From a8e38ced635804ba399d0cbbf1930e08b11f4df6 Mon Sep 17 00:00:00 2001 From: Andrea Amorese Date: Fri, 3 Sep 2021 11:08:54 +0200 Subject: [PATCH] Built motion from commit 3a0e484e.|2.5.345 --- 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 +- server/api/teamVoicePrefix/index.js | 2 +- .../teamVoicePrefix/teamVoicePrefix.attributes.js | 2 +- .../api/teamVoicePrefix/teamVoicePrefix.model.js | 2 +- server/api/teamVoicePrefix/teamVoicePrefix.rpc.js | 2 +- server/api/teamVoiceQueue/index.js | 2 +- .../teamVoiceQueue/teamVoiceQueue.attributes.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.model.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.rpc.js | 2 +- server/api/template/index.js | 2 +- server/api/template/template.attributes.js | 2 +- server/api/template/template.controller.js | 2 +- server/api/template/template.model.js | 2 +- server/api/template/template.rpc.js | 2 +- server/api/trigger/index.js | 2 +- server/api/trigger/trigger.attributes.js | 2 +- server/api/trigger/trigger.controller.js | 2 +- server/api/trigger/trigger.model.js | 2 +- server/api/trigger/trigger.rpc.js | 2 +- server/api/trunk/index.js | 2 +- server/api/trunk/trunk.attributes.js | 2 +- server/api/trunk/trunk.controller.js | 2 +- server/api/trunk/trunk.model.js | 2 +- server/api/trunk/trunk.rpc.js | 2 +- server/api/user/index.js | 2 +- server/api/user/user.attributes.js | 2 +- server/api/user/user.controller.js | 2 +- server/api/user/user.events.js | 2 +- server/api/user/user.model.js | 2 +- server/api/user/user.rpc.js | 2 +- server/api/user/user.socket.js | 2 +- server/api/userChatQueue/index.js | 2 +- .../api/userChatQueue/userChatQueue.attributes.js | 2 +- server/api/userChatQueue/userChatQueue.model.js | 2 +- server/api/userChatQueue/userChatQueue.rpc.js | 2 +- server/api/userFaxQueue/index.js | 2 +- server/api/userFaxQueue/userFaxQueue.attributes.js | 2 +- server/api/userFaxQueue/userFaxQueue.model.js | 2 +- server/api/userFaxQueue/userFaxQueue.rpc.js | 2 +- server/api/userMailQueue/index.js | 2 +- .../api/userMailQueue/userMailQueue.attributes.js | 2 +- server/api/userMailQueue/userMailQueue.model.js | 2 +- server/api/userMailQueue/userMailQueue.rpc.js | 2 +- server/api/userNotification/index.js | 2 +- .../userNotification.attributes.js | 2 +- .../userNotification.controller.js | 2 +- .../userNotification/userNotification.events.js | 2 +- .../api/userNotification/userNotification.model.js | 2 +- .../api/userNotification/userNotification.rpc.js | 2 +- .../userNotification/userNotification.socket.js | 2 +- server/api/userOpenchannelQueue/index.js | 2 +- .../userOpenchannelQueue.attributes.js | 2 +- .../userOpenchannelQueue.model.js | 2 +- .../userOpenchannelQueue.rpc.js | 2 +- server/api/userProfile/index.js | 2 +- server/api/userProfile/userProfile.attributes.js | 2 +- server/api/userProfile/userProfile.controller.js | 2 +- server/api/userProfile/userProfile.events.js | 2 +- server/api/userProfile/userProfile.model.js | 2 +- server/api/userProfile/userProfile.rpc.js | 2 +- server/api/userProfile/userProfile.socket.js | 2 +- server/api/userProfileResource/index.js | 2 +- .../userProfileResource.attributes.js | 2 +- .../userProfileResource.controller.js | 2 +- .../userProfileResource.model.js | 2 +- .../userProfileResource/userProfileResource.rpc.js | 2 +- server/api/userProfileSection/index.js | 2 +- .../userProfileSection.attributes.js | 2 +- .../userProfileSection.controller.js | 2 +- .../userProfileSection/userProfileSection.model.js | 2 +- .../userProfileSection/userProfileSection.rpc.js | 2 +- server/api/userSmsQueue/index.js | 2 +- server/api/userSmsQueue/userSmsQueue.attributes.js | 2 +- server/api/userSmsQueue/userSmsQueue.model.js | 2 +- server/api/userSmsQueue/userSmsQueue.rpc.js | 2 +- server/api/userVoicePrefix/index.js | 2 +- .../userVoicePrefix/userVoicePrefix.attributes.js | 2 +- .../api/userVoicePrefix/userVoicePrefix.model.js | 2 +- server/api/userVoicePrefix/userVoicePrefix.rpc.js | 2 +- server/api/userVoiceQueue/index.js | 2 +- .../userVoiceQueue/userVoiceQueue.attributes.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.model.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.rpc.js | 2 +- server/api/userVoiceQueueRt/index.js | 2 +- .../userVoiceQueueRt.attributes.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.events.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.model.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.rpc.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.socket.js | 2 +- server/api/userWhatsappQueue/index.js | 2 +- .../userWhatsappQueue.attributes.js | 2 +- .../userWhatsappQueue/userWhatsappQueue.model.js | 2 +- .../api/userWhatsappQueue/userWhatsappQueue.rpc.js | 2 +- server/api/variable/index.js | 2 +- server/api/variable/variable.attributes.js | 2 +- server/api/variable/variable.controller.js | 2 +- server/api/variable/variable.model.js | 2 +- server/api/variable/variable.rpc.js | 2 +- server/api/version/index.js | 2 +- server/api/version/version.controller.js | 2 +- server/api/voiceAgentReport/index.js | 2 +- .../voiceAgentReport.attributes.js | 2 +- .../voiceAgentReport.controller.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.model.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.rpc.js | 2 +- server/api/voiceCallReport/index.js | 2 +- .../voiceCallReport/voiceCallReport.attributes.js | 2 +- .../voiceCallReport/voiceCallReport.controller.js | 2 +- .../api/voiceCallReport/voiceCallReport.model.js | 2 +- server/api/voiceCallReport/voiceCallReport.rpc.js | 2 +- server/api/voiceChanSpy/index.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.attributes.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.controller.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.model.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.rpc.js | 2 +- server/api/voiceContext/index.js | 2 +- server/api/voiceContext/voiceContext.attributes.js | 2 +- server/api/voiceContext/voiceContext.controller.js | 2 +- server/api/voiceContext/voiceContext.model.js | 2 +- server/api/voiceContext/voiceContext.rpc.js | 2 +- server/api/voiceDialReport/index.js | 2 +- .../voiceDialReport/voiceDialReport.attributes.js | 2 +- .../voiceDialReport/voiceDialReport.controller.js | 2 +- .../api/voiceDialReport/voiceDialReport.model.js | 2 +- server/api/voiceDialReport/voiceDialReport.rpc.js | 2 +- server/api/voiceExtension/index.js | 2 +- .../voiceExtension/voiceExtension.attributes.js | 2 +- .../voiceExtension/voiceExtension.controller.js | 2 +- server/api/voiceExtension/voiceExtension.events.js | 2 +- server/api/voiceExtension/voiceExtension.model.js | 2 +- server/api/voiceExtension/voiceExtension.rpc.js | 2 +- server/api/voiceExtension/voiceExtension.socket.js | 2 +- server/api/voiceMail/index.js | 2 +- server/api/voiceMail/voiceMail.attributes.js | 2 +- server/api/voiceMail/voiceMail.controller.js | 2 +- server/api/voiceMail/voiceMail.model.js | 2 +- server/api/voiceMail/voiceMail.rpc.js | 2 +- server/api/voiceMailMessage/index.js | 2 +- .../voiceMailMessage.attributes.js | 2 +- .../voiceMailMessage.controller.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.model.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.rpc.js | 2 +- server/api/voiceMusicOnHold/index.js | 2 +- .../voiceMusicOnHold.attributes.js | 2 +- .../voiceMusicOnHold.controller.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.model.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.rpc.js | 2 +- server/api/voicePrefix/index.js | 2 +- server/api/voicePrefix/voicePrefix.attributes.js | 2 +- server/api/voicePrefix/voicePrefix.controller.js | 2 +- server/api/voicePrefix/voicePrefix.events.js | 2 +- server/api/voicePrefix/voicePrefix.model.js | 2 +- server/api/voicePrefix/voicePrefix.rpc.js | 2 +- server/api/voicePrefix/voicePrefix.socket.js | 2 +- server/api/voiceQueue/index.js | 2 +- server/api/voiceQueue/voiceQueue.attributes.js | 2 +- server/api/voiceQueue/voiceQueue.controller.js | 2 +- server/api/voiceQueue/voiceQueue.events.js | 2 +- server/api/voiceQueue/voiceQueue.model.js | 2 +- server/api/voiceQueue/voiceQueue.rpc.js | 2 +- server/api/voiceQueue/voiceQueue.socket.js | 2 +- server/api/voiceQueueReport/index.js | 2 +- .../voiceQueueReport.attributes.js | 2 +- .../voiceQueueReport.controller.js | 2 +- .../voiceQueueReport/voiceQueueReport.events.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.model.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.rpc.js | 2 +- .../voiceQueueReport/voiceQueueReport.socket.js | 2 +- server/api/voiceQueuesLog/index.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.attributes.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.controller.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.model.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.rpc.js | 2 +- server/api/voiceRecording/index.js | 2 +- .../voiceRecording/voiceRecording.attributes.js | 2 +- .../voiceRecording/voiceRecording.controller.js | 2 +- server/api/voiceRecording/voiceRecording.model.js | 2 +- server/api/voiceRecording/voiceRecording.rpc.js | 2 +- server/api/voiceTransferReport/index.js | 2 +- .../voiceTransferReport.attributes.js | 2 +- .../voiceTransferReport.controller.js | 2 +- .../voiceTransferReport.model.js | 2 +- .../voiceTransferReport/voiceTransferReport.rpc.js | 2 +- server/api/webbar/index.js | 2 +- server/api/webbar/webbar.controller.js | 2 +- server/api/whatsappAccount/index.js | 2 +- .../whatsappAccount/whatsappAccount.attributes.js | 2 +- .../whatsappAccount/whatsappAccount.controller.js | 2 +- .../api/whatsappAccount/whatsappAccount.events.js | 2 +- .../api/whatsappAccount/whatsappAccount.model.js | 2 +- server/api/whatsappAccount/whatsappAccount.rpc.js | 2 +- .../api/whatsappAccount/whatsappAccount.socket.js | 2 +- server/api/whatsappApplication/index.js | 2 +- .../whatsappApplication.attributes.js | 2 +- .../whatsappApplication.controller.js | 2 +- .../whatsappApplication.model.js | 2 +- .../whatsappApplication/whatsappApplication.rpc.js | 2 +- server/api/whatsappInteraction/index.js | 2 +- .../whatsappInteraction.attributes.js | 2 +- .../whatsappInteraction.controller.js | 2 +- .../whatsappInteraction.events.js | 2 +- .../whatsappInteraction.model.js | 2 +- .../whatsappInteraction/whatsappInteraction.rpc.js | 2 +- .../whatsappInteraction.socket.js | 2 +- server/api/whatsappMessage/index.js | 2 +- .../whatsappMessage/whatsappMessage.attributes.js | 2 +- .../whatsappMessage/whatsappMessage.controller.js | 2 +- .../api/whatsappMessage/whatsappMessage.events.js | 2 +- .../api/whatsappMessage/whatsappMessage.model.js | 2 +- server/api/whatsappMessage/whatsappMessage.rpc.js | 2 +- .../api/whatsappMessage/whatsappMessage.socket.js | 2 +- server/api/whatsappQueue/index.js | 2 +- .../api/whatsappQueue/whatsappQueue.attributes.js | 2 +- .../api/whatsappQueue/whatsappQueue.controller.js | 2 +- server/api/whatsappQueue/whatsappQueue.events.js | 2 +- server/api/whatsappQueue/whatsappQueue.model.js | 2 +- server/api/whatsappQueue/whatsappQueue.rpc.js | 2 +- server/api/whatsappQueue/whatsappQueue.socket.js | 2 +- server/api/whatsappQueueReport/index.js | 2 +- .../whatsappQueueReport.attributes.js | 2 +- .../whatsappQueueReport.controller.js | 2 +- .../whatsappQueueReport.model.js | 2 +- .../whatsappQueueReport/whatsappQueueReport.rpc.js | 2 +- server/api/whatsappTransferReport/index.js | 2 +- .../whatsappTransferReport.attributes.js | 2 +- .../whatsappTransferReport.controller.js | 2 +- .../whatsappTransferReport.model.js | 2 +- .../whatsappTransferReport.rpc.js | 2 +- server/app.js | 2 +- server/components/auth/service.js | 2 +- server/components/encryptor/index.js | 2 +- server/components/export/csv.js | 2 +- server/components/export/pdf.js | 2 +- server/components/export/xlsx.js | 2 +- server/components/extensions/rewrite.js | 2 +- server/components/import/cm/csv.js | 2 +- server/components/import/cm/csv2.js | 2 +- server/components/integrations/configuration.js | 2 +- server/components/interaction/service.js | 2 +- server/components/license/service.js | 2 +- server/components/parsers/advancedSearch.js | 2 +- server/components/parsers/qs.js | 2 +- server/config/express.js | 2 +- server/config/license/hardware.js | 2 +- server/config/license/index.js | 2 +- server/config/license/util.js | 2 +- server/config/local.env.js | 2 +- server/config/logger.js | 2 +- server/config/pm2/config.js | 2 +- server/config/pm2/index.js | 2 +- server/config/schedule/chat.js | 2 +- server/config/schedule/index.js | 2 +- server/config/schedule/transcribe.js | 2 +- server/config/schedule/whatsapp.js | 2 +- server/config/seedContact.js | 2 +- server/config/seedUsers.js | 2 +- server/config/socketio.js | 2 +- server/config/triggers/index.js | 2 +- server/config/utils.js | 2 +- server/errors/index.js | 2 +- server/mysqldb/index.js | 2 +- server/routes.js | 2 +- server/rpc/index.js | 2 +- server/services/agi/channel.js | 2 +- server/services/agi/error.js | 2 +- server/services/agi/graph/index.js | 2 +- server/services/agi/index.js | 2 +- server/services/agi/mailRpc/index.js | 2 +- server/services/agi/reply.js | 2 +- server/services/agi/rpc/index.js | 2 +- server/services/agi/scripts/aws/index.js | 2 +- server/services/agi/scripts/aws/lex/index.js | 2 +- server/services/agi/scripts/aws/lex/lib/api.js | 2 +- server/services/agi/scripts/aws/polly/index.js | 2 +- server/services/agi/scripts/aws/polly/lib/api.js | 2 +- server/services/agi/scripts/google/asr/index.js | 2 +- server/services/agi/scripts/google/asr/lib/api.js | 2 +- server/services/agi/scripts/google/index.js | 2 +- server/services/agi/scripts/index.js | 2 +- server/services/agi/scripts/sestek/index.js | 2 +- server/services/agi/scripts/sestek/nda/index.js | 2 +- server/services/agi/scripts/tilde/asr/index.js | 2 +- server/services/agi/scripts/tilde/asr/lib/api.js | 2 +- server/services/agi/scripts/tilde/index.js | 2 +- server/services/agi/server.js | 2 +- server/services/agi/vertices.js | 2 +- server/services/ami/acw/index.js | 2 +- server/services/ami/ami.js | 2 +- server/services/ami/client.js | 2 +- server/services/ami/dialer/action.js | 2 +- server/services/ami/dialer/agentComplete.js | 2 +- server/services/ami/dialer/final.js | 2 +- server/services/ami/dialer/hangup.js | 2 +- server/services/ami/dialer/history.js | 2 +- server/services/ami/dialer/index.js | 2 +- server/services/ami/dialer/queueCallerAbandon.js | 2 +- server/services/ami/fax/action.js | 2 +- server/services/ami/fax/index.js | 2 +- server/services/ami/fax/rpcDb.js | 2 +- server/services/ami/fax/util/gs.js | 2 +- server/services/ami/fax/util/util.js | 2 +- server/services/ami/index.js | 2 +- server/services/ami/model/agent.js | 2 +- server/services/ami/model/campaign.js | 2 +- server/services/ami/model/channel.js | 2 +- server/services/ami/model/deskAccount.js | 2 +- server/services/ami/model/dynamics365Account.js | 2 +- server/services/ami/model/faxAccount.js | 2 +- server/services/ami/model/freshdeskAccount.js | 2 +- server/services/ami/model/freshsalesAccount.js | 2 +- server/services/ami/model/queueReport.js | 2 +- server/services/ami/model/salesforceAccount.js | 2 +- server/services/ami/model/servicenowAccount.js | 2 +- server/services/ami/model/sugarcrmAccount.js | 2 +- server/services/ami/model/telephone.js | 2 +- server/services/ami/model/template.js | 2 +- server/services/ami/model/trigger.js | 2 +- server/services/ami/model/trunk.js | 2 +- server/services/ami/model/voiceExtension.js | 2 +- server/services/ami/model/voiceQueue.js | 2 +- server/services/ami/model/vtigerAccount.js | 2 +- server/services/ami/model/zendeskAccount.js | 2 +- server/services/ami/model/zohoAccount.js | 2 +- server/services/ami/preview/action.js | 2 +- server/services/ami/preview/index.js | 2 +- server/services/ami/preview/rpcDb.js | 2 +- server/services/ami/preview/util/util.js | 2 +- server/services/ami/properties.js | 2 +- server/services/ami/realtime/index.js | 2 +- server/services/ami/report/index.js | 2 +- server/services/ami/report/userReport.js | 2 +- server/services/ami/report/voiceAgentReport.js | 2 +- server/services/ami/report/voiceCallReport.js | 2 +- server/services/ami/report/voiceDialReport.js | 2 +- server/services/ami/report/voiceQueueReport.js | 2 +- server/services/ami/rpc/agentReportPreview.js | 2 +- server/services/ami/rpc/attachment.js | 2 +- server/services/ami/rpc/campaign.js | 2 +- server/services/ami/rpc/cmContact.js | 2 +- server/services/ami/rpc/cmHopper.js | 2 +- server/services/ami/rpc/cmHopperBlack.js | 2 +- server/services/ami/rpc/cmHopperFinal.js | 2 +- server/services/ami/rpc/cmHopperHistory.js | 2 +- server/services/ami/rpc/faxAccount.js | 2 +- server/services/ami/rpc/faxMessage.js | 2 +- server/services/ami/rpc/integrations/desk.js | 2 +- .../services/ami/rpc/integrations/dynamics365.js | 2 +- server/services/ami/rpc/integrations/freshdesk.js | 2 +- server/services/ami/rpc/integrations/freshsales.js | 2 +- server/services/ami/rpc/integrations/salesforce.js | 2 +- server/services/ami/rpc/integrations/servicenow.js | 2 +- server/services/ami/rpc/integrations/sugarcrm.js | 2 +- server/services/ami/rpc/integrations/vtiger.js | 2 +- server/services/ami/rpc/integrations/zendesk.js | 2 +- server/services/ami/rpc/integrations/zoho.js | 2 +- server/services/ami/rpc/memberReport.js | 2 +- server/services/ami/rpc/setting.js | 2 +- server/services/ami/rpc/template.js | 2 +- server/services/ami/rpc/trigger.js | 2 +- server/services/ami/rpc/trunk.js | 2 +- server/services/ami/rpc/user.js | 2 +- server/services/ami/rpc/voiceAgentReport.js | 2 +- server/services/ami/rpc/voiceCallReport.js | 2 +- server/services/ami/rpc/voiceDialReport.js | 2 +- server/services/ami/rpc/voiceExtension.js | 2 +- server/services/ami/rpc/voiceQueue.js | 2 +- server/services/ami/rpc/voiceQueueReport.js | 2 +- server/services/ami/rpc/voiceQueueRt.js | 2 +- server/services/ami/rpc/voiceRecording.js | 2 +- server/services/ami/rpc/voiceTransferReport.js | 2 +- server/services/ami/server/index.js | 2 +- server/services/ami/trigger/cmContact/index.js | 2 +- server/services/ami/trigger/index.js | 2 +- server/services/ami/trigger/integration/desk.js | 2 +- .../ami/trigger/integration/dynamics365.js | 2 +- .../services/ami/trigger/integration/freshdesk.js | 2 +- .../services/ami/trigger/integration/freshsales.js | 2 +- server/services/ami/trigger/integration/index.js | 2 +- .../services/ami/trigger/integration/salesforce.js | 2 +- .../services/ami/trigger/integration/servicenow.js | 2 +- .../services/ami/trigger/integration/sugarcrm.js | 2 +- server/services/ami/trigger/integration/util.js | 2 +- server/services/ami/trigger/integration/vtiger.js | 2 +- server/services/ami/trigger/integration/zendesk.js | 2 +- server/services/ami/trigger/integration/zoho.js | 2 +- server/services/ami/trigger/script/index.js | 2 +- server/services/ami/trigger/urlforward/index.js | 2 +- server/services/email/client.js | 2 +- server/services/email/index.js | 2 +- server/services/email/lib/email.js | 2 +- server/services/email/lib/imap.js | 2 +- server/services/email/lib/smtp.js | 2 +- server/services/email/lib/utils.js | 2 +- server/services/email/model/mailAccount.js | 2 +- server/services/email/realtime/index.js | 2 +- server/services/email/rpc/mailAccount.js | 2 +- server/services/email/rpc/setting.js | 2 +- server/services/email/server/index.js | 2 +- server/services/express/index.js | 2 +- server/services/routing/client.js | 2 +- server/services/routing/index.js | 2 +- server/services/routing/lib/rule-engine.js | 2 +- server/services/routing/mailRpc/index.js | 2 +- server/services/routing/model/agent.js | 2 +- server/services/routing/model/chatQueue.js | 2 +- server/services/routing/model/faxQueue.js | 2 +- server/services/routing/model/interval.js | 2 +- server/services/routing/model/mailQueue.js | 2 +- server/services/routing/model/openchannelQueue.js | 2 +- server/services/routing/model/smsQueue.js | 2 +- server/services/routing/model/whatsappQueue.js | 2 +- server/services/routing/realtime/index.js | 2 +- server/services/routing/rpc/chatInteraction.js | 2 +- server/services/routing/rpc/chatMessage.js | 2 +- server/services/routing/rpc/chatQueue.js | 2 +- server/services/routing/rpc/chatQueueReport.js | 2 +- server/services/routing/rpc/faxInteraction.js | 2 +- server/services/routing/rpc/faxMessage.js | 2 +- server/services/routing/rpc/faxQueue.js | 2 +- server/services/routing/rpc/faxQueueReport.js | 2 +- server/services/routing/rpc/interval.js | 2 +- server/services/routing/rpc/mailInteraction.js | 2 +- server/services/routing/rpc/mailMessage.js | 2 +- server/services/routing/rpc/mailQueue.js | 2 +- server/services/routing/rpc/mailQueueReport.js | 2 +- .../services/routing/rpc/openchannelInteraction.js | 2 +- server/services/routing/rpc/openchannelMessage.js | 2 +- server/services/routing/rpc/openchannelQueue.js | 2 +- .../services/routing/rpc/openchannelQueueReport.js | 2 +- server/services/routing/rpc/smsInteraction.js | 2 +- server/services/routing/rpc/smsMessage.js | 2 +- server/services/routing/rpc/smsQueue.js | 2 +- server/services/routing/rpc/smsQueueReport.js | 2 +- server/services/routing/rpc/user.js | 2 +- server/services/routing/rpc/whatsappInteraction.js | 2 +- server/services/routing/rpc/whatsappMessage.js | 2 +- server/services/routing/rpc/whatsappQueue.js | 2 +- server/services/routing/rpc/whatsappQueueReport.js | 2 +- .../services/routing/server/applications/agent.js | 2 +- .../routing/server/applications/amazonlex.js | 2 +- .../routing/server/applications/autoreply.js | 2 +- .../services/routing/server/applications/close.js | 2 +- .../routing/server/applications/dialogflow.js | 2 +- .../routing/server/applications/dialogflowV2.js | 2 +- .../services/routing/server/applications/gotoif.js | 2 +- .../services/routing/server/applications/gotop.js | 2 +- .../routing/server/applications/message.js | 2 +- .../services/routing/server/applications/noop.js | 2 +- .../services/routing/server/applications/queue.js | 2 +- .../routing/server/applications/strategy/agent.js | 2 +- .../server/applications/strategy/beepall.js | 2 +- .../routing/server/applications/strategy/index.js | 2 +- .../server/applications/strategy/rrmemory.js | 2 +- .../routing/server/applications/strategy/util.js | 2 +- .../services/routing/server/applications/system.js | 2 +- server/services/routing/server/applications/tag.js | 2 +- .../services/routing/server/applications/utils.js | 2 +- server/services/routing/server/index.js | 2 +- server/services/routing/server/interval.js | 2 +- server/services/xdr/agents.controller.js | 2 +- server/services/xdr/calls.controller.js | 2 +- server/services/xdr/core.controller.js | 2 +- server/services/xdr/dials.controller.js | 2 +- server/services/xdr/index.js | 2 +- server/services/xdr/members.controller.js | 2 +- server/services/xdr/queues.controller.js | 2 +- server/services/xdr/recordings.controller.js | 2 +- server/services/xdr/transfers.controller.js | 2 +- server/services/xdr/utils.js | 2 +- 1155 files changed, 1155 insertions(+), 1155 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index df4a66e..03ea9b5 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-09-03T08:43:23.987Z", + "time": "2021-09-03T08:57:31.535Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 9d6a311..fd83e3a 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-09-03T08:43:23.987Z", + "time": "2021-09-03T08:57:31.535Z", "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 4e0e197..7718e02 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 _0x6a39=['VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','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]','TEXT','urlForward[body]','sequelize','exports'];(function(_0x24acab,_0x3c8ae3){var _0x3bcae4=function(_0x36d116){while(--_0x36d116){_0x24acab['push'](_0x24acab['shift']());}};_0x3bcae4(++_0x3c8ae3);}(_0x6a39,0x140));var _0x96a3=function(_0x189c9e,_0x1c3b55){_0x189c9e=_0x189c9e-0x0;var _0x3f38ca=_0x6a39[_0x189c9e];return _0x3f38ca;};'use strict';var Sequelize=require(_0x96a3('0x0'));module[_0x96a3('0x1')]={'name':{'type':Sequelize[_0x96a3('0x2')],'get':function(_0x315ac1){return this[_0x96a3('0x3')](_0x96a3('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x96a3('0x5'),_0x96a3('0x6'),_0x96a3('0x7'),_0x96a3('0x8'),_0x96a3('0x9'),_0x96a3('0xa'),_0x96a3('0xb'),_0x96a3('0xc')]],'msg':_0x96a3('0xd')}},'comment':_0x96a3('0xd')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x96a3('0xe')},'data2':{'type':Sequelize[_0x96a3('0xf')](0x1000),'comment':_0x96a3('0x10')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x96a3('0x11')},'data4':{'type':Sequelize[_0x96a3('0xf')](0x1000),'comments':_0x96a3('0x12')},'data5':{'type':Sequelize[_0x96a3('0xf')](0x1000),'comments':_0x96a3('0x13')},'data6':{'type':Sequelize[_0x96a3('0xf')],'comments':_0x96a3('0x14')},'data7':{'type':Sequelize[_0x96a3('0x15')],'comments':_0x96a3('0x16')}}; \ No newline at end of file +var _0x369e=['bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','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]','TEXT','urlForward[body]','sequelize','exports','getDataValue','contactManager','integration','motionbar','urlForward','browser'];(function(_0x454589,_0x3e852e){var _0x468c5c=function(_0xa5b1f5){while(--_0xa5b1f5){_0x454589['push'](_0x454589['shift']());}};_0x468c5c(++_0x3e852e);}(_0x369e,0x174));var _0xe369=function(_0x2fe0ba,_0x63f18a){_0x2fe0ba=_0x2fe0ba-0x0;var _0x3919ff=_0x369e[_0x2fe0ba];return _0x3919ff;};'use strict';var Sequelize=require(_0xe369('0x0'));module[_0xe369('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x1d32a7){return this[_0xe369('0x2')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xe369('0x3'),_0xe369('0x4'),_0xe369('0x5'),'jscripty',_0xe369('0x6'),_0xe369('0x7'),_0xe369('0x8'),_0xe369('0x9')]],'msg':_0xe369('0xa')}},'comment':_0xe369('0xa')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0xe369('0xb')},'data2':{'type':Sequelize[_0xe369('0xc')](0x1000),'comment':_0xe369('0xd')},'data3':{'type':Sequelize[_0xe369('0xc')](0x1000),'comment':_0xe369('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xe369('0xf')},'data5':{'type':Sequelize[_0xe369('0xc')](0x1000),'comments':_0xe369('0x10')},'data6':{'type':Sequelize[_0xe369('0xc')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xe369('0x11')],'comments':_0xe369('0x12')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index c6ae3f2..86e8b1e 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 _0xb90a=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','apply','update','then','destroy','stack','name','send','body','Action','find','params','catch','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware'];(function(_0x23a079,_0xb8c9aa){var _0x53f2a5=function(_0x1b3dc5){while(--_0x1b3dc5){_0x23a079['push'](_0x23a079['shift']());}};_0x53f2a5(++_0xb8c9aa);}(_0xb90a,0x11a));var _0xab90=function(_0x3ec1bd,_0x5813bb){_0x3ec1bd=_0x3ec1bd-0x0;var _0x3d1310=_0xb90a[_0x3ec1bd];return _0x3d1310;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab90('0x0'));var zipdir=require(_0xab90('0x1'));var jsonpatch=require(_0xab90('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xab90('0x3'));var util=require(_0xab90('0x4'));var path=require('path');var sox=require(_0xab90('0x5'));var csv=require(_0xab90('0x6'));var ejs=require(_0xab90('0x7'));var fs=require('fs');var fs_extra=require(_0xab90('0x8'));var _=require(_0xab90('0x9'));var squel=require(_0xab90('0xa'));var crypto=require(_0xab90('0xb'));var jsforce=require(_0xab90('0xc'));var deskjs=require(_0xab90('0xd'));var toCsv=require('to-csv');var querystring=require(_0xab90('0xe'));var Papa=require(_0xab90('0xf'));var Redis=require(_0xab90('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xab90('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab90('0x12'));var logger=require('../../config/logger')(_0xab90('0x13'));var utils=require(_0xab90('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xab90('0x15'));var db=require(_0xab90('0x16'))['db'];function respondWithStatusCode(_0xd5b68e,_0x5367bc){_0x5367bc=_0x5367bc||0xcc;return function(_0x57e195){if(_0x57e195){return _0xd5b68e[_0xab90('0x17')](_0x5367bc);}return _0xd5b68e[_0xab90('0x18')](_0x5367bc)[_0xab90('0x19')]();};}function respondWithResult(_0x4f085e,_0x296c07){_0x296c07=_0x296c07||0xc8;return function(_0x8d26ba){if(_0x8d26ba){return _0x4f085e[_0xab90('0x18')](_0x296c07)['json'](_0x8d26ba);}};}function respondWithFilteredResult(_0x23ce0c,_0x589f7d){return function(_0x1d9d03){if(_0x1d9d03){var _0x16c6b2=typeof _0x589f7d['offset']==='undefined'&&typeof _0x589f7d[_0xab90('0x1a')]===_0xab90('0x1b');var _0x24dbaa=_0x1d9d03[_0xab90('0x1c')];var _0x3aa2ac=_0x16c6b2?0x0:_0x589f7d['offset'];var _0x3dd5e4=_0x16c6b2?_0x1d9d03['count']:_0x589f7d[_0xab90('0x1d')]+_0x589f7d[_0xab90('0x1a')];var _0x5f2bb4;if(_0x3dd5e4>=_0x24dbaa){_0x3dd5e4=_0x24dbaa;_0x5f2bb4=0xc8;}else{_0x5f2bb4=0xce;}_0x23ce0c['status'](_0x5f2bb4);return _0x23ce0c[_0xab90('0x1e')]('Content-Range',_0x3aa2ac+'-'+_0x3dd5e4+'/'+_0x24dbaa)['json'](_0x1d9d03);}return null;};}function patchUpdates(_0x4cc430){return function(_0x3fc66f){try{jsonpatch[_0xab90('0x1f')](_0x3fc66f,_0x4cc430,!![]);}catch(_0x18e343){return BPromise['reject'](_0x18e343);}return _0x3fc66f['save']();};}function saveUpdates(_0x1d2831,_0x49bdb1){return function(_0x3dca2b){if(_0x3dca2b){return _0x3dca2b[_0xab90('0x20')](_0x1d2831)[_0xab90('0x21')](function(_0x45c3c2){return _0x45c3c2;});}return null;};}function removeEntity(_0x2f744e,_0x59b93e){return function(_0xe4c727){if(_0xe4c727){return _0xe4c727[_0xab90('0x22')]()[_0xab90('0x21')](function(){_0x2f744e['status'](0xcc)[_0xab90('0x19')]();});}};}function handleEntityNotFound(_0x464ee2,_0x4a0956){return function(_0x417e19){if(!_0x417e19){_0x464ee2['sendStatus'](0x194);}return _0x417e19;};}function handleError(_0x595924,_0x2d1318){_0x2d1318=_0x2d1318||0x1f4;return function(_0x37f002){logger['error'](_0x37f002[_0xab90('0x23')]);if(_0x37f002[_0xab90('0x24')]){delete _0x37f002[_0xab90('0x24')];}_0x595924['status'](_0x2d1318)[_0xab90('0x25')](_0x37f002);};}exports['update']=function(_0x192d76,_0xbb666c){if(_0x192d76[_0xab90('0x26')]['id']){delete _0x192d76['body']['id'];}return db[_0xab90('0x27')][_0xab90('0x28')]({'where':{'id':_0x192d76[_0xab90('0x29')]['id']}})[_0xab90('0x21')](handleEntityNotFound(_0xbb666c,null))[_0xab90('0x21')](saveUpdates(_0x192d76['body'],null))[_0xab90('0x21')](respondWithResult(_0xbb666c,null))[_0xab90('0x2a')](handleError(_0xbb666c,null));};exports[_0xab90('0x22')]=function(_0x45b013,_0x218e9e){return db[_0xab90('0x27')][_0xab90('0x28')]({'where':{'id':_0x45b013[_0xab90('0x29')]['id']}})[_0xab90('0x21')](handleEntityNotFound(_0x218e9e,null))[_0xab90('0x21')](removeEntity(_0x218e9e,null))[_0xab90('0x2a')](handleError(_0x218e9e,null));}; \ No newline at end of file +var _0x5ad7=['name','body','Action','params','catch','destroy','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','reject','save','update','then','end','error','stack'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x5ad7,0xbb));var _0x75ad=function(_0x5a4661,_0x2c5a37){_0x5a4661=_0x5a4661-0x0;var _0x5c53da=_0x5ad7[_0x5a4661];return _0x5c53da;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x75ad('0x0'));var zipdir=require(_0x75ad('0x1'));var jsonpatch=require(_0x75ad('0x2'));var rp=require(_0x75ad('0x3'));var moment=require(_0x75ad('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x75ad('0x5'));var csv=require(_0x75ad('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75ad('0x7'));var _=require(_0x75ad('0x8'));var squel=require(_0x75ad('0x9'));var crypto=require(_0x75ad('0xa'));var jsforce=require(_0x75ad('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x75ad('0x6'));var querystring=require(_0x75ad('0xc'));var Papa=require(_0x75ad('0xd'));var Redis=require(_0x75ad('0xe'));var authService=require(_0x75ad('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x75ad('0x10'));var hardwareService=require(_0x75ad('0x11'));var logger=require(_0x75ad('0x12'))(_0x75ad('0x13'));var utils=require(_0x75ad('0x14'));var config=require(_0x75ad('0x15'));var licenseUtil=require(_0x75ad('0x16'));var db=require(_0x75ad('0x17'))['db'];function respondWithStatusCode(_0x2c62fe,_0x304ab0){_0x304ab0=_0x304ab0||0xcc;return function(_0x15cb50){if(_0x15cb50){return _0x2c62fe[_0x75ad('0x18')](_0x304ab0);}return _0x2c62fe['status'](_0x304ab0)['end']();};}function respondWithResult(_0x453783,_0x2f308b){_0x2f308b=_0x2f308b||0xc8;return function(_0x5171e0){if(_0x5171e0){return _0x453783[_0x75ad('0x19')](_0x2f308b)[_0x75ad('0x1a')](_0x5171e0);}};}function respondWithFilteredResult(_0x238c19,_0x43ebb4){return function(_0x27b8c5){if(_0x27b8c5){var _0x4e6127=typeof _0x43ebb4['offset']===_0x75ad('0x1b')&&typeof _0x43ebb4[_0x75ad('0x1c')]==='undefined';var _0x5aa1c2=_0x27b8c5[_0x75ad('0x1d')];var _0x4dc318=_0x4e6127?0x0:_0x43ebb4[_0x75ad('0x1e')];var _0x3e80d2=_0x4e6127?_0x27b8c5[_0x75ad('0x1d')]:_0x43ebb4[_0x75ad('0x1e')]+_0x43ebb4[_0x75ad('0x1c')];var _0x10c67e;if(_0x3e80d2>=_0x5aa1c2){_0x3e80d2=_0x5aa1c2;_0x10c67e=0xc8;}else{_0x10c67e=0xce;}_0x238c19[_0x75ad('0x19')](_0x10c67e);return _0x238c19['set']('Content-Range',_0x4dc318+'-'+_0x3e80d2+'/'+_0x5aa1c2)['json'](_0x27b8c5);}return null;};}function patchUpdates(_0xbee655){return function(_0x2d3b54){try{jsonpatch['apply'](_0x2d3b54,_0xbee655,!![]);}catch(_0x3ffeb3){return BPromise[_0x75ad('0x1f')](_0x3ffeb3);}return _0x2d3b54[_0x75ad('0x20')]();};}function saveUpdates(_0x525256,_0x4dab6e){return function(_0x1b1d2a){if(_0x1b1d2a){return _0x1b1d2a[_0x75ad('0x21')](_0x525256)[_0x75ad('0x22')](function(_0x1c1fb5){return _0x1c1fb5;});}return null;};}function removeEntity(_0x3bc2d5,_0x494a27){return function(_0x2adc95){if(_0x2adc95){return _0x2adc95['destroy']()['then'](function(){_0x3bc2d5[_0x75ad('0x19')](0xcc)[_0x75ad('0x23')]();});}};}function handleEntityNotFound(_0x5aaaa2,_0x2d2b31){return function(_0x27f986){if(!_0x27f986){_0x5aaaa2[_0x75ad('0x18')](0x194);}return _0x27f986;};}function handleError(_0x1437ce,_0x21880b){_0x21880b=_0x21880b||0x1f4;return function(_0xe41e72){logger[_0x75ad('0x24')](_0xe41e72[_0x75ad('0x25')]);if(_0xe41e72[_0x75ad('0x26')]){delete _0xe41e72[_0x75ad('0x26')];}_0x1437ce[_0x75ad('0x19')](_0x21880b)['send'](_0xe41e72);};}exports['update']=function(_0x16056f,_0x1eb708){if(_0x16056f[_0x75ad('0x27')]['id']){delete _0x16056f['body']['id'];}return db[_0x75ad('0x28')]['find']({'where':{'id':_0x16056f[_0x75ad('0x29')]['id']}})['then'](handleEntityNotFound(_0x1eb708,null))['then'](saveUpdates(_0x16056f[_0x75ad('0x27')],null))['then'](respondWithResult(_0x1eb708,null))[_0x75ad('0x2a')](handleError(_0x1eb708,null));};exports[_0x75ad('0x2b')]=function(_0x2a7621,_0x2192bf){return db[_0x75ad('0x28')][_0x75ad('0x2c')]({'where':{'id':_0x2a7621[_0x75ad('0x29')]['id']}})[_0x75ad('0x22')](handleEntityNotFound(_0x2192bf,null))[_0x75ad('0x22')](removeEntity(_0x2192bf,null))[_0x75ad('0x2a')](handleError(_0x2192bf,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 5504bd2..4217596 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 _0x59eb=['define','Action','tools_actions','api','moment','bluebird','../../config/environment','exports'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0x59eb,0x14b));var _0xb59e=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x59eb[_0x51c819];return _0x15c5d2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb59e('0x0'));var moment=require(_0xb59e('0x1'));var BPromise=require(_0xb59e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb59e('0x3'));var attributes=require('./action.attributes');module[_0xb59e('0x4')]=function(_0x26b0e9,_0x387557){return _0x26b0e9[_0xb59e('0x5')](_0xb59e('0x6'),attributes,{'tableName':_0xb59e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb882=['tools_actions','../../config/logger','api','bluebird','path','../../config/environment','./action.attributes','exports','Action'];(function(_0x42d2af,_0x3961b5){var _0x1d6d63=function(_0x10833e){while(--_0x10833e){_0x42d2af['push'](_0x42d2af['shift']());}};_0x1d6d63(++_0x3961b5);}(_0xb882,0x118));var _0x2b88=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xb882[_0x3ea913];return _0x2b4f28;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2b88('0x0'))(_0x2b88('0x1'));var moment=require('moment');var BPromise=require(_0x2b88('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b88('0x3'));var rimraf=require('rimraf');var config=require(_0x2b88('0x4'));var attributes=require(_0x2b88('0x5'));module[_0x2b88('0x6')]=function(_0x5aba7c,_0x5819a){return _0x5aba7c['define'](_0x2b88('0x7'),attributes,{'tableName':_0x2b88('0x8'),'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 d0e75de..f51d5a0 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 _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x45cb22,_0x47aae0){var _0x178151=function(_0x3dead5){while(--_0x3dead5){_0x45cb22['push'](_0x45cb22['shift']());}};_0x178151(++_0x47aae0);}(_0x1261,0x144));var _0x1126=function(_0x4fdee1,_0x3f290c){_0x4fdee1=_0x4fdee1-0x0;var _0x87826e=_0x1261[_0x4fdee1];return _0x87826e;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +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(_0x224cda,_0x1f9677){var _0x4fb853=function(_0x36d679){while(--_0x36d679){_0x224cda['push'](_0x224cda['shift']());}};_0x4fb853(++_0x1f9677);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'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 1581956..4a88ca3 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 _0x9108=['util','path','connect-timeout','express','fs-extra','../../config/environment','put','isAuthenticated','update','delete','exports','multer'];(function(_0x5cf767,_0x3f09d1){var _0x41d91c=function(_0x5eb40a){while(--_0x5eb40a){_0x5cf767['push'](_0x5cf767['shift']());}};_0x41d91c(++_0x3f09d1);}(_0x9108,0xef));var _0x8910=function(_0x341ba0,_0x2831d9){_0x341ba0=_0x341ba0-0x0;var _0x12f7fe=_0x9108[_0x341ba0];return _0x12f7fe;};'use strict';var multer=require(_0x8910('0x0'));var util=require(_0x8910('0x1'));var path=require(_0x8910('0x2'));var timeout=require(_0x8910('0x3'));var express=require(_0x8910('0x4'));var router=express['Router']();var fs_extra=require(_0x8910('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8910('0x6'));var controller=require('./action.controller');router[_0x8910('0x7')]('/:id',auth[_0x8910('0x8')](),controller[_0x8910('0x9')]);router[_0x8910('0xa')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8910('0xb')]=router; \ No newline at end of file +var _0xc3e1=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc3e1,0x71));var _0x1c3e=function(_0x398a9a,_0x2c2ce5){_0x398a9a=_0x398a9a-0x0;var _0x4f7346=_0xc3e1[_0x398a9a];return _0x4f7346;};'use strict';var multer=require('multer');var util=require(_0x1c3e('0x0'));var path=require(_0x1c3e('0x1'));var timeout=require(_0x1c3e('0x2'));var express=require(_0x1c3e('0x3'));var router=express[_0x1c3e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1c3e('0x5'));var interaction=require(_0x1c3e('0x6'));var config=require(_0x1c3e('0x7'));var controller=require('./action.controller');router['put'](_0x1c3e('0x8'),auth[_0x1c3e('0x9')](),controller[_0x1c3e('0xa')]);router['delete'](_0x1c3e('0x8'),auth[_0x1c3e('0x9')](),controller[_0x1c3e('0xb')]);module[_0x1c3e('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index aab13cd..44e281d 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 _0x98a8=['sequelize','exports','STRING','TEXT'];(function(_0x3ec167,_0x39b652){var _0x3561fd=function(_0x41e87e){while(--_0x41e87e){_0x3ec167['push'](_0x3ec167['shift']());}};_0x3561fd(++_0x39b652);}(_0x98a8,0x12c));var _0x898a=function(_0x534703,_0x448b6d){_0x534703=_0x534703-0x0;var _0x159802=_0x98a8[_0x534703];return _0x159802;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'name':{'type':Sequelize[_0x898a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x898a('0x2')]},'parent':{'type':Sequelize[_0x898a('0x2')]},'table':{'type':Sequelize[_0x898a('0x2')]},'conditions':{'type':Sequelize[_0x898a('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x687b=['STRING','TEXT','sequelize','exports'];(function(_0xf5b16,_0x47cf1f){var _0x4dccad=function(_0x5f53fa){while(--_0x5f53fa){_0xf5b16['push'](_0xf5b16['shift']());}};_0x4dccad(++_0x47cf1f);}(_0x687b,0x14a));var _0xb687=function(_0x1c0f3d,_0x55a9e2){_0x1c0f3d=_0x1c0f3d-0x0;var _0x4d71a8=_0x687b[_0x1c0f3d];return _0x4d71a8;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'name':{'type':Sequelize[_0xb687('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb687('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xb687('0x3')]},'joins':{'type':Sequelize[_0xb687('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 182f5c4..04428c1 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 _0x4972=['offset','undefined','count','set','Content-Range','apply','save','then','destroy','CustomReports','end','error','stack','name','send','map','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','include','findAll','rows','params','find','catch','create','body','user','role','get','Reports','UserProfileSection','userProfileId','UserProfileResource','update','preview','join','left_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)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','rules','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','AVG(%s)','IS\x20NULL','IS\x20EMPTY','operator','getFields','select','DESC','output','web','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','countTable','COUNT(*)','runReport','IS\x20NOT\x20EMPTY','ValidationErrorItem','Limited\x20Query:','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x4972,0x130));var _0x2497=function(_0x4f3ff8,_0x106de5){_0x4f3ff8=_0x4f3ff8-0x0;var _0x1d326b=_0x4972[_0x4f3ff8];return _0x1d326b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2497('0x0'));var zipdir=require(_0x2497('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2497('0x2'));var moment=require(_0x2497('0x3'));var BPromise=require(_0x2497('0x4'));var Mustache=require(_0x2497('0x5'));var util=require(_0x2497('0x6'));var path=require(_0x2497('0x7'));var sox=require(_0x2497('0x8'));var csv=require('to-csv');var ejs=require(_0x2497('0x9'));var fs=require('fs');var fs_extra=require(_0x2497('0xa'));var _=require('lodash');var squel=require(_0x2497('0xb'));var crypto=require(_0x2497('0xc'));var jsforce=require(_0x2497('0xd'));var deskjs=require(_0x2497('0xe'));var toCsv=require(_0x2497('0xf'));var querystring=require(_0x2497('0x10'));var Papa=require(_0x2497('0x11'));var Redis=require(_0x2497('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2497('0x13'));var as=require(_0x2497('0x14'));var hardwareService=require(_0x2497('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x2497('0x16'));var config=require(_0x2497('0x17'));var licenseUtil=require(_0x2497('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x2497('0x19'))[_0x2497('0x1a')];function respondWithStatusCode(_0x438870,_0x15d96a){_0x15d96a=_0x15d96a||0xcc;return function(_0x3ee478){if(_0x3ee478){return _0x438870[_0x2497('0x1b')](_0x15d96a);}return _0x438870[_0x2497('0x1c')](_0x15d96a)['end']();};}function respondWithResult(_0x23b578,_0xd4752d){_0xd4752d=_0xd4752d||0xc8;return function(_0x3ff8fb){if(_0x3ff8fb){return _0x23b578[_0x2497('0x1c')](_0xd4752d)[_0x2497('0x1d')](_0x3ff8fb);}};}function respondWithFilteredResult(_0x519d70,_0x5420d2){return function(_0x3a45d9){if(_0x3a45d9){var _0x3a2e6c=typeof _0x5420d2[_0x2497('0x1e')]===_0x2497('0x1f')&&typeof _0x5420d2['limit']===_0x2497('0x1f');var _0x4c94ad=_0x3a45d9[_0x2497('0x20')];var _0x59ec89=_0x3a2e6c?0x0:_0x5420d2[_0x2497('0x1e')];var _0xafea66=_0x3a2e6c?_0x3a45d9['count']:_0x5420d2[_0x2497('0x1e')]+_0x5420d2['limit'];var _0x3f491f;if(_0xafea66>=_0x4c94ad){_0xafea66=_0x4c94ad;_0x3f491f=0xc8;}else{_0x3f491f=0xce;}_0x519d70[_0x2497('0x1c')](_0x3f491f);return _0x519d70[_0x2497('0x21')](_0x2497('0x22'),_0x59ec89+'-'+_0xafea66+'/'+_0x4c94ad)[_0x2497('0x1d')](_0x3a45d9);}return null;};}function patchUpdates(_0x37729e){return function(_0xf80b8d){try{jsonpatch[_0x2497('0x23')](_0xf80b8d,_0x37729e,!![]);}catch(_0x1e082a){return BPromise['reject'](_0x1e082a);}return _0xf80b8d[_0x2497('0x24')]();};}function saveUpdates(_0x4bc8d0,_0x53a027){return function(_0x103d8d){if(_0x103d8d){return _0x103d8d['update'](_0x4bc8d0)[_0x2497('0x25')](function(_0x58f7ef){return _0x58f7ef;});}return null;};}function removeEntity(_0x439e10,_0x2f6036){return function(_0x20d0f3){if(_0x20d0f3){return _0x20d0f3[_0x2497('0x26')]()[_0x2497('0x25')](function(){var _0x557b5f=_0x20d0f3['get']({'plain':!![]});var _0x5bfe44=_0x2497('0x27');return db['UserProfileResource'][_0x2497('0x26')]({'where':{'type':_0x5bfe44,'resourceId':_0x557b5f['id']}})[_0x2497('0x25')](function(){return _0x20d0f3;});})['then'](function(){_0x439e10[_0x2497('0x1c')](0xcc)[_0x2497('0x28')]();});}};}function handleEntityNotFound(_0x42b75a,_0x3f5012){return function(_0x323514){if(!_0x323514){_0x42b75a['sendStatus'](0x194);}return _0x323514;};}function handleError(_0x58187d,_0x4d0e97){_0x4d0e97=_0x4d0e97||0x1f4;return function(_0x419c9b){logger[_0x2497('0x29')](_0x419c9b[_0x2497('0x2a')]);if(_0x419c9b[_0x2497('0x2b')]){delete _0x419c9b[_0x2497('0x2b')];}_0x58187d[_0x2497('0x1c')](_0x4d0e97)[_0x2497('0x2c')](_0x419c9b);};}exports['index']=function(_0x1e3f3f,_0x48ba0c){var _0x40ef4c={},_0xdfd2a2={},_0x1372b0={'count':0x0,'rows':[]};var _0x1ac329=_[_0x2497('0x2d')](db['AnalyticCustomReport'][_0x2497('0x2e')],function(_0x3e5cc6){return{'name':_0x3e5cc6[_0x2497('0x2f')],'type':_0x3e5cc6['type']['key']};});_0xdfd2a2['model']=_[_0x2497('0x2d')](_0x1ac329,_0x2497('0x2b'));_0xdfd2a2[_0x2497('0x30')]=_[_0x2497('0x31')](_0x1e3f3f[_0x2497('0x30')]);_0xdfd2a2[_0x2497('0x32')]=_[_0x2497('0x33')](_0xdfd2a2['model'],_0xdfd2a2[_0x2497('0x30')]);_0x40ef4c['attributes']=_[_0x2497('0x33')](_0xdfd2a2[_0x2497('0x34')],qs[_0x2497('0x35')](_0x1e3f3f[_0x2497('0x30')][_0x2497('0x35')]));_0x40ef4c[_0x2497('0x36')]=_0x40ef4c[_0x2497('0x36')][_0x2497('0x37')]?_0x40ef4c[_0x2497('0x36')]:_0xdfd2a2[_0x2497('0x34')];if(!_0x1e3f3f[_0x2497('0x30')]['hasOwnProperty'](_0x2497('0x38'))){_0x40ef4c[_0x2497('0x39')]=qs['limit'](_0x1e3f3f[_0x2497('0x30')][_0x2497('0x39')]);_0x40ef4c['offset']=qs['offset'](_0x1e3f3f[_0x2497('0x30')]['offset']);}_0x40ef4c[_0x2497('0x3a')]=qs[_0x2497('0x3b')](_0x1e3f3f['query'][_0x2497('0x3b')]);_0x40ef4c[_0x2497('0x3c')]=qs[_0x2497('0x32')](_[_0x2497('0x3d')](_0x1e3f3f[_0x2497('0x30')],_0xdfd2a2[_0x2497('0x32')]),_0x1ac329);if(_0x1e3f3f[_0x2497('0x30')][_0x2497('0x3e')]){_0x40ef4c[_0x2497('0x3c')]=_[_0x2497('0x3f')](_0x40ef4c['where'],{'$or':_['map'](_0x1ac329,function(_0x507cb9){if(_0x507cb9['type']!==_0x2497('0x40')){var _0x542f46={};_0x542f46[_0x507cb9[_0x2497('0x2b')]]={'$like':'%'+_0x1e3f3f[_0x2497('0x30')][_0x2497('0x3e')]+'%'};return _0x542f46;}})});}_0x40ef4c=_[_0x2497('0x3f')]({},_0x40ef4c,_0x1e3f3f[_0x2497('0x41')]);var _0x3892d3={'where':_0x40ef4c[_0x2497('0x3c')]};return db[_0x2497('0x42')]['count'](_0x3892d3)[_0x2497('0x25')](function(_0x3b4dcc){_0x1372b0[_0x2497('0x20')]=_0x3b4dcc;if(_0x1e3f3f['query'][_0x2497('0x43')]){_0x40ef4c[_0x2497('0x44')]=[{'all':!![]}];}return db[_0x2497('0x42')][_0x2497('0x45')](_0x40ef4c);})[_0x2497('0x25')](function(_0x27f928){_0x1372b0[_0x2497('0x46')]=_0x27f928;return _0x1372b0;})['then'](respondWithFilteredResult(_0x48ba0c,_0x40ef4c))['catch'](handleError(_0x48ba0c,null));};exports['show']=function(_0x3e07ac,_0x11383a){var _0x11cbfa={'raw':![],'where':{'id':_0x3e07ac[_0x2497('0x47')]['id']}},_0x1f0e2e={};_0x1f0e2e[_0x2497('0x34')]=_[_0x2497('0x31')](db['AnalyticCustomReport'][_0x2497('0x2e')]);_0x1f0e2e['query']=_[_0x2497('0x31')](_0x3e07ac[_0x2497('0x30')]);_0x1f0e2e[_0x2497('0x32')]=_[_0x2497('0x33')](_0x1f0e2e[_0x2497('0x34')],_0x1f0e2e[_0x2497('0x30')]);_0x11cbfa[_0x2497('0x36')]=_[_0x2497('0x33')](_0x1f0e2e[_0x2497('0x34')],qs[_0x2497('0x35')](_0x3e07ac[_0x2497('0x30')][_0x2497('0x35')]));_0x11cbfa[_0x2497('0x36')]=_0x11cbfa[_0x2497('0x36')][_0x2497('0x37')]?_0x11cbfa[_0x2497('0x36')]:_0x1f0e2e[_0x2497('0x34')];if(_0x3e07ac[_0x2497('0x30')]['includeAll']){_0x11cbfa[_0x2497('0x44')]=[{'all':!![]}];}_0x11cbfa=_['merge']({},_0x11cbfa,_0x3e07ac[_0x2497('0x41')]);return db[_0x2497('0x42')][_0x2497('0x48')](_0x11cbfa)['then'](handleEntityNotFound(_0x11383a,null))[_0x2497('0x25')](respondWithResult(_0x11383a,null))[_0x2497('0x49')](handleError(_0x11383a,null));};exports['create']=function(_0x4c32f4,_0x23b9e4){return db[_0x2497('0x42')][_0x2497('0x4a')](_0x4c32f4[_0x2497('0x4b')],{})[_0x2497('0x25')](function(_0x3e34bb){var _0xb08d90=_0x4c32f4[_0x2497('0x4c')]['get']({'plain':!![]});if(!_0xb08d90)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb08d90[_0x2497('0x4d')]===_0x2497('0x4c')){var _0x1cfe13=_0x3e34bb[_0x2497('0x4e')]({'plain':!![]});var _0xd70cf=_0x2497('0x4f');return db[_0x2497('0x50')][_0x2497('0x48')]({'where':{'name':_0xd70cf,'userProfileId':_0xb08d90[_0x2497('0x51')]},'raw':!![]})[_0x2497('0x25')](function(_0x132679){if(_0x132679&&_0x132679['autoAssociation']===0x0){return db[_0x2497('0x52')]['create']({'name':_0x1cfe13['name'],'resourceId':_0x1cfe13['id'],'type':_0x2497('0x27'),'sectionId':_0x132679['id']},{})[_0x2497('0x25')](function(){return _0x3e34bb;});}else{return _0x3e34bb;}})[_0x2497('0x49')](function(_0x5ba22b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ba22b);throw _0x5ba22b;});}return _0x3e34bb;})[_0x2497('0x25')](respondWithResult(_0x23b9e4,0xc9))[_0x2497('0x49')](handleError(_0x23b9e4,null));};exports[_0x2497('0x53')]=function(_0x59f57a,_0x3c7b5e){if(_0x59f57a[_0x2497('0x4b')]['id']){delete _0x59f57a[_0x2497('0x4b')]['id'];}return db[_0x2497('0x42')][_0x2497('0x48')]({'where':{'id':_0x59f57a[_0x2497('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c7b5e,null))['then'](saveUpdates(_0x59f57a[_0x2497('0x4b')],null))[_0x2497('0x25')](respondWithResult(_0x3c7b5e,null))[_0x2497('0x49')](handleError(_0x3c7b5e,null));};exports[_0x2497('0x26')]=function(_0x1f719f,_0x3dac4c){return db[_0x2497('0x42')][_0x2497('0x48')]({'where':{'id':_0x1f719f[_0x2497('0x47')]['id']}})['then'](handleEntityNotFound(_0x3dac4c,null))[_0x2497('0x25')](removeEntity(_0x3dac4c,null))['catch'](handleError(_0x3dac4c,null));};exports[_0x2497('0x54')]=function(_0x5b501e,_0x2338de){var _0x5f18c3=0xa;var _0x21cd30=[_0x2497('0x55'),_0x2497('0x56'),_0x2497('0x57'),_0x2497('0x58')];var _0xe52239={'SUM':_0x2497('0x59'),'COUNT':_0x2497('0x5a'),'COUNT DISTINCT':_0x2497('0x5b'),'MAX':_0x2497('0x5c'),'MIN':_0x2497('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x2497('0x5e'),'GROUP_CONCAT ASC':_0x2497('0x5f'),'GROUP_CONCAT DESC':_0x2497('0x60')};var _0x42daeb={'SEC_TO_TIME':_0x2497('0x61'),'DATE':_0x2497('0x62'),'HOUR':_0x2497('0x63'),'ROUND':_0x2497('0x64'),'UNIX_TIMESTAMP':_0x2497('0x65')};var _0x307a81=function(_0x2570e8){return!_[_0x2497('0x66')](['IS\x20NULL',_0x2497('0x67'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x2570e8);};var _0xb6c2d2=function(_0x68eae9){if(!_0x68eae9||!_0x68eae9[_0x2497('0x68')][_0x2497('0x37')]){return'';}for(var _0x1dd22b='(',_0x456dba=0x0;_0x456dba<_0x68eae9[_0x2497('0x68')][_0x2497('0x37')];_0x456dba+=0x1){_0x456dba>0x0&&(_0x1dd22b+='\x20'+_0x68eae9['operator']+'\x20');_0x1dd22b+=_0x68eae9['rules'][_0x456dba]['group']?_0xb6c2d2(_0x68eae9[_0x2497('0x68')][_0x456dba][_0x2497('0x69')]):_0x68eae9['rules'][_0x456dba][_0x2497('0x6a')]+'\x20'+_0x68eae9[_0x2497('0x68')][_0x456dba][_0x2497('0x6b')]+(_0x307a81(_0x68eae9[_0x2497('0x68')][_0x456dba][_0x2497('0x6b')])?'\x20'+_0x68eae9[_0x2497('0x68')][_0x456dba][_0x2497('0x6c')]:'');}return _0x1dd22b+')';};var _0x15829e={'where':{'id':_0x5b501e[_0x2497('0x47')]['id']}},_0x54cf22,_0x467c46,_0x261bc1,_0x2ea22c,_0x5b0c0b;_0x15829e=_[_0x2497('0x3f')]({},_0x15829e,_0x5b501e[_0x2497('0x41')]);return db[_0x2497('0x42')]['find'](_0x15829e)[_0x2497('0x25')](function(_0x37ce45){if(_0x37ce45){_0x54cf22=_0x37ce45;return _0x37ce45['getFields']();}return null;})[_0x2497('0x25')](function(_0x140875){if(_0x140875){if(!_0x140875[_0x2497('0x37')]){throw new db[(_0x2497('0x6d'))]['ValidationErrorItem'](_0x2497('0x6e'),0x193);}_0x467c46=_0x140875;return db[_0x2497('0x6f')][_0x2497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x3f97b7){if(_0x3f97b7){_0x261bc1=_[_0x2497('0x70')](_0x3f97b7,'id');var _0x50c870;var _0x4c0702=squel['select']();_0x4c0702[_0x2497('0x71')](_0x54cf22[_0x2497('0x72')]);for(var _0x53cced=0x0;_0x53cced<_0x467c46[_0x2497('0x37')];_0x53cced+=0x1){_0x50c870=_0x467c46[_0x53cced]['MetricId']?_0x261bc1[_0x467c46[_0x53cced][_0x2497('0x73')]][_0x2497('0x74')]:_0x467c46[_0x53cced][_0x2497('0x6a')];_0x50c870=_0x467c46[_0x53cced][_0x2497('0x75')]?_[_0x2497('0x76')](_0xe52239[_0x467c46[_0x53cced][_0x2497('0x75')]],'%s',_0x50c870):_0x50c870;_0x50c870=_0x467c46[_0x53cced][_0x2497('0x77')]?_[_0x2497('0x76')](_0x42daeb[_0x467c46[_0x53cced][_0x2497('0x77')]],'%s',_0x50c870):_0x50c870;if(_0x467c46[_0x53cced][_0x2497('0x78')]){_0x4c0702[_0x2497('0x69')](_0x50c870);}_0x467c46[_0x53cced]['orderBy']&&_0x4c0702[_0x2497('0x3a')](_0x50c870,_0x467c46[_0x53cced][_0x2497('0x79')]==='DESC'?![]:!![]);_0x4c0702[_0x2497('0x6a')](_0x50c870,_0x467c46[_0x53cced][_0x2497('0x7a')]||_0x50c870);}if(_0x54cf22['joins']){_0x54cf22[_0x2497('0x7b')]=JSON[_0x2497('0x7c')](_0x54cf22[_0x2497('0x7b')]);for(var _0x3c447a=0x0;_0x3c447a<_0x54cf22['joins'][_0x2497('0x37')];_0x3c447a+=0x1){if(_0x54cf22[_0x2497('0x7b')][_0x3c447a][_0x2497('0x7d')]&&_[_0x2497('0x66')](_0x21cd30,_0x54cf22[_0x2497('0x7b')][_0x3c447a][_0x2497('0x7d')])&&_0x54cf22[_0x2497('0x7b')][_0x3c447a][_0x2497('0x7e')]&&_0x54cf22[_0x2497('0x7b')][_0x3c447a][_0x2497('0x7f')]&&_0x54cf22[_0x2497('0x7b')][_0x3c447a][_0x2497('0x80')]){_0x4c0702[_0x54cf22[_0x2497('0x7b')][_0x3c447a][_0x2497('0x7d')]](_0x54cf22[_0x2497('0x7b')][_0x3c447a][_0x2497('0x7f')],null,util[_0x2497('0x77')](_0x2497('0x81'),_0x54cf22[_0x2497('0x72')],_0x54cf22[_0x2497('0x7b')][_0x3c447a][_0x2497('0x7e')],_0x54cf22[_0x2497('0x7b')][_0x3c447a][_0x2497('0x7f')],_0x54cf22['joins'][_0x3c447a][_0x2497('0x80')]));}}}if(_0x54cf22['conditions']){_0x54cf22[_0x2497('0x82')]=JSON['parse'](_0x54cf22['conditions']);_0x4c0702[_0x2497('0x3c')](_0xb6c2d2(_0x54cf22[_0x2497('0x82')][_0x2497('0x69')]));}_0x5b0c0b=_0x4c0702[_0x2497('0x83')]();_0x4c0702['limit'](_0x5f18c3);_0x4c0702['offset'](0x0);logger[_0x2497('0x84')]('Limited\x20Query:',_0x4c0702['toString']());return dbH['sequelize'][_0x2497('0x30')](_0x4c0702[_0x2497('0x85')](),{'type':dbH[_0x2497('0x86')][_0x2497('0x87')][_0x2497('0x88')]});}})[_0x2497('0x25')](respondWithResult(_0x2338de,null))[_0x2497('0x49')](handleError(_0x2338de,null));};function runReport(_0x3501b0,_0x197b5e,_0x1c0e3f){var _0x5e6e96=_0x197b5e['name'];var _0x5fb60e=0xa;var _0x4c69d7=['join',_0x2497('0x56'),_0x2497('0x57'),_0x2497('0x58')];var _0x23b84f={'SUM':_0x2497('0x59'),'COUNT':_0x2497('0x5a'),'COUNT DISTINCT':_0x2497('0x5b'),'MAX':_0x2497('0x5c'),'MIN':'MIN(%s)','AVG':_0x2497('0x89'),'GROUP_CONCAT':_0x2497('0x5e'),'GROUP_CONCAT ASC':_0x2497('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xfd2952={'SEC_TO_TIME':_0x2497('0x61'),'DATE':_0x2497('0x62'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x2497('0x65')};var _0x4134dc=function(_0x22f8e0){return!_['includes']([_0x2497('0x8a'),'IS\x20NOT\x20NULL',_0x2497('0x8b'),'IS\x20NOT\x20EMPTY'],_0x22f8e0);};var _0xca78ac=function(_0x3fdb51){if(!_0x3fdb51||!_0x3fdb51[_0x2497('0x68')]['length']){return'';}for(var _0x51ed0d='(',_0x2b2651=0x0;_0x2b2651<_0x3fdb51[_0x2497('0x68')]['length'];_0x2b2651+=0x1){_0x2b2651>0x0&&(_0x51ed0d+='\x20'+_0x3fdb51[_0x2497('0x8c')]+'\x20');_0x51ed0d+=_0x3fdb51[_0x2497('0x68')][_0x2b2651][_0x2497('0x69')]?_0xca78ac(_0x3fdb51['rules'][_0x2b2651][_0x2497('0x69')]):_0x3fdb51[_0x2497('0x68')][_0x2b2651]['field']+'\x20'+_0x3fdb51['rules'][_0x2b2651]['condition']+(_0x4134dc(_0x3fdb51['rules'][_0x2b2651][_0x2497('0x6b')])?'\x20'+_0x3fdb51[_0x2497('0x68')][_0x2b2651][_0x2497('0x6c')]:'');}return _0x51ed0d+')';};var _0x3e62ed={'where':{'id':_0x3501b0['id']}},_0x3865e0,_0x43c727,_0x260e9e,_0xf6e5d9,_0x5b9e7e;_0x3e62ed=_[_0x2497('0x3f')]({},_0x3e62ed,_0x1c0e3f);return db['AnalyticCustomReport'][_0x2497('0x48')](_0x3e62ed)[_0x2497('0x25')](function(_0x2cb48b){if(_0x2cb48b){_0x3865e0=_0x2cb48b;return _0x2cb48b[_0x2497('0x8d')]();}return null;})[_0x2497('0x25')](function(_0x2c47de){if(_0x2c47de){if(!_0x2c47de[_0x2497('0x37')]){throw new db[(_0x2497('0x6d'))]['ValidationErrorItem'](_0x2497('0x6e'),0x193);}_0x43c727=_0x2c47de;return db[_0x2497('0x6f')][_0x2497('0x45')]({'raw':!![]});}return null;})[_0x2497('0x25')](function(_0x3a5e72){if(_0x3a5e72){_0x260e9e=_['keyBy'](_0x3a5e72,'id');var _0x1176b6;var _0x47491d=squel[_0x2497('0x8e')]();_0x47491d[_0x2497('0x71')](_0x3865e0[_0x2497('0x72')]);for(var _0x38c775=0x0;_0x38c775<_0x43c727[_0x2497('0x37')];_0x38c775+=0x1){_0x1176b6=_0x43c727[_0x38c775][_0x2497('0x73')]?_0x260e9e[_0x43c727[_0x38c775]['MetricId']]['metric']:_0x43c727[_0x38c775][_0x2497('0x6a')];_0x1176b6=_0x43c727[_0x38c775][_0x2497('0x75')]?_[_0x2497('0x76')](_0x23b84f[_0x43c727[_0x38c775][_0x2497('0x75')]],'%s',_0x1176b6):_0x1176b6;_0x1176b6=_0x43c727[_0x38c775][_0x2497('0x77')]?_[_0x2497('0x76')](_0xfd2952[_0x43c727[_0x38c775]['format']],'%s',_0x1176b6):_0x1176b6;if(_0x43c727[_0x38c775][_0x2497('0x78')]){_0x47491d['group'](_0x1176b6);}_0x43c727[_0x38c775][_0x2497('0x79')]&&_0x47491d[_0x2497('0x3a')](_0x1176b6,_0x43c727[_0x38c775]['orderBy']===_0x2497('0x8f')?![]:!![]);_0x47491d[_0x2497('0x6a')](_0x1176b6,_0x43c727[_0x38c775][_0x2497('0x7a')]||_0x1176b6);}if(_0x3865e0[_0x2497('0x7b')]){_0x3865e0[_0x2497('0x7b')]=JSON['parse'](_0x3865e0[_0x2497('0x7b')]);for(var _0x4af09a=0x0;_0x4af09a<_0x3865e0[_0x2497('0x7b')][_0x2497('0x37')];_0x4af09a+=0x1){if(_0x3865e0[_0x2497('0x7b')][_0x4af09a][_0x2497('0x7d')]&&_['includes'](_0x4c69d7,_0x3865e0[_0x2497('0x7b')][_0x4af09a]['type'])&&_0x3865e0[_0x2497('0x7b')][_0x4af09a][_0x2497('0x7e')]&&_0x3865e0[_0x2497('0x7b')][_0x4af09a]['foreignTable']&&_0x3865e0[_0x2497('0x7b')][_0x4af09a][_0x2497('0x80')]){_0x47491d[_0x3865e0[_0x2497('0x7b')][_0x4af09a][_0x2497('0x7d')]](_0x3865e0[_0x2497('0x7b')][_0x4af09a]['foreignTable'],null,util[_0x2497('0x77')](_0x2497('0x81'),_0x3865e0['table'],_0x3865e0[_0x2497('0x7b')][_0x4af09a][_0x2497('0x7e')],_0x3865e0[_0x2497('0x7b')][_0x4af09a][_0x2497('0x7f')],_0x3865e0[_0x2497('0x7b')][_0x4af09a][_0x2497('0x80')]));}}}if(_0x3865e0[_0x2497('0x82')]){_0x3865e0[_0x2497('0x82')]=JSON[_0x2497('0x7c')](_0x3865e0[_0x2497('0x82')]);_0x47491d[_0x2497('0x3c')](_0xca78ac(_0x3865e0[_0x2497('0x82')][_0x2497('0x69')]));}_0x5b9e7e=_0x47491d[_0x2497('0x83')]();_0x47491d[_0x2497('0x39')](_0x5fb60e);_0x47491d[_0x2497('0x1e')](0x0);return;}})[_0x2497('0x25')](function(){if(_0x197b5e[_0x2497('0x90')]===_0x2497('0x91')){return null;}var _0x5d212c=_[_0x2497('0x3f')](_0x197b5e,{'name':_0x197b5e['fullPath']||_0x197b5e['name']||_0x3865e0[_0x2497('0x2b')],'basename':_0x5e6e96,'savename':util['format'](_0x2497('0x92'),_0x197b5e['name']||_0x3865e0['name'],require(_0x2497('0x93'))[_0x2497('0x94')](0x4),_0x197b5e['output']||_0x2497('0x95')),'reportId':_0x3865e0['id'],'reportType':_0x2497('0x96')});return db[_0x2497('0x97')][_0x2497('0x4a')](_0x5d212c,{'raw':!![]});})[_0x2497('0x25')](function(_0x179cbb){if(_0x3865e0[_0x2497('0x72')]===_0x2497('0x98')){_0x5b9e7e[_0x2497('0x3c')](_0x3865e0[_0x2497('0x72')]+_0x2497('0x99'),_0x197b5e[_0x2497('0x9a')],_0x197b5e[_0x2497('0x9b')]);}else{_0x5b9e7e[_0x2497('0x3c')](_0x3865e0[_0x2497('0x72')]+_0x2497('0x9c'),_0x197b5e[_0x2497('0x9a')],_0x197b5e[_0x2497('0x9b')]);}if(_0x179cbb){logger['info'](_0x2497('0x9d'),_0x5b9e7e[_0x2497('0x85')]());require(_0x2497('0x9e'))[_0x2497('0x9f')](path[_0x2497('0x55')](__dirname,_0x2497('0xa0'),_0x179cbb['output']),[_0x179cbb['id'],_0x5b9e7e[_0x2497('0x85')](),path[_0x2497('0x55')](__dirname,'../../files/reports',_0x179cbb['savename']),_0x5e6e96]);return _0x179cbb;}else{var _0x49b240=squel[_0x2497('0x8e')]();_0x49b240['from']('('+_0x5b9e7e[_0x2497('0x85')]()+')',_0x2497('0xa1'));_0x49b240['field'](_0x2497('0xa2'),_0x2497('0x20'));_0x5b9e7e[_0x2497('0x39')](_0x197b5e['limit']||_0x5fb60e);_0x5b9e7e[_0x2497('0x1e')](_0x197b5e[_0x2497('0x1e')]||0x0);return dbH['sequelize']['query'](_0x49b240[_0x2497('0x85')](),{'type':dbH[_0x2497('0x86')][_0x2497('0x87')][_0x2497('0x88')]})[_0x2497('0x25')](function(_0x4ae38c){if(!_0x4ae38c[_0x2497('0x37')]){_0xf6e5d9=0x0;}else{_0xf6e5d9=_0x4ae38c[0x0][_0x2497('0x20')]||0x0;}return dbH[_0x2497('0x86')][_0x2497('0x30')](_0x5b9e7e['toString'](),{'type':dbH['sequelize'][_0x2497('0x87')][_0x2497('0x88')]});})[_0x2497('0x25')](function(_0x119dc1){return{'rows':_0x119dc1||[],'count':_0xf6e5d9};});}});}exports['run']=function(_0x44ecec,_0x4eb5b9){return runReport(_0x44ecec[_0x2497('0x47')],_0x44ecec[_0x2497('0x30')],_0x44ecec[_0x2497('0x41')])[_0x2497('0x25')](respondWithResult(_0x4eb5b9,null))[_0x2497('0x49')](handleError(_0x4eb5b9,null));};exports[_0x2497('0xa3')]=runReport;exports[_0x2497('0x30')]=function(_0x130370,_0x3af423){var _0x43a2f0=0xa;var _0x6ce25d=['join',_0x2497('0x56'),_0x2497('0x57'),_0x2497('0x58')];var _0x8c4a86={'SUM':_0x2497('0x59'),'COUNT':_0x2497('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x2497('0x5c'),'MIN':_0x2497('0x5d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x2497('0x5e'),'GROUP_CONCAT ASC':_0x2497('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34f40d={'SEC_TO_TIME':_0x2497('0x61'),'DATE':_0x2497('0x62'),'HOUR':_0x2497('0x63'),'ROUND':_0x2497('0x64'),'UNIX_TIMESTAMP':_0x2497('0x65')};var _0x345158=function(_0x53a51d){return!_['includes']([_0x2497('0x8a'),_0x2497('0x67'),_0x2497('0x8b'),_0x2497('0xa4')],_0x53a51d);};var _0x3ba49f=function(_0x18d8a3){if(!_0x18d8a3||!_0x18d8a3[_0x2497('0x68')][_0x2497('0x37')]){return'';}for(var _0x23d75b='(',_0x2e7eaf=0x0;_0x2e7eaf<_0x18d8a3['rules'][_0x2497('0x37')];_0x2e7eaf+=0x1){_0x2e7eaf>0x0&&(_0x23d75b+='\x20'+_0x18d8a3['operator']+'\x20');_0x23d75b+=_0x18d8a3['rules'][_0x2e7eaf][_0x2497('0x69')]?_0x3ba49f(_0x18d8a3['rules'][_0x2e7eaf]['group']):_0x18d8a3['rules'][_0x2e7eaf][_0x2497('0x6a')]+'\x20'+_0x18d8a3[_0x2497('0x68')][_0x2e7eaf][_0x2497('0x6b')]+(_0x345158(_0x18d8a3[_0x2497('0x68')][_0x2e7eaf][_0x2497('0x6b')])?'\x20'+_0x18d8a3[_0x2497('0x68')][_0x2e7eaf][_0x2497('0x6c')]:'');}return _0x23d75b+')';};var _0x43e0a5={'where':{'id':_0x130370[_0x2497('0x47')]['id']}},_0x30bdbf,_0x345b80,_0x52fb8e,_0x3d4a20,_0x2fd295;_0x43e0a5=_[_0x2497('0x3f')]({},_0x43e0a5,_0x130370['options']);return db[_0x2497('0x42')][_0x2497('0x48')](_0x43e0a5)[_0x2497('0x25')](function(_0x5caa7a){if(_0x5caa7a){_0x30bdbf=_0x5caa7a;return _0x5caa7a[_0x2497('0x8d')]();}return null;})['then'](function(_0x31464a){if(_0x31464a){if(!_0x31464a['length']){throw new db['Sequelize'][(_0x2497('0xa5'))](_0x2497('0x6e'),0x193);}_0x345b80=_0x31464a;return db[_0x2497('0x6f')][_0x2497('0x45')]({'raw':!![]});}return null;})[_0x2497('0x25')](function(_0x24210a){if(_0x24210a){_0x52fb8e=_[_0x2497('0x70')](_0x24210a,'id');var _0x39566e;var _0x2c75fe=squel[_0x2497('0x8e')]();_0x2c75fe[_0x2497('0x71')](_0x30bdbf[_0x2497('0x72')]);for(var _0x19baa2=0x0;_0x19baa2<_0x345b80[_0x2497('0x37')];_0x19baa2+=0x1){_0x39566e=_0x345b80[_0x19baa2]['MetricId']?_0x52fb8e[_0x345b80[_0x19baa2][_0x2497('0x73')]][_0x2497('0x74')]:_0x345b80[_0x19baa2]['field'];_0x39566e=_0x345b80[_0x19baa2][_0x2497('0x75')]?_[_0x2497('0x76')](_0x8c4a86[_0x345b80[_0x19baa2][_0x2497('0x75')]],'%s',_0x39566e):_0x39566e;_0x39566e=_0x345b80[_0x19baa2][_0x2497('0x77')]?_['replace'](_0x34f40d[_0x345b80[_0x19baa2]['format']],'%s',_0x39566e):_0x39566e;if(_0x345b80[_0x19baa2][_0x2497('0x78')]){_0x2c75fe['group'](_0x39566e);}_0x345b80[_0x19baa2][_0x2497('0x79')]&&_0x2c75fe[_0x2497('0x3a')](_0x39566e,_0x345b80[_0x19baa2][_0x2497('0x79')]===_0x2497('0x8f')?![]:!![]);_0x2c75fe[_0x2497('0x6a')](_0x39566e,_0x345b80[_0x19baa2]['alias']||_0x39566e);}if(_0x30bdbf[_0x2497('0x7b')]){_0x30bdbf[_0x2497('0x7b')]=JSON[_0x2497('0x7c')](_0x30bdbf[_0x2497('0x7b')]);for(var _0x2b66da=0x0;_0x2b66da<_0x30bdbf[_0x2497('0x7b')][_0x2497('0x37')];_0x2b66da+=0x1){if(_0x30bdbf[_0x2497('0x7b')][_0x2b66da][_0x2497('0x7d')]&&_[_0x2497('0x66')](_0x6ce25d,_0x30bdbf[_0x2497('0x7b')][_0x2b66da][_0x2497('0x7d')])&&_0x30bdbf[_0x2497('0x7b')][_0x2b66da]['parentKey']&&_0x30bdbf[_0x2497('0x7b')][_0x2b66da][_0x2497('0x7f')]&&_0x30bdbf[_0x2497('0x7b')][_0x2b66da][_0x2497('0x80')]){_0x2c75fe[_0x30bdbf['joins'][_0x2b66da]['type']](_0x30bdbf[_0x2497('0x7b')][_0x2b66da][_0x2497('0x7f')],null,util[_0x2497('0x77')]('%s.%s\x20=\x20%s.%s',_0x30bdbf[_0x2497('0x72')],_0x30bdbf[_0x2497('0x7b')][_0x2b66da][_0x2497('0x7e')],_0x30bdbf[_0x2497('0x7b')][_0x2b66da]['foreignTable'],_0x30bdbf['joins'][_0x2b66da][_0x2497('0x80')]));}}}if(_0x30bdbf['conditions']){_0x30bdbf[_0x2497('0x82')]=JSON['parse'](_0x30bdbf['conditions']);_0x2c75fe[_0x2497('0x3c')](_0x3ba49f(_0x30bdbf['conditions'][_0x2497('0x69')]));}_0x2fd295=_0x2c75fe[_0x2497('0x83')]();_0x2c75fe[_0x2497('0x39')](_0x43a2f0);_0x2c75fe['offset'](0x0);logger[_0x2497('0x84')](_0x2497('0xa6'),_0x2c75fe[_0x2497('0x85')]());return dbH[_0x2497('0x86')][_0x2497('0x30')](_0x2c75fe[_0x2497('0x85')](),{'type':dbH['sequelize']['QueryTypes'][_0x2497('0x88')]});}})['then'](function(){return{'sql':_0x2fd295['toString']()};})[_0x2497('0x25')](respondWithResult(_0x3af423,null))[_0x2497('0x49')](handleError(_0x3af423,null));}; \ No newline at end of file +var _0xf975=['randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','MIN(%s)','HOUR(%s)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','CustomReports','UserProfileResource','sendStatus','error','name','index','fieldName','type','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','include','rows','show','params','rawAttributes','intersection','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','create','body','catch','preview','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','getFields','Sequelize','AnalyticMetric','findAll','keyBy','select','table','MetricId','metric','field','replace','function','format','groupBy','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','SUM(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','value','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','from','output','web','%s-%s.%s'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xf975,0xba));var _0x5f97=function(_0xb867a8,_0x926a63){_0xb867a8=_0xb867a8-0x0;var _0x1e5dcd=_0xf975[_0xb867a8];return _0x1e5dcd;};'use strict';var emlformat=require(_0x5f97('0x0'));var rimraf=require(_0x5f97('0x1'));var zipdir=require(_0x5f97('0x2'));var jsonpatch=require(_0x5f97('0x3'));var rp=require(_0x5f97('0x4'));var moment=require(_0x5f97('0x5'));var BPromise=require(_0x5f97('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5f97('0x7'));var sox=require(_0x5f97('0x8'));var csv=require(_0x5f97('0x9'));var ejs=require(_0x5f97('0xa'));var fs=require('fs');var fs_extra=require(_0x5f97('0xb'));var _=require(_0x5f97('0xc'));var squel=require(_0x5f97('0xd'));var crypto=require('crypto');var jsforce=require(_0x5f97('0xe'));var deskjs=require(_0x5f97('0xf'));var toCsv=require(_0x5f97('0x9'));var querystring=require(_0x5f97('0x10'));var Papa=require(_0x5f97('0x11'));var Redis=require(_0x5f97('0x12'));var authService=require(_0x5f97('0x13'));var qs=require(_0x5f97('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5f97('0x15'));var db=require(_0x5f97('0x16'))['db'];var dbH=require('../../mysqldb')[_0x5f97('0x17')];function respondWithStatusCode(_0x13b13d,_0x2c8874){_0x2c8874=_0x2c8874||0xcc;return function(_0x3b3dd7){if(_0x3b3dd7){return _0x13b13d['sendStatus'](_0x2c8874);}return _0x13b13d[_0x5f97('0x18')](_0x2c8874)[_0x5f97('0x19')]();};}function respondWithResult(_0x1143e4,_0x30dcdf){_0x30dcdf=_0x30dcdf||0xc8;return function(_0x1505bf){if(_0x1505bf){return _0x1143e4[_0x5f97('0x18')](_0x30dcdf)[_0x5f97('0x1a')](_0x1505bf);}};}function respondWithFilteredResult(_0x94b187,_0x56375f){return function(_0x3c6535){if(_0x3c6535){var _0xec708a=typeof _0x56375f[_0x5f97('0x1b')]===_0x5f97('0x1c')&&typeof _0x56375f[_0x5f97('0x1d')]===_0x5f97('0x1c');var _0x24a65b=_0x3c6535[_0x5f97('0x1e')];var _0x199ea2=_0xec708a?0x0:_0x56375f[_0x5f97('0x1b')];var _0x186c8d=_0xec708a?_0x3c6535['count']:_0x56375f[_0x5f97('0x1b')]+_0x56375f[_0x5f97('0x1d')];var _0x534d26;if(_0x186c8d>=_0x24a65b){_0x186c8d=_0x24a65b;_0x534d26=0xc8;}else{_0x534d26=0xce;}_0x94b187[_0x5f97('0x18')](_0x534d26);return _0x94b187['set'](_0x5f97('0x1f'),_0x199ea2+'-'+_0x186c8d+'/'+_0x24a65b)[_0x5f97('0x1a')](_0x3c6535);}return null;};}function patchUpdates(_0x5da727){return function(_0x2118af){try{jsonpatch[_0x5f97('0x20')](_0x2118af,_0x5da727,!![]);}catch(_0x14b3cc){return BPromise[_0x5f97('0x21')](_0x14b3cc);}return _0x2118af['save']();};}function saveUpdates(_0x58b57c,_0x411af7){return function(_0x295e35){if(_0x295e35){return _0x295e35[_0x5f97('0x22')](_0x58b57c)['then'](function(_0x2846d2){return _0x2846d2;});}return null;};}function removeEntity(_0x5abd05,_0x45d23c){return function(_0x1747c0){if(_0x1747c0){return _0x1747c0[_0x5f97('0x23')]()[_0x5f97('0x24')](function(){var _0x48f0c1=_0x1747c0['get']({'plain':!![]});var _0x8f25b9=_0x5f97('0x25');return db[_0x5f97('0x26')][_0x5f97('0x23')]({'where':{'type':_0x8f25b9,'resourceId':_0x48f0c1['id']}})['then'](function(){return _0x1747c0;});})[_0x5f97('0x24')](function(){_0x5abd05[_0x5f97('0x18')](0xcc)[_0x5f97('0x19')]();});}};}function handleEntityNotFound(_0x8dcbda,_0x1f3204){return function(_0x2fc345){if(!_0x2fc345){_0x8dcbda[_0x5f97('0x27')](0x194);}return _0x2fc345;};}function handleError(_0x5bceb0,_0x419512){_0x419512=_0x419512||0x1f4;return function(_0x3b4896){logger[_0x5f97('0x28')](_0x3b4896['stack']);if(_0x3b4896[_0x5f97('0x29')]){delete _0x3b4896[_0x5f97('0x29')];}_0x5bceb0[_0x5f97('0x18')](_0x419512)['send'](_0x3b4896);};}exports[_0x5f97('0x2a')]=function(_0x3dcbb1,_0x5e1b4a){var _0x499139={},_0x58ab23={},_0x463215={'count':0x0,'rows':[]};var _0x362445=_['map'](db['AnalyticCustomReport']['rawAttributes'],function(_0x3c7437){return{'name':_0x3c7437[_0x5f97('0x2b')],'type':_0x3c7437[_0x5f97('0x2c')][_0x5f97('0x2d')]};});_0x58ab23[_0x5f97('0x2e')]=_[_0x5f97('0x2f')](_0x362445,'name');_0x58ab23['query']=_[_0x5f97('0x30')](_0x3dcbb1[_0x5f97('0x31')]);_0x58ab23[_0x5f97('0x32')]=_['intersection'](_0x58ab23[_0x5f97('0x2e')],_0x58ab23[_0x5f97('0x31')]);_0x499139[_0x5f97('0x33')]=_['intersection'](_0x58ab23['model'],qs['fields'](_0x3dcbb1['query'][_0x5f97('0x34')]));_0x499139[_0x5f97('0x33')]=_0x499139['attributes'][_0x5f97('0x35')]?_0x499139[_0x5f97('0x33')]:_0x58ab23[_0x5f97('0x2e')];if(!_0x3dcbb1[_0x5f97('0x31')][_0x5f97('0x36')](_0x5f97('0x37'))){_0x499139[_0x5f97('0x1d')]=qs['limit'](_0x3dcbb1[_0x5f97('0x31')]['limit']);_0x499139[_0x5f97('0x1b')]=qs[_0x5f97('0x1b')](_0x3dcbb1['query'][_0x5f97('0x1b')]);}_0x499139[_0x5f97('0x38')]=qs[_0x5f97('0x39')](_0x3dcbb1['query'][_0x5f97('0x39')]);_0x499139[_0x5f97('0x3a')]=qs[_0x5f97('0x32')](_[_0x5f97('0x3b')](_0x3dcbb1[_0x5f97('0x31')],_0x58ab23['filters']),_0x362445);if(_0x3dcbb1[_0x5f97('0x31')][_0x5f97('0x3c')]){_0x499139[_0x5f97('0x3a')]=_[_0x5f97('0x3d')](_0x499139[_0x5f97('0x3a')],{'$or':_[_0x5f97('0x2f')](_0x362445,function(_0x62e169){if(_0x62e169[_0x5f97('0x2c')]!==_0x5f97('0x3e')){var _0x435e75={};_0x435e75[_0x62e169[_0x5f97('0x29')]]={'$like':'%'+_0x3dcbb1[_0x5f97('0x31')][_0x5f97('0x3c')]+'%'};return _0x435e75;}})});}_0x499139=_['merge']({},_0x499139,_0x3dcbb1[_0x5f97('0x3f')]);var _0x1a7bbb={'where':_0x499139[_0x5f97('0x3a')]};return db[_0x5f97('0x40')][_0x5f97('0x1e')](_0x1a7bbb)[_0x5f97('0x24')](function(_0x1392f9){_0x463215[_0x5f97('0x1e')]=_0x1392f9;if(_0x3dcbb1[_0x5f97('0x31')][_0x5f97('0x41')]){_0x499139[_0x5f97('0x42')]=[{'all':!![]}];}return db[_0x5f97('0x40')]['findAll'](_0x499139);})[_0x5f97('0x24')](function(_0x1d6e0d){_0x463215[_0x5f97('0x43')]=_0x1d6e0d;return _0x463215;})[_0x5f97('0x24')](respondWithFilteredResult(_0x5e1b4a,_0x499139))['catch'](handleError(_0x5e1b4a,null));};exports[_0x5f97('0x44')]=function(_0x374688,_0x4cfae1){var _0x4b633c={'raw':![],'where':{'id':_0x374688[_0x5f97('0x45')]['id']}},_0x539902={};_0x539902['model']=_['keys'](db[_0x5f97('0x40')][_0x5f97('0x46')]);_0x539902[_0x5f97('0x31')]=_[_0x5f97('0x30')](_0x374688[_0x5f97('0x31')]);_0x539902['filters']=_[_0x5f97('0x47')](_0x539902[_0x5f97('0x2e')],_0x539902['query']);_0x4b633c[_0x5f97('0x33')]=_[_0x5f97('0x47')](_0x539902[_0x5f97('0x2e')],qs[_0x5f97('0x34')](_0x374688[_0x5f97('0x31')][_0x5f97('0x34')]));_0x4b633c[_0x5f97('0x33')]=_0x4b633c[_0x5f97('0x33')][_0x5f97('0x35')]?_0x4b633c[_0x5f97('0x33')]:_0x539902[_0x5f97('0x2e')];if(_0x374688[_0x5f97('0x31')][_0x5f97('0x41')]){_0x4b633c[_0x5f97('0x42')]=[{'all':!![]}];}_0x4b633c=_[_0x5f97('0x3d')]({},_0x4b633c,_0x374688[_0x5f97('0x3f')]);return db[_0x5f97('0x40')]['find'](_0x4b633c)[_0x5f97('0x24')](handleEntityNotFound(_0x4cfae1,null))[_0x5f97('0x24')](respondWithResult(_0x4cfae1,null))['catch'](handleError(_0x4cfae1,null));};exports['create']=function(_0x405cae,_0x319240){return db['AnalyticCustomReport']['create'](_0x405cae['body'],{})[_0x5f97('0x24')](function(_0x16a870){var _0x39d559=_0x405cae[_0x5f97('0x48')][_0x5f97('0x49')]({'plain':!![]});if(!_0x39d559)throw new Error(_0x5f97('0x4a'));if(_0x39d559[_0x5f97('0x4b')]===_0x5f97('0x48')){var _0x1dc813=_0x16a870[_0x5f97('0x49')]({'plain':!![]});var _0x251d26=_0x5f97('0x4c');return db[_0x5f97('0x4d')][_0x5f97('0x4e')]({'where':{'name':_0x251d26,'userProfileId':_0x39d559[_0x5f97('0x4f')]},'raw':!![]})[_0x5f97('0x24')](function(_0x3106fc){if(_0x3106fc&&_0x3106fc[_0x5f97('0x50')]===0x0){return db['UserProfileResource'][_0x5f97('0x51')]({'name':_0x1dc813[_0x5f97('0x29')],'resourceId':_0x1dc813['id'],'type':_0x5f97('0x25'),'sectionId':_0x3106fc['id']},{})[_0x5f97('0x24')](function(){return _0x16a870;});}else{return _0x16a870;}})['catch'](function(_0x4fc1e3){logger[_0x5f97('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4fc1e3);throw _0x4fc1e3;});}return _0x16a870;})[_0x5f97('0x24')](respondWithResult(_0x319240,0xc9))['catch'](handleError(_0x319240,null));};exports[_0x5f97('0x22')]=function(_0x201de6,_0x56598a){if(_0x201de6['body']['id']){delete _0x201de6[_0x5f97('0x52')]['id'];}return db[_0x5f97('0x40')]['find']({'where':{'id':_0x201de6[_0x5f97('0x45')]['id']}})['then'](handleEntityNotFound(_0x56598a,null))[_0x5f97('0x24')](saveUpdates(_0x201de6['body'],null))[_0x5f97('0x24')](respondWithResult(_0x56598a,null))[_0x5f97('0x53')](handleError(_0x56598a,null));};exports[_0x5f97('0x23')]=function(_0x24b1f0,_0x57dc91){return db[_0x5f97('0x40')][_0x5f97('0x4e')]({'where':{'id':_0x24b1f0[_0x5f97('0x45')]['id']}})[_0x5f97('0x24')](handleEntityNotFound(_0x57dc91,null))['then'](removeEntity(_0x57dc91,null))[_0x5f97('0x53')](handleError(_0x57dc91,null));};exports[_0x5f97('0x54')]=function(_0x5b50ce,_0x25a811){var _0x18e418=0xa;var _0x752f95=[_0x5f97('0x55'),_0x5f97('0x56'),_0x5f97('0x57'),'cross_join'];var _0xe05921={'SUM':'SUM(%s)','COUNT':_0x5f97('0x58'),'COUNT DISTINCT':_0x5f97('0x59'),'MAX':_0x5f97('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5f97('0x5b'),'GROUP_CONCAT ASC':_0x5f97('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x182e1a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5f97('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0x5f97('0x5e'),'UNIX_TIMESTAMP':_0x5f97('0x5f')};var _0x561018=function(_0x2c5092){return!_[_0x5f97('0x60')]([_0x5f97('0x61'),_0x5f97('0x62'),_0x5f97('0x63'),_0x5f97('0x64')],_0x2c5092);};var _0x3a5c4c=function(_0x1a25b7){if(!_0x1a25b7||!_0x1a25b7[_0x5f97('0x65')]['length']){return'';}for(var _0x1f3392='(',_0x5d4e71=0x0;_0x5d4e71<_0x1a25b7['rules'][_0x5f97('0x35')];_0x5d4e71+=0x1){_0x5d4e71>0x0&&(_0x1f3392+='\x20'+_0x1a25b7[_0x5f97('0x66')]+'\x20');_0x1f3392+=_0x1a25b7[_0x5f97('0x65')][_0x5d4e71]['group']?_0x3a5c4c(_0x1a25b7[_0x5f97('0x65')][_0x5d4e71][_0x5f97('0x67')]):_0x1a25b7[_0x5f97('0x65')][_0x5d4e71]['field']+'\x20'+_0x1a25b7['rules'][_0x5d4e71][_0x5f97('0x68')]+(_0x561018(_0x1a25b7['rules'][_0x5d4e71]['condition'])?'\x20'+_0x1a25b7[_0x5f97('0x65')][_0x5d4e71]['value']:'');}return _0x1f3392+')';};var _0x544be2={'where':{'id':_0x5b50ce[_0x5f97('0x45')]['id']}},_0x43c11e,_0xc4666,_0x5eb129,_0x2559b2,_0x38683a;_0x544be2=_[_0x5f97('0x3d')]({},_0x544be2,_0x5b50ce['options']);return db[_0x5f97('0x40')][_0x5f97('0x4e')](_0x544be2)[_0x5f97('0x24')](function(_0x236ab9){if(_0x236ab9){_0x43c11e=_0x236ab9;return _0x236ab9[_0x5f97('0x69')]();}return null;})[_0x5f97('0x24')](function(_0x45484a){if(_0x45484a){if(!_0x45484a[_0x5f97('0x35')]){throw new db[(_0x5f97('0x6a'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xc4666=_0x45484a;return db[_0x5f97('0x6b')][_0x5f97('0x6c')]({'raw':!![]});}return null;})[_0x5f97('0x24')](function(_0x5b5882){if(_0x5b5882){_0x5eb129=_[_0x5f97('0x6d')](_0x5b5882,'id');var _0x367253;var _0x5e630c=squel[_0x5f97('0x6e')]();_0x5e630c['from'](_0x43c11e[_0x5f97('0x6f')]);for(var _0x2a1fcf=0x0;_0x2a1fcf<_0xc4666['length'];_0x2a1fcf+=0x1){_0x367253=_0xc4666[_0x2a1fcf][_0x5f97('0x70')]?_0x5eb129[_0xc4666[_0x2a1fcf][_0x5f97('0x70')]][_0x5f97('0x71')]:_0xc4666[_0x2a1fcf][_0x5f97('0x72')];_0x367253=_0xc4666[_0x2a1fcf]['function']?_[_0x5f97('0x73')](_0xe05921[_0xc4666[_0x2a1fcf][_0x5f97('0x74')]],'%s',_0x367253):_0x367253;_0x367253=_0xc4666[_0x2a1fcf][_0x5f97('0x75')]?_[_0x5f97('0x73')](_0x182e1a[_0xc4666[_0x2a1fcf]['format']],'%s',_0x367253):_0x367253;if(_0xc4666[_0x2a1fcf][_0x5f97('0x76')]){_0x5e630c[_0x5f97('0x67')](_0x367253);}_0xc4666[_0x2a1fcf][_0x5f97('0x77')]&&_0x5e630c[_0x5f97('0x38')](_0x367253,_0xc4666[_0x2a1fcf][_0x5f97('0x77')]===_0x5f97('0x78')?![]:!![]);_0x5e630c[_0x5f97('0x72')](_0x367253,_0xc4666[_0x2a1fcf]['alias']||_0x367253);}if(_0x43c11e[_0x5f97('0x79')]){_0x43c11e[_0x5f97('0x79')]=JSON[_0x5f97('0x7a')](_0x43c11e[_0x5f97('0x79')]);for(var _0x4fa20=0x0;_0x4fa20<_0x43c11e[_0x5f97('0x79')]['length'];_0x4fa20+=0x1){if(_0x43c11e[_0x5f97('0x79')][_0x4fa20][_0x5f97('0x2c')]&&_[_0x5f97('0x60')](_0x752f95,_0x43c11e[_0x5f97('0x79')][_0x4fa20]['type'])&&_0x43c11e['joins'][_0x4fa20][_0x5f97('0x7b')]&&_0x43c11e['joins'][_0x4fa20][_0x5f97('0x7c')]&&_0x43c11e[_0x5f97('0x79')][_0x4fa20][_0x5f97('0x7d')]){_0x5e630c[_0x43c11e['joins'][_0x4fa20][_0x5f97('0x2c')]](_0x43c11e['joins'][_0x4fa20][_0x5f97('0x7c')],null,util['format'](_0x5f97('0x7e'),_0x43c11e[_0x5f97('0x6f')],_0x43c11e[_0x5f97('0x79')][_0x4fa20]['parentKey'],_0x43c11e[_0x5f97('0x79')][_0x4fa20][_0x5f97('0x7c')],_0x43c11e[_0x5f97('0x79')][_0x4fa20][_0x5f97('0x7d')]));}}}if(_0x43c11e['conditions']){_0x43c11e[_0x5f97('0x7f')]=JSON[_0x5f97('0x7a')](_0x43c11e[_0x5f97('0x7f')]);_0x5e630c['where'](_0x3a5c4c(_0x43c11e[_0x5f97('0x7f')][_0x5f97('0x67')]));}_0x38683a=_0x5e630c[_0x5f97('0x80')]();_0x5e630c['limit'](_0x18e418);_0x5e630c['offset'](0x0);logger['debug'](_0x5f97('0x81'),_0x5e630c[_0x5f97('0x82')]());return dbH['sequelize'][_0x5f97('0x31')](_0x5e630c[_0x5f97('0x82')](),{'type':dbH[_0x5f97('0x83')][_0x5f97('0x84')][_0x5f97('0x85')]});}})[_0x5f97('0x24')](respondWithResult(_0x25a811,null))[_0x5f97('0x53')](handleError(_0x25a811,null));};function runReport(_0x3fd324,_0x264680,_0x206614){var _0x5e9a45=_0x264680['name'];var _0x983748=0xa;var _0x809fdf=['join',_0x5f97('0x56'),_0x5f97('0x57'),_0x5f97('0x86')];var _0x1083f1={'SUM':_0x5f97('0x87'),'COUNT':_0x5f97('0x58'),'COUNT DISTINCT':_0x5f97('0x59'),'MAX':_0x5f97('0x5a'),'MIN':'MIN(%s)','AVG':_0x5f97('0x88'),'GROUP_CONCAT':_0x5f97('0x5b'),'GROUP_CONCAT ASC':_0x5f97('0x5c'),'GROUP_CONCAT DESC':_0x5f97('0x89')};var _0x16e8ea={'SEC_TO_TIME':_0x5f97('0x8a'),'DATE':_0x5f97('0x5d'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x25f5df=function(_0x8ed967){return!_[_0x5f97('0x60')]([_0x5f97('0x61'),_0x5f97('0x62'),_0x5f97('0x63'),_0x5f97('0x64')],_0x8ed967);};var _0x35123f=function(_0x1435c6){if(!_0x1435c6||!_0x1435c6['rules'][_0x5f97('0x35')]){return'';}for(var _0x847e0a='(',_0x35612f=0x0;_0x35612f<_0x1435c6[_0x5f97('0x65')][_0x5f97('0x35')];_0x35612f+=0x1){_0x35612f>0x0&&(_0x847e0a+='\x20'+_0x1435c6[_0x5f97('0x66')]+'\x20');_0x847e0a+=_0x1435c6[_0x5f97('0x65')][_0x35612f]['group']?_0x35123f(_0x1435c6[_0x5f97('0x65')][_0x35612f][_0x5f97('0x67')]):_0x1435c6['rules'][_0x35612f][_0x5f97('0x72')]+'\x20'+_0x1435c6[_0x5f97('0x65')][_0x35612f][_0x5f97('0x68')]+(_0x25f5df(_0x1435c6[_0x5f97('0x65')][_0x35612f][_0x5f97('0x68')])?'\x20'+_0x1435c6['rules'][_0x35612f][_0x5f97('0x8b')]:'');}return _0x847e0a+')';};var _0x80320={'where':{'id':_0x3fd324['id']}},_0x239500,_0x4337dd,_0x23cf38,_0xd55b77,_0x54df78;_0x80320=_[_0x5f97('0x3d')]({},_0x80320,_0x206614);return db[_0x5f97('0x40')][_0x5f97('0x4e')](_0x80320)[_0x5f97('0x24')](function(_0x40316f){if(_0x40316f){_0x239500=_0x40316f;return _0x40316f['getFields']();}return null;})['then'](function(_0x404a9f){if(_0x404a9f){if(!_0x404a9f['length']){throw new db['Sequelize'][(_0x5f97('0x8c'))](_0x5f97('0x8d'),0x193);}_0x4337dd=_0x404a9f;return db[_0x5f97('0x6b')][_0x5f97('0x6c')]({'raw':!![]});}return null;})['then'](function(_0xbdf267){if(_0xbdf267){_0x23cf38=_[_0x5f97('0x6d')](_0xbdf267,'id');var _0x2c4fa1;var _0x97115c=squel[_0x5f97('0x6e')]();_0x97115c[_0x5f97('0x8e')](_0x239500[_0x5f97('0x6f')]);for(var _0x3533af=0x0;_0x3533af<_0x4337dd['length'];_0x3533af+=0x1){_0x2c4fa1=_0x4337dd[_0x3533af]['MetricId']?_0x23cf38[_0x4337dd[_0x3533af][_0x5f97('0x70')]]['metric']:_0x4337dd[_0x3533af][_0x5f97('0x72')];_0x2c4fa1=_0x4337dd[_0x3533af]['function']?_[_0x5f97('0x73')](_0x1083f1[_0x4337dd[_0x3533af][_0x5f97('0x74')]],'%s',_0x2c4fa1):_0x2c4fa1;_0x2c4fa1=_0x4337dd[_0x3533af]['format']?_[_0x5f97('0x73')](_0x16e8ea[_0x4337dd[_0x3533af][_0x5f97('0x75')]],'%s',_0x2c4fa1):_0x2c4fa1;if(_0x4337dd[_0x3533af][_0x5f97('0x76')]){_0x97115c[_0x5f97('0x67')](_0x2c4fa1);}_0x4337dd[_0x3533af]['orderBy']&&_0x97115c['order'](_0x2c4fa1,_0x4337dd[_0x3533af]['orderBy']===_0x5f97('0x78')?![]:!![]);_0x97115c[_0x5f97('0x72')](_0x2c4fa1,_0x4337dd[_0x3533af]['alias']||_0x2c4fa1);}if(_0x239500['joins']){_0x239500[_0x5f97('0x79')]=JSON['parse'](_0x239500[_0x5f97('0x79')]);for(var _0x17ecc5=0x0;_0x17ecc5<_0x239500['joins'][_0x5f97('0x35')];_0x17ecc5+=0x1){if(_0x239500[_0x5f97('0x79')][_0x17ecc5]['type']&&_['includes'](_0x809fdf,_0x239500[_0x5f97('0x79')][_0x17ecc5][_0x5f97('0x2c')])&&_0x239500[_0x5f97('0x79')][_0x17ecc5]['parentKey']&&_0x239500['joins'][_0x17ecc5]['foreignTable']&&_0x239500[_0x5f97('0x79')][_0x17ecc5][_0x5f97('0x7d')]){_0x97115c[_0x239500[_0x5f97('0x79')][_0x17ecc5]['type']](_0x239500[_0x5f97('0x79')][_0x17ecc5][_0x5f97('0x7c')],null,util[_0x5f97('0x75')](_0x5f97('0x7e'),_0x239500['table'],_0x239500['joins'][_0x17ecc5]['parentKey'],_0x239500['joins'][_0x17ecc5][_0x5f97('0x7c')],_0x239500[_0x5f97('0x79')][_0x17ecc5][_0x5f97('0x7d')]));}}}if(_0x239500[_0x5f97('0x7f')]){_0x239500[_0x5f97('0x7f')]=JSON[_0x5f97('0x7a')](_0x239500['conditions']);_0x97115c[_0x5f97('0x3a')](_0x35123f(_0x239500[_0x5f97('0x7f')][_0x5f97('0x67')]));}_0x54df78=_0x97115c['clone']();_0x97115c['limit'](_0x983748);_0x97115c[_0x5f97('0x1b')](0x0);return;}})[_0x5f97('0x24')](function(){if(_0x264680[_0x5f97('0x8f')]===_0x5f97('0x90')){return null;}var _0x61ed6d=_[_0x5f97('0x3d')](_0x264680,{'name':_0x264680['fullPath']||_0x264680['name']||_0x239500[_0x5f97('0x29')],'basename':_0x5e9a45,'savename':util[_0x5f97('0x75')](_0x5f97('0x91'),_0x264680[_0x5f97('0x29')]||_0x239500[_0x5f97('0x29')],require(_0x5f97('0x92'))[_0x5f97('0x93')](0x4),_0x264680['output']||_0x5f97('0x94')),'reportId':_0x239500['id'],'reportType':_0x5f97('0x95')});return db['AnalyticExtractedReport'][_0x5f97('0x51')](_0x61ed6d,{'raw':!![]});})['then'](function(_0x3d3b12){if(_0x239500['table']===_0x5f97('0x96')){_0x54df78[_0x5f97('0x3a')](_0x239500[_0x5f97('0x6f')]+_0x5f97('0x97'),_0x264680[_0x5f97('0x98')],_0x264680[_0x5f97('0x99')]);}else{_0x54df78[_0x5f97('0x3a')](_0x239500[_0x5f97('0x6f')]+_0x5f97('0x9a'),_0x264680['startDate'],_0x264680[_0x5f97('0x99')]);}if(_0x3d3b12){logger['info'](_0x5f97('0x9b'),_0x54df78['toString']());require(_0x5f97('0x9c'))[_0x5f97('0x9d')](path['join'](__dirname,_0x5f97('0x9e'),_0x3d3b12[_0x5f97('0x8f')]),[_0x3d3b12['id'],_0x54df78[_0x5f97('0x82')](),path[_0x5f97('0x55')](__dirname,_0x5f97('0x9f'),_0x3d3b12['savename']),_0x5e9a45]);return _0x3d3b12;}else{var _0x56c2d5=squel[_0x5f97('0x6e')]();_0x56c2d5[_0x5f97('0x8e')]('('+_0x54df78[_0x5f97('0x82')]()+')',_0x5f97('0xa0'));_0x56c2d5[_0x5f97('0x72')](_0x5f97('0xa1'),_0x5f97('0x1e'));_0x54df78[_0x5f97('0x1d')](_0x264680[_0x5f97('0x1d')]||_0x983748);_0x54df78[_0x5f97('0x1b')](_0x264680['offset']||0x0);return dbH['sequelize'][_0x5f97('0x31')](_0x56c2d5[_0x5f97('0x82')](),{'type':dbH[_0x5f97('0x83')][_0x5f97('0x84')][_0x5f97('0x85')]})[_0x5f97('0x24')](function(_0x513c31){if(!_0x513c31[_0x5f97('0x35')]){_0xd55b77=0x0;}else{_0xd55b77=_0x513c31[0x0][_0x5f97('0x1e')]||0x0;}return dbH[_0x5f97('0x83')]['query'](_0x54df78['toString'](),{'type':dbH[_0x5f97('0x83')][_0x5f97('0x84')][_0x5f97('0x85')]});})[_0x5f97('0x24')](function(_0x118790){return{'rows':_0x118790||[],'count':_0xd55b77};});}});}exports[_0x5f97('0xa2')]=function(_0x4c0c96,_0x3192fd){return runReport(_0x4c0c96['params'],_0x4c0c96[_0x5f97('0x31')],_0x4c0c96['options'])['then'](respondWithResult(_0x3192fd,null))['catch'](handleError(_0x3192fd,null));};exports[_0x5f97('0xa3')]=runReport;exports[_0x5f97('0x31')]=function(_0x5a0e40,_0x5d9452){var _0x8bbbae=0xa;var _0x207caf=['join',_0x5f97('0x56'),_0x5f97('0x57'),_0x5f97('0x86')];var _0x3c9c67={'SUM':_0x5f97('0x87'),'COUNT':_0x5f97('0x58'),'COUNT DISTINCT':_0x5f97('0x59'),'MAX':_0x5f97('0x5a'),'MIN':_0x5f97('0xa4'),'AVG':_0x5f97('0x88'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3d1ca5={'SEC_TO_TIME':_0x5f97('0x8a'),'DATE':'DATE(%s)','HOUR':_0x5f97('0xa5'),'ROUND':_0x5f97('0x5e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5d91bf=function(_0x45dbbd){return!_['includes']([_0x5f97('0x61'),_0x5f97('0x62'),_0x5f97('0x63'),_0x5f97('0x64')],_0x45dbbd);};var _0x21d8ee=function(_0x5662b8){if(!_0x5662b8||!_0x5662b8[_0x5f97('0x65')][_0x5f97('0x35')]){return'';}for(var _0x30974b='(',_0x1f7739=0x0;_0x1f7739<_0x5662b8['rules'][_0x5f97('0x35')];_0x1f7739+=0x1){_0x1f7739>0x0&&(_0x30974b+='\x20'+_0x5662b8[_0x5f97('0x66')]+'\x20');_0x30974b+=_0x5662b8['rules'][_0x1f7739]['group']?_0x21d8ee(_0x5662b8[_0x5f97('0x65')][_0x1f7739][_0x5f97('0x67')]):_0x5662b8['rules'][_0x1f7739][_0x5f97('0x72')]+'\x20'+_0x5662b8['rules'][_0x1f7739][_0x5f97('0x68')]+(_0x5d91bf(_0x5662b8[_0x5f97('0x65')][_0x1f7739][_0x5f97('0x68')])?'\x20'+_0x5662b8[_0x5f97('0x65')][_0x1f7739][_0x5f97('0x8b')]:'');}return _0x30974b+')';};var _0x3edfdb={'where':{'id':_0x5a0e40[_0x5f97('0x45')]['id']}},_0x760fc9,_0x3b374f,_0x141f53,_0x52cced,_0x13029a;_0x3edfdb=_[_0x5f97('0x3d')]({},_0x3edfdb,_0x5a0e40[_0x5f97('0x3f')]);return db[_0x5f97('0x40')][_0x5f97('0x4e')](_0x3edfdb)['then'](function(_0x589b91){if(_0x589b91){_0x760fc9=_0x589b91;return _0x589b91[_0x5f97('0x69')]();}return null;})[_0x5f97('0x24')](function(_0x31753f){if(_0x31753f){if(!_0x31753f[_0x5f97('0x35')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5f97('0x8d'),0x193);}_0x3b374f=_0x31753f;return db[_0x5f97('0x6b')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x3e1afb){if(_0x3e1afb){_0x141f53=_[_0x5f97('0x6d')](_0x3e1afb,'id');var _0x17a435;var _0x2e55d7=squel[_0x5f97('0x6e')]();_0x2e55d7[_0x5f97('0x8e')](_0x760fc9[_0x5f97('0x6f')]);for(var _0x17e2e6=0x0;_0x17e2e6<_0x3b374f[_0x5f97('0x35')];_0x17e2e6+=0x1){_0x17a435=_0x3b374f[_0x17e2e6]['MetricId']?_0x141f53[_0x3b374f[_0x17e2e6][_0x5f97('0x70')]][_0x5f97('0x71')]:_0x3b374f[_0x17e2e6][_0x5f97('0x72')];_0x17a435=_0x3b374f[_0x17e2e6][_0x5f97('0x74')]?_['replace'](_0x3c9c67[_0x3b374f[_0x17e2e6][_0x5f97('0x74')]],'%s',_0x17a435):_0x17a435;_0x17a435=_0x3b374f[_0x17e2e6][_0x5f97('0x75')]?_[_0x5f97('0x73')](_0x3d1ca5[_0x3b374f[_0x17e2e6]['format']],'%s',_0x17a435):_0x17a435;if(_0x3b374f[_0x17e2e6][_0x5f97('0x76')]){_0x2e55d7['group'](_0x17a435);}_0x3b374f[_0x17e2e6][_0x5f97('0x77')]&&_0x2e55d7['order'](_0x17a435,_0x3b374f[_0x17e2e6]['orderBy']==='DESC'?![]:!![]);_0x2e55d7[_0x5f97('0x72')](_0x17a435,_0x3b374f[_0x17e2e6]['alias']||_0x17a435);}if(_0x760fc9['joins']){_0x760fc9['joins']=JSON[_0x5f97('0x7a')](_0x760fc9[_0x5f97('0x79')]);for(var _0x1178f8=0x0;_0x1178f8<_0x760fc9[_0x5f97('0x79')]['length'];_0x1178f8+=0x1){if(_0x760fc9[_0x5f97('0x79')][_0x1178f8][_0x5f97('0x2c')]&&_['includes'](_0x207caf,_0x760fc9[_0x5f97('0x79')][_0x1178f8][_0x5f97('0x2c')])&&_0x760fc9[_0x5f97('0x79')][_0x1178f8][_0x5f97('0x7b')]&&_0x760fc9[_0x5f97('0x79')][_0x1178f8][_0x5f97('0x7c')]&&_0x760fc9[_0x5f97('0x79')][_0x1178f8][_0x5f97('0x7d')]){_0x2e55d7[_0x760fc9['joins'][_0x1178f8]['type']](_0x760fc9[_0x5f97('0x79')][_0x1178f8]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x760fc9[_0x5f97('0x6f')],_0x760fc9['joins'][_0x1178f8]['parentKey'],_0x760fc9[_0x5f97('0x79')][_0x1178f8]['foreignTable'],_0x760fc9[_0x5f97('0x79')][_0x1178f8]['foreignKey']));}}}if(_0x760fc9[_0x5f97('0x7f')]){_0x760fc9[_0x5f97('0x7f')]=JSON[_0x5f97('0x7a')](_0x760fc9[_0x5f97('0x7f')]);_0x2e55d7[_0x5f97('0x3a')](_0x21d8ee(_0x760fc9[_0x5f97('0x7f')][_0x5f97('0x67')]));}_0x13029a=_0x2e55d7[_0x5f97('0x80')]();_0x2e55d7[_0x5f97('0x1d')](_0x8bbbae);_0x2e55d7[_0x5f97('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x2e55d7['toString']());return dbH['sequelize'][_0x5f97('0x31')](_0x2e55d7[_0x5f97('0x82')](),{'type':dbH[_0x5f97('0x83')][_0x5f97('0x84')][_0x5f97('0x85')]});}})[_0x5f97('0x24')](function(){return{'sql':_0x13029a[_0x5f97('0x82')]()};})[_0x5f97('0x24')](respondWithResult(_0x5d9452,null))[_0x5f97('0x53')](handleError(_0x5d9452,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 20a6bf3..bff9608 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 _0x9483=['lodash','util','../../config/logger','bluebird','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x2f664b,_0x1f3537){var _0x5c1f9f=function(_0xcdf28e){while(--_0xcdf28e){_0x2f664b['push'](_0x2f664b['shift']());}};_0x5c1f9f(++_0x1f3537);}(_0x9483,0x118));var _0x3948=function(_0x30f68b,_0xfa973){_0x30f68b=_0x30f68b-0x0;var _0x140739=_0x9483[_0x30f68b];return _0x140739;};'use strict';var _=require(_0x3948('0x0'));var util=require(_0x3948('0x1'));var logger=require(_0x3948('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3948('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3948('0x4'));var attributes=require(_0x3948('0x5'));module[_0x3948('0x6')]=function(_0x1b314a,_0x3cdd03){return _0x1b314a[_0x3948('0x7')](_0x3948('0x8'),attributes,{'tableName':_0x3948('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4f0=['exports','define','AnalyticCustomReport','analytics_custom_reports','util','api','moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes'];(function(_0x2106e0,_0xbf158d){var _0x32a84e=function(_0x7076d9){while(--_0x7076d9){_0x2106e0['push'](_0x2106e0['shift']());}};_0x32a84e(++_0xbf158d);}(_0xd4f0,0x1a8));var _0x0d4f=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0xd4f0[_0x15ca1a];return _0x507626;};'use strict';var _=require('lodash');var util=require(_0x0d4f('0x0'));var logger=require('../../config/logger')(_0x0d4f('0x1'));var moment=require(_0x0d4f('0x2'));var BPromise=require(_0x0d4f('0x3'));var rp=require(_0x0d4f('0x4'));var fs=require('fs');var path=require(_0x0d4f('0x5'));var rimraf=require('rimraf');var config=require(_0x0d4f('0x6'));var attributes=require(_0x0d4f('0x7'));module[_0x0d4f('0x8')]=function(_0x4d9c83,_0x18444e){return _0x4d9c83[_0x0d4f('0x9')](_0x0d4f('0xa'),attributes,{'tableName':_0x0d4f('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index c0b7e56..a7b205a 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 _0x969f=['jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x595938,_0x475774){var _0x388bc1=function(_0x4987bc){while(--_0x4987bc){_0x595938['push'](_0x595938['shift']());}};_0x388bc1(++_0x475774);}(_0x969f,0xbf));var _0xf969=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0x969f[_0x2a5099];return _0x2802f1;};'use strict';var _=require(_0xf969('0x0'));var util=require(_0xf969('0x1'));var moment=require(_0xf969('0x2'));var BPromise=require(_0xf969('0x3'));var rs=require(_0xf969('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf969('0x5'))['db'];var utils=require(_0xf969('0x6'));var logger=require(_0xf969('0x7'))('rpc');var config=require(_0xf969('0x8'));var jayson=require(_0xf969('0x9'));var client=jayson[_0xf969('0xa')][_0xf969('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4df7a7,_0x1569c3,_0x2ff270){return new BPromise(function(_0xaa9b0a,_0x1d50c0){return client[_0xf969('0xc')](_0x4df7a7,_0x2ff270)[_0xf969('0xd')](function(_0x4b3f43){logger[_0xf969('0xe')](_0xf969('0xf'),_0x1569c3,_0xf969('0x10'));logger[_0xf969('0x11')](_0xf969('0x12'),_0x1569c3,_0xf969('0x10'),JSON[_0xf969('0x13')](_0x4b3f43));if(_0x4b3f43[_0xf969('0x14')]){if(_0x4b3f43[_0xf969('0x14')][_0xf969('0x15')]===0x1f4){logger[_0xf969('0x14')](_0xf969('0xf'),_0x1569c3,_0x4b3f43[_0xf969('0x14')]['message']);return _0x1d50c0(_0x4b3f43[_0xf969('0x14')][_0xf969('0x16')]);}logger[_0xf969('0x14')](_0xf969('0xf'),_0x1569c3,_0x4b3f43[_0xf969('0x14')][_0xf969('0x16')]);return _0xaa9b0a(_0x4b3f43['error'][_0xf969('0x16')]);}else{logger[_0xf969('0xe')](_0xf969('0xf'),_0x1569c3,_0xf969('0x10'));_0xaa9b0a(_0x4b3f43[_0xf969('0x17')][_0xf969('0x16')]);}})[_0xf969('0x18')](function(_0x3555e8){logger[_0xf969('0x14')](_0xf969('0xf'),_0x1569c3,_0x3555e8);_0x1d50c0(_0x3555e8);});});} \ No newline at end of file +var _0xe2cd=['stringify','error','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','http','request','then','info','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x135ebc,_0x123430){var _0x210162=function(_0x4c7459){while(--_0x4c7459){_0x135ebc['push'](_0x135ebc['shift']());}};_0x210162(++_0x123430);}(_0xe2cd,0x1d4));var _0xde2c=function(_0x284d78,_0x113676){_0x284d78=_0x284d78-0x0;var _0x27831a=_0xe2cd[_0x284d78];return _0x27831a;};'use strict';var _=require(_0xde2c('0x0'));var util=require(_0xde2c('0x1'));var moment=require(_0xde2c('0x2'));var BPromise=require(_0xde2c('0x3'));var rs=require(_0xde2c('0x4'));var fs=require('fs');var Redis=require(_0xde2c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xde2c('0x6'));var config=require('../../config/environment');var jayson=require(_0xde2c('0x7'));var client=jayson['client'][_0xde2c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1030f4,_0x59f9da,_0x346bb5){return new BPromise(function(_0x388b0,_0x1c1aa4){return client[_0xde2c('0x9')](_0x1030f4,_0x346bb5)[_0xde2c('0xa')](function(_0x455b2){logger[_0xde2c('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x59f9da,'request\x20sent');logger[_0xde2c('0xc')](_0xde2c('0xd'),_0x59f9da,_0xde2c('0xe'),JSON[_0xde2c('0xf')](_0x455b2));if(_0x455b2[_0xde2c('0x10')]){if(_0x455b2[_0xde2c('0x10')]['code']===0x1f4){logger['error'](_0xde2c('0x11'),_0x59f9da,_0x455b2[_0xde2c('0x10')][_0xde2c('0x12')]);return _0x1c1aa4(_0x455b2[_0xde2c('0x10')][_0xde2c('0x12')]);}logger[_0xde2c('0x10')](_0xde2c('0x11'),_0x59f9da,_0x455b2[_0xde2c('0x10')][_0xde2c('0x12')]);return _0x388b0(_0x455b2['error'][_0xde2c('0x12')]);}else{logger[_0xde2c('0xb')](_0xde2c('0x11'),_0x59f9da,_0xde2c('0xe'));_0x388b0(_0x455b2[_0xde2c('0x13')][_0xde2c('0x12')]);}})[_0xde2c('0x14')](function(_0xf5061a){logger['error'](_0xde2c('0x11'),_0x59f9da,_0xf5061a);_0x1c1aa4(_0xf5061a);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 1c72110..48c9427 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 _0xfa24=['get','isAuthenticated','/:id','/:id/preview','preview','/:id/run','run','query','post','put','update','delete','util','path','connect-timeout','express','Router'];(function(_0x530f66,_0x41bcb7){var _0x23a441=function(_0x24c67f){while(--_0x24c67f){_0x530f66['push'](_0x530f66['shift']());}};_0x23a441(++_0x41bcb7);}(_0xfa24,0x171));var _0x4fa2=function(_0x459a0a,_0x25c46f){_0x459a0a=_0x459a0a-0x0;var _0x4ab46c=_0xfa24[_0x459a0a];return _0x4ab46c;};'use strict';var multer=require('multer');var util=require(_0x4fa2('0x0'));var path=require(_0x4fa2('0x1'));var timeout=require(_0x4fa2('0x2'));var express=require(_0x4fa2('0x3'));var router=express[_0x4fa2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticCustomReport.controller');router[_0x4fa2('0x5')]('/',auth[_0x4fa2('0x6')](),controller['index']);router['get'](_0x4fa2('0x7'),auth[_0x4fa2('0x6')](),controller['show']);router[_0x4fa2('0x5')](_0x4fa2('0x8'),auth[_0x4fa2('0x6')](),controller[_0x4fa2('0x9')]);router['get'](_0x4fa2('0xa'),auth[_0x4fa2('0x6')](),controller[_0x4fa2('0xb')]);router[_0x4fa2('0x5')]('/:id/query',auth[_0x4fa2('0x6')](),controller[_0x4fa2('0xc')]);router[_0x4fa2('0xd')]('/',auth[_0x4fa2('0x6')](),controller['create']);router[_0x4fa2('0xe')](_0x4fa2('0x7'),auth[_0x4fa2('0x6')](),controller[_0x4fa2('0xf')]);router[_0x4fa2('0x10')](_0x4fa2('0x7'),auth[_0x4fa2('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x04f9=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run','/:id/query','query','post','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x271a22,_0xef764b){var _0x26431b=function(_0x58e32a){while(--_0x58e32a){_0x271a22['push'](_0x271a22['shift']());}};_0x26431b(++_0xef764b);}(_0x04f9,0x10b));var _0x904f=function(_0x5df8cf,_0x10bc53){_0x5df8cf=_0x5df8cf-0x0;var _0x45e9ac=_0x04f9[_0x5df8cf];return _0x45e9ac;};'use strict';var multer=require(_0x904f('0x0'));var util=require(_0x904f('0x1'));var path=require('path');var timeout=require(_0x904f('0x2'));var express=require(_0x904f('0x3'));var router=express[_0x904f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x904f('0x5'));var interaction=require(_0x904f('0x6'));var config=require(_0x904f('0x7'));var controller=require('./analyticCustomReport.controller');router[_0x904f('0x8')]('/',auth[_0x904f('0x9')](),controller[_0x904f('0xa')]);router['get'](_0x904f('0xb'),auth[_0x904f('0x9')](),controller['show']);router[_0x904f('0x8')](_0x904f('0xc'),auth['isAuthenticated'](),controller[_0x904f('0xd')]);router[_0x904f('0x8')](_0x904f('0xe'),auth[_0x904f('0x9')](),controller['run']);router[_0x904f('0x8')](_0x904f('0xf'),auth[_0x904f('0x9')](),controller[_0x904f('0x10')]);router[_0x904f('0x11')]('/',auth[_0x904f('0x9')](),controller['create']);router[_0x904f('0x12')](_0x904f('0xb'),auth[_0x904f('0x9')](),controller['update']);router[_0x904f('0x13')](_0x904f('0xb'),auth[_0x904f('0x9')](),controller['destroy']);module[_0x904f('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 61b10b2..53c1782 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 _0x5fd1=['STRING','TEXT','sequelize'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x5fd1,0x155));var _0x15fd=function(_0x103c42,_0x4c4efb){_0x103c42=_0x103c42-0x0;var _0x56ec80=_0x5fd1[_0x103c42];return _0x56ec80;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x15fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15fd('0x1')]},'parent':{'type':Sequelize[_0x15fd('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x15fd('0x2')]}}; \ No newline at end of file +var _0xda19=['exports','STRING','TEXT'];(function(_0x3e5ff1,_0x40564a){var _0x3cf312=function(_0x4244dc){while(--_0x4244dc){_0x3e5ff1['push'](_0x3e5ff1['shift']());}};_0x3cf312(++_0x40564a);}(_0xda19,0xd5));var _0x9da1=function(_0x41a7b3,_0x9df83a){_0x41a7b3=_0x41a7b3-0x0;var _0x5eb096=_0xda19[_0x41a7b3];return _0x5eb096;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index c5c52af..6ad52fd 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 _0x687b=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','findAll','catch','params','intersection','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','merge','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ValidationErrorItem','DESC','parentKey','web','fullPath','%s-%s.%s','output','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','SELECT','run','runReport','cross_join','%s.%s\x20=\x20%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x687b,0x14a));var _0xb687=function(_0x4064a5,_0x15662d){_0x4064a5=_0x4064a5-0x0;var _0xf7b4f0=_0x687b[_0x4064a5];return _0xf7b4f0;};'use strict';var emlformat=require(_0xb687('0x0'));var rimraf=require(_0xb687('0x1'));var zipdir=require(_0xb687('0x2'));var jsonpatch=require(_0xb687('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb687('0x4'));var Mustache=require(_0xb687('0x5'));var util=require(_0xb687('0x6'));var path=require(_0xb687('0x7'));var sox=require(_0xb687('0x8'));var csv=require(_0xb687('0x9'));var ejs=require(_0xb687('0xa'));var fs=require('fs');var fs_extra=require(_0xb687('0xb'));var _=require(_0xb687('0xc'));var squel=require(_0xb687('0xd'));var crypto=require('crypto');var jsforce=require(_0xb687('0xe'));var deskjs=require(_0xb687('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb687('0x10'));var Papa=require(_0xb687('0x11'));var Redis=require(_0xb687('0x12'));var authService=require(_0xb687('0x13'));var qs=require(_0xb687('0x14'));var as=require(_0xb687('0x15'));var hardwareService=require(_0xb687('0x16'));var logger=require(_0xb687('0x17'))(_0xb687('0x18'));var utils=require('../../config/utils');var config=require(_0xb687('0x19'));var licenseUtil=require(_0xb687('0x1a'));var db=require(_0xb687('0x1b'))['db'];var dbH=require(_0xb687('0x1b'))['dbH'];function respondWithStatusCode(_0x4c97ed,_0x3e85b3){_0x3e85b3=_0x3e85b3||0xcc;return function(_0x155ebe){if(_0x155ebe){return _0x4c97ed['sendStatus'](_0x3e85b3);}return _0x4c97ed[_0xb687('0x1c')](_0x3e85b3)[_0xb687('0x1d')]();};}function respondWithResult(_0x1f1f35,_0x30d502){_0x30d502=_0x30d502||0xc8;return function(_0x838dd4){if(_0x838dd4){return _0x1f1f35[_0xb687('0x1c')](_0x30d502)[_0xb687('0x1e')](_0x838dd4);}};}function respondWithFilteredResult(_0x141375,_0x263085){return function(_0x2c7a18){if(_0x2c7a18){var _0x25124a=typeof _0x263085[_0xb687('0x1f')]==='undefined'&&typeof _0x263085[_0xb687('0x20')]===_0xb687('0x21');var _0x30d370=_0x2c7a18['count'];var _0x48958d=_0x25124a?0x0:_0x263085[_0xb687('0x1f')];var _0x3a10ef=_0x25124a?_0x2c7a18[_0xb687('0x22')]:_0x263085['offset']+_0x263085[_0xb687('0x20')];var _0x481f1d;if(_0x3a10ef>=_0x30d370){_0x3a10ef=_0x30d370;_0x481f1d=0xc8;}else{_0x481f1d=0xce;}_0x141375[_0xb687('0x1c')](_0x481f1d);return _0x141375[_0xb687('0x23')](_0xb687('0x24'),_0x48958d+'-'+_0x3a10ef+'/'+_0x30d370)[_0xb687('0x1e')](_0x2c7a18);}return null;};}function patchUpdates(_0x49d5a1){return function(_0x3a73d5){try{jsonpatch['apply'](_0x3a73d5,_0x49d5a1,!![]);}catch(_0x335541){return BPromise[_0xb687('0x25')](_0x335541);}return _0x3a73d5[_0xb687('0x26')]();};}function saveUpdates(_0x546fde,_0x1dc06b){return function(_0x491623){if(_0x491623){return _0x491623[_0xb687('0x27')](_0x546fde)[_0xb687('0x28')](function(_0xbf6c58){return _0xbf6c58;});}return null;};}function removeEntity(_0x38866c,_0xf48ba4){return function(_0x2f0a0a){if(_0x2f0a0a){return _0x2f0a0a['destroy']()[_0xb687('0x28')](function(){var _0x129347=_0x2f0a0a[_0xb687('0x29')]({'plain':!![]});var _0x1a0261=_0xb687('0x2a');return db[_0xb687('0x2b')][_0xb687('0x2c')]({'where':{'type':_0x1a0261,'resourceId':_0x129347['id']}})[_0xb687('0x28')](function(){return _0x2f0a0a;});})[_0xb687('0x28')](function(){_0x38866c[_0xb687('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3712cf,_0x192966){return function(_0x392721){if(!_0x392721){_0x3712cf[_0xb687('0x2d')](0x194);}return _0x392721;};}function handleError(_0x2e5c8d,_0x173c58){_0x173c58=_0x173c58||0x1f4;return function(_0x4e9a06){logger[_0xb687('0x2e')](_0x4e9a06['stack']);if(_0x4e9a06[_0xb687('0x2f')]){delete _0x4e9a06[_0xb687('0x2f')];}_0x2e5c8d[_0xb687('0x1c')](_0x173c58)[_0xb687('0x30')](_0x4e9a06);};}exports[_0xb687('0x31')]=function(_0x43d20d,_0xf1f0dd){var _0x556815={},_0x3da2be={},_0xe3428f={'count':0x0,'rows':[]};var _0x3c08ab=_[_0xb687('0x32')](db[_0xb687('0x33')][_0xb687('0x34')],function(_0x44be88){return{'name':_0x44be88[_0xb687('0x35')],'type':_0x44be88[_0xb687('0x36')][_0xb687('0x37')]};});_0x3da2be[_0xb687('0x38')]=_['map'](_0x3c08ab,'name');_0x3da2be[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x43d20d[_0xb687('0x39')]);_0x3da2be[_0xb687('0x3b')]=_['intersection'](_0x3da2be['model'],_0x3da2be[_0xb687('0x39')]);_0x556815[_0xb687('0x3c')]=_['intersection'](_0x3da2be[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x43d20d['query'][_0xb687('0x3d')]));_0x556815['attributes']=_0x556815[_0xb687('0x3c')][_0xb687('0x3e')]?_0x556815[_0xb687('0x3c')]:_0x3da2be[_0xb687('0x38')];if(!_0x43d20d[_0xb687('0x39')][_0xb687('0x3f')]('nolimit')){_0x556815[_0xb687('0x20')]=qs[_0xb687('0x20')](_0x43d20d[_0xb687('0x39')][_0xb687('0x20')]);_0x556815['offset']=qs[_0xb687('0x1f')](_0x43d20d[_0xb687('0x39')][_0xb687('0x1f')]);}_0x556815[_0xb687('0x40')]=qs[_0xb687('0x41')](_0x43d20d['query'][_0xb687('0x41')]);_0x556815[_0xb687('0x42')]=qs[_0xb687('0x3b')](_[_0xb687('0x43')](_0x43d20d[_0xb687('0x39')],_0x3da2be[_0xb687('0x3b')]),_0x3c08ab);if(_0x43d20d['query']['filter']){_0x556815[_0xb687('0x42')]=_['merge'](_0x556815[_0xb687('0x42')],{'$or':_[_0xb687('0x32')](_0x3c08ab,function(_0x48d3b1){if(_0x48d3b1[_0xb687('0x36')]!==_0xb687('0x44')){var _0x57776b={};_0x57776b[_0x48d3b1[_0xb687('0x2f')]]={'$like':'%'+_0x43d20d[_0xb687('0x39')][_0xb687('0x45')]+'%'};return _0x57776b;}})});}_0x556815=_['merge']({},_0x556815,_0x43d20d[_0xb687('0x46')]);var _0x9cffb2={'where':_0x556815[_0xb687('0x42')]};return db[_0xb687('0x33')][_0xb687('0x22')](_0x9cffb2)[_0xb687('0x28')](function(_0x21b9ef){_0xe3428f['count']=_0x21b9ef;if(_0x43d20d[_0xb687('0x39')]['includeAll']){_0x556815['include']=[{'all':!![]}];}return db[_0xb687('0x33')][_0xb687('0x47')](_0x556815);})['then'](function(_0x19a21c){_0xe3428f['rows']=_0x19a21c;return _0xe3428f;})[_0xb687('0x28')](respondWithFilteredResult(_0xf1f0dd,_0x556815))[_0xb687('0x48')](handleError(_0xf1f0dd,null));};exports['show']=function(_0x4cb7a0,_0x3a8509){var _0x5d9cb0={'raw':!![],'where':{'id':_0x4cb7a0[_0xb687('0x49')]['id']}},_0x247c67={};_0x247c67[_0xb687('0x38')]=_[_0xb687('0x3a')](db[_0xb687('0x33')][_0xb687('0x34')]);_0x247c67[_0xb687('0x39')]=_[_0xb687('0x3a')](_0x4cb7a0[_0xb687('0x39')]);_0x247c67[_0xb687('0x3b')]=_[_0xb687('0x4a')](_0x247c67[_0xb687('0x38')],_0x247c67['query']);_0x5d9cb0[_0xb687('0x3c')]=_['intersection'](_0x247c67[_0xb687('0x38')],qs[_0xb687('0x3d')](_0x4cb7a0[_0xb687('0x39')][_0xb687('0x3d')]));_0x5d9cb0[_0xb687('0x3c')]=_0x5d9cb0[_0xb687('0x3c')]['length']?_0x5d9cb0['attributes']:_0x247c67[_0xb687('0x38')];if(_0x4cb7a0[_0xb687('0x39')][_0xb687('0x4b')]){_0x5d9cb0[_0xb687('0x4c')]=[{'all':!![]}];}_0x5d9cb0=_['merge']({},_0x5d9cb0,_0x4cb7a0[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5d9cb0)[_0xb687('0x28')](handleEntityNotFound(_0x3a8509,null))['then'](respondWithResult(_0x3a8509,null))[_0xb687('0x48')](handleError(_0x3a8509,null));};exports[_0xb687('0x4e')]=function(_0x162b19,_0x401b99){return db['AnalyticDefaultReport']['create'](_0x162b19[_0xb687('0x4f')],{})[_0xb687('0x28')](function(_0x42b61a){var _0x508862=_0x162b19['user'][_0xb687('0x29')]({'plain':!![]});if(!_0x508862)throw new Error(_0xb687('0x50'));if(_0x508862[_0xb687('0x51')]===_0xb687('0x52')){var _0x34205d=_0x42b61a[_0xb687('0x29')]({'plain':!![]});var _0x602864=_0xb687('0x53');return db['UserProfileSection'][_0xb687('0x4d')]({'where':{'name':_0x602864,'userProfileId':_0x508862[_0xb687('0x54')]},'raw':!![]})[_0xb687('0x28')](function(_0x4f5784){if(_0x4f5784&&_0x4f5784['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x34205d[_0xb687('0x2f')],'resourceId':_0x34205d['id'],'type':_0xb687('0x2a'),'sectionId':_0x4f5784['id']},{})[_0xb687('0x28')](function(){return _0x42b61a;});}else{return _0x42b61a;}})[_0xb687('0x48')](function(_0x1ddfd4){logger[_0xb687('0x2e')](_0xb687('0x55'),_0x1ddfd4);throw _0x1ddfd4;});}return _0x42b61a;})[_0xb687('0x28')](respondWithResult(_0x401b99,0xc9))[_0xb687('0x48')](handleError(_0x401b99,null));};exports[_0xb687('0x27')]=function(_0x128264,_0x166900){if(_0x128264[_0xb687('0x4f')]['id']){delete _0x128264[_0xb687('0x4f')]['id'];}return db[_0xb687('0x33')][_0xb687('0x4d')]({'where':{'id':_0x128264[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0x166900,null))['then'](saveUpdates(_0x128264[_0xb687('0x4f')],null))[_0xb687('0x28')](respondWithResult(_0x166900,null))[_0xb687('0x48')](handleError(_0x166900,null));};exports[_0xb687('0x2c')]=function(_0x4e5642,_0xfa8790){return db[_0xb687('0x33')]['find']({'where':{'id':_0x4e5642[_0xb687('0x49')]['id']}})['then'](handleEntityNotFound(_0xfa8790,null))[_0xb687('0x28')](removeEntity(_0xfa8790,null))[_0xb687('0x48')](handleError(_0xfa8790,null));};exports['preview']=function(_0x4fb188,_0x13ad6a){var _0x4ab9c5=0xa;var _0x5ea8fd=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x25e140={'SUM':'SUM(%s)','COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0x58ec8b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0xbc3a94=function(_0x4bc18f){return!_[_0xb687('0x61')]([_0xb687('0x62'),_0xb687('0x63'),_0xb687('0x64'),_0xb687('0x65')],_0x4bc18f);};var _0x17505c=function(_0x132e3a){if(!_0x132e3a||!_0x132e3a['rules']['length']){return'';}for(var _0x2714c6='(',_0x4906df=0x0;_0x4906df<_0x132e3a[_0xb687('0x66')][_0xb687('0x3e')];_0x4906df+=0x1){_0x4906df>0x0&&(_0x2714c6+='\x20'+_0x132e3a[_0xb687('0x67')]+'\x20');_0x2714c6+=_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x68')]?_0x17505c(_0x132e3a['rules'][_0x4906df][_0xb687('0x68')]):_0x132e3a['rules'][_0x4906df][_0xb687('0x69')]+'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')]+(_0xbc3a94(_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6a')])?'\x20'+_0x132e3a[_0xb687('0x66')][_0x4906df][_0xb687('0x6b')]:'');}return _0x2714c6+')';};var _0x5deb7a={'where':{'id':_0x4fb188['params']['id']}},_0x28a6aa,_0x31ed20,_0x8942b7,_0x36bb4b,_0x258caf;_0x5deb7a=_[_0xb687('0x6c')]({},_0x5deb7a,_0x4fb188[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x5deb7a)[_0xb687('0x28')](function(_0x15ef44){if(_0x15ef44){_0x28a6aa=_0x15ef44;return _0x15ef44[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x177ea4){if(_0x177ea4){if(!_0x177ea4[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x31ed20=_0x177ea4;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x505f7a){if(_0x505f7a){_0x8942b7=_[_0xb687('0x71')](_0x505f7a,'id');var _0x1a6075;var _0x53b00a=squel[_0xb687('0x72')]();_0x53b00a[_0xb687('0x73')](_0x28a6aa[_0xb687('0x74')]);for(var _0x5eeb75=0x0;_0x5eeb75<_0x31ed20[_0xb687('0x3e')];_0x5eeb75+=0x1){_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x75')]?_0x8942b7[_0x31ed20[_0x5eeb75]['MetricId']][_0xb687('0x76')]:_0x31ed20[_0x5eeb75][_0xb687('0x69')];_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x77')]?_[_0xb687('0x78')](_0x25e140[_0x31ed20[_0x5eeb75]['function']],'%s',_0x1a6075):_0x1a6075;_0x1a6075=_0x31ed20[_0x5eeb75][_0xb687('0x79')]?_[_0xb687('0x78')](_0x58ec8b[_0x31ed20[_0x5eeb75]['format']],'%s',_0x1a6075):_0x1a6075;if(_0x31ed20[_0x5eeb75][_0xb687('0x7a')]){_0x53b00a[_0xb687('0x68')](_0x1a6075);}_0x31ed20[_0x5eeb75]['orderBy']&&_0x53b00a['order'](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7b')]==='DESC'?![]:!![]);_0x53b00a[_0xb687('0x69')](_0x1a6075,_0x31ed20[_0x5eeb75][_0xb687('0x7c')]||_0x1a6075);}if(_0x28a6aa[_0xb687('0x7d')]){_0x28a6aa[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x7d')]);for(var _0x229bc4=0x0;_0x229bc4<_0x28a6aa[_0xb687('0x7d')]['length'];_0x229bc4+=0x1){if(_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x5ea8fd,_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')])&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey']&&_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x7f')]&&_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]){_0x53b00a[_0x28a6aa[_0xb687('0x7d')][_0x229bc4][_0xb687('0x36')]](_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['foreignTable'],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x28a6aa['table'],_0x28a6aa[_0xb687('0x7d')][_0x229bc4]['parentKey'],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x7f')],_0x28a6aa['joins'][_0x229bc4][_0xb687('0x80')]));}}}if(_0x28a6aa[_0xb687('0x81')]){_0x28a6aa['conditions']=JSON[_0xb687('0x7e')](_0x28a6aa[_0xb687('0x81')]);_0x53b00a['where'](_0x17505c(_0x28a6aa[_0xb687('0x81')][_0xb687('0x68')]));}_0x258caf=_0x53b00a[_0xb687('0x82')]();_0x53b00a[_0xb687('0x20')](_0x4ab9c5);_0x53b00a[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x53b00a[_0xb687('0x85')]());return dbH[_0xb687('0x86')][_0xb687('0x39')](_0x53b00a[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')]['SELECT']});}})['then'](respondWithResult(_0x13ad6a,null))[_0xb687('0x48')](handleError(_0x13ad6a,null));};function runReport(_0x29e830,_0x22ebca,_0xfecb8d){var _0x3a7339=_0x22ebca['name'];var _0x59c94b=0xa;var _0x29e27e=[_0xb687('0x56'),_0xb687('0x57'),_0xb687('0x58'),'cross_join'];var _0x448d59={'SUM':_0xb687('0x88'),'COUNT':_0xb687('0x59'),'COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':_0xb687('0x5c'),'AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':_0xb687('0x8a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x25f5c3={'SEC_TO_TIME':_0xb687('0x8b'),'DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1037b1=function(_0x3bf480){return!_['includes']([_0xb687('0x62'),'IS\x20NOT\x20NULL',_0xb687('0x64'),_0xb687('0x65')],_0x3bf480);};var _0x5ec5f6=function(_0x1c683e){if(!_0x1c683e||!_0x1c683e[_0xb687('0x66')]['length']){return'';}for(var _0x231caa='(',_0x3479c5=0x0;_0x3479c5<_0x1c683e[_0xb687('0x66')][_0xb687('0x3e')];_0x3479c5+=0x1){_0x3479c5>0x0&&(_0x231caa+='\x20'+_0x1c683e[_0xb687('0x67')]+'\x20');_0x231caa+=_0x1c683e[_0xb687('0x66')][_0x3479c5]['group']?_0x5ec5f6(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x68')]):_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x69')]+'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')]+(_0x1037b1(_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6a')])?'\x20'+_0x1c683e[_0xb687('0x66')][_0x3479c5][_0xb687('0x6b')]:'');}return _0x231caa+')';};var _0x290ddf={'where':{'id':_0x29e830['id']}},_0x5ee585,_0x10fb0,_0x5be566,_0x3d98e2,_0x3aa1c8;_0x290ddf=_['merge']({},_0x290ddf,_0xfecb8d);return db['AnalyticDefaultReport'][_0xb687('0x4d')](_0x290ddf)[_0xb687('0x28')](function(_0x3b4acf){if(_0x3b4acf){_0x5ee585=_0x3b4acf;return _0x3b4acf[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1c3de0){if(_0x1c3de0){if(!_0x1c3de0[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))][(_0xb687('0x8e'))](_0xb687('0x6f'),0x193);}_0x10fb0=_0x1c3de0;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x1ea6fd){if(_0x1ea6fd){_0x5be566=_[_0xb687('0x71')](_0x1ea6fd,'id');var _0x3f45b7;var _0x508550=squel['select']();_0x508550[_0xb687('0x73')](_0x5ee585['table']);for(var _0x5f2557=0x0;_0x5f2557<_0x10fb0[_0xb687('0x3e')];_0x5f2557+=0x1){_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x75')]?_0x5be566[_0x10fb0[_0x5f2557]['MetricId']][_0xb687('0x76')]:_0x10fb0[_0x5f2557][_0xb687('0x69')];_0x3f45b7=_0x10fb0[_0x5f2557]['function']?_[_0xb687('0x78')](_0x448d59[_0x10fb0[_0x5f2557][_0xb687('0x77')]],'%s',_0x3f45b7):_0x3f45b7;_0x3f45b7=_0x10fb0[_0x5f2557][_0xb687('0x79')]?_[_0xb687('0x78')](_0x25f5c3[_0x10fb0[_0x5f2557][_0xb687('0x79')]],'%s',_0x3f45b7):_0x3f45b7;if(_0x10fb0[_0x5f2557][_0xb687('0x7a')]){_0x508550[_0xb687('0x68')](_0x3f45b7);}_0x10fb0[_0x5f2557][_0xb687('0x7b')]&&_0x508550[_0xb687('0x40')](_0x3f45b7,_0x10fb0[_0x5f2557]['orderBy']===_0xb687('0x8f')?![]:!![]);_0x508550[_0xb687('0x69')](_0x3f45b7,_0x10fb0[_0x5f2557]['alias']||_0x3f45b7);}if(_0x5ee585[_0xb687('0x7d')]){_0x5ee585['joins']=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x7d')]);for(var _0x59166c=0x0;_0x59166c<_0x5ee585[_0xb687('0x7d')][_0xb687('0x3e')];_0x59166c+=0x1){if(_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]&&_[_0xb687('0x61')](_0x29e27e,_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')])&&_0x5ee585['joins'][_0x59166c]['parentKey']&&_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignTable']&&_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x80')]){_0x508550[_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x36')]](_0x5ee585['joins'][_0x59166c][_0xb687('0x7f')],null,util[_0xb687('0x79')]('%s.%s\x20=\x20%s.%s',_0x5ee585[_0xb687('0x74')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x90')],_0x5ee585[_0xb687('0x7d')][_0x59166c][_0xb687('0x7f')],_0x5ee585[_0xb687('0x7d')][_0x59166c]['foreignKey']));}}}if(_0x5ee585[_0xb687('0x81')]){_0x5ee585[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x5ee585[_0xb687('0x81')]);_0x508550[_0xb687('0x42')](_0x5ec5f6(_0x5ee585[_0xb687('0x81')][_0xb687('0x68')]));}_0x3aa1c8=_0x508550[_0xb687('0x82')]();_0x508550[_0xb687('0x20')](_0x59c94b);_0x508550[_0xb687('0x1f')](0x0);return;}})['then'](function(){if(_0x22ebca['output']===_0xb687('0x91')){return null;}var _0x1a7cd8=_[_0xb687('0x6c')](_0x22ebca,{'name':_0x22ebca[_0xb687('0x92')]||_0x22ebca[_0xb687('0x2f')]||_0x5ee585[_0xb687('0x2f')],'basename':_0x3a7339,'savename':util[_0xb687('0x79')](_0xb687('0x93'),_0x22ebca[_0xb687('0x2f')]||_0x5ee585['name'],require('randomstring')['generate'](0x4),_0x22ebca[_0xb687('0x94')]||_0xb687('0x95')),'reportId':_0x5ee585['id'],'reportType':_0xb687('0x96')});return db[_0xb687('0x97')][_0xb687('0x4e')](_0x1a7cd8,{'raw':!![]});})[_0xb687('0x28')](function(_0x473130){if(_0x5ee585[_0xb687('0x74')]==='cdr'){_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x98'),_0x22ebca[_0xb687('0x99')],_0x22ebca[_0xb687('0x9a')]);}else{_0x3aa1c8[_0xb687('0x42')](_0x5ee585[_0xb687('0x74')]+_0xb687('0x9b'),_0x22ebca['startDate'],_0x22ebca[_0xb687('0x9a')]);}if(_0x473130){logger['info'](_0xb687('0x9c'),_0x3aa1c8[_0xb687('0x85')]());require('child_process')[_0xb687('0x9d')](path[_0xb687('0x56')](__dirname,_0xb687('0x9e'),_0x473130['output']),[_0x473130['id'],_0x3aa1c8[_0xb687('0x85')](),path[_0xb687('0x56')](__dirname,_0xb687('0x9f'),_0x473130[_0xb687('0xa0')]),_0x3a7339]);return _0x473130;}else{var _0x3d4596=squel[_0xb687('0x72')]();_0x3d4596[_0xb687('0x73')]('('+_0x3aa1c8['toString']()+')',_0xb687('0xa1'));_0x3d4596[_0xb687('0x69')](_0xb687('0xa2'),_0xb687('0x22'));_0x3aa1c8[_0xb687('0x20')](_0x22ebca['limit']||_0x59c94b);_0x3aa1c8[_0xb687('0x1f')](_0x22ebca[_0xb687('0x1f')]||0x0);return dbH[_0xb687('0x86')]['query'](_0x3d4596[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]})['then'](function(_0x3dbbd6){if(!_0x3dbbd6[_0xb687('0x3e')]){_0x3d98e2=0x0;}else{_0x3d98e2=_0x3dbbd6[0x0][_0xb687('0x22')]||0x0;}return dbH['sequelize'][_0xb687('0x39')](_0x3aa1c8[_0xb687('0x85')](),{'type':dbH[_0xb687('0x86')][_0xb687('0x87')][_0xb687('0xa3')]});})[_0xb687('0x28')](function(_0x15e599){return{'rows':_0x15e599||[],'count':_0x3d98e2};});}});}exports[_0xb687('0xa4')]=function(_0x8f6ba0,_0x568aca){return runReport(_0x8f6ba0[_0xb687('0x49')],_0x8f6ba0[_0xb687('0x39')],_0x8f6ba0[_0xb687('0x46')])['then'](respondWithResult(_0x568aca,null))['catch'](handleError(_0x568aca,null));};exports[_0xb687('0xa5')]=runReport;exports['query']=function(_0x187810,_0x1d21ef){var _0x386d12=0xa;var _0x4dd8f4=['join',_0xb687('0x57'),_0xb687('0x58'),_0xb687('0xa6')];var _0x295795={'SUM':_0xb687('0x88'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb687('0x5a'),'MAX':_0xb687('0x5b'),'MIN':'MIN(%s)','AVG':_0xb687('0x5d'),'GROUP_CONCAT':_0xb687('0x89'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb687('0x5e')};var _0xe7056c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb687('0x8c'),'HOUR':_0xb687('0x8d'),'ROUND':_0xb687('0x5f'),'UNIX_TIMESTAMP':_0xb687('0x60')};var _0x1b1cf5=function(_0x46283c){return!_[_0xb687('0x61')](['IS\x20NULL',_0xb687('0x63'),'IS\x20EMPTY',_0xb687('0x65')],_0x46283c);};var _0x394ed6=function(_0x875169){if(!_0x875169||!_0x875169[_0xb687('0x66')]['length']){return'';}for(var _0x1ec485='(',_0x55a919=0x0;_0x55a919<_0x875169['rules'][_0xb687('0x3e')];_0x55a919+=0x1){_0x55a919>0x0&&(_0x1ec485+='\x20'+_0x875169[_0xb687('0x67')]+'\x20');_0x1ec485+=_0x875169[_0xb687('0x66')][_0x55a919]['group']?_0x394ed6(_0x875169[_0xb687('0x66')][_0x55a919][_0xb687('0x68')]):_0x875169['rules'][_0x55a919][_0xb687('0x69')]+'\x20'+_0x875169['rules'][_0x55a919][_0xb687('0x6a')]+(_0x1b1cf5(_0x875169[_0xb687('0x66')][_0x55a919]['condition'])?'\x20'+_0x875169[_0xb687('0x66')][_0x55a919]['value']:'');}return _0x1ec485+')';};var _0x2aecd5={'where':{'id':_0x187810[_0xb687('0x49')]['id']}},_0x58955e,_0x488a2a,_0x303738,_0x3904a3,_0x581338;_0x2aecd5=_['merge']({},_0x2aecd5,_0x187810[_0xb687('0x46')]);return db[_0xb687('0x33')][_0xb687('0x4d')](_0x2aecd5)['then'](function(_0xc29834){if(_0xc29834){_0x58955e=_0xc29834;return _0xc29834[_0xb687('0x6d')]();}return null;})[_0xb687('0x28')](function(_0x1f2f2b){if(_0x1f2f2b){if(!_0x1f2f2b[_0xb687('0x3e')]){throw new db[(_0xb687('0x6e'))]['ValidationErrorItem'](_0xb687('0x6f'),0x193);}_0x488a2a=_0x1f2f2b;return db[_0xb687('0x70')][_0xb687('0x47')]({'raw':!![]});}return null;})[_0xb687('0x28')](function(_0x3591e2){if(_0x3591e2){_0x303738=_['keyBy'](_0x3591e2,'id');var _0x4d0c14;var _0x200b55=squel[_0xb687('0x72')]();_0x200b55[_0xb687('0x73')](_0x58955e[_0xb687('0x74')]);for(var _0x33f4de=0x0;_0x33f4de<_0x488a2a[_0xb687('0x3e')];_0x33f4de+=0x1){_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x75')]?_0x303738[_0x488a2a[_0x33f4de]['MetricId']][_0xb687('0x76')]:_0x488a2a[_0x33f4de][_0xb687('0x69')];_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x77')]?_['replace'](_0x295795[_0x488a2a[_0x33f4de][_0xb687('0x77')]],'%s',_0x4d0c14):_0x4d0c14;_0x4d0c14=_0x488a2a[_0x33f4de][_0xb687('0x79')]?_[_0xb687('0x78')](_0xe7056c[_0x488a2a[_0x33f4de]['format']],'%s',_0x4d0c14):_0x4d0c14;if(_0x488a2a[_0x33f4de][_0xb687('0x7a')]){_0x200b55[_0xb687('0x68')](_0x4d0c14);}_0x488a2a[_0x33f4de]['orderBy']&&_0x200b55[_0xb687('0x40')](_0x4d0c14,_0x488a2a[_0x33f4de][_0xb687('0x7b')]===_0xb687('0x8f')?![]:!![]);_0x200b55[_0xb687('0x69')](_0x4d0c14,_0x488a2a[_0x33f4de]['alias']||_0x4d0c14);}if(_0x58955e[_0xb687('0x7d')]){_0x58955e[_0xb687('0x7d')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x7d')]);for(var _0xcff220=0x0;_0xcff220<_0x58955e['joins'][_0xb687('0x3e')];_0xcff220+=0x1){if(_0x58955e[_0xb687('0x7d')][_0xcff220]['type']&&_[_0xb687('0x61')](_0x4dd8f4,_0x58955e[_0xb687('0x7d')][_0xcff220]['type'])&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')]&&_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable']&&_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x80')]){_0x200b55[_0x58955e['joins'][_0xcff220]['type']](_0x58955e['joins'][_0xcff220][_0xb687('0x7f')],null,util['format'](_0xb687('0xa7'),_0x58955e[_0xb687('0x74')],_0x58955e[_0xb687('0x7d')][_0xcff220][_0xb687('0x90')],_0x58955e[_0xb687('0x7d')][_0xcff220]['foreignTable'],_0x58955e['joins'][_0xcff220][_0xb687('0x80')]));}}}if(_0x58955e[_0xb687('0x81')]){_0x58955e[_0xb687('0x81')]=JSON[_0xb687('0x7e')](_0x58955e[_0xb687('0x81')]);_0x200b55[_0xb687('0x42')](_0x394ed6(_0x58955e[_0xb687('0x81')]['group']));}_0x581338=_0x200b55['clone']();_0x200b55['limit'](_0x386d12);_0x200b55[_0xb687('0x1f')](0x0);logger[_0xb687('0x83')](_0xb687('0x84'),_0x200b55['toString']());return dbH['sequelize']['query'](_0x200b55[_0xb687('0x85')](),{'type':dbH['sequelize'][_0xb687('0x87')][_0xb687('0xa3')]});}})[_0xb687('0x28')](function(){return{'sql':_0x581338[_0xb687('0x85')]()};})[_0xb687('0x28')](respondWithResult(_0x1d21ef,null))[_0xb687('0x48')](handleError(_0x1d21ef,null));}; \ No newline at end of file +var _0x46ed=['SEC_TO_TIME(%s)','value','AnalyticMetric','select','DESC','output','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','left_join','COUNT(%s)','MIN(%s)','AVG(%s)','Limited\x20Query:','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','QueryTypes','SELECT'];(function(_0xa0d7ba,_0x303316){var _0x58fa94=function(_0x35d056){while(--_0x35d056){_0xa0d7ba['push'](_0xa0d7ba['shift']());}};_0x58fa94(++_0x303316);}(_0x46ed,0x168));var _0xd46e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x46ed[_0x42cae2];return _0x5f256f;};'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'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xf3048c,_0x27dbfb){_0x27dbfb=_0x27dbfb||0xcc;return function(_0x53b309){if(_0x53b309){return _0xf3048c['sendStatus'](_0x27dbfb);}return _0xf3048c[_0xd46e('0x1a')](_0x27dbfb)[_0xd46e('0x1b')]();};}function respondWithResult(_0x1e9aae,_0x3fdf88){_0x3fdf88=_0x3fdf88||0xc8;return function(_0x50c7c3){if(_0x50c7c3){return _0x1e9aae[_0xd46e('0x1a')](_0x3fdf88)[_0xd46e('0x1c')](_0x50c7c3);}};}function respondWithFilteredResult(_0x417402,_0x3d72ce){return function(_0x36a317){if(_0x36a317){var _0x47fa8f=typeof _0x3d72ce[_0xd46e('0x1d')]===_0xd46e('0x1e')&&typeof _0x3d72ce[_0xd46e('0x1f')]==='undefined';var _0x5ddd04=_0x36a317[_0xd46e('0x20')];var _0x1bd574=_0x47fa8f?0x0:_0x3d72ce['offset'];var _0x4fd1f2=_0x47fa8f?_0x36a317[_0xd46e('0x20')]:_0x3d72ce[_0xd46e('0x1d')]+_0x3d72ce[_0xd46e('0x1f')];var _0x2273c5;if(_0x4fd1f2>=_0x5ddd04){_0x4fd1f2=_0x5ddd04;_0x2273c5=0xc8;}else{_0x2273c5=0xce;}_0x417402[_0xd46e('0x1a')](_0x2273c5);return _0x417402[_0xd46e('0x21')](_0xd46e('0x22'),_0x1bd574+'-'+_0x4fd1f2+'/'+_0x5ddd04)[_0xd46e('0x1c')](_0x36a317);}return null;};}function patchUpdates(_0xb4940){return function(_0x3c7e91){try{jsonpatch[_0xd46e('0x23')](_0x3c7e91,_0xb4940,!![]);}catch(_0x5ba94d){return BPromise[_0xd46e('0x24')](_0x5ba94d);}return _0x3c7e91[_0xd46e('0x25')]();};}function saveUpdates(_0x79aa51,_0x45ce0b){return function(_0x128246){if(_0x128246){return _0x128246[_0xd46e('0x26')](_0x79aa51)[_0xd46e('0x27')](function(_0x8a1be){return _0x8a1be;});}return null;};}function removeEntity(_0x62dea5,_0x4cf899){return function(_0x314570){if(_0x314570){return _0x314570['destroy']()['then'](function(){var _0x371054=_0x314570[_0xd46e('0x28')]({'plain':!![]});var _0x21135f=_0xd46e('0x29');return db[_0xd46e('0x2a')][_0xd46e('0x2b')]({'where':{'type':_0x21135f,'resourceId':_0x371054['id']}})[_0xd46e('0x27')](function(){return _0x314570;});})['then'](function(){_0x62dea5[_0xd46e('0x1a')](0xcc)[_0xd46e('0x1b')]();});}};}function handleEntityNotFound(_0xddbce9,_0x17db79){return function(_0x96f15c){if(!_0x96f15c){_0xddbce9[_0xd46e('0x2c')](0x194);}return _0x96f15c;};}function handleError(_0x58aeef,_0x465d54){_0x465d54=_0x465d54||0x1f4;return function(_0x3a1ced){logger[_0xd46e('0x2d')](_0x3a1ced[_0xd46e('0x2e')]);if(_0x3a1ced[_0xd46e('0x2f')]){delete _0x3a1ced[_0xd46e('0x2f')];}_0x58aeef[_0xd46e('0x1a')](_0x465d54)[_0xd46e('0x30')](_0x3a1ced);};}exports[_0xd46e('0x31')]=function(_0x45ea47,_0x2ff785){var _0x504324={},_0x2f4a1b={},_0x5ed8dc={'count':0x0,'rows':[]};var _0x1248ce=_[_0xd46e('0x32')](db[_0xd46e('0x33')][_0xd46e('0x34')],function(_0x5ef248){return{'name':_0x5ef248[_0xd46e('0x35')],'type':_0x5ef248[_0xd46e('0x36')]['key']};});_0x2f4a1b[_0xd46e('0x37')]=_[_0xd46e('0x32')](_0x1248ce,'name');_0x2f4a1b[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x45ea47[_0xd46e('0x38')]);_0x2f4a1b['filters']=_['intersection'](_0x2f4a1b[_0xd46e('0x37')],_0x2f4a1b[_0xd46e('0x38')]);_0x504324[_0xd46e('0x3a')]=_[_0xd46e('0x3b')](_0x2f4a1b[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x504324['attributes']=_0x504324[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x504324[_0xd46e('0x3a')]:_0x2f4a1b[_0xd46e('0x37')];if(!_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3e')](_0xd46e('0x3f'))){_0x504324['limit']=qs[_0xd46e('0x1f')](_0x45ea47[_0xd46e('0x38')]['limit']);_0x504324[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x1d')]);}_0x504324['order']=qs[_0xd46e('0x40')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x40')]);_0x504324[_0xd46e('0x41')]=qs[_0xd46e('0x42')](_[_0xd46e('0x43')](_0x45ea47[_0xd46e('0x38')],_0x2f4a1b[_0xd46e('0x42')]),_0x1248ce);if(_0x45ea47['query'][_0xd46e('0x44')]){_0x504324[_0xd46e('0x41')]=_[_0xd46e('0x45')](_0x504324[_0xd46e('0x41')],{'$or':_[_0xd46e('0x32')](_0x1248ce,function(_0x56f99c){if(_0x56f99c[_0xd46e('0x36')]!=='VIRTUAL'){var _0x55230d={};_0x55230d[_0x56f99c['name']]={'$like':'%'+_0x45ea47['query'][_0xd46e('0x44')]+'%'};return _0x55230d;}})});}_0x504324=_['merge']({},_0x504324,_0x45ea47[_0xd46e('0x46')]);var _0x40720e={'where':_0x504324['where']};return db[_0xd46e('0x33')][_0xd46e('0x20')](_0x40720e)[_0xd46e('0x27')](function(_0x31ba12){_0x5ed8dc[_0xd46e('0x20')]=_0x31ba12;if(_0x45ea47[_0xd46e('0x38')][_0xd46e('0x47')]){_0x504324[_0xd46e('0x48')]=[{'all':!![]}];}return db[_0xd46e('0x33')][_0xd46e('0x49')](_0x504324);})[_0xd46e('0x27')](function(_0x5ea048){_0x5ed8dc['rows']=_0x5ea048;return _0x5ed8dc;})['then'](respondWithFilteredResult(_0x2ff785,_0x504324))[_0xd46e('0x4a')](handleError(_0x2ff785,null));};exports['show']=function(_0x168d35,_0x272f5f){var _0x3fdf67={'raw':!![],'where':{'id':_0x168d35[_0xd46e('0x4b')]['id']}},_0x416505={};_0x416505[_0xd46e('0x37')]=_[_0xd46e('0x39')](db[_0xd46e('0x33')]['rawAttributes']);_0x416505[_0xd46e('0x38')]=_['keys'](_0x168d35[_0xd46e('0x38')]);_0x416505[_0xd46e('0x42')]=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],_0x416505[_0xd46e('0x38')]);_0x3fdf67['attributes']=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x168d35[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x3fdf67['attributes']=_0x3fdf67[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x3fdf67[_0xd46e('0x3a')]:_0x416505[_0xd46e('0x37')];if(_0x168d35[_0xd46e('0x38')]['includeAll']){_0x3fdf67[_0xd46e('0x48')]=[{'all':!![]}];}_0x3fdf67=_[_0xd46e('0x45')]({},_0x3fdf67,_0x168d35[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fdf67)[_0xd46e('0x27')](handleEntityNotFound(_0x272f5f,null))[_0xd46e('0x27')](respondWithResult(_0x272f5f,null))[_0xd46e('0x4a')](handleError(_0x272f5f,null));};exports['create']=function(_0xf9dab,_0x71a8dc){return db[_0xd46e('0x33')][_0xd46e('0x4d')](_0xf9dab[_0xd46e('0x4e')],{})['then'](function(_0x4ae314){var _0x3a94cf=_0xf9dab[_0xd46e('0x4f')][_0xd46e('0x28')]({'plain':!![]});if(!_0x3a94cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a94cf['role']===_0xd46e('0x4f')){var _0x9d8638=_0x4ae314['get']({'plain':!![]});var _0x2eee92=_0xd46e('0x50');return db[_0xd46e('0x51')][_0xd46e('0x4c')]({'where':{'name':_0x2eee92,'userProfileId':_0x3a94cf[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x27')](function(_0x80ed51){if(_0x80ed51&&_0x80ed51[_0xd46e('0x53')]===0x0){return db['UserProfileResource'][_0xd46e('0x4d')]({'name':_0x9d8638[_0xd46e('0x2f')],'resourceId':_0x9d8638['id'],'type':_0xd46e('0x29'),'sectionId':_0x80ed51['id']},{})[_0xd46e('0x27')](function(){return _0x4ae314;});}else{return _0x4ae314;}})['catch'](function(_0x56dd9a){logger[_0xd46e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56dd9a);throw _0x56dd9a;});}return _0x4ae314;})[_0xd46e('0x27')](respondWithResult(_0x71a8dc,0xc9))[_0xd46e('0x4a')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x26')]=function(_0x31f7eb,_0x5a7870){if(_0x31f7eb[_0xd46e('0x4e')]['id']){delete _0x31f7eb['body']['id'];}return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x31f7eb[_0xd46e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7870,null))[_0xd46e('0x27')](saveUpdates(_0x31f7eb[_0xd46e('0x4e')],null))[_0xd46e('0x27')](respondWithResult(_0x5a7870,null))[_0xd46e('0x4a')](handleError(_0x5a7870,null));};exports[_0xd46e('0x2b')]=function(_0x2cc676,_0x2760ef){return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x2cc676[_0xd46e('0x4b')]['id']}})[_0xd46e('0x27')](handleEntityNotFound(_0x2760ef,null))[_0xd46e('0x27')](removeEntity(_0x2760ef,null))[_0xd46e('0x4a')](handleError(_0x2760ef,null));};exports[_0xd46e('0x54')]=function(_0x47a86c,_0x3ec709){var _0x37a22f=0xa;var _0xe0cd61=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0xaf9641={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x481dce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x2dacb4=function(_0x2f9fcb){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x2f9fcb);};var _0x1aaa99=function(_0x272514){if(!_0x272514||!_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x476f09='(',_0x5067b7=0x0;_0x5067b7<_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')];_0x5067b7+=0x1){_0x5067b7>0x0&&(_0x476f09+='\x20'+_0x272514[_0xd46e('0x68')]+'\x20');_0x476f09+=_0x272514['rules'][_0x5067b7][_0xd46e('0x69')]?_0x1aaa99(_0x272514[_0xd46e('0x67')][_0x5067b7]['group']):_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6a')]+'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['condition']+(_0x2dacb4(_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6b')])?'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['value']:'');}return _0x476f09+')';};var _0xe5f8cd={'where':{'id':_0x47a86c[_0xd46e('0x4b')]['id']}},_0x516e7d,_0x32eed0,_0x148187,_0x35db1b,_0x4f3ba0;_0xe5f8cd=_[_0xd46e('0x45')]({},_0xe5f8cd,_0x47a86c[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0xe5f8cd)[_0xd46e('0x27')](function(_0x16f906){if(_0x16f906){_0x516e7d=_0x16f906;return _0x16f906[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0x3e55a3){if(_0x3e55a3){if(!_0x3e55a3[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))](_0xd46e('0x6f'),0x193);}_0x32eed0=_0x3e55a3;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3e0ed5){if(_0x3e0ed5){_0x148187=_[_0xd46e('0x70')](_0x3e0ed5,'id');var _0x2fff69;var _0x249938=squel['select']();_0x249938[_0xd46e('0x71')](_0x516e7d[_0xd46e('0x72')]);for(var _0xfb4073=0x0;_0xfb4073<_0x32eed0[_0xd46e('0x3d')];_0xfb4073+=0x1){_0x2fff69=_0x32eed0[_0xfb4073]['MetricId']?_0x148187[_0x32eed0[_0xfb4073][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x32eed0[_0xfb4073]['field'];_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0xaf9641[_0x32eed0[_0xfb4073]['function']],'%s',_0x2fff69):_0x2fff69;_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x481dce[_0x32eed0[_0xfb4073]['format']],'%s',_0x2fff69):_0x2fff69;if(_0x32eed0[_0xfb4073][_0xd46e('0x78')]){_0x249938['group'](_0x2fff69);}_0x32eed0[_0xfb4073][_0xd46e('0x79')]&&_0x249938[_0xd46e('0x7a')](_0x2fff69,_0x32eed0[_0xfb4073]['orderBy']==='DESC'?![]:!![]);_0x249938[_0xd46e('0x6a')](_0x2fff69,_0x32eed0[_0xfb4073][_0xd46e('0x7b')]||_0x2fff69);}if(_0x516e7d[_0xd46e('0x7c')]){_0x516e7d[_0xd46e('0x7c')]=JSON['parse'](_0x516e7d[_0xd46e('0x7c')]);for(var _0x372509=0x0;_0x372509<_0x516e7d['joins'][_0xd46e('0x3d')];_0x372509+=0x1){if(_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0xe0cd61,_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')])&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7d')]&&_0x516e7d[_0xd46e('0x7c')][_0x372509]['foreignTable']&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7e')]){_0x249938[_0x516e7d['joins'][_0x372509][_0xd46e('0x36')]](_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0x516e7d[_0xd46e('0x72')],_0x516e7d['joins'][_0x372509]['parentKey'],_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],_0x516e7d['joins'][_0x372509]['foreignKey']));}}}if(_0x516e7d['conditions']){_0x516e7d[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x516e7d[_0xd46e('0x81')]);_0x249938['where'](_0x1aaa99(_0x516e7d[_0xd46e('0x81')][_0xd46e('0x69')]));}_0x4f3ba0=_0x249938[_0xd46e('0x83')]();_0x249938['limit'](_0x37a22f);_0x249938['offset'](0x0);logger['debug']('Limited\x20Query:',_0x249938[_0xd46e('0x84')]());return dbH['sequelize'][_0xd46e('0x38')](_0x249938['toString'](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](respondWithResult(_0x3ec709,null))[_0xd46e('0x4a')](handleError(_0x3ec709,null));};function runReport(_0xf16d87,_0x99872a,_0x57a7cc){var _0x586024=_0x99872a[_0xd46e('0x2f')];var _0x383919=0xa;var _0x114f2c=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0x4ca21f={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x5ef4cc={'SEC_TO_TIME':_0xd46e('0x87'),'DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x88460a=function(_0x3a3744){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x3a3744);};var _0x3c476d=function(_0x1b2a6d){if(!_0x1b2a6d||!_0x1b2a6d[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x441f73='(',_0x1d2738=0x0;_0x1d2738<_0x1b2a6d['rules'][_0xd46e('0x3d')];_0x1d2738+=0x1){_0x1d2738>0x0&&(_0x441f73+='\x20'+_0x1b2a6d['operator']+'\x20');_0x441f73+=_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x69')]?_0x3c476d(_0x1b2a6d['rules'][_0x1d2738][_0xd46e('0x69')]):_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6a')]+'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')]+(_0x88460a(_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')])?'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x88')]:'');}return _0x441f73+')';};var _0x3fa34d={'where':{'id':_0xf16d87['id']}},_0xc098c9,_0x5f5ba7,_0x493df5,_0x18e140,_0x459a0c;_0x3fa34d=_[_0xd46e('0x45')]({},_0x3fa34d,_0x57a7cc);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fa34d)[_0xd46e('0x27')](function(_0x5b554e){if(_0x5b554e){_0xc098c9=_0x5b554e;return _0x5b554e[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0xa254f5){if(_0xa254f5){if(!_0xa254f5[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5f5ba7=_0xa254f5;return db[_0xd46e('0x89')][_0xd46e('0x49')]({'raw':!![]});}return null;})['then'](function(_0x3c8d68){if(_0x3c8d68){_0x493df5=_[_0xd46e('0x70')](_0x3c8d68,'id');var _0x9e222d;var _0x3da17e=squel[_0xd46e('0x8a')]();_0x3da17e[_0xd46e('0x71')](_0xc098c9[_0xd46e('0x72')]);for(var _0x282f71=0x0;_0x282f71<_0x5f5ba7[_0xd46e('0x3d')];_0x282f71+=0x1){_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x73')]?_0x493df5[_0x5f5ba7[_0x282f71][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x5f5ba7[_0x282f71][_0xd46e('0x6a')];_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x75')]?_['replace'](_0x4ca21f[_0x5f5ba7[_0x282f71]['function']],'%s',_0x9e222d):_0x9e222d;_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x5ef4cc[_0x5f5ba7[_0x282f71][_0xd46e('0x77')]],'%s',_0x9e222d):_0x9e222d;if(_0x5f5ba7[_0x282f71][_0xd46e('0x78')]){_0x3da17e[_0xd46e('0x69')](_0x9e222d);}_0x5f5ba7[_0x282f71][_0xd46e('0x79')]&&_0x3da17e['order'](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x3da17e[_0xd46e('0x6a')](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x7b')]||_0x9e222d);}if(_0xc098c9['joins']){_0xc098c9[_0xd46e('0x7c')]=JSON[_0xd46e('0x82')](_0xc098c9['joins']);for(var _0xdf967c=0x0;_0xdf967c<_0xc098c9['joins']['length'];_0xdf967c+=0x1){if(_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x114f2c,_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['type'])&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7d')]&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7f')]&&_0xc098c9['joins'][_0xdf967c]['foreignKey']){_0x3da17e[_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]](_0xc098c9['joins'][_0xdf967c]['foreignTable'],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0xc098c9[_0xd46e('0x72')],_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['parentKey'],_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x7f')],_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7e')]));}}}if(_0xc098c9[_0xd46e('0x81')]){_0xc098c9[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0xc098c9[_0xd46e('0x81')]);_0x3da17e[_0xd46e('0x41')](_0x3c476d(_0xc098c9['conditions'][_0xd46e('0x69')]));}_0x459a0c=_0x3da17e[_0xd46e('0x83')]();_0x3da17e['limit'](_0x383919);_0x3da17e['offset'](0x0);return;}})[_0xd46e('0x27')](function(){if(_0x99872a[_0xd46e('0x8c')]==='web'){return null;}var _0x5e637d=_[_0xd46e('0x45')](_0x99872a,{'name':_0x99872a[_0xd46e('0x8d')]||_0x99872a['name']||_0xc098c9[_0xd46e('0x2f')],'basename':_0x586024,'savename':util[_0xd46e('0x77')](_0xd46e('0x8e'),_0x99872a[_0xd46e('0x2f')]||_0xc098c9[_0xd46e('0x2f')],require(_0xd46e('0x8f'))['generate'](0x4),_0x99872a[_0xd46e('0x8c')]||_0xd46e('0x90')),'reportId':_0xc098c9['id'],'reportType':_0xd46e('0x91')});return db[_0xd46e('0x92')][_0xd46e('0x4d')](_0x5e637d,{'raw':!![]});})[_0xd46e('0x27')](function(_0x3311a6){if(_0xc098c9[_0xd46e('0x72')]===_0xd46e('0x93')){_0x459a0c[_0xd46e('0x41')](_0xc098c9[_0xd46e('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x99872a[_0xd46e('0x94')],_0x99872a['endDate']);}else{_0x459a0c['where'](_0xc098c9[_0xd46e('0x72')]+_0xd46e('0x95'),_0x99872a[_0xd46e('0x94')],_0x99872a[_0xd46e('0x96')]);}if(_0x3311a6){logger[_0xd46e('0x97')](_0xd46e('0x98'),_0x459a0c[_0xd46e('0x84')]());require(_0xd46e('0x99'))['fork'](path[_0xd46e('0x55')](__dirname,'../../components/export/',_0x3311a6[_0xd46e('0x8c')]),[_0x3311a6['id'],_0x459a0c[_0xd46e('0x84')](),path[_0xd46e('0x55')](__dirname,_0xd46e('0x9a'),_0x3311a6[_0xd46e('0x9b')]),_0x586024]);return _0x3311a6;}else{var _0x399918=squel[_0xd46e('0x8a')]();_0x399918[_0xd46e('0x71')]('('+_0x459a0c['toString']()+')',_0xd46e('0x9c'));_0x399918[_0xd46e('0x6a')](_0xd46e('0x9d'),'count');_0x459a0c[_0xd46e('0x1f')](_0x99872a[_0xd46e('0x1f')]||_0x383919);_0x459a0c[_0xd46e('0x1d')](_0x99872a['offset']||0x0);return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x399918[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]})['then'](function(_0x4967ff){if(!_0x4967ff[_0xd46e('0x3d')]){_0x18e140=0x0;}else{_0x18e140=_0x4967ff[0x0][_0xd46e('0x20')]||0x0;}return dbH['sequelize'][_0xd46e('0x38')](_0x459a0c[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]});})[_0xd46e('0x27')](function(_0x4bb76b){return{'rows':_0x4bb76b||[],'count':_0x18e140};});}});}exports['run']=function(_0x204a9f,_0x52ca5a){return runReport(_0x204a9f[_0xd46e('0x4b')],_0x204a9f[_0xd46e('0x38')],_0x204a9f['options'])[_0xd46e('0x27')](respondWithResult(_0x52ca5a,null))[_0xd46e('0x4a')](handleError(_0x52ca5a,null));};exports[_0xd46e('0x9f')]=runReport;exports[_0xd46e('0x38')]=function(_0x786ae,_0x537c73){var _0x1610bd=0xa;var _0x20cc4c=[_0xd46e('0x55'),_0xd46e('0xa0'),_0xd46e('0x56'),_0xd46e('0x57')];var _0x368742={'SUM':_0xd46e('0x58'),'COUNT':_0xd46e('0xa1'),'COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':_0xd46e('0xa2'),'AVG':_0xd46e('0xa3'),'GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x285cf8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc87da2=function(_0x195f02){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),'IS\x20NOT\x20NULL',_0xd46e('0x65'),_0xd46e('0x66')],_0x195f02);};var _0x44322f=function(_0x49959f){if(!_0x49959f||!_0x49959f['rules'][_0xd46e('0x3d')]){return'';}for(var _0x2094e5='(',_0x85aac1=0x0;_0x85aac1<_0x49959f[_0xd46e('0x67')][_0xd46e('0x3d')];_0x85aac1+=0x1){_0x85aac1>0x0&&(_0x2094e5+='\x20'+_0x49959f[_0xd46e('0x68')]+'\x20');_0x2094e5+=_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]?_0x44322f(_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]):_0x49959f['rules'][_0x85aac1][_0xd46e('0x6a')]+'\x20'+_0x49959f['rules'][_0x85aac1]['condition']+(_0xc87da2(_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x6b')])?'\x20'+_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x88')]:'');}return _0x2094e5+')';};var _0x101a29={'where':{'id':_0x786ae[_0xd46e('0x4b')]['id']}},_0x3a44da,_0x417068,_0x52e73e,_0x206077,_0xe729b6;_0x101a29=_[_0xd46e('0x45')]({},_0x101a29,_0x786ae[_0xd46e('0x46')]);return db['AnalyticDefaultReport'][_0xd46e('0x4c')](_0x101a29)[_0xd46e('0x27')](function(_0x1d08bb){if(_0x1d08bb){_0x3a44da=_0x1d08bb;return _0x1d08bb['getFields']();}return null;})[_0xd46e('0x27')](function(_0x8c6ed1){if(_0x8c6ed1){if(!_0x8c6ed1['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xd46e('0x6f'),0x193);}_0x417068=_0x8c6ed1;return db[_0xd46e('0x89')]['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3a13f8){if(_0x3a13f8){_0x52e73e=_['keyBy'](_0x3a13f8,'id');var _0x5a8661;var _0x157fb0=squel[_0xd46e('0x8a')]();_0x157fb0[_0xd46e('0x71')](_0x3a44da[_0xd46e('0x72')]);for(var _0x50750f=0x0;_0x50750f<_0x417068['length'];_0x50750f+=0x1){_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x73')]?_0x52e73e[_0x417068[_0x50750f][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x417068[_0x50750f][_0xd46e('0x6a')];_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0x368742[_0x417068[_0x50750f][_0xd46e('0x75')]],'%s',_0x5a8661):_0x5a8661;_0x5a8661=_0x417068[_0x50750f]['format']?_[_0xd46e('0x76')](_0x285cf8[_0x417068[_0x50750f][_0xd46e('0x77')]],'%s',_0x5a8661):_0x5a8661;if(_0x417068[_0x50750f]['groupBy']){_0x157fb0[_0xd46e('0x69')](_0x5a8661);}_0x417068[_0x50750f][_0xd46e('0x79')]&&_0x157fb0[_0xd46e('0x7a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x157fb0[_0xd46e('0x6a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x7b')]||_0x5a8661);}if(_0x3a44da[_0xd46e('0x7c')]){_0x3a44da['joins']=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x7c')]);for(var _0x3c819b=0x0;_0x3c819b<_0x3a44da[_0xd46e('0x7c')][_0xd46e('0x3d')];_0x3c819b+=0x1){if(_0x3a44da['joins'][_0x3c819b][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x20cc4c,_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')])&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7d')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']){_0x157fb0[_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')]](_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3a44da[_0xd46e('0x72')],_0x3a44da['joins'][_0x3c819b][_0xd46e('0x7d')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']));}}}if(_0x3a44da[_0xd46e('0x81')]){_0x3a44da[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x81')]);_0x157fb0[_0xd46e('0x41')](_0x44322f(_0x3a44da[_0xd46e('0x81')][_0xd46e('0x69')]));}_0xe729b6=_0x157fb0[_0xd46e('0x83')]();_0x157fb0[_0xd46e('0x1f')](_0x1610bd);_0x157fb0['offset'](0x0);logger['debug'](_0xd46e('0xa4'),_0x157fb0['toString']());return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x157fb0[_0xd46e('0x84')](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](function(){return{'sql':_0xe729b6['toString']()};})['then'](respondWithResult(_0x537c73,null))[_0xd46e('0x4a')](handleError(_0x537c73,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index e06c9b5..55df9e8 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 _0x84b8=['analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./analyticDefaultReport.attributes','exports'];(function(_0x5a2d95,_0xb362e5){var _0x2c3986=function(_0x5cce7c){while(--_0x5cce7c){_0x5a2d95['push'](_0x5a2d95['shift']());}};_0x2c3986(++_0xb362e5);}(_0x84b8,0x17d));var _0x884b=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x84b8[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x884b('0x0'));var util=require(_0x884b('0x1'));var logger=require(_0x884b('0x2'))('api');var moment=require(_0x884b('0x3'));var BPromise=require(_0x884b('0x4'));var rp=require(_0x884b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x884b('0x6'));var config=require('../../config/environment');var attributes=require(_0x884b('0x7'));module[_0x884b('0x8')]=function(_0x1f769c,_0x2752fe){return _0x1f769c['define']('AnalyticDefaultReport',attributes,{'tableName':_0x884b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d32=['bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','define','analytics_default_reports','lodash','util','../../config/logger','api','moment'];(function(_0x151b2a,_0x2b88b8){var _0x5c2c04=function(_0x1786d0){while(--_0x1786d0){_0x151b2a['push'](_0x151b2a['shift']());}};_0x5c2c04(++_0x2b88b8);}(_0x1d32,0x1f3));var _0x21d3=function(_0x56ebc5,_0x4bede2){_0x56ebc5=_0x56ebc5-0x0;var _0x4a1a12=_0x1d32[_0x56ebc5];return _0x4a1a12;};'use strict';var _=require(_0x21d3('0x0'));var util=require(_0x21d3('0x1'));var logger=require(_0x21d3('0x2'))(_0x21d3('0x3'));var moment=require(_0x21d3('0x4'));var BPromise=require(_0x21d3('0x5'));var rp=require(_0x21d3('0x6'));var fs=require('fs');var path=require(_0x21d3('0x7'));var rimraf=require('rimraf');var config=require(_0x21d3('0x8'));var attributes=require(_0x21d3('0x9'));module['exports']=function(_0x35dbda,_0xfa67ba){return _0x35dbda[_0x21d3('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x21d3('0xb'),'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 05a29d2..37e3e34 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 _0xd473=['request','debug','request\x20sent','error','AnalyticDefaultReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd473,0x182));var _0x3d47=function(_0x3ca970,_0x44d9b3){_0x3ca970=_0x3ca970-0x0;var _0x1c9622=_0xd473[_0x3ca970];return _0x1c9622;};'use strict';var _=require(_0x3d47('0x0'));var util=require(_0x3d47('0x1'));var moment=require(_0x3d47('0x2'));var BPromise=require(_0x3d47('0x3'));var rs=require(_0x3d47('0x4'));var fs=require('fs');var Redis=require(_0x3d47('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3d47('0x6'))(_0x3d47('0x7'));var config=require(_0x3d47('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3d47('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdd27fc,_0x132650,_0x501536){return new BPromise(function(_0x294fad,_0x32e5ae){return client[_0x3d47('0xa')](_0xdd27fc,_0x501536)['then'](function(_0x1b1c66){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x132650,'request\x20sent');logger[_0x3d47('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x132650,_0x3d47('0xc'),JSON['stringify'](_0x1b1c66));if(_0x1b1c66[_0x3d47('0xd')]){if(_0x1b1c66[_0x3d47('0xd')]['code']===0x1f4){logger[_0x3d47('0xd')](_0x3d47('0xe'),_0x132650,_0x1b1c66[_0x3d47('0xd')][_0x3d47('0xf')]);return _0x32e5ae(_0x1b1c66['error'][_0x3d47('0xf')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x132650,_0x1b1c66[_0x3d47('0xd')]['message']);return _0x294fad(_0x1b1c66[_0x3d47('0xd')]['message']);}else{logger[_0x3d47('0x10')](_0x3d47('0xe'),_0x132650,_0x3d47('0xc'));_0x294fad(_0x1b1c66['result']['message']);}})[_0x3d47('0x11')](function(_0x1b1c56){logger[_0x3d47('0xd')](_0x3d47('0xe'),_0x132650,_0x1b1c56);_0x32e5ae(_0x1b1c56);});});} \ No newline at end of file +var _0x36cd=['client','http','request','then','info','request\x20sent','stringify','error','code','message','AnalyticDefaultReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x45cb02,_0x1f26d4){var _0x333239=function(_0x41f9fa){while(--_0x41f9fa){_0x45cb02['push'](_0x45cb02['shift']());}};_0x333239(++_0x1f26d4);}(_0x36cd,0xae));var _0xd36c=function(_0x511598,_0x50cf30){_0x511598=_0x511598-0x0;var _0x505848=_0x36cd[_0x511598];return _0x505848;};'use strict';var _=require(_0xd36c('0x0'));var util=require(_0xd36c('0x1'));var moment=require(_0xd36c('0x2'));var BPromise=require(_0xd36c('0x3'));var rs=require(_0xd36c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd36c('0x5'))['db'];var utils=require(_0xd36c('0x6'));var logger=require(_0xd36c('0x7'))(_0xd36c('0x8'));var config=require(_0xd36c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd36c('0xa')][_0xd36c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfed3c0,_0x425c20,_0x1dca13){return new BPromise(function(_0x5ad927,_0x23d29b){return client[_0xd36c('0xc')](_0xfed3c0,_0x1dca13)[_0xd36c('0xd')](function(_0x51b2b8){logger[_0xd36c('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x425c20,'request\x20sent');logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x425c20,_0xd36c('0xf'),JSON[_0xd36c('0x10')](_0x51b2b8));if(_0x51b2b8[_0xd36c('0x11')]){if(_0x51b2b8['error'][_0xd36c('0x12')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x425c20,_0x51b2b8[_0xd36c('0x11')]['message']);return _0x23d29b(_0x51b2b8[_0xd36c('0x11')][_0xd36c('0x13')]);}logger[_0xd36c('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x425c20,_0x51b2b8[_0xd36c('0x11')][_0xd36c('0x13')]);return _0x5ad927(_0x51b2b8[_0xd36c('0x11')][_0xd36c('0x13')]);}else{logger[_0xd36c('0xe')](_0xd36c('0x14'),_0x425c20,_0xd36c('0xf'));_0x5ad927(_0x51b2b8[_0xd36c('0x15')][_0xd36c('0x13')]);}})[_0xd36c('0x16')](function(_0x3c9c5a){logger[_0xd36c('0x11')](_0xd36c('0x14'),_0x425c20,_0x3c9c5a);_0x23d29b(_0x3c9c5a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 0cadd72..829ea09 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 _0x179f=['query','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/query'];(function(_0x271980,_0x594695){var _0x3cd4a6=function(_0x3a44f2){while(--_0x3a44f2){_0x271980['push'](_0x271980['shift']());}};_0x3cd4a6(++_0x594695);}(_0x179f,0x1e8));var _0xf179=function(_0x3c44ae,_0x381dd0){_0x3c44ae=_0x3c44ae-0x0;var _0x52aa36=_0x179f[_0x3c44ae];return _0x52aa36;};'use strict';var multer=require(_0xf179('0x0'));var util=require('util');var path=require(_0xf179('0x1'));var timeout=require(_0xf179('0x2'));var express=require(_0xf179('0x3'));var router=express[_0xf179('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf179('0x5'));var interaction=require(_0xf179('0x6'));var config=require(_0xf179('0x7'));var controller=require(_0xf179('0x8'));router[_0xf179('0x9')]('/',auth[_0xf179('0xa')](),controller[_0xf179('0xb')]);router['get'](_0xf179('0xc'),auth[_0xf179('0xa')](),controller[_0xf179('0xd')]);router[_0xf179('0x9')](_0xf179('0xe'),auth[_0xf179('0xa')](),controller['preview']);router[_0xf179('0x9')]('/:id/run',auth[_0xf179('0xa')](),controller['run']);router[_0xf179('0x9')](_0xf179('0xf'),auth['isAuthenticated'](),controller[_0xf179('0x10')]);router[_0xf179('0x11')]('/',auth[_0xf179('0xa')](),controller[_0xf179('0x12')]);router[_0xf179('0x13')](_0xf179('0xc'),auth[_0xf179('0xa')](),controller[_0xf179('0x14')]);router[_0xf179('0x15')](_0xf179('0xc'),auth[_0xf179('0xa')](),controller[_0xf179('0x16')]);module[_0xf179('0x17')]=router; \ No newline at end of file +var _0x64cb=['express','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','/:id/preview','isAuthenticated','preview','/:id/run','run','/:id/query','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x1816e7,_0x31e64f){var _0x5bc6e0=function(_0x3fe991){while(--_0x3fe991){_0x1816e7['push'](_0x1816e7['shift']());}};_0x5bc6e0(++_0x31e64f);}(_0x64cb,0x163));var _0xb64c=function(_0x5ba513,_0x459c3b){_0x5ba513=_0x5ba513-0x0;var _0x1132a0=_0x64cb[_0x5ba513];return _0x1132a0;};'use strict';var multer=require('multer');var util=require(_0xb64c('0x0'));var path=require(_0xb64c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb64c('0x2'));var router=express['Router']();var fs_extra=require(_0xb64c('0x3'));var auth=require(_0xb64c('0x4'));var interaction=require(_0xb64c('0x5'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0xb64c('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb64c('0x6')](_0xb64c('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xb64c('0x6')](_0xb64c('0x8'),auth[_0xb64c('0x9')](),controller[_0xb64c('0xa')]);router['get'](_0xb64c('0xb'),auth[_0xb64c('0x9')](),controller[_0xb64c('0xc')]);router[_0xb64c('0x6')](_0xb64c('0xd'),auth['isAuthenticated'](),controller['query']);router[_0xb64c('0xe')]('/',auth[_0xb64c('0x9')](),controller[_0xb64c('0xf')]);router[_0xb64c('0x10')](_0xb64c('0x7'),auth[_0xb64c('0x9')](),controller[_0xb64c('0x11')]);router[_0xb64c('0x12')](_0xb64c('0x7'),auth[_0xb64c('0x9')](),controller[_0xb64c('0x13')]);module[_0xb64c('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index e45e35d..7ce7b45 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 _0xc651=['STRING','csv','Loading','ENUM','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment'];(function(_0x3917ec,_0x58ba5f){var _0x3c27f0=function(_0x5c80cf){while(--_0x5c80cf){_0x3917ec['push'](_0x3917ec['shift']());}};_0x3c27f0(++_0x58ba5f);}(_0xc651,0x1e8));var _0x1c65=function(_0xc9116f,_0x16e521){_0xc9116f=_0xc9116f-0x0;var _0x1374bb=_0xc651[_0xc9116f];return _0x1374bb;};'use strict';var Sequelize=require(_0x1c65('0x0'));var moment=require(_0x1c65('0x1'));module['exports']={'name':{'type':Sequelize[_0x1c65('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x1c65('0x3'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0x1c65('0x3')},'savename':{'type':Sequelize[_0x1c65('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x1c65('0x2')],'defaultValue':_0x1c65('0x4')},'type':{'type':Sequelize[_0x1c65('0x5')](_0x1c65('0x6'),_0x1c65('0x7')),'allowNull':![],'defaultValue':_0x1c65('0x6')},'reportId':{'type':Sequelize[_0x1c65('0x8')](0xb)[_0x1c65('0x9')]},'reportType':{'type':Sequelize[_0x1c65('0x2')]}}; \ No newline at end of file +var _0xf263=['pdf','xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv'];(function(_0x5a2b1a,_0x156796){var _0x1a1fa9=function(_0x212dd4){while(--_0x212dd4){_0x5a2b1a['push'](_0x5a2b1a['shift']());}};_0x1a1fa9(++_0x156796);}(_0xf263,0xf1));var _0x3f26=function(_0x4cfa2e,_0x5752b5){_0x4cfa2e=_0x4cfa2e-0x0;var _0x279b50=_0xf263[_0x4cfa2e];return _0x279b50;};'use strict';var Sequelize=require(_0x3f26('0x0'));var moment=require(_0x3f26('0x1'));module[_0x3f26('0x2')]={'name':{'type':Sequelize[_0x3f26('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x3f26('0x4')](_0x3f26('0x5'),_0x3f26('0x6'),_0x3f26('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x3f26('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x3f26('0x8')]},'endDate':{'type':Sequelize[_0x3f26('0x8')]},'status':{'type':Sequelize[_0x3f26('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x3f26('0x9'),_0x3f26('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x3f26('0xb')](0xb)[_0x3f26('0xc')]},'reportType':{'type':Sequelize[_0x3f26('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 66c226d..5b57a5d 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 _0xa13e=['sort','where','pick','filters','VIRTUAL','filter','merge','options','findAll','rows','catch','show','include','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','download','basename','join','root','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','output','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','ExtractedReports','UserProfileResource','error','name','send','index','AnalyticExtractedReport','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x1243a1,_0x5a066f){var _0x51e9c1=function(_0x17fab5){while(--_0x17fab5){_0x1243a1['push'](_0x1243a1['shift']());}};_0x51e9c1(++_0x5a066f);}(_0xa13e,0x83));var _0xea13=function(_0x4ac080,_0x4c728e){_0x4ac080=_0x4ac080-0x0;var _0x39bdbc=_0xa13e[_0x4ac080];return _0x39bdbc;};'use strict';var emlformat=require(_0xea13('0x0'));var rimraf=require(_0xea13('0x1'));var zipdir=require(_0xea13('0x2'));var jsonpatch=require(_0xea13('0x3'));var rp=require(_0xea13('0x4'));var moment=require('moment');var BPromise=require(_0xea13('0x5'));var Mustache=require(_0xea13('0x6'));var util=require(_0xea13('0x7'));var path=require('path');var sox=require(_0xea13('0x8'));var csv=require(_0xea13('0x9'));var ejs=require(_0xea13('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea13('0xb'));var squel=require(_0xea13('0xc'));var crypto=require(_0xea13('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xea13('0xe'));var toCsv=require(_0xea13('0x9'));var querystring=require(_0xea13('0xf'));var Papa=require('papaparse');var Redis=require(_0xea13('0x10'));var authService=require(_0xea13('0x11'));var qs=require(_0xea13('0x12'));var as=require(_0xea13('0x13'));var hardwareService=require(_0xea13('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xea13('0x15'));var config=require(_0xea13('0x16'));var licenseUtil=require(_0xea13('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x215532,_0x413f9b){_0x413f9b=_0x413f9b||0xcc;return function(_0x5c795a){if(_0x5c795a){return _0x215532[_0xea13('0x18')](_0x413f9b);}return _0x215532[_0xea13('0x19')](_0x413f9b)[_0xea13('0x1a')]();};}function respondWithResult(_0x2b150f,_0x5a3bba){_0x5a3bba=_0x5a3bba||0xc8;return function(_0x40a45d){if(_0x40a45d){return _0x2b150f['status'](_0x5a3bba)[_0xea13('0x1b')](_0x40a45d);}};}function respondWithFilteredResult(_0x4bf69e,_0x55b61e){return function(_0x57d521){if(_0x57d521){var _0x21f9ee=typeof _0x55b61e[_0xea13('0x1c')]===_0xea13('0x1d')&&typeof _0x55b61e[_0xea13('0x1e')]==='undefined';var _0x251e84=_0x57d521[_0xea13('0x1f')];var _0x3c188f=_0x21f9ee?0x0:_0x55b61e[_0xea13('0x1c')];var _0x57b05d=_0x21f9ee?_0x57d521[_0xea13('0x1f')]:_0x55b61e[_0xea13('0x1c')]+_0x55b61e['limit'];var _0x7a0f0a;if(_0x57b05d>=_0x251e84){_0x57b05d=_0x251e84;_0x7a0f0a=0xc8;}else{_0x7a0f0a=0xce;}_0x4bf69e['status'](_0x7a0f0a);return _0x4bf69e[_0xea13('0x20')](_0xea13('0x21'),_0x3c188f+'-'+_0x57b05d+'/'+_0x251e84)[_0xea13('0x1b')](_0x57d521);}return null;};}function patchUpdates(_0x2dcb2f){return function(_0x4a0ef1){try{jsonpatch[_0xea13('0x22')](_0x4a0ef1,_0x2dcb2f,!![]);}catch(_0x474a82){return BPromise[_0xea13('0x23')](_0x474a82);}return _0x4a0ef1['save']();};}function saveUpdates(_0x546884,_0x3fa950){return function(_0x3fcd51){if(_0x3fcd51){return _0x3fcd51['update'](_0x546884)[_0xea13('0x24')](function(_0x18d760){return _0x18d760;});}return null;};}function removeEntity(_0x238b49,_0x5a7747){return function(_0x1b2dd0){if(_0x1b2dd0){return _0x1b2dd0[_0xea13('0x25')]()[_0xea13('0x24')](function(){var _0x52fee1=_0x1b2dd0[_0xea13('0x26')]({'plain':!![]});var _0x447529=_0xea13('0x27');return db[_0xea13('0x28')]['destroy']({'where':{'type':_0x447529,'resourceId':_0x52fee1['id']}})['then'](function(){return _0x1b2dd0;});})['then'](function(){_0x238b49[_0xea13('0x19')](0xcc)[_0xea13('0x1a')]();});}};}function handleEntityNotFound(_0x3d7b84,_0x527695){return function(_0x3d8f48){if(!_0x3d8f48){_0x3d7b84['sendStatus'](0x194);}return _0x3d8f48;};}function handleError(_0x412851,_0x84e7e){_0x84e7e=_0x84e7e||0x1f4;return function(_0x354a58){logger[_0xea13('0x29')](_0x354a58['stack']);if(_0x354a58['name']){delete _0x354a58[_0xea13('0x2a')];}_0x412851[_0xea13('0x19')](_0x84e7e)[_0xea13('0x2b')](_0x354a58);};}exports[_0xea13('0x2c')]=function(_0x1f18d5,_0x352b1f){var _0x3ffac7={},_0x30bd93={},_0x5fb542={'count':0x0,'rows':[]};var _0x475bc7=_['map'](db[_0xea13('0x2d')]['rawAttributes'],function(_0x2fe5d5){return{'name':_0x2fe5d5[_0xea13('0x2e')],'type':_0x2fe5d5[_0xea13('0x2f')][_0xea13('0x30')]};});_0x30bd93[_0xea13('0x31')]=_[_0xea13('0x32')](_0x475bc7,_0xea13('0x2a'));_0x30bd93[_0xea13('0x33')]=_['keys'](_0x1f18d5[_0xea13('0x33')]);_0x30bd93['filters']=_[_0xea13('0x34')](_0x30bd93[_0xea13('0x31')],_0x30bd93[_0xea13('0x33')]);_0x3ffac7[_0xea13('0x35')]=_[_0xea13('0x34')](_0x30bd93['model'],qs[_0xea13('0x36')](_0x1f18d5[_0xea13('0x33')][_0xea13('0x36')]));_0x3ffac7[_0xea13('0x35')]=_0x3ffac7['attributes'][_0xea13('0x37')]?_0x3ffac7[_0xea13('0x35')]:_0x30bd93[_0xea13('0x31')];if(!_0x1f18d5['query'][_0xea13('0x38')](_0xea13('0x39'))){_0x3ffac7[_0xea13('0x1e')]=qs['limit'](_0x1f18d5['query']['limit']);_0x3ffac7[_0xea13('0x1c')]=qs[_0xea13('0x1c')](_0x1f18d5['query'][_0xea13('0x1c')]);}_0x3ffac7[_0xea13('0x3a')]=qs[_0xea13('0x3b')](_0x1f18d5[_0xea13('0x33')][_0xea13('0x3b')]);_0x3ffac7[_0xea13('0x3c')]=qs['filters'](_[_0xea13('0x3d')](_0x1f18d5[_0xea13('0x33')],_0x30bd93[_0xea13('0x3e')]),_0x475bc7);if(_0x1f18d5[_0xea13('0x33')]['filter']){_0x3ffac7['where']=_['merge'](_0x3ffac7[_0xea13('0x3c')],{'$or':_[_0xea13('0x32')](_0x475bc7,function(_0x7fe28d){if(_0x7fe28d[_0xea13('0x2f')]!==_0xea13('0x3f')){var _0x5b5b90={};_0x5b5b90[_0x7fe28d['name']]={'$like':'%'+_0x1f18d5[_0xea13('0x33')][_0xea13('0x40')]+'%'};return _0x5b5b90;}})});}_0x3ffac7=_[_0xea13('0x41')]({},_0x3ffac7,_0x1f18d5[_0xea13('0x42')]);var _0x1560b7={'where':_0x3ffac7[_0xea13('0x3c')]};return db[_0xea13('0x2d')][_0xea13('0x1f')](_0x1560b7)[_0xea13('0x24')](function(_0x3364df){_0x5fb542[_0xea13('0x1f')]=_0x3364df;if(_0x1f18d5[_0xea13('0x33')]['includeAll']){_0x3ffac7['include']=[{'all':!![]}];}return db[_0xea13('0x2d')][_0xea13('0x43')](_0x3ffac7);})[_0xea13('0x24')](function(_0xe8ee51){_0x5fb542[_0xea13('0x44')]=_0xe8ee51;return _0x5fb542;})[_0xea13('0x24')](respondWithFilteredResult(_0x352b1f,_0x3ffac7))[_0xea13('0x45')](handleError(_0x352b1f,null));};exports[_0xea13('0x46')]=function(_0xe958be,_0x15ebac){var _0x3e4109={'raw':!![],'where':{'id':_0xe958be['params']['id']}},_0x824e51={};_0x824e51[_0xea13('0x31')]=_['keys'](db[_0xea13('0x2d')]['rawAttributes']);_0x824e51[_0xea13('0x33')]=_['keys'](_0xe958be[_0xea13('0x33')]);_0x824e51[_0xea13('0x3e')]=_[_0xea13('0x34')](_0x824e51[_0xea13('0x31')],_0x824e51['query']);_0x3e4109['attributes']=_[_0xea13('0x34')](_0x824e51[_0xea13('0x31')],qs[_0xea13('0x36')](_0xe958be[_0xea13('0x33')][_0xea13('0x36')]));_0x3e4109['attributes']=_0x3e4109[_0xea13('0x35')][_0xea13('0x37')]?_0x3e4109['attributes']:_0x824e51[_0xea13('0x31')];if(_0xe958be[_0xea13('0x33')]['includeAll']){_0x3e4109[_0xea13('0x47')]=[{'all':!![]}];}_0x3e4109=_[_0xea13('0x41')]({},_0x3e4109,_0xe958be[_0xea13('0x42')]);return db['AnalyticExtractedReport']['find'](_0x3e4109)['then'](handleEntityNotFound(_0x15ebac,null))['then'](respondWithResult(_0x15ebac,null))['catch'](handleError(_0x15ebac,null));};exports['create']=function(_0x2941e8,_0x4cdedc){return db[_0xea13('0x2d')]['create'](_0x2941e8[_0xea13('0x48')],{})[_0xea13('0x24')](function(_0x4bc496){var _0x1ba52f=_0x2941e8[_0xea13('0x49')]['get']({'plain':!![]});if(!_0x1ba52f)throw new Error(_0xea13('0x4a'));if(_0x1ba52f[_0xea13('0x4b')]===_0xea13('0x49')){var _0x45b4a8=_0x4bc496[_0xea13('0x26')]({'plain':!![]});var _0x3d7af8=_0xea13('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x3d7af8,'userProfileId':_0x1ba52f['userProfileId']},'raw':!![]})[_0xea13('0x24')](function(_0x305925){if(_0x305925&&_0x305925[_0xea13('0x4c')]===0x0){return db[_0xea13('0x28')][_0xea13('0x4d')]({'name':_0x45b4a8[_0xea13('0x2a')],'resourceId':_0x45b4a8['id'],'type':_0x305925[_0xea13('0x2a')],'sectionId':_0x305925['id']},{})['then'](function(){return _0x4bc496;});}else{return _0x4bc496;}})[_0xea13('0x45')](function(_0x52fce9){logger['error'](_0xea13('0x4e'),_0x52fce9);throw _0x52fce9;});}return _0x4bc496;})[_0xea13('0x24')](respondWithResult(_0x4cdedc,0xc9))[_0xea13('0x45')](handleError(_0x4cdedc,null));};exports[_0xea13('0x4f')]=function(_0xbe3f4e,_0x2853be){if(_0xbe3f4e[_0xea13('0x48')]['id']){delete _0xbe3f4e[_0xea13('0x48')]['id'];}return db[_0xea13('0x2d')][_0xea13('0x50')]({'where':{'id':_0xbe3f4e[_0xea13('0x51')]['id']}})[_0xea13('0x24')](handleEntityNotFound(_0x2853be,null))[_0xea13('0x24')](saveUpdates(_0xbe3f4e[_0xea13('0x48')],null))[_0xea13('0x24')](respondWithResult(_0x2853be,null))['catch'](handleError(_0x2853be,null));};exports[_0xea13('0x25')]=function(_0x45bbfe,_0x380387){return db['AnalyticExtractedReport'][_0xea13('0x50')]({'where':{'id':_0x45bbfe[_0xea13('0x51')]['id']}})[_0xea13('0x24')](handleEntityNotFound(_0x380387,null))[_0xea13('0x24')](removeEntity(_0x380387,null))[_0xea13('0x45')](handleError(_0x380387,null));};exports[_0xea13('0x52')]=function(_0x5dafe4,_0x2eb11f,_0x5654ae){return db[_0xea13('0x2d')][_0xea13('0x50')]({'where':{'id':_0x5dafe4[_0xea13('0x51')]['id']},'attributes':[_0xea13('0x2a'),_0xea13('0x53'),'savename','output'],'raw':!![]})[_0xea13('0x24')](handleEntityNotFound(_0x2eb11f,null))[_0xea13('0x24')](function(_0x11dfb1){if(_0x11dfb1){if(!fs['existsSync'](path[_0xea13('0x54')](config[_0xea13('0x55')],_0xea13('0x56'),_0x11dfb1[_0xea13('0x57')]))){throw new db[(_0xea13('0x58'))]['ValidationError'](_0xea13('0x59'));}if(_0x5dafe4[_0xea13('0x33')][_0xea13('0x5a')]){return _0x2eb11f[_0xea13('0x18')](0xc8);}return _0x2eb11f[_0xea13('0x52')](path[_0xea13('0x54')](config[_0xea13('0x55')],'server/files/reports',_0x11dfb1[_0xea13('0x57')]),util[_0xea13('0x5b')](_0xea13('0x5c'),_0x11dfb1[_0xea13('0x53')]||_0x11dfb1['name'],_0x11dfb1[_0xea13('0x5d')][_0xea13('0x5e')]()));}})[_0xea13('0x45')](handleError(_0x2eb11f,null));}; \ No newline at end of file +var _0x0ee4=['error','stack','name','send','map','AnalyticExtractedReport','fieldName','type','key','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','catch','show','params','intersection','options','find','create','user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','output','existsSync','join','root','Sequelize','ValidationError','server/files/reports','format','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','save','update','then','destroy','get','ExtractedReports'];(function(_0x146a97,_0x2d8483){var _0x259d5c=function(_0x3ca436){while(--_0x3ca436){_0x146a97['push'](_0x146a97['shift']());}};_0x259d5c(++_0x2d8483);}(_0x0ee4,0x93));var _0x40ee=function(_0x3bc404,_0x55c90b){_0x3bc404=_0x3bc404-0x0;var _0x115f41=_0x0ee4[_0x3bc404];return _0x115f41;};'use strict';var emlformat=require(_0x40ee('0x0'));var rimraf=require(_0x40ee('0x1'));var zipdir=require(_0x40ee('0x2'));var jsonpatch=require(_0x40ee('0x3'));var rp=require(_0x40ee('0x4'));var moment=require(_0x40ee('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x40ee('0x6'));var util=require(_0x40ee('0x7'));var path=require(_0x40ee('0x8'));var sox=require('sox');var csv=require(_0x40ee('0x9'));var ejs=require(_0x40ee('0xa'));var fs=require('fs');var fs_extra=require(_0x40ee('0xb'));var _=require(_0x40ee('0xc'));var squel=require(_0x40ee('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x40ee('0xe'));var toCsv=require('to-csv');var querystring=require(_0x40ee('0xf'));var Papa=require(_0x40ee('0x10'));var Redis=require('ioredis');var authService=require(_0x40ee('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x40ee('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x40ee('0x13'))('api');var utils=require(_0x40ee('0x14'));var config=require(_0x40ee('0x15'));var licenseUtil=require(_0x40ee('0x16'));var db=require(_0x40ee('0x17'))['db'];function respondWithStatusCode(_0x145fd1,_0x2477ca){_0x2477ca=_0x2477ca||0xcc;return function(_0x3a4817){if(_0x3a4817){return _0x145fd1[_0x40ee('0x18')](_0x2477ca);}return _0x145fd1['status'](_0x2477ca)[_0x40ee('0x19')]();};}function respondWithResult(_0x545063,_0x1472b6){_0x1472b6=_0x1472b6||0xc8;return function(_0x28494a){if(_0x28494a){return _0x545063['status'](_0x1472b6)[_0x40ee('0x1a')](_0x28494a);}};}function respondWithFilteredResult(_0x476538,_0x156394){return function(_0x56e69b){if(_0x56e69b){var _0x1f4777=typeof _0x156394[_0x40ee('0x1b')]==='undefined'&&typeof _0x156394[_0x40ee('0x1c')]===_0x40ee('0x1d');var _0x55daff=_0x56e69b[_0x40ee('0x1e')];var _0x3eb212=_0x1f4777?0x0:_0x156394['offset'];var _0x1591b1=_0x1f4777?_0x56e69b['count']:_0x156394[_0x40ee('0x1b')]+_0x156394[_0x40ee('0x1c')];var _0x4920ac;if(_0x1591b1>=_0x55daff){_0x1591b1=_0x55daff;_0x4920ac=0xc8;}else{_0x4920ac=0xce;}_0x476538[_0x40ee('0x1f')](_0x4920ac);return _0x476538[_0x40ee('0x20')](_0x40ee('0x21'),_0x3eb212+'-'+_0x1591b1+'/'+_0x55daff)[_0x40ee('0x1a')](_0x56e69b);}return null;};}function patchUpdates(_0x44912f){return function(_0x4c4c0a){try{jsonpatch[_0x40ee('0x22')](_0x4c4c0a,_0x44912f,!![]);}catch(_0x2c0485){return BPromise['reject'](_0x2c0485);}return _0x4c4c0a[_0x40ee('0x23')]();};}function saveUpdates(_0xbf597e,_0x54963c){return function(_0x148dde){if(_0x148dde){return _0x148dde[_0x40ee('0x24')](_0xbf597e)[_0x40ee('0x25')](function(_0x44564b){return _0x44564b;});}return null;};}function removeEntity(_0x3b6e81,_0x49f265){return function(_0x5e06c7){if(_0x5e06c7){return _0x5e06c7[_0x40ee('0x26')]()[_0x40ee('0x25')](function(){var _0x59b00e=_0x5e06c7[_0x40ee('0x27')]({'plain':!![]});var _0x23e1c7=_0x40ee('0x28');return db['UserProfileResource'][_0x40ee('0x26')]({'where':{'type':_0x23e1c7,'resourceId':_0x59b00e['id']}})['then'](function(){return _0x5e06c7;});})['then'](function(){_0x3b6e81[_0x40ee('0x1f')](0xcc)[_0x40ee('0x19')]();});}};}function handleEntityNotFound(_0x1b25bd,_0x2a7f3d){return function(_0x258eba){if(!_0x258eba){_0x1b25bd['sendStatus'](0x194);}return _0x258eba;};}function handleError(_0x165423,_0x2f119d){_0x2f119d=_0x2f119d||0x1f4;return function(_0x36c793){logger[_0x40ee('0x29')](_0x36c793[_0x40ee('0x2a')]);if(_0x36c793['name']){delete _0x36c793[_0x40ee('0x2b')];}_0x165423[_0x40ee('0x1f')](_0x2f119d)[_0x40ee('0x2c')](_0x36c793);};}exports['index']=function(_0x31581b,_0x3c5d64){var _0x507fd2={},_0x3e1787={},_0x3d2f1c={'count':0x0,'rows':[]};var _0x2fb632=_[_0x40ee('0x2d')](db[_0x40ee('0x2e')]['rawAttributes'],function(_0x1400d2){return{'name':_0x1400d2[_0x40ee('0x2f')],'type':_0x1400d2[_0x40ee('0x30')][_0x40ee('0x31')]};});_0x3e1787['model']=_[_0x40ee('0x2d')](_0x2fb632,'name');_0x3e1787['query']=_[_0x40ee('0x32')](_0x31581b[_0x40ee('0x33')]);_0x3e1787[_0x40ee('0x34')]=_['intersection'](_0x3e1787[_0x40ee('0x35')],_0x3e1787[_0x40ee('0x33')]);_0x507fd2[_0x40ee('0x36')]=_['intersection'](_0x3e1787[_0x40ee('0x35')],qs[_0x40ee('0x37')](_0x31581b[_0x40ee('0x33')][_0x40ee('0x37')]));_0x507fd2[_0x40ee('0x36')]=_0x507fd2[_0x40ee('0x36')][_0x40ee('0x38')]?_0x507fd2[_0x40ee('0x36')]:_0x3e1787[_0x40ee('0x35')];if(!_0x31581b[_0x40ee('0x33')][_0x40ee('0x39')](_0x40ee('0x3a'))){_0x507fd2[_0x40ee('0x1c')]=qs[_0x40ee('0x1c')](_0x31581b[_0x40ee('0x33')][_0x40ee('0x1c')]);_0x507fd2['offset']=qs[_0x40ee('0x1b')](_0x31581b['query'][_0x40ee('0x1b')]);}_0x507fd2[_0x40ee('0x3b')]=qs[_0x40ee('0x3c')](_0x31581b['query']['sort']);_0x507fd2[_0x40ee('0x3d')]=qs[_0x40ee('0x34')](_[_0x40ee('0x3e')](_0x31581b[_0x40ee('0x33')],_0x3e1787[_0x40ee('0x34')]),_0x2fb632);if(_0x31581b[_0x40ee('0x33')][_0x40ee('0x3f')]){_0x507fd2['where']=_['merge'](_0x507fd2[_0x40ee('0x3d')],{'$or':_[_0x40ee('0x2d')](_0x2fb632,function(_0x192d10){if(_0x192d10[_0x40ee('0x30')]!==_0x40ee('0x40')){var _0x3690ab={};_0x3690ab[_0x192d10[_0x40ee('0x2b')]]={'$like':'%'+_0x31581b['query'][_0x40ee('0x3f')]+'%'};return _0x3690ab;}})});}_0x507fd2=_[_0x40ee('0x41')]({},_0x507fd2,_0x31581b['options']);var _0x1e502b={'where':_0x507fd2[_0x40ee('0x3d')]};return db[_0x40ee('0x2e')]['count'](_0x1e502b)[_0x40ee('0x25')](function(_0x531188){_0x3d2f1c[_0x40ee('0x1e')]=_0x531188;if(_0x31581b[_0x40ee('0x33')][_0x40ee('0x42')]){_0x507fd2[_0x40ee('0x43')]=[{'all':!![]}];}return db[_0x40ee('0x2e')]['findAll'](_0x507fd2);})['then'](function(_0x3904ac){_0x3d2f1c['rows']=_0x3904ac;return _0x3d2f1c;})[_0x40ee('0x25')](respondWithFilteredResult(_0x3c5d64,_0x507fd2))[_0x40ee('0x44')](handleError(_0x3c5d64,null));};exports[_0x40ee('0x45')]=function(_0x18f4a5,_0x4258d7){var _0x97a197={'raw':!![],'where':{'id':_0x18f4a5[_0x40ee('0x46')]['id']}},_0x56a2ec={};_0x56a2ec[_0x40ee('0x35')]=_[_0x40ee('0x32')](db[_0x40ee('0x2e')]['rawAttributes']);_0x56a2ec[_0x40ee('0x33')]=_[_0x40ee('0x32')](_0x18f4a5[_0x40ee('0x33')]);_0x56a2ec[_0x40ee('0x34')]=_[_0x40ee('0x47')](_0x56a2ec['model'],_0x56a2ec[_0x40ee('0x33')]);_0x97a197['attributes']=_[_0x40ee('0x47')](_0x56a2ec['model'],qs[_0x40ee('0x37')](_0x18f4a5['query'][_0x40ee('0x37')]));_0x97a197[_0x40ee('0x36')]=_0x97a197['attributes'][_0x40ee('0x38')]?_0x97a197[_0x40ee('0x36')]:_0x56a2ec['model'];if(_0x18f4a5[_0x40ee('0x33')][_0x40ee('0x42')]){_0x97a197[_0x40ee('0x43')]=[{'all':!![]}];}_0x97a197=_[_0x40ee('0x41')]({},_0x97a197,_0x18f4a5[_0x40ee('0x48')]);return db['AnalyticExtractedReport'][_0x40ee('0x49')](_0x97a197)[_0x40ee('0x25')](handleEntityNotFound(_0x4258d7,null))['then'](respondWithResult(_0x4258d7,null))['catch'](handleError(_0x4258d7,null));};exports['create']=function(_0x347dad,_0x560f90){return db[_0x40ee('0x2e')][_0x40ee('0x4a')](_0x347dad['body'],{})[_0x40ee('0x25')](function(_0x1cc3ba){var _0x442044=_0x347dad[_0x40ee('0x4b')]['get']({'plain':!![]});if(!_0x442044)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x442044[_0x40ee('0x4c')]===_0x40ee('0x4b')){var _0x1558d8=_0x1cc3ba[_0x40ee('0x27')]({'plain':!![]});var _0x2fef84=_0x40ee('0x28');return db['UserProfileSection'][_0x40ee('0x49')]({'where':{'name':_0x2fef84,'userProfileId':_0x442044[_0x40ee('0x4d')]},'raw':!![]})[_0x40ee('0x25')](function(_0x1465f5){if(_0x1465f5&&_0x1465f5[_0x40ee('0x4e')]===0x0){return db[_0x40ee('0x4f')][_0x40ee('0x4a')]({'name':_0x1558d8[_0x40ee('0x2b')],'resourceId':_0x1558d8['id'],'type':_0x1465f5['name'],'sectionId':_0x1465f5['id']},{})[_0x40ee('0x25')](function(){return _0x1cc3ba;});}else{return _0x1cc3ba;}})['catch'](function(_0x379b35){logger[_0x40ee('0x29')](_0x40ee('0x50'),_0x379b35);throw _0x379b35;});}return _0x1cc3ba;})[_0x40ee('0x25')](respondWithResult(_0x560f90,0xc9))[_0x40ee('0x44')](handleError(_0x560f90,null));};exports['update']=function(_0x41a30c,_0x341e8f){if(_0x41a30c[_0x40ee('0x51')]['id']){delete _0x41a30c[_0x40ee('0x51')]['id'];}return db[_0x40ee('0x2e')]['find']({'where':{'id':_0x41a30c[_0x40ee('0x46')]['id']}})[_0x40ee('0x25')](handleEntityNotFound(_0x341e8f,null))[_0x40ee('0x25')](saveUpdates(_0x41a30c[_0x40ee('0x51')],null))['then'](respondWithResult(_0x341e8f,null))['catch'](handleError(_0x341e8f,null));};exports[_0x40ee('0x26')]=function(_0x388115,_0x1a900c){return db[_0x40ee('0x2e')][_0x40ee('0x49')]({'where':{'id':_0x388115[_0x40ee('0x46')]['id']}})[_0x40ee('0x25')](handleEntityNotFound(_0x1a900c,null))[_0x40ee('0x25')](removeEntity(_0x1a900c,null))[_0x40ee('0x44')](handleError(_0x1a900c,null));};exports[_0x40ee('0x52')]=function(_0x5186c2,_0x3121c4,_0x147cde){return db[_0x40ee('0x2e')][_0x40ee('0x49')]({'where':{'id':_0x5186c2[_0x40ee('0x46')]['id']},'attributes':['name',_0x40ee('0x53'),_0x40ee('0x54'),_0x40ee('0x55')],'raw':!![]})[_0x40ee('0x25')](handleEntityNotFound(_0x3121c4,null))[_0x40ee('0x25')](function(_0x14b5cf){if(_0x14b5cf){if(!fs[_0x40ee('0x56')](path[_0x40ee('0x57')](config[_0x40ee('0x58')],'server/files/reports',_0x14b5cf[_0x40ee('0x54')]))){throw new db[(_0x40ee('0x59'))][(_0x40ee('0x5a'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x5186c2[_0x40ee('0x33')]['exists']){return _0x3121c4[_0x40ee('0x18')](0xc8);}return _0x3121c4[_0x40ee('0x52')](path[_0x40ee('0x57')](config[_0x40ee('0x58')],_0x40ee('0x5b'),_0x14b5cf['savename']),util[_0x40ee('0x5c')]('%s.%s',_0x14b5cf[_0x40ee('0x53')]||_0x14b5cf[_0x40ee('0x2b')],_0x14b5cf['output'][_0x40ee('0x5d')]()));}})[_0x40ee('0x44')](handleError(_0x3121c4,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 0bf7d47..f3466ba 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 _0xf6b6=['analytics_extracted_reports','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define'];(function(_0x557294,_0x54718d){var _0x5e27ab=function(_0x618caa){while(--_0x618caa){_0x557294['push'](_0x557294['shift']());}};_0x5e27ab(++_0x54718d);}(_0xf6b6,0x123));var _0x6f6b=function(_0x299a73,_0x2ec8c3){_0x299a73=_0x299a73-0x0;var _0x267aff=_0xf6b6[_0x299a73];return _0x267aff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f6b('0x0'))(_0x6f6b('0x1'));var moment=require(_0x6f6b('0x2'));var BPromise=require('bluebird');var rp=require(_0x6f6b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6f6b('0x4'));var config=require(_0x6f6b('0x5'));var attributes=require(_0x6f6b('0x6'));module[_0x6f6b('0x7')]=function(_0x514a18,_0x20754f){return _0x514a18[_0x6f6b('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0x6f6b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9814=['lodash','../../config/logger','api','moment','bluebird','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x152b96,_0x5a5b7d){var _0x57c512=function(_0x26402e){while(--_0x26402e){_0x152b96['push'](_0x152b96['shift']());}};_0x57c512(++_0x5a5b7d);}(_0x9814,0x12c));var _0x4981=function(_0x3bc162,_0x3b140b){_0x3bc162=_0x3bc162-0x0;var _0x38e762=_0x9814[_0x3bc162];return _0x38e762;};'use strict';var _=require(_0x4981('0x0'));var util=require('util');var logger=require(_0x4981('0x1'))(_0x4981('0x2'));var moment=require(_0x4981('0x3'));var BPromise=require(_0x4981('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(_0x4981('0x5'));module[_0x4981('0x6')]=function(_0x48d2c9,_0x5a6857){return _0x48d2c9[_0x4981('0x7')](_0x4981('0x8'),attributes,{'tableName':_0x4981('0x9'),'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 4ac8b7b..c8a273d 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 _0x23cf=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis'];(function(_0xaf9ed3,_0x2ba36a){var _0x8cd948=function(_0x347b7e){while(--_0x347b7e){_0xaf9ed3['push'](_0xaf9ed3['shift']());}};_0x8cd948(++_0x2ba36a);}(_0x23cf,0x8f));var _0xf23c=function(_0x1a1ecc,_0x25ba00){_0x1a1ecc=_0x1a1ecc-0x0;var _0x505576=_0x23cf[_0x1a1ecc];return _0x505576;};'use strict';var _=require('lodash');var util=require(_0xf23c('0x0'));var moment=require('moment');var BPromise=require(_0xf23c('0x1'));var rs=require(_0xf23c('0x2'));var fs=require('fs');var Redis=require(_0xf23c('0x3'));var db=require(_0xf23c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf23c('0x5'))('rpc');var config=require(_0xf23c('0x6'));var jayson=require(_0xf23c('0x7'));var client=jayson['client'][_0xf23c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x231399,_0x4485a3,_0x5c3333){return new BPromise(function(_0x587fd2,_0x3a6b25){return client[_0xf23c('0x9')](_0x231399,_0x5c3333)[_0xf23c('0xa')](function(_0x13cedd){logger['info'](_0xf23c('0xb'),_0x4485a3,'request\x20sent');logger[_0xf23c('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x4485a3,_0xf23c('0xd'),JSON[_0xf23c('0xe')](_0x13cedd));if(_0x13cedd['error']){if(_0x13cedd[_0xf23c('0xf')][_0xf23c('0x10')]===0x1f4){logger[_0xf23c('0xf')](_0xf23c('0xb'),_0x4485a3,_0x13cedd[_0xf23c('0xf')][_0xf23c('0x11')]);return _0x3a6b25(_0x13cedd[_0xf23c('0xf')][_0xf23c('0x11')]);}logger[_0xf23c('0xf')](_0xf23c('0xb'),_0x4485a3,_0x13cedd[_0xf23c('0xf')][_0xf23c('0x11')]);return _0x587fd2(_0x13cedd[_0xf23c('0xf')]['message']);}else{logger[_0xf23c('0x12')](_0xf23c('0xb'),_0x4485a3,_0xf23c('0xd'));_0x587fd2(_0x13cedd[_0xf23c('0x13')][_0xf23c('0x11')]);}})[_0xf23c('0x14')](function(_0x9460a){logger[_0xf23c('0xf')](_0xf23c('0xb'),_0x4485a3,_0x9460a);_0x3a6b25(_0x9460a);});});} \ No newline at end of file +var _0x6a3e=['stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s'];(function(_0x38b744,_0x218c46){var _0x3028d4=function(_0x51a542){while(--_0x51a542){_0x38b744['push'](_0x38b744['shift']());}};_0x3028d4(++_0x218c46);}(_0x6a3e,0x1ea));var _0xe6a3=function(_0xf707cd,_0x5e822b){_0xf707cd=_0xf707cd-0x0;var _0x2fa1a7=_0x6a3e[_0xf707cd];return _0x2fa1a7;};'use strict';var _=require('lodash');var util=require(_0xe6a3('0x0'));var moment=require(_0xe6a3('0x1'));var BPromise=require(_0xe6a3('0x2'));var rs=require(_0xe6a3('0x3'));var fs=require('fs');var Redis=require(_0xe6a3('0x4'));var db=require(_0xe6a3('0x5'))['db'];var utils=require(_0xe6a3('0x6'));var logger=require(_0xe6a3('0x7'))(_0xe6a3('0x8'));var config=require('../../config/environment');var jayson=require(_0xe6a3('0x9'));var client=jayson[_0xe6a3('0xa')][_0xe6a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd57d85,_0x2e2c14,_0x5da762){return new BPromise(function(_0x36c380,_0x3eee72){return client['request'](_0xd57d85,_0x5da762)[_0xe6a3('0xc')](function(_0x532d84){logger['info'](_0xe6a3('0xd'),_0x2e2c14,_0xe6a3('0xe'));logger['debug'](_0xe6a3('0xf'),_0x2e2c14,_0xe6a3('0xe'),JSON[_0xe6a3('0x10')](_0x532d84));if(_0x532d84[_0xe6a3('0x11')]){if(_0x532d84['error']['code']===0x1f4){logger['error'](_0xe6a3('0xd'),_0x2e2c14,_0x532d84[_0xe6a3('0x11')][_0xe6a3('0x12')]);return _0x3eee72(_0x532d84['error']['message']);}logger[_0xe6a3('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2e2c14,_0x532d84['error'][_0xe6a3('0x12')]);return _0x36c380(_0x532d84[_0xe6a3('0x11')][_0xe6a3('0x12')]);}else{logger[_0xe6a3('0x13')](_0xe6a3('0xd'),_0x2e2c14,_0xe6a3('0xe'));_0x36c380(_0x532d84[_0xe6a3('0x14')]['message']);}})[_0xe6a3('0x15')](function(_0x41f5f7){logger['error'](_0xe6a3('0xd'),_0x2e2c14,_0x41f5f7);_0x3eee72(_0x41f5f7);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 1efc2c9..8704f2b 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 _0xf740=['destroy','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','/:id/download','download','post','create','put','delete'];(function(_0x13cff5,_0x462dab){var _0x4b8758=function(_0x2d172e){while(--_0x2d172e){_0x13cff5['push'](_0x13cff5['shift']());}};_0x4b8758(++_0x462dab);}(_0xf740,0x17b));var _0x0f74=function(_0x415603,_0x21320c){_0x415603=_0x415603-0x0;var _0x131e72=_0xf740[_0x415603];return _0x131e72;};'use strict';var multer=require('multer');var util=require(_0x0f74('0x0'));var path=require(_0x0f74('0x1'));var timeout=require(_0x0f74('0x2'));var express=require('express');var router=express[_0x0f74('0x3')]();var fs_extra=require(_0x0f74('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0f74('0x5'));var config=require(_0x0f74('0x6'));var controller=require(_0x0f74('0x7'));router[_0x0f74('0x8')]('/',auth[_0x0f74('0x9')](),controller['index']);router['get'](_0x0f74('0xa'),auth[_0x0f74('0x9')](),controller['show']);router[_0x0f74('0x8')](_0x0f74('0xb'),auth[_0x0f74('0x9')](),controller[_0x0f74('0xc')]);router[_0x0f74('0xd')]('/',auth['isAuthenticated'](),controller[_0x0f74('0xe')]);router[_0x0f74('0xf')]('/:id',auth[_0x0f74('0x9')](),controller['update']);router[_0x0f74('0x10')](_0x0f74('0xa'),auth['isAuthenticated'](),controller[_0x0f74('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2d71=['post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/:id','show','download'];(function(_0x130a46,_0xd96560){var _0xd19e73=function(_0x4f5330){while(--_0x4f5330){_0x130a46['push'](_0x130a46['shift']());}};_0xd19e73(++_0xd96560);}(_0x2d71,0x122));var _0x12d7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2d71[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x12d7('0x0'));var util=require(_0x12d7('0x1'));var path=require(_0x12d7('0x2'));var timeout=require(_0x12d7('0x3'));var express=require(_0x12d7('0x4'));var router=express[_0x12d7('0x5')]();var fs_extra=require(_0x12d7('0x6'));var auth=require(_0x12d7('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0x12d7('0x8')](),controller[_0x12d7('0x9')]);router[_0x12d7('0xa')](_0x12d7('0xb'),auth[_0x12d7('0x8')](),controller[_0x12d7('0xc')]);router[_0x12d7('0xa')]('/:id/download',auth[_0x12d7('0x8')](),controller[_0x12d7('0xd')]);router[_0x12d7('0xe')]('/',auth[_0x12d7('0x8')](),controller['create']);router[_0x12d7('0xf')]('/:id',auth[_0x12d7('0x8')](),controller['update']);router[_0x12d7('0x10')](_0x12d7('0xb'),auth[_0x12d7('0x8')](),controller[_0x12d7('0x11')]);module[_0x12d7('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index cf2547c..96bbddc 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 _0x027d=['exports','STRING','BOOLEAN','sequelize'];(function(_0x50e410,_0x36bb68){var _0x3eb22c=function(_0x3f5a8c){while(--_0x3f5a8c){_0x50e410['push'](_0x50e410['shift']());}};_0x3eb22c(++_0x36bb68);}(_0x027d,0x18f));var _0xd027=function(_0x4f252c,_0x1fde40){_0x4f252c=_0x4f252c-0x0;var _0x26e153=_0x027d[_0x4f252c];return _0x26e153;};'use strict';var Sequelize=require(_0xd027('0x0'));module[_0xd027('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xd027('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xd027('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xd027('0x2')]},'custom':{'type':Sequelize[_0xd027('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe013=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x364827,_0x47799a){var _0x56c17b=function(_0x4e6020){while(--_0x4e6020){_0x364827['push'](_0x364827['shift']());}};_0x56c17b(++_0x47799a);}(_0xe013,0x103));var _0x3e01=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xe013[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x3e01('0x0'));module[_0x3e01('0x1')]={'field':{'type':Sequelize[_0x3e01('0x2')]},'alias':{'type':Sequelize[_0x3e01('0x3')]},'function':{'type':Sequelize[_0x3e01('0x3')]},'format':{'type':Sequelize[_0x3e01('0x3')]},'groupBy':{'type':Sequelize[_0x3e01('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x3e01('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index d4660c0..f0e4f71 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 _0xbd28=['lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','update','destroy','then','stack','send','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','name','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','show','params','includeAll','include','find','body','catch','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','findAll','eml-format','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xbd28,0xe0));var _0x8bd2=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0xbd28[_0x35f7f5];return _0x5567a4;};'use strict';var emlformat=require(_0x8bd2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8bd2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8bd2('0x2'));var BPromise=require(_0x8bd2('0x3'));var Mustache=require(_0x8bd2('0x4'));var util=require('util');var path=require(_0x8bd2('0x5'));var sox=require(_0x8bd2('0x6'));var csv=require(_0x8bd2('0x7'));var ejs=require(_0x8bd2('0x8'));var fs=require('fs');var fs_extra=require(_0x8bd2('0x9'));var _=require(_0x8bd2('0xa'));var squel=require('squel');var crypto=require(_0x8bd2('0xb'));var jsforce=require(_0x8bd2('0xc'));var deskjs=require(_0x8bd2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8bd2('0xe'));var Redis=require(_0x8bd2('0xf'));var authService=require(_0x8bd2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8bd2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8bd2('0x12'));var utils=require(_0x8bd2('0x13'));var config=require(_0x8bd2('0x14'));var licenseUtil=require(_0x8bd2('0x15'));var db=require(_0x8bd2('0x16'))['db'];function respondWithStatusCode(_0x4812e6,_0x30d3d4){_0x30d3d4=_0x30d3d4||0xcc;return function(_0x4ba74e){if(_0x4ba74e){return _0x4812e6[_0x8bd2('0x17')](_0x30d3d4);}return _0x4812e6[_0x8bd2('0x18')](_0x30d3d4)[_0x8bd2('0x19')]();};}function respondWithResult(_0x461983,_0x413bfa){_0x413bfa=_0x413bfa||0xc8;return function(_0x139acb){if(_0x139acb){return _0x461983[_0x8bd2('0x18')](_0x413bfa)['json'](_0x139acb);}};}function respondWithFilteredResult(_0x5f11f2,_0x760c90){return function(_0x2eb196){if(_0x2eb196){var _0x202889=typeof _0x760c90[_0x8bd2('0x1a')]===_0x8bd2('0x1b')&&typeof _0x760c90[_0x8bd2('0x1c')]===_0x8bd2('0x1b');var _0x1ca2ed=_0x2eb196['count'];var _0x4fc85e=_0x202889?0x0:_0x760c90[_0x8bd2('0x1a')];var _0x2a17e6=_0x202889?_0x2eb196[_0x8bd2('0x1d')]:_0x760c90['offset']+_0x760c90[_0x8bd2('0x1c')];var _0x19d48d;if(_0x2a17e6>=_0x1ca2ed){_0x2a17e6=_0x1ca2ed;_0x19d48d=0xc8;}else{_0x19d48d=0xce;}_0x5f11f2['status'](_0x19d48d);return _0x5f11f2[_0x8bd2('0x1e')]('Content-Range',_0x4fc85e+'-'+_0x2a17e6+'/'+_0x1ca2ed)[_0x8bd2('0x1f')](_0x2eb196);}return null;};}function patchUpdates(_0x4c5027){return function(_0x54ee74){try{jsonpatch['apply'](_0x54ee74,_0x4c5027,!![]);}catch(_0x4a9486){return BPromise[_0x8bd2('0x20')](_0x4a9486);}return _0x54ee74['save']();};}function saveUpdates(_0x31796d,_0x2ec4d6){return function(_0x4bc79d){if(_0x4bc79d){return _0x4bc79d[_0x8bd2('0x21')](_0x31796d)['then'](function(_0x53f583){return _0x53f583;});}return null;};}function removeEntity(_0x423757,_0x399095){return function(_0x344b64){if(_0x344b64){return _0x344b64[_0x8bd2('0x22')]()[_0x8bd2('0x23')](function(){_0x423757['status'](0xcc)[_0x8bd2('0x19')]();});}};}function handleEntityNotFound(_0x1c0ede,_0x3643c7){return function(_0x2ebc48){if(!_0x2ebc48){_0x1c0ede['sendStatus'](0x194);}return _0x2ebc48;};}function handleError(_0x1f9080,_0x44f58c){_0x44f58c=_0x44f58c||0x1f4;return function(_0x1ff605){logger['error'](_0x1ff605[_0x8bd2('0x24')]);if(_0x1ff605['name']){delete _0x1ff605['name'];}_0x1f9080[_0x8bd2('0x18')](_0x44f58c)[_0x8bd2('0x25')](_0x1ff605);};}exports['index']=function(_0x3e04a1,_0xf00b23){var _0x1ab8d7={},_0x193041={},_0x1275f4={'count':0x0,'rows':[]};var _0x17a73f=_[_0x8bd2('0x26')](db[_0x8bd2('0x27')][_0x8bd2('0x28')],function(_0x5175a9){return{'name':_0x5175a9[_0x8bd2('0x29')],'type':_0x5175a9[_0x8bd2('0x2a')][_0x8bd2('0x2b')]};});_0x193041['model']=_[_0x8bd2('0x26')](_0x17a73f,_0x8bd2('0x2c'));_0x193041[_0x8bd2('0x2d')]=_[_0x8bd2('0x2e')](_0x3e04a1['query']);_0x193041[_0x8bd2('0x2f')]=_['intersection'](_0x193041[_0x8bd2('0x30')],_0x193041[_0x8bd2('0x2d')]);_0x1ab8d7[_0x8bd2('0x31')]=_[_0x8bd2('0x32')](_0x193041[_0x8bd2('0x30')],qs[_0x8bd2('0x33')](_0x3e04a1[_0x8bd2('0x2d')][_0x8bd2('0x33')]));_0x1ab8d7[_0x8bd2('0x31')]=_0x1ab8d7[_0x8bd2('0x31')][_0x8bd2('0x34')]?_0x1ab8d7[_0x8bd2('0x31')]:_0x193041[_0x8bd2('0x30')];if(!_0x3e04a1[_0x8bd2('0x2d')]['hasOwnProperty'](_0x8bd2('0x35'))){_0x1ab8d7['limit']=qs['limit'](_0x3e04a1[_0x8bd2('0x2d')]['limit']);_0x1ab8d7['offset']=qs[_0x8bd2('0x1a')](_0x3e04a1[_0x8bd2('0x2d')][_0x8bd2('0x1a')]);}_0x1ab8d7[_0x8bd2('0x36')]=qs[_0x8bd2('0x37')](_0x3e04a1[_0x8bd2('0x2d')][_0x8bd2('0x37')]);_0x1ab8d7[_0x8bd2('0x38')]=qs[_0x8bd2('0x2f')](_[_0x8bd2('0x39')](_0x3e04a1[_0x8bd2('0x2d')],_0x193041['filters']),_0x17a73f);if(_0x3e04a1[_0x8bd2('0x2d')][_0x8bd2('0x3a')]){_0x1ab8d7['where']=_[_0x8bd2('0x3b')](_0x1ab8d7[_0x8bd2('0x38')],{'$or':_['map'](_0x17a73f,function(_0x2d6c9f){if(_0x2d6c9f[_0x8bd2('0x2a')]!==_0x8bd2('0x3c')){var _0x1ee82f={};_0x1ee82f[_0x2d6c9f[_0x8bd2('0x2c')]]={'$like':'%'+_0x3e04a1[_0x8bd2('0x2d')][_0x8bd2('0x3a')]+'%'};return _0x1ee82f;}})});}_0x1ab8d7=_[_0x8bd2('0x3b')]({},_0x1ab8d7,_0x3e04a1[_0x8bd2('0x3d')]);var _0x53d714={'where':_0x1ab8d7[_0x8bd2('0x38')]};return db['AnalyticFieldReport'][_0x8bd2('0x1d')](_0x53d714)[_0x8bd2('0x23')](function(_0x45e3ac){_0x1275f4[_0x8bd2('0x1d')]=_0x45e3ac;if(_0x3e04a1[_0x8bd2('0x2d')]['includeAll']){_0x1ab8d7['include']=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x1ab8d7);})['then'](function(_0x118591){_0x1275f4[_0x8bd2('0x3e')]=_0x118591;return _0x1275f4;})[_0x8bd2('0x23')](respondWithFilteredResult(_0xf00b23,_0x1ab8d7))['catch'](handleError(_0xf00b23,null));};exports[_0x8bd2('0x3f')]=function(_0x38207e,_0x1927a7){var _0x47b6d8={'raw':![],'where':{'id':_0x38207e[_0x8bd2('0x40')]['id']}},_0x340f1f={};_0x340f1f[_0x8bd2('0x30')]=_[_0x8bd2('0x2e')](db[_0x8bd2('0x27')]['rawAttributes']);_0x340f1f[_0x8bd2('0x2d')]=_[_0x8bd2('0x2e')](_0x38207e[_0x8bd2('0x2d')]);_0x340f1f[_0x8bd2('0x2f')]=_[_0x8bd2('0x32')](_0x340f1f[_0x8bd2('0x30')],_0x340f1f[_0x8bd2('0x2d')]);_0x47b6d8[_0x8bd2('0x31')]=_['intersection'](_0x340f1f[_0x8bd2('0x30')],qs[_0x8bd2('0x33')](_0x38207e['query'][_0x8bd2('0x33')]));_0x47b6d8[_0x8bd2('0x31')]=_0x47b6d8[_0x8bd2('0x31')]['length']?_0x47b6d8['attributes']:_0x340f1f['model'];if(_0x38207e[_0x8bd2('0x2d')][_0x8bd2('0x41')]){_0x47b6d8[_0x8bd2('0x42')]=[{'all':!![]}];}_0x47b6d8=_[_0x8bd2('0x3b')]({},_0x47b6d8,_0x38207e['options']);return db['AnalyticFieldReport'][_0x8bd2('0x43')](_0x47b6d8)['then'](handleEntityNotFound(_0x1927a7,null))['then'](respondWithResult(_0x1927a7,null))['catch'](handleError(_0x1927a7,null));};exports['create']=function(_0x3bd6c9,_0x3f747f){return db[_0x8bd2('0x27')]['create'](_0x3bd6c9[_0x8bd2('0x44')],{})[_0x8bd2('0x23')](respondWithResult(_0x3f747f,0xc9))[_0x8bd2('0x45')](handleError(_0x3f747f,null));};exports[_0x8bd2('0x46')]=function(_0x27e6bc,_0x263131){return db[_0x8bd2('0x27')][_0x8bd2('0x46')](_0x27e6bc[_0x8bd2('0x44')],{'raw':![],'individualHooks':!![]})[_0x8bd2('0x23')](respondWithResult(_0x263131,0xc9))[_0x8bd2('0x45')](handleError(_0x263131,null));};exports[_0x8bd2('0x21')]=function(_0x2bf41c,_0x3672af){if(_0x2bf41c[_0x8bd2('0x44')]['id']){delete _0x2bf41c[_0x8bd2('0x44')]['id'];}return db[_0x8bd2('0x27')][_0x8bd2('0x43')]({'where':{'id':_0x2bf41c[_0x8bd2('0x40')]['id']}})[_0x8bd2('0x23')](handleEntityNotFound(_0x3672af,null))[_0x8bd2('0x23')](saveUpdates(_0x2bf41c['body'],null))[_0x8bd2('0x23')](respondWithResult(_0x3672af,null))[_0x8bd2('0x45')](handleError(_0x3672af,null));};exports[_0x8bd2('0x22')]=function(_0x5d1ea2,_0x24a6c9){return db[_0x8bd2('0x27')]['find']({'where':{'id':_0x5d1ea2[_0x8bd2('0x40')]['id']}})['then'](handleEntityNotFound(_0x24a6c9,null))[_0x8bd2('0x23')](removeEntity(_0x24a6c9,null))[_0x8bd2('0x45')](handleError(_0x24a6c9,null));};exports['bulkDestroy']=function(_0x56a016,_0x431ae4){return db[_0x8bd2('0x27')][_0x8bd2('0x22')]({'where':{'id':_0x56a016[_0x8bd2('0x2d')][_0x8bd2('0x47')]||[]},'raw':![],'individualHooks':!![]})[_0x8bd2('0x23')](respondWithResult(_0x431ae4,0xcc))['catch'](handleError(_0x431ae4,null));};exports[_0x8bd2('0x48')]=function(_0x806048,_0xe83583,_0x5cc7c3){return db[_0x8bd2('0x49')][_0x8bd2('0x4a')]({'where':{'id':_0x806048['params']['id']}})[_0x8bd2('0x23')](handleEntityNotFound(_0xe83583,null))['then'](function(_0x132ccf){if(_0x132ccf){return db['sequelize'][_0x8bd2('0x4b')](function(_0x2a1a54){return db['AnalyticFieldReport'][_0x8bd2('0x22')]({'where':{'CustomReportId':_0x806048[_0x8bd2('0x40')]['id']},'transaction':_0x2a1a54})[_0x8bd2('0x23')](function(_0x41b246){var _0x3c583e=_[_0x8bd2('0x26')](_0x806048[_0x8bd2('0x44')],function(_0x1807e2){delete _0x1807e2['id'];_0x1807e2[_0x8bd2('0x4c')]=_0x806048[_0x8bd2('0x40')]['id'];return _0x1807e2;});return db[_0x8bd2('0x27')][_0x8bd2('0x46')](_0x3c583e,{'transaction':_0x2a1a54});});})[_0x8bd2('0x23')](function(){return db['AnalyticFieldReport'][_0x8bd2('0x4d')]({'where':{'CustomReportId':_0x806048['params']['id']}});});}})[_0x8bd2('0x23')](respondWithResult(_0xe83583,null))[_0x8bd2('0x45')](handleError(_0xe83583,null));}; \ No newline at end of file +var _0xe260=['order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','bulkCreate','rimraf','zip-dir','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','limit','count','set','json','reject','save','update','then','destroy','sendStatus','error','stack','name','map','AnalyticFieldReport','rawAttributes','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x2110f5,_0x28fb16){var _0x44d51e=function(_0x401d00){while(--_0x401d00){_0x2110f5['push'](_0x2110f5['shift']());}};_0x44d51e(++_0x28fb16);}(_0xe260,0x19a));var _0x0e26=function(_0x597519,_0x572f35){_0x597519=_0x597519-0x0;var _0x5cf730=_0xe260[_0x597519];return _0x5cf730;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e26('0x0'));var zipdir=require(_0x0e26('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0e26('0x2'));var Mustache=require(_0x0e26('0x3'));var util=require(_0x0e26('0x4'));var path=require(_0x0e26('0x5'));var sox=require(_0x0e26('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e26('0x7'));var squel=require('squel');var crypto=require(_0x0e26('0x8'));var jsforce=require(_0x0e26('0x9'));var deskjs=require(_0x0e26('0xa'));var toCsv=require('to-csv');var querystring=require(_0x0e26('0xb'));var Papa=require(_0x0e26('0xc'));var Redis=require(_0x0e26('0xd'));var authService=require(_0x0e26('0xe'));var qs=require(_0x0e26('0xf'));var as=require(_0x0e26('0x10'));var hardwareService=require(_0x0e26('0x11'));var logger=require(_0x0e26('0x12'))('api');var utils=require(_0x0e26('0x13'));var config=require(_0x0e26('0x14'));var licenseUtil=require(_0x0e26('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x375092,_0x35a73e){_0x35a73e=_0x35a73e||0xcc;return function(_0x105e7f){if(_0x105e7f){return _0x375092['sendStatus'](_0x35a73e);}return _0x375092[_0x0e26('0x16')](_0x35a73e)[_0x0e26('0x17')]();};}function respondWithResult(_0x80384a,_0x2eb1a9){_0x2eb1a9=_0x2eb1a9||0xc8;return function(_0x4d94da){if(_0x4d94da){return _0x80384a[_0x0e26('0x16')](_0x2eb1a9)['json'](_0x4d94da);}};}function respondWithFilteredResult(_0x5719d4,_0x489df8){return function(_0x3bc255){if(_0x3bc255){var _0x3f08e9=typeof _0x489df8[_0x0e26('0x18')]==='undefined'&&typeof _0x489df8[_0x0e26('0x19')]==='undefined';var _0x44e46d=_0x3bc255['count'];var _0x23be23=_0x3f08e9?0x0:_0x489df8[_0x0e26('0x18')];var _0x213565=_0x3f08e9?_0x3bc255[_0x0e26('0x1a')]:_0x489df8[_0x0e26('0x18')]+_0x489df8[_0x0e26('0x19')];var _0x3783b0;if(_0x213565>=_0x44e46d){_0x213565=_0x44e46d;_0x3783b0=0xc8;}else{_0x3783b0=0xce;}_0x5719d4[_0x0e26('0x16')](_0x3783b0);return _0x5719d4[_0x0e26('0x1b')]('Content-Range',_0x23be23+'-'+_0x213565+'/'+_0x44e46d)[_0x0e26('0x1c')](_0x3bc255);}return null;};}function patchUpdates(_0x217c62){return function(_0x5b6afb){try{jsonpatch['apply'](_0x5b6afb,_0x217c62,!![]);}catch(_0x4aca0a){return BPromise[_0x0e26('0x1d')](_0x4aca0a);}return _0x5b6afb[_0x0e26('0x1e')]();};}function saveUpdates(_0x3930bd,_0x13d52d){return function(_0x468a65){if(_0x468a65){return _0x468a65[_0x0e26('0x1f')](_0x3930bd)[_0x0e26('0x20')](function(_0x1ac7d3){return _0x1ac7d3;});}return null;};}function removeEntity(_0x229db9,_0x342c88){return function(_0x475ead){if(_0x475ead){return _0x475ead[_0x0e26('0x21')]()[_0x0e26('0x20')](function(){_0x229db9[_0x0e26('0x16')](0xcc)[_0x0e26('0x17')]();});}};}function handleEntityNotFound(_0x6c887b,_0x4d8d06){return function(_0x41340a){if(!_0x41340a){_0x6c887b[_0x0e26('0x22')](0x194);}return _0x41340a;};}function handleError(_0x123019,_0x4ba883){_0x4ba883=_0x4ba883||0x1f4;return function(_0x57ce78){logger[_0x0e26('0x23')](_0x57ce78[_0x0e26('0x24')]);if(_0x57ce78['name']){delete _0x57ce78[_0x0e26('0x25')];}_0x123019[_0x0e26('0x16')](_0x4ba883)['send'](_0x57ce78);};}exports['index']=function(_0x44796c,_0x33ecd0){var _0x11b22d={},_0x9425ee={},_0x2a3da7={'count':0x0,'rows':[]};var _0x23f507=_[_0x0e26('0x26')](db[_0x0e26('0x27')][_0x0e26('0x28')],function(_0x54b735){return{'name':_0x54b735['fieldName'],'type':_0x54b735['type'][_0x0e26('0x29')]};});_0x9425ee['model']=_[_0x0e26('0x26')](_0x23f507,_0x0e26('0x25'));_0x9425ee[_0x0e26('0x2a')]=_[_0x0e26('0x2b')](_0x44796c[_0x0e26('0x2a')]);_0x9425ee[_0x0e26('0x2c')]=_[_0x0e26('0x2d')](_0x9425ee[_0x0e26('0x2e')],_0x9425ee[_0x0e26('0x2a')]);_0x11b22d['attributes']=_[_0x0e26('0x2d')](_0x9425ee['model'],qs[_0x0e26('0x2f')](_0x44796c[_0x0e26('0x2a')][_0x0e26('0x2f')]));_0x11b22d[_0x0e26('0x30')]=_0x11b22d['attributes'][_0x0e26('0x31')]?_0x11b22d['attributes']:_0x9425ee[_0x0e26('0x2e')];if(!_0x44796c[_0x0e26('0x2a')][_0x0e26('0x32')](_0x0e26('0x33'))){_0x11b22d[_0x0e26('0x19')]=qs[_0x0e26('0x19')](_0x44796c['query'][_0x0e26('0x19')]);_0x11b22d[_0x0e26('0x18')]=qs['offset'](_0x44796c[_0x0e26('0x2a')][_0x0e26('0x18')]);}_0x11b22d[_0x0e26('0x34')]=qs[_0x0e26('0x35')](_0x44796c[_0x0e26('0x2a')][_0x0e26('0x35')]);_0x11b22d[_0x0e26('0x36')]=qs[_0x0e26('0x2c')](_[_0x0e26('0x37')](_0x44796c['query'],_0x9425ee[_0x0e26('0x2c')]),_0x23f507);if(_0x44796c[_0x0e26('0x2a')][_0x0e26('0x38')]){_0x11b22d[_0x0e26('0x36')]=_[_0x0e26('0x39')](_0x11b22d[_0x0e26('0x36')],{'$or':_['map'](_0x23f507,function(_0x16092d){if(_0x16092d[_0x0e26('0x3a')]!==_0x0e26('0x3b')){var _0xaf243e={};_0xaf243e[_0x16092d['name']]={'$like':'%'+_0x44796c[_0x0e26('0x2a')][_0x0e26('0x38')]+'%'};return _0xaf243e;}})});}_0x11b22d=_['merge']({},_0x11b22d,_0x44796c[_0x0e26('0x3c')]);var _0x510d14={'where':_0x11b22d[_0x0e26('0x36')]};return db['AnalyticFieldReport'][_0x0e26('0x1a')](_0x510d14)[_0x0e26('0x20')](function(_0x2091aa){_0x2a3da7['count']=_0x2091aa;if(_0x44796c['query'][_0x0e26('0x3d')]){_0x11b22d[_0x0e26('0x3e')]=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x0e26('0x3f')](_0x11b22d);})['then'](function(_0x158bde){_0x2a3da7[_0x0e26('0x40')]=_0x158bde;return _0x2a3da7;})[_0x0e26('0x20')](respondWithFilteredResult(_0x33ecd0,_0x11b22d))[_0x0e26('0x41')](handleError(_0x33ecd0,null));};exports[_0x0e26('0x42')]=function(_0x587336,_0x12b506){var _0x28f569={'raw':![],'where':{'id':_0x587336['params']['id']}},_0x13a83e={};_0x13a83e[_0x0e26('0x2e')]=_[_0x0e26('0x2b')](db[_0x0e26('0x27')][_0x0e26('0x28')]);_0x13a83e[_0x0e26('0x2a')]=_[_0x0e26('0x2b')](_0x587336[_0x0e26('0x2a')]);_0x13a83e['filters']=_['intersection'](_0x13a83e['model'],_0x13a83e[_0x0e26('0x2a')]);_0x28f569[_0x0e26('0x30')]=_[_0x0e26('0x2d')](_0x13a83e[_0x0e26('0x2e')],qs[_0x0e26('0x2f')](_0x587336[_0x0e26('0x2a')][_0x0e26('0x2f')]));_0x28f569['attributes']=_0x28f569['attributes']['length']?_0x28f569[_0x0e26('0x30')]:_0x13a83e['model'];if(_0x587336[_0x0e26('0x2a')][_0x0e26('0x3d')]){_0x28f569[_0x0e26('0x3e')]=[{'all':!![]}];}_0x28f569=_[_0x0e26('0x39')]({},_0x28f569,_0x587336[_0x0e26('0x3c')]);return db[_0x0e26('0x27')][_0x0e26('0x43')](_0x28f569)[_0x0e26('0x20')](handleEntityNotFound(_0x12b506,null))['then'](respondWithResult(_0x12b506,null))[_0x0e26('0x41')](handleError(_0x12b506,null));};exports[_0x0e26('0x44')]=function(_0xbcd4e,_0x2495f9){return db[_0x0e26('0x27')][_0x0e26('0x44')](_0xbcd4e[_0x0e26('0x45')],{})['then'](respondWithResult(_0x2495f9,0xc9))[_0x0e26('0x41')](handleError(_0x2495f9,null));};exports['bulkCreate']=function(_0x3906d1,_0xde227e){return db[_0x0e26('0x27')]['bulkCreate'](_0x3906d1[_0x0e26('0x45')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xde227e,0xc9))['catch'](handleError(_0xde227e,null));};exports['update']=function(_0x1be5e0,_0x5103aa){if(_0x1be5e0[_0x0e26('0x45')]['id']){delete _0x1be5e0['body']['id'];}return db['AnalyticFieldReport'][_0x0e26('0x43')]({'where':{'id':_0x1be5e0[_0x0e26('0x46')]['id']}})[_0x0e26('0x20')](handleEntityNotFound(_0x5103aa,null))[_0x0e26('0x20')](saveUpdates(_0x1be5e0[_0x0e26('0x45')],null))[_0x0e26('0x20')](respondWithResult(_0x5103aa,null))['catch'](handleError(_0x5103aa,null));};exports[_0x0e26('0x21')]=function(_0x30f1ea,_0x122c21){return db[_0x0e26('0x27')][_0x0e26('0x43')]({'where':{'id':_0x30f1ea[_0x0e26('0x46')]['id']}})[_0x0e26('0x20')](handleEntityNotFound(_0x122c21,null))['then'](removeEntity(_0x122c21,null))['catch'](handleError(_0x122c21,null));};exports[_0x0e26('0x47')]=function(_0x2f02cd,_0x3409a6){return db[_0x0e26('0x27')][_0x0e26('0x21')]({'where':{'id':_0x2f02cd[_0x0e26('0x2a')][_0x0e26('0x48')]||[]},'raw':![],'individualHooks':!![]})[_0x0e26('0x20')](respondWithResult(_0x3409a6,0xcc))[_0x0e26('0x41')](handleError(_0x3409a6,null));};exports['addFields']=function(_0x56977f,_0x3bea57,_0x4dfdbe){return db[_0x0e26('0x49')][_0x0e26('0x4a')]({'where':{'id':_0x56977f[_0x0e26('0x46')]['id']}})[_0x0e26('0x20')](handleEntityNotFound(_0x3bea57,null))['then'](function(_0x38d3b5){if(_0x38d3b5){return db[_0x0e26('0x4b')]['transaction'](function(_0x42c1fd){return db[_0x0e26('0x27')][_0x0e26('0x21')]({'where':{'CustomReportId':_0x56977f[_0x0e26('0x46')]['id']},'transaction':_0x42c1fd})['then'](function(_0x2d9381){var _0x59b4b8=_[_0x0e26('0x26')](_0x56977f[_0x0e26('0x45')],function(_0x263fb0){delete _0x263fb0['id'];_0x263fb0['CustomReportId']=_0x56977f['params']['id'];return _0x263fb0;});return db[_0x0e26('0x27')][_0x0e26('0x4c')](_0x59b4b8,{'transaction':_0x42c1fd});});})[_0x0e26('0x20')](function(){return db[_0x0e26('0x27')][_0x0e26('0x3f')]({'where':{'CustomReportId':_0x56977f[_0x0e26('0x46')]['id']}});});}})['then'](respondWithResult(_0x3bea57,null))[_0x0e26('0x41')](handleError(_0x3bea57,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 937e32a..f3045a6 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 _0xdeaa=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','moment','bluebird','request-promise'];(function(_0x58978c,_0x38e906){var _0x4083c=function(_0x31c850){while(--_0x31c850){_0x58978c['push'](_0x58978c['shift']());}};_0x4083c(++_0x38e906);}(_0xdeaa,0x1f3));var _0xadea=function(_0x4f5f8d,_0x48fff0){_0x4f5f8d=_0x4f5f8d-0x0;var _0x5177fd=_0xdeaa[_0x4f5f8d];return _0x5177fd;};'use strict';var _=require(_0xadea('0x0'));var util=require(_0xadea('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xadea('0x2'));var BPromise=require(_0xadea('0x3'));var rp=require(_0xadea('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xadea('0x5'));var config=require(_0xadea('0x6'));var attributes=require(_0xadea('0x7'));module[_0xadea('0x8')]=function(_0x8f39cd,_0x5ba1c5){return _0x8f39cd[_0xadea('0x9')](_0xadea('0xa'),attributes,{'tableName':_0xadea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c3b=['../../config/environment','define','AnalyticFieldReport','analytics_report_fields','lodash','util','api','bluebird','path'];(function(_0x1bc510,_0x3819fb){var _0x285dcb=function(_0xab8bf6){while(--_0xab8bf6){_0x1bc510['push'](_0x1bc510['shift']());}};_0x285dcb(++_0x3819fb);}(_0x5c3b,0x67));var _0xb5c3=function(_0x19745e,_0x3d468d){_0x19745e=_0x19745e-0x0;var _0x28e2c2=_0x5c3b[_0x19745e];return _0x28e2c2;};'use strict';var _=require(_0xb5c3('0x0'));var util=require(_0xb5c3('0x1'));var logger=require('../../config/logger')(_0xb5c3('0x2'));var moment=require('moment');var BPromise=require(_0xb5c3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb5c3('0x4'));var rimraf=require('rimraf');var config=require(_0xb5c3('0x5'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x213d33,_0x4ee21b){return _0x213d33[_0xb5c3('0x6')](_0xb5c3('0x7'),attributes,{'tableName':_0xb5c3('0x8'),'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 f58215a..eb3fadc 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 _0x7b2f=['client','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x19a206,_0x1d7556){var _0x7514ac=function(_0xaddeaa){while(--_0xaddeaa){_0x19a206['push'](_0x19a206['shift']());}};_0x7514ac(++_0x1d7556);}(_0x7b2f,0x19b));var _0xf7b2=function(_0x2440fe,_0x281a11){_0x2440fe=_0x2440fe-0x0;var _0x5cf734=_0x7b2f[_0x2440fe];return _0x5cf734;};'use strict';var _=require(_0xf7b2('0x0'));var util=require(_0xf7b2('0x1'));var moment=require('moment');var BPromise=require(_0xf7b2('0x2'));var rs=require(_0xf7b2('0x3'));var fs=require('fs');var Redis=require(_0xf7b2('0x4'));var db=require(_0xf7b2('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf7b2('0x6'));var config=require(_0xf7b2('0x7'));var jayson=require(_0xf7b2('0x8'));var client=jayson[_0xf7b2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x446b82,_0x518408,_0xa7201e){return new BPromise(function(_0x575713,_0x50b436){return client[_0xf7b2('0xa')](_0x446b82,_0xa7201e)[_0xf7b2('0xb')](function(_0x251df3){logger[_0xf7b2('0xc')](_0xf7b2('0xd'),_0x518408,'request\x20sent');logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x518408,'request\x20sent',JSON[_0xf7b2('0xe')](_0x251df3));if(_0x251df3[_0xf7b2('0xf')]){if(_0x251df3[_0xf7b2('0xf')][_0xf7b2('0x10')]===0x1f4){logger[_0xf7b2('0xf')](_0xf7b2('0xd'),_0x518408,_0x251df3[_0xf7b2('0xf')][_0xf7b2('0x11')]);return _0x50b436(_0x251df3['error'][_0xf7b2('0x11')]);}logger[_0xf7b2('0xf')](_0xf7b2('0xd'),_0x518408,_0x251df3[_0xf7b2('0xf')][_0xf7b2('0x11')]);return _0x575713(_0x251df3[_0xf7b2('0xf')][_0xf7b2('0x11')]);}else{logger[_0xf7b2('0xc')](_0xf7b2('0xd'),_0x518408,'request\x20sent');_0x575713(_0x251df3[_0xf7b2('0x12')][_0xf7b2('0x11')]);}})[_0xf7b2('0x13')](function(_0x201e22){logger[_0xf7b2('0xf')](_0xf7b2('0xd'),_0x518408,_0x201e22);_0x50b436(_0x201e22);});});} \ No newline at end of file +var _0x5512=['info','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message'];(function(_0x4e3778,_0x4021bd){var _0x36e57c=function(_0x54639f){while(--_0x54639f){_0x4e3778['push'](_0x4e3778['shift']());}};_0x36e57c(++_0x4021bd);}(_0x5512,0xfe));var _0x2551=function(_0x1b11a2,_0x1c94e9){_0x1b11a2=_0x1b11a2-0x0;var _0xee44e5=_0x5512[_0x1b11a2];return _0xee44e5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2551('0x0'));var BPromise=require(_0x2551('0x1'));var rs=require(_0x2551('0x2'));var fs=require('fs');var Redis=require(_0x2551('0x3'));var db=require(_0x2551('0x4'))['db'];var utils=require(_0x2551('0x5'));var logger=require(_0x2551('0x6'))(_0x2551('0x7'));var config=require('../../config/environment');var jayson=require(_0x2551('0x8'));var client=jayson[_0x2551('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bebeb,_0x69fcc0,_0x3c1cc8){return new BPromise(function(_0x5ad1fd,_0x1f4466){return client['request'](_0x5bebeb,_0x3c1cc8)[_0x2551('0xa')](function(_0x50c0a6){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x69fcc0,_0x2551('0xb'));logger[_0x2551('0xc')](_0x2551('0xd'),_0x69fcc0,_0x2551('0xb'),JSON[_0x2551('0xe')](_0x50c0a6));if(_0x50c0a6['error']){if(_0x50c0a6[_0x2551('0xf')][_0x2551('0x10')]===0x1f4){logger['error'](_0x2551('0x11'),_0x69fcc0,_0x50c0a6[_0x2551('0xf')][_0x2551('0x12')]);return _0x1f4466(_0x50c0a6['error'][_0x2551('0x12')]);}logger[_0x2551('0xf')](_0x2551('0x11'),_0x69fcc0,_0x50c0a6['error'][_0x2551('0x12')]);return _0x5ad1fd(_0x50c0a6[_0x2551('0xf')]['message']);}else{logger[_0x2551('0x13')](_0x2551('0x11'),_0x69fcc0,'request\x20sent');_0x5ad1fd(_0x50c0a6['result']['message']);}})[_0x2551('0x14')](function(_0x33d79b){logger[_0x2551('0xf')](_0x2551('0x11'),_0x69fcc0,_0x33d79b);_0x1f4466(_0x33d79b);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 56296fe..a0206e3 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(_0x44a9b9,_0x4536bc){var _0x159b3a=function(_0x1b8a83){while(--_0x1b8a83){_0x44a9b9['push'](_0x44a9b9['shift']());}};_0x159b3a(++_0x4536bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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(_0x335232,_0x4a3d78){var _0x738ee2=function(_0x2ff477){while(--_0x2ff477){_0x335232['push'](_0x335232['shift']());}};_0x738ee2(++_0x4a3d78);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 2fd1d80..77c55f5 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 _0x6c9c=['name','STRING','TEXT','sequelize','exports'];(function(_0x137542,_0x52d5ef){var _0x38971f=function(_0x41da86){while(--_0x41da86){_0x137542['push'](_0x137542['shift']());}};_0x38971f(++_0x52d5ef);}(_0x6c9c,0x12a));var _0xc6c9=function(_0x5531a1,_0x38b6c6){_0x5531a1=_0x5531a1-0x0;var _0x3a90ad=_0x6c9c[_0x5531a1];return _0x3a90ad;};'use strict';var Sequelize=require(_0xc6c9('0x0'));module[_0xc6c9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc6c9('0x2')},'table':{'type':Sequelize[_0xc6c9('0x3')]},'metric':{'type':Sequelize[_0xc6c9('0x4')]},'description':{'type':Sequelize[_0xc6c9('0x3')]}}; \ No newline at end of file +var _0x6599=['exports','STRING','name','TEXT'];(function(_0x168e6a,_0x2dc65e){var _0x481f3c=function(_0x20aab3){while(--_0x20aab3){_0x168e6a['push'](_0x168e6a['shift']());}};_0x481f3c(++_0x2dc65e);}(_0x6599,0xb0));var _0x9659=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0x6599[_0x545bed];return _0x16c79c;};'use strict';var Sequelize=require('sequelize');module[_0x9659('0x0')]={'name':{'type':Sequelize[_0x9659('0x1')],'allowNull':![],'unique':_0x9659('0x2')},'table':{'type':Sequelize[_0x9659('0x1')]},'metric':{'type':Sequelize[_0x9659('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 5fd20f0..5bc9170 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 _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0x3f90da,_0x48d3df){var _0x163dbc=function(_0x291b50){while(--_0x291b50){_0x3f90da['push'](_0x3f90da['shift']());}};_0x163dbc(++_0x48d3df);}(_0x9a19,0x114));var _0x99a1=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0x9a19[_0x1ab180];return _0xfb2c2d;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file +var _0x9c5a=['update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x49c54c,_0x54a647){var _0x446225=function(_0x462f62){while(--_0x462f62){_0x49c54c['push'](_0x49c54c['shift']());}};_0x446225(++_0x54a647);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x49870e,_0x46aff2){_0x49870e=_0x49870e-0x0;var _0xb11d4b=_0x9c5a[_0x49870e];return _0xb11d4b;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){var _0x424b4c=_0x11d395[_0xa9c5('0x25')]({'plain':!![]});var _0x32fc7d=_0xa9c5('0x26');return db[_0xa9c5('0x27')][_0xa9c5('0x28')]({'where':{'type':_0x32fc7d,'resourceId':_0x424b4c['id']}})['then'](function(){return _0x11d395;});})['then'](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1762ac,_0x830bad){return function(_0x4caefa){if(!_0x4caefa){_0x1762ac[_0xa9c5('0x17')](0x194);}return _0x4caefa;};}function handleError(_0x320dc0,_0x5f468b){_0x5f468b=_0x5f468b||0x1f4;return function(_0x413edf){logger[_0xa9c5('0x29')](_0x413edf[_0xa9c5('0x2a')]);if(_0x413edf[_0xa9c5('0x2b')]){delete _0x413edf[_0xa9c5('0x2b')];}_0x320dc0['status'](_0x5f468b)[_0xa9c5('0x2c')](_0x413edf);};}exports['index']=function(_0x3c3da7,_0x1ef388){var _0x2eeed1={},_0x541475={},_0xc6d0c1={'count':0x0,'rows':[]};var _0xbe29c5=_['map'](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')],function(_0x431e07){return{'name':_0x431e07[_0xa9c5('0x2f')],'type':_0x431e07[_0xa9c5('0x30')][_0xa9c5('0x31')]};});_0x541475[_0xa9c5('0x32')]=_['map'](_0xbe29c5,_0xa9c5('0x2b'));_0x541475[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x3c3da7[_0xa9c5('0x33')]);_0x541475[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0x541475[_0xa9c5('0x32')],_0x541475[_0xa9c5('0x33')]);_0x2eeed1['attributes']=_['intersection'](_0x541475[_0xa9c5('0x32')],qs[_0xa9c5('0x37')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x2eeed1[_0xa9c5('0x38')]=_0x2eeed1[_0xa9c5('0x38')]['length']?_0x2eeed1['attributes']:_0x541475['model'];if(!_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x39')]('nolimit')){_0x2eeed1[_0xa9c5('0x1c')]=qs['limit'](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x1c')]);_0x2eeed1[_0xa9c5('0x1e')]=qs[_0xa9c5('0x1e')](_0x3c3da7['query'][_0xa9c5('0x1e')]);}_0x2eeed1[_0xa9c5('0x3a')]=qs[_0xa9c5('0x3b')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3b')]);_0x2eeed1[_0xa9c5('0x3c')]=qs[_0xa9c5('0x35')](_[_0xa9c5('0x3d')](_0x3c3da7['query'],_0x541475[_0xa9c5('0x35')]),_0xbe29c5);if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]){_0x2eeed1[_0xa9c5('0x3c')]=_[_0xa9c5('0x3f')](_0x2eeed1[_0xa9c5('0x3c')],{'$or':_['map'](_0xbe29c5,function(_0x307736){if(_0x307736['type']!==_0xa9c5('0x40')){var _0x5c89e7={};_0x5c89e7[_0x307736[_0xa9c5('0x2b')]]={'$like':'%'+_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]+'%'};return _0x5c89e7;}})});}_0x2eeed1=_['merge']({},_0x2eeed1,_0x3c3da7[_0xa9c5('0x41')]);var _0x1ddd72={'where':_0x2eeed1[_0xa9c5('0x3c')]};return db[_0xa9c5('0x2d')]['count'](_0x1ddd72)[_0xa9c5('0x24')](function(_0x97803f){_0xc6d0c1[_0xa9c5('0x1d')]=_0x97803f;if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x2eeed1['include']=[{'all':!![]}];}return db[_0xa9c5('0x2d')]['findAll'](_0x2eeed1);})[_0xa9c5('0x24')](function(_0x397614){_0xc6d0c1[_0xa9c5('0x43')]=_0x397614;return _0xc6d0c1;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x1ef388,_0x2eeed1))[_0xa9c5('0x44')](handleError(_0x1ef388,null));};exports[_0xa9c5('0x45')]=function(_0xf35cb3,_0x3e8633){var _0x1f895a={'raw':!![],'where':{'id':_0xf35cb3['params']['id']}},_0xc28b1a={};_0xc28b1a[_0xa9c5('0x32')]=_[_0xa9c5('0x34')](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')]);_0xc28b1a[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0xf35cb3['query']);_0xc28b1a[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0xc28b1a['model'],_0xc28b1a['query']);_0x1f895a['attributes']=_['intersection'](_0xc28b1a['model'],qs[_0xa9c5('0x37')](_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x1f895a[_0xa9c5('0x38')]=_0x1f895a[_0xa9c5('0x38')][_0xa9c5('0x46')]?_0x1f895a[_0xa9c5('0x38')]:_0xc28b1a[_0xa9c5('0x32')];if(_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x1f895a[_0xa9c5('0x47')]=[{'all':!![]}];}_0x1f895a=_[_0xa9c5('0x3f')]({},_0x1f895a,_0xf35cb3[_0xa9c5('0x41')]);return db['AnalyticMetric'][_0xa9c5('0x48')](_0x1f895a)['then'](handleEntityNotFound(_0x3e8633,null))[_0xa9c5('0x24')](respondWithResult(_0x3e8633,null))[_0xa9c5('0x44')](handleError(_0x3e8633,null));};exports['create']=function(_0x5cbd33,_0xf00970){return db[_0xa9c5('0x2d')][_0xa9c5('0x49')](_0x5cbd33['body'],{})['then'](function(_0x2333c4){var _0xd03cec=_0x5cbd33['user'][_0xa9c5('0x25')]({'plain':!![]});if(!_0xd03cec)throw new Error(_0xa9c5('0x4a'));if(_0xd03cec[_0xa9c5('0x4b')]===_0xa9c5('0x4c')){var _0x34020f=_0x2333c4[_0xa9c5('0x25')]({'plain':!![]});var _0x4b6fc9='Metrics';return db['UserProfileSection'][_0xa9c5('0x48')]({'where':{'name':_0x4b6fc9,'userProfileId':_0xd03cec[_0xa9c5('0x4d')]},'raw':!![]})[_0xa9c5('0x24')](function(_0xef4d2){if(_0xef4d2&&_0xef4d2[_0xa9c5('0x4e')]===0x0){return db[_0xa9c5('0x27')]['create']({'name':_0x34020f[_0xa9c5('0x2b')],'resourceId':_0x34020f['id'],'type':_0xef4d2[_0xa9c5('0x2b')],'sectionId':_0xef4d2['id']},{})[_0xa9c5('0x24')](function(){return _0x2333c4;});}else{return _0x2333c4;}})[_0xa9c5('0x44')](function(_0xa0b458){logger[_0xa9c5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa0b458);throw _0xa0b458;});}return _0x2333c4;})['then'](respondWithResult(_0xf00970,0xc9))[_0xa9c5('0x44')](handleError(_0xf00970,null));};exports['update']=function(_0x1b158f,_0x5ea9b0){if(_0x1b158f[_0xa9c5('0x4f')]['id']){delete _0x1b158f[_0xa9c5('0x4f')]['id'];}return db[_0xa9c5('0x2d')]['find']({'where':{'id':_0x1b158f[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x5ea9b0,null))[_0xa9c5('0x24')](saveUpdates(_0x1b158f[_0xa9c5('0x4f')],null))['then'](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x28')]=function(_0x2b66ee,_0x3205f2){return db['AnalyticMetric'][_0xa9c5('0x48')]({'where':{'id':_0x2b66ee[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x3205f2,null))[_0xa9c5('0x24')](removeEntity(_0x3205f2,null))[_0xa9c5('0x44')](handleError(_0x3205f2,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 1cccbac..8037e5a 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 _0x99a0=['analytics_metrics','lodash','util','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','define'];(function(_0x11ba46,_0x1d6752){var _0x1c8c6f=function(_0x4cf96f){while(--_0x4cf96f){_0x11ba46['push'](_0x11ba46['shift']());}};_0x1c8c6f(++_0x1d6752);}(_0x99a0,0x121));var _0x099a=function(_0x31299f,_0x541f47){_0x31299f=_0x31299f-0x0;var _0x3d5474=_0x99a0[_0x31299f];return _0x3d5474;};'use strict';var _=require(_0x099a('0x0'));var util=require(_0x099a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x099a('0x2'));var fs=require('fs');var path=require(_0x099a('0x3'));var rimraf=require('rimraf');var config=require(_0x099a('0x4'));var attributes=require(_0x099a('0x5'));module[_0x099a('0x6')]=function(_0x215a07,_0x2f1aea){return _0x215a07[_0x099a('0x7')]('AnalyticMetric',attributes,{'tableName':_0x099a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefce=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','analytics_metrics','util','moment'];(function(_0x1c846b,_0x1be3e1){var _0x72b234=function(_0x3a4b55){while(--_0x3a4b55){_0x1c846b['push'](_0x1c846b['shift']());}};_0x72b234(++_0x1be3e1);}(_0xefce,0x1e8));var _0xeefc=function(_0x5ca5bc,_0x5b8a9d){_0x5ca5bc=_0x5ca5bc-0x0;var _0x26ca86=_0xefce[_0x5ca5bc];return _0x26ca86;};'use strict';var _=require('lodash');var util=require(_0xeefc('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xeefc('0x1'));var BPromise=require(_0xeefc('0x2'));var rp=require(_0xeefc('0x3'));var fs=require('fs');var path=require(_0xeefc('0x4'));var rimraf=require(_0xeefc('0x5'));var config=require(_0xeefc('0x6'));var attributes=require(_0xeefc('0x7'));module[_0xeefc('0x8')]=function(_0x41ba7c,_0x181dd7){return _0x41ba7c['define']('AnalyticMetric',attributes,{'tableName':_0xeefc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 3f7051d..cf71875 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 _0x3183=['stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x3183,0x1d1));var _0x3318=function(_0x3bef2c,_0x5a86fd){_0x3bef2c=_0x3bef2c-0x0;var _0x331503=_0x3183[_0x3bef2c];return _0x331503;};'use strict';var _=require(_0x3318('0x0'));var util=require(_0x3318('0x1'));var moment=require(_0x3318('0x2'));var BPromise=require(_0x3318('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3318('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3318('0x5'));var config=require(_0x3318('0x6'));var jayson=require(_0x3318('0x7'));var client=jayson[_0x3318('0x8')][_0x3318('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59a48b,_0xdfa691,_0x3b1569){return new BPromise(function(_0x8d8bf0,_0x4ed8c7){return client[_0x3318('0xa')](_0x59a48b,_0x3b1569)['then'](function(_0x4c731e){logger[_0x3318('0xb')](_0x3318('0xc'),_0xdfa691,_0x3318('0xd'));logger[_0x3318('0xe')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0xdfa691,'request\x20sent',JSON[_0x3318('0xf')](_0x4c731e));if(_0x4c731e[_0x3318('0x10')]){if(_0x4c731e[_0x3318('0x10')]['code']===0x1f4){logger['error'](_0x3318('0xc'),_0xdfa691,_0x4c731e[_0x3318('0x10')]['message']);return _0x4ed8c7(_0x4c731e[_0x3318('0x10')][_0x3318('0x11')]);}logger[_0x3318('0x10')](_0x3318('0xc'),_0xdfa691,_0x4c731e[_0x3318('0x10')][_0x3318('0x11')]);return _0x8d8bf0(_0x4c731e[_0x3318('0x10')][_0x3318('0x11')]);}else{logger[_0x3318('0xb')](_0x3318('0xc'),_0xdfa691,_0x3318('0xd'));_0x8d8bf0(_0x4c731e[_0x3318('0x12')][_0x3318('0x11')]);}})[_0x3318('0x13')](function(_0x1929bf){logger[_0x3318('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0xdfa691,_0x1929bf);_0x4ed8c7(_0x1929bf);});});} \ No newline at end of file +var _0x072f=['client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise'];(function(_0xbb3938,_0x487a1e){var _0x222558=function(_0x3f7c8c){while(--_0x3f7c8c){_0xbb3938['push'](_0xbb3938['shift']());}};_0x222558(++_0x487a1e);}(_0x072f,0xa7));var _0xf072=function(_0x302026,_0x5c230a){_0x302026=_0x302026-0x0;var _0x413994=_0x072f[_0x302026];return _0x413994;};'use strict';var _=require(_0xf072('0x0'));var util=require(_0xf072('0x1'));var moment=require(_0xf072('0x2'));var BPromise=require(_0xf072('0x3'));var rs=require(_0xf072('0x4'));var fs=require('fs');var Redis=require(_0xf072('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf072('0x6'))('rpc');var config=require(_0xf072('0x7'));var jayson=require(_0xf072('0x8'));var client=jayson[_0xf072('0x9')][_0xf072('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x376684,_0x2f89bb,_0x1e5eb5){return new BPromise(function(_0x425bdf,_0x2acc53){return client[_0xf072('0xb')](_0x376684,_0x1e5eb5)['then'](function(_0x47f6f6){logger[_0xf072('0xc')](_0xf072('0xd'),_0x2f89bb,_0xf072('0xe'));logger[_0xf072('0xf')](_0xf072('0x10'),_0x2f89bb,_0xf072('0xe'),JSON['stringify'](_0x47f6f6));if(_0x47f6f6[_0xf072('0x11')]){if(_0x47f6f6[_0xf072('0x11')][_0xf072('0x12')]===0x1f4){logger[_0xf072('0x11')](_0xf072('0xd'),_0x2f89bb,_0x47f6f6[_0xf072('0x11')][_0xf072('0x13')]);return _0x2acc53(_0x47f6f6['error'][_0xf072('0x13')]);}logger[_0xf072('0x11')](_0xf072('0xd'),_0x2f89bb,_0x47f6f6[_0xf072('0x11')]['message']);return _0x425bdf(_0x47f6f6[_0xf072('0x11')][_0xf072('0x13')]);}else{logger['info'](_0xf072('0xd'),_0x2f89bb,'request\x20sent');_0x425bdf(_0x47f6f6[_0xf072('0x14')][_0xf072('0x13')]);}})[_0xf072('0x15')](function(_0x37d184){logger['error'](_0xf072('0xd'),_0x2f89bb,_0x37d184);_0x2acc53(_0x37d184);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index d524735..2d62562 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 _0x1696=['get','/:id','show','post','create','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x1696,0x79));var _0x6169=function(_0x93b0c6,_0x305962){_0x93b0c6=_0x93b0c6-0x0;var _0x4036be=_0x1696[_0x93b0c6];return _0x4036be;};'use strict';var multer=require(_0x6169('0x0'));var util=require('util');var path=require(_0x6169('0x1'));var timeout=require(_0x6169('0x2'));var express=require(_0x6169('0x3'));var router=express[_0x6169('0x4')]();var fs_extra=require(_0x6169('0x5'));var auth=require(_0x6169('0x6'));var interaction=require(_0x6169('0x7'));var config=require(_0x6169('0x8'));var controller=require(_0x6169('0x9'));router['get']('/',auth[_0x6169('0xa')](),controller[_0x6169('0xb')]);router[_0x6169('0xc')](_0x6169('0xd'),auth[_0x6169('0xa')](),controller[_0x6169('0xe')]);router[_0x6169('0xf')]('/',auth['isAuthenticated'](),controller[_0x6169('0x10')]);router['put'](_0x6169('0xd'),auth[_0x6169('0xa')](),controller['update']);router[_0x6169('0x11')](_0x6169('0xd'),auth[_0x6169('0xa')](),controller[_0x6169('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5e0e=['../../config/environment','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5e0e,0x89));var _0xe5e0=function(_0x9154ee,_0x5f2a85){_0x9154ee=_0x9154ee-0x0;var _0x24c414=_0x5e0e[_0x9154ee];return _0x24c414;};'use strict';var multer=require(_0xe5e0('0x0'));var util=require(_0xe5e0('0x1'));var path=require('path');var timeout=require(_0xe5e0('0x2'));var express=require(_0xe5e0('0x3'));var router=express[_0xe5e0('0x4')]();var fs_extra=require(_0xe5e0('0x5'));var auth=require(_0xe5e0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe5e0('0x7'));var controller=require('./analyticMetric.controller');router[_0xe5e0('0x8')]('/',auth[_0xe5e0('0x9')](),controller[_0xe5e0('0xa')]);router[_0xe5e0('0x8')](_0xe5e0('0xb'),auth[_0xe5e0('0x9')](),controller['show']);router[_0xe5e0('0xc')]('/',auth[_0xe5e0('0x9')](),controller['create']);router[_0xe5e0('0xd')](_0xe5e0('0xb'),auth[_0xe5e0('0x9')](),controller[_0xe5e0('0xe')]);router[_0xe5e0('0xf')](_0xe5e0('0xb'),auth[_0xe5e0('0x9')](),controller[_0xe5e0('0x10')]);module[_0xe5e0('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index e70197e..4518fb9 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 _0x4058=['sequelize','exports','TEXT'];(function(_0x3ab99a,_0x3ce898){var _0x454822=function(_0x11e3ef){while(--_0x11e3ef){_0x3ab99a['push'](_0x3ab99a['shift']());}};_0x454822(++_0x3ce898);}(_0x4058,0x129));var _0x8405=function(_0x437772,_0x4d1793){_0x437772=_0x437772-0x0;var _0x3317b3=_0x4058[_0x437772];return _0x3317b3;};'use strict';var Sequelize=require(_0x8405('0x0'));module[_0x8405('0x1')]={'tree':{'type':Sequelize[_0x8405('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9a58=['exports','sequelize'];(function(_0x48d0c9,_0x5b26ac){var _0xcfaa34=function(_0x45edfc){while(--_0x45edfc){_0x48d0c9['push'](_0x48d0c9['shift']());}};_0xcfaa34(++_0x5b26ac);}(_0x9a58,0x131));var _0x89a5=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0x9a58[_0x349367];return _0x14179b;};'use strict';var Sequelize=require(_0x89a5('0x0'));module[_0x89a5('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 924dff5..c7127e7 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 _0x68af=['query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','AnalyticTreeReport','rawAttributes','fieldName','key','map'];(function(_0x33220b,_0x557d47){var _0xbc4404=function(_0x5d7ecd){while(--_0x5d7ecd){_0x33220b['push'](_0x33220b['shift']());}};_0xbc4404(++_0x557d47);}(_0x68af,0xaa));var _0xf68a=function(_0xaca348,_0x4d3993){_0xaca348=_0xaca348-0x0;var _0x560057=_0x68af[_0xaca348];return _0x560057;};'use strict';var emlformat=require(_0xf68a('0x0'));var rimraf=require(_0xf68a('0x1'));var zipdir=require(_0xf68a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf68a('0x3'));var moment=require('moment');var BPromise=require(_0xf68a('0x4'));var Mustache=require('mustache');var util=require(_0xf68a('0x5'));var path=require(_0xf68a('0x6'));var sox=require('sox');var csv=require(_0xf68a('0x7'));var ejs=require(_0xf68a('0x8'));var fs=require('fs');var fs_extra=require(_0xf68a('0x9'));var _=require(_0xf68a('0xa'));var squel=require(_0xf68a('0xb'));var crypto=require('crypto');var jsforce=require(_0xf68a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf68a('0x7'));var querystring=require(_0xf68a('0xd'));var Papa=require(_0xf68a('0xe'));var Redis=require(_0xf68a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf68a('0x10'));var as=require(_0xf68a('0x11'));var hardwareService=require(_0xf68a('0x12'));var logger=require(_0xf68a('0x13'))(_0xf68a('0x14'));var utils=require(_0xf68a('0x15'));var config=require(_0xf68a('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x294e10,_0x207810){_0x207810=_0x207810||0xcc;return function(_0x5ab180){if(_0x5ab180){return _0x294e10[_0xf68a('0x17')](_0x207810);}return _0x294e10[_0xf68a('0x18')](_0x207810)[_0xf68a('0x19')]();};}function respondWithResult(_0x3b8e90,_0x5a099b){_0x5a099b=_0x5a099b||0xc8;return function(_0x344a0f){if(_0x344a0f){return _0x3b8e90['status'](_0x5a099b)[_0xf68a('0x1a')](_0x344a0f);}};}function respondWithFilteredResult(_0x471635,_0x52f9ba){return function(_0x4977cc){if(_0x4977cc){var _0x416e40=typeof _0x52f9ba[_0xf68a('0x1b')]===_0xf68a('0x1c')&&typeof _0x52f9ba['limit']===_0xf68a('0x1c');var _0x2965c6=_0x4977cc['count'];var _0x17a134=_0x416e40?0x0:_0x52f9ba[_0xf68a('0x1b')];var _0x3bef66=_0x416e40?_0x4977cc[_0xf68a('0x1d')]:_0x52f9ba[_0xf68a('0x1b')]+_0x52f9ba[_0xf68a('0x1e')];var _0x16aa2a;if(_0x3bef66>=_0x2965c6){_0x3bef66=_0x2965c6;_0x16aa2a=0xc8;}else{_0x16aa2a=0xce;}_0x471635['status'](_0x16aa2a);return _0x471635['set'](_0xf68a('0x1f'),_0x17a134+'-'+_0x3bef66+'/'+_0x2965c6)[_0xf68a('0x1a')](_0x4977cc);}return null;};}function patchUpdates(_0x2fd1cd){return function(_0x3148ab){try{jsonpatch[_0xf68a('0x20')](_0x3148ab,_0x2fd1cd,!![]);}catch(_0x3f84bb){return BPromise[_0xf68a('0x21')](_0x3f84bb);}return _0x3148ab['save']();};}function saveUpdates(_0x3caf95,_0x1ab904){return function(_0x4f649e){if(_0x4f649e){return _0x4f649e[_0xf68a('0x22')](_0x3caf95)[_0xf68a('0x23')](function(_0x2c16c0){return _0x2c16c0;});}return null;};}function removeEntity(_0x2ed8f4,_0x2a80ea){return function(_0xb7b577){if(_0xb7b577){return _0xb7b577[_0xf68a('0x24')]()[_0xf68a('0x23')](function(){_0x2ed8f4[_0xf68a('0x18')](0xcc)[_0xf68a('0x19')]();});}};}function handleEntityNotFound(_0xbd0ecc,_0x2918fa){return function(_0x503b58){if(!_0x503b58){_0xbd0ecc[_0xf68a('0x17')](0x194);}return _0x503b58;};}function handleError(_0x1af1b3,_0x5005a2){_0x5005a2=_0x5005a2||0x1f4;return function(_0x98c56c){logger[_0xf68a('0x25')](_0x98c56c[_0xf68a('0x26')]);if(_0x98c56c['name']){delete _0x98c56c[_0xf68a('0x27')];}_0x1af1b3[_0xf68a('0x18')](_0x5005a2)[_0xf68a('0x28')](_0x98c56c);};}exports['index']=function(_0x1553d5,_0xdd5b56){var _0x112a31={},_0xd060b={},_0xf33d29={'count':0x0,'rows':[]};var _0x3a5d7e=_['map'](db[_0xf68a('0x29')][_0xf68a('0x2a')],function(_0x5802d3){return{'name':_0x5802d3[_0xf68a('0x2b')],'type':_0x5802d3['type'][_0xf68a('0x2c')]};});_0xd060b['model']=_[_0xf68a('0x2d')](_0x3a5d7e,_0xf68a('0x27'));_0xd060b[_0xf68a('0x2e')]=_[_0xf68a('0x2f')](_0x1553d5[_0xf68a('0x2e')]);_0xd060b[_0xf68a('0x30')]=_[_0xf68a('0x31')](_0xd060b[_0xf68a('0x32')],_0xd060b[_0xf68a('0x2e')]);_0x112a31['attributes']=_[_0xf68a('0x31')](_0xd060b['model'],qs['fields'](_0x1553d5['query'][_0xf68a('0x33')]));_0x112a31[_0xf68a('0x34')]=_0x112a31[_0xf68a('0x34')][_0xf68a('0x35')]?_0x112a31[_0xf68a('0x34')]:_0xd060b['model'];if(!_0x1553d5[_0xf68a('0x2e')][_0xf68a('0x36')](_0xf68a('0x37'))){_0x112a31['limit']=qs[_0xf68a('0x1e')](_0x1553d5[_0xf68a('0x2e')][_0xf68a('0x1e')]);_0x112a31[_0xf68a('0x1b')]=qs[_0xf68a('0x1b')](_0x1553d5[_0xf68a('0x2e')][_0xf68a('0x1b')]);}_0x112a31['order']=qs[_0xf68a('0x38')](_0x1553d5['query'][_0xf68a('0x38')]);_0x112a31[_0xf68a('0x39')]=qs[_0xf68a('0x30')](_[_0xf68a('0x3a')](_0x1553d5['query'],_0xd060b[_0xf68a('0x30')]),_0x3a5d7e);if(_0x1553d5[_0xf68a('0x2e')]['filter']){_0x112a31[_0xf68a('0x39')]=_[_0xf68a('0x3b')](_0x112a31['where'],{'$or':_[_0xf68a('0x2d')](_0x3a5d7e,function(_0x5a6308){if(_0x5a6308[_0xf68a('0x3c')]!==_0xf68a('0x3d')){var _0x48df83={};_0x48df83[_0x5a6308[_0xf68a('0x27')]]={'$like':'%'+_0x1553d5[_0xf68a('0x2e')]['filter']+'%'};return _0x48df83;}})});}_0x112a31=_[_0xf68a('0x3b')]({},_0x112a31,_0x1553d5[_0xf68a('0x3e')]);var _0x50b168={'where':_0x112a31[_0xf68a('0x39')]};return db[_0xf68a('0x29')]['count'](_0x50b168)['then'](function(_0x8bb0eb){_0xf33d29['count']=_0x8bb0eb;if(_0x1553d5[_0xf68a('0x2e')][_0xf68a('0x3f')]){_0x112a31[_0xf68a('0x40')]=[{'all':!![]}];}return db[_0xf68a('0x29')]['findAll'](_0x112a31);})[_0xf68a('0x23')](function(_0x31ae27){_0xf33d29[_0xf68a('0x41')]=_0x31ae27;return _0xf33d29;})['then'](respondWithFilteredResult(_0xdd5b56,_0x112a31))[_0xf68a('0x42')](handleError(_0xdd5b56,null));};exports[_0xf68a('0x43')]=function(_0x187d02,_0x1e26ff){var _0x4686cd={'raw':!![],'where':{'id':_0x187d02[_0xf68a('0x44')]['id']}},_0x35f4d7={};_0x35f4d7['model']=_['keys'](db[_0xf68a('0x29')]['rawAttributes']);_0x35f4d7[_0xf68a('0x2e')]=_['keys'](_0x187d02['query']);_0x35f4d7[_0xf68a('0x30')]=_[_0xf68a('0x31')](_0x35f4d7[_0xf68a('0x32')],_0x35f4d7[_0xf68a('0x2e')]);_0x4686cd[_0xf68a('0x34')]=_[_0xf68a('0x31')](_0x35f4d7[_0xf68a('0x32')],qs[_0xf68a('0x33')](_0x187d02[_0xf68a('0x2e')][_0xf68a('0x33')]));_0x4686cd[_0xf68a('0x34')]=_0x4686cd[_0xf68a('0x34')][_0xf68a('0x35')]?_0x4686cd[_0xf68a('0x34')]:_0x35f4d7['model'];if(_0x187d02[_0xf68a('0x2e')][_0xf68a('0x3f')]){_0x4686cd[_0xf68a('0x40')]=[{'all':!![]}];}_0x4686cd=_[_0xf68a('0x3b')]({},_0x4686cd,_0x187d02[_0xf68a('0x3e')]);return db['AnalyticTreeReport'][_0xf68a('0x45')](_0x4686cd)['then'](handleEntityNotFound(_0x1e26ff,null))[_0xf68a('0x23')](respondWithResult(_0x1e26ff,null))[_0xf68a('0x42')](handleError(_0x1e26ff,null));};exports['create']=function(_0x26854c,_0x3f36b0){return db[_0xf68a('0x29')][_0xf68a('0x46')](_0x26854c['body'],{})[_0xf68a('0x23')](respondWithResult(_0x3f36b0,0xc9))[_0xf68a('0x42')](handleError(_0x3f36b0,null));};exports[_0xf68a('0x22')]=function(_0x25439d,_0x3c502a){if(_0x25439d[_0xf68a('0x47')]['id']){delete _0x25439d['body']['id'];}return db['AnalyticTreeReport'][_0xf68a('0x45')]({'where':{'id':_0x25439d[_0xf68a('0x44')]['id']}})[_0xf68a('0x23')](handleEntityNotFound(_0x3c502a,null))[_0xf68a('0x23')](saveUpdates(_0x25439d[_0xf68a('0x47')],null))[_0xf68a('0x23')](respondWithResult(_0x3c502a,null))[_0xf68a('0x42')](handleError(_0x3c502a,null));};exports['destroy']=function(_0x1cf3f5,_0x4fa1b1){return db[_0xf68a('0x29')][_0xf68a('0x45')]({'where':{'id':_0x1cf3f5['params']['id']}})[_0xf68a('0x23')](handleEntityNotFound(_0x4fa1b1,null))[_0xf68a('0x23')](removeEntity(_0x4fa1b1,null))[_0xf68a('0x42')](handleError(_0x4fa1b1,null));}; \ No newline at end of file +var _0xe613=['fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count','limit','status','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','eml-format','rimraf','zip-dir'];(function(_0x14abb7,_0x4049e4){var _0x5673e8=function(_0x130334){while(--_0x130334){_0x14abb7['push'](_0x14abb7['shift']());}};_0x5673e8(++_0x4049e4);}(_0xe613,0x129));var _0x3e61=function(_0x5be686,_0x2fed9f){_0x5be686=_0x5be686-0x0;var _0x306c02=_0xe613[_0x5be686];return _0x306c02;};'use strict';var emlformat=require(_0x3e61('0x0'));var rimraf=require(_0x3e61('0x1'));var zipdir=require(_0x3e61('0x2'));var jsonpatch=require(_0x3e61('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3e61('0x4'));var Mustache=require('mustache');var util=require(_0x3e61('0x5'));var path=require(_0x3e61('0x6'));var sox=require(_0x3e61('0x7'));var csv=require(_0x3e61('0x8'));var ejs=require(_0x3e61('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3e61('0xa'));var squel=require(_0x3e61('0xb'));var crypto=require(_0x3e61('0xc'));var jsforce=require(_0x3e61('0xd'));var deskjs=require(_0x3e61('0xe'));var toCsv=require(_0x3e61('0x8'));var querystring=require(_0x3e61('0xf'));var Papa=require('papaparse');var Redis=require(_0x3e61('0x10'));var authService=require(_0x3e61('0x11'));var qs=require(_0x3e61('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e61('0x13'))(_0x3e61('0x14'));var utils=require(_0x3e61('0x15'));var config=require(_0x3e61('0x16'));var licenseUtil=require(_0x3e61('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1069e8,_0x1c0691){_0x1c0691=_0x1c0691||0xcc;return function(_0x17d911){if(_0x17d911){return _0x1069e8[_0x3e61('0x18')](_0x1c0691);}return _0x1069e8['status'](_0x1c0691)[_0x3e61('0x19')]();};}function respondWithResult(_0xe23b2a,_0x4f8df3){_0x4f8df3=_0x4f8df3||0xc8;return function(_0x52b22e){if(_0x52b22e){return _0xe23b2a['status'](_0x4f8df3)[_0x3e61('0x1a')](_0x52b22e);}};}function respondWithFilteredResult(_0x34bd13,_0x188c97){return function(_0xd4c061){if(_0xd4c061){var _0x125aa7=typeof _0x188c97[_0x3e61('0x1b')]===_0x3e61('0x1c')&&typeof _0x188c97['limit']===_0x3e61('0x1c');var _0x4676d7=_0xd4c061['count'];var _0x357e7b=_0x125aa7?0x0:_0x188c97[_0x3e61('0x1b')];var _0x306ddf=_0x125aa7?_0xd4c061[_0x3e61('0x1d')]:_0x188c97[_0x3e61('0x1b')]+_0x188c97[_0x3e61('0x1e')];var _0x2fda78;if(_0x306ddf>=_0x4676d7){_0x306ddf=_0x4676d7;_0x2fda78=0xc8;}else{_0x2fda78=0xce;}_0x34bd13[_0x3e61('0x1f')](_0x2fda78);return _0x34bd13[_0x3e61('0x20')]('Content-Range',_0x357e7b+'-'+_0x306ddf+'/'+_0x4676d7)[_0x3e61('0x1a')](_0xd4c061);}return null;};}function patchUpdates(_0x51664a){return function(_0x44c837){try{jsonpatch[_0x3e61('0x21')](_0x44c837,_0x51664a,!![]);}catch(_0x389b0c){return BPromise[_0x3e61('0x22')](_0x389b0c);}return _0x44c837[_0x3e61('0x23')]();};}function saveUpdates(_0x1f0741,_0x5b1bd4){return function(_0x59a595){if(_0x59a595){return _0x59a595[_0x3e61('0x24')](_0x1f0741)[_0x3e61('0x25')](function(_0x4c38a6){return _0x4c38a6;});}return null;};}function removeEntity(_0x319971,_0x3b2f7a){return function(_0x1159e0){if(_0x1159e0){return _0x1159e0[_0x3e61('0x26')]()[_0x3e61('0x25')](function(){_0x319971[_0x3e61('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x677343,_0x3eec1e){return function(_0x226ae8){if(!_0x226ae8){_0x677343[_0x3e61('0x18')](0x194);}return _0x226ae8;};}function handleError(_0x5b3ac5,_0x23e877){_0x23e877=_0x23e877||0x1f4;return function(_0x1e2ca7){logger[_0x3e61('0x27')](_0x1e2ca7[_0x3e61('0x28')]);if(_0x1e2ca7[_0x3e61('0x29')]){delete _0x1e2ca7[_0x3e61('0x29')];}_0x5b3ac5[_0x3e61('0x1f')](_0x23e877)[_0x3e61('0x2a')](_0x1e2ca7);};}exports[_0x3e61('0x2b')]=function(_0x34dcd7,_0x65b848){var _0x4ffa1a={},_0x5ca17e={},_0x36529e={'count':0x0,'rows':[]};var _0x4ffe4b=_[_0x3e61('0x2c')](db[_0x3e61('0x2d')][_0x3e61('0x2e')],function(_0x2c574c){return{'name':_0x2c574c['fieldName'],'type':_0x2c574c[_0x3e61('0x2f')]['key']};});_0x5ca17e[_0x3e61('0x30')]=_[_0x3e61('0x2c')](_0x4ffe4b,'name');_0x5ca17e['query']=_[_0x3e61('0x31')](_0x34dcd7[_0x3e61('0x32')]);_0x5ca17e[_0x3e61('0x33')]=_[_0x3e61('0x34')](_0x5ca17e[_0x3e61('0x30')],_0x5ca17e[_0x3e61('0x32')]);_0x4ffa1a[_0x3e61('0x35')]=_[_0x3e61('0x34')](_0x5ca17e['model'],qs['fields'](_0x34dcd7[_0x3e61('0x32')]['fields']));_0x4ffa1a['attributes']=_0x4ffa1a[_0x3e61('0x35')][_0x3e61('0x36')]?_0x4ffa1a['attributes']:_0x5ca17e[_0x3e61('0x30')];if(!_0x34dcd7[_0x3e61('0x32')][_0x3e61('0x37')]('nolimit')){_0x4ffa1a[_0x3e61('0x1e')]=qs[_0x3e61('0x1e')](_0x34dcd7['query'][_0x3e61('0x1e')]);_0x4ffa1a[_0x3e61('0x1b')]=qs['offset'](_0x34dcd7[_0x3e61('0x32')][_0x3e61('0x1b')]);}_0x4ffa1a[_0x3e61('0x38')]=qs[_0x3e61('0x39')](_0x34dcd7[_0x3e61('0x32')][_0x3e61('0x39')]);_0x4ffa1a['where']=qs['filters'](_[_0x3e61('0x3a')](_0x34dcd7[_0x3e61('0x32')],_0x5ca17e['filters']),_0x4ffe4b);if(_0x34dcd7['query'][_0x3e61('0x3b')]){_0x4ffa1a['where']=_[_0x3e61('0x3c')](_0x4ffa1a[_0x3e61('0x3d')],{'$or':_[_0x3e61('0x2c')](_0x4ffe4b,function(_0xbe7ee8){if(_0xbe7ee8[_0x3e61('0x2f')]!==_0x3e61('0x3e')){var _0x4de10a={};_0x4de10a[_0xbe7ee8[_0x3e61('0x29')]]={'$like':'%'+_0x34dcd7[_0x3e61('0x32')][_0x3e61('0x3b')]+'%'};return _0x4de10a;}})});}_0x4ffa1a=_[_0x3e61('0x3c')]({},_0x4ffa1a,_0x34dcd7[_0x3e61('0x3f')]);var _0x1b05a7={'where':_0x4ffa1a['where']};return db[_0x3e61('0x2d')]['count'](_0x1b05a7)['then'](function(_0xbbfdde){_0x36529e[_0x3e61('0x1d')]=_0xbbfdde;if(_0x34dcd7['query'][_0x3e61('0x40')]){_0x4ffa1a[_0x3e61('0x41')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x3e61('0x42')](_0x4ffa1a);})[_0x3e61('0x25')](function(_0x47215d){_0x36529e[_0x3e61('0x43')]=_0x47215d;return _0x36529e;})['then'](respondWithFilteredResult(_0x65b848,_0x4ffa1a))[_0x3e61('0x44')](handleError(_0x65b848,null));};exports[_0x3e61('0x45')]=function(_0x12fa8a,_0x5112b3){var _0x5e4f7d={'raw':!![],'where':{'id':_0x12fa8a[_0x3e61('0x46')]['id']}},_0x32c8bc={};_0x32c8bc[_0x3e61('0x30')]=_[_0x3e61('0x31')](db[_0x3e61('0x2d')]['rawAttributes']);_0x32c8bc[_0x3e61('0x32')]=_[_0x3e61('0x31')](_0x12fa8a['query']);_0x32c8bc[_0x3e61('0x33')]=_[_0x3e61('0x34')](_0x32c8bc[_0x3e61('0x30')],_0x32c8bc[_0x3e61('0x32')]);_0x5e4f7d[_0x3e61('0x35')]=_['intersection'](_0x32c8bc[_0x3e61('0x30')],qs['fields'](_0x12fa8a[_0x3e61('0x32')][_0x3e61('0x47')]));_0x5e4f7d[_0x3e61('0x35')]=_0x5e4f7d[_0x3e61('0x35')][_0x3e61('0x36')]?_0x5e4f7d[_0x3e61('0x35')]:_0x32c8bc[_0x3e61('0x30')];if(_0x12fa8a[_0x3e61('0x32')][_0x3e61('0x40')]){_0x5e4f7d[_0x3e61('0x41')]=[{'all':!![]}];}_0x5e4f7d=_[_0x3e61('0x3c')]({},_0x5e4f7d,_0x12fa8a[_0x3e61('0x3f')]);return db[_0x3e61('0x2d')][_0x3e61('0x48')](_0x5e4f7d)['then'](handleEntityNotFound(_0x5112b3,null))['then'](respondWithResult(_0x5112b3,null))[_0x3e61('0x44')](handleError(_0x5112b3,null));};exports[_0x3e61('0x49')]=function(_0x10a3d1,_0x17fc5f){return db[_0x3e61('0x2d')][_0x3e61('0x49')](_0x10a3d1['body'],{})[_0x3e61('0x25')](respondWithResult(_0x17fc5f,0xc9))[_0x3e61('0x44')](handleError(_0x17fc5f,null));};exports[_0x3e61('0x24')]=function(_0x45595b,_0x1a2402){if(_0x45595b['body']['id']){delete _0x45595b[_0x3e61('0x4a')]['id'];}return db[_0x3e61('0x2d')]['find']({'where':{'id':_0x45595b['params']['id']}})[_0x3e61('0x25')](handleEntityNotFound(_0x1a2402,null))[_0x3e61('0x25')](saveUpdates(_0x45595b[_0x3e61('0x4a')],null))[_0x3e61('0x25')](respondWithResult(_0x1a2402,null))[_0x3e61('0x44')](handleError(_0x1a2402,null));};exports['destroy']=function(_0x2ca93c,_0x33645d){return db[_0x3e61('0x2d')][_0x3e61('0x48')]({'where':{'id':_0x2ca93c[_0x3e61('0x46')]['id']}})['then'](handleEntityNotFound(_0x33645d,null))[_0x3e61('0x25')](removeEntity(_0x33645d,null))[_0x3e61('0x44')](handleError(_0x33645d,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 8bdafac..94b33b4 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 _0x27e4=['../../config/logger','moment','path','../../config/environment','./analyticTreeReport.attributes','exports','define','lodash'];(function(_0x472516,_0x507cad){var _0x3819c0=function(_0x6482e5){while(--_0x6482e5){_0x472516['push'](_0x472516['shift']());}};_0x3819c0(++_0x507cad);}(_0x27e4,0x1a7));var _0x427e=function(_0x1889d5,_0x43c4ec){_0x1889d5=_0x1889d5-0x0;var _0x4e3daf=_0x27e4[_0x1889d5];return _0x4e3daf;};'use strict';var _=require(_0x427e('0x0'));var util=require('util');var logger=require(_0x427e('0x1'))('api');var moment=require(_0x427e('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x427e('0x3'));var rimraf=require('rimraf');var config=require(_0x427e('0x4'));var attributes=require(_0x427e('0x5'));module[_0x427e('0x6')]=function(_0x1784eb,_0x59ead3){return _0x1784eb[_0x427e('0x7')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1477=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x501c84,_0x6fd942){var _0x2706d5=function(_0x9f2e96){while(--_0x9f2e96){_0x501c84['push'](_0x501c84['shift']());}};_0x2706d5(++_0x6fd942);}(_0x1477,0xa4));var _0x7147=function(_0x2ebb4a,_0x29bb77){_0x2ebb4a=_0x2ebb4a-0x0;var _0x2c6a7a=_0x1477[_0x2ebb4a];return _0x2c6a7a;};'use strict';var _=require(_0x7147('0x0'));var util=require(_0x7147('0x1'));var logger=require(_0x7147('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7147('0x3'));var rp=require(_0x7147('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7147('0x5'));var config=require(_0x7147('0x6'));var attributes=require(_0x7147('0x7'));module[_0x7147('0x8')]=function(_0x44fae0,_0x5a71a1){return _0x44fae0['define'](_0x7147('0x9'),attributes,{'tableName':_0x7147('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index e18e6a1..1721902 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x4faef9,_0x2a2fa8){var _0x4d42ca=function(_0x23418e){while(--_0x23418e){_0x4faef9['push'](_0x4faef9['shift']());}};_0x4d42ca(++_0x2a2fa8);}(_0x1261,0x144));var _0x1126=function(_0x1b62b8,_0x3e78d9){_0x1b62b8=_0x1b62b8-0x0;var _0x47a5a0=_0x1261[_0x1b62b8];return _0x47a5a0;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2409b2,_0x4aee9c){var _0x772613=function(_0x576283){while(--_0x576283){_0x2409b2['push'](_0x2409b2['shift']());}};_0x772613(++_0x4aee9c);}(_0x5f2f,0x73));var _0xf5f2=function(_0xff7747,_0x2b2c0a){_0xff7747=_0xff7747-0x0;var _0x1e1530=_0x5f2f[_0xff7747];return _0x1e1530;};'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 313df2d..241c58e 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 _0x7f4c=['put','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x431b29,_0x21fee3){var _0x1ee30d=function(_0x58b26c){while(--_0x58b26c){_0x431b29['push'](_0x431b29['shift']());}};_0x1ee30d(++_0x21fee3);}(_0x7f4c,0x1bb));var _0xc7f4=function(_0x384c0d,_0x5c4736){_0x384c0d=_0x384c0d-0x0;var _0x4470b5=_0x7f4c[_0x384c0d];return _0x4470b5;};'use strict';var multer=require(_0xc7f4('0x0'));var util=require(_0xc7f4('0x1'));var path=require(_0xc7f4('0x2'));var timeout=require('connect-timeout');var express=require(_0xc7f4('0x3'));var router=express[_0xc7f4('0x4')]();var fs_extra=require(_0xc7f4('0x5'));var auth=require(_0xc7f4('0x6'));var interaction=require(_0xc7f4('0x7'));var config=require(_0xc7f4('0x8'));var controller=require(_0xc7f4('0x9'));router[_0xc7f4('0xa')]('/',auth[_0xc7f4('0xb')](),controller[_0xc7f4('0xc')]);router[_0xc7f4('0xa')](_0xc7f4('0xd'),auth[_0xc7f4('0xb')](),controller[_0xc7f4('0xe')]);router[_0xc7f4('0xf')]('/',auth[_0xc7f4('0xb')](),controller[_0xc7f4('0x10')]);router[_0xc7f4('0x11')](_0xc7f4('0xd'),auth[_0xc7f4('0xb')](),controller['update']);router[_0xc7f4('0x12')](_0xc7f4('0xd'),auth[_0xc7f4('0xb')](),controller[_0xc7f4('0x13')]);module['exports']=router; \ No newline at end of file +var _0x4d80=['show','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id'];(function(_0x3e8bfe,_0x3bc10c){var _0x55e5a1=function(_0x2b9bc4){while(--_0x2b9bc4){_0x3e8bfe['push'](_0x3e8bfe['shift']());}};_0x55e5a1(++_0x3bc10c);}(_0x4d80,0x1e1));var _0x04d8=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x4d80[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require('multer');var util=require(_0x04d8('0x0'));var path=require('path');var timeout=require(_0x04d8('0x1'));var express=require(_0x04d8('0x2'));var router=express['Router']();var fs_extra=require(_0x04d8('0x3'));var auth=require(_0x04d8('0x4'));var interaction=require(_0x04d8('0x5'));var config=require(_0x04d8('0x6'));var controller=require(_0x04d8('0x7'));router[_0x04d8('0x8')]('/',auth[_0x04d8('0x9')](),controller[_0x04d8('0xa')]);router[_0x04d8('0x8')](_0x04d8('0xb'),auth['isAuthenticated'](),controller[_0x04d8('0xc')]);router['post']('/',auth[_0x04d8('0x9')](),controller['create']);router['put'](_0x04d8('0xb'),auth['isAuthenticated'](),controller[_0x04d8('0xd')]);router[_0x04d8('0xe')]('/:id',auth[_0x04d8('0x9')](),controller[_0x04d8('0xf')]);module[_0x04d8('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 295ae10..adf8716 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 _0x36f1=['sequelize','STRING'];(function(_0x345e4c,_0x3e73ba){var _0x40c41c=function(_0x23dfe0){while(--_0x23dfe0){_0x345e4c['push'](_0x345e4c['shift']());}};_0x40c41c(++_0x3e73ba);}(_0x36f1,0xb0));var _0x136f=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x36f1[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x136f('0x0'));module['exports']={'name':{'type':Sequelize[_0x136f('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x136f('0x1')]}}; \ No newline at end of file +var _0x17ba=['sequelize','exports','STRING'];(function(_0x510dc4,_0x24488a){var _0x5eabe4=function(_0x1f8c2f){while(--_0x1f8c2f){_0x510dc4['push'](_0x510dc4['shift']());}};_0x5eabe4(++_0x24488a);}(_0x17ba,0xab));var _0xa17b=function(_0x2fa292,_0x7d6ace){_0x2fa292=_0x2fa292-0x0;var _0x56472c=_0x17ba[_0x2fa292];return _0x56472c;};'use strict';var Sequelize=require(_0xa17b('0x0'));module[_0xa17b('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xa17b('0x2')]},'type':{'type':Sequelize[_0xa17b('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 678597c..f306b6b 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 _0xd403=['where','pick','filter','merge','options','Attachment','include','rows','catch','show','params','keys','includeAll','find','clone','get','omit','createdAt','updatedAt','body','create','originalname','basename','file','filename','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','rawAttributes','type','key','filters','model','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x304e95,_0x5991d1){var _0x2261b2=function(_0x524549){while(--_0x524549){_0x304e95['push'](_0x304e95['shift']());}};_0x2261b2(++_0x5991d1);}(_0xd403,0xd5));var _0x3d40=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xd403[_0x29d915];return _0x160f86;};'use strict';var emlformat=require(_0x3d40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d40('0x1'));var jsonpatch=require(_0x3d40('0x2'));var rp=require(_0x3d40('0x3'));var moment=require('moment');var BPromise=require(_0x3d40('0x4'));var Mustache=require(_0x3d40('0x5'));var util=require(_0x3d40('0x6'));var path=require(_0x3d40('0x7'));var sox=require(_0x3d40('0x8'));var csv=require(_0x3d40('0x9'));var ejs=require(_0x3d40('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d40('0xb'));var squel=require(_0x3d40('0xc'));var crypto=require(_0x3d40('0xd'));var jsforce=require(_0x3d40('0xe'));var deskjs=require(_0x3d40('0xf'));var toCsv=require(_0x3d40('0x9'));var querystring=require(_0x3d40('0x10'));var Papa=require(_0x3d40('0x11'));var Redis=require(_0x3d40('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3d40('0x13'));var as=require(_0x3d40('0x14'));var hardwareService=require(_0x3d40('0x15'));var logger=require(_0x3d40('0x16'))('api');var utils=require(_0x3d40('0x17'));var config=require(_0x3d40('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3d40('0x19'))['db'];function respondWithStatusCode(_0x4261a0,_0x5cb2fd){_0x5cb2fd=_0x5cb2fd||0xcc;return function(_0x21f464){if(_0x21f464){return _0x4261a0[_0x3d40('0x1a')](_0x5cb2fd);}return _0x4261a0[_0x3d40('0x1b')](_0x5cb2fd)[_0x3d40('0x1c')]();};}function respondWithResult(_0x3268de,_0x4693bb){_0x4693bb=_0x4693bb||0xc8;return function(_0x4c1e68){if(_0x4c1e68){return _0x3268de[_0x3d40('0x1b')](_0x4693bb)[_0x3d40('0x1d')](_0x4c1e68);}};}function respondWithFilteredResult(_0x183fe3,_0xef011c){return function(_0xb795d5){if(_0xb795d5){var _0x491486=typeof _0xef011c[_0x3d40('0x1e')]===_0x3d40('0x1f')&&typeof _0xef011c['limit']===_0x3d40('0x1f');var _0x3c56c1=_0xb795d5[_0x3d40('0x20')];var _0x1c6d95=_0x491486?0x0:_0xef011c[_0x3d40('0x1e')];var _0x5ca7b8=_0x491486?_0xb795d5[_0x3d40('0x20')]:_0xef011c[_0x3d40('0x1e')]+_0xef011c[_0x3d40('0x21')];var _0x40cbe5;if(_0x5ca7b8>=_0x3c56c1){_0x5ca7b8=_0x3c56c1;_0x40cbe5=0xc8;}else{_0x40cbe5=0xce;}_0x183fe3[_0x3d40('0x1b')](_0x40cbe5);return _0x183fe3[_0x3d40('0x22')](_0x3d40('0x23'),_0x1c6d95+'-'+_0x5ca7b8+'/'+_0x3c56c1)['json'](_0xb795d5);}return null;};}function patchUpdates(_0x54ee55){return function(_0x2be86f){try{jsonpatch[_0x3d40('0x24')](_0x2be86f,_0x54ee55,!![]);}catch(_0x295a30){return BPromise[_0x3d40('0x25')](_0x295a30);}return _0x2be86f[_0x3d40('0x26')]();};}function saveUpdates(_0x214f40,_0x9f5b5c){return function(_0x5374db){if(_0x5374db){return _0x5374db[_0x3d40('0x27')](_0x214f40)[_0x3d40('0x28')](function(_0x11b1c4){return _0x11b1c4;});}return null;};}function removeEntity(_0x245fd8,_0x571b59){return function(_0x5c246d){if(_0x5c246d){return _0x5c246d[_0x3d40('0x29')]()['then'](function(){_0x245fd8['status'](0xcc)[_0x3d40('0x1c')]();});}};}function handleEntityNotFound(_0x18c1ae,_0x447cc3){return function(_0x66d932){if(!_0x66d932){_0x18c1ae[_0x3d40('0x1a')](0x194);}return _0x66d932;};}function handleError(_0x29128f,_0x3ae168){_0x3ae168=_0x3ae168||0x1f4;return function(_0x23b13e){logger['error'](_0x23b13e[_0x3d40('0x2a')]);if(_0x23b13e[_0x3d40('0x2b')]){delete _0x23b13e[_0x3d40('0x2b')];}_0x29128f[_0x3d40('0x1b')](_0x3ae168)['send'](_0x23b13e);};}exports[_0x3d40('0x2c')]=function(_0x2cf227,_0x21b046){var _0x4f5032={},_0x3483a4={},_0x445ad7={'count':0x0,'rows':[]};var _0x38cc8c=_[_0x3d40('0x2d')](db['Attachment'][_0x3d40('0x2e')],function(_0x41936a){return{'name':_0x41936a['fieldName'],'type':_0x41936a[_0x3d40('0x2f')][_0x3d40('0x30')]};});_0x3483a4['model']=_[_0x3d40('0x2d')](_0x38cc8c,_0x3d40('0x2b'));_0x3483a4['query']=_['keys'](_0x2cf227['query']);_0x3483a4[_0x3d40('0x31')]=_['intersection'](_0x3483a4[_0x3d40('0x32')],_0x3483a4['query']);_0x4f5032['attributes']=_[_0x3d40('0x33')](_0x3483a4[_0x3d40('0x32')],qs['fields'](_0x2cf227[_0x3d40('0x34')][_0x3d40('0x35')]));_0x4f5032[_0x3d40('0x36')]=_0x4f5032['attributes'][_0x3d40('0x37')]?_0x4f5032[_0x3d40('0x36')]:_0x3483a4[_0x3d40('0x32')];if(!_0x2cf227[_0x3d40('0x34')][_0x3d40('0x38')](_0x3d40('0x39'))){_0x4f5032[_0x3d40('0x21')]=qs[_0x3d40('0x21')](_0x2cf227[_0x3d40('0x34')][_0x3d40('0x21')]);_0x4f5032[_0x3d40('0x1e')]=qs[_0x3d40('0x1e')](_0x2cf227[_0x3d40('0x34')]['offset']);}_0x4f5032[_0x3d40('0x3a')]=qs[_0x3d40('0x3b')](_0x2cf227['query'][_0x3d40('0x3b')]);_0x4f5032[_0x3d40('0x3c')]=qs[_0x3d40('0x31')](_[_0x3d40('0x3d')](_0x2cf227[_0x3d40('0x34')],_0x3483a4[_0x3d40('0x31')]),_0x38cc8c);if(_0x2cf227[_0x3d40('0x34')][_0x3d40('0x3e')]){_0x4f5032[_0x3d40('0x3c')]=_[_0x3d40('0x3f')](_0x4f5032['where'],{'$or':_['map'](_0x38cc8c,function(_0x1aeb67){if(_0x1aeb67[_0x3d40('0x2f')]!=='VIRTUAL'){var _0xfab07b={};_0xfab07b[_0x1aeb67[_0x3d40('0x2b')]]={'$like':'%'+_0x2cf227[_0x3d40('0x34')][_0x3d40('0x3e')]+'%'};return _0xfab07b;}})});}_0x4f5032=_[_0x3d40('0x3f')]({},_0x4f5032,_0x2cf227[_0x3d40('0x40')]);var _0x4c1701={'where':_0x4f5032[_0x3d40('0x3c')]};return db[_0x3d40('0x41')][_0x3d40('0x20')](_0x4c1701)['then'](function(_0x355af2){_0x445ad7[_0x3d40('0x20')]=_0x355af2;if(_0x2cf227[_0x3d40('0x34')]['includeAll']){_0x4f5032[_0x3d40('0x42')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x4f5032);})['then'](function(_0x4501ed){_0x445ad7[_0x3d40('0x43')]=_0x4501ed;return _0x445ad7;})[_0x3d40('0x28')](respondWithFilteredResult(_0x21b046,_0x4f5032))[_0x3d40('0x44')](handleError(_0x21b046,null));};exports[_0x3d40('0x45')]=function(_0x139c59,_0x5e8d74){var _0x104628={'raw':!![],'where':{'id':_0x139c59[_0x3d40('0x46')]['id']}},_0x4af474={};_0x4af474['model']=_[_0x3d40('0x47')](db[_0x3d40('0x41')]['rawAttributes']);_0x4af474['query']=_[_0x3d40('0x47')](_0x139c59[_0x3d40('0x34')]);_0x4af474[_0x3d40('0x31')]=_[_0x3d40('0x33')](_0x4af474['model'],_0x4af474[_0x3d40('0x34')]);_0x104628['attributes']=_['intersection'](_0x4af474['model'],qs[_0x3d40('0x35')](_0x139c59['query'][_0x3d40('0x35')]));_0x104628[_0x3d40('0x36')]=_0x104628[_0x3d40('0x36')][_0x3d40('0x37')]?_0x104628[_0x3d40('0x36')]:_0x4af474[_0x3d40('0x32')];if(_0x139c59[_0x3d40('0x34')][_0x3d40('0x48')]){_0x104628['include']=[{'all':!![]}];}_0x104628=_[_0x3d40('0x3f')]({},_0x104628,_0x139c59['options']);return db[_0x3d40('0x41')][_0x3d40('0x49')](_0x104628)[_0x3d40('0x28')](handleEntityNotFound(_0x5e8d74,null))[_0x3d40('0x28')](respondWithResult(_0x5e8d74,null))[_0x3d40('0x44')](handleError(_0x5e8d74,null));};exports[_0x3d40('0x4a')]=function(_0x398f55,_0x443d5d){var _0x5adcb9={'where':{'id':_0x398f55[_0x3d40('0x46')]['id']}},_0x527648={};_0x527648[_0x3d40('0x32')]=_[_0x3d40('0x47')](db[_0x3d40('0x41')][_0x3d40('0x2e')]);_0x5adcb9['attributes']=_['intersection'](_0x527648[_0x3d40('0x32')],qs[_0x3d40('0x35')](_0x398f55[_0x3d40('0x34')][_0x3d40('0x35')]));_0x5adcb9[_0x3d40('0x36')]=_0x5adcb9[_0x3d40('0x36')]['length']?_0x5adcb9[_0x3d40('0x36')]:_0x527648[_0x3d40('0x32')];if(_0x398f55[_0x3d40('0x34')][_0x3d40('0x48')]){_0x5adcb9[_0x3d40('0x42')]=[{'all':!![]}];}_0x5adcb9=_['merge']({},_0x5adcb9,_0x398f55[_0x3d40('0x40')]);return db[_0x3d40('0x41')]['find'](_0x5adcb9)[_0x3d40('0x28')](handleEntityNotFound(_0x443d5d,null))[_0x3d40('0x28')](function(_0x559fcb){if(_0x559fcb){var _0x2930c6=_0x559fcb[_0x3d40('0x4b')]({'plain':!![]});_0x2930c6=qs[_0x3d40('0x4c')](_0x2930c6,['id',_0x3d40('0x4d'),_0x3d40('0x4e')]);_0x398f55[_0x3d40('0x4f')]=_['omit'](_0x398f55[_0x3d40('0x4f')],['id','createdAt',_0x3d40('0x4e')]);return db[_0x3d40('0x41')][_0x3d40('0x50')](_[_0x3d40('0x3f')](_0x2930c6,_0x398f55[_0x3d40('0x4f')]),{'include':_0x398f55[_0x3d40('0x34')]['includeAll']?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x443d5d,0xc9))[_0x3d40('0x44')](handleError(_0x443d5d,null));};exports[_0x3d40('0x27')]=function(_0x46ec6a,_0x16a3b6){if(_0x46ec6a[_0x3d40('0x4f')]['id']){delete _0x46ec6a[_0x3d40('0x4f')]['id'];}return db[_0x3d40('0x41')]['find']({'where':{'id':_0x46ec6a[_0x3d40('0x46')]['id']}})['then'](handleEntityNotFound(_0x16a3b6,null))[_0x3d40('0x28')](saveUpdates(_0x46ec6a[_0x3d40('0x4f')],null))[_0x3d40('0x28')](respondWithResult(_0x16a3b6,null))['catch'](handleError(_0x16a3b6,null));};exports[_0x3d40('0x29')]=function(_0x35b265,_0x468e61){return db['Attachment'][_0x3d40('0x49')]({'where':{'id':_0x35b265[_0x3d40('0x46')]['id']}})['then'](handleEntityNotFound(_0x468e61,null))['then'](removeEntity(_0x468e61,null))[_0x3d40('0x44')](handleError(_0x468e61,null));};exports[_0x3d40('0x50')]=function(_0x437fc4,_0x4e23aa,_0x44623a){_0x437fc4[_0x3d40('0x4f')][_0x3d40('0x2b')]=_0x437fc4['file'][_0x3d40('0x51')];_0x437fc4[_0x3d40('0x4f')][_0x3d40('0x52')]=_0x437fc4[_0x3d40('0x53')][_0x3d40('0x54')];_0x437fc4[_0x3d40('0x4f')][_0x3d40('0x2f')]=_0x437fc4[_0x3d40('0x53')]['mimetype'];return db[_0x3d40('0x41')][_0x3d40('0x50')](_0x437fc4[_0x3d40('0x4f')])[_0x3d40('0x28')](respondWithResult(_0x4e23aa,0xc9))[_0x3d40('0x44')](handleError(_0x4e23aa,null));};exports['download']=function(_0x5c2334,_0x383407,_0x378d9b){return db[_0x3d40('0x41')][_0x3d40('0x55')]({'where':{'id':_0x5c2334[_0x3d40('0x46')]['id']},'raw':!![]})[_0x3d40('0x28')](handleEntityNotFound(_0x383407,null))['then'](function(_0x684496){if(_0x684496){var _0x279755=_0x684496[_0x3d40('0x56')]!==null;var _0x31cd02=path[_0x3d40('0x57')](config['root'],_0x3d40('0x58'));if(_0x279755){_0x31cd02=path[_0x3d40('0x57')](_0x31cd02,_0x3d40('0x59'));}var _0x146394=path[_0x3d40('0x57')](_0x31cd02,_0x684496[_0x3d40('0x52')]);return _0x383407[_0x3d40('0x5a')](_0x146394);}})[_0x3d40('0x44')](handleError(_0x383407,null));}; \ No newline at end of file +var _0x2604=['originalname','basename','filename','mimetype','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','eml-format','zip-dir','moment','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','limit','reject','save','update','then','destroy','error','stack','name','send','map','Attachment','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','offset','order','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','find','get','omit','createdAt','updatedAt','body','create','params','file'];(function(_0x15e8a8,_0x47246d){var _0x5ad498=function(_0x463e96){while(--_0x463e96){_0x15e8a8['push'](_0x15e8a8['shift']());}};_0x5ad498(++_0x47246d);}(_0x2604,0xb4));var _0x4260=function(_0xf281b7,_0x2ab18e){_0xf281b7=_0xf281b7-0x0;var _0x46b101=_0x2604[_0xf281b7];return _0x46b101;};'use strict';var emlformat=require(_0x4260('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4260('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4260('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4260('0x3'));var path=require(_0x4260('0x4'));var sox=require(_0x4260('0x5'));var csv=require(_0x4260('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4260('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4260('0x8'));var jsforce=require(_0x4260('0x9'));var deskjs=require(_0x4260('0xa'));var toCsv=require(_0x4260('0x6'));var querystring=require(_0x4260('0xb'));var Papa=require(_0x4260('0xc'));var Redis=require(_0x4260('0xd'));var authService=require(_0x4260('0xe'));var qs=require(_0x4260('0xf'));var as=require(_0x4260('0x10'));var hardwareService=require(_0x4260('0x11'));var logger=require('../../config/logger')(_0x4260('0x12'));var utils=require(_0x4260('0x13'));var config=require(_0x4260('0x14'));var licenseUtil=require(_0x4260('0x15'));var db=require(_0x4260('0x16'))['db'];function respondWithStatusCode(_0x513558,_0x468cd4){_0x468cd4=_0x468cd4||0xcc;return function(_0x33e934){if(_0x33e934){return _0x513558[_0x4260('0x17')](_0x468cd4);}return _0x513558[_0x4260('0x18')](_0x468cd4)[_0x4260('0x19')]();};}function respondWithResult(_0x2eff97,_0x329a07){_0x329a07=_0x329a07||0xc8;return function(_0x4fe653){if(_0x4fe653){return _0x2eff97['status'](_0x329a07)[_0x4260('0x1a')](_0x4fe653);}};}function respondWithFilteredResult(_0xc5fc35,_0xb6a12e){return function(_0x333eda){if(_0x333eda){var _0x5719f6=typeof _0xb6a12e['offset']===_0x4260('0x1b')&&typeof _0xb6a12e['limit']===_0x4260('0x1b');var _0x1a832b=_0x333eda[_0x4260('0x1c')];var _0x308ad9=_0x5719f6?0x0:_0xb6a12e['offset'];var _0xcfcd71=_0x5719f6?_0x333eda[_0x4260('0x1c')]:_0xb6a12e['offset']+_0xb6a12e[_0x4260('0x1d')];var _0x47a8b9;if(_0xcfcd71>=_0x1a832b){_0xcfcd71=_0x1a832b;_0x47a8b9=0xc8;}else{_0x47a8b9=0xce;}_0xc5fc35[_0x4260('0x18')](_0x47a8b9);return _0xc5fc35['set']('Content-Range',_0x308ad9+'-'+_0xcfcd71+'/'+_0x1a832b)[_0x4260('0x1a')](_0x333eda);}return null;};}function patchUpdates(_0x5748e4){return function(_0x464894){try{jsonpatch['apply'](_0x464894,_0x5748e4,!![]);}catch(_0x1abaee){return BPromise[_0x4260('0x1e')](_0x1abaee);}return _0x464894[_0x4260('0x1f')]();};}function saveUpdates(_0x3ea1c5,_0x55b3bb){return function(_0x14ce29){if(_0x14ce29){return _0x14ce29[_0x4260('0x20')](_0x3ea1c5)[_0x4260('0x21')](function(_0x3f89c3){return _0x3f89c3;});}return null;};}function removeEntity(_0x315cb4,_0x28e92c){return function(_0x3ea7df){if(_0x3ea7df){return _0x3ea7df[_0x4260('0x22')]()['then'](function(){_0x315cb4[_0x4260('0x18')](0xcc)[_0x4260('0x19')]();});}};}function handleEntityNotFound(_0x2bad95,_0x29de0b){return function(_0x21645f){if(!_0x21645f){_0x2bad95[_0x4260('0x17')](0x194);}return _0x21645f;};}function handleError(_0x5de322,_0x10c034){_0x10c034=_0x10c034||0x1f4;return function(_0x64e8c4){logger[_0x4260('0x23')](_0x64e8c4[_0x4260('0x24')]);if(_0x64e8c4[_0x4260('0x25')]){delete _0x64e8c4[_0x4260('0x25')];}_0x5de322[_0x4260('0x18')](_0x10c034)[_0x4260('0x26')](_0x64e8c4);};}exports['index']=function(_0x573be5,_0x596115){var _0x96ea33={},_0x28661b={},_0x371a5e={'count':0x0,'rows':[]};var _0x82f71f=_[_0x4260('0x27')](db[_0x4260('0x28')][_0x4260('0x29')],function(_0xe9c332){return{'name':_0xe9c332[_0x4260('0x2a')],'type':_0xe9c332[_0x4260('0x2b')]['key']};});_0x28661b[_0x4260('0x2c')]=_[_0x4260('0x27')](_0x82f71f,'name');_0x28661b[_0x4260('0x2d')]=_[_0x4260('0x2e')](_0x573be5['query']);_0x28661b[_0x4260('0x2f')]=_[_0x4260('0x30')](_0x28661b['model'],_0x28661b['query']);_0x96ea33[_0x4260('0x31')]=_['intersection'](_0x28661b[_0x4260('0x2c')],qs[_0x4260('0x32')](_0x573be5[_0x4260('0x2d')]['fields']));_0x96ea33[_0x4260('0x31')]=_0x96ea33[_0x4260('0x31')]['length']?_0x96ea33['attributes']:_0x28661b[_0x4260('0x2c')];if(!_0x573be5[_0x4260('0x2d')]['hasOwnProperty'](_0x4260('0x33'))){_0x96ea33[_0x4260('0x1d')]=qs[_0x4260('0x1d')](_0x573be5[_0x4260('0x2d')]['limit']);_0x96ea33[_0x4260('0x34')]=qs[_0x4260('0x34')](_0x573be5[_0x4260('0x2d')][_0x4260('0x34')]);}_0x96ea33[_0x4260('0x35')]=qs['sort'](_0x573be5['query']['sort']);_0x96ea33[_0x4260('0x36')]=qs[_0x4260('0x2f')](_['pick'](_0x573be5[_0x4260('0x2d')],_0x28661b[_0x4260('0x2f')]),_0x82f71f);if(_0x573be5[_0x4260('0x2d')][_0x4260('0x37')]){_0x96ea33[_0x4260('0x36')]=_[_0x4260('0x38')](_0x96ea33[_0x4260('0x36')],{'$or':_['map'](_0x82f71f,function(_0x5480b5){if(_0x5480b5[_0x4260('0x2b')]!==_0x4260('0x39')){var _0x30b3bb={};_0x30b3bb[_0x5480b5[_0x4260('0x25')]]={'$like':'%'+_0x573be5[_0x4260('0x2d')][_0x4260('0x37')]+'%'};return _0x30b3bb;}})});}_0x96ea33=_[_0x4260('0x38')]({},_0x96ea33,_0x573be5[_0x4260('0x3a')]);var _0xc4167={'where':_0x96ea33[_0x4260('0x36')]};return db[_0x4260('0x28')][_0x4260('0x1c')](_0xc4167)[_0x4260('0x21')](function(_0x129273){_0x371a5e['count']=_0x129273;if(_0x573be5['query'][_0x4260('0x3b')]){_0x96ea33['include']=[{'all':!![]}];}return db[_0x4260('0x28')][_0x4260('0x3c')](_0x96ea33);})[_0x4260('0x21')](function(_0x3a8cdc){_0x371a5e[_0x4260('0x3d')]=_0x3a8cdc;return _0x371a5e;})[_0x4260('0x21')](respondWithFilteredResult(_0x596115,_0x96ea33))[_0x4260('0x3e')](handleError(_0x596115,null));};exports[_0x4260('0x3f')]=function(_0x29e0e6,_0x4fd15c){var _0xa77072={'raw':!![],'where':{'id':_0x29e0e6['params']['id']}},_0x28ddfb={};_0x28ddfb['model']=_['keys'](db['Attachment'][_0x4260('0x29')]);_0x28ddfb[_0x4260('0x2d')]=_[_0x4260('0x2e')](_0x29e0e6[_0x4260('0x2d')]);_0x28ddfb[_0x4260('0x2f')]=_['intersection'](_0x28ddfb['model'],_0x28ddfb[_0x4260('0x2d')]);_0xa77072[_0x4260('0x31')]=_[_0x4260('0x30')](_0x28ddfb['model'],qs[_0x4260('0x32')](_0x29e0e6[_0x4260('0x2d')][_0x4260('0x32')]));_0xa77072[_0x4260('0x31')]=_0xa77072['attributes'][_0x4260('0x40')]?_0xa77072[_0x4260('0x31')]:_0x28ddfb['model'];if(_0x29e0e6[_0x4260('0x2d')]['includeAll']){_0xa77072[_0x4260('0x41')]=[{'all':!![]}];}_0xa77072=_[_0x4260('0x38')]({},_0xa77072,_0x29e0e6[_0x4260('0x3a')]);return db[_0x4260('0x28')][_0x4260('0x42')](_0xa77072)[_0x4260('0x21')](handleEntityNotFound(_0x4fd15c,null))['then'](respondWithResult(_0x4fd15c,null))[_0x4260('0x3e')](handleError(_0x4fd15c,null));};exports['clone']=function(_0x5b1890,_0x1802e4){var _0x137a61={'where':{'id':_0x5b1890['params']['id']}},_0x25ee05={};_0x25ee05[_0x4260('0x2c')]=_['keys'](db[_0x4260('0x28')]['rawAttributes']);_0x137a61['attributes']=_[_0x4260('0x30')](_0x25ee05[_0x4260('0x2c')],qs[_0x4260('0x32')](_0x5b1890['query'][_0x4260('0x32')]));_0x137a61['attributes']=_0x137a61[_0x4260('0x31')][_0x4260('0x40')]?_0x137a61[_0x4260('0x31')]:_0x25ee05['model'];if(_0x5b1890[_0x4260('0x2d')][_0x4260('0x3b')]){_0x137a61[_0x4260('0x41')]=[{'all':!![]}];}_0x137a61=_[_0x4260('0x38')]({},_0x137a61,_0x5b1890['options']);return db[_0x4260('0x28')][_0x4260('0x42')](_0x137a61)['then'](handleEntityNotFound(_0x1802e4,null))[_0x4260('0x21')](function(_0x79bfb3){if(_0x79bfb3){var _0x52ebe2=_0x79bfb3[_0x4260('0x43')]({'plain':!![]});_0x52ebe2=qs[_0x4260('0x44')](_0x52ebe2,['id',_0x4260('0x45'),_0x4260('0x46')]);_0x5b1890[_0x4260('0x47')]=_[_0x4260('0x44')](_0x5b1890[_0x4260('0x47')],['id',_0x4260('0x45'),_0x4260('0x46')]);return db[_0x4260('0x28')][_0x4260('0x48')](_[_0x4260('0x38')](_0x52ebe2,_0x5b1890['body']),{'include':_0x5b1890[_0x4260('0x2d')][_0x4260('0x3b')]?[{'all':!![]}]:undefined});}})[_0x4260('0x21')](respondWithResult(_0x1802e4,0xc9))['catch'](handleError(_0x1802e4,null));};exports[_0x4260('0x20')]=function(_0x3112fe,_0x23a1d5){if(_0x3112fe[_0x4260('0x47')]['id']){delete _0x3112fe[_0x4260('0x47')]['id'];}return db[_0x4260('0x28')]['find']({'where':{'id':_0x3112fe[_0x4260('0x49')]['id']}})[_0x4260('0x21')](handleEntityNotFound(_0x23a1d5,null))[_0x4260('0x21')](saveUpdates(_0x3112fe[_0x4260('0x47')],null))[_0x4260('0x21')](respondWithResult(_0x23a1d5,null))[_0x4260('0x3e')](handleError(_0x23a1d5,null));};exports[_0x4260('0x22')]=function(_0x5044dc,_0x3ea5e7){return db['Attachment']['find']({'where':{'id':_0x5044dc[_0x4260('0x49')]['id']}})['then'](handleEntityNotFound(_0x3ea5e7,null))['then'](removeEntity(_0x3ea5e7,null))[_0x4260('0x3e')](handleError(_0x3ea5e7,null));};exports[_0x4260('0x48')]=function(_0x168703,_0xb85c7c,_0x55de28){_0x168703[_0x4260('0x47')][_0x4260('0x25')]=_0x168703[_0x4260('0x4a')][_0x4260('0x4b')];_0x168703[_0x4260('0x47')][_0x4260('0x4c')]=_0x168703['file'][_0x4260('0x4d')];_0x168703[_0x4260('0x47')][_0x4260('0x2b')]=_0x168703[_0x4260('0x4a')][_0x4260('0x4e')];return db[_0x4260('0x28')][_0x4260('0x48')](_0x168703[_0x4260('0x47')])[_0x4260('0x21')](respondWithResult(_0xb85c7c,0xc9))['catch'](handleError(_0xb85c7c,null));};exports['download']=function(_0x2391c6,_0x3ecf3b,_0x31c375){return db['Attachment'][_0x4260('0x4f')]({'where':{'id':_0x2391c6[_0x4260('0x49')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3ecf3b,null))['then'](function(_0x281eab){if(_0x281eab){var _0x3039c9=_0x281eab[_0x4260('0x50')]!==null;var _0x2e62e5=path[_0x4260('0x51')](config['root'],_0x4260('0x52'));if(_0x3039c9){_0x2e62e5=path[_0x4260('0x51')](_0x2e62e5,_0x4260('0x53'));}var _0x234be6=path[_0x4260('0x51')](_0x2e62e5,_0x281eab['basename']);return _0x3ecf3b[_0x4260('0x54')](_0x234be6);}})[_0x4260('0x3e')](handleError(_0x3ecf3b,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index f8bf750..056289a 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 _0xed1a=['util','api','bluebird','path','rimraf','../../config/environment','./attachment.attributes','exports','attachments'];(function(_0x14bd3d,_0x4bd305){var _0x4fcf0b=function(_0x10d458){while(--_0x10d458){_0x14bd3d['push'](_0x14bd3d['shift']());}};_0x4fcf0b(++_0x4bd305);}(_0xed1a,0x120));var _0xaed1=function(_0x487605,_0x17306e){_0x487605=_0x487605-0x0;var _0x42c167=_0xed1a[_0x487605];return _0x42c167;};'use strict';var _=require('lodash');var util=require(_0xaed1('0x0'));var logger=require('../../config/logger')(_0xaed1('0x1'));var moment=require('moment');var BPromise=require(_0xaed1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaed1('0x3'));var rimraf=require(_0xaed1('0x4'));var config=require(_0xaed1('0x5'));var attributes=require(_0xaed1('0x6'));module[_0xaed1('0x7')]=function(_0x4ed7cd,_0x367b58){return _0x4ed7cd['define']('Attachment',attributes,{'tableName':_0xaed1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90aa=['./attachment.attributes','define','Attachment','attachments','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x461255,_0x3d5cf2){var _0x1eb484=function(_0x39e491){while(--_0x39e491){_0x461255['push'](_0x461255['shift']());}};_0x1eb484(++_0x3d5cf2);}(_0x90aa,0x117));var _0xa90a=function(_0x15cb1a,_0x33214b){_0x15cb1a=_0x15cb1a-0x0;var _0x3ef003=_0x90aa[_0x15cb1a];return _0x3ef003;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa90a('0x0'))('api');var moment=require(_0xa90a('0x1'));var BPromise=require(_0xa90a('0x2'));var rp=require(_0xa90a('0x3'));var fs=require('fs');var path=require(_0xa90a('0x4'));var rimraf=require(_0xa90a('0x5'));var config=require(_0xa90a('0x6'));var attributes=require(_0xa90a('0x7'));module['exports']=function(_0x1d183e,_0x2256ac){return _0x1d183e[_0xa90a('0x8')](_0xa90a('0x9'),attributes,{'tableName':_0xa90a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 67db326..bb7f98b 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 _0x5ff3=['http','request','then','info','request\x20sent','debug','stringify','error','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','Attachment','create','body','raw','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5ff3,0x17d));var _0x35ff=function(_0x51378e,_0x35e9bb){_0x51378e=_0x51378e-0x0;var _0x3ed8ff=_0x5ff3[_0x51378e];return _0x3ed8ff;};'use strict';var _=require('lodash');var util=require(_0x35ff('0x0'));var moment=require('moment');var BPromise=require(_0x35ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ff('0x2'));var db=require(_0x35ff('0x3'))['db'];var utils=require(_0x35ff('0x4'));var logger=require(_0x35ff('0x5'))('rpc');var config=require(_0x35ff('0x6'));var jayson=require(_0x35ff('0x7'));var client=jayson[_0x35ff('0x8')][_0x35ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30c3ff,_0x495c31,_0x92b403){return new BPromise(function(_0x4c9fab,_0x2e7470){return client[_0x35ff('0xa')](_0x30c3ff,_0x92b403)[_0x35ff('0xb')](function(_0x51967a){logger[_0x35ff('0xc')]('Attachment,\x20%s,\x20%s',_0x495c31,_0x35ff('0xd'));logger[_0x35ff('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x495c31,'request\x20sent',JSON[_0x35ff('0xf')](_0x51967a));if(_0x51967a['error']){if(_0x51967a['error']['code']===0x1f4){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);return _0x2e7470(_0x51967a['error'][_0x35ff('0x12')]);}logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x51967a['error'][_0x35ff('0x12')]);return _0x4c9fab(_0x51967a[_0x35ff('0x10')][_0x35ff('0x12')]);}else{logger[_0x35ff('0xc')](_0x35ff('0x11'),_0x495c31,_0x35ff('0xd'));_0x4c9fab(_0x51967a[_0x35ff('0x13')][_0x35ff('0x12')]);}})[_0x35ff('0x14')](function(_0x2f3456){logger[_0x35ff('0x10')](_0x35ff('0x11'),_0x495c31,_0x2f3456);_0x2e7470(_0x2f3456);});});}exports[_0x35ff('0x15')]=function(_0x16c803){var _0x186f6a=this;return new Promise(function(_0x5f470e,_0x2404e5){return db[_0x35ff('0x16')][_0x35ff('0x17')](_0x16c803[_0x35ff('0x18')],{'raw':_0x16c803['options']?_0x16c803['options'][_0x35ff('0x19')]===undefined?!![]:![]:!![]})[_0x35ff('0xb')](function(_0x4c8dd4){logger[_0x35ff('0xc')](_0x35ff('0x15'),_0x16c803);logger[_0x35ff('0xe')](_0x35ff('0x15'),_0x16c803,JSON['stringify'](_0x4c8dd4));_0x5f470e(_0x4c8dd4);})[_0x35ff('0x14')](function(_0x55274b){logger[_0x35ff('0x10')](_0x35ff('0x15'),_0x55274b[_0x35ff('0x12')],_0x16c803);_0x2404e5(_0x186f6a[_0x35ff('0x10')](0x1f4,_0x55274b[_0x35ff('0x12')]));});});}; \ No newline at end of file +var _0x8e0d=['CreateAttachment','Attachment','body','options','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','Attachment,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','catch'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x8e0d,0x82));var _0xd8e0=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x8e0d[_0x11a220];return _0x20d8fe;};'use strict';var _=require(_0xd8e0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd8e0('0x1'));var rs=require(_0xd8e0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8e0('0x3'))['db'];var utils=require(_0xd8e0('0x4'));var logger=require(_0xd8e0('0x5'))(_0xd8e0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8e0('0x7')][_0xd8e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42d42b,_0x1e4616,_0x5e9735){return new BPromise(function(_0xd0c45c,_0x144a8a){return client[_0xd8e0('0x9')](_0x42d42b,_0x5e9735)[_0xd8e0('0xa')](function(_0x127a32){logger['info'](_0xd8e0('0xb'),_0x1e4616,'request\x20sent');logger[_0xd8e0('0xc')]('Attachment,\x20%s,\x20%s,\x20%s',_0x1e4616,'request\x20sent',JSON[_0xd8e0('0xd')](_0x127a32));if(_0x127a32[_0xd8e0('0xe')]){if(_0x127a32[_0xd8e0('0xe')]['code']===0x1f4){logger['error'](_0xd8e0('0xb'),_0x1e4616,_0x127a32['error'][_0xd8e0('0xf')]);return _0x144a8a(_0x127a32['error']['message']);}logger['error'](_0xd8e0('0xb'),_0x1e4616,_0x127a32['error'][_0xd8e0('0xf')]);return _0xd0c45c(_0x127a32[_0xd8e0('0xe')][_0xd8e0('0xf')]);}else{logger[_0xd8e0('0x10')](_0xd8e0('0xb'),_0x1e4616,_0xd8e0('0x11'));_0xd0c45c(_0x127a32[_0xd8e0('0x12')][_0xd8e0('0xf')]);}})[_0xd8e0('0x13')](function(_0x488ed9){logger[_0xd8e0('0xe')](_0xd8e0('0xb'),_0x1e4616,_0x488ed9);_0x144a8a(_0x488ed9);});});}exports[_0xd8e0('0x14')]=function(_0x42586f){var _0x3b28bc=this;return new Promise(function(_0x2bf195,_0x2c4eaf){return db[_0xd8e0('0x15')]['create'](_0x42586f[_0xd8e0('0x16')],{'raw':_0x42586f[_0xd8e0('0x17')]?_0x42586f['options'][_0xd8e0('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x55ce9b){logger['info'](_0xd8e0('0x14'),_0x42586f);logger[_0xd8e0('0xc')]('CreateAttachment',_0x42586f,JSON[_0xd8e0('0xd')](_0x55ce9b));_0x2bf195(_0x55ce9b);})[_0xd8e0('0x13')](function(_0x1d31de){logger[_0xd8e0('0xe')](_0xd8e0('0x14'),_0x1d31de[_0xd8e0('0xf')],_0x42586f);_0x2c4eaf(_0x3b28bc['error'](0x1f4,_0x1d31de[_0xd8e0('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 6e69f99..a21da17 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x11c2f5,_0x46db98){var _0x43cd8e=function(_0x38e1b5){while(--_0x38e1b5){_0x11c2f5['push'](_0x11c2f5['shift']());}};_0x43cd8e(++_0x46db98);}(_0xb10b,0x12a));var _0xbb10=function(_0x362f6a,_0x3bd6b4){_0x362f6a=_0x362f6a-0x0;var _0x366640=_0xb10b[_0x362f6a];return _0x366640;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0x0b0e[_0x4b4f24];return _0x1c13d4;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 7266003..9cff820 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 _0xc855=['use','clientID','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','emails','value','user','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','clearBlockUser','getLicense','catch','lodash','passport-google-oauth20','../../components/auth/service','login','authenticate','google','profile','/login'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0xc855,0xe8));var _0x5c85=function(_0x4b79b9,_0x2bf955){_0x4b79b9=_0x4b79b9-0x0;var _0x126f9c=_0xc855[_0x4b79b9];return _0x126f9c;};'use strict';var _=require(_0x5c85('0x0'));var passport=require('passport');var GoogleStrategy=require(_0x5c85('0x1'))['Strategy'];var moment=require('moment');var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var signToken=require(_0x5c85('0x2'))['signToken'];var utils=require('../../config/utils');exports[_0x5c85('0x3')]=passport[_0x5c85('0x4')](_0x5c85('0x5'),{'failureRedirect':'/login','scope':[_0x5c85('0x6'),'email'],'session':![]});exports['callback']=passport[_0x5c85('0x4')](_0x5c85('0x5'),{'failureRedirect':_0x5c85('0x7'),'session':![]});passport[_0x5c85('0x8')](new GoogleStrategy({'clientID':config[_0x5c85('0x5')]?config[_0x5c85('0x5')][_0x5c85('0x9')]:'id','clientSecret':config[_0x5c85('0x5')]?config[_0x5c85('0x5')]['clientSecret']:_0x5c85('0xa'),'callbackURL':config['google']?config[_0x5c85('0x5')][_0x5c85('0xb')]:''},function(_0x313b2a,_0x3e32f5,_0x2dfa87,_0x1ed499){var _0x28617c,_0x504098;return db['Setting'][_0x5c85('0xc')]({'where':{'id':0x1},'attributes':[_0x5c85('0xd'),_0x5c85('0xe')],'raw':!![]})[_0x5c85('0xf')](function(_0x526aa8){_0x28617c=_0x526aa8;return db[_0x5c85('0x10')][_0x5c85('0x11')]({'where':{'email':_[_0x5c85('0x12')](_0x2dfa87[_0x5c85('0x13')],_0x5c85('0x14')),'role':{'$or':['admin',_0x5c85('0x15'),'agent']}}});})['then'](function(_0x56f0e3){_0x504098=_0x56f0e3;if(_0x504098){if(_0x504098[_0x5c85('0x16')]){return _0x1ed499(_0x5c85('0x17'));}else if(_0x28617c['blockDuration']>0x0){if(_0x504098[_0x5c85('0x18')]){if(moment(_0x504098[_0x5c85('0x19')])[_0x5c85('0x1a')](_0x28617c[_0x5c85('0xe')],'minutes')>moment()){return _0x1ed499(_0x5c85('0x17'));}else{return utils[_0x5c85('0x1b')](_0x504098,0x0,![],null)[_0x5c85('0xf')](function(){return utils[_0x5c85('0x1c')](_0x504098);})[_0x5c85('0xf')](function(){return _0x1ed499(null,_0x504098);});}}else{return utils[_0x5c85('0x1c')](_0x504098)[_0x5c85('0xf')](function(){return _0x1ed499(null,_0x504098);});}}else{return utils[_0x5c85('0x1c')](_0x504098)[_0x5c85('0xf')](function(){return _0x1ed499(null,_0x504098);});}}return _0x1ed499(_0x5c85('0x17'));})[_0x5c85('0x1d')](function(_0x449400){_0x1ed499(_0x449400);});})); \ No newline at end of file +var _0xd644=['clearBlockUser','getLicense','lodash','moment','../../mysqldb','../../config/environment','/login','profile','email','callback','google','use','clientID','clientSecret','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','emails','value','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','minutes'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xd644,0x157));var _0x4d64=function(_0x2017fe,_0x4e8fa6){_0x2017fe=_0x2017fe-0x0;var _0x2eb2da=_0xd644[_0x2017fe];return _0x2eb2da;};'use strict';var _=require(_0x4d64('0x0'));var passport=require('passport');var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var moment=require(_0x4d64('0x1'));var db=require(_0x4d64('0x2'))['db'];var config=require(_0x4d64('0x3'));var signToken=require('../../components/auth/service')['signToken'];var utils=require('../../config/utils');exports['login']=passport['authenticate']('google',{'failureRedirect':_0x4d64('0x4'),'scope':[_0x4d64('0x5'),_0x4d64('0x6')],'session':![]});exports[_0x4d64('0x7')]=passport['authenticate'](_0x4d64('0x8'),{'failureRedirect':_0x4d64('0x4'),'session':![]});passport[_0x4d64('0x9')](new GoogleStrategy({'clientID':config[_0x4d64('0x8')]?config[_0x4d64('0x8')][_0x4d64('0xa')]:'id','clientSecret':config[_0x4d64('0x8')]?config['google'][_0x4d64('0xb')]:_0x4d64('0xc'),'callbackURL':config[_0x4d64('0x8')]?config[_0x4d64('0x8')][_0x4d64('0xd')]:''},function(_0xcbcec,_0x38b8e9,_0x356ad1,_0x2ebb88){var _0x5b0d61,_0x48d0c4;return db['Setting'][_0x4d64('0xe')]({'where':{'id':0x1},'attributes':[_0x4d64('0xf'),_0x4d64('0x10')],'raw':!![]})[_0x4d64('0x11')](function(_0x1d7a8b){_0x5b0d61=_0x1d7a8b;return db[_0x4d64('0x12')][_0x4d64('0x13')]({'where':{'email':_[_0x4d64('0x14')](_0x356ad1[_0x4d64('0x15')],_0x4d64('0x16')),'role':{'$or':['admin','user',_0x4d64('0x17')]}}});})['then'](function(_0xcee339){_0x48d0c4=_0xcee339;if(_0x48d0c4){if(_0x48d0c4[_0x4d64('0x18')]){return _0x2ebb88(_0x4d64('0x19'));}else if(_0x5b0d61[_0x4d64('0x10')]>0x0){if(_0x48d0c4[_0x4d64('0x1a')]){if(moment(_0x48d0c4[_0x4d64('0x1b')])['add'](_0x5b0d61['blockDuration'],_0x4d64('0x1c'))>moment()){return _0x2ebb88('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x4d64('0x1d')](_0x48d0c4,0x0,![],null)['then'](function(){return utils[_0x4d64('0x1e')](_0x48d0c4);})[_0x4d64('0x11')](function(){return _0x2ebb88(null,_0x48d0c4);});}}else{return utils[_0x4d64('0x1e')](_0x48d0c4)[_0x4d64('0x11')](function(){return _0x2ebb88(null,_0x48d0c4);});}}else{return utils[_0x4d64('0x1e')](_0x48d0c4)['then'](function(){return _0x2ebb88(null,_0x48d0c4);});}}return _0x2ebb88(_0x4d64('0x19'));})['catch'](function(_0x1a47a3){_0x2ebb88(_0x1a47a3);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 13fabb3..cf8e64e 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 _0x4965=['exports','express','passport','Router','../user/user.controller.js','get','login','callback','isMiddleware'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0x4965,0x10f));var _0x5496=function(_0x596284,_0x1cd02b){_0x596284=_0x596284-0x0;var _0x5313c6=_0x4965[_0x596284];return _0x5313c6;};'use strict';var express=require(_0x5496('0x0'));var passport=require(_0x5496('0x1'));var router=express[_0x5496('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x5496('0x3'));var authService=require('../../components/auth/service');router[_0x5496('0x4')]('/',controller[_0x5496('0x5')]);router[_0x5496('0x4')]('/callback',controller[_0x5496('0x6')],authService[_0x5496('0x7')],userController['login'],authService['setTokenCookie']);module[_0x5496('0x8')]=router; \ No newline at end of file +var _0x4243=['/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','./authGoogle.controller','../user/user.controller.js','get','login'];(function(_0x52a86d,_0x1cc564){var _0x40734a=function(_0x5ae768){while(--_0x5ae768){_0x52a86d['push'](_0x52a86d['shift']());}};_0x40734a(++_0x1cc564);}(_0x4243,0x170));var _0x3424=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4243[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x3424('0x0'));var passport=require(_0x3424('0x1'));var router=express['Router']();var controller=require(_0x3424('0x2'));var userController=require(_0x3424('0x3'));var authService=require('../../components/auth/service');router[_0x3424('0x4')]('/',controller[_0x3424('0x5')]);router[_0x3424('0x4')](_0x3424('0x6'),controller[_0x3424('0x7')],authService[_0x3424('0x8')],userController[_0x3424('0x5')],authService[_0x3424('0x9')]);module[_0x3424('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 6593e8d..85f858a 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 _0xea30=['Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','resetPasswordToken','Password\x20reset!','use','Strategy','jayson/promise','randomstring','../../components/auth/service','../../config/utils','client','http','Setting','findOne','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','add','minutes','clearBlockUser','allowedLoginAttempts','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','error','status','send','login','local'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xea30,0x183));var _0x0ea3=function(_0x5a970c,_0x383d98){_0x5a970c=_0x5a970c-0x0;var _0x467c58=_0xea30[_0x5a970c];return _0x467c58;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require('passport-local')[_0x0ea3('0x0')];var jayson=require(_0x0ea3('0x1'));var _=require('lodash');var rs=require(_0x0ea3('0x2'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x0ea3('0x3'));var utils=require(_0x0ea3('0x4'));var client=jayson[_0x0ea3('0x5')][_0x0ea3('0x6')]({'port':0x232b});function localAuthenticate(_0x3b25f8,_0x114af0,_0x433a29,_0x23e8c3){var _0x1b412f,_0xe1d867;return db[_0x0ea3('0x7')][_0x0ea3('0x8')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x0ea3('0x9')],'raw':!![]})[_0x0ea3('0xa')](function(_0x3dc33b){_0x1b412f=_0x3dc33b;return _0x3b25f8[_0x0ea3('0x8')]({'attributes':['id',_0x0ea3('0xb'),_0x0ea3('0xc'),_0x0ea3('0xd'),_0x0ea3('0xe'),_0x0ea3('0xf'),_0x0ea3('0x10'),_0x0ea3('0x11'),'loginAttempts'],'where':{'name':_0x114af0,'role':{'$or':[_0x0ea3('0x12'),_0x0ea3('0x13'),_0x0ea3('0x14')]}}});})[_0x0ea3('0xa')](function(_0x3d67b2){if(!_0x3d67b2||_0x3d67b2&&_0x3d67b2[_0x0ea3('0xb')]!==_0x114af0){throw new Error(_0x0ea3('0x15'));}else{_0xe1d867=_0x3d67b2;return _0xe1d867;}})[_0x0ea3('0xa')](function(){_0xe1d867[_0x0ea3('0x16')](_0x433a29,function(_0x489ad1,_0x2b36e4){var _0x39e484=_0xe1d867[_0x0ea3('0x17')]+0x1;if(_0x489ad1){return _0x23e8c3(_0x489ad1);}else if(!_0x2b36e4){if(_0xe1d867[_0x0ea3('0xf')]){return _0x23e8c3(null,![],{'message':_0x0ea3('0x15')});}else if(_0x1b412f['allowedLoginAttempts']>0x0){if(_0xe1d867[_0x0ea3('0x10')]){if(_0x1b412f[_0x0ea3('0x9')]>0x0){if(moment(_0xe1d867[_0x0ea3('0x11')])[_0x0ea3('0x18')](_0x1b412f['blockDuration'],_0x0ea3('0x19'))>moment()){return _0x23e8c3(null,![],{'message':_0x0ea3('0x15')});}else{return utils[_0x0ea3('0x1a')](_0xe1d867,_0x39e484,![],null)[_0x0ea3('0xa')](function(){return _0x23e8c3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x23e8c3(null,![],{'message':_0x0ea3('0x15')});}}else{if(_0x39e484>=_0x1b412f[_0x0ea3('0x1b')]){return utils[_0x0ea3('0x1a')](_0xe1d867,0x0,!![],moment())['then'](function(){return _0x23e8c3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x0ea3('0x1a')](_0xe1d867,_0x39e484,![],null)[_0x0ea3('0xa')](function(){return _0x23e8c3(null,![],{'message':_0x0ea3('0x15')});});}}}else{return _0x23e8c3(null,![],{'message':_0x0ea3('0x15')});}}else{if(_0xe1d867[_0x0ea3('0xf')]){return _0x23e8c3(null,![],{'message':_0x0ea3('0x15')});}else if(_0x1b412f[_0x0ea3('0x1b')]>0x0){if(_0xe1d867[_0x0ea3('0x10')]){if(_0x1b412f[_0x0ea3('0x9')]>0x0){if(moment(_0xe1d867['blockedAt'])[_0x0ea3('0x18')](_0x1b412f[_0x0ea3('0x9')],_0x0ea3('0x19'))>moment()){return _0x23e8c3(null,![],{'message':_0x0ea3('0x15')});}else{return utils[_0x0ea3('0x1a')](_0xe1d867,0x0,![],null)[_0x0ea3('0xa')](function(){return utils[_0x0ea3('0x1c')](_0xe1d867);})[_0x0ea3('0xa')](function(){return _0x23e8c3(null,_0xe1d867);});}}else{return _0x23e8c3(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x0ea3('0x1a')](_0xe1d867,0x0,![],null)[_0x0ea3('0xa')](function(){return utils['getLicense'](_0xe1d867);})[_0x0ea3('0xa')](function(){return _0x23e8c3(null,_0xe1d867);})[_0x0ea3('0x1d')](function(_0x4d0bfb){return _0x23e8c3(null,![],_0x4d0bfb);});}}else{if(_0xe1d867[_0x0ea3('0x10')]){return _0x23e8c3(null,![],{'message':_0x0ea3('0x15')});}else{return utils[_0x0ea3('0x1c')](_0xe1d867)[_0x0ea3('0xa')](function(){return _0x23e8c3(null,_0xe1d867);});}}}});})[_0x0ea3('0x1d')](function(_0x59923b){return _0x23e8c3(null,![],_0x59923b);});}function sendServiceMail(_0x28afd9){return db[_0x0ea3('0x1e')][_0x0ea3('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x0ea3('0xb'),_0x0ea3('0x20')],'include':[{'model':db[_0x0ea3('0x21')],'as':_0x0ea3('0x22')}]})[_0x0ea3('0xa')](function(_0x34317b){if(!_0x34317b){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x2ba9c4={'tls':{'rejectUnauthorized':![]}};if(_0x34317b[_0x0ea3('0x22')][_0x0ea3('0x23')]){_0x2ba9c4[_0x0ea3('0x23')]=_0x34317b['Smtp'][_0x0ea3('0x23')];}else{_0x2ba9c4[_0x0ea3('0x24')]=_0x34317b[_0x0ea3('0x22')]['host'];_0x2ba9c4[_0x0ea3('0x25')]=_0x34317b[_0x0ea3('0x22')]['port'];_0x2ba9c4['secure']=_0x34317b[_0x0ea3('0x22')][_0x0ea3('0x26')];}if(_0x34317b[_0x0ea3('0x22')][_0x0ea3('0x27')]){_0x2ba9c4[_0x0ea3('0x28')]={'user':_0x34317b[_0x0ea3('0x22')]['user'],'pass':_0x34317b[_0x0ea3('0x22')][_0x0ea3('0x29')]};}var _0x3de43a={'account':_0x2ba9c4,'message':_['merge']({'from':util[_0x0ea3('0x2a')](_0x0ea3('0x2b'),_0x34317b[_0x0ea3('0xb')],_0x34317b[_0x0ea3('0x20')]||_0x34317b[_0x0ea3('0x22')][_0x0ea3('0x13')])},_0x28afd9)};return client['request'](_0x0ea3('0x2c'),_0x3de43a);})[_0x0ea3('0xa')](function(_0x56d3b2){if(_0x56d3b2['error']){throw new Error(util['format'](_0x0ea3('0x2d'),_0x56d3b2['error'][_0x0ea3('0x2e')]||JSON[_0x0ea3('0x2f')](_0x56d3b2[_0x0ea3('0x30')])));}return!![];});}function handleError(_0xbf49de,_0x473bd0,_0x76658b){return _0xbf49de[_0x0ea3('0x31')](_0x473bd0||0x1f4)[_0x0ea3('0x32')]({'message':_0x76658b?_0x76658b[_0x0ea3('0x2e')]||_0x76658b:''});}exports[_0x0ea3('0x33')]=function(_0xe88f74,_0x310bf7,_0x141d06){passport[_0x0ea3('0x16')](_0x0ea3('0x34'),function(_0x417b56,_0x55f05e,_0x47e838){var _0x1c4d11=_0x417b56||_0x47e838;if(_0x1c4d11){return handleError(_0x310bf7,0x191,_0x1c4d11);}if(!_0x55f05e){return handleError(_0x310bf7,0x194,{'message':_0x0ea3('0x35')});}else{var _0x47841b={'payload':{'id':_0x55f05e['id'],'role':_0x55f05e[_0x0ea3('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0x0ea3('0x36')](_0x47841b)[_0x0ea3('0xa')](function(_0x26815d){_0x310bf7[_0x0ea3('0x37')]({'id':_0x55f05e['id'],'token':_0x26815d,'statusCall':'','isAlreadyLogged':_0x55f05e[_0x0ea3('0x38')]});});}})(_0xe88f74,_0x310bf7,_0x141d06);};exports[_0x0ea3('0x39')]=function(_0x448bcb,_0x18d8be,_0x4f013f){if(!_0x448bcb['body']['email']){return handleError(_0x18d8be,0x1f4,{'message':_0x0ea3('0x3a')});}var _0x564dd1=rs[_0x0ea3('0x3b')]();_0x448bcb[_0x0ea3('0x3c')]['email']=_0x448bcb['body']['email'][_0x0ea3('0x3d')]()[_0x0ea3('0x3e')]();var _0x26d551;return db[_0x0ea3('0x7')][_0x0ea3('0x8')]({'where':{'id':0x1},'attributes':[_0x0ea3('0x1b'),_0x0ea3('0x9')],'raw':!![]})['then'](function(_0x28e647){_0x26d551=_0x28e647;return db[_0x0ea3('0x3f')][_0x0ea3('0x1f')]({'where':{'email':_0x448bcb[_0x0ea3('0x3c')][_0x0ea3('0x20')]}});})[_0x0ea3('0xa')](function(_0x594334){if(!_0x594334){throw new Error(_0x0ea3('0x40'));}if(_0x594334['disabled']){throw new Error(_0x0ea3('0x41'));}if(_0x594334['blocked']){if(moment(_0x594334['blockedAt'])['add'](_0x26d551['blockDuration'],'minutes')>moment()){throw new Error(_0x0ea3('0x42'));}else{_0x594334[_0x0ea3('0x10')]=![];_0x594334[_0x0ea3('0x11')]=null;}}_0x594334['resetPasswordToken']=_0x564dd1;_0x594334[_0x0ea3('0x43')]=Date[_0x0ea3('0x44')]()+0x36ee80;return _0x594334['save']();})[_0x0ea3('0xa')](function(){return sendServiceMail({'to':_0x448bcb[_0x0ea3('0x3c')][_0x0ea3('0x20')],'subject':_0x0ea3('0x45'),'text':_0x0ea3('0x46')+_0x0ea3('0x47')+_0x0ea3('0x48')+_0x448bcb[_0x0ea3('0x49')][_0x0ea3('0x24')]+_0x0ea3('0x4a')+_0x564dd1+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x0ea3('0xa')](function(){_0x18d8be[_0x0ea3('0x31')](0xc8)['send']({'message':_0x0ea3('0x4b')});})[_0x0ea3('0x1d')](function(_0x349777){return handleError(_0x18d8be,0x1f4,_0x349777);});};exports[_0x0ea3('0x4c')]=function(_0x14f972,_0x21ecf1,_0x5c9140){return db[_0x0ea3('0x3f')][_0x0ea3('0x1f')]({'where':{'resetPasswordToken':_0x14f972[_0x0ea3('0x4d')][_0x0ea3('0x4e')],'resetPasswordExpires':{'$gt':Date[_0x0ea3('0x44')]()}}})['then'](function(_0x5145c9){if(!_0x5145c9){throw new Error(_0x0ea3('0x4f'));}return db[_0x0ea3('0x7')]['findOne']({'attributes':['id',_0x0ea3('0x50'),'enforcePasswordHistory',_0x0ea3('0x51')]})[_0x0ea3('0xa')](function(_0x16d18e){if(_0x16d18e[_0x0ea3('0x50')])authService[_0x0ea3('0x52')](_0x14f972['body'][_0x0ea3('0xc')]);if(!_0x16d18e[_0x0ea3('0x53')]||!_0x5145c9[_0x0ea3('0x54')])return _0x5145c9;authService['validatePasswordHistory'](_0x14f972[_0x0ea3('0x3c')][_0x0ea3('0xc')],_0x5145c9[_0x0ea3('0x54')],_0x16d18e[_0x0ea3('0x51')]);return _0x5145c9;})[_0x0ea3('0xa')](function(){_0x5145c9[_0x0ea3('0xc')]=_0x14f972[_0x0ea3('0x3c')][_0x0ea3('0xc')];_0x5145c9[_0x0ea3('0x55')]=null;_0x5145c9['resetPasswordExpires']=null;return _0x5145c9['save']();});})[_0x0ea3('0xa')](function(){_0x21ecf1[_0x0ea3('0x31')](0xc8)['send']({'message':_0x0ea3('0x56')});})[_0x0ea3('0x1d')](function(_0x13612a){return handleError(_0x21ecf1,0x1f4,_0x13612a);});};passport[_0x0ea3('0x57')](new LocalStrategy({'usernameField':'name','passwordField':_0x0ea3('0xc')},function(_0x489a1e,_0xf60d62,_0x4cb8b6){return localAuthenticate(db[_0x0ea3('0x3f')],_0x489a1e,_0xf60d62,_0x4cb8b6);})); \ No newline at end of file +var _0x0373=['The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','resetPasswordToken','resetPasswordExpires','Password\x20reset!','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../components/auth/service','../../config/utils','client','http','allowedLoginAttempts','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','message','login','authenticate','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','findOne','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.'];(function(_0x57ac3b,_0x32e884){var _0x4204c9=function(_0x54a70e){while(--_0x54a70e){_0x57ac3b['push'](_0x57ac3b['shift']());}};_0x4204c9(++_0x32e884);}(_0x0373,0x1c2));var _0x3037=function(_0x1fd9e7,_0x24cdbe){_0x1fd9e7=_0x1fd9e7-0x0;var _0x1781f2=_0x0373[_0x1fd9e7];return _0x1781f2;};'use strict';var util=require(_0x3037('0x0'));var passport=require(_0x3037('0x1'));var LocalStrategy=require(_0x3037('0x2'))[_0x3037('0x3')];var jayson=require(_0x3037('0x4'));var _=require(_0x3037('0x5'));var rs=require(_0x3037('0x6'));var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0x3037('0x7'));var utils=require(_0x3037('0x8'));var client=jayson[_0x3037('0x9')][_0x3037('0xa')]({'port':0x232b});function localAuthenticate(_0x59fdcf,_0x1795c8,_0x3a82ba,_0x170fb5){var _0x133da9,_0xd277ba;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x3037('0xb'),'blockDuration'],'raw':!![]})['then'](function(_0x2b163a){_0x133da9=_0x2b163a;return _0x59fdcf['findOne']({'attributes':['id',_0x3037('0xc'),_0x3037('0xd'),_0x3037('0xe'),_0x3037('0xf'),_0x3037('0x10'),_0x3037('0x11'),_0x3037('0x12'),_0x3037('0x13')],'where':{'name':_0x1795c8,'role':{'$or':[_0x3037('0x14'),_0x3037('0x15'),_0x3037('0x16')]}}});})[_0x3037('0x17')](function(_0x2eca38){if(!_0x2eca38||_0x2eca38&&_0x2eca38['name']!==_0x1795c8){throw new Error(_0x3037('0x18'));}else{_0xd277ba=_0x2eca38;return _0xd277ba;}})[_0x3037('0x17')](function(){_0xd277ba['authenticate'](_0x3a82ba,function(_0x122a37,_0x490804){var _0x151da7=_0xd277ba[_0x3037('0x13')]+0x1;if(_0x122a37){return _0x170fb5(_0x122a37);}else if(!_0x490804){if(_0xd277ba[_0x3037('0x10')]){return _0x170fb5(null,![],{'message':_0x3037('0x18')});}else if(_0x133da9[_0x3037('0xb')]>0x0){if(_0xd277ba[_0x3037('0x11')]){if(_0x133da9[_0x3037('0x19')]>0x0){if(moment(_0xd277ba['blockedAt'])[_0x3037('0x1a')](_0x133da9[_0x3037('0x19')],_0x3037('0x1b'))>moment()){return _0x170fb5(null,![],{'message':_0x3037('0x18')});}else{return utils[_0x3037('0x1c')](_0xd277ba,_0x151da7,![],null)[_0x3037('0x17')](function(){return _0x170fb5(null,![],{'message':_0x3037('0x18')});});}}else{return _0x170fb5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x151da7>=_0x133da9['allowedLoginAttempts']){return utils[_0x3037('0x1c')](_0xd277ba,0x0,!![],moment())[_0x3037('0x17')](function(){return _0x170fb5(null,![],{'message':_0x3037('0x18')});});}else{return utils[_0x3037('0x1c')](_0xd277ba,_0x151da7,![],null)[_0x3037('0x17')](function(){return _0x170fb5(null,![],{'message':_0x3037('0x18')});});}}}else{return _0x170fb5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xd277ba['disabled']){return _0x170fb5(null,![],{'message':_0x3037('0x18')});}else if(_0x133da9[_0x3037('0xb')]>0x0){if(_0xd277ba[_0x3037('0x11')]){if(_0x133da9[_0x3037('0x19')]>0x0){if(moment(_0xd277ba[_0x3037('0x12')])[_0x3037('0x1a')](_0x133da9[_0x3037('0x19')],_0x3037('0x1b'))>moment()){return _0x170fb5(null,![],{'message':_0x3037('0x18')});}else{return utils[_0x3037('0x1c')](_0xd277ba,0x0,![],null)['then'](function(){return utils[_0x3037('0x1d')](_0xd277ba);})[_0x3037('0x17')](function(){return _0x170fb5(null,_0xd277ba);});}}else{return _0x170fb5(null,![],{'message':_0x3037('0x18')});}}else{return utils[_0x3037('0x1c')](_0xd277ba,0x0,![],null)[_0x3037('0x17')](function(){return utils[_0x3037('0x1d')](_0xd277ba);})[_0x3037('0x17')](function(){return _0x170fb5(null,_0xd277ba);})['catch'](function(_0x11fcb8){return _0x170fb5(null,![],_0x11fcb8);});}}else{if(_0xd277ba[_0x3037('0x11')]){return _0x170fb5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x3037('0x1d')](_0xd277ba)[_0x3037('0x17')](function(){return _0x170fb5(null,_0xd277ba);});}}}});})[_0x3037('0x1e')](function(_0x38d16d){return _0x170fb5(null,![],_0x38d16d);});}function sendServiceMail(_0x409ac2){return db[_0x3037('0x1f')][_0x3037('0x20')]({'where':{'service':!![]},'attributes':['id',_0x3037('0xc'),_0x3037('0x21')],'include':[{'model':db[_0x3037('0x22')],'as':'Smtp'}]})[_0x3037('0x17')](function(_0x40eda3){if(!_0x40eda3){throw new Error(_0x3037('0x23'));}var _0x1b788e={'tls':{'rejectUnauthorized':![]}};if(_0x40eda3[_0x3037('0x24')][_0x3037('0x25')]){_0x1b788e[_0x3037('0x25')]=_0x40eda3[_0x3037('0x24')][_0x3037('0x25')];}else{_0x1b788e[_0x3037('0x26')]=_0x40eda3[_0x3037('0x24')][_0x3037('0x26')];_0x1b788e['port']=_0x40eda3[_0x3037('0x24')][_0x3037('0x27')];_0x1b788e[_0x3037('0x28')]=_0x40eda3[_0x3037('0x24')]['secure'];}if(_0x40eda3[_0x3037('0x24')]['authentication']){_0x1b788e['auth']={'user':_0x40eda3['Smtp'][_0x3037('0x15')],'pass':_0x40eda3[_0x3037('0x24')]['pass']};}var _0x20faf4={'account':_0x1b788e,'message':_[_0x3037('0x29')]({'from':util['format'](_0x3037('0x2a'),_0x40eda3[_0x3037('0xc')],_0x40eda3['email']||_0x40eda3[_0x3037('0x24')][_0x3037('0x15')])},_0x409ac2)};return client[_0x3037('0x2b')](_0x3037('0x2c'),_0x20faf4);})[_0x3037('0x17')](function(_0x46f810){if(_0x46f810[_0x3037('0x2d')]){throw new Error(util[_0x3037('0x2e')](_0x3037('0x2f'),_0x46f810[_0x3037('0x2d')]['message']||JSON[_0x3037('0x30')](_0x46f810[_0x3037('0x2d')])));}return!![];});}function handleError(_0x33eab5,_0x10c525,_0xeb642b){return _0x33eab5[_0x3037('0x31')](_0x10c525||0x1f4)[_0x3037('0x32')]({'message':_0xeb642b?_0xeb642b[_0x3037('0x33')]||_0xeb642b:''});}exports[_0x3037('0x34')]=function(_0x58b503,_0x3c2da8,_0x34d16c){passport[_0x3037('0x35')]('local',function(_0x38774,_0x223277,_0xea8178){var _0x134f44=_0x38774||_0xea8178;if(_0x134f44){return handleError(_0x3c2da8,0x191,_0x134f44);}if(!_0x223277){return handleError(_0x3c2da8,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x4ee432={'payload':{'id':_0x223277['id'],'role':_0x223277['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4ee432)[_0x3037('0x17')](function(_0x1a2dc8){_0x3c2da8['json']({'id':_0x223277['id'],'token':_0x1a2dc8,'statusCall':'','isAlreadyLogged':_0x223277[_0x3037('0x36')]});});}})(_0x58b503,_0x3c2da8,_0x34d16c);};exports[_0x3037('0x37')]=function(_0x333fc8,_0x18176e,_0x382924){if(!_0x333fc8[_0x3037('0x38')][_0x3037('0x21')]){return handleError(_0x18176e,0x1f4,{'message':_0x3037('0x39')});}var _0xd65595=rs[_0x3037('0x3a')]();_0x333fc8[_0x3037('0x38')]['email']=_0x333fc8['body'][_0x3037('0x21')][_0x3037('0x3b')]()[_0x3037('0x3c')]();var _0x49541d;return db[_0x3037('0x3d')][_0x3037('0x3e')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x3037('0x17')](function(_0x38f927){_0x49541d=_0x38f927;return db[_0x3037('0x3f')][_0x3037('0x20')]({'where':{'email':_0x333fc8[_0x3037('0x38')][_0x3037('0x21')]}});})[_0x3037('0x17')](function(_0x9f704f){if(!_0x9f704f){throw new Error(_0x3037('0x40'));}if(_0x9f704f['disabled']){throw new Error(_0x3037('0x41'));}if(_0x9f704f[_0x3037('0x11')]){if(moment(_0x9f704f[_0x3037('0x12')])[_0x3037('0x1a')](_0x49541d[_0x3037('0x19')],_0x3037('0x1b'))>moment()){throw new Error(_0x3037('0x42'));}else{_0x9f704f[_0x3037('0x11')]=![];_0x9f704f[_0x3037('0x12')]=null;}}_0x9f704f['resetPasswordToken']=_0xd65595;_0x9f704f['resetPasswordExpires']=Date[_0x3037('0x43')]()+0x36ee80;return _0x9f704f[_0x3037('0x44')]();})['then'](function(){return sendServiceMail({'to':_0x333fc8['body']['email'],'subject':_0x3037('0x45'),'text':_0x3037('0x46')+_0x3037('0x47')+'https://'+_0x333fc8['headers'][_0x3037('0x26')]+_0x3037('0x48')+_0xd65595+'\x0a\x0a'+_0x3037('0x49')});})[_0x3037('0x17')](function(){_0x18176e[_0x3037('0x31')](0xc8)[_0x3037('0x32')]({'message':_0x3037('0x4a')});})[_0x3037('0x1e')](function(_0x8116e8){return handleError(_0x18176e,0x1f4,_0x8116e8);});};exports[_0x3037('0x4b')]=function(_0x3dbc47,_0x567a45,_0x4c2da4){return db[_0x3037('0x3f')][_0x3037('0x20')]({'where':{'resetPasswordToken':_0x3dbc47[_0x3037('0x4c')][_0x3037('0x4d')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x3037('0x17')](function(_0xb4762e){if(!_0xb4762e){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting']['findOne']({'attributes':['id',_0x3037('0x4e'),_0x3037('0x4f'),_0x3037('0x50')]})[_0x3037('0x17')](function(_0x5b2aaa){if(_0x5b2aaa[_0x3037('0x4e')])authService[_0x3037('0x51')](_0x3dbc47[_0x3037('0x38')][_0x3037('0xd')]);if(!_0x5b2aaa[_0x3037('0x4f')]||!_0xb4762e[_0x3037('0x52')])return _0xb4762e;authService['validatePasswordHistory'](_0x3dbc47[_0x3037('0x38')][_0x3037('0xd')],_0xb4762e['previousPasswords'],_0x5b2aaa['passwordHistoryLimit']);return _0xb4762e;})[_0x3037('0x17')](function(){_0xb4762e[_0x3037('0xd')]=_0x3dbc47[_0x3037('0x38')][_0x3037('0xd')];_0xb4762e[_0x3037('0x53')]=null;_0xb4762e[_0x3037('0x54')]=null;return _0xb4762e[_0x3037('0x44')]();});})[_0x3037('0x17')](function(){_0x567a45[_0x3037('0x31')](0xc8)[_0x3037('0x32')]({'message':_0x3037('0x55')});})[_0x3037('0x1e')](function(_0x830949){return handleError(_0x567a45,0x1f4,_0x830949);});};passport['use'](new LocalStrategy({'usernameField':_0x3037('0xc'),'passwordField':_0x3037('0xd')},function(_0x709057,_0x525399,_0x49ba3a){return localAuthenticate(db['User'],_0x709057,_0x525399,_0x49ba3a);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 0642e68..425dc86 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 _0x46bb=['forgot','reset','exports','express','Router','./authLocal.controller','login','post','/forgot'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x46bb,0x1aa));var _0xb46b=function(_0x505684,_0x2c1dc9){_0x505684=_0x505684-0x0;var _0x4389b0=_0x46bb[_0x505684];return _0x4389b0;};'use strict';var express=require(_0xb46b('0x0'));var router=express[_0xb46b('0x1')]();var controller=require(_0xb46b('0x2'));router['post']('/',controller[_0xb46b('0x3')]);router[_0xb46b('0x4')](_0xb46b('0x5'),controller[_0xb46b('0x6')]);router['post']('/reset/:token',controller[_0xb46b('0x7')]);module[_0xb46b('0x8')]=router; \ No newline at end of file +var _0xb686=['post','login','/forgot','forgot','/reset/:token','exports','express','Router'];(function(_0x1f4289,_0x5a908a){var _0x517c5c=function(_0xba8976){while(--_0xba8976){_0x1f4289['push'](_0x1f4289['shift']());}};_0x517c5c(++_0x5a908a);}(_0xb686,0xfe));var _0x6b68=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xb686[_0x5ddb1c];return _0x354adc;};'use strict';var express=require(_0x6b68('0x0'));var router=express[_0x6b68('0x1')]();var controller=require('./authLocal.controller');router[_0x6b68('0x2')]('/',controller[_0x6b68('0x3')]);router[_0x6b68('0x2')](_0x6b68('0x4'),controller[_0x6b68('0x5')]);router[_0x6b68('0x2')](_0x6b68('0x6'),controller['reset']);module[_0x6b68('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 e915e94..c5e15fe 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 _0xd9d3=['STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x48e75f,_0x5ab902){var _0x5c4d06=function(_0x3e8c06){while(--_0x3e8c06){_0x48e75f['push'](_0x48e75f['shift']());}};_0x5c4d06(++_0x5ab902);}(_0xd9d3,0x177));var _0x3d9d=function(_0x34cd30,_0x31284f){_0x34cd30=_0x34cd30-0x0;var _0x1d7b3a=_0xd9d3[_0x34cd30];return _0x1d7b3a;};'use strict';var Sequelize=require(_0x3d9d('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d9d('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3d9d('0x1')]},'status':{'type':Sequelize[_0x3d9d('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x3d9d('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x76aa=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76aa,0x12e));var _0xa76a=function(_0x2bc303,_0x4f1180){_0x2bc303=_0x2bc303-0x0;var _0x483433=_0x76aa[_0x2bc303];return _0x483433;};'use strict';var Sequelize=require(_0xa76a('0x0'));module[_0xa76a('0x1')]={'name':{'type':Sequelize[_0xa76a('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xa76a('0x2')]},'description':{'type':Sequelize[_0xa76a('0x2')]},'status':{'type':Sequelize[_0xa76a('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xa76a('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 77eca35..8ef5e4e 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 _0xfb29=['Condition','omit','getConditions','hasOwnProperty','addActions','Action','ids','findOne','getActions','eml-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/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','name','send','index','map','Automation','rawAttributes','type','key','model','query','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','keys','options','find','create','body','destroy'];(function(_0x187d53,_0x4096c3){var _0x27d460=function(_0x3a52ca){while(--_0x3a52ca){_0x187d53['push'](_0x187d53['shift']());}};_0x27d460(++_0x4096c3);}(_0xfb29,0x10b));var _0x9fb2=function(_0xd0e9b4,_0x3a1cc9){_0xd0e9b4=_0xd0e9b4-0x0;var _0x19566c=_0xfb29[_0xd0e9b4];return _0x19566c;};'use strict';var emlformat=require(_0x9fb2('0x0'));var rimraf=require(_0x9fb2('0x1'));var zipdir=require(_0x9fb2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9fb2('0x3'));var moment=require(_0x9fb2('0x4'));var BPromise=require(_0x9fb2('0x5'));var Mustache=require(_0x9fb2('0x6'));var util=require(_0x9fb2('0x7'));var path=require('path');var sox=require(_0x9fb2('0x8'));var csv=require(_0x9fb2('0x9'));var ejs=require(_0x9fb2('0xa'));var fs=require('fs');var fs_extra=require(_0x9fb2('0xb'));var _=require('lodash');var squel=require(_0x9fb2('0xc'));var crypto=require(_0x9fb2('0xd'));var jsforce=require(_0x9fb2('0xe'));var deskjs=require(_0x9fb2('0xf'));var toCsv=require(_0x9fb2('0x9'));var querystring=require(_0x9fb2('0x10'));var Papa=require(_0x9fb2('0x11'));var Redis=require(_0x9fb2('0x12'));var authService=require(_0x9fb2('0x13'));var qs=require(_0x9fb2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9fb2('0x15'));var logger=require(_0x9fb2('0x16'))('api');var utils=require(_0x9fb2('0x17'));var config=require(_0x9fb2('0x18'));var licenseUtil=require(_0x9fb2('0x19'));var db=require(_0x9fb2('0x1a'))['db'];function respondWithStatusCode(_0x15ab45,_0x54309b){_0x54309b=_0x54309b||0xcc;return function(_0x191bc7){if(_0x191bc7){return _0x15ab45[_0x9fb2('0x1b')](_0x54309b);}return _0x15ab45[_0x9fb2('0x1c')](_0x54309b)[_0x9fb2('0x1d')]();};}function respondWithResult(_0x22e814,_0x4d04ab){_0x4d04ab=_0x4d04ab||0xc8;return function(_0x3f38a1){if(_0x3f38a1){return _0x22e814[_0x9fb2('0x1c')](_0x4d04ab)[_0x9fb2('0x1e')](_0x3f38a1);}};}function respondWithFilteredResult(_0x2babd8,_0xd9ed87){return function(_0x118e36){if(_0x118e36){var _0xea93e0=typeof _0xd9ed87[_0x9fb2('0x1f')]===_0x9fb2('0x20')&&typeof _0xd9ed87[_0x9fb2('0x21')]===_0x9fb2('0x20');var _0x12b2f7=_0x118e36[_0x9fb2('0x22')];var _0x356770=_0xea93e0?0x0:_0xd9ed87[_0x9fb2('0x1f')];var _0x3a6b73=_0xea93e0?_0x118e36[_0x9fb2('0x22')]:_0xd9ed87[_0x9fb2('0x1f')]+_0xd9ed87['limit'];var _0x512f9e;if(_0x3a6b73>=_0x12b2f7){_0x3a6b73=_0x12b2f7;_0x512f9e=0xc8;}else{_0x512f9e=0xce;}_0x2babd8[_0x9fb2('0x1c')](_0x512f9e);return _0x2babd8[_0x9fb2('0x23')](_0x9fb2('0x24'),_0x356770+'-'+_0x3a6b73+'/'+_0x12b2f7)[_0x9fb2('0x1e')](_0x118e36);}return null;};}function patchUpdates(_0x29c93f){return function(_0x2f4bad){try{jsonpatch[_0x9fb2('0x25')](_0x2f4bad,_0x29c93f,!![]);}catch(_0x16e334){return BPromise[_0x9fb2('0x26')](_0x16e334);}return _0x2f4bad['save']();};}function saveUpdates(_0x3f7a88,_0x160bd1){return function(_0x15992b){if(_0x15992b){return _0x15992b[_0x9fb2('0x27')](_0x3f7a88)[_0x9fb2('0x28')](function(_0x23a5b3){return _0x23a5b3;});}return null;};}function removeEntity(_0x3289be,_0x2d0139){return function(_0x27bbb9){if(_0x27bbb9){return _0x27bbb9['destroy']()[_0x9fb2('0x28')](function(){_0x3289be[_0x9fb2('0x1c')](0xcc)[_0x9fb2('0x1d')]();});}};}function handleEntityNotFound(_0x418474,_0x37242a){return function(_0x145c32){if(!_0x145c32){_0x418474[_0x9fb2('0x1b')](0x194);}return _0x145c32;};}function handleError(_0x30c7ca,_0x7c286f){_0x7c286f=_0x7c286f||0x1f4;return function(_0x55fb69){logger[_0x9fb2('0x29')](_0x55fb69['stack']);if(_0x55fb69['name']){delete _0x55fb69[_0x9fb2('0x2a')];}_0x30c7ca[_0x9fb2('0x1c')](_0x7c286f)[_0x9fb2('0x2b')](_0x55fb69);};}exports[_0x9fb2('0x2c')]=function(_0x57421a,_0xb84872){var _0x1f3e54={},_0x38e88c={},_0x43f22c={'count':0x0,'rows':[]};var _0x245070=_[_0x9fb2('0x2d')](db[_0x9fb2('0x2e')][_0x9fb2('0x2f')],function(_0x4da880){return{'name':_0x4da880['fieldName'],'type':_0x4da880[_0x9fb2('0x30')][_0x9fb2('0x31')]};});_0x38e88c[_0x9fb2('0x32')]=_[_0x9fb2('0x2d')](_0x245070,_0x9fb2('0x2a'));_0x38e88c[_0x9fb2('0x33')]=_['keys'](_0x57421a['query']);_0x38e88c['filters']=_['intersection'](_0x38e88c[_0x9fb2('0x32')],_0x38e88c[_0x9fb2('0x33')]);_0x1f3e54[_0x9fb2('0x34')]=_[_0x9fb2('0x35')](_0x38e88c[_0x9fb2('0x32')],qs['fields'](_0x57421a[_0x9fb2('0x33')][_0x9fb2('0x36')]));_0x1f3e54['attributes']=_0x1f3e54[_0x9fb2('0x34')][_0x9fb2('0x37')]?_0x1f3e54[_0x9fb2('0x34')]:_0x38e88c[_0x9fb2('0x32')];if(!_0x57421a[_0x9fb2('0x33')]['hasOwnProperty'](_0x9fb2('0x38'))){_0x1f3e54[_0x9fb2('0x21')]=qs['limit'](_0x57421a[_0x9fb2('0x33')][_0x9fb2('0x21')]);_0x1f3e54['offset']=qs[_0x9fb2('0x1f')](_0x57421a[_0x9fb2('0x33')][_0x9fb2('0x1f')]);}_0x1f3e54[_0x9fb2('0x39')]=qs[_0x9fb2('0x3a')](_0x57421a['query'][_0x9fb2('0x3a')]);_0x1f3e54[_0x9fb2('0x3b')]=qs[_0x9fb2('0x3c')](_[_0x9fb2('0x3d')](_0x57421a[_0x9fb2('0x33')],_0x38e88c[_0x9fb2('0x3c')]),_0x245070);if(_0x57421a[_0x9fb2('0x33')][_0x9fb2('0x3e')]){_0x1f3e54[_0x9fb2('0x3b')]=_['merge'](_0x1f3e54[_0x9fb2('0x3b')],{'$or':_[_0x9fb2('0x2d')](_0x245070,function(_0x1fcc00){if(_0x1fcc00[_0x9fb2('0x30')]!==_0x9fb2('0x3f')){var _0x45dd0c={};_0x45dd0c[_0x1fcc00[_0x9fb2('0x2a')]]={'$like':'%'+_0x57421a[_0x9fb2('0x33')]['filter']+'%'};return _0x45dd0c;}})});}_0x1f3e54=_[_0x9fb2('0x40')]({},_0x1f3e54,_0x57421a['options']);var _0x2d9921={'where':_0x1f3e54[_0x9fb2('0x3b')]};return db[_0x9fb2('0x2e')][_0x9fb2('0x22')](_0x2d9921)[_0x9fb2('0x28')](function(_0x2d6d48){_0x43f22c[_0x9fb2('0x22')]=_0x2d6d48;if(_0x57421a[_0x9fb2('0x33')][_0x9fb2('0x41')]){_0x1f3e54[_0x9fb2('0x42')]=[{'all':!![]}];}return db['Automation'][_0x9fb2('0x43')](_0x1f3e54);})[_0x9fb2('0x28')](function(_0x4ce698){_0x43f22c[_0x9fb2('0x44')]=_0x4ce698;return _0x43f22c;})[_0x9fb2('0x28')](respondWithFilteredResult(_0xb84872,_0x1f3e54))[_0x9fb2('0x45')](handleError(_0xb84872,null));};exports['show']=function(_0x56df42,_0x42ad43){var _0x24b7f2={'raw':![],'where':{'id':_0x56df42[_0x9fb2('0x46')]['id']}},_0x99780e={};_0x99780e[_0x9fb2('0x32')]=_[_0x9fb2('0x47')](db[_0x9fb2('0x2e')]['rawAttributes']);_0x99780e[_0x9fb2('0x33')]=_[_0x9fb2('0x47')](_0x56df42[_0x9fb2('0x33')]);_0x99780e[_0x9fb2('0x3c')]=_[_0x9fb2('0x35')](_0x99780e[_0x9fb2('0x32')],_0x99780e[_0x9fb2('0x33')]);_0x24b7f2[_0x9fb2('0x34')]=_[_0x9fb2('0x35')](_0x99780e['model'],qs['fields'](_0x56df42['query'][_0x9fb2('0x36')]));_0x24b7f2[_0x9fb2('0x34')]=_0x24b7f2[_0x9fb2('0x34')][_0x9fb2('0x37')]?_0x24b7f2[_0x9fb2('0x34')]:_0x99780e[_0x9fb2('0x32')];if(_0x56df42[_0x9fb2('0x33')][_0x9fb2('0x41')]){_0x24b7f2[_0x9fb2('0x42')]=[{'all':!![]}];}_0x24b7f2=_[_0x9fb2('0x40')]({},_0x24b7f2,_0x56df42[_0x9fb2('0x48')]);return db[_0x9fb2('0x2e')][_0x9fb2('0x49')](_0x24b7f2)['then'](handleEntityNotFound(_0x42ad43,null))[_0x9fb2('0x28')](respondWithResult(_0x42ad43,null))[_0x9fb2('0x45')](handleError(_0x42ad43,null));};exports[_0x9fb2('0x4a')]=function(_0x3676c2,_0x2e2980){return db['Automation'][_0x9fb2('0x4a')](_0x3676c2['body'],{})['then'](respondWithResult(_0x2e2980,0xc9))[_0x9fb2('0x45')](handleError(_0x2e2980,null));};exports[_0x9fb2('0x27')]=function(_0x16ec6e,_0x32f892){if(_0x16ec6e[_0x9fb2('0x4b')]['id']){delete _0x16ec6e['body']['id'];}return db[_0x9fb2('0x2e')][_0x9fb2('0x49')]({'where':{'id':_0x16ec6e[_0x9fb2('0x46')]['id']}})[_0x9fb2('0x28')](handleEntityNotFound(_0x32f892,null))[_0x9fb2('0x28')](saveUpdates(_0x16ec6e['body'],null))[_0x9fb2('0x28')](respondWithResult(_0x32f892,null))[_0x9fb2('0x45')](handleError(_0x32f892,null));};exports[_0x9fb2('0x4c')]=function(_0x37c75e,_0xf0f1da){return db[_0x9fb2('0x2e')][_0x9fb2('0x49')]({'where':{'id':_0x37c75e[_0x9fb2('0x46')]['id']}})['then'](handleEntityNotFound(_0xf0f1da,null))[_0x9fb2('0x28')](removeEntity(_0xf0f1da,null))[_0x9fb2('0x45')](handleError(_0xf0f1da,null));};exports['addConditions']=function(_0x49a1e2,_0x3243ff,_0x3110f9){return db[_0x9fb2('0x4d')][_0x9fb2('0x49')]({'where':{'id':_0x49a1e2[_0x9fb2('0x46')]['id']}})[_0x9fb2('0x28')](handleEntityNotFound(_0x3243ff,null))['then'](function(_0x3e9cec){if(_0x3e9cec){return _0x3e9cec['addConditions'](_0x49a1e2[_0x9fb2('0x4b')]['ids'],_[_0x9fb2('0x4e')](_0x49a1e2[_0x9fb2('0x4b')],['ids','id'])||{});}})['then'](respondWithResult(_0x3243ff,null))[_0x9fb2('0x45')](handleError(_0x3243ff,null));};exports[_0x9fb2('0x4f')]=function(_0x164ca4,_0x579ff4,_0x412153){var _0x3047e3={};var _0x7ea552={};var _0x357fc7;var _0x23b4aa;return db['Automation']['findOne']({'where':{'id':_0x164ca4[_0x9fb2('0x46')]['id']}})[_0x9fb2('0x28')](handleEntityNotFound(_0x579ff4,null))['then'](function(_0x409d3d){if(_0x409d3d){_0x357fc7=_0x409d3d;_0x7ea552[_0x9fb2('0x32')]=_[_0x9fb2('0x47')](db[_0x9fb2('0x4d')]['rawAttributes']);_0x7ea552['query']=_[_0x9fb2('0x47')](_0x164ca4[_0x9fb2('0x33')]);_0x7ea552[_0x9fb2('0x3c')]=_[_0x9fb2('0x35')](_0x7ea552[_0x9fb2('0x32')],_0x7ea552[_0x9fb2('0x33')]);_0x3047e3[_0x9fb2('0x34')]=_[_0x9fb2('0x35')](_0x7ea552[_0x9fb2('0x32')],qs['fields'](_0x164ca4[_0x9fb2('0x33')][_0x9fb2('0x36')]));_0x3047e3[_0x9fb2('0x34')]=_0x3047e3[_0x9fb2('0x34')][_0x9fb2('0x37')]?_0x3047e3[_0x9fb2('0x34')]:_0x7ea552[_0x9fb2('0x32')];_0x3047e3[_0x9fb2('0x39')]=qs['sort'](_0x164ca4[_0x9fb2('0x33')][_0x9fb2('0x3a')]);_0x3047e3[_0x9fb2('0x3b')]=qs[_0x9fb2('0x3c')](_[_0x9fb2('0x3d')](_0x164ca4[_0x9fb2('0x33')],_0x7ea552['filters']));if(_0x164ca4[_0x9fb2('0x33')][_0x9fb2('0x3e')]){_0x3047e3['where']=_['merge'](_0x3047e3[_0x9fb2('0x3b')],{'$or':_['map'](_0x3047e3[_0x9fb2('0x34')],function(_0xe04e5f){var _0x436da2={};_0x436da2[_0xe04e5f]={'$like':'%'+_0x164ca4['query'][_0x9fb2('0x3e')]+'%'};return _0x436da2;})});}_0x3047e3=_[_0x9fb2('0x40')]({},_0x3047e3,_0x164ca4[_0x9fb2('0x48')]);return _0x357fc7[_0x9fb2('0x4f')](_0x3047e3);}})[_0x9fb2('0x28')](function(_0x4d5682){if(_0x4d5682){_0x23b4aa=_0x4d5682[_0x9fb2('0x37')];if(!_0x164ca4[_0x9fb2('0x33')][_0x9fb2('0x50')](_0x9fb2('0x38'))){_0x3047e3['limit']=qs[_0x9fb2('0x21')](_0x164ca4[_0x9fb2('0x33')][_0x9fb2('0x21')]);_0x3047e3[_0x9fb2('0x1f')]=qs[_0x9fb2('0x1f')](_0x164ca4[_0x9fb2('0x33')]['offset']);}return _0x357fc7[_0x9fb2('0x4f')](_0x3047e3);}})['then'](function(_0x507ec2){if(_0x507ec2){return _0x507ec2?{'count':_0x23b4aa,'rows':_0x507ec2}:null;}})[_0x9fb2('0x28')](respondWithResult(_0x579ff4,null))[_0x9fb2('0x45')](handleError(_0x579ff4,null));};exports[_0x9fb2('0x51')]=function(_0x2e0b6c,_0x28ea7c,_0x47605f){return db[_0x9fb2('0x52')][_0x9fb2('0x49')]({'where':{'id':_0x2e0b6c[_0x9fb2('0x46')]['id']}})[_0x9fb2('0x28')](handleEntityNotFound(_0x28ea7c,null))['then'](function(_0xda4a03){if(_0xda4a03){return _0xda4a03[_0x9fb2('0x51')](_0x2e0b6c[_0x9fb2('0x4b')][_0x9fb2('0x53')],_[_0x9fb2('0x4e')](_0x2e0b6c[_0x9fb2('0x4b')],['ids','id'])||{});}})[_0x9fb2('0x28')](respondWithResult(_0x28ea7c,null))[_0x9fb2('0x45')](handleError(_0x28ea7c,null));};exports['getActions']=function(_0x11954a,_0x405bd7,_0x1b618f){var _0x290613={};var _0xc8017b={};var _0x2d6a18;var _0x1509a2;return db['Automation'][_0x9fb2('0x54')]({'where':{'id':_0x11954a['params']['id']}})['then'](handleEntityNotFound(_0x405bd7,null))[_0x9fb2('0x28')](function(_0x5526a6){if(_0x5526a6){_0x2d6a18=_0x5526a6;_0xc8017b[_0x9fb2('0x32')]=_[_0x9fb2('0x47')](db[_0x9fb2('0x52')][_0x9fb2('0x2f')]);_0xc8017b['query']=_[_0x9fb2('0x47')](_0x11954a[_0x9fb2('0x33')]);_0xc8017b[_0x9fb2('0x3c')]=_['intersection'](_0xc8017b[_0x9fb2('0x32')],_0xc8017b['query']);_0x290613['attributes']=_[_0x9fb2('0x35')](_0xc8017b[_0x9fb2('0x32')],qs[_0x9fb2('0x36')](_0x11954a[_0x9fb2('0x33')][_0x9fb2('0x36')]));_0x290613[_0x9fb2('0x34')]=_0x290613['attributes'][_0x9fb2('0x37')]?_0x290613[_0x9fb2('0x34')]:_0xc8017b[_0x9fb2('0x32')];_0x290613[_0x9fb2('0x39')]=qs[_0x9fb2('0x3a')](_0x11954a[_0x9fb2('0x33')][_0x9fb2('0x3a')]);_0x290613['where']=qs['filters'](_[_0x9fb2('0x3d')](_0x11954a['query'],_0xc8017b[_0x9fb2('0x3c')]));if(_0x11954a[_0x9fb2('0x33')][_0x9fb2('0x3e')]){_0x290613[_0x9fb2('0x3b')]=_[_0x9fb2('0x40')](_0x290613['where'],{'$or':_[_0x9fb2('0x2d')](_0x290613[_0x9fb2('0x34')],function(_0x4435eb){var _0x34b9d2={};_0x34b9d2[_0x4435eb]={'$like':'%'+_0x11954a['query']['filter']+'%'};return _0x34b9d2;})});}_0x290613=_[_0x9fb2('0x40')]({},_0x290613,_0x11954a[_0x9fb2('0x48')]);return _0x2d6a18[_0x9fb2('0x55')](_0x290613);}})['then'](function(_0x41e02){if(_0x41e02){_0x1509a2=_0x41e02[_0x9fb2('0x37')];if(!_0x11954a[_0x9fb2('0x33')][_0x9fb2('0x50')](_0x9fb2('0x38'))){_0x290613[_0x9fb2('0x21')]=qs[_0x9fb2('0x21')](_0x11954a[_0x9fb2('0x33')][_0x9fb2('0x21')]);_0x290613['offset']=qs['offset'](_0x11954a[_0x9fb2('0x33')][_0x9fb2('0x1f')]);}return _0x2d6a18[_0x9fb2('0x55')](_0x290613);}})[_0x9fb2('0x28')](function(_0x4263ef){if(_0x4263ef){return _0x4263ef?{'count':_0x1509a2,'rows':_0x4263ef}:null;}})['then'](respondWithResult(_0x405bd7,null))[_0x9fb2('0x45')](handleError(_0x405bd7,null));}; \ No newline at end of file +var _0x09a2=['nolimit','offset','order','sort','where','filter','merge','type','options','count','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','addConditions','Condition','ids','getConditions','findOne','pick','addActions','omit','getActions','Action','eml-format','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','Automation','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x21b8b6,_0x5e68f4){var _0x1ac143=function(_0xb7587f){while(--_0xb7587f){_0x21b8b6['push'](_0x21b8b6['shift']());}};_0x1ac143(++_0x5e68f4);}(_0x09a2,0x1af));var _0x209a=function(_0x4ea309,_0x4b32ed){_0x4ea309=_0x4ea309-0x0;var _0x5d2ee1=_0x09a2[_0x4ea309];return _0x5d2ee1;};'use strict';var emlformat=require(_0x209a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x209a('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x209a('0x2'));var Mustache=require(_0x209a('0x3'));var util=require(_0x209a('0x4'));var path=require(_0x209a('0x5'));var sox=require('sox');var csv=require(_0x209a('0x6'));var ejs=require(_0x209a('0x7'));var fs=require('fs');var fs_extra=require(_0x209a('0x8'));var _=require(_0x209a('0x9'));var squel=require(_0x209a('0xa'));var crypto=require(_0x209a('0xb'));var jsforce=require(_0x209a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x209a('0x6'));var querystring=require(_0x209a('0xd'));var Papa=require(_0x209a('0xe'));var Redis=require(_0x209a('0xf'));var authService=require(_0x209a('0x10'));var qs=require(_0x209a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x209a('0x12'));var licenseUtil=require(_0x209a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x148b1a,_0x1f3b7d){_0x1f3b7d=_0x1f3b7d||0xcc;return function(_0x5b6d2f){if(_0x5b6d2f){return _0x148b1a[_0x209a('0x14')](_0x1f3b7d);}return _0x148b1a[_0x209a('0x15')](_0x1f3b7d)[_0x209a('0x16')]();};}function respondWithResult(_0x59a4c2,_0x22bdfb){_0x22bdfb=_0x22bdfb||0xc8;return function(_0x345f75){if(_0x345f75){return _0x59a4c2[_0x209a('0x15')](_0x22bdfb)[_0x209a('0x17')](_0x345f75);}};}function respondWithFilteredResult(_0x486347,_0x2f8c03){return function(_0x3028f3){if(_0x3028f3){var _0x2be59a=typeof _0x2f8c03['offset']==='undefined'&&typeof _0x2f8c03[_0x209a('0x18')]==='undefined';var _0x2e0f99=_0x3028f3['count'];var _0x3b8b21=_0x2be59a?0x0:_0x2f8c03['offset'];var _0x7ed8b=_0x2be59a?_0x3028f3['count']:_0x2f8c03['offset']+_0x2f8c03[_0x209a('0x18')];var _0x32368b;if(_0x7ed8b>=_0x2e0f99){_0x7ed8b=_0x2e0f99;_0x32368b=0xc8;}else{_0x32368b=0xce;}_0x486347[_0x209a('0x15')](_0x32368b);return _0x486347[_0x209a('0x19')](_0x209a('0x1a'),_0x3b8b21+'-'+_0x7ed8b+'/'+_0x2e0f99)[_0x209a('0x17')](_0x3028f3);}return null;};}function patchUpdates(_0x21b71c){return function(_0x216463){try{jsonpatch['apply'](_0x216463,_0x21b71c,!![]);}catch(_0x11a47a){return BPromise[_0x209a('0x1b')](_0x11a47a);}return _0x216463[_0x209a('0x1c')]();};}function saveUpdates(_0x1dc80d,_0x516c0d){return function(_0x4b2ac1){if(_0x4b2ac1){return _0x4b2ac1[_0x209a('0x1d')](_0x1dc80d)[_0x209a('0x1e')](function(_0x191025){return _0x191025;});}return null;};}function removeEntity(_0x5bc48c,_0x30b838){return function(_0x1e545c){if(_0x1e545c){return _0x1e545c[_0x209a('0x1f')]()[_0x209a('0x1e')](function(){_0x5bc48c[_0x209a('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x536534,_0x4c5f0f){return function(_0x42495f){if(!_0x42495f){_0x536534[_0x209a('0x14')](0x194);}return _0x42495f;};}function handleError(_0x4d8673,_0x3df7e0){_0x3df7e0=_0x3df7e0||0x1f4;return function(_0x20e639){logger[_0x209a('0x20')](_0x20e639[_0x209a('0x21')]);if(_0x20e639[_0x209a('0x22')]){delete _0x20e639['name'];}_0x4d8673[_0x209a('0x15')](_0x3df7e0)[_0x209a('0x23')](_0x20e639);};}exports['index']=function(_0x241628,_0x3cb496){var _0x46d4e6={},_0x99a5ec={},_0x52dd95={'count':0x0,'rows':[]};var _0x564e76=_[_0x209a('0x24')](db[_0x209a('0x25')][_0x209a('0x26')],function(_0x199895){return{'name':_0x199895[_0x209a('0x27')],'type':_0x199895['type'][_0x209a('0x28')]};});_0x99a5ec['model']=_['map'](_0x564e76,_0x209a('0x22'));_0x99a5ec[_0x209a('0x29')]=_['keys'](_0x241628[_0x209a('0x29')]);_0x99a5ec[_0x209a('0x2a')]=_[_0x209a('0x2b')](_0x99a5ec[_0x209a('0x2c')],_0x99a5ec[_0x209a('0x29')]);_0x46d4e6[_0x209a('0x2d')]=_['intersection'](_0x99a5ec['model'],qs[_0x209a('0x2e')](_0x241628[_0x209a('0x29')][_0x209a('0x2e')]));_0x46d4e6['attributes']=_0x46d4e6[_0x209a('0x2d')][_0x209a('0x2f')]?_0x46d4e6[_0x209a('0x2d')]:_0x99a5ec['model'];if(!_0x241628[_0x209a('0x29')][_0x209a('0x30')](_0x209a('0x31'))){_0x46d4e6[_0x209a('0x18')]=qs[_0x209a('0x18')](_0x241628[_0x209a('0x29')]['limit']);_0x46d4e6[_0x209a('0x32')]=qs[_0x209a('0x32')](_0x241628[_0x209a('0x29')][_0x209a('0x32')]);}_0x46d4e6[_0x209a('0x33')]=qs[_0x209a('0x34')](_0x241628['query'][_0x209a('0x34')]);_0x46d4e6[_0x209a('0x35')]=qs[_0x209a('0x2a')](_['pick'](_0x241628[_0x209a('0x29')],_0x99a5ec[_0x209a('0x2a')]),_0x564e76);if(_0x241628[_0x209a('0x29')][_0x209a('0x36')]){_0x46d4e6[_0x209a('0x35')]=_[_0x209a('0x37')](_0x46d4e6['where'],{'$or':_['map'](_0x564e76,function(_0x474e32){if(_0x474e32[_0x209a('0x38')]!=='VIRTUAL'){var _0x3eb6a1={};_0x3eb6a1[_0x474e32[_0x209a('0x22')]]={'$like':'%'+_0x241628['query']['filter']+'%'};return _0x3eb6a1;}})});}_0x46d4e6=_['merge']({},_0x46d4e6,_0x241628[_0x209a('0x39')]);var _0x362853={'where':_0x46d4e6[_0x209a('0x35')]};return db[_0x209a('0x25')][_0x209a('0x3a')](_0x362853)[_0x209a('0x1e')](function(_0x2fd104){_0x52dd95[_0x209a('0x3a')]=_0x2fd104;if(_0x241628['query']['includeAll']){_0x46d4e6['include']=[{'all':!![]}];}return db[_0x209a('0x25')][_0x209a('0x3b')](_0x46d4e6);})['then'](function(_0xc84442){_0x52dd95[_0x209a('0x3c')]=_0xc84442;return _0x52dd95;})[_0x209a('0x1e')](respondWithFilteredResult(_0x3cb496,_0x46d4e6))[_0x209a('0x3d')](handleError(_0x3cb496,null));};exports[_0x209a('0x3e')]=function(_0x2c58db,_0x33f48b){var _0x3b696e={'raw':![],'where':{'id':_0x2c58db[_0x209a('0x3f')]['id']}},_0x2a53d3={};_0x2a53d3[_0x209a('0x2c')]=_['keys'](db[_0x209a('0x25')][_0x209a('0x26')]);_0x2a53d3[_0x209a('0x29')]=_[_0x209a('0x40')](_0x2c58db[_0x209a('0x29')]);_0x2a53d3[_0x209a('0x2a')]=_[_0x209a('0x2b')](_0x2a53d3[_0x209a('0x2c')],_0x2a53d3[_0x209a('0x29')]);_0x3b696e[_0x209a('0x2d')]=_['intersection'](_0x2a53d3[_0x209a('0x2c')],qs['fields'](_0x2c58db[_0x209a('0x29')]['fields']));_0x3b696e[_0x209a('0x2d')]=_0x3b696e[_0x209a('0x2d')]['length']?_0x3b696e[_0x209a('0x2d')]:_0x2a53d3[_0x209a('0x2c')];if(_0x2c58db[_0x209a('0x29')][_0x209a('0x41')]){_0x3b696e[_0x209a('0x42')]=[{'all':!![]}];}_0x3b696e=_[_0x209a('0x37')]({},_0x3b696e,_0x2c58db[_0x209a('0x39')]);return db[_0x209a('0x25')][_0x209a('0x43')](_0x3b696e)[_0x209a('0x1e')](handleEntityNotFound(_0x33f48b,null))[_0x209a('0x1e')](respondWithResult(_0x33f48b,null))[_0x209a('0x3d')](handleError(_0x33f48b,null));};exports[_0x209a('0x44')]=function(_0x4358dc,_0x35b8e8){return db['Automation'][_0x209a('0x44')](_0x4358dc[_0x209a('0x45')],{})[_0x209a('0x1e')](respondWithResult(_0x35b8e8,0xc9))[_0x209a('0x3d')](handleError(_0x35b8e8,null));};exports['update']=function(_0x42c4e0,_0x5560c4){if(_0x42c4e0[_0x209a('0x45')]['id']){delete _0x42c4e0[_0x209a('0x45')]['id'];}return db[_0x209a('0x25')][_0x209a('0x43')]({'where':{'id':_0x42c4e0['params']['id']}})['then'](handleEntityNotFound(_0x5560c4,null))[_0x209a('0x1e')](saveUpdates(_0x42c4e0['body'],null))[_0x209a('0x1e')](respondWithResult(_0x5560c4,null))[_0x209a('0x3d')](handleError(_0x5560c4,null));};exports['destroy']=function(_0x25893f,_0x5a2f21){return db[_0x209a('0x25')]['find']({'where':{'id':_0x25893f[_0x209a('0x3f')]['id']}})[_0x209a('0x1e')](handleEntityNotFound(_0x5a2f21,null))[_0x209a('0x1e')](removeEntity(_0x5a2f21,null))[_0x209a('0x3d')](handleError(_0x5a2f21,null));};exports[_0x209a('0x46')]=function(_0x4baeb0,_0x41cd1c,_0x1ab81e){return db[_0x209a('0x47')][_0x209a('0x43')]({'where':{'id':_0x4baeb0[_0x209a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x41cd1c,null))['then'](function(_0x5f30ba){if(_0x5f30ba){return _0x5f30ba['addConditions'](_0x4baeb0[_0x209a('0x45')][_0x209a('0x48')],_['omit'](_0x4baeb0[_0x209a('0x45')],[_0x209a('0x48'),'id'])||{});}})[_0x209a('0x1e')](respondWithResult(_0x41cd1c,null))[_0x209a('0x3d')](handleError(_0x41cd1c,null));};exports[_0x209a('0x49')]=function(_0x49fcd2,_0x4e3f40,_0x292b47){var _0x276aec={};var _0x44f940={};var _0x4ce7a7;var _0x2ca307;return db[_0x209a('0x25')][_0x209a('0x4a')]({'where':{'id':_0x49fcd2[_0x209a('0x3f')]['id']}})[_0x209a('0x1e')](handleEntityNotFound(_0x4e3f40,null))['then'](function(_0x7ea4e1){if(_0x7ea4e1){_0x4ce7a7=_0x7ea4e1;_0x44f940['model']=_[_0x209a('0x40')](db['Condition'][_0x209a('0x26')]);_0x44f940[_0x209a('0x29')]=_[_0x209a('0x40')](_0x49fcd2[_0x209a('0x29')]);_0x44f940[_0x209a('0x2a')]=_[_0x209a('0x2b')](_0x44f940['model'],_0x44f940[_0x209a('0x29')]);_0x276aec['attributes']=_[_0x209a('0x2b')](_0x44f940[_0x209a('0x2c')],qs['fields'](_0x49fcd2['query'][_0x209a('0x2e')]));_0x276aec[_0x209a('0x2d')]=_0x276aec[_0x209a('0x2d')][_0x209a('0x2f')]?_0x276aec['attributes']:_0x44f940['model'];_0x276aec['order']=qs[_0x209a('0x34')](_0x49fcd2['query']['sort']);_0x276aec[_0x209a('0x35')]=qs[_0x209a('0x2a')](_[_0x209a('0x4b')](_0x49fcd2[_0x209a('0x29')],_0x44f940['filters']));if(_0x49fcd2[_0x209a('0x29')][_0x209a('0x36')]){_0x276aec[_0x209a('0x35')]=_[_0x209a('0x37')](_0x276aec[_0x209a('0x35')],{'$or':_['map'](_0x276aec[_0x209a('0x2d')],function(_0x4fdd47){var _0x4d8a07={};_0x4d8a07[_0x4fdd47]={'$like':'%'+_0x49fcd2[_0x209a('0x29')][_0x209a('0x36')]+'%'};return _0x4d8a07;})});}_0x276aec=_['merge']({},_0x276aec,_0x49fcd2[_0x209a('0x39')]);return _0x4ce7a7[_0x209a('0x49')](_0x276aec);}})[_0x209a('0x1e')](function(_0x343066){if(_0x343066){_0x2ca307=_0x343066['length'];if(!_0x49fcd2[_0x209a('0x29')][_0x209a('0x30')](_0x209a('0x31'))){_0x276aec[_0x209a('0x18')]=qs[_0x209a('0x18')](_0x49fcd2[_0x209a('0x29')]['limit']);_0x276aec[_0x209a('0x32')]=qs[_0x209a('0x32')](_0x49fcd2[_0x209a('0x29')][_0x209a('0x32')]);}return _0x4ce7a7['getConditions'](_0x276aec);}})[_0x209a('0x1e')](function(_0x32c6a1){if(_0x32c6a1){return _0x32c6a1?{'count':_0x2ca307,'rows':_0x32c6a1}:null;}})[_0x209a('0x1e')](respondWithResult(_0x4e3f40,null))[_0x209a('0x3d')](handleError(_0x4e3f40,null));};exports['addActions']=function(_0x36a99f,_0xe239b6,_0x3a893b){return db['Action'][_0x209a('0x43')]({'where':{'id':_0x36a99f[_0x209a('0x3f')]['id']}})[_0x209a('0x1e')](handleEntityNotFound(_0xe239b6,null))['then'](function(_0x1b939b){if(_0x1b939b){return _0x1b939b[_0x209a('0x4c')](_0x36a99f['body'][_0x209a('0x48')],_[_0x209a('0x4d')](_0x36a99f[_0x209a('0x45')],[_0x209a('0x48'),'id'])||{});}})['then'](respondWithResult(_0xe239b6,null))[_0x209a('0x3d')](handleError(_0xe239b6,null));};exports[_0x209a('0x4e')]=function(_0x41f67d,_0x185024,_0x37bc39){var _0x8ec266={};var _0x1fa0b0={};var _0x11f32e;var _0xc90066;return db[_0x209a('0x25')]['findOne']({'where':{'id':_0x41f67d['params']['id']}})[_0x209a('0x1e')](handleEntityNotFound(_0x185024,null))[_0x209a('0x1e')](function(_0x709814){if(_0x709814){_0x11f32e=_0x709814;_0x1fa0b0[_0x209a('0x2c')]=_[_0x209a('0x40')](db[_0x209a('0x4f')][_0x209a('0x26')]);_0x1fa0b0[_0x209a('0x29')]=_[_0x209a('0x40')](_0x41f67d[_0x209a('0x29')]);_0x1fa0b0[_0x209a('0x2a')]=_['intersection'](_0x1fa0b0[_0x209a('0x2c')],_0x1fa0b0[_0x209a('0x29')]);_0x8ec266[_0x209a('0x2d')]=_[_0x209a('0x2b')](_0x1fa0b0['model'],qs[_0x209a('0x2e')](_0x41f67d[_0x209a('0x29')][_0x209a('0x2e')]));_0x8ec266[_0x209a('0x2d')]=_0x8ec266['attributes'][_0x209a('0x2f')]?_0x8ec266[_0x209a('0x2d')]:_0x1fa0b0[_0x209a('0x2c')];_0x8ec266['order']=qs['sort'](_0x41f67d['query']['sort']);_0x8ec266[_0x209a('0x35')]=qs['filters'](_[_0x209a('0x4b')](_0x41f67d[_0x209a('0x29')],_0x1fa0b0[_0x209a('0x2a')]));if(_0x41f67d[_0x209a('0x29')][_0x209a('0x36')]){_0x8ec266[_0x209a('0x35')]=_['merge'](_0x8ec266[_0x209a('0x35')],{'$or':_[_0x209a('0x24')](_0x8ec266[_0x209a('0x2d')],function(_0x162830){var _0x4380c3={};_0x4380c3[_0x162830]={'$like':'%'+_0x41f67d[_0x209a('0x29')][_0x209a('0x36')]+'%'};return _0x4380c3;})});}_0x8ec266=_[_0x209a('0x37')]({},_0x8ec266,_0x41f67d['options']);return _0x11f32e['getActions'](_0x8ec266);}})[_0x209a('0x1e')](function(_0x271e6e){if(_0x271e6e){_0xc90066=_0x271e6e['length'];if(!_0x41f67d[_0x209a('0x29')][_0x209a('0x30')]('nolimit')){_0x8ec266[_0x209a('0x18')]=qs[_0x209a('0x18')](_0x41f67d[_0x209a('0x29')][_0x209a('0x18')]);_0x8ec266[_0x209a('0x32')]=qs[_0x209a('0x32')](_0x41f67d['query'][_0x209a('0x32')]);}return _0x11f32e[_0x209a('0x4e')](_0x8ec266);}})['then'](function(_0x4d17c1){if(_0x4d17c1){return _0x4d17c1?{'count':_0xc90066,'rows':_0x4d17c1}:null;}})[_0x209a('0x1e')](respondWithResult(_0x185024,null))[_0x209a('0x3d')](handleError(_0x185024,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index aff93d1..6f30335 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 _0x6a8a=['tools_automations','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./automation.attributes','define','Automation'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x6a8a,0xf1));var _0xa6a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a8a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa6a8('0x0'));var util=require('util');var logger=require(_0xa6a8('0x1'))(_0xa6a8('0x2'));var moment=require(_0xa6a8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa6a8('0x4'));var config=require(_0xa6a8('0x5'));var attributes=require(_0xa6a8('0x6'));module['exports']=function(_0x1931b0,_0x35391a){return _0x1931b0[_0xa6a8('0x7')](_0xa6a8('0x8'),attributes,{'tableName':_0xa6a8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x406c=['Automation','tools_automations','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define'];(function(_0x5d2cb2,_0x3bedef){var _0x5bc131=function(_0x5c669b){while(--_0x5c669b){_0x5d2cb2['push'](_0x5d2cb2['shift']());}};_0x5bc131(++_0x3bedef);}(_0x406c,0x115));var _0xc406=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x406c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc406('0x0'))('api');var moment=require(_0xc406('0x1'));var BPromise=require('bluebird');var rp=require(_0xc406('0x2'));var fs=require('fs');var path=require(_0xc406('0x3'));var rimraf=require(_0xc406('0x4'));var config=require(_0xc406('0x5'));var attributes=require(_0xc406('0x6'));module[_0xc406('0x7')]=function(_0x55e51a,_0x1c791c){return _0x55e51a[_0xc406('0x8')](_0xc406('0x9'),attributes,{'tableName':_0xc406('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 84c1b07..ce01135 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 _0xcd4d=['http','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xcd4d,0xe4));var _0xdcd4=function(_0x1945ed,_0x5b3d8c){_0x1945ed=_0x1945ed-0x0;var _0x57c64b=_0xcd4d[_0x1945ed];return _0x57c64b;};'use strict';var _=require(_0xdcd4('0x0'));var util=require(_0xdcd4('0x1'));var moment=require('moment');var BPromise=require(_0xdcd4('0x2'));var rs=require(_0xdcd4('0x3'));var fs=require('fs');var Redis=require(_0xdcd4('0x4'));var db=require(_0xdcd4('0x5'))['db'];var utils=require(_0xdcd4('0x6'));var logger=require(_0xdcd4('0x7'))(_0xdcd4('0x8'));var config=require(_0xdcd4('0x9'));var jayson=require(_0xdcd4('0xa'));var client=jayson[_0xdcd4('0xb')][_0xdcd4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x302b60,_0x5b57f6,_0x17f848){return new BPromise(function(_0x198d6c,_0xc0cf59){return client['request'](_0x302b60,_0x17f848)[_0xdcd4('0xd')](function(_0x3cae6d){logger['info'](_0xdcd4('0xe'),_0x5b57f6,_0xdcd4('0xf'));logger[_0xdcd4('0x10')](_0xdcd4('0x11'),_0x5b57f6,_0xdcd4('0xf'),JSON['stringify'](_0x3cae6d));if(_0x3cae6d[_0xdcd4('0x12')]){if(_0x3cae6d[_0xdcd4('0x12')][_0xdcd4('0x13')]===0x1f4){logger[_0xdcd4('0x12')](_0xdcd4('0xe'),_0x5b57f6,_0x3cae6d['error'][_0xdcd4('0x14')]);return _0xc0cf59(_0x3cae6d[_0xdcd4('0x12')]['message']);}logger[_0xdcd4('0x12')](_0xdcd4('0xe'),_0x5b57f6,_0x3cae6d['error']['message']);return _0x198d6c(_0x3cae6d[_0xdcd4('0x12')][_0xdcd4('0x14')]);}else{logger[_0xdcd4('0x15')](_0xdcd4('0xe'),_0x5b57f6,_0xdcd4('0xf'));_0x198d6c(_0x3cae6d[_0xdcd4('0x16')][_0xdcd4('0x14')]);}})[_0xdcd4('0x17')](function(_0xf57175){logger[_0xdcd4('0x12')](_0xdcd4('0xe'),_0x5b57f6,_0xf57175);_0xc0cf59(_0xf57175);});});} \ No newline at end of file +var _0xedf1=['Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x7c5216,_0x38ee21){var _0x1c47f8=function(_0x440db8){while(--_0x440db8){_0x7c5216['push'](_0x7c5216['shift']());}};_0x1c47f8(++_0x38ee21);}(_0xedf1,0xb2));var _0x1edf=function(_0x8f01d3,_0x5beee0){_0x8f01d3=_0x8f01d3-0x0;var _0x315e88=_0xedf1[_0x8f01d3];return _0x315e88;};'use strict';var _=require(_0x1edf('0x0'));var util=require(_0x1edf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1edf('0x2'));var fs=require('fs');var Redis=require(_0x1edf('0x3'));var db=require(_0x1edf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1edf('0x5'))(_0x1edf('0x6'));var config=require(_0x1edf('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1edf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1615b2,_0x1029fe,_0x20b629){return new BPromise(function(_0x12293b,_0x206f63){return client[_0x1edf('0x9')](_0x1615b2,_0x20b629)[_0x1edf('0xa')](function(_0x30a13f){logger['info'](_0x1edf('0xb'),_0x1029fe,_0x1edf('0xc'));logger[_0x1edf('0xd')](_0x1edf('0xe'),_0x1029fe,'request\x20sent',JSON[_0x1edf('0xf')](_0x30a13f));if(_0x30a13f['error']){if(_0x30a13f[_0x1edf('0x10')][_0x1edf('0x11')]===0x1f4){logger[_0x1edf('0x10')](_0x1edf('0xb'),_0x1029fe,_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);return _0x206f63(_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);}logger[_0x1edf('0x10')]('Automation,\x20%s,\x20%s',_0x1029fe,_0x30a13f[_0x1edf('0x10')][_0x1edf('0x12')]);return _0x12293b(_0x30a13f['error'][_0x1edf('0x12')]);}else{logger[_0x1edf('0x13')](_0x1edf('0xb'),_0x1029fe,_0x1edf('0xc'));_0x12293b(_0x30a13f[_0x1edf('0x14')][_0x1edf('0x12')]);}})['catch'](function(_0x4f2584){logger[_0x1edf('0x10')](_0x1edf('0xb'),_0x1029fe,_0x4f2584);_0x206f63(_0x4f2584);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 6bbbeee..a75be87 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 _0x089f=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','post','create','put','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x7512db,_0x30f6cb){var _0x2c9ee9=function(_0x2f7888){while(--_0x2f7888){_0x7512db['push'](_0x7512db['shift']());}};_0x2c9ee9(++_0x30f6cb);}(_0x089f,0x1c7));var _0xf089=function(_0x14b063,_0xec15d8){_0x14b063=_0x14b063-0x0;var _0x407ef4=_0x089f[_0x14b063];return _0x407ef4;};'use strict';var multer=require('multer');var util=require(_0xf089('0x0'));var path=require(_0xf089('0x1'));var timeout=require(_0xf089('0x2'));var express=require(_0xf089('0x3'));var router=express[_0xf089('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf089('0x5'));var interaction=require(_0xf089('0x6'));var config=require(_0xf089('0x7'));var controller=require('./automation.controller');router[_0xf089('0x8')]('/',auth[_0xf089('0x9')](),controller[_0xf089('0xa')]);router['get'](_0xf089('0xb'),auth[_0xf089('0x9')](),controller[_0xf089('0xc')]);router['get'](_0xf089('0xd'),auth[_0xf089('0x9')](),controller[_0xf089('0xe')]);router[_0xf089('0x8')](_0xf089('0xf'),auth[_0xf089('0x9')](),controller['getActions']);router[_0xf089('0x10')]('/',auth[_0xf089('0x9')](),controller[_0xf089('0x11')]);router['post'](_0xf089('0xd'),auth[_0xf089('0x9')](),controller['addConditions']);router['post'](_0xf089('0xf'),auth[_0xf089('0x9')](),controller['addActions']);router[_0xf089('0x12')](_0xf089('0xb'),auth[_0xf089('0x9')](),controller[_0xf089('0x13')]);router['delete'](_0xf089('0xb'),auth['isAuthenticated'](),controller[_0xf089('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe3c5=['./automation.controller','get','isAuthenticated','index','/:id','show','getConditions','/:id/actions','getActions','create','/:id/conditions','post','addActions','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe3c5,0x17d));var _0x5e3c=function(_0x459573,_0x35679e){_0x459573=_0x459573-0x0;var _0x51ffcd=_0xe3c5[_0x459573];return _0x51ffcd;};'use strict';var multer=require(_0x5e3c('0x0'));var util=require(_0x5e3c('0x1'));var path=require(_0x5e3c('0x2'));var timeout=require(_0x5e3c('0x3'));var express=require(_0x5e3c('0x4'));var router=express[_0x5e3c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5e3c('0x6'));var interaction=require(_0x5e3c('0x7'));var config=require(_0x5e3c('0x8'));var controller=require(_0x5e3c('0x9'));router[_0x5e3c('0xa')]('/',auth[_0x5e3c('0xb')](),controller[_0x5e3c('0xc')]);router[_0x5e3c('0xa')](_0x5e3c('0xd'),auth[_0x5e3c('0xb')](),controller[_0x5e3c('0xe')]);router[_0x5e3c('0xa')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x5e3c('0xf')]);router[_0x5e3c('0xa')](_0x5e3c('0x10'),auth[_0x5e3c('0xb')](),controller[_0x5e3c('0x11')]);router['post']('/',auth[_0x5e3c('0xb')](),controller[_0x5e3c('0x12')]);router['post'](_0x5e3c('0x13'),auth['isAuthenticated'](),controller['addConditions']);router[_0x5e3c('0x14')](_0x5e3c('0x10'),auth[_0x5e3c('0xb')](),controller[_0x5e3c('0x15')]);router[_0x5e3c('0x16')](_0x5e3c('0xd'),auth[_0x5e3c('0xb')](),controller[_0x5e3c('0x17')]);router['delete']('/:id',auth[_0x5e3c('0xb')](),controller[_0x5e3c('0x18')]);module[_0x5e3c('0x19')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index feb2f96..3535c7f 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 _0x1c38=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','Max\x20200\x20calls.','UNSIGNED','INTEGER','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,*,*,*','ENUM','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0x23c273,_0x533614){var _0x2bca0d=function(_0x348fdf){while(--_0x348fdf){_0x23c273['push'](_0x23c273['shift']());}};_0x2bca0d(++_0x533614);}(_0x1c38,0x188));var _0x81c3=function(_0xd4c6a6,_0x5ce042){_0xd4c6a6=_0xd4c6a6-0x0;var _0x3f9046=_0x1c38[_0xd4c6a6];return _0x3f9046;};'use strict';var Sequelize=require('sequelize');module[_0x81c3('0x0')]={'name':{'type':Sequelize[_0x81c3('0x1')],'unique':_0x81c3('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x81c3('0x3')),'allowNull':![],'defaultValue':_0x81c3('0x3')},'description':{'type':Sequelize[_0x81c3('0x1')]},'active':{'type':Sequelize[_0x81c3('0x4')],'defaultValue':0x0,'comment':_0x81c3('0x5')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x81c3('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x81c3('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x81c3('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x81c3('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x81c3('0x8')](0x3)[_0x81c3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x81c3('0x8')](0x5)[_0x81c3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81c3('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x81c3('0x8')](0x3)[_0x81c3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81c3('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0x81c3('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81c3('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x81c3('0x8')](0x3)[_0x81c3('0x7')],'defaultValue':0x3,'comment':_0x81c3('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x81c3('0x8')](0x5)[_0x81c3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81c3('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x81c3('0x8')](0x3)[_0x81c3('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x81c3('0xe')},'dialTimezone':{'type':Sequelize[_0x81c3('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x81c3('0x1')],'defaultValue':_0x81c3('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x81c3('0x10')](_0x81c3('0x11'),_0x81c3('0x12'),_0x81c3('0x13')),'defaultValue':_0x81c3('0x11')},'dialAMDActive':{'type':Sequelize[_0x81c3('0x4')],'defaultValue':0x0,'comment':_0x81c3('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x81c3('0x8')](0x9)[_0x81c3('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x81c3('0x15')},'dialAMDGreeting':{'type':Sequelize[_0x81c3('0x8')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x81c3('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x81c3('0x8')](0x9)[_0x81c3('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x81c3('0x17')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x81c3('0x8')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x81c3('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x81c3('0x8')](0x9)[_0x81c3('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x81c3('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x81c3('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x81c3('0x8')](0x5)[_0x81c3('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x81c3('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x81c3('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x81c3('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x81c3('0x10')](_0x81c3('0x1c'),_0x81c3('0x1d')),'defaultValue':_0x81c3('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x81c3('0x8')](0x3)[_0x81c3('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x81c3('0x1e')},'dialCutDigit':{'type':Sequelize[_0x81c3('0x8')](0x3)[_0x81c3('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x81c3('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x81c3('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x81c3('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81c3('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x81c3('0x8')](0x3)[_0x81c3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81c3('0x21')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x81c3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81c3('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x81c3('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81c3('0x23')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x81c3('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0x81c3('0x8')](0x5)[_0x81c3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x81c3('0x8')](0x3)[_0x81c3('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x81c3('0x8')](0x5)[_0x81c3('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x81c3('0x25')}}; \ No newline at end of file +var _0x1e94=['#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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)'];(function(_0x2608cc,_0x550602){var _0x671ece=function(_0x35a8ee){while(--_0x35a8ee){_0x2608cc['push'](_0x2608cc['shift']());}};_0x671ece(++_0x550602);}(_0x1e94,0x79));var _0x41e9=function(_0x16fbff,_0x244266){_0x16fbff=_0x16fbff-0x0;var _0x547b30=_0x1e94[_0x16fbff];return _0x547b30;};'use strict';var Sequelize=require('sequelize');module[_0x41e9('0x0')]={'name':{'type':Sequelize[_0x41e9('0x1')],'unique':_0x41e9('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x41e9('0x3')](_0x41e9('0x4')),'allowNull':![],'defaultValue':_0x41e9('0x4')},'description':{'type':Sequelize[_0x41e9('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x41e9('0x5')},'limitCalls':{'type':Sequelize[_0x41e9('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x41e9('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x41e9('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x41e9('0x6')](0x3)[_0x41e9('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41e9('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x41e9('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x41e9('0x6')](0x5)[_0x41e9('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41e9('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0x41e9('0x6')](0x3)[_0x41e9('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x41e9('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41e9('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x41e9('0x6')](0x3)[_0x41e9('0x7')],'defaultValue':0x3,'comment':_0x41e9('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41e9('0xc')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x41e9('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x41e9('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x41e9('0x1')],'defaultValue':_0x41e9('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0x41e9('0x3')](_0x41e9('0xe'),'never',_0x41e9('0xf')),'defaultValue':_0x41e9('0xe')},'dialAMDActive':{'type':Sequelize[_0x41e9('0x10')],'defaultValue':0x0,'comment':_0x41e9('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x41e9('0x6')](0x9)[_0x41e9('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x41e9('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x41e9('0x6')](0x9)[_0x41e9('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x41e9('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x41e9('0x6')](0x9)[_0x41e9('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x41e9('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x41e9('0x6')](0x9)[_0x41e9('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x41e9('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x41e9('0x6')](0x9)[_0x41e9('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x41e9('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x41e9('0x6')](0x9)[_0x41e9('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x41e9('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x41e9('0x6')](0x9)[_0x41e9('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x41e9('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x41e9('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x41e9('0x6')](0x9)[_0x41e9('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x41e9('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x41e9('0x3')](_0x41e9('0x1a'),_0x41e9('0x1b')),'defaultValue':_0x41e9('0x1a')},'dialPrefix':{'type':Sequelize[_0x41e9('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x41e9('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x41e9('0x1c')},'dialCutDigit':{'type':Sequelize[_0x41e9('0x6')](0x3)[_0x41e9('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x41e9('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x41e9('0x6')](0x3)[_0x41e9('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41e9('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x41e9('0x6')](0x5)[_0x41e9('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41e9('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x41e9('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x41e9('0x6')](0x5)[_0x41e9('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41e9('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x41e9('0x6')](0x3)[_0x41e9('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41e9('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x41e9('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41e9('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x41e9('0x6')](0x3)[_0x41e9('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41e9('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x41e9('0x6')](0x5)[_0x41e9('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41e9('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x41e9('0x6')](0x3)[_0x41e9('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41e9('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x41e9('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41e9('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index f56775c..a3f27a8 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 _0x0edc=['offset','undefined','limit','count','set','json','apply','reject','save','then','destroy','IvrCampaigns','error','stack','name','Campaign','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rawAttributes','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','params','length','createdAt','omit','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','getHoppers','CmHopper','pick','CampaignId','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','phone','NOW()','field','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','deletedAt\x20IS\x20NULL','push','sequelize','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','all','removeBlackLists','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status'];(function(_0x50f895,_0x181963){var _0x39ded7=function(_0x3d1fd5){while(--_0x3d1fd5){_0x50f895['push'](_0x50f895['shift']());}};_0x39ded7(++_0x181963);}(_0x0edc,0xf8));var _0xc0ed=function(_0x2983c9,_0x4ecd48){_0x2983c9=_0x2983c9-0x0;var _0xdbe7dc=_0x0edc[_0x2983c9];return _0xdbe7dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc0ed('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc0ed('0x1'));var rp=require(_0xc0ed('0x2'));var moment=require('moment');var BPromise=require(_0xc0ed('0x3'));var Mustache=require(_0xc0ed('0x4'));var util=require('util');var path=require(_0xc0ed('0x5'));var sox=require(_0xc0ed('0x6'));var csv=require('to-csv');var ejs=require(_0xc0ed('0x7'));var fs=require('fs');var fs_extra=require(_0xc0ed('0x8'));var _=require(_0xc0ed('0x9'));var squel=require(_0xc0ed('0xa'));var crypto=require('crypto');var jsforce=require(_0xc0ed('0xb'));var deskjs=require(_0xc0ed('0xc'));var toCsv=require(_0xc0ed('0xd'));var querystring=require(_0xc0ed('0xe'));var Papa=require(_0xc0ed('0xf'));var Redis=require(_0xc0ed('0x10'));var authService=require(_0xc0ed('0x11'));var qs=require(_0xc0ed('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc0ed('0x13'));var logger=require(_0xc0ed('0x14'))(_0xc0ed('0x15'));var utils=require(_0xc0ed('0x16'));var config=require(_0xc0ed('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc0ed('0x18'))['db'];function respondWithStatusCode(_0x7a6308,_0x5d3f1f){_0x5d3f1f=_0x5d3f1f||0xcc;return function(_0x42b13e){if(_0x42b13e){return _0x7a6308[_0xc0ed('0x19')](_0x5d3f1f);}return _0x7a6308['status'](_0x5d3f1f)[_0xc0ed('0x1a')]();};}function respondWithResult(_0x1afa2d,_0x5a03a3){_0x5a03a3=_0x5a03a3||0xc8;return function(_0x300cf7){if(_0x300cf7){return _0x1afa2d[_0xc0ed('0x1b')](_0x5a03a3)['json'](_0x300cf7);}};}function respondWithFilteredResult(_0x46405d,_0x1ac39a){return function(_0x1e4383){if(_0x1e4383){var _0x44406f=typeof _0x1ac39a[_0xc0ed('0x1c')]===_0xc0ed('0x1d')&&typeof _0x1ac39a[_0xc0ed('0x1e')]===_0xc0ed('0x1d');var _0x3c2e1c=_0x1e4383[_0xc0ed('0x1f')];var _0x12f776=_0x44406f?0x0:_0x1ac39a['offset'];var _0x47c26e=_0x44406f?_0x1e4383[_0xc0ed('0x1f')]:_0x1ac39a[_0xc0ed('0x1c')]+_0x1ac39a[_0xc0ed('0x1e')];var _0x21400d;if(_0x47c26e>=_0x3c2e1c){_0x47c26e=_0x3c2e1c;_0x21400d=0xc8;}else{_0x21400d=0xce;}_0x46405d[_0xc0ed('0x1b')](_0x21400d);return _0x46405d[_0xc0ed('0x20')]('Content-Range',_0x12f776+'-'+_0x47c26e+'/'+_0x3c2e1c)[_0xc0ed('0x21')](_0x1e4383);}return null;};}function patchUpdates(_0x2a0f0d){return function(_0x515672){try{jsonpatch[_0xc0ed('0x22')](_0x515672,_0x2a0f0d,!![]);}catch(_0x6717bd){return BPromise[_0xc0ed('0x23')](_0x6717bd);}return _0x515672[_0xc0ed('0x24')]();};}function saveUpdates(_0xaf9b05,_0x35b9d7){return function(_0x5d6ead){if(_0x5d6ead){return _0x5d6ead['update'](_0xaf9b05)[_0xc0ed('0x25')](function(_0x51c059){return _0x51c059;});}return null;};}function removeEntity(_0x5e78c9,_0x5682b0){return function(_0x4fc477){if(_0x4fc477){return _0x4fc477[_0xc0ed('0x26')]()[_0xc0ed('0x25')](function(){var _0x34bd60=_0x4fc477['get']({'plain':!![]});var _0x4b8d1d=_0xc0ed('0x27');return db['UserProfileResource'][_0xc0ed('0x26')]({'where':{'type':_0x4b8d1d,'resourceId':_0x34bd60['id']}})[_0xc0ed('0x25')](function(){return _0x4fc477;});})[_0xc0ed('0x25')](function(){_0x5e78c9[_0xc0ed('0x1b')](0xcc)[_0xc0ed('0x1a')]();});}};}function handleEntityNotFound(_0x136e01,_0x39f5bc){return function(_0x57792c){if(!_0x57792c){_0x136e01[_0xc0ed('0x19')](0x194);}return _0x57792c;};}function handleError(_0x20bf6a,_0x3f27f9){_0x3f27f9=_0x3f27f9||0x1f4;return function(_0x2fbea0){logger[_0xc0ed('0x28')](_0x2fbea0[_0xc0ed('0x29')]);if(_0x2fbea0['name']){delete _0x2fbea0[_0xc0ed('0x2a')];}_0x20bf6a['status'](_0x3f27f9)['send'](_0x2fbea0);};}exports['index']=function(_0x2bb9a2,_0x4ace9c){var _0x3666cc={},_0x4d39cc={},_0x1ff84b={'count':0x0,'rows':[]};var _0x4bce3d=_['map'](db[_0xc0ed('0x2b')]['rawAttributes'],function(_0x220e88){return{'name':_0x220e88[_0xc0ed('0x2c')],'type':_0x220e88[_0xc0ed('0x2d')][_0xc0ed('0x2e')]};});_0x4d39cc[_0xc0ed('0x2f')]=_[_0xc0ed('0x30')](_0x4bce3d,_0xc0ed('0x2a'));_0x4d39cc['query']=_[_0xc0ed('0x31')](_0x2bb9a2[_0xc0ed('0x32')]);_0x4d39cc[_0xc0ed('0x33')]=_[_0xc0ed('0x34')](_0x4d39cc[_0xc0ed('0x2f')],_0x4d39cc[_0xc0ed('0x32')]);_0x3666cc['attributes']=_['intersection'](_0x4d39cc[_0xc0ed('0x2f')],qs[_0xc0ed('0x35')](_0x2bb9a2[_0xc0ed('0x32')][_0xc0ed('0x35')]));_0x3666cc[_0xc0ed('0x36')]=_0x3666cc[_0xc0ed('0x36')]['length']?_0x3666cc[_0xc0ed('0x36')]:_0x4d39cc[_0xc0ed('0x2f')];if(!_0x2bb9a2[_0xc0ed('0x32')][_0xc0ed('0x37')](_0xc0ed('0x38'))){_0x3666cc[_0xc0ed('0x1e')]=qs[_0xc0ed('0x1e')](_0x2bb9a2[_0xc0ed('0x32')]['limit']);_0x3666cc[_0xc0ed('0x1c')]=qs[_0xc0ed('0x1c')](_0x2bb9a2[_0xc0ed('0x32')][_0xc0ed('0x1c')]);}_0x3666cc[_0xc0ed('0x39')]=qs['sort'](_0x2bb9a2[_0xc0ed('0x32')][_0xc0ed('0x3a')]);_0x3666cc[_0xc0ed('0x3b')]=qs['filters'](_['pick'](_0x2bb9a2['query'],_0x4d39cc['filters']),_0x4bce3d);if(_0x2bb9a2[_0xc0ed('0x32')][_0xc0ed('0x3c')]){_0x3666cc['where']=_[_0xc0ed('0x3d')](_0x3666cc[_0xc0ed('0x3b')],{'$or':_[_0xc0ed('0x30')](_0x4bce3d,function(_0x4e0625){if(_0x4e0625['type']!==_0xc0ed('0x3e')){var _0x5f334a={};_0x5f334a[_0x4e0625['name']]={'$like':'%'+_0x2bb9a2[_0xc0ed('0x32')]['filter']+'%'};return _0x5f334a;}})});}_0x3666cc=_['merge']({},_0x3666cc,_0x2bb9a2[_0xc0ed('0x3f')]);var _0x4f2287={'where':_0x3666cc[_0xc0ed('0x3b')]};return db[_0xc0ed('0x2b')][_0xc0ed('0x1f')](_0x4f2287)[_0xc0ed('0x25')](function(_0x45cdb5){_0x1ff84b[_0xc0ed('0x1f')]=_0x45cdb5;if(_0x2bb9a2[_0xc0ed('0x32')][_0xc0ed('0x40')]){_0x3666cc[_0xc0ed('0x41')]=[{'all':!![]}];}return db['Campaign'][_0xc0ed('0x42')](_0x3666cc);})[_0xc0ed('0x25')](function(_0x38cf43){_0x1ff84b['rows']=_0x38cf43;return _0x1ff84b;})[_0xc0ed('0x25')](respondWithFilteredResult(_0x4ace9c,_0x3666cc))['catch'](handleError(_0x4ace9c,null));};exports['show']=function(_0x2af425,_0x4dc24e){var _0xd007c9={'raw':![],'where':{'id':_0x2af425['params']['id']}},_0x5430db={};_0x5430db[_0xc0ed('0x2f')]=_[_0xc0ed('0x31')](db[_0xc0ed('0x2b')][_0xc0ed('0x43')]);_0x5430db[_0xc0ed('0x32')]=_[_0xc0ed('0x31')](_0x2af425['query']);_0x5430db['filters']=_[_0xc0ed('0x34')](_0x5430db[_0xc0ed('0x2f')],_0x5430db[_0xc0ed('0x32')]);_0xd007c9['attributes']=_[_0xc0ed('0x34')](_0x5430db['model'],qs['fields'](_0x2af425[_0xc0ed('0x32')][_0xc0ed('0x35')]));_0xd007c9['attributes']=_0xd007c9[_0xc0ed('0x36')]['length']?_0xd007c9['attributes']:_0x5430db['model'];if(_0x2af425['query']['includeAll']){_0xd007c9['include']=[{'all':!![]}];}_0xd007c9=_[_0xc0ed('0x3d')]({},_0xd007c9,_0x2af425[_0xc0ed('0x3f')]);return db[_0xc0ed('0x2b')]['find'](_0xd007c9)[_0xc0ed('0x25')](handleEntityNotFound(_0x4dc24e,null))[_0xc0ed('0x25')](respondWithResult(_0x4dc24e,null))[_0xc0ed('0x44')](handleError(_0x4dc24e,null));};exports[_0xc0ed('0x45')]=function(_0x51e1dd,_0x654cb1){return db[_0xc0ed('0x2b')][_0xc0ed('0x45')](_0x51e1dd[_0xc0ed('0x46')],{})[_0xc0ed('0x25')](function(_0x336d72){var _0x49a55e=_0x51e1dd[_0xc0ed('0x47')][_0xc0ed('0x48')]({'plain':!![]});if(!_0x49a55e)throw new Error(_0xc0ed('0x49'));if(_0x49a55e[_0xc0ed('0x4a')]==='user'){var _0x53dead=_0x336d72[_0xc0ed('0x48')]({'plain':!![]});var _0x3be2ec=_0xc0ed('0x27');return db[_0xc0ed('0x4b')]['find']({'where':{'name':_0x3be2ec,'userProfileId':_0x49a55e[_0xc0ed('0x4c')]},'raw':!![]})[_0xc0ed('0x25')](function(_0x41d5ef){if(_0x41d5ef&&_0x41d5ef[_0xc0ed('0x4d')]===0x0){return db[_0xc0ed('0x4e')]['create']({'name':_0x53dead[_0xc0ed('0x2a')],'resourceId':_0x53dead['id'],'type':_0x41d5ef['name'],'sectionId':_0x41d5ef['id']},{})['then'](function(){return _0x336d72;});}else{return _0x336d72;}})['catch'](function(_0x1c6121){logger[_0xc0ed('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c6121);throw _0x1c6121;});}return _0x336d72;})[_0xc0ed('0x25')](respondWithResult(_0x654cb1,0xc9))[_0xc0ed('0x44')](handleError(_0x654cb1,null));};exports[_0xc0ed('0x4f')]=function(_0x315ab6,_0x3d253c){var _0x51d1b2={'where':{'id':_0x315ab6[_0xc0ed('0x50')]['id']}},_0x421772={};_0x421772[_0xc0ed('0x2f')]=_[_0xc0ed('0x31')](db['Campaign'][_0xc0ed('0x43')]);_0x51d1b2[_0xc0ed('0x36')]=_[_0xc0ed('0x34')](_0x421772[_0xc0ed('0x2f')],qs[_0xc0ed('0x35')](_0x315ab6['query'][_0xc0ed('0x35')]));_0x51d1b2['attributes']=_0x51d1b2[_0xc0ed('0x36')][_0xc0ed('0x51')]?_0x51d1b2['attributes']:_0x421772[_0xc0ed('0x2f')];if(_0x315ab6[_0xc0ed('0x32')]['includeAll']){_0x51d1b2['include']=[{'all':!![]}];}_0x51d1b2=_[_0xc0ed('0x3d')]({},_0x51d1b2,_0x315ab6[_0xc0ed('0x3f')]);return db[_0xc0ed('0x2b')]['find'](_0x51d1b2)['then'](handleEntityNotFound(_0x3d253c,null))[_0xc0ed('0x25')](function(_0x5bc01a){if(_0x5bc01a){var _0x122e13=_0x5bc01a['get']({'plain':!![]});_0x122e13=qs['omit'](_0x122e13,['id',_0xc0ed('0x52'),'updatedAt']);_0x315ab6['body']=_[_0xc0ed('0x53')](_0x315ab6[_0xc0ed('0x46')],['id',_0xc0ed('0x52'),_0xc0ed('0x54')]);return db['Campaign'][_0xc0ed('0x45')](_[_0xc0ed('0x3d')](_0x122e13,_0x315ab6[_0xc0ed('0x46')]),{'include':_0x315ab6[_0xc0ed('0x32')][_0xc0ed('0x40')]?[{'all':!![]}]:undefined})[_0xc0ed('0x25')](function(_0x5be413){var _0x29a5c4=_0x315ab6[_0xc0ed('0x47')]['get']({'plain':!![]});if(!_0x29a5c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29a5c4[_0xc0ed('0x4a')]==='user'){var _0x42bb8e=_0x5be413[_0xc0ed('0x48')]({'plain':!![]});var _0x3387df=_0xc0ed('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x3387df,'userProfileId':_0x29a5c4[_0xc0ed('0x4c')]},'raw':!![]})[_0xc0ed('0x25')](function(_0x2b6cab){if(_0x2b6cab&&_0x2b6cab[_0xc0ed('0x4d')]===0x0){return db[_0xc0ed('0x4e')][_0xc0ed('0x45')]({'name':_0x42bb8e['name'],'resourceId':_0x42bb8e['id'],'type':_0x2b6cab[_0xc0ed('0x2a')],'sectionId':_0x2b6cab['id']},{})[_0xc0ed('0x25')](function(){return _0x5be413;});}else{return _0x5be413;}})[_0xc0ed('0x44')](function(_0x1f818e){logger[_0xc0ed('0x28')](_0xc0ed('0x55'),_0x1f818e);throw _0x1f818e;});}return _0x5be413;});}})[_0xc0ed('0x25')](respondWithResult(_0x3d253c,0xc9))['catch'](handleError(_0x3d253c,null));};exports[_0xc0ed('0x56')]=function(_0x5779f8,_0x13617e){if(_0x5779f8['body']['id']){delete _0x5779f8[_0xc0ed('0x46')]['id'];}return db[_0xc0ed('0x2b')]['find']({'where':{'id':_0x5779f8[_0xc0ed('0x50')]['id']}})[_0xc0ed('0x25')](handleEntityNotFound(_0x13617e,null))[_0xc0ed('0x25')](saveUpdates(_0x5779f8['body'],null))[_0xc0ed('0x25')](respondWithResult(_0x13617e,null))['catch'](handleError(_0x13617e,null));};exports['destroy']=function(_0x41df51,_0x29ed88){return db[_0xc0ed('0x2b')][_0xc0ed('0x57')]({'where':{'id':_0x41df51[_0xc0ed('0x50')]['id']}})['then'](handleEntityNotFound(_0x29ed88,null))['then'](removeEntity(_0x29ed88,null))['catch'](handleError(_0x29ed88,null));};exports[_0xc0ed('0x58')]=function(_0x375363,_0x34074a,_0x5df836){var _0x440ada={'raw':!![],'where':{}};var _0x70d638={};var _0x3b9140={'count':0x0,'rows':[]};return db[_0xc0ed('0x2b')]['findOne']({'where':{'id':_0x375363[_0xc0ed('0x50')]['id']}})[_0xc0ed('0x25')](handleEntityNotFound(_0x34074a,null))['then'](function(_0x5f6555){if(_0x5f6555){_0x70d638[_0xc0ed('0x2f')]=_[_0xc0ed('0x31')](db[_0xc0ed('0x59')][_0xc0ed('0x43')]);_0x70d638[_0xc0ed('0x32')]=_[_0xc0ed('0x31')](_0x375363[_0xc0ed('0x32')]);_0x70d638[_0xc0ed('0x33')]=_[_0xc0ed('0x34')](_0x70d638[_0xc0ed('0x2f')],_0x70d638['query']);_0x440ada['attributes']=_[_0xc0ed('0x34')](_0x70d638['model'],qs['fields'](_0x375363[_0xc0ed('0x32')]['fields']));_0x440ada[_0xc0ed('0x36')]=_0x440ada[_0xc0ed('0x36')]['length']?_0x440ada[_0xc0ed('0x36')]:_0x70d638[_0xc0ed('0x2f')];if(!_0x375363[_0xc0ed('0x32')][_0xc0ed('0x37')](_0xc0ed('0x38'))){_0x440ada[_0xc0ed('0x1e')]=qs[_0xc0ed('0x1e')](_0x375363[_0xc0ed('0x32')][_0xc0ed('0x1e')]);_0x440ada[_0xc0ed('0x1c')]=qs['offset'](_0x375363[_0xc0ed('0x32')][_0xc0ed('0x1c')]);}_0x440ada[_0xc0ed('0x39')]=qs['sort'](_0x375363[_0xc0ed('0x32')][_0xc0ed('0x3a')]);_0x440ada[_0xc0ed('0x3b')]=qs[_0xc0ed('0x33')](_[_0xc0ed('0x5a')](_0x375363[_0xc0ed('0x32')],_0x70d638[_0xc0ed('0x33')]));_0x440ada[_0xc0ed('0x3b')][_0xc0ed('0x5b')]=_0x5f6555['id'];if(_0x375363[_0xc0ed('0x32')][_0xc0ed('0x3c')]){_0x440ada['where']=_[_0xc0ed('0x3d')](_0x440ada[_0xc0ed('0x3b')],{'$or':_[_0xc0ed('0x30')](_0x440ada[_0xc0ed('0x36')],function(_0x4ad731){var _0x275dd9={};_0x275dd9[_0x4ad731]={'$like':'%'+_0x375363['query'][_0xc0ed('0x3c')]+'%'};return _0x275dd9;})});}_0x440ada=_[_0xc0ed('0x3d')]({},_0x440ada,_0x375363[_0xc0ed('0x3f')]);return db['CmHopper'][_0xc0ed('0x1f')]({'where':_0x440ada[_0xc0ed('0x3b')]})['then'](function(_0x17420c){_0x3b9140[_0xc0ed('0x1f')]=_0x17420c;if(_0x375363[_0xc0ed('0x32')][_0xc0ed('0x40')]){_0x440ada[_0xc0ed('0x41')]=[{'all':!![]}];}return db[_0xc0ed('0x59')][_0xc0ed('0x42')](_0x440ada);})[_0xc0ed('0x25')](function(_0x4726e6){_0x3b9140[_0xc0ed('0x5c')]=_0x4726e6;return _0x3b9140;});}})[_0xc0ed('0x25')](respondWithFilteredResult(_0x34074a,_0x440ada))[_0xc0ed('0x44')](handleError(_0x34074a,null));};exports[_0xc0ed('0x5d')]=function(_0x1e80a1,_0x310f91,_0x597c7c){var _0x90c34c={'raw':!![],'where':{}};var _0x341071={};var _0x599495={'count':0x0,'rows':[]};return db[_0xc0ed('0x2b')][_0xc0ed('0x5e')]({'where':{'id':_0x1e80a1[_0xc0ed('0x50')]['id']}})[_0xc0ed('0x25')](handleEntityNotFound(_0x310f91,null))[_0xc0ed('0x25')](function(_0x5892b2){if(_0x5892b2){_0x341071[_0xc0ed('0x2f')]=_[_0xc0ed('0x31')](db[_0xc0ed('0x5f')]['rawAttributes']);_0x341071[_0xc0ed('0x32')]=_[_0xc0ed('0x31')](_0x1e80a1[_0xc0ed('0x32')]);_0x341071['filters']=_[_0xc0ed('0x34')](_0x341071['model'],_0x341071['query']);_0x90c34c['attributes']=_['intersection'](_0x341071[_0xc0ed('0x2f')],qs['fields'](_0x1e80a1['query']['fields']));_0x90c34c[_0xc0ed('0x36')]=_0x90c34c[_0xc0ed('0x36')][_0xc0ed('0x51')]?_0x90c34c['attributes']:_0x341071[_0xc0ed('0x2f')];if(!_0x1e80a1['query'][_0xc0ed('0x37')](_0xc0ed('0x38'))){_0x90c34c[_0xc0ed('0x1e')]=qs[_0xc0ed('0x1e')](_0x1e80a1[_0xc0ed('0x32')][_0xc0ed('0x1e')]);_0x90c34c[_0xc0ed('0x1c')]=qs[_0xc0ed('0x1c')](_0x1e80a1[_0xc0ed('0x32')]['offset']);}_0x90c34c[_0xc0ed('0x39')]=qs['sort'](_0x1e80a1[_0xc0ed('0x32')][_0xc0ed('0x3a')]);_0x90c34c[_0xc0ed('0x3b')]=qs[_0xc0ed('0x33')](_[_0xc0ed('0x5a')](_0x1e80a1[_0xc0ed('0x32')],_0x341071[_0xc0ed('0x33')]));_0x90c34c[_0xc0ed('0x3b')]['CampaignId']=_0x5892b2['id'];if(_0x1e80a1[_0xc0ed('0x32')]['filter']){_0x90c34c[_0xc0ed('0x3b')]=_[_0xc0ed('0x3d')](_0x90c34c[_0xc0ed('0x3b')],{'$or':_[_0xc0ed('0x30')](_0x90c34c['attributes'],function(_0x309d2e){var _0x1f0753={};_0x1f0753[_0x309d2e]={'$like':'%'+_0x1e80a1[_0xc0ed('0x32')][_0xc0ed('0x3c')]+'%'};return _0x1f0753;})});}_0x90c34c=_[_0xc0ed('0x3d')]({},_0x90c34c,_0x1e80a1[_0xc0ed('0x3f')]);return db[_0xc0ed('0x5f')][_0xc0ed('0x1f')]({'where':_0x90c34c['where']})['then'](function(_0x46efa4){_0x599495['count']=_0x46efa4;if(_0x1e80a1[_0xc0ed('0x32')]['includeAll']){_0x90c34c['include']=[{'all':!![]}];}return db[_0xc0ed('0x5f')][_0xc0ed('0x42')](_0x90c34c);})[_0xc0ed('0x25')](function(_0xbaec00){_0x599495[_0xc0ed('0x5c')]=_0xbaec00;return _0x599495;});}})[_0xc0ed('0x25')](respondWithFilteredResult(_0x310f91,_0x90c34c))[_0xc0ed('0x44')](handleError(_0x310f91,null));};exports[_0xc0ed('0x60')]=function(_0x30d1bc,_0xd52a0b,_0x37d961){var _0x4a8dee={'raw':!![],'where':{}};var _0x28a219={};var _0x2c0dcd={'count':0x0,'rows':[]};return db[_0xc0ed('0x2b')][_0xc0ed('0x5e')]({'where':{'id':_0x30d1bc[_0xc0ed('0x50')]['id']}})['then'](handleEntityNotFound(_0xd52a0b,null))[_0xc0ed('0x25')](function(_0x2ca330){if(_0x2ca330){_0x28a219[_0xc0ed('0x2f')]=_['keys'](db[_0xc0ed('0x61')][_0xc0ed('0x43')]);_0x28a219[_0xc0ed('0x32')]=_['keys'](_0x30d1bc['query']);_0x28a219['filters']=_[_0xc0ed('0x34')](_0x28a219[_0xc0ed('0x2f')],_0x28a219[_0xc0ed('0x32')]);_0x4a8dee[_0xc0ed('0x36')]=_[_0xc0ed('0x34')](_0x28a219[_0xc0ed('0x2f')],qs[_0xc0ed('0x35')](_0x30d1bc[_0xc0ed('0x32')][_0xc0ed('0x35')]));_0x4a8dee[_0xc0ed('0x36')]=_0x4a8dee[_0xc0ed('0x36')][_0xc0ed('0x51')]?_0x4a8dee[_0xc0ed('0x36')]:_0x28a219[_0xc0ed('0x2f')];if(!_0x30d1bc[_0xc0ed('0x32')]['hasOwnProperty'](_0xc0ed('0x38'))){_0x4a8dee[_0xc0ed('0x1e')]=qs[_0xc0ed('0x1e')](_0x30d1bc[_0xc0ed('0x32')][_0xc0ed('0x1e')]);_0x4a8dee[_0xc0ed('0x1c')]=qs['offset'](_0x30d1bc[_0xc0ed('0x32')][_0xc0ed('0x1c')]);}_0x4a8dee[_0xc0ed('0x39')]=qs[_0xc0ed('0x3a')](_0x30d1bc[_0xc0ed('0x32')][_0xc0ed('0x3a')]);_0x4a8dee[_0xc0ed('0x3b')]=qs['filters'](_[_0xc0ed('0x5a')](_0x30d1bc[_0xc0ed('0x32')],_0x28a219[_0xc0ed('0x33')]));_0x4a8dee['where'][_0xc0ed('0x5b')]=_0x2ca330['id'];if(_0x30d1bc[_0xc0ed('0x32')][_0xc0ed('0x3c')]){_0x4a8dee[_0xc0ed('0x3b')]=_[_0xc0ed('0x3d')](_0x4a8dee[_0xc0ed('0x3b')],{'$or':_[_0xc0ed('0x30')](_0x4a8dee[_0xc0ed('0x36')],function(_0x344469){var _0x1c6dde={};_0x1c6dde[_0x344469]={'$like':'%'+_0x30d1bc[_0xc0ed('0x32')][_0xc0ed('0x3c')]+'%'};return _0x1c6dde;})});}_0x4a8dee=_['merge']({},_0x4a8dee,_0x30d1bc[_0xc0ed('0x3f')]);return db[_0xc0ed('0x61')]['count']({'where':_0x4a8dee[_0xc0ed('0x3b')]})[_0xc0ed('0x25')](function(_0x2d26bb){_0x2c0dcd[_0xc0ed('0x1f')]=_0x2d26bb;if(_0x30d1bc['query'][_0xc0ed('0x40')]){_0x4a8dee['include']=[{'all':!![]}];}return db[_0xc0ed('0x61')][_0xc0ed('0x42')](_0x4a8dee);})[_0xc0ed('0x25')](function(_0x2be9ae){_0x2c0dcd['rows']=_0x2be9ae;return _0x2c0dcd;});}})[_0xc0ed('0x25')](respondWithFilteredResult(_0xd52a0b,_0x4a8dee))[_0xc0ed('0x44')](handleError(_0xd52a0b,null));};exports[_0xc0ed('0x62')]=function(_0x4f4162,_0x43f869,_0x5a47f4){var _0x323044={'raw':!![],'where':{}};var _0x249441={};var _0x2e16ca={'count':0x0,'rows':[]};return db[_0xc0ed('0x2b')][_0xc0ed('0x5e')]({'where':{'id':_0x4f4162[_0xc0ed('0x50')]['id']}})[_0xc0ed('0x25')](handleEntityNotFound(_0x43f869,null))[_0xc0ed('0x25')](function(_0x3c2c47){if(_0x3c2c47){_0x249441[_0xc0ed('0x2f')]=_[_0xc0ed('0x31')](db[_0xc0ed('0x63')][_0xc0ed('0x43')]);_0x249441[_0xc0ed('0x32')]=_[_0xc0ed('0x31')](_0x4f4162[_0xc0ed('0x32')]);_0x249441['filters']=_[_0xc0ed('0x34')](_0x249441[_0xc0ed('0x2f')],_0x249441[_0xc0ed('0x32')]);_0x323044[_0xc0ed('0x36')]=_[_0xc0ed('0x34')](_0x249441[_0xc0ed('0x2f')],qs['fields'](_0x4f4162[_0xc0ed('0x32')]['fields']));_0x323044['attributes']=_0x323044['attributes'][_0xc0ed('0x51')]?_0x323044['attributes']:_0x249441['model'];if(!_0x4f4162[_0xc0ed('0x32')]['hasOwnProperty']('nolimit')){_0x323044[_0xc0ed('0x1e')]=qs[_0xc0ed('0x1e')](_0x4f4162['query'][_0xc0ed('0x1e')]);_0x323044[_0xc0ed('0x1c')]=qs[_0xc0ed('0x1c')](_0x4f4162[_0xc0ed('0x32')]['offset']);}_0x323044['order']=qs[_0xc0ed('0x3a')](_0x4f4162[_0xc0ed('0x32')][_0xc0ed('0x3a')]);_0x323044[_0xc0ed('0x3b')]=qs[_0xc0ed('0x33')](_[_0xc0ed('0x5a')](_0x4f4162[_0xc0ed('0x32')],_0x249441[_0xc0ed('0x33')]));_0x323044[_0xc0ed('0x3b')][_0xc0ed('0x5b')]=_0x3c2c47['id'];if(_0x4f4162['query'][_0xc0ed('0x3c')]){_0x323044['where']=_[_0xc0ed('0x3d')](_0x323044[_0xc0ed('0x3b')],{'$or':_[_0xc0ed('0x30')](_0x323044['attributes'],function(_0x2c11aa){var _0x4f3d10={};_0x4f3d10[_0x2c11aa]={'$like':'%'+_0x4f4162[_0xc0ed('0x32')]['filter']+'%'};return _0x4f3d10;})});}_0x323044=_[_0xc0ed('0x3d')]({},_0x323044,_0x4f4162[_0xc0ed('0x3f')]);return db[_0xc0ed('0x63')]['count']({'where':_0x323044[_0xc0ed('0x3b')]})['then'](function(_0x4acd5e){_0x2e16ca[_0xc0ed('0x1f')]=_0x4acd5e;if(_0x4f4162['query'][_0xc0ed('0x40')]){_0x323044['include']=[{'all':!![]}];}return db[_0xc0ed('0x63')][_0xc0ed('0x42')](_0x323044);})['then'](function(_0xb2180e){_0x2e16ca[_0xc0ed('0x5c')]=_0xb2180e;return _0x2e16ca;});}})[_0xc0ed('0x25')](respondWithFilteredResult(_0x43f869,_0x323044))['catch'](handleError(_0x43f869,null));};exports[_0xc0ed('0x64')]=function(_0x1704d0,_0x2b86c5,_0x491c08){var _0x55eda6={};var _0x5cd56d={};var _0xb3eb39;var _0x1ba171;return db[_0xc0ed('0x2b')]['findOne']({'where':{'id':_0x1704d0[_0xc0ed('0x50')]['id']}})['then'](handleEntityNotFound(_0x2b86c5,null))['then'](function(_0x70c48){if(_0x70c48){_0xb3eb39=_0x70c48;_0x5cd56d[_0xc0ed('0x2f')]=_[_0xc0ed('0x31')](db['CmList'][_0xc0ed('0x43')]);_0x5cd56d[_0xc0ed('0x32')]=_[_0xc0ed('0x31')](_0x1704d0['query']);_0x5cd56d[_0xc0ed('0x33')]=_[_0xc0ed('0x34')](_0x5cd56d['model'],_0x5cd56d[_0xc0ed('0x32')]);_0x55eda6[_0xc0ed('0x36')]=_['intersection'](_0x5cd56d[_0xc0ed('0x2f')],qs[_0xc0ed('0x35')](_0x1704d0[_0xc0ed('0x32')][_0xc0ed('0x35')]));_0x55eda6[_0xc0ed('0x36')]=_0x55eda6['attributes']['length']?_0x55eda6['attributes']:_0x5cd56d[_0xc0ed('0x2f')];_0x55eda6['order']=qs[_0xc0ed('0x3a')](_0x1704d0[_0xc0ed('0x32')][_0xc0ed('0x3a')]);_0x55eda6[_0xc0ed('0x3b')]=qs[_0xc0ed('0x33')](_[_0xc0ed('0x5a')](_0x1704d0['query'],_0x5cd56d[_0xc0ed('0x33')]));if(_0x1704d0[_0xc0ed('0x32')]['filter']){_0x55eda6['where']=_[_0xc0ed('0x3d')](_0x55eda6[_0xc0ed('0x3b')],{'$or':_[_0xc0ed('0x30')](_0x55eda6[_0xc0ed('0x36')],function(_0x2a8366){var _0x29edd7={};_0x29edd7[_0x2a8366]={'$like':'%'+_0x1704d0[_0xc0ed('0x32')][_0xc0ed('0x3c')]+'%'};return _0x29edd7;})});}_0x55eda6=_[_0xc0ed('0x3d')]({},_0x55eda6,_0x1704d0[_0xc0ed('0x3f')]);return _0xb3eb39['getLists'](_0x55eda6);}})[_0xc0ed('0x25')](function(_0x1fb337){if(_0x1fb337){_0x1ba171=_0x1fb337[_0xc0ed('0x51')];if(!_0x1704d0['query'][_0xc0ed('0x37')](_0xc0ed('0x38'))){_0x55eda6[_0xc0ed('0x1e')]=qs[_0xc0ed('0x1e')](_0x1704d0['query'][_0xc0ed('0x1e')]);_0x55eda6[_0xc0ed('0x1c')]=qs['offset'](_0x1704d0['query'][_0xc0ed('0x1c')]);}return _0xb3eb39[_0xc0ed('0x64')](_0x55eda6);}})[_0xc0ed('0x25')](function(_0x2179f6){if(_0x2179f6){return _0x2179f6?{'count':_0x1ba171,'rows':_0x2179f6}:null;}})[_0xc0ed('0x25')](respondWithResult(_0x2b86c5,null))[_0xc0ed('0x44')](handleError(_0x2b86c5,null));};exports[_0xc0ed('0x65')]=function(_0x58762e,_0x435c03,_0x3aa41c){var _0x323b52,_0x56b15f;return db[_0xc0ed('0x2b')][_0xc0ed('0x57')]({'where':{'id':_0x58762e['params']['id']}})[_0xc0ed('0x25')](handleEntityNotFound(_0x435c03,null))[_0xc0ed('0x25')](function(_0x19b4d6){if(_0x19b4d6){_0x56b15f=_0x19b4d6;return _0x19b4d6[_0xc0ed('0x65')](_0x58762e['body'][_0xc0ed('0x66')],_[_0xc0ed('0x53')](_0x58762e['body'],[_0xc0ed('0x66'),'id'])||{});}return null;})[_0xc0ed('0x67')](function(_0x1c65c3){var _0x3a38b8;_0x323b52=_0x1c65c3||[];var _0x56db26=[];if(_0x1c65c3){for(var _0x321a26=0x0;_0x321a26<_0x1c65c3[_0xc0ed('0x51')];_0x321a26+=0x1){var _0x3254b1=_0x1c65c3[_0x321a26][_0xc0ed('0x48')]({'plain':!![]});_0x56b15f['dialCheckDuplicateType']=_0x58762e['body']['dialCheckDuplicateType']?_0x58762e[_0xc0ed('0x46')][_0xc0ed('0x68')]:_0x56b15f['dialCheckDuplicateType'];switch(_0x56b15f['dialCheckDuplicateType']){case _0xc0ed('0x69'):_0x3a38b8=squel[_0xc0ed('0x6a')]()[_0xc0ed('0x6b')](_0xc0ed('0x6c'))[_0xc0ed('0x6d')](['phone',_0xc0ed('0x6e'),_0xc0ed('0x6f'),_0xc0ed('0x70'),_0xc0ed('0x5b'),_0xc0ed('0x52'),'updatedAt'],squel[_0xc0ed('0x71')]()['field'](_0xc0ed('0x72'),_0xc0ed('0x72'))['field'](_0xc0ed('0x73'),_0xc0ed('0x6e'))['field']('id','ContactId')[_0xc0ed('0x74')](_0x3254b1[_0xc0ed('0x75')][_0xc0ed('0x76')](),_0xc0ed('0x70'))['field'](_0x58762e[_0xc0ed('0x50')]['id'][_0xc0ed('0x76')](),_0xc0ed('0x5b'))[_0xc0ed('0x74')](_0xc0ed('0x73'),_0xc0ed('0x52'))[_0xc0ed('0x74')](_0xc0ed('0x73'),_0xc0ed('0x54'))[_0xc0ed('0x77')](_0xc0ed('0x78'))[_0xc0ed('0x3b')]('deletedAt\x20IS\x20NULL')[_0xc0ed('0x3b')](_0xc0ed('0x79'),_0x3254b1['CmListId'][_0xc0ed('0x76')]())[_0xc0ed('0x3b')](_0xc0ed('0x7a'))[_0xc0ed('0x3b')](_0xc0ed('0x7b'),squel[_0xc0ed('0x71')]()[_0xc0ed('0x74')](_0xc0ed('0x7c'))[_0xc0ed('0x77')]('cm_hopper_final')[_0xc0ed('0x3b')]('CampaignId\x20=\x20?',_0x58762e['params']['id'][_0xc0ed('0x76')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xc0ed('0x71')]()[_0xc0ed('0x74')](_0xc0ed('0x7d'))[_0xc0ed('0x77')](_0xc0ed('0x6c'))[_0xc0ed('0x3b')](_0xc0ed('0x7e'),_0x58762e[_0xc0ed('0x50')]['id']['toString']())))[_0xc0ed('0x76')]();break;case _0xc0ed('0x7f'):_0x3a38b8=squel[_0xc0ed('0x6a')]()[_0xc0ed('0x6b')](_0xc0ed('0x6c'))[_0xc0ed('0x6d')]([_0xc0ed('0x72'),_0xc0ed('0x6e'),'ContactId','ListId',_0xc0ed('0x5b'),_0xc0ed('0x52'),_0xc0ed('0x54')],squel['select']()[_0xc0ed('0x74')](_0xc0ed('0x72'),_0xc0ed('0x72'))[_0xc0ed('0x74')]('NOW()',_0xc0ed('0x6e'))[_0xc0ed('0x74')]('id',_0xc0ed('0x6f'))[_0xc0ed('0x74')](_0x3254b1[_0xc0ed('0x75')][_0xc0ed('0x76')](),_0xc0ed('0x70'))[_0xc0ed('0x74')](_0x58762e[_0xc0ed('0x50')]['id'][_0xc0ed('0x76')](),_0xc0ed('0x5b'))[_0xc0ed('0x74')](_0xc0ed('0x73'),_0xc0ed('0x52'))[_0xc0ed('0x74')]('NOW()',_0xc0ed('0x54'))[_0xc0ed('0x77')]('cm_contacts')[_0xc0ed('0x3b')](_0xc0ed('0x80'))[_0xc0ed('0x3b')](_0xc0ed('0x79'),_0x3254b1['CmListId'][_0xc0ed('0x76')]())[_0xc0ed('0x3b')](_0xc0ed('0x7a'))[_0xc0ed('0x3b')](_0xc0ed('0x7b'),squel['select']()[_0xc0ed('0x74')](_0xc0ed('0x7d'))[_0xc0ed('0x77')](_0xc0ed('0x6c'))[_0xc0ed('0x3b')](_0xc0ed('0x7e'),_0x58762e[_0xc0ed('0x50')]['id']['toString']())))[_0xc0ed('0x76')]();break;default:_0x3a38b8=squel[_0xc0ed('0x6a')]()['into'](_0xc0ed('0x6c'))[_0xc0ed('0x6d')]([_0xc0ed('0x72'),'scheduledAt','ContactId',_0xc0ed('0x70'),_0xc0ed('0x5b'),_0xc0ed('0x52'),_0xc0ed('0x54')],squel[_0xc0ed('0x71')]()['field'](_0xc0ed('0x72'),'phone')['field']('NOW()',_0xc0ed('0x6e'))['field']('id',_0xc0ed('0x6f'))[_0xc0ed('0x74')](_0x3254b1[_0xc0ed('0x75')][_0xc0ed('0x76')](),_0xc0ed('0x70'))[_0xc0ed('0x74')](_0x58762e[_0xc0ed('0x50')]['id'][_0xc0ed('0x76')](),_0xc0ed('0x5b'))['field'](_0xc0ed('0x73'),_0xc0ed('0x52'))[_0xc0ed('0x74')](_0xc0ed('0x73'),_0xc0ed('0x54'))[_0xc0ed('0x77')](_0xc0ed('0x78'))[_0xc0ed('0x3b')](_0xc0ed('0x80'))[_0xc0ed('0x3b')](_0xc0ed('0x79'),_0x3254b1[_0xc0ed('0x75')][_0xc0ed('0x76')]())[_0xc0ed('0x3b')](_0xc0ed('0x7a')))['toString']();}_0x56db26[_0xc0ed('0x81')](db[_0xc0ed('0x82')][_0xc0ed('0x32')](_0x3a38b8));}return BPromise['all'](_0x56db26);}})[_0xc0ed('0x25')](function(){return _0x323b52;})[_0xc0ed('0x25')](respondWithResult(_0x435c03,null))['catch'](handleError(_0x435c03,null));};exports[_0xc0ed('0x83')]=function(_0x324052,_0x5a9a22,_0xd4269a){return db['Campaign'][_0xc0ed('0x57')]({'where':{'id':_0x324052[_0xc0ed('0x50')]['id']}})['then'](handleEntityNotFound(_0x5a9a22,null))[_0xc0ed('0x25')](function(_0x575464){if(_0x575464){return _0x575464[_0xc0ed('0x83')](_0x324052[_0xc0ed('0x32')]['ids']);}})['then'](function(_0x11feab){if(_0x11feab){return db[_0xc0ed('0x59')]['destroy']({'where':{'ListId':_0x324052[_0xc0ed('0x32')]['ids'],'CampaignId':_0x324052[_0xc0ed('0x50')]['id']}})[_0xc0ed('0x25')](function(){return _0x11feab;});}})[_0xc0ed('0x25')](respondWithStatusCode(_0x5a9a22,null))[_0xc0ed('0x44')](handleError(_0x5a9a22,null));};exports[_0xc0ed('0x84')]=function(_0x54fbc5,_0x2be651,_0x1a4bad){var _0xd62d02={};var _0x2deb51={};var _0x19d963;var _0x2f3b0a;return db['Campaign'][_0xc0ed('0x5e')]({'where':{'id':_0x54fbc5[_0xc0ed('0x50')]['id']}})['then'](handleEntityNotFound(_0x2be651,null))['then'](function(_0x8b2ca2){if(_0x8b2ca2){_0x19d963=_0x8b2ca2;_0x2deb51[_0xc0ed('0x2f')]=_[_0xc0ed('0x31')](db[_0xc0ed('0x85')][_0xc0ed('0x43')]);_0x2deb51['query']=_[_0xc0ed('0x31')](_0x54fbc5['query']);_0x2deb51[_0xc0ed('0x33')]=_['intersection'](_0x2deb51[_0xc0ed('0x2f')],_0x2deb51[_0xc0ed('0x32')]);_0xd62d02[_0xc0ed('0x36')]=_['intersection'](_0x2deb51[_0xc0ed('0x2f')],qs[_0xc0ed('0x35')](_0x54fbc5[_0xc0ed('0x32')]['fields']));_0xd62d02[_0xc0ed('0x36')]=_0xd62d02['attributes'][_0xc0ed('0x51')]?_0xd62d02[_0xc0ed('0x36')]:_0x2deb51[_0xc0ed('0x2f')];_0xd62d02[_0xc0ed('0x39')]=qs[_0xc0ed('0x3a')](_0x54fbc5[_0xc0ed('0x32')][_0xc0ed('0x3a')]);_0xd62d02[_0xc0ed('0x3b')]=qs['filters'](_['pick'](_0x54fbc5[_0xc0ed('0x32')],_0x2deb51['filters']));if(_0x54fbc5[_0xc0ed('0x32')][_0xc0ed('0x3c')]){_0xd62d02[_0xc0ed('0x3b')]=_[_0xc0ed('0x3d')](_0xd62d02[_0xc0ed('0x3b')],{'$or':_[_0xc0ed('0x30')](_0xd62d02['attributes'],function(_0x2ee8ba){var _0x52f979={};_0x52f979[_0x2ee8ba]={'$like':'%'+_0x54fbc5[_0xc0ed('0x32')][_0xc0ed('0x3c')]+'%'};return _0x52f979;})});}_0xd62d02=_['merge']({},_0xd62d02,_0x54fbc5['options']);return _0x19d963['getBlackLists'](_0xd62d02);}})[_0xc0ed('0x25')](function(_0x22492d){if(_0x22492d){_0x2f3b0a=_0x22492d[_0xc0ed('0x51')];if(!_0x54fbc5[_0xc0ed('0x32')][_0xc0ed('0x37')](_0xc0ed('0x38'))){_0xd62d02[_0xc0ed('0x1e')]=qs[_0xc0ed('0x1e')](_0x54fbc5[_0xc0ed('0x32')][_0xc0ed('0x1e')]);_0xd62d02[_0xc0ed('0x1c')]=qs[_0xc0ed('0x1c')](_0x54fbc5['query'][_0xc0ed('0x1c')]);}return _0x19d963[_0xc0ed('0x84')](_0xd62d02);}})['then'](function(_0x36ec2c){if(_0x36ec2c){return _0x36ec2c?{'count':_0x2f3b0a,'rows':_0x36ec2c}:null;}})[_0xc0ed('0x25')](respondWithResult(_0x2be651,null))['catch'](handleError(_0x2be651,null));};exports[_0xc0ed('0x86')]=function(_0x2d480d,_0x128d9b,_0x1b3ec6){var _0x5a5c09,_0x41c500;return db[_0xc0ed('0x2b')]['find']({'where':{'id':_0x2d480d[_0xc0ed('0x50')]['id']}})[_0xc0ed('0x25')](handleEntityNotFound(_0x128d9b,null))[_0xc0ed('0x25')](function(_0x12a745){if(_0x12a745){_0x41c500=_0x12a745;return _0x12a745[_0xc0ed('0x86')](_0x2d480d[_0xc0ed('0x46')][_0xc0ed('0x66')],_['omit'](_0x2d480d[_0xc0ed('0x46')],[_0xc0ed('0x66'),'id'])||{});}return null;})[_0xc0ed('0x67')](function(_0x302e05){var _0x24777d;_0x5a5c09=_0x302e05||[];var _0x530512=[];if(_0x302e05){for(var _0x33b47f=0x0;_0x33b47f<_0x302e05['length'];_0x33b47f+=0x1){var _0x1bab12=_0x302e05[_0x33b47f][_0xc0ed('0x48')]({'plain':!![]});_0x24777d=squel[_0xc0ed('0x6a')]()['into'](_0xc0ed('0x87'))[_0xc0ed('0x6d')](['phone','ContactId','ListId','CampaignId',_0xc0ed('0x52'),'updatedAt'],squel['select']()['field']('phone','phone')[_0xc0ed('0x74')]('id',_0xc0ed('0x6f'))['field'](_0x1bab12[_0xc0ed('0x75')][_0xc0ed('0x76')](),_0xc0ed('0x70'))['field'](_0x2d480d[_0xc0ed('0x50')]['id'][_0xc0ed('0x76')](),_0xc0ed('0x5b'))[_0xc0ed('0x74')](_0xc0ed('0x73'),_0xc0ed('0x52'))[_0xc0ed('0x74')](_0xc0ed('0x73'),_0xc0ed('0x54'))['from'](_0xc0ed('0x78'))['where'](_0xc0ed('0x80'))['where']('ListId\x20=\x20?',_0x1bab12[_0xc0ed('0x75')]['toString']())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xc0ed('0x76')]();_0x530512[_0xc0ed('0x81')](db[_0xc0ed('0x82')][_0xc0ed('0x32')](_0x24777d));}return BPromise[_0xc0ed('0x88')](_0x530512);}})[_0xc0ed('0x25')](function(){return _0x5a5c09;})[_0xc0ed('0x25')](respondWithResult(_0x128d9b,null))[_0xc0ed('0x44')](handleError(_0x128d9b,null));};exports[_0xc0ed('0x89')]=function(_0x32da26,_0x1bc61a,_0xf9c062){return db[_0xc0ed('0x2b')][_0xc0ed('0x57')]({'where':{'id':_0x32da26[_0xc0ed('0x50')]['id']}})[_0xc0ed('0x25')](handleEntityNotFound(_0x1bc61a,null))[_0xc0ed('0x25')](function(_0x53ca7e){if(_0x53ca7e){return _0x53ca7e[_0xc0ed('0x89')](_0x32da26[_0xc0ed('0x32')]['ids']);}})[_0xc0ed('0x25')](function(_0x296cc6){if(_0x296cc6){return db[_0xc0ed('0x63')]['destroy']({'where':{'ListId':_0x32da26[_0xc0ed('0x32')]['ids'],'CampaignId':_0x32da26[_0xc0ed('0x50')]['id']}})[_0xc0ed('0x25')](function(){return _0x296cc6;});}})[_0xc0ed('0x25')](respondWithStatusCode(_0x1bc61a,null))[_0xc0ed('0x44')](handleError(_0x1bc61a,null));}; \ No newline at end of file +var _0x5ab4=['onlyIfOpen','insert','into','phone\x20IS\x20NOT\x20NULL','cm_contacts','push','sequelize','all','removeLists','getBlackLists','CmList','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','destroy','get','IvrCampaigns','UserProfileResource','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','find','create','body','user','UserProfileSection','userProfileId','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','findAll','CmHopperHistory','order','CampaignId','rows','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5ab4,0x8e));var _0x45ab=function(_0x3e5b10,_0x41242a){_0x3e5b10=_0x3e5b10-0x0;var _0x5315f8=_0x5ab4[_0x3e5b10];return _0x5315f8;};'use strict';var emlformat=require(_0x45ab('0x0'));var rimraf=require(_0x45ab('0x1'));var zipdir=require(_0x45ab('0x2'));var jsonpatch=require(_0x45ab('0x3'));var rp=require(_0x45ab('0x4'));var moment=require(_0x45ab('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x45ab('0x6'));var util=require('util');var path=require('path');var sox=require(_0x45ab('0x7'));var csv=require(_0x45ab('0x8'));var ejs=require(_0x45ab('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x45ab('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x45ab('0xb'));var deskjs=require(_0x45ab('0xc'));var toCsv=require('to-csv');var querystring=require(_0x45ab('0xd'));var Papa=require(_0x45ab('0xe'));var Redis=require(_0x45ab('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x45ab('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x45ab('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x45ab('0x12'));var licenseUtil=require(_0x45ab('0x13'));var db=require(_0x45ab('0x14'))['db'];function respondWithStatusCode(_0x49f686,_0x330650){_0x330650=_0x330650||0xcc;return function(_0x4e8828){if(_0x4e8828){return _0x49f686[_0x45ab('0x15')](_0x330650);}return _0x49f686[_0x45ab('0x16')](_0x330650)[_0x45ab('0x17')]();};}function respondWithResult(_0x212220,_0x2e3fa0){_0x2e3fa0=_0x2e3fa0||0xc8;return function(_0x157034){if(_0x157034){return _0x212220['status'](_0x2e3fa0)[_0x45ab('0x18')](_0x157034);}};}function respondWithFilteredResult(_0x5b1e1b,_0x2d3b8d){return function(_0x566890){if(_0x566890){var _0x3412ff=typeof _0x2d3b8d[_0x45ab('0x19')]===_0x45ab('0x1a')&&typeof _0x2d3b8d['limit']===_0x45ab('0x1a');var _0x4832cd=_0x566890['count'];var _0x4638a4=_0x3412ff?0x0:_0x2d3b8d['offset'];var _0x78c362=_0x3412ff?_0x566890[_0x45ab('0x1b')]:_0x2d3b8d['offset']+_0x2d3b8d['limit'];var _0x2b4cdb;if(_0x78c362>=_0x4832cd){_0x78c362=_0x4832cd;_0x2b4cdb=0xc8;}else{_0x2b4cdb=0xce;}_0x5b1e1b[_0x45ab('0x16')](_0x2b4cdb);return _0x5b1e1b[_0x45ab('0x1c')](_0x45ab('0x1d'),_0x4638a4+'-'+_0x78c362+'/'+_0x4832cd)['json'](_0x566890);}return null;};}function patchUpdates(_0x220741){return function(_0x3a3ebf){try{jsonpatch['apply'](_0x3a3ebf,_0x220741,!![]);}catch(_0x2f94c9){return BPromise[_0x45ab('0x1e')](_0x2f94c9);}return _0x3a3ebf[_0x45ab('0x1f')]();};}function saveUpdates(_0x50144e,_0x2d151a){return function(_0x39f338){if(_0x39f338){return _0x39f338['update'](_0x50144e)[_0x45ab('0x20')](function(_0xd75d3c){return _0xd75d3c;});}return null;};}function removeEntity(_0x46a7cc,_0x5f5102){return function(_0x4da386){if(_0x4da386){return _0x4da386[_0x45ab('0x21')]()[_0x45ab('0x20')](function(){var _0x5322c4=_0x4da386[_0x45ab('0x22')]({'plain':!![]});var _0x5e3aff=_0x45ab('0x23');return db[_0x45ab('0x24')][_0x45ab('0x21')]({'where':{'type':_0x5e3aff,'resourceId':_0x5322c4['id']}})[_0x45ab('0x20')](function(){return _0x4da386;});})['then'](function(){_0x46a7cc[_0x45ab('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35f427,_0x5c7d9e){return function(_0x5e5e78){if(!_0x5e5e78){_0x35f427[_0x45ab('0x15')](0x194);}return _0x5e5e78;};}function handleError(_0x40bff4,_0x54cc30){_0x54cc30=_0x54cc30||0x1f4;return function(_0x30207f){logger['error'](_0x30207f['stack']);if(_0x30207f['name']){delete _0x30207f[_0x45ab('0x25')];}_0x40bff4[_0x45ab('0x16')](_0x54cc30)['send'](_0x30207f);};}exports[_0x45ab('0x26')]=function(_0x430048,_0x4c0c7e){var _0x4143e8={},_0x47da52={},_0x14a4aa={'count':0x0,'rows':[]};var _0x349bf3=_[_0x45ab('0x27')](db[_0x45ab('0x28')][_0x45ab('0x29')],function(_0x5e3682){return{'name':_0x5e3682[_0x45ab('0x2a')],'type':_0x5e3682[_0x45ab('0x2b')][_0x45ab('0x2c')]};});_0x47da52[_0x45ab('0x2d')]=_[_0x45ab('0x27')](_0x349bf3,'name');_0x47da52[_0x45ab('0x2e')]=_[_0x45ab('0x2f')](_0x430048['query']);_0x47da52[_0x45ab('0x30')]=_[_0x45ab('0x31')](_0x47da52[_0x45ab('0x2d')],_0x47da52['query']);_0x4143e8['attributes']=_['intersection'](_0x47da52[_0x45ab('0x2d')],qs[_0x45ab('0x32')](_0x430048[_0x45ab('0x2e')]['fields']));_0x4143e8['attributes']=_0x4143e8[_0x45ab('0x33')][_0x45ab('0x34')]?_0x4143e8[_0x45ab('0x33')]:_0x47da52[_0x45ab('0x2d')];if(!_0x430048[_0x45ab('0x2e')][_0x45ab('0x35')](_0x45ab('0x36'))){_0x4143e8[_0x45ab('0x37')]=qs['limit'](_0x430048['query'][_0x45ab('0x37')]);_0x4143e8['offset']=qs[_0x45ab('0x19')](_0x430048['query']['offset']);}_0x4143e8['order']=qs['sort'](_0x430048[_0x45ab('0x2e')][_0x45ab('0x38')]);_0x4143e8[_0x45ab('0x39')]=qs[_0x45ab('0x30')](_[_0x45ab('0x3a')](_0x430048['query'],_0x47da52['filters']),_0x349bf3);if(_0x430048[_0x45ab('0x2e')][_0x45ab('0x3b')]){_0x4143e8[_0x45ab('0x39')]=_[_0x45ab('0x3c')](_0x4143e8[_0x45ab('0x39')],{'$or':_[_0x45ab('0x27')](_0x349bf3,function(_0x230bbf){if(_0x230bbf[_0x45ab('0x2b')]!==_0x45ab('0x3d')){var _0x12433f={};_0x12433f[_0x230bbf[_0x45ab('0x25')]]={'$like':'%'+_0x430048['query'][_0x45ab('0x3b')]+'%'};return _0x12433f;}})});}_0x4143e8=_[_0x45ab('0x3c')]({},_0x4143e8,_0x430048[_0x45ab('0x3e')]);var _0x2d19b1={'where':_0x4143e8[_0x45ab('0x39')]};return db['Campaign'][_0x45ab('0x1b')](_0x2d19b1)[_0x45ab('0x20')](function(_0x368189){_0x14a4aa[_0x45ab('0x1b')]=_0x368189;if(_0x430048[_0x45ab('0x2e')][_0x45ab('0x3f')]){_0x4143e8[_0x45ab('0x40')]=[{'all':!![]}];}return db['Campaign']['findAll'](_0x4143e8);})[_0x45ab('0x20')](function(_0x73ffa6){_0x14a4aa['rows']=_0x73ffa6;return _0x14a4aa;})['then'](respondWithFilteredResult(_0x4c0c7e,_0x4143e8))[_0x45ab('0x41')](handleError(_0x4c0c7e,null));};exports[_0x45ab('0x42')]=function(_0x4a43d4,_0x529488){var _0x2af247={'raw':![],'where':{'id':_0x4a43d4['params']['id']}},_0x490fb8={};_0x490fb8['model']=_[_0x45ab('0x2f')](db['Campaign'][_0x45ab('0x29')]);_0x490fb8[_0x45ab('0x2e')]=_[_0x45ab('0x2f')](_0x4a43d4[_0x45ab('0x2e')]);_0x490fb8[_0x45ab('0x30')]=_[_0x45ab('0x31')](_0x490fb8['model'],_0x490fb8['query']);_0x2af247['attributes']=_[_0x45ab('0x31')](_0x490fb8[_0x45ab('0x2d')],qs[_0x45ab('0x32')](_0x4a43d4[_0x45ab('0x2e')][_0x45ab('0x32')]));_0x2af247[_0x45ab('0x33')]=_0x2af247['attributes']['length']?_0x2af247[_0x45ab('0x33')]:_0x490fb8[_0x45ab('0x2d')];if(_0x4a43d4[_0x45ab('0x2e')]['includeAll']){_0x2af247[_0x45ab('0x40')]=[{'all':!![]}];}_0x2af247=_[_0x45ab('0x3c')]({},_0x2af247,_0x4a43d4[_0x45ab('0x3e')]);return db[_0x45ab('0x28')][_0x45ab('0x43')](_0x2af247)['then'](handleEntityNotFound(_0x529488,null))['then'](respondWithResult(_0x529488,null))[_0x45ab('0x41')](handleError(_0x529488,null));};exports[_0x45ab('0x44')]=function(_0x4076d5,_0x2d088f){return db[_0x45ab('0x28')][_0x45ab('0x44')](_0x4076d5[_0x45ab('0x45')],{})[_0x45ab('0x20')](function(_0xf80f66){var _0x44ec7d=_0x4076d5[_0x45ab('0x46')]['get']({'plain':!![]});if(!_0x44ec7d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44ec7d['role']===_0x45ab('0x46')){var _0x480905=_0xf80f66[_0x45ab('0x22')]({'plain':!![]});var _0x4cac92=_0x45ab('0x23');return db[_0x45ab('0x47')][_0x45ab('0x43')]({'where':{'name':_0x4cac92,'userProfileId':_0x44ec7d[_0x45ab('0x48')]},'raw':!![]})[_0x45ab('0x20')](function(_0x59a531){if(_0x59a531&&_0x59a531['autoAssociation']===0x0){return db['UserProfileResource'][_0x45ab('0x44')]({'name':_0x480905[_0x45ab('0x25')],'resourceId':_0x480905['id'],'type':_0x59a531[_0x45ab('0x25')],'sectionId':_0x59a531['id']},{})[_0x45ab('0x20')](function(){return _0xf80f66;});}else{return _0xf80f66;}})['catch'](function(_0x54e4ab){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54e4ab);throw _0x54e4ab;});}return _0xf80f66;})[_0x45ab('0x20')](respondWithResult(_0x2d088f,0xc9))[_0x45ab('0x41')](handleError(_0x2d088f,null));};exports[_0x45ab('0x49')]=function(_0x267ce3,_0x2df5ed){var _0x563415={'where':{'id':_0x267ce3[_0x45ab('0x4a')]['id']}},_0x4edbc1={};_0x4edbc1[_0x45ab('0x2d')]=_[_0x45ab('0x2f')](db['Campaign'][_0x45ab('0x29')]);_0x563415[_0x45ab('0x33')]=_[_0x45ab('0x31')](_0x4edbc1[_0x45ab('0x2d')],qs[_0x45ab('0x32')](_0x267ce3['query'][_0x45ab('0x32')]));_0x563415['attributes']=_0x563415[_0x45ab('0x33')][_0x45ab('0x34')]?_0x563415[_0x45ab('0x33')]:_0x4edbc1[_0x45ab('0x2d')];if(_0x267ce3[_0x45ab('0x2e')]['includeAll']){_0x563415[_0x45ab('0x40')]=[{'all':!![]}];}_0x563415=_[_0x45ab('0x3c')]({},_0x563415,_0x267ce3[_0x45ab('0x3e')]);return db[_0x45ab('0x28')][_0x45ab('0x43')](_0x563415)[_0x45ab('0x20')](handleEntityNotFound(_0x2df5ed,null))[_0x45ab('0x20')](function(_0x4f4d12){if(_0x4f4d12){var _0x126faf=_0x4f4d12['get']({'plain':!![]});_0x126faf=qs[_0x45ab('0x4b')](_0x126faf,['id','createdAt','updatedAt']);_0x267ce3['body']=_[_0x45ab('0x4b')](_0x267ce3[_0x45ab('0x45')],['id',_0x45ab('0x4c'),_0x45ab('0x4d')]);return db[_0x45ab('0x28')][_0x45ab('0x44')](_[_0x45ab('0x3c')](_0x126faf,_0x267ce3[_0x45ab('0x45')]),{'include':_0x267ce3[_0x45ab('0x2e')][_0x45ab('0x3f')]?[{'all':!![]}]:undefined})[_0x45ab('0x20')](function(_0x57d283){var _0x426419=_0x267ce3[_0x45ab('0x46')][_0x45ab('0x22')]({'plain':!![]});if(!_0x426419)throw new Error(_0x45ab('0x4e'));if(_0x426419[_0x45ab('0x4f')]===_0x45ab('0x46')){var _0x3ce4d9=_0x57d283['get']({'plain':!![]});var _0x5dfa95='IvrCampaigns';return db[_0x45ab('0x47')][_0x45ab('0x43')]({'where':{'name':_0x5dfa95,'userProfileId':_0x426419['userProfileId']},'raw':!![]})[_0x45ab('0x20')](function(_0x178f9c){if(_0x178f9c&&_0x178f9c['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3ce4d9[_0x45ab('0x25')],'resourceId':_0x3ce4d9['id'],'type':_0x178f9c[_0x45ab('0x25')],'sectionId':_0x178f9c['id']},{})[_0x45ab('0x20')](function(){return _0x57d283;});}else{return _0x57d283;}})['catch'](function(_0x58d6af){logger[_0x45ab('0x50')](_0x45ab('0x51'),_0x58d6af);throw _0x58d6af;});}return _0x57d283;});}})[_0x45ab('0x20')](respondWithResult(_0x2df5ed,0xc9))[_0x45ab('0x41')](handleError(_0x2df5ed,null));};exports['update']=function(_0x1dbadb,_0x69be9){if(_0x1dbadb['body']['id']){delete _0x1dbadb[_0x45ab('0x45')]['id'];}return db['Campaign'][_0x45ab('0x43')]({'where':{'id':_0x1dbadb[_0x45ab('0x4a')]['id']}})['then'](handleEntityNotFound(_0x69be9,null))[_0x45ab('0x20')](saveUpdates(_0x1dbadb['body'],null))[_0x45ab('0x20')](respondWithResult(_0x69be9,null))[_0x45ab('0x41')](handleError(_0x69be9,null));};exports[_0x45ab('0x21')]=function(_0x39d049,_0x455748){return db[_0x45ab('0x28')][_0x45ab('0x43')]({'where':{'id':_0x39d049['params']['id']}})[_0x45ab('0x20')](handleEntityNotFound(_0x455748,null))[_0x45ab('0x20')](removeEntity(_0x455748,null))[_0x45ab('0x41')](handleError(_0x455748,null));};exports[_0x45ab('0x52')]=function(_0x553988,_0x1e78b3,_0x3101f7){var _0x4fb99b={'raw':!![],'where':{}};var _0x3d248f={};var _0x3bb1d6={'count':0x0,'rows':[]};return db[_0x45ab('0x28')][_0x45ab('0x53')]({'where':{'id':_0x553988['params']['id']}})['then'](handleEntityNotFound(_0x1e78b3,null))[_0x45ab('0x20')](function(_0x34d754){if(_0x34d754){_0x3d248f['model']=_['keys'](db['CmHopper']['rawAttributes']);_0x3d248f[_0x45ab('0x2e')]=_['keys'](_0x553988['query']);_0x3d248f[_0x45ab('0x30')]=_['intersection'](_0x3d248f[_0x45ab('0x2d')],_0x3d248f['query']);_0x4fb99b[_0x45ab('0x33')]=_[_0x45ab('0x31')](_0x3d248f[_0x45ab('0x2d')],qs[_0x45ab('0x32')](_0x553988[_0x45ab('0x2e')][_0x45ab('0x32')]));_0x4fb99b[_0x45ab('0x33')]=_0x4fb99b[_0x45ab('0x33')][_0x45ab('0x34')]?_0x4fb99b[_0x45ab('0x33')]:_0x3d248f['model'];if(!_0x553988['query'][_0x45ab('0x35')](_0x45ab('0x36'))){_0x4fb99b[_0x45ab('0x37')]=qs[_0x45ab('0x37')](_0x553988['query'][_0x45ab('0x37')]);_0x4fb99b['offset']=qs[_0x45ab('0x19')](_0x553988[_0x45ab('0x2e')]['offset']);}_0x4fb99b['order']=qs[_0x45ab('0x38')](_0x553988[_0x45ab('0x2e')]['sort']);_0x4fb99b[_0x45ab('0x39')]=qs['filters'](_['pick'](_0x553988[_0x45ab('0x2e')],_0x3d248f[_0x45ab('0x30')]));_0x4fb99b['where']['CampaignId']=_0x34d754['id'];if(_0x553988['query'][_0x45ab('0x3b')]){_0x4fb99b['where']=_[_0x45ab('0x3c')](_0x4fb99b[_0x45ab('0x39')],{'$or':_[_0x45ab('0x27')](_0x4fb99b['attributes'],function(_0x5acda9){var _0x2a740b={};_0x2a740b[_0x5acda9]={'$like':'%'+_0x553988[_0x45ab('0x2e')][_0x45ab('0x3b')]+'%'};return _0x2a740b;})});}_0x4fb99b=_['merge']({},_0x4fb99b,_0x553988['options']);return db[_0x45ab('0x54')][_0x45ab('0x1b')]({'where':_0x4fb99b[_0x45ab('0x39')]})[_0x45ab('0x20')](function(_0x4921d2){_0x3bb1d6[_0x45ab('0x1b')]=_0x4921d2;if(_0x553988[_0x45ab('0x2e')][_0x45ab('0x3f')]){_0x4fb99b[_0x45ab('0x40')]=[{'all':!![]}];}return db['CmHopper'][_0x45ab('0x55')](_0x4fb99b);})[_0x45ab('0x20')](function(_0x2d47c3){_0x3bb1d6['rows']=_0x2d47c3;return _0x3bb1d6;});}})[_0x45ab('0x20')](respondWithFilteredResult(_0x1e78b3,_0x4fb99b))[_0x45ab('0x41')](handleError(_0x1e78b3,null));};exports['getHopperHistories']=function(_0x5cdd96,_0x7263f1,_0x4b6ed3){var _0x4eac21={'raw':!![],'where':{}};var _0x419980={};var _0x4e4ed6={'count':0x0,'rows':[]};return db[_0x45ab('0x28')][_0x45ab('0x53')]({'where':{'id':_0x5cdd96[_0x45ab('0x4a')]['id']}})['then'](handleEntityNotFound(_0x7263f1,null))[_0x45ab('0x20')](function(_0x3995a5){if(_0x3995a5){_0x419980['model']=_[_0x45ab('0x2f')](db[_0x45ab('0x56')]['rawAttributes']);_0x419980[_0x45ab('0x2e')]=_['keys'](_0x5cdd96['query']);_0x419980['filters']=_['intersection'](_0x419980[_0x45ab('0x2d')],_0x419980[_0x45ab('0x2e')]);_0x4eac21[_0x45ab('0x33')]=_['intersection'](_0x419980[_0x45ab('0x2d')],qs[_0x45ab('0x32')](_0x5cdd96[_0x45ab('0x2e')][_0x45ab('0x32')]));_0x4eac21[_0x45ab('0x33')]=_0x4eac21['attributes'][_0x45ab('0x34')]?_0x4eac21[_0x45ab('0x33')]:_0x419980[_0x45ab('0x2d')];if(!_0x5cdd96[_0x45ab('0x2e')][_0x45ab('0x35')](_0x45ab('0x36'))){_0x4eac21['limit']=qs['limit'](_0x5cdd96[_0x45ab('0x2e')]['limit']);_0x4eac21[_0x45ab('0x19')]=qs[_0x45ab('0x19')](_0x5cdd96['query'][_0x45ab('0x19')]);}_0x4eac21[_0x45ab('0x57')]=qs[_0x45ab('0x38')](_0x5cdd96[_0x45ab('0x2e')]['sort']);_0x4eac21[_0x45ab('0x39')]=qs[_0x45ab('0x30')](_[_0x45ab('0x3a')](_0x5cdd96[_0x45ab('0x2e')],_0x419980['filters']));_0x4eac21[_0x45ab('0x39')][_0x45ab('0x58')]=_0x3995a5['id'];if(_0x5cdd96[_0x45ab('0x2e')][_0x45ab('0x3b')]){_0x4eac21[_0x45ab('0x39')]=_[_0x45ab('0x3c')](_0x4eac21[_0x45ab('0x39')],{'$or':_[_0x45ab('0x27')](_0x4eac21[_0x45ab('0x33')],function(_0x270c83){var _0x111d77={};_0x111d77[_0x270c83]={'$like':'%'+_0x5cdd96['query'][_0x45ab('0x3b')]+'%'};return _0x111d77;})});}_0x4eac21=_[_0x45ab('0x3c')]({},_0x4eac21,_0x5cdd96[_0x45ab('0x3e')]);return db[_0x45ab('0x56')][_0x45ab('0x1b')]({'where':_0x4eac21[_0x45ab('0x39')]})['then'](function(_0x2d7ca1){_0x4e4ed6['count']=_0x2d7ca1;if(_0x5cdd96[_0x45ab('0x2e')][_0x45ab('0x3f')]){_0x4eac21['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x45ab('0x55')](_0x4eac21);})[_0x45ab('0x20')](function(_0x518e20){_0x4e4ed6[_0x45ab('0x59')]=_0x518e20;return _0x4e4ed6;});}})['then'](respondWithFilteredResult(_0x7263f1,_0x4eac21))[_0x45ab('0x41')](handleError(_0x7263f1,null));};exports['getHopperFinals']=function(_0x35c538,_0x4c3b43,_0x3b3350){var _0x1d0298={'raw':!![],'where':{}};var _0xbfdac0={};var _0x48bb66={'count':0x0,'rows':[]};return db['Campaign'][_0x45ab('0x53')]({'where':{'id':_0x35c538[_0x45ab('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4c3b43,null))[_0x45ab('0x20')](function(_0xc39144){if(_0xc39144){_0xbfdac0[_0x45ab('0x2d')]=_['keys'](db['CmHopperFinal'][_0x45ab('0x29')]);_0xbfdac0[_0x45ab('0x2e')]=_['keys'](_0x35c538[_0x45ab('0x2e')]);_0xbfdac0['filters']=_[_0x45ab('0x31')](_0xbfdac0[_0x45ab('0x2d')],_0xbfdac0['query']);_0x1d0298[_0x45ab('0x33')]=_[_0x45ab('0x31')](_0xbfdac0['model'],qs[_0x45ab('0x32')](_0x35c538[_0x45ab('0x2e')][_0x45ab('0x32')]));_0x1d0298['attributes']=_0x1d0298[_0x45ab('0x33')]['length']?_0x1d0298['attributes']:_0xbfdac0[_0x45ab('0x2d')];if(!_0x35c538[_0x45ab('0x2e')][_0x45ab('0x35')](_0x45ab('0x36'))){_0x1d0298['limit']=qs[_0x45ab('0x37')](_0x35c538[_0x45ab('0x2e')]['limit']);_0x1d0298[_0x45ab('0x19')]=qs[_0x45ab('0x19')](_0x35c538['query'][_0x45ab('0x19')]);}_0x1d0298[_0x45ab('0x57')]=qs[_0x45ab('0x38')](_0x35c538[_0x45ab('0x2e')][_0x45ab('0x38')]);_0x1d0298[_0x45ab('0x39')]=qs[_0x45ab('0x30')](_['pick'](_0x35c538[_0x45ab('0x2e')],_0xbfdac0[_0x45ab('0x30')]));_0x1d0298[_0x45ab('0x39')][_0x45ab('0x58')]=_0xc39144['id'];if(_0x35c538[_0x45ab('0x2e')][_0x45ab('0x3b')]){_0x1d0298[_0x45ab('0x39')]=_[_0x45ab('0x3c')](_0x1d0298[_0x45ab('0x39')],{'$or':_['map'](_0x1d0298[_0x45ab('0x33')],function(_0x1feb95){var _0x41bdac={};_0x41bdac[_0x1feb95]={'$like':'%'+_0x35c538[_0x45ab('0x2e')][_0x45ab('0x3b')]+'%'};return _0x41bdac;})});}_0x1d0298=_[_0x45ab('0x3c')]({},_0x1d0298,_0x35c538[_0x45ab('0x3e')]);return db[_0x45ab('0x5a')]['count']({'where':_0x1d0298[_0x45ab('0x39')]})[_0x45ab('0x20')](function(_0x23ca4c){_0x48bb66['count']=_0x23ca4c;if(_0x35c538[_0x45ab('0x2e')][_0x45ab('0x3f')]){_0x1d0298[_0x45ab('0x40')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x45ab('0x55')](_0x1d0298);})[_0x45ab('0x20')](function(_0x20ba46){_0x48bb66[_0x45ab('0x59')]=_0x20ba46;return _0x48bb66;});}})[_0x45ab('0x20')](respondWithFilteredResult(_0x4c3b43,_0x1d0298))['catch'](handleError(_0x4c3b43,null));};exports[_0x45ab('0x5b')]=function(_0x390655,_0x288c67,_0x1d7145){var _0x1478b9={'raw':!![],'where':{}};var _0x25051d={};var _0x36d8c1={'count':0x0,'rows':[]};return db[_0x45ab('0x28')][_0x45ab('0x53')]({'where':{'id':_0x390655[_0x45ab('0x4a')]['id']}})[_0x45ab('0x20')](handleEntityNotFound(_0x288c67,null))[_0x45ab('0x20')](function(_0x4f85bd){if(_0x4f85bd){_0x25051d[_0x45ab('0x2d')]=_[_0x45ab('0x2f')](db[_0x45ab('0x5c')][_0x45ab('0x29')]);_0x25051d['query']=_[_0x45ab('0x2f')](_0x390655['query']);_0x25051d[_0x45ab('0x30')]=_[_0x45ab('0x31')](_0x25051d[_0x45ab('0x2d')],_0x25051d['query']);_0x1478b9[_0x45ab('0x33')]=_[_0x45ab('0x31')](_0x25051d[_0x45ab('0x2d')],qs[_0x45ab('0x32')](_0x390655['query']['fields']));_0x1478b9['attributes']=_0x1478b9['attributes'][_0x45ab('0x34')]?_0x1478b9['attributes']:_0x25051d['model'];if(!_0x390655[_0x45ab('0x2e')][_0x45ab('0x35')]('nolimit')){_0x1478b9[_0x45ab('0x37')]=qs['limit'](_0x390655['query'][_0x45ab('0x37')]);_0x1478b9[_0x45ab('0x19')]=qs[_0x45ab('0x19')](_0x390655[_0x45ab('0x2e')][_0x45ab('0x19')]);}_0x1478b9[_0x45ab('0x57')]=qs[_0x45ab('0x38')](_0x390655['query'][_0x45ab('0x38')]);_0x1478b9[_0x45ab('0x39')]=qs[_0x45ab('0x30')](_[_0x45ab('0x3a')](_0x390655[_0x45ab('0x2e')],_0x25051d[_0x45ab('0x30')]));_0x1478b9[_0x45ab('0x39')][_0x45ab('0x58')]=_0x4f85bd['id'];if(_0x390655[_0x45ab('0x2e')]['filter']){_0x1478b9['where']=_['merge'](_0x1478b9[_0x45ab('0x39')],{'$or':_[_0x45ab('0x27')](_0x1478b9[_0x45ab('0x33')],function(_0x7bc936){var _0x409bd2={};_0x409bd2[_0x7bc936]={'$like':'%'+_0x390655[_0x45ab('0x2e')][_0x45ab('0x3b')]+'%'};return _0x409bd2;})});}_0x1478b9=_[_0x45ab('0x3c')]({},_0x1478b9,_0x390655[_0x45ab('0x3e')]);return db[_0x45ab('0x5c')][_0x45ab('0x1b')]({'where':_0x1478b9[_0x45ab('0x39')]})[_0x45ab('0x20')](function(_0x5c468f){_0x36d8c1[_0x45ab('0x1b')]=_0x5c468f;if(_0x390655['query'][_0x45ab('0x3f')]){_0x1478b9[_0x45ab('0x40')]=[{'all':!![]}];}return db[_0x45ab('0x5c')]['findAll'](_0x1478b9);})['then'](function(_0x2d62ce){_0x36d8c1[_0x45ab('0x59')]=_0x2d62ce;return _0x36d8c1;});}})[_0x45ab('0x20')](respondWithFilteredResult(_0x288c67,_0x1478b9))[_0x45ab('0x41')](handleError(_0x288c67,null));};exports[_0x45ab('0x5d')]=function(_0x44c961,_0x26aeb3,_0x16ff3a){var _0x28f150={};var _0x2ff7f8={};var _0x13d93e;var _0x17c1f0;return db[_0x45ab('0x28')][_0x45ab('0x53')]({'where':{'id':_0x44c961['params']['id']}})[_0x45ab('0x20')](handleEntityNotFound(_0x26aeb3,null))[_0x45ab('0x20')](function(_0x5994bf){if(_0x5994bf){_0x13d93e=_0x5994bf;_0x2ff7f8[_0x45ab('0x2d')]=_[_0x45ab('0x2f')](db['CmList']['rawAttributes']);_0x2ff7f8[_0x45ab('0x2e')]=_['keys'](_0x44c961[_0x45ab('0x2e')]);_0x2ff7f8[_0x45ab('0x30')]=_[_0x45ab('0x31')](_0x2ff7f8[_0x45ab('0x2d')],_0x2ff7f8['query']);_0x28f150[_0x45ab('0x33')]=_[_0x45ab('0x31')](_0x2ff7f8[_0x45ab('0x2d')],qs[_0x45ab('0x32')](_0x44c961[_0x45ab('0x2e')]['fields']));_0x28f150[_0x45ab('0x33')]=_0x28f150[_0x45ab('0x33')][_0x45ab('0x34')]?_0x28f150[_0x45ab('0x33')]:_0x2ff7f8[_0x45ab('0x2d')];_0x28f150[_0x45ab('0x57')]=qs[_0x45ab('0x38')](_0x44c961[_0x45ab('0x2e')][_0x45ab('0x38')]);_0x28f150[_0x45ab('0x39')]=qs[_0x45ab('0x30')](_[_0x45ab('0x3a')](_0x44c961[_0x45ab('0x2e')],_0x2ff7f8[_0x45ab('0x30')]));if(_0x44c961[_0x45ab('0x2e')]['filter']){_0x28f150['where']=_['merge'](_0x28f150['where'],{'$or':_['map'](_0x28f150[_0x45ab('0x33')],function(_0xf5f6d6){var _0xc57ba9={};_0xc57ba9[_0xf5f6d6]={'$like':'%'+_0x44c961['query'][_0x45ab('0x3b')]+'%'};return _0xc57ba9;})});}_0x28f150=_['merge']({},_0x28f150,_0x44c961[_0x45ab('0x3e')]);return _0x13d93e[_0x45ab('0x5d')](_0x28f150);}})[_0x45ab('0x20')](function(_0x188057){if(_0x188057){_0x17c1f0=_0x188057[_0x45ab('0x34')];if(!_0x44c961[_0x45ab('0x2e')][_0x45ab('0x35')]('nolimit')){_0x28f150['limit']=qs[_0x45ab('0x37')](_0x44c961[_0x45ab('0x2e')][_0x45ab('0x37')]);_0x28f150[_0x45ab('0x19')]=qs['offset'](_0x44c961[_0x45ab('0x2e')][_0x45ab('0x19')]);}return _0x13d93e['getLists'](_0x28f150);}})['then'](function(_0x3dff81){if(_0x3dff81){return _0x3dff81?{'count':_0x17c1f0,'rows':_0x3dff81}:null;}})[_0x45ab('0x20')](respondWithResult(_0x26aeb3,null))[_0x45ab('0x41')](handleError(_0x26aeb3,null));};exports[_0x45ab('0x5e')]=function(_0x2d5e3f,_0xf64af2,_0x4f2e25){var _0x461f3f,_0xdd241a;return db[_0x45ab('0x28')][_0x45ab('0x43')]({'where':{'id':_0x2d5e3f[_0x45ab('0x4a')]['id']}})[_0x45ab('0x20')](handleEntityNotFound(_0xf64af2,null))[_0x45ab('0x20')](function(_0x24e162){if(_0x24e162){_0xdd241a=_0x24e162;return _0x24e162[_0x45ab('0x5e')](_0x2d5e3f['body'][_0x45ab('0x5f')],_[_0x45ab('0x4b')](_0x2d5e3f[_0x45ab('0x45')],[_0x45ab('0x5f'),'id'])||{});}return null;})[_0x45ab('0x60')](function(_0x563e23){var _0x49af56;_0x461f3f=_0x563e23||[];var _0x35ab7e=[];if(_0x563e23){for(var _0x13a4e7=0x0;_0x13a4e7<_0x563e23[_0x45ab('0x34')];_0x13a4e7+=0x1){var _0x4179ac=_0x563e23[_0x13a4e7][_0x45ab('0x22')]({'plain':!![]});_0xdd241a[_0x45ab('0x61')]=_0x2d5e3f[_0x45ab('0x45')][_0x45ab('0x61')]?_0x2d5e3f[_0x45ab('0x45')][_0x45ab('0x61')]:_0xdd241a[_0x45ab('0x61')];switch(_0xdd241a[_0x45ab('0x61')]){case _0x45ab('0x62'):_0x49af56=squel['insert']()['into'](_0x45ab('0x63'))[_0x45ab('0x64')]([_0x45ab('0x65'),_0x45ab('0x66'),_0x45ab('0x67'),_0x45ab('0x68'),_0x45ab('0x58'),_0x45ab('0x4c'),'updatedAt'],squel[_0x45ab('0x69')]()[_0x45ab('0x6a')]('phone','phone')['field'](_0x45ab('0x6b'),_0x45ab('0x66'))[_0x45ab('0x6a')]('id',_0x45ab('0x67'))[_0x45ab('0x6a')](_0x4179ac[_0x45ab('0x6c')][_0x45ab('0x6d')](),_0x45ab('0x68'))[_0x45ab('0x6a')](_0x2d5e3f[_0x45ab('0x4a')]['id'][_0x45ab('0x6d')](),_0x45ab('0x58'))['field'](_0x45ab('0x6b'),_0x45ab('0x4c'))[_0x45ab('0x6a')](_0x45ab('0x6b'),_0x45ab('0x4d'))[_0x45ab('0x6e')]('cm_contacts')['where'](_0x45ab('0x6f'))['where'](_0x45ab('0x70'),_0x4179ac[_0x45ab('0x6c')]['toString']())[_0x45ab('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0x45ab('0x39')](_0x45ab('0x71'),squel[_0x45ab('0x69')]()[_0x45ab('0x6a')](_0x45ab('0x72'))['from'](_0x45ab('0x73'))['where'](_0x45ab('0x74'),_0x2d5e3f[_0x45ab('0x4a')]['id']['toString']()))[_0x45ab('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0x45ab('0x69')]()[_0x45ab('0x6a')](_0x45ab('0x75'))[_0x45ab('0x6e')](_0x45ab('0x63'))['where']('CampaignId\x20=\x20?',_0x2d5e3f[_0x45ab('0x4a')]['id'][_0x45ab('0x6d')]())))[_0x45ab('0x6d')]();break;case _0x45ab('0x76'):_0x49af56=squel[_0x45ab('0x77')]()[_0x45ab('0x78')](_0x45ab('0x63'))[_0x45ab('0x64')](['phone',_0x45ab('0x66'),_0x45ab('0x67'),_0x45ab('0x68'),_0x45ab('0x58'),'createdAt',_0x45ab('0x4d')],squel[_0x45ab('0x69')]()[_0x45ab('0x6a')]('phone',_0x45ab('0x65'))['field']('NOW()','scheduledAt')[_0x45ab('0x6a')]('id',_0x45ab('0x67'))['field'](_0x4179ac[_0x45ab('0x6c')][_0x45ab('0x6d')](),'ListId')[_0x45ab('0x6a')](_0x2d5e3f['params']['id']['toString'](),'CampaignId')[_0x45ab('0x6a')]('NOW()',_0x45ab('0x4c'))['field'](_0x45ab('0x6b'),'updatedAt')[_0x45ab('0x6e')]('cm_contacts')[_0x45ab('0x39')]('deletedAt\x20IS\x20NULL')[_0x45ab('0x39')](_0x45ab('0x70'),_0x4179ac[_0x45ab('0x6c')][_0x45ab('0x6d')]())[_0x45ab('0x39')](_0x45ab('0x79'))[_0x45ab('0x39')](_0x45ab('0x71'),squel[_0x45ab('0x69')]()[_0x45ab('0x6a')](_0x45ab('0x75'))[_0x45ab('0x6e')]('cm_hopper')[_0x45ab('0x39')](_0x45ab('0x74'),_0x2d5e3f[_0x45ab('0x4a')]['id'][_0x45ab('0x6d')]())))[_0x45ab('0x6d')]();break;default:_0x49af56=squel['insert']()[_0x45ab('0x78')](_0x45ab('0x63'))[_0x45ab('0x64')]([_0x45ab('0x65'),'scheduledAt',_0x45ab('0x67'),_0x45ab('0x68'),_0x45ab('0x58'),_0x45ab('0x4c'),_0x45ab('0x4d')],squel['select']()[_0x45ab('0x6a')](_0x45ab('0x65'),'phone')[_0x45ab('0x6a')](_0x45ab('0x6b'),_0x45ab('0x66'))[_0x45ab('0x6a')]('id','ContactId')['field'](_0x4179ac[_0x45ab('0x6c')][_0x45ab('0x6d')](),_0x45ab('0x68'))[_0x45ab('0x6a')](_0x2d5e3f[_0x45ab('0x4a')]['id']['toString'](),'CampaignId')[_0x45ab('0x6a')](_0x45ab('0x6b'),_0x45ab('0x4c'))[_0x45ab('0x6a')](_0x45ab('0x6b'),'updatedAt')[_0x45ab('0x6e')](_0x45ab('0x7a'))[_0x45ab('0x39')](_0x45ab('0x6f'))[_0x45ab('0x39')](_0x45ab('0x70'),_0x4179ac[_0x45ab('0x6c')]['toString']())[_0x45ab('0x39')](_0x45ab('0x79')))[_0x45ab('0x6d')]();}_0x35ab7e[_0x45ab('0x7b')](db[_0x45ab('0x7c')][_0x45ab('0x2e')](_0x49af56));}return BPromise[_0x45ab('0x7d')](_0x35ab7e);}})[_0x45ab('0x20')](function(){return _0x461f3f;})[_0x45ab('0x20')](respondWithResult(_0xf64af2,null))[_0x45ab('0x41')](handleError(_0xf64af2,null));};exports[_0x45ab('0x7e')]=function(_0x29b74f,_0xd6e1ca,_0x40cc98){return db[_0x45ab('0x28')][_0x45ab('0x43')]({'where':{'id':_0x29b74f[_0x45ab('0x4a')]['id']}})[_0x45ab('0x20')](handleEntityNotFound(_0xd6e1ca,null))[_0x45ab('0x20')](function(_0x53be0b){if(_0x53be0b){return _0x53be0b['removeLists'](_0x29b74f['query'][_0x45ab('0x5f')]);}})[_0x45ab('0x20')](function(_0x498bb0){if(_0x498bb0){return db['CmHopper'][_0x45ab('0x21')]({'where':{'ListId':_0x29b74f[_0x45ab('0x2e')][_0x45ab('0x5f')],'CampaignId':_0x29b74f[_0x45ab('0x4a')]['id']}})[_0x45ab('0x20')](function(){return _0x498bb0;});}})[_0x45ab('0x20')](respondWithStatusCode(_0xd6e1ca,null))[_0x45ab('0x41')](handleError(_0xd6e1ca,null));};exports[_0x45ab('0x7f')]=function(_0x1217d8,_0x1b4a17,_0x1cd556){var _0x1e3f92={};var _0x4e54f6={};var _0x7cca9;var _0x59bd35;return db[_0x45ab('0x28')]['findOne']({'where':{'id':_0x1217d8[_0x45ab('0x4a')]['id']}})[_0x45ab('0x20')](handleEntityNotFound(_0x1b4a17,null))[_0x45ab('0x20')](function(_0x3541e4){if(_0x3541e4){_0x7cca9=_0x3541e4;_0x4e54f6['model']=_['keys'](db[_0x45ab('0x80')][_0x45ab('0x29')]);_0x4e54f6['query']=_[_0x45ab('0x2f')](_0x1217d8['query']);_0x4e54f6[_0x45ab('0x30')]=_['intersection'](_0x4e54f6['model'],_0x4e54f6[_0x45ab('0x2e')]);_0x1e3f92[_0x45ab('0x33')]=_[_0x45ab('0x31')](_0x4e54f6[_0x45ab('0x2d')],qs[_0x45ab('0x32')](_0x1217d8['query'][_0x45ab('0x32')]));_0x1e3f92[_0x45ab('0x33')]=_0x1e3f92[_0x45ab('0x33')][_0x45ab('0x34')]?_0x1e3f92[_0x45ab('0x33')]:_0x4e54f6['model'];_0x1e3f92[_0x45ab('0x57')]=qs[_0x45ab('0x38')](_0x1217d8['query'][_0x45ab('0x38')]);_0x1e3f92[_0x45ab('0x39')]=qs['filters'](_['pick'](_0x1217d8[_0x45ab('0x2e')],_0x4e54f6[_0x45ab('0x30')]));if(_0x1217d8[_0x45ab('0x2e')][_0x45ab('0x3b')]){_0x1e3f92[_0x45ab('0x39')]=_[_0x45ab('0x3c')](_0x1e3f92[_0x45ab('0x39')],{'$or':_[_0x45ab('0x27')](_0x1e3f92[_0x45ab('0x33')],function(_0x8759a5){var _0x5271e3={};_0x5271e3[_0x8759a5]={'$like':'%'+_0x1217d8['query'][_0x45ab('0x3b')]+'%'};return _0x5271e3;})});}_0x1e3f92=_[_0x45ab('0x3c')]({},_0x1e3f92,_0x1217d8['options']);return _0x7cca9[_0x45ab('0x7f')](_0x1e3f92);}})[_0x45ab('0x20')](function(_0x183e55){if(_0x183e55){_0x59bd35=_0x183e55[_0x45ab('0x34')];if(!_0x1217d8[_0x45ab('0x2e')][_0x45ab('0x35')](_0x45ab('0x36'))){_0x1e3f92[_0x45ab('0x37')]=qs[_0x45ab('0x37')](_0x1217d8['query'][_0x45ab('0x37')]);_0x1e3f92[_0x45ab('0x19')]=qs['offset'](_0x1217d8[_0x45ab('0x2e')][_0x45ab('0x19')]);}return _0x7cca9[_0x45ab('0x7f')](_0x1e3f92);}})[_0x45ab('0x20')](function(_0x129618){if(_0x129618){return _0x129618?{'count':_0x59bd35,'rows':_0x129618}:null;}})[_0x45ab('0x20')](respondWithResult(_0x1b4a17,null))['catch'](handleError(_0x1b4a17,null));};exports['addBlackLists']=function(_0x5ea5be,_0x441dc6,_0x5c4e76){var _0x4ab993,_0x1c99a8;return db['Campaign'][_0x45ab('0x43')]({'where':{'id':_0x5ea5be[_0x45ab('0x4a')]['id']}})[_0x45ab('0x20')](handleEntityNotFound(_0x441dc6,null))[_0x45ab('0x20')](function(_0x51055f){if(_0x51055f){_0x1c99a8=_0x51055f;return _0x51055f['addBlackLists'](_0x5ea5be[_0x45ab('0x45')][_0x45ab('0x5f')],_['omit'](_0x5ea5be[_0x45ab('0x45')],['ids','id'])||{});}return null;})[_0x45ab('0x60')](function(_0x2c6ee1){var _0x528b9a;_0x4ab993=_0x2c6ee1||[];var _0x199418=[];if(_0x2c6ee1){for(var _0x4aa4b5=0x0;_0x4aa4b5<_0x2c6ee1[_0x45ab('0x34')];_0x4aa4b5+=0x1){var _0x48143a=_0x2c6ee1[_0x4aa4b5][_0x45ab('0x22')]({'plain':!![]});_0x528b9a=squel['insert']()[_0x45ab('0x78')]('cm_hopper_black')[_0x45ab('0x64')]([_0x45ab('0x65'),'ContactId','ListId',_0x45ab('0x58'),_0x45ab('0x4c'),'updatedAt'],squel[_0x45ab('0x69')]()[_0x45ab('0x6a')](_0x45ab('0x65'),_0x45ab('0x65'))[_0x45ab('0x6a')]('id',_0x45ab('0x67'))[_0x45ab('0x6a')](_0x48143a[_0x45ab('0x6c')]['toString'](),_0x45ab('0x68'))['field'](_0x5ea5be['params']['id']['toString'](),_0x45ab('0x58'))[_0x45ab('0x6a')](_0x45ab('0x6b'),_0x45ab('0x4c'))[_0x45ab('0x6a')]('NOW()',_0x45ab('0x4d'))[_0x45ab('0x6e')](_0x45ab('0x7a'))[_0x45ab('0x39')]('deletedAt\x20IS\x20NULL')[_0x45ab('0x39')](_0x45ab('0x70'),_0x48143a['CmListId'][_0x45ab('0x6d')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x45ab('0x6d')]();_0x199418['push'](db[_0x45ab('0x7c')][_0x45ab('0x2e')](_0x528b9a));}return BPromise[_0x45ab('0x7d')](_0x199418);}})[_0x45ab('0x20')](function(){return _0x4ab993;})[_0x45ab('0x20')](respondWithResult(_0x441dc6,null))['catch'](handleError(_0x441dc6,null));};exports[_0x45ab('0x81')]=function(_0x18efb4,_0x53bb40,_0x3b488f){return db[_0x45ab('0x28')][_0x45ab('0x43')]({'where':{'id':_0x18efb4[_0x45ab('0x4a')]['id']}})[_0x45ab('0x20')](handleEntityNotFound(_0x53bb40,null))['then'](function(_0x539976){if(_0x539976){return _0x539976[_0x45ab('0x81')](_0x18efb4[_0x45ab('0x2e')][_0x45ab('0x5f')]);}})[_0x45ab('0x20')](function(_0x1faa75){if(_0x1faa75){return db['CmHopperBlack'][_0x45ab('0x21')]({'where':{'ListId':_0x18efb4['query']['ids'],'CampaignId':_0x18efb4[_0x45ab('0x4a')]['id']}})[_0x45ab('0x20')](function(){return _0x1faa75;});}})[_0x45ab('0x20')](respondWithStatusCode(_0x53bb40,null))[_0x45ab('0x41')](handleError(_0x53bb40,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 864e1ba..e6b6e94 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_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 logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_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 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 3d6811a..ce5d9a4 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 _0x3a32=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','info','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','options','raw','where','attributes','include','map','model','then','stringify'];(function(_0x5e0641,_0x5e85e8){var _0x1525c=function(_0x1d75c4){while(--_0x1d75c4){_0x5e0641['push'](_0x5e0641['shift']());}};_0x1525c(++_0x5e85e8);}(_0x3a32,0x9b));var _0x23a3=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x3a32[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0x23a3('0x0'));var util=require(_0x23a3('0x1'));var moment=require(_0x23a3('0x2'));var BPromise=require(_0x23a3('0x3'));var rs=require(_0x23a3('0x4'));var fs=require('fs');var Redis=require(_0x23a3('0x5'));var db=require(_0x23a3('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x23a3('0x7'));var config=require(_0x23a3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x23a3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x103499,_0x256bcf,_0xd4e907){return new BPromise(function(_0x2562bc,_0x11d423){return client[_0x23a3('0xa')](_0x103499,_0xd4e907)['then'](function(_0x233b17){logger[_0x23a3('0xb')]('Campaign,\x20%s,\x20%s',_0x256bcf,'request\x20sent');logger[_0x23a3('0xc')](_0x23a3('0xd'),_0x256bcf,_0x23a3('0xe'),JSON['stringify'](_0x233b17));if(_0x233b17[_0x23a3('0xf')]){if(_0x233b17['error'][_0x23a3('0x10')]===0x1f4){logger[_0x23a3('0xf')](_0x23a3('0x11'),_0x256bcf,_0x233b17['error'][_0x23a3('0x12')]);return _0x11d423(_0x233b17[_0x23a3('0xf')][_0x23a3('0x12')]);}logger[_0x23a3('0xf')](_0x23a3('0x11'),_0x256bcf,_0x233b17['error'][_0x23a3('0x12')]);return _0x2562bc(_0x233b17[_0x23a3('0xf')]['message']);}else{logger[_0x23a3('0xb')](_0x23a3('0x11'),_0x256bcf,'request\x20sent');_0x2562bc(_0x233b17[_0x23a3('0x13')][_0x23a3('0x12')]);}})[_0x23a3('0x14')](function(_0x3e3cc1){logger[_0x23a3('0xf')](_0x23a3('0x11'),_0x256bcf,_0x3e3cc1);_0x11d423(_0x3e3cc1);});});}exports[_0x23a3('0x15')]=function(_0xc33cbd){var _0x53f4e8=this;return new Promise(function(_0x3961e9,_0x2303d2){return db['Campaign']['findAll']({'raw':_0xc33cbd[_0x23a3('0x16')]?_0xc33cbd[_0x23a3('0x16')][_0x23a3('0x17')]===undefined?!![]:![]:!![],'where':_0xc33cbd[_0x23a3('0x16')]?_0xc33cbd[_0x23a3('0x16')][_0x23a3('0x18')]||null:null,'attributes':_0xc33cbd[_0x23a3('0x16')]?_0xc33cbd[_0x23a3('0x16')][_0x23a3('0x19')]||null:null,'limit':_0xc33cbd[_0x23a3('0x16')]?_0xc33cbd[_0x23a3('0x16')]['limit']||null:null,'include':_0xc33cbd[_0x23a3('0x16')]?_0xc33cbd[_0x23a3('0x16')][_0x23a3('0x1a')]?_[_0x23a3('0x1b')](_0xc33cbd[_0x23a3('0x16')][_0x23a3('0x1a')],function(_0x509aa3){return{'model':db[_0x509aa3[_0x23a3('0x1c')]],'as':_0x509aa3['as'],'attributes':_0x509aa3['attributes'],'include':_0x509aa3[_0x23a3('0x1a')]?_['map'](_0x509aa3[_0x23a3('0x1a')],function(_0x525b5f){return{'model':db[_0x525b5f[_0x23a3('0x1c')]],'as':_0x525b5f['as'],'attributes':_0x525b5f['attributes'],'include':_0x525b5f[_0x23a3('0x1a')]?_[_0x23a3('0x1b')](_0x525b5f['include'],function(_0x333998){return{'model':db[_0x333998[_0x23a3('0x1c')]],'as':_0x333998['as'],'attributes':_0x333998[_0x23a3('0x19')]};}):[]};}):[]};}):[]:[]})[_0x23a3('0x1d')](function(_0x2ace31){logger['info'](_0x23a3('0x15'),_0xc33cbd);logger[_0x23a3('0xc')](_0x23a3('0x15'),_0xc33cbd,JSON[_0x23a3('0x1e')](_0x2ace31));_0x3961e9(_0x2ace31);})[_0x23a3('0x14')](function(_0x35519f){logger[_0x23a3('0xf')](_0x23a3('0x15'),_0x35519f['message'],_0xc33cbd);_0x2303d2(_0x53f4e8[_0x23a3('0xf')](0x1f4,_0x35519f[_0x23a3('0x12')]));});});}; \ No newline at end of file +var _0xe186=['Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','where','attributes','limit','map','include','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info'];(function(_0x27331b,_0x217195){var _0xa2de8=function(_0x3156c4){while(--_0x3156c4){_0x27331b['push'](_0x27331b['shift']());}};_0xa2de8(++_0x217195);}(_0xe186,0x146));var _0x6e18=function(_0x3c010b,_0x20b09e){_0x3c010b=_0x3c010b-0x0;var _0x2bcee5=_0xe186[_0x3c010b];return _0x2bcee5;};'use strict';var _=require(_0x6e18('0x0'));var util=require(_0x6e18('0x1'));var moment=require('moment');var BPromise=require(_0x6e18('0x2'));var rs=require(_0x6e18('0x3'));var fs=require('fs');var Redis=require(_0x6e18('0x4'));var db=require(_0x6e18('0x5'))['db'];var utils=require(_0x6e18('0x6'));var logger=require('../../config/logger')(_0x6e18('0x7'));var config=require('../../config/environment');var jayson=require(_0x6e18('0x8'));var client=jayson[_0x6e18('0x9')][_0x6e18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a2ae3,_0x5b6e82,_0x30a65b){return new BPromise(function(_0x508982,_0x7f45c3){return client[_0x6e18('0xb')](_0x5a2ae3,_0x30a65b)[_0x6e18('0xc')](function(_0x1d0874){logger[_0x6e18('0xd')](_0x6e18('0xe'),_0x5b6e82,'request\x20sent');logger[_0x6e18('0xf')](_0x6e18('0x10'),_0x5b6e82,_0x6e18('0x11'),JSON[_0x6e18('0x12')](_0x1d0874));if(_0x1d0874[_0x6e18('0x13')]){if(_0x1d0874['error'][_0x6e18('0x14')]===0x1f4){logger['error'](_0x6e18('0xe'),_0x5b6e82,_0x1d0874[_0x6e18('0x13')][_0x6e18('0x15')]);return _0x7f45c3(_0x1d0874[_0x6e18('0x13')][_0x6e18('0x15')]);}logger[_0x6e18('0x13')]('Campaign,\x20%s,\x20%s',_0x5b6e82,_0x1d0874[_0x6e18('0x13')][_0x6e18('0x15')]);return _0x508982(_0x1d0874[_0x6e18('0x13')]['message']);}else{logger[_0x6e18('0xd')](_0x6e18('0xe'),_0x5b6e82,_0x6e18('0x11'));_0x508982(_0x1d0874[_0x6e18('0x16')][_0x6e18('0x15')]);}})[_0x6e18('0x17')](function(_0xd6b56a){logger['error']('Campaign,\x20%s,\x20%s',_0x5b6e82,_0xd6b56a);_0x7f45c3(_0xd6b56a);});});}exports[_0x6e18('0x18')]=function(_0x5bdcfd){var _0x5bae96=this;return new Promise(function(_0x12ad28,_0x53179a){return db[_0x6e18('0x19')][_0x6e18('0x1a')]({'raw':_0x5bdcfd[_0x6e18('0x1b')]?_0x5bdcfd['options']['raw']===undefined?!![]:![]:!![],'where':_0x5bdcfd[_0x6e18('0x1b')]?_0x5bdcfd[_0x6e18('0x1b')][_0x6e18('0x1c')]||null:null,'attributes':_0x5bdcfd[_0x6e18('0x1b')]?_0x5bdcfd[_0x6e18('0x1b')][_0x6e18('0x1d')]||null:null,'limit':_0x5bdcfd[_0x6e18('0x1b')]?_0x5bdcfd['options'][_0x6e18('0x1e')]||null:null,'include':_0x5bdcfd[_0x6e18('0x1b')]?_0x5bdcfd['options']['include']?_[_0x6e18('0x1f')](_0x5bdcfd[_0x6e18('0x1b')][_0x6e18('0x20')],function(_0x36cb1f){return{'model':db[_0x36cb1f[_0x6e18('0x21')]],'as':_0x36cb1f['as'],'attributes':_0x36cb1f[_0x6e18('0x1d')],'include':_0x36cb1f[_0x6e18('0x20')]?_[_0x6e18('0x1f')](_0x36cb1f[_0x6e18('0x20')],function(_0x142c98){return{'model':db[_0x142c98[_0x6e18('0x21')]],'as':_0x142c98['as'],'attributes':_0x142c98[_0x6e18('0x1d')],'include':_0x142c98[_0x6e18('0x20')]?_[_0x6e18('0x1f')](_0x142c98[_0x6e18('0x20')],function(_0x42d910){return{'model':db[_0x42d910[_0x6e18('0x21')]],'as':_0x42d910['as'],'attributes':_0x42d910['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e18('0xc')](function(_0x2f4d11){logger['info'](_0x6e18('0x18'),_0x5bdcfd);logger[_0x6e18('0xf')](_0x6e18('0x18'),_0x5bdcfd,JSON[_0x6e18('0x12')](_0x2f4d11));_0x12ad28(_0x2f4d11);})['catch'](function(_0x22b6fa){logger[_0x6e18('0x13')](_0x6e18('0x18'),_0x22b6fa[_0x6e18('0x15')],_0x5bdcfd);_0x53179a(_0x5bae96[_0x6e18('0x13')](0x1f4,_0x22b6fa[_0x6e18('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 76bf32d..b8075b2 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 _0x1d25=['../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','getLists','/:id/blacklists','post','create','/:id/clone','clone','/:id/lists','addLists','put','/:id','update','delete','destroy','removeBlackLists','exports','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x544e84,_0x3bd2bb){var _0x1a2fbf=function(_0x1f8a57){while(--_0x1f8a57){_0x544e84['push'](_0x544e84['shift']());}};_0x1a2fbf(++_0x3bd2bb);}(_0x1d25,0xba));var _0x51d2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1d25[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0x51d2('0x0'));var util=require(_0x51d2('0x1'));var path=require(_0x51d2('0x2'));var timeout=require(_0x51d2('0x3'));var express=require(_0x51d2('0x4'));var router=express['Router']();var fs_extra=require(_0x51d2('0x5'));var auth=require(_0x51d2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x51d2('0x7'));var controller=require(_0x51d2('0x8'));router[_0x51d2('0x9')]('/',auth[_0x51d2('0xa')](),controller[_0x51d2('0xb')]);router[_0x51d2('0x9')]('/:id',auth[_0x51d2('0xa')](),controller['show']);router[_0x51d2('0x9')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x51d2('0xc')]);router[_0x51d2('0x9')](_0x51d2('0xd'),auth[_0x51d2('0xa')](),controller['getHopperHistories']);router[_0x51d2('0x9')](_0x51d2('0xe'),auth[_0x51d2('0xa')](),controller[_0x51d2('0xf')]);router[_0x51d2('0x9')]('/:id/hopper_black',auth[_0x51d2('0xa')](),controller[_0x51d2('0x10')]);router['get']('/:id/lists',auth[_0x51d2('0xa')](),controller[_0x51d2('0x11')]);router[_0x51d2('0x9')](_0x51d2('0x12'),auth[_0x51d2('0xa')](),controller['getBlackLists']);router[_0x51d2('0x13')]('/',auth['isAuthenticated'](),controller[_0x51d2('0x14')]);router[_0x51d2('0x13')](_0x51d2('0x15'),auth['isAuthenticated'](),controller[_0x51d2('0x16')]);router[_0x51d2('0x13')](_0x51d2('0x17'),auth[_0x51d2('0xa')](),controller[_0x51d2('0x18')]);router[_0x51d2('0x13')](_0x51d2('0x12'),auth[_0x51d2('0xa')](),controller['addBlackLists']);router[_0x51d2('0x19')](_0x51d2('0x1a'),auth[_0x51d2('0xa')](),controller[_0x51d2('0x1b')]);router[_0x51d2('0x1c')](_0x51d2('0x1a'),auth[_0x51d2('0xa')](),controller[_0x51d2('0x1d')]);router[_0x51d2('0x1c')]('/:id/lists',auth[_0x51d2('0xa')](),controller['removeLists']);router[_0x51d2('0x1c')](_0x51d2('0x12'),auth[_0x51d2('0xa')](),controller[_0x51d2('0x1e')]);module[_0x51d2('0x1f')]=router; \ No newline at end of file +var _0xf2dd=['delete','removeLists','removeBlackLists','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addBlackLists','/:id','update'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xf2dd,0x84));var _0xdf2d=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0xf2dd[_0x4450b1];return _0x399b0b;};'use strict';var multer=require(_0xdf2d('0x0'));var util=require(_0xdf2d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdf2d('0x2'));var router=express[_0xdf2d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdf2d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdf2d('0x5'));var controller=require('./campaign.controller');router[_0xdf2d('0x6')]('/',auth['isAuthenticated'](),controller[_0xdf2d('0x7')]);router[_0xdf2d('0x6')]('/:id',auth[_0xdf2d('0x8')](),controller[_0xdf2d('0x9')]);router[_0xdf2d('0x6')](_0xdf2d('0xa'),auth['isAuthenticated'](),controller[_0xdf2d('0xb')]);router['get'](_0xdf2d('0xc'),auth['isAuthenticated'](),controller['getHopperHistories']);router['get'](_0xdf2d('0xd'),auth[_0xdf2d('0x8')](),controller[_0xdf2d('0xe')]);router['get'](_0xdf2d('0xf'),auth[_0xdf2d('0x8')](),controller[_0xdf2d('0x10')]);router['get'](_0xdf2d('0x11'),auth[_0xdf2d('0x8')](),controller[_0xdf2d('0x12')]);router['get'](_0xdf2d('0x13'),auth['isAuthenticated'](),controller[_0xdf2d('0x14')]);router[_0xdf2d('0x15')]('/',auth['isAuthenticated'](),controller[_0xdf2d('0x16')]);router['post'](_0xdf2d('0x17'),auth[_0xdf2d('0x8')](),controller[_0xdf2d('0x18')]);router[_0xdf2d('0x15')]('/:id/lists',auth[_0xdf2d('0x8')](),controller['addLists']);router[_0xdf2d('0x15')](_0xdf2d('0x13'),auth['isAuthenticated'](),controller[_0xdf2d('0x19')]);router['put'](_0xdf2d('0x1a'),auth['isAuthenticated'](),controller[_0xdf2d('0x1b')]);router[_0xdf2d('0x1c')]('/:id',auth[_0xdf2d('0x8')](),controller['destroy']);router[_0xdf2d('0x1c')](_0xdf2d('0x11'),auth[_0xdf2d('0x8')](),controller[_0xdf2d('0x1d')]);router[_0xdf2d('0x1c')](_0xdf2d('0x13'),auth[_0xdf2d('0x8')](),controller[_0xdf2d('0x1e')]);module[_0xdf2d('0x1f')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 0df1ecb..39299cb 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 _0x209b=['sequelize','exports','STRING','TEXT','VIRTUAL','key'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0x209b,0x168));var _0xb209=function(_0x112d24,_0x215fd4){_0x112d24=_0x112d24-0x0;var _0x5df472=_0x209b[_0x112d24];return _0x5df472;};'use strict';var Sequelize=require(_0xb209('0x0'));module[_0xb209('0x1')]={'key':{'type':Sequelize[_0xb209('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xb209('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xb209('0x2')]},'name':{'type':Sequelize[_0xb209('0x4')],'get':function(){return this['getDataValue'](_0xb209('0x5'));}}}; \ No newline at end of file +var _0x39ec=['sequelize','exports','STRING','VIRTUAL','getDataValue','key'];(function(_0x4c73ac,_0x46b73c){var _0x9839ee=function(_0x2076fb){while(--_0x2076fb){_0x4c73ac['push'](_0x4c73ac['shift']());}};_0x9839ee(++_0x46b73c);}(_0x39ec,0xba));var _0xc39e=function(_0x4b2fea,_0x112395){_0x4b2fea=_0x4b2fea-0x0;var _0x1e2a14=_0x39ec[_0x4b2fea];return _0x1e2a14;};'use strict';var Sequelize=require(_0xc39e('0x0'));module[_0xc39e('0x1')]={'key':{'type':Sequelize[_0xc39e('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0xc39e('0x2')]},'name':{'type':Sequelize[_0xc39e('0x3')],'get':function(){return this[_0xc39e('0x4')](_0xc39e('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index a858936..5cf172c 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 _0xd679=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','reject','then','destroy','CannedAnswers','UserProfileResource','error','name','send','index','map','CannedAnswer','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','filter','include','rows','catch','includeAll','options','find','update','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x14dfc0,_0x5e5460){var _0x48d650=function(_0xa3e710){while(--_0xa3e710){_0x14dfc0['push'](_0x14dfc0['shift']());}};_0x48d650(++_0x5e5460);}(_0xd679,0x1e0));var _0x9d67=function(_0x187d26,_0x8484b5){_0x187d26=_0x187d26-0x0;var _0x46b177=_0xd679[_0x187d26];return _0x46b177;};'use strict';var emlformat=require(_0x9d67('0x0'));var rimraf=require(_0x9d67('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d67('0x2'));var rp=require(_0x9d67('0x3'));var moment=require(_0x9d67('0x4'));var BPromise=require(_0x9d67('0x5'));var Mustache=require(_0x9d67('0x6'));var util=require(_0x9d67('0x7'));var path=require('path');var sox=require(_0x9d67('0x8'));var csv=require(_0x9d67('0x9'));var ejs=require(_0x9d67('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d67('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9d67('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9d67('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9d67('0xd'));var authService=require(_0x9d67('0xe'));var qs=require(_0x9d67('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d67('0x10'));var logger=require(_0x9d67('0x11'))('api');var utils=require(_0x9d67('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9d67('0x13'));var db=require(_0x9d67('0x14'))['db'];function respondWithStatusCode(_0x4c69d8,_0x5e3800){_0x5e3800=_0x5e3800||0xcc;return function(_0x40447c){if(_0x40447c){return _0x4c69d8[_0x9d67('0x15')](_0x5e3800);}return _0x4c69d8[_0x9d67('0x16')](_0x5e3800)[_0x9d67('0x17')]();};}function respondWithResult(_0x27ccca,_0x41601a){_0x41601a=_0x41601a||0xc8;return function(_0x4ad95b){if(_0x4ad95b){return _0x27ccca['status'](_0x41601a)[_0x9d67('0x18')](_0x4ad95b);}};}function respondWithFilteredResult(_0x94b6f0,_0xed7d71){return function(_0x4b6de0){if(_0x4b6de0){var _0x38bf87=typeof _0xed7d71['offset']==='undefined'&&typeof _0xed7d71['limit']===_0x9d67('0x19');var _0x37c14f=_0x4b6de0[_0x9d67('0x1a')];var _0x474483=_0x38bf87?0x0:_0xed7d71['offset'];var _0x34a745=_0x38bf87?_0x4b6de0[_0x9d67('0x1a')]:_0xed7d71[_0x9d67('0x1b')]+_0xed7d71['limit'];var _0x313bd1;if(_0x34a745>=_0x37c14f){_0x34a745=_0x37c14f;_0x313bd1=0xc8;}else{_0x313bd1=0xce;}_0x94b6f0['status'](_0x313bd1);return _0x94b6f0[_0x9d67('0x1c')]('Content-Range',_0x474483+'-'+_0x34a745+'/'+_0x37c14f)['json'](_0x4b6de0);}return null;};}function patchUpdates(_0xcc7acd){return function(_0x142387){try{jsonpatch[_0x9d67('0x1d')](_0x142387,_0xcc7acd,!![]);}catch(_0x564a0d){return BPromise[_0x9d67('0x1e')](_0x564a0d);}return _0x142387['save']();};}function saveUpdates(_0x4979ef,_0x5e38aa){return function(_0x1c2bf3){if(_0x1c2bf3){return _0x1c2bf3['update'](_0x4979ef)[_0x9d67('0x1f')](function(_0x414a9f){return _0x414a9f;});}return null;};}function removeEntity(_0x5aa1ce,_0x312d5a){return function(_0x4b7a02){if(_0x4b7a02){return _0x4b7a02[_0x9d67('0x20')]()[_0x9d67('0x1f')](function(){var _0x2e8385=_0x4b7a02['get']({'plain':!![]});var _0x2f5296=_0x9d67('0x21');return db[_0x9d67('0x22')][_0x9d67('0x20')]({'where':{'type':_0x2f5296,'resourceId':_0x2e8385['id']}})[_0x9d67('0x1f')](function(){return _0x4b7a02;});})[_0x9d67('0x1f')](function(){_0x5aa1ce['status'](0xcc)[_0x9d67('0x17')]();});}};}function handleEntityNotFound(_0x2811ef,_0x16df41){return function(_0x381b33){if(!_0x381b33){_0x2811ef[_0x9d67('0x15')](0x194);}return _0x381b33;};}function handleError(_0x526fd2,_0x3451de){_0x3451de=_0x3451de||0x1f4;return function(_0x24e3dd){logger[_0x9d67('0x23')](_0x24e3dd['stack']);if(_0x24e3dd[_0x9d67('0x24')]){delete _0x24e3dd[_0x9d67('0x24')];}_0x526fd2[_0x9d67('0x16')](_0x3451de)[_0x9d67('0x25')](_0x24e3dd);};}exports[_0x9d67('0x26')]=function(_0x530e87,_0x433d7e){var _0x1ee843={},_0x519d3a={},_0x17b94f={'count':0x0,'rows':[]};var _0x33fe5c=_[_0x9d67('0x27')](db[_0x9d67('0x28')][_0x9d67('0x29')],function(_0x17e44e){return{'name':_0x17e44e[_0x9d67('0x2a')],'type':_0x17e44e['type'][_0x9d67('0x2b')]};});_0x519d3a['model']=_[_0x9d67('0x27')](_0x33fe5c,_0x9d67('0x24'));_0x519d3a[_0x9d67('0x2c')]=_[_0x9d67('0x2d')](_0x530e87[_0x9d67('0x2c')]);_0x519d3a[_0x9d67('0x2e')]=_[_0x9d67('0x2f')](_0x519d3a[_0x9d67('0x30')],_0x519d3a['query']);_0x1ee843[_0x9d67('0x31')]=_[_0x9d67('0x2f')](_0x519d3a['model'],qs[_0x9d67('0x32')](_0x530e87[_0x9d67('0x2c')][_0x9d67('0x32')]));_0x1ee843[_0x9d67('0x31')]=_0x1ee843[_0x9d67('0x31')][_0x9d67('0x33')]?_0x1ee843[_0x9d67('0x31')]:_0x519d3a[_0x9d67('0x30')];if(!_0x530e87[_0x9d67('0x2c')][_0x9d67('0x34')](_0x9d67('0x35'))){_0x1ee843[_0x9d67('0x36')]=qs['limit'](_0x530e87[_0x9d67('0x2c')]['limit']);_0x1ee843[_0x9d67('0x1b')]=qs[_0x9d67('0x1b')](_0x530e87['query'][_0x9d67('0x1b')]);}_0x1ee843['order']=qs['sort'](_0x530e87['query'][_0x9d67('0x37')]);_0x1ee843['where']=qs[_0x9d67('0x2e')](_['pick'](_0x530e87[_0x9d67('0x2c')],_0x519d3a[_0x9d67('0x2e')]),_0x33fe5c);if(_0x530e87[_0x9d67('0x2c')]['filter']){_0x1ee843[_0x9d67('0x38')]=_[_0x9d67('0x39')](_0x1ee843[_0x9d67('0x38')],{'$or':[{'key':{'$like':'%'+_0x530e87[_0x9d67('0x2c')][_0x9d67('0x3a')]+'%'}},{'value':{'$like':'%'+_0x530e87[_0x9d67('0x2c')][_0x9d67('0x3a')]+'%'}}]});}_0x1ee843=_[_0x9d67('0x39')]({},_0x1ee843,_0x530e87['options']);var _0x4dd065={'where':_0x1ee843[_0x9d67('0x38')]};return db[_0x9d67('0x28')][_0x9d67('0x1a')](_0x4dd065)['then'](function(_0x1cc0c1){_0x17b94f[_0x9d67('0x1a')]=_0x1cc0c1;if(_0x530e87['query']['includeAll']){_0x1ee843[_0x9d67('0x3b')]=[{'all':!![]}];}return db[_0x9d67('0x28')]['findAll'](_0x1ee843);})['then'](function(_0x5510bb){_0x17b94f[_0x9d67('0x3c')]=_0x5510bb;return _0x17b94f;})[_0x9d67('0x1f')](respondWithFilteredResult(_0x433d7e,_0x1ee843))[_0x9d67('0x3d')](handleError(_0x433d7e,null));};exports['show']=function(_0x4bd11a,_0x21de9e){var _0x7cb39d={'raw':!![],'where':{'id':_0x4bd11a['params']['id']}},_0x3dd5e9={};_0x3dd5e9[_0x9d67('0x30')]=_['keys'](db['CannedAnswer'][_0x9d67('0x29')]);_0x3dd5e9[_0x9d67('0x2c')]=_['keys'](_0x4bd11a[_0x9d67('0x2c')]);_0x3dd5e9[_0x9d67('0x2e')]=_[_0x9d67('0x2f')](_0x3dd5e9[_0x9d67('0x30')],_0x3dd5e9[_0x9d67('0x2c')]);_0x7cb39d[_0x9d67('0x31')]=_['intersection'](_0x3dd5e9[_0x9d67('0x30')],qs[_0x9d67('0x32')](_0x4bd11a[_0x9d67('0x2c')]['fields']));_0x7cb39d[_0x9d67('0x31')]=_0x7cb39d[_0x9d67('0x31')][_0x9d67('0x33')]?_0x7cb39d[_0x9d67('0x31')]:_0x3dd5e9['model'];if(_0x4bd11a['query'][_0x9d67('0x3e')]){_0x7cb39d['include']=[{'all':!![]}];}_0x7cb39d=_[_0x9d67('0x39')]({},_0x7cb39d,_0x4bd11a[_0x9d67('0x3f')]);return db['CannedAnswer'][_0x9d67('0x40')](_0x7cb39d)[_0x9d67('0x1f')](handleEntityNotFound(_0x21de9e,null))[_0x9d67('0x1f')](respondWithResult(_0x21de9e,null))[_0x9d67('0x3d')](handleError(_0x21de9e,null));};exports[_0x9d67('0x41')]=function(_0x4d44a4,_0xf63a6){if(_0x4d44a4[_0x9d67('0x42')]['id']){delete _0x4d44a4[_0x9d67('0x42')]['id'];}return db[_0x9d67('0x28')][_0x9d67('0x40')]({'where':{'id':_0x4d44a4[_0x9d67('0x43')]['id']}})[_0x9d67('0x1f')](handleEntityNotFound(_0xf63a6,null))['then'](saveUpdates(_0x4d44a4[_0x9d67('0x42')],null))['then'](respondWithResult(_0xf63a6,null))[_0x9d67('0x3d')](handleError(_0xf63a6,null));};exports[_0x9d67('0x20')]=function(_0x4e183c,_0x3715fc){return db['CannedAnswer'][_0x9d67('0x40')]({'where':{'id':_0x4e183c['params']['id']}})['then'](handleEntityNotFound(_0x3715fc,null))[_0x9d67('0x1f')](removeEntity(_0x3715fc,null))[_0x9d67('0x3d')](handleError(_0x3715fc,null));};exports[_0x9d67('0x44')]=function(_0x2b0f26,_0x38bf00){var _0x2d86df={'key':_0x2b0f26[_0x9d67('0x42')][_0x9d67('0x2b')]};if(_0x2b0f26[_0x9d67('0x42')][_0x9d67('0x45')]){_0x2d86df['MailAccountId']=_0x2b0f26['body'][_0x9d67('0x45')];}else if(_0x2b0f26[_0x9d67('0x42')][_0x9d67('0x46')]){_0x2d86df[_0x9d67('0x46')]=_0x2b0f26[_0x9d67('0x42')][_0x9d67('0x46')];}else if(_0x2b0f26[_0x9d67('0x42')]['OpenchannelAccountId']){_0x2d86df[_0x9d67('0x47')]=_0x2b0f26['body']['OpenchannelAccountId'];}else if(_0x2b0f26[_0x9d67('0x42')][_0x9d67('0x48')]){_0x2d86df['ChatWebsiteId']=_0x2b0f26['body'][_0x9d67('0x48')];}return db[_0x9d67('0x28')][_0x9d67('0x40')]({'where':_0x2d86df})[_0x9d67('0x1f')](function(_0x4f6bc5){if(_0x4f6bc5){throw new db[(_0x9d67('0x49'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer'][_0x9d67('0x44')](_0x2b0f26[_0x9d67('0x42')]);})[_0x9d67('0x1f')](function(_0x482aa7){var _0x4fcb73=_0x2b0f26[_0x9d67('0x4a')][_0x9d67('0x4b')]({'plain':!![]});if(!_0x4fcb73)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fcb73['role']===_0x9d67('0x4a')){var _0x5bfbf8=_0x482aa7[_0x9d67('0x4b')]({'plain':!![]});return db[_0x9d67('0x4c')][_0x9d67('0x40')]({'where':{'name':_0x9d67('0x21'),'userProfileId':_0x4fcb73[_0x9d67('0x4d')]},'raw':!![]})[_0x9d67('0x1f')](function(_0x5d4889){if(_0x5d4889&&_0x5d4889[_0x9d67('0x4e')]===0x0){return db['UserProfileResource'][_0x9d67('0x44')]({'name':_0x5bfbf8[_0x9d67('0x24')],'resourceId':_0x5bfbf8['id'],'type':_0x5d4889[_0x9d67('0x24')],'sectionId':_0x5d4889['id']},{})[_0x9d67('0x1f')](function(){return _0x482aa7;});}else{return _0x482aa7;}})['catch'](function(_0x54b6e5){logger[_0x9d67('0x23')](_0x9d67('0x4f'),_0x54b6e5);throw _0x54b6e5;});}return _0x482aa7;})['then'](respondWithResult(_0x38bf00,0xc9))[_0x9d67('0x3d')](handleError(_0x38bf00,null));}; \ No newline at end of file +var _0x73ff=['params','fields','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','CannedAnswers','UserProfileResource','stack','name','send','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','where','pick','filter','merge','options','includeAll','include','rows','catch','show'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x73ff,0x6f));var _0xf73f=function(_0x4f6dfc,_0x542f62){_0x4f6dfc=_0x4f6dfc-0x0;var _0x45d2c7=_0x73ff[_0x4f6dfc];return _0x45d2c7;};'use strict';var emlformat=require(_0xf73f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf73f('0x1'));var jsonpatch=require(_0xf73f('0x2'));var rp=require('request-promise');var moment=require(_0xf73f('0x3'));var BPromise=require(_0xf73f('0x4'));var Mustache=require(_0xf73f('0x5'));var util=require('util');var path=require(_0xf73f('0x6'));var sox=require(_0xf73f('0x7'));var csv=require(_0xf73f('0x8'));var ejs=require(_0xf73f('0x9'));var fs=require('fs');var fs_extra=require(_0xf73f('0xa'));var _=require(_0xf73f('0xb'));var squel=require('squel');var crypto=require(_0xf73f('0xc'));var jsforce=require(_0xf73f('0xd'));var deskjs=require(_0xf73f('0xe'));var toCsv=require(_0xf73f('0x8'));var querystring=require(_0xf73f('0xf'));var Papa=require(_0xf73f('0x10'));var Redis=require(_0xf73f('0x11'));var authService=require(_0xf73f('0x12'));var qs=require(_0xf73f('0x13'));var as=require(_0xf73f('0x14'));var hardwareService=require(_0xf73f('0x15'));var logger=require(_0xf73f('0x16'))(_0xf73f('0x17'));var utils=require(_0xf73f('0x18'));var config=require(_0xf73f('0x19'));var licenseUtil=require(_0xf73f('0x1a'));var db=require(_0xf73f('0x1b'))['db'];function respondWithStatusCode(_0x754fe7,_0x48293d){_0x48293d=_0x48293d||0xcc;return function(_0x41159f){if(_0x41159f){return _0x754fe7[_0xf73f('0x1c')](_0x48293d);}return _0x754fe7[_0xf73f('0x1d')](_0x48293d)[_0xf73f('0x1e')]();};}function respondWithResult(_0x9bac2,_0x27684b){_0x27684b=_0x27684b||0xc8;return function(_0x32d603){if(_0x32d603){return _0x9bac2[_0xf73f('0x1d')](_0x27684b)[_0xf73f('0x1f')](_0x32d603);}};}function respondWithFilteredResult(_0x475da6,_0x3150c5){return function(_0x6773b6){if(_0x6773b6){var _0x3fb934=typeof _0x3150c5[_0xf73f('0x20')]===_0xf73f('0x21')&&typeof _0x3150c5[_0xf73f('0x22')]===_0xf73f('0x21');var _0x7c3945=_0x6773b6['count'];var _0x44eef2=_0x3fb934?0x0:_0x3150c5[_0xf73f('0x20')];var _0x4efecd=_0x3fb934?_0x6773b6[_0xf73f('0x23')]:_0x3150c5['offset']+_0x3150c5[_0xf73f('0x22')];var _0x382a9d;if(_0x4efecd>=_0x7c3945){_0x4efecd=_0x7c3945;_0x382a9d=0xc8;}else{_0x382a9d=0xce;}_0x475da6['status'](_0x382a9d);return _0x475da6['set']('Content-Range',_0x44eef2+'-'+_0x4efecd+'/'+_0x7c3945)[_0xf73f('0x1f')](_0x6773b6);}return null;};}function patchUpdates(_0x54245e){return function(_0x2319ec){try{jsonpatch[_0xf73f('0x24')](_0x2319ec,_0x54245e,!![]);}catch(_0x267d78){return BPromise[_0xf73f('0x25')](_0x267d78);}return _0x2319ec[_0xf73f('0x26')]();};}function saveUpdates(_0x2c5d77,_0x2dbb9e){return function(_0x3b3bd4){if(_0x3b3bd4){return _0x3b3bd4[_0xf73f('0x27')](_0x2c5d77)[_0xf73f('0x28')](function(_0x3b10b5){return _0x3b10b5;});}return null;};}function removeEntity(_0x85b0de,_0x36e650){return function(_0xaa47a4){if(_0xaa47a4){return _0xaa47a4[_0xf73f('0x29')]()[_0xf73f('0x28')](function(){var _0x286451=_0xaa47a4['get']({'plain':!![]});var _0x41d460=_0xf73f('0x2a');return db[_0xf73f('0x2b')]['destroy']({'where':{'type':_0x41d460,'resourceId':_0x286451['id']}})[_0xf73f('0x28')](function(){return _0xaa47a4;});})[_0xf73f('0x28')](function(){_0x85b0de[_0xf73f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fd0e8,_0x103342){return function(_0x4825dd){if(!_0x4825dd){_0x4fd0e8[_0xf73f('0x1c')](0x194);}return _0x4825dd;};}function handleError(_0x1db1cd,_0x462a72){_0x462a72=_0x462a72||0x1f4;return function(_0x333e7e){logger['error'](_0x333e7e[_0xf73f('0x2c')]);if(_0x333e7e['name']){delete _0x333e7e[_0xf73f('0x2d')];}_0x1db1cd['status'](_0x462a72)[_0xf73f('0x2e')](_0x333e7e);};}exports['index']=function(_0x4db4d8,_0x12872f){var _0x267b82={},_0x3e229e={},_0x59ddfa={'count':0x0,'rows':[]};var _0x5b2557=_[_0xf73f('0x2f')](db[_0xf73f('0x30')][_0xf73f('0x31')],function(_0x354197){return{'name':_0x354197[_0xf73f('0x32')],'type':_0x354197[_0xf73f('0x33')][_0xf73f('0x34')]};});_0x3e229e[_0xf73f('0x35')]=_['map'](_0x5b2557,_0xf73f('0x2d'));_0x3e229e[_0xf73f('0x36')]=_[_0xf73f('0x37')](_0x4db4d8[_0xf73f('0x36')]);_0x3e229e[_0xf73f('0x38')]=_[_0xf73f('0x39')](_0x3e229e['model'],_0x3e229e[_0xf73f('0x36')]);_0x267b82[_0xf73f('0x3a')]=_['intersection'](_0x3e229e['model'],qs['fields'](_0x4db4d8[_0xf73f('0x36')]['fields']));_0x267b82[_0xf73f('0x3a')]=_0x267b82[_0xf73f('0x3a')]['length']?_0x267b82[_0xf73f('0x3a')]:_0x3e229e[_0xf73f('0x35')];if(!_0x4db4d8[_0xf73f('0x36')][_0xf73f('0x3b')]('nolimit')){_0x267b82['limit']=qs[_0xf73f('0x22')](_0x4db4d8[_0xf73f('0x36')][_0xf73f('0x22')]);_0x267b82[_0xf73f('0x20')]=qs[_0xf73f('0x20')](_0x4db4d8[_0xf73f('0x36')][_0xf73f('0x20')]);}_0x267b82[_0xf73f('0x3c')]=qs['sort'](_0x4db4d8[_0xf73f('0x36')]['sort']);_0x267b82[_0xf73f('0x3d')]=qs['filters'](_[_0xf73f('0x3e')](_0x4db4d8['query'],_0x3e229e[_0xf73f('0x38')]),_0x5b2557);if(_0x4db4d8['query'][_0xf73f('0x3f')]){_0x267b82[_0xf73f('0x3d')]=_['merge'](_0x267b82[_0xf73f('0x3d')],{'$or':[{'key':{'$like':'%'+_0x4db4d8[_0xf73f('0x36')][_0xf73f('0x3f')]+'%'}},{'value':{'$like':'%'+_0x4db4d8['query']['filter']+'%'}}]});}_0x267b82=_[_0xf73f('0x40')]({},_0x267b82,_0x4db4d8[_0xf73f('0x41')]);var _0x459ab4={'where':_0x267b82[_0xf73f('0x3d')]};return db[_0xf73f('0x30')][_0xf73f('0x23')](_0x459ab4)[_0xf73f('0x28')](function(_0xae19b3){_0x59ddfa[_0xf73f('0x23')]=_0xae19b3;if(_0x4db4d8['query'][_0xf73f('0x42')]){_0x267b82[_0xf73f('0x43')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x267b82);})['then'](function(_0x568a81){_0x59ddfa[_0xf73f('0x44')]=_0x568a81;return _0x59ddfa;})['then'](respondWithFilteredResult(_0x12872f,_0x267b82))[_0xf73f('0x45')](handleError(_0x12872f,null));};exports[_0xf73f('0x46')]=function(_0x31d164,_0x2fc8b3){var _0x4c7fb4={'raw':!![],'where':{'id':_0x31d164[_0xf73f('0x47')]['id']}},_0x2f9982={};_0x2f9982[_0xf73f('0x35')]=_['keys'](db[_0xf73f('0x30')][_0xf73f('0x31')]);_0x2f9982[_0xf73f('0x36')]=_[_0xf73f('0x37')](_0x31d164[_0xf73f('0x36')]);_0x2f9982[_0xf73f('0x38')]=_[_0xf73f('0x39')](_0x2f9982[_0xf73f('0x35')],_0x2f9982[_0xf73f('0x36')]);_0x4c7fb4[_0xf73f('0x3a')]=_[_0xf73f('0x39')](_0x2f9982['model'],qs[_0xf73f('0x48')](_0x31d164[_0xf73f('0x36')][_0xf73f('0x48')]));_0x4c7fb4[_0xf73f('0x3a')]=_0x4c7fb4[_0xf73f('0x3a')]['length']?_0x4c7fb4[_0xf73f('0x3a')]:_0x2f9982[_0xf73f('0x35')];if(_0x31d164[_0xf73f('0x36')]['includeAll']){_0x4c7fb4[_0xf73f('0x43')]=[{'all':!![]}];}_0x4c7fb4=_[_0xf73f('0x40')]({},_0x4c7fb4,_0x31d164[_0xf73f('0x41')]);return db[_0xf73f('0x30')][_0xf73f('0x49')](_0x4c7fb4)[_0xf73f('0x28')](handleEntityNotFound(_0x2fc8b3,null))[_0xf73f('0x28')](respondWithResult(_0x2fc8b3,null))['catch'](handleError(_0x2fc8b3,null));};exports[_0xf73f('0x27')]=function(_0x3f2178,_0x35dcba){if(_0x3f2178[_0xf73f('0x4a')]['id']){delete _0x3f2178[_0xf73f('0x4a')]['id'];}return db[_0xf73f('0x30')][_0xf73f('0x49')]({'where':{'id':_0x3f2178['params']['id']}})[_0xf73f('0x28')](handleEntityNotFound(_0x35dcba,null))['then'](saveUpdates(_0x3f2178[_0xf73f('0x4a')],null))[_0xf73f('0x28')](respondWithResult(_0x35dcba,null))['catch'](handleError(_0x35dcba,null));};exports['destroy']=function(_0x979a2e,_0x372730){return db[_0xf73f('0x30')][_0xf73f('0x49')]({'where':{'id':_0x979a2e[_0xf73f('0x47')]['id']}})[_0xf73f('0x28')](handleEntityNotFound(_0x372730,null))[_0xf73f('0x28')](removeEntity(_0x372730,null))[_0xf73f('0x45')](handleError(_0x372730,null));};exports[_0xf73f('0x4b')]=function(_0x35f7bf,_0x2d5c50){var _0x2cee28={'key':_0x35f7bf[_0xf73f('0x4a')]['key']};if(_0x35f7bf['body'][_0xf73f('0x4c')]){_0x2cee28[_0xf73f('0x4c')]=_0x35f7bf[_0xf73f('0x4a')][_0xf73f('0x4c')];}else if(_0x35f7bf[_0xf73f('0x4a')][_0xf73f('0x4d')]){_0x2cee28[_0xf73f('0x4d')]=_0x35f7bf[_0xf73f('0x4a')][_0xf73f('0x4d')];}else if(_0x35f7bf['body'][_0xf73f('0x4e')]){_0x2cee28[_0xf73f('0x4e')]=_0x35f7bf[_0xf73f('0x4a')]['OpenchannelAccountId'];}else if(_0x35f7bf[_0xf73f('0x4a')]['ChatWebsiteId']){_0x2cee28[_0xf73f('0x4f')]=_0x35f7bf[_0xf73f('0x4a')]['ChatWebsiteId'];}return db[_0xf73f('0x30')][_0xf73f('0x49')]({'where':_0x2cee28})[_0xf73f('0x28')](function(_0x575caa){if(_0x575caa){throw new db[(_0xf73f('0x50'))]['ValidationError'](_0xf73f('0x51'));}return db['CannedAnswer']['create'](_0x35f7bf[_0xf73f('0x4a')]);})['then'](function(_0x46d128){var _0x51345e=_0x35f7bf[_0xf73f('0x52')][_0xf73f('0x53')]({'plain':!![]});if(!_0x51345e)throw new Error(_0xf73f('0x54'));if(_0x51345e[_0xf73f('0x55')]==='user'){var _0x3b2503=_0x46d128['get']({'plain':!![]});return db[_0xf73f('0x56')][_0xf73f('0x49')]({'where':{'name':_0xf73f('0x2a'),'userProfileId':_0x51345e[_0xf73f('0x57')]},'raw':!![]})[_0xf73f('0x28')](function(_0x4fdab8){if(_0x4fdab8&&_0x4fdab8[_0xf73f('0x58')]===0x0){return db[_0xf73f('0x2b')][_0xf73f('0x4b')]({'name':_0x3b2503['name'],'resourceId':_0x3b2503['id'],'type':_0x4fdab8[_0xf73f('0x2d')],'sectionId':_0x4fdab8['id']},{})['then'](function(){return _0x46d128;});}else{return _0x46d128;}})[_0xf73f('0x45')](function(_0x12df7a){logger[_0xf73f('0x59')](_0xf73f('0x5a'),_0x12df7a);throw _0x12df7a;});}return _0x46d128;})[_0xf73f('0x28')](respondWithResult(_0x2d5c50,0xc9))[_0xf73f('0x45')](handleError(_0x2d5c50,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index c7b38b5..915adc3 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 _0x0c58=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CannedAnswer'];(function(_0x1a0d1f,_0x3183f4){var _0x2e2197=function(_0xa9e953){while(--_0xa9e953){_0x1a0d1f['push'](_0x1a0d1f['shift']());}};_0x2e2197(++_0x3183f4);}(_0x0c58,0x12f));var _0x80c5=function(_0x2762a5,_0x3e6796){_0x2762a5=_0x2762a5-0x0;var _0x560b79=_0x0c58[_0x2762a5];return _0x560b79;};'use strict';var _=require(_0x80c5('0x0'));var util=require('util');var logger=require(_0x80c5('0x1'))(_0x80c5('0x2'));var moment=require(_0x80c5('0x3'));var BPromise=require(_0x80c5('0x4'));var rp=require(_0x80c5('0x5'));var fs=require('fs');var path=require(_0x80c5('0x6'));var rimraf=require(_0x80c5('0x7'));var config=require(_0x80c5('0x8'));var attributes=require('./cannedAnswer.attributes');module[_0x80c5('0x9')]=function(_0x11e440,_0x3e38a9){return _0x11e440[_0x80c5('0xa')](_0x80c5('0xb'),attributes,{'tableName':_0x80c5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x80c5('0xd'),'collate':_0x80c5('0xe')});}; \ No newline at end of file +var _0x8bc6=['tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x3e6fc3,_0x169d56){var _0x1548c4=function(_0x28dfdd){while(--_0x28dfdd){_0x3e6fc3['push'](_0x3e6fc3['shift']());}};_0x1548c4(++_0x169d56);}(_0x8bc6,0x137));var _0x68bc=function(_0x51921f,_0x42bde0){_0x51921f=_0x51921f-0x0;var _0x41743a=_0x8bc6[_0x51921f];return _0x41743a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x68bc('0x0'));var moment=require(_0x68bc('0x1'));var BPromise=require(_0x68bc('0x2'));var rp=require(_0x68bc('0x3'));var fs=require('fs');var path=require(_0x68bc('0x4'));var rimraf=require(_0x68bc('0x5'));var config=require(_0x68bc('0x6'));var attributes=require(_0x68bc('0x7'));module[_0x68bc('0x8')]=function(_0x504bbb,_0x5113f1){return _0x504bbb[_0x68bc('0x9')](_0x68bc('0xa'),attributes,{'tableName':_0x68bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x68bc('0xc'),'collate':_0x68bc('0xd')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 218a924..eaa06bd 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(_0x3fc7b2,_0x169540){var _0x5cf040=function(_0x2e97da){while(--_0x2e97da){_0x3fc7b2['push'](_0x3fc7b2['shift']());}};_0x5cf040(++_0x169540);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','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(_0x1e6ff7,_0x4d26c9){var _0x383595=function(_0x29b243){while(--_0x29b243){_0x1e6ff7['push'](_0x1e6ff7['shift']());}};_0x383595(++_0x4d26c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 8a8fd07..31ec486 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 _0x245f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x58b693,_0x14ee77){var _0x400350=function(_0x55a488){while(--_0x55a488){_0x58b693['push'](_0x58b693['shift']());}};_0x400350(++_0x14ee77);}(_0x245f,0x1f3));var _0xf245=function(_0x33e0a0,_0x482449){_0x33e0a0=_0x33e0a0-0x0;var _0x5bf08b=_0x245f[_0x33e0a0];return _0x5bf08b;};'use strict';var multer=require(_0xf245('0x0'));var util=require(_0xf245('0x1'));var path=require(_0xf245('0x2'));var timeout=require(_0xf245('0x3'));var express=require(_0xf245('0x4'));var router=express[_0xf245('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf245('0x6'));var interaction=require(_0xf245('0x7'));var config=require(_0xf245('0x8'));var controller=require('./cannedAnswer.controller');router[_0xf245('0x9')]('/',auth[_0xf245('0xa')](),controller['index']);router[_0xf245('0x9')](_0xf245('0xb'),auth[_0xf245('0xa')](),controller[_0xf245('0xc')]);router[_0xf245('0xd')]('/',auth['isAuthenticated'](),controller[_0xf245('0xe')]);router['put'](_0xf245('0xb'),auth[_0xf245('0xa')](),controller['update']);router[_0xf245('0xf')](_0xf245('0xb'),auth[_0xf245('0xa')](),controller[_0xf245('0x10')]);module[_0xf245('0x11')]=router; \ No newline at end of file +var _0x542d=['post','create','put','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x3af067,_0x4755ed){var _0x38f9a7=function(_0x289f0b){while(--_0x289f0b){_0x3af067['push'](_0x3af067['shift']());}};_0x38f9a7(++_0x4755ed);}(_0x542d,0xf5));var _0xd542=function(_0x167bed,_0x1ae56e){_0x167bed=_0x167bed-0x0;var _0x2e0d45=_0x542d[_0x167bed];return _0x2e0d45;};'use strict';var multer=require('multer');var util=require(_0xd542('0x0'));var path=require(_0xd542('0x1'));var timeout=require('connect-timeout');var express=require(_0xd542('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd542('0x3'));var interaction=require(_0xd542('0x4'));var config=require(_0xd542('0x5'));var controller=require('./cannedAnswer.controller');router[_0xd542('0x6')]('/',auth[_0xd542('0x7')](),controller['index']);router[_0xd542('0x6')](_0xd542('0x8'),auth[_0xd542('0x7')](),controller[_0xd542('0x9')]);router[_0xd542('0xa')]('/',auth[_0xd542('0x7')](),controller[_0xd542('0xb')]);router[_0xd542('0xc')](_0xd542('0x8'),auth[_0xd542('0x7')](),controller[_0xd542('0xd')]);router[_0xd542('0xe')](_0xd542('0x8'),auth[_0xd542('0x7')](),controller[_0xd542('0xf')]);module[_0xd542('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index a9a8453..ec58b57 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 _0x5e5b=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x1a150c,_0x2adc06){var _0x2cbed4=function(_0x582c70){while(--_0x582c70){_0x1a150c['push'](_0x1a150c['shift']());}};_0x2cbed4(++_0x2adc06);}(_0x5e5b,0x113));var _0xb5e5=function(_0xf0de77,_0x28c6d6){_0xf0de77=_0xf0de77-0x0;var _0x1daed2=_0x5e5b[_0xf0de77];return _0x1daed2;};'use strict';var Sequelize=require(_0xb5e5('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xb5e5('0x1')},'clid':{'type':Sequelize[_0xb5e5('0x2')]},'src':{'type':Sequelize[_0xb5e5('0x2')]},'dst':{'type':Sequelize[_0xb5e5('0x2')]},'dcontext':{'type':Sequelize[_0xb5e5('0x2')]},'channel':{'type':Sequelize[_0xb5e5('0x2')]},'dstchannel':{'type':Sequelize[_0xb5e5('0x2')]},'lastapp':{'type':Sequelize[_0xb5e5('0x2')]},'lastdata':{'type':Sequelize[_0xb5e5('0x2')]},'duration':{'type':Sequelize[_0xb5e5('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xb5e5('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xb5e5('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xb5e5('0x2')]},'uniqueid':{'type':Sequelize[_0xb5e5('0x2')]},'linkedid':{'type':Sequelize[_0xb5e5('0x2')]},'sequence':{'type':Sequelize[_0xb5e5('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xb5e5('0x2')]},'tag':{'type':Sequelize[_0xb5e5('0x2')]}}; \ No newline at end of file +var _0x2121=['sequelize','exports','STRING','INTEGER'];(function(_0x4d7df4,_0x5a3216){var _0x1d628e=function(_0x273d22){while(--_0x273d22){_0x4d7df4['push'](_0x4d7df4['shift']());}};_0x1d628e(++_0x5a3216);}(_0x2121,0x1b4));var _0x1212=function(_0x441245,_0x5901c8){_0x441245=_0x441245-0x0;var _0x338c90=_0x2121[_0x441245];return _0x338c90;};'use strict';var Sequelize=require(_0x1212('0x0'));module[_0x1212('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x1212('0x2')]},'src':{'type':Sequelize[_0x1212('0x2')]},'dst':{'type':Sequelize[_0x1212('0x2')]},'dcontext':{'type':Sequelize[_0x1212('0x2')]},'channel':{'type':Sequelize[_0x1212('0x2')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x1212('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x1212('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1212('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1212('0x2')]},'amaflags':{'type':Sequelize[_0x1212('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1212('0x2')]},'userfield':{'type':Sequelize[_0x1212('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x1212('0x2')]},'sequence':{'type':Sequelize[_0x1212('0x2')]},'peeraccount':{'type':Sequelize[_0x1212('0x2')]},'type':{'type':Sequelize[_0x1212('0x2')]},'tag':{'type':Sequelize[_0x1212('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index dff5331..a97aabb 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 _0x0e85=['json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','map','Cdr','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end'];(function(_0x124802,_0x23d360){var _0x310f22=function(_0x353298){while(--_0x353298){_0x124802['push'](_0x124802['shift']());}};_0x310f22(++_0x23d360);}(_0x0e85,0x7c));var _0x50e8=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x0e85[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require(_0x50e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50e8('0x2'));var rp=require(_0x50e8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x50e8('0x4'));var path=require('path');var sox=require(_0x50e8('0x5'));var csv=require(_0x50e8('0x6'));var ejs=require(_0x50e8('0x7'));var fs=require('fs');var fs_extra=require(_0x50e8('0x8'));var _=require('lodash');var squel=require(_0x50e8('0x9'));var crypto=require(_0x50e8('0xa'));var jsforce=require(_0x50e8('0xb'));var deskjs=require(_0x50e8('0xc'));var toCsv=require(_0x50e8('0x6'));var querystring=require(_0x50e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x50e8('0xe'));var authService=require(_0x50e8('0xf'));var qs=require(_0x50e8('0x10'));var as=require(_0x50e8('0x11'));var hardwareService=require(_0x50e8('0x12'));var logger=require(_0x50e8('0x13'))(_0x50e8('0x14'));var utils=require(_0x50e8('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x16'))['db'];function respondWithStatusCode(_0x24d381,_0x508377){_0x508377=_0x508377||0xcc;return function(_0x49e02f){if(_0x49e02f){return _0x24d381[_0x50e8('0x17')](_0x508377);}return _0x24d381[_0x50e8('0x18')](_0x508377)[_0x50e8('0x19')]();};}function respondWithResult(_0x473aa7,_0x54efd3){_0x54efd3=_0x54efd3||0xc8;return function(_0x18596f){if(_0x18596f){return _0x473aa7[_0x50e8('0x18')](_0x54efd3)[_0x50e8('0x1a')](_0x18596f);}};}function respondWithFilteredResult(_0x5c3baa,_0x5524a3){return function(_0x30a872){if(_0x30a872){var _0xf02b48=typeof _0x5524a3[_0x50e8('0x1b')]===_0x50e8('0x1c')&&typeof _0x5524a3[_0x50e8('0x1d')]===_0x50e8('0x1c');var _0x5642bf=_0x30a872['count'];var _0x441f25=_0xf02b48?0x0:_0x5524a3[_0x50e8('0x1b')];var _0x40d060=_0xf02b48?_0x30a872[_0x50e8('0x1e')]:_0x5524a3[_0x50e8('0x1b')]+_0x5524a3[_0x50e8('0x1d')];var _0x1a451d;if(_0x40d060>=_0x5642bf){_0x40d060=_0x5642bf;_0x1a451d=0xc8;}else{_0x1a451d=0xce;}_0x5c3baa['status'](_0x1a451d);return _0x5c3baa[_0x50e8('0x1f')]('Content-Range',_0x441f25+'-'+_0x40d060+'/'+_0x5642bf)[_0x50e8('0x1a')](_0x30a872);}return null;};}function patchUpdates(_0xe04a5c){return function(_0xd263d){try{jsonpatch[_0x50e8('0x20')](_0xd263d,_0xe04a5c,!![]);}catch(_0x46af8e){return BPromise['reject'](_0x46af8e);}return _0xd263d[_0x50e8('0x21')]();};}function saveUpdates(_0x1e4e0d,_0x58110d){return function(_0x31d23c){if(_0x31d23c){return _0x31d23c[_0x50e8('0x22')](_0x1e4e0d)['then'](function(_0x1ce7fc){return _0x1ce7fc;});}return null;};}function removeEntity(_0xe7e56c,_0x4f56b7){return function(_0x47a3d8){if(_0x47a3d8){return _0x47a3d8['destroy']()[_0x50e8('0x23')](function(){_0xe7e56c[_0x50e8('0x18')](0xcc)[_0x50e8('0x19')]();});}};}function handleEntityNotFound(_0x371a1f,_0xc2f832){return function(_0x13b6e9){if(!_0x13b6e9){_0x371a1f['sendStatus'](0x194);}return _0x13b6e9;};}function handleError(_0x3a6442,_0x396611){_0x396611=_0x396611||0x1f4;return function(_0x4b3a09){logger[_0x50e8('0x24')](_0x4b3a09[_0x50e8('0x25')]);if(_0x4b3a09[_0x50e8('0x26')]){delete _0x4b3a09[_0x50e8('0x26')];}_0x3a6442['status'](_0x396611)[_0x50e8('0x27')](_0x4b3a09);};}exports['index']=function(_0x30fedf,_0x39c0c6){var _0x42bbef={},_0x4f0b88={},_0x1041b9={'count':0x0,'rows':[]};var _0x126c99=_[_0x50e8('0x28')](db[_0x50e8('0x29')][_0x50e8('0x2a')],function(_0x18aa31){return{'name':_0x18aa31[_0x50e8('0x2b')],'type':_0x18aa31['type'][_0x50e8('0x2c')]};});_0x4f0b88[_0x50e8('0x2d')]=_['map'](_0x126c99,'name');_0x4f0b88[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x30fedf[_0x50e8('0x2e')]);_0x4f0b88['filters']=_['intersection'](_0x4f0b88[_0x50e8('0x2d')],_0x4f0b88[_0x50e8('0x2e')]);_0x42bbef['attributes']=_[_0x50e8('0x30')](_0x4f0b88[_0x50e8('0x2d')],qs[_0x50e8('0x31')](_0x30fedf[_0x50e8('0x2e')]['fields']));_0x42bbef[_0x50e8('0x32')]=_0x42bbef['attributes'][_0x50e8('0x33')]?_0x42bbef[_0x50e8('0x32')]:_0x4f0b88[_0x50e8('0x2d')];if(!_0x30fedf['query'][_0x50e8('0x34')](_0x50e8('0x35'))){_0x42bbef['limit']=qs[_0x50e8('0x1d')](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1d')]);_0x42bbef[_0x50e8('0x1b')]=qs['offset'](_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x1b')]);}_0x42bbef[_0x50e8('0x36')]=qs[_0x50e8('0x37')](_0x30fedf['query'][_0x50e8('0x37')]);_0x42bbef[_0x50e8('0x38')]=qs[_0x50e8('0x39')](_['pick'](_0x30fedf['query'],_0x4f0b88['filters']),_0x126c99);if(_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]){_0x42bbef[_0x50e8('0x38')]=_[_0x50e8('0x3b')](_0x42bbef[_0x50e8('0x38')],{'$or':_[_0x50e8('0x28')](_0x126c99,function(_0xb566c2){if(_0xb566c2[_0x50e8('0x3c')]!==_0x50e8('0x3d')){var _0x3a1b4d={};_0x3a1b4d[_0xb566c2['name']]={'$like':'%'+_0x30fedf[_0x50e8('0x2e')][_0x50e8('0x3a')]+'%'};return _0x3a1b4d;}})});}_0x42bbef=_[_0x50e8('0x3b')]({},_0x42bbef,_0x30fedf[_0x50e8('0x3e')]);var _0x5dbbe1={'where':_0x42bbef[_0x50e8('0x38')]};return db[_0x50e8('0x29')][_0x50e8('0x1e')](_0x5dbbe1)[_0x50e8('0x23')](function(_0x8e8a97){_0x1041b9['count']=_0x8e8a97;if(_0x30fedf['query'][_0x50e8('0x3f')]){_0x42bbef[_0x50e8('0x40')]=[{'all':!![]}];}return db['Cdr'][_0x50e8('0x41')](_0x42bbef);})[_0x50e8('0x23')](function(_0x3db1ab){_0x1041b9[_0x50e8('0x42')]=_0x3db1ab;return _0x1041b9;})[_0x50e8('0x23')](respondWithFilteredResult(_0x39c0c6,_0x42bbef))[_0x50e8('0x43')](handleError(_0x39c0c6,null));};exports[_0x50e8('0x44')]=function(_0x172049,_0x5e9da3){var _0x3d26bd={'raw':!![],'where':{'id':_0x172049[_0x50e8('0x45')]['id']}},_0x44e0ca={};_0x44e0ca[_0x50e8('0x2d')]=_['keys'](db[_0x50e8('0x29')][_0x50e8('0x2a')]);_0x44e0ca[_0x50e8('0x2e')]=_[_0x50e8('0x2f')](_0x172049['query']);_0x44e0ca[_0x50e8('0x39')]=_['intersection'](_0x44e0ca['model'],_0x44e0ca['query']);_0x3d26bd[_0x50e8('0x32')]=_[_0x50e8('0x30')](_0x44e0ca['model'],qs[_0x50e8('0x31')](_0x172049[_0x50e8('0x2e')][_0x50e8('0x31')]));_0x3d26bd[_0x50e8('0x32')]=_0x3d26bd[_0x50e8('0x32')][_0x50e8('0x33')]?_0x3d26bd['attributes']:_0x44e0ca[_0x50e8('0x2d')];if(_0x172049['query'][_0x50e8('0x3f')]){_0x3d26bd[_0x50e8('0x40')]=[{'all':!![]}];}_0x3d26bd=_['merge']({},_0x3d26bd,_0x172049[_0x50e8('0x3e')]);return db['Cdr'][_0x50e8('0x46')](_0x3d26bd)[_0x50e8('0x23')](handleEntityNotFound(_0x5e9da3,null))[_0x50e8('0x23')](respondWithResult(_0x5e9da3,null))[_0x50e8('0x43')](handleError(_0x5e9da3,null));};exports[_0x50e8('0x47')]=function(_0x3f72ea,_0x229d60){return db[_0x50e8('0x29')][_0x50e8('0x47')](_0x3f72ea[_0x50e8('0x48')],{})[_0x50e8('0x23')](respondWithResult(_0x229d60,0xc9))['catch'](handleError(_0x229d60,null));};exports[_0x50e8('0x22')]=function(_0x275a1b,_0x479431){if(_0x275a1b[_0x50e8('0x48')]['id']){delete _0x275a1b['body']['id'];}return db[_0x50e8('0x29')]['find']({'where':{'id':_0x275a1b[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x479431,null))[_0x50e8('0x23')](saveUpdates(_0x275a1b[_0x50e8('0x48')],null))[_0x50e8('0x23')](respondWithResult(_0x479431,null))[_0x50e8('0x43')](handleError(_0x479431,null));};exports[_0x50e8('0x49')]=function(_0x5f256a,_0x3410f3){return db[_0x50e8('0x29')][_0x50e8('0x46')]({'where':{'id':_0x5f256a[_0x50e8('0x45')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x3410f3,null))[_0x50e8('0x23')](removeEntity(_0x3410f3,null))['catch'](handleError(_0x3410f3,null));};exports[_0x50e8('0x4a')]=function(_0x250b28,_0xff2e24){return db[_0x50e8('0x29')]['describe']()[_0x50e8('0x23')](respondWithResult(_0xff2e24,null))[_0x50e8('0x43')](handleError(_0xff2e24,null));}; \ No newline at end of file +var _0xb647=['bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../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','name','send','index','Cdr','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x2f610e,_0x583e00){var _0x41c7a7=function(_0x338b38){while(--_0x338b38){_0x2f610e['push'](_0x2f610e['shift']());}};_0x41c7a7(++_0x583e00);}(_0xb647,0xdb));var _0x7b64=function(_0x26f704,_0x4b4bfb){_0x26f704=_0x26f704-0x0;var _0x591f06=_0xb647[_0x26f704];return _0x591f06;};'use strict';var emlformat=require(_0x7b64('0x0'));var rimraf=require(_0x7b64('0x1'));var zipdir=require(_0x7b64('0x2'));var jsonpatch=require(_0x7b64('0x3'));var rp=require(_0x7b64('0x4'));var moment=require(_0x7b64('0x5'));var BPromise=require(_0x7b64('0x6'));var Mustache=require(_0x7b64('0x7'));var util=require('util');var path=require(_0x7b64('0x8'));var sox=require('sox');var csv=require(_0x7b64('0x9'));var ejs=require(_0x7b64('0xa'));var fs=require('fs');var fs_extra=require(_0x7b64('0xb'));var _=require(_0x7b64('0xc'));var squel=require(_0x7b64('0xd'));var crypto=require(_0x7b64('0xe'));var jsforce=require(_0x7b64('0xf'));var deskjs=require(_0x7b64('0x10'));var toCsv=require(_0x7b64('0x9'));var querystring=require('querystring');var Papa=require(_0x7b64('0x11'));var Redis=require('ioredis');var authService=require(_0x7b64('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b64('0x13'));var logger=require(_0x7b64('0x14'))('api');var utils=require(_0x7b64('0x15'));var config=require(_0x7b64('0x16'));var licenseUtil=require(_0x7b64('0x17'));var db=require(_0x7b64('0x18'))['db'];function respondWithStatusCode(_0x25e135,_0x432626){_0x432626=_0x432626||0xcc;return function(_0x5ea1dd){if(_0x5ea1dd){return _0x25e135['sendStatus'](_0x432626);}return _0x25e135[_0x7b64('0x19')](_0x432626)['end']();};}function respondWithResult(_0x530938,_0x2f21d8){_0x2f21d8=_0x2f21d8||0xc8;return function(_0x29a596){if(_0x29a596){return _0x530938[_0x7b64('0x19')](_0x2f21d8)[_0x7b64('0x1a')](_0x29a596);}};}function respondWithFilteredResult(_0x33ebe7,_0x437ddc){return function(_0x306a4e){if(_0x306a4e){var _0x519316=typeof _0x437ddc[_0x7b64('0x1b')]===_0x7b64('0x1c')&&typeof _0x437ddc[_0x7b64('0x1d')]===_0x7b64('0x1c');var _0x157c03=_0x306a4e['count'];var _0x3935c3=_0x519316?0x0:_0x437ddc[_0x7b64('0x1b')];var _0x58517e=_0x519316?_0x306a4e[_0x7b64('0x1e')]:_0x437ddc[_0x7b64('0x1b')]+_0x437ddc['limit'];var _0x23845e;if(_0x58517e>=_0x157c03){_0x58517e=_0x157c03;_0x23845e=0xc8;}else{_0x23845e=0xce;}_0x33ebe7[_0x7b64('0x19')](_0x23845e);return _0x33ebe7[_0x7b64('0x1f')](_0x7b64('0x20'),_0x3935c3+'-'+_0x58517e+'/'+_0x157c03)['json'](_0x306a4e);}return null;};}function patchUpdates(_0x123a3b){return function(_0x5c4135){try{jsonpatch['apply'](_0x5c4135,_0x123a3b,!![]);}catch(_0x3f73cf){return BPromise['reject'](_0x3f73cf);}return _0x5c4135[_0x7b64('0x21')]();};}function saveUpdates(_0x587da6,_0x1bbd87){return function(_0x1ad95f){if(_0x1ad95f){return _0x1ad95f[_0x7b64('0x22')](_0x587da6)[_0x7b64('0x23')](function(_0x450b7e){return _0x450b7e;});}return null;};}function removeEntity(_0x3c0d97,_0x215ea9){return function(_0x3d4bef){if(_0x3d4bef){return _0x3d4bef[_0x7b64('0x24')]()[_0x7b64('0x23')](function(){_0x3c0d97[_0x7b64('0x19')](0xcc)[_0x7b64('0x25')]();});}};}function handleEntityNotFound(_0x24b68e,_0x42efa1){return function(_0x50d06c){if(!_0x50d06c){_0x24b68e[_0x7b64('0x26')](0x194);}return _0x50d06c;};}function handleError(_0x5d9586,_0x1580d0){_0x1580d0=_0x1580d0||0x1f4;return function(_0x21fbd3){logger['error'](_0x21fbd3['stack']);if(_0x21fbd3[_0x7b64('0x27')]){delete _0x21fbd3[_0x7b64('0x27')];}_0x5d9586[_0x7b64('0x19')](_0x1580d0)[_0x7b64('0x28')](_0x21fbd3);};}exports[_0x7b64('0x29')]=function(_0x3c9fad,_0x6740b2){var _0x2729f1={},_0x53e29b={},_0x1616c9={'count':0x0,'rows':[]};var _0x2c4619=_['map'](db[_0x7b64('0x2a')][_0x7b64('0x2b')],function(_0x369402){return{'name':_0x369402[_0x7b64('0x2c')],'type':_0x369402[_0x7b64('0x2d')][_0x7b64('0x2e')]};});_0x53e29b['model']=_['map'](_0x2c4619,_0x7b64('0x27'));_0x53e29b[_0x7b64('0x2f')]=_['keys'](_0x3c9fad['query']);_0x53e29b[_0x7b64('0x30')]=_['intersection'](_0x53e29b[_0x7b64('0x31')],_0x53e29b['query']);_0x2729f1['attributes']=_['intersection'](_0x53e29b[_0x7b64('0x31')],qs[_0x7b64('0x32')](_0x3c9fad[_0x7b64('0x2f')]['fields']));_0x2729f1[_0x7b64('0x33')]=_0x2729f1['attributes'][_0x7b64('0x34')]?_0x2729f1[_0x7b64('0x33')]:_0x53e29b[_0x7b64('0x31')];if(!_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x35')]('nolimit')){_0x2729f1[_0x7b64('0x1d')]=qs[_0x7b64('0x1d')](_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x1d')]);_0x2729f1['offset']=qs[_0x7b64('0x1b')](_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x1b')]);}_0x2729f1[_0x7b64('0x36')]=qs[_0x7b64('0x37')](_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x37')]);_0x2729f1['where']=qs['filters'](_[_0x7b64('0x38')](_0x3c9fad[_0x7b64('0x2f')],_0x53e29b[_0x7b64('0x30')]),_0x2c4619);if(_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x39')]){_0x2729f1[_0x7b64('0x3a')]=_[_0x7b64('0x3b')](_0x2729f1[_0x7b64('0x3a')],{'$or':_[_0x7b64('0x3c')](_0x2c4619,function(_0x5b1278){if(_0x5b1278[_0x7b64('0x2d')]!==_0x7b64('0x3d')){var _0x451f9b={};_0x451f9b[_0x5b1278[_0x7b64('0x27')]]={'$like':'%'+_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x39')]+'%'};return _0x451f9b;}})});}_0x2729f1=_[_0x7b64('0x3b')]({},_0x2729f1,_0x3c9fad[_0x7b64('0x3e')]);var _0x3c4467={'where':_0x2729f1[_0x7b64('0x3a')]};return db[_0x7b64('0x2a')][_0x7b64('0x1e')](_0x3c4467)[_0x7b64('0x23')](function(_0x36cfce){_0x1616c9[_0x7b64('0x1e')]=_0x36cfce;if(_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x3f')]){_0x2729f1[_0x7b64('0x40')]=[{'all':!![]}];}return db[_0x7b64('0x2a')][_0x7b64('0x41')](_0x2729f1);})['then'](function(_0x442d65){_0x1616c9[_0x7b64('0x42')]=_0x442d65;return _0x1616c9;})[_0x7b64('0x23')](respondWithFilteredResult(_0x6740b2,_0x2729f1))['catch'](handleError(_0x6740b2,null));};exports[_0x7b64('0x43')]=function(_0x2e4d0f,_0x55c889){var _0x216c58={'raw':!![],'where':{'id':_0x2e4d0f['params']['id']}},_0xf0d4a1={};_0xf0d4a1[_0x7b64('0x31')]=_['keys'](db[_0x7b64('0x2a')][_0x7b64('0x2b')]);_0xf0d4a1[_0x7b64('0x2f')]=_['keys'](_0x2e4d0f[_0x7b64('0x2f')]);_0xf0d4a1[_0x7b64('0x30')]=_[_0x7b64('0x44')](_0xf0d4a1[_0x7b64('0x31')],_0xf0d4a1[_0x7b64('0x2f')]);_0x216c58[_0x7b64('0x33')]=_['intersection'](_0xf0d4a1[_0x7b64('0x31')],qs[_0x7b64('0x32')](_0x2e4d0f[_0x7b64('0x2f')][_0x7b64('0x32')]));_0x216c58[_0x7b64('0x33')]=_0x216c58['attributes']['length']?_0x216c58['attributes']:_0xf0d4a1['model'];if(_0x2e4d0f[_0x7b64('0x2f')][_0x7b64('0x3f')]){_0x216c58[_0x7b64('0x40')]=[{'all':!![]}];}_0x216c58=_[_0x7b64('0x3b')]({},_0x216c58,_0x2e4d0f[_0x7b64('0x3e')]);return db[_0x7b64('0x2a')][_0x7b64('0x45')](_0x216c58)[_0x7b64('0x23')](handleEntityNotFound(_0x55c889,null))[_0x7b64('0x23')](respondWithResult(_0x55c889,null))[_0x7b64('0x46')](handleError(_0x55c889,null));};exports[_0x7b64('0x47')]=function(_0x38983a,_0x4add4d){return db['Cdr'][_0x7b64('0x47')](_0x38983a[_0x7b64('0x48')],{})[_0x7b64('0x23')](respondWithResult(_0x4add4d,0xc9))[_0x7b64('0x46')](handleError(_0x4add4d,null));};exports[_0x7b64('0x22')]=function(_0x5a8639,_0x3e5321){if(_0x5a8639[_0x7b64('0x48')]['id']){delete _0x5a8639[_0x7b64('0x48')]['id'];}return db['Cdr'][_0x7b64('0x45')]({'where':{'id':_0x5a8639[_0x7b64('0x49')]['id']}})[_0x7b64('0x23')](handleEntityNotFound(_0x3e5321,null))[_0x7b64('0x23')](saveUpdates(_0x5a8639[_0x7b64('0x48')],null))['then'](respondWithResult(_0x3e5321,null))[_0x7b64('0x46')](handleError(_0x3e5321,null));};exports[_0x7b64('0x24')]=function(_0x52b04a,_0x3656b8){return db[_0x7b64('0x2a')]['find']({'where':{'id':_0x52b04a[_0x7b64('0x49')]['id']}})[_0x7b64('0x23')](handleEntityNotFound(_0x3656b8,null))[_0x7b64('0x23')](removeEntity(_0x3656b8,null))[_0x7b64('0x46')](handleError(_0x3656b8,null));};exports[_0x7b64('0x4a')]=function(_0x79cbc9,_0x253b33){return db[_0x7b64('0x2a')][_0x7b64('0x4a')]()[_0x7b64('0x23')](respondWithResult(_0x253b33,null))[_0x7b64('0x46')](handleError(_0x253b33,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index b23f903..dea31b7 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(_0x32f06c,_0x1d9c17){var _0x55595e=function(_0x2a11c0){while(--_0x2a11c0){_0x32f06c['push'](_0x32f06c['shift']());}};_0x55595e(++_0x1d9c17);}(_0x7a54,0x106));var _0x47a5=function(_0xe339af,_0x6e8518){_0xe339af=_0xe339af-0x0;var _0x526b4d=_0x7a54[_0xe339af];return _0x526b4d;};'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(_0x21a4b0,_0x2d7c42){var _0x405da0=function(_0x44de21){while(--_0x44de21){_0x21a4b0['push'](_0x21a4b0['shift']());}};_0x405da0(++_0x2d7c42);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 4da68ea..53c347b 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 _0x2d1a=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','Cdr,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash'];(function(_0x59eacf,_0x56ec4a){var _0x5d74f2=function(_0x5476ed){while(--_0x5476ed){_0x59eacf['push'](_0x59eacf['shift']());}};_0x5d74f2(++_0x56ec4a);}(_0x2d1a,0x18f));var _0xa2d1=function(_0x4db22b,_0x30003f){_0x4db22b=_0x4db22b-0x0;var _0x534552=_0x2d1a[_0x4db22b];return _0x534552;};'use strict';var _=require(_0xa2d1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa2d1('0x1'));var rs=require(_0xa2d1('0x2'));var fs=require('fs');var Redis=require(_0xa2d1('0x3'));var db=require(_0xa2d1('0x4'))['db'];var utils=require(_0xa2d1('0x5'));var logger=require(_0xa2d1('0x6'))(_0xa2d1('0x7'));var config=require('../../config/environment');var jayson=require(_0xa2d1('0x8'));var client=jayson[_0xa2d1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19a7cf,_0x2bb19b,_0x401a78){return new BPromise(function(_0x453fd6,_0x5b6f05){return client[_0xa2d1('0xa')](_0x19a7cf,_0x401a78)['then'](function(_0x373467){logger['info']('Cdr,\x20%s,\x20%s',_0x2bb19b,'request\x20sent');logger[_0xa2d1('0xb')](_0xa2d1('0xc'),_0x2bb19b,'request\x20sent',JSON['stringify'](_0x373467));if(_0x373467[_0xa2d1('0xd')]){if(_0x373467['error'][_0xa2d1('0xe')]===0x1f4){logger[_0xa2d1('0xd')](_0xa2d1('0xf'),_0x2bb19b,_0x373467[_0xa2d1('0xd')][_0xa2d1('0x10')]);return _0x5b6f05(_0x373467[_0xa2d1('0xd')][_0xa2d1('0x10')]);}logger[_0xa2d1('0xd')](_0xa2d1('0xf'),_0x2bb19b,_0x373467['error'][_0xa2d1('0x10')]);return _0x453fd6(_0x373467[_0xa2d1('0xd')][_0xa2d1('0x10')]);}else{logger['info'](_0xa2d1('0xf'),_0x2bb19b,_0xa2d1('0x11'));_0x453fd6(_0x373467[_0xa2d1('0x12')][_0xa2d1('0x10')]);}})[_0xa2d1('0x13')](function(_0x3f3bb6){logger[_0xa2d1('0xd')](_0xa2d1('0xf'),_0x2bb19b,_0x3f3bb6);_0x5b6f05(_0x3f3bb6);});});} \ No newline at end of file +var _0x9f4b=['http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x1f3a05,_0x4e3ca3){var _0x16358e=function(_0x291432){while(--_0x291432){_0x1f3a05['push'](_0x1f3a05['shift']());}};_0x16358e(++_0x4e3ca3);}(_0x9f4b,0xa0));var _0xb9f4=function(_0x116e08,_0x570e3f){_0x116e08=_0x116e08-0x0;var _0x513496=_0x9f4b[_0x116e08];return _0x513496;};'use strict';var _=require('lodash');var util=require(_0xb9f4('0x0'));var moment=require(_0xb9f4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9f4('0x2'))['db'];var utils=require(_0xb9f4('0x3'));var logger=require('../../config/logger')(_0xb9f4('0x4'));var config=require(_0xb9f4('0x5'));var jayson=require(_0xb9f4('0x6'));var client=jayson[_0xb9f4('0x7')][_0xb9f4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6b68f,_0x4189d4,_0x418c8e){return new BPromise(function(_0x11cd44,_0x2c7fb1){return client[_0xb9f4('0x9')](_0x6b68f,_0x418c8e)[_0xb9f4('0xa')](function(_0x5717c8){logger['info'](_0xb9f4('0xb'),_0x4189d4,_0xb9f4('0xc'));logger['debug'](_0xb9f4('0xd'),_0x4189d4,_0xb9f4('0xc'),JSON[_0xb9f4('0xe')](_0x5717c8));if(_0x5717c8[_0xb9f4('0xf')]){if(_0x5717c8[_0xb9f4('0xf')][_0xb9f4('0x10')]===0x1f4){logger[_0xb9f4('0xf')]('Cdr,\x20%s,\x20%s',_0x4189d4,_0x5717c8[_0xb9f4('0xf')][_0xb9f4('0x11')]);return _0x2c7fb1(_0x5717c8['error'][_0xb9f4('0x11')]);}logger[_0xb9f4('0xf')]('Cdr,\x20%s,\x20%s',_0x4189d4,_0x5717c8[_0xb9f4('0xf')][_0xb9f4('0x11')]);return _0x11cd44(_0x5717c8['error'][_0xb9f4('0x11')]);}else{logger[_0xb9f4('0x12')](_0xb9f4('0xb'),_0x4189d4,_0xb9f4('0xc'));_0x11cd44(_0x5717c8[_0xb9f4('0x13')][_0xb9f4('0x11')]);}})[_0xb9f4('0x14')](function(_0x1962f6){logger[_0xb9f4('0xf')](_0xb9f4('0xb'),_0x4189d4,_0x1962f6);_0x2c7fb1(_0x1962f6);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 73c2146..8685e69 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 _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(_0x2158cb,_0x36f1e3){var _0x3e0ea7=function(_0x1548f4){while(--_0x1548f4){_0x2158cb['push'](_0x2158cb['shift']());}};_0x3e0ea7(++_0x36f1e3);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e2c1e,_0x1e8d40){_0x3e2c1e=_0x3e2c1e-0x0;var _0x1c6666=_0xb10b[_0x3e2c1e];return _0x1c6666;};'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 +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(_0x4e1280,_0x3b8e04){var _0x59c5f=function(_0x50a33e){while(--_0x50a33e){_0x4e1280['push'](_0x4e1280['shift']());}};_0x59c5f(++_0x3b8e04);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index d91e54d..3018299 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 _0xdabc=['STRING','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x2e63ab,_0x49f112){var _0x2ddcdf=function(_0x554ca3){while(--_0x554ca3){_0x2e63ab['push'](_0x2e63ab['shift']());}};_0x2ddcdf(++_0x49f112);}(_0xdabc,0x16b));var _0xcdab=function(_0x2179e3,_0x3f7767){_0x2179e3=_0x2179e3-0x0;var _0x3a350b=_0xdabc[_0x2179e3];return _0x3a350b;};'use strict';var Sequelize=require('sequelize');module[_0xcdab('0x0')]={'priority':{'type':Sequelize[_0xcdab('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xcdab('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xcdab('0x3')]()},'description':{'type':Sequelize[_0xcdab('0x2')]},'interval':{'type':Sequelize[_0xcdab('0x2')],'defaultValue':_0xcdab('0x4')}}; \ No newline at end of file +var _0xf402=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xf402,0x122));var _0x2f40=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf402[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x2f40('0x0'));module[_0x2f40('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2f40('0x2')],'allowNull':![],'defaultValue':_0x2f40('0x3')},'appdata':{'type':Sequelize[_0x2f40('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2f40('0x2')],'defaultValue':_0x2f40('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index f7f37b7..d15cd71 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 _0xf194=['count','limit','set','apply','reject','save','update','then','destroy','end','error','name','send','show','params','model','ChatApplication','rawAttributes','keys','query','filters','intersection','fields','attributes','length','includeAll','include','options','find','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xf194,0x91));var _0x4f19=function(_0x2df72f,_0x14e57a){_0x2df72f=_0x2df72f-0x0;var _0x9d81b8=_0xf194[_0x2df72f];return _0x9d81b8;};'use strict';var emlformat=require(_0x4f19('0x0'));var rimraf=require(_0x4f19('0x1'));var zipdir=require(_0x4f19('0x2'));var jsonpatch=require(_0x4f19('0x3'));var rp=require('request-promise');var moment=require(_0x4f19('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4f19('0x5'));var sox=require(_0x4f19('0x6'));var csv=require(_0x4f19('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4f19('0x8'));var _=require(_0x4f19('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f19('0xa'));var deskjs=require(_0x4f19('0xb'));var toCsv=require(_0x4f19('0x7'));var querystring=require(_0x4f19('0xc'));var Papa=require('papaparse');var Redis=require(_0x4f19('0xd'));var authService=require(_0x4f19('0xe'));var qs=require(_0x4f19('0xf'));var as=require(_0x4f19('0x10'));var hardwareService=require(_0x4f19('0x11'));var logger=require(_0x4f19('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4f19('0x13'));var db=require(_0x4f19('0x14'))['db'];function respondWithStatusCode(_0x5f4f1d,_0x6280a0){_0x6280a0=_0x6280a0||0xcc;return function(_0x26348c){if(_0x26348c){return _0x5f4f1d[_0x4f19('0x15')](_0x6280a0);}return _0x5f4f1d[_0x4f19('0x16')](_0x6280a0)['end']();};}function respondWithResult(_0x144e21,_0x25e5ce){_0x25e5ce=_0x25e5ce||0xc8;return function(_0x4b7198){if(_0x4b7198){return _0x144e21[_0x4f19('0x16')](_0x25e5ce)[_0x4f19('0x17')](_0x4b7198);}};}function respondWithFilteredResult(_0x5b77b1,_0x298562){return function(_0x55e1f8){if(_0x55e1f8){var _0x33bded=typeof _0x298562[_0x4f19('0x18')]==='undefined'&&typeof _0x298562['limit']===_0x4f19('0x19');var _0x34f0dc=_0x55e1f8[_0x4f19('0x1a')];var _0x576eef=_0x33bded?0x0:_0x298562[_0x4f19('0x18')];var _0x205fee=_0x33bded?_0x55e1f8[_0x4f19('0x1a')]:_0x298562[_0x4f19('0x18')]+_0x298562[_0x4f19('0x1b')];var _0x5915a2;if(_0x205fee>=_0x34f0dc){_0x205fee=_0x34f0dc;_0x5915a2=0xc8;}else{_0x5915a2=0xce;}_0x5b77b1[_0x4f19('0x16')](_0x5915a2);return _0x5b77b1[_0x4f19('0x1c')]('Content-Range',_0x576eef+'-'+_0x205fee+'/'+_0x34f0dc)[_0x4f19('0x17')](_0x55e1f8);}return null;};}function patchUpdates(_0x14ff93){return function(_0x3312f8){try{jsonpatch[_0x4f19('0x1d')](_0x3312f8,_0x14ff93,!![]);}catch(_0x5ee94d){return BPromise[_0x4f19('0x1e')](_0x5ee94d);}return _0x3312f8[_0x4f19('0x1f')]();};}function saveUpdates(_0x13cdcb,_0xcbe002){return function(_0x11a272){if(_0x11a272){return _0x11a272[_0x4f19('0x20')](_0x13cdcb)[_0x4f19('0x21')](function(_0x40c007){return _0x40c007;});}return null;};}function removeEntity(_0x9e3298,_0x10e164){return function(_0x4531f4){if(_0x4531f4){return _0x4531f4[_0x4f19('0x22')]()[_0x4f19('0x21')](function(){_0x9e3298[_0x4f19('0x16')](0xcc)[_0x4f19('0x23')]();});}};}function handleEntityNotFound(_0x39cb12,_0x2fc1a4){return function(_0x3fede9){if(!_0x3fede9){_0x39cb12[_0x4f19('0x15')](0x194);}return _0x3fede9;};}function handleError(_0x56fe60,_0xabade8){_0xabade8=_0xabade8||0x1f4;return function(_0x5218c6){logger[_0x4f19('0x24')](_0x5218c6['stack']);if(_0x5218c6[_0x4f19('0x25')]){delete _0x5218c6['name'];}_0x56fe60[_0x4f19('0x16')](_0xabade8)[_0x4f19('0x26')](_0x5218c6);};}exports[_0x4f19('0x27')]=function(_0x567bd2,_0x444858){var _0x3a18b3={'raw':!![],'where':{'id':_0x567bd2[_0x4f19('0x28')]['id']}},_0x2175ff={};_0x2175ff[_0x4f19('0x29')]=_['keys'](db[_0x4f19('0x2a')][_0x4f19('0x2b')]);_0x2175ff['query']=_[_0x4f19('0x2c')](_0x567bd2[_0x4f19('0x2d')]);_0x2175ff[_0x4f19('0x2e')]=_[_0x4f19('0x2f')](_0x2175ff[_0x4f19('0x29')],_0x2175ff[_0x4f19('0x2d')]);_0x3a18b3['attributes']=_[_0x4f19('0x2f')](_0x2175ff[_0x4f19('0x29')],qs[_0x4f19('0x30')](_0x567bd2['query'][_0x4f19('0x30')]));_0x3a18b3[_0x4f19('0x31')]=_0x3a18b3[_0x4f19('0x31')][_0x4f19('0x32')]?_0x3a18b3[_0x4f19('0x31')]:_0x2175ff[_0x4f19('0x29')];if(_0x567bd2['query'][_0x4f19('0x33')]){_0x3a18b3[_0x4f19('0x34')]=[{'all':!![]}];}_0x3a18b3=_['merge']({},_0x3a18b3,_0x567bd2[_0x4f19('0x35')]);return db[_0x4f19('0x2a')][_0x4f19('0x36')](_0x3a18b3)[_0x4f19('0x21')](handleEntityNotFound(_0x444858,null))[_0x4f19('0x21')](respondWithResult(_0x444858,null))[_0x4f19('0x37')](handleError(_0x444858,null));};exports[_0x4f19('0x20')]=function(_0x502a4f,_0x1708f3){if(_0x502a4f[_0x4f19('0x38')]['id']){delete _0x502a4f[_0x4f19('0x38')]['id'];}return db[_0x4f19('0x2a')][_0x4f19('0x36')]({'where':{'id':_0x502a4f[_0x4f19('0x28')]['id']}})[_0x4f19('0x21')](handleEntityNotFound(_0x1708f3,null))[_0x4f19('0x21')](saveUpdates(_0x502a4f[_0x4f19('0x38')],null))['then'](respondWithResult(_0x1708f3,null))[_0x4f19('0x37')](handleError(_0x1708f3,null));};exports[_0x4f19('0x22')]=function(_0x106f8b,_0x34fbc2){return db[_0x4f19('0x2a')]['find']({'where':{'id':_0x106f8b['params']['id']}})[_0x4f19('0x21')](handleEntityNotFound(_0x34fbc2,null))[_0x4f19('0x21')](removeEntity(_0x34fbc2,null))['catch'](handleError(_0x34fbc2,null));}; \ No newline at end of file +var _0xbbfa=['find','catch','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','params','model','keys','ChatApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','merge','options'];(function(_0x144d66,_0x3d48c5){var _0x3527dd=function(_0x294474){while(--_0x294474){_0x144d66['push'](_0x144d66['shift']());}};_0x3527dd(++_0x3d48c5);}(_0xbbfa,0x1e9));var _0xabbf=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0xbbfa[_0xadde88];return _0x3b8eb6;};'use strict';var emlformat=require(_0xabbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabbf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabbf('0x2'));var moment=require(_0xabbf('0x3'));var BPromise=require(_0xabbf('0x4'));var Mustache=require(_0xabbf('0x5'));var util=require(_0xabbf('0x6'));var path=require(_0xabbf('0x7'));var sox=require(_0xabbf('0x8'));var csv=require(_0xabbf('0x9'));var ejs=require(_0xabbf('0xa'));var fs=require('fs');var fs_extra=require(_0xabbf('0xb'));var _=require(_0xabbf('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xabbf('0xd'));var toCsv=require(_0xabbf('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xabbf('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xabbf('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabbf('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xabbf('0x11'));var config=require(_0xabbf('0x12'));var licenseUtil=require(_0xabbf('0x13'));var db=require(_0xabbf('0x14'))['db'];function respondWithStatusCode(_0x265487,_0x1cc1a0){_0x1cc1a0=_0x1cc1a0||0xcc;return function(_0x28fb83){if(_0x28fb83){return _0x265487[_0xabbf('0x15')](_0x1cc1a0);}return _0x265487[_0xabbf('0x16')](_0x1cc1a0)['end']();};}function respondWithResult(_0x3c85e8,_0x5e6866){_0x5e6866=_0x5e6866||0xc8;return function(_0x3c6e6d){if(_0x3c6e6d){return _0x3c85e8['status'](_0x5e6866)[_0xabbf('0x17')](_0x3c6e6d);}};}function respondWithFilteredResult(_0x23a44a,_0x1df763){return function(_0x13b970){if(_0x13b970){var _0x529af0=typeof _0x1df763[_0xabbf('0x18')]===_0xabbf('0x19')&&typeof _0x1df763[_0xabbf('0x1a')]===_0xabbf('0x19');var _0xbfddcf=_0x13b970['count'];var _0x4252e1=_0x529af0?0x0:_0x1df763[_0xabbf('0x18')];var _0x57002d=_0x529af0?_0x13b970[_0xabbf('0x1b')]:_0x1df763[_0xabbf('0x18')]+_0x1df763['limit'];var _0x1269d9;if(_0x57002d>=_0xbfddcf){_0x57002d=_0xbfddcf;_0x1269d9=0xc8;}else{_0x1269d9=0xce;}_0x23a44a[_0xabbf('0x16')](_0x1269d9);return _0x23a44a[_0xabbf('0x1c')]('Content-Range',_0x4252e1+'-'+_0x57002d+'/'+_0xbfddcf)['json'](_0x13b970);}return null;};}function patchUpdates(_0xdf7640){return function(_0x4d4efb){try{jsonpatch[_0xabbf('0x1d')](_0x4d4efb,_0xdf7640,!![]);}catch(_0x918fc8){return BPromise['reject'](_0x918fc8);}return _0x4d4efb['save']();};}function saveUpdates(_0x44248b,_0x45cf44){return function(_0x2eaa02){if(_0x2eaa02){return _0x2eaa02[_0xabbf('0x1e')](_0x44248b)[_0xabbf('0x1f')](function(_0x35313f){return _0x35313f;});}return null;};}function removeEntity(_0x17d684,_0x573d83){return function(_0x281b36){if(_0x281b36){return _0x281b36[_0xabbf('0x20')]()[_0xabbf('0x1f')](function(){_0x17d684['status'](0xcc)[_0xabbf('0x21')]();});}};}function handleEntityNotFound(_0x26ebc6,_0x26bd52){return function(_0x28a5a1){if(!_0x28a5a1){_0x26ebc6[_0xabbf('0x15')](0x194);}return _0x28a5a1;};}function handleError(_0x5861fb,_0x3a0eca){_0x3a0eca=_0x3a0eca||0x1f4;return function(_0x4ef7cf){logger['error'](_0x4ef7cf[_0xabbf('0x22')]);if(_0x4ef7cf[_0xabbf('0x23')]){delete _0x4ef7cf['name'];}_0x5861fb[_0xabbf('0x16')](_0x3a0eca)[_0xabbf('0x24')](_0x4ef7cf);};}exports['show']=function(_0x4f8ed7,_0x53e49a){var _0x58c8bc={'raw':!![],'where':{'id':_0x4f8ed7[_0xabbf('0x25')]['id']}},_0xf50e5f={};_0xf50e5f[_0xabbf('0x26')]=_[_0xabbf('0x27')](db[_0xabbf('0x28')][_0xabbf('0x29')]);_0xf50e5f[_0xabbf('0x2a')]=_[_0xabbf('0x27')](_0x4f8ed7[_0xabbf('0x2a')]);_0xf50e5f[_0xabbf('0x2b')]=_['intersection'](_0xf50e5f[_0xabbf('0x26')],_0xf50e5f['query']);_0x58c8bc[_0xabbf('0x2c')]=_[_0xabbf('0x2d')](_0xf50e5f['model'],qs[_0xabbf('0x2e')](_0x4f8ed7[_0xabbf('0x2a')][_0xabbf('0x2e')]));_0x58c8bc[_0xabbf('0x2c')]=_0x58c8bc[_0xabbf('0x2c')][_0xabbf('0x2f')]?_0x58c8bc[_0xabbf('0x2c')]:_0xf50e5f['model'];if(_0x4f8ed7['query'][_0xabbf('0x30')]){_0x58c8bc['include']=[{'all':!![]}];}_0x58c8bc=_[_0xabbf('0x31')]({},_0x58c8bc,_0x4f8ed7[_0xabbf('0x32')]);return db[_0xabbf('0x28')][_0xabbf('0x33')](_0x58c8bc)[_0xabbf('0x1f')](handleEntityNotFound(_0x53e49a,null))[_0xabbf('0x1f')](respondWithResult(_0x53e49a,null))[_0xabbf('0x34')](handleError(_0x53e49a,null));};exports['update']=function(_0xe24bdd,_0xf81f1f){if(_0xe24bdd[_0xabbf('0x35')]['id']){delete _0xe24bdd['body']['id'];}return db[_0xabbf('0x28')][_0xabbf('0x33')]({'where':{'id':_0xe24bdd[_0xabbf('0x25')]['id']}})[_0xabbf('0x1f')](handleEntityNotFound(_0xf81f1f,null))[_0xabbf('0x1f')](saveUpdates(_0xe24bdd[_0xabbf('0x35')],null))[_0xabbf('0x1f')](respondWithResult(_0xf81f1f,null))[_0xabbf('0x34')](handleError(_0xf81f1f,null));};exports[_0xabbf('0x20')]=function(_0x4b56c9,_0xb82cbe){return db[_0xabbf('0x28')][_0xabbf('0x33')]({'where':{'id':_0x4b56c9[_0xabbf('0x25')]['id']}})[_0xabbf('0x1f')](handleEntityNotFound(_0xb82cbe,null))['then'](removeEntity(_0xb82cbe,null))[_0xabbf('0x34')](handleError(_0xb82cbe,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index fa3bc56..f890cf6 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 _0x2783=['rimraf','../../config/environment','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2783,0x1f2));var _0x3278=function(_0x2a8eca,_0x441e49){_0x2a8eca=_0x2a8eca-0x0;var _0x5ab193=_0x2783[_0x2a8eca];return _0x5ab193;};'use strict';var _=require(_0x3278('0x0'));var util=require('util');var logger=require(_0x3278('0x1'))(_0x3278('0x2'));var moment=require(_0x3278('0x3'));var BPromise=require('bluebird');var rp=require(_0x3278('0x4'));var fs=require('fs');var path=require(_0x3278('0x5'));var rimraf=require(_0x3278('0x6'));var config=require(_0x3278('0x7'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x1eedc9,_0x20258c){return _0x1eedc9[_0x3278('0x8')](_0x3278('0x9'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3278('0xa'),'collate':_0x3278('0xb')});}; \ No newline at end of file +var _0xc743=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x579295,_0x44ae19){var _0x5ac7e5=function(_0x297120){while(--_0x297120){_0x579295['push'](_0x579295['shift']());}};_0x5ac7e5(++_0x44ae19);}(_0xc743,0x103));var _0x3c74=function(_0x164004,_0x5eeea0){_0x164004=_0x164004-0x0;var _0x594e9b=_0xc743[_0x164004];return _0x594e9b;};'use strict';var _=require(_0x3c74('0x0'));var util=require(_0x3c74('0x1'));var logger=require(_0x3c74('0x2'))('api');var moment=require(_0x3c74('0x3'));var BPromise=require(_0x3c74('0x4'));var rp=require(_0x3c74('0x5'));var fs=require('fs');var path=require(_0x3c74('0x6'));var rimraf=require(_0x3c74('0x7'));var config=require(_0x3c74('0x8'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0xce3828,_0x3dfee6){return _0xce3828[_0x3c74('0x9')]('ChatApplication',attributes,{'tableName':_0x3c74('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3c74('0xb'),'collate':_0x3c74('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index d678a23..e4bd491 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 _0xb079=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','debug','error','code','message','result','moment','ioredis'];(function(_0xc41a99,_0x445b56){var _0x2b8e7f=function(_0x24ab36){while(--_0x24ab36){_0xc41a99['push'](_0xc41a99['shift']());}};_0x2b8e7f(++_0x445b56);}(_0xb079,0xd6));var _0x9b07=function(_0x3156bd,_0x2fa15d){_0x3156bd=_0x3156bd-0x0;var _0x1128e1=_0xb079[_0x3156bd];return _0x1128e1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9b07('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b07('0x1'));var db=require(_0x9b07('0x2'))['db'];var utils=require(_0x9b07('0x3'));var logger=require(_0x9b07('0x4'))(_0x9b07('0x5'));var config=require(_0x9b07('0x6'));var jayson=require(_0x9b07('0x7'));var client=jayson[_0x9b07('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ed38f,_0x4a5150,_0x461fa2){return new BPromise(function(_0x39fcdb,_0x96a204){return client[_0x9b07('0x9')](_0x3ed38f,_0x461fa2)[_0x9b07('0xa')](function(_0x1180c6){logger[_0x9b07('0xb')](_0x9b07('0xc'),_0x4a5150,'request\x20sent');logger[_0x9b07('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x4a5150,'request\x20sent',JSON['stringify'](_0x1180c6));if(_0x1180c6[_0x9b07('0xe')]){if(_0x1180c6['error'][_0x9b07('0xf')]===0x1f4){logger[_0x9b07('0xe')]('ChatApplication,\x20%s,\x20%s',_0x4a5150,_0x1180c6[_0x9b07('0xe')][_0x9b07('0x10')]);return _0x96a204(_0x1180c6['error']['message']);}logger[_0x9b07('0xe')](_0x9b07('0xc'),_0x4a5150,_0x1180c6[_0x9b07('0xe')][_0x9b07('0x10')]);return _0x39fcdb(_0x1180c6[_0x9b07('0xe')][_0x9b07('0x10')]);}else{logger[_0x9b07('0xb')](_0x9b07('0xc'),_0x4a5150,'request\x20sent');_0x39fcdb(_0x1180c6[_0x9b07('0x11')][_0x9b07('0x10')]);}})['catch'](function(_0xa4af0f){logger[_0x9b07('0xe')](_0x9b07('0xc'),_0x4a5150,_0xa4af0f);_0x96a204(_0xa4af0f);});});} \ No newline at end of file +var _0xcc13=['jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1f41b0,_0x3c75e7){var _0x4f4751=function(_0x8ed0b0){while(--_0x8ed0b0){_0x1f41b0['push'](_0x1f41b0['shift']());}};_0x4f4751(++_0x3c75e7);}(_0xcc13,0x16e));var _0x3cc1=function(_0x382ee5,_0xcc0e4c){_0x382ee5=_0x382ee5-0x0;var _0x12e725=_0xcc13[_0x382ee5];return _0x12e725;};'use strict';var _=require(_0x3cc1('0x0'));var util=require(_0x3cc1('0x1'));var moment=require(_0x3cc1('0x2'));var BPromise=require('bluebird');var rs=require(_0x3cc1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3cc1('0x4'))['db'];var utils=require(_0x3cc1('0x5'));var logger=require(_0x3cc1('0x6'))('rpc');var config=require(_0x3cc1('0x7'));var jayson=require(_0x3cc1('0x8'));var client=jayson[_0x3cc1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x256c33,_0x21b220,_0x1775f3){return new BPromise(function(_0x5e0933,_0x3c048c){return client[_0x3cc1('0xa')](_0x256c33,_0x1775f3)[_0x3cc1('0xb')](function(_0x26c310){logger[_0x3cc1('0xc')](_0x3cc1('0xd'),_0x21b220,_0x3cc1('0xe'));logger['debug'](_0x3cc1('0xf'),_0x21b220,_0x3cc1('0xe'),JSON[_0x3cc1('0x10')](_0x26c310));if(_0x26c310[_0x3cc1('0x11')]){if(_0x26c310[_0x3cc1('0x11')][_0x3cc1('0x12')]===0x1f4){logger[_0x3cc1('0x11')]('ChatApplication,\x20%s,\x20%s',_0x21b220,_0x26c310[_0x3cc1('0x11')]['message']);return _0x3c048c(_0x26c310[_0x3cc1('0x11')]['message']);}logger[_0x3cc1('0x11')](_0x3cc1('0xd'),_0x21b220,_0x26c310[_0x3cc1('0x11')][_0x3cc1('0x13')]);return _0x5e0933(_0x26c310['error']['message']);}else{logger['info'](_0x3cc1('0xd'),_0x21b220,_0x3cc1('0xe'));_0x5e0933(_0x26c310[_0x3cc1('0x14')]['message']);}})[_0x3cc1('0x15')](function(_0x20e861){logger['error'](_0x3cc1('0xd'),_0x21b220,_0x20e861);_0x3c048c(_0x20e861);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index e8cb1de..0ea1428 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 _0xec9e=['/:id','isAuthenticated','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x1840b1,_0x2d021e){var _0x54ee73=function(_0x313ab9){while(--_0x313ab9){_0x1840b1['push'](_0x1840b1['shift']());}};_0x54ee73(++_0x2d021e);}(_0xec9e,0x15b));var _0xeec9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec9e[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xeec9('0x0'));var util=require(_0xeec9('0x1'));var path=require(_0xeec9('0x2'));var timeout=require(_0xeec9('0x3'));var express=require(_0xeec9('0x4'));var router=express[_0xeec9('0x5')]();var fs_extra=require(_0xeec9('0x6'));var auth=require(_0xeec9('0x7'));var interaction=require(_0xeec9('0x8'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0xeec9('0x9')](_0xeec9('0xa'),auth[_0xeec9('0xb')](),controller[_0xeec9('0xc')]);router['put']('/:id',auth[_0xeec9('0xb')](),controller[_0xeec9('0xd')]);router[_0xeec9('0xe')](_0xeec9('0xa'),auth['isAuthenticated'](),controller[_0xeec9('0xf')]);module[_0xeec9('0x10')]=router; \ No newline at end of file +var _0x3eb1=['isAuthenticated','show','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3eb1,0x16d));var _0x13eb=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x3eb1[_0x5834bc];return _0x3e183a;};'use strict';var multer=require(_0x13eb('0x0'));var util=require(_0x13eb('0x1'));var path=require(_0x13eb('0x2'));var timeout=require(_0x13eb('0x3'));var express=require(_0x13eb('0x4'));var router=express[_0x13eb('0x5')]();var fs_extra=require(_0x13eb('0x6'));var auth=require(_0x13eb('0x7'));var interaction=require(_0x13eb('0x8'));var config=require(_0x13eb('0x9'));var controller=require(_0x13eb('0xa'));router[_0x13eb('0xb')](_0x13eb('0xc'),auth[_0x13eb('0xd')](),controller[_0x13eb('0xe')]);router['put'](_0x13eb('0xc'),auth[_0x13eb('0xd')](),controller[_0x13eb('0xf')]);router[_0x13eb('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x13eb('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 259aebf..4e91be9 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 _0xbd93=['sequelize','STRING','BOOLEAN'];(function(_0x3438cf,_0x73b174){var _0x278698=function(_0xbba932){while(--_0xbba932){_0x3438cf['push'](_0x3438cf['shift']());}};_0x278698(++_0x73b174);}(_0xbd93,0xba));var _0x3bd9=function(_0x8f14b8,_0x1163a4){_0x8f14b8=_0x8f14b8-0x0;var _0x5487ba=_0xbd93[_0x8f14b8];return _0x5487ba;};'use strict';var Sequelize=require(_0x3bd9('0x0'));module['exports']={'name':{'type':Sequelize[_0x3bd9('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3bd9('0x1')]},'write':{'type':Sequelize[_0x3bd9('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x36b6=['STRING','BOOLEAN','sequelize','exports'];(function(_0x585a2c,_0x345f6f){var _0x37fb63=function(_0x17036b){while(--_0x17036b){_0x585a2c['push'](_0x585a2c['shift']());}};_0x37fb63(++_0x345f6f);}(_0x36b6,0x13a));var _0x636b=function(_0x119572,_0x2cf11a){_0x119572=_0x119572-0x0;var _0x4759ae=_0x36b6[_0x119572];return _0x4759ae;};'use strict';var Sequelize=require(_0x636b('0x0'));module[_0x636b('0x1')]={'name':{'type':Sequelize[_0x636b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x636b('0x2')]},'write':{'type':Sequelize[_0x636b('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 9bfd4b0..44dc8b8 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 _0x8c6f=['getMembers','User','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','sendStatus','status','json','offset','undefined','count','apply','reject','save','update','then','destroy','error','stack','name','send','ChatGroup','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit'];(function(_0x589da5,_0x239489){var _0x149261=function(_0x908b00){while(--_0x908b00){_0x589da5['push'](_0x589da5['shift']());}};_0x149261(++_0x239489);}(_0x8c6f,0x12b));var _0xf8c6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8c6f[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xf8c6('0x0'));var rimraf=require(_0xf8c6('0x1'));var zipdir=require(_0xf8c6('0x2'));var jsonpatch=require(_0xf8c6('0x3'));var rp=require('request-promise');var moment=require(_0xf8c6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf8c6('0x5'));var util=require(_0xf8c6('0x6'));var path=require('path');var sox=require(_0xf8c6('0x7'));var csv=require(_0xf8c6('0x8'));var ejs=require(_0xf8c6('0x9'));var fs=require('fs');var fs_extra=require(_0xf8c6('0xa'));var _=require(_0xf8c6('0xb'));var squel=require('squel');var crypto=require(_0xf8c6('0xc'));var jsforce=require(_0xf8c6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf8c6('0x8'));var querystring=require(_0xf8c6('0xe'));var Papa=require(_0xf8c6('0xf'));var Redis=require(_0xf8c6('0x10'));var authService=require(_0xf8c6('0x11'));var qs=require(_0xf8c6('0x12'));var as=require(_0xf8c6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf8c6('0x14'));var utils=require(_0xf8c6('0x15'));var config=require(_0xf8c6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf8c6('0x17'))['db'];config[_0xf8c6('0x18')]=_[_0xf8c6('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf8c6('0x1a'))(new Redis(config[_0xf8c6('0x18')]));require(_0xf8c6('0x1b'))['register'](socket);function respondWithStatusCode(_0x272148,_0xe2a4cb){_0xe2a4cb=_0xe2a4cb||0xcc;return function(_0x21c567){if(_0x21c567){return _0x272148[_0xf8c6('0x1c')](_0xe2a4cb);}return _0x272148[_0xf8c6('0x1d')](_0xe2a4cb)['end']();};}function respondWithResult(_0x3e8b2c,_0x2171c1){_0x2171c1=_0x2171c1||0xc8;return function(_0x4fe731){if(_0x4fe731){return _0x3e8b2c[_0xf8c6('0x1d')](_0x2171c1)[_0xf8c6('0x1e')](_0x4fe731);}};}function respondWithFilteredResult(_0x3984f4,_0x178249){return function(_0x441a2c){if(_0x441a2c){var _0x1e75de=typeof _0x178249[_0xf8c6('0x1f')]===_0xf8c6('0x20')&&typeof _0x178249['limit']===_0xf8c6('0x20');var _0x369087=_0x441a2c[_0xf8c6('0x21')];var _0x3316f2=_0x1e75de?0x0:_0x178249[_0xf8c6('0x1f')];var _0x43e6b5=_0x1e75de?_0x441a2c['count']:_0x178249[_0xf8c6('0x1f')]+_0x178249['limit'];var _0x1b0c07;if(_0x43e6b5>=_0x369087){_0x43e6b5=_0x369087;_0x1b0c07=0xc8;}else{_0x1b0c07=0xce;}_0x3984f4[_0xf8c6('0x1d')](_0x1b0c07);return _0x3984f4['set']('Content-Range',_0x3316f2+'-'+_0x43e6b5+'/'+_0x369087)[_0xf8c6('0x1e')](_0x441a2c);}return null;};}function patchUpdates(_0x11881d){return function(_0x5e2fce){try{jsonpatch[_0xf8c6('0x22')](_0x5e2fce,_0x11881d,!![]);}catch(_0xcbf361){return BPromise[_0xf8c6('0x23')](_0xcbf361);}return _0x5e2fce[_0xf8c6('0x24')]();};}function saveUpdates(_0x4ed4fe,_0x5c9a26){return function(_0x2e429a){if(_0x2e429a){return _0x2e429a[_0xf8c6('0x25')](_0x4ed4fe)[_0xf8c6('0x26')](function(_0x5c4e91){return _0x5c4e91;});}return null;};}function removeEntity(_0x2f4b9f,_0xb145ae){return function(_0x3f8cdc){if(_0x3f8cdc){return _0x3f8cdc[_0xf8c6('0x27')]()[_0xf8c6('0x26')](function(){_0x2f4b9f[_0xf8c6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x681e61,_0x34c5dd){return function(_0x17e88f){if(!_0x17e88f){_0x681e61[_0xf8c6('0x1c')](0x194);}return _0x17e88f;};}function handleError(_0x40a2d5,_0x32e3c7){_0x32e3c7=_0x32e3c7||0x1f4;return function(_0x4ac42d){logger[_0xf8c6('0x28')](_0x4ac42d[_0xf8c6('0x29')]);if(_0x4ac42d[_0xf8c6('0x2a')]){delete _0x4ac42d[_0xf8c6('0x2a')];}_0x40a2d5[_0xf8c6('0x1d')](_0x32e3c7)[_0xf8c6('0x2b')](_0x4ac42d);};}exports['index']=function(_0x140719,_0x35428b){var _0x449218={},_0x3f5084={},_0x368fa3={'count':0x0,'rows':[]};var _0x47c330=_['map'](db[_0xf8c6('0x2c')]['rawAttributes'],function(_0x1cc299){return{'name':_0x1cc299['fieldName'],'type':_0x1cc299[_0xf8c6('0x2d')][_0xf8c6('0x2e')]};});_0x3f5084[_0xf8c6('0x2f')]=_['map'](_0x47c330,_0xf8c6('0x2a'));_0x3f5084[_0xf8c6('0x30')]=_[_0xf8c6('0x31')](_0x140719['query']);_0x3f5084[_0xf8c6('0x32')]=_[_0xf8c6('0x33')](_0x3f5084['model'],_0x3f5084[_0xf8c6('0x30')]);_0x449218[_0xf8c6('0x34')]=_[_0xf8c6('0x33')](_0x3f5084['model'],qs[_0xf8c6('0x35')](_0x140719[_0xf8c6('0x30')]['fields']));_0x449218['attributes']=_0x449218['attributes'][_0xf8c6('0x36')]?_0x449218[_0xf8c6('0x34')]:_0x3f5084['model'];if(!_0x140719[_0xf8c6('0x30')][_0xf8c6('0x37')](_0xf8c6('0x38'))){_0x449218['limit']=qs['limit'](_0x140719[_0xf8c6('0x30')][_0xf8c6('0x39')]);_0x449218[_0xf8c6('0x1f')]=qs[_0xf8c6('0x1f')](_0x140719[_0xf8c6('0x30')][_0xf8c6('0x1f')]);}_0x449218[_0xf8c6('0x3a')]=qs[_0xf8c6('0x3b')](_0x140719[_0xf8c6('0x30')][_0xf8c6('0x3b')]);_0x449218[_0xf8c6('0x3c')]=qs[_0xf8c6('0x32')](_[_0xf8c6('0x3d')](_0x140719[_0xf8c6('0x30')],_0x3f5084[_0xf8c6('0x32')]),_0x47c330);if(_0x140719[_0xf8c6('0x30')][_0xf8c6('0x3e')]){_0x449218[_0xf8c6('0x3c')]=_[_0xf8c6('0x3f')](_0x449218[_0xf8c6('0x3c')],{'$or':_[_0xf8c6('0x40')](_0x47c330,function(_0x549793){if(_0x549793[_0xf8c6('0x2d')]!==_0xf8c6('0x41')){var _0x122fdd={};_0x122fdd[_0x549793[_0xf8c6('0x2a')]]={'$like':'%'+_0x140719[_0xf8c6('0x30')][_0xf8c6('0x3e')]+'%'};return _0x122fdd;}})});}_0x449218=_[_0xf8c6('0x3f')]({},_0x449218,_0x140719[_0xf8c6('0x42')]);var _0x3fc11b={'where':_0x449218[_0xf8c6('0x3c')]};return db[_0xf8c6('0x2c')]['count'](_0x3fc11b)[_0xf8c6('0x26')](function(_0x271129){_0x368fa3[_0xf8c6('0x21')]=_0x271129;if(_0x140719[_0xf8c6('0x30')]['includeAll']){_0x449218[_0xf8c6('0x43')]=[{'all':!![]}];}return db[_0xf8c6('0x2c')][_0xf8c6('0x44')](_0x449218);})[_0xf8c6('0x26')](function(_0x1e5427){_0x368fa3[_0xf8c6('0x45')]=_0x1e5427;return _0x368fa3;})[_0xf8c6('0x26')](respondWithFilteredResult(_0x35428b,_0x449218))[_0xf8c6('0x46')](handleError(_0x35428b,null));};exports[_0xf8c6('0x47')]=function(_0x22fbfb,_0x5e8248){var _0x242729={'raw':!![],'where':{'id':_0x22fbfb[_0xf8c6('0x48')]['id']}},_0x4e5418={};_0x4e5418[_0xf8c6('0x2f')]=_[_0xf8c6('0x31')](db[_0xf8c6('0x2c')][_0xf8c6('0x49')]);_0x4e5418[_0xf8c6('0x30')]=_[_0xf8c6('0x31')](_0x22fbfb['query']);_0x4e5418[_0xf8c6('0x32')]=_[_0xf8c6('0x33')](_0x4e5418[_0xf8c6('0x2f')],_0x4e5418['query']);_0x242729[_0xf8c6('0x34')]=_['intersection'](_0x4e5418[_0xf8c6('0x2f')],qs[_0xf8c6('0x35')](_0x22fbfb[_0xf8c6('0x30')][_0xf8c6('0x35')]));_0x242729[_0xf8c6('0x34')]=_0x242729['attributes'][_0xf8c6('0x36')]?_0x242729[_0xf8c6('0x34')]:_0x4e5418['model'];if(_0x22fbfb[_0xf8c6('0x30')][_0xf8c6('0x4a')]){_0x242729[_0xf8c6('0x43')]=[{'all':!![]}];}_0x242729=_[_0xf8c6('0x3f')]({},_0x242729,_0x22fbfb['options']);return db[_0xf8c6('0x2c')][_0xf8c6('0x4b')](_0x242729)[_0xf8c6('0x26')](handleEntityNotFound(_0x5e8248,null))[_0xf8c6('0x26')](respondWithResult(_0x5e8248,null))[_0xf8c6('0x46')](handleError(_0x5e8248,null));};exports['create']=function(_0x3e31ea,_0x5d1d83){return db[_0xf8c6('0x2c')][_0xf8c6('0x4c')](_0x3e31ea[_0xf8c6('0x4d')],{})[_0xf8c6('0x26')](respondWithResult(_0x5d1d83,0xc9))[_0xf8c6('0x46')](handleError(_0x5d1d83,null));};exports[_0xf8c6('0x25')]=function(_0x1b3912,_0x13b182){if(_0x1b3912[_0xf8c6('0x4d')]['id']){delete _0x1b3912[_0xf8c6('0x4d')]['id'];}return db[_0xf8c6('0x2c')][_0xf8c6('0x4b')]({'where':{'id':_0x1b3912[_0xf8c6('0x48')]['id']}})[_0xf8c6('0x26')](handleEntityNotFound(_0x13b182,null))[_0xf8c6('0x26')](saveUpdates(_0x1b3912[_0xf8c6('0x4d')],null))[_0xf8c6('0x26')](respondWithResult(_0x13b182,null))[_0xf8c6('0x46')](handleError(_0x13b182,null));};exports['destroy']=function(_0x1d843b,_0x3ab3fa){return db[_0xf8c6('0x2c')][_0xf8c6('0x4b')]({'where':{'id':_0x1d843b[_0xf8c6('0x48')]['id']}})[_0xf8c6('0x26')](handleEntityNotFound(_0x3ab3fa,null))[_0xf8c6('0x26')](removeEntity(_0x3ab3fa,null))['catch'](handleError(_0x3ab3fa,null));};exports[_0xf8c6('0x4e')]=function(_0x19342d,_0x954128){return db[_0xf8c6('0x2c')][_0xf8c6('0x4e')]()['then'](respondWithResult(_0x954128,null))[_0xf8c6('0x46')](handleError(_0x954128,null));};exports[_0xf8c6('0x4f')]=function(_0x207dd2,_0x37ead6,_0x539075){return db[_0xf8c6('0x50')][_0xf8c6('0x21')]({'where':{'ChatGroupId':_0x207dd2[_0xf8c6('0x48')]['id'],'ToId':_0x207dd2['user']['id'],'read':![]}})[_0xf8c6('0x26')](function(_0x4ca7fa){return{'id':_[_0xf8c6('0x51')](_0x207dd2[_0xf8c6('0x48')]['id']),'count':_0x4ca7fa};})[_0xf8c6('0x26')](respondWithResult(_0x37ead6,null))['catch'](handleError(_0x37ead6,null));};exports['addMembers']=function(_0x55f462,_0x5a0e0b,_0x7ceea3){return db[_0xf8c6('0x2c')][_0xf8c6('0x4b')]({'where':{'id':_0x55f462[_0xf8c6('0x48')]['id']}})['then'](handleEntityNotFound(_0x5a0e0b,null))[_0xf8c6('0x26')](function(_0x4833dc){if(_0x4833dc){return _0x4833dc[_0xf8c6('0x52')](_0x55f462[_0xf8c6('0x4d')][_0xf8c6('0x53')],_[_0xf8c6('0x54')](_0x55f462[_0xf8c6('0x4d')],['ids','id'])||{});}})[_0xf8c6('0x26')](respondWithResult(_0x5a0e0b,null))['catch'](handleError(_0x5a0e0b,null));};exports[_0xf8c6('0x55')]=function(_0x5088ad,_0x358064,_0x16c307){var _0x9a1a48={};var _0x15ad1f={};var _0xa0ee19;var _0x42b4d8;return db[_0xf8c6('0x2c')]['findOne']({'where':{'id':_0x5088ad[_0xf8c6('0x48')]['id']}})['then'](handleEntityNotFound(_0x358064,null))['then'](function(_0x3a2041){if(_0x3a2041){_0xa0ee19=_0x3a2041;_0x15ad1f['model']=_[_0xf8c6('0x31')](db[_0xf8c6('0x56')][_0xf8c6('0x49')]);_0x15ad1f[_0xf8c6('0x30')]=_[_0xf8c6('0x31')](_0x5088ad['query']);_0x15ad1f[_0xf8c6('0x32')]=_['intersection'](_0x15ad1f[_0xf8c6('0x2f')],_0x15ad1f['query']);_0x9a1a48[_0xf8c6('0x34')]=_[_0xf8c6('0x33')](_0x15ad1f[_0xf8c6('0x2f')],qs[_0xf8c6('0x35')](_0x5088ad[_0xf8c6('0x30')][_0xf8c6('0x35')]));_0x9a1a48[_0xf8c6('0x34')]=_0x9a1a48[_0xf8c6('0x34')]['length']?_0x9a1a48[_0xf8c6('0x34')]:_0x15ad1f[_0xf8c6('0x2f')];_0x9a1a48[_0xf8c6('0x3a')]=qs[_0xf8c6('0x3b')](_0x5088ad[_0xf8c6('0x30')][_0xf8c6('0x3b')]);_0x9a1a48[_0xf8c6('0x3c')]=qs[_0xf8c6('0x32')](_[_0xf8c6('0x3d')](_0x5088ad[_0xf8c6('0x30')],_0x15ad1f[_0xf8c6('0x32')]));if(_0x5088ad[_0xf8c6('0x30')][_0xf8c6('0x3e')]){_0x9a1a48['where']=_[_0xf8c6('0x3f')](_0x9a1a48[_0xf8c6('0x3c')],{'$or':_['map'](_0x9a1a48['attributes'],function(_0x14c381){var _0x593372={};_0x593372[_0x14c381]={'$like':'%'+_0x5088ad[_0xf8c6('0x30')]['filter']+'%'};return _0x593372;})});}_0x9a1a48=_['merge']({},_0x9a1a48,_0x5088ad[_0xf8c6('0x42')]);return _0xa0ee19[_0xf8c6('0x55')](_0x9a1a48);}})['then'](function(_0x53bde0){if(_0x53bde0){_0x42b4d8=_0x53bde0[_0xf8c6('0x36')];if(!_0x5088ad['query'][_0xf8c6('0x37')](_0xf8c6('0x38'))){_0x9a1a48[_0xf8c6('0x39')]=qs[_0xf8c6('0x39')](_0x5088ad[_0xf8c6('0x30')]['limit']);_0x9a1a48[_0xf8c6('0x1f')]=qs[_0xf8c6('0x1f')](_0x5088ad[_0xf8c6('0x30')][_0xf8c6('0x1f')]);}return _0xa0ee19[_0xf8c6('0x55')](_0x9a1a48);}})[_0xf8c6('0x26')](function(_0x1109d4){if(_0x1109d4){return _0x1109d4?{'count':_0x42b4d8,'rows':_0x1109d4}:null;}})[_0xf8c6('0x26')](respondWithResult(_0x358064,null))[_0xf8c6('0x46')](handleError(_0x358064,null));};exports[_0xf8c6('0x57')]=function(_0x529bf7,_0x308763,_0x5a47c3){return db[_0xf8c6('0x2c')][_0xf8c6('0x4b')]({'where':{'id':_0x529bf7['params']['id']}})[_0xf8c6('0x26')](handleEntityNotFound(_0x308763,null))[_0xf8c6('0x26')](function(_0x5a15cb){if(_0x5a15cb){return _0x5a15cb['removeMembers'](_0x529bf7[_0xf8c6('0x30')][_0xf8c6('0x53')]);}})[_0xf8c6('0x26')](respondWithStatusCode(_0x308763,null))['catch'](handleError(_0x308763,null));};exports[_0xf8c6('0x58')]=function(_0x370c56,_0x8c2a63,_0x5a2661){if(_0x370c56[_0xf8c6('0x4d')]['id']){delete _0x370c56[_0xf8c6('0x4d')]['id'];}return db[_0xf8c6('0x2c')]['find']({'where':{'id':_0x370c56[_0xf8c6('0x48')]['id']}})[_0xf8c6('0x26')](handleEntityNotFound(_0x8c2a63,null))['then'](function(_0x290425){if(_0x290425){_0x370c56[_0xf8c6('0x4d')][_0xf8c6('0x59')]=_0x290425['id'];return db['ChatInternalMessage'][_0xf8c6('0x4c')](_0x370c56['body']);}})['then'](respondWithResult(_0x8c2a63,null))[_0xf8c6('0x46')](handleError(_0x8c2a63,null));};exports[_0xf8c6('0x5a')]=function(_0x2f22fc,_0x214dbc,_0x4da97f){var _0x574817={};var _0x3f41e7={};var _0x51faf1;var _0x1e5162;return db[_0xf8c6('0x2c')][_0xf8c6('0x5b')]({'where':{'id':_0x2f22fc[_0xf8c6('0x48')]['id']}})[_0xf8c6('0x26')](handleEntityNotFound(_0x214dbc,null))[_0xf8c6('0x26')](function(_0x2b42e7){if(_0x2b42e7){_0x51faf1=_0x2b42e7;_0x3f41e7['model']=_[_0xf8c6('0x31')](db[_0xf8c6('0x50')][_0xf8c6('0x49')]);_0x3f41e7['query']=_[_0xf8c6('0x31')](_0x2f22fc[_0xf8c6('0x30')]);_0x3f41e7[_0xf8c6('0x32')]=_[_0xf8c6('0x33')](_0x3f41e7[_0xf8c6('0x2f')],_0x3f41e7[_0xf8c6('0x30')]);_0x574817[_0xf8c6('0x34')]=_[_0xf8c6('0x33')](_0x3f41e7[_0xf8c6('0x2f')],qs[_0xf8c6('0x35')](_0x2f22fc[_0xf8c6('0x30')][_0xf8c6('0x35')]));_0x574817[_0xf8c6('0x34')]=_0x574817[_0xf8c6('0x34')][_0xf8c6('0x36')]?_0x574817['attributes']:_0x3f41e7[_0xf8c6('0x2f')];_0x574817[_0xf8c6('0x3a')]=qs[_0xf8c6('0x3b')](_0x2f22fc['query']['sort']);_0x574817[_0xf8c6('0x3c')]=qs[_0xf8c6('0x32')](_[_0xf8c6('0x3d')](_0x2f22fc[_0xf8c6('0x30')],_0x3f41e7[_0xf8c6('0x32')]));if(_0x2f22fc[_0xf8c6('0x30')][_0xf8c6('0x3e')]){_0x574817[_0xf8c6('0x3c')]=_[_0xf8c6('0x3f')](_0x574817[_0xf8c6('0x3c')],{'$or':_[_0xf8c6('0x40')](_0x574817[_0xf8c6('0x34')],function(_0x41eb1e){var _0x496d29={};_0x496d29[_0x41eb1e]={'$like':'%'+_0x2f22fc[_0xf8c6('0x30')][_0xf8c6('0x3e')]+'%'};return _0x496d29;})});}if(_0x2f22fc[_0xf8c6('0x30')]['$gte']){var _0x849faf=_0x2f22fc[_0xf8c6('0x30')][_0xf8c6('0x5c')][_0xf8c6('0x5d')](',');var _0x4b5799={};_0x4b5799[_0x849faf[0x0]]={'$gte':moment(_0x849faf[0x1])[_0xf8c6('0x5e')](_0xf8c6('0x5f'))};_0x574817[_0xf8c6('0x3c')]=_[_0xf8c6('0x3f')](_0x574817['where'],_0x4b5799);}_0x574817=_[_0xf8c6('0x3f')]({},_0x574817,_0x2f22fc[_0xf8c6('0x42')]);return _0x51faf1[_0xf8c6('0x5a')](_0x574817);}})['then'](function(_0x24afe9){if(_0x24afe9){_0x1e5162=_0x24afe9[_0xf8c6('0x36')];if(!_0x2f22fc[_0xf8c6('0x30')]['hasOwnProperty'](_0xf8c6('0x38'))){_0x574817['limit']=qs[_0xf8c6('0x39')](_0x2f22fc[_0xf8c6('0x30')][_0xf8c6('0x39')]);_0x574817[_0xf8c6('0x1f')]=qs[_0xf8c6('0x1f')](_0x2f22fc[_0xf8c6('0x30')][_0xf8c6('0x1f')]);}return _0x51faf1[_0xf8c6('0x5a')](_0x574817);}})[_0xf8c6('0x26')](function(_0x8fcae6){if(_0x8fcae6){return _0x8fcae6?{'count':_0x1e5162,'rows':_0x8fcae6}:null;}})[_0xf8c6('0x26')](respondWithResult(_0x214dbc,null))[_0xf8c6('0x46')](handleError(_0x214dbc,null));}; \ No newline at end of file +var _0xd5a8=['count','Content-Range','save','update','then','destroy','error','name','send','index','ChatGroup','rawAttributes','key','map','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','length','find','create','body','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','User','filter','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','findOne','$gte','split','YYYY-MM-DD\x20HH:mm:ss','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','limit'];(function(_0x4f8592,_0x45b563){var _0xa45ada=function(_0x3f7cf4){while(--_0x3f7cf4){_0x4f8592['push'](_0x4f8592['shift']());}};_0xa45ada(++_0x45b563);}(_0xd5a8,0x1af));var _0x8d5a=function(_0x285b7d,_0x46a4b7){_0x285b7d=_0x285b7d-0x0;var _0x1c6999=_0xd5a8[_0x285b7d];return _0x1c6999;};'use strict';var emlformat=require(_0x8d5a('0x0'));var rimraf=require(_0x8d5a('0x1'));var zipdir=require(_0x8d5a('0x2'));var jsonpatch=require(_0x8d5a('0x3'));var rp=require(_0x8d5a('0x4'));var moment=require('moment');var BPromise=require(_0x8d5a('0x5'));var Mustache=require(_0x8d5a('0x6'));var util=require(_0x8d5a('0x7'));var path=require(_0x8d5a('0x8'));var sox=require(_0x8d5a('0x9'));var csv=require(_0x8d5a('0xa'));var ejs=require(_0x8d5a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8d5a('0xc'));var squel=require(_0x8d5a('0xd'));var crypto=require('crypto');var jsforce=require(_0x8d5a('0xe'));var deskjs=require(_0x8d5a('0xf'));var toCsv=require(_0x8d5a('0xa'));var querystring=require(_0x8d5a('0x10'));var Papa=require(_0x8d5a('0x11'));var Redis=require(_0x8d5a('0x12'));var authService=require(_0x8d5a('0x13'));var qs=require(_0x8d5a('0x14'));var as=require(_0x8d5a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8d5a('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8d5a('0x17'))['db'];config[_0x8d5a('0x18')]=_[_0x8d5a('0x19')](config[_0x8d5a('0x18')],{'host':_0x8d5a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8d5a('0x18')]));require('./chatGroup.socket')[_0x8d5a('0x1b')](socket);function respondWithStatusCode(_0x45cf29,_0x116909){_0x116909=_0x116909||0xcc;return function(_0x4ba0ea){if(_0x4ba0ea){return _0x45cf29[_0x8d5a('0x1c')](_0x116909);}return _0x45cf29[_0x8d5a('0x1d')](_0x116909)['end']();};}function respondWithResult(_0x456329,_0x5298c5){_0x5298c5=_0x5298c5||0xc8;return function(_0x41a648){if(_0x41a648){return _0x456329[_0x8d5a('0x1d')](_0x5298c5)[_0x8d5a('0x1e')](_0x41a648);}};}function respondWithFilteredResult(_0x36322d,_0x1b1e84){return function(_0x144c2a){if(_0x144c2a){var _0x3a3c83=typeof _0x1b1e84[_0x8d5a('0x1f')]===_0x8d5a('0x20')&&typeof _0x1b1e84[_0x8d5a('0x21')]===_0x8d5a('0x20');var _0x2cbe26=_0x144c2a[_0x8d5a('0x22')];var _0x2666af=_0x3a3c83?0x0:_0x1b1e84[_0x8d5a('0x1f')];var _0x705d91=_0x3a3c83?_0x144c2a[_0x8d5a('0x22')]:_0x1b1e84[_0x8d5a('0x1f')]+_0x1b1e84['limit'];var _0x14756a;if(_0x705d91>=_0x2cbe26){_0x705d91=_0x2cbe26;_0x14756a=0xc8;}else{_0x14756a=0xce;}_0x36322d[_0x8d5a('0x1d')](_0x14756a);return _0x36322d['set'](_0x8d5a('0x23'),_0x2666af+'-'+_0x705d91+'/'+_0x2cbe26)[_0x8d5a('0x1e')](_0x144c2a);}return null;};}function patchUpdates(_0x38cf97){return function(_0x440abc){try{jsonpatch['apply'](_0x440abc,_0x38cf97,!![]);}catch(_0x30a752){return BPromise['reject'](_0x30a752);}return _0x440abc[_0x8d5a('0x24')]();};}function saveUpdates(_0x15f725,_0x1c1f1e){return function(_0x3156d7){if(_0x3156d7){return _0x3156d7[_0x8d5a('0x25')](_0x15f725)[_0x8d5a('0x26')](function(_0xc79a9){return _0xc79a9;});}return null;};}function removeEntity(_0xac4b9a,_0x55ff9d){return function(_0x2b77bb){if(_0x2b77bb){return _0x2b77bb[_0x8d5a('0x27')]()[_0x8d5a('0x26')](function(){_0xac4b9a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ce330,_0x596e2e){return function(_0x98cbea){if(!_0x98cbea){_0x5ce330[_0x8d5a('0x1c')](0x194);}return _0x98cbea;};}function handleError(_0xaed8e1,_0x249bc2){_0x249bc2=_0x249bc2||0x1f4;return function(_0x48a77a){logger[_0x8d5a('0x28')](_0x48a77a['stack']);if(_0x48a77a[_0x8d5a('0x29')]){delete _0x48a77a[_0x8d5a('0x29')];}_0xaed8e1['status'](_0x249bc2)[_0x8d5a('0x2a')](_0x48a77a);};}exports[_0x8d5a('0x2b')]=function(_0x96255d,_0x253cc2){var _0x1174fc={},_0x2ecdc3={},_0x6ad5be={'count':0x0,'rows':[]};var _0x3b06d0=_['map'](db[_0x8d5a('0x2c')][_0x8d5a('0x2d')],function(_0x503e33){return{'name':_0x503e33['fieldName'],'type':_0x503e33['type'][_0x8d5a('0x2e')]};});_0x2ecdc3['model']=_[_0x8d5a('0x2f')](_0x3b06d0,_0x8d5a('0x29'));_0x2ecdc3[_0x8d5a('0x30')]=_[_0x8d5a('0x31')](_0x96255d['query']);_0x2ecdc3[_0x8d5a('0x32')]=_[_0x8d5a('0x33')](_0x2ecdc3[_0x8d5a('0x34')],_0x2ecdc3[_0x8d5a('0x30')]);_0x1174fc[_0x8d5a('0x35')]=_[_0x8d5a('0x33')](_0x2ecdc3['model'],qs[_0x8d5a('0x36')](_0x96255d[_0x8d5a('0x30')][_0x8d5a('0x36')]));_0x1174fc[_0x8d5a('0x35')]=_0x1174fc[_0x8d5a('0x35')]['length']?_0x1174fc[_0x8d5a('0x35')]:_0x2ecdc3[_0x8d5a('0x34')];if(!_0x96255d[_0x8d5a('0x30')]['hasOwnProperty'](_0x8d5a('0x37'))){_0x1174fc[_0x8d5a('0x21')]=qs[_0x8d5a('0x21')](_0x96255d['query'][_0x8d5a('0x21')]);_0x1174fc[_0x8d5a('0x1f')]=qs[_0x8d5a('0x1f')](_0x96255d[_0x8d5a('0x30')]['offset']);}_0x1174fc[_0x8d5a('0x38')]=qs[_0x8d5a('0x39')](_0x96255d[_0x8d5a('0x30')][_0x8d5a('0x39')]);_0x1174fc[_0x8d5a('0x3a')]=qs[_0x8d5a('0x32')](_[_0x8d5a('0x3b')](_0x96255d['query'],_0x2ecdc3[_0x8d5a('0x32')]),_0x3b06d0);if(_0x96255d['query']['filter']){_0x1174fc[_0x8d5a('0x3a')]=_[_0x8d5a('0x3c')](_0x1174fc[_0x8d5a('0x3a')],{'$or':_[_0x8d5a('0x2f')](_0x3b06d0,function(_0x1f8dc7){if(_0x1f8dc7[_0x8d5a('0x3d')]!==_0x8d5a('0x3e')){var _0x4cdddf={};_0x4cdddf[_0x1f8dc7['name']]={'$like':'%'+_0x96255d[_0x8d5a('0x30')]['filter']+'%'};return _0x4cdddf;}})});}_0x1174fc=_[_0x8d5a('0x3c')]({},_0x1174fc,_0x96255d[_0x8d5a('0x3f')]);var _0x42f489={'where':_0x1174fc[_0x8d5a('0x3a')]};return db['ChatGroup'][_0x8d5a('0x22')](_0x42f489)[_0x8d5a('0x26')](function(_0x45ea1e){_0x6ad5be[_0x8d5a('0x22')]=_0x45ea1e;if(_0x96255d[_0x8d5a('0x30')][_0x8d5a('0x40')]){_0x1174fc[_0x8d5a('0x41')]=[{'all':!![]}];}return db[_0x8d5a('0x2c')]['findAll'](_0x1174fc);})[_0x8d5a('0x26')](function(_0x241493){_0x6ad5be['rows']=_0x241493;return _0x6ad5be;})[_0x8d5a('0x26')](respondWithFilteredResult(_0x253cc2,_0x1174fc))[_0x8d5a('0x42')](handleError(_0x253cc2,null));};exports[_0x8d5a('0x43')]=function(_0x249424,_0x1bb238){var _0x36eed1={'raw':!![],'where':{'id':_0x249424[_0x8d5a('0x44')]['id']}},_0x2d5fa4={};_0x2d5fa4[_0x8d5a('0x34')]=_[_0x8d5a('0x31')](db[_0x8d5a('0x2c')]['rawAttributes']);_0x2d5fa4[_0x8d5a('0x30')]=_[_0x8d5a('0x31')](_0x249424[_0x8d5a('0x30')]);_0x2d5fa4['filters']=_['intersection'](_0x2d5fa4[_0x8d5a('0x34')],_0x2d5fa4[_0x8d5a('0x30')]);_0x36eed1['attributes']=_[_0x8d5a('0x33')](_0x2d5fa4[_0x8d5a('0x34')],qs[_0x8d5a('0x36')](_0x249424[_0x8d5a('0x30')][_0x8d5a('0x36')]));_0x36eed1[_0x8d5a('0x35')]=_0x36eed1[_0x8d5a('0x35')][_0x8d5a('0x45')]?_0x36eed1['attributes']:_0x2d5fa4[_0x8d5a('0x34')];if(_0x249424['query'][_0x8d5a('0x40')]){_0x36eed1[_0x8d5a('0x41')]=[{'all':!![]}];}_0x36eed1=_[_0x8d5a('0x3c')]({},_0x36eed1,_0x249424[_0x8d5a('0x3f')]);return db[_0x8d5a('0x2c')][_0x8d5a('0x46')](_0x36eed1)['then'](handleEntityNotFound(_0x1bb238,null))['then'](respondWithResult(_0x1bb238,null))['catch'](handleError(_0x1bb238,null));};exports[_0x8d5a('0x47')]=function(_0x19d8e0,_0x49f7b8){return db[_0x8d5a('0x2c')][_0x8d5a('0x47')](_0x19d8e0[_0x8d5a('0x48')],{})[_0x8d5a('0x26')](respondWithResult(_0x49f7b8,0xc9))[_0x8d5a('0x42')](handleError(_0x49f7b8,null));};exports[_0x8d5a('0x25')]=function(_0xfb8e24,_0x45472f){if(_0xfb8e24[_0x8d5a('0x48')]['id']){delete _0xfb8e24[_0x8d5a('0x48')]['id'];}return db[_0x8d5a('0x2c')][_0x8d5a('0x46')]({'where':{'id':_0xfb8e24[_0x8d5a('0x44')]['id']}})[_0x8d5a('0x26')](handleEntityNotFound(_0x45472f,null))[_0x8d5a('0x26')](saveUpdates(_0xfb8e24[_0x8d5a('0x48')],null))[_0x8d5a('0x26')](respondWithResult(_0x45472f,null))[_0x8d5a('0x42')](handleError(_0x45472f,null));};exports[_0x8d5a('0x27')]=function(_0x15aef3,_0x4befde){return db[_0x8d5a('0x2c')]['find']({'where':{'id':_0x15aef3[_0x8d5a('0x44')]['id']}})['then'](handleEntityNotFound(_0x4befde,null))[_0x8d5a('0x26')](removeEntity(_0x4befde,null))[_0x8d5a('0x42')](handleError(_0x4befde,null));};exports[_0x8d5a('0x49')]=function(_0x16d2b4,_0x3b4de1){return db[_0x8d5a('0x2c')]['describe']()[_0x8d5a('0x26')](respondWithResult(_0x3b4de1,null))[_0x8d5a('0x42')](handleError(_0x3b4de1,null));};exports[_0x8d5a('0x4a')]=function(_0x53d243,_0xad5f3f,_0x1a803a){return db['ChatInternalMessage'][_0x8d5a('0x22')]({'where':{'ChatGroupId':_0x53d243[_0x8d5a('0x44')]['id'],'ToId':_0x53d243[_0x8d5a('0x4b')]['id'],'read':![]}})[_0x8d5a('0x26')](function(_0x5b8eaa){return{'id':_[_0x8d5a('0x4c')](_0x53d243[_0x8d5a('0x44')]['id']),'count':_0x5b8eaa};})['then'](respondWithResult(_0xad5f3f,null))['catch'](handleError(_0xad5f3f,null));};exports[_0x8d5a('0x4d')]=function(_0x565505,_0x3e25e6,_0x4d4fb0){return db[_0x8d5a('0x2c')][_0x8d5a('0x46')]({'where':{'id':_0x565505[_0x8d5a('0x44')]['id']}})[_0x8d5a('0x26')](handleEntityNotFound(_0x3e25e6,null))[_0x8d5a('0x26')](function(_0x4e067b){if(_0x4e067b){return _0x4e067b['addMembers'](_0x565505[_0x8d5a('0x48')][_0x8d5a('0x4e')],_[_0x8d5a('0x4f')](_0x565505[_0x8d5a('0x48')],[_0x8d5a('0x4e'),'id'])||{});}})[_0x8d5a('0x26')](respondWithResult(_0x3e25e6,null))[_0x8d5a('0x42')](handleError(_0x3e25e6,null));};exports[_0x8d5a('0x50')]=function(_0x5aff2d,_0x144da4,_0x55b002){var _0x3ae840={};var _0x226b15={};var _0xcc9774;var _0x31c35a;return db[_0x8d5a('0x2c')]['findOne']({'where':{'id':_0x5aff2d['params']['id']}})[_0x8d5a('0x26')](handleEntityNotFound(_0x144da4,null))[_0x8d5a('0x26')](function(_0x3711c1){if(_0x3711c1){_0xcc9774=_0x3711c1;_0x226b15[_0x8d5a('0x34')]=_['keys'](db[_0x8d5a('0x51')][_0x8d5a('0x2d')]);_0x226b15[_0x8d5a('0x30')]=_['keys'](_0x5aff2d[_0x8d5a('0x30')]);_0x226b15['filters']=_[_0x8d5a('0x33')](_0x226b15[_0x8d5a('0x34')],_0x226b15[_0x8d5a('0x30')]);_0x3ae840[_0x8d5a('0x35')]=_[_0x8d5a('0x33')](_0x226b15['model'],qs[_0x8d5a('0x36')](_0x5aff2d[_0x8d5a('0x30')][_0x8d5a('0x36')]));_0x3ae840[_0x8d5a('0x35')]=_0x3ae840[_0x8d5a('0x35')][_0x8d5a('0x45')]?_0x3ae840[_0x8d5a('0x35')]:_0x226b15[_0x8d5a('0x34')];_0x3ae840['order']=qs[_0x8d5a('0x39')](_0x5aff2d['query'][_0x8d5a('0x39')]);_0x3ae840['where']=qs[_0x8d5a('0x32')](_['pick'](_0x5aff2d['query'],_0x226b15[_0x8d5a('0x32')]));if(_0x5aff2d[_0x8d5a('0x30')][_0x8d5a('0x52')]){_0x3ae840['where']=_[_0x8d5a('0x3c')](_0x3ae840['where'],{'$or':_[_0x8d5a('0x2f')](_0x3ae840[_0x8d5a('0x35')],function(_0x27558c){var _0x50ab5c={};_0x50ab5c[_0x27558c]={'$like':'%'+_0x5aff2d[_0x8d5a('0x30')][_0x8d5a('0x52')]+'%'};return _0x50ab5c;})});}_0x3ae840=_[_0x8d5a('0x3c')]({},_0x3ae840,_0x5aff2d['options']);return _0xcc9774[_0x8d5a('0x50')](_0x3ae840);}})['then'](function(_0x275089){if(_0x275089){_0x31c35a=_0x275089[_0x8d5a('0x45')];if(!_0x5aff2d[_0x8d5a('0x30')]['hasOwnProperty']('nolimit')){_0x3ae840[_0x8d5a('0x21')]=qs[_0x8d5a('0x21')](_0x5aff2d[_0x8d5a('0x30')][_0x8d5a('0x21')]);_0x3ae840['offset']=qs[_0x8d5a('0x1f')](_0x5aff2d['query'][_0x8d5a('0x1f')]);}return _0xcc9774['getMembers'](_0x3ae840);}})[_0x8d5a('0x26')](function(_0x10cd61){if(_0x10cd61){return _0x10cd61?{'count':_0x31c35a,'rows':_0x10cd61}:null;}})['then'](respondWithResult(_0x144da4,null))['catch'](handleError(_0x144da4,null));};exports[_0x8d5a('0x53')]=function(_0x47c29a,_0x2ab501,_0x61d6ef){return db[_0x8d5a('0x2c')][_0x8d5a('0x46')]({'where':{'id':_0x47c29a[_0x8d5a('0x44')]['id']}})[_0x8d5a('0x26')](handleEntityNotFound(_0x2ab501,null))[_0x8d5a('0x26')](function(_0x142bf0){if(_0x142bf0){return _0x142bf0[_0x8d5a('0x53')](_0x47c29a[_0x8d5a('0x30')][_0x8d5a('0x4e')]);}})[_0x8d5a('0x26')](respondWithStatusCode(_0x2ab501,null))[_0x8d5a('0x42')](handleError(_0x2ab501,null));};exports[_0x8d5a('0x54')]=function(_0x13f57b,_0x4afedc,_0x27ac6f){if(_0x13f57b[_0x8d5a('0x48')]['id']){delete _0x13f57b[_0x8d5a('0x48')]['id'];}return db[_0x8d5a('0x2c')][_0x8d5a('0x46')]({'where':{'id':_0x13f57b[_0x8d5a('0x44')]['id']}})[_0x8d5a('0x26')](handleEntityNotFound(_0x4afedc,null))[_0x8d5a('0x26')](function(_0x46ca0f){if(_0x46ca0f){_0x13f57b['body'][_0x8d5a('0x55')]=_0x46ca0f['id'];return db[_0x8d5a('0x56')]['create'](_0x13f57b[_0x8d5a('0x48')]);}})[_0x8d5a('0x26')](respondWithResult(_0x4afedc,null))[_0x8d5a('0x42')](handleError(_0x4afedc,null));};exports[_0x8d5a('0x57')]=function(_0x341710,_0xf82cae,_0x517223){var _0x4162a5={};var _0x4282ae={};var _0x376f62;var _0x861c6d;return db[_0x8d5a('0x2c')][_0x8d5a('0x58')]({'where':{'id':_0x341710[_0x8d5a('0x44')]['id']}})[_0x8d5a('0x26')](handleEntityNotFound(_0xf82cae,null))[_0x8d5a('0x26')](function(_0x57dbc3){if(_0x57dbc3){_0x376f62=_0x57dbc3;_0x4282ae[_0x8d5a('0x34')]=_[_0x8d5a('0x31')](db[_0x8d5a('0x56')][_0x8d5a('0x2d')]);_0x4282ae[_0x8d5a('0x30')]=_[_0x8d5a('0x31')](_0x341710[_0x8d5a('0x30')]);_0x4282ae[_0x8d5a('0x32')]=_[_0x8d5a('0x33')](_0x4282ae[_0x8d5a('0x34')],_0x4282ae[_0x8d5a('0x30')]);_0x4162a5[_0x8d5a('0x35')]=_['intersection'](_0x4282ae[_0x8d5a('0x34')],qs[_0x8d5a('0x36')](_0x341710[_0x8d5a('0x30')][_0x8d5a('0x36')]));_0x4162a5[_0x8d5a('0x35')]=_0x4162a5['attributes'][_0x8d5a('0x45')]?_0x4162a5[_0x8d5a('0x35')]:_0x4282ae[_0x8d5a('0x34')];_0x4162a5[_0x8d5a('0x38')]=qs['sort'](_0x341710['query'][_0x8d5a('0x39')]);_0x4162a5[_0x8d5a('0x3a')]=qs['filters'](_[_0x8d5a('0x3b')](_0x341710[_0x8d5a('0x30')],_0x4282ae[_0x8d5a('0x32')]));if(_0x341710[_0x8d5a('0x30')][_0x8d5a('0x52')]){_0x4162a5['where']=_['merge'](_0x4162a5[_0x8d5a('0x3a')],{'$or':_[_0x8d5a('0x2f')](_0x4162a5[_0x8d5a('0x35')],function(_0x355bf3){var _0x49d85b={};_0x49d85b[_0x355bf3]={'$like':'%'+_0x341710[_0x8d5a('0x30')][_0x8d5a('0x52')]+'%'};return _0x49d85b;})});}if(_0x341710[_0x8d5a('0x30')][_0x8d5a('0x59')]){var _0x27ca57=_0x341710[_0x8d5a('0x30')][_0x8d5a('0x59')][_0x8d5a('0x5a')](',');var _0x24a2de={};_0x24a2de[_0x27ca57[0x0]]={'$gte':moment(_0x27ca57[0x1])['format'](_0x8d5a('0x5b'))};_0x4162a5['where']=_[_0x8d5a('0x3c')](_0x4162a5['where'],_0x24a2de);}_0x4162a5=_[_0x8d5a('0x3c')]({},_0x4162a5,_0x341710[_0x8d5a('0x3f')]);return _0x376f62[_0x8d5a('0x57')](_0x4162a5);}})['then'](function(_0x5b461c){if(_0x5b461c){_0x861c6d=_0x5b461c[_0x8d5a('0x45')];if(!_0x341710['query'][_0x8d5a('0x5c')](_0x8d5a('0x37'))){_0x4162a5[_0x8d5a('0x21')]=qs[_0x8d5a('0x21')](_0x341710[_0x8d5a('0x30')][_0x8d5a('0x21')]);_0x4162a5[_0x8d5a('0x1f')]=qs[_0x8d5a('0x1f')](_0x341710[_0x8d5a('0x30')]['offset']);}return _0x376f62[_0x8d5a('0x57')](_0x4162a5);}})['then'](function(_0xa03f81){if(_0xa03f81){return _0xa03f81?{'count':_0x861c6d,'rows':_0xa03f81}:null;}})[_0x8d5a('0x26')](respondWithResult(_0xf82cae,null))['catch'](handleError(_0xf82cae,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 624e0e0..127baa1 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 _0xc401=['save','update','remove','emit','exports','../../mysqldb','ChatGroup','setMaxListeners'];(function(_0x43d99a,_0x5250d7){var _0x17b61e=function(_0x545c1c){while(--_0x545c1c){_0x43d99a['push'](_0x43d99a['shift']());}};_0x17b61e(++_0x5250d7);}(_0xc401,0x15d));var _0x1c40=function(_0x51fc36,_0x569074){_0x51fc36=_0x51fc36-0x0;var _0x5d829a=_0xc401[_0x51fc36];return _0x5d829a;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x1c40('0x0'))['db'][_0x1c40('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x1c40('0x2')](0x0);var events={'afterCreate':_0x1c40('0x3'),'afterUpdate':_0x1c40('0x4'),'afterDestroy':_0x1c40('0x5')};function emitEvent(_0x3099da){return function(_0x34853a,_0x12f6f4,_0x4bf15e){ChatGroupEvents[_0x1c40('0x6')](_0x3099da+':'+_0x34853a['id'],_0x34853a);ChatGroupEvents[_0x1c40('0x6')](_0x3099da,_0x34853a);_0x4bf15e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x1c40('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0xc2c7=['update','remove','emit','hasOwnProperty','../../mysqldb','ChatGroup','setMaxListeners','save'];(function(_0x3ddd8c,_0x28b6f3){var _0x3a6932=function(_0x53c2e3){while(--_0x53c2e3){_0x3ddd8c['push'](_0x3ddd8c['shift']());}};_0x3a6932(++_0x28b6f3);}(_0xc2c7,0x134));var _0x7c2c=function(_0x48a517,_0x16d96a){_0x48a517=_0x48a517-0x0;var _0x48c4ed=_0xc2c7[_0x48a517];return _0x48c4ed;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x7c2c('0x0'))['db'][_0x7c2c('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x7c2c('0x2')](0x0);var events={'afterCreate':_0x7c2c('0x3'),'afterUpdate':_0x7c2c('0x4'),'afterDestroy':_0x7c2c('0x5')};function emitEvent(_0x472eae){return function(_0x116f8a,_0x4bbc14,_0x59f346){ChatGroupEvents[_0x7c2c('0x6')](_0x472eae+':'+_0x116f8a['id'],_0x116f8a);ChatGroupEvents[_0x7c2c('0x6')](_0x472eae,_0x116f8a);_0x59f346(null);};}for(var e in events){if(events[_0x7c2c('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 62df149..872d2a1 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 _0xc025=['moment','bluebird','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc025,0x136));var _0x5c02=function(_0xea34ca,_0x31054a){_0xea34ca=_0xea34ca-0x0;var _0xe6c09c=_0xc025[_0xea34ca];return _0xe6c09c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5c02('0x0'))(_0x5c02('0x1'));var moment=require(_0x5c02('0x2'));var BPromise=require(_0x5c02('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c02('0x4'));var rimraf=require(_0x5c02('0x5'));var config=require(_0x5c02('0x6'));var attributes=require(_0x5c02('0x7'));module[_0x5c02('0x8')]=function(_0x166e3b,_0x364537){return _0x166e3b[_0x5c02('0x9')](_0x5c02('0xa'),attributes,{'tableName':_0x5c02('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf474=['./chatGroup.attributes','ChatGroup','chat_groups','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x5d2561,_0x1465ca){var _0xbc3871=function(_0x5a1b46){while(--_0x5a1b46){_0x5d2561['push'](_0x5d2561['shift']());}};_0xbc3871(++_0x1465ca);}(_0xf474,0xcb));var _0x4f47=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xf474[_0x500419];return _0x241c1a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4f47('0x0'))('api');var moment=require(_0x4f47('0x1'));var BPromise=require(_0x4f47('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f47('0x3'));var rimraf=require('rimraf');var config=require(_0x4f47('0x4'));var attributes=require(_0x4f47('0x5'));module['exports']=function(_0x47ccbf,_0x4226f4){return _0x47ccbf['define'](_0x4f47('0x6'),attributes,{'tableName':_0x4f47('0x7'),'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 b1030e2..d3a3faa 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 _0x67d1=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','redis','defaults','localhost','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x385c76,_0xb97335){var _0x5c8367=function(_0xdfcd3){while(--_0xdfcd3){_0x385c76['push'](_0x385c76['shift']());}};_0x5c8367(++_0xb97335);}(_0x67d1,0xdf));var _0x167d=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x67d1[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x167d('0x0'));var util=require(_0x167d('0x1'));var moment=require(_0x167d('0x2'));var BPromise=require(_0x167d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x167d('0x4'));var db=require(_0x167d('0x5'))['db'];var utils=require(_0x167d('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x167d('0x7'));var client=jayson[_0x167d('0x8')][_0x167d('0x9')]({'port':0x232a});config[_0x167d('0xa')]=_[_0x167d('0xb')](config[_0x167d('0xa')],{'host':_0x167d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x167d('0xa')]));require(_0x167d('0xd'))[_0x167d('0xe')](socket);function respondWithRpcPromise(_0x128410,_0x3df6de,_0x1582ea){return new BPromise(function(_0x5b53b7,_0x26a075){return client[_0x167d('0xf')](_0x128410,_0x1582ea)[_0x167d('0x10')](function(_0x13314c){logger['info'](_0x167d('0x11'),_0x3df6de,_0x167d('0x12'));logger[_0x167d('0x13')](_0x167d('0x14'),_0x3df6de,_0x167d('0x12'),JSON[_0x167d('0x15')](_0x13314c));if(_0x13314c[_0x167d('0x16')]){if(_0x13314c[_0x167d('0x16')][_0x167d('0x17')]===0x1f4){logger[_0x167d('0x16')](_0x167d('0x11'),_0x3df6de,_0x13314c[_0x167d('0x16')]['message']);return _0x26a075(_0x13314c['error']['message']);}logger[_0x167d('0x16')](_0x167d('0x11'),_0x3df6de,_0x13314c[_0x167d('0x16')][_0x167d('0x18')]);return _0x5b53b7(_0x13314c[_0x167d('0x16')][_0x167d('0x18')]);}else{logger[_0x167d('0x19')]('ChatGroup,\x20%s,\x20%s',_0x3df6de,_0x167d('0x12'));_0x5b53b7(_0x13314c[_0x167d('0x1a')]['message']);}})[_0x167d('0x1b')](function(_0x50536d){logger[_0x167d('0x16')]('ChatGroup,\x20%s,\x20%s',_0x3df6de,_0x50536d);_0x26a075(_0x50536d);});});} \ No newline at end of file +var _0x4853=['ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','util','bluebird','randomstring'];(function(_0x3800bb,_0x5f2ef1){var _0x4af828=function(_0x55aa4f){while(--_0x55aa4f){_0x3800bb['push'](_0x3800bb['shift']());}};_0x4af828(++_0x5f2ef1);}(_0x4853,0x11d));var _0x3485=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4853[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x3485('0x0'));var moment=require('moment');var BPromise=require(_0x3485('0x1'));var rs=require(_0x3485('0x2'));var fs=require('fs');var Redis=require(_0x3485('0x3'));var db=require(_0x3485('0x4'))['db'];var utils=require(_0x3485('0x5'));var logger=require(_0x3485('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3485('0x7')][_0x3485('0x8')]({'port':0x232a});config[_0x3485('0x9')]=_[_0x3485('0xa')](config[_0x3485('0x9')],{'host':_0x3485('0xb'),'port':0x18eb});var socket=require(_0x3485('0xc'))(new Redis(config['redis']));require(_0x3485('0xd'))[_0x3485('0xe')](socket);function respondWithRpcPromise(_0x2d18a6,_0x876b94,_0xe402e6){return new BPromise(function(_0x466c62,_0x1a0315){return client[_0x3485('0xf')](_0x2d18a6,_0xe402e6)[_0x3485('0x10')](function(_0x523fff){logger[_0x3485('0x11')](_0x3485('0x12'),_0x876b94,'request\x20sent');logger['debug'](_0x3485('0x13'),_0x876b94,_0x3485('0x14'),JSON[_0x3485('0x15')](_0x523fff));if(_0x523fff['error']){if(_0x523fff['error']['code']===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x876b94,_0x523fff[_0x3485('0x16')][_0x3485('0x17')]);return _0x1a0315(_0x523fff[_0x3485('0x16')]['message']);}logger[_0x3485('0x16')]('ChatGroup,\x20%s,\x20%s',_0x876b94,_0x523fff['error'][_0x3485('0x17')]);return _0x466c62(_0x523fff['error'][_0x3485('0x17')]);}else{logger[_0x3485('0x11')](_0x3485('0x12'),_0x876b94,_0x3485('0x14'));_0x466c62(_0x523fff['result']['message']);}})['catch'](function(_0x575a78){logger['error'](_0x3485('0x12'),_0x876b94,_0x575a78);_0x1a0315(_0x575a78);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index d9386c4..09eab7d 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 _0x6a45=['update','removeListener','length','chatGroup:','./chatGroup.events','save','remove'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x6a45,0x1e0));var _0x56a4=function(_0x2aae3f,_0x746217){_0x2aae3f=_0x2aae3f-0x0;var _0x3c4745=_0x6a45[_0x2aae3f];return _0x3c4745;};'use strict';var ChatGroupEvents=require(_0x56a4('0x0'));var events=[_0x56a4('0x1'),_0x56a4('0x2'),_0x56a4('0x3')];function createListener(_0x1dd84a,_0x353feb){return function(_0x30ac4b){_0x353feb['emit'](_0x1dd84a,_0x30ac4b);};}function removeListener(_0x11238a,_0x37b60b){return function(){ChatGroupEvents[_0x56a4('0x4')](_0x11238a,_0x37b60b);};}exports['register']=function(_0x456e97){for(var _0x14693e=0x0,_0x5a51dc=events[_0x56a4('0x5')];_0x14693e<_0x5a51dc;_0x14693e++){var _0x4b82eb=events[_0x14693e];var _0x13498d=createListener(_0x56a4('0x6')+_0x4b82eb,_0x456e97);ChatGroupEvents['on'](_0x4b82eb,_0x13498d);}}; \ No newline at end of file +var _0xddb9=['removeListener','length','chatGroup:','./chatGroup.events','save','remove','update'];(function(_0x2e986d,_0x4b6b63){var _0x351c79=function(_0xf178c7){while(--_0xf178c7){_0x2e986d['push'](_0x2e986d['shift']());}};_0x351c79(++_0x4b6b63);}(_0xddb9,0x129));var _0x9ddb=function(_0x36917d,_0x20fdb8){_0x36917d=_0x36917d-0x0;var _0x407197=_0xddb9[_0x36917d];return _0x407197;};'use strict';var ChatGroupEvents=require(_0x9ddb('0x0'));var events=[_0x9ddb('0x1'),_0x9ddb('0x2'),_0x9ddb('0x3')];function createListener(_0x225318,_0x594459){return function(_0x106fdb){_0x594459['emit'](_0x225318,_0x106fdb);};}function removeListener(_0x53a259,_0x5b653c){return function(){ChatGroupEvents[_0x9ddb('0x4')](_0x53a259,_0x5b653c);};}exports['register']=function(_0x173147){for(var _0x5479b0=0x0,_0x29ef3e=events[_0x9ddb('0x5')];_0x5479b0<_0x29ef3e;_0x5479b0++){var _0x3eb3e8=events[_0x5479b0];var _0x2a1942=createListener(_0x9ddb('0x6')+_0x3eb3e8,_0x173147);ChatGroupEvents['on'](_0x3eb3e8,_0x2a1942);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 279ec8b..5b5cb68 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 _0xb074=['multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','destroy','delete','removeMembers','exports'];(function(_0x3c0646,_0x12a1c2){var _0x1cc334=function(_0x26349e){while(--_0x26349e){_0x3c0646['push'](_0x3c0646['shift']());}};_0x1cc334(++_0x12a1c2);}(_0xb074,0xbd));var _0x4b07=function(_0x3daa66,_0x1c3fda){_0x3daa66=_0x3daa66-0x0;var _0x3f3710=_0xb074[_0x3daa66];return _0x3f3710;};'use strict';var multer=require(_0x4b07('0x0'));var util=require(_0x4b07('0x1'));var path=require(_0x4b07('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4b07('0x3'));var auth=require(_0x4b07('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4b07('0x5'));var controller=require(_0x4b07('0x6'));router[_0x4b07('0x7')]('/',auth[_0x4b07('0x8')](),controller['index']);router[_0x4b07('0x7')](_0x4b07('0x9'),auth[_0x4b07('0x8')](),controller[_0x4b07('0xa')]);router[_0x4b07('0x7')](_0x4b07('0xb'),auth[_0x4b07('0x8')](),controller[_0x4b07('0xc')]);router['get'](_0x4b07('0xd'),auth[_0x4b07('0x8')](),controller['getUnread']);router[_0x4b07('0x7')](_0x4b07('0xe'),auth[_0x4b07('0x8')](),controller[_0x4b07('0xf')]);router[_0x4b07('0x7')](_0x4b07('0x10'),auth['isAuthenticated'](),controller[_0x4b07('0x11')]);router[_0x4b07('0x12')]('/',auth['isAuthenticated'](),controller[_0x4b07('0x13')]);router[_0x4b07('0x12')](_0x4b07('0xe'),auth[_0x4b07('0x8')](),controller[_0x4b07('0x14')]);router[_0x4b07('0x12')](_0x4b07('0x10'),auth[_0x4b07('0x8')](),controller[_0x4b07('0x15')]);router[_0x4b07('0x16')](_0x4b07('0xb'),auth[_0x4b07('0x8')](),controller['update']);router['delete'](_0x4b07('0xb'),auth[_0x4b07('0x8')](),controller[_0x4b07('0x17')]);router[_0x4b07('0x18')](_0x4b07('0xe'),auth['isAuthenticated'](),controller[_0x4b07('0x19')]);module[_0x4b07('0x1a')]=router; \ No newline at end of file +var _0xe448=['./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMessage','put','delete','destroy','removeMembers','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2c3a8f,_0x374e56){var _0x189412=function(_0x560055){while(--_0x560055){_0x2c3a8f['push'](_0x2c3a8f['shift']());}};_0x189412(++_0x374e56);}(_0xe448,0x137));var _0x8e44=function(_0x52d2f9,_0x1caeeb){_0x52d2f9=_0x52d2f9-0x0;var _0x338ad0=_0xe448[_0x52d2f9];return _0x338ad0;};'use strict';var multer=require(_0x8e44('0x0'));var util=require(_0x8e44('0x1'));var path=require(_0x8e44('0x2'));var timeout=require(_0x8e44('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8e44('0x4'));var auth=require(_0x8e44('0x5'));var interaction=require(_0x8e44('0x6'));var config=require(_0x8e44('0x7'));var controller=require(_0x8e44('0x8'));router[_0x8e44('0x9')]('/',auth[_0x8e44('0xa')](),controller[_0x8e44('0xb')]);router['get'](_0x8e44('0xc'),auth[_0x8e44('0xa')](),controller[_0x8e44('0xd')]);router['get'](_0x8e44('0xe'),auth[_0x8e44('0xa')](),controller[_0x8e44('0xf')]);router[_0x8e44('0x9')](_0x8e44('0x10'),auth[_0x8e44('0xa')](),controller[_0x8e44('0x11')]);router[_0x8e44('0x9')](_0x8e44('0x12'),auth['isAuthenticated'](),controller[_0x8e44('0x13')]);router[_0x8e44('0x9')](_0x8e44('0x14'),auth['isAuthenticated'](),controller[_0x8e44('0x15')]);router[_0x8e44('0x16')]('/',auth['isAuthenticated'](),controller[_0x8e44('0x17')]);router['post'](_0x8e44('0x12'),auth[_0x8e44('0xa')](),controller['addMembers']);router[_0x8e44('0x16')]('/:id/messages',auth['isAuthenticated'](),controller[_0x8e44('0x18')]);router[_0x8e44('0x19')](_0x8e44('0xe'),auth[_0x8e44('0xa')](),controller['update']);router[_0x8e44('0x1a')](_0x8e44('0xe'),auth[_0x8e44('0xa')](),controller[_0x8e44('0x1b')]);router[_0x8e44('0x1a')]('/:id/members',auth[_0x8e44('0xa')](),controller[_0x8e44('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 8551373..fb1c7ea 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 _0xd87e=['ENUM','star','TEXT','STRING','long','DATE','sequelize','exports','INTEGER'];(function(_0x2d6f09,_0x2adc0e){var _0x15b512=function(_0x28ebb5){while(--_0x28ebb5){_0x2d6f09['push'](_0x2d6f09['shift']());}};_0x15b512(++_0x2adc0e);}(_0xd87e,0x1bf));var _0xed87=function(_0x523a67,_0x11ea07){_0x523a67=_0x523a67-0x0;var _0x3e5b9d=_0xd87e[_0x523a67];return _0x3e5b9d;};'use strict';var Sequelize=require(_0xed87('0x0'));module[_0xed87('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xed87('0x2')]},'ratingType':{'type':Sequelize[_0xed87('0x3')](_0xed87('0x4'),'thumb'),'defaultValue':_0xed87('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xed87('0x5')]},'mailTranscript':{'type':Sequelize[_0xed87('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xed87('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xed87('0x6')]},'browserName':{'type':Sequelize[_0xed87('0x6')]},'browserVersion':{'type':Sequelize[_0xed87('0x6')]},'osName':{'type':Sequelize[_0xed87('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xed87('0x6')]},'deviceVendor':{'type':Sequelize[_0xed87('0x6')]},'deviceType':{'type':Sequelize[_0xed87('0x6')]},'referer':{'type':Sequelize[_0xed87('0x5')]},'customerIp':{'type':Sequelize[_0xed87('0x6')]},'formData':{'type':Sequelize[_0xed87('0x5')](_0xed87('0x7'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xed87('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xed87('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xed87('0x6')]},'customerPort':{'type':Sequelize[_0xed87('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x317b=['STRING','DATE','out','BOOLEAN','sequelize','exports','INTEGER','ENUM','thumb','star','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x317b,0x1c7));var _0xb317=function(_0x27eb55,_0x469ad1){_0x27eb55=_0x27eb55-0x0;var _0x557b62=_0x317b[_0x27eb55];return _0x557b62;};'use strict';var Sequelize=require(_0xb317('0x0'));module[_0xb317('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xb317('0x2')]},'ratingType':{'type':Sequelize[_0xb317('0x3')]('star',_0xb317('0x4')),'defaultValue':_0xb317('0x5')},'ratingMessage':{'type':Sequelize[_0xb317('0x6')]},'pathTranscript':{'type':Sequelize[_0xb317('0x6')]},'mailTranscript':{'type':Sequelize[_0xb317('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xb317('0x8')]},'disposition':{'type':Sequelize[_0xb317('0x7')]},'secondDisposition':{'type':Sequelize[_0xb317('0x7')]},'thirdDisposition':{'type':Sequelize[_0xb317('0x7')]},'note':{'type':Sequelize[_0xb317('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0xb317('0x7')]},'osName':{'type':Sequelize[_0xb317('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xb317('0x7')]},'deviceVendor':{'type':Sequelize[_0xb317('0x7')]},'deviceType':{'type':Sequelize[_0xb317('0x7')]},'referer':{'type':Sequelize[_0xb317('0x6')]},'customerIp':{'type':Sequelize[_0xb317('0x7')]},'formData':{'type':Sequelize[_0xb317('0x6')]('long')},'read1stAt':{'type':Sequelize[_0xb317('0x8')]},'lastMsgAt':{'type':Sequelize[_0xb317('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xb317('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0xb317('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xb317('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xb317('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 68771be..e703ed5 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 _0x14a0=['t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ChatInteractionId','rows','show','params','intersection','includeAll','include','options','create','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','customUpdate','CmContact','Contact','abandon','closed','disposition','AbandonInteraction','file','originalname','basename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','join','root','server/files/attachments/','offline-chat/','download','server/files/chat/upload/','transcript-%s.txt','now','ChatMessage','Messages','format','agentAlias','System','customer','agentIdentifier','%s%d','agent_alias','alias','agent_fullname','createdAt','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','addTags','omit','spread','chatInteractionTags:save','removeTags','files','server','attachments','firstName','lastName','Account','get','Chat','Owner','N.A.','closedAt','osName','referer','customerPort','existsSync','createReadStream','pipe','out','views','transcript-','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','merge','contact','agent','interaction','account','Users','map','fullname','Tags','TagIds','split','forEach','push','ChatInteraction','rawAttributes','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','select','color','tools_tags','field','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','length','getFullTextValue','ContactId','buildExpression','text','start','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','isEmpty','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','DESC'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0x14a0,0x8e));var _0x014a=function(_0x5ddbc8,_0x4380a9){_0x5ddbc8=_0x5ddbc8-0x0;var _0x31d378=_0x14a0[_0x5ddbc8];return _0x31d378;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x014a('0x0'));var zipdir=require(_0x014a('0x1'));var jsonpatch=require(_0x014a('0x2'));var rp=require(_0x014a('0x3'));var moment=require(_0x014a('0x4'));var BPromise=require(_0x014a('0x5'));var Mustache=require(_0x014a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x014a('0x7'));var csv=require(_0x014a('0x8'));var ejs=require(_0x014a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x014a('0xf'));var logger=require(_0x014a('0x10'))('api');var utils=require(_0x014a('0x11'));var config=require(_0x014a('0x12'));var licenseUtil=require(_0x014a('0x13'));var db=require(_0x014a('0x14'))['db'];config[_0x014a('0x15')]=_[_0x014a('0x16')](config[_0x014a('0x15')],{'host':_0x014a('0x17'),'port':0x18eb});var socket=require(_0x014a('0x18'))(new Redis(config[_0x014a('0x15')]));require(_0x014a('0x19'))[_0x014a('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x014a('0x1b')][_0x014a('0x1c')]({'port':0x232b});var client9004=jayson['client'][_0x014a('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x128c46,_0x59a4ea,_0x16e6fc,_0x17e4be){return new BPromise(function(_0x20f148,_0x12da95){var _0x2c26ac=_0x17e4be||client;return _0x2c26ac[_0x014a('0x1d')](_0x128c46,_0x16e6fc)[_0x014a('0x1e')](function(_0x263b07){logger[_0x014a('0x1f')](_0x014a('0x20'),_0x59a4ea,_0x014a('0x21'));logger[_0x014a('0x22')](_0x014a('0x23'),_0x59a4ea,_0x014a('0x21'),JSON['stringify'](_0x263b07));if(_0x263b07[_0x014a('0x24')]){if(_0x263b07[_0x014a('0x24')][_0x014a('0x25')]===0x1f4){logger[_0x014a('0x24')](_0x014a('0x20'),_0x59a4ea,_0x263b07[_0x014a('0x24')][_0x014a('0x26')]);return _0x12da95(_0x263b07[_0x014a('0x24')][_0x014a('0x26')]);}logger['error'](_0x014a('0x20'),_0x59a4ea,_0x263b07['error'][_0x014a('0x26')]);return _0x20f148(_0x263b07[_0x014a('0x24')][_0x014a('0x26')]);}else{logger[_0x014a('0x1f')](_0x014a('0x20'),_0x59a4ea,_0x014a('0x21'));_0x20f148(_0x263b07[_0x014a('0x27')][_0x014a('0x26')]);}})[_0x014a('0x28')](function(_0x4c2627){logger[_0x014a('0x24')]('ChatInteraction,\x20%s,\x20%s',_0x59a4ea,_0x4c2627);_0x12da95(_0x4c2627);});});}function respondWithStatusCode(_0x39a432,_0x28701e){_0x28701e=_0x28701e||0xcc;return function(_0x4f1c44){if(_0x4f1c44){return _0x39a432['sendStatus'](_0x28701e);}return _0x39a432[_0x014a('0x29')](_0x28701e)[_0x014a('0x2a')]();};}function respondWithResult(_0x143346,_0x5ed71b){_0x5ed71b=_0x5ed71b||0xc8;return function(_0x183f19){if(_0x183f19){return _0x143346[_0x014a('0x29')](_0x5ed71b)['json'](_0x183f19);}};}function respondWithFilteredResult(_0x31dc95,_0x2560a6){return function(_0x496040){if(_0x496040){var _0x4f9c1c=typeof _0x2560a6[_0x014a('0x2b')]===_0x014a('0x2c')&&typeof _0x2560a6[_0x014a('0x2d')]===_0x014a('0x2c');var _0x4ea00c=_0x496040[_0x014a('0x2e')];var _0x147e7e=_0x4f9c1c?0x0:_0x2560a6[_0x014a('0x2b')];var _0x402d3b=_0x4f9c1c?_0x496040[_0x014a('0x2e')]:_0x2560a6[_0x014a('0x2b')]+_0x2560a6[_0x014a('0x2d')];var _0x1dae8e;if(_0x402d3b>=_0x4ea00c){_0x402d3b=_0x4ea00c;_0x1dae8e=0xc8;}else{_0x1dae8e=0xce;}_0x31dc95[_0x014a('0x29')](_0x1dae8e);return _0x31dc95[_0x014a('0x2f')](_0x014a('0x30'),_0x147e7e+'-'+_0x402d3b+'/'+_0x4ea00c)['json'](_0x496040);}return null;};}function patchUpdates(_0x105d4a){return function(_0x41ead8){try{jsonpatch[_0x014a('0x31')](_0x41ead8,_0x105d4a,!![]);}catch(_0x457883){return BPromise[_0x014a('0x32')](_0x457883);}return _0x41ead8[_0x014a('0x33')]();};}function saveUpdates(_0x211d18,_0x4dd025){return function(_0x116a24){if(_0x116a24){return _0x116a24[_0x014a('0x34')](_0x211d18)['then'](function(_0x415f83){return _0x415f83;});}return null;};}function removeEntity(_0x12de94,_0x40738f){return function(_0x467032){if(_0x467032){return _0x467032[_0x014a('0x35')]()[_0x014a('0x1e')](function(){_0x12de94[_0x014a('0x29')](0xcc)[_0x014a('0x2a')]();});}};}function handleEntityNotFound(_0x5e37e4,_0x19cee1){return function(_0x1dfe6e){if(!_0x1dfe6e){_0x5e37e4[_0x014a('0x36')](0x194);}return _0x1dfe6e;};}function handleError(_0x1f31c8,_0x5127f3){_0x5127f3=_0x5127f3||0x1f4;return function(_0x427c7a){logger[_0x014a('0x24')](_0x427c7a[_0x014a('0x37')]);if(_0x427c7a[_0x014a('0x38')]){delete _0x427c7a[_0x014a('0x38')];}_0x1f31c8[_0x014a('0x29')](_0x5127f3)[_0x014a('0x39')](_0x427c7a);};}function getMustacheRender(_0x36187b,_0x1ec350){return Mustache['render'](_0x36187b,_[_0x014a('0x3a')](_0x1ec350['body'],{'contact':_0x1ec350[_0x014a('0x3b')],'message':_0x1ec350[_0x014a('0x26')],'agent':_0x1ec350[_0x014a('0x3c')],'interaction':_0x1ec350[_0x014a('0x3d')],'account':_0x1ec350[_0x014a('0x3e')]}))||'';}function getInteractionUsers(_0x55126d,_0x1c6f6f){return new BPromise(function(_0x3f4a61,_0x51dca8){try{if(_0x1c6f6f[_0x55126d['id']]){_0x55126d[_0x014a('0x3f')]=_[_0x014a('0x40')](_0x1c6f6f[_0x55126d['id']],function(_0x3e5ecf){return{'id':_0x3e5ecf['id'],'fullname':_0x3e5ecf[_0x014a('0x41')]};});}}catch(_0x3788d6){_0x51dca8(_0x3788d6);}_0x3f4a61(_0x55126d);});}function getInteractionTags(_0x313eb8,_0x17b1b6){return new BPromise(function(_0x764fbe,_0x2beddc){try{if(_0x313eb8['TagIds']){_0x313eb8[_0x014a('0x42')]=[];_0x313eb8[_0x014a('0x43')][_0x014a('0x44')](',')[_0x014a('0x45')](function(_0x5f1a91){_0x313eb8[_0x014a('0x42')][_0x014a('0x46')](_0x17b1b6[_0x5f1a91]);});}delete _0x313eb8[_0x014a('0x43')];}catch(_0x1355dd){_0x2beddc(_0x1355dd);}_0x764fbe(_0x313eb8);});}function updateChatInteraction(_0x1dc647,_0x430a56,_0x5f2969){return new BPromise(function(_0x361866,_0x2830e1){return getInteractionUsers(_0x1dc647,_0x5f2969)['then'](function(_0xc086b3){return getInteractionTags(_0xc086b3,_0x430a56);})[_0x014a('0x1e')](function(_0x2c45f1){_0x361866(_0x2c45f1);})['catch'](function(_0x5bcf8){_0x2830e1(_0x5bcf8);});});}exports['index']=function(_0x5ab5e8,_0x67b30f){var _0x29c9ca={},_0x5aa496={},_0x1557ad={'count':0x0,'rows':[]};var _0x11c0d5=_[_0x014a('0x40')](db[_0x014a('0x47')][_0x014a('0x48')],function(_0xbaf8c6){return{'name':_0xbaf8c6['fieldName'],'type':_0xbaf8c6[_0x014a('0x49')][_0x014a('0x4a')]};});_0x5aa496[_0x014a('0x4b')]=_['map'](_0x11c0d5,'name');_0x5aa496[_0x014a('0x4c')]=_['keys'](_0x5ab5e8['query']);_0x5aa496[_0x014a('0x4d')]=_['intersection'](_0x5aa496[_0x014a('0x4b')],_0x5aa496[_0x014a('0x4c')]);_0x29c9ca[_0x014a('0x4e')]=_['intersection'](_0x5aa496[_0x014a('0x4b')],qs[_0x014a('0x4f')](_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x4f')]));_0x29c9ca[_0x014a('0x4e')]=_0x29c9ca[_0x014a('0x4e')]['length']?_0x29c9ca[_0x014a('0x4e')]:_0x5aa496[_0x014a('0x4b')];if(!_0x5ab5e8['query'][_0x014a('0x50')](_0x014a('0x51'))){_0x29c9ca[_0x014a('0x2d')]=qs[_0x014a('0x2d')](_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x2d')]);_0x29c9ca[_0x014a('0x2b')]=qs[_0x014a('0x2b')](_0x5ab5e8['query'][_0x014a('0x2b')]);}_0x29c9ca[_0x014a('0x52')]=qs[_0x014a('0x53')](_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x53')]);_0x29c9ca['where']=qs[_0x014a('0x4d')](_['pick'](_0x5ab5e8[_0x014a('0x4c')],_0x5aa496[_0x014a('0x4d')]),_0x11c0d5);var _0x40e02b=[];var _0x479dc0=squel[_0x014a('0x54')]()['field']('id')['field']('name')['field'](_0x014a('0x55'))['from'](_0x014a('0x56'));var _0x5b5318=squel['select']()[_0x014a('0x57')]('u.id')[_0x014a('0x57')](_0x014a('0x58'))[_0x014a('0x57')](_0x014a('0x59'))[_0x014a('0x5a')](_0x014a('0x5b'),'ui')[_0x014a('0x5c')](_0x014a('0x5d'),'u',_0x014a('0x5e'));var _0x3fc9ab=squel['select']()['from'](_0x014a('0x5f'),'i')[_0x014a('0x5c')](_0x014a('0x60'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x014a('0x5d'),'o','o.id\x20=\x20i.UserId')[_0x014a('0x5c')](_0x014a('0x61'),'a',_0x014a('0x62'))[_0x014a('0x5c')]('chat_messages','me',_0x014a('0x63'))[_0x014a('0x5c')](_0x014a('0x64'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x014a('0x5c')]('tools_tags','t',_0x014a('0x65'));var _0x47074f=squel[_0x014a('0x66')]();var _0x24d433=[];var _0xd0334a=squel[_0x014a('0x66')]();var _0x4e9260;if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x67')]){_0x4e9260=as[_0x014a('0x68')](_0x5ab5e8['query'][_0x014a('0x67')]);var _0x17f9d7=_0x4e9260[_0x014a('0x69')];for(var _0xa4fd8d=0x0;_0xa4fd8d<_0x4e9260[_0x014a('0x6a')]['length'];_0xa4fd8d++){var _0x8ac9cd=_0x4e9260[_0x014a('0x6a')][_0xa4fd8d];var _0x63c341='i';var _0x37a7b8=_[_0x014a('0x6b')](_0x11c0d5,[_0x014a('0x38'),_0x8ac9cd[_0x014a('0x57')]]);if(!_0x37a7b8){switch(_0x8ac9cd[_0x014a('0x57')]){case _0x014a('0x6c'):if(_0x8ac9cd[_0x014a('0x6d')]==0x1){_0x3fc9ab[_0x014a('0x6e')]('`'+_0x8ac9cd[_0x014a('0x57')]+'`\x20=\x200');}else{_0x3fc9ab[_0x014a('0x6e')]('`'+_0x8ac9cd['field']+'`\x20>\x200');}break;case'Contact':if(_0x8ac9cd['operator']==='$substring'){if(_0x8ac9cd[_0x014a('0x6d')][_0x014a('0x44')]('\x20')[_0x014a('0x6f')]>0x1){_0x47074f[_0x17f9d7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x014a('0x70')](_0x8ac9cd[_0x014a('0x6d')]),null);}else{var _0x3071c8='%'+_0x8ac9cd[_0x014a('0x6d')]+'%';_0x47074f[_0x17f9d7]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3071c8,_0x3071c8,_0x3071c8);}}else{_0x37a7b8=_['find'](_0x11c0d5,[_0x014a('0x38'),_0x014a('0x71')]);_0x8ac9cd[_0x014a('0x57')]=_0x014a('0x71');_0x58e087=as[_0x014a('0x72')](_0x63c341,_0x37a7b8[_0x014a('0x49')],_0x8ac9cd);_0x47074f[_0x17f9d7](_0x58e087[_0x014a('0x73')],_0x58e087[_0x014a('0x6d')][_0x014a('0x74')],_0x58e087[_0x014a('0x6d')][_0x014a('0x2a')]);}break;case'Tag':var _0x2d87e3=_0x8ac9cd[_0x014a('0x6d')]['split'](',')[_0x014a('0x40')](function(_0x3e39c9){return Number(_0x3e39c9);});_0x2d87e3['forEach'](function(_0x14f2e2){_0xd0334a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x14f2e2+',%');});_0x24d433=_[_0x014a('0x75')](_0x24d433,_0x2d87e3);break;case _0x014a('0x76'):if(_0x8ac9cd[_0x014a('0x77')]===_0x014a('0x78')){_0x47074f[_0x17f9d7](_0x014a('0x79'),'%'+_0x8ac9cd['value']+'%',null);}else{_0x37a7b8=_[_0x014a('0x6b')](_0x11c0d5,[_0x014a('0x38'),_0x014a('0x7a')]);_0x8ac9cd[_0x014a('0x57')]=_0x014a('0x7a');_0x58e087=as['buildExpression'](_0x63c341,_0x37a7b8[_0x014a('0x49')],_0x8ac9cd);_0x47074f[_0x17f9d7](_0x58e087[_0x014a('0x73')],_0x58e087[_0x014a('0x6d')]['start'],_0x58e087[_0x014a('0x6d')]['end']);}break;case _0x014a('0x7b'):_0x58e087=as[_0x014a('0x72')]('me',null,_0x8ac9cd);_0x47074f[_0x17f9d7](_0x58e087[_0x014a('0x73')],_0x58e087[_0x014a('0x6d')][_0x014a('0x74')],_0x58e087[_0x014a('0x6d')][_0x014a('0x2a')]);break;}}else{var _0x58e087=as['buildExpression'](_0x63c341,_0x37a7b8[_0x014a('0x49')],_0x8ac9cd);_0x47074f[_0x17f9d7](_0x58e087['text'],_0x58e087[_0x014a('0x6d')]['start'],_0x58e087[_0x014a('0x6d')][_0x014a('0x2a')]);}}}else{var _0x55bca3=_(_0x5ab5e8['query'])[_0x014a('0x7c')]()[_0x014a('0x40')](function(_0x5f391d){return _[_0x014a('0x7d')](_0x11c0d5,[_0x014a('0x38'),_0x5f391d])?_0x5f391d:undefined;})['compact']()['value']();if(!_[_0x014a('0x7e')](_0x55bca3)){_0x55bca3[_0x014a('0x45')](function(_0x1ee130){if(_0x1ee130===_0x014a('0x7f')){_0x3fc9ab[_0x014a('0x80')](_0x014a('0x81'),[]['concat'](_0x5ab5e8[_0x014a('0x4c')][_0x1ee130]));}else if(_0x1ee130==='createdAt'){var _0x5a8351=JSON[_0x014a('0x82')](_0x5ab5e8[_0x014a('0x4c')][_0x1ee130])['$gte'];var _0x27e363=JSON[_0x014a('0x82')](_0x5ab5e8[_0x014a('0x4c')][_0x1ee130])[_0x014a('0x83')];_0x3fc9ab[_0x014a('0x80')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5a8351,_0x27e363);}else{if(_0x5ab5e8[_0x014a('0x4c')][_0x1ee130]===_0x014a('0x84')){_0x3fc9ab[_0x014a('0x80')]('i.'+_0x1ee130+_0x014a('0x85'));}else{_0x3fc9ab['where']('i.'+_0x1ee130+_0x014a('0x86'),_0x5ab5e8['query'][_0x1ee130]);}}});}if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x87')]){if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x87')]==0x1){_0x3fc9ab[_0x014a('0x6e')](_0x014a('0x88'));}else{_0x3fc9ab['having'](_0x014a('0x89'));}}if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8a')]){_0x24d433=_[_0x014a('0x8b')](_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8a')])?_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8a')]:new Array(_0x5ab5e8['query'][_0x014a('0x8a')]);_0x24d433[_0x014a('0x45')](function(_0x3c2a39){_0xd0334a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c2a39+',%');});}if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8c')]){var _0x1cdfa5=_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8c')][_0x014a('0x8d')]('\x5c','\x5c\x5c')[_0x014a('0x8d')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1cdfa5)){_0x47074f['or']('i.id\x20LIKE\x20?',_0x1cdfa5+'%');}else{_0x47074f['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1cdfa5))['or'](_0x014a('0x8e'),_0x1cdfa5+'%');}}}_0x3fc9ab[_0x014a('0x80')](_0x47074f);_0x3fc9ab[_0x014a('0x8f')](_0x014a('0x90'));var _0xe1b5ed={'type':db[_0x014a('0x91')][_0x014a('0x92')]['SELECT'],'raw':!![]};var _0x24ffb0=_0x3fc9ab[_0x014a('0x93')]();_0x24ffb0[_0x014a('0x57')](_0x014a('0x90'));_0x24ffb0['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x014a('0x6c'));if(_0x29c9ca[_0x014a('0x52')]){_0x29c9ca['order']['forEach'](function(_0x9aa04b){var _0x5bcaf9=_0x9aa04b[0x0]==='contactName'?_0x9aa04b[0x0]:'i.'+_0x9aa04b[0x0];_0x3fc9ab[_0x014a('0x52')](_0x5bcaf9,_0x9aa04b[0x1]===_0x014a('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x24d433)){_0x3fc9ab[_0x014a('0x6e')](_0xd0334a);_0x24ffb0[_0x014a('0x80')](_0x014a('0x95'),_0x24d433);}BPromise[_0x014a('0x96')]()[_0x014a('0x1e')](function(){if(!_0x4e9260){if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x7f')])return;_0x24ffb0[_0x014a('0x80')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x3fc9ab['where'](_0x014a('0x97'));return;}if(_0x5ab5e8['user']['role']!=='agent')return;return _0x5ab5e8[_0x014a('0x98')][_0x014a('0x99')]({'attributes':['id'],'raw':!![]})[_0x014a('0x1e')](function(_0x55408f){if(_[_0x014a('0x7e')](_0x55408f)){_0x24ffb0[_0x014a('0x80')](_0x014a('0x9a'));_0x3fc9ab[_0x014a('0x80')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x24ffb0[_0x014a('0x80')](_0x014a('0x81'),_[_0x014a('0x40')](_0x55408f,'id'));_0x3fc9ab['where'](_0x014a('0x81'),_[_0x014a('0x40')](_0x55408f,'id'));}});})['then'](function(){if(_0x5ab5e8[_0x014a('0x98')][_0x014a('0x9b')]===_0x014a('0x3c')&&!_0x4e9260&&!_0x5ab5e8['query'][_0x014a('0x7f')])return[];return db[_0x014a('0x9c')]['query'](_0x24ffb0[_0x014a('0x9d')](),_0xe1b5ed);})[_0x014a('0x1e')](function(_0x317df3){_0x1557ad[_0x014a('0x2e')]=_0x317df3[_0x014a('0x6f')];if(_0x1557ad[_0x014a('0x2e')]===0x0)return[];return db[_0x014a('0x9c')][_0x014a('0x4c')](_0x479dc0['toString'](),_0xe1b5ed)[_0x014a('0x1e')](function(_0x1806d0){_0x40e02b=_['keyBy'](_0x1806d0,'id');_0xe1b5ed=_['merge'](_0xe1b5ed,{'model':db[_0x014a('0x47')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5ab5e8[_0x014a('0x4c')]['fields']){_0x29c9ca[_0x014a('0x4e')][_0x014a('0x45')](function(_0x216b27){_0x3fc9ab['field']('i.'+_0x216b27);});}else{_0x3fc9ab[_0x014a('0x57')](_0x014a('0x9e'),'unreadMessages');_0x3fc9ab['field'](_0x014a('0x9f'),'Account.key');_0x3fc9ab[_0x014a('0x57')]('a.mandatoryDisposition',_0x014a('0xa0'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xa1'),_0x014a('0xa2'));_0x3fc9ab[_0x014a('0x57')]('i.*');_0x3fc9ab[_0x014a('0x57')](_0x014a('0xa3'),_0x014a('0xa4'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xa5'),_0x014a('0xa6'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xa7'),'Contact.email');_0x3fc9ab[_0x014a('0x57')]('c.phone',_0x014a('0xa8'));_0x3fc9ab['field']('c.mobile','Contact.mobile');_0x3fc9ab['field'](_0x014a('0xa9'),_0x014a('0xaa'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xab'),_0x014a('0xac'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xad'),_0x014a('0xae'));_0x3fc9ab['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x014a('0x43'));}if(_0x29c9ca[_0x014a('0x2d')])_0x3fc9ab[_0x014a('0x2d')](_0x29c9ca[_0x014a('0x2d')]);if(_0x29c9ca[_0x014a('0x2b')])_0x3fc9ab[_0x014a('0x2b')](_0x29c9ca[_0x014a('0x2b')]);return db[_0x014a('0x9c')]['query'](_0x3fc9ab[_0x014a('0x9d')](),_0xe1b5ed);})[_0x014a('0x1e')](function(_0x3a2752){if(_0x3a2752[_0x014a('0x6f')]>0x0)_0x5b5318[_0x014a('0x80')]('ui.ChatInteractionId\x20IN\x20?',_[_0x014a('0x40')](_0x3a2752,'id'));return db[_0x014a('0x9c')][_0x014a('0x4c')](_0x5b5318[_0x014a('0x9d')](),_0xe1b5ed)[_0x014a('0x1e')](function(_0x567357){var _0x3036e4=_['groupBy'](_0x567357,_0x014a('0xaf'));var _0x5a83ab=[];_0x3a2752['forEach'](function(_0x1667c8){_0x5a83ab[_0x014a('0x46')](updateChatInteraction(_0x1667c8,_0x40e02b,_0x3036e4));});return BPromise['all'](_0x5a83ab);});});})[_0x014a('0x1e')](function(_0x3199b9){_0x1557ad[_0x014a('0xb0')]=_0x3199b9;return _0x1557ad;})['then'](respondWithFilteredResult(_0x67b30f,_0x29c9ca))[_0x014a('0x28')](handleError(_0x67b30f,null));};exports[_0x014a('0xb1')]=function(_0x2feb8a,_0x336bcf){var _0x2f7969={'raw':![],'where':{'id':_0x2feb8a[_0x014a('0xb2')]['id']}},_0x263212={};_0x263212[_0x014a('0x4b')]=_[_0x014a('0x7c')](db['ChatInteraction']['rawAttributes']);_0x263212[_0x014a('0x4c')]=_[_0x014a('0x7c')](_0x2feb8a[_0x014a('0x4c')]);_0x263212['filters']=_[_0x014a('0xb3')](_0x263212[_0x014a('0x4b')],_0x263212[_0x014a('0x4c')]);_0x2f7969[_0x014a('0x4e')]=_[_0x014a('0xb3')](_0x263212[_0x014a('0x4b')],qs['fields'](_0x2feb8a[_0x014a('0x4c')][_0x014a('0x4f')]));_0x2f7969[_0x014a('0x4e')]=_0x2f7969[_0x014a('0x4e')]['length']?_0x2f7969[_0x014a('0x4e')]:_0x263212[_0x014a('0x4b')];if(_0x2feb8a[_0x014a('0x4c')][_0x014a('0xb4')]){_0x2f7969[_0x014a('0xb5')]=[{'all':!![]}];}_0x2f7969=_['merge']({},_0x2f7969,_0x2feb8a[_0x014a('0xb6')]);return db['ChatInteraction']['find'](_0x2f7969)[_0x014a('0x1e')](handleEntityNotFound(_0x336bcf,null))[_0x014a('0x1e')](respondWithResult(_0x336bcf,null))[_0x014a('0x28')](handleError(_0x336bcf,null));};exports[_0x014a('0xb7')]=function(_0x3646b8,_0x243fd9){return db[_0x014a('0x47')][_0x014a('0xb7')](_0x3646b8[_0x014a('0x7b')],{})[_0x014a('0x1e')](respondWithResult(_0x243fd9,0xc9))[_0x014a('0x28')](handleError(_0x243fd9,null));};exports[_0x014a('0x34')]=function(_0x383bd8,_0x175c12){if(_0x383bd8[_0x014a('0x7b')]['id']){delete _0x383bd8[_0x014a('0x7b')]['id'];}return db['ChatInteraction'][_0x014a('0x6b')]({'where':{'id':_0x383bd8[_0x014a('0xb2')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x175c12,null))['then'](saveUpdates(_0x383bd8[_0x014a('0x7b')],null))[_0x014a('0x1e')](respondWithResult(_0x175c12,null))[_0x014a('0x28')](handleError(_0x175c12,null));};exports[_0x014a('0x35')]=function(_0x116631,_0xbfd7f8){return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x116631[_0x014a('0xb2')]['id']}})['then'](handleEntityNotFound(_0xbfd7f8,null))[_0x014a('0x1e')](removeEntity(_0xbfd7f8,null))[_0x014a('0x28')](handleError(_0xbfd7f8,null));};exports[_0x014a('0xb8')]=function(_0x11aab3,_0x4f91f1){return db[_0x014a('0x47')]['describe']()['then'](respondWithResult(_0x4f91f1,null))[_0x014a('0x28')](handleError(_0x4f91f1,null));};exports['createVidaooSession']=function(_0x2de457,_0x2ca658){var _0x4ee77b=_0x2de457[_0x014a('0xb2')]['id'];var _0x4e75e4;var _0x172210;var _0x8cc35d;return db['ChatInteraction'][_0x014a('0xb9')]({'where':{'id':_0x4ee77b}})[_0x014a('0x1e')](function(_0x50a129){_0x4e75e4=_0x50a129;return db[_0x014a('0xba')][_0x014a('0xb9')]({'where':{'id':_0x50a129[_0x014a('0x7f')]},'attributes':['id',_0x014a('0xbb'),_0x014a('0xbc'),_0x014a('0xbd'),_0x014a('0xbe'),_0x014a('0xbf')],'raw':!![]});})[_0x014a('0x1e')](function(_0x38df6c){if(_0x38df6c&&_0x38df6c[_0x014a('0xbb')]&&_0x38df6c[_0x014a('0xbc')]){_0x172210=_0x38df6c;var _0x4e0c1a={'interaction':{'id':_0x4ee77b},'agent':{'id':_0x2de457[_0x014a('0x98')]['id'],'name':_0x2de457[_0x014a('0x98')][_0x014a('0x38')],'fullname':_0x2de457[_0x014a('0x98')][_0x014a('0x41')],'email':_0x2de457[_0x014a('0x98')][_0x014a('0xc0')]},'contact':_0x2de457[_0x014a('0x7b')]['contact'],'account':_0x2de457[_0x014a('0x7b')][_0x014a('0x3e')]};var _0x2b3dc0={'rejectUnauthorized':![],'method':_0x014a('0xc1'),'url':_0x014a('0xc2'),'headers':{'X-APIKEY':_0x38df6c[_0x014a('0xbb')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2de457['user'][_0x014a('0xc0')]],'buttons':null,'topic':_0x172210[_0x014a('0xbd')],'note':_[_0x014a('0xc3')](_0x172210['vidaooNote'])?null:getMustacheRender(_0x172210['vidaooNote'],_0x4e0c1a),'metadata':null},'redirect':_0x014a('0xc4'),'json':!![]};try{if(!_[_0x014a('0xc3')](_0x172210[_0x014a('0xbf')])){var _0x31e65e=getMustacheRender(_0x172210[_0x014a('0xbf')],_0x4e0c1a);var _0x537353=JSON[_0x014a('0x82')](_0x31e65e);_0x2b3dc0[_0x014a('0x7b')][_0x014a('0xc5')]=_0x537353;}}catch(_0x5dd7a5){throw new db[(_0x014a('0x91'))][(_0x014a('0xc6'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x2b3dc0);}else{throw new db[(_0x014a('0x91'))]['ValidationError'](_0x014a('0xc7'));}})['then'](function(_0x57d852){_0x8cc35d=_0x57d852;if(_0x8cc35d['id']){var _0x581c3a={'body':_0x8cc35d[_0x014a('0xc8')],'ChatWebsiteId':_0x172210['id'],'ChatInteractionId':_0x4e75e4['id'],'direction':'out','UserId':_0x2de457[_0x014a('0x98')]['id']};return db['ChatMessage'][_0x014a('0xb7')](_0x581c3a,{});}else{throw new db[(_0x014a('0x91'))][(_0x014a('0xc6'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x014a('0x1e')](function(){return _0x4e75e4['updateAttributes']({'vidaooSessionId':_0x8cc35d['id']});})[_0x014a('0x1e')](respondWithResult(_0x2ca658,null))[_0x014a('0x28')](handleError(_0x2ca658,null));};exports[_0x014a('0xc9')]=function(_0x533371,_0x57b53b){if(_0x533371[_0x014a('0x7b')]['id']){delete _0x533371[_0x014a('0x7b')]['id'];}return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x533371[_0x014a('0xb2')]['id']},'include':[{'model':db[_0x014a('0xca')],'as':_0x014a('0xcb')}]})[_0x014a('0x1e')](handleEntityNotFound(_0x57b53b,null))[_0x014a('0x1e')](saveUpdates(_0x533371[_0x014a('0x7b')],null))[_0x014a('0x1e')](respondWithResult(_0x57b53b,null))[_0x014a('0x28')](handleError(_0x57b53b,null));};exports[_0x014a('0xcc')]=function(_0x4adbd2,_0x55a4bb,_0x38807c){if(_0x4adbd2[_0x014a('0x7b')]['id']){delete _0x4adbd2['body']['id'];}return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x4adbd2['params']['id']}})['then'](function(_0xf01aa6){if(!_0xf01aa6){logger[_0x014a('0x24')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x014a('0xcc'),0x194,'entity\x20not\x20found');_0x55a4bb[_0x014a('0x36')](0x194);}else{if(_0xf01aa6[_0x014a('0x7a')]){throw new db[(_0x014a('0x91'))][(_0x014a('0xc6'))]('Interaction\x20already\x20assigned');}}return _0xf01aa6;})['then'](function(_0x5db9d1){if(_0x5db9d1){return _0x5db9d1['update']({'closed':_0x4adbd2[_0x014a('0x7b')][_0x014a('0xcd')],'disposition':_0x4adbd2[_0x014a('0x7b')][_0x014a('0xce')]})[_0x014a('0x1e')](function(_0x3e19c0){return _0x3e19c0;});}})[_0x014a('0x1e')](function(_0x3546e7){return respondWithRpcPromise(_0x014a('0xcf'),_0x014a('0xcc'),_0x4adbd2[_0x014a('0x7b')],client9004);})['then'](respondWithResult(_0x55a4bb,null))['catch'](handleError(_0x55a4bb,null));};exports['attachmentUpload']=function(_0x190839,_0x28f011,_0x4da4a1){_0x190839[_0x014a('0x7b')][_0x014a('0x38')]=_0x190839[_0x014a('0xd0')][_0x014a('0xd1')];_0x190839['body'][_0x014a('0xd2')]=_0x190839[_0x014a('0xd0')]['filename'];_0x190839[_0x014a('0x7b')][_0x014a('0x49')]=_0x190839['file'][_0x014a('0xd3')];return db[_0x014a('0xd4')][_0x014a('0xb7')](_0x190839[_0x014a('0x7b')])[_0x014a('0x1e')](respondWithResult(_0x28f011,0xc9))[_0x014a('0x28')](handleError(_0x28f011,null));};exports[_0x014a('0xd5')]=function(_0xd50ab0,_0x4cee0b,_0x129deb){return db[_0x014a('0x47')][_0x014a('0xb9')]({'where':{'id':_0xd50ab0[_0x014a('0xb2')]['id']},'raw':!![]})[_0x014a('0x1e')](handleEntityNotFound(_0x4cee0b,null))[_0x014a('0x1e')](function(_0x2573bd){if(_0x2573bd){if(_0x2573bd[_0x014a('0xcd')]){return _0x4cee0b[_0x014a('0x29')](0x193)['json']({'status':0x193,'message':_0x014a('0xd6')});}return db['Attachment'][_0x014a('0xb9')]({'where':{'id':_0xd50ab0[_0x014a('0x4c')][_0x014a('0xd7')]},'raw':!![]})['then'](handleEntityNotFound(_0x4cee0b,null));}})['then'](function(_0x293ee3){if(_0x293ee3){var _0x4ce807=_0x293ee3['ChatOfflineMessageId']!==null;var _0x5c002b=path[_0x014a('0xd8')](config[_0x014a('0xd9')],_0x014a('0xda'));if(_0x4ce807){_0x5c002b=path['join'](_0x5c002b,_0x014a('0xdb'));}var _0x19a2ed=path['join'](_0x5c002b,_0x293ee3[_0x014a('0xd2')]);return _0x4cee0b[_0x014a('0xdc')](_0x19a2ed);}})[_0x014a('0x28')](handleError(_0x4cee0b,null));};exports['close']=function(_0x5b82f2,_0x2b622f){var _0x24e9d7=null;var _0x344adb=null;var _0x1441ed=null;var _0x34b528=null;if(_0x5b82f2[_0x014a('0x7b')]['id']){delete _0x5b82f2['body']['id'];}if(_0x5b82f2['body']['mailTranscript']){_0x34b528=path[_0x014a('0xd8')](config[_0x014a('0xd9')],_0x014a('0xdd'),util['format'](_0x014a('0xde'),Date[_0x014a('0xdf')]()));_0x5b82f2[_0x014a('0x7b')]['pathTranscript']=_0x34b528;}return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x5b82f2[_0x014a('0xb2')]['id']},'include':[{'model':db[_0x014a('0xe0')],'as':'Messages','include':[{'model':db[_0x014a('0x76')],'as':'User'}]}]})[_0x014a('0x1e')](handleEntityNotFound(_0x2b622f,null))[_0x014a('0x1e')](saveUpdates(_0x5b82f2[_0x014a('0x7b')],null))['then'](function(_0xdd63f){if(_0xdd63f){_0x24e9d7=_0xdd63f;return db[_0x014a('0xba')][_0x014a('0x6b')]({'where':{'id':_0x24e9d7[_0x014a('0x7f')]}});}})[_0x014a('0x1e')](function(_0x49a1eb){if(_0x49a1eb){_0x1441ed=_0x49a1eb;return db[_0x014a('0xca')][_0x014a('0x6b')]({'where':{'id':_0x24e9d7[_0x014a('0x71')]}});}})[_0x014a('0x1e')](function(_0x2432ac){if(_0x2432ac){_0x344adb=_0x2432ac;if(_0x34b528){var _0xb91589=null;for(var _0x53260c=0x1;_0x53260c<_0x24e9d7[_0x014a('0xe1')][_0x014a('0x6f')];++_0x53260c){_0xb91589=_0x24e9d7['Messages'][_0x53260c];var _0x1b5b25=_0xb91589['UserId']?util[_0x014a('0xe2')]('%s%d',_0x1441ed[_0x014a('0xe3')],_0xb91589[_0x014a('0x7a')]):_0x014a('0xe4');var _0x10b3c5=_0x5b82f2[_0x014a('0x7b')][_0x014a('0xe5')]||util[_0x014a('0xe2')]('%s%d','Visitor',_0xb91589[_0x014a('0x71')]);switch(_0x1441ed[_0x014a('0xe6')]){case'website_alias':_0x1b5b25=_0xb91589[_0x014a('0x7a')]?util[_0x014a('0xe2')](_0x014a('0xe7'),_0x1441ed[_0x014a('0xe3')],_0xb91589[_0x014a('0x7a')]):'System';break;case _0x014a('0xe8'):_0x1b5b25=_0xb91589[_0x014a('0x7a')]?_0xb91589[_0x014a('0x76')][_0x014a('0xe9')]||_0xb91589['User'][_0x014a('0x41')]:'System';break;case _0x014a('0xea'):_0x1b5b25=_0xb91589[_0x014a('0x7a')]?_0xb91589[_0x014a('0x76')][_0x014a('0x41')]:_0x014a('0xe4');break;default:_0x1b5b25=_0xb91589[_0x014a('0x7a')]?util[_0x014a('0xe2')]('%s%d',_0x1441ed[_0x014a('0xe3')],_0xb91589[_0x014a('0x7a')]):_0x014a('0xe4');}var _0x343b5e=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0xb91589[_0x014a('0xeb')])[_0x014a('0xe2')]('MM/DD/YYYY\x20HH:mm:ss'),_0xb91589[_0x014a('0xec')]==='in'?_0x10b3c5:_0x1b5b25,_0xb91589[_0x014a('0x7b')]);if(!_0xb91589[_0x014a('0xed')]){fs[_0x014a('0xee')](_0x34b528,_0x343b5e);}}return db[_0x014a('0xef')][_0x014a('0xb9')]({'where':{'service':!![]},'include':[{'model':db[_0x014a('0xf0')],'as':_0x014a('0xf1'),'raw':!![]}]});}}})[_0x014a('0x1e')](function(_0x4ad0c6){if(_0x4ad0c6&&_0x4ad0c6[_0x014a('0xf1')]&&_0x5b82f2['body']){var _0x5f8d5b={'tls':{'rejectUnauthorized':![]}};if(_0x4ad0c6[_0x014a('0xf1')]['service']){_0x5f8d5b[_0x014a('0xf2')]=_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf2')];}else{_0x5f8d5b[_0x014a('0xf3')]=_0x4ad0c6[_0x014a('0xf1')]['host'];_0x5f8d5b[_0x014a('0xf4')]=_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf4')];_0x5f8d5b[_0x014a('0xf5')]=_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf5')];}if(_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf6')]){_0x5f8d5b['auth']={'user':_0x4ad0c6[_0x014a('0xf1')]['user'],'pass':_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf7')]};}return respondWithRpcPromise(_0x014a('0xf8'),_0x014a('0xf9'),{'account':_0x5f8d5b,'message':{'from':util[_0x014a('0xe2')](_0x014a('0xfa'),_0x4ad0c6['name'],_0x4ad0c6[_0x014a('0xc0')]||_0x4ad0c6['Smtp'][_0x014a('0x98')]),'to':_0x5b82f2[_0x014a('0x7b')][_0x014a('0xfb')],'subject':_0x014a('0xfc'),'text':util[_0x014a('0xe2')](_0x014a('0xfd'),_0x5b82f2[_0x014a('0x7b')][_0x014a('0xfb')]),'attachments':[{'path':_0x34b528}]}})['then'](function(){return _0x24e9d7;})['catch'](function(_0xac886c){console[_0x014a('0x24')](_0xac886c);});}else{return _0x24e9d7;}})[_0x014a('0x1e')](respondWithStatusCode(_0x2b622f,0xc8))[_0x014a('0x28')](handleError(_0x2b622f,null));};exports[_0x014a('0xfe')]=function(_0x30aa7b,_0x451579,_0x3858a1){return db[_0x014a('0xe0')][_0x014a('0x6b')]({'where':{'id':_0x30aa7b[_0x014a('0xb2')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x451579,null))[_0x014a('0x1e')](function(_0x57bd30){if(_0x57bd30){return _0x57bd30[_0x014a('0xfe')](_0x30aa7b[_0x014a('0x7b')][_0x014a('0xff')],_['omit'](_0x30aa7b[_0x014a('0x7b')],[_0x014a('0xff'),'id'])||{});}})[_0x014a('0x1e')](respondWithResult(_0x451579,null))[_0x014a('0x28')](handleError(_0x451579,null));};exports[_0x014a('0x100')]=function(_0x36c94d,_0x44cb05,_0x30a903){var _0x3bb1f={'raw':![],'where':{}};var _0x4775a4={};var _0x13ec10={'count':0x0,'rows':[]};return db[_0x014a('0x47')]['findOne']({'where':{'id':_0x36c94d['params']['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x44cb05,null))[_0x014a('0x1e')](function(_0x4a361b){if(_0x4a361b){_0x4775a4[_0x014a('0x4b')]=_[_0x014a('0x7c')](db[_0x014a('0xe0')][_0x014a('0x48')]);_0x4775a4[_0x014a('0x4c')]=_[_0x014a('0x7c')](_0x36c94d[_0x014a('0x4c')]);_0x4775a4[_0x014a('0x4d')]=_['intersection'](_0x4775a4[_0x014a('0x4b')],_0x4775a4[_0x014a('0x4c')]);_0x3bb1f[_0x014a('0x4e')]=_[_0x014a('0xb3')](_0x4775a4['model'],qs[_0x014a('0x4f')](_0x36c94d[_0x014a('0x4c')][_0x014a('0x4f')]));_0x3bb1f['attributes']=_0x3bb1f[_0x014a('0x4e')][_0x014a('0x6f')]?_0x3bb1f['attributes']:_0x4775a4[_0x014a('0x4b')];if(!_0x36c94d[_0x014a('0x4c')][_0x014a('0x50')]('nolimit')){_0x3bb1f[_0x014a('0x2d')]=qs[_0x014a('0x2d')](_0x36c94d[_0x014a('0x4c')]['limit']);_0x3bb1f[_0x014a('0x2b')]=qs['offset'](_0x36c94d[_0x014a('0x4c')]['offset']);}_0x3bb1f[_0x014a('0x52')]=qs[_0x014a('0x53')](_0x36c94d['query'][_0x014a('0x53')]);_0x3bb1f['where']=qs[_0x014a('0x4d')](_[_0x014a('0x101')](_0x36c94d[_0x014a('0x4c')],_0x4775a4[_0x014a('0x4d')]));_0x3bb1f[_0x014a('0x80')]['ChatInteractionId']=_0x4a361b['id'];if(_0x36c94d[_0x014a('0x4c')][_0x014a('0x8c')]){_0x3bb1f[_0x014a('0x80')]=_['merge'](_0x3bb1f[_0x014a('0x80')],{'$or':_[_0x014a('0x40')](_0x3bb1f['attributes'],function(_0x565da5){var _0x309858={};_0x309858[_0x565da5]={'$like':'%'+_0x36c94d[_0x014a('0x4c')]['filter']+'%'};return _0x309858;})});}if(_0x36c94d[_0x014a('0x4c')]['$gte']){var _0x56bfaf=_0x36c94d[_0x014a('0x4c')][_0x014a('0x102')]['split'](',');var _0x5f14e4={};_0x5f14e4[_0x56bfaf[0x0]]={'$gte':moment(_0x56bfaf[0x1])['format'](_0x014a('0x103'))};_0x3bb1f[_0x014a('0x80')]=_[_0x014a('0x3a')](_0x3bb1f['where'],_0x5f14e4);}_0x3bb1f=_['merge']({},_0x3bb1f,_0x36c94d[_0x014a('0xb6')]);return db['ChatMessage'][_0x014a('0x2e')]({'where':_0x3bb1f[_0x014a('0x80')]})['then'](function(_0x4acfe9){_0x13ec10[_0x014a('0x2e')]=_0x4acfe9;if(_0x36c94d[_0x014a('0x4c')]['includeAll']){_0x3bb1f[_0x014a('0xb5')]=[{'all':!![]}];}return db['ChatMessage'][_0x014a('0x104')](_0x3bb1f);})['then'](function(_0x8c21a7){_0x13ec10[_0x014a('0xb0')]=_0x8c21a7;return _0x13ec10;});}})[_0x014a('0x1e')](respondWithFilteredResult(_0x44cb05,_0x3bb1f))[_0x014a('0x28')](handleError(_0x44cb05,null));};exports[_0x014a('0x105')]=function(_0x260f79,_0x68de07,_0x4126a3){var _0x4f1f23={'where':{}},_0x1ef9b0={},_0x11d0e9={'count':0x0,'rows':[]};return db[_0x014a('0x47')][_0x014a('0xb9')]({'where':{'id':_0x260f79[_0x014a('0xb2')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x68de07,null))[_0x014a('0x1e')](function(_0x4f7960){if(_0x4f7960){_0x1ef9b0['model']=_[_0x014a('0x7c')](db[_0x014a('0xe0')][_0x014a('0x48')]);_0x1ef9b0[_0x014a('0x4c')]=_[_0x014a('0x7c')](_0x260f79[_0x014a('0x4c')]);_0x1ef9b0[_0x014a('0x4d')]=_[_0x014a('0xb3')](_0x1ef9b0[_0x014a('0x4b')],_0x1ef9b0[_0x014a('0x4c')]);_0x4f1f23[_0x014a('0x4e')]=_['intersection'](_0x1ef9b0[_0x014a('0x4b')],qs[_0x014a('0x4f')](_0x260f79[_0x014a('0x4c')][_0x014a('0x4f')]));_0x4f1f23[_0x014a('0x4e')]=_0x4f1f23[_0x014a('0x4e')][_0x014a('0x6f')]?_0x4f1f23['attributes']:_0x1ef9b0['model'];if(!_0x260f79[_0x014a('0x4c')][_0x014a('0x50')](_0x014a('0x51'))){_0x4f1f23[_0x014a('0x2d')]=qs[_0x014a('0x2d')](_0x260f79['query'][_0x014a('0x2d')]);_0x4f1f23[_0x014a('0x2b')]=qs['offset'](_0x260f79[_0x014a('0x4c')][_0x014a('0x2b')]);}_0x4f1f23[_0x014a('0x52')]=qs['sort'](_0x260f79[_0x014a('0x4c')][_0x014a('0x53')]);_0x4f1f23[_0x014a('0x80')]=qs['filters'](_[_0x014a('0x101')](_0x260f79[_0x014a('0x4c')],_0x1ef9b0['filters']));_0x4f1f23[_0x014a('0x80')][_0x014a('0xaf')]=_0x4f7960['id'];if(_0x260f79[_0x014a('0x4c')]['filter']){_0x4f1f23[_0x014a('0x80')]=_['merge'](_0x4f1f23['where'],{'$or':_['map'](_0x4f1f23['attributes'],function(_0xf3e4fb){var _0x126084={};_0x126084[_0xf3e4fb]={'$like':'%'+_0x260f79[_0x014a('0x4c')][_0x014a('0x8c')]+'%'};return _0x126084;})});}_0x4f1f23[_0x014a('0x80')][_0x014a('0xed')]=![];if(_0x260f79[_0x014a('0x4c')]['id']){_0x4f1f23['where']['id']={'$gt':_0x260f79[_0x014a('0x4c')]['id']};}_0x4f1f23=_['merge']({},_0x4f1f23,_0x260f79[_0x014a('0xb6')]);return db[_0x014a('0xe0')][_0x014a('0x2e')]({'where':_0x4f1f23['where']})[_0x014a('0x1e')](function(_0x58421d){_0x11d0e9['count']=_0x58421d;_0x4f1f23[_0x014a('0xb5')]=[];if(_0x260f79[_0x014a('0x4c')][_0x014a('0x106')]){_0x4f1f23['include']['push']({'model':db[_0x014a('0x76')],'as':_0x014a('0x76'),'attributes':['id',_0x014a('0x41'),_0x014a('0xe9')]});}if(_0x260f79[_0x014a('0x4c')][_0x014a('0xb4')]){_0x4f1f23['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4f1f23);})[_0x014a('0x1e')](function(_0x40a47f){_0x11d0e9[_0x014a('0xb0')]=_0x40a47f;return _0x11d0e9;});}})['then'](respondWithFilteredResult(_0x68de07,_0x4f1f23))[_0x014a('0x28')](handleError(_0x68de07,null));};exports[_0x014a('0x107')]=function(_0x8a099,_0x81208d,_0x320be9){return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x8a099[_0x014a('0xb2')]['id']}})['then'](handleEntityNotFound(_0x81208d,null))[_0x014a('0x1e')](function(_0x46a2c5){if(_0x46a2c5){return _0x46a2c5['setTags'](_0x8a099[_0x014a('0x7b')][_0x014a('0xff')],_[_0x014a('0x108')](_0x8a099['body'],[_0x014a('0xff'),'id'])||{})[_0x014a('0x109')](function(){return db['Tag'][_0x014a('0x104')]({'attributes':['id','name',_0x014a('0x55')],'where':{'id':_0x8a099[_0x014a('0x7b')][_0x014a('0xff')]}});})[_0x014a('0x1e')](function(_0x4f56a9){socket['emit'](_0x014a('0x10a'),{'id':Number(_0x8a099[_0x014a('0xb2')]['id']),'tags':_0x4f56a9||[]});return{'id':Number(_0x8a099[_0x014a('0xb2')]['id']),'tags':_0x4f56a9||[]};});}})[_0x014a('0x1e')](respondWithResult(_0x81208d,null))[_0x014a('0x28')](handleError(_0x81208d,null));};exports[_0x014a('0x10b')]=function(_0x32ba5d,_0x120047,_0x570898){return db['ChatInteraction']['find']({'where':{'id':_0x32ba5d[_0x014a('0xb2')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x120047,null))[_0x014a('0x1e')](function(_0x47cd44){if(_0x47cd44){return _0x47cd44[_0x014a('0x10b')](_0x32ba5d[_0x014a('0x4c')][_0x014a('0xff')]);}})['then'](respondWithStatusCode(_0x120047,null))[_0x014a('0x28')](handleError(_0x120047,null));};exports['download']=function(_0x546af7,_0x4c492f){var _0x331ba9=moment()['unix']()[_0x014a('0x9d')]();var _0x3e7923=path['join'](config[_0x014a('0xd9')],'server',_0x014a('0x10c'),'tmp');var _0x387e49=path[_0x014a('0xd8')](config[_0x014a('0xd9')],_0x014a('0x10d'),_0x014a('0x10c'),_0x014a('0x10e'));var _0x1c5606=path['join'](_0x3e7923,_0x331ba9);var _0x4b4336=util[_0x014a('0xe2')]('transcript-%d-%s.zip',_0x546af7[_0x014a('0xb2')]['id'],_0x331ba9);var _0x1b3f4d=path[_0x014a('0xd8')](_0x3e7923,_0x4b4336);var _0x5f58bd=[];_0x5f58bd[_0x014a('0x46')]({'model':db[_0x014a('0x76')],'as':'User','attributes':['id',_0x014a('0x41')],'raw':!![]});_0x5f58bd[_0x014a('0x46')]({'model':db[_0x014a('0xca')],'as':_0x014a('0xcb'),'attributes':['id',_0x014a('0x10f'),_0x014a('0x110')],'raw':!![]});if(_0x546af7[_0x014a('0x4c')]['attachments']){_0x5f58bd[_0x014a('0x46')]({'model':db[_0x014a('0xd4')],'as':'Attachment','raw':!![]});}var _0x5104b1=[{'model':db[_0x014a('0xe0')],'as':_0x014a('0xe1'),'attributes':['id',_0x014a('0x7b'),_0x014a('0xeb'),'direction',_0x014a('0xed'),_0x014a('0x87')],'include':_0x5f58bd}];_0x5104b1[_0x014a('0x46')]({'model':db[_0x014a('0xba')],'as':_0x014a('0x111'),'attributes':['id',_0x014a('0x38')]});_0x5104b1['push']({'model':db['User'],'as':'Owner','attributes':['id',_0x014a('0x41')]});return db['ChatInteraction'][_0x014a('0x6b')]({'where':{'id':_0x546af7[_0x014a('0xb2')]['id']},'include':_0x5104b1})[_0x014a('0x1e')](handleEntityNotFound(_0x4c492f,null))['then'](function(_0x501d05){if(_0x501d05){var _0x48c669=_0x501d05[_0x014a('0x112')]({'plain':!![]});fs['mkdirSync'](_0x1c5606);var _0x5d4bae={'channel':_0x014a('0x113'),'account':_0x48c669[_0x014a('0x111')][_0x014a('0x38')],'agent':_0x48c669[_0x014a('0x114')]?_0x48c669[_0x014a('0x114')][_0x014a('0x41')]:_0x014a('0x115'),'createdAt':moment(_0x48c669[_0x014a('0xeb')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x48c669['closed']?moment(_0x48c669[_0x014a('0x116')])[_0x014a('0xe2')](_0x014a('0x103'))[_0x014a('0x9d')]():'','disposition':_0x48c669[_0x014a('0xce')],'chatInfo':{'browser':_0x48c669['browserName'],'os':_0x48c669[_0x014a('0x117')],'referer':_0x48c669[_0x014a('0x118')],'customerIp':_0x48c669['customerIp'],'customerPort':_0x48c669[_0x014a('0x119')]?_0x48c669[_0x014a('0x119')]:_0x014a('0x115')},'messages':_(_0x48c669[_0x014a('0xe1')])['tail']()[_0x014a('0x8c')]({'secret':![]})[_0x014a('0x40')](function(_0x5afb91){if(_0x5afb91[_0x014a('0xd4')]){var _0x172440=path[_0x014a('0xd8')](_0x387e49,_0x5afb91[_0x014a('0xd4')][_0x014a('0xd2')]);if(fs[_0x014a('0x11a')](_0x172440)){fs[_0x014a('0x11b')](_0x172440)[_0x014a('0x11c')](fs['createWriteStream'](path[_0x014a('0xd8')](_0x1c5606,_0x5afb91[_0x014a('0xd4')][_0x014a('0xd2')])));}}return{'date':moment(_0x5afb91['createdAt'])['format'](_0x014a('0x103'))[_0x014a('0x9d')](),'sender':_0x5afb91[_0x014a('0xec')]==='out'?_0x5afb91[_0x014a('0x76')]?_0x5afb91[_0x014a('0x76')][_0x014a('0x41')]:_0x014a('0xe4'):_0x5afb91[_0x014a('0xcb')][_0x014a('0x10f')]+(_0x5afb91[_0x014a('0xcb')][_0x014a('0x110')]?'\x20'+_0x5afb91[_0x014a('0xcb')][_0x014a('0x110')]:''),'body':_0x5afb91[_0x014a('0xd4')]?_0x5afb91[_0x014a('0xd4')][_0x014a('0xd2')]:_0x5afb91[_0x014a('0x7b')],'direction':_0x5afb91[_0x014a('0xec')]===_0x014a('0x11d')?'A':'C','secret':_0x5afb91[_0x014a('0xed')],'read':_0x5afb91['read'],'attachment':_0x5afb91[_0x014a('0xd4')]};})[_0x014a('0x6d')]()};return ejs['renderFile'](path['join'](config['root'],_0x014a('0x10d'),_0x014a('0x11e'),'downloadInteraction.ejs'),{'interaction':_0x5d4bae})['then'](function(_0x374e3d){var _0x2d9178=path['join'](_0x1c5606,_0x014a('0x11f')+_0x48c669['id']+'-'+_0x331ba9+'.pdf');var _0x30c604={'path':_0x2d9178,'channel':'Chat','interactionId':_0x48c669['id']};return pdf['createPdfFromHTML'](_0x374e3d,_0x30c604);})[_0x014a('0x1e')](function(){return new BPromise(function(_0x321a17,_0x2f20e7){zipdir(_0x1c5606,{'saveTo':_0x1b3f4d},function(_0x18edd1,_0xcad1af){if(_0x18edd1)return _0x2f20e7(_0x18edd1);return _0x321a17(_0xcad1af);});})['then'](function(){return new BPromise(function(_0x42cd23,_0x82d77b){rimraf(_0x1c5606,function(_0x48bcec){if(_0x48bcec)_0x82d77b(_0x48bcec);return _0x42cd23();});});})[_0x014a('0x1e')](function(){return _0x4c492f[_0x014a('0xdc')](_0x1b3f4d,_0x4b4336,function(_0x1d8179){if(_0x1d8179){console[_0x014a('0x120')](_0x014a('0x121'),_0x1d8179);}else{fs[_0x014a('0x122')](_0x1b3f4d);}});});});}else{return _0x4c492f[_0x014a('0x36')](0xc8);}})['catch'](handleError(_0x4c492f,null));}; \ No newline at end of file +var _0xb10b=['querystring','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','update','stack','name','send','body','contact','interaction','account','Users','map','fullname','TagIds','Tags','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','buildExpression','some','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`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?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','agent','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','catch','show','params','keys','includeAll','include','options','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooNote','email','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','follow','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','AbandonInteraction','attachmentUpload','file','filename','mimetype','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','close','mailTranscript','root','now','Messages','format','%s%d','System','customer','Visitor','agentIdentifier','website_alias','agentAlias','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids','omit','getMessages','split','YYYY-MM-DD\x20HH:mm:ss','includeAgent','alias','findAll','setTags','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','disposition','osName','referer','customerPort','tail','existsSync','pipe','createWriteStream','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x1c1172,_0x27c3c4){var _0x300943=function(_0x3f8b89){while(--_0x3f8b89){_0x1c1172['push'](_0x1c1172['shift']());}};_0x300943(++_0x27c3c4);}(_0xb10b,0x12a));var _0xbb10=function(_0x2dee2f,_0x19572f){_0x2dee2f=_0x2dee2f-0x0;var _0x327c18=_0xb10b[_0x2dee2f];return _0x327c18;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xbb10('0x13'));var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))('api');var utils=require(_0xbb10('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb10('0x17'));var db=require(_0xbb10('0x18'))['db'];config[_0xbb10('0x19')]=_[_0xbb10('0x1a')](config[_0xbb10('0x19')],{'host':_0xbb10('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb10('0x19')]));require(_0xbb10('0x1c'))[_0xbb10('0x1d')](socket);var jayson=require(_0xbb10('0x1e'));var client=jayson[_0xbb10('0x1f')][_0xbb10('0x20')]({'port':0x232b});var client9004=jayson[_0xbb10('0x1f')][_0xbb10('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x3e26f4,_0x2b184e,_0x4a2bfc,_0x2eca0f){return new BPromise(function(_0x1145f1,_0x133ac2){var _0x42db98=_0x2eca0f||client;return _0x42db98[_0xbb10('0x21')](_0x3e26f4,_0x4a2bfc)[_0xbb10('0x22')](function(_0x575cca){logger[_0xbb10('0x23')](_0xbb10('0x24'),_0x2b184e,_0xbb10('0x25'));logger['debug'](_0xbb10('0x26'),_0x2b184e,_0xbb10('0x25'),JSON[_0xbb10('0x27')](_0x575cca));if(_0x575cca[_0xbb10('0x28')]){if(_0x575cca[_0xbb10('0x28')][_0xbb10('0x29')]===0x1f4){logger['error'](_0xbb10('0x24'),_0x2b184e,_0x575cca[_0xbb10('0x28')]['message']);return _0x133ac2(_0x575cca['error'][_0xbb10('0x2a')]);}logger[_0xbb10('0x28')](_0xbb10('0x24'),_0x2b184e,_0x575cca[_0xbb10('0x28')][_0xbb10('0x2a')]);return _0x1145f1(_0x575cca[_0xbb10('0x28')][_0xbb10('0x2a')]);}else{logger[_0xbb10('0x23')](_0xbb10('0x24'),_0x2b184e,_0xbb10('0x25'));_0x1145f1(_0x575cca[_0xbb10('0x2b')][_0xbb10('0x2a')]);}})['catch'](function(_0x4fedac){logger['error'](_0xbb10('0x24'),_0x2b184e,_0x4fedac);_0x133ac2(_0x4fedac);});});}function respondWithStatusCode(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0xcc;return function(_0x4e25ff){if(_0x4e25ff){return _0x3c5ae7[_0xbb10('0x2c')](_0x2c89b9);}return _0x3c5ae7[_0xbb10('0x2d')](_0x2c89b9)[_0xbb10('0x2e')]();};}function respondWithResult(_0x1d5e95,_0x1acce9){_0x1acce9=_0x1acce9||0xc8;return function(_0x20d946){if(_0x20d946){return _0x1d5e95[_0xbb10('0x2d')](_0x1acce9)['json'](_0x20d946);}};}function respondWithFilteredResult(_0x3796c7,_0x21ac54){return function(_0xfc3595){if(_0xfc3595){var _0x2e0249=typeof _0x21ac54[_0xbb10('0x2f')]===_0xbb10('0x30')&&typeof _0x21ac54['limit']===_0xbb10('0x30');var _0x4ee02e=_0xfc3595[_0xbb10('0x31')];var _0x56f2da=_0x2e0249?0x0:_0x21ac54[_0xbb10('0x2f')];var _0x1dcc9c=_0x2e0249?_0xfc3595[_0xbb10('0x31')]:_0x21ac54['offset']+_0x21ac54['limit'];var _0x4c3744;if(_0x1dcc9c>=_0x4ee02e){_0x1dcc9c=_0x4ee02e;_0x4c3744=0xc8;}else{_0x4c3744=0xce;}_0x3796c7[_0xbb10('0x2d')](_0x4c3744);return _0x3796c7['set'](_0xbb10('0x32'),_0x56f2da+'-'+_0x1dcc9c+'/'+_0x4ee02e)[_0xbb10('0x33')](_0xfc3595);}return null;};}function patchUpdates(_0x2f653f){return function(_0x1c0b57){try{jsonpatch[_0xbb10('0x34')](_0x1c0b57,_0x2f653f,!![]);}catch(_0x138bc6){return BPromise[_0xbb10('0x35')](_0x138bc6);}return _0x1c0b57['save']();};}function saveUpdates(_0x25acb3,_0x1da9c9){return function(_0x441d15){if(_0x441d15){return _0x441d15[_0xbb10('0x36')](_0x25acb3)[_0xbb10('0x22')](function(_0x9de708){return _0x9de708;});}return null;};}function removeEntity(_0x188cbd,_0x10202c){return function(_0x3c8d7d){if(_0x3c8d7d){return _0x3c8d7d['destroy']()[_0xbb10('0x22')](function(){_0x188cbd[_0xbb10('0x2d')](0xcc)[_0xbb10('0x2e')]();});}};}function handleEntityNotFound(_0x3c3c45,_0x570f5a){return function(_0x111762){if(!_0x111762){_0x3c3c45['sendStatus'](0x194);}return _0x111762;};}function handleError(_0x4e2754,_0x3eb3cc){_0x3eb3cc=_0x3eb3cc||0x1f4;return function(_0x40c164){logger[_0xbb10('0x28')](_0x40c164[_0xbb10('0x37')]);if(_0x40c164[_0xbb10('0x38')]){delete _0x40c164[_0xbb10('0x38')];}_0x4e2754['status'](_0x3eb3cc)[_0xbb10('0x39')](_0x40c164);};}function getMustacheRender(_0x25d72f,_0x52de31){return Mustache['render'](_0x25d72f,_['merge'](_0x52de31[_0xbb10('0x3a')],{'contact':_0x52de31[_0xbb10('0x3b')],'message':_0x52de31[_0xbb10('0x2a')],'agent':_0x52de31['agent'],'interaction':_0x52de31[_0xbb10('0x3c')],'account':_0x52de31[_0xbb10('0x3d')]}))||'';}function getInteractionUsers(_0x4345f3,_0x4d1a83){return new BPromise(function(_0x17b6c5,_0x12238a){try{if(_0x4d1a83[_0x4345f3['id']]){_0x4345f3[_0xbb10('0x3e')]=_[_0xbb10('0x3f')](_0x4d1a83[_0x4345f3['id']],function(_0x4f1cdd){return{'id':_0x4f1cdd['id'],'fullname':_0x4f1cdd[_0xbb10('0x40')]};});}}catch(_0x110eb5){_0x12238a(_0x110eb5);}_0x17b6c5(_0x4345f3);});}function getInteractionTags(_0x5835fd,_0xe2040f){return new BPromise(function(_0x2e3214,_0x44d6ae){try{if(_0x5835fd[_0xbb10('0x41')]){_0x5835fd[_0xbb10('0x42')]=[];_0x5835fd[_0xbb10('0x41')]['split'](',')[_0xbb10('0x43')](function(_0x1c7fae){_0x5835fd[_0xbb10('0x42')][_0xbb10('0x44')](_0xe2040f[_0x1c7fae]);});}delete _0x5835fd['TagIds'];}catch(_0x3fff6c){_0x44d6ae(_0x3fff6c);}_0x2e3214(_0x5835fd);});}function updateChatInteraction(_0x331751,_0x23dc18,_0x403beb){return new BPromise(function(_0x5e2cfa,_0x351484){return getInteractionUsers(_0x331751,_0x403beb)[_0xbb10('0x22')](function(_0x54ac18){return getInteractionTags(_0x54ac18,_0x23dc18);})['then'](function(_0x38d78f){_0x5e2cfa(_0x38d78f);})['catch'](function(_0x318984){_0x351484(_0x318984);});});}exports[_0xbb10('0x45')]=function(_0x4c66d8,_0x366608){var _0x1d82bf={},_0x474e99={},_0x5cf4f8={'count':0x0,'rows':[]};var _0x2dd02b=_[_0xbb10('0x3f')](db[_0xbb10('0x46')][_0xbb10('0x47')],function(_0x36e1fa){return{'name':_0x36e1fa[_0xbb10('0x48')],'type':_0x36e1fa[_0xbb10('0x49')][_0xbb10('0x4a')]};});_0x474e99[_0xbb10('0x4b')]=_[_0xbb10('0x3f')](_0x2dd02b,_0xbb10('0x38'));_0x474e99[_0xbb10('0x4c')]=_['keys'](_0x4c66d8[_0xbb10('0x4c')]);_0x474e99[_0xbb10('0x4d')]=_['intersection'](_0x474e99[_0xbb10('0x4b')],_0x474e99[_0xbb10('0x4c')]);_0x1d82bf[_0xbb10('0x4e')]=_[_0xbb10('0x4f')](_0x474e99[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x4c66d8[_0xbb10('0x4c')]['fields']));_0x1d82bf['attributes']=_0x1d82bf[_0xbb10('0x4e')][_0xbb10('0x51')]?_0x1d82bf[_0xbb10('0x4e')]:_0x474e99['model'];if(!_0x4c66d8['query'][_0xbb10('0x52')](_0xbb10('0x53'))){_0x1d82bf[_0xbb10('0x54')]=qs[_0xbb10('0x54')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x54')]);_0x1d82bf[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x2f')]);}_0x1d82bf['order']=qs['sort'](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x1d82bf[_0xbb10('0x56')]=qs[_0xbb10('0x4d')](_[_0xbb10('0x57')](_0x4c66d8[_0xbb10('0x4c')],_0x474e99[_0xbb10('0x4d')]),_0x2dd02b);var _0x445870=[];var _0x1c0d8f=squel[_0xbb10('0x58')]()[_0xbb10('0x59')]('id')[_0xbb10('0x59')](_0xbb10('0x38'))[_0xbb10('0x59')](_0xbb10('0x5a'))['from'](_0xbb10('0x5b'));var _0x5bd44d=squel[_0xbb10('0x58')]()[_0xbb10('0x59')](_0xbb10('0x5c'))[_0xbb10('0x59')](_0xbb10('0x5d'))[_0xbb10('0x59')](_0xbb10('0x5e'))[_0xbb10('0x5f')](_0xbb10('0x60'),'ui')[_0xbb10('0x61')](_0xbb10('0x62'),'u',_0xbb10('0x63'));var _0x1d49e1=squel[_0xbb10('0x58')]()[_0xbb10('0x5f')]('chat_interactions','i')[_0xbb10('0x61')](_0xbb10('0x64'),'c',_0xbb10('0x65'))[_0xbb10('0x61')](_0xbb10('0x62'),'o',_0xbb10('0x66'))['left_join'](_0xbb10('0x67'),'a',_0xbb10('0x68'))[_0xbb10('0x61')](_0xbb10('0x69'),'me',_0xbb10('0x6a'))[_0xbb10('0x61')](_0xbb10('0x6b'),'it',_0xbb10('0x6c'))[_0xbb10('0x61')](_0xbb10('0x5b'),'t',_0xbb10('0x6d'));var _0x2a1ce1=squel[_0xbb10('0x6e')]();var _0x4e7fac=[];var _0x4ea1a6=squel[_0xbb10('0x6e')]();var _0x3e6338;if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x6f')]){_0x3e6338=as['parseSearch'](_0x4c66d8['query'][_0xbb10('0x6f')]);var _0xaf2cc3=_0x3e6338[_0xbb10('0x70')];for(var _0x2dd150=0x0;_0x2dd150<_0x3e6338[_0xbb10('0x71')][_0xbb10('0x51')];_0x2dd150++){var _0x45c0dc=_0x3e6338['conditions'][_0x2dd150];var _0x117e84='i';var _0x216cff=_['find'](_0x2dd02b,['name',_0x45c0dc['field']]);if(!_0x216cff){switch(_0x45c0dc[_0xbb10('0x59')]){case _0xbb10('0x72'):if(_0x45c0dc[_0xbb10('0x73')]==0x1){_0x1d49e1['having']('`'+_0x45c0dc['field']+'`\x20=\x200');}else{_0x1d49e1[_0xbb10('0x74')]('`'+_0x45c0dc[_0xbb10('0x59')]+_0xbb10('0x75'));}break;case'Contact':if(_0x45c0dc[_0xbb10('0x76')]===_0xbb10('0x77')){if(_0x45c0dc['value']['split']('\x20')[_0xbb10('0x51')]>0x1){_0x2a1ce1[_0xaf2cc3](_0xbb10('0x78'),qs[_0xbb10('0x79')](_0x45c0dc[_0xbb10('0x73')]),null);}else{var _0x54b7c5='%'+_0x45c0dc[_0xbb10('0x73')]+'%';_0x2a1ce1[_0xaf2cc3](_0xbb10('0x7a'),_0x54b7c5,_0x54b7c5,_0x54b7c5);}}else{_0x216cff=_[_0xbb10('0x7b')](_0x2dd02b,['name',_0xbb10('0x7c')]);_0x45c0dc[_0xbb10('0x59')]=_0xbb10('0x7c');_0x329da7=as['buildExpression'](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}break;case _0xbb10('0x7f'):var _0x108e5b=_0x45c0dc[_0xbb10('0x73')]['split'](',')[_0xbb10('0x3f')](function(_0x277fe7){return Number(_0x277fe7);});_0x108e5b[_0xbb10('0x43')](function(_0x2ceb3e){_0x4ea1a6['or'](_0xbb10('0x80'),'%,'+_0x2ceb3e+',%');});_0x4e7fac=_[_0xbb10('0x81')](_0x4e7fac,_0x108e5b);break;case _0xbb10('0x82'):if(_0x45c0dc['operator']==='$substring'){_0x2a1ce1[_0xaf2cc3]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x45c0dc[_0xbb10('0x73')]+'%',null);}else{_0x216cff=_[_0xbb10('0x7b')](_0x2dd02b,[_0xbb10('0x38'),'UserId']);_0x45c0dc['field']=_0xbb10('0x83');_0x329da7=as[_0xbb10('0x84')](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}break;case _0xbb10('0x3a'):_0x329da7=as[_0xbb10('0x84')]('me',null,_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')]['start'],_0x329da7['value']['end']);break;}}else{var _0x329da7=as[_0xbb10('0x84')](_0x117e84,_0x216cff[_0xbb10('0x49')],_0x45c0dc);_0x2a1ce1[_0xaf2cc3](_0x329da7[_0xbb10('0x7d')],_0x329da7[_0xbb10('0x73')][_0xbb10('0x7e')],_0x329da7['value'][_0xbb10('0x2e')]);}}}else{var _0x4bc316=_(_0x4c66d8['query'])['keys']()[_0xbb10('0x3f')](function(_0x13040d){return _[_0xbb10('0x85')](_0x2dd02b,[_0xbb10('0x38'),_0x13040d])?_0x13040d:undefined;})['compact']()[_0xbb10('0x73')]();if(!_['isEmpty'](_0x4bc316)){_0x4bc316['forEach'](function(_0x165fe9){if(_0x165fe9===_0xbb10('0x86')){_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x87'),[][_0xbb10('0x88')](_0x4c66d8['query'][_0x165fe9]));}else if(_0x165fe9===_0xbb10('0x89')){var _0x19fcec=JSON[_0xbb10('0x8a')](_0x4c66d8[_0xbb10('0x4c')][_0x165fe9])[_0xbb10('0x8b')];var _0x27f42f=JSON[_0xbb10('0x8a')](_0x4c66d8['query'][_0x165fe9])[_0xbb10('0x8c')];_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x8d'),_0x19fcec,_0x27f42f);}else{if(_0x4c66d8[_0xbb10('0x4c')][_0x165fe9]===_0xbb10('0x8e')){_0x1d49e1[_0xbb10('0x56')]('i.'+_0x165fe9+_0xbb10('0x8f'));}else{_0x1d49e1[_0xbb10('0x56')]('i.'+_0x165fe9+'\x20=\x20?',_0x4c66d8[_0xbb10('0x4c')][_0x165fe9]);}}});}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x90')]){if(_0x4c66d8['query']['read']==0x1){_0x1d49e1['having'](_0xbb10('0x91'));}else{_0x1d49e1['having']('`unreadMessages`\x20>\x200');}}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]){_0x4e7fac=_[_0xbb10('0x93')](_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')])?_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]:new Array(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x92')]);_0x4e7fac['forEach'](function(_0x318a14){_0x4ea1a6['or'](_0xbb10('0x80'),'%,'+_0x318a14+',%');});}if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x94')]){var _0x5c8eb8=_0x4c66d8['query'][_0xbb10('0x94')][_0xbb10('0x95')]('\x5c','\x5c\x5c')[_0xbb10('0x95')](/'/g,'\x27\x27');if(qs[_0xbb10('0x96')](_0x5c8eb8)){_0x2a1ce1['or']('i.id\x20LIKE\x20?',_0x5c8eb8+'%');}else{_0x2a1ce1['or'](_0xbb10('0x97'),qs[_0xbb10('0x79')](_0x5c8eb8))['or'](_0xbb10('0x98'),_0x5c8eb8+'%');}}}_0x1d49e1[_0xbb10('0x56')](_0x2a1ce1);_0x1d49e1[_0xbb10('0x99')]('i.id');var _0x5f0691={'type':db[_0xbb10('0x9a')][_0xbb10('0x9b')][_0xbb10('0x9c')],'raw':!![]};var _0x5239da=_0x1d49e1[_0xbb10('0x9d')]();_0x5239da[_0xbb10('0x59')]('i.id');_0x5239da['field'](_0xbb10('0x9e'),_0xbb10('0x72'));if(_0x1d82bf[_0xbb10('0x9f')]){_0x1d82bf['order'][_0xbb10('0x43')](function(_0x3a17fc){var _0xfbb365=_0x3a17fc[0x0]===_0xbb10('0xa0')?_0x3a17fc[0x0]:'i.'+_0x3a17fc[0x0];_0x1d49e1[_0xbb10('0x9f')](_0xfbb365,_0x3a17fc[0x1]===_0xbb10('0xa1')?![]:!![]);});}if(!_[_0xbb10('0xa2')](_0x4e7fac)){_0x1d49e1[_0xbb10('0x74')](_0x4ea1a6);_0x5239da[_0xbb10('0x56')]('t.id\x20IN\x20?',_0x4e7fac);}BPromise[_0xbb10('0xa3')]()[_0xbb10('0x22')](function(){if(!_0x3e6338){if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x86')])return;_0x5239da[_0xbb10('0x56')](_0xbb10('0xa4'));_0x1d49e1[_0xbb10('0x56')](_0xbb10('0xa4'));return;}if(_0x4c66d8[_0xbb10('0xa5')][_0xbb10('0xa6')]!==_0xbb10('0xa7'))return;return _0x4c66d8[_0xbb10('0xa5')]['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0xe1fc51){if(_[_0xbb10('0xa2')](_0xe1fc51)){_0x5239da[_0xbb10('0x56')](_0xbb10('0xa8'));_0x1d49e1[_0xbb10('0x56')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x5239da[_0xbb10('0x56')](_0xbb10('0x87'),_[_0xbb10('0x3f')](_0xe1fc51,'id'));_0x1d49e1[_0xbb10('0x56')](_0xbb10('0x87'),_[_0xbb10('0x3f')](_0xe1fc51,'id'));}});})['then'](function(){if(_0x4c66d8[_0xbb10('0xa5')][_0xbb10('0xa6')]==='agent'&&!_0x3e6338&&!_0x4c66d8[_0xbb10('0x4c')]['ChatWebsiteId'])return[];return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x5239da[_0xbb10('0xaa')](),_0x5f0691);})[_0xbb10('0x22')](function(_0x3a4a6e){_0x5cf4f8['count']=_0x3a4a6e[_0xbb10('0x51')];if(_0x5cf4f8['count']===0x0)return[];return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x1c0d8f['toString'](),_0x5f0691)['then'](function(_0x415407){_0x445870=_[_0xbb10('0xab')](_0x415407,'id');_0x5f0691=_[_0xbb10('0xac')](_0x5f0691,{'model':db[_0xbb10('0x46')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4c66d8[_0xbb10('0x4c')][_0xbb10('0x50')]){_0x1d82bf[_0xbb10('0x4e')][_0xbb10('0x43')](function(_0x252ab8){_0x1d49e1[_0xbb10('0x59')]('i.'+_0x252ab8);});}else{_0x1d49e1[_0xbb10('0x59')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xbb10('0x72'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xad'),_0xbb10('0xae'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xaf'),_0xbb10('0xb0'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb1'),_0xbb10('0xa0'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb2'));_0x1d49e1['field'](_0xbb10('0xb3'),'Contact.firstName');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb4'),_0xbb10('0xb5'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb6'),'Contact.email');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb7'),_0xbb10('0xb8'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xb9'),_0xbb10('0xba'));_0x1d49e1['field']('c.fax',_0xbb10('0xbb'));_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbc'),'Owner.fullname');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbd'),'Owner.internal');_0x1d49e1[_0xbb10('0x59')](_0xbb10('0xbe'),'TagIds');}if(_0x1d82bf[_0xbb10('0x54')])_0x1d49e1['limit'](_0x1d82bf[_0xbb10('0x54')]);if(_0x1d82bf[_0xbb10('0x2f')])_0x1d49e1['offset'](_0x1d82bf[_0xbb10('0x2f')]);return db[_0xbb10('0xa9')]['query'](_0x1d49e1['toString'](),_0x5f0691);})[_0xbb10('0x22')](function(_0x13ae83){if(_0x13ae83[_0xbb10('0x51')]>0x0)_0x5bd44d[_0xbb10('0x56')](_0xbb10('0xbf'),_['map'](_0x13ae83,'id'));return db[_0xbb10('0xa9')][_0xbb10('0x4c')](_0x5bd44d[_0xbb10('0xaa')](),_0x5f0691)['then'](function(_0xd68afa){var _0x4f90e6=_[_0xbb10('0xc0')](_0xd68afa,_0xbb10('0xc1'));var _0x44a3e1=[];_0x13ae83[_0xbb10('0x43')](function(_0x1f55d3){_0x44a3e1[_0xbb10('0x44')](updateChatInteraction(_0x1f55d3,_0x445870,_0x4f90e6));});return BPromise[_0xbb10('0xc2')](_0x44a3e1);});});})['then'](function(_0x4fc544){_0x5cf4f8[_0xbb10('0xc3')]=_0x4fc544;return _0x5cf4f8;})[_0xbb10('0x22')](respondWithFilteredResult(_0x366608,_0x1d82bf))[_0xbb10('0xc4')](handleError(_0x366608,null));};exports[_0xbb10('0xc5')]=function(_0x20b585,_0x363b81){var _0x1cccec={'raw':![],'where':{'id':_0x20b585[_0xbb10('0xc6')]['id']}},_0x1674f7={};_0x1674f7[_0xbb10('0x4b')]=_[_0xbb10('0xc7')](db[_0xbb10('0x46')][_0xbb10('0x47')]);_0x1674f7['query']=_[_0xbb10('0xc7')](_0x20b585[_0xbb10('0x4c')]);_0x1674f7[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x1674f7[_0xbb10('0x4b')],_0x1674f7[_0xbb10('0x4c')]);_0x1cccec[_0xbb10('0x4e')]=_[_0xbb10('0x4f')](_0x1674f7[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x20b585[_0xbb10('0x4c')]['fields']));_0x1cccec[_0xbb10('0x4e')]=_0x1cccec['attributes'][_0xbb10('0x51')]?_0x1cccec[_0xbb10('0x4e')]:_0x1674f7[_0xbb10('0x4b')];if(_0x20b585[_0xbb10('0x4c')][_0xbb10('0xc8')]){_0x1cccec[_0xbb10('0xc9')]=[{'all':!![]}];}_0x1cccec=_['merge']({},_0x1cccec,_0x20b585[_0xbb10('0xca')]);return db['ChatInteraction'][_0xbb10('0x7b')](_0x1cccec)[_0xbb10('0x22')](handleEntityNotFound(_0x363b81,null))[_0xbb10('0x22')](respondWithResult(_0x363b81,null))[_0xbb10('0xc4')](handleError(_0x363b81,null));};exports[_0xbb10('0xcb')]=function(_0x31907e,_0x4f06c){return db[_0xbb10('0x46')][_0xbb10('0xcb')](_0x31907e[_0xbb10('0x3a')],{})[_0xbb10('0x22')](respondWithResult(_0x4f06c,0xc9))[_0xbb10('0xc4')](handleError(_0x4f06c,null));};exports['update']=function(_0x3696b3,_0x516520){if(_0x3696b3[_0xbb10('0x3a')]['id']){delete _0x3696b3[_0xbb10('0x3a')]['id'];}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x3696b3[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x516520,null))[_0xbb10('0x22')](saveUpdates(_0x3696b3['body'],null))[_0xbb10('0x22')](respondWithResult(_0x516520,null))['catch'](handleError(_0x516520,null));};exports['destroy']=function(_0x1513e0,_0x35cbb9){return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x1513e0[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x35cbb9,null))['then'](removeEntity(_0x35cbb9,null))[_0xbb10('0xc4')](handleError(_0x35cbb9,null));};exports[_0xbb10('0xcc')]=function(_0x39aa9e,_0xb1b7c8){return db[_0xbb10('0x46')][_0xbb10('0xcc')]()['then'](respondWithResult(_0xb1b7c8,null))[_0xbb10('0xc4')](handleError(_0xb1b7c8,null));};exports[_0xbb10('0xcd')]=function(_0xb7c454,_0xa8b7c3){var _0x31718f=_0xb7c454[_0xbb10('0xc6')]['id'];var _0x2764e1;var _0x5e405b;var _0x33a43e;return db['ChatInteraction'][_0xbb10('0xce')]({'where':{'id':_0x31718f}})['then'](function(_0x4c8b68){_0x2764e1=_0x4c8b68;return db[_0xbb10('0xcf')][_0xbb10('0xce')]({'where':{'id':_0x4c8b68[_0xbb10('0x86')]},'attributes':['id',_0xbb10('0xd0'),_0xbb10('0xd1'),'vidaooTopic',_0xbb10('0xd2'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x4dd138){if(_0x4dd138&&_0x4dd138[_0xbb10('0xd0')]&&_0x4dd138[_0xbb10('0xd1')]){_0x5e405b=_0x4dd138;var _0x1b9012={'interaction':{'id':_0x31718f},'agent':{'id':_0xb7c454[_0xbb10('0xa5')]['id'],'name':_0xb7c454[_0xbb10('0xa5')]['name'],'fullname':_0xb7c454[_0xbb10('0xa5')][_0xbb10('0x40')],'email':_0xb7c454[_0xbb10('0xa5')][_0xbb10('0xd3')]},'contact':_0xb7c454[_0xbb10('0x3a')][_0xbb10('0x3b')],'account':_0xb7c454[_0xbb10('0x3a')]['account']};var _0x4c95c2={'rejectUnauthorized':![],'method':'POST','url':_0xbb10('0xd4'),'headers':{'X-APIKEY':_0x4dd138[_0xbb10('0xd0')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xb7c454[_0xbb10('0xa5')][_0xbb10('0xd3')]],'buttons':null,'topic':_0x5e405b[_0xbb10('0xd5')],'note':_[_0xbb10('0xd6')](_0x5e405b[_0xbb10('0xd2')])?null:getMustacheRender(_0x5e405b[_0xbb10('0xd2')],_0x1b9012),'metadata':null},'redirect':_0xbb10('0xd7'),'json':!![]};try{if(!_[_0xbb10('0xd6')](_0x5e405b['vidaooMetadata'])){var _0x58295f=getMustacheRender(_0x5e405b['vidaooMetadata'],_0x1b9012);var _0x3d4b89=JSON[_0xbb10('0x8a')](_0x58295f);_0x4c95c2[_0xbb10('0x3a')]['metadata']=_0x3d4b89;}}catch(_0x2bfa8e){throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xd9'));}return rp(_0x4c95c2);}else{throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))]('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x356660){_0x33a43e=_0x356660;if(_0x33a43e['id']){var _0x48889b={'body':_0x33a43e[_0xbb10('0xda')],'ChatWebsiteId':_0x5e405b['id'],'ChatInteractionId':_0x2764e1['id'],'direction':_0xbb10('0xdb'),'UserId':_0xb7c454[_0xbb10('0xa5')]['id']};return db[_0xbb10('0xdc')][_0xbb10('0xcb')](_0x48889b,{});}else{throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xdd'));}})[_0xbb10('0x22')](function(){return _0x2764e1[_0xbb10('0xde')]({'vidaooSessionId':_0x33a43e['id']});})['then'](respondWithResult(_0xa8b7c3,null))[_0xbb10('0xc4')](handleError(_0xa8b7c3,null));};exports['customUpdate']=function(_0x27bed2,_0x5547fa){if(_0x27bed2[_0xbb10('0x3a')]['id']){delete _0x27bed2[_0xbb10('0x3a')]['id'];}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0x27bed2['params']['id']},'include':[{'model':db[_0xbb10('0xdf')],'as':'Contact'}]})[_0xbb10('0x22')](handleEntityNotFound(_0x5547fa,null))[_0xbb10('0x22')](saveUpdates(_0x27bed2[_0xbb10('0x3a')],null))['then'](respondWithResult(_0x5547fa,null))[_0xbb10('0xc4')](handleError(_0x5547fa,null));};exports[_0xbb10('0xe0')]=function(_0x140173,_0x18a44f,_0x11d31b){if(_0x140173[_0xbb10('0x3a')]['id']){delete _0x140173['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x140173[_0xbb10('0xc6')]['id']}})['then'](function(_0x318908){if(!_0x318908){logger['error'](_0xbb10('0xe1'),_0xbb10('0xe0'),0x194,_0xbb10('0xe2'));_0x18a44f['sendStatus'](0x194);}else{if(_0x318908['UserId']){throw new db[(_0xbb10('0x9a'))][(_0xbb10('0xd8'))](_0xbb10('0xe3'));}}return _0x318908;})['then'](function(_0x440108){if(_0x440108){return _0x440108[_0xbb10('0x36')]({'closed':_0x140173[_0xbb10('0x3a')]['closed'],'disposition':_0x140173['body']['disposition']})[_0xbb10('0x22')](function(_0x55aa03){return _0x55aa03;});}})[_0xbb10('0x22')](function(_0x1c2c95){return respondWithRpcPromise(_0xbb10('0xe4'),_0xbb10('0xe0'),_0x140173[_0xbb10('0x3a')],client9004);})[_0xbb10('0x22')](respondWithResult(_0x18a44f,null))[_0xbb10('0xc4')](handleError(_0x18a44f,null));};exports[_0xbb10('0xe5')]=function(_0x2746eb,_0x431792,_0x2e2710){_0x2746eb['body'][_0xbb10('0x38')]=_0x2746eb[_0xbb10('0xe6')]['originalname'];_0x2746eb[_0xbb10('0x3a')]['basename']=_0x2746eb['file'][_0xbb10('0xe7')];_0x2746eb[_0xbb10('0x3a')][_0xbb10('0x49')]=_0x2746eb[_0xbb10('0xe6')][_0xbb10('0xe8')];return db['Attachment'][_0xbb10('0xcb')](_0x2746eb[_0xbb10('0x3a')])['then'](respondWithResult(_0x431792,0xc9))[_0xbb10('0xc4')](handleError(_0x431792,null));};exports[_0xbb10('0xe9')]=function(_0x5a82e7,_0x424c96,_0x4c769b){return db[_0xbb10('0x46')][_0xbb10('0xce')]({'where':{'id':_0x5a82e7[_0xbb10('0xc6')]['id']},'raw':!![]})[_0xbb10('0x22')](handleEntityNotFound(_0x424c96,null))[_0xbb10('0x22')](function(_0x20b312){if(_0x20b312){if(_0x20b312[_0xbb10('0xea')]){return _0x424c96['status'](0x193)[_0xbb10('0x33')]({'status':0x193,'message':_0xbb10('0xeb')});}return db[_0xbb10('0xec')][_0xbb10('0xce')]({'where':{'id':_0x5a82e7[_0xbb10('0x4c')][_0xbb10('0xed')]},'raw':!![]})['then'](handleEntityNotFound(_0x424c96,null));}})['then'](function(_0x5a40e8){if(_0x5a40e8){var _0x23849e=_0x5a40e8[_0xbb10('0xee')]!==null;var _0x3e1a86=path[_0xbb10('0xef')](config['root'],_0xbb10('0xf0'));if(_0x23849e){_0x3e1a86=path[_0xbb10('0xef')](_0x3e1a86,_0xbb10('0xf1'));}var _0x577d27=path['join'](_0x3e1a86,_0x5a40e8[_0xbb10('0xf2')]);return _0x424c96['download'](_0x577d27);}})[_0xbb10('0xc4')](handleError(_0x424c96,null));};exports[_0xbb10('0xf3')]=function(_0xb9bc5a,_0x42276f){var _0x425505=null;var _0xcb61bb=null;var _0x1fe250=null;var _0x57933f=null;if(_0xb9bc5a[_0xbb10('0x3a')]['id']){delete _0xb9bc5a[_0xbb10('0x3a')]['id'];}if(_0xb9bc5a['body'][_0xbb10('0xf4')]){_0x57933f=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],'server/files/chat/upload/',util['format']('transcript-%s.txt',Date[_0xbb10('0xf6')]()));_0xb9bc5a[_0xbb10('0x3a')]['pathTranscript']=_0x57933f;}return db[_0xbb10('0x46')][_0xbb10('0x7b')]({'where':{'id':_0xb9bc5a[_0xbb10('0xc6')]['id']},'include':[{'model':db[_0xbb10('0xdc')],'as':_0xbb10('0xf7'),'include':[{'model':db[_0xbb10('0x82')],'as':_0xbb10('0x82')}]}]})['then'](handleEntityNotFound(_0x42276f,null))[_0xbb10('0x22')](saveUpdates(_0xb9bc5a['body'],null))['then'](function(_0x4aa0d7){if(_0x4aa0d7){_0x425505=_0x4aa0d7;return db[_0xbb10('0xcf')][_0xbb10('0x7b')]({'where':{'id':_0x425505['ChatWebsiteId']}});}})[_0xbb10('0x22')](function(_0x49f324){if(_0x49f324){_0x1fe250=_0x49f324;return db[_0xbb10('0xdf')][_0xbb10('0x7b')]({'where':{'id':_0x425505[_0xbb10('0x7c')]}});}})['then'](function(_0x4d10ea){if(_0x4d10ea){_0xcb61bb=_0x4d10ea;if(_0x57933f){var _0x447c0d=null;for(var _0x502e73=0x1;_0x502e73<_0x425505[_0xbb10('0xf7')][_0xbb10('0x51')];++_0x502e73){_0x447c0d=_0x425505['Messages'][_0x502e73];var _0x50cd00=_0x447c0d[_0xbb10('0x83')]?util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0x1fe250['agentAlias'],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');var _0x22f153=_0xb9bc5a['body'][_0xbb10('0xfb')]||util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0xbb10('0xfc'),_0x447c0d[_0xbb10('0x7c')]);switch(_0x1fe250[_0xbb10('0xfd')]){case _0xbb10('0xfe'):_0x50cd00=_0x447c0d[_0xbb10('0x83')]?util[_0xbb10('0xf8')](_0xbb10('0xf9'),_0x1fe250[_0xbb10('0xff')],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');break;case'agent_alias':_0x50cd00=_0x447c0d['UserId']?_0x447c0d[_0xbb10('0x82')]['alias']||_0x447c0d[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa');break;case'agent_fullname':_0x50cd00=_0x447c0d[_0xbb10('0x83')]?_0x447c0d[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa');break;default:_0x50cd00=_0x447c0d[_0xbb10('0x83')]?util['format'](_0xbb10('0xf9'),_0x1fe250[_0xbb10('0xff')],_0x447c0d[_0xbb10('0x83')]):_0xbb10('0xfa');}var _0x150d4c=util[_0xbb10('0xf8')]('[%s]\x20%s:\x20%s\x0a',moment(_0x447c0d[_0xbb10('0x89')])[_0xbb10('0xf8')]('MM/DD/YYYY\x20HH:mm:ss'),_0x447c0d[_0xbb10('0x100')]==='in'?_0x22f153:_0x50cd00,_0x447c0d[_0xbb10('0x3a')]);if(!_0x447c0d[_0xbb10('0x101')]){fs[_0xbb10('0x102')](_0x57933f,_0x150d4c);}}return db[_0xbb10('0x103')][_0xbb10('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0xbb10('0x104')],'as':_0xbb10('0x105'),'raw':!![]}]});}}})[_0xbb10('0x22')](function(_0x33d1b7){if(_0x33d1b7&&_0x33d1b7[_0xbb10('0x105')]&&_0xb9bc5a[_0xbb10('0x3a')]){var _0x1db646={'tls':{'rejectUnauthorized':![]}};if(_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x106')]){_0x1db646['service']=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x106')];}else{_0x1db646['host']=_0x33d1b7['Smtp'][_0xbb10('0x107')];_0x1db646[_0xbb10('0x108')]=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x108')];_0x1db646[_0xbb10('0x109')]=_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x109')];}if(_0x33d1b7[_0xbb10('0x105')][_0xbb10('0x10a')]){_0x1db646['auth']={'user':_0x33d1b7['Smtp']['user'],'pass':_0x33d1b7['Smtp']['pass']};}return respondWithRpcPromise('SendMail',_0xbb10('0x10b'),{'account':_0x1db646,'message':{'from':util[_0xbb10('0xf8')](_0xbb10('0x10c'),_0x33d1b7[_0xbb10('0x38')],_0x33d1b7['email']||_0x33d1b7[_0xbb10('0x105')][_0xbb10('0xa5')]),'to':_0xb9bc5a[_0xbb10('0x3a')][_0xbb10('0xf4')],'subject':'Mail\x20Transcript','text':util['format'](_0xbb10('0x10d'),_0xb9bc5a[_0xbb10('0x3a')]['mailTranscript']),'attachments':[{'path':_0x57933f}]}})['then'](function(){return _0x425505;})[_0xbb10('0xc4')](function(_0xf1371a){console[_0xbb10('0x28')](_0xf1371a);});}else{return _0x425505;}})[_0xbb10('0x22')](respondWithStatusCode(_0x42276f,0xc8))[_0xbb10('0xc4')](handleError(_0x42276f,null));};exports['addMessage']=function(_0x4744f4,_0x5382e9,_0x4c97b9){return db[_0xbb10('0xdc')][_0xbb10('0x7b')]({'where':{'id':_0x4744f4[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x5382e9,null))[_0xbb10('0x22')](function(_0x21c0fd){if(_0x21c0fd){return _0x21c0fd['addMessage'](_0x4744f4[_0xbb10('0x3a')][_0xbb10('0x10e')],_[_0xbb10('0x10f')](_0x4744f4[_0xbb10('0x3a')],[_0xbb10('0x10e'),'id'])||{});}})[_0xbb10('0x22')](respondWithResult(_0x5382e9,null))[_0xbb10('0xc4')](handleError(_0x5382e9,null));};exports[_0xbb10('0x110')]=function(_0x233d5e,_0x16f3ce,_0xbae19c){var _0x26f4b0={'raw':![],'where':{}};var _0x1dbf7b={};var _0x117e95={'count':0x0,'rows':[]};return db[_0xbb10('0x46')][_0xbb10('0xce')]({'where':{'id':_0x233d5e[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x16f3ce,null))[_0xbb10('0x22')](function(_0x43a203){if(_0x43a203){_0x1dbf7b[_0xbb10('0x4b')]=_[_0xbb10('0xc7')](db['ChatMessage'][_0xbb10('0x47')]);_0x1dbf7b['query']=_[_0xbb10('0xc7')](_0x233d5e[_0xbb10('0x4c')]);_0x1dbf7b[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x1dbf7b[_0xbb10('0x4b')],_0x1dbf7b['query']);_0x26f4b0['attributes']=_['intersection'](_0x1dbf7b[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x233d5e['query'][_0xbb10('0x50')]));_0x26f4b0[_0xbb10('0x4e')]=_0x26f4b0[_0xbb10('0x4e')]['length']?_0x26f4b0[_0xbb10('0x4e')]:_0x1dbf7b[_0xbb10('0x4b')];if(!_0x233d5e[_0xbb10('0x4c')]['hasOwnProperty'](_0xbb10('0x53'))){_0x26f4b0['limit']=qs[_0xbb10('0x54')](_0x233d5e['query']['limit']);_0x26f4b0['offset']=qs['offset'](_0x233d5e['query']['offset']);}_0x26f4b0[_0xbb10('0x9f')]=qs[_0xbb10('0x55')](_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x26f4b0['where']=qs[_0xbb10('0x4d')](_[_0xbb10('0x57')](_0x233d5e[_0xbb10('0x4c')],_0x1dbf7b[_0xbb10('0x4d')]));_0x26f4b0[_0xbb10('0x56')][_0xbb10('0xc1')]=_0x43a203['id'];if(_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x94')]){_0x26f4b0[_0xbb10('0x56')]=_[_0xbb10('0xac')](_0x26f4b0['where'],{'$or':_[_0xbb10('0x3f')](_0x26f4b0[_0xbb10('0x4e')],function(_0x288ccc){var _0x5c5ecc={};_0x5c5ecc[_0x288ccc]={'$like':'%'+_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x94')]+'%'};return _0x5c5ecc;})});}if(_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x8b')]){var _0x5b2292=_0x233d5e[_0xbb10('0x4c')][_0xbb10('0x8b')][_0xbb10('0x111')](',');var _0x22ec50={};_0x22ec50[_0x5b2292[0x0]]={'$gte':moment(_0x5b2292[0x1])[_0xbb10('0xf8')](_0xbb10('0x112'))};_0x26f4b0[_0xbb10('0x56')]=_[_0xbb10('0xac')](_0x26f4b0[_0xbb10('0x56')],_0x22ec50);}_0x26f4b0=_[_0xbb10('0xac')]({},_0x26f4b0,_0x233d5e[_0xbb10('0xca')]);return db['ChatMessage'][_0xbb10('0x31')]({'where':_0x26f4b0[_0xbb10('0x56')]})['then'](function(_0x5eb1fb){_0x117e95[_0xbb10('0x31')]=_0x5eb1fb;if(_0x233d5e[_0xbb10('0x4c')]['includeAll']){_0x26f4b0[_0xbb10('0xc9')]=[{'all':!![]}];}return db[_0xbb10('0xdc')]['findAll'](_0x26f4b0);})[_0xbb10('0x22')](function(_0x42441e){_0x117e95[_0xbb10('0xc3')]=_0x42441e;return _0x117e95;});}})[_0xbb10('0x22')](respondWithFilteredResult(_0x16f3ce,_0x26f4b0))[_0xbb10('0xc4')](handleError(_0x16f3ce,null));};exports['getMyMessages']=function(_0x4fc260,_0x5a502c,_0xaeaa51){var _0x4db9ad={'where':{}},_0x43deea={},_0x53e73e={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xbb10('0xce')]({'where':{'id':_0x4fc260[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x5a502c,null))[_0xbb10('0x22')](function(_0x2527f4){if(_0x2527f4){_0x43deea[_0xbb10('0x4b')]=_['keys'](db['ChatMessage']['rawAttributes']);_0x43deea[_0xbb10('0x4c')]=_[_0xbb10('0xc7')](_0x4fc260[_0xbb10('0x4c')]);_0x43deea[_0xbb10('0x4d')]=_[_0xbb10('0x4f')](_0x43deea[_0xbb10('0x4b')],_0x43deea[_0xbb10('0x4c')]);_0x4db9ad['attributes']=_[_0xbb10('0x4f')](_0x43deea[_0xbb10('0x4b')],qs[_0xbb10('0x50')](_0x4fc260[_0xbb10('0x4c')]['fields']));_0x4db9ad[_0xbb10('0x4e')]=_0x4db9ad['attributes']['length']?_0x4db9ad[_0xbb10('0x4e')]:_0x43deea[_0xbb10('0x4b')];if(!_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x52')](_0xbb10('0x53'))){_0x4db9ad[_0xbb10('0x54')]=qs['limit'](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x54')]);_0x4db9ad[_0xbb10('0x2f')]=qs[_0xbb10('0x2f')](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x2f')]);}_0x4db9ad[_0xbb10('0x9f')]=qs['sort'](_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x55')]);_0x4db9ad[_0xbb10('0x56')]=qs['filters'](_['pick'](_0x4fc260[_0xbb10('0x4c')],_0x43deea[_0xbb10('0x4d')]));_0x4db9ad[_0xbb10('0x56')][_0xbb10('0xc1')]=_0x2527f4['id'];if(_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x94')]){_0x4db9ad[_0xbb10('0x56')]=_['merge'](_0x4db9ad[_0xbb10('0x56')],{'$or':_[_0xbb10('0x3f')](_0x4db9ad[_0xbb10('0x4e')],function(_0x55ba78){var _0x5e195a={};_0x5e195a[_0x55ba78]={'$like':'%'+_0x4fc260['query']['filter']+'%'};return _0x5e195a;})});}_0x4db9ad[_0xbb10('0x56')][_0xbb10('0x101')]=![];if(_0x4fc260[_0xbb10('0x4c')]['id']){_0x4db9ad[_0xbb10('0x56')]['id']={'$gt':_0x4fc260['query']['id']};}_0x4db9ad=_[_0xbb10('0xac')]({},_0x4db9ad,_0x4fc260['options']);return db[_0xbb10('0xdc')][_0xbb10('0x31')]({'where':_0x4db9ad[_0xbb10('0x56')]})[_0xbb10('0x22')](function(_0xa16287){_0x53e73e[_0xbb10('0x31')]=_0xa16287;_0x4db9ad[_0xbb10('0xc9')]=[];if(_0x4fc260[_0xbb10('0x4c')][_0xbb10('0x113')]){_0x4db9ad[_0xbb10('0xc9')][_0xbb10('0x44')]({'model':db[_0xbb10('0x82')],'as':'User','attributes':['id',_0xbb10('0x40'),_0xbb10('0x114')]});}if(_0x4fc260[_0xbb10('0x4c')]['includeAll']){_0x4db9ad[_0xbb10('0xc9')]=[{'all':!![]}];}return db['ChatMessage'][_0xbb10('0x115')](_0x4db9ad);})[_0xbb10('0x22')](function(_0x280119){_0x53e73e[_0xbb10('0xc3')]=_0x280119;return _0x53e73e;});}})[_0xbb10('0x22')](respondWithFilteredResult(_0x5a502c,_0x4db9ad))['catch'](handleError(_0x5a502c,null));};exports['addTags']=function(_0x842d94,_0x4cf5cc,_0x553bb8){return db[_0xbb10('0x46')]['find']({'where':{'id':_0x842d94[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x4cf5cc,null))[_0xbb10('0x22')](function(_0x4469c4){if(_0x4469c4){return _0x4469c4[_0xbb10('0x116')](_0x842d94[_0xbb10('0x3a')][_0xbb10('0x10e')],_[_0xbb10('0x10f')](_0x842d94['body'],[_0xbb10('0x10e'),'id'])||{})['spread'](function(){return db[_0xbb10('0x7f')]['findAll']({'attributes':['id',_0xbb10('0x38'),_0xbb10('0x5a')],'where':{'id':_0x842d94['body'][_0xbb10('0x10e')]}});})[_0xbb10('0x22')](function(_0x1bb072){socket['emit'](_0xbb10('0x117'),{'id':Number(_0x842d94[_0xbb10('0xc6')]['id']),'tags':_0x1bb072||[]});return{'id':Number(_0x842d94[_0xbb10('0xc6')]['id']),'tags':_0x1bb072||[]};});}})['then'](respondWithResult(_0x4cf5cc,null))[_0xbb10('0xc4')](handleError(_0x4cf5cc,null));};exports[_0xbb10('0x118')]=function(_0x46df90,_0x4b781e,_0x3e6756){return db['ChatInteraction'][_0xbb10('0x7b')]({'where':{'id':_0x46df90[_0xbb10('0xc6')]['id']}})[_0xbb10('0x22')](handleEntityNotFound(_0x4b781e,null))[_0xbb10('0x22')](function(_0x583a3e){if(_0x583a3e){return _0x583a3e[_0xbb10('0x118')](_0x46df90[_0xbb10('0x4c')][_0xbb10('0x10e')]);}})[_0xbb10('0x22')](respondWithStatusCode(_0x4b781e,null))[_0xbb10('0xc4')](handleError(_0x4b781e,null));};exports['download']=function(_0x4b10ed,_0x40b5da){var _0x4739a6=moment()[_0xbb10('0x119')]()['toString']();var _0x3d5870=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],_0xbb10('0x11a'),_0xbb10('0x11b'),_0xbb10('0x11c'));var _0x81d970=path[_0xbb10('0xef')](config[_0xbb10('0xf5')],'server',_0xbb10('0x11b'),_0xbb10('0x11d'));var _0x4102af=path[_0xbb10('0xef')](_0x3d5870,_0x4739a6);var _0x4d49a7=util[_0xbb10('0xf8')](_0xbb10('0x11e'),_0x4b10ed[_0xbb10('0xc6')]['id'],_0x4739a6);var _0x59fef2=path['join'](_0x3d5870,_0x4d49a7);var _0x3b45c4=[];_0x3b45c4['push']({'model':db[_0xbb10('0x82')],'as':'User','attributes':['id',_0xbb10('0x40')],'raw':!![]});_0x3b45c4[_0xbb10('0x44')]({'model':db[_0xbb10('0xdf')],'as':_0xbb10('0x11f'),'attributes':['id',_0xbb10('0x120'),_0xbb10('0x121')],'raw':!![]});if(_0x4b10ed[_0xbb10('0x4c')]['attachments']){_0x3b45c4[_0xbb10('0x44')]({'model':db[_0xbb10('0xec')],'as':_0xbb10('0xec'),'raw':!![]});}var _0x2807d2=[{'model':db[_0xbb10('0xdc')],'as':_0xbb10('0xf7'),'attributes':['id','body',_0xbb10('0x89'),_0xbb10('0x100'),_0xbb10('0x101'),_0xbb10('0x90')],'include':_0x3b45c4}];_0x2807d2[_0xbb10('0x44')]({'model':db[_0xbb10('0xcf')],'as':_0xbb10('0x122'),'attributes':['id','name']});_0x2807d2[_0xbb10('0x44')]({'model':db[_0xbb10('0x82')],'as':_0xbb10('0x123'),'attributes':['id','fullname']});return db[_0xbb10('0x46')]['find']({'where':{'id':_0x4b10ed[_0xbb10('0xc6')]['id']},'include':_0x2807d2})[_0xbb10('0x22')](handleEntityNotFound(_0x40b5da,null))[_0xbb10('0x22')](function(_0x58a447){if(_0x58a447){var _0x50fa4e=_0x58a447[_0xbb10('0x124')]({'plain':!![]});fs[_0xbb10('0x125')](_0x4102af);var _0xbb410e={'channel':_0xbb10('0x126'),'account':_0x50fa4e[_0xbb10('0x122')][_0xbb10('0x38')],'agent':_0x50fa4e[_0xbb10('0x123')]?_0x50fa4e[_0xbb10('0x123')][_0xbb10('0x40')]:_0xbb10('0x127'),'createdAt':moment(_0x50fa4e[_0xbb10('0x89')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xbb10('0xaa')](),'closedAt':_0x50fa4e[_0xbb10('0xea')]?moment(_0x50fa4e['closedAt'])['format'](_0xbb10('0x112'))[_0xbb10('0xaa')]():'','disposition':_0x50fa4e[_0xbb10('0x128')],'chatInfo':{'browser':_0x50fa4e['browserName'],'os':_0x50fa4e[_0xbb10('0x129')],'referer':_0x50fa4e[_0xbb10('0x12a')],'customerIp':_0x50fa4e['customerIp'],'customerPort':_0x50fa4e[_0xbb10('0x12b')]?_0x50fa4e[_0xbb10('0x12b')]:'N.A.'},'messages':_(_0x50fa4e['Messages'])[_0xbb10('0x12c')]()[_0xbb10('0x94')]({'secret':![]})[_0xbb10('0x3f')](function(_0x5cab64){if(_0x5cab64['Attachment']){var _0x58ee41=path[_0xbb10('0xef')](_0x81d970,_0x5cab64['Attachment'][_0xbb10('0xf2')]);if(fs[_0xbb10('0x12d')](_0x58ee41)){fs['createReadStream'](_0x58ee41)[_0xbb10('0x12e')](fs[_0xbb10('0x12f')](path[_0xbb10('0xef')](_0x4102af,_0x5cab64[_0xbb10('0xec')]['basename'])));}}return{'date':moment(_0x5cab64[_0xbb10('0x89')])['format'](_0xbb10('0x112'))[_0xbb10('0xaa')](),'sender':_0x5cab64[_0xbb10('0x100')]===_0xbb10('0xdb')?_0x5cab64[_0xbb10('0x82')]?_0x5cab64[_0xbb10('0x82')][_0xbb10('0x40')]:_0xbb10('0xfa'):_0x5cab64['Contact'][_0xbb10('0x120')]+(_0x5cab64[_0xbb10('0x11f')][_0xbb10('0x121')]?'\x20'+_0x5cab64[_0xbb10('0x11f')]['lastName']:''),'body':_0x5cab64['Attachment']?_0x5cab64[_0xbb10('0xec')][_0xbb10('0xf2')]:_0x5cab64[_0xbb10('0x3a')],'direction':_0x5cab64[_0xbb10('0x100')]==='out'?'A':'C','secret':_0x5cab64[_0xbb10('0x101')],'read':_0x5cab64[_0xbb10('0x90')],'attachment':_0x5cab64['Attachment']};})[_0xbb10('0x73')]()};return ejs['renderFile'](path['join'](config[_0xbb10('0xf5')],_0xbb10('0x11a'),_0xbb10('0x130'),_0xbb10('0x131')),{'interaction':_0xbb410e})[_0xbb10('0x22')](function(_0x4aa76a){var _0x38403e=path[_0xbb10('0xef')](_0x4102af,_0xbb10('0x132')+_0x50fa4e['id']+'-'+_0x4739a6+_0xbb10('0x133'));var _0x1b7274={'path':_0x38403e,'channel':_0xbb10('0x126'),'interactionId':_0x50fa4e['id']};return pdf[_0xbb10('0x134')](_0x4aa76a,_0x1b7274);})[_0xbb10('0x22')](function(){return new BPromise(function(_0x34f4d6,_0x254b6e){zipdir(_0x4102af,{'saveTo':_0x59fef2},function(_0x368adb,_0xef4ccf){if(_0x368adb)return _0x254b6e(_0x368adb);return _0x34f4d6(_0xef4ccf);});})[_0xbb10('0x22')](function(){return new BPromise(function(_0x9fcc26,_0x111fd4){rimraf(_0x4102af,function(_0x256ce9){if(_0x256ce9)_0x111fd4(_0x256ce9);return _0x9fcc26();});});})[_0xbb10('0x22')](function(){return _0x40b5da[_0xbb10('0x135')](_0x59fef2,_0x4d49a7,function(_0x27e0c5){if(_0x27e0c5){console[_0xbb10('0x136')](_0xbb10('0x137'),_0x27e0c5);}else{fs[_0xbb10('0x138')](_0x59fef2);}});});});}else{return _0x40b5da[_0xbb10('0x2c')](0xc8);}})[_0xbb10('0xc4')](handleError(_0x40b5da,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 191c1b4..aca1d96 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 _0x7565=['ChatInteraction','setMaxListeners','save','update','remove','getUsers','Users','map','findAll','then','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x7565,0x19c));var _0x5756=function(_0x2677d7,_0x3d659d){_0x2677d7=_0x2677d7-0x0;var _0x3a016f=_0x7565[_0x2677d7];return _0x3a016f;};'use strict';var EventEmitter=require(_0x5756('0x0'));var ChatInteraction=require(_0x5756('0x1'))['db'][_0x5756('0x2')];var ChatMessage=require(_0x5756('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5756('0x3')](0x0);var events={'afterCreate':_0x5756('0x4'),'afterUpdate':_0x5756('0x5'),'afterDestroy':_0x5756('0x6')};function emitEvent(_0x2665fa){return function(_0x2d4c63,_0x1e29a1,_0x5aaa44){_0x2d4c63[_0x5756('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x30e0cd){_0x2d4c63['setDataValue'](_0x5756('0x8'),_0x30e0cd[_0x5756('0x9')](function(_0x1a9ba2){return{'id':_0x1a9ba2['id']};}));return ChatMessage[_0x5756('0xa')]({'where':{'ChatInteractionId':_0x2d4c63['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5756('0xb')](function(_0x19ac09){_0x2d4c63['setDataValue'](_0x5756('0xc'),_0x19ac09[_0x5756('0xd')]);ChatInteractionEvents[_0x5756('0xe')](_0x2665fa+':'+_0x2d4c63['id'],_0x2d4c63);ChatInteractionEvents[_0x5756('0xe')](_0x2665fa,_0x2d4c63);_0x5aaa44(null);})['catch'](_0x5aaa44(null));};}for(var e in events){if(events[_0x5756('0xf')](e)){var event=events[e];ChatInteraction[_0x5756('0x10')](e,emitEvent(event));}}module[_0x5756('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0xf651=['Users','map','findAll','unreadMessages','length','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue'];(function(_0x3c5b45,_0x5ec647){var _0x320b6c=function(_0x11ef7b){while(--_0x11ef7b){_0x3c5b45['push'](_0x3c5b45['shift']());}};_0x320b6c(++_0x5ec647);}(_0xf651,0xda));var _0x1f65=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0xf651[_0x4a7631];return _0x1a5a6f;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x1f65('0x0'))['db'][_0x1f65('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x1f65('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x1f65('0x3')](0x0);var events={'afterCreate':_0x1f65('0x4'),'afterUpdate':_0x1f65('0x5'),'afterDestroy':_0x1f65('0x6')};function emitEvent(_0x397bf3){return function(_0x2a0ffd,_0x2e6f0f,_0x2f69af){_0x2a0ffd[_0x1f65('0x7')]({'attributes':['id'],'raw':!![]})[_0x1f65('0x8')](function(_0x4ecc41){_0x2a0ffd[_0x1f65('0x9')](_0x1f65('0xa'),_0x4ecc41[_0x1f65('0xb')](function(_0x191ab5){return{'id':_0x191ab5['id']};}));return ChatMessage[_0x1f65('0xc')]({'where':{'ChatInteractionId':_0x2a0ffd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1f65('0x8')](function(_0x239550){_0x2a0ffd[_0x1f65('0x9')](_0x1f65('0xd'),_0x239550[_0x1f65('0xe')]);ChatInteractionEvents[_0x1f65('0xf')](_0x397bf3+':'+_0x2a0ffd['id'],_0x2a0ffd);ChatInteractionEvents[_0x1f65('0xf')](_0x397bf3,_0x2a0ffd);_0x2f69af(null);})['catch'](_0x2f69af(null));};}for(var e in events){if(events[_0x1f65('0x10')](e)){var event=events[e];ChatInteraction[_0x1f65('0x11')](e,emitEvent(event));}}module[_0x1f65('0x12')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index d3a52b2..94386d1 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 _0x936e=['../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4fb398,_0x5489b4){var _0xbd0d9d=function(_0x18be33){while(--_0x18be33){_0x4fb398['push'](_0x4fb398['shift']());}};_0xbd0d9d(++_0x5489b4);}(_0x936e,0x13c));var _0xe936=function(_0x3c1f0c,_0x46282f){_0x3c1f0c=_0x3c1f0c-0x0;var _0x439f8d=_0x936e[_0x3c1f0c];return _0x439f8d;};'use strict';var _=require(_0xe936('0x0'));var util=require(_0xe936('0x1'));var logger=require(_0xe936('0x2'))(_0xe936('0x3'));var moment=require(_0xe936('0x4'));var BPromise=require(_0xe936('0x5'));var rp=require(_0xe936('0x6'));var fs=require('fs');var path=require(_0xe936('0x7'));var rimraf=require('rimraf');var config=require(_0xe936('0x8'));var attributes=require(_0xe936('0x9'));module[_0xe936('0xa')]=function(_0x46a8c3,_0xaa508e){return _0x46a8c3[_0xe936('0xb')](_0xe936('0xc'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1b501c,_0x4423a8,_0x31091c){if(_0x1b501c[_0xe936('0xd')]('closed')){_0x1b501c[_0xe936('0xe')]=moment()['format'](_0xe936('0xf'));}_0x31091c(null,_0x1b501c);}},'charset':_0xe936('0x10'),'collate':_0xe936('0x11')});}; \ No newline at end of file +var _0x21ec=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci'];(function(_0x23e7af,_0x5b21cd){var _0x13cc88=function(_0x2bd1af){while(--_0x2bd1af){_0x23e7af['push'](_0x23e7af['shift']());}};_0x13cc88(++_0x5b21cd);}(_0x21ec,0xcc));var _0xc21e=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x21ec[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0xc21e('0x0'));var util=require('util');var logger=require(_0xc21e('0x1'))(_0xc21e('0x2'));var moment=require('moment');var BPromise=require(_0xc21e('0x3'));var rp=require(_0xc21e('0x4'));var fs=require('fs');var path=require(_0xc21e('0x5'));var rimraf=require(_0xc21e('0x6'));var config=require(_0xc21e('0x7'));var attributes=require(_0xc21e('0x8'));module[_0xc21e('0x9')]=function(_0x1d2642,_0x2cbc8b){return _0x1d2642['define']('ChatInteraction',attributes,{'tableName':_0xc21e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5066e3,_0x15ab75,_0x5517ea){if(_0x5066e3[_0xc21e('0xb')](_0xc21e('0xc'))){_0x5066e3['closedAt']=moment()[_0xc21e('0xd')](_0xc21e('0xe'));}_0x5517ea(null,_0x5066e3);}},'charset':_0xc21e('0xf'),'collate':_0xc21e('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 6c73248..38cb35c 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 _0x5795=['stringify','AddTagsToChatInteraction','find','addTags','ids','omit','AddTags','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','limit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5795,0xca));var _0x5579=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x5795[_0x456fb1];return _0x4083d6;};'use strict';var _=require(_0x5579('0x0'));var util=require(_0x5579('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5579('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5579('0x3'));var logger=require(_0x5579('0x4'))(_0x5579('0x5'));var config=require(_0x5579('0x6'));var jayson=require(_0x5579('0x7'));var client=jayson[_0x5579('0x8')][_0x5579('0x9')]({'port':0x232a});config[_0x5579('0xa')]=_[_0x5579('0xb')](config[_0x5579('0xa')],{'host':_0x5579('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5579('0xa')]));require(_0x5579('0xd'))['register'](socket);function respondWithRpcPromise(_0xffae19,_0x1ba2d1,_0x3eb971){return new BPromise(function(_0xa39433,_0x2c4473){return client['request'](_0xffae19,_0x3eb971)[_0x5579('0xe')](function(_0x34de3d){logger['info'](_0x5579('0xf'),_0x1ba2d1,_0x5579('0x10'));logger[_0x5579('0x11')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x1ba2d1,_0x5579('0x10'),JSON['stringify'](_0x34de3d));if(_0x34de3d[_0x5579('0x12')]){if(_0x34de3d['error'][_0x5579('0x13')]===0x1f4){logger[_0x5579('0x12')](_0x5579('0xf'),_0x1ba2d1,_0x34de3d['error'][_0x5579('0x14')]);return _0x2c4473(_0x34de3d[_0x5579('0x12')][_0x5579('0x14')]);}logger[_0x5579('0x12')](_0x5579('0xf'),_0x1ba2d1,_0x34de3d['error'][_0x5579('0x14')]);return _0xa39433(_0x34de3d[_0x5579('0x12')]['message']);}else{logger[_0x5579('0x15')](_0x5579('0xf'),_0x1ba2d1,'request\x20sent');_0xa39433(_0x34de3d[_0x5579('0x16')][_0x5579('0x14')]);}})[_0x5579('0x17')](function(_0x55c28a){logger[_0x5579('0x12')](_0x5579('0xf'),_0x1ba2d1,_0x55c28a);_0x2c4473(_0x55c28a);});});}exports[_0x5579('0x18')]=function(_0x567460){var _0x1d5b98=this;return new Promise(function(_0x43feac,_0x56ba2d){return db[_0x5579('0x19')][_0x5579('0x1a')](_0x567460[_0x5579('0x1b')],{'raw':_0x567460[_0x5579('0x1c')]?_0x567460[_0x5579('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x567460[_0x5579('0x1c')]?_0x567460[_0x5579('0x1c')][_0x5579('0x1d')]||null:null,'attributes':_0x567460[_0x5579('0x1c')]?_0x567460['options'][_0x5579('0x1e')]||null:null,'limit':_0x567460['options']?_0x567460['options'][_0x5579('0x1f')]||null:null})[_0x5579('0xe')](function(_0x790df0){logger[_0x5579('0x15')](_0x5579('0x18'),_0x567460);logger[_0x5579('0x11')](_0x5579('0x18'),_0x567460,JSON[_0x5579('0x20')](_0x790df0));_0x43feac(_0x790df0);})[_0x5579('0x17')](function(_0x5b8b19){logger[_0x5579('0x12')](_0x5579('0x18'),_0x5b8b19[_0x5579('0x14')],_0x567460);_0x56ba2d(_0x1d5b98[_0x5579('0x12')](0x1f4,_0x5b8b19[_0x5579('0x14')]));});});};exports[_0x5579('0x21')]=function(_0x408dd2){return new Promise(function(_0x51fca7,_0x5cc9f2){return db[_0x5579('0x19')][_0x5579('0x22')]({'where':_0x408dd2[_0x5579('0x1c')]?_0x408dd2[_0x5579('0x1c')][_0x5579('0x1d')]||null:null})['then'](function(_0x50c73e){if(_0x50c73e){return _0x50c73e[_0x5579('0x23')](_0x408dd2['body'][_0x5579('0x24')],_[_0x5579('0x25')](_0x408dd2[_0x5579('0x1b')],[_0x5579('0x24'),'id'])||{});}})['spread'](function(_0x462dd0){logger[_0x5579('0x15')](_0x5579('0x26'),_0x408dd2);logger[_0x5579('0x11')]('AddTags',_0x408dd2,JSON[_0x5579('0x20')](_0x462dd0));_0x51fca7(_0x462dd0);})['catch'](function(_0x5a108c){logger[_0x5579('0x12')](_0x5579('0x26'),_0x5a108c[_0x5579('0x14')],_0x408dd2);_0x5cc9f2(_this[_0x5579('0x12')](0x1f4,_0x5a108c['message']));});});}; \ No newline at end of file +var _0x2a0c=['redis','defaults','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','limit','catch','AddTagsToChatInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http'];(function(_0x2ddfd9,_0x5877d0){var _0x2668f0=function(_0x70ad6f){while(--_0x70ad6f){_0x2ddfd9['push'](_0x2ddfd9['shift']());}};_0x2668f0(++_0x5877d0);}(_0x2a0c,0x8f));var _0xc2a0=function(_0x10f06b,_0x1577a9){_0x10f06b=_0x10f06b-0x0;var _0x4bbe16=_0x2a0c[_0x10f06b];return _0x4bbe16;};'use strict';var _=require(_0xc2a0('0x0'));var util=require(_0xc2a0('0x1'));var moment=require('moment');var BPromise=require(_0xc2a0('0x2'));var rs=require(_0xc2a0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2a0('0x4'))['db'];var utils=require(_0xc2a0('0x5'));var logger=require(_0xc2a0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc2a0('0x7'));var client=jayson['client'][_0xc2a0('0x8')]({'port':0x232a});config[_0xc2a0('0x9')]=_[_0xc2a0('0xa')](config[_0xc2a0('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc2a0('0xb'))[_0xc2a0('0xc')](socket);function respondWithRpcPromise(_0x56a6f5,_0x49419c,_0x43e5f7){return new BPromise(function(_0x2ac433,_0x58ed8c){return client[_0xc2a0('0xd')](_0x56a6f5,_0x43e5f7)[_0xc2a0('0xe')](function(_0x5ef93b){logger[_0xc2a0('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x49419c,_0xc2a0('0x10'));logger[_0xc2a0('0x11')](_0xc2a0('0x12'),_0x49419c,_0xc2a0('0x10'),JSON[_0xc2a0('0x13')](_0x5ef93b));if(_0x5ef93b['error']){if(_0x5ef93b[_0xc2a0('0x14')]['code']===0x1f4){logger[_0xc2a0('0x14')](_0xc2a0('0x15'),_0x49419c,_0x5ef93b[_0xc2a0('0x14')][_0xc2a0('0x16')]);return _0x58ed8c(_0x5ef93b[_0xc2a0('0x14')]['message']);}logger['error'](_0xc2a0('0x15'),_0x49419c,_0x5ef93b[_0xc2a0('0x14')][_0xc2a0('0x16')]);return _0x2ac433(_0x5ef93b[_0xc2a0('0x14')]['message']);}else{logger[_0xc2a0('0xf')](_0xc2a0('0x15'),_0x49419c,'request\x20sent');_0x2ac433(_0x5ef93b[_0xc2a0('0x17')][_0xc2a0('0x16')]);}})['catch'](function(_0x5e9cf3){logger[_0xc2a0('0x14')](_0xc2a0('0x15'),_0x49419c,_0x5e9cf3);_0x58ed8c(_0x5e9cf3);});});}exports[_0xc2a0('0x18')]=function(_0x4a3078){var _0x5e941f=this;return new Promise(function(_0x2a41c9,_0x46def5){return db[_0xc2a0('0x19')][_0xc2a0('0x1a')](_0x4a3078[_0xc2a0('0x1b')],{'raw':_0x4a3078[_0xc2a0('0x1c')]?_0x4a3078[_0xc2a0('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a3078[_0xc2a0('0x1c')]?_0x4a3078[_0xc2a0('0x1c')]['where']||null:null,'attributes':_0x4a3078[_0xc2a0('0x1c')]?_0x4a3078[_0xc2a0('0x1c')]['attributes']||null:null,'limit':_0x4a3078['options']?_0x4a3078[_0xc2a0('0x1c')][_0xc2a0('0x1d')]||null:null})[_0xc2a0('0xe')](function(_0x2bb047){logger[_0xc2a0('0xf')](_0xc2a0('0x18'),_0x4a3078);logger[_0xc2a0('0x11')](_0xc2a0('0x18'),_0x4a3078,JSON[_0xc2a0('0x13')](_0x2bb047));_0x2a41c9(_0x2bb047);})[_0xc2a0('0x1e')](function(_0x2fb0d3){logger[_0xc2a0('0x14')](_0xc2a0('0x18'),_0x2fb0d3[_0xc2a0('0x16')],_0x4a3078);_0x46def5(_0x5e941f[_0xc2a0('0x14')](0x1f4,_0x2fb0d3[_0xc2a0('0x16')]));});});};exports[_0xc2a0('0x1f')]=function(_0x4783d8){return new Promise(function(_0x3474fd,_0x533d5f){return db['ChatInteraction']['find']({'where':_0x4783d8['options']?_0x4783d8[_0xc2a0('0x1c')][_0xc2a0('0x20')]||null:null})[_0xc2a0('0xe')](function(_0x147b13){if(_0x147b13){return _0x147b13[_0xc2a0('0x21')](_0x4783d8[_0xc2a0('0x1b')][_0xc2a0('0x22')],_[_0xc2a0('0x23')](_0x4783d8[_0xc2a0('0x1b')],[_0xc2a0('0x22'),'id'])||{});}})[_0xc2a0('0x24')](function(_0x37ed67){logger[_0xc2a0('0xf')]('AddTags',_0x4783d8);logger[_0xc2a0('0x11')](_0xc2a0('0x25'),_0x4783d8,JSON[_0xc2a0('0x13')](_0x37ed67));_0x3474fd(_0x37ed67);})[_0xc2a0('0x1e')](function(_0x5b37f7){logger[_0xc2a0('0x14')](_0xc2a0('0x25'),_0x5b37f7[_0xc2a0('0x16')],_0x4783d8);_0x533d5f(_this[_0xc2a0('0x14')](0x1f4,_0x5b37f7[_0xc2a0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 4f85129..3083946 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 _0xecb9=['remove','emit','chatInteraction:'];(function(_0x4e1ecc,_0x4497cf){var _0x5d9775=function(_0x1d09e8){while(--_0x1d09e8){_0x4e1ecc['push'](_0x4e1ecc['shift']());}};_0x5d9775(++_0x4497cf);}(_0xecb9,0x1a1));var _0x9ecb=function(_0x197d72,_0x19b07b){_0x197d72=_0x197d72-0x0;var _0x1e3507=_0xecb9[_0x197d72];return _0x1e3507;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save',_0x9ecb('0x0'),'update'];function createListener(_0x531520,_0x56f1ac){return function(_0x2cfd0d){_0x56f1ac[_0x9ecb('0x1')](_0x531520,_0x2cfd0d);};}function removeListener(_0x416641,_0x5c34dd){return function(){ChatInteractionEvents['removeListener'](_0x416641,_0x5c34dd);};}exports['register']=function(_0x2a4b8d){for(var _0x6060be=0x0,_0x2943b1=events['length'];_0x6060be<_0x2943b1;_0x6060be++){var _0x171d3d=events[_0x6060be];var _0x19caf8=createListener(_0x9ecb('0x2')+_0x171d3d,_0x2a4b8d);ChatInteractionEvents['on'](_0x171d3d,_0x19caf8);}}; \ No newline at end of file +var _0xe87a=['emit','register','save','remove','update'];(function(_0x581249,_0x483f03){var _0x284bae=function(_0x2faadd){while(--_0x2faadd){_0x581249['push'](_0x581249['shift']());}};_0x284bae(++_0x483f03);}(_0xe87a,0xed));var _0xae87=function(_0x1b0766,_0x301091){_0x1b0766=_0x1b0766-0x0;var _0x5c9e6d=_0xe87a[_0x1b0766];return _0x5c9e6d;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xae87('0x0'),_0xae87('0x1'),_0xae87('0x2')];function createListener(_0x4137a0,_0x2a2280){return function(_0x1e1e75){_0x2a2280[_0xae87('0x3')](_0x4137a0,_0x1e1e75);};}function removeListener(_0x4a06f9,_0x1a4b81){return function(){ChatInteractionEvents['removeListener'](_0x4a06f9,_0x1a4b81);};}exports[_0xae87('0x4')]=function(_0x24023c){for(var _0x5d16be=0x0,_0x39bff1=events['length'];_0x5d16be<_0x39bff1;_0x5d16be++){var _0x1f94a0=events[_0x5d16be];var _0x9027ab=createListener('chatInteraction:'+_0x1f94a0,_0x24023c);ChatInteractionEvents['on'](_0x1f94a0,_0x9027ab);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 4fa347a..de79774 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 _0x471b=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','originalname','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','/:id/custom_update','customUpdate','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','connect-timeout','express'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0x471b,0x162));var _0xb471=function(_0x5ac82d,_0xfd75ed){_0x5ac82d=_0x5ac82d-0x0;var _0xf4772f=_0x471b[_0x5ac82d];return _0xf4772f;};'use strict';var multer=require(_0xb471('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb471('0x1'));var express=require(_0xb471('0x2'));var router=express[_0xb471('0x3')]();var fs_extra=require(_0xb471('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb471('0x5'));var config=require(_0xb471('0x6'));var controller=require('./chatInteraction.controller');router[_0xb471('0x7')]('/',auth[_0xb471('0x8')](),controller[_0xb471('0x9')]);router[_0xb471('0x7')](_0xb471('0xa'),auth[_0xb471('0x8')](),controller[_0xb471('0xb')]);router[_0xb471('0x7')](_0xb471('0xc'),auth['isChatInteractionAuthorized'](),controller[_0xb471('0xd')]);router[_0xb471('0x7')](_0xb471('0xe'),auth[_0xb471('0xf')](),controller[_0xb471('0x10')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xb471('0x11')]);router[_0xb471('0x7')](_0xb471('0x12'),auth[_0xb471('0xf')](),controller[_0xb471('0x13')]);router['get'](_0xb471('0x14'),auth[_0xb471('0x8')](),controller[_0xb471('0x15')]);router['post']('/',auth[_0xb471('0x8')](),controller[_0xb471('0x16')]);router[_0xb471('0x17')](_0xb471('0x18'),auth[_0xb471('0x8')](),controller[_0xb471('0x19')]);var upload=multer({'storage':multer[_0xb471('0x1a')]({'destination':function(_0x4e2dae,_0x180018,_0xac1f1d){_0xac1f1d(null,path[_0xb471('0x1b')](config[_0xb471('0x1c')],_0xb471('0x1d')));},'filename':function(_0x5d6618,_0x921f0b,_0x30d299){_0x30d299(null,util[_0xb471('0x1e')](_0xb471('0x1f'),Date['now'](),_0x921f0b[_0xb471('0x20')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xb471('0x21'),upload[_0xb471('0x22')](_0xb471('0x23')),controller[_0xb471('0x24')]);router[_0xb471('0x17')](_0xb471('0x25'),auth['isChatInteractionAuthorized'](),controller[_0xb471('0x26')]);router['post']('/:id/tags',auth[_0xb471('0x8')](),interaction[_0xb471('0x27')](_0xb471('0x28'),_0xb471('0x29')),controller[_0xb471('0x2a')]);router[_0xb471('0x2b')](_0xb471('0xc'),auth[_0xb471('0x8')](),interaction[_0xb471('0x27')](_0xb471('0x28'),'chatinteraction:update'),controller['update']);router[_0xb471('0x2b')](_0xb471('0x2c'),controller[_0xb471('0x2d')]);router[_0xb471('0x2b')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller['abandon']);router['put']('/:id/close',controller['close']);router['delete'](_0xb471('0xc'),auth['isAuthenticated'](),interaction[_0xb471('0x27')](_0xb471('0x28'),_0xb471('0x2e')),controller[_0xb471('0x2f')]);router[_0xb471('0x30')]('/:id/tags',auth[_0xb471('0x8')](),controller[_0xb471('0x31')]);module[_0xb471('0x32')]=router; \ No newline at end of file +var _0x1910=['/:id/tags','tracked','chatinteraction:addtags','addTags','chat','chatinteraction:update','update','put','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','download','post','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x1910,0x11f));var _0x0191=function(_0x13f7fd,_0x588622){_0x13f7fd=_0x13f7fd-0x0;var _0x4cc3e1=_0x1910[_0x13f7fd];return _0x4cc3e1;};'use strict';var multer=require(_0x0191('0x0'));var util=require(_0x0191('0x1'));var path=require(_0x0191('0x2'));var timeout=require(_0x0191('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0191('0x4'));var auth=require(_0x0191('0x5'));var interaction=require(_0x0191('0x6'));var config=require('../../config/environment');var controller=require(_0x0191('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0191('0x8')]);router[_0x0191('0x9')](_0x0191('0xa'),auth[_0x0191('0xb')](),controller[_0x0191('0xc')]);router[_0x0191('0x9')](_0x0191('0xd'),auth[_0x0191('0xe')](),controller[_0x0191('0xf')]);router['get'](_0x0191('0x10'),auth[_0x0191('0xe')](),controller[_0x0191('0x11')]);router[_0x0191('0x9')](_0x0191('0x12'),auth[_0x0191('0xb')](),controller[_0x0191('0x13')]);router[_0x0191('0x9')]('/:id/my_messages',auth[_0x0191('0xe')](),controller['getMyMessages']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x0191('0x14')]);router['post']('/',auth[_0x0191('0xb')](),controller['create']);router[_0x0191('0x15')](_0x0191('0x16'),auth[_0x0191('0xb')](),controller[_0x0191('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x33079a,_0x3e031d,_0x328c1c){_0x328c1c(null,path[_0x0191('0x18')](config[_0x0191('0x19')],_0x0191('0x1a')));},'filename':function(_0x54f433,_0x109e4e,_0x3f8289){_0x3f8289(null,util[_0x0191('0x1b')](_0x0191('0x1c'),Date[_0x0191('0x1d')](),_0x109e4e[_0x0191('0x1e')][_0x0191('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x0191('0x20'),upload[_0x0191('0x21')](_0x0191('0x22')),controller[_0x0191('0x23')]);router[_0x0191('0x15')](_0x0191('0x12'),auth[_0x0191('0xe')](),controller[_0x0191('0x24')]);router['post'](_0x0191('0x25'),auth[_0x0191('0xb')](),interaction[_0x0191('0x26')]('chat',_0x0191('0x27')),controller[_0x0191('0x28')]);router['put'](_0x0191('0xd'),auth[_0x0191('0xb')](),interaction['tracked'](_0x0191('0x29'),_0x0191('0x2a')),controller[_0x0191('0x2b')]);router[_0x0191('0x2c')]('/:id/custom_update',controller[_0x0191('0x2d')]);router[_0x0191('0x2c')](_0x0191('0x2e'),auth[_0x0191('0xe')](),controller[_0x0191('0x2f')]);router[_0x0191('0x2c')](_0x0191('0x30'),controller[_0x0191('0x31')]);router[_0x0191('0x32')](_0x0191('0xd'),auth['isAuthenticated'](),interaction[_0x0191('0x26')](_0x0191('0x29'),_0x0191('0x33')),controller[_0x0191('0x34')]);router[_0x0191('0x32')](_0x0191('0x25'),auth[_0x0191('0xb')](),controller['removeTags']);module[_0x0191('0x35')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 1a5cb9b..b58fd6e 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 _0xaaff=['medium','BOOLEAN','INTEGER','sequelize','exports','TEXT'];(function(_0x535e3d,_0x3011bd){var _0x579e79=function(_0x4fe9ca){while(--_0x4fe9ca){_0x535e3d['push'](_0x535e3d['shift']());}};_0x579e79(++_0x3011bd);}(_0xaaff,0x17d));var _0xfaaf=function(_0x461546,_0x152a89){_0x461546=_0x461546-0x0;var _0xf9e527=_0xaaff[_0x461546];return _0xf9e527;};'use strict';var Sequelize=require(_0xfaaf('0x0'));module[_0xfaaf('0x1')]={'body':{'type':Sequelize[_0xfaaf('0x2')](_0xfaaf('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfaaf('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xfaaf('0x5')]}}; \ No newline at end of file +var _0xc213=['sequelize','exports','INTEGER'];(function(_0x2c6810,_0x23c079){var _0x213881=function(_0x528021){while(--_0x528021){_0x2c6810['push'](_0x2c6810['shift']());}};_0x213881(++_0x23c079);}(_0xc213,0x1b9));var _0x3c21=function(_0x40b579,_0x40a7c2){_0x40b579=_0x40b579-0x0;var _0x74948f=_0xc213[_0x40b579];return _0x74948f;};'use strict';var Sequelize=require(_0x3c21('0x0'));module[_0x3c21('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x3c21('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 87002de..39cd719 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 _0x29a7=['isEmpty','role','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','reject','then','destroy','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','length','create','body','update','find','describe','get','messages','lastMessage','lastMessageAt','format','User','agent','fullname','userpic','internal','online','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x29a7,0xe2));var _0x729a=function(_0x16907f,_0x19c4a1){_0x16907f=_0x16907f-0x0;var _0xdb824=_0x29a7[_0x16907f];return _0xdb824;};'use strict';var emlformat=require(_0x729a('0x0'));var rimraf=require(_0x729a('0x1'));var zipdir=require(_0x729a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x729a('0x3'));var moment=require(_0x729a('0x4'));var BPromise=require(_0x729a('0x5'));var Mustache=require(_0x729a('0x6'));var util=require(_0x729a('0x7'));var path=require(_0x729a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x729a('0x9'));var fs=require('fs');var fs_extra=require(_0x729a('0xa'));var _=require(_0x729a('0xb'));var squel=require(_0x729a('0xc'));var crypto=require('crypto');var jsforce=require(_0x729a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x729a('0xe'));var querystring=require(_0x729a('0xf'));var Papa=require(_0x729a('0x10'));var Redis=require(_0x729a('0x11'));var authService=require(_0x729a('0x12'));var qs=require(_0x729a('0x13'));var as=require(_0x729a('0x14'));var hardwareService=require(_0x729a('0x15'));var logger=require('../../config/logger')(_0x729a('0x16'));var utils=require(_0x729a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x729a('0x18'));var db=require(_0x729a('0x19'))['db'];config[_0x729a('0x1a')]=_[_0x729a('0x1b')](config[_0x729a('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x729a('0x1c'))(new Redis(config[_0x729a('0x1a')]));require(_0x729a('0x1d'))[_0x729a('0x1e')](socket);function respondWithStatusCode(_0x44ecd7,_0x213449){_0x213449=_0x213449||0xcc;return function(_0x510103){if(_0x510103){return _0x44ecd7[_0x729a('0x1f')](_0x213449);}return _0x44ecd7[_0x729a('0x20')](_0x213449)[_0x729a('0x21')]();};}function respondWithResult(_0x3731d5,_0x6fb21a){_0x6fb21a=_0x6fb21a||0xc8;return function(_0x15f07d){if(_0x15f07d){return _0x3731d5[_0x729a('0x20')](_0x6fb21a)[_0x729a('0x22')](_0x15f07d);}};}function respondWithFilteredResult(_0x340ae0,_0x8fd0fe){return function(_0x4a91f8){if(_0x4a91f8){var _0x19e712=typeof _0x8fd0fe['offset']===_0x729a('0x23')&&typeof _0x8fd0fe[_0x729a('0x24')]==='undefined';var _0x53cfc0=_0x4a91f8['count'];var _0x22ad42=_0x19e712?0x0:_0x8fd0fe[_0x729a('0x25')];var _0x222576=_0x19e712?_0x4a91f8[_0x729a('0x26')]:_0x8fd0fe['offset']+_0x8fd0fe['limit'];var _0x4bd896;if(_0x222576>=_0x53cfc0){_0x222576=_0x53cfc0;_0x4bd896=0xc8;}else{_0x4bd896=0xce;}_0x340ae0[_0x729a('0x20')](_0x4bd896);return _0x340ae0['set']('Content-Range',_0x22ad42+'-'+_0x222576+'/'+_0x53cfc0)[_0x729a('0x22')](_0x4a91f8);}return null;};}function patchUpdates(_0x40afbc){return function(_0x4598c3){try{jsonpatch['apply'](_0x4598c3,_0x40afbc,!![]);}catch(_0x4ad2f5){return BPromise[_0x729a('0x27')](_0x4ad2f5);}return _0x4598c3['save']();};}function saveUpdates(_0xc5e1fb,_0x4c2851){return function(_0x37bab6){if(_0x37bab6){return _0x37bab6['update'](_0xc5e1fb)[_0x729a('0x28')](function(_0x254aa3){return _0x254aa3;});}return null;};}function removeEntity(_0x55b275,_0x37f302){return function(_0x10b077){if(_0x10b077){return _0x10b077[_0x729a('0x29')]()[_0x729a('0x28')](function(){_0x55b275[_0x729a('0x20')](0xcc)[_0x729a('0x21')]();});}};}function handleEntityNotFound(_0x556799,_0x169d3f){return function(_0x273b7d){if(!_0x273b7d){_0x556799[_0x729a('0x1f')](0x194);}return _0x273b7d;};}function handleError(_0x1aabfd,_0x8f595a){_0x8f595a=_0x8f595a||0x1f4;return function(_0x1caeb5){logger['error'](_0x1caeb5['stack']);if(_0x1caeb5['name']){delete _0x1caeb5[_0x729a('0x2a')];}_0x1aabfd[_0x729a('0x20')](_0x8f595a)[_0x729a('0x2b')](_0x1caeb5);};}exports[_0x729a('0x2c')]=function(_0x42a654,_0xbcb14){var _0x595b95={},_0x5e5a2c={},_0x264cec={'count':0x0,'rows':[]};var _0x380c9b=_[_0x729a('0x2d')](db[_0x729a('0x2e')][_0x729a('0x2f')],function(_0x53881d){return{'name':_0x53881d[_0x729a('0x30')],'type':_0x53881d[_0x729a('0x31')][_0x729a('0x32')]};});_0x5e5a2c[_0x729a('0x33')]=_[_0x729a('0x2d')](_0x380c9b,'name');_0x5e5a2c[_0x729a('0x34')]=_['keys'](_0x42a654['query']);_0x5e5a2c[_0x729a('0x35')]=_[_0x729a('0x36')](_0x5e5a2c[_0x729a('0x33')],_0x5e5a2c[_0x729a('0x34')]);_0x595b95[_0x729a('0x37')]=_[_0x729a('0x36')](_0x5e5a2c[_0x729a('0x33')],qs[_0x729a('0x38')](_0x42a654[_0x729a('0x34')]['fields']));_0x595b95[_0x729a('0x37')]=_0x595b95[_0x729a('0x37')]['length']?_0x595b95[_0x729a('0x37')]:_0x5e5a2c[_0x729a('0x33')];if(!_0x42a654[_0x729a('0x34')]['hasOwnProperty']('nolimit')){_0x595b95[_0x729a('0x24')]=qs['limit'](_0x42a654[_0x729a('0x34')][_0x729a('0x24')]);_0x595b95[_0x729a('0x25')]=qs[_0x729a('0x25')](_0x42a654[_0x729a('0x34')][_0x729a('0x25')]);}_0x595b95[_0x729a('0x39')]=qs[_0x729a('0x3a')](_0x42a654[_0x729a('0x34')]['sort']);_0x595b95[_0x729a('0x3b')]=qs[_0x729a('0x35')](_[_0x729a('0x3c')](_0x42a654[_0x729a('0x34')],_0x5e5a2c['filters']),_0x380c9b);if(_0x42a654[_0x729a('0x34')][_0x729a('0x3d')]){_0x595b95[_0x729a('0x3b')]=_['merge'](_0x595b95['where'],{'$or':_[_0x729a('0x2d')](_0x380c9b,function(_0x27d522){if(_0x27d522['type']!==_0x729a('0x3e')){var _0x52d59f={};_0x52d59f[_0x27d522[_0x729a('0x2a')]]={'$like':'%'+_0x42a654[_0x729a('0x34')][_0x729a('0x3d')]+'%'};return _0x52d59f;}})});}_0x595b95=_[_0x729a('0x3f')]({},_0x595b95,_0x42a654[_0x729a('0x40')]);var _0x43940d={'where':_0x595b95[_0x729a('0x3b')]};return db[_0x729a('0x2e')][_0x729a('0x26')](_0x43940d)[_0x729a('0x28')](function(_0x47ac17){_0x264cec[_0x729a('0x26')]=_0x47ac17;if(_0x42a654['query'][_0x729a('0x41')]){_0x595b95[_0x729a('0x42')]=[{'all':!![]}];}return db[_0x729a('0x2e')][_0x729a('0x43')](_0x595b95);})[_0x729a('0x28')](function(_0x7b4a60){_0x264cec['rows']=_0x7b4a60;return _0x264cec;})['then'](respondWithFilteredResult(_0xbcb14,_0x595b95))[_0x729a('0x44')](handleError(_0xbcb14,null));};exports[_0x729a('0x45')]=function(_0x33484d,_0x59bedc){var _0x4c85a8={'raw':!![],'where':{'id':_0x33484d[_0x729a('0x46')]['id']}},_0x5ac4cc={};_0x5ac4cc[_0x729a('0x33')]=_[_0x729a('0x47')](db[_0x729a('0x2e')]['rawAttributes']);_0x5ac4cc[_0x729a('0x34')]=_['keys'](_0x33484d[_0x729a('0x34')]);_0x5ac4cc[_0x729a('0x35')]=_[_0x729a('0x36')](_0x5ac4cc[_0x729a('0x33')],_0x5ac4cc[_0x729a('0x34')]);_0x4c85a8[_0x729a('0x37')]=_[_0x729a('0x36')](_0x5ac4cc['model'],qs['fields'](_0x33484d[_0x729a('0x34')][_0x729a('0x38')]));_0x4c85a8[_0x729a('0x37')]=_0x4c85a8[_0x729a('0x37')][_0x729a('0x48')]?_0x4c85a8[_0x729a('0x37')]:_0x5ac4cc['model'];if(_0x33484d[_0x729a('0x34')]['includeAll']){_0x4c85a8[_0x729a('0x42')]=[{'all':!![]}];}_0x4c85a8=_[_0x729a('0x3f')]({},_0x4c85a8,_0x33484d[_0x729a('0x40')]);return db[_0x729a('0x2e')]['find'](_0x4c85a8)[_0x729a('0x28')](handleEntityNotFound(_0x59bedc,null))[_0x729a('0x28')](respondWithResult(_0x59bedc,null))[_0x729a('0x44')](handleError(_0x59bedc,null));};exports[_0x729a('0x49')]=function(_0x190955,_0x24b83f){return db[_0x729a('0x2e')]['create'](_0x190955[_0x729a('0x4a')],{})[_0x729a('0x28')](respondWithResult(_0x24b83f,0xc9))[_0x729a('0x44')](handleError(_0x24b83f,null));};exports[_0x729a('0x4b')]=function(_0x131d97,_0xb8166){if(_0x131d97['body']['id']){delete _0x131d97[_0x729a('0x4a')]['id'];}return db[_0x729a('0x2e')]['find']({'where':{'id':_0x131d97['params']['id']}})['then'](handleEntityNotFound(_0xb8166,null))[_0x729a('0x28')](saveUpdates(_0x131d97[_0x729a('0x4a')],null))[_0x729a('0x28')](respondWithResult(_0xb8166,null))[_0x729a('0x44')](handleError(_0xb8166,null));};exports[_0x729a('0x29')]=function(_0x1163e2,_0x46e10c){return db[_0x729a('0x2e')][_0x729a('0x4c')]({'where':{'id':_0x1163e2[_0x729a('0x46')]['id']}})[_0x729a('0x28')](handleEntityNotFound(_0x46e10c,null))[_0x729a('0x28')](removeEntity(_0x46e10c,null))[_0x729a('0x44')](handleError(_0x46e10c,null));};exports[_0x729a('0x4d')]=function(_0xcb7fac,_0x3ec366){return db[_0x729a('0x2e')][_0x729a('0x4d')]()[_0x729a('0x28')](respondWithResult(_0x3ec366,null))['catch'](handleError(_0x3ec366,null));};function wrapUser(_0x310f42){return function(_0x126a1a){var _0x4c3bc6=_0x310f42[_0x729a('0x4e')]({'plain':!![]});_0x4c3bc6[_0x729a('0x4f')]=[];if(_0x126a1a){_0x4c3bc6['lastMessageAt']=_0x126a1a['createdAt'];_0x4c3bc6[_0x729a('0x50')]=_0x126a1a;}else{_0x4c3bc6[_0x729a('0x51')]=moment(0x0)[_0x729a('0x52')]('YYYY-MM-DD\x20HH:mm:ss');_0x4c3bc6[_0x729a('0x50')]={};}return _0x4c3bc6;};}exports['getUsers']=function(_0x4e1da4,_0x3d8530,_0xacfb2f){var _0x2a02b1=[];return db[_0x729a('0x53')][_0x729a('0x43')]({'where':{'role':[_0x729a('0x54'),'admin','user']},'attributes':['id',_0x729a('0x55'),_0x729a('0x2a'),'role',_0x729a('0x56'),_0x729a('0x57'),_0x729a('0x58'),'lastLoginAt','allowmessenger','showWebBar'],'order':qs[_0x729a('0x3a')](_0x729a('0x59')),'include':[{'model':db[_0x729a('0x5a')],'as':_0x729a('0x5b'),'attributes':['id','name',_0x729a('0x31')],'through':{'attributes':[]}}]})[_0x729a('0x28')](function(_0x2999c5){if(_0x2999c5){var _0x4834b1=_0x4e1da4[_0x729a('0x5c')][_0x729a('0x4e')]({'plain':!![]});if(!_0x4834b1)throw new Error(_0x729a('0x5d'));if(_0x4834b1['role']===_0x729a('0x5c')){return db[_0x729a('0x5e')][_0x729a('0x4c')]({'where':{'name':_0x729a('0x5f'),'userProfileId':_0x4834b1['userProfileId']},'raw':!![]})['then'](function(_0x714d83){if(_0x714d83){if(_0x714d83[_0x729a('0x60')]===0x0){return db[_0x729a('0x61')][_0x729a('0x43')]({'where':{'sectionId':_0x714d83['id']},'raw':!![]})[_0x729a('0x28')](function(_0x31d5ca){var _0xbd206e=[];if(_[_0x729a('0x62')](_0x31d5ca)){_0xbd206e=_[_0x729a('0x3d')](_0x2999c5,function(_0x57af7f){if(_0x57af7f[_0x729a('0x63')]!=='agent'){return _0x57af7f;}});return _0xbd206e;}else{for(var _0x39fe8c=0x0;_0x39fe8c<_0x2999c5['length'];_0x39fe8c++){var _0x3cf450=_0x2999c5[_0x39fe8c];if(_0x3cf450['role']==='agent'){var _0x2f3d8f=_['find'](_0x31d5ca,function(_0x153d19){return _0x153d19[_0x729a('0x64')]===_0x3cf450['id'];});if(_0x2f3d8f)_0xbd206e[_0x729a('0x65')](_0x3cf450);}else{_0xbd206e[_0x729a('0x65')](_0x3cf450);}}return _0xbd206e;}});}else{return _0x2999c5;}}else{var _0x3ff324=_[_0x729a('0x3d')](_0x2999c5,function(_0x38fdbe){if(_0x38fdbe[_0x729a('0x63')]!==_0x729a('0x54')){return _0x38fdbe;}});return _0x3ff324;}});}else{return _0x2999c5;}}})['then'](function(_0x151d2d){var _0x1bac5a=[];if(_0x151d2d){_0x2a02b1=_0x151d2d;for(var _0x90038=0x0;_0x90038<_0x151d2d[_0x729a('0x48')];_0x90038+=0x1){_0x2a02b1[_0x90038][_0x729a('0x4f')]=[];_0x1bac5a['push'](db[_0x729a('0x2e')][_0x729a('0x4c')]({'where':{'FromId':[_0x4e1da4['user']['id'],_0x151d2d[_0x90038]['id']],'ToId':[_0x4e1da4[_0x729a('0x5c')]['id'],_0x151d2d[_0x90038]['id']],'ChatGroupId':null},'attributes':['id',_0x729a('0x66'),_0x729a('0x67'),_0x729a('0x68'),_0x729a('0x69'),_0x729a('0x4a')],'order':qs[_0x729a('0x3a')](_0x729a('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x729a('0x28')](wrapUser(_0x151d2d[_0x90038])));}return BPromise[_0x729a('0x6b')](_0x1bac5a);}return[];})[_0x729a('0x28')](function(_0x408c21){return{'rows':_0x408c21,'count':_0x408c21['length']};})[_0x729a('0x28')](respondWithResult(_0x3d8530,null))[_0x729a('0x44')](handleError(_0x3d8530,null));}; \ No newline at end of file +var _0xe581=['user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','isEmpty','agent','length','resourceId','push','ToId','read','all','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./chatInternalMessage.socket','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','end','sendStatus','error','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','body','destroy','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe581,0x1ce));var _0x1e58=function(_0x239138,_0x5a148c){_0x239138=_0x239138-0x0;var _0x3d4bc0=_0xe581[_0x239138];return _0x3d4bc0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1e58('0x0'));var rp=require(_0x1e58('0x1'));var moment=require(_0x1e58('0x2'));var BPromise=require(_0x1e58('0x3'));var Mustache=require(_0x1e58('0x4'));var util=require(_0x1e58('0x5'));var path=require(_0x1e58('0x6'));var sox=require('sox');var csv=require(_0x1e58('0x7'));var ejs=require(_0x1e58('0x8'));var fs=require('fs');var fs_extra=require(_0x1e58('0x9'));var _=require(_0x1e58('0xa'));var squel=require(_0x1e58('0xb'));var crypto=require(_0x1e58('0xc'));var jsforce=require(_0x1e58('0xd'));var deskjs=require(_0x1e58('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1e58('0xf'));var Papa=require(_0x1e58('0x10'));var Redis=require(_0x1e58('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1e58('0x12'));var as=require(_0x1e58('0x13'));var hardwareService=require(_0x1e58('0x14'));var logger=require('../../config/logger')(_0x1e58('0x15'));var utils=require(_0x1e58('0x16'));var config=require(_0x1e58('0x17'));var licenseUtil=require(_0x1e58('0x18'));var db=require('../../mysqldb')['db'];config[_0x1e58('0x19')]=_[_0x1e58('0x1a')](config[_0x1e58('0x19')],{'host':_0x1e58('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e58('0x19')]));require(_0x1e58('0x1c'))['register'](socket);function respondWithStatusCode(_0x27bd1b,_0x4b9bfd){_0x4b9bfd=_0x4b9bfd||0xcc;return function(_0x1fb41c){if(_0x1fb41c){return _0x27bd1b['sendStatus'](_0x4b9bfd);}return _0x27bd1b['status'](_0x4b9bfd)['end']();};}function respondWithResult(_0x3a21a0,_0x4e19d0){_0x4e19d0=_0x4e19d0||0xc8;return function(_0x24f483){if(_0x24f483){return _0x3a21a0[_0x1e58('0x1d')](_0x4e19d0)[_0x1e58('0x1e')](_0x24f483);}};}function respondWithFilteredResult(_0xdb2f21,_0x5e9e29){return function(_0x3c6917){if(_0x3c6917){var _0x46f63c=typeof _0x5e9e29[_0x1e58('0x1f')]===_0x1e58('0x20')&&typeof _0x5e9e29['limit']===_0x1e58('0x20');var _0x33e199=_0x3c6917[_0x1e58('0x21')];var _0xf1d021=_0x46f63c?0x0:_0x5e9e29[_0x1e58('0x1f')];var _0x54c9aa=_0x46f63c?_0x3c6917['count']:_0x5e9e29[_0x1e58('0x1f')]+_0x5e9e29['limit'];var _0x35b52c;if(_0x54c9aa>=_0x33e199){_0x54c9aa=_0x33e199;_0x35b52c=0xc8;}else{_0x35b52c=0xce;}_0xdb2f21[_0x1e58('0x1d')](_0x35b52c);return _0xdb2f21[_0x1e58('0x22')](_0x1e58('0x23'),_0xf1d021+'-'+_0x54c9aa+'/'+_0x33e199)[_0x1e58('0x1e')](_0x3c6917);}return null;};}function patchUpdates(_0x3ac9bb){return function(_0x337ef5){try{jsonpatch[_0x1e58('0x24')](_0x337ef5,_0x3ac9bb,!![]);}catch(_0x3b3b78){return BPromise[_0x1e58('0x25')](_0x3b3b78);}return _0x337ef5[_0x1e58('0x26')]();};}function saveUpdates(_0x42836c,_0x82381f){return function(_0x4a8153){if(_0x4a8153){return _0x4a8153['update'](_0x42836c)[_0x1e58('0x27')](function(_0x26164a){return _0x26164a;});}return null;};}function removeEntity(_0xc55464,_0x303dbf){return function(_0xd33f68){if(_0xd33f68){return _0xd33f68['destroy']()['then'](function(){_0xc55464[_0x1e58('0x1d')](0xcc)[_0x1e58('0x28')]();});}};}function handleEntityNotFound(_0x1f2f38,_0x292b2e){return function(_0x1065a4){if(!_0x1065a4){_0x1f2f38[_0x1e58('0x29')](0x194);}return _0x1065a4;};}function handleError(_0x57ebf6,_0x21deed){_0x21deed=_0x21deed||0x1f4;return function(_0x4c0088){logger[_0x1e58('0x2a')](_0x4c0088['stack']);if(_0x4c0088[_0x1e58('0x2b')]){delete _0x4c0088[_0x1e58('0x2b')];}_0x57ebf6[_0x1e58('0x1d')](_0x21deed)['send'](_0x4c0088);};}exports[_0x1e58('0x2c')]=function(_0x56a9cc,_0x3e5238){var _0x45fca0={},_0x5f8f5={},_0xd86e24={'count':0x0,'rows':[]};var _0x2dd474=_[_0x1e58('0x2d')](db[_0x1e58('0x2e')][_0x1e58('0x2f')],function(_0x1ae26f){return{'name':_0x1ae26f[_0x1e58('0x30')],'type':_0x1ae26f[_0x1e58('0x31')][_0x1e58('0x32')]};});_0x5f8f5[_0x1e58('0x33')]=_[_0x1e58('0x2d')](_0x2dd474,_0x1e58('0x2b'));_0x5f8f5[_0x1e58('0x34')]=_[_0x1e58('0x35')](_0x56a9cc[_0x1e58('0x34')]);_0x5f8f5[_0x1e58('0x36')]=_[_0x1e58('0x37')](_0x5f8f5[_0x1e58('0x33')],_0x5f8f5[_0x1e58('0x34')]);_0x45fca0[_0x1e58('0x38')]=_['intersection'](_0x5f8f5[_0x1e58('0x33')],qs[_0x1e58('0x39')](_0x56a9cc[_0x1e58('0x34')]['fields']));_0x45fca0['attributes']=_0x45fca0[_0x1e58('0x38')]['length']?_0x45fca0[_0x1e58('0x38')]:_0x5f8f5['model'];if(!_0x56a9cc[_0x1e58('0x34')]['hasOwnProperty'](_0x1e58('0x3a'))){_0x45fca0[_0x1e58('0x3b')]=qs['limit'](_0x56a9cc[_0x1e58('0x34')][_0x1e58('0x3b')]);_0x45fca0['offset']=qs[_0x1e58('0x1f')](_0x56a9cc[_0x1e58('0x34')]['offset']);}_0x45fca0['order']=qs[_0x1e58('0x3c')](_0x56a9cc['query'][_0x1e58('0x3c')]);_0x45fca0[_0x1e58('0x3d')]=qs[_0x1e58('0x36')](_[_0x1e58('0x3e')](_0x56a9cc['query'],_0x5f8f5[_0x1e58('0x36')]),_0x2dd474);if(_0x56a9cc[_0x1e58('0x34')]['filter']){_0x45fca0[_0x1e58('0x3d')]=_[_0x1e58('0x3f')](_0x45fca0['where'],{'$or':_[_0x1e58('0x2d')](_0x2dd474,function(_0x51e82e){if(_0x51e82e['type']!==_0x1e58('0x40')){var _0x3543b5={};_0x3543b5[_0x51e82e[_0x1e58('0x2b')]]={'$like':'%'+_0x56a9cc[_0x1e58('0x34')][_0x1e58('0x41')]+'%'};return _0x3543b5;}})});}_0x45fca0=_['merge']({},_0x45fca0,_0x56a9cc['options']);var _0x274d03={'where':_0x45fca0[_0x1e58('0x3d')]};return db['ChatInternalMessage'][_0x1e58('0x21')](_0x274d03)[_0x1e58('0x27')](function(_0x438654){_0xd86e24[_0x1e58('0x21')]=_0x438654;if(_0x56a9cc[_0x1e58('0x34')][_0x1e58('0x42')]){_0x45fca0[_0x1e58('0x43')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x1e58('0x44')](_0x45fca0);})[_0x1e58('0x27')](function(_0x362064){_0xd86e24[_0x1e58('0x45')]=_0x362064;return _0xd86e24;})['then'](respondWithFilteredResult(_0x3e5238,_0x45fca0))[_0x1e58('0x46')](handleError(_0x3e5238,null));};exports[_0x1e58('0x47')]=function(_0x118f14,_0x57ce60){var _0x3939af={'raw':!![],'where':{'id':_0x118f14[_0x1e58('0x48')]['id']}},_0x52bbd2={};_0x52bbd2['model']=_[_0x1e58('0x35')](db[_0x1e58('0x2e')]['rawAttributes']);_0x52bbd2[_0x1e58('0x34')]=_[_0x1e58('0x35')](_0x118f14[_0x1e58('0x34')]);_0x52bbd2['filters']=_[_0x1e58('0x37')](_0x52bbd2[_0x1e58('0x33')],_0x52bbd2[_0x1e58('0x34')]);_0x3939af[_0x1e58('0x38')]=_['intersection'](_0x52bbd2[_0x1e58('0x33')],qs['fields'](_0x118f14[_0x1e58('0x34')][_0x1e58('0x39')]));_0x3939af[_0x1e58('0x38')]=_0x3939af[_0x1e58('0x38')]['length']?_0x3939af[_0x1e58('0x38')]:_0x52bbd2[_0x1e58('0x33')];if(_0x118f14[_0x1e58('0x34')]['includeAll']){_0x3939af['include']=[{'all':!![]}];}_0x3939af=_['merge']({},_0x3939af,_0x118f14[_0x1e58('0x49')]);return db[_0x1e58('0x2e')][_0x1e58('0x4a')](_0x3939af)[_0x1e58('0x27')](handleEntityNotFound(_0x57ce60,null))[_0x1e58('0x27')](respondWithResult(_0x57ce60,null))[_0x1e58('0x46')](handleError(_0x57ce60,null));};exports['create']=function(_0x3f661e,_0x18712c){return db[_0x1e58('0x2e')]['create'](_0x3f661e['body'],{})['then'](respondWithResult(_0x18712c,0xc9))[_0x1e58('0x46')](handleError(_0x18712c,null));};exports['update']=function(_0x60c2cf,_0x3f23e2){if(_0x60c2cf[_0x1e58('0x4b')]['id']){delete _0x60c2cf[_0x1e58('0x4b')]['id'];}return db[_0x1e58('0x2e')][_0x1e58('0x4a')]({'where':{'id':_0x60c2cf[_0x1e58('0x48')]['id']}})[_0x1e58('0x27')](handleEntityNotFound(_0x3f23e2,null))['then'](saveUpdates(_0x60c2cf[_0x1e58('0x4b')],null))[_0x1e58('0x27')](respondWithResult(_0x3f23e2,null))[_0x1e58('0x46')](handleError(_0x3f23e2,null));};exports[_0x1e58('0x4c')]=function(_0x457895,_0x53908d){return db['ChatInternalMessage'][_0x1e58('0x4a')]({'where':{'id':_0x457895['params']['id']}})[_0x1e58('0x27')](handleEntityNotFound(_0x53908d,null))['then'](removeEntity(_0x53908d,null))[_0x1e58('0x46')](handleError(_0x53908d,null));};exports[_0x1e58('0x4d')]=function(_0x3a7721,_0x202526){return db[_0x1e58('0x2e')][_0x1e58('0x4d')]()[_0x1e58('0x27')](respondWithResult(_0x202526,null))[_0x1e58('0x46')](handleError(_0x202526,null));};function wrapUser(_0x37c11b){return function(_0x578d50){var _0x6d08b1=_0x37c11b[_0x1e58('0x4e')]({'plain':!![]});_0x6d08b1[_0x1e58('0x4f')]=[];if(_0x578d50){_0x6d08b1[_0x1e58('0x50')]=_0x578d50[_0x1e58('0x51')];_0x6d08b1[_0x1e58('0x52')]=_0x578d50;}else{_0x6d08b1['lastMessageAt']=moment(0x0)[_0x1e58('0x53')](_0x1e58('0x54'));_0x6d08b1[_0x1e58('0x52')]={};}return _0x6d08b1;};}exports[_0x1e58('0x55')]=function(_0xc9efdf,_0x45907a,_0x43faa6){var _0x1df66f=[];return db[_0x1e58('0x56')]['findAll']({'where':{'role':['agent',_0x1e58('0x57'),_0x1e58('0x58')]},'attributes':['id',_0x1e58('0x59'),'name',_0x1e58('0x5a'),_0x1e58('0x5b'),_0x1e58('0x5c'),'online',_0x1e58('0x5d'),_0x1e58('0x5e'),_0x1e58('0x5f')],'order':qs[_0x1e58('0x3c')](_0x1e58('0x60')),'include':[{'model':db[_0x1e58('0x61')],'as':_0x1e58('0x62'),'attributes':['id',_0x1e58('0x2b'),'type'],'through':{'attributes':[]}}]})[_0x1e58('0x27')](function(_0x40f8a2){if(_0x40f8a2){var _0x397679=_0xc9efdf['user'][_0x1e58('0x4e')]({'plain':!![]});if(!_0x397679)throw new Error(_0x1e58('0x63'));if(_0x397679[_0x1e58('0x5a')]===_0x1e58('0x58')){return db['UserProfileSection'][_0x1e58('0x4a')]({'where':{'name':'Agents','userProfileId':_0x397679[_0x1e58('0x64')]},'raw':!![]})[_0x1e58('0x27')](function(_0x214a93){if(_0x214a93){if(_0x214a93[_0x1e58('0x65')]===0x0){return db['UserProfileResource'][_0x1e58('0x44')]({'where':{'sectionId':_0x214a93['id']},'raw':!![]})['then'](function(_0x564765){var _0x12cfd0=[];if(_[_0x1e58('0x66')](_0x564765)){_0x12cfd0=_[_0x1e58('0x41')](_0x40f8a2,function(_0x24d1e9){if(_0x24d1e9[_0x1e58('0x5a')]!==_0x1e58('0x67')){return _0x24d1e9;}});return _0x12cfd0;}else{for(var _0x45795b=0x0;_0x45795b<_0x40f8a2[_0x1e58('0x68')];_0x45795b++){var _0x29e054=_0x40f8a2[_0x45795b];if(_0x29e054['role']==='agent'){var _0x458523=_[_0x1e58('0x4a')](_0x564765,function(_0x285891){return _0x285891[_0x1e58('0x69')]===_0x29e054['id'];});if(_0x458523)_0x12cfd0[_0x1e58('0x6a')](_0x29e054);}else{_0x12cfd0[_0x1e58('0x6a')](_0x29e054);}}return _0x12cfd0;}});}else{return _0x40f8a2;}}else{var _0x331cb2=_['filter'](_0x40f8a2,function(_0x34b2e9){if(_0x34b2e9['role']!==_0x1e58('0x67')){return _0x34b2e9;}});return _0x331cb2;}});}else{return _0x40f8a2;}}})[_0x1e58('0x27')](function(_0x3df5a7){var _0x244148=[];if(_0x3df5a7){_0x1df66f=_0x3df5a7;for(var _0x1093c8=0x0;_0x1093c8<_0x3df5a7[_0x1e58('0x68')];_0x1093c8+=0x1){_0x1df66f[_0x1093c8]['messages']=[];_0x244148['push'](db['ChatInternalMessage'][_0x1e58('0x4a')]({'where':{'FromId':[_0xc9efdf[_0x1e58('0x58')]['id'],_0x3df5a7[_0x1093c8]['id']],'ToId':[_0xc9efdf['user']['id'],_0x3df5a7[_0x1093c8]['id']],'ChatGroupId':null},'attributes':['id',_0x1e58('0x51'),'FromId',_0x1e58('0x6b'),_0x1e58('0x6c'),_0x1e58('0x4b')],'order':qs[_0x1e58('0x3c')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x1e58('0x27')](wrapUser(_0x3df5a7[_0x1093c8])));}return BPromise[_0x1e58('0x6d')](_0x244148);}return[];})[_0x1e58('0x27')](function(_0x1f7ed2){return{'rows':_0x1f7ed2,'count':_0x1f7ed2[_0x1e58('0x68')]};})[_0x1e58('0x27')](respondWithResult(_0x45907a,null))[_0x1e58('0x46')](handleError(_0x45907a,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 5d33ece..a1dc96d 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 _0x7ef1=['../../mysqldb','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x46401e,_0x2a345b){var _0x447cba=function(_0x54ea97){while(--_0x54ea97){_0x46401e['push'](_0x46401e['shift']());}};_0x447cba(++_0x2a345b);}(_0x7ef1,0x77));var _0x17ef=function(_0x288b2f,_0x44f22){_0x288b2f=_0x288b2f-0x0;var _0x1878b0=_0x7ef1[_0x288b2f];return _0x1878b0;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x17ef('0x0'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x17ef('0x1'),'afterUpdate':'update','afterDestroy':_0x17ef('0x2')};function emitEvent(_0x26168b){return function(_0x5b2bf1,_0x36efed,_0x2f3099){ChatInternalMessageEvents['emit'](_0x26168b+':'+_0x5b2bf1['id'],_0x5b2bf1);ChatInternalMessageEvents[_0x17ef('0x3')](_0x26168b,_0x5b2bf1);_0x2f3099(null);};}for(var e in events){if(events[_0x17ef('0x4')](e)){var event=events[e];ChatInternalMessage[_0x17ef('0x5')](e,emitEvent(event));}}module[_0x17ef('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xe172=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x49a1a0,_0x48f776){var _0x518a4f=function(_0x313633){while(--_0x313633){_0x49a1a0['push'](_0x49a1a0['shift']());}};_0x518a4f(++_0x48f776);}(_0xe172,0x1bb));var _0x2e17=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xe172[_0x4ed520];return _0x4415a6;};'use strict';var EventEmitter=require(_0x2e17('0x0'));var ChatInternalMessage=require(_0x2e17('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x2e17('0x2')](0x0);var events={'afterCreate':_0x2e17('0x3'),'afterUpdate':'update','afterDestroy':_0x2e17('0x4')};function emitEvent(_0x54ee5c){return function(_0x587c6c,_0x3faebc,_0x16660e){ChatInternalMessageEvents['emit'](_0x54ee5c+':'+_0x587c6c['id'],_0x587c6c);ChatInternalMessageEvents['emit'](_0x54ee5c,_0x587c6c);_0x16660e(null);};}for(var e in events){if(events[_0x2e17('0x5')](e)){var event=events[e];ChatInternalMessage[_0x2e17('0x6')](e,emitEvent(event));}}module[_0x2e17('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 4dc7ad4..33a04df 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 _0x2467=['../../config/environment','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0x2467,0x1f1));var _0x7246=function(_0x38340c,_0x48dc0f){_0x38340c=_0x38340c-0x0;var _0x2a61c6=_0x2467[_0x38340c];return _0x2a61c6;};'use strict';var _=require(_0x7246('0x0'));var util=require('util');var logger=require(_0x7246('0x1'))(_0x7246('0x2'));var moment=require(_0x7246('0x3'));var BPromise=require('bluebird');var rp=require(_0x7246('0x4'));var fs=require('fs');var path=require(_0x7246('0x5'));var rimraf=require(_0x7246('0x6'));var config=require(_0x7246('0x7'));var attributes=require('./chatInternalMessage.attributes');module[_0x7246('0x8')]=function(_0x136f6b,_0x25d075){return _0x136f6b['define'](_0x7246('0x9'),attributes,{'tableName':_0x7246('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7246('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa5d5=['exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes'];(function(_0x479387,_0xdea27f){var _0x3436d0=function(_0x66122c){while(--_0x66122c){_0x479387['push'](_0x479387['shift']());}};_0x3436d0(++_0xdea27f);}(_0xa5d5,0x8c));var _0x5a5d=function(_0x1dd2c8,_0x41f6af){_0x1dd2c8=_0x1dd2c8-0x0;var _0x273958=_0xa5d5[_0x1dd2c8];return _0x273958;};'use strict';var _=require(_0x5a5d('0x0'));var util=require(_0x5a5d('0x1'));var logger=require(_0x5a5d('0x2'))(_0x5a5d('0x3'));var moment=require(_0x5a5d('0x4'));var BPromise=require(_0x5a5d('0x5'));var rp=require(_0x5a5d('0x6'));var fs=require('fs');var path=require(_0x5a5d('0x7'));var rimraf=require('rimraf');var config=require(_0x5a5d('0x8'));var attributes=require(_0x5a5d('0x9'));module[_0x5a5d('0xa')]=function(_0x47277f,_0x17b48a){return _0x47277f[_0x5a5d('0xb')](_0x5a5d('0xc'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5a5d('0xd'),'collate':_0x5a5d('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index cd28818..07f0de2 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 _0x1326=['info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then'];(function(_0x345307,_0x11b6f3){var _0x1e07a7=function(_0x76bed3){while(--_0x76bed3){_0x345307['push'](_0x345307['shift']());}};_0x1e07a7(++_0x11b6f3);}(_0x1326,0xdd));var _0x6132=function(_0x3c79d1,_0x1e55d4){_0x3c79d1=_0x3c79d1-0x0;var _0x1646e8=_0x1326[_0x3c79d1];return _0x1646e8;};'use strict';var _=require(_0x6132('0x0'));var util=require(_0x6132('0x1'));var moment=require('moment');var BPromise=require(_0x6132('0x2'));var rs=require(_0x6132('0x3'));var fs=require('fs');var Redis=require(_0x6132('0x4'));var db=require(_0x6132('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6132('0x6'))(_0x6132('0x7'));var config=require('../../config/environment');var jayson=require(_0x6132('0x8'));var client=jayson[_0x6132('0x9')][_0x6132('0xa')]({'port':0x232a});config[_0x6132('0xb')]=_[_0x6132('0xc')](config[_0x6132('0xb')],{'host':_0x6132('0xd'),'port':0x18eb});var socket=require(_0x6132('0xe'))(new Redis(config[_0x6132('0xb')]));require(_0x6132('0xf'))[_0x6132('0x10')](socket);function respondWithRpcPromise(_0x597779,_0x28ef8c,_0x3ff862){return new BPromise(function(_0x3ae7c6,_0x287a3c){return client[_0x6132('0x11')](_0x597779,_0x3ff862)[_0x6132('0x12')](function(_0x192f7d){logger[_0x6132('0x13')](_0x6132('0x14'),_0x28ef8c,_0x6132('0x15'));logger[_0x6132('0x16')](_0x6132('0x17'),_0x28ef8c,_0x6132('0x15'),JSON[_0x6132('0x18')](_0x192f7d));if(_0x192f7d[_0x6132('0x19')]){if(_0x192f7d['error'][_0x6132('0x1a')]===0x1f4){logger[_0x6132('0x19')](_0x6132('0x14'),_0x28ef8c,_0x192f7d[_0x6132('0x19')][_0x6132('0x1b')]);return _0x287a3c(_0x192f7d[_0x6132('0x19')]['message']);}logger[_0x6132('0x19')](_0x6132('0x14'),_0x28ef8c,_0x192f7d[_0x6132('0x19')][_0x6132('0x1b')]);return _0x3ae7c6(_0x192f7d[_0x6132('0x19')]['message']);}else{logger['info'](_0x6132('0x14'),_0x28ef8c,'request\x20sent');_0x3ae7c6(_0x192f7d[_0x6132('0x1c')][_0x6132('0x1b')]);}})[_0x6132('0x1d')](function(_0x23ce6a){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x28ef8c,_0x23ce6a);_0x287a3c(_0x23ce6a);});});} \ No newline at end of file +var _0x7113=['./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','redis','localhost','socket.io-emitter'];(function(_0x1af415,_0x443c14){var _0x5158b3=function(_0x5df2a4){while(--_0x5df2a4){_0x1af415['push'](_0x1af415['shift']());}};_0x5158b3(++_0x443c14);}(_0x7113,0xc4));var _0x3711=function(_0x190c3f,_0x4940ba){_0x190c3f=_0x190c3f-0x0;var _0x102596=_0x7113[_0x190c3f];return _0x102596;};'use strict';var _=require(_0x3711('0x0'));var util=require(_0x3711('0x1'));var moment=require(_0x3711('0x2'));var BPromise=require(_0x3711('0x3'));var rs=require(_0x3711('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3711('0x5'))['db'];var utils=require(_0x3711('0x6'));var logger=require(_0x3711('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3711('0x8')]['http']({'port':0x232a});config[_0x3711('0x9')]=_['defaults'](config[_0x3711('0x9')],{'host':_0x3711('0xa'),'port':0x18eb});var socket=require(_0x3711('0xb'))(new Redis(config['redis']));require(_0x3711('0xc'))[_0x3711('0xd')](socket);function respondWithRpcPromise(_0xd6c2e,_0x5b9776,_0x629bf3){return new BPromise(function(_0x119a8f,_0x42f887){return client[_0x3711('0xe')](_0xd6c2e,_0x629bf3)[_0x3711('0xf')](function(_0x569cf3){logger[_0x3711('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x5b9776,_0x3711('0x11'));logger[_0x3711('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x5b9776,_0x3711('0x11'),JSON[_0x3711('0x13')](_0x569cf3));if(_0x569cf3[_0x3711('0x14')]){if(_0x569cf3['error'][_0x3711('0x15')]===0x1f4){logger[_0x3711('0x14')](_0x3711('0x16'),_0x5b9776,_0x569cf3[_0x3711('0x14')][_0x3711('0x17')]);return _0x42f887(_0x569cf3[_0x3711('0x14')]['message']);}logger['error'](_0x3711('0x16'),_0x5b9776,_0x569cf3[_0x3711('0x14')][_0x3711('0x17')]);return _0x119a8f(_0x569cf3['error']['message']);}else{logger[_0x3711('0x10')](_0x3711('0x16'),_0x5b9776,_0x3711('0x11'));_0x119a8f(_0x569cf3[_0x3711('0x18')][_0x3711('0x17')]);}})[_0x3711('0x19')](function(_0x92b0af){logger[_0x3711('0x14')](_0x3711('0x16'),_0x5b9776,_0x92b0af);_0x42f887(_0x92b0af);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index b758dec..0d0c004 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 _0x9b7e=['remove','update','register','length','save'];(function(_0x2e3dfc,_0x454d6c){var _0x4b1245=function(_0x5e9faa){while(--_0x5e9faa){_0x2e3dfc['push'](_0x2e3dfc['shift']());}};_0x4b1245(++_0x454d6c);}(_0x9b7e,0x7c));var _0xe9b7=function(_0x4f9522,_0x399e9f){_0x4f9522=_0x4f9522-0x0;var _0x5a89a7=_0x9b7e[_0x4f9522];return _0x5a89a7;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xe9b7('0x0'),_0xe9b7('0x1'),_0xe9b7('0x2')];function createListener(_0x43701a,_0x53d265){return function(_0x5b143a){_0x53d265['emit'](_0x43701a,_0x5b143a);};}function removeListener(_0x42b3b1,_0x262640){return function(){ChatInternalMessageEvents['removeListener'](_0x42b3b1,_0x262640);};}exports[_0xe9b7('0x3')]=function(_0xed2ff7){for(var _0x297bc3=0x0,_0x458746=events[_0xe9b7('0x4')];_0x297bc3<_0x458746;_0x297bc3++){var _0x26415f=events[_0x297bc3];var _0x4271cf=createListener('chatInternalMessage:'+_0x26415f,_0xed2ff7);ChatInternalMessageEvents['on'](_0x26415f,_0x4271cf);}}; \ No newline at end of file +var _0x9b93=['emit','removeListener','register','length','save','remove'];(function(_0x2a5541,_0x1324c3){var _0x54fd9e=function(_0x5f0142){while(--_0x5f0142){_0x2a5541['push'](_0x2a5541['shift']());}};_0x54fd9e(++_0x1324c3);}(_0x9b93,0x6a));var _0x39b9=function(_0x34756e,_0x3c036a){_0x34756e=_0x34756e-0x0;var _0x365e63=_0x9b93[_0x34756e];return _0x365e63;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x39b9('0x0'),_0x39b9('0x1'),'update'];function createListener(_0x5decfb,_0xfc63e0){return function(_0x2e6d68){_0xfc63e0[_0x39b9('0x2')](_0x5decfb,_0x2e6d68);};}function removeListener(_0x25b254,_0x3128b8){return function(){ChatInternalMessageEvents[_0x39b9('0x3')](_0x25b254,_0x3128b8);};}exports[_0x39b9('0x4')]=function(_0x52df16){for(var _0x23a22a=0x0,_0x4df9e3=events[_0x39b9('0x5')];_0x23a22a<_0x4df9e3;_0x23a22a++){var _0x123ba7=events[_0x23a22a];var _0x27fd29=createListener('chatInternalMessage:'+_0x123ba7,_0x52df16);ChatInternalMessageEvents['on'](_0x123ba7,_0x27fd29);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 007c86e..53eb885 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 _0x6008=['/:id','update','util','connect-timeout','express','Router','fs-extra','../../config/environment','get','/describe','isAuthenticated','create','put'];(function(_0xe12b7c,_0x2ed104){var _0x4a26a6=function(_0x2b518d){while(--_0x2b518d){_0xe12b7c['push'](_0xe12b7c['shift']());}};_0x4a26a6(++_0x2ed104);}(_0x6008,0x84));var _0x8600=function(_0x5d1561,_0xbf681b){_0x5d1561=_0x5d1561-0x0;var _0x5222f4=_0x6008[_0x5d1561];return _0x5222f4;};'use strict';var multer=require('multer');var util=require(_0x8600('0x0'));var path=require('path');var timeout=require(_0x8600('0x1'));var express=require(_0x8600('0x2'));var router=express[_0x8600('0x3')]();var fs_extra=require(_0x8600('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8600('0x5'));var controller=require('./chatInternalMessage.controller');router[_0x8600('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8600('0x6')](_0x8600('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0x8600('0x6')]('/users',auth[_0x8600('0x8')](),controller['getUsers']);router[_0x8600('0x6')]('/:id',auth[_0x8600('0x8')](),controller['show']);router['post']('/',auth[_0x8600('0x8')](),controller[_0x8600('0x9')]);router[_0x8600('0xa')](_0x8600('0xb'),controller[_0x8600('0xc')]);router['delete'](_0x8600('0xb'),auth[_0x8600('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8c60=['./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8c60,0x160));var _0x08c6=function(_0x332aa9,_0x459f15){_0x332aa9=_0x332aa9-0x0;var _0x27c859=_0x8c60[_0x332aa9];return _0x27c859;};'use strict';var multer=require('multer');var util=require(_0x08c6('0x0'));var path=require('path');var timeout=require(_0x08c6('0x1'));var express=require(_0x08c6('0x2'));var router=express[_0x08c6('0x3')]();var fs_extra=require(_0x08c6('0x4'));var auth=require(_0x08c6('0x5'));var interaction=require(_0x08c6('0x6'));var config=require(_0x08c6('0x7'));var controller=require(_0x08c6('0x8'));router[_0x08c6('0x9')]('/',auth[_0x08c6('0xa')](),controller[_0x08c6('0xb')]);router['get'](_0x08c6('0xc'),auth[_0x08c6('0xa')](),controller[_0x08c6('0xd')]);router[_0x08c6('0x9')](_0x08c6('0xe'),auth[_0x08c6('0xa')](),controller[_0x08c6('0xf')]);router['get'](_0x08c6('0x10'),auth[_0x08c6('0xa')](),controller['show']);router[_0x08c6('0x11')]('/',auth[_0x08c6('0xa')](),controller[_0x08c6('0x12')]);router[_0x08c6('0x13')](_0x08c6('0x10'),controller[_0x08c6('0x14')]);router[_0x08c6('0x15')]('/:id',auth[_0x08c6('0xa')](),controller[_0x08c6('0x16')]);module[_0x08c6('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 1f31dc5..a972325 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 _0x065e=['ENUM','DATE','STRING','sequelize','BOOLEAN'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x065e,0x1a7));var _0xe065=function(_0x398226,_0x4b5eae){_0x398226=_0x398226-0x0;var _0x280539=_0x065e[_0x398226];return _0x280539;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe065('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe065('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe065('0x2')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xe065('0x3')]},'providerName':{'type':Sequelize[_0xe065('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xfd6f=['medium','BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x506e7d,_0x423164){var _0x425c72=function(_0x24ac91){while(--_0x24ac91){_0x506e7d['push'](_0x506e7d['shift']());}};_0x425c72(++_0x423164);}(_0xfd6f,0x19d));var _0xffd6=function(_0x5e30f1,_0x37c142){_0x5e30f1=_0x5e30f1-0x0;var _0x10cb2d=_0xfd6f[_0x5e30f1];return _0x10cb2d;};'use strict';var Sequelize=require(_0xffd6('0x0'));module[_0xffd6('0x1')]={'body':{'type':Sequelize[_0xffd6('0x2')](_0xffd6('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xffd6('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xffd6('0x5')]('in',_0xffd6('0x6')),'defaultValue':_0xffd6('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xffd6('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xffd6('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8e64b77..5e0e9eb 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 _0xab13=['user','agent','get','ChatInteractionId','isNil','read1stAt','format','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','email','internal','manual','channel','motionChannel','event','EventManager','acceptmessage','merge','parse','formData','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','Sequelize','fullname','interface','SIP/%s','rejectmessage','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','ChatMessage','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','options','include','findAll','params','keys','includeAll','find','create','body','describe','chat-interactions','accept','chat','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab13,0x1b4));var _0x3ab1=function(_0x486d65,_0x3b7523){_0x486d65=_0x486d65-0x0;var _0x49bd9f=_0xab13[_0x486d65];return _0x49bd9f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ab1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ab1('0x1'));var rp=require(_0x3ab1('0x2'));var moment=require(_0x3ab1('0x3'));var BPromise=require(_0x3ab1('0x4'));var Mustache=require(_0x3ab1('0x5'));var util=require(_0x3ab1('0x6'));var path=require(_0x3ab1('0x7'));var sox=require(_0x3ab1('0x8'));var csv=require(_0x3ab1('0x9'));var ejs=require(_0x3ab1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3ab1('0xb'));var crypto=require(_0x3ab1('0xc'));var jsforce=require(_0x3ab1('0xd'));var deskjs=require(_0x3ab1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3ab1('0xf'));var Papa=require(_0x3ab1('0x10'));var Redis=require(_0x3ab1('0x11'));var authService=require(_0x3ab1('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3ab1('0x13'));var hardwareService=require(_0x3ab1('0x14'));var logger=require(_0x3ab1('0x15'))('api');var utils=require(_0x3ab1('0x16'));var config=require(_0x3ab1('0x17'));var licenseUtil=require(_0x3ab1('0x18'));var db=require('../../mysqldb')['db'];config[_0x3ab1('0x19')]=_['defaults'](config[_0x3ab1('0x19')],{'host':_0x3ab1('0x1a'),'port':0x18eb});var socket=require(_0x3ab1('0x1b'))(new Redis(config[_0x3ab1('0x19')]));require(_0x3ab1('0x1c'))[_0x3ab1('0x1d')](socket);var jayson=require(_0x3ab1('0x1e'));var client=jayson[_0x3ab1('0x1f')][_0x3ab1('0x20')]({'port':0x232c});var client9002=jayson[_0x3ab1('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x162e66,_0x22b333,_0x7f82c7,_0x2903ce){return new BPromise(function(_0x8d58b4,_0x541ea2){var _0x126ac4=_0x2903ce||client;return _0x126ac4[_0x3ab1('0x21')](_0x162e66,_0x7f82c7)['then'](function(_0x4c44b8){logger[_0x3ab1('0x22')](_0x3ab1('0x23'),_0x22b333,_0x3ab1('0x24'));logger[_0x3ab1('0x25')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x22b333,_0x3ab1('0x24'),JSON[_0x3ab1('0x26')](_0x4c44b8));if(_0x4c44b8[_0x3ab1('0x27')]){if(_0x4c44b8[_0x3ab1('0x27')][_0x3ab1('0x28')]===0x1f4){logger['error'](_0x3ab1('0x23'),_0x22b333,_0x4c44b8['error']['message']);return _0x541ea2(_0x4c44b8[_0x3ab1('0x27')]['message']);}logger[_0x3ab1('0x27')](_0x3ab1('0x23'),_0x22b333,_0x4c44b8[_0x3ab1('0x27')][_0x3ab1('0x29')]);return _0x8d58b4(_0x4c44b8[_0x3ab1('0x27')][_0x3ab1('0x29')]);}else{logger[_0x3ab1('0x22')](_0x3ab1('0x23'),_0x22b333,'request\x20sent');_0x8d58b4(_0x4c44b8['result'][_0x3ab1('0x29')]);}})[_0x3ab1('0x2a')](function(_0x1a2e16){logger[_0x3ab1('0x27')](_0x3ab1('0x23'),_0x22b333,_0x1a2e16);_0x541ea2(_0x1a2e16);});});}function respondWithStatusCode(_0x1e6096,_0x40096b){_0x40096b=_0x40096b||0xcc;return function(_0x103582){if(_0x103582){return _0x1e6096[_0x3ab1('0x2b')](_0x40096b);}return _0x1e6096[_0x3ab1('0x2c')](_0x40096b)[_0x3ab1('0x2d')]();};}function respondWithResult(_0x44dd87,_0x58c377){_0x58c377=_0x58c377||0xc8;return function(_0x183288){if(_0x183288){return _0x44dd87[_0x3ab1('0x2c')](_0x58c377)[_0x3ab1('0x2e')](_0x183288);}};}function respondWithFilteredResult(_0x21924c,_0x1f7394){return function(_0x260573){if(_0x260573){var _0x1679e6=typeof _0x1f7394[_0x3ab1('0x2f')]===_0x3ab1('0x30')&&typeof _0x1f7394[_0x3ab1('0x31')]===_0x3ab1('0x30');var _0x5f0acf=_0x260573['count'];var _0x56b9be=_0x1679e6?0x0:_0x1f7394[_0x3ab1('0x2f')];var _0x394b1f=_0x1679e6?_0x260573[_0x3ab1('0x32')]:_0x1f7394[_0x3ab1('0x2f')]+_0x1f7394[_0x3ab1('0x31')];var _0x3d34ad;if(_0x394b1f>=_0x5f0acf){_0x394b1f=_0x5f0acf;_0x3d34ad=0xc8;}else{_0x3d34ad=0xce;}_0x21924c[_0x3ab1('0x2c')](_0x3d34ad);return _0x21924c[_0x3ab1('0x33')](_0x3ab1('0x34'),_0x56b9be+'-'+_0x394b1f+'/'+_0x5f0acf)['json'](_0x260573);}return null;};}function patchUpdates(_0x1a4acc){return function(_0x9a404a){try{jsonpatch[_0x3ab1('0x35')](_0x9a404a,_0x1a4acc,!![]);}catch(_0x48714d){return BPromise[_0x3ab1('0x36')](_0x48714d);}return _0x9a404a[_0x3ab1('0x37')]();};}function saveUpdates(_0x5d9af1,_0x1c8699){return function(_0x94a7dc){if(_0x94a7dc){return _0x94a7dc[_0x3ab1('0x38')](_0x5d9af1)['then'](function(_0x4c775b){return _0x4c775b;});}return null;};}function removeEntity(_0x426157,_0x5b89cc){return function(_0x51cb12){if(_0x51cb12){return _0x51cb12[_0x3ab1('0x39')]()[_0x3ab1('0x3a')](function(){_0x426157[_0x3ab1('0x2c')](0xcc)[_0x3ab1('0x2d')]();});}};}function handleEntityNotFound(_0x61df23,_0x2462ae){return function(_0x283312){if(!_0x283312){_0x61df23[_0x3ab1('0x2b')](0x194);}return _0x283312;};}function handleError(_0x17e490,_0x5f2c69){_0x5f2c69=_0x5f2c69||0x1f4;return function(_0x56f7a5){logger[_0x3ab1('0x27')](_0x56f7a5[_0x3ab1('0x3b')]);if(_0x56f7a5[_0x3ab1('0x3c')]){delete _0x56f7a5[_0x3ab1('0x3c')];}_0x17e490[_0x3ab1('0x2c')](_0x5f2c69)[_0x3ab1('0x3d')](_0x56f7a5);};}exports[_0x3ab1('0x3e')]=function(_0xeba073,_0x27dc8a){var _0x5b0059={},_0x325536={},_0x2a4baa={'count':0x0,'rows':[]};var _0x26b1ec=_['map'](db[_0x3ab1('0x3f')][_0x3ab1('0x40')],function(_0x140617){return{'name':_0x140617[_0x3ab1('0x41')],'type':_0x140617[_0x3ab1('0x42')]['key']};});_0x325536[_0x3ab1('0x43')]=_['map'](_0x26b1ec,_0x3ab1('0x3c'));_0x325536['query']=_['keys'](_0xeba073['query']);_0x325536[_0x3ab1('0x44')]=_[_0x3ab1('0x45')](_0x325536['model'],_0x325536[_0x3ab1('0x46')]);_0x5b0059[_0x3ab1('0x47')]=_[_0x3ab1('0x45')](_0x325536[_0x3ab1('0x43')],qs[_0x3ab1('0x48')](_0xeba073['query']['fields']));_0x5b0059[_0x3ab1('0x47')]=_0x5b0059[_0x3ab1('0x47')][_0x3ab1('0x49')]?_0x5b0059[_0x3ab1('0x47')]:_0x325536['model'];if(!_0xeba073[_0x3ab1('0x46')][_0x3ab1('0x4a')](_0x3ab1('0x4b'))){_0x5b0059['limit']=qs[_0x3ab1('0x31')](_0xeba073[_0x3ab1('0x46')][_0x3ab1('0x31')]);_0x5b0059[_0x3ab1('0x2f')]=qs['offset'](_0xeba073[_0x3ab1('0x46')][_0x3ab1('0x2f')]);}_0x5b0059['order']=qs['sort'](_0xeba073['query'][_0x3ab1('0x4c')]);_0x5b0059['where']=qs[_0x3ab1('0x44')](_['pick'](_0xeba073[_0x3ab1('0x46')],_0x325536[_0x3ab1('0x44')]),_0x26b1ec);if(_0xeba073[_0x3ab1('0x46')][_0x3ab1('0x4d')]){_0x5b0059[_0x3ab1('0x4e')]=_['merge'](_0x5b0059[_0x3ab1('0x4e')],{'$or':_['map'](_0x26b1ec,function(_0x45b129){if(_0x45b129['type']!=='VIRTUAL'){var _0x19d67b={};_0x19d67b[_0x45b129[_0x3ab1('0x3c')]]={'$like':'%'+_0xeba073[_0x3ab1('0x46')]['filter']+'%'};return _0x19d67b;}})});}_0x5b0059=_['merge']({},_0x5b0059,_0xeba073[_0x3ab1('0x4f')]);var _0x41cef0={'where':_0x5b0059[_0x3ab1('0x4e')]};return db[_0x3ab1('0x3f')][_0x3ab1('0x32')](_0x41cef0)['then'](function(_0x140531){_0x2a4baa[_0x3ab1('0x32')]=_0x140531;if(_0xeba073['query']['includeAll']){_0x5b0059[_0x3ab1('0x50')]=[{'all':!![]}];}return db[_0x3ab1('0x3f')][_0x3ab1('0x51')](_0x5b0059);})[_0x3ab1('0x3a')](function(_0xd109db){_0x2a4baa['rows']=_0xd109db;return _0x2a4baa;})[_0x3ab1('0x3a')](respondWithFilteredResult(_0x27dc8a,_0x5b0059))[_0x3ab1('0x2a')](handleError(_0x27dc8a,null));};exports['show']=function(_0x50a1bc,_0x49a57d){var _0x57671a={'raw':!![],'where':{'id':_0x50a1bc[_0x3ab1('0x52')]['id']}},_0x5136b5={};_0x5136b5['model']=_['keys'](db['ChatMessage'][_0x3ab1('0x40')]);_0x5136b5[_0x3ab1('0x46')]=_[_0x3ab1('0x53')](_0x50a1bc[_0x3ab1('0x46')]);_0x5136b5[_0x3ab1('0x44')]=_['intersection'](_0x5136b5[_0x3ab1('0x43')],_0x5136b5[_0x3ab1('0x46')]);_0x57671a[_0x3ab1('0x47')]=_[_0x3ab1('0x45')](_0x5136b5[_0x3ab1('0x43')],qs[_0x3ab1('0x48')](_0x50a1bc[_0x3ab1('0x46')][_0x3ab1('0x48')]));_0x57671a[_0x3ab1('0x47')]=_0x57671a[_0x3ab1('0x47')][_0x3ab1('0x49')]?_0x57671a[_0x3ab1('0x47')]:_0x5136b5[_0x3ab1('0x43')];if(_0x50a1bc[_0x3ab1('0x46')][_0x3ab1('0x54')]){_0x57671a[_0x3ab1('0x50')]=[{'all':!![]}];}_0x57671a=_['merge']({},_0x57671a,_0x50a1bc[_0x3ab1('0x4f')]);return db['ChatMessage'][_0x3ab1('0x55')](_0x57671a)['then'](handleEntityNotFound(_0x49a57d,null))[_0x3ab1('0x3a')](respondWithResult(_0x49a57d,null))[_0x3ab1('0x2a')](handleError(_0x49a57d,null));};exports[_0x3ab1('0x56')]=function(_0x3ac7ec,_0xe2ee44){return db[_0x3ab1('0x3f')][_0x3ab1('0x56')](_0x3ac7ec['body'],{})[_0x3ab1('0x3a')](respondWithResult(_0xe2ee44,0xc9))[_0x3ab1('0x2a')](handleError(_0xe2ee44,null));};exports['update']=function(_0x49d71e,_0x5edb65){if(_0x49d71e[_0x3ab1('0x57')]['id']){delete _0x49d71e[_0x3ab1('0x57')]['id'];}return db[_0x3ab1('0x3f')][_0x3ab1('0x55')]({'where':{'id':_0x49d71e[_0x3ab1('0x52')]['id']}})[_0x3ab1('0x3a')](handleEntityNotFound(_0x5edb65,null))[_0x3ab1('0x3a')](saveUpdates(_0x49d71e[_0x3ab1('0x57')],null))[_0x3ab1('0x3a')](respondWithResult(_0x5edb65,null))[_0x3ab1('0x2a')](handleError(_0x5edb65,null));};exports[_0x3ab1('0x39')]=function(_0xa1ec62,_0x278f50){return db[_0x3ab1('0x3f')]['find']({'where':{'id':_0xa1ec62[_0x3ab1('0x52')]['id']}})['then'](handleEntityNotFound(_0x278f50,null))[_0x3ab1('0x3a')](removeEntity(_0x278f50,null))[_0x3ab1('0x2a')](handleError(_0x278f50,null));};exports['describe']=function(_0x4d98b8,_0x1214ac){return db[_0x3ab1('0x3f')][_0x3ab1('0x58')]()['then'](respondWithResult(_0x1214ac,null))[_0x3ab1('0x2a')](handleError(_0x1214ac,null));};var interaction_log=require(_0x3ab1('0x15'))(_0x3ab1('0x59'));exports[_0x3ab1('0x5a')]=function(_0x5566a7,_0x45a754,_0x51495b){var _0x44cbe7={'agent':{},'channel':_0x3ab1('0x5b')};if(_0x5566a7['body']['id']){delete _0x5566a7[_0x3ab1('0x57')]['id'];}_0x5566a7[_0x3ab1('0x57')][_0x3ab1('0x5c')]=!![];_0x5566a7[_0x3ab1('0x57')][_0x3ab1('0x5d')]=moment()['format'](_0x3ab1('0x5e'));_0x5566a7['body'][_0x3ab1('0x5f')]=_0x5566a7[_0x3ab1('0x57')][_0x3ab1('0x5f')]||_0x5566a7[_0x3ab1('0x60')]['id'];_0x44cbe7[_0x3ab1('0x61')]['id']=_0x5566a7[_0x3ab1('0x57')][_0x3ab1('0x5f')];return db[_0x3ab1('0x3f')][_0x3ab1('0x55')]({'where':{'id':_0x5566a7[_0x3ab1('0x52')]['id'],'UserId':null}})[_0x3ab1('0x3a')](handleEntityNotFound(_0x45a754,null))[_0x3ab1('0x3a')](saveUpdates(_0x5566a7[_0x3ab1('0x57')],null))[_0x3ab1('0x3a')](function(_0x20c5af){if(_0x20c5af){_0x44cbe7[_0x3ab1('0x29')]=_0x20c5af[_0x3ab1('0x62')]({'plain':!![]});return db['ChatInteraction'][_0x3ab1('0x55')]({'where':{'id':_0x20c5af[_0x3ab1('0x63')]}});}return null;})[_0x3ab1('0x3a')](handleEntityNotFound(_0x45a754,null))[_0x3ab1('0x3a')](function(_0x5e5c34){if(_0x5e5c34){return _0x5e5c34['update']({'UserId':_0x5566a7['body'][_0x3ab1('0x5f')],'read1stAt':_[_0x3ab1('0x64')](_0x5e5c34[_0x3ab1('0x65')])?moment()[_0x3ab1('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x3ab1('0x3a')](function(_0x54df9b){if(_0x54df9b){_0x44cbe7['interaction']=_0x54df9b['get']({'plain':!![]});interaction_log[_0x3ab1('0x22')](_0x3ab1('0x67'),_0x5566a7[_0x3ab1('0x60')]['id'],_0x5566a7[_0x3ab1('0x60')][_0x3ab1('0x3c')],_0x5566a7[_0x3ab1('0x60')][_0x3ab1('0x68')],_0x44cbe7[_0x3ab1('0x69')]['id'],_0x5566a7['body']?JSON[_0x3ab1('0x26')](_0x5566a7['body']):'null');return respondWithRpcPromise(_0x3ab1('0x6a'),_0x3ab1('0x6b'),_0x44cbe7);}return null;})['then'](function(_0x4941bf){var _0x3bfe04=_0x3ab1('0x6c')+_0x4941bf[_0x3ab1('0x29')][_0x3ab1('0x6d')];return db[_0x3ab1('0x6e')][_0x3ab1('0x46')](_0x3bfe04,{'type':db['Sequelize'][_0x3ab1('0x6f')]['SELECT'],'raw':!![]})[_0x3ab1('0x3a')](function(_0x37088d){return _0x37088d;});})[_0x3ab1('0x3a')](function(_0x148c71){if(_0x148c71){_0x44cbe7[_0x3ab1('0x29')][_0x3ab1('0x70')]=_0x148c71[0x0];if(!_0x5566a7[_0x3ab1('0x57')][_0x3ab1('0x5f')])return;return db[_0x3ab1('0x71')]['find']({'where':{'id':_0x5566a7['body'][_0x3ab1('0x5f')],'role':'agent'},'attributes':['id','name','fullname',_0x3ab1('0x72'),_0x3ab1('0x73')],'raw':!![]});}return null;})[_0x3ab1('0x3a')](function(_0x26d798){if(!_0x26d798)return null;_0x44cbe7[_0x3ab1('0x29')][_0x3ab1('0x61')]=_0x26d798;return _0x44cbe7;})[_0x3ab1('0x3a')](function(_0x2512e9){if(_0x2512e9){if(_0x5566a7[_0x3ab1('0x57')][_0x3ab1('0x74')]){_0x44cbe7[_0x3ab1('0x29')]['interface']=util['format']('SIP/%s',_0x5566a7[_0x3ab1('0x60')][_0x3ab1('0x3c')]);_0x44cbe7[_0x3ab1('0x29')]['channel']=_0x44cbe7[_0x3ab1('0x75')];_0x44cbe7[_0x3ab1('0x29')][_0x3ab1('0x76')]=_0x44cbe7[_0x3ab1('0x75')];_0x44cbe7[_0x3ab1('0x29')][_0x3ab1('0x77')]=_0x3ab1('0x5a');return respondWithRpcPromise(_0x3ab1('0x78'),'EventManager',{'event':_0x3ab1('0x79'),'message':_[_0x3ab1('0x7a')](_0x44cbe7[_0x3ab1('0x29')],JSON[_0x3ab1('0x7b')](_0x44cbe7[_0x3ab1('0x69')][_0x3ab1('0x7c')]))},client9002)[_0x3ab1('0x3a')](function(){return _0x44cbe7;});}return _0x44cbe7;}return null;})[_0x3ab1('0x3a')](respondWithResult(_0x45a754,null))[_0x3ab1('0x2a')](handleError(_0x45a754,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x3ab1('0x36')]=function(_0x2b4138,_0x1caad9,_0x1a6592){var _0x8b75b1={'agent':{},'channel':'chat'};if(_0x2b4138[_0x3ab1('0x57')]['id']){delete _0x2b4138['body']['id'];}_0x2b4138[_0x3ab1('0x57')][_0x3ab1('0x5f')]=_0x2b4138[_0x3ab1('0x57')][_0x3ab1('0x5f')]||_0x2b4138[_0x3ab1('0x60')]['id'];_0x8b75b1[_0x3ab1('0x61')]['id']=_0x2b4138[_0x3ab1('0x57')][_0x3ab1('0x5f')];return db['ChatMessage'][_0x3ab1('0x55')]({'where':{'id':_0x2b4138[_0x3ab1('0x52')]['id'],'UserId':null}})[_0x3ab1('0x3a')](handleEntityNotFound(_0x1caad9,null))['then'](function(_0x531018){if(_0x531018){_0x8b75b1[_0x3ab1('0x29')]=_0x531018[_0x3ab1('0x62')]({'plain':!![]});return db[_0x3ab1('0x7d')][_0x3ab1('0x55')]({'where':{'id':_0x531018[_0x3ab1('0x63')]}});}return null;})[_0x3ab1('0x3a')](handleEntityNotFound(_0x1caad9,null))['then'](function(_0x51cb41){if(_0x51cb41){_0x8b75b1[_0x3ab1('0x69')]=_0x51cb41[_0x3ab1('0x62')]({'plain':!![]});interaction_log[_0x3ab1('0x22')](_0x3ab1('0x7e'),_0x2b4138[_0x3ab1('0x60')]['id'],_0x2b4138['user']['name'],_0x2b4138[_0x3ab1('0x60')]['role'],_0x8b75b1[_0x3ab1('0x69')]['id'],_0x2b4138[_0x3ab1('0x57')]?JSON['stringify'](_0x2b4138[_0x3ab1('0x57')]):'null');return respondWithRpcPromise('RejectMessage',_0x3ab1('0x7f'),_0x8b75b1);}return null;})[_0x3ab1('0x3a')](function(_0x210395){var _0x5c2b85=_0x3ab1('0x6c')+_0x210395['message'][_0x3ab1('0x6d')];return db[_0x3ab1('0x6e')][_0x3ab1('0x46')](_0x5c2b85,{'type':db[_0x3ab1('0x80')][_0x3ab1('0x6f')]['SELECT'],'raw':!![]})[_0x3ab1('0x3a')](function(_0x40ee71){return _0x40ee71;});})[_0x3ab1('0x3a')](function(_0x5b6a12){if(_0x5b6a12){_0x8b75b1['message'][_0x3ab1('0x70')]=_0x5b6a12[0x0];if(!_0x2b4138[_0x3ab1('0x57')]['UserId'])return;return db['User'][_0x3ab1('0x55')]({'where':{'id':_0x2b4138[_0x3ab1('0x57')][_0x3ab1('0x5f')],'role':'agent'},'attributes':['id',_0x3ab1('0x3c'),_0x3ab1('0x81'),_0x3ab1('0x72'),_0x3ab1('0x73')],'raw':!![]});}return null;})[_0x3ab1('0x3a')](function(_0x1fe5d2){if(!_0x1fe5d2)return null;_0x8b75b1['message']['agent']=_0x1fe5d2;return _0x8b75b1;})['then'](function(_0x4c870e){if(_0x4c870e){_0x4c870e['message'][_0x3ab1('0x82')]=util[_0x3ab1('0x66')](_0x3ab1('0x83'),_0x2b4138[_0x3ab1('0x60')]['name']);_0x4c870e[_0x3ab1('0x29')]['channel']=_0x8b75b1[_0x3ab1('0x75')];_0x4c870e['message'][_0x3ab1('0x76')]=_0x8b75b1[_0x3ab1('0x75')];_0x4c870e[_0x3ab1('0x29')]['event']=_0x3ab1('0x36');respondWithRpcPromise(_0x3ab1('0x78'),_0x3ab1('0x78'),{'event':_0x3ab1('0x84'),'message':_[_0x3ab1('0x7a')](_0x8b75b1[_0x3ab1('0x29')],JSON[_0x3ab1('0x7b')](_0x8b75b1[_0x3ab1('0x69')]['formData']))},client9002);return _0x8b75b1;}return null;})[_0x3ab1('0x3a')](respondWithResult(_0x1caad9,null))[_0x3ab1('0x2a')](handleError(_0x1caad9,null));}; \ No newline at end of file +var _0x915e=['acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','fullname','email','interface','SIP/%s','channel','motionChannel','event','EventManager','formData','reject','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','internal','rejectmessage','parse','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','./chatMessage.socket','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','stack','name','send','index','ChatMessage','fieldName','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','includeAll','include','rows','params','rawAttributes','find','create','body','destroy','catch','describe','chat-interactions','accept','read','readAt','format','UserId','agent','ChatInteraction','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage'];(function(_0x46ab02,_0x46f430){var _0x39d9a4=function(_0x6ec26a){while(--_0x6ec26a){_0x46ab02['push'](_0x46ab02['shift']());}};_0x39d9a4(++_0x46f430);}(_0x915e,0x9b));var _0xe915=function(_0x2137e2,_0x4aabde){_0x2137e2=_0x2137e2-0x0;var _0x3dc972=_0x915e[_0x2137e2];return _0x3dc972;};'use strict';var emlformat=require(_0xe915('0x0'));var rimraf=require(_0xe915('0x1'));var zipdir=require(_0xe915('0x2'));var jsonpatch=require(_0xe915('0x3'));var rp=require(_0xe915('0x4'));var moment=require('moment');var BPromise=require(_0xe915('0x5'));var Mustache=require(_0xe915('0x6'));var util=require(_0xe915('0x7'));var path=require(_0xe915('0x8'));var sox=require(_0xe915('0x9'));var csv=require(_0xe915('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe915('0xb'));var _=require(_0xe915('0xc'));var squel=require(_0xe915('0xd'));var crypto=require('crypto');var jsforce=require(_0xe915('0xe'));var deskjs=require(_0xe915('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe915('0x10'));var Redis=require(_0xe915('0x11'));var authService=require(_0xe915('0x12'));var qs=require(_0xe915('0x13'));var as=require(_0xe915('0x14'));var hardwareService=require(_0xe915('0x15'));var logger=require(_0xe915('0x16'))(_0xe915('0x17'));var utils=require(_0xe915('0x18'));var config=require(_0xe915('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe915('0x1a')]=_[_0xe915('0x1b')](config[_0xe915('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe915('0x1a')]));require(_0xe915('0x1c'))['register'](socket);var jayson=require(_0xe915('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xe915('0x1e')][_0xe915('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1f431b,_0x8d8b3,_0x2064af,_0x2a5209){return new BPromise(function(_0x16e20a,_0x5934c0){var _0x1a62e8=_0x2a5209||client;return _0x1a62e8[_0xe915('0x20')](_0x1f431b,_0x2064af)['then'](function(_0x36e2d1){logger[_0xe915('0x21')](_0xe915('0x22'),_0x8d8b3,'request\x20sent');logger[_0xe915('0x23')](_0xe915('0x24'),_0x8d8b3,'request\x20sent',JSON[_0xe915('0x25')](_0x36e2d1));if(_0x36e2d1[_0xe915('0x26')]){if(_0x36e2d1[_0xe915('0x26')][_0xe915('0x27')]===0x1f4){logger[_0xe915('0x26')](_0xe915('0x22'),_0x8d8b3,_0x36e2d1[_0xe915('0x26')][_0xe915('0x28')]);return _0x5934c0(_0x36e2d1['error'][_0xe915('0x28')]);}logger[_0xe915('0x26')](_0xe915('0x22'),_0x8d8b3,_0x36e2d1[_0xe915('0x26')][_0xe915('0x28')]);return _0x16e20a(_0x36e2d1[_0xe915('0x26')][_0xe915('0x28')]);}else{logger[_0xe915('0x21')]('ChatMessage,\x20%s,\x20%s',_0x8d8b3,'request\x20sent');_0x16e20a(_0x36e2d1['result'][_0xe915('0x28')]);}})['catch'](function(_0x307efb){logger['error'](_0xe915('0x22'),_0x8d8b3,_0x307efb);_0x5934c0(_0x307efb);});});}function respondWithStatusCode(_0x4b2df4,_0xcc1506){_0xcc1506=_0xcc1506||0xcc;return function(_0x27d6af){if(_0x27d6af){return _0x4b2df4[_0xe915('0x29')](_0xcc1506);}return _0x4b2df4[_0xe915('0x2a')](_0xcc1506)[_0xe915('0x2b')]();};}function respondWithResult(_0x5894aa,_0x5183f6){_0x5183f6=_0x5183f6||0xc8;return function(_0x320067){if(_0x320067){return _0x5894aa[_0xe915('0x2a')](_0x5183f6)[_0xe915('0x2c')](_0x320067);}};}function respondWithFilteredResult(_0x22fa72,_0x540a9d){return function(_0x40553d){if(_0x40553d){var _0x458668=typeof _0x540a9d[_0xe915('0x2d')]===_0xe915('0x2e')&&typeof _0x540a9d[_0xe915('0x2f')]===_0xe915('0x2e');var _0x501eed=_0x40553d[_0xe915('0x30')];var _0x282644=_0x458668?0x0:_0x540a9d['offset'];var _0x1c3048=_0x458668?_0x40553d[_0xe915('0x30')]:_0x540a9d['offset']+_0x540a9d[_0xe915('0x2f')];var _0x3cf850;if(_0x1c3048>=_0x501eed){_0x1c3048=_0x501eed;_0x3cf850=0xc8;}else{_0x3cf850=0xce;}_0x22fa72[_0xe915('0x2a')](_0x3cf850);return _0x22fa72['set'](_0xe915('0x31'),_0x282644+'-'+_0x1c3048+'/'+_0x501eed)['json'](_0x40553d);}return null;};}function patchUpdates(_0x41d235){return function(_0x9fdb88){try{jsonpatch[_0xe915('0x32')](_0x9fdb88,_0x41d235,!![]);}catch(_0x3cba1b){return BPromise['reject'](_0x3cba1b);}return _0x9fdb88[_0xe915('0x33')]();};}function saveUpdates(_0x5cdd47,_0x447100){return function(_0x40b1e9){if(_0x40b1e9){return _0x40b1e9[_0xe915('0x34')](_0x5cdd47)[_0xe915('0x35')](function(_0x3b8268){return _0x3b8268;});}return null;};}function removeEntity(_0x4c13a2,_0x147052){return function(_0x1eb58a){if(_0x1eb58a){return _0x1eb58a['destroy']()[_0xe915('0x35')](function(){_0x4c13a2[_0xe915('0x2a')](0xcc)[_0xe915('0x2b')]();});}};}function handleEntityNotFound(_0x57c29d,_0x1a709f){return function(_0x4fe8de){if(!_0x4fe8de){_0x57c29d[_0xe915('0x29')](0x194);}return _0x4fe8de;};}function handleError(_0x4df3ad,_0x227f05){_0x227f05=_0x227f05||0x1f4;return function(_0x6b8494){logger[_0xe915('0x26')](_0x6b8494[_0xe915('0x36')]);if(_0x6b8494[_0xe915('0x37')]){delete _0x6b8494[_0xe915('0x37')];}_0x4df3ad[_0xe915('0x2a')](_0x227f05)[_0xe915('0x38')](_0x6b8494);};}exports[_0xe915('0x39')]=function(_0x15defc,_0x1cc158){var _0x4df065={},_0x588861={},_0x3b274c={'count':0x0,'rows':[]};var _0x148c7d=_['map'](db[_0xe915('0x3a')]['rawAttributes'],function(_0x28ce46){return{'name':_0x28ce46[_0xe915('0x3b')],'type':_0x28ce46['type'][_0xe915('0x3c')]};});_0x588861[_0xe915('0x3d')]=_[_0xe915('0x3e')](_0x148c7d,_0xe915('0x37'));_0x588861[_0xe915('0x3f')]=_[_0xe915('0x40')](_0x15defc['query']);_0x588861['filters']=_['intersection'](_0x588861[_0xe915('0x3d')],_0x588861[_0xe915('0x3f')]);_0x4df065[_0xe915('0x41')]=_[_0xe915('0x42')](_0x588861[_0xe915('0x3d')],qs['fields'](_0x15defc[_0xe915('0x3f')][_0xe915('0x43')]));_0x4df065['attributes']=_0x4df065[_0xe915('0x41')][_0xe915('0x44')]?_0x4df065[_0xe915('0x41')]:_0x588861[_0xe915('0x3d')];if(!_0x15defc[_0xe915('0x3f')][_0xe915('0x45')]('nolimit')){_0x4df065[_0xe915('0x2f')]=qs[_0xe915('0x2f')](_0x15defc[_0xe915('0x3f')]['limit']);_0x4df065['offset']=qs[_0xe915('0x2d')](_0x15defc[_0xe915('0x3f')]['offset']);}_0x4df065[_0xe915('0x46')]=qs['sort'](_0x15defc['query'][_0xe915('0x47')]);_0x4df065['where']=qs[_0xe915('0x48')](_[_0xe915('0x49')](_0x15defc[_0xe915('0x3f')],_0x588861[_0xe915('0x48')]),_0x148c7d);if(_0x15defc[_0xe915('0x3f')]['filter']){_0x4df065[_0xe915('0x4a')]=_[_0xe915('0x4b')](_0x4df065[_0xe915('0x4a')],{'$or':_[_0xe915('0x3e')](_0x148c7d,function(_0x231395){if(_0x231395[_0xe915('0x4c')]!==_0xe915('0x4d')){var _0x5321b3={};_0x5321b3[_0x231395['name']]={'$like':'%'+_0x15defc[_0xe915('0x3f')][_0xe915('0x4e')]+'%'};return _0x5321b3;}})});}_0x4df065=_[_0xe915('0x4b')]({},_0x4df065,_0x15defc['options']);var _0x376d6c={'where':_0x4df065[_0xe915('0x4a')]};return db[_0xe915('0x3a')][_0xe915('0x30')](_0x376d6c)[_0xe915('0x35')](function(_0x3c2fbb){_0x3b274c[_0xe915('0x30')]=_0x3c2fbb;if(_0x15defc[_0xe915('0x3f')][_0xe915('0x4f')]){_0x4df065[_0xe915('0x50')]=[{'all':!![]}];}return db[_0xe915('0x3a')]['findAll'](_0x4df065);})[_0xe915('0x35')](function(_0x29520c){_0x3b274c[_0xe915('0x51')]=_0x29520c;return _0x3b274c;})['then'](respondWithFilteredResult(_0x1cc158,_0x4df065))['catch'](handleError(_0x1cc158,null));};exports['show']=function(_0x2b6028,_0x1a8033){var _0x4f6d55={'raw':!![],'where':{'id':_0x2b6028[_0xe915('0x52')]['id']}},_0x275a0c={};_0x275a0c[_0xe915('0x3d')]=_[_0xe915('0x40')](db[_0xe915('0x3a')][_0xe915('0x53')]);_0x275a0c[_0xe915('0x3f')]=_[_0xe915('0x40')](_0x2b6028[_0xe915('0x3f')]);_0x275a0c[_0xe915('0x48')]=_[_0xe915('0x42')](_0x275a0c[_0xe915('0x3d')],_0x275a0c['query']);_0x4f6d55[_0xe915('0x41')]=_[_0xe915('0x42')](_0x275a0c[_0xe915('0x3d')],qs[_0xe915('0x43')](_0x2b6028[_0xe915('0x3f')][_0xe915('0x43')]));_0x4f6d55[_0xe915('0x41')]=_0x4f6d55[_0xe915('0x41')][_0xe915('0x44')]?_0x4f6d55[_0xe915('0x41')]:_0x275a0c['model'];if(_0x2b6028[_0xe915('0x3f')][_0xe915('0x4f')]){_0x4f6d55[_0xe915('0x50')]=[{'all':!![]}];}_0x4f6d55=_[_0xe915('0x4b')]({},_0x4f6d55,_0x2b6028['options']);return db[_0xe915('0x3a')][_0xe915('0x54')](_0x4f6d55)['then'](handleEntityNotFound(_0x1a8033,null))[_0xe915('0x35')](respondWithResult(_0x1a8033,null))['catch'](handleError(_0x1a8033,null));};exports['create']=function(_0xd8f7ee,_0x359213){return db['ChatMessage'][_0xe915('0x55')](_0xd8f7ee['body'],{})['then'](respondWithResult(_0x359213,0xc9))['catch'](handleError(_0x359213,null));};exports[_0xe915('0x34')]=function(_0xc3f535,_0x559014){if(_0xc3f535[_0xe915('0x56')]['id']){delete _0xc3f535[_0xe915('0x56')]['id'];}return db[_0xe915('0x3a')][_0xe915('0x54')]({'where':{'id':_0xc3f535[_0xe915('0x52')]['id']}})['then'](handleEntityNotFound(_0x559014,null))['then'](saveUpdates(_0xc3f535[_0xe915('0x56')],null))[_0xe915('0x35')](respondWithResult(_0x559014,null))['catch'](handleError(_0x559014,null));};exports[_0xe915('0x57')]=function(_0x5c4c1e,_0x5121f7){return db[_0xe915('0x3a')][_0xe915('0x54')]({'where':{'id':_0x5c4c1e['params']['id']}})['then'](handleEntityNotFound(_0x5121f7,null))[_0xe915('0x35')](removeEntity(_0x5121f7,null))[_0xe915('0x58')](handleError(_0x5121f7,null));};exports[_0xe915('0x59')]=function(_0x253ec6,_0x45926b){return db['ChatMessage']['describe']()[_0xe915('0x35')](respondWithResult(_0x45926b,null))['catch'](handleError(_0x45926b,null));};var interaction_log=require(_0xe915('0x16'))(_0xe915('0x5a'));exports[_0xe915('0x5b')]=function(_0x148ff2,_0x1e81a1,_0x4c8ed9){var _0x38634e={'agent':{},'channel':'chat'};if(_0x148ff2[_0xe915('0x56')]['id']){delete _0x148ff2[_0xe915('0x56')]['id'];}_0x148ff2[_0xe915('0x56')][_0xe915('0x5c')]=!![];_0x148ff2[_0xe915('0x56')][_0xe915('0x5d')]=moment()[_0xe915('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x148ff2[_0xe915('0x56')][_0xe915('0x5f')]=_0x148ff2[_0xe915('0x56')][_0xe915('0x5f')]||_0x148ff2['user']['id'];_0x38634e[_0xe915('0x60')]['id']=_0x148ff2['body'][_0xe915('0x5f')];return db[_0xe915('0x3a')][_0xe915('0x54')]({'where':{'id':_0x148ff2[_0xe915('0x52')]['id'],'UserId':null}})[_0xe915('0x35')](handleEntityNotFound(_0x1e81a1,null))[_0xe915('0x35')](saveUpdates(_0x148ff2[_0xe915('0x56')],null))[_0xe915('0x35')](function(_0x398976){if(_0x398976){_0x38634e[_0xe915('0x28')]=_0x398976['get']({'plain':!![]});return db[_0xe915('0x61')][_0xe915('0x54')]({'where':{'id':_0x398976['ChatInteractionId']}});}return null;})[_0xe915('0x35')](handleEntityNotFound(_0x1e81a1,null))[_0xe915('0x35')](function(_0x4da9cf){if(_0x4da9cf){return _0x4da9cf[_0xe915('0x34')]({'UserId':_0x148ff2[_0xe915('0x56')][_0xe915('0x5f')],'read1stAt':_[_0xe915('0x62')](_0x4da9cf['read1stAt'])?moment()[_0xe915('0x5e')](_0xe915('0x63')):undefined});}return null;})[_0xe915('0x35')](function(_0x4acf2b){if(_0x4acf2b){_0x38634e[_0xe915('0x64')]=_0x4acf2b[_0xe915('0x65')]({'plain':!![]});interaction_log['info'](_0xe915('0x66'),_0x148ff2[_0xe915('0x67')]['id'],_0x148ff2[_0xe915('0x67')][_0xe915('0x37')],_0x148ff2['user'][_0xe915('0x68')],_0x38634e['interaction']['id'],_0x148ff2['body']?JSON[_0xe915('0x25')](_0x148ff2[_0xe915('0x56')]):_0xe915('0x69'));return respondWithRpcPromise(_0xe915('0x6a'),_0xe915('0x6b'),_0x38634e);}return null;})[_0xe915('0x35')](function(_0x23f211){var _0xbfd895=_0xe915('0x6c')+_0x23f211['message'][_0xe915('0x6d')];return db[_0xe915('0x6e')]['query'](_0xbfd895,{'type':db[_0xe915('0x6f')]['QueryTypes'][_0xe915('0x70')],'raw':!![]})[_0xe915('0x35')](function(_0x315f2f){return _0x315f2f;});})['then'](function(_0x25dc96){if(_0x25dc96){_0x38634e[_0xe915('0x28')]['contact']=_0x25dc96[0x0];if(!_0x148ff2[_0xe915('0x56')]['UserId'])return;return db['User']['find']({'where':{'id':_0x148ff2[_0xe915('0x56')][_0xe915('0x5f')],'role':_0xe915('0x60')},'attributes':['id',_0xe915('0x37'),_0xe915('0x71'),_0xe915('0x72'),'internal'],'raw':!![]});}return null;})[_0xe915('0x35')](function(_0x3ce77e){if(!_0x3ce77e)return null;_0x38634e[_0xe915('0x28')][_0xe915('0x60')]=_0x3ce77e;return _0x38634e;})[_0xe915('0x35')](function(_0x3a04e7){if(_0x3a04e7){if(_0x148ff2[_0xe915('0x56')]['manual']){_0x38634e[_0xe915('0x28')][_0xe915('0x73')]=util[_0xe915('0x5e')](_0xe915('0x74'),_0x148ff2['user'][_0xe915('0x37')]);_0x38634e[_0xe915('0x28')][_0xe915('0x75')]=_0x38634e[_0xe915('0x75')];_0x38634e[_0xe915('0x28')][_0xe915('0x76')]=_0x38634e[_0xe915('0x75')];_0x38634e[_0xe915('0x28')][_0xe915('0x77')]='accept';return respondWithRpcPromise('EventManager',_0xe915('0x78'),{'event':'acceptmessage','message':_[_0xe915('0x4b')](_0x38634e['message'],JSON['parse'](_0x38634e[_0xe915('0x64')][_0xe915('0x79')]))},client9002)[_0xe915('0x35')](function(){return _0x38634e;});}return _0x38634e;}return null;})[_0xe915('0x35')](respondWithResult(_0x1e81a1,null))[_0xe915('0x58')](handleError(_0x1e81a1,null));};var interaction_log=require(_0xe915('0x16'))(_0xe915('0x5a'));exports[_0xe915('0x7a')]=function(_0xa2e9fb,_0x5d9287,_0x5ab5b0){var _0x39b578={'agent':{},'channel':'chat'};if(_0xa2e9fb['body']['id']){delete _0xa2e9fb['body']['id'];}_0xa2e9fb[_0xe915('0x56')]['UserId']=_0xa2e9fb['body'][_0xe915('0x5f')]||_0xa2e9fb['user']['id'];_0x39b578['agent']['id']=_0xa2e9fb['body']['UserId'];return db[_0xe915('0x3a')][_0xe915('0x54')]({'where':{'id':_0xa2e9fb[_0xe915('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5d9287,null))[_0xe915('0x35')](function(_0x1cbf21){if(_0x1cbf21){_0x39b578['message']=_0x1cbf21[_0xe915('0x65')]({'plain':!![]});return db[_0xe915('0x61')][_0xe915('0x54')]({'where':{'id':_0x1cbf21[_0xe915('0x7b')]}});}return null;})[_0xe915('0x35')](handleEntityNotFound(_0x5d9287,null))[_0xe915('0x35')](function(_0x337b21){if(_0x337b21){_0x39b578[_0xe915('0x64')]=_0x337b21[_0xe915('0x65')]({'plain':!![]});interaction_log['info'](_0xe915('0x7c'),_0xa2e9fb['user']['id'],_0xa2e9fb['user'][_0xe915('0x37')],_0xa2e9fb[_0xe915('0x67')][_0xe915('0x68')],_0x39b578['interaction']['id'],_0xa2e9fb[_0xe915('0x56')]?JSON[_0xe915('0x25')](_0xa2e9fb['body']):_0xe915('0x69'));return respondWithRpcPromise(_0xe915('0x7d'),_0xe915('0x7e'),_0x39b578);}return null;})['then'](function(_0x126383){var _0x19ad1f=_0xe915('0x6c')+_0x126383['message'][_0xe915('0x6d')];return db[_0xe915('0x6e')][_0xe915('0x3f')](_0x19ad1f,{'type':db[_0xe915('0x6f')]['QueryTypes']['SELECT'],'raw':!![]})[_0xe915('0x35')](function(_0x23cf92){return _0x23cf92;});})[_0xe915('0x35')](function(_0x304f09){if(_0x304f09){_0x39b578[_0xe915('0x28')]['contact']=_0x304f09[0x0];if(!_0xa2e9fb[_0xe915('0x56')][_0xe915('0x5f')])return;return db[_0xe915('0x7f')][_0xe915('0x54')]({'where':{'id':_0xa2e9fb[_0xe915('0x56')][_0xe915('0x5f')],'role':_0xe915('0x60')},'attributes':['id',_0xe915('0x37'),_0xe915('0x71'),_0xe915('0x72'),_0xe915('0x80')],'raw':!![]});}return null;})[_0xe915('0x35')](function(_0xdb9ac5){if(!_0xdb9ac5)return null;_0x39b578[_0xe915('0x28')][_0xe915('0x60')]=_0xdb9ac5;return _0x39b578;})[_0xe915('0x35')](function(_0x581782){if(_0x581782){_0x581782['message']['interface']=util[_0xe915('0x5e')](_0xe915('0x74'),_0xa2e9fb[_0xe915('0x67')][_0xe915('0x37')]);_0x581782[_0xe915('0x28')][_0xe915('0x75')]=_0x39b578[_0xe915('0x75')];_0x581782[_0xe915('0x28')]['motionChannel']=_0x39b578['channel'];_0x581782[_0xe915('0x28')][_0xe915('0x77')]=_0xe915('0x7a');respondWithRpcPromise(_0xe915('0x78'),_0xe915('0x78'),{'event':_0xe915('0x81'),'message':_['merge'](_0x39b578[_0xe915('0x28')],JSON[_0xe915('0x82')](_0x39b578[_0xe915('0x64')][_0xe915('0x79')]))},client9002);return _0x39b578;}return null;})[_0xe915('0x35')](respondWithResult(_0x5d9287,null))[_0xe915('0x58')](handleError(_0x5d9287,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 20c04aa..7cd716d 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 _0xf84e=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x389d1e,_0x7fc13e){var _0x4f2103=function(_0x19e428){while(--_0x19e428){_0x389d1e['push'](_0x389d1e['shift']());}};_0x4f2103(++_0x7fc13e);}(_0xf84e,0x18f));var _0xef84=function(_0x300460,_0x514cf1){_0x300460=_0x300460-0x0;var _0x2bbfa0=_0xf84e[_0x300460];return _0x2bbfa0;};'use strict';var EventEmitter=require(_0xef84('0x0'));var ChatMessage=require(_0xef84('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xef84('0x2'),'afterUpdate':_0xef84('0x3'),'afterDestroy':_0xef84('0x4')};function emitEvent(_0x1349e6){return function(_0x4739d9,_0x1e9c94,_0xe0e0c3){ChatMessageEvents[_0xef84('0x5')](_0x1349e6+':'+_0x4739d9['id'],_0x4739d9);ChatMessageEvents[_0xef84('0x5')](_0x1349e6,_0x4739d9);_0xe0e0c3(null);};}for(var e in events){if(events[_0xef84('0x6')](e)){var event=events[e];ChatMessage[_0xef84('0x7')](e,emitEvent(event));}}module[_0xef84('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x7406=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','remove'];(function(_0x4209a9,_0x48a3b9){var _0xe03843=function(_0x312688){while(--_0x312688){_0x4209a9['push'](_0x4209a9['shift']());}};_0xe03843(++_0x48a3b9);}(_0x7406,0x1bc));var _0x6740=function(_0x38f1b1,_0x4690c6){_0x38f1b1=_0x38f1b1-0x0;var _0x527ab6=_0x7406[_0x38f1b1];return _0x527ab6;};'use strict';var EventEmitter=require(_0x6740('0x0'));var ChatMessage=require(_0x6740('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6740('0x2'),'afterUpdate':'update','afterDestroy':_0x6740('0x3')};function emitEvent(_0x3497ed){return function(_0x3bac97,_0x59a5fb,_0x10d0a7){ChatMessageEvents[_0x6740('0x4')](_0x3497ed+':'+_0x3bac97['id'],_0x3bac97);ChatMessageEvents[_0x6740('0x4')](_0x3497ed,_0x3bac97);_0x10d0a7(null);};}for(var e in events){if(events[_0x6740('0x5')](e)){var event=events[e];ChatMessage[_0x6740('0x6')](e,emitEvent(event));}}module[_0x6740('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index be24cb8..749fd06 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 _0x784d=['utf8mb4','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch'];(function(_0x126bbe,_0x1d9050){var _0x59557e=function(_0x460885){while(--_0x460885){_0x126bbe['push'](_0x126bbe['shift']());}};_0x59557e(++_0x1d9050);}(_0x784d,0x140));var _0xd784=function(_0x3f1a9d,_0x1cc728){_0x3f1a9d=_0x3f1a9d-0x0;var _0xd64ff5=_0x784d[_0x3f1a9d];return _0xd64ff5;};'use strict';var _=require(_0xd784('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd784('0x1'));var moment=require(_0xd784('0x2'));var BPromise=require(_0xd784('0x3'));var rp=require(_0xd784('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd784('0x5'));var config=require(_0xd784('0x6'));var attributes=require(_0xd784('0x7'));module['exports']=function(_0x467b5b,_0xccba70){return _0x467b5b[_0xd784('0x8')](_0xd784('0x9'),attributes,{'tableName':_0xd784('0xa'),'paranoid':![],'indexes':[{'name':_0xd784('0xb'),'fields':[_0xd784('0xc')],'type':_0xd784('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x464a18,_0x5d3345,_0xfb43b2){var _0x41b74d=_0x467b5b[_0xd784('0xe')];var _0x32041e=_0x464a18[_0xd784('0xf')]({'plain':!![]});if(_0x32041e[_0xd784('0x10')][_0xd784('0x11')]()==='in'||_0x32041e[_0xd784('0x10')][_0xd784('0x11')]()===_0xd784('0x12')&&!_0x32041e[_0xd784('0x13')]&&!_['isNil'](_0x32041e[_0xd784('0x14')])){_0x41b74d[_0xd784('0x15')][_0xd784('0x16')]({'where':{'id':_0x32041e[_0xd784('0x17')]}})[_0xd784('0x18')](function(_0x27f0fe){if(_0x27f0fe){_0x27f0fe[_0xd784('0x19')]({'lastMsgAt':_0x32041e[_0xd784('0x1a')],'lastMsgDirection':_0x32041e['direction'][_0xd784('0x11')]()});}})[_0xd784('0x1b')](function(_0x298349){console['error'](_0x298349);});}_0xfb43b2();}},'charset':_0xd784('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0a59=['isNil','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0x2ab150,_0x231cc6){var _0x1c8a86=function(_0x1e4e56){while(--_0x1e4e56){_0x2ab150['push'](_0x2ab150['shift']());}};_0x1c8a86(++_0x231cc6);}(_0x0a59,0x12b));var _0x90a5=function(_0x1494b9,_0x444764){_0x1494b9=_0x1494b9-0x0;var _0x1f0f67=_0x0a59[_0x1494b9];return _0x1f0f67;};'use strict';var _=require(_0x90a5('0x0'));var util=require(_0x90a5('0x1'));var logger=require(_0x90a5('0x2'))(_0x90a5('0x3'));var moment=require(_0x90a5('0x4'));var BPromise=require(_0x90a5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90a5('0x6'));var rimraf=require('rimraf');var config=require(_0x90a5('0x7'));var attributes=require('./chatMessage.attributes');module[_0x90a5('0x8')]=function(_0x5579db,_0x30b7b0){return _0x5579db[_0x90a5('0x9')](_0x90a5('0xa'),attributes,{'tableName':_0x90a5('0xb'),'paranoid':![],'indexes':[{'name':_0x90a5('0xc'),'fields':[_0x90a5('0xd')],'type':_0x90a5('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2605a0,_0xe7334c,_0x5662e8){var _0x55ebee=_0x5579db[_0x90a5('0xf')];var _0xa6af01=_0x2605a0[_0x90a5('0x10')]({'plain':!![]});if(_0xa6af01[_0x90a5('0x11')]['toLowerCase']()==='in'||_0xa6af01['direction'][_0x90a5('0x12')]()===_0x90a5('0x13')&&!_0xa6af01['secret']&&!_[_0x90a5('0x14')](_0xa6af01['UserId'])){_0x55ebee['ChatInteraction'][_0x90a5('0x15')]({'where':{'id':_0xa6af01[_0x90a5('0x16')]}})[_0x90a5('0x17')](function(_0x8794ee){if(_0x8794ee){_0x8794ee[_0x90a5('0x18')]({'lastMsgAt':_0xa6af01[_0x90a5('0x19')],'lastMsgDirection':_0xa6af01[_0x90a5('0x11')][_0x90a5('0x12')]()});}})[_0x90a5('0x1a')](function(_0x1524c4){console['error'](_0x1524c4);});}_0x5662e8();}},'charset':_0x90a5('0x1b'),'collate':_0x90a5('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index c0f0d5d..e71be00 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 _0x5836=['rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ChatMessage','create','body','options','raw','then','CreateChatMessage','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x4e8d6f,_0x318224){var _0x12f714=function(_0x5ca5ac){while(--_0x5ca5ac){_0x4e8d6f['push'](_0x4e8d6f['shift']());}};_0x12f714(++_0x318224);}(_0x5836,0x12c));var _0x6583=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0x5836[_0x53b8e0];return _0x10630c;};'use strict';var _=require(_0x6583('0x0'));var util=require('util');var moment=require(_0x6583('0x1'));var BPromise=require(_0x6583('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6583('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6583('0x4'));var logger=require(_0x6583('0x5'))(_0x6583('0x6'));var config=require(_0x6583('0x7'));var jayson=require(_0x6583('0x8'));var client=jayson['client'][_0x6583('0x9')]({'port':0x232a});config[_0x6583('0xa')]=_[_0x6583('0xb')](config[_0x6583('0xa')],{'host':_0x6583('0xc'),'port':0x18eb});var socket=require(_0x6583('0xd'))(new Redis(config[_0x6583('0xa')]));require(_0x6583('0xe'))[_0x6583('0xf')](socket);function respondWithRpcPromise(_0x3380f2,_0x4b3051,_0xf52d01){return new BPromise(function(_0x267a65,_0x1dcfa5){return client[_0x6583('0x10')](_0x3380f2,_0xf52d01)['then'](function(_0xaaa113){logger[_0x6583('0x11')](_0x6583('0x12'),_0x4b3051,_0x6583('0x13'));logger[_0x6583('0x14')](_0x6583('0x15'),_0x4b3051,_0x6583('0x13'),JSON[_0x6583('0x16')](_0xaaa113));if(_0xaaa113[_0x6583('0x17')]){if(_0xaaa113[_0x6583('0x17')][_0x6583('0x18')]===0x1f4){logger[_0x6583('0x17')](_0x6583('0x12'),_0x4b3051,_0xaaa113['error'][_0x6583('0x19')]);return _0x1dcfa5(_0xaaa113[_0x6583('0x17')][_0x6583('0x19')]);}logger[_0x6583('0x17')](_0x6583('0x12'),_0x4b3051,_0xaaa113[_0x6583('0x17')][_0x6583('0x19')]);return _0x267a65(_0xaaa113[_0x6583('0x17')]['message']);}else{logger[_0x6583('0x11')](_0x6583('0x12'),_0x4b3051,_0x6583('0x13'));_0x267a65(_0xaaa113['result'][_0x6583('0x19')]);}})[_0x6583('0x1a')](function(_0x26e974){logger[_0x6583('0x17')](_0x6583('0x12'),_0x4b3051,_0x26e974);_0x1dcfa5(_0x26e974);});});}exports['CreateChatMessage']=function(_0x3e71cb){var _0x551b32=this;return new Promise(function(_0x10e407,_0x49a473){return db[_0x6583('0x1b')][_0x6583('0x1c')](_0x3e71cb[_0x6583('0x1d')],{'raw':_0x3e71cb[_0x6583('0x1e')]?_0x3e71cb[_0x6583('0x1e')][_0x6583('0x1f')]===undefined?!![]:![]:!![]})[_0x6583('0x20')](function(_0x2ac31f){logger[_0x6583('0x11')](_0x6583('0x21'),_0x3e71cb);logger['debug'](_0x6583('0x21'),_0x3e71cb,JSON['stringify'](_0x2ac31f));_0x10e407(_0x2ac31f);})[_0x6583('0x1a')](function(_0x236b82){logger['error']('CreateChatMessage',_0x236b82[_0x6583('0x19')],_0x3e71cb);_0x49a473(_0x551b32[_0x6583('0x17')](0x1f4,_0x236b82[_0x6583('0x19')]));});});}; \ No newline at end of file +var _0xaa0d=['options','raw','info','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','register','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','CreateChatMessage','create','body'];(function(_0x56f6b6,_0x2cfa36){var _0x22f82f=function(_0x33d7a7){while(--_0x33d7a7){_0x56f6b6['push'](_0x56f6b6['shift']());}};_0x22f82f(++_0x2cfa36);}(_0xaa0d,0x18a));var _0xdaa0=function(_0x50bde8,_0xb58046){_0x50bde8=_0x50bde8-0x0;var _0x3c71ef=_0xaa0d[_0x50bde8];return _0x3c71ef;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdaa0('0x0'));var BPromise=require(_0xdaa0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdaa0('0x2'));var db=require(_0xdaa0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaa0('0x4'))(_0xdaa0('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xdaa0('0x6')]=_[_0xdaa0('0x7')](config[_0xdaa0('0x6')],{'host':_0xdaa0('0x8'),'port':0x18eb});var socket=require(_0xdaa0('0x9'))(new Redis(config[_0xdaa0('0x6')]));require('./chatMessage.socket')[_0xdaa0('0xa')](socket);function respondWithRpcPromise(_0x1efb82,_0x4a1706,_0xfcfbb5){return new BPromise(function(_0x563290,_0x20f796){return client['request'](_0x1efb82,_0xfcfbb5)[_0xdaa0('0xb')](function(_0x1e305c){logger['info'](_0xdaa0('0xc'),_0x4a1706,_0xdaa0('0xd'));logger['debug'](_0xdaa0('0xe'),_0x4a1706,_0xdaa0('0xd'),JSON['stringify'](_0x1e305c));if(_0x1e305c[_0xdaa0('0xf')]){if(_0x1e305c[_0xdaa0('0xf')]['code']===0x1f4){logger[_0xdaa0('0xf')](_0xdaa0('0xc'),_0x4a1706,_0x1e305c[_0xdaa0('0xf')]['message']);return _0x20f796(_0x1e305c[_0xdaa0('0xf')][_0xdaa0('0x10')]);}logger[_0xdaa0('0xf')](_0xdaa0('0xc'),_0x4a1706,_0x1e305c[_0xdaa0('0xf')]['message']);return _0x563290(_0x1e305c['error'][_0xdaa0('0x10')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x4a1706,_0xdaa0('0xd'));_0x563290(_0x1e305c['result'][_0xdaa0('0x10')]);}})['catch'](function(_0x2b129e){logger[_0xdaa0('0xf')](_0xdaa0('0xc'),_0x4a1706,_0x2b129e);_0x20f796(_0x2b129e);});});}exports[_0xdaa0('0x11')]=function(_0x52f94b){var _0x1f3c74=this;return new Promise(function(_0x2c6937,_0x52128c){return db['ChatMessage'][_0xdaa0('0x12')](_0x52f94b[_0xdaa0('0x13')],{'raw':_0x52f94b[_0xdaa0('0x14')]?_0x52f94b[_0xdaa0('0x14')][_0xdaa0('0x15')]===undefined?!![]:![]:!![]})[_0xdaa0('0xb')](function(_0x3dc55a){logger[_0xdaa0('0x16')](_0xdaa0('0x11'),_0x52f94b);logger['debug'](_0xdaa0('0x11'),_0x52f94b,JSON['stringify'](_0x3dc55a));_0x2c6937(_0x3dc55a);})['catch'](function(_0x151fad){logger[_0xdaa0('0xf')]('CreateChatMessage',_0x151fad[_0xdaa0('0x10')],_0x52f94b);_0x52128c(_0x1f3c74[_0xdaa0('0xf')](0x1f4,_0x151fad[_0xdaa0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index ebaeb31..9002ec9 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 _0x6c84=['chatMessage:','./chatMessage.events','save','remove','update','register','length'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x6c84,0x112));var _0x46c8=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x6c84[_0x4565bf];return _0x5610ba;};'use strict';var ChatMessageEvents=require(_0x46c8('0x0'));var events=[_0x46c8('0x1'),_0x46c8('0x2'),_0x46c8('0x3')];function createListener(_0x2b33c3,_0x51d202){return function(_0x187ef9){_0x51d202['emit'](_0x2b33c3,_0x187ef9);};}function removeListener(_0x2f4e36,_0x5256eb){return function(){ChatMessageEvents['removeListener'](_0x2f4e36,_0x5256eb);};}exports[_0x46c8('0x4')]=function(_0x378507){for(var _0x322cba=0x0,_0x2d239a=events[_0x46c8('0x5')];_0x322cba<_0x2d239a;_0x322cba++){var _0x3c1e2a=events[_0x322cba];var _0xfe26c8=createListener(_0x46c8('0x6')+_0x3c1e2a,_0x378507);ChatMessageEvents['on'](_0x3c1e2a,_0xfe26c8);}}; \ No newline at end of file +var _0x8ca9=['length','chatMessage:','./chatMessage.events','save','remove','update','register'];(function(_0x56475f,_0x32f61a){var _0x2196cc=function(_0xed5baa){while(--_0xed5baa){_0x56475f['push'](_0x56475f['shift']());}};_0x2196cc(++_0x32f61a);}(_0x8ca9,0x9c));var _0x98ca=function(_0x359f45,_0x484b73){_0x359f45=_0x359f45-0x0;var _0x3dc021=_0x8ca9[_0x359f45];return _0x3dc021;};'use strict';var ChatMessageEvents=require(_0x98ca('0x0'));var events=[_0x98ca('0x1'),_0x98ca('0x2'),_0x98ca('0x3')];function createListener(_0x3d9153,_0x22047f){return function(_0xe479d6){_0x22047f['emit'](_0x3d9153,_0xe479d6);};}function removeListener(_0x4c230f,_0x142793){return function(){ChatMessageEvents['removeListener'](_0x4c230f,_0x142793);};}exports[_0x98ca('0x4')]=function(_0x48415d){for(var _0x219619=0x0,_0xca4097=events[_0x98ca('0x5')];_0x219619<_0xca4097;_0x219619++){var _0x2852a0=events[_0x219619];var _0x323c95=createListener(_0x98ca('0x6')+_0x2852a0,_0x48415d);ChatMessageEvents['on'](_0x2852a0,_0x323c95);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index f8897a4..071ba54 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 _0x039e=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','index','get','isAuthenticated','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','accept','reject','delete','destroy','exports','multer','util'];(function(_0x1dbd09,_0x301322){var _0x1de30b=function(_0x16e500){while(--_0x16e500){_0x1dbd09['push'](_0x1dbd09['shift']());}};_0x1de30b(++_0x301322);}(_0x039e,0x178));var _0xe039=function(_0x4e6db8,_0x4cdc97){_0x4e6db8=_0x4e6db8-0x0;var _0x106fd1=_0x039e[_0x4e6db8];return _0x106fd1;};'use strict';var multer=require(_0xe039('0x0'));var util=require(_0xe039('0x1'));var path=require(_0xe039('0x2'));var timeout=require(_0xe039('0x3'));var express=require(_0xe039('0x4'));var router=express[_0xe039('0x5')]();var fs_extra=require(_0xe039('0x6'));var auth=require(_0xe039('0x7'));var interaction=require(_0xe039('0x8'));var config=require('../../config/environment');var controller=require(_0xe039('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe039('0xa')]);router[_0xe039('0xb')]('/describe',auth[_0xe039('0xc')](),controller[_0xe039('0xd')]);router[_0xe039('0xb')](_0xe039('0xe'),auth[_0xe039('0xc')](),controller[_0xe039('0xf')]);router[_0xe039('0x10')]('/',auth[_0xe039('0xc')](),interaction[_0xe039('0x11')](_0xe039('0x12'),_0xe039('0x13')),controller[_0xe039('0x14')]);router['put'](_0xe039('0xe'),controller['update']);router[_0xe039('0x15')]('/:id/accept',auth[_0xe039('0xc')](),controller[_0xe039('0x16')]);router[_0xe039('0x15')]('/:id/reject',auth['isAuthenticated'](),controller[_0xe039('0x17')]);router[_0xe039('0x18')](_0xe039('0xe'),auth['isAuthenticated'](),controller[_0xe039('0x19')]);module[_0xe039('0x1a')]=router; \ No newline at end of file +var _0xaf45=['isAuthenticated','show','tracked','chatmessage:create','create','put','/:id','/:id/accept','accept','/:id/reject','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe'];(function(_0x1d7e43,_0x505ccf){var _0x2e5790=function(_0x208920){while(--_0x208920){_0x1d7e43['push'](_0x1d7e43['shift']());}};_0x2e5790(++_0x505ccf);}(_0xaf45,0xee));var _0x5af4=function(_0x42b8ad,_0x5f0671){_0x42b8ad=_0x42b8ad-0x0;var _0x1802fa=_0xaf45[_0x42b8ad];return _0x1802fa;};'use strict';var multer=require('multer');var util=require(_0x5af4('0x0'));var path=require(_0x5af4('0x1'));var timeout=require(_0x5af4('0x2'));var express=require('express');var router=express[_0x5af4('0x3')]();var fs_extra=require(_0x5af4('0x4'));var auth=require(_0x5af4('0x5'));var interaction=require(_0x5af4('0x6'));var config=require(_0x5af4('0x7'));var controller=require(_0x5af4('0x8'));router[_0x5af4('0x9')]('/',auth['isAuthenticated'](),controller[_0x5af4('0xa')]);router['get'](_0x5af4('0xb'),auth[_0x5af4('0xc')](),controller['describe']);router[_0x5af4('0x9')]('/:id',auth[_0x5af4('0xc')](),controller[_0x5af4('0xd')]);router['post']('/',auth[_0x5af4('0xc')](),interaction[_0x5af4('0xe')]('chat',_0x5af4('0xf')),controller[_0x5af4('0x10')]);router[_0x5af4('0x11')](_0x5af4('0x12'),controller['update']);router[_0x5af4('0x11')](_0x5af4('0x13'),auth['isAuthenticated'](),controller[_0x5af4('0x14')]);router[_0x5af4('0x11')](_0x5af4('0x15'),auth['isAuthenticated'](),controller['reject']);router[_0x5af4('0x16')](_0x5af4('0x12'),auth[_0x5af4('0xc')](),controller[_0x5af4('0x17')]);module[_0x5af4('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 0f50116..ebb1f44 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 _0x625a=['exports','medium','sequelize'];(function(_0x2cf4c4,_0x3490f3){var _0x24b7f7=function(_0x3a12eb){while(--_0x3a12eb){_0x2cf4c4['push'](_0x2cf4c4['shift']());}};_0x24b7f7(++_0x3490f3);}(_0x625a,0x1c4));var _0xa625=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x625a[_0x2cd1fb];return _0x48fd2b;};'use strict';var Sequelize=require(_0xa625('0x0'));module[_0xa625('0x1')]={'body':{'type':Sequelize['TEXT'](_0xa625('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xb5bd=['sequelize','TEXT','medium'];(function(_0x5883af,_0x280f55){var _0x4cb53d=function(_0x122b50){while(--_0x122b50){_0x5883af['push'](_0x5883af['shift']());}};_0x4cb53d(++_0x280f55);}(_0xb5bd,0x12c));var _0xdb5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb5bd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdb5b('0x0'));module['exports']={'body':{'type':Sequelize[_0xdb5b('0x1')](_0xdb5b('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 3eb841b..97e20b7 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x4fc4b2,_0xa2fa08){var _0x2212de=function(_0x261c4d){while(--_0x261c4d){_0x4fc4b2['push'](_0x4fc4b2['shift']());}};_0x2212de(++_0xa2fa08);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _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(_0x34c80c,_0x2007bd){var _0x1fa3f6=function(_0xae4192){while(--_0xae4192){_0x34c80c['push'](_0x34c80c['shift']());}};_0x1fa3f6(++_0x2007bd);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 14df83e..df93392 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 _0x6043=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatOfflineMessage.attributes','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x6043,0xfb));var _0x3604=function(_0x12aaee,_0x5bf50c){_0x12aaee=_0x12aaee-0x0;var _0x37c350=_0x6043[_0x12aaee];return _0x37c350;};'use strict';var _=require(_0x3604('0x0'));var util=require(_0x3604('0x1'));var logger=require(_0x3604('0x2'))('api');var moment=require(_0x3604('0x3'));var BPromise=require(_0x3604('0x4'));var rp=require(_0x3604('0x5'));var fs=require('fs');var path=require(_0x3604('0x6'));var rimraf=require(_0x3604('0x7'));var config=require('../../config/environment');var attributes=require(_0x3604('0x8'));module['exports']=function(_0x818b7e,_0x5b8038){return _0x818b7e[_0x3604('0x9')](_0x3604('0xa'),attributes,{'tableName':_0x3604('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3604('0xc'),'collate':_0x3604('0xd')});}; \ No newline at end of file +var _0xc0d3=['api','moment','bluebird','request-promise','path','../../config/environment','./chatOfflineMessage.attributes','exports','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x56604b,_0x3de5f9){var _0x1b2450=function(_0x2e51bd){while(--_0x2e51bd){_0x56604b['push'](_0x56604b['shift']());}};_0x1b2450(++_0x3de5f9);}(_0xc0d3,0x1b7));var _0x3c0d=function(_0x4807dc,_0x1dbaea){_0x4807dc=_0x4807dc-0x0;var _0x3dd7c0=_0xc0d3[_0x4807dc];return _0x3dd7c0;};'use strict';var _=require(_0x3c0d('0x0'));var util=require(_0x3c0d('0x1'));var logger=require(_0x3c0d('0x2'))(_0x3c0d('0x3'));var moment=require(_0x3c0d('0x4'));var BPromise=require(_0x3c0d('0x5'));var rp=require(_0x3c0d('0x6'));var fs=require('fs');var path=require(_0x3c0d('0x7'));var rimraf=require('rimraf');var config=require(_0x3c0d('0x8'));var attributes=require(_0x3c0d('0x9'));module[_0x3c0d('0xa')]=function(_0x4ea60b,_0x4190cc){return _0x4ea60b['define']('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3c0d('0xb'),'collate':_0x3c0d('0xc')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0f02974..34590a4 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 _0xdc4d=['request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x418ea5,_0x883b36){var _0x3a3116=function(_0x3bf4ca){while(--_0x3bf4ca){_0x418ea5['push'](_0x418ea5['shift']());}};_0x3a3116(++_0x883b36);}(_0xdc4d,0x129));var _0xddc4=function(_0x805492,_0x33c618){_0x805492=_0x805492-0x0;var _0x3637e4=_0xdc4d[_0x805492];return _0x3637e4;};'use strict';var _=require('lodash');var util=require(_0xddc4('0x0'));var moment=require('moment');var BPromise=require(_0xddc4('0x1'));var rs=require(_0xddc4('0x2'));var fs=require('fs');var Redis=require(_0xddc4('0x3'));var db=require(_0xddc4('0x4'))['db'];var utils=require(_0xddc4('0x5'));var logger=require(_0xddc4('0x6'))(_0xddc4('0x7'));var config=require(_0xddc4('0x8'));var jayson=require(_0xddc4('0x9'));var client=jayson[_0xddc4('0xa')][_0xddc4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36da53,_0x40e9ec,_0x2ab4d4){return new BPromise(function(_0x24ea9b,_0x219f65){return client[_0xddc4('0xc')](_0x36da53,_0x2ab4d4)[_0xddc4('0xd')](function(_0xfef8c9){logger['info'](_0xddc4('0xe'),_0x40e9ec,_0xddc4('0xf'));logger[_0xddc4('0x10')](_0xddc4('0x11'),_0x40e9ec,_0xddc4('0xf'),JSON['stringify'](_0xfef8c9));if(_0xfef8c9[_0xddc4('0x12')]){if(_0xfef8c9[_0xddc4('0x12')][_0xddc4('0x13')]===0x1f4){logger['error'](_0xddc4('0xe'),_0x40e9ec,_0xfef8c9[_0xddc4('0x12')][_0xddc4('0x14')]);return _0x219f65(_0xfef8c9[_0xddc4('0x12')][_0xddc4('0x14')]);}logger[_0xddc4('0x12')](_0xddc4('0xe'),_0x40e9ec,_0xfef8c9[_0xddc4('0x12')][_0xddc4('0x14')]);return _0x24ea9b(_0xfef8c9['error'][_0xddc4('0x14')]);}else{logger[_0xddc4('0x15')](_0xddc4('0xe'),_0x40e9ec,_0xddc4('0xf'));_0x24ea9b(_0xfef8c9[_0xddc4('0x16')]['message']);}})[_0xddc4('0x17')](function(_0xc445dc){logger[_0xddc4('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x40e9ec,_0xc445dc);_0x219f65(_0xc445dc);});});} \ No newline at end of file +var _0x1353=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x519de4,_0x5d872f){var _0x8a753a=function(_0x27ee3b){while(--_0x27ee3b){_0x519de4['push'](_0x519de4['shift']());}};_0x8a753a(++_0x5d872f);}(_0x1353,0xb3));var _0x3135=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x1353[_0x122096];return _0x3d1966;};'use strict';var _=require(_0x3135('0x0'));var util=require(_0x3135('0x1'));var moment=require(_0x3135('0x2'));var BPromise=require(_0x3135('0x3'));var rs=require(_0x3135('0x4'));var fs=require('fs');var Redis=require(_0x3135('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3135('0x6'));var logger=require(_0x3135('0x7'))(_0x3135('0x8'));var config=require(_0x3135('0x9'));var jayson=require(_0x3135('0xa'));var client=jayson['client'][_0x3135('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x399326,_0x4a40bd,_0x35ff62){return new BPromise(function(_0x3ff071,_0x3f4209){return client[_0x3135('0xc')](_0x399326,_0x35ff62)[_0x3135('0xd')](function(_0x501f50){logger[_0x3135('0xe')](_0x3135('0xf'),_0x4a40bd,_0x3135('0x10'));logger[_0x3135('0x11')](_0x3135('0x12'),_0x4a40bd,'request\x20sent',JSON[_0x3135('0x13')](_0x501f50));if(_0x501f50['error']){if(_0x501f50[_0x3135('0x14')]['code']===0x1f4){logger[_0x3135('0x14')](_0x3135('0xf'),_0x4a40bd,_0x501f50['error'][_0x3135('0x15')]);return _0x3f4209(_0x501f50['error'][_0x3135('0x15')]);}logger[_0x3135('0x14')](_0x3135('0xf'),_0x4a40bd,_0x501f50['error'][_0x3135('0x15')]);return _0x3ff071(_0x501f50['error']['message']);}else{logger[_0x3135('0xe')](_0x3135('0xf'),_0x4a40bd,'request\x20sent');_0x3ff071(_0x501f50['result']['message']);}})[_0x3135('0x16')](function(_0x26da2f){logger[_0x3135('0x14')](_0x3135('0xf'),_0x4a40bd,_0x26da2f);_0x3f4209(_0x26da2f);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index d6ca0d6..f367731 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 _0xf2e0=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','multer'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xf2e0,0x14f));var _0x0f2e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xf2e0[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x0f2e('0x0'));var util=require(_0x0f2e('0x1'));var path=require('path');var timeout=require(_0x0f2e('0x2'));var express=require(_0x0f2e('0x3'));var router=express[_0x0f2e('0x4')]();var fs_extra=require(_0x0f2e('0x5'));var auth=require(_0x0f2e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0f2e('0x7'));var controller=require(_0x0f2e('0x8'));router[_0x0f2e('0x9')]('/',auth[_0x0f2e('0xa')](),controller[_0x0f2e('0xb')]);router[_0x0f2e('0x9')](_0x0f2e('0xc'),auth[_0x0f2e('0xa')](),controller[_0x0f2e('0xd')]);router[_0x0f2e('0x9')](_0x0f2e('0xe'),auth[_0x0f2e('0xa')](),controller[_0x0f2e('0xf')]);router[_0x0f2e('0x10')]('/',auth[_0x0f2e('0xa')](),controller[_0x0f2e('0x11')]);router[_0x0f2e('0x12')](_0x0f2e('0xe'),auth[_0x0f2e('0xa')](),controller[_0x0f2e('0x13')]);router['delete'](_0x0f2e('0xe'),auth['isAuthenticated'](),controller[_0x0f2e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x247d=['/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2b57fc,_0x4b3658){var _0x5bf238=function(_0x21661a){while(--_0x21661a){_0x2b57fc['push'](_0x2b57fc['shift']());}};_0x5bf238(++_0x4b3658);}(_0x247d,0x71));var _0xd247=function(_0x3d3d11,_0x4bae0b){_0x3d3d11=_0x3d3d11-0x0;var _0x193aeb=_0x247d[_0x3d3d11];return _0x193aeb;};'use strict';var multer=require(_0xd247('0x0'));var util=require(_0xd247('0x1'));var path=require('path');var timeout=require(_0xd247('0x2'));var express=require('express');var router=express[_0xd247('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd247('0x4'));var interaction=require(_0xd247('0x5'));var config=require(_0xd247('0x6'));var controller=require(_0xd247('0x7'));router[_0xd247('0x8')]('/',auth[_0xd247('0x9')](),controller[_0xd247('0xa')]);router[_0xd247('0x8')](_0xd247('0xb'),auth[_0xd247('0x9')](),controller[_0xd247('0xc')]);router['get'](_0xd247('0xd'),auth[_0xd247('0x9')](),controller[_0xd247('0xe')]);router[_0xd247('0xf')]('/',auth[_0xd247('0x9')](),controller[_0xd247('0x10')]);router[_0xd247('0x11')](_0xd247('0xd'),auth['isAuthenticated'](),controller[_0xd247('0x12')]);router['delete'](_0xd247('0xd'),auth[_0xd247('0x9')](),controller[_0xd247('0x13')]);module[_0xd247('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 bd27dc3..a2fbd6d 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 _0xb34c=['sequelize','exports','STRING','ENUM','timeout','INTEGER'];(function(_0x140f12,_0x53e2ce){var _0x4ae004=function(_0x1a1fcd){while(--_0x1a1fcd){_0x140f12['push'](_0x140f12['shift']());}};_0x4ae004(++_0x53e2ce);}(_0xb34c,0x6c));var _0xcb34=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb34c[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xcb34('0x0'));module[_0xcb34('0x1')]={'name':{'type':Sequelize[_0xcb34('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcb34('0x3')]('mouseOver',_0xcb34('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xcb34('0x2')]},'timeout':{'type':Sequelize[_0xcb34('0x5')]}}; \ No newline at end of file +var _0x57e6=['exports','STRING','ENUM','mouseOver','INTEGER'];(function(_0x3adcc2,_0x4bd4a5){var _0x583be9=function(_0x22cd0c){while(--_0x22cd0c){_0x3adcc2['push'](_0x3adcc2['shift']());}};_0x583be9(++_0x4bd4a5);}(_0x57e6,0xaf));var _0x657e=function(_0x53f608,_0x256def){_0x53f608=_0x53f608-0x0;var _0x495b7d=_0x57e6[_0x53f608];return _0x495b7d;};'use strict';var Sequelize=require('sequelize');module[_0x657e('0x0')]={'name':{'type':Sequelize[_0x657e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x657e('0x2')](_0x657e('0x3'),'timeout'),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x657e('0x1')]},'timeout':{'type':Sequelize[_0x657e('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index b1ed66e..239bf3c 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 _0x1c3b=['ejs','fs-extra','lodash','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','show','model','ChatProactiveAction','query','keys','filters','intersection','fields','attributes','includeAll','merge','options','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox'];(function(_0x1e9b34,_0x5446a5){var _0x41ac8c=function(_0x15e585){while(--_0x15e585){_0x1e9b34['push'](_0x1e9b34['shift']());}};_0x41ac8c(++_0x5446a5);}(_0x1c3b,0xab));var _0xb1c3=function(_0x45264a,_0x2a8f5e){_0x45264a=_0x45264a-0x0;var _0x444163=_0x1c3b[_0x45264a];return _0x444163;};'use strict';var emlformat=require(_0xb1c3('0x0'));var rimraf=require(_0xb1c3('0x1'));var zipdir=require(_0xb1c3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb1c3('0x3'));var BPromise=require(_0xb1c3('0x4'));var Mustache=require(_0xb1c3('0x5'));var util=require(_0xb1c3('0x6'));var path=require(_0xb1c3('0x7'));var sox=require(_0xb1c3('0x8'));var csv=require('to-csv');var ejs=require(_0xb1c3('0x9'));var fs=require('fs');var fs_extra=require(_0xb1c3('0xa'));var _=require(_0xb1c3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb1c3('0xc'));var querystring=require('querystring');var Papa=require(_0xb1c3('0xd'));var Redis=require(_0xb1c3('0xe'));var authService=require(_0xb1c3('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xb1c3('0x10'));var hardwareService=require(_0xb1c3('0x11'));var logger=require(_0xb1c3('0x12'))('api');var utils=require(_0xb1c3('0x13'));var config=require(_0xb1c3('0x14'));var licenseUtil=require(_0xb1c3('0x15'));var db=require(_0xb1c3('0x16'))['db'];function respondWithStatusCode(_0x4dae53,_0xac2af8){_0xac2af8=_0xac2af8||0xcc;return function(_0x30ce26){if(_0x30ce26){return _0x4dae53[_0xb1c3('0x17')](_0xac2af8);}return _0x4dae53['status'](_0xac2af8)[_0xb1c3('0x18')]();};}function respondWithResult(_0x15de90,_0x57b6c9){_0x57b6c9=_0x57b6c9||0xc8;return function(_0x1eb0fa){if(_0x1eb0fa){return _0x15de90[_0xb1c3('0x19')](_0x57b6c9)[_0xb1c3('0x1a')](_0x1eb0fa);}};}function respondWithFilteredResult(_0x378d7a,_0x1bd7e7){return function(_0x4e5f43){if(_0x4e5f43){var _0x3397f0=typeof _0x1bd7e7[_0xb1c3('0x1b')]===_0xb1c3('0x1c')&&typeof _0x1bd7e7[_0xb1c3('0x1d')]===_0xb1c3('0x1c');var _0x599810=_0x4e5f43[_0xb1c3('0x1e')];var _0x2bdeed=_0x3397f0?0x0:_0x1bd7e7[_0xb1c3('0x1b')];var _0x36b25f=_0x3397f0?_0x4e5f43[_0xb1c3('0x1e')]:_0x1bd7e7[_0xb1c3('0x1b')]+_0x1bd7e7[_0xb1c3('0x1d')];var _0x3d0672;if(_0x36b25f>=_0x599810){_0x36b25f=_0x599810;_0x3d0672=0xc8;}else{_0x3d0672=0xce;}_0x378d7a[_0xb1c3('0x19')](_0x3d0672);return _0x378d7a[_0xb1c3('0x1f')](_0xb1c3('0x20'),_0x2bdeed+'-'+_0x36b25f+'/'+_0x599810)[_0xb1c3('0x1a')](_0x4e5f43);}return null;};}function patchUpdates(_0x10c351){return function(_0x5a0950){try{jsonpatch[_0xb1c3('0x21')](_0x5a0950,_0x10c351,!![]);}catch(_0x443040){return BPromise[_0xb1c3('0x22')](_0x443040);}return _0x5a0950[_0xb1c3('0x23')]();};}function saveUpdates(_0x8570d4,_0x236dd6){return function(_0x585d4b){if(_0x585d4b){return _0x585d4b['update'](_0x8570d4)[_0xb1c3('0x24')](function(_0x430a94){return _0x430a94;});}return null;};}function removeEntity(_0x59d11c,_0xdb96){return function(_0x3778fa){if(_0x3778fa){return _0x3778fa[_0xb1c3('0x25')]()[_0xb1c3('0x24')](function(){_0x59d11c['status'](0xcc)[_0xb1c3('0x18')]();});}};}function handleEntityNotFound(_0x1cefff,_0x3614ae){return function(_0x1bfd04){if(!_0x1bfd04){_0x1cefff[_0xb1c3('0x17')](0x194);}return _0x1bfd04;};}function handleError(_0x5c7f13,_0x31aabe){_0x31aabe=_0x31aabe||0x1f4;return function(_0xc6c566){logger[_0xb1c3('0x26')](_0xc6c566[_0xb1c3('0x27')]);if(_0xc6c566[_0xb1c3('0x28')]){delete _0xc6c566[_0xb1c3('0x28')];}_0x5c7f13[_0xb1c3('0x19')](_0x31aabe)[_0xb1c3('0x29')](_0xc6c566);};}exports[_0xb1c3('0x2a')]=function(_0x31ce8a,_0x1c2ed8){var _0x3a91bb={'raw':!![],'where':{'id':_0x31ce8a['params']['id']}},_0x11eb58={};_0x11eb58[_0xb1c3('0x2b')]=_['keys'](db[_0xb1c3('0x2c')]['rawAttributes']);_0x11eb58[_0xb1c3('0x2d')]=_[_0xb1c3('0x2e')](_0x31ce8a[_0xb1c3('0x2d')]);_0x11eb58[_0xb1c3('0x2f')]=_[_0xb1c3('0x30')](_0x11eb58[_0xb1c3('0x2b')],_0x11eb58['query']);_0x3a91bb['attributes']=_[_0xb1c3('0x30')](_0x11eb58[_0xb1c3('0x2b')],qs[_0xb1c3('0x31')](_0x31ce8a[_0xb1c3('0x2d')][_0xb1c3('0x31')]));_0x3a91bb[_0xb1c3('0x32')]=_0x3a91bb[_0xb1c3('0x32')]['length']?_0x3a91bb[_0xb1c3('0x32')]:_0x11eb58['model'];if(_0x31ce8a[_0xb1c3('0x2d')][_0xb1c3('0x33')]){_0x3a91bb['include']=[{'all':!![]}];}_0x3a91bb=_[_0xb1c3('0x34')]({},_0x3a91bb,_0x31ce8a[_0xb1c3('0x35')]);return db[_0xb1c3('0x2c')][_0xb1c3('0x36')](_0x3a91bb)['then'](handleEntityNotFound(_0x1c2ed8,null))[_0xb1c3('0x24')](respondWithResult(_0x1c2ed8,null))[_0xb1c3('0x37')](handleError(_0x1c2ed8,null));};exports[_0xb1c3('0x38')]=function(_0x450ddb,_0x30b4e0){return db[_0xb1c3('0x2c')][_0xb1c3('0x38')](_0x450ddb[_0xb1c3('0x39')],{})[_0xb1c3('0x24')](respondWithResult(_0x30b4e0,0xc9))[_0xb1c3('0x37')](handleError(_0x30b4e0,null));};exports[_0xb1c3('0x3a')]=function(_0x379c9a,_0x5dbed9){if(_0x379c9a[_0xb1c3('0x39')]['id']){delete _0x379c9a[_0xb1c3('0x39')]['id'];}return db['ChatProactiveAction'][_0xb1c3('0x36')]({'where':{'id':_0x379c9a[_0xb1c3('0x3b')]['id']}})[_0xb1c3('0x24')](handleEntityNotFound(_0x5dbed9,null))[_0xb1c3('0x24')](saveUpdates(_0x379c9a[_0xb1c3('0x39')],null))[_0xb1c3('0x24')](respondWithResult(_0x5dbed9,null))[_0xb1c3('0x37')](handleError(_0x5dbed9,null));};exports[_0xb1c3('0x25')]=function(_0x50a485,_0x2e6bdc){return db[_0xb1c3('0x2c')][_0xb1c3('0x36')]({'where':{'id':_0x50a485['params']['id']}})['then'](handleEntityNotFound(_0x2e6bdc,null))[_0xb1c3('0x24')](removeEntity(_0x2e6bdc,null))[_0xb1c3('0x37')](handleError(_0x2e6bdc,null));}; \ No newline at end of file +var _0x3c6c=['include','options','ChatProactiveAction','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length'];(function(_0x4f50bd,_0x1aa1c3){var _0x2b8c4f=function(_0x1291e7){while(--_0x1291e7){_0x4f50bd['push'](_0x4f50bd['shift']());}};_0x2b8c4f(++_0x1aa1c3);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x4a98d4,_0x26d9dd){_0x4a98d4=_0x4a98d4-0x0;var _0x4f23f0=_0x3c6c[_0x4a98d4];return _0x4f23f0;};'use strict';var emlformat=require(_0xc3c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc3c6('0x1'));var jsonpatch=require(_0xc3c6('0x2'));var rp=require(_0xc3c6('0x3'));var moment=require(_0xc3c6('0x4'));var BPromise=require(_0xc3c6('0x5'));var Mustache=require(_0xc3c6('0x6'));var util=require(_0xc3c6('0x7'));var path=require(_0xc3c6('0x8'));var sox=require('sox');var csv=require(_0xc3c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc3c6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc3c6('0x9'));var querystring=require(_0xc3c6('0xb'));var Papa=require('papaparse');var Redis=require(_0xc3c6('0xc'));var authService=require(_0xc3c6('0xd'));var qs=require(_0xc3c6('0xe'));var as=require(_0xc3c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc3c6('0x10'))(_0xc3c6('0x11'));var utils=require(_0xc3c6('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc3c6('0x13'))['db'];function respondWithStatusCode(_0x407147,_0x1d18e3){_0x1d18e3=_0x1d18e3||0xcc;return function(_0x648a0){if(_0x648a0){return _0x407147[_0xc3c6('0x14')](_0x1d18e3);}return _0x407147[_0xc3c6('0x15')](_0x1d18e3)[_0xc3c6('0x16')]();};}function respondWithResult(_0x28a431,_0x34eeeb){_0x34eeeb=_0x34eeeb||0xc8;return function(_0x55c1d8){if(_0x55c1d8){return _0x28a431[_0xc3c6('0x15')](_0x34eeeb)[_0xc3c6('0x17')](_0x55c1d8);}};}function respondWithFilteredResult(_0x37a6a8,_0x25d2bd){return function(_0x283506){if(_0x283506){var _0x42c631=typeof _0x25d2bd[_0xc3c6('0x18')]===_0xc3c6('0x19')&&typeof _0x25d2bd[_0xc3c6('0x1a')]===_0xc3c6('0x19');var _0x64c62a=_0x283506[_0xc3c6('0x1b')];var _0x26c9b0=_0x42c631?0x0:_0x25d2bd[_0xc3c6('0x18')];var _0x3003e1=_0x42c631?_0x283506[_0xc3c6('0x1b')]:_0x25d2bd['offset']+_0x25d2bd[_0xc3c6('0x1a')];var _0x5a2456;if(_0x3003e1>=_0x64c62a){_0x3003e1=_0x64c62a;_0x5a2456=0xc8;}else{_0x5a2456=0xce;}_0x37a6a8[_0xc3c6('0x15')](_0x5a2456);return _0x37a6a8[_0xc3c6('0x1c')](_0xc3c6('0x1d'),_0x26c9b0+'-'+_0x3003e1+'/'+_0x64c62a)[_0xc3c6('0x17')](_0x283506);}return null;};}function patchUpdates(_0xfe2f70){return function(_0x3490a2){try{jsonpatch[_0xc3c6('0x1e')](_0x3490a2,_0xfe2f70,!![]);}catch(_0x22aa76){return BPromise[_0xc3c6('0x1f')](_0x22aa76);}return _0x3490a2[_0xc3c6('0x20')]();};}function saveUpdates(_0x2a99a0,_0x392d20){return function(_0x3d03b0){if(_0x3d03b0){return _0x3d03b0[_0xc3c6('0x21')](_0x2a99a0)['then'](function(_0x24fb2d){return _0x24fb2d;});}return null;};}function removeEntity(_0x40893b,_0x2bced6){return function(_0x565a86){if(_0x565a86){return _0x565a86[_0xc3c6('0x22')]()[_0xc3c6('0x23')](function(){_0x40893b[_0xc3c6('0x15')](0xcc)[_0xc3c6('0x16')]();});}};}function handleEntityNotFound(_0x2bc9bf,_0x47808f){return function(_0x1a0e3b){if(!_0x1a0e3b){_0x2bc9bf['sendStatus'](0x194);}return _0x1a0e3b;};}function handleError(_0x104e80,_0x13b909){_0x13b909=_0x13b909||0x1f4;return function(_0x4ca76f){logger[_0xc3c6('0x24')](_0x4ca76f[_0xc3c6('0x25')]);if(_0x4ca76f[_0xc3c6('0x26')]){delete _0x4ca76f[_0xc3c6('0x26')];}_0x104e80[_0xc3c6('0x15')](_0x13b909)[_0xc3c6('0x27')](_0x4ca76f);};}exports[_0xc3c6('0x28')]=function(_0x2e4094,_0x1f1d36){var _0x478a4b={'raw':!![],'where':{'id':_0x2e4094[_0xc3c6('0x29')]['id']}},_0xb047b1={};_0xb047b1[_0xc3c6('0x2a')]=_[_0xc3c6('0x2b')](db['ChatProactiveAction'][_0xc3c6('0x2c')]);_0xb047b1[_0xc3c6('0x2d')]=_[_0xc3c6('0x2b')](_0x2e4094[_0xc3c6('0x2d')]);_0xb047b1[_0xc3c6('0x2e')]=_[_0xc3c6('0x2f')](_0xb047b1['model'],_0xb047b1[_0xc3c6('0x2d')]);_0x478a4b[_0xc3c6('0x30')]=_[_0xc3c6('0x2f')](_0xb047b1[_0xc3c6('0x2a')],qs[_0xc3c6('0x31')](_0x2e4094['query'][_0xc3c6('0x31')]));_0x478a4b[_0xc3c6('0x30')]=_0x478a4b[_0xc3c6('0x30')][_0xc3c6('0x32')]?_0x478a4b[_0xc3c6('0x30')]:_0xb047b1[_0xc3c6('0x2a')];if(_0x2e4094[_0xc3c6('0x2d')]['includeAll']){_0x478a4b[_0xc3c6('0x33')]=[{'all':!![]}];}_0x478a4b=_['merge']({},_0x478a4b,_0x2e4094[_0xc3c6('0x34')]);return db[_0xc3c6('0x35')][_0xc3c6('0x36')](_0x478a4b)[_0xc3c6('0x23')](handleEntityNotFound(_0x1f1d36,null))[_0xc3c6('0x23')](respondWithResult(_0x1f1d36,null))[_0xc3c6('0x37')](handleError(_0x1f1d36,null));};exports['create']=function(_0x36562e,_0x2bba67){return db['ChatProactiveAction'][_0xc3c6('0x38')](_0x36562e[_0xc3c6('0x39')],{})[_0xc3c6('0x23')](respondWithResult(_0x2bba67,0xc9))[_0xc3c6('0x37')](handleError(_0x2bba67,null));};exports[_0xc3c6('0x21')]=function(_0x377a2f,_0x21163c){if(_0x377a2f['body']['id']){delete _0x377a2f['body']['id'];}return db[_0xc3c6('0x35')][_0xc3c6('0x36')]({'where':{'id':_0x377a2f[_0xc3c6('0x29')]['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0x21163c,null))[_0xc3c6('0x23')](saveUpdates(_0x377a2f['body'],null))[_0xc3c6('0x23')](respondWithResult(_0x21163c,null))[_0xc3c6('0x37')](handleError(_0x21163c,null));};exports[_0xc3c6('0x22')]=function(_0x4aae1e,_0x1eb423){return db[_0xc3c6('0x35')][_0xc3c6('0x36')]({'where':{'id':_0x4aae1e[_0xc3c6('0x29')]['id']}})[_0xc3c6('0x23')](handleEntityNotFound(_0x1eb423,null))['then'](removeEntity(_0x1eb423,null))[_0xc3c6('0x37')](handleError(_0x1eb423,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index eb91abd..d597d96 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 _0xc596=['chat_proactive_actions','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','define','ChatProactiveAction'];(function(_0x2cbc4c,_0x2d4b9b){var _0x27befe=function(_0x5addcc){while(--_0x5addcc){_0x2cbc4c['push'](_0x2cbc4c['shift']());}};_0x27befe(++_0x2d4b9b);}(_0xc596,0x135));var _0x6c59=function(_0x47c1f4,_0x4847a5){_0x47c1f4=_0x47c1f4-0x0;var _0x3e17b3=_0xc596[_0x47c1f4];return _0x3e17b3;};'use strict';var _=require('lodash');var util=require(_0x6c59('0x0'));var logger=require(_0x6c59('0x1'))('api');var moment=require(_0x6c59('0x2'));var BPromise=require('bluebird');var rp=require(_0x6c59('0x3'));var fs=require('fs');var path=require(_0x6c59('0x4'));var rimraf=require(_0x6c59('0x5'));var config=require(_0x6c59('0x6'));var attributes=require(_0x6c59('0x7'));module['exports']=function(_0x52df95,_0x5e47ca){return _0x52df95[_0x6c59('0x8')](_0x6c59('0x9'),attributes,{'tableName':_0x6c59('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcffb=['path','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api','bluebird'];(function(_0x22d331,_0x43c9c1){var _0x10eeb4=function(_0x5cc85e){while(--_0x5cc85e){_0x22d331['push'](_0x22d331['shift']());}};_0x10eeb4(++_0x43c9c1);}(_0xcffb,0x167));var _0xbcff=function(_0x1a6c4f,_0x54f584){_0x1a6c4f=_0x1a6c4f-0x0;var _0x211051=_0xcffb[_0x1a6c4f];return _0x211051;};'use strict';var _=require(_0xbcff('0x0'));var util=require('util');var logger=require(_0xbcff('0x1'))(_0xbcff('0x2'));var moment=require('moment');var BPromise=require(_0xbcff('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcff('0x4'));var rimraf=require('rimraf');var config=require(_0xbcff('0x5'));var attributes=require(_0xbcff('0x6'));module[_0xbcff('0x7')]=function(_0x57aeb9,_0x11946f){return _0x57aeb9[_0xbcff('0x8')](_0xbcff('0x9'),attributes,{'tableName':_0xbcff('0xa'),'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 3a6d596..7d8f85b 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 _0xddfc=['jayson/promise','http','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x27eccc,_0x52bad3){var _0xa8c013=function(_0x597dab){while(--_0x597dab){_0x27eccc['push'](_0x27eccc['shift']());}};_0xa8c013(++_0x52bad3);}(_0xddfc,0x1bb));var _0xcddf=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xddfc[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var util=require(_0xcddf('0x0'));var moment=require(_0xcddf('0x1'));var BPromise=require(_0xcddf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcddf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcddf('0x4'));var logger=require(_0xcddf('0x5'))(_0xcddf('0x6'));var config=require('../../config/environment');var jayson=require(_0xcddf('0x7'));var client=jayson['client'][_0xcddf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52f751,_0x3d4cb0,_0xd738cb){return new BPromise(function(_0x55f8f,_0x1d7a7c){return client['request'](_0x52f751,_0xd738cb)[_0xcddf('0x9')](function(_0x4b80ca){logger[_0xcddf('0xa')](_0xcddf('0xb'),_0x3d4cb0,'request\x20sent');logger[_0xcddf('0xc')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x3d4cb0,_0xcddf('0xd'),JSON['stringify'](_0x4b80ca));if(_0x4b80ca['error']){if(_0x4b80ca[_0xcddf('0xe')]['code']===0x1f4){logger[_0xcddf('0xe')](_0xcddf('0xb'),_0x3d4cb0,_0x4b80ca[_0xcddf('0xe')][_0xcddf('0xf')]);return _0x1d7a7c(_0x4b80ca[_0xcddf('0xe')][_0xcddf('0xf')]);}logger[_0xcddf('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x3d4cb0,_0x4b80ca[_0xcddf('0xe')]['message']);return _0x55f8f(_0x4b80ca[_0xcddf('0xe')][_0xcddf('0xf')]);}else{logger[_0xcddf('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x3d4cb0,_0xcddf('0xd'));_0x55f8f(_0x4b80ca[_0xcddf('0x10')]['message']);}})[_0xcddf('0x11')](function(_0x1c8d06){logger[_0xcddf('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x3d4cb0,_0x1c8d06);_0x1d7a7c(_0x1c8d06);});});} \ No newline at end of file +var _0xd187=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x7094ee,_0x426c09){var _0x1fbb8b=function(_0x778a38){while(--_0x778a38){_0x7094ee['push'](_0x7094ee['shift']());}};_0x1fbb8b(++_0x426c09);}(_0xd187,0x1ba));var _0x7d18=function(_0xf80b3,_0x25d5f3){_0xf80b3=_0xf80b3-0x0;var _0x10c489=_0xd187[_0xf80b3];return _0x10c489;};'use strict';var _=require('lodash');var util=require(_0x7d18('0x0'));var moment=require(_0x7d18('0x1'));var BPromise=require(_0x7d18('0x2'));var rs=require(_0x7d18('0x3'));var fs=require('fs');var Redis=require(_0x7d18('0x4'));var db=require(_0x7d18('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7d18('0x6'));var config=require(_0x7d18('0x7'));var jayson=require(_0x7d18('0x8'));var client=jayson[_0x7d18('0x9')][_0x7d18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x223ef4,_0x46a4c3,_0x1d0d3b){return new BPromise(function(_0x1d8fe2,_0x1d95af){return client[_0x7d18('0xb')](_0x223ef4,_0x1d0d3b)[_0x7d18('0xc')](function(_0x15008d){logger[_0x7d18('0xd')](_0x7d18('0xe'),_0x46a4c3,_0x7d18('0xf'));logger[_0x7d18('0x10')](_0x7d18('0x11'),_0x46a4c3,_0x7d18('0xf'),JSON['stringify'](_0x15008d));if(_0x15008d[_0x7d18('0x12')]){if(_0x15008d['error'][_0x7d18('0x13')]===0x1f4){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x46a4c3,_0x15008d[_0x7d18('0x12')]['message']);return _0x1d95af(_0x15008d[_0x7d18('0x12')][_0x7d18('0x14')]);}logger[_0x7d18('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x46a4c3,_0x15008d['error']['message']);return _0x1d8fe2(_0x15008d[_0x7d18('0x12')][_0x7d18('0x14')]);}else{logger[_0x7d18('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x46a4c3,_0x7d18('0xf'));_0x1d8fe2(_0x15008d['result'][_0x7d18('0x14')]);}})[_0x7d18('0x15')](function(_0x24ec90){logger[_0x7d18('0x12')](_0x7d18('0xe'),_0x46a4c3,_0x24ec90);_0x1d95af(_0x24ec90);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 9cfd81f..3ef300e 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 _0x3eea=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','post','create','update','isAuthenticated','destroy','multer'];(function(_0x385509,_0x39394b){var _0x452d52=function(_0x1d6645){while(--_0x1d6645){_0x385509['push'](_0x385509['shift']());}};_0x452d52(++_0x39394b);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x4d6284,_0x1a41d6){_0x4d6284=_0x4d6284-0x0;var _0x1d794e=_0x3eea[_0x4d6284];return _0x1d794e;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var fs_extra=require(_0xa3ee('0x5'));var auth=require(_0xa3ee('0x6'));var interaction=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var controller=require(_0xa3ee('0x9'));router[_0xa3ee('0xa')](_0xa3ee('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa3ee('0xc')]('/',auth['isAuthenticated'](),controller[_0xa3ee('0xd')]);router['put'](_0xa3ee('0xb'),auth['isAuthenticated'](),controller[_0xa3ee('0xe')]);router['delete'](_0xa3ee('0xb'),auth[_0xa3ee('0xf')](),controller[_0xa3ee('0x10')]);module['exports']=router; \ No newline at end of file +var _0x038b=['isAuthenticated','/:id','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','show','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x038b,0x114));var _0xb038=function(_0x4778c2,_0x13b1f2){_0x4778c2=_0x4778c2-0x0;var _0x4cb2f1=_0x038b[_0x4778c2];return _0x4cb2f1;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb038('0x8')]);router[_0xb038('0x9')]('/',auth[_0xb038('0xa')](),controller['create']);router['put'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['update']);router['delete'](_0xb038('0xb'),auth[_0xb038('0xa')](),controller['destroy']);module[_0xb038('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 41cb613..59d1f8c 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 _0x1791=['INTEGER','ENUM','beepall','sequelize','exports','STRING'];(function(_0x4b4865,_0xb43449){var _0x190dc2=function(_0x2b41f7){while(--_0x2b41f7){_0x4b4865['push'](_0x4b4865['shift']());}};_0x190dc2(++_0xb43449);}(_0x1791,0x17d));var _0x1179=function(_0x3ee44d,_0x17c3ad){_0x3ee44d=_0x3ee44d-0x0;var _0x3599a0=_0x1791[_0x3ee44d];return _0x3599a0;};'use strict';var Sequelize=require(_0x1179('0x0'));module[_0x1179('0x1')]={'name':{'type':Sequelize[_0x1179('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1179('0x2')]},'timeout':{'type':Sequelize[_0x1179('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1179('0x4')]('rrmemory',_0x1179('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x675a=['roundrobin','sequelize','STRING','INTEGER','rrmemory','beepall'];(function(_0xe7c786,_0xcad8a5){var _0x43e3c3=function(_0x440525){while(--_0x440525){_0xe7c786['push'](_0xe7c786['shift']());}};_0x43e3c3(++_0xcad8a5);}(_0x675a,0x109));var _0xa675=function(_0x126a49,_0x1dd0b4){_0x126a49=_0x126a49-0x0;var _0x29f28b=_0x675a[_0x126a49];return _0x29f28b;};'use strict';var Sequelize=require(_0xa675('0x0'));module['exports']={'name':{'type':Sequelize[_0xa675('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa675('0x1')]},'timeout':{'type':Sequelize[_0xa675('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xa675('0x3'),_0xa675('0x4'),_0xa675('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index ac6e3f0..f308c28 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 _0x0baf=['Team','addTeams','ids','Agents','flatMap','sequelize','transaction','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','team_has_chat_queues','join','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','ChatQueue,\x20%s,\x20%s','message','catch','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','sendStatus','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','UserId','agent','chatPause','updatedAt','createdAt','SIP','getTeams'];(function(_0x3af223,_0x4dc898){var _0x4ba964=function(_0x372a53){while(--_0x372a53){_0x3af223['push'](_0x3af223['shift']());}};_0x4ba964(++_0x4dc898);}(_0x0baf,0xb7));var _0xf0ba=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0x0baf[_0x11f249];return _0x5c3656;};'use strict';var emlformat=require(_0xf0ba('0x0'));var rimraf=require(_0xf0ba('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0ba('0x2'));var rp=require(_0xf0ba('0x3'));var moment=require(_0xf0ba('0x4'));var BPromise=require(_0xf0ba('0x5'));var Mustache=require('mustache');var util=require(_0xf0ba('0x6'));var path=require(_0xf0ba('0x7'));var sox=require(_0xf0ba('0x8'));var csv=require('to-csv');var ejs=require(_0xf0ba('0x9'));var fs=require('fs');var fs_extra=require(_0xf0ba('0xa'));var _=require('lodash');var squel=require(_0xf0ba('0xb'));var crypto=require('crypto');var jsforce=require(_0xf0ba('0xc'));var deskjs=require(_0xf0ba('0xd'));var toCsv=require(_0xf0ba('0xe'));var querystring=require(_0xf0ba('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf0ba('0x10'));var qs=require(_0xf0ba('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf0ba('0x12'));var logger=require(_0xf0ba('0x13'))(_0xf0ba('0x14'));var utils=require(_0xf0ba('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf0ba('0x16'));var db=require('../../mysqldb')['db'];config[_0xf0ba('0x17')]=_[_0xf0ba('0x18')](config['redis'],{'host':_0xf0ba('0x19'),'port':0x18eb});var socket=require(_0xf0ba('0x1a'))(new Redis(config[_0xf0ba('0x17')]));require(_0xf0ba('0x1b'))[_0xf0ba('0x1c')](socket);var jayson=require(_0xf0ba('0x1d'));var client=jayson[_0xf0ba('0x1e')][_0xf0ba('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4ec959,_0x1b9aa9,_0x54eb79,_0x5770a8){return new BPromise(function(_0x31a91e,_0x5a7407){var _0x36a92d=_0x5770a8||client;return _0x36a92d[_0xf0ba('0x20')](_0x4ec959,_0x54eb79)[_0xf0ba('0x21')](function(_0x17a5d1){logger[_0xf0ba('0x22')]('ChatQueue,\x20%s,\x20%s',_0x1b9aa9,_0xf0ba('0x23'));logger[_0xf0ba('0x24')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1b9aa9,_0xf0ba('0x23'),JSON[_0xf0ba('0x25')](_0x17a5d1));if(_0x17a5d1[_0xf0ba('0x26')]){if(_0x17a5d1[_0xf0ba('0x26')]['code']===0x1f4){logger[_0xf0ba('0x26')](_0xf0ba('0x27'),_0x1b9aa9,_0x17a5d1[_0xf0ba('0x26')][_0xf0ba('0x28')]);return _0x5a7407(_0x17a5d1[_0xf0ba('0x26')][_0xf0ba('0x28')]);}logger['error'](_0xf0ba('0x27'),_0x1b9aa9,_0x17a5d1['error'][_0xf0ba('0x28')]);return _0x31a91e(_0x17a5d1['error']['message']);}else{logger[_0xf0ba('0x22')]('ChatQueue,\x20%s,\x20%s',_0x1b9aa9,'request\x20sent');_0x31a91e(_0x17a5d1['result'][_0xf0ba('0x28')]);}})[_0xf0ba('0x29')](function(_0x41882c){logger[_0xf0ba('0x26')]('ChatQueue,\x20%s,\x20%s',_0x1b9aa9,_0x41882c);_0x5a7407(_0x41882c);});});}function respondWithStatusCode(_0x2b2744,_0x121772){_0x121772=_0x121772||0xcc;return function(_0x54b715){if(_0x54b715){return _0x2b2744['sendStatus'](_0x121772);}return _0x2b2744[_0xf0ba('0x2a')](_0x121772)[_0xf0ba('0x2b')]();};}function respondWithResult(_0x4a78d3,_0x379422){_0x379422=_0x379422||0xc8;return function(_0x48e393){if(_0x48e393){return _0x4a78d3[_0xf0ba('0x2a')](_0x379422)['json'](_0x48e393);}};}function respondWithFilteredResult(_0x220aec,_0x1c821e){return function(_0x53e46c){if(_0x53e46c){var _0x502cfd=typeof _0x1c821e[_0xf0ba('0x2c')]===_0xf0ba('0x2d')&&typeof _0x1c821e[_0xf0ba('0x2e')]==='undefined';var _0x247432=_0x53e46c[_0xf0ba('0x2f')];var _0x4da7be=_0x502cfd?0x0:_0x1c821e[_0xf0ba('0x2c')];var _0x5b3f6d=_0x502cfd?_0x53e46c[_0xf0ba('0x2f')]:_0x1c821e['offset']+_0x1c821e[_0xf0ba('0x2e')];var _0x3228d0;if(_0x5b3f6d>=_0x247432){_0x5b3f6d=_0x247432;_0x3228d0=0xc8;}else{_0x3228d0=0xce;}_0x220aec[_0xf0ba('0x2a')](_0x3228d0);return _0x220aec[_0xf0ba('0x30')](_0xf0ba('0x31'),_0x4da7be+'-'+_0x5b3f6d+'/'+_0x247432)['json'](_0x53e46c);}return null;};}function patchUpdates(_0x53a434){return function(_0x378a50){try{jsonpatch[_0xf0ba('0x32')](_0x378a50,_0x53a434,!![]);}catch(_0x220bce){return BPromise[_0xf0ba('0x33')](_0x220bce);}return _0x378a50[_0xf0ba('0x34')]();};}function saveUpdates(_0x56d3fe,_0x2a598b){return function(_0x40aba3){if(_0x40aba3){return _0x40aba3[_0xf0ba('0x35')](_0x56d3fe)['then'](function(_0x4f230b){return _0x4f230b;});}return null;};}function removeEntity(_0x311f28,_0x739fbe){return function(_0x4f163f){if(_0x4f163f){return _0x4f163f[_0xf0ba('0x36')]()['then'](function(){var _0x341f12=_0x4f163f[_0xf0ba('0x37')]({'plain':!![]});var _0x590f2b=_0xf0ba('0x38');return db[_0xf0ba('0x39')][_0xf0ba('0x36')]({'where':{'type':_0x590f2b,'resourceId':_0x341f12['id']}})[_0xf0ba('0x21')](function(){return _0x4f163f;});})[_0xf0ba('0x21')](function(){_0x311f28[_0xf0ba('0x2a')](0xcc)[_0xf0ba('0x2b')]();});}};}function handleEntityNotFound(_0xb2fb5a,_0x7344da){return function(_0x1d7644){if(!_0x1d7644){_0xb2fb5a[_0xf0ba('0x3a')](0x194);}return _0x1d7644;};}function handleError(_0xc5fc8c,_0x3260f7){_0x3260f7=_0x3260f7||0x1f4;return function(_0xc89ae7){logger[_0xf0ba('0x26')](_0xc89ae7['stack']);if(_0xc89ae7[_0xf0ba('0x3b')]){delete _0xc89ae7[_0xf0ba('0x3b')];}_0xc5fc8c[_0xf0ba('0x2a')](_0x3260f7)[_0xf0ba('0x3c')](_0xc89ae7);};}exports['index']=function(_0x57a49c,_0x13010d){var _0x175400={},_0x4d4d2b={},_0x4d3937={'count':0x0,'rows':[]};var _0x4d9f4e=_[_0xf0ba('0x3d')](db[_0xf0ba('0x3e')][_0xf0ba('0x3f')],function(_0xd625e5){return{'name':_0xd625e5[_0xf0ba('0x40')],'type':_0xd625e5[_0xf0ba('0x41')][_0xf0ba('0x42')]};});_0x4d4d2b[_0xf0ba('0x43')]=_[_0xf0ba('0x3d')](_0x4d9f4e,_0xf0ba('0x3b'));_0x4d4d2b[_0xf0ba('0x44')]=_[_0xf0ba('0x45')](_0x57a49c[_0xf0ba('0x44')]);_0x4d4d2b['filters']=_['intersection'](_0x4d4d2b[_0xf0ba('0x43')],_0x4d4d2b[_0xf0ba('0x44')]);_0x175400[_0xf0ba('0x46')]=_[_0xf0ba('0x47')](_0x4d4d2b[_0xf0ba('0x43')],qs[_0xf0ba('0x48')](_0x57a49c[_0xf0ba('0x44')][_0xf0ba('0x48')]));_0x175400[_0xf0ba('0x46')]=_0x175400[_0xf0ba('0x46')][_0xf0ba('0x49')]?_0x175400[_0xf0ba('0x46')]:_0x4d4d2b['model'];if(!_0x57a49c[_0xf0ba('0x44')][_0xf0ba('0x4a')](_0xf0ba('0x4b'))){_0x175400[_0xf0ba('0x2e')]=qs[_0xf0ba('0x2e')](_0x57a49c['query']['limit']);_0x175400[_0xf0ba('0x2c')]=qs[_0xf0ba('0x2c')](_0x57a49c[_0xf0ba('0x44')]['offset']);}_0x175400[_0xf0ba('0x4c')]=qs[_0xf0ba('0x4d')](_0x57a49c[_0xf0ba('0x44')][_0xf0ba('0x4d')]);_0x175400[_0xf0ba('0x4e')]=qs[_0xf0ba('0x4f')](_[_0xf0ba('0x50')](_0x57a49c[_0xf0ba('0x44')],_0x4d4d2b[_0xf0ba('0x4f')]),_0x4d9f4e);if(_0x57a49c['query'][_0xf0ba('0x51')]){_0x175400[_0xf0ba('0x4e')]=_[_0xf0ba('0x52')](_0x175400['where'],{'$or':_[_0xf0ba('0x3d')](_0x4d9f4e,function(_0x150a59){if(_0x150a59['type']!==_0xf0ba('0x53')){var _0x251137={};_0x251137[_0x150a59[_0xf0ba('0x3b')]]={'$like':'%'+_0x57a49c[_0xf0ba('0x44')]['filter']+'%'};return _0x251137;}})});}_0x175400=_['merge']({},_0x175400,_0x57a49c[_0xf0ba('0x54')]);var _0x4d2c31={'where':_0x175400[_0xf0ba('0x4e')]};return db['ChatQueue'][_0xf0ba('0x2f')](_0x4d2c31)[_0xf0ba('0x21')](function(_0x258348){_0x4d3937[_0xf0ba('0x2f')]=_0x258348;if(_0x57a49c[_0xf0ba('0x44')][_0xf0ba('0x55')]){_0x175400[_0xf0ba('0x56')]=[{'all':!![]}];}return db[_0xf0ba('0x3e')][_0xf0ba('0x57')](_0x175400);})[_0xf0ba('0x21')](function(_0x256306){_0x4d3937[_0xf0ba('0x58')]=_0x256306;return _0x4d3937;})[_0xf0ba('0x21')](respondWithFilteredResult(_0x13010d,_0x175400))[_0xf0ba('0x29')](handleError(_0x13010d,null));};exports[_0xf0ba('0x59')]=function(_0x4e1a7b,_0x284fc5){var _0x376c9a={'raw':!![],'where':{'id':_0x4e1a7b[_0xf0ba('0x5a')]['id']}},_0x370abf={};_0x370abf[_0xf0ba('0x43')]=_['keys'](db[_0xf0ba('0x3e')][_0xf0ba('0x3f')]);_0x370abf[_0xf0ba('0x44')]=_[_0xf0ba('0x45')](_0x4e1a7b['query']);_0x370abf[_0xf0ba('0x4f')]=_[_0xf0ba('0x47')](_0x370abf[_0xf0ba('0x43')],_0x370abf['query']);_0x376c9a['attributes']=_['intersection'](_0x370abf['model'],qs[_0xf0ba('0x48')](_0x4e1a7b[_0xf0ba('0x44')]['fields']));_0x376c9a['attributes']=_0x376c9a[_0xf0ba('0x46')][_0xf0ba('0x49')]?_0x376c9a[_0xf0ba('0x46')]:_0x370abf['model'];if(_0x4e1a7b['query'][_0xf0ba('0x55')]){_0x376c9a[_0xf0ba('0x56')]=[{'all':!![]}];}_0x376c9a=_[_0xf0ba('0x52')]({},_0x376c9a,_0x4e1a7b[_0xf0ba('0x54')]);return db[_0xf0ba('0x3e')]['find'](_0x376c9a)[_0xf0ba('0x21')](handleEntityNotFound(_0x284fc5,null))[_0xf0ba('0x21')](respondWithResult(_0x284fc5,null))['catch'](handleError(_0x284fc5,null));};exports['create']=function(_0x24f95a,_0x34340c){return db['ChatQueue']['create'](_0x24f95a[_0xf0ba('0x5b')],{})[_0xf0ba('0x21')](function(_0x1419f8){var _0x451987=_0x24f95a[_0xf0ba('0x5c')][_0xf0ba('0x37')]({'plain':!![]});if(!_0x451987)throw new Error(_0xf0ba('0x5d'));if(_0x451987['role']===_0xf0ba('0x5c')){var _0x2075d9=_0x1419f8[_0xf0ba('0x37')]({'plain':!![]});var _0x1906e6=_0xf0ba('0x38');return db['UserProfileSection'][_0xf0ba('0x5e')]({'where':{'name':_0x1906e6,'userProfileId':_0x451987[_0xf0ba('0x5f')]},'raw':!![]})[_0xf0ba('0x21')](function(_0x235678){if(_0x235678&&_0x235678[_0xf0ba('0x60')]===0x0){return db[_0xf0ba('0x39')]['create']({'name':_0x2075d9[_0xf0ba('0x3b')],'resourceId':_0x2075d9['id'],'type':_0x235678['name'],'sectionId':_0x235678['id']},{})[_0xf0ba('0x21')](function(){return _0x1419f8;});}else{return _0x1419f8;}})['catch'](function(_0xb187c3){logger[_0xf0ba('0x26')](_0xf0ba('0x61'),_0xb187c3);throw _0xb187c3;});}return _0x1419f8;})[_0xf0ba('0x21')](respondWithResult(_0x34340c,0xc9))[_0xf0ba('0x29')](handleError(_0x34340c,null));};exports[_0xf0ba('0x35')]=function(_0xdd1850,_0x12a610){if(_0xdd1850[_0xf0ba('0x5b')]['id']){delete _0xdd1850[_0xf0ba('0x5b')]['id'];}return db[_0xf0ba('0x3e')][_0xf0ba('0x5e')]({'where':{'id':_0xdd1850[_0xf0ba('0x5a')]['id']}})[_0xf0ba('0x21')](handleEntityNotFound(_0x12a610,null))[_0xf0ba('0x21')](saveUpdates(_0xdd1850[_0xf0ba('0x5b')],null))[_0xf0ba('0x21')](respondWithResult(_0x12a610,null))[_0xf0ba('0x29')](handleError(_0x12a610,null));};exports[_0xf0ba('0x36')]=function(_0x508c42,_0x317cf1){return db['ChatQueue']['find']({'where':{'id':_0x508c42['params']['id']}})[_0xf0ba('0x21')](handleEntityNotFound(_0x317cf1,null))[_0xf0ba('0x21')](removeEntity(_0x317cf1,null))[_0xf0ba('0x29')](handleError(_0x317cf1,null));};exports[_0xf0ba('0x62')]=function(_0x1899b5,_0x5485ed){return db[_0xf0ba('0x3e')]['describe']()[_0xf0ba('0x21')](respondWithResult(_0x5485ed,null))[_0xf0ba('0x29')](handleError(_0x5485ed,null));};exports[_0xf0ba('0x63')]=function(_0x55067f,_0x26ad6f,_0xecd26e){var _0x10aec8={'raw':!![],'where':{}},_0x105cef={},_0x433e86;return db['ChatQueue'][_0xf0ba('0x64')]({'where':{'id':_0x55067f[_0xf0ba('0x5a')]['id']}})['then'](handleEntityNotFound(_0x26ad6f,null))[_0xf0ba('0x21')](function(_0x47c951){if(_0x47c951){_0x433e86=_0x47c951['get']({'plain':!![]});_0x105cef[_0xf0ba('0x43')]=_[_0xf0ba('0x45')](db[_0xf0ba('0x65')][_0xf0ba('0x3f')]);_0x105cef[_0xf0ba('0x44')]=_[_0xf0ba('0x45')](_0x55067f[_0xf0ba('0x44')]);_0x105cef['filters']=_[_0xf0ba('0x47')](_0x105cef['model'],_0x105cef[_0xf0ba('0x44')]);_0x10aec8[_0xf0ba('0x46')]=_['intersection'](_0x105cef[_0xf0ba('0x43')],qs[_0xf0ba('0x48')](_0x55067f[_0xf0ba('0x44')]['fields']));_0x10aec8[_0xf0ba('0x46')]=_0x10aec8['attributes'][_0xf0ba('0x49')]?_0x10aec8[_0xf0ba('0x46')]:_0x105cef[_0xf0ba('0x43')];if(!_0x55067f['query'][_0xf0ba('0x4a')](_0xf0ba('0x4b'))){_0x10aec8[_0xf0ba('0x2e')]=qs[_0xf0ba('0x2e')](_0x55067f[_0xf0ba('0x44')][_0xf0ba('0x2e')]);_0x10aec8[_0xf0ba('0x2c')]=qs[_0xf0ba('0x2c')](_0x55067f[_0xf0ba('0x44')][_0xf0ba('0x2c')]);}_0x10aec8[_0xf0ba('0x4c')]=qs[_0xf0ba('0x4d')](_0x55067f[_0xf0ba('0x44')][_0xf0ba('0x4d')]);_0x10aec8['where']=qs[_0xf0ba('0x4f')](_['pick'](_0x55067f[_0xf0ba('0x44')],_0x105cef[_0xf0ba('0x4f')]));_0x10aec8['where'][_0xf0ba('0x66')]=_0x47c951['id'];if(_0x55067f[_0xf0ba('0x44')]['filter']){_0x10aec8[_0xf0ba('0x4e')]=_['merge'](_0x10aec8[_0xf0ba('0x4e')],{'$or':_['map'](_0x10aec8[_0xf0ba('0x46')],function(_0x3bb9f4){var _0x3354c1={};_0x3354c1[_0x3bb9f4]={'$like':'%'+_0x55067f[_0xf0ba('0x44')][_0xf0ba('0x51')]+'%'};return _0x3354c1;})});}_0x10aec8=_['merge']({},_0x10aec8,_0x55067f[_0xf0ba('0x54')]);return db[_0xf0ba('0x65')][_0xf0ba('0x57')](_0x10aec8);}})[_0xf0ba('0x21')](function(_0x2b1c8c){if(_0x2b1c8c){return db[_0xf0ba('0x67')]['findAndCountAll']({'where':{'id':_['map'](_0x2b1c8c,_0xf0ba('0x68')),'role':_0xf0ba('0x69')},'attributes':['id',_0xf0ba('0x3b'),_0xf0ba('0x6a'),_0xf0ba('0x6b'),_0xf0ba('0x6c')]});}})[_0xf0ba('0x21')](function(_0x37919b){if(_0x37919b){return{'count':_0x37919b[_0xf0ba('0x2f')],'rows':_[_0xf0ba('0x3d')](_0x37919b[_0xf0ba('0x58')],function(_0x5bc4b3){return{'membername':_0x5bc4b3[_0xf0ba('0x3b')],'UserId':_0x5bc4b3['id'],'queue_name':_0x433e86[_0xf0ba('0x3b')],'ChatQueueId':_0x433e86['id'],'interface':util['format']('%s/%s',_0xf0ba('0x6d'),_0x5bc4b3[_0xf0ba('0x3b')]),'penalty':0x0,'paused':_0x5bc4b3[_0xf0ba('0x6a')],'createdAt':_0x5bc4b3[_0xf0ba('0x6c')],'updatedAt':_0x5bc4b3[_0xf0ba('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf0ba('0x21')](respondWithFilteredResult(_0x26ad6f,_0x10aec8))[_0xf0ba('0x29')](handleError(_0x26ad6f,null));};exports[_0xf0ba('0x6e')]=function(_0x136508,_0x34ead2,_0x296bac){var _0x1ab80b={};var _0x5d15a5={};var _0x8e3f2a;var _0xfed04a;return db['ChatQueue'][_0xf0ba('0x64')]({'where':{'id':_0x136508['params']['id']}})[_0xf0ba('0x21')](handleEntityNotFound(_0x34ead2,null))[_0xf0ba('0x21')](function(_0xc1619f){if(_0xc1619f){_0x8e3f2a=_0xc1619f;_0x5d15a5[_0xf0ba('0x43')]=_[_0xf0ba('0x45')](db[_0xf0ba('0x6f')][_0xf0ba('0x3f')]);_0x5d15a5['query']=_[_0xf0ba('0x45')](_0x136508[_0xf0ba('0x44')]);_0x5d15a5[_0xf0ba('0x4f')]=_[_0xf0ba('0x47')](_0x5d15a5[_0xf0ba('0x43')],_0x5d15a5[_0xf0ba('0x44')]);_0x1ab80b[_0xf0ba('0x46')]=_['intersection'](_0x5d15a5[_0xf0ba('0x43')],qs[_0xf0ba('0x48')](_0x136508[_0xf0ba('0x44')]['fields']));_0x1ab80b[_0xf0ba('0x46')]=_0x1ab80b[_0xf0ba('0x46')][_0xf0ba('0x49')]?_0x1ab80b[_0xf0ba('0x46')]:_0x5d15a5[_0xf0ba('0x43')];_0x1ab80b['order']=qs[_0xf0ba('0x4d')](_0x136508[_0xf0ba('0x44')][_0xf0ba('0x4d')]);_0x1ab80b[_0xf0ba('0x4e')]=qs[_0xf0ba('0x4f')](_[_0xf0ba('0x50')](_0x136508[_0xf0ba('0x44')],_0x5d15a5['filters']));if(_0x136508[_0xf0ba('0x44')][_0xf0ba('0x51')]){_0x1ab80b['where']=_[_0xf0ba('0x52')](_0x1ab80b['where'],{'$or':_[_0xf0ba('0x3d')](_0x1ab80b[_0xf0ba('0x46')],function(_0x4ccaf3){var _0x9bcbb6={};_0x9bcbb6[_0x4ccaf3]={'$like':'%'+_0x136508[_0xf0ba('0x44')][_0xf0ba('0x51')]+'%'};return _0x9bcbb6;})});}_0x1ab80b=_[_0xf0ba('0x52')]({},_0x1ab80b,_0x136508['options']);return _0x8e3f2a[_0xf0ba('0x6e')](_0x1ab80b);}})[_0xf0ba('0x21')](function(_0x3cc4cf){if(_0x3cc4cf){_0xfed04a=_0x3cc4cf[_0xf0ba('0x49')];if(!_0x136508[_0xf0ba('0x44')]['hasOwnProperty'](_0xf0ba('0x4b'))){_0x1ab80b[_0xf0ba('0x2e')]=qs[_0xf0ba('0x2e')](_0x136508[_0xf0ba('0x44')][_0xf0ba('0x2e')]);_0x1ab80b[_0xf0ba('0x2c')]=qs[_0xf0ba('0x2c')](_0x136508[_0xf0ba('0x44')][_0xf0ba('0x2c')]);}return _0x8e3f2a[_0xf0ba('0x6e')](_0x1ab80b);}})['then'](function(_0x552321){if(_0x552321){return _0x552321?{'count':_0xfed04a,'rows':_0x552321}:null;}})[_0xf0ba('0x21')](respondWithResult(_0x34ead2,null))[_0xf0ba('0x29')](handleError(_0x34ead2,null));};exports[_0xf0ba('0x70')]=function(_0x4050c3,_0x4f23d4,_0x4cd112){var _0x354187=_0x4050c3[_0xf0ba('0x5b')][_0xf0ba('0x71')];return db[_0xf0ba('0x6f')][_0xf0ba('0x57')]({'where':{'id':_0x354187},'attributes':['id'],'include':[{'model':db[_0xf0ba('0x67')],'as':_0xf0ba('0x72'),'attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})[_0xf0ba('0x21')](function(_0x5acb35){if(_0x5acb35){var _0x4994dd=_[_0xf0ba('0x73')](_0x5acb35,function(_0x4f328a){var _0x519810=_0x4f328a[_0xf0ba('0x37')]({'plain':!![]});return _0x519810[_0xf0ba('0x72')];});return db[_0xf0ba('0x3e')]['find']({'where':{'id':_0x4050c3[_0xf0ba('0x5a')]['id']}})[_0xf0ba('0x21')](function(_0x15517d){return db[_0xf0ba('0x74')][_0xf0ba('0x75')](function(_0x3d32df){return _0x15517d[_0xf0ba('0x70')](_0x354187,{'transaction':_0x3d32df})['then'](function(){return BPromise['each'](_0x4994dd,function(_0x2b5b8){return db[_0xf0ba('0x65')]['findOrCreate']({'where':{'UserId':_0x2b5b8['id'],'ChatQueueId':_0x4050c3[_0xf0ba('0x5a')]['id']},'transaction':_0x3d32df});});})[_0xf0ba('0x21')](function(){_0x4994dd[_0xf0ba('0x76')](function(_0x11245b){socket[_0xf0ba('0x77')](_0xf0ba('0x78'),{'UserId':_0x11245b['id'],'ChatQueueId':_0x15517d['id']});});});});});}})[_0xf0ba('0x21')](respondWithStatusCode(_0x4f23d4,null))[_0xf0ba('0x29')](handleError(_0x4f23d4,null));};exports[_0xf0ba('0x79')]=function(_0x11ee01,_0xd5675c,_0x5bb3fe){return db['Team'][_0xf0ba('0x57')]({'where':{'id':_0x11ee01['query'][_0xf0ba('0x71')]},'attributes':['id'],'include':[{'model':db[_0xf0ba('0x67')],'as':_0xf0ba('0x72'),'attributes':['id'],'raw':!![]}]})[_0xf0ba('0x21')](handleEntityNotFound(_0xd5675c,null))[_0xf0ba('0x21')](function(_0x3ae4b4){var _0x11caef=_['map'](_0x3ae4b4,'id');var _0x30c92b=[];var _0xfe1e12=[];var _0x1248f5=squel[_0xf0ba('0x7a')]();_0x1248f5[_0xf0ba('0x7b')](_0xf0ba('0x7c'))['from'](_0xf0ba('0x7d'),'tq')[_0xf0ba('0x7e')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf0ba('0x4e')](_0xf0ba('0x7f'),_0x11ee01[_0xf0ba('0x5a')]['id']);for(var _0x31783d=0x0;_0x31783d<_0x3ae4b4[_0xf0ba('0x49')];_0x31783d+=0x1){let _0x3f0f06=_0x3ae4b4[_0x31783d];for(var _0x3dc831=0x0;_0x3dc831<_0x3f0f06[_0xf0ba('0x72')][_0xf0ba('0x49')];_0x3dc831+=0x1){let _0x47e204=_0x3f0f06[_0xf0ba('0x72')][_0x3dc831];var _0x3ba978=_0x1248f5[_0xf0ba('0x80')]();_0x3ba978[_0xf0ba('0x4e')](_0xf0ba('0x81'),_0x47e204['id']);_0xfe1e12[_0xf0ba('0x82')](db['sequelize'][_0xf0ba('0x44')](_0x3ba978[_0xf0ba('0x83')](),{'type':db[_0xf0ba('0x74')][_0xf0ba('0x84')][_0xf0ba('0x85')]})['then'](function(_0x1118b1){if(_0x1118b1[_0xf0ba('0x49')]===0x1){return _0x47e204['id'];}else{var _0x5810b0=_[_0xf0ba('0x86')](_[_0xf0ba('0x3d')](_0x1118b1,_0xf0ba('0x87')),function(_0x348d8d){return _[_0xf0ba('0x88')](_0x11caef,_0x348d8d);});if(_0x5810b0){return _0x47e204['id'];}}}));}}return BPromise['all'](_0xfe1e12)[_0xf0ba('0x21')](function(_0x439fdd){_0x30c92b=_(_0x30c92b)[_0xf0ba('0x89')](_0x439fdd)[_0xf0ba('0x8a')]()[_0xf0ba('0x8b')]();return db[_0xf0ba('0x3e')]['find']({'where':{'id':_0x11ee01['params']['id']}})[_0xf0ba('0x21')](function(_0x1d6d5d){return db[_0xf0ba('0x74')]['transaction'](function(_0x39df2d){return _0x1d6d5d['removeTeams'](_0x11ee01['query'][_0xf0ba('0x71')],{'transaction':_0x39df2d})[_0xf0ba('0x21')](function(){if(!_[_0xf0ba('0x8c')](_0x30c92b)){return _0x1d6d5d[_0xf0ba('0x8d')](_0x30c92b,{'transaction':_0x39df2d});}})[_0xf0ba('0x21')](function(){_0x30c92b[_0xf0ba('0x76')](function(_0x832a72){socket[_0xf0ba('0x77')](_0xf0ba('0x8e'),{'UserId':_0x832a72,'ChatQueueId':_0x1d6d5d['id']});});});});});});})[_0xf0ba('0x21')](respondWithStatusCode(_0xd5675c,null))[_0xf0ba('0x29')](handleError(_0xd5675c,null));};exports['addAgents']=function(_0x9ef342,_0x1a96f9,_0x1f062c){return db[_0xf0ba('0x3e')][_0xf0ba('0x5e')]({'where':{'id':_0x9ef342[_0xf0ba('0x5a')]['id']}})[_0xf0ba('0x21')](handleEntityNotFound(_0x1a96f9,null))[_0xf0ba('0x21')](function(_0x23b2f7){if(_0x23b2f7){return _0x23b2f7[_0xf0ba('0x8f')](_0x9ef342[_0xf0ba('0x5b')][_0xf0ba('0x71')],_[_0xf0ba('0x90')](_0x9ef342[_0xf0ba('0x5b')],[_0xf0ba('0x71'),'id'])||{})[_0xf0ba('0x91')](function(_0x33293c){for(var _0x4f6dad=0x0;_0x4f6dad<_0x9ef342[_0xf0ba('0x5b')][_0xf0ba('0x71')][_0xf0ba('0x49')];_0x4f6dad+=0x1){socket['emit'](_0xf0ba('0x78'),{'UserId':Number(_0x9ef342['body'][_0xf0ba('0x71')][_0x4f6dad]),'ChatQueueId':Number(_0x9ef342[_0xf0ba('0x5a')]['id'])});}return _0x33293c;});}})[_0xf0ba('0x21')](respondWithResult(_0x1a96f9,null))['catch'](handleError(_0x1a96f9,null));};exports[_0xf0ba('0x8d')]=function(_0x47ffa5,_0x4f1ae6,_0x27e59d){return db[_0xf0ba('0x3e')][_0xf0ba('0x5e')]({'where':{'id':_0x47ffa5[_0xf0ba('0x5a')]['id']}})[_0xf0ba('0x21')](handleEntityNotFound(_0x4f1ae6,null))['then'](function(_0xe27045){if(_0xe27045){return _0xe27045[_0xf0ba('0x8d')](_0x47ffa5['query']['ids'])['then'](function(){if(_['isArray'](_0x47ffa5['query'][_0xf0ba('0x71')])){for(var _0x1402b6=0x0;_0x1402b6<_0x47ffa5[_0xf0ba('0x44')]['ids'][_0xf0ba('0x49')];_0x1402b6+=0x1){socket[_0xf0ba('0x77')]('userChatQueue:remove',{'UserId':Number(_0x47ffa5['query'][_0xf0ba('0x71')][_0x1402b6]),'ChatQueueId':Number(_0x47ffa5[_0xf0ba('0x5a')]['id'])});}}else{socket['emit'](_0xf0ba('0x8e'),{'UserId':Number(_0x47ffa5[_0xf0ba('0x44')]['ids']),'ChatQueueId':Number(_0x47ffa5[_0xf0ba('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x4f1ae6,null))[_0xf0ba('0x29')](handleError(_0x4f1ae6,null));};exports[_0xf0ba('0x92')]=function(_0xc88941,_0x2a8650,_0x9304f2){var _0x26eaa7={};var _0x39e293={};var _0x3a7d68;var _0x15cd37;return db['ChatQueue'][_0xf0ba('0x64')]({'where':{'id':_0xc88941[_0xf0ba('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2a8650,null))[_0xf0ba('0x21')](function(_0x3fbffa){if(_0x3fbffa){_0x3a7d68=_0x3fbffa;_0x39e293['model']=_[_0xf0ba('0x45')](db[_0xf0ba('0x67')][_0xf0ba('0x3f')]);_0x39e293[_0xf0ba('0x44')]=_[_0xf0ba('0x45')](_0xc88941[_0xf0ba('0x44')]);_0x39e293[_0xf0ba('0x4f')]=_[_0xf0ba('0x47')](_0x39e293[_0xf0ba('0x43')],_0x39e293[_0xf0ba('0x44')]);_0x26eaa7[_0xf0ba('0x46')]=_[_0xf0ba('0x47')](_0x39e293['model'],qs[_0xf0ba('0x48')](_0xc88941[_0xf0ba('0x44')][_0xf0ba('0x48')]));_0x26eaa7[_0xf0ba('0x46')]=_0x26eaa7[_0xf0ba('0x46')][_0xf0ba('0x49')]?_0x26eaa7['attributes']:_0x39e293['model'];_0x26eaa7[_0xf0ba('0x4c')]=qs['sort'](_0xc88941[_0xf0ba('0x44')][_0xf0ba('0x4d')]);_0x26eaa7['where']=qs['filters'](_[_0xf0ba('0x50')](_0xc88941[_0xf0ba('0x44')],_0x39e293[_0xf0ba('0x4f')]));if(_0xc88941[_0xf0ba('0x44')]['filter']){_0x26eaa7[_0xf0ba('0x4e')]=_[_0xf0ba('0x52')](_0x26eaa7[_0xf0ba('0x4e')],{'$or':_[_0xf0ba('0x3d')](_0x26eaa7[_0xf0ba('0x46')],function(_0xfb833a){var _0x3d0c7a={};_0x3d0c7a[_0xfb833a]={'$like':'%'+_0xc88941[_0xf0ba('0x44')][_0xf0ba('0x51')]+'%'};return _0x3d0c7a;})});}_0x26eaa7=_[_0xf0ba('0x52')]({},_0x26eaa7,_0xc88941[_0xf0ba('0x54')]);return _0x3a7d68[_0xf0ba('0x92')](_0x26eaa7);}})['then'](function(_0x442110){if(_0x442110){_0x15cd37=_0x442110[_0xf0ba('0x49')];if(!_0xc88941[_0xf0ba('0x44')][_0xf0ba('0x4a')]('nolimit')){_0x26eaa7['limit']=qs[_0xf0ba('0x2e')](_0xc88941[_0xf0ba('0x44')][_0xf0ba('0x2e')]);_0x26eaa7[_0xf0ba('0x2c')]=qs['offset'](_0xc88941[_0xf0ba('0x44')][_0xf0ba('0x2c')]);}return _0x3a7d68['getAgents'](_0x26eaa7);}})['then'](function(_0x288109){if(_0x288109){return _0x288109?{'count':_0x15cd37,'rows':_0x288109}:null;}})[_0xf0ba('0x21')](respondWithResult(_0x2a8650,null))[_0xf0ba('0x29')](handleError(_0x2a8650,null));}; \ No newline at end of file +var _0x9ee6=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','jayson/promise','client','http','request','then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','offset','undefined','count','limit','set','json','apply','reject','update','destroy','get','ChatQueues','UserProfileResource','stack','name','map','ChatQueue','rawAttributes','fieldName','type','key','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','findOne','ChatQueueId','User','findAndCountAll','UserId','chatPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','findAll','online','flatMap','Agents','sequelize','each','findOrCreate','forEach','userChatQueue:save','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','union','value','transaction','removeTeams','isEmpty','removeAgents','emit','addAgents','spread','isArray','userChatQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x5a1a51,_0x144c79){var _0x47edd7=function(_0x2259bb){while(--_0x2259bb){_0x5a1a51['push'](_0x5a1a51['shift']());}};_0x47edd7(++_0x144c79);}(_0x9ee6,0x84));var _0x69ee=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0x9ee6[_0x4c4042];return _0xbd10dc;};'use strict';var emlformat=require(_0x69ee('0x0'));var rimraf=require(_0x69ee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x69ee('0x2'));var rp=require(_0x69ee('0x3'));var moment=require(_0x69ee('0x4'));var BPromise=require(_0x69ee('0x5'));var Mustache=require('mustache');var util=require(_0x69ee('0x6'));var path=require(_0x69ee('0x7'));var sox=require(_0x69ee('0x8'));var csv=require(_0x69ee('0x9'));var ejs=require(_0x69ee('0xa'));var fs=require('fs');var fs_extra=require(_0x69ee('0xb'));var _=require(_0x69ee('0xc'));var squel=require(_0x69ee('0xd'));var crypto=require(_0x69ee('0xe'));var jsforce=require(_0x69ee('0xf'));var deskjs=require(_0x69ee('0x10'));var toCsv=require(_0x69ee('0x9'));var querystring=require(_0x69ee('0x11'));var Papa=require(_0x69ee('0x12'));var Redis=require(_0x69ee('0x13'));var authService=require(_0x69ee('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x69ee('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x69ee('0x16'));var config=require(_0x69ee('0x17'));var licenseUtil=require(_0x69ee('0x18'));var db=require(_0x69ee('0x19'))['db'];config['redis']=_[_0x69ee('0x1a')](config[_0x69ee('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x69ee('0x1c'))(new Redis(config[_0x69ee('0x1b')]));require('./chatQueue.socket')['register'](socket);var jayson=require(_0x69ee('0x1d'));var client=jayson[_0x69ee('0x1e')][_0x69ee('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x371c59,_0x3dcc1f,_0x2572ae,_0x3a3423){return new BPromise(function(_0x1c758b,_0x22cd79){var _0x1d5c55=_0x3a3423||client;return _0x1d5c55[_0x69ee('0x20')](_0x371c59,_0x2572ae)[_0x69ee('0x21')](function(_0x568f56){logger[_0x69ee('0x22')]('ChatQueue,\x20%s,\x20%s',_0x3dcc1f,_0x69ee('0x23'));logger['debug'](_0x69ee('0x24'),_0x3dcc1f,_0x69ee('0x23'),JSON[_0x69ee('0x25')](_0x568f56));if(_0x568f56['error']){if(_0x568f56[_0x69ee('0x26')][_0x69ee('0x27')]===0x1f4){logger[_0x69ee('0x26')](_0x69ee('0x28'),_0x3dcc1f,_0x568f56[_0x69ee('0x26')][_0x69ee('0x29')]);return _0x22cd79(_0x568f56[_0x69ee('0x26')][_0x69ee('0x29')]);}logger[_0x69ee('0x26')]('ChatQueue,\x20%s,\x20%s',_0x3dcc1f,_0x568f56['error'][_0x69ee('0x29')]);return _0x1c758b(_0x568f56[_0x69ee('0x26')][_0x69ee('0x29')]);}else{logger[_0x69ee('0x22')]('ChatQueue,\x20%s,\x20%s',_0x3dcc1f,_0x69ee('0x23'));_0x1c758b(_0x568f56[_0x69ee('0x2a')][_0x69ee('0x29')]);}})[_0x69ee('0x2b')](function(_0x584b8c){logger[_0x69ee('0x26')]('ChatQueue,\x20%s,\x20%s',_0x3dcc1f,_0x584b8c);_0x22cd79(_0x584b8c);});});}function respondWithStatusCode(_0x527c4c,_0x59b04a){_0x59b04a=_0x59b04a||0xcc;return function(_0x3ff96b){if(_0x3ff96b){return _0x527c4c[_0x69ee('0x2c')](_0x59b04a);}return _0x527c4c['status'](_0x59b04a)[_0x69ee('0x2d')]();};}function respondWithResult(_0x1eee0b,_0x43bfcc){_0x43bfcc=_0x43bfcc||0xc8;return function(_0x10ac80){if(_0x10ac80){return _0x1eee0b[_0x69ee('0x2e')](_0x43bfcc)['json'](_0x10ac80);}};}function respondWithFilteredResult(_0x51e964,_0x46303c){return function(_0x378c83){if(_0x378c83){var _0x3e9573=typeof _0x46303c[_0x69ee('0x2f')]===_0x69ee('0x30')&&typeof _0x46303c['limit']===_0x69ee('0x30');var _0x51d8d7=_0x378c83['count'];var _0x660df4=_0x3e9573?0x0:_0x46303c[_0x69ee('0x2f')];var _0x27c307=_0x3e9573?_0x378c83[_0x69ee('0x31')]:_0x46303c[_0x69ee('0x2f')]+_0x46303c[_0x69ee('0x32')];var _0x2dacea;if(_0x27c307>=_0x51d8d7){_0x27c307=_0x51d8d7;_0x2dacea=0xc8;}else{_0x2dacea=0xce;}_0x51e964[_0x69ee('0x2e')](_0x2dacea);return _0x51e964[_0x69ee('0x33')]('Content-Range',_0x660df4+'-'+_0x27c307+'/'+_0x51d8d7)[_0x69ee('0x34')](_0x378c83);}return null;};}function patchUpdates(_0x48fb47){return function(_0x1ee0be){try{jsonpatch[_0x69ee('0x35')](_0x1ee0be,_0x48fb47,!![]);}catch(_0x52e4b0){return BPromise[_0x69ee('0x36')](_0x52e4b0);}return _0x1ee0be['save']();};}function saveUpdates(_0x1bc8c0,_0x3bcce6){return function(_0x1c48fd){if(_0x1c48fd){return _0x1c48fd[_0x69ee('0x37')](_0x1bc8c0)[_0x69ee('0x21')](function(_0x2d71a5){return _0x2d71a5;});}return null;};}function removeEntity(_0x1998bb,_0x51db64){return function(_0x522f8d){if(_0x522f8d){return _0x522f8d[_0x69ee('0x38')]()[_0x69ee('0x21')](function(){var _0x16af47=_0x522f8d[_0x69ee('0x39')]({'plain':!![]});var _0x39ffef=_0x69ee('0x3a');return db[_0x69ee('0x3b')]['destroy']({'where':{'type':_0x39ffef,'resourceId':_0x16af47['id']}})[_0x69ee('0x21')](function(){return _0x522f8d;});})['then'](function(){_0x1998bb['status'](0xcc)[_0x69ee('0x2d')]();});}};}function handleEntityNotFound(_0x26a37c,_0x25495c){return function(_0x26ece0){if(!_0x26ece0){_0x26a37c[_0x69ee('0x2c')](0x194);}return _0x26ece0;};}function handleError(_0x52fec2,_0x2c6ab3){_0x2c6ab3=_0x2c6ab3||0x1f4;return function(_0x140675){logger[_0x69ee('0x26')](_0x140675[_0x69ee('0x3c')]);if(_0x140675['name']){delete _0x140675[_0x69ee('0x3d')];}_0x52fec2[_0x69ee('0x2e')](_0x2c6ab3)['send'](_0x140675);};}exports['index']=function(_0x52377d,_0x25d745){var _0x8f1bf4={},_0x548b00={},_0x2bbdff={'count':0x0,'rows':[]};var _0xf085ac=_[_0x69ee('0x3e')](db[_0x69ee('0x3f')][_0x69ee('0x40')],function(_0x22c40b){return{'name':_0x22c40b[_0x69ee('0x41')],'type':_0x22c40b[_0x69ee('0x42')][_0x69ee('0x43')]};});_0x548b00[_0x69ee('0x44')]=_[_0x69ee('0x3e')](_0xf085ac,'name');_0x548b00['query']=_['keys'](_0x52377d['query']);_0x548b00[_0x69ee('0x45')]=_['intersection'](_0x548b00[_0x69ee('0x44')],_0x548b00[_0x69ee('0x46')]);_0x8f1bf4[_0x69ee('0x47')]=_[_0x69ee('0x48')](_0x548b00['model'],qs[_0x69ee('0x49')](_0x52377d[_0x69ee('0x46')][_0x69ee('0x49')]));_0x8f1bf4[_0x69ee('0x47')]=_0x8f1bf4['attributes'][_0x69ee('0x4a')]?_0x8f1bf4['attributes']:_0x548b00[_0x69ee('0x44')];if(!_0x52377d[_0x69ee('0x46')][_0x69ee('0x4b')](_0x69ee('0x4c'))){_0x8f1bf4[_0x69ee('0x32')]=qs['limit'](_0x52377d['query'][_0x69ee('0x32')]);_0x8f1bf4[_0x69ee('0x2f')]=qs[_0x69ee('0x2f')](_0x52377d[_0x69ee('0x46')][_0x69ee('0x2f')]);}_0x8f1bf4[_0x69ee('0x4d')]=qs['sort'](_0x52377d[_0x69ee('0x46')][_0x69ee('0x4e')]);_0x8f1bf4['where']=qs[_0x69ee('0x45')](_[_0x69ee('0x4f')](_0x52377d['query'],_0x548b00[_0x69ee('0x45')]),_0xf085ac);if(_0x52377d[_0x69ee('0x46')]['filter']){_0x8f1bf4[_0x69ee('0x50')]=_[_0x69ee('0x51')](_0x8f1bf4[_0x69ee('0x50')],{'$or':_[_0x69ee('0x3e')](_0xf085ac,function(_0x4471d4){if(_0x4471d4['type']!==_0x69ee('0x52')){var _0x1472f9={};_0x1472f9[_0x4471d4[_0x69ee('0x3d')]]={'$like':'%'+_0x52377d[_0x69ee('0x46')][_0x69ee('0x53')]+'%'};return _0x1472f9;}})});}_0x8f1bf4=_['merge']({},_0x8f1bf4,_0x52377d[_0x69ee('0x54')]);var _0x54648c={'where':_0x8f1bf4['where']};return db[_0x69ee('0x3f')][_0x69ee('0x31')](_0x54648c)[_0x69ee('0x21')](function(_0x328969){_0x2bbdff['count']=_0x328969;if(_0x52377d['query'][_0x69ee('0x55')]){_0x8f1bf4[_0x69ee('0x56')]=[{'all':!![]}];}return db[_0x69ee('0x3f')]['findAll'](_0x8f1bf4);})['then'](function(_0x215422){_0x2bbdff[_0x69ee('0x57')]=_0x215422;return _0x2bbdff;})[_0x69ee('0x21')](respondWithFilteredResult(_0x25d745,_0x8f1bf4))[_0x69ee('0x2b')](handleError(_0x25d745,null));};exports['show']=function(_0x4187b7,_0x23e7f2){var _0x3a2fb5={'raw':!![],'where':{'id':_0x4187b7['params']['id']}},_0x56b3df={};_0x56b3df[_0x69ee('0x44')]=_[_0x69ee('0x58')](db[_0x69ee('0x3f')][_0x69ee('0x40')]);_0x56b3df[_0x69ee('0x46')]=_[_0x69ee('0x58')](_0x4187b7[_0x69ee('0x46')]);_0x56b3df[_0x69ee('0x45')]=_[_0x69ee('0x48')](_0x56b3df[_0x69ee('0x44')],_0x56b3df[_0x69ee('0x46')]);_0x3a2fb5[_0x69ee('0x47')]=_[_0x69ee('0x48')](_0x56b3df[_0x69ee('0x44')],qs[_0x69ee('0x49')](_0x4187b7[_0x69ee('0x46')][_0x69ee('0x49')]));_0x3a2fb5[_0x69ee('0x47')]=_0x3a2fb5[_0x69ee('0x47')][_0x69ee('0x4a')]?_0x3a2fb5[_0x69ee('0x47')]:_0x56b3df['model'];if(_0x4187b7[_0x69ee('0x46')]['includeAll']){_0x3a2fb5[_0x69ee('0x56')]=[{'all':!![]}];}_0x3a2fb5=_[_0x69ee('0x51')]({},_0x3a2fb5,_0x4187b7['options']);return db[_0x69ee('0x3f')]['find'](_0x3a2fb5)[_0x69ee('0x21')](handleEntityNotFound(_0x23e7f2,null))['then'](respondWithResult(_0x23e7f2,null))[_0x69ee('0x2b')](handleError(_0x23e7f2,null));};exports['create']=function(_0x3a6056,_0x283161){return db[_0x69ee('0x3f')][_0x69ee('0x59')](_0x3a6056[_0x69ee('0x5a')],{})[_0x69ee('0x21')](function(_0x10daf3){var _0x437831=_0x3a6056[_0x69ee('0x5b')][_0x69ee('0x39')]({'plain':!![]});if(!_0x437831)throw new Error(_0x69ee('0x5c'));if(_0x437831[_0x69ee('0x5d')]===_0x69ee('0x5b')){var _0x2aa297=_0x10daf3['get']({'plain':!![]});var _0x52ea9a=_0x69ee('0x3a');return db[_0x69ee('0x5e')][_0x69ee('0x5f')]({'where':{'name':_0x52ea9a,'userProfileId':_0x437831[_0x69ee('0x60')]},'raw':!![]})[_0x69ee('0x21')](function(_0x1d86d7){if(_0x1d86d7&&_0x1d86d7[_0x69ee('0x61')]===0x0){return db['UserProfileResource'][_0x69ee('0x59')]({'name':_0x2aa297['name'],'resourceId':_0x2aa297['id'],'type':_0x1d86d7[_0x69ee('0x3d')],'sectionId':_0x1d86d7['id']},{})['then'](function(){return _0x10daf3;});}else{return _0x10daf3;}})[_0x69ee('0x2b')](function(_0x32481f){logger[_0x69ee('0x26')](_0x69ee('0x62'),_0x32481f);throw _0x32481f;});}return _0x10daf3;})[_0x69ee('0x21')](respondWithResult(_0x283161,0xc9))[_0x69ee('0x2b')](handleError(_0x283161,null));};exports[_0x69ee('0x37')]=function(_0x5966a6,_0x5cb4c6){if(_0x5966a6['body']['id']){delete _0x5966a6[_0x69ee('0x5a')]['id'];}return db[_0x69ee('0x3f')][_0x69ee('0x5f')]({'where':{'id':_0x5966a6[_0x69ee('0x63')]['id']}})[_0x69ee('0x21')](handleEntityNotFound(_0x5cb4c6,null))[_0x69ee('0x21')](saveUpdates(_0x5966a6[_0x69ee('0x5a')],null))[_0x69ee('0x21')](respondWithResult(_0x5cb4c6,null))[_0x69ee('0x2b')](handleError(_0x5cb4c6,null));};exports[_0x69ee('0x38')]=function(_0x3d75ff,_0x619c75){return db['ChatQueue']['find']({'where':{'id':_0x3d75ff['params']['id']}})[_0x69ee('0x21')](handleEntityNotFound(_0x619c75,null))['then'](removeEntity(_0x619c75,null))[_0x69ee('0x2b')](handleError(_0x619c75,null));};exports['describe']=function(_0x11479e,_0xf0c681){return db[_0x69ee('0x3f')][_0x69ee('0x64')]()[_0x69ee('0x21')](respondWithResult(_0xf0c681,null))[_0x69ee('0x2b')](handleError(_0xf0c681,null));};exports['getMembers']=function(_0x280f3a,_0x1b3b37,_0x10a59d){var _0x585477={'raw':!![],'where':{}},_0x3a1064={},_0x5f0e09;return db[_0x69ee('0x3f')][_0x69ee('0x65')]({'where':{'id':_0x280f3a[_0x69ee('0x63')]['id']}})['then'](handleEntityNotFound(_0x1b3b37,null))[_0x69ee('0x21')](function(_0x50afe5){if(_0x50afe5){_0x5f0e09=_0x50afe5[_0x69ee('0x39')]({'plain':!![]});_0x3a1064['model']=_[_0x69ee('0x58')](db['UserChatQueue'][_0x69ee('0x40')]);_0x3a1064['query']=_[_0x69ee('0x58')](_0x280f3a['query']);_0x3a1064['filters']=_['intersection'](_0x3a1064[_0x69ee('0x44')],_0x3a1064['query']);_0x585477['attributes']=_[_0x69ee('0x48')](_0x3a1064[_0x69ee('0x44')],qs[_0x69ee('0x49')](_0x280f3a[_0x69ee('0x46')]['fields']));_0x585477[_0x69ee('0x47')]=_0x585477[_0x69ee('0x47')][_0x69ee('0x4a')]?_0x585477[_0x69ee('0x47')]:_0x3a1064[_0x69ee('0x44')];if(!_0x280f3a[_0x69ee('0x46')][_0x69ee('0x4b')](_0x69ee('0x4c'))){_0x585477[_0x69ee('0x32')]=qs['limit'](_0x280f3a[_0x69ee('0x46')][_0x69ee('0x32')]);_0x585477[_0x69ee('0x2f')]=qs[_0x69ee('0x2f')](_0x280f3a[_0x69ee('0x46')][_0x69ee('0x2f')]);}_0x585477[_0x69ee('0x4d')]=qs[_0x69ee('0x4e')](_0x280f3a['query']['sort']);_0x585477['where']=qs['filters'](_[_0x69ee('0x4f')](_0x280f3a['query'],_0x3a1064[_0x69ee('0x45')]));_0x585477[_0x69ee('0x50')][_0x69ee('0x66')]=_0x50afe5['id'];if(_0x280f3a['query'][_0x69ee('0x53')]){_0x585477[_0x69ee('0x50')]=_['merge'](_0x585477[_0x69ee('0x50')],{'$or':_[_0x69ee('0x3e')](_0x585477[_0x69ee('0x47')],function(_0x5ecd14){var _0x47d1b3={};_0x47d1b3[_0x5ecd14]={'$like':'%'+_0x280f3a[_0x69ee('0x46')][_0x69ee('0x53')]+'%'};return _0x47d1b3;})});}_0x585477=_['merge']({},_0x585477,_0x280f3a['options']);return db['UserChatQueue']['findAll'](_0x585477);}})[_0x69ee('0x21')](function(_0x243c7b){if(_0x243c7b){return db[_0x69ee('0x67')][_0x69ee('0x68')]({'where':{'id':_['map'](_0x243c7b,_0x69ee('0x69')),'role':'agent'},'attributes':['id',_0x69ee('0x3d'),_0x69ee('0x6a'),_0x69ee('0x6b'),_0x69ee('0x6c')]});}})[_0x69ee('0x21')](function(_0x7911bb){if(_0x7911bb){return{'count':_0x7911bb[_0x69ee('0x31')],'rows':_[_0x69ee('0x3e')](_0x7911bb['rows'],function(_0x59c4b1){return{'membername':_0x59c4b1[_0x69ee('0x3d')],'UserId':_0x59c4b1['id'],'queue_name':_0x5f0e09[_0x69ee('0x3d')],'ChatQueueId':_0x5f0e09['id'],'interface':util[_0x69ee('0x6d')](_0x69ee('0x6e'),_0x69ee('0x6f'),_0x59c4b1[_0x69ee('0x3d')]),'penalty':0x0,'paused':_0x59c4b1[_0x69ee('0x6a')],'createdAt':_0x59c4b1[_0x69ee('0x6c')],'updatedAt':_0x59c4b1[_0x69ee('0x6b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x69ee('0x21')](respondWithFilteredResult(_0x1b3b37,_0x585477))[_0x69ee('0x2b')](handleError(_0x1b3b37,null));};exports['getTeams']=function(_0x217d52,_0x2f12ae,_0x3866cd){var _0x50d89e={};var _0x130f45={};var _0xcddcf2;var _0x199dc7;return db[_0x69ee('0x3f')][_0x69ee('0x65')]({'where':{'id':_0x217d52[_0x69ee('0x63')]['id']}})[_0x69ee('0x21')](handleEntityNotFound(_0x2f12ae,null))[_0x69ee('0x21')](function(_0x4206de){if(_0x4206de){_0xcddcf2=_0x4206de;_0x130f45[_0x69ee('0x44')]=_[_0x69ee('0x58')](db[_0x69ee('0x70')]['rawAttributes']);_0x130f45[_0x69ee('0x46')]=_['keys'](_0x217d52[_0x69ee('0x46')]);_0x130f45[_0x69ee('0x45')]=_[_0x69ee('0x48')](_0x130f45[_0x69ee('0x44')],_0x130f45[_0x69ee('0x46')]);_0x50d89e['attributes']=_[_0x69ee('0x48')](_0x130f45[_0x69ee('0x44')],qs['fields'](_0x217d52[_0x69ee('0x46')][_0x69ee('0x49')]));_0x50d89e[_0x69ee('0x47')]=_0x50d89e[_0x69ee('0x47')][_0x69ee('0x4a')]?_0x50d89e[_0x69ee('0x47')]:_0x130f45[_0x69ee('0x44')];_0x50d89e[_0x69ee('0x4d')]=qs[_0x69ee('0x4e')](_0x217d52[_0x69ee('0x46')][_0x69ee('0x4e')]);_0x50d89e['where']=qs[_0x69ee('0x45')](_[_0x69ee('0x4f')](_0x217d52[_0x69ee('0x46')],_0x130f45[_0x69ee('0x45')]));if(_0x217d52['query'][_0x69ee('0x53')]){_0x50d89e['where']=_[_0x69ee('0x51')](_0x50d89e[_0x69ee('0x50')],{'$or':_[_0x69ee('0x3e')](_0x50d89e[_0x69ee('0x47')],function(_0xaf7d11){var _0xb92b64={};_0xb92b64[_0xaf7d11]={'$like':'%'+_0x217d52['query']['filter']+'%'};return _0xb92b64;})});}_0x50d89e=_['merge']({},_0x50d89e,_0x217d52[_0x69ee('0x54')]);return _0xcddcf2[_0x69ee('0x71')](_0x50d89e);}})[_0x69ee('0x21')](function(_0x264722){if(_0x264722){_0x199dc7=_0x264722[_0x69ee('0x4a')];if(!_0x217d52['query'][_0x69ee('0x4b')](_0x69ee('0x4c'))){_0x50d89e[_0x69ee('0x32')]=qs[_0x69ee('0x32')](_0x217d52[_0x69ee('0x46')]['limit']);_0x50d89e['offset']=qs[_0x69ee('0x2f')](_0x217d52[_0x69ee('0x46')][_0x69ee('0x2f')]);}return _0xcddcf2[_0x69ee('0x71')](_0x50d89e);}})[_0x69ee('0x21')](function(_0x399915){if(_0x399915){return _0x399915?{'count':_0x199dc7,'rows':_0x399915}:null;}})[_0x69ee('0x21')](respondWithResult(_0x2f12ae,null))[_0x69ee('0x2b')](handleError(_0x2f12ae,null));};exports[_0x69ee('0x72')]=function(_0x362b9b,_0x1cfdd0,_0x55ecfe){var _0x35c000=_0x362b9b[_0x69ee('0x5a')][_0x69ee('0x73')];return db['Team'][_0x69ee('0x74')]({'where':{'id':_0x35c000},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x69ee('0x3d'),_0x69ee('0x75'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x45daee){if(_0x45daee){var _0xc9be=_[_0x69ee('0x76')](_0x45daee,function(_0x1a712c){var _0x224d58=_0x1a712c[_0x69ee('0x39')]({'plain':!![]});return _0x224d58[_0x69ee('0x77')];});return db[_0x69ee('0x3f')][_0x69ee('0x5f')]({'where':{'id':_0x362b9b[_0x69ee('0x63')]['id']}})[_0x69ee('0x21')](function(_0x4bdb9e){return db[_0x69ee('0x78')]['transaction'](function(_0x353adc){return _0x4bdb9e['addTeams'](_0x35c000,{'transaction':_0x353adc})['then'](function(){return BPromise[_0x69ee('0x79')](_0xc9be,function(_0x4e6c0a){return db['UserChatQueue'][_0x69ee('0x7a')]({'where':{'UserId':_0x4e6c0a['id'],'ChatQueueId':_0x362b9b[_0x69ee('0x63')]['id']},'transaction':_0x353adc});});})['then'](function(){_0xc9be[_0x69ee('0x7b')](function(_0x56eb45){socket['emit'](_0x69ee('0x7c'),{'UserId':_0x56eb45['id'],'ChatQueueId':_0x4bdb9e['id']});});});});});}})['then'](respondWithStatusCode(_0x1cfdd0,null))[_0x69ee('0x2b')](handleError(_0x1cfdd0,null));};exports['removeTeams']=function(_0x512eb5,_0x46cfe9,_0x4a4d99){return db[_0x69ee('0x70')][_0x69ee('0x74')]({'where':{'id':_0x512eb5[_0x69ee('0x46')]['ids']},'attributes':['id'],'include':[{'model':db[_0x69ee('0x67')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x69ee('0x21')](handleEntityNotFound(_0x46cfe9,null))['then'](function(_0x3469d6){var _0x230c46=_[_0x69ee('0x3e')](_0x3469d6,'id');var _0x3812ec=[];var _0x1f2d1e=[];var _0x2636a2=squel[_0x69ee('0x7d')]();_0x2636a2[_0x69ee('0x7e')](_0x69ee('0x7f'))[_0x69ee('0x80')](_0x69ee('0x81'),'tq')[_0x69ee('0x82')](_0x69ee('0x83'),'ut',_0x69ee('0x84'))[_0x69ee('0x50')]('ChatQueueId\x20=\x20?',_0x512eb5[_0x69ee('0x63')]['id']);for(var _0x4b658a=0x0;_0x4b658a<_0x3469d6[_0x69ee('0x4a')];_0x4b658a+=0x1){let _0xa0965a=_0x3469d6[_0x4b658a];for(var _0x2388e5=0x0;_0x2388e5<_0xa0965a['Agents']['length'];_0x2388e5+=0x1){let _0x30f8d1=_0xa0965a[_0x69ee('0x77')][_0x2388e5];var _0x1d5278=_0x2636a2['clone']();_0x1d5278[_0x69ee('0x50')](_0x69ee('0x85'),_0x30f8d1['id']);_0x1f2d1e[_0x69ee('0x86')](db[_0x69ee('0x78')]['query'](_0x1d5278[_0x69ee('0x87')](),{'type':db[_0x69ee('0x78')][_0x69ee('0x88')]['SELECT']})[_0x69ee('0x21')](function(_0x3033b3){if(_0x3033b3['length']===0x1){return _0x30f8d1['id'];}else{var _0x8fa4ce=_['every'](_[_0x69ee('0x3e')](_0x3033b3,_0x69ee('0x89')),function(_0x3555ea){return _[_0x69ee('0x8a')](_0x230c46,_0x3555ea);});if(_0x8fa4ce){return _0x30f8d1['id'];}}}));}}return BPromise[_0x69ee('0x8b')](_0x1f2d1e)[_0x69ee('0x21')](function(_0x7f93c2){_0x3812ec=_(_0x3812ec)[_0x69ee('0x8c')](_0x7f93c2)['compact']()[_0x69ee('0x8d')]();return db[_0x69ee('0x3f')][_0x69ee('0x5f')]({'where':{'id':_0x512eb5[_0x69ee('0x63')]['id']}})[_0x69ee('0x21')](function(_0xcc9ea8){return db[_0x69ee('0x78')][_0x69ee('0x8e')](function(_0x28df78){return _0xcc9ea8[_0x69ee('0x8f')](_0x512eb5[_0x69ee('0x46')][_0x69ee('0x73')],{'transaction':_0x28df78})[_0x69ee('0x21')](function(){if(!_[_0x69ee('0x90')](_0x3812ec)){return _0xcc9ea8[_0x69ee('0x91')](_0x3812ec,{'transaction':_0x28df78});}})[_0x69ee('0x21')](function(){_0x3812ec[_0x69ee('0x7b')](function(_0x25ce26){socket[_0x69ee('0x92')]('userChatQueue:remove',{'UserId':_0x25ce26,'ChatQueueId':_0xcc9ea8['id']});});});});});});})[_0x69ee('0x21')](respondWithStatusCode(_0x46cfe9,null))['catch'](handleError(_0x46cfe9,null));};exports[_0x69ee('0x93')]=function(_0x4b3ccc,_0x59ddc5,_0x16cda4){return db[_0x69ee('0x3f')][_0x69ee('0x5f')]({'where':{'id':_0x4b3ccc[_0x69ee('0x63')]['id']}})['then'](handleEntityNotFound(_0x59ddc5,null))['then'](function(_0x1d72e1){if(_0x1d72e1){return _0x1d72e1['addAgents'](_0x4b3ccc['body'][_0x69ee('0x73')],_['omit'](_0x4b3ccc['body'],[_0x69ee('0x73'),'id'])||{})[_0x69ee('0x94')](function(_0x12cdcd){for(var _0x300206=0x0;_0x300206<_0x4b3ccc[_0x69ee('0x5a')][_0x69ee('0x73')][_0x69ee('0x4a')];_0x300206+=0x1){socket[_0x69ee('0x92')](_0x69ee('0x7c'),{'UserId':Number(_0x4b3ccc[_0x69ee('0x5a')][_0x69ee('0x73')][_0x300206]),'ChatQueueId':Number(_0x4b3ccc[_0x69ee('0x63')]['id'])});}return _0x12cdcd;});}})[_0x69ee('0x21')](respondWithResult(_0x59ddc5,null))[_0x69ee('0x2b')](handleError(_0x59ddc5,null));};exports[_0x69ee('0x91')]=function(_0x1deb5a,_0x2226a1,_0xf0b9e){return db[_0x69ee('0x3f')][_0x69ee('0x5f')]({'where':{'id':_0x1deb5a[_0x69ee('0x63')]['id']}})[_0x69ee('0x21')](handleEntityNotFound(_0x2226a1,null))[_0x69ee('0x21')](function(_0x4e6f0a){if(_0x4e6f0a){return _0x4e6f0a[_0x69ee('0x91')](_0x1deb5a[_0x69ee('0x46')]['ids'])['then'](function(){if(_[_0x69ee('0x95')](_0x1deb5a[_0x69ee('0x46')][_0x69ee('0x73')])){for(var _0x22b611=0x0;_0x22b611<_0x1deb5a[_0x69ee('0x46')]['ids'][_0x69ee('0x4a')];_0x22b611+=0x1){socket[_0x69ee('0x92')]('userChatQueue:remove',{'UserId':Number(_0x1deb5a[_0x69ee('0x46')]['ids'][_0x22b611]),'ChatQueueId':Number(_0x1deb5a[_0x69ee('0x63')]['id'])});}}else{socket[_0x69ee('0x92')](_0x69ee('0x96'),{'UserId':Number(_0x1deb5a[_0x69ee('0x46')]['ids']),'ChatQueueId':Number(_0x1deb5a[_0x69ee('0x63')]['id'])});}});}})[_0x69ee('0x21')](respondWithStatusCode(_0x2226a1,null))[_0x69ee('0x2b')](handleError(_0x2226a1,null));};exports[_0x69ee('0x97')]=function(_0x2360a9,_0x2359ee,_0x5356d9){var _0x52b3c8={};var _0x2f24bc={};var _0x2d3ec3;var _0x4f6d1c;return db[_0x69ee('0x3f')][_0x69ee('0x65')]({'where':{'id':_0x2360a9[_0x69ee('0x63')]['id']}})['then'](handleEntityNotFound(_0x2359ee,null))['then'](function(_0x3fbe41){if(_0x3fbe41){_0x2d3ec3=_0x3fbe41;_0x2f24bc[_0x69ee('0x44')]=_[_0x69ee('0x58')](db[_0x69ee('0x67')][_0x69ee('0x40')]);_0x2f24bc[_0x69ee('0x46')]=_[_0x69ee('0x58')](_0x2360a9[_0x69ee('0x46')]);_0x2f24bc[_0x69ee('0x45')]=_[_0x69ee('0x48')](_0x2f24bc[_0x69ee('0x44')],_0x2f24bc[_0x69ee('0x46')]);_0x52b3c8[_0x69ee('0x47')]=_['intersection'](_0x2f24bc[_0x69ee('0x44')],qs['fields'](_0x2360a9[_0x69ee('0x46')][_0x69ee('0x49')]));_0x52b3c8[_0x69ee('0x47')]=_0x52b3c8[_0x69ee('0x47')][_0x69ee('0x4a')]?_0x52b3c8[_0x69ee('0x47')]:_0x2f24bc[_0x69ee('0x44')];_0x52b3c8[_0x69ee('0x4d')]=qs[_0x69ee('0x4e')](_0x2360a9[_0x69ee('0x46')][_0x69ee('0x4e')]);_0x52b3c8[_0x69ee('0x50')]=qs[_0x69ee('0x45')](_['pick'](_0x2360a9[_0x69ee('0x46')],_0x2f24bc['filters']));if(_0x2360a9[_0x69ee('0x46')][_0x69ee('0x53')]){_0x52b3c8[_0x69ee('0x50')]=_[_0x69ee('0x51')](_0x52b3c8[_0x69ee('0x50')],{'$or':_['map'](_0x52b3c8[_0x69ee('0x47')],function(_0x46ddee){var _0x562f36={};_0x562f36[_0x46ddee]={'$like':'%'+_0x2360a9[_0x69ee('0x46')][_0x69ee('0x53')]+'%'};return _0x562f36;})});}_0x52b3c8=_[_0x69ee('0x51')]({},_0x52b3c8,_0x2360a9['options']);return _0x2d3ec3[_0x69ee('0x97')](_0x52b3c8);}})['then'](function(_0x103672){if(_0x103672){_0x4f6d1c=_0x103672[_0x69ee('0x4a')];if(!_0x2360a9['query']['hasOwnProperty'](_0x69ee('0x4c'))){_0x52b3c8[_0x69ee('0x32')]=qs[_0x69ee('0x32')](_0x2360a9[_0x69ee('0x46')][_0x69ee('0x32')]);_0x52b3c8['offset']=qs[_0x69ee('0x2f')](_0x2360a9[_0x69ee('0x46')][_0x69ee('0x2f')]);}return _0x2d3ec3[_0x69ee('0x97')](_0x52b3c8);}})[_0x69ee('0x21')](function(_0x113206){if(_0x113206){return _0x113206?{'count':_0x4f6d1c,'rows':_0x113206}:null;}})[_0x69ee('0x21')](respondWithResult(_0x2359ee,null))[_0x69ee('0x2b')](handleError(_0x2359ee,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 84d84d4..bf9a70b 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 _0x4c0a=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','update'];(function(_0x526fb1,_0x100deb){var _0x258f8e=function(_0x3b243e){while(--_0x3b243e){_0x526fb1['push'](_0x526fb1['shift']());}};_0x258f8e(++_0x100deb);}(_0x4c0a,0x11a));var _0xa4c0=function(_0x20a7b1,_0x221c85){_0x20a7b1=_0x20a7b1-0x0;var _0x4087c7=_0x4c0a[_0x20a7b1];return _0x4087c7;};'use strict';var EventEmitter=require(_0xa4c0('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xa4c0('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xa4c0('0x2')](0x0);var events={'afterCreate':_0xa4c0('0x3'),'afterUpdate':_0xa4c0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5c8f29){return function(_0x5f5c20,_0x1ee801,_0x320c2d){ChatQueueEvents['emit'](_0x5c8f29+':'+_0x5f5c20['id'],_0x5f5c20);ChatQueueEvents['emit'](_0x5c8f29,_0x5f5c20);_0x320c2d(null);};}for(var e in events){if(events[_0xa4c0('0x5')](e)){var event=events[e];ChatQueue[_0xa4c0('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xa4de=['update','remove','emit','hasOwnProperty','hook','events','setMaxListeners','save'];(function(_0x3e60d0,_0x1bd96f){var _0x2d63ee=function(_0x163afc){while(--_0x163afc){_0x3e60d0['push'](_0x3e60d0['shift']());}};_0x2d63ee(++_0x1bd96f);}(_0xa4de,0x10d));var _0xea4d=function(_0xbb824c,_0x32aeea){_0xbb824c=_0xbb824c-0x0;var _0x2b5d4c=_0xa4de[_0xbb824c];return _0x2b5d4c;};'use strict';var EventEmitter=require(_0xea4d('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xea4d('0x1')](0x0);var events={'afterCreate':_0xea4d('0x2'),'afterUpdate':_0xea4d('0x3'),'afterDestroy':_0xea4d('0x4')};function emitEvent(_0x380244){return function(_0x111a9e,_0x23785,_0x3c8588){ChatQueueEvents[_0xea4d('0x5')](_0x380244+':'+_0x111a9e['id'],_0x111a9e);ChatQueueEvents[_0xea4d('0x5')](_0x380244,_0x111a9e);_0x3c8588(null);};}for(var e in events){if(events[_0xea4d('0x6')](e)){var event=events[e];ChatQueue[_0xea4d('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 bb0d923..8730b22 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 _0xa4e9=['bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','../../config/logger','moment'];(function(_0x3cf9de,_0x2ffcf9){var _0x4afb72=function(_0x3874a5){while(--_0x3874a5){_0x3cf9de['push'](_0x3cf9de['shift']());}};_0x4afb72(++_0x2ffcf9);}(_0xa4e9,0x1a0));var _0x9a4e=function(_0x1d2e88,_0x410d1d){_0x1d2e88=_0x1d2e88-0x0;var _0x42794b=_0xa4e9[_0x1d2e88];return _0x42794b;};'use strict';var _=require(_0x9a4e('0x0'));var util=require(_0x9a4e('0x1'));var logger=require(_0x9a4e('0x2'))('api');var moment=require(_0x9a4e('0x3'));var BPromise=require(_0x9a4e('0x4'));var rp=require(_0x9a4e('0x5'));var fs=require('fs');var path=require(_0x9a4e('0x6'));var rimraf=require(_0x9a4e('0x7'));var config=require(_0x9a4e('0x8'));var attributes=require(_0x9a4e('0x9'));module[_0x9a4e('0xa')]=function(_0x285c40,_0x447076){return _0x285c40[_0x9a4e('0xb')](_0x9a4e('0xc'),attributes,{'tableName':_0x9a4e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x366e=['moment','bluebird','path','rimraf','./chatQueue.attributes','exports','chat_queues','util','../../config/logger','api'];(function(_0x1953a1,_0x16a0e9){var _0x45f0b8=function(_0x1e4d7a){while(--_0x1e4d7a){_0x1953a1['push'](_0x1953a1['shift']());}};_0x45f0b8(++_0x16a0e9);}(_0x366e,0x183));var _0xe366=function(_0x4e5d57,_0x742e0f){_0x4e5d57=_0x4e5d57-0x0;var _0x160d0a=_0x366e[_0x4e5d57];return _0x160d0a;};'use strict';var _=require('lodash');var util=require(_0xe366('0x0'));var logger=require(_0xe366('0x1'))(_0xe366('0x2'));var moment=require(_0xe366('0x3'));var BPromise=require(_0xe366('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe366('0x5'));var rimraf=require(_0xe366('0x6'));var config=require('../../config/environment');var attributes=require(_0xe366('0x7'));module[_0xe366('0x8')]=function(_0x984713,_0x2cae32){return _0x984713['define']('ChatQueue',attributes,{'tableName':_0xe366('0x9'),'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 8e700fa..5836964 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 _0x95aa=['ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowChatQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','register','request','then','info'];(function(_0x1947c7,_0x524b2c){var _0xbbca75=function(_0x2ebfd3){while(--_0x2ebfd3){_0x1947c7['push'](_0x1947c7['shift']());}};_0xbbca75(++_0x524b2c);}(_0x95aa,0x91));var _0xa95a=function(_0x40ddc0,_0x41c082){_0x40ddc0=_0x40ddc0-0x0;var _0x1aebf1=_0x95aa[_0x40ddc0];return _0x1aebf1;};'use strict';var _=require(_0xa95a('0x0'));var util=require('util');var moment=require(_0xa95a('0x1'));var BPromise=require(_0xa95a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa95a('0x3'));var db=require(_0xa95a('0x4'))['db'];var utils=require(_0xa95a('0x5'));var logger=require(_0xa95a('0x6'))(_0xa95a('0x7'));var config=require(_0xa95a('0x8'));var jayson=require(_0xa95a('0x9'));var client=jayson[_0xa95a('0xa')][_0xa95a('0xb')]({'port':0x232a});config['redis']=_[_0xa95a('0xc')](config['redis'],{'host':_0xa95a('0xd'),'port':0x18eb});var socket=require(_0xa95a('0xe'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xa95a('0xf')](socket);function respondWithRpcPromise(_0x1a4056,_0x29a091,_0x2ec118){return new BPromise(function(_0x15ce6d,_0x29e4f0){return client[_0xa95a('0x10')](_0x1a4056,_0x2ec118)[_0xa95a('0x11')](function(_0xb951fb){logger[_0xa95a('0x12')](_0xa95a('0x13'),_0x29a091,'request\x20sent');logger['debug'](_0xa95a('0x14'),_0x29a091,'request\x20sent',JSON[_0xa95a('0x15')](_0xb951fb));if(_0xb951fb[_0xa95a('0x16')]){if(_0xb951fb[_0xa95a('0x16')][_0xa95a('0x17')]===0x1f4){logger[_0xa95a('0x16')](_0xa95a('0x13'),_0x29a091,_0xb951fb[_0xa95a('0x16')][_0xa95a('0x18')]);return _0x29e4f0(_0xb951fb[_0xa95a('0x16')][_0xa95a('0x18')]);}logger['error'](_0xa95a('0x13'),_0x29a091,_0xb951fb[_0xa95a('0x16')]['message']);return _0x15ce6d(_0xb951fb[_0xa95a('0x16')][_0xa95a('0x18')]);}else{logger[_0xa95a('0x12')](_0xa95a('0x13'),_0x29a091,'request\x20sent');_0x15ce6d(_0xb951fb[_0xa95a('0x19')]['message']);}})[_0xa95a('0x1a')](function(_0x334c65){logger[_0xa95a('0x16')](_0xa95a('0x13'),_0x29a091,_0x334c65);_0x29e4f0(_0x334c65);});});}exports[_0xa95a('0x1b')]=function(_0x28791e){var _0x4584c4=this;return new Promise(function(_0x27c464,_0x26a3be){return db[_0xa95a('0x1c')][_0xa95a('0x1d')]({'raw':_0x28791e['options']?_0x28791e[_0xa95a('0x1e')][_0xa95a('0x1f')]===undefined?!![]:![]:!![],'where':_0x28791e[_0xa95a('0x1e')]?_0x28791e[_0xa95a('0x1e')][_0xa95a('0x20')]||null:null,'attributes':_0x28791e['options']?_0x28791e['options'][_0xa95a('0x21')]||null:null,'limit':_0x28791e[_0xa95a('0x1e')]?_0x28791e[_0xa95a('0x1e')][_0xa95a('0x22')]||null:null,'include':_0x28791e[_0xa95a('0x1e')]?_0x28791e[_0xa95a('0x1e')][_0xa95a('0x23')]?_[_0xa95a('0x24')](_0x28791e[_0xa95a('0x1e')][_0xa95a('0x23')],function(_0x2560ad){return{'model':db[_0x2560ad[_0xa95a('0x25')]],'as':_0x2560ad['as'],'attributes':_0x2560ad[_0xa95a('0x21')],'include':_0x2560ad[_0xa95a('0x23')]?_['map'](_0x2560ad[_0xa95a('0x23')],function(_0xa541a){return{'model':db[_0xa541a[_0xa95a('0x25')]],'as':_0xa541a['as'],'attributes':_0xa541a[_0xa95a('0x21')],'include':_0xa541a[_0xa95a('0x23')]?_[_0xa95a('0x24')](_0xa541a[_0xa95a('0x23')],function(_0x161c25){return{'model':db[_0x161c25[_0xa95a('0x25')]],'as':_0x161c25['as'],'attributes':_0x161c25[_0xa95a('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d84e0){logger['info']('GetChatQueue',_0x28791e);logger[_0xa95a('0x26')](_0xa95a('0x1b'),_0x28791e,JSON['stringify'](_0x2d84e0));_0x27c464(_0x2d84e0);})['catch'](function(_0x154688){logger[_0xa95a('0x16')](_0xa95a('0x1b'),_0x154688[_0xa95a('0x18')],_0x28791e);_0x26a3be(_0x4584c4[_0xa95a('0x16')](0x1f4,_0x154688[_0xa95a('0x18')]));});});};exports[_0xa95a('0x27')]=function(_0x3c3c86){var _0x578da1=this;return new Promise(function(_0x34762a,_0x3d92f4){return db[_0xa95a('0x1c')][_0xa95a('0x28')]({'raw':_0x3c3c86[_0xa95a('0x1e')]?_0x3c3c86[_0xa95a('0x1e')][_0xa95a('0x1f')]===undefined?!![]:![]:!![],'where':_0x3c3c86[_0xa95a('0x1e')]?_0x3c3c86[_0xa95a('0x1e')]['where']||null:null,'attributes':_0x3c3c86[_0xa95a('0x1e')]?_0x3c3c86['options'][_0xa95a('0x21')]||null:null,'include':_0x3c3c86[_0xa95a('0x1e')]?_0x3c3c86[_0xa95a('0x1e')]['include']?_[_0xa95a('0x24')](_0x3c3c86[_0xa95a('0x1e')][_0xa95a('0x23')],function(_0x450cce){return{'model':db[_0x450cce[_0xa95a('0x25')]],'as':_0x450cce['as'],'attributes':_0x450cce[_0xa95a('0x21')],'include':_0x450cce[_0xa95a('0x23')]?_[_0xa95a('0x24')](_0x450cce['include'],function(_0x495fa8){return{'model':db[_0x495fa8[_0xa95a('0x25')]],'as':_0x495fa8['as'],'attributes':_0x495fa8[_0xa95a('0x21')],'include':_0x495fa8[_0xa95a('0x23')]?_['map'](_0x495fa8[_0xa95a('0x23')],function(_0x5d00df){return{'model':db[_0x5d00df[_0xa95a('0x25')]],'as':_0x5d00df['as'],'attributes':_0x5d00df['attributes']};}):[]};}):[]};}):[]:[]})[_0xa95a('0x11')](function(_0x2c81cb){logger['info']('ShowChatQueue',_0x3c3c86);logger[_0xa95a('0x26')](_0xa95a('0x27'),_0x3c3c86,JSON['stringify'](_0x2c81cb));_0x34762a(_0x2c81cb);})['catch'](function(_0x26fd72){logger['error']('ShowChatQueue',_0x26fd72['message'],_0x3c3c86);_0x3d92f4(_0x578da1['error'](0x1f4,_0x26fd72[_0xa95a('0x18')]));});});}; \ No newline at end of file +var _0x0e5a=['localhost','socket.io-emitter','./chatQueue.socket','register','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetChatQueue','findAll','options','raw','attributes','limit','map','include','model','then','ShowChatQueue','ChatQueue','find','where','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults'];(function(_0x5cb50c,_0x47ed25){var _0x4f349a=function(_0x173941){while(--_0x173941){_0x5cb50c['push'](_0x5cb50c['shift']());}};_0x4f349a(++_0x47ed25);}(_0x0e5a,0x70));var _0xa0e5=function(_0x43952e,_0x2292fe){_0x43952e=_0x43952e-0x0;var _0x4b9a0a=_0x0e5a[_0x43952e];return _0x4b9a0a;};'use strict';var _=require(_0xa0e5('0x0'));var util=require(_0xa0e5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa0e5('0x2'));var fs=require('fs');var Redis=require(_0xa0e5('0x3'));var db=require(_0xa0e5('0x4'))['db'];var utils=require(_0xa0e5('0x5'));var logger=require('../../config/logger')(_0xa0e5('0x6'));var config=require(_0xa0e5('0x7'));var jayson=require(_0xa0e5('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xa0e5('0x9')]=_[_0xa0e5('0xa')](config[_0xa0e5('0x9')],{'host':_0xa0e5('0xb'),'port':0x18eb});var socket=require(_0xa0e5('0xc'))(new Redis(config[_0xa0e5('0x9')]));require(_0xa0e5('0xd'))[_0xa0e5('0xe')](socket);function respondWithRpcPromise(_0x3a3b95,_0x424ce6,_0x5bd4b1){return new BPromise(function(_0x2b2226,_0x29c6e9){return client[_0xa0e5('0xf')](_0x3a3b95,_0x5bd4b1)['then'](function(_0x58b005){logger['info'](_0xa0e5('0x10'),_0x424ce6,_0xa0e5('0x11'));logger[_0xa0e5('0x12')](_0xa0e5('0x13'),_0x424ce6,'request\x20sent',JSON[_0xa0e5('0x14')](_0x58b005));if(_0x58b005['error']){if(_0x58b005[_0xa0e5('0x15')][_0xa0e5('0x16')]===0x1f4){logger[_0xa0e5('0x15')](_0xa0e5('0x10'),_0x424ce6,_0x58b005['error'][_0xa0e5('0x17')]);return _0x29c6e9(_0x58b005[_0xa0e5('0x15')][_0xa0e5('0x17')]);}logger['error'](_0xa0e5('0x10'),_0x424ce6,_0x58b005['error'][_0xa0e5('0x17')]);return _0x2b2226(_0x58b005[_0xa0e5('0x15')]['message']);}else{logger[_0xa0e5('0x18')](_0xa0e5('0x10'),_0x424ce6,_0xa0e5('0x11'));_0x2b2226(_0x58b005[_0xa0e5('0x19')][_0xa0e5('0x17')]);}})[_0xa0e5('0x1a')](function(_0x27be83){logger[_0xa0e5('0x15')]('ChatQueue,\x20%s,\x20%s',_0x424ce6,_0x27be83);_0x29c6e9(_0x27be83);});});}exports[_0xa0e5('0x1b')]=function(_0x556885){var _0x2b963c=this;return new Promise(function(_0x1032e7,_0x4d3906){return db['ChatQueue'][_0xa0e5('0x1c')]({'raw':_0x556885[_0xa0e5('0x1d')]?_0x556885[_0xa0e5('0x1d')][_0xa0e5('0x1e')]===undefined?!![]:![]:!![],'where':_0x556885[_0xa0e5('0x1d')]?_0x556885[_0xa0e5('0x1d')]['where']||null:null,'attributes':_0x556885[_0xa0e5('0x1d')]?_0x556885[_0xa0e5('0x1d')][_0xa0e5('0x1f')]||null:null,'limit':_0x556885['options']?_0x556885[_0xa0e5('0x1d')][_0xa0e5('0x20')]||null:null,'include':_0x556885['options']?_0x556885[_0xa0e5('0x1d')]['include']?_[_0xa0e5('0x21')](_0x556885[_0xa0e5('0x1d')][_0xa0e5('0x22')],function(_0x1a0502){return{'model':db[_0x1a0502[_0xa0e5('0x23')]],'as':_0x1a0502['as'],'attributes':_0x1a0502[_0xa0e5('0x1f')],'include':_0x1a0502[_0xa0e5('0x22')]?_[_0xa0e5('0x21')](_0x1a0502['include'],function(_0x20eb14){return{'model':db[_0x20eb14[_0xa0e5('0x23')]],'as':_0x20eb14['as'],'attributes':_0x20eb14[_0xa0e5('0x1f')],'include':_0x20eb14[_0xa0e5('0x22')]?_['map'](_0x20eb14[_0xa0e5('0x22')],function(_0xdac5da){return{'model':db[_0xdac5da[_0xa0e5('0x23')]],'as':_0xdac5da['as'],'attributes':_0xdac5da[_0xa0e5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa0e5('0x24')](function(_0x2ed39f){logger['info'](_0xa0e5('0x1b'),_0x556885);logger[_0xa0e5('0x12')](_0xa0e5('0x1b'),_0x556885,JSON[_0xa0e5('0x14')](_0x2ed39f));_0x1032e7(_0x2ed39f);})[_0xa0e5('0x1a')](function(_0x548e4f){logger['error'](_0xa0e5('0x1b'),_0x548e4f[_0xa0e5('0x17')],_0x556885);_0x4d3906(_0x2b963c[_0xa0e5('0x15')](0x1f4,_0x548e4f['message']));});});};exports[_0xa0e5('0x25')]=function(_0x238889){var _0x18b49f=this;return new Promise(function(_0x4df615,_0x361ff7){return db[_0xa0e5('0x26')][_0xa0e5('0x27')]({'raw':_0x238889[_0xa0e5('0x1d')]?_0x238889[_0xa0e5('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x238889[_0xa0e5('0x1d')]?_0x238889[_0xa0e5('0x1d')][_0xa0e5('0x28')]||null:null,'attributes':_0x238889[_0xa0e5('0x1d')]?_0x238889[_0xa0e5('0x1d')][_0xa0e5('0x1f')]||null:null,'include':_0x238889['options']?_0x238889['options'][_0xa0e5('0x22')]?_[_0xa0e5('0x21')](_0x238889[_0xa0e5('0x1d')][_0xa0e5('0x22')],function(_0x90ad){return{'model':db[_0x90ad[_0xa0e5('0x23')]],'as':_0x90ad['as'],'attributes':_0x90ad['attributes'],'include':_0x90ad['include']?_[_0xa0e5('0x21')](_0x90ad[_0xa0e5('0x22')],function(_0x13efeb){return{'model':db[_0x13efeb[_0xa0e5('0x23')]],'as':_0x13efeb['as'],'attributes':_0x13efeb['attributes'],'include':_0x13efeb[_0xa0e5('0x22')]?_['map'](_0x13efeb[_0xa0e5('0x22')],function(_0x3a80ee){return{'model':db[_0x3a80ee[_0xa0e5('0x23')]],'as':_0x3a80ee['as'],'attributes':_0x3a80ee[_0xa0e5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa0e5('0x24')](function(_0x8a444){logger[_0xa0e5('0x18')](_0xa0e5('0x25'),_0x238889);logger[_0xa0e5('0x12')](_0xa0e5('0x25'),_0x238889,JSON[_0xa0e5('0x14')](_0x8a444));_0x4df615(_0x8a444);})['catch'](function(_0x31755c){logger[_0xa0e5('0x15')](_0xa0e5('0x25'),_0x31755c[_0xa0e5('0x17')],_0x238889);_0x361ff7(_0x18b49f[_0xa0e5('0x15')](0x1f4,_0x31755c[_0xa0e5('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 68c82aa..a5585a3 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 _0xf873=['register','length','chatQueue:','save','remove','update','emit'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xf873,0xb2));var _0x3f87=function(_0x5df8f5,_0x4956f0){_0x5df8f5=_0x5df8f5-0x0;var _0x4a54a6=_0xf873[_0x5df8f5];return _0x4a54a6;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x3f87('0x0'),_0x3f87('0x1'),_0x3f87('0x2')];function createListener(_0x3ef688,_0x1c56a3){return function(_0xd4592c){_0x1c56a3[_0x3f87('0x3')](_0x3ef688,_0xd4592c);};}function removeListener(_0x1d68dd,_0x3c80d6){return function(){ChatQueueEvents['removeListener'](_0x1d68dd,_0x3c80d6);};}exports[_0x3f87('0x4')]=function(_0x43c8e4){for(var _0x27c03e=0x0,_0x5a5e37=events[_0x3f87('0x5')];_0x27c03e<_0x5a5e37;_0x27c03e++){var _0x2c7ccc=events[_0x27c03e];var _0x3b8e92=createListener(_0x3f87('0x6')+_0x2c7ccc,_0x43c8e4);ChatQueueEvents['on'](_0x2c7ccc,_0x3b8e92);}}; \ No newline at end of file +var _0xf873=['register','length','chatQueue:','save','remove','update','emit'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xf873,0xb2));var _0x3f87=function(_0xff6d9c,_0xce514){_0xff6d9c=_0xff6d9c-0x0;var _0x12b89b=_0xf873[_0xff6d9c];return _0x12b89b;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x3f87('0x0'),_0x3f87('0x1'),_0x3f87('0x2')];function createListener(_0x3ef688,_0x1c56a3){return function(_0xd4592c){_0x1c56a3[_0x3f87('0x3')](_0x3ef688,_0xd4592c);};}function removeListener(_0x1d68dd,_0x3c80d6){return function(){ChatQueueEvents['removeListener'](_0x1d68dd,_0x3c80d6);};}exports[_0x3f87('0x4')]=function(_0x43c8e4){for(var _0x27c03e=0x0,_0x5a5e37=events[_0x3f87('0x5')];_0x27c03e<_0x5a5e37;_0x27c03e++){var _0x2c7ccc=events[_0x27c03e];var _0x3b8e92=createListener(_0x3f87('0x6')+_0x2c7ccc,_0x43c8e4);ChatQueueEvents['on'](_0x2c7ccc,_0x3b8e92);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 73d7e75..91f788f 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(_0x32205e,_0x35767d){var _0x5f1792=function(_0x486da6){while(--_0x486da6){_0x32205e['push'](_0x32205e['shift']());}};_0x5f1792(++_0x35767d);}(_0xe14b,0x93));var _0xbe14=function(_0x532949,_0x3a7435){_0x532949=_0x532949-0x0;var _0x464c2b=_0xe14b[_0x532949];return _0x464c2b;};'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 _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x3458b5,_0x25b314){var _0x53bfd1=function(_0x1152a1){while(--_0x1152a1){_0x3458b5['push'](_0x3458b5['shift']());}};_0x53bfd1(++_0x25b314);}(_0x55ca,0x126));var _0xa55c=function(_0x42ebba,_0x4cbf87){_0x42ebba=_0x42ebba-0x0;var _0x3fd2af=_0x55ca[_0x42ebba];return _0x3fd2af;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 7060253..e3ad2ac 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 _0x65a6=['STRING','DATE','moment','sequelize'];(function(_0x48e100,_0x1f3bf6){var _0x33d659=function(_0x4cdae5){while(--_0x4cdae5){_0x48e100['push'](_0x48e100['shift']());}};_0x33d659(++_0x1f3bf6);}(_0x65a6,0x19e));var _0x665a=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x65a6[_0x12a2a6];return _0x1754ae;};'use strict';var moment=require(_0x665a('0x0'));var Sequelize=require(_0x665a('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x665a('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x665a('0x3')]},'leaveAt':{'type':Sequelize[_0x665a('0x3')]},'acceptAt':{'type':Sequelize[_0x665a('0x3')]},'exitAt':{'type':Sequelize[_0x665a('0x3')]},'reason':{'type':Sequelize[_0x665a('0x2')]}}; \ No newline at end of file +var _0xb2e1=['moment','sequelize','exports','DATE','STRING'];(function(_0x211f25,_0x30f852){var _0x7f8a68=function(_0x5ba82b){while(--_0x5ba82b){_0x211f25['push'](_0x211f25['shift']());}};_0x7f8a68(++_0x30f852);}(_0xb2e1,0x78));var _0x1b2e=function(_0x59bed0,_0xad50a5){_0x59bed0=_0x59bed0-0x0;var _0x2e5d4c=_0xb2e1[_0x59bed0];return _0x2e5d4c;};'use strict';var moment=require(_0x1b2e('0x0'));var Sequelize=require(_0x1b2e('0x1'));module[_0x1b2e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1b2e('0x3')]},'leaveAt':{'type':Sequelize[_0x1b2e('0x3')]},'acceptAt':{'type':Sequelize[_0x1b2e('0x3')]},'exitAt':{'type':Sequelize[_0x1b2e('0x3')]},'reason':{'type':Sequelize[_0x1b2e('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index b3b9e2a..cc3ad04 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 _0x8561=['destroy','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','catch','show','keys','include','find','create','body','update','params','describe','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','lodash','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then'];(function(_0x52a6b3,_0xce216a){var _0x134a12=function(_0x3bce53){while(--_0x3bce53){_0x52a6b3['push'](_0x52a6b3['shift']());}};_0x134a12(++_0xce216a);}(_0x8561,0x1b2));var _0x1856=function(_0x13594e,_0x6f0ed0){_0x13594e=_0x13594e-0x0;var _0x1a4f42=_0x8561[_0x13594e];return _0x1a4f42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1856('0x0'));var zipdir=require(_0x1856('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1856('0x2'));var moment=require('moment');var BPromise=require(_0x1856('0x3'));var Mustache=require('mustache');var util=require(_0x1856('0x4'));var path=require('path');var sox=require(_0x1856('0x5'));var csv=require(_0x1856('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1856('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1856('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1856('0x9'));var authService=require(_0x1856('0xa'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1856('0xb'));var logger=require('../../config/logger')(_0x1856('0xc'));var utils=require(_0x1856('0xd'));var config=require(_0x1856('0xe'));var licenseUtil=require('../../config/license/util');var db=require(_0x1856('0xf'))['db'];function respondWithStatusCode(_0x317635,_0x57deab){_0x57deab=_0x57deab||0xcc;return function(_0x354164){if(_0x354164){return _0x317635[_0x1856('0x10')](_0x57deab);}return _0x317635[_0x1856('0x11')](_0x57deab)['end']();};}function respondWithResult(_0x2db814,_0xc02b25){_0xc02b25=_0xc02b25||0xc8;return function(_0x208118){if(_0x208118){return _0x2db814['status'](_0xc02b25)[_0x1856('0x12')](_0x208118);}};}function respondWithFilteredResult(_0xb5ff4d,_0x12a82f){return function(_0x3ff3af){if(_0x3ff3af){var _0x41d5bc=typeof _0x12a82f[_0x1856('0x13')]===_0x1856('0x14')&&typeof _0x12a82f['limit']==='undefined';var _0x340bcd=_0x3ff3af['count'];var _0x4ccc42=_0x41d5bc?0x0:_0x12a82f[_0x1856('0x13')];var _0x2346f6=_0x41d5bc?_0x3ff3af['count']:_0x12a82f['offset']+_0x12a82f[_0x1856('0x15')];var _0x40d229;if(_0x2346f6>=_0x340bcd){_0x2346f6=_0x340bcd;_0x40d229=0xc8;}else{_0x40d229=0xce;}_0xb5ff4d[_0x1856('0x11')](_0x40d229);return _0xb5ff4d[_0x1856('0x16')](_0x1856('0x17'),_0x4ccc42+'-'+_0x2346f6+'/'+_0x340bcd)[_0x1856('0x12')](_0x3ff3af);}return null;};}function patchUpdates(_0x47e94c){return function(_0x3d98e4){try{jsonpatch[_0x1856('0x18')](_0x3d98e4,_0x47e94c,!![]);}catch(_0x1dd95d){return BPromise[_0x1856('0x19')](_0x1dd95d);}return _0x3d98e4[_0x1856('0x1a')]();};}function saveUpdates(_0x988cd2,_0xce310a){return function(_0x4dd5b2){if(_0x4dd5b2){return _0x4dd5b2['update'](_0x988cd2)[_0x1856('0x1b')](function(_0x31df72){return _0x31df72;});}return null;};}function removeEntity(_0x31dc64,_0x4b867e){return function(_0x389ed6){if(_0x389ed6){return _0x389ed6[_0x1856('0x1c')]()[_0x1856('0x1b')](function(){_0x31dc64[_0x1856('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfd069f,_0x25b98d){return function(_0x195546){if(!_0x195546){_0xfd069f[_0x1856('0x10')](0x194);}return _0x195546;};}function handleError(_0x4d4f0c,_0x254d35){_0x254d35=_0x254d35||0x1f4;return function(_0x4022e8){logger['error'](_0x4022e8[_0x1856('0x1d')]);if(_0x4022e8['name']){delete _0x4022e8[_0x1856('0x1e')];}_0x4d4f0c['status'](_0x254d35)[_0x1856('0x1f')](_0x4022e8);};}exports[_0x1856('0x20')]=function(_0x1416b3,_0x3c907b){var _0x4ad54a={},_0x2f3d8f={},_0x155607={'count':0x0,'rows':[]};var _0x1134a5=_[_0x1856('0x21')](db[_0x1856('0x22')][_0x1856('0x23')],function(_0x4b0deb){return{'name':_0x4b0deb[_0x1856('0x24')],'type':_0x4b0deb[_0x1856('0x25')][_0x1856('0x26')]};});_0x2f3d8f['model']=_[_0x1856('0x21')](_0x1134a5,_0x1856('0x1e'));_0x2f3d8f[_0x1856('0x27')]=_['keys'](_0x1416b3[_0x1856('0x27')]);_0x2f3d8f['filters']=_[_0x1856('0x28')](_0x2f3d8f[_0x1856('0x29')],_0x2f3d8f[_0x1856('0x27')]);_0x4ad54a[_0x1856('0x2a')]=_[_0x1856('0x28')](_0x2f3d8f[_0x1856('0x29')],qs[_0x1856('0x2b')](_0x1416b3['query'][_0x1856('0x2b')]));_0x4ad54a[_0x1856('0x2a')]=_0x4ad54a[_0x1856('0x2a')][_0x1856('0x2c')]?_0x4ad54a[_0x1856('0x2a')]:_0x2f3d8f['model'];if(!_0x1416b3[_0x1856('0x27')][_0x1856('0x2d')](_0x1856('0x2e'))){_0x4ad54a['limit']=qs[_0x1856('0x15')](_0x1416b3[_0x1856('0x27')][_0x1856('0x15')]);_0x4ad54a[_0x1856('0x13')]=qs[_0x1856('0x13')](_0x1416b3['query']['offset']);}_0x4ad54a['order']=qs[_0x1856('0x2f')](_0x1416b3['query'][_0x1856('0x2f')]);_0x4ad54a[_0x1856('0x30')]=qs['filters'](_['pick'](_0x1416b3[_0x1856('0x27')],_0x2f3d8f[_0x1856('0x31')]),_0x1134a5);if(_0x1416b3[_0x1856('0x27')][_0x1856('0x32')]){_0x4ad54a['where']=_[_0x1856('0x33')](_0x4ad54a[_0x1856('0x30')],{'$or':_[_0x1856('0x21')](_0x1134a5,function(_0x366c8d){if(_0x366c8d[_0x1856('0x25')]!==_0x1856('0x34')){var _0x2e60c0={};_0x2e60c0[_0x366c8d['name']]={'$like':'%'+_0x1416b3[_0x1856('0x27')][_0x1856('0x32')]+'%'};return _0x2e60c0;}})});}_0x4ad54a=_['merge']({},_0x4ad54a,_0x1416b3[_0x1856('0x35')]);var _0xc1164={'where':_0x4ad54a['where']};return db['ChatQueueReport'][_0x1856('0x36')](_0xc1164)[_0x1856('0x1b')](function(_0x35948b){_0x155607[_0x1856('0x36')]=_0x35948b;if(_0x1416b3[_0x1856('0x27')][_0x1856('0x37')]){_0x4ad54a['include']=[{'all':!![]}];}return db[_0x1856('0x22')]['findAll'](_0x4ad54a);})[_0x1856('0x1b')](function(_0x15608f){_0x155607['rows']=_0x15608f;return _0x155607;})[_0x1856('0x1b')](respondWithFilteredResult(_0x3c907b,_0x4ad54a))[_0x1856('0x38')](handleError(_0x3c907b,null));};exports[_0x1856('0x39')]=function(_0x9020dc,_0x33c137){var _0x3056ad={'raw':!![],'where':{'id':_0x9020dc['params']['id']}},_0xf534ab={};_0xf534ab['model']=_[_0x1856('0x3a')](db['ChatQueueReport']['rawAttributes']);_0xf534ab[_0x1856('0x27')]=_[_0x1856('0x3a')](_0x9020dc['query']);_0xf534ab[_0x1856('0x31')]=_[_0x1856('0x28')](_0xf534ab[_0x1856('0x29')],_0xf534ab[_0x1856('0x27')]);_0x3056ad[_0x1856('0x2a')]=_[_0x1856('0x28')](_0xf534ab[_0x1856('0x29')],qs[_0x1856('0x2b')](_0x9020dc[_0x1856('0x27')][_0x1856('0x2b')]));_0x3056ad['attributes']=_0x3056ad[_0x1856('0x2a')][_0x1856('0x2c')]?_0x3056ad[_0x1856('0x2a')]:_0xf534ab[_0x1856('0x29')];if(_0x9020dc[_0x1856('0x27')]['includeAll']){_0x3056ad[_0x1856('0x3b')]=[{'all':!![]}];}_0x3056ad=_[_0x1856('0x33')]({},_0x3056ad,_0x9020dc[_0x1856('0x35')]);return db[_0x1856('0x22')][_0x1856('0x3c')](_0x3056ad)['then'](handleEntityNotFound(_0x33c137,null))[_0x1856('0x1b')](respondWithResult(_0x33c137,null))[_0x1856('0x38')](handleError(_0x33c137,null));};exports[_0x1856('0x3d')]=function(_0x5799fd,_0x494c34){return db['ChatQueueReport'][_0x1856('0x3d')](_0x5799fd[_0x1856('0x3e')],{})[_0x1856('0x1b')](respondWithResult(_0x494c34,0xc9))[_0x1856('0x38')](handleError(_0x494c34,null));};exports[_0x1856('0x3f')]=function(_0x4b2aa7,_0x24bf19){if(_0x4b2aa7[_0x1856('0x3e')]['id']){delete _0x4b2aa7[_0x1856('0x3e')]['id'];}return db[_0x1856('0x22')]['find']({'where':{'id':_0x4b2aa7[_0x1856('0x40')]['id']}})[_0x1856('0x1b')](handleEntityNotFound(_0x24bf19,null))['then'](saveUpdates(_0x4b2aa7[_0x1856('0x3e')],null))[_0x1856('0x1b')](respondWithResult(_0x24bf19,null))[_0x1856('0x38')](handleError(_0x24bf19,null));};exports[_0x1856('0x1c')]=function(_0x287b7d,_0x26da87){return db[_0x1856('0x22')][_0x1856('0x3c')]({'where':{'id':_0x287b7d['params']['id']}})[_0x1856('0x1b')](handleEntityNotFound(_0x26da87,null))['then'](removeEntity(_0x26da87,null))['catch'](handleError(_0x26da87,null));};exports[_0x1856('0x41')]=function(_0x58bd90,_0x16edbc){return db[_0x1856('0x22')][_0x1856('0x41')]()[_0x1856('0x1b')](respondWithResult(_0x16edbc,null))[_0x1856('0x38')](handleError(_0x16edbc,null));}; \ No newline at end of file +var _0xbd36=['key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','fields','create','body','find','describe','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ChatQueueReport','type'];(function(_0x44e975,_0x22a637){var _0x230633=function(_0x2d8a59){while(--_0x2d8a59){_0x44e975['push'](_0x44e975['shift']());}};_0x230633(++_0x22a637);}(_0xbd36,0x65));var _0x6bd3=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xbd36[_0x24061a];return _0x82054e;};'use strict';var emlformat=require(_0x6bd3('0x0'));var rimraf=require(_0x6bd3('0x1'));var zipdir=require(_0x6bd3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6bd3('0x3'));var BPromise=require(_0x6bd3('0x4'));var Mustache=require('mustache');var util=require(_0x6bd3('0x5'));var path=require(_0x6bd3('0x6'));var sox=require(_0x6bd3('0x7'));var csv=require(_0x6bd3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6bd3('0x9'));var _=require(_0x6bd3('0xa'));var squel=require(_0x6bd3('0xb'));var crypto=require(_0x6bd3('0xc'));var jsforce=require(_0x6bd3('0xd'));var deskjs=require(_0x6bd3('0xe'));var toCsv=require(_0x6bd3('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6bd3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6bd3('0x10'));var as=require(_0x6bd3('0x11'));var hardwareService=require(_0x6bd3('0x12'));var logger=require(_0x6bd3('0x13'))(_0x6bd3('0x14'));var utils=require('../../config/utils');var config=require(_0x6bd3('0x15'));var licenseUtil=require(_0x6bd3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29c44d,_0x43bf5f){_0x43bf5f=_0x43bf5f||0xcc;return function(_0x2a047c){if(_0x2a047c){return _0x29c44d[_0x6bd3('0x17')](_0x43bf5f);}return _0x29c44d[_0x6bd3('0x18')](_0x43bf5f)[_0x6bd3('0x19')]();};}function respondWithResult(_0x4dd159,_0x141121){_0x141121=_0x141121||0xc8;return function(_0x4987f9){if(_0x4987f9){return _0x4dd159[_0x6bd3('0x18')](_0x141121)[_0x6bd3('0x1a')](_0x4987f9);}};}function respondWithFilteredResult(_0x5ad1f8,_0x583df8){return function(_0x47acc9){if(_0x47acc9){var _0x115ca9=typeof _0x583df8['offset']===_0x6bd3('0x1b')&&typeof _0x583df8[_0x6bd3('0x1c')]===_0x6bd3('0x1b');var _0x4732f3=_0x47acc9['count'];var _0x573656=_0x115ca9?0x0:_0x583df8[_0x6bd3('0x1d')];var _0x769de8=_0x115ca9?_0x47acc9[_0x6bd3('0x1e')]:_0x583df8[_0x6bd3('0x1d')]+_0x583df8[_0x6bd3('0x1c')];var _0xf96734;if(_0x769de8>=_0x4732f3){_0x769de8=_0x4732f3;_0xf96734=0xc8;}else{_0xf96734=0xce;}_0x5ad1f8[_0x6bd3('0x18')](_0xf96734);return _0x5ad1f8[_0x6bd3('0x1f')](_0x6bd3('0x20'),_0x573656+'-'+_0x769de8+'/'+_0x4732f3)[_0x6bd3('0x1a')](_0x47acc9);}return null;};}function patchUpdates(_0x256bca){return function(_0x175d46){try{jsonpatch[_0x6bd3('0x21')](_0x175d46,_0x256bca,!![]);}catch(_0x36618c){return BPromise[_0x6bd3('0x22')](_0x36618c);}return _0x175d46[_0x6bd3('0x23')]();};}function saveUpdates(_0x473b10,_0x1d09fd){return function(_0x9ffd4b){if(_0x9ffd4b){return _0x9ffd4b[_0x6bd3('0x24')](_0x473b10)['then'](function(_0x3365a4){return _0x3365a4;});}return null;};}function removeEntity(_0x3a9d0d,_0x28b9a9){return function(_0x52def3){if(_0x52def3){return _0x52def3[_0x6bd3('0x25')]()[_0x6bd3('0x26')](function(){_0x3a9d0d[_0x6bd3('0x18')](0xcc)[_0x6bd3('0x19')]();});}};}function handleEntityNotFound(_0xa8c894,_0x24230d){return function(_0x143055){if(!_0x143055){_0xa8c894[_0x6bd3('0x17')](0x194);}return _0x143055;};}function handleError(_0x49dc5c,_0xab162b){_0xab162b=_0xab162b||0x1f4;return function(_0x585f4e){logger[_0x6bd3('0x27')](_0x585f4e[_0x6bd3('0x28')]);if(_0x585f4e['name']){delete _0x585f4e[_0x6bd3('0x29')];}_0x49dc5c[_0x6bd3('0x18')](_0xab162b)[_0x6bd3('0x2a')](_0x585f4e);};}exports[_0x6bd3('0x2b')]=function(_0x4444bd,_0x1f45af){var _0x7f3385={},_0x552628={},_0xf12e0d={'count':0x0,'rows':[]};var _0xe2772a=_[_0x6bd3('0x2c')](db[_0x6bd3('0x2d')]['rawAttributes'],function(_0x5e1281){return{'name':_0x5e1281['fieldName'],'type':_0x5e1281[_0x6bd3('0x2e')][_0x6bd3('0x2f')]};});_0x552628[_0x6bd3('0x30')]=_[_0x6bd3('0x2c')](_0xe2772a,_0x6bd3('0x29'));_0x552628['query']=_[_0x6bd3('0x31')](_0x4444bd[_0x6bd3('0x32')]);_0x552628['filters']=_[_0x6bd3('0x33')](_0x552628[_0x6bd3('0x30')],_0x552628[_0x6bd3('0x32')]);_0x7f3385['attributes']=_[_0x6bd3('0x33')](_0x552628[_0x6bd3('0x30')],qs['fields'](_0x4444bd[_0x6bd3('0x32')]['fields']));_0x7f3385[_0x6bd3('0x34')]=_0x7f3385[_0x6bd3('0x34')][_0x6bd3('0x35')]?_0x7f3385[_0x6bd3('0x34')]:_0x552628[_0x6bd3('0x30')];if(!_0x4444bd[_0x6bd3('0x32')][_0x6bd3('0x36')]('nolimit')){_0x7f3385[_0x6bd3('0x1c')]=qs[_0x6bd3('0x1c')](_0x4444bd[_0x6bd3('0x32')][_0x6bd3('0x1c')]);_0x7f3385[_0x6bd3('0x1d')]=qs[_0x6bd3('0x1d')](_0x4444bd[_0x6bd3('0x32')][_0x6bd3('0x1d')]);}_0x7f3385[_0x6bd3('0x37')]=qs[_0x6bd3('0x38')](_0x4444bd[_0x6bd3('0x32')]['sort']);_0x7f3385['where']=qs[_0x6bd3('0x39')](_[_0x6bd3('0x3a')](_0x4444bd[_0x6bd3('0x32')],_0x552628[_0x6bd3('0x39')]),_0xe2772a);if(_0x4444bd['query'][_0x6bd3('0x3b')]){_0x7f3385['where']=_[_0x6bd3('0x3c')](_0x7f3385[_0x6bd3('0x3d')],{'$or':_['map'](_0xe2772a,function(_0x4b9031){if(_0x4b9031[_0x6bd3('0x2e')]!==_0x6bd3('0x3e')){var _0x18274d={};_0x18274d[_0x4b9031[_0x6bd3('0x29')]]={'$like':'%'+_0x4444bd['query'][_0x6bd3('0x3b')]+'%'};return _0x18274d;}})});}_0x7f3385=_[_0x6bd3('0x3c')]({},_0x7f3385,_0x4444bd[_0x6bd3('0x3f')]);var _0x581a22={'where':_0x7f3385[_0x6bd3('0x3d')]};return db['ChatQueueReport'][_0x6bd3('0x1e')](_0x581a22)[_0x6bd3('0x26')](function(_0x37019f){_0xf12e0d['count']=_0x37019f;if(_0x4444bd[_0x6bd3('0x32')][_0x6bd3('0x40')]){_0x7f3385[_0x6bd3('0x41')]=[{'all':!![]}];}return db[_0x6bd3('0x2d')]['findAll'](_0x7f3385);})[_0x6bd3('0x26')](function(_0x41199e){_0xf12e0d['rows']=_0x41199e;return _0xf12e0d;})[_0x6bd3('0x26')](respondWithFilteredResult(_0x1f45af,_0x7f3385))[_0x6bd3('0x42')](handleError(_0x1f45af,null));};exports['show']=function(_0x100015,_0x397dc8){var _0xe2ca49={'raw':!![],'where':{'id':_0x100015[_0x6bd3('0x43')]['id']}},_0x1dbd4c={};_0x1dbd4c[_0x6bd3('0x30')]=_[_0x6bd3('0x31')](db[_0x6bd3('0x2d')][_0x6bd3('0x44')]);_0x1dbd4c['query']=_[_0x6bd3('0x31')](_0x100015['query']);_0x1dbd4c[_0x6bd3('0x39')]=_[_0x6bd3('0x33')](_0x1dbd4c[_0x6bd3('0x30')],_0x1dbd4c[_0x6bd3('0x32')]);_0xe2ca49[_0x6bd3('0x34')]=_[_0x6bd3('0x33')](_0x1dbd4c[_0x6bd3('0x30')],qs[_0x6bd3('0x45')](_0x100015[_0x6bd3('0x32')][_0x6bd3('0x45')]));_0xe2ca49['attributes']=_0xe2ca49[_0x6bd3('0x34')]['length']?_0xe2ca49[_0x6bd3('0x34')]:_0x1dbd4c[_0x6bd3('0x30')];if(_0x100015['query'][_0x6bd3('0x40')]){_0xe2ca49['include']=[{'all':!![]}];}_0xe2ca49=_[_0x6bd3('0x3c')]({},_0xe2ca49,_0x100015[_0x6bd3('0x3f')]);return db[_0x6bd3('0x2d')]['find'](_0xe2ca49)[_0x6bd3('0x26')](handleEntityNotFound(_0x397dc8,null))[_0x6bd3('0x26')](respondWithResult(_0x397dc8,null))[_0x6bd3('0x42')](handleError(_0x397dc8,null));};exports[_0x6bd3('0x46')]=function(_0xfd7b2,_0xba735e){return db['ChatQueueReport'][_0x6bd3('0x46')](_0xfd7b2[_0x6bd3('0x47')],{})[_0x6bd3('0x26')](respondWithResult(_0xba735e,0xc9))['catch'](handleError(_0xba735e,null));};exports[_0x6bd3('0x24')]=function(_0x59cee9,_0x52dfb1){if(_0x59cee9[_0x6bd3('0x47')]['id']){delete _0x59cee9[_0x6bd3('0x47')]['id'];}return db['ChatQueueReport'][_0x6bd3('0x48')]({'where':{'id':_0x59cee9['params']['id']}})[_0x6bd3('0x26')](handleEntityNotFound(_0x52dfb1,null))[_0x6bd3('0x26')](saveUpdates(_0x59cee9[_0x6bd3('0x47')],null))[_0x6bd3('0x26')](respondWithResult(_0x52dfb1,null))[_0x6bd3('0x42')](handleError(_0x52dfb1,null));};exports['destroy']=function(_0x4e4b52,_0x417e4f){return db['ChatQueueReport'][_0x6bd3('0x48')]({'where':{'id':_0x4e4b52[_0x6bd3('0x43')]['id']}})[_0x6bd3('0x26')](handleEntityNotFound(_0x417e4f,null))[_0x6bd3('0x26')](removeEntity(_0x417e4f,null))['catch'](handleError(_0x417e4f,null));};exports[_0x6bd3('0x49')]=function(_0x3a21f0,_0x5b2f38){return db[_0x6bd3('0x2d')]['describe']()[_0x6bd3('0x26')](respondWithResult(_0x5b2f38,null))[_0x6bd3('0x42')](handleError(_0x5b2f38,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 3c682e7..d81850f 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 _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x148c22,_0x7f34c1){var _0x16b05b=function(_0x286801){while(--_0x286801){_0x148c22['push'](_0x148c22['shift']());}};_0x16b05b(++_0x7f34c1);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0xcb91[_0x14a862];return _0x245eb5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x19115e,_0x507bab){var _0x45bbd4=function(_0x1308bf){while(--_0x1308bf){_0x19115e['push'](_0x19115e['shift']());}};_0x45bbd4(++_0x507bab);}(_0xb10b,0x12a));var _0xbb10=function(_0x4fae14,_0x4ef118){_0x4fae14=_0x4fae14-0x0;var _0x305e46=_0xb10b[_0x4fae14];return _0x305e46;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 889b166..6fc401b 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 _0xcb65=['catch','update','limit','UpdateChatQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CreateChatQueueReport','ChatQueueReport','create','body','options','raw'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xcb65,0x13a));var _0x5cb6=function(_0x38ff0f,_0x58fc59){_0x38ff0f=_0x38ff0f-0x0;var _0x597aa2=_0xcb65[_0x38ff0f];return _0x597aa2;};'use strict';var _=require('lodash');var util=require(_0x5cb6('0x0'));var moment=require(_0x5cb6('0x1'));var BPromise=require(_0x5cb6('0x2'));var rs=require(_0x5cb6('0x3'));var fs=require('fs');var Redis=require(_0x5cb6('0x4'));var db=require(_0x5cb6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5cb6('0x6'))(_0x5cb6('0x7'));var config=require('../../config/environment');var jayson=require(_0x5cb6('0x8'));var client=jayson[_0x5cb6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25aa66,_0x77cb95,_0x1e8961){return new BPromise(function(_0x267f94,_0x483556){return client[_0x5cb6('0xa')](_0x25aa66,_0x1e8961)[_0x5cb6('0xb')](function(_0x4f2577){logger['info'](_0x5cb6('0xc'),_0x77cb95,_0x5cb6('0xd'));logger[_0x5cb6('0xe')](_0x5cb6('0xf'),_0x77cb95,_0x5cb6('0xd'),JSON[_0x5cb6('0x10')](_0x4f2577));if(_0x4f2577[_0x5cb6('0x11')]){if(_0x4f2577[_0x5cb6('0x11')][_0x5cb6('0x12')]===0x1f4){logger[_0x5cb6('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x77cb95,_0x4f2577['error'][_0x5cb6('0x13')]);return _0x483556(_0x4f2577['error'][_0x5cb6('0x13')]);}logger[_0x5cb6('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x77cb95,_0x4f2577[_0x5cb6('0x11')][_0x5cb6('0x13')]);return _0x267f94(_0x4f2577[_0x5cb6('0x11')][_0x5cb6('0x13')]);}else{logger[_0x5cb6('0x14')](_0x5cb6('0xc'),_0x77cb95,_0x5cb6('0xd'));_0x267f94(_0x4f2577['result'][_0x5cb6('0x13')]);}})['catch'](function(_0x2b716a){logger[_0x5cb6('0x11')](_0x5cb6('0xc'),_0x77cb95,_0x2b716a);_0x483556(_0x2b716a);});});}exports[_0x5cb6('0x15')]=function(_0x380315){var _0x15337e=this;return new Promise(function(_0x5d2d92,_0x5cca16){return db[_0x5cb6('0x16')][_0x5cb6('0x17')](_0x380315[_0x5cb6('0x18')],{'raw':_0x380315[_0x5cb6('0x19')]?_0x380315[_0x5cb6('0x19')][_0x5cb6('0x1a')]===undefined?!![]:![]:!![]})[_0x5cb6('0xb')](function(_0x6e7c95){logger[_0x5cb6('0x14')](_0x5cb6('0x15'),_0x380315);logger[_0x5cb6('0xe')](_0x5cb6('0x15'),_0x380315,JSON['stringify'](_0x6e7c95));_0x5d2d92(_0x6e7c95);})[_0x5cb6('0x1b')](function(_0x3e8f51){logger[_0x5cb6('0x11')]('CreateChatQueueReport',_0x3e8f51[_0x5cb6('0x13')],_0x380315);_0x5cca16(_0x15337e[_0x5cb6('0x11')](0x1f4,_0x3e8f51[_0x5cb6('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0x1d330b){var _0x428c9d=this;return new Promise(function(_0x322b3b,_0x2614ff){return db[_0x5cb6('0x16')][_0x5cb6('0x1c')](_0x1d330b['body'],{'raw':_0x1d330b[_0x5cb6('0x19')]?_0x1d330b[_0x5cb6('0x19')][_0x5cb6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d330b[_0x5cb6('0x19')]?_0x1d330b['options']['where']||null:null,'attributes':_0x1d330b[_0x5cb6('0x19')]?_0x1d330b[_0x5cb6('0x19')]['attributes']||null:null,'limit':_0x1d330b[_0x5cb6('0x19')]?_0x1d330b[_0x5cb6('0x19')][_0x5cb6('0x1d')]||null:null})['then'](function(_0x4d0e8c){logger[_0x5cb6('0x14')]('UpdateChatQueueReport',_0x1d330b);logger[_0x5cb6('0xe')](_0x5cb6('0x1e'),_0x1d330b,JSON[_0x5cb6('0x10')](_0x4d0e8c));_0x322b3b(_0x4d0e8c);})[_0x5cb6('0x1b')](function(_0x260c76){logger['error'](_0x5cb6('0x1e'),_0x260c76[_0x5cb6('0x13')],_0x1d330b);_0x2614ff(_0x428c9d[_0x5cb6('0x11')](0x1f4,_0x260c76[_0x5cb6('0x13')]));});});}; \ No newline at end of file +var _0x41a7=['ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','UpdateChatQueueReport','update','raw','where','limit','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x26afa3,_0x44d9ef){var _0x359173=function(_0x55b4ce){while(--_0x55b4ce){_0x26afa3['push'](_0x26afa3['shift']());}};_0x359173(++_0x44d9ef);}(_0x41a7,0x15d));var _0x741a=function(_0x289e8d,_0x31abee){_0x289e8d=_0x289e8d-0x0;var _0x505945=_0x41a7[_0x289e8d];return _0x505945;};'use strict';var _=require(_0x741a('0x0'));var util=require('util');var moment=require(_0x741a('0x1'));var BPromise=require(_0x741a('0x2'));var rs=require(_0x741a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x741a('0x4'))['db'];var utils=require(_0x741a('0x5'));var logger=require(_0x741a('0x6'))(_0x741a('0x7'));var config=require(_0x741a('0x8'));var jayson=require(_0x741a('0x9'));var client=jayson[_0x741a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5914c9,_0x52d60d,_0x3fcddb){return new BPromise(function(_0x1a98e0,_0x1846f1){return client[_0x741a('0xb')](_0x5914c9,_0x3fcddb)[_0x741a('0xc')](function(_0x217955){logger[_0x741a('0xd')](_0x741a('0xe'),_0x52d60d,_0x741a('0xf'));logger[_0x741a('0x10')](_0x741a('0x11'),_0x52d60d,_0x741a('0xf'),JSON[_0x741a('0x12')](_0x217955));if(_0x217955[_0x741a('0x13')]){if(_0x217955[_0x741a('0x13')]['code']===0x1f4){logger[_0x741a('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x52d60d,_0x217955[_0x741a('0x13')][_0x741a('0x14')]);return _0x1846f1(_0x217955[_0x741a('0x13')][_0x741a('0x14')]);}logger[_0x741a('0x13')]('ChatQueueReport,\x20%s,\x20%s',_0x52d60d,_0x217955[_0x741a('0x13')][_0x741a('0x14')]);return _0x1a98e0(_0x217955[_0x741a('0x13')][_0x741a('0x14')]);}else{logger['info'](_0x741a('0xe'),_0x52d60d,_0x741a('0xf'));_0x1a98e0(_0x217955[_0x741a('0x15')][_0x741a('0x14')]);}})[_0x741a('0x16')](function(_0x1a728b){logger[_0x741a('0x13')](_0x741a('0xe'),_0x52d60d,_0x1a728b);_0x1846f1(_0x1a728b);});});}exports[_0x741a('0x17')]=function(_0x1ebd36){var _0x397253=this;return new Promise(function(_0xca5bd3,_0x38505c){return db[_0x741a('0x18')][_0x741a('0x19')](_0x1ebd36[_0x741a('0x1a')],{'raw':_0x1ebd36[_0x741a('0x1b')]?_0x1ebd36['options']['raw']===undefined?!![]:![]:!![]})[_0x741a('0xc')](function(_0x2b899b){logger[_0x741a('0xd')]('CreateChatQueueReport',_0x1ebd36);logger[_0x741a('0x10')](_0x741a('0x17'),_0x1ebd36,JSON['stringify'](_0x2b899b));_0xca5bd3(_0x2b899b);})[_0x741a('0x16')](function(_0x3191fa){logger['error'](_0x741a('0x17'),_0x3191fa[_0x741a('0x14')],_0x1ebd36);_0x38505c(_0x397253[_0x741a('0x13')](0x1f4,_0x3191fa[_0x741a('0x14')]));});});};exports[_0x741a('0x1c')]=function(_0x4740da){var _0x4793f7=this;return new Promise(function(_0x38c3d0,_0x3fa718){return db[_0x741a('0x18')][_0x741a('0x1d')](_0x4740da['body'],{'raw':_0x4740da['options']?_0x4740da['options'][_0x741a('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4740da[_0x741a('0x1b')]?_0x4740da[_0x741a('0x1b')][_0x741a('0x1f')]||null:null,'attributes':_0x4740da[_0x741a('0x1b')]?_0x4740da[_0x741a('0x1b')]['attributes']||null:null,'limit':_0x4740da[_0x741a('0x1b')]?_0x4740da[_0x741a('0x1b')][_0x741a('0x20')]||null:null})[_0x741a('0xc')](function(_0x1edf18){logger['info']('UpdateChatQueueReport',_0x4740da);logger[_0x741a('0x10')](_0x741a('0x1c'),_0x4740da,JSON[_0x741a('0x12')](_0x1edf18));_0x38c3d0(_0x1edf18);})[_0x741a('0x16')](function(_0x4f5fe5){logger[_0x741a('0x13')](_0x741a('0x1c'),_0x4f5fe5[_0x741a('0x14')],_0x4740da);_0x3fa718(_0x4793f7[_0x741a('0x13')](0x1f4,_0x4f5fe5['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index d92855b..532c2dd 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 _0xea74=['create','put','/:id','delete','destroy','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','describe','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xea74,0xa5));var _0x4ea7=function(_0x5fd64d,_0x470bc4){_0x5fd64d=_0x5fd64d-0x0;var _0x5075eb=_0xea74[_0x5fd64d];return _0x5075eb;};'use strict';var multer=require('multer');var util=require(_0x4ea7('0x0'));var path=require(_0x4ea7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4ea7('0x2')]();var fs_extra=require(_0x4ea7('0x3'));var auth=require(_0x4ea7('0x4'));var interaction=require(_0x4ea7('0x5'));var config=require(_0x4ea7('0x6'));var controller=require(_0x4ea7('0x7'));router[_0x4ea7('0x8')]('/',auth['isAuthenticated'](),controller[_0x4ea7('0x9')]);router[_0x4ea7('0x8')](_0x4ea7('0xa'),auth[_0x4ea7('0xb')](),controller[_0x4ea7('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4ea7('0xd')]);router[_0x4ea7('0xe')]('/',auth[_0x4ea7('0xb')](),controller[_0x4ea7('0xf')]);router[_0x4ea7('0x10')](_0x4ea7('0x11'),auth[_0x4ea7('0xb')](),controller['update']);router[_0x4ea7('0x12')]('/:id',auth[_0x4ea7('0xb')](),controller[_0x4ea7('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6735=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x6735,0xb9));var _0x5673=function(_0x517b77,_0x5d4943){_0x517b77=_0x517b77-0x0;var _0x4b6ef4=_0x6735[_0x517b77];return _0x4b6ef4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5673('0x0'));var timeout=require(_0x5673('0x1'));var express=require(_0x5673('0x2'));var router=express[_0x5673('0x3')]();var fs_extra=require(_0x5673('0x4'));var auth=require(_0x5673('0x5'));var interaction=require(_0x5673('0x6'));var config=require(_0x5673('0x7'));var controller=require(_0x5673('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5673('0x9')](_0x5673('0xa'),auth[_0x5673('0xb')](),controller['describe']);router['get'](_0x5673('0xc'),auth[_0x5673('0xb')](),controller[_0x5673('0xd')]);router[_0x5673('0xe')]('/',auth[_0x5673('0xb')](),controller[_0x5673('0xf')]);router['put'](_0x5673('0xc'),auth[_0x5673('0xb')](),controller['update']);router[_0x5673('0x10')](_0x5673('0xc'),auth[_0x5673('0xb')](),controller[_0x5673('0x11')]);module[_0x5673('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 63044d0..982ab1c 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(_0x5d0bf8,_0x4c2031){var _0x57f5b8=function(_0x2df711){while(--_0x2df711){_0x5d0bf8['push'](_0x5d0bf8['shift']());}};_0x57f5b8(++_0x4c2031);}(_0xedd9,0xfc));var _0x9edd=function(_0x554beb,_0x1b790e){_0x554beb=_0x554beb-0x0;var _0xcc737f=_0xedd9[_0x554beb];return _0xcc737f;};'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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0xdb810a,_0x3007f8){var _0x3954ba=function(_0x34a8d5){while(--_0x34a8d5){_0xdb810a['push'](_0xdb810a['shift']());}};_0x3954ba(++_0x3007f8);}(_0x34e8,0x12c));var _0x834e=function(_0x5c35ca,_0xf2c0b){_0x5c35ca=_0x5c35ca-0x0;var _0x1827d0=_0x34e8[_0x5c35ca];return _0x1827d0;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 569e3ae..32f0fd1 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 _0xb916=['destroy','end','name','send','index','fieldName','type','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','ChatTransferReport','includeAll','include','findAll','catch','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','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/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then'];(function(_0x2dff52,_0x5bb302){var _0x38040e=function(_0x428706){while(--_0x428706){_0x2dff52['push'](_0x2dff52['shift']());}};_0x38040e(++_0x5bb302);}(_0xb916,0x13b));var _0x6b91=function(_0x3eb4a9,_0x359d73){_0x3eb4a9=_0x3eb4a9-0x0;var _0x48dbad=_0xb916[_0x3eb4a9];return _0x48dbad;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6b91('0x0'));var jsonpatch=require(_0x6b91('0x1'));var rp=require(_0x6b91('0x2'));var moment=require('moment');var BPromise=require(_0x6b91('0x3'));var Mustache=require(_0x6b91('0x4'));var util=require(_0x6b91('0x5'));var path=require(_0x6b91('0x6'));var sox=require('sox');var csv=require(_0x6b91('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b91('0x8'));var _=require(_0x6b91('0x9'));var squel=require(_0x6b91('0xa'));var crypto=require(_0x6b91('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x6b91('0xc'));var toCsv=require(_0x6b91('0x7'));var querystring=require(_0x6b91('0xd'));var Papa=require(_0x6b91('0xe'));var Redis=require(_0x6b91('0xf'));var authService=require(_0x6b91('0x10'));var qs=require(_0x6b91('0x11'));var as=require(_0x6b91('0x12'));var hardwareService=require(_0x6b91('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6b91('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6b91('0x15'));var db=require(_0x6b91('0x16'))['db'];function respondWithStatusCode(_0x57e532,_0x139bcd){_0x139bcd=_0x139bcd||0xcc;return function(_0x157337){if(_0x157337){return _0x57e532['sendStatus'](_0x139bcd);}return _0x57e532[_0x6b91('0x17')](_0x139bcd)['end']();};}function respondWithResult(_0x280991,_0x2b1afc){_0x2b1afc=_0x2b1afc||0xc8;return function(_0x244059){if(_0x244059){return _0x280991['status'](_0x2b1afc)[_0x6b91('0x18')](_0x244059);}};}function respondWithFilteredResult(_0x1bef31,_0x3fd166){return function(_0x5c5194){if(_0x5c5194){var _0xa8c83b=typeof _0x3fd166[_0x6b91('0x19')]===_0x6b91('0x1a')&&typeof _0x3fd166[_0x6b91('0x1b')]==='undefined';var _0x4496e1=_0x5c5194[_0x6b91('0x1c')];var _0x3de392=_0xa8c83b?0x0:_0x3fd166[_0x6b91('0x19')];var _0x5c1d37=_0xa8c83b?_0x5c5194[_0x6b91('0x1c')]:_0x3fd166[_0x6b91('0x19')]+_0x3fd166['limit'];var _0x966454;if(_0x5c1d37>=_0x4496e1){_0x5c1d37=_0x4496e1;_0x966454=0xc8;}else{_0x966454=0xce;}_0x1bef31['status'](_0x966454);return _0x1bef31[_0x6b91('0x1d')](_0x6b91('0x1e'),_0x3de392+'-'+_0x5c1d37+'/'+_0x4496e1)[_0x6b91('0x18')](_0x5c5194);}return null;};}function patchUpdates(_0xbc88e4){return function(_0xfcff31){try{jsonpatch[_0x6b91('0x1f')](_0xfcff31,_0xbc88e4,!![]);}catch(_0x301352){return BPromise['reject'](_0x301352);}return _0xfcff31[_0x6b91('0x20')]();};}function saveUpdates(_0x469a57,_0x3e5abc){return function(_0x47cf71){if(_0x47cf71){return _0x47cf71[_0x6b91('0x21')](_0x469a57)[_0x6b91('0x22')](function(_0x1c3328){return _0x1c3328;});}return null;};}function removeEntity(_0x4a46b0,_0x7b7c27){return function(_0x1561cb){if(_0x1561cb){return _0x1561cb[_0x6b91('0x23')]()[_0x6b91('0x22')](function(){_0x4a46b0['status'](0xcc)[_0x6b91('0x24')]();});}};}function handleEntityNotFound(_0xad6862,_0x211eb5){return function(_0x310e5e){if(!_0x310e5e){_0xad6862['sendStatus'](0x194);}return _0x310e5e;};}function handleError(_0x45a2a9,_0x3344be){_0x3344be=_0x3344be||0x1f4;return function(_0x4776bb){logger['error'](_0x4776bb['stack']);if(_0x4776bb[_0x6b91('0x25')]){delete _0x4776bb[_0x6b91('0x25')];}_0x45a2a9[_0x6b91('0x17')](_0x3344be)[_0x6b91('0x26')](_0x4776bb);};}exports[_0x6b91('0x27')]=function(_0x180f2c,_0x2a83aa){var _0x342af2={},_0x309d71={},_0x34f070={'count':0x0,'rows':[]};var _0x5aebd0=_['map'](db['ChatTransferReport']['rawAttributes'],function(_0x319859){return{'name':_0x319859[_0x6b91('0x28')],'type':_0x319859[_0x6b91('0x29')]['key']};});_0x309d71['model']=_[_0x6b91('0x2a')](_0x5aebd0,'name');_0x309d71[_0x6b91('0x2b')]=_[_0x6b91('0x2c')](_0x180f2c[_0x6b91('0x2b')]);_0x309d71['filters']=_[_0x6b91('0x2d')](_0x309d71['model'],_0x309d71[_0x6b91('0x2b')]);_0x342af2[_0x6b91('0x2e')]=_[_0x6b91('0x2d')](_0x309d71[_0x6b91('0x2f')],qs[_0x6b91('0x30')](_0x180f2c[_0x6b91('0x2b')][_0x6b91('0x30')]));_0x342af2[_0x6b91('0x2e')]=_0x342af2[_0x6b91('0x2e')][_0x6b91('0x31')]?_0x342af2[_0x6b91('0x2e')]:_0x309d71[_0x6b91('0x2f')];if(!_0x180f2c['query'][_0x6b91('0x32')](_0x6b91('0x33'))){_0x342af2[_0x6b91('0x1b')]=qs[_0x6b91('0x1b')](_0x180f2c['query'][_0x6b91('0x1b')]);_0x342af2['offset']=qs['offset'](_0x180f2c[_0x6b91('0x2b')][_0x6b91('0x19')]);}_0x342af2[_0x6b91('0x34')]=qs[_0x6b91('0x35')](_0x180f2c[_0x6b91('0x2b')][_0x6b91('0x35')]);_0x342af2[_0x6b91('0x36')]=qs[_0x6b91('0x37')](_[_0x6b91('0x38')](_0x180f2c['query'],_0x309d71[_0x6b91('0x37')]),_0x5aebd0);if(_0x180f2c[_0x6b91('0x2b')]['filter']){_0x342af2[_0x6b91('0x36')]=_[_0x6b91('0x39')](_0x342af2['where'],{'$or':_[_0x6b91('0x2a')](_0x5aebd0,function(_0x23cbf8){if(_0x23cbf8[_0x6b91('0x29')]!=='VIRTUAL'){var _0x3bf29d={};_0x3bf29d[_0x23cbf8[_0x6b91('0x25')]]={'$like':'%'+_0x180f2c[_0x6b91('0x2b')][_0x6b91('0x3a')]+'%'};return _0x3bf29d;}})});}_0x342af2=_['merge']({},_0x342af2,_0x180f2c[_0x6b91('0x3b')]);var _0x3ec280={'where':_0x342af2['where']};return db[_0x6b91('0x3c')][_0x6b91('0x1c')](_0x3ec280)[_0x6b91('0x22')](function(_0x2dfbeb){_0x34f070[_0x6b91('0x1c')]=_0x2dfbeb;if(_0x180f2c[_0x6b91('0x2b')][_0x6b91('0x3d')]){_0x342af2[_0x6b91('0x3e')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x6b91('0x3f')](_0x342af2);})[_0x6b91('0x22')](function(_0x3a86ab){_0x34f070['rows']=_0x3a86ab;return _0x34f070;})[_0x6b91('0x22')](respondWithFilteredResult(_0x2a83aa,_0x342af2))[_0x6b91('0x40')](handleError(_0x2a83aa,null));};exports['show']=function(_0x3c948c,_0x23b684){var _0x8bed45={'raw':!![],'where':{'id':_0x3c948c['params']['id']}},_0xfc4e8a={};_0xfc4e8a[_0x6b91('0x2f')]=_['keys'](db[_0x6b91('0x3c')]['rawAttributes']);_0xfc4e8a[_0x6b91('0x2b')]=_['keys'](_0x3c948c['query']);_0xfc4e8a[_0x6b91('0x37')]=_[_0x6b91('0x2d')](_0xfc4e8a[_0x6b91('0x2f')],_0xfc4e8a[_0x6b91('0x2b')]);_0x8bed45[_0x6b91('0x2e')]=_['intersection'](_0xfc4e8a[_0x6b91('0x2f')],qs[_0x6b91('0x30')](_0x3c948c[_0x6b91('0x2b')]['fields']));_0x8bed45[_0x6b91('0x2e')]=_0x8bed45[_0x6b91('0x2e')][_0x6b91('0x31')]?_0x8bed45[_0x6b91('0x2e')]:_0xfc4e8a[_0x6b91('0x2f')];if(_0x3c948c[_0x6b91('0x2b')][_0x6b91('0x3d')]){_0x8bed45[_0x6b91('0x3e')]=[{'all':!![]}];}_0x8bed45=_[_0x6b91('0x39')]({},_0x8bed45,_0x3c948c[_0x6b91('0x3b')]);return db[_0x6b91('0x3c')][_0x6b91('0x41')](_0x8bed45)[_0x6b91('0x22')](handleEntityNotFound(_0x23b684,null))['then'](respondWithResult(_0x23b684,null))[_0x6b91('0x40')](handleError(_0x23b684,null));};exports[_0x6b91('0x42')]=function(_0x24e420,_0x5e91ae){return db[_0x6b91('0x3c')][_0x6b91('0x42')](_0x24e420[_0x6b91('0x43')],{})[_0x6b91('0x22')](respondWithResult(_0x5e91ae,0xc9))[_0x6b91('0x40')](handleError(_0x5e91ae,null));};exports[_0x6b91('0x21')]=function(_0x1ca701,_0x3a5e5b){if(_0x1ca701[_0x6b91('0x43')]['id']){delete _0x1ca701[_0x6b91('0x43')]['id'];}return db[_0x6b91('0x3c')][_0x6b91('0x41')]({'where':{'id':_0x1ca701[_0x6b91('0x44')]['id']}})['then'](handleEntityNotFound(_0x3a5e5b,null))['then'](saveUpdates(_0x1ca701[_0x6b91('0x43')],null))[_0x6b91('0x22')](respondWithResult(_0x3a5e5b,null))[_0x6b91('0x40')](handleError(_0x3a5e5b,null));};exports[_0x6b91('0x23')]=function(_0x3bcdac,_0x21017f){return db[_0x6b91('0x3c')][_0x6b91('0x41')]({'where':{'id':_0x3bcdac['params']['id']}})['then'](handleEntityNotFound(_0x21017f,null))['then'](removeEntity(_0x21017f,null))[_0x6b91('0x40')](handleError(_0x21017f,null));};exports[_0x6b91('0x45')]=function(_0xb2789c,_0x2cbdd4){return db[_0x6b91('0x3c')]['describe']()[_0x6b91('0x22')](respondWithResult(_0x2cbdd4,null))[_0x6b91('0x40')](handleError(_0x2cbdd4,null));}; \ No newline at end of file +var _0x72cd=['hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','count','limit','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x5631ce,_0xe5444b){var _0x4af29d=function(_0xb29074){while(--_0xb29074){_0x5631ce['push'](_0x5631ce['shift']());}};_0x4af29d(++_0xe5444b);}(_0x72cd,0x140));var _0xd72c=function(_0x309366,_0x1210e2){_0x309366=_0x309366-0x0;var _0x3d96e1=_0x72cd[_0x309366];return _0x3d96e1;};'use strict';var emlformat=require(_0xd72c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd72c('0x1'));var jsonpatch=require(_0xd72c('0x2'));var rp=require(_0xd72c('0x3'));var moment=require(_0xd72c('0x4'));var BPromise=require(_0xd72c('0x5'));var Mustache=require(_0xd72c('0x6'));var util=require(_0xd72c('0x7'));var path=require(_0xd72c('0x8'));var sox=require('sox');var csv=require(_0xd72c('0x9'));var ejs=require(_0xd72c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd72c('0xb'));var squel=require('squel');var crypto=require(_0xd72c('0xc'));var jsforce=require(_0xd72c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd72c('0x9'));var querystring=require('querystring');var Papa=require(_0xd72c('0xe'));var Redis=require(_0xd72c('0xf'));var authService=require(_0xd72c('0x10'));var qs=require(_0xd72c('0x11'));var as=require(_0xd72c('0x12'));var hardwareService=require(_0xd72c('0x13'));var logger=require(_0xd72c('0x14'))(_0xd72c('0x15'));var utils=require(_0xd72c('0x16'));var config=require(_0xd72c('0x17'));var licenseUtil=require(_0xd72c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48eec9,_0x23b69d){_0x23b69d=_0x23b69d||0xcc;return function(_0x239905){if(_0x239905){return _0x48eec9['sendStatus'](_0x23b69d);}return _0x48eec9['status'](_0x23b69d)[_0xd72c('0x19')]();};}function respondWithResult(_0x467e9c,_0x524cf5){_0x524cf5=_0x524cf5||0xc8;return function(_0x59621c){if(_0x59621c){return _0x467e9c[_0xd72c('0x1a')](_0x524cf5)[_0xd72c('0x1b')](_0x59621c);}};}function respondWithFilteredResult(_0x284f60,_0x10833){return function(_0x2844db){if(_0x2844db){var _0x26d02c=typeof _0x10833[_0xd72c('0x1c')]==='undefined'&&typeof _0x10833['limit']===_0xd72c('0x1d');var _0x59d33f=_0x2844db[_0xd72c('0x1e')];var _0x51b4cb=_0x26d02c?0x0:_0x10833[_0xd72c('0x1c')];var _0x30ca6a=_0x26d02c?_0x2844db[_0xd72c('0x1e')]:_0x10833['offset']+_0x10833[_0xd72c('0x1f')];var _0x4ceb66;if(_0x30ca6a>=_0x59d33f){_0x30ca6a=_0x59d33f;_0x4ceb66=0xc8;}else{_0x4ceb66=0xce;}_0x284f60[_0xd72c('0x1a')](_0x4ceb66);return _0x284f60['set'](_0xd72c('0x20'),_0x51b4cb+'-'+_0x30ca6a+'/'+_0x59d33f)[_0xd72c('0x1b')](_0x2844db);}return null;};}function patchUpdates(_0x32224a){return function(_0x78c6af){try{jsonpatch[_0xd72c('0x21')](_0x78c6af,_0x32224a,!![]);}catch(_0x596968){return BPromise['reject'](_0x596968);}return _0x78c6af['save']();};}function saveUpdates(_0x4400b5,_0x1ec55f){return function(_0x5731e5){if(_0x5731e5){return _0x5731e5[_0xd72c('0x22')](_0x4400b5)[_0xd72c('0x23')](function(_0x2aa381){return _0x2aa381;});}return null;};}function removeEntity(_0x33a52f,_0x29841d){return function(_0x3ded65){if(_0x3ded65){return _0x3ded65[_0xd72c('0x24')]()[_0xd72c('0x23')](function(){_0x33a52f[_0xd72c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bb05a,_0x499fc5){return function(_0x3bd8b2){if(!_0x3bd8b2){_0x1bb05a[_0xd72c('0x25')](0x194);}return _0x3bd8b2;};}function handleError(_0x152e57,_0x38f11a){_0x38f11a=_0x38f11a||0x1f4;return function(_0x38e4b3){logger[_0xd72c('0x26')](_0x38e4b3[_0xd72c('0x27')]);if(_0x38e4b3[_0xd72c('0x28')]){delete _0x38e4b3[_0xd72c('0x28')];}_0x152e57[_0xd72c('0x1a')](_0x38f11a)['send'](_0x38e4b3);};}exports[_0xd72c('0x29')]=function(_0x123969,_0x225985){var _0x483b98={},_0x481c9b={},_0x3c0366={'count':0x0,'rows':[]};var _0x4950e5=_[_0xd72c('0x2a')](db[_0xd72c('0x2b')][_0xd72c('0x2c')],function(_0x48f29a){return{'name':_0x48f29a[_0xd72c('0x2d')],'type':_0x48f29a[_0xd72c('0x2e')][_0xd72c('0x2f')]};});_0x481c9b[_0xd72c('0x30')]=_[_0xd72c('0x2a')](_0x4950e5,_0xd72c('0x28'));_0x481c9b[_0xd72c('0x31')]=_['keys'](_0x123969[_0xd72c('0x31')]);_0x481c9b[_0xd72c('0x32')]=_[_0xd72c('0x33')](_0x481c9b[_0xd72c('0x30')],_0x481c9b[_0xd72c('0x31')]);_0x483b98[_0xd72c('0x34')]=_[_0xd72c('0x33')](_0x481c9b[_0xd72c('0x30')],qs[_0xd72c('0x35')](_0x123969['query'][_0xd72c('0x35')]));_0x483b98[_0xd72c('0x34')]=_0x483b98[_0xd72c('0x34')][_0xd72c('0x36')]?_0x483b98[_0xd72c('0x34')]:_0x481c9b[_0xd72c('0x30')];if(!_0x123969[_0xd72c('0x31')][_0xd72c('0x37')](_0xd72c('0x38'))){_0x483b98[_0xd72c('0x1f')]=qs[_0xd72c('0x1f')](_0x123969[_0xd72c('0x31')]['limit']);_0x483b98[_0xd72c('0x1c')]=qs[_0xd72c('0x1c')](_0x123969[_0xd72c('0x31')][_0xd72c('0x1c')]);}_0x483b98[_0xd72c('0x39')]=qs['sort'](_0x123969[_0xd72c('0x31')][_0xd72c('0x3a')]);_0x483b98[_0xd72c('0x3b')]=qs[_0xd72c('0x32')](_['pick'](_0x123969[_0xd72c('0x31')],_0x481c9b[_0xd72c('0x32')]),_0x4950e5);if(_0x123969[_0xd72c('0x31')][_0xd72c('0x3c')]){_0x483b98['where']=_[_0xd72c('0x3d')](_0x483b98[_0xd72c('0x3b')],{'$or':_['map'](_0x4950e5,function(_0x75cc72){if(_0x75cc72[_0xd72c('0x2e')]!==_0xd72c('0x3e')){var _0x5300b2={};_0x5300b2[_0x75cc72[_0xd72c('0x28')]]={'$like':'%'+_0x123969[_0xd72c('0x31')][_0xd72c('0x3c')]+'%'};return _0x5300b2;}})});}_0x483b98=_[_0xd72c('0x3d')]({},_0x483b98,_0x123969[_0xd72c('0x3f')]);var _0x45c7af={'where':_0x483b98[_0xd72c('0x3b')]};return db[_0xd72c('0x2b')][_0xd72c('0x1e')](_0x45c7af)[_0xd72c('0x23')](function(_0x11c86d){_0x3c0366[_0xd72c('0x1e')]=_0x11c86d;if(_0x123969['query'][_0xd72c('0x40')]){_0x483b98['include']=[{'all':!![]}];}return db[_0xd72c('0x2b')][_0xd72c('0x41')](_0x483b98);})[_0xd72c('0x23')](function(_0x238094){_0x3c0366[_0xd72c('0x42')]=_0x238094;return _0x3c0366;})['then'](respondWithFilteredResult(_0x225985,_0x483b98))[_0xd72c('0x43')](handleError(_0x225985,null));};exports['show']=function(_0x5cef58,_0x1040dc){var _0xf3bd0a={'raw':!![],'where':{'id':_0x5cef58[_0xd72c('0x44')]['id']}},_0x5f0864={};_0x5f0864[_0xd72c('0x30')]=_[_0xd72c('0x45')](db[_0xd72c('0x2b')][_0xd72c('0x2c')]);_0x5f0864[_0xd72c('0x31')]=_[_0xd72c('0x45')](_0x5cef58[_0xd72c('0x31')]);_0x5f0864['filters']=_[_0xd72c('0x33')](_0x5f0864['model'],_0x5f0864[_0xd72c('0x31')]);_0xf3bd0a[_0xd72c('0x34')]=_[_0xd72c('0x33')](_0x5f0864[_0xd72c('0x30')],qs['fields'](_0x5cef58[_0xd72c('0x31')][_0xd72c('0x35')]));_0xf3bd0a[_0xd72c('0x34')]=_0xf3bd0a['attributes']['length']?_0xf3bd0a[_0xd72c('0x34')]:_0x5f0864[_0xd72c('0x30')];if(_0x5cef58['query'][_0xd72c('0x40')]){_0xf3bd0a[_0xd72c('0x46')]=[{'all':!![]}];}_0xf3bd0a=_[_0xd72c('0x3d')]({},_0xf3bd0a,_0x5cef58[_0xd72c('0x3f')]);return db['ChatTransferReport']['find'](_0xf3bd0a)[_0xd72c('0x23')](handleEntityNotFound(_0x1040dc,null))[_0xd72c('0x23')](respondWithResult(_0x1040dc,null))[_0xd72c('0x43')](handleError(_0x1040dc,null));};exports[_0xd72c('0x47')]=function(_0x3ccc83,_0x954684){return db[_0xd72c('0x2b')]['create'](_0x3ccc83[_0xd72c('0x48')],{})[_0xd72c('0x23')](respondWithResult(_0x954684,0xc9))['catch'](handleError(_0x954684,null));};exports[_0xd72c('0x22')]=function(_0x3771e6,_0x58f7a4){if(_0x3771e6['body']['id']){delete _0x3771e6[_0xd72c('0x48')]['id'];}return db[_0xd72c('0x2b')][_0xd72c('0x49')]({'where':{'id':_0x3771e6[_0xd72c('0x44')]['id']}})[_0xd72c('0x23')](handleEntityNotFound(_0x58f7a4,null))['then'](saveUpdates(_0x3771e6['body'],null))[_0xd72c('0x23')](respondWithResult(_0x58f7a4,null))[_0xd72c('0x43')](handleError(_0x58f7a4,null));};exports['destroy']=function(_0xa5cdda,_0x557466){return db[_0xd72c('0x2b')][_0xd72c('0x49')]({'where':{'id':_0xa5cdda[_0xd72c('0x44')]['id']}})['then'](handleEntityNotFound(_0x557466,null))[_0xd72c('0x23')](removeEntity(_0x557466,null))[_0xd72c('0x43')](handleError(_0x557466,null));};exports[_0xd72c('0x4a')]=function(_0x16b9b5,_0xc2888b){return db[_0xd72c('0x2b')][_0xd72c('0x4a')]()[_0xd72c('0x23')](respondWithResult(_0xc2888b,null))[_0xd72c('0x43')](handleError(_0xc2888b,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 6b9d09b..f2f0d75 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 _0xdfc6=['rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','util','api','moment','request-promise'];(function(_0x274790,_0xb48213){var _0x41c59c=function(_0x6e5846){while(--_0x6e5846){_0x274790['push'](_0x274790['shift']());}};_0x41c59c(++_0xb48213);}(_0xdfc6,0x125));var _0x6dfc=function(_0x3161d5,_0x1cbaef){_0x3161d5=_0x3161d5-0x0;var _0x24e7f2=_0xdfc6[_0x3161d5];return _0x24e7f2;};'use strict';var _=require('lodash');var util=require(_0x6dfc('0x0'));var logger=require('../../config/logger')(_0x6dfc('0x1'));var moment=require(_0x6dfc('0x2'));var BPromise=require('bluebird');var rp=require(_0x6dfc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6dfc('0x4'));var config=require(_0x6dfc('0x5'));var attributes=require(_0x6dfc('0x6'));module[_0x6dfc('0x7')]=function(_0x378ae9,_0x3d7963){return _0x378ae9[_0x6dfc('0x8')]('ChatTransferReport',attributes,{'tableName':_0x6dfc('0x9'),'paranoid':![],'indexes':[{'name':_0x6dfc('0xa'),'fields':[_0x6dfc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x53c9=['rimraf','../../config/environment','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x53c9,0x187));var _0x953c=function(_0x35e15a,_0x321e66){_0x35e15a=_0x35e15a-0x0;var _0x15b571=_0x53c9[_0x35e15a];return _0x15b571;};'use strict';var _=require(_0x953c('0x0'));var util=require(_0x953c('0x1'));var logger=require(_0x953c('0x2'))('api');var moment=require(_0x953c('0x3'));var BPromise=require(_0x953c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x953c('0x5'));var config=require(_0x953c('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x953c('0x7')]=function(_0x982eff,_0x25df57){return _0x982eff['define'](_0x953c('0x8'),attributes,{'tableName':_0x953c('0x9'),'paranoid':![],'indexes':[{'name':_0x953c('0xa'),'fields':[_0x953c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 857c3c9..4b2e735 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 _0x2b87=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x533911,_0x3f9428){var _0x45f53a=function(_0x45b0be){while(--_0x45b0be){_0x533911['push'](_0x533911['shift']());}};_0x45f53a(++_0x3f9428);}(_0x2b87,0x125));var _0x72b8=function(_0x495c1a,_0x31f8d4){_0x495c1a=_0x495c1a-0x0;var _0x5cba59=_0x2b87[_0x495c1a];return _0x5cba59;};'use strict';var _=require(_0x72b8('0x0'));var util=require(_0x72b8('0x1'));var moment=require(_0x72b8('0x2'));var BPromise=require('bluebird');var rs=require(_0x72b8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72b8('0x4'))['db'];var utils=require(_0x72b8('0x5'));var logger=require(_0x72b8('0x6'))(_0x72b8('0x7'));var config=require(_0x72b8('0x8'));var jayson=require(_0x72b8('0x9'));var client=jayson[_0x72b8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2fbd34,_0x486e51,_0x17d267){return new BPromise(function(_0x2b718f,_0x4ae752){return client[_0x72b8('0xb')](_0x2fbd34,_0x17d267)['then'](function(_0x10fb93){logger[_0x72b8('0xc')](_0x72b8('0xd'),_0x486e51,_0x72b8('0xe'));logger[_0x72b8('0xf')](_0x72b8('0x10'),_0x486e51,_0x72b8('0xe'),JSON['stringify'](_0x10fb93));if(_0x10fb93['error']){if(_0x10fb93[_0x72b8('0x11')][_0x72b8('0x12')]===0x1f4){logger[_0x72b8('0x11')](_0x72b8('0xd'),_0x486e51,_0x10fb93[_0x72b8('0x11')]['message']);return _0x4ae752(_0x10fb93[_0x72b8('0x11')][_0x72b8('0x13')]);}logger[_0x72b8('0x11')](_0x72b8('0xd'),_0x486e51,_0x10fb93[_0x72b8('0x11')][_0x72b8('0x13')]);return _0x2b718f(_0x10fb93[_0x72b8('0x11')][_0x72b8('0x13')]);}else{logger[_0x72b8('0xc')](_0x72b8('0xd'),_0x486e51,_0x72b8('0xe'));_0x2b718f(_0x10fb93[_0x72b8('0x14')]['message']);}})[_0x72b8('0x15')](function(_0x57ff0f){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x486e51,_0x57ff0f);_0x4ae752(_0x57ff0f);});});} \ No newline at end of file +var _0x08d4=['util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash'];(function(_0x421e36,_0x18776e){var _0x20b3e3=function(_0x767de4){while(--_0x767de4){_0x421e36['push'](_0x421e36['shift']());}};_0x20b3e3(++_0x18776e);}(_0x08d4,0xd1));var _0x408d=function(_0x500abc,_0x6371d2){_0x500abc=_0x500abc-0x0;var _0x1453bc=_0x08d4[_0x500abc];return _0x1453bc;};'use strict';var _=require(_0x408d('0x0'));var util=require(_0x408d('0x1'));var moment=require(_0x408d('0x2'));var BPromise=require(_0x408d('0x3'));var rs=require(_0x408d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x408d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x408d('0x6'));var config=require(_0x408d('0x7'));var jayson=require(_0x408d('0x8'));var client=jayson['client'][_0x408d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x186bf7,_0x1e43c7,_0x15b515){return new BPromise(function(_0x9b09ae,_0x282a17){return client[_0x408d('0xa')](_0x186bf7,_0x15b515)[_0x408d('0xb')](function(_0xf77baa){logger['info'](_0x408d('0xc'),_0x1e43c7,_0x408d('0xd'));logger['debug'](_0x408d('0xe'),_0x1e43c7,_0x408d('0xd'),JSON[_0x408d('0xf')](_0xf77baa));if(_0xf77baa[_0x408d('0x10')]){if(_0xf77baa['error']['code']===0x1f4){logger[_0x408d('0x10')](_0x408d('0xc'),_0x1e43c7,_0xf77baa[_0x408d('0x10')]['message']);return _0x282a17(_0xf77baa[_0x408d('0x10')]['message']);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x1e43c7,_0xf77baa[_0x408d('0x10')][_0x408d('0x11')]);return _0x9b09ae(_0xf77baa['error'][_0x408d('0x11')]);}else{logger[_0x408d('0x12')](_0x408d('0xc'),_0x1e43c7,'request\x20sent');_0x9b09ae(_0xf77baa[_0x408d('0x13')][_0x408d('0x11')]);}})[_0x408d('0x14')](function(_0x3b21ec){logger[_0x408d('0x10')](_0x408d('0xc'),_0x1e43c7,_0x3b21ec);_0x282a17(_0x3b21ec);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 697dd1c..55bcd90 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 _0x4734=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x4661e0,_0x5c06ad){var _0x5d702e=function(_0xfa6091){while(--_0xfa6091){_0x4661e0['push'](_0x4661e0['shift']());}};_0x5d702e(++_0x5c06ad);}(_0x4734,0x165));var _0x4473=function(_0x415929,_0xa4e054){_0x415929=_0x415929-0x0;var _0x390e6d=_0x4734[_0x415929];return _0x390e6d;};'use strict';var multer=require(_0x4473('0x0'));var util=require(_0x4473('0x1'));var path=require('path');var timeout=require(_0x4473('0x2'));var express=require(_0x4473('0x3'));var router=express['Router']();var fs_extra=require(_0x4473('0x4'));var auth=require(_0x4473('0x5'));var interaction=require(_0x4473('0x6'));var config=require(_0x4473('0x7'));var controller=require(_0x4473('0x8'));router[_0x4473('0x9')]('/',auth[_0x4473('0xa')](),controller['index']);router[_0x4473('0x9')](_0x4473('0xb'),auth[_0x4473('0xa')](),controller[_0x4473('0xc')]);router['get'](_0x4473('0xd'),auth[_0x4473('0xa')](),controller[_0x4473('0xe')]);router['post']('/',auth[_0x4473('0xa')](),controller[_0x4473('0xf')]);router[_0x4473('0x10')](_0x4473('0xd'),auth[_0x4473('0xa')](),controller[_0x4473('0x11')]);router[_0x4473('0x12')](_0x4473('0xd'),auth[_0x4473('0xa')](),controller[_0x4473('0x13')]);module['exports']=router; \ No newline at end of file +var _0xfde9=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','post','put','update','delete','destroy'];(function(_0x15a05c,_0x34a0fe){var _0x3bfafa=function(_0x23797c){while(--_0x23797c){_0x15a05c['push'](_0x15a05c['shift']());}};_0x3bfafa(++_0x34a0fe);}(_0xfde9,0x141));var _0x9fde=function(_0x3616bb,_0x86fe00){_0x3616bb=_0x3616bb-0x0;var _0x1c0994=_0xfde9[_0x3616bb];return _0x1c0994;};'use strict';var multer=require(_0x9fde('0x0'));var util=require('util');var path=require(_0x9fde('0x1'));var timeout=require(_0x9fde('0x2'));var express=require(_0x9fde('0x3'));var router=express[_0x9fde('0x4')]();var fs_extra=require(_0x9fde('0x5'));var auth=require(_0x9fde('0x6'));var interaction=require(_0x9fde('0x7'));var config=require(_0x9fde('0x8'));var controller=require('./chatTransferReport.controller');router[_0x9fde('0x9')]('/',auth[_0x9fde('0xa')](),controller['index']);router[_0x9fde('0x9')](_0x9fde('0xb'),auth[_0x9fde('0xa')](),controller[_0x9fde('0xc')]);router[_0x9fde('0x9')](_0x9fde('0xd'),auth[_0x9fde('0xa')](),controller['show']);router[_0x9fde('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9fde('0xf')](_0x9fde('0xd'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x10')]);router[_0x9fde('0x11')](_0x9fde('0xd'),auth[_0x9fde('0xa')](),controller[_0x9fde('0x12')]);module[_0x9fde('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 ae84f13..e6b3df4 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 _0x8790=['Note','Type\x20a\x20message','Feedback','star','thumb','TEXT','stringify','name','email','onlineForm','parse','setDataValue','Comments','getDataValue','offlineForm','generate','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','Agent','#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\x20submission\x20error'];(function(_0x58aeb5,_0x397c64){var _0x3c5f58=function(_0xe871fe){while(--_0xe871fe){_0x58aeb5['push'](_0x58aeb5['shift']());}};_0x3c5f58(++_0x397c64);}(_0x8790,0xb4));var _0x0879=function(_0x153136,_0x2be1b6){_0x153136=_0x153136-0x0;var _0x35abfd=_0x8790[_0x153136];return _0x35abfd;};'use strict';var Sequelize=require(_0x0879('0x0'));var rs=require(_0x0879('0x1'));module[_0x0879('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x0879('0x3')],'allowNull':![],'unique':_0x0879('0x4')},'description':{'type':Sequelize[_0x0879('0x3')]},'mapKey':{'type':Sequelize[_0x0879('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x0879('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0x0879('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x0879('0x3')],'defaultValue':_0x0879('0x5')},'customerAlias':{'type':Sequelize[_0x0879('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0879('0x3')],'allowNull':![],'defaultValue':_0x0879('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0879('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0879('0x3')],'allowNull':![],'defaultValue':_0x0879('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0879('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x0879('0x3')]},'animation':{'type':Sequelize[_0x0879('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0879('0xa')](_0x0879('0xb'),_0x0879('0xc')),'defaultValue':_0x0879('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x0879('0xd')},'start_chat_button':{'type':Sequelize[_0x0879('0x3')],'defaultValue':_0x0879('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x0879('0xf')},'header_offline':{'type':Sequelize[_0x0879('0x3')],'defaultValue':_0x0879('0x10')},'download_transcript':{'type':Sequelize[_0x0879('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0879('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x0879('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x0879('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x0879('0x3')],'defaultValue':_0x0879('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x0879('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x0879('0x3')],'defaultValue':_0x0879('0x13')},'noteTitle':{'type':Sequelize[_0x0879('0x3')],'defaultValue':_0x0879('0x14')},'placeholderMessage':{'type':Sequelize[_0x0879('0x3')],'defaultValue':_0x0879('0x15')},'closingMessage':{'type':Sequelize[_0x0879('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x0879('0x3')],'defaultValue':_0x0879('0xf')},'skipMessageButton':{'type':Sequelize[_0x0879('0x3')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0879('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0879('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x0879('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0879('0x3')],'defaultValue':_0x0879('0x16')},'ratingType':{'type':Sequelize[_0x0879('0xa')](_0x0879('0x17'),_0x0879('0x18')),'defaultValue':_0x0879('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x0879('0x19')],'defaultValue':function(){return JSON[_0x0879('0x1a')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x0879('0x1b'),'type':'text','required':!![]},'props':{'title':'name','helpText':''}},{'type':'input','props':{'title':_0x0879('0x1c'),'helpText':''},'config':{'required':!![],'placeholder':_0x0879('0x1c'),'type':_0x0879('0x1c')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x0879('0x1d'))?JSON[_0x0879('0x1e')](this['getDataValue'](_0x0879('0x1d'))):{};},'set':function(_0x3ab533){return this[_0x0879('0x1f')]('onlineForm',JSON[_0x0879('0x1a')](_0x3ab533));}},'offlineForm':{'type':Sequelize[_0x0879('0x19')],'defaultValue':function(){return JSON[_0x0879('0x1a')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x0879('0x1c'),'type':_0x0879('0x1c')},'variable':null},{'type':'textarea','config':{'placeholder':_0x0879('0x20')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x0879('0x21')](_0x0879('0x22'))?JSON[_0x0879('0x1e')](this['getDataValue'](_0x0879('0x22'))):{};},'set':function(_0x4eea97){return this['setDataValue'](_0x0879('0x22'),JSON['stringify'](_0x4eea97));}},'token':{'type':Sequelize[_0x0879('0x3')],'defaultValue':function(){return rs[_0x0879('0x23')]();}},'autoclose':{'type':Sequelize[_0x0879('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0879('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0879('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x0879('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x0879('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x0879('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x0879('0x3')],'defaultValue':_0x0879('0x24')},'offlineMessageBody':{'type':Sequelize[_0x0879('0x3')],'defaultValue':_0x0879('0x25')},'enableUnmanagedNote':{'type':Sequelize[_0x0879('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0879('0x26')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x0879('0x3')],'defaultValue':_0x0879('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x0879('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0879('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0879('0x19')]},'showAgentAvatar':{'type':Sequelize[_0x0879('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0879('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0879('0x19')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x0879('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0879('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0879('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0879('0x3')],'defaultValue':_0x0879('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0879('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0879('0x3')],'defaultValue':_0x0879('0x28')},'verticalAlignment':{'type':Sequelize[_0x0879('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x0879('0x29')},'defaultTitle':{'type':Sequelize[_0x0879('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x0879('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0879('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0879('0x3')],'allowNull':![],'defaultValue':_0x0879('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0879('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0879('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0879('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0879('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x0879('0x2b')},'systemAvatar':{'type':Sequelize[_0x0879('0x19')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0879('0x8')],'comment':_0x0879('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0879('0x2d'),'set':function(_0x280c31){if(!_0x280c31)this['setDataValue'](_0x0879('0x2e'),null);this[_0x0879('0x1f')](_0x0879('0x2f'),_0x280c31);}},'vidaooEscalation':{'type':Sequelize[_0x0879('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x0879('0x3')],'allowNull':![],'defaultValue':_0x0879('0x30')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x0879('0x31');}},'vidaooMetadata':{'type':Sequelize[_0x0879('0x19')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x0879('0x19')]}}; \ No newline at end of file +var _0xd6cd=['#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','exports','STRING','address','email','Agent','#011F6A','#ffffff','ENUM','rounded','We\x20are\x20here!','Send','BOOLEAN','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Skip','Feedback','star','stringify','name','input','onlineForm','getDataValue','setDataValue','Comments','parse','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate'];(function(_0x429b65,_0x2bbce2){var _0x40519c=function(_0x1ad193){while(--_0x1ad193){_0x429b65['push'](_0x429b65['shift']());}};_0x40519c(++_0x2bbce2);}(_0xd6cd,0x14e));var _0xdd6c=function(_0x1f1cd5,_0x3a9e80){_0x1f1cd5=_0x1f1cd5-0x0;var _0xa3c994=_0xd6cd[_0x1f1cd5];return _0xa3c994;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xdd6c('0x0')]={'name':{'type':Sequelize[_0xdd6c('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xdd6c('0x1')],'allowNull':![],'unique':_0xdd6c('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xdd6c('0x3')},'key':{'type':Sequelize[_0xdd6c('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xdd6c('0x4')},'customerAlias':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdd6c('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xdd6c('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdd6c('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xdd6c('0x1')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xdd6c('0x7')](_0xdd6c('0x8'),'squared'),'defaultValue':_0xdd6c('0x8')},'header_online':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':_0xdd6c('0x9')},'start_chat_button':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':_0xdd6c('0xa')},'header_offline':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xdd6c('0xc')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':_0xdd6c('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xdd6c('0xe')]},'closingQuestion':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':_0xdd6c('0xf')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':_0xdd6c('0xa')},'skipMessageButton':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':_0xdd6c('0x10')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':_0xdd6c('0x11')},'ratingType':{'type':Sequelize['ENUM'](_0xdd6c('0x12'),'thumb'),'defaultValue':_0xdd6c('0x12')},'ratingStarsNumber':{'type':Sequelize[_0xdd6c('0xc')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xdd6c('0xe')],'defaultValue':function(){return JSON[_0xdd6c('0x13')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xdd6c('0x14'),'type':'text','required':!![]},'props':{'title':_0xdd6c('0x14'),'helpText':''}},{'type':_0xdd6c('0x15'),'props':{'title':_0xdd6c('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xdd6c('0x3'),'type':_0xdd6c('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xdd6c('0x16'))?JSON['parse'](this[_0xdd6c('0x17')]('onlineForm')):{};},'set':function(_0x390def){return this[_0xdd6c('0x18')]('onlineForm',JSON[_0xdd6c('0x13')](_0x390def));}},'offlineForm':{'type':Sequelize[_0xdd6c('0xe')],'defaultValue':function(){return JSON[_0xdd6c('0x13')]({'items':[{'type':'input','props':{'title':_0xdd6c('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xdd6c('0x3'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0xdd6c('0x19')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xdd6c('0x17')]('offlineForm')?JSON[_0xdd6c('0x1a')](this[_0xdd6c('0x17')]('offlineForm')):{};},'set':function(_0x30a142){return this['setDataValue'](_0xdd6c('0x1b'),JSON[_0xdd6c('0x13')](_0x30a142));}},'token':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xdd6c('0x1')]},'waitingTitle':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':_0xdd6c('0x1c')},'waitingMessage':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':_0xdd6c('0x1d')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xdd6c('0x1e')},'offlineMessageBody':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xdd6c('0x1f')},'skipUnmanaged':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':_0xdd6c('0xa')},'enableCustomerAttachment':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xdd6c('0xe')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xdd6c('0x1')]},'notificationTemplate':{'type':Sequelize[_0xdd6c('0xe')],'defaultValue':function(){return _0xdd6c('0x20');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xdd6c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xdd6c('0x21')},'verticalAlignment':{'type':Sequelize[_0xdd6c('0xc')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':_0xdd6c('0x22')},'defaultTitle':{'type':Sequelize[_0xdd6c('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xdd6c('0xc')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdd6c('0x23'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdd6c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdd6c('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xdd6c('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdd6c('0xc')],'comment':_0xdd6c('0x24')},'mandatoryDisposition':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':![],'comment':_0xdd6c('0x25'),'set':function(_0x131323){if(!_0x131323)this[_0xdd6c('0x18')](_0xdd6c('0x26'),null);this[_0xdd6c('0x18')](_0xdd6c('0x27'),_0x131323);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xdd6c('0x1')]},'vidaooTopic':{'type':Sequelize[_0xdd6c('0x1')],'allowNull':![],'defaultValue':_0xdd6c('0x28')},'vidaooNote':{'type':Sequelize[_0xdd6c('0x1')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xdd6c('0xe')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xdd6c('0xb')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xdd6c('0xe')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 77db533..6f2387e 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 _0x33c1=['path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','destroy','ChatWebsites','status','stack','name','send','index','map','ChatWebsite','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','mandatoryDispositionPause','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','params','Pause','describe','addDisposition','Disposition','getDispositions','findOne','filter','findAll','removeDispositions','ids','addAnswer','ChatWebsiteId','CannedAnswer','pick','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','isNil','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','chat','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','DESC','ChatApplication','account','Applications','list','orderBy','applications','priority','contact','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','files','ListId','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','defaults','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','mimetype','server','attachments','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','email','offlineMessageSubject','MailAccountId','originalname','subjectOffline','toPairsIn','mapValues','Chat','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Owner','fullname','internal','Tag','Tags','tag','rows','getSnippet','iftime\x20%s,%s','interval','timezone','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','Interval','Intervals','getLicense','virtual','custom','License','increment','readFileSync','remote','x-real-ip','remoteAddress','replace','render','alignment','verticalAlignment','textColor','backgroundColor','addApplications','transaction','getApplications','addProactiveActions','ChatProactiveAction','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','util'];(function(_0x7488c6,_0x1b2889){var _0x50fafa=function(_0x5dbf64){while(--_0x5dbf64){_0x7488c6['push'](_0x7488c6['shift']());}};_0x50fafa(++_0x1b2889);}(_0x33c1,0x128));var _0x133c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x33c1[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x133c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x133c('0x1'));var jsonpatch=require(_0x133c('0x2'));var rp=require(_0x133c('0x3'));var moment=require(_0x133c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x133c('0x5'));var path=require(_0x133c('0x6'));var sox=require(_0x133c('0x7'));var csv=require('to-csv');var ejs=require(_0x133c('0x8'));var fs=require('fs');var fs_extra=require(_0x133c('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x133c('0xa'));var jsforce=require(_0x133c('0xb'));var deskjs=require(_0x133c('0xc'));var toCsv=require(_0x133c('0xd'));var querystring=require(_0x133c('0xe'));var Papa=require(_0x133c('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x133c('0x10'));var as=require(_0x133c('0x11'));var hardwareService=require(_0x133c('0x12'));var logger=require(_0x133c('0x13'))(_0x133c('0x14'));var utils=require('../../config/utils');var config=require(_0x133c('0x15'));var licenseUtil=require(_0x133c('0x16'));var db=require('../../mysqldb')['db'];config[_0x133c('0x17')]=_['defaults'](config[_0x133c('0x17')],{'host':_0x133c('0x18'),'port':0x18eb});var socket=require(_0x133c('0x19'))(new Redis(config[_0x133c('0x17')]));require(_0x133c('0x1a'))['register'](socket);var jayson=require(_0x133c('0x1b'));var client=jayson[_0x133c('0x1c')][_0x133c('0x1d')]({'port':0x232c});var client9002=jayson[_0x133c('0x1c')][_0x133c('0x1d')]({'port':0x232a});var client9003=jayson[_0x133c('0x1c')][_0x133c('0x1d')]({'port':0x232b});var client9001=jayson[_0x133c('0x1c')][_0x133c('0x1d')]({'port':0x2329});function respondWithRpcPromise(_0xf6222d,_0xa418a1,_0x1ebc78,_0x38cd9a){return new BPromise(function(_0x593085,_0x2c6db3){var _0x4289e7=_0x38cd9a||client;return _0x4289e7[_0x133c('0x1e')](_0xf6222d,_0x1ebc78)[_0x133c('0x1f')](function(_0x149a18){logger[_0x133c('0x20')](_0x133c('0x21'),_0xa418a1,_0x133c('0x22'));logger[_0x133c('0x23')](_0x133c('0x24'),_0xa418a1,_0x133c('0x22'),JSON['stringify'](_0x149a18));if(_0x149a18['error']){if(_0x149a18[_0x133c('0x25')]['code']===0x1f4){logger[_0x133c('0x25')](_0x133c('0x21'),_0xa418a1,_0x149a18[_0x133c('0x25')][_0x133c('0x26')]);return _0x2c6db3(_0x149a18[_0x133c('0x25')][_0x133c('0x26')]);}logger[_0x133c('0x25')](_0x133c('0x21'),_0xa418a1,_0x149a18[_0x133c('0x25')]['message']);return _0x593085(_0x149a18['error']['message']);}else{logger[_0x133c('0x20')](_0x133c('0x21'),_0xa418a1,_0x133c('0x22'));_0x593085(_0x149a18[_0x133c('0x27')]['message']);}})[_0x133c('0x28')](function(_0x446769){logger['error'](_0x133c('0x21'),_0xa418a1,_0x446769);_0x2c6db3(_0x446769);});});}function respondWithStatusCode(_0x43491a,_0xbf400b){_0xbf400b=_0xbf400b||0xcc;return function(_0x28d6f1){if(_0x28d6f1){return _0x43491a[_0x133c('0x29')](_0xbf400b);}return _0x43491a['status'](_0xbf400b)[_0x133c('0x2a')]();};}function respondWithResult(_0x994587,_0x538bf1){_0x538bf1=_0x538bf1||0xc8;return function(_0x3c9677){if(_0x3c9677){return _0x994587['status'](_0x538bf1)[_0x133c('0x2b')](_0x3c9677);}};}function respondWithFilteredResult(_0x789d42,_0x4c37e9){return function(_0x527a24){if(_0x527a24){var _0x2258f6=typeof _0x4c37e9[_0x133c('0x2c')]===_0x133c('0x2d')&&typeof _0x4c37e9['limit']==='undefined';var _0x548291=_0x527a24['count'];var _0x16415b=_0x2258f6?0x0:_0x4c37e9['offset'];var _0x36b7cb=_0x2258f6?_0x527a24[_0x133c('0x2e')]:_0x4c37e9[_0x133c('0x2c')]+_0x4c37e9[_0x133c('0x2f')];var _0x539551;if(_0x36b7cb>=_0x548291){_0x36b7cb=_0x548291;_0x539551=0xc8;}else{_0x539551=0xce;}_0x789d42['status'](_0x539551);return _0x789d42[_0x133c('0x30')](_0x133c('0x31'),_0x16415b+'-'+_0x36b7cb+'/'+_0x548291)[_0x133c('0x2b')](_0x527a24);}return null;};}function patchUpdates(_0x2ead99){return function(_0x4c68aa){try{jsonpatch[_0x133c('0x32')](_0x4c68aa,_0x2ead99,!![]);}catch(_0x51d470){return BPromise[_0x133c('0x33')](_0x51d470);}return _0x4c68aa['save']();};}function saveUpdates(_0x25dc11,_0x232871){return function(_0x553fab){if(_0x553fab){return _0x553fab['update'](_0x25dc11)['then'](function(_0x3687b7){return _0x3687b7;});}return null;};}function removeEntity(_0xc0264d,_0x4bd0d9){return function(_0x2f82d3){if(_0x2f82d3){return _0x2f82d3[_0x133c('0x34')]()[_0x133c('0x1f')](function(){var _0xfbbfc5=_0x2f82d3['get']({'plain':!![]});var _0x81db72=_0x133c('0x35');return db['UserProfileResource']['destroy']({'where':{'type':_0x81db72,'resourceId':_0xfbbfc5['id']}})[_0x133c('0x1f')](function(){return _0x2f82d3;});})[_0x133c('0x1f')](function(){_0xc0264d[_0x133c('0x36')](0xcc)['end']();});}};}function handleEntityNotFound(_0x234521,_0x273612){return function(_0x249ee7){if(!_0x249ee7){_0x234521['sendStatus'](0x194);}return _0x249ee7;};}function handleError(_0x2410a1,_0x2cb46e){_0x2cb46e=_0x2cb46e||0x1f4;return function(_0x1320c0){logger[_0x133c('0x25')](_0x1320c0[_0x133c('0x37')]);if(_0x1320c0[_0x133c('0x38')]){delete _0x1320c0[_0x133c('0x38')];}_0x2410a1[_0x133c('0x36')](_0x2cb46e)[_0x133c('0x39')](_0x1320c0);};}exports[_0x133c('0x3a')]=function(_0x32365d,_0x4d7f9f){var _0x14e8ef={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xf793e8={},_0x40b904={'count':0x0,'rows':[]};var _0x212cce=_[_0x133c('0x3b')](db[_0x133c('0x3c')][_0x133c('0x3d')],function(_0xc1ed11){return{'name':_0xc1ed11['fieldName'],'type':_0xc1ed11[_0x133c('0x3e')][_0x133c('0x3f')]};});_0xf793e8[_0x133c('0x40')]=_[_0x133c('0x3b')](_0x212cce,_0x133c('0x38'));_0xf793e8[_0x133c('0x41')]=_[_0x133c('0x42')](_0x32365d[_0x133c('0x41')]);_0xf793e8[_0x133c('0x43')]=_['intersection'](_0xf793e8['model'],_0xf793e8['query']);_0x14e8ef[_0x133c('0x44')]=_[_0x133c('0x45')](_0xf793e8[_0x133c('0x40')],qs[_0x133c('0x46')](_0x32365d['query'][_0x133c('0x46')]));_0x14e8ef[_0x133c('0x44')]=_0x14e8ef[_0x133c('0x44')][_0x133c('0x47')]?_0x14e8ef[_0x133c('0x44')]:_0xf793e8[_0x133c('0x40')];if(!_0x32365d['query'][_0x133c('0x48')](_0x133c('0x49'))){_0x14e8ef[_0x133c('0x2f')]=qs[_0x133c('0x2f')](_0x32365d[_0x133c('0x41')][_0x133c('0x2f')]);_0x14e8ef[_0x133c('0x2c')]=qs[_0x133c('0x2c')](_0x32365d[_0x133c('0x41')][_0x133c('0x2c')]);}_0x14e8ef[_0x133c('0x4a')]=qs['sort'](_0x32365d['query'][_0x133c('0x4b')]);_0x14e8ef['where']=qs[_0x133c('0x43')](_['pick'](_0x32365d['query'],_0xf793e8[_0x133c('0x43')]),_0x212cce);if(_0x32365d[_0x133c('0x41')]['filter']){_0x14e8ef[_0x133c('0x4c')]=_[_0x133c('0x4d')](_0x14e8ef['where'],{'$or':_[_0x133c('0x3b')](_0x212cce,function(_0x4ba396){if(_0x4ba396[_0x133c('0x3e')]!==_0x133c('0x4e')){var _0x1ea43d={};_0x1ea43d[_0x4ba396[_0x133c('0x38')]]={'$like':'%'+_0x32365d[_0x133c('0x41')]['filter']+'%'};return _0x1ea43d;}})});}_0x14e8ef=_['merge']({},_0x14e8ef,_0x32365d[_0x133c('0x4f')]);var _0x423e74={'where':_0x14e8ef[_0x133c('0x4c')]};return db[_0x133c('0x3c')][_0x133c('0x2e')](_0x423e74)['then'](function(_0x3638ec){_0x40b904[_0x133c('0x2e')]=_0x3638ec;if(_0x32365d[_0x133c('0x41')][_0x133c('0x50')]){_0x14e8ef[_0x133c('0x51')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x14e8ef);})[_0x133c('0x1f')](function(_0x125b54){_0x40b904['rows']=_0x125b54;return _0x40b904;})[_0x133c('0x1f')](respondWithFilteredResult(_0x4d7f9f,_0x14e8ef))['catch'](handleError(_0x4d7f9f,null));};exports['show']=function(_0x5bc290,_0x253a1f){var _0x18cfb4={'raw':![],'where':{'id':_0x5bc290['params']['id']},'include':[{'model':db['Pause'],'as':_0x133c('0x52')}]},_0x3e080a={};_0x3e080a['model']=_[_0x133c('0x42')](db[_0x133c('0x3c')]['rawAttributes']);_0x3e080a[_0x133c('0x41')]=_[_0x133c('0x42')](_0x5bc290[_0x133c('0x41')]);_0x3e080a[_0x133c('0x43')]=_[_0x133c('0x45')](_0x3e080a[_0x133c('0x40')],_0x3e080a['query']);_0x18cfb4['attributes']=_[_0x133c('0x45')](_0x3e080a['model'],qs[_0x133c('0x46')](_0x5bc290[_0x133c('0x41')][_0x133c('0x46')]));_0x18cfb4['attributes']=_0x18cfb4['attributes'][_0x133c('0x47')]?_0x18cfb4['attributes']:_0x3e080a[_0x133c('0x40')];if(_0x5bc290[_0x133c('0x41')]['includeAll']){_0x18cfb4[_0x133c('0x51')]=[{'all':!![]}];}_0x18cfb4=_[_0x133c('0x4d')]({},_0x18cfb4,_0x5bc290[_0x133c('0x4f')]);return db['ChatWebsite']['find'](_0x18cfb4)['then'](handleEntityNotFound(_0x253a1f,null))[_0x133c('0x1f')](respondWithResult(_0x253a1f,null))[_0x133c('0x28')](handleError(_0x253a1f,null));};exports[_0x133c('0x53')]=function(_0x189c95,_0x4c31d0){return db[_0x133c('0x3c')][_0x133c('0x53')](_0x189c95[_0x133c('0x54')],{})[_0x133c('0x1f')](function(_0x50ae64){var _0xde522b=_0x189c95[_0x133c('0x55')][_0x133c('0x56')]({'plain':!![]});if(!_0xde522b)throw new Error(_0x133c('0x57'));if(_0xde522b[_0x133c('0x58')]===_0x133c('0x55')){var _0x10fdff=_0x50ae64['get']({'plain':!![]});var _0x5d93c1=_0x133c('0x35');return db[_0x133c('0x59')][_0x133c('0x5a')]({'where':{'name':_0x5d93c1,'userProfileId':_0xde522b[_0x133c('0x5b')]},'raw':!![]})[_0x133c('0x1f')](function(_0x507dd5){if(_0x507dd5&&_0x507dd5[_0x133c('0x5c')]===0x0){return db['UserProfileResource'][_0x133c('0x53')]({'name':_0x10fdff[_0x133c('0x38')],'resourceId':_0x10fdff['id'],'type':_0x507dd5[_0x133c('0x38')],'sectionId':_0x507dd5['id']},{})[_0x133c('0x1f')](function(){return _0x50ae64;});}else{return _0x50ae64;}})[_0x133c('0x28')](function(_0x198cd4){logger[_0x133c('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x198cd4);throw _0x198cd4;});}return _0x50ae64;})['then'](respondWithResult(_0x4c31d0,0xc9))[_0x133c('0x28')](handleError(_0x4c31d0,null));};exports['update']=function(_0x5c2720,_0xa3a12c){if(_0x5c2720[_0x133c('0x54')]['id']){delete _0x5c2720['body']['id'];}return db['ChatWebsite'][_0x133c('0x5a')]({'where':{'id':_0x5c2720[_0x133c('0x5d')]['id']},'include':[{'model':db[_0x133c('0x5e')],'as':_0x133c('0x52')}]})[_0x133c('0x1f')](handleEntityNotFound(_0xa3a12c,null))[_0x133c('0x1f')](saveUpdates(_0x5c2720[_0x133c('0x54')],null))[_0x133c('0x1f')](respondWithResult(_0xa3a12c,null))[_0x133c('0x28')](handleError(_0xa3a12c,null));};exports[_0x133c('0x34')]=function(_0x3c0dc7,_0x2b2a43){return db[_0x133c('0x3c')][_0x133c('0x5a')]({'where':{'id':_0x3c0dc7['params']['id']}})['then'](handleEntityNotFound(_0x2b2a43,null))['then'](removeEntity(_0x2b2a43,null))['catch'](handleError(_0x2b2a43,null));};exports[_0x133c('0x5f')]=function(_0x4e62b1,_0x44007e){return db[_0x133c('0x3c')][_0x133c('0x5f')]()[_0x133c('0x1f')](respondWithResult(_0x44007e,null))[_0x133c('0x28')](handleError(_0x44007e,null));};exports[_0x133c('0x60')]=function(_0x2a5211,_0x9347db,_0x4c35c8){if(_0x2a5211['body']['id']){delete _0x2a5211[_0x133c('0x54')]['id'];}return db['ChatWebsite'][_0x133c('0x5a')]({'where':{'id':_0x2a5211[_0x133c('0x5d')]['id']}})[_0x133c('0x1f')](handleEntityNotFound(_0x9347db,null))['then'](function(_0x11b95b){if(_0x11b95b){_0x2a5211['body']['ChatWebsiteId']=_0x11b95b['id'];return db[_0x133c('0x61')]['create'](_0x2a5211['body']);}})['then'](respondWithResult(_0x9347db,null))[_0x133c('0x28')](handleError(_0x9347db,null));};exports[_0x133c('0x62')]=function(_0x4881ff,_0x4f3a66,_0x1fc041){var _0x19cfc5={'raw':![],'where':{}};var _0x191048={};var _0x3e5de1={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x133c('0x63')]({'where':{'id':_0x4881ff[_0x133c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4f3a66,null))[_0x133c('0x1f')](function(_0x1006f5){if(_0x1006f5){_0x191048['model']=_['keys'](db['Disposition'][_0x133c('0x3d')]);_0x191048[_0x133c('0x41')]=_[_0x133c('0x42')](_0x4881ff[_0x133c('0x41')]);_0x191048[_0x133c('0x43')]=_[_0x133c('0x45')](_0x191048[_0x133c('0x40')],_0x191048[_0x133c('0x41')]);_0x19cfc5[_0x133c('0x44')]=_[_0x133c('0x45')](_0x191048['model'],qs[_0x133c('0x46')](_0x4881ff['query']['fields']));_0x19cfc5[_0x133c('0x44')]=_0x19cfc5['attributes'][_0x133c('0x47')]?_0x19cfc5['attributes']:_0x191048['model'];if(!_0x4881ff[_0x133c('0x41')][_0x133c('0x48')]('nolimit')){_0x19cfc5[_0x133c('0x2f')]=qs['limit'](_0x4881ff[_0x133c('0x41')]['limit']);_0x19cfc5[_0x133c('0x2c')]=qs[_0x133c('0x2c')](_0x4881ff[_0x133c('0x41')][_0x133c('0x2c')]);}_0x19cfc5[_0x133c('0x4a')]=qs[_0x133c('0x4b')](_0x4881ff[_0x133c('0x41')][_0x133c('0x4b')]);_0x19cfc5[_0x133c('0x4c')]=qs[_0x133c('0x43')](_['pick'](_0x4881ff['query'],_0x191048[_0x133c('0x43')]));_0x19cfc5[_0x133c('0x4c')]['ChatWebsiteId']=_0x1006f5['id'];if(_0x4881ff['query'][_0x133c('0x64')]){_0x19cfc5[_0x133c('0x4c')]=_[_0x133c('0x4d')](_0x19cfc5[_0x133c('0x4c')],{'$or':_[_0x133c('0x3b')](_0x19cfc5[_0x133c('0x44')],function(_0x1dec7b){var _0x486f12={};_0x486f12[_0x1dec7b]={'$like':'%'+_0x4881ff[_0x133c('0x41')][_0x133c('0x64')]+'%'};return _0x486f12;})});}_0x19cfc5=_[_0x133c('0x4d')]({},_0x19cfc5,_0x4881ff[_0x133c('0x4f')]);return db[_0x133c('0x61')][_0x133c('0x2e')]({'where':_0x19cfc5[_0x133c('0x4c')]})['then'](function(_0x237e5){_0x3e5de1['count']=_0x237e5;if(_0x4881ff[_0x133c('0x41')][_0x133c('0x50')]){_0x19cfc5[_0x133c('0x51')]=[{'all':!![]}];}return db[_0x133c('0x61')][_0x133c('0x65')](_0x19cfc5);})[_0x133c('0x1f')](function(_0x434b14){_0x3e5de1['rows']=_0x434b14;return _0x3e5de1;});}})[_0x133c('0x1f')](respondWithFilteredResult(_0x4f3a66,_0x19cfc5))[_0x133c('0x28')](handleError(_0x4f3a66,null));};exports[_0x133c('0x66')]=function(_0x59d9d8,_0x4d80c3,_0x45c43c){return db[_0x133c('0x3c')][_0x133c('0x5a')]({'where':{'id':_0x59d9d8[_0x133c('0x5d')]['id']}})[_0x133c('0x1f')](handleEntityNotFound(_0x4d80c3,null))['then'](function(_0x536f34){if(_0x536f34){return _0x536f34[_0x133c('0x66')](_0x59d9d8[_0x133c('0x41')][_0x133c('0x67')]);}})[_0x133c('0x1f')](respondWithStatusCode(_0x4d80c3,null))['catch'](handleError(_0x4d80c3,null));};exports[_0x133c('0x68')]=function(_0xfe257a,_0x344ec9,_0x53a3d1){if(_0xfe257a[_0x133c('0x54')]['id']){delete _0xfe257a[_0x133c('0x54')]['id'];}return db[_0x133c('0x3c')][_0x133c('0x5a')]({'where':{'id':_0xfe257a[_0x133c('0x5d')]['id']}})[_0x133c('0x1f')](handleEntityNotFound(_0x344ec9,null))[_0x133c('0x1f')](function(_0x53759b){if(_0x53759b){_0xfe257a[_0x133c('0x54')][_0x133c('0x69')]=_0x53759b['id'];return db[_0x133c('0x6a')][_0x133c('0x53')](_0xfe257a[_0x133c('0x54')]);}})['then'](respondWithResult(_0x344ec9,null))[_0x133c('0x28')](handleError(_0x344ec9,null));};exports['getAnswers']=function(_0x4c68f0,_0x489e3e,_0x561651){var _0xa7b6f3={'raw':![],'where':{}};var _0x3957d2={};var _0x1c1bac={'count':0x0,'rows':[]};return db[_0x133c('0x3c')][_0x133c('0x63')]({'where':{'id':_0x4c68f0[_0x133c('0x5d')]['id']}})[_0x133c('0x1f')](handleEntityNotFound(_0x489e3e,null))[_0x133c('0x1f')](function(_0x4f2cdb){if(_0x4f2cdb){_0x3957d2[_0x133c('0x40')]=_[_0x133c('0x42')](db[_0x133c('0x6a')][_0x133c('0x3d')]);_0x3957d2[_0x133c('0x41')]=_['keys'](_0x4c68f0[_0x133c('0x41')]);_0x3957d2[_0x133c('0x43')]=_['intersection'](_0x3957d2['model'],_0x3957d2[_0x133c('0x41')]);_0xa7b6f3[_0x133c('0x44')]=_[_0x133c('0x45')](_0x3957d2[_0x133c('0x40')],qs['fields'](_0x4c68f0[_0x133c('0x41')][_0x133c('0x46')]));_0xa7b6f3[_0x133c('0x44')]=_0xa7b6f3['attributes'][_0x133c('0x47')]?_0xa7b6f3[_0x133c('0x44')]:_0x3957d2[_0x133c('0x40')];if(!_0x4c68f0[_0x133c('0x41')][_0x133c('0x48')](_0x133c('0x49'))){_0xa7b6f3[_0x133c('0x2f')]=qs[_0x133c('0x2f')](_0x4c68f0[_0x133c('0x41')][_0x133c('0x2f')]);_0xa7b6f3[_0x133c('0x2c')]=qs[_0x133c('0x2c')](_0x4c68f0[_0x133c('0x41')][_0x133c('0x2c')]);}_0xa7b6f3[_0x133c('0x4a')]=qs['sort'](_0x4c68f0[_0x133c('0x41')][_0x133c('0x4b')]);_0xa7b6f3[_0x133c('0x4c')]=qs[_0x133c('0x43')](_[_0x133c('0x6b')](_0x4c68f0[_0x133c('0x41')],_0x3957d2[_0x133c('0x43')]));_0xa7b6f3['where'][_0x133c('0x69')]=_0x4f2cdb['id'];if(_0x4c68f0['query'][_0x133c('0x64')]){_0xa7b6f3[_0x133c('0x4c')]=_[_0x133c('0x4d')](_0xa7b6f3[_0x133c('0x4c')],{'$or':_[_0x133c('0x3b')](_0xa7b6f3[_0x133c('0x44')],function(_0x3696d6){var _0xb40f0={};_0xb40f0[_0x3696d6]={'$like':'%'+_0x4c68f0[_0x133c('0x41')][_0x133c('0x64')]+'%'};return _0xb40f0;})});}_0xa7b6f3=_[_0x133c('0x4d')]({},_0xa7b6f3,_0x4c68f0[_0x133c('0x4f')]);return db[_0x133c('0x6a')][_0x133c('0x2e')]({'where':_0xa7b6f3[_0x133c('0x4c')]})[_0x133c('0x1f')](function(_0x2db015){_0x1c1bac[_0x133c('0x2e')]=_0x2db015;if(_0x4c68f0['query'][_0x133c('0x50')]){_0xa7b6f3[_0x133c('0x51')]=[{'all':!![]}];}return db[_0x133c('0x6a')]['findAll'](_0xa7b6f3);})[_0x133c('0x1f')](function(_0x2a5331){_0x1c1bac['rows']=_0x2a5331;return _0x1c1bac;});}})[_0x133c('0x1f')](respondWithFilteredResult(_0x489e3e,_0xa7b6f3))[_0x133c('0x28')](handleError(_0x489e3e,null));};exports[_0x133c('0x6c')]=function(_0x5ba801,_0x47fe3c,_0x330697){return db[_0x133c('0x3c')][_0x133c('0x5a')]({'where':{'id':_0x5ba801[_0x133c('0x5d')]['id']}})[_0x133c('0x1f')](handleEntityNotFound(_0x47fe3c,null))[_0x133c('0x1f')](function(_0x267ff6){if(_0x267ff6){return _0x267ff6['removeAnswers'](_0x5ba801[_0x133c('0x41')][_0x133c('0x67')]);}})[_0x133c('0x1f')](respondWithStatusCode(_0x47fe3c,null))['catch'](handleError(_0x47fe3c,null));};exports[_0x133c('0x6d')]=function(_0x514dfc,_0xb42d6d,_0x509892){_0x514dfc['body'][_0x133c('0x6e')]=_0x514dfc['file'][_0x133c('0x6f')];return db[_0x133c('0x3c')][_0x133c('0x5a')]({'where':{'id':_0x514dfc[_0x133c('0x5d')]['id']}})['then'](handleEntityNotFound(_0xb42d6d,null))[_0x133c('0x1f')](saveUpdates(_0x514dfc[_0x133c('0x54')],null))['then'](respondWithResult(_0xb42d6d,null))['catch'](handleError(_0xb42d6d,null));};exports[_0x133c('0x70')]=function(_0x4aca65,_0xe1626b,_0x386872){_0x4aca65['body'][_0x133c('0x71')]=_0x4aca65[_0x133c('0x72')][_0x133c('0x6f')];return db['ChatWebsite'][_0x133c('0x5a')]({'where':{'id':_0x4aca65['params']['id']}})['then'](handleEntityNotFound(_0xe1626b,null))['then'](saveUpdates(_0x4aca65['body'],null))['then'](respondWithResult(_0xe1626b,null))[_0x133c('0x28')](handleError(_0xe1626b,null));};exports['addCustomerAvatar']=function(_0x477cf8,_0x26ff54,_0x1be8b){_0x477cf8[_0x133c('0x54')][_0x133c('0x73')]=_0x477cf8['file'][_0x133c('0x6f')];return db[_0x133c('0x3c')][_0x133c('0x5a')]({'where':{'id':_0x477cf8[_0x133c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x26ff54,null))[_0x133c('0x1f')](saveUpdates(_0x477cf8[_0x133c('0x54')],null))['then'](respondWithResult(_0x26ff54,null))['catch'](handleError(_0x26ff54,null));};exports[_0x133c('0x74')]=function(_0x35c526,_0x20c55d,_0x524ce3){_0x35c526['body'][_0x133c('0x75')]=_0x35c526[_0x133c('0x72')][_0x133c('0x6f')];return db['ChatWebsite']['find']({'where':{'id':_0x35c526[_0x133c('0x5d')]['id']}})[_0x133c('0x1f')](handleEntityNotFound(_0x20c55d,null))[_0x133c('0x1f')](saveUpdates(_0x35c526[_0x133c('0x54')],null))[_0x133c('0x1f')](respondWithResult(_0x20c55d,null))[_0x133c('0x28')](handleError(_0x20c55d,null));};exports['getLogo']=function(_0x36da67,_0x3560b2,_0x17d6fb){var _0x1cc66e=path[_0x133c('0x76')](config[_0x133c('0x77')],_0x133c('0x78'));var _0x51cff9={'where':{'id':_0x36da67[_0x133c('0x5d')]['id']},'attributes':['id',_0x133c('0x6e')],'raw':!![]};var _0x252fbe=![];return require('../../config/license/util')['getLicense']()[_0x133c('0x1f')](function(_0x247226){if(_0x247226){_0x252fbe=_0x247226['custom'];}})['then'](function(){return db[_0x133c('0x3c')][_0x133c('0x5a')](_0x51cff9);})['then'](handleEntityNotFound(_0x3560b2,null))[_0x133c('0x1f')](function(_0x400eb3){if(_0x400eb3){if(!_['isNil'](_0x400eb3[_0x133c('0x6e')])){if(fs[_0x133c('0x79')](path[_0x133c('0x76')](config[_0x133c('0x77')],_0x133c('0x7a'),_0x400eb3['sitepic']))&&_0x252fbe){_0x1cc66e=path[_0x133c('0x76')](config[_0x133c('0x77')],_0x133c('0x7a'),_0x400eb3['sitepic']);}}return _0x3560b2[_0x133c('0x7b')](_0x1cc66e);}})[_0x133c('0x28')](handleError(_0x3560b2,null));};exports[_0x133c('0x7c')]=function(_0x28e03a,_0x21ff0b,_0x507556){var _0x33f35e=path['join'](config['root'],'server/files/images/avatars/default_avatar.png');var _0x8ebb3={'where':{'id':_0x28e03a[_0x133c('0x5d')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x133c('0x3c')][_0x133c('0x5a')](_0x8ebb3)['then'](handleEntityNotFound(_0x21ff0b,null))[_0x133c('0x1f')](function(_0x272b94){if(_0x272b94){if(!_['isNil'](_0x272b94[_0x133c('0x71')])){if(fs[_0x133c('0x79')](path[_0x133c('0x76')](config[_0x133c('0x77')],_0x133c('0x7d'),_0x272b94[_0x133c('0x71')]))){_0x33f35e=path['join'](config['root'],_0x133c('0x7d'),_0x272b94['agentAvatar']);}}return _0x21ff0b['download'](_0x33f35e);}})[_0x133c('0x28')](handleError(_0x21ff0b,null));};exports[_0x133c('0x7e')]=function(_0x369c16,_0x41e874,_0x335cec){var _0x1956e5=path['join'](config[_0x133c('0x77')],_0x133c('0x7f'));var _0x1ed851={'where':{'id':_0x369c16[_0x133c('0x5d')]['id']},'attributes':['id',_0x133c('0x73'),_0x133c('0x80')],'raw':!![]};return db[_0x133c('0x3c')]['find'](_0x1ed851)[_0x133c('0x1f')](handleEntityNotFound(_0x41e874,null))[_0x133c('0x1f')](function(_0x58e61f){if(_0x58e61f){if(!_[_0x133c('0x81')](_0x58e61f[_0x133c('0x73')])){if(fs[_0x133c('0x79')](path[_0x133c('0x76')](config[_0x133c('0x77')],_0x133c('0x7d'),_0x58e61f[_0x133c('0x73')]))&&_0x58e61f['showCustomerAvatar']){_0x1956e5=path[_0x133c('0x76')](config[_0x133c('0x77')],'server/files/images/avatars/',_0x58e61f[_0x133c('0x73')]);}}return _0x41e874[_0x133c('0x7b')](_0x1956e5);}})[_0x133c('0x28')](handleError(_0x41e874,null));};exports['getSystemAvatar']=function(_0x52e532,_0x3f54c9,_0x27781f){var _0x406024=path['join'](config[_0x133c('0x77')],_0x133c('0x82'));var _0x332b5d={'where':{'id':_0x52e532[_0x133c('0x5d')]['id']},'attributes':['id',_0x133c('0x75')],'raw':!![]};return db[_0x133c('0x3c')]['find'](_0x332b5d)[_0x133c('0x1f')](handleEntityNotFound(_0x3f54c9,null))[_0x133c('0x1f')](function(_0xfad424){if(_0xfad424){if(!_[_0x133c('0x81')](_0xfad424[_0x133c('0x75')])){if(fs[_0x133c('0x79')](path[_0x133c('0x76')](config[_0x133c('0x77')],'server/files/images/avatars/',_0xfad424[_0x133c('0x75')]))){_0x406024=path[_0x133c('0x76')](config['root'],_0x133c('0x7d'),_0xfad424[_0x133c('0x75')]);}}return _0x3f54c9['download'](_0x406024);}})['catch'](handleError(_0x3f54c9,null));};exports['notify']=function(_0x1bebf4,_0x31eae2,_0xa1a866){var _0x926cc4=require(_0x133c('0x83'));var _0x57cbf2=new _0x926cc4();var _0x51a428=_0x57cbf2[_0x133c('0x84')](_0x1bebf4[_0x133c('0x85')][_0x133c('0x86')])['getResult']();var _0x381582={'body':_0x1bebf4[_0x133c('0x54')],'channel':_0x133c('0x87')};var _0x2b5227=[];var _0x4764a2=[];var _0x19ce49={};var _0x31a0ef=![];return db[_0x133c('0x88')][_0x133c('0x5f')]()[_0x133c('0x1f')](function(_0x279393){if(!_0x279393){throw new db['Sequelize'][(_0x133c('0x89'))](_0x133c('0x8a'));}_0x2b5227=_[_0x133c('0x8b')](_[_0x133c('0x42')](_0x279393),[_0x133c('0x8c'),_0x133c('0x8d')]);_0x4764a2=_[_0x133c('0x8b')](_['keys'](_0x279393),[_0x133c('0x8c'),_0x133c('0x8d'),_0x133c('0x8e'),'ListId']);if(_0x1bebf4[_0x133c('0x54')]['id']){delete _0x1bebf4['body']['id'];}if(_[_0x133c('0x81')](_0x1bebf4['body'][_0x133c('0x8f')])){throw new db['Sequelize'][(_0x133c('0x89'))]('from\x20is\x20mandatory');}if(_[_0x133c('0x81')](_0x1bebf4['body']['body'])||_0x1bebf4['body'][_0x133c('0x54')]===''){throw new db[(_0x133c('0x90'))][(_0x133c('0x89'))](_0x133c('0x91'));}if(_['isNil'](_0x1bebf4[_0x133c('0x54')][_0x133c('0x92')])){throw new db[(_0x133c('0x90'))][(_0x133c('0x89'))](_0x133c('0x93')+_0x4764a2);}if(!_[_0x133c('0x94')](_0x4764a2,_0x1bebf4[_0x133c('0x54')]['mapKey'])){throw new db[(_0x133c('0x90'))][(_0x133c('0x89'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4764a2);}_0x19ce49[_0x1bebf4[_0x133c('0x54')][_0x133c('0x92')]]=_0x1bebf4[_0x133c('0x54')]['from'];})[_0x133c('0x1f')](function(){return db[_0x133c('0x3c')]['find']({'where':{'id':_0x1bebf4[_0x133c('0x5d')]['id']},'include':[{'model':db[_0x133c('0x95')],'as':_0x133c('0x96'),'include':[{'model':db[_0x133c('0x88')],'as':_0x133c('0x97'),'where':_0x19ce49,'limit':0x1,'order':[[_0x133c('0x8d'),_0x133c('0x98')]]}]},{'model':db[_0x133c('0x99')],'as':'Applications'}]});})[_0x133c('0x1f')](handleEntityNotFound(_0x31eae2,null))['then'](function(_0x13ca70){if(_0x13ca70&&_0x13ca70[_0x133c('0x96')]){_0x381582[_0x133c('0x9a')]=_0x13ca70;_0x381582['applications']=_0x13ca70[_0x133c('0x9b')];_0x381582[_0x133c('0x9c')]=_0x13ca70[_0x133c('0x96')];_0x381582['applications']=_[_0x133c('0x9d')](_0x381582[_0x133c('0x9e')],[_0x133c('0x9f')],['asc']);if(_0x381582[_0x133c('0x9a')][_0x133c('0x9b')]){delete _0x381582[_0x133c('0x9a')][_0x133c('0x9b')];}if(_0x381582[_0x133c('0x9a')]['List']&&_0x381582[_0x133c('0x9a')][_0x133c('0x96')]['Contacts'][_0x133c('0x47')]){return _0x381582[_0x133c('0x9a')][_0x133c('0x96')][_0x133c('0x97')][0x0];}var _0x8ebf64=_['defaults'](_0x1bebf4[_0x133c('0x54')],{'firstName':_0x1bebf4['body'][_0x133c('0x8f')],'ListId':_0x13ca70['ListId']});_0x8ebf64[_0x1bebf4[_0x133c('0x54')][_0x133c('0x92')]]=_0x1bebf4[_0x133c('0x54')][_0x133c('0x8f')];return db[_0x133c('0x88')]['create'](_0x8ebf64,{'fields':_0x2b5227,'raw':!![]});}})[_0x133c('0x1f')](handleEntityNotFound(_0x31eae2,null))['then'](function(_0x2d6d3f){_0x381582[_0x133c('0xa0')]=_0x2d6d3f;var _0x56b97c=_0x1bebf4[_0x133c('0x54')]['customerIp'];if(_0x1bebf4[_0x133c('0x85')][_0x133c('0xa1')]){_0x56b97c=_0x1bebf4[_0x133c('0x85')][_0x133c('0xa1')];}else if(_0x1bebf4[_0x133c('0x85')][_0x133c('0xa2')]){_0x56b97c=_['first'](_0x1bebf4[_0x133c('0x85')]['x-forwarded-for'][_0x133c('0xa3')](','));}if(_0x2d6d3f){var _0x580298={'ContactId':_0x2d6d3f['id'],'ChatWebsiteId':_0x1bebf4[_0x133c('0x5d')]['id'],'from':(_0x2d6d3f[_0x133c('0xa4')]||'')+'\x20'+(_0x2d6d3f[_0x133c('0xa5')]||''),'customerIp':_0x56b97c,'customerPort':_0x1bebf4['headers'][_0x133c('0xa6')]?_0x1bebf4['headers']['x-real-port']:null,'referer':_0x1bebf4[_0x133c('0x54')][_0x133c('0xa7')],'browserName':_0x51a428[_0x133c('0xa8')][_0x133c('0x38')]&&_0x51a428[_0x133c('0xa8')][_0x133c('0xa9')]?util[_0x133c('0xaa')](_0x133c('0xab'),_0x51a428['browser'][_0x133c('0x38')],_0x51a428[_0x133c('0xa8')][_0x133c('0xa9')]):_0x133c('0xac'),'browserVersion':_0x51a428[_0x133c('0xa8')][_0x133c('0xa9')]||_0x133c('0xac'),'osName':util[_0x133c('0xaa')](_0x133c('0xab'),_0x51a428['os'][_0x133c('0x38')],_0x51a428['os'][_0x133c('0xa9')]),'osVersion':_0x51a428['os']['version'],'deviceModel':_0x51a428[_0x133c('0xad')][_0x133c('0x40')]&&_0x51a428[_0x133c('0xad')][_0x133c('0xae')]?util['format'](_0x133c('0xaf'),_0x51a428[_0x133c('0xad')][_0x133c('0x40')],_0x51a428[_0x133c('0xad')][_0x133c('0xae')],_0x51a428[_0x133c('0xad')][_0x133c('0x3e')]):null,'deviceVendor':_0x51a428[_0x133c('0xad')]['vendor'],'deviceType':_0x51a428['device'][_0x133c('0x3e')],'formData':JSON[_0x133c('0xb0')](_0x1bebf4[_0x133c('0x54')])};var _0x19a8d8={'ChatWebsiteId':_0x1bebf4[_0x133c('0x5d')]['id'],'closed':![]};if(_0x1bebf4[_0x133c('0x54')]['threadId']){_0x19a8d8[_0x133c('0xb1')]=_0x1bebf4[_0x133c('0x54')]['threadId'];return db[_0x133c('0xb2')][_0x133c('0x5a')]({'where':_0x19a8d8})[_0x133c('0x1f')](function(_0x68e210){if(_0x68e210){return[_0x68e210,![]];}_0x580298[_0x133c('0xb1')]=_0x1bebf4[_0x133c('0x54')][_0x133c('0xb1')];_0x580298[_0x133c('0xb3')]=_0x1bebf4[_0x133c('0x54')][_0x133c('0xb3')];return db[_0x133c('0xb2')][_0x133c('0x53')](_0x580298)[_0x133c('0x1f')](function(_0x51bde0){return[_0x51bde0,!![]];});});}_0x19a8d8[_0x133c('0xb4')]=_0x2d6d3f['id'];if(_0x1bebf4[_0x133c('0x54')][_0x133c('0xb5')]&&_0x1bebf4['body'][_0x133c('0xb5')]['id']){_0x19a8d8['id']=_0x1bebf4[_0x133c('0x54')][_0x133c('0xb5')]['id'];return db[_0x133c('0xb2')][_0x133c('0x5a')]({'where':_0x19a8d8})[_0x133c('0x1f')](function(_0x4d0514){if(_0x4d0514){return[_0x4d0514,![]];}return db[_0x133c('0xb2')]['create'](_0x580298)[_0x133c('0x1f')](function(_0x25b935){return[_0x25b935,!![]];});});}return db[_0x133c('0xb2')][_0x133c('0x53')](_0x580298)[_0x133c('0x1f')](function(_0x5df221){return[_0x5df221,!![]];});}})[_0x133c('0xb6')](function(_0x36124e,_0x3b7cf7){if(_0x36124e){_0x31a0ef=_0x3b7cf7;if(!_0x3b7cf7){var _0x15e339={'from':(_0x381582[_0x133c('0xa0')][_0x133c('0xa4')]||'')+'\x20'+(_0x381582[_0x133c('0xa0')][_0x133c('0xa5')]||'')};if(_0x1bebf4[_0x133c('0x54')][_0x133c('0xb1')]&&_0x1bebf4[_0x133c('0x54')][_0x133c('0xb7')]&&_0x1bebf4[_0x133c('0x54')][_0x133c('0xb1')]!=_0x1bebf4[_0x133c('0x54')][_0x133c('0xb7')]){_0x15e339[_0x133c('0xb1')]=_0x1bebf4[_0x133c('0x54')][_0x133c('0xb7')];}return _0x36124e['update'](_0x15e339);}else{return _0x36124e;}}})[_0x133c('0x1f')](function(_0x35a3df){_0x381582[_0x133c('0xb5')]=_0x35a3df[_0x133c('0x56')]({'plain':!![]});_0x381582['interaction'][_0x133c('0xb8')]=_0x31a0ef;if(_0x381582[_0x133c('0xb5')][_0x133c('0xb8')]){if(_0x381582[_0x133c('0x9a')]['autoclose']){_0x381582['applications'][_0x133c('0xb9')]({'id':0x0,'priority':_0x381582['applications'][_0x133c('0x47')]+0x1,'app':'close','appdata':_0x133c('0xba'),'interval':_0x133c('0xbb')});}}return db[_0x133c('0xbc')]['create']({'body':_0x1bebf4['body'][_0x133c('0x54')],'ChatWebsiteId':_0x1bebf4['params']['id'],'ChatInteractionId':_0x35a3df['id'],'direction':'in','ContactId':_0x381582[_0x133c('0xa0')]['id'],'AttachmentId':_0x1bebf4[_0x133c('0x54')][_0x133c('0xbd')]});})['then'](function(_0x42b13c){_0x381582[_0x133c('0x26')]=_0x42b13c;if(_0x381582['interaction']['UserId']){return db[_0x133c('0xbe')][_0x133c('0x5a')]({'attributes':['id',_0x133c('0x38')],'where':{'id':_0x381582['interaction']['UserId']}})[_0x133c('0x1f')](function(_0x543024){if(_0x543024){_0x381582[_0x133c('0x9e')][_0x133c('0xbf')]({'id':0x0,'priority':0x0,'app':_0x133c('0xc0'),'appdata':_0x543024['name']+','+(_0x381582[_0x133c('0x9a')][_0x133c('0xc1')]||0xa),'interval':_0x133c('0xbb')});_0x381582[_0x133c('0xc2')]=!![];}return respondWithRpcPromise(_0x133c('0xc3'),_0x133c('0xc4'),_0x381582);});}return respondWithRpcPromise(_0x133c('0xc3'),_0x133c('0xc4'),_0x381582);})[_0x133c('0x1f')](function(_0x185717){respondWithRpcPromise(_0x133c('0xc5'),'EventManager',{'event':_0x133c('0xc6'),'message':_0x185717},client9002);return _0x185717;})[_0x133c('0x1f')](respondWithResult(_0x31eae2,null))['catch'](handleError(_0x31eae2,null));};exports['offline']=function(_0xf7a7c9,_0x2ccb73,_0x5eb965){var _0x2f9439,_0x5d1047,_0x8848f;var _0x1b6e17=[];var _0xd5f07a=[];var _0x3f6468={};var _0x101dbc=_0xf7a7c9[_0x133c('0xc7')]||[];var _0x40e117=[];var _0x1edbac;return db[_0x133c('0x88')][_0x133c('0x5f')]()[_0x133c('0x1f')](function(_0x3262a7){if(!_0x3262a7){throw new db[(_0x133c('0x90'))][(_0x133c('0x89'))]('no\x20available\x20attributes');}_0xd5f07a=_[_0x133c('0x8b')](_['keys'](_0x3262a7),[_0x133c('0x8c'),_0x133c('0x8d')]);_0x1b6e17=_['difference'](_[_0x133c('0x42')](_0x3262a7),['createdAt',_0x133c('0x8d'),_0x133c('0x8e'),_0x133c('0xc8')]);if(_0xf7a7c9[_0x133c('0x54')]['id']){delete _0xf7a7c9[_0x133c('0x54')]['id'];}if(_[_0x133c('0x81')](_0xf7a7c9[_0x133c('0x54')][_0x133c('0x8f')])){throw _0x2ccb73[_0x133c('0x36')](0x1f4)[_0x133c('0x39')](new db[(_0x133c('0x90'))]['ValidationError'](_0x133c('0xc9')));}if(_[_0x133c('0x81')](_0xf7a7c9['body']['body'])||_0xf7a7c9['body'][_0x133c('0x54')]===''){throw _0x2ccb73[_0x133c('0x36')](0x1f4)[_0x133c('0x39')](new db['Sequelize'][(_0x133c('0x89'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x133c('0x81')](_0xf7a7c9[_0x133c('0x54')][_0x133c('0xca')])){throw _0x2ccb73[_0x133c('0x36')](0x1f4)[_0x133c('0x39')](new db[(_0x133c('0x90'))][(_0x133c('0x89'))](_0x133c('0xcb')+_0x1b6e17));}if(!_['includes'](_0x1b6e17,_0xf7a7c9['body'][_0x133c('0xca')])){throw _0x2ccb73[_0x133c('0x36')](0x1f4)[_0x133c('0x39')](new db['Sequelize'][(_0x133c('0x89'))](_0x133c('0xcc')+_0x1b6e17));}_0x3f6468[_0xf7a7c9['body'][_0x133c('0xca')]]=_0xf7a7c9['body'][_0x133c('0x8f')];})['then'](function(){return db['ChatWebsite'][_0x133c('0x5a')]({'where':{'id':_0xf7a7c9[_0x133c('0x5d')]['id']},'include':[{'model':db[_0x133c('0x95')],'as':_0x133c('0x96')},{'model':db[_0x133c('0xcd')],'as':'MailAccount'}]});})[_0x133c('0x1f')](handleEntityNotFound(_0x2ccb73,null))[_0x133c('0x1f')](function(_0x1d645d){if(_0x1d645d&&_0x1d645d[_0x133c('0x96')]){_0x5d1047=_0x1d645d;var _0x3f608c=_[_0x133c('0xce')](_0xf7a7c9[_0x133c('0x54')],{'firstName':_0xf7a7c9[_0x133c('0x54')][_0x133c('0x8f')],'phone':_0xf7a7c9['body']['from'],'ListId':_0x1d645d[_0x133c('0xc8')]});_0x3f608c[_0xf7a7c9[_0x133c('0x54')]['mapKeyOffline']]=_0xf7a7c9['body'][_0x133c('0x8f')];return db['CmContact']['findOrCreate']({'where':_0x3f6468,'defaults':_0x3f608c});}})[_0x133c('0xb6')](function(_0x4d7d80){if(_0x4d7d80){_0x8848f=_0x4d7d80;var _0x3daf1c=fs['readFileSync'](path[_0x133c('0x76')](config[_0x133c('0x77')],_0x133c('0xcf')),_0x133c('0xd0'));var _0x3ec1af=ejs['render'](_0x3daf1c,{'body':_[_0x133c('0xd1')](_0xf7a7c9[_0x133c('0x54')][_0x133c('0x54')]),'bodyTitle':_0x5d1047[_0x133c('0xd2')]});return db[_0x133c('0xd3')][_0x133c('0x53')]({'body':_0x3ec1af,'ContactId':_0x4d7d80['id'],'ChatWebsiteId':_0x5d1047['id']});}})[_0x133c('0x1f')](function(_0x5b708a){_0x1edbac=_0x5b708a;if(_0x101dbc[_0x133c('0x47')]){var _0x1106c9=_0x101dbc[_0x133c('0x3b')](function(_0x33f569){return{'name':_0x33f569['originalname'],'basename':_0x33f569['filename'],'type':_0x33f569[_0x133c('0xd4')],'ChatOfflineMessageId':_0x5b708a['id']};});_0x40e117=_0x1106c9[_0x133c('0x3b')](_0x46796d=>{var _0xd24229={'filename':_0x46796d[_0x133c('0x38')],'path':path[_0x133c('0x76')](config['root'],_0x133c('0xd5'),_0x133c('0xc7'),_0x133c('0xd6'),'offline-chat',_0x46796d['basename'])};return _0xd24229;});if(!_0x5d1047[_0x133c('0xd7')]){return db[_0x133c('0xd8')]['transaction'](function(_0x4b3d4a){return db[_0x133c('0xd9')][_0x133c('0xda')](_0x1106c9,{'transaction':_0x4b3d4a});});}}})[_0x133c('0x1f')](function(){if(_0x1edbac){_0x2f9439=_0x1edbac;return db[_0x133c('0xcd')][_0x133c('0x63')]({'where':{'active':!![]},'include':[{'model':db[_0x133c('0xdb')],'as':_0x133c('0xdc'),'raw':!![]}]});}})[_0x133c('0x1f')](function(_0x15e893){if(_0x15e893&&_0x15e893[_0x133c('0xdc')]&&_0x5d1047[_0x133c('0xdd')]&&_0x5d1047[_0x133c('0xde')]){var _0x20ee0d={'tls':{'rejectUnauthorized':![]}};if(_0x15e893[_0x133c('0xdc')][_0x133c('0xdf')]){_0x20ee0d['service']=_0x15e893[_0x133c('0xdc')][_0x133c('0xdf')];}else{_0x20ee0d[_0x133c('0xe0')]=_0x15e893[_0x133c('0xdc')][_0x133c('0xe0')];_0x20ee0d[_0x133c('0xe1')]=_0x15e893[_0x133c('0xdc')]['port'];_0x20ee0d['secure']=_0x15e893[_0x133c('0xdc')][_0x133c('0xe2')];}if(_0x15e893[_0x133c('0xdc')][_0x133c('0xe3')]){_0x20ee0d[_0x133c('0xe4')]={'user':_0x15e893[_0x133c('0xdc')][_0x133c('0x55')],'pass':_0x15e893['Smtp'][_0x133c('0xe5')]};}return respondWithRpcPromise(_0x133c('0xe6'),_0x133c('0xe7'),{'account':_0x20ee0d,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x15e893[_0x133c('0x38')],_0x15e893[_0x133c('0xe8')]||_0x15e893['Smtp'][_0x133c('0x55')]),'to':_0x5d1047[_0x133c('0xde')],'subject':_0x5d1047[_0x133c('0xe9')],'html':_0x2f9439[_0x133c('0x54')],'attachments':_0x40e117}},client9003)[_0x133c('0x1f')](function(){return _0x2f9439;})[_0x133c('0x28')](function(_0x32e18e){console[_0x133c('0x25')](_0x32e18e);});}})[_0x133c('0x1f')](function(){if(_0x5d1047&&_0x5d1047['openNewInteraction']&&_0x5d1047[_0x133c('0xea')]){var _0x42266d=[];if(_0x101dbc[_0x133c('0x47')]){_0x42266d=_0x101dbc[_0x133c('0x3b')](function(_0x44f520){return{'name':_0x44f520[_0x133c('0xeb')],'basename':_0x44f520['filename'],'type':_0x44f520[_0x133c('0xd4')],'ChatOfflineMessageId':_0x1edbac['id']};});}var _0x3b6f5c;if(!_['isNil'](_0x5d1047[_0x133c('0xec')])){var _0x33967f=_['map'](_0xf7a7c9['body'],function(_0x4982d4){return _0x4982d4;});var _0x469d1c=_[_0x133c('0xed')](_0x33967f)[0x0];var _0x44367c=_[_0x133c('0xee')](_0x469d1c,function(_0x1ef491){return _0x1ef491;});_0x3b6f5c=_0x44367c[0x1][_0x5d1047[_0x133c('0xec')]];}var _0x1fd63d={'from':_0x8848f[_0x133c('0xe8')],'firstName':_0x8848f[_0x133c('0xa4')],'lastName':_0x8848f[_0x133c('0xa5')],'mapKey':_0x133c('0xe8'),'message':{'from':_0x8848f[_0x133c('0xe8')],'to':_0x5d1047['MailAccount'][_0x133c('0xe8')],'cc':'','subject':_[_0x133c('0x81')](_0x3b6f5c)?_0x5d1047['offlineMessageSubject']:_0x3b6f5c,'messageId':'','sentAt':new Date(),'attach':_0x42266d[_0x133c('0x47')],'attachments':_0x42266d,'originChannel':_0x133c('0xef'),'ChatWebsiteId':_0x5d1047['id'],'ChatOfflineMessageId':_0x2f9439['id'],'originTo':_0x5d1047[_0x133c('0xcd')]['email']},'body':_0x2f9439[_0x133c('0x54')]};var _0x171c2b={'account':{'id':_0x5d1047[_0x133c('0xea')]},'body':_0x1fd63d,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0x133c('0xf0'),_0x171c2b,client9001)[_0x133c('0x1f')](function(){return _0x2f9439;})[_0x133c('0x28')](function(_0x48152d){console[_0x133c('0x25')](_0x48152d);});}return;})[_0x133c('0x1f')](function(){if(_0x2f9439){return _0x2f9439;}})[_0x133c('0x1f')](respondWithResult(_0x2ccb73,null))[_0x133c('0x28')](function(_0x1724e6){console[_0x133c('0x25')]('catch',_0x1724e6);for(var _0x4c0af9 of _0x101dbc){var _0x57f8a3=path[_0x133c('0x76')](config[_0x133c('0x77')],_0x133c('0xd5'),'files',_0x133c('0xd6'),'offline-chat',_0x4c0af9[_0x133c('0x6f')]);fs_extra[_0x133c('0xf1')](_0x57f8a3)[_0x133c('0x28')](function(_0x272636){console[_0x133c('0x25')](_0x133c('0xf2'),_0x57f8a3,_0x272636);});}});};exports['addInteraction']=function(_0x447f37,_0x16af83,_0x28ce38){return db[_0x133c('0xb2')]['find']({'where':{'id':_0x447f37['params']['id']}})['then'](handleEntityNotFound(_0x16af83,null))[_0x133c('0x1f')](function(_0x1cd1c8){if(_0x1cd1c8){return _0x1cd1c8[_0x133c('0xf3')](_0x447f37[_0x133c('0x54')][_0x133c('0x67')],_[_0x133c('0xf4')](_0x447f37['body'],[_0x133c('0x67'),'id'])||{});}})[_0x133c('0x1f')](respondWithResult(_0x16af83,null))[_0x133c('0x28')](handleError(_0x16af83,null));};exports['getInteractions']=function(_0x442c65,_0x317886,_0x1b1614){var _0x403026={'raw':![],'where':{}};var _0x3f43dc={};var _0x4627ef={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x133c('0x63')]({'where':{'id':_0x442c65[_0x133c('0x5d')]['id']}})[_0x133c('0x1f')](handleEntityNotFound(_0x317886,null))[_0x133c('0x1f')](function(_0x30b490){if(_0x30b490){_0x3f43dc[_0x133c('0x40')]=_['keys'](db[_0x133c('0xb2')]['rawAttributes']);_0x3f43dc[_0x133c('0x41')]=_['keys'](_0x442c65[_0x133c('0x41')]);_0x3f43dc[_0x133c('0x43')]=_[_0x133c('0x45')](_0x3f43dc[_0x133c('0x40')],_0x3f43dc[_0x133c('0x41')]);_0x403026[_0x133c('0x44')]=_[_0x133c('0x45')](_0x3f43dc[_0x133c('0x40')],qs[_0x133c('0x46')](_0x442c65[_0x133c('0x41')][_0x133c('0x46')]));_0x403026['attributes']=_0x403026[_0x133c('0x44')][_0x133c('0x47')]?_0x403026[_0x133c('0x44')]:_0x3f43dc[_0x133c('0x40')];if(!_0x442c65[_0x133c('0x41')]['hasOwnProperty']('nolimit')){_0x403026[_0x133c('0x2f')]=qs[_0x133c('0x2f')](_0x442c65['query']['limit']);_0x403026['offset']=qs[_0x133c('0x2c')](_0x442c65['query'][_0x133c('0x2c')]);}_0x403026[_0x133c('0x4a')]=qs[_0x133c('0x4b')](_0x442c65[_0x133c('0x41')][_0x133c('0x4b')]);_0x403026[_0x133c('0x4c')]=qs[_0x133c('0x43')](_[_0x133c('0x6b')](_0x442c65[_0x133c('0x41')],_0x3f43dc['filters']));_0x403026[_0x133c('0x4c')][_0x133c('0x69')]=_0x30b490['id'];if(_0x442c65[_0x133c('0x41')][_0x133c('0x64')]){_0x403026['where']=_[_0x133c('0x4d')](_0x403026['where'],{'$or':_[_0x133c('0x3b')](_0x403026['attributes'],function(_0xb0e650){var _0x57e19b={};_0x57e19b[_0xb0e650]={'$like':'%'+_0x442c65[_0x133c('0x41')][_0x133c('0x64')]+'%'};return _0x57e19b;})});}_0x403026=_['merge']({},_0x403026,_0x442c65[_0x133c('0x4f')]);return db[_0x133c('0xb2')][_0x133c('0x2e')]({'where':_0x403026[_0x133c('0x4c')]})[_0x133c('0x1f')](function(_0x4a0889){_0x4627ef[_0x133c('0x2e')]=_0x4a0889;if(_0x442c65[_0x133c('0x41')]['includeAll']){_0x403026[_0x133c('0x51')]=[{'model':db[_0x133c('0x88')],'as':'Contact','required':![]},{'model':db[_0x133c('0xbe')],'as':_0x133c('0xf5'),'attributes':[_0x133c('0x38'),_0x133c('0xf6'),_0x133c('0xf7')],'required':![]},{'model':db[_0x133c('0xf8')],'as':_0x133c('0xf9'),'attributes':['id',_0x133c('0x38'),'color'],'where':_0x442c65[_0x133c('0x41')]['tag']?{'id':_0x442c65['query']['tag']}:undefined,'required':_0x442c65[_0x133c('0x41')][_0x133c('0xfa')]?!![]:![]}];}return db[_0x133c('0xb2')][_0x133c('0x65')](_0x403026);})[_0x133c('0x1f')](function(_0x4c4d43){_0x4627ef[_0x133c('0xfb')]=_0x4c4d43;return _0x4627ef;});}})['then'](respondWithFilteredResult(_0x317886,_0x403026))[_0x133c('0x28')](handleError(_0x317886,null));};function iftimePromise(_0x5f7dab,_0x1f7e2f){return respondWithRpcPromise('Command',_0x133c('0xfc'),{'command':_0x1f7e2f['timezone']?util[_0x133c('0xaa')](_0x133c('0xfd'),_0x5f7dab[_0x133c('0xfe')],_0x1f7e2f[_0x133c('0xff')]):util[_0x133c('0xaa')]('iftime\x20%s',_0x5f7dab[_0x133c('0xfe')])},client9002)['then'](function(_0x4e9bcc){var _0x43b51f=_0x4e9bcc&&_0x4e9bcc[_0x133c('0x100')](_0x133c('0x101'))>=0x0?!![]:![];logger[_0x133c('0x20')](_0x133c('0x102'),_0x1f7e2f['id'],_0x5f7dab['id'],_0x5f7dab[_0x133c('0xfe')],_0x43b51f?_0x133c('0x103'):_0x133c('0x104'),_0x1f7e2f[_0x133c('0xff')]?_0x1f7e2f[_0x133c('0xff')]:'No\x20timezone');return _0x43b51f;})[_0x133c('0x28')](function(_0x25e359){logger[_0x133c('0x25')](_0x133c('0x102'),_0x1f7e2f['id'],_0x5f7dab['id'],_0x5f7dab[_0x133c('0xfe')],util[_0x133c('0x105')](_0x25e359,{'showHidden':![],'depth':null}),_0x1f7e2f['timezone']?_0x1f7e2f[_0x133c('0xff')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x4bd447,_0x5c4698,_0x4e9e21){var _0x1d9b06=0x0;var _0x5650ca=0x0;var _0x2a90f9=![];var _0x5128bb;var _0x22c4ea;return db[_0x133c('0x3c')]['find']({'where':{'id':_0x4bd447[_0x133c('0x5d')]['id']},'include':[{'model':db[_0x133c('0x106')],'as':'Interval','include':[{'model':db[_0x133c('0x106')],'as':_0x133c('0x107'),'attributes':['id',_0x133c('0xfe')],'raw':!![]}]}]})[_0x133c('0x1f')](handleEntityNotFound(_0x5c4698,null))[_0x133c('0x1f')](function(_0x13f0f3){if(_0x13f0f3){_0x5128bb=_0x13f0f3;return _0x13f0f3['getProactiveActions']({'raw':!![]});}})['then'](function(_0x3151d6){if(_0x5128bb){if(_0x3151d6){_0x22c4ea=_0x3151d6;}}return require(_0x133c('0x16'))[_0x133c('0x108')]();})[_0x133c('0x1f')](function(_0x30c385){if(_0x30c385){_0x5650ca=_0x30c385[_0x133c('0x109')];_0x2a90f9=_0x30c385[_0x133c('0x10a')];}})['then'](function(){return db[_0x133c('0xb2')][_0x133c('0x2e')]({'where':{'closed':![]}});})[_0x133c('0x1f')](function(_0x36910f){_0x1d9b06=_0x36910f;if(_0x5650ca&&_0x36910f>_0x5650ca){return db[_0x133c('0x10b')][_0x133c('0x63')]({'where':{'id':0x1}})['then'](function(_0x3d2a0a){if(_0x3d2a0a){_0x3d2a0a[_0x133c('0x10c')]('chatLicenseExceeded');}});}})['then'](function(){if(_0x5128bb['Interval']&&_0x5128bb[_0x133c('0x106')]['Intervals']){var _0x57ab19=[];for(var _0x401272=0x0;_0x401272<_0x5128bb[_0x133c('0x106')][_0x133c('0x107')][_0x133c('0x47')];_0x401272++){var _0x1d4f1d=_0x5128bb[_0x133c('0x106')][_0x133c('0x107')][_0x401272][_0x133c('0x56')]({'plain':!![]});_0x57ab19[_0x133c('0xb9')](iftimePromise(_0x1d4f1d,_0x5128bb));}return BPromise['all'](_0x57ab19)[_0x133c('0x1f')](function(_0x2f9873){return _['some'](_0x2f9873);});}else{return!![];}})[_0x133c('0x1f')](function(_0x23d2b3){var _0x16dd28=fs[_0x133c('0x10d')](path[_0x133c('0x76')](config['root'],'server/files/chat/iframe.ejs'),_0x133c('0xd0'));var _0x2b325e={'remote':_0x5128bb[_0x133c('0x10e')],'query':querystring[_0x133c('0xb0')](_['merge'](_0x5128bb[_0x133c('0x56')]({'plain':!![]}),{'customerIp':_0x4bd447['headers'][_0x133c('0xa2')]||_0x4bd447[_0x133c('0x85')][_0x133c('0x10f')]||_0x4bd447['connection'][_0x133c('0x110')]||_0x4bd447['ip'],'referer':_0x4bd447['headers'][_0x133c('0xa7')],'openedInteractions':_0x1d9b06,'maxInteractions':_0x5650ca,'virtual':_0x2a90f9['virtual'],'online':_0x23d2b3,'custom':_0x2a90f9}))[_0x133c('0x111')](/'/g,'\x5c\x27')};_0x5c4698[_0x133c('0x39')](ejs[_0x133c('0x112')](Mustache[_0x133c('0x112')](_0x16dd28,_0x2b325e),{'proactiveActions':_0x22c4ea,'alignment':_0x5128bb[_0x133c('0x113')],'verticalAlignment':_0x5128bb[_0x133c('0x114')],'div_color':_0x5128bb['color'],'text_color':_0x5128bb[_0x133c('0x115')],'button_color':_0x5128bb['color_button'],'background_color':_0x5128bb[_0x133c('0x116')]}));})[_0x133c('0x28')](handleError(_0x5c4698,null));};exports[_0x133c('0x117')]=function(_0x4a87f8,_0x59260c,_0x4bd593){return db[_0x133c('0x3c')][_0x133c('0x63')]({'where':{'id':_0x4a87f8['params']['id']}})['then'](handleEntityNotFound(_0x59260c,null))[_0x133c('0x1f')](function(_0x16da9){if(_0x16da9){return db[_0x133c('0xd8')][_0x133c('0x118')](function(_0x2bb935){return db[_0x133c('0x99')][_0x133c('0x34')]({'where':{'ChatWebsiteId':_0x4a87f8[_0x133c('0x5d')]['id']},'transaction':_0x2bb935})[_0x133c('0x1f')](function(_0x1ea18d){var _0x376659=_[_0x133c('0x3b')](_0x4a87f8[_0x133c('0x54')],function(_0x12148a){_0x12148a['ChatWebsiteId']=_0x4a87f8[_0x133c('0x5d')]['id'];return _0x12148a;});return db['ChatApplication']['bulkCreate'](_0x376659,{'transaction':_0x2bb935});});})[_0x133c('0x1f')](function(){return db[_0x133c('0x99')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x4a87f8[_0x133c('0x5d')]['id']},'order':_0x133c('0x9f')});});}})[_0x133c('0x1f')](respondWithResult(_0x59260c,null))[_0x133c('0x28')](handleError(_0x59260c,null));};exports[_0x133c('0x119')]=function(_0x23f5ae,_0x263b3f,_0x2856d4){var _0x42abb8={};var _0x4ee4a8={};var _0x486c27;var _0x30473b;return db[_0x133c('0x3c')]['findOne']({'where':{'id':_0x23f5ae[_0x133c('0x5d')]['id']}})[_0x133c('0x1f')](handleEntityNotFound(_0x263b3f,null))[_0x133c('0x1f')](function(_0x419de5){if(_0x419de5){_0x486c27=_0x419de5;_0x4ee4a8[_0x133c('0x40')]=_[_0x133c('0x42')](db[_0x133c('0x99')][_0x133c('0x3d')]);_0x4ee4a8[_0x133c('0x41')]=_[_0x133c('0x42')](_0x23f5ae[_0x133c('0x41')]);_0x4ee4a8[_0x133c('0x43')]=_['intersection'](_0x4ee4a8[_0x133c('0x40')],_0x4ee4a8[_0x133c('0x41')]);_0x42abb8[_0x133c('0x44')]=_['intersection'](_0x4ee4a8['model'],qs[_0x133c('0x46')](_0x23f5ae[_0x133c('0x41')][_0x133c('0x46')]));_0x42abb8[_0x133c('0x44')]=_0x42abb8[_0x133c('0x44')][_0x133c('0x47')]?_0x42abb8[_0x133c('0x44')]:_0x4ee4a8[_0x133c('0x40')];_0x42abb8[_0x133c('0x4a')]=qs[_0x133c('0x4b')](_0x23f5ae['query'][_0x133c('0x4b')]);_0x42abb8['where']=qs[_0x133c('0x43')](_[_0x133c('0x6b')](_0x23f5ae[_0x133c('0x41')],_0x4ee4a8[_0x133c('0x43')]));if(_0x23f5ae[_0x133c('0x41')][_0x133c('0x64')]){_0x42abb8[_0x133c('0x4c')]=_['merge'](_0x42abb8[_0x133c('0x4c')],{'$or':_[_0x133c('0x3b')](_0x42abb8[_0x133c('0x44')],function(_0x2b6568){var _0x406c7e={};_0x406c7e[_0x2b6568]={'$like':'%'+_0x23f5ae['query']['filter']+'%'};return _0x406c7e;})});}_0x42abb8=_[_0x133c('0x4d')]({},_0x42abb8,_0x23f5ae[_0x133c('0x4f')]);return _0x486c27[_0x133c('0x119')](_0x42abb8);}})[_0x133c('0x1f')](function(_0x39477b){if(_0x39477b){_0x30473b=_0x39477b[_0x133c('0x47')];if(!_0x23f5ae[_0x133c('0x41')]['hasOwnProperty'](_0x133c('0x49'))){_0x42abb8[_0x133c('0x2f')]=qs[_0x133c('0x2f')](_0x23f5ae[_0x133c('0x41')][_0x133c('0x2f')]);_0x42abb8['offset']=qs[_0x133c('0x2c')](_0x23f5ae[_0x133c('0x41')][_0x133c('0x2c')]);}return _0x486c27['getApplications'](_0x42abb8);}})[_0x133c('0x1f')](function(_0x3ded37){if(_0x3ded37){return _0x3ded37?{'count':_0x30473b,'rows':_0x3ded37}:null;}})[_0x133c('0x1f')](respondWithResult(_0x263b3f,null))[_0x133c('0x28')](handleError(_0x263b3f,null));};exports[_0x133c('0x11a')]=function(_0x149aa6,_0x24aea4,_0x223634){return db['chatProactiveAction'][_0x133c('0x5a')]({'where':{'id':_0x149aa6[_0x133c('0x5d')]['id']}})[_0x133c('0x1f')](handleEntityNotFound(_0x24aea4,null))[_0x133c('0x1f')](function(_0x7ee876){if(_0x7ee876){return _0x7ee876[_0x133c('0x11a')](_0x149aa6[_0x133c('0x54')][_0x133c('0x67')],_[_0x133c('0xf4')](_0x149aa6[_0x133c('0x54')],[_0x133c('0x67'),'id'])||{});}})[_0x133c('0x1f')](respondWithResult(_0x24aea4,null))[_0x133c('0x28')](handleError(_0x24aea4,null));};exports['getProactiveActions']=function(_0x515a7f,_0x4a054c,_0x31aa80){var _0x3e8b30={};var _0xd54ce7={};var _0x7a914a;var _0x349a5d;return db[_0x133c('0x3c')]['findOne']({'where':{'id':_0x515a7f['params']['id']}})[_0x133c('0x1f')](handleEntityNotFound(_0x4a054c,null))[_0x133c('0x1f')](function(_0x150df4){if(_0x150df4){_0x7a914a=_0x150df4;_0xd54ce7[_0x133c('0x40')]=_[_0x133c('0x42')](db[_0x133c('0x11b')][_0x133c('0x3d')]);_0xd54ce7[_0x133c('0x41')]=_[_0x133c('0x42')](_0x515a7f[_0x133c('0x41')]);_0xd54ce7[_0x133c('0x43')]=_[_0x133c('0x45')](_0xd54ce7[_0x133c('0x40')],_0xd54ce7['query']);_0x3e8b30[_0x133c('0x44')]=_['intersection'](_0xd54ce7[_0x133c('0x40')],qs[_0x133c('0x46')](_0x515a7f[_0x133c('0x41')]['fields']));_0x3e8b30[_0x133c('0x44')]=_0x3e8b30[_0x133c('0x44')][_0x133c('0x47')]?_0x3e8b30['attributes']:_0xd54ce7[_0x133c('0x40')];_0x3e8b30[_0x133c('0x4a')]=qs[_0x133c('0x4b')](_0x515a7f[_0x133c('0x41')][_0x133c('0x4b')]);_0x3e8b30[_0x133c('0x4c')]=qs[_0x133c('0x43')](_['pick'](_0x515a7f[_0x133c('0x41')],_0xd54ce7[_0x133c('0x43')]));if(_0x515a7f[_0x133c('0x41')][_0x133c('0x64')]){_0x3e8b30[_0x133c('0x4c')]=_[_0x133c('0x4d')](_0x3e8b30[_0x133c('0x4c')],{'$or':_[_0x133c('0x3b')](_0x3e8b30[_0x133c('0x44')],function(_0x1d1ff5){var _0x3d5abe={};_0x3d5abe[_0x1d1ff5]={'$like':'%'+_0x515a7f[_0x133c('0x41')][_0x133c('0x64')]+'%'};return _0x3d5abe;})});}_0x3e8b30=_[_0x133c('0x4d')]({},_0x3e8b30,_0x515a7f['options']);return _0x7a914a['getProactiveActions'](_0x3e8b30);}})[_0x133c('0x1f')](function(_0x157439){if(_0x157439){_0x349a5d=_0x157439['length'];if(!_0x515a7f[_0x133c('0x41')][_0x133c('0x48')](_0x133c('0x49'))){_0x3e8b30[_0x133c('0x2f')]=qs[_0x133c('0x2f')](_0x515a7f[_0x133c('0x41')][_0x133c('0x2f')]);_0x3e8b30['offset']=qs[_0x133c('0x2c')](_0x515a7f['query']['offset']);}return _0x7a914a[_0x133c('0x11c')](_0x3e8b30);}})['then'](function(_0x31e7af){if(_0x31e7af){return _0x31e7af?{'count':_0x349a5d,'rows':_0x31e7af}:null;}})[_0x133c('0x1f')](respondWithResult(_0x4a054c,null))[_0x133c('0x28')](handleError(_0x4a054c,null));};exports[_0x133c('0x11d')]=function(_0x43a1a3,_0x37356b,_0x32681a){var _0xbdc85c=_0x43a1a3[_0x133c('0x41')][_0x133c('0x11e')]===_0x133c('0x11f')?_0x133c('0x120'):_0x133c('0x121');return db['ChatWebsite'][_0x133c('0x5a')]({'attributes':['id',_0xbdc85c],'where':{'id':_0x43a1a3['params']['id']}})['then'](handleEntityNotFound(_0x37356b,null))['then'](function(_0x339554){if(_0x339554){var _0x16e974=_0x339554[_0xbdc85c];var _0x168732=_0x16e974&&_0x16e974[_0x133c('0x122')]?_0x16e974[_0x133c('0x122')]:[];_0x37356b[_0x133c('0x39')]({'fromKey':_['isNil'](_0x16e974[_0x133c('0x123')])?undefined:_0x16e974[_0x133c('0x123')],'count':_0x168732[_0x133c('0x47')],'rows':_0x168732});}})[_0x133c('0x28')](handleError(_0x37356b,null));};exports[_0x133c('0x124')]=function(_0x10451c,_0x3ecf44,_0x15de0b){var _0x5c0ca3={'raw':![],'where':{}};var _0x214e70={};var _0x57bf9e={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x133c('0x63')]({'where':{'id':_0x10451c[_0x133c('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3ecf44,null))['then'](function(_0x37b966){if(_0x37b966){_0x214e70[_0x133c('0x40')]=_[_0x133c('0x42')](db['ChatOfflineMessage'][_0x133c('0x3d')]);_0x214e70['query']=_[_0x133c('0x42')](_0x10451c[_0x133c('0x41')]);_0x214e70[_0x133c('0x43')]=_['intersection'](_0x214e70['model'],_0x214e70[_0x133c('0x41')]);_0x5c0ca3[_0x133c('0x44')]=_[_0x133c('0x45')](_0x214e70[_0x133c('0x40')],qs[_0x133c('0x46')](_0x10451c[_0x133c('0x41')][_0x133c('0x46')]));_0x5c0ca3['attributes']=_0x5c0ca3['attributes']['length']?_0x5c0ca3[_0x133c('0x44')]:_0x214e70['model'];if(!_0x10451c[_0x133c('0x41')][_0x133c('0x48')]('nolimit')){_0x5c0ca3[_0x133c('0x2f')]=qs['limit'](_0x10451c[_0x133c('0x41')][_0x133c('0x2f')]);_0x5c0ca3[_0x133c('0x2c')]=qs[_0x133c('0x2c')](_0x10451c[_0x133c('0x41')][_0x133c('0x2c')]);}_0x5c0ca3[_0x133c('0x4a')]=qs[_0x133c('0x4b')](_0x10451c[_0x133c('0x41')][_0x133c('0x4b')]);_0x5c0ca3['where']=qs[_0x133c('0x43')](_[_0x133c('0x6b')](_0x10451c[_0x133c('0x41')],_0x214e70['filters']));_0x5c0ca3['where'][_0x133c('0x69')]=_0x37b966['id'];if(_0x10451c[_0x133c('0x41')]['filter']){_0x5c0ca3[_0x133c('0x4c')]=_['merge'](_0x5c0ca3['where'],{'$or':_['map'](_0x5c0ca3[_0x133c('0x44')],function(_0x137d6b){var _0x2547a9={};_0x2547a9[_0x137d6b]={'$like':'%'+_0x10451c['query'][_0x133c('0x64')]+'%'};return _0x2547a9;})});}_0x5c0ca3=_[_0x133c('0x4d')]({},_0x5c0ca3,_0x10451c[_0x133c('0x4f')]);return db['ChatOfflineMessage'][_0x133c('0x2e')]({'where':_0x5c0ca3['where']})['then'](function(_0x3a8218){_0x57bf9e[_0x133c('0x2e')]=_0x3a8218;if(_0x10451c[_0x133c('0x41')][_0x133c('0x50')]){_0x5c0ca3[_0x133c('0x51')]=[{'all':!![]}];}else{_0x5c0ca3[_0x133c('0x51')]=[{'model':db['CmContact'],'as':_0x133c('0x125'),'required':![]},{'model':db['Attachment'],'as':_0x133c('0x126'),'required':![]}];}return db[_0x133c('0xd3')][_0x133c('0x65')](_0x5c0ca3);})['then'](function(_0x12b01c){_0x57bf9e[_0x133c('0xfb')]=_0x12b01c;return _0x57bf9e;});}})['then'](respondWithFilteredResult(_0x3ecf44,_0x5c0ca3))['catch'](handleError(_0x3ecf44,null));};exports[_0x133c('0x127')]=function(_0x3f1994,_0x4d6ecf,_0x5505bb){return db[_0x133c('0x3c')][_0x133c('0x5a')]({'where':{'id':_0x3f1994[_0x133c('0x5d')]['id']}})[_0x133c('0x1f')](handleEntityNotFound(_0x4d6ecf,null))[_0x133c('0x1f')](function(_0x58509d){if(_0x58509d){return _0x58509d[_0x133c('0x127')](_0x3f1994[_0x133c('0x54')]['ids'],_[_0x133c('0xf4')](_0x3f1994['body'],[_0x133c('0x67'),'id'])||{})['spread'](function(_0x1aa5fc){for(var _0x38dda1=0x0;_0x38dda1<_0x3f1994[_0x133c('0x54')][_0x133c('0x67')][_0x133c('0x47')];_0x38dda1+=0x1){socket[_0x133c('0x128')](_0x133c('0x129'),{'UserId':Number(_0x3f1994[_0x133c('0x54')][_0x133c('0x67')][_0x38dda1]),'ChatWebsiteId':Number(_0x3f1994[_0x133c('0x5d')]['id'])});}return _0x1aa5fc;});}})[_0x133c('0x1f')](respondWithResult(_0x4d6ecf,null))[_0x133c('0x28')](handleError(_0x4d6ecf,null));};exports[_0x133c('0x12a')]=function(_0x38201d,_0x2aeb38,_0x1fab33){return db[_0x133c('0x3c')]['find']({'where':{'id':_0x38201d[_0x133c('0x5d')]['id']}})[_0x133c('0x1f')](handleEntityNotFound(_0x2aeb38,null))[_0x133c('0x1f')](function(_0x592f75){if(_0x592f75){return _0x592f75[_0x133c('0x12a')](_0x38201d[_0x133c('0x41')][_0x133c('0x67')])[_0x133c('0x1f')](function(){if(_[_0x133c('0x12b')](_0x38201d[_0x133c('0x41')][_0x133c('0x67')])){for(var _0x507b95=0x0;_0x507b95<_0x38201d[_0x133c('0x41')][_0x133c('0x67')][_0x133c('0x47')];_0x507b95+=0x1){socket['emit'](_0x133c('0x12c'),{'UserId':Number(_0x38201d[_0x133c('0x41')][_0x133c('0x67')][_0x507b95]),'ChatWebsiteId':Number(_0x38201d[_0x133c('0x5d')]['id'])});}}else{socket[_0x133c('0x128')](_0x133c('0x12c'),{'UserId':Number(_0x38201d[_0x133c('0x41')]['ids']),'ChatWebsiteId':Number(_0x38201d['params']['id'])});}});}})[_0x133c('0x1f')](respondWithStatusCode(_0x2aeb38,null))['catch'](handleError(_0x2aeb38,null));};exports[_0x133c('0x12d')]=function(_0x2eaa19,_0x12b8e2,_0x176d77){var _0xb023e6={};var _0x15ea06={};var _0x23ef06;var _0x531775;return db[_0x133c('0x3c')]['findOne']({'where':{'id':_0x2eaa19['params']['id']}})[_0x133c('0x1f')](handleEntityNotFound(_0x12b8e2,null))[_0x133c('0x1f')](function(_0x292cc0){if(_0x292cc0){_0x23ef06=_0x292cc0;_0x15ea06[_0x133c('0x40')]=_['keys'](db['User']['rawAttributes']);_0x15ea06[_0x133c('0x41')]=_[_0x133c('0x42')](_0x2eaa19[_0x133c('0x41')]);_0x15ea06[_0x133c('0x43')]=_['intersection'](_0x15ea06[_0x133c('0x40')],_0x15ea06[_0x133c('0x41')]);_0xb023e6['attributes']=_[_0x133c('0x45')](_0x15ea06[_0x133c('0x40')],qs[_0x133c('0x46')](_0x2eaa19[_0x133c('0x41')][_0x133c('0x46')]));_0xb023e6[_0x133c('0x44')]=_0xb023e6[_0x133c('0x44')][_0x133c('0x47')]?_0xb023e6[_0x133c('0x44')]:_0x15ea06[_0x133c('0x40')];_0xb023e6[_0x133c('0x4a')]=qs[_0x133c('0x4b')](_0x2eaa19[_0x133c('0x41')][_0x133c('0x4b')]);_0xb023e6[_0x133c('0x4c')]=qs[_0x133c('0x43')](_['pick'](_0x2eaa19[_0x133c('0x41')],_0x15ea06['filters']));if(_0x2eaa19[_0x133c('0x41')][_0x133c('0x64')]){_0xb023e6[_0x133c('0x4c')]=_[_0x133c('0x4d')](_0xb023e6[_0x133c('0x4c')],{'$or':_['map'](_0xb023e6[_0x133c('0x44')],function(_0x1a08ad){var _0x3b757d={};_0x3b757d[_0x1a08ad]={'$like':'%'+_0x2eaa19[_0x133c('0x41')][_0x133c('0x64')]+'%'};return _0x3b757d;})});}_0xb023e6=_[_0x133c('0x4d')]({},_0xb023e6,_0x2eaa19[_0x133c('0x4f')]);return _0x23ef06[_0x133c('0x12d')](_0xb023e6);}})[_0x133c('0x1f')](function(_0x515a09){if(_0x515a09){_0x531775=_0x515a09['length'];if(!_0x2eaa19[_0x133c('0x41')][_0x133c('0x48')](_0x133c('0x49'))){_0xb023e6[_0x133c('0x2f')]=qs['limit'](_0x2eaa19['query'][_0x133c('0x2f')]);_0xb023e6[_0x133c('0x2c')]=qs[_0x133c('0x2c')](_0x2eaa19[_0x133c('0x41')][_0x133c('0x2c')]);}return _0x23ef06[_0x133c('0x12d')](_0xb023e6);}})[_0x133c('0x1f')](function(_0x4dc909){if(_0x4dc909){return _0x4dc909?{'count':_0x531775,'rows':_0x4dc909}:null;}})[_0x133c('0x1f')](respondWithResult(_0x12b8e2,null))[_0x133c('0x28')](handleError(_0x12b8e2,null));}; \ No newline at end of file +var _0x1611=['user-agent-parser','setUA','headers','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','CmList','CmContact','Contacts','ChatApplication','Applications','List','account','list','applications','orderBy','ListId','contact','customerIp','cf-connecting-ip','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','EventManager','offline','files','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','server/files/templates/chatOfflineMessage.ejs','render','ChatOfflineMessage','originalname','mimetype','server','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','MailAccountId','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','fullname','internal','Tag','Tags','tag','Command','getSnippet','timezone','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','getProactiveActions','License','increment','chatLicenseExceeded','all','some','readFileSync','server/files/chat/iframe.ejs','utf8','remote','x-real-ip','connection','virtual','alignment','color','textColor','color_button','backgroundColor','addApplications','transaction','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','offlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','userChatWebsite:remove','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','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','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','status','end','undefined','limit','count','offset','set','reject','save','update','get','ChatWebsites','UserProfileResource','destroy','sendStatus','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','params','ChatWebsiteId','Disposition','getDispositions','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addLogo','sitepic','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','root','agentAvatar','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify'];(function(_0x8dd419,_0x58acff){var _0x4fadf8=function(_0x47a697){while(--_0x47a697){_0x8dd419['push'](_0x8dd419['shift']());}};_0x4fadf8(++_0x58acff);}(_0x1611,0x9f));var _0x1161=function(_0x1974fc,_0x4385c7){_0x1974fc=_0x1974fc-0x0;var _0x459191=_0x1611[_0x1974fc];return _0x459191;};'use strict';var emlformat=require(_0x1161('0x0'));var rimraf=require(_0x1161('0x1'));var zipdir=require(_0x1161('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1161('0x3'));var moment=require(_0x1161('0x4'));var BPromise=require(_0x1161('0x5'));var Mustache=require(_0x1161('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1161('0x7'));var csv=require(_0x1161('0x8'));var ejs=require(_0x1161('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1161('0xa'));var squel=require('squel');var crypto=require(_0x1161('0xb'));var jsforce=require(_0x1161('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1161('0xd'));var Redis=require(_0x1161('0xe'));var authService=require(_0x1161('0xf'));var qs=require(_0x1161('0x10'));var as=require(_0x1161('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1161('0x12'))(_0x1161('0x13'));var utils=require(_0x1161('0x14'));var config=require(_0x1161('0x15'));var licenseUtil=require(_0x1161('0x16'));var db=require(_0x1161('0x17'))['db'];config[_0x1161('0x18')]=_[_0x1161('0x19')](config[_0x1161('0x18')],{'host':_0x1161('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1161('0x18')]));require(_0x1161('0x1b'))[_0x1161('0x1c')](socket);var jayson=require(_0x1161('0x1d'));var client=jayson[_0x1161('0x1e')][_0x1161('0x1f')]({'port':0x232c});var client9002=jayson[_0x1161('0x1e')][_0x1161('0x1f')]({'port':0x232a});var client9003=jayson['client']['http']({'port':0x232b});var client9001=jayson[_0x1161('0x1e')][_0x1161('0x1f')]({'port':0x2329});function respondWithRpcPromise(_0x2fb0b9,_0x4690bd,_0x16b2cb,_0x4bfc13){return new BPromise(function(_0x4921b9,_0x573719){var _0xf615e0=_0x4bfc13||client;return _0xf615e0[_0x1161('0x20')](_0x2fb0b9,_0x16b2cb)[_0x1161('0x21')](function(_0x1a7ad1){logger[_0x1161('0x22')]('ChatWebsite,\x20%s,\x20%s',_0x4690bd,_0x1161('0x23'));logger['debug'](_0x1161('0x24'),_0x4690bd,_0x1161('0x23'),JSON['stringify'](_0x1a7ad1));if(_0x1a7ad1['error']){if(_0x1a7ad1[_0x1161('0x25')][_0x1161('0x26')]===0x1f4){logger['error'](_0x1161('0x27'),_0x4690bd,_0x1a7ad1[_0x1161('0x25')]['message']);return _0x573719(_0x1a7ad1[_0x1161('0x25')]['message']);}logger[_0x1161('0x25')]('ChatWebsite,\x20%s,\x20%s',_0x4690bd,_0x1a7ad1[_0x1161('0x25')][_0x1161('0x28')]);return _0x4921b9(_0x1a7ad1['error'][_0x1161('0x28')]);}else{logger[_0x1161('0x22')](_0x1161('0x27'),_0x4690bd,_0x1161('0x23'));_0x4921b9(_0x1a7ad1[_0x1161('0x29')][_0x1161('0x28')]);}})[_0x1161('0x2a')](function(_0x1ef5ce){logger[_0x1161('0x25')](_0x1161('0x27'),_0x4690bd,_0x1ef5ce);_0x573719(_0x1ef5ce);});});}function respondWithStatusCode(_0xf472c3,_0x49dc96){_0x49dc96=_0x49dc96||0xcc;return function(_0x18b2a4){if(_0x18b2a4){return _0xf472c3['sendStatus'](_0x49dc96);}return _0xf472c3[_0x1161('0x2b')](_0x49dc96)[_0x1161('0x2c')]();};}function respondWithResult(_0x1bccb5,_0x43b07a){_0x43b07a=_0x43b07a||0xc8;return function(_0x295e0f){if(_0x295e0f){return _0x1bccb5[_0x1161('0x2b')](_0x43b07a)['json'](_0x295e0f);}};}function respondWithFilteredResult(_0x3da145,_0x1de5b9){return function(_0x56c88c){if(_0x56c88c){var _0x76dc23=typeof _0x1de5b9['offset']===_0x1161('0x2d')&&typeof _0x1de5b9[_0x1161('0x2e')]===_0x1161('0x2d');var _0x1620e9=_0x56c88c[_0x1161('0x2f')];var _0x13a14c=_0x76dc23?0x0:_0x1de5b9[_0x1161('0x30')];var _0x19beaa=_0x76dc23?_0x56c88c['count']:_0x1de5b9[_0x1161('0x30')]+_0x1de5b9[_0x1161('0x2e')];var _0x663866;if(_0x19beaa>=_0x1620e9){_0x19beaa=_0x1620e9;_0x663866=0xc8;}else{_0x663866=0xce;}_0x3da145[_0x1161('0x2b')](_0x663866);return _0x3da145[_0x1161('0x31')]('Content-Range',_0x13a14c+'-'+_0x19beaa+'/'+_0x1620e9)['json'](_0x56c88c);}return null;};}function patchUpdates(_0x246dbd){return function(_0x547ce6){try{jsonpatch['apply'](_0x547ce6,_0x246dbd,!![]);}catch(_0x127691){return BPromise[_0x1161('0x32')](_0x127691);}return _0x547ce6[_0x1161('0x33')]();};}function saveUpdates(_0x4f1e2c,_0x3c76cc){return function(_0x53a0b0){if(_0x53a0b0){return _0x53a0b0[_0x1161('0x34')](_0x4f1e2c)[_0x1161('0x21')](function(_0x463c09){return _0x463c09;});}return null;};}function removeEntity(_0x30f78b,_0x1ea8d3){return function(_0x2df1c9){if(_0x2df1c9){return _0x2df1c9['destroy']()[_0x1161('0x21')](function(){var _0x1b66f1=_0x2df1c9[_0x1161('0x35')]({'plain':!![]});var _0x637aeb=_0x1161('0x36');return db[_0x1161('0x37')][_0x1161('0x38')]({'where':{'type':_0x637aeb,'resourceId':_0x1b66f1['id']}})[_0x1161('0x21')](function(){return _0x2df1c9;});})[_0x1161('0x21')](function(){_0x30f78b['status'](0xcc)[_0x1161('0x2c')]();});}};}function handleEntityNotFound(_0x34c3e1,_0x224d6f){return function(_0x1df220){if(!_0x1df220){_0x34c3e1[_0x1161('0x39')](0x194);}return _0x1df220;};}function handleError(_0x474f95,_0x99d548){_0x99d548=_0x99d548||0x1f4;return function(_0xdd8d1){logger[_0x1161('0x25')](_0xdd8d1['stack']);if(_0xdd8d1[_0x1161('0x3a')]){delete _0xdd8d1[_0x1161('0x3a')];}_0x474f95[_0x1161('0x2b')](_0x99d548)['send'](_0xdd8d1);};}exports[_0x1161('0x3b')]=function(_0x38800c,_0x15cc3a){var _0x30c109={'include':[{'model':db[_0x1161('0x3c')],'as':_0x1161('0x3d')}]},_0x281ff5={},_0x1dcfc4={'count':0x0,'rows':[]};var _0x2ff72e=_[_0x1161('0x3e')](db[_0x1161('0x3f')]['rawAttributes'],function(_0x59212d){return{'name':_0x59212d[_0x1161('0x40')],'type':_0x59212d[_0x1161('0x41')]['key']};});_0x281ff5[_0x1161('0x42')]=_[_0x1161('0x3e')](_0x2ff72e,'name');_0x281ff5[_0x1161('0x43')]=_[_0x1161('0x44')](_0x38800c[_0x1161('0x43')]);_0x281ff5[_0x1161('0x45')]=_[_0x1161('0x46')](_0x281ff5['model'],_0x281ff5['query']);_0x30c109['attributes']=_[_0x1161('0x46')](_0x281ff5[_0x1161('0x42')],qs[_0x1161('0x47')](_0x38800c[_0x1161('0x43')][_0x1161('0x47')]));_0x30c109[_0x1161('0x48')]=_0x30c109[_0x1161('0x48')][_0x1161('0x49')]?_0x30c109[_0x1161('0x48')]:_0x281ff5[_0x1161('0x42')];if(!_0x38800c[_0x1161('0x43')][_0x1161('0x4a')]('nolimit')){_0x30c109[_0x1161('0x2e')]=qs['limit'](_0x38800c[_0x1161('0x43')][_0x1161('0x2e')]);_0x30c109['offset']=qs[_0x1161('0x30')](_0x38800c['query'][_0x1161('0x30')]);}_0x30c109[_0x1161('0x4b')]=qs[_0x1161('0x4c')](_0x38800c[_0x1161('0x43')][_0x1161('0x4c')]);_0x30c109[_0x1161('0x4d')]=qs[_0x1161('0x45')](_[_0x1161('0x4e')](_0x38800c[_0x1161('0x43')],_0x281ff5[_0x1161('0x45')]),_0x2ff72e);if(_0x38800c['query'][_0x1161('0x4f')]){_0x30c109['where']=_['merge'](_0x30c109[_0x1161('0x4d')],{'$or':_[_0x1161('0x3e')](_0x2ff72e,function(_0xc3d49a){if(_0xc3d49a[_0x1161('0x41')]!=='VIRTUAL'){var _0x4eb7f9={};_0x4eb7f9[_0xc3d49a[_0x1161('0x3a')]]={'$like':'%'+_0x38800c[_0x1161('0x43')][_0x1161('0x4f')]+'%'};return _0x4eb7f9;}})});}_0x30c109=_[_0x1161('0x50')]({},_0x30c109,_0x38800c[_0x1161('0x51')]);var _0x3b00ce={'where':_0x30c109[_0x1161('0x4d')]};return db[_0x1161('0x3f')]['count'](_0x3b00ce)[_0x1161('0x21')](function(_0x41da39){_0x1dcfc4[_0x1161('0x2f')]=_0x41da39;if(_0x38800c[_0x1161('0x43')][_0x1161('0x52')]){_0x30c109[_0x1161('0x53')]=[{'all':!![]}];}return db[_0x1161('0x3f')][_0x1161('0x54')](_0x30c109);})[_0x1161('0x21')](function(_0x22bee6){_0x1dcfc4[_0x1161('0x55')]=_0x22bee6;return _0x1dcfc4;})['then'](respondWithFilteredResult(_0x15cc3a,_0x30c109))[_0x1161('0x2a')](handleError(_0x15cc3a,null));};exports['show']=function(_0x4cac80,_0x2f1f22){var _0x2680c1={'raw':![],'where':{'id':_0x4cac80['params']['id']},'include':[{'model':db[_0x1161('0x3c')],'as':_0x1161('0x3d')}]},_0x298d79={};_0x298d79[_0x1161('0x42')]=_[_0x1161('0x44')](db[_0x1161('0x3f')][_0x1161('0x56')]);_0x298d79[_0x1161('0x43')]=_[_0x1161('0x44')](_0x4cac80[_0x1161('0x43')]);_0x298d79[_0x1161('0x45')]=_[_0x1161('0x46')](_0x298d79[_0x1161('0x42')],_0x298d79[_0x1161('0x43')]);_0x2680c1[_0x1161('0x48')]=_[_0x1161('0x46')](_0x298d79[_0x1161('0x42')],qs[_0x1161('0x47')](_0x4cac80[_0x1161('0x43')]['fields']));_0x2680c1['attributes']=_0x2680c1[_0x1161('0x48')][_0x1161('0x49')]?_0x2680c1[_0x1161('0x48')]:_0x298d79[_0x1161('0x42')];if(_0x4cac80['query'][_0x1161('0x52')]){_0x2680c1[_0x1161('0x53')]=[{'all':!![]}];}_0x2680c1=_[_0x1161('0x50')]({},_0x2680c1,_0x4cac80[_0x1161('0x51')]);return db[_0x1161('0x3f')][_0x1161('0x57')](_0x2680c1)['then'](handleEntityNotFound(_0x2f1f22,null))[_0x1161('0x21')](respondWithResult(_0x2f1f22,null))[_0x1161('0x2a')](handleError(_0x2f1f22,null));};exports[_0x1161('0x58')]=function(_0xfa38b1,_0x3bc23f){return db[_0x1161('0x3f')][_0x1161('0x58')](_0xfa38b1['body'],{})['then'](function(_0x1ba309){var _0x3b8d3c=_0xfa38b1[_0x1161('0x59')][_0x1161('0x35')]({'plain':!![]});if(!_0x3b8d3c)throw new Error(_0x1161('0x5a'));if(_0x3b8d3c[_0x1161('0x5b')]===_0x1161('0x59')){var _0x1ac785=_0x1ba309[_0x1161('0x35')]({'plain':!![]});var _0x36236f='ChatWebsites';return db['UserProfileSection'][_0x1161('0x57')]({'where':{'name':_0x36236f,'userProfileId':_0x3b8d3c['userProfileId']},'raw':!![]})[_0x1161('0x21')](function(_0x27b69c){if(_0x27b69c&&_0x27b69c[_0x1161('0x5c')]===0x0){return db[_0x1161('0x37')][_0x1161('0x58')]({'name':_0x1ac785['name'],'resourceId':_0x1ac785['id'],'type':_0x27b69c['name'],'sectionId':_0x27b69c['id']},{})[_0x1161('0x21')](function(){return _0x1ba309;});}else{return _0x1ba309;}})[_0x1161('0x2a')](function(_0xa1a5c9){logger[_0x1161('0x25')](_0x1161('0x5d'),_0xa1a5c9);throw _0xa1a5c9;});}return _0x1ba309;})[_0x1161('0x21')](respondWithResult(_0x3bc23f,0xc9))[_0x1161('0x2a')](handleError(_0x3bc23f,null));};exports['update']=function(_0x29e8f4,_0x21bc47){if(_0x29e8f4[_0x1161('0x5e')]['id']){delete _0x29e8f4['body']['id'];}return db[_0x1161('0x3f')][_0x1161('0x57')]({'where':{'id':_0x29e8f4['params']['id']},'include':[{'model':db[_0x1161('0x3c')],'as':_0x1161('0x3d')}]})[_0x1161('0x21')](handleEntityNotFound(_0x21bc47,null))['then'](saveUpdates(_0x29e8f4['body'],null))[_0x1161('0x21')](respondWithResult(_0x21bc47,null))['catch'](handleError(_0x21bc47,null));};exports[_0x1161('0x38')]=function(_0x2c97b9,_0x243b7f){return db['ChatWebsite'][_0x1161('0x57')]({'where':{'id':_0x2c97b9['params']['id']}})['then'](handleEntityNotFound(_0x243b7f,null))[_0x1161('0x21')](removeEntity(_0x243b7f,null))['catch'](handleError(_0x243b7f,null));};exports[_0x1161('0x5f')]=function(_0x2c4a11,_0x42132f){return db[_0x1161('0x3f')][_0x1161('0x5f')]()['then'](respondWithResult(_0x42132f,null))['catch'](handleError(_0x42132f,null));};exports[_0x1161('0x60')]=function(_0x11a256,_0x808c6b,_0x4be95d){if(_0x11a256['body']['id']){delete _0x11a256['body']['id'];}return db[_0x1161('0x3f')]['find']({'where':{'id':_0x11a256[_0x1161('0x61')]['id']}})[_0x1161('0x21')](handleEntityNotFound(_0x808c6b,null))[_0x1161('0x21')](function(_0x280033){if(_0x280033){_0x11a256[_0x1161('0x5e')][_0x1161('0x62')]=_0x280033['id'];return db[_0x1161('0x63')][_0x1161('0x58')](_0x11a256['body']);}})[_0x1161('0x21')](respondWithResult(_0x808c6b,null))[_0x1161('0x2a')](handleError(_0x808c6b,null));};exports[_0x1161('0x64')]=function(_0x19f6f0,_0x340973,_0x302e70){var _0x4b2a82={'raw':![],'where':{}};var _0x4e3743={};var _0x34d16c={'count':0x0,'rows':[]};return db[_0x1161('0x3f')]['findOne']({'where':{'id':_0x19f6f0['params']['id']}})['then'](handleEntityNotFound(_0x340973,null))['then'](function(_0x57df5d){if(_0x57df5d){_0x4e3743[_0x1161('0x42')]=_['keys'](db[_0x1161('0x63')][_0x1161('0x56')]);_0x4e3743[_0x1161('0x43')]=_['keys'](_0x19f6f0[_0x1161('0x43')]);_0x4e3743[_0x1161('0x45')]=_[_0x1161('0x46')](_0x4e3743[_0x1161('0x42')],_0x4e3743[_0x1161('0x43')]);_0x4b2a82[_0x1161('0x48')]=_['intersection'](_0x4e3743[_0x1161('0x42')],qs[_0x1161('0x47')](_0x19f6f0[_0x1161('0x43')]['fields']));_0x4b2a82['attributes']=_0x4b2a82[_0x1161('0x48')]['length']?_0x4b2a82['attributes']:_0x4e3743[_0x1161('0x42')];if(!_0x19f6f0[_0x1161('0x43')][_0x1161('0x4a')](_0x1161('0x65'))){_0x4b2a82[_0x1161('0x2e')]=qs[_0x1161('0x2e')](_0x19f6f0['query'][_0x1161('0x2e')]);_0x4b2a82[_0x1161('0x30')]=qs[_0x1161('0x30')](_0x19f6f0[_0x1161('0x43')]['offset']);}_0x4b2a82['order']=qs[_0x1161('0x4c')](_0x19f6f0[_0x1161('0x43')][_0x1161('0x4c')]);_0x4b2a82['where']=qs[_0x1161('0x45')](_[_0x1161('0x4e')](_0x19f6f0['query'],_0x4e3743[_0x1161('0x45')]));_0x4b2a82[_0x1161('0x4d')][_0x1161('0x62')]=_0x57df5d['id'];if(_0x19f6f0[_0x1161('0x43')][_0x1161('0x4f')]){_0x4b2a82[_0x1161('0x4d')]=_['merge'](_0x4b2a82['where'],{'$or':_['map'](_0x4b2a82[_0x1161('0x48')],function(_0x10a8ad){var _0x318086={};_0x318086[_0x10a8ad]={'$like':'%'+_0x19f6f0[_0x1161('0x43')][_0x1161('0x4f')]+'%'};return _0x318086;})});}_0x4b2a82=_['merge']({},_0x4b2a82,_0x19f6f0['options']);return db[_0x1161('0x63')][_0x1161('0x2f')]({'where':_0x4b2a82[_0x1161('0x4d')]})[_0x1161('0x21')](function(_0x1ecb94){_0x34d16c[_0x1161('0x2f')]=_0x1ecb94;if(_0x19f6f0['query'][_0x1161('0x52')]){_0x4b2a82['include']=[{'all':!![]}];}return db[_0x1161('0x63')][_0x1161('0x54')](_0x4b2a82);})[_0x1161('0x21')](function(_0x3a88e4){_0x34d16c[_0x1161('0x55')]=_0x3a88e4;return _0x34d16c;});}})[_0x1161('0x21')](respondWithFilteredResult(_0x340973,_0x4b2a82))[_0x1161('0x2a')](handleError(_0x340973,null));};exports[_0x1161('0x66')]=function(_0x410e4a,_0x27b2e6,_0x5aa469){return db[_0x1161('0x3f')][_0x1161('0x57')]({'where':{'id':_0x410e4a[_0x1161('0x61')]['id']}})[_0x1161('0x21')](handleEntityNotFound(_0x27b2e6,null))[_0x1161('0x21')](function(_0x20ff3b){if(_0x20ff3b){return _0x20ff3b[_0x1161('0x66')](_0x410e4a[_0x1161('0x43')][_0x1161('0x67')]);}})[_0x1161('0x21')](respondWithStatusCode(_0x27b2e6,null))[_0x1161('0x2a')](handleError(_0x27b2e6,null));};exports[_0x1161('0x68')]=function(_0x217209,_0x5c63a9,_0x269314){if(_0x217209[_0x1161('0x5e')]['id']){delete _0x217209[_0x1161('0x5e')]['id'];}return db[_0x1161('0x3f')][_0x1161('0x57')]({'where':{'id':_0x217209[_0x1161('0x61')]['id']}})[_0x1161('0x21')](handleEntityNotFound(_0x5c63a9,null))[_0x1161('0x21')](function(_0x5ae589){if(_0x5ae589){_0x217209[_0x1161('0x5e')][_0x1161('0x62')]=_0x5ae589['id'];return db[_0x1161('0x69')][_0x1161('0x58')](_0x217209[_0x1161('0x5e')]);}})[_0x1161('0x21')](respondWithResult(_0x5c63a9,null))[_0x1161('0x2a')](handleError(_0x5c63a9,null));};exports['getAnswers']=function(_0x8abe55,_0x4465c4,_0x16d6ed){var _0x1c4cef={'raw':![],'where':{}};var _0x64b9cc={};var _0x1a924e={'count':0x0,'rows':[]};return db[_0x1161('0x3f')][_0x1161('0x6a')]({'where':{'id':_0x8abe55[_0x1161('0x61')]['id']}})['then'](handleEntityNotFound(_0x4465c4,null))[_0x1161('0x21')](function(_0x5acd12){if(_0x5acd12){_0x64b9cc[_0x1161('0x42')]=_[_0x1161('0x44')](db[_0x1161('0x69')][_0x1161('0x56')]);_0x64b9cc[_0x1161('0x43')]=_[_0x1161('0x44')](_0x8abe55[_0x1161('0x43')]);_0x64b9cc[_0x1161('0x45')]=_[_0x1161('0x46')](_0x64b9cc[_0x1161('0x42')],_0x64b9cc[_0x1161('0x43')]);_0x1c4cef['attributes']=_[_0x1161('0x46')](_0x64b9cc[_0x1161('0x42')],qs[_0x1161('0x47')](_0x8abe55[_0x1161('0x43')][_0x1161('0x47')]));_0x1c4cef[_0x1161('0x48')]=_0x1c4cef[_0x1161('0x48')][_0x1161('0x49')]?_0x1c4cef['attributes']:_0x64b9cc['model'];if(!_0x8abe55[_0x1161('0x43')][_0x1161('0x4a')]('nolimit')){_0x1c4cef[_0x1161('0x2e')]=qs[_0x1161('0x2e')](_0x8abe55['query'][_0x1161('0x2e')]);_0x1c4cef[_0x1161('0x30')]=qs['offset'](_0x8abe55[_0x1161('0x43')][_0x1161('0x30')]);}_0x1c4cef[_0x1161('0x4b')]=qs[_0x1161('0x4c')](_0x8abe55[_0x1161('0x43')][_0x1161('0x4c')]);_0x1c4cef[_0x1161('0x4d')]=qs['filters'](_[_0x1161('0x4e')](_0x8abe55[_0x1161('0x43')],_0x64b9cc[_0x1161('0x45')]));_0x1c4cef[_0x1161('0x4d')]['ChatWebsiteId']=_0x5acd12['id'];if(_0x8abe55['query'][_0x1161('0x4f')]){_0x1c4cef[_0x1161('0x4d')]=_[_0x1161('0x50')](_0x1c4cef[_0x1161('0x4d')],{'$or':_[_0x1161('0x3e')](_0x1c4cef['attributes'],function(_0x1769a3){var _0x5a709d={};_0x5a709d[_0x1769a3]={'$like':'%'+_0x8abe55[_0x1161('0x43')]['filter']+'%'};return _0x5a709d;})});}_0x1c4cef=_[_0x1161('0x50')]({},_0x1c4cef,_0x8abe55[_0x1161('0x51')]);return db[_0x1161('0x69')]['count']({'where':_0x1c4cef[_0x1161('0x4d')]})['then'](function(_0x4194ca){_0x1a924e[_0x1161('0x2f')]=_0x4194ca;if(_0x8abe55[_0x1161('0x43')][_0x1161('0x52')]){_0x1c4cef['include']=[{'all':!![]}];}return db[_0x1161('0x69')][_0x1161('0x54')](_0x1c4cef);})[_0x1161('0x21')](function(_0x51a5a9){_0x1a924e[_0x1161('0x55')]=_0x51a5a9;return _0x1a924e;});}})[_0x1161('0x21')](respondWithFilteredResult(_0x4465c4,_0x1c4cef))[_0x1161('0x2a')](handleError(_0x4465c4,null));};exports[_0x1161('0x6b')]=function(_0x2aefd1,_0x4bbd7b,_0x281cab){return db[_0x1161('0x3f')]['find']({'where':{'id':_0x2aefd1[_0x1161('0x61')]['id']}})[_0x1161('0x21')](handleEntityNotFound(_0x4bbd7b,null))[_0x1161('0x21')](function(_0x41782e){if(_0x41782e){return _0x41782e[_0x1161('0x6b')](_0x2aefd1[_0x1161('0x43')][_0x1161('0x67')]);}})[_0x1161('0x21')](respondWithStatusCode(_0x4bbd7b,null))[_0x1161('0x2a')](handleError(_0x4bbd7b,null));};exports[_0x1161('0x6c')]=function(_0x36a883,_0x313492,_0x4d6085){_0x36a883[_0x1161('0x5e')][_0x1161('0x6d')]=_0x36a883['file']['filename'];return db[_0x1161('0x3f')]['find']({'where':{'id':_0x36a883['params']['id']}})[_0x1161('0x21')](handleEntityNotFound(_0x313492,null))[_0x1161('0x21')](saveUpdates(_0x36a883['body'],null))[_0x1161('0x21')](respondWithResult(_0x313492,null))[_0x1161('0x2a')](handleError(_0x313492,null));};exports['addAvatar']=function(_0x8b9a14,_0x3e5962,_0x24a1a2){_0x8b9a14['body']['agentAvatar']=_0x8b9a14[_0x1161('0x6e')][_0x1161('0x6f')];return db[_0x1161('0x3f')][_0x1161('0x57')]({'where':{'id':_0x8b9a14[_0x1161('0x61')]['id']}})[_0x1161('0x21')](handleEntityNotFound(_0x3e5962,null))[_0x1161('0x21')](saveUpdates(_0x8b9a14[_0x1161('0x5e')],null))[_0x1161('0x21')](respondWithResult(_0x3e5962,null))[_0x1161('0x2a')](handleError(_0x3e5962,null));};exports[_0x1161('0x70')]=function(_0x4de842,_0x1e6bf6,_0x13ce51){_0x4de842[_0x1161('0x5e')][_0x1161('0x71')]=_0x4de842[_0x1161('0x6e')][_0x1161('0x6f')];return db[_0x1161('0x3f')][_0x1161('0x57')]({'where':{'id':_0x4de842['params']['id']}})[_0x1161('0x21')](handleEntityNotFound(_0x1e6bf6,null))['then'](saveUpdates(_0x4de842[_0x1161('0x5e')],null))['then'](respondWithResult(_0x1e6bf6,null))[_0x1161('0x2a')](handleError(_0x1e6bf6,null));};exports[_0x1161('0x72')]=function(_0x5dbeab,_0x553cf2,_0x4fc8e7){_0x5dbeab[_0x1161('0x5e')][_0x1161('0x73')]=_0x5dbeab[_0x1161('0x6e')][_0x1161('0x6f')];return db['ChatWebsite'][_0x1161('0x57')]({'where':{'id':_0x5dbeab['params']['id']}})['then'](handleEntityNotFound(_0x553cf2,null))[_0x1161('0x21')](saveUpdates(_0x5dbeab['body'],null))[_0x1161('0x21')](respondWithResult(_0x553cf2,null))[_0x1161('0x2a')](handleError(_0x553cf2,null));};exports['getLogo']=function(_0x538233,_0x6deb6b,_0x4633a1){var _0x7ed69a=path[_0x1161('0x74')](config['root'],_0x1161('0x75'));var _0x499a68={'where':{'id':_0x538233['params']['id']},'attributes':['id',_0x1161('0x6d')],'raw':!![]};var _0x520db0=![];return require(_0x1161('0x16'))[_0x1161('0x76')]()[_0x1161('0x21')](function(_0x4d5e80){if(_0x4d5e80){_0x520db0=_0x4d5e80[_0x1161('0x77')];}})[_0x1161('0x21')](function(){return db[_0x1161('0x3f')]['find'](_0x499a68);})['then'](handleEntityNotFound(_0x6deb6b,null))[_0x1161('0x21')](function(_0x14a2d6){if(_0x14a2d6){if(!_[_0x1161('0x78')](_0x14a2d6[_0x1161('0x6d')])){if(fs[_0x1161('0x79')](path[_0x1161('0x74')](config['root'],_0x1161('0x7a'),_0x14a2d6[_0x1161('0x6d')]))&&_0x520db0){_0x7ed69a=path[_0x1161('0x74')](config['root'],_0x1161('0x7a'),_0x14a2d6[_0x1161('0x6d')]);}}return _0x6deb6b[_0x1161('0x7b')](_0x7ed69a);}})[_0x1161('0x2a')](handleError(_0x6deb6b,null));};exports[_0x1161('0x7c')]=function(_0x98b415,_0x19cea4,_0x3a6172){var _0xe7ea98=path['join'](config[_0x1161('0x7d')],'server/files/images/avatars/default_avatar.png');var _0x437573={'where':{'id':_0x98b415[_0x1161('0x61')]['id']},'attributes':['id',_0x1161('0x7e')],'raw':!![]};return db[_0x1161('0x3f')][_0x1161('0x57')](_0x437573)[_0x1161('0x21')](handleEntityNotFound(_0x19cea4,null))[_0x1161('0x21')](function(_0x35b58d){if(_0x35b58d){if(!_[_0x1161('0x78')](_0x35b58d[_0x1161('0x7e')])){if(fs['existsSync'](path[_0x1161('0x74')](config[_0x1161('0x7d')],_0x1161('0x7f'),_0x35b58d[_0x1161('0x7e')]))){_0xe7ea98=path['join'](config['root'],_0x1161('0x7f'),_0x35b58d['agentAvatar']);}}return _0x19cea4[_0x1161('0x7b')](_0xe7ea98);}})['catch'](handleError(_0x19cea4,null));};exports[_0x1161('0x80')]=function(_0x1a79f5,_0x7ccb4f,_0x255a07){var _0x59a680=path[_0x1161('0x74')](config['root'],'server/files/images/avatars/customer_avatar.png');var _0x361e6a={'where':{'id':_0x1a79f5['params']['id']},'attributes':['id','customerAvatar',_0x1161('0x81')],'raw':!![]};return db[_0x1161('0x3f')][_0x1161('0x57')](_0x361e6a)['then'](handleEntityNotFound(_0x7ccb4f,null))[_0x1161('0x21')](function(_0x4af14a){if(_0x4af14a){if(!_[_0x1161('0x78')](_0x4af14a[_0x1161('0x71')])){if(fs[_0x1161('0x79')](path['join'](config[_0x1161('0x7d')],_0x1161('0x7f'),_0x4af14a[_0x1161('0x71')]))&&_0x4af14a[_0x1161('0x81')]){_0x59a680=path[_0x1161('0x74')](config[_0x1161('0x7d')],_0x1161('0x7f'),_0x4af14a[_0x1161('0x71')]);}}return _0x7ccb4f[_0x1161('0x7b')](_0x59a680);}})['catch'](handleError(_0x7ccb4f,null));};exports[_0x1161('0x82')]=function(_0x2f6013,_0x25b73d,_0x12f828){var _0x1413c2=path[_0x1161('0x74')](config[_0x1161('0x7d')],_0x1161('0x83'));var _0x513c7b={'where':{'id':_0x2f6013[_0x1161('0x61')]['id']},'attributes':['id',_0x1161('0x73')],'raw':!![]};return db[_0x1161('0x3f')]['find'](_0x513c7b)[_0x1161('0x21')](handleEntityNotFound(_0x25b73d,null))['then'](function(_0x38a5ff){if(_0x38a5ff){if(!_[_0x1161('0x78')](_0x38a5ff['systemAvatar'])){if(fs[_0x1161('0x79')](path[_0x1161('0x74')](config[_0x1161('0x7d')],_0x1161('0x7f'),_0x38a5ff['systemAvatar']))){_0x1413c2=path[_0x1161('0x74')](config[_0x1161('0x7d')],'server/files/images/avatars/',_0x38a5ff[_0x1161('0x73')]);}}return _0x25b73d[_0x1161('0x7b')](_0x1413c2);}})['catch'](handleError(_0x25b73d,null));};exports[_0x1161('0x84')]=function(_0x2653d6,_0x2fd433,_0x145726){var _0x218685=require(_0x1161('0x85'));var _0x457781=new _0x218685();var _0x520da9=_0x457781[_0x1161('0x86')](_0x2653d6[_0x1161('0x87')][_0x1161('0x88')])[_0x1161('0x89')]();var _0x7f62f8={'body':_0x2653d6['body'],'channel':_0x1161('0x8a')};var _0x4481d8=[];var _0x25e90d=[];var _0x3d5f81={};var _0xe32e3b=![];return db['CmContact'][_0x1161('0x5f')]()[_0x1161('0x21')](function(_0x3bb4be){if(!_0x3bb4be){throw new db[(_0x1161('0x8b'))][(_0x1161('0x8c'))](_0x1161('0x8d'));}_0x4481d8=_[_0x1161('0x8e')](_[_0x1161('0x44')](_0x3bb4be),['createdAt',_0x1161('0x8f')]);_0x25e90d=_[_0x1161('0x8e')](_['keys'](_0x3bb4be),[_0x1161('0x90'),'updatedAt',_0x1161('0x91'),'ListId']);if(_0x2653d6[_0x1161('0x5e')]['id']){delete _0x2653d6['body']['id'];}if(_[_0x1161('0x78')](_0x2653d6[_0x1161('0x5e')][_0x1161('0x92')])){throw new db[(_0x1161('0x8b'))][(_0x1161('0x8c'))](_0x1161('0x93'));}if(_[_0x1161('0x78')](_0x2653d6[_0x1161('0x5e')][_0x1161('0x5e')])||_0x2653d6[_0x1161('0x5e')][_0x1161('0x5e')]===''){throw new db[(_0x1161('0x8b'))][(_0x1161('0x8c'))](_0x1161('0x94'));}if(_[_0x1161('0x78')](_0x2653d6[_0x1161('0x5e')]['mapKey'])){throw new db['Sequelize'][(_0x1161('0x8c'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x25e90d);}if(!_[_0x1161('0x95')](_0x25e90d,_0x2653d6[_0x1161('0x5e')][_0x1161('0x96')])){throw new db[(_0x1161('0x8b'))][(_0x1161('0x8c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x25e90d);}_0x3d5f81[_0x2653d6[_0x1161('0x5e')]['mapKey']]=_0x2653d6[_0x1161('0x5e')]['from'];})[_0x1161('0x21')](function(){return db[_0x1161('0x3f')][_0x1161('0x57')]({'where':{'id':_0x2653d6[_0x1161('0x61')]['id']},'include':[{'model':db[_0x1161('0x97')],'as':'List','include':[{'model':db[_0x1161('0x98')],'as':_0x1161('0x99'),'where':_0x3d5f81,'limit':0x1,'order':[[_0x1161('0x8f'),'DESC']]}]},{'model':db[_0x1161('0x9a')],'as':_0x1161('0x9b')}]});})[_0x1161('0x21')](handleEntityNotFound(_0x2fd433,null))[_0x1161('0x21')](function(_0x135046){if(_0x135046&&_0x135046[_0x1161('0x9c')]){_0x7f62f8[_0x1161('0x9d')]=_0x135046;_0x7f62f8['applications']=_0x135046[_0x1161('0x9b')];_0x7f62f8[_0x1161('0x9e')]=_0x135046[_0x1161('0x9c')];_0x7f62f8[_0x1161('0x9f')]=_[_0x1161('0xa0')](_0x7f62f8[_0x1161('0x9f')],['priority'],['asc']);if(_0x7f62f8['account'][_0x1161('0x9b')]){delete _0x7f62f8['account'][_0x1161('0x9b')];}if(_0x7f62f8[_0x1161('0x9d')][_0x1161('0x9c')]&&_0x7f62f8[_0x1161('0x9d')]['List'][_0x1161('0x99')][_0x1161('0x49')]){return _0x7f62f8['account']['List'][_0x1161('0x99')][0x0];}var _0x229bfb=_['defaults'](_0x2653d6['body'],{'firstName':_0x2653d6['body']['from'],'ListId':_0x135046[_0x1161('0xa1')]});_0x229bfb[_0x2653d6[_0x1161('0x5e')][_0x1161('0x96')]]=_0x2653d6[_0x1161('0x5e')][_0x1161('0x92')];return db[_0x1161('0x98')][_0x1161('0x58')](_0x229bfb,{'fields':_0x4481d8,'raw':!![]});}})[_0x1161('0x21')](handleEntityNotFound(_0x2fd433,null))[_0x1161('0x21')](function(_0x56b44e){_0x7f62f8[_0x1161('0xa2')]=_0x56b44e;var _0x3a4726=_0x2653d6[_0x1161('0x5e')][_0x1161('0xa3')];if(_0x2653d6[_0x1161('0x87')][_0x1161('0xa4')]){_0x3a4726=_0x2653d6[_0x1161('0x87')]['cf-connecting-ip'];}else if(_0x2653d6['headers'][_0x1161('0xa5')]){_0x3a4726=_['first'](_0x2653d6[_0x1161('0x87')][_0x1161('0xa5')]['split'](','));}if(_0x56b44e){var _0x5c45cc={'ContactId':_0x56b44e['id'],'ChatWebsiteId':_0x2653d6[_0x1161('0x61')]['id'],'from':(_0x56b44e[_0x1161('0xa6')]||'')+'\x20'+(_0x56b44e[_0x1161('0xa7')]||''),'customerIp':_0x3a4726,'customerPort':_0x2653d6[_0x1161('0x87')][_0x1161('0xa8')]?_0x2653d6['headers']['x-real-port']:null,'referer':_0x2653d6[_0x1161('0x5e')][_0x1161('0xa9')],'browserName':_0x520da9[_0x1161('0xaa')][_0x1161('0x3a')]&&_0x520da9[_0x1161('0xaa')][_0x1161('0xab')]?util[_0x1161('0xac')](_0x1161('0xad'),_0x520da9[_0x1161('0xaa')]['name'],_0x520da9[_0x1161('0xaa')]['version']):_0x1161('0xae'),'browserVersion':_0x520da9[_0x1161('0xaa')][_0x1161('0xab')]||'unknown','osName':util[_0x1161('0xac')](_0x1161('0xad'),_0x520da9['os'][_0x1161('0x3a')],_0x520da9['os'][_0x1161('0xab')]),'osVersion':_0x520da9['os'][_0x1161('0xab')],'deviceModel':_0x520da9[_0x1161('0xaf')][_0x1161('0x42')]&&_0x520da9[_0x1161('0xaf')][_0x1161('0xb0')]?util[_0x1161('0xac')](_0x1161('0xb1'),_0x520da9['device'][_0x1161('0x42')],_0x520da9[_0x1161('0xaf')][_0x1161('0xb0')],_0x520da9[_0x1161('0xaf')][_0x1161('0x41')]):null,'deviceVendor':_0x520da9[_0x1161('0xaf')][_0x1161('0xb0')],'deviceType':_0x520da9['device'][_0x1161('0x41')],'formData':JSON[_0x1161('0xb2')](_0x2653d6[_0x1161('0x5e')])};var _0x243327={'ChatWebsiteId':_0x2653d6[_0x1161('0x61')]['id'],'closed':![]};if(_0x2653d6[_0x1161('0x5e')]['threadId']){_0x243327[_0x1161('0xb3')]=_0x2653d6[_0x1161('0x5e')][_0x1161('0xb3')];return db[_0x1161('0xb4')][_0x1161('0x57')]({'where':_0x243327})[_0x1161('0x21')](function(_0x1b1c23){if(_0x1b1c23){return[_0x1b1c23,![]];}_0x5c45cc[_0x1161('0xb3')]=_0x2653d6[_0x1161('0x5e')][_0x1161('0xb3')];_0x5c45cc[_0x1161('0xb5')]=_0x2653d6[_0x1161('0x5e')][_0x1161('0xb5')];return db[_0x1161('0xb4')][_0x1161('0x58')](_0x5c45cc)[_0x1161('0x21')](function(_0x4dc4d9){return[_0x4dc4d9,!![]];});});}_0x243327['ContactId']=_0x56b44e['id'];if(_0x2653d6[_0x1161('0x5e')]['interaction']&&_0x2653d6['body'][_0x1161('0xb6')]['id']){_0x243327['id']=_0x2653d6[_0x1161('0x5e')][_0x1161('0xb6')]['id'];return db['ChatInteraction'][_0x1161('0x57')]({'where':_0x243327})[_0x1161('0x21')](function(_0x293a1a){if(_0x293a1a){return[_0x293a1a,![]];}return db['ChatInteraction']['create'](_0x5c45cc)[_0x1161('0x21')](function(_0x594012){return[_0x594012,!![]];});});}return db[_0x1161('0xb4')][_0x1161('0x58')](_0x5c45cc)['then'](function(_0x1adec6){return[_0x1adec6,!![]];});}})[_0x1161('0xb7')](function(_0x1d3e6e,_0x2dfae7){if(_0x1d3e6e){_0xe32e3b=_0x2dfae7;if(!_0x2dfae7){var _0x4b6b63={'from':(_0x7f62f8[_0x1161('0xa2')][_0x1161('0xa6')]||'')+'\x20'+(_0x7f62f8['contact'][_0x1161('0xa7')]||'')};if(_0x2653d6['body'][_0x1161('0xb3')]&&_0x2653d6[_0x1161('0x5e')][_0x1161('0xb8')]&&_0x2653d6[_0x1161('0x5e')]['threadId']!=_0x2653d6[_0x1161('0x5e')][_0x1161('0xb8')]){_0x4b6b63[_0x1161('0xb3')]=_0x2653d6[_0x1161('0x5e')][_0x1161('0xb8')];}return _0x1d3e6e['update'](_0x4b6b63);}else{return _0x1d3e6e;}}})[_0x1161('0x21')](function(_0x41a97e){_0x7f62f8[_0x1161('0xb6')]=_0x41a97e['get']({'plain':!![]});_0x7f62f8[_0x1161('0xb6')][_0x1161('0xb9')]=_0xe32e3b;if(_0x7f62f8[_0x1161('0xb6')][_0x1161('0xb9')]){if(_0x7f62f8['account'][_0x1161('0xba')]){_0x7f62f8[_0x1161('0x9f')][_0x1161('0xbb')]({'id':0x0,'priority':_0x7f62f8[_0x1161('0x9f')]['length']+0x1,'app':_0x1161('0xbc'),'appdata':'unmanaged','interval':_0x1161('0xbd')});}}return db['ChatMessage']['create']({'body':_0x2653d6[_0x1161('0x5e')]['body'],'ChatWebsiteId':_0x2653d6[_0x1161('0x61')]['id'],'ChatInteractionId':_0x41a97e['id'],'direction':'in','ContactId':_0x7f62f8[_0x1161('0xa2')]['id'],'AttachmentId':_0x2653d6[_0x1161('0x5e')][_0x1161('0xbe')]});})[_0x1161('0x21')](function(_0x2f555e){_0x7f62f8[_0x1161('0x28')]=_0x2f555e;if(_0x7f62f8['interaction'][_0x1161('0xbf')]){return db[_0x1161('0xc0')][_0x1161('0x57')]({'attributes':['id',_0x1161('0x3a')],'where':{'id':_0x7f62f8[_0x1161('0xb6')][_0x1161('0xbf')]}})['then'](function(_0x4335dd){if(_0x4335dd){_0x7f62f8[_0x1161('0x9f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1161('0xc1'),'appdata':_0x4335dd[_0x1161('0x3a')]+','+(_0x7f62f8[_0x1161('0x9d')][_0x1161('0xc2')]||0xa),'interval':_0x1161('0xbd')});_0x7f62f8['forcedOwnership']=!![];}return respondWithRpcPromise(_0x1161('0xc3'),'startRouting',_0x7f62f8);});}return respondWithRpcPromise(_0x1161('0xc3'),'startRouting',_0x7f62f8);})[_0x1161('0x21')](function(_0x353a5b){respondWithRpcPromise(_0x1161('0xc4'),_0x1161('0xc4'),{'event':'notify','message':_0x353a5b},client9002);return _0x353a5b;})[_0x1161('0x21')](respondWithResult(_0x2fd433,null))[_0x1161('0x2a')](handleError(_0x2fd433,null));};exports[_0x1161('0xc5')]=function(_0x3ae4b6,_0x3a0e61,_0x26665e){var _0x138f5f,_0x50792c,_0x157be9;var _0x3c4926=[];var _0xd26394=[];var _0x450719={};var _0x555b53=_0x3ae4b6[_0x1161('0xc6')]||[];var _0x3aea00=[];var _0x375f0b;return db[_0x1161('0x98')][_0x1161('0x5f')]()[_0x1161('0x21')](function(_0x573e4b){if(!_0x573e4b){throw new db[(_0x1161('0x8b'))]['ValidationError'](_0x1161('0x8d'));}_0xd26394=_['difference'](_[_0x1161('0x44')](_0x573e4b),[_0x1161('0x90'),_0x1161('0x8f')]);_0x3c4926=_[_0x1161('0x8e')](_[_0x1161('0x44')](_0x573e4b),[_0x1161('0x90'),_0x1161('0x8f'),_0x1161('0x91'),_0x1161('0xa1')]);if(_0x3ae4b6[_0x1161('0x5e')]['id']){delete _0x3ae4b6['body']['id'];}if(_[_0x1161('0x78')](_0x3ae4b6[_0x1161('0x5e')]['from'])){throw _0x3a0e61['status'](0x1f4)[_0x1161('0xc7')](new db[(_0x1161('0x8b'))][(_0x1161('0x8c'))](_0x1161('0x93')));}if(_['isNil'](_0x3ae4b6[_0x1161('0x5e')]['body'])||_0x3ae4b6[_0x1161('0x5e')]['body']===''){throw _0x3a0e61[_0x1161('0x2b')](0x1f4)[_0x1161('0xc7')](new db[(_0x1161('0x8b'))]['ValidationError'](_0x1161('0x94')));}if(_[_0x1161('0x78')](_0x3ae4b6['body'][_0x1161('0xc8')])){throw _0x3a0e61[_0x1161('0x2b')](0x1f4)[_0x1161('0xc7')](new db[(_0x1161('0x8b'))][(_0x1161('0x8c'))](_0x1161('0xc9')+_0x3c4926));}if(!_[_0x1161('0x95')](_0x3c4926,_0x3ae4b6[_0x1161('0x5e')][_0x1161('0xc8')])){throw _0x3a0e61['status'](0x1f4)['send'](new db[(_0x1161('0x8b'))][(_0x1161('0x8c'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3c4926));}_0x450719[_0x3ae4b6[_0x1161('0x5e')]['mapKeyOffline']]=_0x3ae4b6[_0x1161('0x5e')][_0x1161('0x92')];})[_0x1161('0x21')](function(){return db[_0x1161('0x3f')]['find']({'where':{'id':_0x3ae4b6[_0x1161('0x61')]['id']},'include':[{'model':db[_0x1161('0x97')],'as':'List'},{'model':db['MailAccount'],'as':_0x1161('0xca')}]});})[_0x1161('0x21')](handleEntityNotFound(_0x3a0e61,null))[_0x1161('0x21')](function(_0x20b82a){if(_0x20b82a&&_0x20b82a[_0x1161('0x9c')]){_0x50792c=_0x20b82a;var _0x409c32=_[_0x1161('0x19')](_0x3ae4b6[_0x1161('0x5e')],{'firstName':_0x3ae4b6[_0x1161('0x5e')][_0x1161('0x92')],'phone':_0x3ae4b6[_0x1161('0x5e')]['from'],'ListId':_0x20b82a['ListId']});_0x409c32[_0x3ae4b6[_0x1161('0x5e')][_0x1161('0xc8')]]=_0x3ae4b6[_0x1161('0x5e')][_0x1161('0x92')];return db[_0x1161('0x98')]['findOrCreate']({'where':_0x450719,'defaults':_0x409c32});}})[_0x1161('0xb7')](function(_0x3c76fa){if(_0x3c76fa){_0x157be9=_0x3c76fa;var _0x24d301=fs['readFileSync'](path[_0x1161('0x74')](config[_0x1161('0x7d')],_0x1161('0xcb')),'utf8');var _0x38fb5c=ejs[_0x1161('0xcc')](_0x24d301,{'body':_['toPairs'](_0x3ae4b6[_0x1161('0x5e')][_0x1161('0x5e')]),'bodyTitle':_0x50792c['offlineMessageBody']});return db[_0x1161('0xcd')][_0x1161('0x58')]({'body':_0x38fb5c,'ContactId':_0x3c76fa['id'],'ChatWebsiteId':_0x50792c['id']});}})['then'](function(_0x47f90e){_0x375f0b=_0x47f90e;if(_0x555b53[_0x1161('0x49')]){var _0x280830=_0x555b53[_0x1161('0x3e')](function(_0x5825b3){return{'name':_0x5825b3[_0x1161('0xce')],'basename':_0x5825b3['filename'],'type':_0x5825b3[_0x1161('0xcf')],'ChatOfflineMessageId':_0x47f90e['id']};});_0x3aea00=_0x280830[_0x1161('0x3e')](_0x472a22=>{var _0x1ba014={'filename':_0x472a22[_0x1161('0x3a')],'path':path[_0x1161('0x74')](config[_0x1161('0x7d')],_0x1161('0xd0'),_0x1161('0xc6'),'attachments',_0x1161('0xd1'),_0x472a22[_0x1161('0xd2')])};return _0x1ba014;});if(!_0x50792c[_0x1161('0xd3')]){return db[_0x1161('0xd4')]['transaction'](function(_0x3c6f85){return db[_0x1161('0xd5')][_0x1161('0xd6')](_0x280830,{'transaction':_0x3c6f85});});}}})[_0x1161('0x21')](function(){if(_0x375f0b){_0x138f5f=_0x375f0b;return db[_0x1161('0xca')][_0x1161('0x6a')]({'where':{'active':!![]},'include':[{'model':db[_0x1161('0xd7')],'as':_0x1161('0xd8'),'raw':!![]}]});}})[_0x1161('0x21')](function(_0x3b57bf){if(_0x3b57bf&&_0x3b57bf['Smtp']&&_0x50792c[_0x1161('0xd9')]&&_0x50792c[_0x1161('0xda')]){var _0x3486e5={'tls':{'rejectUnauthorized':![]}};if(_0x3b57bf[_0x1161('0xd8')]['service']){_0x3486e5[_0x1161('0xdb')]=_0x3b57bf['Smtp'][_0x1161('0xdb')];}else{_0x3486e5[_0x1161('0xdc')]=_0x3b57bf[_0x1161('0xd8')]['host'];_0x3486e5[_0x1161('0xdd')]=_0x3b57bf[_0x1161('0xd8')][_0x1161('0xdd')];_0x3486e5[_0x1161('0xde')]=_0x3b57bf[_0x1161('0xd8')][_0x1161('0xde')];}if(_0x3b57bf[_0x1161('0xd8')][_0x1161('0xdf')]){_0x3486e5[_0x1161('0xe0')]={'user':_0x3b57bf['Smtp'][_0x1161('0x59')],'pass':_0x3b57bf[_0x1161('0xd8')][_0x1161('0xe1')]};}return respondWithRpcPromise(_0x1161('0xe2'),'sendMail',{'account':_0x3486e5,'message':{'from':util[_0x1161('0xac')](_0x1161('0xe3'),_0x3b57bf[_0x1161('0x3a')],_0x3b57bf[_0x1161('0xe4')]||_0x3b57bf[_0x1161('0xd8')][_0x1161('0x59')]),'to':_0x50792c[_0x1161('0xda')],'subject':_0x50792c[_0x1161('0xe5')],'html':_0x138f5f[_0x1161('0x5e')],'attachments':_0x3aea00}},client9003)[_0x1161('0x21')](function(){return _0x138f5f;})[_0x1161('0x2a')](function(_0xf51efc){console[_0x1161('0x25')](_0xf51efc);});}})['then'](function(){if(_0x50792c&&_0x50792c[_0x1161('0xd3')]&&_0x50792c['MailAccountId']){var _0x53d804=[];if(_0x555b53['length']){_0x53d804=_0x555b53[_0x1161('0x3e')](function(_0x9dbb08){return{'name':_0x9dbb08[_0x1161('0xce')],'basename':_0x9dbb08[_0x1161('0x6f')],'type':_0x9dbb08[_0x1161('0xcf')],'ChatOfflineMessageId':_0x375f0b['id']};});}var _0x4b2394;if(!_[_0x1161('0x78')](_0x50792c[_0x1161('0xe6')])){var _0x9ee882=_['map'](_0x3ae4b6[_0x1161('0x5e')],function(_0x501fa9){return _0x501fa9;});var _0x122127=_[_0x1161('0xe7')](_0x9ee882)[0x0];var _0x244678=_[_0x1161('0xe8')](_0x122127,function(_0x1b717e){return _0x1b717e;});_0x4b2394=_0x244678[0x1][_0x50792c['subjectOffline']];}var _0x4a2694={'from':_0x157be9[_0x1161('0xe4')],'firstName':_0x157be9[_0x1161('0xa6')],'lastName':_0x157be9[_0x1161('0xa7')],'mapKey':_0x1161('0xe4'),'message':{'from':_0x157be9[_0x1161('0xe4')],'to':_0x50792c[_0x1161('0xca')]['email'],'cc':'','subject':_[_0x1161('0x78')](_0x4b2394)?_0x50792c[_0x1161('0xe5')]:_0x4b2394,'messageId':'','sentAt':new Date(),'attach':_0x53d804['length'],'attachments':_0x53d804,'originChannel':'Chat','ChatWebsiteId':_0x50792c['id'],'ChatOfflineMessageId':_0x138f5f['id'],'originTo':_0x50792c['MailAccount'][_0x1161('0xe4')]},'body':_0x138f5f[_0x1161('0x5e')]};var _0x160823={'account':{'id':_0x50792c[_0x1161('0xe9')]},'body':_0x4a2694,'log':_0x1161('0xea')};return respondWithRpcPromise(_0x1161('0xea'),'notifyMail',_0x160823,client9001)[_0x1161('0x21')](function(){return _0x138f5f;})[_0x1161('0x2a')](function(_0x2796cc){console[_0x1161('0x25')](_0x2796cc);});}return;})['then'](function(){if(_0x138f5f){return _0x138f5f;}})[_0x1161('0x21')](respondWithResult(_0x3a0e61,null))[_0x1161('0x2a')](function(_0x3260ae){console[_0x1161('0x25')](_0x1161('0x2a'),_0x3260ae);for(var _0x313283 of _0x555b53){var _0x2f3acd=path[_0x1161('0x74')](config[_0x1161('0x7d')],_0x1161('0xd0'),_0x1161('0xc6'),'attachments',_0x1161('0xd1'),_0x313283[_0x1161('0x6f')]);fs_extra[_0x1161('0xeb')](_0x2f3acd)[_0x1161('0x2a')](function(_0x12ec4b){console[_0x1161('0x25')](_0x1161('0xec'),_0x2f3acd,_0x12ec4b);});}});};exports[_0x1161('0xed')]=function(_0x5f2c18,_0x169f4d,_0x5e9484){return db['ChatInteraction']['find']({'where':{'id':_0x5f2c18[_0x1161('0x61')]['id']}})['then'](handleEntityNotFound(_0x169f4d,null))[_0x1161('0x21')](function(_0x994c74){if(_0x994c74){return _0x994c74[_0x1161('0xed')](_0x5f2c18[_0x1161('0x5e')][_0x1161('0x67')],_[_0x1161('0xee')](_0x5f2c18[_0x1161('0x5e')],['ids','id'])||{});}})['then'](respondWithResult(_0x169f4d,null))['catch'](handleError(_0x169f4d,null));};exports['getInteractions']=function(_0x3c34a7,_0x7c7404,_0x5677f7){var _0xe2b749={'raw':![],'where':{}};var _0x3f2dcb={};var _0x42496b={'count':0x0,'rows':[]};return db[_0x1161('0x3f')][_0x1161('0x6a')]({'where':{'id':_0x3c34a7[_0x1161('0x61')]['id']}})[_0x1161('0x21')](handleEntityNotFound(_0x7c7404,null))[_0x1161('0x21')](function(_0x349ac3){if(_0x349ac3){_0x3f2dcb[_0x1161('0x42')]=_[_0x1161('0x44')](db[_0x1161('0xb4')][_0x1161('0x56')]);_0x3f2dcb['query']=_[_0x1161('0x44')](_0x3c34a7[_0x1161('0x43')]);_0x3f2dcb[_0x1161('0x45')]=_[_0x1161('0x46')](_0x3f2dcb[_0x1161('0x42')],_0x3f2dcb[_0x1161('0x43')]);_0xe2b749[_0x1161('0x48')]=_[_0x1161('0x46')](_0x3f2dcb[_0x1161('0x42')],qs['fields'](_0x3c34a7[_0x1161('0x43')][_0x1161('0x47')]));_0xe2b749['attributes']=_0xe2b749[_0x1161('0x48')][_0x1161('0x49')]?_0xe2b749[_0x1161('0x48')]:_0x3f2dcb[_0x1161('0x42')];if(!_0x3c34a7['query'][_0x1161('0x4a')](_0x1161('0x65'))){_0xe2b749[_0x1161('0x2e')]=qs[_0x1161('0x2e')](_0x3c34a7['query'][_0x1161('0x2e')]);_0xe2b749[_0x1161('0x30')]=qs[_0x1161('0x30')](_0x3c34a7[_0x1161('0x43')]['offset']);}_0xe2b749[_0x1161('0x4b')]=qs[_0x1161('0x4c')](_0x3c34a7['query'][_0x1161('0x4c')]);_0xe2b749['where']=qs[_0x1161('0x45')](_[_0x1161('0x4e')](_0x3c34a7[_0x1161('0x43')],_0x3f2dcb[_0x1161('0x45')]));_0xe2b749[_0x1161('0x4d')]['ChatWebsiteId']=_0x349ac3['id'];if(_0x3c34a7[_0x1161('0x43')][_0x1161('0x4f')]){_0xe2b749[_0x1161('0x4d')]=_[_0x1161('0x50')](_0xe2b749[_0x1161('0x4d')],{'$or':_[_0x1161('0x3e')](_0xe2b749[_0x1161('0x48')],function(_0x372260){var _0x22476e={};_0x22476e[_0x372260]={'$like':'%'+_0x3c34a7[_0x1161('0x43')][_0x1161('0x4f')]+'%'};return _0x22476e;})});}_0xe2b749=_[_0x1161('0x50')]({},_0xe2b749,_0x3c34a7[_0x1161('0x51')]);return db[_0x1161('0xb4')][_0x1161('0x2f')]({'where':_0xe2b749['where']})[_0x1161('0x21')](function(_0x19da52){_0x42496b[_0x1161('0x2f')]=_0x19da52;if(_0x3c34a7[_0x1161('0x43')][_0x1161('0x52')]){_0xe2b749['include']=[{'model':db[_0x1161('0x98')],'as':_0x1161('0xef'),'required':![]},{'model':db[_0x1161('0xc0')],'as':'Owner','attributes':[_0x1161('0x3a'),_0x1161('0xf0'),_0x1161('0xf1')],'required':![]},{'model':db[_0x1161('0xf2')],'as':_0x1161('0xf3'),'attributes':['id',_0x1161('0x3a'),'color'],'where':_0x3c34a7[_0x1161('0x43')][_0x1161('0xf4')]?{'id':_0x3c34a7[_0x1161('0x43')]['tag']}:undefined,'required':_0x3c34a7[_0x1161('0x43')][_0x1161('0xf4')]?!![]:![]}];}return db[_0x1161('0xb4')]['findAll'](_0xe2b749);})['then'](function(_0x39e74a){_0x42496b[_0x1161('0x55')]=_0x39e74a;return _0x42496b;});}})[_0x1161('0x21')](respondWithFilteredResult(_0x7c7404,_0xe2b749))[_0x1161('0x2a')](handleError(_0x7c7404,null));};function iftimePromise(_0x311773,_0x8691af){return respondWithRpcPromise(_0x1161('0xf5'),_0x1161('0xf6'),{'command':_0x8691af[_0x1161('0xf7')]?util[_0x1161('0xac')]('iftime\x20%s,%s',_0x311773[_0x1161('0xf8')],_0x8691af[_0x1161('0xf7')]):util[_0x1161('0xac')]('iftime\x20%s',_0x311773[_0x1161('0xf8')])},client9002)[_0x1161('0x21')](function(_0x181edc){var _0x2cccd8=_0x181edc&&_0x181edc[_0x1161('0xf9')](_0x1161('0xfa'))>=0x0?!![]:![];logger[_0x1161('0x22')](_0x1161('0xfb'),_0x8691af['id'],_0x311773['id'],_0x311773[_0x1161('0xf8')],_0x2cccd8?_0x1161('0xfc'):_0x1161('0xfd'),_0x8691af[_0x1161('0xf7')]?_0x8691af['timezone']:_0x1161('0xfe'));return _0x2cccd8;})[_0x1161('0x2a')](function(_0x74f4a0){logger[_0x1161('0x25')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x8691af['id'],_0x311773['id'],_0x311773[_0x1161('0xf8')],util['inspect'](_0x74f4a0,{'showHidden':![],'depth':null}),_0x8691af[_0x1161('0xf7')]?_0x8691af['timezone']:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x390b64,_0xec4c36,_0x2bfb67){var _0x26f020=0x0;var _0x523f50=0x0;var _0x11286e=![];var _0x4378e9;var _0x44b320;return db[_0x1161('0x3f')][_0x1161('0x57')]({'where':{'id':_0x390b64[_0x1161('0x61')]['id']},'include':[{'model':db[_0x1161('0xff')],'as':_0x1161('0xff'),'include':[{'model':db[_0x1161('0xff')],'as':_0x1161('0x100'),'attributes':['id',_0x1161('0xf8')],'raw':!![]}]}]})[_0x1161('0x21')](handleEntityNotFound(_0xec4c36,null))['then'](function(_0x333a9c){if(_0x333a9c){_0x4378e9=_0x333a9c;return _0x333a9c[_0x1161('0x101')]({'raw':!![]});}})[_0x1161('0x21')](function(_0x4ede8e){if(_0x4378e9){if(_0x4ede8e){_0x44b320=_0x4ede8e;}}return require(_0x1161('0x16'))[_0x1161('0x76')]();})['then'](function(_0x5501ed){if(_0x5501ed){_0x523f50=_0x5501ed['virtual'];_0x11286e=_0x5501ed[_0x1161('0x77')];}})[_0x1161('0x21')](function(){return db['ChatInteraction'][_0x1161('0x2f')]({'where':{'closed':![]}});})['then'](function(_0x2ed123){_0x26f020=_0x2ed123;if(_0x523f50&&_0x2ed123>_0x523f50){return db[_0x1161('0x102')][_0x1161('0x6a')]({'where':{'id':0x1}})[_0x1161('0x21')](function(_0x5c71c8){if(_0x5c71c8){_0x5c71c8[_0x1161('0x103')](_0x1161('0x104'));}});}})['then'](function(){if(_0x4378e9['Interval']&&_0x4378e9[_0x1161('0xff')]['Intervals']){var _0x127445=[];for(var _0x2e4ebe=0x0;_0x2e4ebe<_0x4378e9[_0x1161('0xff')][_0x1161('0x100')]['length'];_0x2e4ebe++){var _0x477857=_0x4378e9[_0x1161('0xff')][_0x1161('0x100')][_0x2e4ebe][_0x1161('0x35')]({'plain':!![]});_0x127445['push'](iftimePromise(_0x477857,_0x4378e9));}return BPromise[_0x1161('0x105')](_0x127445)[_0x1161('0x21')](function(_0x256970){return _[_0x1161('0x106')](_0x256970);});}else{return!![];}})[_0x1161('0x21')](function(_0x22d38f){var _0x27d37a=fs[_0x1161('0x107')](path[_0x1161('0x74')](config[_0x1161('0x7d')],_0x1161('0x108')),_0x1161('0x109'));var _0x4dbcd0={'remote':_0x4378e9[_0x1161('0x10a')],'query':querystring[_0x1161('0xb2')](_[_0x1161('0x50')](_0x4378e9[_0x1161('0x35')]({'plain':!![]}),{'customerIp':_0x390b64[_0x1161('0x87')][_0x1161('0xa5')]||_0x390b64['headers'][_0x1161('0x10b')]||_0x390b64[_0x1161('0x10c')]['remoteAddress']||_0x390b64['ip'],'referer':_0x390b64[_0x1161('0x87')]['referer'],'openedInteractions':_0x26f020,'maxInteractions':_0x523f50,'virtual':_0x11286e[_0x1161('0x10d')],'online':_0x22d38f,'custom':_0x11286e}))['replace'](/'/g,'\x5c\x27')};_0xec4c36[_0x1161('0xc7')](ejs[_0x1161('0xcc')](Mustache['render'](_0x27d37a,_0x4dbcd0),{'proactiveActions':_0x44b320,'alignment':_0x4378e9[_0x1161('0x10e')],'verticalAlignment':_0x4378e9['verticalAlignment'],'div_color':_0x4378e9[_0x1161('0x10f')],'text_color':_0x4378e9[_0x1161('0x110')],'button_color':_0x4378e9[_0x1161('0x111')],'background_color':_0x4378e9[_0x1161('0x112')]}));})[_0x1161('0x2a')](handleError(_0xec4c36,null));};exports[_0x1161('0x113')]=function(_0x24f756,_0x412bd6,_0x4bbdc3){return db[_0x1161('0x3f')][_0x1161('0x6a')]({'where':{'id':_0x24f756[_0x1161('0x61')]['id']}})[_0x1161('0x21')](handleEntityNotFound(_0x412bd6,null))['then'](function(_0x5ea868){if(_0x5ea868){return db[_0x1161('0xd4')][_0x1161('0x114')](function(_0x4dec7e){return db['ChatApplication'][_0x1161('0x38')]({'where':{'ChatWebsiteId':_0x24f756[_0x1161('0x61')]['id']},'transaction':_0x4dec7e})['then'](function(_0x353fc6){var _0x37e7b0=_['map'](_0x24f756[_0x1161('0x5e')],function(_0x503bc0){_0x503bc0['ChatWebsiteId']=_0x24f756['params']['id'];return _0x503bc0;});return db[_0x1161('0x9a')][_0x1161('0xd6')](_0x37e7b0,{'transaction':_0x4dec7e});});})['then'](function(){return db[_0x1161('0x9a')][_0x1161('0x115')]({'where':{'ChatWebsiteId':_0x24f756[_0x1161('0x61')]['id']},'order':_0x1161('0x116')});});}})[_0x1161('0x21')](respondWithResult(_0x412bd6,null))['catch'](handleError(_0x412bd6,null));};exports[_0x1161('0x117')]=function(_0x4904c3,_0x5a98cc,_0x53b371){var _0x37f618={};var _0x4427b1={};var _0x13c2ad;var _0xe22ec6;return db[_0x1161('0x3f')]['findOne']({'where':{'id':_0x4904c3[_0x1161('0x61')]['id']}})[_0x1161('0x21')](handleEntityNotFound(_0x5a98cc,null))[_0x1161('0x21')](function(_0x580f1a){if(_0x580f1a){_0x13c2ad=_0x580f1a;_0x4427b1['model']=_[_0x1161('0x44')](db[_0x1161('0x9a')][_0x1161('0x56')]);_0x4427b1[_0x1161('0x43')]=_[_0x1161('0x44')](_0x4904c3['query']);_0x4427b1[_0x1161('0x45')]=_[_0x1161('0x46')](_0x4427b1[_0x1161('0x42')],_0x4427b1[_0x1161('0x43')]);_0x37f618[_0x1161('0x48')]=_['intersection'](_0x4427b1[_0x1161('0x42')],qs[_0x1161('0x47')](_0x4904c3[_0x1161('0x43')][_0x1161('0x47')]));_0x37f618[_0x1161('0x48')]=_0x37f618[_0x1161('0x48')][_0x1161('0x49')]?_0x37f618[_0x1161('0x48')]:_0x4427b1[_0x1161('0x42')];_0x37f618[_0x1161('0x4b')]=qs[_0x1161('0x4c')](_0x4904c3[_0x1161('0x43')][_0x1161('0x4c')]);_0x37f618[_0x1161('0x4d')]=qs[_0x1161('0x45')](_[_0x1161('0x4e')](_0x4904c3[_0x1161('0x43')],_0x4427b1['filters']));if(_0x4904c3[_0x1161('0x43')][_0x1161('0x4f')]){_0x37f618['where']=_['merge'](_0x37f618['where'],{'$or':_['map'](_0x37f618[_0x1161('0x48')],function(_0x39eefa){var _0x3394ee={};_0x3394ee[_0x39eefa]={'$like':'%'+_0x4904c3['query'][_0x1161('0x4f')]+'%'};return _0x3394ee;})});}_0x37f618=_[_0x1161('0x50')]({},_0x37f618,_0x4904c3[_0x1161('0x51')]);return _0x13c2ad[_0x1161('0x117')](_0x37f618);}})[_0x1161('0x21')](function(_0x5b5b96){if(_0x5b5b96){_0xe22ec6=_0x5b5b96[_0x1161('0x49')];if(!_0x4904c3['query']['hasOwnProperty'](_0x1161('0x65'))){_0x37f618[_0x1161('0x2e')]=qs[_0x1161('0x2e')](_0x4904c3['query']['limit']);_0x37f618['offset']=qs[_0x1161('0x30')](_0x4904c3[_0x1161('0x43')]['offset']);}return _0x13c2ad[_0x1161('0x117')](_0x37f618);}})[_0x1161('0x21')](function(_0x9cad82){if(_0x9cad82){return _0x9cad82?{'count':_0xe22ec6,'rows':_0x9cad82}:null;}})['then'](respondWithResult(_0x5a98cc,null))['catch'](handleError(_0x5a98cc,null));};exports[_0x1161('0x118')]=function(_0x317236,_0x21109b,_0x124472){return db[_0x1161('0x119')][_0x1161('0x57')]({'where':{'id':_0x317236[_0x1161('0x61')]['id']}})[_0x1161('0x21')](handleEntityNotFound(_0x21109b,null))[_0x1161('0x21')](function(_0x3ac835){if(_0x3ac835){return _0x3ac835[_0x1161('0x118')](_0x317236['body']['ids'],_[_0x1161('0xee')](_0x317236[_0x1161('0x5e')],[_0x1161('0x67'),'id'])||{});}})['then'](respondWithResult(_0x21109b,null))[_0x1161('0x2a')](handleError(_0x21109b,null));};exports['getProactiveActions']=function(_0x248a30,_0x1002fe,_0x3298f6){var _0x482794={};var _0x4481a5={};var _0x3ed7a4;var _0x45f26f;return db[_0x1161('0x3f')]['findOne']({'where':{'id':_0x248a30[_0x1161('0x61')]['id']}})[_0x1161('0x21')](handleEntityNotFound(_0x1002fe,null))[_0x1161('0x21')](function(_0x4f573c){if(_0x4f573c){_0x3ed7a4=_0x4f573c;_0x4481a5[_0x1161('0x42')]=_['keys'](db[_0x1161('0x11a')]['rawAttributes']);_0x4481a5[_0x1161('0x43')]=_[_0x1161('0x44')](_0x248a30[_0x1161('0x43')]);_0x4481a5[_0x1161('0x45')]=_['intersection'](_0x4481a5[_0x1161('0x42')],_0x4481a5['query']);_0x482794[_0x1161('0x48')]=_[_0x1161('0x46')](_0x4481a5[_0x1161('0x42')],qs['fields'](_0x248a30[_0x1161('0x43')][_0x1161('0x47')]));_0x482794[_0x1161('0x48')]=_0x482794[_0x1161('0x48')][_0x1161('0x49')]?_0x482794[_0x1161('0x48')]:_0x4481a5[_0x1161('0x42')];_0x482794['order']=qs['sort'](_0x248a30[_0x1161('0x43')][_0x1161('0x4c')]);_0x482794[_0x1161('0x4d')]=qs[_0x1161('0x45')](_[_0x1161('0x4e')](_0x248a30[_0x1161('0x43')],_0x4481a5[_0x1161('0x45')]));if(_0x248a30[_0x1161('0x43')]['filter']){_0x482794[_0x1161('0x4d')]=_[_0x1161('0x50')](_0x482794[_0x1161('0x4d')],{'$or':_[_0x1161('0x3e')](_0x482794[_0x1161('0x48')],function(_0x2b7039){var _0x3e50c9={};_0x3e50c9[_0x2b7039]={'$like':'%'+_0x248a30[_0x1161('0x43')][_0x1161('0x4f')]+'%'};return _0x3e50c9;})});}_0x482794=_['merge']({},_0x482794,_0x248a30[_0x1161('0x51')]);return _0x3ed7a4[_0x1161('0x101')](_0x482794);}})['then'](function(_0xfc0f5a){if(_0xfc0f5a){_0x45f26f=_0xfc0f5a[_0x1161('0x49')];if(!_0x248a30[_0x1161('0x43')]['hasOwnProperty'](_0x1161('0x65'))){_0x482794[_0x1161('0x2e')]=qs[_0x1161('0x2e')](_0x248a30[_0x1161('0x43')][_0x1161('0x2e')]);_0x482794[_0x1161('0x30')]=qs['offset'](_0x248a30['query'][_0x1161('0x30')]);}return _0x3ed7a4['getProactiveActions'](_0x482794);}})[_0x1161('0x21')](function(_0x50edeb){if(_0x50edeb){return _0x50edeb?{'count':_0x45f26f,'rows':_0x50edeb}:null;}})['then'](respondWithResult(_0x1002fe,null))[_0x1161('0x2a')](handleError(_0x1002fe,null));};exports['getFields']=function(_0x222831,_0x1d62b0,_0x8279b6){var _0xdd967d=_0x222831[_0x1161('0x43')]['online']==='false'?_0x1161('0x11b'):'onlineForm';return db[_0x1161('0x3f')][_0x1161('0x57')]({'attributes':['id',_0xdd967d],'where':{'id':_0x222831[_0x1161('0x61')]['id']}})[_0x1161('0x21')](handleEntityNotFound(_0x1d62b0,null))['then'](function(_0x438923){if(_0x438923){var _0x4f60f6=_0x438923[_0xdd967d];var _0x4cc1e2=_0x4f60f6&&_0x4f60f6['items']?_0x4f60f6[_0x1161('0x11c')]:[];_0x1d62b0[_0x1161('0xc7')]({'fromKey':_[_0x1161('0x78')](_0x4f60f6['fromKey'])?undefined:_0x4f60f6[_0x1161('0x11d')],'count':_0x4cc1e2[_0x1161('0x49')],'rows':_0x4cc1e2});}})[_0x1161('0x2a')](handleError(_0x1d62b0,null));};exports[_0x1161('0x11e')]=function(_0x22bd16,_0x2befbc,_0x4cabc7){var _0x546634={'raw':![],'where':{}};var _0x510ba0={};var _0x5c16c8={'count':0x0,'rows':[]};return db[_0x1161('0x3f')][_0x1161('0x6a')]({'where':{'id':_0x22bd16['params']['id']}})[_0x1161('0x21')](handleEntityNotFound(_0x2befbc,null))[_0x1161('0x21')](function(_0x3a98d3){if(_0x3a98d3){_0x510ba0[_0x1161('0x42')]=_[_0x1161('0x44')](db['ChatOfflineMessage'][_0x1161('0x56')]);_0x510ba0[_0x1161('0x43')]=_[_0x1161('0x44')](_0x22bd16[_0x1161('0x43')]);_0x510ba0[_0x1161('0x45')]=_['intersection'](_0x510ba0[_0x1161('0x42')],_0x510ba0[_0x1161('0x43')]);_0x546634['attributes']=_[_0x1161('0x46')](_0x510ba0[_0x1161('0x42')],qs['fields'](_0x22bd16[_0x1161('0x43')]['fields']));_0x546634['attributes']=_0x546634[_0x1161('0x48')]['length']?_0x546634[_0x1161('0x48')]:_0x510ba0['model'];if(!_0x22bd16[_0x1161('0x43')][_0x1161('0x4a')]('nolimit')){_0x546634[_0x1161('0x2e')]=qs['limit'](_0x22bd16[_0x1161('0x43')][_0x1161('0x2e')]);_0x546634[_0x1161('0x30')]=qs[_0x1161('0x30')](_0x22bd16[_0x1161('0x43')][_0x1161('0x30')]);}_0x546634[_0x1161('0x4b')]=qs[_0x1161('0x4c')](_0x22bd16['query'][_0x1161('0x4c')]);_0x546634[_0x1161('0x4d')]=qs[_0x1161('0x45')](_[_0x1161('0x4e')](_0x22bd16[_0x1161('0x43')],_0x510ba0[_0x1161('0x45')]));_0x546634[_0x1161('0x4d')][_0x1161('0x62')]=_0x3a98d3['id'];if(_0x22bd16[_0x1161('0x43')][_0x1161('0x4f')]){_0x546634['where']=_[_0x1161('0x50')](_0x546634[_0x1161('0x4d')],{'$or':_[_0x1161('0x3e')](_0x546634[_0x1161('0x48')],function(_0x3610f3){var _0x2dc273={};_0x2dc273[_0x3610f3]={'$like':'%'+_0x22bd16['query'][_0x1161('0x4f')]+'%'};return _0x2dc273;})});}_0x546634=_['merge']({},_0x546634,_0x22bd16['options']);return db['ChatOfflineMessage'][_0x1161('0x2f')]({'where':_0x546634[_0x1161('0x4d')]})[_0x1161('0x21')](function(_0xaa4d36){_0x5c16c8[_0x1161('0x2f')]=_0xaa4d36;if(_0x22bd16['query'][_0x1161('0x52')]){_0x546634[_0x1161('0x53')]=[{'all':!![]}];}else{_0x546634[_0x1161('0x53')]=[{'model':db[_0x1161('0x98')],'as':_0x1161('0xef'),'required':![]},{'model':db['Attachment'],'as':'Attachments','required':![]}];}return db[_0x1161('0xcd')][_0x1161('0x54')](_0x546634);})[_0x1161('0x21')](function(_0x4e377f){_0x5c16c8[_0x1161('0x55')]=_0x4e377f;return _0x5c16c8;});}})[_0x1161('0x21')](respondWithFilteredResult(_0x2befbc,_0x546634))['catch'](handleError(_0x2befbc,null));};exports[_0x1161('0x11f')]=function(_0x1ad748,_0x3a8fef,_0x65b76b){return db[_0x1161('0x3f')][_0x1161('0x57')]({'where':{'id':_0x1ad748[_0x1161('0x61')]['id']}})[_0x1161('0x21')](handleEntityNotFound(_0x3a8fef,null))[_0x1161('0x21')](function(_0xdfe662){if(_0xdfe662){return _0xdfe662['addAgents'](_0x1ad748[_0x1161('0x5e')][_0x1161('0x67')],_[_0x1161('0xee')](_0x1ad748['body'],['ids','id'])||{})[_0x1161('0xb7')](function(_0x37137b){for(var _0x5f269a=0x0;_0x5f269a<_0x1ad748[_0x1161('0x5e')][_0x1161('0x67')][_0x1161('0x49')];_0x5f269a+=0x1){socket[_0x1161('0x120')](_0x1161('0x121'),{'UserId':Number(_0x1ad748['body']['ids'][_0x5f269a]),'ChatWebsiteId':Number(_0x1ad748[_0x1161('0x61')]['id'])});}return _0x37137b;});}})[_0x1161('0x21')](respondWithResult(_0x3a8fef,null))[_0x1161('0x2a')](handleError(_0x3a8fef,null));};exports[_0x1161('0x122')]=function(_0x17fe33,_0xa24871,_0x5eb20f){return db[_0x1161('0x3f')][_0x1161('0x57')]({'where':{'id':_0x17fe33[_0x1161('0x61')]['id']}})[_0x1161('0x21')](handleEntityNotFound(_0xa24871,null))[_0x1161('0x21')](function(_0x343831){if(_0x343831){return _0x343831[_0x1161('0x122')](_0x17fe33[_0x1161('0x43')][_0x1161('0x67')])[_0x1161('0x21')](function(){if(_['isArray'](_0x17fe33[_0x1161('0x43')][_0x1161('0x67')])){for(var _0x2089ee=0x0;_0x2089ee<_0x17fe33['query'][_0x1161('0x67')][_0x1161('0x49')];_0x2089ee+=0x1){socket[_0x1161('0x120')]('userChatWebsite:remove',{'UserId':Number(_0x17fe33[_0x1161('0x43')][_0x1161('0x67')][_0x2089ee]),'ChatWebsiteId':Number(_0x17fe33['params']['id'])});}}else{socket[_0x1161('0x120')](_0x1161('0x123'),{'UserId':Number(_0x17fe33[_0x1161('0x43')][_0x1161('0x67')]),'ChatWebsiteId':Number(_0x17fe33[_0x1161('0x61')]['id'])});}});}})[_0x1161('0x21')](respondWithStatusCode(_0xa24871,null))[_0x1161('0x2a')](handleError(_0xa24871,null));};exports['getAgents']=function(_0xddee4,_0x2abc95,_0x1bec29){var _0x338fb2={};var _0x349062={};var _0x4420b6;var _0x56bfee;return db[_0x1161('0x3f')][_0x1161('0x6a')]({'where':{'id':_0xddee4['params']['id']}})[_0x1161('0x21')](handleEntityNotFound(_0x2abc95,null))['then'](function(_0x2ee552){if(_0x2ee552){_0x4420b6=_0x2ee552;_0x349062[_0x1161('0x42')]=_[_0x1161('0x44')](db['User'][_0x1161('0x56')]);_0x349062[_0x1161('0x43')]=_[_0x1161('0x44')](_0xddee4['query']);_0x349062[_0x1161('0x45')]=_['intersection'](_0x349062[_0x1161('0x42')],_0x349062[_0x1161('0x43')]);_0x338fb2[_0x1161('0x48')]=_[_0x1161('0x46')](_0x349062[_0x1161('0x42')],qs[_0x1161('0x47')](_0xddee4['query'][_0x1161('0x47')]));_0x338fb2['attributes']=_0x338fb2[_0x1161('0x48')]['length']?_0x338fb2[_0x1161('0x48')]:_0x349062[_0x1161('0x42')];_0x338fb2[_0x1161('0x4b')]=qs[_0x1161('0x4c')](_0xddee4[_0x1161('0x43')][_0x1161('0x4c')]);_0x338fb2[_0x1161('0x4d')]=qs[_0x1161('0x45')](_[_0x1161('0x4e')](_0xddee4[_0x1161('0x43')],_0x349062[_0x1161('0x45')]));if(_0xddee4[_0x1161('0x43')][_0x1161('0x4f')]){_0x338fb2[_0x1161('0x4d')]=_[_0x1161('0x50')](_0x338fb2[_0x1161('0x4d')],{'$or':_[_0x1161('0x3e')](_0x338fb2[_0x1161('0x48')],function(_0x7aedf4){var _0x29f1e2={};_0x29f1e2[_0x7aedf4]={'$like':'%'+_0xddee4['query'][_0x1161('0x4f')]+'%'};return _0x29f1e2;})});}_0x338fb2=_[_0x1161('0x50')]({},_0x338fb2,_0xddee4[_0x1161('0x51')]);return _0x4420b6['getAgents'](_0x338fb2);}})[_0x1161('0x21')](function(_0x1a5a22){if(_0x1a5a22){_0x56bfee=_0x1a5a22[_0x1161('0x49')];if(!_0xddee4[_0x1161('0x43')][_0x1161('0x4a')](_0x1161('0x65'))){_0x338fb2[_0x1161('0x2e')]=qs[_0x1161('0x2e')](_0xddee4[_0x1161('0x43')][_0x1161('0x2e')]);_0x338fb2[_0x1161('0x30')]=qs[_0x1161('0x30')](_0xddee4[_0x1161('0x43')]['offset']);}return _0x4420b6['getAgents'](_0x338fb2);}})[_0x1161('0x21')](function(_0x2cdf0b){if(_0x2cdf0b){return _0x2cdf0b?{'count':_0x56bfee,'rows':_0x2cdf0b}:null;}})[_0x1161('0x21')](respondWithResult(_0x2abc95,null))[_0x1161('0x2a')](handleError(_0x2abc95,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index b88c1c6..1a3c8f1 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 _0xf483=['hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xf483,0xf2));var _0x3f48=function(_0x27a586,_0x1abb65){_0x27a586=_0x27a586-0x0;var _0x3e7cb5=_0xf483[_0x27a586];return _0x3e7cb5;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x3f48('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x3f48('0x1')](0x0);var events={'afterCreate':_0x3f48('0x2'),'afterUpdate':_0x3f48('0x3'),'afterDestroy':_0x3f48('0x4')};function emitEvent(_0x169391){return function(_0x312d9c,_0x5deb61,_0x49f64a){ChatWebsiteEvents['emit'](_0x169391+':'+_0x312d9c['id'],_0x312d9c);ChatWebsiteEvents[_0x3f48('0x5')](_0x169391,_0x312d9c);_0x49f64a(null);};}for(var e in events){if(events[_0x3f48('0x6')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0x3f48('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0x7f90=['save','emit','hasOwnProperty','hook','events','../../mysqldb','ChatWebsite','setMaxListeners'];(function(_0x485feb,_0x4687f9){var _0x3013fd=function(_0x247283){while(--_0x247283){_0x485feb['push'](_0x485feb['shift']());}};_0x3013fd(++_0x4687f9);}(_0x7f90,0xf4));var _0x07f9=function(_0x14d6bb,_0x388b8e){_0x14d6bb=_0x14d6bb-0x0;var _0x191d22=_0x7f90[_0x14d6bb];return _0x191d22;};'use strict';var EventEmitter=require(_0x07f9('0x0'));var ChatWebsite=require(_0x07f9('0x1'))['db'][_0x07f9('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x07f9('0x3')](0x0);var events={'afterCreate':_0x07f9('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x15b548){return function(_0x132ae4,_0x574e7d,_0x36a0f1){ChatWebsiteEvents[_0x07f9('0x5')](_0x15b548+':'+_0x132ae4['id'],_0x132ae4);ChatWebsiteEvents[_0x07f9('0x5')](_0x15b548,_0x132ae4);_0x36a0f1(null);};}for(var e in events){if(events[_0x07f9('0x6')](e)){var event=events[e];ChatWebsite[_0x07f9('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 914e71b..0df0de5 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 _0x9f64=['chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f64,0x10f));var _0x49f6=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0x9f64[_0x383356];return _0x32ee5a;};'use strict';var _=require(_0x49f6('0x0'));var util=require(_0x49f6('0x1'));var logger=require(_0x49f6('0x2'))(_0x49f6('0x3'));var moment=require(_0x49f6('0x4'));var BPromise=require(_0x49f6('0x5'));var rp=require(_0x49f6('0x6'));var fs=require('fs');var path=require(_0x49f6('0x7'));var rimraf=require(_0x49f6('0x8'));var config=require(_0x49f6('0x9'));var attributes=require(_0x49f6('0xa'));module[_0x49f6('0xb')]=function(_0x4ed5e3,_0x3921a){return _0x4ed5e3[_0x49f6('0xc')](_0x49f6('0xd'),attributes,{'tableName':_0x49f6('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x115b=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','util','../../config/logger','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x115b,0x69));var _0xb115=function(_0x581122,_0x4aa990){_0x581122=_0x581122-0x0;var _0x29c9f4=_0x115b[_0x581122];return _0x29c9f4;};'use strict';var _=require('lodash');var util=require(_0xb115('0x0'));var logger=require(_0xb115('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb115('0x2'));var rp=require(_0xb115('0x3'));var fs=require('fs');var path=require(_0xb115('0x4'));var rimraf=require(_0xb115('0x5'));var config=require(_0xb115('0x6'));var attributes=require(_0xb115('0x7'));module[_0xb115('0x8')]=function(_0x3ad1f8,_0x575258){return _0x3ad1f8[_0xb115('0x9')](_0xb115('0xa'),attributes,{'tableName':_0xb115('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 90b84c6..6d84ed6 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 _0x1f3f=['register','request','info','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket'];(function(_0x34c786,_0x37e6ea){var _0x27b0e4=function(_0x1ecb56){while(--_0x1ecb56){_0x34c786['push'](_0x34c786['shift']());}};_0x27b0e4(++_0x37e6ea);}(_0x1f3f,0xff));var _0xf1f3=function(_0x2265da,_0xfbbd2e){_0x2265da=_0x2265da-0x0;var _0x430c2b=_0x1f3f[_0x2265da];return _0x430c2b;};'use strict';var _=require('lodash');var util=require(_0xf1f3('0x0'));var moment=require(_0xf1f3('0x1'));var BPromise=require(_0xf1f3('0x2'));var rs=require(_0xf1f3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf1f3('0x4'))['db'];var utils=require(_0xf1f3('0x5'));var logger=require('../../config/logger')(_0xf1f3('0x6'));var config=require(_0xf1f3('0x7'));var jayson=require(_0xf1f3('0x8'));var client=jayson[_0xf1f3('0x9')][_0xf1f3('0xa')]({'port':0x232a});config[_0xf1f3('0xb')]=_[_0xf1f3('0xc')](config[_0xf1f3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf1f3('0xd'))(new Redis(config['redis']));require(_0xf1f3('0xe'))[_0xf1f3('0xf')](socket);function respondWithRpcPromise(_0x4e6805,_0x40dfd1,_0x3a7005){return new BPromise(function(_0x3d38f4,_0x126660){return client[_0xf1f3('0x10')](_0x4e6805,_0x3a7005)['then'](function(_0x2aeb2c){logger[_0xf1f3('0x11')](_0xf1f3('0x12'),_0x40dfd1,'request\x20sent');logger[_0xf1f3('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x40dfd1,_0xf1f3('0x14'),JSON[_0xf1f3('0x15')](_0x2aeb2c));if(_0x2aeb2c[_0xf1f3('0x16')]){if(_0x2aeb2c[_0xf1f3('0x16')][_0xf1f3('0x17')]===0x1f4){logger[_0xf1f3('0x16')](_0xf1f3('0x12'),_0x40dfd1,_0x2aeb2c[_0xf1f3('0x16')][_0xf1f3('0x18')]);return _0x126660(_0x2aeb2c['error'][_0xf1f3('0x18')]);}logger['error'](_0xf1f3('0x12'),_0x40dfd1,_0x2aeb2c[_0xf1f3('0x16')][_0xf1f3('0x18')]);return _0x3d38f4(_0x2aeb2c[_0xf1f3('0x16')][_0xf1f3('0x18')]);}else{logger[_0xf1f3('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x40dfd1,_0xf1f3('0x14'));_0x3d38f4(_0x2aeb2c[_0xf1f3('0x19')][_0xf1f3('0x18')]);}})[_0xf1f3('0x1a')](function(_0x19af87){logger[_0xf1f3('0x16')](_0xf1f3('0x12'),_0x40dfd1,_0x19af87);_0x126660(_0x19af87);});});} \ No newline at end of file +var _0x4f1b=['error','code','message','catch','util','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','redis','defaults','localhost','./chatWebsite.socket','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x4f1b,0x14e));var _0xb4f1=function(_0xc63576,_0x11e9c3){_0xc63576=_0xc63576-0x0;var _0x219214=_0x4f1b[_0xc63576];return _0x219214;};'use strict';var _=require('lodash');var util=require(_0xb4f1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb4f1('0x1'));var fs=require('fs');var Redis=require(_0xb4f1('0x2'));var db=require(_0xb4f1('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb4f1('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xb4f1('0x5')][_0xb4f1('0x6')]({'port':0x232a});config[_0xb4f1('0x7')]=_[_0xb4f1('0x8')](config[_0xb4f1('0x7')],{'host':_0xb4f1('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb4f1('0xa'))['register'](socket);function respondWithRpcPromise(_0x464ea9,_0x12c035,_0x4b016f){return new BPromise(function(_0xb393b1,_0x189111){return client[_0xb4f1('0xb')](_0x464ea9,_0x4b016f)['then'](function(_0x63e69c){logger[_0xb4f1('0xc')](_0xb4f1('0xd'),_0x12c035,_0xb4f1('0xe'));logger[_0xb4f1('0xf')](_0xb4f1('0x10'),_0x12c035,_0xb4f1('0xe'),JSON[_0xb4f1('0x11')](_0x63e69c));if(_0x63e69c[_0xb4f1('0x12')]){if(_0x63e69c[_0xb4f1('0x12')][_0xb4f1('0x13')]===0x1f4){logger['error'](_0xb4f1('0xd'),_0x12c035,_0x63e69c[_0xb4f1('0x12')][_0xb4f1('0x14')]);return _0x189111(_0x63e69c[_0xb4f1('0x12')]['message']);}logger[_0xb4f1('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x12c035,_0x63e69c[_0xb4f1('0x12')][_0xb4f1('0x14')]);return _0xb393b1(_0x63e69c[_0xb4f1('0x12')][_0xb4f1('0x14')]);}else{logger['info'](_0xb4f1('0xd'),_0x12c035,_0xb4f1('0xe'));_0xb393b1(_0x63e69c['result'][_0xb4f1('0x14')]);}})[_0xb4f1('0x15')](function(_0xd34824){logger['error'](_0xb4f1('0xd'),_0x12c035,_0xd34824);_0x189111(_0xd34824);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c8ff6e1..53b5c4d 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 _0x9e38=['register','chatWebsite:','./chatWebsite.events','save','remove','update','emit','removeListener'];(function(_0x54f493,_0x385811){var _0x5f2b47=function(_0x2d2323){while(--_0x2d2323){_0x54f493['push'](_0x54f493['shift']());}};_0x5f2b47(++_0x385811);}(_0x9e38,0x9a));var _0x89e3=function(_0x5743e3,_0x4a2aab){_0x5743e3=_0x5743e3-0x0;var _0x24d100=_0x9e38[_0x5743e3];return _0x24d100;};'use strict';var ChatWebsiteEvents=require(_0x89e3('0x0'));var events=[_0x89e3('0x1'),_0x89e3('0x2'),_0x89e3('0x3')];function createListener(_0x132361,_0x26edb8){return function(_0x4d26e6){_0x26edb8[_0x89e3('0x4')](_0x132361,_0x4d26e6);};}function removeListener(_0x1da194,_0xf23c36){return function(){ChatWebsiteEvents[_0x89e3('0x5')](_0x1da194,_0xf23c36);};}exports[_0x89e3('0x6')]=function(_0x5e5462){for(var _0x59fa03=0x0,_0x5876b9=events['length'];_0x59fa03<_0x5876b9;_0x59fa03++){var _0x5c58fa=events[_0x59fa03];var _0x1f244d=createListener(_0x89e3('0x7')+_0x5c58fa,_0x5e5462);ChatWebsiteEvents['on'](_0x5c58fa,_0x1f244d);}}; \ No newline at end of file +var _0x04cf=['./chatWebsite.events','save','remove','update','emit','removeListener','length','chatWebsite:'];(function(_0x25f3db,_0x29ccc6){var _0x2d5f2a=function(_0x29cf23){while(--_0x29cf23){_0x25f3db['push'](_0x25f3db['shift']());}};_0x2d5f2a(++_0x29ccc6);}(_0x04cf,0x78));var _0xf04c=function(_0x42c995,_0x5e4e67){_0x42c995=_0x42c995-0x0;var _0x34f4d8=_0x04cf[_0x42c995];return _0x34f4d8;};'use strict';var ChatWebsiteEvents=require(_0xf04c('0x0'));var events=[_0xf04c('0x1'),_0xf04c('0x2'),_0xf04c('0x3')];function createListener(_0x151161,_0x487d98){return function(_0x49858d){_0x487d98[_0xf04c('0x4')](_0x151161,_0x49858d);};}function removeListener(_0x2a159e,_0x186fc1){return function(){ChatWebsiteEvents[_0xf04c('0x5')](_0x2a159e,_0x186fc1);};}exports['register']=function(_0x5e3ab5){for(var _0x478f05=0x0,_0x5e0aae=events[_0xf04c('0x6')];_0x478f05<_0x5e0aae;_0x478f05++){var _0x22ebea=events[_0x478f05];var _0x272661=createListener(_0xf04c('0x7')+_0x22ebea,_0x5e3ab5);ChatWebsiteEvents['on'](_0x22ebea,_0x272661);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 40f8e35..e725ac2 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 _0x0997=['../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','/describe','get','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','server/files/images/avatars/','addAvatar','/:id/customer_avatar','addSystemAvatar','notify','server/files','ensureDir','replace','extname','/:id/offline','any','addApplications','addAgents','put','update','destroy','removeDispositions','delete','exports','multer','path','fs-extra','../../components/auth/service'];(function(_0x4f98f2,_0x35d270){var _0x595a12=function(_0x1c34e5){while(--_0x1c34e5){_0x4f98f2['push'](_0x4f98f2['shift']());}};_0x595a12(++_0x35d270);}(_0x0997,0x84));var _0x7099=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0997[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x7099('0x0'));var util=require('util');var path=require(_0x7099('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7099('0x2'));var auth=require(_0x7099('0x3'));var interaction=require(_0x7099('0x4'));var config=require(_0x7099('0x5'));var controller=require(_0x7099('0x6'));router['get']('/',auth[_0x7099('0x7')](),controller['index']);router['get'](_0x7099('0x8'),auth[_0x7099('0x7')](),controller['describe']);router[_0x7099('0x9')](_0x7099('0xa'),auth[_0x7099('0x7')](),controller['show']);router[_0x7099('0x9')](_0x7099('0xb'),auth[_0x7099('0x7')](),controller[_0x7099('0xc')]);router[_0x7099('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x7099('0xd')]);router[_0x7099('0x9')](_0x7099('0xe'),controller[_0x7099('0xf')]);router[_0x7099('0x9')](_0x7099('0x10'),controller[_0x7099('0x11')]);router['get']('/:id/customer_avatar',controller[_0x7099('0x12')]);router['get'](_0x7099('0x13'),controller[_0x7099('0x14')]);router[_0x7099('0x9')](_0x7099('0x15'),auth[_0x7099('0x7')](),controller[_0x7099('0x16')]);router[_0x7099('0x9')](_0x7099('0x17'),controller[_0x7099('0x18')]);router[_0x7099('0x9')](_0x7099('0x19'),auth['isAuthenticated'](),controller[_0x7099('0x1a')]);router[_0x7099('0x9')]('/:id/proactive_actions',auth[_0x7099('0x7')](),controller[_0x7099('0x1b')]);router[_0x7099('0x9')](_0x7099('0x1c'),controller['getFields']);router['get'](_0x7099('0x1d'),auth[_0x7099('0x7')](),controller[_0x7099('0x1e')]);router[_0x7099('0x9')](_0x7099('0x1f'),auth[_0x7099('0x7')](),controller[_0x7099('0x20')]);router[_0x7099('0x21')]('/',auth['isAuthenticated'](),controller[_0x7099('0x22')]);router[_0x7099('0x21')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x7099('0x23')]);router['post'](_0x7099('0x24'),auth['isAuthenticated'](),controller[_0x7099('0x25')]);var upload=multer({'storage':multer[_0x7099('0x26')]({'destination':function(_0x476a35,_0x27d96b,_0x54d13d){_0x54d13d(null,path[_0x7099('0x27')](config[_0x7099('0x28')],_0x7099('0x29')));},'filename':function(_0x586c92,_0x382f2,_0x584e5b){_0x584e5b(null,util[_0x7099('0x2a')](_0x7099('0x2b'),Date[_0x7099('0x2c')](),_0x382f2[_0x7099('0x2d')]));}})});router[_0x7099('0x21')](_0x7099('0xe'),upload[_0x7099('0x2e')](_0x7099('0x2f')),controller[_0x7099('0x30')]);var upload=multer({'storage':multer[_0x7099('0x26')]({'destination':function(_0x53b704,_0x21d730,_0x10417b){_0x10417b(null,path[_0x7099('0x27')](config[_0x7099('0x28')],_0x7099('0x31')));},'filename':function(_0x154538,_0x5c9537,_0x38ecd5){_0x38ecd5(null,util[_0x7099('0x2a')](_0x7099('0x2b'),Date[_0x7099('0x2c')](),_0x5c9537[_0x7099('0x2d')]));}})});router['post'](_0x7099('0x10'),upload[_0x7099('0x2e')](_0x7099('0x2f')),controller[_0x7099('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x43050a,_0x36036b,_0xb7d6c6){_0xb7d6c6(null,path['join'](config[_0x7099('0x28')],'server/files/images/avatars/'));},'filename':function(_0xd5cc1e,_0x587721,_0x3ce657){_0x3ce657(null,util[_0x7099('0x2a')](_0x7099('0x2b'),Date[_0x7099('0x2c')](),_0x587721['originalname']));}})});router[_0x7099('0x21')](_0x7099('0x33'),upload[_0x7099('0x2e')](_0x7099('0x2f')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x7099('0x26')]({'destination':function(_0x305db7,_0x45266f,_0x45b4b6){_0x45b4b6(null,path[_0x7099('0x27')](config['root'],_0x7099('0x31')));},'filename':function(_0x53827f,_0x4e78ba,_0x264b1e){_0x264b1e(null,util[_0x7099('0x2a')](_0x7099('0x2b'),Date[_0x7099('0x2c')](),_0x4e78ba[_0x7099('0x2d')]));}})});router['post'](_0x7099('0x13'),upload[_0x7099('0x2e')](_0x7099('0x2f')),controller[_0x7099('0x34')]);router[_0x7099('0x21')]('/:id/notify',controller[_0x7099('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x7099('0x26')]({'destination':function(_0x17f97d,_0x2c1e77,_0x368b16){const _0x372ae3=path[_0x7099('0x27')](config[_0x7099('0x28')],_0x7099('0x36'),'attachments','offline-chat');fs_extra[_0x7099('0x37')](_0x372ae3,function(){_0x368b16(null,_0x372ae3);});},'filename':function(_0x3f48bb,_0xdc2610,_0x412d90){const _0x294ca6=_0xdc2610['originalname'][_0x7099('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5327a3=path[_0x7099('0x39')](_0x294ca6);const _0x417897=Date[_0x7099('0x2c')]()+'-'+_0x294ca6[_0x7099('0x38')](_0x5327a3,'')+_0x5327a3;_0x412d90(null,_0x417897);}})});router[_0x7099('0x21')](_0x7099('0x3a'),offlineUploadMulter[_0x7099('0x3b')](),controller['offline']);router['post'](_0x7099('0x15'),auth[_0x7099('0x7')](),controller['addInteraction']);router['post'](_0x7099('0x19'),auth['isAuthenticated'](),controller[_0x7099('0x3c')]);router[_0x7099('0x21')]('/:id/proactive_actions',auth[_0x7099('0x7')](),controller['addProactiveActions']);router[_0x7099('0x21')](_0x7099('0x1f'),auth[_0x7099('0x7')](),controller[_0x7099('0x3d')]);router[_0x7099('0x3e')](_0x7099('0xa'),auth[_0x7099('0x7')](),controller[_0x7099('0x3f')]);router['delete'](_0x7099('0xa'),auth[_0x7099('0x7')](),controller[_0x7099('0x40')]);router['delete'](_0x7099('0xb'),auth['isAuthenticated'](),controller[_0x7099('0x41')]);router[_0x7099('0x42')](_0x7099('0x24'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x7099('0x42')]('/:id/users',auth[_0x7099('0x7')](),controller['removeAgents']);module[_0x7099('0x43')]=router; \ No newline at end of file +var _0xea71=['addCustomerAvatar','addSystemAvatar','/:id/notify','notify','offline-chat','ensureDir','replace','extname','any','offline','addInteraction','/:id/applications','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','get','/:id/canned_answers','getAnswers','getLogo','getAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','getProactiveActions','/:id/fields','getFields','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','now','originalname','/:id/logo','single','file','/:id/avatar','addAvatar','server/files/images/avatars/','format','%s-%s','/:id/customer_avatar'];(function(_0x3712e2,_0x32d752){var _0x1faff4=function(_0x550dc0){while(--_0x550dc0){_0x3712e2['push'](_0x3712e2['shift']());}};_0x1faff4(++_0x32d752);}(_0xea71,0x194));var _0x1ea7=function(_0x14a56c,_0xe8b935){_0x14a56c=_0x14a56c-0x0;var _0xddfeb3=_0xea71[_0x14a56c];return _0xddfeb3;};'use strict';var multer=require(_0x1ea7('0x0'));var util=require(_0x1ea7('0x1'));var path=require(_0x1ea7('0x2'));var timeout=require(_0x1ea7('0x3'));var express=require('express');var router=express[_0x1ea7('0x4')]();var fs_extra=require(_0x1ea7('0x5'));var auth=require(_0x1ea7('0x6'));var interaction=require(_0x1ea7('0x7'));var config=require(_0x1ea7('0x8'));var controller=require(_0x1ea7('0x9'));router['get']('/',auth[_0x1ea7('0xa')](),controller[_0x1ea7('0xb')]);router['get']('/describe',auth[_0x1ea7('0xa')](),controller[_0x1ea7('0xc')]);router['get'](_0x1ea7('0xd'),auth['isAuthenticated'](),controller[_0x1ea7('0xe')]);router['get'](_0x1ea7('0xf'),auth[_0x1ea7('0xa')](),controller[_0x1ea7('0x10')]);router[_0x1ea7('0x11')](_0x1ea7('0x12'),auth[_0x1ea7('0xa')](),controller[_0x1ea7('0x13')]);router[_0x1ea7('0x11')]('/:id/logo',controller[_0x1ea7('0x14')]);router[_0x1ea7('0x11')]('/:id/avatar',controller[_0x1ea7('0x15')]);router[_0x1ea7('0x11')]('/:id/customer_avatar',controller['getCustomerAvatar']);router['get'](_0x1ea7('0x16'),controller['getSystemAvatar']);router[_0x1ea7('0x11')](_0x1ea7('0x17'),auth['isAuthenticated'](),controller[_0x1ea7('0x18')]);router[_0x1ea7('0x11')](_0x1ea7('0x19'),controller[_0x1ea7('0x1a')]);router[_0x1ea7('0x11')]('/:id/applications',auth[_0x1ea7('0xa')](),controller[_0x1ea7('0x1b')]);router[_0x1ea7('0x11')]('/:id/proactive_actions',auth[_0x1ea7('0xa')](),controller[_0x1ea7('0x1c')]);router[_0x1ea7('0x11')](_0x1ea7('0x1d'),controller[_0x1ea7('0x1e')]);router[_0x1ea7('0x11')]('/:id/offline_messages',auth[_0x1ea7('0xa')](),controller[_0x1ea7('0x1f')]);router[_0x1ea7('0x11')](_0x1ea7('0x20'),auth[_0x1ea7('0xa')](),controller['getAgents']);router[_0x1ea7('0x21')]('/',auth[_0x1ea7('0xa')](),controller[_0x1ea7('0x22')]);router[_0x1ea7('0x21')](_0x1ea7('0xf'),auth[_0x1ea7('0xa')](),controller[_0x1ea7('0x23')]);router[_0x1ea7('0x21')]('/:id/canned_answers',auth[_0x1ea7('0xa')](),controller[_0x1ea7('0x24')]);var upload=multer({'storage':multer[_0x1ea7('0x25')]({'destination':function(_0x2f1e19,_0x2a9e9d,_0x157649){_0x157649(null,path[_0x1ea7('0x26')](config[_0x1ea7('0x27')],_0x1ea7('0x28')));},'filename':function(_0x397c53,_0x3939f9,_0x6199c){_0x6199c(null,util['format']('%s-%s',Date[_0x1ea7('0x29')](),_0x3939f9[_0x1ea7('0x2a')]));}})});router[_0x1ea7('0x21')](_0x1ea7('0x2b'),upload[_0x1ea7('0x2c')](_0x1ea7('0x2d')),controller['addLogo']);var upload=multer({'storage':multer[_0x1ea7('0x25')]({'destination':function(_0xdacbd0,_0x2eb25a,_0x4a31a1){_0x4a31a1(null,path[_0x1ea7('0x26')](config[_0x1ea7('0x27')],'server/files/images/avatars/'));},'filename':function(_0x914a21,_0x1a82b7,_0x4eab0d){_0x4eab0d(null,util['format']('%s-%s',Date[_0x1ea7('0x29')](),_0x1a82b7[_0x1ea7('0x2a')]));}})});router[_0x1ea7('0x21')](_0x1ea7('0x2e'),upload[_0x1ea7('0x2c')](_0x1ea7('0x2d')),controller[_0x1ea7('0x2f')]);var upload=multer({'storage':multer[_0x1ea7('0x25')]({'destination':function(_0x140e3b,_0x3d6535,_0x5b36f9){_0x5b36f9(null,path[_0x1ea7('0x26')](config[_0x1ea7('0x27')],_0x1ea7('0x30')));},'filename':function(_0xf83b0c,_0x2afccb,_0x39b4b9){_0x39b4b9(null,util[_0x1ea7('0x31')](_0x1ea7('0x32'),Date[_0x1ea7('0x29')](),_0x2afccb['originalname']));}})});router[_0x1ea7('0x21')](_0x1ea7('0x33'),upload['single'](_0x1ea7('0x2d')),controller[_0x1ea7('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x33d29b,_0x907948,_0x138569){_0x138569(null,path['join'](config['root'],_0x1ea7('0x30')));},'filename':function(_0x2cb772,_0x39c3ba,_0x5e6db3){_0x5e6db3(null,util['format']('%s-%s',Date[_0x1ea7('0x29')](),_0x39c3ba[_0x1ea7('0x2a')]));}})});router[_0x1ea7('0x21')]('/:id/system_avatar',upload[_0x1ea7('0x2c')](_0x1ea7('0x2d')),controller[_0x1ea7('0x35')]);router[_0x1ea7('0x21')](_0x1ea7('0x36'),controller[_0x1ea7('0x37')]);const offlineUploadMulter=multer({'storage':multer[_0x1ea7('0x25')]({'destination':function(_0x1aaab3,_0x57bc33,_0x1ff249){const _0x36405b=path['join'](config[_0x1ea7('0x27')],'server/files','attachments',_0x1ea7('0x38'));fs_extra[_0x1ea7('0x39')](_0x36405b,function(){_0x1ff249(null,_0x36405b);});},'filename':function(_0x2985f4,_0x1f2e8d,_0x40ece7){const _0x256b7f=_0x1f2e8d['originalname'][_0x1ea7('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2fe490=path[_0x1ea7('0x3b')](_0x256b7f);const _0x31f2ce=Date[_0x1ea7('0x29')]()+'-'+_0x256b7f[_0x1ea7('0x3a')](_0x2fe490,'')+_0x2fe490;_0x40ece7(null,_0x31f2ce);}})});router[_0x1ea7('0x21')]('/:id/offline',offlineUploadMulter[_0x1ea7('0x3c')](),controller[_0x1ea7('0x3d')]);router[_0x1ea7('0x21')]('/:id/interactions',auth[_0x1ea7('0xa')](),controller[_0x1ea7('0x3e')]);router[_0x1ea7('0x21')](_0x1ea7('0x3f'),auth['isAuthenticated'](),controller[_0x1ea7('0x40')]);router[_0x1ea7('0x21')](_0x1ea7('0x41'),auth[_0x1ea7('0xa')](),controller[_0x1ea7('0x42')]);router[_0x1ea7('0x21')]('/:id/users',auth['isAuthenticated'](),controller[_0x1ea7('0x43')]);router[_0x1ea7('0x44')](_0x1ea7('0xd'),auth[_0x1ea7('0xa')](),controller[_0x1ea7('0x45')]);router[_0x1ea7('0x46')](_0x1ea7('0xd'),auth[_0x1ea7('0xa')](),controller[_0x1ea7('0x47')]);router[_0x1ea7('0x46')](_0x1ea7('0xf'),auth['isAuthenticated'](),controller[_0x1ea7('0x48')]);router[_0x1ea7('0x46')](_0x1ea7('0x12'),auth[_0x1ea7('0xa')](),controller[_0x1ea7('0x49')]);router[_0x1ea7('0x46')]('/:id/users',auth['isAuthenticated'](),controller[_0x1ea7('0x4a')]);module[_0x1ea7('0x4b')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 2250960..e56cf97 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 _0xb7a7=['sequelize','exports','STRING','ENUM','AmazonAWS'];(function(_0x112f64,_0x4c1f52){var _0x49975e=function(_0x263fac){while(--_0x263fac){_0x112f64['push'](_0x112f64['shift']());}};_0x49975e(++_0x4c1f52);}(_0xb7a7,0x6e));var _0x7b7a=function(_0x263892,_0x53d698){_0x263892=_0x263892-0x0;var _0x120a9c=_0xb7a7[_0x263892];return _0x120a9c;};'use strict';var Sequelize=require(_0x7b7a('0x0'));module[_0x7b7a('0x1')]={'name':{'type':Sequelize[_0x7b7a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x7b7a('0x3')](_0x7b7a('0x4'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x7b7a('0x2')]}}; \ No newline at end of file +var _0xd307=['AmazonAWS','Google','sequelize','exports','STRING','ENUM'];(function(_0x584fce,_0x37bd52){var _0x577006=function(_0x3ff9c9){while(--_0x3ff9c9){_0x584fce['push'](_0x584fce['shift']());}};_0x577006(++_0x37bd52);}(_0xd307,0x110));var _0x7d30=function(_0x33cc9d,_0x59ad21){_0x33cc9d=_0x33cc9d-0x0;var _0x23e228=_0xd307[_0x33cc9d];return _0x23e228;};'use strict';var Sequelize=require(_0x7d30('0x0'));module[_0x7d30('0x1')]={'name':{'type':Sequelize[_0x7d30('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x7d30('0x3')](_0x7d30('0x4'),_0x7d30('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x7d30('0x2')]},'data2':{'type':Sequelize[_0x7d30('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index b9f0ef1..7897c6e 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 _0xadb5=['model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','CloudProvider','fieldName','type','key'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xadb5,0xad));var _0x5adb=function(_0x3d387b,_0x3593f7){_0x3d387b=_0x3d387b-0x0;var _0x26cbb5=_0xadb5[_0x3d387b];return _0x26cbb5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['CloudProvider']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':!![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['CloudProvider'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['CloudProvider'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));}; \ No newline at end of file +var _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','CloudProvider','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x387e84,_0x5fffe7){var _0x1add03=function(_0x52b004){while(--_0x52b004){_0x387e84['push'](_0x387e84['shift']());}};_0x1add03(++_0x5fffe7);}(_0x2ef3,0xba));var _0x32ef=function(_0x1d2c7e,_0x29f3d4){_0x1d2c7e=_0x1d2c7e-0x0;var _0x14f96a=_0x2ef3[_0x1d2c7e];return _0x14f96a;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['CloudProvider'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['CloudProvider'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['CloudProvider']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 651dbf9..6064cc7 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 _0x144d=['cloud_providers','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CloudProvider'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0x144d,0x12c));var _0xd144=function(_0x9e1193,_0x36c529){_0x9e1193=_0x9e1193-0x0;var _0x2c20a0=_0x144d[_0x9e1193];return _0x2c20a0;};'use strict';var _=require('lodash');var util=require(_0xd144('0x0'));var logger=require(_0xd144('0x1'))(_0xd144('0x2'));var moment=require(_0xd144('0x3'));var BPromise=require(_0xd144('0x4'));var rp=require(_0xd144('0x5'));var fs=require('fs');var path=require(_0xd144('0x6'));var rimraf=require(_0xd144('0x7'));var config=require(_0xd144('0x8'));var attributes=require('./cloudProvider.attributes');module[_0xd144('0x9')]=function(_0x218e87,_0x5bebbf){return _0x218e87[_0xd144('0xa')](_0xd144('0xb'),attributes,{'tableName':_0xd144('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ad4=['request-promise','path','rimraf','../../config/environment','CloudProvider','cloud_providers','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5a7795,_0x1976da){var _0x4446e2=function(_0x2b309c){while(--_0x2b309c){_0x5a7795['push'](_0x5a7795['shift']());}};_0x4446e2(++_0x1976da);}(_0x1ad4,0x150));var _0x41ad=function(_0x2fced0,_0x454743){_0x2fced0=_0x2fced0-0x0;var _0x25b3af=_0x1ad4[_0x2fced0];return _0x25b3af;};'use strict';var _=require(_0x41ad('0x0'));var util=require('util');var logger=require(_0x41ad('0x1'))(_0x41ad('0x2'));var moment=require(_0x41ad('0x3'));var BPromise=require(_0x41ad('0x4'));var rp=require(_0x41ad('0x5'));var fs=require('fs');var path=require(_0x41ad('0x6'));var rimraf=require(_0x41ad('0x7'));var config=require(_0x41ad('0x8'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x4cc9dd,_0x3dcdc5){return _0x4cc9dd['define'](_0x41ad('0x9'),attributes,{'tableName':_0x41ad('0xa'),'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 ff01ec0..3e37857 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 _0x4c4a=['message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4c4a,0x1d0));var _0xa4c4=function(_0x1262fe,_0x2b63d6){_0x1262fe=_0x1262fe-0x0;var _0x117279=_0x4c4a[_0x1262fe];return _0x117279;};'use strict';var _=require(_0xa4c4('0x0'));var util=require(_0xa4c4('0x1'));var moment=require(_0xa4c4('0x2'));var BPromise=require('bluebird');var rs=require(_0xa4c4('0x3'));var fs=require('fs');var Redis=require(_0xa4c4('0x4'));var db=require(_0xa4c4('0x5'))['db'];var utils=require(_0xa4c4('0x6'));var logger=require('../../config/logger')(_0xa4c4('0x7'));var config=require('../../config/environment');var jayson=require(_0xa4c4('0x8'));var client=jayson[_0xa4c4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x557596,_0x11b498,_0x553525){return new BPromise(function(_0x27b877,_0x118d89){return client[_0xa4c4('0xa')](_0x557596,_0x553525)['then'](function(_0x5ec64c){logger[_0xa4c4('0xb')](_0xa4c4('0xc'),_0x11b498,_0xa4c4('0xd'));logger[_0xa4c4('0xe')](_0xa4c4('0xf'),_0x11b498,'request\x20sent',JSON[_0xa4c4('0x10')](_0x5ec64c));if(_0x5ec64c['error']){if(_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x12')]===0x1f4){logger[_0xa4c4('0x11')](_0xa4c4('0xc'),_0x11b498,_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x13')]);return _0x118d89(_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x13')]);}logger[_0xa4c4('0x11')]('CloudProvider,\x20%s,\x20%s',_0x11b498,_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x13')]);return _0x27b877(_0x5ec64c[_0xa4c4('0x11')][_0xa4c4('0x13')]);}else{logger[_0xa4c4('0xb')](_0xa4c4('0xc'),_0x11b498,_0xa4c4('0xd'));_0x27b877(_0x5ec64c['result'][_0xa4c4('0x13')]);}})[_0xa4c4('0x14')](function(_0x4b2f2d){logger[_0xa4c4('0x11')](_0xa4c4('0xc'),_0x11b498,_0x4b2f2d);_0x118d89(_0x4b2f2d);});});} \ No newline at end of file +var _0xdab3=['stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0x2dacca,_0x3b55a5){var _0x4e8745=function(_0x4c4515){while(--_0x4c4515){_0x2dacca['push'](_0x2dacca['shift']());}};_0x4e8745(++_0x3b55a5);}(_0xdab3,0xeb));var _0x3dab=function(_0xe81b53,_0x134777){_0xe81b53=_0xe81b53-0x0;var _0x8f1ba3=_0xdab3[_0xe81b53];return _0x8f1ba3;};'use strict';var _=require(_0x3dab('0x0'));var util=require(_0x3dab('0x1'));var moment=require('moment');var BPromise=require(_0x3dab('0x2'));var rs=require(_0x3dab('0x3'));var fs=require('fs');var Redis=require(_0x3dab('0x4'));var db=require(_0x3dab('0x5'))['db'];var utils=require(_0x3dab('0x6'));var logger=require(_0x3dab('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3dab('0x8'));var client=jayson[_0x3dab('0x9')][_0x3dab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x415608,_0x3bdacb,_0x2d6b5c){return new BPromise(function(_0x5ae18c,_0x46a6d7){return client[_0x3dab('0xb')](_0x415608,_0x2d6b5c)[_0x3dab('0xc')](function(_0x2ab58a){logger[_0x3dab('0xd')](_0x3dab('0xe'),_0x3bdacb,_0x3dab('0xf'));logger['debug'](_0x3dab('0x10'),_0x3bdacb,_0x3dab('0xf'),JSON[_0x3dab('0x11')](_0x2ab58a));if(_0x2ab58a[_0x3dab('0x12')]){if(_0x2ab58a[_0x3dab('0x12')]['code']===0x1f4){logger['error'](_0x3dab('0xe'),_0x3bdacb,_0x2ab58a[_0x3dab('0x12')][_0x3dab('0x13')]);return _0x46a6d7(_0x2ab58a[_0x3dab('0x12')][_0x3dab('0x13')]);}logger[_0x3dab('0x12')](_0x3dab('0xe'),_0x3bdacb,_0x2ab58a[_0x3dab('0x12')]['message']);return _0x5ae18c(_0x2ab58a[_0x3dab('0x12')][_0x3dab('0x13')]);}else{logger[_0x3dab('0xd')](_0x3dab('0xe'),_0x3bdacb,_0x3dab('0xf'));_0x5ae18c(_0x2ab58a['result']['message']);}})[_0x3dab('0x14')](function(_0x2e9933){logger[_0x3dab('0x12')](_0x3dab('0xe'),_0x3bdacb,_0x2e9933);_0x46a6d7(_0x2e9933);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 087b0a7..41d736e 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 _0xbb59=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util'];(function(_0x119fc9,_0x344319){var _0x5cea78=function(_0x9f3e6e){while(--_0x9f3e6e){_0x119fc9['push'](_0x119fc9['shift']());}};_0x5cea78(++_0x344319);}(_0xbb59,0x167));var _0x9bb5=function(_0x27169d,_0x3ef8fd){_0x27169d=_0x27169d-0x0;var _0x50c5e5=_0xbb59[_0x27169d];return _0x50c5e5;};'use strict';var multer=require('multer');var util=require(_0x9bb5('0x0'));var path=require(_0x9bb5('0x1'));var timeout=require(_0x9bb5('0x2'));var express=require(_0x9bb5('0x3'));var router=express[_0x9bb5('0x4')]();var fs_extra=require(_0x9bb5('0x5'));var auth=require(_0x9bb5('0x6'));var interaction=require(_0x9bb5('0x7'));var config=require(_0x9bb5('0x8'));var controller=require(_0x9bb5('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9bb5('0xa')](_0x9bb5('0xb'),auth[_0x9bb5('0xc')](),controller[_0x9bb5('0xd')]);router[_0x9bb5('0xe')]('/',auth[_0x9bb5('0xc')](),controller[_0x9bb5('0xf')]);router[_0x9bb5('0x10')](_0x9bb5('0xb'),auth[_0x9bb5('0xc')](),controller[_0x9bb5('0x11')]);router[_0x9bb5('0x12')](_0x9bb5('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x9bb5('0x13')]=router; \ No newline at end of file +var _0x73a1=['get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c921c,_0x16d89c){var _0x1d5cc0=function(_0x3524ff){while(--_0x3524ff){_0x1c921c['push'](_0x1c921c['shift']());}};_0x1d5cc0(++_0x16d89c);}(_0x73a1,0x161));var _0x173a=function(_0x3dfeb9,_0x1cc6e4){_0x3dfeb9=_0x3dfeb9-0x0;var _0x412314=_0x73a1[_0x3dfeb9];return _0x412314;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x173a('0x0'));var timeout=require(_0x173a('0x1'));var express=require('express');var router=express[_0x173a('0x2')]();var fs_extra=require(_0x173a('0x3'));var auth=require(_0x173a('0x4'));var interaction=require(_0x173a('0x5'));var config=require(_0x173a('0x6'));var controller=require('./cloudProvider.controller');router[_0x173a('0x7')]('/',auth[_0x173a('0x8')](),controller[_0x173a('0x9')]);router[_0x173a('0x7')](_0x173a('0xa'),auth[_0x173a('0x8')](),controller[_0x173a('0xb')]);router[_0x173a('0xc')]('/',auth[_0x173a('0x8')](),controller[_0x173a('0xd')]);router[_0x173a('0xe')](_0x173a('0xa'),auth['isAuthenticated'](),controller[_0x173a('0xf')]);router['delete'](_0x173a('0xa'),auth[_0x173a('0x8')](),controller[_0x173a('0x10')]);module[_0x173a('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 97cc4d1..5bfe4bf 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 _0x6337=['sequelize','exports','STRING'];(function(_0x313509,_0x11978a){var _0x308ab8=function(_0x4a9ceb){while(--_0x4a9ceb){_0x313509['push'](_0x313509['shift']());}};_0x308ab8(++_0x11978a);}(_0x6337,0xf0));var _0x7633=function(_0x358f71,_0x52cce1){_0x358f71=_0x358f71-0x0;var _0x1bbc91=_0x6337[_0x358f71];return _0x1bbc91;};'use strict';var Sequelize=require(_0x7633('0x0'));module[_0x7633('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x7633('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x7633('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7633('0x2')]},'street':{'type':Sequelize[_0x7633('0x2')]},'postalCode':{'type':Sequelize[_0x7633('0x2')]},'city':{'type':Sequelize[_0x7633('0x2')]},'country':{'type':Sequelize[_0x7633('0x2')]},'email':{'type':Sequelize[_0x7633('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7633('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x7633('0x2')]},'sCity':{'type':Sequelize[_0x7633('0x2')]},'sCountry':{'type':Sequelize[_0x7633('0x2')]},'description':{'type':Sequelize[_0x7633('0x2')]}}; \ No newline at end of file +var _0x1288=['STRING','name','sequelize'];(function(_0x25749f,_0x16da4b){var _0x564a7b=function(_0x29f98b){while(--_0x29f98b){_0x25749f['push'](_0x25749f['shift']());}};_0x564a7b(++_0x16da4b);}(_0x1288,0x14c));var _0x8128=function(_0x335e29,_0x398135){_0x335e29=_0x335e29-0x0;var _0xf44977=_0x1288[_0x335e29];return _0xf44977;};'use strict';var Sequelize=require(_0x8128('0x0'));module['exports']={'name':{'type':Sequelize[_0x8128('0x1')],'unique':_0x8128('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8128('0x1')]},'companyId':{'type':Sequelize[_0x8128('0x1')]},'website':{'type':Sequelize[_0x8128('0x1')]},'phone':{'type':Sequelize[_0x8128('0x1')]},'fax':{'type':Sequelize[_0x8128('0x1')]},'type':{'type':Sequelize[_0x8128('0x1')]},'street':{'type':Sequelize[_0x8128('0x1')]},'postalCode':{'type':Sequelize[_0x8128('0x1')]},'city':{'type':Sequelize[_0x8128('0x1')]},'country':{'type':Sequelize[_0x8128('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8128('0x1')]},'sStreet':{'type':Sequelize[_0x8128('0x1')]},'sPostalCode':{'type':Sequelize[_0x8128('0x1')]},'sCity':{'type':Sequelize[_0x8128('0x1')]},'sCountry':{'type':Sequelize[_0x8128('0x1')]},'description':{'type':Sequelize[_0x8128('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index fa20f0a..4a4604e 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 _0xe00a=['index','CmCompany','describe','keys','query','filters','intersection','model','fields','length','attributes','nolimit','limit','order','sort','where','pick','merge','map','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContact','addContacts','ids','omit','getContacts','findOne','hasOwnProperty','zip-dir','bluebird','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','undefined','count','offset','json','apply','save','update','then','destroy','Companies','UserProfileResource','error','stack','name','send'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0xe00a,0x7e));var _0xae00=function(_0x515288,_0x2364cf){_0x515288=_0x515288-0x0;var _0x4bd1cd=_0xe00a[_0x515288];return _0x4bd1cd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xae00('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xae00('0x1'));var Mustache=require('mustache');var util=require(_0xae00('0x2'));var path=require(_0xae00('0x3'));var sox=require(_0xae00('0x4'));var csv=require('to-csv');var ejs=require(_0xae00('0x5'));var fs=require('fs');var fs_extra=require(_0xae00('0x6'));var _=require('lodash');var squel=require(_0xae00('0x7'));var crypto=require('crypto');var jsforce=require(_0xae00('0x8'));var deskjs=require(_0xae00('0x9'));var toCsv=require(_0xae00('0xa'));var querystring=require(_0xae00('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xae00('0xc'));var as=require(_0xae00('0xd'));var hardwareService=require(_0xae00('0xe'));var logger=require('../../config/logger')(_0xae00('0xf'));var utils=require(_0xae00('0x10'));var config=require(_0xae00('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x62c26a,_0x271152){_0x271152=_0x271152||0xcc;return function(_0x55c3dc){if(_0x55c3dc){return _0x62c26a[_0xae00('0x12')](_0x271152);}return _0x62c26a['status'](_0x271152)[_0xae00('0x13')]();};}function respondWithResult(_0x2796f1,_0x28f349){_0x28f349=_0x28f349||0xc8;return function(_0x5551f7){if(_0x5551f7){return _0x2796f1[_0xae00('0x14')](_0x28f349)['json'](_0x5551f7);}};}function respondWithFilteredResult(_0x237d46,_0x5a8495){return function(_0xb9d53a){if(_0xb9d53a){var _0x1aea49=typeof _0x5a8495['offset']===_0xae00('0x15')&&typeof _0x5a8495['limit']===_0xae00('0x15');var _0x3503e3=_0xb9d53a[_0xae00('0x16')];var _0x198e0d=_0x1aea49?0x0:_0x5a8495[_0xae00('0x17')];var _0x4377ee=_0x1aea49?_0xb9d53a[_0xae00('0x16')]:_0x5a8495[_0xae00('0x17')]+_0x5a8495['limit'];var _0xb2a08e;if(_0x4377ee>=_0x3503e3){_0x4377ee=_0x3503e3;_0xb2a08e=0xc8;}else{_0xb2a08e=0xce;}_0x237d46['status'](_0xb2a08e);return _0x237d46['set']('Content-Range',_0x198e0d+'-'+_0x4377ee+'/'+_0x3503e3)[_0xae00('0x18')](_0xb9d53a);}return null;};}function patchUpdates(_0x1e3e9f){return function(_0x36cc17){try{jsonpatch[_0xae00('0x19')](_0x36cc17,_0x1e3e9f,!![]);}catch(_0x5cc860){return BPromise['reject'](_0x5cc860);}return _0x36cc17[_0xae00('0x1a')]();};}function saveUpdates(_0xa8d19,_0x2224aa){return function(_0xf3d304){if(_0xf3d304){return _0xf3d304[_0xae00('0x1b')](_0xa8d19)[_0xae00('0x1c')](function(_0x1689da){return _0x1689da;});}return null;};}function removeEntity(_0x3d063e,_0x239211){return function(_0x38aae5){if(_0x38aae5){return _0x38aae5[_0xae00('0x1d')]()['then'](function(){var _0x236c01=_0x38aae5['get']({'plain':!![]});var _0x3a9d26=_0xae00('0x1e');return db[_0xae00('0x1f')]['destroy']({'where':{'type':_0x3a9d26,'resourceId':_0x236c01['id']}})['then'](function(){return _0x38aae5;});})[_0xae00('0x1c')](function(){_0x3d063e[_0xae00('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f3cdd,_0x47b9d2){return function(_0x3e640e){if(!_0x3e640e){_0x5f3cdd[_0xae00('0x12')](0x194);}return _0x3e640e;};}function handleError(_0x306958,_0x2aafaf){_0x2aafaf=_0x2aafaf||0x1f4;return function(_0x1880a8){logger[_0xae00('0x20')](_0x1880a8[_0xae00('0x21')]);if(_0x1880a8[_0xae00('0x22')]){delete _0x1880a8[_0xae00('0x22')];}_0x306958[_0xae00('0x14')](_0x2aafaf)[_0xae00('0x23')](_0x1880a8);};}exports[_0xae00('0x24')]=function(_0x517148,_0x335958){var _0xb5254={},_0x2d4eb7={},_0x140970={'count':0x0,'rows':[]};return db[_0xae00('0x25')][_0xae00('0x26')]()['then'](function(_0x147b81){_0x2d4eb7['model']=_[_0xae00('0x27')](_0x147b81);_0x2d4eb7['query']=_[_0xae00('0x27')](_0x517148[_0xae00('0x28')]);_0x2d4eb7[_0xae00('0x29')]=_['intersection'](_0x2d4eb7['model'],_0x2d4eb7[_0xae00('0x28')]);_0xb5254['attributes']=_[_0xae00('0x2a')](_0x2d4eb7[_0xae00('0x2b')],qs[_0xae00('0x2c')](_0x517148[_0xae00('0x28')]['fields']));_0xb5254['attributes']=_0xb5254['attributes'][_0xae00('0x2d')]?_0xb5254[_0xae00('0x2e')]:_0x2d4eb7[_0xae00('0x2b')];if(!_0x517148[_0xae00('0x28')]['hasOwnProperty'](_0xae00('0x2f'))){_0xb5254[_0xae00('0x30')]=qs[_0xae00('0x30')](_0x517148[_0xae00('0x28')][_0xae00('0x30')]);_0xb5254[_0xae00('0x17')]=qs[_0xae00('0x17')](_0x517148[_0xae00('0x28')][_0xae00('0x17')]);}_0xb5254[_0xae00('0x31')]=qs[_0xae00('0x32')](_0x517148[_0xae00('0x28')][_0xae00('0x32')]);_0xb5254[_0xae00('0x33')]=qs['filters'](_[_0xae00('0x34')](_0x517148['query'],_0x2d4eb7[_0xae00('0x29')]),_0x147b81);if(_0x517148[_0xae00('0x28')]['filter']){_0xb5254[_0xae00('0x33')]=_[_0xae00('0x35')](_0xb5254[_0xae00('0x33')],{'$or':_[_0xae00('0x36')](_0xb5254['attributes'],function(_0x19c73e){var _0x22cfc4={};_0x22cfc4[_0x19c73e]={'$like':'%'+_0x517148[_0xae00('0x28')][_0xae00('0x37')]+'%'};return _0x22cfc4;})});}_0xb5254=_['merge']({},_0xb5254,_0x517148[_0xae00('0x38')]);var _0x16659d={'where':_0xb5254[_0xae00('0x33')]};return db[_0xae00('0x25')]['count'](_0x16659d)[_0xae00('0x1c')](function(_0xce7e9a){_0x140970[_0xae00('0x16')]=_0xce7e9a;if(_0x517148[_0xae00('0x28')][_0xae00('0x39')]){_0xb5254[_0xae00('0x3a')]=[{'all':!![]}];}return db[_0xae00('0x25')][_0xae00('0x3b')](_0xb5254);})[_0xae00('0x1c')](function(_0x22a220){_0x140970[_0xae00('0x3c')]=_0x22a220;return _0x140970;})[_0xae00('0x1c')](respondWithFilteredResult(_0x335958,_0xb5254))[_0xae00('0x3d')](handleError(_0x335958,null));})[_0xae00('0x3d')](handleError(_0x335958,null));};exports[_0xae00('0x3e')]=function(_0xc32f0,_0x3398c1){var _0x42c143={'raw':![],'where':{'id':_0xc32f0[_0xae00('0x3f')]['id']}},_0x10ce7d={};_0x10ce7d[_0xae00('0x2b')]=_['keys'](db['CmCompany'][_0xae00('0x40')]);_0x10ce7d['query']=_['keys'](_0xc32f0[_0xae00('0x28')]);_0x10ce7d['filters']=_[_0xae00('0x2a')](_0x10ce7d[_0xae00('0x2b')],_0x10ce7d[_0xae00('0x28')]);_0x42c143['attributes']=_[_0xae00('0x2a')](_0x10ce7d['model'],qs[_0xae00('0x2c')](_0xc32f0[_0xae00('0x28')][_0xae00('0x2c')]));_0x42c143[_0xae00('0x2e')]=_0x42c143[_0xae00('0x2e')]['length']?_0x42c143[_0xae00('0x2e')]:_0x10ce7d[_0xae00('0x2b')];if(_0xc32f0[_0xae00('0x28')]['includeAll']){_0x42c143['include']=[{'all':!![]}];}_0x42c143=_['merge']({},_0x42c143,_0xc32f0['options']);return db[_0xae00('0x25')][_0xae00('0x41')](_0x42c143)[_0xae00('0x1c')](handleEntityNotFound(_0x3398c1,null))[_0xae00('0x1c')](respondWithResult(_0x3398c1,null))[_0xae00('0x3d')](handleError(_0x3398c1,null));};exports[_0xae00('0x42')]=function(_0x3a9817,_0x4bfcc0){return db[_0xae00('0x25')][_0xae00('0x42')](_0x3a9817['body'],{})[_0xae00('0x1c')](function(_0x46aaf1){var _0x23a328=_0x3a9817['user'][_0xae00('0x43')]({'plain':!![]});if(!_0x23a328)throw new Error(_0xae00('0x44'));if(_0x23a328['role']===_0xae00('0x45')){var _0x43bd72=_0x46aaf1[_0xae00('0x43')]({'plain':!![]});var _0x3f8ba2='Companies';return db[_0xae00('0x46')]['find']({'where':{'name':_0x3f8ba2,'userProfileId':_0x23a328[_0xae00('0x47')]},'raw':!![]})[_0xae00('0x1c')](function(_0x3a32f1){if(_0x3a32f1&&_0x3a32f1['autoAssociation']===0x0){return db[_0xae00('0x1f')][_0xae00('0x42')]({'name':_0x43bd72['name'],'resourceId':_0x43bd72['id'],'type':_0x3a32f1['name'],'sectionId':_0x3a32f1['id']},{})[_0xae00('0x1c')](function(){return _0x46aaf1;});}else{return _0x46aaf1;}})[_0xae00('0x3d')](function(_0x24d5c3){logger['error'](_0xae00('0x48'),_0x24d5c3);throw _0x24d5c3;});}return _0x46aaf1;})['then'](respondWithResult(_0x4bfcc0,0xc9))[_0xae00('0x3d')](handleError(_0x4bfcc0,null));};exports[_0xae00('0x1b')]=function(_0x212c87,_0x1938cf){if(_0x212c87[_0xae00('0x49')]['id']){delete _0x212c87[_0xae00('0x49')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x212c87['params']['id']}})[_0xae00('0x1c')](handleEntityNotFound(_0x1938cf,null))[_0xae00('0x1c')](saveUpdates(_0x212c87[_0xae00('0x49')],null))[_0xae00('0x1c')](respondWithResult(_0x1938cf,null))['catch'](handleError(_0x1938cf,null));};exports[_0xae00('0x1d')]=function(_0x3de9a7,_0x2c55e8){return db[_0xae00('0x25')][_0xae00('0x41')]({'where':{'id':_0x3de9a7[_0xae00('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2c55e8,null))[_0xae00('0x1c')](removeEntity(_0x2c55e8,null))[_0xae00('0x3d')](handleError(_0x2c55e8,null));};exports[_0xae00('0x26')]=function(_0x41c87f,_0x2270f8){return db['CmCompany'][_0xae00('0x26')]()[_0xae00('0x1c')](respondWithResult(_0x2270f8,null))[_0xae00('0x3d')](handleError(_0x2270f8,null));};exports['addContacts']=function(_0x20f28f,_0x3ac9e2,_0x5aa952){return db[_0xae00('0x4a')][_0xae00('0x41')]({'where':{'id':_0x20f28f['params']['id']}})[_0xae00('0x1c')](handleEntityNotFound(_0x3ac9e2,null))['then'](function(_0x5641be){if(_0x5641be){return _0x5641be[_0xae00('0x4b')](_0x20f28f[_0xae00('0x49')][_0xae00('0x4c')],_[_0xae00('0x4d')](_0x20f28f[_0xae00('0x49')],['ids','id'])||{});}})[_0xae00('0x1c')](respondWithResult(_0x3ac9e2,null))[_0xae00('0x3d')](handleError(_0x3ac9e2,null));};exports[_0xae00('0x4e')]=function(_0x172360,_0x39bb5b,_0x5e0ccb){var _0x191517={};var _0x105b50={};var _0x1b9a67;var _0x412495;return db[_0xae00('0x25')][_0xae00('0x4f')]({'where':{'id':_0x172360['params']['id']}})[_0xae00('0x1c')](handleEntityNotFound(_0x39bb5b,null))[_0xae00('0x1c')](function(_0x676b15){if(_0x676b15){_0x1b9a67=_0x676b15;_0x105b50[_0xae00('0x2b')]=_['keys'](db['CmContact'][_0xae00('0x40')]);_0x105b50[_0xae00('0x28')]=_[_0xae00('0x27')](_0x172360[_0xae00('0x28')]);_0x105b50[_0xae00('0x29')]=_[_0xae00('0x2a')](_0x105b50[_0xae00('0x2b')],_0x105b50[_0xae00('0x28')]);_0x191517['attributes']=_[_0xae00('0x2a')](_0x105b50[_0xae00('0x2b')],qs[_0xae00('0x2c')](_0x172360[_0xae00('0x28')]['fields']));_0x191517[_0xae00('0x2e')]=_0x191517[_0xae00('0x2e')][_0xae00('0x2d')]?_0x191517[_0xae00('0x2e')]:_0x105b50[_0xae00('0x2b')];_0x191517[_0xae00('0x31')]=qs['sort'](_0x172360[_0xae00('0x28')][_0xae00('0x32')]);_0x191517['where']=qs[_0xae00('0x29')](_[_0xae00('0x34')](_0x172360[_0xae00('0x28')],_0x105b50[_0xae00('0x29')]));if(_0x172360['query'][_0xae00('0x37')]){_0x191517[_0xae00('0x33')]=_['merge'](_0x191517[_0xae00('0x33')],{'$or':_[_0xae00('0x36')](_0x191517[_0xae00('0x2e')],function(_0x4b714a){var _0x2c40d5={};_0x2c40d5[_0x4b714a]={'$like':'%'+_0x172360[_0xae00('0x28')]['filter']+'%'};return _0x2c40d5;})});}_0x191517=_[_0xae00('0x35')]({},_0x191517,_0x172360[_0xae00('0x38')]);return _0x1b9a67['getContacts'](_0x191517);}})[_0xae00('0x1c')](function(_0x7c5750){if(_0x7c5750){_0x412495=_0x7c5750[_0xae00('0x2d')];if(!_0x172360[_0xae00('0x28')][_0xae00('0x50')](_0xae00('0x2f'))){_0x191517[_0xae00('0x30')]=qs[_0xae00('0x30')](_0x172360['query'][_0xae00('0x30')]);_0x191517[_0xae00('0x17')]=qs[_0xae00('0x17')](_0x172360['query'][_0xae00('0x17')]);}return _0x1b9a67[_0xae00('0x4e')](_0x191517);}})[_0xae00('0x1c')](function(_0x3f5d54){if(_0x3f5d54){return _0x3f5d54?{'count':_0x412495,'rows':_0x3f5d54}:null;}})[_0xae00('0x1c')](respondWithResult(_0x39bb5b,null))[_0xae00('0x3d')](handleError(_0x39bb5b,null));}; \ No newline at end of file +var _0xaf51=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','omit','getContacts','CmContact','pick','filter','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','error','stack','send','index','CmCompany','describe','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','map','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf51,0x1b3));var _0x1af5=function(_0x10a7f2,_0x24d4b8){_0x10a7f2=_0x10a7f2-0x0;var _0x25b668=_0xaf51[_0x10a7f2];return _0x25b668;};'use strict';var emlformat=require(_0x1af5('0x0'));var rimraf=require(_0x1af5('0x1'));var zipdir=require(_0x1af5('0x2'));var jsonpatch=require(_0x1af5('0x3'));var rp=require('request-promise');var moment=require(_0x1af5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1af5('0x5'));var util=require(_0x1af5('0x6'));var path=require('path');var sox=require(_0x1af5('0x7'));var csv=require(_0x1af5('0x8'));var ejs=require(_0x1af5('0x9'));var fs=require('fs');var fs_extra=require(_0x1af5('0xa'));var _=require(_0x1af5('0xb'));var squel=require('squel');var crypto=require(_0x1af5('0xc'));var jsforce=require(_0x1af5('0xd'));var deskjs=require(_0x1af5('0xe'));var toCsv=require(_0x1af5('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1af5('0xf'));var qs=require(_0x1af5('0x10'));var as=require(_0x1af5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1af5('0x12'));var utils=require(_0x1af5('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1af5('0x14'));var db=require(_0x1af5('0x15'))['db'];function respondWithStatusCode(_0x8d8d75,_0x4854dd){_0x4854dd=_0x4854dd||0xcc;return function(_0x10391d){if(_0x10391d){return _0x8d8d75[_0x1af5('0x16')](_0x4854dd);}return _0x8d8d75[_0x1af5('0x17')](_0x4854dd)[_0x1af5('0x18')]();};}function respondWithResult(_0x449902,_0x265def){_0x265def=_0x265def||0xc8;return function(_0x3d7296){if(_0x3d7296){return _0x449902[_0x1af5('0x17')](_0x265def)[_0x1af5('0x19')](_0x3d7296);}};}function respondWithFilteredResult(_0x49a00e,_0x491b04){return function(_0x15f3a0){if(_0x15f3a0){var _0x30aa18=typeof _0x491b04[_0x1af5('0x1a')]===_0x1af5('0x1b')&&typeof _0x491b04[_0x1af5('0x1c')]==='undefined';var _0x50db83=_0x15f3a0[_0x1af5('0x1d')];var _0x250e63=_0x30aa18?0x0:_0x491b04[_0x1af5('0x1a')];var _0x3c8095=_0x30aa18?_0x15f3a0[_0x1af5('0x1d')]:_0x491b04[_0x1af5('0x1a')]+_0x491b04['limit'];var _0x4c25d7;if(_0x3c8095>=_0x50db83){_0x3c8095=_0x50db83;_0x4c25d7=0xc8;}else{_0x4c25d7=0xce;}_0x49a00e[_0x1af5('0x17')](_0x4c25d7);return _0x49a00e[_0x1af5('0x1e')](_0x1af5('0x1f'),_0x250e63+'-'+_0x3c8095+'/'+_0x50db83)['json'](_0x15f3a0);}return null;};}function patchUpdates(_0x5f32c6){return function(_0x41cde7){try{jsonpatch[_0x1af5('0x20')](_0x41cde7,_0x5f32c6,!![]);}catch(_0x2c7648){return BPromise[_0x1af5('0x21')](_0x2c7648);}return _0x41cde7['save']();};}function saveUpdates(_0x1f2645,_0x479be7){return function(_0x566664){if(_0x566664){return _0x566664[_0x1af5('0x22')](_0x1f2645)[_0x1af5('0x23')](function(_0x2ab53d){return _0x2ab53d;});}return null;};}function removeEntity(_0x2f2b3d,_0x4a54b2){return function(_0x2c5167){if(_0x2c5167){return _0x2c5167['destroy']()[_0x1af5('0x23')](function(){var _0x353816=_0x2c5167[_0x1af5('0x24')]({'plain':!![]});var _0x149c44='Companies';return db[_0x1af5('0x25')][_0x1af5('0x26')]({'where':{'type':_0x149c44,'resourceId':_0x353816['id']}})[_0x1af5('0x23')](function(){return _0x2c5167;});})['then'](function(){_0x2f2b3d[_0x1af5('0x17')](0xcc)[_0x1af5('0x18')]();});}};}function handleEntityNotFound(_0x3a5f13,_0x22b128){return function(_0x1d1c65){if(!_0x1d1c65){_0x3a5f13[_0x1af5('0x16')](0x194);}return _0x1d1c65;};}function handleError(_0x272a09,_0x4ff62e){_0x4ff62e=_0x4ff62e||0x1f4;return function(_0x37ef5c){logger[_0x1af5('0x27')](_0x37ef5c[_0x1af5('0x28')]);if(_0x37ef5c['name']){delete _0x37ef5c['name'];}_0x272a09['status'](_0x4ff62e)[_0x1af5('0x29')](_0x37ef5c);};}exports[_0x1af5('0x2a')]=function(_0x1a0aa6,_0x5bcc73){var _0xdd71d9={},_0x62c519={},_0x5b4dc2={'count':0x0,'rows':[]};return db[_0x1af5('0x2b')][_0x1af5('0x2c')]()['then'](function(_0x453cbe){_0x62c519['model']=_[_0x1af5('0x2d')](_0x453cbe);_0x62c519['query']=_[_0x1af5('0x2d')](_0x1a0aa6[_0x1af5('0x2e')]);_0x62c519[_0x1af5('0x2f')]=_[_0x1af5('0x30')](_0x62c519['model'],_0x62c519['query']);_0xdd71d9[_0x1af5('0x31')]=_['intersection'](_0x62c519[_0x1af5('0x32')],qs[_0x1af5('0x33')](_0x1a0aa6[_0x1af5('0x2e')][_0x1af5('0x33')]));_0xdd71d9[_0x1af5('0x31')]=_0xdd71d9[_0x1af5('0x31')][_0x1af5('0x34')]?_0xdd71d9[_0x1af5('0x31')]:_0x62c519[_0x1af5('0x32')];if(!_0x1a0aa6[_0x1af5('0x2e')][_0x1af5('0x35')](_0x1af5('0x36'))){_0xdd71d9['limit']=qs[_0x1af5('0x1c')](_0x1a0aa6[_0x1af5('0x2e')][_0x1af5('0x1c')]);_0xdd71d9[_0x1af5('0x1a')]=qs[_0x1af5('0x1a')](_0x1a0aa6[_0x1af5('0x2e')][_0x1af5('0x1a')]);}_0xdd71d9[_0x1af5('0x37')]=qs[_0x1af5('0x38')](_0x1a0aa6[_0x1af5('0x2e')][_0x1af5('0x38')]);_0xdd71d9[_0x1af5('0x39')]=qs[_0x1af5('0x2f')](_['pick'](_0x1a0aa6[_0x1af5('0x2e')],_0x62c519[_0x1af5('0x2f')]),_0x453cbe);if(_0x1a0aa6[_0x1af5('0x2e')]['filter']){_0xdd71d9['where']=_[_0x1af5('0x3a')](_0xdd71d9[_0x1af5('0x39')],{'$or':_[_0x1af5('0x3b')](_0xdd71d9[_0x1af5('0x31')],function(_0x1b5fce){var _0x3889a9={};_0x3889a9[_0x1b5fce]={'$like':'%'+_0x1a0aa6[_0x1af5('0x2e')]['filter']+'%'};return _0x3889a9;})});}_0xdd71d9=_[_0x1af5('0x3a')]({},_0xdd71d9,_0x1a0aa6[_0x1af5('0x3c')]);var _0x4bb748={'where':_0xdd71d9[_0x1af5('0x39')]};return db[_0x1af5('0x2b')][_0x1af5('0x1d')](_0x4bb748)['then'](function(_0x3ba867){_0x5b4dc2[_0x1af5('0x1d')]=_0x3ba867;if(_0x1a0aa6[_0x1af5('0x2e')][_0x1af5('0x3d')]){_0xdd71d9[_0x1af5('0x3e')]=[{'all':!![]}];}return db['CmCompany'][_0x1af5('0x3f')](_0xdd71d9);})[_0x1af5('0x23')](function(_0x43f7c0){_0x5b4dc2[_0x1af5('0x40')]=_0x43f7c0;return _0x5b4dc2;})[_0x1af5('0x23')](respondWithFilteredResult(_0x5bcc73,_0xdd71d9))[_0x1af5('0x41')](handleError(_0x5bcc73,null));})['catch'](handleError(_0x5bcc73,null));};exports['show']=function(_0x33ee17,_0x391ffe){var _0x361445={'raw':![],'where':{'id':_0x33ee17[_0x1af5('0x42')]['id']}},_0x45c1ec={};_0x45c1ec['model']=_[_0x1af5('0x2d')](db['CmCompany'][_0x1af5('0x43')]);_0x45c1ec[_0x1af5('0x2e')]=_[_0x1af5('0x2d')](_0x33ee17[_0x1af5('0x2e')]);_0x45c1ec[_0x1af5('0x2f')]=_[_0x1af5('0x30')](_0x45c1ec[_0x1af5('0x32')],_0x45c1ec[_0x1af5('0x2e')]);_0x361445[_0x1af5('0x31')]=_[_0x1af5('0x30')](_0x45c1ec[_0x1af5('0x32')],qs[_0x1af5('0x33')](_0x33ee17[_0x1af5('0x2e')][_0x1af5('0x33')]));_0x361445[_0x1af5('0x31')]=_0x361445[_0x1af5('0x31')]['length']?_0x361445[_0x1af5('0x31')]:_0x45c1ec['model'];if(_0x33ee17['query']['includeAll']){_0x361445[_0x1af5('0x3e')]=[{'all':!![]}];}_0x361445=_[_0x1af5('0x3a')]({},_0x361445,_0x33ee17[_0x1af5('0x3c')]);return db[_0x1af5('0x2b')]['find'](_0x361445)[_0x1af5('0x23')](handleEntityNotFound(_0x391ffe,null))[_0x1af5('0x23')](respondWithResult(_0x391ffe,null))[_0x1af5('0x41')](handleError(_0x391ffe,null));};exports[_0x1af5('0x44')]=function(_0x59cb63,_0x57c79c){return db[_0x1af5('0x2b')][_0x1af5('0x44')](_0x59cb63[_0x1af5('0x45')],{})[_0x1af5('0x23')](function(_0x434e75){var _0x5d96a9=_0x59cb63[_0x1af5('0x46')][_0x1af5('0x24')]({'plain':!![]});if(!_0x5d96a9)throw new Error(_0x1af5('0x47'));if(_0x5d96a9[_0x1af5('0x48')]===_0x1af5('0x46')){var _0x12fc2e=_0x434e75[_0x1af5('0x24')]({'plain':!![]});var _0x7a51f9='Companies';return db['UserProfileSection'][_0x1af5('0x49')]({'where':{'name':_0x7a51f9,'userProfileId':_0x5d96a9[_0x1af5('0x4a')]},'raw':!![]})[_0x1af5('0x23')](function(_0x1290f8){if(_0x1290f8&&_0x1290f8[_0x1af5('0x4b')]===0x0){return db[_0x1af5('0x25')][_0x1af5('0x44')]({'name':_0x12fc2e[_0x1af5('0x4c')],'resourceId':_0x12fc2e['id'],'type':_0x1290f8[_0x1af5('0x4c')],'sectionId':_0x1290f8['id']},{})[_0x1af5('0x23')](function(){return _0x434e75;});}else{return _0x434e75;}})[_0x1af5('0x41')](function(_0x154a4f){logger[_0x1af5('0x27')](_0x1af5('0x4d'),_0x154a4f);throw _0x154a4f;});}return _0x434e75;})[_0x1af5('0x23')](respondWithResult(_0x57c79c,0xc9))[_0x1af5('0x41')](handleError(_0x57c79c,null));};exports['update']=function(_0xabe39e,_0x351a60){if(_0xabe39e[_0x1af5('0x45')]['id']){delete _0xabe39e[_0x1af5('0x45')]['id'];}return db[_0x1af5('0x2b')][_0x1af5('0x49')]({'where':{'id':_0xabe39e['params']['id']}})[_0x1af5('0x23')](handleEntityNotFound(_0x351a60,null))[_0x1af5('0x23')](saveUpdates(_0xabe39e[_0x1af5('0x45')],null))[_0x1af5('0x23')](respondWithResult(_0x351a60,null))[_0x1af5('0x41')](handleError(_0x351a60,null));};exports[_0x1af5('0x26')]=function(_0x1669ea,_0x538e99){return db[_0x1af5('0x2b')][_0x1af5('0x49')]({'where':{'id':_0x1669ea[_0x1af5('0x42')]['id']}})[_0x1af5('0x23')](handleEntityNotFound(_0x538e99,null))[_0x1af5('0x23')](removeEntity(_0x538e99,null))['catch'](handleError(_0x538e99,null));};exports[_0x1af5('0x2c')]=function(_0x36a49b,_0x36a2c8){return db[_0x1af5('0x2b')]['describe']()['then'](respondWithResult(_0x36a2c8,null))[_0x1af5('0x41')](handleError(_0x36a2c8,null));};exports[_0x1af5('0x4e')]=function(_0x2533dd,_0x43d540,_0x33c9cc){return db['CmContact'][_0x1af5('0x49')]({'where':{'id':_0x2533dd[_0x1af5('0x42')]['id']}})[_0x1af5('0x23')](handleEntityNotFound(_0x43d540,null))[_0x1af5('0x23')](function(_0x448395){if(_0x448395){return _0x448395['addContacts'](_0x2533dd[_0x1af5('0x45')]['ids'],_[_0x1af5('0x4f')](_0x2533dd[_0x1af5('0x45')],['ids','id'])||{});}})[_0x1af5('0x23')](respondWithResult(_0x43d540,null))['catch'](handleError(_0x43d540,null));};exports[_0x1af5('0x50')]=function(_0x4f6862,_0x2d94de,_0xf97e6b){var _0x3e2fd9={};var _0x2e94e0={};var _0x175883;var _0x3ac5e6;return db[_0x1af5('0x2b')]['findOne']({'where':{'id':_0x4f6862[_0x1af5('0x42')]['id']}})[_0x1af5('0x23')](handleEntityNotFound(_0x2d94de,null))[_0x1af5('0x23')](function(_0x292d69){if(_0x292d69){_0x175883=_0x292d69;_0x2e94e0[_0x1af5('0x32')]=_[_0x1af5('0x2d')](db[_0x1af5('0x51')][_0x1af5('0x43')]);_0x2e94e0['query']=_[_0x1af5('0x2d')](_0x4f6862[_0x1af5('0x2e')]);_0x2e94e0['filters']=_[_0x1af5('0x30')](_0x2e94e0[_0x1af5('0x32')],_0x2e94e0[_0x1af5('0x2e')]);_0x3e2fd9['attributes']=_[_0x1af5('0x30')](_0x2e94e0[_0x1af5('0x32')],qs[_0x1af5('0x33')](_0x4f6862[_0x1af5('0x2e')][_0x1af5('0x33')]));_0x3e2fd9[_0x1af5('0x31')]=_0x3e2fd9[_0x1af5('0x31')][_0x1af5('0x34')]?_0x3e2fd9[_0x1af5('0x31')]:_0x2e94e0[_0x1af5('0x32')];_0x3e2fd9[_0x1af5('0x37')]=qs[_0x1af5('0x38')](_0x4f6862[_0x1af5('0x2e')][_0x1af5('0x38')]);_0x3e2fd9[_0x1af5('0x39')]=qs['filters'](_[_0x1af5('0x52')](_0x4f6862['query'],_0x2e94e0[_0x1af5('0x2f')]));if(_0x4f6862[_0x1af5('0x2e')][_0x1af5('0x53')]){_0x3e2fd9[_0x1af5('0x39')]=_[_0x1af5('0x3a')](_0x3e2fd9[_0x1af5('0x39')],{'$or':_['map'](_0x3e2fd9[_0x1af5('0x31')],function(_0x2a0be4){var _0x4fea86={};_0x4fea86[_0x2a0be4]={'$like':'%'+_0x4f6862['query'][_0x1af5('0x53')]+'%'};return _0x4fea86;})});}_0x3e2fd9=_[_0x1af5('0x3a')]({},_0x3e2fd9,_0x4f6862[_0x1af5('0x3c')]);return _0x175883[_0x1af5('0x50')](_0x3e2fd9);}})[_0x1af5('0x23')](function(_0x2f9fc5){if(_0x2f9fc5){_0x3ac5e6=_0x2f9fc5['length'];if(!_0x4f6862[_0x1af5('0x2e')][_0x1af5('0x35')](_0x1af5('0x36'))){_0x3e2fd9[_0x1af5('0x1c')]=qs[_0x1af5('0x1c')](_0x4f6862[_0x1af5('0x2e')][_0x1af5('0x1c')]);_0x3e2fd9[_0x1af5('0x1a')]=qs[_0x1af5('0x1a')](_0x4f6862[_0x1af5('0x2e')][_0x1af5('0x1a')]);}return _0x175883[_0x1af5('0x50')](_0x3e2fd9);}})[_0x1af5('0x23')](function(_0x4d8954){if(_0x4d8954){return _0x4d8954?{'count':_0x3ac5e6,'rows':_0x4d8954}:null;}})[_0x1af5('0x23')](respondWithResult(_0x2d94de,null))[_0x1af5('0x41')](handleError(_0x2d94de,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 48cd3d4..0f42822 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 _0x12fa=['api','path','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x12fa,0x17a));var _0xa12f=function(_0x4fcbb8,_0x41d3b3){_0x4fcbb8=_0x4fcbb8-0x0;var _0x971055=_0x12fa[_0x4fcbb8];return _0x971055;};'use strict';var _=require('lodash');var util=require(_0xa12f('0x0'));var logger=require(_0xa12f('0x1'))(_0xa12f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa12f('0x3'));var rimraf=require(_0xa12f('0x4'));var config=require('../../config/environment');var attributes=require(_0xa12f('0x5'));module[_0xa12f('0x6')]=function(_0x1d4f3b,_0x55f26c){return _0x1d4f3b[_0xa12f('0x7')](_0xa12f('0x8'),attributes,{'tableName':_0xa12f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x394c=['define','CmCompany','cm_companies','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x428557,_0x4d97a7){var _0x320179=function(_0x361757){while(--_0x361757){_0x428557['push'](_0x428557['shift']());}};_0x320179(++_0x4d97a7);}(_0x394c,0x1cb));var _0xc394=function(_0x1dab5f,_0x10cd21){_0x1dab5f=_0x1dab5f-0x0;var _0x40c2f3=_0x394c[_0x1dab5f];return _0x40c2f3;};'use strict';var _=require(_0xc394('0x0'));var util=require(_0xc394('0x1'));var logger=require(_0xc394('0x2'))('api');var moment=require(_0xc394('0x3'));var BPromise=require(_0xc394('0x4'));var rp=require(_0xc394('0x5'));var fs=require('fs');var path=require(_0xc394('0x6'));var rimraf=require(_0xc394('0x7'));var config=require(_0xc394('0x8'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x164ce1,_0x14e52c){return _0x164ce1[_0xc394('0x9')](_0xc394('0xa'),attributes,{'tableName':_0xc394('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 f92bfab..e1166d6 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 _0x1503=['request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x1503,0x13f));var _0x3150=function(_0x34da8a,_0x4a027c){_0x34da8a=_0x34da8a-0x0;var _0x51f377=_0x1503[_0x34da8a];return _0x51f377;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3150('0x0'));var BPromise=require('bluebird');var rs=require(_0x3150('0x1'));var fs=require('fs');var Redis=require(_0x3150('0x2'));var db=require(_0x3150('0x3'))['db'];var utils=require(_0x3150('0x4'));var logger=require(_0x3150('0x5'))(_0x3150('0x6'));var config=require(_0x3150('0x7'));var jayson=require(_0x3150('0x8'));var client=jayson[_0x3150('0x9')][_0x3150('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2873ee,_0x278707,_0x3ec2da){return new BPromise(function(_0x58c56d,_0x59dd0a){return client[_0x3150('0xb')](_0x2873ee,_0x3ec2da)[_0x3150('0xc')](function(_0x2e41c0){logger[_0x3150('0xd')](_0x3150('0xe'),_0x278707,_0x3150('0xf'));logger[_0x3150('0x10')](_0x3150('0x11'),_0x278707,'request\x20sent',JSON['stringify'](_0x2e41c0));if(_0x2e41c0[_0x3150('0x12')]){if(_0x2e41c0[_0x3150('0x12')]['code']===0x1f4){logger[_0x3150('0x12')](_0x3150('0xe'),_0x278707,_0x2e41c0['error'][_0x3150('0x13')]);return _0x59dd0a(_0x2e41c0[_0x3150('0x12')]['message']);}logger[_0x3150('0x12')]('CmCompany,\x20%s,\x20%s',_0x278707,_0x2e41c0[_0x3150('0x12')][_0x3150('0x13')]);return _0x58c56d(_0x2e41c0[_0x3150('0x12')][_0x3150('0x13')]);}else{logger[_0x3150('0xd')](_0x3150('0xe'),_0x278707,_0x3150('0xf'));_0x58c56d(_0x2e41c0[_0x3150('0x14')]['message']);}})[_0x3150('0x15')](function(_0x29c76a){logger[_0x3150('0x12')](_0x3150('0xe'),_0x278707,_0x29c76a);_0x59dd0a(_0x29c76a);});});} \ No newline at end of file +var _0xb421=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x5d926d,_0x5927b4){var _0x34cb71=function(_0x511a90){while(--_0x511a90){_0x5d926d['push'](_0x5d926d['shift']());}};_0x34cb71(++_0x5927b4);}(_0xb421,0x9f));var _0x1b42=function(_0x4fd297,_0x40fd49){_0x4fd297=_0x4fd297-0x0;var _0x22e2ca=_0xb421[_0x4fd297];return _0x22e2ca;};'use strict';var _=require(_0x1b42('0x0'));var util=require(_0x1b42('0x1'));var moment=require(_0x1b42('0x2'));var BPromise=require(_0x1b42('0x3'));var rs=require(_0x1b42('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b42('0x5'))['db'];var utils=require(_0x1b42('0x6'));var logger=require(_0x1b42('0x7'))(_0x1b42('0x8'));var config=require(_0x1b42('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1b42('0xa')][_0x1b42('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d6048,_0x13123d,_0x2a62a5){return new BPromise(function(_0x3abf61,_0x495d9e){return client[_0x1b42('0xc')](_0x4d6048,_0x2a62a5)[_0x1b42('0xd')](function(_0x5d0e3d){logger[_0x1b42('0xe')](_0x1b42('0xf'),_0x13123d,_0x1b42('0x10'));logger['debug'](_0x1b42('0x11'),_0x13123d,_0x1b42('0x10'),JSON[_0x1b42('0x12')](_0x5d0e3d));if(_0x5d0e3d['error']){if(_0x5d0e3d[_0x1b42('0x13')][_0x1b42('0x14')]===0x1f4){logger[_0x1b42('0x13')](_0x1b42('0xf'),_0x13123d,_0x5d0e3d[_0x1b42('0x13')][_0x1b42('0x15')]);return _0x495d9e(_0x5d0e3d[_0x1b42('0x13')][_0x1b42('0x15')]);}logger[_0x1b42('0x13')](_0x1b42('0xf'),_0x13123d,_0x5d0e3d['error'][_0x1b42('0x15')]);return _0x3abf61(_0x5d0e3d[_0x1b42('0x13')][_0x1b42('0x15')]);}else{logger[_0x1b42('0xe')](_0x1b42('0xf'),_0x13123d,'request\x20sent');_0x3abf61(_0x5d0e3d['result']['message']);}})[_0x1b42('0x16')](function(_0x4d9110){logger[_0x1b42('0x13')](_0x1b42('0xf'),_0x13123d,_0x4d9110);_0x495d9e(_0x4d9110);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 05ce12c..d22e0ea 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 _0x2581=['/describe','describe','/:id','show','getContacts','post','/:id/contacts','addContacts','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index'];(function(_0x52e318,_0x4affdc){var _0x5647b7=function(_0x4dc605){while(--_0x4dc605){_0x52e318['push'](_0x52e318['shift']());}};_0x5647b7(++_0x4affdc);}(_0x2581,0xcb));var _0x1258=function(_0x138fce,_0x304267){_0x138fce=_0x138fce-0x0;var _0x593cb0=_0x2581[_0x138fce];return _0x593cb0;};'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/contacts',auth[_0x1258('0xb')](),controller[_0x1258('0x11')]);router[_0x1258('0x12')]('/',auth[_0x1258('0xb')](),controller['create']);router[_0x1258('0x12')](_0x1258('0x13'),auth[_0x1258('0xb')](),controller[_0x1258('0x14')]);router['put'](_0x1258('0xf'),auth[_0x1258('0xb')](),controller[_0x1258('0x15')]);router[_0x1258('0x16')](_0x1258('0xf'),auth[_0x1258('0xb')](),controller[_0x1258('0x17')]);module['exports']=router; \ No newline at end of file +var _0x6258=['/:id','show','getContacts','post','/:id/contacts','addContacts','put','update','delete','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x6258,0x11d));var _0x8625=function(_0x35c3c8,_0x248649){_0x35c3c8=_0x35c3c8-0x0;var _0x27ff4d=_0x6258[_0x35c3c8];return _0x27ff4d;};'use strict';var multer=require(_0x8625('0x0'));var util=require('util');var path=require(_0x8625('0x1'));var timeout=require(_0x8625('0x2'));var express=require(_0x8625('0x3'));var router=express['Router']();var fs_extra=require(_0x8625('0x4'));var auth=require(_0x8625('0x5'));var interaction=require(_0x8625('0x6'));var config=require(_0x8625('0x7'));var controller=require(_0x8625('0x8'));router[_0x8625('0x9')]('/',auth[_0x8625('0xa')](),controller[_0x8625('0xb')]);router[_0x8625('0x9')](_0x8625('0xc'),auth[_0x8625('0xa')](),controller[_0x8625('0xd')]);router[_0x8625('0x9')](_0x8625('0xe'),auth['isAuthenticated'](),controller[_0x8625('0xf')]);router[_0x8625('0x9')]('/:id/contacts',auth[_0x8625('0xa')](),controller[_0x8625('0x10')]);router['post']('/',auth[_0x8625('0xa')](),controller['create']);router[_0x8625('0x11')](_0x8625('0x12'),auth[_0x8625('0xa')](),controller[_0x8625('0x13')]);router[_0x8625('0x14')](_0x8625('0xe'),auth['isAuthenticated'](),controller[_0x8625('0x15')]);router[_0x8625('0x16')](_0x8625('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index f35cee0..1362928 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 _0x1629=['DATE','lodash','exports','STRING','INTEGER'];(function(_0x52e0ee,_0x52f7c1){var _0x32534c=function(_0x535d65){while(--_0x535d65){_0x52e0ee['push'](_0x52e0ee['shift']());}};_0x32534c(++_0x52f7c1);}(_0x1629,0x132));var _0x9162=function(_0x578ff2,_0x4cb5ef){_0x578ff2=_0x578ff2-0x0;var _0x40c8aa=_0x1629[_0x578ff2];return _0x40c8aa;};'use strict';var _=require(_0x9162('0x0'));var Sequelize=require('sequelize');module[_0x9162('0x1')]={'firstName':{'type':Sequelize[_0x9162('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x9162('0x2')]},'street':{'type':Sequelize[_0x9162('0x2')]},'postalCode':{'type':Sequelize[_0x9162('0x2')]},'city':{'type':Sequelize[_0x9162('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x9162('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x9162('0x2')]},'mobile':{'type':Sequelize[_0x9162('0x2')]},'fax':{'type':Sequelize[_0x9162('0x2')]},'email':{'type':Sequelize[_0x9162('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x9162('0x2')]},'fb_data':{'type':Sequelize[_0x9162('0x2')]},'twitter':{'type':Sequelize[_0x9162('0x2')]},'skype':{'type':Sequelize[_0x9162('0x2')]},'teams':{'type':Sequelize[_0x9162('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x9162('0x2')]},'UserId':{'type':Sequelize[_0x9162('0x3')]},'priority':{'type':Sequelize[_0x9162('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9162('0x4')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x62b8=['STRING','TEXT','INTEGER','UNSIGNED','DATE','lodash','sequelize','exports'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0x62b8,0xc5));var _0x862b=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0x62b8[_0x56ba92];return _0x8fe94d;};'use strict';var _=require(_0x862b('0x0'));var Sequelize=require(_0x862b('0x1'));module[_0x862b('0x2')]={'firstName':{'type':Sequelize[_0x862b('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x862b('0x3')]},'street':{'type':Sequelize[_0x862b('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x862b('0x3')]},'description':{'type':Sequelize[_0x862b('0x4')]},'phone':{'type':Sequelize[_0x862b('0x3')]},'mobile':{'type':Sequelize[_0x862b('0x3')]},'fax':{'type':Sequelize[_0x862b('0x3')]},'email':{'type':Sequelize[_0x862b('0x3')]},'url':{'type':Sequelize[_0x862b('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x862b('0x3')]},'teams':{'type':Sequelize[_0x862b('0x3')]},'viber':{'type':Sequelize[_0x862b('0x3')]},'line':{'type':Sequelize[_0x862b('0x3')]},'wechat':{'type':Sequelize[_0x862b('0x3')]},'telegram':{'type':Sequelize[_0x862b('0x3')]},'UserId':{'type':Sequelize[_0x862b('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x862b('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x862b('0x7')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 1f6b3ef..c83d481 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 _0x367a=['having','t.id\x20IN\x20?','resolve','user','role','some','sequelize','toString','keyBy','merge','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.deletedAt','c.CompanyId','TagIds','Tags','rows','catch','destroy','tags','columnName','displayName','alias','custom','values','body','findAll','get','[CmContact][merge]\x20to\x20%s\x20from\x20%s','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','join','bulkCreate','duplicates','$or','findOrCreate','spread','show','Tag','omit','format','params','$and','pickBy','cf_%d','table','setFields','toParam','CmHopper','phone','getTags','findOne','rawAttributes','intersection','options','setTags','ids','getHoppers','pick','ContactId','include','getHopperHistories','includeAll','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','../../components/import/cm/csv','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','upload','path','parse','meta','import','binding','firstName','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','pid','mail','sms','openchannel','fax','whatsapp','voice','-createdAt','channel','toLowerCase','range','isValid','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','UserId','fullname','findAndCountAll','startCase','Website','Account','closed','closedAt','secondDisposition','thirdDisposition','key','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','Owner','all','sortBy','reverse','eml-format','rimraf','zip-dir','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./cmContact.socket','sendStatus','status','end','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','CmContact','describe','length','keys','startsWith','push','CmCustomField','trimStart','cf_','fieldType','type','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','select','field','color','from','tools_tags','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','find','split','map','forEach','union','User','and','uc.UserId\x20=\x20?','value','dateOfBirth','datetime','DATE','text','start','filter','Contact','isEmpty','ListId','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.id','Sequelize','QueryTypes','clone','DESC'];(function(_0x627a48,_0x1796c6){var _0x374748=function(_0x3d6aa8){while(--_0x3d6aa8){_0x627a48['push'](_0x627a48['shift']());}};_0x374748(++_0x1796c6);}(_0x367a,0x1c8));var _0xa367=function(_0x9f816e,_0x4892bd){_0x9f816e=_0x9f816e-0x0;var _0x3ce5da=_0x367a[_0x9f816e];return _0x3ce5da;};'use strict';var emlformat=require(_0xa367('0x0'));var rimraf=require(_0xa367('0x1'));var zipdir=require(_0xa367('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa367('0x3'));var util=require('util');var path=require('path');var sox=require(_0xa367('0x4'));var csv=require(_0xa367('0x5'));var ejs=require(_0xa367('0x6'));var fs=require('fs');var fs_extra=require(_0xa367('0x7'));var _=require(_0xa367('0x8'));var squel=require(_0xa367('0x9'));var crypto=require(_0xa367('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa367('0x5'));var querystring=require(_0xa367('0xb'));var Papa=require(_0xa367('0xc'));var Redis=require(_0xa367('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa367('0xe'));var hardwareService=require(_0xa367('0xf'));var logger=require('../../config/logger')(_0xa367('0x10'));var utils=require(_0xa367('0x11'));var config=require(_0xa367('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa367('0x13'))['db'];config[_0xa367('0x14')]=_[_0xa367('0x15')](config[_0xa367('0x14')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa367('0x14')]));require(_0xa367('0x16'))['register'](socket);function respondWithStatusCode(_0x435a8c,_0x3deb4d){_0x3deb4d=_0x3deb4d||0xcc;return function(_0x1b38f){if(_0x1b38f){return _0x435a8c[_0xa367('0x17')](_0x3deb4d);}return _0x435a8c[_0xa367('0x18')](_0x3deb4d)[_0xa367('0x19')]();};}function respondWithResult(_0x2b44fa,_0x503fbf){_0x503fbf=_0x503fbf||0xc8;return function(_0x217f0f){if(_0x217f0f){return _0x2b44fa['status'](_0x503fbf)['json'](_0x217f0f);}};}function respondWithFilteredResult(_0x17f39e,_0x186da7){return function(_0x4f9e6b){if(_0x4f9e6b){var _0x2bc4fd=typeof _0x186da7['offset']==='undefined'&&typeof _0x186da7[_0xa367('0x1a')]==='undefined';var _0x41e975=_0x4f9e6b[_0xa367('0x1b')];var _0xc92400=_0x2bc4fd?0x0:_0x186da7['offset'];var _0x2785f1=_0x2bc4fd?_0x4f9e6b[_0xa367('0x1b')]:_0x186da7[_0xa367('0x1c')]+_0x186da7[_0xa367('0x1a')];var _0x48b978;if(_0x2785f1>=_0x41e975){_0x2785f1=_0x41e975;_0x48b978=0xc8;}else{_0x48b978=0xce;}_0x17f39e[_0xa367('0x18')](_0x48b978);return _0x17f39e[_0xa367('0x1d')](_0xa367('0x1e'),_0xc92400+'-'+_0x2785f1+'/'+_0x41e975)[_0xa367('0x1f')](_0x4f9e6b);}return null;};}function patchUpdates(_0x153e4a){return function(_0x432766){try{jsonpatch[_0xa367('0x20')](_0x432766,_0x153e4a,!![]);}catch(_0x2c3e63){return BPromise[_0xa367('0x21')](_0x2c3e63);}return _0x432766[_0xa367('0x22')]();};}function saveUpdates(_0x5a5797,_0x4fcbf1){return function(_0xf6af30){if(_0xf6af30){return _0xf6af30[_0xa367('0x23')](_0x5a5797)[_0xa367('0x24')](function(_0xae0173){return _0xae0173;});}return null;};}function removeEntity(_0x2fbaf1,_0x20ae1e){return function(_0x1c5e5f){if(_0x1c5e5f){return _0x1c5e5f['destroy']()[_0xa367('0x24')](function(){_0x2fbaf1[_0xa367('0x18')](0xcc)[_0xa367('0x19')]();});}};}function handleEntityNotFound(_0x1b4b18,_0x437ed4){return function(_0x4b794d){if(!_0x4b794d){_0x1b4b18[_0xa367('0x17')](0x194);}return _0x4b794d;};}function handleError(_0x2d1208,_0x5b0043){_0x5b0043=_0x5b0043||0x1f4;return function(_0x2dab94){logger[_0xa367('0x25')](_0x2dab94[_0xa367('0x26')]);if(_0x2dab94[_0xa367('0x27')]){delete _0x2dab94[_0xa367('0x27')];}_0x2d1208[_0xa367('0x18')](_0x5b0043)[_0xa367('0x28')](_0x2dab94);};}exports[_0xa367('0x29')]=function(_0x264c46,_0x3d8c82){var _0x3d6d4b={},_0x2469f3={},_0xb703de={'count':0x0,'rows':[]};return db[_0xa367('0x2a')][_0xa367('0x2b')]()[_0xa367('0x24')](function(_0x252724){var _0x1c2645=[];for(var _0x237151=0x0;_0x2371510x1){_0xe0d590['or'](_0xa367('0x64'),qs['getFullTextValue'](_0x37674c),null);}else{if(qs[_0xa367('0x65')](_0x37674c)){_0xe0d590['or']('c.id\x20LIKE\x20?',_0x37674c+'%');_0xe0d590['or']('c.phone\x20LIKE\x20?',_0x37674c+'%');_0xe0d590['or'](_0xa367('0x66'),_0x37674c+'%');_0xe0d590['or'](_0xa367('0x67'),_0x37674c+'%');}else if(qs[_0xa367('0x68')](_0x37674c)){_0xe0d590['or'](_0xa367('0x69'),_0x37674c+'%');}else{_0xe0d590['or'](_0xa367('0x6a'),'%'+_0x37674c+'%');_0xe0d590['or']('c.lastName\x20LIKE\x20?','%'+_0x37674c+'%');_0xe0d590['or'](_0xa367('0x69'),'%'+_0x37674c+'%');}}}}_0x472707['where'](_0xe0d590);_0x472707['group'](_0xa367('0x6b'));var _0x3037e2={'type':db[_0xa367('0x6c')][_0xa367('0x6d')]['SELECT'],'raw':!![]};var _0x1364d1=_0x472707[_0xa367('0x6e')]()[_0xa367('0x40')](_0xa367('0x6b'));if(_0x3d6d4b[_0xa367('0x3b')]){_0x3d6d4b[_0xa367('0x3b')]['forEach'](function(_0x519761){_0x472707[_0xa367('0x3b')]('c.'+_0x519761[0x0],_0x519761[0x1]===_0xa367('0x6f')?![]:!![]);});}if(!_[_0xa367('0x5d')](_0x2beaef)){_0x472707[_0xa367('0x70')](_0x569de8);_0x1364d1[_0xa367('0x3d')](_0xa367('0x71'),_0x2beaef);}BPromise[_0xa367('0x72')]()['then'](function(){if(!_0xf7d86b)return;if(_0x264c46[_0xa367('0x73')][_0xa367('0x74')]!=='agent')return;if(!_[_0xa367('0x75')](_0xf7d86b[_0xa367('0x4c')],[_0xa367('0x40'),_0xa367('0x52')])){return _0x264c46['user']['getLists']({'attributes':['id'],'raw':!![]})[_0xa367('0x24')](function(_0x17a28b){if(_[_0xa367('0x5d')](_0x17a28b)){_0x1364d1['where']('c.ListId\x20IS\x20NULL');_0x472707[_0xa367('0x3d')]('c.ListId\x20IS\x20NULL');}else{_0x1364d1[_0xa367('0x3d')]('c.ListId\x20IN\x20?',_[_0xa367('0x4f')](_0x17a28b,'id'));_0x472707[_0xa367('0x3d')]('c.ListId\x20IN\x20?',_[_0xa367('0x4f')](_0x17a28b,'id'));}});}})[_0xa367('0x24')](function(){if(_0x264c46['user'][_0xa367('0x74')]==='agent'&&!_0xf7d86b&&!_0x264c46[_0xa367('0x36')]['ListId'])return[];return db[_0xa367('0x76')][_0xa367('0x36')](_0x1364d1[_0xa367('0x77')](),_0x3037e2);})[_0xa367('0x24')](function(_0x439b03){_0xb703de[_0xa367('0x1b')]=_0x439b03[_0xa367('0x2c')];if(_0xb703de[_0xa367('0x1b')]===0x0)return[];return db[_0xa367('0x76')]['query'](_0x1c3916[_0xa367('0x77')](),_0x3037e2)[_0xa367('0x24')](function(_0x119fc4){_0x44559b=_[_0xa367('0x78')](_0x119fc4,'id');_0x3037e2=_[_0xa367('0x79')](_0x3037e2,{'model':db[_0xa367('0x2a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x264c46[_0xa367('0x36')][_0xa367('0x38')]){_0x3d6d4b[_0xa367('0x37')][_0xa367('0x50')](function(_0x262935){_0x472707[_0xa367('0x40')]('c.'+_0x262935);});}else{_0x472707[_0xa367('0x40')](_0xa367('0x6b'));_0x472707['field']('c.firstName');_0x472707['field'](_0xa367('0x7a'));_0x472707[_0xa367('0x40')](_0xa367('0x7b'));_0x472707[_0xa367('0x40')](_0xa367('0x7c'));_0x472707[_0xa367('0x40')](_0xa367('0x7d'));_0x472707[_0xa367('0x40')](_0xa367('0x7e'));_0x472707[_0xa367('0x40')](_0xa367('0x7f'));_0x472707[_0xa367('0x40')]('c.createdAt');_0x472707[_0xa367('0x40')](_0xa367('0x80'));_0x472707[_0xa367('0x40')](_0xa367('0x81'));_0x472707['field']('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x3d6d4b['limit'])_0x472707[_0xa367('0x1a')](_0x3d6d4b[_0xa367('0x1a')]);if(_0x3d6d4b['offset'])_0x472707['offset'](_0x3d6d4b[_0xa367('0x1c')]);return db[_0xa367('0x76')][_0xa367('0x36')](_0x472707[_0xa367('0x77')](),_0x3037e2);});})[_0xa367('0x24')](function(_0x41502e){_0x41502e['forEach'](function(_0x5e438a){if(_0x5e438a[_0xa367('0x82')]){_0x5e438a[_0xa367('0x83')]=[];_0x5e438a[_0xa367('0x82')][_0xa367('0x4e')](',')[_0xa367('0x50')](function(_0x20262b){_0x5e438a[_0xa367('0x83')][_0xa367('0x2f')](_0x44559b[_0x20262b]);});}delete _0x5e438a['TagIds'];});_0xb703de[_0xa367('0x84')]=_0x41502e;return _0xb703de;})['then'](respondWithFilteredResult(_0x3d8c82,_0x3d6d4b));})[_0xa367('0x85')](handleError(_0x3d8c82,null));};exports[_0xa367('0x86')]=function(_0x1f811a,_0x2e912a){return db[_0xa367('0x2a')][_0xa367('0x4d')]({'where':{'id':_0x1f811a['params']['id']}})['then'](handleEntityNotFound(_0x2e912a,null))[_0xa367('0x24')](removeEntity(_0x2e912a,null))[_0xa367('0x85')](handleError(_0x2e912a,null));};exports[_0xa367('0x2b')]=function(_0x250aca,_0x27955d){return db[_0xa367('0x2a')][_0xa367('0x2b')]()[_0xa367('0x24')](function(_0x1d4dbb){delete _0x1d4dbb[_0xa367('0x87')];for(var _0x1a15d6=0x0;_0x1a15d6=_0xfc9e45){_0x101398=_0xfc9e45;_0x3424a1=0xc8;}else{_0x3424a1=0xce;}_0x30ba88[_0x881f('0x1c')](_0x3424a1);return _0x30ba88[_0x881f('0x22')](_0x881f('0x23'),_0x34b9a2+'-'+_0x101398+'/'+_0xfc9e45)[_0x881f('0x1d')](_0x2de062);}return null;};}function patchUpdates(_0x545e29){return function(_0x408719){try{jsonpatch[_0x881f('0x24')](_0x408719,_0x545e29,!![]);}catch(_0x4e2fdc){return BPromise['reject'](_0x4e2fdc);}return _0x408719[_0x881f('0x25')]();};}function saveUpdates(_0x3ff408,_0x57e09d){return function(_0x97865c){if(_0x97865c){return _0x97865c['update'](_0x3ff408)[_0x881f('0x26')](function(_0x603d4){return _0x603d4;});}return null;};}function removeEntity(_0x437abb,_0x1b81e5){return function(_0x593ad5){if(_0x593ad5){return _0x593ad5[_0x881f('0x27')]()[_0x881f('0x26')](function(){_0x437abb[_0x881f('0x1c')](0xcc)[_0x881f('0x1b')]();});}};}function handleEntityNotFound(_0x509e7c,_0x7c06c2){return function(_0x454970){if(!_0x454970){_0x509e7c[_0x881f('0x28')](0x194);}return _0x454970;};}function handleError(_0x440212,_0x33bf16){_0x33bf16=_0x33bf16||0x1f4;return function(_0x5599e6){logger[_0x881f('0x29')](_0x5599e6[_0x881f('0x2a')]);if(_0x5599e6[_0x881f('0x2b')]){delete _0x5599e6[_0x881f('0x2b')];}_0x440212[_0x881f('0x1c')](_0x33bf16)['send'](_0x5599e6);};}exports[_0x881f('0x2c')]=function(_0x328721,_0x291446){var _0x4ddfc1={},_0x319037={},_0x3308a4={'count':0x0,'rows':[]};return db[_0x881f('0x2d')][_0x881f('0x2e')]()[_0x881f('0x26')](function(_0x35c6bb){var _0x97e930=[];for(var _0x1d50fc=0x0;_0x1d50fc0x1){_0x29336a['or'](_0x881f('0x69'),qs[_0x881f('0x6a')](_0x452b04),null);}else{if(qs['isNumeric'](_0x452b04)){_0x29336a['or'](_0x881f('0x6b'),_0x452b04+'%');_0x29336a['or']('c.phone\x20LIKE\x20?',_0x452b04+'%');_0x29336a['or'](_0x881f('0x6c'),_0x452b04+'%');_0x29336a['or'](_0x881f('0x6d'),_0x452b04+'%');}else if(qs[_0x881f('0x6e')](_0x452b04)){_0x29336a['or'](_0x881f('0x6f'),_0x452b04+'%');}else{_0x29336a['or'](_0x881f('0x70'),'%'+_0x452b04+'%');_0x29336a['or'](_0x881f('0x71'),'%'+_0x452b04+'%');_0x29336a['or']('c.email\x20LIKE\x20?','%'+_0x452b04+'%');}}}}_0x34a96c['where'](_0x29336a);_0x34a96c['group']('c.id');var _0x4d8788={'type':db[_0x881f('0x72')]['QueryTypes'][_0x881f('0x73')],'raw':!![]};var _0xeac224=_0x34a96c[_0x881f('0x74')]()[_0x881f('0x41')](_0x881f('0x75'));if(_0x4ddfc1[_0x881f('0x76')]){_0x4ddfc1[_0x881f('0x76')][_0x881f('0x55')](function(_0x1c5df8){_0x34a96c[_0x881f('0x76')]('c.'+_0x1c5df8[0x0],_0x1c5df8[0x1]==='DESC'?![]:!![]);});}if(!_[_0x881f('0x62')](_0x23a338)){_0x34a96c[_0x881f('0x77')](_0x5d1a1);_0xeac224['where']('t.id\x20IN\x20?',_0x23a338);}BPromise[_0x881f('0x78')]()[_0x881f('0x26')](function(){if(!_0x18f2c1)return;if(_0x328721['user'][_0x881f('0x79')]!==_0x881f('0x7a'))return;if(!_['some'](_0x18f2c1[_0x881f('0x50')],[_0x881f('0x41'),_0x881f('0x7b')])){return _0x328721[_0x881f('0x7c')][_0x881f('0x7d')]({'attributes':['id'],'raw':!![]})[_0x881f('0x26')](function(_0x5e624f){if(_[_0x881f('0x62')](_0x5e624f)){_0xeac224[_0x881f('0x4a')](_0x881f('0x7e'));_0x34a96c[_0x881f('0x4a')](_0x881f('0x7e'));}else{_0xeac224[_0x881f('0x4a')](_0x881f('0x7f'),_['map'](_0x5e624f,'id'));_0x34a96c[_0x881f('0x4a')](_0x881f('0x7f'),_['map'](_0x5e624f,'id'));}});}})[_0x881f('0x26')](function(){if(_0x328721['user']['role']===_0x881f('0x7a')&&!_0x18f2c1&&!_0x328721[_0x881f('0x38')][_0x881f('0x63')])return[];return db[_0x881f('0x80')][_0x881f('0x38')](_0xeac224[_0x881f('0x81')](),_0x4d8788);})[_0x881f('0x26')](function(_0x6c5766){_0x3308a4[_0x881f('0x21')]=_0x6c5766[_0x881f('0x30')];if(_0x3308a4[_0x881f('0x21')]===0x0)return[];return db[_0x881f('0x80')][_0x881f('0x38')](_0x57d092['toString'](),_0x4d8788)[_0x881f('0x26')](function(_0x5ab236){_0x57f3f7=_['keyBy'](_0x5ab236,'id');_0x4d8788=_[_0x881f('0x82')](_0x4d8788,{'model':db[_0x881f('0x2d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x328721[_0x881f('0x38')][_0x881f('0x3d')]){_0x4ddfc1['attributes'][_0x881f('0x55')](function(_0x1c705c){_0x34a96c['field']('c.'+_0x1c705c);});}else{_0x34a96c['field'](_0x881f('0x75'));_0x34a96c[_0x881f('0x41')](_0x881f('0x83'));_0x34a96c[_0x881f('0x41')](_0x881f('0x84'));_0x34a96c['field'](_0x881f('0x85'));_0x34a96c['field'](_0x881f('0x86'));_0x34a96c['field'](_0x881f('0x87'));_0x34a96c['field'](_0x881f('0x88'));_0x34a96c[_0x881f('0x41')](_0x881f('0x89'));_0x34a96c[_0x881f('0x41')](_0x881f('0x8a'));_0x34a96c[_0x881f('0x41')](_0x881f('0x8b'));_0x34a96c['field'](_0x881f('0x8c'));_0x34a96c[_0x881f('0x41')](_0x881f('0x8d'),_0x881f('0x8e'));}if(_0x4ddfc1[_0x881f('0x20')])_0x34a96c[_0x881f('0x20')](_0x4ddfc1[_0x881f('0x20')]);if(_0x4ddfc1[_0x881f('0x1e')])_0x34a96c[_0x881f('0x1e')](_0x4ddfc1[_0x881f('0x1e')]);return db['sequelize'][_0x881f('0x38')](_0x34a96c[_0x881f('0x81')](),_0x4d8788);});})[_0x881f('0x26')](function(_0x32f647){_0x32f647[_0x881f('0x55')](function(_0x5cd7a7){if(_0x5cd7a7[_0x881f('0x8e')]){_0x5cd7a7[_0x881f('0x8f')]=[];_0x5cd7a7[_0x881f('0x8e')][_0x881f('0x53')](',')[_0x881f('0x55')](function(_0x1ff73c){_0x5cd7a7[_0x881f('0x8f')]['push'](_0x57f3f7[_0x1ff73c]);});}delete _0x5cd7a7['TagIds'];});_0x3308a4[_0x881f('0x90')]=_0x32f647;return _0x3308a4;})[_0x881f('0x26')](respondWithFilteredResult(_0x291446,_0x4ddfc1));})[_0x881f('0x91')](handleError(_0x291446,null));};exports[_0x881f('0x27')]=function(_0x40fb1a,_0x58770f){return db[_0x881f('0x2d')][_0x881f('0x51')]({'where':{'id':_0x40fb1a[_0x881f('0x92')]['id']}})[_0x881f('0x26')](handleEntityNotFound(_0x58770f,null))[_0x881f('0x26')](removeEntity(_0x58770f,null))[_0x881f('0x91')](handleError(_0x58770f,null));};exports['describe']=function(_0x38cb9b,_0x166699){return db[_0x881f('0x2d')][_0x881f('0x2e')]()[_0x881f('0x26')](function(_0x54ab6b){delete _0x54ab6b[_0x881f('0x93')];for(var _0x5d09dc=0x0;_0x5d09dc{}\s\\|]/g,'-');_0x2e1136(null,util[_0x3b49('0x1e')]('%s-%s%s',path['basename'](_0x4691ac['originalname'],path['extname'](_0x4691ac['originalname'])),Date[_0x3b49('0x1f')](),path[_0x3b49('0x20')](_0x4691ac[_0x3b49('0x1c')])));}})});router['post']('/csv',upload[_0x3b49('0x21')](_0x3b49('0x22')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x3b49('0x18')]({'destination':function(_0x1af644,_0x27c4b6,_0x2dc80e){_0x2dc80e(null,path[_0x3b49('0x19')](config['root'],'server/files/tmp'));},'filename':function(_0xd875ed,_0x3b5f17,_0x1b7814){_0x3b5f17['originalname']=_0x3b5f17[_0x3b49('0x1c')][_0x3b49('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1b7814(null,util[_0x3b49('0x1e')](_0x3b49('0x23'),path[_0x3b49('0x24')](_0x3b5f17['originalname'],path[_0x3b49('0x20')](_0x3b5f17['originalname'])),Date[_0x3b49('0x1f')](),path[_0x3b49('0x20')](_0x3b5f17['originalname'])));}})});router[_0x3b49('0x13')](_0x3b49('0x25'),upload[_0x3b49('0x21')](_0x3b49('0x22')),controller['upload']);router[_0x3b49('0x13')](_0x3b49('0x26'),auth['isAuthenticated'](),controller[_0x3b49('0x27')]);router[_0x3b49('0x28')](_0x3b49('0x7'),auth['isAuthenticated'](),controller[_0x3b49('0x29')]);router[_0x3b49('0x2a')](_0x3b49('0x7'),auth['isAuthenticated'](),controller[_0x3b49('0x2b')]);module[_0x3b49('0x2c')]=router; \ No newline at end of file +var _0x4341=['originalname','format','%s-%s%s','basename','extname','now','/csv','file','diskStorage','/upload/:id','import','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','/describe','/:id/tags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','/:id/journey','getJourney','post','/merge','create','/create_many','bulkCreate','setTags','join','root','server/files/tmp'];(function(_0xd7b45a,_0x4fe0f0){var _0x16c83e=function(_0x5a4d99){while(--_0x5a4d99){_0xd7b45a['push'](_0xd7b45a['shift']());}};_0x16c83e(++_0x4fe0f0);}(_0x4341,0x1dc));var _0x1434=function(_0x5038e3,_0x29855b){_0x5038e3=_0x5038e3-0x0;var _0x593c8d=_0x4341[_0x5038e3];return _0x593c8d;};'use strict';var multer=require(_0x1434('0x0'));var util=require(_0x1434('0x1'));var path=require(_0x1434('0x2'));var timeout=require('connect-timeout');var express=require(_0x1434('0x3'));var router=express['Router']();var fs_extra=require(_0x1434('0x4'));var auth=require(_0x1434('0x5'));var interaction=require(_0x1434('0x6'));var config=require(_0x1434('0x7'));var controller=require(_0x1434('0x8'));router[_0x1434('0x9')]('/',auth[_0x1434('0xa')](),controller['index']);router[_0x1434('0x9')](_0x1434('0xb'),auth[_0x1434('0xa')](),controller['describe']);router[_0x1434('0x9')]('/:id',auth[_0x1434('0xa')](),controller['show']);router[_0x1434('0x9')](_0x1434('0xc'),auth['isAuthenticated'](),controller['getTags']);router[_0x1434('0x9')](_0x1434('0xd'),auth[_0x1434('0xa')](),controller[_0x1434('0xe')]);router[_0x1434('0x9')](_0x1434('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x1434('0x9')](_0x1434('0x10'),auth['isAuthenticated'](),controller[_0x1434('0x11')]);router[_0x1434('0x9')]('/:id/jscripty_sessions',auth[_0x1434('0xa')](),controller[_0x1434('0x12')]);router[_0x1434('0x9')](_0x1434('0x13'),auth['isAuthenticated'](),controller[_0x1434('0x14')]);router[_0x1434('0x15')](_0x1434('0x16'),auth[_0x1434('0xa')](),controller['merge']);router['post']('/',auth[_0x1434('0xa')](),controller[_0x1434('0x17')]);router[_0x1434('0x15')](_0x1434('0x18'),auth[_0x1434('0xa')](),controller[_0x1434('0x19')]);router[_0x1434('0x15')]('/:id/tags',auth[_0x1434('0xa')](),controller[_0x1434('0x1a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x276efc,_0x1d4452,_0x5314d7){_0x5314d7(null,path[_0x1434('0x1b')](config[_0x1434('0x1c')],_0x1434('0x1d')));},'filename':function(_0x3f9b54,_0x4f557a,_0x534df3){_0x4f557a['originalname']=_0x4f557a[_0x1434('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x534df3(null,util[_0x1434('0x1f')](_0x1434('0x20'),path[_0x1434('0x21')](_0x4f557a[_0x1434('0x1e')],path[_0x1434('0x22')](_0x4f557a[_0x1434('0x1e')])),Date[_0x1434('0x23')](),path[_0x1434('0x22')](_0x4f557a['originalname'])));}})});router['post'](_0x1434('0x24'),upload['single'](_0x1434('0x25')),controller['uploadCsv']);var upload=multer({'storage':multer[_0x1434('0x26')]({'destination':function(_0x844f88,_0xb3b508,_0x403b41){_0x403b41(null,path[_0x1434('0x1b')](config[_0x1434('0x1c')],'server/files/tmp'));},'filename':function(_0x3a3b66,_0x30febd,_0x279657){_0x30febd[_0x1434('0x1e')]=_0x30febd['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x279657(null,util[_0x1434('0x1f')](_0x1434('0x20'),path[_0x1434('0x21')](_0x30febd[_0x1434('0x1e')],path['extname'](_0x30febd[_0x1434('0x1e')])),Date[_0x1434('0x23')](),path[_0x1434('0x22')](_0x30febd['originalname'])));}})});router[_0x1434('0x15')]('/upload',upload['single'](_0x1434('0x25')),controller['upload']);router[_0x1434('0x15')](_0x1434('0x27'),auth[_0x1434('0xa')](),controller[_0x1434('0x28')]);router[_0x1434('0x29')]('/:id',auth[_0x1434('0xa')](),controller[_0x1434('0x2a')]);router[_0x1434('0x2b')]('/:id',auth[_0x1434('0xa')](),controller[_0x1434('0x2c')]);module[_0x1434('0x2d')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 2c7c0f8..b322757 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 _0xeb0b=['BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','setDataValue','name','STRING','TEXT','type','select','parse','values','isArray'];(function(_0x5bc368,_0x525aa3){var _0x2254b8=function(_0x843caf){while(--_0x843caf){_0x5bc368['push'](_0x5bc368['shift']());}};_0x2254b8(++_0x525aa3);}(_0xeb0b,0x1df));var _0xbeb0=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xeb0b[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0xbeb0('0x0'));var _=require(_0xbeb0('0x1'));module[_0xbeb0('0x2')]={'name':{'type':Sequelize[_0xbeb0('0x3')],'get':function(_0x1b5d06){return this[_0xbeb0('0x4')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x50aa1e){this[_0xbeb0('0x5')]('alias',_0x50aa1e?_0x50aa1e:this[_0xbeb0('0x4')](_0xbeb0('0x6')));}},'type':{'type':Sequelize[_0xbeb0('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0xbeb0('0x8')]('long'),'get':function(){if(this[_0xbeb0('0x4')](_0xbeb0('0x9'))===_0xbeb0('0xa')){return JSON[_0xbeb0('0xb')](this[_0xbeb0('0x4')](_0xbeb0('0xc')));}else{return this[_0xbeb0('0x4')](_0xbeb0('0xc'));}},'set':function(_0x213e5e){if(Array[_0xbeb0('0xd')](_0x213e5e)){this[_0xbeb0('0x5')](_0xbeb0('0xc'),JSON['stringify'](_0x213e5e));}else{this['setDataValue'](_0xbeb0('0xc'),_0x213e5e);}}},'required':{'type':Sequelize[_0xbeb0('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xbeb0('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xbeb0('0xf')](_0xbeb0('0x10'))}}; \ No newline at end of file +var _0x3efd=['exports','VIRTUAL','getDataValue','alias','STRING','TEXT','long','type','parse','values','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3efd,0x1df));var _0xd3ef=function(_0xb21c5,_0x5dd827){_0xb21c5=_0xb21c5-0x0;var _0x17fa86=_0x3efd[_0xb21c5];return _0x17fa86;};'use strict';var Sequelize=require(_0xd3ef('0x0'));var _=require('lodash');module[_0xd3ef('0x1')]={'name':{'type':Sequelize[_0xd3ef('0x2')],'get':function(_0x3746e2){return this[_0xd3ef('0x3')](_0xd3ef('0x4'));}},'alias':{'type':Sequelize[_0xd3ef('0x5')],'allowNull':![],'set':function(_0x635323){this['setDataValue'](_0xd3ef('0x4'),_0x635323?_0x635323:this[_0xd3ef('0x3')]('name'));}},'type':{'type':Sequelize[_0xd3ef('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xd3ef('0x6')](_0xd3ef('0x7')),'get':function(){if(this[_0xd3ef('0x3')](_0xd3ef('0x8'))==='select'){return JSON[_0xd3ef('0x9')](this[_0xd3ef('0x3')](_0xd3ef('0xa')));}else{return this['getDataValue']('values');}},'set':function(_0x16c07b){if(Array['isArray'](_0x16c07b)){this[_0xd3ef('0xb')](_0xd3ef('0xa'),JSON[_0xd3ef('0xc')](_0x16c07b));}else{this['setDataValue'](_0xd3ef('0xa'),_0x16c07b);}}},'required':{'type':Sequelize[_0xd3ef('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xd3ef('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xd3ef('0xe')](_0xd3ef('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index fd0ba5d..065014e 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 _0x1c29=['../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','end','error','stack','send','index','rawAttributes','type','key','differenceBy','map','name','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','options','findAll','catch','show','params','length','includeAll','include','CmCustomField','find','update','body','sequelize','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x48291a,_0x5a29dc){var _0xf76871=function(_0x2a4be5){while(--_0x2a4be5){_0x48291a['push'](_0x48291a['shift']());}};_0xf76871(++_0x5a29dc);}(_0x1c29,0xed));var _0x91c2=function(_0x59305d,_0x497584){_0x59305d=_0x59305d-0x0;var _0x1d22e5=_0x1c29[_0x59305d];return _0x1d22e5;};'use strict';var emlformat=require(_0x91c2('0x0'));var rimraf=require(_0x91c2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x91c2('0x2'));var rp=require(_0x91c2('0x3'));var moment=require('moment');var BPromise=require(_0x91c2('0x4'));var Mustache=require(_0x91c2('0x5'));var util=require(_0x91c2('0x6'));var path=require(_0x91c2('0x7'));var sox=require('sox');var csv=require(_0x91c2('0x8'));var ejs=require(_0x91c2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91c2('0xa'));var squel=require(_0x91c2('0xb'));var crypto=require(_0x91c2('0xc'));var jsforce=require(_0x91c2('0xd'));var deskjs=require(_0x91c2('0xe'));var toCsv=require(_0x91c2('0x8'));var querystring=require('querystring');var Papa=require(_0x91c2('0xf'));var Redis=require('ioredis');var authService=require(_0x91c2('0x10'));var qs=require(_0x91c2('0x11'));var as=require(_0x91c2('0x12'));var hardwareService=require(_0x91c2('0x13'));var logger=require(_0x91c2('0x14'))('api');var utils=require(_0x91c2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x91c2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x428eaa,_0x3abc3f){_0x3abc3f=_0x3abc3f||0xcc;return function(_0x205f4e){if(_0x205f4e){return _0x428eaa[_0x91c2('0x17')](_0x3abc3f);}return _0x428eaa[_0x91c2('0x18')](_0x3abc3f)['end']();};}function respondWithResult(_0x12ffc9,_0x275740){_0x275740=_0x275740||0xc8;return function(_0x349e8f){if(_0x349e8f){return _0x12ffc9[_0x91c2('0x18')](_0x275740)['json'](_0x349e8f);}};}function respondWithFilteredResult(_0x30b7bf,_0x46593d){return function(_0x2c6e2d){if(_0x2c6e2d){var _0x5c374d=typeof _0x46593d[_0x91c2('0x19')]===_0x91c2('0x1a')&&typeof _0x46593d[_0x91c2('0x1b')]===_0x91c2('0x1a');var _0x471e3b=_0x2c6e2d[_0x91c2('0x1c')];var _0x4b418e=_0x5c374d?0x0:_0x46593d[_0x91c2('0x19')];var _0x34be8f=_0x5c374d?_0x2c6e2d['count']:_0x46593d[_0x91c2('0x19')]+_0x46593d['limit'];var _0x3a83b2;if(_0x34be8f>=_0x471e3b){_0x34be8f=_0x471e3b;_0x3a83b2=0xc8;}else{_0x3a83b2=0xce;}_0x30b7bf[_0x91c2('0x18')](_0x3a83b2);return _0x30b7bf[_0x91c2('0x1d')](_0x91c2('0x1e'),_0x4b418e+'-'+_0x34be8f+'/'+_0x471e3b)[_0x91c2('0x1f')](_0x2c6e2d);}return null;};}function patchUpdates(_0x49b2ae){return function(_0x241af8){try{jsonpatch['apply'](_0x241af8,_0x49b2ae,!![]);}catch(_0x44483d){return BPromise[_0x91c2('0x20')](_0x44483d);}return _0x241af8[_0x91c2('0x21')]();};}function saveUpdates(_0x4eec6a,_0x59a408){return function(_0x4375ea){if(_0x4375ea){return _0x4375ea['update'](_0x4eec6a)[_0x91c2('0x22')](function(_0x28bcf1){return _0x28bcf1;});}return null;};}function removeEntity(_0x20d65e,_0x40adbb){return function(_0x3c6c4a){if(_0x3c6c4a){return _0x3c6c4a[_0x91c2('0x23')]()['then'](function(){_0x20d65e[_0x91c2('0x18')](0xcc)[_0x91c2('0x24')]();});}};}function handleEntityNotFound(_0x3d20d8,_0x1937ad){return function(_0x524056){if(!_0x524056){_0x3d20d8[_0x91c2('0x17')](0x194);}return _0x524056;};}function handleError(_0x14e0a2,_0x26d384){_0x26d384=_0x26d384||0x1f4;return function(_0x12a72a){logger[_0x91c2('0x25')](_0x12a72a[_0x91c2('0x26')]);if(_0x12a72a['name']){delete _0x12a72a['name'];}_0x14e0a2[_0x91c2('0x18')](_0x26d384)[_0x91c2('0x27')](_0x12a72a);};}exports[_0x91c2('0x28')]=function(_0x234e9e,_0x59f7e8){var _0x3c9882={},_0x31c3e1={},_0x4d5f62={'count':0x0,'rows':[]};var _0x3d146b=_['map'](db['CmCustomField'][_0x91c2('0x29')],function(_0x7c207f){return{'name':_0x7c207f['fieldName'],'type':_0x7c207f[_0x91c2('0x2a')][_0x91c2('0x2b')]};});_0x31c3e1['model']=_[_0x91c2('0x2c')](_[_0x91c2('0x2d')](_0x3d146b,_0x91c2('0x2e')),['name']);_0x31c3e1[_0x91c2('0x2f')]=_[_0x91c2('0x30')](_0x234e9e['query']);_0x31c3e1[_0x91c2('0x31')]=_[_0x91c2('0x32')](_0x31c3e1[_0x91c2('0x33')],_0x31c3e1[_0x91c2('0x2f')]);_0x3c9882[_0x91c2('0x34')]=_[_0x91c2('0x32')](_0x31c3e1[_0x91c2('0x33')],qs[_0x91c2('0x35')](_0x234e9e[_0x91c2('0x2f')][_0x91c2('0x35')]));_0x3c9882[_0x91c2('0x34')]=_0x3c9882[_0x91c2('0x34')]['length']?_0x3c9882[_0x91c2('0x34')]:_0x31c3e1['model'];if(!_0x234e9e[_0x91c2('0x2f')][_0x91c2('0x36')](_0x91c2('0x37'))){_0x3c9882[_0x91c2('0x1b')]=qs['limit'](_0x234e9e[_0x91c2('0x2f')][_0x91c2('0x1b')]);_0x3c9882[_0x91c2('0x19')]=qs[_0x91c2('0x19')](_0x234e9e['query'][_0x91c2('0x19')]);}_0x3c9882['order']=qs[_0x91c2('0x38')](_0x234e9e[_0x91c2('0x2f')][_0x91c2('0x38')]);_0x3c9882[_0x91c2('0x39')]=qs[_0x91c2('0x31')](_['pick'](_0x234e9e['query'],_0x31c3e1['filters']),_0x3d146b);if(_0x234e9e[_0x91c2('0x2f')]['filter']){_0x3c9882['where']=_[_0x91c2('0x3a')](_0x3c9882[_0x91c2('0x39')],{'$or':_[_0x91c2('0x2d')](_0x3d146b,function(_0x56a635){if(_0x56a635['type']!==_0x91c2('0x3b')){var _0x5d1679={};_0x5d1679[_0x56a635[_0x91c2('0x2e')]]={'$like':'%'+_0x234e9e[_0x91c2('0x2f')][_0x91c2('0x3c')]+'%'};return _0x5d1679;}})});}_0x3c9882=_[_0x91c2('0x3a')]({},_0x3c9882,_0x234e9e[_0x91c2('0x3d')]);var _0x234c8b={'where':_0x3c9882[_0x91c2('0x39')]};return db['CmCustomField'][_0x91c2('0x1c')](_0x234c8b)[_0x91c2('0x22')](function(_0x38ffa1){_0x4d5f62[_0x91c2('0x1c')]=_0x38ffa1;if(_0x234e9e[_0x91c2('0x2f')]['includeAll']){_0x3c9882['include']=[{'all':!![]}];}return db['CmCustomField'][_0x91c2('0x3e')](_0x3c9882);})[_0x91c2('0x22')](function(_0x5046a9){_0x4d5f62['rows']=_0x5046a9;return _0x4d5f62;})[_0x91c2('0x22')](respondWithFilteredResult(_0x59f7e8,_0x3c9882))[_0x91c2('0x3f')](handleError(_0x59f7e8,null));};exports[_0x91c2('0x40')]=function(_0x242d46,_0x5b7147){var _0x38e2b4={'raw':!![],'where':{'id':_0x242d46[_0x91c2('0x41')]['id']}},_0x2f708c={};_0x2f708c['model']=_[_0x91c2('0x30')](db['CmCustomField'][_0x91c2('0x29')]);_0x2f708c[_0x91c2('0x2f')]=_[_0x91c2('0x30')](_0x242d46[_0x91c2('0x2f')]);_0x2f708c[_0x91c2('0x31')]=_[_0x91c2('0x32')](_0x2f708c['model'],_0x2f708c[_0x91c2('0x2f')]);_0x38e2b4[_0x91c2('0x34')]=_[_0x91c2('0x32')](_0x2f708c[_0x91c2('0x33')],qs[_0x91c2('0x35')](_0x242d46[_0x91c2('0x2f')][_0x91c2('0x35')]));_0x38e2b4[_0x91c2('0x34')]=_0x38e2b4[_0x91c2('0x34')][_0x91c2('0x42')]?_0x38e2b4[_0x91c2('0x34')]:_0x2f708c['model'];if(_0x242d46[_0x91c2('0x2f')][_0x91c2('0x43')]){_0x38e2b4[_0x91c2('0x44')]=[{'all':!![]}];}_0x38e2b4=_[_0x91c2('0x3a')]({},_0x38e2b4,_0x242d46['options']);return db[_0x91c2('0x45')][_0x91c2('0x46')](_0x38e2b4)[_0x91c2('0x22')](handleEntityNotFound(_0x5b7147,null))['then'](respondWithResult(_0x5b7147,null))[_0x91c2('0x3f')](handleError(_0x5b7147,null));};exports[_0x91c2('0x47')]=function(_0x3afd42,_0xed2546){if(_0x3afd42['body']['id']){delete _0x3afd42[_0x91c2('0x48')]['id'];}return db[_0x91c2('0x45')][_0x91c2('0x46')]({'where':{'id':_0x3afd42[_0x91c2('0x41')]['id']}})['then'](handleEntityNotFound(_0xed2546,null))[_0x91c2('0x22')](saveUpdates(_0x3afd42['body'],null))[_0x91c2('0x22')](respondWithResult(_0xed2546,null))[_0x91c2('0x3f')](handleError(_0xed2546,null));};exports[_0x91c2('0x23')]=function(_0xa1b5ed,_0xf89d14){return db[_0x91c2('0x45')]['find']({'where':{'id':_0xa1b5ed[_0x91c2('0x41')]['id']}})[_0x91c2('0x22')](handleEntityNotFound(_0xf89d14,null))[_0x91c2('0x22')](removeEntity(_0xf89d14,null))[_0x91c2('0x3f')](handleError(_0xf89d14,null));};exports['create']=function(_0x3c2384,_0x54b4c4){var _0xca55bd;return db[_0x91c2('0x49')]['transaction'](function(_0x4ae8f6){return db[_0x91c2('0x45')]['create'](_0x3c2384[_0x91c2('0x48')],{'transaction':_0x4ae8f6})['then'](function(_0x52769b){_0xca55bd=_0x52769b;var _0x19a0c5={'type':db[_0x91c2('0x4a')]['TEXT'],'transaction':_0x4ae8f6};switch(_0x3c2384[_0x91c2('0x48')][_0x91c2('0x2a')]){case _0x91c2('0x4b'):_0x19a0c5[_0x91c2('0x2a')]=db[_0x91c2('0x4a')][_0x91c2('0x4c')];break;case _0x91c2('0x4d'):_0x19a0c5['type']=db[_0x91c2('0x4a')][_0x91c2('0x4e')];break;case _0x91c2('0x4f'):_0x19a0c5[_0x91c2('0x2a')]=db[_0x91c2('0x4a')][_0x91c2('0x50')];_0x19a0c5[_0x91c2('0x51')]=![];break;default:}return db[_0x91c2('0x49')][_0x91c2('0x52')][_0x91c2('0x53')]('cm_contacts',util[_0x91c2('0x54')](_0x91c2('0x55'),_0xca55bd['id']),_0x19a0c5);})['then'](function(){return _0xca55bd;});})['then'](respondWithResult(_0x54b4c4,0xc9))[_0x91c2('0x3f')](handleError(_0x54b4c4,null));}; \ No newline at end of file +var _0x0281=['merge','VIRTUAL','options','includeAll','show','params','rawAttributes','include','find','catch','update','body','destroy','create','Sequelize','type','text','TEXT','number','INTEGER','switch','queryInterface','cm_contacts','format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','save','then','stack','name','send','index','map','CmCustomField','fieldName','key','differenceBy','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter'];(function(_0xce4f42,_0x464c26){var _0x5815d3=function(_0x14be3d){while(--_0x14be3d){_0xce4f42['push'](_0xce4f42['shift']());}};_0x5815d3(++_0x464c26);}(_0x0281,0x1c6));var _0x1028=function(_0x55a0bf,_0x3f1235){_0x55a0bf=_0x55a0bf-0x0;var _0x20dfec=_0x0281[_0x55a0bf];return _0x20dfec;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1028('0x0'));var zipdir=require(_0x1028('0x1'));var jsonpatch=require(_0x1028('0x2'));var rp=require(_0x1028('0x3'));var moment=require(_0x1028('0x4'));var BPromise=require(_0x1028('0x5'));var Mustache=require(_0x1028('0x6'));var util=require(_0x1028('0x7'));var path=require(_0x1028('0x8'));var sox=require(_0x1028('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1028('0xa'));var _=require('lodash');var squel=require(_0x1028('0xb'));var crypto=require('crypto');var jsforce=require(_0x1028('0xc'));var deskjs=require(_0x1028('0xd'));var toCsv=require(_0x1028('0xe'));var querystring=require('querystring');var Papa=require(_0x1028('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1028('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1028('0x11'));var logger=require(_0x1028('0x12'))(_0x1028('0x13'));var utils=require(_0x1028('0x14'));var config=require(_0x1028('0x15'));var licenseUtil=require(_0x1028('0x16'));var db=require(_0x1028('0x17'))['db'];function respondWithStatusCode(_0x4df7ac,_0x177b27){_0x177b27=_0x177b27||0xcc;return function(_0x38549b){if(_0x38549b){return _0x4df7ac[_0x1028('0x18')](_0x177b27);}return _0x4df7ac[_0x1028('0x19')](_0x177b27)[_0x1028('0x1a')]();};}function respondWithResult(_0x1f703d,_0x2b0dfc){_0x2b0dfc=_0x2b0dfc||0xc8;return function(_0x57ceb1){if(_0x57ceb1){return _0x1f703d[_0x1028('0x19')](_0x2b0dfc)[_0x1028('0x1b')](_0x57ceb1);}};}function respondWithFilteredResult(_0x9a1a3e,_0x5b4091){return function(_0xb0bd7){if(_0xb0bd7){var _0x52e0c5=typeof _0x5b4091['offset']===_0x1028('0x1c')&&typeof _0x5b4091['limit']==='undefined';var _0x1bf954=_0xb0bd7[_0x1028('0x1d')];var _0xcb4489=_0x52e0c5?0x0:_0x5b4091[_0x1028('0x1e')];var _0x12434d=_0x52e0c5?_0xb0bd7['count']:_0x5b4091[_0x1028('0x1e')]+_0x5b4091['limit'];var _0x451bac;if(_0x12434d>=_0x1bf954){_0x12434d=_0x1bf954;_0x451bac=0xc8;}else{_0x451bac=0xce;}_0x9a1a3e[_0x1028('0x19')](_0x451bac);return _0x9a1a3e[_0x1028('0x1f')](_0x1028('0x20'),_0xcb4489+'-'+_0x12434d+'/'+_0x1bf954)['json'](_0xb0bd7);}return null;};}function patchUpdates(_0x31fd98){return function(_0x11e2d5){try{jsonpatch[_0x1028('0x21')](_0x11e2d5,_0x31fd98,!![]);}catch(_0x51f6bd){return BPromise[_0x1028('0x22')](_0x51f6bd);}return _0x11e2d5[_0x1028('0x23')]();};}function saveUpdates(_0x1c8fde,_0x5b13db){return function(_0x427e78){if(_0x427e78){return _0x427e78['update'](_0x1c8fde)[_0x1028('0x24')](function(_0x272d66){return _0x272d66;});}return null;};}function removeEntity(_0x104840,_0x365350){return function(_0x2b3d2f){if(_0x2b3d2f){return _0x2b3d2f['destroy']()['then'](function(){_0x104840[_0x1028('0x19')](0xcc)[_0x1028('0x1a')]();});}};}function handleEntityNotFound(_0x359829,_0x3103b2){return function(_0x46c9d5){if(!_0x46c9d5){_0x359829[_0x1028('0x18')](0x194);}return _0x46c9d5;};}function handleError(_0x3224be,_0x630cb6){_0x630cb6=_0x630cb6||0x1f4;return function(_0x4611f9){logger['error'](_0x4611f9[_0x1028('0x25')]);if(_0x4611f9[_0x1028('0x26')]){delete _0x4611f9[_0x1028('0x26')];}_0x3224be[_0x1028('0x19')](_0x630cb6)[_0x1028('0x27')](_0x4611f9);};}exports[_0x1028('0x28')]=function(_0x47de57,_0x46b43d){var _0x2c226e={},_0x22fa0a={},_0x7ff5f7={'count':0x0,'rows':[]};var _0x1989bb=_[_0x1028('0x29')](db[_0x1028('0x2a')]['rawAttributes'],function(_0x3e8010){return{'name':_0x3e8010[_0x1028('0x2b')],'type':_0x3e8010['type'][_0x1028('0x2c')]};});_0x22fa0a['model']=_[_0x1028('0x2d')](_[_0x1028('0x29')](_0x1989bb,_0x1028('0x26')),[_0x1028('0x26')]);_0x22fa0a[_0x1028('0x2e')]=_[_0x1028('0x2f')](_0x47de57['query']);_0x22fa0a[_0x1028('0x30')]=_[_0x1028('0x31')](_0x22fa0a[_0x1028('0x32')],_0x22fa0a[_0x1028('0x2e')]);_0x2c226e[_0x1028('0x33')]=_['intersection'](_0x22fa0a[_0x1028('0x32')],qs[_0x1028('0x34')](_0x47de57[_0x1028('0x2e')][_0x1028('0x34')]));_0x2c226e[_0x1028('0x33')]=_0x2c226e['attributes'][_0x1028('0x35')]?_0x2c226e[_0x1028('0x33')]:_0x22fa0a[_0x1028('0x32')];if(!_0x47de57['query'][_0x1028('0x36')](_0x1028('0x37'))){_0x2c226e[_0x1028('0x38')]=qs['limit'](_0x47de57[_0x1028('0x2e')][_0x1028('0x38')]);_0x2c226e['offset']=qs[_0x1028('0x1e')](_0x47de57[_0x1028('0x2e')]['offset']);}_0x2c226e[_0x1028('0x39')]=qs[_0x1028('0x3a')](_0x47de57['query'][_0x1028('0x3a')]);_0x2c226e[_0x1028('0x3b')]=qs[_0x1028('0x30')](_[_0x1028('0x3c')](_0x47de57[_0x1028('0x2e')],_0x22fa0a[_0x1028('0x30')]),_0x1989bb);if(_0x47de57[_0x1028('0x2e')][_0x1028('0x3d')]){_0x2c226e['where']=_[_0x1028('0x3e')](_0x2c226e[_0x1028('0x3b')],{'$or':_[_0x1028('0x29')](_0x1989bb,function(_0x3021b8){if(_0x3021b8['type']!==_0x1028('0x3f')){var _0x49c98f={};_0x49c98f[_0x3021b8['name']]={'$like':'%'+_0x47de57['query'][_0x1028('0x3d')]+'%'};return _0x49c98f;}})});}_0x2c226e=_[_0x1028('0x3e')]({},_0x2c226e,_0x47de57[_0x1028('0x40')]);var _0x44ce5d={'where':_0x2c226e['where']};return db[_0x1028('0x2a')]['count'](_0x44ce5d)['then'](function(_0x5efaf0){_0x7ff5f7['count']=_0x5efaf0;if(_0x47de57[_0x1028('0x2e')][_0x1028('0x41')]){_0x2c226e['include']=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x2c226e);})['then'](function(_0x2c3617){_0x7ff5f7['rows']=_0x2c3617;return _0x7ff5f7;})['then'](respondWithFilteredResult(_0x46b43d,_0x2c226e))['catch'](handleError(_0x46b43d,null));};exports[_0x1028('0x42')]=function(_0x32d52e,_0xd05b22){var _0x1699e2={'raw':!![],'where':{'id':_0x32d52e[_0x1028('0x43')]['id']}},_0xc2f31c={};_0xc2f31c[_0x1028('0x32')]=_['keys'](db[_0x1028('0x2a')][_0x1028('0x44')]);_0xc2f31c[_0x1028('0x2e')]=_[_0x1028('0x2f')](_0x32d52e[_0x1028('0x2e')]);_0xc2f31c[_0x1028('0x30')]=_[_0x1028('0x31')](_0xc2f31c[_0x1028('0x32')],_0xc2f31c[_0x1028('0x2e')]);_0x1699e2['attributes']=_[_0x1028('0x31')](_0xc2f31c['model'],qs['fields'](_0x32d52e[_0x1028('0x2e')][_0x1028('0x34')]));_0x1699e2[_0x1028('0x33')]=_0x1699e2['attributes']['length']?_0x1699e2[_0x1028('0x33')]:_0xc2f31c[_0x1028('0x32')];if(_0x32d52e[_0x1028('0x2e')][_0x1028('0x41')]){_0x1699e2[_0x1028('0x45')]=[{'all':!![]}];}_0x1699e2=_[_0x1028('0x3e')]({},_0x1699e2,_0x32d52e[_0x1028('0x40')]);return db['CmCustomField'][_0x1028('0x46')](_0x1699e2)[_0x1028('0x24')](handleEntityNotFound(_0xd05b22,null))[_0x1028('0x24')](respondWithResult(_0xd05b22,null))[_0x1028('0x47')](handleError(_0xd05b22,null));};exports[_0x1028('0x48')]=function(_0x2ed0fe,_0x11de4f){if(_0x2ed0fe[_0x1028('0x49')]['id']){delete _0x2ed0fe[_0x1028('0x49')]['id'];}return db[_0x1028('0x2a')][_0x1028('0x46')]({'where':{'id':_0x2ed0fe[_0x1028('0x43')]['id']}})['then'](handleEntityNotFound(_0x11de4f,null))[_0x1028('0x24')](saveUpdates(_0x2ed0fe[_0x1028('0x49')],null))['then'](respondWithResult(_0x11de4f,null))['catch'](handleError(_0x11de4f,null));};exports[_0x1028('0x4a')]=function(_0x2b9b0f,_0x31adea){return db[_0x1028('0x2a')][_0x1028('0x46')]({'where':{'id':_0x2b9b0f['params']['id']}})[_0x1028('0x24')](handleEntityNotFound(_0x31adea,null))[_0x1028('0x24')](removeEntity(_0x31adea,null))[_0x1028('0x47')](handleError(_0x31adea,null));};exports[_0x1028('0x4b')]=function(_0x2aa381,_0x36880e){var _0x540120;return db['sequelize']['transaction'](function(_0x422150){return db[_0x1028('0x2a')][_0x1028('0x4b')](_0x2aa381[_0x1028('0x49')],{'transaction':_0x422150})[_0x1028('0x24')](function(_0x32d676){_0x540120=_0x32d676;var _0x247f36={'type':db[_0x1028('0x4c')]['TEXT'],'transaction':_0x422150};switch(_0x2aa381[_0x1028('0x49')][_0x1028('0x4d')]){case _0x1028('0x4e'):_0x247f36[_0x1028('0x4d')]=db[_0x1028('0x4c')][_0x1028('0x4f')];break;case _0x1028('0x50'):_0x247f36[_0x1028('0x4d')]=db[_0x1028('0x4c')][_0x1028('0x51')];break;case _0x1028('0x52'):_0x247f36[_0x1028('0x4d')]=db[_0x1028('0x4c')]['BOOLEAN'];_0x247f36['defaultValue']=![];break;default:}return db['sequelize'][_0x1028('0x53')]['addColumn'](_0x1028('0x54'),util[_0x1028('0x55')]('cf_%d',_0x540120['id']),_0x247f36);})['then'](function(){return _0x540120;});})[_0x1028('0x24')](respondWithResult(_0x36880e,0xc9))[_0x1028('0x47')](handleError(_0x36880e,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 9ccc555..f9d125f 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 _0x1e7f=['request-promise','path','rimraf','../../config/environment','exports','define','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird'];(function(_0x43c040,_0x3fe3d7){var _0x280d9e=function(_0x386a82){while(--_0x386a82){_0x43c040['push'](_0x43c040['shift']());}};_0x280d9e(++_0x3fe3d7);}(_0x1e7f,0x7f));var _0xf1e7=function(_0x244394,_0x2ea05b){_0x244394=_0x244394-0x0;var _0x58b2a7=_0x1e7f[_0x244394];return _0x58b2a7;};'use strict';var _=require(_0xf1e7('0x0'));var util=require('util');var logger=require(_0xf1e7('0x1'))(_0xf1e7('0x2'));var moment=require(_0xf1e7('0x3'));var BPromise=require(_0xf1e7('0x4'));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('./cmCustomField.attributes');module[_0xf1e7('0x9')]=function(_0x201910,_0x2b19f7){return _0x201910[_0xf1e7('0xa')]('CmCustomField',attributes,{'tableName':_0xf1e7('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a6e=['bluebird','path','./cmCustomField.attributes','exports','define','cm_custom_fields','lodash','util','../../config/logger','api'];(function(_0x51674a,_0x77ccff){var _0x13fca6=function(_0x3d6c27){while(--_0x3d6c27){_0x51674a['push'](_0x51674a['shift']());}};_0x13fca6(++_0x77ccff);}(_0x0a6e,0xd8));var _0xe0a6=function(_0x398747,_0x17d52d){_0x398747=_0x398747-0x0;var _0x2fb5b6=_0x0a6e[_0x398747];return _0x2fb5b6;};'use strict';var _=require(_0xe0a6('0x0'));var util=require(_0xe0a6('0x1'));var logger=require(_0xe0a6('0x2'))(_0xe0a6('0x3'));var moment=require('moment');var BPromise=require(_0xe0a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0a6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe0a6('0x6'));module[_0xe0a6('0x7')]=function(_0x41fca2,_0x54f9a9){return _0x41fca2[_0xe0a6('0x8')]('CmCustomField',attributes,{'tableName':_0xe0a6('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 1cca681..9a3b9dd 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 _0x025b=['message','result','lodash','util','bluebird','../../config/utils','rpc','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x366ec6,_0x179324){var _0x2f303a=function(_0x42f44a){while(--_0x42f44a){_0x366ec6['push'](_0x366ec6['shift']());}};_0x2f303a(++_0x179324);}(_0x025b,0xfe));var _0xb025=function(_0x1a8d23,_0x75b040){_0x1a8d23=_0x1a8d23-0x0;var _0x36c396=_0x025b[_0x1a8d23];return _0x36c396;};'use strict';var _=require(_0xb025('0x0'));var util=require(_0xb025('0x1'));var moment=require('moment');var BPromise=require(_0xb025('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb025('0x3'));var logger=require('../../config/logger')(_0xb025('0x4'));var config=require('../../config/environment');var jayson=require(_0xb025('0x5'));var client=jayson[_0xb025('0x6')][_0xb025('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5462c3,_0x2ec650,_0xcbf99b){return new BPromise(function(_0x125b1d,_0x1d6d31){return client[_0xb025('0x8')](_0x5462c3,_0xcbf99b)[_0xb025('0x9')](function(_0x2bbc28){logger[_0xb025('0xa')](_0xb025('0xb'),_0x2ec650,_0xb025('0xc'));logger['debug'](_0xb025('0xd'),_0x2ec650,_0xb025('0xc'),JSON[_0xb025('0xe')](_0x2bbc28));if(_0x2bbc28[_0xb025('0xf')]){if(_0x2bbc28[_0xb025('0xf')]['code']===0x1f4){logger['error'](_0xb025('0xb'),_0x2ec650,_0x2bbc28['error']['message']);return _0x1d6d31(_0x2bbc28[_0xb025('0xf')][_0xb025('0x10')]);}logger[_0xb025('0xf')](_0xb025('0xb'),_0x2ec650,_0x2bbc28[_0xb025('0xf')][_0xb025('0x10')]);return _0x125b1d(_0x2bbc28[_0xb025('0xf')]['message']);}else{logger[_0xb025('0xa')](_0xb025('0xb'),_0x2ec650,_0xb025('0xc'));_0x125b1d(_0x2bbc28[_0xb025('0x11')][_0xb025('0x10')]);}})['catch'](function(_0xf5e98d){logger[_0xb025('0xf')]('CmCustomField,\x20%s,\x20%s',_0x2ec650,_0xf5e98d);_0x1d6d31(_0xf5e98d);});});} \ No newline at end of file +var _0x1a8d=['stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x34c7dc,_0x2b683d){var _0x52d8bc=function(_0x78330f){while(--_0x78330f){_0x34c7dc['push'](_0x34c7dc['shift']());}};_0x52d8bc(++_0x2b683d);}(_0x1a8d,0x89));var _0xd1a8=function(_0x31d57e,_0x26fd71){_0x31d57e=_0x31d57e-0x0;var _0x550703=_0x1a8d[_0x31d57e];return _0x550703;};'use strict';var _=require('lodash');var util=require(_0xd1a8('0x0'));var moment=require(_0xd1a8('0x1'));var BPromise=require(_0xd1a8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1a8('0x3'));var db=require(_0xd1a8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd1a8('0x5'))(_0xd1a8('0x6'));var config=require(_0xd1a8('0x7'));var jayson=require(_0xd1a8('0x8'));var client=jayson[_0xd1a8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0512,_0x36786a,_0xdb114e){return new BPromise(function(_0x364504,_0x5d3db4){return client[_0xd1a8('0xa')](_0x2c0512,_0xdb114e)[_0xd1a8('0xb')](function(_0xab5b2d){logger[_0xd1a8('0xc')](_0xd1a8('0xd'),_0x36786a,_0xd1a8('0xe'));logger[_0xd1a8('0xf')](_0xd1a8('0x10'),_0x36786a,_0xd1a8('0xe'),JSON[_0xd1a8('0x11')](_0xab5b2d));if(_0xab5b2d[_0xd1a8('0x12')]){if(_0xab5b2d['error'][_0xd1a8('0x13')]===0x1f4){logger[_0xd1a8('0x12')](_0xd1a8('0xd'),_0x36786a,_0xab5b2d[_0xd1a8('0x12')][_0xd1a8('0x14')]);return _0x5d3db4(_0xab5b2d['error'][_0xd1a8('0x14')]);}logger[_0xd1a8('0x12')](_0xd1a8('0xd'),_0x36786a,_0xab5b2d[_0xd1a8('0x12')][_0xd1a8('0x14')]);return _0x364504(_0xab5b2d[_0xd1a8('0x12')][_0xd1a8('0x14')]);}else{logger[_0xd1a8('0xc')]('CmCustomField,\x20%s,\x20%s',_0x36786a,_0xd1a8('0xe'));_0x364504(_0xab5b2d['result']['message']);}})[_0xd1a8('0x15')](function(_0x5d6ef1){logger[_0xd1a8('0x12')]('CmCustomField,\x20%s,\x20%s',_0x36786a,_0x5d6ef1);_0x5d3db4(_0x5d6ef1);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index cecaf8a..b67c20f 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 _0x64f0=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','index','isAuthenticated','show','post','create','put','/:id','exports'];(function(_0x5ccfb9,_0x5d4a9d){var _0x1f127d=function(_0x5424ad){while(--_0x5424ad){_0x5ccfb9['push'](_0x5ccfb9['shift']());}};_0x1f127d(++_0x5d4a9d);}(_0x64f0,0x1a0));var _0x064f=function(_0x2c0dc0,_0x19900d){_0x2c0dc0=_0x2c0dc0-0x0;var _0x4c0990=_0x64f0[_0x2c0dc0];return _0x4c0990;};'use strict';var multer=require(_0x064f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x064f('0x1'));var express=require(_0x064f('0x2'));var router=express[_0x064f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x064f('0x4'));var interaction=require(_0x064f('0x5'));var config=require('../../config/environment');var controller=require(_0x064f('0x6'));router[_0x064f('0x7')]('/',auth['isAuthenticated'](),controller[_0x064f('0x8')]);router['get']('/:id',auth[_0x064f('0x9')](),controller[_0x064f('0xa')]);router[_0x064f('0xb')]('/',auth[_0x064f('0x9')](),controller[_0x064f('0xc')]);router[_0x064f('0xd')](_0x064f('0xe'),auth[_0x064f('0x9')](),controller['update']);router['delete'](_0x064f('0xe'),auth[_0x064f('0x9')](),controller['destroy']);module[_0x064f('0xf')]=router; \ No newline at end of file +var _0xcddd=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','isAuthenticated','post','create','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x499531,_0x4a0ef9){var _0x2d8414=function(_0x623b65){while(--_0x623b65){_0x499531['push'](_0x499531['shift']());}};_0x2d8414(++_0x4a0ef9);}(_0xcddd,0x1a1));var _0xdcdd=function(_0x580e27,_0x914656){_0x580e27=_0x580e27-0x0;var _0x23bb25=_0xcddd[_0x580e27];return _0x23bb25;};'use strict';var multer=require(_0xdcdd('0x0'));var util=require(_0xdcdd('0x1'));var path=require(_0xdcdd('0x2'));var timeout=require(_0xdcdd('0x3'));var express=require(_0xdcdd('0x4'));var router=express[_0xdcdd('0x5')]();var fs_extra=require(_0xdcdd('0x6'));var auth=require(_0xdcdd('0x7'));var interaction=require(_0xdcdd('0x8'));var config=require(_0xdcdd('0x9'));var controller=require(_0xdcdd('0xa'));router[_0xdcdd('0xb')]('/',auth['isAuthenticated'](),controller[_0xdcdd('0xc')]);router[_0xdcdd('0xb')]('/:id',auth[_0xdcdd('0xd')](),controller['show']);router[_0xdcdd('0xe')]('/',auth[_0xdcdd('0xd')](),controller[_0xdcdd('0xf')]);router['put'](_0xdcdd('0x10'),auth['isAuthenticated'](),controller[_0xdcdd('0x11')]);router[_0xdcdd('0x12')]('/:id',auth[_0xdcdd('0xd')](),controller[_0xdcdd('0x13')]);module[_0xdcdd('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 5ac6503..c56f1cc 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 _0x776e=['sequelize','exports','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue','moment'];(function(_0x4bfe3a,_0xd1d83a){var _0x4048b9=function(_0x522b67){while(--_0x522b67){_0x4bfe3a['push'](_0x4bfe3a['shift']());}};_0x4048b9(++_0xd1d83a);}(_0x776e,0x1ac));var _0xe776=function(_0x2f6a77,_0x7e90b2){_0x2f6a77=_0x2f6a77-0x0;var _0xa97dcc=_0x776e[_0x2f6a77];return _0xa97dcc;};'use strict';var moment=require(_0xe776('0x0'));var Sequelize=require(_0xe776('0x1'));module[_0xe776('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xe776('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xe776('0x4')],'defaultValue':moment()[_0xe776('0x5')](_0xe776('0x6'))},'countbusyretry':{'type':Sequelize[_0xe776('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe776('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe776('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xe776('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe776('0x8')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe776('0x4')]},'priority':{'type':Sequelize[_0xe776('0x7')](0x2)[_0xe776('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xe776('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xe776('0x7')],'unique':_0xe776('0xa')},'ListId':{'type':Sequelize[_0xe776('0x7')],'unique':_0xe776('0xa')},'UserId':{'type':Sequelize[_0xe776('0x7')]},'VoiceQueueId':{'type':Sequelize[_0xe776('0x7')],'unique':_0xe776('0xa')},'CampaignId':{'type':Sequelize[_0xe776('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe776('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe776('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe776('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe776('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3689=['exports','STRING','BOOLEAN','DATE','INTEGER','contactListQueue','moment','sequelize'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x3689,0xa6));var _0x9368=function(_0x4b0d6f,_0x3a0b4e){_0x4b0d6f=_0x4b0d6f-0x0;var _0x1ece7a=_0x3689[_0x4b0d6f];return _0x1ece7a;};'use strict';var moment=require(_0x9368('0x0'));var Sequelize=require(_0x9368('0x1'));module[_0x9368('0x2')]={'phone':{'type':Sequelize[_0x9368('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x9368('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x9368('0x5')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x9368('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9368('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9368('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x9368('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9368('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9368('0x5')]},'priority':{'type':Sequelize[_0x9368('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9368('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9368('0x6')],'unique':_0x9368('0x7')},'ListId':{'type':Sequelize[_0x9368('0x6')],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x9368('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x9368('0x6')],'unique':_0x9368('0x7')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x9368('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9368('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9368('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9368('0x6')],'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 3dfc1ad..8a96b36 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 _0x0405=['outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','hopperIds','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','dialActive','getVoiceQueues','YYYY-MM-DD\x20HH:mm:ss','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','CmHopper','type','key','model','query','keys','filters','intersection','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','VoiceQueueId','VoiceQueue','Campaign','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','phone','campaigntype','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','getPreview','CmContact'];(function(_0x591b21,_0x112ea3){var _0x47236d=function(_0x2f8da7){while(--_0x2f8da7){_0x591b21['push'](_0x591b21['shift']());}};_0x47236d(++_0x112ea3);}(_0x0405,0xb1));var _0x5040=function(_0x415c36,_0x423486){_0x415c36=_0x415c36-0x0;var _0x2e65b5=_0x0405[_0x415c36];return _0x2e65b5;};'use strict';var emlformat=require(_0x5040('0x0'));var rimraf=require(_0x5040('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5040('0x2'));var rp=require(_0x5040('0x3'));var moment=require(_0x5040('0x4'));var BPromise=require(_0x5040('0x5'));var Mustache=require(_0x5040('0x6'));var util=require(_0x5040('0x7'));var path=require(_0x5040('0x8'));var sox=require(_0x5040('0x9'));var csv=require(_0x5040('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5040('0xb'));var _=require(_0x5040('0xc'));var squel=require(_0x5040('0xd'));var crypto=require('crypto');var jsforce=require(_0x5040('0xe'));var deskjs=require(_0x5040('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5040('0x10'));var Redis=require(_0x5040('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5040('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5040('0x13'))('api');var utils=require(_0x5040('0x14'));var config=require(_0x5040('0x15'));var licenseUtil=require(_0x5040('0x16'));var db=require(_0x5040('0x17'))['db'];function respondWithStatusCode(_0x56f977,_0x5e7eba){_0x5e7eba=_0x5e7eba||0xcc;return function(_0x1c0f3f){if(_0x1c0f3f){return _0x56f977[_0x5040('0x18')](_0x5e7eba);}return _0x56f977['status'](_0x5e7eba)[_0x5040('0x19')]();};}function respondWithResult(_0x3eda44,_0x476a49){_0x476a49=_0x476a49||0xc8;return function(_0x52f7fe){if(_0x52f7fe){return _0x3eda44[_0x5040('0x1a')](_0x476a49)[_0x5040('0x1b')](_0x52f7fe);}};}function respondWithFilteredResult(_0x431817,_0x2776e2){return function(_0x1cb263){if(_0x1cb263){var _0x21c5e9=typeof _0x2776e2[_0x5040('0x1c')]===_0x5040('0x1d')&&typeof _0x2776e2[_0x5040('0x1e')]===_0x5040('0x1d');var _0x432cbd=_0x1cb263[_0x5040('0x1f')];var _0x152835=_0x21c5e9?0x0:_0x2776e2[_0x5040('0x1c')];var _0xbbc9fa=_0x21c5e9?_0x1cb263[_0x5040('0x1f')]:_0x2776e2[_0x5040('0x1c')]+_0x2776e2[_0x5040('0x1e')];var _0x13457a;if(_0xbbc9fa>=_0x432cbd){_0xbbc9fa=_0x432cbd;_0x13457a=0xc8;}else{_0x13457a=0xce;}_0x431817[_0x5040('0x1a')](_0x13457a);return _0x431817['set'](_0x5040('0x20'),_0x152835+'-'+_0xbbc9fa+'/'+_0x432cbd)['json'](_0x1cb263);}return null;};}function patchUpdates(_0x6efa8c){return function(_0x47162e){try{jsonpatch[_0x5040('0x21')](_0x47162e,_0x6efa8c,!![]);}catch(_0x3b5a6c){return BPromise['reject'](_0x3b5a6c);}return _0x47162e[_0x5040('0x22')]();};}function saveUpdates(_0x53f8b2,_0x21bd27){return function(_0x59e933){if(_0x59e933){return _0x59e933[_0x5040('0x23')](_0x53f8b2)[_0x5040('0x24')](function(_0x7e0ed0){return _0x7e0ed0;});}return null;};}function removeEntity(_0x34dc01,_0x4f8cac){return function(_0x1018ef){if(_0x1018ef){return _0x1018ef[_0x5040('0x25')]()['then'](function(){_0x34dc01[_0x5040('0x1a')](0xcc)[_0x5040('0x19')]();});}};}function handleEntityNotFound(_0x41153f,_0x253c56){return function(_0x1a295e){if(!_0x1a295e){_0x41153f['sendStatus'](0x194);}return _0x1a295e;};}function handleError(_0x3e8238,_0x33a268){_0x33a268=_0x33a268||0x1f4;return function(_0x4d43a4){logger[_0x5040('0x26')](_0x4d43a4['stack']);if(_0x4d43a4[_0x5040('0x27')]){delete _0x4d43a4[_0x5040('0x27')];}_0x3e8238['status'](_0x33a268)[_0x5040('0x28')](_0x4d43a4);};}exports[_0x5040('0x29')]=function(_0x339268,_0x2c5702){var _0x40e9fc={},_0x500d39={},_0x544cea={'count':0x0,'rows':[]};var _0x2220dd=_[_0x5040('0x2a')](db[_0x5040('0x2b')]['rawAttributes'],function(_0x2c7360){return{'name':_0x2c7360['fieldName'],'type':_0x2c7360[_0x5040('0x2c')][_0x5040('0x2d')]};});_0x500d39[_0x5040('0x2e')]=_[_0x5040('0x2a')](_0x2220dd,_0x5040('0x27'));_0x500d39[_0x5040('0x2f')]=_[_0x5040('0x30')](_0x339268['query']);_0x500d39[_0x5040('0x31')]=_[_0x5040('0x32')](_0x500d39[_0x5040('0x2e')],_0x500d39['query']);_0x500d39['filters']=_['concat'](_0x500d39['filters'],[_0x5040('0x33'),_0x5040('0x34'),_0x5040('0x35'),_0x5040('0x36'),_0x5040('0x37'),_0x5040('0x38'),_0x5040('0x39'),_0x5040('0x3a'),_0x5040('0x3b'),_0x5040('0x3c'),_0x5040('0x3d'),_0x5040('0x3e'),_0x5040('0x3f'),_0x5040('0x40'),_0x5040('0x41'),_0x5040('0x42'),_0x5040('0x43'),_0x5040('0x40'),'$overlap',_0x5040('0x44'),'$contained',_0x5040('0x45')]);_0x40e9fc[_0x5040('0x46')]=_[_0x5040('0x32')](_0x500d39[_0x5040('0x2e')],qs['fields'](_0x339268[_0x5040('0x2f')][_0x5040('0x47')]));_0x40e9fc[_0x5040('0x46')]=_0x40e9fc[_0x5040('0x46')][_0x5040('0x48')]?_0x40e9fc[_0x5040('0x46')]:_0x500d39[_0x5040('0x2e')];if(!_0x339268[_0x5040('0x2f')][_0x5040('0x49')](_0x5040('0x4a'))){_0x40e9fc[_0x5040('0x1e')]=qs[_0x5040('0x1e')](_0x339268[_0x5040('0x2f')][_0x5040('0x1e')]);_0x40e9fc[_0x5040('0x1c')]=qs[_0x5040('0x1c')](_0x339268[_0x5040('0x2f')]['offset']);}_0x40e9fc[_0x5040('0x4b')]=qs[_0x5040('0x4c')](_0x339268[_0x5040('0x2f')][_0x5040('0x4c')]);_0x40e9fc['where']=qs[_0x5040('0x31')](_[_0x5040('0x4d')](_0x339268[_0x5040('0x2f')],_0x500d39[_0x5040('0x31')]),_0x2220dd);if(_0x339268[_0x5040('0x2f')][_0x5040('0x4e')]){_0x40e9fc[_0x5040('0x4f')]=_[_0x5040('0x50')](_0x40e9fc[_0x5040('0x4f')],{'$or':_[_0x5040('0x2a')](_0x2220dd,function(_0x443b76){if(_0x443b76[_0x5040('0x2c')]!==_0x5040('0x51')){var _0x1cf142={};_0x1cf142[_0x443b76[_0x5040('0x27')]]={'$like':'%'+_0x339268['query'][_0x5040('0x4e')]+'%'};return _0x1cf142;}})});}_0x40e9fc=_[_0x5040('0x50')]({},_0x40e9fc,_0x339268[_0x5040('0x52')]);var _0x57b8d6={'where':_0x40e9fc[_0x5040('0x4f')]};return db[_0x5040('0x2b')][_0x5040('0x1f')](_0x57b8d6)[_0x5040('0x24')](function(_0x1a9972){_0x544cea['count']=_0x1a9972;if(_0x339268[_0x5040('0x2f')][_0x5040('0x53')]){_0x40e9fc[_0x5040('0x54')]=[{'all':!![]}];}return db[_0x5040('0x2b')][_0x5040('0x55')](_0x40e9fc);})['then'](function(_0xd4210){_0x544cea[_0x5040('0x56')]=_0xd4210;return _0x544cea;})[_0x5040('0x24')](respondWithFilteredResult(_0x2c5702,_0x40e9fc))[_0x5040('0x57')](handleError(_0x2c5702,null));};exports[_0x5040('0x58')]=function(_0x4be875,_0x3bf8c1){var _0x5dacda={'raw':!![],'where':{'id':_0x4be875[_0x5040('0x59')]['id']}},_0x7bc91={};_0x7bc91[_0x5040('0x2e')]=_['keys'](db[_0x5040('0x2b')][_0x5040('0x5a')]);_0x7bc91['query']=_['keys'](_0x4be875[_0x5040('0x2f')]);_0x7bc91['filters']=_['intersection'](_0x7bc91[_0x5040('0x2e')],_0x7bc91[_0x5040('0x2f')]);_0x5dacda[_0x5040('0x46')]=_[_0x5040('0x32')](_0x7bc91[_0x5040('0x2e')],qs['fields'](_0x4be875[_0x5040('0x2f')][_0x5040('0x47')]));_0x5dacda['attributes']=_0x5dacda['attributes'][_0x5040('0x48')]?_0x5dacda[_0x5040('0x46')]:_0x7bc91[_0x5040('0x2e')];if(_0x4be875[_0x5040('0x2f')][_0x5040('0x53')]){_0x5dacda[_0x5040('0x54')]=[{'all':!![]}];}_0x5dacda=_[_0x5040('0x50')]({},_0x5dacda,_0x4be875[_0x5040('0x52')]);return db['CmHopper'][_0x5040('0x5b')](_0x5dacda)[_0x5040('0x24')](handleEntityNotFound(_0x3bf8c1,null))[_0x5040('0x24')](respondWithResult(_0x3bf8c1,null))[_0x5040('0x57')](handleError(_0x3bf8c1,null));};exports['create']=function(_0x12ef60,_0x56e427){return db['CmHopper'][_0x5040('0x5c')](_0x12ef60['body'],{})[_0x5040('0x24')](respondWithResult(_0x56e427,0xc9))['catch'](handleError(_0x56e427,null));};exports[_0x5040('0x23')]=function(_0x216022,_0x41d6d2){if(_0x216022[_0x5040('0x5d')]['id']){delete _0x216022[_0x5040('0x5d')]['id'];}return db[_0x5040('0x2b')]['find']({'where':{'id':_0x216022[_0x5040('0x59')]['id']}})[_0x5040('0x24')](handleEntityNotFound(_0x41d6d2,null))['then'](saveUpdates(_0x216022[_0x5040('0x5d')],null))[_0x5040('0x24')](respondWithResult(_0x41d6d2,null))[_0x5040('0x57')](handleError(_0x41d6d2,null));};exports[_0x5040('0x5e')]=function(_0x4ccfc8,_0x53de51){return db[_0x5040('0x2b')]['describe']()[_0x5040('0x24')](respondWithResult(_0x53de51,null))['catch'](handleError(_0x53de51,null));};exports[_0x5040('0x25')]=function(_0x5b2552,_0x2f49cd){var _0x10ca96;return db[_0x5040('0x2b')][_0x5040('0x5b')]({'where':{'id':_0x5b2552[_0x5040('0x59')]['id']}})[_0x5040('0x24')](handleEntityNotFound(_0x2f49cd,null))['then'](function(_0x36dcf3){if(_0x36dcf3){return _0x36dcf3[_0x5040('0x25')]()[_0x5040('0x24')](function(_0x5ae646){return _0x5ae646;});}})[_0x5040('0x24')](function(_0x2859d9){_0x10ca96=_0x2859d9;if(_0x2859d9){if(_0x2859d9[_0x5040('0x5f')]||_0x2859d9['CampaignId']){return db[_0x2859d9[_0x5040('0x5f')]?_0x5040('0x60'):_0x5040('0x61')][_0x5040('0x5b')]({'where':{'id':_0x2859d9['VoiceQueueId']?_0x2859d9['VoiceQueueId']:_0x2859d9['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0x5040('0x24')](function(_0x56fc6f){var _0x10acb4={};if(_0x56fc6f){_['merge'](_0x10acb4,_['omit'](_0x10ca96['dataValues'],['createdAt',_0x5040('0x62'),'id']));_0x10acb4[_0x5040('0x63')]=0x15;_0x10acb4[_0x5040('0x64')]=_0x5040('0x65');_0x10acb4[_0x5040('0x66')]=_0x56fc6f['name'];_0x10acb4[_0x5040('0x67')]=_0x5b2552[_0x5040('0x68')]['name'];_0x10acb4[_0x5040('0x69')]=_0x5b2552[_0x5040('0x68')]['id'];_0x10acb4[_0x5040('0x65')]=!![];_0x10acb4[_0x5040('0x6a')]=moment()[_0x5040('0x6b')]('YYYY-MM-DD\x20HH:mm:ss');_0x10acb4['calleridnum']=_0x10ca96[_0x5040('0x6c')];_0x10acb4[_0x5040('0x6d')]=_0x10ca96[_0x5040('0x5f')]?'queue':'ivr';return db['CmContact'][_0x5040('0x5b')]({'where':{'id':_0x10acb4[_0x5040('0x6e')]},'attributes':['firstName',_0x5040('0x6f')]})[_0x5040('0x24')](function(_0xa06954){if(!_['isNil'](_0x2f49cd)&&!_[_0x5040('0x70')](_0xa06954[_0x5040('0x71')])){_0x10acb4['calleridname']=_0xa06954[_0x5040('0x71')];if(!_['isNil'](_0xa06954[_0x5040('0x6f')])){_0x10acb4[_0x5040('0x72')]+='\x20'+_0xa06954['lastName'];}}})[_0x5040('0x73')](function(){return db[_0x5040('0x74')][_0x5040('0x5c')](_0x10acb4);});}})['then'](function(){return _0x2f49cd[_0x5040('0x1a')](0xcc)['end']();})[_0x5040('0x57')](handleError(_0x2f49cd,null));};exports[_0x5040('0x75')]=function(_0x129930,_0x31337d,_0x3c4ad2){var _0x7fadc2=[];return db[_0x5040('0x76')][_0x5040('0x5e')]()[_0x5040('0x24')](function(_0x309b93){_0x7fadc2=_[_0x5040('0x30')](_0x309b93);return _0x129930['user']['getVoiceQueues']({'where':{'type':_0x5040('0x77'),'dialActive':!![],'dialMethod':_0x5040('0x78')},'attributes':['id',_0x5040('0x79')],'raw':!![]});})[_0x5040('0x24')](function(_0x40a15f){if(_0x40a15f&&_0x40a15f['length']){return db[_0x5040('0x7a')][_0x5040('0x7b')](function(_0xb8edd0){var _0x1f527f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x5040('0x6b')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x5040('0x2a')](_0x40a15f,'id')},'$or':[{'UserId':null},{'UserId':_0x129930['user']['id']}]};var _0x4e92d8=[];if(_0x129930[_0x5040('0x5d')][_0x5040('0x7c')]&&_0x129930['body'][_0x5040('0x7c')]===_0x5040('0x7d')){if(!_['isEmpty'](_0x129930['body']['hopperIds'])){_0x1f527f['id']={'$in':_0x129930['body']['hopperIds']};}_0x4e92d8=[['priority',_0x5040('0x7e')],[_0x5040('0x7f'),_0x40a15f[0x0][_0x5040('0x79')]===_0x5040('0x7e')?_0x5040('0x80'):_0x5040('0x7e')],db[_0x5040('0x7a')][_0x5040('0x81')](_0x5040('0x82')),['id',_0x5040('0x80')]];}else{if(!_[_0x5040('0x83')](_0x129930[_0x5040('0x5d')][_0x5040('0x84')])){_0x1f527f['id']={'$notIn':_0x129930[_0x5040('0x5d')][_0x5040('0x84')]};}_0x4e92d8=[['priority',_0x5040('0x80')],[_0x5040('0x7f'),_0x40a15f[0x0][_0x5040('0x79')]],db[_0x5040('0x7a')][_0x5040('0x81')](_0x5040('0x85')),['id',_0x5040('0x7e')]];}return db['CmHopper'][_0x5040('0x86')]({'attributes':['id',_0x5040('0x87')],'where':_0x1f527f,'order':_0x4e92d8,'transaction':_0xb8edd0,'lock':_0xb8edd0[_0x5040('0x88')][_0x5040('0x89')],'include':[{'model':db['CmContact'],'as':_0x5040('0x8a'),'attributes':_0x7fadc2,'include':[{'model':db[_0x5040('0x8b')],'as':_0x5040('0x8c'),'attributes':['id','name']}]},{'model':db[_0x5040('0x8d')],'as':'List','attributes':['id',_0x5040('0x27')]},{'model':db[_0x5040('0x60')],'as':_0x5040('0x8e'),'attributes':['id',_0x5040('0x27'),_0x5040('0x8f')]}]})[_0x5040('0x24')](function(_0x1b54ff){if(_0x1b54ff){return _0x1b54ff[_0x5040('0x23')]({'UserId':_0x129930[_0x5040('0x68')]['id']},{'transaction':_0xb8edd0});}});});}})[_0x5040('0x24')](handleEntityNotFound(_0x31337d,null))[_0x5040('0x24')](respondWithResult(_0x31337d,null))[_0x5040('0x57')](handleError(_0x31337d,null));};exports['getOpenContacts']=function(_0x292ba9,_0x143349,_0x42b910){return _0x292ba9['user'][_0x5040('0x90')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x5040('0x78')},'attributes':['id'],'raw':!![]})[_0x5040('0x24')](function(_0x4d2771){if(_0x4d2771&&_0x4d2771[_0x5040('0x48')]){return db['CmHopper'][_0x5040('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x5040('0x91'))},'VoiceQueueId':{'$in':_['map'](_0x4d2771,'id')},'$or':[{'UserId':null},{'UserId':_0x292ba9[_0x5040('0x68')]['id']}]}});}return 0x0;})[_0x5040('0x24')](function(_0xfc2981){if(!_['isNil'](_0xfc2981)&&_['isNumber'](_0xfc2981)){return _0x143349[_0x5040('0x1a')](0xc8)[_0x5040('0x1b')]({'contacts':_0xfc2981});}else{logger['error'](_0x5040('0x92'),'getOpenContacts',0x194,_0x5040('0x93'));_0x143349[_0x5040('0x18')](0x194);}})[_0x5040('0x57')](handleError(_0x143349,null));}; \ No newline at end of file +var _0x7643=['getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','Company','List','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','apply','save','update','then','destroy','error','stack','name','send','map','CmHopper','fieldName','type','key','model','query','keys','filters','intersection','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$any','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','rawAttributes','length','includeAll','catch','create','body','find','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','updatedAt','state','statedesc','campaign','membername','user','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','CmContact','ContactId','firstName','isNil','calleridname','lastName','CmHopperFinal','getPreview'];(function(_0x1ca946,_0x46418b){var _0x129b07=function(_0x250460){while(--_0x250460){_0x1ca946['push'](_0x1ca946['shift']());}};_0x129b07(++_0x46418b);}(_0x7643,0xad));var _0x3764=function(_0x5d6238,_0xe6992b){_0x5d6238=_0x5d6238-0x0;var _0x46ac6b=_0x7643[_0x5d6238];return _0x46ac6b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3764('0x0'));var zipdir=require(_0x3764('0x1'));var jsonpatch=require(_0x3764('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3764('0x3'));var util=require('util');var path=require(_0x3764('0x4'));var sox=require(_0x3764('0x5'));var csv=require(_0x3764('0x6'));var ejs=require(_0x3764('0x7'));var fs=require('fs');var fs_extra=require(_0x3764('0x8'));var _=require(_0x3764('0x9'));var squel=require('squel');var crypto=require(_0x3764('0xa'));var jsforce=require(_0x3764('0xb'));var deskjs=require(_0x3764('0xc'));var toCsv=require(_0x3764('0x6'));var querystring=require(_0x3764('0xd'));var Papa=require(_0x3764('0xe'));var Redis=require(_0x3764('0xf'));var authService=require(_0x3764('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3764('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3764('0x12'))(_0x3764('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3764('0x14'))['db'];function respondWithStatusCode(_0xae99e9,_0x3bc1d9){_0x3bc1d9=_0x3bc1d9||0xcc;return function(_0x4cfd1e){if(_0x4cfd1e){return _0xae99e9[_0x3764('0x15')](_0x3bc1d9);}return _0xae99e9['status'](_0x3bc1d9)[_0x3764('0x16')]();};}function respondWithResult(_0x2a7178,_0x105b7c){_0x105b7c=_0x105b7c||0xc8;return function(_0x109017){if(_0x109017){return _0x2a7178[_0x3764('0x17')](_0x105b7c)[_0x3764('0x18')](_0x109017);}};}function respondWithFilteredResult(_0x58f089,_0x18122c){return function(_0x18571a){if(_0x18571a){var _0x4f9d6e=typeof _0x18122c[_0x3764('0x19')]==='undefined'&&typeof _0x18122c['limit']===_0x3764('0x1a');var _0x38b376=_0x18571a[_0x3764('0x1b')];var _0x4685e9=_0x4f9d6e?0x0:_0x18122c['offset'];var _0x3e95f9=_0x4f9d6e?_0x18571a[_0x3764('0x1b')]:_0x18122c[_0x3764('0x19')]+_0x18122c['limit'];var _0x585c7b;if(_0x3e95f9>=_0x38b376){_0x3e95f9=_0x38b376;_0x585c7b=0xc8;}else{_0x585c7b=0xce;}_0x58f089['status'](_0x585c7b);return _0x58f089[_0x3764('0x1c')]('Content-Range',_0x4685e9+'-'+_0x3e95f9+'/'+_0x38b376)[_0x3764('0x18')](_0x18571a);}return null;};}function patchUpdates(_0x48f922){return function(_0x4cd15d){try{jsonpatch[_0x3764('0x1d')](_0x4cd15d,_0x48f922,!![]);}catch(_0x514343){return BPromise['reject'](_0x514343);}return _0x4cd15d[_0x3764('0x1e')]();};}function saveUpdates(_0x4b4369,_0x676b1){return function(_0x44b05f){if(_0x44b05f){return _0x44b05f[_0x3764('0x1f')](_0x4b4369)[_0x3764('0x20')](function(_0x4735f0){return _0x4735f0;});}return null;};}function removeEntity(_0x22629d,_0x2ec53c){return function(_0x37e471){if(_0x37e471){return _0x37e471[_0x3764('0x21')]()[_0x3764('0x20')](function(){_0x22629d[_0x3764('0x17')](0xcc)[_0x3764('0x16')]();});}};}function handleEntityNotFound(_0x151feb,_0x405008){return function(_0x2905f8){if(!_0x2905f8){_0x151feb[_0x3764('0x15')](0x194);}return _0x2905f8;};}function handleError(_0x5875aa,_0x5a5ad){_0x5a5ad=_0x5a5ad||0x1f4;return function(_0xdf9a94){logger[_0x3764('0x22')](_0xdf9a94[_0x3764('0x23')]);if(_0xdf9a94[_0x3764('0x24')]){delete _0xdf9a94['name'];}_0x5875aa['status'](_0x5a5ad)[_0x3764('0x25')](_0xdf9a94);};}exports['index']=function(_0x172a6e,_0x3f474e){var _0x3e512a={},_0x4b7d5c={},_0xf283a8={'count':0x0,'rows':[]};var _0x482e00=_[_0x3764('0x26')](db[_0x3764('0x27')]['rawAttributes'],function(_0x1025bc){return{'name':_0x1025bc[_0x3764('0x28')],'type':_0x1025bc[_0x3764('0x29')][_0x3764('0x2a')]};});_0x4b7d5c[_0x3764('0x2b')]=_[_0x3764('0x26')](_0x482e00,'name');_0x4b7d5c[_0x3764('0x2c')]=_[_0x3764('0x2d')](_0x172a6e[_0x3764('0x2c')]);_0x4b7d5c[_0x3764('0x2e')]=_[_0x3764('0x2f')](_0x4b7d5c[_0x3764('0x2b')],_0x4b7d5c['query']);_0x4b7d5c[_0x3764('0x2e')]=_['concat'](_0x4b7d5c[_0x3764('0x2e')],[_0x3764('0x30'),_0x3764('0x31'),_0x3764('0x32'),_0x3764('0x33'),_0x3764('0x34'),_0x3764('0x35'),_0x3764('0x36'),_0x3764('0x37'),_0x3764('0x38'),_0x3764('0x39'),_0x3764('0x3a'),_0x3764('0x3b'),_0x3764('0x3c'),_0x3764('0x3d'),_0x3764('0x3e'),'$iLike',_0x3764('0x3f'),_0x3764('0x3d'),_0x3764('0x40'),_0x3764('0x41'),'$contained',_0x3764('0x42')]);_0x3e512a[_0x3764('0x43')]=_[_0x3764('0x2f')](_0x4b7d5c[_0x3764('0x2b')],qs[_0x3764('0x44')](_0x172a6e[_0x3764('0x2c')]['fields']));_0x3e512a['attributes']=_0x3e512a[_0x3764('0x43')]['length']?_0x3e512a[_0x3764('0x43')]:_0x4b7d5c[_0x3764('0x2b')];if(!_0x172a6e[_0x3764('0x2c')][_0x3764('0x45')](_0x3764('0x46'))){_0x3e512a[_0x3764('0x47')]=qs['limit'](_0x172a6e[_0x3764('0x2c')][_0x3764('0x47')]);_0x3e512a['offset']=qs[_0x3764('0x19')](_0x172a6e[_0x3764('0x2c')][_0x3764('0x19')]);}_0x3e512a[_0x3764('0x48')]=qs[_0x3764('0x49')](_0x172a6e[_0x3764('0x2c')][_0x3764('0x49')]);_0x3e512a[_0x3764('0x4a')]=qs[_0x3764('0x2e')](_[_0x3764('0x4b')](_0x172a6e[_0x3764('0x2c')],_0x4b7d5c[_0x3764('0x2e')]),_0x482e00);if(_0x172a6e[_0x3764('0x2c')][_0x3764('0x4c')]){_0x3e512a['where']=_[_0x3764('0x4d')](_0x3e512a[_0x3764('0x4a')],{'$or':_['map'](_0x482e00,function(_0x438b61){if(_0x438b61[_0x3764('0x29')]!==_0x3764('0x4e')){var _0x28b3ed={};_0x28b3ed[_0x438b61[_0x3764('0x24')]]={'$like':'%'+_0x172a6e['query'][_0x3764('0x4c')]+'%'};return _0x28b3ed;}})});}_0x3e512a=_['merge']({},_0x3e512a,_0x172a6e[_0x3764('0x4f')]);var _0x24b83c={'where':_0x3e512a[_0x3764('0x4a')]};return db[_0x3764('0x27')][_0x3764('0x1b')](_0x24b83c)[_0x3764('0x20')](function(_0x4dd8a8){_0xf283a8[_0x3764('0x1b')]=_0x4dd8a8;if(_0x172a6e[_0x3764('0x2c')]['includeAll']){_0x3e512a[_0x3764('0x50')]=[{'all':!![]}];}return db[_0x3764('0x27')][_0x3764('0x51')](_0x3e512a);})[_0x3764('0x20')](function(_0x21a7e6){_0xf283a8[_0x3764('0x52')]=_0x21a7e6;return _0xf283a8;})[_0x3764('0x20')](respondWithFilteredResult(_0x3f474e,_0x3e512a))['catch'](handleError(_0x3f474e,null));};exports['show']=function(_0x24f7ef,_0x458510){var _0x3e4f3f={'raw':!![],'where':{'id':_0x24f7ef[_0x3764('0x53')]['id']}},_0x62ad11={};_0x62ad11['model']=_[_0x3764('0x2d')](db[_0x3764('0x27')][_0x3764('0x54')]);_0x62ad11[_0x3764('0x2c')]=_[_0x3764('0x2d')](_0x24f7ef[_0x3764('0x2c')]);_0x62ad11['filters']=_[_0x3764('0x2f')](_0x62ad11[_0x3764('0x2b')],_0x62ad11[_0x3764('0x2c')]);_0x3e4f3f['attributes']=_[_0x3764('0x2f')](_0x62ad11[_0x3764('0x2b')],qs[_0x3764('0x44')](_0x24f7ef[_0x3764('0x2c')][_0x3764('0x44')]));_0x3e4f3f[_0x3764('0x43')]=_0x3e4f3f[_0x3764('0x43')][_0x3764('0x55')]?_0x3e4f3f[_0x3764('0x43')]:_0x62ad11['model'];if(_0x24f7ef['query'][_0x3764('0x56')]){_0x3e4f3f['include']=[{'all':!![]}];}_0x3e4f3f=_[_0x3764('0x4d')]({},_0x3e4f3f,_0x24f7ef['options']);return db[_0x3764('0x27')]['find'](_0x3e4f3f)[_0x3764('0x20')](handleEntityNotFound(_0x458510,null))['then'](respondWithResult(_0x458510,null))[_0x3764('0x57')](handleError(_0x458510,null));};exports[_0x3764('0x58')]=function(_0x476bb5,_0x955264){return db[_0x3764('0x27')][_0x3764('0x58')](_0x476bb5[_0x3764('0x59')],{})[_0x3764('0x20')](respondWithResult(_0x955264,0xc9))[_0x3764('0x57')](handleError(_0x955264,null));};exports[_0x3764('0x1f')]=function(_0x34387f,_0x143132){if(_0x34387f[_0x3764('0x59')]['id']){delete _0x34387f['body']['id'];}return db['CmHopper'][_0x3764('0x5a')]({'where':{'id':_0x34387f[_0x3764('0x53')]['id']}})[_0x3764('0x20')](handleEntityNotFound(_0x143132,null))['then'](saveUpdates(_0x34387f[_0x3764('0x59')],null))[_0x3764('0x20')](respondWithResult(_0x143132,null))[_0x3764('0x57')](handleError(_0x143132,null));};exports[_0x3764('0x5b')]=function(_0x18714a,_0x416a0b){return db[_0x3764('0x27')][_0x3764('0x5b')]()[_0x3764('0x20')](respondWithResult(_0x416a0b,null))['catch'](handleError(_0x416a0b,null));};exports[_0x3764('0x21')]=function(_0x3dc6b0,_0x12d6f4){var _0x470074;return db[_0x3764('0x27')]['find']({'where':{'id':_0x3dc6b0[_0x3764('0x53')]['id']}})['then'](handleEntityNotFound(_0x12d6f4,null))['then'](function(_0x5a935e){if(_0x5a935e){return _0x5a935e[_0x3764('0x21')]()[_0x3764('0x20')](function(_0xf8d73b){return _0xf8d73b;});}})[_0x3764('0x20')](function(_0x48fef8){_0x470074=_0x48fef8;if(_0x48fef8){if(_0x48fef8[_0x3764('0x5c')]||_0x48fef8[_0x3764('0x5d')]){return db[_0x48fef8[_0x3764('0x5c')]?_0x3764('0x5e'):_0x3764('0x5f')]['find']({'where':{'id':_0x48fef8[_0x3764('0x5c')]?_0x48fef8[_0x3764('0x5c')]:_0x48fef8[_0x3764('0x5d')]},'attributes':['id',_0x3764('0x24')],'raw':!![]});}}})['then'](function(_0x2735b7){var _0x50ee32={};if(_0x2735b7){_[_0x3764('0x4d')](_0x50ee32,_[_0x3764('0x60')](_0x470074[_0x3764('0x61')],['createdAt',_0x3764('0x62'),'id']));_0x50ee32[_0x3764('0x63')]=0x15;_0x50ee32[_0x3764('0x64')]='deleted';_0x50ee32[_0x3764('0x65')]=_0x2735b7[_0x3764('0x24')];_0x50ee32[_0x3764('0x66')]=_0x3dc6b0[_0x3764('0x67')]['name'];_0x50ee32['UserId']=_0x3dc6b0[_0x3764('0x67')]['id'];_0x50ee32[_0x3764('0x68')]=!![];_0x50ee32[_0x3764('0x69')]=moment()[_0x3764('0x6a')](_0x3764('0x6b'));_0x50ee32[_0x3764('0x6c')]=_0x470074[_0x3764('0x6d')];_0x50ee32['campaigntype']=_0x470074[_0x3764('0x5c')]?_0x3764('0x6e'):'ivr';return db[_0x3764('0x6f')]['find']({'where':{'id':_0x50ee32[_0x3764('0x70')]},'attributes':[_0x3764('0x71'),'lastName']})['then'](function(_0x5078e5){if(!_['isNil'](_0x12d6f4)&&!_[_0x3764('0x72')](_0x5078e5[_0x3764('0x71')])){_0x50ee32[_0x3764('0x73')]=_0x5078e5['firstName'];if(!_[_0x3764('0x72')](_0x5078e5[_0x3764('0x74')])){_0x50ee32[_0x3764('0x73')]+='\x20'+_0x5078e5['lastName'];}}})['finally'](function(){return db[_0x3764('0x75')][_0x3764('0x58')](_0x50ee32);});}})[_0x3764('0x20')](function(){return _0x12d6f4['status'](0xcc)[_0x3764('0x16')]();})[_0x3764('0x57')](handleError(_0x12d6f4,null));};exports[_0x3764('0x76')]=function(_0x96943a,_0xa1faa7,_0x192ca3){var _0x22e9e4=[];return db[_0x3764('0x6f')][_0x3764('0x5b')]()[_0x3764('0x20')](function(_0x3e69bd){_0x22e9e4=_[_0x3764('0x2d')](_0x3e69bd);return _0x96943a[_0x3764('0x67')][_0x3764('0x77')]({'where':{'type':_0x3764('0x78'),'dialActive':!![],'dialMethod':_0x3764('0x79')},'attributes':['id',_0x3764('0x7a')],'raw':!![]});})[_0x3764('0x20')](function(_0x5e1995){if(_0x5e1995&&_0x5e1995[_0x3764('0x55')]){return db[_0x3764('0x7b')][_0x3764('0x7c')](function(_0x35c5a1){var _0x1b327c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3764('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x3764('0x26')](_0x5e1995,'id')},'$or':[{'UserId':null},{'UserId':_0x96943a['user']['id']}]};var _0x5dca19=[];if(_0x96943a[_0x3764('0x59')][_0x3764('0x7d')]&&_0x96943a[_0x3764('0x59')][_0x3764('0x7d')]==='prev'){if(!_['isEmpty'](_0x96943a[_0x3764('0x59')]['hopperIds'])){_0x1b327c['id']={'$in':_0x96943a['body'][_0x3764('0x7e')]};}_0x5dca19=[[_0x3764('0x7f'),_0x3764('0x80')],[_0x3764('0x81'),_0x5e1995[0x0]['dialOrderByScheduledAt']==='ASC'?_0x3764('0x82'):'ASC'],db[_0x3764('0x7b')][_0x3764('0x83')](_0x3764('0x84')),['id',_0x3764('0x82')]];}else{if(!_[_0x3764('0x85')](_0x96943a[_0x3764('0x59')]['hopperIds'])){_0x1b327c['id']={'$notIn':_0x96943a['body'][_0x3764('0x7e')]};}_0x5dca19=[[_0x3764('0x7f'),_0x3764('0x82')],[_0x3764('0x81'),_0x5e1995[0x0]['dialOrderByScheduledAt']],db[_0x3764('0x7b')][_0x3764('0x83')](_0x3764('0x86')),['id','ASC']];}return db['CmHopper']['findOne']({'attributes':['id',_0x3764('0x87')],'where':_0x1b327c,'order':_0x5dca19,'transaction':_0x35c5a1,'lock':_0x35c5a1[_0x3764('0x88')][_0x3764('0x89')],'include':[{'model':db['CmContact'],'as':_0x3764('0x8a'),'attributes':_0x22e9e4,'include':[{'model':db['CmCompany'],'as':_0x3764('0x8b'),'attributes':['id',_0x3764('0x24')]}]},{'model':db['CmList'],'as':_0x3764('0x8c'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x3764('0x8d'),'attributes':['id','name',_0x3764('0x8e')]}]})['then'](function(_0x1e57a8){if(_0x1e57a8){return _0x1e57a8[_0x3764('0x1f')]({'UserId':_0x96943a[_0x3764('0x67')]['id']},{'transaction':_0x35c5a1});}});});}})['then'](handleEntityNotFound(_0xa1faa7,null))[_0x3764('0x20')](respondWithResult(_0xa1faa7,null))[_0x3764('0x57')](handleError(_0xa1faa7,null));};exports[_0x3764('0x8f')]=function(_0x42f31c,_0x4dadda,_0x3e7937){return _0x42f31c[_0x3764('0x67')][_0x3764('0x77')]({'where':{'type':_0x3764('0x78'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x3764('0x20')](function(_0x10de33){if(_0x10de33&&_0x10de33[_0x3764('0x55')]){return db[_0x3764('0x27')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x3764('0x6a')](_0x3764('0x6b'))},'VoiceQueueId':{'$in':_[_0x3764('0x26')](_0x10de33,'id')},'$or':[{'UserId':null},{'UserId':_0x42f31c['user']['id']}]}});}return 0x0;})[_0x3764('0x20')](function(_0x49f7d9){if(!_['isNil'](_0x49f7d9)&&_[_0x3764('0x90')](_0x49f7d9)){return _0x4dadda[_0x3764('0x17')](0xc8)[_0x3764('0x18')]({'contacts':_0x49f7d9});}else{logger[_0x3764('0x22')](_0x3764('0x91'),_0x3764('0x8f'),0x194,'entity\x20not\x20found');_0x4dadda['sendStatus'](0x194);}})['catch'](handleError(_0x4dadda,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index caaeabf..72ff27d 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 _0x7096=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api'];(function(_0xcaa72b,_0x2ae295){var _0x2a72fb=function(_0x2d9415){while(--_0x2d9415){_0xcaa72b['push'](_0xcaa72b['shift']());}};_0x2a72fb(++_0x2ae295);}(_0x7096,0x10c));var _0x6709=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7096[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x6709('0xd')]},{'name':_0x6709('0xe'),'fields':[_0x6709('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5d58=['priority','bluebird','request-promise','rimraf','../../config/environment','exports','define','cm_hopper','scheduledat','phone'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d58,0x187));var _0x85d5=function(_0x109928,_0xe28966){_0x109928=_0x109928-0x0;var _0x3ecd40=_0x5d58[_0x109928];return _0x3ecd40;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x85d5('0x0'));var rp=require(_0x85d5('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85d5('0x2'));var config=require(_0x85d5('0x3'));var attributes=require('./cmHopper.attributes');module[_0x85d5('0x4')]=function(_0x2d457a,_0x578fad){return _0x2d457a[_0x85d5('0x5')]('CmHopper',attributes,{'tableName':_0x85d5('0x6'),'paranoid':![],'indexes':[{'name':_0x85d5('0x7'),'fields':['scheduledat']},{'name':_0x85d5('0x8'),'fields':['phone']},{'name':_0x85d5('0x9'),'fields':[_0x85d5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index b6633bc..54cc0ce 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 _0x6f12=['include','map','model','ShowCmHopper','find','then','CreateCmHopper','create','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','findAll','LOCK','UPDATE','Contact','User','Agent','name','voicePause','UserId','push','includes','all','transaction','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','order','length','GetContactRecallMe','GetCmHopperPreview','keys','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','options','raw','where','attributes','limit'];(function(_0x152ca2,_0x5abd1b){var _0x58fbd2=function(_0x128b08){while(--_0x128b08){_0x152ca2['push'](_0x152ca2['shift']());}};_0x58fbd2(++_0x5abd1b);}(_0x6f12,0x158));var _0x26f1=function(_0x462c9c,_0x4c3ee7){_0x462c9c=_0x462c9c-0x0;var _0x507aca=_0x6f12[_0x462c9c];return _0x507aca;};'use strict';var _=require(_0x26f1('0x0'));var util=require(_0x26f1('0x1'));var moment=require(_0x26f1('0x2'));var BPromise=require(_0x26f1('0x3'));var rs=require(_0x26f1('0x4'));var fs=require('fs');var Redis=require(_0x26f1('0x5'));var db=require(_0x26f1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x26f1('0x7'))(_0x26f1('0x8'));var config=require(_0x26f1('0x9'));var jayson=require(_0x26f1('0xa'));var client=jayson[_0x26f1('0xb')][_0x26f1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x55cd21,_0x35a859,_0x37cf48){return new BPromise(function(_0x3f34ff,_0x24820d){return client[_0x26f1('0xd')](_0x55cd21,_0x37cf48)['then'](function(_0x43f257){logger[_0x26f1('0xe')](_0x26f1('0xf'),_0x35a859,_0x26f1('0x10'));logger[_0x26f1('0x11')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x35a859,'request\x20sent',JSON[_0x26f1('0x12')](_0x43f257));if(_0x43f257[_0x26f1('0x13')]){if(_0x43f257[_0x26f1('0x13')][_0x26f1('0x14')]===0x1f4){logger[_0x26f1('0x13')]('CmHopper,\x20%s,\x20%s',_0x35a859,_0x43f257[_0x26f1('0x13')][_0x26f1('0x15')]);return _0x24820d(_0x43f257[_0x26f1('0x13')][_0x26f1('0x15')]);}logger['error']('CmHopper,\x20%s,\x20%s',_0x35a859,_0x43f257[_0x26f1('0x13')][_0x26f1('0x15')]);return _0x3f34ff(_0x43f257[_0x26f1('0x13')][_0x26f1('0x15')]);}else{logger[_0x26f1('0xe')](_0x26f1('0xf'),_0x35a859,_0x26f1('0x10'));_0x3f34ff(_0x43f257[_0x26f1('0x16')][_0x26f1('0x15')]);}})[_0x26f1('0x17')](function(_0x578e75){logger[_0x26f1('0x13')](_0x26f1('0xf'),_0x35a859,_0x578e75);_0x24820d(_0x578e75);});});}exports[_0x26f1('0x18')]=function(_0x4e3814){var _0x278427=this;return new Promise(function(_0x4ec1c8,_0x363e8d){return db[_0x26f1('0x19')]['findAll']({'raw':_0x4e3814['options']?_0x4e3814[_0x26f1('0x1a')][_0x26f1('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e3814[_0x26f1('0x1a')]?_0x4e3814[_0x26f1('0x1a')][_0x26f1('0x1c')]||null:null,'attributes':_0x4e3814[_0x26f1('0x1a')]?_0x4e3814[_0x26f1('0x1a')][_0x26f1('0x1d')]||null:null,'limit':_0x4e3814[_0x26f1('0x1a')]?_0x4e3814[_0x26f1('0x1a')][_0x26f1('0x1e')]||null:null,'include':_0x4e3814['options']?_0x4e3814['options'][_0x26f1('0x1f')]?_[_0x26f1('0x20')](_0x4e3814[_0x26f1('0x1a')][_0x26f1('0x1f')],function(_0x215fb3){return{'model':db[_0x215fb3[_0x26f1('0x21')]],'as':_0x215fb3['as'],'attributes':_0x215fb3['attributes'],'include':_0x215fb3['include']?_[_0x26f1('0x20')](_0x215fb3[_0x26f1('0x1f')],function(_0xca0a46){return{'model':db[_0xca0a46[_0x26f1('0x21')]],'as':_0xca0a46['as'],'attributes':_0xca0a46[_0x26f1('0x1d')],'include':_0xca0a46['include']?_['map'](_0xca0a46[_0x26f1('0x1f')],function(_0x28fdb6){return{'model':db[_0x28fdb6['model']],'as':_0x28fdb6['as'],'attributes':_0x28fdb6[_0x26f1('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17415d){logger['info'](_0x26f1('0x18'),_0x4e3814);logger[_0x26f1('0x11')]('GetCmHopper',_0x4e3814,JSON[_0x26f1('0x12')](_0x17415d));_0x4ec1c8(_0x17415d);})[_0x26f1('0x17')](function(_0x50b742){logger[_0x26f1('0x13')](_0x26f1('0x18'),_0x50b742[_0x26f1('0x15')],_0x4e3814);_0x363e8d(_0x278427[_0x26f1('0x13')](0x1f4,_0x50b742[_0x26f1('0x15')]));});});};exports[_0x26f1('0x22')]=function(_0x618cb1){var _0x1a9317=this;return new Promise(function(_0x3e4ea0,_0xafbd35){return db[_0x26f1('0x19')][_0x26f1('0x23')]({'raw':_0x618cb1[_0x26f1('0x1a')]?_0x618cb1[_0x26f1('0x1a')][_0x26f1('0x1b')]===undefined?!![]:![]:!![],'where':_0x618cb1[_0x26f1('0x1a')]?_0x618cb1[_0x26f1('0x1a')]['where']||null:null,'attributes':_0x618cb1[_0x26f1('0x1a')]?_0x618cb1[_0x26f1('0x1a')][_0x26f1('0x1d')]||null:null,'include':_0x618cb1[_0x26f1('0x1a')]?_0x618cb1[_0x26f1('0x1a')][_0x26f1('0x1f')]?_[_0x26f1('0x20')](_0x618cb1[_0x26f1('0x1a')][_0x26f1('0x1f')],function(_0x1027e8){return{'model':db[_0x1027e8[_0x26f1('0x21')]],'as':_0x1027e8['as'],'attributes':_0x1027e8[_0x26f1('0x1d')],'include':_0x1027e8[_0x26f1('0x1f')]?_[_0x26f1('0x20')](_0x1027e8['include'],function(_0x4c49e4){return{'model':db[_0x4c49e4[_0x26f1('0x21')]],'as':_0x4c49e4['as'],'attributes':_0x4c49e4['attributes'],'include':_0x4c49e4[_0x26f1('0x1f')]?_[_0x26f1('0x20')](_0x4c49e4[_0x26f1('0x1f')],function(_0x2e93a7){return{'model':db[_0x2e93a7[_0x26f1('0x21')]],'as':_0x2e93a7['as'],'attributes':_0x2e93a7[_0x26f1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x26f1('0x24')](function(_0x4b5062){logger[_0x26f1('0xe')]('ShowCmHopper',_0x618cb1);logger[_0x26f1('0x11')](_0x26f1('0x22'),_0x618cb1,JSON[_0x26f1('0x12')](_0x4b5062));_0x3e4ea0(_0x4b5062);})[_0x26f1('0x17')](function(_0x1dfc6d){logger[_0x26f1('0x13')](_0x26f1('0x22'),_0x1dfc6d['message'],_0x618cb1);_0xafbd35(_0x1a9317[_0x26f1('0x13')](0x1f4,_0x1dfc6d[_0x26f1('0x15')]));});});};exports[_0x26f1('0x25')]=function(_0x6ba502){var _0x94180e=this;return new Promise(function(_0x3c9be8,_0x273920){return db[_0x26f1('0x19')][_0x26f1('0x26')](_0x6ba502[_0x26f1('0x27')],{'raw':_0x6ba502[_0x26f1('0x1a')]?_0x6ba502['options'][_0x26f1('0x1b')]===undefined?!![]:![]:!![]})[_0x26f1('0x24')](function(_0x54c79a){logger[_0x26f1('0xe')](_0x26f1('0x25'),_0x6ba502);logger[_0x26f1('0x11')]('CreateCmHopper',_0x6ba502,JSON['stringify'](_0x54c79a));_0x3c9be8(_0x54c79a);})[_0x26f1('0x17')](function(_0x3d4074){logger[_0x26f1('0x13')]('CreateCmHopper',_0x3d4074[_0x26f1('0x15')],_0x6ba502);_0x273920(_0x94180e[_0x26f1('0x13')](0x1f4,_0x3d4074[_0x26f1('0x15')]));});});};exports[_0x26f1('0x28')]=function(_0x1eddb3){var _0x473dc5=this;return new Promise(function(_0xbc82cb,_0x18244a){return db['CmHopper'][_0x26f1('0x29')](_0x1eddb3[_0x26f1('0x27')],{'raw':_0x1eddb3[_0x26f1('0x1a')]?_0x1eddb3[_0x26f1('0x1a')][_0x26f1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eddb3[_0x26f1('0x1a')]?_0x1eddb3[_0x26f1('0x1a')][_0x26f1('0x1c')]||null:null,'attributes':_0x1eddb3[_0x26f1('0x1a')]?_0x1eddb3[_0x26f1('0x1a')][_0x26f1('0x1d')]||null:null,'limit':_0x1eddb3['options']?_0x1eddb3[_0x26f1('0x1a')][_0x26f1('0x1e')]||null:null})[_0x26f1('0x24')](function(_0x2a5787){logger[_0x26f1('0xe')](_0x26f1('0x28'),_0x1eddb3);logger[_0x26f1('0x11')]('UpdateCmHopper',_0x1eddb3,JSON[_0x26f1('0x12')](_0x2a5787));_0xbc82cb(_0x2a5787);})[_0x26f1('0x17')](function(_0x22562a){logger[_0x26f1('0x13')](_0x26f1('0x28'),_0x22562a[_0x26f1('0x15')],_0x1eddb3);_0x18244a(_0x473dc5['error'](0x1f4,_0x22562a[_0x26f1('0x15')]));});});};exports[_0x26f1('0x2a')]=function(_0x4c8a4e){var _0x1f7ead=this;return new Promise(function(_0x4dfc68,_0x517a00){return db['CmHopper'][_0x26f1('0x2b')]({'where':_0x4c8a4e[_0x26f1('0x1a')]?_0x4c8a4e[_0x26f1('0x1a')][_0x26f1('0x1c')]||null:null})[_0x26f1('0x24')](function(_0x85c41e){logger[_0x26f1('0xe')](_0x26f1('0x2a'),_0x4c8a4e);logger[_0x26f1('0x11')](_0x26f1('0x2a'),_0x4c8a4e,JSON[_0x26f1('0x12')](_0x85c41e));_0x4dfc68(_0x85c41e);})[_0x26f1('0x17')](function(_0x524d94){logger[_0x26f1('0x13')](_0x26f1('0x2a'),_0x524d94[_0x26f1('0x15')],_0x4c8a4e);_0x517a00(_0x1f7ead[_0x26f1('0x13')](0x1f4,_0x524d94[_0x26f1('0x15')]));});});};exports[_0x26f1('0x2c')]=function(_0x2c471b){var _0x5014b8=this;return new Promise(function(_0x101757,_0x2b1553){return db[_0x26f1('0x2d')][_0x26f1('0x2e')]()[_0x26f1('0x24')](function(_0x26d2c7){return db[_0x26f1('0x2f')]['transaction'](function(_0x3c2158){return db[_0x26f1('0x19')][_0x26f1('0x30')]({'where':_0x2c471b[_0x26f1('0x1a')]?_0x2c471b['options'][_0x26f1('0x1c')]||null:null,'attributes':_0x2c471b[_0x26f1('0x1a')]?_0x2c471b[_0x26f1('0x1a')][_0x26f1('0x1d')]||null:null,'limit':_0x2c471b['options']?_0x2c471b[_0x26f1('0x1a')][_0x26f1('0x1e')]||null:null,'order':_0x2c471b[_0x26f1('0x1a')]?_0x2c471b[_0x26f1('0x1a')]['order']||null:null,'transaction':_0x3c2158,'lock':_0x3c2158[_0x26f1('0x31')][_0x26f1('0x32')],'include':[{'model':db[_0x26f1('0x2d')],'as':_0x26f1('0x33'),'attributes':_['keys'](_0x26d2c7)},{'model':db[_0x26f1('0x34')],'as':_0x26f1('0x35'),'attributes':['id',_0x26f1('0x36'),_0x26f1('0x37')]}]})[_0x26f1('0x24')](function(_0x211aa6){var _0xe41bed=[];var _0x20f353=[];for(var _0x475f85=0x0;_0x475f85<_0x211aa6['length'];_0x475f85+=0x1){var _0x5b2565=_0x211aa6[_0x475f85][_0x26f1('0x38')];if(_0x5b2565===null){_0xe41bed[_0x26f1('0x39')](_0x211aa6[_0x475f85][_0x26f1('0x29')](_0x2c471b[_0x26f1('0x27')],{'transaction':_0x3c2158}));}else if(!_0x20f353[_0x26f1('0x3a')](_0x5b2565)){_0x20f353[_0x26f1('0x39')](_0x5b2565);_0xe41bed['push'](_0x211aa6[_0x475f85]['update'](_0x2c471b[_0x26f1('0x27')],{'transaction':_0x3c2158}));}}return BPromise[_0x26f1('0x3b')](_0xe41bed);});})[_0x26f1('0x24')](function(_0x311bd9){logger[_0x26f1('0xe')](_0x26f1('0x2c'),_0x2c471b);logger['debug'](_0x26f1('0x2c'),_0x2c471b,JSON['stringify'](_0x311bd9));_0x101757(_0x311bd9);})[_0x26f1('0x17')](function(_0x4f44ca){logger[_0x26f1('0x13')]('GetContactDialer',_0x4f44ca[_0x26f1('0x15')],_0x2c471b);_0x2b1553(_0x5014b8[_0x26f1('0x13')](0x1f4,_0x4f44ca['message']));});});});};exports['MoveContactManagedDialer']=function(_0x32ad03){var _0x492597=this;return new Promise(function(_0x3cd4e8,_0x48de18){return db[_0x26f1('0x2f')][_0x26f1('0x3c')](function(_0x20f382){return db[_0x26f1('0x3d')][_0x26f1('0x26')](_0x32ad03['body'],{'raw':_0x32ad03['options']?_0x32ad03[_0x26f1('0x1a')][_0x26f1('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x20f382})[_0x26f1('0x24')](function(){return db['CmHopper'][_0x26f1('0x2b')]({'where':_0x32ad03[_0x26f1('0x1a')]?_0x32ad03[_0x26f1('0x1a')]['where']||null:null,'transaction':_0x20f382});});})['then'](function(_0x6bfa73){logger[_0x26f1('0xe')]('MoveContactManagedDialer',_0x32ad03);logger[_0x26f1('0x11')](_0x26f1('0x3e'),_0x32ad03,JSON[_0x26f1('0x12')](_0x6bfa73));_0x3cd4e8(_0x6bfa73);})[_0x26f1('0x17')](function(_0x484621){logger[_0x26f1('0x13')](_0x26f1('0x3e'),_0x484621['message'],_0x32ad03);_0x48de18(_0x492597[_0x26f1('0x13')](0x1f4,_0x484621[_0x26f1('0x15')]));});});};exports[_0x26f1('0x3f')]=function(_0x25c6fe){var _0x438a5b=this;return new Promise(function(_0x5da036,_0x500b07){return db['CmHopper'][_0x26f1('0x30')]({'raw':_0x25c6fe[_0x26f1('0x1a')]?_0x25c6fe[_0x26f1('0x1a')][_0x26f1('0x1b')]===undefined?!![]:![]:!![],'where':_0x25c6fe['options']?_0x25c6fe[_0x26f1('0x1a')][_0x26f1('0x1c')]||null:null,'attributes':[[db[_0x26f1('0x2f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x26f1('0x2f')][_0x26f1('0x40')](_0x26f1('0x41')+util[_0x26f1('0x42')](_0x26f1('0x43'),moment()[_0x26f1('0x42')](_0x26f1('0x44')))+'\x20,\x201,\x20null'))),_0x26f1('0x45')]]})[_0x26f1('0x24')](function(_0x21ccf9){logger[_0x26f1('0xe')](_0x26f1('0x3f'),_0x25c6fe);logger[_0x26f1('0x11')](_0x26f1('0x3f'),_0x25c6fe,JSON['stringify'](_0x21ccf9));_0x5da036(_0x21ccf9);})[_0x26f1('0x17')](function(_0x56f195){logger[_0x26f1('0x13')](_0x26f1('0x3f'),_0x56f195['message'],_0x25c6fe);_0x500b07(_0x438a5b[_0x26f1('0x13')](0x1f4,_0x56f195[_0x26f1('0x15')]));});});};exports['GetContactRecallMe']=function(_0x3f0f4a){var _0x188dc6=this;return new Promise(function(_0x4e155f,_0x1e7d67){return db[_0x26f1('0x2d')][_0x26f1('0x2e')]()[_0x26f1('0x24')](function(_0x4db933){return db[_0x26f1('0x2f')][_0x26f1('0x3c')](function(_0x140990){return db['CmHopper'][_0x26f1('0x30')]({'where':_0x3f0f4a[_0x26f1('0x1a')]?_0x3f0f4a[_0x26f1('0x1a')][_0x26f1('0x1c')]||null:null,'attributes':_0x3f0f4a[_0x26f1('0x1a')]?_0x3f0f4a[_0x26f1('0x1a')][_0x26f1('0x1d')]||null:null,'limit':0x1,'order':_0x3f0f4a['options']?_0x3f0f4a[_0x26f1('0x1a')][_0x26f1('0x46')]||null:null,'group':db['CmHopper'][_0x26f1('0x38')],'transaction':_0x140990,'lock':_0x140990[_0x26f1('0x31')]['UPDATE'],'include':_0x3f0f4a['options']?_0x3f0f4a[_0x26f1('0x1a')]['include']?_[_0x26f1('0x20')](_0x3f0f4a['options'][_0x26f1('0x1f')],function(_0x1704a6){return{'model':db[_0x1704a6[_0x26f1('0x21')]],'as':_0x1704a6['as'],'attributes':_0x1704a6[_0x26f1('0x1d')],'include':_0x1704a6['include']?_[_0x26f1('0x20')](_0x1704a6[_0x26f1('0x1f')],function(_0x1babc2){return{'model':db[_0x1babc2[_0x26f1('0x21')]],'as':_0x1babc2['as'],'attributes':_0x1babc2[_0x26f1('0x1d')],'include':_0x1babc2['include']?_['map'](_0x1babc2[_0x26f1('0x1f')],function(_0x45f458){return{'model':db[_0x45f458[_0x26f1('0x21')]],'as':_0x45f458['as'],'attributes':_0x45f458['attributes']};}):[]};}):[]};}):[]:[]})[_0x26f1('0x24')](function(_0x33e0ef){var _0xcc8987=[];for(var _0x113590=0x0;_0x113590<_0x33e0ef[_0x26f1('0x47')];_0x113590+=0x1){_0xcc8987[_0x26f1('0x39')](_0x33e0ef[_0x113590][_0x26f1('0x29')](_0x3f0f4a['body'],{'transaction':_0x140990}));}return BPromise[_0x26f1('0x3b')](_0xcc8987);});})[_0x26f1('0x24')](function(_0x2713d9){logger[_0x26f1('0xe')](_0x26f1('0x48'),_0x3f0f4a);logger[_0x26f1('0x11')]('GetContactRecallMe',_0x3f0f4a,JSON[_0x26f1('0x12')](_0x2713d9));_0x4e155f(_0x2713d9);})['catch'](function(_0x1aab4b){logger['error'](_0x26f1('0x48'),_0x1aab4b[_0x26f1('0x15')],_0x3f0f4a);_0x1e7d67(_0x188dc6['error'](0x1f4,_0x1aab4b[_0x26f1('0x15')]));});});});};exports[_0x26f1('0x49')]=function(_0x40734e){var _0x12a506=this;return new Promise(function(_0x2ee465,_0x39d5d2){db[_0x26f1('0x2d')]['describe']()[_0x26f1('0x24')](function(_0x58e62c){return db['CmHopper'][_0x26f1('0x30')]({'raw':_0x40734e[_0x26f1('0x1a')]?_0x40734e[_0x26f1('0x1a')][_0x26f1('0x1b')]===undefined?!![]:![]:!![],'where':_0x40734e[_0x26f1('0x1a')]?_0x40734e[_0x26f1('0x1a')][_0x26f1('0x1c')]||null:null,'attributes':_0x40734e[_0x26f1('0x1a')]?_0x40734e['options'][_0x26f1('0x1d')]||null:null,'limit':_0x40734e[_0x26f1('0x1a')]?_0x40734e[_0x26f1('0x1a')][_0x26f1('0x1e')]||null:null,'include':_0x40734e[_0x26f1('0x1a')]?_0x40734e[_0x26f1('0x1a')][_0x26f1('0x1f')]?_['map'](_0x40734e['options']['include'],function(_0x1aaaaf){return{'model':db[_0x1aaaaf[_0x26f1('0x21')]],'as':_0x1aaaaf['as'],'attributes':_0x1aaaaf['as']==='Contact'?_[_0x26f1('0x4a')](_0x58e62c):_0x1aaaaf[_0x26f1('0x1d')],'include':_0x1aaaaf[_0x26f1('0x1f')]?_[_0x26f1('0x20')](_0x1aaaaf[_0x26f1('0x1f')],function(_0x38f904){return{'model':db[_0x38f904[_0x26f1('0x21')]],'as':_0x38f904['as'],'attributes':_0x38f904['attributes'],'include':_0x38f904[_0x26f1('0x1f')]?_[_0x26f1('0x20')](_0x38f904[_0x26f1('0x1f')],function(_0x5e979d){return{'model':db[_0x5e979d[_0x26f1('0x21')]],'as':_0x5e979d['as'],'attributes':_0x5e979d[_0x26f1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x26f1('0x24')](function(_0x1a1774){logger['info'](_0x26f1('0x18'),_0x40734e);logger[_0x26f1('0x11')](_0x26f1('0x18'),_0x40734e,JSON[_0x26f1('0x12')](_0x1a1774));_0x2ee465(_0x1a1774);})[_0x26f1('0x17')](function(_0x5c5f3a){logger[_0x26f1('0x13')](_0x26f1('0x18'),_0x5c5f3a[_0x26f1('0x15')],_0x40734e);_0x39d5d2(_0x12a506[_0x26f1('0x13')](0x1f4,_0x5c5f3a[_0x26f1('0x15')]));});});});}; \ No newline at end of file +var _0x3db5=['findAll','options','raw','where','attributes','limit','include','map','model','debug','find','ShowCmHopper','CreateCmHopper','body','UpdateCmHopper','update','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','order','LOCK','Contact','keys','User','Agent','name','voicePause','length','UserId','push','all','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCmHopper','CmHopper'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3db5,0x196));var _0x53db=function(_0x5c883f,_0x38f092){_0x5c883f=_0x5c883f-0x0;var _0x4210cc=_0x3db5[_0x5c883f];return _0x4210cc;};'use strict';var _=require('lodash');var util=require(_0x53db('0x0'));var moment=require(_0x53db('0x1'));var BPromise=require(_0x53db('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x53db('0x3'));var db=require(_0x53db('0x4'))['db'];var utils=require(_0x53db('0x5'));var logger=require(_0x53db('0x6'))(_0x53db('0x7'));var config=require(_0x53db('0x8'));var jayson=require(_0x53db('0x9'));var client=jayson[_0x53db('0xa')][_0x53db('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x430bec,_0x1b38fe,_0x1ae6a7){return new BPromise(function(_0x3ae3d2,_0x518812){return client[_0x53db('0xc')](_0x430bec,_0x1ae6a7)[_0x53db('0xd')](function(_0x298431){logger['info'](_0x53db('0xe'),_0x1b38fe,_0x53db('0xf'));logger['debug'](_0x53db('0x10'),_0x1b38fe,_0x53db('0xf'),JSON[_0x53db('0x11')](_0x298431));if(_0x298431[_0x53db('0x12')]){if(_0x298431[_0x53db('0x12')][_0x53db('0x13')]===0x1f4){logger['error']('CmHopper,\x20%s,\x20%s',_0x1b38fe,_0x298431['error'][_0x53db('0x14')]);return _0x518812(_0x298431[_0x53db('0x12')][_0x53db('0x14')]);}logger[_0x53db('0x12')]('CmHopper,\x20%s,\x20%s',_0x1b38fe,_0x298431[_0x53db('0x12')][_0x53db('0x14')]);return _0x3ae3d2(_0x298431[_0x53db('0x12')]['message']);}else{logger[_0x53db('0x15')](_0x53db('0xe'),_0x1b38fe,_0x53db('0xf'));_0x3ae3d2(_0x298431[_0x53db('0x16')][_0x53db('0x14')]);}})[_0x53db('0x17')](function(_0x3199f5){logger[_0x53db('0x12')]('CmHopper,\x20%s,\x20%s',_0x1b38fe,_0x3199f5);_0x518812(_0x3199f5);});});}exports[_0x53db('0x18')]=function(_0x5578ff){var _0xd5786f=this;return new Promise(function(_0x4a9640,_0x29a4b0){return db[_0x53db('0x19')][_0x53db('0x1a')]({'raw':_0x5578ff[_0x53db('0x1b')]?_0x5578ff[_0x53db('0x1b')][_0x53db('0x1c')]===undefined?!![]:![]:!![],'where':_0x5578ff['options']?_0x5578ff[_0x53db('0x1b')][_0x53db('0x1d')]||null:null,'attributes':_0x5578ff[_0x53db('0x1b')]?_0x5578ff[_0x53db('0x1b')][_0x53db('0x1e')]||null:null,'limit':_0x5578ff[_0x53db('0x1b')]?_0x5578ff[_0x53db('0x1b')][_0x53db('0x1f')]||null:null,'include':_0x5578ff[_0x53db('0x1b')]?_0x5578ff['options'][_0x53db('0x20')]?_[_0x53db('0x21')](_0x5578ff[_0x53db('0x1b')]['include'],function(_0x519394){return{'model':db[_0x519394[_0x53db('0x22')]],'as':_0x519394['as'],'attributes':_0x519394[_0x53db('0x1e')],'include':_0x519394[_0x53db('0x20')]?_[_0x53db('0x21')](_0x519394[_0x53db('0x20')],function(_0xcbe13a){return{'model':db[_0xcbe13a[_0x53db('0x22')]],'as':_0xcbe13a['as'],'attributes':_0xcbe13a['attributes'],'include':_0xcbe13a[_0x53db('0x20')]?_[_0x53db('0x21')](_0xcbe13a[_0x53db('0x20')],function(_0x19ba77){return{'model':db[_0x19ba77[_0x53db('0x22')]],'as':_0x19ba77['as'],'attributes':_0x19ba77['attributes']};}):[]};}):[]};}):[]:[]})[_0x53db('0xd')](function(_0x4e1adb){logger[_0x53db('0x15')]('GetCmHopper',_0x5578ff);logger[_0x53db('0x23')](_0x53db('0x18'),_0x5578ff,JSON['stringify'](_0x4e1adb));_0x4a9640(_0x4e1adb);})[_0x53db('0x17')](function(_0x7bb395){logger[_0x53db('0x12')](_0x53db('0x18'),_0x7bb395[_0x53db('0x14')],_0x5578ff);_0x29a4b0(_0xd5786f[_0x53db('0x12')](0x1f4,_0x7bb395[_0x53db('0x14')]));});});};exports['ShowCmHopper']=function(_0x1ae357){var _0x35d64e=this;return new Promise(function(_0x1605bc,_0x4c7970){return db[_0x53db('0x19')][_0x53db('0x24')]({'raw':_0x1ae357[_0x53db('0x1b')]?_0x1ae357[_0x53db('0x1b')][_0x53db('0x1c')]===undefined?!![]:![]:!![],'where':_0x1ae357['options']?_0x1ae357['options'][_0x53db('0x1d')]||null:null,'attributes':_0x1ae357[_0x53db('0x1b')]?_0x1ae357[_0x53db('0x1b')][_0x53db('0x1e')]||null:null,'include':_0x1ae357['options']?_0x1ae357[_0x53db('0x1b')][_0x53db('0x20')]?_[_0x53db('0x21')](_0x1ae357[_0x53db('0x1b')]['include'],function(_0x1457ff){return{'model':db[_0x1457ff[_0x53db('0x22')]],'as':_0x1457ff['as'],'attributes':_0x1457ff[_0x53db('0x1e')],'include':_0x1457ff[_0x53db('0x20')]?_[_0x53db('0x21')](_0x1457ff[_0x53db('0x20')],function(_0x3db086){return{'model':db[_0x3db086[_0x53db('0x22')]],'as':_0x3db086['as'],'attributes':_0x3db086[_0x53db('0x1e')],'include':_0x3db086[_0x53db('0x20')]?_[_0x53db('0x21')](_0x3db086['include'],function(_0x522f92){return{'model':db[_0x522f92[_0x53db('0x22')]],'as':_0x522f92['as'],'attributes':_0x522f92[_0x53db('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x53db('0xd')](function(_0x1ae884){logger[_0x53db('0x15')](_0x53db('0x25'),_0x1ae357);logger[_0x53db('0x23')](_0x53db('0x25'),_0x1ae357,JSON[_0x53db('0x11')](_0x1ae884));_0x1605bc(_0x1ae884);})[_0x53db('0x17')](function(_0x34509f){logger['error'](_0x53db('0x25'),_0x34509f[_0x53db('0x14')],_0x1ae357);_0x4c7970(_0x35d64e['error'](0x1f4,_0x34509f[_0x53db('0x14')]));});});};exports[_0x53db('0x26')]=function(_0x2d9c9f){var _0x6cb445=this;return new Promise(function(_0x3b1fee,_0x20c7ab){return db[_0x53db('0x19')]['create'](_0x2d9c9f[_0x53db('0x27')],{'raw':_0x2d9c9f[_0x53db('0x1b')]?_0x2d9c9f[_0x53db('0x1b')][_0x53db('0x1c')]===undefined?!![]:![]:!![]})[_0x53db('0xd')](function(_0x5cd96a){logger[_0x53db('0x15')](_0x53db('0x26'),_0x2d9c9f);logger[_0x53db('0x23')](_0x53db('0x26'),_0x2d9c9f,JSON['stringify'](_0x5cd96a));_0x3b1fee(_0x5cd96a);})[_0x53db('0x17')](function(_0x393395){logger['error'](_0x53db('0x26'),_0x393395['message'],_0x2d9c9f);_0x20c7ab(_0x6cb445[_0x53db('0x12')](0x1f4,_0x393395[_0x53db('0x14')]));});});};exports[_0x53db('0x28')]=function(_0x11588a){var _0x43fde4=this;return new Promise(function(_0x930e5,_0xfec7c5){return db[_0x53db('0x19')][_0x53db('0x29')](_0x11588a[_0x53db('0x27')],{'raw':_0x11588a[_0x53db('0x1b')]?_0x11588a[_0x53db('0x1b')][_0x53db('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11588a[_0x53db('0x1b')]?_0x11588a['options'][_0x53db('0x1d')]||null:null,'attributes':_0x11588a[_0x53db('0x1b')]?_0x11588a[_0x53db('0x1b')][_0x53db('0x1e')]||null:null,'limit':_0x11588a[_0x53db('0x1b')]?_0x11588a['options'][_0x53db('0x1f')]||null:null})[_0x53db('0xd')](function(_0xfa495b){logger[_0x53db('0x15')](_0x53db('0x28'),_0x11588a);logger['debug'](_0x53db('0x28'),_0x11588a,JSON[_0x53db('0x11')](_0xfa495b));_0x930e5(_0xfa495b);})[_0x53db('0x17')](function(_0x3ccf99){logger[_0x53db('0x12')](_0x53db('0x28'),_0x3ccf99[_0x53db('0x14')],_0x11588a);_0xfec7c5(_0x43fde4['error'](0x1f4,_0x3ccf99[_0x53db('0x14')]));});});};exports[_0x53db('0x2a')]=function(_0x1cdae2){var _0x23c2fa=this;return new Promise(function(_0xd9bea5,_0x247c58){return db['CmHopper'][_0x53db('0x2b')]({'where':_0x1cdae2[_0x53db('0x1b')]?_0x1cdae2[_0x53db('0x1b')][_0x53db('0x1d')]||null:null})[_0x53db('0xd')](function(_0x349ef0){logger['info']('DestroyCmHopper',_0x1cdae2);logger[_0x53db('0x23')](_0x53db('0x2a'),_0x1cdae2,JSON[_0x53db('0x11')](_0x349ef0));_0xd9bea5(_0x349ef0);})[_0x53db('0x17')](function(_0x42402f){logger['error']('DestroyCmHopper',_0x42402f[_0x53db('0x14')],_0x1cdae2);_0x247c58(_0x23c2fa[_0x53db('0x12')](0x1f4,_0x42402f[_0x53db('0x14')]));});});};exports[_0x53db('0x2c')]=function(_0x4204f8){var _0xfc2732=this;return new Promise(function(_0x42ad28,_0x3958c2){return db[_0x53db('0x2d')][_0x53db('0x2e')]()[_0x53db('0xd')](function(_0x4828b4){return db['sequelize'][_0x53db('0x2f')](function(_0x5e029c){return db[_0x53db('0x19')]['findAll']({'where':_0x4204f8['options']?_0x4204f8[_0x53db('0x1b')][_0x53db('0x1d')]||null:null,'attributes':_0x4204f8['options']?_0x4204f8[_0x53db('0x1b')]['attributes']||null:null,'limit':_0x4204f8[_0x53db('0x1b')]?_0x4204f8[_0x53db('0x1b')][_0x53db('0x1f')]||null:null,'order':_0x4204f8[_0x53db('0x1b')]?_0x4204f8[_0x53db('0x1b')][_0x53db('0x30')]||null:null,'transaction':_0x5e029c,'lock':_0x5e029c[_0x53db('0x31')]['UPDATE'],'include':[{'model':db[_0x53db('0x2d')],'as':_0x53db('0x32'),'attributes':_[_0x53db('0x33')](_0x4828b4)},{'model':db[_0x53db('0x34')],'as':_0x53db('0x35'),'attributes':['id',_0x53db('0x36'),_0x53db('0x37')]}]})[_0x53db('0xd')](function(_0x2bd20a){var _0x19f665=[];var _0x2c6a14=[];for(var _0x20a74f=0x0;_0x20a74f<_0x2bd20a[_0x53db('0x38')];_0x20a74f+=0x1){var _0x1eed64=_0x2bd20a[_0x20a74f][_0x53db('0x39')];if(_0x1eed64===null){_0x19f665[_0x53db('0x3a')](_0x2bd20a[_0x20a74f]['update'](_0x4204f8[_0x53db('0x27')],{'transaction':_0x5e029c}));}else if(!_0x2c6a14['includes'](_0x1eed64)){_0x2c6a14['push'](_0x1eed64);_0x19f665[_0x53db('0x3a')](_0x2bd20a[_0x20a74f][_0x53db('0x29')](_0x4204f8[_0x53db('0x27')],{'transaction':_0x5e029c}));}}return BPromise[_0x53db('0x3b')](_0x19f665);});})[_0x53db('0xd')](function(_0x53292e){logger[_0x53db('0x15')](_0x53db('0x2c'),_0x4204f8);logger[_0x53db('0x23')](_0x53db('0x2c'),_0x4204f8,JSON['stringify'](_0x53292e));_0x42ad28(_0x53292e);})[_0x53db('0x17')](function(_0x3cebb0){logger[_0x53db('0x12')](_0x53db('0x2c'),_0x3cebb0[_0x53db('0x14')],_0x4204f8);_0x3958c2(_0xfc2732[_0x53db('0x12')](0x1f4,_0x3cebb0[_0x53db('0x14')]));});});});};exports[_0x53db('0x3c')]=function(_0x1448e7){var _0x2a005a=this;return new Promise(function(_0x4c66bb,_0x1090f2){return db[_0x53db('0x3d')][_0x53db('0x2f')](function(_0x1300c0){return db[_0x53db('0x3e')]['create'](_0x1448e7[_0x53db('0x27')],{'raw':_0x1448e7['options']?_0x1448e7[_0x53db('0x1b')][_0x53db('0x1c')]===undefined?!![]:![]:!![],'transaction':_0x1300c0})[_0x53db('0xd')](function(){return db['CmHopper'][_0x53db('0x2b')]({'where':_0x1448e7[_0x53db('0x1b')]?_0x1448e7[_0x53db('0x1b')][_0x53db('0x1d')]||null:null,'transaction':_0x1300c0});});})[_0x53db('0xd')](function(_0x2f542c){logger[_0x53db('0x15')]('MoveContactManagedDialer',_0x1448e7);logger['debug'](_0x53db('0x3c'),_0x1448e7,JSON['stringify'](_0x2f542c));_0x4c66bb(_0x2f542c);})[_0x53db('0x17')](function(_0x2963d0){logger[_0x53db('0x12')](_0x53db('0x3c'),_0x2963d0['message'],_0x1448e7);_0x1090f2(_0x2a005a['error'](0x1f4,_0x2963d0[_0x53db('0x14')]));});});};exports[_0x53db('0x3f')]=function(_0x35c225){var _0x152eee=this;return new Promise(function(_0x4b9941,_0x463e79){return db['CmHopper'][_0x53db('0x1a')]({'raw':_0x35c225[_0x53db('0x1b')]?_0x35c225[_0x53db('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x35c225['options']?_0x35c225[_0x53db('0x1b')][_0x53db('0x1d')]||null:null,'attributes':[[db[_0x53db('0x3d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x53db('0x40')](_0x53db('0x41')+util['format'](_0x53db('0x42'),moment()[_0x53db('0x43')](_0x53db('0x44')))+_0x53db('0x45')))),_0x53db('0x46')]]})[_0x53db('0xd')](function(_0x24b2c9){logger[_0x53db('0x15')]('CountReScheduled',_0x35c225);logger[_0x53db('0x23')](_0x53db('0x3f'),_0x35c225,JSON[_0x53db('0x11')](_0x24b2c9));_0x4b9941(_0x24b2c9);})[_0x53db('0x17')](function(_0x32daa9){logger[_0x53db('0x12')](_0x53db('0x3f'),_0x32daa9['message'],_0x35c225);_0x463e79(_0x152eee[_0x53db('0x12')](0x1f4,_0x32daa9[_0x53db('0x14')]));});});};exports['GetContactRecallMe']=function(_0x55a720){var _0xd7f06f=this;return new Promise(function(_0x267153,_0x14aabe){return db['CmContact']['describe']()[_0x53db('0xd')](function(_0xa94e5b){return db['sequelize'][_0x53db('0x2f')](function(_0x4d52fb){return db[_0x53db('0x19')][_0x53db('0x1a')]({'where':_0x55a720[_0x53db('0x1b')]?_0x55a720['options']['where']||null:null,'attributes':_0x55a720[_0x53db('0x1b')]?_0x55a720[_0x53db('0x1b')]['attributes']||null:null,'limit':0x1,'order':_0x55a720[_0x53db('0x1b')]?_0x55a720[_0x53db('0x1b')][_0x53db('0x30')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x4d52fb,'lock':_0x4d52fb['LOCK']['UPDATE'],'include':_0x55a720['options']?_0x55a720[_0x53db('0x1b')]['include']?_['map'](_0x55a720[_0x53db('0x1b')]['include'],function(_0x301984){return{'model':db[_0x301984[_0x53db('0x22')]],'as':_0x301984['as'],'attributes':_0x301984[_0x53db('0x1e')],'include':_0x301984[_0x53db('0x20')]?_[_0x53db('0x21')](_0x301984[_0x53db('0x20')],function(_0x4d3a97){return{'model':db[_0x4d3a97['model']],'as':_0x4d3a97['as'],'attributes':_0x4d3a97[_0x53db('0x1e')],'include':_0x4d3a97[_0x53db('0x20')]?_[_0x53db('0x21')](_0x4d3a97['include'],function(_0x5f9a36){return{'model':db[_0x5f9a36['model']],'as':_0x5f9a36['as'],'attributes':_0x5f9a36[_0x53db('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x53db('0xd')](function(_0x14247a){var _0x2e5b10=[];for(var _0x2954e7=0x0;_0x2954e7<_0x14247a[_0x53db('0x38')];_0x2954e7+=0x1){_0x2e5b10[_0x53db('0x3a')](_0x14247a[_0x2954e7][_0x53db('0x29')](_0x55a720[_0x53db('0x27')],{'transaction':_0x4d52fb}));}return BPromise[_0x53db('0x3b')](_0x2e5b10);});})[_0x53db('0xd')](function(_0x2acc8b){logger['info'](_0x53db('0x47'),_0x55a720);logger[_0x53db('0x23')](_0x53db('0x47'),_0x55a720,JSON['stringify'](_0x2acc8b));_0x267153(_0x2acc8b);})[_0x53db('0x17')](function(_0x4d5dbb){logger[_0x53db('0x12')](_0x53db('0x47'),_0x4d5dbb['message'],_0x55a720);_0x14aabe(_0xd7f06f[_0x53db('0x12')](0x1f4,_0x4d5dbb[_0x53db('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x214852){var _0x2b1b5a=this;return new Promise(function(_0x3b8ced,_0xca1f3b){db['CmContact'][_0x53db('0x2e')]()['then'](function(_0xd763c8){return db['CmHopper']['findAll']({'raw':_0x214852['options']?_0x214852[_0x53db('0x1b')][_0x53db('0x1c')]===undefined?!![]:![]:!![],'where':_0x214852[_0x53db('0x1b')]?_0x214852[_0x53db('0x1b')][_0x53db('0x1d')]||null:null,'attributes':_0x214852[_0x53db('0x1b')]?_0x214852['options'][_0x53db('0x1e')]||null:null,'limit':_0x214852[_0x53db('0x1b')]?_0x214852['options']['limit']||null:null,'include':_0x214852[_0x53db('0x1b')]?_0x214852[_0x53db('0x1b')][_0x53db('0x20')]?_['map'](_0x214852[_0x53db('0x1b')][_0x53db('0x20')],function(_0x1242b1){return{'model':db[_0x1242b1['model']],'as':_0x1242b1['as'],'attributes':_0x1242b1['as']==='Contact'?_[_0x53db('0x33')](_0xd763c8):_0x1242b1[_0x53db('0x1e')],'include':_0x1242b1['include']?_['map'](_0x1242b1['include'],function(_0x204658){return{'model':db[_0x204658[_0x53db('0x22')]],'as':_0x204658['as'],'attributes':_0x204658[_0x53db('0x1e')],'include':_0x204658['include']?_['map'](_0x204658['include'],function(_0x58a878){return{'model':db[_0x58a878['model']],'as':_0x58a878['as'],'attributes':_0x58a878[_0x53db('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x53db('0xd')](function(_0xc0480e){logger[_0x53db('0x15')](_0x53db('0x18'),_0x214852);logger[_0x53db('0x23')](_0x53db('0x18'),_0x214852,JSON[_0x53db('0x11')](_0xc0480e));_0x3b8ced(_0xc0480e);})[_0x53db('0x17')](function(_0x50703b){logger[_0x53db('0x12')]('GetCmHopper',_0x50703b['message'],_0x214852);_0xca1f3b(_0x2b1b5a[_0x53db('0x12')](0x1f4,_0x50703b[_0x53db('0x14')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 9a59fb8..7ca2bd4 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 _0x2e6d=['index','describe','/opencontacts','/:id','show','post','create','getPreview','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated'];(function(_0x53cb7c,_0x48224d){var _0x447a57=function(_0x1bc760){while(--_0x1bc760){_0x53cb7c['push'](_0x53cb7c['shift']());}};_0x447a57(++_0x48224d);}(_0x2e6d,0x12b));var _0xd2e6=function(_0x2f69a7,_0x2430ad){_0x2f69a7=_0x2f69a7-0x0;var _0x449d2f=_0x2e6d[_0x2f69a7];return _0x449d2f;};'use strict';var multer=require(_0xd2e6('0x0'));var util=require(_0xd2e6('0x1'));var path=require(_0xd2e6('0x2'));var timeout=require(_0xd2e6('0x3'));var express=require(_0xd2e6('0x4'));var router=express[_0xd2e6('0x5')]();var fs_extra=require(_0xd2e6('0x6'));var auth=require(_0xd2e6('0x7'));var interaction=require(_0xd2e6('0x8'));var config=require(_0xd2e6('0x9'));var controller=require(_0xd2e6('0xa'));router[_0xd2e6('0xb')]('/',auth[_0xd2e6('0xc')](),controller[_0xd2e6('0xd')]);router[_0xd2e6('0xb')]('/describe',auth[_0xd2e6('0xc')](),controller[_0xd2e6('0xe')]);router[_0xd2e6('0xb')](_0xd2e6('0xf'),auth[_0xd2e6('0xc')](),controller['getOpenContacts']);router[_0xd2e6('0xb')](_0xd2e6('0x10'),auth[_0xd2e6('0xc')](),controller[_0xd2e6('0x11')]);router[_0xd2e6('0x12')]('/',auth[_0xd2e6('0xc')](),controller[_0xd2e6('0x13')]);router[_0xd2e6('0x12')]('/preview',auth[_0xd2e6('0xc')](),controller[_0xd2e6('0x14')]);router['put'](_0xd2e6('0x10'),auth['isAuthenticated'](),controller[_0xd2e6('0x15')]);router['delete'](_0xd2e6('0x10'),auth[_0xd2e6('0xc')](),controller[_0xd2e6('0x16')]);module[_0xd2e6('0x17')]=router; \ No newline at end of file +var _0x6c8c=['./cmHopper.controller','get','index','/describe','isAuthenticated','/opencontacts','getOpenContacts','/:id','show','post','create','/preview','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x1f7a8b,_0x31fde3){var _0x54fa6b=function(_0x51c54f){while(--_0x51c54f){_0x1f7a8b['push'](_0x1f7a8b['shift']());}};_0x54fa6b(++_0x31fde3);}(_0x6c8c,0x13d));var _0xc6c8=function(_0x4f1aaf,_0x1a0e63){_0x4f1aaf=_0x4f1aaf-0x0;var _0x14ea46=_0x6c8c[_0x4f1aaf];return _0x14ea46;};'use strict';var multer=require(_0xc6c8('0x0'));var util=require(_0xc6c8('0x1'));var path=require(_0xc6c8('0x2'));var timeout=require(_0xc6c8('0x3'));var express=require(_0xc6c8('0x4'));var router=express['Router']();var fs_extra=require(_0xc6c8('0x5'));var auth=require(_0xc6c8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc6c8('0x7'));var controller=require(_0xc6c8('0x8'));router[_0xc6c8('0x9')]('/',auth['isAuthenticated'](),controller[_0xc6c8('0xa')]);router[_0xc6c8('0x9')](_0xc6c8('0xb'),auth[_0xc6c8('0xc')](),controller['describe']);router[_0xc6c8('0x9')](_0xc6c8('0xd'),auth['isAuthenticated'](),controller[_0xc6c8('0xe')]);router['get'](_0xc6c8('0xf'),auth[_0xc6c8('0xc')](),controller[_0xc6c8('0x10')]);router[_0xc6c8('0x11')]('/',auth['isAuthenticated'](),controller[_0xc6c8('0x12')]);router[_0xc6c8('0x11')](_0xc6c8('0x13'),auth['isAuthenticated'](),controller['getPreview']);router[_0xc6c8('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xc6c8('0x15')]);router[_0xc6c8('0x16')]('/:id',auth[_0xc6c8('0xc')](),controller[_0xc6c8('0x17')]);module[_0xc6c8('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 497d475..cd8a639 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 _0xe49a=['sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x35a8b8,_0x29fdc9){var _0x5a64a6=function(_0x8c407a){while(--_0x8c407a){_0x35a8b8['push'](_0x35a8b8['shift']());}};_0x5a64a6(++_0x29fdc9);}(_0xe49a,0xd7));var _0xae49=function(_0x807f1a,_0x1cd82c){_0x807f1a=_0x807f1a-0x0;var _0x1a61fd=_0xe49a[_0x807f1a];return _0x1a61fd;};'use strict';var moment=require('moment');var Sequelize=require(_0xae49('0x0'));module[_0xae49('0x1')]={'phone':{'type':Sequelize[_0xae49('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xae49('0x3')],'unique':_0xae49('0x4')},'ListId':{'type':Sequelize[_0xae49('0x3')],'unique':_0xae49('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xae49('0x4')}}; \ No newline at end of file +var _0xcf81=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x4ee33c,_0x210bee){var _0x34f106=function(_0x2cb4d0){while(--_0x2cb4d0){_0x4ee33c['push'](_0x4ee33c['shift']());}};_0x34f106(++_0x210bee);}(_0xcf81,0x199));var _0x1cf8=function(_0x3936e2,_0x25c4ba){_0x3936e2=_0x3936e2-0x0;var _0xfdbc0e=_0xcf81[_0x3936e2];return _0xfdbc0e;};'use strict';var moment=require(_0x1cf8('0x0'));var Sequelize=require(_0x1cf8('0x1'));module[_0x1cf8('0x2')]={'phone':{'type':Sequelize[_0x1cf8('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x1cf8('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x1cf8('0x4')],'unique':_0x1cf8('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index ede0ca8..d401fa0 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 _0x91b6=['count','status','set','Content-Range','reject','save','update','then','error','stack','name','send','map','CmHopperBlack','rawAttributes','fieldName','key','model','keys','intersection','attributes','fields','query','hasOwnProperty','order','sort','where','pick','filters','type','VIRTUAL','filter','options','includeAll','findAll','catch','params','length','include','merge','body','destroy','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','json','offset','undefined','limit'];(function(_0x1863be,_0x3fb18f){var _0x5835e1=function(_0xaa0e92){while(--_0xaa0e92){_0x1863be['push'](_0x1863be['shift']());}};_0x5835e1(++_0x3fb18f);}(_0x91b6,0x77));var _0x691b=function(_0x208df0,_0x42ecdf){_0x208df0=_0x208df0-0x0;var _0x2ad4df=_0x91b6[_0x208df0];return _0x2ad4df;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x691b('0x0'));var jsonpatch=require(_0x691b('0x1'));var rp=require(_0x691b('0x2'));var moment=require(_0x691b('0x3'));var BPromise=require(_0x691b('0x4'));var Mustache=require(_0x691b('0x5'));var util=require(_0x691b('0x6'));var path=require(_0x691b('0x7'));var sox=require(_0x691b('0x8'));var csv=require('to-csv');var ejs=require(_0x691b('0x9'));var fs=require('fs');var fs_extra=require(_0x691b('0xa'));var _=require(_0x691b('0xb'));var squel=require('squel');var crypto=require(_0x691b('0xc'));var jsforce=require(_0x691b('0xd'));var deskjs=require(_0x691b('0xe'));var toCsv=require(_0x691b('0xf'));var querystring=require(_0x691b('0x10'));var Papa=require(_0x691b('0x11'));var Redis=require('ioredis');var authService=require(_0x691b('0x12'));var qs=require(_0x691b('0x13'));var as=require(_0x691b('0x14'));var hardwareService=require(_0x691b('0x15'));var logger=require(_0x691b('0x16'))(_0x691b('0x17'));var utils=require('../../config/utils');var config=require(_0x691b('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51eb77,_0x16ba83){_0x16ba83=_0x16ba83||0xcc;return function(_0xb421f2){if(_0xb421f2){return _0x51eb77[_0x691b('0x19')](_0x16ba83);}return _0x51eb77['status'](_0x16ba83)[_0x691b('0x1a')]();};}function respondWithResult(_0x112a6d,_0x5c9461){_0x5c9461=_0x5c9461||0xc8;return function(_0x3f770e){if(_0x3f770e){return _0x112a6d['status'](_0x5c9461)[_0x691b('0x1b')](_0x3f770e);}};}function respondWithFilteredResult(_0x136f8d,_0x52a842){return function(_0xa13059){if(_0xa13059){var _0xb151fb=typeof _0x52a842[_0x691b('0x1c')]===_0x691b('0x1d')&&typeof _0x52a842[_0x691b('0x1e')]===_0x691b('0x1d');var _0x495cd8=_0xa13059['count'];var _0x1b40a2=_0xb151fb?0x0:_0x52a842[_0x691b('0x1c')];var _0xf842d5=_0xb151fb?_0xa13059[_0x691b('0x1f')]:_0x52a842[_0x691b('0x1c')]+_0x52a842[_0x691b('0x1e')];var _0x1e7094;if(_0xf842d5>=_0x495cd8){_0xf842d5=_0x495cd8;_0x1e7094=0xc8;}else{_0x1e7094=0xce;}_0x136f8d[_0x691b('0x20')](_0x1e7094);return _0x136f8d[_0x691b('0x21')](_0x691b('0x22'),_0x1b40a2+'-'+_0xf842d5+'/'+_0x495cd8)[_0x691b('0x1b')](_0xa13059);}return null;};}function patchUpdates(_0x1960c8){return function(_0x16b6aa){try{jsonpatch['apply'](_0x16b6aa,_0x1960c8,!![]);}catch(_0x5514a3){return BPromise[_0x691b('0x23')](_0x5514a3);}return _0x16b6aa[_0x691b('0x24')]();};}function saveUpdates(_0x1395c4,_0x53cca3){return function(_0x17045d){if(_0x17045d){return _0x17045d[_0x691b('0x25')](_0x1395c4)['then'](function(_0x53d191){return _0x53d191;});}return null;};}function removeEntity(_0x5c57fa,_0xe1d873){return function(_0x18b6a1){if(_0x18b6a1){return _0x18b6a1['destroy']()[_0x691b('0x26')](function(){_0x5c57fa[_0x691b('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4aa1b4,_0x574fcc){return function(_0x52ca73){if(!_0x52ca73){_0x4aa1b4[_0x691b('0x19')](0x194);}return _0x52ca73;};}function handleError(_0x22f9fe,_0x3074fb){_0x3074fb=_0x3074fb||0x1f4;return function(_0x413676){logger[_0x691b('0x27')](_0x413676[_0x691b('0x28')]);if(_0x413676[_0x691b('0x29')]){delete _0x413676[_0x691b('0x29')];}_0x22f9fe[_0x691b('0x20')](_0x3074fb)[_0x691b('0x2a')](_0x413676);};}exports['index']=function(_0x11e35b,_0x577e71){var _0x5b5c67={},_0x4f29f5={},_0x493df3={'count':0x0,'rows':[]};var _0x4e93cd=_[_0x691b('0x2b')](db[_0x691b('0x2c')][_0x691b('0x2d')],function(_0x589913){return{'name':_0x589913[_0x691b('0x2e')],'type':_0x589913['type'][_0x691b('0x2f')]};});_0x4f29f5[_0x691b('0x30')]=_[_0x691b('0x2b')](_0x4e93cd,_0x691b('0x29'));_0x4f29f5['query']=_[_0x691b('0x31')](_0x11e35b['query']);_0x4f29f5['filters']=_[_0x691b('0x32')](_0x4f29f5['model'],_0x4f29f5['query']);_0x5b5c67[_0x691b('0x33')]=_[_0x691b('0x32')](_0x4f29f5[_0x691b('0x30')],qs[_0x691b('0x34')](_0x11e35b[_0x691b('0x35')][_0x691b('0x34')]));_0x5b5c67['attributes']=_0x5b5c67[_0x691b('0x33')]['length']?_0x5b5c67['attributes']:_0x4f29f5[_0x691b('0x30')];if(!_0x11e35b[_0x691b('0x35')][_0x691b('0x36')]('nolimit')){_0x5b5c67['limit']=qs['limit'](_0x11e35b[_0x691b('0x35')][_0x691b('0x1e')]);_0x5b5c67[_0x691b('0x1c')]=qs[_0x691b('0x1c')](_0x11e35b[_0x691b('0x35')]['offset']);}_0x5b5c67[_0x691b('0x37')]=qs[_0x691b('0x38')](_0x11e35b[_0x691b('0x35')][_0x691b('0x38')]);_0x5b5c67[_0x691b('0x39')]=qs['filters'](_[_0x691b('0x3a')](_0x11e35b[_0x691b('0x35')],_0x4f29f5[_0x691b('0x3b')]),_0x4e93cd);if(_0x11e35b['query']['filter']){_0x5b5c67[_0x691b('0x39')]=_['merge'](_0x5b5c67['where'],{'$or':_['map'](_0x4e93cd,function(_0x308d89){if(_0x308d89[_0x691b('0x3c')]!==_0x691b('0x3d')){var _0x559295={};_0x559295[_0x308d89[_0x691b('0x29')]]={'$like':'%'+_0x11e35b[_0x691b('0x35')][_0x691b('0x3e')]+'%'};return _0x559295;}})});}_0x5b5c67=_['merge']({},_0x5b5c67,_0x11e35b[_0x691b('0x3f')]);var _0x5d721f={'where':_0x5b5c67[_0x691b('0x39')]};return db[_0x691b('0x2c')][_0x691b('0x1f')](_0x5d721f)[_0x691b('0x26')](function(_0x3a6e3d){_0x493df3[_0x691b('0x1f')]=_0x3a6e3d;if(_0x11e35b[_0x691b('0x35')][_0x691b('0x40')]){_0x5b5c67['include']=[{'all':!![]}];}return db[_0x691b('0x2c')][_0x691b('0x41')](_0x5b5c67);})[_0x691b('0x26')](function(_0x201d81){_0x493df3['rows']=_0x201d81;return _0x493df3;})[_0x691b('0x26')](respondWithFilteredResult(_0x577e71,_0x5b5c67))[_0x691b('0x42')](handleError(_0x577e71,null));};exports['show']=function(_0x33fce4,_0x236016){var _0x4143f8={'raw':!![],'where':{'id':_0x33fce4[_0x691b('0x43')]['id']}},_0x305f1c={};_0x305f1c[_0x691b('0x30')]=_['keys'](db[_0x691b('0x2c')][_0x691b('0x2d')]);_0x305f1c['query']=_[_0x691b('0x31')](_0x33fce4[_0x691b('0x35')]);_0x305f1c['filters']=_[_0x691b('0x32')](_0x305f1c[_0x691b('0x30')],_0x305f1c[_0x691b('0x35')]);_0x4143f8['attributes']=_[_0x691b('0x32')](_0x305f1c[_0x691b('0x30')],qs[_0x691b('0x34')](_0x33fce4[_0x691b('0x35')][_0x691b('0x34')]));_0x4143f8[_0x691b('0x33')]=_0x4143f8[_0x691b('0x33')][_0x691b('0x44')]?_0x4143f8[_0x691b('0x33')]:_0x305f1c[_0x691b('0x30')];if(_0x33fce4[_0x691b('0x35')][_0x691b('0x40')]){_0x4143f8[_0x691b('0x45')]=[{'all':!![]}];}_0x4143f8=_[_0x691b('0x46')]({},_0x4143f8,_0x33fce4[_0x691b('0x3f')]);return db[_0x691b('0x2c')]['find'](_0x4143f8)['then'](handleEntityNotFound(_0x236016,null))['then'](respondWithResult(_0x236016,null))[_0x691b('0x42')](handleError(_0x236016,null));};exports[_0x691b('0x25')]=function(_0x529a6c,_0x111019){if(_0x529a6c['body']['id']){delete _0x529a6c[_0x691b('0x47')]['id'];}return db[_0x691b('0x2c')]['find']({'where':{'id':_0x529a6c[_0x691b('0x43')]['id']}})['then'](handleEntityNotFound(_0x111019,null))[_0x691b('0x26')](saveUpdates(_0x529a6c['body'],null))['then'](respondWithResult(_0x111019,null))['catch'](handleError(_0x111019,null));};exports[_0x691b('0x48')]=function(_0x3fae06,_0x9d29c1){return db['CmHopperBlack'][_0x691b('0x49')]({'where':{'id':_0x3fae06[_0x691b('0x43')]['id']}})[_0x691b('0x26')](handleEntityNotFound(_0x9d29c1,null))['then'](removeEntity(_0x9d29c1,null))[_0x691b('0x42')](handleError(_0x9d29c1,null));};exports[_0x691b('0x4a')]=function(_0x1b7b35,_0x1dff34){return db['CmHopperBlack'][_0x691b('0x4a')]()[_0x691b('0x26')](respondWithResult(_0x1dff34,null))[_0x691b('0x42')](handleError(_0x1dff34,null));}; \ No newline at end of file +var _0xb8d5=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','end','name','map','CmHopperBlack','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','body','find','params','describe','eml-format'];(function(_0x4c0fe7,_0x19f374){var _0xf782f1=function(_0x45e6e8){while(--_0x45e6e8){_0x4c0fe7['push'](_0x4c0fe7['shift']());}};_0xf782f1(++_0x19f374);}(_0xb8d5,0xd4));var _0x5b8d=function(_0x2e30bd,_0x19c4de){_0x2e30bd=_0x2e30bd-0x0;var _0x2e0a44=_0xb8d5[_0x2e30bd];return _0x2e0a44;};'use strict';var emlformat=require(_0x5b8d('0x0'));var rimraf=require(_0x5b8d('0x1'));var zipdir=require(_0x5b8d('0x2'));var jsonpatch=require(_0x5b8d('0x3'));var rp=require(_0x5b8d('0x4'));var moment=require(_0x5b8d('0x5'));var BPromise=require(_0x5b8d('0x6'));var Mustache=require('mustache');var util=require(_0x5b8d('0x7'));var path=require(_0x5b8d('0x8'));var sox=require(_0x5b8d('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b8d('0xa'));var _=require(_0x5b8d('0xb'));var squel=require('squel');var crypto=require(_0x5b8d('0xc'));var jsforce=require(_0x5b8d('0xd'));var deskjs=require(_0x5b8d('0xe'));var toCsv=require(_0x5b8d('0xf'));var querystring=require(_0x5b8d('0x10'));var Papa=require(_0x5b8d('0x11'));var Redis=require('ioredis');var authService=require(_0x5b8d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5b8d('0x13'));var hardwareService=require(_0x5b8d('0x14'));var logger=require(_0x5b8d('0x15'))('api');var utils=require(_0x5b8d('0x16'));var config=require(_0x5b8d('0x17'));var licenseUtil=require(_0x5b8d('0x18'));var db=require(_0x5b8d('0x19'))['db'];function respondWithStatusCode(_0x28140c,_0x4b333b){_0x4b333b=_0x4b333b||0xcc;return function(_0x3725eb){if(_0x3725eb){return _0x28140c[_0x5b8d('0x1a')](_0x4b333b);}return _0x28140c[_0x5b8d('0x1b')](_0x4b333b)['end']();};}function respondWithResult(_0x1e35f7,_0x34159d){_0x34159d=_0x34159d||0xc8;return function(_0x17bbb0){if(_0x17bbb0){return _0x1e35f7[_0x5b8d('0x1b')](_0x34159d)[_0x5b8d('0x1c')](_0x17bbb0);}};}function respondWithFilteredResult(_0x20a6b2,_0x4135ae){return function(_0xd20484){if(_0xd20484){var _0x332a17=typeof _0x4135ae[_0x5b8d('0x1d')]===_0x5b8d('0x1e')&&typeof _0x4135ae[_0x5b8d('0x1f')]==='undefined';var _0x30ec92=_0xd20484[_0x5b8d('0x20')];var _0x256f7a=_0x332a17?0x0:_0x4135ae[_0x5b8d('0x1d')];var _0x14c5b6=_0x332a17?_0xd20484['count']:_0x4135ae[_0x5b8d('0x1d')]+_0x4135ae[_0x5b8d('0x1f')];var _0x19663f;if(_0x14c5b6>=_0x30ec92){_0x14c5b6=_0x30ec92;_0x19663f=0xc8;}else{_0x19663f=0xce;}_0x20a6b2[_0x5b8d('0x1b')](_0x19663f);return _0x20a6b2[_0x5b8d('0x21')]('Content-Range',_0x256f7a+'-'+_0x14c5b6+'/'+_0x30ec92)[_0x5b8d('0x1c')](_0xd20484);}return null;};}function patchUpdates(_0x14a5c2){return function(_0x3c5e72){try{jsonpatch[_0x5b8d('0x22')](_0x3c5e72,_0x14a5c2,!![]);}catch(_0x5df0b3){return BPromise[_0x5b8d('0x23')](_0x5df0b3);}return _0x3c5e72['save']();};}function saveUpdates(_0x52868e,_0x398f48){return function(_0x1c80a8){if(_0x1c80a8){return _0x1c80a8[_0x5b8d('0x24')](_0x52868e)['then'](function(_0x41e094){return _0x41e094;});}return null;};}function removeEntity(_0x5d173a,_0x53158b){return function(_0x8ea4a6){if(_0x8ea4a6){return _0x8ea4a6[_0x5b8d('0x25')]()[_0x5b8d('0x26')](function(){_0x5d173a[_0x5b8d('0x1b')](0xcc)[_0x5b8d('0x27')]();});}};}function handleEntityNotFound(_0x18c6de,_0x4eee14){return function(_0x2e4493){if(!_0x2e4493){_0x18c6de[_0x5b8d('0x1a')](0x194);}return _0x2e4493;};}function handleError(_0x308a7d,_0x2cfe26){_0x2cfe26=_0x2cfe26||0x1f4;return function(_0x30877c){logger['error'](_0x30877c['stack']);if(_0x30877c[_0x5b8d('0x28')]){delete _0x30877c[_0x5b8d('0x28')];}_0x308a7d[_0x5b8d('0x1b')](_0x2cfe26)['send'](_0x30877c);};}exports['index']=function(_0x554ebf,_0x632016){var _0x3981bb={},_0x18b94c={},_0x39704b={'count':0x0,'rows':[]};var _0x2f3186=_[_0x5b8d('0x29')](db[_0x5b8d('0x2a')][_0x5b8d('0x2b')],function(_0x2a8ab6){return{'name':_0x2a8ab6['fieldName'],'type':_0x2a8ab6['type'][_0x5b8d('0x2c')]};});_0x18b94c[_0x5b8d('0x2d')]=_[_0x5b8d('0x29')](_0x2f3186,_0x5b8d('0x28'));_0x18b94c[_0x5b8d('0x2e')]=_[_0x5b8d('0x2f')](_0x554ebf[_0x5b8d('0x2e')]);_0x18b94c[_0x5b8d('0x30')]=_[_0x5b8d('0x31')](_0x18b94c[_0x5b8d('0x2d')],_0x18b94c[_0x5b8d('0x2e')]);_0x3981bb[_0x5b8d('0x32')]=_[_0x5b8d('0x31')](_0x18b94c[_0x5b8d('0x2d')],qs[_0x5b8d('0x33')](_0x554ebf[_0x5b8d('0x2e')][_0x5b8d('0x33')]));_0x3981bb[_0x5b8d('0x32')]=_0x3981bb['attributes'][_0x5b8d('0x34')]?_0x3981bb[_0x5b8d('0x32')]:_0x18b94c[_0x5b8d('0x2d')];if(!_0x554ebf[_0x5b8d('0x2e')][_0x5b8d('0x35')](_0x5b8d('0x36'))){_0x3981bb[_0x5b8d('0x1f')]=qs[_0x5b8d('0x1f')](_0x554ebf[_0x5b8d('0x2e')]['limit']);_0x3981bb['offset']=qs[_0x5b8d('0x1d')](_0x554ebf[_0x5b8d('0x2e')][_0x5b8d('0x1d')]);}_0x3981bb['order']=qs[_0x5b8d('0x37')](_0x554ebf['query'][_0x5b8d('0x37')]);_0x3981bb['where']=qs['filters'](_[_0x5b8d('0x38')](_0x554ebf[_0x5b8d('0x2e')],_0x18b94c['filters']),_0x2f3186);if(_0x554ebf['query'][_0x5b8d('0x39')]){_0x3981bb[_0x5b8d('0x3a')]=_[_0x5b8d('0x3b')](_0x3981bb[_0x5b8d('0x3a')],{'$or':_[_0x5b8d('0x29')](_0x2f3186,function(_0xb02533){if(_0xb02533[_0x5b8d('0x3c')]!==_0x5b8d('0x3d')){var _0x246dc6={};_0x246dc6[_0xb02533[_0x5b8d('0x28')]]={'$like':'%'+_0x554ebf['query'][_0x5b8d('0x39')]+'%'};return _0x246dc6;}})});}_0x3981bb=_['merge']({},_0x3981bb,_0x554ebf[_0x5b8d('0x3e')]);var _0x3ededd={'where':_0x3981bb[_0x5b8d('0x3a')]};return db['CmHopperBlack'][_0x5b8d('0x20')](_0x3ededd)['then'](function(_0x5658f3){_0x39704b[_0x5b8d('0x20')]=_0x5658f3;if(_0x554ebf[_0x5b8d('0x2e')][_0x5b8d('0x3f')]){_0x3981bb[_0x5b8d('0x40')]=[{'all':!![]}];}return db[_0x5b8d('0x2a')][_0x5b8d('0x41')](_0x3981bb);})[_0x5b8d('0x26')](function(_0x1cde91){_0x39704b['rows']=_0x1cde91;return _0x39704b;})[_0x5b8d('0x26')](respondWithFilteredResult(_0x632016,_0x3981bb))[_0x5b8d('0x42')](handleError(_0x632016,null));};exports['show']=function(_0x4abb5e,_0x14776e){var _0x294761={'raw':!![],'where':{'id':_0x4abb5e['params']['id']}},_0x49a8a6={};_0x49a8a6[_0x5b8d('0x2d')]=_[_0x5b8d('0x2f')](db[_0x5b8d('0x2a')][_0x5b8d('0x2b')]);_0x49a8a6[_0x5b8d('0x2e')]=_[_0x5b8d('0x2f')](_0x4abb5e[_0x5b8d('0x2e')]);_0x49a8a6[_0x5b8d('0x30')]=_['intersection'](_0x49a8a6[_0x5b8d('0x2d')],_0x49a8a6[_0x5b8d('0x2e')]);_0x294761[_0x5b8d('0x32')]=_[_0x5b8d('0x31')](_0x49a8a6[_0x5b8d('0x2d')],qs[_0x5b8d('0x33')](_0x4abb5e[_0x5b8d('0x2e')][_0x5b8d('0x33')]));_0x294761[_0x5b8d('0x32')]=_0x294761['attributes']['length']?_0x294761[_0x5b8d('0x32')]:_0x49a8a6[_0x5b8d('0x2d')];if(_0x4abb5e[_0x5b8d('0x2e')][_0x5b8d('0x3f')]){_0x294761[_0x5b8d('0x40')]=[{'all':!![]}];}_0x294761=_['merge']({},_0x294761,_0x4abb5e[_0x5b8d('0x3e')]);return db[_0x5b8d('0x2a')]['find'](_0x294761)[_0x5b8d('0x26')](handleEntityNotFound(_0x14776e,null))[_0x5b8d('0x26')](respondWithResult(_0x14776e,null))[_0x5b8d('0x42')](handleError(_0x14776e,null));};exports['update']=function(_0x53eefb,_0x5281ac){if(_0x53eefb[_0x5b8d('0x43')]['id']){delete _0x53eefb[_0x5b8d('0x43')]['id'];}return db['CmHopperBlack'][_0x5b8d('0x44')]({'where':{'id':_0x53eefb[_0x5b8d('0x45')]['id']}})[_0x5b8d('0x26')](handleEntityNotFound(_0x5281ac,null))[_0x5b8d('0x26')](saveUpdates(_0x53eefb['body'],null))[_0x5b8d('0x26')](respondWithResult(_0x5281ac,null))[_0x5b8d('0x42')](handleError(_0x5281ac,null));};exports[_0x5b8d('0x25')]=function(_0x158edf,_0x34f8c3){return db[_0x5b8d('0x2a')][_0x5b8d('0x44')]({'where':{'id':_0x158edf['params']['id']}})[_0x5b8d('0x26')](handleEntityNotFound(_0x34f8c3,null))[_0x5b8d('0x26')](removeEntity(_0x34f8c3,null))[_0x5b8d('0x42')](handleError(_0x34f8c3,null));};exports[_0x5b8d('0x46')]=function(_0x391b96,_0x43cc29){return db[_0x5b8d('0x2a')][_0x5b8d('0x46')]()[_0x5b8d('0x26')](respondWithResult(_0x43cc29,null))['catch'](handleError(_0x43cc29,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 0069930..cd2a872 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 _0xd690=['../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','moment','rimraf'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0xd690,0xc1));var _0x0d69=function(_0x575c9e,_0x338939){_0x575c9e=_0x575c9e-0x0;var _0x5037b8=_0xd690[_0x575c9e];return _0x5037b8;};'use strict';var _=require(_0x0d69('0x0'));var util=require('util');var logger=require(_0x0d69('0x1'))(_0x0d69('0x2'));var moment=require(_0x0d69('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0d69('0x4'));var config=require(_0x0d69('0x5'));var attributes=require(_0x0d69('0x6'));module[_0x0d69('0x7')]=function(_0x2083eb,_0x431770){return _0x2083eb[_0x0d69('0x8')](_0x0d69('0x9'),attributes,{'tableName':_0x0d69('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc451=['exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperBlack.attributes'];(function(_0x56ae3d,_0x588f4a){var _0x3b194e=function(_0x4a37a7){while(--_0x4a37a7){_0x56ae3d['push'](_0x56ae3d['shift']());}};_0x3b194e(++_0x588f4a);}(_0xc451,0x19a));var _0x1c45=function(_0x34c049,_0x4e14f0){_0x34c049=_0x34c049-0x0;var _0x4542ac=_0xc451[_0x34c049];return _0x4542ac;};'use strict';var _=require(_0x1c45('0x0'));var util=require(_0x1c45('0x1'));var logger=require(_0x1c45('0x2'))(_0x1c45('0x3'));var moment=require(_0x1c45('0x4'));var BPromise=require(_0x1c45('0x5'));var rp=require(_0x1c45('0x6'));var fs=require('fs');var path=require(_0x1c45('0x7'));var rimraf=require('rimraf');var config=require(_0x1c45('0x8'));var attributes=require(_0x1c45('0x9'));module[_0x1c45('0xa')]=function(_0x3c1db4,_0x509934){return _0x3c1db4[_0x1c45('0xb')](_0x1c45('0xc'),attributes,{'tableName':_0x1c45('0xd'),'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 fc3860d..44605f1 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 _0xd33b=['findAll','options','where','attributes','include','model','map','stringify','update','raw','UpdateCmHopperBlack','debug','DestroyCmHopperBlack','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','info','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','CmHopperBlack,\x20%s,\x20%s','message','result','catch','GetCmHopperBlack','CmHopperBlack'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0xd33b,0x148));var _0xbd33=function(_0x4546e0,_0x101588){_0x4546e0=_0x4546e0-0x0;var _0x2256b8=_0xd33b[_0x4546e0];return _0x2256b8;};'use strict';var _=require('lodash');var util=require(_0xbd33('0x0'));var moment=require(_0xbd33('0x1'));var BPromise=require(_0xbd33('0x2'));var rs=require(_0xbd33('0x3'));var fs=require('fs');var Redis=require(_0xbd33('0x4'));var db=require(_0xbd33('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbd33('0x6'));var config=require(_0xbd33('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbd33('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x577956,_0x17aa99,_0x859a5d){return new BPromise(function(_0x74ca48,_0x78ad14){return client[_0xbd33('0x9')](_0x577956,_0x859a5d)[_0xbd33('0xa')](function(_0x52298e){logger[_0xbd33('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x17aa99,'request\x20sent');logger['debug'](_0xbd33('0xc'),_0x17aa99,_0xbd33('0xd'),JSON['stringify'](_0x52298e));if(_0x52298e['error']){if(_0x52298e['error'][_0xbd33('0xe')]===0x1f4){logger[_0xbd33('0xf')](_0xbd33('0x10'),_0x17aa99,_0x52298e[_0xbd33('0xf')][_0xbd33('0x11')]);return _0x78ad14(_0x52298e['error']['message']);}logger['error'](_0xbd33('0x10'),_0x17aa99,_0x52298e[_0xbd33('0xf')][_0xbd33('0x11')]);return _0x74ca48(_0x52298e['error'][_0xbd33('0x11')]);}else{logger[_0xbd33('0xb')](_0xbd33('0x10'),_0x17aa99,_0xbd33('0xd'));_0x74ca48(_0x52298e[_0xbd33('0x12')][_0xbd33('0x11')]);}})[_0xbd33('0x13')](function(_0x1fc879){logger[_0xbd33('0xf')](_0xbd33('0x10'),_0x17aa99,_0x1fc879);_0x78ad14(_0x1fc879);});});}exports[_0xbd33('0x14')]=function(_0x55c58b){var _0x5193e7=this;return new Promise(function(_0x23f565,_0x4d5ce8){return db[_0xbd33('0x15')][_0xbd33('0x16')]({'raw':_0x55c58b['options']?_0x55c58b[_0xbd33('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x55c58b['options']?_0x55c58b['options'][_0xbd33('0x18')]||null:null,'attributes':_0x55c58b['options']?_0x55c58b[_0xbd33('0x17')][_0xbd33('0x19')]||null:null,'limit':_0x55c58b[_0xbd33('0x17')]?_0x55c58b[_0xbd33('0x17')]['limit']||null:null,'include':_0x55c58b[_0xbd33('0x17')]?_0x55c58b['options'][_0xbd33('0x1a')]?_['map'](_0x55c58b['options'][_0xbd33('0x1a')],function(_0x16c3c9){return{'model':db[_0x16c3c9[_0xbd33('0x1b')]],'as':_0x16c3c9['as'],'attributes':_0x16c3c9[_0xbd33('0x19')],'include':_0x16c3c9[_0xbd33('0x1a')]?_[_0xbd33('0x1c')](_0x16c3c9[_0xbd33('0x1a')],function(_0x29edbe){return{'model':db[_0x29edbe[_0xbd33('0x1b')]],'as':_0x29edbe['as'],'attributes':_0x29edbe[_0xbd33('0x19')],'include':_0x29edbe[_0xbd33('0x1a')]?_['map'](_0x29edbe['include'],function(_0x58a21f){return{'model':db[_0x58a21f[_0xbd33('0x1b')]],'as':_0x58a21f['as'],'attributes':_0x58a21f[_0xbd33('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43948d){logger['info'](_0xbd33('0x14'),_0x55c58b);logger['debug'](_0xbd33('0x14'),_0x55c58b,JSON[_0xbd33('0x1d')](_0x43948d));_0x23f565(_0x43948d);})['catch'](function(_0xd5c326){logger[_0xbd33('0xf')](_0xbd33('0x14'),_0xd5c326[_0xbd33('0x11')],_0x55c58b);_0x4d5ce8(_0x5193e7[_0xbd33('0xf')](0x1f4,_0xd5c326['message']));});});};exports['UpdateCmHopperBlack']=function(_0x502e80){var _0x201306=this;return new Promise(function(_0x2cddd9,_0x37f61d){return db['CmHopperBlack'][_0xbd33('0x1e')](_0x502e80['body'],{'raw':_0x502e80[_0xbd33('0x17')]?_0x502e80['options'][_0xbd33('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x502e80[_0xbd33('0x17')]?_0x502e80[_0xbd33('0x17')]['where']||null:null,'attributes':_0x502e80[_0xbd33('0x17')]?_0x502e80[_0xbd33('0x17')][_0xbd33('0x19')]||null:null,'limit':_0x502e80['options']?_0x502e80[_0xbd33('0x17')]['limit']||null:null})[_0xbd33('0xa')](function(_0xbadcd6){logger['info'](_0xbd33('0x20'),_0x502e80);logger[_0xbd33('0x21')](_0xbd33('0x20'),_0x502e80,JSON['stringify'](_0xbadcd6));_0x2cddd9(_0xbadcd6);})[_0xbd33('0x13')](function(_0x538956){logger['error']('UpdateCmHopperBlack',_0x538956['message'],_0x502e80);_0x37f61d(_0x201306['error'](0x1f4,_0x538956['message']));});});};exports[_0xbd33('0x22')]=function(_0x3ff7cc){var _0x18f1b3=this;return new Promise(function(_0x580600,_0x48ce4c){return db['CmHopperBlack']['destroy']({'where':_0x3ff7cc['options']?_0x3ff7cc['options'][_0xbd33('0x18')]||null:null})[_0xbd33('0xa')](function(_0x5b4077){logger[_0xbd33('0xb')](_0xbd33('0x22'),_0x3ff7cc);logger[_0xbd33('0x21')](_0xbd33('0x22'),_0x3ff7cc,JSON[_0xbd33('0x1d')](_0x5b4077));_0x580600(_0x5b4077);})['catch'](function(_0xe46c67){logger[_0xbd33('0xf')](_0xbd33('0x22'),_0xe46c67[_0xbd33('0x11')],_0x3ff7cc);_0x48ce4c(_0x18f1b3[_0xbd33('0xf')](0x1f4,_0xe46c67[_0xbd33('0x11')]));});});}; \ No newline at end of file +var _0x4eb2=['limit','include','map','model','then','stringify','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes'];(function(_0x4e1ca0,_0x1fac24){var _0x5c1726=function(_0x2a7a11){while(--_0x2a7a11){_0x4e1ca0['push'](_0x4e1ca0['shift']());}};_0x5c1726(++_0x1fac24);}(_0x4eb2,0x1df));var _0x24eb=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x4eb2[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x24eb('0x0'));var util=require(_0x24eb('0x1'));var moment=require(_0x24eb('0x2'));var BPromise=require('bluebird');var rs=require(_0x24eb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24eb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x24eb('0x5'))('rpc');var config=require(_0x24eb('0x6'));var jayson=require(_0x24eb('0x7'));var client=jayson[_0x24eb('0x8')][_0x24eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ca527,_0x273650,_0xf676f2){return new BPromise(function(_0xf130a1,_0xed11bb){return client[_0x24eb('0xa')](_0x2ca527,_0xf676f2)['then'](function(_0x1be150){logger[_0x24eb('0xb')](_0x24eb('0xc'),_0x273650,_0x24eb('0xd'));logger[_0x24eb('0xe')](_0x24eb('0xf'),_0x273650,_0x24eb('0xd'),JSON['stringify'](_0x1be150));if(_0x1be150[_0x24eb('0x10')]){if(_0x1be150[_0x24eb('0x10')][_0x24eb('0x11')]===0x1f4){logger[_0x24eb('0x10')](_0x24eb('0xc'),_0x273650,_0x1be150[_0x24eb('0x10')][_0x24eb('0x12')]);return _0xed11bb(_0x1be150[_0x24eb('0x10')][_0x24eb('0x12')]);}logger['error'](_0x24eb('0xc'),_0x273650,_0x1be150[_0x24eb('0x10')][_0x24eb('0x12')]);return _0xf130a1(_0x1be150[_0x24eb('0x10')][_0x24eb('0x12')]);}else{logger['info'](_0x24eb('0xc'),_0x273650,'request\x20sent');_0xf130a1(_0x1be150[_0x24eb('0x13')][_0x24eb('0x12')]);}})[_0x24eb('0x14')](function(_0x3d7a21){logger[_0x24eb('0x10')](_0x24eb('0xc'),_0x273650,_0x3d7a21);_0xed11bb(_0x3d7a21);});});}exports[_0x24eb('0x15')]=function(_0x22200c){var _0xd2d78=this;return new Promise(function(_0x1e118c,_0x5d624){return db[_0x24eb('0x16')][_0x24eb('0x17')]({'raw':_0x22200c[_0x24eb('0x18')]?_0x22200c[_0x24eb('0x18')][_0x24eb('0x19')]===undefined?!![]:![]:!![],'where':_0x22200c['options']?_0x22200c[_0x24eb('0x18')][_0x24eb('0x1a')]||null:null,'attributes':_0x22200c[_0x24eb('0x18')]?_0x22200c[_0x24eb('0x18')][_0x24eb('0x1b')]||null:null,'limit':_0x22200c[_0x24eb('0x18')]?_0x22200c['options'][_0x24eb('0x1c')]||null:null,'include':_0x22200c[_0x24eb('0x18')]?_0x22200c[_0x24eb('0x18')][_0x24eb('0x1d')]?_[_0x24eb('0x1e')](_0x22200c[_0x24eb('0x18')]['include'],function(_0x31b572){return{'model':db[_0x31b572[_0x24eb('0x1f')]],'as':_0x31b572['as'],'attributes':_0x31b572[_0x24eb('0x1b')],'include':_0x31b572[_0x24eb('0x1d')]?_[_0x24eb('0x1e')](_0x31b572['include'],function(_0x1011e3){return{'model':db[_0x1011e3[_0x24eb('0x1f')]],'as':_0x1011e3['as'],'attributes':_0x1011e3['attributes'],'include':_0x1011e3['include']?_['map'](_0x1011e3[_0x24eb('0x1d')],function(_0x1266f2){return{'model':db[_0x1266f2[_0x24eb('0x1f')]],'as':_0x1266f2['as'],'attributes':_0x1266f2[_0x24eb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x24eb('0x20')](function(_0x422fe3){logger[_0x24eb('0xb')](_0x24eb('0x15'),_0x22200c);logger[_0x24eb('0xe')](_0x24eb('0x15'),_0x22200c,JSON[_0x24eb('0x21')](_0x422fe3));_0x1e118c(_0x422fe3);})[_0x24eb('0x14')](function(_0x87c4f6){logger[_0x24eb('0x10')]('GetCmHopperBlack',_0x87c4f6['message'],_0x22200c);_0x5d624(_0xd2d78[_0x24eb('0x10')](0x1f4,_0x87c4f6[_0x24eb('0x12')]));});});};exports[_0x24eb('0x22')]=function(_0x1ab5d5){var _0x584fd7=this;return new Promise(function(_0x330761,_0x350f68){return db['CmHopperBlack'][_0x24eb('0x23')](_0x1ab5d5[_0x24eb('0x24')],{'raw':_0x1ab5d5[_0x24eb('0x18')]?_0x1ab5d5['options'][_0x24eb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ab5d5['options']?_0x1ab5d5[_0x24eb('0x18')][_0x24eb('0x1a')]||null:null,'attributes':_0x1ab5d5[_0x24eb('0x18')]?_0x1ab5d5['options'][_0x24eb('0x1b')]||null:null,'limit':_0x1ab5d5[_0x24eb('0x18')]?_0x1ab5d5[_0x24eb('0x18')][_0x24eb('0x1c')]||null:null})['then'](function(_0x56454a){logger[_0x24eb('0xb')](_0x24eb('0x22'),_0x1ab5d5);logger[_0x24eb('0xe')](_0x24eb('0x22'),_0x1ab5d5,JSON[_0x24eb('0x21')](_0x56454a));_0x330761(_0x56454a);})[_0x24eb('0x14')](function(_0x54d4cb){logger['error']('UpdateCmHopperBlack',_0x54d4cb[_0x24eb('0x12')],_0x1ab5d5);_0x350f68(_0x584fd7['error'](0x1f4,_0x54d4cb[_0x24eb('0x12')]));});});};exports[_0x24eb('0x25')]=function(_0x359eb3){var _0x24fb7d=this;return new Promise(function(_0x4a270d,_0x1f8be7){return db[_0x24eb('0x16')][_0x24eb('0x26')]({'where':_0x359eb3[_0x24eb('0x18')]?_0x359eb3[_0x24eb('0x18')][_0x24eb('0x1a')]||null:null})[_0x24eb('0x20')](function(_0x1e2773){logger[_0x24eb('0xb')](_0x24eb('0x25'),_0x359eb3);logger['debug']('DestroyCmHopperBlack',_0x359eb3,JSON[_0x24eb('0x21')](_0x1e2773));_0x4a270d(_0x1e2773);})['catch'](function(_0x44ee96){logger[_0x24eb('0x10')](_0x24eb('0x25'),_0x44ee96[_0x24eb('0x12')],_0x359eb3);_0x1f8be7(_0x24fb7d[_0x24eb('0x10')](0x1f4,_0x44ee96[_0x24eb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 8f3f420..c07749a 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 _0xd117=['/describe','describe','/:id','show','put','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd117,0x182));var _0x7d11=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0xd117[_0x39cd3c];return _0x47a0ae;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0x12')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x13')]);router['delete']('/:id',auth[_0x7d11('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa6b0=['update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','put'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x44d3b2,_0x1a0410){_0x44d3b2=_0x44d3b2-0x0;var _0x21fa38=_0xa6b0[_0x44d3b2];return _0x21fa38;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a6b('0x2'));var router=express[_0x0a6b('0x3')]();var fs_extra=require(_0x0a6b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var controller=require(_0x0a6b('0x7'));router[_0x0a6b('0x8')]('/',auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xa')]);router[_0x0a6b('0x8')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xc')]);router[_0x0a6b('0x8')](_0x0a6b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0a6b('0xe')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xf')]);router[_0x0a6b('0x10')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x11')]);module[_0x0a6b('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index d340a9b..efc09c3 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 _0x9518=['BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','diff','seconds','dispositionat'];(function(_0x5f12f5,_0x3257e9){var _0x1f271d=function(_0x497e12){while(--_0x497e12){_0x5f12f5['push'](_0x5f12f5['shift']());}};_0x1f271d(++_0x3257e9);}(_0x9518,0xc4));var _0x8951=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x9518[_0xa9a245];return _0x2d0eaa;};'use strict';var Sequelize=require(_0x8951('0x0'));var moment=require(_0x8951('0x1'));module[_0x8951('0x2')]={'state':{'type':Sequelize[_0x8951('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x8951('0x4')]},'scheduledat':{'type':Sequelize[_0x8951('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8951('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8951('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8951('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x8951('0x4')]},'originatecalleridname':{'type':Sequelize[_0x8951('0x4')]},'calleridnum':{'type':Sequelize[_0x8951('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8951('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8951('0x5')]},'ringtime':{'type':Sequelize[_0x8951('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8951('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8951('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8951('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x8951('0x4')]},'campaign':{'type':Sequelize[_0x8951('0x4')]},'campaigntype':{'type':Sequelize[_0x8951('0x4')]},'membername':{'type':Sequelize[_0x8951('0x4')]},'reason':{'type':Sequelize[_0x8951('0x4')]},'disposition':{'type':Sequelize[_0x8951('0x4')]},'secondDisposition':{'type':Sequelize[_0x8951('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8951('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4c25ac){var _0x530663=this[_0x8951('0x6')](_0x8951('0x7'));if(_0x530663&&_0x4c25ac){this[_0x8951('0x8')]('followuptime',moment(_0x4c25ac)[_0x8951('0x9')](moment(_0x530663),_0x8951('0xa')));}return this[_0x8951('0x8')](_0x8951('0xb'),_0x4c25ac);}},'amd':{'type':Sequelize[_0x8951('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8951('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x8951('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x8951('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x8951('0x5')]},'callback':{'type':Sequelize[_0x8951('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8951('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8951('0x5')]},'deleted':{'type':Sequelize[_0x8951('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x8951('0x5')]},'recallme':{'type':Sequelize[_0x8951('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x8951('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x8951('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8951('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8951('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x037e=['DATE','getDataValue','endtime','setDataValue','diff','BOOLEAN','sequelize','moment','INTEGER','STRING'];(function(_0x1f6f62,_0xa4a131){var _0x88f31a=function(_0x49d926){while(--_0x49d926){_0x1f6f62['push'](_0x1f6f62['shift']());}};_0x88f31a(++_0xa4a131);}(_0x037e,0x10a));var _0xe037=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x037e[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe037('0x0'));var moment=require(_0xe037('0x1'));module['exports']={'state':{'type':Sequelize[_0xe037('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe037('0x3')]},'scheduledat':{'type':Sequelize[_0xe037('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe037('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe037('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe037('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xe037('0x3')]},'originatecalleridname':{'type':Sequelize[_0xe037('0x3')]},'calleridnum':{'type':Sequelize[_0xe037('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe037('0x4')]},'responsetime':{'type':Sequelize[_0xe037('0x4')]},'answertime':{'type':Sequelize[_0xe037('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe037('0x4')]},'ringtime':{'type':Sequelize[_0xe037('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe037('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe037('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe037('0x3')]},'campaign':{'type':Sequelize[_0xe037('0x3')]},'campaigntype':{'type':Sequelize[_0xe037('0x3')]},'membername':{'type':Sequelize[_0xe037('0x3')]},'reason':{'type':Sequelize[_0xe037('0x3')]},'disposition':{'type':Sequelize[_0xe037('0x3')]},'secondDisposition':{'type':Sequelize[_0xe037('0x3')]},'thirdDisposition':{'type':Sequelize[_0xe037('0x3')]},'dispositionat':{'type':Sequelize[_0xe037('0x4')],'set':function(_0x4ee29d){var _0x29511f=this[_0xe037('0x5')](_0xe037('0x6'));if(_0x29511f&&_0x4ee29d){this[_0xe037('0x7')]('followuptime',moment(_0x4ee29d)[_0xe037('0x8')](moment(_0x29511f),'seconds'));}return this[_0xe037('0x7')]('dispositionat',_0x4ee29d);}},'amd':{'type':Sequelize[_0xe037('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe037('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe037('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe037('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe037('0x4')]},'callback':{'type':Sequelize[_0xe037('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe037('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe037('0x4')]},'recallme':{'type':Sequelize[_0xe037('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe037('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xe037('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe037('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe037('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe037('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe037('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 584e856..5562fd4 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 _0xc6ac=['key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','VoiceQueueId','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','CampaignId\x20=\x20?','checkContactHopper','findOne','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','CmHopperFinal','rawAttributes','fieldName','type'];(function(_0x1aa1bc,_0xacb48f){var _0x3ee8bb=function(_0x23f47a){while(--_0x23f47a){_0x1aa1bc['push'](_0x1aa1bc['shift']());}};_0x3ee8bb(++_0xacb48f);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x470b00,_0xfc5441){_0x470b00=_0x470b00-0x0;var _0x2987d3=_0xc6ac[_0x470b00];return _0x2987d3;};'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['CmHopperFinal'][_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['describe']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')]()[_0xcc6a('0x27')](respondWithResult(_0x47c999,null))[_0xcc6a('0x4b')](handleError(_0x47c999,null));};exports['update']=function(_0x1c3bb8,_0x5e7bab){if(_0x1c3bb8[_0xcc6a('0x4d')][_0xcc6a('0x4e')]){delete _0x1c3bb8[_0xcc6a('0x4d')][_0xcc6a('0x4e')];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'uniqueid':_0x1c3bb8['params']['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0x5e7bab,null))[_0xcc6a('0x27')](saveUpdates(_0x1c3bb8[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x5e7bab,null))[_0xcc6a('0x4b')](handleError(_0x5e7bab,null));};exports[_0xcc6a('0x4f')]=function(_0x431684,_0x392805,_0x31987f){return db[_0xcc6a('0x2d')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x431684[_0xcc6a('0x47')]['id']},'attributes':[[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x53')))),_0xcc6a('0x54')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x55')))),'busyContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x208,\x201,\x20null'))),_0xcc6a('0x56')],[db['sequelize']['fn'](_0xcc6a('0x51'),db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x57')))),_0xcc6a('0x58')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')]['literal'](_0xcc6a('0x59')))),'abandonedContacts'],[db[_0xcc6a('0x50')]['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')]('`state`\x20=\x2022,\x201,\x20null'))),_0xcc6a('0x5a')],[db['sequelize']['fn']('COUNT',db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x5b')))),_0xcc6a('0x5c')]]})[_0xcc6a('0x27')](handleEntityNotFound(_0x392805,null))[_0xcc6a('0x27')](respondWithResult(_0x392805,null))[_0xcc6a('0x4b')](handleError(_0x392805,null));};exports[_0xcc6a('0x5d')]=function(_0x3e76d7,_0x42bbc7,_0x2ad9a6){return db[_0xcc6a('0x2d')]['findAll']({'raw':![],'where':{'CampaignId':_0x3e76d7[_0xcc6a('0x47')]['id']},'attributes':[[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x5e')))),_0xcc6a('0x5f')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x53')))),_0xcc6a('0x54')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x55')))),'busyContacts'],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db[_0xcc6a('0x50')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xcc6a('0x56')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db[_0xcc6a('0x50')]['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x57')))),_0xcc6a('0x58')],[db[_0xcc6a('0x50')]['fn'](_0xcc6a('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0xcc6a('0x52')](_0xcc6a('0x59')))),_0xcc6a('0x60')],[db[_0xcc6a('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x61')))),_0xcc6a('0x5a')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xcc6a('0x50')][_0xcc6a('0x52')](_0xcc6a('0x5b')))),_0xcc6a('0x5c')]]})['then'](handleEntityNotFound(_0x42bbc7,null))[_0xcc6a('0x27')](respondWithResult(_0x42bbc7,null))[_0xcc6a('0x4b')](handleError(_0x42bbc7,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x72e53a,_0x5b61df,_0x3b4ce0){return db['VoiceQueue'][_0xcc6a('0x4a')]({'where':{'id':_0x72e53a[_0xcc6a('0x47')]['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0x5b61df,null))['then'](function(_0x3ce1eb){var _0x51390a;if(_0x3ce1eb){_0x51390a=squel[_0xcc6a('0x62')]()['into'](_0xcc6a('0x63'))[_0xcc6a('0x64')]([_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'VoiceQueueId',_0xcc6a('0x69'),_0xcc6a('0x6a')],squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x6d'),'phone')[_0xcc6a('0x6c')](_0xcc6a('0x6e'),'scheduledAt')['field'](_0xcc6a('0x6f'),_0xcc6a('0x67'))[_0xcc6a('0x6c')](_0xcc6a('0x70'),_0xcc6a('0x68'))[_0xcc6a('0x6c')]('ANY_VALUE(VoiceQueueId)',_0xcc6a('0x71'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x69'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),'updatedAt')['from'](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x75'),_0x72e53a['body'][_0xcc6a('0x76')][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x77'))[_0xcc6a('0x3e')](_0xcc6a('0x78'),squel['select']()[_0xcc6a('0x6c')](_0xcc6a('0x65'))[_0xcc6a('0x79')]('cm_hopper')[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]()))[_0xcc6a('0x3e')](_0xcc6a('0x78'),squel['select']()[_0xcc6a('0x6c')](_0xcc6a('0x7a'))['from'](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x73'),_0x72e53a[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]())['where'](_0xcc6a('0x7b')))[_0xcc6a('0x7c')](_0xcc6a('0x67')))[_0xcc6a('0x74')]();return db[_0xcc6a('0x50')][_0xcc6a('0x33')](_0x51390a);}return[];})['then'](respondWithResult(_0x5b61df,null))['catch'](handleError(_0x5b61df,null));};exports[_0xcc6a('0x7d')]=function(_0x5be65b,_0xb42e9,_0x35a798){return db[_0xcc6a('0x7e')][_0xcc6a('0x4a')]({'where':{'id':_0x5be65b[_0xcc6a('0x47')]['id']}})[_0xcc6a('0x27')](handleEntityNotFound(_0xb42e9,null))[_0xcc6a('0x27')](function(_0x1746d8){var _0xc0d194;if(_0x1746d8){_0xc0d194=squel[_0xcc6a('0x62')]()[_0xcc6a('0x7f')](_0xcc6a('0x63'))['fromQuery']([_0xcc6a('0x65'),_0xcc6a('0x66'),_0xcc6a('0x67'),_0xcc6a('0x68'),'CampaignId',_0xcc6a('0x69'),'updatedAt'],squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x6d'),_0xcc6a('0x65'))[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x66'))['field'](_0xcc6a('0x6f'),_0xcc6a('0x67'))[_0xcc6a('0x6c')](_0xcc6a('0x70'),_0xcc6a('0x68'))[_0xcc6a('0x6c')]('ANY_VALUE(CampaignId)',_0xcc6a('0x80'))[_0xcc6a('0x6c')]('NOW()','createdAt')[_0xcc6a('0x6c')](_0xcc6a('0x6e'),_0xcc6a('0x6a'))[_0xcc6a('0x79')](_0xcc6a('0x72'))['where'](_0xcc6a('0x81'),_0x5be65b['params']['id'][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x75'),_0x5be65b[_0xcc6a('0x4d')][_0xcc6a('0x76')][_0xcc6a('0x74')]())[_0xcc6a('0x3e')](_0xcc6a('0x77'))['where'](_0xcc6a('0x78'),squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')]('phone')[_0xcc6a('0x79')](_0xcc6a('0x63'))[_0xcc6a('0x3e')](_0xcc6a('0x81'),_0x5be65b[_0xcc6a('0x47')]['id'][_0xcc6a('0x74')]()))[_0xcc6a('0x3e')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xcc6a('0x6b')]()[_0xcc6a('0x6c')](_0xcc6a('0x7a'))[_0xcc6a('0x79')](_0xcc6a('0x72'))[_0xcc6a('0x3e')](_0xcc6a('0x81'),_0x5be65b[_0xcc6a('0x47')]['id']['toString']())['where'](_0xcc6a('0x7b')))['group'](_0xcc6a('0x67')))[_0xcc6a('0x74')]();return db[_0xcc6a('0x50')][_0xcc6a('0x33')](_0xc0d194);}return[];})[_0xcc6a('0x27')](respondWithResult(_0xb42e9,null))[_0xcc6a('0x4b')](handleError(_0xb42e9,null));};exports[_0xcc6a('0x82')]=function(_0x48b6e3,_0x10d731,_0x537e2b){return db['CmHopper'][_0xcc6a('0x83')]({'where':{'VoiceQueueId':_0x48b6e3['body'][_0xcc6a('0x71')],'CampaignId':_0x48b6e3[_0xcc6a('0x4d')]['CampaignId'],'ContactId':_0x48b6e3['body'][_0xcc6a('0x67')]}})['then'](handleEntityNotFound(_0x10d731,null))[_0xcc6a('0x27')](function(_0x3df510){if(_0x3df510){return _0x3df510;}return null;})[_0xcc6a('0x27')](respondWithResult(_0x10d731,null))[_0xcc6a('0x4b')](handleError(_0x10d731,null));}; \ No newline at end of file +var _0x2a07=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','describe','body','uniqueid','find','findAll','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','toString','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3f46c5,_0x5aaabb){var _0x226f4c=function(_0x310334){while(--_0x310334){_0x3f46c5['push'](_0x3f46c5['shift']());}};_0x226f4c(++_0x5aaabb);}(_0x2a07,0x74));var _0x72a0=function(_0x41f936,_0x217ec3){_0x41f936=_0x41f936-0x0;var _0x11a6fe=_0x2a07[_0x41f936];return _0x11a6fe;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':!![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['CmHopperFinal'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0x304400,null))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0xe38fb3,_0x3cab6a){if(_0xe38fb3[_0x72a0('0x4c')][_0x72a0('0x4d')]){delete _0xe38fb3[_0x72a0('0x4c')][_0x72a0('0x4d')];}return db[_0x72a0('0x2e')][_0x72a0('0x4e')]({'where':{'uniqueid':_0xe38fb3['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x3cab6a,null))[_0x72a0('0x28')](saveUpdates(_0xe38fb3[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x3cab6a,null))[_0x72a0('0x46')](handleError(_0x3cab6a,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x143410,_0x595243,_0x4d712b){return db[_0x72a0('0x2e')][_0x72a0('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x143410[_0x72a0('0x48')]['id']},'attributes':[[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x53')))),_0x72a0('0x54')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x72a0('0x55')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x56')))),'dropContacts'],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x72a0('0x57')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x58')))),_0x72a0('0x59')],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5a')))),'answeringMachine']]})[_0x72a0('0x28')](handleEntityNotFound(_0x595243,null))['then'](respondWithResult(_0x595243,null))['catch'](handleError(_0x595243,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x522ee2,_0x237025,_0x4e5d05){return db[_0x72a0('0x2e')]['findAll']({'raw':![],'where':{'CampaignId':_0x522ee2[_0x72a0('0x48')]['id']},'attributes':[[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x5b')))),_0x72a0('0x5c')],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x53')))),_0x72a0('0x54')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5d')))),'busyContacts'],[db['sequelize']['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x5e')))),_0x72a0('0x5f')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')]['literal'](_0x72a0('0x56')))),'dropContacts'],[db[_0x72a0('0x50')]['fn'](_0x72a0('0x51'),db['sequelize']['fn']('IF',db[_0x72a0('0x50')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x72a0('0x50')]['fn']('COUNT',db[_0x72a0('0x50')]['fn']('IF',db['sequelize'][_0x72a0('0x52')](_0x72a0('0x58')))),_0x72a0('0x59')],[db['sequelize']['fn'](_0x72a0('0x51'),db[_0x72a0('0x50')]['fn']('IF',db[_0x72a0('0x50')][_0x72a0('0x52')](_0x72a0('0x5a')))),'answeringMachine']]})[_0x72a0('0x28')](handleEntityNotFound(_0x237025,null))[_0x72a0('0x28')](respondWithResult(_0x237025,null))[_0x72a0('0x46')](handleError(_0x237025,null));};exports[_0x72a0('0x60')]=function(_0x4f0944,_0x3dd25d,_0x647e75){return db['VoiceQueue'][_0x72a0('0x4e')]({'where':{'id':_0x4f0944['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x3dd25d,null))[_0x72a0('0x28')](function(_0xb17e09){var _0x1238a3;if(_0xb17e09){_0x1238a3=squel[_0x72a0('0x61')]()[_0x72a0('0x62')](_0x72a0('0x63'))['fromQuery'](['phone','scheduledAt',_0x72a0('0x64'),_0x72a0('0x65'),_0x72a0('0x66'),_0x72a0('0x67'),_0x72a0('0x68')],squel[_0x72a0('0x69')]()['field'](_0x72a0('0x6a'),_0x72a0('0x6b'))[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x6e'))[_0x72a0('0x6c')](_0x72a0('0x6f'),'ContactId')[_0x72a0('0x6c')](_0x72a0('0x70'),_0x72a0('0x65'))[_0x72a0('0x6c')](_0x72a0('0x71'),_0x72a0('0x66'))['field'](_0x72a0('0x6d'),'createdAt')[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x68'))[_0x72a0('0x72')](_0x72a0('0x73'))['where'](_0x72a0('0x74'),_0x4f0944[_0x72a0('0x48')]['id']['toString']())[_0x72a0('0x3e')](_0x72a0('0x75'),_0x4f0944[_0x72a0('0x4c')][_0x72a0('0x76')]['toString']())[_0x72a0('0x3e')](_0x72a0('0x77'))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()[_0x72a0('0x6c')](_0x72a0('0x6b'))[_0x72a0('0x72')](_0x72a0('0x63'))[_0x72a0('0x3e')](_0x72a0('0x74'),_0x4f0944[_0x72a0('0x48')]['id']['toString']()))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()[_0x72a0('0x6c')](_0x72a0('0x79'))[_0x72a0('0x72')](_0x72a0('0x73'))[_0x72a0('0x3e')]('VoiceQueueId\x20=\x20?',_0x4f0944[_0x72a0('0x48')]['id']['toString']())['where'](_0x72a0('0x7a')))['group']('ContactId'))[_0x72a0('0x7b')]();return db['sequelize'][_0x72a0('0x33')](_0x1238a3);}return[];})[_0x72a0('0x28')](respondWithResult(_0x3dd25d,null))[_0x72a0('0x46')](handleError(_0x3dd25d,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x344a69,_0x179ca2,_0x3832d7){return db[_0x72a0('0x7c')][_0x72a0('0x4e')]({'where':{'id':_0x344a69['params']['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x179ca2,null))[_0x72a0('0x28')](function(_0x38736e){var _0x4f421f;if(_0x38736e){_0x4f421f=squel[_0x72a0('0x61')]()[_0x72a0('0x62')](_0x72a0('0x63'))['fromQuery']([_0x72a0('0x6b'),_0x72a0('0x6e'),_0x72a0('0x64'),_0x72a0('0x65'),_0x72a0('0x7d'),_0x72a0('0x67'),_0x72a0('0x68')],squel[_0x72a0('0x69')]()[_0x72a0('0x6c')]('ANY_VALUE(calleridnum)',_0x72a0('0x6b'))[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x6e'))[_0x72a0('0x6c')]('ANY_VALUE(ContactId)',_0x72a0('0x64'))[_0x72a0('0x6c')](_0x72a0('0x70'),_0x72a0('0x65'))['field'](_0x72a0('0x7e'),_0x72a0('0x7d'))[_0x72a0('0x6c')]('NOW()','createdAt')[_0x72a0('0x6c')](_0x72a0('0x6d'),_0x72a0('0x68'))[_0x72a0('0x72')](_0x72a0('0x73'))['where']('CampaignId\x20=\x20?',_0x344a69['params']['id'][_0x72a0('0x7b')]())['where'](_0x72a0('0x75'),_0x344a69['body']['state']['toString']())['where'](_0x72a0('0x77'))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()['field'](_0x72a0('0x6b'))[_0x72a0('0x72')]('cm_hopper')[_0x72a0('0x3e')](_0x72a0('0x7f'),_0x344a69['params']['id'][_0x72a0('0x7b')]()))[_0x72a0('0x3e')](_0x72a0('0x78'),squel[_0x72a0('0x69')]()['field']('calleridnum')[_0x72a0('0x72')](_0x72a0('0x73'))[_0x72a0('0x3e')](_0x72a0('0x7f'),_0x344a69[_0x72a0('0x48')]['id'][_0x72a0('0x7b')]())['where']('state\x20=\x204'))[_0x72a0('0x80')](_0x72a0('0x64')))['toString']();return db[_0x72a0('0x50')][_0x72a0('0x33')](_0x4f421f);}return[];})[_0x72a0('0x28')](respondWithResult(_0x179ca2,null))[_0x72a0('0x46')](handleError(_0x179ca2,null));};exports[_0x72a0('0x81')]=function(_0x167a80,_0x7533ea,_0x56bdf5){return db[_0x72a0('0x82')][_0x72a0('0x83')]({'where':{'VoiceQueueId':_0x167a80[_0x72a0('0x4c')]['VoiceQueueId'],'CampaignId':_0x167a80[_0x72a0('0x4c')][_0x72a0('0x7d')],'ContactId':_0x167a80[_0x72a0('0x4c')][_0x72a0('0x64')]}})[_0x72a0('0x28')](handleEntityNotFound(_0x7533ea,null))['then'](function(_0xc16765){if(_0xc16765){return _0xc16765;}return null;})[_0x72a0('0x28')](respondWithResult(_0x7533ea,null))[_0x72a0('0x46')](handleError(_0x7533ea,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index fc92b38..e9c4041 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 _0x7a7e=['path','rimraf','./cmHopperFinal.attributes','define','CmHopperFinal','calleridnum','uniqueid','util','../../config/logger','api','bluebird','request-promise'];(function(_0x12074e,_0x559b40){var _0x1cde63=function(_0x31a748){while(--_0x31a748){_0x12074e['push'](_0x12074e['shift']());}};_0x1cde63(++_0x559b40);}(_0x7a7e,0x17b));var _0xe7a7=function(_0x3944de,_0x35d924){_0x3944de=_0x3944de-0x0;var _0x3fb66e=_0x7a7e[_0x3944de];return _0x3fb66e;};'use strict';var _=require('lodash');var util=require(_0xe7a7('0x0'));var logger=require(_0xe7a7('0x1'))(_0xe7a7('0x2'));var moment=require('moment');var BPromise=require(_0xe7a7('0x3'));var rp=require(_0xe7a7('0x4'));var fs=require('fs');var path=require(_0xe7a7('0x5'));var rimraf=require(_0xe7a7('0x6'));var config=require('../../config/environment');var attributes=require(_0xe7a7('0x7'));module['exports']=function(_0x42afd4,_0x1a412e){return _0x42afd4[_0xe7a7('0x8')](_0xe7a7('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xe7a7('0xa'),'fields':[_0xe7a7('0xa')]},{'name':_0xe7a7('0xb'),'fields':[_0xe7a7('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ee4=['api','bluebird','request-promise','path','rimraf','exports','CmHopperFinal','calleridnum','uniqueid','util'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4ee4,0x12b));var _0x44ee=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x4ee4[_0x4709c0];return _0x13348b;};'use strict';var _=require('lodash');var util=require(_0x44ee('0x0'));var logger=require('../../config/logger')(_0x44ee('0x1'));var moment=require('moment');var BPromise=require(_0x44ee('0x2'));var rp=require(_0x44ee('0x3'));var fs=require('fs');var path=require(_0x44ee('0x4'));var rimraf=require(_0x44ee('0x5'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0x44ee('0x6')]=function(_0x37ef5c,_0x4ffc56){return _0x37ef5c['define'](_0x44ee('0x7'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x44ee('0x8'),'fields':[_0x44ee('0x8')]},{'name':_0x44ee('0x9'),'fields':[_0x44ee('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 394e1df..35bd741 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 _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x213697,_0x20d23d){var _0x39ec44=function(_0x2ba4d6){while(--_0x2ba4d6){_0x213697['push'](_0x213697['shift']());}};_0x39ec44(++_0x20d23d);}(_0x7a54,0x106));var _0x47a5=function(_0x25b5c5,_0x2fad98){_0x25b5c5=_0x25b5c5-0x0;var _0x3486ac=_0x7a54[_0x25b5c5];return _0x3486ac;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3fd0b6,_0x2f1ae8){var _0x158ad8=function(_0x479184){while(--_0x479184){_0x3fd0b6['push'](_0x3fd0b6['shift']());}};_0x158ad8(++_0x2f1ae8);}(_0x7a54,0x106));var _0x47a5=function(_0x2bffdc,_0x19eaff){_0x2bffdc=_0x2bffdc-0x0;var _0x20a537=_0x7a54[_0x2bffdc];return _0x20a537;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index d76c656..2af834e 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 _0x261b=['/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post'];(function(_0x5a222b,_0x1b8d1b){var _0x45b00d=function(_0x21605a){while(--_0x21605a){_0x5a222b['push'](_0x5a222b['shift']());}};_0x45b00d(++_0x1b8d1b);}(_0x261b,0x93));var _0xb261=function(_0x30ce60,_0x535051){_0x30ce60=_0x30ce60-0x0;var _0x149ac6=_0x261b[_0x30ce60];return _0x149ac6;};'use strict';var multer=require(_0xb261('0x0'));var util=require(_0xb261('0x1'));var path=require(_0xb261('0x2'));var timeout=require(_0xb261('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb261('0x4'));var auth=require(_0xb261('0x5'));var interaction=require(_0xb261('0x6'));var config=require(_0xb261('0x7'));var controller=require(_0xb261('0x8'));router[_0xb261('0x9')]('/',auth[_0xb261('0xa')](),controller[_0xb261('0xb')]);router['get'](_0xb261('0xc'),auth[_0xb261('0xa')](),controller[_0xb261('0xd')]);router[_0xb261('0x9')](_0xb261('0xe'),auth[_0xb261('0xa')](),controller[_0xb261('0xf')]);router[_0xb261('0x9')](_0xb261('0x10'),auth[_0xb261('0xa')](),controller[_0xb261('0x11')]);router[_0xb261('0x9')](_0xb261('0x12'),auth[_0xb261('0xa')](),controller[_0xb261('0x13')]);router[_0xb261('0x14')](_0xb261('0x15'),auth[_0xb261('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xb261('0x14')](_0xb261('0x16'),auth[_0xb261('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0xb261('0x17'),auth['isAuthenticated'](),controller[_0xb261('0x18')]);router[_0xb261('0x19')](_0xb261('0xe'),auth[_0xb261('0xa')](),controller[_0xb261('0x1a')]);module[_0xb261('0x1b')]=router; \ No newline at end of file +var _0x37a5=['./cmHopperFinal.controller','get','isAuthenticated','index','/describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','/:id','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1cf675,_0x3d90bb){var _0x349e19=function(_0x3562f9){while(--_0x3562f9){_0x1cf675['push'](_0x1cf675['shift']());}};_0x349e19(++_0x3d90bb);}(_0x37a5,0x100));var _0x537a=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x37a5[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0x537a('0x0'));var util=require(_0x537a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x537a('0x2'));var router=express[_0x537a('0x3')]();var fs_extra=require(_0x537a('0x4'));var auth=require(_0x537a('0x5'));var interaction=require(_0x537a('0x6'));var config=require(_0x537a('0x7'));var controller=require(_0x537a('0x8'));router[_0x537a('0x9')]('/',auth[_0x537a('0xa')](),controller[_0x537a('0xb')]);router[_0x537a('0x9')](_0x537a('0xc'),auth[_0x537a('0xa')](),controller['describe']);router[_0x537a('0x9')]('/:id',auth[_0x537a('0xa')](),controller[_0x537a('0xd')]);router[_0x537a('0x9')](_0x537a('0xe'),auth['isAuthenticated'](),controller[_0x537a('0xf')]);router[_0x537a('0x9')]('/campaign/countAttributes/:id',auth[_0x537a('0xa')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x537a('0x10')](_0x537a('0x11'),auth[_0x537a('0xa')](),controller[_0x537a('0x12')]);router[_0x537a('0x10')](_0x537a('0x13'),auth[_0x537a('0xa')](),controller[_0x537a('0x14')]);router[_0x537a('0x10')]('/checkContactHopper',auth[_0x537a('0xa')](),controller[_0x537a('0x15')]);router['put'](_0x537a('0x16'),auth['isAuthenticated'](),controller['update']);module[_0x537a('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 5c589f4..36eeaba 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 _0x28b4=['INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x5d1e23,_0x90f452){var _0x35da6c=function(_0x2c0834){while(--_0x2c0834){_0x5d1e23['push'](_0x5d1e23['shift']());}};_0x35da6c(++_0x90f452);}(_0x28b4,0x1ee));var _0x428b=function(_0x526f27,_0x7d93c8){_0x526f27=_0x526f27-0x0;var _0x35d8e4=_0x28b4[_0x526f27];return _0x35d8e4;};'use strict';var Sequelize=require(_0x428b('0x0'));module['exports']={'state':{'type':Sequelize[_0x428b('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x428b('0x2')]},'scheduledat':{'type':Sequelize[_0x428b('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x428b('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x428b('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x428b('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x428b('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x428b('0x2')]},'originatecalleridname':{'type':Sequelize[_0x428b('0x2')]},'calleridnum':{'type':Sequelize[_0x428b('0x2')]},'calleridname':{'type':Sequelize[_0x428b('0x2')]},'starttime':{'type':Sequelize[_0x428b('0x3')]},'responsetime':{'type':Sequelize[_0x428b('0x3')]},'answertime':{'type':Sequelize[_0x428b('0x3')]},'droptime':{'type':Sequelize[_0x428b('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x428b('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x428b('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x428b('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x428b('0x2')]},'campaign':{'type':Sequelize[_0x428b('0x2')]},'campaigntype':{'type':Sequelize[_0x428b('0x2')]},'membername':{'type':Sequelize[_0x428b('0x2')]},'reason':{'type':Sequelize[_0x428b('0x2')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x428b('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x428b('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x428b('0x3')]},'recallme':{'type':Sequelize[_0x428b('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x428b('0x3')]},'edited':{'type':Sequelize[_0x428b('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x428b('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x428b('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x428b('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x428b('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb0b2=['sequelize','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xb0b2,0xbe));var _0x2b0b=function(_0x318e8a,_0x21a8ec){_0x318e8a=_0x318e8a-0x0;var _0xceec48=_0xb0b2[_0x318e8a];return _0xceec48;};'use strict';var Sequelize=require(_0x2b0b('0x0'));module['exports']={'state':{'type':Sequelize[_0x2b0b('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x2b0b('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x2b0b('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2b0b('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2b0b('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2b0b('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2b0b('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x2b0b('0x2')]},'calleridnum':{'type':Sequelize[_0x2b0b('0x2')]},'calleridname':{'type':Sequelize[_0x2b0b('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x2b0b('0x3')]},'answertime':{'type':Sequelize[_0x2b0b('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x2b0b('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2b0b('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2b0b('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x2b0b('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x2b0b('0x2')]},'reason':{'type':Sequelize[_0x2b0b('0x2')]},'amd':{'type':Sequelize[_0x2b0b('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2b0b('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x2b0b('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2b0b('0x3')]},'recallme':{'type':Sequelize[_0x2b0b('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x2b0b('0x3')]},'edited':{'type':Sequelize[_0x2b0b('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x2b0b('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2b0b('0x1')],'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 a78d13d..34a926b 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 _0x6d75=['keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','CmHopperHistory','includeAll','include','findAll','rows','catch','show','params','create','describe','uniqueid','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query'];(function(_0x5b5cbc,_0x1717bf){var _0x145e83=function(_0x3b44f6){while(--_0x3b44f6){_0x5b5cbc['push'](_0x5b5cbc['shift']());}};_0x145e83(++_0x1717bf);}(_0x6d75,0xb4));var _0x56d7=function(_0x23a8ba,_0xab5848){_0x23a8ba=_0x23a8ba-0x0;var _0x468389=_0x6d75[_0x23a8ba];return _0x468389;};'use strict';var emlformat=require(_0x56d7('0x0'));var rimraf=require(_0x56d7('0x1'));var zipdir=require(_0x56d7('0x2'));var jsonpatch=require(_0x56d7('0x3'));var rp=require(_0x56d7('0x4'));var moment=require(_0x56d7('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x56d7('0x6'));var ejs=require(_0x56d7('0x7'));var fs=require('fs');var fs_extra=require(_0x56d7('0x8'));var _=require(_0x56d7('0x9'));var squel=require(_0x56d7('0xa'));var crypto=require(_0x56d7('0xb'));var jsforce=require(_0x56d7('0xc'));var deskjs=require(_0x56d7('0xd'));var toCsv=require('to-csv');var querystring=require(_0x56d7('0xe'));var Papa=require(_0x56d7('0xf'));var Redis=require(_0x56d7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x56d7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x56d7('0x12'));var logger=require(_0x56d7('0x13'))(_0x56d7('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x56d7('0x15'))['db'];function respondWithStatusCode(_0x2cfe58,_0x2f1efd){_0x2f1efd=_0x2f1efd||0xcc;return function(_0x4f59b8){if(_0x4f59b8){return _0x2cfe58[_0x56d7('0x16')](_0x2f1efd);}return _0x2cfe58[_0x56d7('0x17')](_0x2f1efd)[_0x56d7('0x18')]();};}function respondWithResult(_0x2de677,_0x3d26dd){_0x3d26dd=_0x3d26dd||0xc8;return function(_0x3be091){if(_0x3be091){return _0x2de677[_0x56d7('0x17')](_0x3d26dd)['json'](_0x3be091);}};}function respondWithFilteredResult(_0x4cb5b4,_0x2f47d7){return function(_0x4118dc){if(_0x4118dc){var _0x26a99c=typeof _0x2f47d7['offset']===_0x56d7('0x19')&&typeof _0x2f47d7['limit']===_0x56d7('0x19');var _0xafbac1=_0x4118dc[_0x56d7('0x1a')];var _0x383467=_0x26a99c?0x0:_0x2f47d7[_0x56d7('0x1b')];var _0x285c4d=_0x26a99c?_0x4118dc['count']:_0x2f47d7[_0x56d7('0x1b')]+_0x2f47d7[_0x56d7('0x1c')];var _0x1f54ed;if(_0x285c4d>=_0xafbac1){_0x285c4d=_0xafbac1;_0x1f54ed=0xc8;}else{_0x1f54ed=0xce;}_0x4cb5b4[_0x56d7('0x17')](_0x1f54ed);return _0x4cb5b4[_0x56d7('0x1d')](_0x56d7('0x1e'),_0x383467+'-'+_0x285c4d+'/'+_0xafbac1)[_0x56d7('0x1f')](_0x4118dc);}return null;};}function patchUpdates(_0x3a4fdc){return function(_0x29bed4){try{jsonpatch[_0x56d7('0x20')](_0x29bed4,_0x3a4fdc,!![]);}catch(_0x2fcb11){return BPromise['reject'](_0x2fcb11);}return _0x29bed4[_0x56d7('0x21')]();};}function saveUpdates(_0x5c8019,_0x3e48f1){return function(_0x57f869){if(_0x57f869){return _0x57f869[_0x56d7('0x22')](_0x5c8019)[_0x56d7('0x23')](function(_0x3f393a){return _0x3f393a;});}return null;};}function removeEntity(_0x5f56a1,_0x5a88e8){return function(_0x48c238){if(_0x48c238){return _0x48c238[_0x56d7('0x24')]()['then'](function(){_0x5f56a1[_0x56d7('0x17')](0xcc)[_0x56d7('0x18')]();});}};}function handleEntityNotFound(_0x284b60,_0x65c4e0){return function(_0x3f829a){if(!_0x3f829a){_0x284b60[_0x56d7('0x16')](0x194);}return _0x3f829a;};}function handleError(_0x5dcf56,_0x49caf8){_0x49caf8=_0x49caf8||0x1f4;return function(_0x59f2e3){logger[_0x56d7('0x25')](_0x59f2e3[_0x56d7('0x26')]);if(_0x59f2e3['name']){delete _0x59f2e3[_0x56d7('0x27')];}_0x5dcf56['status'](_0x49caf8)[_0x56d7('0x28')](_0x59f2e3);};}exports[_0x56d7('0x29')]=function(_0x48d784,_0x8137bb){var _0x1603d4={},_0x5cbe49={},_0x2f890a={'count':0x0,'rows':[]};var _0xcc1a8b=_[_0x56d7('0x2a')](db['CmHopperHistory']['rawAttributes'],function(_0x4aa0fe){return{'name':_0x4aa0fe[_0x56d7('0x2b')],'type':_0x4aa0fe[_0x56d7('0x2c')][_0x56d7('0x2d')]};});_0x5cbe49[_0x56d7('0x2e')]=_[_0x56d7('0x2a')](_0xcc1a8b,'name');_0x5cbe49[_0x56d7('0x2f')]=_[_0x56d7('0x30')](_0x48d784[_0x56d7('0x2f')]);_0x5cbe49['filters']=_['intersection'](_0x5cbe49['model'],_0x5cbe49[_0x56d7('0x2f')]);_0x1603d4[_0x56d7('0x31')]=_[_0x56d7('0x32')](_0x5cbe49[_0x56d7('0x2e')],qs[_0x56d7('0x33')](_0x48d784[_0x56d7('0x2f')][_0x56d7('0x33')]));_0x1603d4[_0x56d7('0x31')]=_0x1603d4[_0x56d7('0x31')][_0x56d7('0x34')]?_0x1603d4[_0x56d7('0x31')]:_0x5cbe49[_0x56d7('0x2e')];if(!_0x48d784[_0x56d7('0x2f')]['hasOwnProperty'](_0x56d7('0x35'))){_0x1603d4[_0x56d7('0x1c')]=qs['limit'](_0x48d784['query'][_0x56d7('0x1c')]);_0x1603d4[_0x56d7('0x1b')]=qs[_0x56d7('0x1b')](_0x48d784[_0x56d7('0x2f')]['offset']);}_0x1603d4[_0x56d7('0x36')]=qs['sort'](_0x48d784['query'][_0x56d7('0x37')]);_0x1603d4[_0x56d7('0x38')]=qs[_0x56d7('0x39')](_[_0x56d7('0x3a')](_0x48d784[_0x56d7('0x2f')],_0x5cbe49[_0x56d7('0x39')]),_0xcc1a8b);if(_0x48d784[_0x56d7('0x2f')][_0x56d7('0x3b')]){_0x1603d4[_0x56d7('0x38')]=_[_0x56d7('0x3c')](_0x1603d4[_0x56d7('0x38')],{'$or':_[_0x56d7('0x2a')](_0xcc1a8b,function(_0x26c91d){if(_0x26c91d['type']!==_0x56d7('0x3d')){var _0x45d15a={};_0x45d15a[_0x26c91d['name']]={'$like':'%'+_0x48d784[_0x56d7('0x2f')]['filter']+'%'};return _0x45d15a;}})});}_0x1603d4=_[_0x56d7('0x3c')]({},_0x1603d4,_0x48d784[_0x56d7('0x3e')]);var _0x58e906={'where':_0x1603d4[_0x56d7('0x38')]};return db[_0x56d7('0x3f')][_0x56d7('0x1a')](_0x58e906)[_0x56d7('0x23')](function(_0x5db884){_0x2f890a[_0x56d7('0x1a')]=_0x5db884;if(_0x48d784[_0x56d7('0x2f')][_0x56d7('0x40')]){_0x1603d4[_0x56d7('0x41')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x56d7('0x42')](_0x1603d4);})[_0x56d7('0x23')](function(_0x2a114d){_0x2f890a[_0x56d7('0x43')]=_0x2a114d;return _0x2f890a;})[_0x56d7('0x23')](respondWithFilteredResult(_0x8137bb,_0x1603d4))[_0x56d7('0x44')](handleError(_0x8137bb,null));};exports[_0x56d7('0x45')]=function(_0x23ba0b,_0x36091d){var _0x5745d4={'raw':!![],'where':{'id':_0x23ba0b[_0x56d7('0x46')]['id']}},_0x570864={};_0x570864[_0x56d7('0x2e')]=_['keys'](db[_0x56d7('0x3f')]['rawAttributes']);_0x570864[_0x56d7('0x2f')]=_['keys'](_0x23ba0b[_0x56d7('0x2f')]);_0x570864['filters']=_['intersection'](_0x570864[_0x56d7('0x2e')],_0x570864['query']);_0x5745d4['attributes']=_[_0x56d7('0x32')](_0x570864[_0x56d7('0x2e')],qs[_0x56d7('0x33')](_0x23ba0b[_0x56d7('0x2f')][_0x56d7('0x33')]));_0x5745d4[_0x56d7('0x31')]=_0x5745d4['attributes'][_0x56d7('0x34')]?_0x5745d4[_0x56d7('0x31')]:_0x570864[_0x56d7('0x2e')];if(_0x23ba0b['query']['includeAll']){_0x5745d4[_0x56d7('0x41')]=[{'all':!![]}];}_0x5745d4=_[_0x56d7('0x3c')]({},_0x5745d4,_0x23ba0b[_0x56d7('0x3e')]);return db['CmHopperHistory']['find'](_0x5745d4)[_0x56d7('0x23')](handleEntityNotFound(_0x36091d,null))['then'](respondWithResult(_0x36091d,null))[_0x56d7('0x44')](handleError(_0x36091d,null));};exports[_0x56d7('0x47')]=function(_0x34a71b,_0x3730fa){return db[_0x56d7('0x3f')][_0x56d7('0x47')](_0x34a71b['body'],{})[_0x56d7('0x23')](respondWithResult(_0x3730fa,0xc9))[_0x56d7('0x44')](handleError(_0x3730fa,null));};exports['describe']=function(_0x2b4b33,_0x2ebd80){return db['CmHopperHistory'][_0x56d7('0x48')]()[_0x56d7('0x23')](respondWithResult(_0x2ebd80,null))[_0x56d7('0x44')](handleError(_0x2ebd80,null));};exports[_0x56d7('0x22')]=function(_0x43b861,_0x3e9e02){if(_0x43b861['body'][_0x56d7('0x49')]){delete _0x43b861[_0x56d7('0x4a')]['uniqueid'];}return db[_0x56d7('0x3f')][_0x56d7('0x4b')]({'where':{'uniqueid':_0x43b861[_0x56d7('0x46')]['id']}})[_0x56d7('0x23')](handleEntityNotFound(_0x3e9e02,null))['then'](saveUpdates(_0x43b861[_0x56d7('0x4a')],null))[_0x56d7('0x23')](respondWithResult(_0x3e9e02,null))[_0x56d7('0x44')](handleError(_0x3e9e02,null));}; \ No newline at end of file +var _0xfd2e=['error','stack','send','index','CmHopperHistory','rawAttributes','fieldName','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','create','body','uniqueid','find','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x428d83,_0x177637){var _0x181681=function(_0x33a10d){while(--_0x33a10d){_0x428d83['push'](_0x428d83['shift']());}};_0x181681(++_0x177637);}(_0xfd2e,0x15d));var _0xefd2=function(_0x501d37,_0x5ded61){_0x501d37=_0x501d37-0x0;var _0x93b5fe=_0xfd2e[_0x501d37];return _0x93b5fe;};'use strict';var emlformat=require(_0xefd2('0x0'));var rimraf=require(_0xefd2('0x1'));var zipdir=require(_0xefd2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xefd2('0x3'));var BPromise=require(_0xefd2('0x4'));var Mustache=require('mustache');var util=require(_0xefd2('0x5'));var path=require(_0xefd2('0x6'));var sox=require(_0xefd2('0x7'));var csv=require(_0xefd2('0x8'));var ejs=require(_0xefd2('0x9'));var fs=require('fs');var fs_extra=require(_0xefd2('0xa'));var _=require(_0xefd2('0xb'));var squel=require(_0xefd2('0xc'));var crypto=require(_0xefd2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xefd2('0xe'));var toCsv=require(_0xefd2('0x8'));var querystring=require(_0xefd2('0xf'));var Papa=require(_0xefd2('0x10'));var Redis=require(_0xefd2('0x11'));var authService=require(_0xefd2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xefd2('0x13'));var hardwareService=require(_0xefd2('0x14'));var logger=require(_0xefd2('0x15'))(_0xefd2('0x16'));var utils=require(_0xefd2('0x17'));var config=require(_0xefd2('0x18'));var licenseUtil=require(_0xefd2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3471d0,_0x121350){_0x121350=_0x121350||0xcc;return function(_0x19c3ac){if(_0x19c3ac){return _0x3471d0['sendStatus'](_0x121350);}return _0x3471d0[_0xefd2('0x1a')](_0x121350)[_0xefd2('0x1b')]();};}function respondWithResult(_0x2fae46,_0x820aaf){_0x820aaf=_0x820aaf||0xc8;return function(_0x57324c){if(_0x57324c){return _0x2fae46[_0xefd2('0x1a')](_0x820aaf)[_0xefd2('0x1c')](_0x57324c);}};}function respondWithFilteredResult(_0x257dea,_0x7b3b05){return function(_0x42eef7){if(_0x42eef7){var _0xe848a6=typeof _0x7b3b05[_0xefd2('0x1d')]===_0xefd2('0x1e')&&typeof _0x7b3b05[_0xefd2('0x1f')]===_0xefd2('0x1e');var _0x4be2ec=_0x42eef7[_0xefd2('0x20')];var _0x2f9831=_0xe848a6?0x0:_0x7b3b05['offset'];var _0x48f3bb=_0xe848a6?_0x42eef7[_0xefd2('0x20')]:_0x7b3b05[_0xefd2('0x1d')]+_0x7b3b05[_0xefd2('0x1f')];var _0x12e3c2;if(_0x48f3bb>=_0x4be2ec){_0x48f3bb=_0x4be2ec;_0x12e3c2=0xc8;}else{_0x12e3c2=0xce;}_0x257dea[_0xefd2('0x1a')](_0x12e3c2);return _0x257dea['set'](_0xefd2('0x21'),_0x2f9831+'-'+_0x48f3bb+'/'+_0x4be2ec)[_0xefd2('0x1c')](_0x42eef7);}return null;};}function patchUpdates(_0x3909d1){return function(_0x236707){try{jsonpatch[_0xefd2('0x22')](_0x236707,_0x3909d1,!![]);}catch(_0x1b32f3){return BPromise[_0xefd2('0x23')](_0x1b32f3);}return _0x236707[_0xefd2('0x24')]();};}function saveUpdates(_0x5d4b36,_0x2fef06){return function(_0x101aac){if(_0x101aac){return _0x101aac[_0xefd2('0x25')](_0x5d4b36)[_0xefd2('0x26')](function(_0x360d53){return _0x360d53;});}return null;};}function removeEntity(_0x2d86fc,_0x25db7c){return function(_0x31a560){if(_0x31a560){return _0x31a560[_0xefd2('0x27')]()[_0xefd2('0x26')](function(){_0x2d86fc[_0xefd2('0x1a')](0xcc)[_0xefd2('0x1b')]();});}};}function handleEntityNotFound(_0xe1ca24,_0x1702f7){return function(_0x518800){if(!_0x518800){_0xe1ca24[_0xefd2('0x28')](0x194);}return _0x518800;};}function handleError(_0x475734,_0x5216c2){_0x5216c2=_0x5216c2||0x1f4;return function(_0x4f42b1){logger[_0xefd2('0x29')](_0x4f42b1[_0xefd2('0x2a')]);if(_0x4f42b1['name']){delete _0x4f42b1['name'];}_0x475734[_0xefd2('0x1a')](_0x5216c2)[_0xefd2('0x2b')](_0x4f42b1);};}exports[_0xefd2('0x2c')]=function(_0x3c28ff,_0x33172b){var _0x47f944={},_0x1599e2={},_0x5bcae3={'count':0x0,'rows':[]};var _0x4744ab=_['map'](db[_0xefd2('0x2d')][_0xefd2('0x2e')],function(_0x55cacf){return{'name':_0x55cacf[_0xefd2('0x2f')],'type':_0x55cacf['type'][_0xefd2('0x30')]};});_0x1599e2[_0xefd2('0x31')]=_[_0xefd2('0x32')](_0x4744ab,_0xefd2('0x33'));_0x1599e2[_0xefd2('0x34')]=_[_0xefd2('0x35')](_0x3c28ff[_0xefd2('0x34')]);_0x1599e2[_0xefd2('0x36')]=_[_0xefd2('0x37')](_0x1599e2[_0xefd2('0x31')],_0x1599e2[_0xefd2('0x34')]);_0x47f944[_0xefd2('0x38')]=_[_0xefd2('0x37')](_0x1599e2['model'],qs['fields'](_0x3c28ff[_0xefd2('0x34')][_0xefd2('0x39')]));_0x47f944[_0xefd2('0x38')]=_0x47f944[_0xefd2('0x38')][_0xefd2('0x3a')]?_0x47f944['attributes']:_0x1599e2[_0xefd2('0x31')];if(!_0x3c28ff[_0xefd2('0x34')][_0xefd2('0x3b')](_0xefd2('0x3c'))){_0x47f944[_0xefd2('0x1f')]=qs[_0xefd2('0x1f')](_0x3c28ff[_0xefd2('0x34')][_0xefd2('0x1f')]);_0x47f944[_0xefd2('0x1d')]=qs['offset'](_0x3c28ff[_0xefd2('0x34')][_0xefd2('0x1d')]);}_0x47f944[_0xefd2('0x3d')]=qs['sort'](_0x3c28ff[_0xefd2('0x34')]['sort']);_0x47f944[_0xefd2('0x3e')]=qs[_0xefd2('0x36')](_[_0xefd2('0x3f')](_0x3c28ff[_0xefd2('0x34')],_0x1599e2[_0xefd2('0x36')]),_0x4744ab);if(_0x3c28ff[_0xefd2('0x34')][_0xefd2('0x40')]){_0x47f944[_0xefd2('0x3e')]=_[_0xefd2('0x41')](_0x47f944[_0xefd2('0x3e')],{'$or':_[_0xefd2('0x32')](_0x4744ab,function(_0x4d9c70){if(_0x4d9c70['type']!==_0xefd2('0x42')){var _0x2a9111={};_0x2a9111[_0x4d9c70['name']]={'$like':'%'+_0x3c28ff[_0xefd2('0x34')][_0xefd2('0x40')]+'%'};return _0x2a9111;}})});}_0x47f944=_[_0xefd2('0x41')]({},_0x47f944,_0x3c28ff['options']);var _0x200660={'where':_0x47f944['where']};return db[_0xefd2('0x2d')][_0xefd2('0x20')](_0x200660)[_0xefd2('0x26')](function(_0x1faef2){_0x5bcae3[_0xefd2('0x20')]=_0x1faef2;if(_0x3c28ff[_0xefd2('0x34')][_0xefd2('0x43')]){_0x47f944[_0xefd2('0x44')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xefd2('0x45')](_0x47f944);})[_0xefd2('0x26')](function(_0x27a063){_0x5bcae3['rows']=_0x27a063;return _0x5bcae3;})[_0xefd2('0x26')](respondWithFilteredResult(_0x33172b,_0x47f944))[_0xefd2('0x46')](handleError(_0x33172b,null));};exports[_0xefd2('0x47')]=function(_0x120dac,_0x333c58){var _0x568ce7={'raw':!![],'where':{'id':_0x120dac[_0xefd2('0x48')]['id']}},_0x30791c={};_0x30791c[_0xefd2('0x31')]=_['keys'](db['CmHopperHistory'][_0xefd2('0x2e')]);_0x30791c[_0xefd2('0x34')]=_[_0xefd2('0x35')](_0x120dac[_0xefd2('0x34')]);_0x30791c['filters']=_[_0xefd2('0x37')](_0x30791c[_0xefd2('0x31')],_0x30791c[_0xefd2('0x34')]);_0x568ce7['attributes']=_[_0xefd2('0x37')](_0x30791c[_0xefd2('0x31')],qs[_0xefd2('0x39')](_0x120dac['query'][_0xefd2('0x39')]));_0x568ce7['attributes']=_0x568ce7[_0xefd2('0x38')][_0xefd2('0x3a')]?_0x568ce7[_0xefd2('0x38')]:_0x30791c['model'];if(_0x120dac['query'][_0xefd2('0x43')]){_0x568ce7['include']=[{'all':!![]}];}_0x568ce7=_[_0xefd2('0x41')]({},_0x568ce7,_0x120dac[_0xefd2('0x49')]);return db[_0xefd2('0x2d')]['find'](_0x568ce7)[_0xefd2('0x26')](handleEntityNotFound(_0x333c58,null))[_0xefd2('0x26')](respondWithResult(_0x333c58,null))[_0xefd2('0x46')](handleError(_0x333c58,null));};exports[_0xefd2('0x4a')]=function(_0x3f8b2e,_0x31d099){return db[_0xefd2('0x2d')][_0xefd2('0x4a')](_0x3f8b2e[_0xefd2('0x4b')],{})[_0xefd2('0x26')](respondWithResult(_0x31d099,0xc9))[_0xefd2('0x46')](handleError(_0x31d099,null));};exports['describe']=function(_0x332f35,_0x350474){return db[_0xefd2('0x2d')]['describe']()[_0xefd2('0x26')](respondWithResult(_0x350474,null))[_0xefd2('0x46')](handleError(_0x350474,null));};exports[_0xefd2('0x25')]=function(_0x486756,_0x5dadb7){if(_0x486756['body'][_0xefd2('0x4c')]){delete _0x486756[_0xefd2('0x4b')][_0xefd2('0x4c')];}return db[_0xefd2('0x2d')][_0xefd2('0x4d')]({'where':{'uniqueid':_0x486756[_0xefd2('0x48')]['id']}})[_0xefd2('0x26')](handleEntityNotFound(_0x5dadb7,null))['then'](saveUpdates(_0x486756[_0xefd2('0x4b')],null))[_0xefd2('0x26')](respondWithResult(_0x5dadb7,null))['catch'](handleError(_0x5dadb7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index a8e74c0..4dce31c 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 _0x0eeb=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0eeb[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var logger=require(_0xb0ee('0x2'))(_0xb0ee('0x3'));var moment=require(_0xb0ee('0x4'));var BPromise=require(_0xb0ee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb0ee('0x6'));var config=require(_0xb0ee('0x7'));var attributes=require(_0xb0ee('0x8'));module[_0xb0ee('0x9')]=function(_0x209dda,_0x453fa4){return _0x209dda[_0xb0ee('0xa')]('CmHopperHistory',attributes,{'tableName':_0xb0ee('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xb0ee('0xc')]},{'name':_0xb0ee('0xd'),'fields':[_0xb0ee('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9123=['uniqueid','lodash','moment','request-promise','path','rimraf','../../config/environment','exports','CmHopperHistory','cm_hopper_history','endtime'];(function(_0x2dfbc8,_0x54369d){var _0x106233=function(_0x39cf6d){while(--_0x39cf6d){_0x2dfbc8['push'](_0x2dfbc8['shift']());}};_0x106233(++_0x54369d);}(_0x9123,0x140));var _0x3912=function(_0x2b4771,_0x3bcf8e){_0x2b4771=_0x2b4771-0x0;var _0x34e206=_0x9123[_0x2b4771];return _0x34e206;};'use strict';var _=require(_0x3912('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3912('0x1'));var BPromise=require('bluebird');var rp=require(_0x3912('0x2'));var fs=require('fs');var path=require(_0x3912('0x3'));var rimraf=require(_0x3912('0x4'));var config=require(_0x3912('0x5'));var attributes=require('./cmHopperHistory.attributes');module[_0x3912('0x6')]=function(_0x4709e7,_0x487e17){return _0x4709e7['define'](_0x3912('0x7'),attributes,{'tableName':_0x3912('0x8'),'paranoid':![],'indexes':[{'name':_0x3912('0x9'),'fields':['endtime']},{'name':_0x3912('0xa'),'fields':[_0x3912('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 63bd510..a7d6041 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 _0x6f33=['error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','raw','then','findAll','options','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','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','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','ioredis','../../mysqldb','rpc','jayson/promise','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5229bc,_0x994a1){var _0x55d0df=function(_0x1a961c){while(--_0x1a961c){_0x5229bc['push'](_0x5229bc['shift']());}};_0x55d0df(++_0x994a1);}(_0x6f33,0x7a));var _0x36f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x36f3('0x0'));var util=require(_0x36f3('0x1'));var moment=require(_0x36f3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36f3('0x3'));var db=require(_0x36f3('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x36f3('0x5'));var config=require('../../config/environment');var jayson=require(_0x36f3('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x257b9f,_0x491b61,_0x4129b0){return new BPromise(function(_0x2645e3,_0x6f1cbb){return client[_0x36f3('0x7')](_0x257b9f,_0x4129b0)['then'](function(_0x383f82){logger[_0x36f3('0x8')](_0x36f3('0x9'),_0x491b61,_0x36f3('0xa'));logger[_0x36f3('0xb')](_0x36f3('0xc'),_0x491b61,_0x36f3('0xa'),JSON[_0x36f3('0xd')](_0x383f82));if(_0x383f82[_0x36f3('0xe')]){if(_0x383f82[_0x36f3('0xe')]['code']===0x1f4){logger[_0x36f3('0xe')](_0x36f3('0x9'),_0x491b61,_0x383f82['error'][_0x36f3('0xf')]);return _0x6f1cbb(_0x383f82['error'][_0x36f3('0xf')]);}logger[_0x36f3('0xe')](_0x36f3('0x9'),_0x491b61,_0x383f82[_0x36f3('0xe')][_0x36f3('0xf')]);return _0x2645e3(_0x383f82['error'][_0x36f3('0xf')]);}else{logger[_0x36f3('0x8')](_0x36f3('0x9'),_0x491b61,_0x36f3('0xa'));_0x2645e3(_0x383f82[_0x36f3('0x10')]['message']);}})[_0x36f3('0x11')](function(_0x411b0b){logger[_0x36f3('0xe')](_0x36f3('0x9'),_0x491b61,_0x411b0b);_0x6f1cbb(_0x411b0b);});});}exports[_0x36f3('0x12')]=function(_0x2cc9ea){var _0x4d2f7f=this;return new Promise(function(_0x232fd3,_0x227a29){return db[_0x36f3('0x13')][_0x36f3('0x14')](_0x2cc9ea[_0x36f3('0x15')],{'raw':_0x2cc9ea['options']?_0x2cc9ea['options'][_0x36f3('0x16')]===undefined?!![]:![]:!![]})[_0x36f3('0x17')](function(_0x402dc8){logger[_0x36f3('0x8')](_0x36f3('0x12'),_0x2cc9ea);logger[_0x36f3('0xb')](_0x36f3('0x12'),_0x2cc9ea,JSON['stringify'](_0x402dc8));_0x232fd3(_0x402dc8);})['catch'](function(_0x57d1c2){logger['error'](_0x36f3('0x12'),_0x57d1c2['message'],_0x2cc9ea);_0x227a29(_0x4d2f7f[_0x36f3('0xe')](0x1f4,_0x57d1c2[_0x36f3('0xf')]));});});};exports['AvgHandleTime']=function(_0x4c45eb){var _0x4325b8=this;return new Promise(function(_0x56ac46,_0x256f53){return db[_0x36f3('0x13')][_0x36f3('0x18')]({'raw':_0x4c45eb[_0x36f3('0x19')]?_0x4c45eb['options'][_0x36f3('0x16')]===undefined?!![]:![]:!![],'where':_0x4c45eb['options']?_0x4c45eb[_0x36f3('0x19')][_0x36f3('0x1a')]||null:null,'attributes':[[db[_0x36f3('0x1b')]['fn']('COUNT',db['sequelize'][_0x36f3('0x1c')]('id')),_0x36f3('0x1d')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db['sequelize'][_0x36f3('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')]('`state`\x20=\x2010,\x201,\x20null'))),_0x36f3('0x20')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')]('`state`\x20=\x2011,\x201,\x20null'))),_0x36f3('0x21')],[db['sequelize']['fn'](_0x36f3('0x22'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x36f3('0x23')],[db[_0x36f3('0x1b')]['fn']('AVG',db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')](_0x36f3('0x24')))),_0x36f3('0x25')]]})[_0x36f3('0x17')](function(_0x36f189){logger[_0x36f3('0x8')](_0x36f3('0x26'),_0x4c45eb);logger[_0x36f3('0xb')](_0x36f3('0x26'),_0x4c45eb,JSON[_0x36f3('0xd')](_0x36f189));_0x56ac46(_0x36f189);})[_0x36f3('0x11')](function(_0x176989){logger[_0x36f3('0xe')](_0x36f3('0x26'),_0x176989['message'],_0x4c45eb);_0x256f53(_0x4325b8[_0x36f3('0xe')](0x1f4,_0x176989['message']));});});};exports[_0x36f3('0x27')]=function(_0x2b7756){var _0x33bf3c=this;return new Promise(function(_0x35bfdd,_0x43a0bb){return db[_0x36f3('0x13')][_0x36f3('0x18')]({'raw':_0x2b7756['options']?_0x2b7756['options']['raw']===undefined?!![]:![]:!![],'where':_0x2b7756[_0x36f3('0x19')]?_0x2b7756[_0x36f3('0x19')]['where']||null:null,'attributes':[[_0x36f3('0x28'),_0x36f3('0x29')],[db[_0x36f3('0x1b')]['fn']('COUNT',db[_0x36f3('0x1b')]['fn']('IF',db['sequelize'][_0x36f3('0x1f')]('`state`\x20=\x200,\x201,\x20null'))),_0x36f3('0x2a')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db['sequelize']['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')](_0x36f3('0x2b')))),_0x36f3('0x2c')],[db[_0x36f3('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x36f3('0x1f')](_0x36f3('0x2d')))),_0x36f3('0x2e')],[db[_0x36f3('0x1b')]['fn']('COUNT',db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')](_0x36f3('0x2f')))),_0x36f3('0x30')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x36f3('0x31')))),'outboundCongestionCallsDay'],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db['sequelize'][_0x36f3('0x1f')](_0x36f3('0x32')))),_0x36f3('0x33')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')](_0x36f3('0x34')))),_0x36f3('0x35')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db['sequelize'][_0x36f3('0x1f')](_0x36f3('0x36')))),_0x36f3('0x37')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')](_0x36f3('0x38')))),'outboundBlacklistCallsDay'],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')](_0x36f3('0x39')))),_0x36f3('0x3a')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')](_0x36f3('0x3b')))),_0x36f3('0x3c')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')]('`state`\x20=\x2016,\x201,\x20null'))),_0x36f3('0x3d')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db[_0x36f3('0x1b')]['literal'](_0x36f3('0x3e')))),'outboundRejectCallsDay'],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db['sequelize']['fn']('IF',db[_0x36f3('0x1b')][_0x36f3('0x1f')](_0x36f3('0x3f')))),_0x36f3('0x40')]],'group':['campaign']})[_0x36f3('0x17')](function(_0x167170){logger[_0x36f3('0x8')](_0x36f3('0x27'),_0x2b7756);logger[_0x36f3('0xb')](_0x36f3('0x27'),_0x2b7756,JSON[_0x36f3('0xd')](_0x167170));_0x35bfdd(_0x167170);})[_0x36f3('0x11')](function(_0x2c9fc4){logger['error'](_0x36f3('0x27'),_0x2c9fc4[_0x36f3('0xf')],_0x2b7756);_0x43a0bb(_0x33bf3c[_0x36f3('0xe')](0x1f4,_0x2c9fc4[_0x36f3('0xf')]));});});};exports[_0x36f3('0x41')]=function(_0x3ef01a){var _0x189b86=this;return new Promise(function(_0x144d88,_0x2473b9){return db[_0x36f3('0x13')]['findAll']({'raw':_0x3ef01a[_0x36f3('0x19')]?_0x3ef01a['options'][_0x36f3('0x16')]===undefined?!![]:![]:!![],'where':_0x3ef01a[_0x36f3('0x19')]?_0x3ef01a[_0x36f3('0x19')]['where']||null:null,'attributes':[[_0x36f3('0x28'),_0x36f3('0x29')],[db[_0x36f3('0x1b')]['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['col']('id')),_0x36f3('0x42')],[db['sequelize']['fn'](_0x36f3('0x1e'),db[_0x36f3('0x1b')]['fn']('IF',db['sequelize'][_0x36f3('0x1f')](_0x36f3('0x2d')))),_0x36f3('0x43')]],'group':[_0x36f3('0x28')]})[_0x36f3('0x17')](function(_0x2ec8fd){logger['info'](_0x36f3('0x41'),_0x3ef01a);logger[_0x36f3('0xb')](_0x36f3('0x41'),_0x3ef01a,JSON[_0x36f3('0xd')](_0x2ec8fd));_0x144d88(_0x2ec8fd);})[_0x36f3('0x11')](function(_0x5d0911){logger[_0x36f3('0xe')](_0x36f3('0x41'),_0x5d0911['message'],_0x3ef01a);_0x2473b9(_0x189b86[_0x36f3('0xe')](0x1f4,_0x5d0911[_0x36f3('0xf')]));});});}; \ No newline at end of file +var _0x3eec=['result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','stringify','AvgHandleTime','findAll','where','sequelize','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','col','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','CmHopperHistory,\x20%s,\x20%s','info'];(function(_0x48d299,_0x401a53){var _0x339aa7=function(_0x3942ec){while(--_0x3942ec){_0x48d299['push'](_0x48d299['shift']());}};_0x339aa7(++_0x401a53);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x5b52b6,_0x1617ff){_0x5b52b6=_0x5b52b6-0x0;var _0x559cd2=_0x3eec[_0x5b52b6];return _0x559cd2;};'use strict';var _=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var moment=require(_0xc3ee('0x2'));var BPromise=require(_0xc3ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3ee('0x4'));var db=require(_0xc3ee('0x5'))['db'];var utils=require(_0xc3ee('0x6'));var logger=require(_0xc3ee('0x7'))(_0xc3ee('0x8'));var config=require(_0xc3ee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc3ee('0xa')][_0xc3ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xea4318,_0x2cc750,_0x356374){return new BPromise(function(_0x3d74c0,_0xd88f6){return client[_0xc3ee('0xc')](_0xea4318,_0x356374)[_0xc3ee('0xd')](function(_0x23e9c0){logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x2cc750,_0xc3ee('0xe'));logger[_0xc3ee('0xf')](_0xc3ee('0x10'),_0x2cc750,_0xc3ee('0xe'),JSON['stringify'](_0x23e9c0));if(_0x23e9c0[_0xc3ee('0x11')]){if(_0x23e9c0['error'][_0xc3ee('0x12')]===0x1f4){logger[_0xc3ee('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x2cc750,_0x23e9c0['error'][_0xc3ee('0x13')]);return _0xd88f6(_0x23e9c0['error'][_0xc3ee('0x13')]);}logger['error'](_0xc3ee('0x14'),_0x2cc750,_0x23e9c0['error'][_0xc3ee('0x13')]);return _0x3d74c0(_0x23e9c0[_0xc3ee('0x11')][_0xc3ee('0x13')]);}else{logger[_0xc3ee('0x15')](_0xc3ee('0x14'),_0x2cc750,_0xc3ee('0xe'));_0x3d74c0(_0x23e9c0[_0xc3ee('0x16')]['message']);}})[_0xc3ee('0x17')](function(_0x4eea89){logger[_0xc3ee('0x11')](_0xc3ee('0x14'),_0x2cc750,_0x4eea89);_0xd88f6(_0x4eea89);});});}exports[_0xc3ee('0x18')]=function(_0x219db0){var _0x304889=this;return new Promise(function(_0x3acb0c,_0xd4b414){return db[_0xc3ee('0x19')][_0xc3ee('0x1a')](_0x219db0[_0xc3ee('0x1b')],{'raw':_0x219db0[_0xc3ee('0x1c')]?_0x219db0[_0xc3ee('0x1c')][_0xc3ee('0x1d')]===undefined?!![]:![]:!![]})[_0xc3ee('0xd')](function(_0x3e7224){logger[_0xc3ee('0x15')](_0xc3ee('0x18'),_0x219db0);logger[_0xc3ee('0xf')](_0xc3ee('0x18'),_0x219db0,JSON[_0xc3ee('0x1e')](_0x3e7224));_0x3acb0c(_0x3e7224);})[_0xc3ee('0x17')](function(_0x493fea){logger['error'](_0xc3ee('0x18'),_0x493fea[_0xc3ee('0x13')],_0x219db0);_0xd4b414(_0x304889[_0xc3ee('0x11')](0x1f4,_0x493fea[_0xc3ee('0x13')]));});});};exports[_0xc3ee('0x1f')]=function(_0x238df7){var _0x57ab05=this;return new Promise(function(_0x450cd1,_0x3f8f7b){return db[_0xc3ee('0x19')][_0xc3ee('0x20')]({'raw':_0x238df7[_0xc3ee('0x1c')]?_0x238df7['options']['raw']===undefined?!![]:![]:!![],'where':_0x238df7[_0xc3ee('0x1c')]?_0x238df7[_0xc3ee('0x1c')][_0xc3ee('0x21')]||null:null,'attributes':[[db[_0xc3ee('0x22')]['fn'](_0xc3ee('0x23'),db['sequelize']['col']('id')),'predictiveIntervalTotalCalls'],[db[_0xc3ee('0x22')]['fn'](_0xc3ee('0x23'),db[_0xc3ee('0x22')]['fn']('IF',db[_0xc3ee('0x22')][_0xc3ee('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0xc3ee('0x25')],[db[_0xc3ee('0x22')]['fn'](_0xc3ee('0x23'),db[_0xc3ee('0x22')]['fn']('IF',db[_0xc3ee('0x22')][_0xc3ee('0x24')](_0xc3ee('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xc3ee('0x22')]['fn'](_0xc3ee('0x23'),db[_0xc3ee('0x22')]['fn']('IF',db['sequelize'][_0xc3ee('0x24')](_0xc3ee('0x27')))),_0xc3ee('0x28')],[db[_0xc3ee('0x22')]['fn'](_0xc3ee('0x29'),db[_0xc3ee('0x22')]['fn']('IF',db[_0xc3ee('0x22')]['literal'](_0xc3ee('0x2a')))),'predictiveIntervalAvgHoldtime'],[db[_0xc3ee('0x22')]['fn'](_0xc3ee('0x29'),db[_0xc3ee('0x22')]['fn']('IF',db[_0xc3ee('0x22')][_0xc3ee('0x24')](_0xc3ee('0x2b')))),'predictiveIntervalAvgTalktime']]})[_0xc3ee('0xd')](function(_0x3f2e5a){logger[_0xc3ee('0x15')](_0xc3ee('0x1f'),_0x238df7);logger[_0xc3ee('0xf')](_0xc3ee('0x1f'),_0x238df7,JSON[_0xc3ee('0x1e')](_0x3f2e5a));_0x450cd1(_0x3f2e5a);})[_0xc3ee('0x17')](function(_0x3ccd60){logger[_0xc3ee('0x11')](_0xc3ee('0x1f'),_0x3ccd60[_0xc3ee('0x13')],_0x238df7);_0x3f8f7b(_0x57ab05[_0xc3ee('0x11')](0x1f4,_0x3ccd60[_0xc3ee('0x13')]));});});};exports[_0xc3ee('0x2c')]=function(_0x2d1fd0){var _0x3c9f2c=this;return new Promise(function(_0x3a1bd0,_0x22cefe){return db[_0xc3ee('0x19')][_0xc3ee('0x20')]({'raw':_0x2d1fd0['options']?_0x2d1fd0[_0xc3ee('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2d1fd0[_0xc3ee('0x1c')]?_0x2d1fd0[_0xc3ee('0x1c')][_0xc3ee('0x21')]||null:null,'attributes':[[_0xc3ee('0x2d'),_0xc3ee('0x2e')],[db[_0xc3ee('0x22')]['fn']('COUNT',db[_0xc3ee('0x22')]['fn']('IF',db[_0xc3ee('0x22')][_0xc3ee('0x24')]('`state`\x20=\x200,\x201,\x20null'))),_0xc3ee('0x2f')],[db[_0xc3ee('0x22')]['fn'](_0xc3ee('0x23'),db[_0xc3ee('0x22')]['fn']('IF',db[_0xc3ee('0x22')][_0xc3ee('0x24')](_0xc3ee('0x30')))),_0xc3ee('0x31')],[db[_0xc3ee('0x22')]['fn'](_0xc3ee('0x23'),db[_0xc3ee('0x22')]['fn']('IF',db['sequelize'][_0xc3ee('0x24')](_0xc3ee('0x32')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0xc3ee('0x23'),db[_0xc3ee('0x22')]['fn']('IF',db[_0xc3ee('0x22')]['literal'](_0xc3ee('0x33')))),_0xc3ee('0x34')],[db[_0xc3ee('0x22')]['fn'](_0xc3ee('0x23'),db[_0xc3ee('0x22')]['fn']('IF',db[_0xc3ee('0x22')][_0xc3ee('0x24')](_0xc3ee('0x35')))),_0xc3ee('0x36')],[db[_0xc3ee('0x22')]['fn'](_0xc3ee('0x23'),db[_0xc3ee('0x22')]['fn']('IF',db[_0xc3ee('0x22')][_0xc3ee('0x24')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xc3ee('0x37')],[db['sequelize']['fn']('COUNT',db[_0xc3ee('0x22')]['fn']('IF',db[_0xc3ee('0x22')]['literal'](_0xc3ee('0x38')))),_0xc3ee('0x39')],[db['sequelize']['fn'](_0xc3ee('0x23'),db['sequelize']['fn']('IF',db[_0xc3ee('0x22')]['literal'](_0xc3ee('0x3a')))),_0xc3ee('0x3b')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xc3ee('0x22')][_0xc3ee('0x24')](_0xc3ee('0x3c')))),_0xc3ee('0x3d')],[db[_0xc3ee('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xc3ee('0x22')][_0xc3ee('0x24')]('`state`\x20=\x2014,\x201,\x20null'))),_0xc3ee('0x3e')],[db['sequelize']['fn'](_0xc3ee('0x23'),db['sequelize']['fn']('IF',db[_0xc3ee('0x22')][_0xc3ee('0x24')](_0xc3ee('0x3f')))),_0xc3ee('0x40')],[db[_0xc3ee('0x22')]['fn'](_0xc3ee('0x23'),db[_0xc3ee('0x22')]['fn']('IF',db['sequelize'][_0xc3ee('0x24')](_0xc3ee('0x41')))),_0xc3ee('0x42')],[db[_0xc3ee('0x22')]['fn']('COUNT',db[_0xc3ee('0x22')]['fn']('IF',db[_0xc3ee('0x22')][_0xc3ee('0x24')](_0xc3ee('0x43')))),_0xc3ee('0x40')],[db[_0xc3ee('0x22')]['fn'](_0xc3ee('0x23'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xc3ee('0x44')]],'group':[_0xc3ee('0x2d')]})[_0xc3ee('0xd')](function(_0x2b9ea){logger[_0xc3ee('0x15')]('GetVoiceQueueHopperHistory',_0x2d1fd0);logger['debug'](_0xc3ee('0x2c'),_0x2d1fd0,JSON['stringify'](_0x2b9ea));_0x3a1bd0(_0x2b9ea);})[_0xc3ee('0x17')](function(_0x28eca9){logger[_0xc3ee('0x11')]('GetVoiceQueueHopperHistory',_0x28eca9[_0xc3ee('0x13')],_0x2d1fd0);_0x22cefe(_0x3c9f2c[_0xc3ee('0x11')](0x1f4,_0x28eca9[_0xc3ee('0x13')]));});});};exports[_0xc3ee('0x45')]=function(_0x29d98e){var _0x343018=this;return new Promise(function(_0x44e8fe,_0x2ff728){return db[_0xc3ee('0x19')]['findAll']({'raw':_0x29d98e[_0xc3ee('0x1c')]?_0x29d98e[_0xc3ee('0x1c')][_0xc3ee('0x1d')]===undefined?!![]:![]:!![],'where':_0x29d98e[_0xc3ee('0x1c')]?_0x29d98e[_0xc3ee('0x1c')][_0xc3ee('0x21')]||null:null,'attributes':[[_0xc3ee('0x2d'),_0xc3ee('0x2e')],[db[_0xc3ee('0x22')]['fn'](_0xc3ee('0x23'),db[_0xc3ee('0x22')][_0xc3ee('0x46')]('id')),_0xc3ee('0x47')],[db['sequelize']['fn'](_0xc3ee('0x23'),db[_0xc3ee('0x22')]['fn']('IF',db[_0xc3ee('0x22')][_0xc3ee('0x24')](_0xc3ee('0x32')))),_0xc3ee('0x48')]],'group':['campaign']})[_0xc3ee('0xd')](function(_0xca7710){logger[_0xc3ee('0x15')](_0xc3ee('0x45'),_0x29d98e);logger[_0xc3ee('0xf')](_0xc3ee('0x45'),_0x29d98e,JSON[_0xc3ee('0x1e')](_0xca7710));_0x44e8fe(_0xca7710);})[_0xc3ee('0x17')](function(_0x18cb21){logger[_0xc3ee('0x11')](_0xc3ee('0x45'),_0x18cb21[_0xc3ee('0x13')],_0x29d98e);_0x2ff728(_0x343018[_0xc3ee('0x11')](0x1f4,_0x18cb21['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 47ec209..9b8e71f 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 _0x758e=['/:id','show','create','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','describe'];(function(_0x4dff4b,_0x253318){var _0x490467=function(_0x462b18){while(--_0x462b18){_0x4dff4b['push'](_0x4dff4b['shift']());}};_0x490467(++_0x253318);}(_0x758e,0x78));var _0xe758=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x758e[_0x3b380d];return _0x54502b;};'use strict';var multer=require('multer');var util=require(_0xe758('0x0'));var path=require(_0xe758('0x1'));var timeout=require(_0xe758('0x2'));var express=require(_0xe758('0x3'));var router=express[_0xe758('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe758('0x5'));var interaction=require(_0xe758('0x6'));var config=require(_0xe758('0x7'));var controller=require(_0xe758('0x8'));router['get']('/',auth[_0xe758('0x9')](),controller[_0xe758('0xa')]);router[_0xe758('0xb')]('/describe',auth[_0xe758('0x9')](),controller[_0xe758('0xc')]);router[_0xe758('0xb')](_0xe758('0xd'),auth['isAuthenticated'](),controller[_0xe758('0xe')]);router['post']('/',auth[_0xe758('0x9')](),controller[_0xe758('0xf')]);router[_0xe758('0x10')](_0xe758('0xd'),auth[_0xe758('0x9')](),controller[_0xe758('0x11')]);module[_0xe758('0x12')]=router; \ No newline at end of file +var _0x84cd=['multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','isAuthenticated','get','/describe','describe','post','put','/:id','exports'];(function(_0x3e7818,_0xa326f8){var _0x216f7e=function(_0x5c20d1){while(--_0x5c20d1){_0x3e7818['push'](_0x3e7818['shift']());}};_0x216f7e(++_0xa326f8);}(_0x84cd,0x69));var _0xd84c=function(_0x39677e,_0x3cd6de){_0x39677e=_0x39677e-0x0;var _0x5e083a=_0x84cd[_0x39677e];return _0x5e083a;};'use strict';var multer=require(_0xd84c('0x0'));var util=require(_0xd84c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd84c('0x2'));var router=express[_0xd84c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd84c('0x4'));var interaction=require(_0xd84c('0x5'));var config=require('../../config/environment');var controller=require(_0xd84c('0x6'));router['get']('/',auth[_0xd84c('0x7')](),controller['index']);router[_0xd84c('0x8')](_0xd84c('0x9'),auth[_0xd84c('0x7')](),controller[_0xd84c('0xa')]);router[_0xd84c('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd84c('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd84c('0xc')](_0xd84c('0xd'),auth[_0xd84c('0x7')](),controller['update']);module[_0xd84c('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index c645532..a87c589 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 _0x3248=['sequelize','exports','STRING','name'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x3248,0x1b0));var _0x8324=function(_0xa1f2e4,_0x1001a7){_0xa1f2e4=_0xa1f2e4-0x0;var _0x26db53=_0x3248[_0xa1f2e4];return _0x26db53;};'use strict';var Sequelize=require(_0x8324('0x0'));module[_0x8324('0x1')]={'name':{'type':Sequelize[_0x8324('0x2')],'unique':_0x8324('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8324('0x2')]},'dialPrefix':{'type':Sequelize[_0x8324('0x2')]}}; \ No newline at end of file +var _0xa41a=['exports','name','STRING','sequelize'];(function(_0x377742,_0x38a71d){var _0x213d07=function(_0x4b6666){while(--_0x4b6666){_0x377742['push'](_0x377742['shift']());}};_0x213d07(++_0x38a71d);}(_0xa41a,0x6b));var _0xaa41=function(_0x51e16b,_0x4b3b1b){_0x51e16b=_0x51e16b-0x0;var _0x35f9d7=_0xa41a[_0x51e16b];return _0x35f9d7;};'use strict';var Sequelize=require(_0xaa41('0x0'));module[_0xaa41('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xaa41('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaa41('0x3')]},'dialPrefix':{'type':Sequelize[_0xaa41('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 70b6a85..5725f69 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 _0xee38=['sox','to-csv','fs-extra','lodash','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','redis','defaults','socket.io-emitter','./cmList.socket','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','save','update','then','get','Lists','UserProfileResource','error','name','send','index','map','CmList','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','keys','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','ListId','getDispositions','Disposition','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','omit','dataValues','errors','push','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','format','cf_%d','hasOwnProperty','getContactsCsv','concat','raw','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','text/csv','download','addCustomFields','TEXT','text','Sequelize','number','switch','BOOLEAN','sequelize','queryInterface','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','userCmList:save','removeAgents','userCmList:remove','emit','findOne','User','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x457ed4,_0x243411){var _0x4616d5=function(_0x386b01){while(--_0x386b01){_0x457ed4['push'](_0x457ed4['shift']());}};_0x4616d5(++_0x243411);}(_0xee38,0x190));var _0x8ee3=function(_0x1af7e5,_0x21afdb){_0x1af7e5=_0x1af7e5-0x0;var _0x16651f=_0xee38[_0x1af7e5];return _0x16651f;};'use strict';var emlformat=require(_0x8ee3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ee3('0x1'));var jsonpatch=require(_0x8ee3('0x2'));var rp=require(_0x8ee3('0x3'));var moment=require(_0x8ee3('0x4'));var BPromise=require(_0x8ee3('0x5'));var Mustache=require(_0x8ee3('0x6'));var util=require(_0x8ee3('0x7'));var path=require('path');var sox=require(_0x8ee3('0x8'));var csv=require(_0x8ee3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ee3('0xa'));var _=require(_0x8ee3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8ee3('0xc'));var toCsv=require(_0x8ee3('0x9'));var querystring=require(_0x8ee3('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8ee3('0xe'));var qs=require(_0x8ee3('0xf'));var as=require(_0x8ee3('0x10'));var hardwareService=require(_0x8ee3('0x11'));var logger=require('../../config/logger')(_0x8ee3('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x8ee3('0x13')]=_[_0x8ee3('0x14')](config[_0x8ee3('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x8ee3('0x15'))(new Redis(config[_0x8ee3('0x13')]));require(_0x8ee3('0x16'))['register'](socket);function respondWithStatusCode(_0x19a31c,_0x50d639){_0x50d639=_0x50d639||0xcc;return function(_0x27f1c5){if(_0x27f1c5){return _0x19a31c[_0x8ee3('0x17')](_0x50d639);}return _0x19a31c[_0x8ee3('0x18')](_0x50d639)[_0x8ee3('0x19')]();};}function respondWithResult(_0x1a2373,_0x24a764){_0x24a764=_0x24a764||0xc8;return function(_0x5e5923){if(_0x5e5923){return _0x1a2373[_0x8ee3('0x18')](_0x24a764)['json'](_0x5e5923);}};}function respondWithFilteredResult(_0x3c1161,_0x1c5171){return function(_0x358985){if(_0x358985){var _0x53e8dc=typeof _0x1c5171['offset']===_0x8ee3('0x1a')&&typeof _0x1c5171[_0x8ee3('0x1b')]===_0x8ee3('0x1a');var _0x3cea28=_0x358985[_0x8ee3('0x1c')];var _0x51c27a=_0x53e8dc?0x0:_0x1c5171[_0x8ee3('0x1d')];var _0x428850=_0x53e8dc?_0x358985[_0x8ee3('0x1c')]:_0x1c5171[_0x8ee3('0x1d')]+_0x1c5171[_0x8ee3('0x1b')];var _0x26b201;if(_0x428850>=_0x3cea28){_0x428850=_0x3cea28;_0x26b201=0xc8;}else{_0x26b201=0xce;}_0x3c1161[_0x8ee3('0x18')](_0x26b201);return _0x3c1161[_0x8ee3('0x1e')]('Content-Range',_0x51c27a+'-'+_0x428850+'/'+_0x3cea28)[_0x8ee3('0x1f')](_0x358985);}return null;};}function patchUpdates(_0x55f001){return function(_0xd21716){try{jsonpatch[_0x8ee3('0x20')](_0xd21716,_0x55f001,!![]);}catch(_0x421257){return BPromise['reject'](_0x421257);}return _0xd21716[_0x8ee3('0x21')]();};}function saveUpdates(_0x5c8e6f,_0x3ccf7d){return function(_0x4a36dd){if(_0x4a36dd){return _0x4a36dd[_0x8ee3('0x22')](_0x5c8e6f)['then'](function(_0x3b03b2){return _0x3b03b2;});}return null;};}function removeEntity(_0x2b05eb,_0x2e3e30){return function(_0x2066ed){if(_0x2066ed){return _0x2066ed['destroy']()[_0x8ee3('0x23')](function(){var _0x3b68f7=_0x2066ed[_0x8ee3('0x24')]({'plain':!![]});var _0xe80ae2=_0x8ee3('0x25');return db[_0x8ee3('0x26')]['destroy']({'where':{'type':_0xe80ae2,'resourceId':_0x3b68f7['id']}})[_0x8ee3('0x23')](function(){return _0x2066ed;});})[_0x8ee3('0x23')](function(){_0x2b05eb[_0x8ee3('0x18')](0xcc)[_0x8ee3('0x19')]();});}};}function handleEntityNotFound(_0x17295e,_0x984381){return function(_0x140b1d){if(!_0x140b1d){_0x17295e[_0x8ee3('0x17')](0x194);}return _0x140b1d;};}function handleError(_0x15d4f0,_0x3cd928){_0x3cd928=_0x3cd928||0x1f4;return function(_0x37734c){logger[_0x8ee3('0x27')](_0x37734c['stack']);if(_0x37734c[_0x8ee3('0x28')]){delete _0x37734c[_0x8ee3('0x28')];}_0x15d4f0[_0x8ee3('0x18')](_0x3cd928)[_0x8ee3('0x29')](_0x37734c);};}exports[_0x8ee3('0x2a')]=function(_0x1fc5dd,_0x52b9b5){var _0x500752={},_0x2653d1={},_0x4330f8={'count':0x0,'rows':[]};var _0x4b99cc=_[_0x8ee3('0x2b')](db[_0x8ee3('0x2c')][_0x8ee3('0x2d')],function(_0x543be4){return{'name':_0x543be4[_0x8ee3('0x2e')],'type':_0x543be4[_0x8ee3('0x2f')]['key']};});_0x2653d1[_0x8ee3('0x30')]=_[_0x8ee3('0x2b')](_0x4b99cc,_0x8ee3('0x28'));_0x2653d1[_0x8ee3('0x31')]=_['keys'](_0x1fc5dd['query']);_0x2653d1[_0x8ee3('0x32')]=_[_0x8ee3('0x33')](_0x2653d1[_0x8ee3('0x30')],_0x2653d1[_0x8ee3('0x31')]);_0x500752[_0x8ee3('0x34')]=_[_0x8ee3('0x33')](_0x2653d1['model'],qs[_0x8ee3('0x35')](_0x1fc5dd[_0x8ee3('0x31')][_0x8ee3('0x35')]));_0x500752[_0x8ee3('0x34')]=_0x500752['attributes'][_0x8ee3('0x36')]?_0x500752['attributes']:_0x2653d1[_0x8ee3('0x30')];if(!_0x1fc5dd[_0x8ee3('0x31')]['hasOwnProperty'](_0x8ee3('0x37'))){_0x500752[_0x8ee3('0x1b')]=qs['limit'](_0x1fc5dd[_0x8ee3('0x31')]['limit']);_0x500752[_0x8ee3('0x1d')]=qs[_0x8ee3('0x1d')](_0x1fc5dd['query']['offset']);}_0x500752[_0x8ee3('0x38')]=qs['sort'](_0x1fc5dd['query'][_0x8ee3('0x39')]);_0x500752[_0x8ee3('0x3a')]=qs[_0x8ee3('0x32')](_[_0x8ee3('0x3b')](_0x1fc5dd[_0x8ee3('0x31')],_0x2653d1[_0x8ee3('0x32')]),_0x4b99cc);if(_0x1fc5dd[_0x8ee3('0x31')][_0x8ee3('0x3c')]){_0x500752[_0x8ee3('0x3a')]=_[_0x8ee3('0x3d')](_0x500752['where'],{'$or':_[_0x8ee3('0x2b')](_0x4b99cc,function(_0x2b2ba2){if(_0x2b2ba2[_0x8ee3('0x2f')]!==_0x8ee3('0x3e')){var _0x50aaea={};_0x50aaea[_0x2b2ba2[_0x8ee3('0x28')]]={'$like':'%'+_0x1fc5dd[_0x8ee3('0x31')][_0x8ee3('0x3c')]+'%'};return _0x50aaea;}})});}_0x500752=_[_0x8ee3('0x3d')]({},_0x500752,_0x1fc5dd[_0x8ee3('0x3f')]);var _0x19285d={'where':_0x500752[_0x8ee3('0x3a')]};return db['CmList'][_0x8ee3('0x1c')](_0x19285d)[_0x8ee3('0x23')](function(_0x4aa415){_0x4330f8[_0x8ee3('0x1c')]=_0x4aa415;if(_0x1fc5dd[_0x8ee3('0x31')][_0x8ee3('0x40')]){_0x500752['include']=[{'all':!![]}];}return db[_0x8ee3('0x2c')]['findAll'](_0x500752);})[_0x8ee3('0x23')](function(_0x5b492f){_0x4330f8[_0x8ee3('0x41')]=_0x5b492f;return _0x4330f8;})['then'](respondWithFilteredResult(_0x52b9b5,_0x500752))[_0x8ee3('0x42')](handleError(_0x52b9b5,null));};exports[_0x8ee3('0x43')]=function(_0x512a4b,_0x293b3e){var _0x5baf72={'raw':![],'where':{'id':_0x512a4b[_0x8ee3('0x44')]['id']}},_0x5541b1={};_0x5541b1['model']=_[_0x8ee3('0x45')](db[_0x8ee3('0x2c')][_0x8ee3('0x2d')]);_0x5541b1['query']=_[_0x8ee3('0x45')](_0x512a4b[_0x8ee3('0x31')]);_0x5541b1[_0x8ee3('0x32')]=_['intersection'](_0x5541b1[_0x8ee3('0x30')],_0x5541b1[_0x8ee3('0x31')]);_0x5baf72['attributes']=_[_0x8ee3('0x33')](_0x5541b1['model'],qs[_0x8ee3('0x35')](_0x512a4b[_0x8ee3('0x31')][_0x8ee3('0x35')]));_0x5baf72[_0x8ee3('0x34')]=_0x5baf72[_0x8ee3('0x34')]['length']?_0x5baf72['attributes']:_0x5541b1[_0x8ee3('0x30')];if(_0x512a4b['query'][_0x8ee3('0x40')]){_0x5baf72['include']=[{'all':!![]}];}_0x5baf72=_[_0x8ee3('0x3d')]({},_0x5baf72,_0x512a4b['options']);return db[_0x8ee3('0x2c')][_0x8ee3('0x46')](_0x5baf72)[_0x8ee3('0x23')](handleEntityNotFound(_0x293b3e,null))['then'](respondWithResult(_0x293b3e,null))[_0x8ee3('0x42')](handleError(_0x293b3e,null));};exports[_0x8ee3('0x47')]=function(_0x3c1b74,_0x38af81){return db[_0x8ee3('0x2c')][_0x8ee3('0x47')](_0x3c1b74[_0x8ee3('0x48')],{})[_0x8ee3('0x23')](function(_0xe9acf6){var _0x3ccc26=_0x3c1b74[_0x8ee3('0x49')][_0x8ee3('0x24')]({'plain':!![]});if(!_0x3ccc26)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ccc26[_0x8ee3('0x4a')]===_0x8ee3('0x49')){var _0x1dd9a3=_0xe9acf6[_0x8ee3('0x24')]({'plain':!![]});var _0x3ced57=_0x8ee3('0x25');return db[_0x8ee3('0x4b')][_0x8ee3('0x46')]({'where':{'name':_0x3ced57,'userProfileId':_0x3ccc26[_0x8ee3('0x4c')]},'raw':!![]})[_0x8ee3('0x23')](function(_0xae4673){if(_0xae4673&&_0xae4673['autoAssociation']===0x0){return db[_0x8ee3('0x26')][_0x8ee3('0x47')]({'name':_0x1dd9a3['name'],'resourceId':_0x1dd9a3['id'],'type':_0xae4673[_0x8ee3('0x28')],'sectionId':_0xae4673['id']},{})[_0x8ee3('0x23')](function(){return _0xe9acf6;});}else{return _0xe9acf6;}})[_0x8ee3('0x42')](function(_0x10c7fb){logger['error'](_0x8ee3('0x4d'),_0x10c7fb);throw _0x10c7fb;});}return _0xe9acf6;})[_0x8ee3('0x23')](respondWithResult(_0x38af81,0xc9))[_0x8ee3('0x42')](handleError(_0x38af81,null));};exports['update']=function(_0x1d18aa,_0x4ca021){if(_0x1d18aa[_0x8ee3('0x48')]['id']){delete _0x1d18aa[_0x8ee3('0x48')]['id'];}return db[_0x8ee3('0x2c')][_0x8ee3('0x46')]({'where':{'id':_0x1d18aa['params']['id']}})[_0x8ee3('0x23')](handleEntityNotFound(_0x4ca021,null))[_0x8ee3('0x23')](saveUpdates(_0x1d18aa['body'],null))[_0x8ee3('0x23')](respondWithResult(_0x4ca021,null))['catch'](handleError(_0x4ca021,null));};exports[_0x8ee3('0x4e')]=function(_0x3e87fd,_0x2b7fea){return db[_0x8ee3('0x2c')][_0x8ee3('0x46')]({'where':{'id':_0x3e87fd[_0x8ee3('0x44')]['id']}})[_0x8ee3('0x23')](handleEntityNotFound(_0x2b7fea,null))[_0x8ee3('0x23')](removeEntity(_0x2b7fea,null))[_0x8ee3('0x42')](handleError(_0x2b7fea,null));};exports[_0x8ee3('0x4f')]=function(_0x5c226f,_0x55c93c){return db[_0x8ee3('0x2c')][_0x8ee3('0x4f')]()[_0x8ee3('0x23')](respondWithResult(_0x55c93c,null))[_0x8ee3('0x42')](handleError(_0x55c93c,null));};exports['addDisposition']=function(_0x4b782f,_0x1560bb,_0x5ace80){if(_0x4b782f[_0x8ee3('0x48')]['id']){delete _0x4b782f['body']['id'];}return db[_0x8ee3('0x2c')][_0x8ee3('0x46')]({'where':{'id':_0x4b782f[_0x8ee3('0x44')]['id']}})[_0x8ee3('0x23')](handleEntityNotFound(_0x1560bb,null))[_0x8ee3('0x23')](function(_0x5f5144){if(_0x5f5144){_0x4b782f['body'][_0x8ee3('0x50')]=_0x5f5144['id'];return db['Disposition'][_0x8ee3('0x47')](_0x4b782f['body']);}})[_0x8ee3('0x23')](respondWithResult(_0x1560bb,null))[_0x8ee3('0x42')](handleError(_0x1560bb,null));};exports[_0x8ee3('0x51')]=function(_0x3b04c7,_0x238eb7,_0x812327){var _0x424443={'raw':![],'where':{}};var _0x38b099={};var _0x2ecac4={'count':0x0,'rows':[]};return db[_0x8ee3('0x2c')]['findOne']({'where':{'id':_0x3b04c7[_0x8ee3('0x44')]['id']}})[_0x8ee3('0x23')](handleEntityNotFound(_0x238eb7,null))[_0x8ee3('0x23')](function(_0x563a1e){if(_0x563a1e){_0x38b099['model']=_['keys'](db[_0x8ee3('0x52')][_0x8ee3('0x2d')]);_0x38b099[_0x8ee3('0x31')]=_[_0x8ee3('0x45')](_0x3b04c7[_0x8ee3('0x31')]);_0x38b099[_0x8ee3('0x32')]=_[_0x8ee3('0x33')](_0x38b099['model'],_0x38b099['query']);_0x424443[_0x8ee3('0x34')]=_[_0x8ee3('0x33')](_0x38b099[_0x8ee3('0x30')],qs[_0x8ee3('0x35')](_0x3b04c7['query'][_0x8ee3('0x35')]));_0x424443[_0x8ee3('0x34')]=_0x424443['attributes'][_0x8ee3('0x36')]?_0x424443[_0x8ee3('0x34')]:_0x38b099['model'];if(!_0x3b04c7[_0x8ee3('0x31')]['hasOwnProperty']('nolimit')){_0x424443[_0x8ee3('0x1b')]=qs[_0x8ee3('0x1b')](_0x3b04c7[_0x8ee3('0x31')][_0x8ee3('0x1b')]);_0x424443[_0x8ee3('0x1d')]=qs[_0x8ee3('0x1d')](_0x3b04c7['query'][_0x8ee3('0x1d')]);}_0x424443[_0x8ee3('0x38')]=qs[_0x8ee3('0x39')](_0x3b04c7[_0x8ee3('0x31')][_0x8ee3('0x39')]);_0x424443[_0x8ee3('0x3a')]=qs[_0x8ee3('0x32')](_['pick'](_0x3b04c7[_0x8ee3('0x31')],_0x38b099['filters']));_0x424443[_0x8ee3('0x3a')][_0x8ee3('0x50')]=_0x563a1e['id'];if(_0x3b04c7['query'][_0x8ee3('0x3c')]){_0x424443[_0x8ee3('0x3a')]=_[_0x8ee3('0x3d')](_0x424443['where'],{'$or':_[_0x8ee3('0x2b')](_0x424443['attributes'],function(_0xaa4a71){var _0x5073ad={};_0x5073ad[_0xaa4a71]={'$like':'%'+_0x3b04c7[_0x8ee3('0x31')][_0x8ee3('0x3c')]+'%'};return _0x5073ad;})});}_0x424443=_['merge']({},_0x424443,_0x3b04c7['options']);return db['Disposition'][_0x8ee3('0x1c')]({'where':_0x424443[_0x8ee3('0x3a')]})[_0x8ee3('0x23')](function(_0x5414a6){_0x2ecac4[_0x8ee3('0x1c')]=_0x5414a6;if(_0x3b04c7[_0x8ee3('0x31')][_0x8ee3('0x40')]){_0x424443['include']=[{'all':!![]}];}return db[_0x8ee3('0x52')][_0x8ee3('0x53')](_0x424443);})[_0x8ee3('0x23')](function(_0x5529bf){_0x2ecac4['rows']=_0x5529bf;return _0x2ecac4;});}})['then'](respondWithFilteredResult(_0x238eb7,_0x424443))[_0x8ee3('0x42')](handleError(_0x238eb7,null));};exports[_0x8ee3('0x54')]=function(_0x1cb614,_0x556006,_0x348a00){return db[_0x8ee3('0x2c')][_0x8ee3('0x46')]({'where':{'id':_0x1cb614[_0x8ee3('0x44')]['id']}})['then'](handleEntityNotFound(_0x556006,null))[_0x8ee3('0x23')](function(_0xca68d0){if(_0xca68d0){return _0xca68d0[_0x8ee3('0x54')](_0x1cb614[_0x8ee3('0x31')][_0x8ee3('0x55')]);}})[_0x8ee3('0x23')](respondWithStatusCode(_0x556006,null))[_0x8ee3('0x42')](handleError(_0x556006,null));};exports[_0x8ee3('0x56')]=function(_0x5f343c,_0x3dcd84,_0x1159d3){return db['CmList'][_0x8ee3('0x46')]({'where':{'id':_0x5f343c[_0x8ee3('0x44')]['id']}})[_0x8ee3('0x23')](handleEntityNotFound(_0x3dcd84,null))[_0x8ee3('0x23')](function(_0x2d484c){if(_0x2d484c){var _0x315530=[];var _0x4de8e6={'success':[],'errors':[]};return db[_0x8ee3('0x57')][_0x8ee3('0x4f')]()[_0x8ee3('0x23')](function(_0x1d88c7){if(_0x5f343c[_0x8ee3('0x48')][_0x8ee3('0x58')]&&_[_0x8ee3('0x59')](_0x5f343c[_0x8ee3('0x48')][_0x8ee3('0x58')])){if(_0x5f343c['body'][_0x8ee3('0x58')][_0x8ee3('0x36')]){_0x5f343c[_0x8ee3('0x48')]['tags']=_0x5f343c[_0x8ee3('0x48')][_0x8ee3('0x58')][_0x8ee3('0x5a')](';')+';';}else{_0x5f343c[_0x8ee3('0x48')][_0x8ee3('0x58')]=null;}}else{_0x5f343c['body']['tags']=null;}if(_0x5f343c[_0x8ee3('0x48')]&&_[_0x8ee3('0x59')](_0x5f343c[_0x8ee3('0x48')])){for(var _0x10139f=0x0;_0x10139f<_0x5f343c[_0x8ee3('0x48')][_0x8ee3('0x36')];_0x10139f+=0x1){_0x5f343c[_0x8ee3('0x48')][_0x10139f][_0x8ee3('0x50')]=_0x5f343c[_0x8ee3('0x44')]['id'];_0x315530['push'](_0x5f343c[_0x8ee3('0x48')][_0x10139f]);}return BPromise[_0x8ee3('0x5b')](_0x315530,function(_0x2cec84){return db['CmContact'][_0x8ee3('0x47')](_[_0x8ee3('0x5c')](_0x2cec84,[_0x8ee3('0x55'),'id'])||{},{'fields':_['keys'](_0x1d88c7),'raw':!![]})['then'](function(_0x35c01c){_0x4de8e6['success']['push'](_0x35c01c[_0x8ee3('0x5d')]);})[_0x8ee3('0x42')](function(_0x566f11){_0x4de8e6[_0x8ee3('0x5e')][_0x8ee3('0x5f')]({'data':_0x2cec84,'error':_0x566f11[_0x8ee3('0x60')]});});})[_0x8ee3('0x23')](function(_0x1707a5){return _0x4de8e6;})['catch'](function(_0x41cbe1){return _0x41cbe1;});}else{_0x3dcd84[_0x8ee3('0x18')](0x190)['json']({'message':_0x8ee3('0x61')});}});}})[_0x8ee3('0x23')](respondWithResult(_0x3dcd84,null))[_0x8ee3('0x42')](handleError(_0x3dcd84,null));};exports[_0x8ee3('0x62')]=function(_0x2bdf6e,_0x19ee39,_0x52989c){var _0x425c2;return db[_0x8ee3('0x2c')][_0x8ee3('0x46')]({'where':{'id':_0x2bdf6e['params']['id']},'include':[{'model':db[_0x8ee3('0x63')],'as':_0x8ee3('0x64')}]})[_0x8ee3('0x23')](handleEntityNotFound(_0x19ee39,null))[_0x8ee3('0x23')](function(_0x18d0c7){if(_0x18d0c7){_0x425c2=_0x18d0c7;return db[_0x8ee3('0x57')][_0x8ee3('0x2d')];}})[_0x8ee3('0x23')](function(_0x367be6){if(_0x367be6){var _0x18d706={};var _0x146390={};_0x146390[_0x8ee3('0x30')]=_['concat'](_[_0x8ee3('0x45')](_0x367be6),_[_0x8ee3('0x2b')](_0x425c2[_0x8ee3('0x64')],function(_0x5ba616){return util[_0x8ee3('0x65')](_0x8ee3('0x66'),_0x5ba616['id']);}));_0x146390['query']=_[_0x8ee3('0x45')](_0x2bdf6e[_0x8ee3('0x31')]);_0x146390[_0x8ee3('0x32')]=_[_0x8ee3('0x33')](_0x146390['model'],_0x146390[_0x8ee3('0x31')]);_0x18d706[_0x8ee3('0x34')]=_[_0x8ee3('0x33')](_0x146390[_0x8ee3('0x30')],qs[_0x8ee3('0x35')](_0x2bdf6e[_0x8ee3('0x31')][_0x8ee3('0x35')]));_0x18d706[_0x8ee3('0x34')]=_0x18d706['attributes'][_0x8ee3('0x36')]?_0x18d706['attributes']:_0x146390[_0x8ee3('0x30')];if(!_0x2bdf6e[_0x8ee3('0x31')][_0x8ee3('0x67')](_0x8ee3('0x37'))){_0x18d706['limit']=qs['limit'](_0x2bdf6e[_0x8ee3('0x31')]['limit']);_0x18d706['offset']=qs[_0x8ee3('0x1d')](_0x2bdf6e['query']['offset']);}_0x18d706[_0x8ee3('0x38')]=qs[_0x8ee3('0x39')](_0x2bdf6e[_0x8ee3('0x31')]['sort']);_0x18d706['where']=qs['filters'](_[_0x8ee3('0x3b')](_0x2bdf6e[_0x8ee3('0x31')],_0x146390['filters']));_0x18d706['raw']=!![];if(_0x2bdf6e[_0x8ee3('0x31')]['filter']){_0x18d706[_0x8ee3('0x3a')]=_[_0x8ee3('0x3d')](_0x18d706[_0x8ee3('0x3a')],{'$or':_['map'](_0x18d706[_0x8ee3('0x34')],function(_0x4b2d4d){var _0x508556={};_0x508556[_0x4b2d4d]={'$like':'%'+_0x2bdf6e[_0x8ee3('0x31')][_0x8ee3('0x3c')]+'%'};return _0x508556;})});}_0x18d706=_[_0x8ee3('0x3d')]({},_0x18d706,_0x2bdf6e[_0x8ee3('0x3f')]);return _0x425c2[_0x8ee3('0x62')](_0x18d706);}})[_0x8ee3('0x23')](respondWithResult(_0x19ee39,null))[_0x8ee3('0x42')](handleError(_0x19ee39,null));};exports[_0x8ee3('0x68')]=function(_0x2ce8db,_0x4e4a94,_0x3110a5){var _0x614e3e;return db[_0x8ee3('0x2c')][_0x8ee3('0x46')]({'where':{'id':_0x2ce8db[_0x8ee3('0x44')]['id']},'include':[{'model':db[_0x8ee3('0x63')],'as':'CustomFields'}]})[_0x8ee3('0x23')](handleEntityNotFound(_0x4e4a94,null))[_0x8ee3('0x23')](function(_0x51b688){if(_0x51b688){_0x614e3e=_0x51b688;return db[_0x8ee3('0x57')][_0x8ee3('0x2d')];}})['then'](function(_0x33dbe3){if(_0x33dbe3){var _0x30335e={};var _0x6a3b56={};_0x6a3b56[_0x8ee3('0x30')]=_[_0x8ee3('0x69')](_[_0x8ee3('0x45')](_0x33dbe3),_[_0x8ee3('0x2b')](_0x614e3e['CustomFields'],function(_0x47c8bb){return util[_0x8ee3('0x65')](_0x8ee3('0x66'),_0x47c8bb['id']);}));_0x6a3b56[_0x8ee3('0x31')]=_[_0x8ee3('0x45')](_0x2ce8db['query']);_0x6a3b56[_0x8ee3('0x32')]=_['intersection'](_0x6a3b56[_0x8ee3('0x30')],_0x6a3b56[_0x8ee3('0x31')]);_0x30335e[_0x8ee3('0x34')]=_['intersection'](_0x6a3b56['model'],qs['fields'](_0x2ce8db[_0x8ee3('0x31')]['fields']));_0x30335e[_0x8ee3('0x34')]=_0x30335e[_0x8ee3('0x34')]['length']?_0x30335e['attributes']:_0x6a3b56[_0x8ee3('0x30')];if(!_0x2ce8db[_0x8ee3('0x31')][_0x8ee3('0x67')](_0x8ee3('0x37'))){_0x30335e['limit']=qs[_0x8ee3('0x1b')](_0x2ce8db[_0x8ee3('0x31')]['limit']);_0x30335e[_0x8ee3('0x1d')]=qs[_0x8ee3('0x1d')](_0x2ce8db[_0x8ee3('0x31')][_0x8ee3('0x1d')]);}_0x30335e[_0x8ee3('0x38')]=qs[_0x8ee3('0x39')](_0x2ce8db[_0x8ee3('0x31')][_0x8ee3('0x39')]);_0x30335e[_0x8ee3('0x3a')]=qs[_0x8ee3('0x32')](_[_0x8ee3('0x3b')](_0x2ce8db[_0x8ee3('0x31')],_0x6a3b56[_0x8ee3('0x32')]));_0x30335e[_0x8ee3('0x6a')]=!![];if(_0x2ce8db['query'][_0x8ee3('0x3c')]){_0x30335e[_0x8ee3('0x3a')]=_[_0x8ee3('0x3d')](_0x30335e[_0x8ee3('0x3a')],{'$or':_[_0x8ee3('0x2b')](_0x30335e[_0x8ee3('0x34')],function(_0x4e84df){var _0x14f3a5={};_0x14f3a5[_0x4e84df]={'$like':'%'+_0x2ce8db[_0x8ee3('0x31')][_0x8ee3('0x3c')]+'%'};return _0x14f3a5;})});}_0x30335e=_[_0x8ee3('0x3d')]({},_0x30335e,_0x2ce8db[_0x8ee3('0x3f')]);return _0x614e3e[_0x8ee3('0x62')](_0x30335e);}})[_0x8ee3('0x23')](function(_0x56f969){if(!_[_0x8ee3('0x6b')](_0x56f969)){var _0x42c872=toCsv(_0x56f969);var _0x3de5bc=Date[_0x8ee3('0x6c')]();fs[_0x8ee3('0x6d')](util['format'](_0x8ee3('0x6e'),_0x614e3e['id'],_0x3de5bc),_0x42c872);_0x4e4a94[_0x8ee3('0x6f')]('Content-disposition','attachment;\x20filename='+util[_0x8ee3('0x65')]('list_%d_%s.csv',_0x614e3e['id'],_0x3de5bc));_0x4e4a94[_0x8ee3('0x6f')]('Content-type',_0x8ee3('0x70'));return _0x4e4a94[_0x8ee3('0x71')](util['format'](_0x8ee3('0x6e'),_0x614e3e['id'],_0x3de5bc));}else{return _0x4e4a94[_0x8ee3('0x17')](0xcc);}})[_0x8ee3('0x42')](handleError(_0x4e4a94,null));};exports['addCustomField']=function(_0x12826d,_0x132061,_0x4bfa04){var _0x2d0dde;delete _0x12826d[_0x8ee3('0x48')]['id'];return db[_0x8ee3('0x2c')]['findOne']({'where':{'id':_0x12826d[_0x8ee3('0x44')]['id']}})[_0x8ee3('0x23')](handleEntityNotFound(_0x132061,null))[_0x8ee3('0x23')](function(_0x5d8bf0){if(_0x5d8bf0){return db['sequelize']['transaction'](function(_0x3fbcee){return db[_0x8ee3('0x63')][_0x8ee3('0x47')](_0x12826d[_0x8ee3('0x48')],{'transaction':_0x3fbcee})['then'](function(_0x541d5e){_0x2d0dde=_0x541d5e;return _0x5d8bf0[_0x8ee3('0x72')](_0x541d5e,{'transaction':_0x3fbcee});})[_0x8ee3('0x23')](function(){var _0x438fb7={'type':db['Sequelize'][_0x8ee3('0x73')],'transaction':_0x3fbcee};switch(_0x12826d[_0x8ee3('0x48')][_0x8ee3('0x2f')]){case _0x8ee3('0x74'):_0x438fb7[_0x8ee3('0x2f')]=db[_0x8ee3('0x75')][_0x8ee3('0x73')];break;case _0x8ee3('0x76'):_0x438fb7[_0x8ee3('0x2f')]=db[_0x8ee3('0x75')]['INTEGER'];break;case _0x8ee3('0x77'):_0x438fb7[_0x8ee3('0x2f')]=db['Sequelize'][_0x8ee3('0x78')];_0x438fb7['defaultValue']=![];break;default:}return db[_0x8ee3('0x79')][_0x8ee3('0x7a')]['addColumn'](_0x8ee3('0x7b'),util[_0x8ee3('0x65')](_0x8ee3('0x7c'),_0x2d0dde['id']),_0x438fb7);})[_0x8ee3('0x23')](function(){return _0x2d0dde;});});}})[_0x8ee3('0x23')](respondWithResult(_0x132061,null))[_0x8ee3('0x42')](handleError(_0x132061,null));};exports[_0x8ee3('0x7d')]=function(_0x387880,_0x26863e,_0x4d2077){var _0x567133={};var _0x26c195={};var _0x1a1a59;var _0x5868ed;return db[_0x8ee3('0x2c')]['findOne']({'where':{'id':_0x387880[_0x8ee3('0x44')]['id']}})[_0x8ee3('0x23')](handleEntityNotFound(_0x26863e,null))[_0x8ee3('0x23')](function(_0x2fe2bf){if(_0x2fe2bf){_0x1a1a59=_0x2fe2bf;_0x26c195['model']=_[_0x8ee3('0x45')](db['CmCustomField'][_0x8ee3('0x2d')]);_0x26c195['query']=_['keys'](_0x387880[_0x8ee3('0x31')]);_0x26c195[_0x8ee3('0x32')]=_[_0x8ee3('0x33')](_0x26c195[_0x8ee3('0x30')],_0x26c195[_0x8ee3('0x31')]);_0x567133[_0x8ee3('0x34')]=_['intersection'](_0x26c195[_0x8ee3('0x30')],qs[_0x8ee3('0x35')](_0x387880[_0x8ee3('0x31')]['fields']));_0x567133[_0x8ee3('0x34')]=_0x567133[_0x8ee3('0x34')][_0x8ee3('0x36')]?_0x567133['attributes']:_0x26c195[_0x8ee3('0x30')];_0x567133[_0x8ee3('0x38')]=qs[_0x8ee3('0x39')](_0x387880[_0x8ee3('0x31')][_0x8ee3('0x39')]);_0x567133['where']=qs[_0x8ee3('0x32')](_[_0x8ee3('0x3b')](_0x387880['query'],_0x26c195[_0x8ee3('0x32')]));_0x567133['where']=_[_0x8ee3('0x3d')](_0x567133[_0x8ee3('0x3a')],{'$or':[{'ListId':_0x2fe2bf['id']},{'ListId':null}]});if(_0x387880['query'][_0x8ee3('0x3c')]){_0x567133[_0x8ee3('0x3a')]=_[_0x8ee3('0x3d')](_0x567133[_0x8ee3('0x3a')],{'$or':_[_0x8ee3('0x2b')](_0x567133[_0x8ee3('0x34')],function(_0x13db7e){var _0x2f08d5={};_0x2f08d5[_0x13db7e]={'$like':'%'+_0x387880['query']['filter']+'%'};return _0x2f08d5;})});}_0x567133=_['merge']({},_0x567133,_0x387880[_0x8ee3('0x3f')]);return db['CmCustomField'][_0x8ee3('0x7e')](_0x567133);}})[_0x8ee3('0x23')](respondWithResult(_0x26863e,null))[_0x8ee3('0x42')](handleError(_0x26863e,null));};exports[_0x8ee3('0x7f')]=function(_0x2459bb,_0x4822a2,_0x42a802){return db[_0x8ee3('0x2c')]['find']({'where':{'id':_0x2459bb[_0x8ee3('0x44')]['id']}})[_0x8ee3('0x23')](handleEntityNotFound(_0x4822a2,null))[_0x8ee3('0x23')](function(_0x51f372){if(_0x51f372){return _0x51f372[_0x8ee3('0x7f')](_0x2459bb[_0x8ee3('0x48')][_0x8ee3('0x55')],_['omit'](_0x2459bb[_0x8ee3('0x48')],[_0x8ee3('0x55'),'id'])||{})[_0x8ee3('0x80')](function(_0x417a72){for(var _0x12e7e2=0x0;_0x12e7e2<_0x2459bb[_0x8ee3('0x48')][_0x8ee3('0x55')][_0x8ee3('0x36')];_0x12e7e2+=0x1){socket['emit'](_0x8ee3('0x81'),{'UserId':Number(_0x2459bb[_0x8ee3('0x48')]['ids'][_0x12e7e2]),'CmListId':Number(_0x2459bb[_0x8ee3('0x44')]['id'])});}return _0x417a72;});}})['then'](respondWithResult(_0x4822a2,null))[_0x8ee3('0x42')](handleError(_0x4822a2,null));};exports[_0x8ee3('0x82')]=function(_0xddad93,_0x252a6d,_0x2bb38f){return db['CmList'][_0x8ee3('0x46')]({'where':{'id':_0xddad93[_0x8ee3('0x44')]['id']}})[_0x8ee3('0x23')](handleEntityNotFound(_0x252a6d,null))[_0x8ee3('0x23')](function(_0x500795){if(_0x500795){return _0x500795['removeAgents'](_0xddad93[_0x8ee3('0x31')][_0x8ee3('0x55')])[_0x8ee3('0x23')](function(){if(_[_0x8ee3('0x59')](_0xddad93['query'][_0x8ee3('0x55')])){for(var _0x3f5e2c=0x0;_0x3f5e2c<_0xddad93[_0x8ee3('0x31')][_0x8ee3('0x55')]['length'];_0x3f5e2c+=0x1){socket['emit'](_0x8ee3('0x83'),{'UserId':Number(_0xddad93['query']['ids'][_0x3f5e2c]),'CmListId':Number(_0xddad93[_0x8ee3('0x44')]['id'])});}}else{socket[_0x8ee3('0x84')]('userCmList:remove',{'UserId':Number(_0xddad93[_0x8ee3('0x31')]['ids']),'CmListId':Number(_0xddad93[_0x8ee3('0x44')]['id'])});}});}})['then'](respondWithStatusCode(_0x252a6d,null))[_0x8ee3('0x42')](handleError(_0x252a6d,null));};exports['getAgents']=function(_0x24ab30,_0x40a9b1,_0x32f031){var _0x5bada7={};var _0x1e7793={};var _0x308f9a;var _0x535a8f;return db[_0x8ee3('0x2c')][_0x8ee3('0x85')]({'where':{'id':_0x24ab30['params']['id']}})[_0x8ee3('0x23')](handleEntityNotFound(_0x40a9b1,null))[_0x8ee3('0x23')](function(_0x213eba){if(_0x213eba){_0x308f9a=_0x213eba;_0x1e7793[_0x8ee3('0x30')]=_[_0x8ee3('0x45')](db[_0x8ee3('0x86')][_0x8ee3('0x2d')]);_0x1e7793[_0x8ee3('0x31')]=_['keys'](_0x24ab30['query']);_0x1e7793[_0x8ee3('0x32')]=_[_0x8ee3('0x33')](_0x1e7793[_0x8ee3('0x30')],_0x1e7793[_0x8ee3('0x31')]);_0x5bada7[_0x8ee3('0x34')]=_[_0x8ee3('0x33')](_0x1e7793['model'],qs[_0x8ee3('0x35')](_0x24ab30[_0x8ee3('0x31')]['fields']));_0x5bada7[_0x8ee3('0x34')]=_0x5bada7['attributes'][_0x8ee3('0x36')]?_0x5bada7[_0x8ee3('0x34')]:_0x1e7793[_0x8ee3('0x30')];_0x5bada7[_0x8ee3('0x38')]=qs[_0x8ee3('0x39')](_0x24ab30[_0x8ee3('0x31')][_0x8ee3('0x39')]);_0x5bada7['where']=qs[_0x8ee3('0x32')](_[_0x8ee3('0x3b')](_0x24ab30['query'],_0x1e7793[_0x8ee3('0x32')]));if(_0x24ab30[_0x8ee3('0x31')][_0x8ee3('0x3c')]){_0x5bada7[_0x8ee3('0x3a')]=_[_0x8ee3('0x3d')](_0x5bada7[_0x8ee3('0x3a')],{'$or':_[_0x8ee3('0x2b')](_0x5bada7[_0x8ee3('0x34')],function(_0x83d589){var _0x15b115={};_0x15b115[_0x83d589]={'$like':'%'+_0x24ab30[_0x8ee3('0x31')]['filter']+'%'};return _0x15b115;})});}_0x5bada7=_[_0x8ee3('0x3d')]({},_0x5bada7,_0x24ab30[_0x8ee3('0x3f')]);return _0x308f9a[_0x8ee3('0x87')](_0x5bada7);}})[_0x8ee3('0x23')](function(_0x47ea1b){if(_0x47ea1b){_0x535a8f=_0x47ea1b[_0x8ee3('0x36')];if(!_0x24ab30[_0x8ee3('0x31')][_0x8ee3('0x67')](_0x8ee3('0x37'))){_0x5bada7[_0x8ee3('0x1b')]=qs[_0x8ee3('0x1b')](_0x24ab30[_0x8ee3('0x31')][_0x8ee3('0x1b')]);_0x5bada7['offset']=qs['offset'](_0x24ab30[_0x8ee3('0x31')][_0x8ee3('0x1d')]);}return _0x308f9a['getAgents'](_0x5bada7);}})[_0x8ee3('0x23')](function(_0x2b2271){if(_0x2b2271){return _0x2b2271?{'count':_0x535a8f,'rows':_0x2b2271}:null;}})['then'](respondWithResult(_0x40a9b1,null))[_0x8ee3('0x42')](handleError(_0x40a9b1,null));}; \ No newline at end of file +var _0x190d=['CmList','rawAttributes','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','ListId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addContacts','CmContact','tags','join','isArray','each','push','dataValues','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','format','cf_%d','pick','raw','getContactsCsv','concat','getContacts','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','download','addCustomField','transaction','addCustomFields','text','TEXT','number','Sequelize','INTEGER','switch','BOOLEAN','queryInterface','cm_contacts','cf_%s','findAndCountAll','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','zip-dir','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','get','Lists','destroy','error','stack','name','send','index'];(function(_0x41ba6a,_0x4e4743){var _0x471956=function(_0x3d252f){while(--_0x3d252f){_0x41ba6a['push'](_0x41ba6a['shift']());}};_0x471956(++_0x4e4743);}(_0x190d,0xf7));var _0xd190=function(_0x1416fc,_0x72e155){_0x1416fc=_0x1416fc-0x0;var _0x3a4b34=_0x190d[_0x1416fc];return _0x3a4b34;};'use strict';var emlformat=require(_0xd190('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd190('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd190('0x2'));var moment=require(_0xd190('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd190('0x4'));var sox=require(_0xd190('0x5'));var csv=require(_0xd190('0x6'));var ejs=require(_0xd190('0x7'));var fs=require('fs');var fs_extra=require(_0xd190('0x8'));var _=require('lodash');var squel=require(_0xd190('0x9'));var crypto=require(_0xd190('0xa'));var jsforce=require(_0xd190('0xb'));var deskjs=require(_0xd190('0xc'));var toCsv=require(_0xd190('0x6'));var querystring=require(_0xd190('0xd'));var Papa=require(_0xd190('0xe'));var Redis=require(_0xd190('0xf'));var authService=require(_0xd190('0x10'));var qs=require(_0xd190('0x11'));var as=require(_0xd190('0x12'));var hardwareService=require(_0xd190('0x13'));var logger=require('../../config/logger')(_0xd190('0x14'));var utils=require(_0xd190('0x15'));var config=require(_0xd190('0x16'));var licenseUtil=require(_0xd190('0x17'));var db=require('../../mysqldb')['db'];config[_0xd190('0x18')]=_[_0xd190('0x19')](config[_0xd190('0x18')],{'host':_0xd190('0x1a'),'port':0x18eb});var socket=require(_0xd190('0x1b'))(new Redis(config[_0xd190('0x18')]));require(_0xd190('0x1c'))[_0xd190('0x1d')](socket);function respondWithStatusCode(_0x122527,_0xeb8a8f){_0xeb8a8f=_0xeb8a8f||0xcc;return function(_0x44ba5f){if(_0x44ba5f){return _0x122527[_0xd190('0x1e')](_0xeb8a8f);}return _0x122527['status'](_0xeb8a8f)[_0xd190('0x1f')]();};}function respondWithResult(_0x23e43f,_0x502577){_0x502577=_0x502577||0xc8;return function(_0x2ffd7d){if(_0x2ffd7d){return _0x23e43f[_0xd190('0x20')](_0x502577)[_0xd190('0x21')](_0x2ffd7d);}};}function respondWithFilteredResult(_0x582fa1,_0x3c1127){return function(_0xae9f99){if(_0xae9f99){var _0x33487b=typeof _0x3c1127[_0xd190('0x22')]===_0xd190('0x23')&&typeof _0x3c1127[_0xd190('0x24')]==='undefined';var _0x24a336=_0xae9f99[_0xd190('0x25')];var _0x18b385=_0x33487b?0x0:_0x3c1127[_0xd190('0x22')];var _0x216255=_0x33487b?_0xae9f99[_0xd190('0x25')]:_0x3c1127[_0xd190('0x22')]+_0x3c1127['limit'];var _0x5ca644;if(_0x216255>=_0x24a336){_0x216255=_0x24a336;_0x5ca644=0xc8;}else{_0x5ca644=0xce;}_0x582fa1[_0xd190('0x20')](_0x5ca644);return _0x582fa1[_0xd190('0x26')]('Content-Range',_0x18b385+'-'+_0x216255+'/'+_0x24a336)[_0xd190('0x21')](_0xae9f99);}return null;};}function patchUpdates(_0x5a73ba){return function(_0x382937){try{jsonpatch[_0xd190('0x27')](_0x382937,_0x5a73ba,!![]);}catch(_0x228da1){return BPromise['reject'](_0x228da1);}return _0x382937[_0xd190('0x28')]();};}function saveUpdates(_0x23b67c,_0x36d76c){return function(_0x39d502){if(_0x39d502){return _0x39d502[_0xd190('0x29')](_0x23b67c)['then'](function(_0x55c929){return _0x55c929;});}return null;};}function removeEntity(_0x4e6987,_0x48bb1f){return function(_0x1ca7f6){if(_0x1ca7f6){return _0x1ca7f6['destroy']()[_0xd190('0x2a')](function(){var _0x561a03=_0x1ca7f6[_0xd190('0x2b')]({'plain':!![]});var _0xe64ff=_0xd190('0x2c');return db['UserProfileResource'][_0xd190('0x2d')]({'where':{'type':_0xe64ff,'resourceId':_0x561a03['id']}})[_0xd190('0x2a')](function(){return _0x1ca7f6;});})[_0xd190('0x2a')](function(){_0x4e6987[_0xd190('0x20')](0xcc)[_0xd190('0x1f')]();});}};}function handleEntityNotFound(_0x1647eb,_0x30e195){return function(_0x10a070){if(!_0x10a070){_0x1647eb[_0xd190('0x1e')](0x194);}return _0x10a070;};}function handleError(_0x28aca7,_0x18f28d){_0x18f28d=_0x18f28d||0x1f4;return function(_0x2425a1){logger[_0xd190('0x2e')](_0x2425a1[_0xd190('0x2f')]);if(_0x2425a1[_0xd190('0x30')]){delete _0x2425a1[_0xd190('0x30')];}_0x28aca7[_0xd190('0x20')](_0x18f28d)[_0xd190('0x31')](_0x2425a1);};}exports[_0xd190('0x32')]=function(_0x522577,_0x2b471a){var _0x4cea45={},_0x3347b5={},_0x28b01b={'count':0x0,'rows':[]};var _0x289e29=_['map'](db[_0xd190('0x33')][_0xd190('0x34')],function(_0x65c623){return{'name':_0x65c623[_0xd190('0x35')],'type':_0x65c623[_0xd190('0x36')][_0xd190('0x37')]};});_0x3347b5['model']=_[_0xd190('0x38')](_0x289e29,_0xd190('0x30'));_0x3347b5[_0xd190('0x39')]=_[_0xd190('0x3a')](_0x522577[_0xd190('0x39')]);_0x3347b5['filters']=_['intersection'](_0x3347b5[_0xd190('0x3b')],_0x3347b5[_0xd190('0x39')]);_0x4cea45[_0xd190('0x3c')]=_[_0xd190('0x3d')](_0x3347b5['model'],qs[_0xd190('0x3e')](_0x522577[_0xd190('0x39')]['fields']));_0x4cea45[_0xd190('0x3c')]=_0x4cea45[_0xd190('0x3c')][_0xd190('0x3f')]?_0x4cea45[_0xd190('0x3c')]:_0x3347b5[_0xd190('0x3b')];if(!_0x522577[_0xd190('0x39')][_0xd190('0x40')](_0xd190('0x41'))){_0x4cea45['limit']=qs[_0xd190('0x24')](_0x522577[_0xd190('0x39')][_0xd190('0x24')]);_0x4cea45['offset']=qs[_0xd190('0x22')](_0x522577[_0xd190('0x39')]['offset']);}_0x4cea45['order']=qs['sort'](_0x522577['query'][_0xd190('0x42')]);_0x4cea45[_0xd190('0x43')]=qs[_0xd190('0x44')](_['pick'](_0x522577[_0xd190('0x39')],_0x3347b5['filters']),_0x289e29);if(_0x522577['query'][_0xd190('0x45')]){_0x4cea45[_0xd190('0x43')]=_[_0xd190('0x46')](_0x4cea45['where'],{'$or':_[_0xd190('0x38')](_0x289e29,function(_0x4a27fa){if(_0x4a27fa[_0xd190('0x36')]!==_0xd190('0x47')){var _0x8e8b68={};_0x8e8b68[_0x4a27fa[_0xd190('0x30')]]={'$like':'%'+_0x522577[_0xd190('0x39')][_0xd190('0x45')]+'%'};return _0x8e8b68;}})});}_0x4cea45=_[_0xd190('0x46')]({},_0x4cea45,_0x522577[_0xd190('0x48')]);var _0x29fc5c={'where':_0x4cea45['where']};return db['CmList'][_0xd190('0x25')](_0x29fc5c)[_0xd190('0x2a')](function(_0x3eeaeb){_0x28b01b['count']=_0x3eeaeb;if(_0x522577[_0xd190('0x39')][_0xd190('0x49')]){_0x4cea45[_0xd190('0x4a')]=[{'all':!![]}];}return db[_0xd190('0x33')][_0xd190('0x4b')](_0x4cea45);})['then'](function(_0x1cfcdb){_0x28b01b[_0xd190('0x4c')]=_0x1cfcdb;return _0x28b01b;})[_0xd190('0x2a')](respondWithFilteredResult(_0x2b471a,_0x4cea45))[_0xd190('0x4d')](handleError(_0x2b471a,null));};exports[_0xd190('0x4e')]=function(_0x320857,_0x3113ee){var _0x423207={'raw':![],'where':{'id':_0x320857[_0xd190('0x4f')]['id']}},_0x5b45a2={};_0x5b45a2[_0xd190('0x3b')]=_[_0xd190('0x3a')](db['CmList'][_0xd190('0x34')]);_0x5b45a2[_0xd190('0x39')]=_[_0xd190('0x3a')](_0x320857[_0xd190('0x39')]);_0x5b45a2[_0xd190('0x44')]=_[_0xd190('0x3d')](_0x5b45a2[_0xd190('0x3b')],_0x5b45a2['query']);_0x423207[_0xd190('0x3c')]=_[_0xd190('0x3d')](_0x5b45a2['model'],qs['fields'](_0x320857[_0xd190('0x39')][_0xd190('0x3e')]));_0x423207[_0xd190('0x3c')]=_0x423207[_0xd190('0x3c')][_0xd190('0x3f')]?_0x423207[_0xd190('0x3c')]:_0x5b45a2[_0xd190('0x3b')];if(_0x320857[_0xd190('0x39')]['includeAll']){_0x423207[_0xd190('0x4a')]=[{'all':!![]}];}_0x423207=_[_0xd190('0x46')]({},_0x423207,_0x320857[_0xd190('0x48')]);return db[_0xd190('0x33')]['find'](_0x423207)[_0xd190('0x2a')](handleEntityNotFound(_0x3113ee,null))['then'](respondWithResult(_0x3113ee,null))[_0xd190('0x4d')](handleError(_0x3113ee,null));};exports[_0xd190('0x50')]=function(_0x4b5194,_0x4faae6){return db[_0xd190('0x33')][_0xd190('0x50')](_0x4b5194[_0xd190('0x51')],{})['then'](function(_0x3c7154){var _0x285744=_0x4b5194[_0xd190('0x52')][_0xd190('0x2b')]({'plain':!![]});if(!_0x285744)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x285744[_0xd190('0x53')]===_0xd190('0x52')){var _0x556d28=_0x3c7154['get']({'plain':!![]});var _0x5587d9='Lists';return db[_0xd190('0x54')]['find']({'where':{'name':_0x5587d9,'userProfileId':_0x285744[_0xd190('0x55')]},'raw':!![]})[_0xd190('0x2a')](function(_0x5a0f19){if(_0x5a0f19&&_0x5a0f19[_0xd190('0x56')]===0x0){return db[_0xd190('0x57')][_0xd190('0x50')]({'name':_0x556d28[_0xd190('0x30')],'resourceId':_0x556d28['id'],'type':_0x5a0f19[_0xd190('0x30')],'sectionId':_0x5a0f19['id']},{})[_0xd190('0x2a')](function(){return _0x3c7154;});}else{return _0x3c7154;}})['catch'](function(_0x3becb0){logger[_0xd190('0x2e')](_0xd190('0x58'),_0x3becb0);throw _0x3becb0;});}return _0x3c7154;})[_0xd190('0x2a')](respondWithResult(_0x4faae6,0xc9))[_0xd190('0x4d')](handleError(_0x4faae6,null));};exports[_0xd190('0x29')]=function(_0x5d56c8,_0x12c67a){if(_0x5d56c8['body']['id']){delete _0x5d56c8[_0xd190('0x51')]['id'];}return db[_0xd190('0x33')][_0xd190('0x59')]({'where':{'id':_0x5d56c8[_0xd190('0x4f')]['id']}})[_0xd190('0x2a')](handleEntityNotFound(_0x12c67a,null))[_0xd190('0x2a')](saveUpdates(_0x5d56c8['body'],null))[_0xd190('0x2a')](respondWithResult(_0x12c67a,null))[_0xd190('0x4d')](handleError(_0x12c67a,null));};exports[_0xd190('0x2d')]=function(_0xad8c7c,_0x57b294){return db[_0xd190('0x33')][_0xd190('0x59')]({'where':{'id':_0xad8c7c[_0xd190('0x4f')]['id']}})[_0xd190('0x2a')](handleEntityNotFound(_0x57b294,null))[_0xd190('0x2a')](removeEntity(_0x57b294,null))[_0xd190('0x4d')](handleError(_0x57b294,null));};exports[_0xd190('0x5a')]=function(_0x2d158d,_0x454a8c){return db[_0xd190('0x33')]['describe']()[_0xd190('0x2a')](respondWithResult(_0x454a8c,null))['catch'](handleError(_0x454a8c,null));};exports[_0xd190('0x5b')]=function(_0x327345,_0x289370,_0x2ef6e7){if(_0x327345[_0xd190('0x51')]['id']){delete _0x327345[_0xd190('0x51')]['id'];}return db[_0xd190('0x33')][_0xd190('0x59')]({'where':{'id':_0x327345['params']['id']}})[_0xd190('0x2a')](handleEntityNotFound(_0x289370,null))['then'](function(_0x1901e4){if(_0x1901e4){_0x327345[_0xd190('0x51')][_0xd190('0x5c')]=_0x1901e4['id'];return db[_0xd190('0x5d')][_0xd190('0x50')](_0x327345[_0xd190('0x51')]);}})[_0xd190('0x2a')](respondWithResult(_0x289370,null))[_0xd190('0x4d')](handleError(_0x289370,null));};exports[_0xd190('0x5e')]=function(_0x3aa994,_0x1db281,_0x45ce41){var _0x5da918={'raw':![],'where':{}};var _0x3823c9={};var _0x347053={'count':0x0,'rows':[]};return db[_0xd190('0x33')][_0xd190('0x5f')]({'where':{'id':_0x3aa994['params']['id']}})['then'](handleEntityNotFound(_0x1db281,null))[_0xd190('0x2a')](function(_0x1e80a1){if(_0x1e80a1){_0x3823c9['model']=_[_0xd190('0x3a')](db['Disposition'][_0xd190('0x34')]);_0x3823c9[_0xd190('0x39')]=_[_0xd190('0x3a')](_0x3aa994[_0xd190('0x39')]);_0x3823c9[_0xd190('0x44')]=_[_0xd190('0x3d')](_0x3823c9[_0xd190('0x3b')],_0x3823c9['query']);_0x5da918[_0xd190('0x3c')]=_[_0xd190('0x3d')](_0x3823c9[_0xd190('0x3b')],qs['fields'](_0x3aa994[_0xd190('0x39')][_0xd190('0x3e')]));_0x5da918['attributes']=_0x5da918[_0xd190('0x3c')][_0xd190('0x3f')]?_0x5da918[_0xd190('0x3c')]:_0x3823c9[_0xd190('0x3b')];if(!_0x3aa994[_0xd190('0x39')][_0xd190('0x40')](_0xd190('0x41'))){_0x5da918[_0xd190('0x24')]=qs['limit'](_0x3aa994['query'][_0xd190('0x24')]);_0x5da918[_0xd190('0x22')]=qs[_0xd190('0x22')](_0x3aa994[_0xd190('0x39')][_0xd190('0x22')]);}_0x5da918[_0xd190('0x60')]=qs[_0xd190('0x42')](_0x3aa994[_0xd190('0x39')]['sort']);_0x5da918[_0xd190('0x43')]=qs['filters'](_['pick'](_0x3aa994[_0xd190('0x39')],_0x3823c9[_0xd190('0x44')]));_0x5da918[_0xd190('0x43')][_0xd190('0x5c')]=_0x1e80a1['id'];if(_0x3aa994[_0xd190('0x39')][_0xd190('0x45')]){_0x5da918[_0xd190('0x43')]=_['merge'](_0x5da918[_0xd190('0x43')],{'$or':_[_0xd190('0x38')](_0x5da918[_0xd190('0x3c')],function(_0x1575af){var _0x4fcfd3={};_0x4fcfd3[_0x1575af]={'$like':'%'+_0x3aa994[_0xd190('0x39')][_0xd190('0x45')]+'%'};return _0x4fcfd3;})});}_0x5da918=_['merge']({},_0x5da918,_0x3aa994[_0xd190('0x48')]);return db['Disposition'][_0xd190('0x25')]({'where':_0x5da918[_0xd190('0x43')]})['then'](function(_0x4fbd15){_0x347053[_0xd190('0x25')]=_0x4fbd15;if(_0x3aa994[_0xd190('0x39')]['includeAll']){_0x5da918[_0xd190('0x4a')]=[{'all':!![]}];}return db[_0xd190('0x5d')]['findAll'](_0x5da918);})[_0xd190('0x2a')](function(_0x22b7e4){_0x347053[_0xd190('0x4c')]=_0x22b7e4;return _0x347053;});}})[_0xd190('0x2a')](respondWithFilteredResult(_0x1db281,_0x5da918))[_0xd190('0x4d')](handleError(_0x1db281,null));};exports[_0xd190('0x61')]=function(_0x3fc3b9,_0x281758,_0x4974c7){return db[_0xd190('0x33')]['find']({'where':{'id':_0x3fc3b9['params']['id']}})[_0xd190('0x2a')](handleEntityNotFound(_0x281758,null))['then'](function(_0x4002e8){if(_0x4002e8){return _0x4002e8[_0xd190('0x61')](_0x3fc3b9[_0xd190('0x39')][_0xd190('0x62')]);}})[_0xd190('0x2a')](respondWithStatusCode(_0x281758,null))[_0xd190('0x4d')](handleError(_0x281758,null));};exports[_0xd190('0x63')]=function(_0x3c45fb,_0x42802a,_0x2759e4){return db[_0xd190('0x33')][_0xd190('0x59')]({'where':{'id':_0x3c45fb[_0xd190('0x4f')]['id']}})[_0xd190('0x2a')](handleEntityNotFound(_0x42802a,null))['then'](function(_0x1be95e){if(_0x1be95e){var _0x23d86e=[];var _0x58a128={'success':[],'errors':[]};return db[_0xd190('0x64')][_0xd190('0x5a')]()[_0xd190('0x2a')](function(_0x3a39b6){if(_0x3c45fb[_0xd190('0x51')]['tags']&&_['isArray'](_0x3c45fb['body'][_0xd190('0x65')])){if(_0x3c45fb['body'][_0xd190('0x65')][_0xd190('0x3f')]){_0x3c45fb['body'][_0xd190('0x65')]=_0x3c45fb[_0xd190('0x51')][_0xd190('0x65')][_0xd190('0x66')](';')+';';}else{_0x3c45fb['body'][_0xd190('0x65')]=null;}}else{_0x3c45fb[_0xd190('0x51')][_0xd190('0x65')]=null;}if(_0x3c45fb[_0xd190('0x51')]&&_[_0xd190('0x67')](_0x3c45fb['body'])){for(var _0x23ce47=0x0;_0x23ce47<_0x3c45fb[_0xd190('0x51')][_0xd190('0x3f')];_0x23ce47+=0x1){_0x3c45fb[_0xd190('0x51')][_0x23ce47][_0xd190('0x5c')]=_0x3c45fb[_0xd190('0x4f')]['id'];_0x23d86e['push'](_0x3c45fb[_0xd190('0x51')][_0x23ce47]);}return BPromise[_0xd190('0x68')](_0x23d86e,function(_0xc95c4a){return db[_0xd190('0x64')][_0xd190('0x50')](_['omit'](_0xc95c4a,[_0xd190('0x62'),'id'])||{},{'fields':_[_0xd190('0x3a')](_0x3a39b6),'raw':!![]})[_0xd190('0x2a')](function(_0x441113){_0x58a128['success'][_0xd190('0x69')](_0x441113[_0xd190('0x6a')]);})[_0xd190('0x4d')](function(_0x199755){_0x58a128['errors']['push']({'data':_0xc95c4a,'error':_0x199755[_0xd190('0x6b')]});});})[_0xd190('0x2a')](function(_0x208372){return _0x58a128;})[_0xd190('0x4d')](function(_0x3444d3){return _0x3444d3;});}else{_0x42802a[_0xd190('0x20')](0x190)[_0xd190('0x21')]({'message':_0xd190('0x6c')});}});}})[_0xd190('0x2a')](respondWithResult(_0x42802a,null))[_0xd190('0x4d')](handleError(_0x42802a,null));};exports['getContacts']=function(_0x2883ce,_0x56543d,_0x52c944){var _0xd7920f;return db[_0xd190('0x33')]['find']({'where':{'id':_0x2883ce[_0xd190('0x4f')]['id']},'include':[{'model':db[_0xd190('0x6d')],'as':_0xd190('0x6e')}]})[_0xd190('0x2a')](handleEntityNotFound(_0x56543d,null))[_0xd190('0x2a')](function(_0x5b59d9){if(_0x5b59d9){_0xd7920f=_0x5b59d9;return db[_0xd190('0x64')][_0xd190('0x34')];}})[_0xd190('0x2a')](function(_0x2e8729){if(_0x2e8729){var _0x6898dc={};var _0x379668={};_0x379668['model']=_['concat'](_['keys'](_0x2e8729),_[_0xd190('0x38')](_0xd7920f[_0xd190('0x6e')],function(_0x4fd700){return util[_0xd190('0x6f')](_0xd190('0x70'),_0x4fd700['id']);}));_0x379668['query']=_[_0xd190('0x3a')](_0x2883ce[_0xd190('0x39')]);_0x379668[_0xd190('0x44')]=_[_0xd190('0x3d')](_0x379668[_0xd190('0x3b')],_0x379668['query']);_0x6898dc[_0xd190('0x3c')]=_['intersection'](_0x379668[_0xd190('0x3b')],qs[_0xd190('0x3e')](_0x2883ce[_0xd190('0x39')][_0xd190('0x3e')]));_0x6898dc[_0xd190('0x3c')]=_0x6898dc[_0xd190('0x3c')][_0xd190('0x3f')]?_0x6898dc['attributes']:_0x379668[_0xd190('0x3b')];if(!_0x2883ce[_0xd190('0x39')]['hasOwnProperty'](_0xd190('0x41'))){_0x6898dc[_0xd190('0x24')]=qs[_0xd190('0x24')](_0x2883ce[_0xd190('0x39')][_0xd190('0x24')]);_0x6898dc['offset']=qs[_0xd190('0x22')](_0x2883ce[_0xd190('0x39')][_0xd190('0x22')]);}_0x6898dc[_0xd190('0x60')]=qs[_0xd190('0x42')](_0x2883ce[_0xd190('0x39')]['sort']);_0x6898dc[_0xd190('0x43')]=qs[_0xd190('0x44')](_[_0xd190('0x71')](_0x2883ce[_0xd190('0x39')],_0x379668[_0xd190('0x44')]));_0x6898dc[_0xd190('0x72')]=!![];if(_0x2883ce[_0xd190('0x39')]['filter']){_0x6898dc[_0xd190('0x43')]=_['merge'](_0x6898dc[_0xd190('0x43')],{'$or':_[_0xd190('0x38')](_0x6898dc[_0xd190('0x3c')],function(_0x1c0792){var _0x119716={};_0x119716[_0x1c0792]={'$like':'%'+_0x2883ce[_0xd190('0x39')]['filter']+'%'};return _0x119716;})});}_0x6898dc=_[_0xd190('0x46')]({},_0x6898dc,_0x2883ce['options']);return _0xd7920f['getContacts'](_0x6898dc);}})[_0xd190('0x2a')](respondWithResult(_0x56543d,null))[_0xd190('0x4d')](handleError(_0x56543d,null));};exports[_0xd190('0x73')]=function(_0x22ea44,_0x3e3fe6,_0x42c81b){var _0x1682ba;return db['CmList'][_0xd190('0x59')]({'where':{'id':_0x22ea44[_0xd190('0x4f')]['id']},'include':[{'model':db[_0xd190('0x6d')],'as':_0xd190('0x6e')}]})[_0xd190('0x2a')](handleEntityNotFound(_0x3e3fe6,null))[_0xd190('0x2a')](function(_0xf5edf6){if(_0xf5edf6){_0x1682ba=_0xf5edf6;return db['CmContact']['rawAttributes'];}})[_0xd190('0x2a')](function(_0x3a3816){if(_0x3a3816){var _0x195111={};var _0x464e44={};_0x464e44['model']=_[_0xd190('0x74')](_[_0xd190('0x3a')](_0x3a3816),_[_0xd190('0x38')](_0x1682ba['CustomFields'],function(_0x42a9a5){return util['format'](_0xd190('0x70'),_0x42a9a5['id']);}));_0x464e44[_0xd190('0x39')]=_[_0xd190('0x3a')](_0x22ea44[_0xd190('0x39')]);_0x464e44['filters']=_[_0xd190('0x3d')](_0x464e44[_0xd190('0x3b')],_0x464e44[_0xd190('0x39')]);_0x195111['attributes']=_['intersection'](_0x464e44[_0xd190('0x3b')],qs[_0xd190('0x3e')](_0x22ea44[_0xd190('0x39')][_0xd190('0x3e')]));_0x195111['attributes']=_0x195111[_0xd190('0x3c')][_0xd190('0x3f')]?_0x195111[_0xd190('0x3c')]:_0x464e44[_0xd190('0x3b')];if(!_0x22ea44[_0xd190('0x39')][_0xd190('0x40')](_0xd190('0x41'))){_0x195111['limit']=qs[_0xd190('0x24')](_0x22ea44[_0xd190('0x39')][_0xd190('0x24')]);_0x195111[_0xd190('0x22')]=qs[_0xd190('0x22')](_0x22ea44[_0xd190('0x39')][_0xd190('0x22')]);}_0x195111[_0xd190('0x60')]=qs['sort'](_0x22ea44['query'][_0xd190('0x42')]);_0x195111[_0xd190('0x43')]=qs[_0xd190('0x44')](_[_0xd190('0x71')](_0x22ea44[_0xd190('0x39')],_0x464e44[_0xd190('0x44')]));_0x195111[_0xd190('0x72')]=!![];if(_0x22ea44['query'][_0xd190('0x45')]){_0x195111['where']=_[_0xd190('0x46')](_0x195111[_0xd190('0x43')],{'$or':_[_0xd190('0x38')](_0x195111[_0xd190('0x3c')],function(_0x51b0cd){var _0x4e0d9d={};_0x4e0d9d[_0x51b0cd]={'$like':'%'+_0x22ea44[_0xd190('0x39')][_0xd190('0x45')]+'%'};return _0x4e0d9d;})});}_0x195111=_[_0xd190('0x46')]({},_0x195111,_0x22ea44['options']);return _0x1682ba[_0xd190('0x75')](_0x195111);}})[_0xd190('0x2a')](function(_0x42efa5){if(!_[_0xd190('0x76')](_0x42efa5)){var _0x3bfae2=toCsv(_0x42efa5);var _0x36ce90=Date[_0xd190('0x77')]();fs['writeFileSync'](util[_0xd190('0x6f')](_0xd190('0x78'),_0x1682ba['id'],_0x36ce90),_0x3bfae2);_0x3e3fe6[_0xd190('0x79')](_0xd190('0x7a'),_0xd190('0x7b')+util[_0xd190('0x6f')]('list_%d_%s.csv',_0x1682ba['id'],_0x36ce90));_0x3e3fe6[_0xd190('0x79')](_0xd190('0x7c'),'text/csv');return _0x3e3fe6[_0xd190('0x7d')](util[_0xd190('0x6f')](_0xd190('0x78'),_0x1682ba['id'],_0x36ce90));}else{return _0x3e3fe6[_0xd190('0x1e')](0xcc);}})['catch'](handleError(_0x3e3fe6,null));};exports[_0xd190('0x7e')]=function(_0x13c358,_0x422d21,_0x34bae8){var _0x1b81d9;delete _0x13c358[_0xd190('0x51')]['id'];return db[_0xd190('0x33')][_0xd190('0x5f')]({'where':{'id':_0x13c358[_0xd190('0x4f')]['id']}})[_0xd190('0x2a')](handleEntityNotFound(_0x422d21,null))['then'](function(_0x2d05f5){if(_0x2d05f5){return db['sequelize'][_0xd190('0x7f')](function(_0x236d49){return db[_0xd190('0x6d')]['create'](_0x13c358[_0xd190('0x51')],{'transaction':_0x236d49})[_0xd190('0x2a')](function(_0x4918dd){_0x1b81d9=_0x4918dd;return _0x2d05f5[_0xd190('0x80')](_0x4918dd,{'transaction':_0x236d49});})[_0xd190('0x2a')](function(){var _0x5e5425={'type':db['Sequelize']['TEXT'],'transaction':_0x236d49};switch(_0x13c358[_0xd190('0x51')][_0xd190('0x36')]){case _0xd190('0x81'):_0x5e5425[_0xd190('0x36')]=db['Sequelize'][_0xd190('0x82')];break;case _0xd190('0x83'):_0x5e5425[_0xd190('0x36')]=db[_0xd190('0x84')][_0xd190('0x85')];break;case _0xd190('0x86'):_0x5e5425[_0xd190('0x36')]=db[_0xd190('0x84')][_0xd190('0x87')];_0x5e5425['defaultValue']=![];break;default:}return db['sequelize'][_0xd190('0x88')]['addColumn'](_0xd190('0x89'),util[_0xd190('0x6f')](_0xd190('0x8a'),_0x1b81d9['id']),_0x5e5425);})['then'](function(){return _0x1b81d9;});});}})[_0xd190('0x2a')](respondWithResult(_0x422d21,null))[_0xd190('0x4d')](handleError(_0x422d21,null));};exports['getCustomFields']=function(_0x286663,_0x3b6172,_0x59fecf){var _0x2ceaba={};var _0x5886e1={};var _0x3cc8c6;var _0x28f4dd;return db[_0xd190('0x33')][_0xd190('0x5f')]({'where':{'id':_0x286663['params']['id']}})[_0xd190('0x2a')](handleEntityNotFound(_0x3b6172,null))[_0xd190('0x2a')](function(_0x592315){if(_0x592315){_0x3cc8c6=_0x592315;_0x5886e1[_0xd190('0x3b')]=_[_0xd190('0x3a')](db[_0xd190('0x6d')][_0xd190('0x34')]);_0x5886e1[_0xd190('0x39')]=_[_0xd190('0x3a')](_0x286663[_0xd190('0x39')]);_0x5886e1['filters']=_[_0xd190('0x3d')](_0x5886e1[_0xd190('0x3b')],_0x5886e1[_0xd190('0x39')]);_0x2ceaba[_0xd190('0x3c')]=_[_0xd190('0x3d')](_0x5886e1['model'],qs[_0xd190('0x3e')](_0x286663[_0xd190('0x39')][_0xd190('0x3e')]));_0x2ceaba[_0xd190('0x3c')]=_0x2ceaba[_0xd190('0x3c')][_0xd190('0x3f')]?_0x2ceaba[_0xd190('0x3c')]:_0x5886e1['model'];_0x2ceaba[_0xd190('0x60')]=qs[_0xd190('0x42')](_0x286663[_0xd190('0x39')]['sort']);_0x2ceaba['where']=qs[_0xd190('0x44')](_['pick'](_0x286663[_0xd190('0x39')],_0x5886e1[_0xd190('0x44')]));_0x2ceaba['where']=_[_0xd190('0x46')](_0x2ceaba[_0xd190('0x43')],{'$or':[{'ListId':_0x592315['id']},{'ListId':null}]});if(_0x286663[_0xd190('0x39')]['filter']){_0x2ceaba[_0xd190('0x43')]=_[_0xd190('0x46')](_0x2ceaba[_0xd190('0x43')],{'$or':_[_0xd190('0x38')](_0x2ceaba['attributes'],function(_0x35013f){var _0x1356f9={};_0x1356f9[_0x35013f]={'$like':'%'+_0x286663[_0xd190('0x39')][_0xd190('0x45')]+'%'};return _0x1356f9;})});}_0x2ceaba=_[_0xd190('0x46')]({},_0x2ceaba,_0x286663[_0xd190('0x48')]);return db[_0xd190('0x6d')][_0xd190('0x8b')](_0x2ceaba);}})[_0xd190('0x2a')](respondWithResult(_0x3b6172,null))[_0xd190('0x4d')](handleError(_0x3b6172,null));};exports[_0xd190('0x8c')]=function(_0x3a63d4,_0x137587,_0x3b6764){return db[_0xd190('0x33')][_0xd190('0x59')]({'where':{'id':_0x3a63d4['params']['id']}})['then'](handleEntityNotFound(_0x137587,null))[_0xd190('0x2a')](function(_0x23106d){if(_0x23106d){return _0x23106d[_0xd190('0x8c')](_0x3a63d4[_0xd190('0x51')][_0xd190('0x62')],_[_0xd190('0x8d')](_0x3a63d4['body'],[_0xd190('0x62'),'id'])||{})[_0xd190('0x8e')](function(_0x2ef88f){for(var _0x27c7b3=0x0;_0x27c7b3<_0x3a63d4[_0xd190('0x51')]['ids'][_0xd190('0x3f')];_0x27c7b3+=0x1){socket[_0xd190('0x8f')](_0xd190('0x90'),{'UserId':Number(_0x3a63d4[_0xd190('0x51')][_0xd190('0x62')][_0x27c7b3]),'CmListId':Number(_0x3a63d4[_0xd190('0x4f')]['id'])});}return _0x2ef88f;});}})[_0xd190('0x2a')](respondWithResult(_0x137587,null))[_0xd190('0x4d')](handleError(_0x137587,null));};exports[_0xd190('0x91')]=function(_0xcde054,_0x4183bf,_0x28d8bf){return db['CmList'][_0xd190('0x59')]({'where':{'id':_0xcde054[_0xd190('0x4f')]['id']}})[_0xd190('0x2a')](handleEntityNotFound(_0x4183bf,null))[_0xd190('0x2a')](function(_0x59e837){if(_0x59e837){return _0x59e837[_0xd190('0x91')](_0xcde054['query'][_0xd190('0x62')])[_0xd190('0x2a')](function(){if(_[_0xd190('0x67')](_0xcde054['query'][_0xd190('0x62')])){for(var _0x3b26b4=0x0;_0x3b26b4<_0xcde054[_0xd190('0x39')][_0xd190('0x62')][_0xd190('0x3f')];_0x3b26b4+=0x1){socket['emit'](_0xd190('0x92'),{'UserId':Number(_0xcde054['query']['ids'][_0x3b26b4]),'CmListId':Number(_0xcde054[_0xd190('0x4f')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0xcde054[_0xd190('0x39')][_0xd190('0x62')]),'CmListId':Number(_0xcde054['params']['id'])});}});}})[_0xd190('0x2a')](respondWithStatusCode(_0x4183bf,null))['catch'](handleError(_0x4183bf,null));};exports[_0xd190('0x93')]=function(_0x2f30ac,_0x45c7b3,_0xbafa87){var _0x6b4d35={};var _0x55cc6d={};var _0x4e7000;var _0x1c11b9;return db[_0xd190('0x33')]['findOne']({'where':{'id':_0x2f30ac[_0xd190('0x4f')]['id']}})['then'](handleEntityNotFound(_0x45c7b3,null))[_0xd190('0x2a')](function(_0x4f9e10){if(_0x4f9e10){_0x4e7000=_0x4f9e10;_0x55cc6d[_0xd190('0x3b')]=_['keys'](db[_0xd190('0x94')][_0xd190('0x34')]);_0x55cc6d[_0xd190('0x39')]=_[_0xd190('0x3a')](_0x2f30ac['query']);_0x55cc6d[_0xd190('0x44')]=_['intersection'](_0x55cc6d[_0xd190('0x3b')],_0x55cc6d['query']);_0x6b4d35[_0xd190('0x3c')]=_[_0xd190('0x3d')](_0x55cc6d['model'],qs[_0xd190('0x3e')](_0x2f30ac[_0xd190('0x39')][_0xd190('0x3e')]));_0x6b4d35['attributes']=_0x6b4d35[_0xd190('0x3c')]['length']?_0x6b4d35[_0xd190('0x3c')]:_0x55cc6d[_0xd190('0x3b')];_0x6b4d35[_0xd190('0x60')]=qs['sort'](_0x2f30ac[_0xd190('0x39')][_0xd190('0x42')]);_0x6b4d35[_0xd190('0x43')]=qs[_0xd190('0x44')](_[_0xd190('0x71')](_0x2f30ac[_0xd190('0x39')],_0x55cc6d['filters']));if(_0x2f30ac[_0xd190('0x39')][_0xd190('0x45')]){_0x6b4d35[_0xd190('0x43')]=_[_0xd190('0x46')](_0x6b4d35[_0xd190('0x43')],{'$or':_[_0xd190('0x38')](_0x6b4d35[_0xd190('0x3c')],function(_0x2746f0){var _0x4c5a69={};_0x4c5a69[_0x2746f0]={'$like':'%'+_0x2f30ac['query'][_0xd190('0x45')]+'%'};return _0x4c5a69;})});}_0x6b4d35=_[_0xd190('0x46')]({},_0x6b4d35,_0x2f30ac[_0xd190('0x48')]);return _0x4e7000[_0xd190('0x93')](_0x6b4d35);}})[_0xd190('0x2a')](function(_0x540c75){if(_0x540c75){_0x1c11b9=_0x540c75['length'];if(!_0x2f30ac[_0xd190('0x39')][_0xd190('0x40')](_0xd190('0x41'))){_0x6b4d35[_0xd190('0x24')]=qs['limit'](_0x2f30ac['query'][_0xd190('0x24')]);_0x6b4d35[_0xd190('0x22')]=qs[_0xd190('0x22')](_0x2f30ac[_0xd190('0x39')][_0xd190('0x22')]);}return _0x4e7000['getAgents'](_0x6b4d35);}})[_0xd190('0x2a')](function(_0x51f297){if(_0x51f297){return _0x51f297?{'count':_0x1c11b9,'rows':_0x51f297}:null;}})[_0xd190('0x2a')](respondWithResult(_0x45c7b3,null))[_0xd190('0x4d')](handleError(_0x45c7b3,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 94d4ac7..20b49c1 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe14b,0x93));var _0xbe14=function(_0x3d7150,_0x9a4779){_0x3d7150=_0x3d7150-0x0;var _0x42dbfe=_0xe14b[_0x3d7150];return _0x42dbfe;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x445fbc,_0x1a17f9){var _0x5762a9=function(_0xdb41b8){while(--_0xdb41b8){_0x445fbc['push'](_0x445fbc['shift']());}};_0x5762a9(++_0x1a17f9);}(_0x7217,0x19e));var _0x7721=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x7217[_0x46aff0];return _0x9d78cf;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 773302f..5e22ee0 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 _0xe5b5=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash'];(function(_0x51fbd7,_0x1ed2eb){var _0x8dd910=function(_0x3bf290){while(--_0x3bf290){_0x51fbd7['push'](_0x51fbd7['shift']());}};_0x8dd910(++_0x1ed2eb);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x7a112,_0x2eb4a0){_0x7a112=_0x7a112-0x0;var _0x136dc5=_0xe5b5[_0x7a112];return _0x136dc5;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var logger=require(_0x5e5b('0x2'))(_0x5e5b('0x3'));var moment=require(_0x5e5b('0x4'));var BPromise=require(_0x5e5b('0x5'));var rp=require(_0x5e5b('0x6'));var fs=require('fs');var path=require(_0x5e5b('0x7'));var rimraf=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var attributes=require(_0x5e5b('0xa'));module[_0x5e5b('0xb')]=function(_0xf1fbe2,_0x11e0e0){return _0xf1fbe2[_0x5e5b('0xc')](_0x5e5b('0xd'),attributes,{'tableName':_0x5e5b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['request-promise','path','./cmList.attributes','define','CmList','cm_lists','../../config/logger','api','moment','bluebird'];(function(_0x345b1b,_0x14f1ef){var _0x36379a=function(_0x2a85b0){while(--_0x2a85b0){_0x345b1b['push'](_0x345b1b['shift']());}};_0x36379a(++_0x14f1ef);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'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 diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 9ccddef..66e92b5 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 _0xe42c=['info','debug','request\x20sent','stringify','error','code','CmList,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','request'];(function(_0x26a901,_0x29dd83){var _0x305c2a=function(_0x54c8f9){while(--_0x54c8f9){_0x26a901['push'](_0x26a901['shift']());}};_0x305c2a(++_0x29dd83);}(_0xe42c,0x171));var _0xce42=function(_0x575fab,_0x361e4c){_0x575fab=_0x575fab-0x0;var _0x5228c3=_0xe42c[_0x575fab];return _0x5228c3;};'use strict';var _=require(_0xce42('0x0'));var util=require(_0xce42('0x1'));var moment=require(_0xce42('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce42('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xce42('0x4'));var logger=require('../../config/logger')(_0xce42('0x5'));var config=require('../../config/environment');var jayson=require(_0xce42('0x6'));var client=jayson[_0xce42('0x7')][_0xce42('0x8')]({'port':0x232a});config[_0xce42('0x9')]=_[_0xce42('0xa')](config[_0xce42('0x9')],{'host':_0xce42('0xb'),'port':0x18eb});var socket=require(_0xce42('0xc'))(new Redis(config[_0xce42('0x9')]));require(_0xce42('0xd'))['register'](socket);function respondWithRpcPromise(_0x28dd81,_0xdb6a37,_0x488e8a){return new BPromise(function(_0x5e4c65,_0x5d55a2){return client[_0xce42('0xe')](_0x28dd81,_0x488e8a)['then'](function(_0x5e192e){logger[_0xce42('0xf')]('CmList,\x20%s,\x20%s',_0xdb6a37,'request\x20sent');logger[_0xce42('0x10')]('CmList,\x20%s,\x20%s,\x20%s',_0xdb6a37,_0xce42('0x11'),JSON[_0xce42('0x12')](_0x5e192e));if(_0x5e192e[_0xce42('0x13')]){if(_0x5e192e[_0xce42('0x13')][_0xce42('0x14')]===0x1f4){logger[_0xce42('0x13')](_0xce42('0x15'),_0xdb6a37,_0x5e192e[_0xce42('0x13')][_0xce42('0x16')]);return _0x5d55a2(_0x5e192e[_0xce42('0x13')]['message']);}logger[_0xce42('0x13')](_0xce42('0x15'),_0xdb6a37,_0x5e192e[_0xce42('0x13')][_0xce42('0x16')]);return _0x5e4c65(_0x5e192e[_0xce42('0x13')][_0xce42('0x16')]);}else{logger[_0xce42('0xf')]('CmList,\x20%s,\x20%s',_0xdb6a37,'request\x20sent');_0x5e4c65(_0x5e192e[_0xce42('0x17')][_0xce42('0x16')]);}})['catch'](function(_0x1cb37e){logger['error']('CmList,\x20%s,\x20%s',_0xdb6a37,_0x1cb37e);_0x5d55a2(_0x1cb37e);});});} \ No newline at end of file +var _0x90f5=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','CmList,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x90f5,0x141));var _0x590f=function(_0x53426c,_0x2f11d8){_0x53426c=_0x53426c-0x0;var _0x1a72c7=_0x90f5[_0x53426c];return _0x1a72c7;};'use strict';var _=require(_0x590f('0x0'));var util=require(_0x590f('0x1'));var moment=require(_0x590f('0x2'));var BPromise=require('bluebird');var rs=require(_0x590f('0x3'));var fs=require('fs');var Redis=require(_0x590f('0x4'));var db=require(_0x590f('0x5'))['db'];var utils=require(_0x590f('0x6'));var logger=require(_0x590f('0x7'))(_0x590f('0x8'));var config=require('../../config/environment');var jayson=require(_0x590f('0x9'));var client=jayson[_0x590f('0xa')][_0x590f('0xb')]({'port':0x232a});config[_0x590f('0xc')]=_[_0x590f('0xd')](config[_0x590f('0xc')],{'host':_0x590f('0xe'),'port':0x18eb});var socket=require(_0x590f('0xf'))(new Redis(config['redis']));require('./cmList.socket')[_0x590f('0x10')](socket);function respondWithRpcPromise(_0x2cd221,_0x3e6790,_0x37ba0b){return new BPromise(function(_0x33e04b,_0x45c9a5){return client[_0x590f('0x11')](_0x2cd221,_0x37ba0b)[_0x590f('0x12')](function(_0x947675){logger['info'](_0x590f('0x13'),_0x3e6790,'request\x20sent');logger[_0x590f('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x3e6790,_0x590f('0x15'),JSON[_0x590f('0x16')](_0x947675));if(_0x947675[_0x590f('0x17')]){if(_0x947675['error'][_0x590f('0x18')]===0x1f4){logger[_0x590f('0x17')]('CmList,\x20%s,\x20%s',_0x3e6790,_0x947675[_0x590f('0x17')][_0x590f('0x19')]);return _0x45c9a5(_0x947675[_0x590f('0x17')]['message']);}logger[_0x590f('0x17')](_0x590f('0x13'),_0x3e6790,_0x947675['error'][_0x590f('0x19')]);return _0x33e04b(_0x947675[_0x590f('0x17')][_0x590f('0x19')]);}else{logger[_0x590f('0x1a')](_0x590f('0x13'),_0x3e6790,'request\x20sent');_0x33e04b(_0x947675[_0x590f('0x1b')][_0x590f('0x19')]);}})[_0x590f('0x1c')](function(_0x1d1171){logger[_0x590f('0x17')](_0x590f('0x13'),_0x3e6790,_0x1d1171);_0x45c9a5(_0x1d1171);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 5a234cd..d7a0877 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 _0x2b3b=['./cmList.events','save','removeListener','register','length','cmList:'];(function(_0x48ad76,_0x173a57){var _0x3d2c22=function(_0x15a421){while(--_0x15a421){_0x48ad76['push'](_0x48ad76['shift']());}};_0x3d2c22(++_0x173a57);}(_0x2b3b,0x84));var _0xb2b3=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x2b3b[_0x48d6a3];return _0x38bfa0;};'use strict';var CmListEvents=require(_0xb2b3('0x0'));var events=[_0xb2b3('0x1'),'remove','update'];function createListener(_0x57dcab,_0x3a931d){return function(_0x120ad5){_0x3a931d['emit'](_0x57dcab,_0x120ad5);};}function removeListener(_0x51db6f,_0x496852){return function(){CmListEvents[_0xb2b3('0x2')](_0x51db6f,_0x496852);};}exports[_0xb2b3('0x3')]=function(_0x48f262){for(var _0x254898=0x0,_0x261948=events[_0xb2b3('0x4')];_0x254898<_0x261948;_0x254898++){var _0x60461a=events[_0x254898];var _0x433d73=createListener(_0xb2b3('0x5')+_0x60461a,_0x48f262);CmListEvents['on'](_0x60461a,_0x433d73);}}; \ No newline at end of file +var _0x52dd=['cmList:','./cmList.events','save','update','emit','register','length'];(function(_0x261c53,_0x497f83){var _0xa39042=function(_0x2673fb){while(--_0x2673fb){_0x261c53['push'](_0x261c53['shift']());}};_0xa39042(++_0x497f83);}(_0x52dd,0x1c8));var _0xd52d=function(_0x542a26,_0x4ad587){_0x542a26=_0x542a26-0x0;var _0x19b9fd=_0x52dd[_0x542a26];return _0x19b9fd;};'use strict';var CmListEvents=require(_0xd52d('0x0'));var events=[_0xd52d('0x1'),'remove',_0xd52d('0x2')];function createListener(_0x18c7ae,_0x1fb417){return function(_0x5f5c3d){_0x1fb417[_0xd52d('0x3')](_0x18c7ae,_0x5f5c3d);};}function removeListener(_0x4e7233,_0x4199a7){return function(){CmListEvents['removeListener'](_0x4e7233,_0x4199a7);};}exports[_0xd52d('0x4')]=function(_0x34cc8c){for(var _0x558794=0x0,_0x2759c1=events[_0xd52d('0x5')];_0x558794<_0x2759c1;_0x558794++){var _0x25dc54=events[_0x558794];var _0xdc32d9=createListener(_0xd52d('0x6')+_0x25dc54,_0x34cc8c);CmListEvents['on'](_0x25dc54,_0xdc32d9);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index ff7215c..ddb2955 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 _0x8e1c=['../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','update','destroy','delete','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x15964e,_0x84c773){var _0x4fc46a=function(_0x118930){while(--_0x118930){_0x15964e['push'](_0x15964e['shift']());}};_0x4fc46a(++_0x84c773);}(_0x8e1c,0x82));var _0xc8e1=function(_0x656b42,_0x4e306b){_0x656b42=_0x656b42-0x0;var _0x4548e4=_0x8e1c[_0x656b42];return _0x4548e4;};'use strict';var multer=require(_0xc8e1('0x0'));var util=require(_0xc8e1('0x1'));var path=require('path');var timeout=require(_0xc8e1('0x2'));var express=require(_0xc8e1('0x3'));var router=express[_0xc8e1('0x4')]();var fs_extra=require(_0xc8e1('0x5'));var auth=require(_0xc8e1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc8e1('0x7'));var controller=require('./cmList.controller');router[_0xc8e1('0x8')]('/',auth[_0xc8e1('0x9')](),controller['index']);router['get'](_0xc8e1('0xa'),auth['isAuthenticated'](),controller[_0xc8e1('0xb')]);router[_0xc8e1('0x8')](_0xc8e1('0xc'),auth[_0xc8e1('0x9')](),controller[_0xc8e1('0xd')]);router[_0xc8e1('0x8')](_0xc8e1('0xe'),auth[_0xc8e1('0x9')](),controller[_0xc8e1('0xf')]);router[_0xc8e1('0x8')](_0xc8e1('0x10'),auth['isAuthenticated'](),controller[_0xc8e1('0x11')]);router[_0xc8e1('0x8')](_0xc8e1('0x12'),auth[_0xc8e1('0x9')](),controller['getContactsCsv']);router['get'](_0xc8e1('0x13'),auth[_0xc8e1('0x9')](),controller[_0xc8e1('0x14')]);router['get'](_0xc8e1('0x15'),auth['isAuthenticated'](),controller[_0xc8e1('0x16')]);router[_0xc8e1('0x17')]('/',auth[_0xc8e1('0x9')](),controller[_0xc8e1('0x18')]);router['post'](_0xc8e1('0xe'),auth[_0xc8e1('0x9')](),controller[_0xc8e1('0x19')]);router['post'](_0xc8e1('0x10'),auth[_0xc8e1('0x9')](),controller['addContacts']);router[_0xc8e1('0x17')]('/:id/fields',auth[_0xc8e1('0x9')](),controller[_0xc8e1('0x1a')]);router[_0xc8e1('0x17')](_0xc8e1('0x15'),auth[_0xc8e1('0x9')](),controller[_0xc8e1('0x1b')]);router['put'](_0xc8e1('0xc'),auth[_0xc8e1('0x9')](),controller[_0xc8e1('0x1c')]);router['delete']('/:id',auth[_0xc8e1('0x9')](),controller[_0xc8e1('0x1d')]);router[_0xc8e1('0x1e')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc8e1('0x1f')]);router[_0xc8e1('0x1e')](_0xc8e1('0x15'),auth[_0xc8e1('0x9')](),controller[_0xc8e1('0x20')]);module[_0xc8e1('0x21')]=router; \ No newline at end of file +var _0x7a1a=['show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','post','create','addContacts','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','/:id'];(function(_0x57680d,_0xed4229){var _0x544fbf=function(_0x26d19c){while(--_0x26d19c){_0x57680d['push'](_0x57680d['shift']());}};_0x544fbf(++_0xed4229);}(_0x7a1a,0x13e));var _0xa7a1=function(_0x4c942c,_0x1b9125){_0x4c942c=_0x4c942c-0x0;var _0x5edf17=_0x7a1a[_0x4c942c];return _0x5edf17;};'use strict';var multer=require('multer');var util=require(_0xa7a1('0x0'));var path=require('path');var timeout=require(_0xa7a1('0x1'));var express=require(_0xa7a1('0x2'));var router=express['Router']();var fs_extra=require(_0xa7a1('0x3'));var auth=require(_0xa7a1('0x4'));var interaction=require(_0xa7a1('0x5'));var config=require(_0xa7a1('0x6'));var controller=require(_0xa7a1('0x7'));router[_0xa7a1('0x8')]('/',auth[_0xa7a1('0x9')](),controller['index']);router[_0xa7a1('0x8')](_0xa7a1('0xa'),auth[_0xa7a1('0x9')](),controller['describe']);router[_0xa7a1('0x8')](_0xa7a1('0xb'),auth['isAuthenticated'](),controller[_0xa7a1('0xc')]);router[_0xa7a1('0x8')](_0xa7a1('0xd'),auth[_0xa7a1('0x9')](),controller[_0xa7a1('0xe')]);router[_0xa7a1('0x8')](_0xa7a1('0xf'),auth[_0xa7a1('0x9')](),controller[_0xa7a1('0x10')]);router[_0xa7a1('0x8')](_0xa7a1('0x11'),auth['isAuthenticated'](),controller[_0xa7a1('0x12')]);router['get'](_0xa7a1('0x13'),auth[_0xa7a1('0x9')](),controller['getCustomFields']);router[_0xa7a1('0x8')](_0xa7a1('0x14'),auth['isAuthenticated'](),controller[_0xa7a1('0x15')]);router[_0xa7a1('0x16')]('/',auth[_0xa7a1('0x9')](),controller[_0xa7a1('0x17')]);router[_0xa7a1('0x16')](_0xa7a1('0xd'),auth[_0xa7a1('0x9')](),controller['addDisposition']);router[_0xa7a1('0x16')](_0xa7a1('0xf'),auth[_0xa7a1('0x9')](),controller[_0xa7a1('0x18')]);router[_0xa7a1('0x16')](_0xa7a1('0x13'),auth[_0xa7a1('0x9')](),controller['addCustomField']);router[_0xa7a1('0x16')](_0xa7a1('0x14'),auth[_0xa7a1('0x9')](),controller[_0xa7a1('0x19')]);router[_0xa7a1('0x1a')](_0xa7a1('0xb'),auth[_0xa7a1('0x9')](),controller[_0xa7a1('0x1b')]);router[_0xa7a1('0x1c')](_0xa7a1('0xb'),auth[_0xa7a1('0x9')](),controller[_0xa7a1('0x1d')]);router['delete']('/:id/dispositions',auth[_0xa7a1('0x9')](),controller[_0xa7a1('0x1e')]);router[_0xa7a1('0x1c')](_0xa7a1('0x14'),auth['isAuthenticated'](),controller[_0xa7a1('0x1f')]);module[_0xa7a1('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 943ac8a..d43d8df 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 _0xcd3a=['getDataValue','field','STRING','exports','VIRTUAL'];(function(_0x10159b,_0x5ac31e){var _0x3d4781=function(_0x5f1b2a){while(--_0x5f1b2a){_0x10159b['push'](_0x10159b['shift']());}};_0x3d4781(++_0x5ac31e);}(_0xcd3a,0x13e));var _0xacd3=function(_0x4c59bb,_0x541c47){_0x4c59bb=_0x4c59bb-0x0;var _0x5b72db=_0xcd3a[_0x4c59bb];return _0x5b72db;};'use strict';var Sequelize=require('sequelize');module[_0xacd3('0x0')]={'name':{'type':Sequelize[_0xacd3('0x1')],'get':function(_0x36deef){return this[_0xacd3('0x2')](_0xacd3('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xacd3('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xacd3('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9002=['field','STRING','exports','VIRTUAL'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x9002,0x116));var _0x2900=function(_0x473a43,_0xd6b677){_0x473a43=_0x473a43-0x0;var _0x584123=_0x9002[_0x473a43];return _0x584123;};'use strict';var Sequelize=require('sequelize');module[_0x2900('0x0')]={'name':{'type':Sequelize[_0x2900('0x1')],'get':function(_0x529ea7){return this['getDataValue'](_0x2900('0x2'));}},'field':{'type':Sequelize[_0x2900('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x2900('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x2900('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 7df596c..5ccc088 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x12c85f,_0x40515d){var _0x120cb8=function(_0x438db4){while(--_0x438db4){_0x12c85f['push'](_0x12c85f['shift']());}};_0x120cb8(++_0x40515d);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _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(_0x2e80d4,_0x7ee551){var _0x5eda9b=function(_0x17e971){while(--_0x17e971){_0x2e80d4['push'](_0x2e80d4['shift']());}};_0x5eda9b(++_0x7ee551);}(_0x7a54,0x106));var _0x47a5=function(_0x4b588f,_0x3f7cf3){_0x4b588f=_0x4b588f-0x0;var _0x3865bb=_0x7a54[_0x4b588f];return _0x3865bb;};'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 55d77e9..ba51e8a 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 _0x1b22=['Condition','tools_conditions','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x214179,_0x3f6b4d){var _0x3af70e=function(_0x1e0983){while(--_0x1e0983){_0x214179['push'](_0x214179['shift']());}};_0x3af70e(++_0x3f6b4d);}(_0x1b22,0x178));var _0x21b2=function(_0x842f30,_0x5a3981){_0x842f30=_0x842f30-0x0;var _0x24caa8=_0x1b22[_0x842f30];return _0x24caa8;};'use strict';var _=require('lodash');var util=require(_0x21b2('0x0'));var logger=require('../../config/logger')(_0x21b2('0x1'));var moment=require('moment');var BPromise=require(_0x21b2('0x2'));var rp=require(_0x21b2('0x3'));var fs=require('fs');var path=require(_0x21b2('0x4'));var rimraf=require(_0x21b2('0x5'));var config=require(_0x21b2('0x6'));var attributes=require(_0x21b2('0x7'));module[_0x21b2('0x8')]=function(_0xc2eab0,_0x4b1c70){return _0xc2eab0['define'](_0x21b2('0x9'),attributes,{'tableName':_0x21b2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7441=['./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5d30f6,_0x13bbdc){var _0x5383f9=function(_0x244db9){while(--_0x244db9){_0x5d30f6['push'](_0x5d30f6['shift']());}};_0x5383f9(++_0x13bbdc);}(_0x7441,0x131));var _0x1744=function(_0x4a73fe,_0x85b091){_0x4a73fe=_0x4a73fe-0x0;var _0x2fdc2e=_0x7441[_0x4a73fe];return _0x2fdc2e;};'use strict';var _=require(_0x1744('0x0'));var util=require(_0x1744('0x1'));var logger=require(_0x1744('0x2'))(_0x1744('0x3'));var moment=require('moment');var BPromise=require(_0x1744('0x4'));var rp=require(_0x1744('0x5'));var fs=require('fs');var path=require(_0x1744('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1744('0x7'));module[_0x1744('0x8')]=function(_0x3d2a8b,_0x33febd){return _0x3d2a8b[_0x1744('0x9')](_0x1744('0xa'),attributes,{'tableName':_0x1744('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 7bc8f6f..e379ecc 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 _0x1c45=['Condition,\x20%s,\x20%s','message','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x123375,_0x77c67a){var _0x470dbb=function(_0x2d3f81){while(--_0x2d3f81){_0x123375['push'](_0x123375['shift']());}};_0x470dbb(++_0x77c67a);}(_0x1c45,0x16b));var _0x51c4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1c45[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x51c4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x51c4('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51c4('0x2'))['db'];var utils=require(_0x51c4('0x3'));var logger=require(_0x51c4('0x4'))(_0x51c4('0x5'));var config=require(_0x51c4('0x6'));var jayson=require(_0x51c4('0x7'));var client=jayson[_0x51c4('0x8')][_0x51c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b6080,_0x52ada5,_0x126fac){return new BPromise(function(_0x58923e,_0x208799){return client[_0x51c4('0xa')](_0x1b6080,_0x126fac)['then'](function(_0x7a5871){logger[_0x51c4('0xb')]('Condition,\x20%s,\x20%s',_0x52ada5,_0x51c4('0xc'));logger[_0x51c4('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x52ada5,_0x51c4('0xc'),JSON[_0x51c4('0xe')](_0x7a5871));if(_0x7a5871[_0x51c4('0xf')]){if(_0x7a5871[_0x51c4('0xf')][_0x51c4('0x10')]===0x1f4){logger[_0x51c4('0xf')](_0x51c4('0x11'),_0x52ada5,_0x7a5871[_0x51c4('0xf')]['message']);return _0x208799(_0x7a5871[_0x51c4('0xf')][_0x51c4('0x12')]);}logger[_0x51c4('0xf')](_0x51c4('0x11'),_0x52ada5,_0x7a5871['error'][_0x51c4('0x12')]);return _0x58923e(_0x7a5871['error']['message']);}else{logger[_0x51c4('0xb')](_0x51c4('0x11'),_0x52ada5,_0x51c4('0xc'));_0x58923e(_0x7a5871['result'][_0x51c4('0x12')]);}})[_0x51c4('0x13')](function(_0x1fb718){logger[_0x51c4('0xf')](_0x51c4('0x11'),_0x52ada5,_0x1fb718);_0x208799(_0x1fb718);});});} \ No newline at end of file +var _0xfec3=['Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0xfec3,0x106));var _0x3fec=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfec3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3fec('0x0'));var util=require(_0x3fec('0x1'));var moment=require(_0x3fec('0x2'));var BPromise=require(_0x3fec('0x3'));var rs=require(_0x3fec('0x4'));var fs=require('fs');var Redis=require(_0x3fec('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3fec('0x6'))(_0x3fec('0x7'));var config=require(_0x3fec('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3fec('0x9')][_0x3fec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42a25a,_0x151c0d,_0x3d2923){return new BPromise(function(_0x340355,_0x48e243){return client[_0x3fec('0xb')](_0x42a25a,_0x3d2923)[_0x3fec('0xc')](function(_0x3a31f9){logger[_0x3fec('0xd')](_0x3fec('0xe'),_0x151c0d,'request\x20sent');logger[_0x3fec('0xf')](_0x3fec('0x10'),_0x151c0d,_0x3fec('0x11'),JSON[_0x3fec('0x12')](_0x3a31f9));if(_0x3a31f9[_0x3fec('0x13')]){if(_0x3a31f9[_0x3fec('0x13')]['code']===0x1f4){logger['error'](_0x3fec('0xe'),_0x151c0d,_0x3a31f9[_0x3fec('0x13')][_0x3fec('0x14')]);return _0x48e243(_0x3a31f9[_0x3fec('0x13')][_0x3fec('0x14')]);}logger[_0x3fec('0x13')]('Condition,\x20%s,\x20%s',_0x151c0d,_0x3a31f9[_0x3fec('0x13')][_0x3fec('0x14')]);return _0x340355(_0x3a31f9['error'][_0x3fec('0x14')]);}else{logger[_0x3fec('0xd')](_0x3fec('0xe'),_0x151c0d,'request\x20sent');_0x340355(_0x3a31f9[_0x3fec('0x15')][_0x3fec('0x14')]);}})[_0x3fec('0x16')](function(_0x384d5e){logger['error'](_0x3fec('0xe'),_0x151c0d,_0x384d5e);_0x48e243(_0x384d5e);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index bc9d2b0..11c79a5 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 _0xb2ad=['../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4d06a4,_0xc49389){var _0x539cfe=function(_0x343f66){while(--_0x343f66){_0x4d06a4['push'](_0x4d06a4['shift']());}};_0x539cfe(++_0xc49389);}(_0xb2ad,0x168));var _0xdb2a=function(_0xfe6b2d,_0x1c2cc7){_0xfe6b2d=_0xfe6b2d-0x0;var _0x18c9c4=_0xb2ad[_0xfe6b2d];return _0x18c9c4;};'use strict';var multer=require(_0xdb2a('0x0'));var util=require(_0xdb2a('0x1'));var path=require(_0xdb2a('0x2'));var timeout=require(_0xdb2a('0x3'));var express=require(_0xdb2a('0x4'));var router=express['Router']();var fs_extra=require(_0xdb2a('0x5'));var auth=require(_0xdb2a('0x6'));var interaction=require(_0xdb2a('0x7'));var config=require(_0xdb2a('0x8'));var controller=require(_0xdb2a('0x9'));router[_0xdb2a('0xa')](_0xdb2a('0xb'),auth[_0xdb2a('0xc')](),controller[_0xdb2a('0xd')]);router[_0xdb2a('0xe')]('/:id',auth[_0xdb2a('0xc')](),controller['destroy']);module[_0xdb2a('0xf')]=router; \ No newline at end of file +var _0x1006=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','delete','destroy','exports','multer','util','path'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0x1006,0xed));var _0x6100=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x1006[_0x1e7b16];return _0x37fadc;};'use strict';var multer=require(_0x6100('0x0'));var util=require(_0x6100('0x1'));var path=require(_0x6100('0x2'));var timeout=require(_0x6100('0x3'));var express=require('express');var router=express[_0x6100('0x4')]();var fs_extra=require(_0x6100('0x5'));var auth=require(_0x6100('0x6'));var interaction=require(_0x6100('0x7'));var config=require(_0x6100('0x8'));var controller=require('./condition.controller');router[_0x6100('0x9')](_0x6100('0xa'),auth[_0x6100('0xb')](),controller['update']);router[_0x6100('0xc')]('/:id',auth[_0x6100('0xb')](),controller[_0x6100('0xd')]);module[_0x6100('0xe')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index f2a744e..c13eaf1 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 _0xbaf0=['name','exports','STRING'];(function(_0x1f7201,_0x141b79){var _0x289fd2=function(_0x20ce23){while(--_0x20ce23){_0x1f7201['push'](_0x1f7201['shift']());}};_0x289fd2(++_0x141b79);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x212eae,_0x192ec4){var _0x55b588=function(_0x478f9c){while(--_0x478f9c){_0x212eae['push'](_0x212eae['shift']());}};_0x55b588(++_0x192ec4);}(_0x2032,0xd9));var _0x2203=function(_0x5caa25,_0x2ad222){_0x5caa25=_0x5caa25-0x0;var _0x143aa8=_0x2032[_0x5caa25];return _0x143aa8;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index aa0ea64..f9c5260 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 _0xbea9=['../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./dashboard.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','map','Dashboard','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','rawAttributes','createdAt','updatedAt','omit','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','findOne','getItems','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x534deb,_0x21de0c){var _0x1b3238=function(_0x5a5406){while(--_0x5a5406){_0x534deb['push'](_0x534deb['shift']());}};_0x1b3238(++_0x21de0c);}(_0xbea9,0xe0));var _0x9bea=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbea9[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require(_0x9bea('0x0'));var rimraf=require(_0x9bea('0x1'));var zipdir=require(_0x9bea('0x2'));var jsonpatch=require(_0x9bea('0x3'));var rp=require(_0x9bea('0x4'));var moment=require('moment');var BPromise=require(_0x9bea('0x5'));var Mustache=require(_0x9bea('0x6'));var util=require('util');var path=require(_0x9bea('0x7'));var sox=require(_0x9bea('0x8'));var csv=require('to-csv');var ejs=require(_0x9bea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9bea('0xa'));var squel=require(_0x9bea('0xb'));var crypto=require(_0x9bea('0xc'));var jsforce=require(_0x9bea('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9bea('0xe'));var querystring=require(_0x9bea('0xf'));var Papa=require('papaparse');var Redis=require(_0x9bea('0x10'));var authService=require(_0x9bea('0x11'));var qs=require(_0x9bea('0x12'));var as=require(_0x9bea('0x13'));var hardwareService=require(_0x9bea('0x14'));var logger=require('../../config/logger')(_0x9bea('0x15'));var utils=require(_0x9bea('0x16'));var config=require(_0x9bea('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x9bea('0x18'))['db'];config['redis']=_[_0x9bea('0x19')](config[_0x9bea('0x1a')],{'host':_0x9bea('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9bea('0x1a')]));require(_0x9bea('0x1c'))[_0x9bea('0x1d')](socket);function respondWithStatusCode(_0x3fbe5a,_0x17bbaf){_0x17bbaf=_0x17bbaf||0xcc;return function(_0x5be389){if(_0x5be389){return _0x3fbe5a[_0x9bea('0x1e')](_0x17bbaf);}return _0x3fbe5a[_0x9bea('0x1f')](_0x17bbaf)[_0x9bea('0x20')]();};}function respondWithResult(_0x4129e4,_0x317172){_0x317172=_0x317172||0xc8;return function(_0x57541e){if(_0x57541e){return _0x4129e4[_0x9bea('0x1f')](_0x317172)[_0x9bea('0x21')](_0x57541e);}};}function respondWithFilteredResult(_0xcf8e17,_0x118cb2){return function(_0x237d2e){if(_0x237d2e){var _0x15d515=typeof _0x118cb2['offset']===_0x9bea('0x22')&&typeof _0x118cb2[_0x9bea('0x23')]===_0x9bea('0x22');var _0x20deb4=_0x237d2e[_0x9bea('0x24')];var _0x2b593a=_0x15d515?0x0:_0x118cb2[_0x9bea('0x25')];var _0x528e24=_0x15d515?_0x237d2e['count']:_0x118cb2['offset']+_0x118cb2['limit'];var _0x190c99;if(_0x528e24>=_0x20deb4){_0x528e24=_0x20deb4;_0x190c99=0xc8;}else{_0x190c99=0xce;}_0xcf8e17['status'](_0x190c99);return _0xcf8e17[_0x9bea('0x26')](_0x9bea('0x27'),_0x2b593a+'-'+_0x528e24+'/'+_0x20deb4)[_0x9bea('0x21')](_0x237d2e);}return null;};}function patchUpdates(_0x587010){return function(_0x24b061){try{jsonpatch[_0x9bea('0x28')](_0x24b061,_0x587010,!![]);}catch(_0x565db2){return BPromise[_0x9bea('0x29')](_0x565db2);}return _0x24b061[_0x9bea('0x2a')]();};}function saveUpdates(_0x26305f,_0x27716e){return function(_0x3a8c74){if(_0x3a8c74){return _0x3a8c74[_0x9bea('0x2b')](_0x26305f)[_0x9bea('0x2c')](function(_0x3aa46e){return _0x3aa46e;});}return null;};}function removeEntity(_0x335ac6,_0x5d8a2e){return function(_0x23d036){if(_0x23d036){return _0x23d036[_0x9bea('0x2d')]()[_0x9bea('0x2c')](function(){var _0x283944=_0x23d036[_0x9bea('0x2e')]({'plain':!![]});var _0x582c29=_0x9bea('0x2f');return db[_0x9bea('0x30')][_0x9bea('0x2d')]({'where':{'type':_0x582c29,'resourceId':_0x283944['id']}})[_0x9bea('0x2c')](function(){return _0x23d036;});})[_0x9bea('0x2c')](function(){_0x335ac6['status'](0xcc)[_0x9bea('0x20')]();});}};}function handleEntityNotFound(_0x3301cb,_0x5e3c3b){return function(_0x21a7f2){if(!_0x21a7f2){_0x3301cb[_0x9bea('0x1e')](0x194);}return _0x21a7f2;};}function handleError(_0x43187b,_0x43e76a){_0x43e76a=_0x43e76a||0x1f4;return function(_0x3e0f9f){logger[_0x9bea('0x31')](_0x3e0f9f[_0x9bea('0x32')]);if(_0x3e0f9f[_0x9bea('0x33')]){delete _0x3e0f9f[_0x9bea('0x33')];}_0x43187b['status'](_0x43e76a)[_0x9bea('0x34')](_0x3e0f9f);};}exports['index']=function(_0x45c5f3,_0x483baf){var _0x2abe76={},_0x378dba={},_0x4d461b={'count':0x0,'rows':[]};var _0x3e49f2=_[_0x9bea('0x35')](db[_0x9bea('0x36')]['rawAttributes'],function(_0x5c86d8){return{'name':_0x5c86d8[_0x9bea('0x37')],'type':_0x5c86d8[_0x9bea('0x38')][_0x9bea('0x39')]};});_0x378dba[_0x9bea('0x3a')]=_['map'](_0x3e49f2,'name');_0x378dba[_0x9bea('0x3b')]=_[_0x9bea('0x3c')](_0x45c5f3[_0x9bea('0x3b')]);_0x378dba[_0x9bea('0x3d')]=_[_0x9bea('0x3e')](_0x378dba[_0x9bea('0x3a')],_0x378dba['query']);_0x2abe76[_0x9bea('0x3f')]=_[_0x9bea('0x3e')](_0x378dba[_0x9bea('0x3a')],qs[_0x9bea('0x40')](_0x45c5f3[_0x9bea('0x3b')]['fields']));_0x2abe76[_0x9bea('0x3f')]=_0x2abe76[_0x9bea('0x3f')][_0x9bea('0x41')]?_0x2abe76[_0x9bea('0x3f')]:_0x378dba[_0x9bea('0x3a')];if(!_0x45c5f3[_0x9bea('0x3b')][_0x9bea('0x42')]('nolimit')){_0x2abe76[_0x9bea('0x23')]=qs[_0x9bea('0x23')](_0x45c5f3[_0x9bea('0x3b')][_0x9bea('0x23')]);_0x2abe76['offset']=qs[_0x9bea('0x25')](_0x45c5f3[_0x9bea('0x3b')][_0x9bea('0x25')]);}_0x2abe76[_0x9bea('0x43')]=qs['sort'](_0x45c5f3['query'][_0x9bea('0x44')]);_0x2abe76[_0x9bea('0x45')]=qs[_0x9bea('0x3d')](_[_0x9bea('0x46')](_0x45c5f3[_0x9bea('0x3b')],_0x378dba[_0x9bea('0x3d')]),_0x3e49f2);if(_0x45c5f3['query']['filter']){_0x2abe76['where']=_[_0x9bea('0x47')](_0x2abe76[_0x9bea('0x45')],{'$or':_[_0x9bea('0x35')](_0x3e49f2,function(_0x518cc4){if(_0x518cc4[_0x9bea('0x38')]!==_0x9bea('0x48')){var _0x384aba={};_0x384aba[_0x518cc4['name']]={'$like':'%'+_0x45c5f3['query'][_0x9bea('0x49')]+'%'};return _0x384aba;}})});}_0x2abe76=_[_0x9bea('0x47')]({},_0x2abe76,_0x45c5f3[_0x9bea('0x4a')]);var _0x142acb={'where':_0x2abe76[_0x9bea('0x45')]};return db[_0x9bea('0x36')][_0x9bea('0x24')](_0x142acb)[_0x9bea('0x2c')](function(_0x3ee26e){_0x4d461b[_0x9bea('0x24')]=_0x3ee26e;if(_0x45c5f3['query'][_0x9bea('0x4b')]){_0x2abe76['include']=[{'all':!![]}];}return db[_0x9bea('0x36')]['findAll'](_0x2abe76);})[_0x9bea('0x2c')](function(_0x5c48c6){_0x4d461b['rows']=_0x5c48c6;return _0x4d461b;})[_0x9bea('0x2c')](respondWithFilteredResult(_0x483baf,_0x2abe76))['catch'](handleError(_0x483baf,null));};exports[_0x9bea('0x4c')]=function(_0xe0f6d7,_0x5f973f){var _0x344e0f={'raw':![],'where':{'id':_0xe0f6d7[_0x9bea('0x4d')]['id']}},_0x53d07f={};_0x53d07f[_0x9bea('0x3a')]=_[_0x9bea('0x3c')](db[_0x9bea('0x36')]['rawAttributes']);_0x53d07f[_0x9bea('0x3b')]=_['keys'](_0xe0f6d7[_0x9bea('0x3b')]);_0x53d07f[_0x9bea('0x3d')]=_[_0x9bea('0x3e')](_0x53d07f['model'],_0x53d07f[_0x9bea('0x3b')]);_0x344e0f['attributes']=_[_0x9bea('0x3e')](_0x53d07f[_0x9bea('0x3a')],qs[_0x9bea('0x40')](_0xe0f6d7[_0x9bea('0x3b')][_0x9bea('0x40')]));_0x344e0f[_0x9bea('0x3f')]=_0x344e0f[_0x9bea('0x3f')]['length']?_0x344e0f[_0x9bea('0x3f')]:_0x53d07f[_0x9bea('0x3a')];if(_0xe0f6d7[_0x9bea('0x3b')][_0x9bea('0x4b')]){_0x344e0f[_0x9bea('0x4e')]=[{'all':!![]}];}_0x344e0f=_[_0x9bea('0x47')]({},_0x344e0f,_0xe0f6d7[_0x9bea('0x4a')]);return db[_0x9bea('0x36')][_0x9bea('0x4f')](_0x344e0f)[_0x9bea('0x2c')](handleEntityNotFound(_0x5f973f,null))[_0x9bea('0x2c')](respondWithResult(_0x5f973f,null))[_0x9bea('0x50')](handleError(_0x5f973f,null));};exports['create']=function(_0x280581,_0x475bcf){return db['Dashboard'][_0x9bea('0x51')](_0x280581[_0x9bea('0x52')],{})[_0x9bea('0x2c')](function(_0x198e62){var _0x55da8c=_0x280581[_0x9bea('0x53')][_0x9bea('0x2e')]({'plain':!![]});if(!_0x55da8c)throw new Error(_0x9bea('0x54'));if(_0x55da8c[_0x9bea('0x55')]===_0x9bea('0x53')){var _0x4973d7=_0x198e62[_0x9bea('0x2e')]({'plain':!![]});var _0x161f7b=_0x9bea('0x2f');return db[_0x9bea('0x56')][_0x9bea('0x4f')]({'where':{'name':_0x161f7b,'userProfileId':_0x55da8c[_0x9bea('0x57')]},'raw':!![]})['then'](function(_0x50a016){if(_0x50a016&&_0x50a016[_0x9bea('0x58')]===0x0){return db['UserProfileResource'][_0x9bea('0x51')]({'name':_0x4973d7['name'],'resourceId':_0x4973d7['id'],'type':_0x50a016['name'],'sectionId':_0x50a016['id']},{})[_0x9bea('0x2c')](function(){return _0x198e62;});}else{return _0x198e62;}})['catch'](function(_0x1883b0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1883b0);throw _0x1883b0;});}return _0x198e62;})[_0x9bea('0x2c')](respondWithResult(_0x475bcf,0xc9))['catch'](handleError(_0x475bcf,null));};exports[_0x9bea('0x59')]=function(_0x21ec0c,_0x4249c){var _0x9a8ea7={'where':{'id':_0x21ec0c[_0x9bea('0x4d')]['id']}},_0x4502b8={};_0x4502b8[_0x9bea('0x3a')]=_[_0x9bea('0x3c')](db[_0x9bea('0x36')][_0x9bea('0x5a')]);_0x9a8ea7[_0x9bea('0x3f')]=_[_0x9bea('0x3e')](_0x4502b8[_0x9bea('0x3a')],qs[_0x9bea('0x40')](_0x21ec0c[_0x9bea('0x3b')][_0x9bea('0x40')]));_0x9a8ea7[_0x9bea('0x3f')]=_0x9a8ea7['attributes']['length']?_0x9a8ea7[_0x9bea('0x3f')]:_0x4502b8[_0x9bea('0x3a')];if(_0x21ec0c['query'][_0x9bea('0x4b')]){_0x9a8ea7[_0x9bea('0x4e')]=[{'all':!![]}];}_0x9a8ea7=_['merge']({},_0x9a8ea7,_0x21ec0c['options']);return db[_0x9bea('0x36')]['find'](_0x9a8ea7)['then'](handleEntityNotFound(_0x4249c,null))[_0x9bea('0x2c')](function(_0x1c145b){if(_0x1c145b){var _0xbf4203=_0x1c145b['get']({'plain':!![]});_0xbf4203=qs['omit'](_0xbf4203,['id',_0x9bea('0x5b'),_0x9bea('0x5c')]);_0x21ec0c[_0x9bea('0x52')]=_[_0x9bea('0x5d')](_0x21ec0c[_0x9bea('0x52')],['id',_0x9bea('0x5b'),_0x9bea('0x5c')]);return db[_0x9bea('0x36')]['create'](_[_0x9bea('0x47')](_0xbf4203,_0x21ec0c[_0x9bea('0x52')]),{'include':_0x21ec0c[_0x9bea('0x3b')][_0x9bea('0x4b')]?[{'all':!![]}]:undefined})[_0x9bea('0x2c')](function(_0x468250){var _0x3b55bd=_0x21ec0c[_0x9bea('0x53')][_0x9bea('0x2e')]({'plain':!![]});if(!_0x3b55bd)throw new Error(_0x9bea('0x54'));if(_0x3b55bd[_0x9bea('0x55')]===_0x9bea('0x53')){var _0x2f5fad=_0x468250['get']({'plain':!![]});var _0x43a0c6=_0x9bea('0x2f');return db['UserProfileSection'][_0x9bea('0x4f')]({'where':{'name':_0x43a0c6,'userProfileId':_0x3b55bd['userProfileId']},'raw':!![]})[_0x9bea('0x2c')](function(_0x1c402e){if(_0x1c402e&&_0x1c402e[_0x9bea('0x58')]===0x0){return db[_0x9bea('0x30')][_0x9bea('0x51')]({'name':_0x2f5fad['name'],'resourceId':_0x2f5fad['id'],'type':_0x1c402e[_0x9bea('0x33')],'sectionId':_0x1c402e['id']},{})['then'](function(){return _0x468250;});}else{return _0x468250;}})[_0x9bea('0x50')](function(_0x1b7c57){logger[_0x9bea('0x31')](_0x9bea('0x5e'),_0x1b7c57);throw _0x1b7c57;});}return _0x468250;});}})[_0x9bea('0x2c')](respondWithResult(_0x4249c,0xc9))[_0x9bea('0x50')](handleError(_0x4249c,null));};exports[_0x9bea('0x2b')]=function(_0x4ba644,_0x6e9fb2){if(_0x4ba644[_0x9bea('0x52')]['id']){delete _0x4ba644[_0x9bea('0x52')]['id'];}return db[_0x9bea('0x36')][_0x9bea('0x4f')]({'where':{'id':_0x4ba644[_0x9bea('0x4d')]['id']}})['then'](handleEntityNotFound(_0x6e9fb2,null))[_0x9bea('0x2c')](saveUpdates(_0x4ba644[_0x9bea('0x52')],null))[_0x9bea('0x2c')](respondWithResult(_0x6e9fb2,null))[_0x9bea('0x50')](handleError(_0x6e9fb2,null));};exports[_0x9bea('0x2d')]=function(_0x37b753,_0x1d3bf9){return db['Dashboard'][_0x9bea('0x4f')]({'where':{'id':_0x37b753[_0x9bea('0x4d')]['id']}})[_0x9bea('0x2c')](handleEntityNotFound(_0x1d3bf9,null))[_0x9bea('0x2c')](removeEntity(_0x1d3bf9,null))['catch'](handleError(_0x1d3bf9,null));};function widgetAttributes(_0x24f8f6){try{switch(_0x24f8f6[_0x9bea('0x38')]){case _0x9bea('0x5f'):return[{'name':_0x9bea('0x60'),'value':_0x24f8f6[_0x9bea('0x60')]||(_0x24f8f6[_0x9bea('0x61')]&&_0x24f8f6[_0x9bea('0x61')][0x0]?_0x24f8f6[_0x9bea('0x61')][0x0][_0x9bea('0x62')]:undefined)||'https://'}];case _0x9bea('0x63'):return[{'name':'attrPath','value':_0x24f8f6[_0x9bea('0x64')]||(_0x24f8f6['attrs']&&_0x24f8f6[_0x9bea('0x61')][0x0]?_0x24f8f6[_0x9bea('0x61')][0x0][_0x9bea('0x62')]:undefined)||''}];case _0x9bea('0x65'):return[{'name':_0x9bea('0x66'),'value':_0x24f8f6['attrHourFormat']||(_0x24f8f6[_0x9bea('0x61')]&&_0x24f8f6[_0x9bea('0x61')][0x0]?_0x24f8f6[_0x9bea('0x61')][0x0][_0x9bea('0x62')]:undefined)||_0x9bea('0x67')},{'name':_0x9bea('0x68'),'value':_0x24f8f6[_0x9bea('0x68')]||(_0x24f8f6[_0x9bea('0x61')]&&_0x24f8f6[_0x9bea('0x61')][0x1]?_0x24f8f6[_0x9bea('0x61')][0x1][_0x9bea('0x62')]:undefined)||_0x9bea('0x69')},{'name':_0x9bea('0x6a'),'value':_0x24f8f6[_0x9bea('0x6a')]||(_0x24f8f6[_0x9bea('0x61')]&&_0x24f8f6['attrs'][0x2]?_0x24f8f6[_0x9bea('0x61')][0x2][_0x9bea('0x62')]:undefined)||0xc}];case _0x9bea('0x6b'):return[{'name':_0x9bea('0x6c'),'value':_0x24f8f6[_0x9bea('0x6c')]||(_0x24f8f6[_0x9bea('0x61')]&&_0x24f8f6[_0x9bea('0x61')][0x0]?_0x24f8f6['attrs'][0x0][_0x9bea('0x62')]:undefined)||_0x9bea('0x6d')},{'name':_0x9bea('0x6e'),'value':_0x24f8f6['attrVoiceQueues']||(_0x24f8f6[_0x9bea('0x61')]&&_0x24f8f6[_0x9bea('0x61')][0x1]?_0x24f8f6[_0x9bea('0x61')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x24f8f6[_0x9bea('0x6a')]||(_0x24f8f6[_0x9bea('0x61')]&&_0x24f8f6[_0x9bea('0x61')][0x2]?_0x24f8f6[_0x9bea('0x61')][0x2][_0x9bea('0x62')]:undefined)||0x14}];case _0x9bea('0x6f'):case _0x9bea('0x70'):return[{'name':_0x9bea('0x71'),'value':_0x24f8f6['attrSerie1']||(_0x24f8f6[_0x9bea('0x61')]&&_0x24f8f6[_0x9bea('0x61')][0x0]?_0x24f8f6['attrs'][0x0][_0x9bea('0x62')]:undefined)||'total'},{'name':'attrSerie2','value':_0x24f8f6['attrSerie2']||(_0x24f8f6['attrs']&&_0x24f8f6[_0x9bea('0x61')][0x1]?_0x24f8f6[_0x9bea('0x61')][0x1][_0x9bea('0x62')]:undefined)||null},{'name':'attrSerie3','value':_0x24f8f6['attrSerie3']||(_0x24f8f6[_0x9bea('0x61')]&&_0x24f8f6[_0x9bea('0x61')][0x2]?_0x24f8f6[_0x9bea('0x61')][0x2][_0x9bea('0x62')]:undefined)||null},{'name':_0x9bea('0x6e'),'value':_0x24f8f6[_0x9bea('0x6e')]||(_0x24f8f6[_0x9bea('0x61')]&&_0x24f8f6[_0x9bea('0x61')][0x3]?_0x24f8f6[_0x9bea('0x61')][0x3][_0x9bea('0x62')]:undefined)||[]}];case'web-report':return[{'name':_0x9bea('0x72'),'type':_0x24f8f6[_0x9bea('0x73')]||(_0x24f8f6['attrs']&&_0x24f8f6['attrs'][0x0]?_0x24f8f6['attrs'][0x0][_0x9bea('0x38')]:undefined)||null,'value':_0x24f8f6['attrReport']||(_0x24f8f6[_0x9bea('0x61')]&&_0x24f8f6['attrs'][0x0]?_0x24f8f6[_0x9bea('0x61')][0x0][_0x9bea('0x62')]:undefined)||null},{'name':_0x9bea('0x74'),'value':_0x24f8f6[_0x9bea('0x74')]||(_0x24f8f6[_0x9bea('0x61')]&&_0x24f8f6[_0x9bea('0x61')][0x1]?_0x24f8f6[_0x9bea('0x61')][0x1][_0x9bea('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x5aedeb){logger[_0x9bea('0x31')](_0x9bea('0x75'),JSON['stringify'](_0x5aedeb));return[];}}exports['addItem']=function(_0x2d29bd,_0x1f8c18,_0x541e04){if(_0x2d29bd[_0x9bea('0x52')]['id']){delete _0x2d29bd[_0x9bea('0x52')]['id'];}return db[_0x9bea('0x36')]['find']({'where':{'id':_0x2d29bd[_0x9bea('0x4d')]['id']}})[_0x9bea('0x2c')](handleEntityNotFound(_0x1f8c18,null))['then'](function(_0x1204cb){if(_0x1204cb){_0x2d29bd[_0x9bea('0x52')][_0x9bea('0x76')]=_0x1204cb['id'];_0x2d29bd[_0x9bea('0x52')][_0x9bea('0x61')]=widgetAttributes(_0x2d29bd['body']);return db[_0x9bea('0x77')][_0x9bea('0x51')](_0x2d29bd[_0x9bea('0x52')]);}})[_0x9bea('0x2c')](respondWithResult(_0x1f8c18,null))[_0x9bea('0x50')](handleError(_0x1f8c18,null));};exports['getItems']=function(_0x14fd64,_0x570ee6,_0x48344f){var _0x178558={};var _0x186c26={};var _0x3cfe29;var _0x3024a5;return db[_0x9bea('0x36')][_0x9bea('0x78')]({'where':{'id':_0x14fd64[_0x9bea('0x4d')]['id']}})[_0x9bea('0x2c')](handleEntityNotFound(_0x570ee6,null))['then'](function(_0x25fe0f){if(_0x25fe0f){_0x3cfe29=_0x25fe0f;_0x186c26[_0x9bea('0x3a')]=_[_0x9bea('0x3c')](db[_0x9bea('0x77')]['rawAttributes']);_0x186c26[_0x9bea('0x3b')]=_[_0x9bea('0x3c')](_0x14fd64[_0x9bea('0x3b')]);_0x186c26[_0x9bea('0x3d')]=_[_0x9bea('0x3e')](_0x186c26[_0x9bea('0x3a')],_0x186c26[_0x9bea('0x3b')]);_0x178558[_0x9bea('0x3f')]=_[_0x9bea('0x3e')](_0x186c26[_0x9bea('0x3a')],qs[_0x9bea('0x40')](_0x14fd64[_0x9bea('0x3b')][_0x9bea('0x40')]));_0x178558['attributes']=_0x178558[_0x9bea('0x3f')][_0x9bea('0x41')]?_0x178558[_0x9bea('0x3f')]:_0x186c26['model'];_0x178558[_0x9bea('0x43')]=qs[_0x9bea('0x44')](_0x14fd64[_0x9bea('0x3b')][_0x9bea('0x44')]);_0x178558[_0x9bea('0x45')]=qs[_0x9bea('0x3d')](_[_0x9bea('0x46')](_0x14fd64[_0x9bea('0x3b')],_0x186c26[_0x9bea('0x3d')]));if(_0x14fd64[_0x9bea('0x3b')][_0x9bea('0x49')]){_0x178558['where']=_['merge'](_0x178558['where'],{'$or':_['map'](_0x178558['attributes'],function(_0x376922){var _0x3df55f={};_0x3df55f[_0x376922]={'$like':'%'+_0x14fd64[_0x9bea('0x3b')][_0x9bea('0x49')]+'%'};return _0x3df55f;})});}_0x178558=_[_0x9bea('0x47')]({},_0x178558,_0x14fd64['options']);return _0x3cfe29[_0x9bea('0x79')](_0x178558);}})['then'](function(_0x5ca46b){if(_0x5ca46b){_0x3024a5=_0x5ca46b[_0x9bea('0x41')];if(!_0x14fd64[_0x9bea('0x3b')]['hasOwnProperty'](_0x9bea('0x7a'))){_0x178558[_0x9bea('0x23')]=qs[_0x9bea('0x23')](_0x14fd64[_0x9bea('0x3b')][_0x9bea('0x23')]);_0x178558['offset']=qs[_0x9bea('0x25')](_0x14fd64[_0x9bea('0x3b')][_0x9bea('0x25')]);}return _0x3cfe29['getItems'](_0x178558);}})[_0x9bea('0x2c')](function(_0xa364d6){if(_0xa364d6){return _0xa364d6?{'count':_0x3024a5,'rows':_0xa364d6}:null;}})['then'](respondWithResult(_0x570ee6,null))['catch'](handleError(_0x570ee6,null));}; \ No newline at end of file +var _0x8cab=['attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','update','destroy','then','get','CustomDashboards','UserProfileResource','error','name','send','index','map','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','filter','options','Dashboard','includeAll','include','findAll','rows','catch','find','create','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','attrUrl','attrs','value','custom','attrPath','attrHourFormat','attrTimezone','0.00','attrFontSize','counter'];(function(_0x357f21,_0x238c8f){var _0xbef34b=function(_0x6001c9){while(--_0x6001c9){_0x357f21['push'](_0x357f21['shift']());}};_0xbef34b(++_0x238c8f);}(_0x8cab,0xfa));var _0xb8ca=function(_0x5bafcc,_0x584a63){_0x5bafcc=_0x5bafcc-0x0;var _0x1cd8ab=_0x8cab[_0x5bafcc];return _0x1cd8ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb8ca('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb8ca('0x1'));var rp=require(_0xb8ca('0x2'));var moment=require('moment');var BPromise=require(_0xb8ca('0x3'));var Mustache=require(_0xb8ca('0x4'));var util=require(_0xb8ca('0x5'));var path=require(_0xb8ca('0x6'));var sox=require(_0xb8ca('0x7'));var csv=require(_0xb8ca('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8ca('0x9'));var squel=require(_0xb8ca('0xa'));var crypto=require(_0xb8ca('0xb'));var jsforce=require(_0xb8ca('0xc'));var deskjs=require(_0xb8ca('0xd'));var toCsv=require(_0xb8ca('0x8'));var querystring=require(_0xb8ca('0xe'));var Papa=require(_0xb8ca('0xf'));var Redis=require(_0xb8ca('0x10'));var authService=require(_0xb8ca('0x11'));var qs=require(_0xb8ca('0x12'));var as=require(_0xb8ca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8ca('0x14'))(_0xb8ca('0x15'));var utils=require(_0xb8ca('0x16'));var config=require(_0xb8ca('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb8ca('0x18'))['db'];config[_0xb8ca('0x19')]=_[_0xb8ca('0x1a')](config[_0xb8ca('0x19')],{'host':_0xb8ca('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb8ca('0x19')]));require(_0xb8ca('0x1c'))[_0xb8ca('0x1d')](socket);function respondWithStatusCode(_0xf87a62,_0x1947a3){_0x1947a3=_0x1947a3||0xcc;return function(_0x436124){if(_0x436124){return _0xf87a62[_0xb8ca('0x1e')](_0x1947a3);}return _0xf87a62[_0xb8ca('0x1f')](_0x1947a3)[_0xb8ca('0x20')]();};}function respondWithResult(_0x43db3e,_0x505465){_0x505465=_0x505465||0xc8;return function(_0x40efb6){if(_0x40efb6){return _0x43db3e[_0xb8ca('0x1f')](_0x505465)[_0xb8ca('0x21')](_0x40efb6);}};}function respondWithFilteredResult(_0x183485,_0x5938ce){return function(_0x3f3bc1){if(_0x3f3bc1){var _0x38961f=typeof _0x5938ce['offset']===_0xb8ca('0x22')&&typeof _0x5938ce[_0xb8ca('0x23')]==='undefined';var _0x275d9d=_0x3f3bc1['count'];var _0x29c496=_0x38961f?0x0:_0x5938ce[_0xb8ca('0x24')];var _0x232649=_0x38961f?_0x3f3bc1[_0xb8ca('0x25')]:_0x5938ce[_0xb8ca('0x24')]+_0x5938ce[_0xb8ca('0x23')];var _0x426e9a;if(_0x232649>=_0x275d9d){_0x232649=_0x275d9d;_0x426e9a=0xc8;}else{_0x426e9a=0xce;}_0x183485[_0xb8ca('0x1f')](_0x426e9a);return _0x183485[_0xb8ca('0x26')]('Content-Range',_0x29c496+'-'+_0x232649+'/'+_0x275d9d)[_0xb8ca('0x21')](_0x3f3bc1);}return null;};}function patchUpdates(_0x4a7917){return function(_0x416265){try{jsonpatch[_0xb8ca('0x27')](_0x416265,_0x4a7917,!![]);}catch(_0x21f6df){return BPromise['reject'](_0x21f6df);}return _0x416265['save']();};}function saveUpdates(_0x2df67d,_0x3a1988){return function(_0x599e1c){if(_0x599e1c){return _0x599e1c[_0xb8ca('0x28')](_0x2df67d)['then'](function(_0x173dfb){return _0x173dfb;});}return null;};}function removeEntity(_0x14d7fc,_0x334f7b){return function(_0x41e608){if(_0x41e608){return _0x41e608[_0xb8ca('0x29')]()[_0xb8ca('0x2a')](function(){var _0x23e85c=_0x41e608[_0xb8ca('0x2b')]({'plain':!![]});var _0x19cfd4=_0xb8ca('0x2c');return db[_0xb8ca('0x2d')]['destroy']({'where':{'type':_0x19cfd4,'resourceId':_0x23e85c['id']}})[_0xb8ca('0x2a')](function(){return _0x41e608;});})[_0xb8ca('0x2a')](function(){_0x14d7fc[_0xb8ca('0x1f')](0xcc)[_0xb8ca('0x20')]();});}};}function handleEntityNotFound(_0x13824f,_0x343de9){return function(_0x4da063){if(!_0x4da063){_0x13824f[_0xb8ca('0x1e')](0x194);}return _0x4da063;};}function handleError(_0x2b9911,_0x3d11bc){_0x3d11bc=_0x3d11bc||0x1f4;return function(_0xc666b4){logger[_0xb8ca('0x2e')](_0xc666b4['stack']);if(_0xc666b4['name']){delete _0xc666b4[_0xb8ca('0x2f')];}_0x2b9911['status'](_0x3d11bc)[_0xb8ca('0x30')](_0xc666b4);};}exports[_0xb8ca('0x31')]=function(_0x57209,_0x3395bf){var _0x5c53cd={},_0x39e948={},_0x5ddd6c={'count':0x0,'rows':[]};var _0x48d10a=_[_0xb8ca('0x32')](db['Dashboard'][_0xb8ca('0x33')],function(_0x3bb610){return{'name':_0x3bb610['fieldName'],'type':_0x3bb610[_0xb8ca('0x34')][_0xb8ca('0x35')]};});_0x39e948[_0xb8ca('0x36')]=_[_0xb8ca('0x32')](_0x48d10a,_0xb8ca('0x2f'));_0x39e948[_0xb8ca('0x37')]=_[_0xb8ca('0x38')](_0x57209[_0xb8ca('0x37')]);_0x39e948['filters']=_['intersection'](_0x39e948['model'],_0x39e948[_0xb8ca('0x37')]);_0x5c53cd[_0xb8ca('0x39')]=_[_0xb8ca('0x3a')](_0x39e948[_0xb8ca('0x36')],qs[_0xb8ca('0x3b')](_0x57209[_0xb8ca('0x37')][_0xb8ca('0x3b')]));_0x5c53cd['attributes']=_0x5c53cd['attributes'][_0xb8ca('0x3c')]?_0x5c53cd[_0xb8ca('0x39')]:_0x39e948[_0xb8ca('0x36')];if(!_0x57209['query'][_0xb8ca('0x3d')](_0xb8ca('0x3e'))){_0x5c53cd[_0xb8ca('0x23')]=qs[_0xb8ca('0x23')](_0x57209['query'][_0xb8ca('0x23')]);_0x5c53cd[_0xb8ca('0x24')]=qs[_0xb8ca('0x24')](_0x57209[_0xb8ca('0x37')][_0xb8ca('0x24')]);}_0x5c53cd[_0xb8ca('0x3f')]=qs[_0xb8ca('0x40')](_0x57209['query'][_0xb8ca('0x40')]);_0x5c53cd['where']=qs[_0xb8ca('0x41')](_['pick'](_0x57209[_0xb8ca('0x37')],_0x39e948['filters']),_0x48d10a);if(_0x57209[_0xb8ca('0x37')]['filter']){_0x5c53cd[_0xb8ca('0x42')]=_[_0xb8ca('0x43')](_0x5c53cd['where'],{'$or':_['map'](_0x48d10a,function(_0xc8daad){if(_0xc8daad[_0xb8ca('0x34')]!==_0xb8ca('0x44')){var _0x5a9033={};_0x5a9033[_0xc8daad[_0xb8ca('0x2f')]]={'$like':'%'+_0x57209[_0xb8ca('0x37')][_0xb8ca('0x45')]+'%'};return _0x5a9033;}})});}_0x5c53cd=_[_0xb8ca('0x43')]({},_0x5c53cd,_0x57209[_0xb8ca('0x46')]);var _0x4e6ea0={'where':_0x5c53cd['where']};return db[_0xb8ca('0x47')][_0xb8ca('0x25')](_0x4e6ea0)['then'](function(_0x453c08){_0x5ddd6c['count']=_0x453c08;if(_0x57209[_0xb8ca('0x37')][_0xb8ca('0x48')]){_0x5c53cd[_0xb8ca('0x49')]=[{'all':!![]}];}return db[_0xb8ca('0x47')][_0xb8ca('0x4a')](_0x5c53cd);})[_0xb8ca('0x2a')](function(_0x210835){_0x5ddd6c[_0xb8ca('0x4b')]=_0x210835;return _0x5ddd6c;})[_0xb8ca('0x2a')](respondWithFilteredResult(_0x3395bf,_0x5c53cd))[_0xb8ca('0x4c')](handleError(_0x3395bf,null));};exports['show']=function(_0x2e194f,_0x187c96){var _0x1ea90f={'raw':![],'where':{'id':_0x2e194f['params']['id']}},_0x4e6319={};_0x4e6319['model']=_[_0xb8ca('0x38')](db['Dashboard']['rawAttributes']);_0x4e6319[_0xb8ca('0x37')]=_[_0xb8ca('0x38')](_0x2e194f['query']);_0x4e6319[_0xb8ca('0x41')]=_[_0xb8ca('0x3a')](_0x4e6319[_0xb8ca('0x36')],_0x4e6319[_0xb8ca('0x37')]);_0x1ea90f[_0xb8ca('0x39')]=_['intersection'](_0x4e6319[_0xb8ca('0x36')],qs[_0xb8ca('0x3b')](_0x2e194f[_0xb8ca('0x37')][_0xb8ca('0x3b')]));_0x1ea90f[_0xb8ca('0x39')]=_0x1ea90f['attributes'][_0xb8ca('0x3c')]?_0x1ea90f['attributes']:_0x4e6319[_0xb8ca('0x36')];if(_0x2e194f['query'][_0xb8ca('0x48')]){_0x1ea90f[_0xb8ca('0x49')]=[{'all':!![]}];}_0x1ea90f=_[_0xb8ca('0x43')]({},_0x1ea90f,_0x2e194f[_0xb8ca('0x46')]);return db[_0xb8ca('0x47')][_0xb8ca('0x4d')](_0x1ea90f)['then'](handleEntityNotFound(_0x187c96,null))[_0xb8ca('0x2a')](respondWithResult(_0x187c96,null))[_0xb8ca('0x4c')](handleError(_0x187c96,null));};exports[_0xb8ca('0x4e')]=function(_0x38ce95,_0x25c2fe){return db[_0xb8ca('0x47')][_0xb8ca('0x4e')](_0x38ce95['body'],{})[_0xb8ca('0x2a')](function(_0x20bd0d){var _0x377f56=_0x38ce95[_0xb8ca('0x4f')][_0xb8ca('0x2b')]({'plain':!![]});if(!_0x377f56)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x377f56[_0xb8ca('0x50')]===_0xb8ca('0x4f')){var _0x4c3fff=_0x20bd0d[_0xb8ca('0x2b')]({'plain':!![]});var _0x169c85=_0xb8ca('0x2c');return db['UserProfileSection'][_0xb8ca('0x4d')]({'where':{'name':_0x169c85,'userProfileId':_0x377f56['userProfileId']},'raw':!![]})[_0xb8ca('0x2a')](function(_0x566fc3){if(_0x566fc3&&_0x566fc3[_0xb8ca('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x4c3fff[_0xb8ca('0x2f')],'resourceId':_0x4c3fff['id'],'type':_0x566fc3[_0xb8ca('0x2f')],'sectionId':_0x566fc3['id']},{})[_0xb8ca('0x2a')](function(){return _0x20bd0d;});}else{return _0x20bd0d;}})[_0xb8ca('0x4c')](function(_0x13fe1e){logger[_0xb8ca('0x2e')](_0xb8ca('0x52'),_0x13fe1e);throw _0x13fe1e;});}return _0x20bd0d;})['then'](respondWithResult(_0x25c2fe,0xc9))['catch'](handleError(_0x25c2fe,null));};exports[_0xb8ca('0x53')]=function(_0x58a1b3,_0x29b8ff){var _0xa9beea={'where':{'id':_0x58a1b3[_0xb8ca('0x54')]['id']}},_0x2f517c={};_0x2f517c[_0xb8ca('0x36')]=_[_0xb8ca('0x38')](db[_0xb8ca('0x47')][_0xb8ca('0x33')]);_0xa9beea[_0xb8ca('0x39')]=_['intersection'](_0x2f517c['model'],qs[_0xb8ca('0x3b')](_0x58a1b3['query']['fields']));_0xa9beea[_0xb8ca('0x39')]=_0xa9beea[_0xb8ca('0x39')][_0xb8ca('0x3c')]?_0xa9beea[_0xb8ca('0x39')]:_0x2f517c[_0xb8ca('0x36')];if(_0x58a1b3[_0xb8ca('0x37')][_0xb8ca('0x48')]){_0xa9beea[_0xb8ca('0x49')]=[{'all':!![]}];}_0xa9beea=_[_0xb8ca('0x43')]({},_0xa9beea,_0x58a1b3['options']);return db[_0xb8ca('0x47')][_0xb8ca('0x4d')](_0xa9beea)[_0xb8ca('0x2a')](handleEntityNotFound(_0x29b8ff,null))[_0xb8ca('0x2a')](function(_0x552336){if(_0x552336){var _0x49af82=_0x552336['get']({'plain':!![]});_0x49af82=qs[_0xb8ca('0x55')](_0x49af82,['id',_0xb8ca('0x56'),_0xb8ca('0x57')]);_0x58a1b3['body']=_[_0xb8ca('0x55')](_0x58a1b3['body'],['id',_0xb8ca('0x56'),_0xb8ca('0x57')]);return db[_0xb8ca('0x47')][_0xb8ca('0x4e')](_['merge'](_0x49af82,_0x58a1b3[_0xb8ca('0x58')]),{'include':_0x58a1b3[_0xb8ca('0x37')][_0xb8ca('0x48')]?[{'all':!![]}]:undefined})[_0xb8ca('0x2a')](function(_0x4fc703){var _0x5aab75=_0x58a1b3[_0xb8ca('0x4f')][_0xb8ca('0x2b')]({'plain':!![]});if(!_0x5aab75)throw new Error(_0xb8ca('0x59'));if(_0x5aab75[_0xb8ca('0x50')]===_0xb8ca('0x4f')){var _0x76987=_0x4fc703[_0xb8ca('0x2b')]({'plain':!![]});var _0x5192c6=_0xb8ca('0x2c');return db[_0xb8ca('0x5a')][_0xb8ca('0x4d')]({'where':{'name':_0x5192c6,'userProfileId':_0x5aab75['userProfileId']},'raw':!![]})[_0xb8ca('0x2a')](function(_0x2672f4){if(_0x2672f4&&_0x2672f4['autoAssociation']===0x0){return db[_0xb8ca('0x2d')][_0xb8ca('0x4e')]({'name':_0x76987['name'],'resourceId':_0x76987['id'],'type':_0x2672f4['name'],'sectionId':_0x2672f4['id']},{})[_0xb8ca('0x2a')](function(){return _0x4fc703;});}else{return _0x4fc703;}})[_0xb8ca('0x4c')](function(_0x3f9b03){logger['error'](_0xb8ca('0x52'),_0x3f9b03);throw _0x3f9b03;});}return _0x4fc703;});}})[_0xb8ca('0x2a')](respondWithResult(_0x29b8ff,0xc9))['catch'](handleError(_0x29b8ff,null));};exports[_0xb8ca('0x28')]=function(_0x422284,_0x106d61){if(_0x422284['body']['id']){delete _0x422284[_0xb8ca('0x58')]['id'];}return db['Dashboard'][_0xb8ca('0x4d')]({'where':{'id':_0x422284['params']['id']}})[_0xb8ca('0x2a')](handleEntityNotFound(_0x106d61,null))[_0xb8ca('0x2a')](saveUpdates(_0x422284[_0xb8ca('0x58')],null))[_0xb8ca('0x2a')](respondWithResult(_0x106d61,null))['catch'](handleError(_0x106d61,null));};exports['destroy']=function(_0x5dd63b,_0x34a2ca){return db[_0xb8ca('0x47')]['find']({'where':{'id':_0x5dd63b[_0xb8ca('0x54')]['id']}})[_0xb8ca('0x2a')](handleEntityNotFound(_0x34a2ca,null))[_0xb8ca('0x2a')](removeEntity(_0x34a2ca,null))[_0xb8ca('0x4c')](handleError(_0x34a2ca,null));};function widgetAttributes(_0xbf5607){try{switch(_0xbf5607['type']){case'iframe':return[{'name':_0xb8ca('0x5b'),'value':_0xbf5607[_0xb8ca('0x5b')]||(_0xbf5607[_0xb8ca('0x5c')]&&_0xbf5607[_0xb8ca('0x5c')][0x0]?_0xbf5607[_0xb8ca('0x5c')][0x0][_0xb8ca('0x5d')]:undefined)||'https://'}];case _0xb8ca('0x5e'):return[{'name':'attrPath','value':_0xbf5607[_0xb8ca('0x5f')]||(_0xbf5607[_0xb8ca('0x5c')]&&_0xbf5607[_0xb8ca('0x5c')][0x0]?_0xbf5607[_0xb8ca('0x5c')][0x0][_0xb8ca('0x5d')]:undefined)||''}];case'clock':return[{'name':_0xb8ca('0x60'),'value':_0xbf5607[_0xb8ca('0x60')]||(_0xbf5607[_0xb8ca('0x5c')]&&_0xbf5607[_0xb8ca('0x5c')][0x0]?_0xbf5607[_0xb8ca('0x5c')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xb8ca('0x61'),'value':_0xbf5607[_0xb8ca('0x61')]||(_0xbf5607[_0xb8ca('0x5c')]&&_0xbf5607['attrs'][0x1]?_0xbf5607[_0xb8ca('0x5c')][0x1][_0xb8ca('0x5d')]:undefined)||_0xb8ca('0x62')},{'name':'attrFontSize','value':_0xbf5607[_0xb8ca('0x63')]||(_0xbf5607[_0xb8ca('0x5c')]&&_0xbf5607[_0xb8ca('0x5c')][0x2]?_0xbf5607[_0xb8ca('0x5c')][0x2]['value']:undefined)||0xc}];case _0xb8ca('0x64'):return[{'name':_0xb8ca('0x65'),'value':_0xbf5607[_0xb8ca('0x65')]||(_0xbf5607[_0xb8ca('0x5c')]&&_0xbf5607[_0xb8ca('0x5c')][0x0]?_0xbf5607[_0xb8ca('0x5c')][0x0][_0xb8ca('0x5d')]:undefined)||_0xb8ca('0x66')},{'name':_0xb8ca('0x67'),'value':_0xbf5607[_0xb8ca('0x67')]||(_0xbf5607[_0xb8ca('0x5c')]&&_0xbf5607['attrs'][0x1]?_0xbf5607[_0xb8ca('0x5c')][0x1][_0xb8ca('0x5d')]:undefined)||[]},{'name':_0xb8ca('0x63'),'value':_0xbf5607[_0xb8ca('0x63')]||(_0xbf5607['attrs']&&_0xbf5607[_0xb8ca('0x5c')][0x2]?_0xbf5607[_0xb8ca('0x5c')][0x2][_0xb8ca('0x5d')]:undefined)||0x14}];case _0xb8ca('0x68'):case _0xb8ca('0x69'):return[{'name':_0xb8ca('0x6a'),'value':_0xbf5607['attrSerie1']||(_0xbf5607['attrs']&&_0xbf5607[_0xb8ca('0x5c')][0x0]?_0xbf5607[_0xb8ca('0x5c')][0x0][_0xb8ca('0x5d')]:undefined)||_0xb8ca('0x66')},{'name':_0xb8ca('0x6b'),'value':_0xbf5607['attrSerie2']||(_0xbf5607[_0xb8ca('0x5c')]&&_0xbf5607[_0xb8ca('0x5c')][0x1]?_0xbf5607[_0xb8ca('0x5c')][0x1][_0xb8ca('0x5d')]:undefined)||null},{'name':_0xb8ca('0x6c'),'value':_0xbf5607['attrSerie3']||(_0xbf5607[_0xb8ca('0x5c')]&&_0xbf5607['attrs'][0x2]?_0xbf5607[_0xb8ca('0x5c')][0x2][_0xb8ca('0x5d')]:undefined)||null},{'name':_0xb8ca('0x67'),'value':_0xbf5607['attrVoiceQueues']||(_0xbf5607[_0xb8ca('0x5c')]&&_0xbf5607[_0xb8ca('0x5c')][0x3]?_0xbf5607[_0xb8ca('0x5c')][0x3][_0xb8ca('0x5d')]:undefined)||[]}];case _0xb8ca('0x6d'):return[{'name':_0xb8ca('0x6e'),'type':_0xbf5607['reportType']||(_0xbf5607['attrs']&&_0xbf5607[_0xb8ca('0x5c')][0x0]?_0xbf5607[_0xb8ca('0x5c')][0x0][_0xb8ca('0x34')]:undefined)||null,'value':_0xbf5607[_0xb8ca('0x6e')]||(_0xbf5607[_0xb8ca('0x5c')]&&_0xbf5607['attrs'][0x0]?_0xbf5607[_0xb8ca('0x5c')][0x0][_0xb8ca('0x5d')]:undefined)||null},{'name':'attrRefresh','value':_0xbf5607[_0xb8ca('0x6f')]||(_0xbf5607[_0xb8ca('0x5c')]&&_0xbf5607[_0xb8ca('0x5c')][0x1]?_0xbf5607[_0xb8ca('0x5c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x31689d){logger[_0xb8ca('0x2e')](_0xb8ca('0x70'),JSON[_0xb8ca('0x71')](_0x31689d));return[];}}exports['addItem']=function(_0x22a5bc,_0x39f592,_0x1e2796){if(_0x22a5bc[_0xb8ca('0x58')]['id']){delete _0x22a5bc[_0xb8ca('0x58')]['id'];}return db[_0xb8ca('0x47')][_0xb8ca('0x4d')]({'where':{'id':_0x22a5bc[_0xb8ca('0x54')]['id']}})[_0xb8ca('0x2a')](handleEntityNotFound(_0x39f592,null))[_0xb8ca('0x2a')](function(_0x374605){if(_0x374605){_0x22a5bc[_0xb8ca('0x58')][_0xb8ca('0x72')]=_0x374605['id'];_0x22a5bc[_0xb8ca('0x58')]['attrs']=widgetAttributes(_0x22a5bc['body']);return db['DashboardItem']['create'](_0x22a5bc[_0xb8ca('0x58')]);}})[_0xb8ca('0x2a')](respondWithResult(_0x39f592,null))['catch'](handleError(_0x39f592,null));};exports['getItems']=function(_0x256f6d,_0x19188e,_0x541983){var _0x3dfa27={};var _0x387881={};var _0x1ebff5;var _0x4df148;return db[_0xb8ca('0x47')]['findOne']({'where':{'id':_0x256f6d[_0xb8ca('0x54')]['id']}})['then'](handleEntityNotFound(_0x19188e,null))[_0xb8ca('0x2a')](function(_0x13623c){if(_0x13623c){_0x1ebff5=_0x13623c;_0x387881[_0xb8ca('0x36')]=_[_0xb8ca('0x38')](db[_0xb8ca('0x73')]['rawAttributes']);_0x387881[_0xb8ca('0x37')]=_[_0xb8ca('0x38')](_0x256f6d[_0xb8ca('0x37')]);_0x387881[_0xb8ca('0x41')]=_[_0xb8ca('0x3a')](_0x387881[_0xb8ca('0x36')],_0x387881[_0xb8ca('0x37')]);_0x3dfa27[_0xb8ca('0x39')]=_[_0xb8ca('0x3a')](_0x387881[_0xb8ca('0x36')],qs[_0xb8ca('0x3b')](_0x256f6d[_0xb8ca('0x37')]['fields']));_0x3dfa27[_0xb8ca('0x39')]=_0x3dfa27[_0xb8ca('0x39')][_0xb8ca('0x3c')]?_0x3dfa27[_0xb8ca('0x39')]:_0x387881[_0xb8ca('0x36')];_0x3dfa27['order']=qs[_0xb8ca('0x40')](_0x256f6d[_0xb8ca('0x37')]['sort']);_0x3dfa27[_0xb8ca('0x42')]=qs[_0xb8ca('0x41')](_['pick'](_0x256f6d[_0xb8ca('0x37')],_0x387881['filters']));if(_0x256f6d[_0xb8ca('0x37')][_0xb8ca('0x45')]){_0x3dfa27[_0xb8ca('0x42')]=_[_0xb8ca('0x43')](_0x3dfa27[_0xb8ca('0x42')],{'$or':_[_0xb8ca('0x32')](_0x3dfa27[_0xb8ca('0x39')],function(_0x20271c){var _0x446885={};_0x446885[_0x20271c]={'$like':'%'+_0x256f6d[_0xb8ca('0x37')][_0xb8ca('0x45')]+'%'};return _0x446885;})});}_0x3dfa27=_[_0xb8ca('0x43')]({},_0x3dfa27,_0x256f6d['options']);return _0x1ebff5[_0xb8ca('0x74')](_0x3dfa27);}})[_0xb8ca('0x2a')](function(_0x44edbb){if(_0x44edbb){_0x4df148=_0x44edbb[_0xb8ca('0x3c')];if(!_0x256f6d['query']['hasOwnProperty'](_0xb8ca('0x3e'))){_0x3dfa27[_0xb8ca('0x23')]=qs['limit'](_0x256f6d[_0xb8ca('0x37')][_0xb8ca('0x23')]);_0x3dfa27[_0xb8ca('0x24')]=qs[_0xb8ca('0x24')](_0x256f6d[_0xb8ca('0x37')]['offset']);}return _0x1ebff5[_0xb8ca('0x74')](_0x3dfa27);}})[_0xb8ca('0x2a')](function(_0x31218f){if(_0x31218f){return _0x31218f?{'count':_0x4df148,'rows':_0x31218f}:null;}})['then'](respondWithResult(_0x19188e,null))['catch'](handleError(_0x19188e,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index a59893a..9242582 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 _0x4b66=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','Dashboard','setMaxListeners'];(function(_0x5c6ceb,_0x4ed099){var _0x28821b=function(_0x391add){while(--_0x391add){_0x5c6ceb['push'](_0x5c6ceb['shift']());}};_0x28821b(++_0x4ed099);}(_0x4b66,0x1dc));var _0x64b6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4b66[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x64b6('0x0'));var Dashboard=require(_0x64b6('0x1'))['db'][_0x64b6('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x64b6('0x3')](0x0);var events={'afterCreate':_0x64b6('0x4'),'afterUpdate':_0x64b6('0x5'),'afterDestroy':_0x64b6('0x6')};function emitEvent(_0x8d82d1){return function(_0xa00e7f,_0xf885f2,_0x4780bd){DashboardEvents[_0x64b6('0x7')](_0x8d82d1+':'+_0xa00e7f['id'],_0xa00e7f);DashboardEvents[_0x64b6('0x7')](_0x8d82d1,_0xa00e7f);_0x4780bd(null);};}for(var e in events){if(events[_0x64b6('0x8')](e)){var event=events[e];Dashboard[_0x64b6('0x9')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0xbf9b=['emit','hasOwnProperty','hook','exports','setMaxListeners','remove'];(function(_0x378a37,_0x4781db){var _0x3522c7=function(_0x584e8c){while(--_0x584e8c){_0x378a37['push'](_0x378a37['shift']());}};_0x3522c7(++_0x4781db);}(_0xbf9b,0x172));var _0xbbf9=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xbf9b[_0x3b0731];return _0x4204d7;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xbbf9('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbbf9('0x1')};function emitEvent(_0x150c95){return function(_0x220d57,_0x599e91,_0x1cf018){DashboardEvents['emit'](_0x150c95+':'+_0x220d57['id'],_0x220d57);DashboardEvents[_0xbbf9('0x2')](_0x150c95,_0x220d57);_0x1cf018(null);};}for(var e in events){if(events[_0xbbf9('0x3')](e)){var event=events[e];Dashboard[_0xbbf9('0x4')](e,emitEvent(event));}}module[_0xbbf9('0x5')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 557bc1a..10bcaeb 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 _0x3ccf=['bluebird','path','../../config/environment','./dashboard.attributes','exports','define','dashboards','lodash','../../config/logger'];(function(_0x4ee883,_0x104a47){var _0x44f1df=function(_0x2f6d05){while(--_0x2f6d05){_0x4ee883['push'](_0x4ee883['shift']());}};_0x44f1df(++_0x104a47);}(_0x3ccf,0x139));var _0xf3cc=function(_0x36610e,_0xf221ae){_0x36610e=_0x36610e-0x0;var _0x311676=_0x3ccf[_0x36610e];return _0x311676;};'use strict';var _=require(_0xf3cc('0x0'));var util=require('util');var logger=require(_0xf3cc('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf3cc('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3cc('0x3'));var rimraf=require('rimraf');var config=require(_0xf3cc('0x4'));var attributes=require(_0xf3cc('0x5'));module[_0xf3cc('0x6')]=function(_0x2af784,_0x320e4f){return _0x2af784[_0xf3cc('0x7')]('Dashboard',attributes,{'tableName':_0xf3cc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4822=['rimraf','../../config/environment','exports','define','Dashboard','../../config/logger','api','request-promise','path'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x4822,0x12e));var _0x2482=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x4822[_0x38b14f];return _0x22a324;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2482('0x0'))(_0x2482('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2482('0x2'));var fs=require('fs');var path=require(_0x2482('0x3'));var rimraf=require(_0x2482('0x4'));var config=require(_0x2482('0x5'));var attributes=require('./dashboard.attributes');module[_0x2482('0x6')]=function(_0x7fccff,_0x2b82ea){return _0x7fccff[_0x2482('0x7')](_0x2482('0x8'),attributes,{'tableName':'dashboards','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 3262d91..d406632 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 _0x86d6=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','register','then','Dashboard,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x55538e,_0x489040){var _0x5655b4=function(_0x132894){while(--_0x132894){_0x55538e['push'](_0x55538e['shift']());}};_0x5655b4(++_0x489040);}(_0x86d6,0x13f));var _0x686d=function(_0x2c8aea,_0x4e32af){_0x2c8aea=_0x2c8aea-0x0;var _0x3a2945=_0x86d6[_0x2c8aea];return _0x3a2945;};'use strict';var _=require('lodash');var util=require(_0x686d('0x0'));var moment=require(_0x686d('0x1'));var BPromise=require(_0x686d('0x2'));var rs=require(_0x686d('0x3'));var fs=require('fs');var Redis=require(_0x686d('0x4'));var db=require(_0x686d('0x5'))['db'];var utils=require(_0x686d('0x6'));var logger=require(_0x686d('0x7'))(_0x686d('0x8'));var config=require('../../config/environment');var jayson=require(_0x686d('0x9'));var client=jayson[_0x686d('0xa')][_0x686d('0xb')]({'port':0x232a});config[_0x686d('0xc')]=_[_0x686d('0xd')](config['redis'],{'host':_0x686d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x686d('0xc')]));require('./dashboard.socket')[_0x686d('0xf')](socket);function respondWithRpcPromise(_0x1d2547,_0x1a5c88,_0x3f6aa8){return new BPromise(function(_0x5c08a2,_0x362124){return client['request'](_0x1d2547,_0x3f6aa8)[_0x686d('0x10')](function(_0x5dd99b){logger['info'](_0x686d('0x11'),_0x1a5c88,_0x686d('0x12'));logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x1a5c88,_0x686d('0x12'),JSON['stringify'](_0x5dd99b));if(_0x5dd99b[_0x686d('0x13')]){if(_0x5dd99b['error'][_0x686d('0x14')]===0x1f4){logger['error'](_0x686d('0x11'),_0x1a5c88,_0x5dd99b[_0x686d('0x13')][_0x686d('0x15')]);return _0x362124(_0x5dd99b['error'][_0x686d('0x15')]);}logger[_0x686d('0x13')](_0x686d('0x11'),_0x1a5c88,_0x5dd99b['error'][_0x686d('0x15')]);return _0x5c08a2(_0x5dd99b[_0x686d('0x13')]['message']);}else{logger[_0x686d('0x16')](_0x686d('0x11'),_0x1a5c88,_0x686d('0x12'));_0x5c08a2(_0x5dd99b[_0x686d('0x17')][_0x686d('0x15')]);}})[_0x686d('0x18')](function(_0x321662){logger[_0x686d('0x13')](_0x686d('0x11'),_0x1a5c88,_0x321662);_0x362124(_0x321662);});});} \ No newline at end of file +var _0x303b=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x18360d,_0xde1aa){var _0x2dc76a=function(_0x5f289b){while(--_0x5f289b){_0x18360d['push'](_0x18360d['shift']());}};_0x2dc76a(++_0xde1aa);}(_0x303b,0x83));var _0xb303=function(_0x1f9105,_0x16e2ba){_0x1f9105=_0x1f9105-0x0;var _0xd039f1=_0x303b[_0x1f9105];return _0xd039f1;};'use strict';var _=require(_0xb303('0x0'));var util=require(_0xb303('0x1'));var moment=require('moment');var BPromise=require(_0xb303('0x2'));var rs=require(_0xb303('0x3'));var fs=require('fs');var Redis=require(_0xb303('0x4'));var db=require(_0xb303('0x5'))['db'];var utils=require(_0xb303('0x6'));var logger=require(_0xb303('0x7'))(_0xb303('0x8'));var config=require('../../config/environment');var jayson=require(_0xb303('0x9'));var client=jayson['client'][_0xb303('0xa')]({'port':0x232a});config[_0xb303('0xb')]=_[_0xb303('0xc')](config['redis'],{'host':_0xb303('0xd'),'port':0x18eb});var socket=require(_0xb303('0xe'))(new Redis(config[_0xb303('0xb')]));require(_0xb303('0xf'))[_0xb303('0x10')](socket);function respondWithRpcPromise(_0x4badc5,_0x20094f,_0x2752f8){return new BPromise(function(_0x431e4e,_0x17b8e3){return client['request'](_0x4badc5,_0x2752f8)['then'](function(_0x2abe0b){logger[_0xb303('0x11')](_0xb303('0x12'),_0x20094f,'request\x20sent');logger[_0xb303('0x13')](_0xb303('0x14'),_0x20094f,_0xb303('0x15'),JSON[_0xb303('0x16')](_0x2abe0b));if(_0x2abe0b[_0xb303('0x17')]){if(_0x2abe0b[_0xb303('0x17')]['code']===0x1f4){logger[_0xb303('0x17')]('Dashboard,\x20%s,\x20%s',_0x20094f,_0x2abe0b['error']['message']);return _0x17b8e3(_0x2abe0b[_0xb303('0x17')][_0xb303('0x18')]);}logger[_0xb303('0x17')](_0xb303('0x12'),_0x20094f,_0x2abe0b[_0xb303('0x17')]['message']);return _0x431e4e(_0x2abe0b[_0xb303('0x17')][_0xb303('0x18')]);}else{logger[_0xb303('0x11')]('Dashboard,\x20%s,\x20%s',_0x20094f,_0xb303('0x15'));_0x431e4e(_0x2abe0b[_0xb303('0x19')][_0xb303('0x18')]);}})['catch'](function(_0x59b30f){logger[_0xb303('0x17')](_0xb303('0x12'),_0x20094f,_0x59b30f);_0x17b8e3(_0x59b30f);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 133856a..2e175cc 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 _0xda6a=['remove','update','emit','removeListener','length','dashboard:','./dashboard.events','save'];(function(_0x1c33dc,_0x177c7e){var _0x405580=function(_0x556105){while(--_0x556105){_0x1c33dc['push'](_0x1c33dc['shift']());}};_0x405580(++_0x177c7e);}(_0xda6a,0xc6));var _0xada6=function(_0x57cb94,_0x127fbc){_0x57cb94=_0x57cb94-0x0;var _0x3df519=_0xda6a[_0x57cb94];return _0x3df519;};'use strict';var DashboardEvents=require(_0xada6('0x0'));var events=[_0xada6('0x1'),_0xada6('0x2'),_0xada6('0x3')];function createListener(_0x189c18,_0x3504eb){return function(_0x2b2415){_0x3504eb[_0xada6('0x4')](_0x189c18,_0x2b2415);};}function removeListener(_0x2f55fd,_0x17f530){return function(){DashboardEvents[_0xada6('0x5')](_0x2f55fd,_0x17f530);};}exports['register']=function(_0x52d6b4){for(var _0x2005d9=0x0,_0x337baa=events[_0xada6('0x6')];_0x2005d9<_0x337baa;_0x2005d9++){var _0xdf834=events[_0x2005d9];var _0x593153=createListener(_0xada6('0x7')+_0xdf834,_0x52d6b4);DashboardEvents['on'](_0xdf834,_0x593153);}}; \ No newline at end of file +var _0xca91=['./dashboard.events','save','remove','update','emit','length','dashboard:'];(function(_0x217327,_0x16ac63){var _0x30bea8=function(_0x2db98a){while(--_0x2db98a){_0x217327['push'](_0x217327['shift']());}};_0x30bea8(++_0x16ac63);}(_0xca91,0x93));var _0x1ca9=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0xca91[_0x4bed75];return _0x2dd8e8;};'use strict';var DashboardEvents=require(_0x1ca9('0x0'));var events=[_0x1ca9('0x1'),_0x1ca9('0x2'),_0x1ca9('0x3')];function createListener(_0x5b4796,_0x4c56b0){return function(_0x4c7167){_0x4c56b0[_0x1ca9('0x4')](_0x5b4796,_0x4c7167);};}function removeListener(_0x59c8ba,_0x35cb8e){return function(){DashboardEvents['removeListener'](_0x59c8ba,_0x35cb8e);};}exports['register']=function(_0xaaa97){for(var _0x1d07bb=0x0,_0x150c90=events[_0x1ca9('0x5')];_0x1d07bb<_0x150c90;_0x1d07bb++){var _0x538e3f=events[_0x1d07bb];var _0x5763e9=createListener(_0x1ca9('0x6')+_0x538e3f,_0xaaa97);DashboardEvents['on'](_0x538e3f,_0x5763e9);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5d530bc..eee3f2f 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 _0x4293=['addItem','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','post','create','clone'];(function(_0x2d87b2,_0x45d8e8){var _0x5082ca=function(_0x5bb0ce){while(--_0x5bb0ce){_0x2d87b2['push'](_0x2d87b2['shift']());}};_0x5082ca(++_0x45d8e8);}(_0x4293,0x1a8));var _0x3429=function(_0x3fdee6,_0x375de6){_0x3fdee6=_0x3fdee6-0x0;var _0x3246d8=_0x4293[_0x3fdee6];return _0x3246d8;};'use strict';var multer=require(_0x3429('0x0'));var util=require(_0x3429('0x1'));var path=require(_0x3429('0x2'));var timeout=require(_0x3429('0x3'));var express=require(_0x3429('0x4'));var router=express['Router']();var fs_extra=require(_0x3429('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3429('0x6'));var config=require(_0x3429('0x7'));var controller=require(_0x3429('0x8'));router[_0x3429('0x9')]('/',auth[_0x3429('0xa')](),controller['index']);router[_0x3429('0x9')](_0x3429('0xb'),auth[_0x3429('0xa')](),controller[_0x3429('0xc')]);router['get'](_0x3429('0xd'),auth[_0x3429('0xa')](),controller['getItems']);router[_0x3429('0xe')]('/',auth[_0x3429('0xa')](),controller[_0x3429('0xf')]);router[_0x3429('0xe')]('/:id/clone',auth[_0x3429('0xa')](),controller[_0x3429('0x10')]);router[_0x3429('0xe')](_0x3429('0xd'),auth[_0x3429('0xa')](),controller[_0x3429('0x11')]);router['put']('/:id',auth[_0x3429('0xa')](),controller[_0x3429('0x12')]);router[_0x3429('0x13')]('/:id',auth[_0x3429('0xa')](),controller[_0x3429('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe460=['/:id/clone','clone','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','/:id','show','/:id/items','getItems','post','create'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe460,0xcb));var _0x0e46=function(_0x403c8d,_0x5e3825){_0x403c8d=_0x403c8d-0x0;var _0x4ca60d=_0xe460[_0x403c8d];return _0x4ca60d;};'use strict';var multer=require(_0x0e46('0x0'));var util=require(_0x0e46('0x1'));var path=require(_0x0e46('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e46('0x3'));var router=express[_0x0e46('0x4')]();var fs_extra=require(_0x0e46('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0e46('0x6'));var config=require(_0x0e46('0x7'));var controller=require(_0x0e46('0x8'));router[_0x0e46('0x9')]('/',auth[_0x0e46('0xa')](),controller['index']);router[_0x0e46('0x9')](_0x0e46('0xb'),auth[_0x0e46('0xa')](),controller[_0x0e46('0xc')]);router[_0x0e46('0x9')](_0x0e46('0xd'),auth[_0x0e46('0xa')](),controller[_0x0e46('0xe')]);router[_0x0e46('0xf')]('/',auth[_0x0e46('0xa')](),controller[_0x0e46('0x10')]);router['post'](_0x0e46('0x11'),auth[_0x0e46('0xa')](),controller[_0x0e46('0x12')]);router[_0x0e46('0xf')]('/:id/items',auth[_0x0e46('0xa')](),controller['addItem']);router[_0x0e46('0x13')](_0x0e46('0xb'),auth[_0x0e46('0xa')](),controller['update']);router['delete'](_0x0e46('0xb'),auth[_0x0e46('0xa')](),controller[_0x0e46('0x14')]);module[_0x0e46('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 955cb39..ff6d364 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 _0x326f=['#2196f3','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff'];(function(_0x398481,_0x3de964){var _0x3a4d22=function(_0x359ad4){while(--_0x359ad4){_0x398481['push'](_0x398481['shift']());}};_0x3a4d22(++_0x3de964);}(_0x326f,0xd1));var _0xf326=function(_0x3c2b35,_0x91f080){_0x3c2b35=_0x3c2b35-0x0;var _0x4b9dd2=_0x326f[_0x3c2b35];return _0x4b9dd2;};'use strict';var Sequelize=require(_0xf326('0x0'));var squel=require('squel');var _=require('lodash');module[_0xf326('0x1')]={'title':{'type':Sequelize[_0xf326('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf326('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf326('0x3')](_0xf326('0x4')),'get':function(){try{return JSON[_0xf326('0x5')](this[_0xf326('0x6')](_0xf326('0x7')));}catch(_0x1b5a56){return[];}},'set':function(_0x3ace29){try{this['setDataValue'](_0xf326('0x7'),JSON[_0xf326('0x8')](_0x3ace29));}catch(_0x165f95){this[_0xf326('0x9')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf326('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf326('0xa')]},'col':{'type':Sequelize[_0xf326('0xa')]},'background':{'type':Sequelize[_0xf326('0x2')],'allowNull':![],'defaultValue':_0xf326('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf326('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xf326('0xa')],'defaultValue':0xc}}; \ No newline at end of file +var _0xda19=['TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','squel','lodash','STRING'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0xda19,0xd5));var _0x9da1=function(_0x89692a,_0x38627e){_0x89692a=_0x89692a-0x0;var _0x24526e=_0xda19[_0x89692a];return _0x24526e;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x9da1('0x0'));var _=require(_0x9da1('0x1'));module['exports']={'title':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x9da1('0x3')]('long'),'get':function(){try{return JSON[_0x9da1('0x4')](this[_0x9da1('0x5')](_0x9da1('0x6')));}catch(_0x470043){return[];}},'set':function(_0x156faf){try{this[_0x9da1('0x7')](_0x9da1('0x6'),JSON[_0x9da1('0x8')](_0x156faf));}catch(_0x1c24e6){this[_0x9da1('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x9da1('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x9da1('0x9')]},'background':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![],'defaultValue':_0x9da1('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![],'defaultValue':_0x9da1('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x9da1('0x2')]},'titleFontSize':{'type':Sequelize[_0x9da1('0x9')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index ea7d070..b04e510 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 _0x27c7=['attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','show','params','model','keys','query','filters','intersection','attributes','fields','length','include','merge','options','find','catch','DashboardItem','type','iframe','attrs','custom','attrPath','value','clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x27c7,0x10d));var _0x727c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x27c7[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x727c('0x0'));var rimraf=require(_0x727c('0x1'));var zipdir=require(_0x727c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x727c('0x3'));var moment=require(_0x727c('0x4'));var BPromise=require(_0x727c('0x5'));var Mustache=require('mustache');var util=require(_0x727c('0x6'));var path=require(_0x727c('0x7'));var sox=require(_0x727c('0x8'));var csv=require(_0x727c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x727c('0xa'));var _=require(_0x727c('0xb'));var squel=require(_0x727c('0xc'));var crypto=require(_0x727c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x727c('0xe'));var toCsv=require(_0x727c('0x9'));var querystring=require(_0x727c('0xf'));var Papa=require('papaparse');var Redis=require(_0x727c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x727c('0x11'));var as=require(_0x727c('0x12'));var hardwareService=require(_0x727c('0x13'));var logger=require('../../config/logger')(_0x727c('0x14'));var utils=require(_0x727c('0x15'));var config=require(_0x727c('0x16'));var licenseUtil=require(_0x727c('0x17'));var db=require('../../mysqldb')['db'];config[_0x727c('0x18')]=_[_0x727c('0x19')](config['redis'],{'host':_0x727c('0x1a'),'port':0x18eb});var socket=require(_0x727c('0x1b'))(new Redis(config[_0x727c('0x18')]));require('./dashboardItem.socket')[_0x727c('0x1c')](socket);function respondWithStatusCode(_0x196c0d,_0x3d2aae){_0x3d2aae=_0x3d2aae||0xcc;return function(_0x5ec953){if(_0x5ec953){return _0x196c0d['sendStatus'](_0x3d2aae);}return _0x196c0d[_0x727c('0x1d')](_0x3d2aae)[_0x727c('0x1e')]();};}function respondWithResult(_0x52e9f0,_0xf8729d){_0xf8729d=_0xf8729d||0xc8;return function(_0x88d8a7){if(_0x88d8a7){return _0x52e9f0[_0x727c('0x1d')](_0xf8729d)[_0x727c('0x1f')](_0x88d8a7);}};}function respondWithFilteredResult(_0x473998,_0x2df13c){return function(_0x4e24ea){if(_0x4e24ea){var _0x3a68bd=typeof _0x2df13c[_0x727c('0x20')]===_0x727c('0x21')&&typeof _0x2df13c[_0x727c('0x22')]===_0x727c('0x21');var _0x583b31=_0x4e24ea[_0x727c('0x23')];var _0x5b3323=_0x3a68bd?0x0:_0x2df13c[_0x727c('0x20')];var _0x653d5b=_0x3a68bd?_0x4e24ea[_0x727c('0x23')]:_0x2df13c[_0x727c('0x20')]+_0x2df13c['limit'];var _0x36d19c;if(_0x653d5b>=_0x583b31){_0x653d5b=_0x583b31;_0x36d19c=0xc8;}else{_0x36d19c=0xce;}_0x473998[_0x727c('0x1d')](_0x36d19c);return _0x473998['set'](_0x727c('0x24'),_0x5b3323+'-'+_0x653d5b+'/'+_0x583b31)['json'](_0x4e24ea);}return null;};}function patchUpdates(_0x371d1f){return function(_0x14132e){try{jsonpatch[_0x727c('0x25')](_0x14132e,_0x371d1f,!![]);}catch(_0x45ffc9){return BPromise[_0x727c('0x26')](_0x45ffc9);}return _0x14132e[_0x727c('0x27')]();};}function saveUpdates(_0x5a24db,_0x18c5e4){return function(_0x10bf38){if(_0x10bf38){return _0x10bf38[_0x727c('0x28')](_0x5a24db)[_0x727c('0x29')](function(_0x32c5d5){return _0x32c5d5;});}return null;};}function removeEntity(_0x46e6a5,_0xb9495d){return function(_0x1c78a6){if(_0x1c78a6){return _0x1c78a6[_0x727c('0x2a')]()[_0x727c('0x29')](function(){_0x46e6a5[_0x727c('0x1d')](0xcc)[_0x727c('0x1e')]();});}};}function handleEntityNotFound(_0x488092,_0x4da3e6){return function(_0x413685){if(!_0x413685){_0x488092['sendStatus'](0x194);}return _0x413685;};}function handleError(_0x4e46e1,_0x2a2d3b){_0x2a2d3b=_0x2a2d3b||0x1f4;return function(_0x55e6af){logger[_0x727c('0x2b')](_0x55e6af[_0x727c('0x2c')]);if(_0x55e6af[_0x727c('0x2d')]){delete _0x55e6af['name'];}_0x4e46e1['status'](_0x2a2d3b)['send'](_0x55e6af);};}exports[_0x727c('0x2e')]=function(_0x38f0a7,_0x471a95){var _0x50b999={'raw':![],'where':{'id':_0x38f0a7[_0x727c('0x2f')]['id']}},_0xca8ad3={};_0xca8ad3[_0x727c('0x30')]=_[_0x727c('0x31')](db['DashboardItem']['rawAttributes']);_0xca8ad3[_0x727c('0x32')]=_[_0x727c('0x31')](_0x38f0a7['query']);_0xca8ad3[_0x727c('0x33')]=_[_0x727c('0x34')](_0xca8ad3[_0x727c('0x30')],_0xca8ad3[_0x727c('0x32')]);_0x50b999[_0x727c('0x35')]=_[_0x727c('0x34')](_0xca8ad3[_0x727c('0x30')],qs[_0x727c('0x36')](_0x38f0a7[_0x727c('0x32')]['fields']));_0x50b999['attributes']=_0x50b999[_0x727c('0x35')][_0x727c('0x37')]?_0x50b999[_0x727c('0x35')]:_0xca8ad3[_0x727c('0x30')];if(_0x38f0a7['query']['includeAll']){_0x50b999[_0x727c('0x38')]=[{'all':!![]}];}_0x50b999=_[_0x727c('0x39')]({},_0x50b999,_0x38f0a7[_0x727c('0x3a')]);return db['DashboardItem'][_0x727c('0x3b')](_0x50b999)[_0x727c('0x29')](handleEntityNotFound(_0x471a95,null))['then'](respondWithResult(_0x471a95,null))[_0x727c('0x3c')](handleError(_0x471a95,null));};exports[_0x727c('0x2a')]=function(_0x3e8488,_0x129635){return db[_0x727c('0x3d')][_0x727c('0x3b')]({'where':{'id':_0x3e8488[_0x727c('0x2f')]['id']}})['then'](handleEntityNotFound(_0x129635,null))[_0x727c('0x29')](removeEntity(_0x129635,null))['catch'](handleError(_0x129635,null));};function widgetAttributes(_0x357ad9){try{switch(_0x357ad9[_0x727c('0x3e')]){case _0x727c('0x3f'):return[{'name':'attrUrl','value':_0x357ad9['attrUrl']||(_0x357ad9[_0x727c('0x40')]&&_0x357ad9[_0x727c('0x40')][0x0]?_0x357ad9[_0x727c('0x40')][0x0]['value']:undefined)||'https://'}];case _0x727c('0x41'):return[{'name':_0x727c('0x42'),'value':_0x357ad9['attrPath']||(_0x357ad9[_0x727c('0x40')]&&_0x357ad9[_0x727c('0x40')][0x0]?_0x357ad9[_0x727c('0x40')][0x0][_0x727c('0x43')]:undefined)||''}];case _0x727c('0x44'):return[{'name':_0x727c('0x45'),'value':_0x357ad9['attrHourFormat']||(_0x357ad9[_0x727c('0x40')]&&_0x357ad9[_0x727c('0x40')][0x0]?_0x357ad9['attrs'][0x0][_0x727c('0x43')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x357ad9[_0x727c('0x46')]||(_0x357ad9[_0x727c('0x40')]&&_0x357ad9[_0x727c('0x40')][0x1]?_0x357ad9[_0x727c('0x40')][0x1]['value']:undefined)||'0.00'},{'name':_0x727c('0x47'),'value':_0x357ad9[_0x727c('0x47')]||(_0x357ad9[_0x727c('0x40')]&&_0x357ad9[_0x727c('0x40')][0x2]?_0x357ad9[_0x727c('0x40')][0x2][_0x727c('0x43')]:undefined)||0xc}];case _0x727c('0x48'):return[{'name':_0x727c('0x49'),'value':_0x357ad9[_0x727c('0x49')]||(_0x357ad9[_0x727c('0x40')]&&_0x357ad9['attrs'][0x0]?_0x357ad9[_0x727c('0x40')][0x0]['value']:undefined)||_0x727c('0x4a')},{'name':_0x727c('0x4b'),'value':_0x357ad9[_0x727c('0x4b')]||(_0x357ad9['attrs']&&_0x357ad9[_0x727c('0x40')][0x1]?_0x357ad9[_0x727c('0x40')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x357ad9[_0x727c('0x47')]||(_0x357ad9[_0x727c('0x40')]&&_0x357ad9[_0x727c('0x40')][0x2]?_0x357ad9[_0x727c('0x40')][0x2][_0x727c('0x43')]:undefined)||0x14}];case _0x727c('0x4c'):case _0x727c('0x4d'):return[{'name':_0x727c('0x4e'),'value':_0x357ad9['attrSerie1']||(_0x357ad9['attrs']&&_0x357ad9[_0x727c('0x40')][0x0]?_0x357ad9[_0x727c('0x40')][0x0][_0x727c('0x43')]:undefined)||_0x727c('0x4a')},{'name':_0x727c('0x4f'),'value':_0x357ad9['attrSerie2']||(_0x357ad9['attrs']&&_0x357ad9[_0x727c('0x40')][0x1]?_0x357ad9[_0x727c('0x40')][0x1][_0x727c('0x43')]:undefined)||null},{'name':_0x727c('0x50'),'value':_0x357ad9[_0x727c('0x50')]||(_0x357ad9[_0x727c('0x40')]&&_0x357ad9['attrs'][0x2]?_0x357ad9[_0x727c('0x40')][0x2][_0x727c('0x43')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x357ad9['attrVoiceQueues']||(_0x357ad9[_0x727c('0x40')]&&_0x357ad9['attrs'][0x3]?_0x357ad9[_0x727c('0x40')][0x3][_0x727c('0x43')]:undefined)||[]}];case _0x727c('0x51'):return[{'name':_0x727c('0x52'),'type':_0x357ad9['reportType']||(_0x357ad9[_0x727c('0x40')]&&_0x357ad9['attrs'][0x0]?_0x357ad9[_0x727c('0x40')][0x0][_0x727c('0x3e')]:undefined)||null,'value':_0x357ad9[_0x727c('0x52')]||(_0x357ad9[_0x727c('0x40')]&&_0x357ad9['attrs'][0x0]?_0x357ad9[_0x727c('0x40')][0x0][_0x727c('0x43')]:undefined)||null},{'name':_0x727c('0x53'),'value':_0x357ad9[_0x727c('0x53')]||(_0x357ad9[_0x727c('0x40')]&&_0x357ad9[_0x727c('0x40')][0x1]?_0x357ad9[_0x727c('0x40')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x3601fd){logger[_0x727c('0x2b')](_0x727c('0x54'),JSON[_0x727c('0x55')](_0x3601fd));return[];}}exports[_0x727c('0x56')]=function(_0x50bb71,_0x386088){if(_0x50bb71[_0x727c('0x57')]){_0x50bb71[_0x727c('0x57')]['attrs']=widgetAttributes(_0x50bb71[_0x727c('0x57')]);}return db[_0x727c('0x3d')]['create'](_0x50bb71[_0x727c('0x57')],{})[_0x727c('0x29')](respondWithResult(_0x386088,0xc9))[_0x727c('0x3c')](handleError(_0x386088,null));};exports[_0x727c('0x28')]=function(_0x5a6f91,_0x5405ef){if(_0x5a6f91[_0x727c('0x57')]['id']){delete _0x5a6f91['body']['id'];}_0x5a6f91[_0x727c('0x57')][_0x727c('0x40')]=widgetAttributes(_0x5a6f91[_0x727c('0x57')]);return db[_0x727c('0x3d')][_0x727c('0x3b')]({'where':{'id':_0x5a6f91[_0x727c('0x2f')]['id']}})[_0x727c('0x29')](handleEntityNotFound(_0x5405ef,null))[_0x727c('0x29')](saveUpdates(_0x5a6f91[_0x727c('0x57')],null))['then'](respondWithResult(_0x5405ef,null))['catch'](handleError(_0x5405ef,null));}; \ No newline at end of file +var _0x81ce=['attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','end','stack','name','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','custom','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric'];(function(_0xa5ef7d,_0x1ee578){var _0x5bbba6=function(_0x48eaab){while(--_0x48eaab){_0xa5ef7d['push'](_0xa5ef7d['shift']());}};_0x5bbba6(++_0x1ee578);}(_0x81ce,0xca));var _0xe81c=function(_0x2ab0a8,_0x3935d0){_0x2ab0a8=_0x2ab0a8-0x0;var _0x3a6ca2=_0x81ce[_0x2ab0a8];return _0x3a6ca2;};'use strict';var emlformat=require(_0xe81c('0x0'));var rimraf=require(_0xe81c('0x1'));var zipdir=require(_0xe81c('0x2'));var jsonpatch=require(_0xe81c('0x3'));var rp=require(_0xe81c('0x4'));var moment=require(_0xe81c('0x5'));var BPromise=require(_0xe81c('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe81c('0x7'));var sox=require(_0xe81c('0x8'));var csv=require(_0xe81c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe81c('0xa'));var _=require(_0xe81c('0xb'));var squel=require(_0xe81c('0xc'));var crypto=require(_0xe81c('0xd'));var jsforce=require(_0xe81c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe81c('0xf'));var Papa=require(_0xe81c('0x10'));var Redis=require(_0xe81c('0x11'));var authService=require(_0xe81c('0x12'));var qs=require(_0xe81c('0x13'));var as=require(_0xe81c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe81c('0x15'));var utils=require('../../config/utils');var config=require(_0xe81c('0x16'));var licenseUtil=require(_0xe81c('0x17'));var db=require(_0xe81c('0x18'))['db'];config[_0xe81c('0x19')]=_[_0xe81c('0x1a')](config[_0xe81c('0x19')],{'host':_0xe81c('0x1b'),'port':0x18eb});var socket=require(_0xe81c('0x1c'))(new Redis(config[_0xe81c('0x19')]));require(_0xe81c('0x1d'))[_0xe81c('0x1e')](socket);function respondWithStatusCode(_0x41145c,_0x32faa6){_0x32faa6=_0x32faa6||0xcc;return function(_0x21dc7c){if(_0x21dc7c){return _0x41145c[_0xe81c('0x1f')](_0x32faa6);}return _0x41145c['status'](_0x32faa6)['end']();};}function respondWithResult(_0x539821,_0x4f3e0f){_0x4f3e0f=_0x4f3e0f||0xc8;return function(_0x25408b){if(_0x25408b){return _0x539821['status'](_0x4f3e0f)[_0xe81c('0x20')](_0x25408b);}};}function respondWithFilteredResult(_0x8e6504,_0x552b25){return function(_0x26cd1d){if(_0x26cd1d){var _0x57cfbb=typeof _0x552b25[_0xe81c('0x21')]===_0xe81c('0x22')&&typeof _0x552b25[_0xe81c('0x23')]===_0xe81c('0x22');var _0x3e9213=_0x26cd1d['count'];var _0x348232=_0x57cfbb?0x0:_0x552b25[_0xe81c('0x21')];var _0x91ad2e=_0x57cfbb?_0x26cd1d[_0xe81c('0x24')]:_0x552b25[_0xe81c('0x21')]+_0x552b25[_0xe81c('0x23')];var _0x53257a;if(_0x91ad2e>=_0x3e9213){_0x91ad2e=_0x3e9213;_0x53257a=0xc8;}else{_0x53257a=0xce;}_0x8e6504[_0xe81c('0x25')](_0x53257a);return _0x8e6504[_0xe81c('0x26')](_0xe81c('0x27'),_0x348232+'-'+_0x91ad2e+'/'+_0x3e9213)[_0xe81c('0x20')](_0x26cd1d);}return null;};}function patchUpdates(_0x22ac70){return function(_0x29d046){try{jsonpatch[_0xe81c('0x28')](_0x29d046,_0x22ac70,!![]);}catch(_0x399c24){return BPromise[_0xe81c('0x29')](_0x399c24);}return _0x29d046[_0xe81c('0x2a')]();};}function saveUpdates(_0x264db9,_0x29fb04){return function(_0xdab95a){if(_0xdab95a){return _0xdab95a['update'](_0x264db9)[_0xe81c('0x2b')](function(_0x37f70e){return _0x37f70e;});}return null;};}function removeEntity(_0x2339a2,_0x4d7259){return function(_0x43cdb9){if(_0x43cdb9){return _0x43cdb9['destroy']()['then'](function(){_0x2339a2[_0xe81c('0x25')](0xcc)[_0xe81c('0x2c')]();});}};}function handleEntityNotFound(_0x3b5a4f,_0x4a4f6f){return function(_0x39e1ca){if(!_0x39e1ca){_0x3b5a4f[_0xe81c('0x1f')](0x194);}return _0x39e1ca;};}function handleError(_0x2c34ba,_0x303f04){_0x303f04=_0x303f04||0x1f4;return function(_0x593b88){logger['error'](_0x593b88[_0xe81c('0x2d')]);if(_0x593b88['name']){delete _0x593b88[_0xe81c('0x2e')];}_0x2c34ba['status'](_0x303f04)['send'](_0x593b88);};}exports['show']=function(_0x222691,_0x1dd8bb){var _0x29bd43={'raw':![],'where':{'id':_0x222691[_0xe81c('0x2f')]['id']}},_0x3e04c9={};_0x3e04c9[_0xe81c('0x30')]=_[_0xe81c('0x31')](db[_0xe81c('0x32')][_0xe81c('0x33')]);_0x3e04c9[_0xe81c('0x34')]=_[_0xe81c('0x31')](_0x222691[_0xe81c('0x34')]);_0x3e04c9[_0xe81c('0x35')]=_[_0xe81c('0x36')](_0x3e04c9[_0xe81c('0x30')],_0x3e04c9[_0xe81c('0x34')]);_0x29bd43['attributes']=_[_0xe81c('0x36')](_0x3e04c9['model'],qs[_0xe81c('0x37')](_0x222691[_0xe81c('0x34')][_0xe81c('0x37')]));_0x29bd43[_0xe81c('0x38')]=_0x29bd43[_0xe81c('0x38')]['length']?_0x29bd43['attributes']:_0x3e04c9[_0xe81c('0x30')];if(_0x222691[_0xe81c('0x34')][_0xe81c('0x39')]){_0x29bd43[_0xe81c('0x3a')]=[{'all':!![]}];}_0x29bd43=_[_0xe81c('0x3b')]({},_0x29bd43,_0x222691[_0xe81c('0x3c')]);return db[_0xe81c('0x32')][_0xe81c('0x3d')](_0x29bd43)['then'](handleEntityNotFound(_0x1dd8bb,null))[_0xe81c('0x2b')](respondWithResult(_0x1dd8bb,null))[_0xe81c('0x3e')](handleError(_0x1dd8bb,null));};exports['destroy']=function(_0x573e20,_0x313310){return db[_0xe81c('0x32')][_0xe81c('0x3d')]({'where':{'id':_0x573e20[_0xe81c('0x2f')]['id']}})['then'](handleEntityNotFound(_0x313310,null))[_0xe81c('0x2b')](removeEntity(_0x313310,null))['catch'](handleError(_0x313310,null));};function widgetAttributes(_0x5baafe){try{switch(_0x5baafe[_0xe81c('0x3f')]){case _0xe81c('0x40'):return[{'name':_0xe81c('0x41'),'value':_0x5baafe['attrUrl']||(_0x5baafe['attrs']&&_0x5baafe[_0xe81c('0x42')][0x0]?_0x5baafe[_0xe81c('0x42')][0x0]['value']:undefined)||'https://'}];case _0xe81c('0x43'):return[{'name':'attrPath','value':_0x5baafe[_0xe81c('0x44')]||(_0x5baafe[_0xe81c('0x42')]&&_0x5baafe[_0xe81c('0x42')][0x0]?_0x5baafe[_0xe81c('0x42')][0x0][_0xe81c('0x45')]:undefined)||''}];case _0xe81c('0x46'):return[{'name':_0xe81c('0x47'),'value':_0x5baafe['attrHourFormat']||(_0x5baafe['attrs']&&_0x5baafe[_0xe81c('0x42')][0x0]?_0x5baafe[_0xe81c('0x42')][0x0][_0xe81c('0x45')]:undefined)||'HH:mm:ss'},{'name':_0xe81c('0x48'),'value':_0x5baafe[_0xe81c('0x48')]||(_0x5baafe[_0xe81c('0x42')]&&_0x5baafe['attrs'][0x1]?_0x5baafe['attrs'][0x1][_0xe81c('0x45')]:undefined)||_0xe81c('0x49')},{'name':_0xe81c('0x4a'),'value':_0x5baafe[_0xe81c('0x4a')]||(_0x5baafe[_0xe81c('0x42')]&&_0x5baafe[_0xe81c('0x42')][0x2]?_0x5baafe[_0xe81c('0x42')][0x2][_0xe81c('0x45')]:undefined)||0xc}];case _0xe81c('0x4b'):return[{'name':'attrMetric','value':_0x5baafe[_0xe81c('0x4c')]||(_0x5baafe['attrs']&&_0x5baafe['attrs'][0x0]?_0x5baafe[_0xe81c('0x42')][0x0]['value']:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x5baafe[_0xe81c('0x4d')]||(_0x5baafe[_0xe81c('0x42')]&&_0x5baafe[_0xe81c('0x42')][0x1]?_0x5baafe[_0xe81c('0x42')][0x1][_0xe81c('0x45')]:undefined)||[]},{'name':'attrFontSize','value':_0x5baafe[_0xe81c('0x4a')]||(_0x5baafe['attrs']&&_0x5baafe[_0xe81c('0x42')][0x2]?_0x5baafe[_0xe81c('0x42')][0x2][_0xe81c('0x45')]:undefined)||0x14}];case _0xe81c('0x4e'):case _0xe81c('0x4f'):return[{'name':_0xe81c('0x50'),'value':_0x5baafe[_0xe81c('0x50')]||(_0x5baafe[_0xe81c('0x42')]&&_0x5baafe[_0xe81c('0x42')][0x0]?_0x5baafe['attrs'][0x0][_0xe81c('0x45')]:undefined)||_0xe81c('0x51')},{'name':_0xe81c('0x52'),'value':_0x5baafe['attrSerie2']||(_0x5baafe['attrs']&&_0x5baafe[_0xe81c('0x42')][0x1]?_0x5baafe[_0xe81c('0x42')][0x1][_0xe81c('0x45')]:undefined)||null},{'name':_0xe81c('0x53'),'value':_0x5baafe[_0xe81c('0x53')]||(_0x5baafe['attrs']&&_0x5baafe[_0xe81c('0x42')][0x2]?_0x5baafe[_0xe81c('0x42')][0x2][_0xe81c('0x45')]:undefined)||null},{'name':_0xe81c('0x4d'),'value':_0x5baafe[_0xe81c('0x4d')]||(_0x5baafe['attrs']&&_0x5baafe[_0xe81c('0x42')][0x3]?_0x5baafe['attrs'][0x3]['value']:undefined)||[]}];case _0xe81c('0x54'):return[{'name':'attrReport','type':_0x5baafe['reportType']||(_0x5baafe[_0xe81c('0x42')]&&_0x5baafe[_0xe81c('0x42')][0x0]?_0x5baafe[_0xe81c('0x42')][0x0][_0xe81c('0x3f')]:undefined)||null,'value':_0x5baafe[_0xe81c('0x55')]||(_0x5baafe[_0xe81c('0x42')]&&_0x5baafe[_0xe81c('0x42')][0x0]?_0x5baafe[_0xe81c('0x42')][0x0][_0xe81c('0x45')]:undefined)||null},{'name':_0xe81c('0x56'),'value':_0x5baafe[_0xe81c('0x56')]||(_0x5baafe[_0xe81c('0x42')]&&_0x5baafe[_0xe81c('0x42')][0x1]?_0x5baafe[_0xe81c('0x42')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x903ff7){logger[_0xe81c('0x57')](_0xe81c('0x58'),JSON[_0xe81c('0x59')](_0x903ff7));return[];}}exports[_0xe81c('0x5a')]=function(_0x3f36d9,_0x149c39){if(_0x3f36d9['body']){_0x3f36d9[_0xe81c('0x5b')][_0xe81c('0x42')]=widgetAttributes(_0x3f36d9[_0xe81c('0x5b')]);}return db[_0xe81c('0x32')][_0xe81c('0x5a')](_0x3f36d9[_0xe81c('0x5b')],{})[_0xe81c('0x2b')](respondWithResult(_0x149c39,0xc9))[_0xe81c('0x3e')](handleError(_0x149c39,null));};exports[_0xe81c('0x5c')]=function(_0x36f475,_0x211781){if(_0x36f475[_0xe81c('0x5b')]['id']){delete _0x36f475['body']['id'];}_0x36f475[_0xe81c('0x5b')][_0xe81c('0x42')]=widgetAttributes(_0x36f475['body']);return db[_0xe81c('0x32')][_0xe81c('0x3d')]({'where':{'id':_0x36f475[_0xe81c('0x2f')]['id']}})[_0xe81c('0x2b')](handleEntityNotFound(_0x211781,null))[_0xe81c('0x2b')](saveUpdates(_0x36f475[_0xe81c('0x5b')],null))[_0xe81c('0x2b')](respondWithResult(_0x211781,null))[_0xe81c('0x3e')](handleError(_0x211781,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 84fe58f..3f0dc25 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 _0xf459=['hook','exports','events','../../mysqldb','DashboardItem','update','remove','emit','hasOwnProperty'];(function(_0x336bbe,_0x27da18){var _0x3eb536=function(_0x1c3a93){while(--_0x1c3a93){_0x336bbe['push'](_0x336bbe['shift']());}};_0x3eb536(++_0x27da18);}(_0xf459,0x16a));var _0x9f45=function(_0x42ca15,_0x193ccb){_0x42ca15=_0x42ca15-0x0;var _0x1c6ded=_0xf459[_0x42ca15];return _0x1c6ded;};'use strict';var EventEmitter=require(_0x9f45('0x0'));var DashboardItem=require(_0x9f45('0x1'))['db'][_0x9f45('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9f45('0x3'),'afterDestroy':_0x9f45('0x4')};function emitEvent(_0x31c18f){return function(_0x55ce58,_0x236101,_0x32827c){DashboardItemEvents['emit'](_0x31c18f+':'+_0x55ce58['id'],_0x55ce58);DashboardItemEvents[_0x9f45('0x5')](_0x31c18f,_0x55ce58);_0x32827c(null);};}for(var e in events){if(events[_0x9f45('0x6')](e)){var event=events[e];DashboardItem[_0x9f45('0x7')](e,emitEvent(event));}}module[_0x9f45('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x546f=['setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x546f,0xf7));var _0xf546=function(_0x3a32e0,_0x69a2f1){_0x3a32e0=_0x3a32e0-0x0;var _0x43ae59=_0x546f[_0x3a32e0];return _0x43ae59;};'use strict';var EventEmitter=require(_0xf546('0x0'));var DashboardItem=require(_0xf546('0x1'))['db'][_0xf546('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xf546('0x3')](0x0);var events={'afterCreate':_0xf546('0x4'),'afterUpdate':_0xf546('0x5'),'afterDestroy':_0xf546('0x6')};function emitEvent(_0x379a7d){return function(_0x3c3344,_0x354c82,_0x535f2e){DashboardItemEvents['emit'](_0x379a7d+':'+_0x3c3344['id'],_0x3c3344);DashboardItemEvents['emit'](_0x379a7d,_0x3c3344);_0x535f2e(null);};}for(var e in events){if(events[_0xf546('0x7')](e)){var event=events[e];DashboardItem[_0xf546('0x8')](e,emitEvent(event));}}module[_0xf546('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 8e7ace7..3dc7292 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 _0x8666=['./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x8666,0x18b));var _0x6866=function(_0x129012,_0x34ab3e){_0x129012=_0x129012-0x0;var _0x51e0d5=_0x8666[_0x129012];return _0x51e0d5;};'use strict';var _=require(_0x6866('0x0'));var util=require('util');var logger=require(_0x6866('0x1'))(_0x6866('0x2'));var moment=require('moment');var BPromise=require(_0x6866('0x3'));var rp=require(_0x6866('0x4'));var fs=require('fs');var path=require(_0x6866('0x5'));var rimraf=require(_0x6866('0x6'));var config=require(_0x6866('0x7'));var attributes=require(_0x6866('0x8'));module[_0x6866('0x9')]=function(_0x25f5a1,_0x40a79c){return _0x25f5a1[_0x6866('0xa')](_0x6866('0xb'),attributes,{'tableName':_0x6866('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9af6=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items','lodash'];(function(_0x5b4303,_0x225e71){var _0x1aacba=function(_0x1ac0d0){while(--_0x1ac0d0){_0x5b4303['push'](_0x5b4303['shift']());}};_0x1aacba(++_0x225e71);}(_0x9af6,0xb5));var _0x69af=function(_0xc6c4cc,_0x217acd){_0xc6c4cc=_0xc6c4cc-0x0;var _0x59f64f=_0x9af6[_0xc6c4cc];return _0x59f64f;};'use strict';var _=require(_0x69af('0x0'));var util=require(_0x69af('0x1'));var logger=require(_0x69af('0x2'))(_0x69af('0x3'));var moment=require(_0x69af('0x4'));var BPromise=require('bluebird');var rp=require(_0x69af('0x5'));var fs=require('fs');var path=require(_0x69af('0x6'));var rimraf=require(_0x69af('0x7'));var config=require(_0x69af('0x8'));var attributes=require(_0x69af('0x9'));module[_0x69af('0xa')]=function(_0x2e5ffe,_0x328987){return _0x2e5ffe['define'](_0x69af('0xb'),attributes,{'tableName':_0x69af('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 2269d2b..79f5dcc 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 _0x889b=['localhost','socket.io-emitter','register','request','then','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','info','result','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x889b,0x16d));var _0xb889=function(_0x17348b,_0x1a42ba){_0x17348b=_0x17348b-0x0;var _0x3a9762=_0x889b[_0x17348b];return _0x3a9762;};'use strict';var _=require(_0xb889('0x0'));var util=require(_0xb889('0x1'));var moment=require(_0xb889('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb889('0x3'))['db'];var utils=require(_0xb889('0x4'));var logger=require(_0xb889('0x5'))(_0xb889('0x6'));var config=require(_0xb889('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb889('0x8')]['http']({'port':0x232a});config[_0xb889('0x9')]=_['defaults'](config[_0xb889('0x9')],{'host':_0xb889('0xa'),'port':0x18eb});var socket=require(_0xb889('0xb'))(new Redis(config[_0xb889('0x9')]));require('./dashboardItem.socket')[_0xb889('0xc')](socket);function respondWithRpcPromise(_0x1fcd30,_0xe59e9,_0xf421){return new BPromise(function(_0x4ca8ed,_0x13cabe){return client[_0xb889('0xd')](_0x1fcd30,_0xf421)[_0xb889('0xe')](function(_0x299495){logger['info']('DashboardItem,\x20%s,\x20%s',_0xe59e9,_0xb889('0xf'));logger[_0xb889('0x10')](_0xb889('0x11'),_0xe59e9,_0xb889('0xf'),JSON[_0xb889('0x12')](_0x299495));if(_0x299495[_0xb889('0x13')]){if(_0x299495[_0xb889('0x13')][_0xb889('0x14')]===0x1f4){logger[_0xb889('0x13')]('DashboardItem,\x20%s,\x20%s',_0xe59e9,_0x299495['error'][_0xb889('0x15')]);return _0x13cabe(_0x299495[_0xb889('0x13')]['message']);}logger[_0xb889('0x13')](_0xb889('0x16'),_0xe59e9,_0x299495[_0xb889('0x13')][_0xb889('0x15')]);return _0x4ca8ed(_0x299495[_0xb889('0x13')][_0xb889('0x15')]);}else{logger[_0xb889('0x17')]('DashboardItem,\x20%s,\x20%s',_0xe59e9,_0xb889('0xf'));_0x4ca8ed(_0x299495[_0xb889('0x18')]['message']);}})['catch'](function(_0x1f4335){logger['error'](_0xb889('0x16'),_0xe59e9,_0x1f4335);_0x13cabe(_0x1f4335);});});} \ No newline at end of file +var _0x9a15=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x285076,_0x563543){var _0x5af146=function(_0xd19901){while(--_0xd19901){_0x285076['push'](_0x285076['shift']());}};_0x5af146(++_0x563543);}(_0x9a15,0x130));var _0x59a1=function(_0x33f226,_0x101d32){_0x33f226=_0x33f226-0x0;var _0x277648=_0x9a15[_0x33f226];return _0x277648;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x59a1('0x0'));var BPromise=require(_0x59a1('0x1'));var rs=require(_0x59a1('0x2'));var fs=require('fs');var Redis=require(_0x59a1('0x3'));var db=require(_0x59a1('0x4'))['db'];var utils=require(_0x59a1('0x5'));var logger=require(_0x59a1('0x6'))(_0x59a1('0x7'));var config=require('../../config/environment');var jayson=require(_0x59a1('0x8'));var client=jayson[_0x59a1('0x9')][_0x59a1('0xa')]({'port':0x232a});config[_0x59a1('0xb')]=_['defaults'](config[_0x59a1('0xb')],{'host':_0x59a1('0xc'),'port':0x18eb});var socket=require(_0x59a1('0xd'))(new Redis(config[_0x59a1('0xb')]));require(_0x59a1('0xe'))[_0x59a1('0xf')](socket);function respondWithRpcPromise(_0x5942a9,_0x1092e4,_0x51b412){return new BPromise(function(_0xaa8c38,_0x4b4101){return client[_0x59a1('0x10')](_0x5942a9,_0x51b412)[_0x59a1('0x11')](function(_0x2cf788){logger[_0x59a1('0x12')](_0x59a1('0x13'),_0x1092e4,_0x59a1('0x14'));logger[_0x59a1('0x15')](_0x59a1('0x16'),_0x1092e4,_0x59a1('0x14'),JSON[_0x59a1('0x17')](_0x2cf788));if(_0x2cf788[_0x59a1('0x18')]){if(_0x2cf788[_0x59a1('0x18')]['code']===0x1f4){logger[_0x59a1('0x18')](_0x59a1('0x13'),_0x1092e4,_0x2cf788['error'][_0x59a1('0x19')]);return _0x4b4101(_0x2cf788[_0x59a1('0x18')]['message']);}logger[_0x59a1('0x18')](_0x59a1('0x13'),_0x1092e4,_0x2cf788[_0x59a1('0x18')][_0x59a1('0x19')]);return _0xaa8c38(_0x2cf788[_0x59a1('0x18')][_0x59a1('0x19')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x1092e4,_0x59a1('0x14'));_0xaa8c38(_0x2cf788[_0x59a1('0x1a')][_0x59a1('0x19')]);}})[_0x59a1('0x1b')](function(_0x183999){logger[_0x59a1('0x18')](_0x59a1('0x13'),_0x1092e4,_0x183999);_0x4b4101(_0x183999);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 8069ab8..6b33680 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 _0x8d66=['save','remove','emit','removeListener','length','dashboardItem:','./dashboardItem.events'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x8d66,0xfb));var _0x68d6=function(_0x566643,_0x1796e8){_0x566643=_0x566643-0x0;var _0x2d5989=_0x8d66[_0x566643];return _0x2d5989;};'use strict';var DashboardItemEvents=require(_0x68d6('0x0'));var events=[_0x68d6('0x1'),_0x68d6('0x2'),'update'];function createListener(_0x3df16a,_0x4e7e32){return function(_0x520764){_0x4e7e32[_0x68d6('0x3')](_0x3df16a,_0x520764);};}function removeListener(_0x1bed1a,_0x589b3e){return function(){DashboardItemEvents[_0x68d6('0x4')](_0x1bed1a,_0x589b3e);};}exports['register']=function(_0x545c6d){for(var _0x120227=0x0,_0x28a399=events[_0x68d6('0x5')];_0x120227<_0x28a399;_0x120227++){var _0xf77ab1=events[_0x120227];var _0x5889da=createListener(_0x68d6('0x6')+_0xf77ab1,_0x545c6d);DashboardItemEvents['on'](_0xf77ab1,_0x5889da);}}; \ No newline at end of file +var _0x6bce=['register','length','dashboardItem:','./dashboardItem.events','save','remove','update','emit'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x6bce,0xfb));var _0xe6bc=function(_0x24eab8,_0x2f471c){_0x24eab8=_0x24eab8-0x0;var _0x41d883=_0x6bce[_0x24eab8];return _0x41d883;};'use strict';var DashboardItemEvents=require(_0xe6bc('0x0'));var events=[_0xe6bc('0x1'),_0xe6bc('0x2'),_0xe6bc('0x3')];function createListener(_0x5924bd,_0x51fd92){return function(_0x5a1686){_0x51fd92[_0xe6bc('0x4')](_0x5924bd,_0x5a1686);};}function removeListener(_0x18244a,_0x3b43f2){return function(){DashboardItemEvents['removeListener'](_0x18244a,_0x3b43f2);};}exports[_0xe6bc('0x5')]=function(_0x5e7984){for(var _0xbd5120=0x0,_0x16008f=events[_0xe6bc('0x6')];_0xbd5120<_0x16008f;_0xbd5120++){var _0x18538f=events[_0xbd5120];var _0x41a0d3=createListener(_0xe6bc('0x7')+_0x18538f,_0x5e7984);DashboardItemEvents['on'](_0x18538f,_0x41a0d3);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 10bd41d..67a5d90 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 _0xadf0=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','update','destroy','exports','multer','util'];(function(_0x4dbf01,_0x4a10cd){var _0x3a0ff4=function(_0x448f95){while(--_0x448f95){_0x4dbf01['push'](_0x4dbf01['shift']());}};_0x3a0ff4(++_0x4a10cd);}(_0xadf0,0xfe));var _0x0adf=function(_0x3dc3ad,_0x4404ee){_0x3dc3ad=_0x3dc3ad-0x0;var _0x53cd86=_0xadf0[_0x3dc3ad];return _0x53cd86;};'use strict';var multer=require(_0x0adf('0x0'));var util=require(_0x0adf('0x1'));var path=require(_0x0adf('0x2'));var timeout=require(_0x0adf('0x3'));var express=require('express');var router=express[_0x0adf('0x4')]();var fs_extra=require(_0x0adf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0adf('0x6'));var config=require(_0x0adf('0x7'));var controller=require(_0x0adf('0x8'));router[_0x0adf('0x9')](_0x0adf('0xa'),auth[_0x0adf('0xb')](),controller[_0x0adf('0xc')]);router['post']('/',auth[_0x0adf('0xb')](),controller['create']);router['put'](_0x0adf('0xa'),auth[_0x0adf('0xb')](),controller[_0x0adf('0xd')]);router['delete'](_0x0adf('0xa'),auth[_0x0adf('0xb')](),controller[_0x0adf('0xe')]);module[_0x0adf('0xf')]=router; \ No newline at end of file +var _0x1e11=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','show','post','create','put','delete','/:id','multer'];(function(_0x115850,_0x4bb634){var _0xbad084=function(_0xa14074){while(--_0xa14074){_0x115850['push'](_0x115850['shift']());}};_0xbad084(++_0x4bb634);}(_0x1e11,0x1ef));var _0x11e1=function(_0x2685be,_0x5c8f98){_0x2685be=_0x2685be-0x0;var _0x32c3d2=_0x1e11[_0x2685be];return _0x32c3d2;};'use strict';var multer=require(_0x11e1('0x0'));var util=require(_0x11e1('0x1'));var path=require(_0x11e1('0x2'));var timeout=require('connect-timeout');var express=require(_0x11e1('0x3'));var router=express[_0x11e1('0x4')]();var fs_extra=require(_0x11e1('0x5'));var auth=require(_0x11e1('0x6'));var interaction=require(_0x11e1('0x7'));var config=require(_0x11e1('0x8'));var controller=require('./dashboardItem.controller');router['get']('/:id',auth[_0x11e1('0x9')](),controller[_0x11e1('0xa')]);router[_0x11e1('0xb')]('/',auth['isAuthenticated'](),controller[_0x11e1('0xc')]);router[_0x11e1('0xd')]('/:id',auth[_0x11e1('0x9')](),controller['update']);router[_0x11e1('0xe')](_0x11e1('0xf'),auth['isAuthenticated'](),controller['destroy']);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 efede61..bb58800 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 _0xd37d=['first','second','third','sequelize','exports','STRING','ENUM'];(function(_0x4d3fac,_0x3f8934){var _0x1d97dd=function(_0x50ba6c){while(--_0x50ba6c){_0x4d3fac['push'](_0x4d3fac['shift']());}};_0x1d97dd(++_0x3f8934);}(_0xd37d,0x106));var _0xdd37=function(_0x56f604,_0x31e0fc){_0x56f604=_0x56f604-0x0;var _0x5c3f23=_0xd37d[_0x56f604];return _0x5c3f23;};'use strict';var Sequelize=require(_0xdd37('0x0'));module[_0xdd37('0x1')]={'name':{'type':Sequelize[_0xdd37('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xdd37('0x3')](_0xdd37('0x4'),_0xdd37('0x5'),_0xdd37('0x6')),'allowNull':![],'defaultValue':_0xdd37('0x4')},'description':{'type':Sequelize[_0xdd37('0x2')]}}; \ No newline at end of file +var _0x2589=['first','sequelize','STRING','ENUM','second','third'];(function(_0x42bf74,_0x1bf7af){var _0x4b23a1=function(_0x5d0680){while(--_0x5d0680){_0x42bf74['push'](_0x42bf74['shift']());}};_0x4b23a1(++_0x1bf7af);}(_0x2589,0xc1));var _0x9258=function(_0x256dc1,_0x4bf425){_0x256dc1=_0x256dc1-0x0;var _0x1089dd=_0x2589[_0x256dc1];return _0x1089dd;};'use strict';var Sequelize=require(_0x9258('0x0'));module['exports']={'name':{'type':Sequelize[_0x9258('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x9258('0x2')]('first',_0x9258('0x3'),_0x9258('0x4')),'allowNull':![],'defaultValue':_0x9258('0x5')},'description':{'type':Sequelize[_0x9258('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 241c8f7..4cff25c 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 _0x08d9=['includeAll','include','findAll','rows','show','params','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge'];(function(_0x4cbe98,_0x576f7b){var _0x49c755=function(_0x1e0487){while(--_0x1e0487){_0x4cbe98['push'](_0x4cbe98['shift']());}};_0x49c755(++_0x576f7b);}(_0x08d9,0xc2));var _0x908d=function(_0x27e8ea,_0x1b0f1c){_0x27e8ea=_0x27e8ea-0x0;var _0x10c966=_0x08d9[_0x27e8ea];return _0x10c966;};'use strict';var emlformat=require(_0x908d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x908d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x908d('0x2'));var moment=require(_0x908d('0x3'));var BPromise=require(_0x908d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x908d('0x5'));var sox=require(_0x908d('0x6'));var csv=require(_0x908d('0x7'));var ejs=require(_0x908d('0x8'));var fs=require('fs');var fs_extra=require(_0x908d('0x9'));var _=require('lodash');var squel=require(_0x908d('0xa'));var crypto=require(_0x908d('0xb'));var jsforce=require(_0x908d('0xc'));var deskjs=require(_0x908d('0xd'));var toCsv=require(_0x908d('0x7'));var querystring=require(_0x908d('0xe'));var Papa=require(_0x908d('0xf'));var Redis=require(_0x908d('0x10'));var authService=require(_0x908d('0x11'));var qs=require(_0x908d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x908d('0x13'));var logger=require(_0x908d('0x14'))(_0x908d('0x15'));var utils=require(_0x908d('0x16'));var config=require(_0x908d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x588cc3,_0x3213df){_0x3213df=_0x3213df||0xcc;return function(_0x2c92df){if(_0x2c92df){return _0x588cc3[_0x908d('0x18')](_0x3213df);}return _0x588cc3[_0x908d('0x19')](_0x3213df)[_0x908d('0x1a')]();};}function respondWithResult(_0x3c1149,_0x9dbb7f){_0x9dbb7f=_0x9dbb7f||0xc8;return function(_0x4dcd6f){if(_0x4dcd6f){return _0x3c1149['status'](_0x9dbb7f)[_0x908d('0x1b')](_0x4dcd6f);}};}function respondWithFilteredResult(_0x207ac1,_0x178809){return function(_0x3cddfa){if(_0x3cddfa){var _0x5d7f40=typeof _0x178809['offset']===_0x908d('0x1c')&&typeof _0x178809[_0x908d('0x1d')]===_0x908d('0x1c');var _0x3f1c00=_0x3cddfa['count'];var _0x9438c7=_0x5d7f40?0x0:_0x178809[_0x908d('0x1e')];var _0x3dea46=_0x5d7f40?_0x3cddfa[_0x908d('0x1f')]:_0x178809[_0x908d('0x1e')]+_0x178809[_0x908d('0x1d')];var _0x10137f;if(_0x3dea46>=_0x3f1c00){_0x3dea46=_0x3f1c00;_0x10137f=0xc8;}else{_0x10137f=0xce;}_0x207ac1['status'](_0x10137f);return _0x207ac1[_0x908d('0x20')](_0x908d('0x21'),_0x9438c7+'-'+_0x3dea46+'/'+_0x3f1c00)[_0x908d('0x1b')](_0x3cddfa);}return null;};}function patchUpdates(_0x48ef83){return function(_0x37a7b8){try{jsonpatch[_0x908d('0x22')](_0x37a7b8,_0x48ef83,!![]);}catch(_0xdc1474){return BPromise[_0x908d('0x23')](_0xdc1474);}return _0x37a7b8[_0x908d('0x24')]();};}function saveUpdates(_0x53d9bb,_0x3a06c7){return function(_0x4a0875){if(_0x4a0875){return _0x4a0875[_0x908d('0x25')](_0x53d9bb)[_0x908d('0x26')](function(_0x4606a7){return _0x4606a7;});}return null;};}function removeEntity(_0x307b47,_0x43492b){return function(_0x423806){if(_0x423806){return _0x423806[_0x908d('0x27')]()[_0x908d('0x26')](function(){var _0x509105=_0x423806[_0x908d('0x28')]({'plain':!![]});var _0x1b5514=_0x908d('0x29');return db[_0x908d('0x2a')][_0x908d('0x27')]({'where':{'type':_0x1b5514,'resourceId':_0x509105['id']}})['then'](function(){return _0x423806;});})['then'](function(){_0x307b47[_0x908d('0x19')](0xcc)[_0x908d('0x1a')]();});}};}function handleEntityNotFound(_0x41ca76,_0x40e8bc){return function(_0x35e70d){if(!_0x35e70d){_0x41ca76['sendStatus'](0x194);}return _0x35e70d;};}function handleError(_0x3c4157,_0x541c8d){_0x541c8d=_0x541c8d||0x1f4;return function(_0x5f529e){logger[_0x908d('0x2b')](_0x5f529e[_0x908d('0x2c')]);if(_0x5f529e[_0x908d('0x2d')]){delete _0x5f529e[_0x908d('0x2d')];}_0x3c4157[_0x908d('0x19')](_0x541c8d)[_0x908d('0x2e')](_0x5f529e);};}exports[_0x908d('0x2f')]=function(_0x7a0d41,_0x2b8fa3){var _0xefe718={},_0xb38043={},_0x4828e4={'count':0x0,'rows':[]};var _0x12e888=_[_0x908d('0x30')](db[_0x908d('0x31')][_0x908d('0x32')],function(_0x4e44b6){return{'name':_0x4e44b6[_0x908d('0x33')],'type':_0x4e44b6[_0x908d('0x34')][_0x908d('0x35')]};});_0xb38043[_0x908d('0x36')]=_[_0x908d('0x30')](_0x12e888,_0x908d('0x2d'));_0xb38043[_0x908d('0x37')]=_[_0x908d('0x38')](_0x7a0d41[_0x908d('0x37')]);_0xb38043[_0x908d('0x39')]=_[_0x908d('0x3a')](_0xb38043['model'],_0xb38043['query']);_0xefe718[_0x908d('0x3b')]=_[_0x908d('0x3a')](_0xb38043['model'],qs['fields'](_0x7a0d41[_0x908d('0x37')][_0x908d('0x3c')]));_0xefe718[_0x908d('0x3b')]=_0xefe718[_0x908d('0x3b')][_0x908d('0x3d')]?_0xefe718['attributes']:_0xb38043[_0x908d('0x36')];if(!_0x7a0d41[_0x908d('0x37')][_0x908d('0x3e')](_0x908d('0x3f'))){_0xefe718[_0x908d('0x1d')]=qs['limit'](_0x7a0d41['query'][_0x908d('0x1d')]);_0xefe718['offset']=qs[_0x908d('0x1e')](_0x7a0d41[_0x908d('0x37')][_0x908d('0x1e')]);}_0xefe718[_0x908d('0x40')]=qs[_0x908d('0x41')](_0x7a0d41[_0x908d('0x37')][_0x908d('0x41')]);_0xefe718[_0x908d('0x42')]=qs['filters'](_['pick'](_0x7a0d41[_0x908d('0x37')],_0xb38043[_0x908d('0x39')]),_0x12e888);if(_0x7a0d41[_0x908d('0x37')]['filter']){_0xefe718['where']=_['merge'](_0xefe718[_0x908d('0x42')],{'$or':_['map'](_0x12e888,function(_0x2b0108){if(_0x2b0108[_0x908d('0x34')]!==_0x908d('0x43')){var _0x4981e8={};_0x4981e8[_0x2b0108['name']]={'$like':'%'+_0x7a0d41['query'][_0x908d('0x44')]+'%'};return _0x4981e8;}})});}_0xefe718=_[_0x908d('0x45')]({},_0xefe718,_0x7a0d41['options']);var _0x1e09fd={'where':_0xefe718['where']};return db[_0x908d('0x31')][_0x908d('0x1f')](_0x1e09fd)[_0x908d('0x26')](function(_0x5bf839){_0x4828e4[_0x908d('0x1f')]=_0x5bf839;if(_0x7a0d41[_0x908d('0x37')][_0x908d('0x46')]){_0xefe718[_0x908d('0x47')]=[{'all':!![]}];}return db['Disposition'][_0x908d('0x48')](_0xefe718);})[_0x908d('0x26')](function(_0x1c5910){_0x4828e4[_0x908d('0x49')]=_0x1c5910;return _0x4828e4;})[_0x908d('0x26')](respondWithFilteredResult(_0x2b8fa3,_0xefe718))['catch'](handleError(_0x2b8fa3,null));};exports[_0x908d('0x4a')]=function(_0x46bf67,_0x286529){var _0xb060cc={'raw':!![],'where':{'id':_0x46bf67[_0x908d('0x4b')]['id']}},_0x3582a8={};_0x3582a8['model']=_['keys'](db[_0x908d('0x31')]['rawAttributes']);_0x3582a8[_0x908d('0x37')]=_[_0x908d('0x38')](_0x46bf67['query']);_0x3582a8[_0x908d('0x39')]=_[_0x908d('0x3a')](_0x3582a8['model'],_0x3582a8[_0x908d('0x37')]);_0xb060cc[_0x908d('0x3b')]=_[_0x908d('0x3a')](_0x3582a8[_0x908d('0x36')],qs['fields'](_0x46bf67[_0x908d('0x37')]['fields']));_0xb060cc[_0x908d('0x3b')]=_0xb060cc[_0x908d('0x3b')]['length']?_0xb060cc[_0x908d('0x3b')]:_0x3582a8['model'];if(_0x46bf67['query'][_0x908d('0x46')]){_0xb060cc[_0x908d('0x47')]=[{'all':!![]}];}_0xb060cc=_[_0x908d('0x45')]({},_0xb060cc,_0x46bf67[_0x908d('0x4c')]);return db['Disposition']['find'](_0xb060cc)['then'](handleEntityNotFound(_0x286529,null))[_0x908d('0x26')](respondWithResult(_0x286529,null))[_0x908d('0x4d')](handleError(_0x286529,null));};exports[_0x908d('0x4e')]=function(_0x19d277,_0x44d091){return db[_0x908d('0x31')][_0x908d('0x4e')](_0x19d277[_0x908d('0x4f')],{})['then'](function(_0x2c7ba3){var _0x5c4105=_0x19d277[_0x908d('0x50')][_0x908d('0x28')]({'plain':!![]});if(!_0x5c4105)throw new Error(_0x908d('0x51'));if(_0x5c4105[_0x908d('0x52')]==='user'){var _0x51df00=_0x2c7ba3[_0x908d('0x28')]({'plain':!![]});var _0x297681=_0x908d('0x29');return db[_0x908d('0x53')][_0x908d('0x54')]({'where':{'name':_0x297681,'userProfileId':_0x5c4105[_0x908d('0x55')]},'raw':!![]})[_0x908d('0x26')](function(_0x40615b){if(_0x40615b&&_0x40615b[_0x908d('0x56')]===0x0){return db[_0x908d('0x2a')]['create']({'name':_0x51df00[_0x908d('0x2d')],'resourceId':_0x51df00['id'],'type':_0x40615b[_0x908d('0x2d')],'sectionId':_0x40615b['id']},{})['then'](function(){return _0x2c7ba3;});}else{return _0x2c7ba3;}})['catch'](function(_0x2ce1e6){logger['error'](_0x908d('0x57'),_0x2ce1e6);throw _0x2ce1e6;});}return _0x2c7ba3;})[_0x908d('0x26')](respondWithResult(_0x44d091,0xc9))['catch'](handleError(_0x44d091,null));};exports['update']=function(_0x21933f,_0x281914){if(_0x21933f['body']['id']){delete _0x21933f[_0x908d('0x4f')]['id'];}return db[_0x908d('0x31')][_0x908d('0x54')]({'where':{'id':_0x21933f[_0x908d('0x4b')]['id']}})[_0x908d('0x26')](handleEntityNotFound(_0x281914,null))[_0x908d('0x26')](saveUpdates(_0x21933f[_0x908d('0x4f')],null))[_0x908d('0x26')](respondWithResult(_0x281914,null))[_0x908d('0x4d')](handleError(_0x281914,null));};exports[_0x908d('0x27')]=function(_0x106320,_0xf00e21){return db['Disposition']['find']({'where':{'id':_0x106320[_0x908d('0x4b')]['id']}})['then'](handleEntityNotFound(_0xf00e21,null))[_0x908d('0x26')](removeEntity(_0xf00e21,null))[_0x908d('0x4d')](handleError(_0xf00e21,null));}; \ No newline at end of file +var _0x1c1d=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Dispositions','UserProfileResource','destroy','error','stack','name','index','map','Disposition','rawAttributes','type','key','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','length','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId'];(function(_0x308a3a,_0x2874b8){var _0x5b140a=function(_0x4db52d){while(--_0x4db52d){_0x308a3a['push'](_0x308a3a['shift']());}};_0x5b140a(++_0x2874b8);}(_0x1c1d,0xab));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd1c1('0x0'));var zipdir=require(_0xd1c1('0x1'));var jsonpatch=require(_0xd1c1('0x2'));var rp=require(_0xd1c1('0x3'));var moment=require(_0xd1c1('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd1c1('0x5'));var path=require('path');var sox=require(_0xd1c1('0x6'));var csv=require(_0xd1c1('0x7'));var ejs=require(_0xd1c1('0x8'));var fs=require('fs');var fs_extra=require(_0xd1c1('0x9'));var _=require('lodash');var squel=require(_0xd1c1('0xa'));var crypto=require(_0xd1c1('0xb'));var jsforce=require(_0xd1c1('0xc'));var deskjs=require(_0xd1c1('0xd'));var toCsv=require(_0xd1c1('0x7'));var querystring=require(_0xd1c1('0xe'));var Papa=require(_0xd1c1('0xf'));var Redis=require(_0xd1c1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd1c1('0x11'));var as=require(_0xd1c1('0x12'));var hardwareService=require(_0xd1c1('0x13'));var logger=require(_0xd1c1('0x14'))(_0xd1c1('0x15'));var utils=require('../../config/utils');var config=require(_0xd1c1('0x16'));var licenseUtil=require(_0xd1c1('0x17'));var db=require(_0xd1c1('0x18'))['db'];function respondWithStatusCode(_0x48443e,_0x47fd6e){_0x47fd6e=_0x47fd6e||0xcc;return function(_0x95b31e){if(_0x95b31e){return _0x48443e[_0xd1c1('0x19')](_0x47fd6e);}return _0x48443e[_0xd1c1('0x1a')](_0x47fd6e)[_0xd1c1('0x1b')]();};}function respondWithResult(_0xa208a3,_0x5b5786){_0x5b5786=_0x5b5786||0xc8;return function(_0x620969){if(_0x620969){return _0xa208a3[_0xd1c1('0x1a')](_0x5b5786)[_0xd1c1('0x1c')](_0x620969);}};}function respondWithFilteredResult(_0x3ddd22,_0x47e75a){return function(_0x39ac4f){if(_0x39ac4f){var _0x236e7d=typeof _0x47e75a['offset']==='undefined'&&typeof _0x47e75a[_0xd1c1('0x1d')]==='undefined';var _0x3934cf=_0x39ac4f[_0xd1c1('0x1e')];var _0x79441f=_0x236e7d?0x0:_0x47e75a[_0xd1c1('0x1f')];var _0x373566=_0x236e7d?_0x39ac4f[_0xd1c1('0x1e')]:_0x47e75a[_0xd1c1('0x1f')]+_0x47e75a[_0xd1c1('0x1d')];var _0x2b0791;if(_0x373566>=_0x3934cf){_0x373566=_0x3934cf;_0x2b0791=0xc8;}else{_0x2b0791=0xce;}_0x3ddd22['status'](_0x2b0791);return _0x3ddd22[_0xd1c1('0x20')](_0xd1c1('0x21'),_0x79441f+'-'+_0x373566+'/'+_0x3934cf)[_0xd1c1('0x1c')](_0x39ac4f);}return null;};}function patchUpdates(_0x19035a){return function(_0x424cc7){try{jsonpatch[_0xd1c1('0x22')](_0x424cc7,_0x19035a,!![]);}catch(_0x451aff){return BPromise[_0xd1c1('0x23')](_0x451aff);}return _0x424cc7[_0xd1c1('0x24')]();};}function saveUpdates(_0x9905af,_0x21f6d5){return function(_0x4fb56a){if(_0x4fb56a){return _0x4fb56a[_0xd1c1('0x25')](_0x9905af)[_0xd1c1('0x26')](function(_0x23ac17){return _0x23ac17;});}return null;};}function removeEntity(_0x53ef27,_0x3425b6){return function(_0x289b41){if(_0x289b41){return _0x289b41['destroy']()[_0xd1c1('0x26')](function(){var _0x4589a2=_0x289b41[_0xd1c1('0x27')]({'plain':!![]});var _0x22f3ae=_0xd1c1('0x28');return db[_0xd1c1('0x29')][_0xd1c1('0x2a')]({'where':{'type':_0x22f3ae,'resourceId':_0x4589a2['id']}})[_0xd1c1('0x26')](function(){return _0x289b41;});})['then'](function(){_0x53ef27[_0xd1c1('0x1a')](0xcc)[_0xd1c1('0x1b')]();});}};}function handleEntityNotFound(_0x4dad78,_0x45da6c){return function(_0x1fcb11){if(!_0x1fcb11){_0x4dad78[_0xd1c1('0x19')](0x194);}return _0x1fcb11;};}function handleError(_0x35a4a4,_0x3716e4){_0x3716e4=_0x3716e4||0x1f4;return function(_0xc4a6fa){logger[_0xd1c1('0x2b')](_0xc4a6fa[_0xd1c1('0x2c')]);if(_0xc4a6fa[_0xd1c1('0x2d')]){delete _0xc4a6fa[_0xd1c1('0x2d')];}_0x35a4a4[_0xd1c1('0x1a')](_0x3716e4)['send'](_0xc4a6fa);};}exports[_0xd1c1('0x2e')]=function(_0x40fb73,_0x3b45d3){var _0x399b0d={},_0x1ef993={},_0x5f11ba={'count':0x0,'rows':[]};var _0x23e48=_[_0xd1c1('0x2f')](db[_0xd1c1('0x30')][_0xd1c1('0x31')],function(_0x4e2554){return{'name':_0x4e2554['fieldName'],'type':_0x4e2554[_0xd1c1('0x32')][_0xd1c1('0x33')]};});_0x1ef993[_0xd1c1('0x34')]=_[_0xd1c1('0x2f')](_0x23e48,_0xd1c1('0x2d'));_0x1ef993['query']=_[_0xd1c1('0x35')](_0x40fb73[_0xd1c1('0x36')]);_0x1ef993[_0xd1c1('0x37')]=_['intersection'](_0x1ef993[_0xd1c1('0x34')],_0x1ef993[_0xd1c1('0x36')]);_0x399b0d[_0xd1c1('0x38')]=_['intersection'](_0x1ef993[_0xd1c1('0x34')],qs[_0xd1c1('0x39')](_0x40fb73[_0xd1c1('0x36')][_0xd1c1('0x39')]));_0x399b0d['attributes']=_0x399b0d[_0xd1c1('0x38')]['length']?_0x399b0d[_0xd1c1('0x38')]:_0x1ef993[_0xd1c1('0x34')];if(!_0x40fb73['query'][_0xd1c1('0x3a')](_0xd1c1('0x3b'))){_0x399b0d[_0xd1c1('0x1d')]=qs[_0xd1c1('0x1d')](_0x40fb73[_0xd1c1('0x36')][_0xd1c1('0x1d')]);_0x399b0d[_0xd1c1('0x1f')]=qs[_0xd1c1('0x1f')](_0x40fb73['query'][_0xd1c1('0x1f')]);}_0x399b0d[_0xd1c1('0x3c')]=qs[_0xd1c1('0x3d')](_0x40fb73[_0xd1c1('0x36')][_0xd1c1('0x3d')]);_0x399b0d[_0xd1c1('0x3e')]=qs[_0xd1c1('0x37')](_['pick'](_0x40fb73[_0xd1c1('0x36')],_0x1ef993[_0xd1c1('0x37')]),_0x23e48);if(_0x40fb73[_0xd1c1('0x36')][_0xd1c1('0x3f')]){_0x399b0d[_0xd1c1('0x3e')]=_['merge'](_0x399b0d[_0xd1c1('0x3e')],{'$or':_['map'](_0x23e48,function(_0x56b14){if(_0x56b14[_0xd1c1('0x32')]!==_0xd1c1('0x40')){var _0x4923c0={};_0x4923c0[_0x56b14[_0xd1c1('0x2d')]]={'$like':'%'+_0x40fb73[_0xd1c1('0x36')][_0xd1c1('0x3f')]+'%'};return _0x4923c0;}})});}_0x399b0d=_['merge']({},_0x399b0d,_0x40fb73[_0xd1c1('0x41')]);var _0xbe3344={'where':_0x399b0d['where']};return db[_0xd1c1('0x30')][_0xd1c1('0x1e')](_0xbe3344)['then'](function(_0x1f5de0){_0x5f11ba['count']=_0x1f5de0;if(_0x40fb73[_0xd1c1('0x36')][_0xd1c1('0x42')]){_0x399b0d[_0xd1c1('0x43')]=[{'all':!![]}];}return db['Disposition'][_0xd1c1('0x44')](_0x399b0d);})['then'](function(_0x21abf6){_0x5f11ba[_0xd1c1('0x45')]=_0x21abf6;return _0x5f11ba;})[_0xd1c1('0x26')](respondWithFilteredResult(_0x3b45d3,_0x399b0d))[_0xd1c1('0x46')](handleError(_0x3b45d3,null));};exports[_0xd1c1('0x47')]=function(_0x56f14a,_0xcde35c){var _0xf4243c={'raw':!![],'where':{'id':_0x56f14a['params']['id']}},_0x191fe6={};_0x191fe6['model']=_[_0xd1c1('0x35')](db['Disposition'][_0xd1c1('0x31')]);_0x191fe6[_0xd1c1('0x36')]=_[_0xd1c1('0x35')](_0x56f14a[_0xd1c1('0x36')]);_0x191fe6[_0xd1c1('0x37')]=_[_0xd1c1('0x48')](_0x191fe6[_0xd1c1('0x34')],_0x191fe6[_0xd1c1('0x36')]);_0xf4243c['attributes']=_[_0xd1c1('0x48')](_0x191fe6['model'],qs[_0xd1c1('0x39')](_0x56f14a[_0xd1c1('0x36')][_0xd1c1('0x39')]));_0xf4243c[_0xd1c1('0x38')]=_0xf4243c['attributes'][_0xd1c1('0x49')]?_0xf4243c[_0xd1c1('0x38')]:_0x191fe6['model'];if(_0x56f14a[_0xd1c1('0x36')][_0xd1c1('0x42')]){_0xf4243c[_0xd1c1('0x43')]=[{'all':!![]}];}_0xf4243c=_[_0xd1c1('0x4a')]({},_0xf4243c,_0x56f14a['options']);return db[_0xd1c1('0x30')][_0xd1c1('0x4b')](_0xf4243c)[_0xd1c1('0x26')](handleEntityNotFound(_0xcde35c,null))['then'](respondWithResult(_0xcde35c,null))[_0xd1c1('0x46')](handleError(_0xcde35c,null));};exports['create']=function(_0x1a708c,_0x3912ef){return db[_0xd1c1('0x30')][_0xd1c1('0x4c')](_0x1a708c['body'],{})[_0xd1c1('0x26')](function(_0x53e368){var _0x459e67=_0x1a708c[_0xd1c1('0x4d')][_0xd1c1('0x27')]({'plain':!![]});if(!_0x459e67)throw new Error(_0xd1c1('0x4e'));if(_0x459e67['role']===_0xd1c1('0x4d')){var _0x457dce=_0x53e368[_0xd1c1('0x27')]({'plain':!![]});var _0x7f7db2='Dispositions';return db[_0xd1c1('0x4f')][_0xd1c1('0x4b')]({'where':{'name':_0x7f7db2,'userProfileId':_0x459e67[_0xd1c1('0x50')]},'raw':!![]})['then'](function(_0x305ca2){if(_0x305ca2&&_0x305ca2['autoAssociation']===0x0){return db[_0xd1c1('0x29')][_0xd1c1('0x4c')]({'name':_0x457dce[_0xd1c1('0x2d')],'resourceId':_0x457dce['id'],'type':_0x305ca2[_0xd1c1('0x2d')],'sectionId':_0x305ca2['id']},{})[_0xd1c1('0x26')](function(){return _0x53e368;});}else{return _0x53e368;}})['catch'](function(_0x45ac1e){logger['error'](_0xd1c1('0x51'),_0x45ac1e);throw _0x45ac1e;});}return _0x53e368;})[_0xd1c1('0x26')](respondWithResult(_0x3912ef,0xc9))['catch'](handleError(_0x3912ef,null));};exports[_0xd1c1('0x25')]=function(_0x2646eb,_0x1b5fed){if(_0x2646eb[_0xd1c1('0x52')]['id']){delete _0x2646eb[_0xd1c1('0x52')]['id'];}return db['Disposition'][_0xd1c1('0x4b')]({'where':{'id':_0x2646eb['params']['id']}})['then'](handleEntityNotFound(_0x1b5fed,null))[_0xd1c1('0x26')](saveUpdates(_0x2646eb[_0xd1c1('0x52')],null))['then'](respondWithResult(_0x1b5fed,null))[_0xd1c1('0x46')](handleError(_0x1b5fed,null));};exports[_0xd1c1('0x2a')]=function(_0x225431,_0x1bcc69){return db[_0xd1c1('0x30')][_0xd1c1('0x4b')]({'where':{'id':_0x225431[_0xd1c1('0x53')]['id']}})[_0xd1c1('0x26')](handleEntityNotFound(_0x1bcc69,null))[_0xd1c1('0x26')](removeEntity(_0x1bcc69,null))[_0xd1c1('0x46')](handleError(_0x1bcc69,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 4cd17eb..edadc58 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 _0x0bba=['OpenchannelAccountId','WhatsappAccountId','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports','tools_dispositions','name_voice','ListId','name_chat','name','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel'];(function(_0x1c44df,_0x42713c){var _0x109e88=function(_0x19f318){while(--_0x19f318){_0x1c44df['push'](_0x1c44df['shift']());}};_0x109e88(++_0x42713c);}(_0x0bba,0x80));var _0xa0bb=function(_0x5be75a,_0x2b7f35){_0x5be75a=_0x5be75a-0x0;var _0x1e4403=_0x0bba[_0x5be75a];return _0x1e4403;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa0bb('0x0'))(_0xa0bb('0x1'));var moment=require('moment');var BPromise=require(_0xa0bb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0bb('0x3'));var rimraf=require(_0xa0bb('0x4'));var config=require(_0xa0bb('0x5'));var attributes=require('./disposition.attributes');module[_0xa0bb('0x6')]=function(_0x11f123,_0x2b8a02){return _0x11f123['define']('Disposition',attributes,{'tableName':_0xa0bb('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xa0bb('0x8'),'fields':['name',_0xa0bb('0x9')]},{'unique':!![],'name':_0xa0bb('0xa'),'fields':[_0xa0bb('0xb'),'ChatWebsiteId']},{'unique':!![],'name':_0xa0bb('0xc'),'fields':[_0xa0bb('0xb'),_0xa0bb('0xd')]},{'unique':!![],'name':_0xa0bb('0xe'),'fields':['name',_0xa0bb('0xf')]},{'unique':!![],'name':_0xa0bb('0x10'),'fields':[_0xa0bb('0xb'),_0xa0bb('0x11')]},{'unique':!![],'name':_0xa0bb('0x12'),'fields':[_0xa0bb('0xb'),_0xa0bb('0x13')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0xa0bb('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf524=['name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./disposition.attributes','define','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId'];(function(_0x17b1eb,_0x565224){var _0x1d86a1=function(_0x5a0389){while(--_0x5a0389){_0x17b1eb['push'](_0x17b1eb['shift']());}};_0x1d86a1(++_0x565224);}(_0xf524,0x160));var _0x4f52=function(_0x7efe31,_0x1b42d3){_0x7efe31=_0x7efe31-0x0;var _0x59ea5a=_0xf524[_0x7efe31];return _0x59ea5a;};'use strict';var _=require(_0x4f52('0x0'));var util=require(_0x4f52('0x1'));var logger=require(_0x4f52('0x2'))(_0x4f52('0x3'));var moment=require(_0x4f52('0x4'));var BPromise=require(_0x4f52('0x5'));var rp=require(_0x4f52('0x6'));var fs=require('fs');var path=require(_0x4f52('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4f52('0x8'));module['exports']=function(_0xa04f6d,_0x5e7cb6){return _0xa04f6d[_0x4f52('0x9')]('Disposition',attributes,{'tableName':_0x4f52('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x4f52('0xb'),'fields':[_0x4f52('0xc'),_0x4f52('0xd')]},{'unique':!![],'name':_0x4f52('0xe'),'fields':[_0x4f52('0xc'),_0x4f52('0xf')]},{'unique':!![],'name':_0x4f52('0x10'),'fields':[_0x4f52('0xc'),_0x4f52('0x11')]},{'unique':!![],'name':_0x4f52('0x12'),'fields':[_0x4f52('0xc'),_0x4f52('0x13')]},{'unique':!![],'name':_0x4f52('0x14'),'fields':[_0x4f52('0xc'),_0x4f52('0x15')]},{'unique':!![],'name':'name_openchannel','fields':[_0x4f52('0xc'),_0x4f52('0x16')]},{'unique':!![],'name':_0x4f52('0x17'),'fields':[_0x4f52('0xc'),_0x4f52('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 19e1285..eb5b2ef 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(_0x1624a4,_0x3acf25){var _0x3b063c=function(_0x212d5b){while(--_0x212d5b){_0x1624a4['push'](_0x1624a4['shift']());}};_0x3b063c(++_0x3acf25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x32f1fd,_0x48b353){var _0x15f173=function(_0xcc5545){while(--_0xcc5545){_0x32f1fd['push'](_0x32f1fd['shift']());}};_0x15f173(++_0x48b353);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 2d1b9ce..9824a61 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 _0xee03=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports'];(function(_0x503794,_0x291e1a){var _0x144eed=function(_0x5eaad0){while(--_0x5eaad0){_0x503794['push'](_0x503794['shift']());}};_0x144eed(++_0x291e1a);}(_0xee03,0x1a4));var _0x3ee0=function(_0xed5160,_0x22dfc6){_0xed5160=_0xed5160-0x0;var _0x37052a=_0xee03[_0xed5160];return _0x37052a;};'use strict';var multer=require('multer');var util=require(_0x3ee0('0x0'));var path=require(_0x3ee0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3ee0('0x2')]();var fs_extra=require(_0x3ee0('0x3'));var auth=require(_0x3ee0('0x4'));var interaction=require(_0x3ee0('0x5'));var config=require(_0x3ee0('0x6'));var controller=require(_0x3ee0('0x7'));router[_0x3ee0('0x8')]('/',auth['isAuthenticated'](),controller[_0x3ee0('0x9')]);router[_0x3ee0('0x8')](_0x3ee0('0xa'),auth['isAuthenticated'](),controller[_0x3ee0('0xb')]);router[_0x3ee0('0xc')]('/',auth[_0x3ee0('0xd')](),controller[_0x3ee0('0xe')]);router[_0x3ee0('0xf')](_0x3ee0('0xa'),auth[_0x3ee0('0xd')](),controller[_0x3ee0('0x10')]);router[_0x3ee0('0x11')](_0x3ee0('0xa'),auth[_0x3ee0('0xd')](),controller[_0x3ee0('0x12')]);module[_0x3ee0('0x13')]=router; \ No newline at end of file +var _0x6f82=['../../components/auth/service','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x145564,_0x14d60d){var _0x464d58=function(_0x5df8b1){while(--_0x5df8b1){_0x145564['push'](_0x145564['shift']());}};_0x464d58(++_0x14d60d);}(_0x6f82,0xfe));var _0x26f8=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x6f82[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0x26f8('0x0'));var util=require(_0x26f8('0x1'));var path=require(_0x26f8('0x2'));var timeout=require(_0x26f8('0x3'));var express=require(_0x26f8('0x4'));var router=express['Router']();var fs_extra=require(_0x26f8('0x5'));var auth=require(_0x26f8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x26f8('0x7'));var controller=require(_0x26f8('0x8'));router[_0x26f8('0x9')]('/',auth['isAuthenticated'](),controller[_0x26f8('0xa')]);router[_0x26f8('0x9')](_0x26f8('0xb'),auth[_0x26f8('0xc')](),controller[_0x26f8('0xd')]);router[_0x26f8('0xe')]('/',auth[_0x26f8('0xc')](),controller[_0x26f8('0xf')]);router[_0x26f8('0x10')](_0x26f8('0xb'),auth['isAuthenticated'](),controller[_0x26f8('0x11')]);router[_0x26f8('0x12')](_0x26f8('0xb'),auth[_0x26f8('0xc')](),controller[_0x26f8('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index f597cea..292254c 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 _0x0d2e=['xCALLY\x20Motion\x20Fax','localstationid','ENUM','4800','7200','9600','12000','14400','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','yes'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x0d2e,0x110));var _0xe0d2=function(_0x24403d,_0x94ebf1){_0x24403d=_0x24403d-0x0;var _0x3fabf3=_0x0d2e[_0x24403d];return _0x3fabf3;};'use strict';var Sequelize=require(_0xe0d2('0x0'));module[_0xe0d2('0x1')]={'name':{'type':Sequelize[_0xe0d2('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe0d2('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0xe0d2('0x3'),'no'),'defaultValue':_0xe0d2('0x3')},'headerinfo':{'type':Sequelize[_0xe0d2('0x2')],'defaultValue':_0xe0d2('0x4')},'localstationid':{'type':Sequelize[_0xe0d2('0x2')],'unique':_0xe0d2('0x5')},'minrate':{'type':Sequelize[_0xe0d2('0x6')]('2400',_0xe0d2('0x7'),_0xe0d2('0x8'),_0xe0d2('0x9'),_0xe0d2('0xa'),_0xe0d2('0xb')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xe0d2('0x6')]('2400',_0xe0d2('0x7'),_0xe0d2('0x8'),_0xe0d2('0x9'),_0xe0d2('0xa'),_0xe0d2('0xb')),'defaultValue':_0xe0d2('0xb')},'modem':{'type':Sequelize[_0xe0d2('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xe0d2('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xe0d2('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xe0d2('0xc'),_0xe0d2('0xd'),_0xe0d2('0xe'),_0xe0d2('0xf')),'defaultValue':_0xe0d2('0xc')},'key':{'type':Sequelize[_0xe0d2('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe0d2('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xe0d2('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe0d2('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xe0d2('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe0d2('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe0d2('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe0d2('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe0d2('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe0d2('0x12')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe0d2('0x13'),'set':function(_0x1c705d){if(!_0x1c705d)this[_0xe0d2('0x14')](_0xe0d2('0x15'),null);this[_0xe0d2('0x14')](_0xe0d2('0x16'),_0x1c705d);}}}; \ No newline at end of file +var _0x8546=['2400','4800','7200','9600','12000','14400','INTEGER','IAX','SIP','TEXT','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x8546,0xf7));var _0x6854=function(_0x5f360a,_0x29dffc){_0x5f360a=_0x5f360a-0x0;var _0xfa70b3=_0x8546[_0x5f360a];return _0xfa70b3;};'use strict';var Sequelize=require(_0x6854('0x0'));module[_0x6854('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6854('0x2')]},'ecm':{'type':Sequelize[_0x6854('0x3')](_0x6854('0x4'),'no'),'defaultValue':_0x6854('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x6854('0x3')](_0x6854('0x5'),_0x6854('0x6'),_0x6854('0x7'),_0x6854('0x8'),_0x6854('0x9'),_0x6854('0xa')),'defaultValue':_0x6854('0x6')},'maxrate':{'type':Sequelize[_0x6854('0x3')](_0x6854('0x5'),_0x6854('0x6'),'7200',_0x6854('0x8'),_0x6854('0x9'),_0x6854('0xa')),'defaultValue':_0x6854('0xa')},'modem':{'type':Sequelize[_0x6854('0x2')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x6854('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6854('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6854('0x3')]('SIP',_0x6854('0xc'),'DADHI','KHOMP'),'defaultValue':_0x6854('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6854('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[_0x6854('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6854('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6854('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6854('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6854('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6854('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6854('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x6854('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x6854('0xf')],'defaultValue':![],'comment':_0x6854('0x11'),'set':function(_0x5f5ddf){if(!_0x5f5ddf)this[_0x6854('0x12')](_0x6854('0x13'),null);this['setDataValue'](_0x6854('0x14'),_0x5f5ddf);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index fbd87fd..b0c6e41 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 _0xeb7a=['dataValues','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxAccount.socket','register','jayson/promise','client','http','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','status','undefined','limit','offset','count','set','Content-Range','json','apply','update','destroy','then','get','FaxAccounts','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','fieldName','key','model','query','keys','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','catch','params','filters','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','describe','addDisposition','FaxAccountId','Disposition','length','map','includeAll','removeDispositions','ids','CannedAnswer','getAnswers','findOne','rawAttributes','hasOwnProperty','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','FaxApplication','findAndCountAll','priority','getApplications','context','exten','app','description','appdata','push','Answer','ecm','gateway','headerinfo','maxrate','modem','t38timeout','Set','Wait','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','tech','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','List','Contacts','updatedAt','DESC','attachments','root','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','ContactId'];(function(_0x2440fe,_0x281a11){var _0x5cf734=function(_0x38e12b){while(--_0x38e12b){_0x2440fe['push'](_0x2440fe['shift']());}};_0x5cf734(++_0x281a11);}(_0xeb7a,0xc9));var _0xaeb7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb7a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xaeb7('0x0'));var rimraf=require(_0xaeb7('0x1'));var zipdir=require(_0xaeb7('0x2'));var jsonpatch=require(_0xaeb7('0x3'));var rp=require(_0xaeb7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaeb7('0x5'));var util=require(_0xaeb7('0x6'));var path=require('path');var sox=require(_0xaeb7('0x7'));var csv=require(_0xaeb7('0x8'));var ejs=require(_0xaeb7('0x9'));var fs=require('fs');var fs_extra=require(_0xaeb7('0xa'));var _=require(_0xaeb7('0xb'));var squel=require(_0xaeb7('0xc'));var crypto=require(_0xaeb7('0xd'));var jsforce=require(_0xaeb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaeb7('0xf'));var Papa=require('papaparse');var Redis=require(_0xaeb7('0x10'));var authService=require(_0xaeb7('0x11'));var qs=require(_0xaeb7('0x12'));var as=require(_0xaeb7('0x13'));var hardwareService=require(_0xaeb7('0x14'));var logger=require(_0xaeb7('0x15'))(_0xaeb7('0x16'));var utils=require(_0xaeb7('0x17'));var config=require(_0xaeb7('0x18'));var licenseUtil=require(_0xaeb7('0x19'));var db=require(_0xaeb7('0x1a'))['db'];config['redis']=_[_0xaeb7('0x1b')](config['redis'],{'host':_0xaeb7('0x1c'),'port':0x18eb});var socket=require(_0xaeb7('0x1d'))(new Redis(config[_0xaeb7('0x1e')]));require(_0xaeb7('0x1f'))[_0xaeb7('0x20')](socket);var jayson=require(_0xaeb7('0x21'));var client=jayson[_0xaeb7('0x22')][_0xaeb7('0x23')]({'port':0x232c});var client9002=jayson[_0xaeb7('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x257d63,_0x34232d,_0x405b68,_0x463578){return new BPromise(function(_0x34af53,_0xdb0e9b){var _0x2056a3=_0x463578||client;return _0x2056a3['request'](_0x257d63,_0x405b68)['then'](function(_0x321abf){logger['info'](_0xaeb7('0x24'),_0x34232d,_0xaeb7('0x25'));logger[_0xaeb7('0x26')](_0xaeb7('0x27'),_0x34232d,_0xaeb7('0x25'),JSON['stringify'](_0x321abf));if(_0x321abf[_0xaeb7('0x28')]){if(_0x321abf[_0xaeb7('0x28')][_0xaeb7('0x29')]===0x1f4){logger[_0xaeb7('0x28')](_0xaeb7('0x24'),_0x34232d,_0x321abf[_0xaeb7('0x28')][_0xaeb7('0x2a')]);return _0xdb0e9b(_0x321abf['error'][_0xaeb7('0x2a')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x34232d,_0x321abf[_0xaeb7('0x28')][_0xaeb7('0x2a')]);return _0x34af53(_0x321abf[_0xaeb7('0x28')]['message']);}else{logger[_0xaeb7('0x2b')](_0xaeb7('0x24'),_0x34232d,_0xaeb7('0x25'));_0x34af53(_0x321abf['result'][_0xaeb7('0x2a')]);}})['catch'](function(_0x56aeb2){logger['error'](_0xaeb7('0x24'),_0x34232d,_0x56aeb2);_0xdb0e9b(_0x56aeb2);});});}function respondWithStatusCode(_0x252b3b,_0x34f8dc){_0x34f8dc=_0x34f8dc||0xcc;return function(_0x3d85bb){if(_0x3d85bb){return _0x252b3b['sendStatus'](_0x34f8dc);}return _0x252b3b[_0xaeb7('0x2c')](_0x34f8dc)['end']();};}function respondWithResult(_0x6392b6,_0x442658){_0x442658=_0x442658||0xc8;return function(_0x398e9e){if(_0x398e9e){return _0x6392b6[_0xaeb7('0x2c')](_0x442658)['json'](_0x398e9e);}};}function respondWithFilteredResult(_0x3dad8b,_0x3710d6){return function(_0x126160){if(_0x126160){var _0x108f90=typeof _0x3710d6['offset']===_0xaeb7('0x2d')&&typeof _0x3710d6[_0xaeb7('0x2e')]===_0xaeb7('0x2d');var _0x4190d2=_0x126160['count'];var _0x5e30a5=_0x108f90?0x0:_0x3710d6[_0xaeb7('0x2f')];var _0x3e955e=_0x108f90?_0x126160[_0xaeb7('0x30')]:_0x3710d6[_0xaeb7('0x2f')]+_0x3710d6['limit'];var _0x34ad87;if(_0x3e955e>=_0x4190d2){_0x3e955e=_0x4190d2;_0x34ad87=0xc8;}else{_0x34ad87=0xce;}_0x3dad8b[_0xaeb7('0x2c')](_0x34ad87);return _0x3dad8b[_0xaeb7('0x31')](_0xaeb7('0x32'),_0x5e30a5+'-'+_0x3e955e+'/'+_0x4190d2)[_0xaeb7('0x33')](_0x126160);}return null;};}function patchUpdates(_0x1fccb8){return function(_0x208a4b){try{jsonpatch[_0xaeb7('0x34')](_0x208a4b,_0x1fccb8,!![]);}catch(_0x25390f){return BPromise['reject'](_0x25390f);}return _0x208a4b['save']();};}function saveUpdates(_0x2e0d6d,_0x4b3b6a){return function(_0x362c58){if(_0x362c58){return _0x362c58[_0xaeb7('0x35')](_0x2e0d6d)['then'](function(_0x3def7e){return _0x3def7e;});}return null;};}function removeEntity(_0x42e5e7,_0x50d16b){return function(_0x11744a){if(_0x11744a){return _0x11744a[_0xaeb7('0x36')]()[_0xaeb7('0x37')](function(){var _0x369e83=_0x11744a[_0xaeb7('0x38')]({'plain':!![]});var _0x3064f0=_0xaeb7('0x39');return db['UserProfileResource']['destroy']({'where':{'type':_0x3064f0,'resourceId':_0x369e83['id']}})[_0xaeb7('0x37')](function(){return _0x11744a;});})[_0xaeb7('0x37')](function(){_0x42e5e7['status'](0xcc)[_0xaeb7('0x3a')]();});}};}function handleEntityNotFound(_0x920518,_0x14dbc3){return function(_0x312da2){if(!_0x312da2){_0x920518[_0xaeb7('0x3b')](0x194);}return _0x312da2;};}function handleError(_0x3105d5,_0x145e79){_0x145e79=_0x145e79||0x1f4;return function(_0x2ad1d8){logger[_0xaeb7('0x28')](_0x2ad1d8[_0xaeb7('0x3c')]);if(_0x2ad1d8[_0xaeb7('0x3d')]){delete _0x2ad1d8[_0xaeb7('0x3d')];}_0x3105d5['status'](_0x145e79)[_0xaeb7('0x3e')](_0x2ad1d8);};}exports[_0xaeb7('0x3f')]=function(_0x280071,_0x5b248e){var _0x503fd8={'include':[{'model':db[_0xaeb7('0x40')],'as':_0xaeb7('0x41')}]},_0x5eef51={},_0x304dfc={'count':0x0,'rows':[]};var _0x251524=_['map'](db[_0xaeb7('0x42')]['rawAttributes'],function(_0x167fcc){return{'name':_0x167fcc[_0xaeb7('0x43')],'type':_0x167fcc['type'][_0xaeb7('0x44')]};});_0x5eef51[_0xaeb7('0x45')]=_['map'](_0x251524,_0xaeb7('0x3d'));_0x5eef51[_0xaeb7('0x46')]=_[_0xaeb7('0x47')](_0x280071[_0xaeb7('0x46')]);_0x5eef51['filters']=_['intersection'](_0x5eef51[_0xaeb7('0x45')],_0x5eef51[_0xaeb7('0x46')]);_0x503fd8[_0xaeb7('0x48')]=_[_0xaeb7('0x49')](_0x5eef51[_0xaeb7('0x45')],qs[_0xaeb7('0x4a')](_0x280071[_0xaeb7('0x46')][_0xaeb7('0x4a')]));_0x503fd8['attributes']=_0x503fd8[_0xaeb7('0x48')]['length']?_0x503fd8['attributes']:_0x5eef51['model'];if(!_0x280071['query']['hasOwnProperty'](_0xaeb7('0x4b'))){_0x503fd8[_0xaeb7('0x2e')]=qs['limit'](_0x280071[_0xaeb7('0x46')][_0xaeb7('0x2e')]);_0x503fd8['offset']=qs['offset'](_0x280071[_0xaeb7('0x46')][_0xaeb7('0x2f')]);}_0x503fd8[_0xaeb7('0x4c')]=qs[_0xaeb7('0x4d')](_0x280071[_0xaeb7('0x46')][_0xaeb7('0x4d')]);_0x503fd8[_0xaeb7('0x4e')]=qs['filters'](_[_0xaeb7('0x4f')](_0x280071[_0xaeb7('0x46')],_0x5eef51['filters']),_0x251524);if(_0x280071['query'][_0xaeb7('0x50')]){_0x503fd8['where']=_[_0xaeb7('0x51')](_0x503fd8[_0xaeb7('0x4e')],{'$or':_['map'](_0x251524,function(_0x1a5e51){if(_0x1a5e51[_0xaeb7('0x52')]!==_0xaeb7('0x53')){var _0x54a5e6={};_0x54a5e6[_0x1a5e51[_0xaeb7('0x3d')]]={'$like':'%'+_0x280071[_0xaeb7('0x46')]['filter']+'%'};return _0x54a5e6;}})});}_0x503fd8=_[_0xaeb7('0x51')]({},_0x503fd8,_0x280071['options']);var _0x402730={'where':_0x503fd8[_0xaeb7('0x4e')]};return db[_0xaeb7('0x42')][_0xaeb7('0x30')](_0x402730)[_0xaeb7('0x37')](function(_0x251e25){_0x304dfc[_0xaeb7('0x30')]=_0x251e25;if(_0x280071['query']['includeAll']){_0x503fd8['include']=[{'all':!![]}];}return db[_0xaeb7('0x42')][_0xaeb7('0x54')](_0x503fd8);})['then'](function(_0x51181a){_0x304dfc[_0xaeb7('0x55')]=_0x51181a;return _0x304dfc;})[_0xaeb7('0x37')](respondWithFilteredResult(_0x5b248e,_0x503fd8))[_0xaeb7('0x56')](handleError(_0x5b248e,null));};exports['show']=function(_0x4f8e5e,_0x109a1f){var _0x3562c8={'raw':![],'where':{'id':_0x4f8e5e[_0xaeb7('0x57')]['id']},'include':[{'model':db[_0xaeb7('0x40')],'as':_0xaeb7('0x41')}]},_0x1537c6={};_0x1537c6[_0xaeb7('0x45')]=_[_0xaeb7('0x47')](db[_0xaeb7('0x42')]['rawAttributes']);_0x1537c6[_0xaeb7('0x46')]=_['keys'](_0x4f8e5e[_0xaeb7('0x46')]);_0x1537c6[_0xaeb7('0x58')]=_['intersection'](_0x1537c6[_0xaeb7('0x45')],_0x1537c6[_0xaeb7('0x46')]);_0x3562c8['attributes']=_[_0xaeb7('0x49')](_0x1537c6[_0xaeb7('0x45')],qs[_0xaeb7('0x4a')](_0x4f8e5e[_0xaeb7('0x46')][_0xaeb7('0x4a')]));_0x3562c8[_0xaeb7('0x48')]=_0x3562c8[_0xaeb7('0x48')]['length']?_0x3562c8[_0xaeb7('0x48')]:_0x1537c6[_0xaeb7('0x45')];if(_0x4f8e5e['query']['includeAll']){_0x3562c8[_0xaeb7('0x59')]=[{'all':!![]}];}_0x3562c8=_[_0xaeb7('0x51')]({},_0x3562c8,_0x4f8e5e[_0xaeb7('0x5a')]);return db['FaxAccount'][_0xaeb7('0x5b')](_0x3562c8)[_0xaeb7('0x37')](handleEntityNotFound(_0x109a1f,null))[_0xaeb7('0x37')](respondWithResult(_0x109a1f,null))[_0xaeb7('0x56')](handleError(_0x109a1f,null));};exports[_0xaeb7('0x5c')]=function(_0xf1de50,_0x1eb92d){return db['FaxAccount']['create'](_0xf1de50[_0xaeb7('0x5d')],{})[_0xaeb7('0x37')](function(_0x156fe0){var _0x201a1d=_0xf1de50[_0xaeb7('0x5e')][_0xaeb7('0x38')]({'plain':!![]});if(!_0x201a1d)throw new Error(_0xaeb7('0x5f'));if(_0x201a1d[_0xaeb7('0x60')]===_0xaeb7('0x5e')){var _0x31f0c9=_0x156fe0[_0xaeb7('0x38')]({'plain':!![]});var _0x2dde1=_0xaeb7('0x39');return db['UserProfileSection'][_0xaeb7('0x5b')]({'where':{'name':_0x2dde1,'userProfileId':_0x201a1d[_0xaeb7('0x61')]},'raw':!![]})[_0xaeb7('0x37')](function(_0x55a7bc){if(_0x55a7bc&&_0x55a7bc['autoAssociation']===0x0){return db[_0xaeb7('0x62')]['create']({'name':_0x31f0c9['name'],'resourceId':_0x31f0c9['id'],'type':_0x55a7bc[_0xaeb7('0x3d')],'sectionId':_0x55a7bc['id']},{})[_0xaeb7('0x37')](function(){return _0x156fe0;});}else{return _0x156fe0;}})[_0xaeb7('0x56')](function(_0x49e7e6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49e7e6);throw _0x49e7e6;});}return _0x156fe0;})[_0xaeb7('0x37')](respondWithResult(_0x1eb92d,0xc9))['catch'](handleError(_0x1eb92d,null));};exports['update']=function(_0x53c5d2,_0x3358c6){if(_0x53c5d2['body']['id']){delete _0x53c5d2['body']['id'];}return db[_0xaeb7('0x42')][_0xaeb7('0x5b')]({'where':{'id':_0x53c5d2['params']['id']},'include':[{'model':db[_0xaeb7('0x40')],'as':_0xaeb7('0x41')}]})['then'](handleEntityNotFound(_0x3358c6,null))[_0xaeb7('0x37')](saveUpdates(_0x53c5d2[_0xaeb7('0x5d')],null))[_0xaeb7('0x37')](respondWithResult(_0x3358c6,null))[_0xaeb7('0x56')](handleError(_0x3358c6,null));};exports[_0xaeb7('0x36')]=function(_0x2e0812,_0x1aacd0){return db[_0xaeb7('0x42')][_0xaeb7('0x5b')]({'where':{'id':_0x2e0812[_0xaeb7('0x57')]['id']}})[_0xaeb7('0x37')](handleEntityNotFound(_0x1aacd0,null))['then'](removeEntity(_0x1aacd0,null))[_0xaeb7('0x56')](handleError(_0x1aacd0,null));};exports[_0xaeb7('0x63')]=function(_0x5252cf,_0xe5722a){return db['FaxAccount'][_0xaeb7('0x63')]()[_0xaeb7('0x37')](respondWithResult(_0xe5722a,null))['catch'](handleError(_0xe5722a,null));};exports[_0xaeb7('0x64')]=function(_0x4a6519,_0x45342b,_0x2451e0){if(_0x4a6519[_0xaeb7('0x5d')]['id']){delete _0x4a6519['body']['id'];}return db[_0xaeb7('0x42')][_0xaeb7('0x5b')]({'where':{'id':_0x4a6519[_0xaeb7('0x57')]['id']}})[_0xaeb7('0x37')](handleEntityNotFound(_0x45342b,null))[_0xaeb7('0x37')](function(_0x252dc6){if(_0x252dc6){_0x4a6519['body'][_0xaeb7('0x65')]=_0x252dc6['id'];return db[_0xaeb7('0x66')]['create'](_0x4a6519[_0xaeb7('0x5d')]);}})[_0xaeb7('0x37')](respondWithResult(_0x45342b,null))['catch'](handleError(_0x45342b,null));};exports['getDispositions']=function(_0x528a07,_0x18bbe4,_0x4aa286){var _0x51294f={'raw':![],'where':{}};var _0x28d36b={};var _0x4bac44={'count':0x0,'rows':[]};return db[_0xaeb7('0x42')]['findOne']({'where':{'id':_0x528a07['params']['id']}})[_0xaeb7('0x37')](handleEntityNotFound(_0x18bbe4,null))[_0xaeb7('0x37')](function(_0xffb022){if(_0xffb022){_0x28d36b[_0xaeb7('0x45')]=_['keys'](db[_0xaeb7('0x66')]['rawAttributes']);_0x28d36b[_0xaeb7('0x46')]=_[_0xaeb7('0x47')](_0x528a07[_0xaeb7('0x46')]);_0x28d36b[_0xaeb7('0x58')]=_['intersection'](_0x28d36b['model'],_0x28d36b[_0xaeb7('0x46')]);_0x51294f['attributes']=_[_0xaeb7('0x49')](_0x28d36b[_0xaeb7('0x45')],qs[_0xaeb7('0x4a')](_0x528a07[_0xaeb7('0x46')]['fields']));_0x51294f[_0xaeb7('0x48')]=_0x51294f['attributes'][_0xaeb7('0x67')]?_0x51294f['attributes']:_0x28d36b['model'];if(!_0x528a07[_0xaeb7('0x46')]['hasOwnProperty'](_0xaeb7('0x4b'))){_0x51294f[_0xaeb7('0x2e')]=qs[_0xaeb7('0x2e')](_0x528a07[_0xaeb7('0x46')][_0xaeb7('0x2e')]);_0x51294f[_0xaeb7('0x2f')]=qs['offset'](_0x528a07['query'][_0xaeb7('0x2f')]);}_0x51294f['order']=qs[_0xaeb7('0x4d')](_0x528a07['query'][_0xaeb7('0x4d')]);_0x51294f['where']=qs[_0xaeb7('0x58')](_[_0xaeb7('0x4f')](_0x528a07['query'],_0x28d36b[_0xaeb7('0x58')]));_0x51294f[_0xaeb7('0x4e')][_0xaeb7('0x65')]=_0xffb022['id'];if(_0x528a07[_0xaeb7('0x46')][_0xaeb7('0x50')]){_0x51294f[_0xaeb7('0x4e')]=_[_0xaeb7('0x51')](_0x51294f[_0xaeb7('0x4e')],{'$or':_[_0xaeb7('0x68')](_0x51294f[_0xaeb7('0x48')],function(_0x3aaab7){var _0x5616d7={};_0x5616d7[_0x3aaab7]={'$like':'%'+_0x528a07[_0xaeb7('0x46')]['filter']+'%'};return _0x5616d7;})});}_0x51294f=_[_0xaeb7('0x51')]({},_0x51294f,_0x528a07[_0xaeb7('0x5a')]);return db['Disposition'][_0xaeb7('0x30')]({'where':_0x51294f[_0xaeb7('0x4e')]})[_0xaeb7('0x37')](function(_0x3e197c){_0x4bac44['count']=_0x3e197c;if(_0x528a07[_0xaeb7('0x46')][_0xaeb7('0x69')]){_0x51294f['include']=[{'all':!![]}];}return db[_0xaeb7('0x66')][_0xaeb7('0x54')](_0x51294f);})[_0xaeb7('0x37')](function(_0x43c482){_0x4bac44[_0xaeb7('0x55')]=_0x43c482;return _0x4bac44;});}})[_0xaeb7('0x37')](respondWithFilteredResult(_0x18bbe4,_0x51294f))[_0xaeb7('0x56')](handleError(_0x18bbe4,null));};exports[_0xaeb7('0x6a')]=function(_0x1a2194,_0x18b091,_0x49151c){return db['FaxAccount'][_0xaeb7('0x5b')]({'where':{'id':_0x1a2194[_0xaeb7('0x57')]['id']}})['then'](handleEntityNotFound(_0x18b091,null))[_0xaeb7('0x37')](function(_0xc39fd3){if(_0xc39fd3){return _0xc39fd3[_0xaeb7('0x6a')](_0x1a2194['query'][_0xaeb7('0x6b')]);}})[_0xaeb7('0x37')](respondWithStatusCode(_0x18b091,null))[_0xaeb7('0x56')](handleError(_0x18b091,null));};exports['addAnswer']=function(_0x18f6ee,_0x332dc6,_0x447c0b){if(_0x18f6ee['body']['id']){delete _0x18f6ee[_0xaeb7('0x5d')]['id'];}return db[_0xaeb7('0x42')][_0xaeb7('0x5b')]({'where':{'id':_0x18f6ee['params']['id']}})[_0xaeb7('0x37')](handleEntityNotFound(_0x332dc6,null))[_0xaeb7('0x37')](function(_0x4fbc6e){if(_0x4fbc6e){_0x18f6ee[_0xaeb7('0x5d')][_0xaeb7('0x65')]=_0x4fbc6e['id'];return db[_0xaeb7('0x6c')][_0xaeb7('0x5c')](_0x18f6ee['body']);}})['then'](respondWithResult(_0x332dc6,null))[_0xaeb7('0x56')](handleError(_0x332dc6,null));};exports[_0xaeb7('0x6d')]=function(_0x25766d,_0x448678,_0x34fec9){var _0x380b17={'raw':![],'where':{}};var _0xa0cf3d={};var _0x37c743={'count':0x0,'rows':[]};return db[_0xaeb7('0x42')][_0xaeb7('0x6e')]({'where':{'id':_0x25766d[_0xaeb7('0x57')]['id']}})[_0xaeb7('0x37')](handleEntityNotFound(_0x448678,null))['then'](function(_0x9dc262){if(_0x9dc262){_0xa0cf3d['model']=_[_0xaeb7('0x47')](db[_0xaeb7('0x6c')][_0xaeb7('0x6f')]);_0xa0cf3d[_0xaeb7('0x46')]=_['keys'](_0x25766d[_0xaeb7('0x46')]);_0xa0cf3d['filters']=_['intersection'](_0xa0cf3d['model'],_0xa0cf3d[_0xaeb7('0x46')]);_0x380b17['attributes']=_[_0xaeb7('0x49')](_0xa0cf3d[_0xaeb7('0x45')],qs['fields'](_0x25766d[_0xaeb7('0x46')]['fields']));_0x380b17[_0xaeb7('0x48')]=_0x380b17[_0xaeb7('0x48')][_0xaeb7('0x67')]?_0x380b17[_0xaeb7('0x48')]:_0xa0cf3d[_0xaeb7('0x45')];if(!_0x25766d[_0xaeb7('0x46')][_0xaeb7('0x70')](_0xaeb7('0x4b'))){_0x380b17[_0xaeb7('0x2e')]=qs[_0xaeb7('0x2e')](_0x25766d['query'][_0xaeb7('0x2e')]);_0x380b17[_0xaeb7('0x2f')]=qs[_0xaeb7('0x2f')](_0x25766d['query'][_0xaeb7('0x2f')]);}_0x380b17[_0xaeb7('0x4c')]=qs['sort'](_0x25766d['query'][_0xaeb7('0x4d')]);_0x380b17['where']=qs['filters'](_[_0xaeb7('0x4f')](_0x25766d[_0xaeb7('0x46')],_0xa0cf3d[_0xaeb7('0x58')]));_0x380b17[_0xaeb7('0x4e')][_0xaeb7('0x65')]=_0x9dc262['id'];if(_0x25766d[_0xaeb7('0x46')][_0xaeb7('0x50')]){_0x380b17[_0xaeb7('0x4e')]=_[_0xaeb7('0x51')](_0x380b17[_0xaeb7('0x4e')],{'$or':_[_0xaeb7('0x68')](_0x380b17[_0xaeb7('0x48')],function(_0x2d3112){var _0x24be40={};_0x24be40[_0x2d3112]={'$like':'%'+_0x25766d[_0xaeb7('0x46')][_0xaeb7('0x50')]+'%'};return _0x24be40;})});}_0x380b17=_[_0xaeb7('0x51')]({},_0x380b17,_0x25766d[_0xaeb7('0x5a')]);return db[_0xaeb7('0x6c')][_0xaeb7('0x30')]({'where':_0x380b17[_0xaeb7('0x4e')]})[_0xaeb7('0x37')](function(_0x102155){_0x37c743['count']=_0x102155;if(_0x25766d['query'][_0xaeb7('0x69')]){_0x380b17['include']=[{'all':!![]}];}return db[_0xaeb7('0x6c')][_0xaeb7('0x54')](_0x380b17);})[_0xaeb7('0x37')](function(_0x89b831){_0x37c743['rows']=_0x89b831;return _0x37c743;});}})['then'](respondWithFilteredResult(_0x448678,_0x380b17))[_0xaeb7('0x56')](handleError(_0x448678,null));};exports[_0xaeb7('0x71')]=function(_0x379a33,_0x57bf12,_0x444c6c){return db['FaxAccount'][_0xaeb7('0x5b')]({'where':{'id':_0x379a33[_0xaeb7('0x57')]['id']}})[_0xaeb7('0x37')](handleEntityNotFound(_0x57bf12,null))[_0xaeb7('0x37')](function(_0x4c83a1){if(_0x4c83a1){return _0x4c83a1[_0xaeb7('0x71')](_0x379a33[_0xaeb7('0x46')][_0xaeb7('0x6b')]);}})[_0xaeb7('0x37')](respondWithStatusCode(_0x57bf12,null))['catch'](handleError(_0x57bf12,null));};exports[_0xaeb7('0x72')]=function(_0x57c0c5,_0x1a1953,_0x10bb16){return db[_0xaeb7('0x73')][_0xaeb7('0x5b')]({'where':{'id':_0x57c0c5['params']['id']}})[_0xaeb7('0x37')](handleEntityNotFound(_0x1a1953,null))[_0xaeb7('0x37')](function(_0x53881c){if(_0x53881c){return _0x53881c[_0xaeb7('0x72')](_0x57c0c5['body'][_0xaeb7('0x6b')],_[_0xaeb7('0x74')](_0x57c0c5[_0xaeb7('0x5d')],[_0xaeb7('0x6b'),'id'])||{});}})[_0xaeb7('0x37')](respondWithResult(_0x1a1953,null))['catch'](handleError(_0x1a1953,null));};exports['getInteractions']=function(_0x1c7bc5,_0x290d2a,_0x5af975){var _0x299ee3={'raw':![],'where':{}};var _0x306af8={};var _0x389a6d={'count':0x0,'rows':[]};return db[_0xaeb7('0x42')]['findOne']({'where':{'id':_0x1c7bc5[_0xaeb7('0x57')]['id']}})['then'](handleEntityNotFound(_0x290d2a,null))[_0xaeb7('0x37')](function(_0x5ea243){if(_0x5ea243){_0x306af8[_0xaeb7('0x45')]=_['keys'](db[_0xaeb7('0x73')][_0xaeb7('0x6f')]);_0x306af8[_0xaeb7('0x46')]=_['keys'](_0x1c7bc5[_0xaeb7('0x46')]);_0x306af8[_0xaeb7('0x58')]=_[_0xaeb7('0x49')](_0x306af8['model'],_0x306af8['query']);_0x299ee3[_0xaeb7('0x48')]=_[_0xaeb7('0x49')](_0x306af8[_0xaeb7('0x45')],qs[_0xaeb7('0x4a')](_0x1c7bc5['query'][_0xaeb7('0x4a')]));_0x299ee3[_0xaeb7('0x48')]=_0x299ee3[_0xaeb7('0x48')][_0xaeb7('0x67')]?_0x299ee3[_0xaeb7('0x48')]:_0x306af8['model'];if(!_0x1c7bc5['query']['hasOwnProperty'](_0xaeb7('0x4b'))){_0x299ee3[_0xaeb7('0x2e')]=qs['limit'](_0x1c7bc5[_0xaeb7('0x46')]['limit']);_0x299ee3[_0xaeb7('0x2f')]=qs[_0xaeb7('0x2f')](_0x1c7bc5[_0xaeb7('0x46')][_0xaeb7('0x2f')]);}_0x299ee3[_0xaeb7('0x4c')]=qs[_0xaeb7('0x4d')](_0x1c7bc5[_0xaeb7('0x46')][_0xaeb7('0x4d')]);_0x299ee3[_0xaeb7('0x4e')]=qs['filters'](_[_0xaeb7('0x4f')](_0x1c7bc5[_0xaeb7('0x46')],_0x306af8[_0xaeb7('0x58')]));_0x299ee3['where'][_0xaeb7('0x65')]=_0x5ea243['id'];if(_0x1c7bc5[_0xaeb7('0x46')][_0xaeb7('0x50')]){_0x299ee3[_0xaeb7('0x4e')]=_[_0xaeb7('0x51')](_0x299ee3['where'],{'$or':_['map'](_0x299ee3[_0xaeb7('0x48')],function(_0x2ecc37){var _0x2edb25={};_0x2edb25[_0x2ecc37]={'$like':'%'+_0x1c7bc5[_0xaeb7('0x46')][_0xaeb7('0x50')]+'%'};return _0x2edb25;})});}_0x299ee3=_['merge']({},_0x299ee3,_0x1c7bc5[_0xaeb7('0x5a')]);return db[_0xaeb7('0x73')]['count']({'where':_0x299ee3[_0xaeb7('0x4e')]})[_0xaeb7('0x37')](function(_0x5669be){_0x389a6d[_0xaeb7('0x30')]=_0x5669be;if(_0x1c7bc5[_0xaeb7('0x46')][_0xaeb7('0x69')]){_0x299ee3[_0xaeb7('0x59')]=[{'model':db[_0xaeb7('0x75')],'as':_0xaeb7('0x76'),'required':![]},{'model':db[_0xaeb7('0x77')],'as':_0xaeb7('0x78'),'attributes':['name',_0xaeb7('0x79'),_0xaeb7('0x7a')],'required':![]},{'model':db[_0xaeb7('0x7b')],'as':_0xaeb7('0x7c'),'attributes':['id','name',_0xaeb7('0x7d')],'where':_0x1c7bc5[_0xaeb7('0x46')][_0xaeb7('0x7e')]?{'id':_0x1c7bc5[_0xaeb7('0x46')]['tag']}:undefined,'required':_0x1c7bc5['query'][_0xaeb7('0x7e')]?!![]:![]}];}return db[_0xaeb7('0x73')][_0xaeb7('0x54')](_0x299ee3);})['then'](function(_0x12f857){_0x389a6d[_0xaeb7('0x55')]=_0x12f857;return _0x389a6d;});}})[_0xaeb7('0x37')](respondWithFilteredResult(_0x290d2a,_0x299ee3))['catch'](handleError(_0x290d2a,null));};exports['addApplications']=function(_0x47ab9b,_0x1985bf,_0x1a24c7){return db[_0xaeb7('0x42')][_0xaeb7('0x6e')]({'where':{'id':_0x47ab9b[_0xaeb7('0x57')]['id']}})['then'](handleEntityNotFound(_0x1985bf,null))['then'](function(_0x31c8d9){if(_0x31c8d9){return db[_0xaeb7('0x7f')][_0xaeb7('0x80')](function(_0x597959){return db[_0xaeb7('0x81')][_0xaeb7('0x36')]({'where':{'FaxAccountId':_0x47ab9b[_0xaeb7('0x57')]['id']},'transaction':_0x597959})['then'](function(_0x1e521f){var _0xa3b04d=_['map'](_0x47ab9b['body'],function(_0x487cb3){_0x487cb3[_0xaeb7('0x65')]=_0x47ab9b[_0xaeb7('0x57')]['id'];return _0x487cb3;});return db['FaxApplication']['bulkCreate'](_0xa3b04d,{'transaction':_0x597959});});})['then'](function(){return db['FaxApplication'][_0xaeb7('0x82')]({'where':{'FaxAccountId':_0x47ab9b[_0xaeb7('0x57')]['id']},'order':_0xaeb7('0x83')});});}})[_0xaeb7('0x37')](respondWithResult(_0x1985bf,null))[_0xaeb7('0x56')](handleError(_0x1985bf,null));};exports[_0xaeb7('0x84')]=function(_0x421974,_0x113fb1,_0x5f2aa9){var _0x14f82c={};var _0x89ff34={};var _0x3879d3;var _0x517638;return db['FaxAccount'][_0xaeb7('0x6e')]({'where':{'id':_0x421974[_0xaeb7('0x57')]['id']}})[_0xaeb7('0x37')](handleEntityNotFound(_0x113fb1,null))[_0xaeb7('0x37')](function(_0x25d664){if(_0x25d664){_0x3879d3=_0x25d664;_0x89ff34[_0xaeb7('0x45')]=_[_0xaeb7('0x47')](db[_0xaeb7('0x81')][_0xaeb7('0x6f')]);_0x89ff34[_0xaeb7('0x46')]=_['keys'](_0x421974[_0xaeb7('0x46')]);_0x89ff34['filters']=_[_0xaeb7('0x49')](_0x89ff34[_0xaeb7('0x45')],_0x89ff34[_0xaeb7('0x46')]);_0x14f82c['attributes']=_['intersection'](_0x89ff34[_0xaeb7('0x45')],qs[_0xaeb7('0x4a')](_0x421974['query'][_0xaeb7('0x4a')]));_0x14f82c[_0xaeb7('0x48')]=_0x14f82c[_0xaeb7('0x48')]['length']?_0x14f82c['attributes']:_0x89ff34['model'];_0x14f82c[_0xaeb7('0x4c')]=qs[_0xaeb7('0x4d')](_0x421974[_0xaeb7('0x46')][_0xaeb7('0x4d')]);_0x14f82c['where']=qs[_0xaeb7('0x58')](_[_0xaeb7('0x4f')](_0x421974[_0xaeb7('0x46')],_0x89ff34[_0xaeb7('0x58')]));if(_0x421974[_0xaeb7('0x46')][_0xaeb7('0x50')]){_0x14f82c[_0xaeb7('0x4e')]=_[_0xaeb7('0x51')](_0x14f82c['where'],{'$or':_['map'](_0x14f82c[_0xaeb7('0x48')],function(_0xf38c2c){var _0x83c0f7={};_0x83c0f7[_0xf38c2c]={'$like':'%'+_0x421974['query'][_0xaeb7('0x50')]+'%'};return _0x83c0f7;})});}_0x14f82c=_['merge']({},_0x14f82c,_0x421974[_0xaeb7('0x5a')]);return _0x3879d3[_0xaeb7('0x84')](_0x14f82c);}})[_0xaeb7('0x37')](function(_0x5508a5){if(_0x5508a5){_0x517638=_0x5508a5['length'];if(!_0x421974[_0xaeb7('0x46')][_0xaeb7('0x70')]('nolimit')){_0x14f82c[_0xaeb7('0x2e')]=qs['limit'](_0x421974[_0xaeb7('0x46')][_0xaeb7('0x2e')]);_0x14f82c[_0xaeb7('0x2f')]=qs['offset'](_0x421974[_0xaeb7('0x46')][_0xaeb7('0x2f')]);}return _0x3879d3[_0xaeb7('0x84')](_0x14f82c);}})[_0xaeb7('0x37')](function(_0x317340){if(_0x317340){return _0x317340?{'count':_0x517638,'rows':_0x317340}:null;}})[_0xaeb7('0x37')](respondWithResult(_0x113fb1,null))[_0xaeb7('0x56')](handleError(_0x113fb1,null));};function Extension(_0x381321,_0x2320f4,_0x27ef76,_0x392d46){this[_0xaeb7('0x85')]='from-voip-provider';this[_0xaeb7('0x86')]=_0x381321['localstationid'];this[_0xaeb7('0x87')]=_0x392d46;this[_0xaeb7('0x52')]='system';this[_0xaeb7('0x88')]='Fax\x20Extension';this[_0xaeb7('0x65')]=_0x381321['id'];this['priority']=_0x2320f4;this[_0xaeb7('0x89')]=_0x27ef76;}function createExtensionsReciveFax(_0x15f78e){var _0x33d4b4=0x1;var _0x575120=[];_0x575120[_0xaeb7('0x8a')](new Extension(_0x15f78e,_0x33d4b4,'',_0xaeb7('0x8b')));_0x33d4b4+=0x1;_0x575120[_0xaeb7('0x8a')](new Extension(_0x15f78e,_0x33d4b4,'CDR(type)=inbound-fax','Set'));_0x33d4b4+=0x1;for(var _0xe46f97 in _0x15f78e){if(_0x15f78e['hasOwnProperty'](_0xe46f97)&&(_0xe46f97===_0xaeb7('0x8c')||_0xe46f97==='localstationid'||_0xe46f97===_0xaeb7('0x8d')||_0xe46f97==='faxdetect'||_0xe46f97===_0xaeb7('0x8e')||_0xe46f97===_0xaeb7('0x8f')||_0xe46f97==='minrate'||_0xe46f97===_0xaeb7('0x90')||_0xe46f97===_0xaeb7('0x91'))){_0x575120['push'](new Extension(_0x15f78e,_0x33d4b4,'FAXOPT('+_0xe46f97+')='+_0x15f78e[_0xe46f97],_0xaeb7('0x92')));_0x33d4b4+=0x1;}}_0x575120[_0xaeb7('0x8a')](new Extension(_0x15f78e,_0x33d4b4,'6',_0xaeb7('0x93')));_0x33d4b4+=0x1;_0x575120[_0xaeb7('0x8a')](new Extension(_0x15f78e,_0x33d4b4,'/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',_0xaeb7('0x94')));_0x33d4b4=0x0;return _0x575120;}exports[_0xaeb7('0x95')]=function(_0x2cd5cd,_0x58c87d,_0x2db2e1){var _0x10d451;return db['sequelize']['transaction'](function(_0x1fa877){return db[_0xaeb7('0x42')][_0xaeb7('0x5c')](_0x2cd5cd[_0xaeb7('0x5d')],{'transaction':_0x1fa877})['then'](function(_0x39e221){_0x10d451=_0x39e221[_0xaeb7('0x38')]({'plain':!![]});return db[_0xaeb7('0x96')][_0xaeb7('0x97')](createExtensionsReciveFax(_0x10d451),{'transaction':_0x1fa877});});})[_0xaeb7('0x37')](function(){return _0x10d451;})[_0xaeb7('0x37')](respondWithResult(_0x58c87d,null))[_0xaeb7('0x56')](handleError(_0x58c87d,null));};exports[_0xaeb7('0x98')]=function(_0x4f6cdc,_0x5daeeb,_0x1e49ff){var _0xce27b6;return db[_0xaeb7('0x7f')][_0xaeb7('0x80')](function(_0x3bd600){return db[_0xaeb7('0x42')][_0xaeb7('0x35')](_0x4f6cdc[_0xaeb7('0x5d')],{'where':{'id':_0x4f6cdc[_0xaeb7('0x5d')]['id']},'transaction':_0x3bd600})['then'](function(_0x37cfb9){return db[_0xaeb7('0x96')][_0xaeb7('0x36')]({'where':{'FaxAccountId':_0x4f6cdc[_0xaeb7('0x5d')]['id']},'transaction':_0x3bd600})['then'](function(_0x48846a){return db[_0xaeb7('0x96')][_0xaeb7('0x97')](createExtensionsReciveFax(_['omit'](_0x4f6cdc['body'],[_0xaeb7('0x99'),_0xaeb7('0x44'),_0xaeb7('0x9a'),'updatedAt',_0xaeb7('0x9b'),_0xaeb7('0x9c')])),{'transaction':_0x3bd600});});});})[_0xaeb7('0x37')](function(){return db[_0xaeb7('0x42')][_0xaeb7('0x9d')](_0x4f6cdc[_0xaeb7('0x5d')]['id']);})[_0xaeb7('0x37')](respondWithResult(_0x5daeeb,null))[_0xaeb7('0x56')](handleError(_0x5daeeb,null));};exports[_0xaeb7('0x9e')]=function(_0x3177a1,_0x44e890,_0xc65b93){var _0x1f4d3b={'raw':!![],'where':{}};var _0x27960e={};var _0xe0a64={'count':0x0,'rows':[]};return db[_0xaeb7('0x42')][_0xaeb7('0x6e')]({'where':{'id':_0x3177a1['params']['id']}})[_0xaeb7('0x37')](handleEntityNotFound(_0x44e890,null))['then'](function(_0x373278){if(_0x373278){_0x27960e[_0xaeb7('0x45')]=_[_0xaeb7('0x47')](db[_0xaeb7('0x9f')]['rawAttributes']);_0x27960e[_0xaeb7('0x46')]=_['keys'](_0x3177a1[_0xaeb7('0x46')]);_0x27960e[_0xaeb7('0x58')]=_[_0xaeb7('0x49')](_0x27960e[_0xaeb7('0x45')],_0x27960e[_0xaeb7('0x46')]);_0x1f4d3b[_0xaeb7('0x48')]=_['intersection'](_0x27960e[_0xaeb7('0x45')],qs['fields'](_0x3177a1[_0xaeb7('0x46')][_0xaeb7('0x4a')]));_0x1f4d3b[_0xaeb7('0x48')]=_0x1f4d3b[_0xaeb7('0x48')][_0xaeb7('0x67')]?_0x1f4d3b[_0xaeb7('0x48')]:_0x27960e[_0xaeb7('0x45')];if(!_0x3177a1[_0xaeb7('0x46')][_0xaeb7('0x70')]('nolimit')){_0x1f4d3b[_0xaeb7('0x2e')]=qs[_0xaeb7('0x2e')](_0x3177a1[_0xaeb7('0x46')][_0xaeb7('0x2e')]);_0x1f4d3b['offset']=qs[_0xaeb7('0x2f')](_0x3177a1[_0xaeb7('0x46')]['offset']);}_0x1f4d3b[_0xaeb7('0x4c')]=qs[_0xaeb7('0x4d')](_0x3177a1[_0xaeb7('0x46')][_0xaeb7('0x4d')]);_0x1f4d3b[_0xaeb7('0x4e')]=qs[_0xaeb7('0x58')](_[_0xaeb7('0x4f')](_0x3177a1[_0xaeb7('0x46')],_0x27960e[_0xaeb7('0x58')]));_0x1f4d3b[_0xaeb7('0x4e')][_0xaeb7('0x65')]=_0x373278['id'];if(_0x3177a1[_0xaeb7('0x46')][_0xaeb7('0x50')]){_0x1f4d3b[_0xaeb7('0x4e')]=_['merge'](_0x1f4d3b[_0xaeb7('0x4e')],{'$or':_['map'](_0x1f4d3b[_0xaeb7('0x48')],function(_0x3d02da){var _0x3cc685={};_0x3cc685[_0x3d02da]={'$like':'%'+_0x3177a1[_0xaeb7('0x46')][_0xaeb7('0x50')]+'%'};return _0x3cc685;})});}if(_0x3177a1[_0xaeb7('0x46')]['$gte']){var _0x54c68f=_0x3177a1[_0xaeb7('0x46')][_0xaeb7('0xa0')][_0xaeb7('0xa1')](',');var _0x309fb0={};_0x309fb0[_0x54c68f[0x0]]={'$gte':moment(_0x54c68f[0x1])[_0xaeb7('0xa2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1f4d3b[_0xaeb7('0x4e')]=_[_0xaeb7('0x51')](_0x1f4d3b['where'],_0x309fb0);}_0x1f4d3b=_['merge']({},_0x1f4d3b,_0x3177a1['options']);return db[_0xaeb7('0x9f')][_0xaeb7('0x30')]({'where':_0x1f4d3b[_0xaeb7('0x4e')]})[_0xaeb7('0x37')](function(_0x4d00d1){_0xe0a64[_0xaeb7('0x30')]=_0x4d00d1;if(_0x3177a1['query']['includeAll']){_0x1f4d3b['include']=[{'all':!![]}];}return db[_0xaeb7('0x9f')][_0xaeb7('0x54')](_0x1f4d3b);})[_0xaeb7('0x37')](function(_0x1a8008){_0xe0a64[_0xaeb7('0x55')]=_0x1a8008;return _0xe0a64;});}})[_0xaeb7('0x37')](respondWithFilteredResult(_0x44e890,_0x1f4d3b))[_0xaeb7('0x56')](handleError(_0x44e890,null));};exports[_0xaeb7('0x3e')]=function(_0xf4f9f,_0x23ee7d,_0x4b7a09){var _0xa12552,_0x1c95be={},_0x392223;if(_0xf4f9f[_0xaeb7('0x5d')]['to']){_0x392223=_0xf4f9f[_0xaeb7('0x5d')]['to'][0x0];}return db[_0xaeb7('0x42')][_0xaeb7('0x5b')]({'where':{'id':_0xf4f9f[_0xaeb7('0x57')]['id']},'include':[{'model':db['CmList'],'as':_0xaeb7('0xa3'),'include':[{'model':db[_0xaeb7('0x75')],'as':_0xaeb7('0xa4'),'where':{'fax':_0x392223},'limit':0x1,'order':[[_0xaeb7('0xa5'),_0xaeb7('0xa6')]]}]}]})[_0xaeb7('0x37')](handleEntityNotFound(_0x23ee7d,null))[_0xaeb7('0x37')](function(_0x59c7fb){_0xa12552=_0x59c7fb;if(_0xf4f9f[_0xaeb7('0x5d')][_0xaeb7('0xa7')]&&_0xf4f9f['body']['attachments'][_0xaeb7('0x67')]){for(var _0x4c4e27=0x0;_0x4c4e27<_0xf4f9f[_0xaeb7('0x5d')][_0xaeb7('0xa7')][_0xaeb7('0x67')];_0x4c4e27+=0x1){_0xf4f9f['body'][_0xaeb7('0xa7')][_0x4c4e27]={'filename':_0xf4f9f[_0xaeb7('0x5d')][_0xaeb7('0xa7')][_0x4c4e27][_0xaeb7('0x3d')],'id':_0xf4f9f[_0xaeb7('0x5d')][_0xaeb7('0xa7')][_0x4c4e27]['id'],'path':path['join'](config[_0xaeb7('0xa8')],'server/files/attachments',_0xf4f9f[_0xaeb7('0x5d')][_0xaeb7('0xa7')][_0x4c4e27][_0xaeb7('0xa9')])};}}return respondWithRpcPromise(_0xaeb7('0xaa'),_0xaeb7('0xaa'),{'FaxAccountId':_[_0xaeb7('0xab')](_0xf4f9f['params']['id'])?undefined:_0xf4f9f[_0xaeb7('0x57')]['id'],'path':_[_0xaeb7('0xab')](_0xf4f9f[_0xaeb7('0x5d')]['attachments'][0x0][_0xaeb7('0xac')])?undefined:_0xf4f9f[_0xaeb7('0x5d')][_0xaeb7('0xa7')][0x0][_0xaeb7('0xac')],'fax':_[_0xaeb7('0xab')](_0xf4f9f[_0xaeb7('0x5d')]['to'][0x0])?undefined:_0xf4f9f[_0xaeb7('0x5d')]['to'][0x0]},client9002);})[_0xaeb7('0x37')](function(){if(_0xa12552){if(_['isNil'](_0xf4f9f['body'][_0xaeb7('0xad')])){_0xf4f9f[_0xaeb7('0x5d')]['from']=util[_0xaeb7('0xa2')](_0xaeb7('0xae'),_0xa12552[_0xaeb7('0x3d')],_0xa12552['fax']);}if(_0xa12552[_0xaeb7('0xa3')]){if(_0xa12552[_0xaeb7('0xa3')][_0xaeb7('0xa4')][_0xaeb7('0x67')]){return _0xa12552[_0xaeb7('0xa3')][_0xaeb7('0xa4')][0x0];}else{return db[_0xaeb7('0x75')][_0xaeb7('0x5c')](_[_0xaeb7('0x1b')](_0xf4f9f[_0xaeb7('0x5d')],{'firstName':_0xf4f9f[_0xaeb7('0x5d')]['to'][0x0],'phone':_0xf4f9f['body']['to'][0x0],'fax':_0xf4f9f[_0xaeb7('0x5d')]['to'][0x0],'ListId':_0xa12552[_0xaeb7('0x9c')]}));}}else{throw new Error(_0xaeb7('0xaf'));}}else{throw new Error(_0xaeb7('0xb0'));}})['then'](function(_0x754a8d){if(_0x754a8d){return db[_0xaeb7('0x73')]['find']({'where':{'ContactId':_0x754a8d['id'],'closed':![],'FaxAccountId':_0xa12552['id']}})[_0xaeb7('0x37')](function(_0x29451e){if(_0x29451e){return[_0x29451e,![]];}return db[_0xaeb7('0x73')][_0xaeb7('0x5c')]({'UserId':_0xf4f9f[_0xaeb7('0x5e')]['id'],'ContactId':_0x754a8d['id'],'FaxAccountId':_0xa12552['id'],'fax':_0xf4f9f[_0xaeb7('0x5d')]['to'][0x0],'firstMsgDirection':_0xaeb7('0xb1'),'Messages':[_[_0xaeb7('0x51')](_0xf4f9f['body'],{'read':![],'body':_0xf4f9f[_0xaeb7('0x5d')]['attachments'][0x0]['filename'],'FaxAccountId':_0xa12552['id'],'UserId':_0xf4f9f[_0xaeb7('0x5e')]['id'],'ContactId':_0x754a8d['id'],'AttachmentId':_0xf4f9f[_0xaeb7('0x5d')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xaeb7('0xb2')}]})[_0xaeb7('0x37')](function(_0x490f9d){return[_0x490f9d,!![]];});});}else{throw new Error(_0xaeb7('0xb3'));}})[_0xaeb7('0xb4')](function(_0x3c2cbb,_0x682498){if(_0x682498){return _0x3c2cbb;}return db[_0xaeb7('0x9f')][_0xaeb7('0x5c')]({'direction':'out','read':![],'body':_0xf4f9f[_0xaeb7('0x5d')]['attachments'][0x0][_0xaeb7('0xb5')],'FaxAccountId':_0xa12552['id'],'FaxInteractionId':_0x3c2cbb['id'],'UserId':_0xf4f9f[_0xaeb7('0x5e')]['id'],'ContactId':_0x3c2cbb[_0xaeb7('0xb6')],'AttachmentId':_0xf4f9f[_0xaeb7('0x5d')][_0xaeb7('0xa7')][0x0]['id']})['then'](function(_0x138eac){_0x3c2cbb[_0xaeb7('0xb7')]['Messages']=[];_0x3c2cbb['dataValues'][_0xaeb7('0xb2')][_0xaeb7('0x8a')](_0x138eac[_0xaeb7('0xb7')]);return _0x3c2cbb;});})[_0xaeb7('0x37')](function(_0x52dcd0){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xaeb7('0xab')](_0xf4f9f['params']['id'])?undefined:_0xf4f9f[_0xaeb7('0x57')]['id'],'path':_[_0xaeb7('0xab')](_0xf4f9f[_0xaeb7('0x5d')][_0xaeb7('0xa7')][0x0][_0xaeb7('0xac')])?undefined:_0xf4f9f['body'][_0xaeb7('0xa7')][0x0]['path'],'fax':_[_0xaeb7('0xab')](_0xf4f9f[_0xaeb7('0x5d')]['to'][0x0])?undefined:_0xf4f9f[_0xaeb7('0x5d')]['to'][0x0],'AttachmentId':_0xf4f9f[_0xaeb7('0x5d')][_0xaeb7('0xa7')][0x0]['id']},client9002)[_0xaeb7('0x37')](function(_0x114fed){logger[_0xaeb7('0x2b')](_0xaeb7('0xb8'),_0x114fed);})[_0xaeb7('0x56')](function(_0x1301f8){logger[_0xaeb7('0x2b')](_0xaeb7('0xb8'),_0x1301f8);});return _0x52dcd0;})[_0xaeb7('0x37')](respondWithResult(_0x23ee7d,null))[_0xaeb7('0x56')](handleError(_0x23ee7d,null));};exports['addAgents']=function(_0x18b6ed,_0x18d9db,_0x4862bc){return db[_0xaeb7('0x42')]['find']({'where':{'id':_0x18b6ed[_0xaeb7('0x57')]['id']}})[_0xaeb7('0x37')](handleEntityNotFound(_0x18d9db,null))[_0xaeb7('0x37')](function(_0x192a1){if(_0x192a1){return _0x192a1[_0xaeb7('0xb9')](_0x18b6ed[_0xaeb7('0x5d')][_0xaeb7('0x6b')],_[_0xaeb7('0x74')](_0x18b6ed[_0xaeb7('0x5d')],[_0xaeb7('0x6b'),'id'])||{})[_0xaeb7('0xb4')](function(_0xd2fb29){for(var _0x67c1b6=0x0;_0x67c1b6<_0x18b6ed[_0xaeb7('0x5d')][_0xaeb7('0x6b')]['length'];_0x67c1b6+=0x1){socket['emit'](_0xaeb7('0xba'),{'UserId':Number(_0x18b6ed[_0xaeb7('0x5d')][_0xaeb7('0x6b')][_0x67c1b6]),'FaxAccountId':Number(_0x18b6ed[_0xaeb7('0x57')]['id'])});}return _0xd2fb29;});}})['then'](respondWithResult(_0x18d9db,null))[_0xaeb7('0x56')](handleError(_0x18d9db,null));};exports[_0xaeb7('0xbb')]=function(_0x52c947,_0x39afdd,_0xef1743){return db[_0xaeb7('0x42')][_0xaeb7('0x5b')]({'where':{'id':_0x52c947['params']['id']}})[_0xaeb7('0x37')](handleEntityNotFound(_0x39afdd,null))[_0xaeb7('0x37')](function(_0xa9ab16){if(_0xa9ab16){return _0xa9ab16[_0xaeb7('0xbb')](_0x52c947[_0xaeb7('0x46')][_0xaeb7('0x6b')])[_0xaeb7('0x37')](function(){if(_[_0xaeb7('0xbc')](_0x52c947[_0xaeb7('0x46')][_0xaeb7('0x6b')])){for(var _0x55967d=0x0;_0x55967d<_0x52c947[_0xaeb7('0x46')][_0xaeb7('0x6b')][_0xaeb7('0x67')];_0x55967d+=0x1){socket[_0xaeb7('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x52c947[_0xaeb7('0x46')][_0xaeb7('0x6b')][_0x55967d]),'FaxAccountId':Number(_0x52c947['params']['id'])});}}else{socket[_0xaeb7('0xbd')](_0xaeb7('0xbe'),{'UserId':Number(_0x52c947[_0xaeb7('0x46')][_0xaeb7('0x6b')]),'FaxAccountId':Number(_0x52c947[_0xaeb7('0x57')]['id'])});}});}})[_0xaeb7('0x37')](respondWithStatusCode(_0x39afdd,null))[_0xaeb7('0x56')](handleError(_0x39afdd,null));};exports[_0xaeb7('0xbf')]=function(_0x143710,_0x1bcb84,_0x257968){var _0x4ad510={};var _0x47fad4={};var _0x49ea40;var _0x143037;return db[_0xaeb7('0x42')]['findOne']({'where':{'id':_0x143710[_0xaeb7('0x57')]['id']}})['then'](handleEntityNotFound(_0x1bcb84,null))['then'](function(_0x4e73cf){if(_0x4e73cf){_0x49ea40=_0x4e73cf;_0x47fad4[_0xaeb7('0x45')]=_[_0xaeb7('0x47')](db[_0xaeb7('0x77')][_0xaeb7('0x6f')]);_0x47fad4['query']=_[_0xaeb7('0x47')](_0x143710['query']);_0x47fad4[_0xaeb7('0x58')]=_['intersection'](_0x47fad4['model'],_0x47fad4[_0xaeb7('0x46')]);_0x4ad510[_0xaeb7('0x48')]=_[_0xaeb7('0x49')](_0x47fad4[_0xaeb7('0x45')],qs['fields'](_0x143710['query'][_0xaeb7('0x4a')]));_0x4ad510[_0xaeb7('0x48')]=_0x4ad510[_0xaeb7('0x48')][_0xaeb7('0x67')]?_0x4ad510[_0xaeb7('0x48')]:_0x47fad4[_0xaeb7('0x45')];_0x4ad510[_0xaeb7('0x4c')]=qs[_0xaeb7('0x4d')](_0x143710[_0xaeb7('0x46')]['sort']);_0x4ad510[_0xaeb7('0x4e')]=qs[_0xaeb7('0x58')](_[_0xaeb7('0x4f')](_0x143710['query'],_0x47fad4['filters']));if(_0x143710[_0xaeb7('0x46')][_0xaeb7('0x50')]){_0x4ad510[_0xaeb7('0x4e')]=_[_0xaeb7('0x51')](_0x4ad510[_0xaeb7('0x4e')],{'$or':_['map'](_0x4ad510[_0xaeb7('0x48')],function(_0x32f600){var _0x4cf60d={};_0x4cf60d[_0x32f600]={'$like':'%'+_0x143710[_0xaeb7('0x46')]['filter']+'%'};return _0x4cf60d;})});}_0x4ad510=_['merge']({},_0x4ad510,_0x143710[_0xaeb7('0x5a')]);return _0x49ea40[_0xaeb7('0xbf')](_0x4ad510);}})[_0xaeb7('0x37')](function(_0x266f50){if(_0x266f50){_0x143037=_0x266f50[_0xaeb7('0x67')];if(!_0x143710[_0xaeb7('0x46')]['hasOwnProperty']('nolimit')){_0x4ad510[_0xaeb7('0x2e')]=qs[_0xaeb7('0x2e')](_0x143710[_0xaeb7('0x46')]['limit']);_0x4ad510[_0xaeb7('0x2f')]=qs[_0xaeb7('0x2f')](_0x143710[_0xaeb7('0x46')][_0xaeb7('0x2f')]);}return _0x49ea40['getAgents'](_0x4ad510);}})[_0xaeb7('0x37')](function(_0x5d51f3){if(_0x5d51f3){return _0x5d51f3?{'count':_0x143037,'rows':_0x5d51f3}:null;}})[_0xaeb7('0x37')](respondWithResult(_0x1bcb84,null))[_0xaeb7('0x56')](handleError(_0x1bcb84,null));}; \ No newline at end of file +var _0x93a3=['filter','merge','VIRTUAL','options','include','findAll','show','params','Pause','mandatoryDispositionPause','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','getDispositions','includeAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','hasOwnProperty','rows','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','push','CDR(type)=inbound-fax','Set','gateway','headerinfo','maxrate','modem','t38timeout','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','Contacts','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','info','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','request','then','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource','stack','name','index','FaxAccount','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0xf86657,_0x28a8c3){var _0x2b630e=function(_0x2ca7af){while(--_0x2ca7af){_0xf86657['push'](_0xf86657['shift']());}};_0x2b630e(++_0x28a8c3);}(_0x93a3,0x13d));var _0x393a=function(_0x551ee1,_0xf63222){_0x551ee1=_0x551ee1-0x0;var _0x398ba5=_0x93a3[_0x551ee1];return _0x398ba5;};'use strict';var emlformat=require(_0x393a('0x0'));var rimraf=require(_0x393a('0x1'));var zipdir=require(_0x393a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x393a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x393a('0x4'));var path=require(_0x393a('0x5'));var sox=require(_0x393a('0x6'));var csv=require(_0x393a('0x7'));var ejs=require(_0x393a('0x8'));var fs=require('fs');var fs_extra=require(_0x393a('0x9'));var _=require(_0x393a('0xa'));var squel=require(_0x393a('0xb'));var crypto=require(_0x393a('0xc'));var jsforce=require(_0x393a('0xd'));var deskjs=require(_0x393a('0xe'));var toCsv=require(_0x393a('0x7'));var querystring=require(_0x393a('0xf'));var Papa=require(_0x393a('0x10'));var Redis=require(_0x393a('0x11'));var authService=require(_0x393a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x393a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x393a('0x14'))(_0x393a('0x15'));var utils=require(_0x393a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x393a('0x17'))['db'];config[_0x393a('0x18')]=_[_0x393a('0x19')](config['redis'],{'host':_0x393a('0x1a'),'port':0x18eb});var socket=require(_0x393a('0x1b'))(new Redis(config['redis']));require(_0x393a('0x1c'))[_0x393a('0x1d')](socket);var jayson=require(_0x393a('0x1e'));var client=jayson['client'][_0x393a('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x155357,_0x3824fd,_0x287103,_0x274e67){return new BPromise(function(_0x2dcb85,_0x32a0fc){var _0x340549=_0x274e67||client;return _0x340549[_0x393a('0x20')](_0x155357,_0x287103)[_0x393a('0x21')](function(_0x4adfec){logger['info']('FaxAccount,\x20%s,\x20%s',_0x3824fd,'request\x20sent');logger[_0x393a('0x22')](_0x393a('0x23'),_0x3824fd,_0x393a('0x24'),JSON[_0x393a('0x25')](_0x4adfec));if(_0x4adfec[_0x393a('0x26')]){if(_0x4adfec[_0x393a('0x26')][_0x393a('0x27')]===0x1f4){logger[_0x393a('0x26')](_0x393a('0x28'),_0x3824fd,_0x4adfec[_0x393a('0x26')][_0x393a('0x29')]);return _0x32a0fc(_0x4adfec['error'][_0x393a('0x29')]);}logger[_0x393a('0x26')](_0x393a('0x28'),_0x3824fd,_0x4adfec[_0x393a('0x26')][_0x393a('0x29')]);return _0x2dcb85(_0x4adfec[_0x393a('0x26')][_0x393a('0x29')]);}else{logger['info'](_0x393a('0x28'),_0x3824fd,'request\x20sent');_0x2dcb85(_0x4adfec[_0x393a('0x2a')][_0x393a('0x29')]);}})[_0x393a('0x2b')](function(_0x25f953){logger[_0x393a('0x26')](_0x393a('0x28'),_0x3824fd,_0x25f953);_0x32a0fc(_0x25f953);});});}function respondWithStatusCode(_0x203fd5,_0x593aa8){_0x593aa8=_0x593aa8||0xcc;return function(_0x4d91f7){if(_0x4d91f7){return _0x203fd5[_0x393a('0x2c')](_0x593aa8);}return _0x203fd5[_0x393a('0x2d')](_0x593aa8)[_0x393a('0x2e')]();};}function respondWithResult(_0x29da87,_0x31cf4c){_0x31cf4c=_0x31cf4c||0xc8;return function(_0x3de98c){if(_0x3de98c){return _0x29da87['status'](_0x31cf4c)[_0x393a('0x2f')](_0x3de98c);}};}function respondWithFilteredResult(_0x250e68,_0xd78a73){return function(_0x4a7f66){if(_0x4a7f66){var _0x580aef=typeof _0xd78a73['offset']===_0x393a('0x30')&&typeof _0xd78a73['limit']===_0x393a('0x30');var _0xd68e4a=_0x4a7f66[_0x393a('0x31')];var _0x5d3662=_0x580aef?0x0:_0xd78a73[_0x393a('0x32')];var _0x18ce81=_0x580aef?_0x4a7f66[_0x393a('0x31')]:_0xd78a73[_0x393a('0x32')]+_0xd78a73[_0x393a('0x33')];var _0x48b4f3;if(_0x18ce81>=_0xd68e4a){_0x18ce81=_0xd68e4a;_0x48b4f3=0xc8;}else{_0x48b4f3=0xce;}_0x250e68[_0x393a('0x2d')](_0x48b4f3);return _0x250e68[_0x393a('0x34')](_0x393a('0x35'),_0x5d3662+'-'+_0x18ce81+'/'+_0xd68e4a)[_0x393a('0x2f')](_0x4a7f66);}return null;};}function patchUpdates(_0x3dfed5){return function(_0x32beb0){try{jsonpatch[_0x393a('0x36')](_0x32beb0,_0x3dfed5,!![]);}catch(_0x5e3750){return BPromise[_0x393a('0x37')](_0x5e3750);}return _0x32beb0[_0x393a('0x38')]();};}function saveUpdates(_0x3119b2,_0x1990d1){return function(_0x3aa131){if(_0x3aa131){return _0x3aa131[_0x393a('0x39')](_0x3119b2)[_0x393a('0x21')](function(_0x42eb58){return _0x42eb58;});}return null;};}function removeEntity(_0x379cd0,_0x1da8c4){return function(_0x4fdb16){if(_0x4fdb16){return _0x4fdb16[_0x393a('0x3a')]()[_0x393a('0x21')](function(){var _0x43427e=_0x4fdb16['get']({'plain':!![]});var _0x26f9d1=_0x393a('0x3b');return db[_0x393a('0x3c')]['destroy']({'where':{'type':_0x26f9d1,'resourceId':_0x43427e['id']}})[_0x393a('0x21')](function(){return _0x4fdb16;});})[_0x393a('0x21')](function(){_0x379cd0[_0x393a('0x2d')](0xcc)[_0x393a('0x2e')]();});}};}function handleEntityNotFound(_0x4b2286,_0x4cbfee){return function(_0x24ba63){if(!_0x24ba63){_0x4b2286[_0x393a('0x2c')](0x194);}return _0x24ba63;};}function handleError(_0x425457,_0x233475){_0x233475=_0x233475||0x1f4;return function(_0x145e23){logger[_0x393a('0x26')](_0x145e23[_0x393a('0x3d')]);if(_0x145e23[_0x393a('0x3e')]){delete _0x145e23[_0x393a('0x3e')];}_0x425457[_0x393a('0x2d')](_0x233475)['send'](_0x145e23);};}exports[_0x393a('0x3f')]=function(_0x9844b2,_0x54d900){var _0x5c0a77={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4f0005={},_0x38eab4={'count':0x0,'rows':[]};var _0x518adb=_['map'](db[_0x393a('0x40')]['rawAttributes'],function(_0x5e7863){return{'name':_0x5e7863['fieldName'],'type':_0x5e7863[_0x393a('0x41')][_0x393a('0x42')]};});_0x4f0005[_0x393a('0x43')]=_[_0x393a('0x44')](_0x518adb,'name');_0x4f0005['query']=_[_0x393a('0x45')](_0x9844b2[_0x393a('0x46')]);_0x4f0005[_0x393a('0x47')]=_[_0x393a('0x48')](_0x4f0005[_0x393a('0x43')],_0x4f0005[_0x393a('0x46')]);_0x5c0a77[_0x393a('0x49')]=_[_0x393a('0x48')](_0x4f0005[_0x393a('0x43')],qs[_0x393a('0x4a')](_0x9844b2[_0x393a('0x46')][_0x393a('0x4a')]));_0x5c0a77[_0x393a('0x49')]=_0x5c0a77[_0x393a('0x49')][_0x393a('0x4b')]?_0x5c0a77['attributes']:_0x4f0005[_0x393a('0x43')];if(!_0x9844b2[_0x393a('0x46')]['hasOwnProperty'](_0x393a('0x4c'))){_0x5c0a77[_0x393a('0x33')]=qs[_0x393a('0x33')](_0x9844b2[_0x393a('0x46')][_0x393a('0x33')]);_0x5c0a77[_0x393a('0x32')]=qs[_0x393a('0x32')](_0x9844b2[_0x393a('0x46')]['offset']);}_0x5c0a77[_0x393a('0x4d')]=qs[_0x393a('0x4e')](_0x9844b2['query']['sort']);_0x5c0a77[_0x393a('0x4f')]=qs[_0x393a('0x47')](_[_0x393a('0x50')](_0x9844b2['query'],_0x4f0005[_0x393a('0x47')]),_0x518adb);if(_0x9844b2[_0x393a('0x46')][_0x393a('0x51')]){_0x5c0a77[_0x393a('0x4f')]=_[_0x393a('0x52')](_0x5c0a77[_0x393a('0x4f')],{'$or':_['map'](_0x518adb,function(_0x47a8a5){if(_0x47a8a5[_0x393a('0x41')]!==_0x393a('0x53')){var _0x3c66a4={};_0x3c66a4[_0x47a8a5[_0x393a('0x3e')]]={'$like':'%'+_0x9844b2['query']['filter']+'%'};return _0x3c66a4;}})});}_0x5c0a77=_[_0x393a('0x52')]({},_0x5c0a77,_0x9844b2[_0x393a('0x54')]);var _0xcc5b05={'where':_0x5c0a77[_0x393a('0x4f')]};return db[_0x393a('0x40')][_0x393a('0x31')](_0xcc5b05)[_0x393a('0x21')](function(_0x10d212){_0x38eab4[_0x393a('0x31')]=_0x10d212;if(_0x9844b2['query']['includeAll']){_0x5c0a77[_0x393a('0x55')]=[{'all':!![]}];}return db[_0x393a('0x40')][_0x393a('0x56')](_0x5c0a77);})[_0x393a('0x21')](function(_0x46ec56){_0x38eab4['rows']=_0x46ec56;return _0x38eab4;})['then'](respondWithFilteredResult(_0x54d900,_0x5c0a77))[_0x393a('0x2b')](handleError(_0x54d900,null));};exports[_0x393a('0x57')]=function(_0x266759,_0x516e9b){var _0x1d84b6={'raw':![],'where':{'id':_0x266759[_0x393a('0x58')]['id']},'include':[{'model':db[_0x393a('0x59')],'as':_0x393a('0x5a')}]},_0x169aa0={};_0x169aa0['model']=_[_0x393a('0x45')](db[_0x393a('0x40')][_0x393a('0x5b')]);_0x169aa0[_0x393a('0x46')]=_[_0x393a('0x45')](_0x266759[_0x393a('0x46')]);_0x169aa0[_0x393a('0x47')]=_[_0x393a('0x48')](_0x169aa0[_0x393a('0x43')],_0x169aa0[_0x393a('0x46')]);_0x1d84b6[_0x393a('0x49')]=_[_0x393a('0x48')](_0x169aa0[_0x393a('0x43')],qs[_0x393a('0x4a')](_0x266759[_0x393a('0x46')][_0x393a('0x4a')]));_0x1d84b6['attributes']=_0x1d84b6[_0x393a('0x49')][_0x393a('0x4b')]?_0x1d84b6[_0x393a('0x49')]:_0x169aa0[_0x393a('0x43')];if(_0x266759['query']['includeAll']){_0x1d84b6[_0x393a('0x55')]=[{'all':!![]}];}_0x1d84b6=_[_0x393a('0x52')]({},_0x1d84b6,_0x266759[_0x393a('0x54')]);return db[_0x393a('0x40')][_0x393a('0x5c')](_0x1d84b6)[_0x393a('0x21')](handleEntityNotFound(_0x516e9b,null))[_0x393a('0x21')](respondWithResult(_0x516e9b,null))['catch'](handleError(_0x516e9b,null));};exports[_0x393a('0x5d')]=function(_0x4b36f7,_0x16a682){return db[_0x393a('0x40')]['create'](_0x4b36f7[_0x393a('0x5e')],{})[_0x393a('0x21')](function(_0x197a76){var _0x21e845=_0x4b36f7[_0x393a('0x5f')][_0x393a('0x60')]({'plain':!![]});if(!_0x21e845)throw new Error(_0x393a('0x61'));if(_0x21e845['role']===_0x393a('0x5f')){var _0x4f8686=_0x197a76[_0x393a('0x60')]({'plain':!![]});var _0x24bec0=_0x393a('0x3b');return db[_0x393a('0x62')][_0x393a('0x5c')]({'where':{'name':_0x24bec0,'userProfileId':_0x21e845['userProfileId']},'raw':!![]})[_0x393a('0x21')](function(_0x217617){if(_0x217617&&_0x217617[_0x393a('0x63')]===0x0){return db['UserProfileResource'][_0x393a('0x5d')]({'name':_0x4f8686[_0x393a('0x3e')],'resourceId':_0x4f8686['id'],'type':_0x217617['name'],'sectionId':_0x217617['id']},{})['then'](function(){return _0x197a76;});}else{return _0x197a76;}})[_0x393a('0x2b')](function(_0x5d9fce){logger[_0x393a('0x26')](_0x393a('0x64'),_0x5d9fce);throw _0x5d9fce;});}return _0x197a76;})[_0x393a('0x21')](respondWithResult(_0x16a682,0xc9))[_0x393a('0x2b')](handleError(_0x16a682,null));};exports[_0x393a('0x39')]=function(_0x5914e7,_0x47bee7){if(_0x5914e7['body']['id']){delete _0x5914e7['body']['id'];}return db[_0x393a('0x40')]['find']({'where':{'id':_0x5914e7[_0x393a('0x58')]['id']},'include':[{'model':db[_0x393a('0x59')],'as':_0x393a('0x5a')}]})['then'](handleEntityNotFound(_0x47bee7,null))['then'](saveUpdates(_0x5914e7[_0x393a('0x5e')],null))['then'](respondWithResult(_0x47bee7,null))[_0x393a('0x2b')](handleError(_0x47bee7,null));};exports[_0x393a('0x3a')]=function(_0x32368f,_0x5257f2){return db[_0x393a('0x40')][_0x393a('0x5c')]({'where':{'id':_0x32368f[_0x393a('0x58')]['id']}})[_0x393a('0x21')](handleEntityNotFound(_0x5257f2,null))[_0x393a('0x21')](removeEntity(_0x5257f2,null))[_0x393a('0x2b')](handleError(_0x5257f2,null));};exports['describe']=function(_0x27c073,_0x4a37e6){return db[_0x393a('0x40')][_0x393a('0x65')]()[_0x393a('0x21')](respondWithResult(_0x4a37e6,null))[_0x393a('0x2b')](handleError(_0x4a37e6,null));};exports[_0x393a('0x66')]=function(_0x247060,_0x6e8f6e,_0x49c37f){if(_0x247060[_0x393a('0x5e')]['id']){delete _0x247060['body']['id'];}return db[_0x393a('0x40')][_0x393a('0x5c')]({'where':{'id':_0x247060[_0x393a('0x58')]['id']}})[_0x393a('0x21')](handleEntityNotFound(_0x6e8f6e,null))['then'](function(_0x5d8e2f){if(_0x5d8e2f){_0x247060['body'][_0x393a('0x67')]=_0x5d8e2f['id'];return db['Disposition'][_0x393a('0x5d')](_0x247060[_0x393a('0x5e')]);}})[_0x393a('0x21')](respondWithResult(_0x6e8f6e,null))[_0x393a('0x2b')](handleError(_0x6e8f6e,null));};exports[_0x393a('0x68')]=function(_0x50db8b,_0x5e7d2a,_0xb448cf){var _0x22184a={'raw':![],'where':{}};var _0xf9f160={};var _0x318b41={'count':0x0,'rows':[]};return db[_0x393a('0x40')]['findOne']({'where':{'id':_0x50db8b[_0x393a('0x58')]['id']}})[_0x393a('0x21')](handleEntityNotFound(_0x5e7d2a,null))[_0x393a('0x21')](function(_0xaf1fac){if(_0xaf1fac){_0xf9f160[_0x393a('0x43')]=_[_0x393a('0x45')](db['Disposition'][_0x393a('0x5b')]);_0xf9f160[_0x393a('0x46')]=_[_0x393a('0x45')](_0x50db8b['query']);_0xf9f160['filters']=_[_0x393a('0x48')](_0xf9f160[_0x393a('0x43')],_0xf9f160[_0x393a('0x46')]);_0x22184a['attributes']=_[_0x393a('0x48')](_0xf9f160[_0x393a('0x43')],qs[_0x393a('0x4a')](_0x50db8b[_0x393a('0x46')]['fields']));_0x22184a['attributes']=_0x22184a['attributes'][_0x393a('0x4b')]?_0x22184a['attributes']:_0xf9f160['model'];if(!_0x50db8b[_0x393a('0x46')]['hasOwnProperty'](_0x393a('0x4c'))){_0x22184a[_0x393a('0x33')]=qs['limit'](_0x50db8b[_0x393a('0x46')][_0x393a('0x33')]);_0x22184a[_0x393a('0x32')]=qs[_0x393a('0x32')](_0x50db8b[_0x393a('0x46')][_0x393a('0x32')]);}_0x22184a[_0x393a('0x4d')]=qs[_0x393a('0x4e')](_0x50db8b['query'][_0x393a('0x4e')]);_0x22184a[_0x393a('0x4f')]=qs[_0x393a('0x47')](_[_0x393a('0x50')](_0x50db8b[_0x393a('0x46')],_0xf9f160['filters']));_0x22184a[_0x393a('0x4f')][_0x393a('0x67')]=_0xaf1fac['id'];if(_0x50db8b[_0x393a('0x46')][_0x393a('0x51')]){_0x22184a['where']=_[_0x393a('0x52')](_0x22184a[_0x393a('0x4f')],{'$or':_[_0x393a('0x44')](_0x22184a['attributes'],function(_0x97b599){var _0x1be24b={};_0x1be24b[_0x97b599]={'$like':'%'+_0x50db8b['query'][_0x393a('0x51')]+'%'};return _0x1be24b;})});}_0x22184a=_[_0x393a('0x52')]({},_0x22184a,_0x50db8b[_0x393a('0x54')]);return db['Disposition']['count']({'where':_0x22184a['where']})['then'](function(_0x36e455){_0x318b41[_0x393a('0x31')]=_0x36e455;if(_0x50db8b[_0x393a('0x46')][_0x393a('0x69')]){_0x22184a[_0x393a('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x393a('0x56')](_0x22184a);})[_0x393a('0x21')](function(_0x552124){_0x318b41['rows']=_0x552124;return _0x318b41;});}})[_0x393a('0x21')](respondWithFilteredResult(_0x5e7d2a,_0x22184a))[_0x393a('0x2b')](handleError(_0x5e7d2a,null));};exports[_0x393a('0x6a')]=function(_0x274c94,_0x429340,_0x339b6c){return db[_0x393a('0x40')][_0x393a('0x5c')]({'where':{'id':_0x274c94[_0x393a('0x58')]['id']}})['then'](handleEntityNotFound(_0x429340,null))[_0x393a('0x21')](function(_0x57ab11){if(_0x57ab11){return _0x57ab11[_0x393a('0x6a')](_0x274c94[_0x393a('0x46')][_0x393a('0x6b')]);}})[_0x393a('0x21')](respondWithStatusCode(_0x429340,null))[_0x393a('0x2b')](handleError(_0x429340,null));};exports[_0x393a('0x6c')]=function(_0xa226dd,_0x18fe20,_0x170973){if(_0xa226dd['body']['id']){delete _0xa226dd[_0x393a('0x5e')]['id'];}return db[_0x393a('0x40')][_0x393a('0x5c')]({'where':{'id':_0xa226dd[_0x393a('0x58')]['id']}})['then'](handleEntityNotFound(_0x18fe20,null))[_0x393a('0x21')](function(_0x3b515a){if(_0x3b515a){_0xa226dd[_0x393a('0x5e')][_0x393a('0x67')]=_0x3b515a['id'];return db[_0x393a('0x6d')][_0x393a('0x5d')](_0xa226dd['body']);}})[_0x393a('0x21')](respondWithResult(_0x18fe20,null))['catch'](handleError(_0x18fe20,null));};exports[_0x393a('0x6e')]=function(_0x3ef284,_0x19d70b,_0x11fe26){var _0x48fa29={'raw':![],'where':{}};var _0x45c532={};var _0x359298={'count':0x0,'rows':[]};return db[_0x393a('0x40')][_0x393a('0x6f')]({'where':{'id':_0x3ef284[_0x393a('0x58')]['id']}})[_0x393a('0x21')](handleEntityNotFound(_0x19d70b,null))['then'](function(_0x3b9de4){if(_0x3b9de4){_0x45c532[_0x393a('0x43')]=_[_0x393a('0x45')](db['CannedAnswer']['rawAttributes']);_0x45c532[_0x393a('0x46')]=_[_0x393a('0x45')](_0x3ef284[_0x393a('0x46')]);_0x45c532[_0x393a('0x47')]=_[_0x393a('0x48')](_0x45c532[_0x393a('0x43')],_0x45c532[_0x393a('0x46')]);_0x48fa29[_0x393a('0x49')]=_[_0x393a('0x48')](_0x45c532[_0x393a('0x43')],qs[_0x393a('0x4a')](_0x3ef284[_0x393a('0x46')][_0x393a('0x4a')]));_0x48fa29[_0x393a('0x49')]=_0x48fa29[_0x393a('0x49')][_0x393a('0x4b')]?_0x48fa29[_0x393a('0x49')]:_0x45c532[_0x393a('0x43')];if(!_0x3ef284['query'][_0x393a('0x70')](_0x393a('0x4c'))){_0x48fa29[_0x393a('0x33')]=qs[_0x393a('0x33')](_0x3ef284[_0x393a('0x46')][_0x393a('0x33')]);_0x48fa29[_0x393a('0x32')]=qs[_0x393a('0x32')](_0x3ef284[_0x393a('0x46')][_0x393a('0x32')]);}_0x48fa29[_0x393a('0x4d')]=qs['sort'](_0x3ef284[_0x393a('0x46')]['sort']);_0x48fa29[_0x393a('0x4f')]=qs['filters'](_['pick'](_0x3ef284['query'],_0x45c532[_0x393a('0x47')]));_0x48fa29['where'][_0x393a('0x67')]=_0x3b9de4['id'];if(_0x3ef284['query'][_0x393a('0x51')]){_0x48fa29[_0x393a('0x4f')]=_[_0x393a('0x52')](_0x48fa29['where'],{'$or':_[_0x393a('0x44')](_0x48fa29[_0x393a('0x49')],function(_0xd2c42f){var _0x1f24ec={};_0x1f24ec[_0xd2c42f]={'$like':'%'+_0x3ef284[_0x393a('0x46')][_0x393a('0x51')]+'%'};return _0x1f24ec;})});}_0x48fa29=_[_0x393a('0x52')]({},_0x48fa29,_0x3ef284['options']);return db[_0x393a('0x6d')][_0x393a('0x31')]({'where':_0x48fa29[_0x393a('0x4f')]})[_0x393a('0x21')](function(_0x13fd6d){_0x359298[_0x393a('0x31')]=_0x13fd6d;if(_0x3ef284[_0x393a('0x46')]['includeAll']){_0x48fa29[_0x393a('0x55')]=[{'all':!![]}];}return db[_0x393a('0x6d')][_0x393a('0x56')](_0x48fa29);})[_0x393a('0x21')](function(_0x5cc3f6){_0x359298[_0x393a('0x71')]=_0x5cc3f6;return _0x359298;});}})[_0x393a('0x21')](respondWithFilteredResult(_0x19d70b,_0x48fa29))[_0x393a('0x2b')](handleError(_0x19d70b,null));};exports[_0x393a('0x72')]=function(_0x32ce75,_0x49014d,_0x3ce9b2){return db[_0x393a('0x40')][_0x393a('0x5c')]({'where':{'id':_0x32ce75[_0x393a('0x58')]['id']}})['then'](handleEntityNotFound(_0x49014d,null))[_0x393a('0x21')](function(_0x16825d){if(_0x16825d){return _0x16825d['removeAnswers'](_0x32ce75[_0x393a('0x46')][_0x393a('0x6b')]);}})[_0x393a('0x21')](respondWithStatusCode(_0x49014d,null))[_0x393a('0x2b')](handleError(_0x49014d,null));};exports[_0x393a('0x73')]=function(_0x183f91,_0x45bc6c,_0x1a7857){return db[_0x393a('0x74')][_0x393a('0x5c')]({'where':{'id':_0x183f91[_0x393a('0x58')]['id']}})[_0x393a('0x21')](handleEntityNotFound(_0x45bc6c,null))[_0x393a('0x21')](function(_0x28b063){if(_0x28b063){return _0x28b063[_0x393a('0x73')](_0x183f91['body']['ids'],_[_0x393a('0x75')](_0x183f91[_0x393a('0x5e')],[_0x393a('0x6b'),'id'])||{});}})[_0x393a('0x21')](respondWithResult(_0x45bc6c,null))[_0x393a('0x2b')](handleError(_0x45bc6c,null));};exports[_0x393a('0x76')]=function(_0x537460,_0x53e559,_0x1ece97){var _0x29e265={'raw':![],'where':{}};var _0xbb2d13={};var _0x2cc7aa={'count':0x0,'rows':[]};return db[_0x393a('0x40')][_0x393a('0x6f')]({'where':{'id':_0x537460['params']['id']}})[_0x393a('0x21')](handleEntityNotFound(_0x53e559,null))[_0x393a('0x21')](function(_0x511775){if(_0x511775){_0xbb2d13[_0x393a('0x43')]=_['keys'](db[_0x393a('0x74')][_0x393a('0x5b')]);_0xbb2d13[_0x393a('0x46')]=_['keys'](_0x537460[_0x393a('0x46')]);_0xbb2d13[_0x393a('0x47')]=_['intersection'](_0xbb2d13[_0x393a('0x43')],_0xbb2d13[_0x393a('0x46')]);_0x29e265['attributes']=_[_0x393a('0x48')](_0xbb2d13[_0x393a('0x43')],qs[_0x393a('0x4a')](_0x537460['query'][_0x393a('0x4a')]));_0x29e265['attributes']=_0x29e265[_0x393a('0x49')]['length']?_0x29e265['attributes']:_0xbb2d13[_0x393a('0x43')];if(!_0x537460['query'][_0x393a('0x70')]('nolimit')){_0x29e265[_0x393a('0x33')]=qs[_0x393a('0x33')](_0x537460[_0x393a('0x46')]['limit']);_0x29e265[_0x393a('0x32')]=qs[_0x393a('0x32')](_0x537460[_0x393a('0x46')][_0x393a('0x32')]);}_0x29e265[_0x393a('0x4d')]=qs[_0x393a('0x4e')](_0x537460[_0x393a('0x46')][_0x393a('0x4e')]);_0x29e265[_0x393a('0x4f')]=qs[_0x393a('0x47')](_[_0x393a('0x50')](_0x537460[_0x393a('0x46')],_0xbb2d13[_0x393a('0x47')]));_0x29e265[_0x393a('0x4f')][_0x393a('0x67')]=_0x511775['id'];if(_0x537460[_0x393a('0x46')]['filter']){_0x29e265[_0x393a('0x4f')]=_[_0x393a('0x52')](_0x29e265['where'],{'$or':_[_0x393a('0x44')](_0x29e265['attributes'],function(_0x3b2582){var _0x4f07ba={};_0x4f07ba[_0x3b2582]={'$like':'%'+_0x537460[_0x393a('0x46')][_0x393a('0x51')]+'%'};return _0x4f07ba;})});}_0x29e265=_[_0x393a('0x52')]({},_0x29e265,_0x537460[_0x393a('0x54')]);return db[_0x393a('0x74')]['count']({'where':_0x29e265[_0x393a('0x4f')]})[_0x393a('0x21')](function(_0xba840f){_0x2cc7aa[_0x393a('0x31')]=_0xba840f;if(_0x537460[_0x393a('0x46')][_0x393a('0x69')]){_0x29e265[_0x393a('0x55')]=[{'model':db[_0x393a('0x77')],'as':_0x393a('0x78'),'required':![]},{'model':db[_0x393a('0x79')],'as':_0x393a('0x7a'),'attributes':['name',_0x393a('0x7b'),_0x393a('0x7c')],'required':![]},{'model':db[_0x393a('0x7d')],'as':_0x393a('0x7e'),'attributes':['id',_0x393a('0x3e'),_0x393a('0x7f')],'where':_0x537460[_0x393a('0x46')][_0x393a('0x80')]?{'id':_0x537460[_0x393a('0x46')]['tag']}:undefined,'required':_0x537460[_0x393a('0x46')][_0x393a('0x80')]?!![]:![]}];}return db['FaxInteraction'][_0x393a('0x56')](_0x29e265);})['then'](function(_0x2e0c4f){_0x2cc7aa[_0x393a('0x71')]=_0x2e0c4f;return _0x2cc7aa;});}})[_0x393a('0x21')](respondWithFilteredResult(_0x53e559,_0x29e265))['catch'](handleError(_0x53e559,null));};exports['addApplications']=function(_0x177036,_0x1b961d,_0x4dda76){return db['FaxAccount'][_0x393a('0x6f')]({'where':{'id':_0x177036[_0x393a('0x58')]['id']}})[_0x393a('0x21')](handleEntityNotFound(_0x1b961d,null))[_0x393a('0x21')](function(_0x42a97c){if(_0x42a97c){return db[_0x393a('0x81')][_0x393a('0x82')](function(_0x402467){return db[_0x393a('0x83')][_0x393a('0x3a')]({'where':{'FaxAccountId':_0x177036[_0x393a('0x58')]['id']},'transaction':_0x402467})[_0x393a('0x21')](function(_0x4cd37b){var _0x1252b1=_[_0x393a('0x44')](_0x177036[_0x393a('0x5e')],function(_0x48f2fd){_0x48f2fd[_0x393a('0x67')]=_0x177036[_0x393a('0x58')]['id'];return _0x48f2fd;});return db[_0x393a('0x83')][_0x393a('0x84')](_0x1252b1,{'transaction':_0x402467});});})[_0x393a('0x21')](function(){return db[_0x393a('0x83')][_0x393a('0x85')]({'where':{'FaxAccountId':_0x177036[_0x393a('0x58')]['id']},'order':_0x393a('0x86')});});}})[_0x393a('0x21')](respondWithResult(_0x1b961d,null))[_0x393a('0x2b')](handleError(_0x1b961d,null));};exports['getApplications']=function(_0x1f35a3,_0x900d0c,_0x51d485){var _0x81e91e={};var _0x18dcda={};var _0x45b355;var _0x575da3;return db[_0x393a('0x40')][_0x393a('0x6f')]({'where':{'id':_0x1f35a3[_0x393a('0x58')]['id']}})[_0x393a('0x21')](handleEntityNotFound(_0x900d0c,null))[_0x393a('0x21')](function(_0x4a60a5){if(_0x4a60a5){_0x45b355=_0x4a60a5;_0x18dcda[_0x393a('0x43')]=_[_0x393a('0x45')](db[_0x393a('0x83')][_0x393a('0x5b')]);_0x18dcda[_0x393a('0x46')]=_['keys'](_0x1f35a3[_0x393a('0x46')]);_0x18dcda[_0x393a('0x47')]=_[_0x393a('0x48')](_0x18dcda[_0x393a('0x43')],_0x18dcda[_0x393a('0x46')]);_0x81e91e[_0x393a('0x49')]=_['intersection'](_0x18dcda[_0x393a('0x43')],qs[_0x393a('0x4a')](_0x1f35a3[_0x393a('0x46')]['fields']));_0x81e91e[_0x393a('0x49')]=_0x81e91e[_0x393a('0x49')][_0x393a('0x4b')]?_0x81e91e['attributes']:_0x18dcda['model'];_0x81e91e[_0x393a('0x4d')]=qs['sort'](_0x1f35a3[_0x393a('0x46')][_0x393a('0x4e')]);_0x81e91e['where']=qs[_0x393a('0x47')](_[_0x393a('0x50')](_0x1f35a3['query'],_0x18dcda['filters']));if(_0x1f35a3[_0x393a('0x46')][_0x393a('0x51')]){_0x81e91e[_0x393a('0x4f')]=_[_0x393a('0x52')](_0x81e91e[_0x393a('0x4f')],{'$or':_[_0x393a('0x44')](_0x81e91e['attributes'],function(_0x28bcd9){var _0x4ae7f2={};_0x4ae7f2[_0x28bcd9]={'$like':'%'+_0x1f35a3[_0x393a('0x46')][_0x393a('0x51')]+'%'};return _0x4ae7f2;})});}_0x81e91e=_['merge']({},_0x81e91e,_0x1f35a3[_0x393a('0x54')]);return _0x45b355[_0x393a('0x87')](_0x81e91e);}})['then'](function(_0x5a3882){if(_0x5a3882){_0x575da3=_0x5a3882[_0x393a('0x4b')];if(!_0x1f35a3[_0x393a('0x46')][_0x393a('0x70')]('nolimit')){_0x81e91e['limit']=qs[_0x393a('0x33')](_0x1f35a3[_0x393a('0x46')][_0x393a('0x33')]);_0x81e91e[_0x393a('0x32')]=qs[_0x393a('0x32')](_0x1f35a3['query']['offset']);}return _0x45b355[_0x393a('0x87')](_0x81e91e);}})[_0x393a('0x21')](function(_0x32be47){if(_0x32be47){return _0x32be47?{'count':_0x575da3,'rows':_0x32be47}:null;}})[_0x393a('0x21')](respondWithResult(_0x900d0c,null))[_0x393a('0x2b')](handleError(_0x900d0c,null));};function Extension(_0x378adc,_0x840162,_0x45bbf5,_0x16c3b3){this[_0x393a('0x88')]=_0x393a('0x89');this[_0x393a('0x8a')]=_0x378adc[_0x393a('0x8b')];this[_0x393a('0x8c')]=_0x16c3b3;this[_0x393a('0x41')]=_0x393a('0x8d');this[_0x393a('0x8e')]=_0x393a('0x8f');this['FaxAccountId']=_0x378adc['id'];this[_0x393a('0x86')]=_0x840162;this['appdata']=_0x45bbf5;}function createExtensionsReciveFax(_0x4c44d4){var _0x38c807=0x1;var _0x4c5086=[];_0x4c5086[_0x393a('0x90')](new Extension(_0x4c44d4,_0x38c807,'','Answer'));_0x38c807+=0x1;_0x4c5086[_0x393a('0x90')](new Extension(_0x4c44d4,_0x38c807,_0x393a('0x91'),_0x393a('0x92')));_0x38c807+=0x1;for(var _0x68ec5a in _0x4c44d4){if(_0x4c44d4[_0x393a('0x70')](_0x68ec5a)&&(_0x68ec5a==='ecm'||_0x68ec5a===_0x393a('0x8b')||_0x68ec5a===_0x393a('0x93')||_0x68ec5a==='faxdetect'||_0x68ec5a===_0x393a('0x94')||_0x68ec5a===_0x393a('0x95')||_0x68ec5a==='minrate'||_0x68ec5a===_0x393a('0x96')||_0x68ec5a===_0x393a('0x97'))){_0x4c5086['push'](new Extension(_0x4c44d4,_0x38c807,'FAXOPT('+_0x68ec5a+')='+_0x4c44d4[_0x68ec5a],'Set'));_0x38c807+=0x1;}}_0x4c5086['push'](new Extension(_0x4c44d4,_0x38c807,'6','Wait'));_0x38c807+=0x1;_0x4c5086[_0x393a('0x90')](new Extension(_0x4c44d4,_0x38c807,_0x393a('0x98'),_0x393a('0x99')));_0x38c807=0x0;return _0x4c5086;}exports[_0x393a('0x9a')]=function(_0x3f6e7a,_0x23420d,_0x4593f1){var _0x370b0e;return db['sequelize'][_0x393a('0x82')](function(_0x3278c1){return db[_0x393a('0x40')][_0x393a('0x5d')](_0x3f6e7a[_0x393a('0x5e')],{'transaction':_0x3278c1})[_0x393a('0x21')](function(_0x3f60b2){_0x370b0e=_0x3f60b2[_0x393a('0x60')]({'plain':!![]});return db[_0x393a('0x9b')]['bulkCreate'](createExtensionsReciveFax(_0x370b0e),{'transaction':_0x3278c1});});})['then'](function(){return _0x370b0e;})[_0x393a('0x21')](respondWithResult(_0x23420d,null))['catch'](handleError(_0x23420d,null));};exports[_0x393a('0x9c')]=function(_0xe79b6d,_0x454ffa,_0x200653){var _0x41ad0d;return db[_0x393a('0x81')][_0x393a('0x82')](function(_0x22ed20){return db[_0x393a('0x40')][_0x393a('0x39')](_0xe79b6d['body'],{'where':{'id':_0xe79b6d['body']['id']},'transaction':_0x22ed20})[_0x393a('0x21')](function(_0x530393){return db[_0x393a('0x9b')][_0x393a('0x3a')]({'where':{'FaxAccountId':_0xe79b6d['body']['id']},'transaction':_0x22ed20})['then'](function(_0x47a341){return db['VoiceExtension'][_0x393a('0x84')](createExtensionsReciveFax(_[_0x393a('0x75')](_0xe79b6d['body'],[_0x393a('0x9d'),_0x393a('0x42'),_0x393a('0x9e'),_0x393a('0x9f'),'TrunkId',_0x393a('0xa0')])),{'transaction':_0x22ed20});});});})[_0x393a('0x21')](function(){return db[_0x393a('0x40')][_0x393a('0xa1')](_0xe79b6d[_0x393a('0x5e')]['id']);})[_0x393a('0x21')](respondWithResult(_0x454ffa,null))[_0x393a('0x2b')](handleError(_0x454ffa,null));};exports[_0x393a('0xa2')]=function(_0x557584,_0x23854e,_0x77ff1f){var _0xa158fb={'raw':!![],'where':{}};var _0x1b7229={};var _0x3047ef={'count':0x0,'rows':[]};return db[_0x393a('0x40')][_0x393a('0x6f')]({'where':{'id':_0x557584['params']['id']}})[_0x393a('0x21')](handleEntityNotFound(_0x23854e,null))[_0x393a('0x21')](function(_0x4aa801){if(_0x4aa801){_0x1b7229[_0x393a('0x43')]=_['keys'](db[_0x393a('0xa3')][_0x393a('0x5b')]);_0x1b7229['query']=_[_0x393a('0x45')](_0x557584['query']);_0x1b7229[_0x393a('0x47')]=_[_0x393a('0x48')](_0x1b7229[_0x393a('0x43')],_0x1b7229[_0x393a('0x46')]);_0xa158fb['attributes']=_[_0x393a('0x48')](_0x1b7229['model'],qs[_0x393a('0x4a')](_0x557584['query'][_0x393a('0x4a')]));_0xa158fb[_0x393a('0x49')]=_0xa158fb['attributes']['length']?_0xa158fb[_0x393a('0x49')]:_0x1b7229['model'];if(!_0x557584['query'][_0x393a('0x70')]('nolimit')){_0xa158fb[_0x393a('0x33')]=qs[_0x393a('0x33')](_0x557584[_0x393a('0x46')][_0x393a('0x33')]);_0xa158fb[_0x393a('0x32')]=qs[_0x393a('0x32')](_0x557584[_0x393a('0x46')][_0x393a('0x32')]);}_0xa158fb['order']=qs['sort'](_0x557584['query'][_0x393a('0x4e')]);_0xa158fb[_0x393a('0x4f')]=qs[_0x393a('0x47')](_[_0x393a('0x50')](_0x557584[_0x393a('0x46')],_0x1b7229['filters']));_0xa158fb[_0x393a('0x4f')][_0x393a('0x67')]=_0x4aa801['id'];if(_0x557584['query'][_0x393a('0x51')]){_0xa158fb['where']=_[_0x393a('0x52')](_0xa158fb[_0x393a('0x4f')],{'$or':_[_0x393a('0x44')](_0xa158fb[_0x393a('0x49')],function(_0x8229e3){var _0x17fc57={};_0x17fc57[_0x8229e3]={'$like':'%'+_0x557584['query'][_0x393a('0x51')]+'%'};return _0x17fc57;})});}if(_0x557584['query'][_0x393a('0xa4')]){var _0x14f3ad=_0x557584[_0x393a('0x46')][_0x393a('0xa4')][_0x393a('0xa5')](',');var _0x2b6e7e={};_0x2b6e7e[_0x14f3ad[0x0]]={'$gte':moment(_0x14f3ad[0x1])[_0x393a('0xa6')](_0x393a('0xa7'))};_0xa158fb[_0x393a('0x4f')]=_['merge'](_0xa158fb[_0x393a('0x4f')],_0x2b6e7e);}_0xa158fb=_[_0x393a('0x52')]({},_0xa158fb,_0x557584['options']);return db[_0x393a('0xa3')][_0x393a('0x31')]({'where':_0xa158fb[_0x393a('0x4f')]})[_0x393a('0x21')](function(_0x127fab){_0x3047ef[_0x393a('0x31')]=_0x127fab;if(_0x557584[_0x393a('0x46')]['includeAll']){_0xa158fb[_0x393a('0x55')]=[{'all':!![]}];}return db[_0x393a('0xa3')][_0x393a('0x56')](_0xa158fb);})[_0x393a('0x21')](function(_0x231886){_0x3047ef['rows']=_0x231886;return _0x3047ef;});}})[_0x393a('0x21')](respondWithFilteredResult(_0x23854e,_0xa158fb))[_0x393a('0x2b')](handleError(_0x23854e,null));};exports[_0x393a('0xa8')]=function(_0x4d925d,_0x1861c5,_0x11ea21){var _0x3a0be0,_0x18570b={},_0x6e5695;if(_0x4d925d[_0x393a('0x5e')]['to']){_0x6e5695=_0x4d925d[_0x393a('0x5e')]['to'][0x0];}return db['FaxAccount'][_0x393a('0x5c')]({'where':{'id':_0x4d925d[_0x393a('0x58')]['id']},'include':[{'model':db[_0x393a('0xa9')],'as':_0x393a('0xaa'),'include':[{'model':db[_0x393a('0x77')],'as':'Contacts','where':{'fax':_0x6e5695},'limit':0x1,'order':[[_0x393a('0x9f'),_0x393a('0xab')]]}]}]})[_0x393a('0x21')](handleEntityNotFound(_0x1861c5,null))[_0x393a('0x21')](function(_0x16389e){_0x3a0be0=_0x16389e;if(_0x4d925d['body'][_0x393a('0xac')]&&_0x4d925d[_0x393a('0x5e')][_0x393a('0xac')][_0x393a('0x4b')]){for(var _0x1c4b91=0x0;_0x1c4b91<_0x4d925d[_0x393a('0x5e')]['attachments']['length'];_0x1c4b91+=0x1){_0x4d925d[_0x393a('0x5e')][_0x393a('0xac')][_0x1c4b91]={'filename':_0x4d925d[_0x393a('0x5e')]['attachments'][_0x1c4b91]['name'],'id':_0x4d925d['body'][_0x393a('0xac')][_0x1c4b91]['id'],'path':path[_0x393a('0xad')](config[_0x393a('0xae')],_0x393a('0xaf'),_0x4d925d[_0x393a('0x5e')][_0x393a('0xac')][_0x1c4b91][_0x393a('0xb0')])};}}return respondWithRpcPromise(_0x393a('0xb1'),_0x393a('0xb1'),{'FaxAccountId':_[_0x393a('0xb2')](_0x4d925d[_0x393a('0x58')]['id'])?undefined:_0x4d925d[_0x393a('0x58')]['id'],'path':_['isNil'](_0x4d925d[_0x393a('0x5e')]['attachments'][0x0][_0x393a('0x5')])?undefined:_0x4d925d[_0x393a('0x5e')]['attachments'][0x0]['path'],'fax':_[_0x393a('0xb2')](_0x4d925d[_0x393a('0x5e')]['to'][0x0])?undefined:_0x4d925d['body']['to'][0x0]},client9002);})[_0x393a('0x21')](function(){if(_0x3a0be0){if(_[_0x393a('0xb2')](_0x4d925d[_0x393a('0x5e')]['from'])){_0x4d925d[_0x393a('0x5e')][_0x393a('0xb3')]=util['format']('\x22%s\x22\x20<%s>',_0x3a0be0[_0x393a('0x3e')],_0x3a0be0[_0x393a('0xb4')]);}if(_0x3a0be0[_0x393a('0xaa')]){if(_0x3a0be0[_0x393a('0xaa')][_0x393a('0xb5')][_0x393a('0x4b')]){return _0x3a0be0[_0x393a('0xaa')][_0x393a('0xb5')][0x0];}else{return db[_0x393a('0x77')][_0x393a('0x5d')](_[_0x393a('0x19')](_0x4d925d[_0x393a('0x5e')],{'firstName':_0x4d925d[_0x393a('0x5e')]['to'][0x0],'phone':_0x4d925d[_0x393a('0x5e')]['to'][0x0],'fax':_0x4d925d['body']['to'][0x0],'ListId':_0x3a0be0[_0x393a('0xa0')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x393a('0xb6'));}})['then'](function(_0x3c0427){if(_0x3c0427){return db[_0x393a('0x74')][_0x393a('0x5c')]({'where':{'ContactId':_0x3c0427['id'],'closed':![],'FaxAccountId':_0x3a0be0['id']}})[_0x393a('0x21')](function(_0x5cb831){if(_0x5cb831){return[_0x5cb831,![]];}return db[_0x393a('0x74')][_0x393a('0x5d')]({'UserId':_0x4d925d[_0x393a('0x5f')]['id'],'ContactId':_0x3c0427['id'],'FaxAccountId':_0x3a0be0['id'],'fax':_0x4d925d['body']['to'][0x0],'firstMsgDirection':_0x393a('0xb7'),'Messages':[_['merge'](_0x4d925d[_0x393a('0x5e')],{'read':![],'body':_0x4d925d[_0x393a('0x5e')]['attachments'][0x0]['filename'],'FaxAccountId':_0x3a0be0['id'],'UserId':_0x4d925d[_0x393a('0x5f')]['id'],'ContactId':_0x3c0427['id'],'AttachmentId':_0x4d925d[_0x393a('0x5e')][_0x393a('0xac')][0x0]['id']})]},{'include':[{'model':db[_0x393a('0xa3')],'as':_0x393a('0xb8')}]})[_0x393a('0x21')](function(_0x49be79){return[_0x49be79,!![]];});});}else{throw new Error(_0x393a('0xb9'));}})[_0x393a('0xba')](function(_0x596d87,_0x56ea72){if(_0x56ea72){return _0x596d87;}return db['FaxMessage'][_0x393a('0x5d')]({'direction':_0x393a('0xb7'),'read':![],'body':_0x4d925d[_0x393a('0x5e')]['attachments'][0x0]['filename'],'FaxAccountId':_0x3a0be0['id'],'FaxInteractionId':_0x596d87['id'],'UserId':_0x4d925d[_0x393a('0x5f')]['id'],'ContactId':_0x596d87[_0x393a('0xbb')],'AttachmentId':_0x4d925d['body'][_0x393a('0xac')][0x0]['id']})['then'](function(_0x13f3f6){_0x596d87[_0x393a('0xbc')][_0x393a('0xb8')]=[];_0x596d87[_0x393a('0xbc')][_0x393a('0xb8')][_0x393a('0x90')](_0x13f3f6['dataValues']);return _0x596d87;});})['then'](function(_0x540fcb){respondWithRpcPromise(_0x393a('0xbd'),_0x393a('0xbd'),{'FaxAccountId':_[_0x393a('0xb2')](_0x4d925d['params']['id'])?undefined:_0x4d925d[_0x393a('0x58')]['id'],'path':_[_0x393a('0xb2')](_0x4d925d['body']['attachments'][0x0][_0x393a('0x5')])?undefined:_0x4d925d[_0x393a('0x5e')][_0x393a('0xac')][0x0]['path'],'fax':_[_0x393a('0xb2')](_0x4d925d[_0x393a('0x5e')]['to'][0x0])?undefined:_0x4d925d[_0x393a('0x5e')]['to'][0x0],'AttachmentId':_0x4d925d[_0x393a('0x5e')][_0x393a('0xac')][0x0]['id']},client9002)[_0x393a('0x21')](function(_0x3ef0ee){logger[_0x393a('0xbe')](_0x393a('0xbf'),_0x3ef0ee);})[_0x393a('0x2b')](function(_0x25c812){logger[_0x393a('0xbe')]('SendFaxRpc,\x20%s',_0x25c812);});return _0x540fcb;})[_0x393a('0x21')](respondWithResult(_0x1861c5,null))[_0x393a('0x2b')](handleError(_0x1861c5,null));};exports[_0x393a('0xc0')]=function(_0x19db57,_0x16dca3,_0x22e7d5){return db[_0x393a('0x40')][_0x393a('0x5c')]({'where':{'id':_0x19db57[_0x393a('0x58')]['id']}})[_0x393a('0x21')](handleEntityNotFound(_0x16dca3,null))[_0x393a('0x21')](function(_0x1c529f){if(_0x1c529f){return _0x1c529f[_0x393a('0xc0')](_0x19db57[_0x393a('0x5e')]['ids'],_['omit'](_0x19db57['body'],[_0x393a('0x6b'),'id'])||{})[_0x393a('0xba')](function(_0x19e992){for(var _0x325c4b=0x0;_0x325c4b<_0x19db57[_0x393a('0x5e')][_0x393a('0x6b')][_0x393a('0x4b')];_0x325c4b+=0x1){socket[_0x393a('0xc1')](_0x393a('0xc2'),{'UserId':Number(_0x19db57['body']['ids'][_0x325c4b]),'FaxAccountId':Number(_0x19db57[_0x393a('0x58')]['id'])});}return _0x19e992;});}})[_0x393a('0x21')](respondWithResult(_0x16dca3,null))[_0x393a('0x2b')](handleError(_0x16dca3,null));};exports[_0x393a('0xc3')]=function(_0xc7e0a2,_0x5afc19,_0x356485){return db['FaxAccount'][_0x393a('0x5c')]({'where':{'id':_0xc7e0a2[_0x393a('0x58')]['id']}})[_0x393a('0x21')](handleEntityNotFound(_0x5afc19,null))['then'](function(_0x3ef8b0){if(_0x3ef8b0){return _0x3ef8b0[_0x393a('0xc3')](_0xc7e0a2[_0x393a('0x46')]['ids'])[_0x393a('0x21')](function(){if(_[_0x393a('0xc4')](_0xc7e0a2['query']['ids'])){for(var _0x53de65=0x0;_0x53de65<_0xc7e0a2['query'][_0x393a('0x6b')][_0x393a('0x4b')];_0x53de65+=0x1){socket['emit'](_0x393a('0xc5'),{'UserId':Number(_0xc7e0a2[_0x393a('0x46')][_0x393a('0x6b')][_0x53de65]),'FaxAccountId':Number(_0xc7e0a2[_0x393a('0x58')]['id'])});}}else{socket[_0x393a('0xc1')](_0x393a('0xc5'),{'UserId':Number(_0xc7e0a2[_0x393a('0x46')][_0x393a('0x6b')]),'FaxAccountId':Number(_0xc7e0a2[_0x393a('0x58')]['id'])});}});}})[_0x393a('0x21')](respondWithStatusCode(_0x5afc19,null))['catch'](handleError(_0x5afc19,null));};exports[_0x393a('0xc6')]=function(_0x3a2180,_0x39451c,_0x4b3b44){var _0x4140dc={};var _0x380fa2={};var _0x379f98;var _0x4c693c;return db[_0x393a('0x40')]['findOne']({'where':{'id':_0x3a2180[_0x393a('0x58')]['id']}})[_0x393a('0x21')](handleEntityNotFound(_0x39451c,null))[_0x393a('0x21')](function(_0x289605){if(_0x289605){_0x379f98=_0x289605;_0x380fa2[_0x393a('0x43')]=_[_0x393a('0x45')](db['User'][_0x393a('0x5b')]);_0x380fa2[_0x393a('0x46')]=_[_0x393a('0x45')](_0x3a2180[_0x393a('0x46')]);_0x380fa2[_0x393a('0x47')]=_[_0x393a('0x48')](_0x380fa2['model'],_0x380fa2[_0x393a('0x46')]);_0x4140dc[_0x393a('0x49')]=_[_0x393a('0x48')](_0x380fa2[_0x393a('0x43')],qs['fields'](_0x3a2180[_0x393a('0x46')][_0x393a('0x4a')]));_0x4140dc[_0x393a('0x49')]=_0x4140dc['attributes'][_0x393a('0x4b')]?_0x4140dc[_0x393a('0x49')]:_0x380fa2[_0x393a('0x43')];_0x4140dc['order']=qs[_0x393a('0x4e')](_0x3a2180[_0x393a('0x46')][_0x393a('0x4e')]);_0x4140dc['where']=qs['filters'](_[_0x393a('0x50')](_0x3a2180[_0x393a('0x46')],_0x380fa2[_0x393a('0x47')]));if(_0x3a2180['query'][_0x393a('0x51')]){_0x4140dc[_0x393a('0x4f')]=_[_0x393a('0x52')](_0x4140dc['where'],{'$or':_['map'](_0x4140dc['attributes'],function(_0x335df0){var _0x5cf9d4={};_0x5cf9d4[_0x335df0]={'$like':'%'+_0x3a2180['query'][_0x393a('0x51')]+'%'};return _0x5cf9d4;})});}_0x4140dc=_[_0x393a('0x52')]({},_0x4140dc,_0x3a2180[_0x393a('0x54')]);return _0x379f98['getAgents'](_0x4140dc);}})[_0x393a('0x21')](function(_0x437663){if(_0x437663){_0x4c693c=_0x437663[_0x393a('0x4b')];if(!_0x3a2180['query'][_0x393a('0x70')](_0x393a('0x4c'))){_0x4140dc[_0x393a('0x33')]=qs[_0x393a('0x33')](_0x3a2180[_0x393a('0x46')][_0x393a('0x33')]);_0x4140dc[_0x393a('0x32')]=qs[_0x393a('0x32')](_0x3a2180[_0x393a('0x46')][_0x393a('0x32')]);}return _0x379f98[_0x393a('0xc6')](_0x4140dc);}})['then'](function(_0x21d63f){if(_0x21d63f){return _0x21d63f?{'count':_0x4c693c,'rows':_0x21d63f}:null;}})[_0x393a('0x21')](respondWithResult(_0x39451c,null))[_0x393a('0x2b')](handleError(_0x39451c,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index d0a8061..ce3c728 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 _0xd3dd=['hasOwnProperty','hook','exports','events','FaxAccount','setMaxListeners','save','update','remove','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd3dd,0x161));var _0xdd3d=function(_0x18518e,_0x2b1ca2){_0x18518e=_0x18518e-0x0;var _0x17e70e=_0xd3dd[_0x18518e];return _0x17e70e;};'use strict';var EventEmitter=require(_0xdd3d('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xdd3d('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xdd3d('0x2')](0x0);var events={'afterCreate':_0xdd3d('0x3'),'afterUpdate':_0xdd3d('0x4'),'afterDestroy':_0xdd3d('0x5')};function emitEvent(_0x496db0){return function(_0x63b36e,_0x37b7af,_0x245b3e){FaxAccountEvents[_0xdd3d('0x6')](_0x496db0+':'+_0x63b36e['id'],_0x63b36e);FaxAccountEvents['emit'](_0x496db0,_0x63b36e);_0x245b3e(null);};}for(var e in events){if(events[_0xdd3d('0x7')](e)){var event=events[e];FaxAccount[_0xdd3d('0x8')](e,emitEvent(event));}}module[_0xdd3d('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xc989=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxAccount','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc989,0x113));var _0x9c98=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc989[_0x3bf83f];return _0x22c4a9;};'use strict';var EventEmitter=require(_0x9c98('0x0'));var FaxAccount=require(_0x9c98('0x1'))['db'][_0x9c98('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9c98('0x3'),'afterUpdate':_0x9c98('0x4'),'afterDestroy':_0x9c98('0x5')};function emitEvent(_0x4e29ef){return function(_0x129986,_0xb97693,_0x3b64df){FaxAccountEvents[_0x9c98('0x6')](_0x4e29ef+':'+_0x129986['id'],_0x129986);FaxAccountEvents[_0x9c98('0x6')](_0x4e29ef,_0x129986);_0x3b64df(null);};}for(var e in events){if(events[_0x9c98('0x7')](e)){var event=events[e];FaxAccount[_0x9c98('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 96fe94e..10ab2fe 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 _0xbd9d=['rimraf','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','lodash','util','moment','bluebird','request-promise','path'];(function(_0x1340de,_0x5d124b){var _0x58c905=function(_0x3c93b3){while(--_0x3c93b3){_0x1340de['push'](_0x1340de['shift']());}};_0x58c905(++_0x5d124b);}(_0xbd9d,0x1aa));var _0xdbd9=function(_0x273399,_0x3bb652){_0x273399=_0x273399-0x0;var _0xdba7ff=_0xbd9d[_0x273399];return _0xdba7ff;};'use strict';var _=require(_0xdbd9('0x0'));var util=require(_0xdbd9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdbd9('0x2'));var BPromise=require(_0xdbd9('0x3'));var rp=require(_0xdbd9('0x4'));var fs=require('fs');var path=require(_0xdbd9('0x5'));var rimraf=require(_0xdbd9('0x6'));var config=require(_0xdbd9('0x7'));var attributes=require(_0xdbd9('0x8'));module[_0xdbd9('0x9')]=function(_0x222ba5,_0x5068ff){return _0x222ba5[_0xdbd9('0xa')](_0xdbd9('0xb'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaaa5=['request-promise','path','rimraf','../../config/environment','exports','define','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaaa5,0xd7));var _0x5aaa=function(_0x5606fe,_0x12f636){_0x5606fe=_0x5606fe-0x0;var _0x3afaa5=_0xaaa5[_0x5606fe];return _0x3afaa5;};'use strict';var _=require(_0x5aaa('0x0'));var util=require(_0x5aaa('0x1'));var logger=require(_0x5aaa('0x2'))(_0x5aaa('0x3'));var moment=require(_0x5aaa('0x4'));var BPromise=require(_0x5aaa('0x5'));var rp=require(_0x5aaa('0x6'));var fs=require('fs');var path=require(_0x5aaa('0x7'));var rimraf=require(_0x5aaa('0x8'));var config=require(_0x5aaa('0x9'));var attributes=require('./faxAccount.attributes');module[_0x5aaa('0xa')]=function(_0x49c006,_0x178159){return _0x49c006[_0x5aaa('0xb')]('FaxAccount',attributes,{'tableName':_0x5aaa('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 ec683d6..c63fae2 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 _0x63e2=['error','code','message','result','catch','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','Contacts','DESC','Applications','get','list','applications','priority','asc','length','contact','FaxInteraction','create','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','name','agent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','defaults','localhost','socket.io-emitter','redis','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2eea9a,_0x368daf){var _0x1ec61e=function(_0x1fc2fc){while(--_0x1fc2fc){_0x2eea9a['push'](_0x2eea9a['shift']());}};_0x1ec61e(++_0x368daf);}(_0x63e2,0x1a2));var _0x263e=function(_0x5283d4,_0x134a3b){_0x5283d4=_0x5283d4-0x0;var _0x2d0300=_0x63e2[_0x5283d4];return _0x2d0300;};'use strict';var _=require(_0x263e('0x0'));var util=require(_0x263e('0x1'));var moment=require('moment');var BPromise=require(_0x263e('0x2'));var rs=require(_0x263e('0x3'));var fs=require('fs');var Redis=require(_0x263e('0x4'));var db=require(_0x263e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x263e('0x6'));var config=require(_0x263e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x263e('0x8')]({'port':0x232c});config['redis']=_[_0x263e('0x9')](config['redis'],{'host':_0x263e('0xa'),'port':0x18eb});var socket=require(_0x263e('0xb'))(new Redis(config[_0x263e('0xc')]));require(_0x263e('0xd'))['register'](socket);function respondWithRpcPromise(_0x49bc7b,_0xbc8c99,_0x332e4d){return new BPromise(function(_0x424c76,_0x18e557){return client[_0x263e('0xe')](_0x49bc7b,_0x332e4d)[_0x263e('0xf')](function(_0x1488cf){logger[_0x263e('0x10')](_0x263e('0x11'),_0xbc8c99,_0x263e('0x12'));logger[_0x263e('0x13')](_0x263e('0x14'),_0xbc8c99,'request\x20sent',JSON[_0x263e('0x15')](_0x1488cf));if(_0x1488cf[_0x263e('0x16')]){if(_0x1488cf[_0x263e('0x16')][_0x263e('0x17')]===0x1f4){logger[_0x263e('0x16')](_0x263e('0x11'),_0xbc8c99,_0x1488cf[_0x263e('0x16')]['message']);return _0x18e557(_0x1488cf['error'][_0x263e('0x18')]);}logger[_0x263e('0x16')](_0x263e('0x11'),_0xbc8c99,_0x1488cf[_0x263e('0x16')][_0x263e('0x18')]);return _0x424c76(_0x1488cf['error'][_0x263e('0x18')]);}else{logger['info'](_0x263e('0x11'),_0xbc8c99,'request\x20sent');_0x424c76(_0x1488cf[_0x263e('0x19')][_0x263e('0x18')]);}})[_0x263e('0x1a')](function(_0x3c78fb){logger['error'](_0x263e('0x11'),_0xbc8c99,_0x3c78fb);_0x18e557(_0x3c78fb);});});}exports['GetFaxAccount']=function(_0x4a2fe0){var _0x50f7bb=this;return new Promise(function(_0x1e7b15,_0x5f1c05){return db[_0x263e('0x1b')][_0x263e('0x1c')]({'raw':_0x4a2fe0['options']?_0x4a2fe0[_0x263e('0x1d')][_0x263e('0x1e')]===undefined?!![]:![]:!![],'where':_0x4a2fe0[_0x263e('0x1d')]?_0x4a2fe0['options'][_0x263e('0x1f')]||null:null,'attributes':_0x4a2fe0['options']?_0x4a2fe0[_0x263e('0x1d')][_0x263e('0x20')]||null:null,'limit':_0x4a2fe0['options']?_0x4a2fe0['options'][_0x263e('0x21')]||null:null,'include':_0x4a2fe0[_0x263e('0x1d')]?_0x4a2fe0[_0x263e('0x1d')][_0x263e('0x22')]?_[_0x263e('0x23')](_0x4a2fe0[_0x263e('0x1d')][_0x263e('0x22')],function(_0x15889d){return{'model':db[_0x15889d[_0x263e('0x24')]],'as':_0x15889d['as'],'attributes':_0x15889d[_0x263e('0x20')],'include':_0x15889d[_0x263e('0x22')]?_[_0x263e('0x23')](_0x15889d['include'],function(_0x1b1f10){return{'model':db[_0x1b1f10['model']],'as':_0x1b1f10['as'],'attributes':_0x1b1f10[_0x263e('0x20')],'include':_0x1b1f10[_0x263e('0x22')]?_[_0x263e('0x23')](_0x1b1f10['include'],function(_0xdf386e){return{'model':db[_0xdf386e['model']],'as':_0xdf386e['as'],'attributes':_0xdf386e[_0x263e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x263e('0xf')](function(_0x4f23bd){logger[_0x263e('0x10')](_0x263e('0x25'),_0x4a2fe0);logger['debug']('GetFaxAccount',_0x4a2fe0,JSON[_0x263e('0x15')](_0x4f23bd));_0x1e7b15(_0x4f23bd);})[_0x263e('0x1a')](function(_0x36a821){logger[_0x263e('0x16')](_0x263e('0x25'),_0x36a821[_0x263e('0x18')],_0x4a2fe0);_0x5f1c05(_0x50f7bb[_0x263e('0x16')](0x1f4,_0x36a821[_0x263e('0x18')]));});});};exports['NotifyFaxAccount']=function(_0x15f4fb,_0x11f050,_0x442b93){var _0x35ecda=this;return new Promise(function(_0x53869c,_0xc56808){var _0x17d5f8={'body':_0x15f4fb[_0x263e('0x26')],'channel':_0x263e('0x27')};var _0x1f34d5=[];var _0x3116c9=[];var _0x29e027={};return db[_0x263e('0x28')][_0x263e('0x29')]()[_0x263e('0xf')](function(_0x5410eb){if(!_0x5410eb){throw new db['Sequelize'][(_0x263e('0x2a'))](_0x263e('0x2b'));}_0x1f34d5=_[_0x263e('0x2c')](_['keys'](_0x5410eb),[_0x263e('0x2d'),_0x263e('0x2e')]);_0x3116c9=_[_0x263e('0x2c')](_['keys'](_0x5410eb),[_0x263e('0x2d'),_0x263e('0x2e'),_0x263e('0x2f'),_0x263e('0x30')]);if(_0x15f4fb[_0x263e('0x26')]['id']){delete _0x15f4fb['body']['id'];}if(_[_0x263e('0x31')](_0x15f4fb[_0x263e('0x26')][_0x263e('0x32')])){throw new db[(_0x263e('0x33'))][(_0x263e('0x2a'))](_0x263e('0x34'));}if(_[_0x263e('0x31')](_0x15f4fb['body']['body'])||_0x15f4fb[_0x263e('0x26')][_0x263e('0x26')]===''){throw new db[(_0x263e('0x33'))][(_0x263e('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x15f4fb[_0x263e('0x26')][_0x263e('0x35')])){throw new db[(_0x263e('0x33'))][(_0x263e('0x2a'))](_0x263e('0x36')+_0x3116c9);}if(!_[_0x263e('0x37')](_0x3116c9,_0x15f4fb[_0x263e('0x26')][_0x263e('0x35')])){throw new db[(_0x263e('0x33'))][(_0x263e('0x2a'))](_0x263e('0x38')+_0x3116c9);}_0x29e027[_0x15f4fb[_0x263e('0x26')][_0x263e('0x35')]]=_0x15f4fb[_0x263e('0x26')][_0x263e('0x32')];})[_0x263e('0xf')](function(){return db[_0x263e('0x1b')][_0x263e('0x39')]({'where':{'id':_0x15f4fb[_0x263e('0x3a')]['id']},'include':[{'model':db['CmList'],'as':_0x263e('0x3b'),'include':[{'model':db[_0x263e('0x28')],'as':_0x263e('0x3c'),'where':_0x29e027,'limit':0x1,'order':[[_0x263e('0x2e'),_0x263e('0x3d')]]}]},{'model':db['FaxApplication'],'as':_0x263e('0x3e')}]});})[_0x263e('0xf')](function(_0x48026b){if(_0x48026b&&_0x48026b[_0x263e('0x3b')]){var _0x264582=_0x48026b[_0x263e('0x3f')]({'plain':!![]});_0x17d5f8[_0x263e('0x3a')]=_0x264582;_0x17d5f8['applications']=_0x264582[_0x263e('0x3e')];_0x17d5f8[_0x263e('0x40')]=_0x264582[_0x263e('0x3b')];_0x17d5f8[_0x263e('0x41')]=_['orderBy'](_0x17d5f8[_0x263e('0x41')],[_0x263e('0x42')],[_0x263e('0x43')]);if(_0x17d5f8[_0x263e('0x3a')]['Applications']){delete _0x17d5f8[_0x263e('0x3a')][_0x263e('0x3e')];}if(_0x17d5f8[_0x263e('0x3a')]['List']&&_0x17d5f8[_0x263e('0x3a')][_0x263e('0x3b')][_0x263e('0x3c')][_0x263e('0x44')]){return _0x17d5f8[_0x263e('0x3a')]['List'][_0x263e('0x3c')][0x0];}var _0x34280d=_[_0x263e('0x9')](_0x15f4fb[_0x263e('0x26')],{'firstName':_0x15f4fb[_0x263e('0x26')][_0x263e('0x32')],'ListId':_0x264582[_0x263e('0x30')]});_0x34280d[_0x15f4fb[_0x263e('0x26')]['mapKey']]=_0x15f4fb[_0x263e('0x26')][_0x263e('0x32')];return db[_0x263e('0x28')]['create'](_0x34280d,{'fields':_0x1f34d5,'raw':!![]});}})[_0x263e('0xf')](function(_0x53215b){_0x17d5f8[_0x263e('0x45')]=_0x53215b;if(_0x53215b){var _0x10beb={'ContactId':_0x53215b['id'],'FaxAccountId':_0x15f4fb[_0x263e('0x3a')]['id'],'fax':_0x53215b[_0x263e('0x27')]};return db[_0x263e('0x46')][_0x263e('0x39')]({'where':{'ContactId':_0x53215b['id'],'closed':![],'FaxAccountId':_0x15f4fb['account']['id']}})[_0x263e('0xf')](function(_0x339f0a){if(_0x339f0a){return[_0x339f0a,![]];}return db[_0x263e('0x46')][_0x263e('0x47')](_0x10beb)[_0x263e('0xf')](function(_0x49a096){return[_0x49a096,!![]];});});}else{throw new Error(_0x263e('0x48'));}})[_0x263e('0x49')](function(_0x431982,_0xfb7667){var _0x3f3079=_0x431982[_0x263e('0x3f')]({'plain':!![]});if(_0xfb7667){if(_0x17d5f8[_0x263e('0x3a')][_0x263e('0x4a')]){_0x17d5f8['applications'][_0x263e('0x4b')]({'id':0x0,'priority':_0x17d5f8[_0x263e('0x41')]['length']+0x1,'app':_0x263e('0x4c'),'appdata':'unmanaged','interval':_0x263e('0x4d')});}_0x3f3079[_0x263e('0x4e')]=!![];}else{_0x3f3079['created']=![];}_0x17d5f8[_0x263e('0x4f')]=_0x3f3079;return db[_0x263e('0x50')][_0x263e('0x47')]({'body':_0x15f4fb[_0x263e('0x26')]['body'],'FaxAccountId':_0x15f4fb[_0x263e('0x3a')]['id'],'FaxInteractionId':_0x431982['id'],'direction':'in','ContactId':_0x431982[_0x263e('0x51')],'AttachmentId':_0x15f4fb['body'][_0x263e('0x52')]});})[_0x263e('0xf')](function(_0x2a6c92){_0x17d5f8[_0x263e('0x18')]=_0x2a6c92;if(_0x17d5f8[_0x263e('0x4f')][_0x263e('0x53')]){return db['User']['find']({'attributes':['id',_0x263e('0x54')],'where':{'id':_0x17d5f8[_0x263e('0x4f')]['UserId']}})[_0x263e('0xf')](function(_0x5e7275){if(_0x5e7275){_0x17d5f8[_0x263e('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':_0x263e('0x55'),'appdata':_0x5e7275['name']+','+(_0x17d5f8[_0x263e('0x3a')]['waitForTheAssignedAgent']||0xa),'interval':_0x263e('0x4d')});}return respondWithRpcPromise(_0x263e('0x56'),_0x263e('0x57'),_0x17d5f8);});}return respondWithRpcPromise(_0x263e('0x56'),'startRouting',_0x17d5f8);})['then'](function(_0xae43a8){_0x53869c(_0xae43a8);})['catch'](function(_0x123b82){_0xc56808(_0x35ecda[_0x263e('0x16')](0x1f4,_0x123b82['message']));});});}; \ No newline at end of file +var _0xc445=['List','Contacts','updatedAt','DESC','FaxApplication','get','applications','Applications','orderBy','priority','asc','length','create','contact','FaxInteraction','Contact\x20not\x20found','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','limit','include','model','attributes','map','stringify','NotifyFaxAccount','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','Sequelize','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account'];(function(_0x3d1ed7,_0xe18d25){var _0x539ac8=function(_0x179136){while(--_0x179136){_0x3d1ed7['push'](_0x3d1ed7['shift']());}};_0x539ac8(++_0xe18d25);}(_0xc445,0xc8));var _0x5c44=function(_0x310d10,_0x3fe887){_0x310d10=_0x310d10-0x0;var _0x1fb8af=_0xc445[_0x310d10];return _0x1fb8af;};'use strict';var _=require(_0x5c44('0x0'));var util=require(_0x5c44('0x1'));var moment=require('moment');var BPromise=require(_0x5c44('0x2'));var rs=require(_0x5c44('0x3'));var fs=require('fs');var Redis=require(_0x5c44('0x4'));var db=require(_0x5c44('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5c44('0x6'))(_0x5c44('0x7'));var config=require(_0x5c44('0x8'));var jayson=require(_0x5c44('0x9'));var client=jayson[_0x5c44('0xa')][_0x5c44('0xb')]({'port':0x232c});config[_0x5c44('0xc')]=_['defaults'](config[_0x5c44('0xc')],{'host':_0x5c44('0xd'),'port':0x18eb});var socket=require(_0x5c44('0xe'))(new Redis(config[_0x5c44('0xc')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x16182e,_0x2c1da5,_0x5bc4d4){return new BPromise(function(_0x38e49c,_0x160c6b){return client[_0x5c44('0xf')](_0x16182e,_0x5bc4d4)[_0x5c44('0x10')](function(_0x5dde69){logger[_0x5c44('0x11')]('FaxAccount,\x20%s,\x20%s',_0x2c1da5,_0x5c44('0x12'));logger[_0x5c44('0x13')](_0x5c44('0x14'),_0x2c1da5,_0x5c44('0x12'),JSON['stringify'](_0x5dde69));if(_0x5dde69[_0x5c44('0x15')]){if(_0x5dde69[_0x5c44('0x15')][_0x5c44('0x16')]===0x1f4){logger[_0x5c44('0x15')](_0x5c44('0x17'),_0x2c1da5,_0x5dde69[_0x5c44('0x15')][_0x5c44('0x18')]);return _0x160c6b(_0x5dde69[_0x5c44('0x15')][_0x5c44('0x18')]);}logger[_0x5c44('0x15')](_0x5c44('0x17'),_0x2c1da5,_0x5dde69[_0x5c44('0x15')][_0x5c44('0x18')]);return _0x38e49c(_0x5dde69[_0x5c44('0x15')][_0x5c44('0x18')]);}else{logger[_0x5c44('0x11')](_0x5c44('0x17'),_0x2c1da5,_0x5c44('0x12'));_0x38e49c(_0x5dde69['result'][_0x5c44('0x18')]);}})[_0x5c44('0x19')](function(_0x11bba5){logger[_0x5c44('0x15')](_0x5c44('0x17'),_0x2c1da5,_0x11bba5);_0x160c6b(_0x11bba5);});});}exports[_0x5c44('0x1a')]=function(_0x134ec0){var _0x387082=this;return new Promise(function(_0x176c72,_0xb456d5){return db[_0x5c44('0x1b')][_0x5c44('0x1c')]({'raw':_0x134ec0[_0x5c44('0x1d')]?_0x134ec0[_0x5c44('0x1d')][_0x5c44('0x1e')]===undefined?!![]:![]:!![],'where':_0x134ec0[_0x5c44('0x1d')]?_0x134ec0[_0x5c44('0x1d')][_0x5c44('0x1f')]||null:null,'attributes':_0x134ec0[_0x5c44('0x1d')]?_0x134ec0[_0x5c44('0x1d')]['attributes']||null:null,'limit':_0x134ec0[_0x5c44('0x1d')]?_0x134ec0[_0x5c44('0x1d')][_0x5c44('0x20')]||null:null,'include':_0x134ec0[_0x5c44('0x1d')]?_0x134ec0['options']['include']?_['map'](_0x134ec0[_0x5c44('0x1d')][_0x5c44('0x21')],function(_0x301c8a){return{'model':db[_0x301c8a[_0x5c44('0x22')]],'as':_0x301c8a['as'],'attributes':_0x301c8a['attributes'],'include':_0x301c8a[_0x5c44('0x21')]?_['map'](_0x301c8a['include'],function(_0x36975e){return{'model':db[_0x36975e[_0x5c44('0x22')]],'as':_0x36975e['as'],'attributes':_0x36975e[_0x5c44('0x23')],'include':_0x36975e['include']?_[_0x5c44('0x24')](_0x36975e['include'],function(_0x39c3e2){return{'model':db[_0x39c3e2['model']],'as':_0x39c3e2['as'],'attributes':_0x39c3e2[_0x5c44('0x23')]};}):[]};}):[]};}):[]:[]})[_0x5c44('0x10')](function(_0x2adb8d){logger[_0x5c44('0x11')](_0x5c44('0x1a'),_0x134ec0);logger[_0x5c44('0x13')](_0x5c44('0x1a'),_0x134ec0,JSON[_0x5c44('0x25')](_0x2adb8d));_0x176c72(_0x2adb8d);})[_0x5c44('0x19')](function(_0x122da5){logger[_0x5c44('0x15')]('GetFaxAccount',_0x122da5[_0x5c44('0x18')],_0x134ec0);_0xb456d5(_0x387082[_0x5c44('0x15')](0x1f4,_0x122da5['message']));});});};exports[_0x5c44('0x26')]=function(_0x11fdff,_0x130f6b,_0x42d1ef){var _0x4d619c=this;return new Promise(function(_0x178240,_0x4ea998){var _0x3a6c39={'body':_0x11fdff[_0x5c44('0x27')],'channel':_0x5c44('0x28')};var _0xa0e00b=[];var _0x5bd20b=[];var _0x3b302b={};return db[_0x5c44('0x29')][_0x5c44('0x2a')]()[_0x5c44('0x10')](function(_0x1cf582){if(!_0x1cf582){throw new db['Sequelize'][(_0x5c44('0x2b'))](_0x5c44('0x2c'));}_0xa0e00b=_[_0x5c44('0x2d')](_['keys'](_0x1cf582),[_0x5c44('0x2e'),'updatedAt']);_0x5bd20b=_[_0x5c44('0x2d')](_['keys'](_0x1cf582),['createdAt','updatedAt',_0x5c44('0x2f'),_0x5c44('0x30')]);if(_0x11fdff[_0x5c44('0x27')]['id']){delete _0x11fdff[_0x5c44('0x27')]['id'];}if(_['isNil'](_0x11fdff[_0x5c44('0x27')]['from'])){throw new db[(_0x5c44('0x31'))][(_0x5c44('0x2b'))]('from\x20is\x20mandatory');}if(_[_0x5c44('0x32')](_0x11fdff['body']['body'])||_0x11fdff[_0x5c44('0x27')]['body']===''){throw new db['Sequelize'][(_0x5c44('0x2b'))](_0x5c44('0x33'));}if(_[_0x5c44('0x32')](_0x11fdff['body']['mapKey'])){throw new db[(_0x5c44('0x31'))][(_0x5c44('0x2b'))](_0x5c44('0x34')+_0x5bd20b);}if(!_['includes'](_0x5bd20b,_0x11fdff[_0x5c44('0x27')][_0x5c44('0x35')])){throw new db[(_0x5c44('0x31'))][(_0x5c44('0x2b'))](_0x5c44('0x36')+_0x5bd20b);}_0x3b302b[_0x11fdff[_0x5c44('0x27')][_0x5c44('0x35')]]=_0x11fdff[_0x5c44('0x27')][_0x5c44('0x37')];})[_0x5c44('0x10')](function(){return db[_0x5c44('0x1b')][_0x5c44('0x38')]({'where':{'id':_0x11fdff[_0x5c44('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0x5c44('0x3a'),'include':[{'model':db['CmContact'],'as':_0x5c44('0x3b'),'where':_0x3b302b,'limit':0x1,'order':[[_0x5c44('0x3c'),_0x5c44('0x3d')]]}]},{'model':db[_0x5c44('0x3e')],'as':'Applications'}]});})[_0x5c44('0x10')](function(_0x2ecc69){if(_0x2ecc69&&_0x2ecc69[_0x5c44('0x3a')]){var _0x55b428=_0x2ecc69[_0x5c44('0x3f')]({'plain':!![]});_0x3a6c39[_0x5c44('0x39')]=_0x55b428;_0x3a6c39[_0x5c44('0x40')]=_0x55b428[_0x5c44('0x41')];_0x3a6c39['list']=_0x55b428['List'];_0x3a6c39[_0x5c44('0x40')]=_[_0x5c44('0x42')](_0x3a6c39[_0x5c44('0x40')],[_0x5c44('0x43')],[_0x5c44('0x44')]);if(_0x3a6c39['account'][_0x5c44('0x41')]){delete _0x3a6c39[_0x5c44('0x39')][_0x5c44('0x41')];}if(_0x3a6c39[_0x5c44('0x39')][_0x5c44('0x3a')]&&_0x3a6c39[_0x5c44('0x39')]['List'][_0x5c44('0x3b')][_0x5c44('0x45')]){return _0x3a6c39[_0x5c44('0x39')][_0x5c44('0x3a')][_0x5c44('0x3b')][0x0];}var _0x45b6d0=_['defaults'](_0x11fdff[_0x5c44('0x27')],{'firstName':_0x11fdff['body'][_0x5c44('0x37')],'ListId':_0x55b428[_0x5c44('0x30')]});_0x45b6d0[_0x11fdff[_0x5c44('0x27')][_0x5c44('0x35')]]=_0x11fdff[_0x5c44('0x27')][_0x5c44('0x37')];return db[_0x5c44('0x29')][_0x5c44('0x46')](_0x45b6d0,{'fields':_0xa0e00b,'raw':!![]});}})[_0x5c44('0x10')](function(_0x543ca6){_0x3a6c39[_0x5c44('0x47')]=_0x543ca6;if(_0x543ca6){var _0x165fcc={'ContactId':_0x543ca6['id'],'FaxAccountId':_0x11fdff['account']['id'],'fax':_0x543ca6['fax']};return db['FaxInteraction'][_0x5c44('0x38')]({'where':{'ContactId':_0x543ca6['id'],'closed':![],'FaxAccountId':_0x11fdff[_0x5c44('0x39')]['id']}})['then'](function(_0x2c901d){if(_0x2c901d){return[_0x2c901d,![]];}return db[_0x5c44('0x48')][_0x5c44('0x46')](_0x165fcc)[_0x5c44('0x10')](function(_0x2e417d){return[_0x2e417d,!![]];});});}else{throw new Error(_0x5c44('0x49'));}})['spread'](function(_0x197ee6,_0x463405){var _0x3aafa3=_0x197ee6['get']({'plain':!![]});if(_0x463405){if(_0x3a6c39[_0x5c44('0x39')]['autoclose']){_0x3a6c39[_0x5c44('0x40')]['push']({'id':0x0,'priority':_0x3a6c39[_0x5c44('0x40')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x5c44('0x4a')});}_0x3aafa3[_0x5c44('0x4b')]=!![];}else{_0x3aafa3['created']=![];}_0x3a6c39[_0x5c44('0x4c')]=_0x3aafa3;return db[_0x5c44('0x4d')][_0x5c44('0x46')]({'body':_0x11fdff['body']['body'],'FaxAccountId':_0x11fdff[_0x5c44('0x39')]['id'],'FaxInteractionId':_0x197ee6['id'],'direction':'in','ContactId':_0x197ee6['ContactId'],'AttachmentId':_0x11fdff[_0x5c44('0x27')][_0x5c44('0x4e')]});})['then'](function(_0x2e1bad){_0x3a6c39[_0x5c44('0x18')]=_0x2e1bad;if(_0x3a6c39['interaction'][_0x5c44('0x4f')]){return db[_0x5c44('0x50')]['find']({'attributes':['id',_0x5c44('0x51')],'where':{'id':_0x3a6c39[_0x5c44('0x4c')][_0x5c44('0x4f')]}})[_0x5c44('0x10')](function(_0x20db48){if(_0x20db48){_0x3a6c39['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x5c44('0x52'),'appdata':_0x20db48['name']+','+(_0x3a6c39[_0x5c44('0x39')][_0x5c44('0x53')]||0xa),'interval':_0x5c44('0x4a')});}return respondWithRpcPromise(_0x5c44('0x54'),_0x5c44('0x55'),_0x3a6c39);});}return respondWithRpcPromise(_0x5c44('0x54'),'startRouting',_0x3a6c39);})[_0x5c44('0x10')](function(_0x10fc3e){_0x178240(_0x10fc3e);})[_0x5c44('0x19')](function(_0x1cf2f1){_0x4ea998(_0x4d619c['error'](0x1f4,_0x1cf2f1[_0x5c44('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index fe682bc..c7c10ae 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 _0x91c5=['register','length','faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener'];(function(_0x3304bf,_0xa956d6){var _0x3585c1=function(_0x5d80f1){while(--_0x5d80f1){_0x3304bf['push'](_0x3304bf['shift']());}};_0x3585c1(++_0xa956d6);}(_0x91c5,0x1a1));var _0x591c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x91c5[_0x14add3];return _0x4a174f;};'use strict';var FaxAccountEvents=require(_0x591c('0x0'));var events=[_0x591c('0x1'),_0x591c('0x2'),_0x591c('0x3')];function createListener(_0x453db7,_0x4d5e1b){return function(_0x31cb8c){_0x4d5e1b[_0x591c('0x4')](_0x453db7,_0x31cb8c);};}function removeListener(_0x102193,_0xe9b71e){return function(){FaxAccountEvents[_0x591c('0x5')](_0x102193,_0xe9b71e);};}exports[_0x591c('0x6')]=function(_0x36391a){for(var _0xb6e623=0x0,_0x54256b=events[_0x591c('0x7')];_0xb6e623<_0x54256b;_0xb6e623++){var _0x16e362=events[_0xb6e623];var _0x2478e0=createListener(_0x591c('0x8')+_0x16e362,_0x36391a);FaxAccountEvents['on'](_0x16e362,_0x2478e0);}}; \ No newline at end of file +var _0xd348=['./faxAccount.events','save','emit','register','length','faxAccount:'];(function(_0x435b35,_0x34a430){var _0x35ed54=function(_0x3508df){while(--_0x3508df){_0x435b35['push'](_0x435b35['shift']());}};_0x35ed54(++_0x34a430);}(_0xd348,0x120));var _0x8d34=function(_0x2627bf,_0x13a2c8){_0x2627bf=_0x2627bf-0x0;var _0x553e6f=_0xd348[_0x2627bf];return _0x553e6f;};'use strict';var FaxAccountEvents=require(_0x8d34('0x0'));var events=[_0x8d34('0x1'),'remove','update'];function createListener(_0x4e4686,_0x34cb09){return function(_0x200110){_0x34cb09[_0x8d34('0x2')](_0x4e4686,_0x200110);};}function removeListener(_0x44ab85,_0x24cca2){return function(){FaxAccountEvents['removeListener'](_0x44ab85,_0x24cca2);};}exports[_0x8d34('0x3')]=function(_0x20bda8){for(var _0x157383=0x0,_0x1ff49d=events[_0x8d34('0x4')];_0x157383<_0x1ff49d;_0x157383++){var _0x507725=events[_0x157383];var _0x5381a5=createListener(_0x8d34('0x5')+_0x507725,_0x20bda8);FaxAccountEvents['on'](_0x507725,_0x5381a5);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9716729..4120789 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(_0x49f166,_0xf61194){var _0x250d51=function(_0x3b65ec){while(--_0x3b65ec){_0x49f166['push'](_0x49f166['shift']());}};_0x250d51(++_0xf61194);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x53c84b,_0x2bc741){var _0x5cbf89=function(_0xd5a260){while(--_0xd5a260){_0x53c84b['push'](_0x53c84b['shift']());}};_0x5cbf89(++_0x2bc741);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 a3ea91e..6fa52f2 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 _0xefa4=['TEXT','STRING','*,*,*,*','exports'];(function(_0xf35ebb,_0x485148){var _0x5546f0=function(_0x53295f){while(--_0x53295f){_0xf35ebb['push'](_0xf35ebb['shift']());}};_0x5546f0(++_0x485148);}(_0xefa4,0x9b));var _0x4efa=function(_0x374d9d,_0x5208eb){_0x374d9d=_0x374d9d-0x0;var _0x2c83c3=_0xefa4[_0x374d9d];return _0x2c83c3;};'use strict';var Sequelize=require('sequelize');module[_0x4efa('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4efa('0x1')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4efa('0x2')],'defaultValue':_0x4efa('0x3')}}; \ No newline at end of file +var _0xa941=['exports','INTEGER','STRING','noop','TEXT'];(function(_0x197753,_0x1e46cc){var _0x3ce421=function(_0x1eeabe){while(--_0x1eeabe){_0x197753['push'](_0x197753['shift']());}};_0x3ce421(++_0x1e46cc);}(_0xa941,0x15e));var _0x1a94=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa941[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require('sequelize');module[_0x1a94('0x0')]={'priority':{'type':Sequelize[_0x1a94('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x1a94('0x2')],'allowNull':![],'defaultValue':_0x1a94('0x3')},'appdata':{'type':Sequelize[_0x1a94('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 5a865d1..9ccd01d 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 _0x3703=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','include','findAll','show','params','keys','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','type','key','model','query','intersection'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x3703,0x144));var _0x3370=function(_0x2bfe52,_0x43946e){_0x2bfe52=_0x2bfe52-0x0;var _0x1cf649=_0x3703[_0x2bfe52];return _0x1cf649;};'use strict';var emlformat=require(_0x3370('0x0'));var rimraf=require(_0x3370('0x1'));var zipdir=require(_0x3370('0x2'));var jsonpatch=require(_0x3370('0x3'));var rp=require('request-promise');var moment=require(_0x3370('0x4'));var BPromise=require(_0x3370('0x5'));var Mustache=require(_0x3370('0x6'));var util=require(_0x3370('0x7'));var path=require(_0x3370('0x8'));var sox=require(_0x3370('0x9'));var csv=require('to-csv');var ejs=require(_0x3370('0xa'));var fs=require('fs');var fs_extra=require(_0x3370('0xb'));var _=require(_0x3370('0xc'));var squel=require(_0x3370('0xd'));var crypto=require(_0x3370('0xe'));var jsforce=require(_0x3370('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3370('0x10'));var querystring=require(_0x3370('0x11'));var Papa=require('papaparse');var Redis=require(_0x3370('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3370('0x13'));var as=require(_0x3370('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3370('0x15'))(_0x3370('0x16'));var utils=require('../../config/utils');var config=require(_0x3370('0x17'));var licenseUtil=require(_0x3370('0x18'));var db=require(_0x3370('0x19'))['db'];function respondWithStatusCode(_0x5b53e7,_0xd567de){_0xd567de=_0xd567de||0xcc;return function(_0x306966){if(_0x306966){return _0x5b53e7['sendStatus'](_0xd567de);}return _0x5b53e7[_0x3370('0x1a')](_0xd567de)[_0x3370('0x1b')]();};}function respondWithResult(_0x4262d9,_0xd14e9c){_0xd14e9c=_0xd14e9c||0xc8;return function(_0x1775d7){if(_0x1775d7){return _0x4262d9['status'](_0xd14e9c)[_0x3370('0x1c')](_0x1775d7);}};}function respondWithFilteredResult(_0x1fa70d,_0x549358){return function(_0x26782c){if(_0x26782c){var _0x3625f7=typeof _0x549358[_0x3370('0x1d')]===_0x3370('0x1e')&&typeof _0x549358['limit']===_0x3370('0x1e');var _0x5c7971=_0x26782c['count'];var _0x3a6b2e=_0x3625f7?0x0:_0x549358['offset'];var _0x14031c=_0x3625f7?_0x26782c[_0x3370('0x1f')]:_0x549358['offset']+_0x549358[_0x3370('0x20')];var _0xdf55e1;if(_0x14031c>=_0x5c7971){_0x14031c=_0x5c7971;_0xdf55e1=0xc8;}else{_0xdf55e1=0xce;}_0x1fa70d[_0x3370('0x1a')](_0xdf55e1);return _0x1fa70d['set'](_0x3370('0x21'),_0x3a6b2e+'-'+_0x14031c+'/'+_0x5c7971)[_0x3370('0x1c')](_0x26782c);}return null;};}function patchUpdates(_0x255d55){return function(_0x5d0516){try{jsonpatch[_0x3370('0x22')](_0x5d0516,_0x255d55,!![]);}catch(_0x1dfbe8){return BPromise['reject'](_0x1dfbe8);}return _0x5d0516['save']();};}function saveUpdates(_0x575723,_0x5fb247){return function(_0x10812c){if(_0x10812c){return _0x10812c[_0x3370('0x23')](_0x575723)[_0x3370('0x24')](function(_0x513025){return _0x513025;});}return null;};}function removeEntity(_0x1e989c,_0x4e4aed){return function(_0x43f0a1){if(_0x43f0a1){return _0x43f0a1[_0x3370('0x25')]()[_0x3370('0x24')](function(){_0x1e989c['status'](0xcc)[_0x3370('0x1b')]();});}};}function handleEntityNotFound(_0x4a7f6b,_0x136c32){return function(_0x55a7e7){if(!_0x55a7e7){_0x4a7f6b['sendStatus'](0x194);}return _0x55a7e7;};}function handleError(_0x2cdcac,_0x276b71){_0x276b71=_0x276b71||0x1f4;return function(_0x334612){logger[_0x3370('0x26')](_0x334612[_0x3370('0x27')]);if(_0x334612[_0x3370('0x28')]){delete _0x334612[_0x3370('0x28')];}_0x2cdcac[_0x3370('0x1a')](_0x276b71)[_0x3370('0x29')](_0x334612);};}exports[_0x3370('0x2a')]=function(_0x1476a8,_0x3bda06){var _0x4c417a={},_0x325921={},_0x3bda08={'count':0x0,'rows':[]};var _0x3592a0=_[_0x3370('0x2b')](db[_0x3370('0x2c')][_0x3370('0x2d')],function(_0x9e8e){return{'name':_0x9e8e['fieldName'],'type':_0x9e8e[_0x3370('0x2e')][_0x3370('0x2f')]};});_0x325921[_0x3370('0x30')]=_[_0x3370('0x2b')](_0x3592a0,'name');_0x325921[_0x3370('0x31')]=_['keys'](_0x1476a8[_0x3370('0x31')]);_0x325921['filters']=_[_0x3370('0x32')](_0x325921[_0x3370('0x30')],_0x325921[_0x3370('0x31')]);_0x4c417a[_0x3370('0x33')]=_[_0x3370('0x32')](_0x325921[_0x3370('0x30')],qs[_0x3370('0x34')](_0x1476a8['query'][_0x3370('0x34')]));_0x4c417a[_0x3370('0x33')]=_0x4c417a[_0x3370('0x33')][_0x3370('0x35')]?_0x4c417a[_0x3370('0x33')]:_0x325921[_0x3370('0x30')];if(!_0x1476a8['query'][_0x3370('0x36')](_0x3370('0x37'))){_0x4c417a[_0x3370('0x20')]=qs['limit'](_0x1476a8[_0x3370('0x31')][_0x3370('0x20')]);_0x4c417a[_0x3370('0x1d')]=qs[_0x3370('0x1d')](_0x1476a8[_0x3370('0x31')]['offset']);}_0x4c417a[_0x3370('0x38')]=qs['sort'](_0x1476a8[_0x3370('0x31')][_0x3370('0x39')]);_0x4c417a['where']=qs['filters'](_[_0x3370('0x3a')](_0x1476a8[_0x3370('0x31')],_0x325921[_0x3370('0x3b')]),_0x3592a0);if(_0x1476a8[_0x3370('0x31')]['filter']){_0x4c417a[_0x3370('0x3c')]=_[_0x3370('0x3d')](_0x4c417a[_0x3370('0x3c')],{'$or':_[_0x3370('0x2b')](_0x3592a0,function(_0x5ec3ff){if(_0x5ec3ff['type']!==_0x3370('0x3e')){var _0x462677={};_0x462677[_0x5ec3ff[_0x3370('0x28')]]={'$like':'%'+_0x1476a8[_0x3370('0x31')][_0x3370('0x3f')]+'%'};return _0x462677;}})});}_0x4c417a=_['merge']({},_0x4c417a,_0x1476a8[_0x3370('0x40')]);var _0x216a28={'where':_0x4c417a[_0x3370('0x3c')]};return db[_0x3370('0x2c')][_0x3370('0x1f')](_0x216a28)[_0x3370('0x24')](function(_0x4cbd83){_0x3bda08[_0x3370('0x1f')]=_0x4cbd83;if(_0x1476a8[_0x3370('0x31')]['includeAll']){_0x4c417a[_0x3370('0x41')]=[{'all':!![]}];}return db[_0x3370('0x2c')][_0x3370('0x42')](_0x4c417a);})[_0x3370('0x24')](function(_0x1a6c9b){_0x3bda08['rows']=_0x1a6c9b;return _0x3bda08;})[_0x3370('0x24')](respondWithFilteredResult(_0x3bda06,_0x4c417a))['catch'](handleError(_0x3bda06,null));};exports[_0x3370('0x43')]=function(_0x29112d,_0x544560){var _0x327596={'raw':!![],'where':{'id':_0x29112d[_0x3370('0x44')]['id']}},_0xfd1b6={};_0xfd1b6['model']=_[_0x3370('0x45')](db['FaxApplication'][_0x3370('0x2d')]);_0xfd1b6[_0x3370('0x31')]=_[_0x3370('0x45')](_0x29112d[_0x3370('0x31')]);_0xfd1b6[_0x3370('0x3b')]=_['intersection'](_0xfd1b6['model'],_0xfd1b6[_0x3370('0x31')]);_0x327596[_0x3370('0x33')]=_[_0x3370('0x32')](_0xfd1b6['model'],qs[_0x3370('0x34')](_0x29112d[_0x3370('0x31')][_0x3370('0x34')]));_0x327596[_0x3370('0x33')]=_0x327596[_0x3370('0x33')][_0x3370('0x35')]?_0x327596[_0x3370('0x33')]:_0xfd1b6['model'];if(_0x29112d[_0x3370('0x31')][_0x3370('0x46')]){_0x327596[_0x3370('0x41')]=[{'all':!![]}];}_0x327596=_['merge']({},_0x327596,_0x29112d['options']);return db[_0x3370('0x2c')][_0x3370('0x47')](_0x327596)[_0x3370('0x24')](handleEntityNotFound(_0x544560,null))[_0x3370('0x24')](respondWithResult(_0x544560,null))[_0x3370('0x48')](handleError(_0x544560,null));};exports['create']=function(_0x231cad,_0x9588b3){return db[_0x3370('0x2c')][_0x3370('0x49')](_0x231cad[_0x3370('0x4a')],{})[_0x3370('0x24')](respondWithResult(_0x9588b3,0xc9))[_0x3370('0x48')](handleError(_0x9588b3,null));};exports['update']=function(_0x24800c,_0x10c2b1){if(_0x24800c[_0x3370('0x4a')]['id']){delete _0x24800c['body']['id'];}return db[_0x3370('0x2c')][_0x3370('0x47')]({'where':{'id':_0x24800c[_0x3370('0x44')]['id']}})['then'](handleEntityNotFound(_0x10c2b1,null))[_0x3370('0x24')](saveUpdates(_0x24800c[_0x3370('0x4a')],null))[_0x3370('0x24')](respondWithResult(_0x10c2b1,null))[_0x3370('0x48')](handleError(_0x10c2b1,null));};exports[_0x3370('0x25')]=function(_0x448c90,_0x7b3f34){return db[_0x3370('0x2c')][_0x3370('0x47')]({'where':{'id':_0x448c90[_0x3370('0x44')]['id']}})[_0x3370('0x24')](handleEntityNotFound(_0x7b3f34,null))[_0x3370('0x24')](removeEntity(_0x7b3f34,null))['catch'](handleError(_0x7b3f34,null));}; \ No newline at end of file +var _0x56fb=['type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','catch','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','FaxApplication','rawAttributes','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x56fb,0x171));var _0xb56f=function(_0x3a8ef4,_0x3c347a){_0x3a8ef4=_0x3a8ef4-0x0;var _0x62f78b=_0x56fb[_0x3a8ef4];return _0x62f78b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb56f('0x0'));var zipdir=require(_0xb56f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb56f('0x2'));var moment=require(_0xb56f('0x3'));var BPromise=require(_0xb56f('0x4'));var Mustache=require(_0xb56f('0x5'));var util=require(_0xb56f('0x6'));var path=require(_0xb56f('0x7'));var sox=require(_0xb56f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb56f('0x9'));var squel=require(_0xb56f('0xa'));var crypto=require('crypto');var jsforce=require(_0xb56f('0xb'));var deskjs=require(_0xb56f('0xc'));var toCsv=require(_0xb56f('0xd'));var querystring=require(_0xb56f('0xe'));var Papa=require(_0xb56f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb56f('0x10'));var as=require(_0xb56f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb56f('0x12'))(_0xb56f('0x13'));var utils=require(_0xb56f('0x14'));var config=require(_0xb56f('0x15'));var licenseUtil=require(_0xb56f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e136e,_0x28e901){_0x28e901=_0x28e901||0xcc;return function(_0x410291){if(_0x410291){return _0x3e136e['sendStatus'](_0x28e901);}return _0x3e136e[_0xb56f('0x17')](_0x28e901)[_0xb56f('0x18')]();};}function respondWithResult(_0x1cee96,_0x2ea5e6){_0x2ea5e6=_0x2ea5e6||0xc8;return function(_0xbd8af6){if(_0xbd8af6){return _0x1cee96[_0xb56f('0x17')](_0x2ea5e6)[_0xb56f('0x19')](_0xbd8af6);}};}function respondWithFilteredResult(_0x43aa00,_0x48823c){return function(_0x1aed28){if(_0x1aed28){var _0x2d02b9=typeof _0x48823c['offset']===_0xb56f('0x1a')&&typeof _0x48823c[_0xb56f('0x1b')]===_0xb56f('0x1a');var _0x1f4127=_0x1aed28['count'];var _0x5c7bf0=_0x2d02b9?0x0:_0x48823c[_0xb56f('0x1c')];var _0x3157f1=_0x2d02b9?_0x1aed28['count']:_0x48823c[_0xb56f('0x1c')]+_0x48823c[_0xb56f('0x1b')];var _0x35a468;if(_0x3157f1>=_0x1f4127){_0x3157f1=_0x1f4127;_0x35a468=0xc8;}else{_0x35a468=0xce;}_0x43aa00['status'](_0x35a468);return _0x43aa00['set'](_0xb56f('0x1d'),_0x5c7bf0+'-'+_0x3157f1+'/'+_0x1f4127)[_0xb56f('0x19')](_0x1aed28);}return null;};}function patchUpdates(_0x35a59c){return function(_0x17b6a4){try{jsonpatch[_0xb56f('0x1e')](_0x17b6a4,_0x35a59c,!![]);}catch(_0x35fd56){return BPromise[_0xb56f('0x1f')](_0x35fd56);}return _0x17b6a4[_0xb56f('0x20')]();};}function saveUpdates(_0x22fc22,_0x381298){return function(_0xd5692a){if(_0xd5692a){return _0xd5692a[_0xb56f('0x21')](_0x22fc22)['then'](function(_0x2beca5){return _0x2beca5;});}return null;};}function removeEntity(_0x54e8b9,_0x41f361){return function(_0x391cd2){if(_0x391cd2){return _0x391cd2[_0xb56f('0x22')]()[_0xb56f('0x23')](function(){_0x54e8b9[_0xb56f('0x17')](0xcc)[_0xb56f('0x18')]();});}};}function handleEntityNotFound(_0xc5ffb6,_0x31e2e5){return function(_0x23e26f){if(!_0x23e26f){_0xc5ffb6['sendStatus'](0x194);}return _0x23e26f;};}function handleError(_0x19930e,_0x3751b8){_0x3751b8=_0x3751b8||0x1f4;return function(_0x132b7f){logger['error'](_0x132b7f['stack']);if(_0x132b7f[_0xb56f('0x24')]){delete _0x132b7f[_0xb56f('0x24')];}_0x19930e[_0xb56f('0x17')](_0x3751b8)[_0xb56f('0x25')](_0x132b7f);};}exports[_0xb56f('0x26')]=function(_0x122543,_0x4f242e){var _0x54c9eb={},_0x1f827d={},_0x760bb7={'count':0x0,'rows':[]};var _0x4f4df5=_[_0xb56f('0x27')](db[_0xb56f('0x28')][_0xb56f('0x29')],function(_0x58bcf1){return{'name':_0x58bcf1['fieldName'],'type':_0x58bcf1['type'][_0xb56f('0x2a')]};});_0x1f827d['model']=_[_0xb56f('0x27')](_0x4f4df5,_0xb56f('0x24'));_0x1f827d[_0xb56f('0x2b')]=_['keys'](_0x122543['query']);_0x1f827d[_0xb56f('0x2c')]=_[_0xb56f('0x2d')](_0x1f827d['model'],_0x1f827d[_0xb56f('0x2b')]);_0x54c9eb[_0xb56f('0x2e')]=_['intersection'](_0x1f827d[_0xb56f('0x2f')],qs[_0xb56f('0x30')](_0x122543[_0xb56f('0x2b')]['fields']));_0x54c9eb[_0xb56f('0x2e')]=_0x54c9eb[_0xb56f('0x2e')][_0xb56f('0x31')]?_0x54c9eb[_0xb56f('0x2e')]:_0x1f827d[_0xb56f('0x2f')];if(!_0x122543[_0xb56f('0x2b')][_0xb56f('0x32')](_0xb56f('0x33'))){_0x54c9eb[_0xb56f('0x1b')]=qs[_0xb56f('0x1b')](_0x122543[_0xb56f('0x2b')][_0xb56f('0x1b')]);_0x54c9eb[_0xb56f('0x1c')]=qs['offset'](_0x122543['query'][_0xb56f('0x1c')]);}_0x54c9eb['order']=qs[_0xb56f('0x34')](_0x122543[_0xb56f('0x2b')][_0xb56f('0x34')]);_0x54c9eb[_0xb56f('0x35')]=qs[_0xb56f('0x2c')](_[_0xb56f('0x36')](_0x122543[_0xb56f('0x2b')],_0x1f827d[_0xb56f('0x2c')]),_0x4f4df5);if(_0x122543[_0xb56f('0x2b')][_0xb56f('0x37')]){_0x54c9eb['where']=_[_0xb56f('0x38')](_0x54c9eb[_0xb56f('0x35')],{'$or':_[_0xb56f('0x27')](_0x4f4df5,function(_0x1b6ad3){if(_0x1b6ad3[_0xb56f('0x39')]!==_0xb56f('0x3a')){var _0x57bfcd={};_0x57bfcd[_0x1b6ad3[_0xb56f('0x24')]]={'$like':'%'+_0x122543[_0xb56f('0x2b')][_0xb56f('0x37')]+'%'};return _0x57bfcd;}})});}_0x54c9eb=_[_0xb56f('0x38')]({},_0x54c9eb,_0x122543[_0xb56f('0x3b')]);var _0x45db96={'where':_0x54c9eb[_0xb56f('0x35')]};return db['FaxApplication'][_0xb56f('0x3c')](_0x45db96)[_0xb56f('0x23')](function(_0x3f635e){_0x760bb7['count']=_0x3f635e;if(_0x122543['query'][_0xb56f('0x3d')]){_0x54c9eb[_0xb56f('0x3e')]=[{'all':!![]}];}return db['FaxApplication'][_0xb56f('0x3f')](_0x54c9eb);})[_0xb56f('0x23')](function(_0x34abf4){_0x760bb7[_0xb56f('0x40')]=_0x34abf4;return _0x760bb7;})[_0xb56f('0x23')](respondWithFilteredResult(_0x4f242e,_0x54c9eb))['catch'](handleError(_0x4f242e,null));};exports[_0xb56f('0x41')]=function(_0x57bcd9,_0x547c29){var _0x5c758f={'raw':!![],'where':{'id':_0x57bcd9[_0xb56f('0x42')]['id']}},_0x13dd46={};_0x13dd46['model']=_[_0xb56f('0x43')](db[_0xb56f('0x28')][_0xb56f('0x29')]);_0x13dd46['query']=_[_0xb56f('0x43')](_0x57bcd9[_0xb56f('0x2b')]);_0x13dd46['filters']=_['intersection'](_0x13dd46['model'],_0x13dd46['query']);_0x5c758f[_0xb56f('0x2e')]=_[_0xb56f('0x2d')](_0x13dd46['model'],qs[_0xb56f('0x30')](_0x57bcd9[_0xb56f('0x2b')][_0xb56f('0x30')]));_0x5c758f[_0xb56f('0x2e')]=_0x5c758f['attributes'][_0xb56f('0x31')]?_0x5c758f[_0xb56f('0x2e')]:_0x13dd46[_0xb56f('0x2f')];if(_0x57bcd9[_0xb56f('0x2b')]['includeAll']){_0x5c758f['include']=[{'all':!![]}];}_0x5c758f=_['merge']({},_0x5c758f,_0x57bcd9[_0xb56f('0x3b')]);return db[_0xb56f('0x28')]['find'](_0x5c758f)[_0xb56f('0x23')](handleEntityNotFound(_0x547c29,null))[_0xb56f('0x23')](respondWithResult(_0x547c29,null))[_0xb56f('0x44')](handleError(_0x547c29,null));};exports[_0xb56f('0x45')]=function(_0x43dd81,_0x31163d){return db[_0xb56f('0x28')][_0xb56f('0x45')](_0x43dd81[_0xb56f('0x46')],{})[_0xb56f('0x23')](respondWithResult(_0x31163d,0xc9))[_0xb56f('0x44')](handleError(_0x31163d,null));};exports[_0xb56f('0x21')]=function(_0x556367,_0xa3eed7){if(_0x556367['body']['id']){delete _0x556367[_0xb56f('0x46')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x556367[_0xb56f('0x42')]['id']}})['then'](handleEntityNotFound(_0xa3eed7,null))[_0xb56f('0x23')](saveUpdates(_0x556367['body'],null))[_0xb56f('0x23')](respondWithResult(_0xa3eed7,null))['catch'](handleError(_0xa3eed7,null));};exports[_0xb56f('0x22')]=function(_0x2c64c1,_0x5b0dea){return db['FaxApplication']['find']({'where':{'id':_0x2c64c1[_0xb56f('0x42')]['id']}})[_0xb56f('0x23')](handleEntityNotFound(_0x5b0dea,null))[_0xb56f('0x23')](removeEntity(_0x5b0dea,null))['catch'](handleError(_0x5b0dea,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index a9e43d2..7ab2609 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 _0x424b=['fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x424b,0x120));var _0xb424=function(_0x1024ca,_0x2562fe){_0x1024ca=_0x1024ca-0x0;var _0x390f5c=_0x424b[_0x1024ca];return _0x390f5c;};'use strict';var _=require(_0xb424('0x0'));var util=require(_0xb424('0x1'));var logger=require(_0xb424('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb424('0x3'));var rp=require(_0xb424('0x4'));var fs=require('fs');var path=require(_0xb424('0x5'));var rimraf=require(_0xb424('0x6'));var config=require(_0xb424('0x7'));var attributes=require(_0xb424('0x8'));module[_0xb424('0x9')]=function(_0x8a3a91,_0x23023c){return _0x8a3a91[_0xb424('0xa')](_0xb424('0xb'),attributes,{'tableName':_0xb424('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb424('0xd'),'collate':_0xb424('0xe')});}; \ No newline at end of file +var _0xa6b5=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4'];(function(_0x5b3c45,_0x363c83){var _0x4154c6=function(_0x345cf8){while(--_0x345cf8){_0x5b3c45['push'](_0x5b3c45['shift']());}};_0x4154c6(++_0x363c83);}(_0xa6b5,0x186));var _0x5a6b=function(_0x175289,_0x4808cd){_0x175289=_0x175289-0x0;var _0x4fdc60=_0xa6b5[_0x175289];return _0x4fdc60;};'use strict';var _=require(_0x5a6b('0x0'));var util=require('util');var logger=require(_0x5a6b('0x1'))(_0x5a6b('0x2'));var moment=require(_0x5a6b('0x3'));var BPromise=require(_0x5a6b('0x4'));var rp=require(_0x5a6b('0x5'));var fs=require('fs');var path=require(_0x5a6b('0x6'));var rimraf=require(_0x5a6b('0x7'));var config=require(_0x5a6b('0x8'));var attributes=require(_0x5a6b('0x9'));module[_0x5a6b('0xa')]=function(_0x1f4808,_0x3a51b7){return _0x1f4808[_0x5a6b('0xb')](_0x5a6b('0xc'),attributes,{'tableName':_0x5a6b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5a6b('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 0fa4b3d..888ccd5 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 _0xc87b=['limit','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','options','raw','where','attributes'];(function(_0x111c66,_0x785903){var _0x5db1cc=function(_0x428768){while(--_0x428768){_0x111c66['push'](_0x111c66['shift']());}};_0x5db1cc(++_0x785903);}(_0xc87b,0x88));var _0xbc87=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xc87b[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0xbc87('0x0'));var util=require(_0xbc87('0x1'));var moment=require(_0xbc87('0x2'));var BPromise=require(_0xbc87('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc87('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbc87('0x5'))('rpc');var config=require(_0xbc87('0x6'));var jayson=require(_0xbc87('0x7'));var client=jayson[_0xbc87('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e7c95,_0x8c800c,_0x19e24f){return new BPromise(function(_0x4aec4b,_0x136221){return client['request'](_0x2e7c95,_0x19e24f)[_0xbc87('0x9')](function(_0x2b3a67){logger[_0xbc87('0xa')]('FaxApplication,\x20%s,\x20%s',_0x8c800c,_0xbc87('0xb'));logger[_0xbc87('0xc')](_0xbc87('0xd'),_0x8c800c,_0xbc87('0xb'),JSON[_0xbc87('0xe')](_0x2b3a67));if(_0x2b3a67['error']){if(_0x2b3a67[_0xbc87('0xf')]['code']===0x1f4){logger[_0xbc87('0xf')](_0xbc87('0x10'),_0x8c800c,_0x2b3a67[_0xbc87('0xf')][_0xbc87('0x11')]);return _0x136221(_0x2b3a67[_0xbc87('0xf')][_0xbc87('0x11')]);}logger['error'](_0xbc87('0x10'),_0x8c800c,_0x2b3a67[_0xbc87('0xf')][_0xbc87('0x11')]);return _0x4aec4b(_0x2b3a67[_0xbc87('0xf')][_0xbc87('0x11')]);}else{logger['info'](_0xbc87('0x10'),_0x8c800c,_0xbc87('0xb'));_0x4aec4b(_0x2b3a67[_0xbc87('0x12')]['message']);}})[_0xbc87('0x13')](function(_0x99176){logger['error']('FaxApplication,\x20%s,\x20%s',_0x8c800c,_0x99176);_0x136221(_0x99176);});});}exports[_0xbc87('0x14')]=function(_0x5ebe56){var _0x22cb8a=this;return new Promise(function(_0x323483,_0x18ae59){return db[_0xbc87('0x15')]['update'](_0x5ebe56['body'],{'raw':_0x5ebe56[_0xbc87('0x16')]?_0x5ebe56[_0xbc87('0x16')][_0xbc87('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ebe56[_0xbc87('0x16')]?_0x5ebe56[_0xbc87('0x16')][_0xbc87('0x18')]||null:null,'attributes':_0x5ebe56[_0xbc87('0x16')]?_0x5ebe56['options'][_0xbc87('0x19')]||null:null,'limit':_0x5ebe56[_0xbc87('0x16')]?_0x5ebe56[_0xbc87('0x16')][_0xbc87('0x1a')]||null:null})[_0xbc87('0x9')](function(_0x5b7723){logger[_0xbc87('0xa')]('UpdateFaxApplication',_0x5ebe56);logger['debug'](_0xbc87('0x14'),_0x5ebe56,JSON[_0xbc87('0xe')](_0x5b7723));_0x323483(_0x5b7723);})[_0xbc87('0x13')](function(_0x3bd9ef){logger[_0xbc87('0xf')](_0xbc87('0x14'),_0x3bd9ef[_0xbc87('0x11')],_0x5ebe56);_0x18ae59(_0x22cb8a[_0xbc87('0xf')](0x1f4,_0x3bd9ef[_0xbc87('0x11')]));});});}; \ No newline at end of file +var _0xe797=['then','info','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','limit','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe797,0x1c6));var _0x7e79=function(_0x57d830,_0x503bc0){_0x57d830=_0x57d830-0x0;var _0x1a64c8=_0xe797[_0x57d830];return _0x1a64c8;};'use strict';var _=require(_0x7e79('0x0'));var util=require(_0x7e79('0x1'));var moment=require(_0x7e79('0x2'));var BPromise=require(_0x7e79('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e79('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e79('0x5'));var logger=require('../../config/logger')(_0x7e79('0x6'));var config=require(_0x7e79('0x7'));var jayson=require(_0x7e79('0x8'));var client=jayson[_0x7e79('0x9')][_0x7e79('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b4b02,_0xef1e3d,_0x110c22){return new BPromise(function(_0x26fb2c,_0x5540d8){return client['request'](_0x5b4b02,_0x110c22)[_0x7e79('0xb')](function(_0x2e9454){logger[_0x7e79('0xc')](_0x7e79('0xd'),_0xef1e3d,'request\x20sent');logger['debug'](_0x7e79('0xe'),_0xef1e3d,_0x7e79('0xf'),JSON[_0x7e79('0x10')](_0x2e9454));if(_0x2e9454[_0x7e79('0x11')]){if(_0x2e9454['error'][_0x7e79('0x12')]===0x1f4){logger['error'](_0x7e79('0xd'),_0xef1e3d,_0x2e9454['error']['message']);return _0x5540d8(_0x2e9454[_0x7e79('0x11')]['message']);}logger[_0x7e79('0x11')](_0x7e79('0xd'),_0xef1e3d,_0x2e9454[_0x7e79('0x11')][_0x7e79('0x13')]);return _0x26fb2c(_0x2e9454[_0x7e79('0x11')][_0x7e79('0x13')]);}else{logger[_0x7e79('0xc')]('FaxApplication,\x20%s,\x20%s',_0xef1e3d,_0x7e79('0xf'));_0x26fb2c(_0x2e9454[_0x7e79('0x14')][_0x7e79('0x13')]);}})[_0x7e79('0x15')](function(_0x335122){logger[_0x7e79('0x11')](_0x7e79('0xd'),_0xef1e3d,_0x335122);_0x5540d8(_0x335122);});});}exports[_0x7e79('0x16')]=function(_0x2e0b5e){var _0x4ff44e=this;return new Promise(function(_0x5309ac,_0xe944b5){return db[_0x7e79('0x17')][_0x7e79('0x18')](_0x2e0b5e['body'],{'raw':_0x2e0b5e['options']?_0x2e0b5e[_0x7e79('0x19')][_0x7e79('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e0b5e[_0x7e79('0x19')]?_0x2e0b5e[_0x7e79('0x19')][_0x7e79('0x1b')]||null:null,'attributes':_0x2e0b5e[_0x7e79('0x19')]?_0x2e0b5e[_0x7e79('0x19')][_0x7e79('0x1c')]||null:null,'limit':_0x2e0b5e['options']?_0x2e0b5e[_0x7e79('0x19')][_0x7e79('0x1d')]||null:null})[_0x7e79('0xb')](function(_0x23289d){logger[_0x7e79('0xc')]('UpdateFaxApplication',_0x2e0b5e);logger[_0x7e79('0x1e')](_0x7e79('0x16'),_0x2e0b5e,JSON[_0x7e79('0x10')](_0x23289d));_0x5309ac(_0x23289d);})[_0x7e79('0x15')](function(_0x5a0394){logger[_0x7e79('0x11')]('UpdateFaxApplication',_0x5a0394[_0x7e79('0x13')],_0x2e0b5e);_0xe944b5(_0x4ff44e[_0x7e79('0x11')](0x1f4,_0x5a0394['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 31aafdf..4d1b76a 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 _0x0598=['../../components/auth/service','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra'];(function(_0x3f8084,_0x1175ea){var _0x1288aa=function(_0x4fcfd9){while(--_0x4fcfd9){_0x3f8084['push'](_0x3f8084['shift']());}};_0x1288aa(++_0x1175ea);}(_0x0598,0x92));var _0x8059=function(_0x1fe99d,_0x13a2f9){_0x1fe99d=_0x1fe99d-0x0;var _0xfbae2a=_0x0598[_0x1fe99d];return _0xfbae2a;};'use strict';var multer=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var path=require('path');var timeout=require(_0x8059('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8059('0x3'));var auth=require(_0x8059('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxApplication.controller');router[_0x8059('0x5')]('/',auth[_0x8059('0x6')](),controller['index']);router['get'](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0x8')]);router[_0x8059('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8059('0xa')](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0xb')]);router[_0x8059('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x8059('0xd')]);module[_0x8059('0xe')]=router; \ No newline at end of file +var _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0x903dcc,_0x10d4f8){var _0x24d5ce=function(_0x4aadfa){while(--_0x4aadfa){_0x903dcc['push'](_0x903dcc['shift']());}};_0x24d5ce(++_0x10d4f8);}(_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('./faxApplication.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 4d04410..bde4414 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 _0x82bb=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x574913,_0xfd513b){var _0x5b82d8=function(_0x21f826){while(--_0x21f826){_0x574913['push'](_0x574913['shift']());}};_0x5b82d8(++_0xfd513b);}(_0x82bb,0x67));var _0xb82b=function(_0x2f4942,_0x168bb6){_0x2f4942=_0x2f4942-0x0;var _0x666320=_0x82bb[_0x2f4942];return _0x666320;};'use strict';var Sequelize=require(_0xb82b('0x0'));module[_0xb82b('0x1')]={'closed':{'type':Sequelize[_0xb82b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb82b('0x3')]},'disposition':{'type':Sequelize[_0xb82b('0x4')]},'secondDisposition':{'type':Sequelize[_0xb82b('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb82b('0x4')]},'read1stAt':{'type':Sequelize[_0xb82b('0x3')]},'fax':{'type':Sequelize[_0xb82b('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xb82b('0x5')]('in',_0xb82b('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb82b('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb82b('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x3ac8=['sequelize','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x244dc1,_0x54501a){var _0x1a4e59=function(_0xe8c40c){while(--_0xe8c40c){_0x244dc1['push'](_0x244dc1['shift']());}};_0x1a4e59(++_0x54501a);}(_0x3ac8,0x1bc));var _0x83ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ac8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x83ac('0x0'));module['exports']={'closed':{'type':Sequelize[_0x83ac('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x83ac('0x2')]},'secondDisposition':{'type':Sequelize[_0x83ac('0x2')]},'thirdDisposition':{'type':Sequelize[_0x83ac('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x83ac('0x3')]},'fax':{'type':Sequelize[_0x83ac('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x83ac('0x4')]('in',_0x83ac('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x83ac('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x83ac('0x4')]('in',_0x83ac('0x5')),'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 16deebb..aaf3004 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 _0xf72f=['merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','Contact.mobile','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','rows','catch','show','params','includeAll','include','options','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','emit','removeTags','download','unix','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','map','fullname','TagIds','Tags','split','forEach','push','index','FaxInteraction','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','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','parseSearch','search','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','UserId','text','some','compact','isEmpty','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy'];(function(_0xb187d,_0xcc650f){var _0x48db3c=function(_0x4afc5b){while(--_0x4afc5b){_0xb187d['push'](_0xb187d['shift']());}};_0x48db3c(++_0xcc650f);}(_0xf72f,0x1f1));var _0xff72=function(_0x2240ee,_0x4d33bd){_0x2240ee=_0x2240ee-0x0;var _0x48deab=_0xf72f[_0x2240ee];return _0x48deab;};'use strict';var emlformat=require(_0xff72('0x0'));var rimraf=require(_0xff72('0x1'));var zipdir=require(_0xff72('0x2'));var jsonpatch=require(_0xff72('0x3'));var rp=require(_0xff72('0x4'));var moment=require(_0xff72('0x5'));var BPromise=require(_0xff72('0x6'));var Mustache=require(_0xff72('0x7'));var util=require(_0xff72('0x8'));var path=require('path');var sox=require(_0xff72('0x9'));var csv=require(_0xff72('0xa'));var ejs=require(_0xff72('0xb'));var fs=require('fs');var fs_extra=require(_0xff72('0xc'));var _=require(_0xff72('0xd'));var squel=require(_0xff72('0xe'));var crypto=require(_0xff72('0xf'));var jsforce=require(_0xff72('0x10'));var deskjs=require(_0xff72('0x11'));var toCsv=require(_0xff72('0xa'));var querystring=require(_0xff72('0x12'));var Papa=require(_0xff72('0x13'));var Redis=require(_0xff72('0x14'));var authService=require(_0xff72('0x15'));var qs=require(_0xff72('0x16'));var as=require(_0xff72('0x17'));var hardwareService=require(_0xff72('0x18'));var logger=require('../../config/logger')('api');var utils=require(_0xff72('0x19'));var config=require(_0xff72('0x1a'));var licenseUtil=require(_0xff72('0x1b'));var db=require('../../mysqldb')['db'];config[_0xff72('0x1c')]=_[_0xff72('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xff72('0x1e'))(new Redis(config[_0xff72('0x1c')]));require(_0xff72('0x1f'))[_0xff72('0x20')](socket);function respondWithStatusCode(_0x4c92b5,_0x119d0e){_0x119d0e=_0x119d0e||0xcc;return function(_0x5baf22){if(_0x5baf22){return _0x4c92b5[_0xff72('0x21')](_0x119d0e);}return _0x4c92b5[_0xff72('0x22')](_0x119d0e)[_0xff72('0x23')]();};}function respondWithResult(_0x40f5cd,_0x10f9de){_0x10f9de=_0x10f9de||0xc8;return function(_0x5e87f1){if(_0x5e87f1){return _0x40f5cd['status'](_0x10f9de)[_0xff72('0x24')](_0x5e87f1);}};}function respondWithFilteredResult(_0x18a83b,_0xc219f6){return function(_0x3f687b){if(_0x3f687b){var _0xdfc7c=typeof _0xc219f6[_0xff72('0x25')]===_0xff72('0x26')&&typeof _0xc219f6['limit']==='undefined';var _0x3dd478=_0x3f687b[_0xff72('0x27')];var _0x5265d5=_0xdfc7c?0x0:_0xc219f6[_0xff72('0x25')];var _0xbcda69=_0xdfc7c?_0x3f687b[_0xff72('0x27')]:_0xc219f6['offset']+_0xc219f6['limit'];var _0x4173e9;if(_0xbcda69>=_0x3dd478){_0xbcda69=_0x3dd478;_0x4173e9=0xc8;}else{_0x4173e9=0xce;}_0x18a83b[_0xff72('0x22')](_0x4173e9);return _0x18a83b[_0xff72('0x28')](_0xff72('0x29'),_0x5265d5+'-'+_0xbcda69+'/'+_0x3dd478)['json'](_0x3f687b);}return null;};}function patchUpdates(_0x22128f){return function(_0x3b158c){try{jsonpatch[_0xff72('0x2a')](_0x3b158c,_0x22128f,!![]);}catch(_0x125cb5){return BPromise[_0xff72('0x2b')](_0x125cb5);}return _0x3b158c['save']();};}function saveUpdates(_0x558f52,_0x91d8f1){return function(_0x597f1b){if(_0x597f1b){return _0x597f1b[_0xff72('0x2c')](_0x558f52)['then'](function(_0x4e70d7){return _0x4e70d7;});}return null;};}function removeEntity(_0x5690b1,_0xba17a1){return function(_0x4fd4d9){if(_0x4fd4d9){return _0x4fd4d9[_0xff72('0x2d')]()[_0xff72('0x2e')](function(){_0x5690b1[_0xff72('0x22')](0xcc)[_0xff72('0x23')]();});}};}function handleEntityNotFound(_0x549488,_0x3fe692){return function(_0x34813d){if(!_0x34813d){_0x549488['sendStatus'](0x194);}return _0x34813d;};}function handleError(_0x93812b,_0x14cda3){_0x14cda3=_0x14cda3||0x1f4;return function(_0x31743f){logger[_0xff72('0x2f')](_0x31743f[_0xff72('0x30')]);if(_0x31743f['name']){delete _0x31743f[_0xff72('0x31')];}_0x93812b[_0xff72('0x22')](_0x14cda3)[_0xff72('0x32')](_0x31743f);};}function getInteractionUsers(_0x527730,_0x456e52){return new BPromise(function(_0x34a7ea,_0x24d67e){try{if(_0x456e52[_0x527730['id']]){_0x527730['Users']=_[_0xff72('0x33')](_0x456e52[_0x527730['id']],function(_0x103155){return{'id':_0x103155['id'],'fullname':_0x103155[_0xff72('0x34')]};});}}catch(_0x589bbc){_0x24d67e(_0x589bbc);}_0x34a7ea(_0x527730);});}function getInteractionTags(_0x1d0638,_0x2cb471){return new BPromise(function(_0x5ad765,_0x408ede){try{if(_0x1d0638[_0xff72('0x35')]){_0x1d0638[_0xff72('0x36')]=[];_0x1d0638['TagIds'][_0xff72('0x37')](',')[_0xff72('0x38')](function(_0x2b7324){_0x1d0638[_0xff72('0x36')][_0xff72('0x39')](_0x2cb471[_0x2b7324]);});}delete _0x1d0638[_0xff72('0x35')];}catch(_0x381c12){_0x408ede(_0x381c12);}_0x5ad765(_0x1d0638);});}function updateFaxInteraction(_0x3541d3,_0x444201,_0x4edd41){return new BPromise(function(_0x792ce0,_0x43c00d){return getInteractionUsers(_0x3541d3,_0x4edd41)[_0xff72('0x2e')](function(_0x5414c3){return getInteractionTags(_0x5414c3,_0x444201);})[_0xff72('0x2e')](function(_0x3cab50){_0x792ce0(_0x3cab50);})['catch'](function(_0x30754a){_0x43c00d(_0x30754a);});});}exports[_0xff72('0x3a')]=function(_0x3dc74e,_0x166468){var _0x1df897={},_0x27ec0e={},_0x24d2b3={'count':0x0,'rows':[]};var _0x2c716c=_[_0xff72('0x33')](db[_0xff72('0x3b')][_0xff72('0x3c')],function(_0x4bad4d){return{'name':_0x4bad4d['fieldName'],'type':_0x4bad4d['type'][_0xff72('0x3d')]};});_0x27ec0e[_0xff72('0x3e')]=_['map'](_0x2c716c,_0xff72('0x31'));_0x27ec0e[_0xff72('0x3f')]=_[_0xff72('0x40')](_0x3dc74e['query']);_0x27ec0e[_0xff72('0x41')]=_['intersection'](_0x27ec0e[_0xff72('0x3e')],_0x27ec0e[_0xff72('0x3f')]);_0x1df897['attributes']=_[_0xff72('0x42')](_0x27ec0e[_0xff72('0x3e')],qs[_0xff72('0x43')](_0x3dc74e[_0xff72('0x3f')][_0xff72('0x43')]));_0x1df897[_0xff72('0x44')]=_0x1df897['attributes'][_0xff72('0x45')]?_0x1df897['attributes']:_0x27ec0e[_0xff72('0x3e')];if(!_0x3dc74e[_0xff72('0x3f')][_0xff72('0x46')](_0xff72('0x47'))){_0x1df897[_0xff72('0x48')]=qs[_0xff72('0x48')](_0x3dc74e['query']['limit']);_0x1df897[_0xff72('0x25')]=qs[_0xff72('0x25')](_0x3dc74e[_0xff72('0x3f')][_0xff72('0x25')]);}_0x1df897[_0xff72('0x49')]=qs[_0xff72('0x4a')](_0x3dc74e[_0xff72('0x3f')][_0xff72('0x4a')]);_0x1df897[_0xff72('0x4b')]=qs[_0xff72('0x41')](_[_0xff72('0x4c')](_0x3dc74e[_0xff72('0x3f')],_0x27ec0e['filters']),_0x2c716c);var _0x5f2244=[];var _0x177b50=squel[_0xff72('0x4d')]()[_0xff72('0x4e')]('id')[_0xff72('0x4e')]('name')['field'](_0xff72('0x4f'))[_0xff72('0x50')](_0xff72('0x51'));var _0x421f9c=squel[_0xff72('0x4d')]()[_0xff72('0x4e')](_0xff72('0x52'))[_0xff72('0x4e')](_0xff72('0x53'))[_0xff72('0x4e')](_0xff72('0x54'))[_0xff72('0x50')](_0xff72('0x55'),'ui')[_0xff72('0x56')]('users','u',_0xff72('0x57'));var _0x4f2ea6=squel[_0xff72('0x4d')]()[_0xff72('0x50')](_0xff72('0x58'),'i')['left_join'](_0xff72('0x59'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xff72('0x56')]('users','o',_0xff72('0x5a'))[_0xff72('0x56')](_0xff72('0x5b'),'a','a.id\x20=\x20i.FaxAccountId')[_0xff72('0x56')](_0xff72('0x5c'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xff72('0x56')](_0xff72('0x5d'),'it',_0xff72('0x5e'))[_0xff72('0x56')](_0xff72('0x51'),'t','t.id\x20=\x20it.TagId');var _0x4429df=squel['expr']();var _0x4871c7=[];var _0x4ea366=squel['expr']();var _0x54323c;if(_0x3dc74e[_0xff72('0x3f')]['search']){_0x54323c=as[_0xff72('0x5f')](_0x3dc74e['query'][_0xff72('0x60')]);var _0x3f7048=_0x54323c['sqlOperator'];for(var _0x1220b8=0x0;_0x1220b8<_0x54323c[_0xff72('0x61')]['length'];_0x1220b8++){var _0x19cbf5=_0x54323c[_0xff72('0x61')][_0x1220b8];var _0x1aa784='i';var _0x344025=_[_0xff72('0x62')](_0x2c716c,[_0xff72('0x31'),_0x19cbf5[_0xff72('0x4e')]]);if(!_0x344025){switch(_0x19cbf5['field']){case _0xff72('0x63'):if(_0x19cbf5['value']==0x1){_0x4f2ea6[_0xff72('0x64')]('`'+_0x19cbf5['field']+_0xff72('0x65'));}else{_0x4f2ea6['having']('`'+_0x19cbf5['field']+_0xff72('0x66'));}break;case _0xff72('0x67'):if(_0x19cbf5['operator']===_0xff72('0x68')){if(_0x19cbf5[_0xff72('0x69')][_0xff72('0x37')]('\x20')[_0xff72('0x45')]>0x1){_0x4429df[_0x3f7048]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xff72('0x6a')](_0x19cbf5[_0xff72('0x69')]),null);}else{var _0x555123='%'+_0x19cbf5[_0xff72('0x69')]+'%';_0x4429df[_0x3f7048](_0xff72('0x6b'),_0x555123,_0x555123,_0x555123);}}else{_0x344025=_[_0xff72('0x62')](_0x2c716c,[_0xff72('0x31'),_0xff72('0x6c')]);_0x19cbf5[_0xff72('0x4e')]='ContactId';_0x4bbd72=as[_0xff72('0x6d')](_0x1aa784,_0x344025[_0xff72('0x6e')],_0x19cbf5);_0x4429df[_0x3f7048](_0x4bbd72['text'],_0x4bbd72[_0xff72('0x69')][_0xff72('0x6f')],_0x4bbd72['value']['end']);}break;case _0xff72('0x70'):var _0x27b91a=_0x19cbf5[_0xff72('0x69')][_0xff72('0x37')](',')[_0xff72('0x33')](function(_0x366efc){return Number(_0x366efc);});_0x27b91a['forEach'](function(_0x14ea12){_0x4ea366['or'](_0xff72('0x71'),'%,'+_0x14ea12+',%');});_0x4871c7=_['union'](_0x4871c7,_0x27b91a);break;case _0xff72('0x72'):if(_0x19cbf5[_0xff72('0x73')]===_0xff72('0x68')){_0x4429df[_0x3f7048]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x19cbf5[_0xff72('0x69')]+'%',null);}else{_0x344025=_[_0xff72('0x62')](_0x2c716c,[_0xff72('0x31'),_0xff72('0x74')]);_0x19cbf5[_0xff72('0x4e')]=_0xff72('0x74');_0x4bbd72=as[_0xff72('0x6d')](_0x1aa784,_0x344025[_0xff72('0x6e')],_0x19cbf5);_0x4429df[_0x3f7048](_0x4bbd72[_0xff72('0x75')],_0x4bbd72[_0xff72('0x69')]['start'],_0x4bbd72[_0xff72('0x69')][_0xff72('0x23')]);}break;case'body':_0x4bbd72=as['buildExpression']('me',null,_0x19cbf5);_0x4429df[_0x3f7048](_0x4bbd72[_0xff72('0x75')],_0x4bbd72['value'][_0xff72('0x6f')],_0x4bbd72['value'][_0xff72('0x23')]);break;}}else{var _0x4bbd72=as['buildExpression'](_0x1aa784,_0x344025[_0xff72('0x6e')],_0x19cbf5);_0x4429df[_0x3f7048](_0x4bbd72['text'],_0x4bbd72['value']['start'],_0x4bbd72[_0xff72('0x69')]['end']);}}}else{var _0x3a0307=_(_0x3dc74e['query'])[_0xff72('0x40')]()[_0xff72('0x33')](function(_0x33f8bc){return _[_0xff72('0x76')](_0x2c716c,[_0xff72('0x31'),_0x33f8bc])?_0x33f8bc:undefined;})[_0xff72('0x77')]()[_0xff72('0x69')]();if(!_[_0xff72('0x78')](_0x3a0307)){_0x3a0307[_0xff72('0x38')](function(_0xad4c31){if(_0xad4c31==='FaxAccountId'){_0x4f2ea6[_0xff72('0x4b')](_0xff72('0x79'),[][_0xff72('0x7a')](_0x3dc74e[_0xff72('0x3f')][_0xad4c31]));}else if(_0xad4c31===_0xff72('0x7b')){var _0x32a82f=JSON[_0xff72('0x7c')](_0x3dc74e[_0xff72('0x3f')][_0xad4c31])[_0xff72('0x7d')];var _0x8a2ad2=JSON[_0xff72('0x7c')](_0x3dc74e[_0xff72('0x3f')][_0xad4c31])['$lte'];_0x4f2ea6[_0xff72('0x4b')](_0xff72('0x7e'),_0x32a82f,_0x8a2ad2);}else{if(_0x3dc74e[_0xff72('0x3f')][_0xad4c31]===_0xff72('0x7f')){_0x4f2ea6[_0xff72('0x4b')]('i.'+_0xad4c31+'\x20IS\x20NULL');}else{_0x4f2ea6[_0xff72('0x4b')]('i.'+_0xad4c31+_0xff72('0x80'),_0x3dc74e['query'][_0xad4c31]);}}});}if(_0x3dc74e['query']['read']){if(_0x3dc74e[_0xff72('0x3f')][_0xff72('0x81')]==0x1){_0x4f2ea6[_0xff72('0x64')](_0xff72('0x82'));}else{_0x4f2ea6[_0xff72('0x64')]('`unreadMessages`\x20>\x200');}}if(_0x3dc74e[_0xff72('0x3f')][_0xff72('0x83')]){_0x4871c7=_[_0xff72('0x84')](_0x3dc74e[_0xff72('0x3f')][_0xff72('0x83')])?_0x3dc74e[_0xff72('0x3f')][_0xff72('0x83')]:new Array(_0x3dc74e[_0xff72('0x3f')]['tag']);_0x4871c7[_0xff72('0x38')](function(_0x4f48ea){_0x4ea366['or'](_0xff72('0x71'),'%,'+_0x4f48ea+',%');});}if(_0x3dc74e[_0xff72('0x3f')][_0xff72('0x85')]){var _0x2695f5=_0x3dc74e['query']['filter'][_0xff72('0x86')]('\x5c','\x5c\x5c')[_0xff72('0x86')](/'/g,'\x27\x27');if(qs[_0xff72('0x87')](_0x2695f5)){_0x4429df['or'](_0xff72('0x88'),_0x2695f5+'%')['or'](_0xff72('0x89'),_0x2695f5+'%');}_0x4429df['or'](_0xff72('0x8a'),_0x2695f5+'%');}}_0x4f2ea6[_0xff72('0x4b')](_0x4429df);_0x4f2ea6[_0xff72('0x8b')]('i.id');var _0x4604db={'type':db[_0xff72('0x8c')][_0xff72('0x8d')][_0xff72('0x8e')],'raw':!![]};var _0x159649=_0x4f2ea6[_0xff72('0x8f')]();_0x159649['field']('i.id');_0x159649[_0xff72('0x4e')](_0xff72('0x90'),_0xff72('0x63'));if(_0x1df897['order']){_0x1df897[_0xff72('0x49')]['forEach'](function(_0x47c905){var _0x312202=_0x47c905[0x0]==='contactName'?_0x47c905[0x0]:'i.'+_0x47c905[0x0];_0x4f2ea6[_0xff72('0x49')](_0x312202,_0x47c905[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x4871c7)){_0x4f2ea6[_0xff72('0x64')](_0x4ea366);_0x159649[_0xff72('0x4b')](_0xff72('0x91'),_0x4871c7);}BPromise[_0xff72('0x92')]()['then'](function(){if(!_0x54323c){if(_0x3dc74e[_0xff72('0x3f')][_0xff72('0x93')])return;_0x159649[_0xff72('0x4b')](_0xff72('0x94'));_0x4f2ea6[_0xff72('0x4b')](_0xff72('0x94'));return;}if(_0x3dc74e[_0xff72('0x95')][_0xff72('0x96')]!=='agent')return;return _0x3dc74e[_0xff72('0x95')][_0xff72('0x97')]({'attributes':['id'],'raw':!![]})['then'](function(_0x48534f){if(_[_0xff72('0x78')](_0x48534f)){_0x159649['where'](_0xff72('0x98'));_0x4f2ea6[_0xff72('0x4b')](_0xff72('0x98'));}else{_0x159649[_0xff72('0x4b')](_0xff72('0x79'),_[_0xff72('0x33')](_0x48534f,'id'));_0x4f2ea6[_0xff72('0x4b')](_0xff72('0x79'),_['map'](_0x48534f,'id'));}});})[_0xff72('0x2e')](function(){if(_0x3dc74e[_0xff72('0x95')]['role']===_0xff72('0x99')&&!_0x54323c&&!_0x3dc74e[_0xff72('0x3f')][_0xff72('0x93')])return[];return db['sequelize'][_0xff72('0x3f')](_0x159649[_0xff72('0x9a')](),_0x4604db);})[_0xff72('0x2e')](function(_0x5ab98d){_0x24d2b3[_0xff72('0x27')]=_0x5ab98d[_0xff72('0x45')];if(_0x24d2b3[_0xff72('0x27')]===0x0)return[];return db[_0xff72('0x9b')][_0xff72('0x3f')](_0x177b50[_0xff72('0x9a')](),_0x4604db)[_0xff72('0x2e')](function(_0x17a4f6){_0x5f2244=_[_0xff72('0x9c')](_0x17a4f6,'id');_0x4604db=_[_0xff72('0x9d')](_0x4604db,{'model':db[_0xff72('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3dc74e[_0xff72('0x3f')][_0xff72('0x43')]){_0x1df897[_0xff72('0x44')]['forEach'](function(_0x995d6a){_0x4f2ea6[_0xff72('0x4e')]('i.'+_0x995d6a);});}else{_0x4f2ea6['field'](_0xff72('0x90'),_0xff72('0x63'));_0x4f2ea6[_0xff72('0x4e')](_0xff72('0x9e'),_0xff72('0x9f'));_0x4f2ea6['field'](_0xff72('0xa0'),_0xff72('0xa1'));_0x4f2ea6[_0xff72('0x4e')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x4f2ea6[_0xff72('0x4e')](_0xff72('0xa2'));_0x4f2ea6[_0xff72('0x4e')](_0xff72('0xa3'),'Contact.firstName');_0x4f2ea6[_0xff72('0x4e')](_0xff72('0xa4'),_0xff72('0xa5'));_0x4f2ea6[_0xff72('0x4e')]('c.email',_0xff72('0xa6'));_0x4f2ea6[_0xff72('0x4e')]('c.phone',_0xff72('0xa7'));_0x4f2ea6['field']('c.mobile',_0xff72('0xa8'));_0x4f2ea6[_0xff72('0x4e')]('c.fax','Contact.fax');_0x4f2ea6[_0xff72('0x4e')](_0xff72('0xa9'),_0xff72('0xaa'));_0x4f2ea6['field'](_0xff72('0xab'),'Owner.internal');_0x4f2ea6[_0xff72('0x4e')](_0xff72('0xac'),_0xff72('0x35'));}if(_0x1df897[_0xff72('0x48')])_0x4f2ea6[_0xff72('0x48')](_0x1df897['limit']);if(_0x1df897[_0xff72('0x25')])_0x4f2ea6[_0xff72('0x25')](_0x1df897[_0xff72('0x25')]);return db[_0xff72('0x9b')]['query'](_0x4f2ea6[_0xff72('0x9a')](),_0x4604db);})[_0xff72('0x2e')](function(_0x90f330){if(_0x90f330[_0xff72('0x45')]>0x0)_0x421f9c['where'](_0xff72('0xad'),_[_0xff72('0x33')](_0x90f330,'id'));return db['sequelize'][_0xff72('0x3f')](_0x421f9c[_0xff72('0x9a')](),_0x4604db)['then'](function(_0x6bebb5){var _0x4bee56=_['groupBy'](_0x6bebb5,_0xff72('0xae'));var _0x4ce519=[];_0x90f330[_0xff72('0x38')](function(_0x421aed){_0x4ce519[_0xff72('0x39')](updateFaxInteraction(_0x421aed,_0x5f2244,_0x4bee56));});return BPromise[_0xff72('0xaf')](_0x4ce519);});});})[_0xff72('0x2e')](function(_0x3ab8ce){_0x24d2b3[_0xff72('0xb0')]=_0x3ab8ce;return _0x24d2b3;})[_0xff72('0x2e')](respondWithFilteredResult(_0x166468,_0x1df897))[_0xff72('0xb1')](handleError(_0x166468,null));};exports[_0xff72('0xb2')]=function(_0x2bf476,_0x4e84a8){var _0x42cb0f={'raw':![],'where':{'id':_0x2bf476[_0xff72('0xb3')]['id']}},_0x29389b={};_0x29389b['model']=_['keys'](db['FaxInteraction'][_0xff72('0x3c')]);_0x29389b[_0xff72('0x3f')]=_[_0xff72('0x40')](_0x2bf476[_0xff72('0x3f')]);_0x29389b[_0xff72('0x41')]=_[_0xff72('0x42')](_0x29389b[_0xff72('0x3e')],_0x29389b[_0xff72('0x3f')]);_0x42cb0f[_0xff72('0x44')]=_[_0xff72('0x42')](_0x29389b['model'],qs[_0xff72('0x43')](_0x2bf476[_0xff72('0x3f')]['fields']));_0x42cb0f[_0xff72('0x44')]=_0x42cb0f[_0xff72('0x44')][_0xff72('0x45')]?_0x42cb0f['attributes']:_0x29389b[_0xff72('0x3e')];if(_0x2bf476[_0xff72('0x3f')][_0xff72('0xb4')]){_0x42cb0f[_0xff72('0xb5')]=[{'all':!![]}];}_0x42cb0f=_[_0xff72('0x9d')]({},_0x42cb0f,_0x2bf476[_0xff72('0xb6')]);return db[_0xff72('0x3b')][_0xff72('0x62')](_0x42cb0f)[_0xff72('0x2e')](handleEntityNotFound(_0x4e84a8,null))['then'](respondWithResult(_0x4e84a8,null))[_0xff72('0xb1')](handleError(_0x4e84a8,null));};exports[_0xff72('0xb7')]=function(_0xc7de03,_0xc79397){return db['FaxInteraction'][_0xff72('0xb7')](_0xc7de03[_0xff72('0xb8')],{})['then'](respondWithResult(_0xc79397,0xc9))['catch'](handleError(_0xc79397,null));};exports[_0xff72('0x2c')]=function(_0x1588bd,_0x3a1dea){if(_0x1588bd[_0xff72('0xb8')]['id']){delete _0x1588bd[_0xff72('0xb8')]['id'];}return db[_0xff72('0x3b')][_0xff72('0x62')]({'where':{'id':_0x1588bd[_0xff72('0xb3')]['id']}})['then'](handleEntityNotFound(_0x3a1dea,null))[_0xff72('0x2e')](saveUpdates(_0x1588bd['body'],null))[_0xff72('0x2e')](respondWithResult(_0x3a1dea,null))['catch'](handleError(_0x3a1dea,null));};exports['destroy']=function(_0x153ef6,_0x130f8e){return db[_0xff72('0x3b')][_0xff72('0x62')]({'where':{'id':_0x153ef6[_0xff72('0xb3')]['id']}})[_0xff72('0x2e')](handleEntityNotFound(_0x130f8e,null))[_0xff72('0x2e')](removeEntity(_0x130f8e,null))[_0xff72('0xb1')](handleError(_0x130f8e,null));};exports[_0xff72('0xb9')]=function(_0x301bc5,_0xa21d06){return db['FaxInteraction'][_0xff72('0xb9')]()[_0xff72('0x2e')](respondWithResult(_0xa21d06,null))[_0xff72('0xb1')](handleError(_0xa21d06,null));};exports[_0xff72('0xba')]=function(_0x186437,_0x225ec7,_0x4a885b){return db[_0xff72('0xbb')]['find']({'where':{'id':_0x186437[_0xff72('0xb3')]['id']}})['then'](handleEntityNotFound(_0x225ec7,null))[_0xff72('0x2e')](function(_0x36271c){if(_0x36271c){return _0x36271c[_0xff72('0xba')](_0x186437['body'][_0xff72('0xbc')],_[_0xff72('0xbd')](_0x186437[_0xff72('0xb8')],[_0xff72('0xbc'),'id'])||{});}})[_0xff72('0x2e')](respondWithResult(_0x225ec7,null))['catch'](handleError(_0x225ec7,null));};exports[_0xff72('0xbe')]=function(_0x46b64f,_0x33e040,_0xfd6fef){var _0x2335d3={'raw':![],'where':{}};var _0x55c99d={};var _0x17c5ba={'count':0x0,'rows':[]};return db[_0xff72('0x3b')][_0xff72('0xbf')]({'where':{'id':_0x46b64f[_0xff72('0xb3')]['id']}})['then'](handleEntityNotFound(_0x33e040,null))[_0xff72('0x2e')](function(_0x30b476){if(_0x30b476){_0x55c99d[_0xff72('0x3e')]=_[_0xff72('0x40')](db[_0xff72('0xbb')][_0xff72('0x3c')]);_0x55c99d[_0xff72('0x3f')]=_['keys'](_0x46b64f[_0xff72('0x3f')]);_0x55c99d[_0xff72('0x41')]=_[_0xff72('0x42')](_0x55c99d[_0xff72('0x3e')],_0x55c99d[_0xff72('0x3f')]);_0x2335d3['attributes']=_['intersection'](_0x55c99d[_0xff72('0x3e')],qs[_0xff72('0x43')](_0x46b64f['query'][_0xff72('0x43')]));_0x2335d3['attributes']=_0x2335d3[_0xff72('0x44')]['length']?_0x2335d3[_0xff72('0x44')]:_0x55c99d[_0xff72('0x3e')];if(!_0x46b64f['query'][_0xff72('0x46')](_0xff72('0x47'))){_0x2335d3['limit']=qs[_0xff72('0x48')](_0x46b64f[_0xff72('0x3f')][_0xff72('0x48')]);_0x2335d3[_0xff72('0x25')]=qs['offset'](_0x46b64f[_0xff72('0x3f')][_0xff72('0x25')]);}_0x2335d3[_0xff72('0x49')]=qs[_0xff72('0x4a')](_0x46b64f['query']['sort']);_0x2335d3[_0xff72('0x4b')]=qs['filters'](_[_0xff72('0x4c')](_0x46b64f['query'],_0x55c99d[_0xff72('0x41')]));_0x2335d3['where'][_0xff72('0xae')]=_0x30b476['id'];if(_0x46b64f[_0xff72('0x3f')][_0xff72('0x85')]){_0x2335d3[_0xff72('0x4b')]=_['merge'](_0x2335d3[_0xff72('0x4b')],{'$or':_['map'](_0x2335d3[_0xff72('0x44')],function(_0x5468bd){var _0x2b0adb={};_0x2b0adb[_0x5468bd]={'$like':'%'+_0x46b64f['query'][_0xff72('0x85')]+'%'};return _0x2b0adb;})});}if(_0x46b64f[_0xff72('0x3f')][_0xff72('0x7d')]){var _0x1487cf=_0x46b64f[_0xff72('0x3f')][_0xff72('0x7d')][_0xff72('0x37')](',');var _0x355b37={};_0x355b37[_0x1487cf[0x0]]={'$gte':moment(_0x1487cf[0x1])[_0xff72('0xc0')](_0xff72('0xc1'))};_0x2335d3['where']=_['merge'](_0x2335d3[_0xff72('0x4b')],_0x355b37);}_0x2335d3=_[_0xff72('0x9d')]({},_0x2335d3,_0x46b64f[_0xff72('0xb6')]);return db[_0xff72('0xbb')][_0xff72('0x27')]({'where':_0x2335d3[_0xff72('0x4b')]})[_0xff72('0x2e')](function(_0x35ff9c){_0x17c5ba['count']=_0x35ff9c;if(_0x46b64f[_0xff72('0x3f')][_0xff72('0xb4')]){_0x2335d3[_0xff72('0xb5')]=[{'all':!![]}];}return db[_0xff72('0xbb')][_0xff72('0xc2')](_0x2335d3);})[_0xff72('0x2e')](function(_0x2603e8){_0x17c5ba[_0xff72('0xb0')]=_0x2603e8;return _0x17c5ba;});}})[_0xff72('0x2e')](respondWithFilteredResult(_0x33e040,_0x2335d3))[_0xff72('0xb1')](handleError(_0x33e040,null));};exports[_0xff72('0xc3')]=function(_0x7aa974,_0x4179f5,_0x18000e){return db[_0xff72('0x3b')]['find']({'where':{'id':_0x7aa974[_0xff72('0xb3')]['id']}})['then'](handleEntityNotFound(_0x4179f5,null))[_0xff72('0x2e')](function(_0x4ac20a){if(_0x4ac20a){return _0x4ac20a[_0xff72('0xc4')](_0x7aa974[_0xff72('0xb8')]['ids'],_['omit'](_0x7aa974[_0xff72('0xb8')],[_0xff72('0xbc'),'id'])||{})['spread'](function(){return db[_0xff72('0x70')][_0xff72('0xc2')]({'attributes':['id',_0xff72('0x31'),'color'],'where':{'id':_0x7aa974[_0xff72('0xb8')]['ids']}});})[_0xff72('0x2e')](function(_0x40b091){socket[_0xff72('0xc5')]('faxInteractionTags:save',{'id':Number(_0x7aa974[_0xff72('0xb3')]['id']),'tags':_0x40b091||[]});return{'id':Number(_0x7aa974['params']['id']),'tags':_0x40b091||[]};});}})[_0xff72('0x2e')](respondWithResult(_0x4179f5,null))['catch'](handleError(_0x4179f5,null));};exports[_0xff72('0xc6')]=function(_0x1cf61b,_0x3d9c28,_0x40f113){return db[_0xff72('0x3b')][_0xff72('0x62')]({'where':{'id':_0x1cf61b[_0xff72('0xb3')]['id']}})[_0xff72('0x2e')](handleEntityNotFound(_0x3d9c28,null))[_0xff72('0x2e')](function(_0x87d340){if(_0x87d340){return _0x87d340[_0xff72('0xc6')](_0x1cf61b[_0xff72('0x3f')][_0xff72('0xbc')]);}})[_0xff72('0x2e')](respondWithStatusCode(_0x3d9c28,null))['catch'](handleError(_0x3d9c28,null));};exports[_0xff72('0xc7')]=function(_0x2710b4,_0x5bb4b1){var _0x3332d9=moment()[_0xff72('0xc8')]()['toString']();var _0x49bc75=path[_0xff72('0xc9')](config[_0xff72('0xca')],'server',_0xff72('0xcb'),_0xff72('0xcc'));var _0x4be2b8=path['join'](config[_0xff72('0xca')],_0xff72('0xcd'),_0xff72('0xcb'),_0xff72('0xce'));var _0x15ed67=path['join'](_0x49bc75,_0x3332d9);var _0x1d2311=util['format'](_0xff72('0xcf'),_0x2710b4[_0xff72('0xb3')]['id'],_0x3332d9);var _0x37d04f=path[_0xff72('0xc9')](_0x49bc75,_0x1d2311);var _0x4c07f5=[];_0x4c07f5['push']({'model':db[_0xff72('0xd0')],'as':'Attachment','raw':!![]});var _0x2331f7=[{'model':db['FaxMessage'],'as':_0xff72('0xd1'),'attributes':['id',_0xff72('0xb8'),'createdAt'],'include':_0x4c07f5}];return db[_0xff72('0x3b')]['find']({'where':{'id':_0x2710b4[_0xff72('0xb3')]['id']},'include':_0x2331f7})[_0xff72('0x2e')](handleEntityNotFound(_0x5bb4b1,null))[_0xff72('0x2e')](function(_0x21c6b3){if(_0x21c6b3&&_0x21c6b3['Messages']){var _0x408247=_0x21c6b3[_0xff72('0xd2')]({'plain':!![]});fs[_0xff72('0xd3')](_0x15ed67);for(var _0x58d652=0x0;_0x58d652<_0x408247[_0xff72('0xd1')][_0xff72('0x45')];_0x58d652++){var _0xa40c64=_0x408247[_0xff72('0xd1')][_0x58d652]['Attachment'];if(_0xa40c64){var _0x540dfe=path[_0xff72('0xc9')](_0x4be2b8,_0xa40c64[_0xff72('0xd4')]);if(fs['existsSync'](_0x540dfe)){fs[_0xff72('0xd5')](_0x540dfe)[_0xff72('0xd6')](fs[_0xff72('0xd7')](path[_0xff72('0xc9')](_0x15ed67,_0xa40c64['basename'])));}}}return BPromise[_0xff72('0x92')]()[_0xff72('0x2e')](function(){return new BPromise(function(_0xd919fa,_0x19dc9e){zipdir(_0x15ed67,{'saveTo':_0x37d04f},function(_0x4eb342,_0x11e1a1){if(_0x4eb342)return _0x19dc9e(_0x4eb342);return _0xd919fa(_0x11e1a1);});})['then'](function(){return new BPromise(function(_0x154c7c,_0xaa6c58){rimraf(_0x15ed67,function(_0x17250b){if(_0x17250b)_0xaa6c58(_0x17250b);return _0x154c7c();});});})[_0xff72('0x2e')](function(){return _0x5bb4b1['download'](_0x37d04f,_0x1d2311,function(_0x13c650){if(_0x13c650){console['log'](_0xff72('0xd8'),_0x13c650);}else{fs[_0xff72('0xd9')](_0x37d04f);}});});});}else{return _0x5bb4b1[_0xff72('0x21')](0xc8);}})[_0xff72('0xb1')](handleError(_0x5bb4b1,null));}; \ No newline at end of file +var _0x89c7=['transcript-%d-%s.zip','Attachment','Messages','get','basename','existsSync','pipe','createWriteStream','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','error','stack','name','Users','map','fullname','TagIds','Tags','split','push','FaxInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','field','from','u.id','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','select','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','tools_tags','expr','parseSearch','search','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','some','compact','isEmpty','forEach','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.FaxAccountId\x20IS\x20NULL','sequelize','length','toString','keyBy','merge','Account.key','a.mandatoryDisposition','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','catch','params','include','options','create','describe','addMessage','FaxMessage','ids','getMessages','findOne','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','omit','spread','Tag','findAll','color','emit','removeTags','download','unix','join','root','tmp','server','attachments'];(function(_0x5b87d0,_0x437ef0){var _0x22f71e=function(_0x325e9e){while(--_0x325e9e){_0x5b87d0['push'](_0x5b87d0['shift']());}};_0x22f71e(++_0x437ef0);}(_0x89c7,0xe5));var _0x789c=function(_0xdd0313,_0x251c2b){_0xdd0313=_0xdd0313-0x0;var _0x2bd7e8=_0x89c7[_0xdd0313];return _0x2bd7e8;};'use strict';var emlformat=require(_0x789c('0x0'));var rimraf=require(_0x789c('0x1'));var zipdir=require(_0x789c('0x2'));var jsonpatch=require(_0x789c('0x3'));var rp=require(_0x789c('0x4'));var moment=require(_0x789c('0x5'));var BPromise=require(_0x789c('0x6'));var Mustache=require('mustache');var util=require(_0x789c('0x7'));var path=require(_0x789c('0x8'));var sox=require(_0x789c('0x9'));var csv=require(_0x789c('0xa'));var ejs=require(_0x789c('0xb'));var fs=require('fs');var fs_extra=require(_0x789c('0xc'));var _=require(_0x789c('0xd'));var squel=require(_0x789c('0xe'));var crypto=require('crypto');var jsforce=require(_0x789c('0xf'));var deskjs=require(_0x789c('0x10'));var toCsv=require(_0x789c('0xa'));var querystring=require('querystring');var Papa=require(_0x789c('0x11'));var Redis=require(_0x789c('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x789c('0x13'));var hardwareService=require(_0x789c('0x14'));var logger=require('../../config/logger')(_0x789c('0x15'));var utils=require(_0x789c('0x16'));var config=require(_0x789c('0x17'));var licenseUtil=require(_0x789c('0x18'));var db=require(_0x789c('0x19'))['db'];config[_0x789c('0x1a')]=_[_0x789c('0x1b')](config[_0x789c('0x1a')],{'host':_0x789c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x789c('0x1a')]));require(_0x789c('0x1d'))[_0x789c('0x1e')](socket);function respondWithStatusCode(_0x46d0db,_0x55989b){_0x55989b=_0x55989b||0xcc;return function(_0x4ea48f){if(_0x4ea48f){return _0x46d0db[_0x789c('0x1f')](_0x55989b);}return _0x46d0db[_0x789c('0x20')](_0x55989b)['end']();};}function respondWithResult(_0x4154e3,_0x4d7858){_0x4d7858=_0x4d7858||0xc8;return function(_0x307fda){if(_0x307fda){return _0x4154e3[_0x789c('0x20')](_0x4d7858)[_0x789c('0x21')](_0x307fda);}};}function respondWithFilteredResult(_0x117366,_0x588940){return function(_0x302069){if(_0x302069){var _0x2cbbba=typeof _0x588940['offset']===_0x789c('0x22')&&typeof _0x588940[_0x789c('0x23')]===_0x789c('0x22');var _0x390573=_0x302069[_0x789c('0x24')];var _0x25e609=_0x2cbbba?0x0:_0x588940['offset'];var _0x587653=_0x2cbbba?_0x302069[_0x789c('0x24')]:_0x588940[_0x789c('0x25')]+_0x588940[_0x789c('0x23')];var _0x1a8c36;if(_0x587653>=_0x390573){_0x587653=_0x390573;_0x1a8c36=0xc8;}else{_0x1a8c36=0xce;}_0x117366[_0x789c('0x20')](_0x1a8c36);return _0x117366[_0x789c('0x26')](_0x789c('0x27'),_0x25e609+'-'+_0x587653+'/'+_0x390573)[_0x789c('0x21')](_0x302069);}return null;};}function patchUpdates(_0x1c06aa){return function(_0x45372a){try{jsonpatch['apply'](_0x45372a,_0x1c06aa,!![]);}catch(_0x1d8dc4){return BPromise[_0x789c('0x28')](_0x1d8dc4);}return _0x45372a['save']();};}function saveUpdates(_0x5bf461,_0x5c70bc){return function(_0x21fb98){if(_0x21fb98){return _0x21fb98[_0x789c('0x29')](_0x5bf461)[_0x789c('0x2a')](function(_0x5eac64){return _0x5eac64;});}return null;};}function removeEntity(_0x3ddf21,_0x4e663e){return function(_0x1212b3){if(_0x1212b3){return _0x1212b3[_0x789c('0x2b')]()['then'](function(){_0x3ddf21['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aa9e4,_0x239c80){return function(_0x513ecc){if(!_0x513ecc){_0x3aa9e4[_0x789c('0x1f')](0x194);}return _0x513ecc;};}function handleError(_0x40ee70,_0xb12040){_0xb12040=_0xb12040||0x1f4;return function(_0xb8275f){logger[_0x789c('0x2c')](_0xb8275f[_0x789c('0x2d')]);if(_0xb8275f['name']){delete _0xb8275f[_0x789c('0x2e')];}_0x40ee70[_0x789c('0x20')](_0xb12040)['send'](_0xb8275f);};}function getInteractionUsers(_0x612df3,_0x242b45){return new BPromise(function(_0x1428ca,_0x26277e){try{if(_0x242b45[_0x612df3['id']]){_0x612df3[_0x789c('0x2f')]=_[_0x789c('0x30')](_0x242b45[_0x612df3['id']],function(_0x492e59){return{'id':_0x492e59['id'],'fullname':_0x492e59[_0x789c('0x31')]};});}}catch(_0x51f2ea){_0x26277e(_0x51f2ea);}_0x1428ca(_0x612df3);});}function getInteractionTags(_0x30a4fe,_0x80687e){return new BPromise(function(_0x173fe6,_0x77d7e3){try{if(_0x30a4fe[_0x789c('0x32')]){_0x30a4fe[_0x789c('0x33')]=[];_0x30a4fe[_0x789c('0x32')][_0x789c('0x34')](',')['forEach'](function(_0x3f2a0d){_0x30a4fe[_0x789c('0x33')][_0x789c('0x35')](_0x80687e[_0x3f2a0d]);});}delete _0x30a4fe[_0x789c('0x32')];}catch(_0xdf0067){_0x77d7e3(_0xdf0067);}_0x173fe6(_0x30a4fe);});}function updateFaxInteraction(_0x54213c,_0x28bdc0,_0x19a0c4){return new BPromise(function(_0x5aaa82,_0x5adef1){return getInteractionUsers(_0x54213c,_0x19a0c4)[_0x789c('0x2a')](function(_0x116959){return getInteractionTags(_0x116959,_0x28bdc0);})[_0x789c('0x2a')](function(_0x30aa46){_0x5aaa82(_0x30aa46);})['catch'](function(_0x2d2d76){_0x5adef1(_0x2d2d76);});});}exports['index']=function(_0x2ca390,_0x34cbc9){var _0x292695={},_0x4bf1e2={},_0x3f2092={'count':0x0,'rows':[]};var _0x4367bc=_[_0x789c('0x30')](db[_0x789c('0x36')][_0x789c('0x37')],function(_0x23a70a){return{'name':_0x23a70a[_0x789c('0x38')],'type':_0x23a70a[_0x789c('0x39')][_0x789c('0x3a')]};});_0x4bf1e2[_0x789c('0x3b')]=_[_0x789c('0x30')](_0x4367bc,'name');_0x4bf1e2[_0x789c('0x3c')]=_[_0x789c('0x3d')](_0x2ca390[_0x789c('0x3c')]);_0x4bf1e2[_0x789c('0x3e')]=_[_0x789c('0x3f')](_0x4bf1e2[_0x789c('0x3b')],_0x4bf1e2['query']);_0x292695['attributes']=_[_0x789c('0x3f')](_0x4bf1e2[_0x789c('0x3b')],qs[_0x789c('0x40')](_0x2ca390[_0x789c('0x3c')][_0x789c('0x40')]));_0x292695[_0x789c('0x41')]=_0x292695[_0x789c('0x41')]['length']?_0x292695[_0x789c('0x41')]:_0x4bf1e2[_0x789c('0x3b')];if(!_0x2ca390[_0x789c('0x3c')][_0x789c('0x42')](_0x789c('0x43'))){_0x292695[_0x789c('0x23')]=qs[_0x789c('0x23')](_0x2ca390[_0x789c('0x3c')]['limit']);_0x292695[_0x789c('0x25')]=qs[_0x789c('0x25')](_0x2ca390[_0x789c('0x3c')]['offset']);}_0x292695[_0x789c('0x44')]=qs[_0x789c('0x45')](_0x2ca390[_0x789c('0x3c')][_0x789c('0x45')]);_0x292695[_0x789c('0x46')]=qs[_0x789c('0x3e')](_[_0x789c('0x47')](_0x2ca390[_0x789c('0x3c')],_0x4bf1e2[_0x789c('0x3e')]),_0x4367bc);var _0x535196=[];var _0x48eed9=squel['select']()[_0x789c('0x48')]('id')['field'](_0x789c('0x2e'))[_0x789c('0x48')]('color')[_0x789c('0x49')]('tools_tags');var _0x4cfb22=squel['select']()['field'](_0x789c('0x4a'))[_0x789c('0x48')]('u.fullname')[_0x789c('0x48')](_0x789c('0x4b'))[_0x789c('0x49')](_0x789c('0x4c'),'ui')[_0x789c('0x4d')]('users','u',_0x789c('0x4e'));var _0x227aa3=squel[_0x789c('0x4f')]()['from'](_0x789c('0x50'),'i')[_0x789c('0x4d')](_0x789c('0x51'),'c',_0x789c('0x52'))[_0x789c('0x4d')](_0x789c('0x53'),'o',_0x789c('0x54'))[_0x789c('0x4d')](_0x789c('0x55'),'a',_0x789c('0x56'))['left_join'](_0x789c('0x57'),'me',_0x789c('0x58'))[_0x789c('0x4d')]('fax_interaction_has_tags','it',_0x789c('0x59'))[_0x789c('0x4d')](_0x789c('0x5a'),'t','t.id\x20=\x20it.TagId');var _0x594e83=squel[_0x789c('0x5b')]();var _0x517c44=[];var _0x1b6cc3=squel['expr']();var _0x4bedb6;if(_0x2ca390[_0x789c('0x3c')]['search']){_0x4bedb6=as[_0x789c('0x5c')](_0x2ca390['query'][_0x789c('0x5d')]);var _0x5b8f1e=_0x4bedb6['sqlOperator'];for(var _0x4176d2=0x0;_0x4176d2<_0x4bedb6[_0x789c('0x5e')]['length'];_0x4176d2++){var _0x3f8390=_0x4bedb6[_0x789c('0x5e')][_0x4176d2];var _0x1d181d='i';var _0x11aa64=_['find'](_0x4367bc,['name',_0x3f8390[_0x789c('0x48')]]);if(!_0x11aa64){switch(_0x3f8390[_0x789c('0x48')]){case _0x789c('0x5f'):if(_0x3f8390[_0x789c('0x60')]==0x1){_0x227aa3[_0x789c('0x61')]('`'+_0x3f8390['field']+_0x789c('0x62'));}else{_0x227aa3[_0x789c('0x61')]('`'+_0x3f8390[_0x789c('0x48')]+_0x789c('0x63'));}break;case'Contact':if(_0x3f8390[_0x789c('0x64')]===_0x789c('0x65')){if(_0x3f8390[_0x789c('0x60')][_0x789c('0x34')]('\x20')['length']>0x1){_0x594e83[_0x5b8f1e](_0x789c('0x66'),qs[_0x789c('0x67')](_0x3f8390[_0x789c('0x60')]),null);}else{var _0x484e9b='%'+_0x3f8390[_0x789c('0x60')]+'%';_0x594e83[_0x5b8f1e](_0x789c('0x68'),_0x484e9b,_0x484e9b,_0x484e9b);}}else{_0x11aa64=_[_0x789c('0x69')](_0x4367bc,[_0x789c('0x2e'),_0x789c('0x6a')]);_0x3f8390[_0x789c('0x48')]=_0x789c('0x6a');_0x26e3e3=as['buildExpression'](_0x1d181d,_0x11aa64[_0x789c('0x39')],_0x3f8390);_0x594e83[_0x5b8f1e](_0x26e3e3[_0x789c('0x6b')],_0x26e3e3[_0x789c('0x60')][_0x789c('0x6c')],_0x26e3e3[_0x789c('0x60')][_0x789c('0x6d')]);}break;case'Tag':var _0x1ea5d5=_0x3f8390[_0x789c('0x60')]['split'](',')[_0x789c('0x30')](function(_0x23b8c5){return Number(_0x23b8c5);});_0x1ea5d5['forEach'](function(_0x4d48c4){_0x1b6cc3['or'](_0x789c('0x6e'),'%,'+_0x4d48c4+',%');});_0x517c44=_[_0x789c('0x6f')](_0x517c44,_0x1ea5d5);break;case _0x789c('0x70'):if(_0x3f8390[_0x789c('0x64')]===_0x789c('0x65')){_0x594e83[_0x5b8f1e](_0x789c('0x71'),'%'+_0x3f8390[_0x789c('0x60')]+'%',null);}else{_0x11aa64=_[_0x789c('0x69')](_0x4367bc,['name',_0x789c('0x72')]);_0x3f8390['field']='UserId';_0x26e3e3=as[_0x789c('0x73')](_0x1d181d,_0x11aa64[_0x789c('0x39')],_0x3f8390);_0x594e83[_0x5b8f1e](_0x26e3e3[_0x789c('0x6b')],_0x26e3e3['value'][_0x789c('0x6c')],_0x26e3e3['value']['end']);}break;case _0x789c('0x74'):_0x26e3e3=as['buildExpression']('me',null,_0x3f8390);_0x594e83[_0x5b8f1e](_0x26e3e3[_0x789c('0x6b')],_0x26e3e3[_0x789c('0x60')][_0x789c('0x6c')],_0x26e3e3[_0x789c('0x60')][_0x789c('0x6d')]);break;}}else{var _0x26e3e3=as[_0x789c('0x73')](_0x1d181d,_0x11aa64['type'],_0x3f8390);_0x594e83[_0x5b8f1e](_0x26e3e3[_0x789c('0x6b')],_0x26e3e3[_0x789c('0x60')][_0x789c('0x6c')],_0x26e3e3[_0x789c('0x60')][_0x789c('0x6d')]);}}}else{var _0x20af3c=_(_0x2ca390[_0x789c('0x3c')])[_0x789c('0x3d')]()[_0x789c('0x30')](function(_0x1482e4){return _[_0x789c('0x75')](_0x4367bc,[_0x789c('0x2e'),_0x1482e4])?_0x1482e4:undefined;})[_0x789c('0x76')]()['value']();if(!_[_0x789c('0x77')](_0x20af3c)){_0x20af3c[_0x789c('0x78')](function(_0x1bdf85){if(_0x1bdf85===_0x789c('0x79')){_0x227aa3[_0x789c('0x46')](_0x789c('0x7a'),[][_0x789c('0x7b')](_0x2ca390[_0x789c('0x3c')][_0x1bdf85]));}else if(_0x1bdf85===_0x789c('0x7c')){var _0x1d062a=JSON[_0x789c('0x7d')](_0x2ca390[_0x789c('0x3c')][_0x1bdf85])[_0x789c('0x7e')];var _0x18694c=JSON[_0x789c('0x7d')](_0x2ca390['query'][_0x1bdf85])['$lte'];_0x227aa3[_0x789c('0x46')](_0x789c('0x7f'),_0x1d062a,_0x18694c);}else{if(_0x2ca390['query'][_0x1bdf85]===_0x789c('0x80')){_0x227aa3['where']('i.'+_0x1bdf85+_0x789c('0x81'));}else{_0x227aa3[_0x789c('0x46')]('i.'+_0x1bdf85+_0x789c('0x82'),_0x2ca390[_0x789c('0x3c')][_0x1bdf85]);}}});}if(_0x2ca390[_0x789c('0x3c')][_0x789c('0x83')]){if(_0x2ca390[_0x789c('0x3c')][_0x789c('0x83')]==0x1){_0x227aa3[_0x789c('0x61')](_0x789c('0x84'));}else{_0x227aa3[_0x789c('0x61')](_0x789c('0x85'));}}if(_0x2ca390[_0x789c('0x3c')][_0x789c('0x86')]){_0x517c44=_[_0x789c('0x87')](_0x2ca390[_0x789c('0x3c')][_0x789c('0x86')])?_0x2ca390[_0x789c('0x3c')][_0x789c('0x86')]:new Array(_0x2ca390['query'][_0x789c('0x86')]);_0x517c44[_0x789c('0x78')](function(_0x3b6eef){_0x1b6cc3['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3b6eef+',%');});}if(_0x2ca390[_0x789c('0x3c')][_0x789c('0x88')]){var _0x5b0020=_0x2ca390['query']['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5b0020)){_0x594e83['or'](_0x789c('0x89'),_0x5b0020+'%')['or'](_0x789c('0x8a'),_0x5b0020+'%');}_0x594e83['or'](_0x789c('0x8b'),_0x5b0020+'%');}}_0x227aa3[_0x789c('0x46')](_0x594e83);_0x227aa3['group'](_0x789c('0x8c'));var _0x294bf3={'type':db[_0x789c('0x8d')][_0x789c('0x8e')]['SELECT'],'raw':!![]};var _0x22ceef=_0x227aa3[_0x789c('0x8f')]();_0x22ceef[_0x789c('0x48')]('i.id');_0x22ceef[_0x789c('0x48')](_0x789c('0x90'),_0x789c('0x5f'));if(_0x292695['order']){_0x292695['order'][_0x789c('0x78')](function(_0x21c4c7){var _0x227425=_0x21c4c7[0x0]===_0x789c('0x91')?_0x21c4c7[0x0]:'i.'+_0x21c4c7[0x0];_0x227aa3['order'](_0x227425,_0x21c4c7[0x1]===_0x789c('0x92')?![]:!![]);});}if(!_[_0x789c('0x77')](_0x517c44)){_0x227aa3['having'](_0x1b6cc3);_0x22ceef[_0x789c('0x46')](_0x789c('0x93'),_0x517c44);}BPromise[_0x789c('0x94')]()[_0x789c('0x2a')](function(){if(!_0x4bedb6){if(_0x2ca390[_0x789c('0x3c')][_0x789c('0x79')])return;_0x22ceef[_0x789c('0x46')](_0x789c('0x95'));_0x227aa3[_0x789c('0x46')](_0x789c('0x95'));return;}if(_0x2ca390[_0x789c('0x96')][_0x789c('0x97')]!==_0x789c('0x98'))return;return _0x2ca390[_0x789c('0x96')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x789c('0x2a')](function(_0x19d235){if(_[_0x789c('0x77')](_0x19d235)){_0x22ceef[_0x789c('0x46')](_0x789c('0x99'));_0x227aa3[_0x789c('0x46')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x22ceef[_0x789c('0x46')](_0x789c('0x7a'),_[_0x789c('0x30')](_0x19d235,'id'));_0x227aa3['where'](_0x789c('0x7a'),_['map'](_0x19d235,'id'));}});})[_0x789c('0x2a')](function(){if(_0x2ca390['user']['role']===_0x789c('0x98')&&!_0x4bedb6&&!_0x2ca390[_0x789c('0x3c')][_0x789c('0x79')])return[];return db[_0x789c('0x9a')][_0x789c('0x3c')](_0x22ceef['toString'](),_0x294bf3);})['then'](function(_0x288eaf){_0x3f2092[_0x789c('0x24')]=_0x288eaf[_0x789c('0x9b')];if(_0x3f2092[_0x789c('0x24')]===0x0)return[];return db[_0x789c('0x9a')]['query'](_0x48eed9[_0x789c('0x9c')](),_0x294bf3)[_0x789c('0x2a')](function(_0x500cdf){_0x535196=_[_0x789c('0x9d')](_0x500cdf,'id');_0x294bf3=_[_0x789c('0x9e')](_0x294bf3,{'model':db[_0x789c('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ca390['query'][_0x789c('0x40')]){_0x292695['attributes']['forEach'](function(_0x20507b){_0x227aa3['field']('i.'+_0x20507b);});}else{_0x227aa3[_0x789c('0x48')](_0x789c('0x90'),_0x789c('0x5f'));_0x227aa3['field']('a.key',_0x789c('0x9f'));_0x227aa3['field'](_0x789c('0xa0'),'Account.mandatoryDisposition');_0x227aa3[_0x789c('0x48')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x789c('0x91'));_0x227aa3[_0x789c('0x48')]('i.*');_0x227aa3[_0x789c('0x48')]('c.firstName',_0x789c('0xa1'));_0x227aa3[_0x789c('0x48')]('c.lastName',_0x789c('0xa2'));_0x227aa3[_0x789c('0x48')]('c.email',_0x789c('0xa3'));_0x227aa3[_0x789c('0x48')](_0x789c('0xa4'),_0x789c('0xa5'));_0x227aa3[_0x789c('0x48')](_0x789c('0xa6'),_0x789c('0xa7'));_0x227aa3[_0x789c('0x48')](_0x789c('0xa8'),_0x789c('0xa9'));_0x227aa3[_0x789c('0x48')](_0x789c('0xaa'),_0x789c('0xab'));_0x227aa3['field'](_0x789c('0xac'),_0x789c('0xad'));_0x227aa3[_0x789c('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x292695[_0x789c('0x23')])_0x227aa3['limit'](_0x292695[_0x789c('0x23')]);if(_0x292695['offset'])_0x227aa3[_0x789c('0x25')](_0x292695[_0x789c('0x25')]);return db[_0x789c('0x9a')][_0x789c('0x3c')](_0x227aa3[_0x789c('0x9c')](),_0x294bf3);})['then'](function(_0x5a1f91){if(_0x5a1f91['length']>0x0)_0x4cfb22[_0x789c('0x46')]('ui.FaxInteractionId\x20IN\x20?',_[_0x789c('0x30')](_0x5a1f91,'id'));return db[_0x789c('0x9a')][_0x789c('0x3c')](_0x4cfb22['toString'](),_0x294bf3)[_0x789c('0x2a')](function(_0x265ae4){var _0x38859f=_[_0x789c('0xae')](_0x265ae4,'FaxInteractionId');var _0x514061=[];_0x5a1f91[_0x789c('0x78')](function(_0x4a5e13){_0x514061[_0x789c('0x35')](updateFaxInteraction(_0x4a5e13,_0x535196,_0x38859f));});return BPromise['all'](_0x514061);});});})[_0x789c('0x2a')](function(_0x3e4c44){_0x3f2092['rows']=_0x3e4c44;return _0x3f2092;})['then'](respondWithFilteredResult(_0x34cbc9,_0x292695))[_0x789c('0xaf')](handleError(_0x34cbc9,null));};exports['show']=function(_0xd55f2f,_0x197329){var _0x11a1cc={'raw':![],'where':{'id':_0xd55f2f[_0x789c('0xb0')]['id']}},_0x4c190f={};_0x4c190f[_0x789c('0x3b')]=_[_0x789c('0x3d')](db['FaxInteraction'][_0x789c('0x37')]);_0x4c190f[_0x789c('0x3c')]=_[_0x789c('0x3d')](_0xd55f2f[_0x789c('0x3c')]);_0x4c190f[_0x789c('0x3e')]=_[_0x789c('0x3f')](_0x4c190f[_0x789c('0x3b')],_0x4c190f['query']);_0x11a1cc['attributes']=_[_0x789c('0x3f')](_0x4c190f[_0x789c('0x3b')],qs[_0x789c('0x40')](_0xd55f2f[_0x789c('0x3c')][_0x789c('0x40')]));_0x11a1cc['attributes']=_0x11a1cc['attributes'][_0x789c('0x9b')]?_0x11a1cc[_0x789c('0x41')]:_0x4c190f[_0x789c('0x3b')];if(_0xd55f2f['query']['includeAll']){_0x11a1cc[_0x789c('0xb1')]=[{'all':!![]}];}_0x11a1cc=_[_0x789c('0x9e')]({},_0x11a1cc,_0xd55f2f[_0x789c('0xb2')]);return db[_0x789c('0x36')][_0x789c('0x69')](_0x11a1cc)[_0x789c('0x2a')](handleEntityNotFound(_0x197329,null))[_0x789c('0x2a')](respondWithResult(_0x197329,null))['catch'](handleError(_0x197329,null));};exports['create']=function(_0x444cd1,_0x5f2390){return db[_0x789c('0x36')][_0x789c('0xb3')](_0x444cd1[_0x789c('0x74')],{})[_0x789c('0x2a')](respondWithResult(_0x5f2390,0xc9))[_0x789c('0xaf')](handleError(_0x5f2390,null));};exports['update']=function(_0x12050b,_0x228aef){if(_0x12050b[_0x789c('0x74')]['id']){delete _0x12050b[_0x789c('0x74')]['id'];}return db[_0x789c('0x36')][_0x789c('0x69')]({'where':{'id':_0x12050b[_0x789c('0xb0')]['id']}})[_0x789c('0x2a')](handleEntityNotFound(_0x228aef,null))['then'](saveUpdates(_0x12050b['body'],null))[_0x789c('0x2a')](respondWithResult(_0x228aef,null))['catch'](handleError(_0x228aef,null));};exports[_0x789c('0x2b')]=function(_0x3c0f15,_0x118888){return db[_0x789c('0x36')][_0x789c('0x69')]({'where':{'id':_0x3c0f15[_0x789c('0xb0')]['id']}})[_0x789c('0x2a')](handleEntityNotFound(_0x118888,null))['then'](removeEntity(_0x118888,null))[_0x789c('0xaf')](handleError(_0x118888,null));};exports[_0x789c('0xb4')]=function(_0x23bf16,_0x547609){return db['FaxInteraction'][_0x789c('0xb4')]()[_0x789c('0x2a')](respondWithResult(_0x547609,null))[_0x789c('0xaf')](handleError(_0x547609,null));};exports[_0x789c('0xb5')]=function(_0x1db93d,_0x1454b4,_0x26c6fd){return db[_0x789c('0xb6')][_0x789c('0x69')]({'where':{'id':_0x1db93d[_0x789c('0xb0')]['id']}})['then'](handleEntityNotFound(_0x1454b4,null))['then'](function(_0x5ab6a6){if(_0x5ab6a6){return _0x5ab6a6[_0x789c('0xb5')](_0x1db93d[_0x789c('0x74')][_0x789c('0xb7')],_['omit'](_0x1db93d[_0x789c('0x74')],[_0x789c('0xb7'),'id'])||{});}})[_0x789c('0x2a')](respondWithResult(_0x1454b4,null))['catch'](handleError(_0x1454b4,null));};exports[_0x789c('0xb8')]=function(_0x1d9015,_0x362061,_0x10527f){var _0x10e3c8={'raw':![],'where':{}};var _0x14ea96={};var _0xfa008b={'count':0x0,'rows':[]};return db[_0x789c('0x36')][_0x789c('0xb9')]({'where':{'id':_0x1d9015['params']['id']}})[_0x789c('0x2a')](handleEntityNotFound(_0x362061,null))[_0x789c('0x2a')](function(_0x122d9f){if(_0x122d9f){_0x14ea96[_0x789c('0x3b')]=_[_0x789c('0x3d')](db['FaxMessage']['rawAttributes']);_0x14ea96[_0x789c('0x3c')]=_[_0x789c('0x3d')](_0x1d9015['query']);_0x14ea96[_0x789c('0x3e')]=_[_0x789c('0x3f')](_0x14ea96['model'],_0x14ea96[_0x789c('0x3c')]);_0x10e3c8[_0x789c('0x41')]=_[_0x789c('0x3f')](_0x14ea96['model'],qs['fields'](_0x1d9015[_0x789c('0x3c')][_0x789c('0x40')]));_0x10e3c8[_0x789c('0x41')]=_0x10e3c8['attributes'][_0x789c('0x9b')]?_0x10e3c8[_0x789c('0x41')]:_0x14ea96['model'];if(!_0x1d9015[_0x789c('0x3c')][_0x789c('0x42')]('nolimit')){_0x10e3c8[_0x789c('0x23')]=qs[_0x789c('0x23')](_0x1d9015['query'][_0x789c('0x23')]);_0x10e3c8['offset']=qs[_0x789c('0x25')](_0x1d9015[_0x789c('0x3c')][_0x789c('0x25')]);}_0x10e3c8[_0x789c('0x44')]=qs[_0x789c('0x45')](_0x1d9015['query'][_0x789c('0x45')]);_0x10e3c8[_0x789c('0x46')]=qs[_0x789c('0x3e')](_[_0x789c('0x47')](_0x1d9015[_0x789c('0x3c')],_0x14ea96[_0x789c('0x3e')]));_0x10e3c8[_0x789c('0x46')][_0x789c('0xba')]=_0x122d9f['id'];if(_0x1d9015['query'][_0x789c('0x88')]){_0x10e3c8[_0x789c('0x46')]=_[_0x789c('0x9e')](_0x10e3c8['where'],{'$or':_[_0x789c('0x30')](_0x10e3c8['attributes'],function(_0x5a8cb3){var _0x5b498f={};_0x5b498f[_0x5a8cb3]={'$like':'%'+_0x1d9015['query'][_0x789c('0x88')]+'%'};return _0x5b498f;})});}if(_0x1d9015[_0x789c('0x3c')][_0x789c('0x7e')]){var _0x1b1927=_0x1d9015[_0x789c('0x3c')][_0x789c('0x7e')][_0x789c('0x34')](',');var _0x51602d={};_0x51602d[_0x1b1927[0x0]]={'$gte':moment(_0x1b1927[0x1])[_0x789c('0xbb')](_0x789c('0xbc'))};_0x10e3c8['where']=_['merge'](_0x10e3c8[_0x789c('0x46')],_0x51602d);}_0x10e3c8=_[_0x789c('0x9e')]({},_0x10e3c8,_0x1d9015['options']);return db[_0x789c('0xb6')][_0x789c('0x24')]({'where':_0x10e3c8['where']})['then'](function(_0x70b8c8){_0xfa008b[_0x789c('0x24')]=_0x70b8c8;if(_0x1d9015[_0x789c('0x3c')][_0x789c('0xbd')]){_0x10e3c8[_0x789c('0xb1')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x10e3c8);})[_0x789c('0x2a')](function(_0x5d19f6){_0xfa008b[_0x789c('0xbe')]=_0x5d19f6;return _0xfa008b;});}})['then'](respondWithFilteredResult(_0x362061,_0x10e3c8))['catch'](handleError(_0x362061,null));};exports[_0x789c('0xbf')]=function(_0x47a006,_0x959177,_0x2566fb){return db[_0x789c('0x36')][_0x789c('0x69')]({'where':{'id':_0x47a006['params']['id']}})[_0x789c('0x2a')](handleEntityNotFound(_0x959177,null))[_0x789c('0x2a')](function(_0xe84bb9){if(_0xe84bb9){return _0xe84bb9[_0x789c('0xc0')](_0x47a006['body'][_0x789c('0xb7')],_[_0x789c('0xc1')](_0x47a006[_0x789c('0x74')],[_0x789c('0xb7'),'id'])||{})[_0x789c('0xc2')](function(){return db[_0x789c('0xc3')][_0x789c('0xc4')]({'attributes':['id',_0x789c('0x2e'),_0x789c('0xc5')],'where':{'id':_0x47a006['body'][_0x789c('0xb7')]}});})[_0x789c('0x2a')](function(_0x487017){socket[_0x789c('0xc6')]('faxInteractionTags:save',{'id':Number(_0x47a006[_0x789c('0xb0')]['id']),'tags':_0x487017||[]});return{'id':Number(_0x47a006['params']['id']),'tags':_0x487017||[]};});}})[_0x789c('0x2a')](respondWithResult(_0x959177,null))[_0x789c('0xaf')](handleError(_0x959177,null));};exports[_0x789c('0xc7')]=function(_0x46d93e,_0x4cc280,_0x1af5b5){return db[_0x789c('0x36')][_0x789c('0x69')]({'where':{'id':_0x46d93e[_0x789c('0xb0')]['id']}})[_0x789c('0x2a')](handleEntityNotFound(_0x4cc280,null))[_0x789c('0x2a')](function(_0x5859b1){if(_0x5859b1){return _0x5859b1[_0x789c('0xc7')](_0x46d93e['query']['ids']);}})['then'](respondWithStatusCode(_0x4cc280,null))[_0x789c('0xaf')](handleError(_0x4cc280,null));};exports[_0x789c('0xc8')]=function(_0xb1b289,_0x4743c3){var _0x5c219e=moment()[_0x789c('0xc9')]()[_0x789c('0x9c')]();var _0x2b9685=path[_0x789c('0xca')](config[_0x789c('0xcb')],'server','files',_0x789c('0xcc'));var _0x40ebf7=path['join'](config[_0x789c('0xcb')],_0x789c('0xcd'),'files',_0x789c('0xce'));var _0x136f12=path['join'](_0x2b9685,_0x5c219e);var _0x19309c=util[_0x789c('0xbb')](_0x789c('0xcf'),_0xb1b289[_0x789c('0xb0')]['id'],_0x5c219e);var _0x358b75=path['join'](_0x2b9685,_0x19309c);var _0x38469f=[];_0x38469f[_0x789c('0x35')]({'model':db[_0x789c('0xd0')],'as':_0x789c('0xd0'),'raw':!![]});var _0x14bbc0=[{'model':db[_0x789c('0xb6')],'as':'Messages','attributes':['id',_0x789c('0x74'),_0x789c('0x7c')],'include':_0x38469f}];return db[_0x789c('0x36')][_0x789c('0x69')]({'where':{'id':_0xb1b289[_0x789c('0xb0')]['id']},'include':_0x14bbc0})['then'](handleEntityNotFound(_0x4743c3,null))[_0x789c('0x2a')](function(_0x194639){if(_0x194639&&_0x194639[_0x789c('0xd1')]){var _0x25496e=_0x194639[_0x789c('0xd2')]({'plain':!![]});fs['mkdirSync'](_0x136f12);for(var _0x80653b=0x0;_0x80653b<_0x25496e[_0x789c('0xd1')]['length'];_0x80653b++){var _0x436227=_0x25496e[_0x789c('0xd1')][_0x80653b][_0x789c('0xd0')];if(_0x436227){var _0x115649=path['join'](_0x40ebf7,_0x436227[_0x789c('0xd3')]);if(fs[_0x789c('0xd4')](_0x115649)){fs['createReadStream'](_0x115649)[_0x789c('0xd5')](fs[_0x789c('0xd6')](path['join'](_0x136f12,_0x436227['basename'])));}}}return BPromise[_0x789c('0x94')]()['then'](function(){return new BPromise(function(_0x20b6e4,_0x571f71){zipdir(_0x136f12,{'saveTo':_0x358b75},function(_0x2e7a50,_0x285a18){if(_0x2e7a50)return _0x571f71(_0x2e7a50);return _0x20b6e4(_0x285a18);});})[_0x789c('0x2a')](function(){return new BPromise(function(_0x56d7d9,_0x533c85){rimraf(_0x136f12,function(_0x59a5af){if(_0x59a5af)_0x533c85(_0x59a5af);return _0x56d7d9();});});})[_0x789c('0x2a')](function(){return _0x4743c3['download'](_0x358b75,_0x19309c,function(_0xbc48b3){if(_0xbc48b3){console[_0x789c('0xd7')](_0x789c('0xd8'),_0xbc48b3);}else{fs[_0x789c('0xd9')](_0x358b75);}});});});}else{return _0x4743c3[_0x789c('0x1f')](0xc8);}})[_0x789c('0xaf')](handleError(_0x4743c3,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 8978437..baa6ee5 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 _0x3fc3=['then','setDataValue','map','findAll','length','emit','hook','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0x436017,_0x47c412){var _0x50ed01=function(_0x1dd020){while(--_0x1dd020){_0x436017['push'](_0x436017['shift']());}};_0x50ed01(++_0x47c412);}(_0x3fc3,0xbb));var _0x33fc=function(_0x535059,_0x5d8a01){_0x535059=_0x535059-0x0;var _0x221e22=_0x3fc3[_0x535059];return _0x221e22;};'use strict';var EventEmitter=require(_0x33fc('0x0'));var FaxInteraction=require(_0x33fc('0x1'))['db'][_0x33fc('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x33fc('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x33fc('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x33fc('0x5'),'afterDestroy':_0x33fc('0x6')};function emitEvent(_0x32846d){return function(_0x136943,_0x264d45,_0x2e88ab){_0x136943[_0x33fc('0x7')]({'attributes':['id'],'raw':!![]})[_0x33fc('0x8')](function(_0x3cb0ed){_0x136943[_0x33fc('0x9')]('Users',_0x3cb0ed[_0x33fc('0xa')](function(_0x3b3faa){return{'id':_0x3b3faa['id']};}));return FaxMessage[_0x33fc('0xb')]({'where':{'FaxInteractionId':_0x136943['id'],'direction':'in','read':![]},'raw':!![]});})[_0x33fc('0x8')](function(_0x17c988){_0x136943[_0x33fc('0x9')]('unreadMessages',_0x17c988[_0x33fc('0xc')]);FaxInteractionEvents[_0x33fc('0xd')](_0x32846d+':'+_0x136943['id'],_0x136943);FaxInteractionEvents[_0x33fc('0xd')](_0x32846d,_0x136943);_0x2e88ab(null);})['catch'](_0x2e88ab(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x33fc('0xe')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0xe0a9=['Users','findAll','unreadMessages','length','emit','catch','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','getUsers','then','setDataValue'];(function(_0x316708,_0x30fa38){var _0x11cd4c=function(_0x36911e){while(--_0x36911e){_0x316708['push'](_0x316708['shift']());}};_0x11cd4c(++_0x30fa38);}(_0xe0a9,0x117));var _0x9e0a=function(_0x4804d7,_0x56ef10){_0x4804d7=_0x4804d7-0x0;var _0x532259=_0xe0a9[_0x4804d7];return _0x532259;};'use strict';var EventEmitter=require(_0x9e0a('0x0'));var FaxInteraction=require(_0x9e0a('0x1'))['db'][_0x9e0a('0x2')];var FaxMessage=require(_0x9e0a('0x1'))['db'][_0x9e0a('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x9e0a('0x4')](0x0);var events={'afterCreate':_0x9e0a('0x5'),'afterUpdate':_0x9e0a('0x6'),'afterDestroy':'remove'};function emitEvent(_0x1ea900){return function(_0x6cf865,_0x3b557f,_0x3ab4b7){_0x6cf865[_0x9e0a('0x7')]({'attributes':['id'],'raw':!![]})[_0x9e0a('0x8')](function(_0x37d671){_0x6cf865[_0x9e0a('0x9')](_0x9e0a('0xa'),_0x37d671['map'](function(_0x214be2){return{'id':_0x214be2['id']};}));return FaxMessage[_0x9e0a('0xb')]({'where':{'FaxInteractionId':_0x6cf865['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9e0a('0x8')](function(_0x15753c){_0x6cf865[_0x9e0a('0x9')](_0x9e0a('0xc'),_0x15753c[_0x9e0a('0xd')]);FaxInteractionEvents[_0x9e0a('0xe')](_0x1ea900+':'+_0x6cf865['id'],_0x6cf865);FaxInteractionEvents[_0x9e0a('0xe')](_0x1ea900,_0x6cf865);_0x3ab4b7(null);})[_0x9e0a('0xf')](_0x3ab4b7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x9e0a('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 f8c347d..807fa6b 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 _0xf478=['rimraf','./faxInteraction.attributes','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment'];(function(_0x2d25b9,_0x37a818){var _0x54020f=function(_0x353252){while(--_0x353252){_0x2d25b9['push'](_0x2d25b9['shift']());}};_0x54020f(++_0x37a818);}(_0xf478,0xbf));var _0x8f47=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xf478[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require(_0x8f47('0x0'));var util=require(_0x8f47('0x1'));var logger=require(_0x8f47('0x2'))(_0x8f47('0x3'));var moment=require(_0x8f47('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8f47('0x5'));var config=require('../../config/environment');var attributes=require(_0x8f47('0x6'));module['exports']=function(_0x1b5bc3,_0x36e5ea){return _0x1b5bc3['define'](_0x8f47('0x7'),attributes,{'tableName':_0x8f47('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5097f6,_0x106b65,_0x2f25b1){if(_0x5097f6[_0x8f47('0x9')](_0x8f47('0xa'))){_0x5097f6[_0x8f47('0xb')]=moment()[_0x8f47('0xc')](_0x8f47('0xd'));}_0x2f25b1(null,_0x5097f6);}}});}; \ No newline at end of file +var _0xaf79=['fax_interactions','changed','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','FaxInteraction'];(function(_0x44d1d9,_0x172d77){var _0x4e3a07=function(_0x20b2e1){while(--_0x20b2e1){_0x44d1d9['push'](_0x44d1d9['shift']());}};_0x4e3a07(++_0x172d77);}(_0xaf79,0xe4));var _0x9af7=function(_0x3cc18a,_0x4383e2){_0x3cc18a=_0x3cc18a-0x0;var _0x341d22=_0xaf79[_0x3cc18a];return _0x341d22;};'use strict';var _=require(_0x9af7('0x0'));var util=require(_0x9af7('0x1'));var logger=require(_0x9af7('0x2'))(_0x9af7('0x3'));var moment=require(_0x9af7('0x4'));var BPromise=require(_0x9af7('0x5'));var rp=require(_0x9af7('0x6'));var fs=require('fs');var path=require(_0x9af7('0x7'));var rimraf=require(_0x9af7('0x8'));var config=require(_0x9af7('0x9'));var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x598b25,_0x293823){return _0x598b25[_0x9af7('0xa')](_0x9af7('0xb'),attributes,{'tableName':_0x9af7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1d2886,_0x45ed1a,_0x395bc5){if(_0x1d2886[_0x9af7('0xd')](_0x9af7('0xe'))){_0x1d2886['closedAt']=moment()['format'](_0x9af7('0xf'));}_0x395bc5(null,_0x1d2886);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 33cbdbf..7486a93 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 _0x52ad=['addTags','body','omit','spread','AddTags','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','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','error','message','result','catch','update','options','raw','where','attributes','limit','UpdateFaxInteraction','stringify','AddTagsToFaxInteraction','FaxInteraction','find'];(function(_0x30a14c,_0x4177a5){var _0x3df498=function(_0x436f90){while(--_0x436f90){_0x30a14c['push'](_0x30a14c['shift']());}};_0x3df498(++_0x4177a5);}(_0x52ad,0x17f));var _0xd52a=function(_0x26d028,_0x3d0241){_0x26d028=_0x26d028-0x0;var _0x23a210=_0x52ad[_0x26d028];return _0x23a210;};'use strict';var _=require('lodash');var util=require(_0xd52a('0x0'));var moment=require('moment');var BPromise=require(_0xd52a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd52a('0x2'));var db=require(_0xd52a('0x3'))['db'];var utils=require(_0xd52a('0x4'));var logger=require(_0xd52a('0x5'))(_0xd52a('0x6'));var config=require(_0xd52a('0x7'));var jayson=require(_0xd52a('0x8'));var client=jayson[_0xd52a('0x9')]['http']({'port':0x232a});config[_0xd52a('0xa')]=_['defaults'](config[_0xd52a('0xa')],{'host':_0xd52a('0xb'),'port':0x18eb});var socket=require(_0xd52a('0xc'))(new Redis(config[_0xd52a('0xa')]));require(_0xd52a('0xd'))[_0xd52a('0xe')](socket);function respondWithRpcPromise(_0x5d0ef9,_0x605009,_0xd08dd7){return new BPromise(function(_0x547294,_0x2595fa){return client[_0xd52a('0xf')](_0x5d0ef9,_0xd08dd7)[_0xd52a('0x10')](function(_0x4b798d){logger[_0xd52a('0x11')](_0xd52a('0x12'),_0x605009,_0xd52a('0x13'));logger[_0xd52a('0x14')](_0xd52a('0x15'),_0x605009,_0xd52a('0x13'),JSON['stringify'](_0x4b798d));if(_0x4b798d[_0xd52a('0x16')]){if(_0x4b798d[_0xd52a('0x16')]['code']===0x1f4){logger[_0xd52a('0x16')](_0xd52a('0x12'),_0x605009,_0x4b798d[_0xd52a('0x16')][_0xd52a('0x17')]);return _0x2595fa(_0x4b798d[_0xd52a('0x16')][_0xd52a('0x17')]);}logger[_0xd52a('0x16')](_0xd52a('0x12'),_0x605009,_0x4b798d['error'][_0xd52a('0x17')]);return _0x547294(_0x4b798d['error'][_0xd52a('0x17')]);}else{logger[_0xd52a('0x11')](_0xd52a('0x12'),_0x605009,_0xd52a('0x13'));_0x547294(_0x4b798d[_0xd52a('0x18')][_0xd52a('0x17')]);}})[_0xd52a('0x19')](function(_0xe51c79){logger[_0xd52a('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x605009,_0xe51c79);_0x2595fa(_0xe51c79);});});}exports['UpdateFaxInteraction']=function(_0x3c6b30){var _0x6f3f6f=this;return new Promise(function(_0x51477e,_0x1c1fb7){return db['FaxInteraction'][_0xd52a('0x1a')](_0x3c6b30['body'],{'raw':_0x3c6b30['options']?_0x3c6b30[_0xd52a('0x1b')][_0xd52a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c6b30[_0xd52a('0x1b')]?_0x3c6b30[_0xd52a('0x1b')][_0xd52a('0x1d')]||null:null,'attributes':_0x3c6b30[_0xd52a('0x1b')]?_0x3c6b30[_0xd52a('0x1b')][_0xd52a('0x1e')]||null:null,'limit':_0x3c6b30['options']?_0x3c6b30[_0xd52a('0x1b')][_0xd52a('0x1f')]||null:null})[_0xd52a('0x10')](function(_0x50872e){logger[_0xd52a('0x11')](_0xd52a('0x20'),_0x3c6b30);logger['debug']('UpdateFaxInteraction',_0x3c6b30,JSON[_0xd52a('0x21')](_0x50872e));_0x51477e(_0x50872e);})[_0xd52a('0x19')](function(_0xd1694c){logger[_0xd52a('0x16')](_0xd52a('0x20'),_0xd1694c[_0xd52a('0x17')],_0x3c6b30);_0x1c1fb7(_0x6f3f6f[_0xd52a('0x16')](0x1f4,_0xd1694c[_0xd52a('0x17')]));});});};exports[_0xd52a('0x22')]=function(_0x346f6f){return new Promise(function(_0x3e0ed5,_0x115e15){return db[_0xd52a('0x23')][_0xd52a('0x24')]({'where':_0x346f6f['options']?_0x346f6f[_0xd52a('0x1b')][_0xd52a('0x1d')]||null:null})['then'](function(_0x56e46f){if(_0x56e46f){return _0x56e46f[_0xd52a('0x25')](_0x346f6f[_0xd52a('0x26')]['ids'],_[_0xd52a('0x27')](_0x346f6f[_0xd52a('0x26')],['ids','id'])||{});}})[_0xd52a('0x28')](function(_0x554523){logger['info'](_0xd52a('0x29'),_0x346f6f);logger[_0xd52a('0x14')](_0xd52a('0x29'),_0x346f6f,JSON[_0xd52a('0x21')](_0x554523));_0x3e0ed5(_0x554523);})[_0xd52a('0x19')](function(_0x2d8fee){logger[_0xd52a('0x16')]('AddTags',_0x2d8fee[_0xd52a('0x17')],_0x346f6f);_0x115e15(_this[_0xd52a('0x16')](0x1f4,_0x2d8fee[_0xd52a('0x17')]));});});}; \ No newline at end of file +var _0x9541=['rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','then','info','debug','AddTagsToFaxInteraction','where','addTags','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3bd7a2,_0x2cbe32){var _0x47c81e=function(_0xe779){while(--_0xe779){_0x3bd7a2['push'](_0x3bd7a2['shift']());}};_0x47c81e(++_0x2cbe32);}(_0x9541,0x141));var _0x1954=function(_0x7175c3,_0x59774a){_0x7175c3=_0x7175c3-0x0;var _0x582d7b=_0x9541[_0x7175c3];return _0x582d7b;};'use strict';var _=require(_0x1954('0x0'));var util=require(_0x1954('0x1'));var moment=require(_0x1954('0x2'));var BPromise=require('bluebird');var rs=require(_0x1954('0x3'));var fs=require('fs');var Redis=require(_0x1954('0x4'));var db=require(_0x1954('0x5'))['db'];var utils=require(_0x1954('0x6'));var logger=require('../../config/logger')(_0x1954('0x7'));var config=require('../../config/environment');var jayson=require(_0x1954('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x1954('0x9')]=_[_0x1954('0xa')](config['redis'],{'host':_0x1954('0xb'),'port':0x18eb});var socket=require(_0x1954('0xc'))(new Redis(config[_0x1954('0x9')]));require('./faxInteraction.socket')[_0x1954('0xd')](socket);function respondWithRpcPromise(_0x16720b,_0x346b24,_0x4ebea9){return new BPromise(function(_0x22975b,_0x54621f){return client[_0x1954('0xe')](_0x16720b,_0x4ebea9)['then'](function(_0x3c2211){logger['info'](_0x1954('0xf'),_0x346b24,_0x1954('0x10'));logger['debug'](_0x1954('0x11'),_0x346b24,_0x1954('0x10'),JSON[_0x1954('0x12')](_0x3c2211));if(_0x3c2211[_0x1954('0x13')]){if(_0x3c2211[_0x1954('0x13')][_0x1954('0x14')]===0x1f4){logger[_0x1954('0x13')](_0x1954('0xf'),_0x346b24,_0x3c2211[_0x1954('0x13')][_0x1954('0x15')]);return _0x54621f(_0x3c2211[_0x1954('0x13')][_0x1954('0x15')]);}logger[_0x1954('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x346b24,_0x3c2211[_0x1954('0x13')]['message']);return _0x22975b(_0x3c2211[_0x1954('0x13')][_0x1954('0x15')]);}else{logger['info'](_0x1954('0xf'),_0x346b24,_0x1954('0x10'));_0x22975b(_0x3c2211[_0x1954('0x16')][_0x1954('0x15')]);}})[_0x1954('0x17')](function(_0x3c2788){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x346b24,_0x3c2788);_0x54621f(_0x3c2788);});});}exports[_0x1954('0x18')]=function(_0x4aafea){var _0x165904=this;return new Promise(function(_0x522378,_0xf0315e){return db[_0x1954('0x19')][_0x1954('0x1a')](_0x4aafea[_0x1954('0x1b')],{'raw':_0x4aafea[_0x1954('0x1c')]?_0x4aafea[_0x1954('0x1c')][_0x1954('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4aafea[_0x1954('0x1c')]?_0x4aafea['options']['where']||null:null,'attributes':_0x4aafea[_0x1954('0x1c')]?_0x4aafea[_0x1954('0x1c')][_0x1954('0x1e')]||null:null,'limit':_0x4aafea[_0x1954('0x1c')]?_0x4aafea[_0x1954('0x1c')][_0x1954('0x1f')]||null:null})[_0x1954('0x20')](function(_0x3e6f94){logger[_0x1954('0x21')]('UpdateFaxInteraction',_0x4aafea);logger[_0x1954('0x22')]('UpdateFaxInteraction',_0x4aafea,JSON[_0x1954('0x12')](_0x3e6f94));_0x522378(_0x3e6f94);})['catch'](function(_0x590e8c){logger[_0x1954('0x13')](_0x1954('0x18'),_0x590e8c[_0x1954('0x15')],_0x4aafea);_0xf0315e(_0x165904[_0x1954('0x13')](0x1f4,_0x590e8c['message']));});});};exports[_0x1954('0x23')]=function(_0xfcadd9){return new Promise(function(_0x118f01,_0x1da4cb){return db[_0x1954('0x19')]['find']({'where':_0xfcadd9[_0x1954('0x1c')]?_0xfcadd9[_0x1954('0x1c')][_0x1954('0x24')]||null:null})[_0x1954('0x20')](function(_0x52bfb4){if(_0x52bfb4){return _0x52bfb4[_0x1954('0x25')](_0xfcadd9[_0x1954('0x1b')][_0x1954('0x26')],_[_0x1954('0x27')](_0xfcadd9[_0x1954('0x1b')],[_0x1954('0x26'),'id'])||{});}})['spread'](function(_0x3daa39){logger[_0x1954('0x21')]('AddTags',_0xfcadd9);logger[_0x1954('0x22')](_0x1954('0x28'),_0xfcadd9,JSON[_0x1954('0x12')](_0x3daa39));_0x118f01(_0x3daa39);})['catch'](function(_0x4125ae){logger[_0x1954('0x13')](_0x1954('0x28'),_0x4125ae['message'],_0xfcadd9);_0x1da4cb(_this[_0x1954('0x13')](0x1f4,_0x4125ae[_0x1954('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index f1744e7..857d36b 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 _0xf2a9=['update','emit','removeListener','length','faxInteraction:','./faxInteraction.events','remove'];(function(_0x9ef5b9,_0x2324ef){var _0x49d109=function(_0x123687){while(--_0x123687){_0x9ef5b9['push'](_0x9ef5b9['shift']());}};_0x49d109(++_0x2324ef);}(_0xf2a9,0x16a));var _0x9f2a=function(_0x226d47,_0x21f7c4){_0x226d47=_0x226d47-0x0;var _0x576122=_0xf2a9[_0x226d47];return _0x576122;};'use strict';var FaxInteractionEvents=require(_0x9f2a('0x0'));var events=['save',_0x9f2a('0x1'),_0x9f2a('0x2')];function createListener(_0x524fc1,_0x1cb72e){return function(_0x271439){_0x1cb72e[_0x9f2a('0x3')](_0x524fc1,_0x271439);};}function removeListener(_0x31d5c1,_0x54539d){return function(){FaxInteractionEvents[_0x9f2a('0x4')](_0x31d5c1,_0x54539d);};}exports['register']=function(_0x28cd9d){for(var _0x5f3c06=0x0,_0x112109=events[_0x9f2a('0x5')];_0x5f3c06<_0x112109;_0x5f3c06++){var _0x104e6a=events[_0x5f3c06];var _0x53cec9=createListener(_0x9f2a('0x6')+_0x104e6a,_0x28cd9d);FaxInteractionEvents['on'](_0x104e6a,_0x53cec9);}}; \ No newline at end of file +var _0x320c=['update','register','length','save','remove'];(function(_0x17f033,_0xea0ec5){var _0x53de6a=function(_0x388485){while(--_0x388485){_0x17f033['push'](_0x17f033['shift']());}};_0x53de6a(++_0xea0ec5);}(_0x320c,0x143));var _0xc320=function(_0x5b359d,_0x534423){_0x5b359d=_0x5b359d-0x0;var _0x21254e=_0x320c[_0x5b359d];return _0x21254e;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xc320('0x0'),_0xc320('0x1'),_0xc320('0x2')];function createListener(_0x33a525,_0x226ff5){return function(_0x2aa500){_0x226ff5['emit'](_0x33a525,_0x2aa500);};}function removeListener(_0x1b4363,_0x1e3d65){return function(){FaxInteractionEvents['removeListener'](_0x1b4363,_0x1e3d65);};}exports[_0xc320('0x3')]=function(_0x1c24d3){for(var _0x4c1423=0x0,_0x2b70cb=events[_0xc320('0x4')];_0x4c1423<_0x2b70cb;_0x4c1423++){var _0x2d5220=events[_0x4c1423];var _0x271871=createListener('faxInteraction:'+_0x2d5220,_0x1c24d3);FaxInteractionEvents['on'](_0x2d5220,_0x271871);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index be7429d..6d0647d 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 _0x8406=['faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','put','faxinteraction:update','update','delete'];(function(_0x1e6773,_0x138124){var _0x4c81a0=function(_0x5e6b7c){while(--_0x5e6b7c){_0x1e6773['push'](_0x1e6773['shift']());}};_0x4c81a0(++_0x138124);}(_0x8406,0x10c));var _0x6840=function(_0x19deb2,_0x443209){_0x19deb2=_0x19deb2-0x0;var _0x209640=_0x8406[_0x19deb2];return _0x209640;};'use strict';var multer=require(_0x6840('0x0'));var util=require(_0x6840('0x1'));var path=require(_0x6840('0x2'));var timeout=require(_0x6840('0x3'));var express=require(_0x6840('0x4'));var router=express[_0x6840('0x5')]();var fs_extra=require(_0x6840('0x6'));var auth=require(_0x6840('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x6840('0x8'));var controller=require(_0x6840('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6840('0xa')]);router[_0x6840('0xb')](_0x6840('0xc'),auth[_0x6840('0xd')](),controller[_0x6840('0xe')]);router[_0x6840('0xb')](_0x6840('0xf'),auth['isAuthenticated'](),controller[_0x6840('0x10')]);router['get'](_0x6840('0x11'),auth[_0x6840('0xd')](),controller['getMessages']);router[_0x6840('0xb')](_0x6840('0x12'),auth[_0x6840('0xd')](),controller['download']);router[_0x6840('0x13')]('/',auth[_0x6840('0xd')](),controller['create']);router[_0x6840('0x13')](_0x6840('0x11'),auth[_0x6840('0xd')](),controller[_0x6840('0x14')]);router[_0x6840('0x13')](_0x6840('0x15'),auth[_0x6840('0xd')](),interaction[_0x6840('0x16')](_0x6840('0x17'),_0x6840('0x18')),controller['addTags']);router[_0x6840('0x19')](_0x6840('0xf'),auth[_0x6840('0xd')](),interaction['tracked'](_0x6840('0x17'),_0x6840('0x1a')),controller[_0x6840('0x1b')]);router[_0x6840('0x1c')](_0x6840('0xf'),auth['isAuthenticated'](),interaction[_0x6840('0x16')](_0x6840('0x17'),_0x6840('0x1d')),controller[_0x6840('0x1e')]);router[_0x6840('0x1c')]('/:id/tags',auth[_0x6840('0xd')](),controller[_0x6840('0x1f')]);module[_0x6840('0x20')]=router; \ No newline at end of file +var _0xaccf=['tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags'];(function(_0x5b8e5f,_0x31269a){var _0x4ca334=function(_0x1c260c){while(--_0x1c260c){_0x5b8e5f['push'](_0x5b8e5f['shift']());}};_0x4ca334(++_0x31269a);}(_0xaccf,0x182));var _0xfacc=function(_0x5d8ac6,_0x1714fd){_0x5d8ac6=_0x5d8ac6-0x0;var _0x38006b=_0xaccf[_0x5d8ac6];return _0x38006b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfacc('0x0'));var timeout=require(_0xfacc('0x1'));var express=require('express');var router=express[_0xfacc('0x2')]();var fs_extra=require(_0xfacc('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfacc('0x4'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0xfacc('0x5')]('/',auth[_0xfacc('0x6')](),controller[_0xfacc('0x7')]);router[_0xfacc('0x5')](_0xfacc('0x8'),auth[_0xfacc('0x6')](),controller[_0xfacc('0x9')]);router[_0xfacc('0x5')](_0xfacc('0xa'),auth[_0xfacc('0x6')](),controller[_0xfacc('0xb')]);router['get'](_0xfacc('0xc'),auth[_0xfacc('0x6')](),controller[_0xfacc('0xd')]);router['get'](_0xfacc('0xe'),auth[_0xfacc('0x6')](),controller[_0xfacc('0xf')]);router[_0xfacc('0x10')]('/',auth[_0xfacc('0x6')](),controller['create']);router[_0xfacc('0x10')](_0xfacc('0xc'),auth['isAuthenticated'](),controller[_0xfacc('0x11')]);router[_0xfacc('0x10')](_0xfacc('0x12'),auth[_0xfacc('0x6')](),interaction[_0xfacc('0x13')](_0xfacc('0x14'),_0xfacc('0x15')),controller[_0xfacc('0x16')]);router['put'](_0xfacc('0xa'),auth[_0xfacc('0x6')](),interaction['tracked'](_0xfacc('0x14'),_0xfacc('0x17')),controller[_0xfacc('0x18')]);router[_0xfacc('0x19')](_0xfacc('0xa'),auth[_0xfacc('0x6')](),interaction[_0xfacc('0x13')](_0xfacc('0x14'),'faxinteraction:destroy'),controller['destroy']);router[_0xfacc('0x19')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0xfacc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 6018da6..a850dbc 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 _0x2209=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x3b3210,_0x25e8ed){var _0x5b5484=function(_0x417858){while(--_0x417858){_0x3b3210['push'](_0x3b3210['shift']());}};_0x5b5484(++_0x25e8ed);}(_0x2209,0x95));var _0x9220=function(_0x400958,_0x4b9784){_0x400958=_0x400958-0x0;var _0x41df16=_0x2209[_0x400958];return _0x41df16;};'use strict';var Sequelize=require(_0x9220('0x0'));module[_0x9220('0x1')]={'body':{'type':Sequelize[_0x9220('0x2')](_0x9220('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9220('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9220('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x9220('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x9220('0x6')]}}; \ No newline at end of file +var _0x9a19=['ENUM','out','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0x226b19,_0x4bdfb8){var _0x6bfc30=function(_0x40b6a4){while(--_0x40b6a4){_0x226b19['push'](_0x226b19['shift']());}};_0x6bfc30(++_0x4bdfb8);}(_0x9a19,0x114));var _0x99a1=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x9a19[_0x374ada];return _0x449ed8;};'use strict';var Sequelize=require(_0x99a1('0x0'));module[_0x99a1('0x1')]={'body':{'type':Sequelize[_0x99a1('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x99a1('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x99a1('0x4')]('in',_0x99a1('0x5')),'defaultValue':_0x99a1('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x99a1('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x99a1('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index f7fd134..4dd87dd 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 _0x4eae=['rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','/var/opt/motion2/server/files/attachments/%s','download','join','server','files','attachments','basename','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','../../config/license/util','redis','localhost','./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','code','message','result','catch','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','stack','name','send','FaxMessage','rawAttributes','fieldName','type','map','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','fields','includeAll','find','body','destroy','describe','accept','fax','readAt','UserId','user','agent','get','FaxInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','Sequelize','SELECT','User','internal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4eae,0x9b));var _0xe4ea=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0x4eae[_0x420b24];return _0x4da552;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe4ea('0x0'));var zipdir=require(_0xe4ea('0x1'));var jsonpatch=require(_0xe4ea('0x2'));var rp=require(_0xe4ea('0x3'));var moment=require(_0xe4ea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe4ea('0x5'));var util=require(_0xe4ea('0x6'));var path=require(_0xe4ea('0x7'));var sox=require(_0xe4ea('0x8'));var csv=require(_0xe4ea('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4ea('0xa'));var _=require(_0xe4ea('0xb'));var squel=require(_0xe4ea('0xc'));var crypto=require(_0xe4ea('0xd'));var jsforce=require(_0xe4ea('0xe'));var deskjs=require(_0xe4ea('0xf'));var toCsv=require(_0xe4ea('0x9'));var querystring=require(_0xe4ea('0x10'));var Papa=require(_0xe4ea('0x11'));var Redis=require('ioredis');var authService=require(_0xe4ea('0x12'));var qs=require(_0xe4ea('0x13'));var as=require(_0xe4ea('0x14'));var hardwareService=require(_0xe4ea('0x15'));var logger=require(_0xe4ea('0x16'))(_0xe4ea('0x17'));var utils=require(_0xe4ea('0x18'));var config=require(_0xe4ea('0x19'));var licenseUtil=require(_0xe4ea('0x1a'));var db=require('../../mysqldb')['db'];config[_0xe4ea('0x1b')]=_['defaults'](config[_0xe4ea('0x1b')],{'host':_0xe4ea('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe4ea('0x1b')]));require(_0xe4ea('0x1d'))[_0xe4ea('0x1e')](socket);var jayson=require(_0xe4ea('0x1f'));var client=jayson[_0xe4ea('0x20')]['http']({'port':0x232c});var client9002=jayson[_0xe4ea('0x20')][_0xe4ea('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x31be86,_0xebd4ce,_0x1007ac,_0x1aa2f4){return new BPromise(function(_0x5f41fd,_0x401512){var _0x18223a=_0x1aa2f4||client;return _0x18223a[_0xe4ea('0x22')](_0x31be86,_0x1007ac)[_0xe4ea('0x23')](function(_0x45c9b1){logger[_0xe4ea('0x24')](_0xe4ea('0x25'),_0xebd4ce,_0xe4ea('0x26'));logger[_0xe4ea('0x27')](_0xe4ea('0x28'),_0xebd4ce,_0xe4ea('0x26'),JSON[_0xe4ea('0x29')](_0x45c9b1));if(_0x45c9b1['error']){if(_0x45c9b1[_0xe4ea('0x2a')][_0xe4ea('0x2b')]===0x1f4){logger[_0xe4ea('0x2a')]('FaxMessage,\x20%s,\x20%s',_0xebd4ce,_0x45c9b1[_0xe4ea('0x2a')][_0xe4ea('0x2c')]);return _0x401512(_0x45c9b1['error']['message']);}logger[_0xe4ea('0x2a')](_0xe4ea('0x25'),_0xebd4ce,_0x45c9b1[_0xe4ea('0x2a')]['message']);return _0x5f41fd(_0x45c9b1[_0xe4ea('0x2a')][_0xe4ea('0x2c')]);}else{logger[_0xe4ea('0x24')](_0xe4ea('0x25'),_0xebd4ce,_0xe4ea('0x26'));_0x5f41fd(_0x45c9b1[_0xe4ea('0x2d')][_0xe4ea('0x2c')]);}})[_0xe4ea('0x2e')](function(_0x2d5fdc){logger[_0xe4ea('0x2a')](_0xe4ea('0x25'),_0xebd4ce,_0x2d5fdc);_0x401512(_0x2d5fdc);});});}function respondWithStatusCode(_0x368b9b,_0x55897d){_0x55897d=_0x55897d||0xcc;return function(_0x440474){if(_0x440474){return _0x368b9b['sendStatus'](_0x55897d);}return _0x368b9b[_0xe4ea('0x2f')](_0x55897d)[_0xe4ea('0x30')]();};}function respondWithResult(_0x1cdef1,_0x512f9e){_0x512f9e=_0x512f9e||0xc8;return function(_0x46d157){if(_0x46d157){return _0x1cdef1[_0xe4ea('0x2f')](_0x512f9e)[_0xe4ea('0x31')](_0x46d157);}};}function respondWithFilteredResult(_0x534121,_0x455be2){return function(_0x5d8128){if(_0x5d8128){var _0x2d86fc=typeof _0x455be2[_0xe4ea('0x32')]==='undefined'&&typeof _0x455be2[_0xe4ea('0x33')]==='undefined';var _0x2470e8=_0x5d8128['count'];var _0x34af23=_0x2d86fc?0x0:_0x455be2[_0xe4ea('0x32')];var _0x41ffa1=_0x2d86fc?_0x5d8128[_0xe4ea('0x34')]:_0x455be2[_0xe4ea('0x32')]+_0x455be2[_0xe4ea('0x33')];var _0x53e1b6;if(_0x41ffa1>=_0x2470e8){_0x41ffa1=_0x2470e8;_0x53e1b6=0xc8;}else{_0x53e1b6=0xce;}_0x534121['status'](_0x53e1b6);return _0x534121['set'](_0xe4ea('0x35'),_0x34af23+'-'+_0x41ffa1+'/'+_0x2470e8)[_0xe4ea('0x31')](_0x5d8128);}return null;};}function patchUpdates(_0x7c760c){return function(_0x32d5c2){try{jsonpatch[_0xe4ea('0x36')](_0x32d5c2,_0x7c760c,!![]);}catch(_0x19f2de){return BPromise[_0xe4ea('0x37')](_0x19f2de);}return _0x32d5c2[_0xe4ea('0x38')]();};}function saveUpdates(_0x417e61,_0x12dbd2){return function(_0x3d69a3){if(_0x3d69a3){return _0x3d69a3[_0xe4ea('0x39')](_0x417e61)['then'](function(_0x4e7ad5){return _0x4e7ad5;});}return null;};}function removeEntity(_0x3068db,_0x4102a9){return function(_0x2940f5){if(_0x2940f5){return _0x2940f5['destroy']()[_0xe4ea('0x23')](function(){_0x3068db['status'](0xcc)[_0xe4ea('0x30')]();});}};}function handleEntityNotFound(_0x13e9a4,_0x15fede){return function(_0x5598b5){if(!_0x5598b5){_0x13e9a4['sendStatus'](0x194);}return _0x5598b5;};}function handleError(_0x1bb8f4,_0x18c8ee){_0x18c8ee=_0x18c8ee||0x1f4;return function(_0x5a5c2d){logger['error'](_0x5a5c2d[_0xe4ea('0x3a')]);if(_0x5a5c2d[_0xe4ea('0x3b')]){delete _0x5a5c2d['name'];}_0x1bb8f4['status'](_0x18c8ee)[_0xe4ea('0x3c')](_0x5a5c2d);};}exports['index']=function(_0x1cf2e2,_0x579ed5){var _0x1601cf={},_0x19284e={},_0x5b46cc={'count':0x0,'rows':[]};var _0x150a4d=_['map'](db[_0xe4ea('0x3d')][_0xe4ea('0x3e')],function(_0x376fe3){return{'name':_0x376fe3[_0xe4ea('0x3f')],'type':_0x376fe3[_0xe4ea('0x40')]['key']};});_0x19284e['model']=_[_0xe4ea('0x41')](_0x150a4d,_0xe4ea('0x3b'));_0x19284e['query']=_[_0xe4ea('0x42')](_0x1cf2e2[_0xe4ea('0x43')]);_0x19284e[_0xe4ea('0x44')]=_[_0xe4ea('0x45')](_0x19284e[_0xe4ea('0x46')],_0x19284e[_0xe4ea('0x43')]);_0x1601cf['attributes']=_[_0xe4ea('0x45')](_0x19284e['model'],qs['fields'](_0x1cf2e2['query']['fields']));_0x1601cf[_0xe4ea('0x47')]=_0x1601cf['attributes'][_0xe4ea('0x48')]?_0x1601cf[_0xe4ea('0x47')]:_0x19284e[_0xe4ea('0x46')];if(!_0x1cf2e2['query'][_0xe4ea('0x49')](_0xe4ea('0x4a'))){_0x1601cf[_0xe4ea('0x33')]=qs[_0xe4ea('0x33')](_0x1cf2e2['query'][_0xe4ea('0x33')]);_0x1601cf[_0xe4ea('0x32')]=qs['offset'](_0x1cf2e2[_0xe4ea('0x43')]['offset']);}_0x1601cf[_0xe4ea('0x4b')]=qs[_0xe4ea('0x4c')](_0x1cf2e2[_0xe4ea('0x43')][_0xe4ea('0x4c')]);_0x1601cf[_0xe4ea('0x4d')]=qs['filters'](_[_0xe4ea('0x4e')](_0x1cf2e2[_0xe4ea('0x43')],_0x19284e[_0xe4ea('0x44')]),_0x150a4d);if(_0x1cf2e2[_0xe4ea('0x43')][_0xe4ea('0x4f')]){_0x1601cf['where']=_[_0xe4ea('0x50')](_0x1601cf[_0xe4ea('0x4d')],{'$or':_['map'](_0x150a4d,function(_0x5b906d){if(_0x5b906d[_0xe4ea('0x40')]!==_0xe4ea('0x51')){var _0x1563bf={};_0x1563bf[_0x5b906d[_0xe4ea('0x3b')]]={'$like':'%'+_0x1cf2e2[_0xe4ea('0x43')][_0xe4ea('0x4f')]+'%'};return _0x1563bf;}})});}_0x1601cf=_[_0xe4ea('0x50')]({},_0x1601cf,_0x1cf2e2[_0xe4ea('0x52')]);var _0x278667={'where':_0x1601cf[_0xe4ea('0x4d')]};return db[_0xe4ea('0x3d')][_0xe4ea('0x34')](_0x278667)['then'](function(_0x52e9e2){_0x5b46cc[_0xe4ea('0x34')]=_0x52e9e2;if(_0x1cf2e2[_0xe4ea('0x43')]['includeAll']){_0x1601cf[_0xe4ea('0x53')]=[{'all':!![]}];}return db[_0xe4ea('0x3d')]['findAll'](_0x1601cf);})['then'](function(_0x5b4d6d){_0x5b46cc[_0xe4ea('0x54')]=_0x5b4d6d;return _0x5b46cc;})[_0xe4ea('0x23')](respondWithFilteredResult(_0x579ed5,_0x1601cf))[_0xe4ea('0x2e')](handleError(_0x579ed5,null));};exports[_0xe4ea('0x55')]=function(_0x2ed06b,_0x29c3ea){var _0x2d423a={'raw':!![],'where':{'id':_0x2ed06b[_0xe4ea('0x56')]['id']}},_0x4f459d={};_0x4f459d[_0xe4ea('0x46')]=_[_0xe4ea('0x42')](db[_0xe4ea('0x3d')][_0xe4ea('0x3e')]);_0x4f459d['query']=_[_0xe4ea('0x42')](_0x2ed06b['query']);_0x4f459d[_0xe4ea('0x44')]=_[_0xe4ea('0x45')](_0x4f459d[_0xe4ea('0x46')],_0x4f459d[_0xe4ea('0x43')]);_0x2d423a[_0xe4ea('0x47')]=_[_0xe4ea('0x45')](_0x4f459d[_0xe4ea('0x46')],qs['fields'](_0x2ed06b[_0xe4ea('0x43')][_0xe4ea('0x57')]));_0x2d423a['attributes']=_0x2d423a['attributes'][_0xe4ea('0x48')]?_0x2d423a[_0xe4ea('0x47')]:_0x4f459d[_0xe4ea('0x46')];if(_0x2ed06b['query'][_0xe4ea('0x58')]){_0x2d423a[_0xe4ea('0x53')]=[{'all':!![]}];}_0x2d423a=_[_0xe4ea('0x50')]({},_0x2d423a,_0x2ed06b[_0xe4ea('0x52')]);return db[_0xe4ea('0x3d')][_0xe4ea('0x59')](_0x2d423a)[_0xe4ea('0x23')](handleEntityNotFound(_0x29c3ea,null))['then'](respondWithResult(_0x29c3ea,null))[_0xe4ea('0x2e')](handleError(_0x29c3ea,null));};exports['update']=function(_0x5c57bd,_0x34ef48){if(_0x5c57bd[_0xe4ea('0x5a')]['id']){delete _0x5c57bd[_0xe4ea('0x5a')]['id'];}return db[_0xe4ea('0x3d')][_0xe4ea('0x59')]({'where':{'id':_0x5c57bd[_0xe4ea('0x56')]['id']}})[_0xe4ea('0x23')](handleEntityNotFound(_0x34ef48,null))['then'](saveUpdates(_0x5c57bd[_0xe4ea('0x5a')],null))[_0xe4ea('0x23')](respondWithResult(_0x34ef48,null))['catch'](handleError(_0x34ef48,null));};exports[_0xe4ea('0x5b')]=function(_0x43f087,_0x2a98dd){return db['FaxMessage'][_0xe4ea('0x59')]({'where':{'id':_0x43f087[_0xe4ea('0x56')]['id']}})[_0xe4ea('0x23')](handleEntityNotFound(_0x2a98dd,null))[_0xe4ea('0x23')](removeEntity(_0x2a98dd,null))[_0xe4ea('0x2e')](handleError(_0x2a98dd,null));};exports[_0xe4ea('0x5c')]=function(_0x3b6f2e,_0x2603bf){return db[_0xe4ea('0x3d')][_0xe4ea('0x5c')]()['then'](respondWithResult(_0x2603bf,null))[_0xe4ea('0x2e')](handleError(_0x2603bf,null));};var interaction_log=require(_0xe4ea('0x16'))('fax-interactions');exports[_0xe4ea('0x5d')]=function(_0x172fae,_0x471daa,_0x1ce9b8){var _0x16edf4={'agent':{},'channel':_0xe4ea('0x5e')};if(_0x172fae['body']['id']){delete _0x172fae['body']['id'];}_0x172fae[_0xe4ea('0x5a')]['read']=!![];_0x172fae[_0xe4ea('0x5a')][_0xe4ea('0x5f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x172fae['body'][_0xe4ea('0x60')]=_0x172fae[_0xe4ea('0x5a')][_0xe4ea('0x60')]||_0x172fae[_0xe4ea('0x61')]['id'];_0x16edf4[_0xe4ea('0x62')]['id']=_0x172fae['body']['UserId'];return db[_0xe4ea('0x3d')][_0xe4ea('0x59')]({'where':{'id':_0x172fae[_0xe4ea('0x56')]['id'],'UserId':null}})[_0xe4ea('0x23')](handleEntityNotFound(_0x471daa,null))[_0xe4ea('0x23')](saveUpdates(_0x172fae['body'],null))['then'](function(_0x4269b7){if(_0x4269b7){_0x16edf4[_0xe4ea('0x2c')]=_0x4269b7[_0xe4ea('0x63')]({'plain':!![]});return db['FaxInteraction'][_0xe4ea('0x59')]({'where':{'id':_0x4269b7[_0xe4ea('0x64')]}});}return null;})[_0xe4ea('0x23')](handleEntityNotFound(_0x471daa,null))[_0xe4ea('0x23')](function(_0x4aee45){if(_0x4aee45){return _0x4aee45['update']({'UserId':_0x172fae['body'][_0xe4ea('0x60')],'read1stAt':_[_0xe4ea('0x65')](_0x4aee45['read1stAt'])?moment()['format'](_0xe4ea('0x66')):undefined});}return null;})[_0xe4ea('0x23')](function(_0x2c7a59){if(_0x2c7a59){_0x16edf4[_0xe4ea('0x67')]=_0x2c7a59[_0xe4ea('0x63')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x172fae[_0xe4ea('0x61')]['id'],_0x172fae[_0xe4ea('0x61')][_0xe4ea('0x3b')],_0x172fae[_0xe4ea('0x61')][_0xe4ea('0x68')],_0x16edf4['interaction']['id'],_0x172fae[_0xe4ea('0x5a')]?JSON[_0xe4ea('0x29')](_0x172fae['body']):'null');return respondWithRpcPromise(_0xe4ea('0x69'),'acceptMessage',_0x16edf4);}return null;})[_0xe4ea('0x23')](function(_0x1b7504){var _0x330411=_0xe4ea('0x6a')+_0x1b7504[_0xe4ea('0x2c')][_0xe4ea('0x6b')];return db[_0xe4ea('0x6c')][_0xe4ea('0x43')](_0x330411,{'type':db['Sequelize'][_0xe4ea('0x6d')]['SELECT'],'raw':!![]})['then'](function(_0x2ac35f){return _0x2ac35f;});})['then'](function(_0x5dcf80){if(_0x5dcf80){_0x16edf4[_0xe4ea('0x2c')][_0xe4ea('0x6e')]=_0x5dcf80[0x0];if(!_0x172fae[_0xe4ea('0x5a')][_0xe4ea('0x60')])return;return db['User'][_0xe4ea('0x59')]({'where':{'id':_0x172fae['body'][_0xe4ea('0x60')],'role':_0xe4ea('0x62')},'attributes':['id',_0xe4ea('0x3b'),_0xe4ea('0x6f'),_0xe4ea('0x70'),'internal'],'raw':!![]});}return null;})[_0xe4ea('0x23')](function(_0x50dca7){if(!_0x50dca7)return null;_0x16edf4[_0xe4ea('0x2c')][_0xe4ea('0x62')]=_0x50dca7;return _0x16edf4;})[_0xe4ea('0x23')](function(_0x38433c){if(_0x38433c){if(_0x172fae['body'][_0xe4ea('0x71')]){_0x16edf4[_0xe4ea('0x2c')][_0xe4ea('0x72')]=util['format'](_0xe4ea('0x73'),_0x172fae[_0xe4ea('0x61')]['name']);_0x16edf4['message'][_0xe4ea('0x74')]=_0x16edf4[_0xe4ea('0x74')];_0x16edf4['message'][_0xe4ea('0x75')]=_0x16edf4[_0xe4ea('0x74')];_0x16edf4[_0xe4ea('0x2c')][_0xe4ea('0x76')]=_0xe4ea('0x5d');return respondWithRpcPromise(_0xe4ea('0x77'),_0xe4ea('0x77'),{'event':'acceptmessage','message':_0x16edf4[_0xe4ea('0x2c')]},client9002)[_0xe4ea('0x23')](function(){return _0x16edf4;});}return _0x16edf4;}return null;})[_0xe4ea('0x23')](respondWithResult(_0x471daa,null))[_0xe4ea('0x2e')](handleError(_0x471daa,null));};var interaction_log=require(_0xe4ea('0x16'))('fax-interactions');exports[_0xe4ea('0x37')]=function(_0x15d5a3,_0x2d73dc,_0x383f88){var _0x5de135={'agent':{},'channel':'fax'};if(_0x15d5a3[_0xe4ea('0x5a')]['id']){delete _0x15d5a3[_0xe4ea('0x5a')]['id'];}_0x15d5a3[_0xe4ea('0x5a')][_0xe4ea('0x60')]=_0x15d5a3['body'][_0xe4ea('0x60')]||_0x15d5a3[_0xe4ea('0x61')]['id'];_0x5de135[_0xe4ea('0x62')]['id']=_0x15d5a3[_0xe4ea('0x5a')][_0xe4ea('0x60')];return db[_0xe4ea('0x3d')][_0xe4ea('0x59')]({'where':{'id':_0x15d5a3[_0xe4ea('0x56')]['id'],'UserId':null}})[_0xe4ea('0x23')](handleEntityNotFound(_0x2d73dc,null))[_0xe4ea('0x23')](function(_0xb4ce0c){if(_0xb4ce0c){_0x5de135['message']=_0xb4ce0c[_0xe4ea('0x63')]({'plain':!![]});return db[_0xe4ea('0x78')][_0xe4ea('0x59')]({'where':{'id':_0xb4ce0c[_0xe4ea('0x64')]}});}return null;})[_0xe4ea('0x23')](handleEntityNotFound(_0x2d73dc,null))[_0xe4ea('0x23')](function(_0x2f96c6){if(_0x2f96c6){_0x5de135['interaction']=_0x2f96c6[_0xe4ea('0x63')]({'plain':!![]});interaction_log[_0xe4ea('0x24')](_0xe4ea('0x79'),_0x15d5a3[_0xe4ea('0x61')]['id'],_0x15d5a3[_0xe4ea('0x61')][_0xe4ea('0x3b')],_0x15d5a3['user'][_0xe4ea('0x68')],_0x5de135[_0xe4ea('0x67')]['id'],_0x15d5a3['body']?JSON[_0xe4ea('0x29')](_0x15d5a3[_0xe4ea('0x5a')]):_0xe4ea('0x7a'));return respondWithRpcPromise(_0xe4ea('0x7b'),_0xe4ea('0x7c'),_0x5de135);}return null;})[_0xe4ea('0x23')](function(_0x1f8772){var _0x536d87=_0xe4ea('0x6a')+_0x1f8772[_0xe4ea('0x2c')][_0xe4ea('0x6b')];return db['sequelize'][_0xe4ea('0x43')](_0x536d87,{'type':db[_0xe4ea('0x7d')][_0xe4ea('0x6d')][_0xe4ea('0x7e')],'raw':!![]})['then'](function(_0x4ef6df){return _0x4ef6df;});})[_0xe4ea('0x23')](function(_0x1c5394){if(_0x1c5394){_0x5de135[_0xe4ea('0x2c')][_0xe4ea('0x6e')]=_0x1c5394[0x0];if(!_0x15d5a3[_0xe4ea('0x5a')][_0xe4ea('0x60')])return;return db[_0xe4ea('0x7f')][_0xe4ea('0x59')]({'where':{'id':_0x15d5a3[_0xe4ea('0x5a')]['UserId'],'role':'agent'},'attributes':['id','name',_0xe4ea('0x6f'),'email',_0xe4ea('0x80')],'raw':!![]});}return null;})[_0xe4ea('0x23')](function(_0x918996){if(!_0x918996)return null;_0x5de135['message'][_0xe4ea('0x62')]=_0x918996;return _0x5de135;})[_0xe4ea('0x23')](function(_0x4d37b5){if(_0x4d37b5){_0x4d37b5[_0xe4ea('0x2c')][_0xe4ea('0x72')]=util['format'](_0xe4ea('0x73'),_0x15d5a3[_0xe4ea('0x61')][_0xe4ea('0x3b')]);_0x4d37b5['message'][_0xe4ea('0x74')]=_0x5de135[_0xe4ea('0x74')];_0x4d37b5[_0xe4ea('0x2c')][_0xe4ea('0x75')]=_0x5de135[_0xe4ea('0x74')];_0x4d37b5['message'][_0xe4ea('0x76')]=_0xe4ea('0x37');respondWithRpcPromise(_0xe4ea('0x77'),'EventManager',{'event':_0xe4ea('0x81'),'message':_0x4d37b5[_0xe4ea('0x2c')]},client9002);return _0x5de135;}return null;})['then'](respondWithResult(_0x2d73dc,null))[_0xe4ea('0x2e')](handleError(_0x2d73dc,null));};exports[_0xe4ea('0x82')]=function(_0x5d48ba,_0x48f18e){var _0x2328de;return db[_0xe4ea('0x3d')][_0xe4ea('0x82')](_0x5d48ba[_0xe4ea('0x5a')],{})[_0xe4ea('0x23')](function(_0x58f504){_0x2328de=_0x58f504;return db[_0xe4ea('0x83')][_0xe4ea('0x84')]({'where':{'id':_0x2328de[_0xe4ea('0x6b')]}});})[_0xe4ea('0x23')](function(_0x4f3f69){if(_[_0xe4ea('0x65')](_0x4f3f69)){return;}else{_0x2328de[_0xe4ea('0x5e')]=_0x4f3f69['fax'];return db[_0xe4ea('0x85')]['findOne']({'where':{'id':_0x2328de[_0xe4ea('0x86')]}});}})['then'](function(_0x4f2f39){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_['isNil'](_0x5d48ba[_0xe4ea('0x5a')])?undefined:_0x5d48ba[_0xe4ea('0x5a')]['FaxAccountId'],'path':_[_0xe4ea('0x65')](_0x4f2f39)?undefined:util['format'](_0xe4ea('0x87'),_0x4f2f39['basename']),'fax':_[_0xe4ea('0x65')](_0x2328de[_0xe4ea('0x5e')])?undefined:_0x2328de['fax'],'AttachmentId':_0x2328de[_0xe4ea('0x86')]},client9002);})[_0xe4ea('0x23')](respondWithResult(_0x48f18e,0xc9))[_0xe4ea('0x2e')](handleError(_0x48f18e,null));};exports[_0xe4ea('0x88')]=function(_0x1f82b7,_0x40df55){var _0x571250=path[_0xe4ea('0x89')](config['root'],_0xe4ea('0x8a'),_0xe4ea('0x8b'),_0xe4ea('0x8c'));return db[_0xe4ea('0x3d')]['find']({'where':{'id':_0x1f82b7[_0xe4ea('0x56')]['id']},'include':[{'model':db['Attachment'],'as':_0xe4ea('0x85')}]})[_0xe4ea('0x23')](handleEntityNotFound(_0x40df55,null))[_0xe4ea('0x23')](function(_0x1cdad0){if(_0x1cdad0){return _0x40df55[_0xe4ea('0x88')](path['join'](_0x571250,_0x1cdad0['Attachment'][_0xe4ea('0x8d')]));}})[_0xe4ea('0x2e')](handleError(_0x40df55,null));}; \ No newline at end of file +var _0x56fa=['path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','stack','name','index','map','FaxMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','params','include','find','body','describe','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','role','interaction','null','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','fullname','create','CmContact','Attachment','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','download','root','server','files','attachments','join','basename','eml-format','rimraf','fast-json-patch','moment','bluebird','util'];(function(_0x2755e7,_0x39a160){var _0x387dba=function(_0x7b7d66){while(--_0x7b7d66){_0x2755e7['push'](_0x2755e7['shift']());}};_0x387dba(++_0x39a160);}(_0x56fa,0x122));var _0xa56f=function(_0x4e0262,_0x427557){_0x4e0262=_0x4e0262-0x0;var _0x3c7add=_0x56fa[_0x4e0262];return _0x3c7add;};'use strict';var emlformat=require(_0xa56f('0x0'));var rimraf=require(_0xa56f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa56f('0x2'));var rp=require('request-promise');var moment=require(_0xa56f('0x3'));var BPromise=require(_0xa56f('0x4'));var Mustache=require('mustache');var util=require(_0xa56f('0x5'));var path=require(_0xa56f('0x6'));var sox=require('sox');var csv=require(_0xa56f('0x7'));var ejs=require(_0xa56f('0x8'));var fs=require('fs');var fs_extra=require(_0xa56f('0x9'));var _=require(_0xa56f('0xa'));var squel=require(_0xa56f('0xb'));var crypto=require('crypto');var jsforce=require(_0xa56f('0xc'));var deskjs=require(_0xa56f('0xd'));var toCsv=require(_0xa56f('0x7'));var querystring=require(_0xa56f('0xe'));var Papa=require(_0xa56f('0xf'));var Redis=require('ioredis');var authService=require(_0xa56f('0x10'));var qs=require(_0xa56f('0x11'));var as=require(_0xa56f('0x12'));var hardwareService=require(_0xa56f('0x13'));var logger=require(_0xa56f('0x14'))(_0xa56f('0x15'));var utils=require(_0xa56f('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa56f('0x17'));var db=require('../../mysqldb')['db'];config[_0xa56f('0x18')]=_[_0xa56f('0x19')](config[_0xa56f('0x18')],{'host':_0xa56f('0x1a'),'port':0x18eb});var socket=require(_0xa56f('0x1b'))(new Redis(config[_0xa56f('0x18')]));require(_0xa56f('0x1c'))[_0xa56f('0x1d')](socket);var jayson=require(_0xa56f('0x1e'));var client=jayson[_0xa56f('0x1f')][_0xa56f('0x20')]({'port':0x232c});var client9002=jayson[_0xa56f('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd948ca,_0x5107f3,_0x20779b,_0x1cc256){return new BPromise(function(_0x1d2dba,_0x54ee3f){var _0x423e46=_0x1cc256||client;return _0x423e46[_0xa56f('0x21')](_0xd948ca,_0x20779b)[_0xa56f('0x22')](function(_0x377bd0){logger[_0xa56f('0x23')](_0xa56f('0x24'),_0x5107f3,_0xa56f('0x25'));logger[_0xa56f('0x26')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5107f3,'request\x20sent',JSON[_0xa56f('0x27')](_0x377bd0));if(_0x377bd0['error']){if(_0x377bd0['error'][_0xa56f('0x28')]===0x1f4){logger['error'](_0xa56f('0x24'),_0x5107f3,_0x377bd0[_0xa56f('0x29')][_0xa56f('0x2a')]);return _0x54ee3f(_0x377bd0[_0xa56f('0x29')][_0xa56f('0x2a')]);}logger[_0xa56f('0x29')]('FaxMessage,\x20%s,\x20%s',_0x5107f3,_0x377bd0[_0xa56f('0x29')][_0xa56f('0x2a')]);return _0x1d2dba(_0x377bd0[_0xa56f('0x29')][_0xa56f('0x2a')]);}else{logger[_0xa56f('0x23')](_0xa56f('0x24'),_0x5107f3,_0xa56f('0x25'));_0x1d2dba(_0x377bd0[_0xa56f('0x2b')][_0xa56f('0x2a')]);}})[_0xa56f('0x2c')](function(_0x2c47b6){logger[_0xa56f('0x29')](_0xa56f('0x24'),_0x5107f3,_0x2c47b6);_0x54ee3f(_0x2c47b6);});});}function respondWithStatusCode(_0x3de2fd,_0x131e95){_0x131e95=_0x131e95||0xcc;return function(_0xc5cbdd){if(_0xc5cbdd){return _0x3de2fd[_0xa56f('0x2d')](_0x131e95);}return _0x3de2fd[_0xa56f('0x2e')](_0x131e95)[_0xa56f('0x2f')]();};}function respondWithResult(_0x143021,_0x339dea){_0x339dea=_0x339dea||0xc8;return function(_0x5d4597){if(_0x5d4597){return _0x143021[_0xa56f('0x2e')](_0x339dea)[_0xa56f('0x30')](_0x5d4597);}};}function respondWithFilteredResult(_0x502de0,_0x33346c){return function(_0x1bc176){if(_0x1bc176){var _0x4daa3e=typeof _0x33346c[_0xa56f('0x31')]===_0xa56f('0x32')&&typeof _0x33346c[_0xa56f('0x33')]==='undefined';var _0x1b9c39=_0x1bc176[_0xa56f('0x34')];var _0x2000fa=_0x4daa3e?0x0:_0x33346c[_0xa56f('0x31')];var _0x5a5683=_0x4daa3e?_0x1bc176['count']:_0x33346c[_0xa56f('0x31')]+_0x33346c['limit'];var _0x273016;if(_0x5a5683>=_0x1b9c39){_0x5a5683=_0x1b9c39;_0x273016=0xc8;}else{_0x273016=0xce;}_0x502de0[_0xa56f('0x2e')](_0x273016);return _0x502de0[_0xa56f('0x35')](_0xa56f('0x36'),_0x2000fa+'-'+_0x5a5683+'/'+_0x1b9c39)['json'](_0x1bc176);}return null;};}function patchUpdates(_0x1b8158){return function(_0x57b3de){try{jsonpatch['apply'](_0x57b3de,_0x1b8158,!![]);}catch(_0x42a97e){return BPromise[_0xa56f('0x37')](_0x42a97e);}return _0x57b3de[_0xa56f('0x38')]();};}function saveUpdates(_0x1cd70a,_0x49b543){return function(_0x57ad19){if(_0x57ad19){return _0x57ad19[_0xa56f('0x39')](_0x1cd70a)[_0xa56f('0x22')](function(_0x3d6393){return _0x3d6393;});}return null;};}function removeEntity(_0x18e67b,_0x49c033){return function(_0x82dba){if(_0x82dba){return _0x82dba[_0xa56f('0x3a')]()[_0xa56f('0x22')](function(){_0x18e67b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7d5f93,_0x2ba1dc){return function(_0x527ac2){if(!_0x527ac2){_0x7d5f93['sendStatus'](0x194);}return _0x527ac2;};}function handleError(_0x270155,_0x459035){_0x459035=_0x459035||0x1f4;return function(_0x470404){logger[_0xa56f('0x29')](_0x470404[_0xa56f('0x3b')]);if(_0x470404[_0xa56f('0x3c')]){delete _0x470404[_0xa56f('0x3c')];}_0x270155['status'](_0x459035)['send'](_0x470404);};}exports[_0xa56f('0x3d')]=function(_0xf3831d,_0x3d3317){var _0x416b66={},_0x43044f={},_0x43586d={'count':0x0,'rows':[]};var _0x452272=_[_0xa56f('0x3e')](db[_0xa56f('0x3f')][_0xa56f('0x40')],function(_0x1f1e05){return{'name':_0x1f1e05[_0xa56f('0x41')],'type':_0x1f1e05['type'][_0xa56f('0x42')]};});_0x43044f[_0xa56f('0x43')]=_[_0xa56f('0x3e')](_0x452272,_0xa56f('0x3c'));_0x43044f['query']=_[_0xa56f('0x44')](_0xf3831d[_0xa56f('0x45')]);_0x43044f[_0xa56f('0x46')]=_[_0xa56f('0x47')](_0x43044f['model'],_0x43044f['query']);_0x416b66[_0xa56f('0x48')]=_[_0xa56f('0x47')](_0x43044f[_0xa56f('0x43')],qs[_0xa56f('0x49')](_0xf3831d[_0xa56f('0x45')][_0xa56f('0x49')]));_0x416b66[_0xa56f('0x48')]=_0x416b66['attributes'][_0xa56f('0x4a')]?_0x416b66[_0xa56f('0x48')]:_0x43044f['model'];if(!_0xf3831d[_0xa56f('0x45')][_0xa56f('0x4b')](_0xa56f('0x4c'))){_0x416b66['limit']=qs[_0xa56f('0x33')](_0xf3831d['query']['limit']);_0x416b66['offset']=qs[_0xa56f('0x31')](_0xf3831d[_0xa56f('0x45')][_0xa56f('0x31')]);}_0x416b66[_0xa56f('0x4d')]=qs[_0xa56f('0x4e')](_0xf3831d[_0xa56f('0x45')][_0xa56f('0x4e')]);_0x416b66[_0xa56f('0x4f')]=qs[_0xa56f('0x46')](_[_0xa56f('0x50')](_0xf3831d[_0xa56f('0x45')],_0x43044f['filters']),_0x452272);if(_0xf3831d[_0xa56f('0x45')]['filter']){_0x416b66[_0xa56f('0x4f')]=_[_0xa56f('0x51')](_0x416b66[_0xa56f('0x4f')],{'$or':_[_0xa56f('0x3e')](_0x452272,function(_0xefc02b){if(_0xefc02b[_0xa56f('0x52')]!==_0xa56f('0x53')){var _0x228b33={};_0x228b33[_0xefc02b[_0xa56f('0x3c')]]={'$like':'%'+_0xf3831d[_0xa56f('0x45')][_0xa56f('0x54')]+'%'};return _0x228b33;}})});}_0x416b66=_[_0xa56f('0x51')]({},_0x416b66,_0xf3831d[_0xa56f('0x55')]);var _0x22283e={'where':_0x416b66[_0xa56f('0x4f')]};return db['FaxMessage'][_0xa56f('0x34')](_0x22283e)[_0xa56f('0x22')](function(_0x3d771d){_0x43586d['count']=_0x3d771d;if(_0xf3831d[_0xa56f('0x45')][_0xa56f('0x56')]){_0x416b66['include']=[{'all':!![]}];}return db[_0xa56f('0x3f')][_0xa56f('0x57')](_0x416b66);})[_0xa56f('0x22')](function(_0x5bc861){_0x43586d[_0xa56f('0x58')]=_0x5bc861;return _0x43586d;})[_0xa56f('0x22')](respondWithFilteredResult(_0x3d3317,_0x416b66))[_0xa56f('0x2c')](handleError(_0x3d3317,null));};exports['show']=function(_0x30ff1e,_0x250ca7){var _0x30f0a9={'raw':!![],'where':{'id':_0x30ff1e[_0xa56f('0x59')]['id']}},_0x7f9742={};_0x7f9742[_0xa56f('0x43')]=_['keys'](db[_0xa56f('0x3f')][_0xa56f('0x40')]);_0x7f9742['query']=_['keys'](_0x30ff1e[_0xa56f('0x45')]);_0x7f9742[_0xa56f('0x46')]=_[_0xa56f('0x47')](_0x7f9742[_0xa56f('0x43')],_0x7f9742[_0xa56f('0x45')]);_0x30f0a9['attributes']=_['intersection'](_0x7f9742[_0xa56f('0x43')],qs['fields'](_0x30ff1e[_0xa56f('0x45')][_0xa56f('0x49')]));_0x30f0a9[_0xa56f('0x48')]=_0x30f0a9[_0xa56f('0x48')][_0xa56f('0x4a')]?_0x30f0a9[_0xa56f('0x48')]:_0x7f9742['model'];if(_0x30ff1e[_0xa56f('0x45')]['includeAll']){_0x30f0a9[_0xa56f('0x5a')]=[{'all':!![]}];}_0x30f0a9=_['merge']({},_0x30f0a9,_0x30ff1e[_0xa56f('0x55')]);return db[_0xa56f('0x3f')][_0xa56f('0x5b')](_0x30f0a9)[_0xa56f('0x22')](handleEntityNotFound(_0x250ca7,null))[_0xa56f('0x22')](respondWithResult(_0x250ca7,null))[_0xa56f('0x2c')](handleError(_0x250ca7,null));};exports[_0xa56f('0x39')]=function(_0x37d68a,_0xcc5020){if(_0x37d68a[_0xa56f('0x5c')]['id']){delete _0x37d68a[_0xa56f('0x5c')]['id'];}return db[_0xa56f('0x3f')][_0xa56f('0x5b')]({'where':{'id':_0x37d68a[_0xa56f('0x59')]['id']}})[_0xa56f('0x22')](handleEntityNotFound(_0xcc5020,null))['then'](saveUpdates(_0x37d68a[_0xa56f('0x5c')],null))[_0xa56f('0x22')](respondWithResult(_0xcc5020,null))[_0xa56f('0x2c')](handleError(_0xcc5020,null));};exports[_0xa56f('0x3a')]=function(_0x419596,_0x45ec52){return db[_0xa56f('0x3f')][_0xa56f('0x5b')]({'where':{'id':_0x419596[_0xa56f('0x59')]['id']}})[_0xa56f('0x22')](handleEntityNotFound(_0x45ec52,null))['then'](removeEntity(_0x45ec52,null))[_0xa56f('0x2c')](handleError(_0x45ec52,null));};exports[_0xa56f('0x5d')]=function(_0x2674c7,_0x622384){return db['FaxMessage'][_0xa56f('0x5d')]()[_0xa56f('0x22')](respondWithResult(_0x622384,null))[_0xa56f('0x2c')](handleError(_0x622384,null));};var interaction_log=require(_0xa56f('0x14'))(_0xa56f('0x5e'));exports[_0xa56f('0x5f')]=function(_0x3bf9fb,_0x3fa7fd,_0x582a7b){var _0x5b16b2={'agent':{},'channel':_0xa56f('0x60')};if(_0x3bf9fb[_0xa56f('0x5c')]['id']){delete _0x3bf9fb[_0xa56f('0x5c')]['id'];}_0x3bf9fb[_0xa56f('0x5c')][_0xa56f('0x61')]=!![];_0x3bf9fb[_0xa56f('0x5c')]['readAt']=moment()[_0xa56f('0x62')](_0xa56f('0x63'));_0x3bf9fb[_0xa56f('0x5c')][_0xa56f('0x64')]=_0x3bf9fb['body'][_0xa56f('0x64')]||_0x3bf9fb[_0xa56f('0x65')]['id'];_0x5b16b2[_0xa56f('0x66')]['id']=_0x3bf9fb[_0xa56f('0x5c')][_0xa56f('0x64')];return db[_0xa56f('0x3f')]['find']({'where':{'id':_0x3bf9fb['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3fa7fd,null))['then'](saveUpdates(_0x3bf9fb['body'],null))['then'](function(_0x1ca50a){if(_0x1ca50a){_0x5b16b2[_0xa56f('0x2a')]=_0x1ca50a[_0xa56f('0x67')]({'plain':!![]});return db[_0xa56f('0x68')][_0xa56f('0x5b')]({'where':{'id':_0x1ca50a[_0xa56f('0x69')]}});}return null;})[_0xa56f('0x22')](handleEntityNotFound(_0x3fa7fd,null))[_0xa56f('0x22')](function(_0x2783de){if(_0x2783de){return _0x2783de[_0xa56f('0x39')]({'UserId':_0x3bf9fb[_0xa56f('0x5c')][_0xa56f('0x64')],'read1stAt':_[_0xa56f('0x6a')](_0x2783de[_0xa56f('0x6b')])?moment()[_0xa56f('0x62')](_0xa56f('0x63')):undefined});}return null;})[_0xa56f('0x22')](function(_0x42f28a){if(_0x42f28a){_0x5b16b2['interaction']=_0x42f28a[_0xa56f('0x67')]({'plain':!![]});interaction_log[_0xa56f('0x23')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3bf9fb[_0xa56f('0x65')]['id'],_0x3bf9fb[_0xa56f('0x65')][_0xa56f('0x3c')],_0x3bf9fb[_0xa56f('0x65')][_0xa56f('0x6c')],_0x5b16b2[_0xa56f('0x6d')]['id'],_0x3bf9fb['body']?JSON[_0xa56f('0x27')](_0x3bf9fb[_0xa56f('0x5c')]):_0xa56f('0x6e'));return respondWithRpcPromise(_0xa56f('0x6f'),_0xa56f('0x70'),_0x5b16b2);}return null;})[_0xa56f('0x22')](function(_0x4fcf09){var _0x3d52b6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4fcf09['message'][_0xa56f('0x71')];return db['sequelize'][_0xa56f('0x45')](_0x3d52b6,{'type':db[_0xa56f('0x72')][_0xa56f('0x73')][_0xa56f('0x74')],'raw':!![]})[_0xa56f('0x22')](function(_0x3e5391){return _0x3e5391;});})[_0xa56f('0x22')](function(_0x582b16){if(_0x582b16){_0x5b16b2[_0xa56f('0x2a')][_0xa56f('0x75')]=_0x582b16[0x0];if(!_0x3bf9fb['body']['UserId'])return;return db[_0xa56f('0x76')]['find']({'where':{'id':_0x3bf9fb[_0xa56f('0x5c')]['UserId'],'role':_0xa56f('0x66')},'attributes':['id',_0xa56f('0x3c'),'fullname',_0xa56f('0x77'),_0xa56f('0x78')],'raw':!![]});}return null;})[_0xa56f('0x22')](function(_0x3ed9ac){if(!_0x3ed9ac)return null;_0x5b16b2['message'][_0xa56f('0x66')]=_0x3ed9ac;return _0x5b16b2;})[_0xa56f('0x22')](function(_0x3e6947){if(_0x3e6947){if(_0x3bf9fb['body'][_0xa56f('0x79')]){_0x5b16b2['message'][_0xa56f('0x7a')]=util['format'](_0xa56f('0x7b'),_0x3bf9fb[_0xa56f('0x65')][_0xa56f('0x3c')]);_0x5b16b2[_0xa56f('0x2a')][_0xa56f('0x7c')]=_0x5b16b2[_0xa56f('0x7c')];_0x5b16b2['message'][_0xa56f('0x7d')]=_0x5b16b2['channel'];_0x5b16b2[_0xa56f('0x2a')]['event']=_0xa56f('0x5f');return respondWithRpcPromise(_0xa56f('0x7e'),_0xa56f('0x7e'),{'event':_0xa56f('0x7f'),'message':_0x5b16b2[_0xa56f('0x2a')]},client9002)[_0xa56f('0x22')](function(){return _0x5b16b2;});}return _0x5b16b2;}return null;})['then'](respondWithResult(_0x3fa7fd,null))[_0xa56f('0x2c')](handleError(_0x3fa7fd,null));};var interaction_log=require(_0xa56f('0x14'))(_0xa56f('0x5e'));exports[_0xa56f('0x37')]=function(_0x4bc9f1,_0xc84714,_0x51bcab){var _0x5210e4={'agent':{},'channel':'fax'};if(_0x4bc9f1[_0xa56f('0x5c')]['id']){delete _0x4bc9f1[_0xa56f('0x5c')]['id'];}_0x4bc9f1[_0xa56f('0x5c')][_0xa56f('0x64')]=_0x4bc9f1[_0xa56f('0x5c')][_0xa56f('0x64')]||_0x4bc9f1[_0xa56f('0x65')]['id'];_0x5210e4['agent']['id']=_0x4bc9f1['body'][_0xa56f('0x64')];return db[_0xa56f('0x3f')][_0xa56f('0x5b')]({'where':{'id':_0x4bc9f1[_0xa56f('0x59')]['id'],'UserId':null}})[_0xa56f('0x22')](handleEntityNotFound(_0xc84714,null))[_0xa56f('0x22')](function(_0x267292){if(_0x267292){_0x5210e4[_0xa56f('0x2a')]=_0x267292['get']({'plain':!![]});return db[_0xa56f('0x68')]['find']({'where':{'id':_0x267292[_0xa56f('0x69')]}});}return null;})[_0xa56f('0x22')](handleEntityNotFound(_0xc84714,null))['then'](function(_0x16fdf5){if(_0x16fdf5){_0x5210e4[_0xa56f('0x6d')]=_0x16fdf5[_0xa56f('0x67')]({'plain':!![]});interaction_log[_0xa56f('0x23')](_0xa56f('0x80'),_0x4bc9f1['user']['id'],_0x4bc9f1[_0xa56f('0x65')][_0xa56f('0x3c')],_0x4bc9f1[_0xa56f('0x65')][_0xa56f('0x6c')],_0x5210e4[_0xa56f('0x6d')]['id'],_0x4bc9f1[_0xa56f('0x5c')]?JSON['stringify'](_0x4bc9f1[_0xa56f('0x5c')]):_0xa56f('0x6e'));return respondWithRpcPromise(_0xa56f('0x81'),_0xa56f('0x82'),_0x5210e4);}return null;})[_0xa56f('0x22')](function(_0x3c6b49){var _0x34478e=_0xa56f('0x83')+_0x3c6b49[_0xa56f('0x2a')][_0xa56f('0x71')];return db[_0xa56f('0x84')]['query'](_0x34478e,{'type':db['Sequelize'][_0xa56f('0x73')][_0xa56f('0x74')],'raw':!![]})[_0xa56f('0x22')](function(_0x1d366c){return _0x1d366c;});})['then'](function(_0x3b44aa){if(_0x3b44aa){_0x5210e4[_0xa56f('0x2a')][_0xa56f('0x75')]=_0x3b44aa[0x0];if(!_0x4bc9f1[_0xa56f('0x5c')][_0xa56f('0x64')])return;return db['User'][_0xa56f('0x5b')]({'where':{'id':_0x4bc9f1[_0xa56f('0x5c')][_0xa56f('0x64')],'role':'agent'},'attributes':['id',_0xa56f('0x3c'),_0xa56f('0x85'),'email',_0xa56f('0x78')],'raw':!![]});}return null;})[_0xa56f('0x22')](function(_0x58bdfd){if(!_0x58bdfd)return null;_0x5210e4['message'][_0xa56f('0x66')]=_0x58bdfd;return _0x5210e4;})[_0xa56f('0x22')](function(_0x388537){if(_0x388537){_0x388537['message']['interface']=util[_0xa56f('0x62')](_0xa56f('0x7b'),_0x4bc9f1['user']['name']);_0x388537[_0xa56f('0x2a')][_0xa56f('0x7c')]=_0x5210e4['channel'];_0x388537[_0xa56f('0x2a')]['motionChannel']=_0x5210e4[_0xa56f('0x7c')];_0x388537['message']['event']=_0xa56f('0x37');respondWithRpcPromise(_0xa56f('0x7e'),_0xa56f('0x7e'),{'event':'rejectmessage','message':_0x388537[_0xa56f('0x2a')]},client9002);return _0x5210e4;}return null;})['then'](respondWithResult(_0xc84714,null))[_0xa56f('0x2c')](handleError(_0xc84714,null));};exports[_0xa56f('0x86')]=function(_0x1762f9,_0x1805bd){var _0x39c525;return db[_0xa56f('0x3f')][_0xa56f('0x86')](_0x1762f9[_0xa56f('0x5c')],{})[_0xa56f('0x22')](function(_0x26e39c){_0x39c525=_0x26e39c;return db[_0xa56f('0x87')]['findOne']({'where':{'id':_0x39c525[_0xa56f('0x71')]}});})[_0xa56f('0x22')](function(_0x17bc0e){if(_[_0xa56f('0x6a')](_0x17bc0e)){return;}else{_0x39c525[_0xa56f('0x60')]=_0x17bc0e[_0xa56f('0x60')];return db[_0xa56f('0x88')][_0xa56f('0x89')]({'where':{'id':_0x39c525[_0xa56f('0x8a')]}});}})[_0xa56f('0x22')](function(_0x23e53a){return respondWithRpcPromise(_0xa56f('0x8b'),_0xa56f('0x8b'),{'FaxAccountId':_[_0xa56f('0x6a')](_0x1762f9[_0xa56f('0x5c')])?undefined:_0x1762f9[_0xa56f('0x5c')]['FaxAccountId'],'path':_[_0xa56f('0x6a')](_0x23e53a)?undefined:util[_0xa56f('0x62')](_0xa56f('0x8c'),_0x23e53a['basename']),'fax':_[_0xa56f('0x6a')](_0x39c525['fax'])?undefined:_0x39c525[_0xa56f('0x60')],'AttachmentId':_0x39c525[_0xa56f('0x8a')]},client9002);})[_0xa56f('0x22')](respondWithResult(_0x1805bd,0xc9))[_0xa56f('0x2c')](handleError(_0x1805bd,null));};exports[_0xa56f('0x8d')]=function(_0x2af4bf,_0x1ae486){var _0x210d9f=path['join'](config[_0xa56f('0x8e')],_0xa56f('0x8f'),_0xa56f('0x90'),_0xa56f('0x91'));return db[_0xa56f('0x3f')][_0xa56f('0x5b')]({'where':{'id':_0x2af4bf[_0xa56f('0x59')]['id']},'include':[{'model':db[_0xa56f('0x88')],'as':_0xa56f('0x88')}]})[_0xa56f('0x22')](handleEntityNotFound(_0x1ae486,null))[_0xa56f('0x22')](function(_0x3fecc0){if(_0x3fecc0){return _0x1ae486[_0xa56f('0x8d')](path[_0xa56f('0x92')](_0x210d9f,_0x3fecc0[_0xa56f('0x88')][_0xa56f('0x93')]));}})[_0xa56f('0x2c')](handleError(_0x1ae486,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 146f3bd..859b4d1 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 _0x644f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x1790bf,_0x486d51){var _0x2a9d2b=function(_0x569dd1){while(--_0x569dd1){_0x1790bf['push'](_0x1790bf['shift']());}};_0x2a9d2b(++_0x486d51);}(_0x644f,0xc2));var _0xf644=function(_0x25fa5c,_0x421141){_0x25fa5c=_0x25fa5c-0x0;var _0x1bade2=_0x644f[_0x25fa5c];return _0x1bade2;};'use strict';var EventEmitter=require(_0xf644('0x0'));var FaxMessage=require(_0xf644('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf644('0x2'),'afterUpdate':_0xf644('0x3'),'afterDestroy':_0xf644('0x4')};function emitEvent(_0x1f6804){return function(_0x372b63,_0x3759da,_0x3c31e9){FaxMessageEvents[_0xf644('0x5')](_0x1f6804+':'+_0x372b63['id'],_0x372b63);FaxMessageEvents[_0xf644('0x5')](_0x1f6804,_0x372b63);_0x3c31e9(null);};}for(var e in events){if(events[_0xf644('0x6')](e)){var event=events[e];FaxMessage[_0xf644('0x7')](e,emitEvent(event));}}module[_0xf644('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0xf40b=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x2e6422,_0x1889a2){var _0x1810c5=function(_0x1297f2){while(--_0x1297f2){_0x2e6422['push'](_0x2e6422['shift']());}};_0x1810c5(++_0x1889a2);}(_0xf40b,0xb0));var _0xbf40=function(_0x1bf611,_0x5a169b){_0x1bf611=_0x1bf611-0x0;var _0x46c450=_0xf40b[_0x1bf611];return _0x46c450;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0xbf40('0x0'))['db'][_0xbf40('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xbf40('0x2')](0x0);var events={'afterCreate':_0xbf40('0x3'),'afterUpdate':'update','afterDestroy':_0xbf40('0x4')};function emitEvent(_0x2a92dc){return function(_0x118fce,_0x887cae,_0x1a1c6f){FaxMessageEvents['emit'](_0x2a92dc+':'+_0x118fce['id'],_0x118fce);FaxMessageEvents[_0xbf40('0x5')](_0x2a92dc,_0x118fce);_0x1a1c6f(null);};}for(var e in events){if(events[_0xbf40('0x6')](e)){var event=events[e];FaxMessage[_0xbf40('0x7')](e,emitEvent(event));}}module[_0xbf40('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index fb4ae63..3897a5d 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 _0x3ce0=['findOne','then','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxMessage','fti_fax_messages','body','direction','toLowerCase','isNil','UserId','FaxInteraction'];(function(_0x77c228,_0x222bcb){var _0x28a9f=function(_0x490ad3){while(--_0x490ad3){_0x77c228['push'](_0x77c228['shift']());}};_0x28a9f(++_0x222bcb);}(_0x3ce0,0xb4));var _0x03ce=function(_0x5a6dd5,_0x3a59c6){_0x5a6dd5=_0x5a6dd5-0x0;var _0x1fe941=_0x3ce0[_0x5a6dd5];return _0x1fe941;};'use strict';var _=require(_0x03ce('0x0'));var util=require(_0x03ce('0x1'));var logger=require(_0x03ce('0x2'))(_0x03ce('0x3'));var moment=require(_0x03ce('0x4'));var BPromise=require(_0x03ce('0x5'));var rp=require(_0x03ce('0x6'));var fs=require('fs');var path=require(_0x03ce('0x7'));var rimraf=require(_0x03ce('0x8'));var config=require(_0x03ce('0x9'));var attributes=require('./faxMessage.attributes');module[_0x03ce('0xa')]=function(_0x1f5b43,_0x51c37b){return _0x1f5b43[_0x03ce('0xb')](_0x03ce('0xc'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x03ce('0xd'),'fields':[_0x03ce('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5df760,_0x100c82,_0x179931){var _0x25216e=_0x1f5b43['models'];var _0xcb6904=_0x5df760['get']({'plain':!![]});if(_0xcb6904[_0x03ce('0xf')][_0x03ce('0x10')]()==='in'||_0xcb6904['direction'][_0x03ce('0x10')]()==='out'&&!_0xcb6904['secret']&&!_[_0x03ce('0x11')](_0xcb6904[_0x03ce('0x12')])){_0x25216e[_0x03ce('0x13')][_0x03ce('0x14')]({'where':{'id':_0xcb6904['FaxInteractionId']}})[_0x03ce('0x15')](function(_0x17db34){if(_0x17db34){_0x17db34['update']({'lastMsgAt':_0xcb6904['createdAt'],'lastMsgDirection':_0xcb6904[_0x03ce('0xf')][_0x03ce('0x10')]()});}})[_0x03ce('0x16')](function(_0x31b14b){console[_0x03ce('0x17')](_0x31b14b);});}_0x179931();}},'charset':'utf8mb4','collate':_0x03ce('0x18')});}; \ No newline at end of file +var _0xed21=['then','createdAt','catch','error','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxMessage','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId'];(function(_0x3794d6,_0x5671ce){var _0x1abad8=function(_0x26b737){while(--_0x26b737){_0x3794d6['push'](_0x3794d6['shift']());}};_0x1abad8(++_0x5671ce);}(_0xed21,0x91));var _0x1ed2=function(_0x3e24f1,_0xbd829a){_0x3e24f1=_0x3e24f1-0x0;var _0x48f50d=_0xed21[_0x3e24f1];return _0x48f50d;};'use strict';var _=require('lodash');var util=require(_0x1ed2('0x0'));var logger=require(_0x1ed2('0x1'))(_0x1ed2('0x2'));var moment=require(_0x1ed2('0x3'));var BPromise=require(_0x1ed2('0x4'));var rp=require(_0x1ed2('0x5'));var fs=require('fs');var path=require(_0x1ed2('0x6'));var rimraf=require(_0x1ed2('0x7'));var config=require(_0x1ed2('0x8'));var attributes=require('./faxMessage.attributes');module[_0x1ed2('0x9')]=function(_0x225a81,_0x4872fe){return _0x225a81['define'](_0x1ed2('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x1ed2('0xb'),'fields':['body'],'type':_0x1ed2('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2fb694,_0x48f6e0,_0x15fe79){var _0x259955=_0x225a81[_0x1ed2('0xd')];var _0xa1b84b=_0x2fb694[_0x1ed2('0xe')]({'plain':!![]});if(_0xa1b84b[_0x1ed2('0xf')][_0x1ed2('0x10')]()==='in'||_0xa1b84b['direction'][_0x1ed2('0x10')]()==='out'&&!_0xa1b84b[_0x1ed2('0x11')]&&!_[_0x1ed2('0x12')](_0xa1b84b[_0x1ed2('0x13')])){_0x259955[_0x1ed2('0x14')][_0x1ed2('0x15')]({'where':{'id':_0xa1b84b[_0x1ed2('0x16')]}})[_0x1ed2('0x17')](function(_0x105371){if(_0x105371){_0x105371['update']({'lastMsgAt':_0xa1b84b[_0x1ed2('0x18')],'lastMsgDirection':_0xa1b84b[_0x1ed2('0xf')][_0x1ed2('0x10')]()});}})[_0x1ed2('0x19')](function(_0x5eaab6){console[_0x1ed2('0x1a')](_0x5eaab6);});}_0x15fe79();}},'charset':_0x1ed2('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 c46a0fd..7afc07b 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 _0xbec5=['then','info','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','UpdateFaxMessage','update','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0xb65945,_0x20d43b){var _0x1c7ede=function(_0x306931){while(--_0x306931){_0xb65945['push'](_0xb65945['shift']());}};_0x1c7ede(++_0x20d43b);}(_0xbec5,0xe5));var _0x5bec=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0xbec5[_0x4bc4c8];return _0x3bb121;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var moment=require('moment');var BPromise=require(_0x5bec('0x2'));var rs=require(_0x5bec('0x3'));var fs=require('fs');var Redis=require(_0x5bec('0x4'));var db=require(_0x5bec('0x5'))['db'];var utils=require(_0x5bec('0x6'));var logger=require('../../config/logger')(_0x5bec('0x7'));var config=require(_0x5bec('0x8'));var jayson=require(_0x5bec('0x9'));var client=jayson['client'][_0x5bec('0xa')]({'port':0x232a});config[_0x5bec('0xb')]=_[_0x5bec('0xc')](config[_0x5bec('0xb')],{'host':_0x5bec('0xd'),'port':0x18eb});var socket=require(_0x5bec('0xe'))(new Redis(config[_0x5bec('0xb')]));require(_0x5bec('0xf'))['register'](socket);function respondWithRpcPromise(_0x41a827,_0x5c2d67,_0x748f75){return new BPromise(function(_0x2a70a7,_0x117162){return client['request'](_0x41a827,_0x748f75)[_0x5bec('0x10')](function(_0x18fa47){logger[_0x5bec('0x11')]('FaxMessage,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'));logger[_0x5bec('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5c2d67,_0x5bec('0x12'),JSON[_0x5bec('0x14')](_0x18fa47));if(_0x18fa47[_0x5bec('0x15')]){if(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x16')]===0x1f4){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);return _0x117162(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x18fa47['error']['message']);return _0x2a70a7(_0x18fa47[_0x5bec('0x15')][_0x5bec('0x18')]);}else{logger[_0x5bec('0x11')](_0x5bec('0x17'),_0x5c2d67,'request\x20sent');_0x2a70a7(_0x18fa47['result'][_0x5bec('0x18')]);}})[_0x5bec('0x19')](function(_0x4e0191){logger[_0x5bec('0x15')](_0x5bec('0x17'),_0x5c2d67,_0x4e0191);_0x117162(_0x4e0191);});});}exports[_0x5bec('0x1a')]=function(_0x593786){var _0x554f9f=this;return new Promise(function(_0xab397b,_0x5be91c){return db[_0x5bec('0x1b')][_0x5bec('0x1c')](_0x593786[_0x5bec('0x1d')],{'raw':_0x593786[_0x5bec('0x1e')]?_0x593786[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x5bec('0x10')](function(_0x4cfcb8){logger[_0x5bec('0x11')](_0x5bec('0x1a'),_0x593786);logger['debug'](_0x5bec('0x1a'),_0x593786,JSON[_0x5bec('0x14')](_0x4cfcb8));_0xab397b(_0x4cfcb8);})['catch'](function(_0x45afb7){logger[_0x5bec('0x15')](_0x5bec('0x1a'),_0x45afb7[_0x5bec('0x18')],_0x593786);_0x5be91c(_0x554f9f[_0x5bec('0x15')](0x1f4,_0x45afb7[_0x5bec('0x18')]));});});};exports[_0x5bec('0x1f')]=function(_0x4de66a){var _0x5b63ab=this;return new Promise(function(_0x5e44b3,_0x2961bd){return db[_0x5bec('0x1b')][_0x5bec('0x20')](_0x4de66a['body'],{'raw':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')]['where']||null:null,'attributes':_0x4de66a['options']?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x21')]||null:null,'limit':_0x4de66a[_0x5bec('0x1e')]?_0x4de66a[_0x5bec('0x1e')][_0x5bec('0x22')]||null:null})[_0x5bec('0x10')](function(_0x5d6621){logger[_0x5bec('0x11')]('UpdateFaxMessage',_0x4de66a);logger[_0x5bec('0x13')](_0x5bec('0x1f'),_0x4de66a,JSON[_0x5bec('0x14')](_0x5d6621));_0x5e44b3(_0x5d6621);})[_0x5bec('0x19')](function(_0x5128c0){logger[_0x5bec('0x15')](_0x5bec('0x1f'),_0x5128c0[_0x5bec('0x18')],_0x4de66a);_0x2961bd(_0x5b63ab['error'](0x1f4,_0x5128c0[_0x5bec('0x18')]));});});}; \ No newline at end of file +var _0x008c=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','catch','options','raw','then','CreateFaxMessage','attributes','limit','UpdateFaxMessage','stringify','lodash','util','moment','bluebird'];(function(_0x26e8f3,_0x49abd6){var _0x1e7207=function(_0x473813){while(--_0x473813){_0x26e8f3['push'](_0x26e8f3['shift']());}};_0x1e7207(++_0x49abd6);}(_0x008c,0x188));var _0xc008=function(_0x315b6c,_0x2ac37f){_0x315b6c=_0x315b6c-0x0;var _0x94dc8=_0x008c[_0x315b6c];return _0x94dc8;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});config[_0xc008('0xd')]=_['defaults'](config[_0xc008('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc008('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xc008('0xf')](socket);function respondWithRpcPromise(_0x7231b4,_0x57c46d,_0x51ba7d){return new BPromise(function(_0x543eb8,_0x1eacfa){return client[_0xc008('0x10')](_0x7231b4,_0x51ba7d)['then'](function(_0xae2dab){logger[_0xc008('0x11')](_0xc008('0x12'),_0x57c46d,_0xc008('0x13'));logger[_0xc008('0x14')](_0xc008('0x15'),_0x57c46d,_0xc008('0x13'),JSON['stringify'](_0xae2dab));if(_0xae2dab['error']){if(_0xae2dab[_0xc008('0x16')]['code']===0x1f4){logger[_0xc008('0x16')](_0xc008('0x12'),_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x1eacfa(_0xae2dab[_0xc008('0x16')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x543eb8(_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x57c46d,'request\x20sent');_0x543eb8(_0xae2dab['result'][_0xc008('0x17')]);}})[_0xc008('0x18')](function(_0x501137){logger[_0xc008('0x16')]('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0x501137);_0x1eacfa(_0x501137);});});}exports['CreateFaxMessage']=function(_0x543e5d){var _0x50261c=this;return new Promise(function(_0x5754a0,_0x4b9726){return db['FaxMessage']['create'](_0x543e5d['body'],{'raw':_0x543e5d['options']?_0x543e5d[_0xc008('0x19')][_0xc008('0x1a')]===undefined?!![]:![]:!![]})[_0xc008('0x1b')](function(_0x415af3){logger[_0xc008('0x11')](_0xc008('0x1c'),_0x543e5d);logger['debug'](_0xc008('0x1c'),_0x543e5d,JSON['stringify'](_0x415af3));_0x5754a0(_0x415af3);})['catch'](function(_0x218599){logger[_0xc008('0x16')](_0xc008('0x1c'),_0x218599[_0xc008('0x17')],_0x543e5d);_0x4b9726(_0x50261c['error'](0x1f4,_0x218599['message']));});});};exports['UpdateFaxMessage']=function(_0x3f7b07){var _0x15dade=this;return new Promise(function(_0x92c582,_0x2e31c2){return db['FaxMessage']['update'](_0x3f7b07['body'],{'raw':_0x3f7b07['options']?_0x3f7b07['options'][_0xc008('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')]['where']||null:null,'attributes':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')][_0xc008('0x1d')]||null:null,'limit':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07['options'][_0xc008('0x1e')]||null:null})[_0xc008('0x1b')](function(_0x53ed35){logger['info']('UpdateFaxMessage',_0x3f7b07);logger[_0xc008('0x14')](_0xc008('0x1f'),_0x3f7b07,JSON[_0xc008('0x20')](_0x53ed35));_0x92c582(_0x53ed35);})[_0xc008('0x18')](function(_0x1de04b){logger[_0xc008('0x16')](_0xc008('0x1f'),_0x1de04b[_0xc008('0x17')],_0x3f7b07);_0x2e31c2(_0x15dade[_0xc008('0x16')](0x1f4,_0x1de04b[_0xc008('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 81bc8ce..cb915c0 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 _0x4084=['faxMessage:','./faxMessage.events','save','remove','update','removeListener','register'];(function(_0x3eeff6,_0x563580){var _0x1e6237=function(_0x1af951){while(--_0x1af951){_0x3eeff6['push'](_0x3eeff6['shift']());}};_0x1e6237(++_0x563580);}(_0x4084,0xda));var _0x4408=function(_0x56787b,_0x4604e7){_0x56787b=_0x56787b-0x0;var _0x3c66a3=_0x4084[_0x56787b];return _0x3c66a3;};'use strict';var FaxMessageEvents=require(_0x4408('0x0'));var events=[_0x4408('0x1'),_0x4408('0x2'),_0x4408('0x3')];function createListener(_0x444dec,_0x5b2d88){return function(_0x392a5f){_0x5b2d88['emit'](_0x444dec,_0x392a5f);};}function removeListener(_0x8040fd,_0x54b873){return function(){FaxMessageEvents[_0x4408('0x4')](_0x8040fd,_0x54b873);};}exports[_0x4408('0x5')]=function(_0x524eb2){for(var _0x2334cf=0x0,_0x1f1c87=events['length'];_0x2334cf<_0x1f1c87;_0x2334cf++){var _0x5188b4=events[_0x2334cf];var _0x1d64e8=createListener(_0x4408('0x6')+_0x5188b4,_0x524eb2);FaxMessageEvents['on'](_0x5188b4,_0x1d64e8);}}; \ No newline at end of file +var _0x730d=['length','faxMessage:','save','remove','update','emit'];(function(_0x39ee6f,_0x2783e5){var _0x33724c=function(_0x19c4a3){while(--_0x19c4a3){_0x39ee6f['push'](_0x39ee6f['shift']());}};_0x33724c(++_0x2783e5);}(_0x730d,0xd4));var _0xd730=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0x730d[_0x34021d];return _0x16597b;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xd730('0x0'),_0xd730('0x1'),_0xd730('0x2')];function createListener(_0x3db0af,_0x1c2d36){return function(_0x2721b1){_0x1c2d36[_0xd730('0x3')](_0x3db0af,_0x2721b1);};}function removeListener(_0x3fb17b,_0x65d389){return function(){FaxMessageEvents['removeListener'](_0x3fb17b,_0x65d389);};}exports['register']=function(_0x3d1896){for(var _0x51da91=0x0,_0x2bd5a2=events[_0xd730('0x4')];_0x51da91<_0x2bd5a2;_0x51da91++){var _0x4d1f91=events[_0x51da91];var _0x40c133=createListener(_0xd730('0x5')+_0x4d1f91,_0x3d1896);FaxMessageEvents['on'](_0x4d1f91,_0x40c133);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index d43f7c7..71f69a4 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 _0xbdb7=['accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','index','get','describe','show','/:id/download','isAuthenticated','download','post','tracked','put','/:id','update'];(function(_0x524c01,_0x297d6a){var _0x33ffa3=function(_0x566417){while(--_0x566417){_0x524c01['push'](_0x524c01['shift']());}};_0x33ffa3(++_0x297d6a);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x31d040,_0x46742e){_0x31d040=_0x31d040-0x0;var _0xf4812a=_0xbdb7[_0x31d040];return _0xf4812a;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var fs_extra=require(_0x7bdb('0x6'));var auth=require(_0x7bdb('0x7'));var interaction=require(_0x7bdb('0x8'));var config=require('../../config/environment');var controller=require(_0x7bdb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0xb')]('/describe',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0x11')]('/',auth[_0x7bdb('0xf')](),interaction[_0x7bdb('0x12')]('fax','faxmessage:create'),controller['create']);router[_0x7bdb('0x13')](_0x7bdb('0x14'),auth['isAuthenticated'](),controller[_0x7bdb('0x15')]);router['put']('/:id/accept',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x7bdb('0x17')]);router[_0x7bdb('0x18')](_0x7bdb('0x14'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x19')]);module[_0x7bdb('0x1a')]=router; \ No newline at end of file +var _0xc6d8=['describe','/:id','show','/:id/download','download','post','tracked','faxmessage:create','update','put','/:id/accept','accept','/:id/reject','delete','exports','multer','path','express','fs-extra','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x85b14d,_0x5e465b){var _0x56fe6d=function(_0x982c14){while(--_0x982c14){_0x85b14d['push'](_0x85b14d['shift']());}};_0x56fe6d(++_0x5e465b);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x5139bb,_0x3fb5f4){_0x5139bb=_0x5139bb-0x0;var _0x306e2a=_0xc6d8[_0x5139bb];return _0x306e2a;};'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'),auth['isAuthenticated'](),controller[_0x8c6d('0xa')]);router[_0x8c6d('0x6')](_0x8c6d('0xb'),auth['isAuthenticated'](),controller[_0x8c6d('0xc')]);router[_0x8c6d('0x6')](_0x8c6d('0xd'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0xe')]);router[_0x8c6d('0xf')]('/',auth[_0x8c6d('0x7')](),interaction[_0x8c6d('0x10')]('fax',_0x8c6d('0x11')),controller['create']);router['put'](_0x8c6d('0xb'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x12')]);router[_0x8c6d('0x13')](_0x8c6d('0x14'),auth[_0x8c6d('0x7')](),controller[_0x8c6d('0x15')]);router[_0x8c6d('0x13')](_0x8c6d('0x16'),auth[_0x8c6d('0x7')](),controller['reject']);router[_0x8c6d('0x17')]('/:id',auth[_0x8c6d('0x7')](),controller['destroy']);module[_0x8c6d('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 0fcc188..de0d6b8 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 _0xd0ce=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x3a5f93,_0x32da4f){var _0x1f82bb=function(_0x253db3){while(--_0x253db3){_0x3a5f93['push'](_0x3a5f93['shift']());}};_0x1f82bb(++_0x32da4f);}(_0xd0ce,0x105));var _0xed0c=function(_0x2cc8bb,_0x5f2607){_0x2cc8bb=_0x2cc8bb-0x0;var _0x140e40=_0xd0ce[_0x2cc8bb];return _0x140e40;};'use strict';var Sequelize=require(_0xed0c('0x0'));module[_0xed0c('0x1')]={'name':{'type':Sequelize[_0xed0c('0x2')],'unique':_0xed0c('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xed0c('0x2')]},'timeout':{'type':Sequelize[_0xed0c('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xed0c('0x5')](_0xed0c('0x6'),_0xed0c('0x7'),_0xed0c('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xed0c('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6b6b=['rrmemory','roundrobin','sequelize','name','STRING','ENUM'];(function(_0x18542d,_0x47145b){var _0x41adf7=function(_0x15ea7c){while(--_0x15ea7c){_0x18542d['push'](_0x18542d['shift']());}};_0x41adf7(++_0x47145b);}(_0x6b6b,0x1a0));var _0xb6b6=function(_0x72619b,_0x109e23){_0x72619b=_0x72619b-0x0;var _0x11c10b=_0x6b6b[_0x72619b];return _0x11c10b;};'use strict';var Sequelize=require(_0xb6b6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb6b6('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb6b6('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb6b6('0x3')](_0xb6b6('0x4'),'beepall',_0xb6b6('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'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 993c539..942edb6 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 _0x70b3=['includes','all','union','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','FaxQueues','then','end','sendStatus','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserFaxQueue','nolimit','order','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId'];(function(_0x2bd722,_0x4c5268){var _0x1df548=function(_0x3ca957){while(--_0x3ca957){_0x2bd722['push'](_0x2bd722['shift']());}};_0x1df548(++_0x4c5268);}(_0x70b3,0x9c));var _0x370b=function(_0xd3220b,_0x1e9bc4){_0xd3220b=_0xd3220b-0x0;var _0x51ae7d=_0x70b3[_0xd3220b];return _0x51ae7d;};'use strict';var emlformat=require(_0x370b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x370b('0x1'));var jsonpatch=require(_0x370b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x370b('0x3'));var Mustache=require(_0x370b('0x4'));var util=require('util');var path=require(_0x370b('0x5'));var sox=require(_0x370b('0x6'));var csv=require(_0x370b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x370b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x370b('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x370b('0x7'));var querystring=require('querystring');var Papa=require(_0x370b('0xa'));var Redis=require(_0x370b('0xb'));var authService=require(_0x370b('0xc'));var qs=require(_0x370b('0xd'));var as=require(_0x370b('0xe'));var hardwareService=require(_0x370b('0xf'));var logger=require(_0x370b('0x10'))(_0x370b('0x11'));var utils=require('../../config/utils');var config=require(_0x370b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x370b('0x13'))['db'];config[_0x370b('0x14')]=_[_0x370b('0x15')](config[_0x370b('0x14')],{'host':_0x370b('0x16'),'port':0x18eb});var socket=require(_0x370b('0x17'))(new Redis(config['redis']));require(_0x370b('0x18'))[_0x370b('0x19')](socket);function respondWithStatusCode(_0x8349bc,_0x57c1a){_0x57c1a=_0x57c1a||0xcc;return function(_0x48661b){if(_0x48661b){return _0x8349bc['sendStatus'](_0x57c1a);}return _0x8349bc[_0x370b('0x1a')](_0x57c1a)['end']();};}function respondWithResult(_0x5c42f1,_0x505b1c){_0x505b1c=_0x505b1c||0xc8;return function(_0x4446e8){if(_0x4446e8){return _0x5c42f1[_0x370b('0x1a')](_0x505b1c)[_0x370b('0x1b')](_0x4446e8);}};}function respondWithFilteredResult(_0x2b3f8e,_0x52312a){return function(_0x18bbcc){if(_0x18bbcc){var _0x5a6d8f=typeof _0x52312a[_0x370b('0x1c')]===_0x370b('0x1d')&&typeof _0x52312a[_0x370b('0x1e')]==='undefined';var _0x3b62e9=_0x18bbcc[_0x370b('0x1f')];var _0x147762=_0x5a6d8f?0x0:_0x52312a[_0x370b('0x1c')];var _0x34c3db=_0x5a6d8f?_0x18bbcc[_0x370b('0x1f')]:_0x52312a[_0x370b('0x1c')]+_0x52312a[_0x370b('0x1e')];var _0x110957;if(_0x34c3db>=_0x3b62e9){_0x34c3db=_0x3b62e9;_0x110957=0xc8;}else{_0x110957=0xce;}_0x2b3f8e[_0x370b('0x1a')](_0x110957);return _0x2b3f8e['set'](_0x370b('0x20'),_0x147762+'-'+_0x34c3db+'/'+_0x3b62e9)[_0x370b('0x1b')](_0x18bbcc);}return null;};}function patchUpdates(_0x22a39b){return function(_0x512cb9){try{jsonpatch[_0x370b('0x21')](_0x512cb9,_0x22a39b,!![]);}catch(_0x24e555){return BPromise[_0x370b('0x22')](_0x24e555);}return _0x512cb9[_0x370b('0x23')]();};}function saveUpdates(_0x3c52f4,_0xcf3e57){return function(_0x4d99b3){if(_0x4d99b3){return _0x4d99b3['update'](_0x3c52f4)['then'](function(_0x557058){return _0x557058;});}return null;};}function removeEntity(_0x30a269,_0xe151fa){return function(_0x3876db){if(_0x3876db){return _0x3876db[_0x370b('0x24')]()['then'](function(){var _0x17013d=_0x3876db[_0x370b('0x25')]({'plain':!![]});var _0x360a36=_0x370b('0x26');return db['UserProfileResource'][_0x370b('0x24')]({'where':{'type':_0x360a36,'resourceId':_0x17013d['id']}})[_0x370b('0x27')](function(){return _0x3876db;});})[_0x370b('0x27')](function(){_0x30a269[_0x370b('0x1a')](0xcc)[_0x370b('0x28')]();});}};}function handleEntityNotFound(_0x6fc641,_0x3df0da){return function(_0xa1440b){if(!_0xa1440b){_0x6fc641[_0x370b('0x29')](0x194);}return _0xa1440b;};}function handleError(_0x24c936,_0x4ac03a){_0x4ac03a=_0x4ac03a||0x1f4;return function(_0x26d2eb){logger[_0x370b('0x2a')](_0x26d2eb['stack']);if(_0x26d2eb[_0x370b('0x2b')]){delete _0x26d2eb[_0x370b('0x2b')];}_0x24c936[_0x370b('0x1a')](_0x4ac03a)[_0x370b('0x2c')](_0x26d2eb);};}exports[_0x370b('0x2d')]=function(_0xf56701,_0x298425){var _0x2a7576={},_0x49357d={},_0x63f072={'count':0x0,'rows':[]};var _0x3b1db9=_[_0x370b('0x2e')](db[_0x370b('0x2f')][_0x370b('0x30')],function(_0x446293){return{'name':_0x446293[_0x370b('0x31')],'type':_0x446293[_0x370b('0x32')][_0x370b('0x33')]};});_0x49357d[_0x370b('0x34')]=_[_0x370b('0x2e')](_0x3b1db9,'name');_0x49357d[_0x370b('0x35')]=_[_0x370b('0x36')](_0xf56701['query']);_0x49357d[_0x370b('0x37')]=_[_0x370b('0x38')](_0x49357d[_0x370b('0x34')],_0x49357d[_0x370b('0x35')]);_0x2a7576['attributes']=_[_0x370b('0x38')](_0x49357d[_0x370b('0x34')],qs[_0x370b('0x39')](_0xf56701[_0x370b('0x35')]['fields']));_0x2a7576[_0x370b('0x3a')]=_0x2a7576['attributes'][_0x370b('0x3b')]?_0x2a7576[_0x370b('0x3a')]:_0x49357d[_0x370b('0x34')];if(!_0xf56701['query'][_0x370b('0x3c')]('nolimit')){_0x2a7576['limit']=qs[_0x370b('0x1e')](_0xf56701[_0x370b('0x35')][_0x370b('0x1e')]);_0x2a7576[_0x370b('0x1c')]=qs['offset'](_0xf56701[_0x370b('0x35')][_0x370b('0x1c')]);}_0x2a7576['order']=qs[_0x370b('0x3d')](_0xf56701[_0x370b('0x35')][_0x370b('0x3d')]);_0x2a7576[_0x370b('0x3e')]=qs[_0x370b('0x37')](_[_0x370b('0x3f')](_0xf56701[_0x370b('0x35')],_0x49357d[_0x370b('0x37')]),_0x3b1db9);if(_0xf56701[_0x370b('0x35')]['filter']){_0x2a7576['where']=_[_0x370b('0x40')](_0x2a7576[_0x370b('0x3e')],{'$or':_['map'](_0x3b1db9,function(_0x28d608){if(_0x28d608[_0x370b('0x32')]!==_0x370b('0x41')){var _0x219240={};_0x219240[_0x28d608[_0x370b('0x2b')]]={'$like':'%'+_0xf56701[_0x370b('0x35')][_0x370b('0x42')]+'%'};return _0x219240;}})});}_0x2a7576=_['merge']({},_0x2a7576,_0xf56701[_0x370b('0x43')]);var _0x3cf900={'where':_0x2a7576[_0x370b('0x3e')]};return db[_0x370b('0x2f')]['count'](_0x3cf900)[_0x370b('0x27')](function(_0x51a944){_0x63f072[_0x370b('0x1f')]=_0x51a944;if(_0xf56701[_0x370b('0x35')][_0x370b('0x44')]){_0x2a7576[_0x370b('0x45')]=[{'all':!![]}];}return db[_0x370b('0x2f')][_0x370b('0x46')](_0x2a7576);})['then'](function(_0xcddc26){_0x63f072[_0x370b('0x47')]=_0xcddc26;return _0x63f072;})[_0x370b('0x27')](respondWithFilteredResult(_0x298425,_0x2a7576))['catch'](handleError(_0x298425,null));};exports[_0x370b('0x48')]=function(_0x587250,_0x42c2b6){var _0x15e361={'raw':!![],'where':{'id':_0x587250[_0x370b('0x49')]['id']}},_0x113a6={};_0x113a6['model']=_['keys'](db[_0x370b('0x2f')][_0x370b('0x30')]);_0x113a6[_0x370b('0x35')]=_[_0x370b('0x36')](_0x587250[_0x370b('0x35')]);_0x113a6['filters']=_[_0x370b('0x38')](_0x113a6[_0x370b('0x34')],_0x113a6[_0x370b('0x35')]);_0x15e361['attributes']=_['intersection'](_0x113a6[_0x370b('0x34')],qs[_0x370b('0x39')](_0x587250[_0x370b('0x35')][_0x370b('0x39')]));_0x15e361['attributes']=_0x15e361[_0x370b('0x3a')][_0x370b('0x3b')]?_0x15e361['attributes']:_0x113a6[_0x370b('0x34')];if(_0x587250[_0x370b('0x35')][_0x370b('0x44')]){_0x15e361[_0x370b('0x45')]=[{'all':!![]}];}_0x15e361=_[_0x370b('0x40')]({},_0x15e361,_0x587250[_0x370b('0x43')]);return db['FaxQueue'][_0x370b('0x4a')](_0x15e361)[_0x370b('0x27')](handleEntityNotFound(_0x42c2b6,null))[_0x370b('0x27')](respondWithResult(_0x42c2b6,null))['catch'](handleError(_0x42c2b6,null));};exports['create']=function(_0x1cbda4,_0xd5fa86){return db[_0x370b('0x2f')][_0x370b('0x4b')](_0x1cbda4[_0x370b('0x4c')],{})[_0x370b('0x27')](function(_0x260a4c){var _0x29d1f3=_0x1cbda4[_0x370b('0x4d')][_0x370b('0x25')]({'plain':!![]});if(!_0x29d1f3)throw new Error(_0x370b('0x4e'));if(_0x29d1f3['role']===_0x370b('0x4d')){var _0x21b2c7=_0x260a4c[_0x370b('0x25')]({'plain':!![]});var _0xce903f=_0x370b('0x26');return db[_0x370b('0x4f')][_0x370b('0x4a')]({'where':{'name':_0xce903f,'userProfileId':_0x29d1f3[_0x370b('0x50')]},'raw':!![]})[_0x370b('0x27')](function(_0x21249c){if(_0x21249c&&_0x21249c['autoAssociation']===0x0){return db[_0x370b('0x51')][_0x370b('0x4b')]({'name':_0x21b2c7[_0x370b('0x2b')],'resourceId':_0x21b2c7['id'],'type':_0x21249c[_0x370b('0x2b')],'sectionId':_0x21249c['id']},{})[_0x370b('0x27')](function(){return _0x260a4c;});}else{return _0x260a4c;}})[_0x370b('0x52')](function(_0xf67f4){logger[_0x370b('0x2a')](_0x370b('0x53'),_0xf67f4);throw _0xf67f4;});}return _0x260a4c;})[_0x370b('0x27')](respondWithResult(_0xd5fa86,0xc9))[_0x370b('0x52')](handleError(_0xd5fa86,null));};exports[_0x370b('0x54')]=function(_0x5b80a3,_0x25f2e5){if(_0x5b80a3['body']['id']){delete _0x5b80a3[_0x370b('0x4c')]['id'];}return db[_0x370b('0x2f')][_0x370b('0x4a')]({'where':{'id':_0x5b80a3[_0x370b('0x49')]['id']}})[_0x370b('0x27')](handleEntityNotFound(_0x25f2e5,null))[_0x370b('0x27')](saveUpdates(_0x5b80a3[_0x370b('0x4c')],null))[_0x370b('0x27')](respondWithResult(_0x25f2e5,null))[_0x370b('0x52')](handleError(_0x25f2e5,null));};exports[_0x370b('0x24')]=function(_0x11a423,_0x14248a){return db[_0x370b('0x2f')][_0x370b('0x4a')]({'where':{'id':_0x11a423[_0x370b('0x49')]['id']}})['then'](handleEntityNotFound(_0x14248a,null))[_0x370b('0x27')](removeEntity(_0x14248a,null))[_0x370b('0x52')](handleError(_0x14248a,null));};exports[_0x370b('0x55')]=function(_0x419732,_0x57786c){return db[_0x370b('0x2f')][_0x370b('0x55')]()[_0x370b('0x27')](respondWithResult(_0x57786c,null))['catch'](handleError(_0x57786c,null));};exports[_0x370b('0x56')]=function(_0x5aaf2a,_0x4f63f1,_0x1691c5){var _0x4467af={'raw':!![],'where':{}},_0x9f5c6f={},_0x304034;return db['FaxQueue'][_0x370b('0x57')]({'where':{'id':_0x5aaf2a[_0x370b('0x49')]['id']}})[_0x370b('0x27')](handleEntityNotFound(_0x4f63f1,null))['then'](function(_0x36ec26){if(_0x36ec26){_0x304034=_0x36ec26['get']({'plain':!![]});_0x9f5c6f[_0x370b('0x34')]=_[_0x370b('0x36')](db[_0x370b('0x58')][_0x370b('0x30')]);_0x9f5c6f[_0x370b('0x35')]=_['keys'](_0x5aaf2a['query']);_0x9f5c6f['filters']=_[_0x370b('0x38')](_0x9f5c6f[_0x370b('0x34')],_0x9f5c6f[_0x370b('0x35')]);_0x4467af[_0x370b('0x3a')]=_['intersection'](_0x9f5c6f[_0x370b('0x34')],qs[_0x370b('0x39')](_0x5aaf2a[_0x370b('0x35')]['fields']));_0x4467af[_0x370b('0x3a')]=_0x4467af['attributes'][_0x370b('0x3b')]?_0x4467af['attributes']:_0x9f5c6f[_0x370b('0x34')];if(!_0x5aaf2a['query'][_0x370b('0x3c')](_0x370b('0x59'))){_0x4467af[_0x370b('0x1e')]=qs[_0x370b('0x1e')](_0x5aaf2a[_0x370b('0x35')][_0x370b('0x1e')]);_0x4467af[_0x370b('0x1c')]=qs['offset'](_0x5aaf2a['query'][_0x370b('0x1c')]);}_0x4467af[_0x370b('0x5a')]=qs[_0x370b('0x3d')](_0x5aaf2a['query'][_0x370b('0x3d')]);_0x4467af['where']=qs[_0x370b('0x37')](_[_0x370b('0x3f')](_0x5aaf2a['query'],_0x9f5c6f['filters']));_0x4467af[_0x370b('0x3e')][_0x370b('0x5b')]=_0x36ec26['id'];if(_0x5aaf2a[_0x370b('0x35')][_0x370b('0x42')]){_0x4467af[_0x370b('0x3e')]=_['merge'](_0x4467af[_0x370b('0x3e')],{'$or':_[_0x370b('0x2e')](_0x4467af[_0x370b('0x3a')],function(_0x4443d5){var _0x57f25b={};_0x57f25b[_0x4443d5]={'$like':'%'+_0x5aaf2a[_0x370b('0x35')][_0x370b('0x42')]+'%'};return _0x57f25b;})});}_0x4467af=_[_0x370b('0x40')]({},_0x4467af,_0x5aaf2a[_0x370b('0x43')]);return db[_0x370b('0x58')][_0x370b('0x46')](_0x4467af);}})[_0x370b('0x27')](function(_0x4f897c){if(_0x4f897c){return db[_0x370b('0x5c')][_0x370b('0x5d')]({'where':{'id':_[_0x370b('0x2e')](_0x4f897c,_0x370b('0x5e')),'role':_0x370b('0x5f')},'attributes':['id',_0x370b('0x2b'),_0x370b('0x60'),'updatedAt',_0x370b('0x61')]});}})[_0x370b('0x27')](function(_0x2966be){if(_0x2966be){return{'count':_0x2966be[_0x370b('0x1f')],'rows':_['map'](_0x2966be[_0x370b('0x47')],function(_0x5344a2){return{'membername':_0x5344a2['name'],'UserId':_0x5344a2['id'],'queue_name':_0x304034[_0x370b('0x2b')],'FaxQueueId':_0x304034['id'],'interface':util['format'](_0x370b('0x62'),_0x370b('0x63'),_0x5344a2['name']),'penalty':0x0,'paused':_0x5344a2['faxPause'],'createdAt':_0x5344a2[_0x370b('0x61')],'updatedAt':_0x5344a2[_0x370b('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x370b('0x27')](respondWithFilteredResult(_0x4f63f1,_0x4467af))[_0x370b('0x52')](handleError(_0x4f63f1,null));};exports[_0x370b('0x65')]=function(_0x341409,_0x318640,_0x43503b){var _0x44f3b1={};var _0x2d78ba={};var _0x495a73;var _0xbdd057;return db['FaxQueue']['findOne']({'where':{'id':_0x341409['params']['id']}})[_0x370b('0x27')](handleEntityNotFound(_0x318640,null))['then'](function(_0x4e5a22){if(_0x4e5a22){_0x495a73=_0x4e5a22;_0x2d78ba[_0x370b('0x34')]=_[_0x370b('0x36')](db[_0x370b('0x66')][_0x370b('0x30')]);_0x2d78ba[_0x370b('0x35')]=_[_0x370b('0x36')](_0x341409['query']);_0x2d78ba[_0x370b('0x37')]=_[_0x370b('0x38')](_0x2d78ba['model'],_0x2d78ba[_0x370b('0x35')]);_0x44f3b1['attributes']=_['intersection'](_0x2d78ba[_0x370b('0x34')],qs['fields'](_0x341409[_0x370b('0x35')][_0x370b('0x39')]));_0x44f3b1['attributes']=_0x44f3b1[_0x370b('0x3a')][_0x370b('0x3b')]?_0x44f3b1[_0x370b('0x3a')]:_0x2d78ba[_0x370b('0x34')];_0x44f3b1['order']=qs[_0x370b('0x3d')](_0x341409[_0x370b('0x35')][_0x370b('0x3d')]);_0x44f3b1['where']=qs['filters'](_[_0x370b('0x3f')](_0x341409[_0x370b('0x35')],_0x2d78ba['filters']));if(_0x341409[_0x370b('0x35')]['filter']){_0x44f3b1[_0x370b('0x3e')]=_[_0x370b('0x40')](_0x44f3b1[_0x370b('0x3e')],{'$or':_[_0x370b('0x2e')](_0x44f3b1[_0x370b('0x3a')],function(_0x493768){var _0x4115e7={};_0x4115e7[_0x493768]={'$like':'%'+_0x341409['query'][_0x370b('0x42')]+'%'};return _0x4115e7;})});}_0x44f3b1=_[_0x370b('0x40')]({},_0x44f3b1,_0x341409['options']);return _0x495a73[_0x370b('0x65')](_0x44f3b1);}})['then'](function(_0x311c02){if(_0x311c02){_0xbdd057=_0x311c02[_0x370b('0x3b')];if(!_0x341409[_0x370b('0x35')]['hasOwnProperty']('nolimit')){_0x44f3b1[_0x370b('0x1e')]=qs[_0x370b('0x1e')](_0x341409[_0x370b('0x35')][_0x370b('0x1e')]);_0x44f3b1[_0x370b('0x1c')]=qs[_0x370b('0x1c')](_0x341409[_0x370b('0x35')][_0x370b('0x1c')]);}return _0x495a73[_0x370b('0x65')](_0x44f3b1);}})[_0x370b('0x27')](function(_0x36eefe){if(_0x36eefe){return _0x36eefe?{'count':_0xbdd057,'rows':_0x36eefe}:null;}})['then'](respondWithResult(_0x318640,null))[_0x370b('0x52')](handleError(_0x318640,null));};exports['addTeams']=function(_0x163ea9,_0x4c19f6,_0x4f4d0c){var _0x17a87f=_0x163ea9['body'][_0x370b('0x67')];return db[_0x370b('0x66')][_0x370b('0x46')]({'where':{'id':_0x17a87f},'attributes':['id'],'include':[{'model':db[_0x370b('0x5c')],'as':'Agents','attributes':['id',_0x370b('0x2b'),_0x370b('0x68'),_0x370b('0x69'),_0x370b('0x6a')],'raw':!![]}]})[_0x370b('0x27')](function(_0x382aed){if(_0x382aed){var _0x4a47b8=_[_0x370b('0x6b')](_0x382aed,function(_0x24e514){var _0x123ade=_0x24e514[_0x370b('0x25')]({'plain':!![]});return _0x123ade[_0x370b('0x6c')];});return db['FaxQueue'][_0x370b('0x4a')]({'where':{'id':_0x163ea9['params']['id']}})[_0x370b('0x27')](function(_0x1ee115){return db[_0x370b('0x6d')][_0x370b('0x6e')](function(_0x187969){return _0x1ee115[_0x370b('0x6f')](_0x17a87f,{'transaction':_0x187969})[_0x370b('0x27')](function(){return BPromise[_0x370b('0x70')](_0x4a47b8,function(_0x41eda4){return db[_0x370b('0x58')][_0x370b('0x71')]({'where':{'UserId':_0x41eda4['id'],'FaxQueueId':_0x163ea9[_0x370b('0x49')]['id']},'transaction':_0x187969});});})['then'](function(){_0x4a47b8[_0x370b('0x72')](function(_0xb83244){socket[_0x370b('0x73')](_0x370b('0x74'),{'UserId':_0xb83244['id'],'FaxQueueId':_0x1ee115['id']});});});});});}})[_0x370b('0x27')](respondWithStatusCode(_0x4c19f6,null))[_0x370b('0x52')](handleError(_0x4c19f6,null));};exports[_0x370b('0x75')]=function(_0x12ffa3,_0x3e8434,_0x4e1a0f){return db[_0x370b('0x66')][_0x370b('0x46')]({'where':{'id':_0x12ffa3[_0x370b('0x35')][_0x370b('0x67')]},'attributes':['id'],'include':[{'model':db[_0x370b('0x5c')],'as':_0x370b('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3e8434,null))['then'](function(_0x4c9a0a){var _0x122387=_[_0x370b('0x2e')](_0x4c9a0a,'id');var _0x17e9c7=[];var _0x591459=[];var _0x449197=squel[_0x370b('0x76')]();_0x449197[_0x370b('0x77')](_0x370b('0x78'))[_0x370b('0x79')](_0x370b('0x7a'),'tq')[_0x370b('0x7b')](_0x370b('0x7c'),'ut',_0x370b('0x7d'))['where'](_0x370b('0x7e'),_0x12ffa3[_0x370b('0x49')]['id']);for(var _0x4d0f0e=0x0;_0x4d0f0e<_0x4c9a0a[_0x370b('0x3b')];_0x4d0f0e+=0x1){let _0x5b00be=_0x4c9a0a[_0x4d0f0e];for(var _0x32aa0d=0x0;_0x32aa0d<_0x5b00be[_0x370b('0x6c')][_0x370b('0x3b')];_0x32aa0d+=0x1){let _0x33c300=_0x5b00be[_0x370b('0x6c')][_0x32aa0d];var _0x2db4ae=_0x449197[_0x370b('0x7f')]();_0x2db4ae[_0x370b('0x3e')](_0x370b('0x80'),_0x33c300['id']);_0x591459['push'](db[_0x370b('0x6d')][_0x370b('0x35')](_0x2db4ae[_0x370b('0x81')](),{'type':db[_0x370b('0x6d')][_0x370b('0x82')]['SELECT']})[_0x370b('0x27')](function(_0x481cfa){if(_0x481cfa[_0x370b('0x3b')]===0x1){return _0x33c300['id'];}else{var _0x3c91c4=_['every'](_[_0x370b('0x2e')](_0x481cfa,_0x370b('0x83')),function(_0x43dac5){return _[_0x370b('0x84')](_0x122387,_0x43dac5);});if(_0x3c91c4){return _0x33c300['id'];}}}));}}return BPromise[_0x370b('0x85')](_0x591459)[_0x370b('0x27')](function(_0x1c5346){_0x17e9c7=_(_0x17e9c7)[_0x370b('0x86')](_0x1c5346)['compact']()[_0x370b('0x87')]();return db[_0x370b('0x2f')]['find']({'where':{'id':_0x12ffa3['params']['id']}})[_0x370b('0x27')](function(_0x173ae9){return db[_0x370b('0x6d')][_0x370b('0x6e')](function(_0x3e5576){return _0x173ae9[_0x370b('0x75')](_0x12ffa3[_0x370b('0x35')][_0x370b('0x67')],{'transaction':_0x3e5576})[_0x370b('0x27')](function(){if(!_[_0x370b('0x88')](_0x17e9c7)){return _0x173ae9['removeAgents'](_0x17e9c7,{'transaction':_0x3e5576});}})[_0x370b('0x27')](function(){_0x17e9c7[_0x370b('0x72')](function(_0x564a2c){socket['emit'](_0x370b('0x89'),{'UserId':_0x564a2c,'FaxQueueId':_0x173ae9['id']});});});});});});})[_0x370b('0x27')](respondWithStatusCode(_0x3e8434,null))[_0x370b('0x52')](handleError(_0x3e8434,null));};exports[_0x370b('0x8a')]=function(_0x327445,_0x1bf5f0,_0x48623d){return db[_0x370b('0x2f')][_0x370b('0x4a')]({'where':{'id':_0x327445[_0x370b('0x49')]['id']}})[_0x370b('0x27')](handleEntityNotFound(_0x1bf5f0,null))['then'](function(_0x56bbe7){if(_0x56bbe7){return _0x56bbe7['addAgents'](_0x327445[_0x370b('0x4c')]['ids'],_[_0x370b('0x8b')](_0x327445[_0x370b('0x4c')],['ids','id'])||{})[_0x370b('0x8c')](function(_0x2544d5){for(var _0x12250e=0x0;_0x12250e<_0x327445['body']['ids'][_0x370b('0x3b')];_0x12250e+=0x1){socket[_0x370b('0x73')]('userFaxQueue:save',{'UserId':Number(_0x327445[_0x370b('0x4c')][_0x370b('0x67')][_0x12250e]),'FaxQueueId':Number(_0x327445[_0x370b('0x49')]['id'])});}return _0x2544d5;});}})['then'](respondWithResult(_0x1bf5f0,null))[_0x370b('0x52')](handleError(_0x1bf5f0,null));};exports[_0x370b('0x8d')]=function(_0x4f07eb,_0x13a43f,_0x1903c0){return db['FaxQueue'][_0x370b('0x4a')]({'where':{'id':_0x4f07eb['params']['id']}})[_0x370b('0x27')](handleEntityNotFound(_0x13a43f,null))[_0x370b('0x27')](function(_0x4ac182){if(_0x4ac182){return _0x4ac182[_0x370b('0x8d')](_0x4f07eb[_0x370b('0x35')]['ids'])['then'](function(){if(_[_0x370b('0x8e')](_0x4f07eb[_0x370b('0x35')][_0x370b('0x67')])){for(var _0x52d29b=0x0;_0x52d29b<_0x4f07eb['query'][_0x370b('0x67')][_0x370b('0x3b')];_0x52d29b+=0x1){socket[_0x370b('0x73')](_0x370b('0x89'),{'UserId':Number(_0x4f07eb[_0x370b('0x35')][_0x370b('0x67')][_0x52d29b]),'FaxQueueId':Number(_0x4f07eb['params']['id'])});}}else{socket[_0x370b('0x73')]('userFaxQueue:remove',{'UserId':Number(_0x4f07eb[_0x370b('0x35')][_0x370b('0x67')]),'FaxQueueId':Number(_0x4f07eb[_0x370b('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x13a43f,null))[_0x370b('0x52')](handleError(_0x13a43f,null));};exports[_0x370b('0x8f')]=function(_0x7a862d,_0x4aa163,_0x2c1279){var _0x589945={};var _0x32b85a={};var _0x43e153;var _0x52e7eb;return db['FaxQueue']['findOne']({'where':{'id':_0x7a862d[_0x370b('0x49')]['id']}})[_0x370b('0x27')](handleEntityNotFound(_0x4aa163,null))[_0x370b('0x27')](function(_0x25b75d){if(_0x25b75d){_0x43e153=_0x25b75d;_0x32b85a[_0x370b('0x34')]=_['keys'](db[_0x370b('0x5c')]['rawAttributes']);_0x32b85a[_0x370b('0x35')]=_[_0x370b('0x36')](_0x7a862d[_0x370b('0x35')]);_0x32b85a[_0x370b('0x37')]=_[_0x370b('0x38')](_0x32b85a[_0x370b('0x34')],_0x32b85a[_0x370b('0x35')]);_0x589945[_0x370b('0x3a')]=_[_0x370b('0x38')](_0x32b85a[_0x370b('0x34')],qs[_0x370b('0x39')](_0x7a862d[_0x370b('0x35')][_0x370b('0x39')]));_0x589945[_0x370b('0x3a')]=_0x589945['attributes']['length']?_0x589945['attributes']:_0x32b85a[_0x370b('0x34')];_0x589945[_0x370b('0x5a')]=qs[_0x370b('0x3d')](_0x7a862d[_0x370b('0x35')]['sort']);_0x589945['where']=qs[_0x370b('0x37')](_[_0x370b('0x3f')](_0x7a862d[_0x370b('0x35')],_0x32b85a['filters']));if(_0x7a862d[_0x370b('0x35')]['filter']){_0x589945[_0x370b('0x3e')]=_[_0x370b('0x40')](_0x589945[_0x370b('0x3e')],{'$or':_[_0x370b('0x2e')](_0x589945[_0x370b('0x3a')],function(_0x48b10f){var _0x5d649f={};_0x5d649f[_0x48b10f]={'$like':'%'+_0x7a862d['query'][_0x370b('0x42')]+'%'};return _0x5d649f;})});}_0x589945=_['merge']({},_0x589945,_0x7a862d[_0x370b('0x43')]);return _0x43e153['getAgents'](_0x589945);}})[_0x370b('0x27')](function(_0x5a590b){if(_0x5a590b){_0x52e7eb=_0x5a590b[_0x370b('0x3b')];if(!_0x7a862d[_0x370b('0x35')]['hasOwnProperty'](_0x370b('0x59'))){_0x589945[_0x370b('0x1e')]=qs[_0x370b('0x1e')](_0x7a862d[_0x370b('0x35')][_0x370b('0x1e')]);_0x589945[_0x370b('0x1c')]=qs[_0x370b('0x1c')](_0x7a862d[_0x370b('0x35')]['offset']);}return _0x43e153[_0x370b('0x8f')](_0x589945);}})['then'](function(_0x35a203){if(_0x35a203){return _0x35a203?{'count':_0x52e7eb,'rows':_0x35a203}:null;}})['then'](respondWithResult(_0x4aa163,null))[_0x370b('0x52')](handleError(_0x4aa163,null));}; \ No newline at end of file +var _0xd90a=['json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','FaxQueues','error','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','FaxQueueId','UserFaxQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','SIP','faxPause','Team','getTeams','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','forEach','emit','removeTeams','field','tq.TeamId','from','join','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','addAgents','spread','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','status','end'];(function(_0x3e4ebb,_0x48c08c){var _0x20f694=function(_0x5a3a12){while(--_0x5a3a12){_0x3e4ebb['push'](_0x3e4ebb['shift']());}};_0x20f694(++_0x48c08c);}(_0xd90a,0x6b));var _0xad90=function(_0x355454,_0x300b56){_0x355454=_0x355454-0x0;var _0x575584=_0xd90a[_0x355454];return _0x575584;};'use strict';var emlformat=require(_0xad90('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad90('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xad90('0x2'));var moment=require('moment');var BPromise=require(_0xad90('0x3'));var Mustache=require(_0xad90('0x4'));var util=require(_0xad90('0x5'));var path=require(_0xad90('0x6'));var sox=require(_0xad90('0x7'));var csv=require(_0xad90('0x8'));var ejs=require(_0xad90('0x9'));var fs=require('fs');var fs_extra=require(_0xad90('0xa'));var _=require(_0xad90('0xb'));var squel=require(_0xad90('0xc'));var crypto=require(_0xad90('0xd'));var jsforce=require(_0xad90('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xad90('0x8'));var querystring=require(_0xad90('0xf'));var Papa=require('papaparse');var Redis=require(_0xad90('0x10'));var authService=require(_0xad90('0x11'));var qs=require(_0xad90('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad90('0x13'));var logger=require(_0xad90('0x14'))('api');var utils=require(_0xad90('0x15'));var config=require(_0xad90('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xad90('0x17'))['db'];config[_0xad90('0x18')]=_[_0xad90('0x19')](config[_0xad90('0x18')],{'host':_0xad90('0x1a'),'port':0x18eb});var socket=require(_0xad90('0x1b'))(new Redis(config[_0xad90('0x18')]));require(_0xad90('0x1c'))['register'](socket);function respondWithStatusCode(_0x2f626f,_0x2c42ee){_0x2c42ee=_0x2c42ee||0xcc;return function(_0x311e4a){if(_0x311e4a){return _0x2f626f[_0xad90('0x1d')](_0x2c42ee);}return _0x2f626f[_0xad90('0x1e')](_0x2c42ee)[_0xad90('0x1f')]();};}function respondWithResult(_0x4e36c1,_0x4fc9cc){_0x4fc9cc=_0x4fc9cc||0xc8;return function(_0x410804){if(_0x410804){return _0x4e36c1[_0xad90('0x1e')](_0x4fc9cc)[_0xad90('0x20')](_0x410804);}};}function respondWithFilteredResult(_0x38d395,_0x32719d){return function(_0x452c){if(_0x452c){var _0x5b1866=typeof _0x32719d[_0xad90('0x21')]===_0xad90('0x22')&&typeof _0x32719d[_0xad90('0x23')]===_0xad90('0x22');var _0x49c547=_0x452c[_0xad90('0x24')];var _0x3596ba=_0x5b1866?0x0:_0x32719d[_0xad90('0x21')];var _0x49b753=_0x5b1866?_0x452c['count']:_0x32719d['offset']+_0x32719d[_0xad90('0x23')];var _0x46e12b;if(_0x49b753>=_0x49c547){_0x49b753=_0x49c547;_0x46e12b=0xc8;}else{_0x46e12b=0xce;}_0x38d395['status'](_0x46e12b);return _0x38d395[_0xad90('0x25')]('Content-Range',_0x3596ba+'-'+_0x49b753+'/'+_0x49c547)[_0xad90('0x20')](_0x452c);}return null;};}function patchUpdates(_0x307438){return function(_0x457ad0){try{jsonpatch[_0xad90('0x26')](_0x457ad0,_0x307438,!![]);}catch(_0x4ecc36){return BPromise['reject'](_0x4ecc36);}return _0x457ad0[_0xad90('0x27')]();};}function saveUpdates(_0x11333a,_0x1c8203){return function(_0xf80c2c){if(_0xf80c2c){return _0xf80c2c[_0xad90('0x28')](_0x11333a)[_0xad90('0x29')](function(_0x532a59){return _0x532a59;});}return null;};}function removeEntity(_0x51bad2,_0x467361){return function(_0x40172e){if(_0x40172e){return _0x40172e[_0xad90('0x2a')]()[_0xad90('0x29')](function(){var _0x5b20cf=_0x40172e[_0xad90('0x2b')]({'plain':!![]});var _0x149634=_0xad90('0x2c');return db['UserProfileResource'][_0xad90('0x2a')]({'where':{'type':_0x149634,'resourceId':_0x5b20cf['id']}})['then'](function(){return _0x40172e;});})[_0xad90('0x29')](function(){_0x51bad2[_0xad90('0x1e')](0xcc)[_0xad90('0x1f')]();});}};}function handleEntityNotFound(_0x2a7c6c,_0x2310a4){return function(_0x40ab77){if(!_0x40ab77){_0x2a7c6c['sendStatus'](0x194);}return _0x40ab77;};}function handleError(_0x3826ef,_0x5e7a22){_0x5e7a22=_0x5e7a22||0x1f4;return function(_0x416546){logger[_0xad90('0x2d')](_0x416546['stack']);if(_0x416546[_0xad90('0x2e')]){delete _0x416546[_0xad90('0x2e')];}_0x3826ef[_0xad90('0x1e')](_0x5e7a22)[_0xad90('0x2f')](_0x416546);};}exports[_0xad90('0x30')]=function(_0x2d8e3c,_0x583628){var _0x133247={},_0x51c19f={},_0x2c05ae={'count':0x0,'rows':[]};var _0x6fd0d9=_[_0xad90('0x31')](db[_0xad90('0x32')][_0xad90('0x33')],function(_0x5f5cbd){return{'name':_0x5f5cbd[_0xad90('0x34')],'type':_0x5f5cbd['type'][_0xad90('0x35')]};});_0x51c19f[_0xad90('0x36')]=_[_0xad90('0x31')](_0x6fd0d9,_0xad90('0x2e'));_0x51c19f[_0xad90('0x37')]=_[_0xad90('0x38')](_0x2d8e3c[_0xad90('0x37')]);_0x51c19f['filters']=_[_0xad90('0x39')](_0x51c19f['model'],_0x51c19f[_0xad90('0x37')]);_0x133247[_0xad90('0x3a')]=_['intersection'](_0x51c19f['model'],qs[_0xad90('0x3b')](_0x2d8e3c['query']['fields']));_0x133247[_0xad90('0x3a')]=_0x133247['attributes'][_0xad90('0x3c')]?_0x133247[_0xad90('0x3a')]:_0x51c19f[_0xad90('0x36')];if(!_0x2d8e3c[_0xad90('0x37')][_0xad90('0x3d')](_0xad90('0x3e'))){_0x133247['limit']=qs[_0xad90('0x23')](_0x2d8e3c['query'][_0xad90('0x23')]);_0x133247[_0xad90('0x21')]=qs[_0xad90('0x21')](_0x2d8e3c[_0xad90('0x37')][_0xad90('0x21')]);}_0x133247[_0xad90('0x3f')]=qs[_0xad90('0x40')](_0x2d8e3c[_0xad90('0x37')]['sort']);_0x133247[_0xad90('0x41')]=qs[_0xad90('0x42')](_[_0xad90('0x43')](_0x2d8e3c['query'],_0x51c19f['filters']),_0x6fd0d9);if(_0x2d8e3c[_0xad90('0x37')][_0xad90('0x44')]){_0x133247[_0xad90('0x41')]=_[_0xad90('0x45')](_0x133247[_0xad90('0x41')],{'$or':_['map'](_0x6fd0d9,function(_0x538ce2){if(_0x538ce2[_0xad90('0x46')]!==_0xad90('0x47')){var _0x55e80e={};_0x55e80e[_0x538ce2[_0xad90('0x2e')]]={'$like':'%'+_0x2d8e3c[_0xad90('0x37')][_0xad90('0x44')]+'%'};return _0x55e80e;}})});}_0x133247=_[_0xad90('0x45')]({},_0x133247,_0x2d8e3c[_0xad90('0x48')]);var _0x2d4f57={'where':_0x133247[_0xad90('0x41')]};return db[_0xad90('0x32')][_0xad90('0x24')](_0x2d4f57)[_0xad90('0x29')](function(_0x56526b){_0x2c05ae[_0xad90('0x24')]=_0x56526b;if(_0x2d8e3c[_0xad90('0x37')][_0xad90('0x49')]){_0x133247[_0xad90('0x4a')]=[{'all':!![]}];}return db[_0xad90('0x32')][_0xad90('0x4b')](_0x133247);})['then'](function(_0x26fbc2){_0x2c05ae['rows']=_0x26fbc2;return _0x2c05ae;})['then'](respondWithFilteredResult(_0x583628,_0x133247))[_0xad90('0x4c')](handleError(_0x583628,null));};exports[_0xad90('0x4d')]=function(_0x3fdfc6,_0x4d8ba7){var _0x13a992={'raw':!![],'where':{'id':_0x3fdfc6[_0xad90('0x4e')]['id']}},_0x490059={};_0x490059[_0xad90('0x36')]=_[_0xad90('0x38')](db['FaxQueue'][_0xad90('0x33')]);_0x490059['query']=_[_0xad90('0x38')](_0x3fdfc6[_0xad90('0x37')]);_0x490059['filters']=_[_0xad90('0x39')](_0x490059[_0xad90('0x36')],_0x490059[_0xad90('0x37')]);_0x13a992['attributes']=_[_0xad90('0x39')](_0x490059[_0xad90('0x36')],qs[_0xad90('0x3b')](_0x3fdfc6[_0xad90('0x37')][_0xad90('0x3b')]));_0x13a992[_0xad90('0x3a')]=_0x13a992[_0xad90('0x3a')][_0xad90('0x3c')]?_0x13a992[_0xad90('0x3a')]:_0x490059[_0xad90('0x36')];if(_0x3fdfc6[_0xad90('0x37')][_0xad90('0x49')]){_0x13a992['include']=[{'all':!![]}];}_0x13a992=_[_0xad90('0x45')]({},_0x13a992,_0x3fdfc6[_0xad90('0x48')]);return db[_0xad90('0x32')][_0xad90('0x4f')](_0x13a992)[_0xad90('0x29')](handleEntityNotFound(_0x4d8ba7,null))[_0xad90('0x29')](respondWithResult(_0x4d8ba7,null))[_0xad90('0x4c')](handleError(_0x4d8ba7,null));};exports[_0xad90('0x50')]=function(_0x33bdef,_0x13afee){return db['FaxQueue']['create'](_0x33bdef[_0xad90('0x51')],{})[_0xad90('0x29')](function(_0x265aad){var _0x2fb89d=_0x33bdef[_0xad90('0x52')]['get']({'plain':!![]});if(!_0x2fb89d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2fb89d[_0xad90('0x53')]===_0xad90('0x52')){var _0x21587c=_0x265aad[_0xad90('0x2b')]({'plain':!![]});var _0x442d20=_0xad90('0x2c');return db[_0xad90('0x54')][_0xad90('0x4f')]({'where':{'name':_0x442d20,'userProfileId':_0x2fb89d['userProfileId']},'raw':!![]})[_0xad90('0x29')](function(_0x53a36e){if(_0x53a36e&&_0x53a36e[_0xad90('0x55')]===0x0){return db[_0xad90('0x56')]['create']({'name':_0x21587c[_0xad90('0x2e')],'resourceId':_0x21587c['id'],'type':_0x53a36e[_0xad90('0x2e')],'sectionId':_0x53a36e['id']},{})[_0xad90('0x29')](function(){return _0x265aad;});}else{return _0x265aad;}})['catch'](function(_0x537128){logger[_0xad90('0x2d')](_0xad90('0x57'),_0x537128);throw _0x537128;});}return _0x265aad;})['then'](respondWithResult(_0x13afee,0xc9))[_0xad90('0x4c')](handleError(_0x13afee,null));};exports[_0xad90('0x28')]=function(_0x189d48,_0x2be7e6){if(_0x189d48[_0xad90('0x51')]['id']){delete _0x189d48['body']['id'];}return db[_0xad90('0x32')][_0xad90('0x4f')]({'where':{'id':_0x189d48[_0xad90('0x4e')]['id']}})[_0xad90('0x29')](handleEntityNotFound(_0x2be7e6,null))[_0xad90('0x29')](saveUpdates(_0x189d48[_0xad90('0x51')],null))['then'](respondWithResult(_0x2be7e6,null))[_0xad90('0x4c')](handleError(_0x2be7e6,null));};exports[_0xad90('0x2a')]=function(_0x4b4ce6,_0x584512){return db[_0xad90('0x32')][_0xad90('0x4f')]({'where':{'id':_0x4b4ce6['params']['id']}})[_0xad90('0x29')](handleEntityNotFound(_0x584512,null))[_0xad90('0x29')](removeEntity(_0x584512,null))[_0xad90('0x4c')](handleError(_0x584512,null));};exports[_0xad90('0x58')]=function(_0x5b2647,_0x589a91){return db[_0xad90('0x32')][_0xad90('0x58')]()[_0xad90('0x29')](respondWithResult(_0x589a91,null))[_0xad90('0x4c')](handleError(_0x589a91,null));};exports['getMembers']=function(_0x383c0e,_0x3582da,_0x295fa9){var _0x4d87c9={'raw':!![],'where':{}},_0x56d4c9={},_0x74bed1;return db[_0xad90('0x32')][_0xad90('0x59')]({'where':{'id':_0x383c0e['params']['id']}})['then'](handleEntityNotFound(_0x3582da,null))[_0xad90('0x29')](function(_0x2a9501){if(_0x2a9501){_0x74bed1=_0x2a9501[_0xad90('0x2b')]({'plain':!![]});_0x56d4c9[_0xad90('0x36')]=_[_0xad90('0x38')](db['UserFaxQueue'][_0xad90('0x33')]);_0x56d4c9[_0xad90('0x37')]=_['keys'](_0x383c0e[_0xad90('0x37')]);_0x56d4c9[_0xad90('0x42')]=_[_0xad90('0x39')](_0x56d4c9[_0xad90('0x36')],_0x56d4c9[_0xad90('0x37')]);_0x4d87c9[_0xad90('0x3a')]=_['intersection'](_0x56d4c9[_0xad90('0x36')],qs['fields'](_0x383c0e[_0xad90('0x37')]['fields']));_0x4d87c9[_0xad90('0x3a')]=_0x4d87c9[_0xad90('0x3a')]['length']?_0x4d87c9[_0xad90('0x3a')]:_0x56d4c9[_0xad90('0x36')];if(!_0x383c0e[_0xad90('0x37')]['hasOwnProperty'](_0xad90('0x3e'))){_0x4d87c9['limit']=qs[_0xad90('0x23')](_0x383c0e[_0xad90('0x37')][_0xad90('0x23')]);_0x4d87c9[_0xad90('0x21')]=qs[_0xad90('0x21')](_0x383c0e[_0xad90('0x37')]['offset']);}_0x4d87c9['order']=qs[_0xad90('0x40')](_0x383c0e[_0xad90('0x37')][_0xad90('0x40')]);_0x4d87c9[_0xad90('0x41')]=qs[_0xad90('0x42')](_[_0xad90('0x43')](_0x383c0e[_0xad90('0x37')],_0x56d4c9['filters']));_0x4d87c9[_0xad90('0x41')][_0xad90('0x5a')]=_0x2a9501['id'];if(_0x383c0e['query'][_0xad90('0x44')]){_0x4d87c9['where']=_['merge'](_0x4d87c9[_0xad90('0x41')],{'$or':_[_0xad90('0x31')](_0x4d87c9[_0xad90('0x3a')],function(_0x154c9f){var _0x348e4b={};_0x348e4b[_0x154c9f]={'$like':'%'+_0x383c0e[_0xad90('0x37')][_0xad90('0x44')]+'%'};return _0x348e4b;})});}_0x4d87c9=_[_0xad90('0x45')]({},_0x4d87c9,_0x383c0e[_0xad90('0x48')]);return db[_0xad90('0x5b')][_0xad90('0x4b')](_0x4d87c9);}})['then'](function(_0x267f03){if(_0x267f03){return db[_0xad90('0x5c')][_0xad90('0x5d')]({'where':{'id':_[_0xad90('0x31')](_0x267f03,_0xad90('0x5e')),'role':_0xad90('0x5f')},'attributes':['id',_0xad90('0x2e'),'faxPause',_0xad90('0x60'),_0xad90('0x61')]});}})[_0xad90('0x29')](function(_0x5e191b){if(_0x5e191b){return{'count':_0x5e191b[_0xad90('0x24')],'rows':_[_0xad90('0x31')](_0x5e191b[_0xad90('0x62')],function(_0x526177){return{'membername':_0x526177[_0xad90('0x2e')],'UserId':_0x526177['id'],'queue_name':_0x74bed1['name'],'FaxQueueId':_0x74bed1['id'],'interface':util[_0xad90('0x63')](_0xad90('0x64'),_0xad90('0x65'),_0x526177[_0xad90('0x2e')]),'penalty':0x0,'paused':_0x526177[_0xad90('0x66')],'createdAt':_0x526177['createdAt'],'updatedAt':_0x526177['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xad90('0x29')](respondWithFilteredResult(_0x3582da,_0x4d87c9))[_0xad90('0x4c')](handleError(_0x3582da,null));};exports['getTeams']=function(_0x1344de,_0x19b4fe,_0x25da57){var _0x23e695={};var _0x47faaa={};var _0x15f7b0;var _0x308b2f;return db[_0xad90('0x32')][_0xad90('0x59')]({'where':{'id':_0x1344de[_0xad90('0x4e')]['id']}})['then'](handleEntityNotFound(_0x19b4fe,null))[_0xad90('0x29')](function(_0x1e1dc8){if(_0x1e1dc8){_0x15f7b0=_0x1e1dc8;_0x47faaa[_0xad90('0x36')]=_[_0xad90('0x38')](db[_0xad90('0x67')][_0xad90('0x33')]);_0x47faaa[_0xad90('0x37')]=_[_0xad90('0x38')](_0x1344de[_0xad90('0x37')]);_0x47faaa[_0xad90('0x42')]=_[_0xad90('0x39')](_0x47faaa[_0xad90('0x36')],_0x47faaa['query']);_0x23e695[_0xad90('0x3a')]=_[_0xad90('0x39')](_0x47faaa[_0xad90('0x36')],qs[_0xad90('0x3b')](_0x1344de[_0xad90('0x37')]['fields']));_0x23e695[_0xad90('0x3a')]=_0x23e695['attributes'][_0xad90('0x3c')]?_0x23e695[_0xad90('0x3a')]:_0x47faaa[_0xad90('0x36')];_0x23e695[_0xad90('0x3f')]=qs['sort'](_0x1344de[_0xad90('0x37')]['sort']);_0x23e695[_0xad90('0x41')]=qs[_0xad90('0x42')](_[_0xad90('0x43')](_0x1344de[_0xad90('0x37')],_0x47faaa[_0xad90('0x42')]));if(_0x1344de[_0xad90('0x37')][_0xad90('0x44')]){_0x23e695[_0xad90('0x41')]=_[_0xad90('0x45')](_0x23e695['where'],{'$or':_[_0xad90('0x31')](_0x23e695[_0xad90('0x3a')],function(_0x342397){var _0x1cc9e4={};_0x1cc9e4[_0x342397]={'$like':'%'+_0x1344de[_0xad90('0x37')][_0xad90('0x44')]+'%'};return _0x1cc9e4;})});}_0x23e695=_[_0xad90('0x45')]({},_0x23e695,_0x1344de[_0xad90('0x48')]);return _0x15f7b0[_0xad90('0x68')](_0x23e695);}})[_0xad90('0x29')](function(_0x31b7d2){if(_0x31b7d2){_0x308b2f=_0x31b7d2[_0xad90('0x3c')];if(!_0x1344de[_0xad90('0x37')][_0xad90('0x3d')](_0xad90('0x3e'))){_0x23e695[_0xad90('0x23')]=qs[_0xad90('0x23')](_0x1344de[_0xad90('0x37')]['limit']);_0x23e695[_0xad90('0x21')]=qs[_0xad90('0x21')](_0x1344de[_0xad90('0x37')][_0xad90('0x21')]);}return _0x15f7b0[_0xad90('0x68')](_0x23e695);}})[_0xad90('0x29')](function(_0x192fa5){if(_0x192fa5){return _0x192fa5?{'count':_0x308b2f,'rows':_0x192fa5}:null;}})['then'](respondWithResult(_0x19b4fe,null))[_0xad90('0x4c')](handleError(_0x19b4fe,null));};exports[_0xad90('0x69')]=function(_0x57707e,_0x5934d3,_0x249b3e){var _0x3b7b72=_0x57707e[_0xad90('0x51')][_0xad90('0x6a')];return db[_0xad90('0x67')][_0xad90('0x4b')]({'where':{'id':_0x3b7b72},'attributes':['id'],'include':[{'model':db[_0xad90('0x5c')],'as':'Agents','attributes':['id',_0xad90('0x2e'),'online',_0xad90('0x6b'),_0xad90('0x6c')],'raw':!![]}]})['then'](function(_0x24d9db){if(_0x24d9db){var _0x39e37d=_[_0xad90('0x6d')](_0x24d9db,function(_0x5b2df9){var _0x53bc3b=_0x5b2df9[_0xad90('0x2b')]({'plain':!![]});return _0x53bc3b[_0xad90('0x6e')];});return db['FaxQueue'][_0xad90('0x4f')]({'where':{'id':_0x57707e[_0xad90('0x4e')]['id']}})[_0xad90('0x29')](function(_0x43401d){return db[_0xad90('0x6f')][_0xad90('0x70')](function(_0x5a6619){return _0x43401d[_0xad90('0x69')](_0x3b7b72,{'transaction':_0x5a6619})[_0xad90('0x29')](function(){return BPromise['each'](_0x39e37d,function(_0x5ef13c){return db[_0xad90('0x5b')]['findOrCreate']({'where':{'UserId':_0x5ef13c['id'],'FaxQueueId':_0x57707e[_0xad90('0x4e')]['id']},'transaction':_0x5a6619});});})[_0xad90('0x29')](function(){_0x39e37d[_0xad90('0x71')](function(_0x50939e){socket[_0xad90('0x72')]('userFaxQueue:save',{'UserId':_0x50939e['id'],'FaxQueueId':_0x43401d['id']});});});});});}})['then'](respondWithStatusCode(_0x5934d3,null))[_0xad90('0x4c')](handleError(_0x5934d3,null));};exports[_0xad90('0x73')]=function(_0xcab6f7,_0x4963ee,_0x35e4e8){return db[_0xad90('0x67')][_0xad90('0x4b')]({'where':{'id':_0xcab6f7['query'][_0xad90('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xad90('0x5c')],'as':_0xad90('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4963ee,null))[_0xad90('0x29')](function(_0x44823a){var _0x15f905=_[_0xad90('0x31')](_0x44823a,'id');var _0x5af11e=[];var _0x5dfbf9=[];var _0x55fde1=squel['select']();_0x55fde1[_0xad90('0x74')](_0xad90('0x75'))[_0xad90('0x76')]('team_has_fax_queues','tq')[_0xad90('0x77')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xad90('0x41')]('FaxQueueId\x20=\x20?',_0xcab6f7[_0xad90('0x4e')]['id']);for(var _0x1bd4c5=0x0;_0x1bd4c5<_0x44823a['length'];_0x1bd4c5+=0x1){let _0x27000a=_0x44823a[_0x1bd4c5];for(var _0x457975=0x0;_0x457975<_0x27000a[_0xad90('0x6e')]['length'];_0x457975+=0x1){let _0x543f48=_0x27000a[_0xad90('0x6e')][_0x457975];var _0x2babaa=_0x55fde1[_0xad90('0x78')]();_0x2babaa[_0xad90('0x41')](_0xad90('0x79'),_0x543f48['id']);_0x5dfbf9['push'](db[_0xad90('0x6f')]['query'](_0x2babaa[_0xad90('0x7a')](),{'type':db['sequelize'][_0xad90('0x7b')][_0xad90('0x7c')]})[_0xad90('0x29')](function(_0xae930){if(_0xae930['length']===0x1){return _0x543f48['id'];}else{var _0x46102a=_[_0xad90('0x7d')](_[_0xad90('0x31')](_0xae930,_0xad90('0x7e')),function(_0xe73039){return _[_0xad90('0x7f')](_0x15f905,_0xe73039);});if(_0x46102a){return _0x543f48['id'];}}}));}}return BPromise['all'](_0x5dfbf9)[_0xad90('0x29')](function(_0x2a2b01){_0x5af11e=_(_0x5af11e)[_0xad90('0x80')](_0x2a2b01)[_0xad90('0x81')]()[_0xad90('0x82')]();return db[_0xad90('0x32')][_0xad90('0x4f')]({'where':{'id':_0xcab6f7[_0xad90('0x4e')]['id']}})[_0xad90('0x29')](function(_0x16b021){return db[_0xad90('0x6f')][_0xad90('0x70')](function(_0x1e93a1){return _0x16b021[_0xad90('0x73')](_0xcab6f7[_0xad90('0x37')][_0xad90('0x6a')],{'transaction':_0x1e93a1})[_0xad90('0x29')](function(){if(!_[_0xad90('0x83')](_0x5af11e)){return _0x16b021[_0xad90('0x84')](_0x5af11e,{'transaction':_0x1e93a1});}})[_0xad90('0x29')](function(){_0x5af11e['forEach'](function(_0x50a6ae){socket['emit']('userFaxQueue:remove',{'UserId':_0x50a6ae,'FaxQueueId':_0x16b021['id']});});});});});});})[_0xad90('0x29')](respondWithStatusCode(_0x4963ee,null))[_0xad90('0x4c')](handleError(_0x4963ee,null));};exports[_0xad90('0x85')]=function(_0x32e51b,_0x3ae1bc,_0x103df9){return db[_0xad90('0x32')]['find']({'where':{'id':_0x32e51b[_0xad90('0x4e')]['id']}})[_0xad90('0x29')](handleEntityNotFound(_0x3ae1bc,null))['then'](function(_0x3cd2b1){if(_0x3cd2b1){return _0x3cd2b1[_0xad90('0x85')](_0x32e51b[_0xad90('0x51')]['ids'],_['omit'](_0x32e51b['body'],[_0xad90('0x6a'),'id'])||{})[_0xad90('0x86')](function(_0x4cdb1f){for(var _0x51ba3f=0x0;_0x51ba3f<_0x32e51b['body'][_0xad90('0x6a')][_0xad90('0x3c')];_0x51ba3f+=0x1){socket[_0xad90('0x72')](_0xad90('0x87'),{'UserId':Number(_0x32e51b[_0xad90('0x51')]['ids'][_0x51ba3f]),'FaxQueueId':Number(_0x32e51b[_0xad90('0x4e')]['id'])});}return _0x4cdb1f;});}})[_0xad90('0x29')](respondWithResult(_0x3ae1bc,null))[_0xad90('0x4c')](handleError(_0x3ae1bc,null));};exports[_0xad90('0x84')]=function(_0x366137,_0x18e48f,_0x5e4267){return db['FaxQueue'][_0xad90('0x4f')]({'where':{'id':_0x366137[_0xad90('0x4e')]['id']}})[_0xad90('0x29')](handleEntityNotFound(_0x18e48f,null))[_0xad90('0x29')](function(_0x13ff2b){if(_0x13ff2b){return _0x13ff2b[_0xad90('0x84')](_0x366137[_0xad90('0x37')][_0xad90('0x6a')])[_0xad90('0x29')](function(){if(_[_0xad90('0x88')](_0x366137[_0xad90('0x37')][_0xad90('0x6a')])){for(var _0x5dd605=0x0;_0x5dd605<_0x366137[_0xad90('0x37')][_0xad90('0x6a')][_0xad90('0x3c')];_0x5dd605+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x366137['query']['ids'][_0x5dd605]),'FaxQueueId':Number(_0x366137[_0xad90('0x4e')]['id'])});}}else{socket[_0xad90('0x72')](_0xad90('0x89'),{'UserId':Number(_0x366137[_0xad90('0x37')][_0xad90('0x6a')]),'FaxQueueId':Number(_0x366137[_0xad90('0x4e')]['id'])});}});}})[_0xad90('0x29')](respondWithStatusCode(_0x18e48f,null))[_0xad90('0x4c')](handleError(_0x18e48f,null));};exports[_0xad90('0x8a')]=function(_0x2becb3,_0x110201,_0x83cf34){var _0x5473a5={};var _0x483d55={};var _0x5891fe;var _0x2d564f;return db['FaxQueue'][_0xad90('0x59')]({'where':{'id':_0x2becb3[_0xad90('0x4e')]['id']}})[_0xad90('0x29')](handleEntityNotFound(_0x110201,null))['then'](function(_0x78fd49){if(_0x78fd49){_0x5891fe=_0x78fd49;_0x483d55[_0xad90('0x36')]=_['keys'](db[_0xad90('0x5c')][_0xad90('0x33')]);_0x483d55['query']=_[_0xad90('0x38')](_0x2becb3[_0xad90('0x37')]);_0x483d55[_0xad90('0x42')]=_[_0xad90('0x39')](_0x483d55['model'],_0x483d55[_0xad90('0x37')]);_0x5473a5[_0xad90('0x3a')]=_[_0xad90('0x39')](_0x483d55[_0xad90('0x36')],qs[_0xad90('0x3b')](_0x2becb3[_0xad90('0x37')]['fields']));_0x5473a5[_0xad90('0x3a')]=_0x5473a5[_0xad90('0x3a')][_0xad90('0x3c')]?_0x5473a5[_0xad90('0x3a')]:_0x483d55[_0xad90('0x36')];_0x5473a5[_0xad90('0x3f')]=qs[_0xad90('0x40')](_0x2becb3[_0xad90('0x37')][_0xad90('0x40')]);_0x5473a5[_0xad90('0x41')]=qs[_0xad90('0x42')](_['pick'](_0x2becb3[_0xad90('0x37')],_0x483d55[_0xad90('0x42')]));if(_0x2becb3[_0xad90('0x37')]['filter']){_0x5473a5[_0xad90('0x41')]=_['merge'](_0x5473a5[_0xad90('0x41')],{'$or':_[_0xad90('0x31')](_0x5473a5[_0xad90('0x3a')],function(_0x1d7c28){var _0x3c7bf3={};_0x3c7bf3[_0x1d7c28]={'$like':'%'+_0x2becb3['query'][_0xad90('0x44')]+'%'};return _0x3c7bf3;})});}_0x5473a5=_[_0xad90('0x45')]({},_0x5473a5,_0x2becb3['options']);return _0x5891fe[_0xad90('0x8a')](_0x5473a5);}})['then'](function(_0x168521){if(_0x168521){_0x2d564f=_0x168521['length'];if(!_0x2becb3['query'][_0xad90('0x3d')]('nolimit')){_0x5473a5[_0xad90('0x23')]=qs[_0xad90('0x23')](_0x2becb3['query'][_0xad90('0x23')]);_0x5473a5[_0xad90('0x21')]=qs[_0xad90('0x21')](_0x2becb3[_0xad90('0x37')][_0xad90('0x21')]);}return _0x5891fe[_0xad90('0x8a')](_0x5473a5);}})[_0xad90('0x29')](function(_0x418a1a){if(_0x418a1a){return _0x418a1a?{'count':_0x2d564f,'rows':_0x418a1a}:null;}})[_0xad90('0x29')](respondWithResult(_0x110201,null))[_0xad90('0x4c')](handleError(_0x110201,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 75c3a95..8abeeaa 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 _0xdc90=['setMaxListeners','remove','emit','hook','events','../../mysqldb','FaxQueue'];(function(_0x2e2179,_0x283778){var _0x4e525c=function(_0x9e6bc7){while(--_0x9e6bc7){_0x2e2179['push'](_0x2e2179['shift']());}};_0x4e525c(++_0x283778);}(_0xdc90,0x1ee));var _0x0dc9=function(_0xafea8b,_0x1031dd){_0xafea8b=_0xafea8b-0x0;var _0x3db7a1=_0xdc90[_0xafea8b];return _0x3db7a1;};'use strict';var EventEmitter=require(_0x0dc9('0x0'));var FaxQueue=require(_0x0dc9('0x1'))['db'][_0x0dc9('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0dc9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0dc9('0x4')};function emitEvent(_0x157637){return function(_0x1958a7,_0x2b8901,_0x2047b1){FaxQueueEvents[_0x0dc9('0x5')](_0x157637+':'+_0x1958a7['id'],_0x1958a7);FaxQueueEvents[_0x0dc9('0x5')](_0x157637,_0x1958a7);_0x2047b1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x0dc9('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x117b=['events','../../mysqldb','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5e6943,_0x45fe80){var _0x17be2e=function(_0x37f8ad){while(--_0x37f8ad){_0x5e6943['push'](_0x5e6943['shift']());}};_0x17be2e(++_0x45fe80);}(_0x117b,0x160));var _0xb117=function(_0x425a6c,_0x2df8e6){_0x425a6c=_0x425a6c-0x0;var _0x3cc59e=_0x117b[_0x425a6c];return _0x3cc59e;};'use strict';var EventEmitter=require(_0xb117('0x0'));var FaxQueue=require(_0xb117('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb117('0x2'),'afterUpdate':'update','afterDestroy':_0xb117('0x3')};function emitEvent(_0x2056b5){return function(_0x35191e,_0x1fa6d9,_0x34476b){FaxQueueEvents[_0xb117('0x4')](_0x2056b5+':'+_0x35191e['id'],_0x35191e);FaxQueueEvents[_0xb117('0x4')](_0x2056b5,_0x35191e);_0x34476b(null);};}for(var e in events){if(events[_0xb117('0x5')](e)){var event=events[e];FaxQueue[_0xb117('0x6')](e,emitEvent(event));}}module[_0xb117('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index dbba02e..9954ac2 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 _0x37d9=['define','fax_queues','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./faxQueue.attributes','exports'];(function(_0x18346a,_0x10b55e){var _0x4fd7f0=function(_0x118f3d){while(--_0x118f3d){_0x18346a['push'](_0x18346a['shift']());}};_0x4fd7f0(++_0x10b55e);}(_0x37d9,0xa7));var _0x937d=function(_0x3ffc40,_0xe319f0){_0x3ffc40=_0x3ffc40-0x0;var _0x575992=_0x37d9[_0x3ffc40];return _0x575992;};'use strict';var _=require(_0x937d('0x0'));var util=require(_0x937d('0x1'));var logger=require('../../config/logger')(_0x937d('0x2'));var moment=require(_0x937d('0x3'));var BPromise=require(_0x937d('0x4'));var rp=require(_0x937d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x937d('0x6'));var attributes=require(_0x937d('0x7'));module[_0x937d('0x8')]=function(_0x1f8f27,_0x47d5bb){return _0x1f8f27[_0x937d('0x9')]('FaxQueue',attributes,{'tableName':_0x937d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c65=['fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports','FaxQueue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2c65,0x161));var _0x52c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c65[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x52c6('0x0'));var util=require(_0x52c6('0x1'));var logger=require(_0x52c6('0x2'))(_0x52c6('0x3'));var moment=require('moment');var BPromise=require(_0x52c6('0x4'));var rp=require(_0x52c6('0x5'));var fs=require('fs');var path=require(_0x52c6('0x6'));var rimraf=require('rimraf');var config=require(_0x52c6('0x7'));var attributes=require('./faxQueue.attributes');module[_0x52c6('0x8')]=function(_0x498e3e,_0x312e2c){return _0x498e3e['define'](_0x52c6('0x9'),attributes,{'tableName':_0x52c6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 4560f65..2af2b6b 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 _0x5412=['model','attributes','ShowFaxQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','limit','include','map'];(function(_0x5455dd,_0x53b957){var _0x5c2652=function(_0x53bc37){while(--_0x53bc37){_0x5455dd['push'](_0x5455dd['shift']());}};_0x5c2652(++_0x53b957);}(_0x5412,0x7d));var _0x2541=function(_0x111a8a,_0x411280){_0x111a8a=_0x111a8a-0x0;var _0x49a085=_0x5412[_0x111a8a];return _0x49a085;};'use strict';var _=require(_0x2541('0x0'));var util=require(_0x2541('0x1'));var moment=require(_0x2541('0x2'));var BPromise=require('bluebird');var rs=require(_0x2541('0x3'));var fs=require('fs');var Redis=require(_0x2541('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2541('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2541('0x6'));var client=jayson[_0x2541('0x7')][_0x2541('0x8')]({'port':0x232a});config[_0x2541('0x9')]=_[_0x2541('0xa')](config[_0x2541('0x9')],{'host':_0x2541('0xb'),'port':0x18eb});var socket=require(_0x2541('0xc'))(new Redis(config[_0x2541('0x9')]));require('./faxQueue.socket')[_0x2541('0xd')](socket);function respondWithRpcPromise(_0xe2ce13,_0x2422c1,_0x37da19){return new BPromise(function(_0x3ab709,_0xb6d64a){return client[_0x2541('0xe')](_0xe2ce13,_0x37da19)[_0x2541('0xf')](function(_0x9d9f0){logger[_0x2541('0x10')]('FaxQueue,\x20%s,\x20%s',_0x2422c1,_0x2541('0x11'));logger[_0x2541('0x12')](_0x2541('0x13'),_0x2422c1,'request\x20sent',JSON[_0x2541('0x14')](_0x9d9f0));if(_0x9d9f0[_0x2541('0x15')]){if(_0x9d9f0[_0x2541('0x15')][_0x2541('0x16')]===0x1f4){logger[_0x2541('0x15')](_0x2541('0x17'),_0x2422c1,_0x9d9f0[_0x2541('0x15')]['message']);return _0xb6d64a(_0x9d9f0[_0x2541('0x15')]['message']);}logger[_0x2541('0x15')](_0x2541('0x17'),_0x2422c1,_0x9d9f0[_0x2541('0x15')][_0x2541('0x18')]);return _0x3ab709(_0x9d9f0['error'][_0x2541('0x18')]);}else{logger['info'](_0x2541('0x17'),_0x2422c1,_0x2541('0x11'));_0x3ab709(_0x9d9f0[_0x2541('0x19')]['message']);}})[_0x2541('0x1a')](function(_0x2c661c){logger[_0x2541('0x15')](_0x2541('0x17'),_0x2422c1,_0x2c661c);_0xb6d64a(_0x2c661c);});});}exports[_0x2541('0x1b')]=function(_0x2fb556){var _0x1f1d3f=this;return new Promise(function(_0x30c9ce,_0x35471a){return db[_0x2541('0x1c')][_0x2541('0x1d')]({'raw':_0x2fb556['options']?_0x2fb556['options']['raw']===undefined?!![]:![]:!![],'where':_0x2fb556[_0x2541('0x1e')]?_0x2fb556['options'][_0x2541('0x1f')]||null:null,'attributes':_0x2fb556[_0x2541('0x1e')]?_0x2fb556[_0x2541('0x1e')]['attributes']||null:null,'limit':_0x2fb556[_0x2541('0x1e')]?_0x2fb556[_0x2541('0x1e')][_0x2541('0x20')]||null:null,'include':_0x2fb556[_0x2541('0x1e')]?_0x2fb556[_0x2541('0x1e')][_0x2541('0x21')]?_[_0x2541('0x22')](_0x2fb556[_0x2541('0x1e')][_0x2541('0x21')],function(_0x12884f){return{'model':db[_0x12884f[_0x2541('0x23')]],'as':_0x12884f['as'],'attributes':_0x12884f[_0x2541('0x24')],'include':_0x12884f[_0x2541('0x21')]?_[_0x2541('0x22')](_0x12884f[_0x2541('0x21')],function(_0xc36d0e){return{'model':db[_0xc36d0e['model']],'as':_0xc36d0e['as'],'attributes':_0xc36d0e[_0x2541('0x24')],'include':_0xc36d0e['include']?_[_0x2541('0x22')](_0xc36d0e[_0x2541('0x21')],function(_0x3f5b53){return{'model':db[_0x3f5b53[_0x2541('0x23')]],'as':_0x3f5b53['as'],'attributes':_0x3f5b53[_0x2541('0x24')]};}):[]};}):[]};}):[]:[]})[_0x2541('0xf')](function(_0x19e4b2){logger[_0x2541('0x10')](_0x2541('0x1b'),_0x2fb556);logger[_0x2541('0x12')](_0x2541('0x1b'),_0x2fb556,JSON[_0x2541('0x14')](_0x19e4b2));_0x30c9ce(_0x19e4b2);})[_0x2541('0x1a')](function(_0x421a34){logger[_0x2541('0x15')](_0x2541('0x1b'),_0x421a34[_0x2541('0x18')],_0x2fb556);_0x35471a(_0x1f1d3f[_0x2541('0x15')](0x1f4,_0x421a34[_0x2541('0x18')]));});});};exports[_0x2541('0x25')]=function(_0x48a5db){var _0x461f2d=this;return new Promise(function(_0x2894b1,_0x4aa405){return db['FaxQueue'][_0x2541('0x26')]({'raw':_0x48a5db[_0x2541('0x1e')]?_0x48a5db['options'][_0x2541('0x27')]===undefined?!![]:![]:!![],'where':_0x48a5db[_0x2541('0x1e')]?_0x48a5db[_0x2541('0x1e')][_0x2541('0x1f')]||null:null,'attributes':_0x48a5db[_0x2541('0x1e')]?_0x48a5db[_0x2541('0x1e')][_0x2541('0x24')]||null:null,'include':_0x48a5db[_0x2541('0x1e')]?_0x48a5db[_0x2541('0x1e')][_0x2541('0x21')]?_[_0x2541('0x22')](_0x48a5db[_0x2541('0x1e')]['include'],function(_0x33e88a){return{'model':db[_0x33e88a[_0x2541('0x23')]],'as':_0x33e88a['as'],'attributes':_0x33e88a[_0x2541('0x24')],'include':_0x33e88a[_0x2541('0x21')]?_['map'](_0x33e88a[_0x2541('0x21')],function(_0x2195d3){return{'model':db[_0x2195d3[_0x2541('0x23')]],'as':_0x2195d3['as'],'attributes':_0x2195d3['attributes'],'include':_0x2195d3[_0x2541('0x21')]?_[_0x2541('0x22')](_0x2195d3[_0x2541('0x21')],function(_0x16633d){return{'model':db[_0x16633d[_0x2541('0x23')]],'as':_0x16633d['as'],'attributes':_0x16633d[_0x2541('0x24')]};}):[]};}):[]};}):[]:[]})[_0x2541('0xf')](function(_0xdef895){logger[_0x2541('0x10')]('ShowFaxQueue',_0x48a5db);logger[_0x2541('0x12')](_0x2541('0x25'),_0x48a5db,JSON[_0x2541('0x14')](_0xdef895));_0x2894b1(_0xdef895);})[_0x2541('0x1a')](function(_0x348b1a){logger['error'](_0x2541('0x25'),_0x348b1a[_0x2541('0x18')],_0x48a5db);_0x4aa405(_0x461f2d[_0x2541('0x15')](0x1f4,_0x348b1a[_0x2541('0x18')]));});});}; \ No newline at end of file +var _0xd8d6=['localhost','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','client','http','redis'];(function(_0x25b21a,_0x13298d){var _0x3a282d=function(_0x33958e){while(--_0x33958e){_0x25b21a['push'](_0x25b21a['shift']());}};_0x3a282d(++_0x13298d);}(_0xd8d6,0xb8));var _0x6d8d=function(_0x43f92e,_0x26229c){_0x43f92e=_0x43f92e-0x0;var _0x329ded=_0xd8d6[_0x43f92e];return _0x329ded;};'use strict';var _=require(_0x6d8d('0x0'));var util=require(_0x6d8d('0x1'));var moment=require(_0x6d8d('0x2'));var BPromise=require(_0x6d8d('0x3'));var rs=require(_0x6d8d('0x4'));var fs=require('fs');var Redis=require(_0x6d8d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d8d('0x6'));var logger=require(_0x6d8d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6d8d('0x8')][_0x6d8d('0x9')]({'port':0x232a});config[_0x6d8d('0xa')]=_['defaults'](config[_0x6d8d('0xa')],{'host':_0x6d8d('0xb'),'port':0x18eb});var socket=require(_0x6d8d('0xc'))(new Redis(config['redis']));require(_0x6d8d('0xd'))[_0x6d8d('0xe')](socket);function respondWithRpcPromise(_0x8acd5c,_0x1ee6aa,_0x535efd){return new BPromise(function(_0x517a1a,_0x27b27f){return client['request'](_0x8acd5c,_0x535efd)[_0x6d8d('0xf')](function(_0x4bc470){logger[_0x6d8d('0x10')](_0x6d8d('0x11'),_0x1ee6aa,_0x6d8d('0x12'));logger['debug'](_0x6d8d('0x13'),_0x1ee6aa,_0x6d8d('0x12'),JSON[_0x6d8d('0x14')](_0x4bc470));if(_0x4bc470[_0x6d8d('0x15')]){if(_0x4bc470[_0x6d8d('0x15')][_0x6d8d('0x16')]===0x1f4){logger[_0x6d8d('0x15')]('FaxQueue,\x20%s,\x20%s',_0x1ee6aa,_0x4bc470[_0x6d8d('0x15')][_0x6d8d('0x17')]);return _0x27b27f(_0x4bc470[_0x6d8d('0x15')]['message']);}logger['error'](_0x6d8d('0x11'),_0x1ee6aa,_0x4bc470[_0x6d8d('0x15')]['message']);return _0x517a1a(_0x4bc470[_0x6d8d('0x15')]['message']);}else{logger['info'](_0x6d8d('0x11'),_0x1ee6aa,_0x6d8d('0x12'));_0x517a1a(_0x4bc470['result'][_0x6d8d('0x17')]);}})[_0x6d8d('0x18')](function(_0x201443){logger['error'](_0x6d8d('0x11'),_0x1ee6aa,_0x201443);_0x27b27f(_0x201443);});});}exports[_0x6d8d('0x19')]=function(_0x41b0a7){var _0x180f96=this;return new Promise(function(_0x37ec4f,_0x1f9c05){return db[_0x6d8d('0x1a')][_0x6d8d('0x1b')]({'raw':_0x41b0a7[_0x6d8d('0x1c')]?_0x41b0a7[_0x6d8d('0x1c')][_0x6d8d('0x1d')]===undefined?!![]:![]:!![],'where':_0x41b0a7[_0x6d8d('0x1c')]?_0x41b0a7[_0x6d8d('0x1c')][_0x6d8d('0x1e')]||null:null,'attributes':_0x41b0a7[_0x6d8d('0x1c')]?_0x41b0a7['options'][_0x6d8d('0x1f')]||null:null,'limit':_0x41b0a7[_0x6d8d('0x1c')]?_0x41b0a7[_0x6d8d('0x1c')][_0x6d8d('0x20')]||null:null,'include':_0x41b0a7['options']?_0x41b0a7[_0x6d8d('0x1c')][_0x6d8d('0x21')]?_[_0x6d8d('0x22')](_0x41b0a7[_0x6d8d('0x1c')][_0x6d8d('0x21')],function(_0x161aa2){return{'model':db[_0x161aa2[_0x6d8d('0x23')]],'as':_0x161aa2['as'],'attributes':_0x161aa2[_0x6d8d('0x1f')],'include':_0x161aa2[_0x6d8d('0x21')]?_[_0x6d8d('0x22')](_0x161aa2[_0x6d8d('0x21')],function(_0x187d4a){return{'model':db[_0x187d4a[_0x6d8d('0x23')]],'as':_0x187d4a['as'],'attributes':_0x187d4a[_0x6d8d('0x1f')],'include':_0x187d4a[_0x6d8d('0x21')]?_[_0x6d8d('0x22')](_0x187d4a[_0x6d8d('0x21')],function(_0x2ce834){return{'model':db[_0x2ce834[_0x6d8d('0x23')]],'as':_0x2ce834['as'],'attributes':_0x2ce834['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xf910c7){logger[_0x6d8d('0x10')]('GetFaxQueue',_0x41b0a7);logger[_0x6d8d('0x24')]('GetFaxQueue',_0x41b0a7,JSON[_0x6d8d('0x14')](_0xf910c7));_0x37ec4f(_0xf910c7);})['catch'](function(_0x150c6a){logger['error'](_0x6d8d('0x19'),_0x150c6a[_0x6d8d('0x17')],_0x41b0a7);_0x1f9c05(_0x180f96[_0x6d8d('0x15')](0x1f4,_0x150c6a['message']));});});};exports[_0x6d8d('0x25')]=function(_0x7de5d0){var _0x2639f1=this;return new Promise(function(_0x47fdfc,_0x19abc9){return db[_0x6d8d('0x1a')][_0x6d8d('0x26')]({'raw':_0x7de5d0[_0x6d8d('0x1c')]?_0x7de5d0[_0x6d8d('0x1c')][_0x6d8d('0x1d')]===undefined?!![]:![]:!![],'where':_0x7de5d0[_0x6d8d('0x1c')]?_0x7de5d0[_0x6d8d('0x1c')][_0x6d8d('0x1e')]||null:null,'attributes':_0x7de5d0[_0x6d8d('0x1c')]?_0x7de5d0[_0x6d8d('0x1c')]['attributes']||null:null,'include':_0x7de5d0[_0x6d8d('0x1c')]?_0x7de5d0[_0x6d8d('0x1c')][_0x6d8d('0x21')]?_[_0x6d8d('0x22')](_0x7de5d0[_0x6d8d('0x1c')][_0x6d8d('0x21')],function(_0xd425d9){return{'model':db[_0xd425d9[_0x6d8d('0x23')]],'as':_0xd425d9['as'],'attributes':_0xd425d9['attributes'],'include':_0xd425d9[_0x6d8d('0x21')]?_[_0x6d8d('0x22')](_0xd425d9['include'],function(_0x36ca2e){return{'model':db[_0x36ca2e[_0x6d8d('0x23')]],'as':_0x36ca2e['as'],'attributes':_0x36ca2e[_0x6d8d('0x1f')],'include':_0x36ca2e[_0x6d8d('0x21')]?_[_0x6d8d('0x22')](_0x36ca2e[_0x6d8d('0x21')],function(_0x3cae71){return{'model':db[_0x3cae71[_0x6d8d('0x23')]],'as':_0x3cae71['as'],'attributes':_0x3cae71[_0x6d8d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6d8d('0xf')](function(_0x18661a){logger[_0x6d8d('0x10')](_0x6d8d('0x25'),_0x7de5d0);logger[_0x6d8d('0x24')](_0x6d8d('0x25'),_0x7de5d0,JSON[_0x6d8d('0x14')](_0x18661a));_0x47fdfc(_0x18661a);})[_0x6d8d('0x18')](function(_0x59c68e){logger[_0x6d8d('0x15')](_0x6d8d('0x25'),_0x59c68e['message'],_0x7de5d0);_0x19abc9(_0x2639f1[_0x6d8d('0x15')](0x1f4,_0x59c68e[_0x6d8d('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 02a075f..f9b3cc4 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 _0xf1c7=['removeListener','register','length','faxQueue:','./faxQueue.events','remove','emit'];(function(_0x360c92,_0x5ed443){var _0x429495=function(_0x11feaf){while(--_0x11feaf){_0x360c92['push'](_0x360c92['shift']());}};_0x429495(++_0x5ed443);}(_0xf1c7,0x193));var _0x7f1c=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xf1c7[_0x2112d4];return _0x434972;};'use strict';var FaxQueueEvents=require(_0x7f1c('0x0'));var events=['save',_0x7f1c('0x1'),'update'];function createListener(_0x1174fc,_0x123f0e){return function(_0x2f84d0){_0x123f0e[_0x7f1c('0x2')](_0x1174fc,_0x2f84d0);};}function removeListener(_0x3c8612,_0x437c79){return function(){FaxQueueEvents[_0x7f1c('0x3')](_0x3c8612,_0x437c79);};}exports[_0x7f1c('0x4')]=function(_0x36cfb3){for(var _0x53d989=0x0,_0x5e1f2f=events[_0x7f1c('0x5')];_0x53d989<_0x5e1f2f;_0x53d989++){var _0x28e04b=events[_0x53d989];var _0x3c236b=createListener(_0x7f1c('0x6')+_0x28e04b,_0x36cfb3);FaxQueueEvents['on'](_0x28e04b,_0x3c236b);}}; \ No newline at end of file +var _0x2aa0=['register','length','faxQueue:','./faxQueue.events','save','update','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x2aa0,0x6c));var _0x02aa=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2aa0[_0x4b369d];return _0x571a98;};'use strict';var FaxQueueEvents=require(_0x02aa('0x0'));var events=[_0x02aa('0x1'),'remove',_0x02aa('0x2')];function createListener(_0x29b3b7,_0x54dc53){return function(_0x1c354f){_0x54dc53['emit'](_0x29b3b7,_0x1c354f);};}function removeListener(_0x3f5d6a,_0x1d90d4){return function(){FaxQueueEvents[_0x02aa('0x3')](_0x3f5d6a,_0x1d90d4);};}exports[_0x02aa('0x4')]=function(_0x29629a){for(var _0x386694=0x0,_0x17e58f=events[_0x02aa('0x5')];_0x386694<_0x17e58f;_0x386694++){var _0x7d53e2=events[_0x386694];var _0x2aef4a=createListener(_0x02aa('0x6')+_0x7d53e2,_0x29629a);FaxQueueEvents['on'](_0x7d53e2,_0x2aef4a);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 8998117..9f9973b 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 _0xf562=['destroy','removeTeams','/:id/users','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','getMembers','/:id/teams','post','create','addTeams','addAgents','put','delete'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf562,0x100));var _0x2f56=function(_0x871b07,_0x31aee7){_0x871b07=_0x871b07-0x0;var _0x1cc5ca=_0xf562[_0x871b07];return _0x1cc5ca;};'use strict';var multer=require(_0x2f56('0x0'));var util=require(_0x2f56('0x1'));var path=require(_0x2f56('0x2'));var timeout=require(_0x2f56('0x3'));var express=require(_0x2f56('0x4'));var router=express[_0x2f56('0x5')]();var fs_extra=require(_0x2f56('0x6'));var auth=require(_0x2f56('0x7'));var interaction=require(_0x2f56('0x8'));var config=require('../../config/environment');var controller=require(_0x2f56('0x9'));router['get']('/',auth[_0x2f56('0xa')](),controller['index']);router[_0x2f56('0xb')](_0x2f56('0xc'),auth[_0x2f56('0xa')](),controller[_0x2f56('0xd')]);router[_0x2f56('0xb')](_0x2f56('0xe'),auth[_0x2f56('0xa')](),controller[_0x2f56('0xf')]);router[_0x2f56('0xb')]('/:id/members',auth[_0x2f56('0xa')](),controller[_0x2f56('0x10')]);router['get'](_0x2f56('0x11'),auth[_0x2f56('0xa')](),controller['getTeams']);router[_0x2f56('0xb')]('/:id/users',auth[_0x2f56('0xa')](),controller['getAgents']);router[_0x2f56('0x12')]('/',auth[_0x2f56('0xa')](),controller[_0x2f56('0x13')]);router[_0x2f56('0x12')](_0x2f56('0x11'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x14')]);router[_0x2f56('0x12')]('/:id/users',auth[_0x2f56('0xa')](),controller[_0x2f56('0x15')]);router[_0x2f56('0x16')](_0x2f56('0xe'),auth[_0x2f56('0xa')](),controller['update']);router[_0x2f56('0x17')](_0x2f56('0xe'),auth[_0x2f56('0xa')](),controller[_0x2f56('0x18')]);router[_0x2f56('0x17')]('/:id/teams',auth[_0x2f56('0xa')](),controller[_0x2f56('0x19')]);router[_0x2f56('0x17')](_0x2f56('0x1a'),auth[_0x2f56('0xa')](),controller['removeAgents']);module[_0x2f56('0x1b')]=router; \ No newline at end of file +var _0xdec3=['removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','getMembers','getTeams','/:id/users','getAgents','post','create','put','delete','destroy','/:id/teams','removeTeams'];(function(_0x4179ab,_0x2f561f){var _0x460545=function(_0x4098c4){while(--_0x4098c4){_0x4179ab['push'](_0x4179ab['shift']());}};_0x460545(++_0x2f561f);}(_0xdec3,0x89));var _0x3dec=function(_0x1e376d,_0x2d317d){_0x1e376d=_0x1e376d-0x0;var _0x3e2488=_0xdec3[_0x1e376d];return _0x3e2488;};'use strict';var multer=require(_0x3dec('0x0'));var util=require('util');var path=require(_0x3dec('0x1'));var timeout=require(_0x3dec('0x2'));var express=require(_0x3dec('0x3'));var router=express['Router']();var fs_extra=require(_0x3dec('0x4'));var auth=require(_0x3dec('0x5'));var interaction=require(_0x3dec('0x6'));var config=require(_0x3dec('0x7'));var controller=require('./faxQueue.controller');router[_0x3dec('0x8')]('/',auth[_0x3dec('0x9')](),controller[_0x3dec('0xa')]);router[_0x3dec('0x8')](_0x3dec('0xb'),auth[_0x3dec('0x9')](),controller[_0x3dec('0xc')]);router['get'](_0x3dec('0xd'),auth[_0x3dec('0x9')](),controller['show']);router[_0x3dec('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x3dec('0xe')]);router[_0x3dec('0x8')]('/:id/teams',auth[_0x3dec('0x9')](),controller[_0x3dec('0xf')]);router['get'](_0x3dec('0x10'),auth[_0x3dec('0x9')](),controller[_0x3dec('0x11')]);router[_0x3dec('0x12')]('/',auth[_0x3dec('0x9')](),controller[_0x3dec('0x13')]);router['post']('/:id/teams',auth[_0x3dec('0x9')](),controller['addTeams']);router[_0x3dec('0x12')](_0x3dec('0x10'),auth['isAuthenticated'](),controller['addAgents']);router[_0x3dec('0x14')]('/:id',auth[_0x3dec('0x9')](),controller['update']);router[_0x3dec('0x15')]('/:id',auth[_0x3dec('0x9')](),controller[_0x3dec('0x16')]);router['delete'](_0x3dec('0x17'),auth[_0x3dec('0x9')](),controller[_0x3dec('0x18')]);router[_0x3dec('0x15')](_0x3dec('0x10'),auth[_0x3dec('0x9')](),controller[_0x3dec('0x19')]);module[_0x3dec('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 716616a..c5a0c5b 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 _0x1475=['exports','STRING','DATE','moment','sequelize'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x1475,0x1e8));var _0x5147=function(_0x3a19d4,_0x3f19a4){_0x3a19d4=_0x3a19d4-0x0;var _0x5b858b=_0x1475[_0x3a19d4];return _0x5b858b;};'use strict';var moment=require(_0x5147('0x0'));var Sequelize=require(_0x5147('0x1'));module[_0x5147('0x2')]={'uniqueid':{'type':Sequelize[_0x5147('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5147('0x3')]},'joinAt':{'type':Sequelize[_0x5147('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5147('0x4')]},'exitAt':{'type':Sequelize[_0x5147('0x4')]},'reason':{'type':Sequelize[_0x5147('0x3')]}}; \ No newline at end of file +var _0x7ced=['sequelize','exports','STRING','DATE','moment'];(function(_0x318566,_0x1d3bbe){var _0x204197=function(_0x44583d){while(--_0x44583d){_0x318566['push'](_0x318566['shift']());}};_0x204197(++_0x1d3bbe);}(_0x7ced,0x126));var _0xd7ce=function(_0x21399e,_0xbc6101){_0x21399e=_0x21399e-0x0;var _0x3b7be4=_0x7ced[_0x21399e];return _0x3b7be4;};'use strict';var moment=require(_0xd7ce('0x0'));var Sequelize=require(_0xd7ce('0x1'));module[_0xd7ce('0x2')]={'uniqueid':{'type':Sequelize[_0xd7ce('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd7ce('0x3')]},'joinAt':{'type':Sequelize[_0xd7ce('0x4')]},'leaveAt':{'type':Sequelize[_0xd7ce('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd7ce('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 7e241ab..090b0e6 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 _0x9f62=['squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','update','destroy','then','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','include','find','create','body','params','describe','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0x9f62,0x154));var _0x29f6=function(_0xcd421d,_0x4da8a7){_0xcd421d=_0xcd421d-0x0;var _0x395507=_0x9f62[_0xcd421d];return _0x395507;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29f6('0x1'));var rp=require(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f6('0x4'));var path=require(_0x29f6('0x5'));var sox=require(_0x29f6('0x6'));var csv=require(_0x29f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f6('0x8'));var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x559585,_0x57b2d2){_0x57b2d2=_0x57b2d2||0xcc;return function(_0x2ae0e4){if(_0x2ae0e4){return _0x559585[_0x29f6('0x13')](_0x57b2d2);}return _0x559585[_0x29f6('0x14')](_0x57b2d2)[_0x29f6('0x15')]();};}function respondWithResult(_0x17de6e,_0x156c96){_0x156c96=_0x156c96||0xc8;return function(_0x35d2e2){if(_0x35d2e2){return _0x17de6e[_0x29f6('0x14')](_0x156c96)[_0x29f6('0x16')](_0x35d2e2);}};}function respondWithFilteredResult(_0x19331f,_0x28d314){return function(_0x370484){if(_0x370484){var _0x1dde97=typeof _0x28d314[_0x29f6('0x17')]===_0x29f6('0x18')&&typeof _0x28d314[_0x29f6('0x19')]===_0x29f6('0x18');var _0x5bfda7=_0x370484['count'];var _0x2e66d3=_0x1dde97?0x0:_0x28d314[_0x29f6('0x17')];var _0xb31436=_0x1dde97?_0x370484['count']:_0x28d314[_0x29f6('0x17')]+_0x28d314[_0x29f6('0x19')];var _0x49252f;if(_0xb31436>=_0x5bfda7){_0xb31436=_0x5bfda7;_0x49252f=0xc8;}else{_0x49252f=0xce;}_0x19331f[_0x29f6('0x14')](_0x49252f);return _0x19331f[_0x29f6('0x1a')](_0x29f6('0x1b'),_0x2e66d3+'-'+_0xb31436+'/'+_0x5bfda7)[_0x29f6('0x16')](_0x370484);}return null;};}function patchUpdates(_0xb6e7a9){return function(_0x2bfb3d){try{jsonpatch['apply'](_0x2bfb3d,_0xb6e7a9,!![]);}catch(_0xfb8fd2){return BPromise['reject'](_0xfb8fd2);}return _0x2bfb3d['save']();};}function saveUpdates(_0x470019,_0x1fa159){return function(_0x39c6b3){if(_0x39c6b3){return _0x39c6b3[_0x29f6('0x1c')](_0x470019)['then'](function(_0x2c672e){return _0x2c672e;});}return null;};}function removeEntity(_0x49f67d,_0xd4179c){return function(_0xcce041){if(_0xcce041){return _0xcce041[_0x29f6('0x1d')]()[_0x29f6('0x1e')](function(){_0x49f67d['status'](0xcc)[_0x29f6('0x15')]();});}};}function handleEntityNotFound(_0x4d494f,_0x47c385){return function(_0x1401fb){if(!_0x1401fb){_0x4d494f[_0x29f6('0x13')](0x194);}return _0x1401fb;};}function handleError(_0x2519ac,_0x342038){_0x342038=_0x342038||0x1f4;return function(_0x84ccb7){logger[_0x29f6('0x1f')](_0x84ccb7[_0x29f6('0x20')]);if(_0x84ccb7['name']){delete _0x84ccb7[_0x29f6('0x21')];}_0x2519ac[_0x29f6('0x14')](_0x342038)[_0x29f6('0x22')](_0x84ccb7);};}exports[_0x29f6('0x23')]=function(_0xda0a63,_0x16a6ad){var _0x3790f5={},_0x17b2f2={},_0x3d88db={'count':0x0,'rows':[]};var _0x13a3a2=_[_0x29f6('0x24')](db[_0x29f6('0x25')][_0x29f6('0x26')],function(_0x304c28){return{'name':_0x304c28[_0x29f6('0x27')],'type':_0x304c28[_0x29f6('0x28')][_0x29f6('0x29')]};});_0x17b2f2['model']=_['map'](_0x13a3a2,_0x29f6('0x21'));_0x17b2f2['query']=_[_0x29f6('0x2a')](_0xda0a63[_0x29f6('0x2b')]);_0x17b2f2[_0x29f6('0x2c')]=_[_0x29f6('0x2d')](_0x17b2f2['model'],_0x17b2f2['query']);_0x3790f5[_0x29f6('0x2e')]=_[_0x29f6('0x2d')](_0x17b2f2[_0x29f6('0x2f')],qs[_0x29f6('0x30')](_0xda0a63[_0x29f6('0x2b')][_0x29f6('0x30')]));_0x3790f5[_0x29f6('0x2e')]=_0x3790f5[_0x29f6('0x2e')][_0x29f6('0x31')]?_0x3790f5[_0x29f6('0x2e')]:_0x17b2f2[_0x29f6('0x2f')];if(!_0xda0a63[_0x29f6('0x2b')][_0x29f6('0x32')](_0x29f6('0x33'))){_0x3790f5['limit']=qs['limit'](_0xda0a63[_0x29f6('0x2b')][_0x29f6('0x19')]);_0x3790f5[_0x29f6('0x17')]=qs['offset'](_0xda0a63[_0x29f6('0x2b')][_0x29f6('0x17')]);}_0x3790f5[_0x29f6('0x34')]=qs[_0x29f6('0x35')](_0xda0a63[_0x29f6('0x2b')]['sort']);_0x3790f5[_0x29f6('0x36')]=qs[_0x29f6('0x2c')](_[_0x29f6('0x37')](_0xda0a63[_0x29f6('0x2b')],_0x17b2f2['filters']),_0x13a3a2);if(_0xda0a63[_0x29f6('0x2b')][_0x29f6('0x38')]){_0x3790f5[_0x29f6('0x36')]=_[_0x29f6('0x39')](_0x3790f5['where'],{'$or':_['map'](_0x13a3a2,function(_0x35f9e1){if(_0x35f9e1['type']!==_0x29f6('0x3a')){var _0x551411={};_0x551411[_0x35f9e1[_0x29f6('0x21')]]={'$like':'%'+_0xda0a63['query'][_0x29f6('0x38')]+'%'};return _0x551411;}})});}_0x3790f5=_[_0x29f6('0x39')]({},_0x3790f5,_0xda0a63['options']);var _0x1431fc={'where':_0x3790f5['where']};return db[_0x29f6('0x25')][_0x29f6('0x3b')](_0x1431fc)['then'](function(_0xf9c531){_0x3d88db[_0x29f6('0x3b')]=_0xf9c531;if(_0xda0a63[_0x29f6('0x2b')][_0x29f6('0x3c')]){_0x3790f5['include']=[{'all':!![]}];}return db[_0x29f6('0x25')][_0x29f6('0x3d')](_0x3790f5);})[_0x29f6('0x1e')](function(_0x2322eb){_0x3d88db[_0x29f6('0x3e')]=_0x2322eb;return _0x3d88db;})['then'](respondWithFilteredResult(_0x16a6ad,_0x3790f5))[_0x29f6('0x3f')](handleError(_0x16a6ad,null));};exports['show']=function(_0x2ea303,_0x552257){var _0xbfe671={'raw':!![],'where':{'id':_0x2ea303['params']['id']}},_0x3a8a12={};_0x3a8a12[_0x29f6('0x2f')]=_[_0x29f6('0x2a')](db[_0x29f6('0x25')][_0x29f6('0x26')]);_0x3a8a12['query']=_[_0x29f6('0x2a')](_0x2ea303[_0x29f6('0x2b')]);_0x3a8a12[_0x29f6('0x2c')]=_['intersection'](_0x3a8a12[_0x29f6('0x2f')],_0x3a8a12['query']);_0xbfe671[_0x29f6('0x2e')]=_['intersection'](_0x3a8a12['model'],qs['fields'](_0x2ea303[_0x29f6('0x2b')][_0x29f6('0x30')]));_0xbfe671[_0x29f6('0x2e')]=_0xbfe671[_0x29f6('0x2e')][_0x29f6('0x31')]?_0xbfe671[_0x29f6('0x2e')]:_0x3a8a12[_0x29f6('0x2f')];if(_0x2ea303[_0x29f6('0x2b')][_0x29f6('0x3c')]){_0xbfe671[_0x29f6('0x40')]=[{'all':!![]}];}_0xbfe671=_['merge']({},_0xbfe671,_0x2ea303['options']);return db[_0x29f6('0x25')][_0x29f6('0x41')](_0xbfe671)[_0x29f6('0x1e')](handleEntityNotFound(_0x552257,null))[_0x29f6('0x1e')](respondWithResult(_0x552257,null))['catch'](handleError(_0x552257,null));};exports[_0x29f6('0x42')]=function(_0x1f5609,_0x532df5){return db[_0x29f6('0x25')][_0x29f6('0x42')](_0x1f5609[_0x29f6('0x43')],{})[_0x29f6('0x1e')](respondWithResult(_0x532df5,0xc9))[_0x29f6('0x3f')](handleError(_0x532df5,null));};exports[_0x29f6('0x1c')]=function(_0x320b5e,_0x1f03b6){if(_0x320b5e[_0x29f6('0x43')]['id']){delete _0x320b5e[_0x29f6('0x43')]['id'];}return db[_0x29f6('0x25')][_0x29f6('0x41')]({'where':{'id':_0x320b5e['params']['id']}})[_0x29f6('0x1e')](handleEntityNotFound(_0x1f03b6,null))[_0x29f6('0x1e')](saveUpdates(_0x320b5e[_0x29f6('0x43')],null))[_0x29f6('0x1e')](respondWithResult(_0x1f03b6,null))[_0x29f6('0x3f')](handleError(_0x1f03b6,null));};exports['destroy']=function(_0x2e29e3,_0x52be22){return db['FaxQueueReport'][_0x29f6('0x41')]({'where':{'id':_0x2e29e3[_0x29f6('0x44')]['id']}})[_0x29f6('0x1e')](handleEntityNotFound(_0x52be22,null))[_0x29f6('0x1e')](removeEntity(_0x52be22,null))[_0x29f6('0x3f')](handleError(_0x52be22,null));};exports['describe']=function(_0x167976,_0x458ada){return db['FaxQueueReport'][_0x29f6('0x45')]()['then'](respondWithResult(_0x458ada,null))[_0x29f6('0x3f')](handleError(_0x458ada,null));}; \ No newline at end of file +var _0xd4b6=['then','destroy','error','name','send','index','FaxQueueReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','filter','type','merge','options','findAll','catch','show','params','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','lodash','squel','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','json','undefined','limit','count','offset','set','apply','reject','save','update'];(function(_0x489dbe,_0xff2128){var _0x587a96=function(_0xbdb106){while(--_0xbdb106){_0x489dbe['push'](_0x489dbe['shift']());}};_0x587a96(++_0xff2128);}(_0xd4b6,0x13f));var _0x6d4b=function(_0xd153d3,_0x25b2e8){_0xd153d3=_0xd153d3-0x0;var _0x852a9e=_0xd4b6[_0xd153d3];return _0x852a9e;};'use strict';var emlformat=require(_0x6d4b('0x0'));var rimraf=require(_0x6d4b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d4b('0x2'));var rp=require(_0x6d4b('0x3'));var moment=require('moment');var BPromise=require(_0x6d4b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6d4b('0x5'));var csv=require(_0x6d4b('0x6'));var ejs=require(_0x6d4b('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d4b('0x8'));var squel=require(_0x6d4b('0x9'));var crypto=require(_0x6d4b('0xa'));var jsforce=require(_0x6d4b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6d4b('0x6'));var querystring=require(_0x6d4b('0xc'));var Papa=require(_0x6d4b('0xd'));var Redis=require(_0x6d4b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6d4b('0xf'));var as=require(_0x6d4b('0x10'));var hardwareService=require(_0x6d4b('0x11'));var logger=require(_0x6d4b('0x12'))(_0x6d4b('0x13'));var utils=require(_0x6d4b('0x14'));var config=require(_0x6d4b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d4b('0x16'))['db'];function respondWithStatusCode(_0x1d83c6,_0x385b3f){_0x385b3f=_0x385b3f||0xcc;return function(_0x5582ae){if(_0x5582ae){return _0x1d83c6[_0x6d4b('0x17')](_0x385b3f);}return _0x1d83c6[_0x6d4b('0x18')](_0x385b3f)[_0x6d4b('0x19')]();};}function respondWithResult(_0x353c66,_0x296cc2){_0x296cc2=_0x296cc2||0xc8;return function(_0x2bca8b){if(_0x2bca8b){return _0x353c66[_0x6d4b('0x18')](_0x296cc2)[_0x6d4b('0x1a')](_0x2bca8b);}};}function respondWithFilteredResult(_0xb0d2a9,_0x11dabc){return function(_0x591157){if(_0x591157){var _0x303f52=typeof _0x11dabc['offset']===_0x6d4b('0x1b')&&typeof _0x11dabc[_0x6d4b('0x1c')]==='undefined';var _0x53c61c=_0x591157[_0x6d4b('0x1d')];var _0x3a30b2=_0x303f52?0x0:_0x11dabc[_0x6d4b('0x1e')];var _0x2694ba=_0x303f52?_0x591157[_0x6d4b('0x1d')]:_0x11dabc[_0x6d4b('0x1e')]+_0x11dabc[_0x6d4b('0x1c')];var _0x162865;if(_0x2694ba>=_0x53c61c){_0x2694ba=_0x53c61c;_0x162865=0xc8;}else{_0x162865=0xce;}_0xb0d2a9[_0x6d4b('0x18')](_0x162865);return _0xb0d2a9[_0x6d4b('0x1f')]('Content-Range',_0x3a30b2+'-'+_0x2694ba+'/'+_0x53c61c)['json'](_0x591157);}return null;};}function patchUpdates(_0x25a1fa){return function(_0x2bb3cf){try{jsonpatch[_0x6d4b('0x20')](_0x2bb3cf,_0x25a1fa,!![]);}catch(_0x5d5b72){return BPromise[_0x6d4b('0x21')](_0x5d5b72);}return _0x2bb3cf[_0x6d4b('0x22')]();};}function saveUpdates(_0x227c7c,_0x26b72d){return function(_0x4c46cf){if(_0x4c46cf){return _0x4c46cf[_0x6d4b('0x23')](_0x227c7c)[_0x6d4b('0x24')](function(_0x417853){return _0x417853;});}return null;};}function removeEntity(_0x4626a6,_0x3df33c){return function(_0x479bf4){if(_0x479bf4){return _0x479bf4[_0x6d4b('0x25')]()['then'](function(){_0x4626a6[_0x6d4b('0x18')](0xcc)[_0x6d4b('0x19')]();});}};}function handleEntityNotFound(_0x55c1ac,_0x3d729f){return function(_0x4b00e2){if(!_0x4b00e2){_0x55c1ac[_0x6d4b('0x17')](0x194);}return _0x4b00e2;};}function handleError(_0x277f5,_0x8a8c33){_0x8a8c33=_0x8a8c33||0x1f4;return function(_0x5cdfe1){logger[_0x6d4b('0x26')](_0x5cdfe1['stack']);if(_0x5cdfe1[_0x6d4b('0x27')]){delete _0x5cdfe1[_0x6d4b('0x27')];}_0x277f5[_0x6d4b('0x18')](_0x8a8c33)[_0x6d4b('0x28')](_0x5cdfe1);};}exports[_0x6d4b('0x29')]=function(_0xf053ee,_0x1a94e7){var _0x4d88fc={},_0x2427fd={},_0x4da458={'count':0x0,'rows':[]};var _0x10825b=_['map'](db[_0x6d4b('0x2a')][_0x6d4b('0x2b')],function(_0x464e12){return{'name':_0x464e12[_0x6d4b('0x2c')],'type':_0x464e12['type'][_0x6d4b('0x2d')]};});_0x2427fd[_0x6d4b('0x2e')]=_[_0x6d4b('0x2f')](_0x10825b,_0x6d4b('0x27'));_0x2427fd[_0x6d4b('0x30')]=_[_0x6d4b('0x31')](_0xf053ee[_0x6d4b('0x30')]);_0x2427fd[_0x6d4b('0x32')]=_['intersection'](_0x2427fd['model'],_0x2427fd[_0x6d4b('0x30')]);_0x4d88fc['attributes']=_[_0x6d4b('0x33')](_0x2427fd[_0x6d4b('0x2e')],qs[_0x6d4b('0x34')](_0xf053ee[_0x6d4b('0x30')][_0x6d4b('0x34')]));_0x4d88fc['attributes']=_0x4d88fc['attributes']['length']?_0x4d88fc[_0x6d4b('0x35')]:_0x2427fd['model'];if(!_0xf053ee[_0x6d4b('0x30')][_0x6d4b('0x36')]('nolimit')){_0x4d88fc['limit']=qs['limit'](_0xf053ee[_0x6d4b('0x30')][_0x6d4b('0x1c')]);_0x4d88fc['offset']=qs[_0x6d4b('0x1e')](_0xf053ee['query'][_0x6d4b('0x1e')]);}_0x4d88fc[_0x6d4b('0x37')]=qs[_0x6d4b('0x38')](_0xf053ee[_0x6d4b('0x30')]['sort']);_0x4d88fc[_0x6d4b('0x39')]=qs[_0x6d4b('0x32')](_['pick'](_0xf053ee[_0x6d4b('0x30')],_0x2427fd[_0x6d4b('0x32')]),_0x10825b);if(_0xf053ee['query'][_0x6d4b('0x3a')]){_0x4d88fc[_0x6d4b('0x39')]=_['merge'](_0x4d88fc[_0x6d4b('0x39')],{'$or':_[_0x6d4b('0x2f')](_0x10825b,function(_0x5fc8b4){if(_0x5fc8b4[_0x6d4b('0x3b')]!=='VIRTUAL'){var _0x257fcc={};_0x257fcc[_0x5fc8b4[_0x6d4b('0x27')]]={'$like':'%'+_0xf053ee['query'][_0x6d4b('0x3a')]+'%'};return _0x257fcc;}})});}_0x4d88fc=_[_0x6d4b('0x3c')]({},_0x4d88fc,_0xf053ee[_0x6d4b('0x3d')]);var _0x552814={'where':_0x4d88fc[_0x6d4b('0x39')]};return db[_0x6d4b('0x2a')][_0x6d4b('0x1d')](_0x552814)[_0x6d4b('0x24')](function(_0x653621){_0x4da458[_0x6d4b('0x1d')]=_0x653621;if(_0xf053ee[_0x6d4b('0x30')]['includeAll']){_0x4d88fc['include']=[{'all':!![]}];}return db[_0x6d4b('0x2a')][_0x6d4b('0x3e')](_0x4d88fc);})[_0x6d4b('0x24')](function(_0x335cad){_0x4da458['rows']=_0x335cad;return _0x4da458;})[_0x6d4b('0x24')](respondWithFilteredResult(_0x1a94e7,_0x4d88fc))[_0x6d4b('0x3f')](handleError(_0x1a94e7,null));};exports[_0x6d4b('0x40')]=function(_0x52ba02,_0x1a70eb){var _0x5b8d51={'raw':!![],'where':{'id':_0x52ba02[_0x6d4b('0x41')]['id']}},_0x303e99={};_0x303e99[_0x6d4b('0x2e')]=_['keys'](db[_0x6d4b('0x2a')][_0x6d4b('0x2b')]);_0x303e99['query']=_[_0x6d4b('0x31')](_0x52ba02[_0x6d4b('0x30')]);_0x303e99[_0x6d4b('0x32')]=_[_0x6d4b('0x33')](_0x303e99['model'],_0x303e99[_0x6d4b('0x30')]);_0x5b8d51['attributes']=_['intersection'](_0x303e99['model'],qs[_0x6d4b('0x34')](_0x52ba02[_0x6d4b('0x30')][_0x6d4b('0x34')]));_0x5b8d51['attributes']=_0x5b8d51[_0x6d4b('0x35')]['length']?_0x5b8d51[_0x6d4b('0x35')]:_0x303e99[_0x6d4b('0x2e')];if(_0x52ba02[_0x6d4b('0x30')]['includeAll']){_0x5b8d51[_0x6d4b('0x42')]=[{'all':!![]}];}_0x5b8d51=_[_0x6d4b('0x3c')]({},_0x5b8d51,_0x52ba02['options']);return db['FaxQueueReport'][_0x6d4b('0x43')](_0x5b8d51)[_0x6d4b('0x24')](handleEntityNotFound(_0x1a70eb,null))[_0x6d4b('0x24')](respondWithResult(_0x1a70eb,null))[_0x6d4b('0x3f')](handleError(_0x1a70eb,null));};exports[_0x6d4b('0x44')]=function(_0x53421a,_0x371d5e){return db[_0x6d4b('0x2a')]['create'](_0x53421a[_0x6d4b('0x45')],{})[_0x6d4b('0x24')](respondWithResult(_0x371d5e,0xc9))[_0x6d4b('0x3f')](handleError(_0x371d5e,null));};exports[_0x6d4b('0x23')]=function(_0x45382f,_0x4fa633){if(_0x45382f['body']['id']){delete _0x45382f[_0x6d4b('0x45')]['id'];}return db[_0x6d4b('0x2a')][_0x6d4b('0x43')]({'where':{'id':_0x45382f[_0x6d4b('0x41')]['id']}})[_0x6d4b('0x24')](handleEntityNotFound(_0x4fa633,null))[_0x6d4b('0x24')](saveUpdates(_0x45382f[_0x6d4b('0x45')],null))['then'](respondWithResult(_0x4fa633,null))[_0x6d4b('0x3f')](handleError(_0x4fa633,null));};exports[_0x6d4b('0x25')]=function(_0x8acb91,_0xa6095e){return db['FaxQueueReport'][_0x6d4b('0x43')]({'where':{'id':_0x8acb91[_0x6d4b('0x41')]['id']}})['then'](handleEntityNotFound(_0xa6095e,null))['then'](removeEntity(_0xa6095e,null))[_0x6d4b('0x3f')](handleError(_0xa6095e,null));};exports[_0x6d4b('0x46')]=function(_0x433751,_0x85ecc7){return db[_0x6d4b('0x2a')][_0x6d4b('0x46')]()[_0x6d4b('0x24')](respondWithResult(_0x85ecc7,null))[_0x6d4b('0x3f')](handleError(_0x85ecc7,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index e5aec28..19f995c 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 _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x5715b6,_0x3ab068){var _0x1d2308=function(_0x40b2c4){while(--_0x40b2c4){_0x5715b6['push'](_0x5715b6['shift']());}};_0x1d2308(++_0x3ab068);}(_0xabce,0x103));var _0xeabc=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xabce[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['path','rimraf','../../config/environment','define','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x3ba409,_0x56c9e2){var _0xbcb96d=function(_0xb5ddc4){while(--_0xb5ddc4){_0x3ba409['push'](_0x3ba409['shift']());}};_0xbcb96d(++_0x56c9e2);}(_0xabce,0x103));var _0xeabc=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xabce[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./faxQueueReport.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('FaxQueueReport',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 1f22643..96f00c7 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 _0x8fb3=['jayson/promise','client','http','request','then','info','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','CreateFaxQueueReport','options','debug','catch','UpdateFaxQueueReport','FaxQueueReport','update','body','raw','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x413aac,_0x5e2430){var _0x569b11=function(_0x52e060){while(--_0x52e060){_0x413aac['push'](_0x413aac['shift']());}};_0x569b11(++_0x5e2430);}(_0x8fb3,0x178));var _0x38fb=function(_0x4d0096,_0x4406ba){_0x4d0096=_0x4d0096-0x0;var _0x5b2eb7=_0x8fb3[_0x4d0096];return _0x5b2eb7;};'use strict';var _=require('lodash');var util=require(_0x38fb('0x0'));var moment=require(_0x38fb('0x1'));var BPromise=require('bluebird');var rs=require(_0x38fb('0x2'));var fs=require('fs');var Redis=require(_0x38fb('0x3'));var db=require(_0x38fb('0x4'))['db'];var utils=require(_0x38fb('0x5'));var logger=require(_0x38fb('0x6'))(_0x38fb('0x7'));var config=require(_0x38fb('0x8'));var jayson=require(_0x38fb('0x9'));var client=jayson[_0x38fb('0xa')][_0x38fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x361798,_0x17399c,_0x20f244){return new BPromise(function(_0x16789d,_0x5caee8){return client[_0x38fb('0xc')](_0x361798,_0x20f244)[_0x38fb('0xd')](function(_0x504a4b){logger[_0x38fb('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x17399c,_0x38fb('0xf'));logger['debug'](_0x38fb('0x10'),_0x17399c,'request\x20sent',JSON[_0x38fb('0x11')](_0x504a4b));if(_0x504a4b[_0x38fb('0x12')]){if(_0x504a4b[_0x38fb('0x12')][_0x38fb('0x13')]===0x1f4){logger['error'](_0x38fb('0x14'),_0x17399c,_0x504a4b[_0x38fb('0x12')]['message']);return _0x5caee8(_0x504a4b[_0x38fb('0x12')][_0x38fb('0x15')]);}logger[_0x38fb('0x12')](_0x38fb('0x14'),_0x17399c,_0x504a4b[_0x38fb('0x12')][_0x38fb('0x15')]);return _0x16789d(_0x504a4b[_0x38fb('0x12')][_0x38fb('0x15')]);}else{logger[_0x38fb('0xe')](_0x38fb('0x14'),_0x17399c,'request\x20sent');_0x16789d(_0x504a4b[_0x38fb('0x16')]['message']);}})['catch'](function(_0x720bdf){logger['error'](_0x38fb('0x14'),_0x17399c,_0x720bdf);_0x5caee8(_0x720bdf);});});}exports[_0x38fb('0x17')]=function(_0x392ca7){var _0x4ba666=this;return new Promise(function(_0x480560,_0x3f6dfa){return db['FaxQueueReport']['create'](_0x392ca7['body'],{'raw':_0x392ca7[_0x38fb('0x18')]?_0x392ca7[_0x38fb('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x38fb('0xd')](function(_0x530b3f){logger[_0x38fb('0xe')](_0x38fb('0x17'),_0x392ca7);logger[_0x38fb('0x19')](_0x38fb('0x17'),_0x392ca7,JSON[_0x38fb('0x11')](_0x530b3f));_0x480560(_0x530b3f);})[_0x38fb('0x1a')](function(_0x1b6bd7){logger[_0x38fb('0x12')](_0x38fb('0x17'),_0x1b6bd7[_0x38fb('0x15')],_0x392ca7);_0x3f6dfa(_0x4ba666[_0x38fb('0x12')](0x1f4,_0x1b6bd7[_0x38fb('0x15')]));});});};exports[_0x38fb('0x1b')]=function(_0x30a770){var _0x399965=this;return new Promise(function(_0x26d847,_0x11942e){return db[_0x38fb('0x1c')][_0x38fb('0x1d')](_0x30a770[_0x38fb('0x1e')],{'raw':_0x30a770[_0x38fb('0x18')]?_0x30a770[_0x38fb('0x18')][_0x38fb('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30a770[_0x38fb('0x18')]?_0x30a770['options'][_0x38fb('0x20')]||null:null,'attributes':_0x30a770[_0x38fb('0x18')]?_0x30a770['options'][_0x38fb('0x21')]||null:null,'limit':_0x30a770[_0x38fb('0x18')]?_0x30a770['options'][_0x38fb('0x22')]||null:null})[_0x38fb('0xd')](function(_0x4e9398){logger[_0x38fb('0xe')](_0x38fb('0x1b'),_0x30a770);logger[_0x38fb('0x19')](_0x38fb('0x1b'),_0x30a770,JSON[_0x38fb('0x11')](_0x4e9398));_0x26d847(_0x4e9398);})[_0x38fb('0x1a')](function(_0x2bac12){logger['error'](_0x38fb('0x1b'),_0x2bac12['message'],_0x30a770);_0x11942e(_0x399965['error'](0x1f4,_0x2bac12[_0x38fb('0x15')]));});});}; \ No newline at end of file +var _0x8915=['error','code','FaxQueueReport,\x20%s,\x20%s','message','catch','CreateFaxQueueReport','FaxQueueReport','create','options','UpdateFaxQueueReport','update','body','raw','where','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify'];(function(_0x3c82de,_0xa7dd19){var _0x29f1bb=function(_0x406256){while(--_0x406256){_0x3c82de['push'](_0x3c82de['shift']());}};_0x29f1bb(++_0xa7dd19);}(_0x8915,0xef));var _0x5891=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0x8915[_0x2afbb0];return _0x411ff2;};'use strict';var _=require(_0x5891('0x0'));var util=require(_0x5891('0x1'));var moment=require('moment');var BPromise=require(_0x5891('0x2'));var rs=require(_0x5891('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5891('0x4'))['db'];var utils=require(_0x5891('0x5'));var logger=require('../../config/logger')(_0x5891('0x6'));var config=require(_0x5891('0x7'));var jayson=require(_0x5891('0x8'));var client=jayson[_0x5891('0x9')][_0x5891('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3814ff,_0x10d928,_0x4d4530){return new BPromise(function(_0x30cf43,_0x49d9fe){return client[_0x5891('0xb')](_0x3814ff,_0x4d4530)[_0x5891('0xc')](function(_0x508917){logger[_0x5891('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x10d928,_0x5891('0xe'));logger[_0x5891('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x10d928,_0x5891('0xe'),JSON[_0x5891('0x10')](_0x508917));if(_0x508917[_0x5891('0x11')]){if(_0x508917[_0x5891('0x11')][_0x5891('0x12')]===0x1f4){logger['error'](_0x5891('0x13'),_0x10d928,_0x508917[_0x5891('0x11')]['message']);return _0x49d9fe(_0x508917[_0x5891('0x11')][_0x5891('0x14')]);}logger[_0x5891('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x10d928,_0x508917[_0x5891('0x11')]['message']);return _0x30cf43(_0x508917[_0x5891('0x11')][_0x5891('0x14')]);}else{logger[_0x5891('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x10d928,'request\x20sent');_0x30cf43(_0x508917['result']['message']);}})[_0x5891('0x15')](function(_0xaf03fc){logger[_0x5891('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x10d928,_0xaf03fc);_0x49d9fe(_0xaf03fc);});});}exports[_0x5891('0x16')]=function(_0x69e991){var _0x42b70=this;return new Promise(function(_0x1ed2c4,_0x5aa850){return db[_0x5891('0x17')][_0x5891('0x18')](_0x69e991['body'],{'raw':_0x69e991[_0x5891('0x19')]?_0x69e991[_0x5891('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x5891('0xc')](function(_0x2155e7){logger[_0x5891('0xd')](_0x5891('0x16'),_0x69e991);logger[_0x5891('0xf')](_0x5891('0x16'),_0x69e991,JSON[_0x5891('0x10')](_0x2155e7));_0x1ed2c4(_0x2155e7);})[_0x5891('0x15')](function(_0x52bceb){logger['error'](_0x5891('0x16'),_0x52bceb[_0x5891('0x14')],_0x69e991);_0x5aa850(_0x42b70[_0x5891('0x11')](0x1f4,_0x52bceb['message']));});});};exports[_0x5891('0x1a')]=function(_0x95c045){var _0x4c4c43=this;return new Promise(function(_0x343d5c,_0x306238){return db['FaxQueueReport'][_0x5891('0x1b')](_0x95c045[_0x5891('0x1c')],{'raw':_0x95c045[_0x5891('0x19')]?_0x95c045['options'][_0x5891('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x95c045[_0x5891('0x19')]?_0x95c045[_0x5891('0x19')][_0x5891('0x1e')]||null:null,'attributes':_0x95c045['options']?_0x95c045[_0x5891('0x19')]['attributes']||null:null,'limit':_0x95c045[_0x5891('0x19')]?_0x95c045[_0x5891('0x19')][_0x5891('0x1f')]||null:null})[_0x5891('0xc')](function(_0x5f7fcd){logger[_0x5891('0xd')](_0x5891('0x1a'),_0x95c045);logger[_0x5891('0xf')](_0x5891('0x1a'),_0x95c045,JSON[_0x5891('0x10')](_0x5f7fcd));_0x343d5c(_0x5f7fcd);})[_0x5891('0x15')](function(_0x2cf74a){logger[_0x5891('0x11')](_0x5891('0x1a'),_0x2cf74a[_0x5891('0x14')],_0x95c045);_0x306238(_0x4c4c43[_0x5891('0x11')](0x1f4,_0x2cf74a[_0x5891('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 5b7785d..a26ae8c 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 _0xa85b=['post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa85b,0x7f));var _0xba85=function(_0x112c07,_0x167930){_0x112c07=_0x112c07-0x0;var _0x171eae=_0xa85b[_0x112c07];return _0x171eae;};'use strict';var multer=require('multer');var util=require(_0xba85('0x0'));var path=require(_0xba85('0x1'));var timeout=require('connect-timeout');var express=require(_0xba85('0x2'));var router=express[_0xba85('0x3')]();var fs_extra=require(_0xba85('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xba85('0x5'));var config=require('../../config/environment');var controller=require(_0xba85('0x6'));router[_0xba85('0x7')]('/',auth[_0xba85('0x8')](),controller[_0xba85('0x9')]);router[_0xba85('0x7')](_0xba85('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xba85('0xb'),auth[_0xba85('0x8')](),controller[_0xba85('0xc')]);router[_0xba85('0xd')]('/',auth['isAuthenticated'](),controller[_0xba85('0xe')]);router[_0xba85('0xf')](_0xba85('0xb'),auth[_0xba85('0x8')](),controller[_0xba85('0x10')]);router[_0xba85('0x11')](_0xba85('0xb'),auth['isAuthenticated'](),controller[_0xba85('0x12')]);module[_0xba85('0x13')]=router; \ No newline at end of file +var _0x2988=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0x2988,0x1df));var _0x8298=function(_0x5352ab,_0x3396dc){_0x5352ab=_0x5352ab-0x0;var _0x38102a=_0x2988[_0x5352ab];return _0x38102a;};'use strict';var multer=require('multer');var util=require(_0x8298('0x0'));var path=require(_0x8298('0x1'));var timeout=require(_0x8298('0x2'));var express=require(_0x8298('0x3'));var router=express[_0x8298('0x4')]();var fs_extra=require(_0x8298('0x5'));var auth=require(_0x8298('0x6'));var interaction=require(_0x8298('0x7'));var config=require(_0x8298('0x8'));var controller=require(_0x8298('0x9'));router[_0x8298('0xa')]('/',auth[_0x8298('0xb')](),controller[_0x8298('0xc')]);router[_0x8298('0xa')](_0x8298('0xd'),auth[_0x8298('0xb')](),controller['describe']);router[_0x8298('0xa')](_0x8298('0xe'),auth[_0x8298('0xb')](),controller['show']);router[_0x8298('0xf')]('/',auth['isAuthenticated'](),controller[_0x8298('0x10')]);router[_0x8298('0x11')](_0x8298('0xe'),auth[_0x8298('0xb')](),controller['update']);router[_0x8298('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8298('0x13')]);module[_0x8298('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index ebf490e..ba19fac 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x37ca5f,_0x7b93d4){var _0x4b0676=function(_0x5e9dbe){while(--_0x5e9dbe){_0x37ca5f['push'](_0x37ca5f['shift']());}};_0x4b0676(++_0x7b93d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x33a4a8,_0x1fde53){var _0x5ec956=function(_0x3329fb){while(--_0x3329fb){_0x33a4a8['push'](_0x33a4a8['shift']());}};_0x5ec956(++_0x1fde53);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x531a19,_0x43e019){_0x531a19=_0x531a19-0x0;var _0x4845d2=_0xf3cd[_0x531a19];return _0x4845d2;};'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 a3cb879..76e432d 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 _0x1589=['keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','includeAll','create','body','find','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','query'];(function(_0x167288,_0x56bede){var _0x256c9b=function(_0x11630b){while(--_0x11630b){_0x167288['push'](_0x167288['shift']());}};_0x256c9b(++_0x56bede);}(_0x1589,0xad));var _0x9158=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x1589[_0xa148b7];return _0x51efd3;};'use strict';var emlformat=require(_0x9158('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9158('0x1'));var moment=require(_0x9158('0x2'));var BPromise=require(_0x9158('0x3'));var Mustache=require(_0x9158('0x4'));var util=require(_0x9158('0x5'));var path=require(_0x9158('0x6'));var sox=require(_0x9158('0x7'));var csv=require(_0x9158('0x8'));var ejs=require(_0x9158('0x9'));var fs=require('fs');var fs_extra=require(_0x9158('0xa'));var _=require(_0x9158('0xb'));var squel=require('squel');var crypto=require(_0x9158('0xc'));var jsforce=require(_0x9158('0xd'));var deskjs=require(_0x9158('0xe'));var toCsv=require(_0x9158('0x8'));var querystring=require(_0x9158('0xf'));var Papa=require('papaparse');var Redis=require(_0x9158('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9158('0x11'));var as=require(_0x9158('0x12'));var hardwareService=require(_0x9158('0x13'));var logger=require(_0x9158('0x14'))(_0x9158('0x15'));var utils=require('../../config/utils');var config=require(_0x9158('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9158('0x17'))['db'];function respondWithStatusCode(_0x42f50a,_0x4f6303){_0x4f6303=_0x4f6303||0xcc;return function(_0x4b6e39){if(_0x4b6e39){return _0x42f50a['sendStatus'](_0x4f6303);}return _0x42f50a['status'](_0x4f6303)[_0x9158('0x18')]();};}function respondWithResult(_0x48eaa9,_0x20816d){_0x20816d=_0x20816d||0xc8;return function(_0x311c08){if(_0x311c08){return _0x48eaa9[_0x9158('0x19')](_0x20816d)[_0x9158('0x1a')](_0x311c08);}};}function respondWithFilteredResult(_0xec9dab,_0x2e76eb){return function(_0x42685a){if(_0x42685a){var _0x207a77=typeof _0x2e76eb[_0x9158('0x1b')]===_0x9158('0x1c')&&typeof _0x2e76eb['limit']===_0x9158('0x1c');var _0xd91de4=_0x42685a[_0x9158('0x1d')];var _0x11b15d=_0x207a77?0x0:_0x2e76eb[_0x9158('0x1b')];var _0xe418b8=_0x207a77?_0x42685a[_0x9158('0x1d')]:_0x2e76eb[_0x9158('0x1b')]+_0x2e76eb[_0x9158('0x1e')];var _0x46f62d;if(_0xe418b8>=_0xd91de4){_0xe418b8=_0xd91de4;_0x46f62d=0xc8;}else{_0x46f62d=0xce;}_0xec9dab[_0x9158('0x19')](_0x46f62d);return _0xec9dab[_0x9158('0x1f')](_0x9158('0x20'),_0x11b15d+'-'+_0xe418b8+'/'+_0xd91de4)[_0x9158('0x1a')](_0x42685a);}return null;};}function patchUpdates(_0x327efe){return function(_0x411e37){try{jsonpatch[_0x9158('0x21')](_0x411e37,_0x327efe,!![]);}catch(_0x5c063b){return BPromise['reject'](_0x5c063b);}return _0x411e37[_0x9158('0x22')]();};}function saveUpdates(_0x48f3d2,_0x1359e4){return function(_0x5d529d){if(_0x5d529d){return _0x5d529d[_0x9158('0x23')](_0x48f3d2)[_0x9158('0x24')](function(_0x3d549d){return _0x3d549d;});}return null;};}function removeEntity(_0x25eb05,_0x300edc){return function(_0x537c4a){if(_0x537c4a){return _0x537c4a[_0x9158('0x25')]()[_0x9158('0x24')](function(){_0x25eb05[_0x9158('0x19')](0xcc)[_0x9158('0x18')]();});}};}function handleEntityNotFound(_0x5a4200,_0x56c0bb){return function(_0xb4e549){if(!_0xb4e549){_0x5a4200['sendStatus'](0x194);}return _0xb4e549;};}function handleError(_0x2c5497,_0x220fb2){_0x220fb2=_0x220fb2||0x1f4;return function(_0x4021b8){logger[_0x9158('0x26')](_0x4021b8[_0x9158('0x27')]);if(_0x4021b8[_0x9158('0x28')]){delete _0x4021b8[_0x9158('0x28')];}_0x2c5497[_0x9158('0x19')](_0x220fb2)[_0x9158('0x29')](_0x4021b8);};}exports[_0x9158('0x2a')]=function(_0x53da9b,_0x554a0e){var _0x388a59={},_0x170ea2={},_0x36a37b={'count':0x0,'rows':[]};var _0x10ae19=_[_0x9158('0x2b')](db[_0x9158('0x2c')][_0x9158('0x2d')],function(_0x32325a){return{'name':_0x32325a[_0x9158('0x2e')],'type':_0x32325a[_0x9158('0x2f')]['key']};});_0x170ea2['model']=_['map'](_0x10ae19,_0x9158('0x28'));_0x170ea2[_0x9158('0x30')]=_[_0x9158('0x31')](_0x53da9b[_0x9158('0x30')]);_0x170ea2[_0x9158('0x32')]=_[_0x9158('0x33')](_0x170ea2[_0x9158('0x34')],_0x170ea2[_0x9158('0x30')]);_0x388a59[_0x9158('0x35')]=_[_0x9158('0x33')](_0x170ea2['model'],qs[_0x9158('0x36')](_0x53da9b[_0x9158('0x30')]['fields']));_0x388a59[_0x9158('0x35')]=_0x388a59[_0x9158('0x35')][_0x9158('0x37')]?_0x388a59['attributes']:_0x170ea2[_0x9158('0x34')];if(!_0x53da9b[_0x9158('0x30')]['hasOwnProperty'](_0x9158('0x38'))){_0x388a59['limit']=qs[_0x9158('0x1e')](_0x53da9b[_0x9158('0x30')][_0x9158('0x1e')]);_0x388a59[_0x9158('0x1b')]=qs[_0x9158('0x1b')](_0x53da9b[_0x9158('0x30')][_0x9158('0x1b')]);}_0x388a59[_0x9158('0x39')]=qs[_0x9158('0x3a')](_0x53da9b['query'][_0x9158('0x3a')]);_0x388a59[_0x9158('0x3b')]=qs[_0x9158('0x32')](_[_0x9158('0x3c')](_0x53da9b['query'],_0x170ea2[_0x9158('0x32')]),_0x10ae19);if(_0x53da9b['query'][_0x9158('0x3d')]){_0x388a59[_0x9158('0x3b')]=_[_0x9158('0x3e')](_0x388a59[_0x9158('0x3b')],{'$or':_[_0x9158('0x2b')](_0x10ae19,function(_0x11e26b){if(_0x11e26b['type']!==_0x9158('0x3f')){var _0x3818d7={};_0x3818d7[_0x11e26b['name']]={'$like':'%'+_0x53da9b[_0x9158('0x30')][_0x9158('0x3d')]+'%'};return _0x3818d7;}})});}_0x388a59=_[_0x9158('0x3e')]({},_0x388a59,_0x53da9b['options']);var _0x44e28d={'where':_0x388a59[_0x9158('0x3b')]};return db[_0x9158('0x2c')][_0x9158('0x1d')](_0x44e28d)[_0x9158('0x24')](function(_0x28b8ab){_0x36a37b[_0x9158('0x1d')]=_0x28b8ab;if(_0x53da9b[_0x9158('0x30')]['includeAll']){_0x388a59[_0x9158('0x40')]=[{'all':!![]}];}return db[_0x9158('0x2c')][_0x9158('0x41')](_0x388a59);})['then'](function(_0x3536d9){_0x36a37b[_0x9158('0x42')]=_0x3536d9;return _0x36a37b;})['then'](respondWithFilteredResult(_0x554a0e,_0x388a59))[_0x9158('0x43')](handleError(_0x554a0e,null));};exports['show']=function(_0x3fb7c2,_0x466c4d){var _0x50de1b={'raw':!![],'where':{'id':_0x3fb7c2[_0x9158('0x44')]['id']}},_0x512a85={};_0x512a85[_0x9158('0x34')]=_['keys'](db[_0x9158('0x2c')][_0x9158('0x2d')]);_0x512a85['query']=_[_0x9158('0x31')](_0x3fb7c2[_0x9158('0x30')]);_0x512a85[_0x9158('0x32')]=_[_0x9158('0x33')](_0x512a85[_0x9158('0x34')],_0x512a85['query']);_0x50de1b['attributes']=_['intersection'](_0x512a85[_0x9158('0x34')],qs[_0x9158('0x36')](_0x3fb7c2['query'][_0x9158('0x36')]));_0x50de1b[_0x9158('0x35')]=_0x50de1b[_0x9158('0x35')]['length']?_0x50de1b[_0x9158('0x35')]:_0x512a85['model'];if(_0x3fb7c2[_0x9158('0x30')][_0x9158('0x45')]){_0x50de1b[_0x9158('0x40')]=[{'all':!![]}];}_0x50de1b=_[_0x9158('0x3e')]({},_0x50de1b,_0x3fb7c2['options']);return db['FaxTransferReport']['find'](_0x50de1b)[_0x9158('0x24')](handleEntityNotFound(_0x466c4d,null))[_0x9158('0x24')](respondWithResult(_0x466c4d,null))['catch'](handleError(_0x466c4d,null));};exports[_0x9158('0x46')]=function(_0x3d1bce,_0x37b1e4){return db['FaxTransferReport'][_0x9158('0x46')](_0x3d1bce[_0x9158('0x47')],{})[_0x9158('0x24')](respondWithResult(_0x37b1e4,0xc9))[_0x9158('0x43')](handleError(_0x37b1e4,null));};exports[_0x9158('0x23')]=function(_0x51e2ec,_0x5acb10){if(_0x51e2ec[_0x9158('0x47')]['id']){delete _0x51e2ec[_0x9158('0x47')]['id'];}return db['FaxTransferReport'][_0x9158('0x48')]({'where':{'id':_0x51e2ec[_0x9158('0x44')]['id']}})[_0x9158('0x24')](handleEntityNotFound(_0x5acb10,null))[_0x9158('0x24')](saveUpdates(_0x51e2ec[_0x9158('0x47')],null))[_0x9158('0x24')](respondWithResult(_0x5acb10,null))[_0x9158('0x43')](handleError(_0x5acb10,null));};exports[_0x9158('0x25')]=function(_0x6dab30,_0x38a3fe){return db[_0x9158('0x2c')]['find']({'where':{'id':_0x6dab30['params']['id']}})[_0x9158('0x24')](handleEntityNotFound(_0x38a3fe,null))[_0x9158('0x24')](removeEntity(_0x38a3fe,null))[_0x9158('0x43')](handleError(_0x38a3fe,null));};exports[_0x9158('0x49')]=function(_0xbcb8f2,_0x376778){return db[_0x9158('0x2c')]['describe']()['then'](respondWithResult(_0x376778,null))['catch'](handleError(_0x376778,null));}; \ No newline at end of file +var _0x2fca=['FaxTransferReport','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','update','catch','describe','eml-format','fast-json-patch','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error','name','send'];(function(_0x292541,_0x767479){var _0x37b9ad=function(_0x1523a0){while(--_0x1523a0){_0x292541['push'](_0x292541['shift']());}};_0x37b9ad(++_0x767479);}(_0x2fca,0x14e));var _0xa2fc=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x2fca[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require(_0xa2fc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa2fc('0x1'));var rp=require('request-promise');var moment=require(_0xa2fc('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa2fc('0x3'));var path=require(_0xa2fc('0x4'));var sox=require(_0xa2fc('0x5'));var csv=require('to-csv');var ejs=require(_0xa2fc('0x6'));var fs=require('fs');var fs_extra=require(_0xa2fc('0x7'));var _=require('lodash');var squel=require(_0xa2fc('0x8'));var crypto=require(_0xa2fc('0x9'));var jsforce=require(_0xa2fc('0xa'));var deskjs=require(_0xa2fc('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa2fc('0xc'));var Papa=require(_0xa2fc('0xd'));var Redis=require(_0xa2fc('0xe'));var authService=require(_0xa2fc('0xf'));var qs=require(_0xa2fc('0x10'));var as=require(_0xa2fc('0x11'));var hardwareService=require(_0xa2fc('0x12'));var logger=require(_0xa2fc('0x13'))(_0xa2fc('0x14'));var utils=require(_0xa2fc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa2fc('0x16'));var db=require(_0xa2fc('0x17'))['db'];function respondWithStatusCode(_0x580832,_0x3ad51b){_0x3ad51b=_0x3ad51b||0xcc;return function(_0xc768f8){if(_0xc768f8){return _0x580832[_0xa2fc('0x18')](_0x3ad51b);}return _0x580832[_0xa2fc('0x19')](_0x3ad51b)[_0xa2fc('0x1a')]();};}function respondWithResult(_0x30d50e,_0x16b701){_0x16b701=_0x16b701||0xc8;return function(_0x3b556d){if(_0x3b556d){return _0x30d50e[_0xa2fc('0x19')](_0x16b701)['json'](_0x3b556d);}};}function respondWithFilteredResult(_0x3afd66,_0x34b097){return function(_0x371c1a){if(_0x371c1a){var _0x23fa2b=typeof _0x34b097[_0xa2fc('0x1b')]===_0xa2fc('0x1c')&&typeof _0x34b097[_0xa2fc('0x1d')]===_0xa2fc('0x1c');var _0x2039a7=_0x371c1a['count'];var _0x2c85d6=_0x23fa2b?0x0:_0x34b097[_0xa2fc('0x1b')];var _0x4dcc0b=_0x23fa2b?_0x371c1a[_0xa2fc('0x1e')]:_0x34b097[_0xa2fc('0x1b')]+_0x34b097[_0xa2fc('0x1d')];var _0x17db57;if(_0x4dcc0b>=_0x2039a7){_0x4dcc0b=_0x2039a7;_0x17db57=0xc8;}else{_0x17db57=0xce;}_0x3afd66[_0xa2fc('0x19')](_0x17db57);return _0x3afd66[_0xa2fc('0x1f')](_0xa2fc('0x20'),_0x2c85d6+'-'+_0x4dcc0b+'/'+_0x2039a7)[_0xa2fc('0x21')](_0x371c1a);}return null;};}function patchUpdates(_0x5a8b85){return function(_0x517a67){try{jsonpatch['apply'](_0x517a67,_0x5a8b85,!![]);}catch(_0x1a3988){return BPromise[_0xa2fc('0x22')](_0x1a3988);}return _0x517a67[_0xa2fc('0x23')]();};}function saveUpdates(_0x372c3a,_0x43e2d2){return function(_0x2bbb8a){if(_0x2bbb8a){return _0x2bbb8a['update'](_0x372c3a)[_0xa2fc('0x24')](function(_0x1bc159){return _0x1bc159;});}return null;};}function removeEntity(_0xa1b7bf,_0x172a6a){return function(_0x1beadd){if(_0x1beadd){return _0x1beadd[_0xa2fc('0x25')]()['then'](function(){_0xa1b7bf[_0xa2fc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4eb19c,_0x21096d){return function(_0x3480fb){if(!_0x3480fb){_0x4eb19c['sendStatus'](0x194);}return _0x3480fb;};}function handleError(_0x3764ea,_0x4e62d8){_0x4e62d8=_0x4e62d8||0x1f4;return function(_0x3c99a0){logger[_0xa2fc('0x26')](_0x3c99a0['stack']);if(_0x3c99a0[_0xa2fc('0x27')]){delete _0x3c99a0[_0xa2fc('0x27')];}_0x3764ea[_0xa2fc('0x19')](_0x4e62d8)[_0xa2fc('0x28')](_0x3c99a0);};}exports['index']=function(_0x505a1c,_0x2e8ce3){var _0x3aa80e={},_0x36559e={},_0xec12f0={'count':0x0,'rows':[]};var _0x3e13da=_['map'](db[_0xa2fc('0x29')][_0xa2fc('0x2a')],function(_0x114952){return{'name':_0x114952['fieldName'],'type':_0x114952['type'][_0xa2fc('0x2b')]};});_0x36559e[_0xa2fc('0x2c')]=_[_0xa2fc('0x2d')](_0x3e13da,_0xa2fc('0x27'));_0x36559e[_0xa2fc('0x2e')]=_[_0xa2fc('0x2f')](_0x505a1c['query']);_0x36559e[_0xa2fc('0x30')]=_[_0xa2fc('0x31')](_0x36559e[_0xa2fc('0x2c')],_0x36559e[_0xa2fc('0x2e')]);_0x3aa80e[_0xa2fc('0x32')]=_[_0xa2fc('0x31')](_0x36559e[_0xa2fc('0x2c')],qs['fields'](_0x505a1c[_0xa2fc('0x2e')][_0xa2fc('0x33')]));_0x3aa80e[_0xa2fc('0x32')]=_0x3aa80e[_0xa2fc('0x32')][_0xa2fc('0x34')]?_0x3aa80e[_0xa2fc('0x32')]:_0x36559e['model'];if(!_0x505a1c[_0xa2fc('0x2e')][_0xa2fc('0x35')](_0xa2fc('0x36'))){_0x3aa80e['limit']=qs['limit'](_0x505a1c['query'][_0xa2fc('0x1d')]);_0x3aa80e[_0xa2fc('0x1b')]=qs['offset'](_0x505a1c['query'][_0xa2fc('0x1b')]);}_0x3aa80e[_0xa2fc('0x37')]=qs[_0xa2fc('0x38')](_0x505a1c[_0xa2fc('0x2e')]['sort']);_0x3aa80e['where']=qs[_0xa2fc('0x30')](_['pick'](_0x505a1c[_0xa2fc('0x2e')],_0x36559e[_0xa2fc('0x30')]),_0x3e13da);if(_0x505a1c['query'][_0xa2fc('0x39')]){_0x3aa80e['where']=_[_0xa2fc('0x3a')](_0x3aa80e[_0xa2fc('0x3b')],{'$or':_[_0xa2fc('0x2d')](_0x3e13da,function(_0x55aa90){if(_0x55aa90[_0xa2fc('0x3c')]!==_0xa2fc('0x3d')){var _0x1b4c97={};_0x1b4c97[_0x55aa90[_0xa2fc('0x27')]]={'$like':'%'+_0x505a1c[_0xa2fc('0x2e')][_0xa2fc('0x39')]+'%'};return _0x1b4c97;}})});}_0x3aa80e=_[_0xa2fc('0x3a')]({},_0x3aa80e,_0x505a1c['options']);var _0x5868c1={'where':_0x3aa80e[_0xa2fc('0x3b')]};return db['FaxTransferReport']['count'](_0x5868c1)[_0xa2fc('0x24')](function(_0x3e17a6){_0xec12f0['count']=_0x3e17a6;if(_0x505a1c[_0xa2fc('0x2e')][_0xa2fc('0x3e')]){_0x3aa80e[_0xa2fc('0x3f')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xa2fc('0x40')](_0x3aa80e);})['then'](function(_0x12e0dc){_0xec12f0[_0xa2fc('0x41')]=_0x12e0dc;return _0xec12f0;})[_0xa2fc('0x24')](respondWithFilteredResult(_0x2e8ce3,_0x3aa80e))['catch'](handleError(_0x2e8ce3,null));};exports[_0xa2fc('0x42')]=function(_0x285f72,_0x136353){var _0x17fd8e={'raw':!![],'where':{'id':_0x285f72[_0xa2fc('0x43')]['id']}},_0x34fbb4={};_0x34fbb4[_0xa2fc('0x2c')]=_[_0xa2fc('0x2f')](db[_0xa2fc('0x29')][_0xa2fc('0x2a')]);_0x34fbb4[_0xa2fc('0x2e')]=_[_0xa2fc('0x2f')](_0x285f72[_0xa2fc('0x2e')]);_0x34fbb4[_0xa2fc('0x30')]=_[_0xa2fc('0x31')](_0x34fbb4[_0xa2fc('0x2c')],_0x34fbb4[_0xa2fc('0x2e')]);_0x17fd8e[_0xa2fc('0x32')]=_[_0xa2fc('0x31')](_0x34fbb4[_0xa2fc('0x2c')],qs[_0xa2fc('0x33')](_0x285f72[_0xa2fc('0x2e')]['fields']));_0x17fd8e['attributes']=_0x17fd8e[_0xa2fc('0x32')][_0xa2fc('0x34')]?_0x17fd8e['attributes']:_0x34fbb4[_0xa2fc('0x2c')];if(_0x285f72[_0xa2fc('0x2e')]['includeAll']){_0x17fd8e[_0xa2fc('0x3f')]=[{'all':!![]}];}_0x17fd8e=_['merge']({},_0x17fd8e,_0x285f72[_0xa2fc('0x44')]);return db[_0xa2fc('0x29')][_0xa2fc('0x45')](_0x17fd8e)[_0xa2fc('0x24')](handleEntityNotFound(_0x136353,null))[_0xa2fc('0x24')](respondWithResult(_0x136353,null))['catch'](handleError(_0x136353,null));};exports['create']=function(_0x3cd7de,_0x3e42a8){return db[_0xa2fc('0x29')][_0xa2fc('0x46')](_0x3cd7de[_0xa2fc('0x47')],{})['then'](respondWithResult(_0x3e42a8,0xc9))['catch'](handleError(_0x3e42a8,null));};exports[_0xa2fc('0x48')]=function(_0x58c6b3,_0x571abb){if(_0x58c6b3[_0xa2fc('0x47')]['id']){delete _0x58c6b3[_0xa2fc('0x47')]['id'];}return db['FaxTransferReport'][_0xa2fc('0x45')]({'where':{'id':_0x58c6b3['params']['id']}})[_0xa2fc('0x24')](handleEntityNotFound(_0x571abb,null))[_0xa2fc('0x24')](saveUpdates(_0x58c6b3[_0xa2fc('0x47')],null))['then'](respondWithResult(_0x571abb,null))['catch'](handleError(_0x571abb,null));};exports[_0xa2fc('0x25')]=function(_0xcebd53,_0x47ae08){return db['FaxTransferReport'][_0xa2fc('0x45')]({'where':{'id':_0xcebd53[_0xa2fc('0x43')]['id']}})[_0xa2fc('0x24')](handleEntityNotFound(_0x47ae08,null))['then'](removeEntity(_0x47ae08,null))[_0xa2fc('0x49')](handleError(_0x47ae08,null));};exports[_0xa2fc('0x4a')]=function(_0x27fd81,_0x392765){return db[_0xa2fc('0x29')][_0xa2fc('0x4a')]()[_0xa2fc('0x24')](respondWithResult(_0x392765,null))[_0xa2fc('0x49')](handleError(_0x392765,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 77b3fce..7705337 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 _0x1690=['request-promise','path','rimraf','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','api','moment','bluebird'];(function(_0x3f1e57,_0x233ef6){var _0x24fcd9=function(_0x46f2c3){while(--_0x46f2c3){_0x3f1e57['push'](_0x3f1e57['shift']());}};_0x24fcd9(++_0x233ef6);}(_0x1690,0xc3));var _0x0169=function(_0xe0ed16,_0x4c4921){_0xe0ed16=_0xe0ed16-0x0;var _0x263b08=_0x1690[_0xe0ed16];return _0x263b08;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0169('0x0'));var moment=require(_0x0169('0x1'));var BPromise=require(_0x0169('0x2'));var rp=require(_0x0169('0x3'));var fs=require('fs');var path=require(_0x0169('0x4'));var rimraf=require(_0x0169('0x5'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0x0169('0x6')]=function(_0xda8b05,_0x357753){return _0xda8b05[_0x0169('0x7')](_0x0169('0x8'),attributes,{'tableName':_0x0169('0x9'),'paranoid':![],'indexes':[{'name':_0x0169('0xa'),'fields':[_0x0169('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x119e=['moment','bluebird','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','api'];(function(_0x103bec,_0x3ab101){var _0x4c7523=function(_0x2a5014){while(--_0x2a5014){_0x103bec['push'](_0x103bec['shift']());}};_0x4c7523(++_0x3ab101);}(_0x119e,0xf9));var _0xe119=function(_0x535de4,_0x549e1a){_0x535de4=_0x535de4-0x0;var _0x3ee461=_0x119e[_0x535de4];return _0x3ee461;};'use strict';var _=require(_0xe119('0x0'));var util=require(_0xe119('0x1'));var logger=require('../../config/logger')(_0xe119('0x2'));var moment=require(_0xe119('0x3'));var BPromise=require(_0xe119('0x4'));var rp=require(_0xe119('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe119('0x6'));var config=require(_0xe119('0x7'));var attributes=require(_0xe119('0x8'));module[_0xe119('0x9')]=function(_0x18be33,_0x102bc0){return _0x18be33[_0xe119('0xa')](_0xe119('0xb'),attributes,{'tableName':_0xe119('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe119('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 87cd436..1c5ee61 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 _0x5a19=['rpc','../../config/environment','jayson/promise','client','http','request','then','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x38c9db,_0x2b798b){var _0x50d3bd=function(_0x2f4bb2){while(--_0x2f4bb2){_0x38c9db['push'](_0x38c9db['shift']());}};_0x50d3bd(++_0x2b798b);}(_0x5a19,0x9a));var _0x95a1=function(_0x1c90a7,_0x115e4d){_0x1c90a7=_0x1c90a7-0x0;var _0x408b33=_0x5a19[_0x1c90a7];return _0x408b33;};'use strict';var _=require('lodash');var util=require(_0x95a1('0x0'));var moment=require(_0x95a1('0x1'));var BPromise=require(_0x95a1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95a1('0x3'));var db=require(_0x95a1('0x4'))['db'];var utils=require(_0x95a1('0x5'));var logger=require(_0x95a1('0x6'))(_0x95a1('0x7'));var config=require(_0x95a1('0x8'));var jayson=require(_0x95a1('0x9'));var client=jayson[_0x95a1('0xa')][_0x95a1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47e48c,_0x2ff474,_0x1b0a6b){return new BPromise(function(_0x1b94cb,_0x33d37f){return client[_0x95a1('0xc')](_0x47e48c,_0x1b0a6b)[_0x95a1('0xd')](function(_0x119c1d){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x2ff474,'request\x20sent');logger[_0x95a1('0xe')](_0x95a1('0xf'),_0x2ff474,_0x95a1('0x10'),JSON['stringify'](_0x119c1d));if(_0x119c1d[_0x95a1('0x11')]){if(_0x119c1d['error'][_0x95a1('0x12')]===0x1f4){logger[_0x95a1('0x11')](_0x95a1('0x13'),_0x2ff474,_0x119c1d[_0x95a1('0x11')][_0x95a1('0x14')]);return _0x33d37f(_0x119c1d[_0x95a1('0x11')][_0x95a1('0x14')]);}logger['error'](_0x95a1('0x13'),_0x2ff474,_0x119c1d[_0x95a1('0x11')][_0x95a1('0x14')]);return _0x1b94cb(_0x119c1d[_0x95a1('0x11')]['message']);}else{logger['info'](_0x95a1('0x13'),_0x2ff474,_0x95a1('0x10'));_0x1b94cb(_0x119c1d[_0x95a1('0x15')][_0x95a1('0x14')]);}})[_0x95a1('0x16')](function(_0x3bf357){logger[_0x95a1('0x11')](_0x95a1('0x13'),_0x2ff474,_0x3bf357);_0x33d37f(_0x3bf357);});});} \ No newline at end of file +var _0xc8e3=['FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x12a9bb,_0xcc6767){var _0x2b37d3=function(_0x4ad033){while(--_0x4ad033){_0x12a9bb['push'](_0x12a9bb['shift']());}};_0x2b37d3(++_0xcc6767);}(_0xc8e3,0x16e));var _0x3c8e=function(_0x5a7f23,_0x47b655){_0x5a7f23=_0x5a7f23-0x0;var _0x3cc78d=_0xc8e3[_0x5a7f23];return _0x3cc78d;};'use strict';var _=require(_0x3c8e('0x0'));var util=require('util');var moment=require(_0x3c8e('0x1'));var BPromise=require(_0x3c8e('0x2'));var rs=require(_0x3c8e('0x3'));var fs=require('fs');var Redis=require(_0x3c8e('0x4'));var db=require(_0x3c8e('0x5'))['db'];var utils=require(_0x3c8e('0x6'));var logger=require('../../config/logger')(_0x3c8e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x3c8e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a8cb,_0x5360a5,_0x2a3fe8){return new BPromise(function(_0x228b1c,_0xe755d){return client[_0x3c8e('0x9')](_0x1a8cb,_0x2a3fe8)['then'](function(_0x1cb7a2){logger[_0x3c8e('0xa')](_0x3c8e('0xb'),_0x5360a5,_0x3c8e('0xc'));logger[_0x3c8e('0xd')](_0x3c8e('0xe'),_0x5360a5,_0x3c8e('0xc'),JSON[_0x3c8e('0xf')](_0x1cb7a2));if(_0x1cb7a2[_0x3c8e('0x10')]){if(_0x1cb7a2[_0x3c8e('0x10')]['code']===0x1f4){logger[_0x3c8e('0x10')](_0x3c8e('0xb'),_0x5360a5,_0x1cb7a2['error'][_0x3c8e('0x11')]);return _0xe755d(_0x1cb7a2[_0x3c8e('0x10')][_0x3c8e('0x11')]);}logger[_0x3c8e('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x5360a5,_0x1cb7a2['error'][_0x3c8e('0x11')]);return _0x228b1c(_0x1cb7a2[_0x3c8e('0x10')][_0x3c8e('0x11')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x5360a5,_0x3c8e('0xc'));_0x228b1c(_0x1cb7a2[_0x3c8e('0x12')][_0x3c8e('0x11')]);}})[_0x3c8e('0x13')](function(_0xfe71a9){logger[_0x3c8e('0x10')](_0x3c8e('0xb'),_0x5360a5,_0xfe71a9);_0xe755d(_0xfe71a9);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 74d5acc..1277c4c 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 _0xab05=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','put','update','/:id','destroy','util','path','connect-timeout','express'];(function(_0x403be0,_0x35d6a2){var _0x5c1a45=function(_0x822cf6){while(--_0x822cf6){_0x403be0['push'](_0x403be0['shift']());}};_0x5c1a45(++_0x35d6a2);}(_0xab05,0x94));var _0x5ab0=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xab05[_0x160c73];return _0xd9302;};'use strict';var multer=require('multer');var util=require(_0x5ab0('0x0'));var path=require(_0x5ab0('0x1'));var timeout=require(_0x5ab0('0x2'));var express=require(_0x5ab0('0x3'));var router=express[_0x5ab0('0x4')]();var fs_extra=require(_0x5ab0('0x5'));var auth=require(_0x5ab0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5ab0('0x7'));var controller=require('./faxTransferReport.controller');router[_0x5ab0('0x8')]('/',auth[_0x5ab0('0x9')](),controller[_0x5ab0('0xa')]);router['get'](_0x5ab0('0xb'),auth[_0x5ab0('0x9')](),controller[_0x5ab0('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x5ab0('0xd')]);router[_0x5ab0('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5ab0('0xf')]('/:id',auth[_0x5ab0('0x9')](),controller[_0x5ab0('0x10')]);router['delete'](_0x5ab0('0x11'),auth[_0x5ab0('0x9')](),controller[_0x5ab0('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2f26=['/:id','create','put','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','/describe','describe','get'];(function(_0x45c785,_0x1c1d40){var _0x5cc0c9=function(_0xc2e40c){while(--_0xc2e40c){_0x45c785['push'](_0x45c785['shift']());}};_0x5cc0c9(++_0x1c1d40);}(_0x2f26,0xaf));var _0x62f2=function(_0x35263b,_0x4e7987){_0x35263b=_0x35263b-0x0;var _0x3dc702=_0x2f26[_0x35263b];return _0x3dc702;};'use strict';var multer=require('multer');var util=require(_0x62f2('0x0'));var path=require(_0x62f2('0x1'));var timeout=require(_0x62f2('0x2'));var express=require(_0x62f2('0x3'));var router=express[_0x62f2('0x4')]();var fs_extra=require(_0x62f2('0x5'));var auth=require(_0x62f2('0x6'));var interaction=require(_0x62f2('0x7'));var config=require(_0x62f2('0x8'));var controller=require(_0x62f2('0x9'));router['get']('/',auth[_0x62f2('0xa')](),controller[_0x62f2('0xb')]);router['get'](_0x62f2('0xc'),auth['isAuthenticated'](),controller[_0x62f2('0xd')]);router[_0x62f2('0xe')](_0x62f2('0xf'),auth[_0x62f2('0xa')](),controller['show']);router['post']('/',auth[_0x62f2('0xa')](),controller[_0x62f2('0x10')]);router[_0x62f2('0x11')](_0x62f2('0xf'),auth[_0x62f2('0xa')](),controller['update']);router['delete'](_0x62f2('0xf'),auth[_0x62f2('0xa')](),controller[_0x62f2('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 5e7ebb2..64b7afa 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 _0xcf8c=['put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./intDeskAccount.controller','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','get','/:id/fields','getFields','post','addConfiguration'];(function(_0x5aed6d,_0x28dca8){var _0xfdd3f4=function(_0x20fe5a){while(--_0x20fe5a){_0x5aed6d['push'](_0x5aed6d['shift']());}};_0xfdd3f4(++_0x28dca8);}(_0xcf8c,0x1e8));var _0xccf8=function(_0x581493,_0x9d49fc){_0x581493=_0x581493-0x0;var _0x1f837c=_0xcf8c[_0x581493];return _0x1f837c;};'use strict';var multer=require(_0xccf8('0x0'));var util=require(_0xccf8('0x1'));var path=require(_0xccf8('0x2'));var timeout=require('connect-timeout');var express=require(_0xccf8('0x3'));var router=express[_0xccf8('0x4')]();var fs_extra=require(_0xccf8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xccf8('0x6'));var controller=require(_0xccf8('0x7'));router['get']('/',auth[_0xccf8('0x8')](),controller[_0xccf8('0x9')]);router['get'](_0xccf8('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xccf8('0xb'),auth[_0xccf8('0x8')](),controller[_0xccf8('0xc')]);router[_0xccf8('0xd')](_0xccf8('0xe'),auth[_0xccf8('0x8')](),controller[_0xccf8('0xf')]);router[_0xccf8('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xccf8('0x10')]('/:id/configurations',auth[_0xccf8('0x8')](),controller[_0xccf8('0x11')]);router[_0xccf8('0x12')](_0xccf8('0xa'),auth['isAuthenticated'](),controller[_0xccf8('0x13')]);router[_0xccf8('0x14')]('/:id',auth[_0xccf8('0x8')](),controller['destroy']);module[_0xccf8('0x15')]=router; \ No newline at end of file +var _0x36a4=['create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','index','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post'];(function(_0x33df33,_0x1477b6){var _0x521172=function(_0x419491){while(--_0x419491){_0x33df33['push'](_0x33df33['shift']());}};_0x521172(++_0x1477b6);}(_0x36a4,0x1e4));var _0x436a=function(_0x3901fe,_0x59b402){_0x3901fe=_0x3901fe-0x0;var _0x1564f1=_0x36a4[_0x3901fe];return _0x1564f1;};'use strict';var multer=require(_0x436a('0x0'));var util=require(_0x436a('0x1'));var path=require(_0x436a('0x2'));var timeout=require(_0x436a('0x3'));var express=require(_0x436a('0x4'));var router=express[_0x436a('0x5')]();var fs_extra=require(_0x436a('0x6'));var auth=require(_0x436a('0x7'));var interaction=require(_0x436a('0x8'));var config=require(_0x436a('0x9'));var controller=require(_0x436a('0xa'));router[_0x436a('0xb')]('/',auth['isAuthenticated'](),controller[_0x436a('0xc')]);router[_0x436a('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x436a('0xd')]);router[_0x436a('0xb')](_0x436a('0xe'),auth[_0x436a('0xf')](),controller[_0x436a('0x10')]);router[_0x436a('0xb')](_0x436a('0x11'),auth[_0x436a('0xf')](),controller[_0x436a('0x12')]);router[_0x436a('0x13')]('/',auth['isAuthenticated'](),controller[_0x436a('0x14')]);router[_0x436a('0x13')]('/:id/configurations',auth[_0x436a('0xf')](),controller[_0x436a('0x15')]);router[_0x436a('0x16')](_0x436a('0x17'),auth[_0x436a('0xf')](),controller[_0x436a('0x18')]);router[_0x436a('0x19')](_0x436a('0x17'),auth['isAuthenticated'](),controller[_0x436a('0x1a')]);module[_0x436a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index b003a79..0e00ca4 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 _0x8972=['basic','integrationTab','STRING','ENUM'];(function(_0xa0e392,_0x24a050){var _0x264712=function(_0x370191){while(--_0x370191){_0xa0e392['push'](_0xa0e392['shift']());}};_0x264712(++_0x24a050);}(_0x8972,0x16a));var _0x2897=function(_0x3507ef,_0x2c793b){_0x3507ef=_0x3507ef-0x0;var _0x43b75d=_0x8972[_0x3507ef];return _0x43b75d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2897('0x0')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2897('0x0')]},'remoteUri':{'type':Sequelize[_0x2897('0x0')]},'authType':{'type':Sequelize[_0x2897('0x1')](_0x2897('0x2')),'defaultValue':_0x2897('0x2')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x2897('0x0')]},'token':{'type':Sequelize[_0x2897('0x0')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x2897('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x2897('0x1')](_0x2897('0x3'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xcd67=['basic','integrationTab','newTab','exports','STRING','ENUM'];(function(_0xd24165,_0x580b76){var _0x438f29=function(_0x2af5f3){while(--_0x2af5f3){_0xd24165['push'](_0xd24165['shift']());}};_0x438f29(++_0x580b76);}(_0xcd67,0x1cb));var _0x7cd6=function(_0x52f851,_0x289e35){_0x52f851=_0x52f851-0x0;var _0x3f4730=_0xcd67[_0x52f851];return _0x3f4730;};'use strict';var Sequelize=require('sequelize');module[_0x7cd6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7cd6('0x1')]},'username':{'type':Sequelize[_0x7cd6('0x1')]},'remoteUri':{'type':Sequelize[_0x7cd6('0x1')]},'authType':{'type':Sequelize[_0x7cd6('0x2')]('basic'),'defaultValue':_0x7cd6('0x3')},'password':{'type':Sequelize[_0x7cd6('0x1')]},'consumerKey':{'type':Sequelize[_0x7cd6('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7cd6('0x4'),_0x7cd6('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 7a875dc..0e6757f 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 _0x93e0=['end','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','create','body','destroy','getConfigurations','findOne','DeskConfiguration','fields','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','DeskField','getFields','priority','authType','username','consumerKey','consumerSecret','tokenSecret','remoteUri','GET','format','application/json','headers','Authorization','Basic\x20%s','%s:%s','toString','label','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x93e0,0xa7));var _0x093e=function(_0x4e492e,_0x4750a2){_0x4e492e=_0x4e492e-0x0;var _0x17ebbf=_0x93e0[_0x4e492e];return _0x17ebbf;};'use strict';var emlformat=require(_0x093e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x093e('0x1'));var jsonpatch=require(_0x093e('0x2'));var rp=require(_0x093e('0x3'));var moment=require(_0x093e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x093e('0x5'));var util=require('util');var path=require(_0x093e('0x6'));var sox=require(_0x093e('0x7'));var csv=require(_0x093e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x093e('0x9'));var _=require(_0x093e('0xa'));var squel=require('squel');var crypto=require(_0x093e('0xb'));var jsforce=require(_0x093e('0xc'));var deskjs=require(_0x093e('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x093e('0xe'));var Redis=require('ioredis');var authService=require(_0x093e('0xf'));var qs=require(_0x093e('0x10'));var as=require(_0x093e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x093e('0x12'))(_0x093e('0x13'));var utils=require('../../config/utils');var config=require(_0x093e('0x14'));var licenseUtil=require(_0x093e('0x15'));var db=require(_0x093e('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1f7945,_0x278768){_0x278768=_0x278768||0xcc;return function(_0xccf1b9){if(_0xccf1b9){return _0x1f7945[_0x093e('0x17')](_0x278768);}return _0x1f7945[_0x093e('0x18')](_0x278768)['end']();};}function respondWithResult(_0x144a0f,_0x59c505){_0x59c505=_0x59c505||0xc8;return function(_0x51e95e){if(_0x51e95e){return _0x144a0f[_0x093e('0x18')](_0x59c505)['json'](_0x51e95e);}};}function respondWithFilteredResult(_0x878534,_0x17a1f7){return function(_0x5133be){if(_0x5133be){var _0x327944=typeof _0x17a1f7[_0x093e('0x19')]==='undefined'&&typeof _0x17a1f7[_0x093e('0x1a')]===_0x093e('0x1b');var _0x2cad1c=_0x5133be['count'];var _0x584bc3=_0x327944?0x0:_0x17a1f7[_0x093e('0x19')];var _0x3ff8f9=_0x327944?_0x5133be[_0x093e('0x1c')]:_0x17a1f7[_0x093e('0x19')]+_0x17a1f7[_0x093e('0x1a')];var _0x419e95;if(_0x3ff8f9>=_0x2cad1c){_0x3ff8f9=_0x2cad1c;_0x419e95=0xc8;}else{_0x419e95=0xce;}_0x878534[_0x093e('0x18')](_0x419e95);return _0x878534[_0x093e('0x1d')]('Content-Range',_0x584bc3+'-'+_0x3ff8f9+'/'+_0x2cad1c)[_0x093e('0x1e')](_0x5133be);}return null;};}function patchUpdates(_0x43bc0e){return function(_0x310a91){try{jsonpatch[_0x093e('0x1f')](_0x310a91,_0x43bc0e,!![]);}catch(_0x7603d){return BPromise['reject'](_0x7603d);}return _0x310a91[_0x093e('0x20')]();};}function saveUpdates(_0x982917,_0x504140){return function(_0x216ab1){if(_0x216ab1){return _0x216ab1[_0x093e('0x21')](_0x982917)[_0x093e('0x22')](function(_0x8eb42){return _0x8eb42;});}return null;};}function removeEntity(_0x1b37ec,_0xa980b){return function(_0x235d45){if(_0x235d45){return _0x235d45['destroy']()[_0x093e('0x22')](function(){_0x1b37ec[_0x093e('0x18')](0xcc)[_0x093e('0x23')]();});}};}function handleEntityNotFound(_0x55b6e7,_0x2ad272){return function(_0x24a59a){if(!_0x24a59a){_0x55b6e7['sendStatus'](0x194);}return _0x24a59a;};}function handleError(_0x39a860,_0x33b2b5){_0x33b2b5=_0x33b2b5||0x1f4;return function(_0x3fecbc){logger[_0x093e('0x24')](_0x3fecbc[_0x093e('0x25')]);if(_0x3fecbc[_0x093e('0x26')]){delete _0x3fecbc[_0x093e('0x26')];}_0x39a860[_0x093e('0x18')](_0x33b2b5)[_0x093e('0x27')](_0x3fecbc);};}exports[_0x093e('0x28')]=function(_0x4169aa,_0x14669b){var _0x5b57ee={},_0x2a49d2={},_0x3bf122={'count':0x0,'rows':[]};var _0x3b5bdb=_[_0x093e('0x29')](db[_0x093e('0x2a')][_0x093e('0x2b')],function(_0x5ac34c){return{'name':_0x5ac34c[_0x093e('0x2c')],'type':_0x5ac34c[_0x093e('0x2d')]['key']};});_0x2a49d2[_0x093e('0x2e')]=_[_0x093e('0x29')](_0x3b5bdb,_0x093e('0x26'));_0x2a49d2['query']=_[_0x093e('0x2f')](_0x4169aa[_0x093e('0x30')]);_0x2a49d2[_0x093e('0x31')]=_[_0x093e('0x32')](_0x2a49d2[_0x093e('0x2e')],_0x2a49d2[_0x093e('0x30')]);_0x5b57ee[_0x093e('0x33')]=_[_0x093e('0x32')](_0x2a49d2[_0x093e('0x2e')],qs['fields'](_0x4169aa[_0x093e('0x30')]['fields']));_0x5b57ee['attributes']=_0x5b57ee[_0x093e('0x33')][_0x093e('0x34')]?_0x5b57ee['attributes']:_0x2a49d2[_0x093e('0x2e')];if(!_0x4169aa['query']['hasOwnProperty']('nolimit')){_0x5b57ee[_0x093e('0x1a')]=qs[_0x093e('0x1a')](_0x4169aa['query'][_0x093e('0x1a')]);_0x5b57ee[_0x093e('0x19')]=qs[_0x093e('0x19')](_0x4169aa[_0x093e('0x30')]['offset']);}_0x5b57ee[_0x093e('0x35')]=qs[_0x093e('0x36')](_0x4169aa[_0x093e('0x30')]['sort']);_0x5b57ee[_0x093e('0x37')]=qs['filters'](_[_0x093e('0x38')](_0x4169aa[_0x093e('0x30')],_0x2a49d2[_0x093e('0x31')]),_0x3b5bdb);if(_0x4169aa[_0x093e('0x30')][_0x093e('0x39')]){_0x5b57ee[_0x093e('0x37')]=_['merge'](_0x5b57ee[_0x093e('0x37')],{'$or':_[_0x093e('0x29')](_0x3b5bdb,function(_0x41a467){if(_0x41a467[_0x093e('0x2d')]!==_0x093e('0x3a')){var _0x2d83c5={};_0x2d83c5[_0x41a467[_0x093e('0x26')]]={'$like':'%'+_0x4169aa[_0x093e('0x30')][_0x093e('0x39')]+'%'};return _0x2d83c5;}})});}_0x5b57ee=_[_0x093e('0x3b')]({},_0x5b57ee,_0x4169aa[_0x093e('0x3c')]);var _0x1ea0c5={'where':_0x5b57ee[_0x093e('0x37')]};return db[_0x093e('0x2a')]['count'](_0x1ea0c5)[_0x093e('0x22')](function(_0xb764f6){_0x3bf122[_0x093e('0x1c')]=_0xb764f6;if(_0x4169aa[_0x093e('0x30')][_0x093e('0x3d')]){_0x5b57ee[_0x093e('0x3e')]=[{'all':!![]}];}return db[_0x093e('0x2a')][_0x093e('0x3f')](_0x5b57ee);})[_0x093e('0x22')](function(_0x159753){_0x3bf122['rows']=_0x159753;return _0x3bf122;})['then'](respondWithFilteredResult(_0x14669b,_0x5b57ee))[_0x093e('0x40')](handleError(_0x14669b,null));};exports['show']=function(_0x1e96e9,_0x1e364d){var _0x2e7745={'raw':![],'where':{'id':_0x1e96e9[_0x093e('0x41')]['id']}},_0x5a53c4={};_0x5a53c4['model']=_['keys'](db[_0x093e('0x2a')][_0x093e('0x2b')]);_0x5a53c4[_0x093e('0x30')]=_['keys'](_0x1e96e9['query']);_0x5a53c4[_0x093e('0x31')]=_[_0x093e('0x32')](_0x5a53c4[_0x093e('0x2e')],_0x5a53c4[_0x093e('0x30')]);_0x2e7745['attributes']=_[_0x093e('0x32')](_0x5a53c4[_0x093e('0x2e')],qs['fields'](_0x1e96e9[_0x093e('0x30')]['fields']));_0x2e7745['attributes']=_0x2e7745[_0x093e('0x33')][_0x093e('0x34')]?_0x2e7745['attributes']:_0x5a53c4[_0x093e('0x2e')];if(_0x1e96e9[_0x093e('0x30')][_0x093e('0x3d')]){_0x2e7745[_0x093e('0x3e')]=[{'all':!![]}];}_0x2e7745=_['merge']({},_0x2e7745,_0x1e96e9['options']);return db[_0x093e('0x2a')][_0x093e('0x42')](_0x2e7745)[_0x093e('0x22')](handleEntityNotFound(_0x1e364d,null))['then'](respondWithResult(_0x1e364d,null))[_0x093e('0x40')](handleError(_0x1e364d,null));};exports[_0x093e('0x43')]=function(_0xa52443,_0x5a1cb6){return db['DeskAccount'][_0x093e('0x43')](_0xa52443[_0x093e('0x44')],{})[_0x093e('0x22')](respondWithResult(_0x5a1cb6,0xc9))['catch'](handleError(_0x5a1cb6,null));};exports[_0x093e('0x21')]=function(_0xe1f9e2,_0x1b05e3){if(_0xe1f9e2['body']['id']){delete _0xe1f9e2[_0x093e('0x44')]['id'];}return db['DeskAccount'][_0x093e('0x42')]({'where':{'id':_0xe1f9e2[_0x093e('0x41')]['id']}})[_0x093e('0x22')](handleEntityNotFound(_0x1b05e3,null))[_0x093e('0x22')](saveUpdates(_0xe1f9e2[_0x093e('0x44')],null))[_0x093e('0x22')](respondWithResult(_0x1b05e3,null))[_0x093e('0x40')](handleError(_0x1b05e3,null));};exports[_0x093e('0x45')]=function(_0x3f082e,_0x5bf552){return db[_0x093e('0x2a')][_0x093e('0x42')]({'where':{'id':_0x3f082e[_0x093e('0x41')]['id']}})['then'](handleEntityNotFound(_0x5bf552,null))[_0x093e('0x22')](removeEntity(_0x5bf552,null))[_0x093e('0x40')](handleError(_0x5bf552,null));};exports[_0x093e('0x46')]=function(_0x4c6b0a,_0x17b309,_0xfa548b){var _0x175457={};var _0x1490e5={};var _0x39bf9d;var _0x5cd040;return db[_0x093e('0x2a')][_0x093e('0x47')]({'where':{'id':_0x4c6b0a[_0x093e('0x41')]['id']}})[_0x093e('0x22')](handleEntityNotFound(_0x17b309,null))[_0x093e('0x22')](function(_0x451f93){if(_0x451f93){_0x39bf9d=_0x451f93;_0x1490e5[_0x093e('0x2e')]=_[_0x093e('0x2f')](db[_0x093e('0x48')][_0x093e('0x2b')]);_0x1490e5[_0x093e('0x30')]=_[_0x093e('0x2f')](_0x4c6b0a[_0x093e('0x30')]);_0x1490e5['filters']=_[_0x093e('0x32')](_0x1490e5[_0x093e('0x2e')],_0x1490e5[_0x093e('0x30')]);_0x175457['attributes']=_['intersection'](_0x1490e5[_0x093e('0x2e')],qs['fields'](_0x4c6b0a['query'][_0x093e('0x49')]));_0x175457['attributes']=_0x175457[_0x093e('0x33')][_0x093e('0x34')]?_0x175457[_0x093e('0x33')]:_0x1490e5[_0x093e('0x2e')];_0x175457[_0x093e('0x35')]=qs[_0x093e('0x36')](_0x4c6b0a['query'][_0x093e('0x36')]);_0x175457[_0x093e('0x37')]=qs[_0x093e('0x31')](_['pick'](_0x4c6b0a[_0x093e('0x30')],_0x1490e5[_0x093e('0x31')]));if(_0x4c6b0a[_0x093e('0x30')][_0x093e('0x39')]){_0x175457[_0x093e('0x37')]=_[_0x093e('0x3b')](_0x175457[_0x093e('0x37')],{'$or':_[_0x093e('0x29')](_0x175457[_0x093e('0x33')],function(_0x31bc09){var _0x5b0940={};_0x5b0940[_0x31bc09]={'$like':'%'+_0x4c6b0a[_0x093e('0x30')][_0x093e('0x39')]+'%'};return _0x5b0940;})});}_0x175457=_['merge']({},_0x175457,_0x4c6b0a[_0x093e('0x3c')]);return _0x39bf9d[_0x093e('0x46')](_0x175457);}})[_0x093e('0x22')](function(_0x5f0ccd){if(_0x5f0ccd){_0x5cd040=_0x5f0ccd[_0x093e('0x34')];if(!_0x4c6b0a['query'][_0x093e('0x4a')]('nolimit')){_0x175457['limit']=qs[_0x093e('0x1a')](_0x4c6b0a[_0x093e('0x30')]['limit']);_0x175457[_0x093e('0x19')]=qs[_0x093e('0x19')](_0x4c6b0a[_0x093e('0x30')]['offset']);}return _0x39bf9d['getConfigurations'](_0x175457);}})['then'](function(_0x61c64f){if(_0x61c64f){return _0x61c64f?{'count':_0x5cd040,'rows':_0x61c64f}:null;}})[_0x093e('0x22')](respondWithResult(_0x17b309,null))[_0x093e('0x40')](handleError(_0x17b309,null));};exports[_0x093e('0x4b')]=function(_0x386c7a,_0x226af3,_0x5e6ebb){if(_0x386c7a[_0x093e('0x44')]['id']){delete _0x386c7a[_0x093e('0x44')]['id'];}return db[_0x093e('0x2a')]['findOne']({'where':{'id':_0x386c7a[_0x093e('0x41')]['id']}})[_0x093e('0x22')](handleEntityNotFound(_0x226af3,null))[_0x093e('0x22')](function(_0x459ab5){if(_0x459ab5){_0x386c7a['body'][_0x093e('0x4c')]=_0x459ab5['id'];_0x386c7a[_0x093e('0x44')][_0x093e('0x4d')]=integrations[_0x093e('0x4e')](_0x386c7a[_0x093e('0x44')][_0x093e('0x4f')],_0x386c7a['body'][_0x093e('0x2d')]);_0x386c7a[_0x093e('0x44')]['Descriptions']=integrations['getDescriptions'](_0x386c7a['body'][_0x093e('0x4f')],_0x386c7a[_0x093e('0x44')][_0x093e('0x2d')]);return db['DeskConfiguration'][_0x093e('0x43')](_0x386c7a[_0x093e('0x44')],{'include':[{'model':db[_0x093e('0x50')],'as':_0x093e('0x4d')},{'model':db[_0x093e('0x50')],'as':'Descriptions'}]});}return null;})[_0x093e('0x22')](respondWithResult(_0x226af3,null))[_0x093e('0x40')](handleError(_0x226af3,null));};exports[_0x093e('0x51')]=function(_0x2dcfb2,_0x364dd1,_0x5d2938){var _0x408003=[{'name':_0x093e('0x52'),'label':_0x093e('0x52'),'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 _0x4772fe='';return db[_0x093e('0x2a')]['findOne']({'where':{'id':_0x2dcfb2[_0x093e('0x41')]['id']},'attributes':['id','remoteUri',_0x093e('0x53'),_0x093e('0x54'),'password',_0x093e('0x55'),_0x093e('0x56'),'token',_0x093e('0x57')]})[_0x093e('0x22')](handleEntityNotFound(_0x364dd1,null))['then'](function(_0x445911){if(_0x445911){_0x4772fe=_0x445911[_0x093e('0x58')];var _0x2288ac=_0x4772fe['slice'](-0x1);if(_0x2288ac==='/'){_0x4772fe=_0x4772fe['substring'](0x0,_0x4772fe['lastIndexOf'](_0x2288ac));}var _0x8ad55={'method':_0x093e('0x59'),'uri':util[_0x093e('0x5a')]('%s/custom_fields',_0x4772fe),'headers':{'Content-Type':'application/json','Accept':_0x093e('0x5b')},'json':!![]};if(_0x445911['authType']==='basic'){_0x8ad55[_0x093e('0x5c')][_0x093e('0x5d')]=util[_0x093e('0x5a')](_0x093e('0x5e'),new Buffer(util[_0x093e('0x5a')](_0x093e('0x5f'),_0x445911[_0x093e('0x54')],_0x445911['password']))[_0x093e('0x60')]('base64'));}return rp(_0x8ad55)['then'](function(_0x1f5ce2){return _0x408003['concat'](_[_0x093e('0x29')](_0x1f5ce2['_embedded']['entries'],function(_0x5f5761){return{'id':_0x5f5761[_0x093e('0x26')],'name':_0x5f5761['name'],'type':_0x5f5761['type'],'active':_0x5f5761['active'],'label':_0x5f5761[_0x093e('0x61')],'custom':!![]};}));});}})['then'](function(_0x32c56a){return{'count':_0x32c56a[_0x093e('0x34')],'rows':_0x32c56a};})[_0x093e('0x22')](respondWithResult(_0x364dd1,null))[_0x093e('0x40')](function(_0x10fa36){var _0xc13db1=_0x2dcfb2[_0x093e('0x30')][_0x093e('0x62')]?0x1f4:_0x10fa36[_0x093e('0x63')]||0x1f4;logger[_0x093e('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x093e('0x51'),_0xc13db1,JSON['stringify'](_0x10fa36));delete _0x10fa36[_0x093e('0x26')];if(_0xc13db1===0x191){_0xc13db1=0x190;}_0x364dd1[_0x093e('0x18')](_0xc13db1)[_0x093e('0x27')](_0x2dcfb2[_0x093e('0x30')]['test']?{'message':_0x093e('0x64'),'statusCode':_0x10fa36[_0x093e('0x63')]}:_0x10fa36);});}; \ No newline at end of file +var _0xdd28=['../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','error','stack','name','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','keys','find','create','body','findOne','DeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','DeskField','priority','remoteUri','authType','username','consumerKey','consumerSecret','tokenSecret','slice','substring','lastIndexOf','format','application/json','basic','headers','Basic\x20%s','%s:%s','password','toString','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x158527,_0x52c10c){var _0x432a9a=function(_0x3f7304){while(--_0x3f7304){_0x158527['push'](_0x158527['shift']());}};_0x432a9a(++_0x52c10c);}(_0xdd28,0x1ad));var _0x8dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd28[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8dd2('0x0'));var rimraf=require(_0x8dd2('0x1'));var zipdir=require(_0x8dd2('0x2'));var jsonpatch=require(_0x8dd2('0x3'));var rp=require('request-promise');var moment=require(_0x8dd2('0x4'));var BPromise=require(_0x8dd2('0x5'));var Mustache=require(_0x8dd2('0x6'));var util=require(_0x8dd2('0x7'));var path=require(_0x8dd2('0x8'));var sox=require(_0x8dd2('0x9'));var csv=require(_0x8dd2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8dd2('0xb'));var _=require(_0x8dd2('0xc'));var squel=require(_0x8dd2('0xd'));var crypto=require('crypto');var jsforce=require(_0x8dd2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8dd2('0xa'));var querystring=require('querystring');var Papa=require(_0x8dd2('0xf'));var Redis=require(_0x8dd2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8dd2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8dd2('0x12'));var logger=require(_0x8dd2('0x13'))(_0x8dd2('0x14'));var utils=require(_0x8dd2('0x15'));var config=require(_0x8dd2('0x16'));var licenseUtil=require(_0x8dd2('0x17'));var db=require(_0x8dd2('0x18'))['db'];var integrations=require(_0x8dd2('0x19'));function respondWithStatusCode(_0x453e63,_0x4d9664){_0x4d9664=_0x4d9664||0xcc;return function(_0x2004fd){if(_0x2004fd){return _0x453e63[_0x8dd2('0x1a')](_0x4d9664);}return _0x453e63[_0x8dd2('0x1b')](_0x4d9664)[_0x8dd2('0x1c')]();};}function respondWithResult(_0x4c0fbc,_0xe5cbb7){_0xe5cbb7=_0xe5cbb7||0xc8;return function(_0x116463){if(_0x116463){return _0x4c0fbc[_0x8dd2('0x1b')](_0xe5cbb7)['json'](_0x116463);}};}function respondWithFilteredResult(_0x3d1fc3,_0x20533e){return function(_0xb50e8d){if(_0xb50e8d){var _0x2122e8=typeof _0x20533e['offset']===_0x8dd2('0x1d')&&typeof _0x20533e[_0x8dd2('0x1e')]===_0x8dd2('0x1d');var _0x17d38f=_0xb50e8d[_0x8dd2('0x1f')];var _0x313ae8=_0x2122e8?0x0:_0x20533e['offset'];var _0x37711f=_0x2122e8?_0xb50e8d[_0x8dd2('0x1f')]:_0x20533e[_0x8dd2('0x20')]+_0x20533e[_0x8dd2('0x1e')];var _0x1ebd9d;if(_0x37711f>=_0x17d38f){_0x37711f=_0x17d38f;_0x1ebd9d=0xc8;}else{_0x1ebd9d=0xce;}_0x3d1fc3['status'](_0x1ebd9d);return _0x3d1fc3[_0x8dd2('0x21')](_0x8dd2('0x22'),_0x313ae8+'-'+_0x37711f+'/'+_0x17d38f)['json'](_0xb50e8d);}return null;};}function patchUpdates(_0x1e397a){return function(_0x4ea913){try{jsonpatch[_0x8dd2('0x23')](_0x4ea913,_0x1e397a,!![]);}catch(_0x23cd68){return BPromise['reject'](_0x23cd68);}return _0x4ea913[_0x8dd2('0x24')]();};}function saveUpdates(_0x120256,_0x11eb5d){return function(_0x5b2cb8){if(_0x5b2cb8){return _0x5b2cb8[_0x8dd2('0x25')](_0x120256)['then'](function(_0x32ccca){return _0x32ccca;});}return null;};}function removeEntity(_0x3ab7d5,_0x5a75ad){return function(_0x5a5326){if(_0x5a5326){return _0x5a5326[_0x8dd2('0x26')]()['then'](function(){_0x3ab7d5[_0x8dd2('0x1b')](0xcc)[_0x8dd2('0x1c')]();});}};}function handleEntityNotFound(_0x276b9a,_0x1e1757){return function(_0x5aefd1){if(!_0x5aefd1){_0x276b9a[_0x8dd2('0x1a')](0x194);}return _0x5aefd1;};}function handleError(_0x15637c,_0x4cd256){_0x4cd256=_0x4cd256||0x1f4;return function(_0x4e35e5){logger[_0x8dd2('0x27')](_0x4e35e5[_0x8dd2('0x28')]);if(_0x4e35e5[_0x8dd2('0x29')]){delete _0x4e35e5['name'];}_0x15637c[_0x8dd2('0x1b')](_0x4cd256)['send'](_0x4e35e5);};}exports[_0x8dd2('0x2a')]=function(_0x3dd953,_0x4bbcd6){var _0x406d34={},_0x2c7743={},_0x15b6f3={'count':0x0,'rows':[]};var _0x245817=_[_0x8dd2('0x2b')](db[_0x8dd2('0x2c')][_0x8dd2('0x2d')],function(_0x319808){return{'name':_0x319808[_0x8dd2('0x2e')],'type':_0x319808[_0x8dd2('0x2f')]['key']};});_0x2c7743[_0x8dd2('0x30')]=_['map'](_0x245817,_0x8dd2('0x29'));_0x2c7743['query']=_['keys'](_0x3dd953[_0x8dd2('0x31')]);_0x2c7743[_0x8dd2('0x32')]=_[_0x8dd2('0x33')](_0x2c7743[_0x8dd2('0x30')],_0x2c7743['query']);_0x406d34[_0x8dd2('0x34')]=_[_0x8dd2('0x33')](_0x2c7743[_0x8dd2('0x30')],qs[_0x8dd2('0x35')](_0x3dd953[_0x8dd2('0x31')][_0x8dd2('0x35')]));_0x406d34[_0x8dd2('0x34')]=_0x406d34[_0x8dd2('0x34')][_0x8dd2('0x36')]?_0x406d34[_0x8dd2('0x34')]:_0x2c7743['model'];if(!_0x3dd953['query'][_0x8dd2('0x37')](_0x8dd2('0x38'))){_0x406d34['limit']=qs['limit'](_0x3dd953[_0x8dd2('0x31')][_0x8dd2('0x1e')]);_0x406d34[_0x8dd2('0x20')]=qs[_0x8dd2('0x20')](_0x3dd953['query'][_0x8dd2('0x20')]);}_0x406d34[_0x8dd2('0x39')]=qs[_0x8dd2('0x3a')](_0x3dd953[_0x8dd2('0x31')][_0x8dd2('0x3a')]);_0x406d34[_0x8dd2('0x3b')]=qs[_0x8dd2('0x32')](_[_0x8dd2('0x3c')](_0x3dd953['query'],_0x2c7743[_0x8dd2('0x32')]),_0x245817);if(_0x3dd953['query'][_0x8dd2('0x3d')]){_0x406d34[_0x8dd2('0x3b')]=_[_0x8dd2('0x3e')](_0x406d34[_0x8dd2('0x3b')],{'$or':_[_0x8dd2('0x2b')](_0x245817,function(_0x36af5a){if(_0x36af5a[_0x8dd2('0x2f')]!==_0x8dd2('0x3f')){var _0xb02901={};_0xb02901[_0x36af5a[_0x8dd2('0x29')]]={'$like':'%'+_0x3dd953[_0x8dd2('0x31')][_0x8dd2('0x3d')]+'%'};return _0xb02901;}})});}_0x406d34=_[_0x8dd2('0x3e')]({},_0x406d34,_0x3dd953[_0x8dd2('0x40')]);var _0x227ae0={'where':_0x406d34[_0x8dd2('0x3b')]};return db[_0x8dd2('0x2c')][_0x8dd2('0x1f')](_0x227ae0)[_0x8dd2('0x41')](function(_0xe8102b){_0x15b6f3[_0x8dd2('0x1f')]=_0xe8102b;if(_0x3dd953[_0x8dd2('0x31')][_0x8dd2('0x42')]){_0x406d34[_0x8dd2('0x43')]=[{'all':!![]}];}return db[_0x8dd2('0x2c')][_0x8dd2('0x44')](_0x406d34);})['then'](function(_0x72128c){_0x15b6f3['rows']=_0x72128c;return _0x15b6f3;})[_0x8dd2('0x41')](respondWithFilteredResult(_0x4bbcd6,_0x406d34))[_0x8dd2('0x45')](handleError(_0x4bbcd6,null));};exports[_0x8dd2('0x46')]=function(_0x169be6,_0x2e5086){var _0x33f1e5={'raw':![],'where':{'id':_0x169be6[_0x8dd2('0x47')]['id']}},_0x15f391={};_0x15f391['model']=_[_0x8dd2('0x48')](db[_0x8dd2('0x2c')]['rawAttributes']);_0x15f391[_0x8dd2('0x31')]=_[_0x8dd2('0x48')](_0x169be6['query']);_0x15f391[_0x8dd2('0x32')]=_[_0x8dd2('0x33')](_0x15f391[_0x8dd2('0x30')],_0x15f391[_0x8dd2('0x31')]);_0x33f1e5['attributes']=_[_0x8dd2('0x33')](_0x15f391[_0x8dd2('0x30')],qs[_0x8dd2('0x35')](_0x169be6[_0x8dd2('0x31')][_0x8dd2('0x35')]));_0x33f1e5[_0x8dd2('0x34')]=_0x33f1e5[_0x8dd2('0x34')][_0x8dd2('0x36')]?_0x33f1e5[_0x8dd2('0x34')]:_0x15f391[_0x8dd2('0x30')];if(_0x169be6[_0x8dd2('0x31')]['includeAll']){_0x33f1e5[_0x8dd2('0x43')]=[{'all':!![]}];}_0x33f1e5=_[_0x8dd2('0x3e')]({},_0x33f1e5,_0x169be6[_0x8dd2('0x40')]);return db[_0x8dd2('0x2c')][_0x8dd2('0x49')](_0x33f1e5)[_0x8dd2('0x41')](handleEntityNotFound(_0x2e5086,null))[_0x8dd2('0x41')](respondWithResult(_0x2e5086,null))['catch'](handleError(_0x2e5086,null));};exports[_0x8dd2('0x4a')]=function(_0x3102ec,_0x1b2613){return db[_0x8dd2('0x2c')]['create'](_0x3102ec['body'],{})[_0x8dd2('0x41')](respondWithResult(_0x1b2613,0xc9))[_0x8dd2('0x45')](handleError(_0x1b2613,null));};exports[_0x8dd2('0x25')]=function(_0x2ce52f,_0x2c124c){if(_0x2ce52f[_0x8dd2('0x4b')]['id']){delete _0x2ce52f['body']['id'];}return db['DeskAccount']['find']({'where':{'id':_0x2ce52f['params']['id']}})[_0x8dd2('0x41')](handleEntityNotFound(_0x2c124c,null))[_0x8dd2('0x41')](saveUpdates(_0x2ce52f['body'],null))[_0x8dd2('0x41')](respondWithResult(_0x2c124c,null))['catch'](handleError(_0x2c124c,null));};exports[_0x8dd2('0x26')]=function(_0x202820,_0x374e27){return db[_0x8dd2('0x2c')][_0x8dd2('0x49')]({'where':{'id':_0x202820[_0x8dd2('0x47')]['id']}})[_0x8dd2('0x41')](handleEntityNotFound(_0x374e27,null))[_0x8dd2('0x41')](removeEntity(_0x374e27,null))['catch'](handleError(_0x374e27,null));};exports['getConfigurations']=function(_0x37fec7,_0x139f48,_0x499efa){var _0x13d38b={};var _0x4c868f={};var _0x3a03bb;var _0x4ae40f;return db[_0x8dd2('0x2c')][_0x8dd2('0x4c')]({'where':{'id':_0x37fec7[_0x8dd2('0x47')]['id']}})[_0x8dd2('0x41')](handleEntityNotFound(_0x139f48,null))[_0x8dd2('0x41')](function(_0x25c733){if(_0x25c733){_0x3a03bb=_0x25c733;_0x4c868f[_0x8dd2('0x30')]=_[_0x8dd2('0x48')](db[_0x8dd2('0x4d')][_0x8dd2('0x2d')]);_0x4c868f[_0x8dd2('0x31')]=_[_0x8dd2('0x48')](_0x37fec7['query']);_0x4c868f[_0x8dd2('0x32')]=_[_0x8dd2('0x33')](_0x4c868f['model'],_0x4c868f[_0x8dd2('0x31')]);_0x13d38b[_0x8dd2('0x34')]=_[_0x8dd2('0x33')](_0x4c868f[_0x8dd2('0x30')],qs[_0x8dd2('0x35')](_0x37fec7[_0x8dd2('0x31')][_0x8dd2('0x35')]));_0x13d38b[_0x8dd2('0x34')]=_0x13d38b[_0x8dd2('0x34')][_0x8dd2('0x36')]?_0x13d38b[_0x8dd2('0x34')]:_0x4c868f[_0x8dd2('0x30')];_0x13d38b[_0x8dd2('0x39')]=qs['sort'](_0x37fec7[_0x8dd2('0x31')][_0x8dd2('0x3a')]);_0x13d38b[_0x8dd2('0x3b')]=qs[_0x8dd2('0x32')](_[_0x8dd2('0x3c')](_0x37fec7[_0x8dd2('0x31')],_0x4c868f[_0x8dd2('0x32')]));if(_0x37fec7[_0x8dd2('0x31')]['filter']){_0x13d38b[_0x8dd2('0x3b')]=_[_0x8dd2('0x3e')](_0x13d38b[_0x8dd2('0x3b')],{'$or':_[_0x8dd2('0x2b')](_0x13d38b[_0x8dd2('0x34')],function(_0x23dc15){var _0x58ca03={};_0x58ca03[_0x23dc15]={'$like':'%'+_0x37fec7['query'][_0x8dd2('0x3d')]+'%'};return _0x58ca03;})});}_0x13d38b=_[_0x8dd2('0x3e')]({},_0x13d38b,_0x37fec7['options']);return _0x3a03bb[_0x8dd2('0x4e')](_0x13d38b);}})[_0x8dd2('0x41')](function(_0x3971e5){if(_0x3971e5){_0x4ae40f=_0x3971e5[_0x8dd2('0x36')];if(!_0x37fec7['query'][_0x8dd2('0x37')](_0x8dd2('0x38'))){_0x13d38b['limit']=qs[_0x8dd2('0x1e')](_0x37fec7['query'][_0x8dd2('0x1e')]);_0x13d38b[_0x8dd2('0x20')]=qs[_0x8dd2('0x20')](_0x37fec7['query'][_0x8dd2('0x20')]);}return _0x3a03bb[_0x8dd2('0x4e')](_0x13d38b);}})[_0x8dd2('0x41')](function(_0x3833bf){if(_0x3833bf){return _0x3833bf?{'count':_0x4ae40f,'rows':_0x3833bf}:null;}})['then'](respondWithResult(_0x139f48,null))[_0x8dd2('0x45')](handleError(_0x139f48,null));};exports[_0x8dd2('0x4f')]=function(_0x5618d1,_0x1ee5b1,_0x14250d){if(_0x5618d1[_0x8dd2('0x4b')]['id']){delete _0x5618d1[_0x8dd2('0x4b')]['id'];}return db['DeskAccount'][_0x8dd2('0x4c')]({'where':{'id':_0x5618d1[_0x8dd2('0x47')]['id']}})[_0x8dd2('0x41')](handleEntityNotFound(_0x1ee5b1,null))['then'](function(_0x17eef1){if(_0x17eef1){_0x5618d1[_0x8dd2('0x4b')][_0x8dd2('0x50')]=_0x17eef1['id'];_0x5618d1[_0x8dd2('0x4b')][_0x8dd2('0x51')]=integrations[_0x8dd2('0x52')](_0x5618d1['body']['channel'],_0x5618d1['body'][_0x8dd2('0x2f')]);_0x5618d1[_0x8dd2('0x4b')]['Descriptions']=integrations[_0x8dd2('0x53')](_0x5618d1[_0x8dd2('0x4b')]['channel'],_0x5618d1[_0x8dd2('0x4b')][_0x8dd2('0x2f')]);return db['DeskConfiguration'][_0x8dd2('0x4a')](_0x5618d1[_0x8dd2('0x4b')],{'include':[{'model':db[_0x8dd2('0x54')],'as':_0x8dd2('0x51')},{'model':db[_0x8dd2('0x54')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1ee5b1,null))[_0x8dd2('0x45')](handleError(_0x1ee5b1,null));};exports['getFields']=function(_0x2728c9,_0x3a9592,_0x967367){var _0x451901=[{'name':'priority','label':_0x8dd2('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 _0xf0acd8='';return db['DeskAccount'][_0x8dd2('0x4c')]({'where':{'id':_0x2728c9[_0x8dd2('0x47')]['id']},'attributes':['id',_0x8dd2('0x56'),_0x8dd2('0x57'),_0x8dd2('0x58'),'password',_0x8dd2('0x59'),_0x8dd2('0x5a'),'token',_0x8dd2('0x5b')]})[_0x8dd2('0x41')](handleEntityNotFound(_0x3a9592,null))['then'](function(_0x3290b8){if(_0x3290b8){_0xf0acd8=_0x3290b8['remoteUri'];var _0x3168e1=_0xf0acd8[_0x8dd2('0x5c')](-0x1);if(_0x3168e1==='/'){_0xf0acd8=_0xf0acd8[_0x8dd2('0x5d')](0x0,_0xf0acd8[_0x8dd2('0x5e')](_0x3168e1));}var _0x1e1350={'method':'GET','uri':util[_0x8dd2('0x5f')]('%s/custom_fields',_0xf0acd8),'headers':{'Content-Type':_0x8dd2('0x60'),'Accept':_0x8dd2('0x60')},'json':!![]};if(_0x3290b8[_0x8dd2('0x57')]===_0x8dd2('0x61')){_0x1e1350[_0x8dd2('0x62')]['Authorization']=util[_0x8dd2('0x5f')](_0x8dd2('0x63'),new Buffer(util['format'](_0x8dd2('0x64'),_0x3290b8[_0x8dd2('0x58')],_0x3290b8[_0x8dd2('0x65')]))[_0x8dd2('0x66')](_0x8dd2('0x67')));}return rp(_0x1e1350)[_0x8dd2('0x41')](function(_0x393491){return _0x451901['concat'](_[_0x8dd2('0x2b')](_0x393491[_0x8dd2('0x68')][_0x8dd2('0x69')],function(_0x37b2bd){return{'id':_0x37b2bd['name'],'name':_0x37b2bd['name'],'type':_0x37b2bd['type'],'active':_0x37b2bd[_0x8dd2('0x6a')],'label':_0x37b2bd[_0x8dd2('0x6b')],'custom':!![]};}));});}})[_0x8dd2('0x41')](function(_0x56d829){return{'count':_0x56d829[_0x8dd2('0x36')],'rows':_0x56d829};})['then'](respondWithResult(_0x3a9592,null))[_0x8dd2('0x45')](function(_0x31d171){var _0x17aa0c=_0x2728c9[_0x8dd2('0x31')][_0x8dd2('0x6c')]?0x1f4:_0x31d171[_0x8dd2('0x6d')]||0x1f4;logger[_0x8dd2('0x27')](_0x8dd2('0x6e'),'getFields',_0x17aa0c,JSON['stringify'](_0x31d171));delete _0x31d171[_0x8dd2('0x29')];if(_0x17aa0c===0x191){_0x17aa0c=0x190;}_0x3a9592[_0x8dd2('0x1b')](_0x17aa0c)[_0x8dd2('0x6f')](_0x2728c9[_0x8dd2('0x31')]['test']?{'message':_0x8dd2('0x70'),'statusCode':_0x31d171[_0x8dd2('0x6d')]}:_0x31d171);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 5d0f210..9bf84df 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 _0x7440=['DeskAccount','lodash','util','api','moment','request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2f0418,_0x505390){var _0x9cbea4=function(_0x2e5cf7){while(--_0x2e5cf7){_0x2f0418['push'](_0x2f0418['shift']());}};_0x9cbea4(++_0x505390);}(_0x7440,0xa6));var _0x0744=function(_0x21a70b,_0x37ea31){_0x21a70b=_0x21a70b-0x0;var _0x3a2515=_0x7440[_0x21a70b];return _0x3a2515;};'use strict';var _=require(_0x0744('0x0'));var util=require(_0x0744('0x1'));var logger=require('../../config/logger')(_0x0744('0x2'));var moment=require(_0x0744('0x3'));var BPromise=require('bluebird');var rp=require(_0x0744('0x4'));var fs=require('fs');var path=require(_0x0744('0x5'));var rimraf=require(_0x0744('0x6'));var config=require('../../config/environment');var attributes=require(_0x0744('0x7'));var integrations=require(_0x0744('0x8'));module[_0x0744('0x9')]=function(_0x21eb52,_0x590ce3){return _0x21eb52['define'](_0x0744('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d00=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define','DeskAccount','int_desk_accounts','lodash'];(function(_0x33c4d3,_0x1ab361){var _0x18197e=function(_0x943b20){while(--_0x943b20){_0x33c4d3['push'](_0x33c4d3['shift']());}};_0x18197e(++_0x1ab361);}(_0x2d00,0x15b));var _0x02d0=function(_0x566760,_0x1f7104){_0x566760=_0x566760-0x0;var _0x30ca6d=_0x2d00[_0x566760];return _0x30ca6d;};'use strict';var _=require(_0x02d0('0x0'));var util=require(_0x02d0('0x1'));var logger=require(_0x02d0('0x2'))('api');var moment=require(_0x02d0('0x3'));var BPromise=require(_0x02d0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x02d0('0x5'));var rimraf=require(_0x02d0('0x6'));var config=require(_0x02d0('0x7'));var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x02d0('0x8')]=function(_0x37fa16,_0x1eb34e){return _0x37fa16[_0x02d0('0x9')](_0x02d0('0xa'),attributes,{'tableName':_0x02d0('0xb'),'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 fa7352e..84f0690 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 _0xa956=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDeskAccount','findAll','options','raw','where','include','map','model','attributes','debug','stringify','ShowDeskAccount','DeskAccount','util','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa956,0x1b7));var _0x6a95=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0xa956[_0x154192];return _0x3c2792;};'use strict';var _=require('lodash');var util=require(_0x6a95('0x0'));var moment=require(_0x6a95('0x1'));var BPromise=require(_0x6a95('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a95('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a95('0x4'));var logger=require(_0x6a95('0x5'))(_0x6a95('0x6'));var config=require('../../config/environment');var jayson=require(_0x6a95('0x7'));var client=jayson[_0x6a95('0x8')][_0x6a95('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42d983,_0x112eff,_0x13c265){return new BPromise(function(_0x40126a,_0x3036f6){return client[_0x6a95('0xa')](_0x42d983,_0x13c265)[_0x6a95('0xb')](function(_0x5cb2e6){logger[_0x6a95('0xc')](_0x6a95('0xd'),_0x112eff,_0x6a95('0xe'));logger['debug'](_0x6a95('0xf'),_0x112eff,_0x6a95('0xe'),JSON['stringify'](_0x5cb2e6));if(_0x5cb2e6[_0x6a95('0x10')]){if(_0x5cb2e6[_0x6a95('0x10')][_0x6a95('0x11')]===0x1f4){logger[_0x6a95('0x10')](_0x6a95('0xd'),_0x112eff,_0x5cb2e6['error'][_0x6a95('0x12')]);return _0x3036f6(_0x5cb2e6[_0x6a95('0x10')][_0x6a95('0x12')]);}logger[_0x6a95('0x10')](_0x6a95('0xd'),_0x112eff,_0x5cb2e6[_0x6a95('0x10')][_0x6a95('0x12')]);return _0x40126a(_0x5cb2e6[_0x6a95('0x10')]['message']);}else{logger[_0x6a95('0xc')](_0x6a95('0xd'),_0x112eff,_0x6a95('0xe'));_0x40126a(_0x5cb2e6[_0x6a95('0x13')]['message']);}})[_0x6a95('0x14')](function(_0x320875){logger['error'](_0x6a95('0xd'),_0x112eff,_0x320875);_0x3036f6(_0x320875);});});}exports[_0x6a95('0x15')]=function(_0x270068){var _0x55ae9d=this;return new Promise(function(_0x19d090,_0x36b736){return db['DeskAccount'][_0x6a95('0x16')]({'raw':_0x270068[_0x6a95('0x17')]?_0x270068['options'][_0x6a95('0x18')]===undefined?!![]:![]:!![],'where':_0x270068[_0x6a95('0x17')]?_0x270068[_0x6a95('0x17')][_0x6a95('0x19')]||null:null,'attributes':_0x270068['options']?_0x270068[_0x6a95('0x17')]['attributes']||null:null,'limit':_0x270068['options']?_0x270068[_0x6a95('0x17')]['limit']||null:null,'include':_0x270068['options']?_0x270068[_0x6a95('0x17')][_0x6a95('0x1a')]?_[_0x6a95('0x1b')](_0x270068[_0x6a95('0x17')][_0x6a95('0x1a')],function(_0x530aff){return{'model':db[_0x530aff[_0x6a95('0x1c')]],'as':_0x530aff['as'],'attributes':_0x530aff[_0x6a95('0x1d')],'include':_0x530aff[_0x6a95('0x1a')]?_[_0x6a95('0x1b')](_0x530aff[_0x6a95('0x1a')],function(_0x5c4620){return{'model':db[_0x5c4620[_0x6a95('0x1c')]],'as':_0x5c4620['as'],'attributes':_0x5c4620['attributes'],'include':_0x5c4620[_0x6a95('0x1a')]?_[_0x6a95('0x1b')](_0x5c4620['include'],function(_0x5b6553){return{'model':db[_0x5b6553['model']],'as':_0x5b6553['as'],'attributes':_0x5b6553[_0x6a95('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6a95('0xb')](function(_0x16d209){logger[_0x6a95('0xc')](_0x6a95('0x15'),_0x270068);logger[_0x6a95('0x1e')](_0x6a95('0x15'),_0x270068,JSON[_0x6a95('0x1f')](_0x16d209));_0x19d090(_0x16d209);})[_0x6a95('0x14')](function(_0x5be5c8){logger[_0x6a95('0x10')](_0x6a95('0x15'),_0x5be5c8[_0x6a95('0x12')],_0x270068);_0x36b736(_0x55ae9d[_0x6a95('0x10')](0x1f4,_0x5be5c8[_0x6a95('0x12')]));});});};exports[_0x6a95('0x20')]=function(_0x38ce4e){var _0x447ab0=this;return new Promise(function(_0x56aad0,_0x1944aa){return db[_0x6a95('0x21')]['find']({'raw':_0x38ce4e[_0x6a95('0x17')]?_0x38ce4e['options'][_0x6a95('0x18')]===undefined?!![]:![]:!![],'where':_0x38ce4e[_0x6a95('0x17')]?_0x38ce4e[_0x6a95('0x17')][_0x6a95('0x19')]||null:null,'attributes':_0x38ce4e['options']?_0x38ce4e['options'][_0x6a95('0x1d')]||null:null,'include':_0x38ce4e['options']?_0x38ce4e[_0x6a95('0x17')][_0x6a95('0x1a')]?_[_0x6a95('0x1b')](_0x38ce4e[_0x6a95('0x17')][_0x6a95('0x1a')],function(_0x539631){return{'model':db[_0x539631[_0x6a95('0x1c')]],'as':_0x539631['as'],'attributes':_0x539631[_0x6a95('0x1d')],'include':_0x539631[_0x6a95('0x1a')]?_['map'](_0x539631[_0x6a95('0x1a')],function(_0x4a8bf0){return{'model':db[_0x4a8bf0['model']],'as':_0x4a8bf0['as'],'attributes':_0x4a8bf0[_0x6a95('0x1d')],'include':_0x4a8bf0[_0x6a95('0x1a')]?_[_0x6a95('0x1b')](_0x4a8bf0[_0x6a95('0x1a')],function(_0x2b69bd){return{'model':db[_0x2b69bd['model']],'as':_0x2b69bd['as'],'attributes':_0x2b69bd[_0x6a95('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6a95('0xb')](function(_0xcea949){logger[_0x6a95('0xc')]('ShowDeskAccount',_0x38ce4e);logger[_0x6a95('0x1e')]('ShowDeskAccount',_0x38ce4e,JSON[_0x6a95('0x1f')](_0xcea949));_0x56aad0(_0xcea949);})[_0x6a95('0x14')](function(_0x817819){logger['error'](_0x6a95('0x20'),_0x817819[_0x6a95('0x12')],_0x38ce4e);_0x1944aa(_0x447ab0['error'](0x1f4,_0x817819[_0x6a95('0x12')]));});});}; \ No newline at end of file +var _0x2948=['raw','options','where','attributes','limit','include','model','map','ShowDeskAccount','find','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDeskAccount','DeskAccount'];(function(_0x47e9c,_0x1b949e){var _0x242eaa=function(_0x33f27d){while(--_0x33f27d){_0x47e9c['push'](_0x47e9c['shift']());}};_0x242eaa(++_0x1b949e);}(_0x2948,0x6a));var _0x8294=function(_0x27ccea,_0x995f9b){_0x27ccea=_0x27ccea-0x0;var _0x300bb4=_0x2948[_0x27ccea];return _0x300bb4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8294('0x0'));var BPromise=require('bluebird');var rs=require(_0x8294('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8294('0x2'))['db'];var utils=require(_0x8294('0x3'));var logger=require(_0x8294('0x4'))(_0x8294('0x5'));var config=require('../../config/environment');var jayson=require(_0x8294('0x6'));var client=jayson['client'][_0x8294('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x343956,_0x3edf7b,_0x3b652b){return new BPromise(function(_0x54e194,_0x3b588c){return client[_0x8294('0x8')](_0x343956,_0x3b652b)[_0x8294('0x9')](function(_0x526a98){logger[_0x8294('0xa')](_0x8294('0xb'),_0x3edf7b,_0x8294('0xc'));logger[_0x8294('0xd')](_0x8294('0xe'),_0x3edf7b,_0x8294('0xc'),JSON[_0x8294('0xf')](_0x526a98));if(_0x526a98['error']){if(_0x526a98[_0x8294('0x10')][_0x8294('0x11')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x3edf7b,_0x526a98['error'][_0x8294('0x12')]);return _0x3b588c(_0x526a98[_0x8294('0x10')][_0x8294('0x12')]);}logger[_0x8294('0x10')]('DeskAccount,\x20%s,\x20%s',_0x3edf7b,_0x526a98[_0x8294('0x10')][_0x8294('0x12')]);return _0x54e194(_0x526a98['error']['message']);}else{logger['info'](_0x8294('0xb'),_0x3edf7b,_0x8294('0xc'));_0x54e194(_0x526a98['result'][_0x8294('0x12')]);}})[_0x8294('0x13')](function(_0x3ac10d){logger[_0x8294('0x10')]('DeskAccount,\x20%s,\x20%s',_0x3edf7b,_0x3ac10d);_0x3b588c(_0x3ac10d);});});}exports[_0x8294('0x14')]=function(_0x13b19a){var _0x50ae90=this;return new Promise(function(_0x566dd1,_0xa218bc){return db[_0x8294('0x15')]['findAll']({'raw':_0x13b19a['options']?_0x13b19a['options'][_0x8294('0x16')]===undefined?!![]:![]:!![],'where':_0x13b19a['options']?_0x13b19a[_0x8294('0x17')][_0x8294('0x18')]||null:null,'attributes':_0x13b19a[_0x8294('0x17')]?_0x13b19a[_0x8294('0x17')][_0x8294('0x19')]||null:null,'limit':_0x13b19a[_0x8294('0x17')]?_0x13b19a[_0x8294('0x17')][_0x8294('0x1a')]||null:null,'include':_0x13b19a[_0x8294('0x17')]?_0x13b19a[_0x8294('0x17')][_0x8294('0x1b')]?_['map'](_0x13b19a[_0x8294('0x17')][_0x8294('0x1b')],function(_0x429cb1){return{'model':db[_0x429cb1[_0x8294('0x1c')]],'as':_0x429cb1['as'],'attributes':_0x429cb1[_0x8294('0x19')],'include':_0x429cb1[_0x8294('0x1b')]?_[_0x8294('0x1d')](_0x429cb1[_0x8294('0x1b')],function(_0x823ed8){return{'model':db[_0x823ed8[_0x8294('0x1c')]],'as':_0x823ed8['as'],'attributes':_0x823ed8['attributes'],'include':_0x823ed8[_0x8294('0x1b')]?_[_0x8294('0x1d')](_0x823ed8[_0x8294('0x1b')],function(_0x461022){return{'model':db[_0x461022[_0x8294('0x1c')]],'as':_0x461022['as'],'attributes':_0x461022[_0x8294('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8294('0x9')](function(_0x3055c3){logger['info']('GetDeskAccount',_0x13b19a);logger[_0x8294('0xd')]('GetDeskAccount',_0x13b19a,JSON[_0x8294('0xf')](_0x3055c3));_0x566dd1(_0x3055c3);})[_0x8294('0x13')](function(_0x36b083){logger[_0x8294('0x10')](_0x8294('0x14'),_0x36b083[_0x8294('0x12')],_0x13b19a);_0xa218bc(_0x50ae90[_0x8294('0x10')](0x1f4,_0x36b083[_0x8294('0x12')]));});});};exports[_0x8294('0x1e')]=function(_0x3770d4){var _0x9f0a54=this;return new Promise(function(_0x363018,_0x487104){return db[_0x8294('0x15')][_0x8294('0x1f')]({'raw':_0x3770d4[_0x8294('0x17')]?_0x3770d4[_0x8294('0x17')][_0x8294('0x16')]===undefined?!![]:![]:!![],'where':_0x3770d4[_0x8294('0x17')]?_0x3770d4['options'][_0x8294('0x18')]||null:null,'attributes':_0x3770d4[_0x8294('0x17')]?_0x3770d4['options'][_0x8294('0x19')]||null:null,'include':_0x3770d4[_0x8294('0x17')]?_0x3770d4['options'][_0x8294('0x1b')]?_[_0x8294('0x1d')](_0x3770d4['options'][_0x8294('0x1b')],function(_0x23805b){return{'model':db[_0x23805b[_0x8294('0x1c')]],'as':_0x23805b['as'],'attributes':_0x23805b[_0x8294('0x19')],'include':_0x23805b[_0x8294('0x1b')]?_['map'](_0x23805b[_0x8294('0x1b')],function(_0x485779){return{'model':db[_0x485779[_0x8294('0x1c')]],'as':_0x485779['as'],'attributes':_0x485779[_0x8294('0x19')],'include':_0x485779[_0x8294('0x1b')]?_[_0x8294('0x1d')](_0x485779[_0x8294('0x1b')],function(_0x226648){return{'model':db[_0x226648[_0x8294('0x1c')]],'as':_0x226648['as'],'attributes':_0x226648['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xf418e0){logger[_0x8294('0xa')](_0x8294('0x1e'),_0x3770d4);logger[_0x8294('0xd')](_0x8294('0x1e'),_0x3770d4,JSON[_0x8294('0xf')](_0xf418e0));_0x363018(_0xf418e0);})[_0x8294('0x13')](function(_0x3d8ad9){logger[_0x8294('0x10')](_0x8294('0x1e'),_0x3d8ad9['message'],_0x3770d4);_0x487104(_0x9f0a54[_0x8294('0x10')](0x1f4,_0x3d8ad9[_0x8294('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 4cde882..5ef146a 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x47f32e,_0x1abc5b){var _0x1eecaa=function(_0x416d94){while(--_0x416d94){_0x47f32e['push'](_0x47f32e['shift']());}};_0x1eecaa(++_0x1abc5b);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x3158a5,_0x5c32fd){var _0x15a244=function(_0x31197e){while(--_0x31197e){_0x3158a5['push'](_0x3158a5['shift']());}};_0x15a244(++_0x5c32fd);}(_0xedd9,0xfc));var _0x9edd=function(_0xe1f27b,_0x4b5b1b){_0xe1f27b=_0xe1f27b-0x0;var _0x420910=_0xedd9[_0xe1f27b];return _0x420910;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 536baa2..52a18bb 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 _0xd379=['sequelize','exports','STRING'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xd379,0x11a));var _0x9d37=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd379[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9d37('0x0'));module[_0x9d37('0x1')]={'name':{'type':Sequelize[_0x9d37('0x2')]},'description':{'type':Sequelize[_0x9d37('0x2')]}}; \ No newline at end of file +var _0xe670=['sequelize','exports','STRING'];(function(_0x35749e,_0x46f55b){var _0x49e742=function(_0x4692ac){while(--_0x4692ac){_0x35749e['push'](_0x35749e['shift']());}};_0x49e742(++_0x46f55b);}(_0xe670,0xf6));var _0x0e67=function(_0x114d1f,_0x55548e){_0x114d1f=_0x114d1f-0x0;var _0x5b91d4=_0xe670[_0x114d1f];return _0x5b91d4;};'use strict';var Sequelize=require(_0x0e67('0x0'));module[_0x0e67('0x1')]={'name':{'type':Sequelize[_0x0e67('0x2')]},'description':{'type':Sequelize[_0x0e67('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 1956267..2552b33 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 _0xb85e=['includeAll','findAll','rows','catch','show','params','include','find','create','body','getFields','findOne','DeskField','getSubjects','pick','nolimit','getDescriptions','getTags','Tag','setTags','ids','eml-format','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','destroy','sendStatus','error','stack','name','DeskConfiguration','rawAttributes','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','merge','where','VIRTUAL','filter','options','then'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xb85e,0x108));var _0xeb85=function(_0xc43928,_0x3890ac){_0xc43928=_0xc43928-0x0;var _0x529606=_0xb85e[_0xc43928];return _0x529606;};'use strict';var emlformat=require(_0xeb85('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeb85('0x1'));var BPromise=require(_0xeb85('0x2'));var Mustache=require(_0xeb85('0x3'));var util=require(_0xeb85('0x4'));var path=require(_0xeb85('0x5'));var sox=require(_0xeb85('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb85('0x7'));var squel=require(_0xeb85('0x8'));var crypto=require('crypto');var jsforce=require(_0xeb85('0x9'));var deskjs=require(_0xeb85('0xa'));var toCsv=require('to-csv');var querystring=require(_0xeb85('0xb'));var Papa=require(_0xeb85('0xc'));var Redis=require(_0xeb85('0xd'));var authService=require(_0xeb85('0xe'));var qs=require(_0xeb85('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb85('0x10'));var logger=require(_0xeb85('0x11'))('api');var utils=require(_0xeb85('0x12'));var config=require(_0xeb85('0x13'));var licenseUtil=require(_0xeb85('0x14'));var db=require(_0xeb85('0x15'))['db'];function respondWithStatusCode(_0xd7b46b,_0x1b69e0){_0x1b69e0=_0x1b69e0||0xcc;return function(_0xac3986){if(_0xac3986){return _0xd7b46b['sendStatus'](_0x1b69e0);}return _0xd7b46b[_0xeb85('0x16')](_0x1b69e0)[_0xeb85('0x17')]();};}function respondWithResult(_0x55f117,_0x1c3e83){_0x1c3e83=_0x1c3e83||0xc8;return function(_0x13dd8c){if(_0x13dd8c){return _0x55f117[_0xeb85('0x16')](_0x1c3e83)[_0xeb85('0x18')](_0x13dd8c);}};}function respondWithFilteredResult(_0xaecc9c,_0x4f7007){return function(_0x22f98b){if(_0x22f98b){var _0x5ce891=typeof _0x4f7007['offset']===_0xeb85('0x19')&&typeof _0x4f7007[_0xeb85('0x1a')]===_0xeb85('0x19');var _0x2206f1=_0x22f98b[_0xeb85('0x1b')];var _0x2bb32c=_0x5ce891?0x0:_0x4f7007['offset'];var _0x43a768=_0x5ce891?_0x22f98b[_0xeb85('0x1b')]:_0x4f7007[_0xeb85('0x1c')]+_0x4f7007[_0xeb85('0x1a')];var _0x5c6032;if(_0x43a768>=_0x2206f1){_0x43a768=_0x2206f1;_0x5c6032=0xc8;}else{_0x5c6032=0xce;}_0xaecc9c[_0xeb85('0x16')](_0x5c6032);return _0xaecc9c['set'](_0xeb85('0x1d'),_0x2bb32c+'-'+_0x43a768+'/'+_0x2206f1)['json'](_0x22f98b);}return null;};}function patchUpdates(_0x3dbe5b){return function(_0x4d6481){try{jsonpatch['apply'](_0x4d6481,_0x3dbe5b,!![]);}catch(_0x27374c){return BPromise[_0xeb85('0x1e')](_0x27374c);}return _0x4d6481[_0xeb85('0x1f')]();};}function saveUpdates(_0x5a0cbd,_0x8dee8b){return function(_0x12a978){if(_0x12a978){return _0x12a978[_0xeb85('0x20')](_0x5a0cbd)['then'](function(_0x457211){return _0x457211;});}return null;};}function removeEntity(_0x11c4a5,_0x1a6b17){return function(_0x2bc75d){if(_0x2bc75d){return _0x2bc75d[_0xeb85('0x21')]()['then'](function(){_0x11c4a5['status'](0xcc)[_0xeb85('0x17')]();});}};}function handleEntityNotFound(_0x5a796f,_0x1cf099){return function(_0xdcd3c9){if(!_0xdcd3c9){_0x5a796f[_0xeb85('0x22')](0x194);}return _0xdcd3c9;};}function handleError(_0x23be3a,_0x527dd9){_0x527dd9=_0x527dd9||0x1f4;return function(_0x6fd35d){logger[_0xeb85('0x23')](_0x6fd35d[_0xeb85('0x24')]);if(_0x6fd35d[_0xeb85('0x25')]){delete _0x6fd35d[_0xeb85('0x25')];}_0x23be3a[_0xeb85('0x16')](_0x527dd9)['send'](_0x6fd35d);};}exports['index']=function(_0x18a594,_0x26911b){var _0x31449a={},_0x7ee92e={},_0x1f5b66={'count':0x0,'rows':[]};var _0x2d85a7=_['map'](db[_0xeb85('0x26')][_0xeb85('0x27')],function(_0x27be8a){return{'name':_0x27be8a['fieldName'],'type':_0x27be8a[_0xeb85('0x28')][_0xeb85('0x29')]};});_0x7ee92e[_0xeb85('0x2a')]=_[_0xeb85('0x2b')](_0x2d85a7,_0xeb85('0x25'));_0x7ee92e['query']=_[_0xeb85('0x2c')](_0x18a594['query']);_0x7ee92e[_0xeb85('0x2d')]=_[_0xeb85('0x2e')](_0x7ee92e[_0xeb85('0x2a')],_0x7ee92e[_0xeb85('0x2f')]);_0x31449a[_0xeb85('0x30')]=_[_0xeb85('0x2e')](_0x7ee92e['model'],qs['fields'](_0x18a594['query'][_0xeb85('0x31')]));_0x31449a[_0xeb85('0x30')]=_0x31449a[_0xeb85('0x30')][_0xeb85('0x32')]?_0x31449a['attributes']:_0x7ee92e[_0xeb85('0x2a')];if(!_0x18a594[_0xeb85('0x2f')][_0xeb85('0x33')]('nolimit')){_0x31449a[_0xeb85('0x1a')]=qs[_0xeb85('0x1a')](_0x18a594['query'][_0xeb85('0x1a')]);_0x31449a[_0xeb85('0x1c')]=qs[_0xeb85('0x1c')](_0x18a594[_0xeb85('0x2f')][_0xeb85('0x1c')]);}_0x31449a[_0xeb85('0x34')]=qs[_0xeb85('0x35')](_0x18a594[_0xeb85('0x2f')][_0xeb85('0x35')]);_0x31449a['where']=qs[_0xeb85('0x2d')](_['pick'](_0x18a594[_0xeb85('0x2f')],_0x7ee92e[_0xeb85('0x2d')]),_0x2d85a7);if(_0x18a594[_0xeb85('0x2f')]['filter']){_0x31449a['where']=_[_0xeb85('0x36')](_0x31449a[_0xeb85('0x37')],{'$or':_[_0xeb85('0x2b')](_0x2d85a7,function(_0x10049e){if(_0x10049e[_0xeb85('0x28')]!==_0xeb85('0x38')){var _0x174f1e={};_0x174f1e[_0x10049e['name']]={'$like':'%'+_0x18a594['query'][_0xeb85('0x39')]+'%'};return _0x174f1e;}})});}_0x31449a=_[_0xeb85('0x36')]({},_0x31449a,_0x18a594[_0xeb85('0x3a')]);var _0x1dd21a={'where':_0x31449a[_0xeb85('0x37')]};return db[_0xeb85('0x26')][_0xeb85('0x1b')](_0x1dd21a)[_0xeb85('0x3b')](function(_0x27081){_0x1f5b66[_0xeb85('0x1b')]=_0x27081;if(_0x18a594[_0xeb85('0x2f')][_0xeb85('0x3c')]){_0x31449a['include']=[{'all':!![]}];}return db[_0xeb85('0x26')][_0xeb85('0x3d')](_0x31449a);})[_0xeb85('0x3b')](function(_0x9f25c2){_0x1f5b66[_0xeb85('0x3e')]=_0x9f25c2;return _0x1f5b66;})[_0xeb85('0x3b')](respondWithFilteredResult(_0x26911b,_0x31449a))[_0xeb85('0x3f')](handleError(_0x26911b,null));};exports[_0xeb85('0x40')]=function(_0x1decab,_0x1102c2){var _0x213791={'raw':![],'where':{'id':_0x1decab[_0xeb85('0x41')]['id']}},_0x19f837={};_0x19f837[_0xeb85('0x2a')]=_[_0xeb85('0x2c')](db[_0xeb85('0x26')][_0xeb85('0x27')]);_0x19f837['query']=_['keys'](_0x1decab[_0xeb85('0x2f')]);_0x19f837[_0xeb85('0x2d')]=_[_0xeb85('0x2e')](_0x19f837['model'],_0x19f837[_0xeb85('0x2f')]);_0x213791['attributes']=_['intersection'](_0x19f837[_0xeb85('0x2a')],qs[_0xeb85('0x31')](_0x1decab['query'][_0xeb85('0x31')]));_0x213791[_0xeb85('0x30')]=_0x213791[_0xeb85('0x30')]['length']?_0x213791[_0xeb85('0x30')]:_0x19f837[_0xeb85('0x2a')];if(_0x1decab['query'][_0xeb85('0x3c')]){_0x213791[_0xeb85('0x42')]=[{'all':!![]}];}_0x213791=_[_0xeb85('0x36')]({},_0x213791,_0x1decab[_0xeb85('0x3a')]);return db['DeskConfiguration'][_0xeb85('0x43')](_0x213791)[_0xeb85('0x3b')](handleEntityNotFound(_0x1102c2,null))[_0xeb85('0x3b')](respondWithResult(_0x1102c2,null))['catch'](handleError(_0x1102c2,null));};exports['create']=function(_0x3bec16,_0x42820e){return db[_0xeb85('0x26')][_0xeb85('0x44')](_0x3bec16[_0xeb85('0x45')],{})['then'](respondWithResult(_0x42820e,0xc9))[_0xeb85('0x3f')](handleError(_0x42820e,null));};exports[_0xeb85('0x20')]=function(_0x6b52a3,_0x1dcdd3){if(_0x6b52a3['body']['id']){delete _0x6b52a3[_0xeb85('0x45')]['id'];}return db[_0xeb85('0x26')][_0xeb85('0x43')]({'where':{'id':_0x6b52a3[_0xeb85('0x41')]['id']}})['then'](handleEntityNotFound(_0x1dcdd3,null))['then'](saveUpdates(_0x6b52a3[_0xeb85('0x45')],null))[_0xeb85('0x3b')](respondWithResult(_0x1dcdd3,null))[_0xeb85('0x3f')](handleError(_0x1dcdd3,null));};exports[_0xeb85('0x21')]=function(_0x4f8f66,_0x5eaa7d){return db['DeskConfiguration'][_0xeb85('0x43')]({'where':{'id':_0x4f8f66[_0xeb85('0x41')]['id']}})[_0xeb85('0x3b')](handleEntityNotFound(_0x5eaa7d,null))['then'](removeEntity(_0x5eaa7d,null))['catch'](handleError(_0x5eaa7d,null));};exports[_0xeb85('0x46')]=function(_0x5639ce,_0x4fee37,_0x2d200d){var _0x57b57a={};var _0x1ddd18={};var _0x1f6e8b;var _0x33f357;return db[_0xeb85('0x26')][_0xeb85('0x47')]({'where':{'id':_0x5639ce[_0xeb85('0x41')]['id']}})['then'](handleEntityNotFound(_0x4fee37,null))['then'](function(_0x20e095){if(_0x20e095){_0x1f6e8b=_0x20e095;_0x1ddd18[_0xeb85('0x2a')]=_[_0xeb85('0x2c')](db[_0xeb85('0x48')]['rawAttributes']);_0x1ddd18[_0xeb85('0x2f')]=_[_0xeb85('0x2c')](_0x5639ce[_0xeb85('0x2f')]);_0x1ddd18[_0xeb85('0x2d')]=_['intersection'](_0x1ddd18[_0xeb85('0x2a')],_0x1ddd18[_0xeb85('0x2f')]);_0x57b57a[_0xeb85('0x30')]=_[_0xeb85('0x2e')](_0x1ddd18[_0xeb85('0x2a')],qs[_0xeb85('0x31')](_0x5639ce[_0xeb85('0x2f')][_0xeb85('0x31')]));_0x57b57a['attributes']=_0x57b57a[_0xeb85('0x30')][_0xeb85('0x32')]?_0x57b57a[_0xeb85('0x30')]:_0x1ddd18[_0xeb85('0x2a')];_0x57b57a[_0xeb85('0x34')]=qs[_0xeb85('0x35')](_0x5639ce[_0xeb85('0x2f')][_0xeb85('0x35')]);_0x57b57a['where']=qs[_0xeb85('0x2d')](_['pick'](_0x5639ce[_0xeb85('0x2f')],_0x1ddd18[_0xeb85('0x2d')]));if(_0x5639ce['query'][_0xeb85('0x39')]){_0x57b57a[_0xeb85('0x37')]=_[_0xeb85('0x36')](_0x57b57a[_0xeb85('0x37')],{'$or':_[_0xeb85('0x2b')](_0x57b57a[_0xeb85('0x30')],function(_0x52bf96){var _0x45b95e={};_0x45b95e[_0x52bf96]={'$like':'%'+_0x5639ce[_0xeb85('0x2f')][_0xeb85('0x39')]+'%'};return _0x45b95e;})});}_0x57b57a=_['merge']({},_0x57b57a,_0x5639ce[_0xeb85('0x3a')]);return _0x1f6e8b[_0xeb85('0x46')](_0x57b57a);}})[_0xeb85('0x3b')](function(_0x6f43bf){if(_0x6f43bf){_0x33f357=_0x6f43bf[_0xeb85('0x32')];if(!_0x5639ce[_0xeb85('0x2f')]['hasOwnProperty']('nolimit')){_0x57b57a[_0xeb85('0x1a')]=qs[_0xeb85('0x1a')](_0x5639ce[_0xeb85('0x2f')][_0xeb85('0x1a')]);_0x57b57a[_0xeb85('0x1c')]=qs[_0xeb85('0x1c')](_0x5639ce[_0xeb85('0x2f')][_0xeb85('0x1c')]);}return _0x1f6e8b['getFields'](_0x57b57a);}})[_0xeb85('0x3b')](function(_0x47cf46){if(_0x47cf46){return _0x47cf46?{'count':_0x33f357,'rows':_0x47cf46}:null;}})[_0xeb85('0x3b')](respondWithResult(_0x4fee37,null))['catch'](handleError(_0x4fee37,null));};exports[_0xeb85('0x49')]=function(_0x52a1e5,_0x1d2467,_0x2b566b){var _0xd8bce4={};var _0x331488={};var _0x1b73eb;var _0x3c2770;return db[_0xeb85('0x26')]['findOne']({'where':{'id':_0x52a1e5['params']['id']}})[_0xeb85('0x3b')](handleEntityNotFound(_0x1d2467,null))[_0xeb85('0x3b')](function(_0x4b5d3e){if(_0x4b5d3e){_0x1b73eb=_0x4b5d3e;_0x331488[_0xeb85('0x2a')]=_[_0xeb85('0x2c')](db[_0xeb85('0x48')][_0xeb85('0x27')]);_0x331488[_0xeb85('0x2f')]=_['keys'](_0x52a1e5[_0xeb85('0x2f')]);_0x331488[_0xeb85('0x2d')]=_[_0xeb85('0x2e')](_0x331488[_0xeb85('0x2a')],_0x331488[_0xeb85('0x2f')]);_0xd8bce4[_0xeb85('0x30')]=_['intersection'](_0x331488[_0xeb85('0x2a')],qs['fields'](_0x52a1e5[_0xeb85('0x2f')][_0xeb85('0x31')]));_0xd8bce4['attributes']=_0xd8bce4[_0xeb85('0x30')]['length']?_0xd8bce4[_0xeb85('0x30')]:_0x331488['model'];_0xd8bce4[_0xeb85('0x34')]=qs[_0xeb85('0x35')](_0x52a1e5['query']['sort']);_0xd8bce4[_0xeb85('0x37')]=qs[_0xeb85('0x2d')](_[_0xeb85('0x4a')](_0x52a1e5[_0xeb85('0x2f')],_0x331488['filters']));if(_0x52a1e5[_0xeb85('0x2f')][_0xeb85('0x39')]){_0xd8bce4[_0xeb85('0x37')]=_['merge'](_0xd8bce4[_0xeb85('0x37')],{'$or':_[_0xeb85('0x2b')](_0xd8bce4['attributes'],function(_0x2b6f7b){var _0x10c613={};_0x10c613[_0x2b6f7b]={'$like':'%'+_0x52a1e5[_0xeb85('0x2f')]['filter']+'%'};return _0x10c613;})});}_0xd8bce4=_['merge']({},_0xd8bce4,_0x52a1e5[_0xeb85('0x3a')]);return _0x1b73eb[_0xeb85('0x49')](_0xd8bce4);}})[_0xeb85('0x3b')](function(_0x324c33){if(_0x324c33){_0x3c2770=_0x324c33[_0xeb85('0x32')];if(!_0x52a1e5['query'][_0xeb85('0x33')](_0xeb85('0x4b'))){_0xd8bce4[_0xeb85('0x1a')]=qs[_0xeb85('0x1a')](_0x52a1e5[_0xeb85('0x2f')][_0xeb85('0x1a')]);_0xd8bce4[_0xeb85('0x1c')]=qs[_0xeb85('0x1c')](_0x52a1e5[_0xeb85('0x2f')][_0xeb85('0x1c')]);}return _0x1b73eb[_0xeb85('0x49')](_0xd8bce4);}})[_0xeb85('0x3b')](function(_0x3e60ed){if(_0x3e60ed){return _0x3e60ed?{'count':_0x3c2770,'rows':_0x3e60ed}:null;}})[_0xeb85('0x3b')](respondWithResult(_0x1d2467,null))[_0xeb85('0x3f')](handleError(_0x1d2467,null));};exports[_0xeb85('0x4c')]=function(_0x616d3c,_0x287bc3,_0x1b2fea){var _0x196fe7={};var _0x1c3ad5={};var _0x475aff;var _0x5b85a2;return db[_0xeb85('0x26')][_0xeb85('0x47')]({'where':{'id':_0x616d3c[_0xeb85('0x41')]['id']}})[_0xeb85('0x3b')](handleEntityNotFound(_0x287bc3,null))[_0xeb85('0x3b')](function(_0x5b2e15){if(_0x5b2e15){_0x475aff=_0x5b2e15;_0x1c3ad5[_0xeb85('0x2a')]=_[_0xeb85('0x2c')](db[_0xeb85('0x48')][_0xeb85('0x27')]);_0x1c3ad5['query']=_[_0xeb85('0x2c')](_0x616d3c[_0xeb85('0x2f')]);_0x1c3ad5[_0xeb85('0x2d')]=_['intersection'](_0x1c3ad5[_0xeb85('0x2a')],_0x1c3ad5[_0xeb85('0x2f')]);_0x196fe7['attributes']=_['intersection'](_0x1c3ad5[_0xeb85('0x2a')],qs['fields'](_0x616d3c[_0xeb85('0x2f')][_0xeb85('0x31')]));_0x196fe7['attributes']=_0x196fe7[_0xeb85('0x30')][_0xeb85('0x32')]?_0x196fe7[_0xeb85('0x30')]:_0x1c3ad5['model'];_0x196fe7[_0xeb85('0x34')]=qs['sort'](_0x616d3c[_0xeb85('0x2f')][_0xeb85('0x35')]);_0x196fe7[_0xeb85('0x37')]=qs['filters'](_[_0xeb85('0x4a')](_0x616d3c['query'],_0x1c3ad5[_0xeb85('0x2d')]));if(_0x616d3c['query']['filter']){_0x196fe7[_0xeb85('0x37')]=_[_0xeb85('0x36')](_0x196fe7[_0xeb85('0x37')],{'$or':_[_0xeb85('0x2b')](_0x196fe7[_0xeb85('0x30')],function(_0x2bce4b){var _0xbe0101={};_0xbe0101[_0x2bce4b]={'$like':'%'+_0x616d3c[_0xeb85('0x2f')][_0xeb85('0x39')]+'%'};return _0xbe0101;})});}_0x196fe7=_[_0xeb85('0x36')]({},_0x196fe7,_0x616d3c[_0xeb85('0x3a')]);return _0x475aff[_0xeb85('0x4c')](_0x196fe7);}})[_0xeb85('0x3b')](function(_0x3aa3d9){if(_0x3aa3d9){_0x5b85a2=_0x3aa3d9[_0xeb85('0x32')];if(!_0x616d3c[_0xeb85('0x2f')]['hasOwnProperty']('nolimit')){_0x196fe7['limit']=qs[_0xeb85('0x1a')](_0x616d3c[_0xeb85('0x2f')][_0xeb85('0x1a')]);_0x196fe7[_0xeb85('0x1c')]=qs[_0xeb85('0x1c')](_0x616d3c[_0xeb85('0x2f')][_0xeb85('0x1c')]);}return _0x475aff[_0xeb85('0x4c')](_0x196fe7);}})['then'](function(_0xa842db){if(_0xa842db){return _0xa842db?{'count':_0x5b85a2,'rows':_0xa842db}:null;}})[_0xeb85('0x3b')](respondWithResult(_0x287bc3,null))[_0xeb85('0x3f')](handleError(_0x287bc3,null));};exports[_0xeb85('0x4d')]=function(_0x324dd5,_0x46e191,_0x312919){var _0x4e3191={};var _0x39169b={};var _0x5e08d6;var _0x5516f2;return db[_0xeb85('0x26')][_0xeb85('0x47')]({'where':{'id':_0x324dd5['params']['id']}})[_0xeb85('0x3b')](handleEntityNotFound(_0x46e191,null))['then'](function(_0x20e900){if(_0x20e900){_0x5e08d6=_0x20e900;_0x39169b['model']=_[_0xeb85('0x2c')](db[_0xeb85('0x4e')][_0xeb85('0x27')]);_0x39169b[_0xeb85('0x2f')]=_['keys'](_0x324dd5[_0xeb85('0x2f')]);_0x39169b[_0xeb85('0x2d')]=_['intersection'](_0x39169b[_0xeb85('0x2a')],_0x39169b[_0xeb85('0x2f')]);_0x4e3191['attributes']=_[_0xeb85('0x2e')](_0x39169b[_0xeb85('0x2a')],qs['fields'](_0x324dd5[_0xeb85('0x2f')][_0xeb85('0x31')]));_0x4e3191[_0xeb85('0x30')]=_0x4e3191[_0xeb85('0x30')]['length']?_0x4e3191[_0xeb85('0x30')]:_0x39169b[_0xeb85('0x2a')];_0x4e3191[_0xeb85('0x34')]=qs[_0xeb85('0x35')](_0x324dd5['query'][_0xeb85('0x35')]);_0x4e3191[_0xeb85('0x37')]=qs[_0xeb85('0x2d')](_[_0xeb85('0x4a')](_0x324dd5[_0xeb85('0x2f')],_0x39169b[_0xeb85('0x2d')]));if(_0x324dd5[_0xeb85('0x2f')][_0xeb85('0x39')]){_0x4e3191[_0xeb85('0x37')]=_[_0xeb85('0x36')](_0x4e3191[_0xeb85('0x37')],{'$or':_[_0xeb85('0x2b')](_0x4e3191['attributes'],function(_0x228f19){var _0x2a24c0={};_0x2a24c0[_0x228f19]={'$like':'%'+_0x324dd5['query']['filter']+'%'};return _0x2a24c0;})});}_0x4e3191=_[_0xeb85('0x36')]({},_0x4e3191,_0x324dd5[_0xeb85('0x3a')]);return _0x5e08d6['getTags'](_0x4e3191);}})[_0xeb85('0x3b')](function(_0xd7e16e){if(_0xd7e16e){_0x5516f2=_0xd7e16e[_0xeb85('0x32')];if(!_0x324dd5[_0xeb85('0x2f')][_0xeb85('0x33')](_0xeb85('0x4b'))){_0x4e3191[_0xeb85('0x1a')]=qs[_0xeb85('0x1a')](_0x324dd5[_0xeb85('0x2f')][_0xeb85('0x1a')]);_0x4e3191['offset']=qs[_0xeb85('0x1c')](_0x324dd5[_0xeb85('0x2f')][_0xeb85('0x1c')]);}return _0x5e08d6[_0xeb85('0x4d')](_0x4e3191);}})[_0xeb85('0x3b')](function(_0x38e648){if(_0x38e648){return _0x38e648?{'count':_0x5516f2,'rows':_0x38e648}:null;}})[_0xeb85('0x3b')](respondWithResult(_0x46e191,null))[_0xeb85('0x3f')](handleError(_0x46e191,null));};exports[_0xeb85('0x4f')]=function(_0x3b6430,_0x3b5855,_0x9640eb){if(_0x3b6430['body']['id']){delete _0x3b6430['body']['id'];}return db['DeskConfiguration'][_0xeb85('0x47')]({'where':{'id':_0x3b6430[_0xeb85('0x41')]['id']}})[_0xeb85('0x3b')](handleEntityNotFound(_0x3b5855,null))[_0xeb85('0x3b')](function(_0x25dcd0){if(_0x25dcd0){return _0x25dcd0[_0xeb85('0x4f')](_0x3b6430['body'][_0xeb85('0x50')]||[]);}return null;})[_0xeb85('0x3b')](respondWithResult(_0x3b5855,null))[_0xeb85('0x3f')](handleError(_0x3b5855,null));}; \ No newline at end of file +var _0xa3c5=['util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','findOne','getFields','getSubjects','DeskField','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x1e8e69,_0x508379){var _0x291b1a=function(_0x16861c){while(--_0x16861c){_0x1e8e69['push'](_0x1e8e69['shift']());}};_0x291b1a(++_0x508379);}(_0xa3c5,0x1f2));var _0x5a3c=function(_0x14364a,_0x1291a3){_0x14364a=_0x14364a-0x0;var _0x31d682=_0xa3c5[_0x14364a];return _0x31d682;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a3c('0x0'));var zipdir=require(_0x5a3c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a3c('0x2'));var moment=require(_0x5a3c('0x3'));var BPromise=require(_0x5a3c('0x4'));var Mustache=require(_0x5a3c('0x5'));var util=require(_0x5a3c('0x6'));var path=require(_0x5a3c('0x7'));var sox=require(_0x5a3c('0x8'));var csv=require('to-csv');var ejs=require(_0x5a3c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5a3c('0xa'));var crypto=require('crypto');var jsforce=require(_0x5a3c('0xb'));var deskjs=require(_0x5a3c('0xc'));var toCsv=require(_0x5a3c('0xd'));var querystring=require(_0x5a3c('0xe'));var Papa=require(_0x5a3c('0xf'));var Redis=require(_0x5a3c('0x10'));var authService=require(_0x5a3c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5a3c('0x12'));var hardwareService=require(_0x5a3c('0x13'));var logger=require(_0x5a3c('0x14'))(_0x5a3c('0x15'));var utils=require(_0x5a3c('0x16'));var config=require(_0x5a3c('0x17'));var licenseUtil=require(_0x5a3c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x303f7f,_0x3978fa){_0x3978fa=_0x3978fa||0xcc;return function(_0x61b969){if(_0x61b969){return _0x303f7f[_0x5a3c('0x19')](_0x3978fa);}return _0x303f7f[_0x5a3c('0x1a')](_0x3978fa)['end']();};}function respondWithResult(_0x2d0612,_0x35f71a){_0x35f71a=_0x35f71a||0xc8;return function(_0x12017c){if(_0x12017c){return _0x2d0612[_0x5a3c('0x1a')](_0x35f71a)['json'](_0x12017c);}};}function respondWithFilteredResult(_0x1d2306,_0x2aae74){return function(_0x446294){if(_0x446294){var _0x49df7=typeof _0x2aae74[_0x5a3c('0x1b')]===_0x5a3c('0x1c')&&typeof _0x2aae74[_0x5a3c('0x1d')]===_0x5a3c('0x1c');var _0x2c2fba=_0x446294[_0x5a3c('0x1e')];var _0xa33789=_0x49df7?0x0:_0x2aae74[_0x5a3c('0x1b')];var _0x29510d=_0x49df7?_0x446294[_0x5a3c('0x1e')]:_0x2aae74[_0x5a3c('0x1b')]+_0x2aae74['limit'];var _0x1f5c99;if(_0x29510d>=_0x2c2fba){_0x29510d=_0x2c2fba;_0x1f5c99=0xc8;}else{_0x1f5c99=0xce;}_0x1d2306['status'](_0x1f5c99);return _0x1d2306[_0x5a3c('0x1f')](_0x5a3c('0x20'),_0xa33789+'-'+_0x29510d+'/'+_0x2c2fba)['json'](_0x446294);}return null;};}function patchUpdates(_0x4b297d){return function(_0x1e84ac){try{jsonpatch['apply'](_0x1e84ac,_0x4b297d,!![]);}catch(_0x2012ff){return BPromise[_0x5a3c('0x21')](_0x2012ff);}return _0x1e84ac[_0x5a3c('0x22')]();};}function saveUpdates(_0x2130b8,_0x3c91c6){return function(_0x246131){if(_0x246131){return _0x246131[_0x5a3c('0x23')](_0x2130b8)['then'](function(_0x47dae4){return _0x47dae4;});}return null;};}function removeEntity(_0x27f276,_0x3a928c){return function(_0x42d89a){if(_0x42d89a){return _0x42d89a[_0x5a3c('0x24')]()[_0x5a3c('0x25')](function(){_0x27f276[_0x5a3c('0x1a')](0xcc)[_0x5a3c('0x26')]();});}};}function handleEntityNotFound(_0xc72101,_0x2f657b){return function(_0x1dea32){if(!_0x1dea32){_0xc72101['sendStatus'](0x194);}return _0x1dea32;};}function handleError(_0x26cf14,_0x382daf){_0x382daf=_0x382daf||0x1f4;return function(_0x11b4c3){logger[_0x5a3c('0x27')](_0x11b4c3[_0x5a3c('0x28')]);if(_0x11b4c3[_0x5a3c('0x29')]){delete _0x11b4c3[_0x5a3c('0x29')];}_0x26cf14[_0x5a3c('0x1a')](_0x382daf)[_0x5a3c('0x2a')](_0x11b4c3);};}exports['index']=function(_0x49eae5,_0x4d0482){var _0x21ebd9={},_0x1d0040={},_0xd4e892={'count':0x0,'rows':[]};var _0x14f699=_[_0x5a3c('0x2b')](db[_0x5a3c('0x2c')][_0x5a3c('0x2d')],function(_0x3fb54a){return{'name':_0x3fb54a[_0x5a3c('0x2e')],'type':_0x3fb54a[_0x5a3c('0x2f')]['key']};});_0x1d0040['model']=_[_0x5a3c('0x2b')](_0x14f699,_0x5a3c('0x29'));_0x1d0040[_0x5a3c('0x30')]=_[_0x5a3c('0x31')](_0x49eae5[_0x5a3c('0x30')]);_0x1d0040[_0x5a3c('0x32')]=_[_0x5a3c('0x33')](_0x1d0040[_0x5a3c('0x34')],_0x1d0040[_0x5a3c('0x30')]);_0x21ebd9[_0x5a3c('0x35')]=_['intersection'](_0x1d0040['model'],qs[_0x5a3c('0x36')](_0x49eae5[_0x5a3c('0x30')][_0x5a3c('0x36')]));_0x21ebd9[_0x5a3c('0x35')]=_0x21ebd9[_0x5a3c('0x35')][_0x5a3c('0x37')]?_0x21ebd9[_0x5a3c('0x35')]:_0x1d0040[_0x5a3c('0x34')];if(!_0x49eae5['query'][_0x5a3c('0x38')](_0x5a3c('0x39'))){_0x21ebd9[_0x5a3c('0x1d')]=qs['limit'](_0x49eae5['query'][_0x5a3c('0x1d')]);_0x21ebd9[_0x5a3c('0x1b')]=qs[_0x5a3c('0x1b')](_0x49eae5[_0x5a3c('0x30')]['offset']);}_0x21ebd9[_0x5a3c('0x3a')]=qs[_0x5a3c('0x3b')](_0x49eae5[_0x5a3c('0x30')][_0x5a3c('0x3b')]);_0x21ebd9[_0x5a3c('0x3c')]=qs[_0x5a3c('0x32')](_[_0x5a3c('0x3d')](_0x49eae5[_0x5a3c('0x30')],_0x1d0040[_0x5a3c('0x32')]),_0x14f699);if(_0x49eae5['query'][_0x5a3c('0x3e')]){_0x21ebd9[_0x5a3c('0x3c')]=_[_0x5a3c('0x3f')](_0x21ebd9[_0x5a3c('0x3c')],{'$or':_[_0x5a3c('0x2b')](_0x14f699,function(_0x539ea8){if(_0x539ea8[_0x5a3c('0x2f')]!==_0x5a3c('0x40')){var _0xc00833={};_0xc00833[_0x539ea8[_0x5a3c('0x29')]]={'$like':'%'+_0x49eae5[_0x5a3c('0x30')][_0x5a3c('0x3e')]+'%'};return _0xc00833;}})});}_0x21ebd9=_[_0x5a3c('0x3f')]({},_0x21ebd9,_0x49eae5[_0x5a3c('0x41')]);var _0xe05ba8={'where':_0x21ebd9[_0x5a3c('0x3c')]};return db['DeskConfiguration']['count'](_0xe05ba8)[_0x5a3c('0x25')](function(_0xffc7ad){_0xd4e892[_0x5a3c('0x1e')]=_0xffc7ad;if(_0x49eae5[_0x5a3c('0x30')][_0x5a3c('0x42')]){_0x21ebd9[_0x5a3c('0x43')]=[{'all':!![]}];}return db[_0x5a3c('0x2c')][_0x5a3c('0x44')](_0x21ebd9);})['then'](function(_0x46b0cc){_0xd4e892['rows']=_0x46b0cc;return _0xd4e892;})[_0x5a3c('0x25')](respondWithFilteredResult(_0x4d0482,_0x21ebd9))[_0x5a3c('0x45')](handleError(_0x4d0482,null));};exports[_0x5a3c('0x46')]=function(_0x2c84ee,_0x38ed1c){var _0x476c5c={'raw':![],'where':{'id':_0x2c84ee[_0x5a3c('0x47')]['id']}},_0x1dcd02={};_0x1dcd02[_0x5a3c('0x34')]=_[_0x5a3c('0x31')](db[_0x5a3c('0x2c')][_0x5a3c('0x2d')]);_0x1dcd02[_0x5a3c('0x30')]=_[_0x5a3c('0x31')](_0x2c84ee[_0x5a3c('0x30')]);_0x1dcd02['filters']=_[_0x5a3c('0x33')](_0x1dcd02[_0x5a3c('0x34')],_0x1dcd02[_0x5a3c('0x30')]);_0x476c5c[_0x5a3c('0x35')]=_[_0x5a3c('0x33')](_0x1dcd02[_0x5a3c('0x34')],qs[_0x5a3c('0x36')](_0x2c84ee[_0x5a3c('0x30')]['fields']));_0x476c5c['attributes']=_0x476c5c[_0x5a3c('0x35')][_0x5a3c('0x37')]?_0x476c5c[_0x5a3c('0x35')]:_0x1dcd02['model'];if(_0x2c84ee[_0x5a3c('0x30')][_0x5a3c('0x42')]){_0x476c5c[_0x5a3c('0x43')]=[{'all':!![]}];}_0x476c5c=_[_0x5a3c('0x3f')]({},_0x476c5c,_0x2c84ee[_0x5a3c('0x41')]);return db[_0x5a3c('0x2c')]['find'](_0x476c5c)['then'](handleEntityNotFound(_0x38ed1c,null))[_0x5a3c('0x25')](respondWithResult(_0x38ed1c,null))['catch'](handleError(_0x38ed1c,null));};exports[_0x5a3c('0x48')]=function(_0x42fddc,_0xd39c4f){return db['DeskConfiguration'][_0x5a3c('0x48')](_0x42fddc[_0x5a3c('0x49')],{})[_0x5a3c('0x25')](respondWithResult(_0xd39c4f,0xc9))[_0x5a3c('0x45')](handleError(_0xd39c4f,null));};exports[_0x5a3c('0x23')]=function(_0x3e25a3,_0xe5f60e){if(_0x3e25a3['body']['id']){delete _0x3e25a3[_0x5a3c('0x49')]['id'];}return db[_0x5a3c('0x2c')][_0x5a3c('0x4a')]({'where':{'id':_0x3e25a3[_0x5a3c('0x47')]['id']}})[_0x5a3c('0x25')](handleEntityNotFound(_0xe5f60e,null))[_0x5a3c('0x25')](saveUpdates(_0x3e25a3[_0x5a3c('0x49')],null))[_0x5a3c('0x25')](respondWithResult(_0xe5f60e,null))[_0x5a3c('0x45')](handleError(_0xe5f60e,null));};exports[_0x5a3c('0x24')]=function(_0x1e898c,_0x508b54){return db['DeskConfiguration'][_0x5a3c('0x4a')]({'where':{'id':_0x1e898c[_0x5a3c('0x47')]['id']}})[_0x5a3c('0x25')](handleEntityNotFound(_0x508b54,null))[_0x5a3c('0x25')](removeEntity(_0x508b54,null))[_0x5a3c('0x45')](handleError(_0x508b54,null));};exports['getFields']=function(_0xcd0e16,_0x3a6926,_0x5df3c4){var _0x16cb1e={};var _0x41dfa7={};var _0x4891c5;var _0x22f059;return db[_0x5a3c('0x2c')][_0x5a3c('0x4b')]({'where':{'id':_0xcd0e16['params']['id']}})[_0x5a3c('0x25')](handleEntityNotFound(_0x3a6926,null))[_0x5a3c('0x25')](function(_0x455861){if(_0x455861){_0x4891c5=_0x455861;_0x41dfa7[_0x5a3c('0x34')]=_['keys'](db['DeskField']['rawAttributes']);_0x41dfa7[_0x5a3c('0x30')]=_['keys'](_0xcd0e16[_0x5a3c('0x30')]);_0x41dfa7[_0x5a3c('0x32')]=_['intersection'](_0x41dfa7['model'],_0x41dfa7[_0x5a3c('0x30')]);_0x16cb1e['attributes']=_[_0x5a3c('0x33')](_0x41dfa7[_0x5a3c('0x34')],qs['fields'](_0xcd0e16['query'][_0x5a3c('0x36')]));_0x16cb1e[_0x5a3c('0x35')]=_0x16cb1e['attributes']['length']?_0x16cb1e['attributes']:_0x41dfa7[_0x5a3c('0x34')];_0x16cb1e['order']=qs[_0x5a3c('0x3b')](_0xcd0e16[_0x5a3c('0x30')][_0x5a3c('0x3b')]);_0x16cb1e[_0x5a3c('0x3c')]=qs[_0x5a3c('0x32')](_['pick'](_0xcd0e16[_0x5a3c('0x30')],_0x41dfa7[_0x5a3c('0x32')]));if(_0xcd0e16[_0x5a3c('0x30')][_0x5a3c('0x3e')]){_0x16cb1e['where']=_['merge'](_0x16cb1e['where'],{'$or':_['map'](_0x16cb1e[_0x5a3c('0x35')],function(_0x12efef){var _0x1b4f08={};_0x1b4f08[_0x12efef]={'$like':'%'+_0xcd0e16[_0x5a3c('0x30')]['filter']+'%'};return _0x1b4f08;})});}_0x16cb1e=_[_0x5a3c('0x3f')]({},_0x16cb1e,_0xcd0e16[_0x5a3c('0x41')]);return _0x4891c5[_0x5a3c('0x4c')](_0x16cb1e);}})[_0x5a3c('0x25')](function(_0x1d3946){if(_0x1d3946){_0x22f059=_0x1d3946[_0x5a3c('0x37')];if(!_0xcd0e16[_0x5a3c('0x30')][_0x5a3c('0x38')](_0x5a3c('0x39'))){_0x16cb1e[_0x5a3c('0x1d')]=qs[_0x5a3c('0x1d')](_0xcd0e16['query']['limit']);_0x16cb1e[_0x5a3c('0x1b')]=qs[_0x5a3c('0x1b')](_0xcd0e16[_0x5a3c('0x30')][_0x5a3c('0x1b')]);}return _0x4891c5[_0x5a3c('0x4c')](_0x16cb1e);}})[_0x5a3c('0x25')](function(_0x5c7897){if(_0x5c7897){return _0x5c7897?{'count':_0x22f059,'rows':_0x5c7897}:null;}})[_0x5a3c('0x25')](respondWithResult(_0x3a6926,null))[_0x5a3c('0x45')](handleError(_0x3a6926,null));};exports[_0x5a3c('0x4d')]=function(_0x4b11e5,_0xc5a480,_0x1e2d99){var _0x214125={};var _0xd2f3a2={};var _0xe8ec17;var _0x244d8f;return db[_0x5a3c('0x2c')]['findOne']({'where':{'id':_0x4b11e5[_0x5a3c('0x47')]['id']}})['then'](handleEntityNotFound(_0xc5a480,null))[_0x5a3c('0x25')](function(_0x4c30b5){if(_0x4c30b5){_0xe8ec17=_0x4c30b5;_0xd2f3a2[_0x5a3c('0x34')]=_[_0x5a3c('0x31')](db[_0x5a3c('0x4e')][_0x5a3c('0x2d')]);_0xd2f3a2['query']=_[_0x5a3c('0x31')](_0x4b11e5[_0x5a3c('0x30')]);_0xd2f3a2[_0x5a3c('0x32')]=_[_0x5a3c('0x33')](_0xd2f3a2['model'],_0xd2f3a2[_0x5a3c('0x30')]);_0x214125['attributes']=_[_0x5a3c('0x33')](_0xd2f3a2['model'],qs[_0x5a3c('0x36')](_0x4b11e5[_0x5a3c('0x30')][_0x5a3c('0x36')]));_0x214125[_0x5a3c('0x35')]=_0x214125['attributes'][_0x5a3c('0x37')]?_0x214125[_0x5a3c('0x35')]:_0xd2f3a2[_0x5a3c('0x34')];_0x214125['order']=qs[_0x5a3c('0x3b')](_0x4b11e5['query'][_0x5a3c('0x3b')]);_0x214125[_0x5a3c('0x3c')]=qs[_0x5a3c('0x32')](_[_0x5a3c('0x3d')](_0x4b11e5[_0x5a3c('0x30')],_0xd2f3a2[_0x5a3c('0x32')]));if(_0x4b11e5[_0x5a3c('0x30')][_0x5a3c('0x3e')]){_0x214125[_0x5a3c('0x3c')]=_[_0x5a3c('0x3f')](_0x214125[_0x5a3c('0x3c')],{'$or':_['map'](_0x214125[_0x5a3c('0x35')],function(_0x49f31f){var _0xc029c6={};_0xc029c6[_0x49f31f]={'$like':'%'+_0x4b11e5[_0x5a3c('0x30')][_0x5a3c('0x3e')]+'%'};return _0xc029c6;})});}_0x214125=_[_0x5a3c('0x3f')]({},_0x214125,_0x4b11e5['options']);return _0xe8ec17[_0x5a3c('0x4d')](_0x214125);}})['then'](function(_0x15c338){if(_0x15c338){_0x244d8f=_0x15c338[_0x5a3c('0x37')];if(!_0x4b11e5['query']['hasOwnProperty'](_0x5a3c('0x39'))){_0x214125[_0x5a3c('0x1d')]=qs[_0x5a3c('0x1d')](_0x4b11e5[_0x5a3c('0x30')][_0x5a3c('0x1d')]);_0x214125[_0x5a3c('0x1b')]=qs[_0x5a3c('0x1b')](_0x4b11e5[_0x5a3c('0x30')][_0x5a3c('0x1b')]);}return _0xe8ec17[_0x5a3c('0x4d')](_0x214125);}})[_0x5a3c('0x25')](function(_0x499764){if(_0x499764){return _0x499764?{'count':_0x244d8f,'rows':_0x499764}:null;}})['then'](respondWithResult(_0xc5a480,null))[_0x5a3c('0x45')](handleError(_0xc5a480,null));};exports[_0x5a3c('0x4f')]=function(_0x41a5fd,_0x3ad6ff,_0x971e0d){var _0x1d767d={};var _0x27e2b6={};var _0x523e55;var _0x3cdd74;return db[_0x5a3c('0x2c')][_0x5a3c('0x4b')]({'where':{'id':_0x41a5fd[_0x5a3c('0x47')]['id']}})[_0x5a3c('0x25')](handleEntityNotFound(_0x3ad6ff,null))[_0x5a3c('0x25')](function(_0x1b0c3b){if(_0x1b0c3b){_0x523e55=_0x1b0c3b;_0x27e2b6[_0x5a3c('0x34')]=_[_0x5a3c('0x31')](db[_0x5a3c('0x4e')]['rawAttributes']);_0x27e2b6['query']=_[_0x5a3c('0x31')](_0x41a5fd[_0x5a3c('0x30')]);_0x27e2b6[_0x5a3c('0x32')]=_[_0x5a3c('0x33')](_0x27e2b6[_0x5a3c('0x34')],_0x27e2b6[_0x5a3c('0x30')]);_0x1d767d[_0x5a3c('0x35')]=_[_0x5a3c('0x33')](_0x27e2b6[_0x5a3c('0x34')],qs['fields'](_0x41a5fd[_0x5a3c('0x30')]['fields']));_0x1d767d[_0x5a3c('0x35')]=_0x1d767d[_0x5a3c('0x35')][_0x5a3c('0x37')]?_0x1d767d[_0x5a3c('0x35')]:_0x27e2b6[_0x5a3c('0x34')];_0x1d767d['order']=qs[_0x5a3c('0x3b')](_0x41a5fd[_0x5a3c('0x30')][_0x5a3c('0x3b')]);_0x1d767d[_0x5a3c('0x3c')]=qs['filters'](_[_0x5a3c('0x3d')](_0x41a5fd[_0x5a3c('0x30')],_0x27e2b6[_0x5a3c('0x32')]));if(_0x41a5fd[_0x5a3c('0x30')]['filter']){_0x1d767d[_0x5a3c('0x3c')]=_[_0x5a3c('0x3f')](_0x1d767d[_0x5a3c('0x3c')],{'$or':_[_0x5a3c('0x2b')](_0x1d767d[_0x5a3c('0x35')],function(_0x2a038b){var _0x2b7fd9={};_0x2b7fd9[_0x2a038b]={'$like':'%'+_0x41a5fd['query'][_0x5a3c('0x3e')]+'%'};return _0x2b7fd9;})});}_0x1d767d=_[_0x5a3c('0x3f')]({},_0x1d767d,_0x41a5fd[_0x5a3c('0x41')]);return _0x523e55[_0x5a3c('0x4f')](_0x1d767d);}})[_0x5a3c('0x25')](function(_0x1ae92c){if(_0x1ae92c){_0x3cdd74=_0x1ae92c[_0x5a3c('0x37')];if(!_0x41a5fd[_0x5a3c('0x30')][_0x5a3c('0x38')](_0x5a3c('0x39'))){_0x1d767d[_0x5a3c('0x1d')]=qs[_0x5a3c('0x1d')](_0x41a5fd[_0x5a3c('0x30')][_0x5a3c('0x1d')]);_0x1d767d[_0x5a3c('0x1b')]=qs['offset'](_0x41a5fd[_0x5a3c('0x30')][_0x5a3c('0x1b')]);}return _0x523e55[_0x5a3c('0x4f')](_0x1d767d);}})[_0x5a3c('0x25')](function(_0x1eecd3){if(_0x1eecd3){return _0x1eecd3?{'count':_0x3cdd74,'rows':_0x1eecd3}:null;}})[_0x5a3c('0x25')](respondWithResult(_0x3ad6ff,null))[_0x5a3c('0x45')](handleError(_0x3ad6ff,null));};exports[_0x5a3c('0x50')]=function(_0x40468d,_0x186067,_0x235786){var _0x1b156f={};var _0xd1fd29={};var _0x522996;var _0x269512;return db['DeskConfiguration']['findOne']({'where':{'id':_0x40468d['params']['id']}})['then'](handleEntityNotFound(_0x186067,null))[_0x5a3c('0x25')](function(_0x57115c){if(_0x57115c){_0x522996=_0x57115c;_0xd1fd29['model']=_[_0x5a3c('0x31')](db[_0x5a3c('0x51')]['rawAttributes']);_0xd1fd29[_0x5a3c('0x30')]=_['keys'](_0x40468d[_0x5a3c('0x30')]);_0xd1fd29[_0x5a3c('0x32')]=_[_0x5a3c('0x33')](_0xd1fd29[_0x5a3c('0x34')],_0xd1fd29[_0x5a3c('0x30')]);_0x1b156f[_0x5a3c('0x35')]=_[_0x5a3c('0x33')](_0xd1fd29[_0x5a3c('0x34')],qs['fields'](_0x40468d['query'][_0x5a3c('0x36')]));_0x1b156f[_0x5a3c('0x35')]=_0x1b156f[_0x5a3c('0x35')]['length']?_0x1b156f[_0x5a3c('0x35')]:_0xd1fd29[_0x5a3c('0x34')];_0x1b156f['order']=qs[_0x5a3c('0x3b')](_0x40468d[_0x5a3c('0x30')]['sort']);_0x1b156f['where']=qs[_0x5a3c('0x32')](_[_0x5a3c('0x3d')](_0x40468d[_0x5a3c('0x30')],_0xd1fd29['filters']));if(_0x40468d[_0x5a3c('0x30')][_0x5a3c('0x3e')]){_0x1b156f[_0x5a3c('0x3c')]=_[_0x5a3c('0x3f')](_0x1b156f['where'],{'$or':_['map'](_0x1b156f[_0x5a3c('0x35')],function(_0x2d17e7){var _0x1c9b37={};_0x1c9b37[_0x2d17e7]={'$like':'%'+_0x40468d[_0x5a3c('0x30')][_0x5a3c('0x3e')]+'%'};return _0x1c9b37;})});}_0x1b156f=_[_0x5a3c('0x3f')]({},_0x1b156f,_0x40468d[_0x5a3c('0x41')]);return _0x522996['getTags'](_0x1b156f);}})[_0x5a3c('0x25')](function(_0x1984e1){if(_0x1984e1){_0x269512=_0x1984e1[_0x5a3c('0x37')];if(!_0x40468d[_0x5a3c('0x30')]['hasOwnProperty'](_0x5a3c('0x39'))){_0x1b156f['limit']=qs['limit'](_0x40468d[_0x5a3c('0x30')][_0x5a3c('0x1d')]);_0x1b156f[_0x5a3c('0x1b')]=qs['offset'](_0x40468d[_0x5a3c('0x30')][_0x5a3c('0x1b')]);}return _0x522996[_0x5a3c('0x50')](_0x1b156f);}})['then'](function(_0x524db8){if(_0x524db8){return _0x524db8?{'count':_0x269512,'rows':_0x524db8}:null;}})['then'](respondWithResult(_0x186067,null))[_0x5a3c('0x45')](handleError(_0x186067,null));};exports[_0x5a3c('0x52')]=function(_0x25196e,_0x11809a,_0x40e201){if(_0x25196e['body']['id']){delete _0x25196e[_0x5a3c('0x49')]['id'];}return db['DeskConfiguration'][_0x5a3c('0x4b')]({'where':{'id':_0x25196e[_0x5a3c('0x47')]['id']}})['then'](handleEntityNotFound(_0x11809a,null))[_0x5a3c('0x25')](function(_0x119673){if(_0x119673){return _0x119673[_0x5a3c('0x52')](_0x25196e[_0x5a3c('0x49')][_0x5a3c('0x53')]||[]);}return null;})[_0x5a3c('0x25')](respondWithResult(_0x11809a,null))['catch'](handleError(_0x11809a,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 7a8e5b8..b71790d 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 _0x6bdd=['./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x1c324f,_0x540dcd){var _0x6135fa=function(_0x60ca27){while(--_0x60ca27){_0x1c324f['push'](_0x1c324f['shift']());}};_0x6135fa(++_0x540dcd);}(_0x6bdd,0x1d9));var _0xd6bd=function(_0xa2049b,_0x7eeb1e){_0xa2049b=_0xa2049b-0x0;var _0x2fd615=_0x6bdd[_0xa2049b];return _0x2fd615;};'use strict';var _=require(_0xd6bd('0x0'));var util=require(_0xd6bd('0x1'));var logger=require('../../config/logger')(_0xd6bd('0x2'));var moment=require(_0xd6bd('0x3'));var BPromise=require(_0xd6bd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd6bd('0x5'));var rimraf=require(_0xd6bd('0x6'));var config=require(_0xd6bd('0x7'));var attributes=require(_0xd6bd('0x8'));module[_0xd6bd('0x9')]=function(_0x4a6d67,_0x233ead){return _0x4a6d67[_0xd6bd('0xa')](_0xd6bd('0xb'),attributes,{'tableName':_0xd6bd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51fc=['DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define'];(function(_0x497885,_0x212799){var _0x10e1ab=function(_0x9aabb3){while(--_0x9aabb3){_0x497885['push'](_0x497885['shift']());}};_0x10e1ab(++_0x212799);}(_0x51fc,0x1b4));var _0xc51f=function(_0x484fae,_0x37c7ed){_0x484fae=_0x484fae-0x0;var _0x2df2a7=_0x51fc[_0x484fae];return _0x2df2a7;};'use strict';var _=require(_0xc51f('0x0'));var util=require('util');var logger=require(_0xc51f('0x1'))(_0xc51f('0x2'));var moment=require(_0xc51f('0x3'));var BPromise=require(_0xc51f('0x4'));var rp=require(_0xc51f('0x5'));var fs=require('fs');var path=require(_0xc51f('0x6'));var rimraf=require(_0xc51f('0x7'));var config=require(_0xc51f('0x8'));var attributes=require(_0xc51f('0x9'));module[_0xc51f('0xa')]=function(_0x56e930,_0x22e166){return _0x56e930[_0xc51f('0xb')](_0xc51f('0xc'),attributes,{'tableName':_0xc51f('0xd'),'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 fa97b36..16b1595 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 _0xc113=['request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DeskConfiguration,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info'];(function(_0x3c598a,_0x404f6e){var _0x353be6=function(_0x4d78cd){while(--_0x4d78cd){_0x3c598a['push'](_0x3c598a['shift']());}};_0x353be6(++_0x404f6e);}(_0xc113,0x1ab));var _0x3c11=function(_0x346d0e,_0x4841ad){_0x346d0e=_0x346d0e-0x0;var _0x3d29fc=_0xc113[_0x346d0e];return _0x3d29fc;};'use strict';var _=require(_0x3c11('0x0'));var util=require(_0x3c11('0x1'));var moment=require(_0x3c11('0x2'));var BPromise=require(_0x3c11('0x3'));var rs=require(_0x3c11('0x4'));var fs=require('fs');var Redis=require(_0x3c11('0x5'));var db=require(_0x3c11('0x6'))['db'];var utils=require(_0x3c11('0x7'));var logger=require(_0x3c11('0x8'))('rpc');var config=require(_0x3c11('0x9'));var jayson=require(_0x3c11('0xa'));var client=jayson['client'][_0x3c11('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b181f,_0x2fa44d,_0x5d6f91){return new BPromise(function(_0x16959a,_0x4e98c0){return client['request'](_0x3b181f,_0x5d6f91)['then'](function(_0x7f14e6){logger[_0x3c11('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x2fa44d,_0x3c11('0xd'));logger[_0x3c11('0xe')](_0x3c11('0xf'),_0x2fa44d,'request\x20sent',JSON[_0x3c11('0x10')](_0x7f14e6));if(_0x7f14e6[_0x3c11('0x11')]){if(_0x7f14e6[_0x3c11('0x11')][_0x3c11('0x12')]===0x1f4){logger[_0x3c11('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x2fa44d,_0x7f14e6[_0x3c11('0x11')][_0x3c11('0x13')]);return _0x4e98c0(_0x7f14e6['error'][_0x3c11('0x13')]);}logger[_0x3c11('0x11')](_0x3c11('0x14'),_0x2fa44d,_0x7f14e6[_0x3c11('0x11')][_0x3c11('0x13')]);return _0x16959a(_0x7f14e6['error'][_0x3c11('0x13')]);}else{logger[_0x3c11('0xc')](_0x3c11('0x14'),_0x2fa44d,_0x3c11('0xd'));_0x16959a(_0x7f14e6[_0x3c11('0x15')]['message']);}})['catch'](function(_0x575e69){logger[_0x3c11('0x11')](_0x3c11('0x14'),_0x2fa44d,_0x575e69);_0x4e98c0(_0x575e69);});});} \ No newline at end of file +var _0xdec3=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0xdb7e75,_0x393b48){var _0x336047=function(_0x1cb712){while(--_0x1cb712){_0xdb7e75['push'](_0xdb7e75['shift']());}};_0x336047(++_0x393b48);}(_0xdec3,0x89));var _0x3dec=function(_0x4f3f71,_0x1e35ce){_0x4f3f71=_0x4f3f71-0x0;var _0x559c25=_0xdec3[_0x4f3f71];return _0x559c25;};'use strict';var _=require(_0x3dec('0x0'));var util=require('util');var moment=require(_0x3dec('0x1'));var BPromise=require(_0x3dec('0x2'));var rs=require(_0x3dec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3dec('0x4'))['db'];var utils=require(_0x3dec('0x5'));var logger=require(_0x3dec('0x6'))(_0x3dec('0x7'));var config=require('../../config/environment');var jayson=require(_0x3dec('0x8'));var client=jayson[_0x3dec('0x9')][_0x3dec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd3208e,_0x1826ab,_0x311a74){return new BPromise(function(_0x207dcf,_0x4b32d2){return client[_0x3dec('0xb')](_0xd3208e,_0x311a74)[_0x3dec('0xc')](function(_0x599552){logger[_0x3dec('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x1826ab,'request\x20sent');logger[_0x3dec('0xe')](_0x3dec('0xf'),_0x1826ab,'request\x20sent',JSON[_0x3dec('0x10')](_0x599552));if(_0x599552[_0x3dec('0x11')]){if(_0x599552['error'][_0x3dec('0x12')]===0x1f4){logger[_0x3dec('0x11')](_0x3dec('0x13'),_0x1826ab,_0x599552[_0x3dec('0x11')][_0x3dec('0x14')]);return _0x4b32d2(_0x599552[_0x3dec('0x11')]['message']);}logger['error'](_0x3dec('0x13'),_0x1826ab,_0x599552['error'][_0x3dec('0x14')]);return _0x207dcf(_0x599552[_0x3dec('0x11')]['message']);}else{logger['info'](_0x3dec('0x13'),_0x1826ab,'request\x20sent');_0x207dcf(_0x599552[_0x3dec('0x15')]['message']);}})[_0x3dec('0x16')](function(_0x51cb2c){logger[_0x3dec('0x11')](_0x3dec('0x13'),_0x1826ab,_0x51cb2c);_0x4b32d2(_0x51cb2c);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 174bec1..98b273e 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 _0x983f=['/:id','isAuthenticated','create','put','update','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index'];(function(_0xc05b58,_0x533473){var _0x44f0a0=function(_0x310192){while(--_0x310192){_0xc05b58['push'](_0xc05b58['shift']());}};_0x44f0a0(++_0x533473);}(_0x983f,0xd3));var _0xf983=function(_0x4416ff,_0x1daf8c){_0x4416ff=_0x4416ff-0x0;var _0x5f30ed=_0x983f[_0x4416ff];return _0x5f30ed;};'use strict';var multer=require('multer');var util=require(_0xf983('0x0'));var path=require(_0xf983('0x1'));var timeout=require('connect-timeout');var express=require(_0xf983('0x2'));var router=express['Router']();var fs_extra=require(_0xf983('0x3'));var auth=require(_0xf983('0x4'));var interaction=require(_0xf983('0x5'));var config=require(_0xf983('0x6'));var controller=require(_0xf983('0x7'));router[_0xf983('0x8')]('/',auth['isAuthenticated'](),controller[_0xf983('0x9')]);router[_0xf983('0x8')](_0xf983('0xa'),auth[_0xf983('0xb')](),controller['show']);router['post']('/',auth[_0xf983('0xb')](),controller[_0xf983('0xc')]);router[_0xf983('0xd')](_0xf983('0xa'),auth[_0xf983('0xb')](),controller[_0xf983('0xe')]);router['delete'](_0xf983('0xa'),auth['isAuthenticated'](),controller[_0xf983('0xf')]);module[_0xf983('0x10')]=router; \ No newline at end of file +var _0x4e4a=['../../config/environment','./intDeskField.controller','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x48bf5f,_0x4e801c){var _0x18463c=function(_0x71723c){while(--_0x71723c){_0x48bf5f['push'](_0x48bf5f['shift']());}};_0x18463c(++_0x4e801c);}(_0x4e4a,0x15d));var _0xa4e4=function(_0x48ef6b,_0x1f535a){_0x48ef6b=_0x48ef6b-0x0;var _0x4157b3=_0x4e4a[_0x48ef6b];return _0x4157b3;};'use strict';var multer=require(_0xa4e4('0x0'));var util=require(_0xa4e4('0x1'));var path=require(_0xa4e4('0x2'));var timeout=require(_0xa4e4('0x3'));var express=require('express');var router=express[_0xa4e4('0x4')]();var fs_extra=require(_0xa4e4('0x5'));var auth=require(_0xa4e4('0x6'));var interaction=require(_0xa4e4('0x7'));var config=require(_0xa4e4('0x8'));var controller=require(_0xa4e4('0x9'));router[_0xa4e4('0xa')]('/',auth['isAuthenticated'](),controller[_0xa4e4('0xb')]);router['get'](_0xa4e4('0xc'),auth[_0xa4e4('0xd')](),controller['show']);router[_0xa4e4('0xe')]('/',auth[_0xa4e4('0xd')](),controller[_0xa4e4('0xf')]);router[_0xa4e4('0x10')](_0xa4e4('0xc'),auth[_0xa4e4('0xd')](),controller[_0xa4e4('0x11')]);router[_0xa4e4('0x12')](_0xa4e4('0xc'),auth[_0xa4e4('0xd')](),controller[_0xa4e4('0x13')]);module[_0xa4e4('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index c019955..0ac4548 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 _0x5295=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0xfb2261,_0x14c678){var _0x19abe5=function(_0x12cf2c){while(--_0x12cf2c){_0xfb2261['push'](_0xfb2261['shift']());}};_0x19abe5(++_0x14c678);}(_0x5295,0x1d0));var _0x5529=function(_0x6881c3,_0x3a532f){_0x6881c3=_0x6881c3-0x0;var _0x5d7a58=_0x5295[_0x6881c3];return _0x5d7a58;};'use strict';var Sequelize=require(_0x5529('0x0'));module[_0x5529('0x1')]={'type':{'type':Sequelize[_0x5529('0x2')](_0x5529('0x3'),_0x5529('0x4'),_0x5529('0x5'),_0x5529('0x6'),'picklist'),'defaultValue':_0x5529('0x3')},'content':{'type':Sequelize[_0x5529('0x7')]},'key':{'type':Sequelize[_0x5529('0x7')]},'keyType':{'type':Sequelize[_0x5529('0x2')]('string',_0x5529('0x4'),_0x5529('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5529('0x7')]},'nameField':{'type':Sequelize[_0x5529('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x69b5=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x50cd9d,_0xa509cc){var _0x33b72c=function(_0x175f0c){while(--_0x175f0c){_0x50cd9d['push'](_0x50cd9d['shift']());}};_0x33b72c(++_0xa509cc);}(_0x69b5,0x144));var _0x569b=function(_0x1cc925,_0x4c59a1){_0x1cc925=_0x1cc925-0x0;var _0x5a2e6c=_0x69b5[_0x1cc925];return _0x5a2e6c;};'use strict';var Sequelize=require(_0x569b('0x0'));module[_0x569b('0x1')]={'type':{'type':Sequelize[_0x569b('0x2')](_0x569b('0x3'),_0x569b('0x4'),_0x569b('0x5'),_0x569b('0x6'),_0x569b('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x569b('0x8')]},'keyType':{'type':Sequelize[_0x569b('0x2')](_0x569b('0x3'),_0x569b('0x4'),_0x569b('0x5'))},'keyContent':{'type':Sequelize[_0x569b('0x8')]},'idField':{'type':Sequelize[_0x569b('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x569b('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 7484ea3..add84b3 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 _0xd3e7=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','intersection','find','create','catch','body','params','destroy','eml-format','zip-dir','moment','bluebird','mustache','util','path'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0xd3e7,0xe3));var _0x7d3e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd3e7[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x7d3e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d3e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7d3e('0x2'));var BPromise=require(_0x7d3e('0x3'));var Mustache=require(_0x7d3e('0x4'));var util=require(_0x7d3e('0x5'));var path=require(_0x7d3e('0x6'));var sox=require(_0x7d3e('0x7'));var csv=require(_0x7d3e('0x8'));var ejs=require(_0x7d3e('0x9'));var fs=require('fs');var fs_extra=require(_0x7d3e('0xa'));var _=require(_0x7d3e('0xb'));var squel=require(_0x7d3e('0xc'));var crypto=require(_0x7d3e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7d3e('0x8'));var querystring=require(_0x7d3e('0xe'));var Papa=require(_0x7d3e('0xf'));var Redis=require(_0x7d3e('0x10'));var authService=require(_0x7d3e('0x11'));var qs=require(_0x7d3e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d3e('0x13'))(_0x7d3e('0x14'));var utils=require(_0x7d3e('0x15'));var config=require(_0x7d3e('0x16'));var licenseUtil=require(_0x7d3e('0x17'));var db=require(_0x7d3e('0x18'))['db'];function respondWithStatusCode(_0x5647a5,_0x38e4b2){_0x38e4b2=_0x38e4b2||0xcc;return function(_0x4054d1){if(_0x4054d1){return _0x5647a5[_0x7d3e('0x19')](_0x38e4b2);}return _0x5647a5['status'](_0x38e4b2)[_0x7d3e('0x1a')]();};}function respondWithResult(_0x49293a,_0x1f3a17){_0x1f3a17=_0x1f3a17||0xc8;return function(_0x4cb9f8){if(_0x4cb9f8){return _0x49293a[_0x7d3e('0x1b')](_0x1f3a17)[_0x7d3e('0x1c')](_0x4cb9f8);}};}function respondWithFilteredResult(_0x412891,_0x214367){return function(_0x5bb444){if(_0x5bb444){var _0x1ebe28=typeof _0x214367[_0x7d3e('0x1d')]===_0x7d3e('0x1e')&&typeof _0x214367[_0x7d3e('0x1f')]===_0x7d3e('0x1e');var _0x4f69b4=_0x5bb444['count'];var _0x4a3d6d=_0x1ebe28?0x0:_0x214367[_0x7d3e('0x1d')];var _0x3eb417=_0x1ebe28?_0x5bb444['count']:_0x214367[_0x7d3e('0x1d')]+_0x214367[_0x7d3e('0x1f')];var _0xacc105;if(_0x3eb417>=_0x4f69b4){_0x3eb417=_0x4f69b4;_0xacc105=0xc8;}else{_0xacc105=0xce;}_0x412891[_0x7d3e('0x1b')](_0xacc105);return _0x412891[_0x7d3e('0x20')](_0x7d3e('0x21'),_0x4a3d6d+'-'+_0x3eb417+'/'+_0x4f69b4)['json'](_0x5bb444);}return null;};}function patchUpdates(_0x28e5bf){return function(_0x295ef1){try{jsonpatch[_0x7d3e('0x22')](_0x295ef1,_0x28e5bf,!![]);}catch(_0x48b978){return BPromise[_0x7d3e('0x23')](_0x48b978);}return _0x295ef1[_0x7d3e('0x24')]();};}function saveUpdates(_0x5bacbd,_0x2de157){return function(_0x24b996){if(_0x24b996){return _0x24b996[_0x7d3e('0x25')](_0x5bacbd)[_0x7d3e('0x26')](function(_0x2b9cb6){return _0x2b9cb6;});}return null;};}function removeEntity(_0x479171,_0x42c808){return function(_0x4d8831){if(_0x4d8831){return _0x4d8831['destroy']()[_0x7d3e('0x26')](function(){_0x479171[_0x7d3e('0x1b')](0xcc)[_0x7d3e('0x1a')]();});}};}function handleEntityNotFound(_0x511cbf,_0x4cf22f){return function(_0x4282dd){if(!_0x4282dd){_0x511cbf[_0x7d3e('0x19')](0x194);}return _0x4282dd;};}function handleError(_0x31f53e,_0x4cad21){_0x4cad21=_0x4cad21||0x1f4;return function(_0x597dcb){logger[_0x7d3e('0x27')](_0x597dcb[_0x7d3e('0x28')]);if(_0x597dcb[_0x7d3e('0x29')]){delete _0x597dcb[_0x7d3e('0x29')];}_0x31f53e[_0x7d3e('0x1b')](_0x4cad21)[_0x7d3e('0x2a')](_0x597dcb);};}exports[_0x7d3e('0x2b')]=function(_0x4b90f7,_0x45cd39){var _0x4c0087={},_0x31161b={},_0x4f7ac9={'count':0x0,'rows':[]};var _0x41b14a=_[_0x7d3e('0x2c')](db[_0x7d3e('0x2d')][_0x7d3e('0x2e')],function(_0x49b4db){return{'name':_0x49b4db[_0x7d3e('0x2f')],'type':_0x49b4db[_0x7d3e('0x30')][_0x7d3e('0x31')]};});_0x31161b[_0x7d3e('0x32')]=_[_0x7d3e('0x2c')](_0x41b14a,'name');_0x31161b['query']=_[_0x7d3e('0x33')](_0x4b90f7[_0x7d3e('0x34')]);_0x31161b[_0x7d3e('0x35')]=_['intersection'](_0x31161b[_0x7d3e('0x32')],_0x31161b[_0x7d3e('0x34')]);_0x4c0087[_0x7d3e('0x36')]=_['intersection'](_0x31161b[_0x7d3e('0x32')],qs[_0x7d3e('0x37')](_0x4b90f7['query']['fields']));_0x4c0087[_0x7d3e('0x36')]=_0x4c0087[_0x7d3e('0x36')][_0x7d3e('0x38')]?_0x4c0087['attributes']:_0x31161b['model'];if(!_0x4b90f7[_0x7d3e('0x34')][_0x7d3e('0x39')](_0x7d3e('0x3a'))){_0x4c0087[_0x7d3e('0x1f')]=qs[_0x7d3e('0x1f')](_0x4b90f7[_0x7d3e('0x34')][_0x7d3e('0x1f')]);_0x4c0087['offset']=qs[_0x7d3e('0x1d')](_0x4b90f7[_0x7d3e('0x34')][_0x7d3e('0x1d')]);}_0x4c0087['order']=qs[_0x7d3e('0x3b')](_0x4b90f7['query'][_0x7d3e('0x3b')]);_0x4c0087['where']=qs[_0x7d3e('0x35')](_[_0x7d3e('0x3c')](_0x4b90f7[_0x7d3e('0x34')],_0x31161b[_0x7d3e('0x35')]),_0x41b14a);if(_0x4b90f7[_0x7d3e('0x34')]['filter']){_0x4c0087[_0x7d3e('0x3d')]=_[_0x7d3e('0x3e')](_0x4c0087['where'],{'$or':_[_0x7d3e('0x2c')](_0x41b14a,function(_0x3adbf6){if(_0x3adbf6[_0x7d3e('0x30')]!==_0x7d3e('0x3f')){var _0x43ed00={};_0x43ed00[_0x3adbf6['name']]={'$like':'%'+_0x4b90f7[_0x7d3e('0x34')]['filter']+'%'};return _0x43ed00;}})});}_0x4c0087=_['merge']({},_0x4c0087,_0x4b90f7[_0x7d3e('0x40')]);var _0x2ef00f={'where':_0x4c0087['where']};return db[_0x7d3e('0x2d')]['count'](_0x2ef00f)['then'](function(_0x4a2d91){_0x4f7ac9[_0x7d3e('0x41')]=_0x4a2d91;if(_0x4b90f7['query'][_0x7d3e('0x42')]){_0x4c0087[_0x7d3e('0x43')]=[{'all':!![]}];}return db[_0x7d3e('0x2d')][_0x7d3e('0x44')](_0x4c0087);})['then'](function(_0x57a3e7){_0x4f7ac9[_0x7d3e('0x45')]=_0x57a3e7;return _0x4f7ac9;})[_0x7d3e('0x26')](respondWithFilteredResult(_0x45cd39,_0x4c0087))['catch'](handleError(_0x45cd39,null));};exports[_0x7d3e('0x46')]=function(_0x1e816c,_0x37fe97){var _0x22e168={'raw':!![],'where':{'id':_0x1e816c['params']['id']}},_0x526dc2={};_0x526dc2['model']=_[_0x7d3e('0x33')](db['DeskField'][_0x7d3e('0x2e')]);_0x526dc2[_0x7d3e('0x34')]=_['keys'](_0x1e816c['query']);_0x526dc2[_0x7d3e('0x35')]=_['intersection'](_0x526dc2[_0x7d3e('0x32')],_0x526dc2[_0x7d3e('0x34')]);_0x22e168[_0x7d3e('0x36')]=_[_0x7d3e('0x47')](_0x526dc2[_0x7d3e('0x32')],qs['fields'](_0x1e816c[_0x7d3e('0x34')][_0x7d3e('0x37')]));_0x22e168['attributes']=_0x22e168[_0x7d3e('0x36')][_0x7d3e('0x38')]?_0x22e168[_0x7d3e('0x36')]:_0x526dc2[_0x7d3e('0x32')];if(_0x1e816c[_0x7d3e('0x34')][_0x7d3e('0x42')]){_0x22e168['include']=[{'all':!![]}];}_0x22e168=_[_0x7d3e('0x3e')]({},_0x22e168,_0x1e816c[_0x7d3e('0x40')]);return db[_0x7d3e('0x2d')][_0x7d3e('0x48')](_0x22e168)['then'](handleEntityNotFound(_0x37fe97,null))['then'](respondWithResult(_0x37fe97,null))['catch'](handleError(_0x37fe97,null));};exports[_0x7d3e('0x49')]=function(_0x1a71af,_0x578eae){return db[_0x7d3e('0x2d')][_0x7d3e('0x49')](_0x1a71af['body'],{})[_0x7d3e('0x26')](respondWithResult(_0x578eae,0xc9))[_0x7d3e('0x4a')](handleError(_0x578eae,null));};exports[_0x7d3e('0x25')]=function(_0xdce9c8,_0x741274){if(_0xdce9c8['body']['id']){delete _0xdce9c8[_0x7d3e('0x4b')]['id'];}return db['DeskField'][_0x7d3e('0x48')]({'where':{'id':_0xdce9c8[_0x7d3e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x741274,null))[_0x7d3e('0x26')](saveUpdates(_0xdce9c8[_0x7d3e('0x4b')],null))[_0x7d3e('0x26')](respondWithResult(_0x741274,null))[_0x7d3e('0x4a')](handleError(_0x741274,null));};exports[_0x7d3e('0x4d')]=function(_0x1fa327,_0x960709){return db[_0x7d3e('0x2d')][_0x7d3e('0x48')]({'where':{'id':_0x1fa327[_0x7d3e('0x4c')]['id']}})[_0x7d3e('0x26')](handleEntityNotFound(_0x960709,null))['then'](removeEntity(_0x960709,null))['catch'](handleError(_0x960709,null));}; \ No newline at end of file +var _0x28e1=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','apply','save','then','destroy','end','stack','name','send','index','DeskField','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','update','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service'];(function(_0x38a6a8,_0x3d7c35){var _0x129793=function(_0x5a17bc){while(--_0x5a17bc){_0x38a6a8['push'](_0x38a6a8['shift']());}};_0x129793(++_0x3d7c35);}(_0x28e1,0x85));var _0x128e=function(_0x3c718d,_0x2f16d8){_0x3c718d=_0x3c718d-0x0;var _0x2d3979=_0x28e1[_0x3c718d];return _0x2d3979;};'use strict';var emlformat=require(_0x128e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x128e('0x1'));var jsonpatch=require(_0x128e('0x2'));var rp=require(_0x128e('0x3'));var moment=require(_0x128e('0x4'));var BPromise=require(_0x128e('0x5'));var Mustache=require(_0x128e('0x6'));var util=require(_0x128e('0x7'));var path=require(_0x128e('0x8'));var sox=require('sox');var csv=require(_0x128e('0x9'));var ejs=require(_0x128e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x128e('0xb'));var squel=require(_0x128e('0xc'));var crypto=require('crypto');var jsforce=require(_0x128e('0xd'));var deskjs=require(_0x128e('0xe'));var toCsv=require(_0x128e('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x128e('0xf'));var authService=require(_0x128e('0x10'));var qs=require(_0x128e('0x11'));var as=require(_0x128e('0x12'));var hardwareService=require(_0x128e('0x13'));var logger=require(_0x128e('0x14'))(_0x128e('0x15'));var utils=require(_0x128e('0x16'));var config=require(_0x128e('0x17'));var licenseUtil=require(_0x128e('0x18'));var db=require(_0x128e('0x19'))['db'];function respondWithStatusCode(_0x6ef473,_0x207e14){_0x207e14=_0x207e14||0xcc;return function(_0x2f392c){if(_0x2f392c){return _0x6ef473[_0x128e('0x1a')](_0x207e14);}return _0x6ef473[_0x128e('0x1b')](_0x207e14)['end']();};}function respondWithResult(_0x3f3a5a,_0xb8daaf){_0xb8daaf=_0xb8daaf||0xc8;return function(_0x5ebe21){if(_0x5ebe21){return _0x3f3a5a[_0x128e('0x1b')](_0xb8daaf)[_0x128e('0x1c')](_0x5ebe21);}};}function respondWithFilteredResult(_0x20b892,_0x1f2916){return function(_0x4f2e99){if(_0x4f2e99){var _0x45e477=typeof _0x1f2916['offset']==='undefined'&&typeof _0x1f2916[_0x128e('0x1d')]===_0x128e('0x1e');var _0x15b5d9=_0x4f2e99['count'];var _0x4bc251=_0x45e477?0x0:_0x1f2916[_0x128e('0x1f')];var _0x203e45=_0x45e477?_0x4f2e99[_0x128e('0x20')]:_0x1f2916[_0x128e('0x1f')]+_0x1f2916[_0x128e('0x1d')];var _0x57e11c;if(_0x203e45>=_0x15b5d9){_0x203e45=_0x15b5d9;_0x57e11c=0xc8;}else{_0x57e11c=0xce;}_0x20b892[_0x128e('0x1b')](_0x57e11c);return _0x20b892[_0x128e('0x21')](_0x128e('0x22'),_0x4bc251+'-'+_0x203e45+'/'+_0x15b5d9)[_0x128e('0x1c')](_0x4f2e99);}return null;};}function patchUpdates(_0x26eeaf){return function(_0x78ee3b){try{jsonpatch[_0x128e('0x23')](_0x78ee3b,_0x26eeaf,!![]);}catch(_0x126647){return BPromise['reject'](_0x126647);}return _0x78ee3b[_0x128e('0x24')]();};}function saveUpdates(_0xd95f27,_0x183244){return function(_0x28d2a9){if(_0x28d2a9){return _0x28d2a9['update'](_0xd95f27)[_0x128e('0x25')](function(_0x17b835){return _0x17b835;});}return null;};}function removeEntity(_0xfa9135,_0xc5ce20){return function(_0x79287e){if(_0x79287e){return _0x79287e[_0x128e('0x26')]()[_0x128e('0x25')](function(){_0xfa9135['status'](0xcc)[_0x128e('0x27')]();});}};}function handleEntityNotFound(_0xd996a6,_0x4afc84){return function(_0x180e5b){if(!_0x180e5b){_0xd996a6[_0x128e('0x1a')](0x194);}return _0x180e5b;};}function handleError(_0x555ed2,_0xf4c62a){_0xf4c62a=_0xf4c62a||0x1f4;return function(_0x13493f){logger['error'](_0x13493f[_0x128e('0x28')]);if(_0x13493f['name']){delete _0x13493f[_0x128e('0x29')];}_0x555ed2[_0x128e('0x1b')](_0xf4c62a)[_0x128e('0x2a')](_0x13493f);};}exports[_0x128e('0x2b')]=function(_0x26630d,_0x98164){var _0x2ddcf5={},_0x45ab6b={},_0x3ca3f0={'count':0x0,'rows':[]};var _0x30fda1=_['map'](db[_0x128e('0x2c')][_0x128e('0x2d')],function(_0x51322b){return{'name':_0x51322b['fieldName'],'type':_0x51322b[_0x128e('0x2e')][_0x128e('0x2f')]};});_0x45ab6b[_0x128e('0x30')]=_[_0x128e('0x31')](_0x30fda1,_0x128e('0x29'));_0x45ab6b['query']=_[_0x128e('0x32')](_0x26630d[_0x128e('0x33')]);_0x45ab6b[_0x128e('0x34')]=_[_0x128e('0x35')](_0x45ab6b[_0x128e('0x30')],_0x45ab6b['query']);_0x2ddcf5[_0x128e('0x36')]=_[_0x128e('0x35')](_0x45ab6b[_0x128e('0x30')],qs['fields'](_0x26630d[_0x128e('0x33')][_0x128e('0x37')]));_0x2ddcf5[_0x128e('0x36')]=_0x2ddcf5[_0x128e('0x36')]['length']?_0x2ddcf5[_0x128e('0x36')]:_0x45ab6b['model'];if(!_0x26630d['query']['hasOwnProperty'](_0x128e('0x38'))){_0x2ddcf5[_0x128e('0x1d')]=qs[_0x128e('0x1d')](_0x26630d[_0x128e('0x33')][_0x128e('0x1d')]);_0x2ddcf5['offset']=qs['offset'](_0x26630d['query'][_0x128e('0x1f')]);}_0x2ddcf5['order']=qs[_0x128e('0x39')](_0x26630d[_0x128e('0x33')][_0x128e('0x39')]);_0x2ddcf5[_0x128e('0x3a')]=qs[_0x128e('0x34')](_[_0x128e('0x3b')](_0x26630d[_0x128e('0x33')],_0x45ab6b[_0x128e('0x34')]),_0x30fda1);if(_0x26630d['query'][_0x128e('0x3c')]){_0x2ddcf5[_0x128e('0x3a')]=_['merge'](_0x2ddcf5[_0x128e('0x3a')],{'$or':_[_0x128e('0x31')](_0x30fda1,function(_0x5681c0){if(_0x5681c0['type']!==_0x128e('0x3d')){var _0xb5c00e={};_0xb5c00e[_0x5681c0['name']]={'$like':'%'+_0x26630d['query'][_0x128e('0x3c')]+'%'};return _0xb5c00e;}})});}_0x2ddcf5=_['merge']({},_0x2ddcf5,_0x26630d[_0x128e('0x3e')]);var _0x4f909e={'where':_0x2ddcf5[_0x128e('0x3a')]};return db[_0x128e('0x2c')]['count'](_0x4f909e)[_0x128e('0x25')](function(_0x2d75f1){_0x3ca3f0[_0x128e('0x20')]=_0x2d75f1;if(_0x26630d[_0x128e('0x33')][_0x128e('0x3f')]){_0x2ddcf5[_0x128e('0x40')]=[{'all':!![]}];}return db[_0x128e('0x2c')][_0x128e('0x41')](_0x2ddcf5);})[_0x128e('0x25')](function(_0x203c24){_0x3ca3f0[_0x128e('0x42')]=_0x203c24;return _0x3ca3f0;})[_0x128e('0x25')](respondWithFilteredResult(_0x98164,_0x2ddcf5))[_0x128e('0x43')](handleError(_0x98164,null));};exports[_0x128e('0x44')]=function(_0x5e4635,_0x36ab4b){var _0x565014={'raw':!![],'where':{'id':_0x5e4635[_0x128e('0x45')]['id']}},_0x3bf13d={};_0x3bf13d[_0x128e('0x30')]=_['keys'](db[_0x128e('0x2c')]['rawAttributes']);_0x3bf13d[_0x128e('0x33')]=_[_0x128e('0x32')](_0x5e4635[_0x128e('0x33')]);_0x3bf13d[_0x128e('0x34')]=_['intersection'](_0x3bf13d[_0x128e('0x30')],_0x3bf13d[_0x128e('0x33')]);_0x565014['attributes']=_[_0x128e('0x35')](_0x3bf13d[_0x128e('0x30')],qs[_0x128e('0x37')](_0x5e4635[_0x128e('0x33')][_0x128e('0x37')]));_0x565014[_0x128e('0x36')]=_0x565014[_0x128e('0x36')][_0x128e('0x46')]?_0x565014[_0x128e('0x36')]:_0x3bf13d['model'];if(_0x5e4635['query'][_0x128e('0x3f')]){_0x565014[_0x128e('0x40')]=[{'all':!![]}];}_0x565014=_['merge']({},_0x565014,_0x5e4635[_0x128e('0x3e')]);return db[_0x128e('0x2c')]['find'](_0x565014)[_0x128e('0x25')](handleEntityNotFound(_0x36ab4b,null))[_0x128e('0x25')](respondWithResult(_0x36ab4b,null))[_0x128e('0x43')](handleError(_0x36ab4b,null));};exports[_0x128e('0x47')]=function(_0x215162,_0xe3619){return db[_0x128e('0x2c')]['create'](_0x215162[_0x128e('0x48')],{})[_0x128e('0x25')](respondWithResult(_0xe3619,0xc9))[_0x128e('0x43')](handleError(_0xe3619,null));};exports[_0x128e('0x49')]=function(_0x29174c,_0x24dcd8){if(_0x29174c['body']['id']){delete _0x29174c[_0x128e('0x48')]['id'];}return db['DeskField'][_0x128e('0x4a')]({'where':{'id':_0x29174c[_0x128e('0x45')]['id']}})[_0x128e('0x25')](handleEntityNotFound(_0x24dcd8,null))['then'](saveUpdates(_0x29174c[_0x128e('0x48')],null))['then'](respondWithResult(_0x24dcd8,null))[_0x128e('0x43')](handleError(_0x24dcd8,null));};exports[_0x128e('0x26')]=function(_0x3074c9,_0x4896b7){return db[_0x128e('0x2c')][_0x128e('0x4a')]({'where':{'id':_0x3074c9[_0x128e('0x45')]['id']}})[_0x128e('0x25')](handleEntityNotFound(_0x4896b7,null))[_0x128e('0x25')](removeEntity(_0x4896b7,null))['catch'](handleError(_0x4896b7,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 03484a5..424f375 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 _0x30f5=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x42708d,_0x251f79){var _0xcff127=function(_0x1af08f){while(--_0x1af08f){_0x42708d['push'](_0x42708d['shift']());}};_0xcff127(++_0x251f79);}(_0x30f5,0x14e));var _0x530f=function(_0x31c81b,_0x4a2b1c){_0x31c81b=_0x31c81b-0x0;var _0x52ab34=_0x30f5[_0x31c81b];return _0x52ab34;};'use strict';var _=require(_0x530f('0x0'));var util=require(_0x530f('0x1'));var logger=require(_0x530f('0x2'))(_0x530f('0x3'));var moment=require(_0x530f('0x4'));var BPromise=require(_0x530f('0x5'));var rp=require(_0x530f('0x6'));var fs=require('fs');var path=require(_0x530f('0x7'));var rimraf=require(_0x530f('0x8'));var config=require(_0x530f('0x9'));var attributes=require(_0x530f('0xa'));module[_0x530f('0xb')]=function(_0x1678fd,_0x4007fd){return _0x1678fd[_0x530f('0xc')](_0x530f('0xd'),attributes,{'tableName':_0x530f('0xe'),'paranoid':![],'indexes':[{'name':_0x530f('0xf'),'fields':[_0x530f('0x10'),_0x530f('0x11')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9460=['path','rimraf','../../config/environment','exports','define','int_desk_fields','desk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xe61544,_0x30b2d2){var _0x58cc3e=function(_0x4fa6c7){while(--_0x4fa6c7){_0xe61544['push'](_0xe61544['shift']());}};_0x58cc3e(++_0x30b2d2);}(_0x9460,0x9e));var _0x0946=function(_0x14b547,_0x1bfdb7){_0x14b547=_0x14b547-0x0;var _0xfa3498=_0x9460[_0x14b547];return _0xfa3498;};'use strict';var _=require(_0x0946('0x0'));var util=require(_0x0946('0x1'));var logger=require(_0x0946('0x2'))(_0x0946('0x3'));var moment=require(_0x0946('0x4'));var BPromise=require(_0x0946('0x5'));var rp=require(_0x0946('0x6'));var fs=require('fs');var path=require(_0x0946('0x7'));var rimraf=require(_0x0946('0x8'));var config=require(_0x0946('0x9'));var attributes=require('./intDeskField.attributes');module[_0x0946('0xa')]=function(_0x259cca,_0x55e44a){return _0x259cca[_0x0946('0xb')]('DeskField',attributes,{'tableName':_0x0946('0xc'),'paranoid':![],'indexes':[{'name':_0x0946('0xd'),'fields':['idField',_0x0946('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 7ac038d..27ec463 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 _0x65f0=['DeskField,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x65f0,0x155));var _0x065f=function(_0x5ac67c,_0x467ce2){_0x5ac67c=_0x5ac67c-0x0;var _0x190f4b=_0x65f0[_0x5ac67c];return _0x190f4b;};'use strict';var _=require(_0x065f('0x0'));var util=require(_0x065f('0x1'));var moment=require(_0x065f('0x2'));var BPromise=require('bluebird');var rs=require(_0x065f('0x3'));var fs=require('fs');var Redis=require(_0x065f('0x4'));var db=require(_0x065f('0x5'))['db'];var utils=require(_0x065f('0x6'));var logger=require(_0x065f('0x7'))(_0x065f('0x8'));var config=require(_0x065f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x065f('0xa')][_0x065f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8295a2,_0x51f403,_0x3b45de){return new BPromise(function(_0x38424c,_0x200ce8){return client['request'](_0x8295a2,_0x3b45de)[_0x065f('0xc')](function(_0x2d378f){logger[_0x065f('0xd')](_0x065f('0xe'),_0x51f403,_0x065f('0xf'));logger['debug'](_0x065f('0x10'),_0x51f403,'request\x20sent',JSON['stringify'](_0x2d378f));if(_0x2d378f['error']){if(_0x2d378f[_0x065f('0x11')][_0x065f('0x12')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x51f403,_0x2d378f[_0x065f('0x11')][_0x065f('0x13')]);return _0x200ce8(_0x2d378f['error'][_0x065f('0x13')]);}logger[_0x065f('0x11')](_0x065f('0xe'),_0x51f403,_0x2d378f[_0x065f('0x11')][_0x065f('0x13')]);return _0x38424c(_0x2d378f[_0x065f('0x11')][_0x065f('0x13')]);}else{logger[_0x065f('0xd')](_0x065f('0xe'),_0x51f403,'request\x20sent');_0x38424c(_0x2d378f['result']['message']);}})[_0x065f('0x14')](function(_0x7b381a){logger[_0x065f('0x11')]('DeskField,\x20%s,\x20%s',_0x51f403,_0x7b381a);_0x200ce8(_0x7b381a);});});} \ No newline at end of file +var _0x723c=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x3238ea,_0x91809d){var _0x4aaac2=function(_0xc5b102){while(--_0xc5b102){_0x3238ea['push'](_0x3238ea['shift']());}};_0x4aaac2(++_0x91809d);}(_0x723c,0x18f));var _0xc723=function(_0x4dd707,_0x3acf32){_0x4dd707=_0x4dd707-0x0;var _0x41d37a=_0x723c[_0x4dd707];return _0x41d37a;};'use strict';var _=require(_0xc723('0x0'));var util=require('util');var moment=require(_0xc723('0x1'));var BPromise=require(_0xc723('0x2'));var rs=require(_0xc723('0x3'));var fs=require('fs');var Redis=require(_0xc723('0x4'));var db=require(_0xc723('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc723('0x6'));var config=require(_0xc723('0x7'));var jayson=require(_0xc723('0x8'));var client=jayson[_0xc723('0x9')][_0xc723('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x144824,_0x5c5289,_0x4e110d){return new BPromise(function(_0x221051,_0x336c17){return client['request'](_0x144824,_0x4e110d)[_0xc723('0xb')](function(_0x37b0d0){logger[_0xc723('0xc')](_0xc723('0xd'),_0x5c5289,_0xc723('0xe'));logger[_0xc723('0xf')](_0xc723('0x10'),_0x5c5289,_0xc723('0xe'),JSON['stringify'](_0x37b0d0));if(_0x37b0d0[_0xc723('0x11')]){if(_0x37b0d0['error'][_0xc723('0x12')]===0x1f4){logger[_0xc723('0x11')]('DeskField,\x20%s,\x20%s',_0x5c5289,_0x37b0d0['error'][_0xc723('0x13')]);return _0x336c17(_0x37b0d0[_0xc723('0x11')][_0xc723('0x13')]);}logger[_0xc723('0x11')](_0xc723('0xd'),_0x5c5289,_0x37b0d0[_0xc723('0x11')][_0xc723('0x13')]);return _0x221051(_0x37b0d0['error']['message']);}else{logger[_0xc723('0xc')](_0xc723('0xd'),_0x5c5289,_0xc723('0xe'));_0x221051(_0x37b0d0['result'][_0xc723('0x13')]);}})[_0xc723('0x14')](function(_0x5c969b){logger['error'](_0xc723('0xd'),_0x5c5289,_0x5c969b);_0x336c17(_0x5c969b);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index bee09fe..05a79cb 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 _0xea8c=['../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3db33c,_0xf0197c){var _0x338471=function(_0x3e062d){while(--_0x3e062d){_0x3db33c['push'](_0x3db33c['shift']());}};_0x338471(++_0xf0197c);}(_0xea8c,0x9a));var _0xcea8=function(_0x547611,_0x2f48f7){_0x547611=_0x547611-0x0;var _0x3a9d02=_0xea8c[_0x547611];return _0x3a9d02;};'use strict';var multer=require('multer');var util=require(_0xcea8('0x0'));var path=require(_0xcea8('0x1'));var timeout=require(_0xcea8('0x2'));var express=require('express');var router=express[_0xcea8('0x3')]();var fs_extra=require(_0xcea8('0x4'));var auth=require(_0xcea8('0x5'));var interaction=require(_0xcea8('0x6'));var config=require(_0xcea8('0x7'));var controller=require('./intDynamics365Account.controller');router[_0xcea8('0x8')]('/',auth[_0xcea8('0x9')](),controller[_0xcea8('0xa')]);router[_0xcea8('0x8')](_0xcea8('0xb'),auth['isAuthenticated'](),controller[_0xcea8('0xc')]);router[_0xcea8('0x8')](_0xcea8('0xd'),auth[_0xcea8('0x9')](),controller[_0xcea8('0xe')]);router[_0xcea8('0x8')]('/:id/fields',auth[_0xcea8('0x9')](),controller[_0xcea8('0xf')]);router[_0xcea8('0x10')]('/',auth['isAuthenticated'](),controller[_0xcea8('0x11')]);router[_0xcea8('0x10')](_0xcea8('0xd'),auth['isAuthenticated'](),controller[_0xcea8('0x12')]);router[_0xcea8('0x13')](_0xcea8('0xb'),auth[_0xcea8('0x9')](),controller[_0xcea8('0x14')]);router[_0xcea8('0x15')](_0xcea8('0xb'),auth[_0xcea8('0x9')](),controller[_0xcea8('0x16')]);module['exports']=router; \ No newline at end of file +var _0xe07e=['addConfiguration','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create'];(function(_0x2e3dfc,_0x454d6c){var _0x4b1245=function(_0x5e9faa){while(--_0x5e9faa){_0x2e3dfc['push'](_0x2e3dfc['shift']());}};_0x4b1245(++_0x454d6c);}(_0xe07e,0x8e));var _0xee07=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0xe07e[_0x1d39f6];return _0x3dbd7a;};'use strict';var multer=require(_0xee07('0x0'));var util=require(_0xee07('0x1'));var path=require(_0xee07('0x2'));var timeout=require(_0xee07('0x3'));var express=require(_0xee07('0x4'));var router=express[_0xee07('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xee07('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xee07('0x7'));var controller=require(_0xee07('0x8'));router[_0xee07('0x9')]('/',auth['isAuthenticated'](),controller[_0xee07('0xa')]);router[_0xee07('0x9')](_0xee07('0xb'),auth[_0xee07('0xc')](),controller[_0xee07('0xd')]);router[_0xee07('0x9')](_0xee07('0xe'),auth[_0xee07('0xc')](),controller[_0xee07('0xf')]);router['get'](_0xee07('0x10'),auth[_0xee07('0xc')](),controller['getFields']);router[_0xee07('0x11')]('/',auth['isAuthenticated'](),controller[_0xee07('0x12')]);router[_0xee07('0x11')](_0xee07('0xe'),auth[_0xee07('0xc')](),controller[_0xee07('0x13')]);router['put']('/:id',auth[_0xee07('0xc')](),controller[_0xee07('0x14')]);router[_0xee07('0x15')](_0xee07('0xb'),auth[_0xee07('0xc')](),controller[_0xee07('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 3339932..665a18a 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 _0xd54d=['STRING'];(function(_0x2cde8a,_0x18949e){var _0x3e36c2=function(_0x54458c){while(--_0x54458c){_0x2cde8a['push'](_0x2cde8a['shift']());}};_0x3e36c2(++_0x18949e);}(_0xd54d,0x6e));var _0xdd54=function(_0x462732,_0x187a81){_0x462732=_0x462732-0x0;var _0x11f5dc=_0xd54d[_0x462732];return _0x11f5dc;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdd54('0x0')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xdd54('0x0')]},'tenantId':{'type':Sequelize[_0xdd54('0x0')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xdd54('0x0')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xdd54('0x0')]}}; \ No newline at end of file +var _0xd133=['sequelize','exports','STRING'];(function(_0x1428d9,_0xded63c){var _0x438019=function(_0x31c37d){while(--_0x31c37d){_0x1428d9['push'](_0x1428d9['shift']());}};_0x438019(++_0xded63c);}(_0xd133,0x84));var _0x3d13=function(_0x20d81d,_0xe5667e){_0x20d81d=_0x20d81d-0x0;var _0x4242e8=_0xd133[_0x20d81d];return _0x4242e8;};'use strict';var Sequelize=require(_0x3d13('0x0'));module[_0x3d13('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x3d13('0x2')]},'clientSecret':{'type':Sequelize[_0x3d13('0x2')]},'serverUrl':{'type':Sequelize[_0x3d13('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3d13('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 5193bdc..f92d302 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 _0x2137=['channel','create','Dynamics365Field','Subjects','getFields','ticketType','incident','Incident','title','customerid','ownerid','caseorigincode','subject','directioncode','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productserialnumber','responseby','responsiblecontactidname','sentimentvalue','slaname','statecode','ticketnumber','timezoneruleversionnumber','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','tenantId','clientSecret','slice','lastIndexOf','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','4.0','Attributes','remove','@odata.type','substring','push','all','isNil','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','forEach','UserLocalizedLabel','Label','Value','LogicalName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','moment','mustache','util','path','fs-extra','lodash','crypto','jsforce','to-csv','ioredis','../../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','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','Dynamics365Account','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','nolimit','sort','filters','filter','where','VIRTUAL','merge','options','rows','catch','show','params','includeAll','include','find','body','getConfigurations','Dynamics365Configuration','rawAttributes','order','pick','addConfiguration','findOne','getSubjects','Descriptions','getDescriptions'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x2137,0x134));var _0x7213=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x2137[_0x4b7895];return _0x264180;};'use strict';var emlformat=require(_0x7213('0x0'));var rimraf=require(_0x7213('0x1'));var zipdir=require(_0x7213('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7213('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7213('0x4'));var util=require(_0x7213('0x5'));var path=require(_0x7213('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7213('0x7'));var _=require(_0x7213('0x8'));var squel=require('squel');var crypto=require(_0x7213('0x9'));var jsforce=require(_0x7213('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7213('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7213('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x7213('0xd'));var as=require(_0x7213('0xe'));var hardwareService=require(_0x7213('0xf'));var logger=require(_0x7213('0x10'))(_0x7213('0x11'));var utils=require(_0x7213('0x12'));var config=require(_0x7213('0x13'));var licenseUtil=require(_0x7213('0x14'));var db=require(_0x7213('0x15'))['db'];var integrations=require(_0x7213('0x16'));function respondWithStatusCode(_0x58e74a,_0x3d0115){_0x3d0115=_0x3d0115||0xcc;return function(_0x413132){if(_0x413132){return _0x58e74a[_0x7213('0x17')](_0x3d0115);}return _0x58e74a[_0x7213('0x18')](_0x3d0115)[_0x7213('0x19')]();};}function respondWithResult(_0x9764e1,_0x121036){_0x121036=_0x121036||0xc8;return function(_0x215750){if(_0x215750){return _0x9764e1[_0x7213('0x18')](_0x121036)[_0x7213('0x1a')](_0x215750);}};}function respondWithFilteredResult(_0xe91a2f,_0x277455){return function(_0x4809fb){if(_0x4809fb){var _0xc6b44e=typeof _0x277455[_0x7213('0x1b')]===_0x7213('0x1c')&&typeof _0x277455[_0x7213('0x1d')]===_0x7213('0x1c');var _0x90bc4d=_0x4809fb[_0x7213('0x1e')];var _0x24e2a5=_0xc6b44e?0x0:_0x277455[_0x7213('0x1b')];var _0xbd1ded=_0xc6b44e?_0x4809fb[_0x7213('0x1e')]:_0x277455[_0x7213('0x1b')]+_0x277455[_0x7213('0x1d')];var _0x4c947b;if(_0xbd1ded>=_0x90bc4d){_0xbd1ded=_0x90bc4d;_0x4c947b=0xc8;}else{_0x4c947b=0xce;}_0xe91a2f[_0x7213('0x18')](_0x4c947b);return _0xe91a2f[_0x7213('0x1f')](_0x7213('0x20'),_0x24e2a5+'-'+_0xbd1ded+'/'+_0x90bc4d)[_0x7213('0x1a')](_0x4809fb);}return null;};}function patchUpdates(_0x1b17d0){return function(_0x5bddc2){try{jsonpatch[_0x7213('0x21')](_0x5bddc2,_0x1b17d0,!![]);}catch(_0x452b5c){return BPromise[_0x7213('0x22')](_0x452b5c);}return _0x5bddc2[_0x7213('0x23')]();};}function saveUpdates(_0x43c17c,_0x2e49d8){return function(_0x13e489){if(_0x13e489){return _0x13e489[_0x7213('0x24')](_0x43c17c)[_0x7213('0x25')](function(_0x4f3756){return _0x4f3756;});}return null;};}function removeEntity(_0x5ddb6b,_0x40d1a6){return function(_0x5627fd){if(_0x5627fd){return _0x5627fd[_0x7213('0x26')]()['then'](function(){_0x5ddb6b[_0x7213('0x18')](0xcc)[_0x7213('0x19')]();});}};}function handleEntityNotFound(_0x4eedf1,_0x5ecadd){return function(_0x4a46ac){if(!_0x4a46ac){_0x4eedf1[_0x7213('0x17')](0x194);}return _0x4a46ac;};}function handleError(_0x139f2f,_0x1e443d){_0x1e443d=_0x1e443d||0x1f4;return function(_0x1740a2){logger[_0x7213('0x27')](_0x1740a2[_0x7213('0x28')]);if(_0x1740a2['name']){delete _0x1740a2['name'];}_0x139f2f[_0x7213('0x18')](_0x1e443d)[_0x7213('0x29')](_0x1740a2);};}exports[_0x7213('0x2a')]=function(_0x59139e,_0x562783){var _0x59a540={},_0x11ed63={},_0x100766={'count':0x0,'rows':[]};var _0x2f8b8c=_[_0x7213('0x2b')](db[_0x7213('0x2c')]['rawAttributes'],function(_0x1c9fb9){return{'name':_0x1c9fb9[_0x7213('0x2d')],'type':_0x1c9fb9[_0x7213('0x2e')][_0x7213('0x2f')]};});_0x11ed63[_0x7213('0x30')]=_[_0x7213('0x2b')](_0x2f8b8c,_0x7213('0x31'));_0x11ed63[_0x7213('0x32')]=_[_0x7213('0x33')](_0x59139e['query']);_0x11ed63['filters']=_[_0x7213('0x34')](_0x11ed63[_0x7213('0x30')],_0x11ed63[_0x7213('0x32')]);_0x59a540[_0x7213('0x35')]=_['intersection'](_0x11ed63[_0x7213('0x30')],qs[_0x7213('0x36')](_0x59139e[_0x7213('0x32')]['fields']));_0x59a540['attributes']=_0x59a540[_0x7213('0x35')][_0x7213('0x37')]?_0x59a540[_0x7213('0x35')]:_0x11ed63[_0x7213('0x30')];if(!_0x59139e[_0x7213('0x32')]['hasOwnProperty'](_0x7213('0x38'))){_0x59a540[_0x7213('0x1d')]=qs['limit'](_0x59139e[_0x7213('0x32')][_0x7213('0x1d')]);_0x59a540['offset']=qs['offset'](_0x59139e['query'][_0x7213('0x1b')]);}_0x59a540['order']=qs[_0x7213('0x39')](_0x59139e[_0x7213('0x32')][_0x7213('0x39')]);_0x59a540['where']=qs[_0x7213('0x3a')](_['pick'](_0x59139e[_0x7213('0x32')],_0x11ed63['filters']),_0x2f8b8c);if(_0x59139e['query'][_0x7213('0x3b')]){_0x59a540[_0x7213('0x3c')]=_['merge'](_0x59a540[_0x7213('0x3c')],{'$or':_[_0x7213('0x2b')](_0x2f8b8c,function(_0x3af817){if(_0x3af817[_0x7213('0x2e')]!==_0x7213('0x3d')){var _0x210728={};_0x210728[_0x3af817[_0x7213('0x31')]]={'$like':'%'+_0x59139e[_0x7213('0x32')][_0x7213('0x3b')]+'%'};return _0x210728;}})});}_0x59a540=_[_0x7213('0x3e')]({},_0x59a540,_0x59139e[_0x7213('0x3f')]);var _0x368ec8={'where':_0x59a540[_0x7213('0x3c')]};return db[_0x7213('0x2c')][_0x7213('0x1e')](_0x368ec8)[_0x7213('0x25')](function(_0x30544c){_0x100766[_0x7213('0x1e')]=_0x30544c;if(_0x59139e[_0x7213('0x32')]['includeAll']){_0x59a540['include']=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x59a540);})['then'](function(_0x567125){_0x100766[_0x7213('0x40')]=_0x567125;return _0x100766;})[_0x7213('0x25')](respondWithFilteredResult(_0x562783,_0x59a540))[_0x7213('0x41')](handleError(_0x562783,null));};exports[_0x7213('0x42')]=function(_0x11faa8,_0x154ce9){var _0x2174d3={'raw':![],'where':{'id':_0x11faa8[_0x7213('0x43')]['id']}},_0x233c6b={};_0x233c6b[_0x7213('0x30')]=_[_0x7213('0x33')](db[_0x7213('0x2c')]['rawAttributes']);_0x233c6b['query']=_['keys'](_0x11faa8['query']);_0x233c6b['filters']=_[_0x7213('0x34')](_0x233c6b['model'],_0x233c6b[_0x7213('0x32')]);_0x2174d3[_0x7213('0x35')]=_[_0x7213('0x34')](_0x233c6b['model'],qs[_0x7213('0x36')](_0x11faa8[_0x7213('0x32')][_0x7213('0x36')]));_0x2174d3['attributes']=_0x2174d3[_0x7213('0x35')][_0x7213('0x37')]?_0x2174d3[_0x7213('0x35')]:_0x233c6b['model'];if(_0x11faa8[_0x7213('0x32')][_0x7213('0x44')]){_0x2174d3[_0x7213('0x45')]=[{'all':!![]}];}_0x2174d3=_[_0x7213('0x3e')]({},_0x2174d3,_0x11faa8[_0x7213('0x3f')]);return db[_0x7213('0x2c')][_0x7213('0x46')](_0x2174d3)[_0x7213('0x25')](handleEntityNotFound(_0x154ce9,null))[_0x7213('0x25')](respondWithResult(_0x154ce9,null))['catch'](handleError(_0x154ce9,null));};exports['create']=function(_0x2d276b,_0x2657c9){return db[_0x7213('0x2c')]['create'](_0x2d276b[_0x7213('0x47')],{})[_0x7213('0x25')](respondWithResult(_0x2657c9,0xc9))['catch'](handleError(_0x2657c9,null));};exports['update']=function(_0x517162,_0x24f637){if(_0x517162[_0x7213('0x47')]['id']){delete _0x517162['body']['id'];}return db[_0x7213('0x2c')][_0x7213('0x46')]({'where':{'id':_0x517162[_0x7213('0x43')]['id']}})[_0x7213('0x25')](handleEntityNotFound(_0x24f637,null))['then'](saveUpdates(_0x517162['body'],null))['then'](respondWithResult(_0x24f637,null))[_0x7213('0x41')](handleError(_0x24f637,null));};exports['destroy']=function(_0x245795,_0x127b24){return db[_0x7213('0x2c')][_0x7213('0x46')]({'where':{'id':_0x245795[_0x7213('0x43')]['id']}})[_0x7213('0x25')](handleEntityNotFound(_0x127b24,null))[_0x7213('0x25')](removeEntity(_0x127b24,null))[_0x7213('0x41')](handleError(_0x127b24,null));};exports[_0x7213('0x48')]=function(_0xc50ec1,_0xe0a818,_0x3c89f9){var _0x4dc545={};var _0x10c778={};var _0x50531c;var _0x4d8313;return db[_0x7213('0x2c')]['findOne']({'where':{'id':_0xc50ec1[_0x7213('0x43')]['id']}})[_0x7213('0x25')](handleEntityNotFound(_0xe0a818,null))[_0x7213('0x25')](function(_0xdeaaef){if(_0xdeaaef){_0x50531c=_0xdeaaef;_0x10c778[_0x7213('0x30')]=_['keys'](db[_0x7213('0x49')][_0x7213('0x4a')]);_0x10c778[_0x7213('0x32')]=_['keys'](_0xc50ec1[_0x7213('0x32')]);_0x10c778[_0x7213('0x3a')]=_['intersection'](_0x10c778[_0x7213('0x30')],_0x10c778[_0x7213('0x32')]);_0x4dc545[_0x7213('0x35')]=_['intersection'](_0x10c778[_0x7213('0x30')],qs[_0x7213('0x36')](_0xc50ec1[_0x7213('0x32')][_0x7213('0x36')]));_0x4dc545['attributes']=_0x4dc545[_0x7213('0x35')][_0x7213('0x37')]?_0x4dc545['attributes']:_0x10c778[_0x7213('0x30')];_0x4dc545[_0x7213('0x4b')]=qs[_0x7213('0x39')](_0xc50ec1[_0x7213('0x32')][_0x7213('0x39')]);_0x4dc545[_0x7213('0x3c')]=qs[_0x7213('0x3a')](_[_0x7213('0x4c')](_0xc50ec1[_0x7213('0x32')],_0x10c778[_0x7213('0x3a')]));if(_0xc50ec1['query'][_0x7213('0x3b')]){_0x4dc545['where']=_[_0x7213('0x3e')](_0x4dc545[_0x7213('0x3c')],{'$or':_[_0x7213('0x2b')](_0x4dc545[_0x7213('0x35')],function(_0x8dd958){var _0x452aeb={};_0x452aeb[_0x8dd958]={'$like':'%'+_0xc50ec1[_0x7213('0x32')][_0x7213('0x3b')]+'%'};return _0x452aeb;})});}_0x4dc545=_[_0x7213('0x3e')]({},_0x4dc545,_0xc50ec1['options']);return _0x50531c[_0x7213('0x48')](_0x4dc545);}})['then'](function(_0x2efa27){if(_0x2efa27){_0x4d8313=_0x2efa27[_0x7213('0x37')];if(!_0xc50ec1['query']['hasOwnProperty']('nolimit')){_0x4dc545[_0x7213('0x1d')]=qs[_0x7213('0x1d')](_0xc50ec1[_0x7213('0x32')][_0x7213('0x1d')]);_0x4dc545[_0x7213('0x1b')]=qs[_0x7213('0x1b')](_0xc50ec1[_0x7213('0x32')][_0x7213('0x1b')]);}return _0x50531c[_0x7213('0x48')](_0x4dc545);}})[_0x7213('0x25')](function(_0x91fdd6){if(_0x91fdd6){return _0x91fdd6?{'count':_0x4d8313,'rows':_0x91fdd6}:null;}})[_0x7213('0x25')](respondWithResult(_0xe0a818,null))[_0x7213('0x41')](handleError(_0xe0a818,null));};exports[_0x7213('0x4d')]=function(_0x3c9856,_0x4310b3,_0x49636f){if(_0x3c9856['body']['id']){delete _0x3c9856['body']['id'];}return db[_0x7213('0x2c')][_0x7213('0x4e')]({'where':{'id':_0x3c9856[_0x7213('0x43')]['id']}})['then'](handleEntityNotFound(_0x4310b3,null))[_0x7213('0x25')](function(_0x1cb6c0){if(_0x1cb6c0){_0x3c9856['body']['AccountId']=_0x1cb6c0['id'];_0x3c9856['body']['Subjects']=integrations[_0x7213('0x4f')](_0x3c9856[_0x7213('0x47')]['channel'],_0x3c9856[_0x7213('0x47')][_0x7213('0x2e')]);_0x3c9856[_0x7213('0x47')][_0x7213('0x50')]=integrations[_0x7213('0x51')](_0x3c9856['body'][_0x7213('0x52')],_0x3c9856[_0x7213('0x47')][_0x7213('0x2e')]);return db[_0x7213('0x49')][_0x7213('0x53')](_0x3c9856['body'],{'include':[{'model':db[_0x7213('0x54')],'as':_0x7213('0x55')},{'model':db[_0x7213('0x54')],'as':_0x7213('0x50')}]});}return null;})['then'](respondWithResult(_0x4310b3,null))['catch'](handleError(_0x4310b3,null));};exports[_0x7213('0x56')]=function(_0x5eba59,_0x4a5aa2,_0x435a35){var _0x3f7ca2=_0x5eba59[_0x7213('0x32')][_0x7213('0x57')];var _0xda82e4=_0x3f7ca2===_0x7213('0x58')?_0x7213('0x59'):'PhoneCall';var _0x371015='';var _0x255ff5='';var _0x36e8a0='';var _0x450200='';var _0x9a223c='';var _0x55afbf='';var _0x23aabb='';var _0x300924='';var _0x455aa1=[_0x7213('0x5a'),'description',_0x7213('0x5b'),_0x7213('0x5c'),_0x7213('0x5d'),_0x7213('0x5e'),'phonenumber','regardingobjectid',_0x7213('0x5f'),_0x7213('0x60')];var _0x2bdec7=['accountidname',_0x7213('0x61'),_0x7213('0x62'),_0x7213('0x63'),_0x7213('0x64'),_0x7213('0x65'),'contractdetailidname',_0x7213('0x66'),_0x7213('0x67'),'createdbyexternalpartyyominame',_0x7213('0x68'),_0x7213('0x69'),'createdon','createdonbehalfbyname',_0x7213('0x6a'),_0x7213('0x6b'),_0x7213('0x6c'),_0x7213('0x6d'),_0x7213('0x6e'),_0x7213('0x6f'),_0x7213('0x70'),_0x7213('0x71'),_0x7213('0x72'),_0x7213('0x73'),_0x7213('0x74'),'followupby',_0x7213('0x75'),_0x7213('0x76'),_0x7213('0x77'),'lastonholdtime','masteridname',_0x7213('0x78'),_0x7213('0x79'),_0x7213('0x7a'),_0x7213('0x7b'),_0x7213('0x7c'),_0x7213('0x7d'),_0x7213('0x7e'),'msdyn_incidenttypename',_0x7213('0x7f'),_0x7213('0x80'),_0x7213('0x81'),_0x7213('0x82'),_0x7213('0x83'),_0x7213('0x84'),_0x7213('0x85'),_0x7213('0x86'),_0x7213('0x87'),'primarycontactidyominame',_0x7213('0x88'),'productidname',_0x7213('0x89'),'resolveby','resolvebykpiidname',_0x7213('0x8a'),_0x7213('0x8b'),'responsiblecontactidyominame',_0x7213('0x8c'),'slainvokedidname',_0x7213('0x8d'),'socialprofileidname',_0x7213('0x8e'),'statuscode','subjectidname',_0x7213('0x8f'),_0x7213('0x90'),'transactioncurrencyidname','traversedpath',_0x7213('0x91'),_0x7213('0x92')];var _0x28db9f=_0x455aa1[_0x7213('0x93')](_0x2bdec7);return db['Dynamics365Account'][_0x7213('0x4e')]({'where':{'id':_0x5eba59['params']['id']},'attributes':['id',_0x7213('0x94'),'password',_0x7213('0x95'),_0x7213('0x96'),'clientId',_0x7213('0x97')]})[_0x7213('0x25')](handleEntityNotFound(_0x4a5aa2,null))['then'](function(_0x26b1a3){if(_0x26b1a3){_0x300924=_0x26b1a3['remoteUri'];var _0x4c581e=_0x300924[_0x7213('0x98')](-0x1);if(_0x4c581e==='/'){_0x300924=_0x300924['substring'](0x0,_0x300924[_0x7213('0x99')](_0x4c581e));}_0x23aabb=util['format']('%s/api/data/v9.0/',_0x300924);var _0x99cee1={'method':_0x7213('0x9a'),'uri':_0x7213('0x9b')+_0x26b1a3[_0x7213('0x96')]+_0x7213('0x9c'),'form':{'client_id':_0x26b1a3[_0x7213('0x9d')],'resource':_0x300924,'username':_0x26b1a3[_0x7213('0x94')],'password':_0x26b1a3['password'],'grant_type':'password','client_secret':_0x26b1a3[_0x7213('0x97')]},'json':!![]};return rp(_0x99cee1);}})[_0x7213('0x25')](function(_0x315b5d){_0x55afbf=_0x315b5d['access_token'];var _0x464e27={'method':_0x7213('0x9e'),'uri':encodeURI(_0x23aabb+_0x7213('0x9f')+_0xda82e4+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x55afbf,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x464e27);})[_0x7213('0x25')](function(_0x32bb3a){var _0x33a5b9=_0x32bb3a['value'][0x0];var _0x402c1f=_0x33a5b9[_0x7213('0xa0')];var _0x2b74ef={'method':_0x7213('0x9e'),'uri':_0x23aabb+_0x7213('0xa1')+_0x402c1f+_0x7213('0xa2'),'headers':{'Authorization':_0x7213('0xa3')+_0x55afbf,'If-None-Match':null,'OData-Version':_0x7213('0xa4')},'json':!![]};return rp(_0x2b74ef);})[_0x7213('0x25')](function(_0x2573c3){_0x371015=_0x2573c3;_0x255ff5=_0x371015[_0x7213('0xa5')];_0x255ff5=_[_0x7213('0xa6')](_0x255ff5,function(_0x3315da){return!_0x28db9f['includes'](_0x3315da['LogicalName']);});var _0x151e72=[];var _0x58f81e=[];_0x255ff5['forEach'](function(_0x38f49b){if(_0x38f49b[_0x7213('0xa7')]){var _0x4cbdd1=_0x38f49b[_0x7213('0xa7')][_0x7213('0xa8')](_0x38f49b[_0x7213('0xa7')][_0x7213('0x99')]('.')+0x1);if(_0x4cbdd1==='PicklistAttributeMetadata'){_0x151e72[_0x7213('0xa9')](getSelectList(_0x23aabb,_0x3f7ca2,_0x58f81e,_0x371015[_0x7213('0xa0')],_0x38f49b['MetadataId'],_0x55afbf));}}});return Promise[_0x7213('0xaa')](_0x151e72);})[_0x7213('0x25')](function(_0xc1f02f){_0x36e8a0=_0xc1f02f[0x0];var _0x36ad7f=[];var _0x1ead9f=[];_0x255ff5['forEach'](function(_0x6d3b38){if(!_[_0x7213('0xab')](_0x6d3b38[_0x7213('0xa7')])){var _0x27f1c8=_0x6d3b38[_0x7213('0xa7')]['substring'](_0x6d3b38[_0x7213('0xa7')][_0x7213('0x99')]('.')+0x1);if(_0x27f1c8==='BooleanAttributeMetadata'){_0x36ad7f[_0x7213('0xa9')](getBooleanList(_0x23aabb,_0x3f7ca2,_0x1ead9f,_0x371015['MetadataId'],_0x6d3b38['MetadataId'],_0x55afbf));}}});return Promise[_0x7213('0xaa')](_0x36ad7f);})[_0x7213('0x25')](function(_0xca097e){_0x450200=_0xca097e[0x0];var _0x5ca6fa=[];var _0x1a23c6=[];_0x255ff5['forEach'](function(_0x12b1b1){if(_0x12b1b1[_0x7213('0xa7')]){var _0x20cb13=_0x12b1b1[_0x7213('0xa7')][_0x7213('0xa8')](_0x12b1b1['@odata.type'][_0x7213('0x99')]('.')+0x1);if(_0x20cb13==='StringAttributeMetadata'||_0x20cb13==='DoubleAttributeMetadata'||_0x20cb13==='BigIntAttributeMetadata'||_0x20cb13===_0x7213('0xac')||_0x20cb13===_0x7213('0xad')||_0x20cb13===_0x7213('0xae')||_0x20cb13===_0x7213('0xaf')||_0x20cb13==='EntityNameAttributeMetadata'||_0x20cb13==='StateAttributeMetadata'||_0x20cb13===_0x7213('0xb0')){_0x5ca6fa[_0x7213('0xa9')](getInputList(_0x23aabb,_0x3f7ca2,_0x20cb13,_0x1a23c6,_0x371015[_0x7213('0xa0')],_0x12b1b1[_0x7213('0xa0')],_0x55afbf));}}});return Promise['all'](_0x5ca6fa);})[_0x7213('0x25')](function(_0x50b9d5){_0x9a223c=_0x50b9d5[0x0];var _0x302c73=_0x36e8a0[_0x7213('0x93')](_0x450200)[_0x7213('0x93')](_0x9a223c);var _0x285c83={'count':_0x302c73[_0x7213('0x37')],'rows':_0x302c73};return _0x285c83;})['then'](respondWithResult(_0x4a5aa2,null))[_0x7213('0x41')](function(_0x49c40c){var _0x48e6c3=_0x5eba59[_0x7213('0x32')][_0x7213('0xb1')]?0x1f4:_0x49c40c[_0x7213('0xb2')]||0x1f4;logger[_0x7213('0x27')](_0x49c40c[_0x7213('0x28')]);delete _0x49c40c[_0x7213('0x31')];if(_0x48e6c3===0x191){_0x48e6c3=0x190;}_0x4a5aa2[_0x7213('0x18')](_0x48e6c3)[_0x7213('0x29')](_0x5eba59[_0x7213('0x32')][_0x7213('0xb1')]?{'message':_0x7213('0xb3'),'statusCode':_0x49c40c[_0x7213('0xb2')]}:_0x49c40c);});};function getSelectList(_0x1b6b12,_0x4c5766,_0x32479a,_0x453261,_0x4f0043,_0x224dd0){var _0x37f290={'method':_0x7213('0x9e'),'uri':_0x1b6b12+_0x7213('0xa1')+_0x453261+_0x7213('0xb4')+_0x4f0043+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x7213('0xb5'),'headers':{'Authorization':_0x7213('0xa3')+_0x224dd0,'If-None-Match':null,'OData-Version':_0x7213('0xa4')},'json':!![]};return rp(_0x37f290)['then'](function(_0x17318f){var _0x14ffaa=[];var _0xcf5dba=_0x17318f[_0x7213('0xb6')]['Options'];_0xcf5dba[_0x7213('0xb7')](function(_0x380f2c){_0x14ffaa[_0x7213('0xa9')]({'name':_0x380f2c['Label'][_0x7213('0xb8')][_0x7213('0xb9')],'value':String(_0x380f2c[_0x7213('0xba')])});});var _0x419bec={'id':_0x4c5766+'_'+_0x17318f[_0x7213('0xbb')],'name':_0x17318f['DisplayName']['UserLocalizedLabel'][_0x7213('0xb9')],'custom':![],'options':_0x14ffaa};_0x32479a[_0x7213('0xa9')](_0x419bec);return _0x32479a;});}function getBooleanList(_0x576402,_0x43be2a,_0xe2653c,_0x5d4c25,_0xd5c476,_0x13a2e3){var _0x4a205b={'method':'GET','uri':_0x576402+_0x7213('0xa1')+_0x5d4c25+_0x7213('0xb4')+_0xd5c476+_0x7213('0xbc'),'headers':{'Authorization':_0x7213('0xa3')+_0x13a2e3,'If-None-Match':null,'OData-Version':_0x7213('0xa4')},'json':!![]};return rp(_0x4a205b)['then'](function(_0x35cf62){var _0x1385c0=[];_0x1385c0[_0x7213('0xa9')]({'name':_0x35cf62['OptionSet'][_0x7213('0xbd')][_0x7213('0xb9')][_0x7213('0xb8')]['Label'],'value':'true'},{'name':_0x35cf62[_0x7213('0xb6')][_0x7213('0xbe')]['Label'][_0x7213('0xb8')]['Label'],'value':_0x7213('0xbf')});var _0x163ee6={'id':_0x43be2a+'_'+_0x35cf62['LogicalName'],'name':_0x35cf62[_0x7213('0xc0')]['UserLocalizedLabel'][_0x7213('0xb9')],'custom':![],'options':_0x1385c0};_0xe2653c[_0x7213('0xa9')](_0x163ee6);return _0xe2653c;});}function getInputList(_0x4f1b8b,_0x3d008b,_0x31c43f,_0x23be4e,_0x2e6410,_0x235c75,_0xcf78e8){var _0x135037={'method':_0x7213('0x9e'),'uri':_0x4f1b8b+'EntityDefinitions('+_0x2e6410+_0x7213('0xb4')+_0x235c75+_0x7213('0xc1')+_0x31c43f+_0x7213('0xc2'),'headers':{'Authorization':'Bearer\x20'+_0xcf78e8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x135037)[_0x7213('0x25')](function(_0x49488d){var _0x5d2d1c={'id':_0x3d008b+'_'+_0x49488d[_0x7213('0xbb')],'name':_0x49488d[_0x7213('0xc0')]['UserLocalizedLabel']?_0x49488d['DisplayName'][_0x7213('0xb8')][_0x7213('0xb9')]:_0x49488d[_0x7213('0xbb')],'custom':![],'options':[]};_0x23be4e['push'](_0x5d2d1c);return _0x23be4e;});} \ No newline at end of file +var _0x80fb=['overriddencreatedon','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','format','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','BooleanAttributeMetadata','all','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','send','statusCode',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Label','Value','DisplayName','UserLocalizedLabel','TrueOption','true','OptionSet','FalseOption','false','?$select=DisplayName,LogicalName','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','Dynamics365Account','rawAttributes','fieldName','key','keys','query','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','update','findOne','params','Dynamics365Configuration','getConfigurations','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','Dynamics365Field','getFields','ticketType','incident','PhoneCall','title','description','customerid','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','numberofchildincidents'];(function(_0x104cb7,_0x2fe5ef){var _0x16eacb=function(_0x317b82){while(--_0x317b82){_0x104cb7['push'](_0x104cb7['shift']());}};_0x16eacb(++_0x2fe5ef);}(_0x80fb,0x11e));var _0xb80f=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x80fb[_0x16d10f];return _0x50c823;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb80f('0x0'));var zipdir=require(_0xb80f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb80f('0x2'));var moment=require(_0xb80f('0x3'));var BPromise=require(_0xb80f('0x4'));var Mustache=require(_0xb80f('0x5'));var util=require(_0xb80f('0x6'));var path=require(_0xb80f('0x7'));var sox=require(_0xb80f('0x8'));var csv=require(_0xb80f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb80f('0xa'));var _=require(_0xb80f('0xb'));var squel=require(_0xb80f('0xc'));var crypto=require(_0xb80f('0xd'));var jsforce=require(_0xb80f('0xe'));var deskjs=require(_0xb80f('0xf'));var toCsv=require(_0xb80f('0x9'));var querystring=require(_0xb80f('0x10'));var Papa=require(_0xb80f('0x11'));var Redis=require(_0xb80f('0x12'));var authService=require(_0xb80f('0x13'));var qs=require(_0xb80f('0x14'));var as=require(_0xb80f('0x15'));var hardwareService=require(_0xb80f('0x16'));var logger=require(_0xb80f('0x17'))(_0xb80f('0x18'));var utils=require('../../config/utils');var config=require(_0xb80f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb80f('0x1a'))['db'];var integrations=require(_0xb80f('0x1b'));function respondWithStatusCode(_0x13b5f4,_0x30e0c8){_0x30e0c8=_0x30e0c8||0xcc;return function(_0x3b03c3){if(_0x3b03c3){return _0x13b5f4[_0xb80f('0x1c')](_0x30e0c8);}return _0x13b5f4[_0xb80f('0x1d')](_0x30e0c8)[_0xb80f('0x1e')]();};}function respondWithResult(_0x4686de,_0x205523){_0x205523=_0x205523||0xc8;return function(_0x152368){if(_0x152368){return _0x4686de[_0xb80f('0x1d')](_0x205523)[_0xb80f('0x1f')](_0x152368);}};}function respondWithFilteredResult(_0x2af09b,_0x30a126){return function(_0x59cc1b){if(_0x59cc1b){var _0x2558f6=typeof _0x30a126[_0xb80f('0x20')]==='undefined'&&typeof _0x30a126['limit']===_0xb80f('0x21');var _0x29b88d=_0x59cc1b[_0xb80f('0x22')];var _0x353d77=_0x2558f6?0x0:_0x30a126[_0xb80f('0x20')];var _0x347b46=_0x2558f6?_0x59cc1b['count']:_0x30a126[_0xb80f('0x20')]+_0x30a126[_0xb80f('0x23')];var _0x3b2140;if(_0x347b46>=_0x29b88d){_0x347b46=_0x29b88d;_0x3b2140=0xc8;}else{_0x3b2140=0xce;}_0x2af09b[_0xb80f('0x1d')](_0x3b2140);return _0x2af09b[_0xb80f('0x24')](_0xb80f('0x25'),_0x353d77+'-'+_0x347b46+'/'+_0x29b88d)[_0xb80f('0x1f')](_0x59cc1b);}return null;};}function patchUpdates(_0x3ad8a6){return function(_0x271abc){try{jsonpatch[_0xb80f('0x26')](_0x271abc,_0x3ad8a6,!![]);}catch(_0x362da7){return BPromise['reject'](_0x362da7);}return _0x271abc[_0xb80f('0x27')]();};}function saveUpdates(_0x5c6120,_0x713bad){return function(_0x2a63b2){if(_0x2a63b2){return _0x2a63b2['update'](_0x5c6120)[_0xb80f('0x28')](function(_0x2a9749){return _0x2a9749;});}return null;};}function removeEntity(_0x4e46fa,_0x52a032){return function(_0x2a0f1d){if(_0x2a0f1d){return _0x2a0f1d[_0xb80f('0x29')]()[_0xb80f('0x28')](function(){_0x4e46fa['status'](0xcc)[_0xb80f('0x1e')]();});}};}function handleEntityNotFound(_0x49d2c0,_0x510180){return function(_0x475caf){if(!_0x475caf){_0x49d2c0[_0xb80f('0x1c')](0x194);}return _0x475caf;};}function handleError(_0x33e570,_0x12aa3e){_0x12aa3e=_0x12aa3e||0x1f4;return function(_0x332699){logger[_0xb80f('0x2a')](_0x332699[_0xb80f('0x2b')]);if(_0x332699[_0xb80f('0x2c')]){delete _0x332699['name'];}_0x33e570['status'](_0x12aa3e)['send'](_0x332699);};}exports['index']=function(_0x395c86,_0xa36328){var _0xe2551e={},_0x3b8271={},_0x43d7db={'count':0x0,'rows':[]};var _0x561f36=_['map'](db[_0xb80f('0x2d')][_0xb80f('0x2e')],function(_0x5c0846){return{'name':_0x5c0846[_0xb80f('0x2f')],'type':_0x5c0846['type'][_0xb80f('0x30')]};});_0x3b8271['model']=_['map'](_0x561f36,_0xb80f('0x2c'));_0x3b8271['query']=_[_0xb80f('0x31')](_0x395c86[_0xb80f('0x32')]);_0x3b8271['filters']=_['intersection'](_0x3b8271[_0xb80f('0x33')],_0x3b8271[_0xb80f('0x32')]);_0xe2551e['attributes']=_[_0xb80f('0x34')](_0x3b8271[_0xb80f('0x33')],qs[_0xb80f('0x35')](_0x395c86[_0xb80f('0x32')][_0xb80f('0x35')]));_0xe2551e['attributes']=_0xe2551e[_0xb80f('0x36')][_0xb80f('0x37')]?_0xe2551e['attributes']:_0x3b8271[_0xb80f('0x33')];if(!_0x395c86[_0xb80f('0x32')][_0xb80f('0x38')]('nolimit')){_0xe2551e[_0xb80f('0x23')]=qs['limit'](_0x395c86[_0xb80f('0x32')]['limit']);_0xe2551e[_0xb80f('0x20')]=qs['offset'](_0x395c86[_0xb80f('0x32')][_0xb80f('0x20')]);}_0xe2551e[_0xb80f('0x39')]=qs[_0xb80f('0x3a')](_0x395c86['query'][_0xb80f('0x3a')]);_0xe2551e[_0xb80f('0x3b')]=qs[_0xb80f('0x3c')](_[_0xb80f('0x3d')](_0x395c86[_0xb80f('0x32')],_0x3b8271[_0xb80f('0x3c')]),_0x561f36);if(_0x395c86[_0xb80f('0x32')][_0xb80f('0x3e')]){_0xe2551e['where']=_[_0xb80f('0x3f')](_0xe2551e[_0xb80f('0x3b')],{'$or':_[_0xb80f('0x40')](_0x561f36,function(_0xb17fa0){if(_0xb17fa0[_0xb80f('0x41')]!==_0xb80f('0x42')){var _0x294d7f={};_0x294d7f[_0xb17fa0[_0xb80f('0x2c')]]={'$like':'%'+_0x395c86['query']['filter']+'%'};return _0x294d7f;}})});}_0xe2551e=_[_0xb80f('0x3f')]({},_0xe2551e,_0x395c86[_0xb80f('0x43')]);var _0x3922b4={'where':_0xe2551e[_0xb80f('0x3b')]};return db['Dynamics365Account']['count'](_0x3922b4)[_0xb80f('0x28')](function(_0x5c3fc2){_0x43d7db[_0xb80f('0x22')]=_0x5c3fc2;if(_0x395c86[_0xb80f('0x32')][_0xb80f('0x44')]){_0xe2551e[_0xb80f('0x45')]=[{'all':!![]}];}return db[_0xb80f('0x2d')][_0xb80f('0x46')](_0xe2551e);})[_0xb80f('0x28')](function(_0x3076c8){_0x43d7db[_0xb80f('0x47')]=_0x3076c8;return _0x43d7db;})[_0xb80f('0x28')](respondWithFilteredResult(_0xa36328,_0xe2551e))['catch'](handleError(_0xa36328,null));};exports[_0xb80f('0x48')]=function(_0x33ba01,_0x1c3b38){var _0x2cb571={'raw':![],'where':{'id':_0x33ba01['params']['id']}},_0x149f57={};_0x149f57['model']=_['keys'](db['Dynamics365Account'][_0xb80f('0x2e')]);_0x149f57[_0xb80f('0x32')]=_[_0xb80f('0x31')](_0x33ba01[_0xb80f('0x32')]);_0x149f57[_0xb80f('0x3c')]=_[_0xb80f('0x34')](_0x149f57[_0xb80f('0x33')],_0x149f57[_0xb80f('0x32')]);_0x2cb571['attributes']=_['intersection'](_0x149f57['model'],qs[_0xb80f('0x35')](_0x33ba01['query'][_0xb80f('0x35')]));_0x2cb571[_0xb80f('0x36')]=_0x2cb571[_0xb80f('0x36')][_0xb80f('0x37')]?_0x2cb571['attributes']:_0x149f57[_0xb80f('0x33')];if(_0x33ba01['query'][_0xb80f('0x44')]){_0x2cb571[_0xb80f('0x45')]=[{'all':!![]}];}_0x2cb571=_['merge']({},_0x2cb571,_0x33ba01['options']);return db[_0xb80f('0x2d')][_0xb80f('0x49')](_0x2cb571)[_0xb80f('0x28')](handleEntityNotFound(_0x1c3b38,null))[_0xb80f('0x28')](respondWithResult(_0x1c3b38,null))[_0xb80f('0x4a')](handleError(_0x1c3b38,null));};exports['create']=function(_0x446d0a,_0x549f6d){return db[_0xb80f('0x2d')][_0xb80f('0x4b')](_0x446d0a[_0xb80f('0x4c')],{})[_0xb80f('0x28')](respondWithResult(_0x549f6d,0xc9))[_0xb80f('0x4a')](handleError(_0x549f6d,null));};exports[_0xb80f('0x4d')]=function(_0x22f350,_0x15991e){if(_0x22f350[_0xb80f('0x4c')]['id']){delete _0x22f350['body']['id'];}return db[_0xb80f('0x2d')][_0xb80f('0x49')]({'where':{'id':_0x22f350['params']['id']}})['then'](handleEntityNotFound(_0x15991e,null))[_0xb80f('0x28')](saveUpdates(_0x22f350[_0xb80f('0x4c')],null))[_0xb80f('0x28')](respondWithResult(_0x15991e,null))[_0xb80f('0x4a')](handleError(_0x15991e,null));};exports['destroy']=function(_0x19a0ab,_0x19e2a9){return db['Dynamics365Account'][_0xb80f('0x49')]({'where':{'id':_0x19a0ab['params']['id']}})[_0xb80f('0x28')](handleEntityNotFound(_0x19e2a9,null))[_0xb80f('0x28')](removeEntity(_0x19e2a9,null))[_0xb80f('0x4a')](handleError(_0x19e2a9,null));};exports['getConfigurations']=function(_0x4b29dd,_0x267766,_0x262377){var _0x8d690e={};var _0x2397d={};var _0x5d14b9;var _0x1466b2;return db[_0xb80f('0x2d')][_0xb80f('0x4e')]({'where':{'id':_0x4b29dd[_0xb80f('0x4f')]['id']}})[_0xb80f('0x28')](handleEntityNotFound(_0x267766,null))['then'](function(_0x119114){if(_0x119114){_0x5d14b9=_0x119114;_0x2397d['model']=_['keys'](db[_0xb80f('0x50')]['rawAttributes']);_0x2397d[_0xb80f('0x32')]=_[_0xb80f('0x31')](_0x4b29dd[_0xb80f('0x32')]);_0x2397d[_0xb80f('0x3c')]=_[_0xb80f('0x34')](_0x2397d[_0xb80f('0x33')],_0x2397d[_0xb80f('0x32')]);_0x8d690e[_0xb80f('0x36')]=_[_0xb80f('0x34')](_0x2397d['model'],qs[_0xb80f('0x35')](_0x4b29dd['query']['fields']));_0x8d690e['attributes']=_0x8d690e['attributes'][_0xb80f('0x37')]?_0x8d690e['attributes']:_0x2397d[_0xb80f('0x33')];_0x8d690e[_0xb80f('0x39')]=qs[_0xb80f('0x3a')](_0x4b29dd['query']['sort']);_0x8d690e[_0xb80f('0x3b')]=qs[_0xb80f('0x3c')](_[_0xb80f('0x3d')](_0x4b29dd[_0xb80f('0x32')],_0x2397d[_0xb80f('0x3c')]));if(_0x4b29dd['query']['filter']){_0x8d690e[_0xb80f('0x3b')]=_[_0xb80f('0x3f')](_0x8d690e[_0xb80f('0x3b')],{'$or':_['map'](_0x8d690e['attributes'],function(_0x426265){var _0x207af5={};_0x207af5[_0x426265]={'$like':'%'+_0x4b29dd[_0xb80f('0x32')][_0xb80f('0x3e')]+'%'};return _0x207af5;})});}_0x8d690e=_['merge']({},_0x8d690e,_0x4b29dd[_0xb80f('0x43')]);return _0x5d14b9[_0xb80f('0x51')](_0x8d690e);}})['then'](function(_0x13d1b4){if(_0x13d1b4){_0x1466b2=_0x13d1b4[_0xb80f('0x37')];if(!_0x4b29dd[_0xb80f('0x32')][_0xb80f('0x38')](_0xb80f('0x52'))){_0x8d690e['limit']=qs[_0xb80f('0x23')](_0x4b29dd['query'][_0xb80f('0x23')]);_0x8d690e[_0xb80f('0x20')]=qs[_0xb80f('0x20')](_0x4b29dd[_0xb80f('0x32')][_0xb80f('0x20')]);}return _0x5d14b9[_0xb80f('0x51')](_0x8d690e);}})['then'](function(_0x6abf8f){if(_0x6abf8f){return _0x6abf8f?{'count':_0x1466b2,'rows':_0x6abf8f}:null;}})[_0xb80f('0x28')](respondWithResult(_0x267766,null))[_0xb80f('0x4a')](handleError(_0x267766,null));};exports[_0xb80f('0x53')]=function(_0x1c4ff8,_0x180310,_0x1ea485){if(_0x1c4ff8[_0xb80f('0x4c')]['id']){delete _0x1c4ff8[_0xb80f('0x4c')]['id'];}return db[_0xb80f('0x2d')]['findOne']({'where':{'id':_0x1c4ff8['params']['id']}})[_0xb80f('0x28')](handleEntityNotFound(_0x180310,null))[_0xb80f('0x28')](function(_0x21ed74){if(_0x21ed74){_0x1c4ff8[_0xb80f('0x4c')][_0xb80f('0x54')]=_0x21ed74['id'];_0x1c4ff8[_0xb80f('0x4c')]['Subjects']=integrations[_0xb80f('0x55')](_0x1c4ff8['body'][_0xb80f('0x56')],_0x1c4ff8[_0xb80f('0x4c')][_0xb80f('0x41')]);_0x1c4ff8['body'][_0xb80f('0x57')]=integrations[_0xb80f('0x58')](_0x1c4ff8[_0xb80f('0x4c')]['channel'],_0x1c4ff8[_0xb80f('0x4c')][_0xb80f('0x41')]);return db[_0xb80f('0x50')][_0xb80f('0x4b')](_0x1c4ff8[_0xb80f('0x4c')],{'include':[{'model':db['Dynamics365Field'],'as':_0xb80f('0x59')},{'model':db[_0xb80f('0x5a')],'as':'Descriptions'}]});}return null;})[_0xb80f('0x28')](respondWithResult(_0x180310,null))[_0xb80f('0x4a')](handleError(_0x180310,null));};exports[_0xb80f('0x5b')]=function(_0x2e9418,_0x11c205,_0x228ab5){var _0x5ab028=_0x2e9418['query'][_0xb80f('0x5c')];var _0x552ccf=_0x5ab028===_0xb80f('0x5d')?'Incident':_0xb80f('0x5e');var _0x305195='';var _0x5d4c08='';var _0x5ce875='';var _0x562411='';var _0x187d25='';var _0x26ffd5='';var _0x2bbf8a='';var _0x3a6467='';var _0x596172=[_0xb80f('0x5f'),_0xb80f('0x60'),_0xb80f('0x61'),'ownerid','caseorigincode',_0xb80f('0x62'),_0xb80f('0x63'),_0xb80f('0x64'),_0xb80f('0x65'),'phonecall_activity_parties'];var _0x56d16b=[_0xb80f('0x66'),_0xb80f('0x67'),_0xb80f('0x68'),_0xb80f('0x69'),_0xb80f('0x6a'),'contactidyominame',_0xb80f('0x6b'),_0xb80f('0x6c'),_0xb80f('0x6d'),_0xb80f('0x6e'),_0xb80f('0x6f'),_0xb80f('0x70'),_0xb80f('0x71'),_0xb80f('0x72'),_0xb80f('0x73'),_0xb80f('0x74'),_0xb80f('0x75'),_0xb80f('0x76'),_0xb80f('0x77'),_0xb80f('0x78'),_0xb80f('0x79'),_0xb80f('0x7a'),_0xb80f('0x7b'),'exchangerate',_0xb80f('0x7c'),_0xb80f('0x7d'),_0xb80f('0x7e'),_0xb80f('0x7f'),_0xb80f('0x80'),_0xb80f('0x81'),_0xb80f('0x82'),_0xb80f('0x83'),_0xb80f('0x84'),'modifiedbyname',_0xb80f('0x85'),_0xb80f('0x86'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname',_0xb80f('0x87'),'onholdtime',_0xb80f('0x88'),'owneridname',_0xb80f('0x89'),_0xb80f('0x8a'),_0xb80f('0x8b'),_0xb80f('0x8c'),_0xb80f('0x8d'),_0xb80f('0x8e'),_0xb80f('0x8f'),_0xb80f('0x90'),_0xb80f('0x91'),'resolvebykpiidname','responseby',_0xb80f('0x92'),'responsiblecontactidyominame',_0xb80f('0x93'),_0xb80f('0x94'),_0xb80f('0x95'),_0xb80f('0x96'),_0xb80f('0x97'),'statuscode','subjectidname',_0xb80f('0x98'),_0xb80f('0x99'),_0xb80f('0x9a'),_0xb80f('0x9b'),_0xb80f('0x9c'),_0xb80f('0x9d')];var _0x47ad77=_0x596172[_0xb80f('0x9e')](_0x56d16b);return db[_0xb80f('0x2d')]['findOne']({'where':{'id':_0x2e9418['params']['id']},'attributes':['id',_0xb80f('0x9f'),_0xb80f('0xa0'),_0xb80f('0xa1'),_0xb80f('0xa2'),_0xb80f('0xa3'),_0xb80f('0xa4')]})[_0xb80f('0x28')](handleEntityNotFound(_0x11c205,null))['then'](function(_0x3f8db1){if(_0x3f8db1){_0x3a6467=_0x3f8db1[_0xb80f('0xa1')];var _0x4d4b28=_0x3a6467[_0xb80f('0xa5')](-0x1);if(_0x4d4b28==='/'){_0x3a6467=_0x3a6467[_0xb80f('0xa6')](0x0,_0x3a6467['lastIndexOf'](_0x4d4b28));}_0x2bbf8a=util[_0xb80f('0xa7')]('%s/api/data/v9.0/',_0x3a6467);var _0x38c5f8={'method':_0xb80f('0xa8'),'uri':_0xb80f('0xa9')+_0x3f8db1[_0xb80f('0xa2')]+_0xb80f('0xaa'),'form':{'client_id':_0x3f8db1[_0xb80f('0xa3')],'resource':_0x3a6467,'username':_0x3f8db1[_0xb80f('0x9f')],'password':_0x3f8db1['password'],'grant_type':'password','client_secret':_0x3f8db1[_0xb80f('0xa4')]},'json':!![]};return rp(_0x38c5f8);}})['then'](function(_0x506d9f){_0x26ffd5=_0x506d9f[_0xb80f('0xab')];var _0x1f1e66={'method':'GET','uri':encodeURI(_0x2bbf8a+_0xb80f('0xac')+_0x552ccf+'\x27'),'headers':{'Authorization':_0xb80f('0xad')+_0x26ffd5,'If-None-Match':null,'OData-Version':_0xb80f('0xae')},'json':!![]};return rp(_0x1f1e66);})[_0xb80f('0x28')](function(_0x3699fa){var _0x49a3b8=_0x3699fa[_0xb80f('0xaf')][0x0];var _0x5b4477=_0x49a3b8[_0xb80f('0xb0')];var _0x46fd03={'method':_0xb80f('0xb1'),'uri':_0x2bbf8a+_0xb80f('0xb2')+_0x5b4477+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xb80f('0xad')+_0x26ffd5,'If-None-Match':null,'OData-Version':_0xb80f('0xae')},'json':!![]};return rp(_0x46fd03);})['then'](function(_0x4b58a3){_0x305195=_0x4b58a3;_0x5d4c08=_0x305195[_0xb80f('0xb3')];_0x5d4c08=_[_0xb80f('0xb4')](_0x5d4c08,function(_0x28110d){return!_0x47ad77[_0xb80f('0xb5')](_0x28110d[_0xb80f('0xb6')]);});var _0x24eac5=[];var _0x2b1f21=[];_0x5d4c08[_0xb80f('0xb7')](function(_0x3cf739){if(_0x3cf739[_0xb80f('0xb8')]){var _0x3919a4=_0x3cf739[_0xb80f('0xb8')]['substring'](_0x3cf739[_0xb80f('0xb8')][_0xb80f('0xb9')]('.')+0x1);if(_0x3919a4===_0xb80f('0xba')){_0x24eac5[_0xb80f('0xbb')](getSelectList(_0x2bbf8a,_0x5ab028,_0x2b1f21,_0x305195['MetadataId'],_0x3cf739['MetadataId'],_0x26ffd5));}}});return Promise['all'](_0x24eac5);})['then'](function(_0x2be7a1){_0x5ce875=_0x2be7a1[0x0];var _0x239168=[];var _0x5e82d4=[];_0x5d4c08[_0xb80f('0xb7')](function(_0x4e494e){if(!_['isNil'](_0x4e494e[_0xb80f('0xb8')])){var _0x592bfe=_0x4e494e[_0xb80f('0xb8')][_0xb80f('0xa6')](_0x4e494e['@odata.type'][_0xb80f('0xb9')]('.')+0x1);if(_0x592bfe===_0xb80f('0xbc')){_0x239168[_0xb80f('0xbb')](getBooleanList(_0x2bbf8a,_0x5ab028,_0x5e82d4,_0x305195['MetadataId'],_0x4e494e[_0xb80f('0xb0')],_0x26ffd5));}}});return Promise[_0xb80f('0xbd')](_0x239168);})[_0xb80f('0x28')](function(_0x1760ad){_0x562411=_0x1760ad[0x0];var _0xb3478d=[];var _0x49c4f5=[];_0x5d4c08['forEach'](function(_0x3acb3d){if(_0x3acb3d['@odata.type']){var _0x2703ad=_0x3acb3d[_0xb80f('0xb8')][_0xb80f('0xa6')](_0x3acb3d[_0xb80f('0xb8')][_0xb80f('0xb9')]('.')+0x1);if(_0x2703ad==='StringAttributeMetadata'||_0x2703ad===_0xb80f('0xbe')||_0x2703ad===_0xb80f('0xbf')||_0x2703ad===_0xb80f('0xc0')||_0x2703ad===_0xb80f('0xc1')||_0x2703ad==='DateTimeAttributeMetadata'||_0x2703ad==='StatusAttributeMetadata'||_0x2703ad==='EntityNameAttributeMetadata'||_0x2703ad===_0xb80f('0xc2')||_0x2703ad===_0xb80f('0xc3')){_0xb3478d['push'](getInputList(_0x2bbf8a,_0x5ab028,_0x2703ad,_0x49c4f5,_0x305195[_0xb80f('0xb0')],_0x3acb3d[_0xb80f('0xb0')],_0x26ffd5));}}});return Promise[_0xb80f('0xbd')](_0xb3478d);})[_0xb80f('0x28')](function(_0x2344de){_0x187d25=_0x2344de[0x0];var _0x24c329=_0x5ce875[_0xb80f('0x9e')](_0x562411)[_0xb80f('0x9e')](_0x187d25);var _0x4c9390={'count':_0x24c329['length'],'rows':_0x24c329};return _0x4c9390;})[_0xb80f('0x28')](respondWithResult(_0x11c205,null))[_0xb80f('0x4a')](function(_0x16bdd2){var _0x3e1b05=_0x2e9418[_0xb80f('0x32')][_0xb80f('0xc4')]?0x1f4:_0x16bdd2['statusCode']||0x1f4;logger['error'](_0x16bdd2[_0xb80f('0x2b')]);delete _0x16bdd2['name'];if(_0x3e1b05===0x191){_0x3e1b05=0x190;}_0x11c205['status'](_0x3e1b05)[_0xb80f('0xc5')](_0x2e9418[_0xb80f('0x32')][_0xb80f('0xc4')]?{'message':'Wrong\x20credentials','statusCode':_0x16bdd2[_0xb80f('0xc6')]}:_0x16bdd2);});};function getSelectList(_0x573185,_0x419146,_0x5c88a0,_0x4a5253,_0x37d80b,_0x28302d){var _0x546000={'method':_0xb80f('0xb1'),'uri':_0x573185+_0xb80f('0xb2')+_0x4a5253+_0xb80f('0xc7')+_0x37d80b+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xb80f('0xc8'),'headers':{'Authorization':_0xb80f('0xad')+_0x28302d,'If-None-Match':null,'OData-Version':_0xb80f('0xae')},'json':!![]};return rp(_0x546000)[_0xb80f('0x28')](function(_0x519703){var _0x65cb29=[];var _0x65fe13=_0x519703['OptionSet']['Options'];_0x65fe13[_0xb80f('0xb7')](function(_0x12f8ea){_0x65cb29['push']({'name':_0x12f8ea[_0xb80f('0xc9')]['UserLocalizedLabel'][_0xb80f('0xc9')],'value':String(_0x12f8ea[_0xb80f('0xca')])});});var _0x3b79bd={'id':_0x419146+'_'+_0x519703[_0xb80f('0xb6')],'name':_0x519703[_0xb80f('0xcb')][_0xb80f('0xcc')]['Label'],'custom':![],'options':_0x65cb29};_0x5c88a0[_0xb80f('0xbb')](_0x3b79bd);return _0x5c88a0;});}function getBooleanList(_0x53260d,_0x1fff01,_0x58de1e,_0x15b59c,_0xcbc276,_0x13a518){var _0x18e2d6={'method':_0xb80f('0xb1'),'uri':_0x53260d+_0xb80f('0xb2')+_0x15b59c+_0xb80f('0xc7')+_0xcbc276+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xb80f('0xad')+_0x13a518,'If-None-Match':null,'OData-Version':_0xb80f('0xae')},'json':!![]};return rp(_0x18e2d6)['then'](function(_0x84beea){var _0x45d0c6=[];_0x45d0c6[_0xb80f('0xbb')]({'name':_0x84beea['OptionSet'][_0xb80f('0xcd')][_0xb80f('0xc9')]['UserLocalizedLabel'][_0xb80f('0xc9')],'value':_0xb80f('0xce')},{'name':_0x84beea[_0xb80f('0xcf')][_0xb80f('0xd0')][_0xb80f('0xc9')]['UserLocalizedLabel'][_0xb80f('0xc9')],'value':_0xb80f('0xd1')});var _0x3067e0={'id':_0x1fff01+'_'+_0x84beea[_0xb80f('0xb6')],'name':_0x84beea[_0xb80f('0xcb')][_0xb80f('0xcc')][_0xb80f('0xc9')],'custom':![],'options':_0x45d0c6};_0x58de1e[_0xb80f('0xbb')](_0x3067e0);return _0x58de1e;});}function getInputList(_0x343c82,_0x3e310d,_0x2d1536,_0x5beb52,_0x4bc876,_0x3eff4b,_0x53a693){var _0x110b82={'method':_0xb80f('0xb1'),'uri':_0x343c82+_0xb80f('0xb2')+_0x4bc876+_0xb80f('0xc7')+_0x3eff4b+')/Microsoft.Dynamics.CRM.'+_0x2d1536+_0xb80f('0xd2'),'headers':{'Authorization':_0xb80f('0xad')+_0x53a693,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x110b82)['then'](function(_0x34536f){var _0xca4e65={'id':_0x3e310d+'_'+_0x34536f[_0xb80f('0xb6')],'name':_0x34536f[_0xb80f('0xcb')]['UserLocalizedLabel']?_0x34536f[_0xb80f('0xcb')]['UserLocalizedLabel']['Label']:_0x34536f[_0xb80f('0xb6')],'custom':![],'options':[]};_0x5beb52[_0xb80f('0xbb')](_0xca4e65);return _0x5beb52;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index ba9014d..bc3c68f 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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2070e4,_0x366b88){var _0x30719d=function(_0x27e56a){while(--_0x27e56a){_0x2070e4['push'](_0x2070e4['shift']());}};_0x30719d(++_0x366b88);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x1d426f,_0x37e919){var _0x17f71a=function(_0x3bf60c){while(--_0x3bf60c){_0x1d426f['push'](_0x1d426f['shift']());}};_0x17f71a(++_0x37e919);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'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 7018915..c194b38 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 _0x3840=['error','code','message','result','catch','Dynamics365Account','findAll','options','where','attributes','limit','include','map','model','then','GetDynamics365Account','debug','find','raw','ShowDynamics365Account','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x3840,0x1e9));var _0x0384=function(_0xbed84e,_0x3e6176){_0xbed84e=_0xbed84e-0x0;var _0x33dc55=_0x3840[_0xbed84e];return _0x33dc55;};'use strict';var _=require(_0x0384('0x0'));var util=require(_0x0384('0x1'));var moment=require(_0x0384('0x2'));var BPromise=require(_0x0384('0x3'));var rs=require(_0x0384('0x4'));var fs=require('fs');var Redis=require(_0x0384('0x5'));var db=require(_0x0384('0x6'))['db'];var utils=require(_0x0384('0x7'));var logger=require(_0x0384('0x8'))(_0x0384('0x9'));var config=require(_0x0384('0xa'));var jayson=require(_0x0384('0xb'));var client=jayson[_0x0384('0xc')][_0x0384('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x37b2f6,_0xc90a2d,_0x47e5fa){return new BPromise(function(_0x4208eb,_0x13c614){return client[_0x0384('0xe')](_0x37b2f6,_0x47e5fa)['then'](function(_0x2c062c){logger[_0x0384('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0xc90a2d,_0x0384('0x10'));logger['debug'](_0x0384('0x11'),_0xc90a2d,_0x0384('0x10'),JSON['stringify'](_0x2c062c));if(_0x2c062c['error']){if(_0x2c062c[_0x0384('0x12')][_0x0384('0x13')]===0x1f4){logger[_0x0384('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0xc90a2d,_0x2c062c[_0x0384('0x12')][_0x0384('0x14')]);return _0x13c614(_0x2c062c[_0x0384('0x12')]['message']);}logger[_0x0384('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0xc90a2d,_0x2c062c[_0x0384('0x12')]['message']);return _0x4208eb(_0x2c062c[_0x0384('0x12')][_0x0384('0x14')]);}else{logger[_0x0384('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0xc90a2d,_0x0384('0x10'));_0x4208eb(_0x2c062c[_0x0384('0x15')]['message']);}})[_0x0384('0x16')](function(_0x1d1abd){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0xc90a2d,_0x1d1abd);_0x13c614(_0x1d1abd);});});}exports['GetDynamics365Account']=function(_0x202eb5){var _0x539e79=this;return new Promise(function(_0x1c2e98,_0x9f8a79){return db[_0x0384('0x17')][_0x0384('0x18')]({'raw':_0x202eb5[_0x0384('0x19')]?_0x202eb5['options']['raw']===undefined?!![]:![]:!![],'where':_0x202eb5['options']?_0x202eb5[_0x0384('0x19')][_0x0384('0x1a')]||null:null,'attributes':_0x202eb5[_0x0384('0x19')]?_0x202eb5[_0x0384('0x19')][_0x0384('0x1b')]||null:null,'limit':_0x202eb5[_0x0384('0x19')]?_0x202eb5[_0x0384('0x19')][_0x0384('0x1c')]||null:null,'include':_0x202eb5[_0x0384('0x19')]?_0x202eb5[_0x0384('0x19')][_0x0384('0x1d')]?_[_0x0384('0x1e')](_0x202eb5['options'][_0x0384('0x1d')],function(_0x233b7e){return{'model':db[_0x233b7e[_0x0384('0x1f')]],'as':_0x233b7e['as'],'attributes':_0x233b7e[_0x0384('0x1b')],'include':_0x233b7e[_0x0384('0x1d')]?_[_0x0384('0x1e')](_0x233b7e[_0x0384('0x1d')],function(_0x5e098f){return{'model':db[_0x5e098f[_0x0384('0x1f')]],'as':_0x5e098f['as'],'attributes':_0x5e098f[_0x0384('0x1b')],'include':_0x5e098f[_0x0384('0x1d')]?_[_0x0384('0x1e')](_0x5e098f[_0x0384('0x1d')],function(_0x1161db){return{'model':db[_0x1161db[_0x0384('0x1f')]],'as':_0x1161db['as'],'attributes':_0x1161db[_0x0384('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0384('0x20')](function(_0x48806f){logger['info'](_0x0384('0x21'),_0x202eb5);logger[_0x0384('0x22')](_0x0384('0x21'),_0x202eb5,JSON['stringify'](_0x48806f));_0x1c2e98(_0x48806f);})[_0x0384('0x16')](function(_0xcde960){logger['error'](_0x0384('0x21'),_0xcde960[_0x0384('0x14')],_0x202eb5);_0x9f8a79(_0x539e79[_0x0384('0x12')](0x1f4,_0xcde960[_0x0384('0x14')]));});});};exports['ShowDynamics365Account']=function(_0x5c92b9){var _0x4dc822=this;return new Promise(function(_0x1d556,_0x2443db){return db[_0x0384('0x17')][_0x0384('0x23')]({'raw':_0x5c92b9[_0x0384('0x19')]?_0x5c92b9[_0x0384('0x19')][_0x0384('0x24')]===undefined?!![]:![]:!![],'where':_0x5c92b9['options']?_0x5c92b9[_0x0384('0x19')][_0x0384('0x1a')]||null:null,'attributes':_0x5c92b9['options']?_0x5c92b9[_0x0384('0x19')][_0x0384('0x1b')]||null:null,'include':_0x5c92b9[_0x0384('0x19')]?_0x5c92b9['options'][_0x0384('0x1d')]?_[_0x0384('0x1e')](_0x5c92b9[_0x0384('0x19')][_0x0384('0x1d')],function(_0xbd843d){return{'model':db[_0xbd843d[_0x0384('0x1f')]],'as':_0xbd843d['as'],'attributes':_0xbd843d[_0x0384('0x1b')],'include':_0xbd843d[_0x0384('0x1d')]?_[_0x0384('0x1e')](_0xbd843d[_0x0384('0x1d')],function(_0x312d10){return{'model':db[_0x312d10[_0x0384('0x1f')]],'as':_0x312d10['as'],'attributes':_0x312d10[_0x0384('0x1b')],'include':_0x312d10[_0x0384('0x1d')]?_[_0x0384('0x1e')](_0x312d10[_0x0384('0x1d')],function(_0x49c1cc){return{'model':db[_0x49c1cc[_0x0384('0x1f')]],'as':_0x49c1cc['as'],'attributes':_0x49c1cc[_0x0384('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a914f){logger['info']('ShowDynamics365Account',_0x5c92b9);logger[_0x0384('0x22')](_0x0384('0x25'),_0x5c92b9,JSON[_0x0384('0x26')](_0x4a914f));_0x1d556(_0x4a914f);})[_0x0384('0x16')](function(_0x1774ce){logger['error'](_0x0384('0x25'),_0x1774ce[_0x0384('0x14')],_0x5c92b9);_0x2443db(_0x4dc822[_0x0384('0x12')](0x1f4,_0x1774ce[_0x0384('0x14')]));});});}; \ No newline at end of file +var _0xec50=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','include','map','model','find','raw','ShowDynamics365Account','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x4817f9,_0x4070d1){var _0x2dcfa6=function(_0x408973){while(--_0x408973){_0x4817f9['push'](_0x4817f9['shift']());}};_0x2dcfa6(++_0x4070d1);}(_0xec50,0x13e));var _0x0ec5=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0xec50[_0x7791d5];return _0x5ce288;};'use strict';var _=require(_0x0ec5('0x0'));var util=require(_0x0ec5('0x1'));var moment=require(_0x0ec5('0x2'));var BPromise=require(_0x0ec5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ec5('0x4'));var db=require(_0x0ec5('0x5'))['db'];var utils=require(_0x0ec5('0x6'));var logger=require(_0x0ec5('0x7'))(_0x0ec5('0x8'));var config=require('../../config/environment');var jayson=require(_0x0ec5('0x9'));var client=jayson['client'][_0x0ec5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46cfc6,_0x1bf188,_0x33d689){return new BPromise(function(_0x58ca56,_0x2adfec){return client[_0x0ec5('0xb')](_0x46cfc6,_0x33d689)[_0x0ec5('0xc')](function(_0x430d8d){logger['info'](_0x0ec5('0xd'),_0x1bf188,_0x0ec5('0xe'));logger[_0x0ec5('0xf')](_0x0ec5('0x10'),_0x1bf188,_0x0ec5('0xe'),JSON[_0x0ec5('0x11')](_0x430d8d));if(_0x430d8d['error']){if(_0x430d8d[_0x0ec5('0x12')][_0x0ec5('0x13')]===0x1f4){logger[_0x0ec5('0x12')](_0x0ec5('0xd'),_0x1bf188,_0x430d8d['error'][_0x0ec5('0x14')]);return _0x2adfec(_0x430d8d[_0x0ec5('0x12')][_0x0ec5('0x14')]);}logger[_0x0ec5('0x12')](_0x0ec5('0xd'),_0x1bf188,_0x430d8d[_0x0ec5('0x12')][_0x0ec5('0x14')]);return _0x58ca56(_0x430d8d['error']['message']);}else{logger[_0x0ec5('0x15')](_0x0ec5('0xd'),_0x1bf188,_0x0ec5('0xe'));_0x58ca56(_0x430d8d[_0x0ec5('0x16')][_0x0ec5('0x14')]);}})[_0x0ec5('0x17')](function(_0x6509fb){logger[_0x0ec5('0x12')](_0x0ec5('0xd'),_0x1bf188,_0x6509fb);_0x2adfec(_0x6509fb);});});}exports[_0x0ec5('0x18')]=function(_0x14143c){var _0x14d9ba=this;return new Promise(function(_0x1c2387,_0x2a224c){return db[_0x0ec5('0x19')][_0x0ec5('0x1a')]({'raw':_0x14143c[_0x0ec5('0x1b')]?_0x14143c[_0x0ec5('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x14143c[_0x0ec5('0x1b')]?_0x14143c[_0x0ec5('0x1b')][_0x0ec5('0x1c')]||null:null,'attributes':_0x14143c[_0x0ec5('0x1b')]?_0x14143c['options'][_0x0ec5('0x1d')]||null:null,'limit':_0x14143c['options']?_0x14143c[_0x0ec5('0x1b')]['limit']||null:null,'include':_0x14143c[_0x0ec5('0x1b')]?_0x14143c[_0x0ec5('0x1b')][_0x0ec5('0x1e')]?_[_0x0ec5('0x1f')](_0x14143c[_0x0ec5('0x1b')][_0x0ec5('0x1e')],function(_0x5ef03a){return{'model':db[_0x5ef03a[_0x0ec5('0x20')]],'as':_0x5ef03a['as'],'attributes':_0x5ef03a[_0x0ec5('0x1d')],'include':_0x5ef03a[_0x0ec5('0x1e')]?_[_0x0ec5('0x1f')](_0x5ef03a[_0x0ec5('0x1e')],function(_0x4c2c4c){return{'model':db[_0x4c2c4c['model']],'as':_0x4c2c4c['as'],'attributes':_0x4c2c4c[_0x0ec5('0x1d')],'include':_0x4c2c4c[_0x0ec5('0x1e')]?_[_0x0ec5('0x1f')](_0x4c2c4c[_0x0ec5('0x1e')],function(_0x169b63){return{'model':db[_0x169b63[_0x0ec5('0x20')]],'as':_0x169b63['as'],'attributes':_0x169b63[_0x0ec5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0ec5('0xc')](function(_0x32d212){logger[_0x0ec5('0x15')](_0x0ec5('0x18'),_0x14143c);logger['debug'](_0x0ec5('0x18'),_0x14143c,JSON[_0x0ec5('0x11')](_0x32d212));_0x1c2387(_0x32d212);})[_0x0ec5('0x17')](function(_0x348d25){logger[_0x0ec5('0x12')](_0x0ec5('0x18'),_0x348d25['message'],_0x14143c);_0x2a224c(_0x14d9ba[_0x0ec5('0x12')](0x1f4,_0x348d25['message']));});});};exports['ShowDynamics365Account']=function(_0x43422d){var _0x451b90=this;return new Promise(function(_0x33d37e,_0x8316f5){return db[_0x0ec5('0x19')][_0x0ec5('0x21')]({'raw':_0x43422d[_0x0ec5('0x1b')]?_0x43422d[_0x0ec5('0x1b')][_0x0ec5('0x22')]===undefined?!![]:![]:!![],'where':_0x43422d['options']?_0x43422d[_0x0ec5('0x1b')]['where']||null:null,'attributes':_0x43422d[_0x0ec5('0x1b')]?_0x43422d[_0x0ec5('0x1b')]['attributes']||null:null,'include':_0x43422d[_0x0ec5('0x1b')]?_0x43422d['options'][_0x0ec5('0x1e')]?_['map'](_0x43422d[_0x0ec5('0x1b')]['include'],function(_0x383405){return{'model':db[_0x383405[_0x0ec5('0x20')]],'as':_0x383405['as'],'attributes':_0x383405[_0x0ec5('0x1d')],'include':_0x383405['include']?_[_0x0ec5('0x1f')](_0x383405[_0x0ec5('0x1e')],function(_0x53ccd1){return{'model':db[_0x53ccd1[_0x0ec5('0x20')]],'as':_0x53ccd1['as'],'attributes':_0x53ccd1[_0x0ec5('0x1d')],'include':_0x53ccd1[_0x0ec5('0x1e')]?_[_0x0ec5('0x1f')](_0x53ccd1['include'],function(_0x4f709c){return{'model':db[_0x4f709c[_0x0ec5('0x20')]],'as':_0x4f709c['as'],'attributes':_0x4f709c['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ec5('0xc')](function(_0x11517f){logger['info'](_0x0ec5('0x23'),_0x43422d);logger['debug'](_0x0ec5('0x23'),_0x43422d,JSON[_0x0ec5('0x11')](_0x11517f));_0x33d37e(_0x11517f);})[_0x0ec5('0x17')](function(_0x56b556){logger[_0x0ec5('0x12')](_0x0ec5('0x23'),_0x56b556[_0x0ec5('0x14')],_0x43422d);_0x8316f5(_0x451b90[_0x0ec5('0x12')](0x1f4,_0x56b556[_0x0ec5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 02cde44..210fdbc 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 _0x96be=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id','delete','destroy'];(function(_0x52335f,_0x4c229e){var _0x503602=function(_0x3eba29){while(--_0x3eba29){_0x52335f['push'](_0x52335f['shift']());}};_0x503602(++_0x4c229e);}(_0x96be,0x1c9));var _0xe96b=function(_0x16614b,_0x22fd39){_0x16614b=_0x16614b-0x0;var _0x552d22=_0x96be[_0x16614b];return _0x552d22;};'use strict';var multer=require(_0xe96b('0x0'));var util=require(_0xe96b('0x1'));var path=require(_0xe96b('0x2'));var timeout=require(_0xe96b('0x3'));var express=require(_0xe96b('0x4'));var router=express[_0xe96b('0x5')]();var fs_extra=require(_0xe96b('0x6'));var auth=require(_0xe96b('0x7'));var interaction=require(_0xe96b('0x8'));var config=require(_0xe96b('0x9'));var controller=require(_0xe96b('0xa'));router[_0xe96b('0xb')]('/',auth[_0xe96b('0xc')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe96b('0xd')]);router[_0xe96b('0xb')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xe96b('0xb')](_0xe96b('0xe'),auth[_0xe96b('0xc')](),controller[_0xe96b('0xf')]);router[_0xe96b('0xb')](_0xe96b('0x10'),auth[_0xe96b('0xc')](),controller[_0xe96b('0x11')]);router['post']('/',auth[_0xe96b('0xc')](),controller[_0xe96b('0x12')]);router[_0xe96b('0x13')](_0xe96b('0x14'),auth[_0xe96b('0xc')](),controller['update']);router[_0xe96b('0x15')](_0xe96b('0x14'),auth['isAuthenticated'](),controller[_0xe96b('0x16')]);module[_0xe96b('0x17')]=router; \ No newline at end of file +var _0x340e=['isAuthenticated','get','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x340e,0x1dc));var _0xe340=function(_0x3b0cd2,_0x5c4b2a){_0x3b0cd2=_0x3b0cd2-0x0;var _0x195439=_0x340e[_0x3b0cd2];return _0x195439;};'use strict';var multer=require(_0xe340('0x0'));var util=require('util');var path=require(_0xe340('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe340('0x2')]();var fs_extra=require(_0xe340('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe340('0x4'));var config=require(_0xe340('0x5'));var controller=require(_0xe340('0x6'));router['get']('/',auth[_0xe340('0x7')](),controller['index']);router[_0xe340('0x8')](_0xe340('0x9'),auth[_0xe340('0x7')](),controller[_0xe340('0xa')]);router[_0xe340('0x8')]('/:id/fields',auth[_0xe340('0x7')](),controller[_0xe340('0xb')]);router[_0xe340('0x8')]('/:id/subjects',auth[_0xe340('0x7')](),controller[_0xe340('0xc')]);router[_0xe340('0x8')](_0xe340('0xd'),auth['isAuthenticated'](),controller[_0xe340('0xe')]);router[_0xe340('0xf')]('/',auth[_0xe340('0x7')](),controller[_0xe340('0x10')]);router[_0xe340('0x11')](_0xe340('0x9'),auth[_0xe340('0x7')](),controller['update']);router[_0xe340('0x12')](_0xe340('0x9'),auth[_0xe340('0x7')](),controller[_0xe340('0x13')]);module[_0xe340('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 75c3bce..4bb37b6 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 _0x1349=['STRING','ENUM','incident','phonecall','sequelize','exports'];(function(_0xfda96d,_0x59044){var _0x5589b3=function(_0x312973){while(--_0x312973){_0xfda96d['push'](_0xfda96d['shift']());}};_0x5589b3(++_0x59044);}(_0x1349,0x142));var _0x9134=function(_0x2f411c,_0x471e02){_0x2f411c=_0x2f411c-0x0;var _0x1a690f=_0x1349[_0x2f411c];return _0x1a690f;};'use strict';var Sequelize=require(_0x9134('0x0'));module[_0x9134('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9134('0x2')]},'ticketType':{'type':Sequelize[_0x9134('0x3')](_0x9134('0x4'),_0x9134('0x5')),'defaultValue':_0x9134('0x4')}}; \ No newline at end of file +var _0x100c=['exports','STRING','ENUM','phonecall','incident','sequelize'];(function(_0x148507,_0x47bc38){var _0x3ddca3=function(_0x44b142){while(--_0x44b142){_0x148507['push'](_0x148507['shift']());}};_0x3ddca3(++_0x47bc38);}(_0x100c,0x173));var _0xc100=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x100c[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0xc100('0x0'));module[_0xc100('0x1')]={'name':{'type':Sequelize[_0xc100('0x2')]},'description':{'type':Sequelize[_0xc100('0x2')]},'ticketType':{'type':Sequelize[_0xc100('0x3')]('incident',_0xc100('0x4')),'defaultValue':_0xc100('0x5')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 53074dd..d332f63 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 _0xfead=['send','map','Dynamics365Configuration','rawAttributes','key','keys','query','intersection','model','attributes','fields','length','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','getFields','Dynamics365Field','pick','hasOwnProperty','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','update','then','destroy','stack','name'];(function(_0x454abf,_0xac959d){var _0x47ce07=function(_0x444376){while(--_0x444376){_0x454abf['push'](_0x454abf['shift']());}};_0x47ce07(++_0xac959d);}(_0xfead,0x70));var _0xdfea=function(_0xe7ff14,_0x55917b){_0xe7ff14=_0xe7ff14-0x0;var _0x5f1d8b=_0xfead[_0xe7ff14];return _0x5f1d8b;};'use strict';var emlformat=require(_0xdfea('0x0'));var rimraf=require(_0xdfea('0x1'));var zipdir=require(_0xdfea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdfea('0x3'));var moment=require(_0xdfea('0x4'));var BPromise=require(_0xdfea('0x5'));var Mustache=require(_0xdfea('0x6'));var util=require('util');var path=require(_0xdfea('0x7'));var sox=require(_0xdfea('0x8'));var csv=require(_0xdfea('0x9'));var ejs=require(_0xdfea('0xa'));var fs=require('fs');var fs_extra=require(_0xdfea('0xb'));var _=require('lodash');var squel=require(_0xdfea('0xc'));var crypto=require('crypto');var jsforce=require(_0xdfea('0xd'));var deskjs=require(_0xdfea('0xe'));var toCsv=require(_0xdfea('0x9'));var querystring=require(_0xdfea('0xf'));var Papa=require('papaparse');var Redis=require(_0xdfea('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xdfea('0x11'));var as=require(_0xdfea('0x12'));var hardwareService=require(_0xdfea('0x13'));var logger=require(_0xdfea('0x14'))('api');var utils=require(_0xdfea('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdfea('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x162f39,_0x361840){_0x361840=_0x361840||0xcc;return function(_0x41a7d1){if(_0x41a7d1){return _0x162f39[_0xdfea('0x17')](_0x361840);}return _0x162f39[_0xdfea('0x18')](_0x361840)[_0xdfea('0x19')]();};}function respondWithResult(_0x575773,_0x18f0d4){_0x18f0d4=_0x18f0d4||0xc8;return function(_0x2ac741){if(_0x2ac741){return _0x575773[_0xdfea('0x18')](_0x18f0d4)[_0xdfea('0x1a')](_0x2ac741);}};}function respondWithFilteredResult(_0x31fbf7,_0x55c07c){return function(_0x5a8ff1){if(_0x5a8ff1){var _0x470763=typeof _0x55c07c[_0xdfea('0x1b')]===_0xdfea('0x1c')&&typeof _0x55c07c['limit']===_0xdfea('0x1c');var _0x4731b5=_0x5a8ff1[_0xdfea('0x1d')];var _0x1cd626=_0x470763?0x0:_0x55c07c[_0xdfea('0x1b')];var _0x2ed139=_0x470763?_0x5a8ff1[_0xdfea('0x1d')]:_0x55c07c[_0xdfea('0x1b')]+_0x55c07c[_0xdfea('0x1e')];var _0x37edcf;if(_0x2ed139>=_0x4731b5){_0x2ed139=_0x4731b5;_0x37edcf=0xc8;}else{_0x37edcf=0xce;}_0x31fbf7[_0xdfea('0x18')](_0x37edcf);return _0x31fbf7[_0xdfea('0x1f')]('Content-Range',_0x1cd626+'-'+_0x2ed139+'/'+_0x4731b5)[_0xdfea('0x1a')](_0x5a8ff1);}return null;};}function patchUpdates(_0x5dd0ae){return function(_0x46903d){try{jsonpatch[_0xdfea('0x20')](_0x46903d,_0x5dd0ae,!![]);}catch(_0x46131c){return BPromise['reject'](_0x46131c);}return _0x46903d['save']();};}function saveUpdates(_0x455472,_0x18883e){return function(_0x1a9065){if(_0x1a9065){return _0x1a9065[_0xdfea('0x21')](_0x455472)[_0xdfea('0x22')](function(_0x4f6225){return _0x4f6225;});}return null;};}function removeEntity(_0x461e54,_0xd33af1){return function(_0x5b902e){if(_0x5b902e){return _0x5b902e[_0xdfea('0x23')]()['then'](function(){_0x461e54[_0xdfea('0x18')](0xcc)[_0xdfea('0x19')]();});}};}function handleEntityNotFound(_0x2c556a,_0x145883){return function(_0x13ac16){if(!_0x13ac16){_0x2c556a[_0xdfea('0x17')](0x194);}return _0x13ac16;};}function handleError(_0x208974,_0x142ca4){_0x142ca4=_0x142ca4||0x1f4;return function(_0x5d64a4){logger['error'](_0x5d64a4[_0xdfea('0x24')]);if(_0x5d64a4[_0xdfea('0x25')]){delete _0x5d64a4[_0xdfea('0x25')];}_0x208974[_0xdfea('0x18')](_0x142ca4)[_0xdfea('0x26')](_0x5d64a4);};}exports['index']=function(_0xb727bc,_0x177f22){var _0x21975f={},_0x19994a={},_0x267b5f={'count':0x0,'rows':[]};var _0x3373da=_[_0xdfea('0x27')](db[_0xdfea('0x28')][_0xdfea('0x29')],function(_0x4b8494){return{'name':_0x4b8494['fieldName'],'type':_0x4b8494['type'][_0xdfea('0x2a')]};});_0x19994a['model']=_[_0xdfea('0x27')](_0x3373da,_0xdfea('0x25'));_0x19994a['query']=_[_0xdfea('0x2b')](_0xb727bc[_0xdfea('0x2c')]);_0x19994a['filters']=_[_0xdfea('0x2d')](_0x19994a[_0xdfea('0x2e')],_0x19994a['query']);_0x21975f[_0xdfea('0x2f')]=_[_0xdfea('0x2d')](_0x19994a[_0xdfea('0x2e')],qs[_0xdfea('0x30')](_0xb727bc[_0xdfea('0x2c')][_0xdfea('0x30')]));_0x21975f[_0xdfea('0x2f')]=_0x21975f['attributes'][_0xdfea('0x31')]?_0x21975f[_0xdfea('0x2f')]:_0x19994a[_0xdfea('0x2e')];if(!_0xb727bc[_0xdfea('0x2c')]['hasOwnProperty']('nolimit')){_0x21975f[_0xdfea('0x1e')]=qs['limit'](_0xb727bc[_0xdfea('0x2c')]['limit']);_0x21975f[_0xdfea('0x1b')]=qs[_0xdfea('0x1b')](_0xb727bc[_0xdfea('0x2c')][_0xdfea('0x1b')]);}_0x21975f[_0xdfea('0x32')]=qs[_0xdfea('0x33')](_0xb727bc[_0xdfea('0x2c')][_0xdfea('0x33')]);_0x21975f[_0xdfea('0x34')]=qs[_0xdfea('0x35')](_['pick'](_0xb727bc['query'],_0x19994a[_0xdfea('0x35')]),_0x3373da);if(_0xb727bc[_0xdfea('0x2c')][_0xdfea('0x36')]){_0x21975f[_0xdfea('0x34')]=_[_0xdfea('0x37')](_0x21975f[_0xdfea('0x34')],{'$or':_[_0xdfea('0x27')](_0x3373da,function(_0x238311){if(_0x238311[_0xdfea('0x38')]!==_0xdfea('0x39')){var _0x292ad7={};_0x292ad7[_0x238311['name']]={'$like':'%'+_0xb727bc[_0xdfea('0x2c')][_0xdfea('0x36')]+'%'};return _0x292ad7;}})});}_0x21975f=_[_0xdfea('0x37')]({},_0x21975f,_0xb727bc[_0xdfea('0x3a')]);var _0xf224ab={'where':_0x21975f[_0xdfea('0x34')]};return db[_0xdfea('0x28')][_0xdfea('0x1d')](_0xf224ab)[_0xdfea('0x22')](function(_0x3e0164){_0x267b5f[_0xdfea('0x1d')]=_0x3e0164;if(_0xb727bc['query'][_0xdfea('0x3b')]){_0x21975f[_0xdfea('0x3c')]=[{'all':!![]}];}return db[_0xdfea('0x28')]['findAll'](_0x21975f);})[_0xdfea('0x22')](function(_0x175bdd){_0x267b5f[_0xdfea('0x3d')]=_0x175bdd;return _0x267b5f;})[_0xdfea('0x22')](respondWithFilteredResult(_0x177f22,_0x21975f))[_0xdfea('0x3e')](handleError(_0x177f22,null));};exports[_0xdfea('0x3f')]=function(_0x28f530,_0xaa5288){var _0x4a38e7={'raw':![],'where':{'id':_0x28f530[_0xdfea('0x40')]['id']}},_0x4e6fe0={};_0x4e6fe0[_0xdfea('0x2e')]=_[_0xdfea('0x2b')](db[_0xdfea('0x28')]['rawAttributes']);_0x4e6fe0[_0xdfea('0x2c')]=_[_0xdfea('0x2b')](_0x28f530[_0xdfea('0x2c')]);_0x4e6fe0['filters']=_[_0xdfea('0x2d')](_0x4e6fe0[_0xdfea('0x2e')],_0x4e6fe0[_0xdfea('0x2c')]);_0x4a38e7[_0xdfea('0x2f')]=_[_0xdfea('0x2d')](_0x4e6fe0[_0xdfea('0x2e')],qs[_0xdfea('0x30')](_0x28f530['query'][_0xdfea('0x30')]));_0x4a38e7[_0xdfea('0x2f')]=_0x4a38e7[_0xdfea('0x2f')]['length']?_0x4a38e7[_0xdfea('0x2f')]:_0x4e6fe0[_0xdfea('0x2e')];if(_0x28f530['query'][_0xdfea('0x3b')]){_0x4a38e7['include']=[{'all':!![]}];}_0x4a38e7=_[_0xdfea('0x37')]({},_0x4a38e7,_0x28f530[_0xdfea('0x3a')]);return db[_0xdfea('0x28')][_0xdfea('0x41')](_0x4a38e7)[_0xdfea('0x22')](handleEntityNotFound(_0xaa5288,null))[_0xdfea('0x22')](respondWithResult(_0xaa5288,null))['catch'](handleError(_0xaa5288,null));};exports[_0xdfea('0x42')]=function(_0x369db2,_0x2410ba){return db[_0xdfea('0x28')][_0xdfea('0x42')](_0x369db2[_0xdfea('0x43')],{})[_0xdfea('0x22')](respondWithResult(_0x2410ba,0xc9))[_0xdfea('0x3e')](handleError(_0x2410ba,null));};exports[_0xdfea('0x21')]=function(_0x6c4672,_0x58719c){if(_0x6c4672['body']['id']){delete _0x6c4672[_0xdfea('0x43')]['id'];}return db[_0xdfea('0x28')]['find']({'where':{'id':_0x6c4672[_0xdfea('0x40')]['id']}})[_0xdfea('0x22')](handleEntityNotFound(_0x58719c,null))['then'](saveUpdates(_0x6c4672[_0xdfea('0x43')],null))[_0xdfea('0x22')](respondWithResult(_0x58719c,null))[_0xdfea('0x3e')](handleError(_0x58719c,null));};exports[_0xdfea('0x23')]=function(_0x166ff1,_0x26d815){return db[_0xdfea('0x28')][_0xdfea('0x41')]({'where':{'id':_0x166ff1[_0xdfea('0x40')]['id']}})['then'](handleEntityNotFound(_0x26d815,null))[_0xdfea('0x22')](removeEntity(_0x26d815,null))[_0xdfea('0x3e')](handleError(_0x26d815,null));};exports[_0xdfea('0x44')]=function(_0x74cf8c,_0x26142f,_0x5b1512){var _0x19670d={};var _0x28874e={};var _0x58e952;var _0x45bb14;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x74cf8c['params']['id']}})[_0xdfea('0x22')](handleEntityNotFound(_0x26142f,null))['then'](function(_0xe967c4){if(_0xe967c4){_0x58e952=_0xe967c4;_0x28874e['model']=_['keys'](db[_0xdfea('0x45')][_0xdfea('0x29')]);_0x28874e['query']=_[_0xdfea('0x2b')](_0x74cf8c[_0xdfea('0x2c')]);_0x28874e['filters']=_[_0xdfea('0x2d')](_0x28874e[_0xdfea('0x2e')],_0x28874e[_0xdfea('0x2c')]);_0x19670d['attributes']=_[_0xdfea('0x2d')](_0x28874e[_0xdfea('0x2e')],qs[_0xdfea('0x30')](_0x74cf8c[_0xdfea('0x2c')][_0xdfea('0x30')]));_0x19670d[_0xdfea('0x2f')]=_0x19670d[_0xdfea('0x2f')][_0xdfea('0x31')]?_0x19670d[_0xdfea('0x2f')]:_0x28874e[_0xdfea('0x2e')];_0x19670d[_0xdfea('0x32')]=qs[_0xdfea('0x33')](_0x74cf8c[_0xdfea('0x2c')]['sort']);_0x19670d[_0xdfea('0x34')]=qs[_0xdfea('0x35')](_[_0xdfea('0x46')](_0x74cf8c[_0xdfea('0x2c')],_0x28874e[_0xdfea('0x35')]));if(_0x74cf8c[_0xdfea('0x2c')][_0xdfea('0x36')]){_0x19670d['where']=_[_0xdfea('0x37')](_0x19670d[_0xdfea('0x34')],{'$or':_[_0xdfea('0x27')](_0x19670d['attributes'],function(_0x53c505){var _0x5240d5={};_0x5240d5[_0x53c505]={'$like':'%'+_0x74cf8c[_0xdfea('0x2c')][_0xdfea('0x36')]+'%'};return _0x5240d5;})});}_0x19670d=_[_0xdfea('0x37')]({},_0x19670d,_0x74cf8c['options']);return _0x58e952[_0xdfea('0x44')](_0x19670d);}})[_0xdfea('0x22')](function(_0x3a8696){if(_0x3a8696){_0x45bb14=_0x3a8696['length'];if(!_0x74cf8c[_0xdfea('0x2c')][_0xdfea('0x47')]('nolimit')){_0x19670d[_0xdfea('0x1e')]=qs[_0xdfea('0x1e')](_0x74cf8c['query'][_0xdfea('0x1e')]);_0x19670d[_0xdfea('0x1b')]=qs[_0xdfea('0x1b')](_0x74cf8c['query']['offset']);}return _0x58e952[_0xdfea('0x44')](_0x19670d);}})[_0xdfea('0x22')](function(_0x5345fd){if(_0x5345fd){return _0x5345fd?{'count':_0x45bb14,'rows':_0x5345fd}:null;}})[_0xdfea('0x22')](respondWithResult(_0x26142f,null))[_0xdfea('0x3e')](handleError(_0x26142f,null));};exports[_0xdfea('0x48')]=function(_0x204ce1,_0x47cb08,_0x53af15){var _0x5f55b4={};var _0x4f2b88={};var _0x28c571;var _0x4a16ff;return db[_0xdfea('0x28')]['findOne']({'where':{'id':_0x204ce1['params']['id']}})[_0xdfea('0x22')](handleEntityNotFound(_0x47cb08,null))[_0xdfea('0x22')](function(_0x1938b8){if(_0x1938b8){_0x28c571=_0x1938b8;_0x4f2b88[_0xdfea('0x2e')]=_['keys'](db[_0xdfea('0x45')][_0xdfea('0x29')]);_0x4f2b88[_0xdfea('0x2c')]=_['keys'](_0x204ce1['query']);_0x4f2b88[_0xdfea('0x35')]=_[_0xdfea('0x2d')](_0x4f2b88[_0xdfea('0x2e')],_0x4f2b88[_0xdfea('0x2c')]);_0x5f55b4[_0xdfea('0x2f')]=_[_0xdfea('0x2d')](_0x4f2b88['model'],qs[_0xdfea('0x30')](_0x204ce1[_0xdfea('0x2c')][_0xdfea('0x30')]));_0x5f55b4['attributes']=_0x5f55b4['attributes']['length']?_0x5f55b4[_0xdfea('0x2f')]:_0x4f2b88[_0xdfea('0x2e')];_0x5f55b4['order']=qs[_0xdfea('0x33')](_0x204ce1[_0xdfea('0x2c')][_0xdfea('0x33')]);_0x5f55b4[_0xdfea('0x34')]=qs[_0xdfea('0x35')](_[_0xdfea('0x46')](_0x204ce1[_0xdfea('0x2c')],_0x4f2b88[_0xdfea('0x35')]));if(_0x204ce1['query']['filter']){_0x5f55b4[_0xdfea('0x34')]=_[_0xdfea('0x37')](_0x5f55b4[_0xdfea('0x34')],{'$or':_[_0xdfea('0x27')](_0x5f55b4[_0xdfea('0x2f')],function(_0x47fcbf){var _0x37bbaf={};_0x37bbaf[_0x47fcbf]={'$like':'%'+_0x204ce1[_0xdfea('0x2c')][_0xdfea('0x36')]+'%'};return _0x37bbaf;})});}_0x5f55b4=_['merge']({},_0x5f55b4,_0x204ce1[_0xdfea('0x3a')]);return _0x28c571[_0xdfea('0x48')](_0x5f55b4);}})[_0xdfea('0x22')](function(_0x5d7bd8){if(_0x5d7bd8){_0x4a16ff=_0x5d7bd8['length'];if(!_0x204ce1[_0xdfea('0x2c')][_0xdfea('0x47')](_0xdfea('0x49'))){_0x5f55b4[_0xdfea('0x1e')]=qs['limit'](_0x204ce1[_0xdfea('0x2c')]['limit']);_0x5f55b4[_0xdfea('0x1b')]=qs[_0xdfea('0x1b')](_0x204ce1[_0xdfea('0x2c')][_0xdfea('0x1b')]);}return _0x28c571[_0xdfea('0x48')](_0x5f55b4);}})['then'](function(_0x198802){if(_0x198802){return _0x198802?{'count':_0x4a16ff,'rows':_0x198802}:null;}})[_0xdfea('0x22')](respondWithResult(_0x47cb08,null))[_0xdfea('0x3e')](handleError(_0x47cb08,null));};exports[_0xdfea('0x4a')]=function(_0x1e80b4,_0x86fdd8,_0x668680){var _0x567790={};var _0x66eaac={};var _0x4c2d3b;var _0x2df6c4;return db[_0xdfea('0x28')]['findOne']({'where':{'id':_0x1e80b4[_0xdfea('0x40')]['id']}})[_0xdfea('0x22')](handleEntityNotFound(_0x86fdd8,null))['then'](function(_0x4ecfac){if(_0x4ecfac){_0x4c2d3b=_0x4ecfac;_0x66eaac[_0xdfea('0x2e')]=_[_0xdfea('0x2b')](db[_0xdfea('0x45')][_0xdfea('0x29')]);_0x66eaac[_0xdfea('0x2c')]=_[_0xdfea('0x2b')](_0x1e80b4[_0xdfea('0x2c')]);_0x66eaac[_0xdfea('0x35')]=_[_0xdfea('0x2d')](_0x66eaac['model'],_0x66eaac[_0xdfea('0x2c')]);_0x567790['attributes']=_[_0xdfea('0x2d')](_0x66eaac[_0xdfea('0x2e')],qs[_0xdfea('0x30')](_0x1e80b4['query']['fields']));_0x567790[_0xdfea('0x2f')]=_0x567790[_0xdfea('0x2f')]['length']?_0x567790[_0xdfea('0x2f')]:_0x66eaac['model'];_0x567790['order']=qs[_0xdfea('0x33')](_0x1e80b4['query'][_0xdfea('0x33')]);_0x567790[_0xdfea('0x34')]=qs[_0xdfea('0x35')](_['pick'](_0x1e80b4[_0xdfea('0x2c')],_0x66eaac[_0xdfea('0x35')]));if(_0x1e80b4[_0xdfea('0x2c')][_0xdfea('0x36')]){_0x567790['where']=_[_0xdfea('0x37')](_0x567790[_0xdfea('0x34')],{'$or':_[_0xdfea('0x27')](_0x567790[_0xdfea('0x2f')],function(_0x39675c){var _0x864c94={};_0x864c94[_0x39675c]={'$like':'%'+_0x1e80b4[_0xdfea('0x2c')][_0xdfea('0x36')]+'%'};return _0x864c94;})});}_0x567790=_[_0xdfea('0x37')]({},_0x567790,_0x1e80b4['options']);return _0x4c2d3b[_0xdfea('0x4a')](_0x567790);}})[_0xdfea('0x22')](function(_0x34c769){if(_0x34c769){_0x2df6c4=_0x34c769['length'];if(!_0x1e80b4[_0xdfea('0x2c')]['hasOwnProperty'](_0xdfea('0x49'))){_0x567790['limit']=qs[_0xdfea('0x1e')](_0x1e80b4[_0xdfea('0x2c')][_0xdfea('0x1e')]);_0x567790[_0xdfea('0x1b')]=qs[_0xdfea('0x1b')](_0x1e80b4['query'][_0xdfea('0x1b')]);}return _0x4c2d3b[_0xdfea('0x4a')](_0x567790);}})['then'](function(_0x275f61){if(_0x275f61){return _0x275f61?{'count':_0x2df6c4,'rows':_0x275f61}:null;}})[_0xdfea('0x22')](respondWithResult(_0x86fdd8,null))[_0xdfea('0x3e')](handleError(_0x86fdd8,null));}; \ No newline at end of file +var _0xcce4=['where','pick','filter','merge','VIRTUAL','include','Dynamics365Configuration','rows','catch','show','params','includeAll','options','find','create','body','getFields','hasOwnProperty','findOne','Dynamics365Field','order','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort'];(function(_0x25bca1,_0x5c8a11){var _0x191994=function(_0x384af3){while(--_0x384af3){_0x25bca1['push'](_0x25bca1['shift']());}};_0x191994(++_0x5c8a11);}(_0xcce4,0xbb));var _0x4cce=function(_0x1c2f29,_0x5a2668){_0x1c2f29=_0x1c2f29-0x0;var _0x258465=_0xcce4[_0x1c2f29];return _0x258465;};'use strict';var emlformat=require(_0x4cce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4cce('0x1'));var jsonpatch=require(_0x4cce('0x2'));var rp=require('request-promise');var moment=require(_0x4cce('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4cce('0x4'));var util=require(_0x4cce('0x5'));var path=require(_0x4cce('0x6'));var sox=require(_0x4cce('0x7'));var csv=require(_0x4cce('0x8'));var ejs=require(_0x4cce('0x9'));var fs=require('fs');var fs_extra=require(_0x4cce('0xa'));var _=require(_0x4cce('0xb'));var squel=require(_0x4cce('0xc'));var crypto=require(_0x4cce('0xd'));var jsforce=require(_0x4cce('0xe'));var deskjs=require(_0x4cce('0xf'));var toCsv=require(_0x4cce('0x8'));var querystring=require('querystring');var Papa=require(_0x4cce('0x10'));var Redis=require(_0x4cce('0x11'));var authService=require(_0x4cce('0x12'));var qs=require(_0x4cce('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4cce('0x14'));var logger=require(_0x4cce('0x15'))(_0x4cce('0x16'));var utils=require(_0x4cce('0x17'));var config=require(_0x4cce('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4cce('0x19'))['db'];function respondWithStatusCode(_0x452194,_0x9a0b24){_0x9a0b24=_0x9a0b24||0xcc;return function(_0x118efd){if(_0x118efd){return _0x452194[_0x4cce('0x1a')](_0x9a0b24);}return _0x452194[_0x4cce('0x1b')](_0x9a0b24)[_0x4cce('0x1c')]();};}function respondWithResult(_0x307b4c,_0x128494){_0x128494=_0x128494||0xc8;return function(_0x6e2bef){if(_0x6e2bef){return _0x307b4c[_0x4cce('0x1b')](_0x128494)[_0x4cce('0x1d')](_0x6e2bef);}};}function respondWithFilteredResult(_0x3e1e8e,_0x46ea05){return function(_0x342d04){if(_0x342d04){var _0x24d758=typeof _0x46ea05[_0x4cce('0x1e')]==='undefined'&&typeof _0x46ea05[_0x4cce('0x1f')]==='undefined';var _0x1f22d5=_0x342d04['count'];var _0x1c7b41=_0x24d758?0x0:_0x46ea05['offset'];var _0x383d13=_0x24d758?_0x342d04[_0x4cce('0x20')]:_0x46ea05[_0x4cce('0x1e')]+_0x46ea05[_0x4cce('0x1f')];var _0x4964dd;if(_0x383d13>=_0x1f22d5){_0x383d13=_0x1f22d5;_0x4964dd=0xc8;}else{_0x4964dd=0xce;}_0x3e1e8e[_0x4cce('0x1b')](_0x4964dd);return _0x3e1e8e[_0x4cce('0x21')](_0x4cce('0x22'),_0x1c7b41+'-'+_0x383d13+'/'+_0x1f22d5)[_0x4cce('0x1d')](_0x342d04);}return null;};}function patchUpdates(_0x46599e){return function(_0xd9cf49){try{jsonpatch[_0x4cce('0x23')](_0xd9cf49,_0x46599e,!![]);}catch(_0x31372e){return BPromise['reject'](_0x31372e);}return _0xd9cf49[_0x4cce('0x24')]();};}function saveUpdates(_0x20ca5c,_0x59818e){return function(_0x23a525){if(_0x23a525){return _0x23a525[_0x4cce('0x25')](_0x20ca5c)[_0x4cce('0x26')](function(_0x11c05b){return _0x11c05b;});}return null;};}function removeEntity(_0x178939,_0x2a53eb){return function(_0xf4146b){if(_0xf4146b){return _0xf4146b[_0x4cce('0x27')]()[_0x4cce('0x26')](function(){_0x178939[_0x4cce('0x1b')](0xcc)[_0x4cce('0x1c')]();});}};}function handleEntityNotFound(_0x5e45f9,_0x4b2109){return function(_0x4b8cb8){if(!_0x4b8cb8){_0x5e45f9[_0x4cce('0x1a')](0x194);}return _0x4b8cb8;};}function handleError(_0x31a191,_0x3572ec){_0x3572ec=_0x3572ec||0x1f4;return function(_0xdf1058){logger[_0x4cce('0x28')](_0xdf1058[_0x4cce('0x29')]);if(_0xdf1058[_0x4cce('0x2a')]){delete _0xdf1058['name'];}_0x31a191[_0x4cce('0x1b')](_0x3572ec)[_0x4cce('0x2b')](_0xdf1058);};}exports['index']=function(_0x261d91,_0x48d8fe){var _0x164c70={},_0x33230e={},_0x465839={'count':0x0,'rows':[]};var _0x29145b=_[_0x4cce('0x2c')](db['Dynamics365Configuration'][_0x4cce('0x2d')],function(_0x571bbd){return{'name':_0x571bbd[_0x4cce('0x2e')],'type':_0x571bbd[_0x4cce('0x2f')][_0x4cce('0x30')]};});_0x33230e[_0x4cce('0x31')]=_['map'](_0x29145b,_0x4cce('0x2a'));_0x33230e['query']=_[_0x4cce('0x32')](_0x261d91[_0x4cce('0x33')]);_0x33230e[_0x4cce('0x34')]=_[_0x4cce('0x35')](_0x33230e['model'],_0x33230e[_0x4cce('0x33')]);_0x164c70[_0x4cce('0x36')]=_[_0x4cce('0x35')](_0x33230e['model'],qs[_0x4cce('0x37')](_0x261d91['query']['fields']));_0x164c70[_0x4cce('0x36')]=_0x164c70['attributes'][_0x4cce('0x38')]?_0x164c70[_0x4cce('0x36')]:_0x33230e[_0x4cce('0x31')];if(!_0x261d91[_0x4cce('0x33')]['hasOwnProperty'](_0x4cce('0x39'))){_0x164c70[_0x4cce('0x1f')]=qs[_0x4cce('0x1f')](_0x261d91[_0x4cce('0x33')][_0x4cce('0x1f')]);_0x164c70[_0x4cce('0x1e')]=qs[_0x4cce('0x1e')](_0x261d91[_0x4cce('0x33')][_0x4cce('0x1e')]);}_0x164c70['order']=qs[_0x4cce('0x3a')](_0x261d91['query']['sort']);_0x164c70[_0x4cce('0x3b')]=qs[_0x4cce('0x34')](_[_0x4cce('0x3c')](_0x261d91[_0x4cce('0x33')],_0x33230e[_0x4cce('0x34')]),_0x29145b);if(_0x261d91[_0x4cce('0x33')][_0x4cce('0x3d')]){_0x164c70[_0x4cce('0x3b')]=_[_0x4cce('0x3e')](_0x164c70[_0x4cce('0x3b')],{'$or':_[_0x4cce('0x2c')](_0x29145b,function(_0x211093){if(_0x211093[_0x4cce('0x2f')]!==_0x4cce('0x3f')){var _0x29ba8d={};_0x29ba8d[_0x211093[_0x4cce('0x2a')]]={'$like':'%'+_0x261d91[_0x4cce('0x33')][_0x4cce('0x3d')]+'%'};return _0x29ba8d;}})});}_0x164c70=_['merge']({},_0x164c70,_0x261d91['options']);var _0xf580f3={'where':_0x164c70['where']};return db['Dynamics365Configuration']['count'](_0xf580f3)[_0x4cce('0x26')](function(_0x25fe4c){_0x465839[_0x4cce('0x20')]=_0x25fe4c;if(_0x261d91['query']['includeAll']){_0x164c70[_0x4cce('0x40')]=[{'all':!![]}];}return db[_0x4cce('0x41')]['findAll'](_0x164c70);})[_0x4cce('0x26')](function(_0x32a124){_0x465839[_0x4cce('0x42')]=_0x32a124;return _0x465839;})[_0x4cce('0x26')](respondWithFilteredResult(_0x48d8fe,_0x164c70))[_0x4cce('0x43')](handleError(_0x48d8fe,null));};exports[_0x4cce('0x44')]=function(_0x1d9006,_0xa715ce){var _0x37acb3={'raw':![],'where':{'id':_0x1d9006[_0x4cce('0x45')]['id']}},_0x31c932={};_0x31c932[_0x4cce('0x31')]=_[_0x4cce('0x32')](db['Dynamics365Configuration'][_0x4cce('0x2d')]);_0x31c932['query']=_[_0x4cce('0x32')](_0x1d9006[_0x4cce('0x33')]);_0x31c932[_0x4cce('0x34')]=_[_0x4cce('0x35')](_0x31c932[_0x4cce('0x31')],_0x31c932[_0x4cce('0x33')]);_0x37acb3[_0x4cce('0x36')]=_[_0x4cce('0x35')](_0x31c932[_0x4cce('0x31')],qs[_0x4cce('0x37')](_0x1d9006[_0x4cce('0x33')][_0x4cce('0x37')]));_0x37acb3[_0x4cce('0x36')]=_0x37acb3[_0x4cce('0x36')][_0x4cce('0x38')]?_0x37acb3[_0x4cce('0x36')]:_0x31c932[_0x4cce('0x31')];if(_0x1d9006['query'][_0x4cce('0x46')]){_0x37acb3['include']=[{'all':!![]}];}_0x37acb3=_[_0x4cce('0x3e')]({},_0x37acb3,_0x1d9006[_0x4cce('0x47')]);return db[_0x4cce('0x41')][_0x4cce('0x48')](_0x37acb3)[_0x4cce('0x26')](handleEntityNotFound(_0xa715ce,null))['then'](respondWithResult(_0xa715ce,null))[_0x4cce('0x43')](handleError(_0xa715ce,null));};exports[_0x4cce('0x49')]=function(_0x5f1cca,_0x5e8286){return db[_0x4cce('0x41')][_0x4cce('0x49')](_0x5f1cca['body'],{})[_0x4cce('0x26')](respondWithResult(_0x5e8286,0xc9))['catch'](handleError(_0x5e8286,null));};exports[_0x4cce('0x25')]=function(_0x3a4b70,_0x50ec35){if(_0x3a4b70['body']['id']){delete _0x3a4b70[_0x4cce('0x4a')]['id'];}return db[_0x4cce('0x41')][_0x4cce('0x48')]({'where':{'id':_0x3a4b70[_0x4cce('0x45')]['id']}})[_0x4cce('0x26')](handleEntityNotFound(_0x50ec35,null))[_0x4cce('0x26')](saveUpdates(_0x3a4b70[_0x4cce('0x4a')],null))[_0x4cce('0x26')](respondWithResult(_0x50ec35,null))[_0x4cce('0x43')](handleError(_0x50ec35,null));};exports[_0x4cce('0x27')]=function(_0x19a14d,_0xc3a254){return db['Dynamics365Configuration']['find']({'where':{'id':_0x19a14d['params']['id']}})[_0x4cce('0x26')](handleEntityNotFound(_0xc3a254,null))[_0x4cce('0x26')](removeEntity(_0xc3a254,null))['catch'](handleError(_0xc3a254,null));};exports[_0x4cce('0x4b')]=function(_0x34e861,_0x3e155a,_0x424509){var _0x10401a={};var _0x5dcc45={};var _0x2bfbe9;var _0x4ca113;return db[_0x4cce('0x41')]['findOne']({'where':{'id':_0x34e861[_0x4cce('0x45')]['id']}})[_0x4cce('0x26')](handleEntityNotFound(_0x3e155a,null))[_0x4cce('0x26')](function(_0x49207b){if(_0x49207b){_0x2bfbe9=_0x49207b;_0x5dcc45[_0x4cce('0x31')]=_[_0x4cce('0x32')](db['Dynamics365Field'][_0x4cce('0x2d')]);_0x5dcc45['query']=_[_0x4cce('0x32')](_0x34e861[_0x4cce('0x33')]);_0x5dcc45[_0x4cce('0x34')]=_[_0x4cce('0x35')](_0x5dcc45[_0x4cce('0x31')],_0x5dcc45[_0x4cce('0x33')]);_0x10401a[_0x4cce('0x36')]=_[_0x4cce('0x35')](_0x5dcc45['model'],qs[_0x4cce('0x37')](_0x34e861[_0x4cce('0x33')][_0x4cce('0x37')]));_0x10401a[_0x4cce('0x36')]=_0x10401a[_0x4cce('0x36')]['length']?_0x10401a['attributes']:_0x5dcc45[_0x4cce('0x31')];_0x10401a['order']=qs['sort'](_0x34e861[_0x4cce('0x33')][_0x4cce('0x3a')]);_0x10401a['where']=qs[_0x4cce('0x34')](_[_0x4cce('0x3c')](_0x34e861[_0x4cce('0x33')],_0x5dcc45[_0x4cce('0x34')]));if(_0x34e861[_0x4cce('0x33')]['filter']){_0x10401a[_0x4cce('0x3b')]=_[_0x4cce('0x3e')](_0x10401a[_0x4cce('0x3b')],{'$or':_['map'](_0x10401a[_0x4cce('0x36')],function(_0x242f00){var _0xf77fd4={};_0xf77fd4[_0x242f00]={'$like':'%'+_0x34e861[_0x4cce('0x33')][_0x4cce('0x3d')]+'%'};return _0xf77fd4;})});}_0x10401a=_['merge']({},_0x10401a,_0x34e861[_0x4cce('0x47')]);return _0x2bfbe9['getFields'](_0x10401a);}})['then'](function(_0xe3725a){if(_0xe3725a){_0x4ca113=_0xe3725a[_0x4cce('0x38')];if(!_0x34e861[_0x4cce('0x33')][_0x4cce('0x4c')](_0x4cce('0x39'))){_0x10401a[_0x4cce('0x1f')]=qs[_0x4cce('0x1f')](_0x34e861[_0x4cce('0x33')][_0x4cce('0x1f')]);_0x10401a['offset']=qs[_0x4cce('0x1e')](_0x34e861[_0x4cce('0x33')][_0x4cce('0x1e')]);}return _0x2bfbe9[_0x4cce('0x4b')](_0x10401a);}})[_0x4cce('0x26')](function(_0x60d9c0){if(_0x60d9c0){return _0x60d9c0?{'count':_0x4ca113,'rows':_0x60d9c0}:null;}})[_0x4cce('0x26')](respondWithResult(_0x3e155a,null))[_0x4cce('0x43')](handleError(_0x3e155a,null));};exports['getSubjects']=function(_0x393908,_0x7aecfb,_0x229436){var _0x4ab9ba={};var _0xfecd5f={};var _0x4db0f7;var _0x309d4d;return db[_0x4cce('0x41')][_0x4cce('0x4d')]({'where':{'id':_0x393908[_0x4cce('0x45')]['id']}})[_0x4cce('0x26')](handleEntityNotFound(_0x7aecfb,null))[_0x4cce('0x26')](function(_0x448e55){if(_0x448e55){_0x4db0f7=_0x448e55;_0xfecd5f[_0x4cce('0x31')]=_['keys'](db[_0x4cce('0x4e')]['rawAttributes']);_0xfecd5f['query']=_[_0x4cce('0x32')](_0x393908[_0x4cce('0x33')]);_0xfecd5f[_0x4cce('0x34')]=_[_0x4cce('0x35')](_0xfecd5f[_0x4cce('0x31')],_0xfecd5f[_0x4cce('0x33')]);_0x4ab9ba[_0x4cce('0x36')]=_[_0x4cce('0x35')](_0xfecd5f[_0x4cce('0x31')],qs[_0x4cce('0x37')](_0x393908[_0x4cce('0x33')]['fields']));_0x4ab9ba['attributes']=_0x4ab9ba[_0x4cce('0x36')][_0x4cce('0x38')]?_0x4ab9ba[_0x4cce('0x36')]:_0xfecd5f[_0x4cce('0x31')];_0x4ab9ba[_0x4cce('0x4f')]=qs[_0x4cce('0x3a')](_0x393908[_0x4cce('0x33')][_0x4cce('0x3a')]);_0x4ab9ba[_0x4cce('0x3b')]=qs[_0x4cce('0x34')](_[_0x4cce('0x3c')](_0x393908[_0x4cce('0x33')],_0xfecd5f[_0x4cce('0x34')]));if(_0x393908[_0x4cce('0x33')]['filter']){_0x4ab9ba[_0x4cce('0x3b')]=_['merge'](_0x4ab9ba[_0x4cce('0x3b')],{'$or':_['map'](_0x4ab9ba[_0x4cce('0x36')],function(_0x24d347){var _0x3f7746={};_0x3f7746[_0x24d347]={'$like':'%'+_0x393908[_0x4cce('0x33')][_0x4cce('0x3d')]+'%'};return _0x3f7746;})});}_0x4ab9ba=_[_0x4cce('0x3e')]({},_0x4ab9ba,_0x393908['options']);return _0x4db0f7[_0x4cce('0x50')](_0x4ab9ba);}})['then'](function(_0x4ae5f7){if(_0x4ae5f7){_0x309d4d=_0x4ae5f7['length'];if(!_0x393908[_0x4cce('0x33')][_0x4cce('0x4c')](_0x4cce('0x39'))){_0x4ab9ba[_0x4cce('0x1f')]=qs['limit'](_0x393908[_0x4cce('0x33')]['limit']);_0x4ab9ba['offset']=qs[_0x4cce('0x1e')](_0x393908['query']['offset']);}return _0x4db0f7[_0x4cce('0x50')](_0x4ab9ba);}})['then'](function(_0x2c288c){if(_0x2c288c){return _0x2c288c?{'count':_0x309d4d,'rows':_0x2c288c}:null;}})[_0x4cce('0x26')](respondWithResult(_0x7aecfb,null))[_0x4cce('0x43')](handleError(_0x7aecfb,null));};exports[_0x4cce('0x51')]=function(_0x5b6bd2,_0x54f8b9,_0x17645b){var _0x14ccdc={};var _0x2415c3={};var _0x506d68;var _0x1d517d;return db[_0x4cce('0x41')][_0x4cce('0x4d')]({'where':{'id':_0x5b6bd2[_0x4cce('0x45')]['id']}})[_0x4cce('0x26')](handleEntityNotFound(_0x54f8b9,null))[_0x4cce('0x26')](function(_0x28f337){if(_0x28f337){_0x506d68=_0x28f337;_0x2415c3['model']=_[_0x4cce('0x32')](db[_0x4cce('0x4e')][_0x4cce('0x2d')]);_0x2415c3[_0x4cce('0x33')]=_[_0x4cce('0x32')](_0x5b6bd2['query']);_0x2415c3[_0x4cce('0x34')]=_['intersection'](_0x2415c3['model'],_0x2415c3[_0x4cce('0x33')]);_0x14ccdc[_0x4cce('0x36')]=_[_0x4cce('0x35')](_0x2415c3[_0x4cce('0x31')],qs[_0x4cce('0x37')](_0x5b6bd2[_0x4cce('0x33')][_0x4cce('0x37')]));_0x14ccdc[_0x4cce('0x36')]=_0x14ccdc[_0x4cce('0x36')][_0x4cce('0x38')]?_0x14ccdc[_0x4cce('0x36')]:_0x2415c3[_0x4cce('0x31')];_0x14ccdc[_0x4cce('0x4f')]=qs[_0x4cce('0x3a')](_0x5b6bd2[_0x4cce('0x33')][_0x4cce('0x3a')]);_0x14ccdc['where']=qs[_0x4cce('0x34')](_['pick'](_0x5b6bd2[_0x4cce('0x33')],_0x2415c3['filters']));if(_0x5b6bd2['query'][_0x4cce('0x3d')]){_0x14ccdc[_0x4cce('0x3b')]=_['merge'](_0x14ccdc[_0x4cce('0x3b')],{'$or':_[_0x4cce('0x2c')](_0x14ccdc[_0x4cce('0x36')],function(_0x1ef1bb){var _0x469b0f={};_0x469b0f[_0x1ef1bb]={'$like':'%'+_0x5b6bd2[_0x4cce('0x33')][_0x4cce('0x3d')]+'%'};return _0x469b0f;})});}_0x14ccdc=_[_0x4cce('0x3e')]({},_0x14ccdc,_0x5b6bd2[_0x4cce('0x47')]);return _0x506d68['getDescriptions'](_0x14ccdc);}})['then'](function(_0x2cd3b8){if(_0x2cd3b8){_0x1d517d=_0x2cd3b8[_0x4cce('0x38')];if(!_0x5b6bd2[_0x4cce('0x33')][_0x4cce('0x4c')](_0x4cce('0x39'))){_0x14ccdc['limit']=qs[_0x4cce('0x1f')](_0x5b6bd2['query'][_0x4cce('0x1f')]);_0x14ccdc[_0x4cce('0x1e')]=qs[_0x4cce('0x1e')](_0x5b6bd2[_0x4cce('0x33')][_0x4cce('0x1e')]);}return _0x506d68[_0x4cce('0x51')](_0x14ccdc);}})[_0x4cce('0x26')](function(_0x8f7ff7){if(_0x8f7ff7){return _0x8f7ff7?{'count':_0x1d517d,'rows':_0x8f7ff7}:null;}})[_0x4cce('0x26')](respondWithResult(_0x54f8b9,null))['catch'](handleError(_0x54f8b9,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index da6f8a6..e069bbd 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x34fb00,_0x15382a){var _0x3d91e8=function(_0x302695){while(--_0x302695){_0x34fb00['push'](_0x34fb00['shift']());}};_0x3d91e8(++_0x15382a);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0xf3cd[_0x4bb66f];return _0xf2772f;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb43b=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird','path'];(function(_0x2ad4a9,_0x55e5a9){var _0x525000=function(_0x5d18a3){while(--_0x5d18a3){_0x2ad4a9['push'](_0x2ad4a9['shift']());}};_0x525000(++_0x55e5a9);}(_0xb43b,0x1b2));var _0xbb43=function(_0x306465,_0x37b342){_0x306465=_0x306465-0x0;var _0x5d6f22=_0xb43b[_0x306465];return _0x5d6f22;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb43('0x5'));var rimraf=require(_0xbb43('0x6'));var config=require(_0xbb43('0x7'));var attributes=require(_0xbb43('0x8'));module['exports']=function(_0x491fb9,_0x378df5){return _0x491fb9['define'](_0xbb43('0x9'),attributes,{'tableName':_0xbb43('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 57af39b..a24f644 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 _0xd714=['catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0xff462c,_0x4d5bdc){var _0x285c67=function(_0x2590c1){while(--_0x2590c1){_0xff462c['push'](_0xff462c['shift']());}};_0x285c67(++_0x4d5bdc);}(_0xd714,0x1b9));var _0x4d71=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xd714[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0x4d71('0x0'));var util=require(_0x4d71('0x1'));var moment=require(_0x4d71('0x2'));var BPromise=require(_0x4d71('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d71('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d71('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4d71('0x6'));var client=jayson[_0x4d71('0x7')][_0x4d71('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x570c8c,_0x1771d9,_0x46c2fe){return new BPromise(function(_0x4ead4c,_0x3602b9){return client['request'](_0x570c8c,_0x46c2fe)[_0x4d71('0x9')](function(_0xf5306e){logger[_0x4d71('0xa')](_0x4d71('0xb'),_0x1771d9,_0x4d71('0xc'));logger[_0x4d71('0xd')](_0x4d71('0xe'),_0x1771d9,_0x4d71('0xc'),JSON[_0x4d71('0xf')](_0xf5306e));if(_0xf5306e['error']){if(_0xf5306e['error'][_0x4d71('0x10')]===0x1f4){logger[_0x4d71('0x11')](_0x4d71('0xb'),_0x1771d9,_0xf5306e['error'][_0x4d71('0x12')]);return _0x3602b9(_0xf5306e[_0x4d71('0x11')][_0x4d71('0x12')]);}logger[_0x4d71('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1771d9,_0xf5306e[_0x4d71('0x11')]['message']);return _0x4ead4c(_0xf5306e[_0x4d71('0x11')][_0x4d71('0x12')]);}else{logger[_0x4d71('0xa')](_0x4d71('0xb'),_0x1771d9,_0x4d71('0xc'));_0x4ead4c(_0xf5306e['result'][_0x4d71('0x12')]);}})[_0x4d71('0x13')](function(_0x3f608a){logger['error'](_0x4d71('0xb'),_0x1771d9,_0x3f608a);_0x3602b9(_0x3f608a);});});} \ No newline at end of file +var _0x5ab5=['jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','message','error','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x11c619,_0x16db04){var _0x23b8f9=function(_0x5bc502){while(--_0x5bc502){_0x11c619['push'](_0x11c619['shift']());}};_0x23b8f9(++_0x16db04);}(_0x5ab5,0xaf));var _0x55ab=function(_0x40e701,_0x288569){_0x40e701=_0x40e701-0x0;var _0x462870=_0x5ab5[_0x40e701];return _0x462870;};'use strict';var _=require(_0x55ab('0x0'));var util=require(_0x55ab('0x1'));var moment=require(_0x55ab('0x2'));var BPromise=require(_0x55ab('0x3'));var rs=require(_0x55ab('0x4'));var fs=require('fs');var Redis=require(_0x55ab('0x5'));var db=require(_0x55ab('0x6'))['db'];var utils=require(_0x55ab('0x7'));var logger=require('../../config/logger')(_0x55ab('0x8'));var config=require('../../config/environment');var jayson=require(_0x55ab('0x9'));var client=jayson['client'][_0x55ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2da1ed,_0x470433,_0x9e640f){return new BPromise(function(_0x1a3359,_0x2257d4){return client[_0x55ab('0xb')](_0x2da1ed,_0x9e640f)[_0x55ab('0xc')](function(_0x4f0915){logger[_0x55ab('0xd')](_0x55ab('0xe'),_0x470433,'request\x20sent');logger[_0x55ab('0xf')](_0x55ab('0x10'),_0x470433,_0x55ab('0x11'),JSON[_0x55ab('0x12')](_0x4f0915));if(_0x4f0915['error']){if(_0x4f0915['error']['code']===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x470433,_0x4f0915['error'][_0x55ab('0x13')]);return _0x2257d4(_0x4f0915['error'][_0x55ab('0x13')]);}logger['error'](_0x55ab('0xe'),_0x470433,_0x4f0915[_0x55ab('0x14')]['message']);return _0x1a3359(_0x4f0915[_0x55ab('0x14')][_0x55ab('0x13')]);}else{logger['info'](_0x55ab('0xe'),_0x470433,_0x55ab('0x11'));_0x1a3359(_0x4f0915[_0x55ab('0x15')][_0x55ab('0x13')]);}})[_0x55ab('0x16')](function(_0x2dd0ef){logger[_0x55ab('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x470433,_0x2dd0ef);_0x2257d4(_0x2dd0ef);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 88def57..af2a32b 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 _0x5830=['../../components/interaction/service','index','get','/:id','isAuthenticated','post','update','delete','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x149899,_0x38e7ba){var _0x3aa9a0=function(_0x3a449b){while(--_0x3a449b){_0x149899['push'](_0x149899['shift']());}};_0x3aa9a0(++_0x38e7ba);}(_0x5830,0x191));var _0x0583=function(_0x5d87f3,_0x12d764){_0x5d87f3=_0x5d87f3-0x0;var _0x3ff174=_0x5830[_0x5d87f3];return _0x3ff174;};'use strict';var multer=require(_0x0583('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0583('0x1'));var express=require('express');var router=express[_0x0583('0x2')]();var fs_extra=require(_0x0583('0x3'));var auth=require(_0x0583('0x4'));var interaction=require(_0x0583('0x5'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0583('0x6')]);router[_0x0583('0x7')](_0x0583('0x8'),auth[_0x0583('0x9')](),controller['show']);router[_0x0583('0xa')]('/',auth[_0x0583('0x9')](),controller['create']);router['put'](_0x0583('0x8'),auth['isAuthenticated'](),controller[_0x0583('0xb')]);router[_0x0583('0xc')](_0x0583('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x0583('0xd')]=router; \ No newline at end of file +var _0xff67=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','index','/:id','post','isAuthenticated','update','delete','destroy','exports','multer','util','path'];(function(_0x52509d,_0x457469){var _0x217a49=function(_0x4c021b){while(--_0x4c021b){_0x52509d['push'](_0x52509d['shift']());}};_0x217a49(++_0x457469);}(_0xff67,0x189));var _0x7ff6=function(_0x5aaed9,_0x3de8d1){_0x5aaed9=_0x5aaed9-0x0;var _0x1e531b=_0xff67[_0x5aaed9];return _0x1e531b;};'use strict';var multer=require(_0x7ff6('0x0'));var util=require(_0x7ff6('0x1'));var path=require(_0x7ff6('0x2'));var timeout=require('connect-timeout');var express=require(_0x7ff6('0x3'));var router=express[_0x7ff6('0x4')]();var fs_extra=require(_0x7ff6('0x5'));var auth=require(_0x7ff6('0x6'));var interaction=require(_0x7ff6('0x7'));var config=require('../../config/environment');var controller=require(_0x7ff6('0x8'));router[_0x7ff6('0x9')]('/',auth['isAuthenticated'](),controller[_0x7ff6('0xa')]);router[_0x7ff6('0x9')](_0x7ff6('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7ff6('0xc')]('/',auth[_0x7ff6('0xd')](),controller['create']);router['put'](_0x7ff6('0xb'),auth['isAuthenticated'](),controller[_0x7ff6('0xe')]);router[_0x7ff6('0xf')](_0x7ff6('0xb'),auth['isAuthenticated'](),controller[_0x7ff6('0x10')]);module[_0x7ff6('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 0d50dcd..0d6277d 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 _0x6b04=['keyValue','picklist','STRING','ENUM','variable','sequelize','string','customVariable'];(function(_0x3fbb45,_0x42c9eb){var _0x36278c=function(_0x38dd94){while(--_0x38dd94){_0x3fbb45['push'](_0x3fbb45['shift']());}};_0x36278c(++_0x42c9eb);}(_0x6b04,0xf5));var _0x46b0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6b04[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x46b0('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x46b0('0x1'),'variable',_0x46b0('0x2'),_0x46b0('0x3'),_0x46b0('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x46b0('0x5')]},'key':{'type':Sequelize[_0x46b0('0x5')]},'keyType':{'type':Sequelize[_0x46b0('0x6')](_0x46b0('0x1'),_0x46b0('0x7'),_0x46b0('0x2'))},'keyContent':{'type':Sequelize[_0x46b0('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x46b0('0x5')]}}; \ No newline at end of file +var _0xef6a=['STRING','BOOLEAN','sequelize','string','variable','customVariable'];(function(_0x395380,_0x1c6f9b){var _0x19ed34=function(_0x2db963){while(--_0x2db963){_0x395380['push'](_0x395380['shift']());}};_0x19ed34(++_0x1c6f9b);}(_0xef6a,0x1f4));var _0xaef6=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xef6a[_0x4f9b18];return _0x29f20c;};'use strict';var Sequelize=require(_0xaef6('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xaef6('0x1'),_0xaef6('0x2'),_0xaef6('0x3'),'keyValue','picklist'),'defaultValue':_0xaef6('0x1')},'content':{'type':Sequelize[_0xaef6('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xaef6('0x1'),_0xaef6('0x2'),_0xaef6('0x3'))},'keyContent':{'type':Sequelize[_0xaef6('0x4')]},'idField':{'type':Sequelize[_0xaef6('0x4')]},'nameField':{'type':Sequelize[_0xaef6('0x4')]},'customField':{'type':Sequelize[_0xaef6('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaef6('0x4')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index fba4add..723e339 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 _0x3831=['ejs','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','map','Dynamics365Field','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x3831,0x11e));var _0x1383=function(_0x31c5fd,_0x33131f){_0x31c5fd=_0x31c5fd-0x0;var _0x3799ab=_0x3831[_0x31c5fd];return _0x3799ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1383('0x0'));var zipdir=require(_0x1383('0x1'));var jsonpatch=require(_0x1383('0x2'));var rp=require(_0x1383('0x3'));var moment=require(_0x1383('0x4'));var BPromise=require(_0x1383('0x5'));var Mustache=require(_0x1383('0x6'));var util=require(_0x1383('0x7'));var path=require('path');var sox=require(_0x1383('0x8'));var csv=require(_0x1383('0x9'));var ejs=require(_0x1383('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1383('0xb'));var crypto=require(_0x1383('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1383('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1383('0xe'));var Papa=require('papaparse');var Redis=require(_0x1383('0xf'));var authService=require(_0x1383('0x10'));var qs=require(_0x1383('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1383('0x12'));var logger=require(_0x1383('0x13'))('api');var utils=require(_0x1383('0x14'));var config=require(_0x1383('0x15'));var licenseUtil=require(_0x1383('0x16'));var db=require(_0x1383('0x17'))['db'];function respondWithStatusCode(_0x14ca53,_0x1aa964){_0x1aa964=_0x1aa964||0xcc;return function(_0x297a5b){if(_0x297a5b){return _0x14ca53[_0x1383('0x18')](_0x1aa964);}return _0x14ca53['status'](_0x1aa964)[_0x1383('0x19')]();};}function respondWithResult(_0x3259d3,_0x39ff9c){_0x39ff9c=_0x39ff9c||0xc8;return function(_0x567711){if(_0x567711){return _0x3259d3[_0x1383('0x1a')](_0x39ff9c)[_0x1383('0x1b')](_0x567711);}};}function respondWithFilteredResult(_0x423d91,_0x2f8107){return function(_0x53b103){if(_0x53b103){var _0x3b3ca1=typeof _0x2f8107['offset']===_0x1383('0x1c')&&typeof _0x2f8107[_0x1383('0x1d')]===_0x1383('0x1c');var _0x568ba9=_0x53b103[_0x1383('0x1e')];var _0x2c3cc7=_0x3b3ca1?0x0:_0x2f8107['offset'];var _0x2d90cd=_0x3b3ca1?_0x53b103[_0x1383('0x1e')]:_0x2f8107[_0x1383('0x1f')]+_0x2f8107[_0x1383('0x1d')];var _0x47aab7;if(_0x2d90cd>=_0x568ba9){_0x2d90cd=_0x568ba9;_0x47aab7=0xc8;}else{_0x47aab7=0xce;}_0x423d91[_0x1383('0x1a')](_0x47aab7);return _0x423d91[_0x1383('0x20')](_0x1383('0x21'),_0x2c3cc7+'-'+_0x2d90cd+'/'+_0x568ba9)[_0x1383('0x1b')](_0x53b103);}return null;};}function patchUpdates(_0x1482fa){return function(_0x27b415){try{jsonpatch[_0x1383('0x22')](_0x27b415,_0x1482fa,!![]);}catch(_0x182d0c){return BPromise['reject'](_0x182d0c);}return _0x27b415[_0x1383('0x23')]();};}function saveUpdates(_0x568541,_0x452a51){return function(_0xf32f7a){if(_0xf32f7a){return _0xf32f7a[_0x1383('0x24')](_0x568541)[_0x1383('0x25')](function(_0x590c32){return _0x590c32;});}return null;};}function removeEntity(_0x3054d4,_0x4e9205){return function(_0x301714){if(_0x301714){return _0x301714[_0x1383('0x26')]()[_0x1383('0x25')](function(){_0x3054d4[_0x1383('0x1a')](0xcc)[_0x1383('0x19')]();});}};}function handleEntityNotFound(_0x4f75d4,_0xc15920){return function(_0x4264e7){if(!_0x4264e7){_0x4f75d4[_0x1383('0x18')](0x194);}return _0x4264e7;};}function handleError(_0x4657c6,_0x581e5c){_0x581e5c=_0x581e5c||0x1f4;return function(_0x1895b6){logger[_0x1383('0x27')](_0x1895b6[_0x1383('0x28')]);if(_0x1895b6['name']){delete _0x1895b6[_0x1383('0x29')];}_0x4657c6[_0x1383('0x1a')](_0x581e5c)['send'](_0x1895b6);};}exports['index']=function(_0x4834e7,_0x171648){var _0x2d1701={},_0x424581={},_0x4967c7={'count':0x0,'rows':[]};var _0x594ff7=_[_0x1383('0x2a')](db[_0x1383('0x2b')][_0x1383('0x2c')],function(_0x3bce7d){return{'name':_0x3bce7d[_0x1383('0x2d')],'type':_0x3bce7d[_0x1383('0x2e')][_0x1383('0x2f')]};});_0x424581['model']=_[_0x1383('0x2a')](_0x594ff7,'name');_0x424581[_0x1383('0x30')]=_[_0x1383('0x31')](_0x4834e7[_0x1383('0x30')]);_0x424581[_0x1383('0x32')]=_[_0x1383('0x33')](_0x424581[_0x1383('0x34')],_0x424581[_0x1383('0x30')]);_0x2d1701[_0x1383('0x35')]=_['intersection'](_0x424581[_0x1383('0x34')],qs[_0x1383('0x36')](_0x4834e7[_0x1383('0x30')][_0x1383('0x36')]));_0x2d1701[_0x1383('0x35')]=_0x2d1701[_0x1383('0x35')][_0x1383('0x37')]?_0x2d1701[_0x1383('0x35')]:_0x424581['model'];if(!_0x4834e7[_0x1383('0x30')][_0x1383('0x38')](_0x1383('0x39'))){_0x2d1701[_0x1383('0x1d')]=qs['limit'](_0x4834e7['query'][_0x1383('0x1d')]);_0x2d1701[_0x1383('0x1f')]=qs['offset'](_0x4834e7[_0x1383('0x30')][_0x1383('0x1f')]);}_0x2d1701[_0x1383('0x3a')]=qs[_0x1383('0x3b')](_0x4834e7['query'][_0x1383('0x3b')]);_0x2d1701[_0x1383('0x3c')]=qs['filters'](_[_0x1383('0x3d')](_0x4834e7[_0x1383('0x30')],_0x424581[_0x1383('0x32')]),_0x594ff7);if(_0x4834e7['query'][_0x1383('0x3e')]){_0x2d1701[_0x1383('0x3c')]=_[_0x1383('0x3f')](_0x2d1701['where'],{'$or':_['map'](_0x594ff7,function(_0x2707fa){if(_0x2707fa[_0x1383('0x2e')]!=='VIRTUAL'){var _0x178e19={};_0x178e19[_0x2707fa[_0x1383('0x29')]]={'$like':'%'+_0x4834e7[_0x1383('0x30')]['filter']+'%'};return _0x178e19;}})});}_0x2d1701=_[_0x1383('0x3f')]({},_0x2d1701,_0x4834e7[_0x1383('0x40')]);var _0x301d75={'where':_0x2d1701['where']};return db[_0x1383('0x2b')][_0x1383('0x1e')](_0x301d75)[_0x1383('0x25')](function(_0x528b3b){_0x4967c7['count']=_0x528b3b;if(_0x4834e7[_0x1383('0x30')][_0x1383('0x41')]){_0x2d1701[_0x1383('0x42')]=[{'all':!![]}];}return db[_0x1383('0x2b')]['findAll'](_0x2d1701);})[_0x1383('0x25')](function(_0x43cd07){_0x4967c7[_0x1383('0x43')]=_0x43cd07;return _0x4967c7;})[_0x1383('0x25')](respondWithFilteredResult(_0x171648,_0x2d1701))[_0x1383('0x44')](handleError(_0x171648,null));};exports[_0x1383('0x45')]=function(_0x3621bd,_0x37275d){var _0x152eb5={'raw':!![],'where':{'id':_0x3621bd[_0x1383('0x46')]['id']}},_0xac0234={};_0xac0234[_0x1383('0x34')]=_['keys'](db['Dynamics365Field'][_0x1383('0x2c')]);_0xac0234[_0x1383('0x30')]=_['keys'](_0x3621bd['query']);_0xac0234['filters']=_['intersection'](_0xac0234[_0x1383('0x34')],_0xac0234[_0x1383('0x30')]);_0x152eb5['attributes']=_['intersection'](_0xac0234[_0x1383('0x34')],qs['fields'](_0x3621bd[_0x1383('0x30')][_0x1383('0x36')]));_0x152eb5[_0x1383('0x35')]=_0x152eb5[_0x1383('0x35')]['length']?_0x152eb5['attributes']:_0xac0234[_0x1383('0x34')];if(_0x3621bd[_0x1383('0x30')][_0x1383('0x41')]){_0x152eb5['include']=[{'all':!![]}];}_0x152eb5=_[_0x1383('0x3f')]({},_0x152eb5,_0x3621bd['options']);return db[_0x1383('0x2b')][_0x1383('0x47')](_0x152eb5)[_0x1383('0x25')](handleEntityNotFound(_0x37275d,null))['then'](respondWithResult(_0x37275d,null))[_0x1383('0x44')](handleError(_0x37275d,null));};exports['create']=function(_0x4e5152,_0x536e85){return db[_0x1383('0x2b')][_0x1383('0x48')](_0x4e5152['body'],{})[_0x1383('0x25')](respondWithResult(_0x536e85,0xc9))[_0x1383('0x44')](handleError(_0x536e85,null));};exports['update']=function(_0xc199fb,_0x110a97){if(_0xc199fb['body']['id']){delete _0xc199fb[_0x1383('0x49')]['id'];}return db['Dynamics365Field']['find']({'where':{'id':_0xc199fb[_0x1383('0x46')]['id']}})['then'](handleEntityNotFound(_0x110a97,null))[_0x1383('0x25')](saveUpdates(_0xc199fb[_0x1383('0x49')],null))[_0x1383('0x25')](respondWithResult(_0x110a97,null))[_0x1383('0x44')](handleError(_0x110a97,null));};exports['destroy']=function(_0x564283,_0x598ce3){return db['Dynamics365Field'][_0x1383('0x47')]({'where':{'id':_0x564283['params']['id']}})[_0x1383('0x25')](handleEntityNotFound(_0x598ce3,null))[_0x1383('0x25')](removeEntity(_0x598ce3,null))[_0x1383('0x44')](handleError(_0x598ce3,null));}; \ No newline at end of file +var _0xd7a3=['params','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show'];(function(_0x45c7a4,_0x375b32){var _0x1fe146=function(_0x4de1ae){while(--_0x4de1ae){_0x45c7a4['push'](_0x45c7a4['shift']());}};_0x1fe146(++_0x375b32);}(_0xd7a3,0x177));var _0x3d7a=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xd7a3[_0x455c6c];return _0x488242;};'use strict';var emlformat=require(_0x3d7a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d7a('0x1'));var jsonpatch=require(_0x3d7a('0x2'));var rp=require(_0x3d7a('0x3'));var moment=require('moment');var BPromise=require(_0x3d7a('0x4'));var Mustache=require(_0x3d7a('0x5'));var util=require(_0x3d7a('0x6'));var path=require(_0x3d7a('0x7'));var sox=require(_0x3d7a('0x8'));var csv=require(_0x3d7a('0x9'));var ejs=require(_0x3d7a('0xa'));var fs=require('fs');var fs_extra=require(_0x3d7a('0xb'));var _=require(_0x3d7a('0xc'));var squel=require('squel');var crypto=require(_0x3d7a('0xd'));var jsforce=require(_0x3d7a('0xe'));var deskjs=require(_0x3d7a('0xf'));var toCsv=require(_0x3d7a('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3d7a('0x10'));var authService=require(_0x3d7a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3d7a('0x12'));var hardwareService=require(_0x3d7a('0x13'));var logger=require('../../config/logger')(_0x3d7a('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3d7a('0x15'));var db=require(_0x3d7a('0x16'))['db'];function respondWithStatusCode(_0x27798e,_0x49533c){_0x49533c=_0x49533c||0xcc;return function(_0x25a19d){if(_0x25a19d){return _0x27798e[_0x3d7a('0x17')](_0x49533c);}return _0x27798e['status'](_0x49533c)[_0x3d7a('0x18')]();};}function respondWithResult(_0x3566b3,_0x5a53b3){_0x5a53b3=_0x5a53b3||0xc8;return function(_0x255d88){if(_0x255d88){return _0x3566b3[_0x3d7a('0x19')](_0x5a53b3)[_0x3d7a('0x1a')](_0x255d88);}};}function respondWithFilteredResult(_0x552643,_0x39571a){return function(_0x455417){if(_0x455417){var _0xcae668=typeof _0x39571a[_0x3d7a('0x1b')]===_0x3d7a('0x1c')&&typeof _0x39571a[_0x3d7a('0x1d')]===_0x3d7a('0x1c');var _0x1a2c81=_0x455417[_0x3d7a('0x1e')];var _0x9be7b=_0xcae668?0x0:_0x39571a['offset'];var _0x79933e=_0xcae668?_0x455417[_0x3d7a('0x1e')]:_0x39571a[_0x3d7a('0x1b')]+_0x39571a['limit'];var _0x1e0093;if(_0x79933e>=_0x1a2c81){_0x79933e=_0x1a2c81;_0x1e0093=0xc8;}else{_0x1e0093=0xce;}_0x552643[_0x3d7a('0x19')](_0x1e0093);return _0x552643['set'](_0x3d7a('0x1f'),_0x9be7b+'-'+_0x79933e+'/'+_0x1a2c81)[_0x3d7a('0x1a')](_0x455417);}return null;};}function patchUpdates(_0x11c347){return function(_0x86fdbb){try{jsonpatch[_0x3d7a('0x20')](_0x86fdbb,_0x11c347,!![]);}catch(_0x1586df){return BPromise[_0x3d7a('0x21')](_0x1586df);}return _0x86fdbb[_0x3d7a('0x22')]();};}function saveUpdates(_0x11ab25,_0x5da341){return function(_0x3823bd){if(_0x3823bd){return _0x3823bd[_0x3d7a('0x23')](_0x11ab25)[_0x3d7a('0x24')](function(_0x5a2c8d){return _0x5a2c8d;});}return null;};}function removeEntity(_0x7e5861,_0x238ee5){return function(_0x28174d){if(_0x28174d){return _0x28174d[_0x3d7a('0x25')]()['then'](function(){_0x7e5861[_0x3d7a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ec1a8,_0x435cab){return function(_0x58c88c){if(!_0x58c88c){_0x5ec1a8[_0x3d7a('0x17')](0x194);}return _0x58c88c;};}function handleError(_0x26837a,_0x53997e){_0x53997e=_0x53997e||0x1f4;return function(_0xadc9bf){logger['error'](_0xadc9bf[_0x3d7a('0x26')]);if(_0xadc9bf[_0x3d7a('0x27')]){delete _0xadc9bf[_0x3d7a('0x27')];}_0x26837a[_0x3d7a('0x19')](_0x53997e)[_0x3d7a('0x28')](_0xadc9bf);};}exports[_0x3d7a('0x29')]=function(_0x1626f1,_0x222967){var _0x4a29d0={},_0x17e88e={},_0x307ee7={'count':0x0,'rows':[]};var _0x376932=_[_0x3d7a('0x2a')](db[_0x3d7a('0x2b')][_0x3d7a('0x2c')],function(_0x370451){return{'name':_0x370451[_0x3d7a('0x2d')],'type':_0x370451[_0x3d7a('0x2e')][_0x3d7a('0x2f')]};});_0x17e88e[_0x3d7a('0x30')]=_[_0x3d7a('0x2a')](_0x376932,_0x3d7a('0x27'));_0x17e88e['query']=_[_0x3d7a('0x31')](_0x1626f1[_0x3d7a('0x32')]);_0x17e88e[_0x3d7a('0x33')]=_['intersection'](_0x17e88e['model'],_0x17e88e[_0x3d7a('0x32')]);_0x4a29d0[_0x3d7a('0x34')]=_[_0x3d7a('0x35')](_0x17e88e[_0x3d7a('0x30')],qs[_0x3d7a('0x36')](_0x1626f1[_0x3d7a('0x32')][_0x3d7a('0x36')]));_0x4a29d0['attributes']=_0x4a29d0[_0x3d7a('0x34')][_0x3d7a('0x37')]?_0x4a29d0['attributes']:_0x17e88e[_0x3d7a('0x30')];if(!_0x1626f1[_0x3d7a('0x32')][_0x3d7a('0x38')](_0x3d7a('0x39'))){_0x4a29d0[_0x3d7a('0x1d')]=qs[_0x3d7a('0x1d')](_0x1626f1['query']['limit']);_0x4a29d0[_0x3d7a('0x1b')]=qs[_0x3d7a('0x1b')](_0x1626f1['query'][_0x3d7a('0x1b')]);}_0x4a29d0['order']=qs['sort'](_0x1626f1['query'][_0x3d7a('0x3a')]);_0x4a29d0[_0x3d7a('0x3b')]=qs[_0x3d7a('0x33')](_['pick'](_0x1626f1[_0x3d7a('0x32')],_0x17e88e[_0x3d7a('0x33')]),_0x376932);if(_0x1626f1[_0x3d7a('0x32')]['filter']){_0x4a29d0[_0x3d7a('0x3b')]=_['merge'](_0x4a29d0[_0x3d7a('0x3b')],{'$or':_[_0x3d7a('0x2a')](_0x376932,function(_0x3328d5){if(_0x3328d5['type']!==_0x3d7a('0x3c')){var _0x49af24={};_0x49af24[_0x3328d5['name']]={'$like':'%'+_0x1626f1[_0x3d7a('0x32')][_0x3d7a('0x3d')]+'%'};return _0x49af24;}})});}_0x4a29d0=_[_0x3d7a('0x3e')]({},_0x4a29d0,_0x1626f1[_0x3d7a('0x3f')]);var _0x1b2450={'where':_0x4a29d0[_0x3d7a('0x3b')]};return db['Dynamics365Field'][_0x3d7a('0x1e')](_0x1b2450)['then'](function(_0x2e38de){_0x307ee7[_0x3d7a('0x1e')]=_0x2e38de;if(_0x1626f1[_0x3d7a('0x32')][_0x3d7a('0x40')]){_0x4a29d0[_0x3d7a('0x41')]=[{'all':!![]}];}return db[_0x3d7a('0x2b')][_0x3d7a('0x42')](_0x4a29d0);})['then'](function(_0x1b938e){_0x307ee7[_0x3d7a('0x43')]=_0x1b938e;return _0x307ee7;})['then'](respondWithFilteredResult(_0x222967,_0x4a29d0))['catch'](handleError(_0x222967,null));};exports[_0x3d7a('0x44')]=function(_0x2cedde,_0x3ce823){var _0x4ed3ce={'raw':!![],'where':{'id':_0x2cedde[_0x3d7a('0x45')]['id']}},_0x2c40a3={};_0x2c40a3[_0x3d7a('0x30')]=_['keys'](db[_0x3d7a('0x2b')]['rawAttributes']);_0x2c40a3['query']=_['keys'](_0x2cedde[_0x3d7a('0x32')]);_0x2c40a3[_0x3d7a('0x33')]=_[_0x3d7a('0x35')](_0x2c40a3[_0x3d7a('0x30')],_0x2c40a3[_0x3d7a('0x32')]);_0x4ed3ce['attributes']=_[_0x3d7a('0x35')](_0x2c40a3[_0x3d7a('0x30')],qs[_0x3d7a('0x36')](_0x2cedde[_0x3d7a('0x32')]['fields']));_0x4ed3ce[_0x3d7a('0x34')]=_0x4ed3ce[_0x3d7a('0x34')][_0x3d7a('0x37')]?_0x4ed3ce[_0x3d7a('0x34')]:_0x2c40a3[_0x3d7a('0x30')];if(_0x2cedde[_0x3d7a('0x32')]['includeAll']){_0x4ed3ce[_0x3d7a('0x41')]=[{'all':!![]}];}_0x4ed3ce=_[_0x3d7a('0x3e')]({},_0x4ed3ce,_0x2cedde[_0x3d7a('0x3f')]);return db[_0x3d7a('0x2b')][_0x3d7a('0x46')](_0x4ed3ce)[_0x3d7a('0x24')](handleEntityNotFound(_0x3ce823,null))[_0x3d7a('0x24')](respondWithResult(_0x3ce823,null))[_0x3d7a('0x47')](handleError(_0x3ce823,null));};exports[_0x3d7a('0x48')]=function(_0x2c4c8c,_0x48fef9){return db[_0x3d7a('0x2b')][_0x3d7a('0x48')](_0x2c4c8c[_0x3d7a('0x49')],{})['then'](respondWithResult(_0x48fef9,0xc9))['catch'](handleError(_0x48fef9,null));};exports[_0x3d7a('0x23')]=function(_0x51fefe,_0x17df3a){if(_0x51fefe['body']['id']){delete _0x51fefe[_0x3d7a('0x49')]['id'];}return db[_0x3d7a('0x2b')][_0x3d7a('0x46')]({'where':{'id':_0x51fefe[_0x3d7a('0x45')]['id']}})['then'](handleEntityNotFound(_0x17df3a,null))[_0x3d7a('0x24')](saveUpdates(_0x51fefe['body'],null))['then'](respondWithResult(_0x17df3a,null))['catch'](handleError(_0x17df3a,null));};exports[_0x3d7a('0x25')]=function(_0x87338a,_0x4403fa){return db[_0x3d7a('0x2b')][_0x3d7a('0x46')]({'where':{'id':_0x87338a[_0x3d7a('0x45')]['id']}})[_0x3d7a('0x24')](handleEntityNotFound(_0x4403fa,null))['then'](removeEntity(_0x4403fa,null))[_0x3d7a('0x47')](handleError(_0x4403fa,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index d0f5a61..5f93c7a 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 _0x3244=['./intDynamics365Field.attributes','exports','define','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x3244,0xaf));var _0x4324=function(_0x20410d,_0x201cb8){_0x20410d=_0x20410d-0x0;var _0x374c5e=_0x3244[_0x20410d];return _0x374c5e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4324('0x0'))(_0x4324('0x1'));var moment=require(_0x4324('0x2'));var BPromise=require('bluebird');var rp=require(_0x4324('0x3'));var fs=require('fs');var path=require(_0x4324('0x4'));var rimraf=require(_0x4324('0x5'));var config=require(_0x4324('0x6'));var attributes=require(_0x4324('0x7'));module[_0x4324('0x8')]=function(_0x252a98,_0x44c0cf){return _0x252a98[_0x4324('0x9')]('Dynamics365Field',attributes,{'tableName':_0x4324('0xa'),'paranoid':![],'indexes':[{'name':_0x4324('0xb'),'fields':[_0x4324('0xc'),_0x4324('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdd54=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xdd54,0x168));var _0x4dd5=function(_0x41b29e,_0x34b288){_0x41b29e=_0x41b29e-0x0;var _0xacd517=_0xdd54[_0x41b29e];return _0xacd517;};'use strict';var _=require(_0x4dd5('0x0'));var util=require(_0x4dd5('0x1'));var logger=require(_0x4dd5('0x2'))(_0x4dd5('0x3'));var moment=require('moment');var BPromise=require(_0x4dd5('0x4'));var rp=require(_0x4dd5('0x5'));var fs=require('fs');var path=require(_0x4dd5('0x6'));var rimraf=require(_0x4dd5('0x7'));var config=require('../../config/environment');var attributes=require(_0x4dd5('0x8'));module[_0x4dd5('0x9')]=function(_0x3a33f1,_0x15cc89){return _0x3a33f1[_0x4dd5('0xa')](_0x4dd5('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x4dd5('0xc'),'fields':[_0x4dd5('0xd'),_0x4dd5('0xe')],'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 e5726a1..55936f0 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 _0x9323=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','request\x20sent','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0xfa7af3,_0x2d86a2){var _0x2faf88=function(_0x4aadad){while(--_0x4aadad){_0xfa7af3['push'](_0xfa7af3['shift']());}};_0x2faf88(++_0x2d86a2);}(_0x9323,0x90));var _0x3932=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9323[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x3932('0x0'));var util=require(_0x3932('0x1'));var moment=require(_0x3932('0x2'));var BPromise=require('bluebird');var rs=require(_0x3932('0x3'));var fs=require('fs');var Redis=require(_0x3932('0x4'));var db=require(_0x3932('0x5'))['db'];var utils=require(_0x3932('0x6'));var logger=require(_0x3932('0x7'))(_0x3932('0x8'));var config=require(_0x3932('0x9'));var jayson=require(_0x3932('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ea122,_0x2df4d3,_0x4068ed){return new BPromise(function(_0x3e29c8,_0x112d8a){return client[_0x3932('0xb')](_0x5ea122,_0x4068ed)[_0x3932('0xc')](function(_0x3e6ad5){logger[_0x3932('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x2df4d3,'request\x20sent');logger[_0x3932('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x2df4d3,_0x3932('0xf'),JSON['stringify'](_0x3e6ad5));if(_0x3e6ad5[_0x3932('0x10')]){if(_0x3e6ad5[_0x3932('0x10')][_0x3932('0x11')]===0x1f4){logger['error'](_0x3932('0x12'),_0x2df4d3,_0x3e6ad5[_0x3932('0x10')]['message']);return _0x112d8a(_0x3e6ad5[_0x3932('0x10')][_0x3932('0x13')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x2df4d3,_0x3e6ad5[_0x3932('0x10')][_0x3932('0x13')]);return _0x3e29c8(_0x3e6ad5[_0x3932('0x10')][_0x3932('0x13')]);}else{logger[_0x3932('0xd')](_0x3932('0x12'),_0x2df4d3,'request\x20sent');_0x3e29c8(_0x3e6ad5[_0x3932('0x14')][_0x3932('0x13')]);}})['catch'](function(_0x335faa){logger[_0x3932('0x10')](_0x3932('0x12'),_0x2df4d3,_0x335faa);_0x112d8a(_0x335faa);});});} \ No newline at end of file +var _0x643f=['result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message'];(function(_0x14fd54,_0x139fed){var _0x25eb06=function(_0x31e0a7){while(--_0x31e0a7){_0x14fd54['push'](_0x14fd54['shift']());}};_0x25eb06(++_0x139fed);}(_0x643f,0x156));var _0xf643=function(_0x484a60,_0x63e920){_0x484a60=_0x484a60-0x0;var _0x18217b=_0x643f[_0x484a60];return _0x18217b;};'use strict';var _=require(_0xf643('0x0'));var util=require('util');var moment=require(_0xf643('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf643('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf643('0x3'));var logger=require(_0xf643('0x4'))(_0xf643('0x5'));var config=require(_0xf643('0x6'));var jayson=require(_0xf643('0x7'));var client=jayson[_0xf643('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x514d84,_0x3b5d7b,_0x5deeef){return new BPromise(function(_0x32663b,_0x3c3160){return client[_0xf643('0x9')](_0x514d84,_0x5deeef)[_0xf643('0xa')](function(_0x4bfc65){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x3b5d7b,_0xf643('0xb'));logger['debug'](_0xf643('0xc'),_0x3b5d7b,_0xf643('0xb'),JSON[_0xf643('0xd')](_0x4bfc65));if(_0x4bfc65[_0xf643('0xe')]){if(_0x4bfc65[_0xf643('0xe')][_0xf643('0xf')]===0x1f4){logger['error'](_0xf643('0x10'),_0x3b5d7b,_0x4bfc65[_0xf643('0xe')][_0xf643('0x11')]);return _0x3c3160(_0x4bfc65[_0xf643('0xe')][_0xf643('0x11')]);}logger[_0xf643('0xe')](_0xf643('0x10'),_0x3b5d7b,_0x4bfc65[_0xf643('0xe')]['message']);return _0x32663b(_0x4bfc65[_0xf643('0xe')]['message']);}else{logger['info'](_0xf643('0x10'),_0x3b5d7b,_0xf643('0xb'));_0x32663b(_0x4bfc65[_0xf643('0x12')][_0xf643('0x11')]);}})[_0xf643('0x13')](function(_0x30787f){logger[_0xf643('0xe')](_0xf643('0x10'),_0x3b5d7b,_0x30787f);_0x3c3160(_0x30787f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 6f166b3..11c1b98 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 _0xfe56=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getFields','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xfe56,0x140));var _0x6fe5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xfe56[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x6fe5('0x0'));var util=require(_0x6fe5('0x1'));var path=require(_0x6fe5('0x2'));var timeout=require('connect-timeout');var express=require(_0x6fe5('0x3'));var router=express[_0x6fe5('0x4')]();var fs_extra=require(_0x6fe5('0x5'));var auth=require(_0x6fe5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6fe5('0x7'));var controller=require(_0x6fe5('0x8'));router['get']('/',auth[_0x6fe5('0x9')](),controller[_0x6fe5('0xa')]);router[_0x6fe5('0xb')](_0x6fe5('0xc'),auth['isAuthenticated'](),controller[_0x6fe5('0xd')]);router[_0x6fe5('0xb')](_0x6fe5('0xe'),auth[_0x6fe5('0x9')](),controller['getConfigurations']);router[_0x6fe5('0xb')]('/:id/fields',auth[_0x6fe5('0x9')](),controller[_0x6fe5('0xf')]);router[_0x6fe5('0x10')]('/',auth[_0x6fe5('0x9')](),controller[_0x6fe5('0x11')]);router[_0x6fe5('0x10')](_0x6fe5('0xe'),auth[_0x6fe5('0x9')](),controller['addConfiguration']);router[_0x6fe5('0x12')](_0x6fe5('0xc'),auth[_0x6fe5('0x9')](),controller[_0x6fe5('0x13')]);router[_0x6fe5('0x14')]('/:id',auth[_0x6fe5('0x9')](),controller[_0x6fe5('0x15')]);module[_0x6fe5('0x16')]=router; \ No newline at end of file +var _0x4c31=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service'];(function(_0x2f6b1f,_0x368020){var _0x5bcb88=function(_0x38b2cc){while(--_0x38b2cc){_0x2f6b1f['push'](_0x2f6b1f['shift']());}};_0x5bcb88(++_0x368020);}(_0x4c31,0x1b0));var _0x14c3=function(_0x4c689e,_0x5a5d67){_0x4c689e=_0x4c689e-0x0;var _0x4df4cb=_0x4c31[_0x4c689e];return _0x4df4cb;};'use strict';var multer=require(_0x14c3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x14c3('0x1'));var router=express[_0x14c3('0x2')]();var fs_extra=require(_0x14c3('0x3'));var auth=require(_0x14c3('0x4'));var interaction=require(_0x14c3('0x5'));var config=require(_0x14c3('0x6'));var controller=require('./intFreshdeskAccount.controller');router[_0x14c3('0x7')]('/',auth[_0x14c3('0x8')](),controller[_0x14c3('0x9')]);router[_0x14c3('0x7')](_0x14c3('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x14c3('0x7')](_0x14c3('0xb'),auth['isAuthenticated'](),controller[_0x14c3('0xc')]);router[_0x14c3('0x7')](_0x14c3('0xd'),auth[_0x14c3('0x8')](),controller[_0x14c3('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x14c3('0xf')]);router[_0x14c3('0x10')](_0x14c3('0xb'),auth[_0x14c3('0x8')](),controller[_0x14c3('0x11')]);router[_0x14c3('0x12')](_0x14c3('0xa'),auth['isAuthenticated'](),controller[_0x14c3('0x13')]);router[_0x14c3('0x14')]('/:id',auth[_0x14c3('0x8')](),controller[_0x14c3('0x15')]);module[_0x14c3('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index b06c045..762fd6d 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 _0x8aad=['STRING','username','sequelize','exports'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x8aad,0x146));var _0xd8aa=function(_0x4133a9,_0x2a04a7){_0x4133a9=_0x4133a9-0x0;var _0x11c9fd=_0x8aad[_0x4133a9];return _0x11c9fd;};'use strict';var Sequelize=require(_0xd8aa('0x0'));module[_0xd8aa('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd8aa('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xd8aa('0x3')},'apiKey':{'type':Sequelize[_0xd8aa('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xd8aa('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4137=['STRING','username','remoteUri','sequelize','exports'];(function(_0xe551df,_0x10aa37){var _0x4cb6f8=function(_0x42e11b){while(--_0x42e11b){_0xe551df['push'](_0xe551df['shift']());}};_0x4cb6f8(++_0x10aa37);}(_0x4137,0xf8));var _0x7413=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x4137[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0x7413('0x0'));module[_0x7413('0x1')]={'name':{'type':Sequelize[_0x7413('0x2')]},'description':{'type':Sequelize[_0x7413('0x2')]},'username':{'type':Sequelize[_0x7413('0x2')],'unique':_0x7413('0x3')},'apiKey':{'type':Sequelize[_0x7413('0x2')]},'remoteUri':{'type':Sequelize[_0x7413('0x2')],'unique':_0x7413('0x4')},'serverUrl':{'type':Sequelize[_0x7413('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 9af316f..216b757 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 _0x2821=['requester','subject','agent','description','priority','group','ticket_type','company','default','custom_text','choices','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','findAll','rows','params','include','find','catch','create','body','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','substring','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64'];(function(_0x32d92a,_0x202b98){var _0x5c1ba2=function(_0x231075){while(--_0x231075){_0x32d92a['push'](_0x32d92a['shift']());}};_0x5c1ba2(++_0x202b98);}(_0x2821,0x87));var _0x1282=function(_0x5b9682,_0x8ca152){_0x5b9682=_0x5b9682-0x0;var _0x1bedf6=_0x2821[_0x5b9682];return _0x1bedf6;};'use strict';var emlformat=require(_0x1282('0x0'));var rimraf=require(_0x1282('0x1'));var zipdir=require(_0x1282('0x2'));var jsonpatch=require(_0x1282('0x3'));var rp=require(_0x1282('0x4'));var moment=require(_0x1282('0x5'));var BPromise=require(_0x1282('0x6'));var Mustache=require(_0x1282('0x7'));var util=require(_0x1282('0x8'));var path=require(_0x1282('0x9'));var sox=require(_0x1282('0xa'));var csv=require('to-csv');var ejs=require(_0x1282('0xb'));var fs=require('fs');var fs_extra=require(_0x1282('0xc'));var _=require(_0x1282('0xd'));var squel=require(_0x1282('0xe'));var crypto=require(_0x1282('0xf'));var jsforce=require(_0x1282('0x10'));var deskjs=require(_0x1282('0x11'));var toCsv=require(_0x1282('0x12'));var querystring=require('querystring');var Papa=require(_0x1282('0x13'));var Redis=require(_0x1282('0x14'));var authService=require(_0x1282('0x15'));var qs=require(_0x1282('0x16'));var as=require(_0x1282('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1282('0x18'))(_0x1282('0x19'));var utils=require('../../config/utils');var config=require(_0x1282('0x1a'));var licenseUtil=require(_0x1282('0x1b'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1282('0x1c'));function respondWithStatusCode(_0x4bba95,_0x4d0a3c){_0x4d0a3c=_0x4d0a3c||0xcc;return function(_0x387852){if(_0x387852){return _0x4bba95[_0x1282('0x1d')](_0x4d0a3c);}return _0x4bba95[_0x1282('0x1e')](_0x4d0a3c)[_0x1282('0x1f')]();};}function respondWithResult(_0x4dfd14,_0x5af979){_0x5af979=_0x5af979||0xc8;return function(_0x493837){if(_0x493837){return _0x4dfd14[_0x1282('0x1e')](_0x5af979)[_0x1282('0x20')](_0x493837);}};}function respondWithFilteredResult(_0x4272fa,_0x3f7bd8){return function(_0x2320c5){if(_0x2320c5){var _0x1f6a7a=typeof _0x3f7bd8[_0x1282('0x21')]===_0x1282('0x22')&&typeof _0x3f7bd8['limit']===_0x1282('0x22');var _0x28eeef=_0x2320c5['count'];var _0x48c857=_0x1f6a7a?0x0:_0x3f7bd8[_0x1282('0x21')];var _0x4e3ec7=_0x1f6a7a?_0x2320c5[_0x1282('0x23')]:_0x3f7bd8[_0x1282('0x21')]+_0x3f7bd8['limit'];var _0x5ea75d;if(_0x4e3ec7>=_0x28eeef){_0x4e3ec7=_0x28eeef;_0x5ea75d=0xc8;}else{_0x5ea75d=0xce;}_0x4272fa['status'](_0x5ea75d);return _0x4272fa['set'](_0x1282('0x24'),_0x48c857+'-'+_0x4e3ec7+'/'+_0x28eeef)[_0x1282('0x20')](_0x2320c5);}return null;};}function patchUpdates(_0xe67079){return function(_0x41dd71){try{jsonpatch[_0x1282('0x25')](_0x41dd71,_0xe67079,!![]);}catch(_0x38f22b){return BPromise[_0x1282('0x26')](_0x38f22b);}return _0x41dd71[_0x1282('0x27')]();};}function saveUpdates(_0x153159,_0x1a6240){return function(_0x56fddd){if(_0x56fddd){return _0x56fddd[_0x1282('0x28')](_0x153159)['then'](function(_0x13a39e){return _0x13a39e;});}return null;};}function removeEntity(_0x25dbb5,_0x158123){return function(_0x3c116f){if(_0x3c116f){return _0x3c116f[_0x1282('0x29')]()['then'](function(){_0x25dbb5[_0x1282('0x1e')](0xcc)[_0x1282('0x1f')]();});}};}function handleEntityNotFound(_0x45830f,_0x29d09c){return function(_0xe98661){if(!_0xe98661){_0x45830f[_0x1282('0x1d')](0x194);}return _0xe98661;};}function handleError(_0x725029,_0x28e686){_0x28e686=_0x28e686||0x1f4;return function(_0x5b2927){logger['error'](_0x5b2927[_0x1282('0x2a')]);if(_0x5b2927[_0x1282('0x2b')]){delete _0x5b2927[_0x1282('0x2b')];}_0x725029['status'](_0x28e686)[_0x1282('0x2c')](_0x5b2927);};}exports['index']=function(_0xfdb50c,_0x5753ba){var _0x519a7f={},_0x4b5d6c={},_0x5d6a7d={'count':0x0,'rows':[]};var _0x4aa4cb=_['map'](db[_0x1282('0x2d')][_0x1282('0x2e')],function(_0x37463a){return{'name':_0x37463a[_0x1282('0x2f')],'type':_0x37463a[_0x1282('0x30')][_0x1282('0x31')]};});_0x4b5d6c[_0x1282('0x32')]=_[_0x1282('0x33')](_0x4aa4cb,_0x1282('0x2b'));_0x4b5d6c['query']=_[_0x1282('0x34')](_0xfdb50c[_0x1282('0x35')]);_0x4b5d6c[_0x1282('0x36')]=_[_0x1282('0x37')](_0x4b5d6c[_0x1282('0x32')],_0x4b5d6c['query']);_0x519a7f[_0x1282('0x38')]=_[_0x1282('0x37')](_0x4b5d6c['model'],qs['fields'](_0xfdb50c['query'][_0x1282('0x39')]));_0x519a7f['attributes']=_0x519a7f[_0x1282('0x38')][_0x1282('0x3a')]?_0x519a7f['attributes']:_0x4b5d6c[_0x1282('0x32')];if(!_0xfdb50c['query']['hasOwnProperty'](_0x1282('0x3b'))){_0x519a7f[_0x1282('0x3c')]=qs[_0x1282('0x3c')](_0xfdb50c[_0x1282('0x35')]['limit']);_0x519a7f['offset']=qs[_0x1282('0x21')](_0xfdb50c['query'][_0x1282('0x21')]);}_0x519a7f[_0x1282('0x3d')]=qs[_0x1282('0x3e')](_0xfdb50c[_0x1282('0x35')]['sort']);_0x519a7f[_0x1282('0x3f')]=qs['filters'](_[_0x1282('0x40')](_0xfdb50c[_0x1282('0x35')],_0x4b5d6c[_0x1282('0x36')]),_0x4aa4cb);if(_0xfdb50c[_0x1282('0x35')]['filter']){_0x519a7f['where']=_[_0x1282('0x41')](_0x519a7f[_0x1282('0x3f')],{'$or':_[_0x1282('0x33')](_0x4aa4cb,function(_0x5ce898){if(_0x5ce898[_0x1282('0x30')]!==_0x1282('0x42')){var _0x3efca5={};_0x3efca5[_0x5ce898[_0x1282('0x2b')]]={'$like':'%'+_0xfdb50c[_0x1282('0x35')][_0x1282('0x43')]+'%'};return _0x3efca5;}})});}_0x519a7f=_[_0x1282('0x41')]({},_0x519a7f,_0xfdb50c[_0x1282('0x44')]);var _0x178ac5={'where':_0x519a7f[_0x1282('0x3f')]};return db[_0x1282('0x2d')][_0x1282('0x23')](_0x178ac5)[_0x1282('0x45')](function(_0x53ee4c){_0x5d6a7d[_0x1282('0x23')]=_0x53ee4c;if(_0xfdb50c[_0x1282('0x35')][_0x1282('0x46')]){_0x519a7f['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0x1282('0x47')](_0x519a7f);})[_0x1282('0x45')](function(_0x3ca027){_0x5d6a7d[_0x1282('0x48')]=_0x3ca027;return _0x5d6a7d;})[_0x1282('0x45')](respondWithFilteredResult(_0x5753ba,_0x519a7f))['catch'](handleError(_0x5753ba,null));};exports['show']=function(_0x45be30,_0x3bd935){var _0x270262={'raw':![],'where':{'id':_0x45be30[_0x1282('0x49')]['id']}},_0x5657f4={};_0x5657f4[_0x1282('0x32')]=_[_0x1282('0x34')](db[_0x1282('0x2d')][_0x1282('0x2e')]);_0x5657f4[_0x1282('0x35')]=_['keys'](_0x45be30['query']);_0x5657f4['filters']=_[_0x1282('0x37')](_0x5657f4[_0x1282('0x32')],_0x5657f4[_0x1282('0x35')]);_0x270262[_0x1282('0x38')]=_[_0x1282('0x37')](_0x5657f4['model'],qs['fields'](_0x45be30['query']['fields']));_0x270262[_0x1282('0x38')]=_0x270262[_0x1282('0x38')][_0x1282('0x3a')]?_0x270262[_0x1282('0x38')]:_0x5657f4['model'];if(_0x45be30['query']['includeAll']){_0x270262[_0x1282('0x4a')]=[{'all':!![]}];}_0x270262=_['merge']({},_0x270262,_0x45be30['options']);return db['FreshdeskAccount'][_0x1282('0x4b')](_0x270262)[_0x1282('0x45')](handleEntityNotFound(_0x3bd935,null))['then'](respondWithResult(_0x3bd935,null))[_0x1282('0x4c')](handleError(_0x3bd935,null));};exports[_0x1282('0x4d')]=function(_0x3d6792,_0x2e9414){return db['FreshdeskAccount']['create'](_0x3d6792[_0x1282('0x4e')],{})[_0x1282('0x45')](respondWithResult(_0x2e9414,0xc9))[_0x1282('0x4c')](handleError(_0x2e9414,null));};exports[_0x1282('0x28')]=function(_0x381a46,_0x2e1529){if(_0x381a46[_0x1282('0x4e')]['id']){delete _0x381a46[_0x1282('0x4e')]['id'];}return db[_0x1282('0x2d')][_0x1282('0x4b')]({'where':{'id':_0x381a46[_0x1282('0x49')]['id']}})[_0x1282('0x45')](handleEntityNotFound(_0x2e1529,null))[_0x1282('0x45')](saveUpdates(_0x381a46[_0x1282('0x4e')],null))['then'](respondWithResult(_0x2e1529,null))[_0x1282('0x4c')](handleError(_0x2e1529,null));};exports['destroy']=function(_0x16d0cf,_0x412eaf){return db['FreshdeskAccount']['find']({'where':{'id':_0x16d0cf['params']['id']}})[_0x1282('0x45')](handleEntityNotFound(_0x412eaf,null))[_0x1282('0x45')](removeEntity(_0x412eaf,null))[_0x1282('0x4c')](handleError(_0x412eaf,null));};exports[_0x1282('0x4f')]=function(_0x1e0541,_0x212c9c,_0x44e249){var _0x5f00bb={};var _0x276397={};var _0x401f16;var _0x321edb;return db[_0x1282('0x2d')]['findOne']({'where':{'id':_0x1e0541[_0x1282('0x49')]['id']}})[_0x1282('0x45')](handleEntityNotFound(_0x212c9c,null))['then'](function(_0x6275c3){if(_0x6275c3){_0x401f16=_0x6275c3;_0x276397[_0x1282('0x32')]=_[_0x1282('0x34')](db['FreshdeskConfiguration'][_0x1282('0x2e')]);_0x276397['query']=_[_0x1282('0x34')](_0x1e0541['query']);_0x276397[_0x1282('0x36')]=_[_0x1282('0x37')](_0x276397[_0x1282('0x32')],_0x276397[_0x1282('0x35')]);_0x5f00bb[_0x1282('0x38')]=_[_0x1282('0x37')](_0x276397[_0x1282('0x32')],qs[_0x1282('0x39')](_0x1e0541[_0x1282('0x35')][_0x1282('0x39')]));_0x5f00bb['attributes']=_0x5f00bb[_0x1282('0x38')][_0x1282('0x3a')]?_0x5f00bb[_0x1282('0x38')]:_0x276397[_0x1282('0x32')];_0x5f00bb[_0x1282('0x3d')]=qs[_0x1282('0x3e')](_0x1e0541['query'][_0x1282('0x3e')]);_0x5f00bb['where']=qs[_0x1282('0x36')](_[_0x1282('0x40')](_0x1e0541[_0x1282('0x35')],_0x276397[_0x1282('0x36')]));if(_0x1e0541[_0x1282('0x35')][_0x1282('0x43')]){_0x5f00bb['where']=_[_0x1282('0x41')](_0x5f00bb[_0x1282('0x3f')],{'$or':_['map'](_0x5f00bb[_0x1282('0x38')],function(_0x147ac0){var _0xe87f96={};_0xe87f96[_0x147ac0]={'$like':'%'+_0x1e0541['query'][_0x1282('0x43')]+'%'};return _0xe87f96;})});}_0x5f00bb=_['merge']({},_0x5f00bb,_0x1e0541[_0x1282('0x44')]);return _0x401f16[_0x1282('0x4f')](_0x5f00bb);}})['then'](function(_0x556d09){if(_0x556d09){_0x321edb=_0x556d09[_0x1282('0x3a')];if(!_0x1e0541[_0x1282('0x35')][_0x1282('0x50')](_0x1282('0x3b'))){_0x5f00bb[_0x1282('0x3c')]=qs['limit'](_0x1e0541[_0x1282('0x35')][_0x1282('0x3c')]);_0x5f00bb['offset']=qs[_0x1282('0x21')](_0x1e0541[_0x1282('0x35')][_0x1282('0x21')]);}return _0x401f16[_0x1282('0x4f')](_0x5f00bb);}})[_0x1282('0x45')](function(_0x1e2692){if(_0x1e2692){return _0x1e2692?{'count':_0x321edb,'rows':_0x1e2692}:null;}})[_0x1282('0x45')](respondWithResult(_0x212c9c,null))['catch'](handleError(_0x212c9c,null));};exports[_0x1282('0x51')]=function(_0x4d2a6f,_0x359449,_0x1a7545){if(_0x4d2a6f[_0x1282('0x4e')]['id']){delete _0x4d2a6f['body']['id'];}return db[_0x1282('0x2d')][_0x1282('0x52')]({'where':{'id':_0x4d2a6f[_0x1282('0x49')]['id']}})[_0x1282('0x45')](handleEntityNotFound(_0x359449,null))['then'](function(_0x1ed80e){if(_0x1ed80e){_0x4d2a6f[_0x1282('0x4e')][_0x1282('0x53')]=_0x1ed80e['id'];_0x4d2a6f['body'][_0x1282('0x54')]=integrations[_0x1282('0x55')](_0x4d2a6f[_0x1282('0x4e')][_0x1282('0x56')],_0x4d2a6f['body'][_0x1282('0x30')]);_0x4d2a6f[_0x1282('0x4e')]['Descriptions']=integrations[_0x1282('0x57')](_0x4d2a6f[_0x1282('0x4e')]['channel'],_0x4d2a6f[_0x1282('0x4e')][_0x1282('0x30')]);return db[_0x1282('0x58')][_0x1282('0x4d')](_0x4d2a6f[_0x1282('0x4e')],{'include':[{'model':db[_0x1282('0x59')],'as':'Subjects'},{'model':db[_0x1282('0x59')],'as':'Descriptions'}]});}return null;})[_0x1282('0x45')](respondWithResult(_0x359449,null))[_0x1282('0x4c')](handleError(_0x359449,null));};exports[_0x1282('0x5a')]=function(_0x2e7f65,_0x470d95,_0x3aa0d4){var _0x2be9bd='';return db[_0x1282('0x2d')][_0x1282('0x52')]({'where':{'id':_0x2e7f65[_0x1282('0x49')]['id']},'attributes':['id',_0x1282('0x5b'),_0x1282('0x5c')]})[_0x1282('0x45')](handleEntityNotFound(_0x470d95,null))[_0x1282('0x45')](function(_0x3f90ea){if(_0x3f90ea){_0x2be9bd=_0x3f90ea['remoteUri'];var _0x32efc0=_0x2be9bd['slice'](-0x1);if(_0x32efc0==='/'){_0x2be9bd=_0x2be9bd[_0x1282('0x5d')](0x0,_0x2be9bd[_0x1282('0x5e')](_0x32efc0));}return rp({'method':'GET','uri':util[_0x1282('0x5f')](_0x1282('0x60'),_0x2be9bd,_0x1282('0x61')),'headers':{'Authorization':util[_0x1282('0x5f')](_0x1282('0x62'),new Buffer(util['format'](_0x1282('0x63'),_0x3f90ea[_0x1282('0x5c')]))['toString'](_0x1282('0x64')))},'json':!![]});}})[_0x1282('0x45')](function(_0x5ef6c9){if(_0x5ef6c9){var _0x124eef=[_0x1282('0x65'),_0x1282('0x66'),_0x1282('0x67'),_0x1282('0x68'),_0x1282('0x1e'),_0x1282('0x69'),_0x1282('0x6a'),'source',_0x1282('0x6b'),'group',_0x1282('0x6c')];_['remove'](_0x5ef6c9,function(_0xa58f6a){return _0x124eef['includes'](_0xa58f6a[_0x1282('0x2b')])||!_0xa58f6a[_0x1282('0x6d')]&&_0xa58f6a[_0x1282('0x30')]!==_0x1282('0x6e')&&_0xa58f6a['type']!=='custom_dropdown';});return{'count':_0x5ef6c9['length'],'rows':_[_0x1282('0x33')](_0x5ef6c9,function(_0x44884e){return{'id':_0x44884e[_0x1282('0x2b')],'name':_0x44884e['label'],'custom':!_0x44884e['default'],'options':_0x44884e[_0x1282('0x6f')]?_['map'](_0x44884e[_0x1282('0x6f')],function(_0x3bfcd4){return{'name':_['capitalize'](_0x3bfcd4),'value':_0x3bfcd4};}):[]};})};}})[_0x1282('0x45')](respondWithResult(_0x470d95,null))['catch'](function(_0x4f8a31){var _0x1d8cf3=_0x2e7f65[_0x1282('0x35')][_0x1282('0x70')]?0x1f4:_0x4f8a31[_0x1282('0x71')]||0x1f4;logger[_0x1282('0x72')](_0x1282('0x73'),'getFields',_0x1d8cf3,JSON[_0x1282('0x74')](_0x4f8a31));delete _0x4f8a31[_0x1282('0x2b')];if(_0x1d8cf3===0x191){_0x1d8cf3=0x190;}_0x470d95[_0x1282('0x1e')](_0x1d8cf3)[_0x1282('0x2c')](_0x2e7f65['query']['test']?{'message':_0x1282('0x75'),'statusCode':_0x4f8a31[_0x1282('0x71')]}:_0x4f8a31);});}; \ No newline at end of file +var _0x0bb5=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','offset','limit','undefined','count','set','json','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','FreshdeskAccount','include','findAll','rows','catch','show','params','includeAll','create','body','find','destroy','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','substring','lastIndexOf','format','api/v2/ticket_fields','%s:X','base64','subject','agent','priority','group','ticket_type','company','remove','default','custom_text','label','choices','capitalize','test','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0xbc4d66,_0x321958){var _0x5ec02e=function(_0x1936b5){while(--_0x1936b5){_0xbc4d66['push'](_0xbc4d66['shift']());}};_0x5ec02e(++_0x321958);}(_0x0bb5,0x148));var _0x50bb=function(_0x4663b6,_0x639ae5){_0x4663b6=_0x4663b6-0x0;var _0x1bdb9b=_0x0bb5[_0x4663b6];return _0x1bdb9b;};'use strict';var emlformat=require(_0x50bb('0x0'));var rimraf=require(_0x50bb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x50bb('0x2'));var moment=require(_0x50bb('0x3'));var BPromise=require(_0x50bb('0x4'));var Mustache=require(_0x50bb('0x5'));var util=require(_0x50bb('0x6'));var path=require(_0x50bb('0x7'));var sox=require(_0x50bb('0x8'));var csv=require(_0x50bb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50bb('0xa'));var squel=require(_0x50bb('0xb'));var crypto=require(_0x50bb('0xc'));var jsforce=require(_0x50bb('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x50bb('0xe'));var Papa=require(_0x50bb('0xf'));var Redis=require(_0x50bb('0x10'));var authService=require(_0x50bb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x50bb('0x12'));var hardwareService=require(_0x50bb('0x13'));var logger=require(_0x50bb('0x14'))(_0x50bb('0x15'));var utils=require(_0x50bb('0x16'));var config=require(_0x50bb('0x17'));var licenseUtil=require(_0x50bb('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x50bb('0x19'));function respondWithStatusCode(_0x58837d,_0x283f04){_0x283f04=_0x283f04||0xcc;return function(_0xd8ab27){if(_0xd8ab27){return _0x58837d[_0x50bb('0x1a')](_0x283f04);}return _0x58837d['status'](_0x283f04)[_0x50bb('0x1b')]();};}function respondWithResult(_0x309986,_0x3094f2){_0x3094f2=_0x3094f2||0xc8;return function(_0x5244b0){if(_0x5244b0){return _0x309986[_0x50bb('0x1c')](_0x3094f2)['json'](_0x5244b0);}};}function respondWithFilteredResult(_0x21befa,_0x3e1a51){return function(_0x253073){if(_0x253073){var _0x42ffab=typeof _0x3e1a51[_0x50bb('0x1d')]==='undefined'&&typeof _0x3e1a51[_0x50bb('0x1e')]===_0x50bb('0x1f');var _0x4b1f5f=_0x253073[_0x50bb('0x20')];var _0x4796ec=_0x42ffab?0x0:_0x3e1a51[_0x50bb('0x1d')];var _0x431ed4=_0x42ffab?_0x253073['count']:_0x3e1a51['offset']+_0x3e1a51[_0x50bb('0x1e')];var _0x1499dc;if(_0x431ed4>=_0x4b1f5f){_0x431ed4=_0x4b1f5f;_0x1499dc=0xc8;}else{_0x1499dc=0xce;}_0x21befa[_0x50bb('0x1c')](_0x1499dc);return _0x21befa[_0x50bb('0x21')]('Content-Range',_0x4796ec+'-'+_0x431ed4+'/'+_0x4b1f5f)[_0x50bb('0x22')](_0x253073);}return null;};}function patchUpdates(_0x32bfc3){return function(_0x4020a0){try{jsonpatch['apply'](_0x4020a0,_0x32bfc3,!![]);}catch(_0x3104c8){return BPromise[_0x50bb('0x23')](_0x3104c8);}return _0x4020a0[_0x50bb('0x24')]();};}function saveUpdates(_0x4825f8,_0x1dbba2){return function(_0x4cc7f9){if(_0x4cc7f9){return _0x4cc7f9[_0x50bb('0x25')](_0x4825f8)[_0x50bb('0x26')](function(_0x1a2a0b){return _0x1a2a0b;});}return null;};}function removeEntity(_0x2ee87a,_0x846311){return function(_0x342078){if(_0x342078){return _0x342078['destroy']()[_0x50bb('0x26')](function(){_0x2ee87a[_0x50bb('0x1c')](0xcc)[_0x50bb('0x1b')]();});}};}function handleEntityNotFound(_0x3462c1,_0x5234d7){return function(_0x75fea6){if(!_0x75fea6){_0x3462c1['sendStatus'](0x194);}return _0x75fea6;};}function handleError(_0x55e87b,_0x2befd9){_0x2befd9=_0x2befd9||0x1f4;return function(_0x491632){logger['error'](_0x491632[_0x50bb('0x27')]);if(_0x491632[_0x50bb('0x28')]){delete _0x491632[_0x50bb('0x28')];}_0x55e87b[_0x50bb('0x1c')](_0x2befd9)[_0x50bb('0x29')](_0x491632);};}exports[_0x50bb('0x2a')]=function(_0x41a8ad,_0x41d479){var _0x4f7514={},_0x44ce86={},_0x461cf3={'count':0x0,'rows':[]};var _0x15ee2e=_[_0x50bb('0x2b')](db['FreshdeskAccount'][_0x50bb('0x2c')],function(_0x1a62fb){return{'name':_0x1a62fb[_0x50bb('0x2d')],'type':_0x1a62fb[_0x50bb('0x2e')][_0x50bb('0x2f')]};});_0x44ce86[_0x50bb('0x30')]=_[_0x50bb('0x2b')](_0x15ee2e,_0x50bb('0x28'));_0x44ce86[_0x50bb('0x31')]=_[_0x50bb('0x32')](_0x41a8ad[_0x50bb('0x31')]);_0x44ce86[_0x50bb('0x33')]=_['intersection'](_0x44ce86[_0x50bb('0x30')],_0x44ce86[_0x50bb('0x31')]);_0x4f7514[_0x50bb('0x34')]=_[_0x50bb('0x35')](_0x44ce86[_0x50bb('0x30')],qs[_0x50bb('0x36')](_0x41a8ad[_0x50bb('0x31')][_0x50bb('0x36')]));_0x4f7514[_0x50bb('0x34')]=_0x4f7514[_0x50bb('0x34')][_0x50bb('0x37')]?_0x4f7514['attributes']:_0x44ce86[_0x50bb('0x30')];if(!_0x41a8ad[_0x50bb('0x31')][_0x50bb('0x38')](_0x50bb('0x39'))){_0x4f7514[_0x50bb('0x1e')]=qs[_0x50bb('0x1e')](_0x41a8ad['query']['limit']);_0x4f7514[_0x50bb('0x1d')]=qs['offset'](_0x41a8ad[_0x50bb('0x31')][_0x50bb('0x1d')]);}_0x4f7514[_0x50bb('0x3a')]=qs[_0x50bb('0x3b')](_0x41a8ad[_0x50bb('0x31')]['sort']);_0x4f7514[_0x50bb('0x3c')]=qs['filters'](_[_0x50bb('0x3d')](_0x41a8ad[_0x50bb('0x31')],_0x44ce86[_0x50bb('0x33')]),_0x15ee2e);if(_0x41a8ad['query']['filter']){_0x4f7514[_0x50bb('0x3c')]=_[_0x50bb('0x3e')](_0x4f7514[_0x50bb('0x3c')],{'$or':_[_0x50bb('0x2b')](_0x15ee2e,function(_0x51750b){if(_0x51750b[_0x50bb('0x2e')]!=='VIRTUAL'){var _0x52059b={};_0x52059b[_0x51750b[_0x50bb('0x28')]]={'$like':'%'+_0x41a8ad['query'][_0x50bb('0x3f')]+'%'};return _0x52059b;}})});}_0x4f7514=_[_0x50bb('0x3e')]({},_0x4f7514,_0x41a8ad[_0x50bb('0x40')]);var _0x1f156e={'where':_0x4f7514[_0x50bb('0x3c')]};return db[_0x50bb('0x41')][_0x50bb('0x20')](_0x1f156e)[_0x50bb('0x26')](function(_0x46039a){_0x461cf3[_0x50bb('0x20')]=_0x46039a;if(_0x41a8ad['query']['includeAll']){_0x4f7514[_0x50bb('0x42')]=[{'all':!![]}];}return db[_0x50bb('0x41')][_0x50bb('0x43')](_0x4f7514);})[_0x50bb('0x26')](function(_0x5e8085){_0x461cf3[_0x50bb('0x44')]=_0x5e8085;return _0x461cf3;})['then'](respondWithFilteredResult(_0x41d479,_0x4f7514))[_0x50bb('0x45')](handleError(_0x41d479,null));};exports[_0x50bb('0x46')]=function(_0x379944,_0x40748d){var _0x1c438b={'raw':![],'where':{'id':_0x379944[_0x50bb('0x47')]['id']}},_0x355726={};_0x355726[_0x50bb('0x30')]=_[_0x50bb('0x32')](db[_0x50bb('0x41')][_0x50bb('0x2c')]);_0x355726[_0x50bb('0x31')]=_[_0x50bb('0x32')](_0x379944[_0x50bb('0x31')]);_0x355726[_0x50bb('0x33')]=_[_0x50bb('0x35')](_0x355726['model'],_0x355726[_0x50bb('0x31')]);_0x1c438b['attributes']=_[_0x50bb('0x35')](_0x355726[_0x50bb('0x30')],qs[_0x50bb('0x36')](_0x379944[_0x50bb('0x31')][_0x50bb('0x36')]));_0x1c438b[_0x50bb('0x34')]=_0x1c438b[_0x50bb('0x34')][_0x50bb('0x37')]?_0x1c438b[_0x50bb('0x34')]:_0x355726[_0x50bb('0x30')];if(_0x379944[_0x50bb('0x31')][_0x50bb('0x48')]){_0x1c438b[_0x50bb('0x42')]=[{'all':!![]}];}_0x1c438b=_[_0x50bb('0x3e')]({},_0x1c438b,_0x379944['options']);return db[_0x50bb('0x41')]['find'](_0x1c438b)[_0x50bb('0x26')](handleEntityNotFound(_0x40748d,null))[_0x50bb('0x26')](respondWithResult(_0x40748d,null))[_0x50bb('0x45')](handleError(_0x40748d,null));};exports[_0x50bb('0x49')]=function(_0x650e91,_0x39ac1a){return db[_0x50bb('0x41')][_0x50bb('0x49')](_0x650e91['body'],{})[_0x50bb('0x26')](respondWithResult(_0x39ac1a,0xc9))[_0x50bb('0x45')](handleError(_0x39ac1a,null));};exports[_0x50bb('0x25')]=function(_0x13afe2,_0x3659c4){if(_0x13afe2['body']['id']){delete _0x13afe2[_0x50bb('0x4a')]['id'];}return db[_0x50bb('0x41')][_0x50bb('0x4b')]({'where':{'id':_0x13afe2[_0x50bb('0x47')]['id']}})[_0x50bb('0x26')](handleEntityNotFound(_0x3659c4,null))['then'](saveUpdates(_0x13afe2['body'],null))[_0x50bb('0x26')](respondWithResult(_0x3659c4,null))['catch'](handleError(_0x3659c4,null));};exports[_0x50bb('0x4c')]=function(_0x57ee0e,_0x4316e4){return db[_0x50bb('0x41')][_0x50bb('0x4b')]({'where':{'id':_0x57ee0e['params']['id']}})[_0x50bb('0x26')](handleEntityNotFound(_0x4316e4,null))[_0x50bb('0x26')](removeEntity(_0x4316e4,null))['catch'](handleError(_0x4316e4,null));};exports[_0x50bb('0x4d')]=function(_0x1dff6a,_0x8d62af,_0x3c525c){var _0x55a4a6={};var _0x33e71f={};var _0x46b51e;var _0x2e0032;return db[_0x50bb('0x41')][_0x50bb('0x4e')]({'where':{'id':_0x1dff6a['params']['id']}})[_0x50bb('0x26')](handleEntityNotFound(_0x8d62af,null))['then'](function(_0x38a775){if(_0x38a775){_0x46b51e=_0x38a775;_0x33e71f['model']=_['keys'](db[_0x50bb('0x4f')]['rawAttributes']);_0x33e71f['query']=_[_0x50bb('0x32')](_0x1dff6a[_0x50bb('0x31')]);_0x33e71f[_0x50bb('0x33')]=_[_0x50bb('0x35')](_0x33e71f[_0x50bb('0x30')],_0x33e71f[_0x50bb('0x31')]);_0x55a4a6[_0x50bb('0x34')]=_[_0x50bb('0x35')](_0x33e71f['model'],qs['fields'](_0x1dff6a[_0x50bb('0x31')][_0x50bb('0x36')]));_0x55a4a6[_0x50bb('0x34')]=_0x55a4a6[_0x50bb('0x34')][_0x50bb('0x37')]?_0x55a4a6[_0x50bb('0x34')]:_0x33e71f[_0x50bb('0x30')];_0x55a4a6['order']=qs[_0x50bb('0x3b')](_0x1dff6a[_0x50bb('0x31')][_0x50bb('0x3b')]);_0x55a4a6[_0x50bb('0x3c')]=qs[_0x50bb('0x33')](_['pick'](_0x1dff6a[_0x50bb('0x31')],_0x33e71f[_0x50bb('0x33')]));if(_0x1dff6a[_0x50bb('0x31')][_0x50bb('0x3f')]){_0x55a4a6[_0x50bb('0x3c')]=_['merge'](_0x55a4a6[_0x50bb('0x3c')],{'$or':_['map'](_0x55a4a6['attributes'],function(_0x170761){var _0x3057f2={};_0x3057f2[_0x170761]={'$like':'%'+_0x1dff6a[_0x50bb('0x31')][_0x50bb('0x3f')]+'%'};return _0x3057f2;})});}_0x55a4a6=_[_0x50bb('0x3e')]({},_0x55a4a6,_0x1dff6a[_0x50bb('0x40')]);return _0x46b51e[_0x50bb('0x4d')](_0x55a4a6);}})[_0x50bb('0x26')](function(_0x330299){if(_0x330299){_0x2e0032=_0x330299[_0x50bb('0x37')];if(!_0x1dff6a[_0x50bb('0x31')]['hasOwnProperty'](_0x50bb('0x39'))){_0x55a4a6['limit']=qs[_0x50bb('0x1e')](_0x1dff6a[_0x50bb('0x31')]['limit']);_0x55a4a6[_0x50bb('0x1d')]=qs[_0x50bb('0x1d')](_0x1dff6a[_0x50bb('0x31')][_0x50bb('0x1d')]);}return _0x46b51e[_0x50bb('0x4d')](_0x55a4a6);}})[_0x50bb('0x26')](function(_0x2b7df6){if(_0x2b7df6){return _0x2b7df6?{'count':_0x2e0032,'rows':_0x2b7df6}:null;}})[_0x50bb('0x26')](respondWithResult(_0x8d62af,null))['catch'](handleError(_0x8d62af,null));};exports[_0x50bb('0x50')]=function(_0x2dc832,_0x3b17c8,_0x4a226d){if(_0x2dc832[_0x50bb('0x4a')]['id']){delete _0x2dc832[_0x50bb('0x4a')]['id'];}return db[_0x50bb('0x41')][_0x50bb('0x4e')]({'where':{'id':_0x2dc832[_0x50bb('0x47')]['id']}})[_0x50bb('0x26')](handleEntityNotFound(_0x3b17c8,null))['then'](function(_0xf47641){if(_0xf47641){_0x2dc832[_0x50bb('0x4a')][_0x50bb('0x51')]=_0xf47641['id'];_0x2dc832[_0x50bb('0x4a')][_0x50bb('0x52')]=integrations[_0x50bb('0x53')](_0x2dc832['body'][_0x50bb('0x54')],_0x2dc832[_0x50bb('0x4a')][_0x50bb('0x2e')]);_0x2dc832[_0x50bb('0x4a')][_0x50bb('0x55')]=integrations[_0x50bb('0x56')](_0x2dc832[_0x50bb('0x4a')][_0x50bb('0x54')],_0x2dc832[_0x50bb('0x4a')]['type']);return db[_0x50bb('0x4f')][_0x50bb('0x49')](_0x2dc832[_0x50bb('0x4a')],{'include':[{'model':db[_0x50bb('0x57')],'as':_0x50bb('0x52')},{'model':db[_0x50bb('0x57')],'as':_0x50bb('0x55')}]});}return null;})[_0x50bb('0x26')](respondWithResult(_0x3b17c8,null))[_0x50bb('0x45')](handleError(_0x3b17c8,null));};exports['getFields']=function(_0x58ad41,_0x5babbc,_0x4159ad){var _0x5ba597='';return db['FreshdeskAccount'][_0x50bb('0x4e')]({'where':{'id':_0x58ad41[_0x50bb('0x47')]['id']},'attributes':['id',_0x50bb('0x58'),_0x50bb('0x59')]})['then'](handleEntityNotFound(_0x5babbc,null))[_0x50bb('0x26')](function(_0x16a500){if(_0x16a500){_0x5ba597=_0x16a500['remoteUri'];var _0x13310d=_0x5ba597['slice'](-0x1);if(_0x13310d==='/'){_0x5ba597=_0x5ba597[_0x50bb('0x5a')](0x0,_0x5ba597[_0x50bb('0x5b')](_0x13310d));}return rp({'method':'GET','uri':util[_0x50bb('0x5c')]('%s/%s',_0x5ba597,_0x50bb('0x5d')),'headers':{'Authorization':util[_0x50bb('0x5c')]('Basic\x20%s',new Buffer(util[_0x50bb('0x5c')](_0x50bb('0x5e'),_0x16a500[_0x50bb('0x59')]))['toString'](_0x50bb('0x5f')))},'json':!![]});}})[_0x50bb('0x26')](function(_0x224256){if(_0x224256){var _0x31a583=['requester',_0x50bb('0x60'),_0x50bb('0x61'),'description','status',_0x50bb('0x62'),_0x50bb('0x63'),'source',_0x50bb('0x64'),_0x50bb('0x63'),_0x50bb('0x65')];_[_0x50bb('0x66')](_0x224256,function(_0x197798){return _0x31a583['includes'](_0x197798['name'])||!_0x197798[_0x50bb('0x67')]&&_0x197798[_0x50bb('0x2e')]!==_0x50bb('0x68')&&_0x197798[_0x50bb('0x2e')]!=='custom_dropdown';});return{'count':_0x224256[_0x50bb('0x37')],'rows':_['map'](_0x224256,function(_0x256125){return{'id':_0x256125[_0x50bb('0x28')],'name':_0x256125[_0x50bb('0x69')],'custom':!_0x256125[_0x50bb('0x67')],'options':_0x256125[_0x50bb('0x6a')]?_[_0x50bb('0x2b')](_0x256125[_0x50bb('0x6a')],function(_0x57ccc7){return{'name':_[_0x50bb('0x6b')](_0x57ccc7),'value':_0x57ccc7};}):[]};})};}})[_0x50bb('0x26')](respondWithResult(_0x5babbc,null))[_0x50bb('0x45')](function(_0x170923){var _0x5d2dc4=_0x58ad41[_0x50bb('0x31')][_0x50bb('0x6c')]?0x1f4:_0x170923['statusCode']||0x1f4;logger[_0x50bb('0x6d')](_0x50bb('0x6e'),_0x50bb('0x6f'),_0x5d2dc4,JSON[_0x50bb('0x70')](_0x170923));delete _0x170923[_0x50bb('0x28')];if(_0x5d2dc4===0x191){_0x5d2dc4=0x190;}_0x5babbc['status'](_0x5d2dc4)['send'](_0x58ad41[_0x50bb('0x31')]['test']?{'message':_0x50bb('0x71'),'statusCode':_0x170923[_0x50bb('0x72')]}:_0x170923);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 49d6dd5..3c03dfd 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 _0x8019=['FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x17823e,_0x28a254){var _0x2c6aa0=function(_0x18430f){while(--_0x18430f){_0x17823e['push'](_0x17823e['shift']());}};_0x2c6aa0(++_0x28a254);}(_0x8019,0x9c));var _0x9801=function(_0x4f4df2,_0x13c453){_0x4f4df2=_0x4f4df2-0x0;var _0x303e4b=_0x8019[_0x4f4df2];return _0x303e4b;};'use strict';var _=require(_0x9801('0x0'));var util=require('util');var logger=require(_0x9801('0x1'))('api');var moment=require(_0x9801('0x2'));var BPromise=require(_0x9801('0x3'));var rp=require(_0x9801('0x4'));var fs=require('fs');var path=require(_0x9801('0x5'));var rimraf=require(_0x9801('0x6'));var config=require(_0x9801('0x7'));var attributes=require(_0x9801('0x8'));var integrations=require(_0x9801('0x9'));module[_0x9801('0xa')]=function(_0xce0852,_0xee555b){return _0xce0852[_0x9801('0xb')](_0x9801('0xc'),attributes,{'tableName':_0x9801('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a90=['path','../../config/environment','./intFreshdeskAccount.attributes','exports','FreshdeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4cc6b8,_0x5c04b6){var _0x4e0610=function(_0x4b0bc9){while(--_0x4b0bc9){_0x4cc6b8['push'](_0x4cc6b8['shift']());}};_0x4e0610(++_0x5c04b6);}(_0x5a90,0xc5));var _0x05a9=function(_0x4608e7,_0x4e63b9){_0x4608e7=_0x4608e7-0x0;var _0xd87f35=_0x5a90[_0x4608e7];return _0xd87f35;};'use strict';var _=require(_0x05a9('0x0'));var util=require(_0x05a9('0x1'));var logger=require(_0x05a9('0x2'))(_0x05a9('0x3'));var moment=require(_0x05a9('0x4'));var BPromise=require(_0x05a9('0x5'));var rp=require(_0x05a9('0x6'));var fs=require('fs');var path=require(_0x05a9('0x7'));var rimraf=require('rimraf');var config=require(_0x05a9('0x8'));var attributes=require(_0x05a9('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x05a9('0xa')]=function(_0xd8cd5b,_0x8ba0f7){return _0xd8cd5b['define'](_0x05a9('0xb'),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 8391ce4..82c9bde 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 _0x93a0=['result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2c4dfe,_0x587bd9){var _0x370811=function(_0x1f82e5){while(--_0x1f82e5){_0x2c4dfe['push'](_0x2c4dfe['shift']());}};_0x370811(++_0x587bd9);}(_0x93a0,0x19a));var _0x093a=function(_0x320fbb,_0x410613){_0x320fbb=_0x320fbb-0x0;var _0x482ed2=_0x93a0[_0x320fbb];return _0x482ed2;};'use strict';var _=require(_0x093a('0x0'));var util=require('util');var moment=require(_0x093a('0x1'));var BPromise=require(_0x093a('0x2'));var rs=require(_0x093a('0x3'));var fs=require('fs');var Redis=require(_0x093a('0x4'));var db=require(_0x093a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x093a('0x6'))(_0x093a('0x7'));var config=require(_0x093a('0x8'));var jayson=require(_0x093a('0x9'));var client=jayson[_0x093a('0xa')][_0x093a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d373e,_0x46ab5a,_0x235456){return new BPromise(function(_0x4bb19a,_0x57f08b){return client[_0x093a('0xc')](_0x1d373e,_0x235456)[_0x093a('0xd')](function(_0x51c429){logger[_0x093a('0xe')](_0x093a('0xf'),_0x46ab5a,_0x093a('0x10'));logger[_0x093a('0x11')](_0x093a('0x12'),_0x46ab5a,_0x093a('0x10'),JSON[_0x093a('0x13')](_0x51c429));if(_0x51c429[_0x093a('0x14')]){if(_0x51c429[_0x093a('0x14')]['code']===0x1f4){logger[_0x093a('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x46ab5a,_0x51c429[_0x093a('0x14')][_0x093a('0x15')]);return _0x57f08b(_0x51c429[_0x093a('0x14')][_0x093a('0x15')]);}logger['error'](_0x093a('0xf'),_0x46ab5a,_0x51c429['error']['message']);return _0x4bb19a(_0x51c429[_0x093a('0x14')][_0x093a('0x15')]);}else{logger['info'](_0x093a('0xf'),_0x46ab5a,'request\x20sent');_0x4bb19a(_0x51c429[_0x093a('0x16')][_0x093a('0x15')]);}})[_0x093a('0x17')](function(_0x3da99e){logger[_0x093a('0x14')]('FreshdeskAccount,\x20%s,\x20%s',_0x46ab5a,_0x3da99e);_0x57f08b(_0x3da99e);});});}exports[_0x093a('0x18')]=function(_0x27216e){var _0x284cf6=this;return new Promise(function(_0x4ed7a1,_0x1f9d01){return db[_0x093a('0x19')][_0x093a('0x1a')]({'raw':_0x27216e[_0x093a('0x1b')]?_0x27216e[_0x093a('0x1b')][_0x093a('0x1c')]===undefined?!![]:![]:!![],'where':_0x27216e[_0x093a('0x1b')]?_0x27216e[_0x093a('0x1b')][_0x093a('0x1d')]||null:null,'attributes':_0x27216e['options']?_0x27216e['options'][_0x093a('0x1e')]||null:null,'limit':_0x27216e[_0x093a('0x1b')]?_0x27216e[_0x093a('0x1b')][_0x093a('0x1f')]||null:null,'include':_0x27216e['options']?_0x27216e[_0x093a('0x1b')][_0x093a('0x20')]?_[_0x093a('0x21')](_0x27216e[_0x093a('0x1b')][_0x093a('0x20')],function(_0x210a5f){return{'model':db[_0x210a5f['model']],'as':_0x210a5f['as'],'attributes':_0x210a5f[_0x093a('0x1e')],'include':_0x210a5f[_0x093a('0x20')]?_[_0x093a('0x21')](_0x210a5f['include'],function(_0x5d14fd){return{'model':db[_0x5d14fd['model']],'as':_0x5d14fd['as'],'attributes':_0x5d14fd[_0x093a('0x1e')],'include':_0x5d14fd[_0x093a('0x20')]?_['map'](_0x5d14fd[_0x093a('0x20')],function(_0x50afc2){return{'model':db[_0x50afc2[_0x093a('0x22')]],'as':_0x50afc2['as'],'attributes':_0x50afc2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d497e){logger[_0x093a('0xe')](_0x093a('0x18'),_0x27216e);logger[_0x093a('0x11')](_0x093a('0x18'),_0x27216e,JSON[_0x093a('0x13')](_0x1d497e));_0x4ed7a1(_0x1d497e);})[_0x093a('0x17')](function(_0x17a3a4){logger[_0x093a('0x14')](_0x093a('0x18'),_0x17a3a4[_0x093a('0x15')],_0x27216e);_0x1f9d01(_0x284cf6['error'](0x1f4,_0x17a3a4[_0x093a('0x15')]));});});};exports[_0x093a('0x23')]=function(_0x402ba8){var _0x503700=this;return new Promise(function(_0x81a62c,_0x27d9d8){return db[_0x093a('0x19')]['find']({'raw':_0x402ba8[_0x093a('0x1b')]?_0x402ba8[_0x093a('0x1b')][_0x093a('0x1c')]===undefined?!![]:![]:!![],'where':_0x402ba8[_0x093a('0x1b')]?_0x402ba8['options'][_0x093a('0x1d')]||null:null,'attributes':_0x402ba8[_0x093a('0x1b')]?_0x402ba8[_0x093a('0x1b')][_0x093a('0x1e')]||null:null,'include':_0x402ba8['options']?_0x402ba8['options'][_0x093a('0x20')]?_[_0x093a('0x21')](_0x402ba8['options'][_0x093a('0x20')],function(_0x3c0212){return{'model':db[_0x3c0212[_0x093a('0x22')]],'as':_0x3c0212['as'],'attributes':_0x3c0212[_0x093a('0x1e')],'include':_0x3c0212[_0x093a('0x20')]?_[_0x093a('0x21')](_0x3c0212['include'],function(_0x2c3da1){return{'model':db[_0x2c3da1[_0x093a('0x22')]],'as':_0x2c3da1['as'],'attributes':_0x2c3da1[_0x093a('0x1e')],'include':_0x2c3da1[_0x093a('0x20')]?_[_0x093a('0x21')](_0x2c3da1['include'],function(_0x298c91){return{'model':db[_0x298c91[_0x093a('0x22')]],'as':_0x298c91['as'],'attributes':_0x298c91[_0x093a('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x093a('0xd')](function(_0x42a328){logger[_0x093a('0xe')](_0x093a('0x23'),_0x402ba8);logger[_0x093a('0x11')](_0x093a('0x23'),_0x402ba8,JSON['stringify'](_0x42a328));_0x81a62c(_0x42a328);})[_0x093a('0x17')](function(_0x45135b){logger[_0x093a('0x14')](_0x093a('0x23'),_0x45135b[_0x093a('0x15')],_0x402ba8);_0x27d9d8(_0x503700['error'](0x1f4,_0x45135b[_0x093a('0x15')]));});});}; \ No newline at end of file +var _0xa6be=['then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x14f5af,_0x40fc1f){var _0x274c72=function(_0x292ce8){while(--_0x292ce8){_0x14f5af['push'](_0x14f5af['shift']());}};_0x274c72(++_0x40fc1f);}(_0xa6be,0xab));var _0xea6b=function(_0x7dc27e,_0x5c0cb9){_0x7dc27e=_0x7dc27e-0x0;var _0x55ea96=_0xa6be[_0x7dc27e];return _0x55ea96;};'use strict';var _=require(_0xea6b('0x0'));var util=require(_0xea6b('0x1'));var moment=require(_0xea6b('0x2'));var BPromise=require(_0xea6b('0x3'));var rs=require(_0xea6b('0x4'));var fs=require('fs');var Redis=require(_0xea6b('0x5'));var db=require(_0xea6b('0x6'))['db'];var utils=require(_0xea6b('0x7'));var logger=require(_0xea6b('0x8'))(_0xea6b('0x9'));var config=require('../../config/environment');var jayson=require(_0xea6b('0xa'));var client=jayson[_0xea6b('0xb')][_0xea6b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52de9e,_0x36c621,_0x38f84f){return new BPromise(function(_0x291f0a,_0x5dc002){return client[_0xea6b('0xd')](_0x52de9e,_0x38f84f)[_0xea6b('0xe')](function(_0x440485){logger[_0xea6b('0xf')](_0xea6b('0x10'),_0x36c621,_0xea6b('0x11'));logger[_0xea6b('0x12')](_0xea6b('0x13'),_0x36c621,_0xea6b('0x11'),JSON[_0xea6b('0x14')](_0x440485));if(_0x440485[_0xea6b('0x15')]){if(_0x440485[_0xea6b('0x15')][_0xea6b('0x16')]===0x1f4){logger[_0xea6b('0x15')]('FreshdeskAccount,\x20%s,\x20%s',_0x36c621,_0x440485['error'][_0xea6b('0x17')]);return _0x5dc002(_0x440485['error']['message']);}logger[_0xea6b('0x15')](_0xea6b('0x10'),_0x36c621,_0x440485[_0xea6b('0x15')][_0xea6b('0x17')]);return _0x291f0a(_0x440485['error'][_0xea6b('0x17')]);}else{logger[_0xea6b('0xf')](_0xea6b('0x10'),_0x36c621,_0xea6b('0x11'));_0x291f0a(_0x440485['result'][_0xea6b('0x17')]);}})[_0xea6b('0x18')](function(_0x4a6127){logger[_0xea6b('0x15')](_0xea6b('0x10'),_0x36c621,_0x4a6127);_0x5dc002(_0x4a6127);});});}exports[_0xea6b('0x19')]=function(_0x5eedb6){var _0xa2789f=this;return new Promise(function(_0x53aec1,_0x4e5d1){return db[_0xea6b('0x1a')][_0xea6b('0x1b')]({'raw':_0x5eedb6[_0xea6b('0x1c')]?_0x5eedb6[_0xea6b('0x1c')][_0xea6b('0x1d')]===undefined?!![]:![]:!![],'where':_0x5eedb6[_0xea6b('0x1c')]?_0x5eedb6[_0xea6b('0x1c')][_0xea6b('0x1e')]||null:null,'attributes':_0x5eedb6['options']?_0x5eedb6[_0xea6b('0x1c')][_0xea6b('0x1f')]||null:null,'limit':_0x5eedb6[_0xea6b('0x1c')]?_0x5eedb6[_0xea6b('0x1c')][_0xea6b('0x20')]||null:null,'include':_0x5eedb6['options']?_0x5eedb6['options'][_0xea6b('0x21')]?_[_0xea6b('0x22')](_0x5eedb6[_0xea6b('0x1c')][_0xea6b('0x21')],function(_0x421a96){return{'model':db[_0x421a96[_0xea6b('0x23')]],'as':_0x421a96['as'],'attributes':_0x421a96['attributes'],'include':_0x421a96[_0xea6b('0x21')]?_[_0xea6b('0x22')](_0x421a96['include'],function(_0x40a870){return{'model':db[_0x40a870[_0xea6b('0x23')]],'as':_0x40a870['as'],'attributes':_0x40a870[_0xea6b('0x1f')],'include':_0x40a870['include']?_[_0xea6b('0x22')](_0x40a870['include'],function(_0x1d4c5d){return{'model':db[_0x1d4c5d[_0xea6b('0x23')]],'as':_0x1d4c5d['as'],'attributes':_0x1d4c5d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3de8c1){logger[_0xea6b('0xf')](_0xea6b('0x19'),_0x5eedb6);logger[_0xea6b('0x12')]('GetFreshdeskAccount',_0x5eedb6,JSON['stringify'](_0x3de8c1));_0x53aec1(_0x3de8c1);})[_0xea6b('0x18')](function(_0x9553f7){logger[_0xea6b('0x15')](_0xea6b('0x19'),_0x9553f7[_0xea6b('0x17')],_0x5eedb6);_0x4e5d1(_0xa2789f[_0xea6b('0x15')](0x1f4,_0x9553f7[_0xea6b('0x17')]));});});};exports['ShowFreshdeskAccount']=function(_0x846d21){var _0x5dacd4=this;return new Promise(function(_0x3feb71,_0x2a0ffa){return db['FreshdeskAccount']['find']({'raw':_0x846d21[_0xea6b('0x1c')]?_0x846d21['options'][_0xea6b('0x1d')]===undefined?!![]:![]:!![],'where':_0x846d21[_0xea6b('0x1c')]?_0x846d21[_0xea6b('0x1c')][_0xea6b('0x1e')]||null:null,'attributes':_0x846d21[_0xea6b('0x1c')]?_0x846d21[_0xea6b('0x1c')][_0xea6b('0x1f')]||null:null,'include':_0x846d21[_0xea6b('0x1c')]?_0x846d21[_0xea6b('0x1c')][_0xea6b('0x21')]?_['map'](_0x846d21[_0xea6b('0x1c')][_0xea6b('0x21')],function(_0x39a21d){return{'model':db[_0x39a21d[_0xea6b('0x23')]],'as':_0x39a21d['as'],'attributes':_0x39a21d[_0xea6b('0x1f')],'include':_0x39a21d['include']?_[_0xea6b('0x22')](_0x39a21d['include'],function(_0x565fa2){return{'model':db[_0x565fa2[_0xea6b('0x23')]],'as':_0x565fa2['as'],'attributes':_0x565fa2[_0xea6b('0x1f')],'include':_0x565fa2['include']?_[_0xea6b('0x22')](_0x565fa2[_0xea6b('0x21')],function(_0x5418c9){return{'model':db[_0x5418c9['model']],'as':_0x5418c9['as'],'attributes':_0x5418c9[_0xea6b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xea6b('0xe')](function(_0x103869){logger['info'](_0xea6b('0x24'),_0x846d21);logger[_0xea6b('0x12')](_0xea6b('0x24'),_0x846d21,JSON[_0xea6b('0x14')](_0x103869));_0x3feb71(_0x103869);})[_0xea6b('0x18')](function(_0x20977d){logger[_0xea6b('0x15')](_0xea6b('0x24'),_0x20977d[_0xea6b('0x17')],_0x846d21);_0x2a0ffa(_0x5dacd4[_0xea6b('0x15')](0x1f4,_0x20977d['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 63bda6e..aad000a 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 _0x725d=['Router','fs-extra','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getTags','post','/:id/tags','put','delete','destroy','multer','util','connect-timeout','express'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x725d,0x164));var _0xd725=function(_0x4dec07,_0x5d12c8){_0x4dec07=_0x4dec07-0x0;var _0x17c8d4=_0x725d[_0x4dec07];return _0x17c8d4;};'use strict';var multer=require(_0xd725('0x0'));var util=require(_0xd725('0x1'));var path=require('path');var timeout=require(_0xd725('0x2'));var express=require(_0xd725('0x3'));var router=express[_0xd725('0x4')]();var fs_extra=require(_0xd725('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd725('0x6'));var controller=require(_0xd725('0x7'));router[_0xd725('0x8')]('/',auth[_0xd725('0x9')](),controller[_0xd725('0xa')]);router[_0xd725('0x8')](_0xd725('0xb'),auth[_0xd725('0x9')](),controller[_0xd725('0xc')]);router[_0xd725('0x8')](_0xd725('0xd'),auth[_0xd725('0x9')](),controller[_0xd725('0xe')]);router[_0xd725('0x8')](_0xd725('0xf'),auth[_0xd725('0x9')](),controller[_0xd725('0x10')]);router[_0xd725('0x8')](_0xd725('0x11'),auth[_0xd725('0x9')](),controller['getDescriptions']);router[_0xd725('0x8')]('/:id/tags',auth[_0xd725('0x9')](),controller[_0xd725('0x12')]);router[_0xd725('0x13')]('/',auth[_0xd725('0x9')](),controller['create']);router[_0xd725('0x13')](_0xd725('0x14'),auth['isAuthenticated'](),controller['setTags']);router[_0xd725('0x15')](_0xd725('0xb'),auth[_0xd725('0x9')](),controller['update']);router[_0xd725('0x16')](_0xd725('0xb'),auth['isAuthenticated'](),controller[_0xd725('0x17')]);module['exports']=router; \ No newline at end of file +var _0xd178=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x571137,_0x16964e){var _0x2d1f6d=function(_0x334da6){while(--_0x334da6){_0x571137['push'](_0x571137['shift']());}};_0x2d1f6d(++_0x16964e);}(_0xd178,0x158));var _0x8d17=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xd178[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require(_0x8d17('0x0'));var util=require(_0x8d17('0x1'));var path=require(_0x8d17('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d17('0x3'));var router=express[_0x8d17('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8d17('0x5'));var interaction=require(_0x8d17('0x6'));var config=require(_0x8d17('0x7'));var controller=require(_0x8d17('0x8'));router[_0x8d17('0x9')]('/',auth[_0x8d17('0xa')](),controller[_0x8d17('0xb')]);router[_0x8d17('0x9')](_0x8d17('0xc'),auth[_0x8d17('0xa')](),controller[_0x8d17('0xd')]);router[_0x8d17('0x9')](_0x8d17('0xe'),auth[_0x8d17('0xa')](),controller['getFields']);router['get'](_0x8d17('0xf'),auth[_0x8d17('0xa')](),controller[_0x8d17('0x10')]);router[_0x8d17('0x9')](_0x8d17('0x11'),auth[_0x8d17('0xa')](),controller[_0x8d17('0x12')]);router[_0x8d17('0x9')](_0x8d17('0x13'),auth[_0x8d17('0xa')](),controller[_0x8d17('0x14')]);router[_0x8d17('0x15')]('/',auth[_0x8d17('0xa')](),controller[_0x8d17('0x16')]);router[_0x8d17('0x15')](_0x8d17('0x13'),auth[_0x8d17('0xa')](),controller[_0x8d17('0x17')]);router[_0x8d17('0x18')](_0x8d17('0xc'),auth['isAuthenticated'](),controller[_0x8d17('0x19')]);router[_0x8d17('0x1a')](_0x8d17('0xc'),auth[_0x8d17('0xa')](),controller[_0x8d17('0x1b')]);module[_0x8d17('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index ea88748..3d53d35 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 _0x896d=['STRING','sequelize','exports'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x896d,0x10f));var _0xd896=function(_0x571018,_0x32aeb8){_0x571018=_0x571018-0x0;var _0x2c4eb0=_0x896d[_0x571018];return _0x2c4eb0;};'use strict';var Sequelize=require(_0xd896('0x0'));module[_0xd896('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd896('0x2')]}}; \ No newline at end of file +var _0x4289=['exports','STRING'];(function(_0x1d6b55,_0x43ab65){var _0x1751f9=function(_0x22cc1b){while(--_0x22cc1b){_0x1d6b55['push'](_0x1d6b55['shift']());}};_0x1751f9(++_0x43ab65);}(_0x4289,0x1ac));var _0x9428=function(_0x80ea27,_0x3ddd66){_0x80ea27=_0x80ea27-0x0;var _0x4fdee6=_0x4289[_0x80ea27];return _0x4fdee6;};'use strict';var Sequelize=require('sequelize');module[_0x9428('0x0')]={'name':{'type':Sequelize[_0x9428('0x1')]},'description':{'type':Sequelize[_0x9428('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index fa537f7..15c4060 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 _0x07e2=['getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','include','FreshdeskConfiguration','findAll','then','rows','catch','show','includeAll','find','create','body','findOne','params','FreshdeskField','getFields','getSubjects','order','getDescriptions'];(function(_0x39a94d,_0x670d15){var _0x5bc327=function(_0x3fcc31){while(--_0x3fcc31){_0x39a94d['push'](_0x39a94d['shift']());}};_0x5bc327(++_0x670d15);}(_0x07e2,0x1c1));var _0x207e=function(_0x2ef822,_0x5b8acb){_0x2ef822=_0x2ef822-0x0;var _0x2d193e=_0x07e2[_0x2ef822];return _0x2d193e;};'use strict';var emlformat=require(_0x207e('0x0'));var rimraf=require(_0x207e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x207e('0x2'));var rp=require(_0x207e('0x3'));var moment=require(_0x207e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x207e('0x5'));var path=require(_0x207e('0x6'));var sox=require(_0x207e('0x7'));var csv=require(_0x207e('0x8'));var ejs=require(_0x207e('0x9'));var fs=require('fs');var fs_extra=require(_0x207e('0xa'));var _=require(_0x207e('0xb'));var squel=require(_0x207e('0xc'));var crypto=require(_0x207e('0xd'));var jsforce=require(_0x207e('0xe'));var deskjs=require(_0x207e('0xf'));var toCsv=require(_0x207e('0x8'));var querystring=require(_0x207e('0x10'));var Papa=require(_0x207e('0x11'));var Redis=require('ioredis');var authService=require(_0x207e('0x12'));var qs=require(_0x207e('0x13'));var as=require(_0x207e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x207e('0x15'))('api');var utils=require(_0x207e('0x16'));var config=require(_0x207e('0x17'));var licenseUtil=require(_0x207e('0x18'));var db=require(_0x207e('0x19'))['db'];function respondWithStatusCode(_0x400daa,_0x369447){_0x369447=_0x369447||0xcc;return function(_0x8312f5){if(_0x8312f5){return _0x400daa[_0x207e('0x1a')](_0x369447);}return _0x400daa[_0x207e('0x1b')](_0x369447)['end']();};}function respondWithResult(_0x4257e4,_0x37dd73){_0x37dd73=_0x37dd73||0xc8;return function(_0x1da035){if(_0x1da035){return _0x4257e4[_0x207e('0x1b')](_0x37dd73)['json'](_0x1da035);}};}function respondWithFilteredResult(_0x1d150d,_0x2b2be6){return function(_0x70aced){if(_0x70aced){var _0x3b7fcb=typeof _0x2b2be6[_0x207e('0x1c')]==='undefined'&&typeof _0x2b2be6[_0x207e('0x1d')]==='undefined';var _0x9ad749=_0x70aced[_0x207e('0x1e')];var _0x54f60d=_0x3b7fcb?0x0:_0x2b2be6[_0x207e('0x1c')];var _0x4142d2=_0x3b7fcb?_0x70aced['count']:_0x2b2be6[_0x207e('0x1c')]+_0x2b2be6[_0x207e('0x1d')];var _0x528d1a;if(_0x4142d2>=_0x9ad749){_0x4142d2=_0x9ad749;_0x528d1a=0xc8;}else{_0x528d1a=0xce;}_0x1d150d[_0x207e('0x1b')](_0x528d1a);return _0x1d150d[_0x207e('0x1f')](_0x207e('0x20'),_0x54f60d+'-'+_0x4142d2+'/'+_0x9ad749)[_0x207e('0x21')](_0x70aced);}return null;};}function patchUpdates(_0x4dc5a6){return function(_0x3d678d){try{jsonpatch[_0x207e('0x22')](_0x3d678d,_0x4dc5a6,!![]);}catch(_0x440dd2){return BPromise[_0x207e('0x23')](_0x440dd2);}return _0x3d678d[_0x207e('0x24')]();};}function saveUpdates(_0x97480b,_0x25d2b2){return function(_0x11cbc4){if(_0x11cbc4){return _0x11cbc4[_0x207e('0x25')](_0x97480b)['then'](function(_0x3b1e52){return _0x3b1e52;});}return null;};}function removeEntity(_0x1a1dbd,_0x1da4b5){return function(_0x4a5e87){if(_0x4a5e87){return _0x4a5e87[_0x207e('0x26')]()['then'](function(){_0x1a1dbd[_0x207e('0x1b')](0xcc)[_0x207e('0x27')]();});}};}function handleEntityNotFound(_0x5e833f,_0x52ee60){return function(_0x46196d){if(!_0x46196d){_0x5e833f[_0x207e('0x1a')](0x194);}return _0x46196d;};}function handleError(_0x9daf90,_0x4615a5){_0x4615a5=_0x4615a5||0x1f4;return function(_0x24251e){logger[_0x207e('0x28')](_0x24251e[_0x207e('0x29')]);if(_0x24251e[_0x207e('0x2a')]){delete _0x24251e[_0x207e('0x2a')];}_0x9daf90[_0x207e('0x1b')](_0x4615a5)[_0x207e('0x2b')](_0x24251e);};}exports[_0x207e('0x2c')]=function(_0x1a9238,_0x5df9e5){var _0x5b8818={},_0xd9039={},_0x49f874={'count':0x0,'rows':[]};var _0x56cdfe=_[_0x207e('0x2d')](db['FreshdeskConfiguration'][_0x207e('0x2e')],function(_0x421f6b){return{'name':_0x421f6b[_0x207e('0x2f')],'type':_0x421f6b[_0x207e('0x30')][_0x207e('0x31')]};});_0xd9039[_0x207e('0x32')]=_[_0x207e('0x2d')](_0x56cdfe,'name');_0xd9039[_0x207e('0x33')]=_[_0x207e('0x34')](_0x1a9238[_0x207e('0x33')]);_0xd9039[_0x207e('0x35')]=_[_0x207e('0x36')](_0xd9039[_0x207e('0x32')],_0xd9039[_0x207e('0x33')]);_0x5b8818['attributes']=_[_0x207e('0x36')](_0xd9039[_0x207e('0x32')],qs[_0x207e('0x37')](_0x1a9238[_0x207e('0x33')][_0x207e('0x37')]));_0x5b8818[_0x207e('0x38')]=_0x5b8818[_0x207e('0x38')][_0x207e('0x39')]?_0x5b8818['attributes']:_0xd9039[_0x207e('0x32')];if(!_0x1a9238[_0x207e('0x33')][_0x207e('0x3a')](_0x207e('0x3b'))){_0x5b8818[_0x207e('0x1d')]=qs[_0x207e('0x1d')](_0x1a9238[_0x207e('0x33')][_0x207e('0x1d')]);_0x5b8818[_0x207e('0x1c')]=qs[_0x207e('0x1c')](_0x1a9238['query'][_0x207e('0x1c')]);}_0x5b8818['order']=qs[_0x207e('0x3c')](_0x1a9238[_0x207e('0x33')][_0x207e('0x3c')]);_0x5b8818[_0x207e('0x3d')]=qs[_0x207e('0x35')](_[_0x207e('0x3e')](_0x1a9238[_0x207e('0x33')],_0xd9039[_0x207e('0x35')]),_0x56cdfe);if(_0x1a9238[_0x207e('0x33')][_0x207e('0x3f')]){_0x5b8818[_0x207e('0x3d')]=_['merge'](_0x5b8818[_0x207e('0x3d')],{'$or':_[_0x207e('0x2d')](_0x56cdfe,function(_0x2cb0b8){if(_0x2cb0b8[_0x207e('0x30')]!==_0x207e('0x40')){var _0xb89b77={};_0xb89b77[_0x2cb0b8['name']]={'$like':'%'+_0x1a9238[_0x207e('0x33')][_0x207e('0x3f')]+'%'};return _0xb89b77;}})});}_0x5b8818=_[_0x207e('0x41')]({},_0x5b8818,_0x1a9238[_0x207e('0x42')]);var _0x2d5ff6={'where':_0x5b8818[_0x207e('0x3d')]};return db['FreshdeskConfiguration'][_0x207e('0x1e')](_0x2d5ff6)['then'](function(_0x3dd6c1){_0x49f874[_0x207e('0x1e')]=_0x3dd6c1;if(_0x1a9238[_0x207e('0x33')]['includeAll']){_0x5b8818[_0x207e('0x43')]=[{'all':!![]}];}return db[_0x207e('0x44')][_0x207e('0x45')](_0x5b8818);})[_0x207e('0x46')](function(_0x3882a5){_0x49f874[_0x207e('0x47')]=_0x3882a5;return _0x49f874;})[_0x207e('0x46')](respondWithFilteredResult(_0x5df9e5,_0x5b8818))[_0x207e('0x48')](handleError(_0x5df9e5,null));};exports[_0x207e('0x49')]=function(_0x138590,_0x23fff1){var _0x4bee3a={'raw':![],'where':{'id':_0x138590['params']['id']}},_0x3762be={};_0x3762be[_0x207e('0x32')]=_[_0x207e('0x34')](db[_0x207e('0x44')][_0x207e('0x2e')]);_0x3762be[_0x207e('0x33')]=_[_0x207e('0x34')](_0x138590[_0x207e('0x33')]);_0x3762be[_0x207e('0x35')]=_[_0x207e('0x36')](_0x3762be[_0x207e('0x32')],_0x3762be[_0x207e('0x33')]);_0x4bee3a[_0x207e('0x38')]=_[_0x207e('0x36')](_0x3762be[_0x207e('0x32')],qs[_0x207e('0x37')](_0x138590[_0x207e('0x33')]['fields']));_0x4bee3a[_0x207e('0x38')]=_0x4bee3a[_0x207e('0x38')][_0x207e('0x39')]?_0x4bee3a[_0x207e('0x38')]:_0x3762be[_0x207e('0x32')];if(_0x138590[_0x207e('0x33')][_0x207e('0x4a')]){_0x4bee3a[_0x207e('0x43')]=[{'all':!![]}];}_0x4bee3a=_['merge']({},_0x4bee3a,_0x138590[_0x207e('0x42')]);return db[_0x207e('0x44')][_0x207e('0x4b')](_0x4bee3a)[_0x207e('0x46')](handleEntityNotFound(_0x23fff1,null))[_0x207e('0x46')](respondWithResult(_0x23fff1,null))[_0x207e('0x48')](handleError(_0x23fff1,null));};exports['create']=function(_0x41b51a,_0x3160c0){return db[_0x207e('0x44')][_0x207e('0x4c')](_0x41b51a[_0x207e('0x4d')],{})['then'](respondWithResult(_0x3160c0,0xc9))['catch'](handleError(_0x3160c0,null));};exports[_0x207e('0x25')]=function(_0x1adaad,_0x40f855){if(_0x1adaad[_0x207e('0x4d')]['id']){delete _0x1adaad[_0x207e('0x4d')]['id'];}return db['FreshdeskConfiguration'][_0x207e('0x4b')]({'where':{'id':_0x1adaad['params']['id']}})[_0x207e('0x46')](handleEntityNotFound(_0x40f855,null))[_0x207e('0x46')](saveUpdates(_0x1adaad['body'],null))['then'](respondWithResult(_0x40f855,null))[_0x207e('0x48')](handleError(_0x40f855,null));};exports['destroy']=function(_0x114fad,_0x140725){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x114fad['params']['id']}})[_0x207e('0x46')](handleEntityNotFound(_0x140725,null))[_0x207e('0x46')](removeEntity(_0x140725,null))[_0x207e('0x48')](handleError(_0x140725,null));};exports['getFields']=function(_0x293008,_0x16054d,_0xd22817){var _0x5d5505={};var _0x1da088={};var _0x49319e;var _0x381211;return db[_0x207e('0x44')][_0x207e('0x4e')]({'where':{'id':_0x293008[_0x207e('0x4f')]['id']}})[_0x207e('0x46')](handleEntityNotFound(_0x16054d,null))[_0x207e('0x46')](function(_0x5e1d4d){if(_0x5e1d4d){_0x49319e=_0x5e1d4d;_0x1da088[_0x207e('0x32')]=_[_0x207e('0x34')](db[_0x207e('0x50')][_0x207e('0x2e')]);_0x1da088[_0x207e('0x33')]=_['keys'](_0x293008[_0x207e('0x33')]);_0x1da088[_0x207e('0x35')]=_['intersection'](_0x1da088[_0x207e('0x32')],_0x1da088['query']);_0x5d5505[_0x207e('0x38')]=_[_0x207e('0x36')](_0x1da088[_0x207e('0x32')],qs[_0x207e('0x37')](_0x293008[_0x207e('0x33')]['fields']));_0x5d5505[_0x207e('0x38')]=_0x5d5505[_0x207e('0x38')]['length']?_0x5d5505[_0x207e('0x38')]:_0x1da088['model'];_0x5d5505['order']=qs['sort'](_0x293008[_0x207e('0x33')]['sort']);_0x5d5505[_0x207e('0x3d')]=qs['filters'](_['pick'](_0x293008['query'],_0x1da088['filters']));if(_0x293008[_0x207e('0x33')]['filter']){_0x5d5505[_0x207e('0x3d')]=_['merge'](_0x5d5505['where'],{'$or':_[_0x207e('0x2d')](_0x5d5505[_0x207e('0x38')],function(_0x1219ac){var _0x2599ee={};_0x2599ee[_0x1219ac]={'$like':'%'+_0x293008['query'][_0x207e('0x3f')]+'%'};return _0x2599ee;})});}_0x5d5505=_[_0x207e('0x41')]({},_0x5d5505,_0x293008[_0x207e('0x42')]);return _0x49319e[_0x207e('0x51')](_0x5d5505);}})[_0x207e('0x46')](function(_0x440b43){if(_0x440b43){_0x381211=_0x440b43[_0x207e('0x39')];if(!_0x293008[_0x207e('0x33')][_0x207e('0x3a')](_0x207e('0x3b'))){_0x5d5505[_0x207e('0x1d')]=qs[_0x207e('0x1d')](_0x293008[_0x207e('0x33')]['limit']);_0x5d5505['offset']=qs['offset'](_0x293008[_0x207e('0x33')][_0x207e('0x1c')]);}return _0x49319e['getFields'](_0x5d5505);}})[_0x207e('0x46')](function(_0x16b147){if(_0x16b147){return _0x16b147?{'count':_0x381211,'rows':_0x16b147}:null;}})[_0x207e('0x46')](respondWithResult(_0x16054d,null))['catch'](handleError(_0x16054d,null));};exports[_0x207e('0x52')]=function(_0xffccfc,_0x402c89,_0xac4085){var _0x16548b={};var _0x4980f3={};var _0x16b6fd;var _0x54fc7c;return db[_0x207e('0x44')]['findOne']({'where':{'id':_0xffccfc[_0x207e('0x4f')]['id']}})[_0x207e('0x46')](handleEntityNotFound(_0x402c89,null))['then'](function(_0x5550d7){if(_0x5550d7){_0x16b6fd=_0x5550d7;_0x4980f3['model']=_[_0x207e('0x34')](db[_0x207e('0x50')][_0x207e('0x2e')]);_0x4980f3[_0x207e('0x33')]=_[_0x207e('0x34')](_0xffccfc[_0x207e('0x33')]);_0x4980f3[_0x207e('0x35')]=_['intersection'](_0x4980f3['model'],_0x4980f3[_0x207e('0x33')]);_0x16548b[_0x207e('0x38')]=_[_0x207e('0x36')](_0x4980f3[_0x207e('0x32')],qs[_0x207e('0x37')](_0xffccfc['query']['fields']));_0x16548b[_0x207e('0x38')]=_0x16548b[_0x207e('0x38')][_0x207e('0x39')]?_0x16548b[_0x207e('0x38')]:_0x4980f3[_0x207e('0x32')];_0x16548b[_0x207e('0x53')]=qs[_0x207e('0x3c')](_0xffccfc[_0x207e('0x33')]['sort']);_0x16548b[_0x207e('0x3d')]=qs[_0x207e('0x35')](_[_0x207e('0x3e')](_0xffccfc[_0x207e('0x33')],_0x4980f3[_0x207e('0x35')]));if(_0xffccfc[_0x207e('0x33')]['filter']){_0x16548b[_0x207e('0x3d')]=_[_0x207e('0x41')](_0x16548b['where'],{'$or':_[_0x207e('0x2d')](_0x16548b[_0x207e('0x38')],function(_0x1b38ef){var _0x10d6d2={};_0x10d6d2[_0x1b38ef]={'$like':'%'+_0xffccfc[_0x207e('0x33')][_0x207e('0x3f')]+'%'};return _0x10d6d2;})});}_0x16548b=_['merge']({},_0x16548b,_0xffccfc[_0x207e('0x42')]);return _0x16b6fd['getSubjects'](_0x16548b);}})[_0x207e('0x46')](function(_0x2ea246){if(_0x2ea246){_0x54fc7c=_0x2ea246[_0x207e('0x39')];if(!_0xffccfc['query'][_0x207e('0x3a')]('nolimit')){_0x16548b['limit']=qs[_0x207e('0x1d')](_0xffccfc[_0x207e('0x33')]['limit']);_0x16548b[_0x207e('0x1c')]=qs['offset'](_0xffccfc[_0x207e('0x33')][_0x207e('0x1c')]);}return _0x16b6fd[_0x207e('0x52')](_0x16548b);}})[_0x207e('0x46')](function(_0x4d044e){if(_0x4d044e){return _0x4d044e?{'count':_0x54fc7c,'rows':_0x4d044e}:null;}})[_0x207e('0x46')](respondWithResult(_0x402c89,null))[_0x207e('0x48')](handleError(_0x402c89,null));};exports[_0x207e('0x54')]=function(_0x337732,_0x3797db,_0x1d101c){var _0x3c4376={};var _0x3be6c9={};var _0x432743;var _0x125181;return db[_0x207e('0x44')][_0x207e('0x4e')]({'where':{'id':_0x337732[_0x207e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3797db,null))[_0x207e('0x46')](function(_0x5a2ac4){if(_0x5a2ac4){_0x432743=_0x5a2ac4;_0x3be6c9[_0x207e('0x32')]=_[_0x207e('0x34')](db['FreshdeskField'][_0x207e('0x2e')]);_0x3be6c9[_0x207e('0x33')]=_[_0x207e('0x34')](_0x337732['query']);_0x3be6c9[_0x207e('0x35')]=_[_0x207e('0x36')](_0x3be6c9[_0x207e('0x32')],_0x3be6c9[_0x207e('0x33')]);_0x3c4376[_0x207e('0x38')]=_[_0x207e('0x36')](_0x3be6c9[_0x207e('0x32')],qs[_0x207e('0x37')](_0x337732[_0x207e('0x33')][_0x207e('0x37')]));_0x3c4376[_0x207e('0x38')]=_0x3c4376[_0x207e('0x38')]['length']?_0x3c4376[_0x207e('0x38')]:_0x3be6c9['model'];_0x3c4376['order']=qs[_0x207e('0x3c')](_0x337732[_0x207e('0x33')]['sort']);_0x3c4376[_0x207e('0x3d')]=qs[_0x207e('0x35')](_['pick'](_0x337732[_0x207e('0x33')],_0x3be6c9['filters']));if(_0x337732[_0x207e('0x33')][_0x207e('0x3f')]){_0x3c4376[_0x207e('0x3d')]=_[_0x207e('0x41')](_0x3c4376[_0x207e('0x3d')],{'$or':_[_0x207e('0x2d')](_0x3c4376[_0x207e('0x38')],function(_0x41a178){var _0x2f73ee={};_0x2f73ee[_0x41a178]={'$like':'%'+_0x337732[_0x207e('0x33')][_0x207e('0x3f')]+'%'};return _0x2f73ee;})});}_0x3c4376=_['merge']({},_0x3c4376,_0x337732[_0x207e('0x42')]);return _0x432743[_0x207e('0x54')](_0x3c4376);}})['then'](function(_0x26e4db){if(_0x26e4db){_0x125181=_0x26e4db['length'];if(!_0x337732['query'][_0x207e('0x3a')]('nolimit')){_0x3c4376['limit']=qs[_0x207e('0x1d')](_0x337732[_0x207e('0x33')]['limit']);_0x3c4376[_0x207e('0x1c')]=qs[_0x207e('0x1c')](_0x337732[_0x207e('0x33')]['offset']);}return _0x432743[_0x207e('0x54')](_0x3c4376);}})[_0x207e('0x46')](function(_0x46541c){if(_0x46541c){return _0x46541c?{'count':_0x125181,'rows':_0x46541c}:null;}})['then'](respondWithResult(_0x3797db,null))[_0x207e('0x48')](handleError(_0x3797db,null));};exports[_0x207e('0x55')]=function(_0x4da124,_0x319009,_0x11cc08){var _0x42020={};var _0x5756fe={};var _0x46d240;var _0x11ec44;return db['FreshdeskConfiguration'][_0x207e('0x4e')]({'where':{'id':_0x4da124[_0x207e('0x4f')]['id']}})['then'](handleEntityNotFound(_0x319009,null))[_0x207e('0x46')](function(_0x213901){if(_0x213901){_0x46d240=_0x213901;_0x5756fe[_0x207e('0x32')]=_['keys'](db[_0x207e('0x56')][_0x207e('0x2e')]);_0x5756fe[_0x207e('0x33')]=_[_0x207e('0x34')](_0x4da124['query']);_0x5756fe[_0x207e('0x35')]=_[_0x207e('0x36')](_0x5756fe[_0x207e('0x32')],_0x5756fe[_0x207e('0x33')]);_0x42020[_0x207e('0x38')]=_['intersection'](_0x5756fe[_0x207e('0x32')],qs[_0x207e('0x37')](_0x4da124['query'][_0x207e('0x37')]));_0x42020[_0x207e('0x38')]=_0x42020['attributes'][_0x207e('0x39')]?_0x42020['attributes']:_0x5756fe['model'];_0x42020['order']=qs[_0x207e('0x3c')](_0x4da124['query'][_0x207e('0x3c')]);_0x42020[_0x207e('0x3d')]=qs[_0x207e('0x35')](_['pick'](_0x4da124['query'],_0x5756fe[_0x207e('0x35')]));if(_0x4da124[_0x207e('0x33')][_0x207e('0x3f')]){_0x42020[_0x207e('0x3d')]=_[_0x207e('0x41')](_0x42020['where'],{'$or':_[_0x207e('0x2d')](_0x42020['attributes'],function(_0x52adbe){var _0x504eba={};_0x504eba[_0x52adbe]={'$like':'%'+_0x4da124[_0x207e('0x33')]['filter']+'%'};return _0x504eba;})});}_0x42020=_['merge']({},_0x42020,_0x4da124[_0x207e('0x42')]);return _0x46d240[_0x207e('0x55')](_0x42020);}})[_0x207e('0x46')](function(_0x2d2e2e){if(_0x2d2e2e){_0x11ec44=_0x2d2e2e[_0x207e('0x39')];if(!_0x4da124['query'][_0x207e('0x3a')](_0x207e('0x3b'))){_0x42020[_0x207e('0x1d')]=qs[_0x207e('0x1d')](_0x4da124['query']['limit']);_0x42020['offset']=qs[_0x207e('0x1c')](_0x4da124[_0x207e('0x33')]['offset']);}return _0x46d240[_0x207e('0x55')](_0x42020);}})['then'](function(_0x5d3c23){if(_0x5d3c23){return _0x5d3c23?{'count':_0x11ec44,'rows':_0x5d3c23}:null;}})[_0x207e('0x46')](respondWithResult(_0x319009,null))['catch'](handleError(_0x319009,null));};exports[_0x207e('0x57')]=function(_0x1a3bf2,_0xfabffa,_0x3467c4){if(_0x1a3bf2['body']['id']){delete _0x1a3bf2[_0x207e('0x4d')]['id'];}return db[_0x207e('0x44')][_0x207e('0x4e')]({'where':{'id':_0x1a3bf2[_0x207e('0x4f')]['id']}})[_0x207e('0x46')](handleEntityNotFound(_0xfabffa,null))[_0x207e('0x46')](function(_0x35aa7a){if(_0x35aa7a){return _0x35aa7a['setTags'](_0x1a3bf2['body'][_0x207e('0x58')]||[]);}return null;})[_0x207e('0x46')](respondWithResult(_0xfabffa,null))[_0x207e('0x48')](handleError(_0xfabffa,null));}; \ No newline at end of file +var _0x6cf2=['fieldName','type','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','body','find','destroy','getFields','FreshdeskField','order','getSubjects','getDescriptions','findOne','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','error','stack','name','index','map','FreshdeskConfiguration'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x6cf2,0x17f));var _0x26cf=function(_0x2e2deb,_0x341609){_0x2e2deb=_0x2e2deb-0x0;var _0x4eb2e0=_0x6cf2[_0x2e2deb];return _0x4eb2e0;};'use strict';var emlformat=require(_0x26cf('0x0'));var rimraf=require(_0x26cf('0x1'));var zipdir=require(_0x26cf('0x2'));var jsonpatch=require(_0x26cf('0x3'));var rp=require(_0x26cf('0x4'));var moment=require(_0x26cf('0x5'));var BPromise=require(_0x26cf('0x6'));var Mustache=require(_0x26cf('0x7'));var util=require(_0x26cf('0x8'));var path=require(_0x26cf('0x9'));var sox=require(_0x26cf('0xa'));var csv=require(_0x26cf('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26cf('0xc'));var _=require(_0x26cf('0xd'));var squel=require(_0x26cf('0xe'));var crypto=require(_0x26cf('0xf'));var jsforce=require(_0x26cf('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x26cf('0xb'));var querystring=require(_0x26cf('0x11'));var Papa=require(_0x26cf('0x12'));var Redis=require(_0x26cf('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x26cf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x26cf('0x15'));var logger=require(_0x26cf('0x16'))(_0x26cf('0x17'));var utils=require(_0x26cf('0x18'));var config=require(_0x26cf('0x19'));var licenseUtil=require(_0x26cf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x166c6e,_0x24404a){_0x24404a=_0x24404a||0xcc;return function(_0x534530){if(_0x534530){return _0x166c6e[_0x26cf('0x1b')](_0x24404a);}return _0x166c6e[_0x26cf('0x1c')](_0x24404a)[_0x26cf('0x1d')]();};}function respondWithResult(_0x4dd2ab,_0x4edc99){_0x4edc99=_0x4edc99||0xc8;return function(_0x4d5ac0){if(_0x4d5ac0){return _0x4dd2ab['status'](_0x4edc99)['json'](_0x4d5ac0);}};}function respondWithFilteredResult(_0x5130cd,_0x5b8127){return function(_0x301a9c){if(_0x301a9c){var _0x45e33e=typeof _0x5b8127[_0x26cf('0x1e')]===_0x26cf('0x1f')&&typeof _0x5b8127['limit']==='undefined';var _0x31ed78=_0x301a9c[_0x26cf('0x20')];var _0x169c4e=_0x45e33e?0x0:_0x5b8127['offset'];var _0x44c451=_0x45e33e?_0x301a9c[_0x26cf('0x20')]:_0x5b8127[_0x26cf('0x1e')]+_0x5b8127[_0x26cf('0x21')];var _0x2db41e;if(_0x44c451>=_0x31ed78){_0x44c451=_0x31ed78;_0x2db41e=0xc8;}else{_0x2db41e=0xce;}_0x5130cd[_0x26cf('0x1c')](_0x2db41e);return _0x5130cd[_0x26cf('0x22')]('Content-Range',_0x169c4e+'-'+_0x44c451+'/'+_0x31ed78)[_0x26cf('0x23')](_0x301a9c);}return null;};}function patchUpdates(_0x2f235c){return function(_0x45f8a4){try{jsonpatch[_0x26cf('0x24')](_0x45f8a4,_0x2f235c,!![]);}catch(_0x411715){return BPromise[_0x26cf('0x25')](_0x411715);}return _0x45f8a4[_0x26cf('0x26')]();};}function saveUpdates(_0x10bda4,_0xb58a7e){return function(_0x563b93){if(_0x563b93){return _0x563b93[_0x26cf('0x27')](_0x10bda4)[_0x26cf('0x28')](function(_0x5c5c1b){return _0x5c5c1b;});}return null;};}function removeEntity(_0x2b47c0,_0xdf57ab){return function(_0x211b3f){if(_0x211b3f){return _0x211b3f['destroy']()[_0x26cf('0x28')](function(){_0x2b47c0[_0x26cf('0x1c')](0xcc)[_0x26cf('0x1d')]();});}};}function handleEntityNotFound(_0x3fbee2,_0x48b2c7){return function(_0x21f03d){if(!_0x21f03d){_0x3fbee2[_0x26cf('0x1b')](0x194);}return _0x21f03d;};}function handleError(_0x4b2bc8,_0x432630){_0x432630=_0x432630||0x1f4;return function(_0x311e10){logger[_0x26cf('0x29')](_0x311e10[_0x26cf('0x2a')]);if(_0x311e10[_0x26cf('0x2b')]){delete _0x311e10[_0x26cf('0x2b')];}_0x4b2bc8['status'](_0x432630)['send'](_0x311e10);};}exports[_0x26cf('0x2c')]=function(_0x26c013,_0x503c6f){var _0x49d711={},_0x4b5d57={},_0x4f2485={'count':0x0,'rows':[]};var _0x3b72ca=_[_0x26cf('0x2d')](db[_0x26cf('0x2e')]['rawAttributes'],function(_0x5bc3f0){return{'name':_0x5bc3f0[_0x26cf('0x2f')],'type':_0x5bc3f0[_0x26cf('0x30')]['key']};});_0x4b5d57['model']=_[_0x26cf('0x2d')](_0x3b72ca,'name');_0x4b5d57[_0x26cf('0x31')]=_[_0x26cf('0x32')](_0x26c013['query']);_0x4b5d57[_0x26cf('0x33')]=_['intersection'](_0x4b5d57[_0x26cf('0x34')],_0x4b5d57['query']);_0x49d711[_0x26cf('0x35')]=_[_0x26cf('0x36')](_0x4b5d57[_0x26cf('0x34')],qs['fields'](_0x26c013['query'][_0x26cf('0x37')]));_0x49d711[_0x26cf('0x35')]=_0x49d711[_0x26cf('0x35')]['length']?_0x49d711[_0x26cf('0x35')]:_0x4b5d57[_0x26cf('0x34')];if(!_0x26c013[_0x26cf('0x31')][_0x26cf('0x38')](_0x26cf('0x39'))){_0x49d711[_0x26cf('0x21')]=qs['limit'](_0x26c013[_0x26cf('0x31')][_0x26cf('0x21')]);_0x49d711[_0x26cf('0x1e')]=qs[_0x26cf('0x1e')](_0x26c013[_0x26cf('0x31')][_0x26cf('0x1e')]);}_0x49d711['order']=qs['sort'](_0x26c013[_0x26cf('0x31')][_0x26cf('0x3a')]);_0x49d711[_0x26cf('0x3b')]=qs[_0x26cf('0x33')](_[_0x26cf('0x3c')](_0x26c013[_0x26cf('0x31')],_0x4b5d57[_0x26cf('0x33')]),_0x3b72ca);if(_0x26c013[_0x26cf('0x31')]['filter']){_0x49d711[_0x26cf('0x3b')]=_['merge'](_0x49d711['where'],{'$or':_[_0x26cf('0x2d')](_0x3b72ca,function(_0x24b0fe){if(_0x24b0fe['type']!==_0x26cf('0x3d')){var _0x56eee6={};_0x56eee6[_0x24b0fe[_0x26cf('0x2b')]]={'$like':'%'+_0x26c013[_0x26cf('0x31')][_0x26cf('0x3e')]+'%'};return _0x56eee6;}})});}_0x49d711=_[_0x26cf('0x3f')]({},_0x49d711,_0x26c013[_0x26cf('0x40')]);var _0x191a14={'where':_0x49d711[_0x26cf('0x3b')]};return db['FreshdeskConfiguration'][_0x26cf('0x20')](_0x191a14)[_0x26cf('0x28')](function(_0x41c27d){_0x4f2485['count']=_0x41c27d;if(_0x26c013[_0x26cf('0x31')][_0x26cf('0x41')]){_0x49d711[_0x26cf('0x42')]=[{'all':!![]}];}return db[_0x26cf('0x2e')][_0x26cf('0x43')](_0x49d711);})['then'](function(_0x9f73c9){_0x4f2485[_0x26cf('0x44')]=_0x9f73c9;return _0x4f2485;})['then'](respondWithFilteredResult(_0x503c6f,_0x49d711))[_0x26cf('0x45')](handleError(_0x503c6f,null));};exports['show']=function(_0x55d618,_0x2ddaff){var _0x57e619={'raw':![],'where':{'id':_0x55d618[_0x26cf('0x46')]['id']}},_0x25a3fd={};_0x25a3fd['model']=_[_0x26cf('0x32')](db[_0x26cf('0x2e')][_0x26cf('0x47')]);_0x25a3fd[_0x26cf('0x31')]=_['keys'](_0x55d618[_0x26cf('0x31')]);_0x25a3fd[_0x26cf('0x33')]=_[_0x26cf('0x36')](_0x25a3fd[_0x26cf('0x34')],_0x25a3fd[_0x26cf('0x31')]);_0x57e619[_0x26cf('0x35')]=_['intersection'](_0x25a3fd[_0x26cf('0x34')],qs[_0x26cf('0x37')](_0x55d618[_0x26cf('0x31')]['fields']));_0x57e619['attributes']=_0x57e619[_0x26cf('0x35')][_0x26cf('0x48')]?_0x57e619[_0x26cf('0x35')]:_0x25a3fd[_0x26cf('0x34')];if(_0x55d618['query'][_0x26cf('0x41')]){_0x57e619['include']=[{'all':!![]}];}_0x57e619=_[_0x26cf('0x3f')]({},_0x57e619,_0x55d618['options']);return db[_0x26cf('0x2e')]['find'](_0x57e619)[_0x26cf('0x28')](handleEntityNotFound(_0x2ddaff,null))[_0x26cf('0x28')](respondWithResult(_0x2ddaff,null))[_0x26cf('0x45')](handleError(_0x2ddaff,null));};exports['create']=function(_0x56c81f,_0x56e692){return db[_0x26cf('0x2e')]['create'](_0x56c81f[_0x26cf('0x49')],{})[_0x26cf('0x28')](respondWithResult(_0x56e692,0xc9))[_0x26cf('0x45')](handleError(_0x56e692,null));};exports[_0x26cf('0x27')]=function(_0x51d5c3,_0x2388b3){if(_0x51d5c3['body']['id']){delete _0x51d5c3[_0x26cf('0x49')]['id'];}return db[_0x26cf('0x2e')][_0x26cf('0x4a')]({'where':{'id':_0x51d5c3[_0x26cf('0x46')]['id']}})[_0x26cf('0x28')](handleEntityNotFound(_0x2388b3,null))['then'](saveUpdates(_0x51d5c3[_0x26cf('0x49')],null))['then'](respondWithResult(_0x2388b3,null))[_0x26cf('0x45')](handleError(_0x2388b3,null));};exports[_0x26cf('0x4b')]=function(_0x42a942,_0x402fd1){return db['FreshdeskConfiguration'][_0x26cf('0x4a')]({'where':{'id':_0x42a942['params']['id']}})[_0x26cf('0x28')](handleEntityNotFound(_0x402fd1,null))['then'](removeEntity(_0x402fd1,null))[_0x26cf('0x45')](handleError(_0x402fd1,null));};exports[_0x26cf('0x4c')]=function(_0x23b665,_0x5b6a96,_0x516fd6){var _0x242a71={};var _0x572ea0={};var _0x5b4c3a;var _0x559bfb;return db[_0x26cf('0x2e')]['findOne']({'where':{'id':_0x23b665[_0x26cf('0x46')]['id']}})['then'](handleEntityNotFound(_0x5b6a96,null))[_0x26cf('0x28')](function(_0x252533){if(_0x252533){_0x5b4c3a=_0x252533;_0x572ea0[_0x26cf('0x34')]=_[_0x26cf('0x32')](db[_0x26cf('0x4d')][_0x26cf('0x47')]);_0x572ea0['query']=_['keys'](_0x23b665['query']);_0x572ea0[_0x26cf('0x33')]=_[_0x26cf('0x36')](_0x572ea0[_0x26cf('0x34')],_0x572ea0['query']);_0x242a71[_0x26cf('0x35')]=_[_0x26cf('0x36')](_0x572ea0[_0x26cf('0x34')],qs['fields'](_0x23b665['query'][_0x26cf('0x37')]));_0x242a71[_0x26cf('0x35')]=_0x242a71[_0x26cf('0x35')][_0x26cf('0x48')]?_0x242a71[_0x26cf('0x35')]:_0x572ea0['model'];_0x242a71[_0x26cf('0x4e')]=qs[_0x26cf('0x3a')](_0x23b665[_0x26cf('0x31')][_0x26cf('0x3a')]);_0x242a71[_0x26cf('0x3b')]=qs[_0x26cf('0x33')](_[_0x26cf('0x3c')](_0x23b665['query'],_0x572ea0[_0x26cf('0x33')]));if(_0x23b665['query'][_0x26cf('0x3e')]){_0x242a71['where']=_[_0x26cf('0x3f')](_0x242a71[_0x26cf('0x3b')],{'$or':_[_0x26cf('0x2d')](_0x242a71['attributes'],function(_0x2e29f9){var _0x12ff62={};_0x12ff62[_0x2e29f9]={'$like':'%'+_0x23b665[_0x26cf('0x31')][_0x26cf('0x3e')]+'%'};return _0x12ff62;})});}_0x242a71=_['merge']({},_0x242a71,_0x23b665['options']);return _0x5b4c3a['getFields'](_0x242a71);}})[_0x26cf('0x28')](function(_0x417d36){if(_0x417d36){_0x559bfb=_0x417d36['length'];if(!_0x23b665[_0x26cf('0x31')][_0x26cf('0x38')](_0x26cf('0x39'))){_0x242a71[_0x26cf('0x21')]=qs['limit'](_0x23b665[_0x26cf('0x31')][_0x26cf('0x21')]);_0x242a71[_0x26cf('0x1e')]=qs['offset'](_0x23b665[_0x26cf('0x31')][_0x26cf('0x1e')]);}return _0x5b4c3a[_0x26cf('0x4c')](_0x242a71);}})[_0x26cf('0x28')](function(_0x25b874){if(_0x25b874){return _0x25b874?{'count':_0x559bfb,'rows':_0x25b874}:null;}})[_0x26cf('0x28')](respondWithResult(_0x5b6a96,null))[_0x26cf('0x45')](handleError(_0x5b6a96,null));};exports[_0x26cf('0x4f')]=function(_0x4e8f7e,_0x23178f,_0x768b3b){var _0x466405={};var _0x10ba5d={};var _0x272e03;var _0xa9ec1a;return db[_0x26cf('0x2e')]['findOne']({'where':{'id':_0x4e8f7e['params']['id']}})[_0x26cf('0x28')](handleEntityNotFound(_0x23178f,null))[_0x26cf('0x28')](function(_0x54eccc){if(_0x54eccc){_0x272e03=_0x54eccc;_0x10ba5d['model']=_['keys'](db['FreshdeskField'][_0x26cf('0x47')]);_0x10ba5d[_0x26cf('0x31')]=_['keys'](_0x4e8f7e[_0x26cf('0x31')]);_0x10ba5d['filters']=_['intersection'](_0x10ba5d[_0x26cf('0x34')],_0x10ba5d[_0x26cf('0x31')]);_0x466405[_0x26cf('0x35')]=_[_0x26cf('0x36')](_0x10ba5d[_0x26cf('0x34')],qs[_0x26cf('0x37')](_0x4e8f7e[_0x26cf('0x31')][_0x26cf('0x37')]));_0x466405[_0x26cf('0x35')]=_0x466405['attributes'][_0x26cf('0x48')]?_0x466405['attributes']:_0x10ba5d[_0x26cf('0x34')];_0x466405[_0x26cf('0x4e')]=qs['sort'](_0x4e8f7e['query'][_0x26cf('0x3a')]);_0x466405[_0x26cf('0x3b')]=qs[_0x26cf('0x33')](_[_0x26cf('0x3c')](_0x4e8f7e['query'],_0x10ba5d['filters']));if(_0x4e8f7e[_0x26cf('0x31')]['filter']){_0x466405[_0x26cf('0x3b')]=_['merge'](_0x466405[_0x26cf('0x3b')],{'$or':_['map'](_0x466405[_0x26cf('0x35')],function(_0x131a8e){var _0x363856={};_0x363856[_0x131a8e]={'$like':'%'+_0x4e8f7e[_0x26cf('0x31')][_0x26cf('0x3e')]+'%'};return _0x363856;})});}_0x466405=_[_0x26cf('0x3f')]({},_0x466405,_0x4e8f7e[_0x26cf('0x40')]);return _0x272e03[_0x26cf('0x4f')](_0x466405);}})['then'](function(_0x2a820b){if(_0x2a820b){_0xa9ec1a=_0x2a820b[_0x26cf('0x48')];if(!_0x4e8f7e[_0x26cf('0x31')][_0x26cf('0x38')](_0x26cf('0x39'))){_0x466405[_0x26cf('0x21')]=qs['limit'](_0x4e8f7e[_0x26cf('0x31')]['limit']);_0x466405[_0x26cf('0x1e')]=qs[_0x26cf('0x1e')](_0x4e8f7e['query'][_0x26cf('0x1e')]);}return _0x272e03[_0x26cf('0x4f')](_0x466405);}})[_0x26cf('0x28')](function(_0x50008c){if(_0x50008c){return _0x50008c?{'count':_0xa9ec1a,'rows':_0x50008c}:null;}})['then'](respondWithResult(_0x23178f,null))[_0x26cf('0x45')](handleError(_0x23178f,null));};exports[_0x26cf('0x50')]=function(_0x3ebe57,_0x480437,_0x4506bb){var _0x2770e3={};var _0x488cea={};var _0x39da3d;var _0x18f43c;return db[_0x26cf('0x2e')][_0x26cf('0x51')]({'where':{'id':_0x3ebe57[_0x26cf('0x46')]['id']}})[_0x26cf('0x28')](handleEntityNotFound(_0x480437,null))[_0x26cf('0x28')](function(_0x3dd1d5){if(_0x3dd1d5){_0x39da3d=_0x3dd1d5;_0x488cea[_0x26cf('0x34')]=_[_0x26cf('0x32')](db[_0x26cf('0x4d')][_0x26cf('0x47')]);_0x488cea[_0x26cf('0x31')]=_[_0x26cf('0x32')](_0x3ebe57[_0x26cf('0x31')]);_0x488cea[_0x26cf('0x33')]=_['intersection'](_0x488cea[_0x26cf('0x34')],_0x488cea[_0x26cf('0x31')]);_0x2770e3['attributes']=_[_0x26cf('0x36')](_0x488cea['model'],qs[_0x26cf('0x37')](_0x3ebe57[_0x26cf('0x31')][_0x26cf('0x37')]));_0x2770e3[_0x26cf('0x35')]=_0x2770e3[_0x26cf('0x35')][_0x26cf('0x48')]?_0x2770e3[_0x26cf('0x35')]:_0x488cea[_0x26cf('0x34')];_0x2770e3[_0x26cf('0x4e')]=qs[_0x26cf('0x3a')](_0x3ebe57[_0x26cf('0x31')][_0x26cf('0x3a')]);_0x2770e3[_0x26cf('0x3b')]=qs[_0x26cf('0x33')](_[_0x26cf('0x3c')](_0x3ebe57[_0x26cf('0x31')],_0x488cea[_0x26cf('0x33')]));if(_0x3ebe57['query'][_0x26cf('0x3e')]){_0x2770e3[_0x26cf('0x3b')]=_['merge'](_0x2770e3[_0x26cf('0x3b')],{'$or':_[_0x26cf('0x2d')](_0x2770e3[_0x26cf('0x35')],function(_0x1efc68){var _0x447a47={};_0x447a47[_0x1efc68]={'$like':'%'+_0x3ebe57[_0x26cf('0x31')]['filter']+'%'};return _0x447a47;})});}_0x2770e3=_[_0x26cf('0x3f')]({},_0x2770e3,_0x3ebe57[_0x26cf('0x40')]);return _0x39da3d[_0x26cf('0x50')](_0x2770e3);}})['then'](function(_0x4c594c){if(_0x4c594c){_0x18f43c=_0x4c594c[_0x26cf('0x48')];if(!_0x3ebe57[_0x26cf('0x31')][_0x26cf('0x38')](_0x26cf('0x39'))){_0x2770e3[_0x26cf('0x21')]=qs[_0x26cf('0x21')](_0x3ebe57[_0x26cf('0x31')][_0x26cf('0x21')]);_0x2770e3[_0x26cf('0x1e')]=qs[_0x26cf('0x1e')](_0x3ebe57[_0x26cf('0x31')][_0x26cf('0x1e')]);}return _0x39da3d[_0x26cf('0x50')](_0x2770e3);}})[_0x26cf('0x28')](function(_0xc35dd2){if(_0xc35dd2){return _0xc35dd2?{'count':_0x18f43c,'rows':_0xc35dd2}:null;}})[_0x26cf('0x28')](respondWithResult(_0x480437,null))[_0x26cf('0x45')](handleError(_0x480437,null));};exports[_0x26cf('0x52')]=function(_0x1df79e,_0x344086,_0x527a44){var _0x349e71={};var _0x59c98e={};var _0x1e91f2;var _0x3cfbd8;return db[_0x26cf('0x2e')][_0x26cf('0x51')]({'where':{'id':_0x1df79e[_0x26cf('0x46')]['id']}})[_0x26cf('0x28')](handleEntityNotFound(_0x344086,null))[_0x26cf('0x28')](function(_0x30f3ce){if(_0x30f3ce){_0x1e91f2=_0x30f3ce;_0x59c98e[_0x26cf('0x34')]=_[_0x26cf('0x32')](db[_0x26cf('0x53')][_0x26cf('0x47')]);_0x59c98e[_0x26cf('0x31')]=_[_0x26cf('0x32')](_0x1df79e['query']);_0x59c98e[_0x26cf('0x33')]=_['intersection'](_0x59c98e[_0x26cf('0x34')],_0x59c98e['query']);_0x349e71[_0x26cf('0x35')]=_[_0x26cf('0x36')](_0x59c98e['model'],qs[_0x26cf('0x37')](_0x1df79e[_0x26cf('0x31')][_0x26cf('0x37')]));_0x349e71['attributes']=_0x349e71[_0x26cf('0x35')][_0x26cf('0x48')]?_0x349e71[_0x26cf('0x35')]:_0x59c98e[_0x26cf('0x34')];_0x349e71[_0x26cf('0x4e')]=qs['sort'](_0x1df79e[_0x26cf('0x31')][_0x26cf('0x3a')]);_0x349e71['where']=qs[_0x26cf('0x33')](_[_0x26cf('0x3c')](_0x1df79e[_0x26cf('0x31')],_0x59c98e[_0x26cf('0x33')]));if(_0x1df79e[_0x26cf('0x31')]['filter']){_0x349e71['where']=_[_0x26cf('0x3f')](_0x349e71[_0x26cf('0x3b')],{'$or':_['map'](_0x349e71[_0x26cf('0x35')],function(_0x566301){var _0x3e74fd={};_0x3e74fd[_0x566301]={'$like':'%'+_0x1df79e['query'][_0x26cf('0x3e')]+'%'};return _0x3e74fd;})});}_0x349e71=_[_0x26cf('0x3f')]({},_0x349e71,_0x1df79e['options']);return _0x1e91f2[_0x26cf('0x52')](_0x349e71);}})[_0x26cf('0x28')](function(_0x4cbcf5){if(_0x4cbcf5){_0x3cfbd8=_0x4cbcf5['length'];if(!_0x1df79e['query'][_0x26cf('0x38')](_0x26cf('0x39'))){_0x349e71[_0x26cf('0x21')]=qs[_0x26cf('0x21')](_0x1df79e[_0x26cf('0x31')][_0x26cf('0x21')]);_0x349e71['offset']=qs[_0x26cf('0x1e')](_0x1df79e[_0x26cf('0x31')][_0x26cf('0x1e')]);}return _0x1e91f2[_0x26cf('0x52')](_0x349e71);}})['then'](function(_0x422ea5){if(_0x422ea5){return _0x422ea5?{'count':_0x3cfbd8,'rows':_0x422ea5}:null;}})[_0x26cf('0x28')](respondWithResult(_0x344086,null))[_0x26cf('0x45')](handleError(_0x344086,null));};exports[_0x26cf('0x54')]=function(_0x181203,_0x135eb0,_0xbfd26b){if(_0x181203[_0x26cf('0x49')]['id']){delete _0x181203[_0x26cf('0x49')]['id'];}return db[_0x26cf('0x2e')]['findOne']({'where':{'id':_0x181203[_0x26cf('0x46')]['id']}})['then'](handleEntityNotFound(_0x135eb0,null))[_0x26cf('0x28')](function(_0x17c16f){if(_0x17c16f){return _0x17c16f[_0x26cf('0x54')](_0x181203[_0x26cf('0x49')][_0x26cf('0x55')]||[]);}return null;})[_0x26cf('0x28')](respondWithResult(_0x135eb0,null))[_0x26cf('0x45')](handleError(_0x135eb0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 7cb0831..6b9bf07 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 _0xac94=['request-promise','path','rimraf','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','moment','bluebird'];(function(_0x59d74a,_0xf35858){var _0x137878=function(_0x116a70){while(--_0x116a70){_0x59d74a['push'](_0x59d74a['shift']());}};_0x137878(++_0xf35858);}(_0xac94,0x103));var _0x4ac9=function(_0x44ebee,_0x4392ca){_0x44ebee=_0x44ebee-0x0;var _0x53b52f=_0xac94[_0x44ebee];return _0x53b52f;};'use strict';var _=require(_0x4ac9('0x0'));var util=require(_0x4ac9('0x1'));var logger=require('../../config/logger')(_0x4ac9('0x2'));var moment=require(_0x4ac9('0x3'));var BPromise=require(_0x4ac9('0x4'));var rp=require(_0x4ac9('0x5'));var fs=require('fs');var path=require(_0x4ac9('0x6'));var rimraf=require(_0x4ac9('0x7'));var config=require('../../config/environment');var attributes=require(_0x4ac9('0x8'));module['exports']=function(_0x1d084d,_0x2e33d0){return _0x1d084d[_0x4ac9('0x9')](_0x4ac9('0xa'),attributes,{'tableName':_0x4ac9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeae4=['../../config/environment','./intFreshdeskConfiguration.attributes','int_freshdesk_configurations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x773ebb,_0x93df36){var _0x236626=function(_0x40ccc2){while(--_0x40ccc2){_0x773ebb['push'](_0x773ebb['shift']());}};_0x236626(++_0x93df36);}(_0xeae4,0x11b));var _0x4eae=function(_0x5a9b9b,_0x2ec608){_0x5a9b9b=_0x5a9b9b-0x0;var _0x23fd61=_0xeae4[_0x5a9b9b];return _0x23fd61;};'use strict';var _=require(_0x4eae('0x0'));var util=require('util');var logger=require(_0x4eae('0x1'))(_0x4eae('0x2'));var moment=require('moment');var BPromise=require(_0x4eae('0x3'));var rp=require(_0x4eae('0x4'));var fs=require('fs');var path=require(_0x4eae('0x5'));var rimraf=require(_0x4eae('0x6'));var config=require(_0x4eae('0x7'));var attributes=require(_0x4eae('0x8'));module['exports']=function(_0x525a9e,_0x19aeb1){return _0x525a9e['define']('FreshdeskConfiguration',attributes,{'tableName':_0x4eae('0x9'),'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 ed89b7f..3588131 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 _0x41fc=['info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then'];(function(_0x11a3bb,_0x5c5466){var _0x3c3e36=function(_0x59f16f){while(--_0x59f16f){_0x11a3bb['push'](_0x11a3bb['shift']());}};_0x3c3e36(++_0x5c5466);}(_0x41fc,0x154));var _0xc41f=function(_0x20c5b3,_0x152196){_0x20c5b3=_0x20c5b3-0x0;var _0x27155c=_0x41fc[_0x20c5b3];return _0x27155c;};'use strict';var _=require(_0xc41f('0x0'));var util=require(_0xc41f('0x1'));var moment=require(_0xc41f('0x2'));var BPromise=require(_0xc41f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc41f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc41f('0x5'));var logger=require(_0xc41f('0x6'))(_0xc41f('0x7'));var config=require(_0xc41f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc41f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3466c9,_0xef5276,_0x35652a){return new BPromise(function(_0x363150,_0x52bf18){return client[_0xc41f('0xa')](_0x3466c9,_0x35652a)[_0xc41f('0xb')](function(_0x12b154){logger[_0xc41f('0xc')](_0xc41f('0xd'),_0xef5276,'request\x20sent');logger[_0xc41f('0xe')](_0xc41f('0xf'),_0xef5276,_0xc41f('0x10'),JSON[_0xc41f('0x11')](_0x12b154));if(_0x12b154[_0xc41f('0x12')]){if(_0x12b154[_0xc41f('0x12')]['code']===0x1f4){logger[_0xc41f('0x12')](_0xc41f('0xd'),_0xef5276,_0x12b154[_0xc41f('0x12')][_0xc41f('0x13')]);return _0x52bf18(_0x12b154[_0xc41f('0x12')]['message']);}logger[_0xc41f('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xef5276,_0x12b154['error']['message']);return _0x363150(_0x12b154[_0xc41f('0x12')]['message']);}else{logger[_0xc41f('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s',_0xef5276,_0xc41f('0x10'));_0x363150(_0x12b154[_0xc41f('0x14')][_0xc41f('0x13')]);}})[_0xc41f('0x15')](function(_0x2ea372){logger[_0xc41f('0x12')](_0xc41f('0xd'),_0xef5276,_0x2ea372);_0x52bf18(_0x2ea372);});});} \ No newline at end of file +var _0x5368=['../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskConfiguration,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x135892,_0x203263){var _0x1351d4=function(_0x40bfd8){while(--_0x40bfd8){_0x135892['push'](_0x135892['shift']());}};_0x1351d4(++_0x203263);}(_0x5368,0x19b));var _0x8536=function(_0x4e8b59,_0x3ab3c2){_0x4e8b59=_0x4e8b59-0x0;var _0xfaa6e7=_0x5368[_0x4e8b59];return _0xfaa6e7;};'use strict';var _=require('lodash');var util=require(_0x8536('0x0'));var moment=require(_0x8536('0x1'));var BPromise=require(_0x8536('0x2'));var rs=require(_0x8536('0x3'));var fs=require('fs');var Redis=require(_0x8536('0x4'));var db=require(_0x8536('0x5'))['db'];var utils=require(_0x8536('0x6'));var logger=require(_0x8536('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8536('0x8'));var client=jayson[_0x8536('0x9')][_0x8536('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd42fe1,_0x1e0523,_0x4734a0){return new BPromise(function(_0x37972e,_0x1fc0fd){return client[_0x8536('0xb')](_0xd42fe1,_0x4734a0)[_0x8536('0xc')](function(_0x176ebd){logger[_0x8536('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e0523,_0x8536('0xe'));logger['debug'](_0x8536('0xf'),_0x1e0523,'request\x20sent',JSON[_0x8536('0x10')](_0x176ebd));if(_0x176ebd[_0x8536('0x11')]){if(_0x176ebd[_0x8536('0x11')][_0x8536('0x12')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e0523,_0x176ebd['error'][_0x8536('0x13')]);return _0x1fc0fd(_0x176ebd[_0x8536('0x11')][_0x8536('0x13')]);}logger[_0x8536('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1e0523,_0x176ebd[_0x8536('0x11')][_0x8536('0x13')]);return _0x37972e(_0x176ebd[_0x8536('0x11')][_0x8536('0x13')]);}else{logger[_0x8536('0xd')](_0x8536('0x14'),_0x1e0523,_0x8536('0xe'));_0x37972e(_0x176ebd['result'][_0x8536('0x13')]);}})[_0x8536('0x15')](function(_0x62fe35){logger[_0x8536('0x11')](_0x8536('0x14'),_0x1e0523,_0x62fe35);_0x1fc0fd(_0x62fe35);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 685b841..10949e6 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 _0x3036=['index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_0x2bc8ba,_0x26712f){var _0x554054=function(_0x3e3fe1){while(--_0x3e3fe1){_0x2bc8ba['push'](_0x2bc8ba['shift']());}};_0x554054(++_0x26712f);}(_0x3036,0x16f));var _0x6303=function(_0x1590d4,_0x5beb5a){_0x1590d4=_0x1590d4-0x0;var _0x4ebd5d=_0x3036[_0x1590d4];return _0x4ebd5d;};'use strict';var multer=require(_0x6303('0x0'));var util=require(_0x6303('0x1'));var path=require(_0x6303('0x2'));var timeout=require(_0x6303('0x3'));var express=require(_0x6303('0x4'));var router=express[_0x6303('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6303('0x6'));var config=require(_0x6303('0x7'));var controller=require(_0x6303('0x8'));router[_0x6303('0x9')]('/',auth[_0x6303('0xa')](),controller[_0x6303('0xb')]);router['get'](_0x6303('0xc'),auth['isAuthenticated'](),controller[_0x6303('0xd')]);router[_0x6303('0xe')]('/',auth[_0x6303('0xa')](),controller[_0x6303('0xf')]);router[_0x6303('0x10')](_0x6303('0xc'),auth[_0x6303('0xa')](),controller[_0x6303('0x11')]);router[_0x6303('0x12')]('/:id',auth[_0x6303('0xa')](),controller[_0x6303('0x13')]);module[_0x6303('0x14')]=router; \ No newline at end of file +var _0xb1d9=['create','put','update','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x375bfd,_0x7c9e97){var _0x5ae9af=function(_0x1b8e61){while(--_0x1b8e61){_0x375bfd['push'](_0x375bfd['shift']());}};_0x5ae9af(++_0x7c9e97);}(_0xb1d9,0x122));var _0x9b1d=function(_0x539291,_0x1f7d12){_0x539291=_0x539291-0x0;var _0xcb7e73=_0xb1d9[_0x539291];return _0xcb7e73;};'use strict';var multer=require(_0x9b1d('0x0'));var util=require(_0x9b1d('0x1'));var path=require('path');var timeout=require(_0x9b1d('0x2'));var express=require('express');var router=express[_0x9b1d('0x3')]();var fs_extra=require(_0x9b1d('0x4'));var auth=require(_0x9b1d('0x5'));var interaction=require(_0x9b1d('0x6'));var config=require(_0x9b1d('0x7'));var controller=require(_0x9b1d('0x8'));router[_0x9b1d('0x9')]('/',auth[_0x9b1d('0xa')](),controller[_0x9b1d('0xb')]);router[_0x9b1d('0x9')](_0x9b1d('0xc'),auth[_0x9b1d('0xa')](),controller[_0x9b1d('0xd')]);router['post']('/',auth[_0x9b1d('0xa')](),controller[_0x9b1d('0xe')]);router[_0x9b1d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x9b1d('0x10')]);router['delete'](_0x9b1d('0xc'),auth[_0x9b1d('0xa')](),controller[_0x9b1d('0x11')]);module[_0x9b1d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index c715cfe..59ee92e 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 _0x9637=['sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x370852,_0x2c7e62){var _0x40cc7e=function(_0x34a439){while(--_0x34a439){_0x370852['push'](_0x370852['shift']());}};_0x40cc7e(++_0x2c7e62);}(_0x9637,0x1a7));var _0x7963=function(_0x148ec7,_0x351090){_0x148ec7=_0x148ec7-0x0;var _0x582769=_0x9637[_0x148ec7];return _0x582769;};'use strict';var Sequelize=require(_0x7963('0x0'));module['exports']={'type':{'type':Sequelize[_0x7963('0x1')](_0x7963('0x2'),_0x7963('0x3'),_0x7963('0x4'),_0x7963('0x5'),_0x7963('0x6')),'defaultValue':_0x7963('0x2')},'content':{'type':Sequelize[_0x7963('0x7')]},'key':{'type':Sequelize[_0x7963('0x7')]},'keyType':{'type':Sequelize[_0x7963('0x1')](_0x7963('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x7963('0x7')]},'idField':{'type':Sequelize[_0x7963('0x7')]},'nameField':{'type':Sequelize[_0x7963('0x7')]},'customField':{'type':Sequelize[_0x7963('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7963('0x7')]}}; \ No newline at end of file +var _0xa0da=['customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','string','variable'];(function(_0x4858bc,_0x176641){var _0x5f2e11=function(_0x45866b){while(--_0x45866b){_0x4858bc['push'](_0x4858bc['shift']());}};_0x5f2e11(++_0x176641);}(_0xa0da,0xf5));var _0xaa0d=function(_0x57b4cf,_0x7aced5){_0x57b4cf=_0x57b4cf-0x0;var _0x4432e6=_0xa0da[_0x57b4cf];return _0x4432e6;};'use strict';var Sequelize=require(_0xaa0d('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xaa0d('0x1'),_0xaa0d('0x2'),_0xaa0d('0x3'),_0xaa0d('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xaa0d('0x5')]},'keyType':{'type':Sequelize[_0xaa0d('0x6')](_0xaa0d('0x1'),'variable',_0xaa0d('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xaa0d('0x5')]},'nameField':{'type':Sequelize[_0xaa0d('0x5')]},'customField':{'type':Sequelize[_0xaa0d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 131c987..f1cad7d 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 _0x684c=['to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','query','intersection','model','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','params','find','body','update','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x5def81,_0x7fe1d6){var _0x521d22=function(_0x2657d0){while(--_0x2657d0){_0x5def81['push'](_0x5def81['shift']());}};_0x521d22(++_0x7fe1d6);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc684('0x0'));var rimraf=require(_0xc684('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc684('0x2'));var rp=require(_0xc684('0x3'));var moment=require(_0xc684('0x4'));var BPromise=require(_0xc684('0x5'));var Mustache=require(_0xc684('0x6'));var util=require('util');var path=require(_0xc684('0x7'));var sox=require(_0xc684('0x8'));var csv=require(_0xc684('0x9'));var ejs=require(_0xc684('0xa'));var fs=require('fs');var fs_extra=require(_0xc684('0xb'));var _=require(_0xc684('0xc'));var squel=require(_0xc684('0xd'));var crypto=require(_0xc684('0xe'));var jsforce=require(_0xc684('0xf'));var deskjs=require(_0xc684('0x10'));var toCsv=require(_0xc684('0x9'));var querystring=require(_0xc684('0x11'));var Papa=require(_0xc684('0x12'));var Redis=require(_0xc684('0x13'));var authService=require(_0xc684('0x14'));var qs=require(_0xc684('0x15'));var as=require(_0xc684('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc684('0x17'))(_0xc684('0x18'));var utils=require(_0xc684('0x19'));var config=require(_0xc684('0x1a'));var licenseUtil=require(_0xc684('0x1b'));var db=require(_0xc684('0x1c'))['db'];function respondWithStatusCode(_0x4f3ff9,_0x3004a6){_0x3004a6=_0x3004a6||0xcc;return function(_0x10cc25){if(_0x10cc25){return _0x4f3ff9['sendStatus'](_0x3004a6);}return _0x4f3ff9['status'](_0x3004a6)[_0xc684('0x1d')]();};}function respondWithResult(_0x34cfd7,_0x32d5da){_0x32d5da=_0x32d5da||0xc8;return function(_0x2ad4f1){if(_0x2ad4f1){return _0x34cfd7[_0xc684('0x1e')](_0x32d5da)[_0xc684('0x1f')](_0x2ad4f1);}};}function respondWithFilteredResult(_0x4f26f7,_0x56d76f){return function(_0x43235d){if(_0x43235d){var _0x599c93=typeof _0x56d76f['offset']==='undefined'&&typeof _0x56d76f['limit']==='undefined';var _0x264cb5=_0x43235d[_0xc684('0x20')];var _0x3b6f5e=_0x599c93?0x0:_0x56d76f[_0xc684('0x21')];var _0x1c3af5=_0x599c93?_0x43235d['count']:_0x56d76f[_0xc684('0x21')]+_0x56d76f[_0xc684('0x22')];var _0x4afdd0;if(_0x1c3af5>=_0x264cb5){_0x1c3af5=_0x264cb5;_0x4afdd0=0xc8;}else{_0x4afdd0=0xce;}_0x4f26f7[_0xc684('0x1e')](_0x4afdd0);return _0x4f26f7[_0xc684('0x23')](_0xc684('0x24'),_0x3b6f5e+'-'+_0x1c3af5+'/'+_0x264cb5)['json'](_0x43235d);}return null;};}function patchUpdates(_0x62c4e5){return function(_0x11a159){try{jsonpatch[_0xc684('0x25')](_0x11a159,_0x62c4e5,!![]);}catch(_0xe7aadb){return BPromise[_0xc684('0x26')](_0xe7aadb);}return _0x11a159['save']();};}function saveUpdates(_0x13d43f,_0x39f39a){return function(_0x1fb8b0){if(_0x1fb8b0){return _0x1fb8b0['update'](_0x13d43f)['then'](function(_0x5a7b2e){return _0x5a7b2e;});}return null;};}function removeEntity(_0x41162b,_0x15ce5d){return function(_0xd2a943){if(_0xd2a943){return _0xd2a943['destroy']()['then'](function(){_0x41162b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27c7cc,_0x321a88){return function(_0x236f02){if(!_0x236f02){_0x27c7cc['sendStatus'](0x194);}return _0x236f02;};}function handleError(_0x32cc56,_0x4dbf22){_0x4dbf22=_0x4dbf22||0x1f4;return function(_0x125d55){logger[_0xc684('0x27')](_0x125d55[_0xc684('0x28')]);if(_0x125d55['name']){delete _0x125d55[_0xc684('0x29')];}_0x32cc56['status'](_0x4dbf22)[_0xc684('0x2a')](_0x125d55);};}exports[_0xc684('0x2b')]=function(_0x210dcd,_0x9fdc2c){var _0x5df482={},_0xc0f77b={},_0x2710c1={'count':0x0,'rows':[]};var _0x28a48a=_[_0xc684('0x2c')](db[_0xc684('0x2d')][_0xc684('0x2e')],function(_0x10db0d){return{'name':_0x10db0d[_0xc684('0x2f')],'type':_0x10db0d['type']['key']};});_0xc0f77b['model']=_[_0xc684('0x2c')](_0x28a48a,_0xc684('0x29'));_0xc0f77b['query']=_['keys'](_0x210dcd[_0xc684('0x30')]);_0xc0f77b['filters']=_[_0xc684('0x31')](_0xc0f77b[_0xc684('0x32')],_0xc0f77b[_0xc684('0x30')]);_0x5df482['attributes']=_['intersection'](_0xc0f77b[_0xc684('0x32')],qs[_0xc684('0x33')](_0x210dcd['query']['fields']));_0x5df482[_0xc684('0x34')]=_0x5df482[_0xc684('0x34')][_0xc684('0x35')]?_0x5df482[_0xc684('0x34')]:_0xc0f77b[_0xc684('0x32')];if(!_0x210dcd[_0xc684('0x30')]['hasOwnProperty'](_0xc684('0x36'))){_0x5df482['limit']=qs['limit'](_0x210dcd[_0xc684('0x30')][_0xc684('0x22')]);_0x5df482['offset']=qs['offset'](_0x210dcd[_0xc684('0x30')][_0xc684('0x21')]);}_0x5df482[_0xc684('0x37')]=qs[_0xc684('0x38')](_0x210dcd[_0xc684('0x30')]['sort']);_0x5df482[_0xc684('0x39')]=qs[_0xc684('0x3a')](_['pick'](_0x210dcd['query'],_0xc0f77b[_0xc684('0x3a')]),_0x28a48a);if(_0x210dcd[_0xc684('0x30')][_0xc684('0x3b')]){_0x5df482[_0xc684('0x39')]=_[_0xc684('0x3c')](_0x5df482[_0xc684('0x39')],{'$or':_[_0xc684('0x2c')](_0x28a48a,function(_0x4889ad){if(_0x4889ad['type']!==_0xc684('0x3d')){var _0x1a863f={};_0x1a863f[_0x4889ad['name']]={'$like':'%'+_0x210dcd['query']['filter']+'%'};return _0x1a863f;}})});}_0x5df482=_[_0xc684('0x3c')]({},_0x5df482,_0x210dcd[_0xc684('0x3e')]);var _0xb1be5c={'where':_0x5df482[_0xc684('0x39')]};return db[_0xc684('0x2d')]['count'](_0xb1be5c)[_0xc684('0x3f')](function(_0x5b44eb){_0x2710c1[_0xc684('0x20')]=_0x5b44eb;if(_0x210dcd[_0xc684('0x30')][_0xc684('0x40')]){_0x5df482[_0xc684('0x41')]=[{'all':!![]}];}return db['FreshdeskField'][_0xc684('0x42')](_0x5df482);})[_0xc684('0x3f')](function(_0xd9eae7){_0x2710c1[_0xc684('0x43')]=_0xd9eae7;return _0x2710c1;})[_0xc684('0x3f')](respondWithFilteredResult(_0x9fdc2c,_0x5df482))[_0xc684('0x44')](handleError(_0x9fdc2c,null));};exports['show']=function(_0x2b3aa7,_0x5aa42f){var _0x566c61={'raw':!![],'where':{'id':_0x2b3aa7[_0xc684('0x45')]['id']}},_0x46c6ad={};_0x46c6ad[_0xc684('0x32')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x46c6ad['query']=_['keys'](_0x2b3aa7[_0xc684('0x30')]);_0x46c6ad[_0xc684('0x3a')]=_[_0xc684('0x31')](_0x46c6ad['model'],_0x46c6ad[_0xc684('0x30')]);_0x566c61['attributes']=_[_0xc684('0x31')](_0x46c6ad['model'],qs[_0xc684('0x33')](_0x2b3aa7[_0xc684('0x30')][_0xc684('0x33')]));_0x566c61[_0xc684('0x34')]=_0x566c61[_0xc684('0x34')]['length']?_0x566c61[_0xc684('0x34')]:_0x46c6ad[_0xc684('0x32')];if(_0x2b3aa7[_0xc684('0x30')][_0xc684('0x40')]){_0x566c61[_0xc684('0x41')]=[{'all':!![]}];}_0x566c61=_[_0xc684('0x3c')]({},_0x566c61,_0x2b3aa7[_0xc684('0x3e')]);return db[_0xc684('0x2d')][_0xc684('0x46')](_0x566c61)['then'](handleEntityNotFound(_0x5aa42f,null))[_0xc684('0x3f')](respondWithResult(_0x5aa42f,null))[_0xc684('0x44')](handleError(_0x5aa42f,null));};exports['create']=function(_0x30abd0,_0x4fb1d5){return db[_0xc684('0x2d')]['create'](_0x30abd0[_0xc684('0x47')],{})[_0xc684('0x3f')](respondWithResult(_0x4fb1d5,0xc9))[_0xc684('0x44')](handleError(_0x4fb1d5,null));};exports[_0xc684('0x48')]=function(_0x1bfd8d,_0x1fde57){if(_0x1bfd8d[_0xc684('0x47')]['id']){delete _0x1bfd8d[_0xc684('0x47')]['id'];}return db[_0xc684('0x2d')][_0xc684('0x46')]({'where':{'id':_0x1bfd8d['params']['id']}})[_0xc684('0x3f')](handleEntityNotFound(_0x1fde57,null))[_0xc684('0x3f')](saveUpdates(_0x1bfd8d['body'],null))['then'](respondWithResult(_0x1fde57,null))['catch'](handleError(_0x1fde57,null));};exports[_0xc684('0x49')]=function(_0x1304a2,_0x5439ae){return db[_0xc684('0x2d')][_0xc684('0x46')]({'where':{'id':_0x1304a2[_0xc684('0x45')]['id']}})['then'](handleEntityNotFound(_0x5439ae,null))[_0xc684('0x3f')](removeEntity(_0x5439ae,null))[_0xc684('0x44')](handleError(_0x5439ae,null));}; \ No newline at end of file +var _0x19ea=['attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','include','findAll','catch','show','fields','includeAll','merge','find','create','body','params','eml-format','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x19ea,0xfe));var _0xa19e=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0x19ea[_0x45fc6a];return _0x14bcfd;};'use strict';var emlformat=require(_0xa19e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa19e('0x1'));var rp=require('request-promise');var moment=require(_0xa19e('0x2'));var BPromise=require(_0xa19e('0x3'));var Mustache=require(_0xa19e('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa19e('0x5'));var csv=require(_0xa19e('0x6'));var ejs=require(_0xa19e('0x7'));var fs=require('fs');var fs_extra=require(_0xa19e('0x8'));var _=require(_0xa19e('0x9'));var squel=require(_0xa19e('0xa'));var crypto=require(_0xa19e('0xb'));var jsforce=require(_0xa19e('0xc'));var deskjs=require(_0xa19e('0xd'));var toCsv=require(_0xa19e('0x6'));var querystring=require(_0xa19e('0xe'));var Papa=require('papaparse');var Redis=require(_0xa19e('0xf'));var authService=require(_0xa19e('0x10'));var qs=require(_0xa19e('0x11'));var as=require(_0xa19e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa19e('0x13'))(_0xa19e('0x14'));var utils=require(_0xa19e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa19e('0x16'));var db=require(_0xa19e('0x17'))['db'];function respondWithStatusCode(_0xc781a2,_0x1bd1f5){_0x1bd1f5=_0x1bd1f5||0xcc;return function(_0x35ca5b){if(_0x35ca5b){return _0xc781a2['sendStatus'](_0x1bd1f5);}return _0xc781a2[_0xa19e('0x18')](_0x1bd1f5)[_0xa19e('0x19')]();};}function respondWithResult(_0xa7e0c4,_0x28dedd){_0x28dedd=_0x28dedd||0xc8;return function(_0x564d2a){if(_0x564d2a){return _0xa7e0c4[_0xa19e('0x18')](_0x28dedd)[_0xa19e('0x1a')](_0x564d2a);}};}function respondWithFilteredResult(_0x245bcb,_0x3be281){return function(_0x1fdea2){if(_0x1fdea2){var _0x2598f5=typeof _0x3be281['offset']===_0xa19e('0x1b')&&typeof _0x3be281[_0xa19e('0x1c')]===_0xa19e('0x1b');var _0x256819=_0x1fdea2[_0xa19e('0x1d')];var _0x38e398=_0x2598f5?0x0:_0x3be281[_0xa19e('0x1e')];var _0x530a75=_0x2598f5?_0x1fdea2[_0xa19e('0x1d')]:_0x3be281['offset']+_0x3be281[_0xa19e('0x1c')];var _0x5d05fd;if(_0x530a75>=_0x256819){_0x530a75=_0x256819;_0x5d05fd=0xc8;}else{_0x5d05fd=0xce;}_0x245bcb['status'](_0x5d05fd);return _0x245bcb[_0xa19e('0x1f')](_0xa19e('0x20'),_0x38e398+'-'+_0x530a75+'/'+_0x256819)['json'](_0x1fdea2);}return null;};}function patchUpdates(_0x1cb9f9){return function(_0x3f2060){try{jsonpatch[_0xa19e('0x21')](_0x3f2060,_0x1cb9f9,!![]);}catch(_0x93eb86){return BPromise['reject'](_0x93eb86);}return _0x3f2060[_0xa19e('0x22')]();};}function saveUpdates(_0x33b588,_0x105874){return function(_0x301f6d){if(_0x301f6d){return _0x301f6d[_0xa19e('0x23')](_0x33b588)[_0xa19e('0x24')](function(_0x2a416e){return _0x2a416e;});}return null;};}function removeEntity(_0x20a649,_0xc16a44){return function(_0x536386){if(_0x536386){return _0x536386[_0xa19e('0x25')]()[_0xa19e('0x24')](function(){_0x20a649['status'](0xcc)[_0xa19e('0x19')]();});}};}function handleEntityNotFound(_0x1d3ce6,_0x4e06b8){return function(_0x20b05c){if(!_0x20b05c){_0x1d3ce6[_0xa19e('0x26')](0x194);}return _0x20b05c;};}function handleError(_0x5d5559,_0x40dc1c){_0x40dc1c=_0x40dc1c||0x1f4;return function(_0x10682d){logger[_0xa19e('0x27')](_0x10682d[_0xa19e('0x28')]);if(_0x10682d[_0xa19e('0x29')]){delete _0x10682d[_0xa19e('0x29')];}_0x5d5559[_0xa19e('0x18')](_0x40dc1c)[_0xa19e('0x2a')](_0x10682d);};}exports[_0xa19e('0x2b')]=function(_0x24dd51,_0x30e490){var _0x3d1cae={},_0x1ce643={},_0x475a26={'count':0x0,'rows':[]};var _0xdf0b20=_[_0xa19e('0x2c')](db[_0xa19e('0x2d')][_0xa19e('0x2e')],function(_0x3dcd74){return{'name':_0x3dcd74[_0xa19e('0x2f')],'type':_0x3dcd74['type'][_0xa19e('0x30')]};});_0x1ce643[_0xa19e('0x31')]=_[_0xa19e('0x2c')](_0xdf0b20,_0xa19e('0x29'));_0x1ce643[_0xa19e('0x32')]=_[_0xa19e('0x33')](_0x24dd51['query']);_0x1ce643[_0xa19e('0x34')]=_[_0xa19e('0x35')](_0x1ce643['model'],_0x1ce643[_0xa19e('0x32')]);_0x3d1cae['attributes']=_['intersection'](_0x1ce643[_0xa19e('0x31')],qs['fields'](_0x24dd51['query']['fields']));_0x3d1cae[_0xa19e('0x36')]=_0x3d1cae[_0xa19e('0x36')][_0xa19e('0x37')]?_0x3d1cae['attributes']:_0x1ce643[_0xa19e('0x31')];if(!_0x24dd51[_0xa19e('0x32')][_0xa19e('0x38')](_0xa19e('0x39'))){_0x3d1cae[_0xa19e('0x1c')]=qs[_0xa19e('0x1c')](_0x24dd51['query'][_0xa19e('0x1c')]);_0x3d1cae[_0xa19e('0x1e')]=qs['offset'](_0x24dd51[_0xa19e('0x32')][_0xa19e('0x1e')]);}_0x3d1cae[_0xa19e('0x3a')]=qs['sort'](_0x24dd51['query'][_0xa19e('0x3b')]);_0x3d1cae['where']=qs[_0xa19e('0x34')](_[_0xa19e('0x3c')](_0x24dd51[_0xa19e('0x32')],_0x1ce643[_0xa19e('0x34')]),_0xdf0b20);if(_0x24dd51['query'][_0xa19e('0x3d')]){_0x3d1cae[_0xa19e('0x3e')]=_['merge'](_0x3d1cae[_0xa19e('0x3e')],{'$or':_['map'](_0xdf0b20,function(_0x374201){if(_0x374201[_0xa19e('0x3f')]!==_0xa19e('0x40')){var _0x5ed1ce={};_0x5ed1ce[_0x374201[_0xa19e('0x29')]]={'$like':'%'+_0x24dd51[_0xa19e('0x32')][_0xa19e('0x3d')]+'%'};return _0x5ed1ce;}})});}_0x3d1cae=_['merge']({},_0x3d1cae,_0x24dd51[_0xa19e('0x41')]);var _0x244ee5={'where':_0x3d1cae['where']};return db['FreshdeskField'][_0xa19e('0x1d')](_0x244ee5)[_0xa19e('0x24')](function(_0x5dd159){_0x475a26[_0xa19e('0x1d')]=_0x5dd159;if(_0x24dd51[_0xa19e('0x32')]['includeAll']){_0x3d1cae[_0xa19e('0x42')]=[{'all':!![]}];}return db[_0xa19e('0x2d')][_0xa19e('0x43')](_0x3d1cae);})[_0xa19e('0x24')](function(_0x30fdfb){_0x475a26['rows']=_0x30fdfb;return _0x475a26;})[_0xa19e('0x24')](respondWithFilteredResult(_0x30e490,_0x3d1cae))[_0xa19e('0x44')](handleError(_0x30e490,null));};exports[_0xa19e('0x45')]=function(_0x29d254,_0x124e8c){var _0x51f0f4={'raw':!![],'where':{'id':_0x29d254['params']['id']}},_0x315341={};_0x315341[_0xa19e('0x31')]=_[_0xa19e('0x33')](db['FreshdeskField'][_0xa19e('0x2e')]);_0x315341[_0xa19e('0x32')]=_['keys'](_0x29d254[_0xa19e('0x32')]);_0x315341['filters']=_[_0xa19e('0x35')](_0x315341[_0xa19e('0x31')],_0x315341[_0xa19e('0x32')]);_0x51f0f4[_0xa19e('0x36')]=_[_0xa19e('0x35')](_0x315341[_0xa19e('0x31')],qs[_0xa19e('0x46')](_0x29d254[_0xa19e('0x32')]['fields']));_0x51f0f4[_0xa19e('0x36')]=_0x51f0f4[_0xa19e('0x36')]['length']?_0x51f0f4['attributes']:_0x315341[_0xa19e('0x31')];if(_0x29d254[_0xa19e('0x32')][_0xa19e('0x47')]){_0x51f0f4['include']=[{'all':!![]}];}_0x51f0f4=_[_0xa19e('0x48')]({},_0x51f0f4,_0x29d254[_0xa19e('0x41')]);return db['FreshdeskField'][_0xa19e('0x49')](_0x51f0f4)[_0xa19e('0x24')](handleEntityNotFound(_0x124e8c,null))[_0xa19e('0x24')](respondWithResult(_0x124e8c,null))['catch'](handleError(_0x124e8c,null));};exports[_0xa19e('0x4a')]=function(_0x52cf31,_0x349543){return db[_0xa19e('0x2d')][_0xa19e('0x4a')](_0x52cf31[_0xa19e('0x4b')],{})[_0xa19e('0x24')](respondWithResult(_0x349543,0xc9))['catch'](handleError(_0x349543,null));};exports[_0xa19e('0x23')]=function(_0x4c90fe,_0x4779d8){if(_0x4c90fe['body']['id']){delete _0x4c90fe[_0xa19e('0x4b')]['id'];}return db[_0xa19e('0x2d')][_0xa19e('0x49')]({'where':{'id':_0x4c90fe[_0xa19e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4779d8,null))[_0xa19e('0x24')](saveUpdates(_0x4c90fe[_0xa19e('0x4b')],null))[_0xa19e('0x24')](respondWithResult(_0x4779d8,null))[_0xa19e('0x44')](handleError(_0x4779d8,null));};exports['destroy']=function(_0x454c9f,_0x5ae431){return db[_0xa19e('0x2d')][_0xa19e('0x49')]({'where':{'id':_0x454c9f[_0xa19e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5ae431,null))[_0xa19e('0x24')](removeEntity(_0x5ae431,null))[_0xa19e('0x44')](handleError(_0x5ae431,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 10e0553..905d313 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 _0x30dc=['../../config/environment','./intFreshdeskField.attributes','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','../../config/logger','api','moment','path','rimraf'];(function(_0x3cf5c7,_0x1eb319){var _0xf3d981=function(_0x3521ef){while(--_0x3521ef){_0x3cf5c7['push'](_0x3cf5c7['shift']());}};_0xf3d981(++_0x1eb319);}(_0x30dc,0x14a));var _0xc30d=function(_0x556477,_0x1b7214){_0x556477=_0x556477-0x0;var _0x552276=_0x30dc[_0x556477];return _0x552276;};'use strict';var _=require(_0xc30d('0x0'));var util=require('util');var logger=require(_0xc30d('0x1'))(_0xc30d('0x2'));var moment=require(_0xc30d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc30d('0x4'));var rimraf=require(_0xc30d('0x5'));var config=require(_0xc30d('0x6'));var attributes=require(_0xc30d('0x7'));module['exports']=function(_0x5a7c88,_0x5382d4){return _0x5a7c88['define'](_0xc30d('0x8'),attributes,{'tableName':_0xc30d('0x9'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xc30d('0xa'),_0xc30d('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x015a=['idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index'];(function(_0x5a77fb,_0x2d2d59){var _0x6ca4fb=function(_0x428777){while(--_0x428777){_0x5a77fb['push'](_0x5a77fb['shift']());}};_0x6ca4fb(++_0x2d2d59);}(_0x015a,0xf2));var _0xa015=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x015a[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0xa015('0x0'));var util=require('util');var logger=require(_0xa015('0x1'))(_0xa015('0x2'));var moment=require(_0xa015('0x3'));var BPromise=require(_0xa015('0x4'));var rp=require(_0xa015('0x5'));var fs=require('fs');var path=require(_0xa015('0x6'));var rimraf=require(_0xa015('0x7'));var config=require(_0xa015('0x8'));var attributes=require('./intFreshdeskField.attributes');module[_0xa015('0x9')]=function(_0x5466d7,_0x1985b6){return _0x5466d7[_0xa015('0xa')](_0xa015('0xb'),attributes,{'tableName':_0xa015('0xc'),'paranoid':![],'indexes':[{'name':_0xa015('0xd'),'fields':[_0xa015('0xe'),_0xa015('0xf')],'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 b58c949..3e3a20a 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 _0xfeea=['request','then','info','request\x20sent','debug','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0xfeea,0x174));var _0xafee=function(_0x328ac9,_0x2f7225){_0x328ac9=_0x328ac9-0x0;var _0x2b3a0a=_0xfeea[_0x328ac9];return _0x2b3a0a;};'use strict';var _=require('lodash');var util=require(_0xafee('0x0'));var moment=require(_0xafee('0x1'));var BPromise=require(_0xafee('0x2'));var rs=require(_0xafee('0x3'));var fs=require('fs');var Redis=require(_0xafee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xafee('0x5'));var logger=require(_0xafee('0x6'))(_0xafee('0x7'));var config=require(_0xafee('0x8'));var jayson=require(_0xafee('0x9'));var client=jayson[_0xafee('0xa')][_0xafee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54d539,_0x4f80ca,_0x54db4d){return new BPromise(function(_0x434fdb,_0x23a05d){return client[_0xafee('0xc')](_0x54d539,_0x54db4d)[_0xafee('0xd')](function(_0x269962){logger[_0xafee('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x4f80ca,_0xafee('0xf'));logger[_0xafee('0x10')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x4f80ca,'request\x20sent',JSON[_0xafee('0x11')](_0x269962));if(_0x269962[_0xafee('0x12')]){if(_0x269962[_0xafee('0x12')][_0xafee('0x13')]===0x1f4){logger[_0xafee('0x12')](_0xafee('0x14'),_0x4f80ca,_0x269962['error'][_0xafee('0x15')]);return _0x23a05d(_0x269962[_0xafee('0x12')][_0xafee('0x15')]);}logger[_0xafee('0x12')](_0xafee('0x14'),_0x4f80ca,_0x269962[_0xafee('0x12')][_0xafee('0x15')]);return _0x434fdb(_0x269962['error'][_0xafee('0x15')]);}else{logger['info'](_0xafee('0x14'),_0x4f80ca,'request\x20sent');_0x434fdb(_0x269962[_0xafee('0x16')][_0xafee('0x15')]);}})[_0xafee('0x17')](function(_0x5f25dd){logger[_0xafee('0x12')](_0xafee('0x14'),_0x4f80ca,_0x5f25dd);_0x23a05d(_0x5f25dd);});});} \ No newline at end of file +var _0x5992=['request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','lodash','util','moment','../../config/utils','../../config/logger','jayson/promise','client','request','then','FreshdeskField,\x20%s,\x20%s'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x5992,0x6d));var _0x2599=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x5992[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x2599('0x0'));var util=require(_0x2599('0x1'));var moment=require(_0x2599('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(_0x2599('0x3'));var logger=require(_0x2599('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2599('0x5'));var client=jayson[_0x2599('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22e2a5,_0x100fe0,_0x322648){return new BPromise(function(_0x229c2e,_0x35fd60){return client[_0x2599('0x7')](_0x22e2a5,_0x322648)[_0x2599('0x8')](function(_0x30e02d){logger['info'](_0x2599('0x9'),_0x100fe0,_0x2599('0xa'));logger[_0x2599('0xb')](_0x2599('0xc'),_0x100fe0,_0x2599('0xa'),JSON[_0x2599('0xd')](_0x30e02d));if(_0x30e02d[_0x2599('0xe')]){if(_0x30e02d[_0x2599('0xe')]['code']===0x1f4){logger['error'](_0x2599('0x9'),_0x100fe0,_0x30e02d['error'][_0x2599('0xf')]);return _0x35fd60(_0x30e02d[_0x2599('0xe')][_0x2599('0xf')]);}logger[_0x2599('0xe')](_0x2599('0x9'),_0x100fe0,_0x30e02d[_0x2599('0xe')][_0x2599('0xf')]);return _0x229c2e(_0x30e02d[_0x2599('0xe')][_0x2599('0xf')]);}else{logger[_0x2599('0x10')](_0x2599('0x9'),_0x100fe0,_0x2599('0xa'));_0x229c2e(_0x30e02d['result']['message']);}})['catch'](function(_0x4b66fe){logger[_0x2599('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x100fe0,_0x4b66fe);_0x35fd60(_0x4b66fe);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 8b29b17..914eeca 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 _0xe706=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated'];(function(_0x51c234,_0x49c2ce){var _0x2a2b4f=function(_0xfb8faa){while(--_0xfb8faa){_0x51c234['push'](_0x51c234['shift']());}};_0x2a2b4f(++_0x49c2ce);}(_0xe706,0xa3));var _0x6e70=function(_0x555552,_0x576279){_0x555552=_0x555552-0x0;var _0x5b280d=_0xe706[_0x555552];return _0x5b280d;};'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('0xa')](_0x6e70('0x11'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')]('/',auth[_0x6e70('0xb')](),controller['create']);router['post'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x18')]=router; \ No newline at end of file +var _0x0102=['getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','destroy','exports','util','path','connect-timeout','express','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0x0102,0x186));var _0x2010=function(_0x59c4fb,_0x784132){_0x59c4fb=_0x59c4fb-0x0;var _0x3ecace=_0x0102[_0x59c4fb];return _0x3ecace;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require(_0x2010('0x1'));var timeout=require(_0x2010('0x2'));var express=require(_0x2010('0x3'));var router=express['Router']();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(_0x2010('0x4'));router[_0x2010('0x5')]('/',auth[_0x2010('0x6')](),controller[_0x2010('0x7')]);router['get'](_0x2010('0x8'),auth['isAuthenticated'](),controller[_0x2010('0x9')]);router[_0x2010('0x5')]('/:id/configurations',auth[_0x2010('0x6')](),controller[_0x2010('0xa')]);router[_0x2010('0x5')](_0x2010('0xb'),auth[_0x2010('0x6')](),controller[_0x2010('0xc')]);router[_0x2010('0xd')]('/',auth[_0x2010('0x6')](),controller[_0x2010('0xe')]);router[_0x2010('0xd')](_0x2010('0xf'),auth[_0x2010('0x6')](),controller[_0x2010('0x10')]);router[_0x2010('0x11')](_0x2010('0x8'),auth[_0x2010('0x6')](),controller['update']);router['delete'](_0x2010('0x8'),auth[_0x2010('0x6')](),controller[_0x2010('0x12')]);module[_0x2010('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 5f56199..28e659a 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 _0xd117=['remoteUri','sequelize','exports','STRING','username'];(function(_0x494abe,_0x1d0a84){var _0x488798=function(_0xb42303){while(--_0xb42303){_0x494abe['push'](_0x494abe['shift']());}};_0x488798(++_0x1d0a84);}(_0xd117,0x182));var _0x7d11=function(_0x5933fb,_0x9115ad){_0x5933fb=_0x5933fb-0x0;var _0x44d988=_0xd117[_0x5933fb];return _0x44d988;};'use strict';var Sequelize=require(_0x7d11('0x0'));module[_0x7d11('0x1')]={'name':{'type':Sequelize[_0x7d11('0x2')]},'description':{'type':Sequelize[_0x7d11('0x2')]},'username':{'type':Sequelize[_0x7d11('0x2')],'unique':_0x7d11('0x3')},'apiKey':{'type':Sequelize[_0x7d11('0x2')]},'remoteUri':{'type':Sequelize[_0x7d11('0x2')],'unique':_0x7d11('0x4')},'serverUrl':{'type':Sequelize[_0x7d11('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xcf2f=['exports','STRING','remoteUri','sequelize'];(function(_0x438ce4,_0x2476cc){var _0x8be9be=function(_0x327b34){while(--_0x327b34){_0x438ce4['push'](_0x438ce4['shift']());}};_0x8be9be(++_0x2476cc);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x72b58b,_0x1f2f2c){_0x72b58b=_0x72b58b-0x0;var _0x34aad5=_0xcf2f[_0x72b58b];return _0x34aad5;};'use strict';var Sequelize=require(_0xfcf2('0x0'));module[_0xfcf2('0x1')]={'name':{'type':Sequelize[_0xfcf2('0x2')]},'description':{'type':Sequelize[_0xfcf2('0x2')]},'username':{'type':Sequelize[_0xfcf2('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfcf2('0x2')]},'remoteUri':{'type':Sequelize[_0xfcf2('0x2')],'unique':_0xfcf2('0x3')},'serverUrl':{'type':Sequelize[_0xfcf2('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 18519a4..065e7bc 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 _0xb8b1=['options','includeAll','include','rows','catch','show','params','length','find','create','body','FreshsalesConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','GET','%s%s','users','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb8b1,0xee));var _0x1b8b=function(_0x465c3b,_0x384cf1){_0x465c3b=_0x465c3b-0x0;var _0x67f5d8=_0xb8b1[_0x465c3b];return _0x67f5d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b8b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b8b('0x1'));var rp=require(_0x1b8b('0x2'));var moment=require(_0x1b8b('0x3'));var BPromise=require(_0x1b8b('0x4'));var Mustache=require('mustache');var util=require(_0x1b8b('0x5'));var path=require(_0x1b8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1b8b('0x7'));var fs=require('fs');var fs_extra=require(_0x1b8b('0x8'));var _=require(_0x1b8b('0x9'));var squel=require('squel');var crypto=require(_0x1b8b('0xa'));var jsforce=require(_0x1b8b('0xb'));var deskjs=require(_0x1b8b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1b8b('0xd'));var Papa=require(_0x1b8b('0xe'));var Redis=require(_0x1b8b('0xf'));var authService=require(_0x1b8b('0x10'));var qs=require(_0x1b8b('0x11'));var as=require(_0x1b8b('0x12'));var hardwareService=require(_0x1b8b('0x13'));var logger=require('../../config/logger')(_0x1b8b('0x14'));var utils=require(_0x1b8b('0x15'));var config=require(_0x1b8b('0x16'));var licenseUtil=require(_0x1b8b('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x1b8b('0x18'));function respondWithStatusCode(_0x4c6012,_0x3c545d){_0x3c545d=_0x3c545d||0xcc;return function(_0x1260e9){if(_0x1260e9){return _0x4c6012[_0x1b8b('0x19')](_0x3c545d);}return _0x4c6012[_0x1b8b('0x1a')](_0x3c545d)[_0x1b8b('0x1b')]();};}function respondWithResult(_0x397bc5,_0x1f6a37){_0x1f6a37=_0x1f6a37||0xc8;return function(_0xe5298a){if(_0xe5298a){return _0x397bc5['status'](_0x1f6a37)[_0x1b8b('0x1c')](_0xe5298a);}};}function respondWithFilteredResult(_0x367848,_0x28ad85){return function(_0x155509){if(_0x155509){var _0x56a44f=typeof _0x28ad85['offset']===_0x1b8b('0x1d')&&typeof _0x28ad85['limit']==='undefined';var _0x551236=_0x155509[_0x1b8b('0x1e')];var _0x2a350c=_0x56a44f?0x0:_0x28ad85[_0x1b8b('0x1f')];var _0x962455=_0x56a44f?_0x155509[_0x1b8b('0x1e')]:_0x28ad85['offset']+_0x28ad85[_0x1b8b('0x20')];var _0x192cba;if(_0x962455>=_0x551236){_0x962455=_0x551236;_0x192cba=0xc8;}else{_0x192cba=0xce;}_0x367848[_0x1b8b('0x1a')](_0x192cba);return _0x367848[_0x1b8b('0x21')](_0x1b8b('0x22'),_0x2a350c+'-'+_0x962455+'/'+_0x551236)[_0x1b8b('0x1c')](_0x155509);}return null;};}function patchUpdates(_0x4f1476){return function(_0x257572){try{jsonpatch[_0x1b8b('0x23')](_0x257572,_0x4f1476,!![]);}catch(_0x1f63b5){return BPromise['reject'](_0x1f63b5);}return _0x257572[_0x1b8b('0x24')]();};}function saveUpdates(_0x221963,_0x43a905){return function(_0x3430e8){if(_0x3430e8){return _0x3430e8[_0x1b8b('0x25')](_0x221963)[_0x1b8b('0x26')](function(_0xc58320){return _0xc58320;});}return null;};}function removeEntity(_0x45d987,_0x21a994){return function(_0x75dd01){if(_0x75dd01){return _0x75dd01[_0x1b8b('0x27')]()[_0x1b8b('0x26')](function(){_0x45d987['status'](0xcc)[_0x1b8b('0x1b')]();});}};}function handleEntityNotFound(_0x190a1f,_0x467d15){return function(_0x1ca47c){if(!_0x1ca47c){_0x190a1f[_0x1b8b('0x19')](0x194);}return _0x1ca47c;};}function handleError(_0x137d4f,_0x245970){_0x245970=_0x245970||0x1f4;return function(_0x3072a2){logger['error'](_0x3072a2[_0x1b8b('0x28')]);if(_0x3072a2['name']){delete _0x3072a2[_0x1b8b('0x29')];}_0x137d4f[_0x1b8b('0x1a')](_0x245970)['send'](_0x3072a2);};}exports[_0x1b8b('0x2a')]=function(_0x1fb0d8,_0x28d5bf){var _0x3df117={},_0x1437d9={},_0x35851c={'count':0x0,'rows':[]};var _0x46c1f3=_[_0x1b8b('0x2b')](db[_0x1b8b('0x2c')][_0x1b8b('0x2d')],function(_0xe83171){return{'name':_0xe83171[_0x1b8b('0x2e')],'type':_0xe83171[_0x1b8b('0x2f')][_0x1b8b('0x30')]};});_0x1437d9[_0x1b8b('0x31')]=_[_0x1b8b('0x2b')](_0x46c1f3,_0x1b8b('0x29'));_0x1437d9[_0x1b8b('0x32')]=_[_0x1b8b('0x33')](_0x1fb0d8['query']);_0x1437d9['filters']=_[_0x1b8b('0x34')](_0x1437d9[_0x1b8b('0x31')],_0x1437d9[_0x1b8b('0x32')]);_0x3df117[_0x1b8b('0x35')]=_[_0x1b8b('0x34')](_0x1437d9[_0x1b8b('0x31')],qs['fields'](_0x1fb0d8[_0x1b8b('0x32')][_0x1b8b('0x36')]));_0x3df117['attributes']=_0x3df117[_0x1b8b('0x35')]['length']?_0x3df117[_0x1b8b('0x35')]:_0x1437d9[_0x1b8b('0x31')];if(!_0x1fb0d8[_0x1b8b('0x32')][_0x1b8b('0x37')](_0x1b8b('0x38'))){_0x3df117[_0x1b8b('0x20')]=qs[_0x1b8b('0x20')](_0x1fb0d8['query'][_0x1b8b('0x20')]);_0x3df117['offset']=qs[_0x1b8b('0x1f')](_0x1fb0d8[_0x1b8b('0x32')][_0x1b8b('0x1f')]);}_0x3df117[_0x1b8b('0x39')]=qs[_0x1b8b('0x3a')](_0x1fb0d8[_0x1b8b('0x32')][_0x1b8b('0x3a')]);_0x3df117[_0x1b8b('0x3b')]=qs[_0x1b8b('0x3c')](_[_0x1b8b('0x3d')](_0x1fb0d8[_0x1b8b('0x32')],_0x1437d9[_0x1b8b('0x3c')]),_0x46c1f3);if(_0x1fb0d8[_0x1b8b('0x32')]['filter']){_0x3df117['where']=_[_0x1b8b('0x3e')](_0x3df117[_0x1b8b('0x3b')],{'$or':_['map'](_0x46c1f3,function(_0x519f4f){if(_0x519f4f[_0x1b8b('0x2f')]!==_0x1b8b('0x3f')){var _0x2b2188={};_0x2b2188[_0x519f4f[_0x1b8b('0x29')]]={'$like':'%'+_0x1fb0d8['query'][_0x1b8b('0x40')]+'%'};return _0x2b2188;}})});}_0x3df117=_[_0x1b8b('0x3e')]({},_0x3df117,_0x1fb0d8[_0x1b8b('0x41')]);var _0x1470e5={'where':_0x3df117['where']};return db[_0x1b8b('0x2c')][_0x1b8b('0x1e')](_0x1470e5)['then'](function(_0x4b24c1){_0x35851c[_0x1b8b('0x1e')]=_0x4b24c1;if(_0x1fb0d8[_0x1b8b('0x32')][_0x1b8b('0x42')]){_0x3df117[_0x1b8b('0x43')]=[{'all':!![]}];}return db[_0x1b8b('0x2c')]['findAll'](_0x3df117);})[_0x1b8b('0x26')](function(_0x372769){_0x35851c[_0x1b8b('0x44')]=_0x372769;return _0x35851c;})[_0x1b8b('0x26')](respondWithFilteredResult(_0x28d5bf,_0x3df117))[_0x1b8b('0x45')](handleError(_0x28d5bf,null));};exports[_0x1b8b('0x46')]=function(_0x476565,_0x2b628d){var _0x35f0e1={'raw':![],'where':{'id':_0x476565[_0x1b8b('0x47')]['id']}},_0x18363a={};_0x18363a[_0x1b8b('0x31')]=_[_0x1b8b('0x33')](db['FreshsalesAccount']['rawAttributes']);_0x18363a[_0x1b8b('0x32')]=_[_0x1b8b('0x33')](_0x476565[_0x1b8b('0x32')]);_0x18363a[_0x1b8b('0x3c')]=_[_0x1b8b('0x34')](_0x18363a[_0x1b8b('0x31')],_0x18363a['query']);_0x35f0e1[_0x1b8b('0x35')]=_['intersection'](_0x18363a['model'],qs['fields'](_0x476565[_0x1b8b('0x32')][_0x1b8b('0x36')]));_0x35f0e1[_0x1b8b('0x35')]=_0x35f0e1['attributes'][_0x1b8b('0x48')]?_0x35f0e1['attributes']:_0x18363a['model'];if(_0x476565[_0x1b8b('0x32')][_0x1b8b('0x42')]){_0x35f0e1[_0x1b8b('0x43')]=[{'all':!![]}];}_0x35f0e1=_[_0x1b8b('0x3e')]({},_0x35f0e1,_0x476565[_0x1b8b('0x41')]);return db['FreshsalesAccount'][_0x1b8b('0x49')](_0x35f0e1)[_0x1b8b('0x26')](handleEntityNotFound(_0x2b628d,null))['then'](respondWithResult(_0x2b628d,null))[_0x1b8b('0x45')](handleError(_0x2b628d,null));};exports[_0x1b8b('0x4a')]=function(_0x12bfa5,_0x34cc89){return db[_0x1b8b('0x2c')]['create'](_0x12bfa5[_0x1b8b('0x4b')],{})[_0x1b8b('0x26')](respondWithResult(_0x34cc89,0xc9))[_0x1b8b('0x45')](handleError(_0x34cc89,null));};exports['update']=function(_0x59b78b,_0x3f97e0){if(_0x59b78b[_0x1b8b('0x4b')]['id']){delete _0x59b78b[_0x1b8b('0x4b')]['id'];}return db[_0x1b8b('0x2c')][_0x1b8b('0x49')]({'where':{'id':_0x59b78b[_0x1b8b('0x47')]['id']}})['then'](handleEntityNotFound(_0x3f97e0,null))[_0x1b8b('0x26')](saveUpdates(_0x59b78b[_0x1b8b('0x4b')],null))[_0x1b8b('0x26')](respondWithResult(_0x3f97e0,null))[_0x1b8b('0x45')](handleError(_0x3f97e0,null));};exports[_0x1b8b('0x27')]=function(_0x5e32f2,_0x4c4750){return db[_0x1b8b('0x2c')][_0x1b8b('0x49')]({'where':{'id':_0x5e32f2[_0x1b8b('0x47')]['id']}})[_0x1b8b('0x26')](handleEntityNotFound(_0x4c4750,null))[_0x1b8b('0x26')](removeEntity(_0x4c4750,null))[_0x1b8b('0x45')](handleError(_0x4c4750,null));};exports['getConfigurations']=function(_0x1ba60d,_0x37fd6d,_0x4c3dc3){var _0x43620b={};var _0x10993b={};var _0x5fbbf1;var _0x4b48db;return db[_0x1b8b('0x2c')]['findOne']({'where':{'id':_0x1ba60d['params']['id']}})[_0x1b8b('0x26')](handleEntityNotFound(_0x37fd6d,null))[_0x1b8b('0x26')](function(_0x4df9a4){if(_0x4df9a4){_0x5fbbf1=_0x4df9a4;_0x10993b[_0x1b8b('0x31')]=_[_0x1b8b('0x33')](db[_0x1b8b('0x4c')][_0x1b8b('0x2d')]);_0x10993b[_0x1b8b('0x32')]=_['keys'](_0x1ba60d['query']);_0x10993b[_0x1b8b('0x3c')]=_['intersection'](_0x10993b['model'],_0x10993b[_0x1b8b('0x32')]);_0x43620b[_0x1b8b('0x35')]=_['intersection'](_0x10993b[_0x1b8b('0x31')],qs[_0x1b8b('0x36')](_0x1ba60d[_0x1b8b('0x32')][_0x1b8b('0x36')]));_0x43620b[_0x1b8b('0x35')]=_0x43620b[_0x1b8b('0x35')][_0x1b8b('0x48')]?_0x43620b[_0x1b8b('0x35')]:_0x10993b[_0x1b8b('0x31')];_0x43620b[_0x1b8b('0x39')]=qs[_0x1b8b('0x3a')](_0x1ba60d['query'][_0x1b8b('0x3a')]);_0x43620b['where']=qs['filters'](_[_0x1b8b('0x3d')](_0x1ba60d[_0x1b8b('0x32')],_0x10993b[_0x1b8b('0x3c')]));if(_0x1ba60d[_0x1b8b('0x32')][_0x1b8b('0x40')]){_0x43620b[_0x1b8b('0x3b')]=_['merge'](_0x43620b['where'],{'$or':_[_0x1b8b('0x2b')](_0x43620b[_0x1b8b('0x35')],function(_0x49528f){var _0x2666f7={};_0x2666f7[_0x49528f]={'$like':'%'+_0x1ba60d[_0x1b8b('0x32')]['filter']+'%'};return _0x2666f7;})});}_0x43620b=_['merge']({},_0x43620b,_0x1ba60d[_0x1b8b('0x41')]);return _0x5fbbf1[_0x1b8b('0x4d')](_0x43620b);}})[_0x1b8b('0x26')](function(_0x28549c){if(_0x28549c){_0x4b48db=_0x28549c[_0x1b8b('0x48')];if(!_0x1ba60d[_0x1b8b('0x32')]['hasOwnProperty'](_0x1b8b('0x38'))){_0x43620b[_0x1b8b('0x20')]=qs[_0x1b8b('0x20')](_0x1ba60d['query'][_0x1b8b('0x20')]);_0x43620b[_0x1b8b('0x1f')]=qs[_0x1b8b('0x1f')](_0x1ba60d[_0x1b8b('0x32')][_0x1b8b('0x1f')]);}return _0x5fbbf1[_0x1b8b('0x4d')](_0x43620b);}})[_0x1b8b('0x26')](function(_0x18c2f8){if(_0x18c2f8){return _0x18c2f8?{'count':_0x4b48db,'rows':_0x18c2f8}:null;}})[_0x1b8b('0x26')](respondWithResult(_0x37fd6d,null))[_0x1b8b('0x45')](handleError(_0x37fd6d,null));};exports[_0x1b8b('0x4e')]=function(_0x592c0e,_0x2c4650,_0x175b99){if(_0x592c0e['body']['id']){delete _0x592c0e[_0x1b8b('0x4b')]['id'];}return db[_0x1b8b('0x2c')]['findOne']({'where':{'id':_0x592c0e[_0x1b8b('0x47')]['id']}})[_0x1b8b('0x26')](handleEntityNotFound(_0x2c4650,null))[_0x1b8b('0x26')](function(_0x3b7dc1){if(_0x3b7dc1){_0x592c0e[_0x1b8b('0x4b')][_0x1b8b('0x4f')]=_0x3b7dc1['id'];_0x592c0e[_0x1b8b('0x4b')][_0x1b8b('0x50')]=integrations[_0x1b8b('0x51')](_0x592c0e[_0x1b8b('0x4b')][_0x1b8b('0x52')],_0x592c0e['body'][_0x1b8b('0x2f')]);_0x592c0e[_0x1b8b('0x4b')][_0x1b8b('0x53')]=integrations['getDescriptions'](_0x592c0e['body'][_0x1b8b('0x52')],_0x592c0e['body'][_0x1b8b('0x2f')]);return db['FreshsalesConfiguration']['create'](_0x592c0e[_0x1b8b('0x4b')],{'include':[{'model':db[_0x1b8b('0x54')],'as':_0x1b8b('0x50')},{'model':db['FreshsalesField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x2c4650,null))['catch'](handleError(_0x2c4650,null));};exports[_0x1b8b('0x55')]=function(_0x4abf3a,_0x408026,_0x53d685){var _0x18261e='';var _0x2a8e92='';return db[_0x1b8b('0x2c')]['findOne']({'where':{'id':_0x4abf3a[_0x1b8b('0x47')]['id']},'attributes':['id',_0x1b8b('0x56'),_0x1b8b('0x57'),_0x1b8b('0x58')]})[_0x1b8b('0x26')](handleEntityNotFound(_0x408026,null))[_0x1b8b('0x26')](function(_0x587bd2){if(_0x587bd2){_0x2a8e92=_0x587bd2[_0x1b8b('0x56')];_0x18261e=_0x587bd2[_0x1b8b('0x57')];var _0x81257=_0x587bd2[_0x1b8b('0x57')][_0x1b8b('0x59')](-0x1);if(_0x81257==='/'){_0x18261e=_0x18261e[_0x1b8b('0x5a')](0x0,_0x18261e['lastIndexOf'](_0x81257));}return rp({'method':_0x1b8b('0x5b'),'uri':util['format'](_0x1b8b('0x5c'),_0x18261e,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x587bd2[_0x1b8b('0x58')]},'json':!![]});}})[_0x1b8b('0x26')](function(_0x2c6e51){if(_0x2c6e51){var _0x5757cd=_0x2c6e51[_0x1b8b('0x5d')];var _0x1b6c00=![];var _0x16b407=null;for(_0x16b407=0x0;_0x16b407<_0x5757cd[_0x1b8b('0x48')];_0x16b407++){if(_0x5757cd[_0x16b407]['email']===_0x2a8e92){_0x1b6c00=!![];}}if(_0x1b6c00){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1b8b('0x5e')});}}})[_0x1b8b('0x26')](respondWithResult(_0x408026,null))[_0x1b8b('0x45')](function(_0x117548){var _0x1b782b=_0x4abf3a[_0x1b8b('0x32')][_0x1b8b('0x5f')]?0x1f4:_0x117548[_0x1b8b('0x60')]||0x1f4;logger[_0x1b8b('0x61')](_0x1b8b('0x62'),_0x1b8b('0x55'),_0x1b782b,JSON['stringify'](_0x117548));delete _0x117548[_0x1b8b('0x29')];if(_0x1b782b===0x191){_0x1b782b=0x190;}_0x408026['status'](_0x1b782b)[_0x1b8b('0x63')](_0x4abf3a[_0x1b8b('0x32')][_0x1b8b('0x5f')]?{'message':_0x1b8b('0x64'),'statusCode':_0x117548[_0x1b8b('0x60')]}:_0x117548);});}; \ No newline at end of file +var _0xa5f7=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','model','keys','query','intersection','fields','attributes','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','FreshsalesConfiguration','length','getConfigurations','hasOwnProperty','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','lastIndexOf','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','squel'];(function(_0x2a215f,_0xa27cec){var _0x541220=function(_0x39d689){while(--_0x39d689){_0x2a215f['push'](_0x2a215f['shift']());}};_0x541220(++_0xa27cec);}(_0xa5f7,0x18b));var _0x7a5f=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0xa5f7[_0x51fe5f];return _0x4abce9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7a5f('0x0'));var jsonpatch=require(_0x7a5f('0x1'));var rp=require(_0x7a5f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7a5f('0x3'));var util=require(_0x7a5f('0x4'));var path=require(_0x7a5f('0x5'));var sox=require(_0x7a5f('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a5f('0x7'));var _=require('lodash');var squel=require(_0x7a5f('0x8'));var crypto=require('crypto');var jsforce=require(_0x7a5f('0x9'));var deskjs=require(_0x7a5f('0xa'));var toCsv=require(_0x7a5f('0xb'));var querystring=require(_0x7a5f('0xc'));var Papa=require(_0x7a5f('0xd'));var Redis=require(_0x7a5f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7a5f('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a5f('0x10'));var logger=require('../../config/logger')(_0x7a5f('0x11'));var utils=require(_0x7a5f('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x7a5f('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7a5f('0x14'));function respondWithStatusCode(_0x18b965,_0x565ce9){_0x565ce9=_0x565ce9||0xcc;return function(_0x38fa49){if(_0x38fa49){return _0x18b965[_0x7a5f('0x15')](_0x565ce9);}return _0x18b965[_0x7a5f('0x16')](_0x565ce9)[_0x7a5f('0x17')]();};}function respondWithResult(_0x24cc01,_0x9eea42){_0x9eea42=_0x9eea42||0xc8;return function(_0xdb648a){if(_0xdb648a){return _0x24cc01[_0x7a5f('0x16')](_0x9eea42)[_0x7a5f('0x18')](_0xdb648a);}};}function respondWithFilteredResult(_0x4a20c2,_0x34ff8b){return function(_0x2c84dd){if(_0x2c84dd){var _0x2f25ea=typeof _0x34ff8b[_0x7a5f('0x19')]===_0x7a5f('0x1a')&&typeof _0x34ff8b[_0x7a5f('0x1b')]===_0x7a5f('0x1a');var _0x10368b=_0x2c84dd[_0x7a5f('0x1c')];var _0x553dbd=_0x2f25ea?0x0:_0x34ff8b[_0x7a5f('0x19')];var _0x25da11=_0x2f25ea?_0x2c84dd[_0x7a5f('0x1c')]:_0x34ff8b[_0x7a5f('0x19')]+_0x34ff8b[_0x7a5f('0x1b')];var _0x1e8203;if(_0x25da11>=_0x10368b){_0x25da11=_0x10368b;_0x1e8203=0xc8;}else{_0x1e8203=0xce;}_0x4a20c2[_0x7a5f('0x16')](_0x1e8203);return _0x4a20c2[_0x7a5f('0x1d')](_0x7a5f('0x1e'),_0x553dbd+'-'+_0x25da11+'/'+_0x10368b)[_0x7a5f('0x18')](_0x2c84dd);}return null;};}function patchUpdates(_0x45cc5f){return function(_0x196465){try{jsonpatch[_0x7a5f('0x1f')](_0x196465,_0x45cc5f,!![]);}catch(_0x16e07f){return BPromise[_0x7a5f('0x20')](_0x16e07f);}return _0x196465[_0x7a5f('0x21')]();};}function saveUpdates(_0x296d03,_0x185d5e){return function(_0x197bb5){if(_0x197bb5){return _0x197bb5[_0x7a5f('0x22')](_0x296d03)['then'](function(_0x2ba900){return _0x2ba900;});}return null;};}function removeEntity(_0x577dfd,_0x5df849){return function(_0x2328c3){if(_0x2328c3){return _0x2328c3[_0x7a5f('0x23')]()[_0x7a5f('0x24')](function(){_0x577dfd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x57337b,_0x10dd33){return function(_0x148afe){if(!_0x148afe){_0x57337b[_0x7a5f('0x15')](0x194);}return _0x148afe;};}function handleError(_0x776c4d,_0x217695){_0x217695=_0x217695||0x1f4;return function(_0x509352){logger['error'](_0x509352[_0x7a5f('0x25')]);if(_0x509352['name']){delete _0x509352[_0x7a5f('0x26')];}_0x776c4d[_0x7a5f('0x16')](_0x217695)[_0x7a5f('0x27')](_0x509352);};}exports[_0x7a5f('0x28')]=function(_0x31fa20,_0x5c2c6a){var _0x2774b8={},_0x2a446e={},_0x4207ca={'count':0x0,'rows':[]};var _0x19dd87=_[_0x7a5f('0x29')](db[_0x7a5f('0x2a')]['rawAttributes'],function(_0x586c31){return{'name':_0x586c31[_0x7a5f('0x2b')],'type':_0x586c31[_0x7a5f('0x2c')][_0x7a5f('0x2d')]};});_0x2a446e[_0x7a5f('0x2e')]=_[_0x7a5f('0x29')](_0x19dd87,_0x7a5f('0x26'));_0x2a446e['query']=_[_0x7a5f('0x2f')](_0x31fa20[_0x7a5f('0x30')]);_0x2a446e['filters']=_[_0x7a5f('0x31')](_0x2a446e['model'],_0x2a446e[_0x7a5f('0x30')]);_0x2774b8['attributes']=_[_0x7a5f('0x31')](_0x2a446e[_0x7a5f('0x2e')],qs[_0x7a5f('0x32')](_0x31fa20[_0x7a5f('0x30')]['fields']));_0x2774b8[_0x7a5f('0x33')]=_0x2774b8['attributes']['length']?_0x2774b8[_0x7a5f('0x33')]:_0x2a446e['model'];if(!_0x31fa20[_0x7a5f('0x30')]['hasOwnProperty'](_0x7a5f('0x34'))){_0x2774b8['limit']=qs[_0x7a5f('0x1b')](_0x31fa20['query'][_0x7a5f('0x1b')]);_0x2774b8[_0x7a5f('0x19')]=qs[_0x7a5f('0x19')](_0x31fa20[_0x7a5f('0x30')]['offset']);}_0x2774b8[_0x7a5f('0x35')]=qs['sort'](_0x31fa20[_0x7a5f('0x30')][_0x7a5f('0x36')]);_0x2774b8['where']=qs[_0x7a5f('0x37')](_[_0x7a5f('0x38')](_0x31fa20[_0x7a5f('0x30')],_0x2a446e[_0x7a5f('0x37')]),_0x19dd87);if(_0x31fa20[_0x7a5f('0x30')][_0x7a5f('0x39')]){_0x2774b8['where']=_[_0x7a5f('0x3a')](_0x2774b8[_0x7a5f('0x3b')],{'$or':_[_0x7a5f('0x29')](_0x19dd87,function(_0x42edd9){if(_0x42edd9[_0x7a5f('0x2c')]!==_0x7a5f('0x3c')){var _0x3437e0={};_0x3437e0[_0x42edd9[_0x7a5f('0x26')]]={'$like':'%'+_0x31fa20['query'][_0x7a5f('0x39')]+'%'};return _0x3437e0;}})});}_0x2774b8=_[_0x7a5f('0x3a')]({},_0x2774b8,_0x31fa20[_0x7a5f('0x3d')]);var _0x29925e={'where':_0x2774b8[_0x7a5f('0x3b')]};return db[_0x7a5f('0x2a')][_0x7a5f('0x1c')](_0x29925e)['then'](function(_0x312cc5){_0x4207ca[_0x7a5f('0x1c')]=_0x312cc5;if(_0x31fa20['query'][_0x7a5f('0x3e')]){_0x2774b8[_0x7a5f('0x3f')]=[{'all':!![]}];}return db[_0x7a5f('0x2a')]['findAll'](_0x2774b8);})[_0x7a5f('0x24')](function(_0x198846){_0x4207ca[_0x7a5f('0x40')]=_0x198846;return _0x4207ca;})[_0x7a5f('0x24')](respondWithFilteredResult(_0x5c2c6a,_0x2774b8))[_0x7a5f('0x41')](handleError(_0x5c2c6a,null));};exports[_0x7a5f('0x42')]=function(_0x270f6d,_0x3db761){var _0x1cb283={'raw':![],'where':{'id':_0x270f6d['params']['id']}},_0x1b9357={};_0x1b9357['model']=_[_0x7a5f('0x2f')](db[_0x7a5f('0x2a')]['rawAttributes']);_0x1b9357[_0x7a5f('0x30')]=_[_0x7a5f('0x2f')](_0x270f6d[_0x7a5f('0x30')]);_0x1b9357['filters']=_['intersection'](_0x1b9357[_0x7a5f('0x2e')],_0x1b9357[_0x7a5f('0x30')]);_0x1cb283[_0x7a5f('0x33')]=_['intersection'](_0x1b9357['model'],qs[_0x7a5f('0x32')](_0x270f6d[_0x7a5f('0x30')]['fields']));_0x1cb283[_0x7a5f('0x33')]=_0x1cb283[_0x7a5f('0x33')]['length']?_0x1cb283[_0x7a5f('0x33')]:_0x1b9357[_0x7a5f('0x2e')];if(_0x270f6d[_0x7a5f('0x30')][_0x7a5f('0x3e')]){_0x1cb283[_0x7a5f('0x3f')]=[{'all':!![]}];}_0x1cb283=_[_0x7a5f('0x3a')]({},_0x1cb283,_0x270f6d[_0x7a5f('0x3d')]);return db['FreshsalesAccount'][_0x7a5f('0x43')](_0x1cb283)['then'](handleEntityNotFound(_0x3db761,null))[_0x7a5f('0x24')](respondWithResult(_0x3db761,null))[_0x7a5f('0x41')](handleError(_0x3db761,null));};exports[_0x7a5f('0x44')]=function(_0x49b760,_0x22bb02){return db[_0x7a5f('0x2a')][_0x7a5f('0x44')](_0x49b760[_0x7a5f('0x45')],{})['then'](respondWithResult(_0x22bb02,0xc9))['catch'](handleError(_0x22bb02,null));};exports[_0x7a5f('0x22')]=function(_0xd8986b,_0x51b66d){if(_0xd8986b[_0x7a5f('0x45')]['id']){delete _0xd8986b[_0x7a5f('0x45')]['id'];}return db[_0x7a5f('0x2a')][_0x7a5f('0x43')]({'where':{'id':_0xd8986b['params']['id']}})['then'](handleEntityNotFound(_0x51b66d,null))[_0x7a5f('0x24')](saveUpdates(_0xd8986b[_0x7a5f('0x45')],null))[_0x7a5f('0x24')](respondWithResult(_0x51b66d,null))[_0x7a5f('0x41')](handleError(_0x51b66d,null));};exports[_0x7a5f('0x23')]=function(_0x1aeea0,_0x4357ce){return db[_0x7a5f('0x2a')][_0x7a5f('0x43')]({'where':{'id':_0x1aeea0[_0x7a5f('0x46')]['id']}})[_0x7a5f('0x24')](handleEntityNotFound(_0x4357ce,null))[_0x7a5f('0x24')](removeEntity(_0x4357ce,null))[_0x7a5f('0x41')](handleError(_0x4357ce,null));};exports['getConfigurations']=function(_0x3c5538,_0x4464fb,_0x2e7d13){var _0x4ca971={};var _0x5b3450={};var _0x3d9074;var _0x2b642d;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x3c5538['params']['id']}})[_0x7a5f('0x24')](handleEntityNotFound(_0x4464fb,null))['then'](function(_0xd160a){if(_0xd160a){_0x3d9074=_0xd160a;_0x5b3450[_0x7a5f('0x2e')]=_[_0x7a5f('0x2f')](db[_0x7a5f('0x47')]['rawAttributes']);_0x5b3450[_0x7a5f('0x30')]=_[_0x7a5f('0x2f')](_0x3c5538[_0x7a5f('0x30')]);_0x5b3450[_0x7a5f('0x37')]=_[_0x7a5f('0x31')](_0x5b3450[_0x7a5f('0x2e')],_0x5b3450[_0x7a5f('0x30')]);_0x4ca971['attributes']=_[_0x7a5f('0x31')](_0x5b3450['model'],qs[_0x7a5f('0x32')](_0x3c5538[_0x7a5f('0x30')][_0x7a5f('0x32')]));_0x4ca971['attributes']=_0x4ca971[_0x7a5f('0x33')][_0x7a5f('0x48')]?_0x4ca971[_0x7a5f('0x33')]:_0x5b3450[_0x7a5f('0x2e')];_0x4ca971[_0x7a5f('0x35')]=qs[_0x7a5f('0x36')](_0x3c5538[_0x7a5f('0x30')][_0x7a5f('0x36')]);_0x4ca971[_0x7a5f('0x3b')]=qs[_0x7a5f('0x37')](_['pick'](_0x3c5538[_0x7a5f('0x30')],_0x5b3450[_0x7a5f('0x37')]));if(_0x3c5538[_0x7a5f('0x30')][_0x7a5f('0x39')]){_0x4ca971[_0x7a5f('0x3b')]=_[_0x7a5f('0x3a')](_0x4ca971[_0x7a5f('0x3b')],{'$or':_[_0x7a5f('0x29')](_0x4ca971['attributes'],function(_0x189c74){var _0x1208cc={};_0x1208cc[_0x189c74]={'$like':'%'+_0x3c5538['query'][_0x7a5f('0x39')]+'%'};return _0x1208cc;})});}_0x4ca971=_[_0x7a5f('0x3a')]({},_0x4ca971,_0x3c5538[_0x7a5f('0x3d')]);return _0x3d9074[_0x7a5f('0x49')](_0x4ca971);}})[_0x7a5f('0x24')](function(_0x5f3b72){if(_0x5f3b72){_0x2b642d=_0x5f3b72['length'];if(!_0x3c5538[_0x7a5f('0x30')][_0x7a5f('0x4a')](_0x7a5f('0x34'))){_0x4ca971[_0x7a5f('0x1b')]=qs[_0x7a5f('0x1b')](_0x3c5538[_0x7a5f('0x30')][_0x7a5f('0x1b')]);_0x4ca971[_0x7a5f('0x19')]=qs[_0x7a5f('0x19')](_0x3c5538[_0x7a5f('0x30')][_0x7a5f('0x19')]);}return _0x3d9074[_0x7a5f('0x49')](_0x4ca971);}})['then'](function(_0x296191){if(_0x296191){return _0x296191?{'count':_0x2b642d,'rows':_0x296191}:null;}})[_0x7a5f('0x24')](respondWithResult(_0x4464fb,null))['catch'](handleError(_0x4464fb,null));};exports[_0x7a5f('0x4b')]=function(_0x58509c,_0x5e37cf,_0x80b7bd){if(_0x58509c[_0x7a5f('0x45')]['id']){delete _0x58509c[_0x7a5f('0x45')]['id'];}return db[_0x7a5f('0x2a')][_0x7a5f('0x4c')]({'where':{'id':_0x58509c['params']['id']}})[_0x7a5f('0x24')](handleEntityNotFound(_0x5e37cf,null))[_0x7a5f('0x24')](function(_0x5b4ba7){if(_0x5b4ba7){_0x58509c[_0x7a5f('0x45')]['AccountId']=_0x5b4ba7['id'];_0x58509c[_0x7a5f('0x45')][_0x7a5f('0x4d')]=integrations[_0x7a5f('0x4e')](_0x58509c[_0x7a5f('0x45')][_0x7a5f('0x4f')],_0x58509c[_0x7a5f('0x45')][_0x7a5f('0x2c')]);_0x58509c[_0x7a5f('0x45')][_0x7a5f('0x50')]=integrations[_0x7a5f('0x51')](_0x58509c[_0x7a5f('0x45')][_0x7a5f('0x4f')],_0x58509c[_0x7a5f('0x45')]['type']);return db[_0x7a5f('0x47')][_0x7a5f('0x44')](_0x58509c[_0x7a5f('0x45')],{'include':[{'model':db[_0x7a5f('0x52')],'as':'Subjects'},{'model':db[_0x7a5f('0x52')],'as':_0x7a5f('0x50')}]});}return null;})[_0x7a5f('0x24')](respondWithResult(_0x5e37cf,null))[_0x7a5f('0x41')](handleError(_0x5e37cf,null));};exports[_0x7a5f('0x53')]=function(_0x3b89c8,_0x59dd39,_0x532c1a){var _0x273ef1='';var _0x2b0251='';return db[_0x7a5f('0x2a')]['findOne']({'where':{'id':_0x3b89c8['params']['id']},'attributes':['id',_0x7a5f('0x54'),'remoteUri',_0x7a5f('0x55')]})[_0x7a5f('0x24')](handleEntityNotFound(_0x59dd39,null))[_0x7a5f('0x24')](function(_0x41df4){if(_0x41df4){_0x2b0251=_0x41df4['username'];_0x273ef1=_0x41df4[_0x7a5f('0x56')];var _0x314464=_0x41df4[_0x7a5f('0x56')][_0x7a5f('0x57')](-0x1);if(_0x314464==='/'){_0x273ef1=_0x273ef1[_0x7a5f('0x58')](0x0,_0x273ef1[_0x7a5f('0x59')](_0x314464));}return rp({'method':'GET','uri':util['format']('%s%s',_0x273ef1,_0x7a5f('0x5a')),'headers':{'Authorization':_0x7a5f('0x5b')+_0x41df4[_0x7a5f('0x55')]},'json':!![]});}})[_0x7a5f('0x24')](function(_0x57cc54){if(_0x57cc54){var _0x34ed67=_0x57cc54[_0x7a5f('0x5c')];var _0x459367=![];var _0x380fd8=null;for(_0x380fd8=0x0;_0x380fd8<_0x34ed67[_0x7a5f('0x48')];_0x380fd8++){if(_0x34ed67[_0x380fd8][_0x7a5f('0x5d')]===_0x2b0251){_0x459367=!![];}}if(_0x459367){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7a5f('0x5e')});}}})[_0x7a5f('0x24')](respondWithResult(_0x59dd39,null))[_0x7a5f('0x41')](function(_0x2e4763){var _0x274025=_0x3b89c8[_0x7a5f('0x30')]['test']?0x1f4:_0x2e4763[_0x7a5f('0x5f')]||0x1f4;logger[_0x7a5f('0x60')](_0x7a5f('0x61'),_0x7a5f('0x53'),_0x274025,JSON[_0x7a5f('0x62')](_0x2e4763));delete _0x2e4763[_0x7a5f('0x26')];if(_0x274025===0x191){_0x274025=0x190;}_0x59dd39[_0x7a5f('0x16')](_0x274025)[_0x7a5f('0x27')](_0x3b89c8[_0x7a5f('0x30')][_0x7a5f('0x63')]?{'message':_0x7a5f('0x64'),'statusCode':_0x2e4763['statusCode']}:_0x2e4763);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index a7b947c..9bf7482 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 _0x2542=['api','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger'];(function(_0x4ba28c,_0x4d25f1){var _0x12c2cb=function(_0x5c66e8){while(--_0x5c66e8){_0x4ba28c['push'](_0x4ba28c['shift']());}};_0x12c2cb(++_0x4d25f1);}(_0x2542,0x169));var _0x2254=function(_0x11d596,_0x2d4fb4){_0x11d596=_0x11d596-0x0;var _0x31a2be=_0x2542[_0x11d596];return _0x31a2be;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));var integrations=require(_0x2254('0x9'));module['exports']=function(_0x19ad3c,_0xe8ca50){return _0x19ad3c[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x187d=['exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x30fdf9,_0x89096d){var _0x3c43bb=function(_0x40a755){while(--_0x40a755){_0x30fdf9['push'](_0x30fdf9['shift']());}};_0x3c43bb(++_0x89096d);}(_0x187d,0x93));var _0xd187=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x187d[_0x4d07cc];return _0x42de3b;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xd187('0x9')]=function(_0x58ee7,_0x444a60){return _0x58ee7[_0xd187('0xa')](_0xd187('0xb'),attributes,{'tableName':_0xd187('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 3e72473..9da4c7c 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 _0x7278=['stringify','error','code','message','result','catch','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3574fe,_0x1144f5){var _0x47434a=function(_0x287d36){while(--_0x287d36){_0x3574fe['push'](_0x3574fe['shift']());}};_0x47434a(++_0x1144f5);}(_0x7278,0x161));var _0x8727=function(_0x1b13ee,_0x278572){_0x1b13ee=_0x1b13ee-0x0;var _0x252bfe=_0x7278[_0x1b13ee];return _0x252bfe;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var moment=require(_0x8727('0x2'));var BPromise=require(_0x8727('0x3'));var rs=require(_0x8727('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8727('0x5'))['db'];var utils=require(_0x8727('0x6'));var logger=require(_0x8727('0x7'))(_0x8727('0x8'));var config=require(_0x8727('0x9'));var jayson=require(_0x8727('0xa'));var client=jayson[_0x8727('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfd1902,_0x2f491c,_0xffd783){return new BPromise(function(_0x435911,_0x4160c3){return client['request'](_0xfd1902,_0xffd783)['then'](function(_0x4df6f8){logger[_0x8727('0xc')](_0x8727('0xd'),_0x2f491c,_0x8727('0xe'));logger[_0x8727('0xf')](_0x8727('0x10'),_0x2f491c,_0x8727('0xe'),JSON[_0x8727('0x11')](_0x4df6f8));if(_0x4df6f8[_0x8727('0x12')]){if(_0x4df6f8['error'][_0x8727('0x13')]===0x1f4){logger[_0x8727('0x12')](_0x8727('0xd'),_0x2f491c,_0x4df6f8['error'][_0x8727('0x14')]);return _0x4160c3(_0x4df6f8[_0x8727('0x12')]['message']);}logger[_0x8727('0x12')](_0x8727('0xd'),_0x2f491c,_0x4df6f8[_0x8727('0x12')][_0x8727('0x14')]);return _0x435911(_0x4df6f8[_0x8727('0x12')][_0x8727('0x14')]);}else{logger[_0x8727('0xc')](_0x8727('0xd'),_0x2f491c,_0x8727('0xe'));_0x435911(_0x4df6f8[_0x8727('0x15')]['message']);}})[_0x8727('0x16')](function(_0x1f9538){logger[_0x8727('0x12')](_0x8727('0xd'),_0x2f491c,_0x1f9538);_0x4160c3(_0x1f9538);});});}exports[_0x8727('0x17')]=function(_0xba0af5){var _0x533e6d=this;return new Promise(function(_0x575d29,_0x1a90ed){return db['FreshsalesAccount'][_0x8727('0x18')]({'raw':_0xba0af5[_0x8727('0x19')]?_0xba0af5[_0x8727('0x19')][_0x8727('0x1a')]===undefined?!![]:![]:!![],'where':_0xba0af5[_0x8727('0x19')]?_0xba0af5['options'][_0x8727('0x1b')]||null:null,'attributes':_0xba0af5[_0x8727('0x19')]?_0xba0af5[_0x8727('0x19')][_0x8727('0x1c')]||null:null,'limit':_0xba0af5[_0x8727('0x19')]?_0xba0af5[_0x8727('0x19')][_0x8727('0x1d')]||null:null,'include':_0xba0af5[_0x8727('0x19')]?_0xba0af5[_0x8727('0x19')][_0x8727('0x1e')]?_[_0x8727('0x1f')](_0xba0af5[_0x8727('0x19')]['include'],function(_0x464a32){return{'model':db[_0x464a32[_0x8727('0x20')]],'as':_0x464a32['as'],'attributes':_0x464a32['attributes'],'include':_0x464a32['include']?_[_0x8727('0x1f')](_0x464a32[_0x8727('0x1e')],function(_0x15e8bf){return{'model':db[_0x15e8bf['model']],'as':_0x15e8bf['as'],'attributes':_0x15e8bf[_0x8727('0x1c')],'include':_0x15e8bf[_0x8727('0x1e')]?_[_0x8727('0x1f')](_0x15e8bf[_0x8727('0x1e')],function(_0x2c8cd5){return{'model':db[_0x2c8cd5[_0x8727('0x20')]],'as':_0x2c8cd5['as'],'attributes':_0x2c8cd5[_0x8727('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8727('0x21')](function(_0x5d03f2){logger[_0x8727('0xc')](_0x8727('0x17'),_0xba0af5);logger['debug'](_0x8727('0x17'),_0xba0af5,JSON[_0x8727('0x11')](_0x5d03f2));_0x575d29(_0x5d03f2);})[_0x8727('0x16')](function(_0x228ca9){logger[_0x8727('0x12')](_0x8727('0x17'),_0x228ca9['message'],_0xba0af5);_0x1a90ed(_0x533e6d[_0x8727('0x12')](0x1f4,_0x228ca9['message']));});});};exports[_0x8727('0x22')]=function(_0x47e9f9){var _0x44ed83=this;return new Promise(function(_0x391d60,_0x152a53){return db[_0x8727('0x23')][_0x8727('0x24')]({'raw':_0x47e9f9[_0x8727('0x19')]?_0x47e9f9[_0x8727('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x47e9f9[_0x8727('0x19')]?_0x47e9f9[_0x8727('0x19')][_0x8727('0x1b')]||null:null,'attributes':_0x47e9f9[_0x8727('0x19')]?_0x47e9f9[_0x8727('0x19')][_0x8727('0x1c')]||null:null,'include':_0x47e9f9[_0x8727('0x19')]?_0x47e9f9[_0x8727('0x19')][_0x8727('0x1e')]?_[_0x8727('0x1f')](_0x47e9f9[_0x8727('0x19')][_0x8727('0x1e')],function(_0x54bff3){return{'model':db[_0x54bff3['model']],'as':_0x54bff3['as'],'attributes':_0x54bff3[_0x8727('0x1c')],'include':_0x54bff3[_0x8727('0x1e')]?_[_0x8727('0x1f')](_0x54bff3[_0x8727('0x1e')],function(_0x52220f){return{'model':db[_0x52220f[_0x8727('0x20')]],'as':_0x52220f['as'],'attributes':_0x52220f[_0x8727('0x1c')],'include':_0x52220f[_0x8727('0x1e')]?_[_0x8727('0x1f')](_0x52220f[_0x8727('0x1e')],function(_0x5b96cc){return{'model':db[_0x5b96cc[_0x8727('0x20')]],'as':_0x5b96cc['as'],'attributes':_0x5b96cc[_0x8727('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8727('0x21')](function(_0x1b0e88){logger[_0x8727('0xc')](_0x8727('0x22'),_0x47e9f9);logger[_0x8727('0xf')](_0x8727('0x22'),_0x47e9f9,JSON[_0x8727('0x11')](_0x1b0e88));_0x391d60(_0x1b0e88);})[_0x8727('0x16')](function(_0x396f12){logger[_0x8727('0x12')]('ShowFreshsalesAccount',_0x396f12[_0x8727('0x14')],_0x47e9f9);_0x152a53(_0x44ed83[_0x8727('0x12')](0x1f4,_0x396f12[_0x8727('0x14')]));});});}; \ No newline at end of file +var _0xb016=['include','model','debug','ShowFreshsalesAccount','find','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','map'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xb016,0x159));var _0x6b01=function(_0x38a801,_0x35c70d){_0x38a801=_0x38a801-0x0;var _0x1a7dcf=_0xb016[_0x38a801];return _0x1a7dcf;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b01('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b01('0x3'))['db'];var utils=require(_0x6b01('0x4'));var logger=require(_0x6b01('0x5'))(_0x6b01('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b01('0x7'));var client=jayson[_0x6b01('0x8')][_0x6b01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5759a1,_0x5c5bfb,_0x374aab){return new BPromise(function(_0x39f9fa,_0x526a7d){return client['request'](_0x5759a1,_0x374aab)[_0x6b01('0xa')](function(_0x1cb3a6){logger[_0x6b01('0xb')](_0x6b01('0xc'),_0x5c5bfb,_0x6b01('0xd'));logger['debug']('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'),JSON[_0x6b01('0xe')](_0x1cb3a6));if(_0x1cb3a6[_0x6b01('0xf')]){if(_0x1cb3a6['error'][_0x6b01('0x10')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x5c5bfb,_0x1cb3a6[_0x6b01('0xf')]['message']);return _0x526a7d(_0x1cb3a6[_0x6b01('0xf')][_0x6b01('0x11')]);}logger['error'](_0x6b01('0xc'),_0x5c5bfb,_0x1cb3a6['error']['message']);return _0x39f9fa(_0x1cb3a6['error'][_0x6b01('0x11')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x5c5bfb,_0x6b01('0xd'));_0x39f9fa(_0x1cb3a6[_0x6b01('0x12')][_0x6b01('0x11')]);}})[_0x6b01('0x13')](function(_0x3d7045){logger[_0x6b01('0xf')](_0x6b01('0xc'),_0x5c5bfb,_0x3d7045);_0x526a7d(_0x3d7045);});});}exports[_0x6b01('0x14')]=function(_0x9c6571){var _0xc4e1b1=this;return new Promise(function(_0x18f336,_0x4f2d08){return db[_0x6b01('0x15')][_0x6b01('0x16')]({'raw':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x18')]===undefined?!![]:![]:!![],'where':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x19')]||null:null,'attributes':_0x9c6571['options']?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1a')]||null:null,'limit':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1b')]||null:null,'include':_0x9c6571[_0x6b01('0x17')]?_0x9c6571[_0x6b01('0x17')]['include']?_[_0x6b01('0x1c')](_0x9c6571[_0x6b01('0x17')][_0x6b01('0x1d')],function(_0x51243c){return{'model':db[_0x51243c[_0x6b01('0x1e')]],'as':_0x51243c['as'],'attributes':_0x51243c[_0x6b01('0x1a')],'include':_0x51243c[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x51243c[_0x6b01('0x1d')],function(_0x2456e9){return{'model':db[_0x2456e9[_0x6b01('0x1e')]],'as':_0x2456e9['as'],'attributes':_0x2456e9[_0x6b01('0x1a')],'include':_0x2456e9[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x2456e9[_0x6b01('0x1d')],function(_0xa846d8){return{'model':db[_0xa846d8[_0x6b01('0x1e')]],'as':_0xa846d8['as'],'attributes':_0xa846d8['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b01('0xa')](function(_0x220efb){logger[_0x6b01('0xb')](_0x6b01('0x14'),_0x9c6571);logger[_0x6b01('0x1f')]('GetFreshsalesAccount',_0x9c6571,JSON['stringify'](_0x220efb));_0x18f336(_0x220efb);})[_0x6b01('0x13')](function(_0x3df3d4){logger[_0x6b01('0xf')](_0x6b01('0x14'),_0x3df3d4[_0x6b01('0x11')],_0x9c6571);_0x4f2d08(_0xc4e1b1[_0x6b01('0xf')](0x1f4,_0x3df3d4['message']));});});};exports[_0x6b01('0x20')]=function(_0x5482a8){var _0x3942d7=this;return new Promise(function(_0x4e7e32,_0x6920cf){return db[_0x6b01('0x15')][_0x6b01('0x21')]({'raw':_0x5482a8[_0x6b01('0x17')]?_0x5482a8[_0x6b01('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5482a8[_0x6b01('0x17')]?_0x5482a8[_0x6b01('0x17')][_0x6b01('0x19')]||null:null,'attributes':_0x5482a8['options']?_0x5482a8['options'][_0x6b01('0x1a')]||null:null,'include':_0x5482a8['options']?_0x5482a8[_0x6b01('0x17')][_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x5482a8['options'][_0x6b01('0x1d')],function(_0x42d5f7){return{'model':db[_0x42d5f7[_0x6b01('0x1e')]],'as':_0x42d5f7['as'],'attributes':_0x42d5f7['attributes'],'include':_0x42d5f7[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x42d5f7[_0x6b01('0x1d')],function(_0x2eb34f){return{'model':db[_0x2eb34f[_0x6b01('0x1e')]],'as':_0x2eb34f['as'],'attributes':_0x2eb34f['attributes'],'include':_0x2eb34f[_0x6b01('0x1d')]?_[_0x6b01('0x1c')](_0x2eb34f[_0x6b01('0x1d')],function(_0x5269c7){return{'model':db[_0x5269c7[_0x6b01('0x1e')]],'as':_0x5269c7['as'],'attributes':_0x5269c7[_0x6b01('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6b01('0xa')](function(_0x3154d7){logger['info'](_0x6b01('0x20'),_0x5482a8);logger['debug'](_0x6b01('0x20'),_0x5482a8,JSON[_0x6b01('0xe')](_0x3154d7));_0x4e7e32(_0x3154d7);})[_0x6b01('0x13')](function(_0x318b8b){logger[_0x6b01('0xf')](_0x6b01('0x20'),_0x318b8b[_0x6b01('0x11')],_0x5482a8);_0x6920cf(_0x3942d7['error'](0x1f4,_0x318b8b[_0x6b01('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 80e839d..54de108 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 _0xb77b=['path','express','Router','fs-extra','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','/:id/subjects','getDescriptions','/:id/fields','post','update','delete','destroy','multer','util'];(function(_0x2f0df7,_0x128c45){var _0xb25d91=function(_0x10d784){while(--_0x10d784){_0x2f0df7['push'](_0x2f0df7['shift']());}};_0xb25d91(++_0x128c45);}(_0xb77b,0x75));var _0xbb77=function(_0x21104f,_0x54d0e4){_0x21104f=_0x21104f-0x0;var _0x12eaaf=_0xb77b[_0x21104f];return _0x12eaaf;};'use strict';var multer=require(_0xbb77('0x0'));var util=require(_0xbb77('0x1'));var path=require(_0xbb77('0x2'));var timeout=require('connect-timeout');var express=require(_0xbb77('0x3'));var router=express[_0xbb77('0x4')]();var fs_extra=require(_0xbb77('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbb77('0x6'));router[_0xbb77('0x7')]('/',auth[_0xbb77('0x8')](),controller['index']);router['get'](_0xbb77('0x9'),auth[_0xbb77('0x8')](),controller['show']);router['get'](_0xbb77('0xa'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xbb77('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xbb77('0xb')]);router[_0xbb77('0x7')](_0xbb77('0xc'),auth[_0xbb77('0x8')](),controller['getFields']);router[_0xbb77('0xd')]('/',auth[_0xbb77('0x8')](),controller['create']);router['put'](_0xbb77('0x9'),auth[_0xbb77('0x8')](),controller[_0xbb77('0xe')]);router[_0xbb77('0xf')](_0xbb77('0x9'),auth[_0xbb77('0x8')](),controller[_0xbb77('0x10')]);module['exports']=router; \ No newline at end of file +var _0x04e3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x04e3,0x103));var _0x304e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x04e3[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0x304e('0x0'));var path=require('path');var timeout=require(_0x304e('0x1'));var express=require(_0x304e('0x2'));var router=express[_0x304e('0x3')]();var fs_extra=require(_0x304e('0x4'));var auth=require(_0x304e('0x5'));var interaction=require(_0x304e('0x6'));var config=require(_0x304e('0x7'));var controller=require(_0x304e('0x8'));router[_0x304e('0x9')]('/',auth[_0x304e('0xa')](),controller[_0x304e('0xb')]);router[_0x304e('0x9')](_0x304e('0xc'),auth[_0x304e('0xa')](),controller[_0x304e('0xd')]);router[_0x304e('0x9')](_0x304e('0xe'),auth[_0x304e('0xa')](),controller['getSubjects']);router[_0x304e('0x9')](_0x304e('0xf'),auth['isAuthenticated'](),controller[_0x304e('0x10')]);router['get'](_0x304e('0x11'),auth[_0x304e('0xa')](),controller[_0x304e('0x12')]);router[_0x304e('0x13')]('/',auth[_0x304e('0xa')](),controller[_0x304e('0x14')]);router[_0x304e('0x15')](_0x304e('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x304e('0x16')]);module[_0x304e('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 1ee5d37..00bae78 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 _0xca27=['STRING'];(function(_0x463ded,_0x385192){var _0x92b918=function(_0x38879c){while(--_0x38879c){_0x463ded['push'](_0x463ded['shift']());}};_0x92b918(++_0x385192);}(_0xca27,0x1e1));var _0x7ca2=function(_0x3fef09,_0x4c18bf){_0x3fef09=_0x3fef09-0x0;var _0x29fc0b=_0xca27[_0x3fef09];return _0x29fc0b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7ca2('0x0')]}}; \ No newline at end of file +var _0x5f9a=['STRING','sequelize','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5f9a,0x97));var _0xa5f9=function(_0x4baffa,_0x436a2d){_0x4baffa=_0x4baffa-0x0;var _0x53dfb2=_0x5f9a[_0x4baffa];return _0x53dfb2;};'use strict';var Sequelize=require(_0xa5f9('0x0'));module[_0xa5f9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa5f9('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 970aae6..8d88ee1 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 _0x285e=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','reject','save','update','error','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','merge','type','VIRTUAL','name','filter','options','then','includeAll','include','findAll','rows','catch','params','length','find','create','body','destroy','findOne','FreshsalesField','order','pick','getSubjects','getDescriptions','getFields','eml-format','rimraf'];(function(_0x377293,_0x223330){var _0x77b9c5=function(_0x51fd6a){while(--_0x51fd6a){_0x377293['push'](_0x377293['shift']());}};_0x77b9c5(++_0x223330);}(_0x285e,0xf7));var _0xe285=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x285e[_0x62c958];return _0x57ec61;};'use strict';var emlformat=require(_0xe285('0x0'));var rimraf=require(_0xe285('0x1'));var zipdir=require(_0xe285('0x2'));var jsonpatch=require(_0xe285('0x3'));var rp=require(_0xe285('0x4'));var moment=require(_0xe285('0x5'));var BPromise=require(_0xe285('0x6'));var Mustache=require(_0xe285('0x7'));var util=require(_0xe285('0x8'));var path=require(_0xe285('0x9'));var sox=require('sox');var csv=require(_0xe285('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe285('0xb'));var _=require(_0xe285('0xc'));var squel=require(_0xe285('0xd'));var crypto=require(_0xe285('0xe'));var jsforce=require(_0xe285('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe285('0xa'));var querystring=require(_0xe285('0x10'));var Papa=require(_0xe285('0x11'));var Redis=require(_0xe285('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe285('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe285('0x14'));var logger=require(_0xe285('0x15'))(_0xe285('0x16'));var utils=require(_0xe285('0x17'));var config=require(_0xe285('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe285('0x19'))['db'];function respondWithStatusCode(_0x3731ab,_0x57a527){_0x57a527=_0x57a527||0xcc;return function(_0x2c30ed){if(_0x2c30ed){return _0x3731ab[_0xe285('0x1a')](_0x57a527);}return _0x3731ab[_0xe285('0x1b')](_0x57a527)[_0xe285('0x1c')]();};}function respondWithResult(_0x31227b,_0x2f4c3c){_0x2f4c3c=_0x2f4c3c||0xc8;return function(_0x18d486){if(_0x18d486){return _0x31227b['status'](_0x2f4c3c)['json'](_0x18d486);}};}function respondWithFilteredResult(_0x4915c4,_0x4d69bc){return function(_0x6b0747){if(_0x6b0747){var _0x2582e9=typeof _0x4d69bc[_0xe285('0x1d')]===_0xe285('0x1e')&&typeof _0x4d69bc['limit']===_0xe285('0x1e');var _0x4f62d6=_0x6b0747[_0xe285('0x1f')];var _0x5198d5=_0x2582e9?0x0:_0x4d69bc[_0xe285('0x1d')];var _0x57e2da=_0x2582e9?_0x6b0747[_0xe285('0x1f')]:_0x4d69bc[_0xe285('0x1d')]+_0x4d69bc['limit'];var _0x5d18f3;if(_0x57e2da>=_0x4f62d6){_0x57e2da=_0x4f62d6;_0x5d18f3=0xc8;}else{_0x5d18f3=0xce;}_0x4915c4[_0xe285('0x1b')](_0x5d18f3);return _0x4915c4[_0xe285('0x20')](_0xe285('0x21'),_0x5198d5+'-'+_0x57e2da+'/'+_0x4f62d6)[_0xe285('0x22')](_0x6b0747);}return null;};}function patchUpdates(_0x59bdf1){return function(_0x328e44){try{jsonpatch['apply'](_0x328e44,_0x59bdf1,!![]);}catch(_0x597eec){return BPromise[_0xe285('0x23')](_0x597eec);}return _0x328e44[_0xe285('0x24')]();};}function saveUpdates(_0x4c2241,_0x17ed17){return function(_0x3349e8){if(_0x3349e8){return _0x3349e8[_0xe285('0x25')](_0x4c2241)['then'](function(_0x548d46){return _0x548d46;});}return null;};}function removeEntity(_0x2360a4,_0x17ae7d){return function(_0xd95380){if(_0xd95380){return _0xd95380['destroy']()['then'](function(){_0x2360a4[_0xe285('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x591441,_0x2ad022){return function(_0x2dada5){if(!_0x2dada5){_0x591441[_0xe285('0x1a')](0x194);}return _0x2dada5;};}function handleError(_0x71d637,_0x592b68){_0x592b68=_0x592b68||0x1f4;return function(_0x3d72b9){logger[_0xe285('0x26')](_0x3d72b9['stack']);if(_0x3d72b9['name']){delete _0x3d72b9['name'];}_0x71d637['status'](_0x592b68)[_0xe285('0x27')](_0x3d72b9);};}exports[_0xe285('0x28')]=function(_0x3639cb,_0x24ed62){var _0x25a52b={},_0x368370={},_0x3a1285={'count':0x0,'rows':[]};var _0x56e06c=_[_0xe285('0x29')](db[_0xe285('0x2a')][_0xe285('0x2b')],function(_0x179c6e){return{'name':_0x179c6e[_0xe285('0x2c')],'type':_0x179c6e['type'][_0xe285('0x2d')]};});_0x368370[_0xe285('0x2e')]=_['map'](_0x56e06c,'name');_0x368370[_0xe285('0x2f')]=_[_0xe285('0x30')](_0x3639cb['query']);_0x368370[_0xe285('0x31')]=_[_0xe285('0x32')](_0x368370[_0xe285('0x2e')],_0x368370[_0xe285('0x2f')]);_0x25a52b[_0xe285('0x33')]=_[_0xe285('0x32')](_0x368370[_0xe285('0x2e')],qs[_0xe285('0x34')](_0x3639cb[_0xe285('0x2f')][_0xe285('0x34')]));_0x25a52b[_0xe285('0x33')]=_0x25a52b[_0xe285('0x33')]['length']?_0x25a52b[_0xe285('0x33')]:_0x368370[_0xe285('0x2e')];if(!_0x3639cb['query'][_0xe285('0x35')](_0xe285('0x36'))){_0x25a52b[_0xe285('0x37')]=qs[_0xe285('0x37')](_0x3639cb[_0xe285('0x2f')][_0xe285('0x37')]);_0x25a52b[_0xe285('0x1d')]=qs[_0xe285('0x1d')](_0x3639cb[_0xe285('0x2f')]['offset']);}_0x25a52b['order']=qs['sort'](_0x3639cb[_0xe285('0x2f')][_0xe285('0x38')]);_0x25a52b[_0xe285('0x39')]=qs[_0xe285('0x31')](_['pick'](_0x3639cb[_0xe285('0x2f')],_0x368370[_0xe285('0x31')]),_0x56e06c);if(_0x3639cb[_0xe285('0x2f')]['filter']){_0x25a52b[_0xe285('0x39')]=_[_0xe285('0x3a')](_0x25a52b[_0xe285('0x39')],{'$or':_[_0xe285('0x29')](_0x56e06c,function(_0x57c22d){if(_0x57c22d[_0xe285('0x3b')]!==_0xe285('0x3c')){var _0x1d644b={};_0x1d644b[_0x57c22d[_0xe285('0x3d')]]={'$like':'%'+_0x3639cb['query'][_0xe285('0x3e')]+'%'};return _0x1d644b;}})});}_0x25a52b=_[_0xe285('0x3a')]({},_0x25a52b,_0x3639cb[_0xe285('0x3f')]);var _0x2d8d4c={'where':_0x25a52b[_0xe285('0x39')]};return db[_0xe285('0x2a')][_0xe285('0x1f')](_0x2d8d4c)[_0xe285('0x40')](function(_0x77e5db){_0x3a1285[_0xe285('0x1f')]=_0x77e5db;if(_0x3639cb[_0xe285('0x2f')][_0xe285('0x41')]){_0x25a52b[_0xe285('0x42')]=[{'all':!![]}];}return db[_0xe285('0x2a')][_0xe285('0x43')](_0x25a52b);})[_0xe285('0x40')](function(_0x319742){_0x3a1285[_0xe285('0x44')]=_0x319742;return _0x3a1285;})['then'](respondWithFilteredResult(_0x24ed62,_0x25a52b))[_0xe285('0x45')](handleError(_0x24ed62,null));};exports['show']=function(_0x3ae52a,_0x206ce2){var _0x441544={'raw':![],'where':{'id':_0x3ae52a[_0xe285('0x46')]['id']}},_0x51d8ee={};_0x51d8ee[_0xe285('0x2e')]=_['keys'](db[_0xe285('0x2a')][_0xe285('0x2b')]);_0x51d8ee[_0xe285('0x2f')]=_[_0xe285('0x30')](_0x3ae52a[_0xe285('0x2f')]);_0x51d8ee[_0xe285('0x31')]=_[_0xe285('0x32')](_0x51d8ee[_0xe285('0x2e')],_0x51d8ee[_0xe285('0x2f')]);_0x441544[_0xe285('0x33')]=_[_0xe285('0x32')](_0x51d8ee['model'],qs[_0xe285('0x34')](_0x3ae52a[_0xe285('0x2f')][_0xe285('0x34')]));_0x441544[_0xe285('0x33')]=_0x441544[_0xe285('0x33')][_0xe285('0x47')]?_0x441544[_0xe285('0x33')]:_0x51d8ee[_0xe285('0x2e')];if(_0x3ae52a[_0xe285('0x2f')][_0xe285('0x41')]){_0x441544[_0xe285('0x42')]=[{'all':!![]}];}_0x441544=_[_0xe285('0x3a')]({},_0x441544,_0x3ae52a[_0xe285('0x3f')]);return db[_0xe285('0x2a')][_0xe285('0x48')](_0x441544)[_0xe285('0x40')](handleEntityNotFound(_0x206ce2,null))[_0xe285('0x40')](respondWithResult(_0x206ce2,null))[_0xe285('0x45')](handleError(_0x206ce2,null));};exports[_0xe285('0x49')]=function(_0x42473e,_0x39bb7a){return db[_0xe285('0x2a')][_0xe285('0x49')](_0x42473e[_0xe285('0x4a')],{})[_0xe285('0x40')](respondWithResult(_0x39bb7a,0xc9))['catch'](handleError(_0x39bb7a,null));};exports[_0xe285('0x25')]=function(_0x137ec5,_0x50d272){if(_0x137ec5[_0xe285('0x4a')]['id']){delete _0x137ec5[_0xe285('0x4a')]['id'];}return db[_0xe285('0x2a')]['find']({'where':{'id':_0x137ec5[_0xe285('0x46')]['id']}})['then'](handleEntityNotFound(_0x50d272,null))[_0xe285('0x40')](saveUpdates(_0x137ec5[_0xe285('0x4a')],null))[_0xe285('0x40')](respondWithResult(_0x50d272,null))[_0xe285('0x45')](handleError(_0x50d272,null));};exports[_0xe285('0x4b')]=function(_0x49f9eb,_0x5bcd61){return db[_0xe285('0x2a')]['find']({'where':{'id':_0x49f9eb[_0xe285('0x46')]['id']}})['then'](handleEntityNotFound(_0x5bcd61,null))[_0xe285('0x40')](removeEntity(_0x5bcd61,null))['catch'](handleError(_0x5bcd61,null));};exports['getSubjects']=function(_0x5a84b2,_0x45bfec,_0x46144b){var _0x35e2f2={};var _0x1732a4={};var _0xc27b1;var _0x10109b;return db[_0xe285('0x2a')][_0xe285('0x4c')]({'where':{'id':_0x5a84b2[_0xe285('0x46')]['id']}})[_0xe285('0x40')](handleEntityNotFound(_0x45bfec,null))[_0xe285('0x40')](function(_0x26d87a){if(_0x26d87a){_0xc27b1=_0x26d87a;_0x1732a4[_0xe285('0x2e')]=_[_0xe285('0x30')](db[_0xe285('0x4d')][_0xe285('0x2b')]);_0x1732a4[_0xe285('0x2f')]=_['keys'](_0x5a84b2['query']);_0x1732a4[_0xe285('0x31')]=_[_0xe285('0x32')](_0x1732a4['model'],_0x1732a4[_0xe285('0x2f')]);_0x35e2f2[_0xe285('0x33')]=_['intersection'](_0x1732a4[_0xe285('0x2e')],qs['fields'](_0x5a84b2[_0xe285('0x2f')]['fields']));_0x35e2f2[_0xe285('0x33')]=_0x35e2f2['attributes'][_0xe285('0x47')]?_0x35e2f2['attributes']:_0x1732a4[_0xe285('0x2e')];_0x35e2f2[_0xe285('0x4e')]=qs[_0xe285('0x38')](_0x5a84b2[_0xe285('0x2f')][_0xe285('0x38')]);_0x35e2f2[_0xe285('0x39')]=qs[_0xe285('0x31')](_[_0xe285('0x4f')](_0x5a84b2[_0xe285('0x2f')],_0x1732a4['filters']));if(_0x5a84b2[_0xe285('0x2f')][_0xe285('0x3e')]){_0x35e2f2['where']=_[_0xe285('0x3a')](_0x35e2f2['where'],{'$or':_[_0xe285('0x29')](_0x35e2f2['attributes'],function(_0x3a99a1){var _0x22660c={};_0x22660c[_0x3a99a1]={'$like':'%'+_0x5a84b2[_0xe285('0x2f')][_0xe285('0x3e')]+'%'};return _0x22660c;})});}_0x35e2f2=_[_0xe285('0x3a')]({},_0x35e2f2,_0x5a84b2[_0xe285('0x3f')]);return _0xc27b1[_0xe285('0x50')](_0x35e2f2);}})[_0xe285('0x40')](function(_0x155584){if(_0x155584){_0x10109b=_0x155584[_0xe285('0x47')];if(!_0x5a84b2[_0xe285('0x2f')][_0xe285('0x35')]('nolimit')){_0x35e2f2[_0xe285('0x37')]=qs[_0xe285('0x37')](_0x5a84b2['query']['limit']);_0x35e2f2['offset']=qs[_0xe285('0x1d')](_0x5a84b2[_0xe285('0x2f')][_0xe285('0x1d')]);}return _0xc27b1[_0xe285('0x50')](_0x35e2f2);}})['then'](function(_0x292659){if(_0x292659){return _0x292659?{'count':_0x10109b,'rows':_0x292659}:null;}})[_0xe285('0x40')](respondWithResult(_0x45bfec,null))[_0xe285('0x45')](handleError(_0x45bfec,null));};exports[_0xe285('0x51')]=function(_0x35a3e9,_0x4a7082,_0x266e3a){var _0x527d17={};var _0x5ec2e5={};var _0x3e95a6;var _0x4f3bed;return db[_0xe285('0x2a')][_0xe285('0x4c')]({'where':{'id':_0x35a3e9[_0xe285('0x46')]['id']}})[_0xe285('0x40')](handleEntityNotFound(_0x4a7082,null))[_0xe285('0x40')](function(_0x259573){if(_0x259573){_0x3e95a6=_0x259573;_0x5ec2e5[_0xe285('0x2e')]=_[_0xe285('0x30')](db['FreshsalesField'][_0xe285('0x2b')]);_0x5ec2e5[_0xe285('0x2f')]=_[_0xe285('0x30')](_0x35a3e9[_0xe285('0x2f')]);_0x5ec2e5[_0xe285('0x31')]=_[_0xe285('0x32')](_0x5ec2e5['model'],_0x5ec2e5['query']);_0x527d17['attributes']=_[_0xe285('0x32')](_0x5ec2e5['model'],qs['fields'](_0x35a3e9[_0xe285('0x2f')][_0xe285('0x34')]));_0x527d17['attributes']=_0x527d17['attributes'][_0xe285('0x47')]?_0x527d17['attributes']:_0x5ec2e5[_0xe285('0x2e')];_0x527d17['order']=qs[_0xe285('0x38')](_0x35a3e9[_0xe285('0x2f')][_0xe285('0x38')]);_0x527d17['where']=qs[_0xe285('0x31')](_['pick'](_0x35a3e9['query'],_0x5ec2e5[_0xe285('0x31')]));if(_0x35a3e9[_0xe285('0x2f')]['filter']){_0x527d17[_0xe285('0x39')]=_[_0xe285('0x3a')](_0x527d17['where'],{'$or':_[_0xe285('0x29')](_0x527d17[_0xe285('0x33')],function(_0x3a6b3a){var _0x135c68={};_0x135c68[_0x3a6b3a]={'$like':'%'+_0x35a3e9['query']['filter']+'%'};return _0x135c68;})});}_0x527d17=_[_0xe285('0x3a')]({},_0x527d17,_0x35a3e9['options']);return _0x3e95a6[_0xe285('0x51')](_0x527d17);}})[_0xe285('0x40')](function(_0x23f9fd){if(_0x23f9fd){_0x4f3bed=_0x23f9fd[_0xe285('0x47')];if(!_0x35a3e9['query']['hasOwnProperty']('nolimit')){_0x527d17['limit']=qs[_0xe285('0x37')](_0x35a3e9['query'][_0xe285('0x37')]);_0x527d17[_0xe285('0x1d')]=qs[_0xe285('0x1d')](_0x35a3e9[_0xe285('0x2f')][_0xe285('0x1d')]);}return _0x3e95a6['getDescriptions'](_0x527d17);}})[_0xe285('0x40')](function(_0x32cad1){if(_0x32cad1){return _0x32cad1?{'count':_0x4f3bed,'rows':_0x32cad1}:null;}})['then'](respondWithResult(_0x4a7082,null))[_0xe285('0x45')](handleError(_0x4a7082,null));};exports[_0xe285('0x52')]=function(_0x1708c4,_0x307845,_0x50d18a){var _0x63c396={};var _0x640c2e={};var _0x1d896e;var _0x3a61c0;return db[_0xe285('0x2a')][_0xe285('0x4c')]({'where':{'id':_0x1708c4[_0xe285('0x46')]['id']}})[_0xe285('0x40')](handleEntityNotFound(_0x307845,null))[_0xe285('0x40')](function(_0x53a7f2){if(_0x53a7f2){_0x1d896e=_0x53a7f2;_0x640c2e[_0xe285('0x2e')]=_[_0xe285('0x30')](db[_0xe285('0x4d')][_0xe285('0x2b')]);_0x640c2e[_0xe285('0x2f')]=_[_0xe285('0x30')](_0x1708c4[_0xe285('0x2f')]);_0x640c2e[_0xe285('0x31')]=_[_0xe285('0x32')](_0x640c2e[_0xe285('0x2e')],_0x640c2e['query']);_0x63c396['attributes']=_[_0xe285('0x32')](_0x640c2e[_0xe285('0x2e')],qs[_0xe285('0x34')](_0x1708c4[_0xe285('0x2f')][_0xe285('0x34')]));_0x63c396[_0xe285('0x33')]=_0x63c396[_0xe285('0x33')][_0xe285('0x47')]?_0x63c396[_0xe285('0x33')]:_0x640c2e[_0xe285('0x2e')];_0x63c396['order']=qs['sort'](_0x1708c4[_0xe285('0x2f')][_0xe285('0x38')]);_0x63c396['where']=qs[_0xe285('0x31')](_[_0xe285('0x4f')](_0x1708c4[_0xe285('0x2f')],_0x640c2e[_0xe285('0x31')]));if(_0x1708c4[_0xe285('0x2f')][_0xe285('0x3e')]){_0x63c396[_0xe285('0x39')]=_['merge'](_0x63c396['where'],{'$or':_[_0xe285('0x29')](_0x63c396['attributes'],function(_0x35ec1a){var _0x30e6da={};_0x30e6da[_0x35ec1a]={'$like':'%'+_0x1708c4[_0xe285('0x2f')][_0xe285('0x3e')]+'%'};return _0x30e6da;})});}_0x63c396=_[_0xe285('0x3a')]({},_0x63c396,_0x1708c4['options']);return _0x1d896e[_0xe285('0x52')](_0x63c396);}})['then'](function(_0x267974){if(_0x267974){_0x3a61c0=_0x267974[_0xe285('0x47')];if(!_0x1708c4['query'][_0xe285('0x35')](_0xe285('0x36'))){_0x63c396['limit']=qs[_0xe285('0x37')](_0x1708c4[_0xe285('0x2f')][_0xe285('0x37')]);_0x63c396[_0xe285('0x1d')]=qs[_0xe285('0x1d')](_0x1708c4[_0xe285('0x2f')]['offset']);}return _0x1d896e[_0xe285('0x52')](_0x63c396);}})[_0xe285('0x40')](function(_0x5e2c33){if(_0x5e2c33){return _0x5e2c33?{'count':_0x3a61c0,'rows':_0x5e2c33}:null;}})['then'](respondWithResult(_0x307845,null))['catch'](handleError(_0x307845,null));}; \ No newline at end of file +var _0xe26c=['intersection','query','attributes','fields','length','hasOwnProperty','sort','filters','pick','filter','where','merge','options','include','findAll','rows','catch','show','keys','find','create','body','params','getSubjects','findOne','order','nolimit','getDescriptions','getFields','FreshsalesField','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','save','update','then','destroy','error','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map'];(function(_0x280e52,_0x58dfa8){var _0x169e30=function(_0x311053){while(--_0x311053){_0x280e52['push'](_0x280e52['shift']());}};_0x169e30(++_0x58dfa8);}(_0xe26c,0x1e6));var _0xce26=function(_0x521ead,_0x40e7d3){_0x521ead=_0x521ead-0x0;var _0xcd5edd=_0xe26c[_0x521ead];return _0xcd5edd;};'use strict';var emlformat=require(_0xce26('0x0'));var rimraf=require(_0xce26('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce26('0x2'));var rp=require('request-promise');var moment=require(_0xce26('0x3'));var BPromise=require(_0xce26('0x4'));var Mustache=require(_0xce26('0x5'));var util=require(_0xce26('0x6'));var path=require(_0xce26('0x7'));var sox=require('sox');var csv=require(_0xce26('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce26('0x9'));var _=require(_0xce26('0xa'));var squel=require(_0xce26('0xb'));var crypto=require(_0xce26('0xc'));var jsforce=require(_0xce26('0xd'));var deskjs=require(_0xce26('0xe'));var toCsv=require(_0xce26('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xce26('0xf'));var hardwareService=require(_0xce26('0x10'));var logger=require(_0xce26('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xce26('0x12'));var licenseUtil=require(_0xce26('0x13'));var db=require(_0xce26('0x14'))['db'];function respondWithStatusCode(_0x3fe214,_0x1b99c4){_0x1b99c4=_0x1b99c4||0xcc;return function(_0x1ccafb){if(_0x1ccafb){return _0x3fe214[_0xce26('0x15')](_0x1b99c4);}return _0x3fe214[_0xce26('0x16')](_0x1b99c4)[_0xce26('0x17')]();};}function respondWithResult(_0x13dc30,_0x5a214f){_0x5a214f=_0x5a214f||0xc8;return function(_0x555e5d){if(_0x555e5d){return _0x13dc30['status'](_0x5a214f)[_0xce26('0x18')](_0x555e5d);}};}function respondWithFilteredResult(_0x50e34f,_0x5f06d1){return function(_0x3cc744){if(_0x3cc744){var _0x1a4cd9=typeof _0x5f06d1[_0xce26('0x19')]===_0xce26('0x1a')&&typeof _0x5f06d1['limit']===_0xce26('0x1a');var _0x357d3b=_0x3cc744[_0xce26('0x1b')];var _0x404fd2=_0x1a4cd9?0x0:_0x5f06d1[_0xce26('0x19')];var _0x51a90d=_0x1a4cd9?_0x3cc744[_0xce26('0x1b')]:_0x5f06d1[_0xce26('0x19')]+_0x5f06d1[_0xce26('0x1c')];var _0x268f9f;if(_0x51a90d>=_0x357d3b){_0x51a90d=_0x357d3b;_0x268f9f=0xc8;}else{_0x268f9f=0xce;}_0x50e34f[_0xce26('0x16')](_0x268f9f);return _0x50e34f[_0xce26('0x1d')]('Content-Range',_0x404fd2+'-'+_0x51a90d+'/'+_0x357d3b)[_0xce26('0x18')](_0x3cc744);}return null;};}function patchUpdates(_0x7eea6c){return function(_0x36a14e){try{jsonpatch['apply'](_0x36a14e,_0x7eea6c,!![]);}catch(_0x1e1716){return BPromise['reject'](_0x1e1716);}return _0x36a14e[_0xce26('0x1e')]();};}function saveUpdates(_0x1132d4,_0x2047c1){return function(_0x2fa28d){if(_0x2fa28d){return _0x2fa28d[_0xce26('0x1f')](_0x1132d4)[_0xce26('0x20')](function(_0x22925b){return _0x22925b;});}return null;};}function removeEntity(_0x5ede6c,_0x16a064){return function(_0x2f7d19){if(_0x2f7d19){return _0x2f7d19[_0xce26('0x21')]()[_0xce26('0x20')](function(){_0x5ede6c[_0xce26('0x16')](0xcc)[_0xce26('0x17')]();});}};}function handleEntityNotFound(_0x25a578,_0x9aba8a){return function(_0x1c754d){if(!_0x1c754d){_0x25a578[_0xce26('0x15')](0x194);}return _0x1c754d;};}function handleError(_0x4f6d8d,_0x3ca690){_0x3ca690=_0x3ca690||0x1f4;return function(_0x47f1bb){logger[_0xce26('0x22')](_0x47f1bb[_0xce26('0x23')]);if(_0x47f1bb[_0xce26('0x24')]){delete _0x47f1bb[_0xce26('0x24')];}_0x4f6d8d[_0xce26('0x16')](_0x3ca690)[_0xce26('0x25')](_0x47f1bb);};}exports[_0xce26('0x26')]=function(_0x50da2a,_0x80539f){var _0x31430f={},_0xf3c74a={},_0x5f3df5={'count':0x0,'rows':[]};var _0x5e72b9=_['map'](db[_0xce26('0x27')][_0xce26('0x28')],function(_0x56ecc3){return{'name':_0x56ecc3[_0xce26('0x29')],'type':_0x56ecc3[_0xce26('0x2a')][_0xce26('0x2b')]};});_0xf3c74a[_0xce26('0x2c')]=_[_0xce26('0x2d')](_0x5e72b9,_0xce26('0x24'));_0xf3c74a['query']=_['keys'](_0x50da2a['query']);_0xf3c74a['filters']=_[_0xce26('0x2e')](_0xf3c74a[_0xce26('0x2c')],_0xf3c74a[_0xce26('0x2f')]);_0x31430f[_0xce26('0x30')]=_[_0xce26('0x2e')](_0xf3c74a[_0xce26('0x2c')],qs[_0xce26('0x31')](_0x50da2a['query'][_0xce26('0x31')]));_0x31430f['attributes']=_0x31430f[_0xce26('0x30')][_0xce26('0x32')]?_0x31430f[_0xce26('0x30')]:_0xf3c74a[_0xce26('0x2c')];if(!_0x50da2a['query'][_0xce26('0x33')]('nolimit')){_0x31430f['limit']=qs['limit'](_0x50da2a[_0xce26('0x2f')][_0xce26('0x1c')]);_0x31430f[_0xce26('0x19')]=qs[_0xce26('0x19')](_0x50da2a[_0xce26('0x2f')]['offset']);}_0x31430f['order']=qs[_0xce26('0x34')](_0x50da2a['query']['sort']);_0x31430f['where']=qs[_0xce26('0x35')](_[_0xce26('0x36')](_0x50da2a[_0xce26('0x2f')],_0xf3c74a['filters']),_0x5e72b9);if(_0x50da2a['query'][_0xce26('0x37')]){_0x31430f[_0xce26('0x38')]=_['merge'](_0x31430f['where'],{'$or':_[_0xce26('0x2d')](_0x5e72b9,function(_0x17acc6){if(_0x17acc6['type']!=='VIRTUAL'){var _0x5749d9={};_0x5749d9[_0x17acc6[_0xce26('0x24')]]={'$like':'%'+_0x50da2a[_0xce26('0x2f')]['filter']+'%'};return _0x5749d9;}})});}_0x31430f=_[_0xce26('0x39')]({},_0x31430f,_0x50da2a[_0xce26('0x3a')]);var _0x21b880={'where':_0x31430f[_0xce26('0x38')]};return db[_0xce26('0x27')][_0xce26('0x1b')](_0x21b880)['then'](function(_0x12e096){_0x5f3df5[_0xce26('0x1b')]=_0x12e096;if(_0x50da2a[_0xce26('0x2f')]['includeAll']){_0x31430f[_0xce26('0x3b')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xce26('0x3c')](_0x31430f);})['then'](function(_0x5e86b5){_0x5f3df5[_0xce26('0x3d')]=_0x5e86b5;return _0x5f3df5;})[_0xce26('0x20')](respondWithFilteredResult(_0x80539f,_0x31430f))[_0xce26('0x3e')](handleError(_0x80539f,null));};exports[_0xce26('0x3f')]=function(_0x241e91,_0x5b3727){var _0x5e82df={'raw':![],'where':{'id':_0x241e91['params']['id']}},_0xd34ad2={};_0xd34ad2['model']=_['keys'](db[_0xce26('0x27')]['rawAttributes']);_0xd34ad2['query']=_[_0xce26('0x40')](_0x241e91[_0xce26('0x2f')]);_0xd34ad2[_0xce26('0x35')]=_[_0xce26('0x2e')](_0xd34ad2[_0xce26('0x2c')],_0xd34ad2['query']);_0x5e82df[_0xce26('0x30')]=_['intersection'](_0xd34ad2[_0xce26('0x2c')],qs[_0xce26('0x31')](_0x241e91['query']['fields']));_0x5e82df[_0xce26('0x30')]=_0x5e82df[_0xce26('0x30')][_0xce26('0x32')]?_0x5e82df[_0xce26('0x30')]:_0xd34ad2[_0xce26('0x2c')];if(_0x241e91[_0xce26('0x2f')]['includeAll']){_0x5e82df[_0xce26('0x3b')]=[{'all':!![]}];}_0x5e82df=_[_0xce26('0x39')]({},_0x5e82df,_0x241e91[_0xce26('0x3a')]);return db[_0xce26('0x27')][_0xce26('0x41')](_0x5e82df)[_0xce26('0x20')](handleEntityNotFound(_0x5b3727,null))['then'](respondWithResult(_0x5b3727,null))[_0xce26('0x3e')](handleError(_0x5b3727,null));};exports[_0xce26('0x42')]=function(_0x7165d0,_0x393a49){return db[_0xce26('0x27')]['create'](_0x7165d0[_0xce26('0x43')],{})[_0xce26('0x20')](respondWithResult(_0x393a49,0xc9))[_0xce26('0x3e')](handleError(_0x393a49,null));};exports['update']=function(_0x3f01ed,_0x45115f){if(_0x3f01ed[_0xce26('0x43')]['id']){delete _0x3f01ed['body']['id'];}return db['FreshsalesConfiguration']['find']({'where':{'id':_0x3f01ed[_0xce26('0x44')]['id']}})['then'](handleEntityNotFound(_0x45115f,null))[_0xce26('0x20')](saveUpdates(_0x3f01ed[_0xce26('0x43')],null))['then'](respondWithResult(_0x45115f,null))[_0xce26('0x3e')](handleError(_0x45115f,null));};exports['destroy']=function(_0x2468b6,_0xaed818){return db[_0xce26('0x27')]['find']({'where':{'id':_0x2468b6[_0xce26('0x44')]['id']}})[_0xce26('0x20')](handleEntityNotFound(_0xaed818,null))[_0xce26('0x20')](removeEntity(_0xaed818,null))['catch'](handleError(_0xaed818,null));};exports[_0xce26('0x45')]=function(_0x538417,_0x53d792,_0x4bae07){var _0x98868c={};var _0x112bc9={};var _0x35cb61;var _0x252263;return db['FreshsalesConfiguration'][_0xce26('0x46')]({'where':{'id':_0x538417['params']['id']}})['then'](handleEntityNotFound(_0x53d792,null))[_0xce26('0x20')](function(_0x1b7d80){if(_0x1b7d80){_0x35cb61=_0x1b7d80;_0x112bc9[_0xce26('0x2c')]=_[_0xce26('0x40')](db['FreshsalesField']['rawAttributes']);_0x112bc9['query']=_[_0xce26('0x40')](_0x538417[_0xce26('0x2f')]);_0x112bc9[_0xce26('0x35')]=_['intersection'](_0x112bc9[_0xce26('0x2c')],_0x112bc9['query']);_0x98868c[_0xce26('0x30')]=_['intersection'](_0x112bc9[_0xce26('0x2c')],qs[_0xce26('0x31')](_0x538417['query'][_0xce26('0x31')]));_0x98868c[_0xce26('0x30')]=_0x98868c[_0xce26('0x30')][_0xce26('0x32')]?_0x98868c[_0xce26('0x30')]:_0x112bc9['model'];_0x98868c[_0xce26('0x47')]=qs[_0xce26('0x34')](_0x538417[_0xce26('0x2f')][_0xce26('0x34')]);_0x98868c[_0xce26('0x38')]=qs[_0xce26('0x35')](_[_0xce26('0x36')](_0x538417[_0xce26('0x2f')],_0x112bc9[_0xce26('0x35')]));if(_0x538417['query'][_0xce26('0x37')]){_0x98868c[_0xce26('0x38')]=_[_0xce26('0x39')](_0x98868c[_0xce26('0x38')],{'$or':_[_0xce26('0x2d')](_0x98868c['attributes'],function(_0x38e81d){var _0x3dacb6={};_0x3dacb6[_0x38e81d]={'$like':'%'+_0x538417[_0xce26('0x2f')][_0xce26('0x37')]+'%'};return _0x3dacb6;})});}_0x98868c=_[_0xce26('0x39')]({},_0x98868c,_0x538417[_0xce26('0x3a')]);return _0x35cb61[_0xce26('0x45')](_0x98868c);}})['then'](function(_0x7390ec){if(_0x7390ec){_0x252263=_0x7390ec[_0xce26('0x32')];if(!_0x538417[_0xce26('0x2f')][_0xce26('0x33')](_0xce26('0x48'))){_0x98868c[_0xce26('0x1c')]=qs[_0xce26('0x1c')](_0x538417['query']['limit']);_0x98868c[_0xce26('0x19')]=qs[_0xce26('0x19')](_0x538417[_0xce26('0x2f')][_0xce26('0x19')]);}return _0x35cb61[_0xce26('0x45')](_0x98868c);}})['then'](function(_0x3efafd){if(_0x3efafd){return _0x3efafd?{'count':_0x252263,'rows':_0x3efafd}:null;}})[_0xce26('0x20')](respondWithResult(_0x53d792,null))['catch'](handleError(_0x53d792,null));};exports[_0xce26('0x49')]=function(_0x332ba2,_0xf63531,_0x2faabd){var _0x191bf2={};var _0x335b3c={};var _0x30fe1e;var _0x114e97;return db[_0xce26('0x27')][_0xce26('0x46')]({'where':{'id':_0x332ba2[_0xce26('0x44')]['id']}})['then'](handleEntityNotFound(_0xf63531,null))['then'](function(_0x748245){if(_0x748245){_0x30fe1e=_0x748245;_0x335b3c[_0xce26('0x2c')]=_[_0xce26('0x40')](db['FreshsalesField'][_0xce26('0x28')]);_0x335b3c[_0xce26('0x2f')]=_[_0xce26('0x40')](_0x332ba2[_0xce26('0x2f')]);_0x335b3c[_0xce26('0x35')]=_[_0xce26('0x2e')](_0x335b3c['model'],_0x335b3c[_0xce26('0x2f')]);_0x191bf2[_0xce26('0x30')]=_[_0xce26('0x2e')](_0x335b3c[_0xce26('0x2c')],qs[_0xce26('0x31')](_0x332ba2[_0xce26('0x2f')]['fields']));_0x191bf2[_0xce26('0x30')]=_0x191bf2['attributes'][_0xce26('0x32')]?_0x191bf2[_0xce26('0x30')]:_0x335b3c[_0xce26('0x2c')];_0x191bf2['order']=qs['sort'](_0x332ba2[_0xce26('0x2f')][_0xce26('0x34')]);_0x191bf2[_0xce26('0x38')]=qs[_0xce26('0x35')](_[_0xce26('0x36')](_0x332ba2[_0xce26('0x2f')],_0x335b3c[_0xce26('0x35')]));if(_0x332ba2[_0xce26('0x2f')][_0xce26('0x37')]){_0x191bf2[_0xce26('0x38')]=_[_0xce26('0x39')](_0x191bf2['where'],{'$or':_['map'](_0x191bf2[_0xce26('0x30')],function(_0x3af104){var _0x7b0489={};_0x7b0489[_0x3af104]={'$like':'%'+_0x332ba2[_0xce26('0x2f')][_0xce26('0x37')]+'%'};return _0x7b0489;})});}_0x191bf2=_['merge']({},_0x191bf2,_0x332ba2[_0xce26('0x3a')]);return _0x30fe1e[_0xce26('0x49')](_0x191bf2);}})[_0xce26('0x20')](function(_0x28c463){if(_0x28c463){_0x114e97=_0x28c463[_0xce26('0x32')];if(!_0x332ba2[_0xce26('0x2f')][_0xce26('0x33')](_0xce26('0x48'))){_0x191bf2[_0xce26('0x1c')]=qs[_0xce26('0x1c')](_0x332ba2['query']['limit']);_0x191bf2[_0xce26('0x19')]=qs[_0xce26('0x19')](_0x332ba2['query']['offset']);}return _0x30fe1e[_0xce26('0x49')](_0x191bf2);}})['then'](function(_0x326df5){if(_0x326df5){return _0x326df5?{'count':_0x114e97,'rows':_0x326df5}:null;}})['then'](respondWithResult(_0xf63531,null))[_0xce26('0x3e')](handleError(_0xf63531,null));};exports[_0xce26('0x4a')]=function(_0x20a272,_0xbe8726,_0x4e7c24){var _0x18f8a9={};var _0x234097={};var _0x56feeb;var _0x199b6a;return db[_0xce26('0x27')][_0xce26('0x46')]({'where':{'id':_0x20a272[_0xce26('0x44')]['id']}})['then'](handleEntityNotFound(_0xbe8726,null))['then'](function(_0x246d08){if(_0x246d08){_0x56feeb=_0x246d08;_0x234097[_0xce26('0x2c')]=_[_0xce26('0x40')](db[_0xce26('0x4b')][_0xce26('0x28')]);_0x234097[_0xce26('0x2f')]=_[_0xce26('0x40')](_0x20a272[_0xce26('0x2f')]);_0x234097[_0xce26('0x35')]=_[_0xce26('0x2e')](_0x234097[_0xce26('0x2c')],_0x234097[_0xce26('0x2f')]);_0x18f8a9[_0xce26('0x30')]=_['intersection'](_0x234097['model'],qs[_0xce26('0x31')](_0x20a272[_0xce26('0x2f')][_0xce26('0x31')]));_0x18f8a9[_0xce26('0x30')]=_0x18f8a9['attributes'][_0xce26('0x32')]?_0x18f8a9['attributes']:_0x234097[_0xce26('0x2c')];_0x18f8a9[_0xce26('0x47')]=qs['sort'](_0x20a272['query'][_0xce26('0x34')]);_0x18f8a9['where']=qs[_0xce26('0x35')](_[_0xce26('0x36')](_0x20a272['query'],_0x234097[_0xce26('0x35')]));if(_0x20a272[_0xce26('0x2f')]['filter']){_0x18f8a9['where']=_[_0xce26('0x39')](_0x18f8a9[_0xce26('0x38')],{'$or':_[_0xce26('0x2d')](_0x18f8a9[_0xce26('0x30')],function(_0x3b43c5){var _0x15d32b={};_0x15d32b[_0x3b43c5]={'$like':'%'+_0x20a272['query'][_0xce26('0x37')]+'%'};return _0x15d32b;})});}_0x18f8a9=_[_0xce26('0x39')]({},_0x18f8a9,_0x20a272[_0xce26('0x3a')]);return _0x56feeb[_0xce26('0x4a')](_0x18f8a9);}})['then'](function(_0x4dd0f6){if(_0x4dd0f6){_0x199b6a=_0x4dd0f6[_0xce26('0x32')];if(!_0x20a272[_0xce26('0x2f')][_0xce26('0x33')](_0xce26('0x48'))){_0x18f8a9[_0xce26('0x1c')]=qs[_0xce26('0x1c')](_0x20a272[_0xce26('0x2f')]['limit']);_0x18f8a9[_0xce26('0x19')]=qs[_0xce26('0x19')](_0x20a272[_0xce26('0x2f')][_0xce26('0x19')]);}return _0x56feeb[_0xce26('0x4a')](_0x18f8a9);}})[_0xce26('0x20')](function(_0x285c21){if(_0x285c21){return _0x285c21?{'count':_0x199b6a,'rows':_0x285c21}:null;}})[_0xce26('0x20')](respondWithResult(_0xbe8726,null))[_0xce26('0x3e')](handleError(_0xbe8726,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 27a0abc..aa87251 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 _0xe378=['path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','moment','request-promise'];(function(_0x4a692c,_0x3a6887){var _0x183801=function(_0x41bef7){while(--_0x41bef7){_0x4a692c['push'](_0x4a692c['shift']());}};_0x183801(++_0x3a6887);}(_0xe378,0xa1));var _0x8e37=function(_0xa69592,_0x571583){_0xa69592=_0xa69592-0x0;var _0x4c5ec5=_0xe378[_0xa69592];return _0x4c5ec5;};'use strict';var _=require(_0x8e37('0x0'));var util=require('util');var logger=require(_0x8e37('0x1'))('api');var moment=require(_0x8e37('0x2'));var BPromise=require('bluebird');var rp=require(_0x8e37('0x3'));var fs=require('fs');var path=require(_0x8e37('0x4'));var rimraf=require('rimraf');var config=require(_0x8e37('0x5'));var attributes=require(_0x8e37('0x6'));module[_0x8e37('0x7')]=function(_0x3fa703,_0x521a34){return _0x3fa703[_0x8e37('0x8')](_0x8e37('0x9'),attributes,{'tableName':_0x8e37('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf357=['bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger','api','moment'];(function(_0x1e371f,_0x361627){var _0x4671ef=function(_0x1309f9){while(--_0x1309f9){_0x1e371f['push'](_0x1e371f['shift']());}};_0x4671ef(++_0x361627);}(_0xf357,0x1c3));var _0x7f35=function(_0x57e714,_0x2e6a1d){_0x57e714=_0x57e714-0x0;var _0x76b0c3=_0xf357[_0x57e714];return _0x76b0c3;};'use strict';var _=require(_0x7f35('0x0'));var util=require('util');var logger=require(_0x7f35('0x1'))(_0x7f35('0x2'));var moment=require(_0x7f35('0x3'));var BPromise=require(_0x7f35('0x4'));var rp=require(_0x7f35('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f35('0x6'));var config=require(_0x7f35('0x7'));var attributes=require(_0x7f35('0x8'));module[_0x7f35('0x9')]=function(_0x263544,_0x2f04d5){return _0x263544[_0x7f35('0xa')](_0x7f35('0xb'),attributes,{'tableName':_0x7f35('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 5ffb145..0dbf892 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 _0xda7b=['http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1e8d9a,_0x5794b8){var _0x181a8d=function(_0x1e9f92){while(--_0x1e9f92){_0x1e8d9a['push'](_0x1e8d9a['shift']());}};_0x181a8d(++_0x5794b8);}(_0xda7b,0x9d));var _0xbda7=function(_0x13bcff,_0x38bbbe){_0x13bcff=_0x13bcff-0x0;var _0x57ac7d=_0xda7b[_0x13bcff];return _0x57ac7d;};'use strict';var _=require('lodash');var util=require(_0xbda7('0x0'));var moment=require(_0xbda7('0x1'));var BPromise=require(_0xbda7('0x2'));var rs=require(_0xbda7('0x3'));var fs=require('fs');var Redis=require(_0xbda7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbda7('0x5'));var logger=require(_0xbda7('0x6'))(_0xbda7('0x7'));var config=require(_0xbda7('0x8'));var jayson=require(_0xbda7('0x9'));var client=jayson[_0xbda7('0xa')][_0xbda7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ecfd5,_0x1a7b20,_0x1de60a){return new BPromise(function(_0x2246ae,_0x18dc03){return client['request'](_0x1ecfd5,_0x1de60a)[_0xbda7('0xc')](function(_0x5bd119){logger[_0xbda7('0xd')](_0xbda7('0xe'),_0x1a7b20,_0xbda7('0xf'));logger['debug'](_0xbda7('0x10'),_0x1a7b20,_0xbda7('0xf'),JSON[_0xbda7('0x11')](_0x5bd119));if(_0x5bd119['error']){if(_0x5bd119[_0xbda7('0x12')]['code']===0x1f4){logger[_0xbda7('0x12')](_0xbda7('0xe'),_0x1a7b20,_0x5bd119[_0xbda7('0x12')][_0xbda7('0x13')]);return _0x18dc03(_0x5bd119[_0xbda7('0x12')][_0xbda7('0x13')]);}logger[_0xbda7('0x12')](_0xbda7('0xe'),_0x1a7b20,_0x5bd119[_0xbda7('0x12')][_0xbda7('0x13')]);return _0x2246ae(_0x5bd119[_0xbda7('0x12')]['message']);}else{logger[_0xbda7('0xd')](_0xbda7('0xe'),_0x1a7b20,'request\x20sent');_0x2246ae(_0x5bd119[_0xbda7('0x14')]['message']);}})['catch'](function(_0xff9865){logger[_0xbda7('0x12')](_0xbda7('0xe'),_0x1a7b20,_0xff9865);_0x18dc03(_0xff9865);});});} \ No newline at end of file +var _0xdd8b=['util','moment','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0xdd8b,0x1f3));var _0xbdd8=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0xdd8b[_0x50e593];return _0x3821d0;};'use strict';var _=require(_0xbdd8('0x0'));var util=require(_0xbdd8('0x1'));var moment=require(_0xbdd8('0x2'));var BPromise=require('bluebird');var rs=require(_0xbdd8('0x3'));var fs=require('fs');var Redis=require(_0xbdd8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xbdd8('0x5'));var jayson=require(_0xbdd8('0x6'));var client=jayson[_0xbdd8('0x7')][_0xbdd8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f6c44,_0x28c71d,_0x5bd5bd){return new BPromise(function(_0xfcc5c,_0x52da1b){return client[_0xbdd8('0x9')](_0x1f6c44,_0x5bd5bd)[_0xbdd8('0xa')](function(_0x56bb61){logger[_0xbdd8('0xb')](_0xbdd8('0xc'),_0x28c71d,_0xbdd8('0xd'));logger['debug'](_0xbdd8('0xe'),_0x28c71d,_0xbdd8('0xd'),JSON[_0xbdd8('0xf')](_0x56bb61));if(_0x56bb61[_0xbdd8('0x10')]){if(_0x56bb61['error']['code']===0x1f4){logger[_0xbdd8('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x28c71d,_0x56bb61[_0xbdd8('0x10')][_0xbdd8('0x11')]);return _0x52da1b(_0x56bb61[_0xbdd8('0x10')][_0xbdd8('0x11')]);}logger[_0xbdd8('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x28c71d,_0x56bb61['error'][_0xbdd8('0x11')]);return _0xfcc5c(_0x56bb61[_0xbdd8('0x10')][_0xbdd8('0x11')]);}else{logger[_0xbdd8('0xb')](_0xbdd8('0xc'),_0x28c71d,'request\x20sent');_0xfcc5c(_0x56bb61[_0xbdd8('0x12')][_0xbdd8('0x11')]);}})[_0xbdd8('0x13')](function(_0x31c38f){logger[_0xbdd8('0x10')](_0xbdd8('0xc'),_0x28c71d,_0x31c38f);_0x52da1b(_0x31c38f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 4ad27fc..c13792b 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 _0x2285=['destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','post','create','put','delete'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x2285,0x177));var _0x5228=function(_0x23f601,_0x2319f2){_0x23f601=_0x23f601-0x0;var _0x2f8575=_0x2285[_0x23f601];return _0x2f8575;};'use strict';var multer=require('multer');var util=require(_0x5228('0x0'));var path=require(_0x5228('0x1'));var timeout=require(_0x5228('0x2'));var express=require(_0x5228('0x3'));var router=express[_0x5228('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5228('0x5'));var interaction=require(_0x5228('0x6'));var config=require('../../config/environment');var controller=require(_0x5228('0x7'));router[_0x5228('0x8')]('/',auth[_0x5228('0x9')](),controller['index']);router[_0x5228('0x8')](_0x5228('0xa'),auth[_0x5228('0x9')](),controller[_0x5228('0xb')]);router[_0x5228('0xc')]('/',auth[_0x5228('0x9')](),controller[_0x5228('0xd')]);router[_0x5228('0xe')](_0x5228('0xa'),auth[_0x5228('0x9')](),controller['update']);router[_0x5228('0xf')](_0x5228('0xa'),auth[_0x5228('0x9')](),controller[_0x5228('0x10')]);module['exports']=router; \ No newline at end of file +var _0xec56=['update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x4bffde,_0x426ba5){var _0x5a9d12=function(_0xe3bc12){while(--_0xe3bc12){_0x4bffde['push'](_0x4bffde['shift']());}};_0x5a9d12(++_0x426ba5);}(_0xec56,0x1bd));var _0x6ec5=function(_0x2ef5b3,_0x3679a8){_0x2ef5b3=_0x2ef5b3-0x0;var _0x291b4e=_0xec56[_0x2ef5b3];return _0x291b4e;};'use strict';var multer=require(_0x6ec5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6ec5('0x1'));var express=require(_0x6ec5('0x2'));var router=express[_0x6ec5('0x3')]();var fs_extra=require(_0x6ec5('0x4'));var auth=require(_0x6ec5('0x5'));var interaction=require(_0x6ec5('0x6'));var config=require(_0x6ec5('0x7'));var controller=require(_0x6ec5('0x8'));router[_0x6ec5('0x9')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xb')]);router[_0x6ec5('0x9')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xd')]);router[_0x6ec5('0xe')]('/',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0xf')]);router[_0x6ec5('0x10')]('/:id',auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x11')]);router[_0x6ec5('0x12')](_0x6ec5('0xc'),auth[_0x6ec5('0xa')](),controller[_0x6ec5('0x13')]);module[_0x6ec5('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index c37c0de..b084bd6 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 _0x7aab=['ENUM','string','variable','keyValue','STRING','customVariable','sequelize'];(function(_0x946ba9,_0x2a0129){var _0x23b228=function(_0x155d75){while(--_0x155d75){_0x946ba9['push'](_0x946ba9['shift']());}};_0x23b228(++_0x2a0129);}(_0x7aab,0x7d));var _0xb7aa=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7aab[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xb7aa('0x0'));module['exports']={'type':{'type':Sequelize[_0xb7aa('0x1')](_0xb7aa('0x2'),_0xb7aa('0x3'),'customVariable',_0xb7aa('0x4'),'picklist'),'defaultValue':_0xb7aa('0x2')},'content':{'type':Sequelize[_0xb7aa('0x5')]},'key':{'type':Sequelize[_0xb7aa('0x5')]},'keyType':{'type':Sequelize[_0xb7aa('0x1')](_0xb7aa('0x2'),_0xb7aa('0x3'),_0xb7aa('0x6'))},'keyContent':{'type':Sequelize[_0xb7aa('0x5')]},'idField':{'type':Sequelize[_0xb7aa('0x5')]},'nameField':{'type':Sequelize[_0xb7aa('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb7aa('0x5')]}}; \ No newline at end of file +var _0xd989=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x206c55,_0x103b17){var _0x33cf66=function(_0xcb186c){while(--_0xcb186c){_0x206c55['push'](_0x206c55['shift']());}};_0x33cf66(++_0x103b17);}(_0xd989,0x1e9));var _0x9d98=function(_0x3ba566,_0x5e009d){_0x3ba566=_0x3ba566-0x0;var _0x480317=_0xd989[_0x3ba566];return _0x480317;};'use strict';var Sequelize=require(_0x9d98('0x0'));module[_0x9d98('0x1')]={'type':{'type':Sequelize[_0x9d98('0x2')](_0x9d98('0x3'),_0x9d98('0x4'),_0x9d98('0x5'),_0x9d98('0x6'),_0x9d98('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x9d98('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9d98('0x2')](_0x9d98('0x3'),_0x9d98('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9d98('0x8')]},'nameField':{'type':Sequelize[_0x9d98('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9d98('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index b4f72f4..e806cde 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 _0xcdeb=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit'];(function(_0x25c398,_0x13284b){var _0x3311bc=function(_0x383d58){while(--_0x383d58){_0x25c398['push'](_0x25c398['shift']());}};_0x3311bc(++_0x13284b);}(_0xcdeb,0xab));var _0xbcde=function(_0x59c234,_0x190b5a){_0x59c234=_0x59c234-0x0;var _0x32956b=_0xcdeb[_0x59c234];return _0x32956b;};'use strict';var emlformat=require(_0xbcde('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbcde('0x1'));var rp=require(_0xbcde('0x2'));var moment=require(_0xbcde('0x3'));var BPromise=require(_0xbcde('0x4'));var Mustache=require(_0xbcde('0x5'));var util=require(_0xbcde('0x6'));var path=require(_0xbcde('0x7'));var sox=require(_0xbcde('0x8'));var csv=require(_0xbcde('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbcde('0xa'));var squel=require(_0xbcde('0xb'));var crypto=require(_0xbcde('0xc'));var jsforce=require(_0xbcde('0xd'));var deskjs=require(_0xbcde('0xe'));var toCsv=require(_0xbcde('0x9'));var querystring=require(_0xbcde('0xf'));var Papa=require(_0xbcde('0x10'));var Redis=require(_0xbcde('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbcde('0x12'));var as=require(_0xbcde('0x13'));var hardwareService=require(_0xbcde('0x14'));var logger=require(_0xbcde('0x15'))(_0xbcde('0x16'));var utils=require(_0xbcde('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbcde('0x18'));var db=require(_0xbcde('0x19'))['db'];function respondWithStatusCode(_0x38ccb9,_0x26d435){_0x26d435=_0x26d435||0xcc;return function(_0x510d77){if(_0x510d77){return _0x38ccb9['sendStatus'](_0x26d435);}return _0x38ccb9['status'](_0x26d435)[_0xbcde('0x1a')]();};}function respondWithResult(_0x1d6fa1,_0x36365a){_0x36365a=_0x36365a||0xc8;return function(_0x2e6aa0){if(_0x2e6aa0){return _0x1d6fa1[_0xbcde('0x1b')](_0x36365a)[_0xbcde('0x1c')](_0x2e6aa0);}};}function respondWithFilteredResult(_0x31232d,_0x1c8b88){return function(_0x350d66){if(_0x350d66){var _0x2acd91=typeof _0x1c8b88[_0xbcde('0x1d')]===_0xbcde('0x1e')&&typeof _0x1c8b88[_0xbcde('0x1f')]===_0xbcde('0x1e');var _0x566a7d=_0x350d66[_0xbcde('0x20')];var _0xfebc04=_0x2acd91?0x0:_0x1c8b88[_0xbcde('0x1d')];var _0x590355=_0x2acd91?_0x350d66[_0xbcde('0x20')]:_0x1c8b88[_0xbcde('0x1d')]+_0x1c8b88[_0xbcde('0x1f')];var _0x14d863;if(_0x590355>=_0x566a7d){_0x590355=_0x566a7d;_0x14d863=0xc8;}else{_0x14d863=0xce;}_0x31232d[_0xbcde('0x1b')](_0x14d863);return _0x31232d['set'](_0xbcde('0x21'),_0xfebc04+'-'+_0x590355+'/'+_0x566a7d)[_0xbcde('0x1c')](_0x350d66);}return null;};}function patchUpdates(_0x5155bc){return function(_0x2e49e6){try{jsonpatch[_0xbcde('0x22')](_0x2e49e6,_0x5155bc,!![]);}catch(_0x5da435){return BPromise[_0xbcde('0x23')](_0x5da435);}return _0x2e49e6[_0xbcde('0x24')]();};}function saveUpdates(_0x4e754d,_0x558245){return function(_0x2a0c59){if(_0x2a0c59){return _0x2a0c59[_0xbcde('0x25')](_0x4e754d)[_0xbcde('0x26')](function(_0x55c6dd){return _0x55c6dd;});}return null;};}function removeEntity(_0x25a770,_0x56752c){return function(_0x54aa9b){if(_0x54aa9b){return _0x54aa9b[_0xbcde('0x27')]()['then'](function(){_0x25a770[_0xbcde('0x1b')](0xcc)[_0xbcde('0x1a')]();});}};}function handleEntityNotFound(_0x5cd30d,_0xac7cc4){return function(_0x443355){if(!_0x443355){_0x5cd30d[_0xbcde('0x28')](0x194);}return _0x443355;};}function handleError(_0x16e81a,_0x459302){_0x459302=_0x459302||0x1f4;return function(_0x3753cd){logger[_0xbcde('0x29')](_0x3753cd['stack']);if(_0x3753cd['name']){delete _0x3753cd[_0xbcde('0x2a')];}_0x16e81a[_0xbcde('0x1b')](_0x459302)[_0xbcde('0x2b')](_0x3753cd);};}exports[_0xbcde('0x2c')]=function(_0x418acf,_0x4cf105){var _0x1f5e7a={},_0x22ea34={},_0x4d807a={'count':0x0,'rows':[]};var _0x5de692=_[_0xbcde('0x2d')](db[_0xbcde('0x2e')][_0xbcde('0x2f')],function(_0xde1855){return{'name':_0xde1855[_0xbcde('0x30')],'type':_0xde1855[_0xbcde('0x31')][_0xbcde('0x32')]};});_0x22ea34[_0xbcde('0x33')]=_[_0xbcde('0x2d')](_0x5de692,_0xbcde('0x2a'));_0x22ea34[_0xbcde('0x34')]=_[_0xbcde('0x35')](_0x418acf[_0xbcde('0x34')]);_0x22ea34[_0xbcde('0x36')]=_['intersection'](_0x22ea34['model'],_0x22ea34[_0xbcde('0x34')]);_0x1f5e7a[_0xbcde('0x37')]=_[_0xbcde('0x38')](_0x22ea34[_0xbcde('0x33')],qs[_0xbcde('0x39')](_0x418acf[_0xbcde('0x34')][_0xbcde('0x39')]));_0x1f5e7a[_0xbcde('0x37')]=_0x1f5e7a[_0xbcde('0x37')]['length']?_0x1f5e7a[_0xbcde('0x37')]:_0x22ea34['model'];if(!_0x418acf[_0xbcde('0x34')][_0xbcde('0x3a')](_0xbcde('0x3b'))){_0x1f5e7a['limit']=qs[_0xbcde('0x1f')](_0x418acf['query'][_0xbcde('0x1f')]);_0x1f5e7a[_0xbcde('0x1d')]=qs['offset'](_0x418acf[_0xbcde('0x34')]['offset']);}_0x1f5e7a[_0xbcde('0x3c')]=qs[_0xbcde('0x3d')](_0x418acf[_0xbcde('0x34')]['sort']);_0x1f5e7a[_0xbcde('0x3e')]=qs['filters'](_[_0xbcde('0x3f')](_0x418acf[_0xbcde('0x34')],_0x22ea34[_0xbcde('0x36')]),_0x5de692);if(_0x418acf[_0xbcde('0x34')][_0xbcde('0x40')]){_0x1f5e7a[_0xbcde('0x3e')]=_[_0xbcde('0x41')](_0x1f5e7a[_0xbcde('0x3e')],{'$or':_[_0xbcde('0x2d')](_0x5de692,function(_0x14a791){if(_0x14a791[_0xbcde('0x31')]!==_0xbcde('0x42')){var _0x12f425={};_0x12f425[_0x14a791[_0xbcde('0x2a')]]={'$like':'%'+_0x418acf[_0xbcde('0x34')][_0xbcde('0x40')]+'%'};return _0x12f425;}})});}_0x1f5e7a=_[_0xbcde('0x41')]({},_0x1f5e7a,_0x418acf[_0xbcde('0x43')]);var _0x106e39={'where':_0x1f5e7a[_0xbcde('0x3e')]};return db[_0xbcde('0x2e')][_0xbcde('0x20')](_0x106e39)[_0xbcde('0x26')](function(_0xae4cba){_0x4d807a[_0xbcde('0x20')]=_0xae4cba;if(_0x418acf['query'][_0xbcde('0x44')]){_0x1f5e7a['include']=[{'all':!![]}];}return db[_0xbcde('0x2e')][_0xbcde('0x45')](_0x1f5e7a);})[_0xbcde('0x26')](function(_0x2eb895){_0x4d807a['rows']=_0x2eb895;return _0x4d807a;})[_0xbcde('0x26')](respondWithFilteredResult(_0x4cf105,_0x1f5e7a))[_0xbcde('0x46')](handleError(_0x4cf105,null));};exports[_0xbcde('0x47')]=function(_0x47a33d,_0x8ec215){var _0x5c4403={'raw':!![],'where':{'id':_0x47a33d[_0xbcde('0x48')]['id']}},_0x208ae7={};_0x208ae7['model']=_['keys'](db[_0xbcde('0x2e')][_0xbcde('0x2f')]);_0x208ae7[_0xbcde('0x34')]=_['keys'](_0x47a33d[_0xbcde('0x34')]);_0x208ae7[_0xbcde('0x36')]=_[_0xbcde('0x38')](_0x208ae7[_0xbcde('0x33')],_0x208ae7[_0xbcde('0x34')]);_0x5c4403[_0xbcde('0x37')]=_[_0xbcde('0x38')](_0x208ae7[_0xbcde('0x33')],qs[_0xbcde('0x39')](_0x47a33d['query']['fields']));_0x5c4403[_0xbcde('0x37')]=_0x5c4403[_0xbcde('0x37')]['length']?_0x5c4403[_0xbcde('0x37')]:_0x208ae7['model'];if(_0x47a33d['query']['includeAll']){_0x5c4403[_0xbcde('0x49')]=[{'all':!![]}];}_0x5c4403=_['merge']({},_0x5c4403,_0x47a33d[_0xbcde('0x43')]);return db['FreshsalesField'][_0xbcde('0x4a')](_0x5c4403)['then'](handleEntityNotFound(_0x8ec215,null))[_0xbcde('0x26')](respondWithResult(_0x8ec215,null))[_0xbcde('0x46')](handleError(_0x8ec215,null));};exports[_0xbcde('0x4b')]=function(_0x499520,_0xb266a2){return db[_0xbcde('0x2e')][_0xbcde('0x4b')](_0x499520[_0xbcde('0x4c')],{})['then'](respondWithResult(_0xb266a2,0xc9))[_0xbcde('0x46')](handleError(_0xb266a2,null));};exports[_0xbcde('0x25')]=function(_0x380e5f,_0x14653c){if(_0x380e5f[_0xbcde('0x4c')]['id']){delete _0x380e5f[_0xbcde('0x4c')]['id'];}return db[_0xbcde('0x2e')][_0xbcde('0x4a')]({'where':{'id':_0x380e5f[_0xbcde('0x48')]['id']}})[_0xbcde('0x26')](handleEntityNotFound(_0x14653c,null))['then'](saveUpdates(_0x380e5f[_0xbcde('0x4c')],null))[_0xbcde('0x26')](respondWithResult(_0x14653c,null))[_0xbcde('0x46')](handleError(_0x14653c,null));};exports[_0xbcde('0x27')]=function(_0x2eaf92,_0x4573c6){return db[_0xbcde('0x2e')]['find']({'where':{'id':_0x2eaf92[_0xbcde('0x48')]['id']}})[_0xbcde('0x26')](handleEntityNotFound(_0x4573c6,null))[_0xbcde('0x26')](removeEntity(_0x4573c6,null))[_0xbcde('0x46')](handleError(_0x4573c6,null));}; \ No newline at end of file +var _0xe702=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','catch','show','filters','include','find','create','params','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service'];(function(_0x57354a,_0x47df5d){var _0x211be7=function(_0xa5ceb8){while(--_0xa5ceb8){_0x57354a['push'](_0x57354a['shift']());}};_0x211be7(++_0x47df5d);}(_0xe702,0x1bc));var _0x2e70=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe702[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x2e70('0x0'));var rimraf=require(_0x2e70('0x1'));var zipdir=require(_0x2e70('0x2'));var jsonpatch=require(_0x2e70('0x3'));var rp=require(_0x2e70('0x4'));var moment=require(_0x2e70('0x5'));var BPromise=require(_0x2e70('0x6'));var Mustache=require('mustache');var util=require(_0x2e70('0x7'));var path=require(_0x2e70('0x8'));var sox=require(_0x2e70('0x9'));var csv=require(_0x2e70('0xa'));var ejs=require(_0x2e70('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e70('0xc'));var squel=require(_0x2e70('0xd'));var crypto=require('crypto');var jsforce=require(_0x2e70('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2e70('0xa'));var querystring=require(_0x2e70('0xf'));var Papa=require('papaparse');var Redis=require(_0x2e70('0x10'));var authService=require(_0x2e70('0x11'));var qs=require(_0x2e70('0x12'));var as=require(_0x2e70('0x13'));var hardwareService=require(_0x2e70('0x14'));var logger=require(_0x2e70('0x15'))(_0x2e70('0x16'));var utils=require('../../config/utils');var config=require(_0x2e70('0x17'));var licenseUtil=require(_0x2e70('0x18'));var db=require(_0x2e70('0x19'))['db'];function respondWithStatusCode(_0x55d708,_0x2a5238){_0x2a5238=_0x2a5238||0xcc;return function(_0x3bcf61){if(_0x3bcf61){return _0x55d708[_0x2e70('0x1a')](_0x2a5238);}return _0x55d708['status'](_0x2a5238)['end']();};}function respondWithResult(_0x5a56cd,_0x267f9d){_0x267f9d=_0x267f9d||0xc8;return function(_0x58f2e3){if(_0x58f2e3){return _0x5a56cd[_0x2e70('0x1b')](_0x267f9d)['json'](_0x58f2e3);}};}function respondWithFilteredResult(_0x6b1ec1,_0x369fb3){return function(_0x55638e){if(_0x55638e){var _0x4a363f=typeof _0x369fb3[_0x2e70('0x1c')]===_0x2e70('0x1d')&&typeof _0x369fb3[_0x2e70('0x1e')]===_0x2e70('0x1d');var _0x115d80=_0x55638e['count'];var _0x5bac0b=_0x4a363f?0x0:_0x369fb3[_0x2e70('0x1c')];var _0x8a1e1=_0x4a363f?_0x55638e[_0x2e70('0x1f')]:_0x369fb3[_0x2e70('0x1c')]+_0x369fb3[_0x2e70('0x1e')];var _0x17fe73;if(_0x8a1e1>=_0x115d80){_0x8a1e1=_0x115d80;_0x17fe73=0xc8;}else{_0x17fe73=0xce;}_0x6b1ec1[_0x2e70('0x1b')](_0x17fe73);return _0x6b1ec1[_0x2e70('0x20')](_0x2e70('0x21'),_0x5bac0b+'-'+_0x8a1e1+'/'+_0x115d80)[_0x2e70('0x22')](_0x55638e);}return null;};}function patchUpdates(_0x7fbb4d){return function(_0x14c435){try{jsonpatch[_0x2e70('0x23')](_0x14c435,_0x7fbb4d,!![]);}catch(_0x41850d){return BPromise[_0x2e70('0x24')](_0x41850d);}return _0x14c435[_0x2e70('0x25')]();};}function saveUpdates(_0x3febf0,_0x1cfc43){return function(_0x1e1952){if(_0x1e1952){return _0x1e1952[_0x2e70('0x26')](_0x3febf0)['then'](function(_0x43c2b0){return _0x43c2b0;});}return null;};}function removeEntity(_0x5740c4,_0x3d25b4){return function(_0x3f55e8){if(_0x3f55e8){return _0x3f55e8[_0x2e70('0x27')]()[_0x2e70('0x28')](function(){_0x5740c4[_0x2e70('0x1b')](0xcc)[_0x2e70('0x29')]();});}};}function handleEntityNotFound(_0x1997a6,_0x5eebe0){return function(_0x492f19){if(!_0x492f19){_0x1997a6[_0x2e70('0x1a')](0x194);}return _0x492f19;};}function handleError(_0x1e6fb9,_0x1fa771){_0x1fa771=_0x1fa771||0x1f4;return function(_0xbcf39b){logger[_0x2e70('0x2a')](_0xbcf39b['stack']);if(_0xbcf39b[_0x2e70('0x2b')]){delete _0xbcf39b[_0x2e70('0x2b')];}_0x1e6fb9[_0x2e70('0x1b')](_0x1fa771)[_0x2e70('0x2c')](_0xbcf39b);};}exports[_0x2e70('0x2d')]=function(_0x49f1ce,_0xc12b1){var _0x404ec7={},_0x69a9be={},_0x447f89={'count':0x0,'rows':[]};var _0x1b4e12=_[_0x2e70('0x2e')](db[_0x2e70('0x2f')][_0x2e70('0x30')],function(_0x562c05){return{'name':_0x562c05[_0x2e70('0x31')],'type':_0x562c05[_0x2e70('0x32')][_0x2e70('0x33')]};});_0x69a9be['model']=_[_0x2e70('0x2e')](_0x1b4e12,_0x2e70('0x2b'));_0x69a9be[_0x2e70('0x34')]=_[_0x2e70('0x35')](_0x49f1ce[_0x2e70('0x34')]);_0x69a9be['filters']=_[_0x2e70('0x36')](_0x69a9be[_0x2e70('0x37')],_0x69a9be[_0x2e70('0x34')]);_0x404ec7[_0x2e70('0x38')]=_['intersection'](_0x69a9be[_0x2e70('0x37')],qs[_0x2e70('0x39')](_0x49f1ce[_0x2e70('0x34')]['fields']));_0x404ec7[_0x2e70('0x38')]=_0x404ec7[_0x2e70('0x38')][_0x2e70('0x3a')]?_0x404ec7[_0x2e70('0x38')]:_0x69a9be[_0x2e70('0x37')];if(!_0x49f1ce[_0x2e70('0x34')]['hasOwnProperty'](_0x2e70('0x3b'))){_0x404ec7['limit']=qs[_0x2e70('0x1e')](_0x49f1ce[_0x2e70('0x34')][_0x2e70('0x1e')]);_0x404ec7[_0x2e70('0x1c')]=qs[_0x2e70('0x1c')](_0x49f1ce[_0x2e70('0x34')][_0x2e70('0x1c')]);}_0x404ec7[_0x2e70('0x3c')]=qs[_0x2e70('0x3d')](_0x49f1ce[_0x2e70('0x34')]['sort']);_0x404ec7[_0x2e70('0x3e')]=qs['filters'](_[_0x2e70('0x3f')](_0x49f1ce['query'],_0x69a9be['filters']),_0x1b4e12);if(_0x49f1ce[_0x2e70('0x34')]['filter']){_0x404ec7[_0x2e70('0x3e')]=_[_0x2e70('0x40')](_0x404ec7[_0x2e70('0x3e')],{'$or':_['map'](_0x1b4e12,function(_0x44683a){if(_0x44683a[_0x2e70('0x32')]!==_0x2e70('0x41')){var _0x5dedd2={};_0x5dedd2[_0x44683a[_0x2e70('0x2b')]]={'$like':'%'+_0x49f1ce[_0x2e70('0x34')][_0x2e70('0x42')]+'%'};return _0x5dedd2;}})});}_0x404ec7=_[_0x2e70('0x40')]({},_0x404ec7,_0x49f1ce[_0x2e70('0x43')]);var _0x284878={'where':_0x404ec7[_0x2e70('0x3e')]};return db[_0x2e70('0x2f')]['count'](_0x284878)[_0x2e70('0x28')](function(_0x32bf42){_0x447f89[_0x2e70('0x1f')]=_0x32bf42;if(_0x49f1ce[_0x2e70('0x34')][_0x2e70('0x44')]){_0x404ec7['include']=[{'all':!![]}];}return db[_0x2e70('0x2f')]['findAll'](_0x404ec7);})[_0x2e70('0x28')](function(_0x5977c7){_0x447f89['rows']=_0x5977c7;return _0x447f89;})['then'](respondWithFilteredResult(_0xc12b1,_0x404ec7))[_0x2e70('0x45')](handleError(_0xc12b1,null));};exports[_0x2e70('0x46')]=function(_0x160ed6,_0x5dbe00){var _0x278a55={'raw':!![],'where':{'id':_0x160ed6['params']['id']}},_0x42c65f={};_0x42c65f[_0x2e70('0x37')]=_[_0x2e70('0x35')](db[_0x2e70('0x2f')][_0x2e70('0x30')]);_0x42c65f['query']=_['keys'](_0x160ed6[_0x2e70('0x34')]);_0x42c65f[_0x2e70('0x47')]=_[_0x2e70('0x36')](_0x42c65f[_0x2e70('0x37')],_0x42c65f[_0x2e70('0x34')]);_0x278a55[_0x2e70('0x38')]=_[_0x2e70('0x36')](_0x42c65f[_0x2e70('0x37')],qs[_0x2e70('0x39')](_0x160ed6['query'][_0x2e70('0x39')]));_0x278a55[_0x2e70('0x38')]=_0x278a55[_0x2e70('0x38')][_0x2e70('0x3a')]?_0x278a55[_0x2e70('0x38')]:_0x42c65f[_0x2e70('0x37')];if(_0x160ed6[_0x2e70('0x34')]['includeAll']){_0x278a55[_0x2e70('0x48')]=[{'all':!![]}];}_0x278a55=_[_0x2e70('0x40')]({},_0x278a55,_0x160ed6[_0x2e70('0x43')]);return db[_0x2e70('0x2f')][_0x2e70('0x49')](_0x278a55)[_0x2e70('0x28')](handleEntityNotFound(_0x5dbe00,null))[_0x2e70('0x28')](respondWithResult(_0x5dbe00,null))[_0x2e70('0x45')](handleError(_0x5dbe00,null));};exports[_0x2e70('0x4a')]=function(_0x3e370d,_0x2fe756){return db[_0x2e70('0x2f')]['create'](_0x3e370d['body'],{})[_0x2e70('0x28')](respondWithResult(_0x2fe756,0xc9))[_0x2e70('0x45')](handleError(_0x2fe756,null));};exports[_0x2e70('0x26')]=function(_0xa3b2cc,_0x5a1d21){if(_0xa3b2cc['body']['id']){delete _0xa3b2cc['body']['id'];}return db[_0x2e70('0x2f')][_0x2e70('0x49')]({'where':{'id':_0xa3b2cc[_0x2e70('0x4b')]['id']}})[_0x2e70('0x28')](handleEntityNotFound(_0x5a1d21,null))[_0x2e70('0x28')](saveUpdates(_0xa3b2cc[_0x2e70('0x4c')],null))[_0x2e70('0x28')](respondWithResult(_0x5a1d21,null))[_0x2e70('0x45')](handleError(_0x5a1d21,null));};exports[_0x2e70('0x27')]=function(_0xf00eb7,_0x13ca82){return db[_0x2e70('0x2f')]['find']({'where':{'id':_0xf00eb7['params']['id']}})[_0x2e70('0x28')](handleEntityNotFound(_0x13ca82,null))[_0x2e70('0x28')](removeEntity(_0x13ca82,null))[_0x2e70('0x45')](handleError(_0x13ca82,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index bbb6173..54be785 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 _0x97b2=['exports','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intFreshsalesField.attributes'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x97b2,0x1b7));var _0x297b=function(_0x256684,_0x529c1e){_0x256684=_0x256684-0x0;var _0x37a0c9=_0x97b2[_0x256684];return _0x37a0c9;};'use strict';var _=require(_0x297b('0x0'));var util=require(_0x297b('0x1'));var logger=require(_0x297b('0x2'))(_0x297b('0x3'));var moment=require(_0x297b('0x4'));var BPromise=require(_0x297b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x297b('0x6'));var rimraf=require(_0x297b('0x7'));var config=require('../../config/environment');var attributes=require(_0x297b('0x8'));module[_0x297b('0x9')]=function(_0x5ef74e,_0x596f9c){return _0x5ef74e['define'](_0x297b('0xa'),attributes,{'tableName':_0x297b('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x297b('0xc'),_0x297b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd386=['freshsales_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','int_freshsales_fields'];(function(_0x27324c,_0x9599a0){var _0x271256=function(_0x3ec958){while(--_0x3ec958){_0x27324c['push'](_0x27324c['shift']());}};_0x271256(++_0x9599a0);}(_0xd386,0x10c));var _0x6d38=function(_0x53bf11,_0x3acb5e){_0x53bf11=_0x53bf11-0x0;var _0x3a4f47=_0xd386[_0x53bf11];return _0x3a4f47;};'use strict';var _=require(_0x6d38('0x0'));var util=require(_0x6d38('0x1'));var logger=require(_0x6d38('0x2'))('api');var moment=require(_0x6d38('0x3'));var BPromise=require(_0x6d38('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6d38('0x5'));var rimraf=require(_0x6d38('0x6'));var config=require(_0x6d38('0x7'));var attributes=require(_0x6d38('0x8'));module['exports']=function(_0x1a54fa,_0x25eef5){return _0x1a54fa[_0x6d38('0x9')](_0x6d38('0xa'),attributes,{'tableName':_0x6d38('0xb'),'paranoid':![],'indexes':[{'name':_0x6d38('0xc'),'fields':['idField',_0x6d38('0xd')],'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 da7f458..7f2b1e9 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 _0x2bd8=['info','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x437ec0,_0x50f051){var _0x5840d5=function(_0xe81020){while(--_0xe81020){_0x437ec0['push'](_0x437ec0['shift']());}};_0x5840d5(++_0x50f051);}(_0x2bd8,0x130));var _0x82bd=function(_0x5da670,_0x20b10a){_0x5da670=_0x5da670-0x0;var _0x33f423=_0x2bd8[_0x5da670];return _0x33f423;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var moment=require(_0x82bd('0x1'));var BPromise=require(_0x82bd('0x2'));var rs=require(_0x82bd('0x3'));var fs=require('fs');var Redis=require(_0x82bd('0x4'));var db=require(_0x82bd('0x5'))['db'];var utils=require(_0x82bd('0x6'));var logger=require(_0x82bd('0x7'))('rpc');var config=require(_0x82bd('0x8'));var jayson=require(_0x82bd('0x9'));var client=jayson[_0x82bd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19dbb1,_0x77d7a9,_0x226f60){return new BPromise(function(_0x1f7463,_0x4dc3a6){return client[_0x82bd('0xb')](_0x19dbb1,_0x226f60)['then'](function(_0x4a9b2c){logger['info'](_0x82bd('0xc'),_0x77d7a9,'request\x20sent');logger['debug'](_0x82bd('0xd'),_0x77d7a9,'request\x20sent',JSON['stringify'](_0x4a9b2c));if(_0x4a9b2c[_0x82bd('0xe')]){if(_0x4a9b2c[_0x82bd('0xe')]['code']===0x1f4){logger[_0x82bd('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x77d7a9,_0x4a9b2c[_0x82bd('0xe')]['message']);return _0x4dc3a6(_0x4a9b2c[_0x82bd('0xe')][_0x82bd('0xf')]);}logger[_0x82bd('0xe')](_0x82bd('0xc'),_0x77d7a9,_0x4a9b2c['error'][_0x82bd('0xf')]);return _0x1f7463(_0x4a9b2c[_0x82bd('0xe')]['message']);}else{logger[_0x82bd('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x77d7a9,_0x82bd('0x11'));_0x1f7463(_0x4a9b2c[_0x82bd('0x12')][_0x82bd('0xf')]);}})[_0x82bd('0x13')](function(_0x209081){logger[_0x82bd('0xe')](_0x82bd('0xc'),_0x77d7a9,_0x209081);_0x4dc3a6(_0x209081);});});} \ No newline at end of file +var _0x9536=['request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesField,\x20%s,\x20%s'];(function(_0x197fb8,_0x3638a0){var _0x5252d2=function(_0xb7cccb){while(--_0xb7cccb){_0x197fb8['push'](_0x197fb8['shift']());}};_0x5252d2(++_0x3638a0);}(_0x9536,0x179));var _0x6953=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0x9536[_0x4704dc];return _0x254d81;};'use strict';var _=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var BPromise=require(_0x6953('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6953('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6953('0x5'));var logger=require(_0x6953('0x6'))(_0x6953('0x7'));var config=require(_0x6953('0x8'));var jayson=require(_0x6953('0x9'));var client=jayson['client'][_0x6953('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bb026,_0x385f2d,_0x3e1aff){return new BPromise(function(_0x1c8225,_0x58ac30){return client[_0x6953('0xb')](_0x2bb026,_0x3e1aff)[_0x6953('0xc')](function(_0x449acb){logger['info'](_0x6953('0xd'),_0x385f2d,_0x6953('0xe'));logger[_0x6953('0xf')](_0x6953('0x10'),_0x385f2d,_0x6953('0xe'),JSON[_0x6953('0x11')](_0x449acb));if(_0x449acb[_0x6953('0x12')]){if(_0x449acb[_0x6953('0x12')][_0x6953('0x13')]===0x1f4){logger['error'](_0x6953('0xd'),_0x385f2d,_0x449acb['error'][_0x6953('0x14')]);return _0x58ac30(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}logger[_0x6953('0x12')](_0x6953('0xd'),_0x385f2d,_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);return _0x1c8225(_0x449acb[_0x6953('0x12')][_0x6953('0x14')]);}else{logger[_0x6953('0x15')](_0x6953('0xd'),_0x385f2d,'request\x20sent');_0x1c8225(_0x449acb['result'][_0x6953('0x14')]);}})[_0x6953('0x16')](function(_0x16b79b){logger[_0x6953('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x385f2d,_0x16b79b);_0x58ac30(_0x16b79b);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 1af51a7..56fd420 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(_0xee410e,_0x2678e6){var _0x3d58ec=function(_0x55494d){while(--_0x55494d){_0xee410e['push'](_0xee410e['shift']());}};_0x3d58ec(++_0x2678e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +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(_0x3610c8,_0x24a8eb){var _0x363d3e=function(_0x4969b6){while(--_0x4969b6){_0x3610c8['push'](_0x3610c8['shift']());}};_0x363d3e(++_0x24a8eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index f2b5853..cc04273 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 _0xd301=['integrationTab','sequelize','STRING','username','ENUM','newTab'];(function(_0x4c5e74,_0x319d00){var _0x48b7f6=function(_0x247742){while(--_0x247742){_0x4c5e74['push'](_0x4c5e74['shift']());}};_0x48b7f6(++_0x319d00);}(_0xd301,0x145));var _0x1d30=function(_0x2c2f35,_0x20cda1){_0x2c2f35=_0x2c2f35-0x0;var _0x543b7e=_0xd301[_0x2c2f35];return _0x543b7e;};'use strict';var Sequelize=require(_0x1d30('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1d30('0x1')],'unique':_0x1d30('0x2')},'remoteUri':{'type':Sequelize[_0x1d30('0x1')]},'password':{'type':Sequelize[_0x1d30('0x1')]},'clientId':{'type':Sequelize[_0x1d30('0x1')]},'clientSecret':{'type':Sequelize[_0x1d30('0x1')]},'securityToken':{'type':Sequelize[_0x1d30('0x1')]},'serverUrl':{'type':Sequelize[_0x1d30('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1d30('0x3')]('integrationTab',_0x1d30('0x4')),'defaultValue':_0x1d30('0x5')}}; \ No newline at end of file +var _0xdf94=['STRING','username','ENUM','integrationTab','newTab','exports'];(function(_0x20a68a,_0x54502e){var _0x56c5d4=function(_0x4ace56){while(--_0x4ace56){_0x20a68a['push'](_0x20a68a['shift']());}};_0x56c5d4(++_0x54502e);}(_0xdf94,0xad));var _0x4df9=function(_0x37d9d6,_0x4821dd){_0x37d9d6=_0x37d9d6-0x0;var _0x4e62e8=_0xdf94[_0x37d9d6];return _0x4e62e8;};'use strict';var Sequelize=require('sequelize');module[_0x4df9('0x0')]={'name':{'type':Sequelize[_0x4df9('0x1')]},'description':{'type':Sequelize[_0x4df9('0x1')]},'username':{'type':Sequelize[_0x4df9('0x1')],'unique':_0x4df9('0x2')},'remoteUri':{'type':Sequelize[_0x4df9('0x1')]},'password':{'type':Sequelize[_0x4df9('0x1')]},'clientId':{'type':Sequelize[_0x4df9('0x1')]},'clientSecret':{'type':Sequelize[_0x4df9('0x1')]},'securityToken':{'type':Sequelize[_0x4df9('0x1')]},'serverUrl':{'type':Sequelize[_0x4df9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x4df9('0x3')](_0x4df9('0x4'),_0x4df9('0x5')),'defaultValue':_0x4df9('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 7872b0d..89f2835 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 _0x2080=['set','Content-Range','save','update','then','error','stack','name','send','map','SalesforceAccount','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','rawAttributes','order','filter','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','username','slice','lastIndexOf','Connection','password','concat','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','string','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count'];(function(_0x46b1b5,_0x506797){var _0x111d37=function(_0x1ae45c){while(--_0x1ae45c){_0x46b1b5['push'](_0x46b1b5['shift']());}};_0x111d37(++_0x506797);}(_0x2080,0xce));var _0x0208=function(_0x52c4e4,_0x4978e3){_0x52c4e4=_0x52c4e4-0x0;var _0x4d154e=_0x2080[_0x52c4e4];return _0x4d154e;};'use strict';var emlformat=require(_0x0208('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0208('0x1'));var jsonpatch=require(_0x0208('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0208('0x3'));var util=require(_0x0208('0x4'));var path=require(_0x0208('0x5'));var sox=require(_0x0208('0x6'));var csv=require(_0x0208('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0208('0x8'));var _=require(_0x0208('0x9'));var squel=require(_0x0208('0xa'));var crypto=require(_0x0208('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0208('0xc'));var toCsv=require(_0x0208('0x7'));var querystring=require('querystring');var Papa=require(_0x0208('0xd'));var Redis=require(_0x0208('0xe'));var authService=require(_0x0208('0xf'));var qs=require(_0x0208('0x10'));var as=require(_0x0208('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0208('0x12'))('api');var utils=require(_0x0208('0x13'));var config=require(_0x0208('0x14'));var licenseUtil=require(_0x0208('0x15'));var db=require(_0x0208('0x16'))['db'];var integrations=require(_0x0208('0x17'));function respondWithStatusCode(_0x203f98,_0x1fa8a0){_0x1fa8a0=_0x1fa8a0||0xcc;return function(_0x4c97b1){if(_0x4c97b1){return _0x203f98[_0x0208('0x18')](_0x1fa8a0);}return _0x203f98['status'](_0x1fa8a0)[_0x0208('0x19')]();};}function respondWithResult(_0x1e4496,_0x30d886){_0x30d886=_0x30d886||0xc8;return function(_0x427f9e){if(_0x427f9e){return _0x1e4496[_0x0208('0x1a')](_0x30d886)[_0x0208('0x1b')](_0x427f9e);}};}function respondWithFilteredResult(_0x4411c2,_0x28fa47){return function(_0x2c5c1c){if(_0x2c5c1c){var _0x4b94af=typeof _0x28fa47[_0x0208('0x1c')]===_0x0208('0x1d')&&typeof _0x28fa47[_0x0208('0x1e')]==='undefined';var _0xa22930=_0x2c5c1c[_0x0208('0x1f')];var _0xb6d2c1=_0x4b94af?0x0:_0x28fa47[_0x0208('0x1c')];var _0x19d874=_0x4b94af?_0x2c5c1c[_0x0208('0x1f')]:_0x28fa47[_0x0208('0x1c')]+_0x28fa47[_0x0208('0x1e')];var _0x4d52db;if(_0x19d874>=_0xa22930){_0x19d874=_0xa22930;_0x4d52db=0xc8;}else{_0x4d52db=0xce;}_0x4411c2['status'](_0x4d52db);return _0x4411c2[_0x0208('0x20')](_0x0208('0x21'),_0xb6d2c1+'-'+_0x19d874+'/'+_0xa22930)[_0x0208('0x1b')](_0x2c5c1c);}return null;};}function patchUpdates(_0x9c775){return function(_0x51cc75){try{jsonpatch['apply'](_0x51cc75,_0x9c775,!![]);}catch(_0x227446){return BPromise['reject'](_0x227446);}return _0x51cc75[_0x0208('0x22')]();};}function saveUpdates(_0x4dcfaa,_0x5c8fd9){return function(_0x445fb1){if(_0x445fb1){return _0x445fb1[_0x0208('0x23')](_0x4dcfaa)[_0x0208('0x24')](function(_0x13b52b){return _0x13b52b;});}return null;};}function removeEntity(_0x361447,_0x371ea8){return function(_0x196e78){if(_0x196e78){return _0x196e78['destroy']()[_0x0208('0x24')](function(){_0x361447[_0x0208('0x1a')](0xcc)[_0x0208('0x19')]();});}};}function handleEntityNotFound(_0x4ba212,_0x12ce6d){return function(_0x329396){if(!_0x329396){_0x4ba212[_0x0208('0x18')](0x194);}return _0x329396;};}function handleError(_0x556648,_0x52fa66){_0x52fa66=_0x52fa66||0x1f4;return function(_0x42e3e2){logger[_0x0208('0x25')](_0x42e3e2[_0x0208('0x26')]);if(_0x42e3e2['name']){delete _0x42e3e2[_0x0208('0x27')];}_0x556648[_0x0208('0x1a')](_0x52fa66)[_0x0208('0x28')](_0x42e3e2);};}exports['index']=function(_0x40d3b4,_0x39f8ab){var _0x2e12d8={},_0xb46cf9={},_0x432c50={'count':0x0,'rows':[]};var _0x145efc=_[_0x0208('0x29')](db[_0x0208('0x2a')]['rawAttributes'],function(_0x194cda){return{'name':_0x194cda['fieldName'],'type':_0x194cda[_0x0208('0x2b')]['key']};});_0xb46cf9['model']=_[_0x0208('0x29')](_0x145efc,_0x0208('0x27'));_0xb46cf9[_0x0208('0x2c')]=_[_0x0208('0x2d')](_0x40d3b4[_0x0208('0x2c')]);_0xb46cf9[_0x0208('0x2e')]=_[_0x0208('0x2f')](_0xb46cf9[_0x0208('0x30')],_0xb46cf9[_0x0208('0x2c')]);_0x2e12d8[_0x0208('0x31')]=_['intersection'](_0xb46cf9[_0x0208('0x30')],qs[_0x0208('0x32')](_0x40d3b4['query'][_0x0208('0x32')]));_0x2e12d8[_0x0208('0x31')]=_0x2e12d8[_0x0208('0x31')][_0x0208('0x33')]?_0x2e12d8['attributes']:_0xb46cf9[_0x0208('0x30')];if(!_0x40d3b4[_0x0208('0x2c')][_0x0208('0x34')](_0x0208('0x35'))){_0x2e12d8['limit']=qs[_0x0208('0x1e')](_0x40d3b4[_0x0208('0x2c')][_0x0208('0x1e')]);_0x2e12d8[_0x0208('0x1c')]=qs[_0x0208('0x1c')](_0x40d3b4[_0x0208('0x2c')]['offset']);}_0x2e12d8['order']=qs['sort'](_0x40d3b4[_0x0208('0x2c')][_0x0208('0x36')]);_0x2e12d8[_0x0208('0x37')]=qs[_0x0208('0x2e')](_['pick'](_0x40d3b4[_0x0208('0x2c')],_0xb46cf9['filters']),_0x145efc);if(_0x40d3b4['query']['filter']){_0x2e12d8[_0x0208('0x37')]=_[_0x0208('0x38')](_0x2e12d8['where'],{'$or':_[_0x0208('0x29')](_0x145efc,function(_0x3ed896){if(_0x3ed896['type']!==_0x0208('0x39')){var _0x3e67a9={};_0x3e67a9[_0x3ed896[_0x0208('0x27')]]={'$like':'%'+_0x40d3b4[_0x0208('0x2c')]['filter']+'%'};return _0x3e67a9;}})});}_0x2e12d8=_[_0x0208('0x38')]({},_0x2e12d8,_0x40d3b4['options']);var _0x41e43c={'where':_0x2e12d8['where']};return db['SalesforceAccount']['count'](_0x41e43c)[_0x0208('0x24')](function(_0x2818ed){_0x432c50['count']=_0x2818ed;if(_0x40d3b4[_0x0208('0x2c')][_0x0208('0x3a')]){_0x2e12d8['include']=[{'all':!![]}];}return db[_0x0208('0x2a')][_0x0208('0x3b')](_0x2e12d8);})[_0x0208('0x24')](function(_0x451ef3){_0x432c50[_0x0208('0x3c')]=_0x451ef3;return _0x432c50;})[_0x0208('0x24')](respondWithFilteredResult(_0x39f8ab,_0x2e12d8))['catch'](handleError(_0x39f8ab,null));};exports[_0x0208('0x3d')]=function(_0x69defe,_0x76bb7d){var _0xcb59c6={'raw':![],'where':{'id':_0x69defe[_0x0208('0x3e')]['id']}},_0x3f6553={};_0x3f6553['model']=_[_0x0208('0x2d')](db[_0x0208('0x2a')]['rawAttributes']);_0x3f6553[_0x0208('0x2c')]=_['keys'](_0x69defe['query']);_0x3f6553[_0x0208('0x2e')]=_[_0x0208('0x2f')](_0x3f6553[_0x0208('0x30')],_0x3f6553[_0x0208('0x2c')]);_0xcb59c6[_0x0208('0x31')]=_['intersection'](_0x3f6553[_0x0208('0x30')],qs[_0x0208('0x32')](_0x69defe[_0x0208('0x2c')][_0x0208('0x32')]));_0xcb59c6['attributes']=_0xcb59c6[_0x0208('0x31')][_0x0208('0x33')]?_0xcb59c6[_0x0208('0x31')]:_0x3f6553[_0x0208('0x30')];if(_0x69defe[_0x0208('0x2c')][_0x0208('0x3a')]){_0xcb59c6[_0x0208('0x3f')]=[{'all':!![]}];}_0xcb59c6=_[_0x0208('0x38')]({},_0xcb59c6,_0x69defe[_0x0208('0x40')]);return db[_0x0208('0x2a')][_0x0208('0x41')](_0xcb59c6)['then'](handleEntityNotFound(_0x76bb7d,null))[_0x0208('0x24')](respondWithResult(_0x76bb7d,null))[_0x0208('0x42')](handleError(_0x76bb7d,null));};exports[_0x0208('0x43')]=function(_0x489d5b,_0x319b96){return db[_0x0208('0x2a')][_0x0208('0x43')](_0x489d5b[_0x0208('0x44')],{})[_0x0208('0x24')](respondWithResult(_0x319b96,0xc9))[_0x0208('0x42')](handleError(_0x319b96,null));};exports[_0x0208('0x23')]=function(_0x5350eb,_0x46cddd){if(_0x5350eb[_0x0208('0x44')]['id']){delete _0x5350eb[_0x0208('0x44')]['id'];}return db[_0x0208('0x2a')][_0x0208('0x41')]({'where':{'id':_0x5350eb[_0x0208('0x3e')]['id']}})[_0x0208('0x24')](handleEntityNotFound(_0x46cddd,null))[_0x0208('0x24')](saveUpdates(_0x5350eb[_0x0208('0x44')],null))['then'](respondWithResult(_0x46cddd,null))[_0x0208('0x42')](handleError(_0x46cddd,null));};exports[_0x0208('0x45')]=function(_0x5b8afd,_0x5aa8f8){return db[_0x0208('0x2a')][_0x0208('0x41')]({'where':{'id':_0x5b8afd[_0x0208('0x3e')]['id']}})[_0x0208('0x24')](handleEntityNotFound(_0x5aa8f8,null))[_0x0208('0x24')](removeEntity(_0x5aa8f8,null))[_0x0208('0x42')](handleError(_0x5aa8f8,null));};exports[_0x0208('0x46')]=function(_0x5dbf2a,_0x1296aa,_0x557ca7){var _0x3a4a67={};var _0x2f054f={};var _0x524bcf;var _0x4fddbd;return db[_0x0208('0x2a')][_0x0208('0x47')]({'where':{'id':_0x5dbf2a[_0x0208('0x3e')]['id']}})[_0x0208('0x24')](handleEntityNotFound(_0x1296aa,null))[_0x0208('0x24')](function(_0x3703fd){if(_0x3703fd){_0x524bcf=_0x3703fd;_0x2f054f[_0x0208('0x30')]=_['keys'](db[_0x0208('0x48')][_0x0208('0x49')]);_0x2f054f[_0x0208('0x2c')]=_[_0x0208('0x2d')](_0x5dbf2a[_0x0208('0x2c')]);_0x2f054f[_0x0208('0x2e')]=_[_0x0208('0x2f')](_0x2f054f[_0x0208('0x30')],_0x2f054f[_0x0208('0x2c')]);_0x3a4a67['attributes']=_[_0x0208('0x2f')](_0x2f054f[_0x0208('0x30')],qs[_0x0208('0x32')](_0x5dbf2a['query']['fields']));_0x3a4a67[_0x0208('0x31')]=_0x3a4a67[_0x0208('0x31')][_0x0208('0x33')]?_0x3a4a67[_0x0208('0x31')]:_0x2f054f[_0x0208('0x30')];_0x3a4a67[_0x0208('0x4a')]=qs[_0x0208('0x36')](_0x5dbf2a[_0x0208('0x2c')][_0x0208('0x36')]);_0x3a4a67[_0x0208('0x37')]=qs[_0x0208('0x2e')](_['pick'](_0x5dbf2a['query'],_0x2f054f[_0x0208('0x2e')]));if(_0x5dbf2a[_0x0208('0x2c')][_0x0208('0x4b')]){_0x3a4a67[_0x0208('0x37')]=_['merge'](_0x3a4a67[_0x0208('0x37')],{'$or':_[_0x0208('0x29')](_0x3a4a67[_0x0208('0x31')],function(_0x5effe7){var _0x254b25={};_0x254b25[_0x5effe7]={'$like':'%'+_0x5dbf2a[_0x0208('0x2c')][_0x0208('0x4b')]+'%'};return _0x254b25;})});}_0x3a4a67=_[_0x0208('0x38')]({},_0x3a4a67,_0x5dbf2a[_0x0208('0x40')]);return _0x524bcf[_0x0208('0x46')](_0x3a4a67);}})[_0x0208('0x24')](function(_0xd0d84a){if(_0xd0d84a){_0x4fddbd=_0xd0d84a['length'];if(!_0x5dbf2a[_0x0208('0x2c')]['hasOwnProperty'](_0x0208('0x35'))){_0x3a4a67[_0x0208('0x1e')]=qs[_0x0208('0x1e')](_0x5dbf2a[_0x0208('0x2c')][_0x0208('0x1e')]);_0x3a4a67[_0x0208('0x1c')]=qs[_0x0208('0x1c')](_0x5dbf2a['query']['offset']);}return _0x524bcf['getConfigurations'](_0x3a4a67);}})['then'](function(_0x1149d0){if(_0x1149d0){return _0x1149d0?{'count':_0x4fddbd,'rows':_0x1149d0}:null;}})['then'](respondWithResult(_0x1296aa,null))[_0x0208('0x42')](handleError(_0x1296aa,null));};exports[_0x0208('0x4c')]=function(_0x19654d,_0x33a78a,_0x55bbb2){if(_0x19654d[_0x0208('0x44')]['id']){delete _0x19654d[_0x0208('0x44')]['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x19654d[_0x0208('0x3e')]['id']}})['then'](handleEntityNotFound(_0x33a78a,null))[_0x0208('0x24')](function(_0x3f7c5f){if(_0x3f7c5f){_0x19654d[_0x0208('0x44')][_0x0208('0x4d')]=_0x3f7c5f['id'];_0x19654d[_0x0208('0x44')][_0x0208('0x4e')]=integrations['getSubjects'](_0x19654d['body'][_0x0208('0x4f')],_0x19654d[_0x0208('0x44')][_0x0208('0x2b')]);_0x19654d['body'][_0x0208('0x50')]=integrations[_0x0208('0x51')](_0x19654d[_0x0208('0x44')][_0x0208('0x4f')],_0x19654d[_0x0208('0x44')][_0x0208('0x2b')]);return db['SalesforceConfiguration']['create'](_0x19654d['body'],{'include':[{'model':db[_0x0208('0x52')],'as':_0x0208('0x4e')},{'model':db[_0x0208('0x52')],'as':_0x0208('0x50')}]});}return null;})[_0x0208('0x24')](respondWithResult(_0x33a78a,null))[_0x0208('0x42')](handleError(_0x33a78a,null));};exports['getFields']=function(_0x11347b,_0x2a111b,_0x2949f9){var _0x937b2f;var _0x3b3385='';var _0xcd5d8c=_0x0208('0x53');return db['SalesforceAccount']['findOne']({'where':{'id':_0x11347b[_0x0208('0x3e')]['id']},'attributes':['id',_0x0208('0x54'),_0x0208('0x55'),_0x0208('0x56'),_0x0208('0x57'),'password','securityToken']})[_0x0208('0x24')](handleEntityNotFound(_0x2a111b,null))[_0x0208('0x24')](function(_0x5afbd3){if(_0x5afbd3){_0x3b3385=_0x5afbd3[_0x0208('0x54')];var _0x471a9c=_0x3b3385[_0x0208('0x58')](-0x1);if(_0x471a9c==='/'){_0x3b3385=_0x3b3385['substring'](0x0,_0x3b3385[_0x0208('0x59')](_0x471a9c));}_0x937b2f=new jsforce[(_0x0208('0x5a'))]({'oauth2':{'loginUrl':_0x3b3385,'clientId':_0x5afbd3[_0x0208('0x55')],'clientSecret':_0x5afbd3[_0x0208('0x56')]}});return _0x937b2f['login'](_0x5afbd3['username'],_0x5afbd3[_0x0208('0x5b')][_0x0208('0x5c')](_0x5afbd3['securityToken']));}})[_0x0208('0x24')](function(_0x555f35){if(_0x555f35){if(!_['isNil'](_0x11347b['query']['ticketType'])){_0xcd5d8c=_0x11347b['query'][_0x0208('0x5d')];}return _0x937b2f[_0x0208('0x5e')](_0xcd5d8c)['describe']();}})[_0x0208('0x24')](function(_0x46e091){var _0x721fb5=[_0x0208('0x5f'),_0x0208('0x60'),_0x0208('0x61'),_0x0208('0x62'),_0x0208('0x63'),'Description'];var _0x223535=[_0x0208('0x64'),'int','picklist',_0x0208('0x65'),_0x0208('0x66'),_0x0208('0x67'),_0x0208('0x68')];if(_0x46e091){_[_0x0208('0x69')](_0x46e091['fields'],function(_0x3d5642){return _0x721fb5[_0x0208('0x6a')](_0x3d5642['name'])||!_0x223535[_0x0208('0x6a')](_0x3d5642['type']);});return{'count':_0x46e091[_0x0208('0x32')]['length'],'rows':_['map'](_0x46e091[_0x0208('0x32')],function(_0x48e166){return{'id':_0x48e166[_0x0208('0x27')],'name':_0x48e166[_0x0208('0x6b')],'custom':_0x48e166[_0x0208('0x6c')],'options':_0x48e166[_0x0208('0x6d')]['length']>0x0?_[_0x0208('0x29')](_0x48e166[_0x0208('0x6d')],function(_0x447f99){return{'name':_0x447f99[_0x0208('0x6b')],'value':_0x447f99['value']};}):_0x48e166['type']==_0x0208('0x65')?[{'name':_0x0208('0x6e'),'value':_0x0208('0x6f')},{'name':_0x0208('0x70'),'value':_0x0208('0x71')}]:[]};})};}})[_0x0208('0x24')](respondWithResult(_0x2a111b,null))[_0x0208('0x42')](function(_0x4fd4c2){var _0xc5e0e1=_0x11347b['query'][_0x0208('0x72')]?0x1f4:_0x4fd4c2[_0x0208('0x73')]||0x1f4;logger[_0x0208('0x25')](_0x0208('0x74'),_0x0208('0x75'),_0xc5e0e1,JSON[_0x0208('0x76')](_0x4fd4c2));delete _0x4fd4c2[_0x0208('0x27')];if(_0xc5e0e1===0x191){_0xc5e0e1=0x190;}_0x2a111b[_0x0208('0x1a')](_0xc5e0e1)[_0x0208('0x28')](_0x11347b[_0x0208('0x2c')][_0x0208('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x4fd4c2[_0x0208('0x73')]}:_0x4fd4c2);});}; \ No newline at end of file +var _0x9ee7=['rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','send','index','map','fieldName','type','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','SalesforceAccount','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientSecret','username','slice','substring','lastIndexOf','Connection','clientId','password','concat','securityToken','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsRecurrence','Subject','Description','int','boolean','textarea','phone','remove','includes','label','picklistValues','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9ee7,0x80));var _0x79ee=function(_0x121309,_0x3de68a){_0x121309=_0x121309-0x0;var _0x542514=_0x9ee7[_0x121309];return _0x542514;};'use strict';var emlformat=require(_0x79ee('0x0'));var rimraf=require(_0x79ee('0x1'));var zipdir=require(_0x79ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x79ee('0x3'));var Mustache=require(_0x79ee('0x4'));var util=require(_0x79ee('0x5'));var path=require(_0x79ee('0x6'));var sox=require(_0x79ee('0x7'));var csv=require(_0x79ee('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x79ee('0x9'));var _=require(_0x79ee('0xa'));var squel=require('squel');var crypto=require(_0x79ee('0xb'));var jsforce=require(_0x79ee('0xc'));var deskjs=require(_0x79ee('0xd'));var toCsv=require('to-csv');var querystring=require(_0x79ee('0xe'));var Papa=require(_0x79ee('0xf'));var Redis=require(_0x79ee('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x79ee('0x11'));var as=require(_0x79ee('0x12'));var hardwareService=require(_0x79ee('0x13'));var logger=require(_0x79ee('0x14'))(_0x79ee('0x15'));var utils=require(_0x79ee('0x16'));var config=require(_0x79ee('0x17'));var licenseUtil=require(_0x79ee('0x18'));var db=require(_0x79ee('0x19'))['db'];var integrations=require(_0x79ee('0x1a'));function respondWithStatusCode(_0x19c1d3,_0x34a4b9){_0x34a4b9=_0x34a4b9||0xcc;return function(_0x16ec58){if(_0x16ec58){return _0x19c1d3[_0x79ee('0x1b')](_0x34a4b9);}return _0x19c1d3[_0x79ee('0x1c')](_0x34a4b9)['end']();};}function respondWithResult(_0xce1859,_0x57945f){_0x57945f=_0x57945f||0xc8;return function(_0x437c46){if(_0x437c46){return _0xce1859[_0x79ee('0x1c')](_0x57945f)['json'](_0x437c46);}};}function respondWithFilteredResult(_0x2d6d88,_0x9f6967){return function(_0x5854ca){if(_0x5854ca){var _0x36ef54=typeof _0x9f6967[_0x79ee('0x1d')]===_0x79ee('0x1e')&&typeof _0x9f6967['limit']===_0x79ee('0x1e');var _0x59db0e=_0x5854ca[_0x79ee('0x1f')];var _0x3105bd=_0x36ef54?0x0:_0x9f6967['offset'];var _0x3a549a=_0x36ef54?_0x5854ca[_0x79ee('0x1f')]:_0x9f6967['offset']+_0x9f6967['limit'];var _0x40d45d;if(_0x3a549a>=_0x59db0e){_0x3a549a=_0x59db0e;_0x40d45d=0xc8;}else{_0x40d45d=0xce;}_0x2d6d88[_0x79ee('0x1c')](_0x40d45d);return _0x2d6d88[_0x79ee('0x20')](_0x79ee('0x21'),_0x3105bd+'-'+_0x3a549a+'/'+_0x59db0e)[_0x79ee('0x22')](_0x5854ca);}return null;};}function patchUpdates(_0x5a4788){return function(_0x296a76){try{jsonpatch[_0x79ee('0x23')](_0x296a76,_0x5a4788,!![]);}catch(_0x5215ac){return BPromise[_0x79ee('0x24')](_0x5215ac);}return _0x296a76[_0x79ee('0x25')]();};}function saveUpdates(_0xc307b3,_0xad346b){return function(_0x9891f3){if(_0x9891f3){return _0x9891f3[_0x79ee('0x26')](_0xc307b3)[_0x79ee('0x27')](function(_0x23c468){return _0x23c468;});}return null;};}function removeEntity(_0x5f5fa3,_0x22f036){return function(_0x21c723){if(_0x21c723){return _0x21c723[_0x79ee('0x28')]()[_0x79ee('0x27')](function(){_0x5f5fa3[_0x79ee('0x1c')](0xcc)[_0x79ee('0x29')]();});}};}function handleEntityNotFound(_0x2430e7,_0x32d2a6){return function(_0x53df89){if(!_0x53df89){_0x2430e7['sendStatus'](0x194);}return _0x53df89;};}function handleError(_0x2756d1,_0xd4da25){_0xd4da25=_0xd4da25||0x1f4;return function(_0x249926){logger[_0x79ee('0x2a')](_0x249926[_0x79ee('0x2b')]);if(_0x249926['name']){delete _0x249926['name'];}_0x2756d1[_0x79ee('0x1c')](_0xd4da25)[_0x79ee('0x2c')](_0x249926);};}exports[_0x79ee('0x2d')]=function(_0x535d79,_0x353d79){var _0xb13216={},_0x1aa30d={},_0x3beb9a={'count':0x0,'rows':[]};var _0x419244=_[_0x79ee('0x2e')](db['SalesforceAccount']['rawAttributes'],function(_0x33006b){return{'name':_0x33006b[_0x79ee('0x2f')],'type':_0x33006b[_0x79ee('0x30')]['key']};});_0x1aa30d[_0x79ee('0x31')]=_[_0x79ee('0x2e')](_0x419244,_0x79ee('0x32'));_0x1aa30d[_0x79ee('0x33')]=_[_0x79ee('0x34')](_0x535d79[_0x79ee('0x33')]);_0x1aa30d['filters']=_[_0x79ee('0x35')](_0x1aa30d[_0x79ee('0x31')],_0x1aa30d[_0x79ee('0x33')]);_0xb13216[_0x79ee('0x36')]=_['intersection'](_0x1aa30d[_0x79ee('0x31')],qs[_0x79ee('0x37')](_0x535d79['query'][_0x79ee('0x37')]));_0xb13216['attributes']=_0xb13216['attributes']['length']?_0xb13216[_0x79ee('0x36')]:_0x1aa30d[_0x79ee('0x31')];if(!_0x535d79[_0x79ee('0x33')][_0x79ee('0x38')](_0x79ee('0x39'))){_0xb13216[_0x79ee('0x3a')]=qs[_0x79ee('0x3a')](_0x535d79[_0x79ee('0x33')]['limit']);_0xb13216[_0x79ee('0x1d')]=qs[_0x79ee('0x1d')](_0x535d79[_0x79ee('0x33')][_0x79ee('0x1d')]);}_0xb13216[_0x79ee('0x3b')]=qs[_0x79ee('0x3c')](_0x535d79[_0x79ee('0x33')]['sort']);_0xb13216[_0x79ee('0x3d')]=qs[_0x79ee('0x3e')](_[_0x79ee('0x3f')](_0x535d79[_0x79ee('0x33')],_0x1aa30d[_0x79ee('0x3e')]),_0x419244);if(_0x535d79['query'][_0x79ee('0x40')]){_0xb13216['where']=_['merge'](_0xb13216[_0x79ee('0x3d')],{'$or':_[_0x79ee('0x2e')](_0x419244,function(_0x3a9fa5){if(_0x3a9fa5[_0x79ee('0x30')]!==_0x79ee('0x41')){var _0x4069fd={};_0x4069fd[_0x3a9fa5[_0x79ee('0x32')]]={'$like':'%'+_0x535d79[_0x79ee('0x33')][_0x79ee('0x40')]+'%'};return _0x4069fd;}})});}_0xb13216=_[_0x79ee('0x42')]({},_0xb13216,_0x535d79[_0x79ee('0x43')]);var _0x24dca4={'where':_0xb13216[_0x79ee('0x3d')]};return db[_0x79ee('0x44')][_0x79ee('0x1f')](_0x24dca4)['then'](function(_0x76b3e){_0x3beb9a[_0x79ee('0x1f')]=_0x76b3e;if(_0x535d79[_0x79ee('0x33')][_0x79ee('0x45')]){_0xb13216[_0x79ee('0x46')]=[{'all':!![]}];}return db[_0x79ee('0x44')][_0x79ee('0x47')](_0xb13216);})[_0x79ee('0x27')](function(_0x3bfa2c){_0x3beb9a[_0x79ee('0x48')]=_0x3bfa2c;return _0x3beb9a;})[_0x79ee('0x27')](respondWithFilteredResult(_0x353d79,_0xb13216))[_0x79ee('0x49')](handleError(_0x353d79,null));};exports[_0x79ee('0x4a')]=function(_0x376fb9,_0x326d56){var _0x5efcfc={'raw':![],'where':{'id':_0x376fb9[_0x79ee('0x4b')]['id']}},_0x5af91c={};_0x5af91c[_0x79ee('0x31')]=_[_0x79ee('0x34')](db[_0x79ee('0x44')][_0x79ee('0x4c')]);_0x5af91c[_0x79ee('0x33')]=_[_0x79ee('0x34')](_0x376fb9[_0x79ee('0x33')]);_0x5af91c[_0x79ee('0x3e')]=_['intersection'](_0x5af91c['model'],_0x5af91c['query']);_0x5efcfc[_0x79ee('0x36')]=_[_0x79ee('0x35')](_0x5af91c[_0x79ee('0x31')],qs['fields'](_0x376fb9[_0x79ee('0x33')][_0x79ee('0x37')]));_0x5efcfc[_0x79ee('0x36')]=_0x5efcfc[_0x79ee('0x36')][_0x79ee('0x4d')]?_0x5efcfc[_0x79ee('0x36')]:_0x5af91c[_0x79ee('0x31')];if(_0x376fb9[_0x79ee('0x33')][_0x79ee('0x45')]){_0x5efcfc[_0x79ee('0x46')]=[{'all':!![]}];}_0x5efcfc=_[_0x79ee('0x42')]({},_0x5efcfc,_0x376fb9[_0x79ee('0x43')]);return db['SalesforceAccount'][_0x79ee('0x4e')](_0x5efcfc)['then'](handleEntityNotFound(_0x326d56,null))['then'](respondWithResult(_0x326d56,null))[_0x79ee('0x49')](handleError(_0x326d56,null));};exports[_0x79ee('0x4f')]=function(_0x54f064,_0x26db51){return db[_0x79ee('0x44')][_0x79ee('0x4f')](_0x54f064['body'],{})[_0x79ee('0x27')](respondWithResult(_0x26db51,0xc9))[_0x79ee('0x49')](handleError(_0x26db51,null));};exports[_0x79ee('0x26')]=function(_0x209b01,_0xf4db5){if(_0x209b01['body']['id']){delete _0x209b01[_0x79ee('0x50')]['id'];}return db['SalesforceAccount'][_0x79ee('0x4e')]({'where':{'id':_0x209b01[_0x79ee('0x4b')]['id']}})[_0x79ee('0x27')](handleEntityNotFound(_0xf4db5,null))[_0x79ee('0x27')](saveUpdates(_0x209b01['body'],null))[_0x79ee('0x27')](respondWithResult(_0xf4db5,null))[_0x79ee('0x49')](handleError(_0xf4db5,null));};exports[_0x79ee('0x28')]=function(_0x46b13c,_0x45ece5){return db[_0x79ee('0x44')][_0x79ee('0x4e')]({'where':{'id':_0x46b13c[_0x79ee('0x4b')]['id']}})[_0x79ee('0x27')](handleEntityNotFound(_0x45ece5,null))[_0x79ee('0x27')](removeEntity(_0x45ece5,null))[_0x79ee('0x49')](handleError(_0x45ece5,null));};exports[_0x79ee('0x51')]=function(_0x3dec07,_0x174249,_0x47927b){var _0x412cb2={};var _0x1ef64b={};var _0x30b151;var _0x2e140e;return db['SalesforceAccount'][_0x79ee('0x52')]({'where':{'id':_0x3dec07['params']['id']}})[_0x79ee('0x27')](handleEntityNotFound(_0x174249,null))[_0x79ee('0x27')](function(_0x4ab244){if(_0x4ab244){_0x30b151=_0x4ab244;_0x1ef64b[_0x79ee('0x31')]=_[_0x79ee('0x34')](db[_0x79ee('0x53')][_0x79ee('0x4c')]);_0x1ef64b[_0x79ee('0x33')]=_[_0x79ee('0x34')](_0x3dec07[_0x79ee('0x33')]);_0x1ef64b[_0x79ee('0x3e')]=_[_0x79ee('0x35')](_0x1ef64b[_0x79ee('0x31')],_0x1ef64b[_0x79ee('0x33')]);_0x412cb2[_0x79ee('0x36')]=_[_0x79ee('0x35')](_0x1ef64b[_0x79ee('0x31')],qs[_0x79ee('0x37')](_0x3dec07[_0x79ee('0x33')]['fields']));_0x412cb2[_0x79ee('0x36')]=_0x412cb2['attributes'][_0x79ee('0x4d')]?_0x412cb2[_0x79ee('0x36')]:_0x1ef64b[_0x79ee('0x31')];_0x412cb2[_0x79ee('0x3b')]=qs[_0x79ee('0x3c')](_0x3dec07[_0x79ee('0x33')][_0x79ee('0x3c')]);_0x412cb2[_0x79ee('0x3d')]=qs[_0x79ee('0x3e')](_[_0x79ee('0x3f')](_0x3dec07['query'],_0x1ef64b['filters']));if(_0x3dec07['query'][_0x79ee('0x40')]){_0x412cb2['where']=_[_0x79ee('0x42')](_0x412cb2[_0x79ee('0x3d')],{'$or':_[_0x79ee('0x2e')](_0x412cb2[_0x79ee('0x36')],function(_0x280759){var _0x414f1b={};_0x414f1b[_0x280759]={'$like':'%'+_0x3dec07['query'][_0x79ee('0x40')]+'%'};return _0x414f1b;})});}_0x412cb2=_[_0x79ee('0x42')]({},_0x412cb2,_0x3dec07['options']);return _0x30b151[_0x79ee('0x51')](_0x412cb2);}})[_0x79ee('0x27')](function(_0x2cf223){if(_0x2cf223){_0x2e140e=_0x2cf223[_0x79ee('0x4d')];if(!_0x3dec07['query'][_0x79ee('0x38')]('nolimit')){_0x412cb2[_0x79ee('0x3a')]=qs[_0x79ee('0x3a')](_0x3dec07[_0x79ee('0x33')][_0x79ee('0x3a')]);_0x412cb2[_0x79ee('0x1d')]=qs[_0x79ee('0x1d')](_0x3dec07[_0x79ee('0x33')][_0x79ee('0x1d')]);}return _0x30b151[_0x79ee('0x51')](_0x412cb2);}})[_0x79ee('0x27')](function(_0x2fb03b){if(_0x2fb03b){return _0x2fb03b?{'count':_0x2e140e,'rows':_0x2fb03b}:null;}})['then'](respondWithResult(_0x174249,null))[_0x79ee('0x49')](handleError(_0x174249,null));};exports[_0x79ee('0x54')]=function(_0x1cf9b7,_0x51d665,_0x549cba){if(_0x1cf9b7[_0x79ee('0x50')]['id']){delete _0x1cf9b7[_0x79ee('0x50')]['id'];}return db[_0x79ee('0x44')][_0x79ee('0x52')]({'where':{'id':_0x1cf9b7[_0x79ee('0x4b')]['id']}})[_0x79ee('0x27')](handleEntityNotFound(_0x51d665,null))[_0x79ee('0x27')](function(_0x17c020){if(_0x17c020){_0x1cf9b7[_0x79ee('0x50')][_0x79ee('0x55')]=_0x17c020['id'];_0x1cf9b7['body']['Subjects']=integrations['getSubjects'](_0x1cf9b7[_0x79ee('0x50')][_0x79ee('0x56')],_0x1cf9b7[_0x79ee('0x50')][_0x79ee('0x30')]);_0x1cf9b7['body'][_0x79ee('0x57')]=integrations[_0x79ee('0x58')](_0x1cf9b7[_0x79ee('0x50')][_0x79ee('0x56')],_0x1cf9b7[_0x79ee('0x50')]['type']);return db[_0x79ee('0x53')][_0x79ee('0x4f')](_0x1cf9b7[_0x79ee('0x50')],{'include':[{'model':db[_0x79ee('0x59')],'as':_0x79ee('0x5a')},{'model':db[_0x79ee('0x59')],'as':_0x79ee('0x57')}]});}return null;})[_0x79ee('0x27')](respondWithResult(_0x51d665,null))[_0x79ee('0x49')](handleError(_0x51d665,null));};exports[_0x79ee('0x5b')]=function(_0x31a736,_0x210dd2,_0x3c542e){var _0x254496;var _0x202d12='';var _0x530e58=_0x79ee('0x5c');return db[_0x79ee('0x44')]['findOne']({'where':{'id':_0x31a736[_0x79ee('0x4b')]['id']},'attributes':['id',_0x79ee('0x5d'),'clientId',_0x79ee('0x5e'),_0x79ee('0x5f'),'password','securityToken']})['then'](handleEntityNotFound(_0x210dd2,null))['then'](function(_0x1ec47f){if(_0x1ec47f){_0x202d12=_0x1ec47f[_0x79ee('0x5d')];var _0x349f4e=_0x202d12[_0x79ee('0x60')](-0x1);if(_0x349f4e==='/'){_0x202d12=_0x202d12[_0x79ee('0x61')](0x0,_0x202d12[_0x79ee('0x62')](_0x349f4e));}_0x254496=new jsforce[(_0x79ee('0x63'))]({'oauth2':{'loginUrl':_0x202d12,'clientId':_0x1ec47f[_0x79ee('0x64')],'clientSecret':_0x1ec47f[_0x79ee('0x5e')]}});return _0x254496['login'](_0x1ec47f[_0x79ee('0x5f')],_0x1ec47f[_0x79ee('0x65')][_0x79ee('0x66')](_0x1ec47f[_0x79ee('0x67')]));}})[_0x79ee('0x27')](function(_0x2442de){if(_0x2442de){if(!_[_0x79ee('0x68')](_0x31a736[_0x79ee('0x33')][_0x79ee('0x69')])){_0x530e58=_0x31a736['query'][_0x79ee('0x69')];}return _0x254496[_0x79ee('0x6a')](_0x530e58)[_0x79ee('0x6b')]();}})[_0x79ee('0x27')](function(_0x20eb20){var _0x162ee5=[_0x79ee('0x6c'),_0x79ee('0x6d'),'IsReminderSet',_0x79ee('0x6e'),_0x79ee('0x6f'),_0x79ee('0x70')];var _0x3a4779=['string',_0x79ee('0x71'),'picklist',_0x79ee('0x72'),'email',_0x79ee('0x73'),_0x79ee('0x74')];if(_0x20eb20){_[_0x79ee('0x75')](_0x20eb20[_0x79ee('0x37')],function(_0x4acf5e){return _0x162ee5[_0x79ee('0x76')](_0x4acf5e[_0x79ee('0x32')])||!_0x3a4779['includes'](_0x4acf5e[_0x79ee('0x30')]);});return{'count':_0x20eb20['fields'][_0x79ee('0x4d')],'rows':_['map'](_0x20eb20[_0x79ee('0x37')],function(_0x1b927a){return{'id':_0x1b927a[_0x79ee('0x32')],'name':_0x1b927a[_0x79ee('0x77')],'custom':_0x1b927a['custom'],'options':_0x1b927a[_0x79ee('0x78')][_0x79ee('0x4d')]>0x0?_[_0x79ee('0x2e')](_0x1b927a[_0x79ee('0x78')],function(_0x1bcf87){return{'name':_0x1bcf87[_0x79ee('0x77')],'value':_0x1bcf87['value']};}):_0x1b927a[_0x79ee('0x30')]==_0x79ee('0x72')?[{'name':_0x79ee('0x79'),'value':_0x79ee('0x7a')},{'name':_0x79ee('0x7b'),'value':_0x79ee('0x7c')}]:[]};})};}})[_0x79ee('0x27')](respondWithResult(_0x210dd2,null))['catch'](function(_0x4c6c25){var _0x1ec34f=_0x31a736[_0x79ee('0x33')][_0x79ee('0x7d')]?0x1f4:_0x4c6c25[_0x79ee('0x7e')]||0x1f4;logger[_0x79ee('0x2a')](_0x79ee('0x7f'),_0x79ee('0x5b'),_0x1ec34f,JSON[_0x79ee('0x80')](_0x4c6c25));delete _0x4c6c25['name'];if(_0x1ec34f===0x191){_0x1ec34f=0x190;}_0x210dd2['status'](_0x1ec34f)[_0x79ee('0x2c')](_0x31a736[_0x79ee('0x33')][_0x79ee('0x7d')]?{'message':'Wrong\x20credentials','statusCode':_0x4c6c25[_0x79ee('0x7e')]}:_0x4c6c25);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 3788720..1cfa01b 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 _0xc5b8=['request-promise','path','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','lodash','util','../../config/logger','api','bluebird'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xc5b8,0xbb));var _0x8c5b=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xc5b8[_0x29b609];return _0x54c952;};'use strict';var _=require(_0x8c5b('0x0'));var util=require(_0x8c5b('0x1'));var logger=require(_0x8c5b('0x2'))(_0x8c5b('0x3'));var moment=require('moment');var BPromise=require(_0x8c5b('0x4'));var rp=require(_0x8c5b('0x5'));var fs=require('fs');var path=require(_0x8c5b('0x6'));var rimraf=require('rimraf');var config=require(_0x8c5b('0x7'));var attributes=require(_0x8c5b('0x8'));var integrations=require(_0x8c5b('0x9'));module['exports']=function(_0x20828a,_0x1fac05){return _0x20828a[_0x8c5b('0xa')](_0x8c5b('0xb'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cd8=['request-promise','path','rimraf','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','../../config/logger','api','moment','bluebird'];(function(_0x477a25,_0x4f2bb8){var _0x19cd58=function(_0x4f35ab){while(--_0x4f35ab){_0x477a25['push'](_0x477a25['shift']());}};_0x19cd58(++_0x4f2bb8);}(_0x1cd8,0x110));var _0x81cd=function(_0x4d5581,_0x51d33c){_0x4d5581=_0x4d5581-0x0;var _0x578445=_0x1cd8[_0x4d5581];return _0x578445;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x81cd('0x0'))(_0x81cd('0x1'));var moment=require(_0x81cd('0x2'));var BPromise=require(_0x81cd('0x3'));var rp=require(_0x81cd('0x4'));var fs=require('fs');var path=require(_0x81cd('0x5'));var rimraf=require(_0x81cd('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x81cd('0x7'));module[_0x81cd('0x8')]=function(_0x129239,_0x220c8d){return _0x129239[_0x81cd('0x9')](_0x81cd('0xa'),attributes,{'tableName':_0x81cd('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 72507e7..811428c 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 _0x2d06=['find','where','info','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','map','include','model','ShowSalesforceAccount'];(function(_0x352ee0,_0x337464){var _0x291628=function(_0x160036){while(--_0x160036){_0x352ee0['push'](_0x352ee0['shift']());}};_0x291628(++_0x337464);}(_0x2d06,0x157));var _0x62d0=function(_0x7f70ec,_0x82eb8b){_0x7f70ec=_0x7f70ec-0x0;var _0x397ff9=_0x2d06[_0x7f70ec];return _0x397ff9;};'use strict';var _=require('lodash');var util=require(_0x62d0('0x0'));var moment=require(_0x62d0('0x1'));var BPromise=require(_0x62d0('0x2'));var rs=require(_0x62d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62d0('0x4'))['db'];var utils=require(_0x62d0('0x5'));var logger=require(_0x62d0('0x6'))(_0x62d0('0x7'));var config=require('../../config/environment');var jayson=require(_0x62d0('0x8'));var client=jayson[_0x62d0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x377f3d,_0x43fd82,_0x508d82){return new BPromise(function(_0x264cd4,_0xc4dacc){return client[_0x62d0('0xa')](_0x377f3d,_0x508d82)[_0x62d0('0xb')](function(_0x482d16){logger['info'](_0x62d0('0xc'),_0x43fd82,_0x62d0('0xd'));logger[_0x62d0('0xe')](_0x62d0('0xf'),_0x43fd82,_0x62d0('0xd'),JSON[_0x62d0('0x10')](_0x482d16));if(_0x482d16[_0x62d0('0x11')]){if(_0x482d16[_0x62d0('0x11')][_0x62d0('0x12')]===0x1f4){logger[_0x62d0('0x11')](_0x62d0('0xc'),_0x43fd82,_0x482d16[_0x62d0('0x11')][_0x62d0('0x13')]);return _0xc4dacc(_0x482d16[_0x62d0('0x11')]['message']);}logger[_0x62d0('0x11')](_0x62d0('0xc'),_0x43fd82,_0x482d16[_0x62d0('0x11')]['message']);return _0x264cd4(_0x482d16[_0x62d0('0x11')][_0x62d0('0x13')]);}else{logger['info'](_0x62d0('0xc'),_0x43fd82,_0x62d0('0xd'));_0x264cd4(_0x482d16[_0x62d0('0x14')][_0x62d0('0x13')]);}})['catch'](function(_0x5a803c){logger[_0x62d0('0x11')]('SalesforceAccount,\x20%s,\x20%s',_0x43fd82,_0x5a803c);_0xc4dacc(_0x5a803c);});});}exports[_0x62d0('0x15')]=function(_0x12036c){var _0x510bd4=this;return new Promise(function(_0x1e7076,_0x501c48){return db[_0x62d0('0x16')][_0x62d0('0x17')]({'raw':_0x12036c[_0x62d0('0x18')]?_0x12036c['options'][_0x62d0('0x19')]===undefined?!![]:![]:!![],'where':_0x12036c[_0x62d0('0x18')]?_0x12036c[_0x62d0('0x18')]['where']||null:null,'attributes':_0x12036c[_0x62d0('0x18')]?_0x12036c['options'][_0x62d0('0x1a')]||null:null,'limit':_0x12036c['options']?_0x12036c[_0x62d0('0x18')]['limit']||null:null,'include':_0x12036c[_0x62d0('0x18')]?_0x12036c[_0x62d0('0x18')]['include']?_[_0x62d0('0x1b')](_0x12036c['options'][_0x62d0('0x1c')],function(_0x495aba){return{'model':db[_0x495aba[_0x62d0('0x1d')]],'as':_0x495aba['as'],'attributes':_0x495aba[_0x62d0('0x1a')],'include':_0x495aba[_0x62d0('0x1c')]?_['map'](_0x495aba[_0x62d0('0x1c')],function(_0x130bc6){return{'model':db[_0x130bc6['model']],'as':_0x130bc6['as'],'attributes':_0x130bc6['attributes'],'include':_0x130bc6['include']?_['map'](_0x130bc6[_0x62d0('0x1c')],function(_0x15de54){return{'model':db[_0x15de54[_0x62d0('0x1d')]],'as':_0x15de54['as'],'attributes':_0x15de54[_0x62d0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x62d0('0xb')](function(_0x52cec8){logger['info'](_0x62d0('0x15'),_0x12036c);logger[_0x62d0('0xe')](_0x62d0('0x15'),_0x12036c,JSON[_0x62d0('0x10')](_0x52cec8));_0x1e7076(_0x52cec8);})['catch'](function(_0x44e51b){logger['error'](_0x62d0('0x15'),_0x44e51b[_0x62d0('0x13')],_0x12036c);_0x501c48(_0x510bd4[_0x62d0('0x11')](0x1f4,_0x44e51b[_0x62d0('0x13')]));});});};exports[_0x62d0('0x1e')]=function(_0x1ff4df){var _0x84dbb2=this;return new Promise(function(_0x382aa6,_0x36a5ec){return db[_0x62d0('0x16')][_0x62d0('0x1f')]({'raw':_0x1ff4df[_0x62d0('0x18')]?_0x1ff4df['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ff4df['options']?_0x1ff4df[_0x62d0('0x18')][_0x62d0('0x20')]||null:null,'attributes':_0x1ff4df['options']?_0x1ff4df[_0x62d0('0x18')][_0x62d0('0x1a')]||null:null,'include':_0x1ff4df['options']?_0x1ff4df[_0x62d0('0x18')][_0x62d0('0x1c')]?_[_0x62d0('0x1b')](_0x1ff4df['options'][_0x62d0('0x1c')],function(_0x5a5178){return{'model':db[_0x5a5178['model']],'as':_0x5a5178['as'],'attributes':_0x5a5178[_0x62d0('0x1a')],'include':_0x5a5178[_0x62d0('0x1c')]?_['map'](_0x5a5178[_0x62d0('0x1c')],function(_0x220d3e){return{'model':db[_0x220d3e[_0x62d0('0x1d')]],'as':_0x220d3e['as'],'attributes':_0x220d3e['attributes'],'include':_0x220d3e[_0x62d0('0x1c')]?_[_0x62d0('0x1b')](_0x220d3e[_0x62d0('0x1c')],function(_0x135bec){return{'model':db[_0x135bec['model']],'as':_0x135bec['as'],'attributes':_0x135bec['attributes']};}):[]};}):[]};}):[]:[]})[_0x62d0('0xb')](function(_0x1f0bff){logger[_0x62d0('0x21')](_0x62d0('0x1e'),_0x1ff4df);logger[_0x62d0('0xe')](_0x62d0('0x1e'),_0x1ff4df,JSON[_0x62d0('0x10')](_0x1f0bff));_0x382aa6(_0x1f0bff);})['catch'](function(_0x136d16){logger['error']('ShowSalesforceAccount',_0x136d16[_0x62d0('0x13')],_0x1ff4df);_0x36a5ec(_0x84dbb2[_0x62d0('0x11')](0x1f4,_0x136d16[_0x62d0('0x13')]));});});}; \ No newline at end of file +var _0x39f8=['raw','where','attributes','limit','map','include','model','find','ShowSalesforceAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','options'];(function(_0x2a88d8,_0x257370){var _0x16163c=function(_0xbdd7ea){while(--_0xbdd7ea){_0x2a88d8['push'](_0x2a88d8['shift']());}};_0x16163c(++_0x257370);}(_0x39f8,0xb3));var _0x839f=function(_0x4396f0,_0x186c64){_0x4396f0=_0x4396f0-0x0;var _0x587e57=_0x39f8[_0x4396f0];return _0x587e57;};'use strict';var _=require(_0x839f('0x0'));var util=require('util');var moment=require(_0x839f('0x1'));var BPromise=require(_0x839f('0x2'));var rs=require(_0x839f('0x3'));var fs=require('fs');var Redis=require(_0x839f('0x4'));var db=require(_0x839f('0x5'))['db'];var utils=require(_0x839f('0x6'));var logger=require(_0x839f('0x7'))('rpc');var config=require(_0x839f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x839f('0x9')][_0x839f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f41c5,_0x1a5123,_0x4d4f39){return new BPromise(function(_0x977ce3,_0x11d812){return client[_0x839f('0xb')](_0x5f41c5,_0x4d4f39)[_0x839f('0xc')](function(_0xdef23f){logger[_0x839f('0xd')](_0x839f('0xe'),_0x1a5123,_0x839f('0xf'));logger[_0x839f('0x10')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x1a5123,'request\x20sent',JSON[_0x839f('0x11')](_0xdef23f));if(_0xdef23f[_0x839f('0x12')]){if(_0xdef23f[_0x839f('0x12')]['code']===0x1f4){logger[_0x839f('0x12')]('SalesforceAccount,\x20%s,\x20%s',_0x1a5123,_0xdef23f[_0x839f('0x12')][_0x839f('0x13')]);return _0x11d812(_0xdef23f[_0x839f('0x12')][_0x839f('0x13')]);}logger[_0x839f('0x12')](_0x839f('0xe'),_0x1a5123,_0xdef23f[_0x839f('0x12')]['message']);return _0x977ce3(_0xdef23f[_0x839f('0x12')][_0x839f('0x13')]);}else{logger[_0x839f('0xd')](_0x839f('0xe'),_0x1a5123,'request\x20sent');_0x977ce3(_0xdef23f[_0x839f('0x14')][_0x839f('0x13')]);}})[_0x839f('0x15')](function(_0x43e662){logger['error'](_0x839f('0xe'),_0x1a5123,_0x43e662);_0x11d812(_0x43e662);});});}exports[_0x839f('0x16')]=function(_0x3ec6ce){var _0x386170=this;return new Promise(function(_0x2bb40e,_0x1d4011){return db[_0x839f('0x17')]['findAll']({'raw':_0x3ec6ce['options']?_0x3ec6ce[_0x839f('0x18')][_0x839f('0x19')]===undefined?!![]:![]:!![],'where':_0x3ec6ce['options']?_0x3ec6ce[_0x839f('0x18')][_0x839f('0x1a')]||null:null,'attributes':_0x3ec6ce['options']?_0x3ec6ce[_0x839f('0x18')][_0x839f('0x1b')]||null:null,'limit':_0x3ec6ce[_0x839f('0x18')]?_0x3ec6ce[_0x839f('0x18')][_0x839f('0x1c')]||null:null,'include':_0x3ec6ce[_0x839f('0x18')]?_0x3ec6ce[_0x839f('0x18')]['include']?_[_0x839f('0x1d')](_0x3ec6ce[_0x839f('0x18')][_0x839f('0x1e')],function(_0x188336){return{'model':db[_0x188336[_0x839f('0x1f')]],'as':_0x188336['as'],'attributes':_0x188336[_0x839f('0x1b')],'include':_0x188336[_0x839f('0x1e')]?_[_0x839f('0x1d')](_0x188336[_0x839f('0x1e')],function(_0x38d131){return{'model':db[_0x38d131['model']],'as':_0x38d131['as'],'attributes':_0x38d131[_0x839f('0x1b')],'include':_0x38d131[_0x839f('0x1e')]?_[_0x839f('0x1d')](_0x38d131[_0x839f('0x1e')],function(_0x250582){return{'model':db[_0x250582['model']],'as':_0x250582['as'],'attributes':_0x250582[_0x839f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x839f('0xc')](function(_0x12b73f){logger[_0x839f('0xd')](_0x839f('0x16'),_0x3ec6ce);logger[_0x839f('0x10')](_0x839f('0x16'),_0x3ec6ce,JSON[_0x839f('0x11')](_0x12b73f));_0x2bb40e(_0x12b73f);})[_0x839f('0x15')](function(_0x3893c7){logger['error'](_0x839f('0x16'),_0x3893c7[_0x839f('0x13')],_0x3ec6ce);_0x1d4011(_0x386170[_0x839f('0x12')](0x1f4,_0x3893c7[_0x839f('0x13')]));});});};exports['ShowSalesforceAccount']=function(_0x179ecc){var _0x1d6d82=this;return new Promise(function(_0x2419a6,_0x3b3661){return db[_0x839f('0x17')][_0x839f('0x20')]({'raw':_0x179ecc['options']?_0x179ecc['options'][_0x839f('0x19')]===undefined?!![]:![]:!![],'where':_0x179ecc[_0x839f('0x18')]?_0x179ecc[_0x839f('0x18')][_0x839f('0x1a')]||null:null,'attributes':_0x179ecc[_0x839f('0x18')]?_0x179ecc[_0x839f('0x18')][_0x839f('0x1b')]||null:null,'include':_0x179ecc[_0x839f('0x18')]?_0x179ecc[_0x839f('0x18')][_0x839f('0x1e')]?_[_0x839f('0x1d')](_0x179ecc[_0x839f('0x18')][_0x839f('0x1e')],function(_0x4cdcf7){return{'model':db[_0x4cdcf7['model']],'as':_0x4cdcf7['as'],'attributes':_0x4cdcf7[_0x839f('0x1b')],'include':_0x4cdcf7['include']?_[_0x839f('0x1d')](_0x4cdcf7['include'],function(_0x5398e8){return{'model':db[_0x5398e8[_0x839f('0x1f')]],'as':_0x5398e8['as'],'attributes':_0x5398e8['attributes'],'include':_0x5398e8[_0x839f('0x1e')]?_[_0x839f('0x1d')](_0x5398e8[_0x839f('0x1e')],function(_0x51764e){return{'model':db[_0x51764e[_0x839f('0x1f')]],'as':_0x51764e['as'],'attributes':_0x51764e[_0x839f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x839f('0xc')](function(_0x258659){logger[_0x839f('0xd')](_0x839f('0x21'),_0x179ecc);logger[_0x839f('0x10')](_0x839f('0x21'),_0x179ecc,JSON[_0x839f('0x11')](_0x258659));_0x2419a6(_0x258659);})[_0x839f('0x15')](function(_0x1361f3){logger['error']('ShowSalesforceAccount',_0x1361f3[_0x839f('0x13')],_0x179ecc);_0x3b3661(_0x1d6d82[_0x839f('0x12')](0x1f4,_0x1361f3[_0x839f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 5693499..5080cfc 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 _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x165a48,_0x44bc9d){var _0x6f6735=function(_0x510ec3){while(--_0x510ec3){_0x165a48['push'](_0x165a48['shift']());}};_0x6f6735(++_0x44bc9d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ff8a5,_0x39c030){_0x4ff8a5=_0x4ff8a5-0x0;var _0x27c636=_0x5f2f[_0x4ff8a5];return _0x27c636;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0xfce31d,_0x368b31){var _0x39d05b=function(_0x3a88c5){while(--_0x3a88c5){_0xfce31d['push'](_0xfce31d['shift']());}};_0x39d05b(++_0x368b31);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 21a7088..d0f6b22 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 _0xb235=['lead','account_contact_lead','account','nothing','contact','sequelize','exports','STRING','ENUM','Task','Case','contact_lead'];(function(_0x15112f,_0x4b9ce4){var _0x150caf=function(_0x123ec9){while(--_0x123ec9){_0x15112f['push'](_0x15112f['shift']());}};_0x150caf(++_0x4b9ce4);}(_0xb235,0x1c1));var _0x5b23=function(_0x542a9b,_0x351513){_0x542a9b=_0x542a9b-0x0;var _0x4d5032=_0xb235[_0x542a9b];return _0x4d5032;};'use strict';var Sequelize=require(_0x5b23('0x0'));module[_0x5b23('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5b23('0x2')]},'ticketType':{'type':Sequelize[_0x5b23('0x3')](_0x5b23('0x4'),_0x5b23('0x5')),'defaultValue':_0x5b23('0x4')},'moduleSearch':{'type':Sequelize[_0x5b23('0x3')](_0x5b23('0x6'),'contact',_0x5b23('0x7'),_0x5b23('0x8'),_0x5b23('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x5b23('0xa'),_0x5b23('0xb'),_0x5b23('0x7'),_0x5b23('0x9')),'defaultValue':_0x5b23('0x7')},'leadId':{'type':Sequelize[_0x5b23('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x5b23('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x5b23('0x2')]}}; \ No newline at end of file +var _0xc6bf=['contact_lead','contact','lead','account','nothing','sequelize','exports','STRING','ENUM','Task','Case'];(function(_0x20a3d5,_0x1a699f){var _0x5e9e1b=function(_0x9e9b6d){while(--_0x9e9b6d){_0x20a3d5['push'](_0x20a3d5['shift']());}};_0x5e9e1b(++_0x1a699f);}(_0xc6bf,0x118));var _0xfc6b=function(_0x36d57f,_0x2f9118){_0x36d57f=_0x36d57f-0x0;var _0x3f93fb=_0xc6bf[_0x36d57f];return _0x3f93fb;};'use strict';var Sequelize=require(_0xfc6b('0x0'));module[_0xfc6b('0x1')]={'name':{'type':Sequelize[_0xfc6b('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xfc6b('0x3')](_0xfc6b('0x4'),_0xfc6b('0x5')),'defaultValue':_0xfc6b('0x4')},'moduleSearch':{'type':Sequelize[_0xfc6b('0x3')](_0xfc6b('0x6'),_0xfc6b('0x7'),_0xfc6b('0x8'),'account_contact_lead',_0xfc6b('0x9')),'defaultValue':_0xfc6b('0x6')},'moduleCreate':{'type':Sequelize[_0xfc6b('0x3')](_0xfc6b('0xa'),_0xfc6b('0x7'),'lead','account'),'defaultValue':_0xfc6b('0x8')},'leadId':{'type':Sequelize[_0xfc6b('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xfc6b('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xfc6b('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 713531c..a93611b 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 _0x809d=['save','destroy','sendStatus','stack','name','index','map','SalesforceConfiguration','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','include','rows','catch','find','create','body','params','getFields','findOne','SalesforceField','sort','getSubjects','getDescriptions','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject'];(function(_0x3022c7,_0x3005ec){var _0x114226=function(_0x581aee){while(--_0x581aee){_0x3022c7['push'](_0x3022c7['shift']());}};_0x114226(++_0x3005ec);}(_0x809d,0xc1));var _0xd809=function(_0x2632cf,_0x189b08){_0x2632cf=_0x2632cf-0x0;var _0x385780=_0x809d[_0x2632cf];return _0x385780;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd809('0x0'));var rp=require(_0xd809('0x1'));var moment=require(_0xd809('0x2'));var BPromise=require(_0xd809('0x3'));var Mustache=require(_0xd809('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xd809('0x5'));var ejs=require(_0xd809('0x6'));var fs=require('fs');var fs_extra=require(_0xd809('0x7'));var _=require(_0xd809('0x8'));var squel=require('squel');var crypto=require(_0xd809('0x9'));var jsforce=require(_0xd809('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd809('0x5'));var querystring=require('querystring');var Papa=require(_0xd809('0xb'));var Redis=require(_0xd809('0xc'));var authService=require(_0xd809('0xd'));var qs=require(_0xd809('0xe'));var as=require(_0xd809('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd809('0x10'))(_0xd809('0x11'));var utils=require(_0xd809('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xd809('0x13'));var db=require(_0xd809('0x14'))['db'];function respondWithStatusCode(_0x1344da,_0xd07406){_0xd07406=_0xd07406||0xcc;return function(_0x4d9802){if(_0x4d9802){return _0x1344da['sendStatus'](_0xd07406);}return _0x1344da[_0xd809('0x15')](_0xd07406)[_0xd809('0x16')]();};}function respondWithResult(_0x3218d5,_0x555d32){_0x555d32=_0x555d32||0xc8;return function(_0xbe6630){if(_0xbe6630){return _0x3218d5[_0xd809('0x15')](_0x555d32)[_0xd809('0x17')](_0xbe6630);}};}function respondWithFilteredResult(_0x1be1aa,_0x212573){return function(_0x3dd659){if(_0x3dd659){var _0x231a88=typeof _0x212573['offset']===_0xd809('0x18')&&typeof _0x212573[_0xd809('0x19')]===_0xd809('0x18');var _0x1762da=_0x3dd659['count'];var _0xa96565=_0x231a88?0x0:_0x212573[_0xd809('0x1a')];var _0x126819=_0x231a88?_0x3dd659[_0xd809('0x1b')]:_0x212573[_0xd809('0x1a')]+_0x212573[_0xd809('0x19')];var _0x1bb895;if(_0x126819>=_0x1762da){_0x126819=_0x1762da;_0x1bb895=0xc8;}else{_0x1bb895=0xce;}_0x1be1aa[_0xd809('0x15')](_0x1bb895);return _0x1be1aa[_0xd809('0x1c')](_0xd809('0x1d'),_0xa96565+'-'+_0x126819+'/'+_0x1762da)[_0xd809('0x17')](_0x3dd659);}return null;};}function patchUpdates(_0x1d3b67){return function(_0x4b87bf){try{jsonpatch[_0xd809('0x1e')](_0x4b87bf,_0x1d3b67,!![]);}catch(_0x5e72a8){return BPromise[_0xd809('0x1f')](_0x5e72a8);}return _0x4b87bf[_0xd809('0x20')]();};}function saveUpdates(_0x16b212,_0x1595bd){return function(_0x29f244){if(_0x29f244){return _0x29f244['update'](_0x16b212)['then'](function(_0x49e71d){return _0x49e71d;});}return null;};}function removeEntity(_0x5c6641,_0x4b2915){return function(_0x43a978){if(_0x43a978){return _0x43a978[_0xd809('0x21')]()['then'](function(){_0x5c6641['status'](0xcc)[_0xd809('0x16')]();});}};}function handleEntityNotFound(_0x13a8fa,_0x4f3ecc){return function(_0x2151ff){if(!_0x2151ff){_0x13a8fa[_0xd809('0x22')](0x194);}return _0x2151ff;};}function handleError(_0x489cb5,_0x4d377e){_0x4d377e=_0x4d377e||0x1f4;return function(_0x442209){logger['error'](_0x442209[_0xd809('0x23')]);if(_0x442209['name']){delete _0x442209[_0xd809('0x24')];}_0x489cb5[_0xd809('0x15')](_0x4d377e)['send'](_0x442209);};}exports[_0xd809('0x25')]=function(_0x4b8e48,_0x426441){var _0x4e876c={},_0x688bb0={},_0x236d96={'count':0x0,'rows':[]};var _0x264fe0=_[_0xd809('0x26')](db[_0xd809('0x27')][_0xd809('0x28')],function(_0x5f218f){return{'name':_0x5f218f[_0xd809('0x29')],'type':_0x5f218f['type']['key']};});_0x688bb0[_0xd809('0x2a')]=_['map'](_0x264fe0,'name');_0x688bb0[_0xd809('0x2b')]=_[_0xd809('0x2c')](_0x4b8e48[_0xd809('0x2b')]);_0x688bb0[_0xd809('0x2d')]=_[_0xd809('0x2e')](_0x688bb0[_0xd809('0x2a')],_0x688bb0[_0xd809('0x2b')]);_0x4e876c['attributes']=_[_0xd809('0x2e')](_0x688bb0[_0xd809('0x2a')],qs[_0xd809('0x2f')](_0x4b8e48[_0xd809('0x2b')][_0xd809('0x2f')]));_0x4e876c[_0xd809('0x30')]=_0x4e876c['attributes'][_0xd809('0x31')]?_0x4e876c[_0xd809('0x30')]:_0x688bb0['model'];if(!_0x4b8e48['query'][_0xd809('0x32')](_0xd809('0x33'))){_0x4e876c[_0xd809('0x19')]=qs[_0xd809('0x19')](_0x4b8e48[_0xd809('0x2b')][_0xd809('0x19')]);_0x4e876c[_0xd809('0x1a')]=qs[_0xd809('0x1a')](_0x4b8e48[_0xd809('0x2b')][_0xd809('0x1a')]);}_0x4e876c[_0xd809('0x34')]=qs['sort'](_0x4b8e48[_0xd809('0x2b')]['sort']);_0x4e876c[_0xd809('0x35')]=qs['filters'](_[_0xd809('0x36')](_0x4b8e48['query'],_0x688bb0[_0xd809('0x2d')]),_0x264fe0);if(_0x4b8e48[_0xd809('0x2b')][_0xd809('0x37')]){_0x4e876c['where']=_[_0xd809('0x38')](_0x4e876c['where'],{'$or':_[_0xd809('0x26')](_0x264fe0,function(_0x35078f){if(_0x35078f[_0xd809('0x39')]!==_0xd809('0x3a')){var _0x1c0e17={};_0x1c0e17[_0x35078f[_0xd809('0x24')]]={'$like':'%'+_0x4b8e48[_0xd809('0x2b')]['filter']+'%'};return _0x1c0e17;}})});}_0x4e876c=_[_0xd809('0x38')]({},_0x4e876c,_0x4b8e48[_0xd809('0x3b')]);var _0x487074={'where':_0x4e876c[_0xd809('0x35')]};return db[_0xd809('0x27')]['count'](_0x487074)[_0xd809('0x3c')](function(_0x1bf16d){_0x236d96[_0xd809('0x1b')]=_0x1bf16d;if(_0x4b8e48[_0xd809('0x2b')][_0xd809('0x3d')]){_0x4e876c[_0xd809('0x3e')]=[{'all':!![]}];}return db['SalesforceConfiguration']['findAll'](_0x4e876c);})[_0xd809('0x3c')](function(_0x3d676b){_0x236d96[_0xd809('0x3f')]=_0x3d676b;return _0x236d96;})[_0xd809('0x3c')](respondWithFilteredResult(_0x426441,_0x4e876c))[_0xd809('0x40')](handleError(_0x426441,null));};exports['show']=function(_0x57d70f,_0x2102e8){var _0x32a65b={'raw':![],'where':{'id':_0x57d70f['params']['id']}},_0x9bf7be={};_0x9bf7be[_0xd809('0x2a')]=_[_0xd809('0x2c')](db[_0xd809('0x27')][_0xd809('0x28')]);_0x9bf7be[_0xd809('0x2b')]=_[_0xd809('0x2c')](_0x57d70f['query']);_0x9bf7be[_0xd809('0x2d')]=_['intersection'](_0x9bf7be[_0xd809('0x2a')],_0x9bf7be[_0xd809('0x2b')]);_0x32a65b[_0xd809('0x30')]=_['intersection'](_0x9bf7be['model'],qs[_0xd809('0x2f')](_0x57d70f[_0xd809('0x2b')][_0xd809('0x2f')]));_0x32a65b[_0xd809('0x30')]=_0x32a65b[_0xd809('0x30')][_0xd809('0x31')]?_0x32a65b[_0xd809('0x30')]:_0x9bf7be[_0xd809('0x2a')];if(_0x57d70f[_0xd809('0x2b')]['includeAll']){_0x32a65b['include']=[{'all':!![]}];}_0x32a65b=_[_0xd809('0x38')]({},_0x32a65b,_0x57d70f[_0xd809('0x3b')]);return db[_0xd809('0x27')][_0xd809('0x41')](_0x32a65b)[_0xd809('0x3c')](handleEntityNotFound(_0x2102e8,null))[_0xd809('0x3c')](respondWithResult(_0x2102e8,null))['catch'](handleError(_0x2102e8,null));};exports[_0xd809('0x42')]=function(_0x1862c4,_0x29c991){return db[_0xd809('0x27')][_0xd809('0x42')](_0x1862c4[_0xd809('0x43')],{})[_0xd809('0x3c')](respondWithResult(_0x29c991,0xc9))[_0xd809('0x40')](handleError(_0x29c991,null));};exports['update']=function(_0x46248b,_0x5c01e6){if(_0x46248b[_0xd809('0x43')]['id']){delete _0x46248b[_0xd809('0x43')]['id'];}return db[_0xd809('0x27')][_0xd809('0x41')]({'where':{'id':_0x46248b['params']['id']}})[_0xd809('0x3c')](handleEntityNotFound(_0x5c01e6,null))[_0xd809('0x3c')](saveUpdates(_0x46248b[_0xd809('0x43')],null))['then'](respondWithResult(_0x5c01e6,null))[_0xd809('0x40')](handleError(_0x5c01e6,null));};exports[_0xd809('0x21')]=function(_0x4ed511,_0x1080b6){return db['SalesforceConfiguration'][_0xd809('0x41')]({'where':{'id':_0x4ed511[_0xd809('0x44')]['id']}})[_0xd809('0x3c')](handleEntityNotFound(_0x1080b6,null))[_0xd809('0x3c')](removeEntity(_0x1080b6,null))[_0xd809('0x40')](handleError(_0x1080b6,null));};exports[_0xd809('0x45')]=function(_0x178ff1,_0x147807,_0x1ef831){var _0xa00c2={};var _0x1f8af1={};var _0x4351bb;var _0x47f286;return db['SalesforceConfiguration'][_0xd809('0x46')]({'where':{'id':_0x178ff1[_0xd809('0x44')]['id']}})[_0xd809('0x3c')](handleEntityNotFound(_0x147807,null))[_0xd809('0x3c')](function(_0xd8a85e){if(_0xd8a85e){_0x4351bb=_0xd8a85e;_0x1f8af1[_0xd809('0x2a')]=_[_0xd809('0x2c')](db[_0xd809('0x47')][_0xd809('0x28')]);_0x1f8af1[_0xd809('0x2b')]=_['keys'](_0x178ff1[_0xd809('0x2b')]);_0x1f8af1[_0xd809('0x2d')]=_[_0xd809('0x2e')](_0x1f8af1[_0xd809('0x2a')],_0x1f8af1[_0xd809('0x2b')]);_0xa00c2['attributes']=_[_0xd809('0x2e')](_0x1f8af1['model'],qs[_0xd809('0x2f')](_0x178ff1['query'][_0xd809('0x2f')]));_0xa00c2[_0xd809('0x30')]=_0xa00c2['attributes'][_0xd809('0x31')]?_0xa00c2['attributes']:_0x1f8af1[_0xd809('0x2a')];_0xa00c2[_0xd809('0x34')]=qs['sort'](_0x178ff1[_0xd809('0x2b')][_0xd809('0x48')]);_0xa00c2[_0xd809('0x35')]=qs[_0xd809('0x2d')](_['pick'](_0x178ff1[_0xd809('0x2b')],_0x1f8af1[_0xd809('0x2d')]));if(_0x178ff1[_0xd809('0x2b')][_0xd809('0x37')]){_0xa00c2[_0xd809('0x35')]=_['merge'](_0xa00c2['where'],{'$or':_[_0xd809('0x26')](_0xa00c2[_0xd809('0x30')],function(_0x5ba72a){var _0x5e37b6={};_0x5e37b6[_0x5ba72a]={'$like':'%'+_0x178ff1['query'][_0xd809('0x37')]+'%'};return _0x5e37b6;})});}_0xa00c2=_[_0xd809('0x38')]({},_0xa00c2,_0x178ff1[_0xd809('0x3b')]);return _0x4351bb['getFields'](_0xa00c2);}})[_0xd809('0x3c')](function(_0x3f642d){if(_0x3f642d){_0x47f286=_0x3f642d[_0xd809('0x31')];if(!_0x178ff1[_0xd809('0x2b')][_0xd809('0x32')](_0xd809('0x33'))){_0xa00c2['limit']=qs['limit'](_0x178ff1[_0xd809('0x2b')][_0xd809('0x19')]);_0xa00c2[_0xd809('0x1a')]=qs[_0xd809('0x1a')](_0x178ff1['query'][_0xd809('0x1a')]);}return _0x4351bb['getFields'](_0xa00c2);}})[_0xd809('0x3c')](function(_0x1fc4b6){if(_0x1fc4b6){return _0x1fc4b6?{'count':_0x47f286,'rows':_0x1fc4b6}:null;}})[_0xd809('0x3c')](respondWithResult(_0x147807,null))[_0xd809('0x40')](handleError(_0x147807,null));};exports[_0xd809('0x49')]=function(_0x549c24,_0x1208c9,_0x4b0894){var _0x44e872={};var _0x49eab={};var _0x382713;var _0x2ac05d;return db[_0xd809('0x27')][_0xd809('0x46')]({'where':{'id':_0x549c24[_0xd809('0x44')]['id']}})[_0xd809('0x3c')](handleEntityNotFound(_0x1208c9,null))[_0xd809('0x3c')](function(_0x4aa69a){if(_0x4aa69a){_0x382713=_0x4aa69a;_0x49eab[_0xd809('0x2a')]=_[_0xd809('0x2c')](db['SalesforceField']['rawAttributes']);_0x49eab['query']=_[_0xd809('0x2c')](_0x549c24['query']);_0x49eab['filters']=_['intersection'](_0x49eab[_0xd809('0x2a')],_0x49eab[_0xd809('0x2b')]);_0x44e872[_0xd809('0x30')]=_['intersection'](_0x49eab[_0xd809('0x2a')],qs[_0xd809('0x2f')](_0x549c24['query']['fields']));_0x44e872[_0xd809('0x30')]=_0x44e872[_0xd809('0x30')][_0xd809('0x31')]?_0x44e872[_0xd809('0x30')]:_0x49eab['model'];_0x44e872[_0xd809('0x34')]=qs['sort'](_0x549c24[_0xd809('0x2b')]['sort']);_0x44e872['where']=qs[_0xd809('0x2d')](_[_0xd809('0x36')](_0x549c24['query'],_0x49eab[_0xd809('0x2d')]));if(_0x549c24[_0xd809('0x2b')][_0xd809('0x37')]){_0x44e872['where']=_[_0xd809('0x38')](_0x44e872[_0xd809('0x35')],{'$or':_[_0xd809('0x26')](_0x44e872['attributes'],function(_0x3c0855){var _0x3b5725={};_0x3b5725[_0x3c0855]={'$like':'%'+_0x549c24['query'][_0xd809('0x37')]+'%'};return _0x3b5725;})});}_0x44e872=_[_0xd809('0x38')]({},_0x44e872,_0x549c24[_0xd809('0x3b')]);return _0x382713[_0xd809('0x49')](_0x44e872);}})[_0xd809('0x3c')](function(_0x541caa){if(_0x541caa){_0x2ac05d=_0x541caa[_0xd809('0x31')];if(!_0x549c24[_0xd809('0x2b')]['hasOwnProperty'](_0xd809('0x33'))){_0x44e872[_0xd809('0x19')]=qs['limit'](_0x549c24['query']['limit']);_0x44e872[_0xd809('0x1a')]=qs['offset'](_0x549c24[_0xd809('0x2b')][_0xd809('0x1a')]);}return _0x382713[_0xd809('0x49')](_0x44e872);}})[_0xd809('0x3c')](function(_0x45e2e6){if(_0x45e2e6){return _0x45e2e6?{'count':_0x2ac05d,'rows':_0x45e2e6}:null;}})[_0xd809('0x3c')](respondWithResult(_0x1208c9,null))[_0xd809('0x40')](handleError(_0x1208c9,null));};exports[_0xd809('0x4a')]=function(_0x52e789,_0x31cb6c,_0x2558b9){var _0x14c424={};var _0x419db9={};var _0xdd480b;var _0x4517d1;return db[_0xd809('0x27')]['findOne']({'where':{'id':_0x52e789[_0xd809('0x44')]['id']}})[_0xd809('0x3c')](handleEntityNotFound(_0x31cb6c,null))[_0xd809('0x3c')](function(_0x123b89){if(_0x123b89){_0xdd480b=_0x123b89;_0x419db9[_0xd809('0x2a')]=_[_0xd809('0x2c')](db[_0xd809('0x47')]['rawAttributes']);_0x419db9[_0xd809('0x2b')]=_[_0xd809('0x2c')](_0x52e789[_0xd809('0x2b')]);_0x419db9[_0xd809('0x2d')]=_[_0xd809('0x2e')](_0x419db9[_0xd809('0x2a')],_0x419db9[_0xd809('0x2b')]);_0x14c424[_0xd809('0x30')]=_[_0xd809('0x2e')](_0x419db9[_0xd809('0x2a')],qs[_0xd809('0x2f')](_0x52e789[_0xd809('0x2b')]['fields']));_0x14c424[_0xd809('0x30')]=_0x14c424[_0xd809('0x30')][_0xd809('0x31')]?_0x14c424['attributes']:_0x419db9['model'];_0x14c424['order']=qs[_0xd809('0x48')](_0x52e789[_0xd809('0x2b')][_0xd809('0x48')]);_0x14c424[_0xd809('0x35')]=qs[_0xd809('0x2d')](_[_0xd809('0x36')](_0x52e789['query'],_0x419db9[_0xd809('0x2d')]));if(_0x52e789['query'][_0xd809('0x37')]){_0x14c424[_0xd809('0x35')]=_['merge'](_0x14c424[_0xd809('0x35')],{'$or':_['map'](_0x14c424[_0xd809('0x30')],function(_0x31aa7f){var _0x36e8ba={};_0x36e8ba[_0x31aa7f]={'$like':'%'+_0x52e789[_0xd809('0x2b')][_0xd809('0x37')]+'%'};return _0x36e8ba;})});}_0x14c424=_[_0xd809('0x38')]({},_0x14c424,_0x52e789[_0xd809('0x3b')]);return _0xdd480b[_0xd809('0x4a')](_0x14c424);}})[_0xd809('0x3c')](function(_0x5d7e9d){if(_0x5d7e9d){_0x4517d1=_0x5d7e9d['length'];if(!_0x52e789['query'][_0xd809('0x32')](_0xd809('0x33'))){_0x14c424['limit']=qs[_0xd809('0x19')](_0x52e789['query'][_0xd809('0x19')]);_0x14c424['offset']=qs[_0xd809('0x1a')](_0x52e789[_0xd809('0x2b')]['offset']);}return _0xdd480b[_0xd809('0x4a')](_0x14c424);}})[_0xd809('0x3c')](function(_0x1e3890){if(_0x1e3890){return _0x1e3890?{'count':_0x4517d1,'rows':_0x1e3890}:null;}})[_0xd809('0x3c')](respondWithResult(_0x31cb6c,null))[_0xd809('0x40')](handleError(_0x31cb6c,null));}; \ No newline at end of file +var _0x4325=['index','map','SalesforceConfiguration','type','model','keys','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send'];(function(_0x4f23e0,_0x35ba7d){var _0x107d4f=function(_0x395ab3){while(--_0x395ab3){_0x4f23e0['push'](_0x4f23e0['shift']());}};_0x107d4f(++_0x35ba7d);}(_0x4325,0x159));var _0x5432=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4325[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5432('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5432('0x1'));var rp=require(_0x5432('0x2'));var moment=require(_0x5432('0x3'));var BPromise=require(_0x5432('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5432('0x5'));var sox=require(_0x5432('0x6'));var csv=require(_0x5432('0x7'));var ejs=require(_0x5432('0x8'));var fs=require('fs');var fs_extra=require(_0x5432('0x9'));var _=require(_0x5432('0xa'));var squel=require('squel');var crypto=require(_0x5432('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5432('0xc'));var toCsv=require(_0x5432('0x7'));var querystring=require(_0x5432('0xd'));var Papa=require(_0x5432('0xe'));var Redis=require(_0x5432('0xf'));var authService=require(_0x5432('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5432('0x11'));var hardwareService=require(_0x5432('0x12'));var logger=require('../../config/logger')(_0x5432('0x13'));var utils=require(_0x5432('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5432('0x15'));var db=require(_0x5432('0x16'))['db'];function respondWithStatusCode(_0x14f9c4,_0x36448a){_0x36448a=_0x36448a||0xcc;return function(_0x24164c){if(_0x24164c){return _0x14f9c4[_0x5432('0x17')](_0x36448a);}return _0x14f9c4[_0x5432('0x18')](_0x36448a)[_0x5432('0x19')]();};}function respondWithResult(_0x5d9452,_0x2033d3){_0x2033d3=_0x2033d3||0xc8;return function(_0x4f229c){if(_0x4f229c){return _0x5d9452[_0x5432('0x18')](_0x2033d3)['json'](_0x4f229c);}};}function respondWithFilteredResult(_0x364308,_0x396973){return function(_0x4e6efa){if(_0x4e6efa){var _0x30bd49=typeof _0x396973[_0x5432('0x1a')]===_0x5432('0x1b')&&typeof _0x396973[_0x5432('0x1c')]==='undefined';var _0x3c0484=_0x4e6efa[_0x5432('0x1d')];var _0x391704=_0x30bd49?0x0:_0x396973[_0x5432('0x1a')];var _0xe280d8=_0x30bd49?_0x4e6efa[_0x5432('0x1d')]:_0x396973[_0x5432('0x1a')]+_0x396973[_0x5432('0x1c')];var _0x68338e;if(_0xe280d8>=_0x3c0484){_0xe280d8=_0x3c0484;_0x68338e=0xc8;}else{_0x68338e=0xce;}_0x364308[_0x5432('0x18')](_0x68338e);return _0x364308[_0x5432('0x1e')](_0x5432('0x1f'),_0x391704+'-'+_0xe280d8+'/'+_0x3c0484)['json'](_0x4e6efa);}return null;};}function patchUpdates(_0x21cdcf){return function(_0x35d89e){try{jsonpatch[_0x5432('0x20')](_0x35d89e,_0x21cdcf,!![]);}catch(_0x113d7d){return BPromise['reject'](_0x113d7d);}return _0x35d89e[_0x5432('0x21')]();};}function saveUpdates(_0x4a50b7,_0x3ee8b8){return function(_0x2f0ef8){if(_0x2f0ef8){return _0x2f0ef8[_0x5432('0x22')](_0x4a50b7)[_0x5432('0x23')](function(_0x49101e){return _0x49101e;});}return null;};}function removeEntity(_0x206816,_0x28fe0c){return function(_0x135f02){if(_0x135f02){return _0x135f02['destroy']()[_0x5432('0x23')](function(){_0x206816[_0x5432('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3409c2,_0x32d733){return function(_0x14ed88){if(!_0x14ed88){_0x3409c2[_0x5432('0x17')](0x194);}return _0x14ed88;};}function handleError(_0x2ec32b,_0x59894e){_0x59894e=_0x59894e||0x1f4;return function(_0x5765bc){logger[_0x5432('0x24')](_0x5765bc[_0x5432('0x25')]);if(_0x5765bc['name']){delete _0x5765bc[_0x5432('0x26')];}_0x2ec32b['status'](_0x59894e)[_0x5432('0x27')](_0x5765bc);};}exports[_0x5432('0x28')]=function(_0x435a73,_0x2dd9e2){var _0x1229d1={},_0x14b62f={},_0x577a44={'count':0x0,'rows':[]};var _0x3f32b3=_[_0x5432('0x29')](db[_0x5432('0x2a')]['rawAttributes'],function(_0x1274da){return{'name':_0x1274da['fieldName'],'type':_0x1274da[_0x5432('0x2b')]['key']};});_0x14b62f[_0x5432('0x2c')]=_[_0x5432('0x29')](_0x3f32b3,_0x5432('0x26'));_0x14b62f['query']=_[_0x5432('0x2d')](_0x435a73[_0x5432('0x2e')]);_0x14b62f['filters']=_[_0x5432('0x2f')](_0x14b62f[_0x5432('0x2c')],_0x14b62f['query']);_0x1229d1[_0x5432('0x30')]=_[_0x5432('0x2f')](_0x14b62f[_0x5432('0x2c')],qs['fields'](_0x435a73['query'][_0x5432('0x31')]));_0x1229d1[_0x5432('0x30')]=_0x1229d1[_0x5432('0x30')]['length']?_0x1229d1[_0x5432('0x30')]:_0x14b62f[_0x5432('0x2c')];if(!_0x435a73[_0x5432('0x2e')]['hasOwnProperty'](_0x5432('0x32'))){_0x1229d1['limit']=qs['limit'](_0x435a73[_0x5432('0x2e')][_0x5432('0x1c')]);_0x1229d1[_0x5432('0x1a')]=qs['offset'](_0x435a73[_0x5432('0x2e')][_0x5432('0x1a')]);}_0x1229d1[_0x5432('0x33')]=qs[_0x5432('0x34')](_0x435a73[_0x5432('0x2e')]['sort']);_0x1229d1[_0x5432('0x35')]=qs[_0x5432('0x36')](_[_0x5432('0x37')](_0x435a73[_0x5432('0x2e')],_0x14b62f[_0x5432('0x36')]),_0x3f32b3);if(_0x435a73[_0x5432('0x2e')]['filter']){_0x1229d1[_0x5432('0x35')]=_[_0x5432('0x38')](_0x1229d1[_0x5432('0x35')],{'$or':_['map'](_0x3f32b3,function(_0x166111){if(_0x166111[_0x5432('0x2b')]!==_0x5432('0x39')){var _0x56eccb={};_0x56eccb[_0x166111[_0x5432('0x26')]]={'$like':'%'+_0x435a73[_0x5432('0x2e')][_0x5432('0x3a')]+'%'};return _0x56eccb;}})});}_0x1229d1=_[_0x5432('0x38')]({},_0x1229d1,_0x435a73[_0x5432('0x3b')]);var _0x30551c={'where':_0x1229d1[_0x5432('0x35')]};return db[_0x5432('0x2a')][_0x5432('0x1d')](_0x30551c)[_0x5432('0x23')](function(_0xed70b5){_0x577a44[_0x5432('0x1d')]=_0xed70b5;if(_0x435a73['query'][_0x5432('0x3c')]){_0x1229d1['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x5432('0x3d')](_0x1229d1);})['then'](function(_0x3620d5){_0x577a44[_0x5432('0x3e')]=_0x3620d5;return _0x577a44;})[_0x5432('0x23')](respondWithFilteredResult(_0x2dd9e2,_0x1229d1))[_0x5432('0x3f')](handleError(_0x2dd9e2,null));};exports[_0x5432('0x40')]=function(_0x38afb1,_0x558e01){var _0x838a12={'raw':![],'where':{'id':_0x38afb1[_0x5432('0x41')]['id']}},_0xcbbdc1={};_0xcbbdc1[_0x5432('0x2c')]=_['keys'](db[_0x5432('0x2a')][_0x5432('0x42')]);_0xcbbdc1[_0x5432('0x2e')]=_[_0x5432('0x2d')](_0x38afb1[_0x5432('0x2e')]);_0xcbbdc1['filters']=_[_0x5432('0x2f')](_0xcbbdc1[_0x5432('0x2c')],_0xcbbdc1[_0x5432('0x2e')]);_0x838a12[_0x5432('0x30')]=_[_0x5432('0x2f')](_0xcbbdc1[_0x5432('0x2c')],qs[_0x5432('0x31')](_0x38afb1['query'][_0x5432('0x31')]));_0x838a12[_0x5432('0x30')]=_0x838a12[_0x5432('0x30')][_0x5432('0x43')]?_0x838a12[_0x5432('0x30')]:_0xcbbdc1['model'];if(_0x38afb1[_0x5432('0x2e')][_0x5432('0x3c')]){_0x838a12[_0x5432('0x44')]=[{'all':!![]}];}_0x838a12=_[_0x5432('0x38')]({},_0x838a12,_0x38afb1[_0x5432('0x3b')]);return db[_0x5432('0x2a')][_0x5432('0x45')](_0x838a12)['then'](handleEntityNotFound(_0x558e01,null))[_0x5432('0x23')](respondWithResult(_0x558e01,null))['catch'](handleError(_0x558e01,null));};exports['create']=function(_0xbb5444,_0x44276c){return db[_0x5432('0x2a')][_0x5432('0x46')](_0xbb5444['body'],{})[_0x5432('0x23')](respondWithResult(_0x44276c,0xc9))[_0x5432('0x3f')](handleError(_0x44276c,null));};exports[_0x5432('0x22')]=function(_0x2952c0,_0x47cf26){if(_0x2952c0[_0x5432('0x47')]['id']){delete _0x2952c0[_0x5432('0x47')]['id'];}return db[_0x5432('0x2a')]['find']({'where':{'id':_0x2952c0['params']['id']}})[_0x5432('0x23')](handleEntityNotFound(_0x47cf26,null))[_0x5432('0x23')](saveUpdates(_0x2952c0[_0x5432('0x47')],null))['then'](respondWithResult(_0x47cf26,null))['catch'](handleError(_0x47cf26,null));};exports['destroy']=function(_0x2daa66,_0x46d01a){return db[_0x5432('0x2a')][_0x5432('0x45')]({'where':{'id':_0x2daa66['params']['id']}})[_0x5432('0x23')](handleEntityNotFound(_0x46d01a,null))[_0x5432('0x23')](removeEntity(_0x46d01a,null))[_0x5432('0x3f')](handleError(_0x46d01a,null));};exports[_0x5432('0x48')]=function(_0x32b895,_0x34c1ca,_0x10db59){var _0x426149={};var _0x561b02={};var _0x96d01b;var _0x30516e;return db[_0x5432('0x2a')][_0x5432('0x49')]({'where':{'id':_0x32b895[_0x5432('0x41')]['id']}})[_0x5432('0x23')](handleEntityNotFound(_0x34c1ca,null))['then'](function(_0xb05420){if(_0xb05420){_0x96d01b=_0xb05420;_0x561b02['model']=_['keys'](db[_0x5432('0x4a')]['rawAttributes']);_0x561b02[_0x5432('0x2e')]=_[_0x5432('0x2d')](_0x32b895[_0x5432('0x2e')]);_0x561b02['filters']=_[_0x5432('0x2f')](_0x561b02['model'],_0x561b02['query']);_0x426149['attributes']=_['intersection'](_0x561b02[_0x5432('0x2c')],qs[_0x5432('0x31')](_0x32b895[_0x5432('0x2e')][_0x5432('0x31')]));_0x426149['attributes']=_0x426149[_0x5432('0x30')][_0x5432('0x43')]?_0x426149[_0x5432('0x30')]:_0x561b02['model'];_0x426149[_0x5432('0x33')]=qs[_0x5432('0x34')](_0x32b895[_0x5432('0x2e')][_0x5432('0x34')]);_0x426149[_0x5432('0x35')]=qs[_0x5432('0x36')](_['pick'](_0x32b895[_0x5432('0x2e')],_0x561b02['filters']));if(_0x32b895['query'][_0x5432('0x3a')]){_0x426149[_0x5432('0x35')]=_['merge'](_0x426149[_0x5432('0x35')],{'$or':_[_0x5432('0x29')](_0x426149[_0x5432('0x30')],function(_0x48d0c7){var _0x1df3fd={};_0x1df3fd[_0x48d0c7]={'$like':'%'+_0x32b895[_0x5432('0x2e')]['filter']+'%'};return _0x1df3fd;})});}_0x426149=_[_0x5432('0x38')]({},_0x426149,_0x32b895['options']);return _0x96d01b[_0x5432('0x48')](_0x426149);}})[_0x5432('0x23')](function(_0x5e8b58){if(_0x5e8b58){_0x30516e=_0x5e8b58[_0x5432('0x43')];if(!_0x32b895[_0x5432('0x2e')]['hasOwnProperty']('nolimit')){_0x426149[_0x5432('0x1c')]=qs['limit'](_0x32b895['query'][_0x5432('0x1c')]);_0x426149[_0x5432('0x1a')]=qs[_0x5432('0x1a')](_0x32b895[_0x5432('0x2e')]['offset']);}return _0x96d01b['getFields'](_0x426149);}})[_0x5432('0x23')](function(_0x2879c){if(_0x2879c){return _0x2879c?{'count':_0x30516e,'rows':_0x2879c}:null;}})[_0x5432('0x23')](respondWithResult(_0x34c1ca,null))[_0x5432('0x3f')](handleError(_0x34c1ca,null));};exports['getSubjects']=function(_0x20f499,_0x19ca29,_0x38078d){var _0x4b70b9={};var _0x51d513={};var _0x2b79a4;var _0x2265c5;return db[_0x5432('0x2a')][_0x5432('0x49')]({'where':{'id':_0x20f499[_0x5432('0x41')]['id']}})[_0x5432('0x23')](handleEntityNotFound(_0x19ca29,null))[_0x5432('0x23')](function(_0x49d87a){if(_0x49d87a){_0x2b79a4=_0x49d87a;_0x51d513[_0x5432('0x2c')]=_[_0x5432('0x2d')](db[_0x5432('0x4a')][_0x5432('0x42')]);_0x51d513[_0x5432('0x2e')]=_[_0x5432('0x2d')](_0x20f499[_0x5432('0x2e')]);_0x51d513[_0x5432('0x36')]=_[_0x5432('0x2f')](_0x51d513[_0x5432('0x2c')],_0x51d513['query']);_0x4b70b9[_0x5432('0x30')]=_[_0x5432('0x2f')](_0x51d513[_0x5432('0x2c')],qs[_0x5432('0x31')](_0x20f499[_0x5432('0x2e')][_0x5432('0x31')]));_0x4b70b9[_0x5432('0x30')]=_0x4b70b9[_0x5432('0x30')][_0x5432('0x43')]?_0x4b70b9[_0x5432('0x30')]:_0x51d513[_0x5432('0x2c')];_0x4b70b9[_0x5432('0x33')]=qs[_0x5432('0x34')](_0x20f499[_0x5432('0x2e')][_0x5432('0x34')]);_0x4b70b9[_0x5432('0x35')]=qs['filters'](_['pick'](_0x20f499[_0x5432('0x2e')],_0x51d513[_0x5432('0x36')]));if(_0x20f499[_0x5432('0x2e')][_0x5432('0x3a')]){_0x4b70b9[_0x5432('0x35')]=_[_0x5432('0x38')](_0x4b70b9[_0x5432('0x35')],{'$or':_[_0x5432('0x29')](_0x4b70b9[_0x5432('0x30')],function(_0xd2a653){var _0x1fa68f={};_0x1fa68f[_0xd2a653]={'$like':'%'+_0x20f499[_0x5432('0x2e')][_0x5432('0x3a')]+'%'};return _0x1fa68f;})});}_0x4b70b9=_[_0x5432('0x38')]({},_0x4b70b9,_0x20f499[_0x5432('0x3b')]);return _0x2b79a4[_0x5432('0x4b')](_0x4b70b9);}})[_0x5432('0x23')](function(_0x3fa17e){if(_0x3fa17e){_0x2265c5=_0x3fa17e['length'];if(!_0x20f499['query']['hasOwnProperty'](_0x5432('0x32'))){_0x4b70b9[_0x5432('0x1c')]=qs['limit'](_0x20f499[_0x5432('0x2e')][_0x5432('0x1c')]);_0x4b70b9['offset']=qs[_0x5432('0x1a')](_0x20f499[_0x5432('0x2e')][_0x5432('0x1a')]);}return _0x2b79a4[_0x5432('0x4b')](_0x4b70b9);}})[_0x5432('0x23')](function(_0x8648fa){if(_0x8648fa){return _0x8648fa?{'count':_0x2265c5,'rows':_0x8648fa}:null;}})[_0x5432('0x23')](respondWithResult(_0x19ca29,null))[_0x5432('0x3f')](handleError(_0x19ca29,null));};exports[_0x5432('0x4c')]=function(_0x58690e,_0x1ba3e8,_0x479b58){var _0x2ae499={};var _0x2d0720={};var _0x463106;var _0x2cc74f;return db['SalesforceConfiguration'][_0x5432('0x49')]({'where':{'id':_0x58690e[_0x5432('0x41')]['id']}})[_0x5432('0x23')](handleEntityNotFound(_0x1ba3e8,null))['then'](function(_0x42c8b6){if(_0x42c8b6){_0x463106=_0x42c8b6;_0x2d0720[_0x5432('0x2c')]=_['keys'](db[_0x5432('0x4a')][_0x5432('0x42')]);_0x2d0720[_0x5432('0x2e')]=_[_0x5432('0x2d')](_0x58690e[_0x5432('0x2e')]);_0x2d0720[_0x5432('0x36')]=_[_0x5432('0x2f')](_0x2d0720[_0x5432('0x2c')],_0x2d0720[_0x5432('0x2e')]);_0x2ae499[_0x5432('0x30')]=_[_0x5432('0x2f')](_0x2d0720['model'],qs['fields'](_0x58690e[_0x5432('0x2e')][_0x5432('0x31')]));_0x2ae499['attributes']=_0x2ae499['attributes'][_0x5432('0x43')]?_0x2ae499[_0x5432('0x30')]:_0x2d0720[_0x5432('0x2c')];_0x2ae499[_0x5432('0x33')]=qs[_0x5432('0x34')](_0x58690e[_0x5432('0x2e')][_0x5432('0x34')]);_0x2ae499['where']=qs[_0x5432('0x36')](_[_0x5432('0x37')](_0x58690e[_0x5432('0x2e')],_0x2d0720[_0x5432('0x36')]));if(_0x58690e[_0x5432('0x2e')]['filter']){_0x2ae499[_0x5432('0x35')]=_[_0x5432('0x38')](_0x2ae499[_0x5432('0x35')],{'$or':_[_0x5432('0x29')](_0x2ae499[_0x5432('0x30')],function(_0x1cfef4){var _0xc68c6c={};_0xc68c6c[_0x1cfef4]={'$like':'%'+_0x58690e[_0x5432('0x2e')][_0x5432('0x3a')]+'%'};return _0xc68c6c;})});}_0x2ae499=_[_0x5432('0x38')]({},_0x2ae499,_0x58690e[_0x5432('0x3b')]);return _0x463106[_0x5432('0x4c')](_0x2ae499);}})[_0x5432('0x23')](function(_0x4dde40){if(_0x4dde40){_0x2cc74f=_0x4dde40[_0x5432('0x43')];if(!_0x58690e[_0x5432('0x2e')]['hasOwnProperty'](_0x5432('0x32'))){_0x2ae499[_0x5432('0x1c')]=qs[_0x5432('0x1c')](_0x58690e[_0x5432('0x2e')][_0x5432('0x1c')]);_0x2ae499['offset']=qs[_0x5432('0x1a')](_0x58690e[_0x5432('0x2e')]['offset']);}return _0x463106[_0x5432('0x4c')](_0x2ae499);}})[_0x5432('0x23')](function(_0x1435f4){if(_0x1435f4){return _0x1435f4?{'count':_0x2cc74f,'rows':_0x1435f4}:null;}})[_0x5432('0x23')](respondWithResult(_0x1ba3e8,null))[_0x5432('0x3f')](handleError(_0x1ba3e8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2d9c8a8..ee306af 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 _0xd95e=['SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd95e,0x1a6));var _0xed95=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd95e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xed95('0x0'));var util=require(_0xed95('0x1'));var logger=require(_0xed95('0x2'))(_0xed95('0x3'));var moment=require(_0xed95('0x4'));var BPromise=require(_0xed95('0x5'));var rp=require(_0xed95('0x6'));var fs=require('fs');var path=require(_0xed95('0x7'));var rimraf=require(_0xed95('0x8'));var config=require('../../config/environment');var attributes=require(_0xed95('0x9'));module[_0xed95('0xa')]=function(_0x3e4a47,_0x5160ca){return _0x3e4a47[_0xed95('0xb')](_0xed95('0xc'),attributes,{'tableName':_0xed95('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0464=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','util'];(function(_0x16acc6,_0x3dd9ae){var _0x2970f1=function(_0x40e0ad){while(--_0x40e0ad){_0x16acc6['push'](_0x16acc6['shift']());}};_0x2970f1(++_0x3dd9ae);}(_0x0464,0xe3));var _0x4046=function(_0x46482f,_0x41943f){_0x46482f=_0x46482f-0x0;var _0x374eb3=_0x0464[_0x46482f];return _0x374eb3;};'use strict';var _=require('lodash');var util=require(_0x4046('0x0'));var logger=require(_0x4046('0x1'))(_0x4046('0x2'));var moment=require(_0x4046('0x3'));var BPromise=require(_0x4046('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4046('0x5'));var config=require(_0x4046('0x6'));var attributes=require(_0x4046('0x7'));module[_0x4046('0x8')]=function(_0x3e337b,_0x136ba3){return _0x3e337b[_0x4046('0x9')](_0x4046('0xa'),attributes,{'tableName':_0x4046('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index a9247d8..f7352aa 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 _0x4121=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','error','code','message','SalesforceConfiguration,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring'];(function(_0x2bd335,_0x10badd){var _0x4faf9c=function(_0x4c283c){while(--_0x4c283c){_0x2bd335['push'](_0x2bd335['shift']());}};_0x4faf9c(++_0x10badd);}(_0x4121,0x1b4));var _0x1412=function(_0x162e9c,_0x1f66b9){_0x162e9c=_0x162e9c-0x0;var _0x434df9=_0x4121[_0x162e9c];return _0x434df9;};'use strict';var _=require(_0x1412('0x0'));var util=require(_0x1412('0x1'));var moment=require('moment');var BPromise=require(_0x1412('0x2'));var rs=require(_0x1412('0x3'));var fs=require('fs');var Redis=require(_0x1412('0x4'));var db=require(_0x1412('0x5'))['db'];var utils=require(_0x1412('0x6'));var logger=require(_0x1412('0x7'))(_0x1412('0x8'));var config=require('../../config/environment');var jayson=require(_0x1412('0x9'));var client=jayson[_0x1412('0xa')][_0x1412('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f4cd4,_0x528998,_0x58700f){return new BPromise(function(_0xd07b38,_0x2150f9){return client[_0x1412('0xc')](_0x4f4cd4,_0x58700f)[_0x1412('0xd')](function(_0x56ab7f){logger[_0x1412('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x528998,_0x1412('0xf'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x528998,_0x1412('0xf'),JSON['stringify'](_0x56ab7f));if(_0x56ab7f[_0x1412('0x10')]){if(_0x56ab7f[_0x1412('0x10')][_0x1412('0x11')]===0x1f4){logger[_0x1412('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x528998,_0x56ab7f[_0x1412('0x10')]['message']);return _0x2150f9(_0x56ab7f['error'][_0x1412('0x12')]);}logger[_0x1412('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x528998,_0x56ab7f[_0x1412('0x10')][_0x1412('0x12')]);return _0xd07b38(_0x56ab7f[_0x1412('0x10')]['message']);}else{logger[_0x1412('0xe')](_0x1412('0x13'),_0x528998,_0x1412('0xf'));_0xd07b38(_0x56ab7f[_0x1412('0x14')][_0x1412('0x12')]);}})[_0x1412('0x15')](function(_0x5e4580){logger['error'](_0x1412('0x13'),_0x528998,_0x5e4580);_0x2150f9(_0x5e4580);});});} \ No newline at end of file +var _0x3179=['request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x6b9b17,_0x175bd2){var _0x30b0c9=function(_0x28ca4e){while(--_0x28ca4e){_0x6b9b17['push'](_0x6b9b17['shift']());}};_0x30b0c9(++_0x175bd2);}(_0x3179,0x134));var _0x9317=function(_0x47fa81,_0x2320f4){_0x47fa81=_0x47fa81-0x0;var _0x3f964c=_0x3179[_0x47fa81];return _0x3f964c;};'use strict';var _=require(_0x9317('0x0'));var util=require('util');var moment=require(_0x9317('0x1'));var BPromise=require(_0x9317('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9317('0x3'));var db=require(_0x9317('0x4'))['db'];var utils=require(_0x9317('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x9317('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9317('0x7')][_0x9317('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15043a,_0x5b0786,_0x108f26){return new BPromise(function(_0xc9466f,_0x5eaab4){return client['request'](_0x15043a,_0x108f26)[_0x9317('0x9')](function(_0x3357c3){logger[_0x9317('0xa')](_0x9317('0xb'),_0x5b0786,_0x9317('0xc'));logger['debug'](_0x9317('0xd'),_0x5b0786,_0x9317('0xc'),JSON[_0x9317('0xe')](_0x3357c3));if(_0x3357c3[_0x9317('0xf')]){if(_0x3357c3[_0x9317('0xf')][_0x9317('0x10')]===0x1f4){logger[_0x9317('0xf')](_0x9317('0xb'),_0x5b0786,_0x3357c3['error']['message']);return _0x5eaab4(_0x3357c3[_0x9317('0xf')][_0x9317('0x11')]);}logger[_0x9317('0xf')](_0x9317('0xb'),_0x5b0786,_0x3357c3[_0x9317('0xf')][_0x9317('0x11')]);return _0xc9466f(_0x3357c3[_0x9317('0xf')][_0x9317('0x11')]);}else{logger[_0x9317('0xa')](_0x9317('0xb'),_0x5b0786,_0x9317('0xc'));_0xc9466f(_0x3357c3[_0x9317('0x12')]['message']);}})[_0x9317('0x13')](function(_0x3bbbdb){logger[_0x9317('0xf')](_0x9317('0xb'),_0x5b0786,_0x3bbbdb);_0x5eaab4(_0x3bbbdb);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 37ec481..1ce5ac6 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 _0x9414=['create','put','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','show','post'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0x9414,0xa5));var _0x4941=function(_0x134827,_0x21f6ed){_0x134827=_0x134827-0x0;var _0x366671=_0x9414[_0x134827];return _0x366671;};'use strict';var multer=require('multer');var util=require(_0x4941('0x0'));var path=require(_0x4941('0x1'));var timeout=require(_0x4941('0x2'));var express=require(_0x4941('0x3'));var router=express[_0x4941('0x4')]();var fs_extra=require(_0x4941('0x5'));var auth=require(_0x4941('0x6'));var interaction=require(_0x4941('0x7'));var config=require(_0x4941('0x8'));var controller=require(_0x4941('0x9'));router[_0x4941('0xa')]('/',auth[_0x4941('0xb')](),controller[_0x4941('0xc')]);router[_0x4941('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x4941('0xd')]);router[_0x4941('0xe')]('/',auth['isAuthenticated'](),controller[_0x4941('0xf')]);router[_0x4941('0x10')](_0x4941('0x11'),auth[_0x4941('0xb')](),controller['update']);router['delete'](_0x4941('0x11'),auth[_0x4941('0xb')](),controller[_0x4941('0x12')]);module[_0x4941('0x13')]=router; \ No newline at end of file +var _0x11d1=['update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x2f00da,_0x51b9f4){var _0x2142a9=function(_0x48ad2c){while(--_0x48ad2c){_0x2f00da['push'](_0x2f00da['shift']());}};_0x2142a9(++_0x51b9f4);}(_0x11d1,0x133));var _0x111d=function(_0x4686e9,_0xe56ece){_0x4686e9=_0x4686e9-0x0;var _0x385bf4=_0x11d1[_0x4686e9];return _0x385bf4;};'use strict';var multer=require(_0x111d('0x0'));var util=require(_0x111d('0x1'));var path=require('path');var timeout=require(_0x111d('0x2'));var express=require(_0x111d('0x3'));var router=express[_0x111d('0x4')]();var fs_extra=require(_0x111d('0x5'));var auth=require(_0x111d('0x6'));var interaction=require(_0x111d('0x7'));var config=require(_0x111d('0x8'));var controller=require(_0x111d('0x9'));router[_0x111d('0xa')]('/',auth[_0x111d('0xb')](),controller[_0x111d('0xc')]);router[_0x111d('0xa')]('/:id',auth[_0x111d('0xb')](),controller['show']);router[_0x111d('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x111d('0xe')](_0x111d('0xf'),auth[_0x111d('0xb')](),controller[_0x111d('0x10')]);router[_0x111d('0x11')](_0x111d('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x111d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 387bf75..9e3708b 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 _0xe970=['STRING','ENUM','variable','sequelize','exports','string','customVariable'];(function(_0x532c4c,_0x14f89d){var _0x27c20f=function(_0x7c8ffb){while(--_0x7c8ffb){_0x532c4c['push'](_0x532c4c['shift']());}};_0x27c20f(++_0x14f89d);}(_0xe970,0xa4));var _0x0e97=function(_0x410fc5,_0xbbf71b){_0x410fc5=_0x410fc5-0x0;var _0x2688ac=_0xe970[_0x410fc5];return _0x2688ac;};'use strict';var Sequelize=require(_0x0e97('0x0'));module[_0x0e97('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0e97('0x2'),'variable',_0x0e97('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x0e97('0x4')]},'key':{'type':Sequelize[_0x0e97('0x4')]},'keyType':{'type':Sequelize[_0x0e97('0x5')](_0x0e97('0x2'),_0x0e97('0x6'),_0x0e97('0x3'))},'keyContent':{'type':Sequelize[_0x0e97('0x4')]},'idField':{'type':Sequelize[_0x0e97('0x4')]},'variableName':{'type':Sequelize[_0x0e97('0x4')]}}; \ No newline at end of file +var _0x91a3=['customVariable','picklist','STRING','string','sequelize','exports','ENUM','variable'];(function(_0x469852,_0x532e8c){var _0xa844b9=function(_0x511046){while(--_0x511046){_0x469852['push'](_0x469852['shift']());}};_0xa844b9(++_0x532e8c);}(_0x91a3,0xbc));var _0x391a=function(_0x5e094a,_0x2933e3){_0x5e094a=_0x5e094a-0x0;var _0x5de0fc=_0x91a3[_0x5e094a];return _0x5de0fc;};'use strict';var Sequelize=require(_0x391a('0x0'));module[_0x391a('0x1')]={'type':{'type':Sequelize[_0x391a('0x2')]('string',_0x391a('0x3'),_0x391a('0x4'),'keyValue',_0x391a('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x391a('0x6')]},'key':{'type':Sequelize[_0x391a('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x391a('0x7'),_0x391a('0x3'),_0x391a('0x4'))},'keyContent':{'type':Sequelize[_0x391a('0x6')]},'idField':{'type':Sequelize[_0x391a('0x6')]},'variableName':{'type':Sequelize[_0x391a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 35a86c5..1df99ac 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 _0xf35b=['sendStatus','status','end','count','offset','limit','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','SalesforceField','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','findAll','rows','catch','show','params','keys','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x5c0678,_0x5d2d9a){var _0x45fff7=function(_0x431e87){while(--_0x431e87){_0x5c0678['push'](_0x5c0678['shift']());}};_0x45fff7(++_0x5d2d9a);}(_0xf35b,0xcc));var _0xbf35=function(_0x272e1b,_0x346b64){_0x272e1b=_0x272e1b-0x0;var _0x55794e=_0xf35b[_0x272e1b];return _0x55794e;};'use strict';var emlformat=require(_0xbf35('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf35('0x1'));var jsonpatch=require(_0xbf35('0x2'));var rp=require(_0xbf35('0x3'));var moment=require(_0xbf35('0x4'));var BPromise=require(_0xbf35('0x5'));var Mustache=require(_0xbf35('0x6'));var util=require(_0xbf35('0x7'));var path=require('path');var sox=require(_0xbf35('0x8'));var csv=require('to-csv');var ejs=require(_0xbf35('0x9'));var fs=require('fs');var fs_extra=require(_0xbf35('0xa'));var _=require(_0xbf35('0xb'));var squel=require(_0xbf35('0xc'));var crypto=require(_0xbf35('0xd'));var jsforce=require(_0xbf35('0xe'));var deskjs=require(_0xbf35('0xf'));var toCsv=require(_0xbf35('0x10'));var querystring=require('querystring');var Papa=require(_0xbf35('0x11'));var Redis=require(_0xbf35('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xbf35('0x13'));var as=require(_0xbf35('0x14'));var hardwareService=require(_0xbf35('0x15'));var logger=require(_0xbf35('0x16'))(_0xbf35('0x17'));var utils=require(_0xbf35('0x18'));var config=require(_0xbf35('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf35('0x1a'))['db'];function respondWithStatusCode(_0xb4545e,_0x33a4fd){_0x33a4fd=_0x33a4fd||0xcc;return function(_0x39f63b){if(_0x39f63b){return _0xb4545e[_0xbf35('0x1b')](_0x33a4fd);}return _0xb4545e[_0xbf35('0x1c')](_0x33a4fd)[_0xbf35('0x1d')]();};}function respondWithResult(_0x152e8d,_0x2d679f){_0x2d679f=_0x2d679f||0xc8;return function(_0x19c56f){if(_0x19c56f){return _0x152e8d['status'](_0x2d679f)['json'](_0x19c56f);}};}function respondWithFilteredResult(_0x48fa1f,_0x5bb1b0){return function(_0x538287){if(_0x538287){var _0x49115c=typeof _0x5bb1b0['offset']==='undefined'&&typeof _0x5bb1b0['limit']==='undefined';var _0xae7870=_0x538287[_0xbf35('0x1e')];var _0x4589ee=_0x49115c?0x0:_0x5bb1b0['offset'];var _0x1ecfc0=_0x49115c?_0x538287[_0xbf35('0x1e')]:_0x5bb1b0[_0xbf35('0x1f')]+_0x5bb1b0[_0xbf35('0x20')];var _0x23d88c;if(_0x1ecfc0>=_0xae7870){_0x1ecfc0=_0xae7870;_0x23d88c=0xc8;}else{_0x23d88c=0xce;}_0x48fa1f[_0xbf35('0x1c')](_0x23d88c);return _0x48fa1f['set']('Content-Range',_0x4589ee+'-'+_0x1ecfc0+'/'+_0xae7870)[_0xbf35('0x21')](_0x538287);}return null;};}function patchUpdates(_0x2a7d32){return function(_0x1f37e5){try{jsonpatch[_0xbf35('0x22')](_0x1f37e5,_0x2a7d32,!![]);}catch(_0x2834d4){return BPromise[_0xbf35('0x23')](_0x2834d4);}return _0x1f37e5[_0xbf35('0x24')]();};}function saveUpdates(_0x593d7d,_0x209fde){return function(_0x23f6e5){if(_0x23f6e5){return _0x23f6e5[_0xbf35('0x25')](_0x593d7d)[_0xbf35('0x26')](function(_0x10a2c0){return _0x10a2c0;});}return null;};}function removeEntity(_0x4ccade,_0x57b5b8){return function(_0x22cef9){if(_0x22cef9){return _0x22cef9[_0xbf35('0x27')]()[_0xbf35('0x26')](function(){_0x4ccade[_0xbf35('0x1c')](0xcc)[_0xbf35('0x1d')]();});}};}function handleEntityNotFound(_0x39db8c,_0x306ede){return function(_0x3a80f0){if(!_0x3a80f0){_0x39db8c[_0xbf35('0x1b')](0x194);}return _0x3a80f0;};}function handleError(_0x276ce7,_0x521d10){_0x521d10=_0x521d10||0x1f4;return function(_0x25475a){logger[_0xbf35('0x28')](_0x25475a[_0xbf35('0x29')]);if(_0x25475a['name']){delete _0x25475a[_0xbf35('0x2a')];}_0x276ce7[_0xbf35('0x1c')](_0x521d10)[_0xbf35('0x2b')](_0x25475a);};}exports[_0xbf35('0x2c')]=function(_0x24e496,_0x511aca){var _0x44ae96={},_0x30ca1c={},_0x18d486={'count':0x0,'rows':[]};var _0x40c7a7=_['map'](db[_0xbf35('0x2d')][_0xbf35('0x2e')],function(_0x71917){return{'name':_0x71917[_0xbf35('0x2f')],'type':_0x71917['type'][_0xbf35('0x30')]};});_0x30ca1c[_0xbf35('0x31')]=_[_0xbf35('0x32')](_0x40c7a7,_0xbf35('0x2a'));_0x30ca1c[_0xbf35('0x33')]=_['keys'](_0x24e496[_0xbf35('0x33')]);_0x30ca1c[_0xbf35('0x34')]=_[_0xbf35('0x35')](_0x30ca1c['model'],_0x30ca1c[_0xbf35('0x33')]);_0x44ae96[_0xbf35('0x36')]=_[_0xbf35('0x35')](_0x30ca1c['model'],qs[_0xbf35('0x37')](_0x24e496['query'][_0xbf35('0x37')]));_0x44ae96[_0xbf35('0x36')]=_0x44ae96[_0xbf35('0x36')][_0xbf35('0x38')]?_0x44ae96['attributes']:_0x30ca1c[_0xbf35('0x31')];if(!_0x24e496[_0xbf35('0x33')]['hasOwnProperty'](_0xbf35('0x39'))){_0x44ae96[_0xbf35('0x20')]=qs[_0xbf35('0x20')](_0x24e496[_0xbf35('0x33')][_0xbf35('0x20')]);_0x44ae96[_0xbf35('0x1f')]=qs[_0xbf35('0x1f')](_0x24e496[_0xbf35('0x33')][_0xbf35('0x1f')]);}_0x44ae96[_0xbf35('0x3a')]=qs[_0xbf35('0x3b')](_0x24e496[_0xbf35('0x33')][_0xbf35('0x3b')]);_0x44ae96[_0xbf35('0x3c')]=qs[_0xbf35('0x34')](_[_0xbf35('0x3d')](_0x24e496[_0xbf35('0x33')],_0x30ca1c[_0xbf35('0x34')]),_0x40c7a7);if(_0x24e496['query']['filter']){_0x44ae96[_0xbf35('0x3c')]=_[_0xbf35('0x3e')](_0x44ae96[_0xbf35('0x3c')],{'$or':_[_0xbf35('0x32')](_0x40c7a7,function(_0x1f44bd){if(_0x1f44bd[_0xbf35('0x3f')]!==_0xbf35('0x40')){var _0x4a535b={};_0x4a535b[_0x1f44bd[_0xbf35('0x2a')]]={'$like':'%'+_0x24e496[_0xbf35('0x33')][_0xbf35('0x41')]+'%'};return _0x4a535b;}})});}_0x44ae96=_['merge']({},_0x44ae96,_0x24e496[_0xbf35('0x42')]);var _0x470b30={'where':_0x44ae96['where']};return db[_0xbf35('0x2d')][_0xbf35('0x1e')](_0x470b30)['then'](function(_0x5612a1){_0x18d486[_0xbf35('0x1e')]=_0x5612a1;if(_0x24e496[_0xbf35('0x33')]['includeAll']){_0x44ae96['include']=[{'all':!![]}];}return db[_0xbf35('0x2d')][_0xbf35('0x43')](_0x44ae96);})[_0xbf35('0x26')](function(_0x5c5085){_0x18d486[_0xbf35('0x44')]=_0x5c5085;return _0x18d486;})[_0xbf35('0x26')](respondWithFilteredResult(_0x511aca,_0x44ae96))[_0xbf35('0x45')](handleError(_0x511aca,null));};exports[_0xbf35('0x46')]=function(_0x4b83b8,_0x5522ce){var _0x19afe7={'raw':!![],'where':{'id':_0x4b83b8[_0xbf35('0x47')]['id']}},_0x4e16bd={};_0x4e16bd['model']=_[_0xbf35('0x48')](db[_0xbf35('0x2d')][_0xbf35('0x2e')]);_0x4e16bd['query']=_[_0xbf35('0x48')](_0x4b83b8['query']);_0x4e16bd['filters']=_[_0xbf35('0x35')](_0x4e16bd['model'],_0x4e16bd[_0xbf35('0x33')]);_0x19afe7[_0xbf35('0x36')]=_['intersection'](_0x4e16bd[_0xbf35('0x31')],qs[_0xbf35('0x37')](_0x4b83b8['query']['fields']));_0x19afe7['attributes']=_0x19afe7[_0xbf35('0x36')][_0xbf35('0x38')]?_0x19afe7['attributes']:_0x4e16bd['model'];if(_0x4b83b8['query'][_0xbf35('0x49')]){_0x19afe7['include']=[{'all':!![]}];}_0x19afe7=_[_0xbf35('0x3e')]({},_0x19afe7,_0x4b83b8[_0xbf35('0x42')]);return db['SalesforceField'][_0xbf35('0x4a')](_0x19afe7)[_0xbf35('0x26')](handleEntityNotFound(_0x5522ce,null))[_0xbf35('0x26')](respondWithResult(_0x5522ce,null))[_0xbf35('0x45')](handleError(_0x5522ce,null));};exports[_0xbf35('0x4b')]=function(_0x3f491d,_0x3fbeac){return db['SalesforceField'][_0xbf35('0x4b')](_0x3f491d[_0xbf35('0x4c')],{})[_0xbf35('0x26')](respondWithResult(_0x3fbeac,0xc9))[_0xbf35('0x45')](handleError(_0x3fbeac,null));};exports[_0xbf35('0x25')]=function(_0x33e10b,_0x34f8a2){if(_0x33e10b[_0xbf35('0x4c')]['id']){delete _0x33e10b[_0xbf35('0x4c')]['id'];}return db[_0xbf35('0x2d')][_0xbf35('0x4a')]({'where':{'id':_0x33e10b['params']['id']}})[_0xbf35('0x26')](handleEntityNotFound(_0x34f8a2,null))['then'](saveUpdates(_0x33e10b[_0xbf35('0x4c')],null))[_0xbf35('0x26')](respondWithResult(_0x34f8a2,null))[_0xbf35('0x45')](handleError(_0x34f8a2,null));};exports['destroy']=function(_0x119eef,_0x2934c0){return db[_0xbf35('0x2d')][_0xbf35('0x4a')]({'where':{'id':_0x119eef['params']['id']}})[_0xbf35('0x26')](handleEntityNotFound(_0x2934c0,null))[_0xbf35('0x26')](removeEntity(_0x2934c0,null))['catch'](handleError(_0x2934c0,null));}; \ No newline at end of file +var _0x9e0c=['name','send','index','map','SalesforceField','type','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','fields','length','create','body','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x9e0c,0x117));var _0xc9e0=function(_0x35b241,_0x24bd66){_0x35b241=_0x35b241-0x0;var _0x502c60=_0x9e0c[_0x35b241];return _0x502c60;};'use strict';var emlformat=require(_0xc9e0('0x0'));var rimraf=require(_0xc9e0('0x1'));var zipdir=require(_0xc9e0('0x2'));var jsonpatch=require(_0xc9e0('0x3'));var rp=require(_0xc9e0('0x4'));var moment=require(_0xc9e0('0x5'));var BPromise=require(_0xc9e0('0x6'));var Mustache=require('mustache');var util=require(_0xc9e0('0x7'));var path=require(_0xc9e0('0x8'));var sox=require(_0xc9e0('0x9'));var csv=require(_0xc9e0('0xa'));var ejs=require(_0xc9e0('0xb'));var fs=require('fs');var fs_extra=require(_0xc9e0('0xc'));var _=require(_0xc9e0('0xd'));var squel=require('squel');var crypto=require(_0xc9e0('0xe'));var jsforce=require(_0xc9e0('0xf'));var deskjs=require(_0xc9e0('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc9e0('0x11'));var Papa=require(_0xc9e0('0x12'));var Redis=require(_0xc9e0('0x13'));var authService=require(_0xc9e0('0x14'));var qs=require(_0xc9e0('0x15'));var as=require(_0xc9e0('0x16'));var hardwareService=require(_0xc9e0('0x17'));var logger=require(_0xc9e0('0x18'))(_0xc9e0('0x19'));var utils=require(_0xc9e0('0x1a'));var config=require(_0xc9e0('0x1b'));var licenseUtil=require(_0xc9e0('0x1c'));var db=require(_0xc9e0('0x1d'))['db'];function respondWithStatusCode(_0x261583,_0x461a35){_0x461a35=_0x461a35||0xcc;return function(_0x12861a){if(_0x12861a){return _0x261583[_0xc9e0('0x1e')](_0x461a35);}return _0x261583['status'](_0x461a35)[_0xc9e0('0x1f')]();};}function respondWithResult(_0x994763,_0x437124){_0x437124=_0x437124||0xc8;return function(_0x1a6aee){if(_0x1a6aee){return _0x994763[_0xc9e0('0x20')](_0x437124)[_0xc9e0('0x21')](_0x1a6aee);}};}function respondWithFilteredResult(_0x348d17,_0x50cf3b){return function(_0x16a9bc){if(_0x16a9bc){var _0x4d22b0=typeof _0x50cf3b[_0xc9e0('0x22')]===_0xc9e0('0x23')&&typeof _0x50cf3b[_0xc9e0('0x24')]===_0xc9e0('0x23');var _0x3b9de8=_0x16a9bc[_0xc9e0('0x25')];var _0x439fb7=_0x4d22b0?0x0:_0x50cf3b[_0xc9e0('0x22')];var _0x427646=_0x4d22b0?_0x16a9bc[_0xc9e0('0x25')]:_0x50cf3b[_0xc9e0('0x22')]+_0x50cf3b[_0xc9e0('0x24')];var _0x32e9ce;if(_0x427646>=_0x3b9de8){_0x427646=_0x3b9de8;_0x32e9ce=0xc8;}else{_0x32e9ce=0xce;}_0x348d17[_0xc9e0('0x20')](_0x32e9ce);return _0x348d17[_0xc9e0('0x26')]('Content-Range',_0x439fb7+'-'+_0x427646+'/'+_0x3b9de8)[_0xc9e0('0x21')](_0x16a9bc);}return null;};}function patchUpdates(_0x40b138){return function(_0x4353fe){try{jsonpatch[_0xc9e0('0x27')](_0x4353fe,_0x40b138,!![]);}catch(_0x4c4ae4){return BPromise['reject'](_0x4c4ae4);}return _0x4353fe[_0xc9e0('0x28')]();};}function saveUpdates(_0x4f607a,_0x28eb74){return function(_0x39ae55){if(_0x39ae55){return _0x39ae55[_0xc9e0('0x29')](_0x4f607a)['then'](function(_0x4ec0d8){return _0x4ec0d8;});}return null;};}function removeEntity(_0x1388fc,_0x450ea1){return function(_0x20f7a8){if(_0x20f7a8){return _0x20f7a8['destroy']()[_0xc9e0('0x2a')](function(){_0x1388fc[_0xc9e0('0x20')](0xcc)[_0xc9e0('0x1f')]();});}};}function handleEntityNotFound(_0x224a82,_0x5ceaba){return function(_0x54f717){if(!_0x54f717){_0x224a82[_0xc9e0('0x1e')](0x194);}return _0x54f717;};}function handleError(_0x2cf86e,_0x553694){_0x553694=_0x553694||0x1f4;return function(_0x4bbd49){logger[_0xc9e0('0x2b')](_0x4bbd49[_0xc9e0('0x2c')]);if(_0x4bbd49[_0xc9e0('0x2d')]){delete _0x4bbd49[_0xc9e0('0x2d')];}_0x2cf86e[_0xc9e0('0x20')](_0x553694)[_0xc9e0('0x2e')](_0x4bbd49);};}exports[_0xc9e0('0x2f')]=function(_0x299553,_0x471bd1){var _0x5e37ce={},_0x3b8280={},_0x1dfde2={'count':0x0,'rows':[]};var _0x2184e1=_[_0xc9e0('0x30')](db[_0xc9e0('0x31')]['rawAttributes'],function(_0x23360f){return{'name':_0x23360f['fieldName'],'type':_0x23360f[_0xc9e0('0x32')][_0xc9e0('0x33')]};});_0x3b8280[_0xc9e0('0x34')]=_[_0xc9e0('0x30')](_0x2184e1,_0xc9e0('0x2d'));_0x3b8280[_0xc9e0('0x35')]=_[_0xc9e0('0x36')](_0x299553[_0xc9e0('0x35')]);_0x3b8280['filters']=_[_0xc9e0('0x37')](_0x3b8280[_0xc9e0('0x34')],_0x3b8280[_0xc9e0('0x35')]);_0x5e37ce[_0xc9e0('0x38')]=_[_0xc9e0('0x37')](_0x3b8280['model'],qs['fields'](_0x299553['query']['fields']));_0x5e37ce[_0xc9e0('0x38')]=_0x5e37ce['attributes']['length']?_0x5e37ce[_0xc9e0('0x38')]:_0x3b8280[_0xc9e0('0x34')];if(!_0x299553[_0xc9e0('0x35')][_0xc9e0('0x39')](_0xc9e0('0x3a'))){_0x5e37ce['limit']=qs[_0xc9e0('0x24')](_0x299553[_0xc9e0('0x35')][_0xc9e0('0x24')]);_0x5e37ce[_0xc9e0('0x22')]=qs[_0xc9e0('0x22')](_0x299553[_0xc9e0('0x35')][_0xc9e0('0x22')]);}_0x5e37ce[_0xc9e0('0x3b')]=qs[_0xc9e0('0x3c')](_0x299553[_0xc9e0('0x35')][_0xc9e0('0x3c')]);_0x5e37ce[_0xc9e0('0x3d')]=qs[_0xc9e0('0x3e')](_[_0xc9e0('0x3f')](_0x299553[_0xc9e0('0x35')],_0x3b8280[_0xc9e0('0x3e')]),_0x2184e1);if(_0x299553[_0xc9e0('0x35')][_0xc9e0('0x40')]){_0x5e37ce['where']=_[_0xc9e0('0x41')](_0x5e37ce[_0xc9e0('0x3d')],{'$or':_[_0xc9e0('0x30')](_0x2184e1,function(_0x216dc8){if(_0x216dc8[_0xc9e0('0x32')]!==_0xc9e0('0x42')){var _0x577e62={};_0x577e62[_0x216dc8['name']]={'$like':'%'+_0x299553[_0xc9e0('0x35')][_0xc9e0('0x40')]+'%'};return _0x577e62;}})});}_0x5e37ce=_[_0xc9e0('0x41')]({},_0x5e37ce,_0x299553[_0xc9e0('0x43')]);var _0x21f034={'where':_0x5e37ce[_0xc9e0('0x3d')]};return db[_0xc9e0('0x31')][_0xc9e0('0x25')](_0x21f034)[_0xc9e0('0x2a')](function(_0x31d9d8){_0x1dfde2[_0xc9e0('0x25')]=_0x31d9d8;if(_0x299553[_0xc9e0('0x35')][_0xc9e0('0x44')]){_0x5e37ce[_0xc9e0('0x45')]=[{'all':!![]}];}return db[_0xc9e0('0x31')]['findAll'](_0x5e37ce);})[_0xc9e0('0x2a')](function(_0x4979a4){_0x1dfde2[_0xc9e0('0x46')]=_0x4979a4;return _0x1dfde2;})[_0xc9e0('0x2a')](respondWithFilteredResult(_0x471bd1,_0x5e37ce))[_0xc9e0('0x47')](handleError(_0x471bd1,null));};exports[_0xc9e0('0x48')]=function(_0x22d6c5,_0x47e77a){var _0x12b6fa={'raw':!![],'where':{'id':_0x22d6c5[_0xc9e0('0x49')]['id']}},_0x46e688={};_0x46e688['model']=_[_0xc9e0('0x36')](db[_0xc9e0('0x31')][_0xc9e0('0x4a')]);_0x46e688[_0xc9e0('0x35')]=_[_0xc9e0('0x36')](_0x22d6c5['query']);_0x46e688[_0xc9e0('0x3e')]=_[_0xc9e0('0x37')](_0x46e688[_0xc9e0('0x34')],_0x46e688[_0xc9e0('0x35')]);_0x12b6fa[_0xc9e0('0x38')]=_[_0xc9e0('0x37')](_0x46e688[_0xc9e0('0x34')],qs[_0xc9e0('0x4b')](_0x22d6c5[_0xc9e0('0x35')][_0xc9e0('0x4b')]));_0x12b6fa[_0xc9e0('0x38')]=_0x12b6fa[_0xc9e0('0x38')][_0xc9e0('0x4c')]?_0x12b6fa[_0xc9e0('0x38')]:_0x46e688['model'];if(_0x22d6c5[_0xc9e0('0x35')][_0xc9e0('0x44')]){_0x12b6fa['include']=[{'all':!![]}];}_0x12b6fa=_['merge']({},_0x12b6fa,_0x22d6c5[_0xc9e0('0x43')]);return db[_0xc9e0('0x31')]['find'](_0x12b6fa)[_0xc9e0('0x2a')](handleEntityNotFound(_0x47e77a,null))[_0xc9e0('0x2a')](respondWithResult(_0x47e77a,null))[_0xc9e0('0x47')](handleError(_0x47e77a,null));};exports[_0xc9e0('0x4d')]=function(_0x12e132,_0x488d99){return db['SalesforceField'][_0xc9e0('0x4d')](_0x12e132[_0xc9e0('0x4e')],{})['then'](respondWithResult(_0x488d99,0xc9))[_0xc9e0('0x47')](handleError(_0x488d99,null));};exports[_0xc9e0('0x29')]=function(_0x597947,_0x1d3fa8){if(_0x597947['body']['id']){delete _0x597947[_0xc9e0('0x4e')]['id'];}return db[_0xc9e0('0x31')]['find']({'where':{'id':_0x597947[_0xc9e0('0x49')]['id']}})[_0xc9e0('0x2a')](handleEntityNotFound(_0x1d3fa8,null))[_0xc9e0('0x2a')](saveUpdates(_0x597947[_0xc9e0('0x4e')],null))['then'](respondWithResult(_0x1d3fa8,null))[_0xc9e0('0x47')](handleError(_0x1d3fa8,null));};exports[_0xc9e0('0x4f')]=function(_0x233da4,_0x534897){return db[_0xc9e0('0x31')][_0xc9e0('0x50')]({'where':{'id':_0x233da4[_0xc9e0('0x49')]['id']}})[_0xc9e0('0x2a')](handleEntityNotFound(_0x534897,null))[_0xc9e0('0x2a')](removeEntity(_0x534897,null))[_0xc9e0('0x47')](handleError(_0x534897,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 859cba3..74711cf 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 _0xa52f=['define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','rimraf','./intSalesforceField.attributes'];(function(_0x209243,_0x122196){var _0x4f4566=function(_0x442d27){while(--_0x442d27){_0x209243['push'](_0x209243['shift']());}};_0x4f4566(++_0x122196);}(_0xa52f,0x1b3));var _0xfa52=function(_0x30c331,_0x46f687){_0x30c331=_0x30c331-0x0;var _0x396921=_0xa52f[_0x30c331];return _0x396921;};'use strict';var _=require('lodash');var util=require(_0xfa52('0x0'));var logger=require(_0xfa52('0x1'))('api');var moment=require(_0xfa52('0x2'));var BPromise=require(_0xfa52('0x3'));var rp=require(_0xfa52('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa52('0x5'));var config=require('../../config/environment');var attributes=require(_0xfa52('0x6'));module['exports']=function(_0x56eb81,_0xee4a58){return _0x56eb81[_0xfa52('0x7')](_0xfa52('0x8'),attributes,{'tableName':_0xfa52('0x9'),'paranoid':![],'indexes':[{'name':_0xfa52('0xa'),'fields':[_0xfa52('0xb'),_0xfa52('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfcae=['define','SalesforceField','int_salesforce_fields','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','exports'];(function(_0x546e81,_0x122d50){var _0x5360ee=function(_0x4a1540){while(--_0x4a1540){_0x546e81['push'](_0x546e81['shift']());}};_0x5360ee(++_0x122d50);}(_0xfcae,0x198));var _0xefca=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xfcae[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0xefca('0x0'));var util=require('util');var logger=require(_0xefca('0x1'))(_0xefca('0x2'));var moment=require(_0xefca('0x3'));var BPromise=require(_0xefca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xefca('0x5'));var rimraf=require(_0xefca('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0xefca('0x7')]=function(_0x491e93,_0x352539){return _0x491e93[_0xefca('0x8')](_0xefca('0x9'),attributes,{'tableName':_0xefca('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0xefca('0xb'),_0xefca('0xc')],'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 c7644db..5229378 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 _0xf1fa=['client','http','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2d959a,_0x4d8b26){var _0x2fa8d6=function(_0x500312){while(--_0x500312){_0x2d959a['push'](_0x2d959a['shift']());}};_0x2fa8d6(++_0x4d8b26);}(_0xf1fa,0xef));var _0xaf1f=function(_0x19276d,_0xfb255e){_0x19276d=_0x19276d-0x0;var _0x470c38=_0xf1fa[_0x19276d];return _0x470c38;};'use strict';var _=require('lodash');var util=require(_0xaf1f('0x0'));var moment=require(_0xaf1f('0x1'));var BPromise=require(_0xaf1f('0x2'));var rs=require(_0xaf1f('0x3'));var fs=require('fs');var Redis=require(_0xaf1f('0x4'));var db=require(_0xaf1f('0x5'))['db'];var utils=require(_0xaf1f('0x6'));var logger=require(_0xaf1f('0x7'))(_0xaf1f('0x8'));var config=require(_0xaf1f('0x9'));var jayson=require(_0xaf1f('0xa'));var client=jayson[_0xaf1f('0xb')][_0xaf1f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7913f3,_0x2132dd,_0x4f0b26){return new BPromise(function(_0x190324,_0x232e9){return client[_0xaf1f('0xd')](_0x7913f3,_0x4f0b26)[_0xaf1f('0xe')](function(_0x207514){logger[_0xaf1f('0xf')]('SalesforceField,\x20%s,\x20%s',_0x2132dd,_0xaf1f('0x10'));logger[_0xaf1f('0x11')](_0xaf1f('0x12'),_0x2132dd,_0xaf1f('0x10'),JSON[_0xaf1f('0x13')](_0x207514));if(_0x207514[_0xaf1f('0x14')]){if(_0x207514[_0xaf1f('0x14')][_0xaf1f('0x15')]===0x1f4){logger[_0xaf1f('0x14')](_0xaf1f('0x16'),_0x2132dd,_0x207514['error'][_0xaf1f('0x17')]);return _0x232e9(_0x207514[_0xaf1f('0x14')]['message']);}logger['error'](_0xaf1f('0x16'),_0x2132dd,_0x207514[_0xaf1f('0x14')][_0xaf1f('0x17')]);return _0x190324(_0x207514[_0xaf1f('0x14')][_0xaf1f('0x17')]);}else{logger['info'](_0xaf1f('0x16'),_0x2132dd,_0xaf1f('0x10'));_0x190324(_0x207514[_0xaf1f('0x18')][_0xaf1f('0x17')]);}})['catch'](function(_0x1651a9){logger[_0xaf1f('0x14')](_0xaf1f('0x16'),_0x2132dd,_0x1651a9);_0x232e9(_0x1651a9);});});} \ No newline at end of file +var _0xa159=['SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then'];(function(_0x325332,_0x214f88){var _0x3cc0ee=function(_0x4bf316){while(--_0x4bf316){_0x325332['push'](_0x325332['shift']());}};_0x3cc0ee(++_0x214f88);}(_0xa159,0x14a));var _0x9a15=function(_0x279d06,_0x3bc312){_0x279d06=_0x279d06-0x0;var _0x2f997b=_0xa159[_0x279d06];return _0x2f997b;};'use strict';var _=require('lodash');var util=require(_0x9a15('0x0'));var moment=require(_0x9a15('0x1'));var BPromise=require(_0x9a15('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a15('0x3'))['db'];var utils=require(_0x9a15('0x4'));var logger=require('../../config/logger')(_0x9a15('0x5'));var config=require('../../config/environment');var jayson=require(_0x9a15('0x6'));var client=jayson['client'][_0x9a15('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2a2c4f,_0x368641,_0x47ee05){return new BPromise(function(_0x33305f,_0x34938e){return client[_0x9a15('0x8')](_0x2a2c4f,_0x47ee05)[_0x9a15('0x9')](function(_0x2ab8b1){logger['info'](_0x9a15('0xa'),_0x368641,_0x9a15('0xb'));logger[_0x9a15('0xc')](_0x9a15('0xd'),_0x368641,_0x9a15('0xb'),JSON[_0x9a15('0xe')](_0x2ab8b1));if(_0x2ab8b1[_0x9a15('0xf')]){if(_0x2ab8b1[_0x9a15('0xf')][_0x9a15('0x10')]===0x1f4){logger['error'](_0x9a15('0xa'),_0x368641,_0x2ab8b1[_0x9a15('0xf')][_0x9a15('0x11')]);return _0x34938e(_0x2ab8b1['error'][_0x9a15('0x11')]);}logger[_0x9a15('0xf')](_0x9a15('0xa'),_0x368641,_0x2ab8b1[_0x9a15('0xf')][_0x9a15('0x11')]);return _0x33305f(_0x2ab8b1['error']['message']);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x368641,_0x9a15('0xb'));_0x33305f(_0x2ab8b1[_0x9a15('0x12')][_0x9a15('0x11')]);}})[_0x9a15('0x13')](function(_0x311b67){logger[_0x9a15('0xf')](_0x9a15('0xa'),_0x368641,_0x311b67);_0x34938e(_0x311b67);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 771788d..8e419af 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 _0x85b5=['get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','/:id','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/interaction/service','./intServicenowAccount.controller'];(function(_0x44b816,_0x2af972){var _0xdfaa68=function(_0x2a2cde){while(--_0x2a2cde){_0x44b816['push'](_0x44b816['shift']());}};_0xdfaa68(++_0x2af972);}(_0x85b5,0x7f));var _0x585b=function(_0x47622b,_0x48738f){_0x47622b=_0x47622b-0x0;var _0x11d51f=_0x85b5[_0x47622b];return _0x11d51f;};'use strict';var multer=require(_0x585b('0x0'));var util=require(_0x585b('0x1'));var path=require('path');var timeout=require(_0x585b('0x2'));var express=require('express');var router=express[_0x585b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x585b('0x4'));var config=require('../../config/environment');var controller=require(_0x585b('0x5'));router[_0x585b('0x6')]('/',auth[_0x585b('0x7')](),controller['index']);router[_0x585b('0x6')]('/:id',auth[_0x585b('0x7')](),controller[_0x585b('0x8')]);router[_0x585b('0x6')](_0x585b('0x9'),auth['isAuthenticated'](),controller[_0x585b('0xa')]);router[_0x585b('0x6')](_0x585b('0xb'),auth[_0x585b('0x7')](),controller[_0x585b('0xc')]);router[_0x585b('0xd')]('/',auth[_0x585b('0x7')](),controller['create']);router[_0x585b('0xd')]('/:id/configurations',auth[_0x585b('0x7')](),controller['addConfiguration']);router[_0x585b('0xe')](_0x585b('0xf'),auth[_0x585b('0x7')](),controller['update']);router[_0x585b('0x10')](_0x585b('0xf'),auth[_0x585b('0x7')](),controller[_0x585b('0x11')]);module[_0x585b('0x12')]=router; \ No newline at end of file +var _0x8319=['/:id/configurations','/:id/fields','post','create','isAuthenticated','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','show'];(function(_0x5bd22b,_0x336f36){var _0x541b96=function(_0x191b1a){while(--_0x191b1a){_0x5bd22b['push'](_0x5bd22b['shift']());}};_0x541b96(++_0x336f36);}(_0x8319,0xac));var _0x9831=function(_0x3bf6e5,_0xbce317){_0x3bf6e5=_0x3bf6e5-0x0;var _0x4b8efe=_0x8319[_0x3bf6e5];return _0x4b8efe;};'use strict';var multer=require(_0x9831('0x0'));var util=require(_0x9831('0x1'));var path=require('path');var timeout=require(_0x9831('0x2'));var express=require(_0x9831('0x3'));var router=express[_0x9831('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9831('0x5'));var config=require(_0x9831('0x6'));var controller=require(_0x9831('0x7'));router[_0x9831('0x8')]('/',auth['isAuthenticated'](),controller[_0x9831('0x9')]);router[_0x9831('0x8')](_0x9831('0xa'),auth['isAuthenticated'](),controller[_0x9831('0xb')]);router[_0x9831('0x8')](_0x9831('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x9831('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x9831('0xe')]('/',auth['isAuthenticated'](),controller[_0x9831('0xf')]);router[_0x9831('0xe')](_0x9831('0xc'),auth[_0x9831('0x10')](),controller[_0x9831('0x11')]);router[_0x9831('0x12')](_0x9831('0xa'),auth[_0x9831('0x10')](),controller[_0x9831('0x13')]);router[_0x9831('0x14')](_0x9831('0xa'),auth[_0x9831('0x10')](),controller[_0x9831('0x15')]);module[_0x9831('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index d0db814..4c48fa9 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 _0xd63b=['remoteUri','sequelize','exports','STRING'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xd63b,0x13d));var _0xbd63=function(_0x11c551,_0x1028d2){_0x11c551=_0x11c551-0x0;var _0x14756e=_0xd63b[_0x11c551];return _0x14756e;};'use strict';var Sequelize=require(_0xbd63('0x0'));module[_0xbd63('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbd63('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize[_0xbd63('0x2')]},'email':{'type':Sequelize[_0xbd63('0x2')]},'remoteUri':{'type':Sequelize[_0xbd63('0x2')],'unique':_0xbd63('0x3')},'serverUrl':{'type':Sequelize[_0xbd63('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x8c83=['username','remoteUri','sequelize','exports','STRING'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x8c83,0x147));var _0x38c8=function(_0x191cb6,_0xdde476){_0x191cb6=_0x191cb6-0x0;var _0x5e55d6=_0x8c83[_0x191cb6];return _0x5e55d6;};'use strict';var Sequelize=require(_0x38c8('0x0'));module[_0x38c8('0x1')]={'name':{'type':Sequelize[_0x38c8('0x2')]},'description':{'type':Sequelize[_0x38c8('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x38c8('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x38c8('0x2')]},'remoteUri':{'type':Sequelize[_0x38c8('0x2')],'unique':_0x38c8('0x4')},'serverUrl':{'type':Sequelize[_0x38c8('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 679da83..2ab5a59 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 _0xad2e=['reopened_time','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','comments','sla_due','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','correlation_id','location','findOne','username','password','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','forEach','internalType','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','ServiceNow\x20error:\x20','test','error','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','ServicenowAccount','fieldName','type','key','map','keys','filters','query','attributes','intersection','fields','model','hasOwnProperty','order','sort','where','pick','merge','options','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','getConfigurations','ServicenowConfiguration','filter','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','business_service','sys_domain_path','rfc','time_worked','opened_at','group_list','work_end'];(function(_0x5e4c91,_0x4b90a7){var _0x4c1b95=function(_0x14e6f5){while(--_0x14e6f5){_0x5e4c91['push'](_0x5e4c91['shift']());}};_0x4c1b95(++_0x4b90a7);}(_0xad2e,0xf7));var _0xead2=function(_0x2cbdd6,_0xdc9195){_0x2cbdd6=_0x2cbdd6-0x0;var _0x4be052=_0xad2e[_0x2cbdd6];return _0x4be052;};'use strict';var emlformat=require(_0xead2('0x0'));var rimraf=require(_0xead2('0x1'));var zipdir=require(_0xead2('0x2'));var jsonpatch=require(_0xead2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xead2('0x4'));var Mustache=require('mustache');var util=require(_0xead2('0x5'));var path=require('path');var sox=require(_0xead2('0x6'));var csv=require(_0xead2('0x7'));var ejs=require(_0xead2('0x8'));var fs=require('fs');var fs_extra=require(_0xead2('0x9'));var _=require(_0xead2('0xa'));var squel=require(_0xead2('0xb'));var crypto=require(_0xead2('0xc'));var jsforce=require(_0xead2('0xd'));var deskjs=require(_0xead2('0xe'));var toCsv=require(_0xead2('0x7'));var querystring=require(_0xead2('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xead2('0x10'));var as=require(_0xead2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xead2('0x12'));var utils=require('../../config/utils');var config=require(_0xead2('0x13'));var licenseUtil=require(_0xead2('0x14'));var db=require(_0xead2('0x15'))['db'];var integrations=require(_0xead2('0x16'));function respondWithStatusCode(_0x259b30,_0x2140ce){_0x2140ce=_0x2140ce||0xcc;return function(_0x58131e){if(_0x58131e){return _0x259b30['sendStatus'](_0x2140ce);}return _0x259b30[_0xead2('0x17')](_0x2140ce)[_0xead2('0x18')]();};}function respondWithResult(_0x51e49c,_0x572377){_0x572377=_0x572377||0xc8;return function(_0x207a50){if(_0x207a50){return _0x51e49c['status'](_0x572377)[_0xead2('0x19')](_0x207a50);}};}function respondWithFilteredResult(_0x2e8b63,_0x59fe93){return function(_0x433b06){if(_0x433b06){var _0x1152f6=typeof _0x59fe93[_0xead2('0x1a')]===_0xead2('0x1b')&&typeof _0x59fe93[_0xead2('0x1c')]===_0xead2('0x1b');var _0x5e91c6=_0x433b06['count'];var _0x483fc6=_0x1152f6?0x0:_0x59fe93[_0xead2('0x1a')];var _0x4e9f34=_0x1152f6?_0x433b06[_0xead2('0x1d')]:_0x59fe93[_0xead2('0x1a')]+_0x59fe93[_0xead2('0x1c')];var _0x399ca3;if(_0x4e9f34>=_0x5e91c6){_0x4e9f34=_0x5e91c6;_0x399ca3=0xc8;}else{_0x399ca3=0xce;}_0x2e8b63[_0xead2('0x17')](_0x399ca3);return _0x2e8b63[_0xead2('0x1e')](_0xead2('0x1f'),_0x483fc6+'-'+_0x4e9f34+'/'+_0x5e91c6)[_0xead2('0x19')](_0x433b06);}return null;};}function patchUpdates(_0x2b1717){return function(_0x37ed2e){try{jsonpatch[_0xead2('0x20')](_0x37ed2e,_0x2b1717,!![]);}catch(_0x3c2cd2){return BPromise[_0xead2('0x21')](_0x3c2cd2);}return _0x37ed2e['save']();};}function saveUpdates(_0x1b6b96,_0x52efb2){return function(_0x19cdc3){if(_0x19cdc3){return _0x19cdc3[_0xead2('0x22')](_0x1b6b96)[_0xead2('0x23')](function(_0x720e55){return _0x720e55;});}return null;};}function removeEntity(_0x8c95c4,_0x57171d){return function(_0x96a3b4){if(_0x96a3b4){return _0x96a3b4[_0xead2('0x24')]()['then'](function(){_0x8c95c4['status'](0xcc)[_0xead2('0x18')]();});}};}function handleEntityNotFound(_0x1fbe2c,_0x21950a){return function(_0x2d7e17){if(!_0x2d7e17){_0x1fbe2c['sendStatus'](0x194);}return _0x2d7e17;};}function handleError(_0x1b5827,_0xb214bf){_0xb214bf=_0xb214bf||0x1f4;return function(_0x17b552){logger['error'](_0x17b552[_0xead2('0x25')]);if(_0x17b552[_0xead2('0x26')]){delete _0x17b552[_0xead2('0x26')];}_0x1b5827[_0xead2('0x17')](_0xb214bf)[_0xead2('0x27')](_0x17b552);};}exports[_0xead2('0x28')]=function(_0x3219f8,_0x30edfc){var _0x686ae7={},_0xc75f39={},_0x33b1c7={'count':0x0,'rows':[]};var _0x299e36=_['map'](db[_0xead2('0x29')]['rawAttributes'],function(_0x28c1bb){return{'name':_0x28c1bb[_0xead2('0x2a')],'type':_0x28c1bb[_0xead2('0x2b')][_0xead2('0x2c')]};});_0xc75f39['model']=_[_0xead2('0x2d')](_0x299e36,_0xead2('0x26'));_0xc75f39['query']=_[_0xead2('0x2e')](_0x3219f8['query']);_0xc75f39[_0xead2('0x2f')]=_['intersection'](_0xc75f39['model'],_0xc75f39[_0xead2('0x30')]);_0x686ae7[_0xead2('0x31')]=_[_0xead2('0x32')](_0xc75f39['model'],qs[_0xead2('0x33')](_0x3219f8[_0xead2('0x30')]['fields']));_0x686ae7[_0xead2('0x31')]=_0x686ae7[_0xead2('0x31')]['length']?_0x686ae7[_0xead2('0x31')]:_0xc75f39[_0xead2('0x34')];if(!_0x3219f8['query'][_0xead2('0x35')]('nolimit')){_0x686ae7[_0xead2('0x1c')]=qs[_0xead2('0x1c')](_0x3219f8[_0xead2('0x30')]['limit']);_0x686ae7[_0xead2('0x1a')]=qs[_0xead2('0x1a')](_0x3219f8[_0xead2('0x30')][_0xead2('0x1a')]);}_0x686ae7[_0xead2('0x36')]=qs[_0xead2('0x37')](_0x3219f8[_0xead2('0x30')][_0xead2('0x37')]);_0x686ae7[_0xead2('0x38')]=qs['filters'](_[_0xead2('0x39')](_0x3219f8[_0xead2('0x30')],_0xc75f39[_0xead2('0x2f')]),_0x299e36);if(_0x3219f8[_0xead2('0x30')]['filter']){_0x686ae7[_0xead2('0x38')]=_[_0xead2('0x3a')](_0x686ae7['where'],{'$or':_[_0xead2('0x2d')](_0x299e36,function(_0x434dca){if(_0x434dca[_0xead2('0x2b')]!=='VIRTUAL'){var _0x5b7cde={};_0x5b7cde[_0x434dca[_0xead2('0x26')]]={'$like':'%'+_0x3219f8[_0xead2('0x30')]['filter']+'%'};return _0x5b7cde;}})});}_0x686ae7=_['merge']({},_0x686ae7,_0x3219f8[_0xead2('0x3b')]);var _0x13db7a={'where':_0x686ae7[_0xead2('0x38')]};return db[_0xead2('0x29')][_0xead2('0x1d')](_0x13db7a)['then'](function(_0x1ea566){_0x33b1c7[_0xead2('0x1d')]=_0x1ea566;if(_0x3219f8[_0xead2('0x30')]['includeAll']){_0x686ae7['include']=[{'all':!![]}];}return db[_0xead2('0x29')]['findAll'](_0x686ae7);})[_0xead2('0x23')](function(_0x33e29c){_0x33b1c7[_0xead2('0x3c')]=_0x33e29c;return _0x33b1c7;})[_0xead2('0x23')](respondWithFilteredResult(_0x30edfc,_0x686ae7))[_0xead2('0x3d')](handleError(_0x30edfc,null));};exports[_0xead2('0x3e')]=function(_0x2d5278,_0x40ecc2){var _0x4fce6d={'raw':![],'where':{'id':_0x2d5278[_0xead2('0x3f')]['id']}},_0xad5f6b={};_0xad5f6b[_0xead2('0x34')]=_[_0xead2('0x2e')](db[_0xead2('0x29')][_0xead2('0x40')]);_0xad5f6b[_0xead2('0x30')]=_[_0xead2('0x2e')](_0x2d5278['query']);_0xad5f6b['filters']=_[_0xead2('0x32')](_0xad5f6b['model'],_0xad5f6b[_0xead2('0x30')]);_0x4fce6d[_0xead2('0x31')]=_[_0xead2('0x32')](_0xad5f6b[_0xead2('0x34')],qs[_0xead2('0x33')](_0x2d5278[_0xead2('0x30')]['fields']));_0x4fce6d[_0xead2('0x31')]=_0x4fce6d[_0xead2('0x31')][_0xead2('0x41')]?_0x4fce6d[_0xead2('0x31')]:_0xad5f6b[_0xead2('0x34')];if(_0x2d5278['query'][_0xead2('0x42')]){_0x4fce6d['include']=[{'all':!![]}];}_0x4fce6d=_[_0xead2('0x3a')]({},_0x4fce6d,_0x2d5278['options']);return db[_0xead2('0x29')][_0xead2('0x43')](_0x4fce6d)['then'](handleEntityNotFound(_0x40ecc2,null))[_0xead2('0x23')](respondWithResult(_0x40ecc2,null))[_0xead2('0x3d')](handleError(_0x40ecc2,null));};exports[_0xead2('0x44')]=function(_0x3d2043,_0x629df8){return db[_0xead2('0x29')]['create'](_0x3d2043[_0xead2('0x45')],{})['then'](respondWithResult(_0x629df8,0xc9))[_0xead2('0x3d')](handleError(_0x629df8,null));};exports['update']=function(_0x3faf5d,_0x39c256){if(_0x3faf5d['body']['id']){delete _0x3faf5d[_0xead2('0x45')]['id'];}return db[_0xead2('0x29')][_0xead2('0x43')]({'where':{'id':_0x3faf5d[_0xead2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x39c256,null))[_0xead2('0x23')](saveUpdates(_0x3faf5d[_0xead2('0x45')],null))[_0xead2('0x23')](respondWithResult(_0x39c256,null))['catch'](handleError(_0x39c256,null));};exports[_0xead2('0x24')]=function(_0x2e45ef,_0xe5f0ac){return db['ServicenowAccount'][_0xead2('0x43')]({'where':{'id':_0x2e45ef['params']['id']}})[_0xead2('0x23')](handleEntityNotFound(_0xe5f0ac,null))[_0xead2('0x23')](removeEntity(_0xe5f0ac,null))[_0xead2('0x3d')](handleError(_0xe5f0ac,null));};exports[_0xead2('0x46')]=function(_0x3dfda6,_0x171829,_0xe52ffb){var _0x18b746={};var _0x542b73={};var _0x1269f2;var _0x51b416;return db[_0xead2('0x29')]['findOne']({'where':{'id':_0x3dfda6[_0xead2('0x3f')]['id']}})[_0xead2('0x23')](handleEntityNotFound(_0x171829,null))[_0xead2('0x23')](function(_0x119c59){if(_0x119c59){_0x1269f2=_0x119c59;_0x542b73[_0xead2('0x34')]=_[_0xead2('0x2e')](db[_0xead2('0x47')][_0xead2('0x40')]);_0x542b73[_0xead2('0x30')]=_[_0xead2('0x2e')](_0x3dfda6['query']);_0x542b73['filters']=_['intersection'](_0x542b73['model'],_0x542b73['query']);_0x18b746[_0xead2('0x31')]=_[_0xead2('0x32')](_0x542b73['model'],qs[_0xead2('0x33')](_0x3dfda6[_0xead2('0x30')][_0xead2('0x33')]));_0x18b746[_0xead2('0x31')]=_0x18b746['attributes'][_0xead2('0x41')]?_0x18b746[_0xead2('0x31')]:_0x542b73['model'];_0x18b746[_0xead2('0x36')]=qs[_0xead2('0x37')](_0x3dfda6[_0xead2('0x30')][_0xead2('0x37')]);_0x18b746['where']=qs[_0xead2('0x2f')](_[_0xead2('0x39')](_0x3dfda6[_0xead2('0x30')],_0x542b73['filters']));if(_0x3dfda6['query'][_0xead2('0x48')]){_0x18b746['where']=_[_0xead2('0x3a')](_0x18b746[_0xead2('0x38')],{'$or':_[_0xead2('0x2d')](_0x18b746[_0xead2('0x31')],function(_0x589382){var _0x27cdfa={};_0x27cdfa[_0x589382]={'$like':'%'+_0x3dfda6[_0xead2('0x30')][_0xead2('0x48')]+'%'};return _0x27cdfa;})});}_0x18b746=_[_0xead2('0x3a')]({},_0x18b746,_0x3dfda6[_0xead2('0x3b')]);return _0x1269f2[_0xead2('0x46')](_0x18b746);}})[_0xead2('0x23')](function(_0x4b8346){if(_0x4b8346){_0x51b416=_0x4b8346[_0xead2('0x41')];if(!_0x3dfda6[_0xead2('0x30')][_0xead2('0x35')](_0xead2('0x49'))){_0x18b746['limit']=qs['limit'](_0x3dfda6[_0xead2('0x30')][_0xead2('0x1c')]);_0x18b746[_0xead2('0x1a')]=qs[_0xead2('0x1a')](_0x3dfda6[_0xead2('0x30')][_0xead2('0x1a')]);}return _0x1269f2[_0xead2('0x46')](_0x18b746);}})[_0xead2('0x23')](function(_0x1edd34){if(_0x1edd34){return _0x1edd34?{'count':_0x51b416,'rows':_0x1edd34}:null;}})['then'](respondWithResult(_0x171829,null))[_0xead2('0x3d')](handleError(_0x171829,null));};exports[_0xead2('0x4a')]=function(_0x334ae9,_0x2e3f2e,_0x1c69f4){if(_0x334ae9['body']['id']){delete _0x334ae9[_0xead2('0x45')]['id'];}return db[_0xead2('0x29')]['findOne']({'where':{'id':_0x334ae9[_0xead2('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2e3f2e,null))[_0xead2('0x23')](function(_0x4ccf99){if(_0x4ccf99){_0x334ae9[_0xead2('0x45')][_0xead2('0x4b')]=_0x4ccf99['id'];_0x334ae9[_0xead2('0x45')][_0xead2('0x4c')]=integrations[_0xead2('0x4d')](_0x334ae9[_0xead2('0x45')][_0xead2('0x4e')],_0x334ae9[_0xead2('0x45')]['type']);_0x334ae9[_0xead2('0x45')][_0xead2('0x4f')]=integrations[_0xead2('0x50')](_0x334ae9[_0xead2('0x45')][_0xead2('0x4e')],_0x334ae9[_0xead2('0x45')][_0xead2('0x2b')]);return db[_0xead2('0x47')][_0xead2('0x44')](_0x334ae9[_0xead2('0x45')],{'include':[{'model':db['ServicenowField'],'as':_0xead2('0x4c')},{'model':db['ServicenowField'],'as':_0xead2('0x4f')}]});}return null;})[_0xead2('0x23')](respondWithResult(_0x2e3f2e,null))[_0xead2('0x3d')](handleError(_0x2e3f2e,null));};exports[_0xead2('0x51')]=function(_0x122b95,_0x6f7382,_0x29d530){var _0x2b898d=[_0xead2('0x52'),_0xead2('0x53'),_0xead2('0x54'),_0xead2('0x55'),_0xead2('0x56'),_0xead2('0x57'),_0xead2('0x58'),_0xead2('0x59'),_0xead2('0x5a')];var _0x3d3633=[_0xead2('0x5b'),'made_sla',_0xead2('0x5c'),_0xead2('0x5d'),'upon_reject',_0xead2('0x5e'),_0xead2('0x5f'),_0xead2('0x53'),_0xead2('0x60'),'number',_0xead2('0x61'),_0xead2('0x62'),_0xead2('0x63'),_0xead2('0x64'),'sys_created_on',_0xead2('0x65'),_0xead2('0x66'),_0xead2('0x67'),_0xead2('0x54'),_0xead2('0x36'),_0xead2('0x68'),_0xead2('0x69'),'cmdb_ci','delivery_plan','impact','active','work_notes_list',_0xead2('0x6a'),'priority',_0xead2('0x6b'),_0xead2('0x6c'),_0xead2('0x6d'),'expected_start',_0xead2('0x6e'),'business_duration',_0xead2('0x6f'),_0xead2('0x70'),_0xead2('0x71'),'resolved_at','caller_id',_0xead2('0x72'),_0xead2('0x55'),_0xead2('0x73'),_0xead2('0x74'),_0xead2('0x56'),_0xead2('0x75'),_0xead2('0x76'),_0xead2('0x77'),_0xead2('0x78'),_0xead2('0x79'),_0xead2('0x7a'),'description','calendar_duration',_0xead2('0x57'),_0xead2('0x7b'),'close_notes',_0xead2('0x7c'),_0xead2('0x7d'),_0xead2('0x7e'),_0xead2('0x7f'),_0xead2('0x80'),_0xead2('0x81'),_0xead2('0x58'),_0xead2('0x82'),'problem_id',_0xead2('0x83'),_0xead2('0x84'),_0xead2('0x85'),'assigned_to',_0xead2('0x59'),_0xead2('0x86'),_0xead2('0x87'),'approval',_0xead2('0x88'),'due_date',_0xead2('0x89'),_0xead2('0x8a'),_0xead2('0x8b'),'escalation','upon_approval',_0xead2('0x8c'),_0xead2('0x8d'),_0xead2('0x5a')];var _0x3f4bdc='';var _0x5593a2='';var _0x15be39=[];var _0x48f96='';var _0x3fd4fa='';var _0x13df3b=[];var _0x591d92='';var _0x2d71ba='';var _0x4c5a68={};var _0x3e3ed6='';return db[_0xead2('0x29')][_0xead2('0x8e')]({'where':{'id':_0x122b95['params']['id']},'attributes':['id',_0xead2('0x8f'),_0xead2('0x90'),'email',_0xead2('0x91'),_0xead2('0x92')]})[_0xead2('0x23')](handleEntityNotFound(_0x6f7382,null))[_0xead2('0x23')](function(_0x51c172){if(_0x51c172){_0x3e3ed6=_0x51c172['remoteUri'];var _0x46ba03=_0x3e3ed6[_0xead2('0x93')](-0x1);if(_0x46ba03==='/'){_0x3e3ed6=_0x3e3ed6[_0xead2('0x94')](0x0,_0x3e3ed6[_0xead2('0x95')](_0x46ba03));}_0x2d71ba=util[_0xead2('0x96')](_0xead2('0x97'),_0x3e3ed6);_0x591d92=util[_0xead2('0x96')](_0xead2('0x98'),_0x3e3ed6);_0x4c5a68={'user':_0x51c172[_0xead2('0x8f')],'pass':_0x51c172[_0xead2('0x90')]};var _0x63ae1f={'method':_0xead2('0x99'),'uri':_0x2d71ba+_0xead2('0x9a'),'auth':_0x4c5a68,'json':!![]};return rp(_0x63ae1f);}})[_0xead2('0x23')](function(_0x1a0b79){if(_0x1a0b79[_0xead2('0x9b')][_0xead2('0x41')]>0x0){_0x3f4bdc=_0x1a0b79[_0xead2('0x9b')];}console[_0xead2('0x9c')](_0xead2('0x9d'),_0x3f4bdc);_0x13df3b=[];_0x5593a2=Object[_0xead2('0x9e')]([],_0x3f4bdc);_[_0xead2('0x9f')](_0x5593a2,function(_0x3e4a4b){return!_0x2b898d['includes'](_0x3e4a4b[_0xead2('0x26')]);});_0x5593a2[_0xead2('0xa0')](function(_0x181a40){var _0x3daca1=createFieldObject(_0x591d92,_0x4c5a68,_0x181a40[_0xead2('0xa1')],_0x181a40[_0xead2('0x26')],_0x181a40['label'],![]);_0x13df3b[_0xead2('0xa2')](_0x3daca1);});return Promise[_0xead2('0xa3')](_0x13df3b);})[_0xead2('0x23')](function(_0x3f074d){_0x15be39=_0x3f074d;_0x48f96=Object[_0xead2('0x9e')]([],_0x3f4bdc);console[_0xead2('0x9c')](_0xead2('0xa4'),_0x3f4bdc);_[_0xead2('0x9f')](_0x48f96,function(_0x3ca838){return _0x3d3633['includes'](_0x3ca838['name']);});console[_0xead2('0x9c')](_0xead2('0xa5'),_0x48f96);_0x13df3b=[];_0x48f96[_0xead2('0xa0')](function(_0x40b875){var _0x41903f=createFieldObject(_0x591d92,_0x4c5a68,_0x40b875[_0xead2('0xa1')],_0x40b875[_0xead2('0x26')],_0x40b875[_0xead2('0xa6')],!![]);_0x13df3b[_0xead2('0xa2')](_0x41903f);});return Promise[_0xead2('0xa3')](_0x13df3b);})['then'](function(_0x21398d){_0x3fd4fa=_0x21398d;var _0xb15392=_0x15be39[_0xead2('0xa7')](_0x3fd4fa);return{'count':_0xb15392[_0xead2('0x41')],'rows':_0xb15392};})[_0xead2('0x23')](respondWithResult(_0x6f7382,null))[_0xead2('0x3d')](function(_0x40c3a4){console['log'](_0xead2('0xa8')+_0x40c3a4);var _0x5980d1=_0x122b95[_0xead2('0x30')][_0xead2('0xa9')]?0x1f4:_0x40c3a4['statusCode']||0x1f4;logger[_0xead2('0xaa')](_0x40c3a4[_0xead2('0x25')]);delete _0x40c3a4['name'];if(_0x5980d1===0x191){_0x5980d1=0x190;}_0x6f7382[_0xead2('0x17')](_0x5980d1)[_0xead2('0x27')](_0x122b95[_0xead2('0x30')][_0xead2('0xa9')]?{'message':'Wrong\x20credentials','statusCode':_0x40c3a4[_0xead2('0xab')]}:_0x40c3a4);});};function createFieldObject(_0x164674,_0x9e9349,_0x8c3b29,_0x54d11b,_0x5883aa,_0x4d8782){return new Promise(function(_0x5ee3dc,_0x33ac12){var _0x508bec={'id':_0x54d11b,'name':_0x5883aa,'custom':_0x4d8782};if(_0x8c3b29===_0xead2('0xac')){_0x508bec[_0xead2('0x3b')]=[{'name':_0xead2('0xad'),'value':_0xead2('0xae')},{'name':_0xead2('0xaf'),'value':_0xead2('0xb0')}];_0x5ee3dc(_0x508bec);}else{var _0x13022f={'method':'GET','uri':_0x164674+_0xead2('0xb1')+_0x54d11b,'auth':_0x9e9349,'json':!![]};return rp(_0x13022f)[_0xead2('0x23')](function(_0x35c62d){var _0x36a90f=[];if(_0x35c62d[_0xead2('0x9b')][_0xead2('0x41')]>0x0){_0x35c62d[_0xead2('0x9b')][_0xead2('0xa0')](function(_0x59ac88){if(_0x59ac88[_0xead2('0xb2')]==='false'){var _0x2442cb={'name':_0x59ac88['label'],'value':_0x59ac88[_0xead2('0xb3')]};_0x36a90f['push'](_0x2442cb);}});}_0x508bec[_0xead2('0x3b')]=_0x36a90f;if(_0x508bec[_0xead2('0x3b')][_0xead2('0x41')]>0x0){_0x5ee3dc(_0x508bec);}else{if(_0x4d8782==![]){_0x5ee3dc();}else{_0x5ee3dc(_0x508bec);}}});}});} \ No newline at end of file +var _0x5490=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','ServicenowAccount','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','channel','Descriptions','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','severity','category','parent','caused_by','upon_reject','sys_updated_on','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','active','work_notes_list','priority','sys_domain_path','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','contact_type','incident_state','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','location','password','email','remoteUri','slice','format','%s/api/now/table/','username','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','TCL:\x20_object','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','concat','ServiceNow\x20error:\x20','statusCode','error','test','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','papaparse'];(function(_0x4acd65,_0x193e16){var _0x1e7c1d=function(_0x49ee80){while(--_0x49ee80){_0x4acd65['push'](_0x4acd65['shift']());}};_0x1e7c1d(++_0x193e16);}(_0x5490,0xa8));var _0x0549=function(_0x2a09f0,_0x52c863){_0x2a09f0=_0x2a09f0-0x0;var _0x1cccdf=_0x5490[_0x2a09f0];return _0x1cccdf;};'use strict';var emlformat=require(_0x0549('0x0'));var rimraf=require(_0x0549('0x1'));var zipdir=require(_0x0549('0x2'));var jsonpatch=require(_0x0549('0x3'));var rp=require('request-promise');var moment=require(_0x0549('0x4'));var BPromise=require(_0x0549('0x5'));var Mustache=require(_0x0549('0x6'));var util=require('util');var path=require(_0x0549('0x7'));var sox=require('sox');var csv=require(_0x0549('0x8'));var ejs=require(_0x0549('0x9'));var fs=require('fs');var fs_extra=require(_0x0549('0xa'));var _=require(_0x0549('0xb'));var squel=require('squel');var crypto=require(_0x0549('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0549('0x8'));var querystring=require('querystring');var Papa=require(_0x0549('0xd'));var Redis=require('ioredis');var authService=require(_0x0549('0xe'));var qs=require(_0x0549('0xf'));var as=require(_0x0549('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0549('0x11'))('api');var utils=require(_0x0549('0x12'));var config=require(_0x0549('0x13'));var licenseUtil=require(_0x0549('0x14'));var db=require(_0x0549('0x15'))['db'];var integrations=require(_0x0549('0x16'));function respondWithStatusCode(_0x6d34f3,_0xf9967c){_0xf9967c=_0xf9967c||0xcc;return function(_0x50cdd9){if(_0x50cdd9){return _0x6d34f3['sendStatus'](_0xf9967c);}return _0x6d34f3[_0x0549('0x17')](_0xf9967c)[_0x0549('0x18')]();};}function respondWithResult(_0x3b06e2,_0x35d5ef){_0x35d5ef=_0x35d5ef||0xc8;return function(_0x293743){if(_0x293743){return _0x3b06e2[_0x0549('0x17')](_0x35d5ef)[_0x0549('0x19')](_0x293743);}};}function respondWithFilteredResult(_0x14f1fb,_0x49d699){return function(_0x13bf75){if(_0x13bf75){var _0x2460d1=typeof _0x49d699['offset']==='undefined'&&typeof _0x49d699[_0x0549('0x1a')]===_0x0549('0x1b');var _0x15e8b3=_0x13bf75['count'];var _0x5dc5cb=_0x2460d1?0x0:_0x49d699[_0x0549('0x1c')];var _0x29da25=_0x2460d1?_0x13bf75[_0x0549('0x1d')]:_0x49d699[_0x0549('0x1c')]+_0x49d699[_0x0549('0x1a')];var _0x245a7f;if(_0x29da25>=_0x15e8b3){_0x29da25=_0x15e8b3;_0x245a7f=0xc8;}else{_0x245a7f=0xce;}_0x14f1fb[_0x0549('0x17')](_0x245a7f);return _0x14f1fb[_0x0549('0x1e')](_0x0549('0x1f'),_0x5dc5cb+'-'+_0x29da25+'/'+_0x15e8b3)['json'](_0x13bf75);}return null;};}function patchUpdates(_0x381878){return function(_0x533bca){try{jsonpatch[_0x0549('0x20')](_0x533bca,_0x381878,!![]);}catch(_0x4a6657){return BPromise[_0x0549('0x21')](_0x4a6657);}return _0x533bca[_0x0549('0x22')]();};}function saveUpdates(_0x578329,_0x1f6aa6){return function(_0x54ff11){if(_0x54ff11){return _0x54ff11[_0x0549('0x23')](_0x578329)[_0x0549('0x24')](function(_0x65d670){return _0x65d670;});}return null;};}function removeEntity(_0xb8edee,_0x1699a4){return function(_0x44e7dd){if(_0x44e7dd){return _0x44e7dd[_0x0549('0x25')]()[_0x0549('0x24')](function(){_0xb8edee[_0x0549('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13ece7,_0x36cf18){return function(_0x165002){if(!_0x165002){_0x13ece7['sendStatus'](0x194);}return _0x165002;};}function handleError(_0xd6e3e3,_0xa942c){_0xa942c=_0xa942c||0x1f4;return function(_0x2445be){logger['error'](_0x2445be[_0x0549('0x26')]);if(_0x2445be[_0x0549('0x27')]){delete _0x2445be['name'];}_0xd6e3e3['status'](_0xa942c)[_0x0549('0x28')](_0x2445be);};}exports['index']=function(_0xbfab91,_0x12bd32){var _0x47f5c4={},_0x1f2aba={},_0x5b1997={'count':0x0,'rows':[]};var _0x1233a4=_['map'](db['ServicenowAccount'][_0x0549('0x29')],function(_0x420040){return{'name':_0x420040[_0x0549('0x2a')],'type':_0x420040[_0x0549('0x2b')][_0x0549('0x2c')]};});_0x1f2aba[_0x0549('0x2d')]=_[_0x0549('0x2e')](_0x1233a4,_0x0549('0x27'));_0x1f2aba['query']=_[_0x0549('0x2f')](_0xbfab91[_0x0549('0x30')]);_0x1f2aba[_0x0549('0x31')]=_[_0x0549('0x32')](_0x1f2aba[_0x0549('0x2d')],_0x1f2aba[_0x0549('0x30')]);_0x47f5c4['attributes']=_[_0x0549('0x32')](_0x1f2aba[_0x0549('0x2d')],qs['fields'](_0xbfab91[_0x0549('0x30')][_0x0549('0x33')]));_0x47f5c4[_0x0549('0x34')]=_0x47f5c4[_0x0549('0x34')][_0x0549('0x35')]?_0x47f5c4[_0x0549('0x34')]:_0x1f2aba['model'];if(!_0xbfab91[_0x0549('0x30')][_0x0549('0x36')](_0x0549('0x37'))){_0x47f5c4[_0x0549('0x1a')]=qs['limit'](_0xbfab91[_0x0549('0x30')][_0x0549('0x1a')]);_0x47f5c4[_0x0549('0x1c')]=qs[_0x0549('0x1c')](_0xbfab91[_0x0549('0x30')][_0x0549('0x1c')]);}_0x47f5c4[_0x0549('0x38')]=qs[_0x0549('0x39')](_0xbfab91[_0x0549('0x30')][_0x0549('0x39')]);_0x47f5c4[_0x0549('0x3a')]=qs[_0x0549('0x31')](_[_0x0549('0x3b')](_0xbfab91['query'],_0x1f2aba[_0x0549('0x31')]),_0x1233a4);if(_0xbfab91[_0x0549('0x30')]['filter']){_0x47f5c4[_0x0549('0x3a')]=_['merge'](_0x47f5c4[_0x0549('0x3a')],{'$or':_[_0x0549('0x2e')](_0x1233a4,function(_0x567db5){if(_0x567db5['type']!==_0x0549('0x3c')){var _0x2c9f95={};_0x2c9f95[_0x567db5[_0x0549('0x27')]]={'$like':'%'+_0xbfab91[_0x0549('0x30')][_0x0549('0x3d')]+'%'};return _0x2c9f95;}})});}_0x47f5c4=_[_0x0549('0x3e')]({},_0x47f5c4,_0xbfab91[_0x0549('0x3f')]);var _0x30fd9f={'where':_0x47f5c4['where']};return db['ServicenowAccount']['count'](_0x30fd9f)[_0x0549('0x24')](function(_0x1bdc27){_0x5b1997[_0x0549('0x1d')]=_0x1bdc27;if(_0xbfab91[_0x0549('0x30')][_0x0549('0x40')]){_0x47f5c4[_0x0549('0x41')]=[{'all':!![]}];}return db[_0x0549('0x42')][_0x0549('0x43')](_0x47f5c4);})[_0x0549('0x24')](function(_0x2c3695){_0x5b1997[_0x0549('0x44')]=_0x2c3695;return _0x5b1997;})[_0x0549('0x24')](respondWithFilteredResult(_0x12bd32,_0x47f5c4))[_0x0549('0x45')](handleError(_0x12bd32,null));};exports['show']=function(_0x2266f6,_0x57132c){var _0x3f8108={'raw':![],'where':{'id':_0x2266f6[_0x0549('0x46')]['id']}},_0x4ffee={};_0x4ffee[_0x0549('0x2d')]=_[_0x0549('0x2f')](db[_0x0549('0x42')]['rawAttributes']);_0x4ffee[_0x0549('0x30')]=_[_0x0549('0x2f')](_0x2266f6[_0x0549('0x30')]);_0x4ffee[_0x0549('0x31')]=_[_0x0549('0x32')](_0x4ffee[_0x0549('0x2d')],_0x4ffee['query']);_0x3f8108[_0x0549('0x34')]=_[_0x0549('0x32')](_0x4ffee['model'],qs[_0x0549('0x33')](_0x2266f6['query'][_0x0549('0x33')]));_0x3f8108[_0x0549('0x34')]=_0x3f8108[_0x0549('0x34')][_0x0549('0x35')]?_0x3f8108[_0x0549('0x34')]:_0x4ffee['model'];if(_0x2266f6[_0x0549('0x30')][_0x0549('0x40')]){_0x3f8108[_0x0549('0x41')]=[{'all':!![]}];}_0x3f8108=_[_0x0549('0x3e')]({},_0x3f8108,_0x2266f6[_0x0549('0x3f')]);return db['ServicenowAccount'][_0x0549('0x47')](_0x3f8108)[_0x0549('0x24')](handleEntityNotFound(_0x57132c,null))[_0x0549('0x24')](respondWithResult(_0x57132c,null))['catch'](handleError(_0x57132c,null));};exports[_0x0549('0x48')]=function(_0x5f223f,_0x58c2d0){return db[_0x0549('0x42')][_0x0549('0x48')](_0x5f223f['body'],{})[_0x0549('0x24')](respondWithResult(_0x58c2d0,0xc9))[_0x0549('0x45')](handleError(_0x58c2d0,null));};exports[_0x0549('0x23')]=function(_0x174683,_0x8f05a7){if(_0x174683['body']['id']){delete _0x174683[_0x0549('0x49')]['id'];}return db['ServicenowAccount'][_0x0549('0x47')]({'where':{'id':_0x174683[_0x0549('0x46')]['id']}})[_0x0549('0x24')](handleEntityNotFound(_0x8f05a7,null))[_0x0549('0x24')](saveUpdates(_0x174683[_0x0549('0x49')],null))[_0x0549('0x24')](respondWithResult(_0x8f05a7,null))['catch'](handleError(_0x8f05a7,null));};exports[_0x0549('0x25')]=function(_0x5b6787,_0x1fb153){return db[_0x0549('0x42')][_0x0549('0x47')]({'where':{'id':_0x5b6787[_0x0549('0x46')]['id']}})[_0x0549('0x24')](handleEntityNotFound(_0x1fb153,null))[_0x0549('0x24')](removeEntity(_0x1fb153,null))['catch'](handleError(_0x1fb153,null));};exports[_0x0549('0x4a')]=function(_0x2f239a,_0x5689db,_0x57b17d){var _0x425162={};var _0x21fc01={};var _0xd6ee6e;var _0x502657;return db[_0x0549('0x42')][_0x0549('0x4b')]({'where':{'id':_0x2f239a[_0x0549('0x46')]['id']}})[_0x0549('0x24')](handleEntityNotFound(_0x5689db,null))[_0x0549('0x24')](function(_0x32febb){if(_0x32febb){_0xd6ee6e=_0x32febb;_0x21fc01[_0x0549('0x2d')]=_[_0x0549('0x2f')](db['ServicenowConfiguration']['rawAttributes']);_0x21fc01[_0x0549('0x30')]=_[_0x0549('0x2f')](_0x2f239a[_0x0549('0x30')]);_0x21fc01['filters']=_[_0x0549('0x32')](_0x21fc01[_0x0549('0x2d')],_0x21fc01[_0x0549('0x30')]);_0x425162['attributes']=_[_0x0549('0x32')](_0x21fc01[_0x0549('0x2d')],qs[_0x0549('0x33')](_0x2f239a['query'][_0x0549('0x33')]));_0x425162[_0x0549('0x34')]=_0x425162[_0x0549('0x34')]['length']?_0x425162[_0x0549('0x34')]:_0x21fc01[_0x0549('0x2d')];_0x425162['order']=qs[_0x0549('0x39')](_0x2f239a[_0x0549('0x30')][_0x0549('0x39')]);_0x425162[_0x0549('0x3a')]=qs['filters'](_[_0x0549('0x3b')](_0x2f239a[_0x0549('0x30')],_0x21fc01[_0x0549('0x31')]));if(_0x2f239a[_0x0549('0x30')][_0x0549('0x3d')]){_0x425162[_0x0549('0x3a')]=_[_0x0549('0x3e')](_0x425162[_0x0549('0x3a')],{'$or':_[_0x0549('0x2e')](_0x425162[_0x0549('0x34')],function(_0x354b13){var _0x1ab259={};_0x1ab259[_0x354b13]={'$like':'%'+_0x2f239a[_0x0549('0x30')]['filter']+'%'};return _0x1ab259;})});}_0x425162=_[_0x0549('0x3e')]({},_0x425162,_0x2f239a[_0x0549('0x3f')]);return _0xd6ee6e[_0x0549('0x4a')](_0x425162);}})['then'](function(_0x2b9931){if(_0x2b9931){_0x502657=_0x2b9931['length'];if(!_0x2f239a[_0x0549('0x30')][_0x0549('0x36')](_0x0549('0x37'))){_0x425162[_0x0549('0x1a')]=qs[_0x0549('0x1a')](_0x2f239a[_0x0549('0x30')][_0x0549('0x1a')]);_0x425162[_0x0549('0x1c')]=qs[_0x0549('0x1c')](_0x2f239a[_0x0549('0x30')]['offset']);}return _0xd6ee6e[_0x0549('0x4a')](_0x425162);}})[_0x0549('0x24')](function(_0x1b4dcf){if(_0x1b4dcf){return _0x1b4dcf?{'count':_0x502657,'rows':_0x1b4dcf}:null;}})[_0x0549('0x24')](respondWithResult(_0x5689db,null))[_0x0549('0x45')](handleError(_0x5689db,null));};exports[_0x0549('0x4c')]=function(_0x1743b1,_0x5f6839,_0x4d8006){if(_0x1743b1['body']['id']){delete _0x1743b1[_0x0549('0x49')]['id'];}return db[_0x0549('0x42')][_0x0549('0x4b')]({'where':{'id':_0x1743b1[_0x0549('0x46')]['id']}})[_0x0549('0x24')](handleEntityNotFound(_0x5f6839,null))['then'](function(_0x1a6691){if(_0x1a6691){_0x1743b1[_0x0549('0x49')][_0x0549('0x4d')]=_0x1a6691['id'];_0x1743b1[_0x0549('0x49')][_0x0549('0x4e')]=integrations['getSubjects'](_0x1743b1[_0x0549('0x49')][_0x0549('0x4f')],_0x1743b1[_0x0549('0x49')][_0x0549('0x2b')]);_0x1743b1[_0x0549('0x49')][_0x0549('0x50')]=integrations['getDescriptions'](_0x1743b1[_0x0549('0x49')][_0x0549('0x4f')],_0x1743b1['body'][_0x0549('0x2b')]);return db[_0x0549('0x51')][_0x0549('0x48')](_0x1743b1['body'],{'include':[{'model':db[_0x0549('0x52')],'as':_0x0549('0x4e')},{'model':db[_0x0549('0x52')],'as':'Descriptions'}]});}return null;})[_0x0549('0x24')](respondWithResult(_0x5f6839,null))['catch'](handleError(_0x5f6839,null));};exports[_0x0549('0x53')]=function(_0x5e4c2b,_0xfb5cf8,_0x5ad85c){var _0x3e2672=[_0x0549('0x54'),_0x0549('0x55'),_0x0549('0x56'),_0x0549('0x57'),_0x0549('0x58'),_0x0549('0x59'),'incident_state',_0x0549('0x5a'),_0x0549('0x5b')];var _0x5d17d5=[_0x0549('0x5c'),'made_sla',_0x0549('0x5d'),'watch_list',_0x0549('0x5e'),_0x0549('0x5f'),'child_incidents',_0x0549('0x55'),_0x0549('0x60'),_0x0549('0x61'),_0x0549('0x62'),'sys_updated_by',_0x0549('0x63'),_0x0549('0x64'),_0x0549('0x65'),'sys_domain',_0x0549('0x66'),_0x0549('0x67'),_0x0549('0x56'),_0x0549('0x38'),_0x0549('0x68'),_0x0549('0x69'),'cmdb_ci','delivery_plan','impact',_0x0549('0x6a'),_0x0549('0x6b'),'business_service',_0x0549('0x6c'),_0x0549('0x6d'),'rfc','time_worked',_0x0549('0x6e'),_0x0549('0x6f'),'business_duration',_0x0549('0x70'),_0x0549('0x71'),_0x0549('0x72'),_0x0549('0x73'),_0x0549('0x74'),_0x0549('0x75'),_0x0549('0x57'),_0x0549('0x76'),_0x0549('0x77'),'close_code',_0x0549('0x78'),'delivery_task',_0x0549('0x79'),_0x0549('0x7a'),_0x0549('0x7b'),_0x0549('0x7c'),'description',_0x0549('0x7d'),'notify',_0x0549('0x7e'),_0x0549('0x7f'),_0x0549('0x80'),_0x0549('0x81'),_0x0549('0x82'),'sys_id',_0x0549('0x83'),'reopened_by',_0x0549('0x84'),'urgency',_0x0549('0x85'),_0x0549('0x86'),_0x0549('0x87'),'activity_due',_0x0549('0x88'),_0x0549('0x5a'),_0x0549('0x89'),_0x0549('0x8a'),_0x0549('0x8b'),_0x0549('0x8c'),_0x0549('0x8d'),_0x0549('0x8e'),_0x0549('0x8f'),'sys_tags',_0x0549('0x90'),'upon_approval','correlation_id',_0x0549('0x91'),_0x0549('0x5b')];var _0x418aba='';var _0xb241c7='';var _0x7630df=[];var _0x4d92cb='';var _0x46047f='';var _0x4cdfeb=[];var _0x366db0='';var _0x19985f='';var _0x2ea407={};var _0x4ed57b='';return db[_0x0549('0x42')][_0x0549('0x4b')]({'where':{'id':_0x5e4c2b[_0x0549('0x46')]['id']},'attributes':['id','username',_0x0549('0x92'),_0x0549('0x93'),'remoteUri','serverUrl']})['then'](handleEntityNotFound(_0xfb5cf8,null))[_0x0549('0x24')](function(_0x1b9f97){if(_0x1b9f97){_0x4ed57b=_0x1b9f97[_0x0549('0x94')];var _0x250318=_0x4ed57b[_0x0549('0x95')](-0x1);if(_0x250318==='/'){_0x4ed57b=_0x4ed57b['substring'](0x0,_0x4ed57b['lastIndexOf'](_0x250318));}_0x19985f=util[_0x0549('0x96')]('%s/api/now/doc/table/schema/',_0x4ed57b);_0x366db0=util[_0x0549('0x96')](_0x0549('0x97'),_0x4ed57b);_0x2ea407={'user':_0x1b9f97[_0x0549('0x98')],'pass':_0x1b9f97[_0x0549('0x92')]};var _0x9d61f3={'method':_0x0549('0x99'),'uri':_0x19985f+_0x0549('0x9a'),'auth':_0x2ea407,'json':!![]};return rp(_0x9d61f3);}})[_0x0549('0x24')](function(_0xf0d9f0){if(_0xf0d9f0[_0x0549('0x9b')][_0x0549('0x35')]>0x0){_0x418aba=_0xf0d9f0[_0x0549('0x9b')];}console['log'](_0x0549('0x9c'),_0x418aba);_0x4cdfeb=[];_0xb241c7=Object[_0x0549('0x9d')]([],_0x418aba);_[_0x0549('0x9e')](_0xb241c7,function(_0x57d7da){return!_0x3e2672[_0x0549('0x9f')](_0x57d7da[_0x0549('0x27')]);});_0xb241c7[_0x0549('0xa0')](function(_0x555481){var _0x256061=createFieldObject(_0x366db0,_0x2ea407,_0x555481[_0x0549('0xa1')],_0x555481['name'],_0x555481[_0x0549('0xa2')],![]);_0x4cdfeb[_0x0549('0xa3')](_0x256061);});return Promise['all'](_0x4cdfeb);})[_0x0549('0x24')](function(_0x5b51d1){_0x7630df=_0x5b51d1;_0x4d92cb=Object[_0x0549('0x9d')]([],_0x418aba);console['log'](_0x0549('0xa4'),_0x418aba);_[_0x0549('0x9e')](_0x4d92cb,function(_0x2bb9c6){return _0x5d17d5[_0x0549('0x9f')](_0x2bb9c6[_0x0549('0x27')]);});console[_0x0549('0xa5')](_0x0549('0xa6'),_0x4d92cb);_0x4cdfeb=[];_0x4d92cb[_0x0549('0xa0')](function(_0x1b59f2){var _0x469209=createFieldObject(_0x366db0,_0x2ea407,_0x1b59f2[_0x0549('0xa1')],_0x1b59f2[_0x0549('0x27')],_0x1b59f2[_0x0549('0xa2')],!![]);_0x4cdfeb[_0x0549('0xa3')](_0x469209);});return Promise[_0x0549('0xa7')](_0x4cdfeb);})[_0x0549('0x24')](function(_0x11eb8b){_0x46047f=_0x11eb8b;var _0xfc1a3d=_0x7630df[_0x0549('0xa8')](_0x46047f);return{'count':_0xfc1a3d[_0x0549('0x35')],'rows':_0xfc1a3d};})[_0x0549('0x24')](respondWithResult(_0xfb5cf8,null))['catch'](function(_0x523f3f){console['log'](_0x0549('0xa9')+_0x523f3f);var _0x1e20e3=_0x5e4c2b[_0x0549('0x30')]['test']?0x1f4:_0x523f3f[_0x0549('0xaa')]||0x1f4;logger[_0x0549('0xab')](_0x523f3f[_0x0549('0x26')]);delete _0x523f3f[_0x0549('0x27')];if(_0x1e20e3===0x191){_0x1e20e3=0x190;}_0xfb5cf8[_0x0549('0x17')](_0x1e20e3)[_0x0549('0x28')](_0x5e4c2b[_0x0549('0x30')][_0x0549('0xac')]?{'message':_0x0549('0xad'),'statusCode':_0x523f3f[_0x0549('0xaa')]}:_0x523f3f);});};function createFieldObject(_0x46df31,_0x4203c6,_0x173ea3,_0x168224,_0x2d7625,_0x390521){return new Promise(function(_0x104bdb,_0x2ce6c8){var _0x15827e={'id':_0x168224,'name':_0x2d7625,'custom':_0x390521};if(_0x173ea3===_0x0549('0xae')){_0x15827e[_0x0549('0x3f')]=[{'name':_0x0549('0xaf'),'value':_0x0549('0xb0')},{'name':_0x0549('0xb1'),'value':_0x0549('0xb2')}];_0x104bdb(_0x15827e);}else{var _0x2968cc={'method':_0x0549('0x99'),'uri':_0x46df31+_0x0549('0xb3')+_0x168224,'auth':_0x4203c6,'json':!![]};return rp(_0x2968cc)['then'](function(_0x306126){var _0x4b2818=[];if(_0x306126[_0x0549('0x9b')][_0x0549('0x35')]>0x0){_0x306126[_0x0549('0x9b')][_0x0549('0xa0')](function(_0x3a9cd1){if(_0x3a9cd1[_0x0549('0xb4')]===_0x0549('0xb2')){var _0x3c3b7f={'name':_0x3a9cd1[_0x0549('0xa2')],'value':_0x3a9cd1[_0x0549('0xb5')]};_0x4b2818['push'](_0x3c3b7f);}});}_0x15827e[_0x0549('0x3f')]=_0x4b2818;if(_0x15827e[_0x0549('0x3f')]['length']>0x0){_0x104bdb(_0x15827e);}else{if(_0x390521==![]){_0x104bdb();}else{_0x104bdb(_0x15827e);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 1ffca80..aa61323 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 _0xba34=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x3ed96a,_0x63a56f){var _0x20876b=function(_0xdf258b){while(--_0xdf258b){_0x3ed96a['push'](_0x3ed96a['shift']());}};_0x20876b(++_0x63a56f);}(_0xba34,0x119));var _0x4ba3=function(_0x1d0865,_0x4bec68){_0x1d0865=_0x1d0865-0x0;var _0x2ae3e6=_0xba34[_0x1d0865];return _0x2ae3e6;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));var integrations=require(_0x4ba3('0x8'));module[_0x4ba3('0x9')]=function(_0xb88621,_0xe5f99a){return _0xb88621['define'](_0x4ba3('0xa'),attributes,{'tableName':_0x4ba3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb138=['int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount'];(function(_0x5914da,_0x25bf95){var _0xeb847b=function(_0x1d3aee){while(--_0x1d3aee){_0x5914da['push'](_0x5914da['shift']());}};_0xeb847b(++_0x25bf95);}(_0xb138,0x1dd));var _0x8b13=function(_0x26cd17,_0x1faa73){_0x26cd17=_0x26cd17-0x0;var _0x3f9e21=_0xb138[_0x26cd17];return _0x3f9e21;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x8b13('0xa')]=function(_0x13f7bd,_0x5d51b1){return _0x13f7bd[_0x8b13('0xb')](_0x8b13('0xc'),attributes,{'tableName':_0x8b13('0xd'),'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 ba03a97..d6b1b68 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 _0x3893=['include','map','model','stringify','ShowServicenowAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','ServicenowAccount,\x20%s,\x20%s','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','attributes','limit'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0x3893,0xec));var _0x3389=function(_0x198446,_0x119c8f){_0x198446=_0x198446-0x0;var _0x38d7b7=_0x3893[_0x198446];return _0x38d7b7;};'use strict';var _=require(_0x3389('0x0'));var util=require(_0x3389('0x1'));var moment=require(_0x3389('0x2'));var BPromise=require(_0x3389('0x3'));var rs=require(_0x3389('0x4'));var fs=require('fs');var Redis=require(_0x3389('0x5'));var db=require(_0x3389('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3389('0x7'))(_0x3389('0x8'));var config=require(_0x3389('0x9'));var jayson=require(_0x3389('0xa'));var client=jayson[_0x3389('0xb')][_0x3389('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x37e9c1,_0x16d945,_0x4acb96){return new BPromise(function(_0x4feef1,_0x117462){return client[_0x3389('0xd')](_0x37e9c1,_0x4acb96)[_0x3389('0xe')](function(_0x10581a){logger[_0x3389('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x16d945,_0x3389('0x10'));logger[_0x3389('0x11')](_0x3389('0x12'),_0x16d945,'request\x20sent',JSON['stringify'](_0x10581a));if(_0x10581a[_0x3389('0x13')]){if(_0x10581a[_0x3389('0x13')][_0x3389('0x14')]===0x1f4){logger[_0x3389('0x13')](_0x3389('0x15'),_0x16d945,_0x10581a[_0x3389('0x13')][_0x3389('0x16')]);return _0x117462(_0x10581a['error'][_0x3389('0x16')]);}logger['error'](_0x3389('0x15'),_0x16d945,_0x10581a[_0x3389('0x13')][_0x3389('0x16')]);return _0x4feef1(_0x10581a[_0x3389('0x13')][_0x3389('0x16')]);}else{logger[_0x3389('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x16d945,_0x3389('0x10'));_0x4feef1(_0x10581a['result']['message']);}})[_0x3389('0x17')](function(_0x5e02b9){logger[_0x3389('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x16d945,_0x5e02b9);_0x117462(_0x5e02b9);});});}exports[_0x3389('0x18')]=function(_0x35f671){var _0x461aaa=this;return new Promise(function(_0x25c912,_0x1377c8){return db[_0x3389('0x19')][_0x3389('0x1a')]({'raw':_0x35f671[_0x3389('0x1b')]?_0x35f671['options']['raw']===undefined?!![]:![]:!![],'where':_0x35f671['options']?_0x35f671[_0x3389('0x1b')]['where']||null:null,'attributes':_0x35f671[_0x3389('0x1b')]?_0x35f671['options'][_0x3389('0x1c')]||null:null,'limit':_0x35f671[_0x3389('0x1b')]?_0x35f671[_0x3389('0x1b')][_0x3389('0x1d')]||null:null,'include':_0x35f671[_0x3389('0x1b')]?_0x35f671[_0x3389('0x1b')][_0x3389('0x1e')]?_[_0x3389('0x1f')](_0x35f671[_0x3389('0x1b')][_0x3389('0x1e')],function(_0x182503){return{'model':db[_0x182503[_0x3389('0x20')]],'as':_0x182503['as'],'attributes':_0x182503['attributes'],'include':_0x182503['include']?_['map'](_0x182503[_0x3389('0x1e')],function(_0x3f14de){return{'model':db[_0x3f14de[_0x3389('0x20')]],'as':_0x3f14de['as'],'attributes':_0x3f14de[_0x3389('0x1c')],'include':_0x3f14de['include']?_[_0x3389('0x1f')](_0x3f14de[_0x3389('0x1e')],function(_0x5cb374){return{'model':db[_0x5cb374[_0x3389('0x20')]],'as':_0x5cb374['as'],'attributes':_0x5cb374[_0x3389('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3389('0xe')](function(_0x2a7935){logger[_0x3389('0xf')]('GetServicenowAccount',_0x35f671);logger[_0x3389('0x11')](_0x3389('0x18'),_0x35f671,JSON[_0x3389('0x21')](_0x2a7935));_0x25c912(_0x2a7935);})[_0x3389('0x17')](function(_0x49f936){logger['error']('GetServicenowAccount',_0x49f936[_0x3389('0x16')],_0x35f671);_0x1377c8(_0x461aaa[_0x3389('0x13')](0x1f4,_0x49f936[_0x3389('0x16')]));});});};exports[_0x3389('0x22')]=function(_0x202c64){var _0x4c6662=this;return new Promise(function(_0xc9fdf4,_0x50847f){return db[_0x3389('0x19')][_0x3389('0x23')]({'raw':_0x202c64[_0x3389('0x1b')]?_0x202c64['options'][_0x3389('0x24')]===undefined?!![]:![]:!![],'where':_0x202c64['options']?_0x202c64['options'][_0x3389('0x25')]||null:null,'attributes':_0x202c64[_0x3389('0x1b')]?_0x202c64[_0x3389('0x1b')][_0x3389('0x1c')]||null:null,'include':_0x202c64[_0x3389('0x1b')]?_0x202c64['options'][_0x3389('0x1e')]?_['map'](_0x202c64[_0x3389('0x1b')][_0x3389('0x1e')],function(_0x3b6c0a){return{'model':db[_0x3b6c0a[_0x3389('0x20')]],'as':_0x3b6c0a['as'],'attributes':_0x3b6c0a[_0x3389('0x1c')],'include':_0x3b6c0a['include']?_['map'](_0x3b6c0a[_0x3389('0x1e')],function(_0x1881be){return{'model':db[_0x1881be[_0x3389('0x20')]],'as':_0x1881be['as'],'attributes':_0x1881be[_0x3389('0x1c')],'include':_0x1881be[_0x3389('0x1e')]?_[_0x3389('0x1f')](_0x1881be[_0x3389('0x1e')],function(_0x4028e1){return{'model':db[_0x4028e1['model']],'as':_0x4028e1['as'],'attributes':_0x4028e1[_0x3389('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3389('0xe')](function(_0x1d6efc){logger[_0x3389('0xf')](_0x3389('0x22'),_0x202c64);logger[_0x3389('0x11')](_0x3389('0x22'),_0x202c64,JSON[_0x3389('0x21')](_0x1d6efc));_0xc9fdf4(_0x1d6efc);})[_0x3389('0x17')](function(_0x2fee09){logger[_0x3389('0x13')](_0x3389('0x22'),_0x2fee09[_0x3389('0x16')],_0x202c64);_0x50847f(_0x4c6662[_0x3389('0x13')](0x1f4,_0x2fee09[_0x3389('0x16')]));});});}; \ No newline at end of file +var _0x1815=['catch','ShowServicenowAccount','find','lodash','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','error','code','message','request\x20sent','result','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','limit','map','include','model','then','debug','stringify'];(function(_0x22a75f,_0xf98f1f){var _0x583584=function(_0x48a6cc){while(--_0x48a6cc){_0x22a75f['push'](_0x22a75f['shift']());}};_0x583584(++_0xf98f1f);}(_0x1815,0xa3));var _0x5181=function(_0x18dfc6,_0x54c580){_0x18dfc6=_0x18dfc6-0x0;var _0x5ab7a6=_0x1815[_0x18dfc6];return _0x5ab7a6;};'use strict';var _=require(_0x5181('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5181('0x1'));var fs=require('fs');var Redis=require(_0x5181('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5181('0x3'));var logger=require(_0x5181('0x4'))('rpc');var config=require(_0x5181('0x5'));var jayson=require(_0x5181('0x6'));var client=jayson[_0x5181('0x7')][_0x5181('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2cf135,_0x45406a,_0x4556cb){return new BPromise(function(_0x28d0a7,_0x702ae1){return client[_0x5181('0x9')](_0x2cf135,_0x4556cb)['then'](function(_0x7c101e){logger[_0x5181('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x45406a,'request\x20sent');logger['debug']('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x45406a,'request\x20sent',JSON['stringify'](_0x7c101e));if(_0x7c101e['error']){if(_0x7c101e[_0x5181('0xb')][_0x5181('0xc')]===0x1f4){logger[_0x5181('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x45406a,_0x7c101e[_0x5181('0xb')][_0x5181('0xd')]);return _0x702ae1(_0x7c101e[_0x5181('0xb')][_0x5181('0xd')]);}logger[_0x5181('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x45406a,_0x7c101e['error']['message']);return _0x28d0a7(_0x7c101e[_0x5181('0xb')][_0x5181('0xd')]);}else{logger[_0x5181('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x45406a,_0x5181('0xe'));_0x28d0a7(_0x7c101e[_0x5181('0xf')][_0x5181('0xd')]);}})['catch'](function(_0x5a054b){logger[_0x5181('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x45406a,_0x5a054b);_0x702ae1(_0x5a054b);});});}exports[_0x5181('0x10')]=function(_0x2dc9ca){var _0x44881e=this;return new Promise(function(_0x2a6b2c,_0x370df5){return db[_0x5181('0x11')][_0x5181('0x12')]({'raw':_0x2dc9ca[_0x5181('0x13')]?_0x2dc9ca[_0x5181('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x2dc9ca[_0x5181('0x13')]?_0x2dc9ca[_0x5181('0x13')][_0x5181('0x14')]||null:null,'attributes':_0x2dc9ca['options']?_0x2dc9ca[_0x5181('0x13')][_0x5181('0x15')]||null:null,'limit':_0x2dc9ca['options']?_0x2dc9ca[_0x5181('0x13')][_0x5181('0x16')]||null:null,'include':_0x2dc9ca[_0x5181('0x13')]?_0x2dc9ca['options']['include']?_[_0x5181('0x17')](_0x2dc9ca['options'][_0x5181('0x18')],function(_0x58ea96){return{'model':db[_0x58ea96[_0x5181('0x19')]],'as':_0x58ea96['as'],'attributes':_0x58ea96[_0x5181('0x15')],'include':_0x58ea96[_0x5181('0x18')]?_['map'](_0x58ea96[_0x5181('0x18')],function(_0x10755a){return{'model':db[_0x10755a['model']],'as':_0x10755a['as'],'attributes':_0x10755a[_0x5181('0x15')],'include':_0x10755a[_0x5181('0x18')]?_['map'](_0x10755a['include'],function(_0xca2e7f){return{'model':db[_0xca2e7f[_0x5181('0x19')]],'as':_0xca2e7f['as'],'attributes':_0xca2e7f[_0x5181('0x15')]};}):[]};}):[]};}):[]:[]})[_0x5181('0x1a')](function(_0x1cdfd2){logger[_0x5181('0xa')]('GetServicenowAccount',_0x2dc9ca);logger[_0x5181('0x1b')](_0x5181('0x10'),_0x2dc9ca,JSON[_0x5181('0x1c')](_0x1cdfd2));_0x2a6b2c(_0x1cdfd2);})[_0x5181('0x1d')](function(_0x18ec84){logger['error'](_0x5181('0x10'),_0x18ec84[_0x5181('0xd')],_0x2dc9ca);_0x370df5(_0x44881e[_0x5181('0xb')](0x1f4,_0x18ec84[_0x5181('0xd')]));});});};exports[_0x5181('0x1e')]=function(_0x2f1166){var _0x3dd341=this;return new Promise(function(_0x18e6f8,_0x41d869){return db[_0x5181('0x11')][_0x5181('0x1f')]({'raw':_0x2f1166['options']?_0x2f1166[_0x5181('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x2f1166[_0x5181('0x13')]?_0x2f1166[_0x5181('0x13')][_0x5181('0x14')]||null:null,'attributes':_0x2f1166[_0x5181('0x13')]?_0x2f1166[_0x5181('0x13')]['attributes']||null:null,'include':_0x2f1166[_0x5181('0x13')]?_0x2f1166[_0x5181('0x13')][_0x5181('0x18')]?_['map'](_0x2f1166[_0x5181('0x13')][_0x5181('0x18')],function(_0x2e67c8){return{'model':db[_0x2e67c8[_0x5181('0x19')]],'as':_0x2e67c8['as'],'attributes':_0x2e67c8[_0x5181('0x15')],'include':_0x2e67c8['include']?_['map'](_0x2e67c8[_0x5181('0x18')],function(_0x51d3cd){return{'model':db[_0x51d3cd['model']],'as':_0x51d3cd['as'],'attributes':_0x51d3cd['attributes'],'include':_0x51d3cd[_0x5181('0x18')]?_[_0x5181('0x17')](_0x51d3cd[_0x5181('0x18')],function(_0x15308f){return{'model':db[_0x15308f['model']],'as':_0x15308f['as'],'attributes':_0x15308f[_0x5181('0x15')]};}):[]};}):[]};}):[]:[]})[_0x5181('0x1a')](function(_0x23ddc7){logger[_0x5181('0xa')](_0x5181('0x1e'),_0x2f1166);logger[_0x5181('0x1b')](_0x5181('0x1e'),_0x2f1166,JSON['stringify'](_0x23ddc7));_0x18e6f8(_0x23ddc7);})[_0x5181('0x1d')](function(_0x479745){logger['error'](_0x5181('0x1e'),_0x479745[_0x5181('0xd')],_0x2f1166);_0x41d869(_0x3dd341['error'](0x1f4,_0x479745[_0x5181('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 50a435f..316c139 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 _0xce8d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce8d,0x1c4));var _0xdce8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce8d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdce8('0x0'));var util=require(_0xdce8('0x1'));var path=require(_0xdce8('0x2'));var timeout=require(_0xdce8('0x3'));var express=require(_0xdce8('0x4'));var router=express[_0xdce8('0x5')]();var fs_extra=require(_0xdce8('0x6'));var auth=require(_0xdce8('0x7'));var interaction=require(_0xdce8('0x8'));var config=require('../../config/environment');var controller=require(_0xdce8('0x9'));router[_0xdce8('0xa')]('/',auth[_0xdce8('0xb')](),controller[_0xdce8('0xc')]);router[_0xdce8('0xa')](_0xdce8('0xd'),auth[_0xdce8('0xb')](),controller[_0xdce8('0xe')]);router[_0xdce8('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xdce8('0xf')]);router[_0xdce8('0xa')](_0xdce8('0x10'),auth['isAuthenticated'](),controller[_0xdce8('0x11')]);router[_0xdce8('0xa')](_0xdce8('0x12'),auth[_0xdce8('0xb')](),controller[_0xdce8('0x13')]);router[_0xdce8('0x14')]('/',auth[_0xdce8('0xb')](),controller['create']);router[_0xdce8('0x15')](_0xdce8('0xd'),auth[_0xdce8('0xb')](),controller['update']);router['delete'](_0xdce8('0xd'),auth[_0xdce8('0xb')](),controller[_0xdce8('0x16')]);module[_0xdce8('0x17')]=router; \ No newline at end of file +var _0x0030=['connect-timeout','express','Router','../../components/auth/service','./intServicenowConfiguration.controller','isAuthenticated','get','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','destroy','exports','util','path'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0x0030,0x67));var _0x0003=function(_0x710317,_0x7fabfb){_0x710317=_0x710317-0x0;var _0x153bca=_0x0030[_0x710317];return _0x153bca;};'use strict';var multer=require('multer');var util=require(_0x0003('0x0'));var path=require(_0x0003('0x1'));var timeout=require(_0x0003('0x2'));var express=require(_0x0003('0x3'));var router=express[_0x0003('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0003('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0003('0x6'));router['get']('/',auth[_0x0003('0x7')](),controller['index']);router[_0x0003('0x8')](_0x0003('0x9'),auth[_0x0003('0x7')](),controller['show']);router[_0x0003('0x8')](_0x0003('0xa'),auth[_0x0003('0x7')](),controller[_0x0003('0xb')]);router[_0x0003('0x8')](_0x0003('0xc'),auth[_0x0003('0x7')](),controller[_0x0003('0xd')]);router[_0x0003('0x8')](_0x0003('0xe'),auth['isAuthenticated'](),controller[_0x0003('0xf')]);router[_0x0003('0x10')]('/',auth[_0x0003('0x7')](),controller[_0x0003('0x11')]);router['put'](_0x0003('0x9'),auth['isAuthenticated'](),controller[_0x0003('0x12')]);router['delete']('/:id',auth[_0x0003('0x7')](),controller[_0x0003('0x13')]);module[_0x0003('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 1c27f8f..dc7c98a 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 _0xd9af=['exports','STRING'];(function(_0x2a120b,_0x52933c){var _0x29495f=function(_0x107178){while(--_0x107178){_0x2a120b['push'](_0x2a120b['shift']());}};_0x29495f(++_0x52933c);}(_0xd9af,0x16a));var _0xfd9a=function(_0x15dd83,_0x78f21e){_0x15dd83=_0x15dd83-0x0;var _0x4fcf74=_0xd9af[_0x15dd83];return _0x4fcf74;};'use strict';var Sequelize=require('sequelize');module[_0xfd9a('0x0')]={'name':{'type':Sequelize[_0xfd9a('0x1')]},'description':{'type':Sequelize[_0xfd9a('0x1')]}}; \ No newline at end of file +var _0x9fb4=['sequelize','STRING'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0x9fb4,0x11e));var _0x49fb=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0x9fb4[_0x3a0863];return _0x85c557;};'use strict';var Sequelize=require(_0x49fb('0x0'));module['exports']={'name':{'type':Sequelize[_0x49fb('0x1')]},'description':{'type':Sequelize[_0x49fb('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 11c7f99..3280cb8 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 _0x7a63=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','key','model','query','keys','attributes','fields','length','order','sort','where','filters','filter','merge','type','VIRTUAL','include','findAll','catch','intersection','includeAll','options','find','create','body','params','getFields','findOne','ServicenowField','pick','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x2e9048,_0xf79fcd){var _0x305e49=function(_0x256b88){while(--_0x256b88){_0x2e9048['push'](_0x2e9048['shift']());}};_0x305e49(++_0xf79fcd);}(_0x7a63,0x1ef));var _0x37a6=function(_0x399388,_0x378aeb){_0x399388=_0x399388-0x0;var _0x41b8a2=_0x7a63[_0x399388];return _0x41b8a2;};'use strict';var emlformat=require(_0x37a6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x37a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x37a6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x37a6('0x3'));var util=require('util');var path=require(_0x37a6('0x4'));var sox=require(_0x37a6('0x5'));var csv=require('to-csv');var ejs=require(_0x37a6('0x6'));var fs=require('fs');var fs_extra=require(_0x37a6('0x7'));var _=require(_0x37a6('0x8'));var squel=require(_0x37a6('0x9'));var crypto=require(_0x37a6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x37a6('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x37a6('0xc'));var authService=require(_0x37a6('0xd'));var qs=require(_0x37a6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37a6('0xf'));var logger=require(_0x37a6('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x37a6('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x37a6('0x12'))['db'];function respondWithStatusCode(_0xe62476,_0x92a0ba){_0x92a0ba=_0x92a0ba||0xcc;return function(_0xff8d28){if(_0xff8d28){return _0xe62476[_0x37a6('0x13')](_0x92a0ba);}return _0xe62476[_0x37a6('0x14')](_0x92a0ba)[_0x37a6('0x15')]();};}function respondWithResult(_0x1efea8,_0x2246c4){_0x2246c4=_0x2246c4||0xc8;return function(_0x418d83){if(_0x418d83){return _0x1efea8['status'](_0x2246c4)[_0x37a6('0x16')](_0x418d83);}};}function respondWithFilteredResult(_0x3a9dc2,_0x1cbbba){return function(_0x11b1aa){if(_0x11b1aa){var _0x5c06d3=typeof _0x1cbbba[_0x37a6('0x17')]===_0x37a6('0x18')&&typeof _0x1cbbba[_0x37a6('0x19')]===_0x37a6('0x18');var _0x40b360=_0x11b1aa[_0x37a6('0x1a')];var _0x43ac8=_0x5c06d3?0x0:_0x1cbbba[_0x37a6('0x17')];var _0x2c2d23=_0x5c06d3?_0x11b1aa['count']:_0x1cbbba['offset']+_0x1cbbba[_0x37a6('0x19')];var _0x167703;if(_0x2c2d23>=_0x40b360){_0x2c2d23=_0x40b360;_0x167703=0xc8;}else{_0x167703=0xce;}_0x3a9dc2[_0x37a6('0x14')](_0x167703);return _0x3a9dc2[_0x37a6('0x1b')](_0x37a6('0x1c'),_0x43ac8+'-'+_0x2c2d23+'/'+_0x40b360)[_0x37a6('0x16')](_0x11b1aa);}return null;};}function patchUpdates(_0x4bce74){return function(_0x50a9d3){try{jsonpatch[_0x37a6('0x1d')](_0x50a9d3,_0x4bce74,!![]);}catch(_0x1d048d){return BPromise[_0x37a6('0x1e')](_0x1d048d);}return _0x50a9d3[_0x37a6('0x1f')]();};}function saveUpdates(_0x12345a,_0x14d6ef){return function(_0x3ef1c1){if(_0x3ef1c1){return _0x3ef1c1['update'](_0x12345a)[_0x37a6('0x20')](function(_0x3ac327){return _0x3ac327;});}return null;};}function removeEntity(_0x5ba763,_0x250398){return function(_0xe9cb79){if(_0xe9cb79){return _0xe9cb79[_0x37a6('0x21')]()[_0x37a6('0x20')](function(){_0x5ba763[_0x37a6('0x14')](0xcc)[_0x37a6('0x15')]();});}};}function handleEntityNotFound(_0x2e353d,_0x329469){return function(_0x5322ce){if(!_0x5322ce){_0x2e353d[_0x37a6('0x13')](0x194);}return _0x5322ce;};}function handleError(_0x20cb0a,_0x4cb88b){_0x4cb88b=_0x4cb88b||0x1f4;return function(_0x45998e){logger['error'](_0x45998e[_0x37a6('0x22')]);if(_0x45998e[_0x37a6('0x23')]){delete _0x45998e[_0x37a6('0x23')];}_0x20cb0a['status'](_0x4cb88b)[_0x37a6('0x24')](_0x45998e);};}exports[_0x37a6('0x25')]=function(_0x46e759,_0x3d1894){var _0x4d5b39={},_0xa70ddb={},_0x221476={'count':0x0,'rows':[]};var _0x4784fe=_[_0x37a6('0x26')](db[_0x37a6('0x27')][_0x37a6('0x28')],function(_0x6bc672){return{'name':_0x6bc672['fieldName'],'type':_0x6bc672['type'][_0x37a6('0x29')]};});_0xa70ddb[_0x37a6('0x2a')]=_[_0x37a6('0x26')](_0x4784fe,_0x37a6('0x23'));_0xa70ddb[_0x37a6('0x2b')]=_[_0x37a6('0x2c')](_0x46e759['query']);_0xa70ddb['filters']=_['intersection'](_0xa70ddb[_0x37a6('0x2a')],_0xa70ddb['query']);_0x4d5b39[_0x37a6('0x2d')]=_['intersection'](_0xa70ddb[_0x37a6('0x2a')],qs[_0x37a6('0x2e')](_0x46e759['query'][_0x37a6('0x2e')]));_0x4d5b39[_0x37a6('0x2d')]=_0x4d5b39[_0x37a6('0x2d')][_0x37a6('0x2f')]?_0x4d5b39[_0x37a6('0x2d')]:_0xa70ddb['model'];if(!_0x46e759[_0x37a6('0x2b')]['hasOwnProperty']('nolimit')){_0x4d5b39['limit']=qs[_0x37a6('0x19')](_0x46e759['query'][_0x37a6('0x19')]);_0x4d5b39[_0x37a6('0x17')]=qs[_0x37a6('0x17')](_0x46e759['query'][_0x37a6('0x17')]);}_0x4d5b39[_0x37a6('0x30')]=qs[_0x37a6('0x31')](_0x46e759['query']['sort']);_0x4d5b39[_0x37a6('0x32')]=qs[_0x37a6('0x33')](_['pick'](_0x46e759[_0x37a6('0x2b')],_0xa70ddb[_0x37a6('0x33')]),_0x4784fe);if(_0x46e759[_0x37a6('0x2b')][_0x37a6('0x34')]){_0x4d5b39[_0x37a6('0x32')]=_[_0x37a6('0x35')](_0x4d5b39[_0x37a6('0x32')],{'$or':_['map'](_0x4784fe,function(_0x1ffb9a){if(_0x1ffb9a[_0x37a6('0x36')]!==_0x37a6('0x37')){var _0xa90190={};_0xa90190[_0x1ffb9a[_0x37a6('0x23')]]={'$like':'%'+_0x46e759['query']['filter']+'%'};return _0xa90190;}})});}_0x4d5b39=_[_0x37a6('0x35')]({},_0x4d5b39,_0x46e759['options']);var _0x51d6ff={'where':_0x4d5b39[_0x37a6('0x32')]};return db['ServicenowConfiguration'][_0x37a6('0x1a')](_0x51d6ff)[_0x37a6('0x20')](function(_0x320420){_0x221476['count']=_0x320420;if(_0x46e759[_0x37a6('0x2b')]['includeAll']){_0x4d5b39[_0x37a6('0x38')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x37a6('0x39')](_0x4d5b39);})['then'](function(_0x11f3b7){_0x221476['rows']=_0x11f3b7;return _0x221476;})[_0x37a6('0x20')](respondWithFilteredResult(_0x3d1894,_0x4d5b39))[_0x37a6('0x3a')](handleError(_0x3d1894,null));};exports['show']=function(_0x6bed23,_0xbebd1f){var _0xd2e28e={'raw':![],'where':{'id':_0x6bed23['params']['id']}},_0x1d3336={};_0x1d3336[_0x37a6('0x2a')]=_[_0x37a6('0x2c')](db[_0x37a6('0x27')][_0x37a6('0x28')]);_0x1d3336[_0x37a6('0x2b')]=_['keys'](_0x6bed23['query']);_0x1d3336[_0x37a6('0x33')]=_[_0x37a6('0x3b')](_0x1d3336[_0x37a6('0x2a')],_0x1d3336[_0x37a6('0x2b')]);_0xd2e28e[_0x37a6('0x2d')]=_[_0x37a6('0x3b')](_0x1d3336['model'],qs[_0x37a6('0x2e')](_0x6bed23[_0x37a6('0x2b')]['fields']));_0xd2e28e[_0x37a6('0x2d')]=_0xd2e28e[_0x37a6('0x2d')][_0x37a6('0x2f')]?_0xd2e28e['attributes']:_0x1d3336[_0x37a6('0x2a')];if(_0x6bed23[_0x37a6('0x2b')][_0x37a6('0x3c')]){_0xd2e28e[_0x37a6('0x38')]=[{'all':!![]}];}_0xd2e28e=_[_0x37a6('0x35')]({},_0xd2e28e,_0x6bed23[_0x37a6('0x3d')]);return db['ServicenowConfiguration'][_0x37a6('0x3e')](_0xd2e28e)[_0x37a6('0x20')](handleEntityNotFound(_0xbebd1f,null))[_0x37a6('0x20')](respondWithResult(_0xbebd1f,null))[_0x37a6('0x3a')](handleError(_0xbebd1f,null));};exports[_0x37a6('0x3f')]=function(_0x25b4a6,_0xce9678){return db[_0x37a6('0x27')][_0x37a6('0x3f')](_0x25b4a6[_0x37a6('0x40')],{})[_0x37a6('0x20')](respondWithResult(_0xce9678,0xc9))[_0x37a6('0x3a')](handleError(_0xce9678,null));};exports['update']=function(_0x1ece79,_0x4a391c){if(_0x1ece79[_0x37a6('0x40')]['id']){delete _0x1ece79[_0x37a6('0x40')]['id'];}return db[_0x37a6('0x27')]['find']({'where':{'id':_0x1ece79[_0x37a6('0x41')]['id']}})['then'](handleEntityNotFound(_0x4a391c,null))['then'](saveUpdates(_0x1ece79['body'],null))['then'](respondWithResult(_0x4a391c,null))[_0x37a6('0x3a')](handleError(_0x4a391c,null));};exports['destroy']=function(_0x5b65bc,_0x5a1f78){return db[_0x37a6('0x27')][_0x37a6('0x3e')]({'where':{'id':_0x5b65bc['params']['id']}})[_0x37a6('0x20')](handleEntityNotFound(_0x5a1f78,null))[_0x37a6('0x20')](removeEntity(_0x5a1f78,null))[_0x37a6('0x3a')](handleError(_0x5a1f78,null));};exports[_0x37a6('0x42')]=function(_0x22f16e,_0x5396b8,_0x2e1e15){var _0x4ee291={};var _0x385166={};var _0x502324;var _0x1237ac;return db[_0x37a6('0x27')][_0x37a6('0x43')]({'where':{'id':_0x22f16e['params']['id']}})[_0x37a6('0x20')](handleEntityNotFound(_0x5396b8,null))['then'](function(_0xd2134d){if(_0xd2134d){_0x502324=_0xd2134d;_0x385166[_0x37a6('0x2a')]=_[_0x37a6('0x2c')](db[_0x37a6('0x44')]['rawAttributes']);_0x385166[_0x37a6('0x2b')]=_['keys'](_0x22f16e[_0x37a6('0x2b')]);_0x385166[_0x37a6('0x33')]=_[_0x37a6('0x3b')](_0x385166[_0x37a6('0x2a')],_0x385166['query']);_0x4ee291[_0x37a6('0x2d')]=_[_0x37a6('0x3b')](_0x385166['model'],qs['fields'](_0x22f16e[_0x37a6('0x2b')]['fields']));_0x4ee291[_0x37a6('0x2d')]=_0x4ee291[_0x37a6('0x2d')]['length']?_0x4ee291[_0x37a6('0x2d')]:_0x385166[_0x37a6('0x2a')];_0x4ee291['order']=qs[_0x37a6('0x31')](_0x22f16e['query'][_0x37a6('0x31')]);_0x4ee291[_0x37a6('0x32')]=qs[_0x37a6('0x33')](_[_0x37a6('0x45')](_0x22f16e[_0x37a6('0x2b')],_0x385166['filters']));if(_0x22f16e[_0x37a6('0x2b')][_0x37a6('0x34')]){_0x4ee291['where']=_[_0x37a6('0x35')](_0x4ee291[_0x37a6('0x32')],{'$or':_['map'](_0x4ee291[_0x37a6('0x2d')],function(_0x41f3b9){var _0x465870={};_0x465870[_0x41f3b9]={'$like':'%'+_0x22f16e['query'][_0x37a6('0x34')]+'%'};return _0x465870;})});}_0x4ee291=_[_0x37a6('0x35')]({},_0x4ee291,_0x22f16e[_0x37a6('0x3d')]);return _0x502324[_0x37a6('0x42')](_0x4ee291);}})[_0x37a6('0x20')](function(_0x5e1570){if(_0x5e1570){_0x1237ac=_0x5e1570['length'];if(!_0x22f16e['query'][_0x37a6('0x46')](_0x37a6('0x47'))){_0x4ee291[_0x37a6('0x19')]=qs[_0x37a6('0x19')](_0x22f16e[_0x37a6('0x2b')][_0x37a6('0x19')]);_0x4ee291['offset']=qs[_0x37a6('0x17')](_0x22f16e['query'][_0x37a6('0x17')]);}return _0x502324['getFields'](_0x4ee291);}})[_0x37a6('0x20')](function(_0x329c77){if(_0x329c77){return _0x329c77?{'count':_0x1237ac,'rows':_0x329c77}:null;}})[_0x37a6('0x20')](respondWithResult(_0x5396b8,null))[_0x37a6('0x3a')](handleError(_0x5396b8,null));};exports[_0x37a6('0x48')]=function(_0x3cd376,_0x408681,_0x5169b3){var _0x51d642={};var _0x17c29f={};var _0x2e803e;var _0x3e5efb;return db[_0x37a6('0x27')][_0x37a6('0x43')]({'where':{'id':_0x3cd376[_0x37a6('0x41')]['id']}})[_0x37a6('0x20')](handleEntityNotFound(_0x408681,null))['then'](function(_0x3672d3){if(_0x3672d3){_0x2e803e=_0x3672d3;_0x17c29f['model']=_[_0x37a6('0x2c')](db['ServicenowField'][_0x37a6('0x28')]);_0x17c29f[_0x37a6('0x2b')]=_['keys'](_0x3cd376[_0x37a6('0x2b')]);_0x17c29f['filters']=_[_0x37a6('0x3b')](_0x17c29f[_0x37a6('0x2a')],_0x17c29f[_0x37a6('0x2b')]);_0x51d642[_0x37a6('0x2d')]=_[_0x37a6('0x3b')](_0x17c29f[_0x37a6('0x2a')],qs[_0x37a6('0x2e')](_0x3cd376['query'][_0x37a6('0x2e')]));_0x51d642[_0x37a6('0x2d')]=_0x51d642[_0x37a6('0x2d')]['length']?_0x51d642[_0x37a6('0x2d')]:_0x17c29f[_0x37a6('0x2a')];_0x51d642[_0x37a6('0x30')]=qs[_0x37a6('0x31')](_0x3cd376[_0x37a6('0x2b')][_0x37a6('0x31')]);_0x51d642[_0x37a6('0x32')]=qs['filters'](_['pick'](_0x3cd376['query'],_0x17c29f['filters']));if(_0x3cd376['query'][_0x37a6('0x34')]){_0x51d642[_0x37a6('0x32')]=_[_0x37a6('0x35')](_0x51d642[_0x37a6('0x32')],{'$or':_[_0x37a6('0x26')](_0x51d642[_0x37a6('0x2d')],function(_0x33025d){var _0x4c7ea8={};_0x4c7ea8[_0x33025d]={'$like':'%'+_0x3cd376['query'][_0x37a6('0x34')]+'%'};return _0x4c7ea8;})});}_0x51d642=_[_0x37a6('0x35')]({},_0x51d642,_0x3cd376[_0x37a6('0x3d')]);return _0x2e803e[_0x37a6('0x48')](_0x51d642);}})[_0x37a6('0x20')](function(_0xf29fc4){if(_0xf29fc4){_0x3e5efb=_0xf29fc4[_0x37a6('0x2f')];if(!_0x3cd376[_0x37a6('0x2b')][_0x37a6('0x46')]('nolimit')){_0x51d642['limit']=qs[_0x37a6('0x19')](_0x3cd376['query']['limit']);_0x51d642[_0x37a6('0x17')]=qs[_0x37a6('0x17')](_0x3cd376[_0x37a6('0x2b')]['offset']);}return _0x2e803e[_0x37a6('0x48')](_0x51d642);}})[_0x37a6('0x20')](function(_0x3ab545){if(_0x3ab545){return _0x3ab545?{'count':_0x3e5efb,'rows':_0x3ab545}:null;}})[_0x37a6('0x20')](respondWithResult(_0x408681,null))['catch'](handleError(_0x408681,null));};exports[_0x37a6('0x49')]=function(_0x4112ee,_0x4926d7,_0x207006){var _0x29e736={};var _0x2d391b={};var _0x2be407;var _0x1b52fb;return db[_0x37a6('0x27')][_0x37a6('0x43')]({'where':{'id':_0x4112ee[_0x37a6('0x41')]['id']}})['then'](handleEntityNotFound(_0x4926d7,null))[_0x37a6('0x20')](function(_0x1e2eb3){if(_0x1e2eb3){_0x2be407=_0x1e2eb3;_0x2d391b[_0x37a6('0x2a')]=_[_0x37a6('0x2c')](db[_0x37a6('0x44')]['rawAttributes']);_0x2d391b['query']=_[_0x37a6('0x2c')](_0x4112ee['query']);_0x2d391b[_0x37a6('0x33')]=_[_0x37a6('0x3b')](_0x2d391b[_0x37a6('0x2a')],_0x2d391b[_0x37a6('0x2b')]);_0x29e736[_0x37a6('0x2d')]=_[_0x37a6('0x3b')](_0x2d391b['model'],qs[_0x37a6('0x2e')](_0x4112ee[_0x37a6('0x2b')][_0x37a6('0x2e')]));_0x29e736['attributes']=_0x29e736[_0x37a6('0x2d')][_0x37a6('0x2f')]?_0x29e736[_0x37a6('0x2d')]:_0x2d391b['model'];_0x29e736['order']=qs['sort'](_0x4112ee[_0x37a6('0x2b')][_0x37a6('0x31')]);_0x29e736[_0x37a6('0x32')]=qs[_0x37a6('0x33')](_[_0x37a6('0x45')](_0x4112ee[_0x37a6('0x2b')],_0x2d391b['filters']));if(_0x4112ee['query'][_0x37a6('0x34')]){_0x29e736[_0x37a6('0x32')]=_[_0x37a6('0x35')](_0x29e736[_0x37a6('0x32')],{'$or':_[_0x37a6('0x26')](_0x29e736[_0x37a6('0x2d')],function(_0xb38062){var _0x22cff8={};_0x22cff8[_0xb38062]={'$like':'%'+_0x4112ee['query'][_0x37a6('0x34')]+'%'};return _0x22cff8;})});}_0x29e736=_[_0x37a6('0x35')]({},_0x29e736,_0x4112ee[_0x37a6('0x3d')]);return _0x2be407[_0x37a6('0x49')](_0x29e736);}})['then'](function(_0x5a12c2){if(_0x5a12c2){_0x1b52fb=_0x5a12c2['length'];if(!_0x4112ee['query']['hasOwnProperty'](_0x37a6('0x47'))){_0x29e736[_0x37a6('0x19')]=qs[_0x37a6('0x19')](_0x4112ee['query'][_0x37a6('0x19')]);_0x29e736['offset']=qs[_0x37a6('0x17')](_0x4112ee[_0x37a6('0x2b')][_0x37a6('0x17')]);}return _0x2be407['getDescriptions'](_0x29e736);}})[_0x37a6('0x20')](function(_0xb59aa9){if(_0xb59aa9){return _0xb59aa9?{'count':_0x1b52fb,'rows':_0xb59aa9}:null;}})[_0x37a6('0x20')](respondWithResult(_0x4926d7,null))[_0x37a6('0x3a')](handleError(_0x4926d7,null));}; \ No newline at end of file +var _0x2cd8=['body','update','findOne','ServicenowField','getFields','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','map','ServicenowConfiguration','fieldName','type','query','filters','intersection','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','keys','fields','includeAll','find','create'];(function(_0x51ff6c,_0x46a844){var _0x508e6b=function(_0x1319cb){while(--_0x1319cb){_0x51ff6c['push'](_0x51ff6c['shift']());}};_0x508e6b(++_0x46a844);}(_0x2cd8,0xad));var _0x82cd=function(_0xb28fa8,_0x3e67bb){_0xb28fa8=_0xb28fa8-0x0;var _0x7d8294=_0x2cd8[_0xb28fa8];return _0x7d8294;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82cd('0x0'));var zipdir=require(_0x82cd('0x1'));var jsonpatch=require(_0x82cd('0x2'));var rp=require(_0x82cd('0x3'));var moment=require(_0x82cd('0x4'));var BPromise=require(_0x82cd('0x5'));var Mustache=require(_0x82cd('0x6'));var util=require(_0x82cd('0x7'));var path=require(_0x82cd('0x8'));var sox=require(_0x82cd('0x9'));var csv=require(_0x82cd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x82cd('0xb'));var _=require(_0x82cd('0xc'));var squel=require('squel');var crypto=require(_0x82cd('0xd'));var jsforce=require(_0x82cd('0xe'));var deskjs=require(_0x82cd('0xf'));var toCsv=require(_0x82cd('0xa'));var querystring=require('querystring');var Papa=require(_0x82cd('0x10'));var Redis=require('ioredis');var authService=require(_0x82cd('0x11'));var qs=require(_0x82cd('0x12'));var as=require(_0x82cd('0x13'));var hardwareService=require(_0x82cd('0x14'));var logger=require(_0x82cd('0x15'))(_0x82cd('0x16'));var utils=require(_0x82cd('0x17'));var config=require(_0x82cd('0x18'));var licenseUtil=require(_0x82cd('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25fe35,_0x27afb3){_0x27afb3=_0x27afb3||0xcc;return function(_0x4a7e5e){if(_0x4a7e5e){return _0x25fe35[_0x82cd('0x1a')](_0x27afb3);}return _0x25fe35[_0x82cd('0x1b')](_0x27afb3)[_0x82cd('0x1c')]();};}function respondWithResult(_0x3aba12,_0x5ebf03){_0x5ebf03=_0x5ebf03||0xc8;return function(_0x396e68){if(_0x396e68){return _0x3aba12[_0x82cd('0x1b')](_0x5ebf03)['json'](_0x396e68);}};}function respondWithFilteredResult(_0x420fd6,_0x3c24c8){return function(_0x5c66ba){if(_0x5c66ba){var _0x547476=typeof _0x3c24c8['offset']==='undefined'&&typeof _0x3c24c8[_0x82cd('0x1d')]===_0x82cd('0x1e');var _0xc17f12=_0x5c66ba[_0x82cd('0x1f')];var _0x253096=_0x547476?0x0:_0x3c24c8[_0x82cd('0x20')];var _0x5eda35=_0x547476?_0x5c66ba[_0x82cd('0x1f')]:_0x3c24c8[_0x82cd('0x20')]+_0x3c24c8[_0x82cd('0x1d')];var _0x1d3ef0;if(_0x5eda35>=_0xc17f12){_0x5eda35=_0xc17f12;_0x1d3ef0=0xc8;}else{_0x1d3ef0=0xce;}_0x420fd6['status'](_0x1d3ef0);return _0x420fd6[_0x82cd('0x21')](_0x82cd('0x22'),_0x253096+'-'+_0x5eda35+'/'+_0xc17f12)[_0x82cd('0x23')](_0x5c66ba);}return null;};}function patchUpdates(_0x3cb185){return function(_0x365034){try{jsonpatch['apply'](_0x365034,_0x3cb185,!![]);}catch(_0x591a1d){return BPromise[_0x82cd('0x24')](_0x591a1d);}return _0x365034[_0x82cd('0x25')]();};}function saveUpdates(_0x429228,_0x3efd76){return function(_0x59447e){if(_0x59447e){return _0x59447e['update'](_0x429228)[_0x82cd('0x26')](function(_0x52a9d0){return _0x52a9d0;});}return null;};}function removeEntity(_0x440edd,_0x1cf48c){return function(_0x52289c){if(_0x52289c){return _0x52289c[_0x82cd('0x27')]()[_0x82cd('0x26')](function(){_0x440edd[_0x82cd('0x1b')](0xcc)[_0x82cd('0x1c')]();});}};}function handleEntityNotFound(_0x5222f,_0x11aa0c){return function(_0x5a16cc){if(!_0x5a16cc){_0x5222f[_0x82cd('0x1a')](0x194);}return _0x5a16cc;};}function handleError(_0x6cfdc7,_0x2b32c1){_0x2b32c1=_0x2b32c1||0x1f4;return function(_0xec1722){logger[_0x82cd('0x28')](_0xec1722[_0x82cd('0x29')]);if(_0xec1722['name']){delete _0xec1722[_0x82cd('0x2a')];}_0x6cfdc7['status'](_0x2b32c1)[_0x82cd('0x2b')](_0xec1722);};}exports['index']=function(_0x841adf,_0x487ba5){var _0x4ea0f7={},_0x5ab78b={},_0x76c246={'count':0x0,'rows':[]};var _0x2e78e9=_[_0x82cd('0x2c')](db[_0x82cd('0x2d')]['rawAttributes'],function(_0x480bc9){return{'name':_0x480bc9[_0x82cd('0x2e')],'type':_0x480bc9[_0x82cd('0x2f')]['key']};});_0x5ab78b['model']=_[_0x82cd('0x2c')](_0x2e78e9,_0x82cd('0x2a'));_0x5ab78b[_0x82cd('0x30')]=_['keys'](_0x841adf[_0x82cd('0x30')]);_0x5ab78b[_0x82cd('0x31')]=_[_0x82cd('0x32')](_0x5ab78b['model'],_0x5ab78b[_0x82cd('0x30')]);_0x4ea0f7[_0x82cd('0x33')]=_[_0x82cd('0x32')](_0x5ab78b['model'],qs['fields'](_0x841adf[_0x82cd('0x30')]['fields']));_0x4ea0f7['attributes']=_0x4ea0f7[_0x82cd('0x33')][_0x82cd('0x34')]?_0x4ea0f7[_0x82cd('0x33')]:_0x5ab78b[_0x82cd('0x35')];if(!_0x841adf[_0x82cd('0x30')][_0x82cd('0x36')](_0x82cd('0x37'))){_0x4ea0f7[_0x82cd('0x1d')]=qs[_0x82cd('0x1d')](_0x841adf['query'][_0x82cd('0x1d')]);_0x4ea0f7['offset']=qs[_0x82cd('0x20')](_0x841adf[_0x82cd('0x30')]['offset']);}_0x4ea0f7[_0x82cd('0x38')]=qs[_0x82cd('0x39')](_0x841adf[_0x82cd('0x30')]['sort']);_0x4ea0f7[_0x82cd('0x3a')]=qs[_0x82cd('0x31')](_[_0x82cd('0x3b')](_0x841adf[_0x82cd('0x30')],_0x5ab78b['filters']),_0x2e78e9);if(_0x841adf['query'][_0x82cd('0x3c')]){_0x4ea0f7['where']=_[_0x82cd('0x3d')](_0x4ea0f7[_0x82cd('0x3a')],{'$or':_[_0x82cd('0x2c')](_0x2e78e9,function(_0x334362){if(_0x334362[_0x82cd('0x2f')]!==_0x82cd('0x3e')){var _0x5248a6={};_0x5248a6[_0x334362[_0x82cd('0x2a')]]={'$like':'%'+_0x841adf[_0x82cd('0x30')]['filter']+'%'};return _0x5248a6;}})});}_0x4ea0f7=_[_0x82cd('0x3d')]({},_0x4ea0f7,_0x841adf[_0x82cd('0x3f')]);var _0x247989={'where':_0x4ea0f7[_0x82cd('0x3a')]};return db[_0x82cd('0x2d')][_0x82cd('0x1f')](_0x247989)[_0x82cd('0x26')](function(_0x1da2cf){_0x76c246[_0x82cd('0x1f')]=_0x1da2cf;if(_0x841adf[_0x82cd('0x30')]['includeAll']){_0x4ea0f7[_0x82cd('0x40')]=[{'all':!![]}];}return db[_0x82cd('0x2d')][_0x82cd('0x41')](_0x4ea0f7);})[_0x82cd('0x26')](function(_0x3200e7){_0x76c246[_0x82cd('0x42')]=_0x3200e7;return _0x76c246;})[_0x82cd('0x26')](respondWithFilteredResult(_0x487ba5,_0x4ea0f7))[_0x82cd('0x43')](handleError(_0x487ba5,null));};exports[_0x82cd('0x44')]=function(_0x2ecb01,_0x415665){var _0x37687c={'raw':![],'where':{'id':_0x2ecb01[_0x82cd('0x45')]['id']}},_0x1b8e35={};_0x1b8e35['model']=_['keys'](db[_0x82cd('0x2d')][_0x82cd('0x46')]);_0x1b8e35[_0x82cd('0x30')]=_[_0x82cd('0x47')](_0x2ecb01[_0x82cd('0x30')]);_0x1b8e35[_0x82cd('0x31')]=_[_0x82cd('0x32')](_0x1b8e35[_0x82cd('0x35')],_0x1b8e35[_0x82cd('0x30')]);_0x37687c[_0x82cd('0x33')]=_['intersection'](_0x1b8e35[_0x82cd('0x35')],qs[_0x82cd('0x48')](_0x2ecb01[_0x82cd('0x30')][_0x82cd('0x48')]));_0x37687c[_0x82cd('0x33')]=_0x37687c['attributes']['length']?_0x37687c[_0x82cd('0x33')]:_0x1b8e35[_0x82cd('0x35')];if(_0x2ecb01[_0x82cd('0x30')][_0x82cd('0x49')]){_0x37687c[_0x82cd('0x40')]=[{'all':!![]}];}_0x37687c=_[_0x82cd('0x3d')]({},_0x37687c,_0x2ecb01[_0x82cd('0x3f')]);return db[_0x82cd('0x2d')][_0x82cd('0x4a')](_0x37687c)[_0x82cd('0x26')](handleEntityNotFound(_0x415665,null))['then'](respondWithResult(_0x415665,null))[_0x82cd('0x43')](handleError(_0x415665,null));};exports['create']=function(_0x1ffc36,_0x4df1f3){return db['ServicenowConfiguration'][_0x82cd('0x4b')](_0x1ffc36[_0x82cd('0x4c')],{})[_0x82cd('0x26')](respondWithResult(_0x4df1f3,0xc9))[_0x82cd('0x43')](handleError(_0x4df1f3,null));};exports[_0x82cd('0x4d')]=function(_0x32652b,_0x26a0b1){if(_0x32652b[_0x82cd('0x4c')]['id']){delete _0x32652b['body']['id'];}return db[_0x82cd('0x2d')][_0x82cd('0x4a')]({'where':{'id':_0x32652b[_0x82cd('0x45')]['id']}})['then'](handleEntityNotFound(_0x26a0b1,null))['then'](saveUpdates(_0x32652b[_0x82cd('0x4c')],null))['then'](respondWithResult(_0x26a0b1,null))[_0x82cd('0x43')](handleError(_0x26a0b1,null));};exports[_0x82cd('0x27')]=function(_0x33f914,_0x1c17cc){return db[_0x82cd('0x2d')][_0x82cd('0x4a')]({'where':{'id':_0x33f914[_0x82cd('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c17cc,null))[_0x82cd('0x26')](removeEntity(_0x1c17cc,null))[_0x82cd('0x43')](handleError(_0x1c17cc,null));};exports['getFields']=function(_0x55a47c,_0x33d139,_0x4aef3f){var _0x53bebc={};var _0x318e10={};var _0x2f5afa;var _0x535cc0;return db[_0x82cd('0x2d')][_0x82cd('0x4e')]({'where':{'id':_0x55a47c[_0x82cd('0x45')]['id']}})['then'](handleEntityNotFound(_0x33d139,null))[_0x82cd('0x26')](function(_0x871ac6){if(_0x871ac6){_0x2f5afa=_0x871ac6;_0x318e10[_0x82cd('0x35')]=_[_0x82cd('0x47')](db[_0x82cd('0x4f')][_0x82cd('0x46')]);_0x318e10[_0x82cd('0x30')]=_[_0x82cd('0x47')](_0x55a47c[_0x82cd('0x30')]);_0x318e10['filters']=_[_0x82cd('0x32')](_0x318e10[_0x82cd('0x35')],_0x318e10['query']);_0x53bebc[_0x82cd('0x33')]=_[_0x82cd('0x32')](_0x318e10['model'],qs['fields'](_0x55a47c['query'][_0x82cd('0x48')]));_0x53bebc['attributes']=_0x53bebc[_0x82cd('0x33')][_0x82cd('0x34')]?_0x53bebc['attributes']:_0x318e10[_0x82cd('0x35')];_0x53bebc['order']=qs[_0x82cd('0x39')](_0x55a47c[_0x82cd('0x30')]['sort']);_0x53bebc['where']=qs[_0x82cd('0x31')](_[_0x82cd('0x3b')](_0x55a47c['query'],_0x318e10[_0x82cd('0x31')]));if(_0x55a47c[_0x82cd('0x30')][_0x82cd('0x3c')]){_0x53bebc[_0x82cd('0x3a')]=_[_0x82cd('0x3d')](_0x53bebc[_0x82cd('0x3a')],{'$or':_[_0x82cd('0x2c')](_0x53bebc[_0x82cd('0x33')],function(_0x16b687){var _0x3ad860={};_0x3ad860[_0x16b687]={'$like':'%'+_0x55a47c['query'][_0x82cd('0x3c')]+'%'};return _0x3ad860;})});}_0x53bebc=_[_0x82cd('0x3d')]({},_0x53bebc,_0x55a47c['options']);return _0x2f5afa[_0x82cd('0x50')](_0x53bebc);}})['then'](function(_0x5508d1){if(_0x5508d1){_0x535cc0=_0x5508d1[_0x82cd('0x34')];if(!_0x55a47c[_0x82cd('0x30')]['hasOwnProperty'](_0x82cd('0x37'))){_0x53bebc['limit']=qs[_0x82cd('0x1d')](_0x55a47c['query'][_0x82cd('0x1d')]);_0x53bebc[_0x82cd('0x20')]=qs[_0x82cd('0x20')](_0x55a47c[_0x82cd('0x30')][_0x82cd('0x20')]);}return _0x2f5afa['getFields'](_0x53bebc);}})[_0x82cd('0x26')](function(_0x5144c6){if(_0x5144c6){return _0x5144c6?{'count':_0x535cc0,'rows':_0x5144c6}:null;}})[_0x82cd('0x26')](respondWithResult(_0x33d139,null))[_0x82cd('0x43')](handleError(_0x33d139,null));};exports[_0x82cd('0x51')]=function(_0x500859,_0x361c85,_0x3ae976){var _0x1c4ebf={};var _0x3d3e4e={};var _0x2fe523;var _0x471bc5;return db['ServicenowConfiguration'][_0x82cd('0x4e')]({'where':{'id':_0x500859[_0x82cd('0x45')]['id']}})[_0x82cd('0x26')](handleEntityNotFound(_0x361c85,null))[_0x82cd('0x26')](function(_0x1a02d1){if(_0x1a02d1){_0x2fe523=_0x1a02d1;_0x3d3e4e[_0x82cd('0x35')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x3d3e4e[_0x82cd('0x30')]=_[_0x82cd('0x47')](_0x500859[_0x82cd('0x30')]);_0x3d3e4e['filters']=_[_0x82cd('0x32')](_0x3d3e4e[_0x82cd('0x35')],_0x3d3e4e[_0x82cd('0x30')]);_0x1c4ebf[_0x82cd('0x33')]=_[_0x82cd('0x32')](_0x3d3e4e[_0x82cd('0x35')],qs[_0x82cd('0x48')](_0x500859['query'][_0x82cd('0x48')]));_0x1c4ebf[_0x82cd('0x33')]=_0x1c4ebf[_0x82cd('0x33')][_0x82cd('0x34')]?_0x1c4ebf[_0x82cd('0x33')]:_0x3d3e4e[_0x82cd('0x35')];_0x1c4ebf[_0x82cd('0x38')]=qs[_0x82cd('0x39')](_0x500859[_0x82cd('0x30')][_0x82cd('0x39')]);_0x1c4ebf['where']=qs['filters'](_['pick'](_0x500859[_0x82cd('0x30')],_0x3d3e4e[_0x82cd('0x31')]));if(_0x500859[_0x82cd('0x30')]['filter']){_0x1c4ebf[_0x82cd('0x3a')]=_[_0x82cd('0x3d')](_0x1c4ebf[_0x82cd('0x3a')],{'$or':_[_0x82cd('0x2c')](_0x1c4ebf[_0x82cd('0x33')],function(_0x3d8a31){var _0x548cf3={};_0x548cf3[_0x3d8a31]={'$like':'%'+_0x500859[_0x82cd('0x30')]['filter']+'%'};return _0x548cf3;})});}_0x1c4ebf=_['merge']({},_0x1c4ebf,_0x500859[_0x82cd('0x3f')]);return _0x2fe523[_0x82cd('0x51')](_0x1c4ebf);}})[_0x82cd('0x26')](function(_0x137fd5){if(_0x137fd5){_0x471bc5=_0x137fd5[_0x82cd('0x34')];if(!_0x500859['query'][_0x82cd('0x36')](_0x82cd('0x37'))){_0x1c4ebf[_0x82cd('0x1d')]=qs['limit'](_0x500859[_0x82cd('0x30')][_0x82cd('0x1d')]);_0x1c4ebf[_0x82cd('0x20')]=qs[_0x82cd('0x20')](_0x500859['query'][_0x82cd('0x20')]);}return _0x2fe523[_0x82cd('0x51')](_0x1c4ebf);}})[_0x82cd('0x26')](function(_0xf69631){if(_0xf69631){return _0xf69631?{'count':_0x471bc5,'rows':_0xf69631}:null;}})[_0x82cd('0x26')](respondWithResult(_0x361c85,null))[_0x82cd('0x43')](handleError(_0x361c85,null));};exports[_0x82cd('0x52')]=function(_0x36466b,_0x39f8d3,_0x447ceb){var _0x2d90f8={};var _0x5916b5={};var _0x10d19b;var _0x3e9dc5;return db[_0x82cd('0x2d')][_0x82cd('0x4e')]({'where':{'id':_0x36466b[_0x82cd('0x45')]['id']}})[_0x82cd('0x26')](handleEntityNotFound(_0x39f8d3,null))[_0x82cd('0x26')](function(_0x41481b){if(_0x41481b){_0x10d19b=_0x41481b;_0x5916b5[_0x82cd('0x35')]=_[_0x82cd('0x47')](db[_0x82cd('0x4f')][_0x82cd('0x46')]);_0x5916b5[_0x82cd('0x30')]=_[_0x82cd('0x47')](_0x36466b['query']);_0x5916b5[_0x82cd('0x31')]=_['intersection'](_0x5916b5[_0x82cd('0x35')],_0x5916b5[_0x82cd('0x30')]);_0x2d90f8[_0x82cd('0x33')]=_[_0x82cd('0x32')](_0x5916b5[_0x82cd('0x35')],qs[_0x82cd('0x48')](_0x36466b[_0x82cd('0x30')][_0x82cd('0x48')]));_0x2d90f8['attributes']=_0x2d90f8['attributes'][_0x82cd('0x34')]?_0x2d90f8[_0x82cd('0x33')]:_0x5916b5['model'];_0x2d90f8[_0x82cd('0x38')]=qs['sort'](_0x36466b[_0x82cd('0x30')]['sort']);_0x2d90f8[_0x82cd('0x3a')]=qs[_0x82cd('0x31')](_[_0x82cd('0x3b')](_0x36466b['query'],_0x5916b5[_0x82cd('0x31')]));if(_0x36466b['query'][_0x82cd('0x3c')]){_0x2d90f8[_0x82cd('0x3a')]=_[_0x82cd('0x3d')](_0x2d90f8[_0x82cd('0x3a')],{'$or':_['map'](_0x2d90f8[_0x82cd('0x33')],function(_0x46c155){var _0x38c2ae={};_0x38c2ae[_0x46c155]={'$like':'%'+_0x36466b['query'][_0x82cd('0x3c')]+'%'};return _0x38c2ae;})});}_0x2d90f8=_[_0x82cd('0x3d')]({},_0x2d90f8,_0x36466b[_0x82cd('0x3f')]);return _0x10d19b['getDescriptions'](_0x2d90f8);}})['then'](function(_0x4931a5){if(_0x4931a5){_0x3e9dc5=_0x4931a5[_0x82cd('0x34')];if(!_0x36466b[_0x82cd('0x30')][_0x82cd('0x36')]('nolimit')){_0x2d90f8[_0x82cd('0x1d')]=qs[_0x82cd('0x1d')](_0x36466b[_0x82cd('0x30')][_0x82cd('0x1d')]);_0x2d90f8[_0x82cd('0x20')]=qs[_0x82cd('0x20')](_0x36466b[_0x82cd('0x30')][_0x82cd('0x20')]);}return _0x10d19b['getDescriptions'](_0x2d90f8);}})[_0x82cd('0x26')](function(_0x164c30){if(_0x164c30){return _0x164c30?{'count':_0x3e9dc5,'rows':_0x164c30}:null;}})[_0x82cd('0x26')](respondWithResult(_0x39f8d3,null))[_0x82cd('0x43')](handleError(_0x39f8d3,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 2b3cd8b..e57d9d3 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 _0xb5fb=['path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4e2b25,_0x4eb01d){var _0x2d8228=function(_0x3c657c){while(--_0x3c657c){_0x4e2b25['push'](_0x4e2b25['shift']());}};_0x2d8228(++_0x4eb01d);}(_0xb5fb,0x172));var _0xbb5f=function(_0x396d05,_0x5cbf27){_0x396d05=_0x396d05-0x0;var _0x3b206e=_0xb5fb[_0x396d05];return _0x3b206e;};'use strict';var _=require(_0xbb5f('0x0'));var util=require(_0xbb5f('0x1'));var logger=require(_0xbb5f('0x2'))(_0xbb5f('0x3'));var moment=require(_0xbb5f('0x4'));var BPromise=require(_0xbb5f('0x5'));var rp=require(_0xbb5f('0x6'));var fs=require('fs');var path=require(_0xbb5f('0x7'));var rimraf=require(_0xbb5f('0x8'));var config=require(_0xbb5f('0x9'));var attributes=require(_0xbb5f('0xa'));module[_0xbb5f('0xb')]=function(_0x4b35d1,_0x1c6c4c){return _0x4b35d1['define']('ServicenowConfiguration',attributes,{'tableName':_0xbb5f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40ac=['api','moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','ServicenowConfiguration','int_servicenow_configurations','lodash','../../config/logger'];(function(_0x433f31,_0x12d471){var _0x1dde21=function(_0x8d1616){while(--_0x8d1616){_0x433f31['push'](_0x433f31['shift']());}};_0x1dde21(++_0x12d471);}(_0x40ac,0x1de));var _0xc40a=function(_0x304fe0,_0x430c48){_0x304fe0=_0x304fe0-0x0;var _0x1649f8=_0x40ac[_0x304fe0];return _0x1649f8;};'use strict';var _=require(_0xc40a('0x0'));var util=require('util');var logger=require(_0xc40a('0x1'))(_0xc40a('0x2'));var moment=require(_0xc40a('0x3'));var BPromise=require(_0xc40a('0x4'));var rp=require(_0xc40a('0x5'));var fs=require('fs');var path=require(_0xc40a('0x6'));var rimraf=require(_0xc40a('0x7'));var config=require('../../config/environment');var attributes=require(_0xc40a('0x8'));module[_0xc40a('0x9')]=function(_0xd6d891,_0x5e179f){return _0xd6d891['define'](_0xc40a('0xa'),attributes,{'tableName':_0xc40a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 9ed8e65..a00231d 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 _0xa329=['../../config/environment','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x35e140,_0x516f11){var _0x17fefe=function(_0xcf2538){while(--_0xcf2538){_0x35e140['push'](_0x35e140['shift']());}};_0x17fefe(++_0x516f11);}(_0xa329,0x174));var _0x9a32=function(_0x55e108,_0x3f3363){_0x55e108=_0x55e108-0x0;var _0xe845c7=_0xa329[_0x55e108];return _0xe845c7;};'use strict';var _=require(_0x9a32('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9a32('0x1'));var rs=require(_0x9a32('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9a32('0x3'));var logger=require(_0x9a32('0x4'))(_0x9a32('0x5'));var config=require(_0x9a32('0x6'));var jayson=require(_0x9a32('0x7'));var client=jayson['client'][_0x9a32('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36956d,_0x39ae33,_0x4ffe68){return new BPromise(function(_0x62ecf9,_0x23294d){return client[_0x9a32('0x9')](_0x36956d,_0x4ffe68)[_0x9a32('0xa')](function(_0x34ccba){logger[_0x9a32('0xb')](_0x9a32('0xc'),_0x39ae33,_0x9a32('0xd'));logger['debug'](_0x9a32('0xe'),_0x39ae33,_0x9a32('0xd'),JSON[_0x9a32('0xf')](_0x34ccba));if(_0x34ccba[_0x9a32('0x10')]){if(_0x34ccba[_0x9a32('0x10')][_0x9a32('0x11')]===0x1f4){logger[_0x9a32('0x10')](_0x9a32('0xc'),_0x39ae33,_0x34ccba['error'][_0x9a32('0x12')]);return _0x23294d(_0x34ccba[_0x9a32('0x10')][_0x9a32('0x12')]);}logger[_0x9a32('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x39ae33,_0x34ccba['error'][_0x9a32('0x12')]);return _0x62ecf9(_0x34ccba['error']['message']);}else{logger[_0x9a32('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x39ae33,'request\x20sent');_0x62ecf9(_0x34ccba[_0x9a32('0x13')][_0x9a32('0x12')]);}})[_0x9a32('0x14')](function(_0x3573ed){logger[_0x9a32('0x10')](_0x9a32('0xc'),_0x39ae33,_0x3573ed);_0x23294d(_0x3573ed);});});} \ No newline at end of file +var _0x1ba3=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x1ea0e1,_0x45f75f){var _0x28b845=function(_0x1cf7df){while(--_0x1cf7df){_0x1ea0e1['push'](_0x1ea0e1['shift']());}};_0x28b845(++_0x45f75f);}(_0x1ba3,0x154));var _0x31ba=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0x1ba3[_0x1b1e76];return _0x3d743a;};'use strict';var _=require(_0x31ba('0x0'));var util=require(_0x31ba('0x1'));var moment=require(_0x31ba('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31ba('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x31ba('0x4'));var logger=require('../../config/logger')(_0x31ba('0x5'));var config=require('../../config/environment');var jayson=require(_0x31ba('0x6'));var client=jayson[_0x31ba('0x7')][_0x31ba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2e7953,_0x32d506,_0x54baea){return new BPromise(function(_0x5718e9,_0x2960ee){return client[_0x31ba('0x9')](_0x2e7953,_0x54baea)[_0x31ba('0xa')](function(_0x5a49e4){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x32d506,_0x31ba('0xb'));logger[_0x31ba('0xc')](_0x31ba('0xd'),_0x32d506,_0x31ba('0xb'),JSON[_0x31ba('0xe')](_0x5a49e4));if(_0x5a49e4['error']){if(_0x5a49e4[_0x31ba('0xf')][_0x31ba('0x10')]===0x1f4){logger[_0x31ba('0xf')](_0x31ba('0x11'),_0x32d506,_0x5a49e4[_0x31ba('0xf')][_0x31ba('0x12')]);return _0x2960ee(_0x5a49e4[_0x31ba('0xf')]['message']);}logger[_0x31ba('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x32d506,_0x5a49e4[_0x31ba('0xf')]['message']);return _0x5718e9(_0x5a49e4[_0x31ba('0xf')][_0x31ba('0x12')]);}else{logger[_0x31ba('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x32d506,_0x31ba('0xb'));_0x5718e9(_0x5a49e4[_0x31ba('0x14')]['message']);}})[_0x31ba('0x15')](function(_0x4c9f66){logger[_0x31ba('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x32d506,_0x4c9f66);_0x2960ee(_0x4c9f66);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 31704f3..93d8889 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 _0xf7fc=['../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7fc,0x111));var _0xcf7f=function(_0x236832,_0x409537){_0x236832=_0x236832-0x0;var _0x287acc=_0xf7fc[_0x236832];return _0x287acc;};'use strict';var multer=require(_0xcf7f('0x0'));var util=require(_0xcf7f('0x1'));var path=require(_0xcf7f('0x2'));var timeout=require('connect-timeout');var express=require(_0xcf7f('0x3'));var router=express[_0xcf7f('0x4')]();var fs_extra=require(_0xcf7f('0x5'));var auth=require(_0xcf7f('0x6'));var interaction=require(_0xcf7f('0x7'));var config=require(_0xcf7f('0x8'));var controller=require(_0xcf7f('0x9'));router['get']('/',auth[_0xcf7f('0xa')](),controller[_0xcf7f('0xb')]);router[_0xcf7f('0xc')](_0xcf7f('0xd'),auth[_0xcf7f('0xa')](),controller[_0xcf7f('0xe')]);router[_0xcf7f('0xf')]('/',auth[_0xcf7f('0xa')](),controller['create']);router[_0xcf7f('0x10')](_0xcf7f('0xd'),auth[_0xcf7f('0xa')](),controller[_0xcf7f('0x11')]);router['delete'](_0xcf7f('0xd'),auth['isAuthenticated'](),controller[_0xcf7f('0x12')]);module[_0xcf7f('0x13')]=router; \ No newline at end of file +var _0xf7cc=['../../config/environment','./intServicenowField.controller','get','index','isAuthenticated','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0xf7cc,0x188));var _0xcf7c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xf7cc[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0xcf7c('0x0'));var util=require(_0xcf7c('0x1'));var path=require('path');var timeout=require(_0xcf7c('0x2'));var express=require(_0xcf7c('0x3'));var router=express[_0xcf7c('0x4')]();var fs_extra=require(_0xcf7c('0x5'));var auth=require(_0xcf7c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcf7c('0x7'));var controller=require(_0xcf7c('0x8'));router[_0xcf7c('0x9')]('/',auth['isAuthenticated'](),controller[_0xcf7c('0xa')]);router[_0xcf7c('0x9')]('/:id',auth[_0xcf7c('0xb')](),controller['show']);router[_0xcf7c('0xc')]('/',auth[_0xcf7c('0xb')](),controller[_0xcf7c('0xd')]);router[_0xcf7c('0xe')](_0xcf7c('0xf'),auth[_0xcf7c('0xb')](),controller[_0xcf7c('0x10')]);router[_0xcf7c('0x11')](_0xcf7c('0xf'),auth[_0xcf7c('0xb')](),controller[_0xcf7c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index fff13e1..a7bb383 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 _0x9029=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x2a0724,_0x376cb2){var _0x2b5a46=function(_0x211534){while(--_0x211534){_0x2a0724['push'](_0x2a0724['shift']());}};_0x2b5a46(++_0x376cb2);}(_0x9029,0x8f));var _0x9902=function(_0x39623b,_0x7d9de2){_0x39623b=_0x39623b-0x0;var _0x1b3230=_0x9029[_0x39623b];return _0x1b3230;};'use strict';var Sequelize=require(_0x9902('0x0'));module[_0x9902('0x1')]={'type':{'type':Sequelize[_0x9902('0x2')](_0x9902('0x3'),_0x9902('0x4'),_0x9902('0x5'),_0x9902('0x6'),_0x9902('0x7')),'defaultValue':_0x9902('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9902('0x8')]},'keyType':{'type':Sequelize[_0x9902('0x2')](_0x9902('0x3'),_0x9902('0x4'),_0x9902('0x5'))},'keyContent':{'type':Sequelize[_0x9902('0x8')]},'idField':{'type':Sequelize[_0x9902('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x9902('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9902('0x8')]}}; \ No newline at end of file +var _0xd8fd=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x31e14f,_0x49effd){var _0x5c696c=function(_0x33650f){while(--_0x33650f){_0x31e14f['push'](_0x31e14f['shift']());}};_0x5c696c(++_0x49effd);}(_0xd8fd,0xc0));var _0xdd8f=function(_0x4787d9,_0x2bc799){_0x4787d9=_0x4787d9-0x0;var _0x2c36ea=_0xd8fd[_0x4787d9];return _0x2c36ea;};'use strict';var Sequelize=require('sequelize');module[_0xdd8f('0x0')]={'type':{'type':Sequelize[_0xdd8f('0x1')](_0xdd8f('0x2'),_0xdd8f('0x3'),_0xdd8f('0x4'),_0xdd8f('0x5'),_0xdd8f('0x6')),'defaultValue':_0xdd8f('0x2')},'content':{'type':Sequelize[_0xdd8f('0x7')]},'key':{'type':Sequelize[_0xdd8f('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xdd8f('0x2'),_0xdd8f('0x3'),_0xdd8f('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xdd8f('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xdd8f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdd8f('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 1066af7..13747b4 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 _0x704c=['../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','ServicenowField','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','filter','options','includeAll','rows','catch','show','params','keys','include','find','create','body','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x31a768,_0x49f459){var _0x3cc7aa=function(_0x20a655){while(--_0x20a655){_0x31a768['push'](_0x31a768['shift']());}};_0x3cc7aa(++_0x49f459);}(_0x704c,0x13c));var _0xc704=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0x704c[_0x35ef6b];return _0x3ad145;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc704('0x0'));var jsonpatch=require(_0xc704('0x1'));var rp=require('request-promise');var moment=require(_0xc704('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc704('0x3'));var path=require(_0xc704('0x4'));var sox=require('sox');var csv=require(_0xc704('0x5'));var ejs=require(_0xc704('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc704('0x7'));var squel=require('squel');var crypto=require(_0xc704('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xc704('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc704('0xa'));var authService=require(_0xc704('0xb'));var qs=require(_0xc704('0xc'));var as=require(_0xc704('0xd'));var hardwareService=require(_0xc704('0xe'));var logger=require(_0xc704('0xf'))(_0xc704('0x10'));var utils=require(_0xc704('0x11'));var config=require(_0xc704('0x12'));var licenseUtil=require(_0xc704('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39428d,_0x6de63d){_0x6de63d=_0x6de63d||0xcc;return function(_0x6d8976){if(_0x6d8976){return _0x39428d[_0xc704('0x14')](_0x6de63d);}return _0x39428d['status'](_0x6de63d)[_0xc704('0x15')]();};}function respondWithResult(_0x5878e2,_0xd1afbb){_0xd1afbb=_0xd1afbb||0xc8;return function(_0x3cc3c6){if(_0x3cc3c6){return _0x5878e2[_0xc704('0x16')](_0xd1afbb)[_0xc704('0x17')](_0x3cc3c6);}};}function respondWithFilteredResult(_0x397779,_0x31374b){return function(_0x336934){if(_0x336934){var _0x246f3c=typeof _0x31374b[_0xc704('0x18')]==='undefined'&&typeof _0x31374b['limit']===_0xc704('0x19');var _0x536cfa=_0x336934[_0xc704('0x1a')];var _0x116a56=_0x246f3c?0x0:_0x31374b[_0xc704('0x18')];var _0x2c30fc=_0x246f3c?_0x336934[_0xc704('0x1a')]:_0x31374b['offset']+_0x31374b[_0xc704('0x1b')];var _0x4ee092;if(_0x2c30fc>=_0x536cfa){_0x2c30fc=_0x536cfa;_0x4ee092=0xc8;}else{_0x4ee092=0xce;}_0x397779[_0xc704('0x16')](_0x4ee092);return _0x397779[_0xc704('0x1c')](_0xc704('0x1d'),_0x116a56+'-'+_0x2c30fc+'/'+_0x536cfa)[_0xc704('0x17')](_0x336934);}return null;};}function patchUpdates(_0x2b08d3){return function(_0x2d16b6){try{jsonpatch['apply'](_0x2d16b6,_0x2b08d3,!![]);}catch(_0x503bb7){return BPromise[_0xc704('0x1e')](_0x503bb7);}return _0x2d16b6[_0xc704('0x1f')]();};}function saveUpdates(_0xe5414b,_0x2dc9e3){return function(_0x48177f){if(_0x48177f){return _0x48177f['update'](_0xe5414b)[_0xc704('0x20')](function(_0x32a7bb){return _0x32a7bb;});}return null;};}function removeEntity(_0x3c24c3,_0x168434){return function(_0x3a9581){if(_0x3a9581){return _0x3a9581[_0xc704('0x21')]()['then'](function(){_0x3c24c3[_0xc704('0x16')](0xcc)[_0xc704('0x15')]();});}};}function handleEntityNotFound(_0xe28cc0,_0x56cc4f){return function(_0x2a5fab){if(!_0x2a5fab){_0xe28cc0[_0xc704('0x14')](0x194);}return _0x2a5fab;};}function handleError(_0x3cdb4f,_0x4a5ef3){_0x4a5ef3=_0x4a5ef3||0x1f4;return function(_0x103ff3){logger[_0xc704('0x22')](_0x103ff3[_0xc704('0x23')]);if(_0x103ff3[_0xc704('0x24')]){delete _0x103ff3['name'];}_0x3cdb4f['status'](_0x4a5ef3)[_0xc704('0x25')](_0x103ff3);};}exports[_0xc704('0x26')]=function(_0x279d35,_0x2c743c){var _0x96c564={},_0x2faf29={},_0x27c394={'count':0x0,'rows':[]};var _0x43c4a7=_['map'](db[_0xc704('0x27')][_0xc704('0x28')],function(_0x3a5b64){return{'name':_0x3a5b64['fieldName'],'type':_0x3a5b64[_0xc704('0x29')][_0xc704('0x2a')]};});_0x2faf29[_0xc704('0x2b')]=_['map'](_0x43c4a7,_0xc704('0x24'));_0x2faf29[_0xc704('0x2c')]=_['keys'](_0x279d35[_0xc704('0x2c')]);_0x2faf29[_0xc704('0x2d')]=_[_0xc704('0x2e')](_0x2faf29['model'],_0x2faf29[_0xc704('0x2c')]);_0x96c564[_0xc704('0x2f')]=_[_0xc704('0x2e')](_0x2faf29[_0xc704('0x2b')],qs['fields'](_0x279d35[_0xc704('0x2c')][_0xc704('0x30')]));_0x96c564['attributes']=_0x96c564[_0xc704('0x2f')][_0xc704('0x31')]?_0x96c564[_0xc704('0x2f')]:_0x2faf29['model'];if(!_0x279d35[_0xc704('0x2c')]['hasOwnProperty'](_0xc704('0x32'))){_0x96c564[_0xc704('0x1b')]=qs['limit'](_0x279d35[_0xc704('0x2c')][_0xc704('0x1b')]);_0x96c564['offset']=qs['offset'](_0x279d35[_0xc704('0x2c')][_0xc704('0x18')]);}_0x96c564[_0xc704('0x33')]=qs[_0xc704('0x34')](_0x279d35[_0xc704('0x2c')][_0xc704('0x34')]);_0x96c564[_0xc704('0x35')]=qs[_0xc704('0x2d')](_['pick'](_0x279d35[_0xc704('0x2c')],_0x2faf29[_0xc704('0x2d')]),_0x43c4a7);if(_0x279d35[_0xc704('0x2c')]['filter']){_0x96c564[_0xc704('0x35')]=_[_0xc704('0x36')](_0x96c564[_0xc704('0x35')],{'$or':_['map'](_0x43c4a7,function(_0x3807ce){if(_0x3807ce['type']!=='VIRTUAL'){var _0x527555={};_0x527555[_0x3807ce[_0xc704('0x24')]]={'$like':'%'+_0x279d35['query'][_0xc704('0x37')]+'%'};return _0x527555;}})});}_0x96c564=_[_0xc704('0x36')]({},_0x96c564,_0x279d35[_0xc704('0x38')]);var _0x51f745={'where':_0x96c564['where']};return db[_0xc704('0x27')][_0xc704('0x1a')](_0x51f745)[_0xc704('0x20')](function(_0xab40e5){_0x27c394['count']=_0xab40e5;if(_0x279d35['query'][_0xc704('0x39')]){_0x96c564['include']=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x96c564);})[_0xc704('0x20')](function(_0x41cf2e){_0x27c394[_0xc704('0x3a')]=_0x41cf2e;return _0x27c394;})['then'](respondWithFilteredResult(_0x2c743c,_0x96c564))[_0xc704('0x3b')](handleError(_0x2c743c,null));};exports[_0xc704('0x3c')]=function(_0x39a0a7,_0x4ce191){var _0x5fd235={'raw':!![],'where':{'id':_0x39a0a7[_0xc704('0x3d')]['id']}},_0x52464a={};_0x52464a[_0xc704('0x2b')]=_[_0xc704('0x3e')](db['ServicenowField'][_0xc704('0x28')]);_0x52464a['query']=_['keys'](_0x39a0a7[_0xc704('0x2c')]);_0x52464a[_0xc704('0x2d')]=_[_0xc704('0x2e')](_0x52464a[_0xc704('0x2b')],_0x52464a['query']);_0x5fd235[_0xc704('0x2f')]=_[_0xc704('0x2e')](_0x52464a['model'],qs[_0xc704('0x30')](_0x39a0a7[_0xc704('0x2c')][_0xc704('0x30')]));_0x5fd235['attributes']=_0x5fd235[_0xc704('0x2f')][_0xc704('0x31')]?_0x5fd235['attributes']:_0x52464a['model'];if(_0x39a0a7[_0xc704('0x2c')]['includeAll']){_0x5fd235[_0xc704('0x3f')]=[{'all':!![]}];}_0x5fd235=_[_0xc704('0x36')]({},_0x5fd235,_0x39a0a7['options']);return db[_0xc704('0x27')][_0xc704('0x40')](_0x5fd235)[_0xc704('0x20')](handleEntityNotFound(_0x4ce191,null))[_0xc704('0x20')](respondWithResult(_0x4ce191,null))[_0xc704('0x3b')](handleError(_0x4ce191,null));};exports['create']=function(_0xe9f254,_0x214c21){return db[_0xc704('0x27')][_0xc704('0x41')](_0xe9f254[_0xc704('0x42')],{})[_0xc704('0x20')](respondWithResult(_0x214c21,0xc9))[_0xc704('0x3b')](handleError(_0x214c21,null));};exports['update']=function(_0x4c9499,_0x299358){if(_0x4c9499[_0xc704('0x42')]['id']){delete _0x4c9499['body']['id'];}return db[_0xc704('0x27')][_0xc704('0x40')]({'where':{'id':_0x4c9499[_0xc704('0x3d')]['id']}})[_0xc704('0x20')](handleEntityNotFound(_0x299358,null))[_0xc704('0x20')](saveUpdates(_0x4c9499[_0xc704('0x42')],null))[_0xc704('0x20')](respondWithResult(_0x299358,null))[_0xc704('0x3b')](handleError(_0x299358,null));};exports[_0xc704('0x21')]=function(_0x4a639b,_0x174689){return db[_0xc704('0x27')][_0xc704('0x40')]({'where':{'id':_0x4a639b['params']['id']}})[_0xc704('0x20')](handleEntityNotFound(_0x174689,null))[_0xc704('0x20')](removeEntity(_0x174689,null))[_0xc704('0x3b')](handleError(_0x174689,null));}; \ No newline at end of file +var _0x30c3=['../../config/environment','../../config/license/util','../../mysqldb','status','limit','undefined','count','offset','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','ServicenowField','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x188725,_0x4d8f48){var _0x5e4f48=function(_0xbe178f){while(--_0xbe178f){_0x188725['push'](_0x188725['shift']());}};_0x5e4f48(++_0x4d8f48);}(_0x30c3,0x1e4));var _0x330c=function(_0x558849,_0x113740){_0x558849=_0x558849-0x0;var _0x4149cd=_0x30c3[_0x558849];return _0x4149cd;};'use strict';var emlformat=require(_0x330c('0x0'));var rimraf=require(_0x330c('0x1'));var zipdir=require(_0x330c('0x2'));var jsonpatch=require(_0x330c('0x3'));var rp=require('request-promise');var moment=require(_0x330c('0x4'));var BPromise=require(_0x330c('0x5'));var Mustache=require(_0x330c('0x6'));var util=require('util');var path=require(_0x330c('0x7'));var sox=require(_0x330c('0x8'));var csv=require(_0x330c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x330c('0xa'));var squel=require(_0x330c('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x330c('0xc'));var toCsv=require(_0x330c('0x9'));var querystring=require(_0x330c('0xd'));var Papa=require(_0x330c('0xe'));var Redis=require(_0x330c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x330c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x330c('0x11'))(_0x330c('0x12'));var utils=require(_0x330c('0x13'));var config=require(_0x330c('0x14'));var licenseUtil=require(_0x330c('0x15'));var db=require(_0x330c('0x16'))['db'];function respondWithStatusCode(_0x259305,_0x2f8aba){_0x2f8aba=_0x2f8aba||0xcc;return function(_0x3fe8da){if(_0x3fe8da){return _0x259305['sendStatus'](_0x2f8aba);}return _0x259305[_0x330c('0x17')](_0x2f8aba)['end']();};}function respondWithResult(_0x4edc74,_0x1789fc){_0x1789fc=_0x1789fc||0xc8;return function(_0x58596d){if(_0x58596d){return _0x4edc74[_0x330c('0x17')](_0x1789fc)['json'](_0x58596d);}};}function respondWithFilteredResult(_0x215bd3,_0x10e78e){return function(_0x3abf82){if(_0x3abf82){var _0x3f2b04=typeof _0x10e78e['offset']==='undefined'&&typeof _0x10e78e[_0x330c('0x18')]===_0x330c('0x19');var _0x2d6c66=_0x3abf82[_0x330c('0x1a')];var _0x4c9844=_0x3f2b04?0x0:_0x10e78e[_0x330c('0x1b')];var _0xe6c6de=_0x3f2b04?_0x3abf82[_0x330c('0x1a')]:_0x10e78e[_0x330c('0x1b')]+_0x10e78e[_0x330c('0x18')];var _0x38d7fe;if(_0xe6c6de>=_0x2d6c66){_0xe6c6de=_0x2d6c66;_0x38d7fe=0xc8;}else{_0x38d7fe=0xce;}_0x215bd3[_0x330c('0x17')](_0x38d7fe);return _0x215bd3['set'](_0x330c('0x1c'),_0x4c9844+'-'+_0xe6c6de+'/'+_0x2d6c66)[_0x330c('0x1d')](_0x3abf82);}return null;};}function patchUpdates(_0x290f35){return function(_0x3ea594){try{jsonpatch[_0x330c('0x1e')](_0x3ea594,_0x290f35,!![]);}catch(_0x3afa91){return BPromise[_0x330c('0x1f')](_0x3afa91);}return _0x3ea594['save']();};}function saveUpdates(_0x22d2d3,_0x50e32d){return function(_0x4e8327){if(_0x4e8327){return _0x4e8327[_0x330c('0x20')](_0x22d2d3)[_0x330c('0x21')](function(_0x38fbea){return _0x38fbea;});}return null;};}function removeEntity(_0x2a7d44,_0x3bd040){return function(_0x28964c){if(_0x28964c){return _0x28964c[_0x330c('0x22')]()[_0x330c('0x21')](function(){_0x2a7d44['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x414500,_0x70a0ad){return function(_0x593333){if(!_0x593333){_0x414500[_0x330c('0x23')](0x194);}return _0x593333;};}function handleError(_0x10b864,_0x235a38){_0x235a38=_0x235a38||0x1f4;return function(_0x2eb883){logger[_0x330c('0x24')](_0x2eb883[_0x330c('0x25')]);if(_0x2eb883[_0x330c('0x26')]){delete _0x2eb883['name'];}_0x10b864[_0x330c('0x17')](_0x235a38)[_0x330c('0x27')](_0x2eb883);};}exports['index']=function(_0x1301df,_0x2d2797){var _0x1bbebd={},_0x1372d8={},_0x5c05a4={'count':0x0,'rows':[]};var _0x5d5ded=_[_0x330c('0x28')](db[_0x330c('0x29')][_0x330c('0x2a')],function(_0x165144){return{'name':_0x165144[_0x330c('0x2b')],'type':_0x165144[_0x330c('0x2c')]['key']};});_0x1372d8['model']=_[_0x330c('0x28')](_0x5d5ded,_0x330c('0x26'));_0x1372d8[_0x330c('0x2d')]=_[_0x330c('0x2e')](_0x1301df[_0x330c('0x2d')]);_0x1372d8['filters']=_[_0x330c('0x2f')](_0x1372d8[_0x330c('0x30')],_0x1372d8[_0x330c('0x2d')]);_0x1bbebd[_0x330c('0x31')]=_[_0x330c('0x2f')](_0x1372d8['model'],qs[_0x330c('0x32')](_0x1301df[_0x330c('0x2d')][_0x330c('0x32')]));_0x1bbebd[_0x330c('0x31')]=_0x1bbebd[_0x330c('0x31')][_0x330c('0x33')]?_0x1bbebd[_0x330c('0x31')]:_0x1372d8[_0x330c('0x30')];if(!_0x1301df[_0x330c('0x2d')]['hasOwnProperty'](_0x330c('0x34'))){_0x1bbebd['limit']=qs[_0x330c('0x18')](_0x1301df['query'][_0x330c('0x18')]);_0x1bbebd[_0x330c('0x1b')]=qs[_0x330c('0x1b')](_0x1301df[_0x330c('0x2d')]['offset']);}_0x1bbebd[_0x330c('0x35')]=qs[_0x330c('0x36')](_0x1301df['query'][_0x330c('0x36')]);_0x1bbebd[_0x330c('0x37')]=qs[_0x330c('0x38')](_[_0x330c('0x39')](_0x1301df['query'],_0x1372d8[_0x330c('0x38')]),_0x5d5ded);if(_0x1301df[_0x330c('0x2d')][_0x330c('0x3a')]){_0x1bbebd[_0x330c('0x37')]=_[_0x330c('0x3b')](_0x1bbebd['where'],{'$or':_[_0x330c('0x28')](_0x5d5ded,function(_0x824926){if(_0x824926[_0x330c('0x2c')]!==_0x330c('0x3c')){var _0x53ab52={};_0x53ab52[_0x824926[_0x330c('0x26')]]={'$like':'%'+_0x1301df[_0x330c('0x2d')][_0x330c('0x3a')]+'%'};return _0x53ab52;}})});}_0x1bbebd=_['merge']({},_0x1bbebd,_0x1301df[_0x330c('0x3d')]);var _0x59b37b={'where':_0x1bbebd[_0x330c('0x37')]};return db[_0x330c('0x29')][_0x330c('0x1a')](_0x59b37b)[_0x330c('0x21')](function(_0x34333f){_0x5c05a4[_0x330c('0x1a')]=_0x34333f;if(_0x1301df[_0x330c('0x2d')][_0x330c('0x3e')]){_0x1bbebd[_0x330c('0x3f')]=[{'all':!![]}];}return db[_0x330c('0x29')][_0x330c('0x40')](_0x1bbebd);})['then'](function(_0x14f700){_0x5c05a4[_0x330c('0x41')]=_0x14f700;return _0x5c05a4;})['then'](respondWithFilteredResult(_0x2d2797,_0x1bbebd))['catch'](handleError(_0x2d2797,null));};exports[_0x330c('0x42')]=function(_0x25a6b6,_0x27fa36){var _0x57adc2={'raw':!![],'where':{'id':_0x25a6b6[_0x330c('0x43')]['id']}},_0x38786c={};_0x38786c[_0x330c('0x30')]=_[_0x330c('0x2e')](db[_0x330c('0x29')][_0x330c('0x2a')]);_0x38786c[_0x330c('0x2d')]=_[_0x330c('0x2e')](_0x25a6b6[_0x330c('0x2d')]);_0x38786c['filters']=_['intersection'](_0x38786c[_0x330c('0x30')],_0x38786c[_0x330c('0x2d')]);_0x57adc2[_0x330c('0x31')]=_[_0x330c('0x2f')](_0x38786c['model'],qs[_0x330c('0x32')](_0x25a6b6['query'][_0x330c('0x32')]));_0x57adc2[_0x330c('0x31')]=_0x57adc2[_0x330c('0x31')][_0x330c('0x33')]?_0x57adc2['attributes']:_0x38786c['model'];if(_0x25a6b6['query']['includeAll']){_0x57adc2[_0x330c('0x3f')]=[{'all':!![]}];}_0x57adc2=_[_0x330c('0x3b')]({},_0x57adc2,_0x25a6b6[_0x330c('0x3d')]);return db[_0x330c('0x29')]['find'](_0x57adc2)['then'](handleEntityNotFound(_0x27fa36,null))[_0x330c('0x21')](respondWithResult(_0x27fa36,null))['catch'](handleError(_0x27fa36,null));};exports[_0x330c('0x44')]=function(_0x30b137,_0x4ab362){return db['ServicenowField'][_0x330c('0x44')](_0x30b137['body'],{})[_0x330c('0x21')](respondWithResult(_0x4ab362,0xc9))[_0x330c('0x45')](handleError(_0x4ab362,null));};exports[_0x330c('0x20')]=function(_0x3888ce,_0x47d6ad){if(_0x3888ce['body']['id']){delete _0x3888ce[_0x330c('0x46')]['id'];}return db[_0x330c('0x29')][_0x330c('0x47')]({'where':{'id':_0x3888ce['params']['id']}})[_0x330c('0x21')](handleEntityNotFound(_0x47d6ad,null))[_0x330c('0x21')](saveUpdates(_0x3888ce[_0x330c('0x46')],null))[_0x330c('0x21')](respondWithResult(_0x47d6ad,null))[_0x330c('0x45')](handleError(_0x47d6ad,null));};exports[_0x330c('0x22')]=function(_0x52dc8a,_0x1a4a65){return db[_0x330c('0x29')][_0x330c('0x47')]({'where':{'id':_0x52dc8a[_0x330c('0x43')]['id']}})[_0x330c('0x21')](handleEntityNotFound(_0x1a4a65,null))[_0x330c('0x21')](removeEntity(_0x1a4a65,null))[_0x330c('0x45')](handleError(_0x1a4a65,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 85164a7..215f324 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 _0x02a3=['exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x02a3,0x15b));var _0x302a=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x02a3[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0x302a('0x0'));var util=require(_0x302a('0x1'));var logger=require(_0x302a('0x2'))(_0x302a('0x3'));var moment=require(_0x302a('0x4'));var BPromise=require(_0x302a('0x5'));var rp=require(_0x302a('0x6'));var fs=require('fs');var path=require(_0x302a('0x7'));var rimraf=require(_0x302a('0x8'));var config=require(_0x302a('0x9'));var attributes=require('./intServicenowField.attributes');module[_0x302a('0xa')]=function(_0x382d0e,_0x3f6ca5){return _0x382d0e[_0x302a('0xb')](_0x302a('0xc'),attributes,{'tableName':_0x302a('0xd'),'paranoid':![],'indexes':[{'name':_0x302a('0xe'),'fields':[_0x302a('0xf'),_0x302a('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90ab=['request-promise','path','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','moment','bluebird'];(function(_0x4e0026,_0x2b52b6){var _0x3f8ee7=function(_0x31d891){while(--_0x31d891){_0x4e0026['push'](_0x4e0026['shift']());}};_0x3f8ee7(++_0x2b52b6);}(_0x90ab,0x65));var _0xb90a=function(_0xf94618,_0x114c5e){_0xf94618=_0xf94618-0x0;var _0x3b550f=_0x90ab[_0xf94618];return _0x3b550f;};'use strict';var _=require(_0xb90a('0x0'));var util=require(_0xb90a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb90a('0x2'));var BPromise=require(_0xb90a('0x3'));var rp=require(_0xb90a('0x4'));var fs=require('fs');var path=require(_0xb90a('0x5'));var rimraf=require(_0xb90a('0x6'));var config=require('../../config/environment');var attributes=require(_0xb90a('0x7'));module[_0xb90a('0x8')]=function(_0x1e7ada,_0x53a7a3){return _0x1e7ada[_0xb90a('0x9')](_0xb90a('0xa'),attributes,{'tableName':_0xb90a('0xb'),'paranoid':![],'indexes':[{'name':_0xb90a('0xc'),'fields':[_0xb90a('0xd'),_0xb90a('0xe')],'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 940ac6f..1aa076a 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x20b9ec,_0x4fb442){var _0x25aa01=function(_0x3e3ca2){while(--_0x3e3ca2){_0x20b9ec['push'](_0x20b9ec['shift']());}};_0x25aa01(++_0x4fb442);}(_0xb43b,0x1b2));var _0xbb43=function(_0x58a95c,_0x183b0b){_0x58a95c=_0x58a95c-0x0;var _0x2da309=_0xb43b[_0x58a95c];return _0x2da309;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x417e75,_0x548352){var _0x14beb9=function(_0x4dbd61){while(--_0x4dbd61){_0x417e75['push'](_0x417e75['shift']());}};_0x14beb9(++_0x548352);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2ce9ae,_0x3d1d32){_0x2ce9ae=_0x2ce9ae-0x0;var _0x5b640b=_0x9ffd[_0x2ce9ae];return _0x5b640b;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index e15c263..08bc4a5 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x24b716,_0x62a194){var _0x3ce4ac=function(_0x522a84){while(--_0x522a84){_0x24b716['push'](_0x24b716['shift']());}};_0x3ce4ac(++_0x62a194);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x54f6bb,_0x549589){var _0x810755=function(_0x517ac9){while(--_0x517ac9){_0x54f6bb['push'](_0x54f6bb['shift']());}};_0x810755(++_0x549589);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 4e9090c..e9f21d4 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(_0x3550e7,_0x445e40){var _0x47263a=function(_0x2c6970){while(--_0x2c6970){_0x3550e7['push'](_0x3550e7['shift']());}};_0x47263a(++_0x445e40);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x237ecd,_0x2a3bee){var _0x1157fe=function(_0x369c89){while(--_0x369c89){_0x237ecd['push'](_0x237ecd['shift']());}};_0x1157fe(++_0x2a3bee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 4566941..eb957df 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 _0xf641=['POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','values','remove','includes','label','endsWith','value','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','sendStatus','status','json','undefined','offset','set','Content-Range','apply','reject','save','update','then','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','limit','sort','where','pick','merge','VIRTUAL','name','filter','options','SugarcrmAccount','count','rows','catch','show','params','keys','includeAll','find','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','order','hasOwnProperty','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','substring'];(function(_0x3186c5,_0x23524b){var _0x51e4c6=function(_0x4bde50){while(--_0x4bde50){_0x3186c5['push'](_0x3186c5['shift']());}};_0x51e4c6(++_0x23524b);}(_0xf641,0x17d));var _0x1f64=function(_0x29bfda,_0x30ad24){_0x29bfda=_0x29bfda-0x0;var _0x3f3db5=_0xf641[_0x29bfda];return _0x3f3db5;};'use strict';var emlformat=require(_0x1f64('0x0'));var rimraf=require(_0x1f64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f64('0x2'));var rp=require('request-promise');var moment=require(_0x1f64('0x3'));var BPromise=require(_0x1f64('0x4'));var Mustache=require('mustache');var util=require(_0x1f64('0x5'));var path=require(_0x1f64('0x6'));var sox=require(_0x1f64('0x7'));var csv=require(_0x1f64('0x8'));var ejs=require(_0x1f64('0x9'));var fs=require('fs');var fs_extra=require(_0x1f64('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1f64('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1f64('0xc'));var toCsv=require(_0x1f64('0x8'));var querystring=require(_0x1f64('0xd'));var Papa=require(_0x1f64('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1f64('0xf'));var as=require(_0x1f64('0x10'));var hardwareService=require(_0x1f64('0x11'));var logger=require(_0x1f64('0x12'))(_0x1f64('0x13'));var utils=require(_0x1f64('0x14'));var config=require(_0x1f64('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x1f64('0x16'));function respondWithStatusCode(_0x1b4c41,_0xa2a8ba){_0xa2a8ba=_0xa2a8ba||0xcc;return function(_0x2889d2){if(_0x2889d2){return _0x1b4c41[_0x1f64('0x17')](_0xa2a8ba);}return _0x1b4c41[_0x1f64('0x18')](_0xa2a8ba)['end']();};}function respondWithResult(_0x5aed34,_0x193635){_0x193635=_0x193635||0xc8;return function(_0x162618){if(_0x162618){return _0x5aed34['status'](_0x193635)[_0x1f64('0x19')](_0x162618);}};}function respondWithFilteredResult(_0x504495,_0x4926ba){return function(_0x3ee2de){if(_0x3ee2de){var _0x2895e5=typeof _0x4926ba['offset']===_0x1f64('0x1a')&&typeof _0x4926ba['limit']===_0x1f64('0x1a');var _0x4a1e48=_0x3ee2de['count'];var _0x43a527=_0x2895e5?0x0:_0x4926ba['offset'];var _0x4d73ce=_0x2895e5?_0x3ee2de['count']:_0x4926ba[_0x1f64('0x1b')]+_0x4926ba['limit'];var _0xfa94e;if(_0x4d73ce>=_0x4a1e48){_0x4d73ce=_0x4a1e48;_0xfa94e=0xc8;}else{_0xfa94e=0xce;}_0x504495[_0x1f64('0x18')](_0xfa94e);return _0x504495[_0x1f64('0x1c')](_0x1f64('0x1d'),_0x43a527+'-'+_0x4d73ce+'/'+_0x4a1e48)[_0x1f64('0x19')](_0x3ee2de);}return null;};}function patchUpdates(_0x66b7f5){return function(_0x28a1df){try{jsonpatch[_0x1f64('0x1e')](_0x28a1df,_0x66b7f5,!![]);}catch(_0x456b43){return BPromise[_0x1f64('0x1f')](_0x456b43);}return _0x28a1df[_0x1f64('0x20')]();};}function saveUpdates(_0xe7c07,_0x43f4f1){return function(_0xbb1021){if(_0xbb1021){return _0xbb1021[_0x1f64('0x21')](_0xe7c07)[_0x1f64('0x22')](function(_0x496db8){return _0x496db8;});}return null;};}function removeEntity(_0x42a405,_0x3d6ca9){return function(_0x3c6e3f){if(_0x3c6e3f){return _0x3c6e3f['destroy']()['then'](function(){_0x42a405['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f4733,_0x4faf36){return function(_0x158f81){if(!_0x158f81){_0x2f4733[_0x1f64('0x17')](0x194);}return _0x158f81;};}function handleError(_0x30efde,_0x4cccc7){_0x4cccc7=_0x4cccc7||0x1f4;return function(_0x36ec7f){logger[_0x1f64('0x23')](_0x36ec7f[_0x1f64('0x24')]);if(_0x36ec7f['name']){delete _0x36ec7f['name'];}_0x30efde['status'](_0x4cccc7)[_0x1f64('0x25')](_0x36ec7f);};}exports[_0x1f64('0x26')]=function(_0x3ed10c,_0x4117e2){var _0x852d10={},_0x2ef604={},_0x10dc0c={'count':0x0,'rows':[]};var _0x386026=_[_0x1f64('0x27')](db['SugarcrmAccount'][_0x1f64('0x28')],function(_0x58d856){return{'name':_0x58d856[_0x1f64('0x29')],'type':_0x58d856[_0x1f64('0x2a')][_0x1f64('0x2b')]};});_0x2ef604[_0x1f64('0x2c')]=_[_0x1f64('0x27')](_0x386026,'name');_0x2ef604[_0x1f64('0x2d')]=_['keys'](_0x3ed10c['query']);_0x2ef604[_0x1f64('0x2e')]=_['intersection'](_0x2ef604['model'],_0x2ef604[_0x1f64('0x2d')]);_0x852d10[_0x1f64('0x2f')]=_[_0x1f64('0x30')](_0x2ef604[_0x1f64('0x2c')],qs[_0x1f64('0x31')](_0x3ed10c['query'][_0x1f64('0x31')]));_0x852d10[_0x1f64('0x2f')]=_0x852d10[_0x1f64('0x2f')][_0x1f64('0x32')]?_0x852d10[_0x1f64('0x2f')]:_0x2ef604[_0x1f64('0x2c')];if(!_0x3ed10c[_0x1f64('0x2d')]['hasOwnProperty'](_0x1f64('0x33'))){_0x852d10[_0x1f64('0x34')]=qs[_0x1f64('0x34')](_0x3ed10c[_0x1f64('0x2d')][_0x1f64('0x34')]);_0x852d10[_0x1f64('0x1b')]=qs[_0x1f64('0x1b')](_0x3ed10c[_0x1f64('0x2d')]['offset']);}_0x852d10['order']=qs[_0x1f64('0x35')](_0x3ed10c[_0x1f64('0x2d')][_0x1f64('0x35')]);_0x852d10[_0x1f64('0x36')]=qs[_0x1f64('0x2e')](_[_0x1f64('0x37')](_0x3ed10c['query'],_0x2ef604['filters']),_0x386026);if(_0x3ed10c[_0x1f64('0x2d')]['filter']){_0x852d10[_0x1f64('0x36')]=_[_0x1f64('0x38')](_0x852d10[_0x1f64('0x36')],{'$or':_[_0x1f64('0x27')](_0x386026,function(_0x31f9ba){if(_0x31f9ba[_0x1f64('0x2a')]!==_0x1f64('0x39')){var _0x57d53d={};_0x57d53d[_0x31f9ba[_0x1f64('0x3a')]]={'$like':'%'+_0x3ed10c[_0x1f64('0x2d')][_0x1f64('0x3b')]+'%'};return _0x57d53d;}})});}_0x852d10=_[_0x1f64('0x38')]({},_0x852d10,_0x3ed10c[_0x1f64('0x3c')]);var _0x2628a7={'where':_0x852d10['where']};return db[_0x1f64('0x3d')][_0x1f64('0x3e')](_0x2628a7)[_0x1f64('0x22')](function(_0x129191){_0x10dc0c['count']=_0x129191;if(_0x3ed10c['query']['includeAll']){_0x852d10['include']=[{'all':!![]}];}return db[_0x1f64('0x3d')]['findAll'](_0x852d10);})[_0x1f64('0x22')](function(_0x100763){_0x10dc0c[_0x1f64('0x3f')]=_0x100763;return _0x10dc0c;})[_0x1f64('0x22')](respondWithFilteredResult(_0x4117e2,_0x852d10))[_0x1f64('0x40')](handleError(_0x4117e2,null));};exports[_0x1f64('0x41')]=function(_0x59dadb,_0x3f9dae){var _0x47f4e2={'raw':![],'where':{'id':_0x59dadb[_0x1f64('0x42')]['id']}},_0x2996cc={};_0x2996cc['model']=_[_0x1f64('0x43')](db[_0x1f64('0x3d')][_0x1f64('0x28')]);_0x2996cc['query']=_[_0x1f64('0x43')](_0x59dadb[_0x1f64('0x2d')]);_0x2996cc[_0x1f64('0x2e')]=_['intersection'](_0x2996cc['model'],_0x2996cc[_0x1f64('0x2d')]);_0x47f4e2[_0x1f64('0x2f')]=_[_0x1f64('0x30')](_0x2996cc[_0x1f64('0x2c')],qs[_0x1f64('0x31')](_0x59dadb[_0x1f64('0x2d')][_0x1f64('0x31')]));_0x47f4e2['attributes']=_0x47f4e2[_0x1f64('0x2f')][_0x1f64('0x32')]?_0x47f4e2[_0x1f64('0x2f')]:_0x2996cc['model'];if(_0x59dadb[_0x1f64('0x2d')][_0x1f64('0x44')]){_0x47f4e2['include']=[{'all':!![]}];}_0x47f4e2=_['merge']({},_0x47f4e2,_0x59dadb[_0x1f64('0x3c')]);return db[_0x1f64('0x3d')][_0x1f64('0x45')](_0x47f4e2)['then'](handleEntityNotFound(_0x3f9dae,null))[_0x1f64('0x22')](respondWithResult(_0x3f9dae,null))[_0x1f64('0x40')](handleError(_0x3f9dae,null));};exports[_0x1f64('0x46')]=function(_0x2b6a15,_0x339d11){return db[_0x1f64('0x3d')][_0x1f64('0x46')](_0x2b6a15['body'],{})[_0x1f64('0x22')](respondWithResult(_0x339d11,0xc9))[_0x1f64('0x40')](handleError(_0x339d11,null));};exports[_0x1f64('0x21')]=function(_0x293900,_0x58d72e){if(_0x293900[_0x1f64('0x47')]['id']){delete _0x293900[_0x1f64('0x47')]['id'];}return db[_0x1f64('0x3d')][_0x1f64('0x45')]({'where':{'id':_0x293900[_0x1f64('0x42')]['id']}})[_0x1f64('0x22')](handleEntityNotFound(_0x58d72e,null))[_0x1f64('0x22')](saveUpdates(_0x293900[_0x1f64('0x47')],null))[_0x1f64('0x22')](respondWithResult(_0x58d72e,null))[_0x1f64('0x40')](handleError(_0x58d72e,null));};exports[_0x1f64('0x48')]=function(_0x372b2e,_0x1ec2b9){return db['SugarcrmAccount'][_0x1f64('0x45')]({'where':{'id':_0x372b2e[_0x1f64('0x42')]['id']}})[_0x1f64('0x22')](handleEntityNotFound(_0x1ec2b9,null))[_0x1f64('0x22')](removeEntity(_0x1ec2b9,null))[_0x1f64('0x40')](handleError(_0x1ec2b9,null));};exports[_0x1f64('0x49')]=function(_0x3ec0f3,_0x4632c2,_0x3e98df){var _0x17cbc9={};var _0x535698={};var _0x3cd185;var _0x1a1503;return db[_0x1f64('0x3d')][_0x1f64('0x4a')]({'where':{'id':_0x3ec0f3[_0x1f64('0x42')]['id']}})[_0x1f64('0x22')](handleEntityNotFound(_0x4632c2,null))[_0x1f64('0x22')](function(_0xbf59fb){if(_0xbf59fb){_0x3cd185=_0xbf59fb;_0x535698[_0x1f64('0x2c')]=_[_0x1f64('0x43')](db[_0x1f64('0x4b')][_0x1f64('0x28')]);_0x535698[_0x1f64('0x2d')]=_[_0x1f64('0x43')](_0x3ec0f3['query']);_0x535698[_0x1f64('0x2e')]=_[_0x1f64('0x30')](_0x535698[_0x1f64('0x2c')],_0x535698[_0x1f64('0x2d')]);_0x17cbc9[_0x1f64('0x2f')]=_[_0x1f64('0x30')](_0x535698[_0x1f64('0x2c')],qs['fields'](_0x3ec0f3[_0x1f64('0x2d')][_0x1f64('0x31')]));_0x17cbc9[_0x1f64('0x2f')]=_0x17cbc9[_0x1f64('0x2f')]['length']?_0x17cbc9['attributes']:_0x535698[_0x1f64('0x2c')];_0x17cbc9[_0x1f64('0x4c')]=qs[_0x1f64('0x35')](_0x3ec0f3[_0x1f64('0x2d')][_0x1f64('0x35')]);_0x17cbc9[_0x1f64('0x36')]=qs[_0x1f64('0x2e')](_[_0x1f64('0x37')](_0x3ec0f3[_0x1f64('0x2d')],_0x535698[_0x1f64('0x2e')]));if(_0x3ec0f3['query'][_0x1f64('0x3b')]){_0x17cbc9['where']=_[_0x1f64('0x38')](_0x17cbc9['where'],{'$or':_[_0x1f64('0x27')](_0x17cbc9['attributes'],function(_0x4c32fb){var _0x27f5d2={};_0x27f5d2[_0x4c32fb]={'$like':'%'+_0x3ec0f3[_0x1f64('0x2d')][_0x1f64('0x3b')]+'%'};return _0x27f5d2;})});}_0x17cbc9=_['merge']({},_0x17cbc9,_0x3ec0f3['options']);return _0x3cd185['getConfigurations'](_0x17cbc9);}})[_0x1f64('0x22')](function(_0x3de558){if(_0x3de558){_0x1a1503=_0x3de558[_0x1f64('0x32')];if(!_0x3ec0f3[_0x1f64('0x2d')][_0x1f64('0x4d')](_0x1f64('0x33'))){_0x17cbc9[_0x1f64('0x34')]=qs['limit'](_0x3ec0f3[_0x1f64('0x2d')]['limit']);_0x17cbc9[_0x1f64('0x1b')]=qs[_0x1f64('0x1b')](_0x3ec0f3['query'][_0x1f64('0x1b')]);}return _0x3cd185[_0x1f64('0x49')](_0x17cbc9);}})[_0x1f64('0x22')](function(_0x5638b0){if(_0x5638b0){return _0x5638b0?{'count':_0x1a1503,'rows':_0x5638b0}:null;}})['then'](respondWithResult(_0x4632c2,null))[_0x1f64('0x40')](handleError(_0x4632c2,null));};exports['addConfiguration']=function(_0x5a4067,_0x4c15ec,_0x5f53fa){if(_0x5a4067[_0x1f64('0x47')]['id']){delete _0x5a4067[_0x1f64('0x47')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x5a4067['params']['id']}})[_0x1f64('0x22')](handleEntityNotFound(_0x4c15ec,null))['then'](function(_0x41d19a){if(_0x41d19a){_0x5a4067['body'][_0x1f64('0x4e')]=_0x41d19a['id'];_0x5a4067[_0x1f64('0x47')][_0x1f64('0x4f')]=integrations[_0x1f64('0x50')](_0x5a4067[_0x1f64('0x47')][_0x1f64('0x51')],_0x5a4067[_0x1f64('0x47')][_0x1f64('0x2a')]);_0x5a4067['body']['Descriptions']=integrations[_0x1f64('0x52')](_0x5a4067[_0x1f64('0x47')]['channel'],_0x5a4067[_0x1f64('0x47')]['type']);return db[_0x1f64('0x4b')][_0x1f64('0x46')](_0x5a4067[_0x1f64('0x47')],{'include':[{'model':db[_0x1f64('0x53')],'as':'Subjects'},{'model':db[_0x1f64('0x53')],'as':_0x1f64('0x54')}]});}return null;})['then'](respondWithResult(_0x4c15ec,null))[_0x1f64('0x40')](handleError(_0x4c15ec,null));};exports[_0x1f64('0x55')]=function(_0x5bc7af,_0x283ff0,_0x389b26){var _0xd2d7a0='';var _0x5c4f6b=['id',_0x1f64('0x3a'),_0x1f64('0x56'),'created_by',_0x1f64('0x57'),_0x1f64('0x58'),_0x1f64('0x59'),_0x1f64('0x5a'),_0x1f64('0x5b'),_0x1f64('0x5c'),_0x1f64('0x5d'),_0x1f64('0x5e')];return db[_0x1f64('0x3d')][_0x1f64('0x4a')]({'where':{'id':_0x5bc7af[_0x1f64('0x42')]['id']},'attributes':['id','username',_0x1f64('0x5f'),_0x1f64('0x60')]})[_0x1f64('0x22')](handleEntityNotFound(_0x283ff0,null))[_0x1f64('0x22')](function(_0x490b1f){if(_0x490b1f){_0xd2d7a0=_0x490b1f[_0x1f64('0x60')];var _0x27b3c0=_0xd2d7a0[_0x1f64('0x61')](-0x1);if(_0x27b3c0==='/'){_0xd2d7a0=_0xd2d7a0[_0x1f64('0x62')](0x0,_0xd2d7a0['lastIndexOf'](_0x27b3c0));}return rp({'method':_0x1f64('0x63'),'uri':util[_0x1f64('0x64')](_0x1f64('0x65'),_0xd2d7a0,_0x1f64('0x66')),'json':!![],'form':{'method':_0x1f64('0x67'),'input_type':'JSON','response_type':_0x1f64('0x68'),'rest_data':JSON[_0x1f64('0x69')]({'user_auth':{'user_name':_0x490b1f[_0x1f64('0x6a')],'password':_0x490b1f[_0x1f64('0x5f')],'encryption':_0x1f64('0x6b')},'application':_0x1f64('0x6c')})}});}})['then'](function(_0x27c148){if(_0x27c148&&_0x27c148['name']!==_0x1f64('0x6d')&&_0x27c148[_0x1f64('0x3a')]!==_0x1f64('0x6e')){return rp({'method':'POST','uri':util[_0x1f64('0x64')](_0x1f64('0x65'),_0xd2d7a0,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x1f64('0x6f'),'input_type':_0x1f64('0x68'),'response_type':_0x1f64('0x68'),'rest_data':JSON[_0x1f64('0x69')]({'session':_0x27c148['id'],'module_name':'Calls'})}})[_0x1f64('0x22')](function(_0x1b17c1){if(_0x1b17c1){var _0x32064a=_[_0x1f64('0x70')](_0x1b17c1['module_fields']);_[_0x1f64('0x71')](_0x32064a,function(_0x424ecf){return _0x5c4f6b[_0x1f64('0x72')](_0x424ecf[_0x1f64('0x3a')]);});return{'count':_0x32064a[_0x1f64('0x32')],'rows':_['map'](_0x32064a,function(_0x504864){return{'id':_0x504864[_0x1f64('0x3a')],'name':_0x504864[_0x1f64('0x73')],'custom':_[_0x1f64('0x74')](_0x504864[_0x1f64('0x3a')],'_c')?!![]:![],'options':_0x504864[_0x1f64('0x3c')]?_[_0x1f64('0x27')](_[_0x1f64('0x70')](_0x504864[_0x1f64('0x3c')]),function(_0x5174bb){return{'name':_0x5174bb[_0x1f64('0x75')],'value':_0x5174bb[_0x1f64('0x3a')]};}):[]};})};}})['then'](respondWithResult(_0x283ff0,null))[_0x1f64('0x40')](function(_0x566e9c){var _0x41f9d2=_0x5bc7af[_0x1f64('0x2d')][_0x1f64('0x76')]?0x1f4:_0x566e9c['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x1f64('0x55'),_0x41f9d2,JSON[_0x1f64('0x69')](_0x566e9c));delete _0x566e9c[_0x1f64('0x3a')];if(_0x41f9d2===0x191){_0x41f9d2=0x190;}_0x283ff0['status'](_0x41f9d2)[_0x1f64('0x25')](_0x5bc7af[_0x1f64('0x2d')][_0x1f64('0x76')]?{'message':_0x1f64('0x77'),'statusCode':_0x566e9c['statusCode']}:_0x566e9c);});}else{var _0x5b684e=0x1f4;_0x283ff0[_0x1f64('0x18')](_0x5b684e)[_0x1f64('0x25')]({'message':_0x1f64('0x77'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xe73d=['filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','destroy','getConfigurations','findOne','length','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','created_by','duration_hours','parent_id','parent_type','parent_name','direction','password','remoteUri','slice','format','%s%s','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','values','module_fields','remove','includes','label','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','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','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe73d,0x1b3));var _0xde73=function(_0x4bae48,_0x1ab620){_0x4bae48=_0x4bae48-0x0;var _0x4df7dc=_0xe73d[_0x4bae48];return _0x4df7dc;};'use strict';var emlformat=require(_0xde73('0x0'));var rimraf=require(_0xde73('0x1'));var zipdir=require(_0xde73('0x2'));var jsonpatch=require(_0xde73('0x3'));var rp=require(_0xde73('0x4'));var moment=require(_0xde73('0x5'));var BPromise=require(_0xde73('0x6'));var Mustache=require(_0xde73('0x7'));var util=require(_0xde73('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xde73('0x9'));var fs=require('fs');var fs_extra=require(_0xde73('0xa'));var _=require(_0xde73('0xb'));var squel=require(_0xde73('0xc'));var crypto=require(_0xde73('0xd'));var jsforce=require(_0xde73('0xe'));var deskjs=require(_0xde73('0xf'));var toCsv=require(_0xde73('0x10'));var querystring=require(_0xde73('0x11'));var Papa=require(_0xde73('0x12'));var Redis=require(_0xde73('0x13'));var authService=require(_0xde73('0x14'));var qs=require(_0xde73('0x15'));var as=require(_0xde73('0x16'));var hardwareService=require(_0xde73('0x17'));var logger=require(_0xde73('0x18'))(_0xde73('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xde73('0x1a'));var db=require(_0xde73('0x1b'))['db'];var integrations=require(_0xde73('0x1c'));function respondWithStatusCode(_0x20e0b6,_0x4d505f){_0x4d505f=_0x4d505f||0xcc;return function(_0x1dca7c){if(_0x1dca7c){return _0x20e0b6[_0xde73('0x1d')](_0x4d505f);}return _0x20e0b6[_0xde73('0x1e')](_0x4d505f)['end']();};}function respondWithResult(_0x20999f,_0x4ab04b){_0x4ab04b=_0x4ab04b||0xc8;return function(_0x3be23a){if(_0x3be23a){return _0x20999f['status'](_0x4ab04b)[_0xde73('0x1f')](_0x3be23a);}};}function respondWithFilteredResult(_0x44e6e3,_0x3b7881){return function(_0x4273ce){if(_0x4273ce){var _0x37b2b9=typeof _0x3b7881['offset']===_0xde73('0x20')&&typeof _0x3b7881[_0xde73('0x21')]==='undefined';var _0x2d57e0=_0x4273ce[_0xde73('0x22')];var _0x53419c=_0x37b2b9?0x0:_0x3b7881[_0xde73('0x23')];var _0x4e1925=_0x37b2b9?_0x4273ce[_0xde73('0x22')]:_0x3b7881[_0xde73('0x23')]+_0x3b7881[_0xde73('0x21')];var _0x5dcd7c;if(_0x4e1925>=_0x2d57e0){_0x4e1925=_0x2d57e0;_0x5dcd7c=0xc8;}else{_0x5dcd7c=0xce;}_0x44e6e3[_0xde73('0x1e')](_0x5dcd7c);return _0x44e6e3['set'](_0xde73('0x24'),_0x53419c+'-'+_0x4e1925+'/'+_0x2d57e0)[_0xde73('0x1f')](_0x4273ce);}return null;};}function patchUpdates(_0x13fa23){return function(_0x5770b8){try{jsonpatch[_0xde73('0x25')](_0x5770b8,_0x13fa23,!![]);}catch(_0x196658){return BPromise[_0xde73('0x26')](_0x196658);}return _0x5770b8[_0xde73('0x27')]();};}function saveUpdates(_0xb4e27,_0x4368c3){return function(_0xd8d757){if(_0xd8d757){return _0xd8d757[_0xde73('0x28')](_0xb4e27)['then'](function(_0xd067c6){return _0xd067c6;});}return null;};}function removeEntity(_0x4caa4e,_0x408779){return function(_0x53acb8){if(_0x53acb8){return _0x53acb8['destroy']()[_0xde73('0x29')](function(){_0x4caa4e[_0xde73('0x1e')](0xcc)[_0xde73('0x2a')]();});}};}function handleEntityNotFound(_0x2e2134,_0x36e622){return function(_0x4d92e2){if(!_0x4d92e2){_0x2e2134['sendStatus'](0x194);}return _0x4d92e2;};}function handleError(_0x5c533e,_0x520720){_0x520720=_0x520720||0x1f4;return function(_0x24017b){logger[_0xde73('0x2b')](_0x24017b[_0xde73('0x2c')]);if(_0x24017b[_0xde73('0x2d')]){delete _0x24017b[_0xde73('0x2d')];}_0x5c533e['status'](_0x520720)[_0xde73('0x2e')](_0x24017b);};}exports[_0xde73('0x2f')]=function(_0xdf84c6,_0x1f7641){var _0x12a2c9={},_0x4522de={},_0xa2f32e={'count':0x0,'rows':[]};var _0x55d003=_['map'](db[_0xde73('0x30')][_0xde73('0x31')],function(_0x46340b){return{'name':_0x46340b[_0xde73('0x32')],'type':_0x46340b[_0xde73('0x33')]['key']};});_0x4522de['model']=_[_0xde73('0x34')](_0x55d003,_0xde73('0x2d'));_0x4522de[_0xde73('0x35')]=_['keys'](_0xdf84c6[_0xde73('0x35')]);_0x4522de[_0xde73('0x36')]=_[_0xde73('0x37')](_0x4522de[_0xde73('0x38')],_0x4522de[_0xde73('0x35')]);_0x12a2c9[_0xde73('0x39')]=_['intersection'](_0x4522de[_0xde73('0x38')],qs[_0xde73('0x3a')](_0xdf84c6[_0xde73('0x35')][_0xde73('0x3a')]));_0x12a2c9[_0xde73('0x39')]=_0x12a2c9[_0xde73('0x39')]['length']?_0x12a2c9[_0xde73('0x39')]:_0x4522de[_0xde73('0x38')];if(!_0xdf84c6[_0xde73('0x35')][_0xde73('0x3b')](_0xde73('0x3c'))){_0x12a2c9[_0xde73('0x21')]=qs[_0xde73('0x21')](_0xdf84c6['query'][_0xde73('0x21')]);_0x12a2c9[_0xde73('0x23')]=qs['offset'](_0xdf84c6[_0xde73('0x35')][_0xde73('0x23')]);}_0x12a2c9[_0xde73('0x3d')]=qs[_0xde73('0x3e')](_0xdf84c6['query'][_0xde73('0x3e')]);_0x12a2c9[_0xde73('0x3f')]=qs[_0xde73('0x36')](_[_0xde73('0x40')](_0xdf84c6[_0xde73('0x35')],_0x4522de[_0xde73('0x36')]),_0x55d003);if(_0xdf84c6[_0xde73('0x35')][_0xde73('0x41')]){_0x12a2c9['where']=_[_0xde73('0x42')](_0x12a2c9[_0xde73('0x3f')],{'$or':_[_0xde73('0x34')](_0x55d003,function(_0x4b23c4){if(_0x4b23c4['type']!==_0xde73('0x43')){var _0x5952c2={};_0x5952c2[_0x4b23c4[_0xde73('0x2d')]]={'$like':'%'+_0xdf84c6[_0xde73('0x35')][_0xde73('0x41')]+'%'};return _0x5952c2;}})});}_0x12a2c9=_[_0xde73('0x42')]({},_0x12a2c9,_0xdf84c6[_0xde73('0x44')]);var _0x3080ac={'where':_0x12a2c9[_0xde73('0x3f')]};return db[_0xde73('0x30')]['count'](_0x3080ac)[_0xde73('0x29')](function(_0x582b8d){_0xa2f32e[_0xde73('0x22')]=_0x582b8d;if(_0xdf84c6[_0xde73('0x35')]['includeAll']){_0x12a2c9[_0xde73('0x45')]=[{'all':!![]}];}return db[_0xde73('0x30')][_0xde73('0x46')](_0x12a2c9);})[_0xde73('0x29')](function(_0x20cec9){_0xa2f32e[_0xde73('0x47')]=_0x20cec9;return _0xa2f32e;})[_0xde73('0x29')](respondWithFilteredResult(_0x1f7641,_0x12a2c9))[_0xde73('0x48')](handleError(_0x1f7641,null));};exports[_0xde73('0x49')]=function(_0x23faf1,_0x3c4d82){var _0x413042={'raw':![],'where':{'id':_0x23faf1[_0xde73('0x4a')]['id']}},_0x3bf07d={};_0x3bf07d[_0xde73('0x38')]=_[_0xde73('0x4b')](db[_0xde73('0x30')][_0xde73('0x31')]);_0x3bf07d['query']=_[_0xde73('0x4b')](_0x23faf1[_0xde73('0x35')]);_0x3bf07d[_0xde73('0x36')]=_[_0xde73('0x37')](_0x3bf07d['model'],_0x3bf07d[_0xde73('0x35')]);_0x413042[_0xde73('0x39')]=_[_0xde73('0x37')](_0x3bf07d[_0xde73('0x38')],qs[_0xde73('0x3a')](_0x23faf1['query'][_0xde73('0x3a')]));_0x413042['attributes']=_0x413042[_0xde73('0x39')]['length']?_0x413042[_0xde73('0x39')]:_0x3bf07d['model'];if(_0x23faf1[_0xde73('0x35')][_0xde73('0x4c')]){_0x413042[_0xde73('0x45')]=[{'all':!![]}];}_0x413042=_[_0xde73('0x42')]({},_0x413042,_0x23faf1[_0xde73('0x44')]);return db[_0xde73('0x30')][_0xde73('0x4d')](_0x413042)[_0xde73('0x29')](handleEntityNotFound(_0x3c4d82,null))['then'](respondWithResult(_0x3c4d82,null))['catch'](handleError(_0x3c4d82,null));};exports[_0xde73('0x4e')]=function(_0x475f0c,_0x3b1932){return db[_0xde73('0x30')]['create'](_0x475f0c[_0xde73('0x4f')],{})['then'](respondWithResult(_0x3b1932,0xc9))[_0xde73('0x48')](handleError(_0x3b1932,null));};exports['update']=function(_0x10ae2d,_0x5f31c9){if(_0x10ae2d[_0xde73('0x4f')]['id']){delete _0x10ae2d[_0xde73('0x4f')]['id'];}return db[_0xde73('0x30')][_0xde73('0x4d')]({'where':{'id':_0x10ae2d['params']['id']}})[_0xde73('0x29')](handleEntityNotFound(_0x5f31c9,null))[_0xde73('0x29')](saveUpdates(_0x10ae2d[_0xde73('0x4f')],null))[_0xde73('0x29')](respondWithResult(_0x5f31c9,null))[_0xde73('0x48')](handleError(_0x5f31c9,null));};exports[_0xde73('0x50')]=function(_0x2dd741,_0x2bb884){return db[_0xde73('0x30')][_0xde73('0x4d')]({'where':{'id':_0x2dd741[_0xde73('0x4a')]['id']}})[_0xde73('0x29')](handleEntityNotFound(_0x2bb884,null))[_0xde73('0x29')](removeEntity(_0x2bb884,null))[_0xde73('0x48')](handleError(_0x2bb884,null));};exports[_0xde73('0x51')]=function(_0xf97352,_0x109c29,_0x4501f5){var _0x149b76={};var _0x35e597={};var _0x534365;var _0x4710df;return db[_0xde73('0x30')][_0xde73('0x52')]({'where':{'id':_0xf97352['params']['id']}})[_0xde73('0x29')](handleEntityNotFound(_0x109c29,null))[_0xde73('0x29')](function(_0x1816b7){if(_0x1816b7){_0x534365=_0x1816b7;_0x35e597['model']=_[_0xde73('0x4b')](db['SugarcrmConfiguration'][_0xde73('0x31')]);_0x35e597[_0xde73('0x35')]=_[_0xde73('0x4b')](_0xf97352[_0xde73('0x35')]);_0x35e597['filters']=_[_0xde73('0x37')](_0x35e597[_0xde73('0x38')],_0x35e597[_0xde73('0x35')]);_0x149b76[_0xde73('0x39')]=_[_0xde73('0x37')](_0x35e597[_0xde73('0x38')],qs['fields'](_0xf97352['query'][_0xde73('0x3a')]));_0x149b76[_0xde73('0x39')]=_0x149b76[_0xde73('0x39')][_0xde73('0x53')]?_0x149b76[_0xde73('0x39')]:_0x35e597[_0xde73('0x38')];_0x149b76['order']=qs[_0xde73('0x3e')](_0xf97352[_0xde73('0x35')][_0xde73('0x3e')]);_0x149b76['where']=qs['filters'](_[_0xde73('0x40')](_0xf97352['query'],_0x35e597[_0xde73('0x36')]));if(_0xf97352[_0xde73('0x35')][_0xde73('0x41')]){_0x149b76[_0xde73('0x3f')]=_[_0xde73('0x42')](_0x149b76['where'],{'$or':_['map'](_0x149b76[_0xde73('0x39')],function(_0x142126){var _0x33ca94={};_0x33ca94[_0x142126]={'$like':'%'+_0xf97352[_0xde73('0x35')][_0xde73('0x41')]+'%'};return _0x33ca94;})});}_0x149b76=_[_0xde73('0x42')]({},_0x149b76,_0xf97352[_0xde73('0x44')]);return _0x534365[_0xde73('0x51')](_0x149b76);}})[_0xde73('0x29')](function(_0x5c774b){if(_0x5c774b){_0x4710df=_0x5c774b['length'];if(!_0xf97352['query']['hasOwnProperty'](_0xde73('0x3c'))){_0x149b76[_0xde73('0x21')]=qs[_0xde73('0x21')](_0xf97352[_0xde73('0x35')][_0xde73('0x21')]);_0x149b76['offset']=qs['offset'](_0xf97352[_0xde73('0x35')]['offset']);}return _0x534365['getConfigurations'](_0x149b76);}})[_0xde73('0x29')](function(_0x2a9ef3){if(_0x2a9ef3){return _0x2a9ef3?{'count':_0x4710df,'rows':_0x2a9ef3}:null;}})[_0xde73('0x29')](respondWithResult(_0x109c29,null))[_0xde73('0x48')](handleError(_0x109c29,null));};exports[_0xde73('0x54')]=function(_0x1f0f9d,_0x3d0e8b,_0xe6854b){if(_0x1f0f9d[_0xde73('0x4f')]['id']){delete _0x1f0f9d[_0xde73('0x4f')]['id'];}return db['SugarcrmAccount'][_0xde73('0x52')]({'where':{'id':_0x1f0f9d[_0xde73('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3d0e8b,null))[_0xde73('0x29')](function(_0x473257){if(_0x473257){_0x1f0f9d[_0xde73('0x4f')][_0xde73('0x55')]=_0x473257['id'];_0x1f0f9d[_0xde73('0x4f')][_0xde73('0x56')]=integrations[_0xde73('0x57')](_0x1f0f9d['body']['channel'],_0x1f0f9d[_0xde73('0x4f')][_0xde73('0x33')]);_0x1f0f9d[_0xde73('0x4f')][_0xde73('0x58')]=integrations['getDescriptions'](_0x1f0f9d[_0xde73('0x4f')][_0xde73('0x59')],_0x1f0f9d['body'][_0xde73('0x33')]);return db[_0xde73('0x5a')][_0xde73('0x4e')](_0x1f0f9d[_0xde73('0x4f')],{'include':[{'model':db[_0xde73('0x5b')],'as':_0xde73('0x56')},{'model':db[_0xde73('0x5b')],'as':'Descriptions'}]});}return null;})[_0xde73('0x29')](respondWithResult(_0x3d0e8b,null))[_0xde73('0x48')](handleError(_0x3d0e8b,null));};exports[_0xde73('0x5c')]=function(_0x19cdec,_0x47d8a9,_0x27b7e4){var _0x5e5bba='';var _0x15b65b=['id','name',_0xde73('0x5d'),_0xde73('0x5e'),'description','date_start',_0xde73('0x5f'),'duration_minutes',_0xde73('0x60'),_0xde73('0x61'),_0xde73('0x62'),_0xde73('0x63')];return db['SugarcrmAccount'][_0xde73('0x52')]({'where':{'id':_0x19cdec['params']['id']},'attributes':['id','username',_0xde73('0x64'),_0xde73('0x65')]})[_0xde73('0x29')](handleEntityNotFound(_0x47d8a9,null))[_0xde73('0x29')](function(_0x28fbb9){if(_0x28fbb9){_0x5e5bba=_0x28fbb9[_0xde73('0x65')];var _0x1b7e29=_0x5e5bba[_0xde73('0x66')](-0x1);if(_0x1b7e29==='/'){_0x5e5bba=_0x5e5bba['substring'](0x0,_0x5e5bba['lastIndexOf'](_0x1b7e29));}return rp({'method':'POST','uri':util[_0xde73('0x67')](_0xde73('0x68'),_0x5e5bba,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xde73('0x69'),'input_type':_0xde73('0x6a'),'response_type':_0xde73('0x6a'),'rest_data':JSON[_0xde73('0x6b')]({'user_auth':{'user_name':_0x28fbb9[_0xde73('0x6c')],'password':_0x28fbb9[_0xde73('0x64')],'encryption':_0xde73('0x6d')},'application':_0xde73('0x6e')})}});}})[_0xde73('0x29')](function(_0xf585a2){if(_0xf585a2&&_0xf585a2[_0xde73('0x2d')]!==_0xde73('0x6f')&&_0xf585a2['name']!==_0xde73('0x70')){return rp({'method':_0xde73('0x71'),'uri':util[_0xde73('0x67')]('%s%s',_0x5e5bba,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xde73('0x72'),'input_type':_0xde73('0x6a'),'response_type':_0xde73('0x6a'),'rest_data':JSON['stringify']({'session':_0xf585a2['id'],'module_name':'Calls'})}})[_0xde73('0x29')](function(_0x13a1bc){if(_0x13a1bc){var _0x520f8b=_[_0xde73('0x73')](_0x13a1bc[_0xde73('0x74')]);_[_0xde73('0x75')](_0x520f8b,function(_0x2fd8b2){return _0x15b65b[_0xde73('0x76')](_0x2fd8b2['name']);});return{'count':_0x520f8b[_0xde73('0x53')],'rows':_['map'](_0x520f8b,function(_0x4856b2){return{'id':_0x4856b2['name'],'name':_0x4856b2[_0xde73('0x77')],'custom':_['endsWith'](_0x4856b2[_0xde73('0x2d')],'_c')?!![]:![],'options':_0x4856b2[_0xde73('0x44')]?_[_0xde73('0x34')](_['values'](_0x4856b2[_0xde73('0x44')]),function(_0x4b7534){return{'name':_0x4b7534[_0xde73('0x78')],'value':_0x4b7534[_0xde73('0x2d')]};}):[]};})};}})[_0xde73('0x29')](respondWithResult(_0x47d8a9,null))[_0xde73('0x48')](function(_0x246fde){var _0x43cadb=_0x19cdec['query']['test']?0x1f4:_0x246fde[_0xde73('0x79')]||0x1f4;logger[_0xde73('0x2b')](_0xde73('0x7a'),'getFields',_0x43cadb,JSON['stringify'](_0x246fde));delete _0x246fde[_0xde73('0x2d')];if(_0x43cadb===0x191){_0x43cadb=0x190;}_0x47d8a9['status'](_0x43cadb)['send'](_0x19cdec[_0xde73('0x35')][_0xde73('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x246fde[_0xde73('0x79')]}:_0x246fde);});}else{var _0xb096f1=0x1f4;_0x47d8a9['status'](_0xb096f1)['send']({'message':_0xde73('0x7c'),'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 bf112d3..164b845 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 _0x6633=['api','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','lodash','util','../../config/logger'];(function(_0x52096b,_0x20bab4){var _0x2b1cc7=function(_0x3f7021){while(--_0x3f7021){_0x52096b['push'](_0x52096b['shift']());}};_0x2b1cc7(++_0x20bab4);}(_0x6633,0xfd));var _0x3663=function(_0x51e355,_0x200d69){_0x51e355=_0x51e355-0x0;var _0x3fca78=_0x6633[_0x51e355];return _0x3fca78;};'use strict';var _=require(_0x3663('0x0'));var util=require(_0x3663('0x1'));var logger=require(_0x3663('0x2'))(_0x3663('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3663('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3663('0x5'));var config=require(_0x3663('0x6'));var attributes=require(_0x3663('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3a8894,_0x51604b){return _0x3a8894['define']('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x896a=['util','../../config/logger','api','bluebird','path','rimraf','./intSugarcrmAccount.attributes','exports','int_sugarcrm_accounts','lodash'];(function(_0x579147,_0x501efe){var _0x43cc8e=function(_0x23793d){while(--_0x23793d){_0x579147['push'](_0x579147['shift']());}};_0x43cc8e(++_0x501efe);}(_0x896a,0x117));var _0xa896=function(_0xcd38bd,_0x5e0bbb){_0xcd38bd=_0xcd38bd-0x0;var _0x79c1f5=_0x896a[_0xcd38bd];return _0x79c1f5;};'use strict';var _=require(_0xa896('0x0'));var util=require(_0xa896('0x1'));var logger=require(_0xa896('0x2'))(_0xa896('0x3'));var moment=require('moment');var BPromise=require(_0xa896('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa896('0x5'));var rimraf=require(_0xa896('0x6'));var config=require('../../config/environment');var attributes=require(_0xa896('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xa896('0x8')]=function(_0x115233,_0x594c14){return _0x115233['define']('SugarcrmAccount',attributes,{'tableName':_0xa896('0x9'),'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 23d6efd..cb57afc 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 _0x4a06=['limit','include','attributes','map','model','ShowSugarcrmAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetSugarcrmAccount','SugarcrmAccount','options','raw','where'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x4a06,0x8b));var _0x64a0=function(_0x3cb281,_0x1c0ced){_0x3cb281=_0x3cb281-0x0;var _0x32a5cf=_0x4a06[_0x3cb281];return _0x32a5cf;};'use strict';var _=require(_0x64a0('0x0'));var util=require(_0x64a0('0x1'));var moment=require(_0x64a0('0x2'));var BPromise=require('bluebird');var rs=require(_0x64a0('0x3'));var fs=require('fs');var Redis=require(_0x64a0('0x4'));var db=require(_0x64a0('0x5'))['db'];var utils=require(_0x64a0('0x6'));var logger=require(_0x64a0('0x7'))('rpc');var config=require(_0x64a0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x64a0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x213363,_0x4f035a,_0x406f34){return new BPromise(function(_0x50ceba,_0x1b13ab){return client[_0x64a0('0xa')](_0x213363,_0x406f34)[_0x64a0('0xb')](function(_0x3bc7be){logger[_0x64a0('0xc')](_0x64a0('0xd'),_0x4f035a,'request\x20sent');logger[_0x64a0('0xe')](_0x64a0('0xf'),_0x4f035a,_0x64a0('0x10'),JSON[_0x64a0('0x11')](_0x3bc7be));if(_0x3bc7be['error']){if(_0x3bc7be[_0x64a0('0x12')]['code']===0x1f4){logger[_0x64a0('0x12')](_0x64a0('0xd'),_0x4f035a,_0x3bc7be[_0x64a0('0x12')]['message']);return _0x1b13ab(_0x3bc7be[_0x64a0('0x12')][_0x64a0('0x13')]);}logger[_0x64a0('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x4f035a,_0x3bc7be[_0x64a0('0x12')]['message']);return _0x50ceba(_0x3bc7be['error'][_0x64a0('0x13')]);}else{logger[_0x64a0('0xc')](_0x64a0('0xd'),_0x4f035a,_0x64a0('0x10'));_0x50ceba(_0x3bc7be[_0x64a0('0x14')][_0x64a0('0x13')]);}})['catch'](function(_0x1a2bb6){logger[_0x64a0('0x12')]('SugarcrmAccount,\x20%s,\x20%s',_0x4f035a,_0x1a2bb6);_0x1b13ab(_0x1a2bb6);});});}exports[_0x64a0('0x15')]=function(_0x5a05c7){var _0x475294=this;return new Promise(function(_0x2eb75e,_0x439cde){return db[_0x64a0('0x16')]['findAll']({'raw':_0x5a05c7[_0x64a0('0x17')]?_0x5a05c7[_0x64a0('0x17')][_0x64a0('0x18')]===undefined?!![]:![]:!![],'where':_0x5a05c7['options']?_0x5a05c7[_0x64a0('0x17')][_0x64a0('0x19')]||null:null,'attributes':_0x5a05c7[_0x64a0('0x17')]?_0x5a05c7[_0x64a0('0x17')]['attributes']||null:null,'limit':_0x5a05c7['options']?_0x5a05c7[_0x64a0('0x17')][_0x64a0('0x1a')]||null:null,'include':_0x5a05c7[_0x64a0('0x17')]?_0x5a05c7[_0x64a0('0x17')][_0x64a0('0x1b')]?_['map'](_0x5a05c7[_0x64a0('0x17')][_0x64a0('0x1b')],function(_0x2866c1){return{'model':db[_0x2866c1['model']],'as':_0x2866c1['as'],'attributes':_0x2866c1[_0x64a0('0x1c')],'include':_0x2866c1[_0x64a0('0x1b')]?_[_0x64a0('0x1d')](_0x2866c1[_0x64a0('0x1b')],function(_0x2f9b2e){return{'model':db[_0x2f9b2e[_0x64a0('0x1e')]],'as':_0x2f9b2e['as'],'attributes':_0x2f9b2e[_0x64a0('0x1c')],'include':_0x2f9b2e['include']?_['map'](_0x2f9b2e['include'],function(_0x29686d){return{'model':db[_0x29686d['model']],'as':_0x29686d['as'],'attributes':_0x29686d[_0x64a0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x64a0('0xb')](function(_0x4e9227){logger['info'](_0x64a0('0x15'),_0x5a05c7);logger[_0x64a0('0xe')]('GetSugarcrmAccount',_0x5a05c7,JSON[_0x64a0('0x11')](_0x4e9227));_0x2eb75e(_0x4e9227);})['catch'](function(_0xdc9a4f){logger['error'](_0x64a0('0x15'),_0xdc9a4f['message'],_0x5a05c7);_0x439cde(_0x475294[_0x64a0('0x12')](0x1f4,_0xdc9a4f['message']));});});};exports[_0x64a0('0x1f')]=function(_0x5ccbcf){var _0x2c7352=this;return new Promise(function(_0x305895,_0x446974){return db[_0x64a0('0x16')][_0x64a0('0x20')]({'raw':_0x5ccbcf['options']?_0x5ccbcf[_0x64a0('0x17')][_0x64a0('0x18')]===undefined?!![]:![]:!![],'where':_0x5ccbcf[_0x64a0('0x17')]?_0x5ccbcf[_0x64a0('0x17')][_0x64a0('0x19')]||null:null,'attributes':_0x5ccbcf[_0x64a0('0x17')]?_0x5ccbcf['options'][_0x64a0('0x1c')]||null:null,'include':_0x5ccbcf[_0x64a0('0x17')]?_0x5ccbcf[_0x64a0('0x17')]['include']?_[_0x64a0('0x1d')](_0x5ccbcf['options'][_0x64a0('0x1b')],function(_0x513863){return{'model':db[_0x513863['model']],'as':_0x513863['as'],'attributes':_0x513863[_0x64a0('0x1c')],'include':_0x513863[_0x64a0('0x1b')]?_[_0x64a0('0x1d')](_0x513863[_0x64a0('0x1b')],function(_0x55d091){return{'model':db[_0x55d091[_0x64a0('0x1e')]],'as':_0x55d091['as'],'attributes':_0x55d091[_0x64a0('0x1c')],'include':_0x55d091['include']?_[_0x64a0('0x1d')](_0x55d091[_0x64a0('0x1b')],function(_0x205e7b){return{'model':db[_0x205e7b[_0x64a0('0x1e')]],'as':_0x205e7b['as'],'attributes':_0x205e7b[_0x64a0('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b6936){logger[_0x64a0('0xc')]('ShowSugarcrmAccount',_0x5ccbcf);logger[_0x64a0('0xe')](_0x64a0('0x1f'),_0x5ccbcf,JSON[_0x64a0('0x11')](_0x4b6936));_0x305895(_0x4b6936);})['catch'](function(_0x326d42){logger[_0x64a0('0x12')](_0x64a0('0x1f'),_0x326d42['message'],_0x5ccbcf);_0x446974(_0x2c7352['error'](0x1f4,_0x326d42['message']));});});}; \ No newline at end of file +var _0x06f5=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','message','catch','GetSugarcrmAccount','findAll','options','raw','where','limit','map','include','attributes','model','stringify','ShowSugarcrmAccount','SugarcrmAccount','lodash','moment','bluebird','ioredis'];(function(_0x58fd78,_0x5dd8a8){var _0x17e364=function(_0x5bac3b){while(--_0x5bac3b){_0x58fd78['push'](_0x58fd78['shift']());}};_0x17e364(++_0x5dd8a8);}(_0x06f5,0x80));var _0x506f=function(_0x1c961d,_0x5999e6){_0x1c961d=_0x1c961d-0x0;var _0xfef1d=_0x06f5[_0x1c961d];return _0xfef1d;};'use strict';var _=require(_0x506f('0x0'));var util=require('util');var moment=require(_0x506f('0x1'));var BPromise=require(_0x506f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x506f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x506f('0x4'));var logger=require(_0x506f('0x5'))(_0x506f('0x6'));var config=require(_0x506f('0x7'));var jayson=require(_0x506f('0x8'));var client=jayson[_0x506f('0x9')][_0x506f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a713a,_0x427f8c,_0x8b917b){return new BPromise(function(_0x3ad528,_0x55219c){return client['request'](_0x5a713a,_0x8b917b)[_0x506f('0xb')](function(_0x5e4337){logger[_0x506f('0xc')](_0x506f('0xd'),_0x427f8c,_0x506f('0xe'));logger[_0x506f('0xf')](_0x506f('0x10'),_0x427f8c,_0x506f('0xe'),JSON['stringify'](_0x5e4337));if(_0x5e4337[_0x506f('0x11')]){if(_0x5e4337['error']['code']===0x1f4){logger['error'](_0x506f('0xd'),_0x427f8c,_0x5e4337[_0x506f('0x11')][_0x506f('0x12')]);return _0x55219c(_0x5e4337['error']['message']);}logger[_0x506f('0x11')](_0x506f('0xd'),_0x427f8c,_0x5e4337[_0x506f('0x11')]['message']);return _0x3ad528(_0x5e4337[_0x506f('0x11')]['message']);}else{logger[_0x506f('0xc')](_0x506f('0xd'),_0x427f8c,_0x506f('0xe'));_0x3ad528(_0x5e4337['result'][_0x506f('0x12')]);}})[_0x506f('0x13')](function(_0x58d101){logger['error'](_0x506f('0xd'),_0x427f8c,_0x58d101);_0x55219c(_0x58d101);});});}exports[_0x506f('0x14')]=function(_0xb2e854){var _0x1f9c10=this;return new Promise(function(_0x218b8b,_0x298313){return db['SugarcrmAccount'][_0x506f('0x15')]({'raw':_0xb2e854['options']?_0xb2e854[_0x506f('0x16')][_0x506f('0x17')]===undefined?!![]:![]:!![],'where':_0xb2e854[_0x506f('0x16')]?_0xb2e854['options'][_0x506f('0x18')]||null:null,'attributes':_0xb2e854[_0x506f('0x16')]?_0xb2e854[_0x506f('0x16')]['attributes']||null:null,'limit':_0xb2e854['options']?_0xb2e854[_0x506f('0x16')][_0x506f('0x19')]||null:null,'include':_0xb2e854[_0x506f('0x16')]?_0xb2e854['options']['include']?_[_0x506f('0x1a')](_0xb2e854[_0x506f('0x16')][_0x506f('0x1b')],function(_0x5aea31){return{'model':db[_0x5aea31['model']],'as':_0x5aea31['as'],'attributes':_0x5aea31[_0x506f('0x1c')],'include':_0x5aea31['include']?_[_0x506f('0x1a')](_0x5aea31['include'],function(_0x2bc1c1){return{'model':db[_0x2bc1c1[_0x506f('0x1d')]],'as':_0x2bc1c1['as'],'attributes':_0x2bc1c1[_0x506f('0x1c')],'include':_0x2bc1c1[_0x506f('0x1b')]?_[_0x506f('0x1a')](_0x2bc1c1['include'],function(_0x2d921a){return{'model':db[_0x2d921a[_0x506f('0x1d')]],'as':_0x2d921a['as'],'attributes':_0x2d921a[_0x506f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x506f('0xb')](function(_0x272562){logger[_0x506f('0xc')](_0x506f('0x14'),_0xb2e854);logger[_0x506f('0xf')](_0x506f('0x14'),_0xb2e854,JSON[_0x506f('0x1e')](_0x272562));_0x218b8b(_0x272562);})[_0x506f('0x13')](function(_0x4b1f25){logger[_0x506f('0x11')](_0x506f('0x14'),_0x4b1f25[_0x506f('0x12')],_0xb2e854);_0x298313(_0x1f9c10['error'](0x1f4,_0x4b1f25[_0x506f('0x12')]));});});};exports[_0x506f('0x1f')]=function(_0xe7343){var _0x3f122e=this;return new Promise(function(_0x35e382,_0x203a01){return db[_0x506f('0x20')]['find']({'raw':_0xe7343[_0x506f('0x16')]?_0xe7343[_0x506f('0x16')][_0x506f('0x17')]===undefined?!![]:![]:!![],'where':_0xe7343[_0x506f('0x16')]?_0xe7343[_0x506f('0x16')]['where']||null:null,'attributes':_0xe7343[_0x506f('0x16')]?_0xe7343['options']['attributes']||null:null,'include':_0xe7343[_0x506f('0x16')]?_0xe7343['options'][_0x506f('0x1b')]?_[_0x506f('0x1a')](_0xe7343[_0x506f('0x16')][_0x506f('0x1b')],function(_0x2b0fc4){return{'model':db[_0x2b0fc4['model']],'as':_0x2b0fc4['as'],'attributes':_0x2b0fc4[_0x506f('0x1c')],'include':_0x2b0fc4[_0x506f('0x1b')]?_[_0x506f('0x1a')](_0x2b0fc4['include'],function(_0x5cc196){return{'model':db[_0x5cc196['model']],'as':_0x5cc196['as'],'attributes':_0x5cc196['attributes'],'include':_0x5cc196['include']?_[_0x506f('0x1a')](_0x5cc196['include'],function(_0x5b9879){return{'model':db[_0x5b9879['model']],'as':_0x5b9879['as'],'attributes':_0x5b9879[_0x506f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x506f('0xb')](function(_0x5b8dc9){logger[_0x506f('0xc')]('ShowSugarcrmAccount',_0xe7343);logger['debug']('ShowSugarcrmAccount',_0xe7343,JSON['stringify'](_0x5b8dc9));_0x35e382(_0x5b8dc9);})[_0x506f('0x13')](function(_0x30bab5){logger[_0x506f('0x11')](_0x506f('0x1f'),_0x30bab5[_0x506f('0x12')],_0xe7343);_0x203a01(_0x3f122e[_0x506f('0x11')](0x1f4,_0x30bab5['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 766a031..d350662 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 _0x9411=['getDescriptions','post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','/:id','show','/:id/fields','getFields','get','/:id/subjects'];(function(_0x6ccf3f,_0x5cf069){var _0x37f31f=function(_0x53eba4){while(--_0x53eba4){_0x6ccf3f['push'](_0x6ccf3f['shift']());}};_0x37f31f(++_0x5cf069);}(_0x9411,0x160));var _0x1941=function(_0x33bc62,_0x551cdf){_0x33bc62=_0x33bc62-0x0;var _0x166502=_0x9411[_0x33bc62];return _0x166502;};'use strict';var multer=require(_0x1941('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1941('0x1'));var express=require(_0x1941('0x2'));var router=express[_0x1941('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1941('0x4'));var interaction=require(_0x1941('0x5'));var config=require(_0x1941('0x6'));var controller=require(_0x1941('0x7'));router['get']('/',auth[_0x1941('0x8')](),controller[_0x1941('0x9')]);router['get'](_0x1941('0xa'),auth[_0x1941('0x8')](),controller[_0x1941('0xb')]);router['get'](_0x1941('0xc'),auth[_0x1941('0x8')](),controller[_0x1941('0xd')]);router[_0x1941('0xe')](_0x1941('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x1941('0xe')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x1941('0x10')]);router[_0x1941('0x11')]('/',auth['isAuthenticated'](),controller[_0x1941('0x12')]);router['put'](_0x1941('0xa'),auth[_0x1941('0x8')](),controller[_0x1941('0x13')]);router[_0x1941('0x14')]('/:id',auth[_0x1941('0x8')](),controller[_0x1941('0x15')]);module[_0x1941('0x16')]=router; \ No newline at end of file +var _0x7e87=['/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3434bb,_0x1c576b){var _0xe558f8=function(_0x525b45){while(--_0x525b45){_0x3434bb['push'](_0x3434bb['shift']());}};_0xe558f8(++_0x1c576b);}(_0x7e87,0x172));var _0x77e8=function(_0x3e6759,_0x3798f6){_0x3e6759=_0x3e6759-0x0;var _0x2b9aea=_0x7e87[_0x3e6759];return _0x2b9aea;};'use strict';var multer=require('multer');var util=require(_0x77e8('0x0'));var path=require(_0x77e8('0x1'));var timeout=require(_0x77e8('0x2'));var express=require(_0x77e8('0x3'));var router=express[_0x77e8('0x4')]();var fs_extra=require(_0x77e8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x77e8('0x6'));var config=require(_0x77e8('0x7'));var controller=require(_0x77e8('0x8'));router[_0x77e8('0x9')]('/',auth[_0x77e8('0xa')](),controller[_0x77e8('0xb')]);router['get'](_0x77e8('0xc'),auth['isAuthenticated'](),controller[_0x77e8('0xd')]);router['get'](_0x77e8('0xe'),auth[_0x77e8('0xa')](),controller[_0x77e8('0xf')]);router[_0x77e8('0x9')](_0x77e8('0x10'),auth[_0x77e8('0xa')](),controller['getSubjects']);router['get'](_0x77e8('0x11'),auth[_0x77e8('0xa')](),controller[_0x77e8('0x12')]);router['post']('/',auth[_0x77e8('0xa')](),controller[_0x77e8('0x13')]);router[_0x77e8('0x14')](_0x77e8('0xc'),auth[_0x77e8('0xa')](),controller['update']);router[_0x77e8('0x15')](_0x77e8('0xc'),auth['isAuthenticated'](),controller[_0x77e8('0x16')]);module[_0x77e8('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index cf8acab..9be19b3 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 _0x4fa1=['exports','STRING'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0x4fa1,0x184));var _0x14fa=function(_0x584a8c,_0x1da55b){_0x584a8c=_0x584a8c-0x0;var _0x4fc436=_0x4fa1[_0x584a8c];return _0x4fc436;};'use strict';var Sequelize=require('sequelize');module[_0x14fa('0x0')]={'name':{'type':Sequelize[_0x14fa('0x1')]},'description':{'type':Sequelize[_0x14fa('0x1')]}}; \ No newline at end of file +var _0x7b8b=['STRING','sequelize','exports'];(function(_0x1a2081,_0x590a4e){var _0x448e71=function(_0x32cb30){while(--_0x32cb30){_0x1a2081['push'](_0x1a2081['shift']());}};_0x448e71(++_0x590a4e);}(_0x7b8b,0x145));var _0xb7b8=function(_0xd2d54,_0x5329f7){_0xd2d54=_0xd2d54-0x0;var _0x78b113=_0x7b8b[_0xd2d54];return _0x78b113;};'use strict';var Sequelize=require(_0xb7b8('0x0'));module[_0xb7b8('0x1')]={'name':{'type':Sequelize[_0xb7b8('0x2')]},'description':{'type':Sequelize[_0xb7b8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index a24b938..7a0759c 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 _0xafec=['find','params','getFields','SugarcrmField','fields','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','json','apply','reject','save','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','SugarcrmConfiguration','includeAll','findAll','rows','catch','show','filters','include','create','body','update'];(function(_0x54bb88,_0x532967){var _0x3fd594=function(_0x2ec90f){while(--_0x2ec90f){_0x54bb88['push'](_0x54bb88['shift']());}};_0x3fd594(++_0x532967);}(_0xafec,0x1f4));var _0xcafe=function(_0x49e1c5,_0x1f4a4f){_0x49e1c5=_0x49e1c5-0x0;var _0x576240=_0xafec[_0x49e1c5];return _0x576240;};'use strict';var emlformat=require(_0xcafe('0x0'));var rimraf=require(_0xcafe('0x1'));var zipdir=require(_0xcafe('0x2'));var jsonpatch=require(_0xcafe('0x3'));var rp=require(_0xcafe('0x4'));var moment=require('moment');var BPromise=require(_0xcafe('0x5'));var Mustache=require('mustache');var util=require(_0xcafe('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcafe('0x7'));var fs=require('fs');var fs_extra=require(_0xcafe('0x8'));var _=require('lodash');var squel=require(_0xcafe('0x9'));var crypto=require(_0xcafe('0xa'));var jsforce=require(_0xcafe('0xb'));var deskjs=require(_0xcafe('0xc'));var toCsv=require(_0xcafe('0xd'));var querystring=require(_0xcafe('0xe'));var Papa=require(_0xcafe('0xf'));var Redis=require('ioredis');var authService=require(_0xcafe('0x10'));var qs=require(_0xcafe('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcafe('0x12'));var logger=require(_0xcafe('0x13'))(_0xcafe('0x14'));var utils=require(_0xcafe('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xcafe('0x16'));var db=require(_0xcafe('0x17'))['db'];function respondWithStatusCode(_0x4ea913,_0x8d44dc){_0x8d44dc=_0x8d44dc||0xcc;return function(_0x21146a){if(_0x21146a){return _0x4ea913[_0xcafe('0x18')](_0x8d44dc);}return _0x4ea913[_0xcafe('0x19')](_0x8d44dc)['end']();};}function respondWithResult(_0x5bab50,_0x1eff54){_0x1eff54=_0x1eff54||0xc8;return function(_0x33d130){if(_0x33d130){return _0x5bab50[_0xcafe('0x19')](_0x1eff54)['json'](_0x33d130);}};}function respondWithFilteredResult(_0xc9b11c,_0x2988c6){return function(_0x14c50b){if(_0x14c50b){var _0x4776b6=typeof _0x2988c6['offset']===_0xcafe('0x1a')&&typeof _0x2988c6[_0xcafe('0x1b')]===_0xcafe('0x1a');var _0x2feebc=_0x14c50b[_0xcafe('0x1c')];var _0x388ef2=_0x4776b6?0x0:_0x2988c6[_0xcafe('0x1d')];var _0xdcecb0=_0x4776b6?_0x14c50b['count']:_0x2988c6[_0xcafe('0x1d')]+_0x2988c6['limit'];var _0x4d6ed6;if(_0xdcecb0>=_0x2feebc){_0xdcecb0=_0x2feebc;_0x4d6ed6=0xc8;}else{_0x4d6ed6=0xce;}_0xc9b11c[_0xcafe('0x19')](_0x4d6ed6);return _0xc9b11c[_0xcafe('0x1e')]('Content-Range',_0x388ef2+'-'+_0xdcecb0+'/'+_0x2feebc)[_0xcafe('0x1f')](_0x14c50b);}return null;};}function patchUpdates(_0x215709){return function(_0x29b701){try{jsonpatch[_0xcafe('0x20')](_0x29b701,_0x215709,!![]);}catch(_0x5c17b6){return BPromise[_0xcafe('0x21')](_0x5c17b6);}return _0x29b701[_0xcafe('0x22')]();};}function saveUpdates(_0x3d3526,_0x44d356){return function(_0x2bc2bf){if(_0x2bc2bf){return _0x2bc2bf['update'](_0x3d3526)[_0xcafe('0x23')](function(_0x4740a4){return _0x4740a4;});}return null;};}function removeEntity(_0x3b7f26,_0x21d49e){return function(_0x487d09){if(_0x487d09){return _0x487d09[_0xcafe('0x24')]()['then'](function(){_0x3b7f26[_0xcafe('0x19')](0xcc)[_0xcafe('0x25')]();});}};}function handleEntityNotFound(_0x53eb6d,_0x1f7cdf){return function(_0x302d11){if(!_0x302d11){_0x53eb6d[_0xcafe('0x18')](0x194);}return _0x302d11;};}function handleError(_0x3b1d36,_0x3aca6c){_0x3aca6c=_0x3aca6c||0x1f4;return function(_0x407529){logger['error'](_0x407529[_0xcafe('0x26')]);if(_0x407529['name']){delete _0x407529[_0xcafe('0x27')];}_0x3b1d36[_0xcafe('0x19')](_0x3aca6c)[_0xcafe('0x28')](_0x407529);};}exports[_0xcafe('0x29')]=function(_0x56cc56,_0x2da600){var _0x2d09eb={},_0x4a70de={},_0x55c034={'count':0x0,'rows':[]};var _0x4d6449=_[_0xcafe('0x2a')](db['SugarcrmConfiguration'][_0xcafe('0x2b')],function(_0x3b3933){return{'name':_0x3b3933[_0xcafe('0x2c')],'type':_0x3b3933[_0xcafe('0x2d')][_0xcafe('0x2e')]};});_0x4a70de[_0xcafe('0x2f')]=_[_0xcafe('0x2a')](_0x4d6449,_0xcafe('0x27'));_0x4a70de[_0xcafe('0x30')]=_[_0xcafe('0x31')](_0x56cc56[_0xcafe('0x30')]);_0x4a70de['filters']=_[_0xcafe('0x32')](_0x4a70de[_0xcafe('0x2f')],_0x4a70de['query']);_0x2d09eb[_0xcafe('0x33')]=_[_0xcafe('0x32')](_0x4a70de[_0xcafe('0x2f')],qs['fields'](_0x56cc56[_0xcafe('0x30')]['fields']));_0x2d09eb[_0xcafe('0x33')]=_0x2d09eb[_0xcafe('0x33')][_0xcafe('0x34')]?_0x2d09eb[_0xcafe('0x33')]:_0x4a70de[_0xcafe('0x2f')];if(!_0x56cc56[_0xcafe('0x30')][_0xcafe('0x35')](_0xcafe('0x36'))){_0x2d09eb[_0xcafe('0x1b')]=qs[_0xcafe('0x1b')](_0x56cc56['query'][_0xcafe('0x1b')]);_0x2d09eb[_0xcafe('0x1d')]=qs[_0xcafe('0x1d')](_0x56cc56['query']['offset']);}_0x2d09eb[_0xcafe('0x37')]=qs['sort'](_0x56cc56[_0xcafe('0x30')][_0xcafe('0x38')]);_0x2d09eb['where']=qs['filters'](_[_0xcafe('0x39')](_0x56cc56['query'],_0x4a70de['filters']),_0x4d6449);if(_0x56cc56[_0xcafe('0x30')][_0xcafe('0x3a')]){_0x2d09eb[_0xcafe('0x3b')]=_[_0xcafe('0x3c')](_0x2d09eb['where'],{'$or':_[_0xcafe('0x2a')](_0x4d6449,function(_0x3519c9){if(_0x3519c9[_0xcafe('0x2d')]!==_0xcafe('0x3d')){var _0x377f0f={};_0x377f0f[_0x3519c9['name']]={'$like':'%'+_0x56cc56[_0xcafe('0x30')][_0xcafe('0x3a')]+'%'};return _0x377f0f;}})});}_0x2d09eb=_[_0xcafe('0x3c')]({},_0x2d09eb,_0x56cc56[_0xcafe('0x3e')]);var _0x141328={'where':_0x2d09eb[_0xcafe('0x3b')]};return db[_0xcafe('0x3f')][_0xcafe('0x1c')](_0x141328)[_0xcafe('0x23')](function(_0x5b1bff){_0x55c034[_0xcafe('0x1c')]=_0x5b1bff;if(_0x56cc56['query'][_0xcafe('0x40')]){_0x2d09eb['include']=[{'all':!![]}];}return db[_0xcafe('0x3f')][_0xcafe('0x41')](_0x2d09eb);})[_0xcafe('0x23')](function(_0x3b3ae7){_0x55c034[_0xcafe('0x42')]=_0x3b3ae7;return _0x55c034;})['then'](respondWithFilteredResult(_0x2da600,_0x2d09eb))[_0xcafe('0x43')](handleError(_0x2da600,null));};exports[_0xcafe('0x44')]=function(_0x2ca603,_0x2f703a){var _0x1cde60={'raw':![],'where':{'id':_0x2ca603['params']['id']}},_0x5bc4f3={};_0x5bc4f3[_0xcafe('0x2f')]=_[_0xcafe('0x31')](db[_0xcafe('0x3f')][_0xcafe('0x2b')]);_0x5bc4f3[_0xcafe('0x30')]=_[_0xcafe('0x31')](_0x2ca603[_0xcafe('0x30')]);_0x5bc4f3[_0xcafe('0x45')]=_[_0xcafe('0x32')](_0x5bc4f3[_0xcafe('0x2f')],_0x5bc4f3[_0xcafe('0x30')]);_0x1cde60[_0xcafe('0x33')]=_[_0xcafe('0x32')](_0x5bc4f3['model'],qs['fields'](_0x2ca603[_0xcafe('0x30')]['fields']));_0x1cde60[_0xcafe('0x33')]=_0x1cde60[_0xcafe('0x33')][_0xcafe('0x34')]?_0x1cde60[_0xcafe('0x33')]:_0x5bc4f3[_0xcafe('0x2f')];if(_0x2ca603[_0xcafe('0x30')][_0xcafe('0x40')]){_0x1cde60[_0xcafe('0x46')]=[{'all':!![]}];}_0x1cde60=_[_0xcafe('0x3c')]({},_0x1cde60,_0x2ca603['options']);return db[_0xcafe('0x3f')]['find'](_0x1cde60)[_0xcafe('0x23')](handleEntityNotFound(_0x2f703a,null))[_0xcafe('0x23')](respondWithResult(_0x2f703a,null))[_0xcafe('0x43')](handleError(_0x2f703a,null));};exports[_0xcafe('0x47')]=function(_0x5df609,_0x651a17){return db['SugarcrmConfiguration']['create'](_0x5df609[_0xcafe('0x48')],{})[_0xcafe('0x23')](respondWithResult(_0x651a17,0xc9))['catch'](handleError(_0x651a17,null));};exports[_0xcafe('0x49')]=function(_0x345827,_0x416a45){if(_0x345827[_0xcafe('0x48')]['id']){delete _0x345827[_0xcafe('0x48')]['id'];}return db[_0xcafe('0x3f')][_0xcafe('0x4a')]({'where':{'id':_0x345827[_0xcafe('0x4b')]['id']}})[_0xcafe('0x23')](handleEntityNotFound(_0x416a45,null))[_0xcafe('0x23')](saveUpdates(_0x345827[_0xcafe('0x48')],null))[_0xcafe('0x23')](respondWithResult(_0x416a45,null))[_0xcafe('0x43')](handleError(_0x416a45,null));};exports[_0xcafe('0x24')]=function(_0x115348,_0x3b1a16){return db[_0xcafe('0x3f')][_0xcafe('0x4a')]({'where':{'id':_0x115348[_0xcafe('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3b1a16,null))[_0xcafe('0x23')](removeEntity(_0x3b1a16,null))[_0xcafe('0x43')](handleError(_0x3b1a16,null));};exports[_0xcafe('0x4c')]=function(_0x25e6ad,_0x534b31,_0x402f13){var _0x22e121={};var _0x4ac449={};var _0x4292d2;var _0x50d060;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x25e6ad[_0xcafe('0x4b')]['id']}})[_0xcafe('0x23')](handleEntityNotFound(_0x534b31,null))['then'](function(_0x2d334e){if(_0x2d334e){_0x4292d2=_0x2d334e;_0x4ac449[_0xcafe('0x2f')]=_['keys'](db[_0xcafe('0x4d')][_0xcafe('0x2b')]);_0x4ac449[_0xcafe('0x30')]=_[_0xcafe('0x31')](_0x25e6ad[_0xcafe('0x30')]);_0x4ac449[_0xcafe('0x45')]=_[_0xcafe('0x32')](_0x4ac449[_0xcafe('0x2f')],_0x4ac449[_0xcafe('0x30')]);_0x22e121[_0xcafe('0x33')]=_[_0xcafe('0x32')](_0x4ac449[_0xcafe('0x2f')],qs[_0xcafe('0x4e')](_0x25e6ad[_0xcafe('0x30')][_0xcafe('0x4e')]));_0x22e121['attributes']=_0x22e121[_0xcafe('0x33')][_0xcafe('0x34')]?_0x22e121[_0xcafe('0x33')]:_0x4ac449[_0xcafe('0x2f')];_0x22e121[_0xcafe('0x37')]=qs[_0xcafe('0x38')](_0x25e6ad[_0xcafe('0x30')][_0xcafe('0x38')]);_0x22e121[_0xcafe('0x3b')]=qs[_0xcafe('0x45')](_['pick'](_0x25e6ad[_0xcafe('0x30')],_0x4ac449['filters']));if(_0x25e6ad[_0xcafe('0x30')][_0xcafe('0x3a')]){_0x22e121[_0xcafe('0x3b')]=_['merge'](_0x22e121['where'],{'$or':_['map'](_0x22e121[_0xcafe('0x33')],function(_0x3217a7){var _0x4d3a73={};_0x4d3a73[_0x3217a7]={'$like':'%'+_0x25e6ad['query'][_0xcafe('0x3a')]+'%'};return _0x4d3a73;})});}_0x22e121=_[_0xcafe('0x3c')]({},_0x22e121,_0x25e6ad[_0xcafe('0x3e')]);return _0x4292d2[_0xcafe('0x4c')](_0x22e121);}})[_0xcafe('0x23')](function(_0x38ad51){if(_0x38ad51){_0x50d060=_0x38ad51[_0xcafe('0x34')];if(!_0x25e6ad[_0xcafe('0x30')][_0xcafe('0x35')]('nolimit')){_0x22e121['limit']=qs[_0xcafe('0x1b')](_0x25e6ad[_0xcafe('0x30')][_0xcafe('0x1b')]);_0x22e121['offset']=qs[_0xcafe('0x1d')](_0x25e6ad[_0xcafe('0x30')][_0xcafe('0x1d')]);}return _0x4292d2[_0xcafe('0x4c')](_0x22e121);}})[_0xcafe('0x23')](function(_0x18a812){if(_0x18a812){return _0x18a812?{'count':_0x50d060,'rows':_0x18a812}:null;}})['then'](respondWithResult(_0x534b31,null))[_0xcafe('0x43')](handleError(_0x534b31,null));};exports[_0xcafe('0x4f')]=function(_0x5f4df5,_0x15ea7c,_0x53928d){var _0x2d894e={};var _0xe54b9e={};var _0x5a1378;var _0x28ddc9;return db[_0xcafe('0x3f')][_0xcafe('0x50')]({'where':{'id':_0x5f4df5[_0xcafe('0x4b')]['id']}})[_0xcafe('0x23')](handleEntityNotFound(_0x15ea7c,null))[_0xcafe('0x23')](function(_0xa0506){if(_0xa0506){_0x5a1378=_0xa0506;_0xe54b9e[_0xcafe('0x2f')]=_[_0xcafe('0x31')](db[_0xcafe('0x4d')][_0xcafe('0x2b')]);_0xe54b9e[_0xcafe('0x30')]=_['keys'](_0x5f4df5['query']);_0xe54b9e[_0xcafe('0x45')]=_[_0xcafe('0x32')](_0xe54b9e['model'],_0xe54b9e[_0xcafe('0x30')]);_0x2d894e['attributes']=_[_0xcafe('0x32')](_0xe54b9e[_0xcafe('0x2f')],qs[_0xcafe('0x4e')](_0x5f4df5[_0xcafe('0x30')][_0xcafe('0x4e')]));_0x2d894e[_0xcafe('0x33')]=_0x2d894e['attributes'][_0xcafe('0x34')]?_0x2d894e['attributes']:_0xe54b9e[_0xcafe('0x2f')];_0x2d894e['order']=qs[_0xcafe('0x38')](_0x5f4df5[_0xcafe('0x30')][_0xcafe('0x38')]);_0x2d894e[_0xcafe('0x3b')]=qs['filters'](_[_0xcafe('0x39')](_0x5f4df5[_0xcafe('0x30')],_0xe54b9e[_0xcafe('0x45')]));if(_0x5f4df5['query'][_0xcafe('0x3a')]){_0x2d894e['where']=_[_0xcafe('0x3c')](_0x2d894e[_0xcafe('0x3b')],{'$or':_[_0xcafe('0x2a')](_0x2d894e[_0xcafe('0x33')],function(_0x29cf6f){var _0x538a46={};_0x538a46[_0x29cf6f]={'$like':'%'+_0x5f4df5[_0xcafe('0x30')][_0xcafe('0x3a')]+'%'};return _0x538a46;})});}_0x2d894e=_['merge']({},_0x2d894e,_0x5f4df5['options']);return _0x5a1378[_0xcafe('0x4f')](_0x2d894e);}})[_0xcafe('0x23')](function(_0x2f9884){if(_0x2f9884){_0x28ddc9=_0x2f9884[_0xcafe('0x34')];if(!_0x5f4df5['query']['hasOwnProperty']('nolimit')){_0x2d894e['limit']=qs[_0xcafe('0x1b')](_0x5f4df5[_0xcafe('0x30')][_0xcafe('0x1b')]);_0x2d894e[_0xcafe('0x1d')]=qs['offset'](_0x5f4df5[_0xcafe('0x30')][_0xcafe('0x1d')]);}return _0x5a1378['getSubjects'](_0x2d894e);}})[_0xcafe('0x23')](function(_0x5c4c95){if(_0x5c4c95){return _0x5c4c95?{'count':_0x28ddc9,'rows':_0x5c4c95}:null;}})['then'](respondWithResult(_0x15ea7c,null))[_0xcafe('0x43')](handleError(_0x15ea7c,null));};exports[_0xcafe('0x51')]=function(_0x30cafe,_0x14b4c1,_0x3f894a){var _0x407497={};var _0x339ba0={};var _0x360177;var _0x1ec0b8;return db[_0xcafe('0x3f')]['findOne']({'where':{'id':_0x30cafe[_0xcafe('0x4b')]['id']}})[_0xcafe('0x23')](handleEntityNotFound(_0x14b4c1,null))['then'](function(_0x3acdef){if(_0x3acdef){_0x360177=_0x3acdef;_0x339ba0['model']=_['keys'](db[_0xcafe('0x4d')][_0xcafe('0x2b')]);_0x339ba0[_0xcafe('0x30')]=_[_0xcafe('0x31')](_0x30cafe[_0xcafe('0x30')]);_0x339ba0[_0xcafe('0x45')]=_['intersection'](_0x339ba0[_0xcafe('0x2f')],_0x339ba0['query']);_0x407497[_0xcafe('0x33')]=_['intersection'](_0x339ba0[_0xcafe('0x2f')],qs[_0xcafe('0x4e')](_0x30cafe['query']['fields']));_0x407497[_0xcafe('0x33')]=_0x407497[_0xcafe('0x33')][_0xcafe('0x34')]?_0x407497['attributes']:_0x339ba0[_0xcafe('0x2f')];_0x407497['order']=qs['sort'](_0x30cafe[_0xcafe('0x30')][_0xcafe('0x38')]);_0x407497[_0xcafe('0x3b')]=qs[_0xcafe('0x45')](_[_0xcafe('0x39')](_0x30cafe[_0xcafe('0x30')],_0x339ba0[_0xcafe('0x45')]));if(_0x30cafe[_0xcafe('0x30')][_0xcafe('0x3a')]){_0x407497[_0xcafe('0x3b')]=_['merge'](_0x407497[_0xcafe('0x3b')],{'$or':_[_0xcafe('0x2a')](_0x407497[_0xcafe('0x33')],function(_0x47c609){var _0x14694a={};_0x14694a[_0x47c609]={'$like':'%'+_0x30cafe[_0xcafe('0x30')][_0xcafe('0x3a')]+'%'};return _0x14694a;})});}_0x407497=_['merge']({},_0x407497,_0x30cafe[_0xcafe('0x3e')]);return _0x360177['getDescriptions'](_0x407497);}})['then'](function(_0x4d0a50){if(_0x4d0a50){_0x1ec0b8=_0x4d0a50[_0xcafe('0x34')];if(!_0x30cafe[_0xcafe('0x30')][_0xcafe('0x35')](_0xcafe('0x36'))){_0x407497[_0xcafe('0x1b')]=qs[_0xcafe('0x1b')](_0x30cafe[_0xcafe('0x30')][_0xcafe('0x1b')]);_0x407497['offset']=qs[_0xcafe('0x1d')](_0x30cafe[_0xcafe('0x30')]['offset']);}return _0x360177[_0xcafe('0x51')](_0x407497);}})[_0xcafe('0x23')](function(_0x408d5c){if(_0x408d5c){return _0x408d5c?{'count':_0x1ec0b8,'rows':_0x408d5c}:null;}})[_0xcafe('0x23')](respondWithResult(_0x14b4c1,null))[_0xcafe('0x43')](handleError(_0x14b4c1,null));}; \ No newline at end of file +var _0xbfee=['jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','rows','params','includeAll','catch','create','body','find','getFields','getSubjects','findOne','SugarcrmField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x5528c3,_0x35a416){var _0x47ec1b=function(_0x54a18e){while(--_0x54a18e){_0x5528c3['push'](_0x5528c3['shift']());}};_0x47ec1b(++_0x35a416);}(_0xbfee,0x1d8));var _0xebfe=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xbfee[_0x11005e];return _0x29338f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xebfe('0x0'));var zipdir=require(_0xebfe('0x1'));var jsonpatch=require(_0xebfe('0x2'));var rp=require(_0xebfe('0x3'));var moment=require(_0xebfe('0x4'));var BPromise=require(_0xebfe('0x5'));var Mustache=require(_0xebfe('0x6'));var util=require(_0xebfe('0x7'));var path=require(_0xebfe('0x8'));var sox=require('sox');var csv=require(_0xebfe('0x9'));var ejs=require(_0xebfe('0xa'));var fs=require('fs');var fs_extra=require(_0xebfe('0xb'));var _=require('lodash');var squel=require(_0xebfe('0xc'));var crypto=require(_0xebfe('0xd'));var jsforce=require(_0xebfe('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xebfe('0xf'));var Papa=require(_0xebfe('0x10'));var Redis=require(_0xebfe('0x11'));var authService=require(_0xebfe('0x12'));var qs=require(_0xebfe('0x13'));var as=require(_0xebfe('0x14'));var hardwareService=require(_0xebfe('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xebfe('0x16'));var config=require(_0xebfe('0x17'));var licenseUtil=require(_0xebfe('0x18'));var db=require(_0xebfe('0x19'))['db'];function respondWithStatusCode(_0x2425f2,_0x463f6d){_0x463f6d=_0x463f6d||0xcc;return function(_0x3e4c32){if(_0x3e4c32){return _0x2425f2['sendStatus'](_0x463f6d);}return _0x2425f2[_0xebfe('0x1a')](_0x463f6d)[_0xebfe('0x1b')]();};}function respondWithResult(_0xa2a13b,_0x238a9f){_0x238a9f=_0x238a9f||0xc8;return function(_0x3cba57){if(_0x3cba57){return _0xa2a13b[_0xebfe('0x1a')](_0x238a9f)[_0xebfe('0x1c')](_0x3cba57);}};}function respondWithFilteredResult(_0x574a7d,_0x18aea6){return function(_0x3f744b){if(_0x3f744b){var _0x33a28a=typeof _0x18aea6[_0xebfe('0x1d')]===_0xebfe('0x1e')&&typeof _0x18aea6[_0xebfe('0x1f')]===_0xebfe('0x1e');var _0x499a6b=_0x3f744b[_0xebfe('0x20')];var _0x2deacb=_0x33a28a?0x0:_0x18aea6[_0xebfe('0x1d')];var _0x7d38db=_0x33a28a?_0x3f744b['count']:_0x18aea6[_0xebfe('0x1d')]+_0x18aea6[_0xebfe('0x1f')];var _0x92a1e5;if(_0x7d38db>=_0x499a6b){_0x7d38db=_0x499a6b;_0x92a1e5=0xc8;}else{_0x92a1e5=0xce;}_0x574a7d['status'](_0x92a1e5);return _0x574a7d[_0xebfe('0x21')](_0xebfe('0x22'),_0x2deacb+'-'+_0x7d38db+'/'+_0x499a6b)['json'](_0x3f744b);}return null;};}function patchUpdates(_0x47996b){return function(_0x5b7499){try{jsonpatch[_0xebfe('0x23')](_0x5b7499,_0x47996b,!![]);}catch(_0x23662e){return BPromise[_0xebfe('0x24')](_0x23662e);}return _0x5b7499[_0xebfe('0x25')]();};}function saveUpdates(_0x5eea66,_0x2c14c7){return function(_0x211813){if(_0x211813){return _0x211813[_0xebfe('0x26')](_0x5eea66)[_0xebfe('0x27')](function(_0x8f177d){return _0x8f177d;});}return null;};}function removeEntity(_0x402fed,_0x513a0a){return function(_0x441eff){if(_0x441eff){return _0x441eff[_0xebfe('0x28')]()[_0xebfe('0x27')](function(){_0x402fed[_0xebfe('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x476cfd,_0x1155e3){return function(_0x5b69c1){if(!_0x5b69c1){_0x476cfd[_0xebfe('0x29')](0x194);}return _0x5b69c1;};}function handleError(_0x53ddc1,_0x4d8328){_0x4d8328=_0x4d8328||0x1f4;return function(_0x34d377){logger[_0xebfe('0x2a')](_0x34d377[_0xebfe('0x2b')]);if(_0x34d377[_0xebfe('0x2c')]){delete _0x34d377[_0xebfe('0x2c')];}_0x53ddc1[_0xebfe('0x1a')](_0x4d8328)[_0xebfe('0x2d')](_0x34d377);};}exports[_0xebfe('0x2e')]=function(_0x5a7548,_0x629251){var _0x370643={},_0x8e7450={},_0x20c730={'count':0x0,'rows':[]};var _0xa96efb=_[_0xebfe('0x2f')](db[_0xebfe('0x30')][_0xebfe('0x31')],function(_0x5310b9){return{'name':_0x5310b9['fieldName'],'type':_0x5310b9['type']['key']};});_0x8e7450[_0xebfe('0x32')]=_[_0xebfe('0x2f')](_0xa96efb,_0xebfe('0x2c'));_0x8e7450[_0xebfe('0x33')]=_[_0xebfe('0x34')](_0x5a7548['query']);_0x8e7450[_0xebfe('0x35')]=_[_0xebfe('0x36')](_0x8e7450[_0xebfe('0x32')],_0x8e7450['query']);_0x370643['attributes']=_['intersection'](_0x8e7450[_0xebfe('0x32')],qs[_0xebfe('0x37')](_0x5a7548[_0xebfe('0x33')][_0xebfe('0x37')]));_0x370643[_0xebfe('0x38')]=_0x370643[_0xebfe('0x38')][_0xebfe('0x39')]?_0x370643[_0xebfe('0x38')]:_0x8e7450[_0xebfe('0x32')];if(!_0x5a7548['query']['hasOwnProperty'](_0xebfe('0x3a'))){_0x370643[_0xebfe('0x1f')]=qs['limit'](_0x5a7548[_0xebfe('0x33')][_0xebfe('0x1f')]);_0x370643[_0xebfe('0x1d')]=qs[_0xebfe('0x1d')](_0x5a7548['query']['offset']);}_0x370643[_0xebfe('0x3b')]=qs[_0xebfe('0x3c')](_0x5a7548[_0xebfe('0x33')][_0xebfe('0x3c')]);_0x370643[_0xebfe('0x3d')]=qs[_0xebfe('0x35')](_[_0xebfe('0x3e')](_0x5a7548[_0xebfe('0x33')],_0x8e7450['filters']),_0xa96efb);if(_0x5a7548[_0xebfe('0x33')][_0xebfe('0x3f')]){_0x370643['where']=_[_0xebfe('0x40')](_0x370643[_0xebfe('0x3d')],{'$or':_['map'](_0xa96efb,function(_0x45abca){if(_0x45abca[_0xebfe('0x41')]!=='VIRTUAL'){var _0x532746={};_0x532746[_0x45abca[_0xebfe('0x2c')]]={'$like':'%'+_0x5a7548[_0xebfe('0x33')]['filter']+'%'};return _0x532746;}})});}_0x370643=_['merge']({},_0x370643,_0x5a7548[_0xebfe('0x42')]);var _0x45b979={'where':_0x370643[_0xebfe('0x3d')]};return db[_0xebfe('0x30')][_0xebfe('0x20')](_0x45b979)[_0xebfe('0x27')](function(_0x530ad1){_0x20c730['count']=_0x530ad1;if(_0x5a7548[_0xebfe('0x33')]['includeAll']){_0x370643[_0xebfe('0x43')]=[{'all':!![]}];}return db[_0xebfe('0x30')][_0xebfe('0x44')](_0x370643);})[_0xebfe('0x27')](function(_0x1a1116){_0x20c730[_0xebfe('0x45')]=_0x1a1116;return _0x20c730;})[_0xebfe('0x27')](respondWithFilteredResult(_0x629251,_0x370643))['catch'](handleError(_0x629251,null));};exports['show']=function(_0x30ffa5,_0x69c199){var _0x5a6494={'raw':![],'where':{'id':_0x30ffa5[_0xebfe('0x46')]['id']}},_0x1a3c8a={};_0x1a3c8a['model']=_['keys'](db[_0xebfe('0x30')][_0xebfe('0x31')]);_0x1a3c8a[_0xebfe('0x33')]=_[_0xebfe('0x34')](_0x30ffa5[_0xebfe('0x33')]);_0x1a3c8a[_0xebfe('0x35')]=_[_0xebfe('0x36')](_0x1a3c8a[_0xebfe('0x32')],_0x1a3c8a[_0xebfe('0x33')]);_0x5a6494[_0xebfe('0x38')]=_[_0xebfe('0x36')](_0x1a3c8a[_0xebfe('0x32')],qs[_0xebfe('0x37')](_0x30ffa5[_0xebfe('0x33')]['fields']));_0x5a6494['attributes']=_0x5a6494['attributes'][_0xebfe('0x39')]?_0x5a6494[_0xebfe('0x38')]:_0x1a3c8a['model'];if(_0x30ffa5['query'][_0xebfe('0x47')]){_0x5a6494[_0xebfe('0x43')]=[{'all':!![]}];}_0x5a6494=_[_0xebfe('0x40')]({},_0x5a6494,_0x30ffa5[_0xebfe('0x42')]);return db[_0xebfe('0x30')]['find'](_0x5a6494)[_0xebfe('0x27')](handleEntityNotFound(_0x69c199,null))['then'](respondWithResult(_0x69c199,null))[_0xebfe('0x48')](handleError(_0x69c199,null));};exports[_0xebfe('0x49')]=function(_0x2436df,_0x1c5f1d){return db[_0xebfe('0x30')][_0xebfe('0x49')](_0x2436df[_0xebfe('0x4a')],{})[_0xebfe('0x27')](respondWithResult(_0x1c5f1d,0xc9))[_0xebfe('0x48')](handleError(_0x1c5f1d,null));};exports[_0xebfe('0x26')]=function(_0x1ee207,_0x513220){if(_0x1ee207[_0xebfe('0x4a')]['id']){delete _0x1ee207['body']['id'];}return db[_0xebfe('0x30')][_0xebfe('0x4b')]({'where':{'id':_0x1ee207[_0xebfe('0x46')]['id']}})[_0xebfe('0x27')](handleEntityNotFound(_0x513220,null))[_0xebfe('0x27')](saveUpdates(_0x1ee207[_0xebfe('0x4a')],null))[_0xebfe('0x27')](respondWithResult(_0x513220,null))[_0xebfe('0x48')](handleError(_0x513220,null));};exports[_0xebfe('0x28')]=function(_0x1b4b99,_0x4bcac1){return db[_0xebfe('0x30')]['find']({'where':{'id':_0x1b4b99[_0xebfe('0x46')]['id']}})['then'](handleEntityNotFound(_0x4bcac1,null))[_0xebfe('0x27')](removeEntity(_0x4bcac1,null))[_0xebfe('0x48')](handleError(_0x4bcac1,null));};exports[_0xebfe('0x4c')]=function(_0x46cfa5,_0x138dd5,_0x1e66e8){var _0x1f65ec={};var _0x49f923={};var _0x4c8812;var _0x44d36e;return db[_0xebfe('0x30')]['findOne']({'where':{'id':_0x46cfa5['params']['id']}})[_0xebfe('0x27')](handleEntityNotFound(_0x138dd5,null))['then'](function(_0x5ba20b){if(_0x5ba20b){_0x4c8812=_0x5ba20b;_0x49f923[_0xebfe('0x32')]=_[_0xebfe('0x34')](db['SugarcrmField'][_0xebfe('0x31')]);_0x49f923[_0xebfe('0x33')]=_['keys'](_0x46cfa5[_0xebfe('0x33')]);_0x49f923[_0xebfe('0x35')]=_[_0xebfe('0x36')](_0x49f923['model'],_0x49f923[_0xebfe('0x33')]);_0x1f65ec[_0xebfe('0x38')]=_[_0xebfe('0x36')](_0x49f923[_0xebfe('0x32')],qs['fields'](_0x46cfa5[_0xebfe('0x33')][_0xebfe('0x37')]));_0x1f65ec[_0xebfe('0x38')]=_0x1f65ec[_0xebfe('0x38')][_0xebfe('0x39')]?_0x1f65ec[_0xebfe('0x38')]:_0x49f923['model'];_0x1f65ec['order']=qs[_0xebfe('0x3c')](_0x46cfa5['query']['sort']);_0x1f65ec[_0xebfe('0x3d')]=qs[_0xebfe('0x35')](_[_0xebfe('0x3e')](_0x46cfa5['query'],_0x49f923[_0xebfe('0x35')]));if(_0x46cfa5[_0xebfe('0x33')][_0xebfe('0x3f')]){_0x1f65ec['where']=_[_0xebfe('0x40')](_0x1f65ec[_0xebfe('0x3d')],{'$or':_[_0xebfe('0x2f')](_0x1f65ec[_0xebfe('0x38')],function(_0x346072){var _0x185a34={};_0x185a34[_0x346072]={'$like':'%'+_0x46cfa5['query'][_0xebfe('0x3f')]+'%'};return _0x185a34;})});}_0x1f65ec=_[_0xebfe('0x40')]({},_0x1f65ec,_0x46cfa5[_0xebfe('0x42')]);return _0x4c8812[_0xebfe('0x4c')](_0x1f65ec);}})[_0xebfe('0x27')](function(_0x2a4fa6){if(_0x2a4fa6){_0x44d36e=_0x2a4fa6[_0xebfe('0x39')];if(!_0x46cfa5[_0xebfe('0x33')]['hasOwnProperty']('nolimit')){_0x1f65ec['limit']=qs[_0xebfe('0x1f')](_0x46cfa5[_0xebfe('0x33')]['limit']);_0x1f65ec[_0xebfe('0x1d')]=qs[_0xebfe('0x1d')](_0x46cfa5[_0xebfe('0x33')]['offset']);}return _0x4c8812[_0xebfe('0x4c')](_0x1f65ec);}})[_0xebfe('0x27')](function(_0x237b4f){if(_0x237b4f){return _0x237b4f?{'count':_0x44d36e,'rows':_0x237b4f}:null;}})['then'](respondWithResult(_0x138dd5,null))[_0xebfe('0x48')](handleError(_0x138dd5,null));};exports[_0xebfe('0x4d')]=function(_0x4c8948,_0x269b32,_0x5643a5){var _0x52a407={};var _0x1c8981={};var _0x377b4f;var _0x359040;return db[_0xebfe('0x30')][_0xebfe('0x4e')]({'where':{'id':_0x4c8948[_0xebfe('0x46')]['id']}})[_0xebfe('0x27')](handleEntityNotFound(_0x269b32,null))[_0xebfe('0x27')](function(_0x24d5e2){if(_0x24d5e2){_0x377b4f=_0x24d5e2;_0x1c8981[_0xebfe('0x32')]=_['keys'](db[_0xebfe('0x4f')][_0xebfe('0x31')]);_0x1c8981[_0xebfe('0x33')]=_[_0xebfe('0x34')](_0x4c8948[_0xebfe('0x33')]);_0x1c8981[_0xebfe('0x35')]=_[_0xebfe('0x36')](_0x1c8981['model'],_0x1c8981[_0xebfe('0x33')]);_0x52a407['attributes']=_[_0xebfe('0x36')](_0x1c8981['model'],qs[_0xebfe('0x37')](_0x4c8948['query']['fields']));_0x52a407[_0xebfe('0x38')]=_0x52a407['attributes'][_0xebfe('0x39')]?_0x52a407['attributes']:_0x1c8981[_0xebfe('0x32')];_0x52a407['order']=qs[_0xebfe('0x3c')](_0x4c8948[_0xebfe('0x33')][_0xebfe('0x3c')]);_0x52a407[_0xebfe('0x3d')]=qs[_0xebfe('0x35')](_[_0xebfe('0x3e')](_0x4c8948['query'],_0x1c8981[_0xebfe('0x35')]));if(_0x4c8948[_0xebfe('0x33')][_0xebfe('0x3f')]){_0x52a407[_0xebfe('0x3d')]=_[_0xebfe('0x40')](_0x52a407[_0xebfe('0x3d')],{'$or':_['map'](_0x52a407['attributes'],function(_0x19e7ea){var _0x5d4e1a={};_0x5d4e1a[_0x19e7ea]={'$like':'%'+_0x4c8948[_0xebfe('0x33')][_0xebfe('0x3f')]+'%'};return _0x5d4e1a;})});}_0x52a407=_[_0xebfe('0x40')]({},_0x52a407,_0x4c8948[_0xebfe('0x42')]);return _0x377b4f[_0xebfe('0x4d')](_0x52a407);}})[_0xebfe('0x27')](function(_0x55b050){if(_0x55b050){_0x359040=_0x55b050[_0xebfe('0x39')];if(!_0x4c8948[_0xebfe('0x33')]['hasOwnProperty'](_0xebfe('0x3a'))){_0x52a407['limit']=qs[_0xebfe('0x1f')](_0x4c8948[_0xebfe('0x33')][_0xebfe('0x1f')]);_0x52a407[_0xebfe('0x1d')]=qs[_0xebfe('0x1d')](_0x4c8948['query'][_0xebfe('0x1d')]);}return _0x377b4f[_0xebfe('0x4d')](_0x52a407);}})[_0xebfe('0x27')](function(_0x1752c9){if(_0x1752c9){return _0x1752c9?{'count':_0x359040,'rows':_0x1752c9}:null;}})['then'](respondWithResult(_0x269b32,null))[_0xebfe('0x48')](handleError(_0x269b32,null));};exports[_0xebfe('0x50')]=function(_0x34d68b,_0xd3a2fd,_0x27d8b9){var _0x33ed0c={};var _0x2923e1={};var _0x566d79;var _0x5e8e8a;return db['SugarcrmConfiguration'][_0xebfe('0x4e')]({'where':{'id':_0x34d68b[_0xebfe('0x46')]['id']}})[_0xebfe('0x27')](handleEntityNotFound(_0xd3a2fd,null))[_0xebfe('0x27')](function(_0x306d81){if(_0x306d81){_0x566d79=_0x306d81;_0x2923e1[_0xebfe('0x32')]=_['keys'](db[_0xebfe('0x4f')][_0xebfe('0x31')]);_0x2923e1['query']=_['keys'](_0x34d68b['query']);_0x2923e1[_0xebfe('0x35')]=_[_0xebfe('0x36')](_0x2923e1[_0xebfe('0x32')],_0x2923e1[_0xebfe('0x33')]);_0x33ed0c[_0xebfe('0x38')]=_['intersection'](_0x2923e1['model'],qs[_0xebfe('0x37')](_0x34d68b['query']['fields']));_0x33ed0c['attributes']=_0x33ed0c[_0xebfe('0x38')][_0xebfe('0x39')]?_0x33ed0c['attributes']:_0x2923e1[_0xebfe('0x32')];_0x33ed0c[_0xebfe('0x3b')]=qs[_0xebfe('0x3c')](_0x34d68b[_0xebfe('0x33')][_0xebfe('0x3c')]);_0x33ed0c[_0xebfe('0x3d')]=qs[_0xebfe('0x35')](_[_0xebfe('0x3e')](_0x34d68b[_0xebfe('0x33')],_0x2923e1['filters']));if(_0x34d68b[_0xebfe('0x33')]['filter']){_0x33ed0c[_0xebfe('0x3d')]=_['merge'](_0x33ed0c['where'],{'$or':_['map'](_0x33ed0c['attributes'],function(_0x4ed03b){var _0x20fcb8={};_0x20fcb8[_0x4ed03b]={'$like':'%'+_0x34d68b['query'][_0xebfe('0x3f')]+'%'};return _0x20fcb8;})});}_0x33ed0c=_[_0xebfe('0x40')]({},_0x33ed0c,_0x34d68b[_0xebfe('0x42')]);return _0x566d79['getDescriptions'](_0x33ed0c);}})[_0xebfe('0x27')](function(_0x8f232c){if(_0x8f232c){_0x5e8e8a=_0x8f232c[_0xebfe('0x39')];if(!_0x34d68b['query']['hasOwnProperty'](_0xebfe('0x3a'))){_0x33ed0c[_0xebfe('0x1f')]=qs[_0xebfe('0x1f')](_0x34d68b['query']['limit']);_0x33ed0c[_0xebfe('0x1d')]=qs[_0xebfe('0x1d')](_0x34d68b[_0xebfe('0x33')][_0xebfe('0x1d')]);}return _0x566d79[_0xebfe('0x50')](_0x33ed0c);}})[_0xebfe('0x27')](function(_0x2f56bc){if(_0x2f56bc){return _0x2f56bc?{'count':_0x5e8e8a,'rows':_0x2f56bc}:null;}})['then'](respondWithResult(_0xd3a2fd,null))[_0xebfe('0x48')](handleError(_0xd3a2fd,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 184241a..36d2b78 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 _0x8989=['./intSugarcrmConfiguration.attributes','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4362c6,_0x301841){var _0x139605=function(_0x4f597d){while(--_0x4f597d){_0x4362c6['push'](_0x4362c6['shift']());}};_0x139605(++_0x301841);}(_0x8989,0xeb));var _0x9898=function(_0x1cbc70,_0x53a336){_0x1cbc70=_0x1cbc70-0x0;var _0x4ef4da=_0x8989[_0x1cbc70];return _0x4ef4da;};'use strict';var _=require(_0x9898('0x0'));var util=require(_0x9898('0x1'));var logger=require(_0x9898('0x2'))('api');var moment=require(_0x9898('0x3'));var BPromise=require(_0x9898('0x4'));var rp=require(_0x9898('0x5'));var fs=require('fs');var path=require(_0x9898('0x6'));var rimraf=require(_0x9898('0x7'));var config=require('../../config/environment');var attributes=require(_0x9898('0x8'));module['exports']=function(_0x40e282,_0x48ea30){return _0x40e282['define']('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1101=['define','int_sugarcrm_configurations','lodash','api','moment','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x1101,0x174));var _0x1110=function(_0x3391d2,_0x2d343c){_0x3391d2=_0x3391d2-0x0;var _0x109058=_0x1101[_0x3391d2];return _0x109058;};'use strict';var _=require(_0x1110('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1110('0x1'));var moment=require(_0x1110('0x2'));var BPromise=require('bluebird');var rp=require(_0x1110('0x3'));var fs=require('fs');var path=require(_0x1110('0x4'));var rimraf=require(_0x1110('0x5'));var config=require('../../config/environment');var attributes=require(_0x1110('0x6'));module[_0x1110('0x7')]=function(_0x259b18,_0x36ff30){return _0x259b18[_0x1110('0x8')]('SugarcrmConfiguration',attributes,{'tableName':_0x1110('0x9'),'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 7f46269..93ce336 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 _0x11f9=['info','request\x20sent','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x11f9,0x8e));var _0x911f=function(_0x2a810d,_0x596b4f){_0x2a810d=_0x2a810d-0x0;var _0x2ea39d=_0x11f9[_0x2a810d];return _0x2ea39d;};'use strict';var _=require('lodash');var util=require(_0x911f('0x0'));var moment=require(_0x911f('0x1'));var BPromise=require('bluebird');var rs=require(_0x911f('0x2'));var fs=require('fs');var Redis=require(_0x911f('0x3'));var db=require(_0x911f('0x4'))['db'];var utils=require(_0x911f('0x5'));var logger=require(_0x911f('0x6'))(_0x911f('0x7'));var config=require(_0x911f('0x8'));var jayson=require(_0x911f('0x9'));var client=jayson[_0x911f('0xa')][_0x911f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53050d,_0x291f22,_0x13c099){return new BPromise(function(_0x28765a,_0x194a04){return client[_0x911f('0xc')](_0x53050d,_0x13c099)[_0x911f('0xd')](function(_0x22dfdc){logger['info'](_0x911f('0xe'),_0x291f22,'request\x20sent');logger[_0x911f('0xf')](_0x911f('0x10'),_0x291f22,'request\x20sent',JSON['stringify'](_0x22dfdc));if(_0x22dfdc[_0x911f('0x11')]){if(_0x22dfdc[_0x911f('0x11')]['code']===0x1f4){logger[_0x911f('0x11')](_0x911f('0xe'),_0x291f22,_0x22dfdc['error'][_0x911f('0x12')]);return _0x194a04(_0x22dfdc[_0x911f('0x11')]['message']);}logger[_0x911f('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x291f22,_0x22dfdc[_0x911f('0x11')]['message']);return _0x28765a(_0x22dfdc[_0x911f('0x11')][_0x911f('0x12')]);}else{logger[_0x911f('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x291f22,_0x911f('0x14'));_0x28765a(_0x22dfdc[_0x911f('0x15')][_0x911f('0x12')]);}})[_0x911f('0x16')](function(_0x2a7cb1){logger[_0x911f('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x291f22,_0x2a7cb1);_0x194a04(_0x2a7cb1);});});} \ No newline at end of file +var _0xe5fb=['message','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x33c951,_0x46600e){var _0x5ed1a5=function(_0x4f1ff4){while(--_0x4f1ff4){_0x33c951['push'](_0x33c951['shift']());}};_0x5ed1a5(++_0x46600e);}(_0xe5fb,0x1e1));var _0xbe5f=function(_0x457b64,_0x49a219){_0x457b64=_0x457b64-0x0;var _0x437111=_0xe5fb[_0x457b64];return _0x437111;};'use strict';var _=require('lodash');var util=require(_0xbe5f('0x0'));var moment=require('moment');var BPromise=require(_0xbe5f('0x1'));var rs=require(_0xbe5f('0x2'));var fs=require('fs');var Redis=require(_0xbe5f('0x3'));var db=require(_0xbe5f('0x4'))['db'];var utils=require(_0xbe5f('0x5'));var logger=require('../../config/logger')(_0xbe5f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b371e,_0x309ee8,_0x3fe6bf){return new BPromise(function(_0x579f68,_0x174564){return client['request'](_0x3b371e,_0x3fe6bf)['then'](function(_0x31bb92){logger[_0xbe5f('0x7')](_0xbe5f('0x8'),_0x309ee8,_0xbe5f('0x9'));logger[_0xbe5f('0xa')](_0xbe5f('0xb'),_0x309ee8,_0xbe5f('0x9'),JSON[_0xbe5f('0xc')](_0x31bb92));if(_0x31bb92[_0xbe5f('0xd')]){if(_0x31bb92[_0xbe5f('0xd')][_0xbe5f('0xe')]===0x1f4){logger[_0xbe5f('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x309ee8,_0x31bb92['error']['message']);return _0x174564(_0x31bb92[_0xbe5f('0xd')][_0xbe5f('0xf')]);}logger[_0xbe5f('0xd')](_0xbe5f('0x8'),_0x309ee8,_0x31bb92[_0xbe5f('0xd')][_0xbe5f('0xf')]);return _0x579f68(_0x31bb92[_0xbe5f('0xd')][_0xbe5f('0xf')]);}else{logger[_0xbe5f('0x7')](_0xbe5f('0x8'),_0x309ee8,_0xbe5f('0x9'));_0x579f68(_0x31bb92['result'][_0xbe5f('0xf')]);}})['catch'](function(_0x8b6c2e){logger[_0xbe5f('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x309ee8,_0x8b6c2e);_0x174564(_0x8b6c2e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 7f844b3..e4317b2 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 _0xfbcf=['show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','index','/:id','isAuthenticated'];(function(_0x4dda9e,_0x16147c){var _0x47f76d=function(_0x2ccde7){while(--_0x2ccde7){_0x4dda9e['push'](_0x4dda9e['shift']());}};_0x47f76d(++_0x16147c);}(_0xfbcf,0x6a));var _0xffbc=function(_0x158814,_0x3f84a2){_0x158814=_0x158814-0x0;var _0x3c680a=_0xfbcf[_0x158814];return _0x3c680a;};'use strict';var multer=require(_0xffbc('0x0'));var util=require(_0xffbc('0x1'));var path=require(_0xffbc('0x2'));var timeout=require(_0xffbc('0x3'));var express=require(_0xffbc('0x4'));var router=express['Router']();var fs_extra=require(_0xffbc('0x5'));var auth=require(_0xffbc('0x6'));var interaction=require(_0xffbc('0x7'));var config=require(_0xffbc('0x8'));var controller=require(_0xffbc('0x9'));router[_0xffbc('0xa')]('/',auth['isAuthenticated'](),controller[_0xffbc('0xb')]);router[_0xffbc('0xa')](_0xffbc('0xc'),auth[_0xffbc('0xd')](),controller[_0xffbc('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xffbc('0xf')]);router['put'](_0xffbc('0xc'),auth[_0xffbc('0xd')](),controller[_0xffbc('0x10')]);router[_0xffbc('0x11')]('/:id',auth[_0xffbc('0xd')](),controller[_0xffbc('0x12')]);module[_0xffbc('0x13')]=router; \ No newline at end of file +var _0x5ff8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','index','get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x24563c,_0x49d7cd){var _0x14796e=function(_0x3ab3d9){while(--_0x3ab3d9){_0x24563c['push'](_0x24563c['shift']());}};_0x14796e(++_0x49d7cd);}(_0x5ff8,0x188));var _0x85ff=function(_0x4cdba8,_0x29467e){_0x4cdba8=_0x4cdba8-0x0;var _0x310d45=_0x5ff8[_0x4cdba8];return _0x310d45;};'use strict';var multer=require(_0x85ff('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x85ff('0x1'));var express=require(_0x85ff('0x2'));var router=express[_0x85ff('0x3')]();var fs_extra=require(_0x85ff('0x4'));var auth=require(_0x85ff('0x5'));var interaction=require(_0x85ff('0x6'));var config=require(_0x85ff('0x7'));var controller=require(_0x85ff('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x85ff('0x9')]);router[_0x85ff('0xa')](_0x85ff('0xb'),auth[_0x85ff('0xc')](),controller[_0x85ff('0xd')]);router['post']('/',auth[_0x85ff('0xc')](),controller[_0x85ff('0xe')]);router[_0x85ff('0xf')](_0x85ff('0xb'),auth[_0x85ff('0xc')](),controller['update']);router['delete'](_0x85ff('0xb'),auth[_0x85ff('0xc')](),controller[_0x85ff('0x10')]);module[_0x85ff('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 487e8f2..107e009 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 _0x1188=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1188,0x170));var _0x8118=function(_0x32bc96,_0xb1c5a9){_0x32bc96=_0x32bc96-0x0;var _0x7a47a7=_0x1188[_0x32bc96];return _0x7a47a7;};'use strict';var Sequelize=require(_0x8118('0x0'));module[_0x8118('0x1')]={'type':{'type':Sequelize[_0x8118('0x2')](_0x8118('0x3'),_0x8118('0x4'),_0x8118('0x5'),_0x8118('0x6'),_0x8118('0x7')),'defaultValue':_0x8118('0x3')},'content':{'type':Sequelize[_0x8118('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x8118('0x3'),'variable',_0x8118('0x5'))},'keyContent':{'type':Sequelize[_0x8118('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8118('0x8')]},'customField':{'type':Sequelize[_0x8118('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3662=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x206d96,_0x1f7238){var _0x436a74=function(_0x56e7c0){while(--_0x56e7c0){_0x206d96['push'](_0x206d96['shift']());}};_0x436a74(++_0x1f7238);}(_0x3662,0xc4));var _0x2366=function(_0xf03d56,_0x27653a){_0xf03d56=_0xf03d56-0x0;var _0x30c964=_0x3662[_0xf03d56];return _0x30c964;};'use strict';var Sequelize=require(_0x2366('0x0'));module[_0x2366('0x1')]={'type':{'type':Sequelize[_0x2366('0x2')](_0x2366('0x3'),_0x2366('0x4'),_0x2366('0x5'),_0x2366('0x6'),_0x2366('0x7')),'defaultValue':_0x2366('0x3')},'content':{'type':Sequelize[_0x2366('0x8')]},'key':{'type':Sequelize[_0x2366('0x8')]},'keyType':{'type':Sequelize[_0x2366('0x2')](_0x2366('0x3'),_0x2366('0x4'),_0x2366('0x5'))},'keyContent':{'type':Sequelize[_0x2366('0x8')]},'idField':{'type':Sequelize[_0x2366('0x8')]},'nameField':{'type':Sequelize[_0x2366('0x8')]},'customField':{'type':Sequelize[_0x2366('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2366('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 3424224..6d58005 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 _0xfb52=['length','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params'];(function(_0x4f7036,_0x1919c7){var _0xca22b2=function(_0x383e1c){while(--_0x383e1c){_0x4f7036['push'](_0x4f7036['shift']());}};_0xca22b2(++_0x1919c7);}(_0xfb52,0xf9));var _0x2fb5=function(_0x4e1f73,_0x4751c0){_0x4e1f73=_0x4e1f73-0x0;var _0xc7c16f=_0xfb52[_0x4e1f73];return _0xc7c16f;};'use strict';var emlformat=require(_0x2fb5('0x0'));var rimraf=require(_0x2fb5('0x1'));var zipdir=require(_0x2fb5('0x2'));var jsonpatch=require(_0x2fb5('0x3'));var rp=require('request-promise');var moment=require(_0x2fb5('0x4'));var BPromise=require(_0x2fb5('0x5'));var Mustache=require(_0x2fb5('0x6'));var util=require(_0x2fb5('0x7'));var path=require(_0x2fb5('0x8'));var sox=require('sox');var csv=require(_0x2fb5('0x9'));var ejs=require(_0x2fb5('0xa'));var fs=require('fs');var fs_extra=require(_0x2fb5('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2fb5('0xc'));var jsforce=require(_0x2fb5('0xd'));var deskjs=require(_0x2fb5('0xe'));var toCsv=require(_0x2fb5('0x9'));var querystring=require(_0x2fb5('0xf'));var Papa=require(_0x2fb5('0x10'));var Redis=require(_0x2fb5('0x11'));var authService=require(_0x2fb5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2fb5('0x13'));var hardwareService=require(_0x2fb5('0x14'));var logger=require(_0x2fb5('0x15'))(_0x2fb5('0x16'));var utils=require('../../config/utils');var config=require(_0x2fb5('0x17'));var licenseUtil=require(_0x2fb5('0x18'));var db=require(_0x2fb5('0x19'))['db'];function respondWithStatusCode(_0x243208,_0x5acc97){_0x5acc97=_0x5acc97||0xcc;return function(_0x384b21){if(_0x384b21){return _0x243208['sendStatus'](_0x5acc97);}return _0x243208[_0x2fb5('0x1a')](_0x5acc97)[_0x2fb5('0x1b')]();};}function respondWithResult(_0x2a05bd,_0x486bb7){_0x486bb7=_0x486bb7||0xc8;return function(_0x4990f9){if(_0x4990f9){return _0x2a05bd[_0x2fb5('0x1a')](_0x486bb7)[_0x2fb5('0x1c')](_0x4990f9);}};}function respondWithFilteredResult(_0x30cde2,_0x56cba9){return function(_0x5ac9cf){if(_0x5ac9cf){var _0x373b4e=typeof _0x56cba9[_0x2fb5('0x1d')]===_0x2fb5('0x1e')&&typeof _0x56cba9[_0x2fb5('0x1f')]===_0x2fb5('0x1e');var _0x31006d=_0x5ac9cf['count'];var _0x1375ff=_0x373b4e?0x0:_0x56cba9[_0x2fb5('0x1d')];var _0x37acb3=_0x373b4e?_0x5ac9cf[_0x2fb5('0x20')]:_0x56cba9[_0x2fb5('0x1d')]+_0x56cba9[_0x2fb5('0x1f')];var _0x245a21;if(_0x37acb3>=_0x31006d){_0x37acb3=_0x31006d;_0x245a21=0xc8;}else{_0x245a21=0xce;}_0x30cde2['status'](_0x245a21);return _0x30cde2[_0x2fb5('0x21')](_0x2fb5('0x22'),_0x1375ff+'-'+_0x37acb3+'/'+_0x31006d)['json'](_0x5ac9cf);}return null;};}function patchUpdates(_0x1aedd9){return function(_0x4063bf){try{jsonpatch[_0x2fb5('0x23')](_0x4063bf,_0x1aedd9,!![]);}catch(_0x4496a8){return BPromise[_0x2fb5('0x24')](_0x4496a8);}return _0x4063bf[_0x2fb5('0x25')]();};}function saveUpdates(_0x772d8,_0x49687c){return function(_0x5c1eec){if(_0x5c1eec){return _0x5c1eec['update'](_0x772d8)['then'](function(_0x5923a1){return _0x5923a1;});}return null;};}function removeEntity(_0x37add2,_0x45c95b){return function(_0x16abe5){if(_0x16abe5){return _0x16abe5[_0x2fb5('0x26')]()[_0x2fb5('0x27')](function(){_0x37add2[_0x2fb5('0x1a')](0xcc)[_0x2fb5('0x1b')]();});}};}function handleEntityNotFound(_0x1f3449,_0x55fcba){return function(_0x500e7e){if(!_0x500e7e){_0x1f3449[_0x2fb5('0x28')](0x194);}return _0x500e7e;};}function handleError(_0x5a83b1,_0x3707e5){_0x3707e5=_0x3707e5||0x1f4;return function(_0x30504c){logger[_0x2fb5('0x29')](_0x30504c[_0x2fb5('0x2a')]);if(_0x30504c[_0x2fb5('0x2b')]){delete _0x30504c['name'];}_0x5a83b1[_0x2fb5('0x1a')](_0x3707e5)[_0x2fb5('0x2c')](_0x30504c);};}exports[_0x2fb5('0x2d')]=function(_0x49263f,_0x69d029){var _0x474feb={},_0x158a0d={},_0x42133e={'count':0x0,'rows':[]};var _0x48785f=_[_0x2fb5('0x2e')](db[_0x2fb5('0x2f')][_0x2fb5('0x30')],function(_0x23127e){return{'name':_0x23127e[_0x2fb5('0x31')],'type':_0x23127e[_0x2fb5('0x32')][_0x2fb5('0x33')]};});_0x158a0d[_0x2fb5('0x34')]=_[_0x2fb5('0x2e')](_0x48785f,'name');_0x158a0d[_0x2fb5('0x35')]=_[_0x2fb5('0x36')](_0x49263f[_0x2fb5('0x35')]);_0x158a0d[_0x2fb5('0x37')]=_['intersection'](_0x158a0d[_0x2fb5('0x34')],_0x158a0d[_0x2fb5('0x35')]);_0x474feb[_0x2fb5('0x38')]=_[_0x2fb5('0x39')](_0x158a0d[_0x2fb5('0x34')],qs['fields'](_0x49263f[_0x2fb5('0x35')][_0x2fb5('0x3a')]));_0x474feb[_0x2fb5('0x38')]=_0x474feb['attributes']['length']?_0x474feb[_0x2fb5('0x38')]:_0x158a0d[_0x2fb5('0x34')];if(!_0x49263f['query'][_0x2fb5('0x3b')](_0x2fb5('0x3c'))){_0x474feb[_0x2fb5('0x1f')]=qs[_0x2fb5('0x1f')](_0x49263f[_0x2fb5('0x35')][_0x2fb5('0x1f')]);_0x474feb[_0x2fb5('0x1d')]=qs['offset'](_0x49263f['query']['offset']);}_0x474feb[_0x2fb5('0x3d')]=qs[_0x2fb5('0x3e')](_0x49263f[_0x2fb5('0x35')][_0x2fb5('0x3e')]);_0x474feb[_0x2fb5('0x3f')]=qs['filters'](_[_0x2fb5('0x40')](_0x49263f[_0x2fb5('0x35')],_0x158a0d[_0x2fb5('0x37')]),_0x48785f);if(_0x49263f[_0x2fb5('0x35')][_0x2fb5('0x41')]){_0x474feb[_0x2fb5('0x3f')]=_['merge'](_0x474feb['where'],{'$or':_['map'](_0x48785f,function(_0x3f24ed){if(_0x3f24ed[_0x2fb5('0x32')]!==_0x2fb5('0x42')){var _0x16888f={};_0x16888f[_0x3f24ed[_0x2fb5('0x2b')]]={'$like':'%'+_0x49263f[_0x2fb5('0x35')][_0x2fb5('0x41')]+'%'};return _0x16888f;}})});}_0x474feb=_[_0x2fb5('0x43')]({},_0x474feb,_0x49263f[_0x2fb5('0x44')]);var _0x560b41={'where':_0x474feb[_0x2fb5('0x3f')]};return db[_0x2fb5('0x2f')][_0x2fb5('0x20')](_0x560b41)[_0x2fb5('0x27')](function(_0xc5472d){_0x42133e[_0x2fb5('0x20')]=_0xc5472d;if(_0x49263f[_0x2fb5('0x35')][_0x2fb5('0x45')]){_0x474feb['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x2fb5('0x46')](_0x474feb);})[_0x2fb5('0x27')](function(_0x13401d){_0x42133e[_0x2fb5('0x47')]=_0x13401d;return _0x42133e;})[_0x2fb5('0x27')](respondWithFilteredResult(_0x69d029,_0x474feb))[_0x2fb5('0x48')](handleError(_0x69d029,null));};exports[_0x2fb5('0x49')]=function(_0x19e139,_0x119ac0){var _0x26ad6d={'raw':!![],'where':{'id':_0x19e139[_0x2fb5('0x4a')]['id']}},_0x287afe={};_0x287afe[_0x2fb5('0x34')]=_['keys'](db[_0x2fb5('0x2f')][_0x2fb5('0x30')]);_0x287afe['query']=_[_0x2fb5('0x36')](_0x19e139[_0x2fb5('0x35')]);_0x287afe[_0x2fb5('0x37')]=_[_0x2fb5('0x39')](_0x287afe[_0x2fb5('0x34')],_0x287afe[_0x2fb5('0x35')]);_0x26ad6d[_0x2fb5('0x38')]=_[_0x2fb5('0x39')](_0x287afe[_0x2fb5('0x34')],qs[_0x2fb5('0x3a')](_0x19e139[_0x2fb5('0x35')]['fields']));_0x26ad6d[_0x2fb5('0x38')]=_0x26ad6d[_0x2fb5('0x38')][_0x2fb5('0x4b')]?_0x26ad6d['attributes']:_0x287afe[_0x2fb5('0x34')];if(_0x19e139['query'][_0x2fb5('0x45')]){_0x26ad6d[_0x2fb5('0x4c')]=[{'all':!![]}];}_0x26ad6d=_['merge']({},_0x26ad6d,_0x19e139['options']);return db['SugarcrmField'][_0x2fb5('0x4d')](_0x26ad6d)[_0x2fb5('0x27')](handleEntityNotFound(_0x119ac0,null))[_0x2fb5('0x27')](respondWithResult(_0x119ac0,null))['catch'](handleError(_0x119ac0,null));};exports[_0x2fb5('0x4e')]=function(_0x269453,_0x4a363c){return db[_0x2fb5('0x2f')][_0x2fb5('0x4e')](_0x269453[_0x2fb5('0x4f')],{})['then'](respondWithResult(_0x4a363c,0xc9))[_0x2fb5('0x48')](handleError(_0x4a363c,null));};exports[_0x2fb5('0x50')]=function(_0x346b10,_0x437812){if(_0x346b10[_0x2fb5('0x4f')]['id']){delete _0x346b10[_0x2fb5('0x4f')]['id'];}return db[_0x2fb5('0x2f')][_0x2fb5('0x4d')]({'where':{'id':_0x346b10['params']['id']}})[_0x2fb5('0x27')](handleEntityNotFound(_0x437812,null))[_0x2fb5('0x27')](saveUpdates(_0x346b10[_0x2fb5('0x4f')],null))[_0x2fb5('0x27')](respondWithResult(_0x437812,null))['catch'](handleError(_0x437812,null));};exports['destroy']=function(_0x17ee9e,_0xb25428){return db[_0x2fb5('0x2f')][_0x2fb5('0x4d')]({'where':{'id':_0x17ee9e[_0x2fb5('0x4a')]['id']}})[_0x2fb5('0x27')](handleEntityNotFound(_0xb25428,null))['then'](removeEntity(_0xb25428,null))[_0x2fb5('0x48')](handleError(_0xb25428,null));}; \ No newline at end of file +var _0xde5a=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','map','SugarcrmField','fieldName','type','model','query','keys','filters','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','attributes','find','create','body','eml-format','rimraf','fast-json-patch','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','../../config/logger'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xde5a,0x161));var _0xade5=function(_0x4d4f71,_0x51f54e){_0x4d4f71=_0x4d4f71-0x0;var _0x5b1093=_0xde5a[_0x4d4f71];return _0x5b1093;};'use strict';var emlformat=require(_0xade5('0x0'));var rimraf=require(_0xade5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xade5('0x2'));var rp=require(_0xade5('0x3'));var moment=require(_0xade5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xade5('0x5'));var util=require(_0xade5('0x6'));var path=require(_0xade5('0x7'));var sox=require(_0xade5('0x8'));var csv=require(_0xade5('0x9'));var ejs=require(_0xade5('0xa'));var fs=require('fs');var fs_extra=require(_0xade5('0xb'));var _=require(_0xade5('0xc'));var squel=require(_0xade5('0xd'));var crypto=require('crypto');var jsforce=require(_0xade5('0xe'));var deskjs=require(_0xade5('0xf'));var toCsv=require('to-csv');var querystring=require(_0xade5('0x10'));var Papa=require(_0xade5('0x11'));var Redis=require(_0xade5('0x12'));var authService=require(_0xade5('0x13'));var qs=require(_0xade5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xade5('0x15'))(_0xade5('0x16'));var utils=require(_0xade5('0x17'));var config=require(_0xade5('0x18'));var licenseUtil=require(_0xade5('0x19'));var db=require(_0xade5('0x1a'))['db'];function respondWithStatusCode(_0x8f9d36,_0x23fafd){_0x23fafd=_0x23fafd||0xcc;return function(_0x319f20){if(_0x319f20){return _0x8f9d36[_0xade5('0x1b')](_0x23fafd);}return _0x8f9d36[_0xade5('0x1c')](_0x23fafd)[_0xade5('0x1d')]();};}function respondWithResult(_0x5c8229,_0x52cea1){_0x52cea1=_0x52cea1||0xc8;return function(_0x3c1cd4){if(_0x3c1cd4){return _0x5c8229[_0xade5('0x1c')](_0x52cea1)[_0xade5('0x1e')](_0x3c1cd4);}};}function respondWithFilteredResult(_0x4a9dcb,_0x5aae55){return function(_0x982586){if(_0x982586){var _0x1b9d0b=typeof _0x5aae55['offset']==='undefined'&&typeof _0x5aae55[_0xade5('0x1f')]===_0xade5('0x20');var _0x14d735=_0x982586[_0xade5('0x21')];var _0xb732b2=_0x1b9d0b?0x0:_0x5aae55[_0xade5('0x22')];var _0x4f1f57=_0x1b9d0b?_0x982586[_0xade5('0x21')]:_0x5aae55[_0xade5('0x22')]+_0x5aae55[_0xade5('0x1f')];var _0x470e93;if(_0x4f1f57>=_0x14d735){_0x4f1f57=_0x14d735;_0x470e93=0xc8;}else{_0x470e93=0xce;}_0x4a9dcb[_0xade5('0x1c')](_0x470e93);return _0x4a9dcb[_0xade5('0x23')](_0xade5('0x24'),_0xb732b2+'-'+_0x4f1f57+'/'+_0x14d735)[_0xade5('0x1e')](_0x982586);}return null;};}function patchUpdates(_0x51113a){return function(_0x1fff62){try{jsonpatch[_0xade5('0x25')](_0x1fff62,_0x51113a,!![]);}catch(_0x318933){return BPromise[_0xade5('0x26')](_0x318933);}return _0x1fff62['save']();};}function saveUpdates(_0x1f15d6,_0x13d7cb){return function(_0x152c61){if(_0x152c61){return _0x152c61[_0xade5('0x27')](_0x1f15d6)[_0xade5('0x28')](function(_0x20ce73){return _0x20ce73;});}return null;};}function removeEntity(_0x17097b,_0x308868){return function(_0x4d8871){if(_0x4d8871){return _0x4d8871[_0xade5('0x29')]()[_0xade5('0x28')](function(){_0x17097b[_0xade5('0x1c')](0xcc)[_0xade5('0x1d')]();});}};}function handleEntityNotFound(_0x181b22,_0xb2f901){return function(_0x3985be){if(!_0x3985be){_0x181b22['sendStatus'](0x194);}return _0x3985be;};}function handleError(_0x33ae3e,_0x48b144){_0x48b144=_0x48b144||0x1f4;return function(_0x4cd74c){logger[_0xade5('0x2a')](_0x4cd74c['stack']);if(_0x4cd74c[_0xade5('0x2b')]){delete _0x4cd74c[_0xade5('0x2b')];}_0x33ae3e['status'](_0x48b144)[_0xade5('0x2c')](_0x4cd74c);};}exports['index']=function(_0x469d36,_0x59cc68){var _0x93d76c={},_0x276f6b={},_0x298dca={'count':0x0,'rows':[]};var _0x540508=_[_0xade5('0x2d')](db[_0xade5('0x2e')]['rawAttributes'],function(_0x23aef5){return{'name':_0x23aef5[_0xade5('0x2f')],'type':_0x23aef5[_0xade5('0x30')]['key']};});_0x276f6b[_0xade5('0x31')]=_[_0xade5('0x2d')](_0x540508,_0xade5('0x2b'));_0x276f6b[_0xade5('0x32')]=_[_0xade5('0x33')](_0x469d36[_0xade5('0x32')]);_0x276f6b[_0xade5('0x34')]=_[_0xade5('0x35')](_0x276f6b[_0xade5('0x31')],_0x276f6b[_0xade5('0x32')]);_0x93d76c['attributes']=_['intersection'](_0x276f6b['model'],qs[_0xade5('0x36')](_0x469d36[_0xade5('0x32')][_0xade5('0x36')]));_0x93d76c['attributes']=_0x93d76c['attributes'][_0xade5('0x37')]?_0x93d76c['attributes']:_0x276f6b['model'];if(!_0x469d36['query']['hasOwnProperty'](_0xade5('0x38'))){_0x93d76c[_0xade5('0x1f')]=qs[_0xade5('0x1f')](_0x469d36[_0xade5('0x32')]['limit']);_0x93d76c[_0xade5('0x22')]=qs[_0xade5('0x22')](_0x469d36[_0xade5('0x32')]['offset']);}_0x93d76c['order']=qs[_0xade5('0x39')](_0x469d36[_0xade5('0x32')][_0xade5('0x39')]);_0x93d76c[_0xade5('0x3a')]=qs['filters'](_[_0xade5('0x3b')](_0x469d36[_0xade5('0x32')],_0x276f6b['filters']),_0x540508);if(_0x469d36['query'][_0xade5('0x3c')]){_0x93d76c[_0xade5('0x3a')]=_[_0xade5('0x3d')](_0x93d76c[_0xade5('0x3a')],{'$or':_[_0xade5('0x2d')](_0x540508,function(_0xaaec30){if(_0xaaec30[_0xade5('0x30')]!==_0xade5('0x3e')){var _0x24c0eb={};_0x24c0eb[_0xaaec30[_0xade5('0x2b')]]={'$like':'%'+_0x469d36[_0xade5('0x32')][_0xade5('0x3c')]+'%'};return _0x24c0eb;}})});}_0x93d76c=_[_0xade5('0x3d')]({},_0x93d76c,_0x469d36[_0xade5('0x3f')]);var _0x5756ab={'where':_0x93d76c[_0xade5('0x3a')]};return db[_0xade5('0x2e')][_0xade5('0x21')](_0x5756ab)[_0xade5('0x28')](function(_0x4f81f1){_0x298dca[_0xade5('0x21')]=_0x4f81f1;if(_0x469d36['query'][_0xade5('0x40')]){_0x93d76c[_0xade5('0x41')]=[{'all':!![]}];}return db[_0xade5('0x2e')][_0xade5('0x42')](_0x93d76c);})[_0xade5('0x28')](function(_0x5bd47f){_0x298dca['rows']=_0x5bd47f;return _0x298dca;})['then'](respondWithFilteredResult(_0x59cc68,_0x93d76c))[_0xade5('0x43')](handleError(_0x59cc68,null));};exports[_0xade5('0x44')]=function(_0x1e4bb1,_0x2e8c0e){var _0x5e0f0a={'raw':!![],'where':{'id':_0x1e4bb1[_0xade5('0x45')]['id']}},_0x49268c={};_0x49268c[_0xade5('0x31')]=_[_0xade5('0x33')](db[_0xade5('0x2e')][_0xade5('0x46')]);_0x49268c[_0xade5('0x32')]=_[_0xade5('0x33')](_0x1e4bb1['query']);_0x49268c[_0xade5('0x34')]=_[_0xade5('0x35')](_0x49268c[_0xade5('0x31')],_0x49268c[_0xade5('0x32')]);_0x5e0f0a[_0xade5('0x47')]=_[_0xade5('0x35')](_0x49268c[_0xade5('0x31')],qs[_0xade5('0x36')](_0x1e4bb1[_0xade5('0x32')]['fields']));_0x5e0f0a[_0xade5('0x47')]=_0x5e0f0a[_0xade5('0x47')][_0xade5('0x37')]?_0x5e0f0a[_0xade5('0x47')]:_0x49268c['model'];if(_0x1e4bb1[_0xade5('0x32')]['includeAll']){_0x5e0f0a['include']=[{'all':!![]}];}_0x5e0f0a=_['merge']({},_0x5e0f0a,_0x1e4bb1[_0xade5('0x3f')]);return db['SugarcrmField'][_0xade5('0x48')](_0x5e0f0a)[_0xade5('0x28')](handleEntityNotFound(_0x2e8c0e,null))['then'](respondWithResult(_0x2e8c0e,null))[_0xade5('0x43')](handleError(_0x2e8c0e,null));};exports[_0xade5('0x49')]=function(_0xee8f27,_0x5f0d20){return db[_0xade5('0x2e')]['create'](_0xee8f27['body'],{})[_0xade5('0x28')](respondWithResult(_0x5f0d20,0xc9))[_0xade5('0x43')](handleError(_0x5f0d20,null));};exports['update']=function(_0x515709,_0x3dd3b2){if(_0x515709[_0xade5('0x4a')]['id']){delete _0x515709[_0xade5('0x4a')]['id'];}return db[_0xade5('0x2e')]['find']({'where':{'id':_0x515709[_0xade5('0x45')]['id']}})[_0xade5('0x28')](handleEntityNotFound(_0x3dd3b2,null))[_0xade5('0x28')](saveUpdates(_0x515709[_0xade5('0x4a')],null))[_0xade5('0x28')](respondWithResult(_0x3dd3b2,null))[_0xade5('0x43')](handleError(_0x3dd3b2,null));};exports['destroy']=function(_0x4fcf17,_0x1c75bc){return db[_0xade5('0x2e')]['find']({'where':{'id':_0x4fcf17[_0xade5('0x45')]['id']}})[_0xade5('0x28')](handleEntityNotFound(_0x1c75bc,null))[_0xade5('0x28')](removeEntity(_0x1c75bc,null))[_0xade5('0x43')](handleError(_0x1c75bc,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 95b3b31..d0ef307 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 _0xbd27=['exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes'];(function(_0x4e4d64,_0x6077f7){var _0x1b1ba0=function(_0x725f90){while(--_0x725f90){_0x4e4d64['push'](_0x4e4d64['shift']());}};_0x1b1ba0(++_0x6077f7);}(_0xbd27,0x1e6));var _0x7bd2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbd27[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x7bd2('0x0'));var util=require(_0x7bd2('0x1'));var logger=require(_0x7bd2('0x2'))(_0x7bd2('0x3'));var moment=require(_0x7bd2('0x4'));var BPromise=require(_0x7bd2('0x5'));var rp=require(_0x7bd2('0x6'));var fs=require('fs');var path=require(_0x7bd2('0x7'));var rimraf=require(_0x7bd2('0x8'));var config=require('../../config/environment');var attributes=require(_0x7bd2('0x9'));module[_0x7bd2('0xa')]=function(_0x41cde8,_0x474736){return _0x41cde8[_0x7bd2('0xb')](_0x7bd2('0xc'),attributes,{'tableName':_0x7bd2('0xd'),'paranoid':![],'indexes':[{'name':_0x7bd2('0xe'),'fields':[_0x7bd2('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1896=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','lodash','util','../../config/logger'];(function(_0x4fb9ed,_0x187ea0){var _0x263645=function(_0x11c604){while(--_0x11c604){_0x4fb9ed['push'](_0x4fb9ed['shift']());}};_0x263645(++_0x187ea0);}(_0x1896,0x192));var _0x6189=function(_0x2080fd,_0x2ca423){_0x2080fd=_0x2080fd-0x0;var _0x2439ba=_0x1896[_0x2080fd];return _0x2439ba;};'use strict';var _=require(_0x6189('0x0'));var util=require(_0x6189('0x1'));var logger=require(_0x6189('0x2'))(_0x6189('0x3'));var moment=require(_0x6189('0x4'));var BPromise=require(_0x6189('0x5'));var rp=require(_0x6189('0x6'));var fs=require('fs');var path=require(_0x6189('0x7'));var rimraf=require(_0x6189('0x8'));var config=require(_0x6189('0x9'));var attributes=require(_0x6189('0xa'));module[_0x6189('0xb')]=function(_0x16b099,_0x11358e){return _0x16b099['define'](_0x6189('0xc'),attributes,{'tableName':_0x6189('0xd'),'paranoid':![],'indexes':[{'name':_0x6189('0xe'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index dd873d5..6025ee0 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 _0xe6de=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x39396b,_0x3ee0df){var _0x1f5b78=function(_0x492c30){while(--_0x492c30){_0x39396b['push'](_0x39396b['shift']());}};_0x1f5b78(++_0x3ee0df);}(_0xe6de,0x151));var _0xee6d=function(_0x2aa375,_0x2bfaa4){_0x2aa375=_0x2aa375-0x0;var _0x443c44=_0xe6de[_0x2aa375];return _0x443c44;};'use strict';var _=require(_0xee6d('0x0'));var util=require(_0xee6d('0x1'));var moment=require(_0xee6d('0x2'));var BPromise=require('bluebird');var rs=require(_0xee6d('0x3'));var fs=require('fs');var Redis=require(_0xee6d('0x4'));var db=require(_0xee6d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xee6d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xee6d('0x7'));var client=jayson[_0xee6d('0x8')][_0xee6d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41729a,_0x288ce6,_0x40086d){return new BPromise(function(_0x5e5b9e,_0x542f59){return client[_0xee6d('0xa')](_0x41729a,_0x40086d)[_0xee6d('0xb')](function(_0x677324){logger[_0xee6d('0xc')](_0xee6d('0xd'),_0x288ce6,_0xee6d('0xe'));logger['debug'](_0xee6d('0xf'),_0x288ce6,_0xee6d('0xe'),JSON['stringify'](_0x677324));if(_0x677324[_0xee6d('0x10')]){if(_0x677324[_0xee6d('0x10')][_0xee6d('0x11')]===0x1f4){logger['error'](_0xee6d('0xd'),_0x288ce6,_0x677324[_0xee6d('0x10')]['message']);return _0x542f59(_0x677324['error'][_0xee6d('0x12')]);}logger[_0xee6d('0x10')](_0xee6d('0xd'),_0x288ce6,_0x677324[_0xee6d('0x10')][_0xee6d('0x12')]);return _0x5e5b9e(_0x677324[_0xee6d('0x10')]['message']);}else{logger[_0xee6d('0xc')](_0xee6d('0xd'),_0x288ce6,_0xee6d('0xe'));_0x5e5b9e(_0x677324[_0xee6d('0x13')][_0xee6d('0x12')]);}})[_0xee6d('0x14')](function(_0x1deb7c){logger[_0xee6d('0x10')](_0xee6d('0xd'),_0x288ce6,_0x1deb7c);_0x542f59(_0x1deb7c);});});} \ No newline at end of file +var _0x84ec=['error','code','message','SugarcrmField,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','stringify'];(function(_0x3e2e81,_0xc231cb){var _0x7af12f=function(_0x313363){while(--_0x313363){_0x3e2e81['push'](_0x3e2e81['shift']());}};_0x7af12f(++_0xc231cb);}(_0x84ec,0xa0));var _0xc84e=function(_0x5ed3a3,_0x5483cd){_0x5ed3a3=_0x5ed3a3-0x0;var _0x34a06a=_0x84ec[_0x5ed3a3];return _0x34a06a;};'use strict';var _=require(_0xc84e('0x0'));var util=require(_0xc84e('0x1'));var moment=require(_0xc84e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc84e('0x3'));var db=require(_0xc84e('0x4'))['db'];var utils=require(_0xc84e('0x5'));var logger=require(_0xc84e('0x6'))(_0xc84e('0x7'));var config=require('../../config/environment');var jayson=require(_0xc84e('0x8'));var client=jayson[_0xc84e('0x9')][_0xc84e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x599e03,_0x3734b4,_0x587681){return new BPromise(function(_0x360839,_0x1f9d69){return client['request'](_0x599e03,_0x587681)[_0xc84e('0xb')](function(_0x410777){logger[_0xc84e('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x3734b4,_0xc84e('0xd'));logger[_0xc84e('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x3734b4,_0xc84e('0xd'),JSON[_0xc84e('0xf')](_0x410777));if(_0x410777[_0xc84e('0x10')]){if(_0x410777[_0xc84e('0x10')][_0xc84e('0x11')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x3734b4,_0x410777[_0xc84e('0x10')][_0xc84e('0x12')]);return _0x1f9d69(_0x410777['error'][_0xc84e('0x12')]);}logger[_0xc84e('0x10')](_0xc84e('0x13'),_0x3734b4,_0x410777[_0xc84e('0x10')][_0xc84e('0x12')]);return _0x360839(_0x410777[_0xc84e('0x10')][_0xc84e('0x12')]);}else{logger[_0xc84e('0xc')](_0xc84e('0x13'),_0x3734b4,'request\x20sent');_0x360839(_0x410777[_0xc84e('0x14')][_0xc84e('0x12')]);}})[_0xc84e('0x15')](function(_0x10952a){logger[_0xc84e('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x3734b4,_0x10952a);_0x1f9d69(_0x10952a);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index c09c169..1a93239 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 _0xeb3a=['get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller'];(function(_0x1a6e0a,_0x1db7cb){var _0x22cab1=function(_0x5ebf10){while(--_0x5ebf10){_0x1a6e0a['push'](_0x1a6e0a['shift']());}};_0x22cab1(++_0x1db7cb);}(_0xeb3a,0x12f));var _0xaeb3=function(_0x211347,_0x3940dd){_0x211347=_0x211347-0x0;var _0x84ae6a=_0xeb3a[_0x211347];return _0x84ae6a;};'use strict';var multer=require(_0xaeb3('0x0'));var util=require(_0xaeb3('0x1'));var path=require(_0xaeb3('0x2'));var timeout=require(_0xaeb3('0x3'));var express=require(_0xaeb3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaeb3('0x5'));var interaction=require(_0xaeb3('0x6'));var config=require(_0xaeb3('0x7'));var controller=require(_0xaeb3('0x8'));router[_0xaeb3('0x9')]('/',auth[_0xaeb3('0xa')](),controller[_0xaeb3('0xb')]);router[_0xaeb3('0x9')]('/:id',auth[_0xaeb3('0xa')](),controller[_0xaeb3('0xc')]);router[_0xaeb3('0x9')](_0xaeb3('0xd'),auth[_0xaeb3('0xa')](),controller[_0xaeb3('0xe')]);router[_0xaeb3('0x9')](_0xaeb3('0xf'),auth[_0xaeb3('0xa')](),controller['getFields']);router[_0xaeb3('0x10')]('/',auth['isAuthenticated'](),controller[_0xaeb3('0x11')]);router[_0xaeb3('0x10')](_0xaeb3('0xd'),auth['isAuthenticated'](),controller[_0xaeb3('0x12')]);router[_0xaeb3('0x13')](_0xaeb3('0x14'),auth[_0xaeb3('0xa')](),controller[_0xaeb3('0x15')]);router[_0xaeb3('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xaeb3('0x17')]=router; \ No newline at end of file +var _0x4cdd=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','update','destroy'];(function(_0x1d5714,_0x2fa5f4){var _0x1b620e=function(_0x9a0a73){while(--_0x9a0a73){_0x1d5714['push'](_0x1d5714['shift']());}};_0x1b620e(++_0x2fa5f4);}(_0x4cdd,0x1a5));var _0xd4cd=function(_0x279f0f,_0x569056){_0x279f0f=_0x279f0f-0x0;var _0x1f494d=_0x4cdd[_0x279f0f];return _0x1f494d;};'use strict';var multer=require(_0xd4cd('0x0'));var util=require(_0xd4cd('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd4cd('0x2'));var router=express[_0xd4cd('0x3')]();var fs_extra=require(_0xd4cd('0x4'));var auth=require(_0xd4cd('0x5'));var interaction=require(_0xd4cd('0x6'));var config=require(_0xd4cd('0x7'));var controller=require(_0xd4cd('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd4cd('0x9')]('/:id',auth[_0xd4cd('0xa')](),controller['show']);router[_0xd4cd('0x9')](_0xd4cd('0xb'),auth[_0xd4cd('0xa')](),controller[_0xd4cd('0xc')]);router[_0xd4cd('0x9')](_0xd4cd('0xd'),auth['isAuthenticated'](),controller[_0xd4cd('0xe')]);router[_0xd4cd('0xf')]('/',auth[_0xd4cd('0xa')](),controller['create']);router['post']('/:id/configurations',auth[_0xd4cd('0xa')](),controller[_0xd4cd('0x10')]);router['put']('/:id',auth[_0xd4cd('0xa')](),controller[_0xd4cd('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd4cd('0x12')]);module[_0xd4cd('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 46e49e5..faf3fbd 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 _0x946a=['sequelize','exports','STRING','HelpDesk'];(function(_0x393bf5,_0x225cac){var _0xcb023=function(_0x4e671d){while(--_0x4e671d){_0x393bf5['push'](_0x393bf5['shift']());}};_0xcb023(++_0x225cac);}(_0x946a,0xec));var _0xa946=function(_0x17d6db,_0x33ed6b){_0x17d6db=_0x17d6db-0x0;var _0x31c550=_0x946a[_0x17d6db];return _0x31c550;};'use strict';var Sequelize=require(_0xa946('0x0'));module[_0xa946('0x1')]={'name':{'type':Sequelize[_0xa946('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa946('0x2')]},'username':{'type':Sequelize[_0xa946('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa946('0x3')},'remoteUri':{'type':Sequelize[_0xa946('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa946('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xa946('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe4a7=['STRING','sequelize','exports'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xe4a7,0x196));var _0x7e4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe4a7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x7e4a('0x0'));module[_0x7e4a('0x1')]={'name':{'type':Sequelize[_0x7e4a('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7e4a('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x7e4a('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x7e4a('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x7e4a('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x7e4a('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index d883e5f..88a96a9 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 _0x9e1d=['create','body','getConfigurations','VtigerConfiguration','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','findOne','username','description','moduleName','remoteUri','accessKey','substring','lastIndexOf','format','%s/webservice.php','getchallenge','POST','result','success','GET','autogenerated','owner','includes','remove','editable','label','startsWith','cf_','picklist','picklistValues','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','VtigerAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch'];(function(_0x335a61,_0x21b879){var _0x48a02b=function(_0x2978a8){while(--_0x2978a8){_0x335a61['push'](_0x335a61['shift']());}};_0x48a02b(++_0x21b879);}(_0x9e1d,0x192));var _0xd9e1=function(_0x294b0e,_0x11b38a){_0x294b0e=_0x294b0e-0x0;var _0x5a3e3a=_0x9e1d[_0x294b0e];return _0x5a3e3a;};'use strict';var emlformat=require(_0xd9e1('0x0'));var rimraf=require(_0xd9e1('0x1'));var zipdir=require(_0xd9e1('0x2'));var jsonpatch=require(_0xd9e1('0x3'));var rp=require(_0xd9e1('0x4'));var moment=require(_0xd9e1('0x5'));var BPromise=require(_0xd9e1('0x6'));var Mustache=require(_0xd9e1('0x7'));var util=require(_0xd9e1('0x8'));var path=require(_0xd9e1('0x9'));var sox=require(_0xd9e1('0xa'));var csv=require(_0xd9e1('0xb'));var ejs=require(_0xd9e1('0xc'));var fs=require('fs');var fs_extra=require(_0xd9e1('0xd'));var _=require('lodash');var squel=require(_0xd9e1('0xe'));var crypto=require(_0xd9e1('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xd9e1('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd9e1('0x11'));var Papa=require(_0xd9e1('0x12'));var Redis=require(_0xd9e1('0x13'));var authService=require(_0xd9e1('0x14'));var qs=require(_0xd9e1('0x15'));var as=require(_0xd9e1('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd9e1('0x17'));var config=require(_0xd9e1('0x18'));var licenseUtil=require(_0xd9e1('0x19'));var db=require(_0xd9e1('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1c3cc7,_0x2db74e){_0x2db74e=_0x2db74e||0xcc;return function(_0x13c4bb){if(_0x13c4bb){return _0x1c3cc7[_0xd9e1('0x1b')](_0x2db74e);}return _0x1c3cc7[_0xd9e1('0x1c')](_0x2db74e)[_0xd9e1('0x1d')]();};}function respondWithResult(_0x599ff1,_0x21ef41){_0x21ef41=_0x21ef41||0xc8;return function(_0x139b5d){if(_0x139b5d){return _0x599ff1[_0xd9e1('0x1c')](_0x21ef41)[_0xd9e1('0x1e')](_0x139b5d);}};}function respondWithFilteredResult(_0x16f643,_0x266dfc){return function(_0x308724){if(_0x308724){var _0x4c033d=typeof _0x266dfc[_0xd9e1('0x1f')]==='undefined'&&typeof _0x266dfc[_0xd9e1('0x20')]==='undefined';var _0x1dc476=_0x308724['count'];var _0x33c0be=_0x4c033d?0x0:_0x266dfc[_0xd9e1('0x1f')];var _0x3c124d=_0x4c033d?_0x308724[_0xd9e1('0x21')]:_0x266dfc[_0xd9e1('0x1f')]+_0x266dfc['limit'];var _0x318c77;if(_0x3c124d>=_0x1dc476){_0x3c124d=_0x1dc476;_0x318c77=0xc8;}else{_0x318c77=0xce;}_0x16f643[_0xd9e1('0x1c')](_0x318c77);return _0x16f643[_0xd9e1('0x22')](_0xd9e1('0x23'),_0x33c0be+'-'+_0x3c124d+'/'+_0x1dc476)[_0xd9e1('0x1e')](_0x308724);}return null;};}function patchUpdates(_0x30de8d){return function(_0x44efd1){try{jsonpatch['apply'](_0x44efd1,_0x30de8d,!![]);}catch(_0x3422a6){return BPromise[_0xd9e1('0x24')](_0x3422a6);}return _0x44efd1[_0xd9e1('0x25')]();};}function saveUpdates(_0x10d88f,_0x2addaa){return function(_0x59f712){if(_0x59f712){return _0x59f712[_0xd9e1('0x26')](_0x10d88f)[_0xd9e1('0x27')](function(_0x7dd632){return _0x7dd632;});}return null;};}function removeEntity(_0x1f755b,_0x3a396a){return function(_0x1ea4ab){if(_0x1ea4ab){return _0x1ea4ab[_0xd9e1('0x28')]()[_0xd9e1('0x27')](function(){_0x1f755b[_0xd9e1('0x1c')](0xcc)[_0xd9e1('0x1d')]();});}};}function handleEntityNotFound(_0x5eb8de,_0x40cbdf){return function(_0x59a01c){if(!_0x59a01c){_0x5eb8de[_0xd9e1('0x1b')](0x194);}return _0x59a01c;};}function handleError(_0x2b1cab,_0x588353){_0x588353=_0x588353||0x1f4;return function(_0x846365){logger[_0xd9e1('0x29')](_0x846365['stack']);if(_0x846365[_0xd9e1('0x2a')]){delete _0x846365[_0xd9e1('0x2a')];}_0x2b1cab[_0xd9e1('0x1c')](_0x588353)[_0xd9e1('0x2b')](_0x846365);};}exports[_0xd9e1('0x2c')]=function(_0x971647,_0x533911){var _0x498e8f={},_0x29ddad={},_0x1be12c={'count':0x0,'rows':[]};var _0x3696ab=_[_0xd9e1('0x2d')](db[_0xd9e1('0x2e')]['rawAttributes'],function(_0x9784ad){return{'name':_0x9784ad[_0xd9e1('0x2f')],'type':_0x9784ad[_0xd9e1('0x30')]['key']};});_0x29ddad[_0xd9e1('0x31')]=_[_0xd9e1('0x2d')](_0x3696ab,_0xd9e1('0x2a'));_0x29ddad[_0xd9e1('0x32')]=_[_0xd9e1('0x33')](_0x971647[_0xd9e1('0x32')]);_0x29ddad[_0xd9e1('0x34')]=_[_0xd9e1('0x35')](_0x29ddad['model'],_0x29ddad[_0xd9e1('0x32')]);_0x498e8f[_0xd9e1('0x36')]=_[_0xd9e1('0x35')](_0x29ddad['model'],qs['fields'](_0x971647[_0xd9e1('0x32')][_0xd9e1('0x37')]));_0x498e8f[_0xd9e1('0x36')]=_0x498e8f['attributes'][_0xd9e1('0x38')]?_0x498e8f[_0xd9e1('0x36')]:_0x29ddad[_0xd9e1('0x31')];if(!_0x971647[_0xd9e1('0x32')][_0xd9e1('0x39')](_0xd9e1('0x3a'))){_0x498e8f['limit']=qs[_0xd9e1('0x20')](_0x971647['query']['limit']);_0x498e8f[_0xd9e1('0x1f')]=qs[_0xd9e1('0x1f')](_0x971647['query'][_0xd9e1('0x1f')]);}_0x498e8f[_0xd9e1('0x3b')]=qs['sort'](_0x971647[_0xd9e1('0x32')][_0xd9e1('0x3c')]);_0x498e8f['where']=qs['filters'](_[_0xd9e1('0x3d')](_0x971647[_0xd9e1('0x32')],_0x29ddad[_0xd9e1('0x34')]),_0x3696ab);if(_0x971647[_0xd9e1('0x32')][_0xd9e1('0x3e')]){_0x498e8f['where']=_[_0xd9e1('0x3f')](_0x498e8f[_0xd9e1('0x40')],{'$or':_['map'](_0x3696ab,function(_0x37858b){if(_0x37858b[_0xd9e1('0x30')]!==_0xd9e1('0x41')){var _0x128b30={};_0x128b30[_0x37858b[_0xd9e1('0x2a')]]={'$like':'%'+_0x971647[_0xd9e1('0x32')][_0xd9e1('0x3e')]+'%'};return _0x128b30;}})});}_0x498e8f=_[_0xd9e1('0x3f')]({},_0x498e8f,_0x971647['options']);var _0x8a705f={'where':_0x498e8f[_0xd9e1('0x40')]};return db['VtigerAccount'][_0xd9e1('0x21')](_0x8a705f)[_0xd9e1('0x27')](function(_0x279437){_0x1be12c[_0xd9e1('0x21')]=_0x279437;if(_0x971647[_0xd9e1('0x32')]['includeAll']){_0x498e8f[_0xd9e1('0x42')]=[{'all':!![]}];}return db['VtigerAccount'][_0xd9e1('0x43')](_0x498e8f);})[_0xd9e1('0x27')](function(_0x1e650d){_0x1be12c['rows']=_0x1e650d;return _0x1be12c;})[_0xd9e1('0x27')](respondWithFilteredResult(_0x533911,_0x498e8f))['catch'](handleError(_0x533911,null));};exports[_0xd9e1('0x44')]=function(_0x148c4f,_0x4cd455){var _0x56cfa9={'raw':![],'where':{'id':_0x148c4f[_0xd9e1('0x45')]['id']}},_0xd42a0d={};_0xd42a0d[_0xd9e1('0x31')]=_[_0xd9e1('0x33')](db['VtigerAccount']['rawAttributes']);_0xd42a0d['query']=_[_0xd9e1('0x33')](_0x148c4f['query']);_0xd42a0d[_0xd9e1('0x34')]=_[_0xd9e1('0x35')](_0xd42a0d[_0xd9e1('0x31')],_0xd42a0d[_0xd9e1('0x32')]);_0x56cfa9[_0xd9e1('0x36')]=_[_0xd9e1('0x35')](_0xd42a0d['model'],qs[_0xd9e1('0x37')](_0x148c4f['query'][_0xd9e1('0x37')]));_0x56cfa9[_0xd9e1('0x36')]=_0x56cfa9[_0xd9e1('0x36')][_0xd9e1('0x38')]?_0x56cfa9[_0xd9e1('0x36')]:_0xd42a0d['model'];if(_0x148c4f[_0xd9e1('0x32')][_0xd9e1('0x46')]){_0x56cfa9[_0xd9e1('0x42')]=[{'all':!![]}];}_0x56cfa9=_[_0xd9e1('0x3f')]({},_0x56cfa9,_0x148c4f[_0xd9e1('0x47')]);return db[_0xd9e1('0x2e')][_0xd9e1('0x48')](_0x56cfa9)[_0xd9e1('0x27')](handleEntityNotFound(_0x4cd455,null))[_0xd9e1('0x27')](respondWithResult(_0x4cd455,null))[_0xd9e1('0x49')](handleError(_0x4cd455,null));};exports[_0xd9e1('0x4a')]=function(_0x3be048,_0x210100){return db[_0xd9e1('0x2e')][_0xd9e1('0x4a')](_0x3be048[_0xd9e1('0x4b')],{})[_0xd9e1('0x27')](respondWithResult(_0x210100,0xc9))[_0xd9e1('0x49')](handleError(_0x210100,null));};exports[_0xd9e1('0x26')]=function(_0x56ccdb,_0x36618d){if(_0x56ccdb['body']['id']){delete _0x56ccdb[_0xd9e1('0x4b')]['id'];}return db[_0xd9e1('0x2e')][_0xd9e1('0x48')]({'where':{'id':_0x56ccdb[_0xd9e1('0x45')]['id']}})[_0xd9e1('0x27')](handleEntityNotFound(_0x36618d,null))[_0xd9e1('0x27')](saveUpdates(_0x56ccdb[_0xd9e1('0x4b')],null))[_0xd9e1('0x27')](respondWithResult(_0x36618d,null))[_0xd9e1('0x49')](handleError(_0x36618d,null));};exports['destroy']=function(_0x15f003,_0x2e19ec){return db[_0xd9e1('0x2e')][_0xd9e1('0x48')]({'where':{'id':_0x15f003[_0xd9e1('0x45')]['id']}})[_0xd9e1('0x27')](handleEntityNotFound(_0x2e19ec,null))[_0xd9e1('0x27')](removeEntity(_0x2e19ec,null))[_0xd9e1('0x49')](handleError(_0x2e19ec,null));};exports[_0xd9e1('0x4c')]=function(_0x2047e5,_0x30b70b,_0x4aab6c){var _0x5e7b68={};var _0xf27d6e={};var _0x481502;var _0x46a403;return db[_0xd9e1('0x2e')]['findOne']({'where':{'id':_0x2047e5[_0xd9e1('0x45')]['id']}})['then'](handleEntityNotFound(_0x30b70b,null))[_0xd9e1('0x27')](function(_0x4b6f45){if(_0x4b6f45){_0x481502=_0x4b6f45;_0xf27d6e[_0xd9e1('0x31')]=_['keys'](db[_0xd9e1('0x4d')][_0xd9e1('0x4e')]);_0xf27d6e[_0xd9e1('0x32')]=_[_0xd9e1('0x33')](_0x2047e5[_0xd9e1('0x32')]);_0xf27d6e[_0xd9e1('0x34')]=_[_0xd9e1('0x35')](_0xf27d6e['model'],_0xf27d6e['query']);_0x5e7b68[_0xd9e1('0x36')]=_[_0xd9e1('0x35')](_0xf27d6e[_0xd9e1('0x31')],qs[_0xd9e1('0x37')](_0x2047e5['query']['fields']));_0x5e7b68[_0xd9e1('0x36')]=_0x5e7b68[_0xd9e1('0x36')][_0xd9e1('0x38')]?_0x5e7b68[_0xd9e1('0x36')]:_0xf27d6e[_0xd9e1('0x31')];_0x5e7b68['order']=qs[_0xd9e1('0x3c')](_0x2047e5[_0xd9e1('0x32')]['sort']);_0x5e7b68[_0xd9e1('0x40')]=qs[_0xd9e1('0x34')](_[_0xd9e1('0x3d')](_0x2047e5['query'],_0xf27d6e[_0xd9e1('0x34')]));if(_0x2047e5[_0xd9e1('0x32')][_0xd9e1('0x3e')]){_0x5e7b68[_0xd9e1('0x40')]=_['merge'](_0x5e7b68[_0xd9e1('0x40')],{'$or':_[_0xd9e1('0x2d')](_0x5e7b68['attributes'],function(_0xf2cd73){var _0x407885={};_0x407885[_0xf2cd73]={'$like':'%'+_0x2047e5['query'][_0xd9e1('0x3e')]+'%'};return _0x407885;})});}_0x5e7b68=_[_0xd9e1('0x3f')]({},_0x5e7b68,_0x2047e5[_0xd9e1('0x47')]);return _0x481502[_0xd9e1('0x4c')](_0x5e7b68);}})[_0xd9e1('0x27')](function(_0x39912f){if(_0x39912f){_0x46a403=_0x39912f[_0xd9e1('0x38')];if(!_0x2047e5['query'][_0xd9e1('0x39')](_0xd9e1('0x3a'))){_0x5e7b68[_0xd9e1('0x20')]=qs[_0xd9e1('0x20')](_0x2047e5[_0xd9e1('0x32')][_0xd9e1('0x20')]);_0x5e7b68['offset']=qs[_0xd9e1('0x1f')](_0x2047e5[_0xd9e1('0x32')][_0xd9e1('0x1f')]);}return _0x481502[_0xd9e1('0x4c')](_0x5e7b68);}})[_0xd9e1('0x27')](function(_0xab17ac){if(_0xab17ac){return _0xab17ac?{'count':_0x46a403,'rows':_0xab17ac}:null;}})['then'](respondWithResult(_0x30b70b,null))[_0xd9e1('0x49')](handleError(_0x30b70b,null));};exports[_0xd9e1('0x4f')]=function(_0x445202,_0xdcd96b,_0x35f6fa){if(_0x445202[_0xd9e1('0x4b')]['id']){delete _0x445202[_0xd9e1('0x4b')]['id'];}return db[_0xd9e1('0x2e')]['findOne']({'where':{'id':_0x445202['params']['id']}})[_0xd9e1('0x27')](handleEntityNotFound(_0xdcd96b,null))[_0xd9e1('0x27')](function(_0x383cea){if(_0x383cea){_0x445202[_0xd9e1('0x4b')][_0xd9e1('0x50')]=_0x383cea['id'];_0x445202[_0xd9e1('0x4b')][_0xd9e1('0x51')]=integrations[_0xd9e1('0x52')](_0x445202[_0xd9e1('0x4b')][_0xd9e1('0x53')],_0x445202['body'][_0xd9e1('0x30')]);_0x445202[_0xd9e1('0x4b')][_0xd9e1('0x54')]=integrations[_0xd9e1('0x55')](_0x445202['body'][_0xd9e1('0x53')],_0x445202[_0xd9e1('0x4b')][_0xd9e1('0x30')]);return db['VtigerConfiguration'][_0xd9e1('0x4a')](_0x445202['body'],{'include':[{'model':db[_0xd9e1('0x56')],'as':_0xd9e1('0x51')},{'model':db[_0xd9e1('0x56')],'as':_0xd9e1('0x54')}]});}return null;})[_0xd9e1('0x27')](respondWithResult(_0xdcd96b,null))[_0xd9e1('0x49')](handleError(_0xdcd96b,null));};var md5=require(_0xd9e1('0x57'));exports[_0xd9e1('0x58')]=function(_0x41e802,_0x5d2e16,_0x111b0e){var _0x1836cb=null;var _0x3d9586=null;var _0x8d31ec=null;var _0x1a783f=null;var _0x599411='';return db[_0xd9e1('0x2e')][_0xd9e1('0x59')]({'where':{'id':_0x41e802[_0xd9e1('0x45')]['id']},'attributes':['id',_0xd9e1('0x2a'),_0xd9e1('0x5a'),_0xd9e1('0x5b'),_0xd9e1('0x5c'),_0xd9e1('0x5d'),'serverUrl',_0xd9e1('0x5e')]})[_0xd9e1('0x27')](handleEntityNotFound(_0x5d2e16,null))['then'](function(_0x10a7d1){if(_0x10a7d1){_0x1836cb=_0x10a7d1['username'];_0x3d9586=_0x10a7d1[_0xd9e1('0x5e')];_0x8d31ec=_0x10a7d1[_0xd9e1('0x5c')];_0x599411=_0x10a7d1['remoteUri'];var _0x49ec4f=_0x599411['slice'](-0x1);if(_0x49ec4f==='/'){_0x599411=_0x599411[_0xd9e1('0x5f')](0x0,_0x599411[_0xd9e1('0x60')](_0x49ec4f));}_0x1a783f=util[_0xd9e1('0x61')](_0xd9e1('0x62'),_0x599411);var _0x556188={'method':'GET','uri':_0x1a783f,'qs':{'operation':_0xd9e1('0x63'),'username':_0x10a7d1[_0xd9e1('0x5a')]},'json':!![]};return rp(_0x556188);}})[_0xd9e1('0x27')](function(_0x1a1e7f){if(_0x1a1e7f['success']){var _0x1bb5af={'method':_0xd9e1('0x64'),'uri':_0x1a783f,'form':{'operation':'login','username':_0x1836cb,'accessKey':md5(_0x1a1e7f[_0xd9e1('0x65')]['token']+_0x3d9586)},'json':!![]};return rp(_0x1bb5af);}})[_0xd9e1('0x27')](function(_0xf69dd1){if(_0xf69dd1[_0xd9e1('0x66')]){var _0x2767b8={'method':_0xd9e1('0x67'),'uri':_0x1a783f,'qs':{'operation':'describe','username':_0x1836cb,'sessionName':_0xf69dd1[_0xd9e1('0x65')]['sessionName'],'elementType':_0x8d31ec},'json':!![]};return rp(_0x2767b8);}})[_0xd9e1('0x27')](function(_0x14c62f){if(_0x14c62f[_0xd9e1('0x66')]){var _0x22931f=[_0xd9e1('0x68'),'reference',_0xd9e1('0x69')];_['remove'](_0x14c62f[_0xd9e1('0x65')][_0xd9e1('0x37')],function(_0x5bc942){return _0x22931f[_0xd9e1('0x6a')](_0x5bc942[_0xd9e1('0x30')][_0xd9e1('0x2a')]);});_[_0xd9e1('0x6b')](_0x14c62f[_0xd9e1('0x65')][_0xd9e1('0x37')],function(_0x3eb3bd){return _0x3eb3bd[_0xd9e1('0x6c')]==='false';});return{'count':_0x14c62f[_0xd9e1('0x65')][_0xd9e1('0x37')][_0xd9e1('0x38')],'rows':_[_0xd9e1('0x2d')](_0x14c62f['result'][_0xd9e1('0x37')],function(_0x5877d4){return{'id':_0x5877d4[_0xd9e1('0x2a')],'name':_0x5877d4[_0xd9e1('0x6d')],'custom':_[_0xd9e1('0x6e')](_0x5877d4['name'],_0xd9e1('0x6f'))?!![]:![],'options':_0x5877d4[_0xd9e1('0x30')][_0xd9e1('0x2a')]===_0xd9e1('0x70')&&_0x5877d4[_0xd9e1('0x30')][_0xd9e1('0x71')][_0xd9e1('0x38')]>0x0?_['map'](_0x5877d4['type'][_0xd9e1('0x71')],function(_0xa37052){return{'name':_0xa37052['label'],'value':_0xa37052['value']};}):[]};})};}})[_0xd9e1('0x27')](respondWithResult(_0x5d2e16,null))[_0xd9e1('0x49')](function(_0x30992f){console[_0xd9e1('0x72')]('vTiger\x20error:\x20'+_0x30992f);var _0x1f86a3=_0x41e802[_0xd9e1('0x32')]['test']?0x1f4:_0x30992f[_0xd9e1('0x73')]||0x1f4;logger[_0xd9e1('0x29')](_0xd9e1('0x74'),_0xd9e1('0x58'),_0x1f86a3,JSON[_0xd9e1('0x75')](_0x30992f));delete _0x30992f[_0xd9e1('0x2a')];if(_0x1f86a3===0x191){_0x1f86a3=0x190;}_0x5d2e16[_0xd9e1('0x1c')](_0x1f86a3)[_0xd9e1('0x2b')](_0x41e802[_0xd9e1('0x32')][_0xd9e1('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x30992f['statusCode']}:_0x30992f);});}; \ No newline at end of file +var _0xecd0=['status','end','limit','undefined','count','offset','set','Content-Range','json','apply','save','update','then','error','stack','name','send','VtigerAccount','rawAttributes','key','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','merge','type','filter','options','include','findAll','rows','catch','show','params','fields','includeAll','create','body','find','findOne','VtigerConfiguration','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','md5','getFields','username','moduleName','remoteUri','serverUrl','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','result','describe','autogenerated','reference','owner','includes','remove','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus'];(function(_0x310926,_0x226e01){var _0x205927=function(_0x330d81){while(--_0x330d81){_0x310926['push'](_0x310926['shift']());}};_0x205927(++_0x226e01);}(_0xecd0,0x149));var _0x0ecd=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xecd0[_0x369151];return _0x4292d5;};'use strict';var emlformat=require(_0x0ecd('0x0'));var rimraf=require(_0x0ecd('0x1'));var zipdir=require(_0x0ecd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ecd('0x3'));var moment=require(_0x0ecd('0x4'));var BPromise=require(_0x0ecd('0x5'));var Mustache=require(_0x0ecd('0x6'));var util=require(_0x0ecd('0x7'));var path=require(_0x0ecd('0x8'));var sox=require('sox');var csv=require(_0x0ecd('0x9'));var ejs=require(_0x0ecd('0xa'));var fs=require('fs');var fs_extra=require(_0x0ecd('0xb'));var _=require(_0x0ecd('0xc'));var squel=require(_0x0ecd('0xd'));var crypto=require(_0x0ecd('0xe'));var jsforce=require(_0x0ecd('0xf'));var deskjs=require(_0x0ecd('0x10'));var toCsv=require(_0x0ecd('0x9'));var querystring=require(_0x0ecd('0x11'));var Papa=require(_0x0ecd('0x12'));var Redis=require(_0x0ecd('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0ecd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0ecd('0x15'));var utils=require(_0x0ecd('0x16'));var config=require(_0x0ecd('0x17'));var licenseUtil=require(_0x0ecd('0x18'));var db=require(_0x0ecd('0x19'))['db'];var integrations=require(_0x0ecd('0x1a'));function respondWithStatusCode(_0x367c99,_0x4a94ca){_0x4a94ca=_0x4a94ca||0xcc;return function(_0x3a3f3f){if(_0x3a3f3f){return _0x367c99[_0x0ecd('0x1b')](_0x4a94ca);}return _0x367c99[_0x0ecd('0x1c')](_0x4a94ca)[_0x0ecd('0x1d')]();};}function respondWithResult(_0x527da6,_0x5cd7ae){_0x5cd7ae=_0x5cd7ae||0xc8;return function(_0x470691){if(_0x470691){return _0x527da6[_0x0ecd('0x1c')](_0x5cd7ae)['json'](_0x470691);}};}function respondWithFilteredResult(_0x3b988d,_0x32885e){return function(_0x6c8512){if(_0x6c8512){var _0x5f3e0e=typeof _0x32885e['offset']==='undefined'&&typeof _0x32885e[_0x0ecd('0x1e')]===_0x0ecd('0x1f');var _0x134ba4=_0x6c8512[_0x0ecd('0x20')];var _0x1d5ec0=_0x5f3e0e?0x0:_0x32885e[_0x0ecd('0x21')];var _0x17ebed=_0x5f3e0e?_0x6c8512['count']:_0x32885e[_0x0ecd('0x21')]+_0x32885e[_0x0ecd('0x1e')];var _0x3b7b0e;if(_0x17ebed>=_0x134ba4){_0x17ebed=_0x134ba4;_0x3b7b0e=0xc8;}else{_0x3b7b0e=0xce;}_0x3b988d[_0x0ecd('0x1c')](_0x3b7b0e);return _0x3b988d[_0x0ecd('0x22')](_0x0ecd('0x23'),_0x1d5ec0+'-'+_0x17ebed+'/'+_0x134ba4)[_0x0ecd('0x24')](_0x6c8512);}return null;};}function patchUpdates(_0x160a52){return function(_0x212e21){try{jsonpatch[_0x0ecd('0x25')](_0x212e21,_0x160a52,!![]);}catch(_0x327b35){return BPromise['reject'](_0x327b35);}return _0x212e21[_0x0ecd('0x26')]();};}function saveUpdates(_0x40e9fd,_0x3ca897){return function(_0x4a97fd){if(_0x4a97fd){return _0x4a97fd[_0x0ecd('0x27')](_0x40e9fd)[_0x0ecd('0x28')](function(_0x5c69aa){return _0x5c69aa;});}return null;};}function removeEntity(_0x356a93,_0x4b03ba){return function(_0x2a6b91){if(_0x2a6b91){return _0x2a6b91['destroy']()['then'](function(){_0x356a93[_0x0ecd('0x1c')](0xcc)[_0x0ecd('0x1d')]();});}};}function handleEntityNotFound(_0x2a0276,_0x4b06b3){return function(_0x17cadd){if(!_0x17cadd){_0x2a0276[_0x0ecd('0x1b')](0x194);}return _0x17cadd;};}function handleError(_0x23a1b4,_0x5a3887){_0x5a3887=_0x5a3887||0x1f4;return function(_0x5eab73){logger[_0x0ecd('0x29')](_0x5eab73[_0x0ecd('0x2a')]);if(_0x5eab73[_0x0ecd('0x2b')]){delete _0x5eab73[_0x0ecd('0x2b')];}_0x23a1b4[_0x0ecd('0x1c')](_0x5a3887)[_0x0ecd('0x2c')](_0x5eab73);};}exports['index']=function(_0x389b92,_0x50c3b3){var _0x54e63a={},_0xa7c910={},_0x101cd6={'count':0x0,'rows':[]};var _0x64c663=_['map'](db[_0x0ecd('0x2d')][_0x0ecd('0x2e')],function(_0x331409){return{'name':_0x331409['fieldName'],'type':_0x331409['type'][_0x0ecd('0x2f')]};});_0xa7c910[_0x0ecd('0x30')]=_[_0x0ecd('0x31')](_0x64c663,'name');_0xa7c910[_0x0ecd('0x32')]=_[_0x0ecd('0x33')](_0x389b92['query']);_0xa7c910[_0x0ecd('0x34')]=_['intersection'](_0xa7c910[_0x0ecd('0x30')],_0xa7c910['query']);_0x54e63a[_0x0ecd('0x35')]=_[_0x0ecd('0x36')](_0xa7c910[_0x0ecd('0x30')],qs['fields'](_0x389b92['query']['fields']));_0x54e63a[_0x0ecd('0x35')]=_0x54e63a[_0x0ecd('0x35')][_0x0ecd('0x37')]?_0x54e63a[_0x0ecd('0x35')]:_0xa7c910[_0x0ecd('0x30')];if(!_0x389b92[_0x0ecd('0x32')][_0x0ecd('0x38')]('nolimit')){_0x54e63a[_0x0ecd('0x1e')]=qs[_0x0ecd('0x1e')](_0x389b92[_0x0ecd('0x32')][_0x0ecd('0x1e')]);_0x54e63a[_0x0ecd('0x21')]=qs[_0x0ecd('0x21')](_0x389b92[_0x0ecd('0x32')][_0x0ecd('0x21')]);}_0x54e63a[_0x0ecd('0x39')]=qs[_0x0ecd('0x3a')](_0x389b92[_0x0ecd('0x32')][_0x0ecd('0x3a')]);_0x54e63a[_0x0ecd('0x3b')]=qs[_0x0ecd('0x34')](_[_0x0ecd('0x3c')](_0x389b92[_0x0ecd('0x32')],_0xa7c910[_0x0ecd('0x34')]),_0x64c663);if(_0x389b92[_0x0ecd('0x32')]['filter']){_0x54e63a[_0x0ecd('0x3b')]=_[_0x0ecd('0x3d')](_0x54e63a['where'],{'$or':_['map'](_0x64c663,function(_0x4d70db){if(_0x4d70db[_0x0ecd('0x3e')]!=='VIRTUAL'){var _0x12cd93={};_0x12cd93[_0x4d70db['name']]={'$like':'%'+_0x389b92[_0x0ecd('0x32')][_0x0ecd('0x3f')]+'%'};return _0x12cd93;}})});}_0x54e63a=_['merge']({},_0x54e63a,_0x389b92[_0x0ecd('0x40')]);var _0x1e1112={'where':_0x54e63a[_0x0ecd('0x3b')]};return db[_0x0ecd('0x2d')][_0x0ecd('0x20')](_0x1e1112)[_0x0ecd('0x28')](function(_0x539bf0){_0x101cd6['count']=_0x539bf0;if(_0x389b92[_0x0ecd('0x32')]['includeAll']){_0x54e63a[_0x0ecd('0x41')]=[{'all':!![]}];}return db['VtigerAccount'][_0x0ecd('0x42')](_0x54e63a);})[_0x0ecd('0x28')](function(_0x24fbd5){_0x101cd6[_0x0ecd('0x43')]=_0x24fbd5;return _0x101cd6;})[_0x0ecd('0x28')](respondWithFilteredResult(_0x50c3b3,_0x54e63a))[_0x0ecd('0x44')](handleError(_0x50c3b3,null));};exports[_0x0ecd('0x45')]=function(_0x46ac5d,_0x417b7d){var _0x43bbf7={'raw':![],'where':{'id':_0x46ac5d[_0x0ecd('0x46')]['id']}},_0x38f08f={};_0x38f08f['model']=_['keys'](db[_0x0ecd('0x2d')]['rawAttributes']);_0x38f08f['query']=_[_0x0ecd('0x33')](_0x46ac5d[_0x0ecd('0x32')]);_0x38f08f[_0x0ecd('0x34')]=_[_0x0ecd('0x36')](_0x38f08f[_0x0ecd('0x30')],_0x38f08f[_0x0ecd('0x32')]);_0x43bbf7[_0x0ecd('0x35')]=_['intersection'](_0x38f08f['model'],qs[_0x0ecd('0x47')](_0x46ac5d[_0x0ecd('0x32')]['fields']));_0x43bbf7[_0x0ecd('0x35')]=_0x43bbf7[_0x0ecd('0x35')]['length']?_0x43bbf7[_0x0ecd('0x35')]:_0x38f08f[_0x0ecd('0x30')];if(_0x46ac5d['query'][_0x0ecd('0x48')]){_0x43bbf7['include']=[{'all':!![]}];}_0x43bbf7=_['merge']({},_0x43bbf7,_0x46ac5d[_0x0ecd('0x40')]);return db[_0x0ecd('0x2d')]['find'](_0x43bbf7)[_0x0ecd('0x28')](handleEntityNotFound(_0x417b7d,null))[_0x0ecd('0x28')](respondWithResult(_0x417b7d,null))[_0x0ecd('0x44')](handleError(_0x417b7d,null));};exports[_0x0ecd('0x49')]=function(_0x3ef91a,_0x395076){return db[_0x0ecd('0x2d')]['create'](_0x3ef91a[_0x0ecd('0x4a')],{})[_0x0ecd('0x28')](respondWithResult(_0x395076,0xc9))[_0x0ecd('0x44')](handleError(_0x395076,null));};exports[_0x0ecd('0x27')]=function(_0x564601,_0x46b3e0){if(_0x564601[_0x0ecd('0x4a')]['id']){delete _0x564601['body']['id'];}return db[_0x0ecd('0x2d')][_0x0ecd('0x4b')]({'where':{'id':_0x564601['params']['id']}})[_0x0ecd('0x28')](handleEntityNotFound(_0x46b3e0,null))[_0x0ecd('0x28')](saveUpdates(_0x564601[_0x0ecd('0x4a')],null))[_0x0ecd('0x28')](respondWithResult(_0x46b3e0,null))[_0x0ecd('0x44')](handleError(_0x46b3e0,null));};exports['destroy']=function(_0xf45086,_0x5dabb8){return db[_0x0ecd('0x2d')][_0x0ecd('0x4b')]({'where':{'id':_0xf45086[_0x0ecd('0x46')]['id']}})[_0x0ecd('0x28')](handleEntityNotFound(_0x5dabb8,null))[_0x0ecd('0x28')](removeEntity(_0x5dabb8,null))[_0x0ecd('0x44')](handleError(_0x5dabb8,null));};exports['getConfigurations']=function(_0x359826,_0x27f0e2,_0x12a252){var _0x294862={};var _0x15bfe7={};var _0x43631d;var _0x23924b;return db[_0x0ecd('0x2d')][_0x0ecd('0x4c')]({'where':{'id':_0x359826[_0x0ecd('0x46')]['id']}})['then'](handleEntityNotFound(_0x27f0e2,null))['then'](function(_0x2dc3bf){if(_0x2dc3bf){_0x43631d=_0x2dc3bf;_0x15bfe7[_0x0ecd('0x30')]=_[_0x0ecd('0x33')](db[_0x0ecd('0x4d')][_0x0ecd('0x2e')]);_0x15bfe7[_0x0ecd('0x32')]=_[_0x0ecd('0x33')](_0x359826[_0x0ecd('0x32')]);_0x15bfe7[_0x0ecd('0x34')]=_[_0x0ecd('0x36')](_0x15bfe7['model'],_0x15bfe7[_0x0ecd('0x32')]);_0x294862[_0x0ecd('0x35')]=_[_0x0ecd('0x36')](_0x15bfe7[_0x0ecd('0x30')],qs[_0x0ecd('0x47')](_0x359826[_0x0ecd('0x32')][_0x0ecd('0x47')]));_0x294862[_0x0ecd('0x35')]=_0x294862[_0x0ecd('0x35')][_0x0ecd('0x37')]?_0x294862[_0x0ecd('0x35')]:_0x15bfe7[_0x0ecd('0x30')];_0x294862[_0x0ecd('0x39')]=qs[_0x0ecd('0x3a')](_0x359826[_0x0ecd('0x32')][_0x0ecd('0x3a')]);_0x294862[_0x0ecd('0x3b')]=qs[_0x0ecd('0x34')](_[_0x0ecd('0x3c')](_0x359826[_0x0ecd('0x32')],_0x15bfe7[_0x0ecd('0x34')]));if(_0x359826[_0x0ecd('0x32')][_0x0ecd('0x3f')]){_0x294862[_0x0ecd('0x3b')]=_[_0x0ecd('0x3d')](_0x294862[_0x0ecd('0x3b')],{'$or':_['map'](_0x294862[_0x0ecd('0x35')],function(_0x2ee86a){var _0x3b4d60={};_0x3b4d60[_0x2ee86a]={'$like':'%'+_0x359826[_0x0ecd('0x32')]['filter']+'%'};return _0x3b4d60;})});}_0x294862=_['merge']({},_0x294862,_0x359826['options']);return _0x43631d[_0x0ecd('0x4e')](_0x294862);}})['then'](function(_0x4246ae){if(_0x4246ae){_0x23924b=_0x4246ae[_0x0ecd('0x37')];if(!_0x359826[_0x0ecd('0x32')][_0x0ecd('0x38')](_0x0ecd('0x4f'))){_0x294862['limit']=qs[_0x0ecd('0x1e')](_0x359826[_0x0ecd('0x32')][_0x0ecd('0x1e')]);_0x294862[_0x0ecd('0x21')]=qs['offset'](_0x359826[_0x0ecd('0x32')]['offset']);}return _0x43631d[_0x0ecd('0x4e')](_0x294862);}})[_0x0ecd('0x28')](function(_0xd8f1eb){if(_0xd8f1eb){return _0xd8f1eb?{'count':_0x23924b,'rows':_0xd8f1eb}:null;}})[_0x0ecd('0x28')](respondWithResult(_0x27f0e2,null))['catch'](handleError(_0x27f0e2,null));};exports[_0x0ecd('0x50')]=function(_0x371b08,_0x24779b,_0xd60d8f){if(_0x371b08[_0x0ecd('0x4a')]['id']){delete _0x371b08[_0x0ecd('0x4a')]['id'];}return db['VtigerAccount'][_0x0ecd('0x4c')]({'where':{'id':_0x371b08[_0x0ecd('0x46')]['id']}})[_0x0ecd('0x28')](handleEntityNotFound(_0x24779b,null))[_0x0ecd('0x28')](function(_0x44ff1c){if(_0x44ff1c){_0x371b08['body'][_0x0ecd('0x51')]=_0x44ff1c['id'];_0x371b08[_0x0ecd('0x4a')][_0x0ecd('0x52')]=integrations[_0x0ecd('0x53')](_0x371b08[_0x0ecd('0x4a')][_0x0ecd('0x54')],_0x371b08[_0x0ecd('0x4a')][_0x0ecd('0x3e')]);_0x371b08[_0x0ecd('0x4a')]['Descriptions']=integrations[_0x0ecd('0x55')](_0x371b08[_0x0ecd('0x4a')][_0x0ecd('0x54')],_0x371b08[_0x0ecd('0x4a')][_0x0ecd('0x3e')]);return db[_0x0ecd('0x4d')][_0x0ecd('0x49')](_0x371b08[_0x0ecd('0x4a')],{'include':[{'model':db[_0x0ecd('0x56')],'as':_0x0ecd('0x52')},{'model':db[_0x0ecd('0x56')],'as':'Descriptions'}]});}return null;})[_0x0ecd('0x28')](respondWithResult(_0x24779b,null))[_0x0ecd('0x44')](handleError(_0x24779b,null));};var md5=require(_0x0ecd('0x57'));exports[_0x0ecd('0x58')]=function(_0x378c70,_0x49b61e,_0xcbe1a5){var _0x4250fe=null;var _0x4033b0=null;var _0x16b311=null;var _0x3c2577=null;var _0x29b6c='';return db['VtigerAccount']['findOne']({'where':{'id':_0x378c70[_0x0ecd('0x46')]['id']},'attributes':['id',_0x0ecd('0x2b'),_0x0ecd('0x59'),'description',_0x0ecd('0x5a'),_0x0ecd('0x5b'),_0x0ecd('0x5c'),'accessKey']})[_0x0ecd('0x28')](handleEntityNotFound(_0x49b61e,null))['then'](function(_0x4aa9e3){if(_0x4aa9e3){_0x4250fe=_0x4aa9e3[_0x0ecd('0x59')];_0x4033b0=_0x4aa9e3['accessKey'];_0x16b311=_0x4aa9e3['moduleName'];_0x29b6c=_0x4aa9e3[_0x0ecd('0x5b')];var _0x4c212f=_0x29b6c['slice'](-0x1);if(_0x4c212f==='/'){_0x29b6c=_0x29b6c[_0x0ecd('0x5d')](0x0,_0x29b6c[_0x0ecd('0x5e')](_0x4c212f));}_0x3c2577=util[_0x0ecd('0x5f')](_0x0ecd('0x60'),_0x29b6c);var _0x1bf05d={'method':_0x0ecd('0x61'),'uri':_0x3c2577,'qs':{'operation':'getchallenge','username':_0x4aa9e3['username']},'json':!![]};return rp(_0x1bf05d);}})[_0x0ecd('0x28')](function(_0x5ec970){if(_0x5ec970[_0x0ecd('0x62')]){var _0x2b8e86={'method':_0x0ecd('0x63'),'uri':_0x3c2577,'form':{'operation':'login','username':_0x4250fe,'accessKey':md5(_0x5ec970[_0x0ecd('0x64')]['token']+_0x4033b0)},'json':!![]};return rp(_0x2b8e86);}})[_0x0ecd('0x28')](function(_0x2eb86c){if(_0x2eb86c[_0x0ecd('0x62')]){var _0x422eb4={'method':_0x0ecd('0x61'),'uri':_0x3c2577,'qs':{'operation':_0x0ecd('0x65'),'username':_0x4250fe,'sessionName':_0x2eb86c[_0x0ecd('0x64')]['sessionName'],'elementType':_0x16b311},'json':!![]};return rp(_0x422eb4);}})[_0x0ecd('0x28')](function(_0x2d3ee2){if(_0x2d3ee2['success']){var _0x309ad6=[_0x0ecd('0x66'),_0x0ecd('0x67'),_0x0ecd('0x68')];_['remove'](_0x2d3ee2['result'][_0x0ecd('0x47')],function(_0x41802f){return _0x309ad6[_0x0ecd('0x69')](_0x41802f[_0x0ecd('0x3e')]['name']);});_[_0x0ecd('0x6a')](_0x2d3ee2[_0x0ecd('0x64')][_0x0ecd('0x47')],function(_0x11f97d){return _0x11f97d['editable']===_0x0ecd('0x6b');});return{'count':_0x2d3ee2[_0x0ecd('0x64')][_0x0ecd('0x47')][_0x0ecd('0x37')],'rows':_['map'](_0x2d3ee2['result']['fields'],function(_0x2f9d00){return{'id':_0x2f9d00[_0x0ecd('0x2b')],'name':_0x2f9d00[_0x0ecd('0x6c')],'custom':_[_0x0ecd('0x6d')](_0x2f9d00['name'],_0x0ecd('0x6e'))?!![]:![],'options':_0x2f9d00[_0x0ecd('0x3e')][_0x0ecd('0x2b')]===_0x0ecd('0x6f')&&_0x2f9d00[_0x0ecd('0x3e')][_0x0ecd('0x70')]['length']>0x0?_[_0x0ecd('0x31')](_0x2f9d00[_0x0ecd('0x3e')]['picklistValues'],function(_0x551ef8){return{'name':_0x551ef8[_0x0ecd('0x6c')],'value':_0x551ef8['value']};}):[]};})};}})[_0x0ecd('0x28')](respondWithResult(_0x49b61e,null))['catch'](function(_0x158127){console[_0x0ecd('0x71')](_0x0ecd('0x72')+_0x158127);var _0x28340b=_0x378c70[_0x0ecd('0x32')][_0x0ecd('0x73')]?0x1f4:_0x158127[_0x0ecd('0x74')]||0x1f4;logger['error'](_0x0ecd('0x75'),_0x0ecd('0x58'),_0x28340b,JSON[_0x0ecd('0x76')](_0x158127));delete _0x158127[_0x0ecd('0x2b')];if(_0x28340b===0x191){_0x28340b=0x190;}_0x49b61e[_0x0ecd('0x1c')](_0x28340b)[_0x0ecd('0x2c')](_0x378c70[_0x0ecd('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x158127[_0x0ecd('0x74')]}:_0x158127);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 2722f1a..0e2777e 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 _0x3a22=['../../config/logger','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a22,0x1b6));var _0x23a2=function(_0x28a8ed,_0x477469){_0x28a8ed=_0x28a8ed-0x0;var _0x1711f5=_0x3a22[_0x28a8ed];return _0x1711f5;};'use strict';var _=require(_0x23a2('0x0'));var util=require(_0x23a2('0x1'));var logger=require(_0x23a2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x23a2('0x3'));var rp=require(_0x23a2('0x4'));var fs=require('fs');var path=require(_0x23a2('0x5'));var rimraf=require(_0x23a2('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x23a2('0x7'));module[_0x23a2('0x8')]=function(_0x10b678,_0x116cba){return _0x10b678[_0x23a2('0x9')]('VtigerAccount',attributes,{'tableName':_0x23a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0d3=['exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes'];(function(_0x134d5e,_0x2a47d8){var _0x1e166a=function(_0x53f10d){while(--_0x53f10d){_0x134d5e['push'](_0x134d5e['shift']());}};_0x1e166a(++_0x2a47d8);}(_0xf0d3,0x10c));var _0x3f0d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf0d3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3f0d('0x0'));var util=require(_0x3f0d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3f0d('0x2'));var BPromise=require(_0x3f0d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f0d('0x4'));var rimraf=require(_0x3f0d('0x5'));var config=require(_0x3f0d('0x6'));var attributes=require(_0x3f0d('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x3f0d('0x8')]=function(_0x2b870b,_0x421b68){return _0x2b870b[_0x3f0d('0x9')](_0x3f0d('0xa'),attributes,{'tableName':_0x3f0d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 8306c65..9900d31 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 _0x373d=['VtigerAccount','ShowVtigerAccount','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','info','request\x20sent','debug','stringify','error','code','message','VtigerAccount,\x20%s,\x20%s','result','catch','options','raw','where','attributes','limit','include','map','model','then','GetVtigerAccount'];(function(_0x3c9e74,_0x4334c5){var _0x4fea21=function(_0x5a2cbb){while(--_0x5a2cbb){_0x3c9e74['push'](_0x3c9e74['shift']());}};_0x4fea21(++_0x4334c5);}(_0x373d,0x1e2));var _0xd373=function(_0x41c49e,_0x4e9e2c){_0x41c49e=_0x41c49e-0x0;var _0x648a67=_0x373d[_0x41c49e];return _0x648a67;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var moment=require(_0xd373('0x1'));var BPromise=require(_0xd373('0x2'));var rs=require(_0xd373('0x3'));var fs=require('fs');var Redis=require(_0xd373('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd373('0x5'));var logger=require(_0xd373('0x6'))(_0xd373('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd373('0x8')][_0xd373('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x446be6,_0x4008c5,_0x48d977){return new BPromise(function(_0xe79819,_0x51c074){return client['request'](_0x446be6,_0x48d977)['then'](function(_0x14472a){logger[_0xd373('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x4008c5,_0xd373('0xb'));logger[_0xd373('0xc')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4008c5,'request\x20sent',JSON[_0xd373('0xd')](_0x14472a));if(_0x14472a[_0xd373('0xe')]){if(_0x14472a[_0xd373('0xe')][_0xd373('0xf')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4008c5,_0x14472a['error'][_0xd373('0x10')]);return _0x51c074(_0x14472a[_0xd373('0xe')]['message']);}logger[_0xd373('0xe')](_0xd373('0x11'),_0x4008c5,_0x14472a[_0xd373('0xe')][_0xd373('0x10')]);return _0xe79819(_0x14472a[_0xd373('0xe')][_0xd373('0x10')]);}else{logger[_0xd373('0xa')](_0xd373('0x11'),_0x4008c5,_0xd373('0xb'));_0xe79819(_0x14472a[_0xd373('0x12')][_0xd373('0x10')]);}})[_0xd373('0x13')](function(_0x1921dd){logger['error'](_0xd373('0x11'),_0x4008c5,_0x1921dd);_0x51c074(_0x1921dd);});});}exports['GetVtigerAccount']=function(_0x460259){var _0x36d47a=this;return new Promise(function(_0x55c5c7,_0x1bbdbd){return db['VtigerAccount']['findAll']({'raw':_0x460259[_0xd373('0x14')]?_0x460259[_0xd373('0x14')][_0xd373('0x15')]===undefined?!![]:![]:!![],'where':_0x460259[_0xd373('0x14')]?_0x460259[_0xd373('0x14')][_0xd373('0x16')]||null:null,'attributes':_0x460259['options']?_0x460259[_0xd373('0x14')][_0xd373('0x17')]||null:null,'limit':_0x460259[_0xd373('0x14')]?_0x460259[_0xd373('0x14')][_0xd373('0x18')]||null:null,'include':_0x460259[_0xd373('0x14')]?_0x460259['options'][_0xd373('0x19')]?_[_0xd373('0x1a')](_0x460259[_0xd373('0x14')][_0xd373('0x19')],function(_0x217ee7){return{'model':db[_0x217ee7[_0xd373('0x1b')]],'as':_0x217ee7['as'],'attributes':_0x217ee7[_0xd373('0x17')],'include':_0x217ee7[_0xd373('0x19')]?_[_0xd373('0x1a')](_0x217ee7[_0xd373('0x19')],function(_0x437110){return{'model':db[_0x437110[_0xd373('0x1b')]],'as':_0x437110['as'],'attributes':_0x437110[_0xd373('0x17')],'include':_0x437110[_0xd373('0x19')]?_[_0xd373('0x1a')](_0x437110[_0xd373('0x19')],function(_0x50b987){return{'model':db[_0x50b987[_0xd373('0x1b')]],'as':_0x50b987['as'],'attributes':_0x50b987[_0xd373('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd373('0x1c')](function(_0x45ee58){logger[_0xd373('0xa')](_0xd373('0x1d'),_0x460259);logger[_0xd373('0xc')](_0xd373('0x1d'),_0x460259,JSON[_0xd373('0xd')](_0x45ee58));_0x55c5c7(_0x45ee58);})[_0xd373('0x13')](function(_0xbc420b){logger[_0xd373('0xe')](_0xd373('0x1d'),_0xbc420b['message'],_0x460259);_0x1bbdbd(_0x36d47a[_0xd373('0xe')](0x1f4,_0xbc420b['message']));});});};exports['ShowVtigerAccount']=function(_0xedc8f3){var _0x15da6c=this;return new Promise(function(_0x25e016,_0x23024c){return db[_0xd373('0x1e')]['find']({'raw':_0xedc8f3[_0xd373('0x14')]?_0xedc8f3[_0xd373('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0xedc8f3[_0xd373('0x14')]?_0xedc8f3[_0xd373('0x14')][_0xd373('0x16')]||null:null,'attributes':_0xedc8f3[_0xd373('0x14')]?_0xedc8f3[_0xd373('0x14')][_0xd373('0x17')]||null:null,'include':_0xedc8f3[_0xd373('0x14')]?_0xedc8f3[_0xd373('0x14')][_0xd373('0x19')]?_['map'](_0xedc8f3[_0xd373('0x14')][_0xd373('0x19')],function(_0x420c73){return{'model':db[_0x420c73[_0xd373('0x1b')]],'as':_0x420c73['as'],'attributes':_0x420c73[_0xd373('0x17')],'include':_0x420c73[_0xd373('0x19')]?_[_0xd373('0x1a')](_0x420c73[_0xd373('0x19')],function(_0xaa62aa){return{'model':db[_0xaa62aa[_0xd373('0x1b')]],'as':_0xaa62aa['as'],'attributes':_0xaa62aa[_0xd373('0x17')],'include':_0xaa62aa[_0xd373('0x19')]?_[_0xd373('0x1a')](_0xaa62aa[_0xd373('0x19')],function(_0x22429c){return{'model':db[_0x22429c['model']],'as':_0x22429c['as'],'attributes':_0x22429c[_0xd373('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd373('0x1c')](function(_0x186e39){logger[_0xd373('0xa')]('ShowVtigerAccount',_0xedc8f3);logger[_0xd373('0xc')](_0xd373('0x1f'),_0xedc8f3,JSON[_0xd373('0xd')](_0x186e39));_0x25e016(_0x186e39);})[_0xd373('0x13')](function(_0x38d8ec){logger[_0xd373('0xe')]('ShowVtigerAccount',_0x38d8ec['message'],_0xedc8f3);_0x23024c(_0x15da6c[_0xd373('0xe')](0x1f4,_0x38d8ec['message']));});});}; \ No newline at end of file +var _0xd87e=['stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','map','include','model','attributes','ShowVtigerAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3bcbaa,_0x3453fc){var _0x18b6b9=function(_0x37b009){while(--_0x37b009){_0x3bcbaa['push'](_0x3bcbaa['shift']());}};_0x18b6b9(++_0x3453fc);}(_0xd87e,0x1bf));var _0xed87=function(_0x8ae1c9,_0x1c61ab){_0x8ae1c9=_0x8ae1c9-0x0;var _0x18b221=_0xd87e[_0x8ae1c9];return _0x18b221;};'use strict';var _=require(_0xed87('0x0'));var util=require(_0xed87('0x1'));var moment=require('moment');var BPromise=require(_0xed87('0x2'));var rs=require(_0xed87('0x3'));var fs=require('fs');var Redis=require(_0xed87('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xed87('0x5'));var logger=require('../../config/logger')(_0xed87('0x6'));var config=require(_0xed87('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xed87('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5da793,_0xa33c67,_0x42fef6){return new BPromise(function(_0x33e1c1,_0x2f348a){return client['request'](_0x5da793,_0x42fef6)[_0xed87('0x9')](function(_0x3dce4b){logger[_0xed87('0xa')](_0xed87('0xb'),_0xa33c67,_0xed87('0xc'));logger[_0xed87('0xd')](_0xed87('0xe'),_0xa33c67,'request\x20sent',JSON[_0xed87('0xf')](_0x3dce4b));if(_0x3dce4b[_0xed87('0x10')]){if(_0x3dce4b['error'][_0xed87('0x11')]===0x1f4){logger[_0xed87('0x10')]('VtigerAccount,\x20%s,\x20%s',_0xa33c67,_0x3dce4b['error'][_0xed87('0x12')]);return _0x2f348a(_0x3dce4b[_0xed87('0x10')][_0xed87('0x12')]);}logger[_0xed87('0x10')](_0xed87('0xb'),_0xa33c67,_0x3dce4b[_0xed87('0x10')]['message']);return _0x33e1c1(_0x3dce4b[_0xed87('0x10')][_0xed87('0x12')]);}else{logger[_0xed87('0xa')](_0xed87('0xb'),_0xa33c67,_0xed87('0xc'));_0x33e1c1(_0x3dce4b[_0xed87('0x13')][_0xed87('0x12')]);}})[_0xed87('0x14')](function(_0x385859){logger['error'](_0xed87('0xb'),_0xa33c67,_0x385859);_0x2f348a(_0x385859);});});}exports[_0xed87('0x15')]=function(_0x2c386a){var _0xfb8a44=this;return new Promise(function(_0x5f4076,_0x211085){return db[_0xed87('0x16')][_0xed87('0x17')]({'raw':_0x2c386a[_0xed87('0x18')]?_0x2c386a[_0xed87('0x18')][_0xed87('0x19')]===undefined?!![]:![]:!![],'where':_0x2c386a[_0xed87('0x18')]?_0x2c386a[_0xed87('0x18')][_0xed87('0x1a')]||null:null,'attributes':_0x2c386a['options']?_0x2c386a['options']['attributes']||null:null,'limit':_0x2c386a['options']?_0x2c386a[_0xed87('0x18')]['limit']||null:null,'include':_0x2c386a[_0xed87('0x18')]?_0x2c386a[_0xed87('0x18')]['include']?_[_0xed87('0x1b')](_0x2c386a['options'][_0xed87('0x1c')],function(_0x24962e){return{'model':db[_0x24962e[_0xed87('0x1d')]],'as':_0x24962e['as'],'attributes':_0x24962e[_0xed87('0x1e')],'include':_0x24962e[_0xed87('0x1c')]?_['map'](_0x24962e[_0xed87('0x1c')],function(_0x3c22b7){return{'model':db[_0x3c22b7[_0xed87('0x1d')]],'as':_0x3c22b7['as'],'attributes':_0x3c22b7[_0xed87('0x1e')],'include':_0x3c22b7[_0xed87('0x1c')]?_[_0xed87('0x1b')](_0x3c22b7[_0xed87('0x1c')],function(_0x4735b3){return{'model':db[_0x4735b3[_0xed87('0x1d')]],'as':_0x4735b3['as'],'attributes':_0x4735b3[_0xed87('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xed87('0x9')](function(_0x341a35){logger[_0xed87('0xa')](_0xed87('0x15'),_0x2c386a);logger['debug'](_0xed87('0x15'),_0x2c386a,JSON[_0xed87('0xf')](_0x341a35));_0x5f4076(_0x341a35);})['catch'](function(_0x3dff74){logger[_0xed87('0x10')](_0xed87('0x15'),_0x3dff74['message'],_0x2c386a);_0x211085(_0xfb8a44['error'](0x1f4,_0x3dff74[_0xed87('0x12')]));});});};exports[_0xed87('0x1f')]=function(_0x21ab8a){var _0x549a19=this;return new Promise(function(_0x37d45a,_0x3b87e3){return db[_0xed87('0x16')][_0xed87('0x20')]({'raw':_0x21ab8a[_0xed87('0x18')]?_0x21ab8a[_0xed87('0x18')][_0xed87('0x19')]===undefined?!![]:![]:!![],'where':_0x21ab8a[_0xed87('0x18')]?_0x21ab8a[_0xed87('0x18')]['where']||null:null,'attributes':_0x21ab8a[_0xed87('0x18')]?_0x21ab8a[_0xed87('0x18')]['attributes']||null:null,'include':_0x21ab8a[_0xed87('0x18')]?_0x21ab8a['options'][_0xed87('0x1c')]?_[_0xed87('0x1b')](_0x21ab8a[_0xed87('0x18')][_0xed87('0x1c')],function(_0x103b34){return{'model':db[_0x103b34[_0xed87('0x1d')]],'as':_0x103b34['as'],'attributes':_0x103b34[_0xed87('0x1e')],'include':_0x103b34[_0xed87('0x1c')]?_[_0xed87('0x1b')](_0x103b34[_0xed87('0x1c')],function(_0x35c9aa){return{'model':db[_0x35c9aa['model']],'as':_0x35c9aa['as'],'attributes':_0x35c9aa[_0xed87('0x1e')],'include':_0x35c9aa[_0xed87('0x1c')]?_['map'](_0x35c9aa[_0xed87('0x1c')],function(_0x54f6cb){return{'model':db[_0x54f6cb[_0xed87('0x1d')]],'as':_0x54f6cb['as'],'attributes':_0x54f6cb[_0xed87('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x443090){logger[_0xed87('0xa')](_0xed87('0x1f'),_0x21ab8a);logger[_0xed87('0xd')](_0xed87('0x1f'),_0x21ab8a,JSON['stringify'](_0x443090));_0x37d45a(_0x443090);})[_0xed87('0x14')](function(_0x525a11){logger[_0xed87('0x10')]('ShowVtigerAccount',_0x525a11[_0xed87('0x12')],_0x21ab8a);_0x3b87e3(_0x549a19[_0xed87('0x10')](0x1f4,_0x525a11[_0xed87('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 0b0b9ce..e3c0358 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 _0xeb68=['post','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xeb68,0x1d1));var _0x8eb6=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0xeb68[_0x22bdd3];return _0x44d9d9;};'use strict';var multer=require(_0x8eb6('0x0'));var util=require(_0x8eb6('0x1'));var path=require('path');var timeout=require(_0x8eb6('0x2'));var express=require(_0x8eb6('0x3'));var router=express[_0x8eb6('0x4')]();var fs_extra=require(_0x8eb6('0x5'));var auth=require(_0x8eb6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8eb6('0x7'));var controller=require(_0x8eb6('0x8'));router[_0x8eb6('0x9')]('/',auth['isAuthenticated'](),controller[_0x8eb6('0xa')]);router[_0x8eb6('0x9')](_0x8eb6('0xb'),auth[_0x8eb6('0xc')](),controller['show']);router[_0x8eb6('0x9')](_0x8eb6('0xd'),auth[_0x8eb6('0xc')](),controller['getFields']);router[_0x8eb6('0x9')](_0x8eb6('0xe'),auth[_0x8eb6('0xc')](),controller[_0x8eb6('0xf')]);router[_0x8eb6('0x9')](_0x8eb6('0x10'),auth[_0x8eb6('0xc')](),controller[_0x8eb6('0x11')]);router[_0x8eb6('0x12')]('/',auth[_0x8eb6('0xc')](),controller[_0x8eb6('0x13')]);router[_0x8eb6('0x14')](_0x8eb6('0xb'),auth[_0x8eb6('0xc')](),controller['update']);router[_0x8eb6('0x15')]('/:id',auth[_0x8eb6('0xc')](),controller['destroy']);module[_0x8eb6('0x16')]=router; \ No newline at end of file +var _0x9424=['getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','update','destroy','exports','multer','util','express','Router','fs-extra','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','show','/:id/fields','isAuthenticated'];(function(_0x579266,_0x45c18d){var _0x211e2b=function(_0x57939f){while(--_0x57939f){_0x579266['push'](_0x579266['shift']());}};_0x211e2b(++_0x45c18d);}(_0x9424,0x1ab));var _0x4942=function(_0x33273f,_0x58021b){_0x33273f=_0x33273f-0x0;var _0x1f693f=_0x9424[_0x33273f];return _0x1f693f;};'use strict';var multer=require(_0x4942('0x0'));var util=require(_0x4942('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4942('0x2'));var router=express[_0x4942('0x3')]();var fs_extra=require(_0x4942('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4942('0x5'));var controller=require(_0x4942('0x6'));router[_0x4942('0x7')]('/',auth['isAuthenticated'](),controller[_0x4942('0x8')]);router[_0x4942('0x7')](_0x4942('0x9'),auth['isAuthenticated'](),controller[_0x4942('0xa')]);router[_0x4942('0x7')](_0x4942('0xb'),auth[_0x4942('0xc')](),controller[_0x4942('0xd')]);router['get'](_0x4942('0xe'),auth[_0x4942('0xc')](),controller[_0x4942('0xf')]);router[_0x4942('0x7')](_0x4942('0x10'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x4942('0xc')](),controller[_0x4942('0x11')]);router[_0x4942('0x12')](_0x4942('0x9'),auth[_0x4942('0xc')](),controller[_0x4942('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4942('0x14')]);module[_0x4942('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 1ffae02..88fccf5 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 _0x3271=['exports','STRING'];(function(_0x12b1a9,_0x2779ff){var _0x4461f7=function(_0x115cb4){while(--_0x115cb4){_0x12b1a9['push'](_0x12b1a9['shift']());}};_0x4461f7(++_0x2779ff);}(_0x3271,0x1d0));var _0x1327=function(_0x53697a,_0x4f1c78){_0x53697a=_0x53697a-0x0;var _0x1dae01=_0x3271[_0x53697a];return _0x1dae01;};'use strict';var Sequelize=require('sequelize');module[_0x1327('0x0')]={'name':{'type':Sequelize[_0x1327('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc75f=['STRING','exports'];(function(_0x5232e7,_0xf76bc5){var _0xe4ca68=function(_0x10faa6){while(--_0x10faa6){_0x5232e7['push'](_0x5232e7['shift']());}};_0xe4ca68(++_0xf76bc5);}(_0xc75f,0x1d7));var _0xfc75=function(_0x2109a7,_0x1b65df){_0x2109a7=_0x2109a7-0x0;var _0x1dab1f=_0xc75f[_0x2109a7];return _0x1dab1f;};'use strict';var Sequelize=require('sequelize');module[_0xfc75('0x0')]={'name':{'type':Sequelize[_0xfc75('0x1')]},'description':{'type':Sequelize[_0xfc75('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 042779f..c599e21 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 _0x5c2a=['where','filters','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','keys','rawAttributes','options','find','create','body','params','destroy','getFields','findOne','VtigerField','sort','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','util','sox','ejs','fs-extra','lodash','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','send','index','map','VtigerConfiguration','fieldName','type','model','name','query','intersection','attributes','fields','length','nolimit','order'];(function(_0x3ef4f1,_0x5f0f9b){var _0x69953c=function(_0xb4e621){while(--_0xb4e621){_0x3ef4f1['push'](_0x3ef4f1['shift']());}};_0x69953c(++_0x5f0f9b);}(_0x5c2a,0x1aa));var _0xa5c2=function(_0x2c1aa8,_0x3e0609){_0x2c1aa8=_0x2c1aa8-0x0;var _0x4019f5=_0x5c2a[_0x2c1aa8];return _0x4019f5;};'use strict';var emlformat=require(_0xa5c2('0x0'));var rimraf=require(_0xa5c2('0x1'));var zipdir=require(_0xa5c2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5c2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa5c2('0x4'));var path=require('path');var sox=require(_0xa5c2('0x5'));var csv=require('to-csv');var ejs=require(_0xa5c2('0x6'));var fs=require('fs');var fs_extra=require(_0xa5c2('0x7'));var _=require(_0xa5c2('0x8'));var squel=require('squel');var crypto=require(_0xa5c2('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa5c2('0xa'));var querystring=require('querystring');var Papa=require(_0xa5c2('0xb'));var Redis=require(_0xa5c2('0xc'));var authService=require(_0xa5c2('0xd'));var qs=require(_0xa5c2('0xe'));var as=require(_0xa5c2('0xf'));var hardwareService=require(_0xa5c2('0x10'));var logger=require(_0xa5c2('0x11'))(_0xa5c2('0x12'));var utils=require(_0xa5c2('0x13'));var config=require(_0xa5c2('0x14'));var licenseUtil=require(_0xa5c2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x403f3e,_0x1d58b9){_0x1d58b9=_0x1d58b9||0xcc;return function(_0x14c61d){if(_0x14c61d){return _0x403f3e[_0xa5c2('0x16')](_0x1d58b9);}return _0x403f3e[_0xa5c2('0x17')](_0x1d58b9)[_0xa5c2('0x18')]();};}function respondWithResult(_0x1c64cc,_0x4f4b9f){_0x4f4b9f=_0x4f4b9f||0xc8;return function(_0x147ca8){if(_0x147ca8){return _0x1c64cc[_0xa5c2('0x17')](_0x4f4b9f)['json'](_0x147ca8);}};}function respondWithFilteredResult(_0x3df4cd,_0x49f51c){return function(_0x3e04c1){if(_0x3e04c1){var _0x492ef1=typeof _0x49f51c[_0xa5c2('0x19')]===_0xa5c2('0x1a')&&typeof _0x49f51c[_0xa5c2('0x1b')]==='undefined';var _0x35ef5f=_0x3e04c1['count'];var _0x131676=_0x492ef1?0x0:_0x49f51c[_0xa5c2('0x19')];var _0x34031a=_0x492ef1?_0x3e04c1[_0xa5c2('0x1c')]:_0x49f51c[_0xa5c2('0x19')]+_0x49f51c[_0xa5c2('0x1b')];var _0x19087b;if(_0x34031a>=_0x35ef5f){_0x34031a=_0x35ef5f;_0x19087b=0xc8;}else{_0x19087b=0xce;}_0x3df4cd[_0xa5c2('0x17')](_0x19087b);return _0x3df4cd[_0xa5c2('0x1d')](_0xa5c2('0x1e'),_0x131676+'-'+_0x34031a+'/'+_0x35ef5f)[_0xa5c2('0x1f')](_0x3e04c1);}return null;};}function patchUpdates(_0x3a52b4){return function(_0xc63bd4){try{jsonpatch[_0xa5c2('0x20')](_0xc63bd4,_0x3a52b4,!![]);}catch(_0x119960){return BPromise[_0xa5c2('0x21')](_0x119960);}return _0xc63bd4[_0xa5c2('0x22')]();};}function saveUpdates(_0x54b112,_0xc966cc){return function(_0xc4a806){if(_0xc4a806){return _0xc4a806[_0xa5c2('0x23')](_0x54b112)[_0xa5c2('0x24')](function(_0x16a1fb){return _0x16a1fb;});}return null;};}function removeEntity(_0x277f10,_0x246ff9){return function(_0x114bf7){if(_0x114bf7){return _0x114bf7['destroy']()[_0xa5c2('0x24')](function(){_0x277f10['status'](0xcc)[_0xa5c2('0x18')]();});}};}function handleEntityNotFound(_0x3deebc,_0x5c5d51){return function(_0x360a47){if(!_0x360a47){_0x3deebc[_0xa5c2('0x16')](0x194);}return _0x360a47;};}function handleError(_0xe2d955,_0x80b52f){_0x80b52f=_0x80b52f||0x1f4;return function(_0x1ce380){logger[_0xa5c2('0x25')](_0x1ce380[_0xa5c2('0x26')]);if(_0x1ce380['name']){delete _0x1ce380['name'];}_0xe2d955[_0xa5c2('0x17')](_0x80b52f)[_0xa5c2('0x27')](_0x1ce380);};}exports[_0xa5c2('0x28')]=function(_0x4d5ac7,_0x5746fc){var _0xa17b3c={},_0x1eae7e={},_0x41a385={'count':0x0,'rows':[]};var _0x6aa311=_[_0xa5c2('0x29')](db[_0xa5c2('0x2a')]['rawAttributes'],function(_0x250d35){return{'name':_0x250d35[_0xa5c2('0x2b')],'type':_0x250d35[_0xa5c2('0x2c')]['key']};});_0x1eae7e[_0xa5c2('0x2d')]=_[_0xa5c2('0x29')](_0x6aa311,_0xa5c2('0x2e'));_0x1eae7e[_0xa5c2('0x2f')]=_['keys'](_0x4d5ac7['query']);_0x1eae7e['filters']=_[_0xa5c2('0x30')](_0x1eae7e['model'],_0x1eae7e[_0xa5c2('0x2f')]);_0xa17b3c[_0xa5c2('0x31')]=_[_0xa5c2('0x30')](_0x1eae7e[_0xa5c2('0x2d')],qs[_0xa5c2('0x32')](_0x4d5ac7[_0xa5c2('0x2f')][_0xa5c2('0x32')]));_0xa17b3c[_0xa5c2('0x31')]=_0xa17b3c[_0xa5c2('0x31')][_0xa5c2('0x33')]?_0xa17b3c[_0xa5c2('0x31')]:_0x1eae7e['model'];if(!_0x4d5ac7[_0xa5c2('0x2f')]['hasOwnProperty'](_0xa5c2('0x34'))){_0xa17b3c['limit']=qs['limit'](_0x4d5ac7[_0xa5c2('0x2f')][_0xa5c2('0x1b')]);_0xa17b3c[_0xa5c2('0x19')]=qs['offset'](_0x4d5ac7['query']['offset']);}_0xa17b3c[_0xa5c2('0x35')]=qs['sort'](_0x4d5ac7[_0xa5c2('0x2f')]['sort']);_0xa17b3c[_0xa5c2('0x36')]=qs[_0xa5c2('0x37')](_[_0xa5c2('0x38')](_0x4d5ac7[_0xa5c2('0x2f')],_0x1eae7e['filters']),_0x6aa311);if(_0x4d5ac7[_0xa5c2('0x2f')]['filter']){_0xa17b3c[_0xa5c2('0x36')]=_[_0xa5c2('0x39')](_0xa17b3c[_0xa5c2('0x36')],{'$or':_[_0xa5c2('0x29')](_0x6aa311,function(_0xe9bb1b){if(_0xe9bb1b[_0xa5c2('0x2c')]!==_0xa5c2('0x3a')){var _0xaacc6e={};_0xaacc6e[_0xe9bb1b[_0xa5c2('0x2e')]]={'$like':'%'+_0x4d5ac7[_0xa5c2('0x2f')][_0xa5c2('0x3b')]+'%'};return _0xaacc6e;}})});}_0xa17b3c=_['merge']({},_0xa17b3c,_0x4d5ac7['options']);var _0x504d09={'where':_0xa17b3c[_0xa5c2('0x36')]};return db[_0xa5c2('0x2a')]['count'](_0x504d09)[_0xa5c2('0x24')](function(_0x5baf05){_0x41a385[_0xa5c2('0x1c')]=_0x5baf05;if(_0x4d5ac7[_0xa5c2('0x2f')]['includeAll']){_0xa17b3c[_0xa5c2('0x3c')]=[{'all':!![]}];}return db[_0xa5c2('0x2a')][_0xa5c2('0x3d')](_0xa17b3c);})['then'](function(_0x401421){_0x41a385[_0xa5c2('0x3e')]=_0x401421;return _0x41a385;})[_0xa5c2('0x24')](respondWithFilteredResult(_0x5746fc,_0xa17b3c))[_0xa5c2('0x3f')](handleError(_0x5746fc,null));};exports[_0xa5c2('0x40')]=function(_0x3241fa,_0x7ef02f){var _0x29dabb={'raw':![],'where':{'id':_0x3241fa['params']['id']}},_0x1c5a36={};_0x1c5a36[_0xa5c2('0x2d')]=_[_0xa5c2('0x41')](db[_0xa5c2('0x2a')][_0xa5c2('0x42')]);_0x1c5a36[_0xa5c2('0x2f')]=_[_0xa5c2('0x41')](_0x3241fa[_0xa5c2('0x2f')]);_0x1c5a36[_0xa5c2('0x37')]=_['intersection'](_0x1c5a36[_0xa5c2('0x2d')],_0x1c5a36[_0xa5c2('0x2f')]);_0x29dabb[_0xa5c2('0x31')]=_[_0xa5c2('0x30')](_0x1c5a36[_0xa5c2('0x2d')],qs[_0xa5c2('0x32')](_0x3241fa[_0xa5c2('0x2f')]['fields']));_0x29dabb['attributes']=_0x29dabb[_0xa5c2('0x31')][_0xa5c2('0x33')]?_0x29dabb['attributes']:_0x1c5a36[_0xa5c2('0x2d')];if(_0x3241fa['query']['includeAll']){_0x29dabb['include']=[{'all':!![]}];}_0x29dabb=_[_0xa5c2('0x39')]({},_0x29dabb,_0x3241fa[_0xa5c2('0x43')]);return db[_0xa5c2('0x2a')][_0xa5c2('0x44')](_0x29dabb)[_0xa5c2('0x24')](handleEntityNotFound(_0x7ef02f,null))['then'](respondWithResult(_0x7ef02f,null))[_0xa5c2('0x3f')](handleError(_0x7ef02f,null));};exports[_0xa5c2('0x45')]=function(_0x299719,_0xae8858){return db[_0xa5c2('0x2a')][_0xa5c2('0x45')](_0x299719[_0xa5c2('0x46')],{})[_0xa5c2('0x24')](respondWithResult(_0xae8858,0xc9))[_0xa5c2('0x3f')](handleError(_0xae8858,null));};exports[_0xa5c2('0x23')]=function(_0x50a2c8,_0x25b68c){if(_0x50a2c8[_0xa5c2('0x46')]['id']){delete _0x50a2c8[_0xa5c2('0x46')]['id'];}return db[_0xa5c2('0x2a')][_0xa5c2('0x44')]({'where':{'id':_0x50a2c8[_0xa5c2('0x47')]['id']}})[_0xa5c2('0x24')](handleEntityNotFound(_0x25b68c,null))[_0xa5c2('0x24')](saveUpdates(_0x50a2c8['body'],null))['then'](respondWithResult(_0x25b68c,null))['catch'](handleError(_0x25b68c,null));};exports[_0xa5c2('0x48')]=function(_0x4aab48,_0x105591){return db[_0xa5c2('0x2a')][_0xa5c2('0x44')]({'where':{'id':_0x4aab48[_0xa5c2('0x47')]['id']}})[_0xa5c2('0x24')](handleEntityNotFound(_0x105591,null))[_0xa5c2('0x24')](removeEntity(_0x105591,null))[_0xa5c2('0x3f')](handleError(_0x105591,null));};exports[_0xa5c2('0x49')]=function(_0x45a558,_0x1289ff,_0x561cc8){var _0x14444e={};var _0x312b9a={};var _0x452d6f;var _0x3e4086;return db[_0xa5c2('0x2a')][_0xa5c2('0x4a')]({'where':{'id':_0x45a558[_0xa5c2('0x47')]['id']}})[_0xa5c2('0x24')](handleEntityNotFound(_0x1289ff,null))[_0xa5c2('0x24')](function(_0x5aeef8){if(_0x5aeef8){_0x452d6f=_0x5aeef8;_0x312b9a['model']=_[_0xa5c2('0x41')](db[_0xa5c2('0x4b')][_0xa5c2('0x42')]);_0x312b9a[_0xa5c2('0x2f')]=_['keys'](_0x45a558[_0xa5c2('0x2f')]);_0x312b9a['filters']=_[_0xa5c2('0x30')](_0x312b9a['model'],_0x312b9a['query']);_0x14444e[_0xa5c2('0x31')]=_[_0xa5c2('0x30')](_0x312b9a[_0xa5c2('0x2d')],qs['fields'](_0x45a558['query']['fields']));_0x14444e[_0xa5c2('0x31')]=_0x14444e[_0xa5c2('0x31')]['length']?_0x14444e[_0xa5c2('0x31')]:_0x312b9a[_0xa5c2('0x2d')];_0x14444e[_0xa5c2('0x35')]=qs['sort'](_0x45a558['query'][_0xa5c2('0x4c')]);_0x14444e[_0xa5c2('0x36')]=qs[_0xa5c2('0x37')](_[_0xa5c2('0x38')](_0x45a558[_0xa5c2('0x2f')],_0x312b9a[_0xa5c2('0x37')]));if(_0x45a558['query'][_0xa5c2('0x3b')]){_0x14444e[_0xa5c2('0x36')]=_[_0xa5c2('0x39')](_0x14444e[_0xa5c2('0x36')],{'$or':_[_0xa5c2('0x29')](_0x14444e[_0xa5c2('0x31')],function(_0x123bba){var _0x1b49cd={};_0x1b49cd[_0x123bba]={'$like':'%'+_0x45a558['query'][_0xa5c2('0x3b')]+'%'};return _0x1b49cd;})});}_0x14444e=_[_0xa5c2('0x39')]({},_0x14444e,_0x45a558[_0xa5c2('0x43')]);return _0x452d6f['getFields'](_0x14444e);}})[_0xa5c2('0x24')](function(_0x5babf0){if(_0x5babf0){_0x3e4086=_0x5babf0[_0xa5c2('0x33')];if(!_0x45a558[_0xa5c2('0x2f')][_0xa5c2('0x4d')](_0xa5c2('0x34'))){_0x14444e[_0xa5c2('0x1b')]=qs['limit'](_0x45a558[_0xa5c2('0x2f')][_0xa5c2('0x1b')]);_0x14444e[_0xa5c2('0x19')]=qs['offset'](_0x45a558['query'][_0xa5c2('0x19')]);}return _0x452d6f[_0xa5c2('0x49')](_0x14444e);}})[_0xa5c2('0x24')](function(_0x42b1f5){if(_0x42b1f5){return _0x42b1f5?{'count':_0x3e4086,'rows':_0x42b1f5}:null;}})['then'](respondWithResult(_0x1289ff,null))['catch'](handleError(_0x1289ff,null));};exports[_0xa5c2('0x4e')]=function(_0x16b7a3,_0x5f88bd,_0x57f145){var _0x570c9f={};var _0x25b1d6={};var _0x3fb5a5;var _0xada61c;return db[_0xa5c2('0x2a')][_0xa5c2('0x4a')]({'where':{'id':_0x16b7a3[_0xa5c2('0x47')]['id']}})[_0xa5c2('0x24')](handleEntityNotFound(_0x5f88bd,null))[_0xa5c2('0x24')](function(_0x31515a){if(_0x31515a){_0x3fb5a5=_0x31515a;_0x25b1d6['model']=_[_0xa5c2('0x41')](db[_0xa5c2('0x4b')][_0xa5c2('0x42')]);_0x25b1d6[_0xa5c2('0x2f')]=_[_0xa5c2('0x41')](_0x16b7a3['query']);_0x25b1d6[_0xa5c2('0x37')]=_[_0xa5c2('0x30')](_0x25b1d6['model'],_0x25b1d6[_0xa5c2('0x2f')]);_0x570c9f[_0xa5c2('0x31')]=_[_0xa5c2('0x30')](_0x25b1d6[_0xa5c2('0x2d')],qs['fields'](_0x16b7a3[_0xa5c2('0x2f')][_0xa5c2('0x32')]));_0x570c9f[_0xa5c2('0x31')]=_0x570c9f[_0xa5c2('0x31')]['length']?_0x570c9f[_0xa5c2('0x31')]:_0x25b1d6[_0xa5c2('0x2d')];_0x570c9f[_0xa5c2('0x35')]=qs[_0xa5c2('0x4c')](_0x16b7a3['query']['sort']);_0x570c9f['where']=qs[_0xa5c2('0x37')](_[_0xa5c2('0x38')](_0x16b7a3[_0xa5c2('0x2f')],_0x25b1d6[_0xa5c2('0x37')]));if(_0x16b7a3['query']['filter']){_0x570c9f[_0xa5c2('0x36')]=_[_0xa5c2('0x39')](_0x570c9f[_0xa5c2('0x36')],{'$or':_['map'](_0x570c9f['attributes'],function(_0x8f45a3){var _0x267990={};_0x267990[_0x8f45a3]={'$like':'%'+_0x16b7a3[_0xa5c2('0x2f')][_0xa5c2('0x3b')]+'%'};return _0x267990;})});}_0x570c9f=_[_0xa5c2('0x39')]({},_0x570c9f,_0x16b7a3['options']);return _0x3fb5a5[_0xa5c2('0x4e')](_0x570c9f);}})['then'](function(_0x19ddf7){if(_0x19ddf7){_0xada61c=_0x19ddf7[_0xa5c2('0x33')];if(!_0x16b7a3[_0xa5c2('0x2f')][_0xa5c2('0x4d')]('nolimit')){_0x570c9f['limit']=qs['limit'](_0x16b7a3['query'][_0xa5c2('0x1b')]);_0x570c9f[_0xa5c2('0x19')]=qs['offset'](_0x16b7a3['query'][_0xa5c2('0x19')]);}return _0x3fb5a5[_0xa5c2('0x4e')](_0x570c9f);}})['then'](function(_0x40dc66){if(_0x40dc66){return _0x40dc66?{'count':_0xada61c,'rows':_0x40dc66}:null;}})[_0xa5c2('0x24')](respondWithResult(_0x5f88bd,null))[_0xa5c2('0x3f')](handleError(_0x5f88bd,null));};exports[_0xa5c2('0x4f')]=function(_0x579bdc,_0x1a84a7,_0x4e8280){var _0x5a12e3={};var _0x1ff2ed={};var _0x5503af;var _0x5beaf9;return db[_0xa5c2('0x2a')][_0xa5c2('0x4a')]({'where':{'id':_0x579bdc[_0xa5c2('0x47')]['id']}})[_0xa5c2('0x24')](handleEntityNotFound(_0x1a84a7,null))[_0xa5c2('0x24')](function(_0x52165e){if(_0x52165e){_0x5503af=_0x52165e;_0x1ff2ed['model']=_[_0xa5c2('0x41')](db[_0xa5c2('0x4b')][_0xa5c2('0x42')]);_0x1ff2ed['query']=_['keys'](_0x579bdc[_0xa5c2('0x2f')]);_0x1ff2ed['filters']=_[_0xa5c2('0x30')](_0x1ff2ed[_0xa5c2('0x2d')],_0x1ff2ed['query']);_0x5a12e3['attributes']=_[_0xa5c2('0x30')](_0x1ff2ed[_0xa5c2('0x2d')],qs['fields'](_0x579bdc[_0xa5c2('0x2f')][_0xa5c2('0x32')]));_0x5a12e3['attributes']=_0x5a12e3[_0xa5c2('0x31')]['length']?_0x5a12e3[_0xa5c2('0x31')]:_0x1ff2ed[_0xa5c2('0x2d')];_0x5a12e3[_0xa5c2('0x35')]=qs['sort'](_0x579bdc['query'][_0xa5c2('0x4c')]);_0x5a12e3[_0xa5c2('0x36')]=qs[_0xa5c2('0x37')](_[_0xa5c2('0x38')](_0x579bdc[_0xa5c2('0x2f')],_0x1ff2ed['filters']));if(_0x579bdc[_0xa5c2('0x2f')]['filter']){_0x5a12e3['where']=_[_0xa5c2('0x39')](_0x5a12e3[_0xa5c2('0x36')],{'$or':_[_0xa5c2('0x29')](_0x5a12e3[_0xa5c2('0x31')],function(_0x3bc2a6){var _0x296650={};_0x296650[_0x3bc2a6]={'$like':'%'+_0x579bdc[_0xa5c2('0x2f')][_0xa5c2('0x3b')]+'%'};return _0x296650;})});}_0x5a12e3=_[_0xa5c2('0x39')]({},_0x5a12e3,_0x579bdc[_0xa5c2('0x43')]);return _0x5503af[_0xa5c2('0x4f')](_0x5a12e3);}})[_0xa5c2('0x24')](function(_0x496970){if(_0x496970){_0x5beaf9=_0x496970[_0xa5c2('0x33')];if(!_0x579bdc[_0xa5c2('0x2f')][_0xa5c2('0x4d')](_0xa5c2('0x34'))){_0x5a12e3[_0xa5c2('0x1b')]=qs[_0xa5c2('0x1b')](_0x579bdc[_0xa5c2('0x2f')][_0xa5c2('0x1b')]);_0x5a12e3[_0xa5c2('0x19')]=qs[_0xa5c2('0x19')](_0x579bdc[_0xa5c2('0x2f')][_0xa5c2('0x19')]);}return _0x5503af['getDescriptions'](_0x5a12e3);}})[_0xa5c2('0x24')](function(_0x271791){if(_0x271791){return _0x271791?{'count':_0x5beaf9,'rows':_0x271791}:null;}})[_0xa5c2('0x24')](respondWithResult(_0x1a84a7,null))[_0xa5c2('0x3f')](handleError(_0x1a84a7,null));}; \ No newline at end of file +var _0xd86f=['findAll','params','keys','include','options','find','catch','create','body','destroy','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','includeAll'];(function(_0x8456f,_0x3be106){var _0x15c5a5=function(_0x17dd1e){while(--_0x17dd1e){_0x8456f['push'](_0x8456f['shift']());}};_0x15c5a5(++_0x3be106);}(_0xd86f,0xf6));var _0xfd86=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xd86f[_0x29d94e];return _0x106237;};'use strict';var emlformat=require(_0xfd86('0x0'));var rimraf=require(_0xfd86('0x1'));var zipdir=require(_0xfd86('0x2'));var jsonpatch=require(_0xfd86('0x3'));var rp=require(_0xfd86('0x4'));var moment=require(_0xfd86('0x5'));var BPromise=require(_0xfd86('0x6'));var Mustache=require(_0xfd86('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfd86('0x8'));var ejs=require(_0xfd86('0x9'));var fs=require('fs');var fs_extra=require(_0xfd86('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfd86('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfd86('0x8'));var querystring=require(_0xfd86('0xc'));var Papa=require(_0xfd86('0xd'));var Redis=require(_0xfd86('0xe'));var authService=require(_0xfd86('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfd86('0x10'));var hardwareService=require(_0xfd86('0x11'));var logger=require('../../config/logger')(_0xfd86('0x12'));var utils=require(_0xfd86('0x13'));var config=require(_0xfd86('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd86('0x15'))['db'];function respondWithStatusCode(_0x4ba8ab,_0x5f1f3e){_0x5f1f3e=_0x5f1f3e||0xcc;return function(_0x18fad9){if(_0x18fad9){return _0x4ba8ab[_0xfd86('0x16')](_0x5f1f3e);}return _0x4ba8ab['status'](_0x5f1f3e)[_0xfd86('0x17')]();};}function respondWithResult(_0x5dfa0e,_0x178ed3){_0x178ed3=_0x178ed3||0xc8;return function(_0x23b8fc){if(_0x23b8fc){return _0x5dfa0e[_0xfd86('0x18')](_0x178ed3)[_0xfd86('0x19')](_0x23b8fc);}};}function respondWithFilteredResult(_0xa98827,_0x39a5b9){return function(_0xd5f5e0){if(_0xd5f5e0){var _0x470c22=typeof _0x39a5b9['offset']===_0xfd86('0x1a')&&typeof _0x39a5b9[_0xfd86('0x1b')]==='undefined';var _0x1e857f=_0xd5f5e0[_0xfd86('0x1c')];var _0x5c9ad5=_0x470c22?0x0:_0x39a5b9[_0xfd86('0x1d')];var _0x3086a3=_0x470c22?_0xd5f5e0['count']:_0x39a5b9[_0xfd86('0x1d')]+_0x39a5b9[_0xfd86('0x1b')];var _0x58f33e;if(_0x3086a3>=_0x1e857f){_0x3086a3=_0x1e857f;_0x58f33e=0xc8;}else{_0x58f33e=0xce;}_0xa98827[_0xfd86('0x18')](_0x58f33e);return _0xa98827[_0xfd86('0x1e')](_0xfd86('0x1f'),_0x5c9ad5+'-'+_0x3086a3+'/'+_0x1e857f)[_0xfd86('0x19')](_0xd5f5e0);}return null;};}function patchUpdates(_0x20666f){return function(_0x2bd11b){try{jsonpatch[_0xfd86('0x20')](_0x2bd11b,_0x20666f,!![]);}catch(_0x488d3f){return BPromise['reject'](_0x488d3f);}return _0x2bd11b[_0xfd86('0x21')]();};}function saveUpdates(_0x4562fe,_0xc16cc5){return function(_0x48e4b1){if(_0x48e4b1){return _0x48e4b1[_0xfd86('0x22')](_0x4562fe)[_0xfd86('0x23')](function(_0x4ad150){return _0x4ad150;});}return null;};}function removeEntity(_0x157fe7,_0x3f2e70){return function(_0x1c9150){if(_0x1c9150){return _0x1c9150['destroy']()[_0xfd86('0x23')](function(){_0x157fe7[_0xfd86('0x18')](0xcc)[_0xfd86('0x17')]();});}};}function handleEntityNotFound(_0x1639a1,_0x1d2435){return function(_0x306610){if(!_0x306610){_0x1639a1[_0xfd86('0x16')](0x194);}return _0x306610;};}function handleError(_0x364854,_0x52975e){_0x52975e=_0x52975e||0x1f4;return function(_0x463825){logger['error'](_0x463825[_0xfd86('0x24')]);if(_0x463825[_0xfd86('0x25')]){delete _0x463825[_0xfd86('0x25')];}_0x364854[_0xfd86('0x18')](_0x52975e)[_0xfd86('0x26')](_0x463825);};}exports[_0xfd86('0x27')]=function(_0x253cec,_0x1644be){var _0x59ca2c={},_0x2d4e67={},_0x3ad327={'count':0x0,'rows':[]};var _0x4a4a13=_['map'](db[_0xfd86('0x28')][_0xfd86('0x29')],function(_0x42bd91){return{'name':_0x42bd91[_0xfd86('0x2a')],'type':_0x42bd91[_0xfd86('0x2b')]['key']};});_0x2d4e67['model']=_['map'](_0x4a4a13,_0xfd86('0x25'));_0x2d4e67[_0xfd86('0x2c')]=_['keys'](_0x253cec[_0xfd86('0x2c')]);_0x2d4e67[_0xfd86('0x2d')]=_[_0xfd86('0x2e')](_0x2d4e67['model'],_0x2d4e67['query']);_0x59ca2c[_0xfd86('0x2f')]=_[_0xfd86('0x2e')](_0x2d4e67[_0xfd86('0x30')],qs['fields'](_0x253cec[_0xfd86('0x2c')][_0xfd86('0x31')]));_0x59ca2c['attributes']=_0x59ca2c[_0xfd86('0x2f')][_0xfd86('0x32')]?_0x59ca2c[_0xfd86('0x2f')]:_0x2d4e67[_0xfd86('0x30')];if(!_0x253cec['query'][_0xfd86('0x33')](_0xfd86('0x34'))){_0x59ca2c[_0xfd86('0x1b')]=qs['limit'](_0x253cec[_0xfd86('0x2c')][_0xfd86('0x1b')]);_0x59ca2c['offset']=qs[_0xfd86('0x1d')](_0x253cec[_0xfd86('0x2c')]['offset']);}_0x59ca2c[_0xfd86('0x35')]=qs[_0xfd86('0x36')](_0x253cec['query']['sort']);_0x59ca2c[_0xfd86('0x37')]=qs[_0xfd86('0x2d')](_[_0xfd86('0x38')](_0x253cec[_0xfd86('0x2c')],_0x2d4e67[_0xfd86('0x2d')]),_0x4a4a13);if(_0x253cec[_0xfd86('0x2c')][_0xfd86('0x39')]){_0x59ca2c[_0xfd86('0x37')]=_['merge'](_0x59ca2c[_0xfd86('0x37')],{'$or':_[_0xfd86('0x3a')](_0x4a4a13,function(_0x155861){if(_0x155861[_0xfd86('0x2b')]!==_0xfd86('0x3b')){var _0x3c7e1c={};_0x3c7e1c[_0x155861[_0xfd86('0x25')]]={'$like':'%'+_0x253cec[_0xfd86('0x2c')]['filter']+'%'};return _0x3c7e1c;}})});}_0x59ca2c=_[_0xfd86('0x3c')]({},_0x59ca2c,_0x253cec['options']);var _0x52d89e={'where':_0x59ca2c['where']};return db[_0xfd86('0x28')][_0xfd86('0x1c')](_0x52d89e)[_0xfd86('0x23')](function(_0xcf8cc7){_0x3ad327[_0xfd86('0x1c')]=_0xcf8cc7;if(_0x253cec[_0xfd86('0x2c')][_0xfd86('0x3d')]){_0x59ca2c['include']=[{'all':!![]}];}return db[_0xfd86('0x28')][_0xfd86('0x3e')](_0x59ca2c);})[_0xfd86('0x23')](function(_0x22c7a6){_0x3ad327['rows']=_0x22c7a6;return _0x3ad327;})['then'](respondWithFilteredResult(_0x1644be,_0x59ca2c))['catch'](handleError(_0x1644be,null));};exports['show']=function(_0x427109,_0x55025f){var _0x5de211={'raw':![],'where':{'id':_0x427109[_0xfd86('0x3f')]['id']}},_0x616ef2={};_0x616ef2['model']=_['keys'](db[_0xfd86('0x28')][_0xfd86('0x29')]);_0x616ef2['query']=_[_0xfd86('0x40')](_0x427109['query']);_0x616ef2['filters']=_[_0xfd86('0x2e')](_0x616ef2[_0xfd86('0x30')],_0x616ef2[_0xfd86('0x2c')]);_0x5de211['attributes']=_['intersection'](_0x616ef2[_0xfd86('0x30')],qs[_0xfd86('0x31')](_0x427109[_0xfd86('0x2c')][_0xfd86('0x31')]));_0x5de211[_0xfd86('0x2f')]=_0x5de211[_0xfd86('0x2f')][_0xfd86('0x32')]?_0x5de211['attributes']:_0x616ef2[_0xfd86('0x30')];if(_0x427109[_0xfd86('0x2c')]['includeAll']){_0x5de211[_0xfd86('0x41')]=[{'all':!![]}];}_0x5de211=_[_0xfd86('0x3c')]({},_0x5de211,_0x427109[_0xfd86('0x42')]);return db['VtigerConfiguration'][_0xfd86('0x43')](_0x5de211)['then'](handleEntityNotFound(_0x55025f,null))[_0xfd86('0x23')](respondWithResult(_0x55025f,null))[_0xfd86('0x44')](handleError(_0x55025f,null));};exports['create']=function(_0x4ac5f8,_0x39732a){return db[_0xfd86('0x28')][_0xfd86('0x45')](_0x4ac5f8[_0xfd86('0x46')],{})[_0xfd86('0x23')](respondWithResult(_0x39732a,0xc9))[_0xfd86('0x44')](handleError(_0x39732a,null));};exports[_0xfd86('0x22')]=function(_0xd25228,_0x205c7c){if(_0xd25228[_0xfd86('0x46')]['id']){delete _0xd25228[_0xfd86('0x46')]['id'];}return db['VtigerConfiguration'][_0xfd86('0x43')]({'where':{'id':_0xd25228[_0xfd86('0x3f')]['id']}})[_0xfd86('0x23')](handleEntityNotFound(_0x205c7c,null))['then'](saveUpdates(_0xd25228['body'],null))[_0xfd86('0x23')](respondWithResult(_0x205c7c,null))[_0xfd86('0x44')](handleError(_0x205c7c,null));};exports[_0xfd86('0x47')]=function(_0x1cd07a,_0x3431fc){return db['VtigerConfiguration']['find']({'where':{'id':_0x1cd07a[_0xfd86('0x3f')]['id']}})[_0xfd86('0x23')](handleEntityNotFound(_0x3431fc,null))[_0xfd86('0x23')](removeEntity(_0x3431fc,null))[_0xfd86('0x44')](handleError(_0x3431fc,null));};exports[_0xfd86('0x48')]=function(_0x13a2eb,_0x4f448b,_0x18674){var _0x356f32={};var _0x5827a7={};var _0x1a3bba;var _0x2c863d;return db['VtigerConfiguration'][_0xfd86('0x49')]({'where':{'id':_0x13a2eb[_0xfd86('0x3f')]['id']}})[_0xfd86('0x23')](handleEntityNotFound(_0x4f448b,null))[_0xfd86('0x23')](function(_0x355deb){if(_0x355deb){_0x1a3bba=_0x355deb;_0x5827a7[_0xfd86('0x30')]=_[_0xfd86('0x40')](db[_0xfd86('0x4a')][_0xfd86('0x29')]);_0x5827a7[_0xfd86('0x2c')]=_['keys'](_0x13a2eb[_0xfd86('0x2c')]);_0x5827a7[_0xfd86('0x2d')]=_[_0xfd86('0x2e')](_0x5827a7[_0xfd86('0x30')],_0x5827a7[_0xfd86('0x2c')]);_0x356f32['attributes']=_['intersection'](_0x5827a7[_0xfd86('0x30')],qs[_0xfd86('0x31')](_0x13a2eb[_0xfd86('0x2c')]['fields']));_0x356f32[_0xfd86('0x2f')]=_0x356f32[_0xfd86('0x2f')][_0xfd86('0x32')]?_0x356f32['attributes']:_0x5827a7[_0xfd86('0x30')];_0x356f32[_0xfd86('0x35')]=qs[_0xfd86('0x36')](_0x13a2eb['query'][_0xfd86('0x36')]);_0x356f32[_0xfd86('0x37')]=qs['filters'](_[_0xfd86('0x38')](_0x13a2eb[_0xfd86('0x2c')],_0x5827a7['filters']));if(_0x13a2eb[_0xfd86('0x2c')][_0xfd86('0x39')]){_0x356f32[_0xfd86('0x37')]=_[_0xfd86('0x3c')](_0x356f32['where'],{'$or':_[_0xfd86('0x3a')](_0x356f32[_0xfd86('0x2f')],function(_0x432c14){var _0x11187a={};_0x11187a[_0x432c14]={'$like':'%'+_0x13a2eb[_0xfd86('0x2c')][_0xfd86('0x39')]+'%'};return _0x11187a;})});}_0x356f32=_['merge']({},_0x356f32,_0x13a2eb[_0xfd86('0x42')]);return _0x1a3bba[_0xfd86('0x48')](_0x356f32);}})[_0xfd86('0x23')](function(_0x5cccc4){if(_0x5cccc4){_0x2c863d=_0x5cccc4[_0xfd86('0x32')];if(!_0x13a2eb['query']['hasOwnProperty'](_0xfd86('0x34'))){_0x356f32['limit']=qs[_0xfd86('0x1b')](_0x13a2eb[_0xfd86('0x2c')][_0xfd86('0x1b')]);_0x356f32[_0xfd86('0x1d')]=qs[_0xfd86('0x1d')](_0x13a2eb[_0xfd86('0x2c')][_0xfd86('0x1d')]);}return _0x1a3bba[_0xfd86('0x48')](_0x356f32);}})[_0xfd86('0x23')](function(_0x5cce3d){if(_0x5cce3d){return _0x5cce3d?{'count':_0x2c863d,'rows':_0x5cce3d}:null;}})[_0xfd86('0x23')](respondWithResult(_0x4f448b,null))['catch'](handleError(_0x4f448b,null));};exports['getSubjects']=function(_0xc5fa6a,_0x2ef61f,_0x5a1474){var _0x144b37={};var _0x41a181={};var _0x232171;var _0x2a8e63;return db[_0xfd86('0x28')][_0xfd86('0x49')]({'where':{'id':_0xc5fa6a[_0xfd86('0x3f')]['id']}})[_0xfd86('0x23')](handleEntityNotFound(_0x2ef61f,null))[_0xfd86('0x23')](function(_0x276cad){if(_0x276cad){_0x232171=_0x276cad;_0x41a181[_0xfd86('0x30')]=_['keys'](db[_0xfd86('0x4a')][_0xfd86('0x29')]);_0x41a181[_0xfd86('0x2c')]=_[_0xfd86('0x40')](_0xc5fa6a['query']);_0x41a181[_0xfd86('0x2d')]=_['intersection'](_0x41a181[_0xfd86('0x30')],_0x41a181[_0xfd86('0x2c')]);_0x144b37[_0xfd86('0x2f')]=_[_0xfd86('0x2e')](_0x41a181[_0xfd86('0x30')],qs[_0xfd86('0x31')](_0xc5fa6a[_0xfd86('0x2c')][_0xfd86('0x31')]));_0x144b37[_0xfd86('0x2f')]=_0x144b37[_0xfd86('0x2f')][_0xfd86('0x32')]?_0x144b37[_0xfd86('0x2f')]:_0x41a181[_0xfd86('0x30')];_0x144b37[_0xfd86('0x35')]=qs[_0xfd86('0x36')](_0xc5fa6a[_0xfd86('0x2c')]['sort']);_0x144b37[_0xfd86('0x37')]=qs[_0xfd86('0x2d')](_[_0xfd86('0x38')](_0xc5fa6a['query'],_0x41a181[_0xfd86('0x2d')]));if(_0xc5fa6a['query']['filter']){_0x144b37[_0xfd86('0x37')]=_[_0xfd86('0x3c')](_0x144b37[_0xfd86('0x37')],{'$or':_[_0xfd86('0x3a')](_0x144b37[_0xfd86('0x2f')],function(_0x85496f){var _0x28efcf={};_0x28efcf[_0x85496f]={'$like':'%'+_0xc5fa6a[_0xfd86('0x2c')][_0xfd86('0x39')]+'%'};return _0x28efcf;})});}_0x144b37=_[_0xfd86('0x3c')]({},_0x144b37,_0xc5fa6a[_0xfd86('0x42')]);return _0x232171[_0xfd86('0x4b')](_0x144b37);}})[_0xfd86('0x23')](function(_0x51e3bb){if(_0x51e3bb){_0x2a8e63=_0x51e3bb['length'];if(!_0xc5fa6a[_0xfd86('0x2c')][_0xfd86('0x33')](_0xfd86('0x34'))){_0x144b37[_0xfd86('0x1b')]=qs[_0xfd86('0x1b')](_0xc5fa6a[_0xfd86('0x2c')][_0xfd86('0x1b')]);_0x144b37[_0xfd86('0x1d')]=qs[_0xfd86('0x1d')](_0xc5fa6a[_0xfd86('0x2c')][_0xfd86('0x1d')]);}return _0x232171[_0xfd86('0x4b')](_0x144b37);}})['then'](function(_0x2c0ab4){if(_0x2c0ab4){return _0x2c0ab4?{'count':_0x2a8e63,'rows':_0x2c0ab4}:null;}})[_0xfd86('0x23')](respondWithResult(_0x2ef61f,null))['catch'](handleError(_0x2ef61f,null));};exports[_0xfd86('0x4c')]=function(_0xdc2aa2,_0x3e96d0,_0x369b40){var _0x5b47d1={};var _0x45240c={};var _0x254023;var _0x1fa2b4;return db[_0xfd86('0x28')][_0xfd86('0x49')]({'where':{'id':_0xdc2aa2[_0xfd86('0x3f')]['id']}})[_0xfd86('0x23')](handleEntityNotFound(_0x3e96d0,null))[_0xfd86('0x23')](function(_0x5451de){if(_0x5451de){_0x254023=_0x5451de;_0x45240c['model']=_[_0xfd86('0x40')](db[_0xfd86('0x4a')]['rawAttributes']);_0x45240c[_0xfd86('0x2c')]=_[_0xfd86('0x40')](_0xdc2aa2['query']);_0x45240c[_0xfd86('0x2d')]=_[_0xfd86('0x2e')](_0x45240c['model'],_0x45240c[_0xfd86('0x2c')]);_0x5b47d1[_0xfd86('0x2f')]=_['intersection'](_0x45240c[_0xfd86('0x30')],qs['fields'](_0xdc2aa2['query'][_0xfd86('0x31')]));_0x5b47d1[_0xfd86('0x2f')]=_0x5b47d1['attributes'][_0xfd86('0x32')]?_0x5b47d1[_0xfd86('0x2f')]:_0x45240c[_0xfd86('0x30')];_0x5b47d1['order']=qs['sort'](_0xdc2aa2['query'][_0xfd86('0x36')]);_0x5b47d1[_0xfd86('0x37')]=qs[_0xfd86('0x2d')](_['pick'](_0xdc2aa2[_0xfd86('0x2c')],_0x45240c['filters']));if(_0xdc2aa2[_0xfd86('0x2c')][_0xfd86('0x39')]){_0x5b47d1[_0xfd86('0x37')]=_[_0xfd86('0x3c')](_0x5b47d1['where'],{'$or':_['map'](_0x5b47d1[_0xfd86('0x2f')],function(_0x45cf84){var _0x209303={};_0x209303[_0x45cf84]={'$like':'%'+_0xdc2aa2[_0xfd86('0x2c')][_0xfd86('0x39')]+'%'};return _0x209303;})});}_0x5b47d1=_[_0xfd86('0x3c')]({},_0x5b47d1,_0xdc2aa2[_0xfd86('0x42')]);return _0x254023[_0xfd86('0x4c')](_0x5b47d1);}})[_0xfd86('0x23')](function(_0x5668ee){if(_0x5668ee){_0x1fa2b4=_0x5668ee[_0xfd86('0x32')];if(!_0xdc2aa2['query'][_0xfd86('0x33')](_0xfd86('0x34'))){_0x5b47d1[_0xfd86('0x1b')]=qs['limit'](_0xdc2aa2['query'][_0xfd86('0x1b')]);_0x5b47d1[_0xfd86('0x1d')]=qs[_0xfd86('0x1d')](_0xdc2aa2[_0xfd86('0x2c')]['offset']);}return _0x254023[_0xfd86('0x4c')](_0x5b47d1);}})['then'](function(_0x45456b){if(_0x45456b){return _0x45456b?{'count':_0x1fa2b4,'rows':_0x45456b}:null;}})['then'](respondWithResult(_0x3e96d0,null))[_0xfd86('0x44')](handleError(_0x3e96d0,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 0e4794a..bc5cff7 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 _0x3b33=['request-promise','rimraf','../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2be240,_0x1e119d){var _0x123543=function(_0x580bf4){while(--_0x580bf4){_0x2be240['push'](_0x2be240['shift']());}};_0x123543(++_0x1e119d);}(_0x3b33,0xbb));var _0x33b3=function(_0x4dcdbb,_0x35011c){_0x4dcdbb=_0x4dcdbb-0x0;var _0x2fdb69=_0x3b33[_0x4dcdbb];return _0x2fdb69;};'use strict';var _=require(_0x33b3('0x0'));var util=require(_0x33b3('0x1'));var logger=require(_0x33b3('0x2'))('api');var moment=require(_0x33b3('0x3'));var BPromise=require(_0x33b3('0x4'));var rp=require(_0x33b3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33b3('0x6'));var config=require(_0x33b3('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x33b3('0x8')]=function(_0x4d888e,_0x130ff9){return _0x4d888e[_0x33b3('0x9')](_0x33b3('0xa'),attributes,{'tableName':_0x33b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf0d4=['VtigerConfiguration','int_vtiger_configurations','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0d4,0x7a));var _0x4f0d=function(_0x544ec1,_0x2814eb){_0x544ec1=_0x544ec1-0x0;var _0x31e735=_0xf0d4[_0x544ec1];return _0x31e735;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4f0d('0x0'))(_0x4f0d('0x1'));var moment=require('moment');var BPromise=require(_0x4f0d('0x2'));var rp=require(_0x4f0d('0x3'));var fs=require('fs');var path=require(_0x4f0d('0x4'));var rimraf=require(_0x4f0d('0x5'));var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x4f0d('0x6')]=function(_0x445ca8,_0x1d306e){return _0x445ca8[_0x4f0d('0x7')](_0x4f0d('0x8'),attributes,{'tableName':_0x4f0d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index 86256a7..6690145 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 _0xfbeb=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message'];(function(_0x2a3734,_0x3ddaa3){var _0x5f262b=function(_0x3105f6){while(--_0x3105f6){_0x2a3734['push'](_0x2a3734['shift']());}};_0x5f262b(++_0x3ddaa3);}(_0xfbeb,0x115));var _0xbfbe=function(_0x309b09,_0xe4c181){_0x309b09=_0x309b09-0x0;var _0x7b38d7=_0xfbeb[_0x309b09];return _0x7b38d7;};'use strict';var _=require(_0xbfbe('0x0'));var util=require(_0xbfbe('0x1'));var moment=require(_0xbfbe('0x2'));var BPromise=require(_0xbfbe('0x3'));var rs=require(_0xbfbe('0x4'));var fs=require('fs');var Redis=require(_0xbfbe('0x5'));var db=require(_0xbfbe('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbfbe('0x7'))(_0xbfbe('0x8'));var config=require(_0xbfbe('0x9'));var jayson=require(_0xbfbe('0xa'));var client=jayson[_0xbfbe('0xb')][_0xbfbe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd9fcfe,_0x3b9419,_0x591f13){return new BPromise(function(_0x3e1a69,_0x5930c7){return client[_0xbfbe('0xd')](_0xd9fcfe,_0x591f13)['then'](function(_0x10d5b3){logger[_0xbfbe('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x3b9419,_0xbfbe('0xf'));logger[_0xbfbe('0x10')](_0xbfbe('0x11'),_0x3b9419,_0xbfbe('0xf'),JSON[_0xbfbe('0x12')](_0x10d5b3));if(_0x10d5b3[_0xbfbe('0x13')]){if(_0x10d5b3[_0xbfbe('0x13')][_0xbfbe('0x14')]===0x1f4){logger['error'](_0xbfbe('0x15'),_0x3b9419,_0x10d5b3[_0xbfbe('0x13')][_0xbfbe('0x16')]);return _0x5930c7(_0x10d5b3[_0xbfbe('0x13')][_0xbfbe('0x16')]);}logger[_0xbfbe('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x3b9419,_0x10d5b3[_0xbfbe('0x13')]['message']);return _0x3e1a69(_0x10d5b3[_0xbfbe('0x13')]['message']);}else{logger[_0xbfbe('0xe')](_0xbfbe('0x15'),_0x3b9419,_0xbfbe('0xf'));_0x3e1a69(_0x10d5b3[_0xbfbe('0x17')][_0xbfbe('0x16')]);}})[_0xbfbe('0x18')](function(_0x1bf573){logger[_0xbfbe('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x3b9419,_0x1bf573);_0x5930c7(_0x1bf573);});});} \ No newline at end of file +var _0xefe5=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3ce948,_0xe8845d){var _0x2c5313=function(_0x43dcce){while(--_0x43dcce){_0x3ce948['push'](_0x3ce948['shift']());}};_0x2c5313(++_0xe8845d);}(_0xefe5,0x179));var _0x5efe=function(_0x4c3d75,_0x3288ec){_0x4c3d75=_0x4c3d75-0x0;var _0x4223e1=_0xefe5[_0x4c3d75];return _0x4223e1;};'use strict';var _=require('lodash');var util=require(_0x5efe('0x0'));var moment=require(_0x5efe('0x1'));var BPromise=require(_0x5efe('0x2'));var rs=require(_0x5efe('0x3'));var fs=require('fs');var Redis=require(_0x5efe('0x4'));var db=require(_0x5efe('0x5'))['db'];var utils=require(_0x5efe('0x6'));var logger=require(_0x5efe('0x7'))(_0x5efe('0x8'));var config=require(_0x5efe('0x9'));var jayson=require(_0x5efe('0xa'));var client=jayson[_0x5efe('0xb')][_0x5efe('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1835b0,_0x19cd65,_0x17b4aa){return new BPromise(function(_0x321686,_0x38183a){return client['request'](_0x1835b0,_0x17b4aa)[_0x5efe('0xd')](function(_0x40d525){logger[_0x5efe('0xe')](_0x5efe('0xf'),_0x19cd65,_0x5efe('0x10'));logger[_0x5efe('0x11')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x19cd65,'request\x20sent',JSON[_0x5efe('0x12')](_0x40d525));if(_0x40d525[_0x5efe('0x13')]){if(_0x40d525[_0x5efe('0x13')][_0x5efe('0x14')]===0x1f4){logger[_0x5efe('0x13')](_0x5efe('0xf'),_0x19cd65,_0x40d525[_0x5efe('0x13')]['message']);return _0x38183a(_0x40d525['error']['message']);}logger[_0x5efe('0x13')](_0x5efe('0xf'),_0x19cd65,_0x40d525['error'][_0x5efe('0x15')]);return _0x321686(_0x40d525[_0x5efe('0x13')][_0x5efe('0x15')]);}else{logger[_0x5efe('0xe')](_0x5efe('0xf'),_0x19cd65,_0x5efe('0x10'));_0x321686(_0x40d525[_0x5efe('0x16')][_0x5efe('0x15')]);}})[_0x5efe('0x17')](function(_0x48f9e4){logger[_0x5efe('0x13')](_0x5efe('0xf'),_0x19cd65,_0x48f9e4);_0x38183a(_0x48f9e4);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index a32e1d3..6148512 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 _0x58c1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xce73d7,_0x4f1935){var _0x574146=function(_0x44ea3a){while(--_0x44ea3a){_0xce73d7['push'](_0xce73d7['shift']());}};_0x574146(++_0x4f1935);}(_0x58c1,0x174));var _0x158c=function(_0x290989,_0x5bc4c4){_0x290989=_0x290989-0x0;var _0x2e127f=_0x58c1[_0x290989];return _0x2e127f;};'use strict';var multer=require('multer');var util=require(_0x158c('0x0'));var path=require(_0x158c('0x1'));var timeout=require(_0x158c('0x2'));var express=require(_0x158c('0x3'));var router=express[_0x158c('0x4')]();var fs_extra=require(_0x158c('0x5'));var auth=require(_0x158c('0x6'));var interaction=require(_0x158c('0x7'));var config=require(_0x158c('0x8'));var controller=require(_0x158c('0x9'));router[_0x158c('0xa')]('/',auth[_0x158c('0xb')](),controller[_0x158c('0xc')]);router['get'](_0x158c('0xd'),auth[_0x158c('0xb')](),controller[_0x158c('0xe')]);router[_0x158c('0xf')]('/',auth['isAuthenticated'](),controller[_0x158c('0x10')]);router[_0x158c('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x158c('0x12')](_0x158c('0xd'),auth[_0x158c('0xb')](),controller[_0x158c('0x13')]);module[_0x158c('0x14')]=router; \ No newline at end of file +var _0xabb1=['post','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show'];(function(_0x4cd790,_0xb24161){var _0x1bad99=function(_0x219b82){while(--_0x219b82){_0x4cd790['push'](_0x4cd790['shift']());}};_0x1bad99(++_0xb24161);}(_0xabb1,0xba));var _0x1abb=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xabb1[_0x45d3f0];return _0x314b79;};'use strict';var multer=require(_0x1abb('0x0'));var util=require('util');var path=require(_0x1abb('0x1'));var timeout=require(_0x1abb('0x2'));var express=require('express');var router=express[_0x1abb('0x3')]();var fs_extra=require(_0x1abb('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1abb('0x5'));var config=require(_0x1abb('0x6'));var controller=require(_0x1abb('0x7'));router[_0x1abb('0x8')]('/',auth[_0x1abb('0x9')](),controller['index']);router['get'](_0x1abb('0xa'),auth[_0x1abb('0x9')](),controller[_0x1abb('0xb')]);router[_0x1abb('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1abb('0xd')](_0x1abb('0xa'),auth[_0x1abb('0x9')](),controller[_0x1abb('0xe')]);router[_0x1abb('0xf')](_0x1abb('0xa'),auth[_0x1abb('0x9')](),controller[_0x1abb('0x10')]);module[_0x1abb('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 99bf99e..1ec653b 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 _0x5604=['sequelize','picklist','string','STRING','ENUM','variable','customVariable','BOOLEAN'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5604,0x1b8));var _0x4560=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x5604[_0x4c440b];return _0x2d48cf;};'use strict';var Sequelize=require(_0x4560('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable','customVariable','keyValue',_0x4560('0x1')),'defaultValue':_0x4560('0x2')},'content':{'type':Sequelize[_0x4560('0x3')]},'key':{'type':Sequelize[_0x4560('0x3')]},'keyType':{'type':Sequelize[_0x4560('0x4')](_0x4560('0x2'),_0x4560('0x5'),_0x4560('0x6'))},'keyContent':{'type':Sequelize[_0x4560('0x3')]},'idField':{'type':Sequelize[_0x4560('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4560('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4560('0x3')]}}; \ No newline at end of file +var _0xde7a=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','picklist'];(function(_0x289995,_0x275588){var _0x6b6825=function(_0x11c364){while(--_0x11c364){_0x289995['push'](_0x289995['shift']());}};_0x6b6825(++_0x275588);}(_0xde7a,0x108));var _0xade7=function(_0x2ee822,_0x4c15ab){_0x2ee822=_0x2ee822-0x0;var _0x3df987=_0xde7a[_0x2ee822];return _0x3df987;};'use strict';var Sequelize=require(_0xade7('0x0'));module[_0xade7('0x1')]={'type':{'type':Sequelize[_0xade7('0x2')](_0xade7('0x3'),_0xade7('0x4'),'customVariable','keyValue',_0xade7('0x5')),'defaultValue':_0xade7('0x3')},'content':{'type':Sequelize[_0xade7('0x6')]},'key':{'type':Sequelize[_0xade7('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xade7('0x3'),_0xade7('0x4'),_0xade7('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xade7('0x6')]},'nameField':{'type':Sequelize[_0xade7('0x6')]},'customField':{'type':Sequelize[_0xade7('0x8')],'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 565d5df..37ec701 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 _0x10b7=['body','update','destroy','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','params','keys','find','catch','create'];(function(_0xb7cb72,_0x19d391){var _0x4b7570=function(_0x5a4a93){while(--_0x5a4a93){_0xb7cb72['push'](_0xb7cb72['shift']());}};_0x4b7570(++_0x19d391);}(_0x10b7,0x137));var _0x710b=function(_0x5326cb,_0x28b72c){_0x5326cb=_0x5326cb-0x0;var _0x322d76=_0x10b7[_0x5326cb];return _0x322d76;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x710b('0x0'));var zipdir=require(_0x710b('0x1'));var jsonpatch=require(_0x710b('0x2'));var rp=require(_0x710b('0x3'));var moment=require(_0x710b('0x4'));var BPromise=require(_0x710b('0x5'));var Mustache=require(_0x710b('0x6'));var util=require(_0x710b('0x7'));var path=require(_0x710b('0x8'));var sox=require('sox');var csv=require(_0x710b('0x9'));var ejs=require(_0x710b('0xa'));var fs=require('fs');var fs_extra=require(_0x710b('0xb'));var _=require(_0x710b('0xc'));var squel=require(_0x710b('0xd'));var crypto=require(_0x710b('0xe'));var jsforce=require(_0x710b('0xf'));var deskjs=require(_0x710b('0x10'));var toCsv=require(_0x710b('0x9'));var querystring=require(_0x710b('0x11'));var Papa=require('papaparse');var Redis=require(_0x710b('0x12'));var authService=require(_0x710b('0x13'));var qs=require(_0x710b('0x14'));var as=require(_0x710b('0x15'));var hardwareService=require(_0x710b('0x16'));var logger=require(_0x710b('0x17'))(_0x710b('0x18'));var utils=require(_0x710b('0x19'));var config=require(_0x710b('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37e87c,_0x1c0170){_0x1c0170=_0x1c0170||0xcc;return function(_0x36dac7){if(_0x36dac7){return _0x37e87c[_0x710b('0x1b')](_0x1c0170);}return _0x37e87c[_0x710b('0x1c')](_0x1c0170)['end']();};}function respondWithResult(_0x195325,_0x236382){_0x236382=_0x236382||0xc8;return function(_0x9de3ef){if(_0x9de3ef){return _0x195325['status'](_0x236382)[_0x710b('0x1d')](_0x9de3ef);}};}function respondWithFilteredResult(_0x13d623,_0xa8b863){return function(_0x19890e){if(_0x19890e){var _0x2e7c48=typeof _0xa8b863['offset']==='undefined'&&typeof _0xa8b863[_0x710b('0x1e')]===_0x710b('0x1f');var _0x3438ad=_0x19890e[_0x710b('0x20')];var _0x212d72=_0x2e7c48?0x0:_0xa8b863[_0x710b('0x21')];var _0x318f57=_0x2e7c48?_0x19890e[_0x710b('0x20')]:_0xa8b863[_0x710b('0x21')]+_0xa8b863['limit'];var _0x3158f5;if(_0x318f57>=_0x3438ad){_0x318f57=_0x3438ad;_0x3158f5=0xc8;}else{_0x3158f5=0xce;}_0x13d623['status'](_0x3158f5);return _0x13d623[_0x710b('0x22')](_0x710b('0x23'),_0x212d72+'-'+_0x318f57+'/'+_0x3438ad)[_0x710b('0x1d')](_0x19890e);}return null;};}function patchUpdates(_0x4d2606){return function(_0x141bba){try{jsonpatch[_0x710b('0x24')](_0x141bba,_0x4d2606,!![]);}catch(_0x35118f){return BPromise[_0x710b('0x25')](_0x35118f);}return _0x141bba[_0x710b('0x26')]();};}function saveUpdates(_0x130810,_0x464ae3){return function(_0x27848b){if(_0x27848b){return _0x27848b['update'](_0x130810)[_0x710b('0x27')](function(_0x1969b3){return _0x1969b3;});}return null;};}function removeEntity(_0x9aa24,_0x264cd0){return function(_0x42a0e1){if(_0x42a0e1){return _0x42a0e1['destroy']()[_0x710b('0x27')](function(){_0x9aa24[_0x710b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfa0bb2,_0x4458ab){return function(_0x10f25c){if(!_0x10f25c){_0xfa0bb2[_0x710b('0x1b')](0x194);}return _0x10f25c;};}function handleError(_0x34506c,_0x81e59c){_0x81e59c=_0x81e59c||0x1f4;return function(_0x2275f6){logger[_0x710b('0x28')](_0x2275f6[_0x710b('0x29')]);if(_0x2275f6[_0x710b('0x2a')]){delete _0x2275f6[_0x710b('0x2a')];}_0x34506c[_0x710b('0x1c')](_0x81e59c)['send'](_0x2275f6);};}exports[_0x710b('0x2b')]=function(_0x516468,_0x4a80ca){var _0xe1f6e0={},_0x2c8d91={},_0x500335={'count':0x0,'rows':[]};var _0x491147=_[_0x710b('0x2c')](db[_0x710b('0x2d')][_0x710b('0x2e')],function(_0x59f28e){return{'name':_0x59f28e[_0x710b('0x2f')],'type':_0x59f28e[_0x710b('0x30')][_0x710b('0x31')]};});_0x2c8d91[_0x710b('0x32')]=_[_0x710b('0x2c')](_0x491147,_0x710b('0x2a'));_0x2c8d91['query']=_['keys'](_0x516468[_0x710b('0x33')]);_0x2c8d91[_0x710b('0x34')]=_[_0x710b('0x35')](_0x2c8d91['model'],_0x2c8d91['query']);_0xe1f6e0[_0x710b('0x36')]=_[_0x710b('0x35')](_0x2c8d91[_0x710b('0x32')],qs['fields'](_0x516468[_0x710b('0x33')][_0x710b('0x37')]));_0xe1f6e0[_0x710b('0x36')]=_0xe1f6e0['attributes'][_0x710b('0x38')]?_0xe1f6e0[_0x710b('0x36')]:_0x2c8d91[_0x710b('0x32')];if(!_0x516468['query']['hasOwnProperty'](_0x710b('0x39'))){_0xe1f6e0[_0x710b('0x1e')]=qs['limit'](_0x516468['query']['limit']);_0xe1f6e0[_0x710b('0x21')]=qs['offset'](_0x516468[_0x710b('0x33')][_0x710b('0x21')]);}_0xe1f6e0[_0x710b('0x3a')]=qs[_0x710b('0x3b')](_0x516468[_0x710b('0x33')][_0x710b('0x3b')]);_0xe1f6e0[_0x710b('0x3c')]=qs[_0x710b('0x34')](_[_0x710b('0x3d')](_0x516468['query'],_0x2c8d91[_0x710b('0x34')]),_0x491147);if(_0x516468[_0x710b('0x33')]['filter']){_0xe1f6e0[_0x710b('0x3c')]=_[_0x710b('0x3e')](_0xe1f6e0[_0x710b('0x3c')],{'$or':_[_0x710b('0x2c')](_0x491147,function(_0xf01968){if(_0xf01968[_0x710b('0x30')]!==_0x710b('0x3f')){var _0x18b80d={};_0x18b80d[_0xf01968['name']]={'$like':'%'+_0x516468[_0x710b('0x33')][_0x710b('0x40')]+'%'};return _0x18b80d;}})});}_0xe1f6e0=_[_0x710b('0x3e')]({},_0xe1f6e0,_0x516468[_0x710b('0x41')]);var _0x161f5a={'where':_0xe1f6e0[_0x710b('0x3c')]};return db['VtigerField'][_0x710b('0x20')](_0x161f5a)['then'](function(_0x22cb46){_0x500335[_0x710b('0x20')]=_0x22cb46;if(_0x516468[_0x710b('0x33')][_0x710b('0x42')]){_0xe1f6e0[_0x710b('0x43')]=[{'all':!![]}];}return db[_0x710b('0x2d')][_0x710b('0x44')](_0xe1f6e0);})['then'](function(_0x99e191){_0x500335['rows']=_0x99e191;return _0x500335;})['then'](respondWithFilteredResult(_0x4a80ca,_0xe1f6e0))['catch'](handleError(_0x4a80ca,null));};exports['show']=function(_0x4ec19b,_0xdc46ab){var _0x129c65={'raw':!![],'where':{'id':_0x4ec19b[_0x710b('0x45')]['id']}},_0x1238dc={};_0x1238dc[_0x710b('0x32')]=_[_0x710b('0x46')](db[_0x710b('0x2d')][_0x710b('0x2e')]);_0x1238dc[_0x710b('0x33')]=_[_0x710b('0x46')](_0x4ec19b['query']);_0x1238dc['filters']=_[_0x710b('0x35')](_0x1238dc[_0x710b('0x32')],_0x1238dc[_0x710b('0x33')]);_0x129c65['attributes']=_['intersection'](_0x1238dc[_0x710b('0x32')],qs[_0x710b('0x37')](_0x4ec19b['query'][_0x710b('0x37')]));_0x129c65[_0x710b('0x36')]=_0x129c65[_0x710b('0x36')][_0x710b('0x38')]?_0x129c65[_0x710b('0x36')]:_0x1238dc[_0x710b('0x32')];if(_0x4ec19b[_0x710b('0x33')][_0x710b('0x42')]){_0x129c65[_0x710b('0x43')]=[{'all':!![]}];}_0x129c65=_[_0x710b('0x3e')]({},_0x129c65,_0x4ec19b[_0x710b('0x41')]);return db[_0x710b('0x2d')][_0x710b('0x47')](_0x129c65)[_0x710b('0x27')](handleEntityNotFound(_0xdc46ab,null))[_0x710b('0x27')](respondWithResult(_0xdc46ab,null))[_0x710b('0x48')](handleError(_0xdc46ab,null));};exports[_0x710b('0x49')]=function(_0x4d6cf5,_0x4ea0c3){return db[_0x710b('0x2d')][_0x710b('0x49')](_0x4d6cf5[_0x710b('0x4a')],{})[_0x710b('0x27')](respondWithResult(_0x4ea0c3,0xc9))[_0x710b('0x48')](handleError(_0x4ea0c3,null));};exports[_0x710b('0x4b')]=function(_0x4764f7,_0x487c01){if(_0x4764f7[_0x710b('0x4a')]['id']){delete _0x4764f7[_0x710b('0x4a')]['id'];}return db[_0x710b('0x2d')][_0x710b('0x47')]({'where':{'id':_0x4764f7['params']['id']}})[_0x710b('0x27')](handleEntityNotFound(_0x487c01,null))['then'](saveUpdates(_0x4764f7[_0x710b('0x4a')],null))[_0x710b('0x27')](respondWithResult(_0x487c01,null))[_0x710b('0x48')](handleError(_0x487c01,null));};exports[_0x710b('0x4c')]=function(_0x1e9a68,_0x1878f8){return db[_0x710b('0x2d')][_0x710b('0x47')]({'where':{'id':_0x1e9a68['params']['id']}})[_0x710b('0x27')](handleEntityNotFound(_0x1878f8,null))[_0x710b('0x27')](removeEntity(_0x1878f8,null))['catch'](handleError(_0x1878f8,null));}; \ No newline at end of file +var _0x1af3=['update','then','destroy','end','error','stack','name','send','map','VtigerField','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','create','body','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x52eab6,_0x1984a7){var _0x48f57a=function(_0x4f7888){while(--_0x4f7888){_0x52eab6['push'](_0x52eab6['shift']());}};_0x48f57a(++_0x1984a7);}(_0x1af3,0x1a2));var _0x31af=function(_0x4c8a8f,_0x997ef){_0x4c8a8f=_0x4c8a8f-0x0;var _0x404500=_0x1af3[_0x4c8a8f];return _0x404500;};'use strict';var emlformat=require(_0x31af('0x0'));var rimraf=require(_0x31af('0x1'));var zipdir=require(_0x31af('0x2'));var jsonpatch=require(_0x31af('0x3'));var rp=require('request-promise');var moment=require(_0x31af('0x4'));var BPromise=require(_0x31af('0x5'));var Mustache=require(_0x31af('0x6'));var util=require(_0x31af('0x7'));var path=require(_0x31af('0x8'));var sox=require(_0x31af('0x9'));var csv=require('to-csv');var ejs=require(_0x31af('0xa'));var fs=require('fs');var fs_extra=require(_0x31af('0xb'));var _=require(_0x31af('0xc'));var squel=require('squel');var crypto=require(_0x31af('0xd'));var jsforce=require(_0x31af('0xe'));var deskjs=require(_0x31af('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x31af('0x10'));var Redis=require(_0x31af('0x11'));var authService=require(_0x31af('0x12'));var qs=require(_0x31af('0x13'));var as=require(_0x31af('0x14'));var hardwareService=require(_0x31af('0x15'));var logger=require('../../config/logger')(_0x31af('0x16'));var utils=require(_0x31af('0x17'));var config=require(_0x31af('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x31af('0x19'))['db'];function respondWithStatusCode(_0xdc58d8,_0x2c4cd6){_0x2c4cd6=_0x2c4cd6||0xcc;return function(_0x4d0380){if(_0x4d0380){return _0xdc58d8[_0x31af('0x1a')](_0x2c4cd6);}return _0xdc58d8['status'](_0x2c4cd6)['end']();};}function respondWithResult(_0x42638c,_0xf425fd){_0xf425fd=_0xf425fd||0xc8;return function(_0x525381){if(_0x525381){return _0x42638c[_0x31af('0x1b')](_0xf425fd)[_0x31af('0x1c')](_0x525381);}};}function respondWithFilteredResult(_0x4158d4,_0x287ba0){return function(_0x4833a3){if(_0x4833a3){var _0x39fce2=typeof _0x287ba0[_0x31af('0x1d')]===_0x31af('0x1e')&&typeof _0x287ba0[_0x31af('0x1f')]===_0x31af('0x1e');var _0x1037d5=_0x4833a3['count'];var _0x554b63=_0x39fce2?0x0:_0x287ba0[_0x31af('0x1d')];var _0x4bae6e=_0x39fce2?_0x4833a3[_0x31af('0x20')]:_0x287ba0[_0x31af('0x1d')]+_0x287ba0['limit'];var _0x2268cd;if(_0x4bae6e>=_0x1037d5){_0x4bae6e=_0x1037d5;_0x2268cd=0xc8;}else{_0x2268cd=0xce;}_0x4158d4[_0x31af('0x1b')](_0x2268cd);return _0x4158d4[_0x31af('0x21')](_0x31af('0x22'),_0x554b63+'-'+_0x4bae6e+'/'+_0x1037d5)[_0x31af('0x1c')](_0x4833a3);}return null;};}function patchUpdates(_0x5e6dc1){return function(_0x3c3caf){try{jsonpatch[_0x31af('0x23')](_0x3c3caf,_0x5e6dc1,!![]);}catch(_0x52abfa){return BPromise[_0x31af('0x24')](_0x52abfa);}return _0x3c3caf[_0x31af('0x25')]();};}function saveUpdates(_0x1483cb,_0x58a3fe){return function(_0x455a4e){if(_0x455a4e){return _0x455a4e[_0x31af('0x26')](_0x1483cb)[_0x31af('0x27')](function(_0x1a54e6){return _0x1a54e6;});}return null;};}function removeEntity(_0x3c10fe,_0x343703){return function(_0x38e874){if(_0x38e874){return _0x38e874[_0x31af('0x28')]()[_0x31af('0x27')](function(){_0x3c10fe['status'](0xcc)[_0x31af('0x29')]();});}};}function handleEntityNotFound(_0xba69ec,_0x3e1502){return function(_0x4dbc04){if(!_0x4dbc04){_0xba69ec[_0x31af('0x1a')](0x194);}return _0x4dbc04;};}function handleError(_0x274130,_0x17cbb6){_0x17cbb6=_0x17cbb6||0x1f4;return function(_0xa8500d){logger[_0x31af('0x2a')](_0xa8500d[_0x31af('0x2b')]);if(_0xa8500d[_0x31af('0x2c')]){delete _0xa8500d['name'];}_0x274130[_0x31af('0x1b')](_0x17cbb6)[_0x31af('0x2d')](_0xa8500d);};}exports['index']=function(_0x298627,_0x2ded71){var _0x168edd={},_0x28c684={},_0x1ff9aa={'count':0x0,'rows':[]};var _0xf86288=_[_0x31af('0x2e')](db[_0x31af('0x2f')]['rawAttributes'],function(_0x19499d){return{'name':_0x19499d[_0x31af('0x30')],'type':_0x19499d[_0x31af('0x31')][_0x31af('0x32')]};});_0x28c684[_0x31af('0x33')]=_[_0x31af('0x2e')](_0xf86288,_0x31af('0x2c'));_0x28c684[_0x31af('0x34')]=_[_0x31af('0x35')](_0x298627[_0x31af('0x34')]);_0x28c684['filters']=_[_0x31af('0x36')](_0x28c684[_0x31af('0x33')],_0x28c684['query']);_0x168edd[_0x31af('0x37')]=_[_0x31af('0x36')](_0x28c684[_0x31af('0x33')],qs[_0x31af('0x38')](_0x298627['query'][_0x31af('0x38')]));_0x168edd['attributes']=_0x168edd[_0x31af('0x37')][_0x31af('0x39')]?_0x168edd[_0x31af('0x37')]:_0x28c684[_0x31af('0x33')];if(!_0x298627[_0x31af('0x34')][_0x31af('0x3a')]('nolimit')){_0x168edd[_0x31af('0x1f')]=qs[_0x31af('0x1f')](_0x298627[_0x31af('0x34')]['limit']);_0x168edd[_0x31af('0x1d')]=qs[_0x31af('0x1d')](_0x298627['query'][_0x31af('0x1d')]);}_0x168edd[_0x31af('0x3b')]=qs[_0x31af('0x3c')](_0x298627['query'][_0x31af('0x3c')]);_0x168edd[_0x31af('0x3d')]=qs[_0x31af('0x3e')](_[_0x31af('0x3f')](_0x298627[_0x31af('0x34')],_0x28c684[_0x31af('0x3e')]),_0xf86288);if(_0x298627[_0x31af('0x34')]['filter']){_0x168edd['where']=_[_0x31af('0x40')](_0x168edd[_0x31af('0x3d')],{'$or':_[_0x31af('0x2e')](_0xf86288,function(_0x39a455){if(_0x39a455[_0x31af('0x31')]!==_0x31af('0x41')){var _0x21ad31={};_0x21ad31[_0x39a455[_0x31af('0x2c')]]={'$like':'%'+_0x298627['query']['filter']+'%'};return _0x21ad31;}})});}_0x168edd=_[_0x31af('0x40')]({},_0x168edd,_0x298627[_0x31af('0x42')]);var _0x47cbf8={'where':_0x168edd[_0x31af('0x3d')]};return db[_0x31af('0x2f')]['count'](_0x47cbf8)[_0x31af('0x27')](function(_0x4cade7){_0x1ff9aa[_0x31af('0x20')]=_0x4cade7;if(_0x298627[_0x31af('0x34')][_0x31af('0x43')]){_0x168edd['include']=[{'all':!![]}];}return db[_0x31af('0x2f')][_0x31af('0x44')](_0x168edd);})[_0x31af('0x27')](function(_0x4267a6){_0x1ff9aa[_0x31af('0x45')]=_0x4267a6;return _0x1ff9aa;})[_0x31af('0x27')](respondWithFilteredResult(_0x2ded71,_0x168edd))['catch'](handleError(_0x2ded71,null));};exports[_0x31af('0x46')]=function(_0xb3825f,_0x4ea22f){var _0x2afc0e={'raw':!![],'where':{'id':_0xb3825f[_0x31af('0x47')]['id']}},_0x228994={};_0x228994['model']=_[_0x31af('0x35')](db['VtigerField']['rawAttributes']);_0x228994[_0x31af('0x34')]=_[_0x31af('0x35')](_0xb3825f['query']);_0x228994[_0x31af('0x3e')]=_['intersection'](_0x228994[_0x31af('0x33')],_0x228994[_0x31af('0x34')]);_0x2afc0e['attributes']=_[_0x31af('0x36')](_0x228994['model'],qs[_0x31af('0x38')](_0xb3825f[_0x31af('0x34')][_0x31af('0x38')]));_0x2afc0e[_0x31af('0x37')]=_0x2afc0e[_0x31af('0x37')]['length']?_0x2afc0e[_0x31af('0x37')]:_0x228994[_0x31af('0x33')];if(_0xb3825f[_0x31af('0x34')][_0x31af('0x43')]){_0x2afc0e['include']=[{'all':!![]}];}_0x2afc0e=_[_0x31af('0x40')]({},_0x2afc0e,_0xb3825f[_0x31af('0x42')]);return db[_0x31af('0x2f')]['find'](_0x2afc0e)[_0x31af('0x27')](handleEntityNotFound(_0x4ea22f,null))['then'](respondWithResult(_0x4ea22f,null))['catch'](handleError(_0x4ea22f,null));};exports['create']=function(_0x23a7a3,_0x10ed6a){return db[_0x31af('0x2f')][_0x31af('0x48')](_0x23a7a3['body'],{})[_0x31af('0x27')](respondWithResult(_0x10ed6a,0xc9))['catch'](handleError(_0x10ed6a,null));};exports[_0x31af('0x26')]=function(_0x2dd349,_0xf11314){if(_0x2dd349[_0x31af('0x49')]['id']){delete _0x2dd349[_0x31af('0x49')]['id'];}return db['VtigerField'][_0x31af('0x4a')]({'where':{'id':_0x2dd349[_0x31af('0x47')]['id']}})['then'](handleEntityNotFound(_0xf11314,null))[_0x31af('0x27')](saveUpdates(_0x2dd349['body'],null))[_0x31af('0x27')](respondWithResult(_0xf11314,null))['catch'](handleError(_0xf11314,null));};exports[_0x31af('0x28')]=function(_0x16ddf9,_0x4d1ef9){return db['VtigerField'][_0x31af('0x4a')]({'where':{'id':_0x16ddf9[_0x31af('0x47')]['id']}})[_0x31af('0x27')](handleEntityNotFound(_0x4d1ef9,null))[_0x31af('0x27')](removeEntity(_0x4d1ef9,null))[_0x31af('0x4b')](handleError(_0x4d1ef9,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index d21df39..d9910b1 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 _0xd308=['bluebird','exports','define','VtigerField','vtiger_unique_index','FieldId','../../config/logger','api'];(function(_0xbf7ffb,_0x52e3df){var _0x567d9a=function(_0x258cfe){while(--_0x258cfe){_0xbf7ffb['push'](_0xbf7ffb['shift']());}};_0x567d9a(++_0x52e3df);}(_0xd308,0xc6));var _0x8d30=function(_0x342603,_0x54543d){_0x342603=_0x342603-0x0;var _0x2ee807=_0xd308[_0x342603];return _0x2ee807;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8d30('0x0'))(_0x8d30('0x1'));var moment=require('moment');var BPromise=require(_0x8d30('0x2'));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('./intVtigerField.attributes');module[_0x8d30('0x3')]=function(_0x4f1657,_0x59abbd){return _0x4f1657[_0x8d30('0x4')](_0x8d30('0x5'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x8d30('0x6'),'fields':['idField',_0x8d30('0x7')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe00b=['int_vtiger_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intVtigerField.attributes','define'];(function(_0x498e82,_0x39c5b4){var _0x3fd6a3=function(_0x4d4bd3){while(--_0x4d4bd3){_0x498e82['push'](_0x498e82['shift']());}};_0x3fd6a3(++_0x39c5b4);}(_0xe00b,0x65));var _0xbe00=function(_0x4ad8fd,_0x561f3e){_0x4ad8fd=_0x4ad8fd-0x0;var _0xe1cf0e=_0xe00b[_0x4ad8fd];return _0xe1cf0e;};'use strict';var _=require(_0xbe00('0x0'));var util=require('util');var logger=require(_0xbe00('0x1'))(_0xbe00('0x2'));var moment=require(_0xbe00('0x3'));var BPromise=require(_0xbe00('0x4'));var rp=require(_0xbe00('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbe00('0x6'));var config=require('../../config/environment');var attributes=require(_0xbe00('0x7'));module['exports']=function(_0x2dea91,_0x5d25d9){return _0x2dea91[_0xbe00('0x8')]('VtigerField',attributes,{'tableName':_0xbe00('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 99e73fb..79b6d52 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 _0x1385=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x1385,0x189));var _0x5138=function(_0x4b2778,_0x2517d1){_0x4b2778=_0x4b2778-0x0;var _0x386d08=_0x1385[_0x4b2778];return _0x386d08;};'use strict';var _=require(_0x5138('0x0'));var util=require(_0x5138('0x1'));var moment=require(_0x5138('0x2'));var BPromise=require(_0x5138('0x3'));var rs=require(_0x5138('0x4'));var fs=require('fs');var Redis=require(_0x5138('0x5'));var db=require(_0x5138('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5138('0x7'))(_0x5138('0x8'));var config=require('../../config/environment');var jayson=require(_0x5138('0x9'));var client=jayson[_0x5138('0xa')][_0x5138('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16c27b,_0x13c112,_0x3131aa){return new BPromise(function(_0x272277,_0x7eccab){return client[_0x5138('0xc')](_0x16c27b,_0x3131aa)[_0x5138('0xd')](function(_0x4153f1){logger[_0x5138('0xe')](_0x5138('0xf'),_0x13c112,'request\x20sent');logger['debug'](_0x5138('0x10'),_0x13c112,_0x5138('0x11'),JSON[_0x5138('0x12')](_0x4153f1));if(_0x4153f1[_0x5138('0x13')]){if(_0x4153f1[_0x5138('0x13')][_0x5138('0x14')]===0x1f4){logger[_0x5138('0x13')](_0x5138('0xf'),_0x13c112,_0x4153f1[_0x5138('0x13')][_0x5138('0x15')]);return _0x7eccab(_0x4153f1[_0x5138('0x13')][_0x5138('0x15')]);}logger[_0x5138('0x13')]('VtigerField,\x20%s,\x20%s',_0x13c112,_0x4153f1[_0x5138('0x13')][_0x5138('0x15')]);return _0x272277(_0x4153f1['error'][_0x5138('0x15')]);}else{logger['info'](_0x5138('0xf'),_0x13c112,_0x5138('0x11'));_0x272277(_0x4153f1[_0x5138('0x16')][_0x5138('0x15')]);}})['catch'](function(_0x5a9ca0){logger[_0x5138('0x13')](_0x5138('0xf'),_0x13c112,_0x5a9ca0);_0x7eccab(_0x5a9ca0);});});} \ No newline at end of file +var _0x88e9=['result','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4af01e,_0x543f5c){var _0x178c11=function(_0x2c2f76){while(--_0x2c2f76){_0x4af01e['push'](_0x4af01e['shift']());}};_0x178c11(++_0x543f5c);}(_0x88e9,0x141));var _0x988e=function(_0x4d439b,_0x541834){_0x4d439b=_0x4d439b-0x0;var _0x3da356=_0x88e9[_0x4d439b];return _0x3da356;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x988e('0x0'));var BPromise=require(_0x988e('0x1'));var rs=require(_0x988e('0x2'));var fs=require('fs');var Redis=require(_0x988e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x988e('0x4'))(_0x988e('0x5'));var config=require(_0x988e('0x6'));var jayson=require(_0x988e('0x7'));var client=jayson[_0x988e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48ed59,_0x1cd9d8,_0x193083){return new BPromise(function(_0xffb654,_0x44ff35){return client[_0x988e('0x9')](_0x48ed59,_0x193083)[_0x988e('0xa')](function(_0x45da0b){logger[_0x988e('0xb')](_0x988e('0xc'),_0x1cd9d8,_0x988e('0xd'));logger[_0x988e('0xe')](_0x988e('0xf'),_0x1cd9d8,_0x988e('0xd'),JSON['stringify'](_0x45da0b));if(_0x45da0b['error']){if(_0x45da0b[_0x988e('0x10')][_0x988e('0x11')]===0x1f4){logger[_0x988e('0x10')]('VtigerField,\x20%s,\x20%s',_0x1cd9d8,_0x45da0b[_0x988e('0x10')][_0x988e('0x12')]);return _0x44ff35(_0x45da0b['error'][_0x988e('0x12')]);}logger[_0x988e('0x10')](_0x988e('0xc'),_0x1cd9d8,_0x45da0b['error'][_0x988e('0x12')]);return _0xffb654(_0x45da0b[_0x988e('0x10')][_0x988e('0x12')]);}else{logger[_0x988e('0xb')]('VtigerField,\x20%s,\x20%s',_0x1cd9d8,_0x988e('0xd'));_0xffb654(_0x45da0b[_0x988e('0x13')]['message']);}})['catch'](function(_0x7679f2){logger['error'](_0x988e('0xc'),_0x1cd9d8,_0x7679f2);_0x44ff35(_0x7679f2);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 0d140e1..68dbce0 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 _0x326e=['update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x326e,0x136));var _0xe326=function(_0x53b77f,_0x4ce9ce){_0x53b77f=_0x53b77f-0x0;var _0x1a0a8d=_0x326e[_0x53b77f];return _0x1a0a8d;};'use strict';var multer=require(_0xe326('0x0'));var util=require(_0xe326('0x1'));var path=require(_0xe326('0x2'));var timeout=require(_0xe326('0x3'));var express=require(_0xe326('0x4'));var router=express[_0xe326('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe326('0x6'));var interaction=require(_0xe326('0x7'));var config=require('../../config/environment');var controller=require(_0xe326('0x8'));router[_0xe326('0x9')]('/',auth[_0xe326('0xa')](),controller[_0xe326('0xb')]);router[_0xe326('0x9')](_0xe326('0xc'),auth[_0xe326('0xa')](),controller['show']);router['get'](_0xe326('0xd'),auth['isAuthenticated'](),controller[_0xe326('0xe')]);router[_0xe326('0x9')](_0xe326('0xf'),auth['isAuthenticated'](),controller[_0xe326('0x10')]);router['post']('/',auth[_0xe326('0xa')](),controller[_0xe326('0x11')]);router[_0xe326('0x12')](_0xe326('0xd'),auth[_0xe326('0xa')](),controller[_0xe326('0x13')]);router['put'](_0xe326('0xc'),auth[_0xe326('0xa')](),controller[_0xe326('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe326('0x15')]);module['exports']=router; \ No newline at end of file +var _0x31bc=['path','connect-timeout','express','Router','fs-extra','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util'];(function(_0x217a87,_0x1b5944){var _0x3ec628=function(_0x249d04){while(--_0x249d04){_0x217a87['push'](_0x217a87['shift']());}};_0x3ec628(++_0x1b5944);}(_0x31bc,0x1e3));var _0xc31b=function(_0x16190d,_0x2a0a26){_0x16190d=_0x16190d-0x0;var _0x3725f2=_0x31bc[_0x16190d];return _0x3725f2;};'use strict';var multer=require('multer');var util=require(_0xc31b('0x0'));var path=require(_0xc31b('0x1'));var timeout=require(_0xc31b('0x2'));var express=require(_0xc31b('0x3'));var router=express[_0xc31b('0x4')]();var fs_extra=require(_0xc31b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0xc31b('0x6')]('/',auth[_0xc31b('0x7')](),controller[_0xc31b('0x8')]);router[_0xc31b('0x6')](_0xc31b('0x9'),auth[_0xc31b('0x7')](),controller['show']);router[_0xc31b('0x6')](_0xc31b('0xa'),auth[_0xc31b('0x7')](),controller[_0xc31b('0xb')]);router[_0xc31b('0x6')](_0xc31b('0xc'),auth[_0xc31b('0x7')](),controller[_0xc31b('0xd')]);router[_0xc31b('0xe')]('/',auth[_0xc31b('0x7')](),controller[_0xc31b('0xf')]);router['post'](_0xc31b('0xa'),auth[_0xc31b('0x7')](),controller[_0xc31b('0x10')]);router[_0xc31b('0x11')](_0xc31b('0x9'),auth[_0xc31b('0x7')](),controller[_0xc31b('0x12')]);router[_0xc31b('0x13')](_0xc31b('0x9'),auth[_0xc31b('0x7')](),controller[_0xc31b('0x14')]);module[_0xc31b('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 fd44e07..de22bf8 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 _0x126e=['token','integrationTab','newTab','exports','STRING','username','remoteUri','ENUM','password'];(function(_0x347645,_0x587a1d){var _0x2cbd86=function(_0x463c25){while(--_0x463c25){_0x347645['push'](_0x347645['shift']());}};_0x2cbd86(++_0x587a1d);}(_0x126e,0x108));var _0xe126=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x126e[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0xe126('0x0')]={'name':{'type':Sequelize[_0xe126('0x1')]},'description':{'type':Sequelize[_0xe126('0x1')]},'username':{'type':Sequelize[_0xe126('0x1')],'unique':_0xe126('0x2')},'password':{'type':Sequelize[_0xe126('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe126('0x1')],'unique':_0xe126('0x3')},'authType':{'type':Sequelize[_0xe126('0x4')](_0xe126('0x5'),_0xe126('0x6')),'defaultValue':_0xe126('0x5')},'serverUrl':{'type':Sequelize[_0xe126('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe126('0x7'),_0xe126('0x8')),'defaultValue':_0xe126('0x7')}}; \ No newline at end of file +var _0x07e8=['exports','STRING','remoteUri','ENUM','password','integrationTab','newTab','sequelize'];(function(_0x315011,_0x3dfb3e){var _0x569d4b=function(_0x31dda7){while(--_0x31dda7){_0x315011['push'](_0x315011['shift']());}};_0x569d4b(++_0x3dfb3e);}(_0x07e8,0x10f));var _0x807e=function(_0x2c8ac7,_0x4e7e27){_0x2c8ac7=_0x2c8ac7-0x0;var _0x313f4d=_0x07e8[_0x2c8ac7];return _0x313f4d;};'use strict';var Sequelize=require(_0x807e('0x0'));module[_0x807e('0x1')]={'name':{'type':Sequelize[_0x807e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x807e('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x807e('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x807e('0x3')},'authType':{'type':Sequelize[_0x807e('0x4')](_0x807e('0x5'),'token'),'defaultValue':_0x807e('0x5')},'serverUrl':{'type':Sequelize[_0x807e('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x807e('0x4')](_0x807e('0x6'),_0x807e('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 627fc19..ebc92b4 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 _0xb62e=['custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','sendStatus','error','stack','name','send','map','ZendeskAccount','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','include','rows','catch','keys','rawAttributes','length','find','create','update','body','params','getConfigurations','findOne','ZendeskConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','includes','position','system_field_options'];(function(_0x7f7bf9,_0x3b6057){var _0x51fee6=function(_0x3aefe5){while(--_0x3aefe5){_0x7f7bf9['push'](_0x7f7bf9['shift']());}};_0x51fee6(++_0x3b6057);}(_0xb62e,0x1de));var _0xeb62=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xb62e[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb62('0x1b'));function respondWithStatusCode(_0xcc11c4,_0x27671e){_0x27671e=_0x27671e||0xcc;return function(_0x6822bc){if(_0x6822bc){return _0xcc11c4['sendStatus'](_0x27671e);}return _0xcc11c4[_0xeb62('0x1c')](_0x27671e)[_0xeb62('0x1d')]();};}function respondWithResult(_0x23fb15,_0x4da178){_0x4da178=_0x4da178||0xc8;return function(_0x26c3fd){if(_0x26c3fd){return _0x23fb15[_0xeb62('0x1c')](_0x4da178)[_0xeb62('0x1e')](_0x26c3fd);}};}function respondWithFilteredResult(_0x4ce9fa,_0x1f6a1f){return function(_0x15b3e8){if(_0x15b3e8){var _0x184106=typeof _0x1f6a1f[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x1f6a1f[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1324d7=_0x15b3e8[_0xeb62('0x22')];var _0x27fd84=_0x184106?0x0:_0x1f6a1f[_0xeb62('0x1f')];var _0x11d516=_0x184106?_0x15b3e8[_0xeb62('0x22')]:_0x1f6a1f['offset']+_0x1f6a1f[_0xeb62('0x21')];var _0x130e2f;if(_0x11d516>=_0x1324d7){_0x11d516=_0x1324d7;_0x130e2f=0xc8;}else{_0x130e2f=0xce;}_0x4ce9fa[_0xeb62('0x1c')](_0x130e2f);return _0x4ce9fa[_0xeb62('0x23')](_0xeb62('0x24'),_0x27fd84+'-'+_0x11d516+'/'+_0x1324d7)[_0xeb62('0x1e')](_0x15b3e8);}return null;};}function patchUpdates(_0x2ed96d){return function(_0x589bf2){try{jsonpatch['apply'](_0x589bf2,_0x2ed96d,!![]);}catch(_0x1fbfaa){return BPromise[_0xeb62('0x25')](_0x1fbfaa);}return _0x589bf2[_0xeb62('0x26')]();};}function saveUpdates(_0x13243f,_0x122b15){return function(_0x4cafcf){if(_0x4cafcf){return _0x4cafcf['update'](_0x13243f)[_0xeb62('0x27')](function(_0x132861){return _0x132861;});}return null;};}function removeEntity(_0x182781,_0x395b70){return function(_0x55a169){if(_0x55a169){return _0x55a169['destroy']()[_0xeb62('0x27')](function(){_0x182781['status'](0xcc)[_0xeb62('0x1d')]();});}};}function handleEntityNotFound(_0x4b0f46,_0xfe3e16){return function(_0x516a72){if(!_0x516a72){_0x4b0f46[_0xeb62('0x28')](0x194);}return _0x516a72;};}function handleError(_0x6bfbbc,_0x46d1bb){_0x46d1bb=_0x46d1bb||0x1f4;return function(_0x4e4268){logger[_0xeb62('0x29')](_0x4e4268[_0xeb62('0x2a')]);if(_0x4e4268[_0xeb62('0x2b')]){delete _0x4e4268[_0xeb62('0x2b')];}_0x6bfbbc[_0xeb62('0x1c')](_0x46d1bb)[_0xeb62('0x2c')](_0x4e4268);};}exports['index']=function(_0x192517,_0x1616ee){var _0x57169a={},_0x157474={},_0x2b51b2={'count':0x0,'rows':[]};var _0x2c967c=_[_0xeb62('0x2d')](db[_0xeb62('0x2e')]['rawAttributes'],function(_0x4b58af){return{'name':_0x4b58af[_0xeb62('0x2f')],'type':_0x4b58af[_0xeb62('0x30')][_0xeb62('0x31')]};});_0x157474[_0xeb62('0x32')]=_[_0xeb62('0x2d')](_0x2c967c,_0xeb62('0x2b'));_0x157474[_0xeb62('0x33')]=_['keys'](_0x192517[_0xeb62('0x33')]);_0x157474['filters']=_['intersection'](_0x157474[_0xeb62('0x32')],_0x157474[_0xeb62('0x33')]);_0x57169a['attributes']=_[_0xeb62('0x34')](_0x157474['model'],qs[_0xeb62('0x35')](_0x192517[_0xeb62('0x33')]['fields']));_0x57169a[_0xeb62('0x36')]=_0x57169a[_0xeb62('0x36')]['length']?_0x57169a[_0xeb62('0x36')]:_0x157474[_0xeb62('0x32')];if(!_0x192517[_0xeb62('0x33')][_0xeb62('0x37')]('nolimit')){_0x57169a[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x192517['query']['limit']);_0x57169a[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x192517['query'][_0xeb62('0x1f')]);}_0x57169a[_0xeb62('0x38')]=qs[_0xeb62('0x39')](_0x192517[_0xeb62('0x33')][_0xeb62('0x39')]);_0x57169a[_0xeb62('0x3a')]=qs[_0xeb62('0x3b')](_['pick'](_0x192517['query'],_0x157474[_0xeb62('0x3b')]),_0x2c967c);if(_0x192517[_0xeb62('0x33')][_0xeb62('0x3c')]){_0x57169a[_0xeb62('0x3a')]=_['merge'](_0x57169a[_0xeb62('0x3a')],{'$or':_['map'](_0x2c967c,function(_0x20fd7a){if(_0x20fd7a[_0xeb62('0x30')]!==_0xeb62('0x3d')){var _0x136c5a={};_0x136c5a[_0x20fd7a[_0xeb62('0x2b')]]={'$like':'%'+_0x192517[_0xeb62('0x33')][_0xeb62('0x3c')]+'%'};return _0x136c5a;}})});}_0x57169a=_[_0xeb62('0x3e')]({},_0x57169a,_0x192517['options']);var _0x38f91b={'where':_0x57169a[_0xeb62('0x3a')]};return db[_0xeb62('0x2e')][_0xeb62('0x22')](_0x38f91b)['then'](function(_0x4eda8b){_0x2b51b2[_0xeb62('0x22')]=_0x4eda8b;if(_0x192517[_0xeb62('0x33')]['includeAll']){_0x57169a[_0xeb62('0x3f')]=[{'all':!![]}];}return db[_0xeb62('0x2e')]['findAll'](_0x57169a);})[_0xeb62('0x27')](function(_0x478a54){_0x2b51b2[_0xeb62('0x40')]=_0x478a54;return _0x2b51b2;})['then'](respondWithFilteredResult(_0x1616ee,_0x57169a))[_0xeb62('0x41')](handleError(_0x1616ee,null));};exports['show']=function(_0x2bf77f,_0x609b2d){var _0x317f50={'raw':![],'where':{'id':_0x2bf77f['params']['id']}},_0x594274={};_0x594274[_0xeb62('0x32')]=_[_0xeb62('0x42')](db[_0xeb62('0x2e')][_0xeb62('0x43')]);_0x594274[_0xeb62('0x33')]=_['keys'](_0x2bf77f[_0xeb62('0x33')]);_0x594274['filters']=_[_0xeb62('0x34')](_0x594274['model'],_0x594274[_0xeb62('0x33')]);_0x317f50['attributes']=_[_0xeb62('0x34')](_0x594274['model'],qs[_0xeb62('0x35')](_0x2bf77f[_0xeb62('0x33')][_0xeb62('0x35')]));_0x317f50[_0xeb62('0x36')]=_0x317f50[_0xeb62('0x36')][_0xeb62('0x44')]?_0x317f50['attributes']:_0x594274[_0xeb62('0x32')];if(_0x2bf77f[_0xeb62('0x33')]['includeAll']){_0x317f50['include']=[{'all':!![]}];}_0x317f50=_['merge']({},_0x317f50,_0x2bf77f['options']);return db[_0xeb62('0x2e')][_0xeb62('0x45')](_0x317f50)['then'](handleEntityNotFound(_0x609b2d,null))[_0xeb62('0x27')](respondWithResult(_0x609b2d,null))[_0xeb62('0x41')](handleError(_0x609b2d,null));};exports[_0xeb62('0x46')]=function(_0x16e262,_0x39595c){return db['ZendeskAccount'][_0xeb62('0x46')](_0x16e262['body'],{})[_0xeb62('0x27')](respondWithResult(_0x39595c,0xc9))[_0xeb62('0x41')](handleError(_0x39595c,null));};exports[_0xeb62('0x47')]=function(_0x18c40d,_0x1f2d87){if(_0x18c40d[_0xeb62('0x48')]['id']){delete _0x18c40d[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2e')][_0xeb62('0x45')]({'where':{'id':_0x18c40d[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x1f2d87,null))[_0xeb62('0x27')](saveUpdates(_0x18c40d['body'],null))[_0xeb62('0x27')](respondWithResult(_0x1f2d87,null))['catch'](handleError(_0x1f2d87,null));};exports['destroy']=function(_0x2dcb2d,_0x31fd4a){return db['ZendeskAccount'][_0xeb62('0x45')]({'where':{'id':_0x2dcb2d[_0xeb62('0x49')]['id']}})['then'](handleEntityNotFound(_0x31fd4a,null))[_0xeb62('0x27')](removeEntity(_0x31fd4a,null))[_0xeb62('0x41')](handleError(_0x31fd4a,null));};exports[_0xeb62('0x4a')]=function(_0x60617,_0xe71e83,_0x1e6238){var _0x351027={};var _0x190e65={};var _0x497714;var _0x3e2be9;return db['ZendeskAccount'][_0xeb62('0x4b')]({'where':{'id':_0x60617[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0xe71e83,null))[_0xeb62('0x27')](function(_0x35d92d){if(_0x35d92d){_0x497714=_0x35d92d;_0x190e65[_0xeb62('0x32')]=_[_0xeb62('0x42')](db[_0xeb62('0x4c')]['rawAttributes']);_0x190e65['query']=_['keys'](_0x60617['query']);_0x190e65[_0xeb62('0x3b')]=_['intersection'](_0x190e65[_0xeb62('0x32')],_0x190e65['query']);_0x351027[_0xeb62('0x36')]=_[_0xeb62('0x34')](_0x190e65[_0xeb62('0x32')],qs['fields'](_0x60617[_0xeb62('0x33')][_0xeb62('0x35')]));_0x351027['attributes']=_0x351027[_0xeb62('0x36')][_0xeb62('0x44')]?_0x351027[_0xeb62('0x36')]:_0x190e65[_0xeb62('0x32')];_0x351027['order']=qs[_0xeb62('0x39')](_0x60617[_0xeb62('0x33')]['sort']);_0x351027[_0xeb62('0x3a')]=qs[_0xeb62('0x3b')](_[_0xeb62('0x4d')](_0x60617[_0xeb62('0x33')],_0x190e65[_0xeb62('0x3b')]));if(_0x60617[_0xeb62('0x33')][_0xeb62('0x3c')]){_0x351027[_0xeb62('0x3a')]=_[_0xeb62('0x3e')](_0x351027[_0xeb62('0x3a')],{'$or':_[_0xeb62('0x2d')](_0x351027[_0xeb62('0x36')],function(_0x200b43){var _0x3ae984={};_0x3ae984[_0x200b43]={'$like':'%'+_0x60617[_0xeb62('0x33')][_0xeb62('0x3c')]+'%'};return _0x3ae984;})});}_0x351027=_['merge']({},_0x351027,_0x60617['options']);return _0x497714['getConfigurations'](_0x351027);}})['then'](function(_0x279b83){if(_0x279b83){_0x3e2be9=_0x279b83['length'];if(!_0x60617[_0xeb62('0x33')][_0xeb62('0x37')](_0xeb62('0x4e'))){_0x351027[_0xeb62('0x21')]=qs[_0xeb62('0x21')](_0x60617[_0xeb62('0x33')][_0xeb62('0x21')]);_0x351027[_0xeb62('0x1f')]=qs[_0xeb62('0x1f')](_0x60617[_0xeb62('0x33')]['offset']);}return _0x497714[_0xeb62('0x4a')](_0x351027);}})[_0xeb62('0x27')](function(_0x42e992){if(_0x42e992){return _0x42e992?{'count':_0x3e2be9,'rows':_0x42e992}:null;}})[_0xeb62('0x27')](respondWithResult(_0xe71e83,null))['catch'](handleError(_0xe71e83,null));};exports[_0xeb62('0x4f')]=function(_0x2e5456,_0x3ff00a,_0x2abd21){if(_0x2e5456[_0xeb62('0x48')]['id']){delete _0x2e5456[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2e')][_0xeb62('0x4b')]({'where':{'id':_0x2e5456[_0xeb62('0x49')]['id']}})[_0xeb62('0x27')](handleEntityNotFound(_0x3ff00a,null))[_0xeb62('0x27')](function(_0x510275){if(_0x510275){_0x2e5456[_0xeb62('0x48')][_0xeb62('0x50')]=_0x510275['id'];_0x2e5456[_0xeb62('0x48')][_0xeb62('0x51')]=integrations[_0xeb62('0x52')](_0x2e5456[_0xeb62('0x48')][_0xeb62('0x53')],_0x2e5456[_0xeb62('0x48')][_0xeb62('0x30')]);_0x2e5456[_0xeb62('0x48')]['Descriptions']=integrations[_0xeb62('0x54')](_0x2e5456[_0xeb62('0x48')][_0xeb62('0x53')],_0x2e5456[_0xeb62('0x48')]['type']);return db[_0xeb62('0x4c')][_0xeb62('0x46')](_0x2e5456[_0xeb62('0x48')],{'include':[{'model':db[_0xeb62('0x55')],'as':_0xeb62('0x51')},{'model':db[_0xeb62('0x55')],'as':'Descriptions'}]});}return null;})[_0xeb62('0x27')](respondWithResult(_0x3ff00a,null))[_0xeb62('0x41')](handleError(_0x3ff00a,null));};exports[_0xeb62('0x56')]=function(_0x173c07,_0x351acf,_0x28d0ff){var _0x2e4502='';return db[_0xeb62('0x2e')][_0xeb62('0x4b')]({'where':{'id':_0x173c07[_0xeb62('0x49')]['id']},'attributes':['id',_0xeb62('0x57'),_0xeb62('0x58'),_0xeb62('0x59'),_0xeb62('0x5a'),_0xeb62('0x5b')]})[_0xeb62('0x27')](handleEntityNotFound(_0x351acf,null))['then'](function(_0x3b3eb1){if(_0x3b3eb1){_0x2e4502=_0x3b3eb1['remoteUri'];var _0x6ea297=_0x2e4502[_0xeb62('0x5c')](-0x1);if(_0x6ea297==='/'){_0x2e4502=_0x2e4502['substring'](0x0,_0x2e4502[_0xeb62('0x5d')](_0x6ea297));}var _0x10986a={'method':_0xeb62('0x5e'),'uri':util[_0xeb62('0x5f')](_0xeb62('0x60'),_0x2e4502,_0xeb62('0x61')),'json':!![]};switch(_0x3b3eb1[_0xeb62('0x5a')]){case _0xeb62('0x58'):_0x10986a[_0xeb62('0x62')]={'Authorization':util[_0xeb62('0x5f')](_0xeb62('0x63'),new Buffer(util[_0xeb62('0x5f')](_0xeb62('0x64'),_0x3b3eb1['username'],_0x3b3eb1[_0xeb62('0x58')]))[_0xeb62('0x65')]('base64'))};break;case _0xeb62('0x59'):_0x10986a['headers']={'Authorization':util[_0xeb62('0x5f')](_0xeb62('0x63'),new Buffer(util[_0xeb62('0x5f')](_0xeb62('0x66'),_0x3b3eb1[_0xeb62('0x57')],_0x3b3eb1[_0xeb62('0x59')]))['toString'](_0xeb62('0x67')))};break;default:throw new db['Sequelize'][(_0xeb62('0x68'))](_0xeb62('0x69'));}return rp(_0x10986a);}})[_0xeb62('0x27')](function(_0x489410){if(_0x489410){var _0x1dcd96=['subject',_0xeb62('0x6a'),_0xeb62('0x6b'),_0xeb62('0x6c')];_['remove'](_0x489410[_0xeb62('0x61')],function(_0x3ad496){return _0x1dcd96[_0xeb62('0x6d')](_0x3ad496[_0xeb62('0x30')]);});return{'count':_0x489410[_0xeb62('0x61')][_0xeb62('0x44')],'rows':_['map'](_0x489410['ticket_fields'],function(_0x4c7a56){return{'id':_0x4c7a56['id'],'name':_0x4c7a56['position']>0x7?_0x4c7a56['title']:_0x4c7a56[_0xeb62('0x30')],'custom':_0x4c7a56[_0xeb62('0x6e')]>0x7?!![]:![],'options':_0x4c7a56[_0xeb62('0x6f')]?_0x4c7a56[_0xeb62('0x6f')]:_0x4c7a56[_0xeb62('0x70')]?_0x4c7a56[_0xeb62('0x70')]:[]};})};}})[_0xeb62('0x27')](respondWithResult(_0x351acf,null))[_0xeb62('0x41')](function(_0xb28adb){var _0x2c6bb3=_0x173c07[_0xeb62('0x33')][_0xeb62('0x71')]?0x1f4:_0xb28adb['statusCode']||0x1f4;logger[_0xeb62('0x29')](_0xeb62('0x72'),_0xeb62('0x56'),_0x2c6bb3,JSON[_0xeb62('0x73')](_0xb28adb));delete _0xb28adb[_0xeb62('0x2b')];if(_0x2c6bb3===0x191){_0x2c6bb3=0x190;}_0x351acf[_0xeb62('0x1c')](_0x2c6bb3)[_0xeb62('0x2c')](_0x173c07[_0xeb62('0x33')][_0xeb62('0x71')]?{'message':_0xeb62('0x74'),'statusCode':_0xb28adb[_0xeb62('0x75')]}:_0xb28adb);});}; \ No newline at end of file +var _0x750a=['crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','destroy','then','error','name','index','map','ZendeskAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','merge','options','includeAll','include','rows','catch','show','params','find','create','body','ZendeskConfiguration','getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','authType','remoteUri','slice','substring','lastIndexOf','GET','ticket_fields','password','headers','format','Basic\x20%s','%s:%s','token','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','remove','includes','title','position','system_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x750a,0x140));var _0xa750=function(_0x5ba4b0,_0x539d6a){_0x5ba4b0=_0x5ba4b0-0x0;var _0x41ab05=_0x750a[_0x5ba4b0];return _0x41ab05;};'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'];var integrations=require(_0xa750('0x15'));function respondWithStatusCode(_0x1c5657,_0x344c67){_0x344c67=_0x344c67||0xcc;return function(_0x567c51){if(_0x567c51){return _0x1c5657[_0xa750('0x16')](_0x344c67);}return _0x1c5657[_0xa750('0x17')](_0x344c67)[_0xa750('0x18')]();};}function respondWithResult(_0x24e48a,_0xa66181){_0xa66181=_0xa66181||0xc8;return function(_0x339329){if(_0x339329){return _0x24e48a['status'](_0xa66181)[_0xa750('0x19')](_0x339329);}};}function respondWithFilteredResult(_0x8488ea,_0x290d46){return function(_0x49fe3b){if(_0x49fe3b){var _0x337095=typeof _0x290d46[_0xa750('0x1a')]==='undefined'&&typeof _0x290d46['limit']===_0xa750('0x1b');var _0x5b1e6b=_0x49fe3b[_0xa750('0x1c')];var _0x1bde87=_0x337095?0x0:_0x290d46['offset'];var _0x36dcca=_0x337095?_0x49fe3b['count']:_0x290d46['offset']+_0x290d46[_0xa750('0x1d')];var _0x5d0935;if(_0x36dcca>=_0x5b1e6b){_0x36dcca=_0x5b1e6b;_0x5d0935=0xc8;}else{_0x5d0935=0xce;}_0x8488ea[_0xa750('0x17')](_0x5d0935);return _0x8488ea['set'](_0xa750('0x1e'),_0x1bde87+'-'+_0x36dcca+'/'+_0x5b1e6b)['json'](_0x49fe3b);}return null;};}function patchUpdates(_0x3dc7f1){return function(_0x500922){try{jsonpatch[_0xa750('0x1f')](_0x500922,_0x3dc7f1,!![]);}catch(_0x4d1939){return BPromise['reject'](_0x4d1939);}return _0x500922[_0xa750('0x20')]();};}function saveUpdates(_0x52da84,_0x216fbf){return function(_0x5a9d96){if(_0x5a9d96){return _0x5a9d96['update'](_0x52da84)['then'](function(_0x5d758e){return _0x5d758e;});}return null;};}function removeEntity(_0x15d72f,_0x2ec6c4){return function(_0x2c43ef){if(_0x2c43ef){return _0x2c43ef[_0xa750('0x21')]()[_0xa750('0x22')](function(){_0x15d72f[_0xa750('0x17')](0xcc)[_0xa750('0x18')]();});}};}function handleEntityNotFound(_0x7e22ad,_0x3d52b3){return function(_0x94697a){if(!_0x94697a){_0x7e22ad[_0xa750('0x16')](0x194);}return _0x94697a;};}function handleError(_0x27a5eb,_0x31ea63){_0x31ea63=_0x31ea63||0x1f4;return function(_0x3f7d6d){logger[_0xa750('0x23')](_0x3f7d6d['stack']);if(_0x3f7d6d[_0xa750('0x24')]){delete _0x3f7d6d[_0xa750('0x24')];}_0x27a5eb[_0xa750('0x17')](_0x31ea63)['send'](_0x3f7d6d);};}exports[_0xa750('0x25')]=function(_0x6ade2b,_0x3270e3){var _0x1223d2={},_0x579f1c={},_0x297eef={'count':0x0,'rows':[]};var _0x34d5e9=_[_0xa750('0x26')](db[_0xa750('0x27')][_0xa750('0x28')],function(_0x59ab33){return{'name':_0x59ab33[_0xa750('0x29')],'type':_0x59ab33['type'][_0xa750('0x2a')]};});_0x579f1c[_0xa750('0x2b')]=_['map'](_0x34d5e9,_0xa750('0x24'));_0x579f1c[_0xa750('0x2c')]=_[_0xa750('0x2d')](_0x6ade2b[_0xa750('0x2c')]);_0x579f1c[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0x579f1c[_0xa750('0x2b')],_0x579f1c[_0xa750('0x2c')]);_0x1223d2['attributes']=_[_0xa750('0x2f')](_0x579f1c['model'],qs[_0xa750('0x30')](_0x6ade2b[_0xa750('0x2c')][_0xa750('0x30')]));_0x1223d2[_0xa750('0x31')]=_0x1223d2['attributes'][_0xa750('0x32')]?_0x1223d2[_0xa750('0x31')]:_0x579f1c['model'];if(!_0x6ade2b[_0xa750('0x2c')][_0xa750('0x33')](_0xa750('0x34'))){_0x1223d2[_0xa750('0x1d')]=qs['limit'](_0x6ade2b[_0xa750('0x2c')]['limit']);_0x1223d2['offset']=qs[_0xa750('0x1a')](_0x6ade2b[_0xa750('0x2c')][_0xa750('0x1a')]);}_0x1223d2['order']=qs[_0xa750('0x35')](_0x6ade2b[_0xa750('0x2c')][_0xa750('0x35')]);_0x1223d2['where']=qs[_0xa750('0x2e')](_[_0xa750('0x36')](_0x6ade2b[_0xa750('0x2c')],_0x579f1c['filters']),_0x34d5e9);if(_0x6ade2b[_0xa750('0x2c')][_0xa750('0x37')]){_0x1223d2[_0xa750('0x38')]=_['merge'](_0x1223d2[_0xa750('0x38')],{'$or':_[_0xa750('0x26')](_0x34d5e9,function(_0x1e579b){if(_0x1e579b[_0xa750('0x39')]!=='VIRTUAL'){var _0x4dc0b8={};_0x4dc0b8[_0x1e579b[_0xa750('0x24')]]={'$like':'%'+_0x6ade2b[_0xa750('0x2c')]['filter']+'%'};return _0x4dc0b8;}})});}_0x1223d2=_[_0xa750('0x3a')]({},_0x1223d2,_0x6ade2b[_0xa750('0x3b')]);var _0x15d35a={'where':_0x1223d2[_0xa750('0x38')]};return db[_0xa750('0x27')]['count'](_0x15d35a)[_0xa750('0x22')](function(_0x2b33e0){_0x297eef[_0xa750('0x1c')]=_0x2b33e0;if(_0x6ade2b[_0xa750('0x2c')][_0xa750('0x3c')]){_0x1223d2[_0xa750('0x3d')]=[{'all':!![]}];}return db[_0xa750('0x27')]['findAll'](_0x1223d2);})[_0xa750('0x22')](function(_0x5e9ffb){_0x297eef[_0xa750('0x3e')]=_0x5e9ffb;return _0x297eef;})['then'](respondWithFilteredResult(_0x3270e3,_0x1223d2))[_0xa750('0x3f')](handleError(_0x3270e3,null));};exports[_0xa750('0x40')]=function(_0xf9fd5f,_0x1be24e){var _0x430d60={'raw':![],'where':{'id':_0xf9fd5f[_0xa750('0x41')]['id']}},_0xe27272={};_0xe27272[_0xa750('0x2b')]=_[_0xa750('0x2d')](db[_0xa750('0x27')][_0xa750('0x28')]);_0xe27272[_0xa750('0x2c')]=_[_0xa750('0x2d')](_0xf9fd5f[_0xa750('0x2c')]);_0xe27272[_0xa750('0x2e')]=_[_0xa750('0x2f')](_0xe27272[_0xa750('0x2b')],_0xe27272[_0xa750('0x2c')]);_0x430d60[_0xa750('0x31')]=_[_0xa750('0x2f')](_0xe27272['model'],qs[_0xa750('0x30')](_0xf9fd5f[_0xa750('0x2c')][_0xa750('0x30')]));_0x430d60[_0xa750('0x31')]=_0x430d60[_0xa750('0x31')][_0xa750('0x32')]?_0x430d60[_0xa750('0x31')]:_0xe27272[_0xa750('0x2b')];if(_0xf9fd5f[_0xa750('0x2c')]['includeAll']){_0x430d60[_0xa750('0x3d')]=[{'all':!![]}];}_0x430d60=_[_0xa750('0x3a')]({},_0x430d60,_0xf9fd5f['options']);return db[_0xa750('0x27')][_0xa750('0x42')](_0x430d60)[_0xa750('0x22')](handleEntityNotFound(_0x1be24e,null))[_0xa750('0x22')](respondWithResult(_0x1be24e,null))[_0xa750('0x3f')](handleError(_0x1be24e,null));};exports[_0xa750('0x43')]=function(_0x5e7a95,_0x278c22){return db[_0xa750('0x27')][_0xa750('0x43')](_0x5e7a95['body'],{})[_0xa750('0x22')](respondWithResult(_0x278c22,0xc9))[_0xa750('0x3f')](handleError(_0x278c22,null));};exports['update']=function(_0x93e49f,_0x2397e1){if(_0x93e49f[_0xa750('0x44')]['id']){delete _0x93e49f['body']['id'];}return db[_0xa750('0x27')][_0xa750('0x42')]({'where':{'id':_0x93e49f[_0xa750('0x41')]['id']}})[_0xa750('0x22')](handleEntityNotFound(_0x2397e1,null))['then'](saveUpdates(_0x93e49f[_0xa750('0x44')],null))[_0xa750('0x22')](respondWithResult(_0x2397e1,null))[_0xa750('0x3f')](handleError(_0x2397e1,null));};exports[_0xa750('0x21')]=function(_0x4ce363,_0x203f2a){return db[_0xa750('0x27')]['find']({'where':{'id':_0x4ce363[_0xa750('0x41')]['id']}})['then'](handleEntityNotFound(_0x203f2a,null))[_0xa750('0x22')](removeEntity(_0x203f2a,null))[_0xa750('0x3f')](handleError(_0x203f2a,null));};exports['getConfigurations']=function(_0x47e93c,_0x58eba1,_0x232da4){var _0x401125={};var _0x4ea12b={};var _0xe88dc;var _0x1a79a9;return db[_0xa750('0x27')]['findOne']({'where':{'id':_0x47e93c['params']['id']}})['then'](handleEntityNotFound(_0x58eba1,null))['then'](function(_0x3c34d4){if(_0x3c34d4){_0xe88dc=_0x3c34d4;_0x4ea12b['model']=_[_0xa750('0x2d')](db[_0xa750('0x45')]['rawAttributes']);_0x4ea12b[_0xa750('0x2c')]=_['keys'](_0x47e93c[_0xa750('0x2c')]);_0x4ea12b['filters']=_['intersection'](_0x4ea12b['model'],_0x4ea12b['query']);_0x401125[_0xa750('0x31')]=_[_0xa750('0x2f')](_0x4ea12b['model'],qs['fields'](_0x47e93c['query'][_0xa750('0x30')]));_0x401125[_0xa750('0x31')]=_0x401125[_0xa750('0x31')][_0xa750('0x32')]?_0x401125[_0xa750('0x31')]:_0x4ea12b[_0xa750('0x2b')];_0x401125['order']=qs['sort'](_0x47e93c[_0xa750('0x2c')][_0xa750('0x35')]);_0x401125[_0xa750('0x38')]=qs[_0xa750('0x2e')](_[_0xa750('0x36')](_0x47e93c['query'],_0x4ea12b[_0xa750('0x2e')]));if(_0x47e93c[_0xa750('0x2c')][_0xa750('0x37')]){_0x401125[_0xa750('0x38')]=_[_0xa750('0x3a')](_0x401125[_0xa750('0x38')],{'$or':_[_0xa750('0x26')](_0x401125[_0xa750('0x31')],function(_0x5e78f1){var _0x2aa1d6={};_0x2aa1d6[_0x5e78f1]={'$like':'%'+_0x47e93c[_0xa750('0x2c')][_0xa750('0x37')]+'%'};return _0x2aa1d6;})});}_0x401125=_[_0xa750('0x3a')]({},_0x401125,_0x47e93c[_0xa750('0x3b')]);return _0xe88dc['getConfigurations'](_0x401125);}})[_0xa750('0x22')](function(_0x25248f){if(_0x25248f){_0x1a79a9=_0x25248f[_0xa750('0x32')];if(!_0x47e93c[_0xa750('0x2c')][_0xa750('0x33')](_0xa750('0x34'))){_0x401125[_0xa750('0x1d')]=qs[_0xa750('0x1d')](_0x47e93c[_0xa750('0x2c')][_0xa750('0x1d')]);_0x401125[_0xa750('0x1a')]=qs[_0xa750('0x1a')](_0x47e93c[_0xa750('0x2c')][_0xa750('0x1a')]);}return _0xe88dc[_0xa750('0x46')](_0x401125);}})[_0xa750('0x22')](function(_0x49e132){if(_0x49e132){return _0x49e132?{'count':_0x1a79a9,'rows':_0x49e132}:null;}})[_0xa750('0x22')](respondWithResult(_0x58eba1,null))['catch'](handleError(_0x58eba1,null));};exports[_0xa750('0x47')]=function(_0x2d488d,_0xbe7451,_0x5845c5){if(_0x2d488d[_0xa750('0x44')]['id']){delete _0x2d488d[_0xa750('0x44')]['id'];}return db[_0xa750('0x27')][_0xa750('0x48')]({'where':{'id':_0x2d488d[_0xa750('0x41')]['id']}})[_0xa750('0x22')](handleEntityNotFound(_0xbe7451,null))['then'](function(_0x3001d7){if(_0x3001d7){_0x2d488d[_0xa750('0x44')]['AccountId']=_0x3001d7['id'];_0x2d488d[_0xa750('0x44')][_0xa750('0x49')]=integrations[_0xa750('0x4a')](_0x2d488d[_0xa750('0x44')][_0xa750('0x4b')],_0x2d488d[_0xa750('0x44')][_0xa750('0x39')]);_0x2d488d[_0xa750('0x44')][_0xa750('0x4c')]=integrations[_0xa750('0x4d')](_0x2d488d[_0xa750('0x44')]['channel'],_0x2d488d['body'][_0xa750('0x39')]);return db[_0xa750('0x45')][_0xa750('0x43')](_0x2d488d[_0xa750('0x44')],{'include':[{'model':db['ZendeskField'],'as':_0xa750('0x49')},{'model':db[_0xa750('0x4e')],'as':_0xa750('0x4c')}]});}return null;})[_0xa750('0x22')](respondWithResult(_0xbe7451,null))[_0xa750('0x3f')](handleError(_0xbe7451,null));};exports[_0xa750('0x4f')]=function(_0x17b25e,_0x5d883d,_0x1dcc15){var _0x2783b9='';return db[_0xa750('0x27')]['findOne']({'where':{'id':_0x17b25e['params']['id']},'attributes':['id',_0xa750('0x50'),'password','token',_0xa750('0x51'),_0xa750('0x52')]})[_0xa750('0x22')](handleEntityNotFound(_0x5d883d,null))[_0xa750('0x22')](function(_0x292dab){if(_0x292dab){_0x2783b9=_0x292dab['remoteUri'];var _0x3ac9a2=_0x2783b9[_0xa750('0x53')](-0x1);if(_0x3ac9a2==='/'){_0x2783b9=_0x2783b9[_0xa750('0x54')](0x0,_0x2783b9[_0xa750('0x55')](_0x3ac9a2));}var _0x439dce={'method':_0xa750('0x56'),'uri':util['format']('%s/%s',_0x2783b9,_0xa750('0x57')),'json':!![]};switch(_0x292dab[_0xa750('0x51')]){case _0xa750('0x58'):_0x439dce[_0xa750('0x59')]={'Authorization':util[_0xa750('0x5a')](_0xa750('0x5b'),new Buffer(util[_0xa750('0x5a')](_0xa750('0x5c'),_0x292dab['username'],_0x292dab[_0xa750('0x58')]))['toString']('base64'))};break;case _0xa750('0x5d'):_0x439dce[_0xa750('0x59')]={'Authorization':util[_0xa750('0x5a')](_0xa750('0x5b'),new Buffer(util['format'](_0xa750('0x5e'),_0x292dab[_0xa750('0x50')],_0x292dab[_0xa750('0x5d')]))[_0xa750('0x5f')]('base64'))};break;default:throw new db[(_0xa750('0x60'))][(_0xa750('0x61'))](_0xa750('0x62'));}return rp(_0x439dce);}})[_0xa750('0x22')](function(_0x332862){if(_0x332862){var _0x14de1b=[_0xa750('0x63'),_0xa750('0x64'),'group','assignee'];_[_0xa750('0x65')](_0x332862['ticket_fields'],function(_0x2c4114){return _0x14de1b[_0xa750('0x66')](_0x2c4114['type']);});return{'count':_0x332862[_0xa750('0x57')]['length'],'rows':_[_0xa750('0x26')](_0x332862[_0xa750('0x57')],function(_0x77110){return{'id':_0x77110['id'],'name':_0x77110['position']>0x7?_0x77110[_0xa750('0x67')]:_0x77110[_0xa750('0x39')],'custom':_0x77110[_0xa750('0x68')]>0x7?!![]:![],'options':_0x77110[_0xa750('0x69')]?_0x77110['system_field_options']:_0x77110['custom_field_options']?_0x77110['custom_field_options']:[]};})};}})[_0xa750('0x22')](respondWithResult(_0x5d883d,null))[_0xa750('0x3f')](function(_0x5387dc){var _0x12cae9=_0x17b25e[_0xa750('0x2c')][_0xa750('0x6a')]?0x1f4:_0x5387dc[_0xa750('0x6b')]||0x1f4;logger[_0xa750('0x23')](_0xa750('0x6c'),'getFields',_0x12cae9,JSON[_0xa750('0x6d')](_0x5387dc));delete _0x5387dc[_0xa750('0x24')];if(_0x12cae9===0x191){_0x12cae9=0x190;}_0x5d883d[_0xa750('0x17')](_0x12cae9)['send'](_0x17b25e[_0xa750('0x2c')][_0xa750('0x6a')]?{'message':_0xa750('0x6e'),'statusCode':_0x5387dc[_0xa750('0x6b')]}:_0x5387dc);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 026243a..0c1048e 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 _0x2ff6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','int_zendesk_accounts','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2ff6,0x140));var _0x62ff=function(_0x4260a3,_0x1bee4f){_0x4260a3=_0x4260a3-0x0;var _0x3ff289=_0x2ff6[_0x4260a3];return _0x3ff289;};'use strict';var _=require(_0x62ff('0x0'));var util=require(_0x62ff('0x1'));var logger=require(_0x62ff('0x2'))(_0x62ff('0x3'));var moment=require(_0x62ff('0x4'));var BPromise=require(_0x62ff('0x5'));var rp=require(_0x62ff('0x6'));var fs=require('fs');var path=require(_0x62ff('0x7'));var rimraf=require(_0x62ff('0x8'));var config=require(_0x62ff('0x9'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x62ff('0xa')]=function(_0x3db88d,_0x3a9ffb){return _0x3db88d['define']('ZendeskAccount',attributes,{'tableName':_0x62ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0071=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','int_zendesk_accounts','lodash'];(function(_0x4a720f,_0x5e0285){var _0x1d5a8c=function(_0x4076da){while(--_0x4076da){_0x4a720f['push'](_0x4a720f['shift']());}};_0x1d5a8c(++_0x5e0285);}(_0x0071,0x14f));var _0x1007=function(_0x4c061a,_0x20eced){_0x4c061a=_0x4c061a-0x0;var _0x230386=_0x0071[_0x4c061a];return _0x230386;};'use strict';var _=require(_0x1007('0x0'));var util=require(_0x1007('0x1'));var logger=require(_0x1007('0x2'))(_0x1007('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1007('0x4'));var fs=require('fs');var path=require(_0x1007('0x5'));var rimraf=require(_0x1007('0x6'));var config=require(_0x1007('0x7'));var attributes=require(_0x1007('0x8'));var integrations=require(_0x1007('0x9'));module[_0x1007('0xa')]=function(_0x25ab66,_0x514e04){return _0x25ab66['define']('ZendeskAccount',attributes,{'tableName':_0x1007('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 016c433..030550b 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 _0x3f1c=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','debug','ShowZendeskAccount','find','where','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x50e484,_0x1bbb9a){var _0x166951=function(_0xe6f300){while(--_0xe6f300){_0x50e484['push'](_0x50e484['shift']());}};_0x166951(++_0x1bbb9a);}(_0x3f1c,0xd4));var _0xc3f1=function(_0x54f36e,_0x4e2f98){_0x54f36e=_0x54f36e-0x0;var _0x4c1d8e=_0x3f1c[_0x54f36e];return _0x4c1d8e;};'use strict';var _=require(_0xc3f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc3f1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc3f1('0x2'))['db'];var utils=require(_0xc3f1('0x3'));var logger=require(_0xc3f1('0x4'))(_0xc3f1('0x5'));var config=require(_0xc3f1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc3f1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f0b80,_0x4092b3,_0x1060e6){return new BPromise(function(_0x5e4bfe,_0x58e9a9){return client[_0xc3f1('0x8')](_0x1f0b80,_0x1060e6)['then'](function(_0x4640b3){logger[_0xc3f1('0x9')](_0xc3f1('0xa'),_0x4092b3,_0xc3f1('0xb'));logger['debug'](_0xc3f1('0xc'),_0x4092b3,'request\x20sent',JSON[_0xc3f1('0xd')](_0x4640b3));if(_0x4640b3['error']){if(_0x4640b3[_0xc3f1('0xe')]['code']===0x1f4){logger['error'](_0xc3f1('0xa'),_0x4092b3,_0x4640b3[_0xc3f1('0xe')][_0xc3f1('0xf')]);return _0x58e9a9(_0x4640b3[_0xc3f1('0xe')][_0xc3f1('0xf')]);}logger[_0xc3f1('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x4092b3,_0x4640b3['error'][_0xc3f1('0xf')]);return _0x5e4bfe(_0x4640b3[_0xc3f1('0xe')][_0xc3f1('0xf')]);}else{logger[_0xc3f1('0x9')]('ZendeskAccount,\x20%s,\x20%s',_0x4092b3,_0xc3f1('0xb'));_0x5e4bfe(_0x4640b3[_0xc3f1('0x10')][_0xc3f1('0xf')]);}})[_0xc3f1('0x11')](function(_0x5796c4){logger[_0xc3f1('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x4092b3,_0x5796c4);_0x58e9a9(_0x5796c4);});});}exports[_0xc3f1('0x12')]=function(_0x420d75){var _0x3ed046=this;return new Promise(function(_0x3dc419,_0x486c9f){return db[_0xc3f1('0x13')][_0xc3f1('0x14')]({'raw':_0x420d75[_0xc3f1('0x15')]?_0x420d75[_0xc3f1('0x15')][_0xc3f1('0x16')]===undefined?!![]:![]:!![],'where':_0x420d75['options']?_0x420d75[_0xc3f1('0x15')]['where']||null:null,'attributes':_0x420d75['options']?_0x420d75[_0xc3f1('0x15')][_0xc3f1('0x17')]||null:null,'limit':_0x420d75[_0xc3f1('0x15')]?_0x420d75[_0xc3f1('0x15')]['limit']||null:null,'include':_0x420d75[_0xc3f1('0x15')]?_0x420d75[_0xc3f1('0x15')][_0xc3f1('0x18')]?_[_0xc3f1('0x19')](_0x420d75[_0xc3f1('0x15')][_0xc3f1('0x18')],function(_0x2f4d81){return{'model':db[_0x2f4d81[_0xc3f1('0x1a')]],'as':_0x2f4d81['as'],'attributes':_0x2f4d81['attributes'],'include':_0x2f4d81['include']?_[_0xc3f1('0x19')](_0x2f4d81[_0xc3f1('0x18')],function(_0x3b1eb9){return{'model':db[_0x3b1eb9['model']],'as':_0x3b1eb9['as'],'attributes':_0x3b1eb9['attributes'],'include':_0x3b1eb9[_0xc3f1('0x18')]?_[_0xc3f1('0x19')](_0x3b1eb9[_0xc3f1('0x18')],function(_0x4dd154){return{'model':db[_0x4dd154['model']],'as':_0x4dd154['as'],'attributes':_0x4dd154[_0xc3f1('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc3f1('0x1b')](function(_0x5e7970){logger['info'](_0xc3f1('0x12'),_0x420d75);logger[_0xc3f1('0x1c')]('GetZendeskAccount',_0x420d75,JSON[_0xc3f1('0xd')](_0x5e7970));_0x3dc419(_0x5e7970);})[_0xc3f1('0x11')](function(_0x2f925e){logger[_0xc3f1('0xe')](_0xc3f1('0x12'),_0x2f925e[_0xc3f1('0xf')],_0x420d75);_0x486c9f(_0x3ed046[_0xc3f1('0xe')](0x1f4,_0x2f925e['message']));});});};exports[_0xc3f1('0x1d')]=function(_0x136a16){var _0x1782d7=this;return new Promise(function(_0x1d63d4,_0x24d40d){return db['ZendeskAccount'][_0xc3f1('0x1e')]({'raw':_0x136a16['options']?_0x136a16[_0xc3f1('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x136a16['options']?_0x136a16[_0xc3f1('0x15')][_0xc3f1('0x1f')]||null:null,'attributes':_0x136a16['options']?_0x136a16[_0xc3f1('0x15')][_0xc3f1('0x17')]||null:null,'include':_0x136a16['options']?_0x136a16[_0xc3f1('0x15')]['include']?_[_0xc3f1('0x19')](_0x136a16[_0xc3f1('0x15')][_0xc3f1('0x18')],function(_0xe4cf39){return{'model':db[_0xe4cf39[_0xc3f1('0x1a')]],'as':_0xe4cf39['as'],'attributes':_0xe4cf39['attributes'],'include':_0xe4cf39[_0xc3f1('0x18')]?_[_0xc3f1('0x19')](_0xe4cf39['include'],function(_0x11aac3){return{'model':db[_0x11aac3[_0xc3f1('0x1a')]],'as':_0x11aac3['as'],'attributes':_0x11aac3[_0xc3f1('0x17')],'include':_0x11aac3['include']?_[_0xc3f1('0x19')](_0x11aac3[_0xc3f1('0x18')],function(_0x5bc634){return{'model':db[_0x5bc634[_0xc3f1('0x1a')]],'as':_0x5bc634['as'],'attributes':_0x5bc634[_0xc3f1('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c0e33){logger[_0xc3f1('0x9')](_0xc3f1('0x1d'),_0x136a16);logger[_0xc3f1('0x1c')](_0xc3f1('0x1d'),_0x136a16,JSON[_0xc3f1('0xd')](_0x3c0e33));_0x1d63d4(_0x3c0e33);})[_0xc3f1('0x11')](function(_0x303c88){logger[_0xc3f1('0xe')](_0xc3f1('0x1d'),_0x303c88[_0xc3f1('0xf')],_0x136a16);_0x24d40d(_0x1782d7['error'](0x1f4,_0x303c88[_0xc3f1('0xf')]));});});}; \ No newline at end of file +var _0x4e2b=['raw','where','attributes','limit','include','model','map','ShowZendeskAccount','ZendeskAccount','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetZendeskAccount','findAll','options'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4e2b,0xa9));var _0xb4e2=function(_0x43fb7c,_0x3970b5){_0x43fb7c=_0x43fb7c-0x0;var _0x3c764a=_0x4e2b[_0x43fb7c];return _0x3c764a;};'use strict';var _=require('lodash');var util=require(_0xb4e2('0x0'));var moment=require('moment');var BPromise=require(_0xb4e2('0x1'));var rs=require(_0xb4e2('0x2'));var fs=require('fs');var Redis=require(_0xb4e2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb4e2('0x4'))(_0xb4e2('0x5'));var config=require('../../config/environment');var jayson=require(_0xb4e2('0x6'));var client=jayson[_0xb4e2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35d370,_0x1e4520,_0x28d08d){return new BPromise(function(_0x33d107,_0x6e58ea){return client['request'](_0x35d370,_0x28d08d)[_0xb4e2('0x8')](function(_0x13754c){logger['info'](_0xb4e2('0x9'),_0x1e4520,_0xb4e2('0xa'));logger[_0xb4e2('0xb')](_0xb4e2('0xc'),_0x1e4520,_0xb4e2('0xa'),JSON[_0xb4e2('0xd')](_0x13754c));if(_0x13754c[_0xb4e2('0xe')]){if(_0x13754c[_0xb4e2('0xe')][_0xb4e2('0xf')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x1e4520,_0x13754c[_0xb4e2('0xe')][_0xb4e2('0x10')]);return _0x6e58ea(_0x13754c[_0xb4e2('0xe')][_0xb4e2('0x10')]);}logger[_0xb4e2('0xe')](_0xb4e2('0x9'),_0x1e4520,_0x13754c['error'][_0xb4e2('0x10')]);return _0x33d107(_0x13754c[_0xb4e2('0xe')][_0xb4e2('0x10')]);}else{logger[_0xb4e2('0x11')](_0xb4e2('0x9'),_0x1e4520,_0xb4e2('0xa'));_0x33d107(_0x13754c[_0xb4e2('0x12')]['message']);}})[_0xb4e2('0x13')](function(_0x119b9a){logger[_0xb4e2('0xe')](_0xb4e2('0x9'),_0x1e4520,_0x119b9a);_0x6e58ea(_0x119b9a);});});}exports[_0xb4e2('0x14')]=function(_0x569e0f){var _0x22f25=this;return new Promise(function(_0x2b75d9,_0x2023d8){return db['ZendeskAccount'][_0xb4e2('0x15')]({'raw':_0x569e0f['options']?_0x569e0f[_0xb4e2('0x16')][_0xb4e2('0x17')]===undefined?!![]:![]:!![],'where':_0x569e0f[_0xb4e2('0x16')]?_0x569e0f[_0xb4e2('0x16')][_0xb4e2('0x18')]||null:null,'attributes':_0x569e0f[_0xb4e2('0x16')]?_0x569e0f[_0xb4e2('0x16')][_0xb4e2('0x19')]||null:null,'limit':_0x569e0f[_0xb4e2('0x16')]?_0x569e0f[_0xb4e2('0x16')][_0xb4e2('0x1a')]||null:null,'include':_0x569e0f[_0xb4e2('0x16')]?_0x569e0f[_0xb4e2('0x16')][_0xb4e2('0x1b')]?_['map'](_0x569e0f[_0xb4e2('0x16')][_0xb4e2('0x1b')],function(_0x51fe2d){return{'model':db[_0x51fe2d[_0xb4e2('0x1c')]],'as':_0x51fe2d['as'],'attributes':_0x51fe2d[_0xb4e2('0x19')],'include':_0x51fe2d[_0xb4e2('0x1b')]?_['map'](_0x51fe2d[_0xb4e2('0x1b')],function(_0x49c0a2){return{'model':db[_0x49c0a2['model']],'as':_0x49c0a2['as'],'attributes':_0x49c0a2[_0xb4e2('0x19')],'include':_0x49c0a2[_0xb4e2('0x1b')]?_[_0xb4e2('0x1d')](_0x49c0a2[_0xb4e2('0x1b')],function(_0x2376fe){return{'model':db[_0x2376fe['model']],'as':_0x2376fe['as'],'attributes':_0x2376fe[_0xb4e2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb4e2('0x8')](function(_0x20e524){logger[_0xb4e2('0x11')](_0xb4e2('0x14'),_0x569e0f);logger[_0xb4e2('0xb')]('GetZendeskAccount',_0x569e0f,JSON[_0xb4e2('0xd')](_0x20e524));_0x2b75d9(_0x20e524);})[_0xb4e2('0x13')](function(_0x268e92){logger[_0xb4e2('0xe')]('GetZendeskAccount',_0x268e92[_0xb4e2('0x10')],_0x569e0f);_0x2023d8(_0x22f25['error'](0x1f4,_0x268e92[_0xb4e2('0x10')]));});});};exports[_0xb4e2('0x1e')]=function(_0x392b20){var _0x357eb3=this;return new Promise(function(_0x49b320,_0x2ba839){return db[_0xb4e2('0x1f')]['find']({'raw':_0x392b20[_0xb4e2('0x16')]?_0x392b20[_0xb4e2('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x392b20[_0xb4e2('0x16')]?_0x392b20[_0xb4e2('0x16')][_0xb4e2('0x18')]||null:null,'attributes':_0x392b20[_0xb4e2('0x16')]?_0x392b20[_0xb4e2('0x16')][_0xb4e2('0x19')]||null:null,'include':_0x392b20[_0xb4e2('0x16')]?_0x392b20['options'][_0xb4e2('0x1b')]?_[_0xb4e2('0x1d')](_0x392b20[_0xb4e2('0x16')]['include'],function(_0x50d6db){return{'model':db[_0x50d6db[_0xb4e2('0x1c')]],'as':_0x50d6db['as'],'attributes':_0x50d6db[_0xb4e2('0x19')],'include':_0x50d6db[_0xb4e2('0x1b')]?_[_0xb4e2('0x1d')](_0x50d6db[_0xb4e2('0x1b')],function(_0x4cacec){return{'model':db[_0x4cacec[_0xb4e2('0x1c')]],'as':_0x4cacec['as'],'attributes':_0x4cacec[_0xb4e2('0x19')],'include':_0x4cacec[_0xb4e2('0x1b')]?_[_0xb4e2('0x1d')](_0x4cacec[_0xb4e2('0x1b')],function(_0x21f7b5){return{'model':db[_0x21f7b5['model']],'as':_0x21f7b5['as'],'attributes':_0x21f7b5[_0xb4e2('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb4e2('0x8')](function(_0x4a0c28){logger[_0xb4e2('0x11')](_0xb4e2('0x1e'),_0x392b20);logger[_0xb4e2('0xb')]('ShowZendeskAccount',_0x392b20,JSON['stringify'](_0x4a0c28));_0x49b320(_0x4a0c28);})[_0xb4e2('0x13')](function(_0x10b42b){logger[_0xb4e2('0xe')](_0xb4e2('0x1e'),_0x10b42b[_0xb4e2('0x10')],_0x392b20);_0x2ba839(_0x357eb3[_0xb4e2('0xe')](0x1f4,_0x10b42b[_0xb4e2('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 712e8e8..022d0d8 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 _0x750a=['getTags','post','setTags','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/tags'];(function(_0x5a07dd,_0x5b119f){var _0x199578=function(_0x30edaf){while(--_0x30edaf){_0x5a07dd['push'](_0x5a07dd['shift']());}};_0x199578(++_0x5b119f);}(_0x750a,0x140));var _0xa750=function(_0x26f1d3,_0x1bb42f){_0x26f1d3=_0x26f1d3-0x0;var _0x254e74=_0x750a[_0x26f1d3];return _0x254e74;};'use strict';var multer=require('multer');var util=require(_0xa750('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa750('0x1'));var router=express[_0xa750('0x2')]();var fs_extra=require(_0xa750('0x3'));var auth=require(_0xa750('0x4'));var interaction=require(_0xa750('0x5'));var config=require(_0xa750('0x6'));var controller=require(_0xa750('0x7'));router[_0xa750('0x8')]('/',auth[_0xa750('0x9')](),controller[_0xa750('0xa')]);router[_0xa750('0x8')](_0xa750('0xb'),auth[_0xa750('0x9')](),controller['show']);router['get'](_0xa750('0xc'),auth['isAuthenticated'](),controller[_0xa750('0xd')]);router[_0xa750('0x8')]('/:id/subjects',auth[_0xa750('0x9')](),controller[_0xa750('0xe')]);router['get']('/:id/descriptions',auth[_0xa750('0x9')](),controller['getDescriptions']);router[_0xa750('0x8')](_0xa750('0xf'),auth['isAuthenticated'](),controller[_0xa750('0x10')]);router[_0xa750('0x11')]('/',auth[_0xa750('0x9')](),controller['create']);router[_0xa750('0x11')](_0xa750('0xf'),auth[_0xa750('0x9')](),controller[_0xa750('0x12')]);router[_0xa750('0x13')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x14')]);router[_0xa750('0x15')](_0xa750('0xb'),auth['isAuthenticated'](),controller[_0xa750('0x16')]);module[_0xa750('0x17')]=router; \ No newline at end of file +var _0x5c00=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/tags','post','create','setTags','put','/:id','delete','destroy','exports','multer','util'];(function(_0x611d8,_0x7dc8e9){var _0x2a71b3=function(_0x50efcf){while(--_0x50efcf){_0x611d8['push'](_0x611d8['shift']());}};_0x2a71b3(++_0x7dc8e9);}(_0x5c00,0x17e));var _0x05c0=function(_0x5b70f0,_0x189655){_0x5b70f0=_0x5b70f0-0x0;var _0x49a246=_0x5c00[_0x5b70f0];return _0x49a246;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var fs_extra=require(_0x05c0('0x4'));var auth=require(_0x05c0('0x5'));var interaction=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var controller=require('./intZendeskConfiguration.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id/fields',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/descriptions',auth[_0x05c0('0x9')](),controller['getDescriptions']);router[_0x05c0('0x8')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller['getTags']);router[_0x05c0('0x10')]('/',auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0x10')](_0x05c0('0xf'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x12')]);router[_0x05c0('0x13')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller['update']);router[_0x05c0('0x15')](_0x05c0('0x14'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x16')]);module[_0x05c0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 6ca9648..252bb8f 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 _0x0aca=['STRING','sequelize','exports'];(function(_0x2e8271,_0xdab3c5){var _0x25dd38=function(_0x36a3a0){while(--_0x36a3a0){_0x2e8271['push'](_0x2e8271['shift']());}};_0x25dd38(++_0xdab3c5);}(_0x0aca,0xb8));var _0xa0ac=function(_0x3ce82c,_0x57a08d){_0x3ce82c=_0x3ce82c-0x0;var _0x15f514=_0x0aca[_0x3ce82c];return _0x15f514;};'use strict';var Sequelize=require(_0xa0ac('0x0'));module[_0xa0ac('0x1')]={'name':{'type':Sequelize[_0xa0ac('0x2')]},'description':{'type':Sequelize[_0xa0ac('0x2')]}}; \ No newline at end of file +var _0xfeff=['exports','STRING','sequelize'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0xfeff,0x1f4));var _0xffef=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xfeff[_0x2e4aa2];return _0x5e6092;};'use strict';var Sequelize=require(_0xffef('0x0'));module[_0xffef('0x1')]={'name':{'type':Sequelize[_0xffef('0x2')]},'description':{'type':Sequelize[_0xffef('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 4cc59bf..a27110b 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 _0x738b=['params','options','find','create','body','getFields','findOne','ZendeskField','rawAttributes','filter','map','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','ZendeskConfiguration','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x738b,0xbe));var _0xb738=function(_0x707abb,_0xc361f6){_0x707abb=_0x707abb-0x0;var _0x54bd0a=_0x738b[_0x707abb];return _0x54bd0a;};'use strict';var emlformat=require(_0xb738('0x0'));var rimraf=require(_0xb738('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb738('0x2'));var rp=require(_0xb738('0x3'));var moment=require(_0xb738('0x4'));var BPromise=require(_0xb738('0x5'));var Mustache=require(_0xb738('0x6'));var util=require(_0xb738('0x7'));var path=require(_0xb738('0x8'));var sox=require(_0xb738('0x9'));var csv=require(_0xb738('0xa'));var ejs=require(_0xb738('0xb'));var fs=require('fs');var fs_extra=require(_0xb738('0xc'));var _=require(_0xb738('0xd'));var squel=require(_0xb738('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb738('0xf'));var toCsv=require(_0xb738('0xa'));var querystring=require(_0xb738('0x10'));var Papa=require(_0xb738('0x11'));var Redis=require(_0xb738('0x12'));var authService=require(_0xb738('0x13'));var qs=require(_0xb738('0x14'));var as=require(_0xb738('0x15'));var hardwareService=require(_0xb738('0x16'));var logger=require(_0xb738('0x17'))('api');var utils=require(_0xb738('0x18'));var config=require(_0xb738('0x19'));var licenseUtil=require(_0xb738('0x1a'));var db=require(_0xb738('0x1b'))['db'];function respondWithStatusCode(_0x19bc0d,_0x2bfb85){_0x2bfb85=_0x2bfb85||0xcc;return function(_0x485e3f){if(_0x485e3f){return _0x19bc0d['sendStatus'](_0x2bfb85);}return _0x19bc0d['status'](_0x2bfb85)[_0xb738('0x1c')]();};}function respondWithResult(_0x47ab6e,_0x3027ca){_0x3027ca=_0x3027ca||0xc8;return function(_0xbdffb3){if(_0xbdffb3){return _0x47ab6e[_0xb738('0x1d')](_0x3027ca)[_0xb738('0x1e')](_0xbdffb3);}};}function respondWithFilteredResult(_0x20d54d,_0x234366){return function(_0x48e8bf){if(_0x48e8bf){var _0x587f1d=typeof _0x234366[_0xb738('0x1f')]==='undefined'&&typeof _0x234366[_0xb738('0x20')]===_0xb738('0x21');var _0x2c9475=_0x48e8bf[_0xb738('0x22')];var _0x265ab6=_0x587f1d?0x0:_0x234366[_0xb738('0x1f')];var _0x337b57=_0x587f1d?_0x48e8bf['count']:_0x234366[_0xb738('0x1f')]+_0x234366[_0xb738('0x20')];var _0x1e213f;if(_0x337b57>=_0x2c9475){_0x337b57=_0x2c9475;_0x1e213f=0xc8;}else{_0x1e213f=0xce;}_0x20d54d['status'](_0x1e213f);return _0x20d54d['set']('Content-Range',_0x265ab6+'-'+_0x337b57+'/'+_0x2c9475)[_0xb738('0x1e')](_0x48e8bf);}return null;};}function patchUpdates(_0x58dd82){return function(_0x187fc0){try{jsonpatch[_0xb738('0x23')](_0x187fc0,_0x58dd82,!![]);}catch(_0x3a873b){return BPromise[_0xb738('0x24')](_0x3a873b);}return _0x187fc0[_0xb738('0x25')]();};}function saveUpdates(_0x38f07a,_0x18ac54){return function(_0x376149){if(_0x376149){return _0x376149[_0xb738('0x26')](_0x38f07a)[_0xb738('0x27')](function(_0x27d188){return _0x27d188;});}return null;};}function removeEntity(_0x53ea91,_0x1a04b8){return function(_0x3c7329){if(_0x3c7329){return _0x3c7329[_0xb738('0x28')]()[_0xb738('0x27')](function(){_0x53ea91[_0xb738('0x1d')](0xcc)[_0xb738('0x1c')]();});}};}function handleEntityNotFound(_0x3ee12e,_0x49b39c){return function(_0x5545ac){if(!_0x5545ac){_0x3ee12e[_0xb738('0x29')](0x194);}return _0x5545ac;};}function handleError(_0x4c4c28,_0x5dd5b9){_0x5dd5b9=_0x5dd5b9||0x1f4;return function(_0x31eb05){logger[_0xb738('0x2a')](_0x31eb05[_0xb738('0x2b')]);if(_0x31eb05['name']){delete _0x31eb05[_0xb738('0x2c')];}_0x4c4c28[_0xb738('0x1d')](_0x5dd5b9)['send'](_0x31eb05);};}exports[_0xb738('0x2d')]=function(_0x5cace0,_0x29ed40){var _0xe3740c={},_0x468452={},_0x1a9c60={'count':0x0,'rows':[]};var _0x3a5b3d=_['map'](db[_0xb738('0x2e')]['rawAttributes'],function(_0x3169f5){return{'name':_0x3169f5[_0xb738('0x2f')],'type':_0x3169f5[_0xb738('0x30')]['key']};});_0x468452[_0xb738('0x31')]=_['map'](_0x3a5b3d,'name');_0x468452[_0xb738('0x32')]=_[_0xb738('0x33')](_0x5cace0['query']);_0x468452['filters']=_[_0xb738('0x34')](_0x468452[_0xb738('0x31')],_0x468452[_0xb738('0x32')]);_0xe3740c[_0xb738('0x35')]=_[_0xb738('0x34')](_0x468452['model'],qs[_0xb738('0x36')](_0x5cace0['query'][_0xb738('0x36')]));_0xe3740c['attributes']=_0xe3740c[_0xb738('0x35')][_0xb738('0x37')]?_0xe3740c['attributes']:_0x468452[_0xb738('0x31')];if(!_0x5cace0['query'][_0xb738('0x38')](_0xb738('0x39'))){_0xe3740c[_0xb738('0x20')]=qs['limit'](_0x5cace0[_0xb738('0x32')]['limit']);_0xe3740c[_0xb738('0x1f')]=qs[_0xb738('0x1f')](_0x5cace0[_0xb738('0x32')]['offset']);}_0xe3740c[_0xb738('0x3a')]=qs[_0xb738('0x3b')](_0x5cace0[_0xb738('0x32')]['sort']);_0xe3740c[_0xb738('0x3c')]=qs['filters'](_[_0xb738('0x3d')](_0x5cace0['query'],_0x468452[_0xb738('0x3e')]),_0x3a5b3d);if(_0x5cace0[_0xb738('0x32')]['filter']){_0xe3740c[_0xb738('0x3c')]=_[_0xb738('0x3f')](_0xe3740c[_0xb738('0x3c')],{'$or':_['map'](_0x3a5b3d,function(_0x592855){if(_0x592855[_0xb738('0x30')]!==_0xb738('0x40')){var _0x48cc3b={};_0x48cc3b[_0x592855['name']]={'$like':'%'+_0x5cace0['query']['filter']+'%'};return _0x48cc3b;}})});}_0xe3740c=_['merge']({},_0xe3740c,_0x5cace0['options']);var _0x37fcd9={'where':_0xe3740c[_0xb738('0x3c')]};return db[_0xb738('0x2e')][_0xb738('0x22')](_0x37fcd9)[_0xb738('0x27')](function(_0x2a07b3){_0x1a9c60[_0xb738('0x22')]=_0x2a07b3;if(_0x5cace0[_0xb738('0x32')][_0xb738('0x41')]){_0xe3740c[_0xb738('0x42')]=[{'all':!![]}];}return db[_0xb738('0x2e')][_0xb738('0x43')](_0xe3740c);})['then'](function(_0x538fc8){_0x1a9c60[_0xb738('0x44')]=_0x538fc8;return _0x1a9c60;})[_0xb738('0x27')](respondWithFilteredResult(_0x29ed40,_0xe3740c))[_0xb738('0x45')](handleError(_0x29ed40,null));};exports[_0xb738('0x46')]=function(_0x15ca81,_0x5b06ef){var _0x41594a={'raw':![],'where':{'id':_0x15ca81[_0xb738('0x47')]['id']}},_0x5c2876={};_0x5c2876[_0xb738('0x31')]=_[_0xb738('0x33')](db['ZendeskConfiguration']['rawAttributes']);_0x5c2876[_0xb738('0x32')]=_['keys'](_0x15ca81[_0xb738('0x32')]);_0x5c2876['filters']=_['intersection'](_0x5c2876['model'],_0x5c2876[_0xb738('0x32')]);_0x41594a[_0xb738('0x35')]=_[_0xb738('0x34')](_0x5c2876[_0xb738('0x31')],qs[_0xb738('0x36')](_0x15ca81[_0xb738('0x32')][_0xb738('0x36')]));_0x41594a[_0xb738('0x35')]=_0x41594a[_0xb738('0x35')][_0xb738('0x37')]?_0x41594a['attributes']:_0x5c2876['model'];if(_0x15ca81[_0xb738('0x32')][_0xb738('0x41')]){_0x41594a[_0xb738('0x42')]=[{'all':!![]}];}_0x41594a=_['merge']({},_0x41594a,_0x15ca81[_0xb738('0x48')]);return db[_0xb738('0x2e')][_0xb738('0x49')](_0x41594a)[_0xb738('0x27')](handleEntityNotFound(_0x5b06ef,null))[_0xb738('0x27')](respondWithResult(_0x5b06ef,null))[_0xb738('0x45')](handleError(_0x5b06ef,null));};exports[_0xb738('0x4a')]=function(_0x48a0cb,_0x2faad8){return db[_0xb738('0x2e')][_0xb738('0x4a')](_0x48a0cb[_0xb738('0x4b')],{})[_0xb738('0x27')](respondWithResult(_0x2faad8,0xc9))[_0xb738('0x45')](handleError(_0x2faad8,null));};exports[_0xb738('0x26')]=function(_0x32724a,_0x24ac11){if(_0x32724a['body']['id']){delete _0x32724a['body']['id'];}return db[_0xb738('0x2e')]['find']({'where':{'id':_0x32724a['params']['id']}})[_0xb738('0x27')](handleEntityNotFound(_0x24ac11,null))[_0xb738('0x27')](saveUpdates(_0x32724a[_0xb738('0x4b')],null))[_0xb738('0x27')](respondWithResult(_0x24ac11,null))[_0xb738('0x45')](handleError(_0x24ac11,null));};exports['destroy']=function(_0x3f1e9f,_0x29d17d){return db[_0xb738('0x2e')]['find']({'where':{'id':_0x3f1e9f['params']['id']}})[_0xb738('0x27')](handleEntityNotFound(_0x29d17d,null))['then'](removeEntity(_0x29d17d,null))['catch'](handleError(_0x29d17d,null));};exports[_0xb738('0x4c')]=function(_0x15affa,_0x2af4e8,_0xd17f56){var _0x23d2d9={};var _0x35cd6c={};var _0x29de85;var _0x52c961;return db[_0xb738('0x2e')][_0xb738('0x4d')]({'where':{'id':_0x15affa['params']['id']}})[_0xb738('0x27')](handleEntityNotFound(_0x2af4e8,null))['then'](function(_0x1afeb7){if(_0x1afeb7){_0x29de85=_0x1afeb7;_0x35cd6c[_0xb738('0x31')]=_[_0xb738('0x33')](db[_0xb738('0x4e')][_0xb738('0x4f')]);_0x35cd6c[_0xb738('0x32')]=_[_0xb738('0x33')](_0x15affa['query']);_0x35cd6c[_0xb738('0x3e')]=_[_0xb738('0x34')](_0x35cd6c[_0xb738('0x31')],_0x35cd6c[_0xb738('0x32')]);_0x23d2d9[_0xb738('0x35')]=_[_0xb738('0x34')](_0x35cd6c[_0xb738('0x31')],qs[_0xb738('0x36')](_0x15affa[_0xb738('0x32')]['fields']));_0x23d2d9['attributes']=_0x23d2d9['attributes'][_0xb738('0x37')]?_0x23d2d9[_0xb738('0x35')]:_0x35cd6c['model'];_0x23d2d9[_0xb738('0x3a')]=qs[_0xb738('0x3b')](_0x15affa[_0xb738('0x32')][_0xb738('0x3b')]);_0x23d2d9[_0xb738('0x3c')]=qs[_0xb738('0x3e')](_[_0xb738('0x3d')](_0x15affa[_0xb738('0x32')],_0x35cd6c['filters']));if(_0x15affa[_0xb738('0x32')][_0xb738('0x50')]){_0x23d2d9[_0xb738('0x3c')]=_['merge'](_0x23d2d9[_0xb738('0x3c')],{'$or':_[_0xb738('0x51')](_0x23d2d9[_0xb738('0x35')],function(_0x400ea0){var _0x116f46={};_0x116f46[_0x400ea0]={'$like':'%'+_0x15affa[_0xb738('0x32')][_0xb738('0x50')]+'%'};return _0x116f46;})});}_0x23d2d9=_[_0xb738('0x3f')]({},_0x23d2d9,_0x15affa[_0xb738('0x48')]);return _0x29de85['getFields'](_0x23d2d9);}})[_0xb738('0x27')](function(_0x1d4c6b){if(_0x1d4c6b){_0x52c961=_0x1d4c6b[_0xb738('0x37')];if(!_0x15affa[_0xb738('0x32')][_0xb738('0x38')](_0xb738('0x39'))){_0x23d2d9[_0xb738('0x20')]=qs[_0xb738('0x20')](_0x15affa['query'][_0xb738('0x20')]);_0x23d2d9[_0xb738('0x1f')]=qs['offset'](_0x15affa['query'][_0xb738('0x1f')]);}return _0x29de85['getFields'](_0x23d2d9);}})[_0xb738('0x27')](function(_0x330059){if(_0x330059){return _0x330059?{'count':_0x52c961,'rows':_0x330059}:null;}})[_0xb738('0x27')](respondWithResult(_0x2af4e8,null))[_0xb738('0x45')](handleError(_0x2af4e8,null));};exports['getSubjects']=function(_0x229669,_0x33ac49,_0x1a7128){var _0x482b53={};var _0x35cdad={};var _0x5c3977;var _0x52bf65;return db[_0xb738('0x2e')][_0xb738('0x4d')]({'where':{'id':_0x229669[_0xb738('0x47')]['id']}})[_0xb738('0x27')](handleEntityNotFound(_0x33ac49,null))[_0xb738('0x27')](function(_0x1877b0){if(_0x1877b0){_0x5c3977=_0x1877b0;_0x35cdad[_0xb738('0x31')]=_[_0xb738('0x33')](db[_0xb738('0x4e')]['rawAttributes']);_0x35cdad['query']=_[_0xb738('0x33')](_0x229669[_0xb738('0x32')]);_0x35cdad['filters']=_[_0xb738('0x34')](_0x35cdad[_0xb738('0x31')],_0x35cdad['query']);_0x482b53[_0xb738('0x35')]=_[_0xb738('0x34')](_0x35cdad['model'],qs[_0xb738('0x36')](_0x229669[_0xb738('0x32')][_0xb738('0x36')]));_0x482b53[_0xb738('0x35')]=_0x482b53['attributes'][_0xb738('0x37')]?_0x482b53[_0xb738('0x35')]:_0x35cdad['model'];_0x482b53[_0xb738('0x3a')]=qs['sort'](_0x229669[_0xb738('0x32')][_0xb738('0x3b')]);_0x482b53[_0xb738('0x3c')]=qs[_0xb738('0x3e')](_['pick'](_0x229669['query'],_0x35cdad['filters']));if(_0x229669[_0xb738('0x32')][_0xb738('0x50')]){_0x482b53['where']=_['merge'](_0x482b53['where'],{'$or':_[_0xb738('0x51')](_0x482b53[_0xb738('0x35')],function(_0x2f8396){var _0x2f452e={};_0x2f452e[_0x2f8396]={'$like':'%'+_0x229669['query'][_0xb738('0x50')]+'%'};return _0x2f452e;})});}_0x482b53=_[_0xb738('0x3f')]({},_0x482b53,_0x229669[_0xb738('0x48')]);return _0x5c3977[_0xb738('0x52')](_0x482b53);}})['then'](function(_0x124906){if(_0x124906){_0x52bf65=_0x124906['length'];if(!_0x229669['query'][_0xb738('0x38')](_0xb738('0x39'))){_0x482b53[_0xb738('0x20')]=qs[_0xb738('0x20')](_0x229669[_0xb738('0x32')][_0xb738('0x20')]);_0x482b53[_0xb738('0x1f')]=qs[_0xb738('0x1f')](_0x229669['query'][_0xb738('0x1f')]);}return _0x5c3977[_0xb738('0x52')](_0x482b53);}})['then'](function(_0x1fc654){if(_0x1fc654){return _0x1fc654?{'count':_0x52bf65,'rows':_0x1fc654}:null;}})[_0xb738('0x27')](respondWithResult(_0x33ac49,null))[_0xb738('0x45')](handleError(_0x33ac49,null));};exports[_0xb738('0x53')]=function(_0x32de69,_0x20823f,_0x1cc60f){var _0x172dbf={};var _0x2cfd0b={};var _0x108649;var _0x3d04c5;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x32de69[_0xb738('0x47')]['id']}})['then'](handleEntityNotFound(_0x20823f,null))[_0xb738('0x27')](function(_0x4e52ec){if(_0x4e52ec){_0x108649=_0x4e52ec;_0x2cfd0b[_0xb738('0x31')]=_['keys'](db[_0xb738('0x4e')][_0xb738('0x4f')]);_0x2cfd0b['query']=_['keys'](_0x32de69[_0xb738('0x32')]);_0x2cfd0b[_0xb738('0x3e')]=_[_0xb738('0x34')](_0x2cfd0b[_0xb738('0x31')],_0x2cfd0b[_0xb738('0x32')]);_0x172dbf[_0xb738('0x35')]=_[_0xb738('0x34')](_0x2cfd0b[_0xb738('0x31')],qs[_0xb738('0x36')](_0x32de69[_0xb738('0x32')][_0xb738('0x36')]));_0x172dbf['attributes']=_0x172dbf[_0xb738('0x35')][_0xb738('0x37')]?_0x172dbf[_0xb738('0x35')]:_0x2cfd0b['model'];_0x172dbf[_0xb738('0x3a')]=qs[_0xb738('0x3b')](_0x32de69[_0xb738('0x32')][_0xb738('0x3b')]);_0x172dbf[_0xb738('0x3c')]=qs[_0xb738('0x3e')](_[_0xb738('0x3d')](_0x32de69['query'],_0x2cfd0b[_0xb738('0x3e')]));if(_0x32de69[_0xb738('0x32')]['filter']){_0x172dbf[_0xb738('0x3c')]=_['merge'](_0x172dbf[_0xb738('0x3c')],{'$or':_[_0xb738('0x51')](_0x172dbf[_0xb738('0x35')],function(_0x3d0ab5){var _0x1c1692={};_0x1c1692[_0x3d0ab5]={'$like':'%'+_0x32de69[_0xb738('0x32')][_0xb738('0x50')]+'%'};return _0x1c1692;})});}_0x172dbf=_[_0xb738('0x3f')]({},_0x172dbf,_0x32de69[_0xb738('0x48')]);return _0x108649[_0xb738('0x53')](_0x172dbf);}})[_0xb738('0x27')](function(_0x4bc922){if(_0x4bc922){_0x3d04c5=_0x4bc922[_0xb738('0x37')];if(!_0x32de69[_0xb738('0x32')]['hasOwnProperty']('nolimit')){_0x172dbf[_0xb738('0x20')]=qs[_0xb738('0x20')](_0x32de69[_0xb738('0x32')][_0xb738('0x20')]);_0x172dbf[_0xb738('0x1f')]=qs[_0xb738('0x1f')](_0x32de69['query'][_0xb738('0x1f')]);}return _0x108649[_0xb738('0x53')](_0x172dbf);}})[_0xb738('0x27')](function(_0xd91232){if(_0xd91232){return _0xd91232?{'count':_0x3d04c5,'rows':_0xd91232}:null;}})[_0xb738('0x27')](respondWithResult(_0x20823f,null))['catch'](handleError(_0x20823f,null));};exports[_0xb738('0x54')]=function(_0x435080,_0x2f4a70,_0x365283){var _0x3e2417={};var _0x133156={};var _0x497f50;var _0x457d22;return db[_0xb738('0x2e')][_0xb738('0x4d')]({'where':{'id':_0x435080[_0xb738('0x47')]['id']}})['then'](handleEntityNotFound(_0x2f4a70,null))[_0xb738('0x27')](function(_0x3fa1df){if(_0x3fa1df){_0x497f50=_0x3fa1df;_0x133156['model']=_['keys'](db['Tag'][_0xb738('0x4f')]);_0x133156['query']=_[_0xb738('0x33')](_0x435080[_0xb738('0x32')]);_0x133156[_0xb738('0x3e')]=_['intersection'](_0x133156[_0xb738('0x31')],_0x133156[_0xb738('0x32')]);_0x3e2417[_0xb738('0x35')]=_[_0xb738('0x34')](_0x133156[_0xb738('0x31')],qs['fields'](_0x435080['query'][_0xb738('0x36')]));_0x3e2417[_0xb738('0x35')]=_0x3e2417[_0xb738('0x35')][_0xb738('0x37')]?_0x3e2417[_0xb738('0x35')]:_0x133156[_0xb738('0x31')];_0x3e2417[_0xb738('0x3a')]=qs[_0xb738('0x3b')](_0x435080[_0xb738('0x32')][_0xb738('0x3b')]);_0x3e2417[_0xb738('0x3c')]=qs[_0xb738('0x3e')](_['pick'](_0x435080[_0xb738('0x32')],_0x133156[_0xb738('0x3e')]));if(_0x435080['query'][_0xb738('0x50')]){_0x3e2417['where']=_[_0xb738('0x3f')](_0x3e2417[_0xb738('0x3c')],{'$or':_[_0xb738('0x51')](_0x3e2417[_0xb738('0x35')],function(_0x4312c9){var _0x478b41={};_0x478b41[_0x4312c9]={'$like':'%'+_0x435080[_0xb738('0x32')][_0xb738('0x50')]+'%'};return _0x478b41;})});}_0x3e2417=_[_0xb738('0x3f')]({},_0x3e2417,_0x435080[_0xb738('0x48')]);return _0x497f50[_0xb738('0x54')](_0x3e2417);}})[_0xb738('0x27')](function(_0x56c04f){if(_0x56c04f){_0x457d22=_0x56c04f[_0xb738('0x37')];if(!_0x435080[_0xb738('0x32')]['hasOwnProperty'](_0xb738('0x39'))){_0x3e2417[_0xb738('0x20')]=qs[_0xb738('0x20')](_0x435080[_0xb738('0x32')][_0xb738('0x20')]);_0x3e2417[_0xb738('0x1f')]=qs[_0xb738('0x1f')](_0x435080[_0xb738('0x32')]['offset']);}return _0x497f50[_0xb738('0x54')](_0x3e2417);}})[_0xb738('0x27')](function(_0x345d32){if(_0x345d32){return _0x345d32?{'count':_0x457d22,'rows':_0x345d32}:null;}})[_0xb738('0x27')](respondWithResult(_0x2f4a70,null))['catch'](handleError(_0x2f4a70,null));};exports[_0xb738('0x55')]=function(_0x2a8ab4,_0x308e93,_0x4bea35){if(_0x2a8ab4[_0xb738('0x4b')]['id']){delete _0x2a8ab4[_0xb738('0x4b')]['id'];}return db[_0xb738('0x2e')][_0xb738('0x4d')]({'where':{'id':_0x2a8ab4['params']['id']}})[_0xb738('0x27')](handleEntityNotFound(_0x308e93,null))[_0xb738('0x27')](function(_0x590a91){if(_0x590a91){return _0x590a91[_0xb738('0x55')](_0x2a8ab4['body'][_0xb738('0x56')]||[]);}return null;})['then'](respondWithResult(_0x308e93,null))['catch'](handleError(_0x308e93,null));}; \ No newline at end of file +var _0x5846=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','ZendeskField','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x5846,0x9a));var _0x6584=function(_0x2db126,_0x26361c){_0x2db126=_0x2db126-0x0;var _0x6e5b63=_0x5846[_0x2db126];return _0x6e5b63;};'use strict';var emlformat=require(_0x6584('0x0'));var rimraf=require(_0x6584('0x1'));var zipdir=require(_0x6584('0x2'));var jsonpatch=require(_0x6584('0x3'));var rp=require(_0x6584('0x4'));var moment=require(_0x6584('0x5'));var BPromise=require(_0x6584('0x6'));var Mustache=require('mustache');var util=require(_0x6584('0x7'));var path=require('path');var sox=require(_0x6584('0x8'));var csv=require(_0x6584('0x9'));var ejs=require(_0x6584('0xa'));var fs=require('fs');var fs_extra=require(_0x6584('0xb'));var _=require(_0x6584('0xc'));var squel=require(_0x6584('0xd'));var crypto=require(_0x6584('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6584('0x9'));var querystring=require(_0x6584('0xf'));var Papa=require(_0x6584('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6584('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6584('0x12'));var logger=require(_0x6584('0x13'))(_0x6584('0x14'));var utils=require(_0x6584('0x15'));var config=require(_0x6584('0x16'));var licenseUtil=require(_0x6584('0x17'));var db=require(_0x6584('0x18'))['db'];function respondWithStatusCode(_0xf921d1,_0x3db56a){_0x3db56a=_0x3db56a||0xcc;return function(_0x1c28fa){if(_0x1c28fa){return _0xf921d1['sendStatus'](_0x3db56a);}return _0xf921d1[_0x6584('0x19')](_0x3db56a)[_0x6584('0x1a')]();};}function respondWithResult(_0x421d12,_0xf59e9c){_0xf59e9c=_0xf59e9c||0xc8;return function(_0x16845a){if(_0x16845a){return _0x421d12[_0x6584('0x19')](_0xf59e9c)['json'](_0x16845a);}};}function respondWithFilteredResult(_0x439432,_0x5511ee){return function(_0x383684){if(_0x383684){var _0x132eaf=typeof _0x5511ee[_0x6584('0x1b')]===_0x6584('0x1c')&&typeof _0x5511ee['limit']===_0x6584('0x1c');var _0x132ca3=_0x383684[_0x6584('0x1d')];var _0x172875=_0x132eaf?0x0:_0x5511ee[_0x6584('0x1b')];var _0x25d7bf=_0x132eaf?_0x383684['count']:_0x5511ee[_0x6584('0x1b')]+_0x5511ee[_0x6584('0x1e')];var _0x252e58;if(_0x25d7bf>=_0x132ca3){_0x25d7bf=_0x132ca3;_0x252e58=0xc8;}else{_0x252e58=0xce;}_0x439432[_0x6584('0x19')](_0x252e58);return _0x439432[_0x6584('0x1f')](_0x6584('0x20'),_0x172875+'-'+_0x25d7bf+'/'+_0x132ca3)[_0x6584('0x21')](_0x383684);}return null;};}function patchUpdates(_0x202ce0){return function(_0x7f76e6){try{jsonpatch[_0x6584('0x22')](_0x7f76e6,_0x202ce0,!![]);}catch(_0x30d71f){return BPromise['reject'](_0x30d71f);}return _0x7f76e6[_0x6584('0x23')]();};}function saveUpdates(_0xa7671d,_0x495291){return function(_0x41f8b3){if(_0x41f8b3){return _0x41f8b3[_0x6584('0x24')](_0xa7671d)[_0x6584('0x25')](function(_0x4da200){return _0x4da200;});}return null;};}function removeEntity(_0x233d2a,_0x3838df){return function(_0x40abe5){if(_0x40abe5){return _0x40abe5[_0x6584('0x26')]()[_0x6584('0x25')](function(){_0x233d2a[_0x6584('0x19')](0xcc)[_0x6584('0x1a')]();});}};}function handleEntityNotFound(_0x49ffce,_0x497a18){return function(_0x2e24d1){if(!_0x2e24d1){_0x49ffce['sendStatus'](0x194);}return _0x2e24d1;};}function handleError(_0x6861e3,_0x227be4){_0x227be4=_0x227be4||0x1f4;return function(_0x3b794b){logger[_0x6584('0x27')](_0x3b794b[_0x6584('0x28')]);if(_0x3b794b[_0x6584('0x29')]){delete _0x3b794b[_0x6584('0x29')];}_0x6861e3[_0x6584('0x19')](_0x227be4)[_0x6584('0x2a')](_0x3b794b);};}exports['index']=function(_0x2ff7e4,_0x29b8ef){var _0x2d2a26={},_0x29b46b={},_0x37ba54={'count':0x0,'rows':[]};var _0x3005ec=_[_0x6584('0x2b')](db[_0x6584('0x2c')][_0x6584('0x2d')],function(_0x53873b){return{'name':_0x53873b[_0x6584('0x2e')],'type':_0x53873b[_0x6584('0x2f')][_0x6584('0x30')]};});_0x29b46b[_0x6584('0x31')]=_[_0x6584('0x2b')](_0x3005ec,_0x6584('0x29'));_0x29b46b['query']=_[_0x6584('0x32')](_0x2ff7e4[_0x6584('0x33')]);_0x29b46b['filters']=_[_0x6584('0x34')](_0x29b46b[_0x6584('0x31')],_0x29b46b[_0x6584('0x33')]);_0x2d2a26['attributes']=_[_0x6584('0x34')](_0x29b46b[_0x6584('0x31')],qs[_0x6584('0x35')](_0x2ff7e4[_0x6584('0x33')][_0x6584('0x35')]));_0x2d2a26[_0x6584('0x36')]=_0x2d2a26['attributes'][_0x6584('0x37')]?_0x2d2a26[_0x6584('0x36')]:_0x29b46b[_0x6584('0x31')];if(!_0x2ff7e4[_0x6584('0x33')]['hasOwnProperty'](_0x6584('0x38'))){_0x2d2a26[_0x6584('0x1e')]=qs[_0x6584('0x1e')](_0x2ff7e4['query']['limit']);_0x2d2a26[_0x6584('0x1b')]=qs[_0x6584('0x1b')](_0x2ff7e4['query']['offset']);}_0x2d2a26[_0x6584('0x39')]=qs[_0x6584('0x3a')](_0x2ff7e4[_0x6584('0x33')][_0x6584('0x3a')]);_0x2d2a26[_0x6584('0x3b')]=qs['filters'](_[_0x6584('0x3c')](_0x2ff7e4[_0x6584('0x33')],_0x29b46b[_0x6584('0x3d')]),_0x3005ec);if(_0x2ff7e4[_0x6584('0x33')]['filter']){_0x2d2a26[_0x6584('0x3b')]=_[_0x6584('0x3e')](_0x2d2a26[_0x6584('0x3b')],{'$or':_['map'](_0x3005ec,function(_0x514522){if(_0x514522['type']!==_0x6584('0x3f')){var _0x475808={};_0x475808[_0x514522[_0x6584('0x29')]]={'$like':'%'+_0x2ff7e4[_0x6584('0x33')][_0x6584('0x40')]+'%'};return _0x475808;}})});}_0x2d2a26=_[_0x6584('0x3e')]({},_0x2d2a26,_0x2ff7e4[_0x6584('0x41')]);var _0x23bffc={'where':_0x2d2a26['where']};return db[_0x6584('0x2c')][_0x6584('0x1d')](_0x23bffc)['then'](function(_0x43b302){_0x37ba54[_0x6584('0x1d')]=_0x43b302;if(_0x2ff7e4[_0x6584('0x33')][_0x6584('0x42')]){_0x2d2a26[_0x6584('0x43')]=[{'all':!![]}];}return db[_0x6584('0x2c')][_0x6584('0x44')](_0x2d2a26);})[_0x6584('0x25')](function(_0x425c9e){_0x37ba54[_0x6584('0x45')]=_0x425c9e;return _0x37ba54;})['then'](respondWithFilteredResult(_0x29b8ef,_0x2d2a26))[_0x6584('0x46')](handleError(_0x29b8ef,null));};exports[_0x6584('0x47')]=function(_0x5e49ba,_0x462822){var _0x4c1ffe={'raw':![],'where':{'id':_0x5e49ba[_0x6584('0x48')]['id']}},_0x405369={};_0x405369['model']=_[_0x6584('0x32')](db[_0x6584('0x2c')][_0x6584('0x2d')]);_0x405369['query']=_[_0x6584('0x32')](_0x5e49ba[_0x6584('0x33')]);_0x405369[_0x6584('0x3d')]=_['intersection'](_0x405369['model'],_0x405369[_0x6584('0x33')]);_0x4c1ffe[_0x6584('0x36')]=_[_0x6584('0x34')](_0x405369[_0x6584('0x31')],qs[_0x6584('0x35')](_0x5e49ba['query'][_0x6584('0x35')]));_0x4c1ffe['attributes']=_0x4c1ffe[_0x6584('0x36')][_0x6584('0x37')]?_0x4c1ffe[_0x6584('0x36')]:_0x405369['model'];if(_0x5e49ba[_0x6584('0x33')][_0x6584('0x42')]){_0x4c1ffe[_0x6584('0x43')]=[{'all':!![]}];}_0x4c1ffe=_[_0x6584('0x3e')]({},_0x4c1ffe,_0x5e49ba[_0x6584('0x41')]);return db['ZendeskConfiguration'][_0x6584('0x49')](_0x4c1ffe)[_0x6584('0x25')](handleEntityNotFound(_0x462822,null))['then'](respondWithResult(_0x462822,null))[_0x6584('0x46')](handleError(_0x462822,null));};exports['create']=function(_0x23ecb1,_0x5bcb9e){return db[_0x6584('0x2c')][_0x6584('0x4a')](_0x23ecb1[_0x6584('0x4b')],{})['then'](respondWithResult(_0x5bcb9e,0xc9))[_0x6584('0x46')](handleError(_0x5bcb9e,null));};exports[_0x6584('0x24')]=function(_0xcc8e8e,_0xd73715){if(_0xcc8e8e['body']['id']){delete _0xcc8e8e[_0x6584('0x4b')]['id'];}return db[_0x6584('0x2c')][_0x6584('0x49')]({'where':{'id':_0xcc8e8e[_0x6584('0x48')]['id']}})[_0x6584('0x25')](handleEntityNotFound(_0xd73715,null))[_0x6584('0x25')](saveUpdates(_0xcc8e8e['body'],null))['then'](respondWithResult(_0xd73715,null))[_0x6584('0x46')](handleError(_0xd73715,null));};exports[_0x6584('0x26')]=function(_0x20eb05,_0x5f4427){return db[_0x6584('0x2c')][_0x6584('0x49')]({'where':{'id':_0x20eb05['params']['id']}})[_0x6584('0x25')](handleEntityNotFound(_0x5f4427,null))[_0x6584('0x25')](removeEntity(_0x5f4427,null))[_0x6584('0x46')](handleError(_0x5f4427,null));};exports[_0x6584('0x4c')]=function(_0x3c4548,_0x2bd14a,_0xfc4d36){var _0xde02a5={};var _0x4d3c42={};var _0x2e4e45;var _0x14c74b;return db[_0x6584('0x2c')][_0x6584('0x4d')]({'where':{'id':_0x3c4548[_0x6584('0x48')]['id']}})[_0x6584('0x25')](handleEntityNotFound(_0x2bd14a,null))[_0x6584('0x25')](function(_0x2ef09f){if(_0x2ef09f){_0x2e4e45=_0x2ef09f;_0x4d3c42[_0x6584('0x31')]=_[_0x6584('0x32')](db[_0x6584('0x4e')]['rawAttributes']);_0x4d3c42[_0x6584('0x33')]=_['keys'](_0x3c4548[_0x6584('0x33')]);_0x4d3c42[_0x6584('0x3d')]=_[_0x6584('0x34')](_0x4d3c42[_0x6584('0x31')],_0x4d3c42[_0x6584('0x33')]);_0xde02a5[_0x6584('0x36')]=_[_0x6584('0x34')](_0x4d3c42[_0x6584('0x31')],qs[_0x6584('0x35')](_0x3c4548[_0x6584('0x33')]['fields']));_0xde02a5['attributes']=_0xde02a5[_0x6584('0x36')]['length']?_0xde02a5[_0x6584('0x36')]:_0x4d3c42[_0x6584('0x31')];_0xde02a5[_0x6584('0x39')]=qs[_0x6584('0x3a')](_0x3c4548[_0x6584('0x33')]['sort']);_0xde02a5[_0x6584('0x3b')]=qs['filters'](_[_0x6584('0x3c')](_0x3c4548[_0x6584('0x33')],_0x4d3c42[_0x6584('0x3d')]));if(_0x3c4548[_0x6584('0x33')][_0x6584('0x40')]){_0xde02a5[_0x6584('0x3b')]=_[_0x6584('0x3e')](_0xde02a5[_0x6584('0x3b')],{'$or':_['map'](_0xde02a5[_0x6584('0x36')],function(_0xe4d7f3){var _0x3c870a={};_0x3c870a[_0xe4d7f3]={'$like':'%'+_0x3c4548[_0x6584('0x33')][_0x6584('0x40')]+'%'};return _0x3c870a;})});}_0xde02a5=_['merge']({},_0xde02a5,_0x3c4548[_0x6584('0x41')]);return _0x2e4e45['getFields'](_0xde02a5);}})[_0x6584('0x25')](function(_0x1f6fdf){if(_0x1f6fdf){_0x14c74b=_0x1f6fdf[_0x6584('0x37')];if(!_0x3c4548[_0x6584('0x33')]['hasOwnProperty'](_0x6584('0x38'))){_0xde02a5[_0x6584('0x1e')]=qs[_0x6584('0x1e')](_0x3c4548[_0x6584('0x33')][_0x6584('0x1e')]);_0xde02a5[_0x6584('0x1b')]=qs[_0x6584('0x1b')](_0x3c4548['query'][_0x6584('0x1b')]);}return _0x2e4e45[_0x6584('0x4c')](_0xde02a5);}})[_0x6584('0x25')](function(_0x5aa7b5){if(_0x5aa7b5){return _0x5aa7b5?{'count':_0x14c74b,'rows':_0x5aa7b5}:null;}})[_0x6584('0x25')](respondWithResult(_0x2bd14a,null))[_0x6584('0x46')](handleError(_0x2bd14a,null));};exports[_0x6584('0x4f')]=function(_0x5b648f,_0x25be18,_0x79e55e){var _0x3d5340={};var _0x44f9fd={};var _0x26b358;var _0x52bd6b;return db[_0x6584('0x2c')][_0x6584('0x4d')]({'where':{'id':_0x5b648f['params']['id']}})['then'](handleEntityNotFound(_0x25be18,null))[_0x6584('0x25')](function(_0xe96258){if(_0xe96258){_0x26b358=_0xe96258;_0x44f9fd[_0x6584('0x31')]=_[_0x6584('0x32')](db['ZendeskField'][_0x6584('0x2d')]);_0x44f9fd[_0x6584('0x33')]=_[_0x6584('0x32')](_0x5b648f[_0x6584('0x33')]);_0x44f9fd['filters']=_[_0x6584('0x34')](_0x44f9fd[_0x6584('0x31')],_0x44f9fd['query']);_0x3d5340[_0x6584('0x36')]=_[_0x6584('0x34')](_0x44f9fd[_0x6584('0x31')],qs['fields'](_0x5b648f[_0x6584('0x33')]['fields']));_0x3d5340['attributes']=_0x3d5340[_0x6584('0x36')][_0x6584('0x37')]?_0x3d5340[_0x6584('0x36')]:_0x44f9fd[_0x6584('0x31')];_0x3d5340['order']=qs[_0x6584('0x3a')](_0x5b648f[_0x6584('0x33')][_0x6584('0x3a')]);_0x3d5340[_0x6584('0x3b')]=qs['filters'](_['pick'](_0x5b648f[_0x6584('0x33')],_0x44f9fd[_0x6584('0x3d')]));if(_0x5b648f[_0x6584('0x33')]['filter']){_0x3d5340['where']=_[_0x6584('0x3e')](_0x3d5340[_0x6584('0x3b')],{'$or':_[_0x6584('0x2b')](_0x3d5340[_0x6584('0x36')],function(_0x399c49){var _0x4bde41={};_0x4bde41[_0x399c49]={'$like':'%'+_0x5b648f['query'][_0x6584('0x40')]+'%'};return _0x4bde41;})});}_0x3d5340=_['merge']({},_0x3d5340,_0x5b648f[_0x6584('0x41')]);return _0x26b358[_0x6584('0x4f')](_0x3d5340);}})[_0x6584('0x25')](function(_0x4a54fc){if(_0x4a54fc){_0x52bd6b=_0x4a54fc[_0x6584('0x37')];if(!_0x5b648f[_0x6584('0x33')][_0x6584('0x50')](_0x6584('0x38'))){_0x3d5340[_0x6584('0x1e')]=qs[_0x6584('0x1e')](_0x5b648f[_0x6584('0x33')][_0x6584('0x1e')]);_0x3d5340['offset']=qs[_0x6584('0x1b')](_0x5b648f[_0x6584('0x33')][_0x6584('0x1b')]);}return _0x26b358[_0x6584('0x4f')](_0x3d5340);}})[_0x6584('0x25')](function(_0x5c04ec){if(_0x5c04ec){return _0x5c04ec?{'count':_0x52bd6b,'rows':_0x5c04ec}:null;}})[_0x6584('0x25')](respondWithResult(_0x25be18,null))['catch'](handleError(_0x25be18,null));};exports[_0x6584('0x51')]=function(_0x454664,_0xf153a3,_0x41cbea){var _0x2774a3={};var _0x4d0671={};var _0x38ad41;var _0x41b027;return db['ZendeskConfiguration'][_0x6584('0x4d')]({'where':{'id':_0x454664[_0x6584('0x48')]['id']}})[_0x6584('0x25')](handleEntityNotFound(_0xf153a3,null))['then'](function(_0x631ea8){if(_0x631ea8){_0x38ad41=_0x631ea8;_0x4d0671[_0x6584('0x31')]=_[_0x6584('0x32')](db[_0x6584('0x4e')][_0x6584('0x2d')]);_0x4d0671[_0x6584('0x33')]=_['keys'](_0x454664[_0x6584('0x33')]);_0x4d0671[_0x6584('0x3d')]=_[_0x6584('0x34')](_0x4d0671[_0x6584('0x31')],_0x4d0671[_0x6584('0x33')]);_0x2774a3[_0x6584('0x36')]=_['intersection'](_0x4d0671[_0x6584('0x31')],qs[_0x6584('0x35')](_0x454664['query']['fields']));_0x2774a3['attributes']=_0x2774a3[_0x6584('0x36')][_0x6584('0x37')]?_0x2774a3['attributes']:_0x4d0671[_0x6584('0x31')];_0x2774a3[_0x6584('0x39')]=qs['sort'](_0x454664['query'][_0x6584('0x3a')]);_0x2774a3[_0x6584('0x3b')]=qs['filters'](_['pick'](_0x454664[_0x6584('0x33')],_0x4d0671[_0x6584('0x3d')]));if(_0x454664[_0x6584('0x33')]['filter']){_0x2774a3['where']=_[_0x6584('0x3e')](_0x2774a3['where'],{'$or':_[_0x6584('0x2b')](_0x2774a3[_0x6584('0x36')],function(_0x2d26a2){var _0x708a6a={};_0x708a6a[_0x2d26a2]={'$like':'%'+_0x454664[_0x6584('0x33')][_0x6584('0x40')]+'%'};return _0x708a6a;})});}_0x2774a3=_[_0x6584('0x3e')]({},_0x2774a3,_0x454664[_0x6584('0x41')]);return _0x38ad41[_0x6584('0x51')](_0x2774a3);}})[_0x6584('0x25')](function(_0x25cb7e){if(_0x25cb7e){_0x41b027=_0x25cb7e[_0x6584('0x37')];if(!_0x454664[_0x6584('0x33')][_0x6584('0x50')]('nolimit')){_0x2774a3[_0x6584('0x1e')]=qs[_0x6584('0x1e')](_0x454664[_0x6584('0x33')][_0x6584('0x1e')]);_0x2774a3['offset']=qs['offset'](_0x454664[_0x6584('0x33')][_0x6584('0x1b')]);}return _0x38ad41['getDescriptions'](_0x2774a3);}})[_0x6584('0x25')](function(_0x393089){if(_0x393089){return _0x393089?{'count':_0x41b027,'rows':_0x393089}:null;}})['then'](respondWithResult(_0xf153a3,null))[_0x6584('0x46')](handleError(_0xf153a3,null));};exports[_0x6584('0x52')]=function(_0x19d32f,_0x2a92fe,_0x3894a0){var _0x48bdc2={};var _0xf13b25={};var _0x293909;var _0x3478d2;return db[_0x6584('0x2c')][_0x6584('0x4d')]({'where':{'id':_0x19d32f[_0x6584('0x48')]['id']}})['then'](handleEntityNotFound(_0x2a92fe,null))[_0x6584('0x25')](function(_0x1ff891){if(_0x1ff891){_0x293909=_0x1ff891;_0xf13b25[_0x6584('0x31')]=_[_0x6584('0x32')](db[_0x6584('0x53')][_0x6584('0x2d')]);_0xf13b25['query']=_[_0x6584('0x32')](_0x19d32f[_0x6584('0x33')]);_0xf13b25[_0x6584('0x3d')]=_['intersection'](_0xf13b25[_0x6584('0x31')],_0xf13b25[_0x6584('0x33')]);_0x48bdc2[_0x6584('0x36')]=_['intersection'](_0xf13b25[_0x6584('0x31')],qs[_0x6584('0x35')](_0x19d32f[_0x6584('0x33')][_0x6584('0x35')]));_0x48bdc2['attributes']=_0x48bdc2[_0x6584('0x36')][_0x6584('0x37')]?_0x48bdc2[_0x6584('0x36')]:_0xf13b25[_0x6584('0x31')];_0x48bdc2[_0x6584('0x39')]=qs['sort'](_0x19d32f[_0x6584('0x33')][_0x6584('0x3a')]);_0x48bdc2['where']=qs[_0x6584('0x3d')](_[_0x6584('0x3c')](_0x19d32f[_0x6584('0x33')],_0xf13b25[_0x6584('0x3d')]));if(_0x19d32f['query'][_0x6584('0x40')]){_0x48bdc2[_0x6584('0x3b')]=_[_0x6584('0x3e')](_0x48bdc2[_0x6584('0x3b')],{'$or':_[_0x6584('0x2b')](_0x48bdc2[_0x6584('0x36')],function(_0x2f1c96){var _0xdee27b={};_0xdee27b[_0x2f1c96]={'$like':'%'+_0x19d32f[_0x6584('0x33')]['filter']+'%'};return _0xdee27b;})});}_0x48bdc2=_[_0x6584('0x3e')]({},_0x48bdc2,_0x19d32f[_0x6584('0x41')]);return _0x293909[_0x6584('0x52')](_0x48bdc2);}})[_0x6584('0x25')](function(_0x10116d){if(_0x10116d){_0x3478d2=_0x10116d[_0x6584('0x37')];if(!_0x19d32f[_0x6584('0x33')][_0x6584('0x50')](_0x6584('0x38'))){_0x48bdc2[_0x6584('0x1e')]=qs[_0x6584('0x1e')](_0x19d32f[_0x6584('0x33')][_0x6584('0x1e')]);_0x48bdc2[_0x6584('0x1b')]=qs[_0x6584('0x1b')](_0x19d32f[_0x6584('0x33')][_0x6584('0x1b')]);}return _0x293909[_0x6584('0x52')](_0x48bdc2);}})['then'](function(_0x304dce){if(_0x304dce){return _0x304dce?{'count':_0x3478d2,'rows':_0x304dce}:null;}})[_0x6584('0x25')](respondWithResult(_0x2a92fe,null))[_0x6584('0x46')](handleError(_0x2a92fe,null));};exports[_0x6584('0x54')]=function(_0x54ae29,_0x42273c,_0x5b61af){if(_0x54ae29[_0x6584('0x4b')]['id']){delete _0x54ae29[_0x6584('0x4b')]['id'];}return db[_0x6584('0x2c')]['findOne']({'where':{'id':_0x54ae29[_0x6584('0x48')]['id']}})['then'](handleEntityNotFound(_0x42273c,null))[_0x6584('0x25')](function(_0x3ce585){if(_0x3ce585){return _0x3ce585[_0x6584('0x54')](_0x54ae29[_0x6584('0x4b')][_0x6584('0x55')]||[]);}return null;})[_0x6584('0x25')](respondWithResult(_0x42273c,null))['catch'](handleError(_0x42273c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 35a09b1..776b72a 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 _0x5f66=['request-promise','path','../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','util','api','moment','bluebird'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x282b=['moment','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x2efaa9,_0x359aac){var _0x181b62=function(_0x2be0d8){while(--_0x2be0d8){_0x2efaa9['push'](_0x2efaa9['shift']());}};_0x181b62(++_0x359aac);}(_0x282b,0xec));var _0xb282=function(_0x591633,_0x123410){_0x591633=_0x591633-0x0;var _0x1cb85d=_0x282b[_0x591633];return _0x1cb85d;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var logger=require(_0xb282('0x2'))(_0xb282('0x3'));var moment=require(_0xb282('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb282('0x5'));var rimraf=require('rimraf');var config=require(_0xb282('0x6'));var attributes=require(_0xb282('0x7'));module[_0xb282('0x8')]=function(_0x1dd19b,_0x3cad41){return _0x1dd19b[_0xb282('0x9')]('ZendeskConfiguration',attributes,{'tableName':'int_zendesk_configurations','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 f9873cb..a31f69e 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 _0xb9e0=['rpc','jayson/promise','client','http','request','info','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2e1e4a,_0x29d728){var _0xdae6d6=function(_0xfdf3c7){while(--_0xfdf3c7){_0x2e1e4a['push'](_0x2e1e4a['shift']());}};_0xdae6d6(++_0x29d728);}(_0xb9e0,0x197));var _0x0b9e=function(_0x30e0f5,_0x5e4826){_0x30e0f5=_0x30e0f5-0x0;var _0x3b5800=_0xb9e0[_0x30e0f5];return _0x3b5800;};'use strict';var _=require(_0x0b9e('0x0'));var util=require(_0x0b9e('0x1'));var moment=require(_0x0b9e('0x2'));var BPromise=require('bluebird');var rs=require(_0x0b9e('0x3'));var fs=require('fs');var Redis=require(_0x0b9e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b9e('0x5'));var logger=require(_0x0b9e('0x6'))(_0x0b9e('0x7'));var config=require('../../config/environment');var jayson=require(_0x0b9e('0x8'));var client=jayson[_0x0b9e('0x9')][_0x0b9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x594e6c,_0x32fc77,_0x52bc2d){return new BPromise(function(_0x311852,_0x4fe9e4){return client[_0x0b9e('0xb')](_0x594e6c,_0x52bc2d)['then'](function(_0x4fd3b6){logger[_0x0b9e('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x32fc77,'request\x20sent');logger[_0x0b9e('0xd')](_0x0b9e('0xe'),_0x32fc77,_0x0b9e('0xf'),JSON[_0x0b9e('0x10')](_0x4fd3b6));if(_0x4fd3b6[_0x0b9e('0x11')]){if(_0x4fd3b6[_0x0b9e('0x11')][_0x0b9e('0x12')]===0x1f4){logger[_0x0b9e('0x11')](_0x0b9e('0x13'),_0x32fc77,_0x4fd3b6['error'][_0x0b9e('0x14')]);return _0x4fe9e4(_0x4fd3b6[_0x0b9e('0x11')][_0x0b9e('0x14')]);}logger[_0x0b9e('0x11')](_0x0b9e('0x13'),_0x32fc77,_0x4fd3b6[_0x0b9e('0x11')]['message']);return _0x311852(_0x4fd3b6['error'][_0x0b9e('0x14')]);}else{logger[_0x0b9e('0xc')](_0x0b9e('0x13'),_0x32fc77,_0x0b9e('0xf'));_0x311852(_0x4fd3b6[_0x0b9e('0x15')]['message']);}})[_0x0b9e('0x16')](function(_0x366941){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x32fc77,_0x366941);_0x4fe9e4(_0x366941);});});} \ No newline at end of file +var _0x76ab=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','randomstring'];(function(_0x53a00d,_0x462437){var _0x28b7f6=function(_0x4f6ef3){while(--_0x4f6ef3){_0x53a00d['push'](_0x53a00d['shift']());}};_0x28b7f6(++_0x462437);}(_0x76ab,0xad));var _0xb76a=function(_0x44afa4,_0x5be27b){_0x44afa4=_0x44afa4-0x0;var _0xcad289=_0x76ab[_0x44afa4];return _0xcad289;};'use strict';var _=require('lodash');var util=require(_0xb76a('0x0'));var moment=require(_0xb76a('0x1'));var BPromise=require('bluebird');var rs=require(_0xb76a('0x2'));var fs=require('fs');var Redis=require(_0xb76a('0x3'));var db=require(_0xb76a('0x4'))['db'];var utils=require(_0xb76a('0x5'));var logger=require('../../config/logger')(_0xb76a('0x6'));var config=require(_0xb76a('0x7'));var jayson=require(_0xb76a('0x8'));var client=jayson['client'][_0xb76a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553553,_0x2e505f,_0x12b304){return new BPromise(function(_0x526bc2,_0x5676f4){return client[_0xb76a('0xa')](_0x553553,_0x12b304)[_0xb76a('0xb')](function(_0x1b1712){logger['info'](_0xb76a('0xc'),_0x2e505f,_0xb76a('0xd'));logger[_0xb76a('0xe')](_0xb76a('0xf'),_0x2e505f,_0xb76a('0xd'),JSON[_0xb76a('0x10')](_0x1b1712));if(_0x1b1712[_0xb76a('0x11')]){if(_0x1b1712['error'][_0xb76a('0x12')]===0x1f4){logger[_0xb76a('0x11')](_0xb76a('0xc'),_0x2e505f,_0x1b1712[_0xb76a('0x11')]['message']);return _0x5676f4(_0x1b1712[_0xb76a('0x11')][_0xb76a('0x13')]);}logger[_0xb76a('0x11')](_0xb76a('0xc'),_0x2e505f,_0x1b1712['error'][_0xb76a('0x13')]);return _0x526bc2(_0x1b1712[_0xb76a('0x11')][_0xb76a('0x13')]);}else{logger[_0xb76a('0x14')](_0xb76a('0xc'),_0x2e505f,_0xb76a('0xd'));_0x526bc2(_0x1b1712['result'][_0xb76a('0x13')]);}})[_0xb76a('0x15')](function(_0x1b4724){logger[_0xb76a('0x11')](_0xb76a('0xc'),_0x2e505f,_0x1b4724);_0x5676f4(_0x1b4724);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 12e48cf..47e15e5 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 _0x42b7=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','index','show','post','isAuthenticated','create','update','delete','/:id'];(function(_0x5bf3c8,_0x5c268b){var _0xf2a998=function(_0x24243d){while(--_0x24243d){_0x5bf3c8['push'](_0x5bf3c8['shift']());}};_0xf2a998(++_0x5c268b);}(_0x42b7,0x169));var _0x742b=function(_0x5d9bbd,_0x5193c0){_0x5d9bbd=_0x5d9bbd-0x0;var _0x3dded4=_0x42b7[_0x5d9bbd];return _0x3dded4;};'use strict';var multer=require(_0x742b('0x0'));var util=require(_0x742b('0x1'));var path=require(_0x742b('0x2'));var timeout=require(_0x742b('0x3'));var express=require(_0x742b('0x4'));var router=express[_0x742b('0x5')]();var fs_extra=require(_0x742b('0x6'));var auth=require(_0x742b('0x7'));var interaction=require(_0x742b('0x8'));var config=require('../../config/environment');var controller=require(_0x742b('0x9'));router[_0x742b('0xa')]('/',auth['isAuthenticated'](),controller[_0x742b('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x742b('0xc')]);router[_0x742b('0xd')]('/',auth[_0x742b('0xe')](),controller[_0x742b('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x742b('0x10')]);router[_0x742b('0x11')](_0x742b('0x12'),auth[_0x742b('0xe')](),controller['destroy']);module[_0x742b('0x13')]=router; \ No newline at end of file +var _0xf11b=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x5365ff,_0x14a8b0){var _0x50faf8=function(_0x76f9a9){while(--_0x76f9a9){_0x5365ff['push'](_0x5365ff['shift']());}};_0x50faf8(++_0x14a8b0);}(_0xf11b,0x1cc));var _0xbf11=function(_0x1cb3bd,_0x26d60f){_0x1cb3bd=_0x1cb3bd-0x0;var _0xe19894=_0xf11b[_0x1cb3bd];return _0xe19894;};'use strict';var multer=require(_0xbf11('0x0'));var util=require(_0xbf11('0x1'));var path=require(_0xbf11('0x2'));var timeout=require(_0xbf11('0x3'));var express=require(_0xbf11('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbf11('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbf11('0x6'));var controller=require(_0xbf11('0x7'));router[_0xbf11('0x8')]('/',auth[_0xbf11('0x9')](),controller['index']);router[_0xbf11('0x8')](_0xbf11('0xa'),auth[_0xbf11('0x9')](),controller[_0xbf11('0xb')]);router[_0xbf11('0xc')]('/',auth['isAuthenticated'](),controller[_0xbf11('0xd')]);router[_0xbf11('0xe')](_0xbf11('0xa'),auth[_0xbf11('0x9')](),controller[_0xbf11('0xf')]);router[_0xbf11('0x10')](_0xbf11('0xa'),auth[_0xbf11('0x9')](),controller[_0xbf11('0x11')]);module[_0xbf11('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 ce1a5ec..5fbc094 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 _0xac95=['string','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x1b91a3,_0xedfa3b){var _0x5d94ee=function(_0x46e41a){while(--_0x46e41a){_0x1b91a3['push'](_0x1b91a3['shift']());}};_0x5d94ee(++_0xedfa3b);}(_0xac95,0x10d));var _0x5ac9=function(_0x5031ec,_0x4fdf06){_0x5031ec=_0x5031ec-0x0;var _0x1f393e=_0xac95[_0x5031ec];return _0x1f393e;};'use strict';var Sequelize=require(_0x5ac9('0x0'));module[_0x5ac9('0x1')]={'type':{'type':Sequelize[_0x5ac9('0x2')](_0x5ac9('0x3'),'variable',_0x5ac9('0x4'),'keyValue',_0x5ac9('0x5')),'defaultValue':_0x5ac9('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5ac9('0x2')]('string','variable',_0x5ac9('0x4'))},'keyContent':{'type':Sequelize[_0x5ac9('0x6')]},'idField':{'type':Sequelize[_0x5ac9('0x6')]},'nameField':{'type':Sequelize[_0x5ac9('0x6')]},'customField':{'type':Sequelize[_0x5ac9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5ac9('0x6')]}}; \ No newline at end of file +var _0x4370=['sequelize','exports','string','variable','customVariable','picklist','STRING','ENUM','BOOLEAN'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x4370,0x129));var _0x0437=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x4370[_0x5447fd];return _0x15b28a;};'use strict';var Sequelize=require(_0x0437('0x0'));module[_0x0437('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0437('0x2'),_0x0437('0x3'),_0x0437('0x4'),'keyValue',_0x0437('0x5')),'defaultValue':_0x0437('0x2')},'content':{'type':Sequelize[_0x0437('0x6')]},'key':{'type':Sequelize[_0x0437('0x6')]},'keyType':{'type':Sequelize[_0x0437('0x7')](_0x0437('0x2'),_0x0437('0x3'),_0x0437('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0437('0x6')]},'nameField':{'type':Sequelize[_0x0437('0x6')]},'customField':{'type':Sequelize[_0x0437('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0437('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index a8e263b..0386c17 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 _0x0694=['send','index','ZendeskField','rawAttributes','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','create','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','then','destroy','name'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x0694,0x180));var _0x4069=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x0694[_0x2bf141];return _0x48277b;};'use strict';var emlformat=require(_0x4069('0x0'));var rimraf=require(_0x4069('0x1'));var zipdir=require(_0x4069('0x2'));var jsonpatch=require(_0x4069('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4069('0x4'));var util=require('util');var path=require(_0x4069('0x5'));var sox=require(_0x4069('0x6'));var csv=require(_0x4069('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4069('0x8'));var _=require(_0x4069('0x9'));var squel=require(_0x4069('0xa'));var crypto=require(_0x4069('0xb'));var jsforce=require(_0x4069('0xc'));var deskjs=require(_0x4069('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4069('0xe'));var Papa=require(_0x4069('0xf'));var Redis=require(_0x4069('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4069('0x11'))(_0x4069('0x12'));var utils=require(_0x4069('0x13'));var config=require(_0x4069('0x14'));var licenseUtil=require(_0x4069('0x15'));var db=require(_0x4069('0x16'))['db'];function respondWithStatusCode(_0x460c55,_0x20d449){_0x20d449=_0x20d449||0xcc;return function(_0x9e0372){if(_0x9e0372){return _0x460c55[_0x4069('0x17')](_0x20d449);}return _0x460c55[_0x4069('0x18')](_0x20d449)[_0x4069('0x19')]();};}function respondWithResult(_0x32bd0b,_0x150032){_0x150032=_0x150032||0xc8;return function(_0x5d7c95){if(_0x5d7c95){return _0x32bd0b['status'](_0x150032)[_0x4069('0x1a')](_0x5d7c95);}};}function respondWithFilteredResult(_0x165a09,_0x131bc6){return function(_0x21364e){if(_0x21364e){var _0x3ed24f=typeof _0x131bc6[_0x4069('0x1b')]===_0x4069('0x1c')&&typeof _0x131bc6[_0x4069('0x1d')]===_0x4069('0x1c');var _0x1eb85f=_0x21364e[_0x4069('0x1e')];var _0x28dc3b=_0x3ed24f?0x0:_0x131bc6['offset'];var _0x46031c=_0x3ed24f?_0x21364e[_0x4069('0x1e')]:_0x131bc6[_0x4069('0x1b')]+_0x131bc6[_0x4069('0x1d')];var _0x14de15;if(_0x46031c>=_0x1eb85f){_0x46031c=_0x1eb85f;_0x14de15=0xc8;}else{_0x14de15=0xce;}_0x165a09[_0x4069('0x18')](_0x14de15);return _0x165a09[_0x4069('0x1f')]('Content-Range',_0x28dc3b+'-'+_0x46031c+'/'+_0x1eb85f)[_0x4069('0x1a')](_0x21364e);}return null;};}function patchUpdates(_0x29d8fd){return function(_0x2fbc93){try{jsonpatch[_0x4069('0x20')](_0x2fbc93,_0x29d8fd,!![]);}catch(_0x10413b){return BPromise['reject'](_0x10413b);}return _0x2fbc93['save']();};}function saveUpdates(_0x5cbc87,_0x22eb0){return function(_0x59c357){if(_0x59c357){return _0x59c357['update'](_0x5cbc87)[_0x4069('0x21')](function(_0x6d587f){return _0x6d587f;});}return null;};}function removeEntity(_0x44982b,_0x15c4a0){return function(_0x3fddcf){if(_0x3fddcf){return _0x3fddcf[_0x4069('0x22')]()[_0x4069('0x21')](function(){_0x44982b[_0x4069('0x18')](0xcc)[_0x4069('0x19')]();});}};}function handleEntityNotFound(_0xaebdc5,_0x2f06e7){return function(_0x2bfa1e){if(!_0x2bfa1e){_0xaebdc5['sendStatus'](0x194);}return _0x2bfa1e;};}function handleError(_0x41b2e0,_0x1dce45){_0x1dce45=_0x1dce45||0x1f4;return function(_0x20ff3d){logger['error'](_0x20ff3d['stack']);if(_0x20ff3d[_0x4069('0x23')]){delete _0x20ff3d['name'];}_0x41b2e0[_0x4069('0x18')](_0x1dce45)[_0x4069('0x24')](_0x20ff3d);};}exports[_0x4069('0x25')]=function(_0x1ab698,_0x4c1ec4){var _0x185641={},_0x4db3ee={},_0x196ad3={'count':0x0,'rows':[]};var _0x3fd6f2=_['map'](db[_0x4069('0x26')][_0x4069('0x27')],function(_0x3eb031){return{'name':_0x3eb031['fieldName'],'type':_0x3eb031[_0x4069('0x28')][_0x4069('0x29')]};});_0x4db3ee['model']=_[_0x4069('0x2a')](_0x3fd6f2,_0x4069('0x23'));_0x4db3ee['query']=_[_0x4069('0x2b')](_0x1ab698[_0x4069('0x2c')]);_0x4db3ee[_0x4069('0x2d')]=_[_0x4069('0x2e')](_0x4db3ee[_0x4069('0x2f')],_0x4db3ee[_0x4069('0x2c')]);_0x185641[_0x4069('0x30')]=_['intersection'](_0x4db3ee['model'],qs[_0x4069('0x31')](_0x1ab698['query']['fields']));_0x185641[_0x4069('0x30')]=_0x185641[_0x4069('0x30')][_0x4069('0x32')]?_0x185641[_0x4069('0x30')]:_0x4db3ee[_0x4069('0x2f')];if(!_0x1ab698['query'][_0x4069('0x33')]('nolimit')){_0x185641['limit']=qs[_0x4069('0x1d')](_0x1ab698['query']['limit']);_0x185641['offset']=qs['offset'](_0x1ab698[_0x4069('0x2c')][_0x4069('0x1b')]);}_0x185641['order']=qs[_0x4069('0x34')](_0x1ab698['query'][_0x4069('0x34')]);_0x185641[_0x4069('0x35')]=qs['filters'](_[_0x4069('0x36')](_0x1ab698[_0x4069('0x2c')],_0x4db3ee['filters']),_0x3fd6f2);if(_0x1ab698[_0x4069('0x2c')][_0x4069('0x37')]){_0x185641[_0x4069('0x35')]=_['merge'](_0x185641[_0x4069('0x35')],{'$or':_['map'](_0x3fd6f2,function(_0x5d74e1){if(_0x5d74e1[_0x4069('0x28')]!==_0x4069('0x38')){var _0x4c7522={};_0x4c7522[_0x5d74e1[_0x4069('0x23')]]={'$like':'%'+_0x1ab698[_0x4069('0x2c')][_0x4069('0x37')]+'%'};return _0x4c7522;}})});}_0x185641=_[_0x4069('0x39')]({},_0x185641,_0x1ab698[_0x4069('0x3a')]);var _0x48b53a={'where':_0x185641[_0x4069('0x35')]};return db[_0x4069('0x26')][_0x4069('0x1e')](_0x48b53a)[_0x4069('0x21')](function(_0x581568){_0x196ad3[_0x4069('0x1e')]=_0x581568;if(_0x1ab698['query'][_0x4069('0x3b')]){_0x185641['include']=[{'all':!![]}];}return db['ZendeskField'][_0x4069('0x3c')](_0x185641);})[_0x4069('0x21')](function(_0x5dc0e2){_0x196ad3[_0x4069('0x3d')]=_0x5dc0e2;return _0x196ad3;})[_0x4069('0x21')](respondWithFilteredResult(_0x4c1ec4,_0x185641))[_0x4069('0x3e')](handleError(_0x4c1ec4,null));};exports[_0x4069('0x3f')]=function(_0x12fdf2,_0x30d16d){var _0x16312c={'raw':!![],'where':{'id':_0x12fdf2[_0x4069('0x40')]['id']}},_0xaf74b1={};_0xaf74b1[_0x4069('0x2f')]=_[_0x4069('0x2b')](db['ZendeskField'][_0x4069('0x27')]);_0xaf74b1[_0x4069('0x2c')]=_[_0x4069('0x2b')](_0x12fdf2['query']);_0xaf74b1[_0x4069('0x2d')]=_[_0x4069('0x2e')](_0xaf74b1['model'],_0xaf74b1['query']);_0x16312c[_0x4069('0x30')]=_['intersection'](_0xaf74b1[_0x4069('0x2f')],qs['fields'](_0x12fdf2[_0x4069('0x2c')][_0x4069('0x31')]));_0x16312c[_0x4069('0x30')]=_0x16312c[_0x4069('0x30')][_0x4069('0x32')]?_0x16312c[_0x4069('0x30')]:_0xaf74b1[_0x4069('0x2f')];if(_0x12fdf2[_0x4069('0x2c')][_0x4069('0x3b')]){_0x16312c[_0x4069('0x41')]=[{'all':!![]}];}_0x16312c=_[_0x4069('0x39')]({},_0x16312c,_0x12fdf2[_0x4069('0x3a')]);return db[_0x4069('0x26')]['find'](_0x16312c)[_0x4069('0x21')](handleEntityNotFound(_0x30d16d,null))[_0x4069('0x21')](respondWithResult(_0x30d16d,null))[_0x4069('0x3e')](handleError(_0x30d16d,null));};exports[_0x4069('0x42')]=function(_0x10ee17,_0x4b6253){return db[_0x4069('0x26')][_0x4069('0x42')](_0x10ee17['body'],{})[_0x4069('0x21')](respondWithResult(_0x4b6253,0xc9))[_0x4069('0x3e')](handleError(_0x4b6253,null));};exports[_0x4069('0x43')]=function(_0x56dbe4,_0x4d762e){if(_0x56dbe4['body']['id']){delete _0x56dbe4[_0x4069('0x44')]['id'];}return db[_0x4069('0x26')][_0x4069('0x45')]({'where':{'id':_0x56dbe4[_0x4069('0x40')]['id']}})[_0x4069('0x21')](handleEntityNotFound(_0x4d762e,null))[_0x4069('0x21')](saveUpdates(_0x56dbe4[_0x4069('0x44')],null))['then'](respondWithResult(_0x4d762e,null))[_0x4069('0x3e')](handleError(_0x4d762e,null));};exports[_0x4069('0x22')]=function(_0x5cfa77,_0x350004){return db['ZendeskField'][_0x4069('0x45')]({'where':{'id':_0x5cfa77[_0x4069('0x40')]['id']}})[_0x4069('0x21')](handleEntityNotFound(_0x350004,null))[_0x4069('0x21')](removeEntity(_0x350004,null))[_0x4069('0x3e')](handleError(_0x350004,null));}; \ No newline at end of file +var _0xa602=['order','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ZendeskField','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','nolimit'];(function(_0x71cd05,_0x36ac11){var _0x59c9e7=function(_0x5472cd){while(--_0x5472cd){_0x71cd05['push'](_0x71cd05['shift']());}};_0x59c9e7(++_0x36ac11);}(_0xa602,0x199));var _0x2a60=function(_0x40d08d,_0x369755){_0x40d08d=_0x40d08d-0x0;var _0x5f14d4=_0xa602[_0x40d08d];return _0x5f14d4;};'use strict';var emlformat=require(_0x2a60('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2a60('0x1'));var jsonpatch=require(_0x2a60('0x2'));var rp=require(_0x2a60('0x3'));var moment=require(_0x2a60('0x4'));var BPromise=require(_0x2a60('0x5'));var Mustache=require(_0x2a60('0x6'));var util=require(_0x2a60('0x7'));var path=require(_0x2a60('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2a60('0x9'));var fs=require('fs');var fs_extra=require(_0x2a60('0xa'));var _=require(_0x2a60('0xb'));var squel=require(_0x2a60('0xc'));var crypto=require('crypto');var jsforce=require(_0x2a60('0xd'));var deskjs=require(_0x2a60('0xe'));var toCsv=require(_0x2a60('0xf'));var querystring=require(_0x2a60('0x10'));var Papa=require(_0x2a60('0x11'));var Redis=require('ioredis');var authService=require(_0x2a60('0x12'));var qs=require(_0x2a60('0x13'));var as=require(_0x2a60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a60('0x15'))(_0x2a60('0x16'));var utils=require(_0x2a60('0x17'));var config=require(_0x2a60('0x18'));var licenseUtil=require(_0x2a60('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c1dd8,_0x547a03){_0x547a03=_0x547a03||0xcc;return function(_0x48941a){if(_0x48941a){return _0x1c1dd8[_0x2a60('0x1a')](_0x547a03);}return _0x1c1dd8[_0x2a60('0x1b')](_0x547a03)['end']();};}function respondWithResult(_0x426ade,_0x2cea82){_0x2cea82=_0x2cea82||0xc8;return function(_0xb0df4){if(_0xb0df4){return _0x426ade[_0x2a60('0x1b')](_0x2cea82)[_0x2a60('0x1c')](_0xb0df4);}};}function respondWithFilteredResult(_0x92168d,_0x3d18a6){return function(_0x30aeca){if(_0x30aeca){var _0x6160dc=typeof _0x3d18a6[_0x2a60('0x1d')]===_0x2a60('0x1e')&&typeof _0x3d18a6[_0x2a60('0x1f')]===_0x2a60('0x1e');var _0x1f471c=_0x30aeca['count'];var _0x2ebc7a=_0x6160dc?0x0:_0x3d18a6[_0x2a60('0x1d')];var _0xb92cd6=_0x6160dc?_0x30aeca[_0x2a60('0x20')]:_0x3d18a6['offset']+_0x3d18a6[_0x2a60('0x1f')];var _0x1e68bd;if(_0xb92cd6>=_0x1f471c){_0xb92cd6=_0x1f471c;_0x1e68bd=0xc8;}else{_0x1e68bd=0xce;}_0x92168d['status'](_0x1e68bd);return _0x92168d[_0x2a60('0x21')](_0x2a60('0x22'),_0x2ebc7a+'-'+_0xb92cd6+'/'+_0x1f471c)[_0x2a60('0x1c')](_0x30aeca);}return null;};}function patchUpdates(_0x4af89e){return function(_0x298c02){try{jsonpatch[_0x2a60('0x23')](_0x298c02,_0x4af89e,!![]);}catch(_0x3f336a){return BPromise[_0x2a60('0x24')](_0x3f336a);}return _0x298c02[_0x2a60('0x25')]();};}function saveUpdates(_0x4af1a6,_0xeb4611){return function(_0x14b950){if(_0x14b950){return _0x14b950[_0x2a60('0x26')](_0x4af1a6)[_0x2a60('0x27')](function(_0x47538f){return _0x47538f;});}return null;};}function removeEntity(_0x4e35d0,_0x57c498){return function(_0x92d29d){if(_0x92d29d){return _0x92d29d[_0x2a60('0x28')]()[_0x2a60('0x27')](function(){_0x4e35d0[_0x2a60('0x1b')](0xcc)[_0x2a60('0x29')]();});}};}function handleEntityNotFound(_0x567d58,_0x4f15cd){return function(_0x290152){if(!_0x290152){_0x567d58['sendStatus'](0x194);}return _0x290152;};}function handleError(_0x2f0596,_0x39a339){_0x39a339=_0x39a339||0x1f4;return function(_0x1772c4){logger[_0x2a60('0x2a')](_0x1772c4[_0x2a60('0x2b')]);if(_0x1772c4[_0x2a60('0x2c')]){delete _0x1772c4[_0x2a60('0x2c')];}_0x2f0596['status'](_0x39a339)[_0x2a60('0x2d')](_0x1772c4);};}exports[_0x2a60('0x2e')]=function(_0x56af3a,_0x48780d){var _0x4fb333={},_0x8cd799={},_0x57ffbe={'count':0x0,'rows':[]};var _0x336a24=_[_0x2a60('0x2f')](db[_0x2a60('0x30')][_0x2a60('0x31')],function(_0x252f45){return{'name':_0x252f45['fieldName'],'type':_0x252f45['type'][_0x2a60('0x32')]};});_0x8cd799[_0x2a60('0x33')]=_[_0x2a60('0x2f')](_0x336a24,_0x2a60('0x2c'));_0x8cd799['query']=_['keys'](_0x56af3a[_0x2a60('0x34')]);_0x8cd799[_0x2a60('0x35')]=_['intersection'](_0x8cd799['model'],_0x8cd799[_0x2a60('0x34')]);_0x4fb333['attributes']=_[_0x2a60('0x36')](_0x8cd799['model'],qs[_0x2a60('0x37')](_0x56af3a[_0x2a60('0x34')][_0x2a60('0x37')]));_0x4fb333[_0x2a60('0x38')]=_0x4fb333[_0x2a60('0x38')][_0x2a60('0x39')]?_0x4fb333[_0x2a60('0x38')]:_0x8cd799[_0x2a60('0x33')];if(!_0x56af3a[_0x2a60('0x34')]['hasOwnProperty'](_0x2a60('0x3a'))){_0x4fb333[_0x2a60('0x1f')]=qs[_0x2a60('0x1f')](_0x56af3a['query'][_0x2a60('0x1f')]);_0x4fb333['offset']=qs['offset'](_0x56af3a[_0x2a60('0x34')][_0x2a60('0x1d')]);}_0x4fb333[_0x2a60('0x3b')]=qs['sort'](_0x56af3a[_0x2a60('0x34')]['sort']);_0x4fb333['where']=qs['filters'](_[_0x2a60('0x3c')](_0x56af3a[_0x2a60('0x34')],_0x8cd799['filters']),_0x336a24);if(_0x56af3a[_0x2a60('0x34')][_0x2a60('0x3d')]){_0x4fb333[_0x2a60('0x3e')]=_[_0x2a60('0x3f')](_0x4fb333[_0x2a60('0x3e')],{'$or':_[_0x2a60('0x2f')](_0x336a24,function(_0x3dc125){if(_0x3dc125[_0x2a60('0x40')]!==_0x2a60('0x41')){var _0x334e2e={};_0x334e2e[_0x3dc125['name']]={'$like':'%'+_0x56af3a['query']['filter']+'%'};return _0x334e2e;}})});}_0x4fb333=_[_0x2a60('0x3f')]({},_0x4fb333,_0x56af3a[_0x2a60('0x42')]);var _0x4cfebe={'where':_0x4fb333[_0x2a60('0x3e')]};return db[_0x2a60('0x30')][_0x2a60('0x20')](_0x4cfebe)[_0x2a60('0x27')](function(_0xfbdcf2){_0x57ffbe[_0x2a60('0x20')]=_0xfbdcf2;if(_0x56af3a[_0x2a60('0x34')][_0x2a60('0x43')]){_0x4fb333[_0x2a60('0x44')]=[{'all':!![]}];}return db[_0x2a60('0x30')][_0x2a60('0x45')](_0x4fb333);})['then'](function(_0x215849){_0x57ffbe[_0x2a60('0x46')]=_0x215849;return _0x57ffbe;})[_0x2a60('0x27')](respondWithFilteredResult(_0x48780d,_0x4fb333))['catch'](handleError(_0x48780d,null));};exports[_0x2a60('0x47')]=function(_0x3e4610,_0xb2bd5e){var _0x130901={'raw':!![],'where':{'id':_0x3e4610[_0x2a60('0x48')]['id']}},_0x127b88={};_0x127b88[_0x2a60('0x33')]=_[_0x2a60('0x49')](db[_0x2a60('0x30')]['rawAttributes']);_0x127b88[_0x2a60('0x34')]=_['keys'](_0x3e4610[_0x2a60('0x34')]);_0x127b88['filters']=_['intersection'](_0x127b88[_0x2a60('0x33')],_0x127b88[_0x2a60('0x34')]);_0x130901[_0x2a60('0x38')]=_[_0x2a60('0x36')](_0x127b88['model'],qs[_0x2a60('0x37')](_0x3e4610[_0x2a60('0x34')][_0x2a60('0x37')]));_0x130901[_0x2a60('0x38')]=_0x130901[_0x2a60('0x38')][_0x2a60('0x39')]?_0x130901[_0x2a60('0x38')]:_0x127b88[_0x2a60('0x33')];if(_0x3e4610[_0x2a60('0x34')][_0x2a60('0x43')]){_0x130901[_0x2a60('0x44')]=[{'all':!![]}];}_0x130901=_['merge']({},_0x130901,_0x3e4610[_0x2a60('0x42')]);return db[_0x2a60('0x30')][_0x2a60('0x4a')](_0x130901)[_0x2a60('0x27')](handleEntityNotFound(_0xb2bd5e,null))[_0x2a60('0x27')](respondWithResult(_0xb2bd5e,null))[_0x2a60('0x4b')](handleError(_0xb2bd5e,null));};exports[_0x2a60('0x4c')]=function(_0x5cda16,_0x208a86){return db[_0x2a60('0x30')][_0x2a60('0x4c')](_0x5cda16[_0x2a60('0x4d')],{})[_0x2a60('0x27')](respondWithResult(_0x208a86,0xc9))['catch'](handleError(_0x208a86,null));};exports['update']=function(_0x5311b9,_0x4b3f40){if(_0x5311b9['body']['id']){delete _0x5311b9[_0x2a60('0x4d')]['id'];}return db[_0x2a60('0x30')]['find']({'where':{'id':_0x5311b9[_0x2a60('0x48')]['id']}})[_0x2a60('0x27')](handleEntityNotFound(_0x4b3f40,null))['then'](saveUpdates(_0x5311b9['body'],null))[_0x2a60('0x27')](respondWithResult(_0x4b3f40,null))[_0x2a60('0x4b')](handleError(_0x4b3f40,null));};exports[_0x2a60('0x28')]=function(_0x1d4584,_0x197bfb){return db[_0x2a60('0x30')]['find']({'where':{'id':_0x1d4584[_0x2a60('0x48')]['id']}})[_0x2a60('0x27')](handleEntityNotFound(_0x197bfb,null))['then'](removeEntity(_0x197bfb,null))[_0x2a60('0x4b')](handleError(_0x197bfb,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index c2fd25b..240a231 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 _0x566f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','zendesk_unique_index','idField','lodash','../../config/logger','api'];(function(_0xcaae48,_0x38a00d){var _0x578cb9=function(_0x84da9d){while(--_0x84da9d){_0xcaae48['push'](_0xcaae48['shift']());}};_0x578cb9(++_0x38a00d);}(_0x566f,0xb3));var _0xf566=function(_0x1c7674,_0x5db079){_0x1c7674=_0x1c7674-0x0;var _0x2e07ec=_0x566f[_0x1c7674];return _0x2e07ec;};'use strict';var _=require(_0xf566('0x0'));var util=require('util');var logger=require(_0xf566('0x1'))(_0xf566('0x2'));var moment=require(_0xf566('0x3'));var BPromise=require(_0xf566('0x4'));var rp=require(_0xf566('0x5'));var fs=require('fs');var path=require(_0xf566('0x6'));var rimraf=require(_0xf566('0x7'));var config=require(_0xf566('0x8'));var attributes=require(_0xf566('0x9'));module[_0xf566('0xa')]=function(_0x2df36a,_0x131173){return _0x2df36a['define']('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xf566('0xb'),'fields':[_0xf566('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ed7=['moment','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','int_zendesk_fields','FieldId','lodash','util','../../config/logger','api'];(function(_0x54c520,_0x1a2586){var _0x271766=function(_0x25af64){while(--_0x25af64){_0x54c520['push'](_0x54c520['shift']());}};_0x271766(++_0x1a2586);}(_0x0ed7,0x1bc));var _0x70ed=function(_0x56418e,_0x362812){_0x56418e=_0x56418e-0x0;var _0x5b160c=_0x0ed7[_0x56418e];return _0x5b160c;};'use strict';var _=require(_0x70ed('0x0'));var util=require(_0x70ed('0x1'));var logger=require(_0x70ed('0x2'))(_0x70ed('0x3'));var moment=require(_0x70ed('0x4'));var BPromise=require('bluebird');var rp=require(_0x70ed('0x5'));var fs=require('fs');var path=require(_0x70ed('0x6'));var rimraf=require(_0x70ed('0x7'));var config=require(_0x70ed('0x8'));var attributes=require(_0x70ed('0x9'));module[_0x70ed('0xa')]=function(_0x23ed97,_0x5e62a1){return _0x23ed97[_0x70ed('0xb')]('ZendeskField',attributes,{'tableName':_0x70ed('0xc'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':['idField',_0x70ed('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 16c6f26..037e95b 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 _0xc0f7=['request','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x286ec0,_0xad13c6){var _0xd22ce0=function(_0x2df37e){while(--_0x2df37e){_0x286ec0['push'](_0x286ec0['shift']());}};_0xd22ce0(++_0xad13c6);}(_0xc0f7,0x64));var _0x7c0f=function(_0x2784af,_0xb2b8cb){_0x2784af=_0x2784af-0x0;var _0x27b58c=_0xc0f7[_0x2784af];return _0x27b58c;};'use strict';var _=require(_0x7c0f('0x0'));var util=require(_0x7c0f('0x1'));var moment=require(_0x7c0f('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c0f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7c0f('0x4'))(_0x7c0f('0x5'));var config=require(_0x7c0f('0x6'));var jayson=require(_0x7c0f('0x7'));var client=jayson[_0x7c0f('0x8')][_0x7c0f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x220c53,_0x3334ed,_0x1b8234){return new BPromise(function(_0x58c72f,_0xae3500){return client[_0x7c0f('0xa')](_0x220c53,_0x1b8234)[_0x7c0f('0xb')](function(_0x2bc2f3){logger[_0x7c0f('0xc')]('ZendeskField,\x20%s,\x20%s',_0x3334ed,_0x7c0f('0xd'));logger[_0x7c0f('0xe')](_0x7c0f('0xf'),_0x3334ed,_0x7c0f('0xd'),JSON[_0x7c0f('0x10')](_0x2bc2f3));if(_0x2bc2f3['error']){if(_0x2bc2f3[_0x7c0f('0x11')][_0x7c0f('0x12')]===0x1f4){logger[_0x7c0f('0x11')](_0x7c0f('0x13'),_0x3334ed,_0x2bc2f3['error']['message']);return _0xae3500(_0x2bc2f3[_0x7c0f('0x11')][_0x7c0f('0x14')]);}logger[_0x7c0f('0x11')]('ZendeskField,\x20%s,\x20%s',_0x3334ed,_0x2bc2f3[_0x7c0f('0x11')]['message']);return _0x58c72f(_0x2bc2f3[_0x7c0f('0x11')][_0x7c0f('0x14')]);}else{logger[_0x7c0f('0xc')]('ZendeskField,\x20%s,\x20%s',_0x3334ed,_0x7c0f('0xd'));_0x58c72f(_0x2bc2f3['result'][_0x7c0f('0x14')]);}})[_0x7c0f('0x15')](function(_0x15b82f){logger['error'](_0x7c0f('0x13'),_0x3334ed,_0x15b82f);_0xae3500(_0x15b82f);});});} \ No newline at end of file +var _0xb2a9=['../../config/logger','rpc','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb2a9,0x130));var _0x9b2a=function(_0x533787,_0x4c136d){_0x533787=_0x533787-0x0;var _0x1f3619=_0xb2a9[_0x533787];return _0x1f3619;};'use strict';var _=require(_0x9b2a('0x0'));var util=require(_0x9b2a('0x1'));var moment=require(_0x9b2a('0x2'));var BPromise=require(_0x9b2a('0x3'));var rs=require(_0x9b2a('0x4'));var fs=require('fs');var Redis=require(_0x9b2a('0x5'));var db=require(_0x9b2a('0x6'))['db'];var utils=require(_0x9b2a('0x7'));var logger=require(_0x9b2a('0x8'))(_0x9b2a('0x9'));var config=require('../../config/environment');var jayson=require(_0x9b2a('0xa'));var client=jayson[_0x9b2a('0xb')][_0x9b2a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1efcbd,_0x186163,_0x3c4bb4){return new BPromise(function(_0x2e41e9,_0x4fe6b0){return client[_0x9b2a('0xd')](_0x1efcbd,_0x3c4bb4)[_0x9b2a('0xe')](function(_0xcf173e){logger['info'](_0x9b2a('0xf'),_0x186163,_0x9b2a('0x10'));logger[_0x9b2a('0x11')](_0x9b2a('0x12'),_0x186163,'request\x20sent',JSON[_0x9b2a('0x13')](_0xcf173e));if(_0xcf173e[_0x9b2a('0x14')]){if(_0xcf173e['error']['code']===0x1f4){logger['error'](_0x9b2a('0xf'),_0x186163,_0xcf173e[_0x9b2a('0x14')][_0x9b2a('0x15')]);return _0x4fe6b0(_0xcf173e[_0x9b2a('0x14')][_0x9b2a('0x15')]);}logger['error'](_0x9b2a('0xf'),_0x186163,_0xcf173e['error'][_0x9b2a('0x15')]);return _0x2e41e9(_0xcf173e[_0x9b2a('0x14')]['message']);}else{logger[_0x9b2a('0x16')](_0x9b2a('0xf'),_0x186163,_0x9b2a('0x10'));_0x2e41e9(_0xcf173e[_0x9b2a('0x17')][_0x9b2a('0x15')]);}})['catch'](function(_0xe479a){logger[_0x9b2a('0x14')]('ZendeskField,\x20%s,\x20%s',_0x186163,_0xe479a);_0x4fe6b0(_0xe479a);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 0341a23..965d57c 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 _0x582a=['../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','update','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x41d3c4,_0xd86678){var _0x2e90d5=function(_0x184308){while(--_0x184308){_0x41d3c4['push'](_0x41d3c4['shift']());}};_0x2e90d5(++_0xd86678);}(_0x582a,0xe1));var _0xa582=function(_0x2c1c86,_0xb5268b){_0x2c1c86=_0x2c1c86-0x0;var _0x127659=_0x582a[_0x2c1c86];return _0x127659;};'use strict';var multer=require(_0xa582('0x0'));var util=require(_0xa582('0x1'));var path=require(_0xa582('0x2'));var timeout=require(_0xa582('0x3'));var express=require(_0xa582('0x4'));var router=express['Router']();var fs_extra=require(_0xa582('0x5'));var auth=require(_0xa582('0x6'));var interaction=require(_0xa582('0x7'));var config=require('../../config/environment');var controller=require(_0xa582('0x8'));router['get']('/',auth[_0xa582('0x9')](),controller[_0xa582('0xa')]);router[_0xa582('0xb')](_0xa582('0xc'),auth[_0xa582('0x9')](),controller[_0xa582('0xd')]);router[_0xa582('0xb')](_0xa582('0xe'),auth[_0xa582('0x9')](),controller['getConfigurations']);router[_0xa582('0xb')](_0xa582('0xf'),auth[_0xa582('0x9')](),controller[_0xa582('0x10')]);router[_0xa582('0x11')]('/',auth[_0xa582('0x9')](),controller[_0xa582('0x12')]);router[_0xa582('0x11')](_0xa582('0xe'),auth[_0xa582('0x9')](),controller['addConfiguration']);router['put'](_0xa582('0xc'),auth[_0xa582('0x9')](),controller[_0xa582('0x13')]);router['delete'](_0xa582('0xc'),auth[_0xa582('0x9')](),controller[_0xa582('0x14')]);module['exports']=router; \ No newline at end of file +var _0x0f82=['getConfigurations','/:id/fields','getFields','post','create','destroy','exports','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x908bc3,_0x588c99){var _0xfd1da1=function(_0x350991){while(--_0x350991){_0x908bc3['push'](_0x908bc3['shift']());}};_0xfd1da1(++_0x588c99);}(_0x0f82,0x115));var _0x20f8=function(_0xfbac0b,_0x20b38b){_0xfbac0b=_0xfbac0b-0x0;var _0x14e054=_0x0f82[_0xfbac0b];return _0x14e054;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x20f8('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x20f8('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x20f8('0x2'));var config=require(_0x20f8('0x3'));var controller=require(_0x20f8('0x4'));router[_0x20f8('0x5')]('/',auth[_0x20f8('0x6')](),controller[_0x20f8('0x7')]);router[_0x20f8('0x5')](_0x20f8('0x8'),auth[_0x20f8('0x6')](),controller[_0x20f8('0x9')]);router['get'](_0x20f8('0xa'),auth[_0x20f8('0x6')](),controller[_0x20f8('0xb')]);router['get'](_0x20f8('0xc'),auth[_0x20f8('0x6')](),controller[_0x20f8('0xd')]);router[_0x20f8('0xe')]('/',auth[_0x20f8('0x6')](),controller[_0x20f8('0xf')]);router[_0x20f8('0xe')](_0x20f8('0xa'),auth[_0x20f8('0x6')](),controller['addConfiguration']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x20f8('0x6')](),controller[_0x20f8('0x10')]);module[_0x20f8('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 97b9159..993c74d 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 _0xb821=['STRING','exports'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xb821,0xa7));var _0x1b82=function(_0x4744b2,_0x31a62c){_0x4744b2=_0x4744b2-0x0;var _0x21a363=_0xb821[_0x4744b2];return _0x21a363;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'name':{'type':Sequelize[_0x1b82('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x1b82('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1b82('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x1b82('0x1')]},'refreshToken':{'type':Sequelize[_0x1b82('0x1')]}}; \ No newline at end of file +var _0x55e0=['STRING','sequelize','exports'];(function(_0x451980,_0x2ad060){var _0x3a66cf=function(_0x365204){while(--_0x365204){_0x451980['push'](_0x451980['shift']());}};_0x3a66cf(++_0x2ad060);}(_0x55e0,0xdc));var _0x055e=function(_0x531891,_0x7c890){_0x531891=_0x531891-0x0;var _0x526681=_0x55e0[_0x531891];return _0x526681;};'use strict';var Sequelize=require(_0x055e('0x0'));module[_0x055e('0x1')]={'name':{'type':Sequelize[_0x055e('0x2')]},'description':{'type':Sequelize[_0x055e('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x055e('0x2')]},'clientSecret':{'type':Sequelize[_0x055e('0x2')]},'serverUrl':{'type':Sequelize[_0x055e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x055e('0x2')]},'refreshToken':{'type':Sequelize[_0x055e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 663822a..29de95d 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 _0x00aa=['bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','type','key','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','options','ZohoAccount','include','catch','params','includeAll','create','body','getConfigurations','findOne','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','clientId','serverUrl','code','zoho.eu','slice','substring','lastIndexOf','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','Owner','Description','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x132162,_0x314bf2){var _0x421367=function(_0xa7bd6c){while(--_0xa7bd6c){_0x132162['push'](_0x132162['shift']());}};_0x421367(++_0x314bf2);}(_0x00aa,0x16a));var _0xa00a=function(_0x506d2f,_0x5ab76e){_0x506d2f=_0x506d2f-0x0;var _0x101255=_0x00aa[_0x506d2f];return _0x101255;};'use strict';var emlformat=require(_0xa00a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa00a('0x1'));var jsonpatch=require(_0xa00a('0x2'));var rp=require(_0xa00a('0x3'));var moment=require('moment');var BPromise=require(_0xa00a('0x4'));var Mustache=require(_0xa00a('0x5'));var util=require(_0xa00a('0x6'));var path=require(_0xa00a('0x7'));var sox=require(_0xa00a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa00a('0x9'));var _=require(_0xa00a('0xa'));var squel=require(_0xa00a('0xb'));var crypto=require(_0xa00a('0xc'));var jsforce=require(_0xa00a('0xd'));var deskjs=require(_0xa00a('0xe'));var toCsv=require(_0xa00a('0xf'));var querystring=require('querystring');var Papa=require(_0xa00a('0x10'));var Redis=require(_0xa00a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa00a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa00a('0x13'));var logger=require(_0xa00a('0x14'))(_0xa00a('0x15'));var utils=require('../../config/utils');var config=require(_0xa00a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa00a('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1eb9bb,_0x4fbded){_0x4fbded=_0x4fbded||0xcc;return function(_0x3cef03){if(_0x3cef03){return _0x1eb9bb['sendStatus'](_0x4fbded);}return _0x1eb9bb[_0xa00a('0x18')](_0x4fbded)[_0xa00a('0x19')]();};}function respondWithResult(_0x40adb7,_0x3e3e02){_0x3e3e02=_0x3e3e02||0xc8;return function(_0x486f3d){if(_0x486f3d){return _0x40adb7['status'](_0x3e3e02)[_0xa00a('0x1a')](_0x486f3d);}};}function respondWithFilteredResult(_0x7127bc,_0x3ec247){return function(_0x2e53ba){if(_0x2e53ba){var _0x516452=typeof _0x3ec247[_0xa00a('0x1b')]===_0xa00a('0x1c')&&typeof _0x3ec247[_0xa00a('0x1d')]===_0xa00a('0x1c');var _0x33df9b=_0x2e53ba[_0xa00a('0x1e')];var _0x1b69c1=_0x516452?0x0:_0x3ec247[_0xa00a('0x1b')];var _0x2b1b37=_0x516452?_0x2e53ba[_0xa00a('0x1e')]:_0x3ec247[_0xa00a('0x1b')]+_0x3ec247[_0xa00a('0x1d')];var _0x1a7b77;if(_0x2b1b37>=_0x33df9b){_0x2b1b37=_0x33df9b;_0x1a7b77=0xc8;}else{_0x1a7b77=0xce;}_0x7127bc['status'](_0x1a7b77);return _0x7127bc[_0xa00a('0x1f')]('Content-Range',_0x1b69c1+'-'+_0x2b1b37+'/'+_0x33df9b)['json'](_0x2e53ba);}return null;};}function patchUpdates(_0x44d1c4){return function(_0x4edab4){try{jsonpatch['apply'](_0x4edab4,_0x44d1c4,!![]);}catch(_0x3c98e6){return BPromise[_0xa00a('0x20')](_0x3c98e6);}return _0x4edab4[_0xa00a('0x21')]();};}function saveUpdates(_0x1f38f7,_0x16adca){return function(_0x1a16a9){if(_0x1a16a9){return _0x1a16a9[_0xa00a('0x22')](_0x1f38f7)[_0xa00a('0x23')](function(_0x5a2b02){return _0x5a2b02;});}return null;};}function removeEntity(_0x18b408,_0x1fd8e0){return function(_0x5b4c9d){if(_0x5b4c9d){return _0x5b4c9d[_0xa00a('0x24')]()[_0xa00a('0x23')](function(){_0x18b408['status'](0xcc)[_0xa00a('0x19')]();});}};}function handleEntityNotFound(_0x3cd266,_0x3c9186){return function(_0x1998ce){if(!_0x1998ce){_0x3cd266[_0xa00a('0x25')](0x194);}return _0x1998ce;};}function handleError(_0x35e7da,_0x3ff94e){_0x3ff94e=_0x3ff94e||0x1f4;return function(_0x387bb5){logger['error'](_0x387bb5[_0xa00a('0x26')]);if(_0x387bb5['name']){delete _0x387bb5[_0xa00a('0x27')];}_0x35e7da[_0xa00a('0x18')](_0x3ff94e)[_0xa00a('0x28')](_0x387bb5);};}exports[_0xa00a('0x29')]=function(_0x138921,_0x3a870a){var _0x4d58a6={},_0x5eff71={},_0x501b38={'count':0x0,'rows':[]};var _0x1deca9=_[_0xa00a('0x2a')](db['ZohoAccount']['rawAttributes'],function(_0x3f4596){return{'name':_0x3f4596['fieldName'],'type':_0x3f4596[_0xa00a('0x2b')][_0xa00a('0x2c')]};});_0x5eff71['model']=_[_0xa00a('0x2a')](_0x1deca9,_0xa00a('0x27'));_0x5eff71['query']=_[_0xa00a('0x2d')](_0x138921[_0xa00a('0x2e')]);_0x5eff71['filters']=_[_0xa00a('0x2f')](_0x5eff71[_0xa00a('0x30')],_0x5eff71[_0xa00a('0x2e')]);_0x4d58a6[_0xa00a('0x31')]=_[_0xa00a('0x2f')](_0x5eff71[_0xa00a('0x30')],qs['fields'](_0x138921[_0xa00a('0x2e')][_0xa00a('0x32')]));_0x4d58a6['attributes']=_0x4d58a6[_0xa00a('0x31')][_0xa00a('0x33')]?_0x4d58a6[_0xa00a('0x31')]:_0x5eff71[_0xa00a('0x30')];if(!_0x138921[_0xa00a('0x2e')]['hasOwnProperty'](_0xa00a('0x34'))){_0x4d58a6['limit']=qs[_0xa00a('0x1d')](_0x138921[_0xa00a('0x2e')]['limit']);_0x4d58a6[_0xa00a('0x1b')]=qs[_0xa00a('0x1b')](_0x138921[_0xa00a('0x2e')][_0xa00a('0x1b')]);}_0x4d58a6[_0xa00a('0x35')]=qs[_0xa00a('0x36')](_0x138921['query'][_0xa00a('0x36')]);_0x4d58a6[_0xa00a('0x37')]=qs['filters'](_['pick'](_0x138921[_0xa00a('0x2e')],_0x5eff71[_0xa00a('0x38')]),_0x1deca9);if(_0x138921['query'][_0xa00a('0x39')]){_0x4d58a6[_0xa00a('0x37')]=_['merge'](_0x4d58a6['where'],{'$or':_[_0xa00a('0x2a')](_0x1deca9,function(_0x51027e){if(_0x51027e[_0xa00a('0x2b')]!==_0xa00a('0x3a')){var _0x2ee08e={};_0x2ee08e[_0x51027e['name']]={'$like':'%'+_0x138921[_0xa00a('0x2e')][_0xa00a('0x39')]+'%'};return _0x2ee08e;}})});}_0x4d58a6=_['merge']({},_0x4d58a6,_0x138921[_0xa00a('0x3b')]);var _0x1eca53={'where':_0x4d58a6[_0xa00a('0x37')]};return db[_0xa00a('0x3c')]['count'](_0x1eca53)['then'](function(_0xc38656){_0x501b38[_0xa00a('0x1e')]=_0xc38656;if(_0x138921[_0xa00a('0x2e')]['includeAll']){_0x4d58a6[_0xa00a('0x3d')]=[{'all':!![]}];}return db[_0xa00a('0x3c')]['findAll'](_0x4d58a6);})[_0xa00a('0x23')](function(_0x99c68f){_0x501b38['rows']=_0x99c68f;return _0x501b38;})['then'](respondWithFilteredResult(_0x3a870a,_0x4d58a6))[_0xa00a('0x3e')](handleError(_0x3a870a,null));};exports['show']=function(_0x20db78,_0xe90c6b){var _0x2adcf9={'raw':![],'where':{'id':_0x20db78[_0xa00a('0x3f')]['id']}},_0x683d20={};_0x683d20[_0xa00a('0x30')]=_[_0xa00a('0x2d')](db[_0xa00a('0x3c')]['rawAttributes']);_0x683d20[_0xa00a('0x2e')]=_[_0xa00a('0x2d')](_0x20db78[_0xa00a('0x2e')]);_0x683d20[_0xa00a('0x38')]=_[_0xa00a('0x2f')](_0x683d20[_0xa00a('0x30')],_0x683d20[_0xa00a('0x2e')]);_0x2adcf9[_0xa00a('0x31')]=_[_0xa00a('0x2f')](_0x683d20[_0xa00a('0x30')],qs['fields'](_0x20db78[_0xa00a('0x2e')]['fields']));_0x2adcf9['attributes']=_0x2adcf9[_0xa00a('0x31')]['length']?_0x2adcf9[_0xa00a('0x31')]:_0x683d20[_0xa00a('0x30')];if(_0x20db78[_0xa00a('0x2e')][_0xa00a('0x40')]){_0x2adcf9[_0xa00a('0x3d')]=[{'all':!![]}];}_0x2adcf9=_['merge']({},_0x2adcf9,_0x20db78[_0xa00a('0x3b')]);return db[_0xa00a('0x3c')]['find'](_0x2adcf9)[_0xa00a('0x23')](handleEntityNotFound(_0xe90c6b,null))[_0xa00a('0x23')](respondWithResult(_0xe90c6b,null))[_0xa00a('0x3e')](handleError(_0xe90c6b,null));};exports[_0xa00a('0x41')]=function(_0x41b49b,_0xcad4ef){return db['ZohoAccount'][_0xa00a('0x41')](_0x41b49b[_0xa00a('0x42')],{})['then'](respondWithResult(_0xcad4ef,0xc9))[_0xa00a('0x3e')](handleError(_0xcad4ef,null));};exports[_0xa00a('0x22')]=function(_0x9a0847,_0x1ea44a){if(_0x9a0847['body']['id']){delete _0x9a0847['body']['id'];}return db[_0xa00a('0x3c')]['find']({'where':{'id':_0x9a0847['params']['id']}})[_0xa00a('0x23')](handleEntityNotFound(_0x1ea44a,null))[_0xa00a('0x23')](saveUpdates(_0x9a0847[_0xa00a('0x42')],null))['then'](respondWithResult(_0x1ea44a,null))[_0xa00a('0x3e')](handleError(_0x1ea44a,null));};exports[_0xa00a('0x24')]=function(_0x12d03b,_0x424068){return db[_0xa00a('0x3c')]['find']({'where':{'id':_0x12d03b[_0xa00a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x424068,null))[_0xa00a('0x23')](removeEntity(_0x424068,null))[_0xa00a('0x3e')](handleError(_0x424068,null));};exports[_0xa00a('0x43')]=function(_0x36975a,_0x1b49f1,_0x502113){var _0x2570a4={};var _0x38a624={};var _0x47183b;var _0xd2cd43;return db[_0xa00a('0x3c')][_0xa00a('0x44')]({'where':{'id':_0x36975a['params']['id']}})['then'](handleEntityNotFound(_0x1b49f1,null))['then'](function(_0x2e05d2){if(_0x2e05d2){_0x47183b=_0x2e05d2;_0x38a624['model']=_[_0xa00a('0x2d')](db['ZohoConfiguration']['rawAttributes']);_0x38a624[_0xa00a('0x2e')]=_[_0xa00a('0x2d')](_0x36975a[_0xa00a('0x2e')]);_0x38a624['filters']=_[_0xa00a('0x2f')](_0x38a624[_0xa00a('0x30')],_0x38a624[_0xa00a('0x2e')]);_0x2570a4[_0xa00a('0x31')]=_[_0xa00a('0x2f')](_0x38a624[_0xa00a('0x30')],qs[_0xa00a('0x32')](_0x36975a[_0xa00a('0x2e')][_0xa00a('0x32')]));_0x2570a4[_0xa00a('0x31')]=_0x2570a4[_0xa00a('0x31')][_0xa00a('0x33')]?_0x2570a4[_0xa00a('0x31')]:_0x38a624[_0xa00a('0x30')];_0x2570a4['order']=qs[_0xa00a('0x36')](_0x36975a[_0xa00a('0x2e')]['sort']);_0x2570a4[_0xa00a('0x37')]=qs[_0xa00a('0x38')](_[_0xa00a('0x45')](_0x36975a[_0xa00a('0x2e')],_0x38a624[_0xa00a('0x38')]));if(_0x36975a['query']['filter']){_0x2570a4[_0xa00a('0x37')]=_['merge'](_0x2570a4[_0xa00a('0x37')],{'$or':_[_0xa00a('0x2a')](_0x2570a4[_0xa00a('0x31')],function(_0x2aa453){var _0x3bbe5f={};_0x3bbe5f[_0x2aa453]={'$like':'%'+_0x36975a[_0xa00a('0x2e')][_0xa00a('0x39')]+'%'};return _0x3bbe5f;})});}_0x2570a4=_['merge']({},_0x2570a4,_0x36975a['options']);return _0x47183b['getConfigurations'](_0x2570a4);}})[_0xa00a('0x23')](function(_0x43c7d3){if(_0x43c7d3){_0xd2cd43=_0x43c7d3[_0xa00a('0x33')];if(!_0x36975a[_0xa00a('0x2e')][_0xa00a('0x46')]('nolimit')){_0x2570a4[_0xa00a('0x1d')]=qs[_0xa00a('0x1d')](_0x36975a[_0xa00a('0x2e')]['limit']);_0x2570a4[_0xa00a('0x1b')]=qs[_0xa00a('0x1b')](_0x36975a['query']['offset']);}return _0x47183b[_0xa00a('0x43')](_0x2570a4);}})[_0xa00a('0x23')](function(_0x30e8b7){if(_0x30e8b7){return _0x30e8b7?{'count':_0xd2cd43,'rows':_0x30e8b7}:null;}})[_0xa00a('0x23')](respondWithResult(_0x1b49f1,null))['catch'](handleError(_0x1b49f1,null));};exports[_0xa00a('0x47')]=function(_0x337eab,_0x6a8ccd,_0xd61d46){if(_0x337eab[_0xa00a('0x42')]['id']){delete _0x337eab[_0xa00a('0x42')]['id'];}return db[_0xa00a('0x3c')][_0xa00a('0x44')]({'where':{'id':_0x337eab[_0xa00a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x6a8ccd,null))[_0xa00a('0x23')](function(_0x496ac9){if(_0x496ac9){_0x337eab[_0xa00a('0x42')][_0xa00a('0x48')]=_0x496ac9['id'];_0x337eab[_0xa00a('0x42')][_0xa00a('0x49')]=integrations['getSubjects'](_0x337eab[_0xa00a('0x42')][_0xa00a('0x4a')],_0x337eab['body'][_0xa00a('0x2b')]);_0x337eab[_0xa00a('0x42')][_0xa00a('0x4b')]=integrations[_0xa00a('0x4c')](_0x337eab[_0xa00a('0x42')][_0xa00a('0x4a')],_0x337eab[_0xa00a('0x42')]['type']);return db[_0xa00a('0x4d')][_0xa00a('0x41')](_0x337eab['body'],{'include':[{'model':db[_0xa00a('0x4e')],'as':_0xa00a('0x49')},{'model':db[_0xa00a('0x4e')],'as':_0xa00a('0x4b')}]});}return null;})[_0xa00a('0x23')](respondWithResult(_0x6a8ccd,null))[_0xa00a('0x3e')](handleError(_0x6a8ccd,null));};function getAccessToken(_0x5cf8bb){return new Promise(function(_0x2c788a,_0x27f3d4){var _0xae546a;switch(_0x5cf8bb['zone']){case'US':_0xae546a='https://accounts.zoho.com';break;case'AU':_0xae546a=_0xa00a('0x4f');break;case'EU':_0xae546a=_0xa00a('0x50');break;case'IN':_0xae546a='https://accounts.zoho.in';break;case'CN':_0xae546a='https://accounts.zoho.com.cn';break;default:_0xae546a=_0xa00a('0x50');break;}var _0x3f917e={'method':_0xa00a('0x51'),'uri':_0xae546a+_0xa00a('0x52'),'qs':{'refresh_token':_0x5cf8bb[_0xa00a('0x53')],'client_id':_0x5cf8bb['clientId'],'client_secret':_0x5cf8bb[_0xa00a('0x54')],'grant_type':_0xa00a('0x55')},'json':!![]};return rp(_0x3f917e)[_0xa00a('0x23')](function(_0x1f54bc){if(_0x1f54bc[_0xa00a('0x56')]){_0x2c788a(_0x1f54bc[_0xa00a('0x56')]);}else{_0x27f3d4(_0xa00a('0x57'));}})[_0xa00a('0x3e')](function(_0x1ee92c){_0x27f3d4(_0x1ee92c);});});}exports[_0xa00a('0x58')]=function(_0x2c8c5c,_0x58fa22,_0x17cdba){var _0x3aadf4,_0x207664,_0x2e4ac5,_0x1a3368,_0x5570c4;return db[_0xa00a('0x3c')][_0xa00a('0x44')]({'where':{'id':_0x2c8c5c[_0xa00a('0x3f')]['id']},'attributes':['id',_0xa00a('0x59'),_0xa00a('0x5a'),_0xa00a('0x5b'),_0xa00a('0x54'),_0xa00a('0x5c'),_0xa00a('0x5d'),'refreshToken']})[_0xa00a('0x23')](handleEntityNotFound(_0x58fa22,null))[_0xa00a('0x23')](function(_0x31340c){_0x5570c4=_0x31340c;_0x3aadf4=_0x5570c4['host'];_0x207664=_0x3aadf4===_0xa00a('0x5e')?'eu':'com';_0x2e4ac5=_0x5570c4[_0xa00a('0x5c')];var _0x22c71c=_0x2e4ac5[_0xa00a('0x5f')](-0x1);if(_0x22c71c==='/'||_0x22c71c==='\x5c'||_0x22c71c===':'){_0x2e4ac5=_0x2e4ac5[_0xa00a('0x60')](0x0,_0x2e4ac5[_0xa00a('0x61')](_0x22c71c));}if(!_0x5570c4[_0xa00a('0x53')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x5570c4);})[_0xa00a('0x23')](function(_0x24e6be){if(_0x24e6be){return rp({'method':'GET','uri':util[_0xa00a('0x62')](_0xa00a('0x63'),_0x207664),'qs':{'module':_0xa00a('0x64')},'headers':{'Authorization':_0xa00a('0x65')+_0x24e6be},'json':!![]});}})[_0xa00a('0x23')](function(_0x37d969){if(_0x37d969){if(_0x37d969[_0xa00a('0x66')]&&_0x37d969[_0xa00a('0x66')][_0xa00a('0x67')]){throw new Error(_0x37d969[_0xa00a('0x66')][_0xa00a('0x67')]['message']);}var _0x14d65b=[];var _0x26d481=[];var _0x1a7889=[_0xa00a('0x68'),'Subject',_0xa00a('0x69'),'WhoId','Call_Duration',_0xa00a('0x6a'),_0xa00a('0x6b'),'Call_Type'];_0x26d481=_[_0xa00a('0x6c')](_0x37d969[_0xa00a('0x32')],function(_0x3e3489){return _0x1a7889[_0xa00a('0x6d')](_0x3e3489[_0xa00a('0x6e')]);});for(var _0x120f34=0x0;_0x120f34<_0x26d481[_0xa00a('0x33')];_0x120f34++){if(_0x26d481[_0x120f34][_0xa00a('0x6f')]===![]){_0x14d65b[_0xa00a('0x70')]({'id':_0x26d481[_0x120f34]['id'],'name':_0x26d481[_0x120f34][_0xa00a('0x71')],'custom':_0x26d481[_0x120f34][_0xa00a('0x72')],'options':_0x26d481[_0x120f34][_0xa00a('0x73')]==='picklist'&&_0x26d481[_0x120f34][_0xa00a('0x74')][_0xa00a('0x33')]>-0x1?_[_0xa00a('0x2a')](_0x26d481[_0x120f34][_0xa00a('0x74')],function(_0x3588b0){return{'name':_0x3588b0,'value':_0x3588b0};}):[]});}}return{'count':_0x14d65b['length'],'rows':_0x14d65b};}else{return{'count':0x0,'rows':[]};}})[_0xa00a('0x23')](respondWithResult(_0x58fa22,null))['catch'](function(_0x28dec3){var _0x5d070c=_0x2c8c5c[_0xa00a('0x2e')][_0xa00a('0x75')]?0x1f4:_0x28dec3[_0xa00a('0x76')]||0x1f4;logger['error'](_0xa00a('0x77'),_0xa00a('0x58'),_0x5d070c,JSON[_0xa00a('0x78')](_0x28dec3));delete _0x28dec3[_0xa00a('0x27')];if(_0x5d070c===0x191){_0x5d070c=0x190;}_0x58fa22[_0xa00a('0x18')](_0x5d070c)[_0xa00a('0x28')](_0x2c8c5c[_0xa00a('0x2e')][_0xa00a('0x75')]?{'message':_0xa00a('0x79'),'statusCode':_0x28dec3[_0xa00a('0x76')]}:_0x28dec3);});}; \ No newline at end of file +var _0x6e0a=['params','merge','find','create','body','findOne','ZohoConfiguration','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','refreshToken','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','then','error','send','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','name','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x6e0a,0x142));var _0xa6e0=function(_0xee1b2e,_0x34f7bd){_0xee1b2e=_0xee1b2e-0x0;var _0x5bf13c=_0x6e0a[_0xee1b2e];return _0x5bf13c;};'use strict';var emlformat=require(_0xa6e0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa6e0('0x1'));var jsonpatch=require(_0xa6e0('0x2'));var rp=require(_0xa6e0('0x3'));var moment=require(_0xa6e0('0x4'));var BPromise=require(_0xa6e0('0x5'));var Mustache=require(_0xa6e0('0x6'));var util=require('util');var path=require(_0xa6e0('0x7'));var sox=require(_0xa6e0('0x8'));var csv=require('to-csv');var ejs=require(_0xa6e0('0x9'));var fs=require('fs');var fs_extra=require(_0xa6e0('0xa'));var _=require('lodash');var squel=require(_0xa6e0('0xb'));var crypto=require(_0xa6e0('0xc'));var jsforce=require(_0xa6e0('0xd'));var deskjs=require(_0xa6e0('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa6e0('0xf'));var Papa=require(_0xa6e0('0x10'));var Redis=require(_0xa6e0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa6e0('0x12'));var as=require(_0xa6e0('0x13'));var hardwareService=require(_0xa6e0('0x14'));var logger=require(_0xa6e0('0x15'))(_0xa6e0('0x16'));var utils=require(_0xa6e0('0x17'));var config=require(_0xa6e0('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa6e0('0x19'))['db'];var integrations=require(_0xa6e0('0x1a'));function respondWithStatusCode(_0x532a97,_0x3962f8){_0x3962f8=_0x3962f8||0xcc;return function(_0x21750a){if(_0x21750a){return _0x532a97[_0xa6e0('0x1b')](_0x3962f8);}return _0x532a97['status'](_0x3962f8)[_0xa6e0('0x1c')]();};}function respondWithResult(_0x3ae7b6,_0x2c2a9e){_0x2c2a9e=_0x2c2a9e||0xc8;return function(_0x489068){if(_0x489068){return _0x3ae7b6[_0xa6e0('0x1d')](_0x2c2a9e)[_0xa6e0('0x1e')](_0x489068);}};}function respondWithFilteredResult(_0x29ac33,_0x3efe95){return function(_0x528681){if(_0x528681){var _0x23298b=typeof _0x3efe95['offset']===_0xa6e0('0x1f')&&typeof _0x3efe95[_0xa6e0('0x20')]===_0xa6e0('0x1f');var _0x56aca1=_0x528681[_0xa6e0('0x21')];var _0xa50e90=_0x23298b?0x0:_0x3efe95[_0xa6e0('0x22')];var _0x85eb9b=_0x23298b?_0x528681[_0xa6e0('0x21')]:_0x3efe95[_0xa6e0('0x22')]+_0x3efe95[_0xa6e0('0x20')];var _0x54122b;if(_0x85eb9b>=_0x56aca1){_0x85eb9b=_0x56aca1;_0x54122b=0xc8;}else{_0x54122b=0xce;}_0x29ac33[_0xa6e0('0x1d')](_0x54122b);return _0x29ac33[_0xa6e0('0x23')](_0xa6e0('0x24'),_0xa50e90+'-'+_0x85eb9b+'/'+_0x56aca1)[_0xa6e0('0x1e')](_0x528681);}return null;};}function patchUpdates(_0x29923e){return function(_0x3135fe){try{jsonpatch['apply'](_0x3135fe,_0x29923e,!![]);}catch(_0x1a3bde){return BPromise['reject'](_0x1a3bde);}return _0x3135fe[_0xa6e0('0x25')]();};}function saveUpdates(_0x10652d,_0x2e0581){return function(_0x287949){if(_0x287949){return _0x287949[_0xa6e0('0x26')](_0x10652d)['then'](function(_0x4ab670){return _0x4ab670;});}return null;};}function removeEntity(_0x2dc395,_0x491e1c){return function(_0x6ea347){if(_0x6ea347){return _0x6ea347[_0xa6e0('0x27')]()[_0xa6e0('0x28')](function(){_0x2dc395[_0xa6e0('0x1d')](0xcc)[_0xa6e0('0x1c')]();});}};}function handleEntityNotFound(_0x5b090e,_0x1b2e6c){return function(_0x349f76){if(!_0x349f76){_0x5b090e[_0xa6e0('0x1b')](0x194);}return _0x349f76;};}function handleError(_0x5e2598,_0x28b4d5){_0x28b4d5=_0x28b4d5||0x1f4;return function(_0xf3512d){logger[_0xa6e0('0x29')](_0xf3512d['stack']);if(_0xf3512d['name']){delete _0xf3512d['name'];}_0x5e2598[_0xa6e0('0x1d')](_0x28b4d5)[_0xa6e0('0x2a')](_0xf3512d);};}exports[_0xa6e0('0x2b')]=function(_0x3debdb,_0x48081b){var _0x1078dc={},_0x31bb61={},_0x2f6c46={'count':0x0,'rows':[]};var _0x3a40aa=_['map'](db[_0xa6e0('0x2c')][_0xa6e0('0x2d')],function(_0x46ff4d){return{'name':_0x46ff4d[_0xa6e0('0x2e')],'type':_0x46ff4d[_0xa6e0('0x2f')][_0xa6e0('0x30')]};});_0x31bb61[_0xa6e0('0x31')]=_[_0xa6e0('0x32')](_0x3a40aa,_0xa6e0('0x33'));_0x31bb61['query']=_[_0xa6e0('0x34')](_0x3debdb['query']);_0x31bb61[_0xa6e0('0x35')]=_[_0xa6e0('0x36')](_0x31bb61[_0xa6e0('0x31')],_0x31bb61[_0xa6e0('0x37')]);_0x1078dc['attributes']=_[_0xa6e0('0x36')](_0x31bb61[_0xa6e0('0x31')],qs['fields'](_0x3debdb[_0xa6e0('0x37')][_0xa6e0('0x38')]));_0x1078dc[_0xa6e0('0x39')]=_0x1078dc[_0xa6e0('0x39')][_0xa6e0('0x3a')]?_0x1078dc[_0xa6e0('0x39')]:_0x31bb61[_0xa6e0('0x31')];if(!_0x3debdb['query'][_0xa6e0('0x3b')]('nolimit')){_0x1078dc[_0xa6e0('0x20')]=qs['limit'](_0x3debdb['query']['limit']);_0x1078dc['offset']=qs['offset'](_0x3debdb[_0xa6e0('0x37')][_0xa6e0('0x22')]);}_0x1078dc[_0xa6e0('0x3c')]=qs[_0xa6e0('0x3d')](_0x3debdb[_0xa6e0('0x37')][_0xa6e0('0x3d')]);_0x1078dc[_0xa6e0('0x3e')]=qs[_0xa6e0('0x35')](_[_0xa6e0('0x3f')](_0x3debdb['query'],_0x31bb61[_0xa6e0('0x35')]),_0x3a40aa);if(_0x3debdb['query'][_0xa6e0('0x40')]){_0x1078dc[_0xa6e0('0x3e')]=_['merge'](_0x1078dc[_0xa6e0('0x3e')],{'$or':_[_0xa6e0('0x32')](_0x3a40aa,function(_0x9fb72d){if(_0x9fb72d[_0xa6e0('0x2f')]!==_0xa6e0('0x41')){var _0x4ffdbe={};_0x4ffdbe[_0x9fb72d[_0xa6e0('0x33')]]={'$like':'%'+_0x3debdb[_0xa6e0('0x37')][_0xa6e0('0x40')]+'%'};return _0x4ffdbe;}})});}_0x1078dc=_['merge']({},_0x1078dc,_0x3debdb[_0xa6e0('0x42')]);var _0x3d5fd3={'where':_0x1078dc['where']};return db[_0xa6e0('0x2c')]['count'](_0x3d5fd3)[_0xa6e0('0x28')](function(_0x1402c0){_0x2f6c46[_0xa6e0('0x21')]=_0x1402c0;if(_0x3debdb[_0xa6e0('0x37')][_0xa6e0('0x43')]){_0x1078dc[_0xa6e0('0x44')]=[{'all':!![]}];}return db[_0xa6e0('0x2c')][_0xa6e0('0x45')](_0x1078dc);})[_0xa6e0('0x28')](function(_0xebc49b){_0x2f6c46['rows']=_0xebc49b;return _0x2f6c46;})[_0xa6e0('0x28')](respondWithFilteredResult(_0x48081b,_0x1078dc))[_0xa6e0('0x46')](handleError(_0x48081b,null));};exports['show']=function(_0x1d16e8,_0x218f57){var _0x318aac={'raw':![],'where':{'id':_0x1d16e8[_0xa6e0('0x47')]['id']}},_0x25cf7b={};_0x25cf7b[_0xa6e0('0x31')]=_[_0xa6e0('0x34')](db[_0xa6e0('0x2c')]['rawAttributes']);_0x25cf7b['query']=_['keys'](_0x1d16e8['query']);_0x25cf7b[_0xa6e0('0x35')]=_[_0xa6e0('0x36')](_0x25cf7b[_0xa6e0('0x31')],_0x25cf7b['query']);_0x318aac[_0xa6e0('0x39')]=_[_0xa6e0('0x36')](_0x25cf7b['model'],qs[_0xa6e0('0x38')](_0x1d16e8['query'][_0xa6e0('0x38')]));_0x318aac[_0xa6e0('0x39')]=_0x318aac[_0xa6e0('0x39')]['length']?_0x318aac[_0xa6e0('0x39')]:_0x25cf7b[_0xa6e0('0x31')];if(_0x1d16e8[_0xa6e0('0x37')][_0xa6e0('0x43')]){_0x318aac[_0xa6e0('0x44')]=[{'all':!![]}];}_0x318aac=_[_0xa6e0('0x48')]({},_0x318aac,_0x1d16e8['options']);return db[_0xa6e0('0x2c')][_0xa6e0('0x49')](_0x318aac)[_0xa6e0('0x28')](handleEntityNotFound(_0x218f57,null))[_0xa6e0('0x28')](respondWithResult(_0x218f57,null))[_0xa6e0('0x46')](handleError(_0x218f57,null));};exports['create']=function(_0x1998eb,_0x1e126a){return db[_0xa6e0('0x2c')][_0xa6e0('0x4a')](_0x1998eb[_0xa6e0('0x4b')],{})[_0xa6e0('0x28')](respondWithResult(_0x1e126a,0xc9))[_0xa6e0('0x46')](handleError(_0x1e126a,null));};exports[_0xa6e0('0x26')]=function(_0x3d44a6,_0x4d0a50){if(_0x3d44a6[_0xa6e0('0x4b')]['id']){delete _0x3d44a6[_0xa6e0('0x4b')]['id'];}return db[_0xa6e0('0x2c')][_0xa6e0('0x49')]({'where':{'id':_0x3d44a6['params']['id']}})[_0xa6e0('0x28')](handleEntityNotFound(_0x4d0a50,null))[_0xa6e0('0x28')](saveUpdates(_0x3d44a6[_0xa6e0('0x4b')],null))[_0xa6e0('0x28')](respondWithResult(_0x4d0a50,null))[_0xa6e0('0x46')](handleError(_0x4d0a50,null));};exports[_0xa6e0('0x27')]=function(_0x14688e,_0x48e059){return db[_0xa6e0('0x2c')]['find']({'where':{'id':_0x14688e[_0xa6e0('0x47')]['id']}})[_0xa6e0('0x28')](handleEntityNotFound(_0x48e059,null))[_0xa6e0('0x28')](removeEntity(_0x48e059,null))[_0xa6e0('0x46')](handleError(_0x48e059,null));};exports['getConfigurations']=function(_0x435645,_0x248ae6,_0x1d1fc4){var _0x26dfe1={};var _0x41277a={};var _0x2d060c;var _0x125a35;return db[_0xa6e0('0x2c')][_0xa6e0('0x4c')]({'where':{'id':_0x435645[_0xa6e0('0x47')]['id']}})[_0xa6e0('0x28')](handleEntityNotFound(_0x248ae6,null))[_0xa6e0('0x28')](function(_0x4e46df){if(_0x4e46df){_0x2d060c=_0x4e46df;_0x41277a['model']=_[_0xa6e0('0x34')](db[_0xa6e0('0x4d')][_0xa6e0('0x2d')]);_0x41277a[_0xa6e0('0x37')]=_['keys'](_0x435645[_0xa6e0('0x37')]);_0x41277a['filters']=_[_0xa6e0('0x36')](_0x41277a[_0xa6e0('0x31')],_0x41277a[_0xa6e0('0x37')]);_0x26dfe1[_0xa6e0('0x39')]=_['intersection'](_0x41277a[_0xa6e0('0x31')],qs[_0xa6e0('0x38')](_0x435645[_0xa6e0('0x37')][_0xa6e0('0x38')]));_0x26dfe1[_0xa6e0('0x39')]=_0x26dfe1['attributes']['length']?_0x26dfe1[_0xa6e0('0x39')]:_0x41277a[_0xa6e0('0x31')];_0x26dfe1[_0xa6e0('0x3c')]=qs[_0xa6e0('0x3d')](_0x435645[_0xa6e0('0x37')][_0xa6e0('0x3d')]);_0x26dfe1['where']=qs['filters'](_[_0xa6e0('0x3f')](_0x435645[_0xa6e0('0x37')],_0x41277a[_0xa6e0('0x35')]));if(_0x435645['query']['filter']){_0x26dfe1[_0xa6e0('0x3e')]=_[_0xa6e0('0x48')](_0x26dfe1[_0xa6e0('0x3e')],{'$or':_[_0xa6e0('0x32')](_0x26dfe1[_0xa6e0('0x39')],function(_0x129894){var _0x5e27a8={};_0x5e27a8[_0x129894]={'$like':'%'+_0x435645[_0xa6e0('0x37')][_0xa6e0('0x40')]+'%'};return _0x5e27a8;})});}_0x26dfe1=_[_0xa6e0('0x48')]({},_0x26dfe1,_0x435645[_0xa6e0('0x42')]);return _0x2d060c[_0xa6e0('0x4e')](_0x26dfe1);}})[_0xa6e0('0x28')](function(_0x5ec1a9){if(_0x5ec1a9){_0x125a35=_0x5ec1a9[_0xa6e0('0x3a')];if(!_0x435645[_0xa6e0('0x37')][_0xa6e0('0x3b')]('nolimit')){_0x26dfe1[_0xa6e0('0x20')]=qs['limit'](_0x435645[_0xa6e0('0x37')][_0xa6e0('0x20')]);_0x26dfe1['offset']=qs[_0xa6e0('0x22')](_0x435645[_0xa6e0('0x37')][_0xa6e0('0x22')]);}return _0x2d060c[_0xa6e0('0x4e')](_0x26dfe1);}})['then'](function(_0x4ee53){if(_0x4ee53){return _0x4ee53?{'count':_0x125a35,'rows':_0x4ee53}:null;}})[_0xa6e0('0x28')](respondWithResult(_0x248ae6,null))['catch'](handleError(_0x248ae6,null));};exports['addConfiguration']=function(_0x464f38,_0x2723ee,_0x10c7a1){if(_0x464f38[_0xa6e0('0x4b')]['id']){delete _0x464f38[_0xa6e0('0x4b')]['id'];}return db[_0xa6e0('0x2c')][_0xa6e0('0x4c')]({'where':{'id':_0x464f38[_0xa6e0('0x47')]['id']}})[_0xa6e0('0x28')](handleEntityNotFound(_0x2723ee,null))[_0xa6e0('0x28')](function(_0x3d96a0){if(_0x3d96a0){_0x464f38[_0xa6e0('0x4b')][_0xa6e0('0x4f')]=_0x3d96a0['id'];_0x464f38[_0xa6e0('0x4b')][_0xa6e0('0x50')]=integrations[_0xa6e0('0x51')](_0x464f38[_0xa6e0('0x4b')][_0xa6e0('0x52')],_0x464f38[_0xa6e0('0x4b')][_0xa6e0('0x2f')]);_0x464f38[_0xa6e0('0x4b')][_0xa6e0('0x53')]=integrations[_0xa6e0('0x54')](_0x464f38[_0xa6e0('0x4b')][_0xa6e0('0x52')],_0x464f38[_0xa6e0('0x4b')][_0xa6e0('0x2f')]);return db[_0xa6e0('0x4d')][_0xa6e0('0x4a')](_0x464f38[_0xa6e0('0x4b')],{'include':[{'model':db[_0xa6e0('0x55')],'as':_0xa6e0('0x50')},{'model':db['ZohoField'],'as':_0xa6e0('0x53')}]});}return null;})[_0xa6e0('0x28')](respondWithResult(_0x2723ee,null))[_0xa6e0('0x46')](handleError(_0x2723ee,null));};function getAccessToken(_0x5c0fc7){return new Promise(function(_0x3a03fc,_0x10e5b2){var _0x52b63c;switch(_0x5c0fc7[_0xa6e0('0x56')]){case'US':_0x52b63c=_0xa6e0('0x57');break;case'AU':_0x52b63c=_0xa6e0('0x58');break;case'EU':_0x52b63c=_0xa6e0('0x59');break;case'IN':_0x52b63c=_0xa6e0('0x5a');break;case'CN':_0x52b63c='https://accounts.zoho.com.cn';break;default:_0x52b63c=_0xa6e0('0x59');break;}var _0x1e90c2={'method':_0xa6e0('0x5b'),'uri':_0x52b63c+'/oauth/v2/token','qs':{'refresh_token':_0x5c0fc7['refreshToken'],'client_id':_0x5c0fc7[_0xa6e0('0x5c')],'client_secret':_0x5c0fc7[_0xa6e0('0x5d')],'grant_type':_0xa6e0('0x5e')},'json':!![]};return rp(_0x1e90c2)[_0xa6e0('0x28')](function(_0x26ee75){if(_0x26ee75[_0xa6e0('0x5f')]){_0x3a03fc(_0x26ee75[_0xa6e0('0x5f')]);}else{_0x10e5b2(_0xa6e0('0x60'));}})['catch'](function(_0x5c6730){_0x10e5b2(_0x5c6730);});});}exports[_0xa6e0('0x61')]=function(_0x2daf7e,_0x3aac13,_0xeb0ae6){var _0x1774ab,_0x2c9c8e,_0xdccee9,_0x592e50,_0x237782;return db['ZohoAccount'][_0xa6e0('0x4c')]({'where':{'id':_0x2daf7e['params']['id']},'attributes':['id',_0xa6e0('0x62'),_0xa6e0('0x56'),_0xa6e0('0x5c'),_0xa6e0('0x5d'),_0xa6e0('0x63'),_0xa6e0('0x64'),_0xa6e0('0x65')]})[_0xa6e0('0x28')](handleEntityNotFound(_0x3aac13,null))[_0xa6e0('0x28')](function(_0x6f7336){_0x237782=_0x6f7336;_0x1774ab=_0x237782[_0xa6e0('0x62')];_0x2c9c8e=_0x1774ab==='zoho.eu'?'eu':_0xa6e0('0x66');_0xdccee9=_0x237782[_0xa6e0('0x63')];var _0x1b8c30=_0xdccee9[_0xa6e0('0x67')](-0x1);if(_0x1b8c30==='/'||_0x1b8c30==='\x5c'||_0x1b8c30===':'){_0xdccee9=_0xdccee9[_0xa6e0('0x68')](0x0,_0xdccee9[_0xa6e0('0x69')](_0x1b8c30));}if(!_0x237782[_0xa6e0('0x65')]){throw new Error(_0xa6e0('0x6a'));}return getAccessToken(_0x237782);})['then'](function(_0x2af504){if(_0x2af504){return rp({'method':_0xa6e0('0x6b'),'uri':util[_0xa6e0('0x6c')](_0xa6e0('0x6d'),_0x2c9c8e),'qs':{'module':'Calls'},'headers':{'Authorization':_0xa6e0('0x6e')+_0x2af504},'json':!![]});}})['then'](function(_0x42adb2){if(_0x42adb2){if(_0x42adb2[_0xa6e0('0x6f')]&&_0x42adb2[_0xa6e0('0x6f')][_0xa6e0('0x29')]){throw new Error(_0x42adb2[_0xa6e0('0x6f')][_0xa6e0('0x29')]['message']);}var _0x499bde=[];var _0x1eda79=[];var _0x91a482=['Owner',_0xa6e0('0x70'),_0xa6e0('0x71'),_0xa6e0('0x72'),'Call_Duration',_0xa6e0('0x73'),_0xa6e0('0x74'),_0xa6e0('0x75')];_0x1eda79=_[_0xa6e0('0x76')](_0x42adb2[_0xa6e0('0x38')],function(_0x5716ba){return _0x91a482[_0xa6e0('0x77')](_0x5716ba['api_name']);});for(var _0x54615e=0x0;_0x54615e<_0x1eda79[_0xa6e0('0x3a')];_0x54615e++){if(_0x1eda79[_0x54615e][_0xa6e0('0x78')]===![]){_0x499bde[_0xa6e0('0x79')]({'id':_0x1eda79[_0x54615e]['id'],'name':_0x1eda79[_0x54615e][_0xa6e0('0x7a')],'custom':_0x1eda79[_0x54615e][_0xa6e0('0x7b')],'options':_0x1eda79[_0x54615e]['data_type']===_0xa6e0('0x7c')&&_0x1eda79[_0x54615e][_0xa6e0('0x7d')]['length']>-0x1?_['map'](_0x1eda79[_0x54615e][_0xa6e0('0x7d')],function(_0x278715){return{'name':_0x278715,'value':_0x278715};}):[]});}}return{'count':_0x499bde[_0xa6e0('0x3a')],'rows':_0x499bde};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x3aac13,null))['catch'](function(_0x1ec587){var _0x19c78c=_0x2daf7e['query'][_0xa6e0('0x7e')]?0x1f4:_0x1ec587[_0xa6e0('0x7f')]||0x1f4;logger[_0xa6e0('0x29')](_0xa6e0('0x80'),_0xa6e0('0x61'),_0x19c78c,JSON[_0xa6e0('0x81')](_0x1ec587));delete _0x1ec587[_0xa6e0('0x33')];if(_0x19c78c===0x191){_0x19c78c=0x190;}_0x3aac13[_0xa6e0('0x1d')](_0x19c78c)[_0xa6e0('0x2a')](_0x2daf7e['query'][_0xa6e0('0x7e')]?{'message':_0xa6e0('0x82'),'statusCode':_0x1ec587[_0xa6e0('0x7f')]}:_0x1ec587);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index e9cc6ac..1ee49e8 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 _0xbd1b=['host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/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','inspect','catch','https://accounts.zoho.com.cn','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xbd1b,0x18a));var _0xbbd1=function(_0x15cc3a,_0x54bb){_0x15cc3a=_0x15cc3a-0x0;var _0x100e2=_0xbd1b[_0x15cc3a];return _0x100e2;};'use strict';var _=require('lodash');var util=require(_0xbbd1('0x0'));var logger=require(_0xbbd1('0x1'))(_0xbbd1('0x2'));var moment=require(_0xbbd1('0x3'));var BPromise=require(_0xbbd1('0x4'));var rp=require(_0xbbd1('0x5'));var fs=require('fs');var path=require(_0xbbd1('0x6'));var rimraf=require(_0xbbd1('0x7'));var config=require(_0xbbd1('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x57745e,_0x3dda3c){return _0x57745e['define']('ZohoAccount',attributes,{'tableName':_0xbbd1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x23aac3,_0x49fc87,_0x41c6d8){if(_0x23aac3[_0xbbd1('0xa')](_0xbbd1('0xb'))||_0x23aac3[_0xbbd1('0xa')](_0xbbd1('0xc'))||_0x23aac3[_0xbbd1('0xa')](_0xbbd1('0xd'))||_0x23aac3[_0xbbd1('0xa')](_0xbbd1('0xe'))||_0x23aac3[_0xbbd1('0xa')](_0xbbd1('0xf'))||_0x23aac3[_0xbbd1('0xa')](_0xbbd1('0x10'))){var _0x220041,_0x15be2f;_0x220041=_0x23aac3[_0xbbd1('0xc')];var _0x402b08=_0x220041[_0xbbd1('0x11')](-0x1);if(_0x402b08==='/'||_0x402b08==='\x5c'||_0x402b08===':'){_0x220041=_0x220041[_0xbbd1('0x12')](0x0,_0x220041[_0xbbd1('0x13')](_0x402b08));}switch(_0x23aac3[_0xbbd1('0xb')]){case'US':_0x15be2f=_0xbbd1('0x14');break;case'AU':_0x15be2f=_0xbbd1('0x15');break;case'IN':_0x15be2f=_0xbbd1('0x16');break;case'CN':_0x15be2f='https://accounts.zoho.com.cn';break;default:_0x15be2f=_0xbbd1('0x17');break;}var _0xb57e55={'method':_0xbbd1('0x18'),'uri':_0x15be2f+_0xbbd1('0x19'),'form':{'grant_type':_0xbbd1('0x1a'),'client_id':_0x23aac3[_0xbbd1('0xd')],'client_secret':_0x23aac3[_0xbbd1('0xe')],'redirect_uri':_0x23aac3[_0xbbd1('0xc')],'code':_0x23aac3['code']},'headers':{'Content-Type':_0xbbd1('0x1b')}};return rp(_0xb57e55)[_0xbbd1('0x1c')](function(_0x9a13d7){var _0x4e1ad1=JSON[_0xbbd1('0x1d')](_0x9a13d7);if(_0x4e1ad1[_0xbbd1('0x1e')]){_0x23aac3[_0xbbd1('0x1f')]=_0x4e1ad1[_0xbbd1('0x1e')];logger[_0xbbd1('0x20')](util[_0xbbd1('0x21')](_0xbbd1('0x22'),_0x23aac3[_0xbbd1('0x23')],_0x23aac3['id']));}else{logger[_0xbbd1('0x24')](util[_0xbbd1('0x21')](_0xbbd1('0x25'),_0x23aac3['name'],_0x23aac3['id']),util[_0xbbd1('0x26')](_0x4e1ad1,{'showHidden':![],'depth':null}));}return _0x41c6d8(null,_0x49fc87);})[_0xbbd1('0x27')](function(_0x5dc077){logger[_0xbbd1('0x24')](util[_0xbbd1('0x21')](_0xbbd1('0x25'),_0x23aac3[_0xbbd1('0x23')],_0x23aac3['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x41c6d8(_0x5dc077);});}else{return _0x41c6d8(null,_0x49fc87);}},'beforeUpdate':function(_0x485339,_0x1075d1,_0x10ae6d){if(_0x485339[_0xbbd1('0xa')](_0xbbd1('0xb'))||_0x485339[_0xbbd1('0xa')]('serverUrl')||_0x485339['changed'](_0xbbd1('0xd'))||_0x485339[_0xbbd1('0xa')](_0xbbd1('0xe'))||_0x485339[_0xbbd1('0xa')](_0xbbd1('0xf'))||_0x485339[_0xbbd1('0xa')]('host')){var _0x9c1e33,_0xc606ac;_0x9c1e33=_0x485339[_0xbbd1('0xc')];var _0x439282=_0x9c1e33[_0xbbd1('0x11')](-0x1);if(_0x439282==='/'||_0x439282==='\x5c'||_0x439282===':'){_0x9c1e33=_0x9c1e33['substring'](0x0,_0x9c1e33[_0xbbd1('0x13')](_0x439282));}switch(_0x485339[_0xbbd1('0xb')]){case'US':_0xc606ac=_0xbbd1('0x14');break;case'AU':_0xc606ac=_0xbbd1('0x15');break;case'IN':_0xc606ac=_0xbbd1('0x16');break;case'CN':_0xc606ac=_0xbbd1('0x28');break;default:_0xc606ac=_0xbbd1('0x17');break;}var _0x13027e={'method':'POST','uri':_0xc606ac+'/oauth/v2/token','form':{'grant_type':_0xbbd1('0x1a'),'client_id':_0x485339[_0xbbd1('0xd')],'client_secret':_0x485339[_0xbbd1('0xe')],'redirect_uri':_0x485339[_0xbbd1('0xc')],'code':_0x485339[_0xbbd1('0xf')]},'headers':{'Content-Type':_0xbbd1('0x1b')}};return rp(_0x13027e)[_0xbbd1('0x1c')](function(_0x2e0379){var _0x3f33ba=JSON['parse'](_0x2e0379);if(_0x3f33ba[_0xbbd1('0x1e')]){_0x485339['refreshToken']=_0x3f33ba[_0xbbd1('0x1e')];logger['info'](util[_0xbbd1('0x21')](_0xbbd1('0x22'),_0x485339[_0xbbd1('0x23')],_0x485339['id']));}else{logger[_0xbbd1('0x24')](util['format'](_0xbbd1('0x25'),_0x485339[_0xbbd1('0x23')],_0x485339['id']),util['inspect'](_0x3f33ba,{'showHidden':![],'depth':null}));}return _0x10ae6d(null,_0x1075d1);})['catch'](function(_0x4169c3){logger['error'](util[_0xbbd1('0x21')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x485339['name'],_0x485339['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x10ae6d(_0x4169c3);});}else{return _0x10ae6d(null,_0x1075d1);}}}});}; \ No newline at end of file +var _0x0ecb=['slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientId','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','inspect','catch','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','clientSecret','host','https://accounts.zoho.com','POST','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','changed','zone','code','serverUrl'];(function(_0x189478,_0x3c04d4){var _0x138783=function(_0x509674){while(--_0x509674){_0x189478['push'](_0x189478['shift']());}};_0x138783(++_0x3c04d4);}(_0x0ecb,0x123));var _0xb0ec=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0x0ecb[_0x4d7a61];return _0x186f73;};'use strict';var _=require(_0xb0ec('0x0'));var util=require(_0xb0ec('0x1'));var logger=require(_0xb0ec('0x2'))(_0xb0ec('0x3'));var moment=require('moment');var BPromise=require(_0xb0ec('0x4'));var rp=require(_0xb0ec('0x5'));var fs=require('fs');var path=require(_0xb0ec('0x6'));var rimraf=require(_0xb0ec('0x7'));var config=require(_0xb0ec('0x8'));var attributes=require(_0xb0ec('0x9'));var integrations=require(_0xb0ec('0xa'));module['exports']=function(_0x164df1,_0x2943da){return _0x164df1[_0xb0ec('0xb')](_0xb0ec('0xc'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5b8983,_0x3b69ec,_0x53ef4a){if(_0x5b8983[_0xb0ec('0xd')](_0xb0ec('0xe'))||_0x5b8983['changed']('serverUrl')||_0x5b8983[_0xb0ec('0xd')]('clientId')||_0x5b8983['changed']('clientSecret')||_0x5b8983['changed'](_0xb0ec('0xf'))||_0x5b8983[_0xb0ec('0xd')]('host')){var _0x387863,_0x384cb6;_0x387863=_0x5b8983[_0xb0ec('0x10')];var _0x3b285e=_0x387863[_0xb0ec('0x11')](-0x1);if(_0x3b285e==='/'||_0x3b285e==='\x5c'||_0x3b285e===':'){_0x387863=_0x387863[_0xb0ec('0x12')](0x0,_0x387863[_0xb0ec('0x13')](_0x3b285e));}switch(_0x5b8983[_0xb0ec('0xe')]){case'US':_0x384cb6='https://accounts.zoho.com';break;case'AU':_0x384cb6=_0xb0ec('0x14');break;case'IN':_0x384cb6=_0xb0ec('0x15');break;case'CN':_0x384cb6=_0xb0ec('0x16');break;default:_0x384cb6=_0xb0ec('0x17');break;}var _0x58e2be={'method':'POST','uri':_0x384cb6+_0xb0ec('0x18'),'form':{'grant_type':_0xb0ec('0x19'),'client_id':_0x5b8983[_0xb0ec('0x1a')],'client_secret':_0x5b8983['clientSecret'],'redirect_uri':_0x5b8983[_0xb0ec('0x10')],'code':_0x5b8983['code']},'headers':{'Content-Type':_0xb0ec('0x1b')}};return rp(_0x58e2be)[_0xb0ec('0x1c')](function(_0x1176ec){var _0x1d82f8=JSON[_0xb0ec('0x1d')](_0x1176ec);if(_0x1d82f8[_0xb0ec('0x1e')]){_0x5b8983[_0xb0ec('0x1f')]=_0x1d82f8[_0xb0ec('0x1e')];logger[_0xb0ec('0x20')](util['format'](_0xb0ec('0x21'),_0x5b8983[_0xb0ec('0x22')],_0x5b8983['id']));}else{logger[_0xb0ec('0x23')](util[_0xb0ec('0x24')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5b8983['name'],_0x5b8983['id']),util[_0xb0ec('0x25')](_0x1d82f8,{'showHidden':![],'depth':null}));}return _0x53ef4a(null,_0x3b69ec);})[_0xb0ec('0x26')](function(_0x55a3d3){logger['error'](util[_0xb0ec('0x24')](_0xb0ec('0x27'),_0x5b8983[_0xb0ec('0x22')],_0x5b8983['id']),util[_0xb0ec('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x53ef4a(_0x55a3d3);});}else{return _0x53ef4a(null,_0x3b69ec);}},'beforeUpdate':function(_0x3748c0,_0x17d0a5,_0x174e80){if(_0x3748c0[_0xb0ec('0xd')](_0xb0ec('0xe'))||_0x3748c0['changed'](_0xb0ec('0x10'))||_0x3748c0[_0xb0ec('0xd')](_0xb0ec('0x1a'))||_0x3748c0[_0xb0ec('0xd')](_0xb0ec('0x28'))||_0x3748c0[_0xb0ec('0xd')](_0xb0ec('0xf'))||_0x3748c0[_0xb0ec('0xd')](_0xb0ec('0x29'))){var _0x53bde8,_0x4491b7;_0x53bde8=_0x3748c0['serverUrl'];var _0x4b7052=_0x53bde8[_0xb0ec('0x11')](-0x1);if(_0x4b7052==='/'||_0x4b7052==='\x5c'||_0x4b7052===':'){_0x53bde8=_0x53bde8[_0xb0ec('0x12')](0x0,_0x53bde8[_0xb0ec('0x13')](_0x4b7052));}switch(_0x3748c0[_0xb0ec('0xe')]){case'US':_0x4491b7=_0xb0ec('0x2a');break;case'AU':_0x4491b7=_0xb0ec('0x14');break;case'IN':_0x4491b7=_0xb0ec('0x15');break;case'CN':_0x4491b7=_0xb0ec('0x16');break;default:_0x4491b7=_0xb0ec('0x17');break;}var _0x4e44eb={'method':_0xb0ec('0x2b'),'uri':_0x4491b7+_0xb0ec('0x18'),'form':{'grant_type':_0xb0ec('0x19'),'client_id':_0x3748c0['clientId'],'client_secret':_0x3748c0[_0xb0ec('0x28')],'redirect_uri':_0x3748c0['serverUrl'],'code':_0x3748c0[_0xb0ec('0xf')]},'headers':{'Content-Type':_0xb0ec('0x1b')}};return rp(_0x4e44eb)[_0xb0ec('0x1c')](function(_0x282cbe){var _0x2729a3=JSON['parse'](_0x282cbe);if(_0x2729a3[_0xb0ec('0x1e')]){_0x3748c0['refreshToken']=_0x2729a3[_0xb0ec('0x1e')];logger[_0xb0ec('0x20')](util[_0xb0ec('0x24')](_0xb0ec('0x21'),_0x3748c0[_0xb0ec('0x22')],_0x3748c0['id']));}else{logger[_0xb0ec('0x23')](util[_0xb0ec('0x24')](_0xb0ec('0x27'),_0x3748c0['name'],_0x3748c0['id']),util[_0xb0ec('0x25')](_0x2729a3,{'showHidden':![],'depth':null}));}return _0x174e80(null,_0x17d0a5);})[_0xb0ec('0x26')](function(_0x5b322e){logger['error'](util['format'](_0xb0ec('0x27'),_0x3748c0[_0xb0ec('0x22')],_0x3748c0['id']),util[_0xb0ec('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x174e80(_0x5b322e);});}else{return _0x174e80(null,_0x17d0a5);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 6905863..39f552c 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 _0x72fa=['options','raw','where','attributes','limit','include','map','model','info','debug','ShowZohoAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll'];(function(_0x39a7bb,_0x3616b6){var _0x2e1027=function(_0x530bd7){while(--_0x530bd7){_0x39a7bb['push'](_0x39a7bb['shift']());}};_0x2e1027(++_0x3616b6);}(_0x72fa,0x78));var _0xa72f=function(_0x546c68,_0x5c0116){_0x546c68=_0x546c68-0x0;var _0x4a2389=_0x72fa[_0x546c68];return _0x4a2389;};'use strict';var _=require(_0xa72f('0x0'));var util=require(_0xa72f('0x1'));var moment=require('moment');var BPromise=require(_0xa72f('0x2'));var rs=require(_0xa72f('0x3'));var fs=require('fs');var Redis=require(_0xa72f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa72f('0x5'))(_0xa72f('0x6'));var config=require(_0xa72f('0x7'));var jayson=require(_0xa72f('0x8'));var client=jayson[_0xa72f('0x9')][_0xa72f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cd1a3,_0xe8aa31,_0x1e1b85){return new BPromise(function(_0x33eae5,_0x57d4fa){return client[_0xa72f('0xb')](_0x2cd1a3,_0x1e1b85)[_0xa72f('0xc')](function(_0x423bc7){logger['info'](_0xa72f('0xd'),_0xe8aa31,_0xa72f('0xe'));logger['debug'](_0xa72f('0xf'),_0xe8aa31,_0xa72f('0xe'),JSON[_0xa72f('0x10')](_0x423bc7));if(_0x423bc7[_0xa72f('0x11')]){if(_0x423bc7[_0xa72f('0x11')][_0xa72f('0x12')]===0x1f4){logger[_0xa72f('0x11')](_0xa72f('0xd'),_0xe8aa31,_0x423bc7[_0xa72f('0x11')][_0xa72f('0x13')]);return _0x57d4fa(_0x423bc7[_0xa72f('0x11')][_0xa72f('0x13')]);}logger['error'](_0xa72f('0xd'),_0xe8aa31,_0x423bc7[_0xa72f('0x11')][_0xa72f('0x13')]);return _0x33eae5(_0x423bc7['error'][_0xa72f('0x13')]);}else{logger['info'](_0xa72f('0xd'),_0xe8aa31,_0xa72f('0xe'));_0x33eae5(_0x423bc7['result'][_0xa72f('0x13')]);}})[_0xa72f('0x14')](function(_0x461119){logger[_0xa72f('0x11')]('ZohoAccount,\x20%s,\x20%s',_0xe8aa31,_0x461119);_0x57d4fa(_0x461119);});});}exports[_0xa72f('0x15')]=function(_0x79d7a){var _0x425e89=this;return new Promise(function(_0x303faa,_0x59b62a){return db[_0xa72f('0x16')][_0xa72f('0x17')]({'raw':_0x79d7a[_0xa72f('0x18')]?_0x79d7a[_0xa72f('0x18')][_0xa72f('0x19')]===undefined?!![]:![]:!![],'where':_0x79d7a[_0xa72f('0x18')]?_0x79d7a['options'][_0xa72f('0x1a')]||null:null,'attributes':_0x79d7a['options']?_0x79d7a[_0xa72f('0x18')][_0xa72f('0x1b')]||null:null,'limit':_0x79d7a['options']?_0x79d7a[_0xa72f('0x18')][_0xa72f('0x1c')]||null:null,'include':_0x79d7a[_0xa72f('0x18')]?_0x79d7a[_0xa72f('0x18')][_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x79d7a[_0xa72f('0x18')][_0xa72f('0x1d')],function(_0x1e3af9){return{'model':db[_0x1e3af9[_0xa72f('0x1f')]],'as':_0x1e3af9['as'],'attributes':_0x1e3af9['attributes'],'include':_0x1e3af9[_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x1e3af9[_0xa72f('0x1d')],function(_0x40cc13){return{'model':db[_0x40cc13[_0xa72f('0x1f')]],'as':_0x40cc13['as'],'attributes':_0x40cc13['attributes'],'include':_0x40cc13[_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x40cc13[_0xa72f('0x1d')],function(_0x25bf66){return{'model':db[_0x25bf66['model']],'as':_0x25bf66['as'],'attributes':_0x25bf66['attributes']};}):[]};}):[]};}):[]:[]})[_0xa72f('0xc')](function(_0x51e4e4){logger[_0xa72f('0x20')](_0xa72f('0x15'),_0x79d7a);logger[_0xa72f('0x21')](_0xa72f('0x15'),_0x79d7a,JSON[_0xa72f('0x10')](_0x51e4e4));_0x303faa(_0x51e4e4);})['catch'](function(_0x259a9a){logger[_0xa72f('0x11')](_0xa72f('0x15'),_0x259a9a[_0xa72f('0x13')],_0x79d7a);_0x59b62a(_0x425e89['error'](0x1f4,_0x259a9a[_0xa72f('0x13')]));});});};exports[_0xa72f('0x22')]=function(_0x4c1eff){var _0x2cd213=this;return new Promise(function(_0x2216ce,_0x3206ab){return db['ZohoAccount'][_0xa72f('0x23')]({'raw':_0x4c1eff['options']?_0x4c1eff[_0xa72f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4c1eff[_0xa72f('0x18')]?_0x4c1eff['options'][_0xa72f('0x1a')]||null:null,'attributes':_0x4c1eff[_0xa72f('0x18')]?_0x4c1eff[_0xa72f('0x18')][_0xa72f('0x1b')]||null:null,'include':_0x4c1eff[_0xa72f('0x18')]?_0x4c1eff['options'][_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x4c1eff[_0xa72f('0x18')][_0xa72f('0x1d')],function(_0x216c49){return{'model':db[_0x216c49[_0xa72f('0x1f')]],'as':_0x216c49['as'],'attributes':_0x216c49[_0xa72f('0x1b')],'include':_0x216c49[_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x216c49[_0xa72f('0x1d')],function(_0x316b10){return{'model':db[_0x316b10['model']],'as':_0x316b10['as'],'attributes':_0x316b10['attributes'],'include':_0x316b10[_0xa72f('0x1d')]?_[_0xa72f('0x1e')](_0x316b10[_0xa72f('0x1d')],function(_0x6fb77e){return{'model':db[_0x6fb77e[_0xa72f('0x1f')]],'as':_0x6fb77e['as'],'attributes':_0x6fb77e[_0xa72f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35eae4){logger[_0xa72f('0x20')]('ShowZohoAccount',_0x4c1eff);logger[_0xa72f('0x21')]('ShowZohoAccount',_0x4c1eff,JSON[_0xa72f('0x10')](_0x35eae4));_0x2216ce(_0x35eae4);})[_0xa72f('0x14')](function(_0x43a56f){logger[_0xa72f('0x11')](_0xa72f('0x22'),_0x43a56f[_0xa72f('0x13')],_0x4c1eff);_0x3206ab(_0x2cd213['error'](0x1f4,_0x43a56f[_0xa72f('0x13')]));});});}; \ No newline at end of file +var _0xf06c=['ShowZohoAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','ZohoAccount,\x20%s,\x20%s','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','debug'];(function(_0x23c043,_0x36ccd9){var _0x448024=function(_0x5bcc59){while(--_0x5bcc59){_0x23c043['push'](_0x23c043['shift']());}};_0x448024(++_0x36ccd9);}(_0xf06c,0xc7));var _0xcf06=function(_0x127479,_0x166a53){_0x127479=_0x127479-0x0;var _0x579335=_0xf06c[_0x127479];return _0x579335;};'use strict';var _=require(_0xcf06('0x0'));var util=require(_0xcf06('0x1'));var moment=require(_0xcf06('0x2'));var BPromise=require(_0xcf06('0x3'));var rs=require(_0xcf06('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf06('0x5'))['db'];var utils=require(_0xcf06('0x6'));var logger=require(_0xcf06('0x7'))('rpc');var config=require(_0xcf06('0x8'));var jayson=require(_0xcf06('0x9'));var client=jayson[_0xcf06('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22ac40,_0x5d1aa0,_0x2723ad){return new BPromise(function(_0x48ed0c,_0x4dd606){return client['request'](_0x22ac40,_0x2723ad)['then'](function(_0x6ecf1a){logger[_0xcf06('0xb')](_0xcf06('0xc'),_0x5d1aa0,'request\x20sent');logger['debug'](_0xcf06('0xd'),_0x5d1aa0,'request\x20sent',JSON[_0xcf06('0xe')](_0x6ecf1a));if(_0x6ecf1a['error']){if(_0x6ecf1a[_0xcf06('0xf')]['code']===0x1f4){logger[_0xcf06('0xf')](_0xcf06('0xc'),_0x5d1aa0,_0x6ecf1a[_0xcf06('0xf')][_0xcf06('0x10')]);return _0x4dd606(_0x6ecf1a['error']['message']);}logger[_0xcf06('0xf')](_0xcf06('0xc'),_0x5d1aa0,_0x6ecf1a[_0xcf06('0xf')][_0xcf06('0x10')]);return _0x48ed0c(_0x6ecf1a['error'][_0xcf06('0x10')]);}else{logger[_0xcf06('0xb')]('ZohoAccount,\x20%s,\x20%s',_0x5d1aa0,'request\x20sent');_0x48ed0c(_0x6ecf1a[_0xcf06('0x11')][_0xcf06('0x10')]);}})[_0xcf06('0x12')](function(_0x57c316){logger[_0xcf06('0xf')](_0xcf06('0xc'),_0x5d1aa0,_0x57c316);_0x4dd606(_0x57c316);});});}exports[_0xcf06('0x13')]=function(_0x569bbf){var _0x2f6584=this;return new Promise(function(_0x2a5ef5,_0x24b658){return db[_0xcf06('0x14')][_0xcf06('0x15')]({'raw':_0x569bbf['options']?_0x569bbf[_0xcf06('0x16')][_0xcf06('0x17')]===undefined?!![]:![]:!![],'where':_0x569bbf[_0xcf06('0x16')]?_0x569bbf['options'][_0xcf06('0x18')]||null:null,'attributes':_0x569bbf[_0xcf06('0x16')]?_0x569bbf['options'][_0xcf06('0x19')]||null:null,'limit':_0x569bbf[_0xcf06('0x16')]?_0x569bbf['options'][_0xcf06('0x1a')]||null:null,'include':_0x569bbf[_0xcf06('0x16')]?_0x569bbf[_0xcf06('0x16')][_0xcf06('0x1b')]?_[_0xcf06('0x1c')](_0x569bbf[_0xcf06('0x16')][_0xcf06('0x1b')],function(_0x26a685){return{'model':db[_0x26a685[_0xcf06('0x1d')]],'as':_0x26a685['as'],'attributes':_0x26a685[_0xcf06('0x19')],'include':_0x26a685[_0xcf06('0x1b')]?_[_0xcf06('0x1c')](_0x26a685['include'],function(_0x58840a){return{'model':db[_0x58840a[_0xcf06('0x1d')]],'as':_0x58840a['as'],'attributes':_0x58840a[_0xcf06('0x19')],'include':_0x58840a[_0xcf06('0x1b')]?_[_0xcf06('0x1c')](_0x58840a[_0xcf06('0x1b')],function(_0x6c3dcf){return{'model':db[_0x6c3dcf['model']],'as':_0x6c3dcf['as'],'attributes':_0x6c3dcf['attributes']};}):[]};}):[]};}):[]:[]})[_0xcf06('0x1e')](function(_0x4c6fcd){logger[_0xcf06('0xb')](_0xcf06('0x13'),_0x569bbf);logger[_0xcf06('0x1f')](_0xcf06('0x13'),_0x569bbf,JSON[_0xcf06('0xe')](_0x4c6fcd));_0x2a5ef5(_0x4c6fcd);})[_0xcf06('0x12')](function(_0x303823){logger[_0xcf06('0xf')](_0xcf06('0x13'),_0x303823['message'],_0x569bbf);_0x24b658(_0x2f6584[_0xcf06('0xf')](0x1f4,_0x303823['message']));});});};exports[_0xcf06('0x20')]=function(_0x3ec4f2){var _0x42d287=this;return new Promise(function(_0x41493c,_0x143854){return db[_0xcf06('0x14')]['find']({'raw':_0x3ec4f2[_0xcf06('0x16')]?_0x3ec4f2[_0xcf06('0x16')][_0xcf06('0x17')]===undefined?!![]:![]:!![],'where':_0x3ec4f2[_0xcf06('0x16')]?_0x3ec4f2[_0xcf06('0x16')][_0xcf06('0x18')]||null:null,'attributes':_0x3ec4f2[_0xcf06('0x16')]?_0x3ec4f2[_0xcf06('0x16')][_0xcf06('0x19')]||null:null,'include':_0x3ec4f2[_0xcf06('0x16')]?_0x3ec4f2['options'][_0xcf06('0x1b')]?_[_0xcf06('0x1c')](_0x3ec4f2[_0xcf06('0x16')][_0xcf06('0x1b')],function(_0x117558){return{'model':db[_0x117558[_0xcf06('0x1d')]],'as':_0x117558['as'],'attributes':_0x117558[_0xcf06('0x19')],'include':_0x117558[_0xcf06('0x1b')]?_[_0xcf06('0x1c')](_0x117558[_0xcf06('0x1b')],function(_0x23845c){return{'model':db[_0x23845c['model']],'as':_0x23845c['as'],'attributes':_0x23845c[_0xcf06('0x19')],'include':_0x23845c[_0xcf06('0x1b')]?_['map'](_0x23845c[_0xcf06('0x1b')],function(_0x5e9431){return{'model':db[_0x5e9431[_0xcf06('0x1d')]],'as':_0x5e9431['as'],'attributes':_0x5e9431[_0xcf06('0x19')]};}):[]};}):[]};}):[]:[]})[_0xcf06('0x1e')](function(_0x26a32c){logger['info'](_0xcf06('0x20'),_0x3ec4f2);logger[_0xcf06('0x1f')](_0xcf06('0x20'),_0x3ec4f2,JSON[_0xcf06('0xe')](_0x26a32c));_0x41493c(_0x26a32c);})[_0xcf06('0x12')](function(_0x580850){logger[_0xcf06('0xf')](_0xcf06('0x20'),_0x580850[_0xcf06('0x10')],_0x3ec4f2);_0x143854(_0x42d287[_0xcf06('0xf')](0x1f4,_0x580850[_0xcf06('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 3645284..01fda13 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 _0xa288=['../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','getFields','getSubjects','create','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x4055e3,_0x4864cd){var _0x3d8b9a=function(_0x5a9601){while(--_0x5a9601){_0x4055e3['push'](_0x4055e3['shift']());}};_0x3d8b9a(++_0x4864cd);}(_0xa288,0x6c));var _0x8a28=function(_0x11a7be,_0x531813){_0x11a7be=_0x11a7be-0x0;var _0x34275f=_0xa288[_0x11a7be];return _0x34275f;};'use strict';var multer=require(_0x8a28('0x0'));var util=require(_0x8a28('0x1'));var path=require('path');var timeout=require(_0x8a28('0x2'));var express=require(_0x8a28('0x3'));var router=express[_0x8a28('0x4')]();var fs_extra=require(_0x8a28('0x5'));var auth=require(_0x8a28('0x6'));var interaction=require(_0x8a28('0x7'));var config=require('../../config/environment');var controller=require(_0x8a28('0x8'));router[_0x8a28('0x9')]('/',auth[_0x8a28('0xa')](),controller['index']);router[_0x8a28('0x9')](_0x8a28('0xb'),auth[_0x8a28('0xa')](),controller[_0x8a28('0xc')]);router[_0x8a28('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8a28('0xd')]);router[_0x8a28('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x8a28('0xe')]);router['get']('/:id/descriptions',auth[_0x8a28('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0x8a28('0xa')](),controller[_0x8a28('0xf')]);router[_0x8a28('0x10')](_0x8a28('0xb'),auth[_0x8a28('0xa')](),controller[_0x8a28('0x11')]);router['delete'](_0x8a28('0xb'),auth[_0x8a28('0xa')](),controller[_0x8a28('0x12')]);module['exports']=router; \ No newline at end of file +var _0x16d4=['getSubjects','/:id/descriptions','getDescriptions','create','update','delete','destroy','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x16d4,0x177));var _0x416d=function(_0x3ce831,_0x115228){_0x3ce831=_0x3ce831-0x0;var _0x5b3479=_0x16d4[_0x3ce831];return _0x5b3479;};'use strict';var multer=require('multer');var util=require(_0x416d('0x0'));var path=require(_0x416d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x416d('0x2')]();var fs_extra=require(_0x416d('0x3'));var auth=require(_0x416d('0x4'));var interaction=require(_0x416d('0x5'));var config=require(_0x416d('0x6'));var controller=require(_0x416d('0x7'));router['get']('/',auth[_0x416d('0x8')](),controller[_0x416d('0x9')]);router[_0x416d('0xa')](_0x416d('0xb'),auth[_0x416d('0x8')](),controller[_0x416d('0xc')]);router[_0x416d('0xa')](_0x416d('0xd'),auth[_0x416d('0x8')](),controller[_0x416d('0xe')]);router[_0x416d('0xa')](_0x416d('0xf'),auth['isAuthenticated'](),controller[_0x416d('0x10')]);router[_0x416d('0xa')](_0x416d('0x11'),auth['isAuthenticated'](),controller[_0x416d('0x12')]);router['post']('/',auth[_0x416d('0x8')](),controller[_0x416d('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x416d('0x14')]);router[_0x416d('0x15')](_0x416d('0xb'),auth[_0x416d('0x8')](),controller[_0x416d('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e5c1027..391f103 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 _0xd4f4=['lead','contact','nothing','contact_lead','sequelize','STRING','ENUM'];(function(_0xdf2acc,_0x13feea){var _0x1b641d=function(_0xea41bc){while(--_0xea41bc){_0xdf2acc['push'](_0xdf2acc['shift']());}};_0x1b641d(++_0x13feea);}(_0xd4f4,0x6d));var _0x4d4f=function(_0xab8f6,_0x244168){_0xab8f6=_0xab8f6-0x0;var _0x4acc58=_0xd4f4[_0xab8f6];return _0x4acc58;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module['exports']={'name':{'type':Sequelize[_0x4d4f('0x1')]},'moduleCreate':{'type':Sequelize[_0x4d4f('0x2')](_0x4d4f('0x3'),_0x4d4f('0x4'),_0x4d4f('0x5')),'defaultValue':_0x4d4f('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x4d4f('0x6'),_0x4d4f('0x4'),_0x4d4f('0x3')),'defaultValue':_0x4d4f('0x6')},'description':{'type':Sequelize[_0x4d4f('0x1')]}}; \ No newline at end of file +var _0xee8b=['nothing','ENUM','contact_lead','STRING','sequelize','exports','lead','contact'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xee8b,0x14c));var _0xbee8=function(_0x3490e4,_0x456d7e){_0x3490e4=_0x3490e4-0x0;var _0x2c25a9=_0xee8b[_0x3490e4];return _0x2c25a9;};'use strict';var Sequelize=require(_0xbee8('0x0'));module[_0xbee8('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0xbee8('0x2'),_0xbee8('0x3'),_0xbee8('0x4')),'defaultValue':_0xbee8('0x2')},'moduleSearch':{'type':Sequelize[_0xbee8('0x5')](_0xbee8('0x6'),_0xbee8('0x3'),'lead'),'defaultValue':_0xbee8('0x6')},'description':{'type':Sequelize[_0xbee8('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index c8b7247..36dbe24 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 _0xfa27=['params','find','create','body','getFields','findOne','length','getSubjects','ZohoField','getDescriptions','eml-format','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','stack','name','index','map','ZohoConfiguration','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch'];(function(_0xbe7c9d,_0x3c9b3a){var _0x3dcf4a=function(_0x43d552){while(--_0x43d552){_0xbe7c9d['push'](_0xbe7c9d['shift']());}};_0x3dcf4a(++_0x3c9b3a);}(_0xfa27,0xa8));var _0x7fa2=function(_0x5a1d13,_0x148bf7){_0x5a1d13=_0x5a1d13-0x0;var _0x1694d5=_0xfa27[_0x5a1d13];return _0x1694d5;};'use strict';var emlformat=require(_0x7fa2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7fa2('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7fa2('0x2'));var Mustache=require(_0x7fa2('0x3'));var util=require('util');var path=require(_0x7fa2('0x4'));var sox=require(_0x7fa2('0x5'));var csv=require(_0x7fa2('0x6'));var ejs=require(_0x7fa2('0x7'));var fs=require('fs');var fs_extra=require(_0x7fa2('0x8'));var _=require('lodash');var squel=require(_0x7fa2('0x9'));var crypto=require(_0x7fa2('0xa'));var jsforce=require(_0x7fa2('0xb'));var deskjs=require(_0x7fa2('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7fa2('0xd'));var Papa=require('papaparse');var Redis=require(_0x7fa2('0xe'));var authService=require(_0x7fa2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7fa2('0x10'));var hardwareService=require(_0x7fa2('0x11'));var logger=require('../../config/logger')(_0x7fa2('0x12'));var utils=require(_0x7fa2('0x13'));var config=require(_0x7fa2('0x14'));var licenseUtil=require(_0x7fa2('0x15'));var db=require(_0x7fa2('0x16'))['db'];function respondWithStatusCode(_0x494b3b,_0x14de94){_0x14de94=_0x14de94||0xcc;return function(_0x30cf82){if(_0x30cf82){return _0x494b3b[_0x7fa2('0x17')](_0x14de94);}return _0x494b3b[_0x7fa2('0x18')](_0x14de94)['end']();};}function respondWithResult(_0x4ba026,_0x4ecb61){_0x4ecb61=_0x4ecb61||0xc8;return function(_0x62151e){if(_0x62151e){return _0x4ba026['status'](_0x4ecb61)['json'](_0x62151e);}};}function respondWithFilteredResult(_0x3eaf17,_0x2d413a){return function(_0x4e041e){if(_0x4e041e){var _0x3f03bd=typeof _0x2d413a[_0x7fa2('0x19')]===_0x7fa2('0x1a')&&typeof _0x2d413a['limit']===_0x7fa2('0x1a');var _0x57d43f=_0x4e041e[_0x7fa2('0x1b')];var _0x411983=_0x3f03bd?0x0:_0x2d413a['offset'];var _0x28aec7=_0x3f03bd?_0x4e041e['count']:_0x2d413a[_0x7fa2('0x19')]+_0x2d413a[_0x7fa2('0x1c')];var _0x3a03d5;if(_0x28aec7>=_0x57d43f){_0x28aec7=_0x57d43f;_0x3a03d5=0xc8;}else{_0x3a03d5=0xce;}_0x3eaf17[_0x7fa2('0x18')](_0x3a03d5);return _0x3eaf17[_0x7fa2('0x1d')](_0x7fa2('0x1e'),_0x411983+'-'+_0x28aec7+'/'+_0x57d43f)[_0x7fa2('0x1f')](_0x4e041e);}return null;};}function patchUpdates(_0x487e8f){return function(_0x10fe12){try{jsonpatch[_0x7fa2('0x20')](_0x10fe12,_0x487e8f,!![]);}catch(_0x1b76fd){return BPromise[_0x7fa2('0x21')](_0x1b76fd);}return _0x10fe12[_0x7fa2('0x22')]();};}function saveUpdates(_0x103b79,_0x2ae6d8){return function(_0x2ad3b6){if(_0x2ad3b6){return _0x2ad3b6[_0x7fa2('0x23')](_0x103b79)[_0x7fa2('0x24')](function(_0x59813e){return _0x59813e;});}return null;};}function removeEntity(_0x5af69e,_0x2a544c){return function(_0x445658){if(_0x445658){return _0x445658[_0x7fa2('0x25')]()[_0x7fa2('0x24')](function(){_0x5af69e[_0x7fa2('0x18')](0xcc)[_0x7fa2('0x26')]();});}};}function handleEntityNotFound(_0xf8b975,_0x4f0534){return function(_0x1fed0e){if(!_0x1fed0e){_0xf8b975[_0x7fa2('0x17')](0x194);}return _0x1fed0e;};}function handleError(_0x26775f,_0x29069d){_0x29069d=_0x29069d||0x1f4;return function(_0x489511){logger['error'](_0x489511[_0x7fa2('0x27')]);if(_0x489511[_0x7fa2('0x28')]){delete _0x489511[_0x7fa2('0x28')];}_0x26775f[_0x7fa2('0x18')](_0x29069d)['send'](_0x489511);};}exports[_0x7fa2('0x29')]=function(_0x405756,_0x3e5196){var _0x358ab3={},_0x5a6e18={},_0x2d0e0f={'count':0x0,'rows':[]};var _0x3282c5=_[_0x7fa2('0x2a')](db[_0x7fa2('0x2b')][_0x7fa2('0x2c')],function(_0x7b3e3){return{'name':_0x7b3e3['fieldName'],'type':_0x7b3e3['type'][_0x7fa2('0x2d')]};});_0x5a6e18[_0x7fa2('0x2e')]=_[_0x7fa2('0x2a')](_0x3282c5,_0x7fa2('0x28'));_0x5a6e18[_0x7fa2('0x2f')]=_[_0x7fa2('0x30')](_0x405756[_0x7fa2('0x2f')]);_0x5a6e18[_0x7fa2('0x31')]=_[_0x7fa2('0x32')](_0x5a6e18[_0x7fa2('0x2e')],_0x5a6e18[_0x7fa2('0x2f')]);_0x358ab3[_0x7fa2('0x33')]=_[_0x7fa2('0x32')](_0x5a6e18[_0x7fa2('0x2e')],qs[_0x7fa2('0x34')](_0x405756[_0x7fa2('0x2f')][_0x7fa2('0x34')]));_0x358ab3[_0x7fa2('0x33')]=_0x358ab3[_0x7fa2('0x33')]['length']?_0x358ab3[_0x7fa2('0x33')]:_0x5a6e18['model'];if(!_0x405756[_0x7fa2('0x2f')][_0x7fa2('0x35')](_0x7fa2('0x36'))){_0x358ab3[_0x7fa2('0x1c')]=qs[_0x7fa2('0x1c')](_0x405756[_0x7fa2('0x2f')][_0x7fa2('0x1c')]);_0x358ab3['offset']=qs[_0x7fa2('0x19')](_0x405756['query'][_0x7fa2('0x19')]);}_0x358ab3[_0x7fa2('0x37')]=qs['sort'](_0x405756[_0x7fa2('0x2f')][_0x7fa2('0x38')]);_0x358ab3[_0x7fa2('0x39')]=qs['filters'](_[_0x7fa2('0x3a')](_0x405756['query'],_0x5a6e18[_0x7fa2('0x31')]),_0x3282c5);if(_0x405756['query'][_0x7fa2('0x3b')]){_0x358ab3[_0x7fa2('0x39')]=_[_0x7fa2('0x3c')](_0x358ab3[_0x7fa2('0x39')],{'$or':_[_0x7fa2('0x2a')](_0x3282c5,function(_0x5c5c2e){if(_0x5c5c2e[_0x7fa2('0x3d')]!==_0x7fa2('0x3e')){var _0x5a9a0e={};_0x5a9a0e[_0x5c5c2e[_0x7fa2('0x28')]]={'$like':'%'+_0x405756['query'][_0x7fa2('0x3b')]+'%'};return _0x5a9a0e;}})});}_0x358ab3=_['merge']({},_0x358ab3,_0x405756[_0x7fa2('0x3f')]);var _0x5d5273={'where':_0x358ab3[_0x7fa2('0x39')]};return db['ZohoConfiguration'][_0x7fa2('0x1b')](_0x5d5273)[_0x7fa2('0x24')](function(_0x31d3f8){_0x2d0e0f[_0x7fa2('0x1b')]=_0x31d3f8;if(_0x405756[_0x7fa2('0x2f')][_0x7fa2('0x40')]){_0x358ab3[_0x7fa2('0x41')]=[{'all':!![]}];}return db[_0x7fa2('0x2b')][_0x7fa2('0x42')](_0x358ab3);})[_0x7fa2('0x24')](function(_0x8c7b56){_0x2d0e0f[_0x7fa2('0x43')]=_0x8c7b56;return _0x2d0e0f;})[_0x7fa2('0x24')](respondWithFilteredResult(_0x3e5196,_0x358ab3))[_0x7fa2('0x44')](handleError(_0x3e5196,null));};exports['show']=function(_0x49d565,_0x2b9778){var _0x4ab19e={'raw':![],'where':{'id':_0x49d565[_0x7fa2('0x45')]['id']}},_0x5ac13e={};_0x5ac13e['model']=_[_0x7fa2('0x30')](db[_0x7fa2('0x2b')]['rawAttributes']);_0x5ac13e['query']=_[_0x7fa2('0x30')](_0x49d565['query']);_0x5ac13e[_0x7fa2('0x31')]=_[_0x7fa2('0x32')](_0x5ac13e[_0x7fa2('0x2e')],_0x5ac13e[_0x7fa2('0x2f')]);_0x4ab19e[_0x7fa2('0x33')]=_['intersection'](_0x5ac13e[_0x7fa2('0x2e')],qs['fields'](_0x49d565[_0x7fa2('0x2f')][_0x7fa2('0x34')]));_0x4ab19e['attributes']=_0x4ab19e[_0x7fa2('0x33')]['length']?_0x4ab19e[_0x7fa2('0x33')]:_0x5ac13e[_0x7fa2('0x2e')];if(_0x49d565[_0x7fa2('0x2f')][_0x7fa2('0x40')]){_0x4ab19e[_0x7fa2('0x41')]=[{'all':!![]}];}_0x4ab19e=_['merge']({},_0x4ab19e,_0x49d565[_0x7fa2('0x3f')]);return db['ZohoConfiguration'][_0x7fa2('0x46')](_0x4ab19e)['then'](handleEntityNotFound(_0x2b9778,null))[_0x7fa2('0x24')](respondWithResult(_0x2b9778,null))[_0x7fa2('0x44')](handleError(_0x2b9778,null));};exports['create']=function(_0x556fe5,_0x5443a2){return db['ZohoConfiguration'][_0x7fa2('0x47')](_0x556fe5[_0x7fa2('0x48')],{})[_0x7fa2('0x24')](respondWithResult(_0x5443a2,0xc9))['catch'](handleError(_0x5443a2,null));};exports[_0x7fa2('0x23')]=function(_0xf44b7c,_0x336134){if(_0xf44b7c[_0x7fa2('0x48')]['id']){delete _0xf44b7c[_0x7fa2('0x48')]['id'];}return db[_0x7fa2('0x2b')]['find']({'where':{'id':_0xf44b7c[_0x7fa2('0x45')]['id']}})['then'](handleEntityNotFound(_0x336134,null))['then'](saveUpdates(_0xf44b7c[_0x7fa2('0x48')],null))[_0x7fa2('0x24')](respondWithResult(_0x336134,null))[_0x7fa2('0x44')](handleError(_0x336134,null));};exports[_0x7fa2('0x25')]=function(_0x46d329,_0x1fef8a){return db[_0x7fa2('0x2b')][_0x7fa2('0x46')]({'where':{'id':_0x46d329[_0x7fa2('0x45')]['id']}})['then'](handleEntityNotFound(_0x1fef8a,null))[_0x7fa2('0x24')](removeEntity(_0x1fef8a,null))[_0x7fa2('0x44')](handleError(_0x1fef8a,null));};exports[_0x7fa2('0x49')]=function(_0x447a10,_0x53c35c,_0x520af1){var _0x582912={};var _0x11bd2e={};var _0x43db38;var _0x4c5b86;return db[_0x7fa2('0x2b')][_0x7fa2('0x4a')]({'where':{'id':_0x447a10[_0x7fa2('0x45')]['id']}})['then'](handleEntityNotFound(_0x53c35c,null))[_0x7fa2('0x24')](function(_0x4d9880){if(_0x4d9880){_0x43db38=_0x4d9880;_0x11bd2e[_0x7fa2('0x2e')]=_[_0x7fa2('0x30')](db['ZohoField'][_0x7fa2('0x2c')]);_0x11bd2e[_0x7fa2('0x2f')]=_[_0x7fa2('0x30')](_0x447a10[_0x7fa2('0x2f')]);_0x11bd2e[_0x7fa2('0x31')]=_[_0x7fa2('0x32')](_0x11bd2e['model'],_0x11bd2e['query']);_0x582912[_0x7fa2('0x33')]=_[_0x7fa2('0x32')](_0x11bd2e[_0x7fa2('0x2e')],qs[_0x7fa2('0x34')](_0x447a10['query'][_0x7fa2('0x34')]));_0x582912[_0x7fa2('0x33')]=_0x582912[_0x7fa2('0x33')][_0x7fa2('0x4b')]?_0x582912[_0x7fa2('0x33')]:_0x11bd2e[_0x7fa2('0x2e')];_0x582912[_0x7fa2('0x37')]=qs[_0x7fa2('0x38')](_0x447a10[_0x7fa2('0x2f')][_0x7fa2('0x38')]);_0x582912[_0x7fa2('0x39')]=qs[_0x7fa2('0x31')](_[_0x7fa2('0x3a')](_0x447a10['query'],_0x11bd2e['filters']));if(_0x447a10['query'][_0x7fa2('0x3b')]){_0x582912[_0x7fa2('0x39')]=_[_0x7fa2('0x3c')](_0x582912[_0x7fa2('0x39')],{'$or':_['map'](_0x582912[_0x7fa2('0x33')],function(_0x10c46c){var _0x4a7be3={};_0x4a7be3[_0x10c46c]={'$like':'%'+_0x447a10[_0x7fa2('0x2f')]['filter']+'%'};return _0x4a7be3;})});}_0x582912=_['merge']({},_0x582912,_0x447a10[_0x7fa2('0x3f')]);return _0x43db38['getFields'](_0x582912);}})['then'](function(_0x14db58){if(_0x14db58){_0x4c5b86=_0x14db58[_0x7fa2('0x4b')];if(!_0x447a10[_0x7fa2('0x2f')][_0x7fa2('0x35')](_0x7fa2('0x36'))){_0x582912[_0x7fa2('0x1c')]=qs[_0x7fa2('0x1c')](_0x447a10[_0x7fa2('0x2f')]['limit']);_0x582912[_0x7fa2('0x19')]=qs['offset'](_0x447a10[_0x7fa2('0x2f')][_0x7fa2('0x19')]);}return _0x43db38['getFields'](_0x582912);}})[_0x7fa2('0x24')](function(_0x50895e){if(_0x50895e){return _0x50895e?{'count':_0x4c5b86,'rows':_0x50895e}:null;}})[_0x7fa2('0x24')](respondWithResult(_0x53c35c,null))[_0x7fa2('0x44')](handleError(_0x53c35c,null));};exports[_0x7fa2('0x4c')]=function(_0x2ec0b0,_0x4e8d4f,_0xe8cdf4){var _0x1fac1a={};var _0x5ec33c={};var _0x49beb4;var _0x312327;return db['ZohoConfiguration'][_0x7fa2('0x4a')]({'where':{'id':_0x2ec0b0['params']['id']}})[_0x7fa2('0x24')](handleEntityNotFound(_0x4e8d4f,null))[_0x7fa2('0x24')](function(_0x2e8e68){if(_0x2e8e68){_0x49beb4=_0x2e8e68;_0x5ec33c['model']=_[_0x7fa2('0x30')](db[_0x7fa2('0x4d')][_0x7fa2('0x2c')]);_0x5ec33c[_0x7fa2('0x2f')]=_['keys'](_0x2ec0b0[_0x7fa2('0x2f')]);_0x5ec33c[_0x7fa2('0x31')]=_[_0x7fa2('0x32')](_0x5ec33c[_0x7fa2('0x2e')],_0x5ec33c[_0x7fa2('0x2f')]);_0x1fac1a[_0x7fa2('0x33')]=_['intersection'](_0x5ec33c[_0x7fa2('0x2e')],qs[_0x7fa2('0x34')](_0x2ec0b0[_0x7fa2('0x2f')][_0x7fa2('0x34')]));_0x1fac1a[_0x7fa2('0x33')]=_0x1fac1a[_0x7fa2('0x33')][_0x7fa2('0x4b')]?_0x1fac1a['attributes']:_0x5ec33c[_0x7fa2('0x2e')];_0x1fac1a[_0x7fa2('0x37')]=qs[_0x7fa2('0x38')](_0x2ec0b0[_0x7fa2('0x2f')]['sort']);_0x1fac1a[_0x7fa2('0x39')]=qs['filters'](_[_0x7fa2('0x3a')](_0x2ec0b0[_0x7fa2('0x2f')],_0x5ec33c[_0x7fa2('0x31')]));if(_0x2ec0b0[_0x7fa2('0x2f')]['filter']){_0x1fac1a[_0x7fa2('0x39')]=_[_0x7fa2('0x3c')](_0x1fac1a['where'],{'$or':_[_0x7fa2('0x2a')](_0x1fac1a['attributes'],function(_0x1e55a4){var _0x50d5d1={};_0x50d5d1[_0x1e55a4]={'$like':'%'+_0x2ec0b0['query'][_0x7fa2('0x3b')]+'%'};return _0x50d5d1;})});}_0x1fac1a=_['merge']({},_0x1fac1a,_0x2ec0b0['options']);return _0x49beb4[_0x7fa2('0x4c')](_0x1fac1a);}})[_0x7fa2('0x24')](function(_0x4eb684){if(_0x4eb684){_0x312327=_0x4eb684['length'];if(!_0x2ec0b0[_0x7fa2('0x2f')][_0x7fa2('0x35')](_0x7fa2('0x36'))){_0x1fac1a[_0x7fa2('0x1c')]=qs[_0x7fa2('0x1c')](_0x2ec0b0[_0x7fa2('0x2f')][_0x7fa2('0x1c')]);_0x1fac1a[_0x7fa2('0x19')]=qs['offset'](_0x2ec0b0[_0x7fa2('0x2f')][_0x7fa2('0x19')]);}return _0x49beb4[_0x7fa2('0x4c')](_0x1fac1a);}})['then'](function(_0x281043){if(_0x281043){return _0x281043?{'count':_0x312327,'rows':_0x281043}:null;}})[_0x7fa2('0x24')](respondWithResult(_0x4e8d4f,null))['catch'](handleError(_0x4e8d4f,null));};exports[_0x7fa2('0x4e')]=function(_0x342fc6,_0x1fb1a8,_0x152630){var _0x30818={};var _0x927888={};var _0x58d707;var _0x1c3db8;return db[_0x7fa2('0x2b')][_0x7fa2('0x4a')]({'where':{'id':_0x342fc6[_0x7fa2('0x45')]['id']}})[_0x7fa2('0x24')](handleEntityNotFound(_0x1fb1a8,null))[_0x7fa2('0x24')](function(_0x5b41d6){if(_0x5b41d6){_0x58d707=_0x5b41d6;_0x927888[_0x7fa2('0x2e')]=_[_0x7fa2('0x30')](db[_0x7fa2('0x4d')]['rawAttributes']);_0x927888[_0x7fa2('0x2f')]=_[_0x7fa2('0x30')](_0x342fc6['query']);_0x927888[_0x7fa2('0x31')]=_[_0x7fa2('0x32')](_0x927888[_0x7fa2('0x2e')],_0x927888[_0x7fa2('0x2f')]);_0x30818[_0x7fa2('0x33')]=_[_0x7fa2('0x32')](_0x927888[_0x7fa2('0x2e')],qs['fields'](_0x342fc6[_0x7fa2('0x2f')][_0x7fa2('0x34')]));_0x30818[_0x7fa2('0x33')]=_0x30818[_0x7fa2('0x33')][_0x7fa2('0x4b')]?_0x30818[_0x7fa2('0x33')]:_0x927888[_0x7fa2('0x2e')];_0x30818[_0x7fa2('0x37')]=qs[_0x7fa2('0x38')](_0x342fc6['query']['sort']);_0x30818[_0x7fa2('0x39')]=qs[_0x7fa2('0x31')](_[_0x7fa2('0x3a')](_0x342fc6[_0x7fa2('0x2f')],_0x927888[_0x7fa2('0x31')]));if(_0x342fc6[_0x7fa2('0x2f')][_0x7fa2('0x3b')]){_0x30818[_0x7fa2('0x39')]=_['merge'](_0x30818[_0x7fa2('0x39')],{'$or':_[_0x7fa2('0x2a')](_0x30818[_0x7fa2('0x33')],function(_0x3f17f7){var _0x12a68d={};_0x12a68d[_0x3f17f7]={'$like':'%'+_0x342fc6[_0x7fa2('0x2f')][_0x7fa2('0x3b')]+'%'};return _0x12a68d;})});}_0x30818=_[_0x7fa2('0x3c')]({},_0x30818,_0x342fc6[_0x7fa2('0x3f')]);return _0x58d707[_0x7fa2('0x4e')](_0x30818);}})[_0x7fa2('0x24')](function(_0x5bc8d1){if(_0x5bc8d1){_0x1c3db8=_0x5bc8d1['length'];if(!_0x342fc6['query'][_0x7fa2('0x35')](_0x7fa2('0x36'))){_0x30818['limit']=qs[_0x7fa2('0x1c')](_0x342fc6[_0x7fa2('0x2f')][_0x7fa2('0x1c')]);_0x30818[_0x7fa2('0x19')]=qs[_0x7fa2('0x19')](_0x342fc6[_0x7fa2('0x2f')][_0x7fa2('0x19')]);}return _0x58d707['getDescriptions'](_0x30818);}})[_0x7fa2('0x24')](function(_0x123756){if(_0x123756){return _0x123756?{'count':_0x1c3db8,'rows':_0x123756}:null;}})['then'](respondWithResult(_0x1fb1a8,null))['catch'](handleError(_0x1fb1a8,null));}; \ No newline at end of file +var _0x8dad=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','update','then','error','name','send','map','fieldName','type','key','query','filters','model','intersection','attributes','length','nolimit','sort','where','merge','VIRTUAL','filter','options','ZohoConfiguration','include','rows','catch','params','keys','rawAttributes','fields','includeAll','find','create','body','getFields','findOne','ZohoField','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path'];(function(_0x21c09f,_0x6ce866){var _0x164d58=function(_0x3f94c1){while(--_0x3f94c1){_0x21c09f['push'](_0x21c09f['shift']());}};_0x164d58(++_0x6ce866);}(_0x8dad,0x91));var _0xd8da=function(_0x1040d3,_0x1e16a9){_0x1040d3=_0x1040d3-0x0;var _0x5ddc33=_0x8dad[_0x1040d3];return _0x5ddc33;};'use strict';var emlformat=require(_0xd8da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8da('0x1'));var jsonpatch=require(_0xd8da('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd8da('0x3'));var Mustache=require(_0xd8da('0x4'));var util=require(_0xd8da('0x5'));var path=require(_0xd8da('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd8da('0x7'));var fs=require('fs');var fs_extra=require(_0xd8da('0x8'));var _=require(_0xd8da('0x9'));var squel=require(_0xd8da('0xa'));var crypto=require(_0xd8da('0xb'));var jsforce=require(_0xd8da('0xc'));var deskjs=require(_0xd8da('0xd'));var toCsv=require(_0xd8da('0xe'));var querystring=require(_0xd8da('0xf'));var Papa=require(_0xd8da('0x10'));var Redis=require(_0xd8da('0x11'));var authService=require(_0xd8da('0x12'));var qs=require(_0xd8da('0x13'));var as=require(_0xd8da('0x14'));var hardwareService=require(_0xd8da('0x15'));var logger=require(_0xd8da('0x16'))(_0xd8da('0x17'));var utils=require('../../config/utils');var config=require(_0xd8da('0x18'));var licenseUtil=require(_0xd8da('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15933f,_0x4e9dcd){_0x4e9dcd=_0x4e9dcd||0xcc;return function(_0x22cd3d){if(_0x22cd3d){return _0x15933f[_0xd8da('0x1a')](_0x4e9dcd);}return _0x15933f['status'](_0x4e9dcd)['end']();};}function respondWithResult(_0x48589d,_0xf41e48){_0xf41e48=_0xf41e48||0xc8;return function(_0x26a3d6){if(_0x26a3d6){return _0x48589d[_0xd8da('0x1b')](_0xf41e48)[_0xd8da('0x1c')](_0x26a3d6);}};}function respondWithFilteredResult(_0x44d16c,_0x3729dd){return function(_0x5ac364){if(_0x5ac364){var _0x115977=typeof _0x3729dd['offset']===_0xd8da('0x1d')&&typeof _0x3729dd[_0xd8da('0x1e')]==='undefined';var _0x50fdbd=_0x5ac364[_0xd8da('0x1f')];var _0x5d290b=_0x115977?0x0:_0x3729dd[_0xd8da('0x20')];var _0x1109e3=_0x115977?_0x5ac364['count']:_0x3729dd['offset']+_0x3729dd[_0xd8da('0x1e')];var _0x1bc9da;if(_0x1109e3>=_0x50fdbd){_0x1109e3=_0x50fdbd;_0x1bc9da=0xc8;}else{_0x1bc9da=0xce;}_0x44d16c[_0xd8da('0x1b')](_0x1bc9da);return _0x44d16c['set'](_0xd8da('0x21'),_0x5d290b+'-'+_0x1109e3+'/'+_0x50fdbd)[_0xd8da('0x1c')](_0x5ac364);}return null;};}function patchUpdates(_0x18302c){return function(_0x2de52b){try{jsonpatch[_0xd8da('0x22')](_0x2de52b,_0x18302c,!![]);}catch(_0x295445){return BPromise['reject'](_0x295445);}return _0x2de52b['save']();};}function saveUpdates(_0x1fac2,_0x176e20){return function(_0x24766c){if(_0x24766c){return _0x24766c[_0xd8da('0x23')](_0x1fac2)[_0xd8da('0x24')](function(_0x291905){return _0x291905;});}return null;};}function removeEntity(_0x26c18b,_0x3df549){return function(_0x1faefe){if(_0x1faefe){return _0x1faefe['destroy']()['then'](function(){_0x26c18b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x458cf5,_0x5bda87){return function(_0x1ae881){if(!_0x1ae881){_0x458cf5['sendStatus'](0x194);}return _0x1ae881;};}function handleError(_0x316308,_0x2ddca0){_0x2ddca0=_0x2ddca0||0x1f4;return function(_0x1b4fb4){logger[_0xd8da('0x25')](_0x1b4fb4['stack']);if(_0x1b4fb4[_0xd8da('0x26')]){delete _0x1b4fb4['name'];}_0x316308[_0xd8da('0x1b')](_0x2ddca0)[_0xd8da('0x27')](_0x1b4fb4);};}exports['index']=function(_0x440fad,_0x15ec83){var _0x456daa={},_0x54cd18={},_0x3fb435={'count':0x0,'rows':[]};var _0x28be9e=_[_0xd8da('0x28')](db['ZohoConfiguration']['rawAttributes'],function(_0x4ac95f){return{'name':_0x4ac95f[_0xd8da('0x29')],'type':_0x4ac95f[_0xd8da('0x2a')][_0xd8da('0x2b')]};});_0x54cd18['model']=_[_0xd8da('0x28')](_0x28be9e,_0xd8da('0x26'));_0x54cd18[_0xd8da('0x2c')]=_['keys'](_0x440fad[_0xd8da('0x2c')]);_0x54cd18[_0xd8da('0x2d')]=_['intersection'](_0x54cd18[_0xd8da('0x2e')],_0x54cd18[_0xd8da('0x2c')]);_0x456daa['attributes']=_[_0xd8da('0x2f')](_0x54cd18[_0xd8da('0x2e')],qs['fields'](_0x440fad['query']['fields']));_0x456daa[_0xd8da('0x30')]=_0x456daa[_0xd8da('0x30')][_0xd8da('0x31')]?_0x456daa[_0xd8da('0x30')]:_0x54cd18[_0xd8da('0x2e')];if(!_0x440fad[_0xd8da('0x2c')]['hasOwnProperty'](_0xd8da('0x32'))){_0x456daa[_0xd8da('0x1e')]=qs[_0xd8da('0x1e')](_0x440fad[_0xd8da('0x2c')][_0xd8da('0x1e')]);_0x456daa[_0xd8da('0x20')]=qs[_0xd8da('0x20')](_0x440fad[_0xd8da('0x2c')][_0xd8da('0x20')]);}_0x456daa['order']=qs[_0xd8da('0x33')](_0x440fad[_0xd8da('0x2c')][_0xd8da('0x33')]);_0x456daa[_0xd8da('0x34')]=qs[_0xd8da('0x2d')](_['pick'](_0x440fad[_0xd8da('0x2c')],_0x54cd18[_0xd8da('0x2d')]),_0x28be9e);if(_0x440fad[_0xd8da('0x2c')]['filter']){_0x456daa[_0xd8da('0x34')]=_[_0xd8da('0x35')](_0x456daa['where'],{'$or':_['map'](_0x28be9e,function(_0x2aa02a){if(_0x2aa02a[_0xd8da('0x2a')]!==_0xd8da('0x36')){var _0x216a88={};_0x216a88[_0x2aa02a[_0xd8da('0x26')]]={'$like':'%'+_0x440fad[_0xd8da('0x2c')][_0xd8da('0x37')]+'%'};return _0x216a88;}})});}_0x456daa=_[_0xd8da('0x35')]({},_0x456daa,_0x440fad[_0xd8da('0x38')]);var _0x27f8e9={'where':_0x456daa['where']};return db[_0xd8da('0x39')][_0xd8da('0x1f')](_0x27f8e9)[_0xd8da('0x24')](function(_0x207893){_0x3fb435[_0xd8da('0x1f')]=_0x207893;if(_0x440fad['query']['includeAll']){_0x456daa[_0xd8da('0x3a')]=[{'all':!![]}];}return db[_0xd8da('0x39')]['findAll'](_0x456daa);})[_0xd8da('0x24')](function(_0x4aa447){_0x3fb435[_0xd8da('0x3b')]=_0x4aa447;return _0x3fb435;})[_0xd8da('0x24')](respondWithFilteredResult(_0x15ec83,_0x456daa))[_0xd8da('0x3c')](handleError(_0x15ec83,null));};exports['show']=function(_0x49676f,_0x8ebdcd){var _0x94bfa5={'raw':![],'where':{'id':_0x49676f[_0xd8da('0x3d')]['id']}},_0x4ba090={};_0x4ba090[_0xd8da('0x2e')]=_[_0xd8da('0x3e')](db[_0xd8da('0x39')][_0xd8da('0x3f')]);_0x4ba090[_0xd8da('0x2c')]=_['keys'](_0x49676f[_0xd8da('0x2c')]);_0x4ba090[_0xd8da('0x2d')]=_[_0xd8da('0x2f')](_0x4ba090[_0xd8da('0x2e')],_0x4ba090[_0xd8da('0x2c')]);_0x94bfa5[_0xd8da('0x30')]=_['intersection'](_0x4ba090[_0xd8da('0x2e')],qs[_0xd8da('0x40')](_0x49676f[_0xd8da('0x2c')][_0xd8da('0x40')]));_0x94bfa5[_0xd8da('0x30')]=_0x94bfa5[_0xd8da('0x30')][_0xd8da('0x31')]?_0x94bfa5[_0xd8da('0x30')]:_0x4ba090[_0xd8da('0x2e')];if(_0x49676f['query'][_0xd8da('0x41')]){_0x94bfa5[_0xd8da('0x3a')]=[{'all':!![]}];}_0x94bfa5=_[_0xd8da('0x35')]({},_0x94bfa5,_0x49676f['options']);return db[_0xd8da('0x39')][_0xd8da('0x42')](_0x94bfa5)[_0xd8da('0x24')](handleEntityNotFound(_0x8ebdcd,null))['then'](respondWithResult(_0x8ebdcd,null))['catch'](handleError(_0x8ebdcd,null));};exports[_0xd8da('0x43')]=function(_0x361df0,_0x634f2e){return db[_0xd8da('0x39')][_0xd8da('0x43')](_0x361df0['body'],{})[_0xd8da('0x24')](respondWithResult(_0x634f2e,0xc9))[_0xd8da('0x3c')](handleError(_0x634f2e,null));};exports[_0xd8da('0x23')]=function(_0x3cdd2d,_0x4e3dee){if(_0x3cdd2d['body']['id']){delete _0x3cdd2d[_0xd8da('0x44')]['id'];}return db[_0xd8da('0x39')][_0xd8da('0x42')]({'where':{'id':_0x3cdd2d[_0xd8da('0x3d')]['id']}})[_0xd8da('0x24')](handleEntityNotFound(_0x4e3dee,null))[_0xd8da('0x24')](saveUpdates(_0x3cdd2d[_0xd8da('0x44')],null))[_0xd8da('0x24')](respondWithResult(_0x4e3dee,null))[_0xd8da('0x3c')](handleError(_0x4e3dee,null));};exports['destroy']=function(_0x14a15d,_0x5792b2){return db['ZohoConfiguration'][_0xd8da('0x42')]({'where':{'id':_0x14a15d['params']['id']}})[_0xd8da('0x24')](handleEntityNotFound(_0x5792b2,null))[_0xd8da('0x24')](removeEntity(_0x5792b2,null))[_0xd8da('0x3c')](handleError(_0x5792b2,null));};exports[_0xd8da('0x45')]=function(_0x5845b3,_0x5b2484,_0x27b810){var _0x4e36e9={};var _0x3fb4e5={};var _0x329d68;var _0x303f74;return db[_0xd8da('0x39')][_0xd8da('0x46')]({'where':{'id':_0x5845b3[_0xd8da('0x3d')]['id']}})[_0xd8da('0x24')](handleEntityNotFound(_0x5b2484,null))[_0xd8da('0x24')](function(_0x1c020c){if(_0x1c020c){_0x329d68=_0x1c020c;_0x3fb4e5['model']=_[_0xd8da('0x3e')](db[_0xd8da('0x47')][_0xd8da('0x3f')]);_0x3fb4e5[_0xd8da('0x2c')]=_['keys'](_0x5845b3['query']);_0x3fb4e5[_0xd8da('0x2d')]=_[_0xd8da('0x2f')](_0x3fb4e5[_0xd8da('0x2e')],_0x3fb4e5[_0xd8da('0x2c')]);_0x4e36e9['attributes']=_['intersection'](_0x3fb4e5[_0xd8da('0x2e')],qs[_0xd8da('0x40')](_0x5845b3[_0xd8da('0x2c')][_0xd8da('0x40')]));_0x4e36e9[_0xd8da('0x30')]=_0x4e36e9[_0xd8da('0x30')][_0xd8da('0x31')]?_0x4e36e9[_0xd8da('0x30')]:_0x3fb4e5[_0xd8da('0x2e')];_0x4e36e9[_0xd8da('0x48')]=qs[_0xd8da('0x33')](_0x5845b3[_0xd8da('0x2c')][_0xd8da('0x33')]);_0x4e36e9[_0xd8da('0x34')]=qs[_0xd8da('0x2d')](_['pick'](_0x5845b3[_0xd8da('0x2c')],_0x3fb4e5['filters']));if(_0x5845b3[_0xd8da('0x2c')][_0xd8da('0x37')]){_0x4e36e9[_0xd8da('0x34')]=_['merge'](_0x4e36e9['where'],{'$or':_['map'](_0x4e36e9[_0xd8da('0x30')],function(_0x203bc8){var _0x176173={};_0x176173[_0x203bc8]={'$like':'%'+_0x5845b3['query'][_0xd8da('0x37')]+'%'};return _0x176173;})});}_0x4e36e9=_[_0xd8da('0x35')]({},_0x4e36e9,_0x5845b3[_0xd8da('0x38')]);return _0x329d68[_0xd8da('0x45')](_0x4e36e9);}})['then'](function(_0x27647e){if(_0x27647e){_0x303f74=_0x27647e[_0xd8da('0x31')];if(!_0x5845b3['query'][_0xd8da('0x49')](_0xd8da('0x32'))){_0x4e36e9[_0xd8da('0x1e')]=qs[_0xd8da('0x1e')](_0x5845b3[_0xd8da('0x2c')][_0xd8da('0x1e')]);_0x4e36e9[_0xd8da('0x20')]=qs[_0xd8da('0x20')](_0x5845b3[_0xd8da('0x2c')][_0xd8da('0x20')]);}return _0x329d68['getFields'](_0x4e36e9);}})[_0xd8da('0x24')](function(_0x17256b){if(_0x17256b){return _0x17256b?{'count':_0x303f74,'rows':_0x17256b}:null;}})[_0xd8da('0x24')](respondWithResult(_0x5b2484,null))[_0xd8da('0x3c')](handleError(_0x5b2484,null));};exports['getSubjects']=function(_0x34d69d,_0x524e3c,_0x4102d9){var _0x28a3f6={};var _0x4dff76={};var _0x543a52;var _0x1c5c07;return db[_0xd8da('0x39')][_0xd8da('0x46')]({'where':{'id':_0x34d69d[_0xd8da('0x3d')]['id']}})[_0xd8da('0x24')](handleEntityNotFound(_0x524e3c,null))['then'](function(_0x30f048){if(_0x30f048){_0x543a52=_0x30f048;_0x4dff76[_0xd8da('0x2e')]=_['keys'](db[_0xd8da('0x47')]['rawAttributes']);_0x4dff76[_0xd8da('0x2c')]=_[_0xd8da('0x3e')](_0x34d69d[_0xd8da('0x2c')]);_0x4dff76[_0xd8da('0x2d')]=_[_0xd8da('0x2f')](_0x4dff76[_0xd8da('0x2e')],_0x4dff76['query']);_0x28a3f6[_0xd8da('0x30')]=_[_0xd8da('0x2f')](_0x4dff76['model'],qs[_0xd8da('0x40')](_0x34d69d[_0xd8da('0x2c')][_0xd8da('0x40')]));_0x28a3f6[_0xd8da('0x30')]=_0x28a3f6[_0xd8da('0x30')][_0xd8da('0x31')]?_0x28a3f6[_0xd8da('0x30')]:_0x4dff76['model'];_0x28a3f6[_0xd8da('0x48')]=qs[_0xd8da('0x33')](_0x34d69d['query']['sort']);_0x28a3f6['where']=qs[_0xd8da('0x2d')](_['pick'](_0x34d69d['query'],_0x4dff76[_0xd8da('0x2d')]));if(_0x34d69d[_0xd8da('0x2c')][_0xd8da('0x37')]){_0x28a3f6[_0xd8da('0x34')]=_[_0xd8da('0x35')](_0x28a3f6[_0xd8da('0x34')],{'$or':_['map'](_0x28a3f6[_0xd8da('0x30')],function(_0x59f09c){var _0x3ca03c={};_0x3ca03c[_0x59f09c]={'$like':'%'+_0x34d69d[_0xd8da('0x2c')][_0xd8da('0x37')]+'%'};return _0x3ca03c;})});}_0x28a3f6=_['merge']({},_0x28a3f6,_0x34d69d[_0xd8da('0x38')]);return _0x543a52[_0xd8da('0x4a')](_0x28a3f6);}})[_0xd8da('0x24')](function(_0x588722){if(_0x588722){_0x1c5c07=_0x588722[_0xd8da('0x31')];if(!_0x34d69d[_0xd8da('0x2c')]['hasOwnProperty'](_0xd8da('0x32'))){_0x28a3f6['limit']=qs[_0xd8da('0x1e')](_0x34d69d[_0xd8da('0x2c')][_0xd8da('0x1e')]);_0x28a3f6[_0xd8da('0x20')]=qs[_0xd8da('0x20')](_0x34d69d['query'][_0xd8da('0x20')]);}return _0x543a52[_0xd8da('0x4a')](_0x28a3f6);}})[_0xd8da('0x24')](function(_0x31fd83){if(_0x31fd83){return _0x31fd83?{'count':_0x1c5c07,'rows':_0x31fd83}:null;}})[_0xd8da('0x24')](respondWithResult(_0x524e3c,null))[_0xd8da('0x3c')](handleError(_0x524e3c,null));};exports['getDescriptions']=function(_0x234520,_0x7762f3,_0x50cb72){var _0x4fe9c9={};var _0x58d07b={};var _0x123d49;var _0x117463;return db[_0xd8da('0x39')][_0xd8da('0x46')]({'where':{'id':_0x234520[_0xd8da('0x3d')]['id']}})[_0xd8da('0x24')](handleEntityNotFound(_0x7762f3,null))[_0xd8da('0x24')](function(_0x494607){if(_0x494607){_0x123d49=_0x494607;_0x58d07b[_0xd8da('0x2e')]=_[_0xd8da('0x3e')](db[_0xd8da('0x47')][_0xd8da('0x3f')]);_0x58d07b['query']=_[_0xd8da('0x3e')](_0x234520[_0xd8da('0x2c')]);_0x58d07b[_0xd8da('0x2d')]=_[_0xd8da('0x2f')](_0x58d07b['model'],_0x58d07b[_0xd8da('0x2c')]);_0x4fe9c9[_0xd8da('0x30')]=_[_0xd8da('0x2f')](_0x58d07b[_0xd8da('0x2e')],qs['fields'](_0x234520[_0xd8da('0x2c')][_0xd8da('0x40')]));_0x4fe9c9[_0xd8da('0x30')]=_0x4fe9c9[_0xd8da('0x30')][_0xd8da('0x31')]?_0x4fe9c9[_0xd8da('0x30')]:_0x58d07b['model'];_0x4fe9c9[_0xd8da('0x48')]=qs[_0xd8da('0x33')](_0x234520['query']['sort']);_0x4fe9c9[_0xd8da('0x34')]=qs[_0xd8da('0x2d')](_['pick'](_0x234520[_0xd8da('0x2c')],_0x58d07b['filters']));if(_0x234520[_0xd8da('0x2c')][_0xd8da('0x37')]){_0x4fe9c9[_0xd8da('0x34')]=_['merge'](_0x4fe9c9[_0xd8da('0x34')],{'$or':_[_0xd8da('0x28')](_0x4fe9c9[_0xd8da('0x30')],function(_0x395d43){var _0x212c1e={};_0x212c1e[_0x395d43]={'$like':'%'+_0x234520[_0xd8da('0x2c')][_0xd8da('0x37')]+'%'};return _0x212c1e;})});}_0x4fe9c9=_['merge']({},_0x4fe9c9,_0x234520[_0xd8da('0x38')]);return _0x123d49[_0xd8da('0x4b')](_0x4fe9c9);}})[_0xd8da('0x24')](function(_0x4067f1){if(_0x4067f1){_0x117463=_0x4067f1[_0xd8da('0x31')];if(!_0x234520[_0xd8da('0x2c')][_0xd8da('0x49')]('nolimit')){_0x4fe9c9[_0xd8da('0x1e')]=qs['limit'](_0x234520[_0xd8da('0x2c')]['limit']);_0x4fe9c9[_0xd8da('0x20')]=qs[_0xd8da('0x20')](_0x234520[_0xd8da('0x2c')][_0xd8da('0x20')]);}return _0x123d49['getDescriptions'](_0x4fe9c9);}})[_0xd8da('0x24')](function(_0x338e99){if(_0x338e99){return _0x338e99?{'count':_0x117463,'rows':_0x338e99}:null;}})[_0xd8da('0x24')](respondWithResult(_0x7762f3,null))[_0xd8da('0x3c')](handleError(_0x7762f3,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 4f4e9e4..a2e8f39 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 _0x3baa=['util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','ZohoConfiguration'];(function(_0x10839b,_0x220d8d){var _0x60f574=function(_0x4b1d57){while(--_0x4b1d57){_0x10839b['push'](_0x10839b['shift']());}};_0x60f574(++_0x220d8d);}(_0x3baa,0xbe));var _0xa3ba=function(_0x19ac3a,_0x24a96d){_0x19ac3a=_0x19ac3a-0x0;var _0x1053b8=_0x3baa[_0x19ac3a];return _0x1053b8;};'use strict';var _=require('lodash');var util=require(_0xa3ba('0x0'));var logger=require(_0xa3ba('0x1'))(_0xa3ba('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa3ba('0x3'));var fs=require('fs');var path=require(_0xa3ba('0x4'));var rimraf=require(_0xa3ba('0x5'));var config=require(_0xa3ba('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0xa3ba('0x7')]=function(_0x11f899,_0x1eddce){return _0x11f899[_0xa3ba('0x8')](_0xa3ba('0x9'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1fa=['request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0xc1fa,0x180));var _0xac1f=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0xc1fa[_0x45bf86];return _0x1f02b7;};'use strict';var _=require(_0xac1f('0x0'));var util=require(_0xac1f('0x1'));var logger=require(_0xac1f('0x2'))(_0xac1f('0x3'));var moment=require(_0xac1f('0x4'));var BPromise=require(_0xac1f('0x5'));var rp=require(_0xac1f('0x6'));var fs=require('fs');var path=require(_0xac1f('0x7'));var rimraf=require(_0xac1f('0x8'));var config=require(_0xac1f('0x9'));var attributes=require(_0xac1f('0xa'));module['exports']=function(_0x3ced2f,_0xc32d0c){return _0x3ced2f[_0xac1f('0xb')]('ZohoConfiguration',attributes,{'tableName':_0xac1f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index b006165..37c8228 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 _0xa170=['../../config/environment','jayson/promise','request','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x11a6bb,_0x82931c){var _0x5277e4=function(_0x8461d0){while(--_0x8461d0){_0x11a6bb['push'](_0x11a6bb['shift']());}};_0x5277e4(++_0x82931c);}(_0xa170,0x160));var _0x0a17=function(_0x3e00fc,_0x4e8f17){_0x3e00fc=_0x3e00fc-0x0;var _0x4dd87f=_0xa170[_0x3e00fc];return _0x4dd87f;};'use strict';var _=require(_0x0a17('0x0'));var util=require(_0x0a17('0x1'));var moment=require(_0x0a17('0x2'));var BPromise=require(_0x0a17('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a17('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a17('0x5'));var logger=require(_0x0a17('0x6'))(_0x0a17('0x7'));var config=require(_0x0a17('0x8'));var jayson=require(_0x0a17('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d41aa,_0x34ff28,_0x200e75){return new BPromise(function(_0x2391a9,_0x486e6e){return client[_0x0a17('0xa')](_0x3d41aa,_0x200e75)['then'](function(_0x21b0d0){logger['info'](_0x0a17('0xb'),_0x34ff28,_0x0a17('0xc'));logger[_0x0a17('0xd')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x34ff28,'request\x20sent',JSON[_0x0a17('0xe')](_0x21b0d0));if(_0x21b0d0['error']){if(_0x21b0d0[_0x0a17('0xf')]['code']===0x1f4){logger['error'](_0x0a17('0xb'),_0x34ff28,_0x21b0d0[_0x0a17('0xf')]['message']);return _0x486e6e(_0x21b0d0[_0x0a17('0xf')]['message']);}logger['error'](_0x0a17('0xb'),_0x34ff28,_0x21b0d0['error'][_0x0a17('0x10')]);return _0x2391a9(_0x21b0d0[_0x0a17('0xf')][_0x0a17('0x10')]);}else{logger[_0x0a17('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x34ff28,'request\x20sent');_0x2391a9(_0x21b0d0[_0x0a17('0x12')][_0x0a17('0x10')]);}})[_0x0a17('0x13')](function(_0x2138a3){logger[_0x0a17('0xf')](_0x0a17('0xb'),_0x34ff28,_0x2138a3);_0x486e6e(_0x2138a3);});});} \ No newline at end of file +var _0x446b=['debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ZohoConfiguration,\x20%s,\x20%s','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x446b,0x1bd));var _0xb446=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x446b[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xb446('0x0'));var util=require(_0xb446('0x1'));var moment=require('moment');var BPromise=require(_0xb446('0x2'));var rs=require(_0xb446('0x3'));var fs=require('fs');var Redis=require(_0xb446('0x4'));var db=require(_0xb446('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb446('0x6'))('rpc');var config=require(_0xb446('0x7'));var jayson=require(_0xb446('0x8'));var client=jayson[_0xb446('0x9')][_0xb446('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d1c58,_0x203250,_0x3dfb22){return new BPromise(function(_0xb537a,_0x411abc){return client[_0xb446('0xb')](_0x4d1c58,_0x3dfb22)[_0xb446('0xc')](function(_0x284a6b){logger[_0xb446('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x203250,_0xb446('0xe'));logger[_0xb446('0xf')](_0xb446('0x10'),_0x203250,'request\x20sent',JSON[_0xb446('0x11')](_0x284a6b));if(_0x284a6b[_0xb446('0x12')]){if(_0x284a6b['error'][_0xb446('0x13')]===0x1f4){logger[_0xb446('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x203250,_0x284a6b['error']['message']);return _0x411abc(_0x284a6b[_0xb446('0x12')][_0xb446('0x14')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x203250,_0x284a6b[_0xb446('0x12')][_0xb446('0x14')]);return _0xb537a(_0x284a6b[_0xb446('0x12')][_0xb446('0x14')]);}else{logger[_0xb446('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x203250,'request\x20sent');_0xb537a(_0x284a6b['result'][_0xb446('0x14')]);}})[_0xb446('0x15')](function(_0x2ce20c){logger[_0xb446('0x12')](_0xb446('0x16'),_0x203250,_0x2ce20c);_0x411abc(_0x2ce20c);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 1f29f47..32b73a4 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 _0x2984=['destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','show','post','isAuthenticated','create','put','delete'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2984,0x145));var _0x4298=function(_0x3cf053,_0x7a9947){_0x3cf053=_0x3cf053-0x0;var _0x3b55a0=_0x2984[_0x3cf053];return _0x3b55a0;};'use strict';var multer=require(_0x4298('0x0'));var util=require(_0x4298('0x1'));var path=require(_0x4298('0x2'));var timeout=require(_0x4298('0x3'));var express=require(_0x4298('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4298('0x5'));var config=require(_0x4298('0x6'));var controller=require(_0x4298('0x7'));router[_0x4298('0x8')]('/',auth['isAuthenticated'](),controller[_0x4298('0x9')]);router['get'](_0x4298('0xa'),auth['isAuthenticated'](),controller[_0x4298('0xb')]);router[_0x4298('0xc')]('/',auth[_0x4298('0xd')](),controller[_0x4298('0xe')]);router[_0x4298('0xf')](_0x4298('0xa'),auth[_0x4298('0xd')](),controller['update']);router[_0x4298('0x10')]('/:id',auth[_0x4298('0xd')](),controller[_0x4298('0x11')]);module[_0x4298('0x12')]=router; \ No newline at end of file +var _0x625d=['update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','post','create','put'];(function(_0x108831,_0x5e4f70){var _0x4da77a=function(_0x139446){while(--_0x139446){_0x108831['push'](_0x108831['shift']());}};_0x4da77a(++_0x5e4f70);}(_0x625d,0xd7));var _0xd625=function(_0x26ac6b,_0x3e0e21){_0x26ac6b=_0x26ac6b-0x0;var _0x1972ec=_0x625d[_0x26ac6b];return _0x1972ec;};'use strict';var multer=require(_0xd625('0x0'));var util=require(_0xd625('0x1'));var path=require(_0xd625('0x2'));var timeout=require(_0xd625('0x3'));var express=require(_0xd625('0x4'));var router=express['Router']();var fs_extra=require(_0xd625('0x5'));var auth=require(_0xd625('0x6'));var interaction=require(_0xd625('0x7'));var config=require(_0xd625('0x8'));var controller=require(_0xd625('0x9'));router[_0xd625('0xa')]('/',auth[_0xd625('0xb')](),controller[_0xd625('0xc')]);router['get']('/:id',auth[_0xd625('0xb')](),controller['show']);router[_0xd625('0xd')]('/',auth[_0xd625('0xb')](),controller[_0xd625('0xe')]);router[_0xd625('0xf')]('/:id',auth[_0xd625('0xb')](),controller[_0xd625('0x10')]);router[_0xd625('0x11')](_0xd625('0x12'),auth['isAuthenticated'](),controller[_0xd625('0x13')]);module[_0xd625('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index f81eaa9..a7948ad 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 _0x2c3a=['STRING','BOOLEAN','exports','variable','customVariable','picklist','string','ENUM'];(function(_0x4452a1,_0x1d50fa){var _0x2e5604=function(_0x198e90){while(--_0x198e90){_0x4452a1['push'](_0x4452a1['shift']());}};_0x2e5604(++_0x1d50fa);}(_0x2c3a,0x192));var _0xa2c3=function(_0x9c50ae,_0x3484e7){_0x9c50ae=_0x9c50ae-0x0;var _0xf4d23c=_0x2c3a[_0x9c50ae];return _0xf4d23c;};'use strict';var Sequelize=require('sequelize');module[_0xa2c3('0x0')]={'type':{'type':Sequelize['ENUM']('string',_0xa2c3('0x1'),_0xa2c3('0x2'),'keyValue',_0xa2c3('0x3')),'defaultValue':_0xa2c3('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xa2c3('0x5')](_0xa2c3('0x4'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa2c3('0x6')]},'customField':{'type':Sequelize[_0xa2c3('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa2c3('0x6')]}}; \ No newline at end of file +var _0xcb4f=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x13610a,_0x4f866c){var _0x150ecc=function(_0x383f46){while(--_0x383f46){_0x13610a['push'](_0x13610a['shift']());}};_0x150ecc(++_0x4f866c);}(_0xcb4f,0xa3));var _0xfcb4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xcb4f[_0x1caf6a];return _0x1bf493;};'use strict';var Sequelize=require(_0xfcb4('0x0'));module['exports']={'type':{'type':Sequelize[_0xfcb4('0x1')](_0xfcb4('0x2'),_0xfcb4('0x3'),_0xfcb4('0x4'),_0xfcb4('0x5'),_0xfcb4('0x6')),'defaultValue':_0xfcb4('0x2')},'content':{'type':Sequelize[_0xfcb4('0x7')]},'key':{'type':Sequelize[_0xfcb4('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0xfcb4('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xfcb4('0x7')]},'idField':{'type':Sequelize[_0xfcb4('0x7')]},'nameField':{'type':Sequelize[_0xfcb4('0x7')]},'customField':{'type':Sequelize[_0xfcb4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfcb4('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index ef24cba..e98f1aa 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 _0x330c=['key','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','rows','show','params','model','rawAttributes','include','find','catch','create','body','update','destroy','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','index','ZohoField','fieldName'];(function(_0x24dc4a,_0x49ed43){var _0x22c710=function(_0x5974ab){while(--_0x5974ab){_0x24dc4a['push'](_0x24dc4a['shift']());}};_0x22c710(++_0x49ed43);}(_0x330c,0x14e));var _0xc330=function(_0x539281,_0xeef1e){_0x539281=_0x539281-0x0;var _0x223040=_0x330c[_0x539281];return _0x223040;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc330('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc330('0x1'));var moment=require(_0xc330('0x2'));var BPromise=require(_0xc330('0x3'));var Mustache=require(_0xc330('0x4'));var util=require(_0xc330('0x5'));var path=require('path');var sox=require(_0xc330('0x6'));var csv=require(_0xc330('0x7'));var ejs=require(_0xc330('0x8'));var fs=require('fs');var fs_extra=require(_0xc330('0x9'));var _=require(_0xc330('0xa'));var squel=require(_0xc330('0xb'));var crypto=require('crypto');var jsforce=require(_0xc330('0xc'));var deskjs=require(_0xc330('0xd'));var toCsv=require(_0xc330('0x7'));var querystring=require(_0xc330('0xe'));var Papa=require(_0xc330('0xf'));var Redis=require(_0xc330('0x10'));var authService=require(_0xc330('0x11'));var qs=require(_0xc330('0x12'));var as=require(_0xc330('0x13'));var hardwareService=require(_0xc330('0x14'));var logger=require(_0xc330('0x15'))(_0xc330('0x16'));var utils=require(_0xc330('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc330('0x18'));var db=require(_0xc330('0x19'))['db'];function respondWithStatusCode(_0x2e5a2f,_0x204072){_0x204072=_0x204072||0xcc;return function(_0x311485){if(_0x311485){return _0x2e5a2f[_0xc330('0x1a')](_0x204072);}return _0x2e5a2f['status'](_0x204072)[_0xc330('0x1b')]();};}function respondWithResult(_0xb1e1e4,_0x50ec0c){_0x50ec0c=_0x50ec0c||0xc8;return function(_0x16c8bb){if(_0x16c8bb){return _0xb1e1e4[_0xc330('0x1c')](_0x50ec0c)[_0xc330('0x1d')](_0x16c8bb);}};}function respondWithFilteredResult(_0x20dc10,_0x2e8661){return function(_0x59ed0c){if(_0x59ed0c){var _0x37099a=typeof _0x2e8661[_0xc330('0x1e')]===_0xc330('0x1f')&&typeof _0x2e8661['limit']===_0xc330('0x1f');var _0x4f5742=_0x59ed0c[_0xc330('0x20')];var _0x2e5909=_0x37099a?0x0:_0x2e8661[_0xc330('0x1e')];var _0x192a7f=_0x37099a?_0x59ed0c[_0xc330('0x20')]:_0x2e8661[_0xc330('0x1e')]+_0x2e8661[_0xc330('0x21')];var _0x4e237a;if(_0x192a7f>=_0x4f5742){_0x192a7f=_0x4f5742;_0x4e237a=0xc8;}else{_0x4e237a=0xce;}_0x20dc10[_0xc330('0x1c')](_0x4e237a);return _0x20dc10[_0xc330('0x22')](_0xc330('0x23'),_0x2e5909+'-'+_0x192a7f+'/'+_0x4f5742)['json'](_0x59ed0c);}return null;};}function patchUpdates(_0x2badb1){return function(_0x26a15c){try{jsonpatch[_0xc330('0x24')](_0x26a15c,_0x2badb1,!![]);}catch(_0x1fb964){return BPromise[_0xc330('0x25')](_0x1fb964);}return _0x26a15c[_0xc330('0x26')]();};}function saveUpdates(_0x1e575f,_0x3add11){return function(_0x257a7d){if(_0x257a7d){return _0x257a7d['update'](_0x1e575f)['then'](function(_0x3949c3){return _0x3949c3;});}return null;};}function removeEntity(_0x39e47a,_0x7e1d16){return function(_0x4277d2){if(_0x4277d2){return _0x4277d2['destroy']()[_0xc330('0x27')](function(){_0x39e47a[_0xc330('0x1c')](0xcc)[_0xc330('0x1b')]();});}};}function handleEntityNotFound(_0x21781c,_0x486f46){return function(_0x159f52){if(!_0x159f52){_0x21781c['sendStatus'](0x194);}return _0x159f52;};}function handleError(_0x5eaf29,_0x417ecf){_0x417ecf=_0x417ecf||0x1f4;return function(_0x48d672){logger[_0xc330('0x28')](_0x48d672[_0xc330('0x29')]);if(_0x48d672['name']){delete _0x48d672[_0xc330('0x2a')];}_0x5eaf29[_0xc330('0x1c')](_0x417ecf)['send'](_0x48d672);};}exports[_0xc330('0x2b')]=function(_0x3cb744,_0x5939db){var _0x7ca696={},_0x10c4c5={},_0x405e6c={'count':0x0,'rows':[]};var _0xa96847=_['map'](db[_0xc330('0x2c')]['rawAttributes'],function(_0x4fcaea){return{'name':_0x4fcaea[_0xc330('0x2d')],'type':_0x4fcaea['type'][_0xc330('0x2e')]};});_0x10c4c5['model']=_[_0xc330('0x2f')](_0xa96847,_0xc330('0x2a'));_0x10c4c5[_0xc330('0x30')]=_[_0xc330('0x31')](_0x3cb744['query']);_0x10c4c5[_0xc330('0x32')]=_[_0xc330('0x33')](_0x10c4c5['model'],_0x10c4c5[_0xc330('0x30')]);_0x7ca696[_0xc330('0x34')]=_[_0xc330('0x33')](_0x10c4c5['model'],qs[_0xc330('0x35')](_0x3cb744[_0xc330('0x30')][_0xc330('0x35')]));_0x7ca696['attributes']=_0x7ca696['attributes'][_0xc330('0x36')]?_0x7ca696['attributes']:_0x10c4c5['model'];if(!_0x3cb744[_0xc330('0x30')]['hasOwnProperty'](_0xc330('0x37'))){_0x7ca696['limit']=qs[_0xc330('0x21')](_0x3cb744[_0xc330('0x30')]['limit']);_0x7ca696[_0xc330('0x1e')]=qs[_0xc330('0x1e')](_0x3cb744['query'][_0xc330('0x1e')]);}_0x7ca696[_0xc330('0x38')]=qs[_0xc330('0x39')](_0x3cb744[_0xc330('0x30')]['sort']);_0x7ca696[_0xc330('0x3a')]=qs['filters'](_[_0xc330('0x3b')](_0x3cb744[_0xc330('0x30')],_0x10c4c5[_0xc330('0x32')]),_0xa96847);if(_0x3cb744[_0xc330('0x30')]['filter']){_0x7ca696[_0xc330('0x3a')]=_[_0xc330('0x3c')](_0x7ca696[_0xc330('0x3a')],{'$or':_[_0xc330('0x2f')](_0xa96847,function(_0x3a2e2a){if(_0x3a2e2a['type']!=='VIRTUAL'){var _0x5b575c={};_0x5b575c[_0x3a2e2a[_0xc330('0x2a')]]={'$like':'%'+_0x3cb744['query'][_0xc330('0x3d')]+'%'};return _0x5b575c;}})});}_0x7ca696=_[_0xc330('0x3c')]({},_0x7ca696,_0x3cb744[_0xc330('0x3e')]);var _0x4b0c62={'where':_0x7ca696[_0xc330('0x3a')]};return db['ZohoField'][_0xc330('0x20')](_0x4b0c62)[_0xc330('0x27')](function(_0xcd0e42){_0x405e6c[_0xc330('0x20')]=_0xcd0e42;if(_0x3cb744[_0xc330('0x30')][_0xc330('0x3f')]){_0x7ca696['include']=[{'all':!![]}];}return db[_0xc330('0x2c')]['findAll'](_0x7ca696);})[_0xc330('0x27')](function(_0x37b22d){_0x405e6c[_0xc330('0x40')]=_0x37b22d;return _0x405e6c;})[_0xc330('0x27')](respondWithFilteredResult(_0x5939db,_0x7ca696))['catch'](handleError(_0x5939db,null));};exports[_0xc330('0x41')]=function(_0x50b9e9,_0x499a12){var _0x1c214b={'raw':!![],'where':{'id':_0x50b9e9[_0xc330('0x42')]['id']}},_0x86290={};_0x86290[_0xc330('0x43')]=_[_0xc330('0x31')](db[_0xc330('0x2c')][_0xc330('0x44')]);_0x86290[_0xc330('0x30')]=_[_0xc330('0x31')](_0x50b9e9[_0xc330('0x30')]);_0x86290[_0xc330('0x32')]=_[_0xc330('0x33')](_0x86290['model'],_0x86290[_0xc330('0x30')]);_0x1c214b[_0xc330('0x34')]=_[_0xc330('0x33')](_0x86290[_0xc330('0x43')],qs[_0xc330('0x35')](_0x50b9e9[_0xc330('0x30')][_0xc330('0x35')]));_0x1c214b[_0xc330('0x34')]=_0x1c214b[_0xc330('0x34')][_0xc330('0x36')]?_0x1c214b[_0xc330('0x34')]:_0x86290[_0xc330('0x43')];if(_0x50b9e9[_0xc330('0x30')][_0xc330('0x3f')]){_0x1c214b[_0xc330('0x45')]=[{'all':!![]}];}_0x1c214b=_['merge']({},_0x1c214b,_0x50b9e9[_0xc330('0x3e')]);return db[_0xc330('0x2c')][_0xc330('0x46')](_0x1c214b)[_0xc330('0x27')](handleEntityNotFound(_0x499a12,null))[_0xc330('0x27')](respondWithResult(_0x499a12,null))[_0xc330('0x47')](handleError(_0x499a12,null));};exports['create']=function(_0x8308ed,_0xac455d){return db[_0xc330('0x2c')][_0xc330('0x48')](_0x8308ed[_0xc330('0x49')],{})['then'](respondWithResult(_0xac455d,0xc9))['catch'](handleError(_0xac455d,null));};exports[_0xc330('0x4a')]=function(_0x38ce9e,_0x53c9dc){if(_0x38ce9e['body']['id']){delete _0x38ce9e['body']['id'];}return db['ZohoField'][_0xc330('0x46')]({'where':{'id':_0x38ce9e['params']['id']}})['then'](handleEntityNotFound(_0x53c9dc,null))[_0xc330('0x27')](saveUpdates(_0x38ce9e[_0xc330('0x49')],null))[_0xc330('0x27')](respondWithResult(_0x53c9dc,null))['catch'](handleError(_0x53c9dc,null));};exports[_0xc330('0x4b')]=function(_0x5c8845,_0x554412){return db[_0xc330('0x2c')][_0xc330('0x46')]({'where':{'id':_0x5c8845[_0xc330('0x42')]['id']}})[_0xc330('0x27')](handleEntityNotFound(_0x554412,null))[_0xc330('0x27')](removeEntity(_0x554412,null))[_0xc330('0x47')](handleError(_0x554412,null));}; \ No newline at end of file +var _0xaefc=['lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','index','ZohoField','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x59891d,_0x3388d6){var _0x33b5d9=function(_0x42e684){while(--_0x42e684){_0x59891d['push'](_0x59891d['shift']());}};_0x33b5d9(++_0x3388d6);}(_0xaefc,0x11a));var _0xcaef=function(_0x42c9e7,_0x2ca65b){_0x42c9e7=_0x42c9e7-0x0;var _0x5ec13a=_0xaefc[_0x42c9e7];return _0x5ec13a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcaef('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcaef('0x1'));var rp=require(_0xcaef('0x2'));var moment=require(_0xcaef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcaef('0x4'));var util=require(_0xcaef('0x5'));var path=require(_0xcaef('0x6'));var sox=require(_0xcaef('0x7'));var csv=require(_0xcaef('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcaef('0x9'));var _=require(_0xcaef('0xa'));var squel=require(_0xcaef('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcaef('0xc'));var toCsv=require(_0xcaef('0x8'));var querystring=require('querystring');var Papa=require(_0xcaef('0xd'));var Redis=require(_0xcaef('0xe'));var authService=require(_0xcaef('0xf'));var qs=require(_0xcaef('0x10'));var as=require(_0xcaef('0x11'));var hardwareService=require(_0xcaef('0x12'));var logger=require(_0xcaef('0x13'))(_0xcaef('0x14'));var utils=require(_0xcaef('0x15'));var config=require(_0xcaef('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4928cb,_0x4c8f70){_0x4c8f70=_0x4c8f70||0xcc;return function(_0xfba032){if(_0xfba032){return _0x4928cb[_0xcaef('0x17')](_0x4c8f70);}return _0x4928cb['status'](_0x4c8f70)[_0xcaef('0x18')]();};}function respondWithResult(_0x5ec47d,_0x42d74e){_0x42d74e=_0x42d74e||0xc8;return function(_0x54b035){if(_0x54b035){return _0x5ec47d[_0xcaef('0x19')](_0x42d74e)[_0xcaef('0x1a')](_0x54b035);}};}function respondWithFilteredResult(_0x14de07,_0x8a09fc){return function(_0x20f859){if(_0x20f859){var _0xc382c7=typeof _0x8a09fc[_0xcaef('0x1b')]===_0xcaef('0x1c')&&typeof _0x8a09fc[_0xcaef('0x1d')]===_0xcaef('0x1c');var _0x2c9be7=_0x20f859['count'];var _0x2c0616=_0xc382c7?0x0:_0x8a09fc[_0xcaef('0x1b')];var _0x49cd07=_0xc382c7?_0x20f859[_0xcaef('0x1e')]:_0x8a09fc['offset']+_0x8a09fc[_0xcaef('0x1d')];var _0x40f749;if(_0x49cd07>=_0x2c9be7){_0x49cd07=_0x2c9be7;_0x40f749=0xc8;}else{_0x40f749=0xce;}_0x14de07[_0xcaef('0x19')](_0x40f749);return _0x14de07[_0xcaef('0x1f')]('Content-Range',_0x2c0616+'-'+_0x49cd07+'/'+_0x2c9be7)[_0xcaef('0x1a')](_0x20f859);}return null;};}function patchUpdates(_0x19f801){return function(_0x45c528){try{jsonpatch['apply'](_0x45c528,_0x19f801,!![]);}catch(_0x256588){return BPromise[_0xcaef('0x20')](_0x256588);}return _0x45c528[_0xcaef('0x21')]();};}function saveUpdates(_0x3e51af,_0x10e9d0){return function(_0x184c47){if(_0x184c47){return _0x184c47[_0xcaef('0x22')](_0x3e51af)[_0xcaef('0x23')](function(_0x34a9ff){return _0x34a9ff;});}return null;};}function removeEntity(_0xb35aba,_0x975fed){return function(_0x58dec6){if(_0x58dec6){return _0x58dec6['destroy']()[_0xcaef('0x23')](function(){_0xb35aba['status'](0xcc)[_0xcaef('0x18')]();});}};}function handleEntityNotFound(_0xcb270b,_0x340021){return function(_0x165b43){if(!_0x165b43){_0xcb270b['sendStatus'](0x194);}return _0x165b43;};}function handleError(_0x745bac,_0x505157){_0x505157=_0x505157||0x1f4;return function(_0x454a2b){logger[_0xcaef('0x24')](_0x454a2b[_0xcaef('0x25')]);if(_0x454a2b['name']){delete _0x454a2b[_0xcaef('0x26')];}_0x745bac[_0xcaef('0x19')](_0x505157)['send'](_0x454a2b);};}exports[_0xcaef('0x27')]=function(_0x2a9d02,_0x5d5042){var _0x25d03d={},_0x2c79df={},_0x522723={'count':0x0,'rows':[]};var _0x25e3f9=_['map'](db[_0xcaef('0x28')][_0xcaef('0x29')],function(_0x3af140){return{'name':_0x3af140[_0xcaef('0x2a')],'type':_0x3af140[_0xcaef('0x2b')]['key']};});_0x2c79df['model']=_[_0xcaef('0x2c')](_0x25e3f9,'name');_0x2c79df[_0xcaef('0x2d')]=_[_0xcaef('0x2e')](_0x2a9d02[_0xcaef('0x2d')]);_0x2c79df[_0xcaef('0x2f')]=_['intersection'](_0x2c79df[_0xcaef('0x30')],_0x2c79df[_0xcaef('0x2d')]);_0x25d03d[_0xcaef('0x31')]=_[_0xcaef('0x32')](_0x2c79df['model'],qs[_0xcaef('0x33')](_0x2a9d02[_0xcaef('0x2d')][_0xcaef('0x33')]));_0x25d03d[_0xcaef('0x31')]=_0x25d03d[_0xcaef('0x31')][_0xcaef('0x34')]?_0x25d03d[_0xcaef('0x31')]:_0x2c79df[_0xcaef('0x30')];if(!_0x2a9d02[_0xcaef('0x2d')][_0xcaef('0x35')](_0xcaef('0x36'))){_0x25d03d[_0xcaef('0x1d')]=qs[_0xcaef('0x1d')](_0x2a9d02[_0xcaef('0x2d')]['limit']);_0x25d03d[_0xcaef('0x1b')]=qs[_0xcaef('0x1b')](_0x2a9d02[_0xcaef('0x2d')][_0xcaef('0x1b')]);}_0x25d03d[_0xcaef('0x37')]=qs[_0xcaef('0x38')](_0x2a9d02[_0xcaef('0x2d')]['sort']);_0x25d03d[_0xcaef('0x39')]=qs['filters'](_[_0xcaef('0x3a')](_0x2a9d02[_0xcaef('0x2d')],_0x2c79df[_0xcaef('0x2f')]),_0x25e3f9);if(_0x2a9d02[_0xcaef('0x2d')][_0xcaef('0x3b')]){_0x25d03d[_0xcaef('0x39')]=_[_0xcaef('0x3c')](_0x25d03d[_0xcaef('0x39')],{'$or':_['map'](_0x25e3f9,function(_0x23a6c8){if(_0x23a6c8[_0xcaef('0x2b')]!=='VIRTUAL'){var _0x324eb4={};_0x324eb4[_0x23a6c8[_0xcaef('0x26')]]={'$like':'%'+_0x2a9d02['query'][_0xcaef('0x3b')]+'%'};return _0x324eb4;}})});}_0x25d03d=_['merge']({},_0x25d03d,_0x2a9d02[_0xcaef('0x3d')]);var _0x5a721b={'where':_0x25d03d[_0xcaef('0x39')]};return db[_0xcaef('0x28')][_0xcaef('0x1e')](_0x5a721b)[_0xcaef('0x23')](function(_0x5c04d3){_0x522723[_0xcaef('0x1e')]=_0x5c04d3;if(_0x2a9d02[_0xcaef('0x2d')][_0xcaef('0x3e')]){_0x25d03d[_0xcaef('0x3f')]=[{'all':!![]}];}return db[_0xcaef('0x28')][_0xcaef('0x40')](_0x25d03d);})[_0xcaef('0x23')](function(_0x11ee58){_0x522723[_0xcaef('0x41')]=_0x11ee58;return _0x522723;})[_0xcaef('0x23')](respondWithFilteredResult(_0x5d5042,_0x25d03d))[_0xcaef('0x42')](handleError(_0x5d5042,null));};exports[_0xcaef('0x43')]=function(_0x2fe2ab,_0x47d8fc){var _0x397211={'raw':!![],'where':{'id':_0x2fe2ab[_0xcaef('0x44')]['id']}},_0x3c6f35={};_0x3c6f35[_0xcaef('0x30')]=_[_0xcaef('0x2e')](db['ZohoField'][_0xcaef('0x29')]);_0x3c6f35[_0xcaef('0x2d')]=_[_0xcaef('0x2e')](_0x2fe2ab['query']);_0x3c6f35[_0xcaef('0x2f')]=_[_0xcaef('0x32')](_0x3c6f35[_0xcaef('0x30')],_0x3c6f35[_0xcaef('0x2d')]);_0x397211[_0xcaef('0x31')]=_[_0xcaef('0x32')](_0x3c6f35[_0xcaef('0x30')],qs[_0xcaef('0x33')](_0x2fe2ab[_0xcaef('0x2d')]['fields']));_0x397211[_0xcaef('0x31')]=_0x397211[_0xcaef('0x31')]['length']?_0x397211[_0xcaef('0x31')]:_0x3c6f35[_0xcaef('0x30')];if(_0x2fe2ab[_0xcaef('0x2d')][_0xcaef('0x3e')]){_0x397211[_0xcaef('0x3f')]=[{'all':!![]}];}_0x397211=_[_0xcaef('0x3c')]({},_0x397211,_0x2fe2ab[_0xcaef('0x3d')]);return db[_0xcaef('0x28')][_0xcaef('0x45')](_0x397211)[_0xcaef('0x23')](handleEntityNotFound(_0x47d8fc,null))[_0xcaef('0x23')](respondWithResult(_0x47d8fc,null))[_0xcaef('0x42')](handleError(_0x47d8fc,null));};exports[_0xcaef('0x46')]=function(_0x290586,_0x3e9219){return db[_0xcaef('0x28')]['create'](_0x290586[_0xcaef('0x47')],{})[_0xcaef('0x23')](respondWithResult(_0x3e9219,0xc9))['catch'](handleError(_0x3e9219,null));};exports['update']=function(_0x519b66,_0x540ec2){if(_0x519b66[_0xcaef('0x47')]['id']){delete _0x519b66[_0xcaef('0x47')]['id'];}return db[_0xcaef('0x28')][_0xcaef('0x45')]({'where':{'id':_0x519b66['params']['id']}})[_0xcaef('0x23')](handleEntityNotFound(_0x540ec2,null))[_0xcaef('0x23')](saveUpdates(_0x519b66[_0xcaef('0x47')],null))['then'](respondWithResult(_0x540ec2,null))[_0xcaef('0x42')](handleError(_0x540ec2,null));};exports[_0xcaef('0x48')]=function(_0xab9c7,_0x2ef8a7){return db[_0xcaef('0x28')][_0xcaef('0x45')]({'where':{'id':_0xab9c7[_0xcaef('0x44')]['id']}})[_0xcaef('0x23')](handleEntityNotFound(_0x2ef8a7,null))['then'](removeEntity(_0x2ef8a7,null))[_0xcaef('0x42')](handleError(_0x2ef8a7,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index e1d8400..478b4af 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 _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZohoField','int_zoho_fields','lodash','util'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x1a37,0xb4));var _0x71a3=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x1a37[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./intZohoField.attributes');module[_0x71a3('0xa')]=function(_0x4f6b7a,_0xd09f7){return _0x4f6b7a[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':_0x71a3('0xd'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x57ca=['moment','bluebird','request-promise','path','rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','util','../../config/logger'];(function(_0x16e6bf,_0x316c1c){var _0x12c827=function(_0x58e58d){while(--_0x58e58d){_0x16e6bf['push'](_0x16e6bf['shift']());}};_0x12c827(++_0x316c1c);}(_0x57ca,0x108));var _0xa57c=function(_0x32325c,_0x53c868){_0x32325c=_0x32325c-0x0;var _0x293fff=_0x57ca[_0x32325c];return _0x293fff;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var fs=require('fs');var path=require(_0xa57c('0x5'));var rimraf=require(_0xa57c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa57c('0x7'));module[_0xa57c('0x8')]=function(_0x113dcf,_0x19473f){return _0x113dcf[_0xa57c('0x9')](_0xa57c('0xa'),attributes,{'tableName':_0xa57c('0xb'),'paranoid':![],'indexes':[{'name':_0xa57c('0xc'),'fields':['idField',_0xa57c('0xd')],'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 d8f80fc..0614500 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 _0xe92f=['jayson/promise','request','then','debug','request\x20sent','stringify','error','code','ZohoField,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x597f70,_0x1efe11){var _0x56701d=function(_0x3c36b1){while(--_0x3c36b1){_0x597f70['push'](_0x597f70['shift']());}};_0x56701d(++_0x1efe11);}(_0xe92f,0x146));var _0xfe92=function(_0x37ba34,_0x42b8db){_0x37ba34=_0x37ba34-0x0;var _0x6f8dee=_0xe92f[_0x37ba34];return _0x6f8dee;};'use strict';var _=require(_0xfe92('0x0'));var util=require(_0xfe92('0x1'));var moment=require(_0xfe92('0x2'));var BPromise=require('bluebird');var rs=require(_0xfe92('0x3'));var fs=require('fs');var Redis=require(_0xfe92('0x4'));var db=require(_0xfe92('0x5'))['db'];var utils=require(_0xfe92('0x6'));var logger=require(_0xfe92('0x7'))(_0xfe92('0x8'));var config=require(_0xfe92('0x9'));var jayson=require(_0xfe92('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32eae1,_0x3f7700,_0x29424c){return new BPromise(function(_0x3fce93,_0xcda59){return client[_0xfe92('0xb')](_0x32eae1,_0x29424c)[_0xfe92('0xc')](function(_0x161ac2){logger['info']('ZohoField,\x20%s,\x20%s',_0x3f7700,'request\x20sent');logger[_0xfe92('0xd')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x3f7700,_0xfe92('0xe'),JSON[_0xfe92('0xf')](_0x161ac2));if(_0x161ac2[_0xfe92('0x10')]){if(_0x161ac2[_0xfe92('0x10')][_0xfe92('0x11')]===0x1f4){logger[_0xfe92('0x10')](_0xfe92('0x12'),_0x3f7700,_0x161ac2[_0xfe92('0x10')][_0xfe92('0x13')]);return _0xcda59(_0x161ac2[_0xfe92('0x10')][_0xfe92('0x13')]);}logger[_0xfe92('0x10')](_0xfe92('0x12'),_0x3f7700,_0x161ac2['error'][_0xfe92('0x13')]);return _0x3fce93(_0x161ac2[_0xfe92('0x10')][_0xfe92('0x13')]);}else{logger['info'](_0xfe92('0x12'),_0x3f7700,_0xfe92('0xe'));_0x3fce93(_0x161ac2[_0xfe92('0x14')]['message']);}})['catch'](function(_0x4d83a7){logger[_0xfe92('0x10')]('ZohoField,\x20%s,\x20%s',_0x3f7700,_0x4d83a7);_0xcda59(_0x4d83a7);});});} \ No newline at end of file +var _0xe600=['rpc','client','http','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x212fcc,_0x1a8867){var _0x4d8190=function(_0x347f7b){while(--_0x347f7b){_0x212fcc['push'](_0x212fcc['shift']());}};_0x4d8190(++_0x1a8867);}(_0xe600,0x1e8));var _0x0e60=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe600[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x0e60('0x0'));var moment=require(_0x0e60('0x1'));var BPromise=require(_0x0e60('0x2'));var rs=require(_0x0e60('0x3'));var fs=require('fs');var Redis=require(_0x0e60('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0e60('0x5'))(_0x0e60('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0e60('0x7')][_0x0e60('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1fb1ef,_0x573080,_0x1f10eb){return new BPromise(function(_0x3ad2c5,_0x4996c1){return client['request'](_0x1fb1ef,_0x1f10eb)['then'](function(_0x397e58){logger[_0x0e60('0x9')](_0x0e60('0xa'),_0x573080,_0x0e60('0xb'));logger['debug'](_0x0e60('0xc'),_0x573080,_0x0e60('0xb'),JSON[_0x0e60('0xd')](_0x397e58));if(_0x397e58[_0x0e60('0xe')]){if(_0x397e58[_0x0e60('0xe')][_0x0e60('0xf')]===0x1f4){logger[_0x0e60('0xe')](_0x0e60('0xa'),_0x573080,_0x397e58[_0x0e60('0xe')]['message']);return _0x4996c1(_0x397e58[_0x0e60('0xe')]['message']);}logger[_0x0e60('0xe')](_0x0e60('0xa'),_0x573080,_0x397e58['error'][_0x0e60('0x10')]);return _0x3ad2c5(_0x397e58[_0x0e60('0xe')][_0x0e60('0x10')]);}else{logger[_0x0e60('0x9')](_0x0e60('0xa'),_0x573080,'request\x20sent');_0x3ad2c5(_0x397e58[_0x0e60('0x11')][_0x0e60('0x10')]);}})[_0x0e60('0x12')](function(_0x2d71c5){logger[_0x0e60('0xe')](_0x0e60('0xa'),_0x573080,_0x2d71c5);_0x4996c1(_0x2d71c5);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 2617c93..9fcf278 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x125feb,_0x5bbfe8){var _0x279548=function(_0x24d6e0){while(--_0x24d6e0){_0x125feb['push'](_0x125feb['shift']());}};_0x279548(++_0x5bbfe8);}(_0xe706,0xa3));var _0x6e70=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xe706[_0x236d24];return _0x1574cf;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x47edc4,_0x550a5d){var _0x159758=function(_0x993c8a){while(--_0x993c8a){_0x47edc4['push'](_0x47edc4['shift']());}};_0x159758(++_0x550a5d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index f144e63..7eaab90 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 _0x8ae9=['state','sequelize','exports','unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN'];(function(_0x4c5ba2,_0x2c1ec8){var _0x5328e6=function(_0xe9297c){while(--_0xe9297c){_0x4c5ba2['push'](_0x4c5ba2['shift']());}};_0x5328e6(++_0x2c1ec8);}(_0x8ae9,0x179));var _0x98ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ae9[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x98ae('0x0'));module[_0x98ae('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x98ae('0x2')},'main':{'type':Sequelize[_0x98ae('0x3')],'defaultValue':_0x98ae('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x98ae('0x3')]},'size':{'type':Sequelize[_0x98ae('0x5')]},'active':{'type':Sequelize[_0x98ae('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x98ae('0x3')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x98ae('0x3')],'unique':_0x98ae('0x7')},'description':{'type':Sequelize[_0x98ae('0x3')]},'title':{'type':Sequelize[_0x98ae('0x3')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x98ae('0x3')],'defaultValue':'#'}}; \ No newline at end of file +var _0x7de1=['exports','STRING','unique_name_and_version','INTEGER','BOOLEAN','state','sequelize'];(function(_0x2d7842,_0x5e1932){var _0x35485d=function(_0x56843a){while(--_0x56843a){_0x2d7842['push'](_0x2d7842['shift']());}};_0x35485d(++_0x5e1932);}(_0x7de1,0x1cd));var _0x17de=function(_0x2962b4,_0x4b0786){_0x2962b4=_0x2962b4-0x0;var _0x411b7d=_0x7de1[_0x2962b4];return _0x411b7d;};'use strict';var Sequelize=require(_0x17de('0x0'));module[_0x17de('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x17de('0x2')],'allowNull':![],'unique':_0x17de('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x17de('0x2')]},'path':{'type':Sequelize[_0x17de('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x17de('0x4')]},'active':{'type':Sequelize[_0x17de('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x17de('0x2')]},'logo':{'type':Sequelize[_0x17de('0x2')]},'state':{'type':Sequelize[_0x17de('0x2')],'unique':_0x17de('0x6')},'description':{'type':Sequelize[_0x17de('0x2')]},'title':{'type':Sequelize[_0x17de('0x2')]},'remoteUri':{'type':Sequelize[_0x17de('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 0781011..7ee2ba5 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 _0x1967=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','Integration','includeAll','include','findAll','rows','show','params','fields','options','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x17784a,_0x42fe44){var _0x41aded=function(_0x2e7319){while(--_0x2e7319){_0x17784a['push'](_0x17784a['shift']());}};_0x41aded(++_0x42fe44);}(_0x1967,0x173));var _0x7196=function(_0x1b2f69,_0x3815e1){_0x1b2f69=_0x1b2f69-0x0;var _0x480f2e=_0x1967[_0x1b2f69];return _0x480f2e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}exports['index']=function(_0x35eef9,_0x4ecea1){var _0x4fd339={},_0x59d79d={},_0x30151f={'count':0x0,'rows':[]};var _0x985727=_[_0x7196('0x2c')](db['Integration'][_0x7196('0x2d')],function(_0x45d567){return{'name':_0x45d567[_0x7196('0x2e')],'type':_0x45d567[_0x7196('0x2f')]['key']};});_0x59d79d[_0x7196('0x30')]=_[_0x7196('0x2c')](_0x985727,_0x7196('0x2a'));_0x59d79d[_0x7196('0x31')]=_[_0x7196('0x32')](_0x35eef9[_0x7196('0x31')]);_0x59d79d[_0x7196('0x33')]=_[_0x7196('0x34')](_0x59d79d[_0x7196('0x30')],_0x59d79d[_0x7196('0x31')]);_0x4fd339[_0x7196('0x35')]=_['intersection'](_0x59d79d[_0x7196('0x30')],qs['fields'](_0x35eef9[_0x7196('0x31')]['fields']));_0x4fd339[_0x7196('0x35')]=_0x4fd339[_0x7196('0x35')]['length']?_0x4fd339[_0x7196('0x35')]:_0x59d79d[_0x7196('0x30')];if(!_0x35eef9[_0x7196('0x31')][_0x7196('0x36')](_0x7196('0x37'))){_0x4fd339['limit']=qs[_0x7196('0x21')](_0x35eef9[_0x7196('0x31')][_0x7196('0x21')]);_0x4fd339[_0x7196('0x1f')]=qs[_0x7196('0x1f')](_0x35eef9[_0x7196('0x31')]['offset']);}_0x4fd339[_0x7196('0x38')]=qs[_0x7196('0x39')](_0x35eef9[_0x7196('0x31')]['sort']);_0x4fd339[_0x7196('0x3a')]=qs[_0x7196('0x33')](_[_0x7196('0x3b')](_0x35eef9[_0x7196('0x31')],_0x59d79d[_0x7196('0x33')]),_0x985727);if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3c')]){_0x4fd339[_0x7196('0x3a')]=_[_0x7196('0x3d')](_0x4fd339[_0x7196('0x3a')],{'$or':_['map'](_0x985727,function(_0x257754){if(_0x257754[_0x7196('0x2f')]!=='VIRTUAL'){var _0x186efe={};_0x186efe[_0x257754['name']]={'$like':'%'+_0x35eef9['query'][_0x7196('0x3c')]+'%'};return _0x186efe;}})});}_0x4fd339=_[_0x7196('0x3d')]({},_0x4fd339,_0x35eef9['options']);var _0x587f6f={'where':_0x4fd339[_0x7196('0x3a')]};return db[_0x7196('0x3e')][_0x7196('0x22')](_0x587f6f)['then'](function(_0x36a990){_0x30151f[_0x7196('0x22')]=_0x36a990;if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3f')]){_0x4fd339[_0x7196('0x40')]=[{'all':!![]}];}return db[_0x7196('0x3e')][_0x7196('0x41')](_0x4fd339);})[_0x7196('0x27')](function(_0x5cd903){_0x30151f[_0x7196('0x42')]=_0x5cd903;return _0x30151f;})[_0x7196('0x27')](respondWithFilteredResult(_0x4ecea1,_0x4fd339))['catch'](handleError(_0x4ecea1,null));};exports[_0x7196('0x43')]=function(_0x43d4c0,_0x48178f){var _0x471915={'raw':![],'where':{'id':_0x43d4c0[_0x7196('0x44')]['id']}},_0x471bb2={};_0x471bb2['model']=_[_0x7196('0x32')](db[_0x7196('0x3e')]['rawAttributes']);_0x471bb2[_0x7196('0x31')]=_[_0x7196('0x32')](_0x43d4c0['query']);_0x471bb2[_0x7196('0x33')]=_['intersection'](_0x471bb2['model'],_0x471bb2['query']);_0x471915['attributes']=_['intersection'](_0x471bb2[_0x7196('0x30')],qs['fields'](_0x43d4c0[_0x7196('0x31')][_0x7196('0x45')]));_0x471915[_0x7196('0x35')]=_0x471915[_0x7196('0x35')]['length']?_0x471915[_0x7196('0x35')]:_0x471bb2['model'];if(_0x43d4c0[_0x7196('0x31')][_0x7196('0x3f')]){_0x471915[_0x7196('0x40')]=[{'all':!![]}];}_0x471915=_['merge']({},_0x471915,_0x43d4c0[_0x7196('0x46')]);return db[_0x7196('0x3e')][_0x7196('0x47')](_0x471915)['then'](handleEntityNotFound(_0x48178f,null))['then'](respondWithResult(_0x48178f,null))[_0x7196('0x48')](handleError(_0x48178f,null));};exports['create']=function(_0x29c7e8,_0x582884){return db['Integration'][_0x7196('0x49')](_0x29c7e8['body'],{})['then'](respondWithResult(_0x582884,0xc9))['catch'](handleError(_0x582884,null));};exports[_0x7196('0x26')]=function(_0x5052ee,_0x48e3b5){if(_0x5052ee[_0x7196('0x4a')]['id']){delete _0x5052ee[_0x7196('0x4a')]['id'];}return db[_0x7196('0x3e')][_0x7196('0x47')]({'where':{'id':_0x5052ee['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x48e3b5,null))['then'](saveUpdates(_0x5052ee[_0x7196('0x4a')],null))[_0x7196('0x27')](respondWithResult(_0x48e3b5,null))['catch'](handleError(_0x48e3b5,null));};exports[_0x7196('0x4b')]=function(_0x2fd056,_0x3fe092){return db['Integration'][_0x7196('0x47')]({'where':{'id':_0x2fd056['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x3fe092,null))[_0x7196('0x27')](removeEntity(_0x3fe092,null))[_0x7196('0x48')](handleError(_0x3fe092,null));}; \ No newline at end of file +var _0xc1c6=['type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','Integration','rawAttributes'];(function(_0x2eae1f,_0x4884bc){var _0x1110dc=function(_0x338ded){while(--_0x338ded){_0x2eae1f['push'](_0x2eae1f['shift']());}};_0x1110dc(++_0x4884bc);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x17e11c,_0xcd4331){_0x17e11c=_0x17e11c-0x0;var _0x120098=_0xc1c6[_0x17e11c];return _0x120098;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['Integration']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['Integration'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['Integration'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['Integration']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 85142eb..03ab5e8 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 _0x81a1=['lodash','util','moment','request-promise','path','../../config/environment','./integration.attributes','exports','define','Integration'];(function(_0x2f4970,_0x195f4e){var _0x4c68d5=function(_0x112825){while(--_0x112825){_0x2f4970['push'](_0x2f4970['shift']());}};_0x4c68d5(++_0x195f4e);}(_0x81a1,0x1a4));var _0x181a=function(_0x205df2,_0x5e44d7){_0x205df2=_0x205df2-0x0;var _0x59fa95=_0x81a1[_0x205df2];return _0x59fa95;};'use strict';var _=require(_0x181a('0x0'));var util=require(_0x181a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x181a('0x2'));var BPromise=require('bluebird');var rp=require(_0x181a('0x3'));var fs=require('fs');var path=require(_0x181a('0x4'));var rimraf=require('rimraf');var config=require(_0x181a('0x5'));var attributes=require(_0x181a('0x6'));module[_0x181a('0x7')]=function(_0x1a0a39,_0x4d1293){return _0x1a0a39[_0x181a('0x8')](_0x181a('0x9'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0305=['util','api','moment','bluebird','request-promise','rimraf','./integration.attributes','exports','define','Integration','integrations','lodash'];(function(_0x2631e2,_0x5afaf9){var _0x2f081b=function(_0x17e4ae){while(--_0x17e4ae){_0x2631e2['push'](_0x2631e2['shift']());}};_0x2f081b(++_0x5afaf9);}(_0x0305,0x15b));var _0x5030=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x0305[_0x3e3bee];return _0x3ae14c;};'use strict';var _=require(_0x5030('0x0'));var util=require(_0x5030('0x1'));var logger=require('../../config/logger')(_0x5030('0x2'));var moment=require(_0x5030('0x3'));var BPromise=require(_0x5030('0x4'));var rp=require(_0x5030('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5030('0x6'));var config=require('../../config/environment');var attributes=require(_0x5030('0x7'));module[_0x5030('0x8')]=function(_0x2c68d0,_0x230ed2){return _0x2c68d0[_0x5030('0x9')](_0x5030('0xa'),attributes,{'tableName':_0x5030('0xb'),'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 e5b9b06..0c30fd2 100644 --- a/server/api/integration/integration.rpc.js +++ b/server/api/integration/integration.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0295=['client','http','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','Integration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3bf676,_0x320310){var _0x112c6e=function(_0x270d5b){while(--_0x270d5b){_0x3bf676['push'](_0x3bf676['shift']());}};_0x112c6e(++_0x320310);}(_0x0295,0x1f0));var _0x5029=function(_0x23b85e,_0x39b209){_0x23b85e=_0x23b85e-0x0;var _0x329756=_0x0295[_0x23b85e];return _0x329756;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('Integration,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0xc6ac=['http','request','then','info','Integration,\x20%s,\x20%s','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xf8bc30,_0xba2fac){var _0x4f0256=function(_0x26475f){while(--_0x26475f){_0xf8bc30['push'](_0xf8bc30['shift']());}};_0x4f0256(++_0xba2fac);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x52e7ad,_0xdcd46d){_0x52e7ad=_0x52e7ad-0x0;var _0x34f66d=_0xc6ac[_0x52e7ad];return _0x34f66d;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 5c4f16e..ddd3bac 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 _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','create','put','update','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'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('./integrationReport.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['post']('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0xc')]);router[_0x65f6('0xd')](_0x65f6('0xb'),auth['isAuthenticated'](),controller[_0x65f6('0xe')]);router['delete']('/:id',auth[_0x65f6('0x8')](),controller['destroy']);module[_0x65f6('0xf')]=router; \ No newline at end of file +var _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x57afe1,_0x55e19b){var _0x11383f=function(_0x4010cf){while(--_0x4010cf){_0x57afe1['push'](_0x57afe1['shift']());}};_0x11383f(++_0x55e19b);}(_0x2ef3,0xba));var _0x32ef=function(_0x102def,_0x2468d7){_0x102def=_0x102def-0x0;var _0x358afc=_0x2ef3[_0x102def];return _0x358afc;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 3e37f3a..bc6b543 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 _0x35ee=['INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','FAILED','exports','STRING'];(function(_0x34c641,_0x103399){var _0x5476f0=function(_0x160abc){while(--_0x160abc){_0x34c641['push'](_0x34c641['shift']());}};_0x5476f0(++_0x103399);}(_0x35ee,0x16f));var _0xe35e=function(_0x308e55,_0x56cbd3){_0x308e55=_0x308e55-0x0;var _0x37633d=_0x35ee[_0x308e55];return _0x37633d;};'use strict';var Sequelize=require('sequelize');module[_0xe35e('0x0')]={'integration':{'type':Sequelize[_0xe35e('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xe35e('0x1')]},'ticketId':{'type':Sequelize[_0xe35e('0x1')]},'integrationId':{'type':Sequelize[_0xe35e('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe35e('0x1')]},'calleridname':{'type':Sequelize[_0xe35e('0x1')]},'queue':{'type':Sequelize[_0xe35e('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xe35e('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe35e('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xe35e('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xe35e('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xe35e('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe35e('0x2')]},'reason':{'type':Sequelize[_0xe35e('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xe35e('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xe35e('0x3')]},'agentdump':{'type':Sequelize[_0xe35e('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xe35e('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xe35e('0x1')]},'connectedlinename':{'type':Sequelize[_0xe35e('0x1')]},'language':{'type':Sequelize[_0xe35e('0x1')]},'accountcode':{'type':Sequelize[_0xe35e('0x1')]},'context':{'type':Sequelize[_0xe35e('0x1')]},'exten':{'type':Sequelize[_0xe35e('0x1')]},'priority':{'type':Sequelize[_0xe35e('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe35e('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe35e('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe35e('0x1')]},'destcalleridname':{'type':Sequelize[_0xe35e('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe35e('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xe35e('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xe35e('0x1')]},'destexten':{'type':Sequelize[_0xe35e('0x1')]},'destpriority':{'type':Sequelize[_0xe35e('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xe35e('0x1')]},'inReplyTo':{'type':Sequelize[_0xe35e('0x1')]},'subject':{'type':Sequelize[_0xe35e('0x1')]},'from':{'type':Sequelize[_0xe35e('0x1')]},'to':{'type':Sequelize[_0xe35e('0x1')]},'cc':{'type':Sequelize[_0xe35e('0x1')]},'attachment':{'type':Sequelize[_0xe35e('0x5')]},'html':{'type':Sequelize[_0xe35e('0x5')]},'text':{'type':Sequelize[_0xe35e('0x5')]},'status':{'type':Sequelize['ENUM'](_0xe35e('0x6'),_0xe35e('0x7'),'RECEIVED',_0xe35e('0x8'))},'url':{'type':Sequelize[_0xe35e('0x1')]},'app':{'type':Sequelize[_0xe35e('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xe35e('0x2')]}}; \ No newline at end of file +var _0x103d=['SENDING','RECEIVED','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','ENUM','SENT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x103d,0x111));var _0xd103=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x103d[_0x5d4607];return _0x5e4a86;};'use strict';var Sequelize=require('sequelize');module[_0xd103('0x0')]={'integration':{'type':Sequelize[_0xd103('0x1')]},'eventChannel':{'type':Sequelize[_0xd103('0x1')]},'exitStatus':{'type':Sequelize[_0xd103('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xd103('0x2')]},'contacts':{'type':Sequelize[_0xd103('0x1')]},'uniqueid':{'type':Sequelize[_0xd103('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xd103('0x1')]},'interface':{'type':Sequelize[_0xd103('0x1')]},'membername':{'type':Sequelize[_0xd103('0x1')]},'agentcalledAt':{'type':Sequelize[_0xd103('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xd103('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xd103('0x3')]},'talktime':{'type':Sequelize[_0xd103('0x2')]},'agentacw':{'type':Sequelize[_0xd103('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd103('0x2')]},'reason':{'type':Sequelize[_0xd103('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd103('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xd103('0x3')]},'lastevent':{'type':Sequelize[_0xd103('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd103('0x2')]},'channelstatedesc':{'type':Sequelize[_0xd103('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd103('0x1')]},'accountcode':{'type':Sequelize[_0xd103('0x1')]},'context':{'type':Sequelize[_0xd103('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd103('0x1')]},'destchannelstate':{'type':Sequelize[_0xd103('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xd103('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd103('0x1')]},'destcalleridname':{'type':Sequelize[_0xd103('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd103('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xd103('0x1')]},'destaccountcode':{'type':Sequelize[_0xd103('0x1')]},'destcontext':{'type':Sequelize[_0xd103('0x1')]},'destexten':{'type':Sequelize[_0xd103('0x1')]},'destpriority':{'type':Sequelize[_0xd103('0x1')]},'destuniqueid':{'type':Sequelize[_0xd103('0x1')]},'messageId':{'type':Sequelize[_0xd103('0x1')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xd103('0x1')]},'to':{'type':Sequelize[_0xd103('0x1')]},'cc':{'type':Sequelize[_0xd103('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xd103('0x5')](_0xd103('0x6'),_0xd103('0x7'),_0xd103('0x8'),_0xd103('0x9'))},'url':{'type':Sequelize[_0xd103('0x1')]},'app':{'type':Sequelize[_0xd103('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xd103('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 5181a5b..44950bc 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 _0xfddc=['update','then','destroy','error','stack','name','send','map','IntegrationReport','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0xfddc,0x15c));var _0xcfdd=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0xfddc[_0xbf8ebe];return _0x1e25e8;};'use strict';var emlformat=require(_0xcfdd('0x0'));var rimraf=require(_0xcfdd('0x1'));var zipdir=require(_0xcfdd('0x2'));var jsonpatch=require(_0xcfdd('0x3'));var rp=require(_0xcfdd('0x4'));var moment=require(_0xcfdd('0x5'));var BPromise=require(_0xcfdd('0x6'));var Mustache=require(_0xcfdd('0x7'));var util=require(_0xcfdd('0x8'));var path=require(_0xcfdd('0x9'));var sox=require(_0xcfdd('0xa'));var csv=require(_0xcfdd('0xb'));var ejs=require(_0xcfdd('0xc'));var fs=require('fs');var fs_extra=require(_0xcfdd('0xd'));var _=require(_0xcfdd('0xe'));var squel=require(_0xcfdd('0xf'));var crypto=require('crypto');var jsforce=require(_0xcfdd('0x10'));var deskjs=require(_0xcfdd('0x11'));var toCsv=require(_0xcfdd('0xb'));var querystring=require(_0xcfdd('0x12'));var Papa=require(_0xcfdd('0x13'));var Redis=require(_0xcfdd('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcfdd('0x15'));var hardwareService=require(_0xcfdd('0x16'));var logger=require(_0xcfdd('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcfdd('0x18'));var db=require(_0xcfdd('0x19'))['db'];function respondWithStatusCode(_0x443ba5,_0x56662f){_0x56662f=_0x56662f||0xcc;return function(_0x23106e){if(_0x23106e){return _0x443ba5[_0xcfdd('0x1a')](_0x56662f);}return _0x443ba5[_0xcfdd('0x1b')](_0x56662f)[_0xcfdd('0x1c')]();};}function respondWithResult(_0x1cd653,_0x38d7f6){_0x38d7f6=_0x38d7f6||0xc8;return function(_0x543b78){if(_0x543b78){return _0x1cd653[_0xcfdd('0x1b')](_0x38d7f6)['json'](_0x543b78);}};}function respondWithFilteredResult(_0x110be0,_0x550bb1){return function(_0x29c3b0){if(_0x29c3b0){var _0x3d1f54=typeof _0x550bb1[_0xcfdd('0x1d')]===_0xcfdd('0x1e')&&typeof _0x550bb1[_0xcfdd('0x1f')]===_0xcfdd('0x1e');var _0xc38c02=_0x29c3b0[_0xcfdd('0x20')];var _0x32cd0e=_0x3d1f54?0x0:_0x550bb1['offset'];var _0x323ebc=_0x3d1f54?_0x29c3b0['count']:_0x550bb1[_0xcfdd('0x1d')]+_0x550bb1['limit'];var _0x5ca3f8;if(_0x323ebc>=_0xc38c02){_0x323ebc=_0xc38c02;_0x5ca3f8=0xc8;}else{_0x5ca3f8=0xce;}_0x110be0[_0xcfdd('0x1b')](_0x5ca3f8);return _0x110be0[_0xcfdd('0x21')](_0xcfdd('0x22'),_0x32cd0e+'-'+_0x323ebc+'/'+_0xc38c02)['json'](_0x29c3b0);}return null;};}function patchUpdates(_0x322d4c){return function(_0x4fc200){try{jsonpatch['apply'](_0x4fc200,_0x322d4c,!![]);}catch(_0x575576){return BPromise[_0xcfdd('0x23')](_0x575576);}return _0x4fc200[_0xcfdd('0x24')]();};}function saveUpdates(_0x3721a5,_0x5da319){return function(_0x553123){if(_0x553123){return _0x553123[_0xcfdd('0x25')](_0x3721a5)[_0xcfdd('0x26')](function(_0x21fa9a){return _0x21fa9a;});}return null;};}function removeEntity(_0xc7e81d,_0x1ece9d){return function(_0x2ae837){if(_0x2ae837){return _0x2ae837[_0xcfdd('0x27')]()[_0xcfdd('0x26')](function(){_0xc7e81d['status'](0xcc)[_0xcfdd('0x1c')]();});}};}function handleEntityNotFound(_0xbcdd0f,_0x334194){return function(_0x59d693){if(!_0x59d693){_0xbcdd0f['sendStatus'](0x194);}return _0x59d693;};}function handleError(_0x1e2566,_0x56caa8){_0x56caa8=_0x56caa8||0x1f4;return function(_0x5395ee){logger[_0xcfdd('0x28')](_0x5395ee[_0xcfdd('0x29')]);if(_0x5395ee[_0xcfdd('0x2a')]){delete _0x5395ee[_0xcfdd('0x2a')];}_0x1e2566[_0xcfdd('0x1b')](_0x56caa8)[_0xcfdd('0x2b')](_0x5395ee);};}exports['index']=function(_0x17ad45,_0x57c5de){var _0x36bd7d={},_0x292a51={},_0x2c6768={'count':0x0,'rows':[]};var _0x31e447=_[_0xcfdd('0x2c')](db[_0xcfdd('0x2d')]['rawAttributes'],function(_0x4a52e1){return{'name':_0x4a52e1[_0xcfdd('0x2e')],'type':_0x4a52e1[_0xcfdd('0x2f')][_0xcfdd('0x30')]};});_0x292a51['model']=_[_0xcfdd('0x2c')](_0x31e447,'name');_0x292a51[_0xcfdd('0x31')]=_[_0xcfdd('0x32')](_0x17ad45[_0xcfdd('0x31')]);_0x292a51[_0xcfdd('0x33')]=_['intersection'](_0x292a51[_0xcfdd('0x34')],_0x292a51[_0xcfdd('0x31')]);_0x36bd7d[_0xcfdd('0x35')]=_[_0xcfdd('0x36')](_0x292a51[_0xcfdd('0x34')],qs[_0xcfdd('0x37')](_0x17ad45[_0xcfdd('0x31')]['fields']));_0x36bd7d[_0xcfdd('0x35')]=_0x36bd7d['attributes']['length']?_0x36bd7d[_0xcfdd('0x35')]:_0x292a51[_0xcfdd('0x34')];if(!_0x17ad45['query'][_0xcfdd('0x38')](_0xcfdd('0x39'))){_0x36bd7d[_0xcfdd('0x1f')]=qs['limit'](_0x17ad45[_0xcfdd('0x31')]['limit']);_0x36bd7d[_0xcfdd('0x1d')]=qs[_0xcfdd('0x1d')](_0x17ad45[_0xcfdd('0x31')][_0xcfdd('0x1d')]);}_0x36bd7d[_0xcfdd('0x3a')]=qs[_0xcfdd('0x3b')](_0x17ad45['query']['sort']);_0x36bd7d[_0xcfdd('0x3c')]=qs[_0xcfdd('0x33')](_[_0xcfdd('0x3d')](_0x17ad45[_0xcfdd('0x31')],_0x292a51[_0xcfdd('0x33')]),_0x31e447);if(_0x17ad45[_0xcfdd('0x31')][_0xcfdd('0x3e')]){_0x36bd7d[_0xcfdd('0x3c')]=_[_0xcfdd('0x3f')](_0x36bd7d[_0xcfdd('0x3c')],{'$or':_[_0xcfdd('0x2c')](_0x31e447,function(_0x19a620){if(_0x19a620[_0xcfdd('0x2f')]!==_0xcfdd('0x40')){var _0xda984b={};_0xda984b[_0x19a620['name']]={'$like':'%'+_0x17ad45['query'][_0xcfdd('0x3e')]+'%'};return _0xda984b;}})});}_0x36bd7d=_[_0xcfdd('0x3f')]({},_0x36bd7d,_0x17ad45[_0xcfdd('0x41')]);var _0x25e41c={'where':_0x36bd7d[_0xcfdd('0x3c')]};return db['IntegrationReport'][_0xcfdd('0x20')](_0x25e41c)[_0xcfdd('0x26')](function(_0xf3627e){_0x2c6768['count']=_0xf3627e;if(_0x17ad45[_0xcfdd('0x31')][_0xcfdd('0x42')]){_0x36bd7d[_0xcfdd('0x43')]=[{'all':!![]}];}return db[_0xcfdd('0x2d')]['findAll'](_0x36bd7d);})[_0xcfdd('0x26')](function(_0x340c66){_0x2c6768[_0xcfdd('0x44')]=_0x340c66;return _0x2c6768;})[_0xcfdd('0x26')](respondWithFilteredResult(_0x57c5de,_0x36bd7d))[_0xcfdd('0x45')](handleError(_0x57c5de,null));};exports[_0xcfdd('0x46')]=function(_0x13f7d7,_0x1418d2){var _0x164876={'raw':![],'where':{'id':_0x13f7d7[_0xcfdd('0x47')]['id']}},_0x146a1c={};_0x146a1c['model']=_[_0xcfdd('0x32')](db[_0xcfdd('0x2d')][_0xcfdd('0x48')]);_0x146a1c[_0xcfdd('0x31')]=_[_0xcfdd('0x32')](_0x13f7d7[_0xcfdd('0x31')]);_0x146a1c[_0xcfdd('0x33')]=_[_0xcfdd('0x36')](_0x146a1c['model'],_0x146a1c[_0xcfdd('0x31')]);_0x164876['attributes']=_['intersection'](_0x146a1c[_0xcfdd('0x34')],qs[_0xcfdd('0x37')](_0x13f7d7['query']['fields']));_0x164876['attributes']=_0x164876[_0xcfdd('0x35')]['length']?_0x164876[_0xcfdd('0x35')]:_0x146a1c[_0xcfdd('0x34')];if(_0x13f7d7[_0xcfdd('0x31')]['includeAll']){_0x164876[_0xcfdd('0x43')]=[{'all':!![]}];}_0x164876=_['merge']({},_0x164876,_0x13f7d7[_0xcfdd('0x41')]);return db[_0xcfdd('0x2d')]['find'](_0x164876)[_0xcfdd('0x26')](handleEntityNotFound(_0x1418d2,null))[_0xcfdd('0x26')](respondWithResult(_0x1418d2,null))[_0xcfdd('0x45')](handleError(_0x1418d2,null));};exports[_0xcfdd('0x49')]=function(_0xc864ea,_0x5b78b4){return db[_0xcfdd('0x2d')][_0xcfdd('0x49')](_0xc864ea[_0xcfdd('0x4a')],{})[_0xcfdd('0x26')](respondWithResult(_0x5b78b4,0xc9))[_0xcfdd('0x45')](handleError(_0x5b78b4,null));};exports[_0xcfdd('0x25')]=function(_0xd5fc2a,_0x3f9b43){if(_0xd5fc2a[_0xcfdd('0x4a')]['id']){delete _0xd5fc2a[_0xcfdd('0x4a')]['id'];}return db['IntegrationReport'][_0xcfdd('0x4b')]({'where':{'id':_0xd5fc2a['params']['id']}})[_0xcfdd('0x26')](handleEntityNotFound(_0x3f9b43,null))['then'](saveUpdates(_0xd5fc2a[_0xcfdd('0x4a')],null))[_0xcfdd('0x26')](respondWithResult(_0x3f9b43,null))[_0xcfdd('0x45')](handleError(_0x3f9b43,null));};exports['destroy']=function(_0x4807c2,_0x58a425){return db['IntegrationReport'][_0xcfdd('0x4b')]({'where':{'id':_0x4807c2[_0xcfdd('0x47')]['id']}})['then'](handleEntityNotFound(_0x58a425,null))['then'](removeEntity(_0x58a425,null))[_0xcfdd('0x45')](handleError(_0x58a425,null));};exports[_0xcfdd('0x4c')]=function(_0x12c9c0,_0x458be3){return db[_0xcfdd('0x2d')][_0xcfdd('0x4c')]()[_0xcfdd('0x26')](respondWithResult(_0x458be3,null))['catch'](handleError(_0x458be3,null));}; \ No newline at end of file +var _0x2801=['length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','fields','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','destroy','then','sendStatus','stack','name','send','index','map','IntegrationReport','model','query','intersection','attributes'];(function(_0x5a54e7,_0x446b69){var _0x4316a0=function(_0x38895f){while(--_0x38895f){_0x5a54e7['push'](_0x5a54e7['shift']());}};_0x4316a0(++_0x446b69);}(_0x2801,0xab));var _0x1280=function(_0x1ce827,_0xcfd6b){_0x1ce827=_0x1ce827-0x0;var _0xf1d3fc=_0x2801[_0x1ce827];return _0xf1d3fc;};'use strict';var emlformat=require(_0x1280('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1280('0x1'));var jsonpatch=require(_0x1280('0x2'));var rp=require(_0x1280('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1280('0x4'));var util=require(_0x1280('0x5'));var path=require(_0x1280('0x6'));var sox=require(_0x1280('0x7'));var csv=require(_0x1280('0x8'));var ejs=require(_0x1280('0x9'));var fs=require('fs');var fs_extra=require(_0x1280('0xa'));var _=require(_0x1280('0xb'));var squel=require('squel');var crypto=require(_0x1280('0xc'));var jsforce=require(_0x1280('0xd'));var deskjs=require(_0x1280('0xe'));var toCsv=require(_0x1280('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1280('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1280('0x10'));var as=require(_0x1280('0x11'));var hardwareService=require(_0x1280('0x12'));var logger=require(_0x1280('0x13'))(_0x1280('0x14'));var utils=require(_0x1280('0x15'));var config=require(_0x1280('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1280('0x17'))['db'];function respondWithStatusCode(_0x1951e1,_0x36b45a){_0x36b45a=_0x36b45a||0xcc;return function(_0x316e01){if(_0x316e01){return _0x1951e1['sendStatus'](_0x36b45a);}return _0x1951e1[_0x1280('0x18')](_0x36b45a)[_0x1280('0x19')]();};}function respondWithResult(_0xe52e3b,_0xf88584){_0xf88584=_0xf88584||0xc8;return function(_0x148501){if(_0x148501){return _0xe52e3b['status'](_0xf88584)[_0x1280('0x1a')](_0x148501);}};}function respondWithFilteredResult(_0x1d753c,_0x450711){return function(_0x36df7f){if(_0x36df7f){var _0x555ae3=typeof _0x450711[_0x1280('0x1b')]==='undefined'&&typeof _0x450711[_0x1280('0x1c')]===_0x1280('0x1d');var _0x189c0c=_0x36df7f[_0x1280('0x1e')];var _0x69da51=_0x555ae3?0x0:_0x450711[_0x1280('0x1b')];var _0x52a7fa=_0x555ae3?_0x36df7f[_0x1280('0x1e')]:_0x450711['offset']+_0x450711[_0x1280('0x1c')];var _0x2ab915;if(_0x52a7fa>=_0x189c0c){_0x52a7fa=_0x189c0c;_0x2ab915=0xc8;}else{_0x2ab915=0xce;}_0x1d753c[_0x1280('0x18')](_0x2ab915);return _0x1d753c['set'](_0x1280('0x1f'),_0x69da51+'-'+_0x52a7fa+'/'+_0x189c0c)[_0x1280('0x1a')](_0x36df7f);}return null;};}function patchUpdates(_0x4197f1){return function(_0x6349fa){try{jsonpatch[_0x1280('0x20')](_0x6349fa,_0x4197f1,!![]);}catch(_0x2dabd5){return BPromise[_0x1280('0x21')](_0x2dabd5);}return _0x6349fa['save']();};}function saveUpdates(_0x2074bb,_0x39044b){return function(_0x404481){if(_0x404481){return _0x404481[_0x1280('0x22')](_0x2074bb)['then'](function(_0x34d697){return _0x34d697;});}return null;};}function removeEntity(_0xd86265,_0x1d976d){return function(_0x20abdb){if(_0x20abdb){return _0x20abdb[_0x1280('0x23')]()[_0x1280('0x24')](function(){_0xd86265[_0x1280('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6b2922,_0x3c52a8){return function(_0x5378ef){if(!_0x5378ef){_0x6b2922[_0x1280('0x25')](0x194);}return _0x5378ef;};}function handleError(_0x5d8e23,_0x319dc8){_0x319dc8=_0x319dc8||0x1f4;return function(_0x50698b){logger['error'](_0x50698b[_0x1280('0x26')]);if(_0x50698b[_0x1280('0x27')]){delete _0x50698b[_0x1280('0x27')];}_0x5d8e23[_0x1280('0x18')](_0x319dc8)[_0x1280('0x28')](_0x50698b);};}exports[_0x1280('0x29')]=function(_0x400adc,_0x31a319){var _0x428ec8={},_0x3968c4={},_0x23f6dc={'count':0x0,'rows':[]};var _0x268bae=_[_0x1280('0x2a')](db[_0x1280('0x2b')]['rawAttributes'],function(_0x18ef1b){return{'name':_0x18ef1b['fieldName'],'type':_0x18ef1b['type']['key']};});_0x3968c4[_0x1280('0x2c')]=_[_0x1280('0x2a')](_0x268bae,_0x1280('0x27'));_0x3968c4['query']=_['keys'](_0x400adc[_0x1280('0x2d')]);_0x3968c4['filters']=_[_0x1280('0x2e')](_0x3968c4[_0x1280('0x2c')],_0x3968c4[_0x1280('0x2d')]);_0x428ec8[_0x1280('0x2f')]=_[_0x1280('0x2e')](_0x3968c4[_0x1280('0x2c')],qs['fields'](_0x400adc[_0x1280('0x2d')]['fields']));_0x428ec8[_0x1280('0x2f')]=_0x428ec8[_0x1280('0x2f')][_0x1280('0x30')]?_0x428ec8[_0x1280('0x2f')]:_0x3968c4[_0x1280('0x2c')];if(!_0x400adc[_0x1280('0x2d')][_0x1280('0x31')](_0x1280('0x32'))){_0x428ec8[_0x1280('0x1c')]=qs[_0x1280('0x1c')](_0x400adc[_0x1280('0x2d')][_0x1280('0x1c')]);_0x428ec8[_0x1280('0x1b')]=qs[_0x1280('0x1b')](_0x400adc[_0x1280('0x2d')][_0x1280('0x1b')]);}_0x428ec8[_0x1280('0x33')]=qs[_0x1280('0x34')](_0x400adc[_0x1280('0x2d')][_0x1280('0x34')]);_0x428ec8[_0x1280('0x35')]=qs[_0x1280('0x36')](_['pick'](_0x400adc[_0x1280('0x2d')],_0x3968c4['filters']),_0x268bae);if(_0x400adc['query'][_0x1280('0x37')]){_0x428ec8[_0x1280('0x35')]=_[_0x1280('0x38')](_0x428ec8[_0x1280('0x35')],{'$or':_[_0x1280('0x2a')](_0x268bae,function(_0x309d43){if(_0x309d43[_0x1280('0x39')]!==_0x1280('0x3a')){var _0x1c1b66={};_0x1c1b66[_0x309d43['name']]={'$like':'%'+_0x400adc[_0x1280('0x2d')][_0x1280('0x37')]+'%'};return _0x1c1b66;}})});}_0x428ec8=_[_0x1280('0x38')]({},_0x428ec8,_0x400adc['options']);var _0x200cc5={'where':_0x428ec8[_0x1280('0x35')]};return db[_0x1280('0x2b')]['count'](_0x200cc5)[_0x1280('0x24')](function(_0x29d51c){_0x23f6dc[_0x1280('0x1e')]=_0x29d51c;if(_0x400adc[_0x1280('0x2d')][_0x1280('0x3b')]){_0x428ec8[_0x1280('0x3c')]=[{'all':!![]}];}return db[_0x1280('0x2b')][_0x1280('0x3d')](_0x428ec8);})[_0x1280('0x24')](function(_0x36847b){_0x23f6dc[_0x1280('0x3e')]=_0x36847b;return _0x23f6dc;})[_0x1280('0x24')](respondWithFilteredResult(_0x31a319,_0x428ec8))[_0x1280('0x3f')](handleError(_0x31a319,null));};exports[_0x1280('0x40')]=function(_0x5ccee8,_0x48a814){var _0x4557ab={'raw':![],'where':{'id':_0x5ccee8[_0x1280('0x41')]['id']}},_0x57ba8e={};_0x57ba8e[_0x1280('0x2c')]=_[_0x1280('0x42')](db[_0x1280('0x2b')]['rawAttributes']);_0x57ba8e['query']=_[_0x1280('0x42')](_0x5ccee8['query']);_0x57ba8e[_0x1280('0x36')]=_[_0x1280('0x2e')](_0x57ba8e[_0x1280('0x2c')],_0x57ba8e['query']);_0x4557ab['attributes']=_[_0x1280('0x2e')](_0x57ba8e[_0x1280('0x2c')],qs[_0x1280('0x43')](_0x5ccee8[_0x1280('0x2d')][_0x1280('0x43')]));_0x4557ab[_0x1280('0x2f')]=_0x4557ab['attributes']['length']?_0x4557ab[_0x1280('0x2f')]:_0x57ba8e[_0x1280('0x2c')];if(_0x5ccee8[_0x1280('0x2d')][_0x1280('0x3b')]){_0x4557ab[_0x1280('0x3c')]=[{'all':!![]}];}_0x4557ab=_[_0x1280('0x38')]({},_0x4557ab,_0x5ccee8[_0x1280('0x44')]);return db['IntegrationReport'][_0x1280('0x45')](_0x4557ab)[_0x1280('0x24')](handleEntityNotFound(_0x48a814,null))[_0x1280('0x24')](respondWithResult(_0x48a814,null))[_0x1280('0x3f')](handleError(_0x48a814,null));};exports[_0x1280('0x46')]=function(_0x1930e1,_0x44a3c2){return db['IntegrationReport']['create'](_0x1930e1[_0x1280('0x47')],{})[_0x1280('0x24')](respondWithResult(_0x44a3c2,0xc9))[_0x1280('0x3f')](handleError(_0x44a3c2,null));};exports['update']=function(_0x1219e4,_0xc47627){if(_0x1219e4[_0x1280('0x47')]['id']){delete _0x1219e4['body']['id'];}return db[_0x1280('0x2b')][_0x1280('0x45')]({'where':{'id':_0x1219e4[_0x1280('0x41')]['id']}})[_0x1280('0x24')](handleEntityNotFound(_0xc47627,null))[_0x1280('0x24')](saveUpdates(_0x1219e4[_0x1280('0x47')],null))[_0x1280('0x24')](respondWithResult(_0xc47627,null))[_0x1280('0x3f')](handleError(_0xc47627,null));};exports[_0x1280('0x23')]=function(_0x3ecc2b,_0x29473a){return db[_0x1280('0x2b')][_0x1280('0x45')]({'where':{'id':_0x3ecc2b[_0x1280('0x41')]['id']}})[_0x1280('0x24')](handleEntityNotFound(_0x29473a,null))['then'](removeEntity(_0x29473a,null))[_0x1280('0x3f')](handleError(_0x29473a,null));};exports[_0x1280('0x48')]=function(_0x261ed0,_0x362526){return db[_0x1280('0x2b')]['describe']()[_0x1280('0x24')](respondWithResult(_0x362526,null))['catch'](handleError(_0x362526,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 61d408c..5b414b7 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 _0x0410=['../../config/environment','exports','define','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x222499,_0x5ade75){var _0x3a2b29=function(_0x533fc4){while(--_0x533fc4){_0x222499['push'](_0x222499['shift']());}};_0x3a2b29(++_0x5ade75);}(_0x0410,0x67));var _0x0041=function(_0x35d0e7,_0x1a7c59){_0x35d0e7=_0x35d0e7-0x0;var _0x44bf01=_0x0410[_0x35d0e7];return _0x44bf01;};'use strict';var _=require(_0x0041('0x0'));var util=require(_0x0041('0x1'));var logger=require(_0x0041('0x2'))(_0x0041('0x3'));var moment=require('moment');var BPromise=require(_0x0041('0x4'));var rp=require(_0x0041('0x5'));var fs=require('fs');var path=require(_0x0041('0x6'));var rimraf=require('rimraf');var config=require(_0x0041('0x7'));var attributes=require('./integrationReport.attributes');module[_0x0041('0x8')]=function(_0x9280e5,_0x42280f){return _0x9280e5[_0x0041('0x9')]('IntegrationReport',attributes,{'tableName':_0x0041('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c89=['IntegrationReport','lodash','../../config/logger','api','moment','request-promise','rimraf','exports','define'];(function(_0x249865,_0x3f5add){var _0x26cd8a=function(_0x10eb69){while(--_0x10eb69){_0x249865['push'](_0x249865['shift']());}};_0x26cd8a(++_0x3f5add);}(_0x3c89,0x172));var _0x93c8=function(_0x4f8385,_0x1e6bde){_0x4f8385=_0x4f8385-0x0;var _0x1ba451=_0x3c89[_0x4f8385];return _0x1ba451;};'use strict';var _=require(_0x93c8('0x0'));var util=require('util');var logger=require(_0x93c8('0x1'))(_0x93c8('0x2'));var moment=require(_0x93c8('0x3'));var BPromise=require('bluebird');var rp=require(_0x93c8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x93c8('0x5'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x93c8('0x6')]=function(_0x5225a2,_0x5f1be9){return _0x5225a2[_0x93c8('0x7')](_0x93c8('0x8'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index ca22d99..d19b971 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x31ac6f,_0xac69ee){var _0x26653f=function(_0x202b19){while(--_0x202b19){_0x31ac6f['push'](_0x31ac6f['shift']());}};_0x26653f(++_0xac69ee);}(_0x5fab,0x177));var _0xb5fa=function(_0x25be63,_0x4b335e){_0x25be63=_0x25be63-0x0;var _0x4daaa8=_0x5fab[_0x25be63];return _0x4daaa8;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x53ec,0x192));var _0xc53e=function(_0x44ea1b,_0x36bbd3){_0x44ea1b=_0x44ea1b-0x0;var _0x239690=_0x53ec[_0x44ea1b];return _0x239690;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 86d46cc..85e2c17 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 _0xcddb=['/:id','show','getIntervals','post','/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','isAuthenticated','get'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0xcddb,0x1c4));var _0xbcdd=function(_0x2b8ba0,_0x155ee4){_0x2b8ba0=_0x2b8ba0-0x0;var _0x3e4cd0=_0xcddb[_0x2b8ba0];return _0x3e4cd0;};'use strict';var multer=require(_0xbcdd('0x0'));var util=require(_0xbcdd('0x1'));var path=require(_0xbcdd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbcdd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbcdd('0x4'));var interaction=require(_0xbcdd('0x5'));var config=require(_0xbcdd('0x6'));var controller=require(_0xbcdd('0x7'));router['get']('/',auth[_0xbcdd('0x8')](),controller['index']);router[_0xbcdd('0x9')](_0xbcdd('0xa'),auth['isAuthenticated'](),controller[_0xbcdd('0xb')]);router[_0xbcdd('0x9')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xbcdd('0xc')]);router[_0xbcdd('0xd')]('/',auth[_0xbcdd('0x8')](),controller['create']);router[_0xbcdd('0xd')](_0xbcdd('0xe'),auth[_0xbcdd('0x8')](),controller[_0xbcdd('0xf')]);router['post'](_0xbcdd('0x10'),auth[_0xbcdd('0x8')](),controller['addIntervals']);router[_0xbcdd('0x11')](_0xbcdd('0xa'),auth['isAuthenticated'](),controller[_0xbcdd('0x12')]);router[_0xbcdd('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xbcdd('0x14')]);module[_0xbcdd('0x15')]=router; \ No newline at end of file +var _0x406e=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra'];(function(_0x5bcbbc,_0xcd75b4){var _0x4295d1=function(_0x1b1484){while(--_0x1b1484){_0x5bcbbc['push'](_0x5bcbbc['shift']());}};_0x4295d1(++_0xcd75b4);}(_0x406e,0xab));var _0xe406=function(_0x4d2efc,_0x157005){_0x4d2efc=_0x4d2efc-0x0;var _0x3d1222=_0x406e[_0x4d2efc];return _0x3d1222;};'use strict';var multer=require(_0xe406('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe406('0x1'));var express=require(_0xe406('0x2'));var router=express[_0xe406('0x3')]();var fs_extra=require(_0xe406('0x4'));var auth=require(_0xe406('0x5'));var interaction=require(_0xe406('0x6'));var config=require(_0xe406('0x7'));var controller=require('./interval.controller');router['get']('/',auth[_0xe406('0x8')](),controller[_0xe406('0x9')]);router[_0xe406('0xa')](_0xe406('0xb'),auth[_0xe406('0x8')](),controller[_0xe406('0xc')]);router[_0xe406('0xa')](_0xe406('0xd'),auth[_0xe406('0x8')](),controller[_0xe406('0xe')]);router[_0xe406('0xf')]('/',auth[_0xe406('0x8')](),controller[_0xe406('0x10')]);router[_0xe406('0xf')](_0xe406('0xd'),auth['isAuthenticated'](),controller['addInterval']);router[_0xe406('0xf')](_0xe406('0x11'),auth[_0xe406('0x8')](),controller['addIntervals']);router[_0xe406('0x12')](_0xe406('0xb'),auth[_0xe406('0x8')](),controller[_0xe406('0x13')]);router[_0xe406('0x14')](_0xe406('0xb'),auth[_0xe406('0x8')](),controller['destroy']);module[_0xe406('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 3d6324a..13beb3d 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 _0x8611=['sequelize','STRING'];(function(_0x4abc24,_0x121c01){var _0x271049=function(_0x3465ce){while(--_0x3465ce){_0x4abc24['push'](_0x4abc24['shift']());}};_0x271049(++_0x121c01);}(_0x8611,0x196));var _0x1861=function(_0x173ef2,_0x44f1ac){_0x173ef2=_0x173ef2-0x0;var _0x54c7ec=_0x8611[_0x173ef2];return _0x54c7ec;};'use strict';var Sequelize=require(_0x1861('0x0'));module['exports']={'name':{'type':Sequelize[_0x1861('0x1')]},'description':{'type':Sequelize[_0x1861('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x8b28=['exports','STRING','sequelize'];(function(_0x2e93c0,_0x481c89){var _0x556cba=function(_0x17d841){while(--_0x17d841){_0x2e93c0['push'](_0x2e93c0['shift']());}};_0x556cba(++_0x481c89);}(_0x8b28,0x1dc));var _0x88b2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8b28[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x88b2('0x0'));module[_0x88b2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x88b2('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index e6f3633..87374c9 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 _0x4f57=['moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','update','destroy','Intervals','then','error','stack','name','index','map','Interval','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','rows','catch','includeAll','options','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','body','params','addInterval','IntervalId','getIntervals','findOne','addIntervals','sequelize','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x4f57,0xb9));var _0x74f5=function(_0x29b4c4,_0x5646bd){_0x29b4c4=_0x29b4c4-0x0;var _0x54cc68=_0x4f57[_0x29b4c4];return _0x54cc68;};'use strict';var emlformat=require(_0x74f5('0x0'));var rimraf=require(_0x74f5('0x1'));var zipdir=require(_0x74f5('0x2'));var jsonpatch=require(_0x74f5('0x3'));var rp=require(_0x74f5('0x4'));var moment=require(_0x74f5('0x5'));var BPromise=require(_0x74f5('0x6'));var Mustache=require('mustache');var util=require(_0x74f5('0x7'));var path=require(_0x74f5('0x8'));var sox=require(_0x74f5('0x9'));var csv=require(_0x74f5('0xa'));var ejs=require(_0x74f5('0xb'));var fs=require('fs');var fs_extra=require(_0x74f5('0xc'));var _=require(_0x74f5('0xd'));var squel=require(_0x74f5('0xe'));var crypto=require(_0x74f5('0xf'));var jsforce=require(_0x74f5('0x10'));var deskjs=require(_0x74f5('0x11'));var toCsv=require(_0x74f5('0xa'));var querystring=require('querystring');var Papa=require(_0x74f5('0x12'));var Redis=require(_0x74f5('0x13'));var authService=require(_0x74f5('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x74f5('0x15'));var hardwareService=require(_0x74f5('0x16'));var logger=require(_0x74f5('0x17'))(_0x74f5('0x18'));var utils=require('../../config/utils');var config=require(_0x74f5('0x19'));var licenseUtil=require(_0x74f5('0x1a'));var db=require(_0x74f5('0x1b'))['db'];var extensions=require(_0x74f5('0x1c'));function respondWithStatusCode(_0x49a15a,_0x5668a4){_0x5668a4=_0x5668a4||0xcc;return function(_0x5e8d56){if(_0x5e8d56){return _0x49a15a[_0x74f5('0x1d')](_0x5668a4);}return _0x49a15a[_0x74f5('0x1e')](_0x5668a4)[_0x74f5('0x1f')]();};}function respondWithResult(_0xdb1bd6,_0xec73e3){_0xec73e3=_0xec73e3||0xc8;return function(_0x2fa836){if(_0x2fa836){return _0xdb1bd6[_0x74f5('0x1e')](_0xec73e3)[_0x74f5('0x20')](_0x2fa836);}};}function respondWithFilteredResult(_0x5372ec,_0x2caad0){return function(_0x34384b){if(_0x34384b){var _0x2a5977=typeof _0x2caad0[_0x74f5('0x21')]==='undefined'&&typeof _0x2caad0['limit']===_0x74f5('0x22');var _0x1386d0=_0x34384b[_0x74f5('0x23')];var _0x2a67eb=_0x2a5977?0x0:_0x2caad0[_0x74f5('0x21')];var _0x3454c6=_0x2a5977?_0x34384b[_0x74f5('0x23')]:_0x2caad0[_0x74f5('0x21')]+_0x2caad0['limit'];var _0x3d706e;if(_0x3454c6>=_0x1386d0){_0x3454c6=_0x1386d0;_0x3d706e=0xc8;}else{_0x3d706e=0xce;}_0x5372ec[_0x74f5('0x1e')](_0x3d706e);return _0x5372ec['set'](_0x74f5('0x24'),_0x2a67eb+'-'+_0x3454c6+'/'+_0x1386d0)[_0x74f5('0x20')](_0x34384b);}return null;};}function patchUpdates(_0x4411e3){return function(_0x2cbda8){try{jsonpatch[_0x74f5('0x25')](_0x2cbda8,_0x4411e3,!![]);}catch(_0x426b19){return BPromise[_0x74f5('0x26')](_0x426b19);}return _0x2cbda8['save']();};}function saveUpdates(_0x550608,_0xa4b305){return function(_0x353633){if(_0x353633){return _0x353633[_0x74f5('0x27')](_0x550608)['then'](function(_0x667fca){return _0x667fca;});}return null;};}function removeEntity(_0x36a4bb,_0x3864a1){return function(_0x31864b){if(_0x31864b){return _0x31864b[_0x74f5('0x28')]()['then'](function(){var _0x372daa=_0x31864b['get']({'plain':!![]});var _0x29a0ef=_0x74f5('0x29');return db['UserProfileResource'][_0x74f5('0x28')]({'where':{'type':_0x29a0ef,'resourceId':_0x372daa['id']}})['then'](function(){return _0x31864b;});})[_0x74f5('0x2a')](function(){_0x36a4bb[_0x74f5('0x1e')](0xcc)[_0x74f5('0x1f')]();});}};}function handleEntityNotFound(_0x5935b4,_0x3634e0){return function(_0x52d196){if(!_0x52d196){_0x5935b4[_0x74f5('0x1d')](0x194);}return _0x52d196;};}function handleError(_0x3508be,_0x36bf2b){_0x36bf2b=_0x36bf2b||0x1f4;return function(_0x12c86c){logger[_0x74f5('0x2b')](_0x12c86c[_0x74f5('0x2c')]);if(_0x12c86c[_0x74f5('0x2d')]){delete _0x12c86c['name'];}_0x3508be[_0x74f5('0x1e')](_0x36bf2b)['send'](_0x12c86c);};}exports[_0x74f5('0x2e')]=function(_0x429df0,_0x3f1e69){var _0x3df284={},_0x310606={},_0x202462={'count':0x0,'rows':[]};var _0x255499=_[_0x74f5('0x2f')](db[_0x74f5('0x30')][_0x74f5('0x31')],function(_0x432b6a){return{'name':_0x432b6a['fieldName'],'type':_0x432b6a['type'][_0x74f5('0x32')]};});_0x310606[_0x74f5('0x33')]=_[_0x74f5('0x2f')](_0x255499,'name');_0x310606[_0x74f5('0x34')]=_[_0x74f5('0x35')](_0x429df0[_0x74f5('0x34')]);_0x310606[_0x74f5('0x36')]=_[_0x74f5('0x37')](_0x310606['model'],_0x310606['query']);_0x3df284[_0x74f5('0x38')]=_[_0x74f5('0x37')](_0x310606['model'],qs[_0x74f5('0x39')](_0x429df0[_0x74f5('0x34')][_0x74f5('0x39')]));_0x3df284[_0x74f5('0x38')]=_0x3df284[_0x74f5('0x38')][_0x74f5('0x3a')]?_0x3df284['attributes']:_0x310606[_0x74f5('0x33')];if(!_0x429df0['query'][_0x74f5('0x3b')](_0x74f5('0x3c'))){_0x3df284[_0x74f5('0x3d')]=qs['limit'](_0x429df0[_0x74f5('0x34')][_0x74f5('0x3d')]);_0x3df284[_0x74f5('0x21')]=qs[_0x74f5('0x21')](_0x429df0['query']['offset']);}_0x3df284[_0x74f5('0x3e')]=qs[_0x74f5('0x3f')](_0x429df0[_0x74f5('0x34')][_0x74f5('0x3f')]);_0x3df284[_0x74f5('0x40')]=qs[_0x74f5('0x36')](_[_0x74f5('0x41')](_0x429df0['query'],_0x310606[_0x74f5('0x36')]),_0x255499);if(_0x429df0['query'][_0x74f5('0x42')]){_0x3df284['where']=_[_0x74f5('0x43')](_0x3df284[_0x74f5('0x40')],{'$or':_[_0x74f5('0x2f')](_0x255499,function(_0x29e93b){if(_0x29e93b[_0x74f5('0x44')]!==_0x74f5('0x45')){var _0x4d2812={};_0x4d2812[_0x29e93b['name']]={'$like':'%'+_0x429df0[_0x74f5('0x34')][_0x74f5('0x42')]+'%'};return _0x4d2812;}})});}_0x3df284=_[_0x74f5('0x43')]({},_0x3df284,_0x429df0['options']);var _0x558da9={'where':_0x3df284[_0x74f5('0x40')]};return db['Interval'][_0x74f5('0x23')](_0x558da9)[_0x74f5('0x2a')](function(_0x209d91){_0x202462[_0x74f5('0x23')]=_0x209d91;if(_0x429df0['query']['includeAll']){_0x3df284[_0x74f5('0x46')]=[{'all':!![]}];}return db['Interval'][_0x74f5('0x47')](_0x3df284);})[_0x74f5('0x2a')](function(_0x13a936){_0x202462[_0x74f5('0x48')]=_0x13a936;return _0x202462;})[_0x74f5('0x2a')](respondWithFilteredResult(_0x3f1e69,_0x3df284))[_0x74f5('0x49')](handleError(_0x3f1e69,null));};exports['show']=function(_0x5201f4,_0x15cce3){var _0xfb1d56={'raw':!![],'where':{'id':_0x5201f4['params']['id']}},_0x3eaa4f={};_0x3eaa4f['model']=_[_0x74f5('0x35')](db['Interval'][_0x74f5('0x31')]);_0x3eaa4f[_0x74f5('0x34')]=_[_0x74f5('0x35')](_0x5201f4[_0x74f5('0x34')]);_0x3eaa4f[_0x74f5('0x36')]=_[_0x74f5('0x37')](_0x3eaa4f[_0x74f5('0x33')],_0x3eaa4f[_0x74f5('0x34')]);_0xfb1d56[_0x74f5('0x38')]=_['intersection'](_0x3eaa4f[_0x74f5('0x33')],qs[_0x74f5('0x39')](_0x5201f4[_0x74f5('0x34')][_0x74f5('0x39')]));_0xfb1d56[_0x74f5('0x38')]=_0xfb1d56[_0x74f5('0x38')]['length']?_0xfb1d56[_0x74f5('0x38')]:_0x3eaa4f[_0x74f5('0x33')];if(_0x5201f4['query'][_0x74f5('0x4a')]){_0xfb1d56['include']=[{'all':!![]}];}_0xfb1d56=_['merge']({},_0xfb1d56,_0x5201f4[_0x74f5('0x4b')]);return db['Interval'][_0x74f5('0x4c')](_0xfb1d56)[_0x74f5('0x2a')](handleEntityNotFound(_0x15cce3,null))['then'](respondWithResult(_0x15cce3,null))['catch'](handleError(_0x15cce3,null));};exports['create']=function(_0xa2df27,_0x1c5e6d){return db[_0x74f5('0x30')]['create'](_0xa2df27['body'],{})[_0x74f5('0x2a')](function(_0x1d7350){var _0x447f14=_0xa2df27[_0x74f5('0x4d')][_0x74f5('0x4e')]({'plain':!![]});if(!_0x447f14)throw new Error(_0x74f5('0x4f'));if(_0x447f14[_0x74f5('0x50')]===_0x74f5('0x4d')){var _0x19024b=_0x1d7350[_0x74f5('0x4e')]({'plain':!![]});var _0x5224d4=_0x74f5('0x29');return db[_0x74f5('0x51')]['find']({'where':{'name':_0x5224d4,'userProfileId':_0x447f14[_0x74f5('0x52')]},'raw':!![]})['then'](function(_0x20bd40){if(_0x20bd40&&_0x20bd40[_0x74f5('0x53')]===0x0){return db[_0x74f5('0x54')][_0x74f5('0x55')]({'name':_0x19024b[_0x74f5('0x2d')],'resourceId':_0x19024b['id'],'type':_0x20bd40['name'],'sectionId':_0x20bd40['id']},{})[_0x74f5('0x2a')](function(){return _0x1d7350;});}else{return _0x1d7350;}})[_0x74f5('0x49')](function(_0x35d089){logger[_0x74f5('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35d089);throw _0x35d089;});}return _0x1d7350;})[_0x74f5('0x2a')](respondWithResult(_0x1c5e6d,0xc9))[_0x74f5('0x49')](handleError(_0x1c5e6d,null));};exports['update']=function(_0x1ff200,_0x2fdd0b){if(_0x1ff200[_0x74f5('0x56')]['id']){delete _0x1ff200[_0x74f5('0x56')]['id'];}return db[_0x74f5('0x30')][_0x74f5('0x4c')]({'where':{'id':_0x1ff200[_0x74f5('0x57')]['id']}})[_0x74f5('0x2a')](handleEntityNotFound(_0x2fdd0b,null))[_0x74f5('0x2a')](saveUpdates(_0x1ff200[_0x74f5('0x56')],null))[_0x74f5('0x2a')](respondWithResult(_0x2fdd0b,null))[_0x74f5('0x49')](handleError(_0x2fdd0b,null));};exports[_0x74f5('0x28')]=function(_0x55404e,_0xda544e){return db[_0x74f5('0x30')][_0x74f5('0x4c')]({'where':{'id':_0x55404e[_0x74f5('0x57')]['id']}})['then'](handleEntityNotFound(_0xda544e,null))['then'](removeEntity(_0xda544e,null))[_0x74f5('0x49')](handleError(_0xda544e,null));};exports[_0x74f5('0x58')]=function(_0x1e0eb2,_0x466efa,_0x4c0733){if(_0x1e0eb2[_0x74f5('0x56')]['id']){delete _0x1e0eb2['body']['id'];}return db[_0x74f5('0x30')][_0x74f5('0x4c')]({'where':{'id':_0x1e0eb2[_0x74f5('0x57')]['id']}})['then'](handleEntityNotFound(_0x466efa,null))[_0x74f5('0x2a')](function(_0x3d77b0){if(_0x3d77b0){_0x1e0eb2[_0x74f5('0x56')][_0x74f5('0x59')]=_0x3d77b0['id'];return db[_0x74f5('0x30')][_0x74f5('0x55')](_0x1e0eb2[_0x74f5('0x56')]);}})[_0x74f5('0x2a')](respondWithResult(_0x466efa,null))[_0x74f5('0x49')](handleError(_0x466efa,null));};exports[_0x74f5('0x5a')]=function(_0x1604c6,_0x34b856,_0x130726){var _0x4816d5={};var _0x536d09={};var _0x29f9ee;var _0x5521e6;return db[_0x74f5('0x30')][_0x74f5('0x5b')]({'where':{'id':_0x1604c6[_0x74f5('0x57')]['id']}})[_0x74f5('0x2a')](handleEntityNotFound(_0x34b856,null))[_0x74f5('0x2a')](function(_0x112e00){if(_0x112e00){_0x29f9ee=_0x112e00;_0x536d09[_0x74f5('0x33')]=_[_0x74f5('0x35')](db[_0x74f5('0x30')]['rawAttributes']);_0x536d09[_0x74f5('0x34')]=_[_0x74f5('0x35')](_0x1604c6[_0x74f5('0x34')]);_0x536d09[_0x74f5('0x36')]=_[_0x74f5('0x37')](_0x536d09[_0x74f5('0x33')],_0x536d09[_0x74f5('0x34')]);_0x4816d5['attributes']=_[_0x74f5('0x37')](_0x536d09[_0x74f5('0x33')],qs[_0x74f5('0x39')](_0x1604c6[_0x74f5('0x34')][_0x74f5('0x39')]));_0x4816d5[_0x74f5('0x38')]=_0x4816d5['attributes'][_0x74f5('0x3a')]?_0x4816d5[_0x74f5('0x38')]:_0x536d09[_0x74f5('0x33')];_0x4816d5[_0x74f5('0x3e')]=qs[_0x74f5('0x3f')](_0x1604c6[_0x74f5('0x34')]['sort']);_0x4816d5[_0x74f5('0x40')]=qs[_0x74f5('0x36')](_[_0x74f5('0x41')](_0x1604c6[_0x74f5('0x34')],_0x536d09[_0x74f5('0x36')]));if(_0x1604c6['query'][_0x74f5('0x42')]){_0x4816d5[_0x74f5('0x40')]=_[_0x74f5('0x43')](_0x4816d5['where'],{'$or':_['map'](_0x4816d5[_0x74f5('0x38')],function(_0x31a182){var _0x227f11={};_0x227f11[_0x31a182]={'$like':'%'+_0x1604c6[_0x74f5('0x34')][_0x74f5('0x42')]+'%'};return _0x227f11;})});}_0x4816d5=_['merge']({},_0x4816d5,_0x1604c6['options']);return _0x29f9ee[_0x74f5('0x5a')](_0x4816d5);}})['then'](function(_0x4e279d){if(_0x4e279d){_0x5521e6=_0x4e279d[_0x74f5('0x3a')];if(!_0x1604c6[_0x74f5('0x34')][_0x74f5('0x3b')](_0x74f5('0x3c'))){_0x4816d5[_0x74f5('0x3d')]=qs[_0x74f5('0x3d')](_0x1604c6[_0x74f5('0x34')][_0x74f5('0x3d')]);_0x4816d5['offset']=qs['offset'](_0x1604c6[_0x74f5('0x34')]['offset']);}return _0x29f9ee['getIntervals'](_0x4816d5);}})['then'](function(_0x162a9d){if(_0x162a9d){return _0x162a9d?{'count':_0x5521e6,'rows':_0x162a9d}:null;}})[_0x74f5('0x2a')](respondWithResult(_0x34b856,null))[_0x74f5('0x49')](handleError(_0x34b856,null));};exports[_0x74f5('0x5c')]=function(_0x5d2aaa,_0x57e227,_0x2fc389){return db['Interval']['findOne']({'where':{'id':_0x5d2aaa[_0x74f5('0x57')]['id']}})[_0x74f5('0x2a')](handleEntityNotFound(_0x57e227,null))[_0x74f5('0x2a')](function(_0x55b9ff){if(_0x55b9ff){return db[_0x74f5('0x5d')][_0x74f5('0x5e')](function(_0x5bd5a7){return db['Interval'][_0x74f5('0x28')]({'where':{'IntervalId':_0x5d2aaa[_0x74f5('0x57')]['id']},'transaction':_0x5bd5a7})[_0x74f5('0x2a')](function(_0x5c8890){var _0x3f5710=_['map'](_0x5d2aaa[_0x74f5('0x56')],function(_0x5ab1e5){delete _0x5ab1e5['id'];_0x5ab1e5[_0x74f5('0x59')]=_0x5d2aaa['params']['id'];return _0x5ab1e5;});return db[_0x74f5('0x30')]['bulkCreate'](_0x3f5710,{'transaction':_0x5bd5a7});});})[_0x74f5('0x2a')](function(){return db[_0x74f5('0x30')][_0x74f5('0x47')]({'where':{'IntervalId':_0x5d2aaa[_0x74f5('0x57')]['id']}});});}})['then'](respondWithResult(_0x57e227,null))[_0x74f5('0x49')](handleError(_0x57e227,null));}; \ No newline at end of file +var _0x88d3=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Intervals','error','stack','name','send','map','Interval','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','pick','options','findOne','sequelize','transaction','destroy','eml-format'];(function(_0x565596,_0x3e54e9){var _0x3b5454=function(_0x37b1e3){while(--_0x37b1e3){_0x565596['push'](_0x565596['shift']());}};_0x3b5454(++_0x3e54e9);}(_0x88d3,0x163));var _0x388d=function(_0x4b9983,_0x1a3fa){_0x4b9983=_0x4b9983-0x0;var _0x2bade2=_0x88d3[_0x4b9983];return _0x2bade2;};'use strict';var emlformat=require(_0x388d('0x0'));var rimraf=require(_0x388d('0x1'));var zipdir=require(_0x388d('0x2'));var jsonpatch=require(_0x388d('0x3'));var rp=require(_0x388d('0x4'));var moment=require('moment');var BPromise=require(_0x388d('0x5'));var Mustache=require(_0x388d('0x6'));var util=require(_0x388d('0x7'));var path=require('path');var sox=require(_0x388d('0x8'));var csv=require(_0x388d('0x9'));var ejs=require(_0x388d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x388d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x388d('0xc'));var deskjs=require(_0x388d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x388d('0xe'));var Papa=require(_0x388d('0xf'));var Redis=require(_0x388d('0x10'));var authService=require(_0x388d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x388d('0x12'));var hardwareService=require(_0x388d('0x13'));var logger=require(_0x388d('0x14'))('api');var utils=require(_0x388d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x388d('0x16'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x11aca5,_0x4ab73c){_0x4ab73c=_0x4ab73c||0xcc;return function(_0x459f47){if(_0x459f47){return _0x11aca5[_0x388d('0x17')](_0x4ab73c);}return _0x11aca5['status'](_0x4ab73c)[_0x388d('0x18')]();};}function respondWithResult(_0x558ac7,_0x57ad2e){_0x57ad2e=_0x57ad2e||0xc8;return function(_0x482f3e){if(_0x482f3e){return _0x558ac7[_0x388d('0x19')](_0x57ad2e)[_0x388d('0x1a')](_0x482f3e);}};}function respondWithFilteredResult(_0xf6ab25,_0x25cfc7){return function(_0x3dc1cc){if(_0x3dc1cc){var _0x486e60=typeof _0x25cfc7[_0x388d('0x1b')]===_0x388d('0x1c')&&typeof _0x25cfc7[_0x388d('0x1d')]===_0x388d('0x1c');var _0x333ebe=_0x3dc1cc['count'];var _0x1e7b4e=_0x486e60?0x0:_0x25cfc7[_0x388d('0x1b')];var _0x34188a=_0x486e60?_0x3dc1cc[_0x388d('0x1e')]:_0x25cfc7[_0x388d('0x1b')]+_0x25cfc7[_0x388d('0x1d')];var _0x1fc950;if(_0x34188a>=_0x333ebe){_0x34188a=_0x333ebe;_0x1fc950=0xc8;}else{_0x1fc950=0xce;}_0xf6ab25[_0x388d('0x19')](_0x1fc950);return _0xf6ab25[_0x388d('0x1f')](_0x388d('0x20'),_0x1e7b4e+'-'+_0x34188a+'/'+_0x333ebe)[_0x388d('0x1a')](_0x3dc1cc);}return null;};}function patchUpdates(_0x53df11){return function(_0x1b39ff){try{jsonpatch[_0x388d('0x21')](_0x1b39ff,_0x53df11,!![]);}catch(_0x5264f2){return BPromise[_0x388d('0x22')](_0x5264f2);}return _0x1b39ff[_0x388d('0x23')]();};}function saveUpdates(_0x4b228f,_0x382c24){return function(_0x2f9e13){if(_0x2f9e13){return _0x2f9e13[_0x388d('0x24')](_0x4b228f)[_0x388d('0x25')](function(_0x52dcf9){return _0x52dcf9;});}return null;};}function removeEntity(_0x5b369b,_0x5459e6){return function(_0x1bdded){if(_0x1bdded){return _0x1bdded['destroy']()['then'](function(){var _0x48e0a5=_0x1bdded[_0x388d('0x26')]({'plain':!![]});var _0x330e70=_0x388d('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x330e70,'resourceId':_0x48e0a5['id']}})[_0x388d('0x25')](function(){return _0x1bdded;});})[_0x388d('0x25')](function(){_0x5b369b[_0x388d('0x19')](0xcc)[_0x388d('0x18')]();});}};}function handleEntityNotFound(_0x23793a,_0x315857){return function(_0xe776fd){if(!_0xe776fd){_0x23793a[_0x388d('0x17')](0x194);}return _0xe776fd;};}function handleError(_0x5436a7,_0x4b65b7){_0x4b65b7=_0x4b65b7||0x1f4;return function(_0x4526a3){logger[_0x388d('0x28')](_0x4526a3[_0x388d('0x29')]);if(_0x4526a3[_0x388d('0x2a')]){delete _0x4526a3[_0x388d('0x2a')];}_0x5436a7[_0x388d('0x19')](_0x4b65b7)[_0x388d('0x2b')](_0x4526a3);};}exports['index']=function(_0x1bbca7,_0x1c88e2){var _0x3f5576={},_0x33371b={},_0x3e6c24={'count':0x0,'rows':[]};var _0x518d0f=_[_0x388d('0x2c')](db[_0x388d('0x2d')][_0x388d('0x2e')],function(_0x2e1593){return{'name':_0x2e1593[_0x388d('0x2f')],'type':_0x2e1593[_0x388d('0x30')][_0x388d('0x31')]};});_0x33371b[_0x388d('0x32')]=_[_0x388d('0x2c')](_0x518d0f,_0x388d('0x2a'));_0x33371b['query']=_[_0x388d('0x33')](_0x1bbca7['query']);_0x33371b[_0x388d('0x34')]=_[_0x388d('0x35')](_0x33371b['model'],_0x33371b[_0x388d('0x36')]);_0x3f5576[_0x388d('0x37')]=_[_0x388d('0x35')](_0x33371b[_0x388d('0x32')],qs['fields'](_0x1bbca7[_0x388d('0x36')][_0x388d('0x38')]));_0x3f5576[_0x388d('0x37')]=_0x3f5576[_0x388d('0x37')][_0x388d('0x39')]?_0x3f5576[_0x388d('0x37')]:_0x33371b[_0x388d('0x32')];if(!_0x1bbca7[_0x388d('0x36')][_0x388d('0x3a')](_0x388d('0x3b'))){_0x3f5576['limit']=qs[_0x388d('0x1d')](_0x1bbca7[_0x388d('0x36')][_0x388d('0x1d')]);_0x3f5576[_0x388d('0x1b')]=qs['offset'](_0x1bbca7[_0x388d('0x36')][_0x388d('0x1b')]);}_0x3f5576[_0x388d('0x3c')]=qs[_0x388d('0x3d')](_0x1bbca7['query'][_0x388d('0x3d')]);_0x3f5576['where']=qs[_0x388d('0x34')](_['pick'](_0x1bbca7[_0x388d('0x36')],_0x33371b[_0x388d('0x34')]),_0x518d0f);if(_0x1bbca7[_0x388d('0x36')][_0x388d('0x3e')]){_0x3f5576[_0x388d('0x3f')]=_[_0x388d('0x40')](_0x3f5576[_0x388d('0x3f')],{'$or':_[_0x388d('0x2c')](_0x518d0f,function(_0x568f2e){if(_0x568f2e[_0x388d('0x30')]!=='VIRTUAL'){var _0xd64448={};_0xd64448[_0x568f2e['name']]={'$like':'%'+_0x1bbca7['query']['filter']+'%'};return _0xd64448;}})});}_0x3f5576=_['merge']({},_0x3f5576,_0x1bbca7['options']);var _0x3d18d3={'where':_0x3f5576[_0x388d('0x3f')]};return db[_0x388d('0x2d')]['count'](_0x3d18d3)['then'](function(_0x35c934){_0x3e6c24[_0x388d('0x1e')]=_0x35c934;if(_0x1bbca7[_0x388d('0x36')][_0x388d('0x41')]){_0x3f5576[_0x388d('0x42')]=[{'all':!![]}];}return db[_0x388d('0x2d')][_0x388d('0x43')](_0x3f5576);})[_0x388d('0x25')](function(_0x38531c){_0x3e6c24['rows']=_0x38531c;return _0x3e6c24;})[_0x388d('0x25')](respondWithFilteredResult(_0x1c88e2,_0x3f5576))[_0x388d('0x44')](handleError(_0x1c88e2,null));};exports[_0x388d('0x45')]=function(_0x209985,_0x5079d3){var _0x4d56a9={'raw':!![],'where':{'id':_0x209985[_0x388d('0x46')]['id']}},_0x26ebc6={};_0x26ebc6[_0x388d('0x32')]=_[_0x388d('0x33')](db[_0x388d('0x2d')][_0x388d('0x2e')]);_0x26ebc6['query']=_[_0x388d('0x33')](_0x209985[_0x388d('0x36')]);_0x26ebc6[_0x388d('0x34')]=_[_0x388d('0x35')](_0x26ebc6[_0x388d('0x32')],_0x26ebc6[_0x388d('0x36')]);_0x4d56a9[_0x388d('0x37')]=_[_0x388d('0x35')](_0x26ebc6['model'],qs[_0x388d('0x38')](_0x209985[_0x388d('0x36')][_0x388d('0x38')]));_0x4d56a9[_0x388d('0x37')]=_0x4d56a9[_0x388d('0x37')][_0x388d('0x39')]?_0x4d56a9[_0x388d('0x37')]:_0x26ebc6[_0x388d('0x32')];if(_0x209985[_0x388d('0x36')][_0x388d('0x41')]){_0x4d56a9['include']=[{'all':!![]}];}_0x4d56a9=_['merge']({},_0x4d56a9,_0x209985['options']);return db[_0x388d('0x2d')][_0x388d('0x47')](_0x4d56a9)[_0x388d('0x25')](handleEntityNotFound(_0x5079d3,null))[_0x388d('0x25')](respondWithResult(_0x5079d3,null))['catch'](handleError(_0x5079d3,null));};exports[_0x388d('0x48')]=function(_0x1d6001,_0x3ee4b1){return db['Interval'][_0x388d('0x48')](_0x1d6001[_0x388d('0x49')],{})['then'](function(_0x24b368){var _0x9feb70=_0x1d6001[_0x388d('0x4a')][_0x388d('0x26')]({'plain':!![]});if(!_0x9feb70)throw new Error(_0x388d('0x4b'));if(_0x9feb70[_0x388d('0x4c')]==='user'){var _0x2bb378=_0x24b368[_0x388d('0x26')]({'plain':!![]});var _0x45a694='Intervals';return db[_0x388d('0x4d')][_0x388d('0x47')]({'where':{'name':_0x45a694,'userProfileId':_0x9feb70[_0x388d('0x4e')]},'raw':!![]})['then'](function(_0x577b79){if(_0x577b79&&_0x577b79[_0x388d('0x4f')]===0x0){return db['UserProfileResource'][_0x388d('0x48')]({'name':_0x2bb378['name'],'resourceId':_0x2bb378['id'],'type':_0x577b79[_0x388d('0x2a')],'sectionId':_0x577b79['id']},{})[_0x388d('0x25')](function(){return _0x24b368;});}else{return _0x24b368;}})[_0x388d('0x44')](function(_0x128b43){logger[_0x388d('0x28')](_0x388d('0x50'),_0x128b43);throw _0x128b43;});}return _0x24b368;})['then'](respondWithResult(_0x3ee4b1,0xc9))[_0x388d('0x44')](handleError(_0x3ee4b1,null));};exports[_0x388d('0x24')]=function(_0x3ffeb2,_0x53833c){if(_0x3ffeb2[_0x388d('0x49')]['id']){delete _0x3ffeb2[_0x388d('0x49')]['id'];}return db[_0x388d('0x2d')]['find']({'where':{'id':_0x3ffeb2[_0x388d('0x46')]['id']}})[_0x388d('0x25')](handleEntityNotFound(_0x53833c,null))[_0x388d('0x25')](saveUpdates(_0x3ffeb2['body'],null))['then'](respondWithResult(_0x53833c,null))[_0x388d('0x44')](handleError(_0x53833c,null));};exports['destroy']=function(_0x5eb84b,_0x3255c3){return db['Interval'][_0x388d('0x47')]({'where':{'id':_0x5eb84b[_0x388d('0x46')]['id']}})[_0x388d('0x25')](handleEntityNotFound(_0x3255c3,null))[_0x388d('0x25')](removeEntity(_0x3255c3,null))[_0x388d('0x44')](handleError(_0x3255c3,null));};exports[_0x388d('0x51')]=function(_0xa35cd9,_0x125450,_0x33a36b){if(_0xa35cd9[_0x388d('0x49')]['id']){delete _0xa35cd9[_0x388d('0x49')]['id'];}return db['Interval'][_0x388d('0x47')]({'where':{'id':_0xa35cd9[_0x388d('0x46')]['id']}})[_0x388d('0x25')](handleEntityNotFound(_0x125450,null))[_0x388d('0x25')](function(_0x411791){if(_0x411791){_0xa35cd9[_0x388d('0x49')][_0x388d('0x52')]=_0x411791['id'];return db['Interval']['create'](_0xa35cd9[_0x388d('0x49')]);}})[_0x388d('0x25')](respondWithResult(_0x125450,null))[_0x388d('0x44')](handleError(_0x125450,null));};exports['getIntervals']=function(_0x344a33,_0x235604,_0x53b4fc){var _0x430b71={};var _0x5bfbfc={};var _0x1dc1b5;var _0x17b4ef;return db[_0x388d('0x2d')]['findOne']({'where':{'id':_0x344a33[_0x388d('0x46')]['id']}})[_0x388d('0x25')](handleEntityNotFound(_0x235604,null))[_0x388d('0x25')](function(_0x25cad0){if(_0x25cad0){_0x1dc1b5=_0x25cad0;_0x5bfbfc['model']=_[_0x388d('0x33')](db[_0x388d('0x2d')]['rawAttributes']);_0x5bfbfc[_0x388d('0x36')]=_[_0x388d('0x33')](_0x344a33[_0x388d('0x36')]);_0x5bfbfc['filters']=_[_0x388d('0x35')](_0x5bfbfc['model'],_0x5bfbfc[_0x388d('0x36')]);_0x430b71[_0x388d('0x37')]=_[_0x388d('0x35')](_0x5bfbfc[_0x388d('0x32')],qs[_0x388d('0x38')](_0x344a33['query'][_0x388d('0x38')]));_0x430b71[_0x388d('0x37')]=_0x430b71['attributes'][_0x388d('0x39')]?_0x430b71[_0x388d('0x37')]:_0x5bfbfc[_0x388d('0x32')];_0x430b71[_0x388d('0x3c')]=qs[_0x388d('0x3d')](_0x344a33[_0x388d('0x36')][_0x388d('0x3d')]);_0x430b71[_0x388d('0x3f')]=qs[_0x388d('0x34')](_[_0x388d('0x53')](_0x344a33[_0x388d('0x36')],_0x5bfbfc[_0x388d('0x34')]));if(_0x344a33[_0x388d('0x36')][_0x388d('0x3e')]){_0x430b71[_0x388d('0x3f')]=_[_0x388d('0x40')](_0x430b71[_0x388d('0x3f')],{'$or':_[_0x388d('0x2c')](_0x430b71[_0x388d('0x37')],function(_0x42bcb3){var _0x998419={};_0x998419[_0x42bcb3]={'$like':'%'+_0x344a33[_0x388d('0x36')][_0x388d('0x3e')]+'%'};return _0x998419;})});}_0x430b71=_[_0x388d('0x40')]({},_0x430b71,_0x344a33[_0x388d('0x54')]);return _0x1dc1b5['getIntervals'](_0x430b71);}})['then'](function(_0x4e8258){if(_0x4e8258){_0x17b4ef=_0x4e8258[_0x388d('0x39')];if(!_0x344a33['query'][_0x388d('0x3a')](_0x388d('0x3b'))){_0x430b71['limit']=qs[_0x388d('0x1d')](_0x344a33[_0x388d('0x36')][_0x388d('0x1d')]);_0x430b71[_0x388d('0x1b')]=qs['offset'](_0x344a33[_0x388d('0x36')]['offset']);}return _0x1dc1b5['getIntervals'](_0x430b71);}})[_0x388d('0x25')](function(_0xab1c42){if(_0xab1c42){return _0xab1c42?{'count':_0x17b4ef,'rows':_0xab1c42}:null;}})[_0x388d('0x25')](respondWithResult(_0x235604,null))[_0x388d('0x44')](handleError(_0x235604,null));};exports['addIntervals']=function(_0x3ca6ef,_0x32186e,_0x34e65e){return db[_0x388d('0x2d')][_0x388d('0x55')]({'where':{'id':_0x3ca6ef[_0x388d('0x46')]['id']}})[_0x388d('0x25')](handleEntityNotFound(_0x32186e,null))[_0x388d('0x25')](function(_0x3ebcd1){if(_0x3ebcd1){return db[_0x388d('0x56')][_0x388d('0x57')](function(_0x1e026f){return db[_0x388d('0x2d')][_0x388d('0x58')]({'where':{'IntervalId':_0x3ca6ef['params']['id']},'transaction':_0x1e026f})[_0x388d('0x25')](function(_0x46996a){var _0x844bf8=_[_0x388d('0x2c')](_0x3ca6ef[_0x388d('0x49')],function(_0x1262f4){delete _0x1262f4['id'];_0x1262f4[_0x388d('0x52')]=_0x3ca6ef[_0x388d('0x46')]['id'];return _0x1262f4;});return db[_0x388d('0x2d')]['bulkCreate'](_0x844bf8,{'transaction':_0x1e026f});});})[_0x388d('0x25')](function(){return db[_0x388d('0x2d')][_0x388d('0x43')]({'where':{'IntervalId':_0x3ca6ef['params']['id']}});});}})[_0x388d('0x25')](respondWithResult(_0x32186e,null))[_0x388d('0x44')](handleError(_0x32186e,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 2a9db0f..f478669 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 _0x51e1=['./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5257b7,_0x4f42d6){var _0x5a8139=function(_0x4adfe2){while(--_0x4adfe2){_0x5257b7['push'](_0x5257b7['shift']());}};_0x5a8139(++_0x4f42d6);}(_0x51e1,0x70));var _0x151e=function(_0x3d27ba,_0x2671a3){_0x3d27ba=_0x3d27ba-0x0;var _0xf01885=_0x51e1[_0x3d27ba];return _0xf01885;};'use strict';var _=require(_0x151e('0x0'));var util=require('util');var logger=require(_0x151e('0x1'))(_0x151e('0x2'));var moment=require('moment');var BPromise=require(_0x151e('0x3'));var rp=require(_0x151e('0x4'));var fs=require('fs');var path=require(_0x151e('0x5'));var rimraf=require(_0x151e('0x6'));var config=require(_0x151e('0x7'));var attributes=require(_0x151e('0x8'));var extensions=require(_0x151e('0x9'));module[_0x151e('0xa')]=function(_0x318b93,_0x34ccf1){return _0x318b93[_0x151e('0xb')](_0x151e('0xc'),attributes,{'tableName':_0x151e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x202b6d,_0x46dea7){extensions[_0x151e('0xe')](_0x318b93,_0x202b6d);},'afterBulkCreate':function(_0x273d,_0x43d5d3,_0x1da8fd){_0x1da8fd();extensions['rewrite'](_0x318b93,_0x273d[0x0]);},'afterUpdate':function(_0x182c09,_0x26da98){extensions[_0x151e('0xe')](_0x318b93,_0x182c09);},'afterDestroy':function(_0xf38a9f,_0x205e57){extensions[_0x151e('0xe')](_0x318b93,_0xf38a9f);}}});}; \ No newline at end of file +var _0x5a23=['bluebird','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment'];(function(_0x56418e,_0x362812){var _0x5b160c=function(_0x5b44cb){while(--_0x5b44cb){_0x56418e['push'](_0x56418e['shift']());}};_0x5b160c(++_0x362812);}(_0x5a23,0x14b));var _0x35a2=function(_0x3a7902,_0x2df778){_0x3a7902=_0x3a7902-0x0;var _0x39842f=_0x5a23[_0x3a7902];return _0x39842f;};'use strict';var _=require(_0x35a2('0x0'));var util=require(_0x35a2('0x1'));var logger=require(_0x35a2('0x2'))(_0x35a2('0x3'));var moment=require(_0x35a2('0x4'));var BPromise=require(_0x35a2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x35a2('0x6'));var rimraf=require(_0x35a2('0x7'));var config=require(_0x35a2('0x8'));var attributes=require(_0x35a2('0x9'));var extensions=require(_0x35a2('0xa'));module[_0x35a2('0xb')]=function(_0x4f3b10,_0x2af9c2){return _0x4f3b10[_0x35a2('0xc')](_0x35a2('0xd'),attributes,{'tableName':_0x35a2('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1fdc6b,_0x5aee56){extensions[_0x35a2('0xf')](_0x4f3b10,_0x1fdc6b);},'afterBulkCreate':function(_0xf2a884,_0x2a627a,_0x12d7f5){_0x12d7f5();extensions[_0x35a2('0xf')](_0x4f3b10,_0xf2a884[0x0]);},'afterUpdate':function(_0x5a14e4,_0x124a57){extensions[_0x35a2('0xf')](_0x4f3b10,_0x5a14e4);},'afterDestroy':function(_0x29025f,_0x47a86a){extensions[_0x35a2('0xf')](_0x4f3b10,_0x29025f);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 67e74e2..90a6672 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(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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 31ecfe1..73e8284 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 _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x481904,_0x6ec36e){var _0xd9a15c=function(_0x3b7538){while(--_0x3b7538){_0x481904['push'](_0x481904['shift']());}};_0xd9a15c(++_0x6ec36e);}(_0xdb28,0x106));var _0x8db2=function(_0x46462f,_0x1c29ed){_0x46462f=_0x46462f-0x0;var _0x2b5f24=_0xdb28[_0x46462f];return _0x2b5f24;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x5ece1d,_0xb51221){var _0x53e14e=function(_0x9a9a2f){while(--_0x9a9a2f){_0x5ece1d['push'](_0x5ece1d['shift']());}};_0x53e14e(++_0xb51221);}(_0x5f2f,0x73));var _0xf5f2=function(_0x424977,_0x37fe0e){_0x424977=_0x424977-0x0;var _0x283b5e=_0x5f2f[_0x424977];return _0x283b5e;};'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 fd6803e..cd863f4 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 _0xa69a=['name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','setEncoding','data','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','end','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','fields','email','customfield_11501','oldToken','customfield_11502','newToken'];(function(_0x1ae1bd,_0x17e5c2){var _0x4a8a21=function(_0x9a67f0){while(--_0x9a67f0){_0x1ae1bd['push'](_0x1ae1bd['shift']());}};_0x4a8a21(++_0x17e5c2);}(_0xa69a,0xd4));var _0xaa69=function(_0x36139a,_0x5e417f){_0x36139a=_0x36139a-0x0;var _0x4ec5e3=_0xa69a[_0x36139a];return _0x4ec5e3;};'use strict';var BPromise=require(_0xaa69('0x0'));var https=require(_0xaa69('0x1'));var logger=require(_0xaa69('0x2'))(_0xaa69('0x3'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x5ed763,_0x2e1d5d){var _0x1058b2={'fields':{'project':{'key':_0x5ed763[_0xaa69('0x4')]||_0xaa69('0x5')},'summary':(_0x5ed763[_0xaa69('0x6')]||_0xaa69('0x7'))+_0xaa69('0x8')+_0x5ed763['ip'],'description':_0x5ed763[_0xaa69('0x9')]||JSON[_0xaa69('0xa')](_0x5ed763),'issuetype':{'name':_0x5ed763['issuetype']||_0xaa69('0xb')}}};_0x1058b2[_0xaa69('0xc')]['customfield_11500']=_0x5ed763[_0xaa69('0xd')];_0x1058b2['fields'][_0xaa69('0xe')]=_0x5ed763[_0xaa69('0xf')];_0x1058b2['fields'][_0xaa69('0x10')]=_0x5ed763[_0xaa69('0x11')];_0x1058b2[_0xaa69('0xc')]['customfield_11503']=_0x5ed763[_0xaa69('0x12')];_0x1058b2[_0xaa69('0xc')][_0xaa69('0x13')]=_0x5ed763[_0xaa69('0x14')];_0x1058b2[_0xaa69('0xc')][_0xaa69('0x15')]=_0x5ed763['ip'];var _0x32811f={'host':_0xaa69('0x16'),'port':0x1bb,'path':_0xaa69('0x17'),'method':_0xaa69('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xaa69('0x19'),'Authorization':_0xaa69('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0xaa69('0x1b')](_0xaa69('0x1c'))}};var _0x17d1dc=JSON[_0xaa69('0xa')](_0x1058b2);var _0x264245=https['request'](_0x32811f,function(_0x4b9975){_0x4b9975[_0xaa69('0x1d')]('utf8');var _0x32d2a7='';_0x4b9975['on'](_0xaa69('0x1e'),function(_0x127ff7){_0x32d2a7+=_0x127ff7;});_0x4b9975['on']('end',function(){if(_0x2e1d5d){return _0x2e1d5d[_0xaa69('0x1f')](_0x4b9975[_0xaa69('0x20')])[_0xaa69('0x21')](JSON['parse'](_0x32d2a7));}});});_0x264245['on'](_0xaa69('0x22'),function(_0xc6f6b4){if(_0x2e1d5d){return _0x2e1d5d[_0xaa69('0x1f')](0x1f4)[_0xaa69('0x21')]({'errors':[{'message':_0xaa69('0x23'),'type':'api.jira'}]});}});_0x264245[_0xaa69('0x24')](_0x17d1dc);_0x264245[_0xaa69('0x25')]();}exports[_0xaa69('0x26')]=openIssue;exports[_0xaa69('0x27')]=function(_0x80dbc8,_0x172060){_0x80dbc8[_0xaa69('0x28')]['ip']=_0x80dbc8[_0xaa69('0x29')][_0xaa69('0x2a')]||_0x80dbc8[_0xaa69('0x2b')][_0xaa69('0x2c')]||_0x80dbc8[_0xaa69('0x2d')][_0xaa69('0x2c')]||_0x80dbc8[_0xaa69('0x2b')][_0xaa69('0x2d')][_0xaa69('0x2c')];return openIssue(_0x80dbc8[_0xaa69('0x28')],_0x172060);}; \ No newline at end of file +var _0x4ca3=['reason','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','toString','base64','stringify','setEncoding','utf8','data','end','status','statusCode','json','parse','api.jira','write','openIssue','send','headers','x-forwarded-for','socket','remoteAddress','connection','body','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','Report','issuetype','Bug','email','customfield_11501','fields','customfield_11502','newToken','name','customfield_11504'];(function(_0x3b41a7,_0x43f713){var _0x3036a8=function(_0x4adb65){while(--_0x4adb65){_0x3b41a7['push'](_0x3b41a7['shift']());}};_0x3036a8(++_0x43f713);}(_0x4ca3,0xc6));var _0x34ca=function(_0x27b297,_0x2840bd){_0x27b297=_0x27b297-0x0;var _0x3e414c=_0x4ca3[_0x27b297];return _0x3e414c;};'use strict';var BPromise=require(_0x34ca('0x0'));var https=require(_0x34ca('0x1'));var logger=require(_0x34ca('0x2'))(_0x34ca('0x3'));var USERNAME='support';var PASSWORD=_0x34ca('0x4');function openIssue(_0x1a803c,_0x44ff72){var _0xc54d79={'fields':{'project':{'key':_0x1a803c[_0x34ca('0x5')]||_0x34ca('0x6')},'summary':(_0x1a803c['summary']||_0x34ca('0x7'))+'\x20from\x20'+_0x1a803c['ip'],'description':_0x1a803c['description']||JSON['stringify'](_0x1a803c),'issuetype':{'name':_0x1a803c[_0x34ca('0x8')]||_0x34ca('0x9')}}};_0xc54d79['fields']['customfield_11500']=_0x1a803c[_0x34ca('0xa')];_0xc54d79['fields'][_0x34ca('0xb')]=_0x1a803c['oldToken'];_0xc54d79[_0x34ca('0xc')][_0x34ca('0xd')]=_0x1a803c[_0x34ca('0xe')];_0xc54d79[_0x34ca('0xc')]['customfield_11503']=_0x1a803c[_0x34ca('0xf')];_0xc54d79[_0x34ca('0xc')][_0x34ca('0x10')]=_0x1a803c[_0x34ca('0x11')];_0xc54d79[_0x34ca('0xc')]['customfield_10102']=_0x1a803c['ip'];var _0x3b3a59={'host':_0x34ca('0x12'),'port':0x1bb,'path':_0x34ca('0x13'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x34ca('0x14'),'Authorization':_0x34ca('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0x34ca('0x16')](_0x34ca('0x17'))}};var _0x21b09c=JSON[_0x34ca('0x18')](_0xc54d79);var _0x15eb6a=https['request'](_0x3b3a59,function(_0x26ee97){_0x26ee97[_0x34ca('0x19')](_0x34ca('0x1a'));var _0x1337e2='';_0x26ee97['on'](_0x34ca('0x1b'),function(_0xbd819e){_0x1337e2+=_0xbd819e;});_0x26ee97['on'](_0x34ca('0x1c'),function(){if(_0x44ff72){return _0x44ff72[_0x34ca('0x1d')](_0x26ee97[_0x34ca('0x1e')])[_0x34ca('0x1f')](JSON[_0x34ca('0x20')](_0x1337e2));}});});_0x15eb6a['on']('error',function(_0x53b9ae){if(_0x44ff72){return _0x44ff72[_0x34ca('0x1d')](0x1f4)[_0x34ca('0x1f')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x34ca('0x21')}]});}});_0x15eb6a[_0x34ca('0x22')](_0x21b09c);_0x15eb6a['end']();}exports[_0x34ca('0x23')]=openIssue;exports[_0x34ca('0x24')]=function(_0x2cd84d,_0x1ace4e){_0x2cd84d['body']['ip']=_0x2cd84d[_0x34ca('0x25')][_0x34ca('0x26')]||_0x2cd84d['connection']['remoteAddress']||_0x2cd84d[_0x34ca('0x27')][_0x34ca('0x28')]||_0x2cd84d[_0x34ca('0x29')][_0x34ca('0x27')]['remoteAddress'];return openIssue(_0x2cd84d[_0x34ca('0x2a')],_0x1ace4e);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index fe23e44..84de723 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 _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','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x122e62,_0x3a0309){var _0x478733=function(_0x37c9b9){while(--_0x37c9b9){_0x122e62['push'](_0x122e62['shift']());}};_0x478733(++_0x3a0309);}(_0xe706,0xa3));var _0x6e70=function(_0xc923,_0x3c0d55){_0xc923=_0xc923-0x0;var _0x2ff917=_0xe706[_0xc923];return _0x2ff917;};'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 +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','show','post'];(function(_0x3fe6df,_0x5a04d4){var _0x372a0e=function(_0x144b98){while(--_0x144b98){_0x3fe6df['push'](_0x3fe6df['shift']());}};_0x372a0e(++_0x5a04d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index cdbbf46..eaf732a 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(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x7a54,0x106));var _0x47a5=function(_0x4225ee,_0x19ff7a){_0x4225ee=_0x4225ee-0x0;var _0x51218a=_0x7a54[_0x4225ee];return _0x51218a;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x3d89c4,_0x223469){_0x3d89c4=_0x3d89c4-0x0;var _0x49b104=_0x7a54[_0x3d89c4];return _0x49b104;};'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 88d6a91..077cb53 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 _0x36c3=['nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','JscriptyAnswerReport','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','sendStatus','end','json','offset','limit','count','set','apply','then','destroy','status','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length'];(function(_0xb7bb45,_0xfeddf2){var _0x3ffd50=function(_0x2bbb4a){while(--_0x2bbb4a){_0xb7bb45['push'](_0xb7bb45['shift']());}};_0x3ffd50(++_0xfeddf2);}(_0x36c3,0x1a6));var _0x336c=function(_0x36f47e,_0x1d85cd){_0x36f47e=_0x36f47e-0x0;var _0x4e6a98=_0x36c3[_0x36f47e];return _0x4e6a98;};'use strict';var emlformat=require(_0x336c('0x0'));var rimraf=require(_0x336c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x336c('0x2'));var rp=require(_0x336c('0x3'));var moment=require(_0x336c('0x4'));var BPromise=require(_0x336c('0x5'));var Mustache=require(_0x336c('0x6'));var util=require(_0x336c('0x7'));var path=require(_0x336c('0x8'));var sox=require('sox');var csv=require(_0x336c('0x9'));var ejs=require(_0x336c('0xa'));var fs=require('fs');var fs_extra=require(_0x336c('0xb'));var _=require(_0x336c('0xc'));var squel=require(_0x336c('0xd'));var crypto=require('crypto');var jsforce=require(_0x336c('0xe'));var deskjs=require(_0x336c('0xf'));var toCsv=require(_0x336c('0x9'));var querystring=require(_0x336c('0x10'));var Papa=require(_0x336c('0x11'));var Redis=require(_0x336c('0x12'));var authService=require(_0x336c('0x13'));var qs=require(_0x336c('0x14'));var as=require(_0x336c('0x15'));var hardwareService=require(_0x336c('0x16'));var logger=require(_0x336c('0x17'))(_0x336c('0x18'));var utils=require(_0x336c('0x19'));var config=require(_0x336c('0x1a'));var licenseUtil=require(_0x336c('0x1b'));var db=require(_0x336c('0x1c'))['db'];function respondWithStatusCode(_0x94b601,_0x4b08f8){_0x4b08f8=_0x4b08f8||0xcc;return function(_0x592a5b){if(_0x592a5b){return _0x94b601[_0x336c('0x1d')](_0x4b08f8);}return _0x94b601['status'](_0x4b08f8)[_0x336c('0x1e')]();};}function respondWithResult(_0xc6a857,_0x2115ce){_0x2115ce=_0x2115ce||0xc8;return function(_0x345be6){if(_0x345be6){return _0xc6a857['status'](_0x2115ce)[_0x336c('0x1f')](_0x345be6);}};}function respondWithFilteredResult(_0x15bc2b,_0x4ce90a){return function(_0x23b375){if(_0x23b375){var _0x5f5ae1=typeof _0x4ce90a[_0x336c('0x20')]==='undefined'&&typeof _0x4ce90a[_0x336c('0x21')]==='undefined';var _0x7610f4=_0x23b375[_0x336c('0x22')];var _0x4a46ff=_0x5f5ae1?0x0:_0x4ce90a['offset'];var _0x13db87=_0x5f5ae1?_0x23b375[_0x336c('0x22')]:_0x4ce90a[_0x336c('0x20')]+_0x4ce90a[_0x336c('0x21')];var _0x366182;if(_0x13db87>=_0x7610f4){_0x13db87=_0x7610f4;_0x366182=0xc8;}else{_0x366182=0xce;}_0x15bc2b['status'](_0x366182);return _0x15bc2b[_0x336c('0x23')]('Content-Range',_0x4a46ff+'-'+_0x13db87+'/'+_0x7610f4)['json'](_0x23b375);}return null;};}function patchUpdates(_0x5f401e){return function(_0x9d4fc6){try{jsonpatch[_0x336c('0x24')](_0x9d4fc6,_0x5f401e,!![]);}catch(_0x2c8254){return BPromise['reject'](_0x2c8254);}return _0x9d4fc6['save']();};}function saveUpdates(_0x5b6cc3,_0x3ba228){return function(_0x60d259){if(_0x60d259){return _0x60d259['update'](_0x5b6cc3)[_0x336c('0x25')](function(_0x421929){return _0x421929;});}return null;};}function removeEntity(_0x37a355,_0x56a6fb){return function(_0x473164){if(_0x473164){return _0x473164[_0x336c('0x26')]()[_0x336c('0x25')](function(){_0x37a355[_0x336c('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x401660,_0x9dc9bc){return function(_0x412a00){if(!_0x412a00){_0x401660[_0x336c('0x1d')](0x194);}return _0x412a00;};}function handleError(_0x27fcc2,_0x1cb083){_0x1cb083=_0x1cb083||0x1f4;return function(_0x567bfa){logger[_0x336c('0x28')](_0x567bfa[_0x336c('0x29')]);if(_0x567bfa[_0x336c('0x2a')]){delete _0x567bfa[_0x336c('0x2a')];}_0x27fcc2['status'](_0x1cb083)[_0x336c('0x2b')](_0x567bfa);};}exports[_0x336c('0x2c')]=function(_0x54b06b,_0x5476ff){var _0x562043={},_0x2ba9c1={},_0x1c7a34={'count':0x0,'rows':[]};var _0x489901=_['map'](db['JscriptyAnswerReport'][_0x336c('0x2d')],function(_0x37782a){return{'name':_0x37782a[_0x336c('0x2e')],'type':_0x37782a[_0x336c('0x2f')][_0x336c('0x30')]};});_0x2ba9c1[_0x336c('0x31')]=_[_0x336c('0x32')](_0x489901,'name');_0x2ba9c1[_0x336c('0x33')]=_[_0x336c('0x34')](_0x54b06b[_0x336c('0x33')]);_0x2ba9c1[_0x336c('0x35')]=_['intersection'](_0x2ba9c1[_0x336c('0x31')],_0x2ba9c1[_0x336c('0x33')]);_0x562043['attributes']=_[_0x336c('0x36')](_0x2ba9c1[_0x336c('0x31')],qs['fields'](_0x54b06b[_0x336c('0x33')][_0x336c('0x37')]));_0x562043[_0x336c('0x38')]=_0x562043[_0x336c('0x38')][_0x336c('0x39')]?_0x562043[_0x336c('0x38')]:_0x2ba9c1[_0x336c('0x31')];if(!_0x54b06b[_0x336c('0x33')]['hasOwnProperty'](_0x336c('0x3a'))){_0x562043[_0x336c('0x21')]=qs[_0x336c('0x21')](_0x54b06b[_0x336c('0x33')][_0x336c('0x21')]);_0x562043[_0x336c('0x20')]=qs[_0x336c('0x20')](_0x54b06b[_0x336c('0x33')][_0x336c('0x20')]);}_0x562043[_0x336c('0x3b')]=qs['sort'](_0x54b06b[_0x336c('0x33')][_0x336c('0x3c')]);_0x562043[_0x336c('0x3d')]=qs[_0x336c('0x35')](_[_0x336c('0x3e')](_0x54b06b[_0x336c('0x33')],_0x2ba9c1[_0x336c('0x35')]),_0x489901);if(_0x54b06b[_0x336c('0x33')][_0x336c('0x3f')]){_0x562043[_0x336c('0x3d')]=_['merge'](_0x562043[_0x336c('0x3d')],{'$or':_[_0x336c('0x32')](_0x489901,function(_0x3615a7){if(_0x3615a7['type']!==_0x336c('0x40')){var _0x154bc0={};_0x154bc0[_0x3615a7[_0x336c('0x2a')]]={'$like':'%'+_0x54b06b[_0x336c('0x33')]['filter']+'%'};return _0x154bc0;}})});}_0x562043=_[_0x336c('0x41')]({},_0x562043,_0x54b06b[_0x336c('0x42')]);var _0x478b10={'where':_0x562043[_0x336c('0x3d')]};return db[_0x336c('0x43')][_0x336c('0x22')](_0x478b10)['then'](function(_0x16c6c6){_0x1c7a34[_0x336c('0x22')]=_0x16c6c6;if(_0x54b06b[_0x336c('0x33')][_0x336c('0x44')]){_0x562043[_0x336c('0x45')]=[{'all':!![]}];}return db[_0x336c('0x43')][_0x336c('0x46')](_0x562043);})[_0x336c('0x25')](function(_0x1ab068){_0x1c7a34[_0x336c('0x47')]=_0x1ab068;return _0x1c7a34;})['then'](respondWithFilteredResult(_0x5476ff,_0x562043))[_0x336c('0x48')](handleError(_0x5476ff,null));};exports[_0x336c('0x49')]=function(_0x290750,_0x5b2f25){var _0x22ad35={'raw':!![],'where':{'id':_0x290750['params']['id']}},_0xabb11e={};_0xabb11e[_0x336c('0x31')]=_[_0x336c('0x34')](db[_0x336c('0x43')][_0x336c('0x2d')]);_0xabb11e['query']=_[_0x336c('0x34')](_0x290750[_0x336c('0x33')]);_0xabb11e['filters']=_[_0x336c('0x36')](_0xabb11e[_0x336c('0x31')],_0xabb11e['query']);_0x22ad35[_0x336c('0x38')]=_[_0x336c('0x36')](_0xabb11e[_0x336c('0x31')],qs[_0x336c('0x37')](_0x290750['query'][_0x336c('0x37')]));_0x22ad35[_0x336c('0x38')]=_0x22ad35[_0x336c('0x38')][_0x336c('0x39')]?_0x22ad35[_0x336c('0x38')]:_0xabb11e[_0x336c('0x31')];if(_0x290750[_0x336c('0x33')][_0x336c('0x44')]){_0x22ad35[_0x336c('0x45')]=[{'all':!![]}];}_0x22ad35=_['merge']({},_0x22ad35,_0x290750[_0x336c('0x42')]);return db[_0x336c('0x43')][_0x336c('0x4a')](_0x22ad35)[_0x336c('0x25')](handleEntityNotFound(_0x5b2f25,null))[_0x336c('0x25')](respondWithResult(_0x5b2f25,null))[_0x336c('0x48')](handleError(_0x5b2f25,null));};exports[_0x336c('0x4b')]=function(_0xbfac47,_0x3bdbb8){return db[_0x336c('0x43')][_0x336c('0x4b')](_0xbfac47[_0x336c('0x4c')],{})[_0x336c('0x25')](respondWithResult(_0x3bdbb8,0xc9))['catch'](handleError(_0x3bdbb8,null));};exports[_0x336c('0x4d')]=function(_0x57f151,_0x4f4e12){if(_0x57f151[_0x336c('0x4c')]['id']){delete _0x57f151['body']['id'];}return db['JscriptyAnswerReport'][_0x336c('0x4a')]({'where':{'id':_0x57f151['params']['id']}})[_0x336c('0x25')](handleEntityNotFound(_0x4f4e12,null))[_0x336c('0x25')](saveUpdates(_0x57f151[_0x336c('0x4c')],null))[_0x336c('0x25')](respondWithResult(_0x4f4e12,null))['catch'](handleError(_0x4f4e12,null));};exports['destroy']=function(_0x33f091,_0x17bfc9){return db['JscriptyAnswerReport'][_0x336c('0x4a')]({'where':{'id':_0x33f091[_0x336c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x17bfc9,null))[_0x336c('0x25')](removeEntity(_0x17bfc9,null))[_0x336c('0x48')](handleError(_0x17bfc9,null));};exports[_0x336c('0x4f')]=function(_0x2a0bf2,_0x4e0a2f){return db[_0x336c('0x43')][_0x336c('0x4f')]()['then'](respondWithResult(_0x4e0a2f,null))['catch'](handleError(_0x4e0a2f,null));}; \ No newline at end of file +var _0x5a2a=['body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','lodash','crypto','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','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create'];(function(_0x353b5f,_0x444867){var _0x6a687a=function(_0x4498ab){while(--_0x4498ab){_0x353b5f['push'](_0x353b5f['shift']());}};_0x6a687a(++_0x444867);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x9dd3ac,_0x4920e6){_0x9dd3ac=_0x9dd3ac-0x0;var _0x59a41b=_0x5a2a[_0x9dd3ac];return _0x59a41b;};'use strict';var emlformat=require(_0xa5a2('0x0'));var rimraf=require(_0xa5a2('0x1'));var zipdir=require(_0xa5a2('0x2'));var jsonpatch=require(_0xa5a2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa5a2('0x4'));var util=require(_0xa5a2('0x5'));var path=require('path');var sox=require(_0xa5a2('0x6'));var csv=require(_0xa5a2('0x7'));var ejs=require(_0xa5a2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5a2('0x9'));var squel=require('squel');var crypto=require(_0xa5a2('0xa'));var jsforce=require(_0xa5a2('0xb'));var deskjs=require(_0xa5a2('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa5a2('0xd'));var Redis=require(_0xa5a2('0xe'));var authService=require(_0xa5a2('0xf'));var qs=require(_0xa5a2('0x10'));var as=require(_0xa5a2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5a2('0x12'))(_0xa5a2('0x13'));var utils=require(_0xa5a2('0x14'));var config=require(_0xa5a2('0x15'));var licenseUtil=require(_0xa5a2('0x16'));var db=require(_0xa5a2('0x17'))['db'];function respondWithStatusCode(_0x501e3c,_0x5e71a8){_0x5e71a8=_0x5e71a8||0xcc;return function(_0x4a6a35){if(_0x4a6a35){return _0x501e3c[_0xa5a2('0x18')](_0x5e71a8);}return _0x501e3c[_0xa5a2('0x19')](_0x5e71a8)[_0xa5a2('0x1a')]();};}function respondWithResult(_0x29174b,_0x39d6a6){_0x39d6a6=_0x39d6a6||0xc8;return function(_0x488b10){if(_0x488b10){return _0x29174b[_0xa5a2('0x19')](_0x39d6a6)[_0xa5a2('0x1b')](_0x488b10);}};}function respondWithFilteredResult(_0x570d87,_0x20ae7c){return function(_0x1bdcd2){if(_0x1bdcd2){var _0x5e1b56=typeof _0x20ae7c[_0xa5a2('0x1c')]===_0xa5a2('0x1d')&&typeof _0x20ae7c['limit']===_0xa5a2('0x1d');var _0x996384=_0x1bdcd2[_0xa5a2('0x1e')];var _0xf874c0=_0x5e1b56?0x0:_0x20ae7c[_0xa5a2('0x1c')];var _0xe4b688=_0x5e1b56?_0x1bdcd2['count']:_0x20ae7c[_0xa5a2('0x1c')]+_0x20ae7c[_0xa5a2('0x1f')];var _0x21712b;if(_0xe4b688>=_0x996384){_0xe4b688=_0x996384;_0x21712b=0xc8;}else{_0x21712b=0xce;}_0x570d87[_0xa5a2('0x19')](_0x21712b);return _0x570d87[_0xa5a2('0x20')](_0xa5a2('0x21'),_0xf874c0+'-'+_0xe4b688+'/'+_0x996384)['json'](_0x1bdcd2);}return null;};}function patchUpdates(_0x299208){return function(_0x2fa65d){try{jsonpatch[_0xa5a2('0x22')](_0x2fa65d,_0x299208,!![]);}catch(_0x1116f8){return BPromise[_0xa5a2('0x23')](_0x1116f8);}return _0x2fa65d[_0xa5a2('0x24')]();};}function saveUpdates(_0x134877,_0x27f3bf){return function(_0x3a7a6a){if(_0x3a7a6a){return _0x3a7a6a[_0xa5a2('0x25')](_0x134877)[_0xa5a2('0x26')](function(_0x2adce9){return _0x2adce9;});}return null;};}function removeEntity(_0x9a6e53,_0x349f94){return function(_0x4c8faf){if(_0x4c8faf){return _0x4c8faf['destroy']()['then'](function(){_0x9a6e53[_0xa5a2('0x19')](0xcc)[_0xa5a2('0x1a')]();});}};}function handleEntityNotFound(_0x2f0317,_0x445aee){return function(_0x43d74d){if(!_0x43d74d){_0x2f0317[_0xa5a2('0x18')](0x194);}return _0x43d74d;};}function handleError(_0x29556e,_0x1ad00c){_0x1ad00c=_0x1ad00c||0x1f4;return function(_0x50722e){logger[_0xa5a2('0x27')](_0x50722e[_0xa5a2('0x28')]);if(_0x50722e['name']){delete _0x50722e[_0xa5a2('0x29')];}_0x29556e[_0xa5a2('0x19')](_0x1ad00c)['send'](_0x50722e);};}exports[_0xa5a2('0x2a')]=function(_0x406f3d,_0x38bd1b){var _0x180b8a={},_0x5284a9={},_0x41eae4={'count':0x0,'rows':[]};var _0x25b806=_[_0xa5a2('0x2b')](db[_0xa5a2('0x2c')][_0xa5a2('0x2d')],function(_0x1475ec){return{'name':_0x1475ec[_0xa5a2('0x2e')],'type':_0x1475ec[_0xa5a2('0x2f')][_0xa5a2('0x30')]};});_0x5284a9[_0xa5a2('0x31')]=_[_0xa5a2('0x2b')](_0x25b806,_0xa5a2('0x29'));_0x5284a9[_0xa5a2('0x32')]=_['keys'](_0x406f3d[_0xa5a2('0x32')]);_0x5284a9['filters']=_[_0xa5a2('0x33')](_0x5284a9[_0xa5a2('0x31')],_0x5284a9[_0xa5a2('0x32')]);_0x180b8a[_0xa5a2('0x34')]=_['intersection'](_0x5284a9['model'],qs[_0xa5a2('0x35')](_0x406f3d['query']['fields']));_0x180b8a[_0xa5a2('0x34')]=_0x180b8a[_0xa5a2('0x34')]['length']?_0x180b8a[_0xa5a2('0x34')]:_0x5284a9[_0xa5a2('0x31')];if(!_0x406f3d[_0xa5a2('0x32')]['hasOwnProperty']('nolimit')){_0x180b8a[_0xa5a2('0x1f')]=qs[_0xa5a2('0x1f')](_0x406f3d[_0xa5a2('0x32')][_0xa5a2('0x1f')]);_0x180b8a[_0xa5a2('0x1c')]=qs[_0xa5a2('0x1c')](_0x406f3d[_0xa5a2('0x32')]['offset']);}_0x180b8a[_0xa5a2('0x36')]=qs[_0xa5a2('0x37')](_0x406f3d[_0xa5a2('0x32')][_0xa5a2('0x37')]);_0x180b8a['where']=qs[_0xa5a2('0x38')](_[_0xa5a2('0x39')](_0x406f3d['query'],_0x5284a9[_0xa5a2('0x38')]),_0x25b806);if(_0x406f3d[_0xa5a2('0x32')][_0xa5a2('0x3a')]){_0x180b8a[_0xa5a2('0x3b')]=_[_0xa5a2('0x3c')](_0x180b8a[_0xa5a2('0x3b')],{'$or':_[_0xa5a2('0x2b')](_0x25b806,function(_0x2e31c1){if(_0x2e31c1[_0xa5a2('0x2f')]!==_0xa5a2('0x3d')){var _0x19ddc7={};_0x19ddc7[_0x2e31c1['name']]={'$like':'%'+_0x406f3d['query']['filter']+'%'};return _0x19ddc7;}})});}_0x180b8a=_[_0xa5a2('0x3c')]({},_0x180b8a,_0x406f3d[_0xa5a2('0x3e')]);var _0x2a4546={'where':_0x180b8a[_0xa5a2('0x3b')]};return db[_0xa5a2('0x2c')][_0xa5a2('0x1e')](_0x2a4546)['then'](function(_0x18b538){_0x41eae4[_0xa5a2('0x1e')]=_0x18b538;if(_0x406f3d['query'][_0xa5a2('0x3f')]){_0x180b8a[_0xa5a2('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xa5a2('0x41')](_0x180b8a);})[_0xa5a2('0x26')](function(_0x4c81aa){_0x41eae4[_0xa5a2('0x42')]=_0x4c81aa;return _0x41eae4;})[_0xa5a2('0x26')](respondWithFilteredResult(_0x38bd1b,_0x180b8a))[_0xa5a2('0x43')](handleError(_0x38bd1b,null));};exports[_0xa5a2('0x44')]=function(_0x4bfe06,_0x2b6d6a){var _0x35d9ed={'raw':!![],'where':{'id':_0x4bfe06[_0xa5a2('0x45')]['id']}},_0x28d0c8={};_0x28d0c8['model']=_[_0xa5a2('0x46')](db[_0xa5a2('0x2c')]['rawAttributes']);_0x28d0c8[_0xa5a2('0x32')]=_[_0xa5a2('0x46')](_0x4bfe06['query']);_0x28d0c8['filters']=_['intersection'](_0x28d0c8[_0xa5a2('0x31')],_0x28d0c8['query']);_0x35d9ed['attributes']=_['intersection'](_0x28d0c8['model'],qs['fields'](_0x4bfe06[_0xa5a2('0x32')][_0xa5a2('0x35')]));_0x35d9ed['attributes']=_0x35d9ed[_0xa5a2('0x34')][_0xa5a2('0x47')]?_0x35d9ed[_0xa5a2('0x34')]:_0x28d0c8[_0xa5a2('0x31')];if(_0x4bfe06[_0xa5a2('0x32')][_0xa5a2('0x3f')]){_0x35d9ed[_0xa5a2('0x40')]=[{'all':!![]}];}_0x35d9ed=_['merge']({},_0x35d9ed,_0x4bfe06[_0xa5a2('0x3e')]);return db[_0xa5a2('0x2c')][_0xa5a2('0x48')](_0x35d9ed)[_0xa5a2('0x26')](handleEntityNotFound(_0x2b6d6a,null))['then'](respondWithResult(_0x2b6d6a,null))['catch'](handleError(_0x2b6d6a,null));};exports[_0xa5a2('0x49')]=function(_0x5d96a9,_0xdba957){return db[_0xa5a2('0x2c')][_0xa5a2('0x49')](_0x5d96a9['body'],{})['then'](respondWithResult(_0xdba957,0xc9))[_0xa5a2('0x43')](handleError(_0xdba957,null));};exports[_0xa5a2('0x25')]=function(_0x589b52,_0x44d1ea){if(_0x589b52[_0xa5a2('0x4a')]['id']){delete _0x589b52[_0xa5a2('0x4a')]['id'];}return db[_0xa5a2('0x2c')][_0xa5a2('0x48')]({'where':{'id':_0x589b52[_0xa5a2('0x45')]['id']}})[_0xa5a2('0x26')](handleEntityNotFound(_0x44d1ea,null))[_0xa5a2('0x26')](saveUpdates(_0x589b52[_0xa5a2('0x4a')],null))['then'](respondWithResult(_0x44d1ea,null))['catch'](handleError(_0x44d1ea,null));};exports['destroy']=function(_0x1c391f,_0x429446){return db[_0xa5a2('0x2c')][_0xa5a2('0x48')]({'where':{'id':_0x1c391f[_0xa5a2('0x45')]['id']}})[_0xa5a2('0x26')](handleEntityNotFound(_0x429446,null))[_0xa5a2('0x26')](removeEntity(_0x429446,null))['catch'](handleError(_0x429446,null));};exports['describe']=function(_0x8b464e,_0x1d8bf0){return db[_0xa5a2('0x2c')]['describe']()['then'](respondWithResult(_0x1d8bf0,null))[_0xa5a2('0x43')](handleError(_0x1d8bf0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 3e2c9fd..d4e7737 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 _0x83a2=['exports','define','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0xdaf681,_0x2b6320){var _0x3897ec=function(_0x58a392){while(--_0x58a392){_0xdaf681['push'](_0xdaf681['shift']());}};_0x3897ec(++_0x2b6320);}(_0x83a2,0x1ec));var _0x283a=function(_0x388f5e,_0x37f507){_0x388f5e=_0x388f5e-0x0;var _0x10c7b1=_0x83a2[_0x388f5e];return _0x10c7b1;};'use strict';var _=require(_0x283a('0x0'));var util=require('util');var logger=require(_0x283a('0x1'))('api');var moment=require(_0x283a('0x2'));var BPromise=require(_0x283a('0x3'));var rp=require(_0x283a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x283a('0x5'));var config=require(_0x283a('0x6'));var attributes=require(_0x283a('0x7'));module[_0x283a('0x8')]=function(_0x2d0da9,_0x390be0){return _0x2d0da9[_0x283a('0x9')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c57=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x5d6a84,_0x10929c){var _0x930f0=function(_0x28af93){while(--_0x28af93){_0x5d6a84['push'](_0x5d6a84['shift']());}};_0x930f0(++_0x10929c);}(_0x0c57,0x179));var _0x70c5=function(_0x4d1f4b,_0x4168bb){_0x4d1f4b=_0x4d1f4b-0x0;var _0x40e281=_0x0c57[_0x4d1f4b];return _0x40e281;};'use strict';var _=require(_0x70c5('0x0'));var util=require(_0x70c5('0x1'));var logger=require(_0x70c5('0x2'))(_0x70c5('0x3'));var moment=require(_0x70c5('0x4'));var BPromise=require(_0x70c5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x70c5('0x6'));var config=require(_0x70c5('0x7'));var attributes=require(_0x70c5('0x8'));module[_0x70c5('0x9')]=function(_0x1a44a3,_0x1cebe2){return _0x1a44a3[_0x70c5('0xa')](_0x70c5('0xb'),attributes,{'tableName':_0x70c5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 3d6f8f9..2643489 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 _0x8ec2=['stringify','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0xb4947e,_0x39de27){var _0x2af6df=function(_0x308271){while(--_0x308271){_0xb4947e['push'](_0xb4947e['shift']());}};_0x2af6df(++_0x39de27);}(_0x8ec2,0xe2));var _0x28ec=function(_0xb5fc12,_0x52af9e){_0xb5fc12=_0xb5fc12-0x0;var _0x41063c=_0x8ec2[_0xb5fc12];return _0x41063c;};'use strict';var _=require(_0x28ec('0x0'));var util=require(_0x28ec('0x1'));var moment=require('moment');var BPromise=require(_0x28ec('0x2'));var rs=require(_0x28ec('0x3'));var fs=require('fs');var Redis=require(_0x28ec('0x4'));var db=require(_0x28ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x28ec('0x6'));var config=require(_0x28ec('0x7'));var jayson=require(_0x28ec('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c826e,_0x4869fa,_0x1ecdba){return new BPromise(function(_0x321392,_0x5b7f1c){return client[_0x28ec('0x9')](_0x4c826e,_0x1ecdba)['then'](function(_0x23da5b){logger['info'](_0x28ec('0xa'),_0x4869fa,_0x28ec('0xb'));logger[_0x28ec('0xc')](_0x28ec('0xd'),_0x4869fa,'request\x20sent',JSON[_0x28ec('0xe')](_0x23da5b));if(_0x23da5b[_0x28ec('0xf')]){if(_0x23da5b[_0x28ec('0xf')]['code']===0x1f4){logger[_0x28ec('0xf')](_0x28ec('0xa'),_0x4869fa,_0x23da5b[_0x28ec('0xf')][_0x28ec('0x10')]);return _0x5b7f1c(_0x23da5b[_0x28ec('0xf')][_0x28ec('0x10')]);}logger[_0x28ec('0xf')](_0x28ec('0xa'),_0x4869fa,_0x23da5b[_0x28ec('0xf')]['message']);return _0x321392(_0x23da5b[_0x28ec('0xf')]['message']);}else{logger[_0x28ec('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4869fa,_0x28ec('0xb'));_0x321392(_0x23da5b[_0x28ec('0x12')][_0x28ec('0x10')]);}})[_0x28ec('0x13')](function(_0x365fdc){logger[_0x28ec('0xf')](_0x28ec('0xa'),_0x4869fa,_0x365fdc);_0x5b7f1c(_0x365fdc);});});} \ No newline at end of file +var _0xda1c=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xda1c,0x123));var _0xcda1=function(_0x5f4213,_0x4ba2f4){_0x5f4213=_0x5f4213-0x0;var _0x56a61c=_0xda1c[_0x5f4213];return _0x56a61c;};'use strict';var _=require('lodash');var util=require(_0xcda1('0x0'));var moment=require(_0xcda1('0x1'));var BPromise=require(_0xcda1('0x2'));var rs=require(_0xcda1('0x3'));var fs=require('fs');var Redis=require(_0xcda1('0x4'));var db=require(_0xcda1('0x5'))['db'];var utils=require(_0xcda1('0x6'));var logger=require('../../config/logger')(_0xcda1('0x7'));var config=require(_0xcda1('0x8'));var jayson=require(_0xcda1('0x9'));var client=jayson[_0xcda1('0xa')][_0xcda1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c5ad4,_0x633f65,_0x5088bf){return new BPromise(function(_0xb3a9ff,_0x39c309){return client[_0xcda1('0xc')](_0x4c5ad4,_0x5088bf)[_0xcda1('0xd')](function(_0x596932){logger['info'](_0xcda1('0xe'),_0x633f65,_0xcda1('0xf'));logger[_0xcda1('0x10')](_0xcda1('0x11'),_0x633f65,'request\x20sent',JSON[_0xcda1('0x12')](_0x596932));if(_0x596932['error']){if(_0x596932[_0xcda1('0x13')][_0xcda1('0x14')]===0x1f4){logger[_0xcda1('0x13')](_0xcda1('0xe'),_0x633f65,_0x596932['error'][_0xcda1('0x15')]);return _0x39c309(_0x596932[_0xcda1('0x13')][_0xcda1('0x15')]);}logger[_0xcda1('0x13')](_0xcda1('0xe'),_0x633f65,_0x596932['error'][_0xcda1('0x15')]);return _0xb3a9ff(_0x596932[_0xcda1('0x13')][_0xcda1('0x15')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x633f65,'request\x20sent');_0xb3a9ff(_0x596932[_0xcda1('0x16')][_0xcda1('0x15')]);}})[_0xcda1('0x17')](function(_0x5cc5d6){logger[_0xcda1('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x633f65,_0x5cc5d6);_0x39c309(_0x5cc5d6);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 7c26d38..f0bb4d8 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 _0x825b=['delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','clone','put','update'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0x825b,0x17a));var _0xb825=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x825b[_0x1c34e7];return _0x378cb1;};'use strict';var multer=require('multer');var util=require(_0xb825('0x0'));var path=require(_0xb825('0x1'));var timeout=require('connect-timeout');var express=require(_0xb825('0x2'));var router=express[_0xb825('0x3')]();var fs_extra=require(_0xb825('0x4'));var auth=require(_0xb825('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb825('0x6'));router['get']('/',auth[_0xb825('0x7')](),controller[_0xb825('0x8')]);router[_0xb825('0x9')](_0xb825('0xa'),auth[_0xb825('0x7')](),controller[_0xb825('0xb')]);router[_0xb825('0x9')]('/:id/sessions',auth[_0xb825('0x7')](),controller['getSessions']);router['get'](_0xb825('0xc'),auth['isAuthenticated'](),controller[_0xb825('0xd')]);router[_0xb825('0x9')](_0xb825('0xe'),auth['isAuthenticated'](),timeout(_0xb825('0xf')),controller[_0xb825('0x10')]);router[_0xb825('0x11')]('/',auth['isAuthenticated'](),controller[_0xb825('0x12')]);router[_0xb825('0x11')]('/:id/clone',auth[_0xb825('0x7')](),controller[_0xb825('0x13')]);router[_0xb825('0x14')]('/:id',auth[_0xb825('0x7')](),controller[_0xb825('0x15')]);router[_0xb825('0x16')](_0xb825('0xa'),auth[_0xb825('0x7')](),controller[_0xb825('0x17')]);module[_0xb825('0x18')]=router; \ No newline at end of file +var _0x5706=['/:id/answers','getAnswers','getSummary','post','create','/:id/clone','clone','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','show','isAuthenticated','getSessions'];(function(_0x3c04ef,_0x9d110c){var _0x6a3a69=function(_0x333514){while(--_0x333514){_0x3c04ef['push'](_0x3c04ef['shift']());}};_0x6a3a69(++_0x9d110c);}(_0x5706,0x136));var _0x6570=function(_0xa3a31f,_0x19333d){_0xa3a31f=_0xa3a31f-0x0;var _0x103d0f=_0x5706[_0xa3a31f];return _0x103d0f;};'use strict';var multer=require(_0x6570('0x0'));var util=require(_0x6570('0x1'));var path=require(_0x6570('0x2'));var timeout=require(_0x6570('0x3'));var express=require(_0x6570('0x4'));var router=express[_0x6570('0x5')]();var fs_extra=require(_0x6570('0x6'));var auth=require(_0x6570('0x7'));var interaction=require(_0x6570('0x8'));var config=require(_0x6570('0x9'));var controller=require('./jscriptyProject.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6570('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6570('0xb')]);router['get']('/:id/sessions',auth[_0x6570('0xc')](),controller[_0x6570('0xd')]);router[_0x6570('0xa')](_0x6570('0xe'),auth[_0x6570('0xc')](),controller[_0x6570('0xf')]);router[_0x6570('0xa')]('/:id/summary',auth[_0x6570('0xc')](),timeout('30s'),controller[_0x6570('0x10')]);router[_0x6570('0x11')]('/',auth[_0x6570('0xc')](),controller[_0x6570('0x12')]);router[_0x6570('0x11')](_0x6570('0x13'),auth[_0x6570('0xc')](),controller[_0x6570('0x14')]);router[_0x6570('0x15')](_0x6570('0x16'),auth[_0x6570('0xc')](),controller[_0x6570('0x17')]);router[_0x6570('0x18')](_0x6570('0x16'),auth[_0x6570('0xc')](),controller[_0x6570('0x19')]);module[_0x6570('0x1a')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index fb34f0e..e0cc77e 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 _0x0adc=['stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData'];(function(_0x3d308c,_0x756cd){var _0x5691ca=function(_0x57dbbc){while(--_0x57dbbc){_0x3d308c['push'](_0x3d308c['shift']());}};_0x5691ca(++_0x756cd);}(_0x0adc,0x1ed));var _0xc0ad=function(_0x38813c,_0x561563){_0x38813c=_0x38813c-0x0;var _0x52183e=_0x0adc[_0x38813c];return _0x52183e;};'use strict';var Sequelize=require(_0xc0ad('0x0'));var _=require(_0xc0ad('0x1'));var util=require(_0xc0ad('0x2'));module[_0xc0ad('0x3')]={'name':{'type':Sequelize[_0xc0ad('0x4')],'unique':_0xc0ad('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xc0ad('0x6')](_0xc0ad('0x7')),'set':function(_0x375cfc){if(_[_0xc0ad('0x8')](_0x375cfc)){this[_0xc0ad('0x9')](_0xc0ad('0xa'),JSON[_0xc0ad('0xb')](_0x375cfc));}else if(_[_0xc0ad('0xc')](_0x375cfc)){this[_0xc0ad('0x9')](_0xc0ad('0xa'),_0x375cfc);}else{this[_0xc0ad('0x9')](_0xc0ad('0xa'),util[_0xc0ad('0xd')](_0xc0ad('0xe'),this['getDataValue'](_0xc0ad('0x5'))||'',this[_0xc0ad('0xf')](_0xc0ad('0x10'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xc0ad('0x11')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xc0ad('0x11')],'defaultValue':![]}}; \ No newline at end of file +var _0x4439=['getDataValue','name','BOOLEAN','sequelize','exports','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x45f6cb,_0x531af6){var _0x5b7f93=function(_0x1296ba){while(--_0x1296ba){_0x45f6cb['push'](_0x45f6cb['shift']());}};_0x5b7f93(++_0x531af6);}(_0x4439,0x189));var _0x9443=function(_0x60286b,_0x3247c1){_0x60286b=_0x60286b-0x0;var _0x5dff69=_0x4439[_0x60286b];return _0x5dff69;};'use strict';var Sequelize=require(_0x9443('0x0'));var _=require('lodash');var util=require('util');module[_0x9443('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x9443('0x2')](_0x9443('0x3')),'set':function(_0x13b3d0){if(_[_0x9443('0x4')](_0x13b3d0)){this[_0x9443('0x5')]('formData',JSON[_0x9443('0x6')](_0x13b3d0));}else if(_[_0x9443('0x7')](_0x13b3d0)){this['setDataValue'](_0x9443('0x8'),_0x13b3d0);}else{this[_0x9443('0x5')](_0x9443('0x8'),util['format'](_0x9443('0x9'),this[_0x9443('0xa')](_0x9443('0xb'))||'',this[_0x9443('0xa')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x9443('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x9443('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 b6f2d81..212b63f 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 _0x04b5=['include','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','update','getSessions','findOne','JscriptySessionReport','rawAttributes','nolimit','sort','ProjectId','getAnswers','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','-createdAt','questionId','question','format','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Content-type','download','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','Projects','UserProfileResource','sendStatus','error','stack','send','index','map','JscriptyProject','type','key','name','query','intersection','model','attributes','fields','hasOwnProperty','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','length','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone'];(function(_0x3fae8a,_0x1b9262){var _0x59dde5=function(_0x2f84fd){while(--_0x2f84fd){_0x3fae8a['push'](_0x3fae8a['shift']());}};_0x59dde5(++_0x1b9262);}(_0x04b5,0x1ef));var _0x504b=function(_0x2880dc,_0x348d24){_0x2880dc=_0x2880dc-0x0;var _0x53d099=_0x04b5[_0x2880dc];return _0x53d099;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x504b('0x0'));var zipdir=require(_0x504b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x504b('0x2'));var moment=require(_0x504b('0x3'));var BPromise=require(_0x504b('0x4'));var Mustache=require(_0x504b('0x5'));var util=require('util');var path=require(_0x504b('0x6'));var sox=require(_0x504b('0x7'));var csv=require(_0x504b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x504b('0x9'));var _=require(_0x504b('0xa'));var squel=require(_0x504b('0xb'));var crypto=require(_0x504b('0xc'));var jsforce=require(_0x504b('0xd'));var deskjs=require(_0x504b('0xe'));var toCsv=require(_0x504b('0x8'));var querystring=require(_0x504b('0xf'));var Papa=require(_0x504b('0x10'));var Redis=require(_0x504b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x504b('0x12'));var as=require(_0x504b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x504b('0x14'));var utils=require(_0x504b('0x15'));var config=require(_0x504b('0x16'));var licenseUtil=require(_0x504b('0x17'));var db=require(_0x504b('0x18'))['db'];function respondWithStatusCode(_0x982762,_0xed922e){_0xed922e=_0xed922e||0xcc;return function(_0x17e3a8){if(_0x17e3a8){return _0x982762['sendStatus'](_0xed922e);}return _0x982762['status'](_0xed922e)[_0x504b('0x19')]();};}function respondWithResult(_0xcf295,_0x2feaea){_0x2feaea=_0x2feaea||0xc8;return function(_0x32df02){if(_0x32df02){return _0xcf295[_0x504b('0x1a')](_0x2feaea)[_0x504b('0x1b')](_0x32df02);}};}function respondWithFilteredResult(_0x4f2bb2,_0x537f6c){return function(_0x4db6a4){if(_0x4db6a4){var _0x224a76=typeof _0x537f6c[_0x504b('0x1c')]===_0x504b('0x1d')&&typeof _0x537f6c[_0x504b('0x1e')]===_0x504b('0x1d');var _0x57380f=_0x4db6a4[_0x504b('0x1f')];var _0x4a039f=_0x224a76?0x0:_0x537f6c['offset'];var _0x5e6e6b=_0x224a76?_0x4db6a4[_0x504b('0x1f')]:_0x537f6c[_0x504b('0x1c')]+_0x537f6c[_0x504b('0x1e')];var _0x1f28e5;if(_0x5e6e6b>=_0x57380f){_0x5e6e6b=_0x57380f;_0x1f28e5=0xc8;}else{_0x1f28e5=0xce;}_0x4f2bb2['status'](_0x1f28e5);return _0x4f2bb2[_0x504b('0x20')](_0x504b('0x21'),_0x4a039f+'-'+_0x5e6e6b+'/'+_0x57380f)[_0x504b('0x1b')](_0x4db6a4);}return null;};}function patchUpdates(_0x28616e){return function(_0x840a14){try{jsonpatch[_0x504b('0x22')](_0x840a14,_0x28616e,!![]);}catch(_0x1bf2b8){return BPromise['reject'](_0x1bf2b8);}return _0x840a14[_0x504b('0x23')]();};}function saveUpdates(_0x1821fd,_0x42b8cd){return function(_0x569c7b){if(_0x569c7b){return _0x569c7b['update'](_0x1821fd)[_0x504b('0x24')](function(_0x13413c){return _0x13413c;});}return null;};}function removeEntity(_0xc6fe0,_0x3fbfa0){return function(_0x16c032){if(_0x16c032){return _0x16c032[_0x504b('0x25')]()['then'](function(){var _0x2bba35=_0x16c032[_0x504b('0x26')]({'plain':!![]});var _0x3b574e=_0x504b('0x27');return db[_0x504b('0x28')][_0x504b('0x25')]({'where':{'type':_0x3b574e,'resourceId':_0x2bba35['id']}})[_0x504b('0x24')](function(){return _0x16c032;});})[_0x504b('0x24')](function(){_0xc6fe0['status'](0xcc)[_0x504b('0x19')]();});}};}function handleEntityNotFound(_0x5832f1,_0x4ffaa6){return function(_0x45319f){if(!_0x45319f){_0x5832f1[_0x504b('0x29')](0x194);}return _0x45319f;};}function handleError(_0x1f8544,_0x31b4c5){_0x31b4c5=_0x31b4c5||0x1f4;return function(_0x3495be){logger[_0x504b('0x2a')](_0x3495be[_0x504b('0x2b')]);if(_0x3495be['name']){delete _0x3495be['name'];}_0x1f8544[_0x504b('0x1a')](_0x31b4c5)[_0x504b('0x2c')](_0x3495be);};}exports[_0x504b('0x2d')]=function(_0x227af0,_0x1037fe){var _0x2272e4={},_0x5de9b0={},_0x10402b={'count':0x0,'rows':[]};var _0x411427=_[_0x504b('0x2e')](db[_0x504b('0x2f')]['rawAttributes'],function(_0x1163d6){return{'name':_0x1163d6['fieldName'],'type':_0x1163d6[_0x504b('0x30')][_0x504b('0x31')]};});_0x5de9b0['model']=_['map'](_0x411427,_0x504b('0x32'));_0x5de9b0[_0x504b('0x33')]=_['keys'](_0x227af0['query']);_0x5de9b0['filters']=_[_0x504b('0x34')](_0x5de9b0[_0x504b('0x35')],_0x5de9b0[_0x504b('0x33')]);_0x2272e4[_0x504b('0x36')]=_[_0x504b('0x34')](_0x5de9b0[_0x504b('0x35')],qs[_0x504b('0x37')](_0x227af0[_0x504b('0x33')][_0x504b('0x37')]));_0x2272e4[_0x504b('0x36')]=_0x2272e4[_0x504b('0x36')]['length']?_0x2272e4[_0x504b('0x36')]:_0x5de9b0[_0x504b('0x35')];if(!_0x227af0[_0x504b('0x33')][_0x504b('0x38')]('nolimit')){_0x2272e4[_0x504b('0x1e')]=qs[_0x504b('0x1e')](_0x227af0[_0x504b('0x33')][_0x504b('0x1e')]);_0x2272e4[_0x504b('0x1c')]=qs[_0x504b('0x1c')](_0x227af0['query'][_0x504b('0x1c')]);}_0x2272e4['order']=qs['sort'](_0x227af0[_0x504b('0x33')]['sort']);_0x2272e4[_0x504b('0x39')]=qs[_0x504b('0x3a')](_[_0x504b('0x3b')](_0x227af0[_0x504b('0x33')],_0x5de9b0[_0x504b('0x3a')]),_0x411427);if(_0x227af0[_0x504b('0x33')][_0x504b('0x3c')]){_0x2272e4[_0x504b('0x39')]=_[_0x504b('0x3d')](_0x2272e4['where'],{'$or':_[_0x504b('0x2e')](_0x411427,function(_0x36d589){if(_0x36d589[_0x504b('0x30')]!==_0x504b('0x3e')){var _0x4fe5b2={};_0x4fe5b2[_0x36d589[_0x504b('0x32')]]={'$like':'%'+_0x227af0[_0x504b('0x33')][_0x504b('0x3c')]+'%'};return _0x4fe5b2;}})});}_0x2272e4=_[_0x504b('0x3d')]({},_0x2272e4,_0x227af0[_0x504b('0x3f')]);var _0x5b7a4e={'where':_0x2272e4[_0x504b('0x39')]};return db[_0x504b('0x2f')][_0x504b('0x1f')](_0x5b7a4e)[_0x504b('0x24')](function(_0xf5e637){_0x10402b['count']=_0xf5e637;if(_0x227af0[_0x504b('0x33')][_0x504b('0x40')]){_0x2272e4['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x504b('0x41')](_0x2272e4);})[_0x504b('0x24')](function(_0x574cf9){_0x10402b[_0x504b('0x42')]=_0x574cf9;return _0x10402b;})[_0x504b('0x24')](respondWithFilteredResult(_0x1037fe,_0x2272e4))[_0x504b('0x43')](handleError(_0x1037fe,null));};exports[_0x504b('0x44')]=function(_0x33102b,_0x1173a1){var _0x105ab8={'raw':![],'where':{'id':_0x33102b[_0x504b('0x45')]['id']}},_0x46dd2b={};_0x46dd2b[_0x504b('0x35')]=_[_0x504b('0x46')](db[_0x504b('0x2f')]['rawAttributes']);_0x46dd2b[_0x504b('0x33')]=_['keys'](_0x33102b[_0x504b('0x33')]);_0x46dd2b['filters']=_[_0x504b('0x34')](_0x46dd2b[_0x504b('0x35')],_0x46dd2b[_0x504b('0x33')]);_0x105ab8[_0x504b('0x36')]=_[_0x504b('0x34')](_0x46dd2b['model'],qs[_0x504b('0x37')](_0x33102b[_0x504b('0x33')]['fields']));_0x105ab8['attributes']=_0x105ab8[_0x504b('0x36')][_0x504b('0x47')]?_0x105ab8['attributes']:_0x46dd2b[_0x504b('0x35')];if(_0x33102b['query'][_0x504b('0x40')]){_0x105ab8['include']=[{'all':!![]}];}_0x105ab8=_['merge']({},_0x105ab8,_0x33102b[_0x504b('0x3f')]);return db[_0x504b('0x2f')][_0x504b('0x48')](_0x105ab8)['then'](handleEntityNotFound(_0x1173a1,null))['then'](respondWithResult(_0x1173a1,null))[_0x504b('0x43')](handleError(_0x1173a1,null));};exports[_0x504b('0x49')]=function(_0xf17b02,_0xead4ab){return db[_0x504b('0x2f')][_0x504b('0x49')](_0xf17b02[_0x504b('0x4a')],{})[_0x504b('0x24')](function(_0x5b88e9){var _0x149782=_0xf17b02[_0x504b('0x4b')][_0x504b('0x26')]({'plain':!![]});if(!_0x149782)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x149782['role']===_0x504b('0x4b')){var _0x11fb4d=_0x5b88e9[_0x504b('0x26')]({'plain':!![]});var _0x4f11c1=_0x504b('0x27');return db[_0x504b('0x4c')]['find']({'where':{'name':_0x4f11c1,'userProfileId':_0x149782['userProfileId']},'raw':!![]})['then'](function(_0x5dcac9){if(_0x5dcac9&&_0x5dcac9[_0x504b('0x4d')]===0x0){return db['UserProfileResource'][_0x504b('0x49')]({'name':_0x11fb4d[_0x504b('0x32')],'resourceId':_0x11fb4d['id'],'type':_0x5dcac9['name'],'sectionId':_0x5dcac9['id']},{})[_0x504b('0x24')](function(){return _0x5b88e9;});}else{return _0x5b88e9;}})[_0x504b('0x43')](function(_0x4ea3ad){logger[_0x504b('0x2a')](_0x504b('0x4e'),_0x4ea3ad);throw _0x4ea3ad;});}return _0x5b88e9;})[_0x504b('0x24')](respondWithResult(_0xead4ab,0xc9))[_0x504b('0x43')](handleError(_0xead4ab,null));};exports[_0x504b('0x4f')]=function(_0x3f657c,_0x4bf610){var _0x55a450={'where':{'id':_0x3f657c[_0x504b('0x45')]['id']}},_0x42e8e8={};_0x42e8e8[_0x504b('0x35')]=_[_0x504b('0x46')](db[_0x504b('0x2f')]['rawAttributes']);_0x55a450[_0x504b('0x36')]=_[_0x504b('0x34')](_0x42e8e8[_0x504b('0x35')],qs[_0x504b('0x37')](_0x3f657c[_0x504b('0x33')][_0x504b('0x37')]));_0x55a450[_0x504b('0x36')]=_0x55a450[_0x504b('0x36')][_0x504b('0x47')]?_0x55a450[_0x504b('0x36')]:_0x42e8e8[_0x504b('0x35')];if(_0x3f657c[_0x504b('0x33')][_0x504b('0x40')]){_0x55a450[_0x504b('0x50')]=[{'all':!![]}];}_0x55a450=_[_0x504b('0x3d')]({},_0x55a450,_0x3f657c['options']);return db[_0x504b('0x2f')][_0x504b('0x48')](_0x55a450)[_0x504b('0x24')](handleEntityNotFound(_0x4bf610,null))['then'](function(_0x161063){if(_0x161063){var _0x4627c8=_0x161063['get']({'plain':!![]});_0x4627c8=qs['omit'](_0x4627c8,['id',_0x504b('0x51'),_0x504b('0x52')]);_0x3f657c['body']=_[_0x504b('0x53')](_0x3f657c[_0x504b('0x4a')],['id',_0x504b('0x51'),_0x504b('0x52')]);return db[_0x504b('0x2f')][_0x504b('0x49')](_[_0x504b('0x3d')](_0x4627c8,_0x3f657c[_0x504b('0x4a')]),{'include':_0x3f657c[_0x504b('0x33')][_0x504b('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x2b0cb5){var _0x4474fe=_0x3f657c[_0x504b('0x4b')][_0x504b('0x26')]({'plain':!![]});if(!_0x4474fe)throw new Error(_0x504b('0x54'));if(_0x4474fe[_0x504b('0x55')]==='user'){var _0x1fd4ab=_0x2b0cb5[_0x504b('0x26')]({'plain':!![]});var _0x182b56=_0x504b('0x27');return db[_0x504b('0x4c')][_0x504b('0x48')]({'where':{'name':_0x182b56,'userProfileId':_0x4474fe[_0x504b('0x56')]},'raw':!![]})['then'](function(_0x3769fb){if(_0x3769fb&&_0x3769fb[_0x504b('0x4d')]===0x0){return db['UserProfileResource'][_0x504b('0x49')]({'name':_0x1fd4ab[_0x504b('0x32')],'resourceId':_0x1fd4ab['id'],'type':_0x3769fb[_0x504b('0x32')],'sectionId':_0x3769fb['id']},{})[_0x504b('0x24')](function(){return _0x2b0cb5;});}else{return _0x2b0cb5;}})[_0x504b('0x43')](function(_0x22392a){logger[_0x504b('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22392a);throw _0x22392a;});}return _0x2b0cb5;});}})['then'](respondWithResult(_0x4bf610,0xc9))['catch'](handleError(_0x4bf610,null));};exports[_0x504b('0x57')]=function(_0x3a5b60,_0x42c3b0){if(_0x3a5b60[_0x504b('0x4a')]['id']){delete _0x3a5b60['body']['id'];}return db[_0x504b('0x2f')]['find']({'where':{'id':_0x3a5b60['params']['id']}})[_0x504b('0x24')](handleEntityNotFound(_0x42c3b0,null))['then'](saveUpdates(_0x3a5b60['body'],null))['then'](respondWithResult(_0x42c3b0,null))[_0x504b('0x43')](handleError(_0x42c3b0,null));};exports[_0x504b('0x25')]=function(_0x1b2ea5,_0x236ad4){return db[_0x504b('0x2f')][_0x504b('0x48')]({'where':{'id':_0x1b2ea5[_0x504b('0x45')]['id']}})[_0x504b('0x24')](handleEntityNotFound(_0x236ad4,null))[_0x504b('0x24')](removeEntity(_0x236ad4,null))['catch'](handleError(_0x236ad4,null));};exports[_0x504b('0x58')]=function(_0x23fcf8,_0x3e01c9,_0x197ab9){var _0x3d3b93={'raw':!![],'where':{}};var _0x5023a0={};var _0x59bf95={'count':0x0,'rows':[]};return db[_0x504b('0x2f')][_0x504b('0x59')]({'where':{'id':_0x23fcf8['params']['id']}})[_0x504b('0x24')](handleEntityNotFound(_0x3e01c9,null))[_0x504b('0x24')](function(_0x162756){if(_0x162756){_0x5023a0['model']=_[_0x504b('0x46')](db[_0x504b('0x5a')][_0x504b('0x5b')]);_0x5023a0[_0x504b('0x33')]=_[_0x504b('0x46')](_0x23fcf8[_0x504b('0x33')]);_0x5023a0[_0x504b('0x3a')]=_['intersection'](_0x5023a0[_0x504b('0x35')],_0x5023a0['query']);_0x3d3b93[_0x504b('0x36')]=_[_0x504b('0x34')](_0x5023a0[_0x504b('0x35')],qs[_0x504b('0x37')](_0x23fcf8['query'][_0x504b('0x37')]));_0x3d3b93[_0x504b('0x36')]=_0x3d3b93[_0x504b('0x36')][_0x504b('0x47')]?_0x3d3b93[_0x504b('0x36')]:_0x5023a0[_0x504b('0x35')];if(!_0x23fcf8[_0x504b('0x33')][_0x504b('0x38')](_0x504b('0x5c'))){_0x3d3b93['limit']=qs[_0x504b('0x1e')](_0x23fcf8[_0x504b('0x33')]['limit']);_0x3d3b93[_0x504b('0x1c')]=qs[_0x504b('0x1c')](_0x23fcf8[_0x504b('0x33')][_0x504b('0x1c')]);}_0x3d3b93['order']=qs[_0x504b('0x5d')](_0x23fcf8[_0x504b('0x33')][_0x504b('0x5d')]);_0x3d3b93[_0x504b('0x39')]=qs[_0x504b('0x3a')](_[_0x504b('0x3b')](_0x23fcf8['query'],_0x5023a0[_0x504b('0x3a')]));_0x3d3b93[_0x504b('0x39')][_0x504b('0x5e')]=_0x162756['id'];if(_0x23fcf8[_0x504b('0x33')][_0x504b('0x3c')]){_0x3d3b93[_0x504b('0x39')]=_[_0x504b('0x3d')](_0x3d3b93[_0x504b('0x39')],{'$or':_[_0x504b('0x2e')](_0x3d3b93[_0x504b('0x36')],function(_0x44a39f){var _0x1f0272={};_0x1f0272[_0x44a39f]={'$like':'%'+_0x23fcf8['query'][_0x504b('0x3c')]+'%'};return _0x1f0272;})});}_0x3d3b93=_[_0x504b('0x3d')]({},_0x3d3b93,_0x23fcf8[_0x504b('0x3f')]);return db['JscriptySessionReport'][_0x504b('0x1f')]({'where':_0x3d3b93['where']})[_0x504b('0x24')](function(_0x2c7c26){_0x59bf95[_0x504b('0x1f')]=_0x2c7c26;if(_0x23fcf8['query'][_0x504b('0x40')]){_0x3d3b93['include']=[{'all':!![]}];}return db[_0x504b('0x5a')]['findAll'](_0x3d3b93);})['then'](function(_0x4ba394){_0x59bf95[_0x504b('0x42')]=_0x4ba394;return _0x59bf95;});}})[_0x504b('0x24')](respondWithFilteredResult(_0x3e01c9,_0x3d3b93))[_0x504b('0x43')](handleError(_0x3e01c9,null));};exports[_0x504b('0x5f')]=function(_0x56a043,_0x560778,_0x4b28d0){var _0x438fa4={'raw':!![],'where':{}};var _0x4ec275={};var _0x400f7c={'count':0x0,'rows':[]};return db[_0x504b('0x2f')][_0x504b('0x59')]({'where':{'id':_0x56a043[_0x504b('0x45')]['id']}})[_0x504b('0x24')](handleEntityNotFound(_0x560778,null))['then'](function(_0x3c65b1){if(_0x3c65b1){_0x4ec275['model']=_[_0x504b('0x46')](db[_0x504b('0x60')][_0x504b('0x5b')]);_0x4ec275[_0x504b('0x33')]=_[_0x504b('0x46')](_0x56a043[_0x504b('0x33')]);_0x4ec275[_0x504b('0x3a')]=_[_0x504b('0x34')](_0x4ec275[_0x504b('0x35')],_0x4ec275['query']);_0x438fa4[_0x504b('0x36')]=_[_0x504b('0x34')](_0x4ec275[_0x504b('0x35')],qs[_0x504b('0x37')](_0x56a043[_0x504b('0x33')][_0x504b('0x37')]));_0x438fa4[_0x504b('0x36')]=_0x438fa4[_0x504b('0x36')][_0x504b('0x47')]?_0x438fa4[_0x504b('0x36')]:_0x4ec275['model'];if(!_0x56a043[_0x504b('0x33')][_0x504b('0x38')](_0x504b('0x5c'))){_0x438fa4[_0x504b('0x1e')]=qs[_0x504b('0x1e')](_0x56a043[_0x504b('0x33')][_0x504b('0x1e')]);_0x438fa4[_0x504b('0x1c')]=qs[_0x504b('0x1c')](_0x56a043[_0x504b('0x33')][_0x504b('0x1c')]);}_0x438fa4['order']=qs[_0x504b('0x5d')](_0x56a043[_0x504b('0x33')][_0x504b('0x5d')]);_0x438fa4[_0x504b('0x39')]=qs[_0x504b('0x3a')](_[_0x504b('0x3b')](_0x56a043[_0x504b('0x33')],_0x4ec275[_0x504b('0x3a')]));_0x438fa4[_0x504b('0x39')]['ProjectId']=_0x3c65b1['id'];if(_0x56a043[_0x504b('0x33')]['filter']){_0x438fa4[_0x504b('0x39')]=_[_0x504b('0x3d')](_0x438fa4[_0x504b('0x39')],{'$or':_[_0x504b('0x2e')](_0x438fa4[_0x504b('0x36')],function(_0x37ebe9){var _0x53940d={};_0x53940d[_0x37ebe9]={'$like':'%'+_0x56a043[_0x504b('0x33')][_0x504b('0x3c')]+'%'};return _0x53940d;})});}_0x438fa4=_[_0x504b('0x3d')]({},_0x438fa4,_0x56a043[_0x504b('0x3f')]);return db[_0x504b('0x60')][_0x504b('0x1f')]({'where':_0x438fa4[_0x504b('0x39')]})[_0x504b('0x24')](function(_0x1bb84b){_0x400f7c[_0x504b('0x1f')]=_0x1bb84b;if(_0x56a043[_0x504b('0x33')][_0x504b('0x40')]){_0x438fa4[_0x504b('0x50')]=[{'all':!![]}];}return db[_0x504b('0x60')][_0x504b('0x41')](_0x438fa4);})[_0x504b('0x24')](function(_0x41a0fa){_0x400f7c[_0x504b('0x42')]=_0x41a0fa;return _0x400f7c;});}})[_0x504b('0x24')](respondWithFilteredResult(_0x560778,_0x438fa4))[_0x504b('0x43')](handleError(_0x560778,null));};function char(_0x37f7c1){return _0x504b('0x61')===typeof _0x37f7c1?String['fromCharCode'][_0x504b('0x22')](null,arguments):_0x37f7c1;}function needsEncapsulation(_0x53939b){return!!_0x53939b&&(_0x53939b[_0x504b('0x62')]()['indexOf'](char(0xd))>=0x0||_0x53939b[_0x504b('0x62')]()[_0x504b('0x63')](char(0xa))>=0x0||_0x53939b[_0x504b('0x62')]()[_0x504b('0x63')](char(0x2c))>=0x0||_0x53939b[_0x504b('0x62')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x3750ef){var _0x1eec67=char(0x22),_0x3b85ad='\x5c'+char(0x22),_0x503777=_0x3750ef['toString']()[_0x504b('0x64')](new RegExp(_0x1eec67,'g'),_0x3b85ad);return _0x1eec67+_0x503777+_0x1eec67;}exports[_0x504b('0x65')]=function(_0x5a294e,_0x5a235f,_0x18caa3){var _0x31d257,_0x5d51ef;var _0x30a6a9={'where':{'ProjectId':_0x5a294e[_0x504b('0x45')]['id']}};if(_0x5a294e['query'][_0x504b('0x66')]){_0x30a6a9[_0x504b('0x39')]['starttime']=JSON['parse'](_0x5a294e[_0x504b('0x33')][_0x504b('0x66')]);}return db[_0x504b('0x5a')][_0x504b('0x41')](_0x30a6a9)['then'](handleEntityNotFound(_0x5a235f,null))['then'](function(_0x339c05){if(_0x339c05){_0x31d257=_0x339c05;return db['JscriptyQuestionReport'][_0x504b('0x41')]({'where':{'SessionId':{'$in':_['map'](_0x31d257,'id')},'ProjectId':_0x5a294e[_0x504b('0x45')]['id']},'order':_0x504b('0x67')});}})[_0x504b('0x24')](handleEntityNotFound(_0x5a235f,null))[_0x504b('0x24')](function(_0x4b8941){if(_0x4b8941){_0x5d51ef=_0x4b8941;var _0x136df3={};for(var _0x3c5d98=0x0,_0x4cd383=_0x5d51ef[_0x504b('0x47')];_0x3c5d98<_0x4cd383;_0x3c5d98++){if(!_0x136df3['hasOwnProperty'](_0x5d51ef[_0x3c5d98][_0x504b('0x68')])){_0x136df3[_0x5d51ef[_0x3c5d98][_0x504b('0x68')]]=needsEncapsulation(_0x5d51ef[_0x3c5d98]['question'])?encapsulate(_0x5d51ef[_0x3c5d98][_0x504b('0x69')]):_0x5d51ef[_0x3c5d98]['question'];}}var _0x3bb719=[],_0xc31353={};for(var _0x5b1fc7=0x0,_0x306427=_0x31d257[_0x504b('0x47')];_0x5b1fc7<_0x306427;_0x5b1fc7++){_0xc31353={'ProjectId':_0x5a294e[_0x504b('0x45')]['id'],'SessionId':_0x31d257[_0x5b1fc7]['id'],'StartTime':moment(_0x31d257[_0x5b1fc7]['starttime'])[_0x504b('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x2840fe=0x0,_0x380c02=_0x5d51ef['length'];_0x2840fe<_0x380c02;_0x2840fe++){if(_0x5d51ef[_0x2840fe]['SessionId']==_0x31d257[_0x5b1fc7]['id']&&_0x136df3[_0x504b('0x38')](_0x5d51ef[_0x2840fe][_0x504b('0x68')])){_0xc31353[_0x136df3[_0x5d51ef[_0x2840fe][_0x504b('0x68')]]]=_0x5d51ef[_0x2840fe]['answer'];}}for(var _0x16929d in _0x136df3){if(!_0xc31353[_0x504b('0x38')](_0x136df3[_0x16929d])){_0xc31353[_0x136df3[_0x16929d]]=null;}}_0x3bb719[_0x504b('0x6b')](_0xc31353);}return _0x3bb719;}})['then'](function(_0x1f260a){if(!_['isEmpty'](_0x1f260a)){var _0x2a547b=toCsv(_0x1f260a);var _0x2aa781=Date[_0x504b('0x6c')]();fs[_0x504b('0x6d')](util[_0x504b('0x6a')](_0x504b('0x6e'),_0x5a294e[_0x504b('0x45')]['id'],_0x2aa781),_0x2a547b);_0x5a235f[_0x504b('0x6f')](_0x504b('0x70'),'attachment;\x20filename='+util[_0x504b('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x5a294e[_0x504b('0x45')]['id'],_0x2aa781));_0x5a235f[_0x504b('0x6f')](_0x504b('0x71'),'text/csv');return _0x5a235f[_0x504b('0x72')](util[_0x504b('0x6a')](_0x504b('0x6e'),_0x5a294e[_0x504b('0x45')]['id'],_0x2aa781));}else{return _0x5a235f['sendStatus'](0xcc);}})[_0x504b('0x43')](handleError(_0x5a235f,null));}; \ No newline at end of file +var _0xdaa8=['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','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','Projects','UserProfileResource','destroy','error','stack','name','send','index','map','JscriptyProject','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','order','where','pick','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','createdAt','updatedAt','user','UserProfileSection','autoAssociation','getSessions','findOne','JscriptySessionReport','nolimit','sort','ProjectId','filter','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','hasOwnProperty','answer','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','eml-format','rimraf','zip-dir','fast-json-patch','sox','to-csv','ejs','squel'];(function(_0x14f7fe,_0x5132c4){var _0x3d8309=function(_0x22f5c7){while(--_0x22f5c7){_0x14f7fe['push'](_0x14f7fe['shift']());}};_0x3d8309(++_0x5132c4);}(_0xdaa8,0xe4));var _0x8daa=function(_0x384304,_0x301f0f){_0x384304=_0x384304-0x0;var _0x6230f6=_0xdaa8[_0x384304];return _0x6230f6;};'use strict';var emlformat=require(_0x8daa('0x0'));var rimraf=require(_0x8daa('0x1'));var zipdir=require(_0x8daa('0x2'));var jsonpatch=require(_0x8daa('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('path');var sox=require(_0x8daa('0x4'));var csv=require(_0x8daa('0x5'));var ejs=require(_0x8daa('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8daa('0x7'));var crypto=require('crypto');var jsforce=require(_0x8daa('0x8'));var deskjs=require(_0x8daa('0x9'));var toCsv=require(_0x8daa('0x5'));var querystring=require(_0x8daa('0xa'));var Papa=require(_0x8daa('0xb'));var Redis=require('ioredis');var authService=require(_0x8daa('0xc'));var qs=require(_0x8daa('0xd'));var as=require(_0x8daa('0xe'));var hardwareService=require(_0x8daa('0xf'));var logger=require(_0x8daa('0x10'))(_0x8daa('0x11'));var utils=require(_0x8daa('0x12'));var config=require(_0x8daa('0x13'));var licenseUtil=require(_0x8daa('0x14'));var db=require(_0x8daa('0x15'))['db'];function respondWithStatusCode(_0x151f24,_0x536f7e){_0x536f7e=_0x536f7e||0xcc;return function(_0x17b260){if(_0x17b260){return _0x151f24[_0x8daa('0x16')](_0x536f7e);}return _0x151f24[_0x8daa('0x17')](_0x536f7e)['end']();};}function respondWithResult(_0x33fbf4,_0x5130a4){_0x5130a4=_0x5130a4||0xc8;return function(_0x28900d){if(_0x28900d){return _0x33fbf4[_0x8daa('0x17')](_0x5130a4)[_0x8daa('0x18')](_0x28900d);}};}function respondWithFilteredResult(_0x531f62,_0x3e90ad){return function(_0x3f1f8f){if(_0x3f1f8f){var _0x55bf66=typeof _0x3e90ad['offset']===_0x8daa('0x19')&&typeof _0x3e90ad[_0x8daa('0x1a')]===_0x8daa('0x19');var _0x2fd793=_0x3f1f8f[_0x8daa('0x1b')];var _0x1bca53=_0x55bf66?0x0:_0x3e90ad[_0x8daa('0x1c')];var _0x15ab40=_0x55bf66?_0x3f1f8f[_0x8daa('0x1b')]:_0x3e90ad[_0x8daa('0x1c')]+_0x3e90ad['limit'];var _0x490d91;if(_0x15ab40>=_0x2fd793){_0x15ab40=_0x2fd793;_0x490d91=0xc8;}else{_0x490d91=0xce;}_0x531f62['status'](_0x490d91);return _0x531f62[_0x8daa('0x1d')](_0x8daa('0x1e'),_0x1bca53+'-'+_0x15ab40+'/'+_0x2fd793)[_0x8daa('0x18')](_0x3f1f8f);}return null;};}function patchUpdates(_0x57c76b){return function(_0x3d5675){try{jsonpatch['apply'](_0x3d5675,_0x57c76b,!![]);}catch(_0x33994a){return BPromise[_0x8daa('0x1f')](_0x33994a);}return _0x3d5675[_0x8daa('0x20')]();};}function saveUpdates(_0x55d563,_0x1ed29e){return function(_0x4db25d){if(_0x4db25d){return _0x4db25d[_0x8daa('0x21')](_0x55d563)['then'](function(_0x580214){return _0x580214;});}return null;};}function removeEntity(_0x202b2f,_0x15a4be){return function(_0x221d96){if(_0x221d96){return _0x221d96['destroy']()[_0x8daa('0x22')](function(){var _0xbd075f=_0x221d96['get']({'plain':!![]});var _0x35dbc1=_0x8daa('0x23');return db[_0x8daa('0x24')][_0x8daa('0x25')]({'where':{'type':_0x35dbc1,'resourceId':_0xbd075f['id']}})[_0x8daa('0x22')](function(){return _0x221d96;});})[_0x8daa('0x22')](function(){_0x202b2f[_0x8daa('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41862b,_0x5f1609){return function(_0x41e96a){if(!_0x41e96a){_0x41862b['sendStatus'](0x194);}return _0x41e96a;};}function handleError(_0xb78435,_0x54cfc1){_0x54cfc1=_0x54cfc1||0x1f4;return function(_0x446304){logger[_0x8daa('0x26')](_0x446304[_0x8daa('0x27')]);if(_0x446304[_0x8daa('0x28')]){delete _0x446304['name'];}_0xb78435[_0x8daa('0x17')](_0x54cfc1)[_0x8daa('0x29')](_0x446304);};}exports[_0x8daa('0x2a')]=function(_0xb469db,_0x5a995b){var _0x5da841={},_0x503e67={},_0x233f10={'count':0x0,'rows':[]};var _0x519289=_[_0x8daa('0x2b')](db[_0x8daa('0x2c')][_0x8daa('0x2d')],function(_0x4016da){return{'name':_0x4016da['fieldName'],'type':_0x4016da[_0x8daa('0x2e')]['key']};});_0x503e67['model']=_[_0x8daa('0x2b')](_0x519289,_0x8daa('0x28'));_0x503e67[_0x8daa('0x2f')]=_[_0x8daa('0x30')](_0xb469db[_0x8daa('0x2f')]);_0x503e67[_0x8daa('0x31')]=_[_0x8daa('0x32')](_0x503e67[_0x8daa('0x33')],_0x503e67['query']);_0x5da841[_0x8daa('0x34')]=_[_0x8daa('0x32')](_0x503e67['model'],qs[_0x8daa('0x35')](_0xb469db[_0x8daa('0x2f')][_0x8daa('0x35')]));_0x5da841[_0x8daa('0x34')]=_0x5da841[_0x8daa('0x34')]['length']?_0x5da841[_0x8daa('0x34')]:_0x503e67[_0x8daa('0x33')];if(!_0xb469db['query']['hasOwnProperty']('nolimit')){_0x5da841[_0x8daa('0x1a')]=qs[_0x8daa('0x1a')](_0xb469db[_0x8daa('0x2f')][_0x8daa('0x1a')]);_0x5da841[_0x8daa('0x1c')]=qs[_0x8daa('0x1c')](_0xb469db['query']['offset']);}_0x5da841[_0x8daa('0x36')]=qs['sort'](_0xb469db[_0x8daa('0x2f')]['sort']);_0x5da841[_0x8daa('0x37')]=qs[_0x8daa('0x31')](_[_0x8daa('0x38')](_0xb469db['query'],_0x503e67[_0x8daa('0x31')]),_0x519289);if(_0xb469db[_0x8daa('0x2f')]['filter']){_0x5da841[_0x8daa('0x37')]=_['merge'](_0x5da841['where'],{'$or':_[_0x8daa('0x2b')](_0x519289,function(_0x5cc76f){if(_0x5cc76f[_0x8daa('0x2e')]!==_0x8daa('0x39')){var _0x1f8db2={};_0x1f8db2[_0x5cc76f[_0x8daa('0x28')]]={'$like':'%'+_0xb469db['query']['filter']+'%'};return _0x1f8db2;}})});}_0x5da841=_['merge']({},_0x5da841,_0xb469db['options']);var _0x5ae4a5={'where':_0x5da841[_0x8daa('0x37')]};return db['JscriptyProject'][_0x8daa('0x1b')](_0x5ae4a5)[_0x8daa('0x22')](function(_0x124206){_0x233f10['count']=_0x124206;if(_0xb469db['query'][_0x8daa('0x3a')]){_0x5da841[_0x8daa('0x3b')]=[{'all':!![]}];}return db[_0x8daa('0x2c')][_0x8daa('0x3c')](_0x5da841);})[_0x8daa('0x22')](function(_0x4a9adc){_0x233f10[_0x8daa('0x3d')]=_0x4a9adc;return _0x233f10;})[_0x8daa('0x22')](respondWithFilteredResult(_0x5a995b,_0x5da841))['catch'](handleError(_0x5a995b,null));};exports[_0x8daa('0x3e')]=function(_0x23d94d,_0xf1ad1d){var _0x521f77={'raw':![],'where':{'id':_0x23d94d[_0x8daa('0x3f')]['id']}},_0x1f0db9={};_0x1f0db9['model']=_['keys'](db[_0x8daa('0x2c')]['rawAttributes']);_0x1f0db9['query']=_[_0x8daa('0x30')](_0x23d94d[_0x8daa('0x2f')]);_0x1f0db9[_0x8daa('0x31')]=_['intersection'](_0x1f0db9['model'],_0x1f0db9[_0x8daa('0x2f')]);_0x521f77[_0x8daa('0x34')]=_[_0x8daa('0x32')](_0x1f0db9[_0x8daa('0x33')],qs['fields'](_0x23d94d[_0x8daa('0x2f')][_0x8daa('0x35')]));_0x521f77[_0x8daa('0x34')]=_0x521f77['attributes'][_0x8daa('0x40')]?_0x521f77[_0x8daa('0x34')]:_0x1f0db9[_0x8daa('0x33')];if(_0x23d94d[_0x8daa('0x2f')][_0x8daa('0x3a')]){_0x521f77[_0x8daa('0x3b')]=[{'all':!![]}];}_0x521f77=_[_0x8daa('0x41')]({},_0x521f77,_0x23d94d['options']);return db['JscriptyProject'][_0x8daa('0x42')](_0x521f77)['then'](handleEntityNotFound(_0xf1ad1d,null))[_0x8daa('0x22')](respondWithResult(_0xf1ad1d,null))[_0x8daa('0x43')](handleError(_0xf1ad1d,null));};exports['create']=function(_0x16544b,_0x2669d5){return db[_0x8daa('0x2c')][_0x8daa('0x44')](_0x16544b[_0x8daa('0x45')],{})['then'](function(_0x29222e){var _0x33ddf8=_0x16544b['user']['get']({'plain':!![]});if(!_0x33ddf8)throw new Error(_0x8daa('0x46'));if(_0x33ddf8[_0x8daa('0x47')]==='user'){var _0xd16925=_0x29222e[_0x8daa('0x48')]({'plain':!![]});var _0x3d4ab4=_0x8daa('0x23');return db['UserProfileSection'][_0x8daa('0x42')]({'where':{'name':_0x3d4ab4,'userProfileId':_0x33ddf8[_0x8daa('0x49')]},'raw':!![]})['then'](function(_0x21eca8){if(_0x21eca8&&_0x21eca8['autoAssociation']===0x0){return db[_0x8daa('0x24')][_0x8daa('0x44')]({'name':_0xd16925['name'],'resourceId':_0xd16925['id'],'type':_0x21eca8['name'],'sectionId':_0x21eca8['id']},{})[_0x8daa('0x22')](function(){return _0x29222e;});}else{return _0x29222e;}})[_0x8daa('0x43')](function(_0x89b74e){logger[_0x8daa('0x26')](_0x8daa('0x4a'),_0x89b74e);throw _0x89b74e;});}return _0x29222e;})[_0x8daa('0x22')](respondWithResult(_0x2669d5,0xc9))[_0x8daa('0x43')](handleError(_0x2669d5,null));};exports[_0x8daa('0x4b')]=function(_0x26def8,_0x3cad83){var _0x4f5890={'where':{'id':_0x26def8[_0x8daa('0x3f')]['id']}},_0x135059={};_0x135059['model']=_['keys'](db[_0x8daa('0x2c')][_0x8daa('0x2d')]);_0x4f5890[_0x8daa('0x34')]=_[_0x8daa('0x32')](_0x135059['model'],qs[_0x8daa('0x35')](_0x26def8['query'][_0x8daa('0x35')]));_0x4f5890['attributes']=_0x4f5890[_0x8daa('0x34')]['length']?_0x4f5890[_0x8daa('0x34')]:_0x135059[_0x8daa('0x33')];if(_0x26def8[_0x8daa('0x2f')][_0x8daa('0x3a')]){_0x4f5890[_0x8daa('0x3b')]=[{'all':!![]}];}_0x4f5890=_[_0x8daa('0x41')]({},_0x4f5890,_0x26def8[_0x8daa('0x4c')]);return db[_0x8daa('0x2c')][_0x8daa('0x42')](_0x4f5890)[_0x8daa('0x22')](handleEntityNotFound(_0x3cad83,null))[_0x8daa('0x22')](function(_0x4c2b24){if(_0x4c2b24){var _0x18d871=_0x4c2b24[_0x8daa('0x48')]({'plain':!![]});_0x18d871=qs[_0x8daa('0x4d')](_0x18d871,['id',_0x8daa('0x4e'),_0x8daa('0x4f')]);_0x26def8[_0x8daa('0x45')]=_['omit'](_0x26def8[_0x8daa('0x45')],['id',_0x8daa('0x4e'),'updatedAt']);return db[_0x8daa('0x2c')][_0x8daa('0x44')](_[_0x8daa('0x41')](_0x18d871,_0x26def8[_0x8daa('0x45')]),{'include':_0x26def8['query'][_0x8daa('0x3a')]?[{'all':!![]}]:undefined})[_0x8daa('0x22')](function(_0x484a9a){var _0x1ee6db=_0x26def8[_0x8daa('0x50')][_0x8daa('0x48')]({'plain':!![]});if(!_0x1ee6db)throw new Error(_0x8daa('0x46'));if(_0x1ee6db[_0x8daa('0x47')]==='user'){var _0x77385a=_0x484a9a[_0x8daa('0x48')]({'plain':!![]});var _0x34212e='Projects';return db[_0x8daa('0x51')]['find']({'where':{'name':_0x34212e,'userProfileId':_0x1ee6db[_0x8daa('0x49')]},'raw':!![]})['then'](function(_0x3486c8){if(_0x3486c8&&_0x3486c8[_0x8daa('0x52')]===0x0){return db[_0x8daa('0x24')][_0x8daa('0x44')]({'name':_0x77385a[_0x8daa('0x28')],'resourceId':_0x77385a['id'],'type':_0x3486c8[_0x8daa('0x28')],'sectionId':_0x3486c8['id']},{})['then'](function(){return _0x484a9a;});}else{return _0x484a9a;}})[_0x8daa('0x43')](function(_0x27449c){logger[_0x8daa('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x27449c);throw _0x27449c;});}return _0x484a9a;});}})[_0x8daa('0x22')](respondWithResult(_0x3cad83,0xc9))[_0x8daa('0x43')](handleError(_0x3cad83,null));};exports[_0x8daa('0x21')]=function(_0x45249b,_0x28a932){if(_0x45249b['body']['id']){delete _0x45249b[_0x8daa('0x45')]['id'];}return db[_0x8daa('0x2c')][_0x8daa('0x42')]({'where':{'id':_0x45249b[_0x8daa('0x3f')]['id']}})[_0x8daa('0x22')](handleEntityNotFound(_0x28a932,null))[_0x8daa('0x22')](saveUpdates(_0x45249b['body'],null))[_0x8daa('0x22')](respondWithResult(_0x28a932,null))['catch'](handleError(_0x28a932,null));};exports[_0x8daa('0x25')]=function(_0x4ea39f,_0x3f4fe2){return db[_0x8daa('0x2c')][_0x8daa('0x42')]({'where':{'id':_0x4ea39f['params']['id']}})['then'](handleEntityNotFound(_0x3f4fe2,null))[_0x8daa('0x22')](removeEntity(_0x3f4fe2,null))['catch'](handleError(_0x3f4fe2,null));};exports[_0x8daa('0x53')]=function(_0x3ff558,_0xd35665,_0x38debc){var _0x460cbe={'raw':!![],'where':{}};var _0x1cee13={};var _0x39e0db={'count':0x0,'rows':[]};return db[_0x8daa('0x2c')][_0x8daa('0x54')]({'where':{'id':_0x3ff558['params']['id']}})['then'](handleEntityNotFound(_0xd35665,null))[_0x8daa('0x22')](function(_0x57cbe8){if(_0x57cbe8){_0x1cee13['model']=_['keys'](db[_0x8daa('0x55')][_0x8daa('0x2d')]);_0x1cee13[_0x8daa('0x2f')]=_['keys'](_0x3ff558['query']);_0x1cee13[_0x8daa('0x31')]=_['intersection'](_0x1cee13['model'],_0x1cee13[_0x8daa('0x2f')]);_0x460cbe['attributes']=_[_0x8daa('0x32')](_0x1cee13[_0x8daa('0x33')],qs[_0x8daa('0x35')](_0x3ff558[_0x8daa('0x2f')][_0x8daa('0x35')]));_0x460cbe[_0x8daa('0x34')]=_0x460cbe[_0x8daa('0x34')][_0x8daa('0x40')]?_0x460cbe[_0x8daa('0x34')]:_0x1cee13[_0x8daa('0x33')];if(!_0x3ff558[_0x8daa('0x2f')]['hasOwnProperty'](_0x8daa('0x56'))){_0x460cbe[_0x8daa('0x1a')]=qs[_0x8daa('0x1a')](_0x3ff558[_0x8daa('0x2f')]['limit']);_0x460cbe['offset']=qs[_0x8daa('0x1c')](_0x3ff558[_0x8daa('0x2f')][_0x8daa('0x1c')]);}_0x460cbe[_0x8daa('0x36')]=qs[_0x8daa('0x57')](_0x3ff558['query'][_0x8daa('0x57')]);_0x460cbe[_0x8daa('0x37')]=qs[_0x8daa('0x31')](_[_0x8daa('0x38')](_0x3ff558[_0x8daa('0x2f')],_0x1cee13[_0x8daa('0x31')]));_0x460cbe[_0x8daa('0x37')][_0x8daa('0x58')]=_0x57cbe8['id'];if(_0x3ff558[_0x8daa('0x2f')][_0x8daa('0x59')]){_0x460cbe[_0x8daa('0x37')]=_['merge'](_0x460cbe[_0x8daa('0x37')],{'$or':_[_0x8daa('0x2b')](_0x460cbe['attributes'],function(_0x997551){var _0x1f404b={};_0x1f404b[_0x997551]={'$like':'%'+_0x3ff558[_0x8daa('0x2f')][_0x8daa('0x59')]+'%'};return _0x1f404b;})});}_0x460cbe=_[_0x8daa('0x41')]({},_0x460cbe,_0x3ff558[_0x8daa('0x4c')]);return db[_0x8daa('0x55')][_0x8daa('0x1b')]({'where':_0x460cbe[_0x8daa('0x37')]})['then'](function(_0x5a07b6){_0x39e0db['count']=_0x5a07b6;if(_0x3ff558[_0x8daa('0x2f')][_0x8daa('0x3a')]){_0x460cbe['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x8daa('0x3c')](_0x460cbe);})['then'](function(_0x5aa2d6){_0x39e0db[_0x8daa('0x3d')]=_0x5aa2d6;return _0x39e0db;});}})[_0x8daa('0x22')](respondWithFilteredResult(_0xd35665,_0x460cbe))['catch'](handleError(_0xd35665,null));};exports[_0x8daa('0x5a')]=function(_0x47a522,_0x4b7d86,_0x40bc59){var _0x2f7558={'raw':!![],'where':{}};var _0x35ec37={};var _0x9efc14={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x8daa('0x54')]({'where':{'id':_0x47a522[_0x8daa('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4b7d86,null))[_0x8daa('0x22')](function(_0x55b090){if(_0x55b090){_0x35ec37[_0x8daa('0x33')]=_[_0x8daa('0x30')](db[_0x8daa('0x5b')][_0x8daa('0x2d')]);_0x35ec37[_0x8daa('0x2f')]=_[_0x8daa('0x30')](_0x47a522[_0x8daa('0x2f')]);_0x35ec37[_0x8daa('0x31')]=_[_0x8daa('0x32')](_0x35ec37['model'],_0x35ec37[_0x8daa('0x2f')]);_0x2f7558[_0x8daa('0x34')]=_['intersection'](_0x35ec37[_0x8daa('0x33')],qs[_0x8daa('0x35')](_0x47a522['query']['fields']));_0x2f7558[_0x8daa('0x34')]=_0x2f7558['attributes'][_0x8daa('0x40')]?_0x2f7558[_0x8daa('0x34')]:_0x35ec37[_0x8daa('0x33')];if(!_0x47a522[_0x8daa('0x2f')]['hasOwnProperty'](_0x8daa('0x56'))){_0x2f7558[_0x8daa('0x1a')]=qs['limit'](_0x47a522['query']['limit']);_0x2f7558['offset']=qs[_0x8daa('0x1c')](_0x47a522[_0x8daa('0x2f')][_0x8daa('0x1c')]);}_0x2f7558[_0x8daa('0x36')]=qs['sort'](_0x47a522['query'][_0x8daa('0x57')]);_0x2f7558[_0x8daa('0x37')]=qs['filters'](_['pick'](_0x47a522[_0x8daa('0x2f')],_0x35ec37[_0x8daa('0x31')]));_0x2f7558[_0x8daa('0x37')][_0x8daa('0x58')]=_0x55b090['id'];if(_0x47a522[_0x8daa('0x2f')][_0x8daa('0x59')]){_0x2f7558[_0x8daa('0x37')]=_[_0x8daa('0x41')](_0x2f7558[_0x8daa('0x37')],{'$or':_[_0x8daa('0x2b')](_0x2f7558[_0x8daa('0x34')],function(_0x2e2c4c){var _0x296b2e={};_0x296b2e[_0x2e2c4c]={'$like':'%'+_0x47a522[_0x8daa('0x2f')][_0x8daa('0x59')]+'%'};return _0x296b2e;})});}_0x2f7558=_[_0x8daa('0x41')]({},_0x2f7558,_0x47a522[_0x8daa('0x4c')]);return db[_0x8daa('0x5b')][_0x8daa('0x1b')]({'where':_0x2f7558[_0x8daa('0x37')]})[_0x8daa('0x22')](function(_0x425927){_0x9efc14[_0x8daa('0x1b')]=_0x425927;if(_0x47a522[_0x8daa('0x2f')][_0x8daa('0x3a')]){_0x2f7558[_0x8daa('0x3b')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x8daa('0x3c')](_0x2f7558);})[_0x8daa('0x22')](function(_0xa94cd){_0x9efc14[_0x8daa('0x3d')]=_0xa94cd;return _0x9efc14;});}})['then'](respondWithFilteredResult(_0x4b7d86,_0x2f7558))[_0x8daa('0x43')](handleError(_0x4b7d86,null));};function char(_0x159ab6){return'number'===typeof _0x159ab6?String[_0x8daa('0x5c')]['apply'](null,arguments):_0x159ab6;}function needsEncapsulation(_0x2668b6){return!!_0x2668b6&&(_0x2668b6[_0x8daa('0x5d')]()[_0x8daa('0x5e')](char(0xd))>=0x0||_0x2668b6[_0x8daa('0x5d')]()[_0x8daa('0x5e')](char(0xa))>=0x0||_0x2668b6[_0x8daa('0x5d')]()[_0x8daa('0x5e')](char(0x2c))>=0x0||_0x2668b6['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x39a1bd){var _0x5a2fc1=char(0x22),_0x4a0f59='\x5c'+char(0x22),_0x597dab=_0x39a1bd['toString']()[_0x8daa('0x5f')](new RegExp(_0x5a2fc1,'g'),_0x4a0f59);return _0x5a2fc1+_0x597dab+_0x5a2fc1;}exports[_0x8daa('0x60')]=function(_0xf2f96d,_0x14bfc2,_0x4db12e){var _0x555935,_0x54c9f2;var _0x4fbeee={'where':{'ProjectId':_0xf2f96d['params']['id']}};if(_0xf2f96d['query'][_0x8daa('0x61')]){_0x4fbeee[_0x8daa('0x37')][_0x8daa('0x62')]=JSON[_0x8daa('0x63')](_0xf2f96d[_0x8daa('0x2f')][_0x8daa('0x61')]);}return db['JscriptySessionReport'][_0x8daa('0x3c')](_0x4fbeee)[_0x8daa('0x22')](handleEntityNotFound(_0x14bfc2,null))[_0x8daa('0x22')](function(_0x2fce4a){if(_0x2fce4a){_0x555935=_0x2fce4a;return db[_0x8daa('0x64')][_0x8daa('0x3c')]({'where':{'SessionId':{'$in':_[_0x8daa('0x2b')](_0x555935,'id')},'ProjectId':_0xf2f96d[_0x8daa('0x3f')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x14bfc2,null))[_0x8daa('0x22')](function(_0x38ef51){if(_0x38ef51){_0x54c9f2=_0x38ef51;var _0x437e1c={};for(var _0x31cd21=0x0,_0x47e7ff=_0x54c9f2[_0x8daa('0x40')];_0x31cd21<_0x47e7ff;_0x31cd21++){if(!_0x437e1c['hasOwnProperty'](_0x54c9f2[_0x31cd21][_0x8daa('0x65')])){_0x437e1c[_0x54c9f2[_0x31cd21][_0x8daa('0x65')]]=needsEncapsulation(_0x54c9f2[_0x31cd21][_0x8daa('0x66')])?encapsulate(_0x54c9f2[_0x31cd21][_0x8daa('0x66')]):_0x54c9f2[_0x31cd21]['question'];}}var _0x44864d=[],_0x220ed5={};for(var _0x2b67a9=0x0,_0xff4179=_0x555935['length'];_0x2b67a9<_0xff4179;_0x2b67a9++){_0x220ed5={'ProjectId':_0xf2f96d[_0x8daa('0x3f')]['id'],'SessionId':_0x555935[_0x2b67a9]['id'],'StartTime':moment(_0x555935[_0x2b67a9][_0x8daa('0x62')])['format'](_0x8daa('0x67'))};for(var _0x530bf7=0x0,_0x495e04=_0x54c9f2[_0x8daa('0x40')];_0x530bf7<_0x495e04;_0x530bf7++){if(_0x54c9f2[_0x530bf7][_0x8daa('0x68')]==_0x555935[_0x2b67a9]['id']&&_0x437e1c[_0x8daa('0x69')](_0x54c9f2[_0x530bf7]['questionId'])){_0x220ed5[_0x437e1c[_0x54c9f2[_0x530bf7][_0x8daa('0x65')]]]=_0x54c9f2[_0x530bf7][_0x8daa('0x6a')];}}for(var _0x5b23f3 in _0x437e1c){if(!_0x220ed5[_0x8daa('0x69')](_0x437e1c[_0x5b23f3])){_0x220ed5[_0x437e1c[_0x5b23f3]]=null;}}_0x44864d[_0x8daa('0x6b')](_0x220ed5);}return _0x44864d;}})[_0x8daa('0x22')](function(_0x361b3b){if(!_[_0x8daa('0x6c')](_0x361b3b)){var _0x443ca3=toCsv(_0x361b3b);var _0x2f452f=Date[_0x8daa('0x6d')]();fs[_0x8daa('0x6e')](util[_0x8daa('0x6f')](_0x8daa('0x70'),_0xf2f96d[_0x8daa('0x3f')]['id'],_0x2f452f),_0x443ca3);_0x14bfc2[_0x8daa('0x71')]('Content-disposition',_0x8daa('0x72')+util[_0x8daa('0x6f')](_0x8daa('0x73'),_0xf2f96d[_0x8daa('0x3f')]['id'],_0x2f452f));_0x14bfc2[_0x8daa('0x71')](_0x8daa('0x74'),_0x8daa('0x75'));return _0x14bfc2['download'](util[_0x8daa('0x6f')](_0x8daa('0x70'),_0xf2f96d[_0x8daa('0x3f')]['id'],_0x2f452f));}else{return _0x14bfc2['sendStatus'](0xcc);}})[_0x8daa('0x43')](handleError(_0x14bfc2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index a008812..9795278 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 _0xf006=['bluebird','path','./jscriptyProject.attributes','exports','define','jscripty_projects','../../config/logger','api'];(function(_0x6ffab0,_0x199b4b){var _0x449333=function(_0x42b7d9){while(--_0x42b7d9){_0x6ffab0['push'](_0x6ffab0['shift']());}};_0x449333(++_0x199b4b);}(_0xf006,0x146));var _0x6f00=function(_0x2db1c1,_0x48db15){_0x2db1c1=_0x2db1c1-0x0;var _0x5e740c=_0xf006[_0x2db1c1];return _0x5e740c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f00('0x0'))(_0x6f00('0x1'));var moment=require('moment');var BPromise=require(_0x6f00('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f00('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6f00('0x4'));module[_0x6f00('0x5')]=function(_0x141e71,_0x52c9a2){return _0x141e71[_0x6f00('0x6')]('JscriptyProject',attributes,{'tableName':_0x6f00('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23ea=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define','JscriptyProject','jscripty_projects','lodash'];(function(_0x5e4a9c,_0x2c0d9b){var _0x7f3c28=function(_0x101593){while(--_0x101593){_0x5e4a9c['push'](_0x5e4a9c['shift']());}};_0x7f3c28(++_0x2c0d9b);}(_0x23ea,0xc3));var _0xa23e=function(_0x19a21c,_0x4e03f8){_0x19a21c=_0x19a21c-0x0;var _0x3e9b9f=_0x23ea[_0x19a21c];return _0x3e9b9f;};'use strict';var _=require(_0xa23e('0x0'));var util=require(_0xa23e('0x1'));var logger=require(_0xa23e('0x2'))(_0xa23e('0x3'));var moment=require(_0xa23e('0x4'));var BPromise=require(_0xa23e('0x5'));var rp=require(_0xa23e('0x6'));var fs=require('fs');var path=require(_0xa23e('0x7'));var rimraf=require(_0xa23e('0x8'));var config=require(_0xa23e('0x9'));var attributes=require(_0xa23e('0xa'));module['exports']=function(_0x3baf3d,_0x423454){return _0x3baf3d[_0xa23e('0xb')](_0xa23e('0xc'),attributes,{'tableName':_0xa23e('0xd'),'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 bd6cefb..0ac41d7 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0xda3f,0xec));var _0xfda3=function(_0x3944dc,_0x37f2b0){_0x3944dc=_0x3944dc-0x0;var _0xb073e2=_0xda3f[_0x3944dc];return _0xb073e2;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','JscriptyProject,\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','JscriptyProject,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1bafb1,_0x3f4d43){_0x1bafb1=_0x1bafb1-0x0;var _0x1e9aa9=_0xbdb7[_0x1bafb1];return _0x1e9aa9;};'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 diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 84bae8f..f8b2358 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 _0x6d72=['delete','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','create','put'];(function(_0x5c29e0,_0xf52f6e){var _0x90cd14=function(_0x187413){while(--_0x187413){_0x5c29e0['push'](_0x5c29e0['shift']());}};_0x90cd14(++_0xf52f6e);}(_0x6d72,0x1b1));var _0x26d7=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x6d72[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x26d7('0x0'));var path=require('path');var timeout=require(_0x26d7('0x1'));var express=require(_0x26d7('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x26d7('0x3'));var config=require(_0x26d7('0x4'));var controller=require(_0x26d7('0x5'));router[_0x26d7('0x6')]('/',auth['isAuthenticated'](),controller[_0x26d7('0x7')]);router[_0x26d7('0x6')](_0x26d7('0x8'),auth[_0x26d7('0x9')](),controller[_0x26d7('0xa')]);router['get'](_0x26d7('0xb'),auth[_0x26d7('0x9')](),controller[_0x26d7('0xc')]);router['post']('/',auth[_0x26d7('0x9')](),controller[_0x26d7('0xd')]);router[_0x26d7('0xe')](_0x26d7('0xb'),auth[_0x26d7('0x9')](),controller['update']);router[_0x26d7('0xf')](_0x26d7('0xb'),auth[_0x26d7('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x90dc=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x90dc,0x100));var _0xc90d=function(_0x48120e,_0xa92edb){_0x48120e=_0x48120e-0x0;var _0x4df519=_0x90dc[_0x48120e];return _0x4df519;};'use strict';var multer=require('multer');var util=require(_0xc90d('0x0'));var path=require(_0xc90d('0x1'));var timeout=require(_0xc90d('0x2'));var express=require(_0xc90d('0x3'));var router=express[_0xc90d('0x4')]();var fs_extra=require(_0xc90d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc90d('0x6'));var config=require(_0xc90d('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0xc90d('0x8')]('/',auth[_0xc90d('0x9')](),controller[_0xc90d('0xa')]);router['get']('/describe',auth[_0xc90d('0x9')](),controller[_0xc90d('0xb')]);router[_0xc90d('0x8')]('/:id',auth[_0xc90d('0x9')](),controller[_0xc90d('0xc')]);router[_0xc90d('0xd')]('/',auth[_0xc90d('0x9')](),controller[_0xc90d('0xe')]);router[_0xc90d('0xf')](_0xc90d('0x10'),auth['isAuthenticated'](),controller[_0xc90d('0x11')]);router[_0xc90d('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xc90d('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 23ab894..cea2877 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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7a54,0x106));var _0x47a5=function(_0x282ab6,_0x5aff9e){_0x282ab6=_0x282ab6-0x0;var _0x3437c8=_0x7a54[_0x282ab6];return _0x3437c8;};'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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x22e529,_0x1967de){_0x22e529=_0x22e529-0x0;var _0x496612=_0x7a54[_0x22e529];return _0x496612;};'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 2d16468..c167858 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 _0xe5c6=['stack','name','send','index','map','rawAttributes','fieldName','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','include','findAll','rows','catch','keys','JscriptyQuestionReport','includeAll','find','create','body','params','eml-format','rimraf','moment','mustache','util','sox','to-csv','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','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xe5c6,0xa8));var _0x6e5c=function(_0x21c03e,_0x35d118){_0x21c03e=_0x21c03e-0x0;var _0x2fa59e=_0xe5c6[_0x21c03e];return _0x2fa59e;};'use strict';var emlformat=require(_0x6e5c('0x0'));var rimraf=require(_0x6e5c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6e5c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6e5c('0x3'));var util=require(_0x6e5c('0x4'));var path=require('path');var sox=require(_0x6e5c('0x5'));var csv=require(_0x6e5c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e5c('0x7'));var squel=require(_0x6e5c('0x8'));var crypto=require(_0x6e5c('0x9'));var jsforce=require(_0x6e5c('0xa'));var deskjs=require(_0x6e5c('0xb'));var toCsv=require(_0x6e5c('0x6'));var querystring=require(_0x6e5c('0xc'));var Papa=require('papaparse');var Redis=require(_0x6e5c('0xd'));var authService=require(_0x6e5c('0xe'));var qs=require(_0x6e5c('0xf'));var as=require(_0x6e5c('0x10'));var hardwareService=require(_0x6e5c('0x11'));var logger=require('../../config/logger')(_0x6e5c('0x12'));var utils=require(_0x6e5c('0x13'));var config=require(_0x6e5c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6e5c('0x15'))['db'];function respondWithStatusCode(_0x179f31,_0x49922c){_0x49922c=_0x49922c||0xcc;return function(_0x513b69){if(_0x513b69){return _0x179f31[_0x6e5c('0x16')](_0x49922c);}return _0x179f31['status'](_0x49922c)[_0x6e5c('0x17')]();};}function respondWithResult(_0x336b2a,_0x1a95f4){_0x1a95f4=_0x1a95f4||0xc8;return function(_0xdad283){if(_0xdad283){return _0x336b2a[_0x6e5c('0x18')](_0x1a95f4)[_0x6e5c('0x19')](_0xdad283);}};}function respondWithFilteredResult(_0x59fcf3,_0xb685a0){return function(_0x49ac58){if(_0x49ac58){var _0x309eab=typeof _0xb685a0[_0x6e5c('0x1a')]===_0x6e5c('0x1b')&&typeof _0xb685a0[_0x6e5c('0x1c')]===_0x6e5c('0x1b');var _0xd65f61=_0x49ac58[_0x6e5c('0x1d')];var _0x2ddab1=_0x309eab?0x0:_0xb685a0[_0x6e5c('0x1a')];var _0x4b9434=_0x309eab?_0x49ac58[_0x6e5c('0x1d')]:_0xb685a0[_0x6e5c('0x1a')]+_0xb685a0[_0x6e5c('0x1c')];var _0x357e8a;if(_0x4b9434>=_0xd65f61){_0x4b9434=_0xd65f61;_0x357e8a=0xc8;}else{_0x357e8a=0xce;}_0x59fcf3[_0x6e5c('0x18')](_0x357e8a);return _0x59fcf3[_0x6e5c('0x1e')](_0x6e5c('0x1f'),_0x2ddab1+'-'+_0x4b9434+'/'+_0xd65f61)['json'](_0x49ac58);}return null;};}function patchUpdates(_0x553099){return function(_0x484b0e){try{jsonpatch[_0x6e5c('0x20')](_0x484b0e,_0x553099,!![]);}catch(_0x4e3053){return BPromise['reject'](_0x4e3053);}return _0x484b0e['save']();};}function saveUpdates(_0x17196e,_0x35f058){return function(_0x2c41fc){if(_0x2c41fc){return _0x2c41fc[_0x6e5c('0x21')](_0x17196e)['then'](function(_0x39e877){return _0x39e877;});}return null;};}function removeEntity(_0x23cbdd,_0x5b57c4){return function(_0x2d2d4c){if(_0x2d2d4c){return _0x2d2d4c[_0x6e5c('0x22')]()[_0x6e5c('0x23')](function(){_0x23cbdd[_0x6e5c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10219f,_0x49fa94){return function(_0x1eec8b){if(!_0x1eec8b){_0x10219f['sendStatus'](0x194);}return _0x1eec8b;};}function handleError(_0x54b878,_0xd091b0){_0xd091b0=_0xd091b0||0x1f4;return function(_0x4a9c31){logger['error'](_0x4a9c31[_0x6e5c('0x24')]);if(_0x4a9c31[_0x6e5c('0x25')]){delete _0x4a9c31[_0x6e5c('0x25')];}_0x54b878[_0x6e5c('0x18')](_0xd091b0)[_0x6e5c('0x26')](_0x4a9c31);};}exports[_0x6e5c('0x27')]=function(_0x154130,_0x4c2f3f){var _0x18b49e={},_0x539470={},_0x1173de={'count':0x0,'rows':[]};var _0x56b452=_[_0x6e5c('0x28')](db['JscriptyQuestionReport'][_0x6e5c('0x29')],function(_0x4f9a7a){return{'name':_0x4f9a7a[_0x6e5c('0x2a')],'type':_0x4f9a7a['type']['key']};});_0x539470['model']=_[_0x6e5c('0x28')](_0x56b452,_0x6e5c('0x25'));_0x539470['query']=_['keys'](_0x154130[_0x6e5c('0x2b')]);_0x539470[_0x6e5c('0x2c')]=_['intersection'](_0x539470[_0x6e5c('0x2d')],_0x539470['query']);_0x18b49e[_0x6e5c('0x2e')]=_[_0x6e5c('0x2f')](_0x539470['model'],qs['fields'](_0x154130[_0x6e5c('0x2b')][_0x6e5c('0x30')]));_0x18b49e['attributes']=_0x18b49e[_0x6e5c('0x2e')][_0x6e5c('0x31')]?_0x18b49e[_0x6e5c('0x2e')]:_0x539470[_0x6e5c('0x2d')];if(!_0x154130['query'][_0x6e5c('0x32')](_0x6e5c('0x33'))){_0x18b49e[_0x6e5c('0x1c')]=qs['limit'](_0x154130[_0x6e5c('0x2b')]['limit']);_0x18b49e[_0x6e5c('0x1a')]=qs['offset'](_0x154130[_0x6e5c('0x2b')][_0x6e5c('0x1a')]);}_0x18b49e[_0x6e5c('0x34')]=qs[_0x6e5c('0x35')](_0x154130['query'][_0x6e5c('0x35')]);_0x18b49e[_0x6e5c('0x36')]=qs[_0x6e5c('0x2c')](_['pick'](_0x154130[_0x6e5c('0x2b')],_0x539470[_0x6e5c('0x2c')]),_0x56b452);if(_0x154130[_0x6e5c('0x2b')]['filter']){_0x18b49e[_0x6e5c('0x36')]=_['merge'](_0x18b49e[_0x6e5c('0x36')],{'$or':_[_0x6e5c('0x28')](_0x56b452,function(_0xdfaaa3){if(_0xdfaaa3['type']!=='VIRTUAL'){var _0x3aab3f={};_0x3aab3f[_0xdfaaa3[_0x6e5c('0x25')]]={'$like':'%'+_0x154130['query']['filter']+'%'};return _0x3aab3f;}})});}_0x18b49e=_[_0x6e5c('0x37')]({},_0x18b49e,_0x154130[_0x6e5c('0x38')]);var _0x4a711f={'where':_0x18b49e[_0x6e5c('0x36')]};return db['JscriptyQuestionReport'][_0x6e5c('0x1d')](_0x4a711f)[_0x6e5c('0x23')](function(_0x1a5554){_0x1173de[_0x6e5c('0x1d')]=_0x1a5554;if(_0x154130[_0x6e5c('0x2b')]['includeAll']){_0x18b49e[_0x6e5c('0x39')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x6e5c('0x3a')](_0x18b49e);})['then'](function(_0x560f19){_0x1173de[_0x6e5c('0x3b')]=_0x560f19;return _0x1173de;})[_0x6e5c('0x23')](respondWithFilteredResult(_0x4c2f3f,_0x18b49e))[_0x6e5c('0x3c')](handleError(_0x4c2f3f,null));};exports['show']=function(_0x2bfffd,_0x560599){var _0x292e8b={'raw':!![],'where':{'id':_0x2bfffd['params']['id']}},_0x4422ad={};_0x4422ad['model']=_[_0x6e5c('0x3d')](db[_0x6e5c('0x3e')]['rawAttributes']);_0x4422ad[_0x6e5c('0x2b')]=_[_0x6e5c('0x3d')](_0x2bfffd['query']);_0x4422ad[_0x6e5c('0x2c')]=_['intersection'](_0x4422ad[_0x6e5c('0x2d')],_0x4422ad[_0x6e5c('0x2b')]);_0x292e8b[_0x6e5c('0x2e')]=_[_0x6e5c('0x2f')](_0x4422ad[_0x6e5c('0x2d')],qs['fields'](_0x2bfffd[_0x6e5c('0x2b')]['fields']));_0x292e8b[_0x6e5c('0x2e')]=_0x292e8b[_0x6e5c('0x2e')][_0x6e5c('0x31')]?_0x292e8b[_0x6e5c('0x2e')]:_0x4422ad[_0x6e5c('0x2d')];if(_0x2bfffd[_0x6e5c('0x2b')][_0x6e5c('0x3f')]){_0x292e8b['include']=[{'all':!![]}];}_0x292e8b=_[_0x6e5c('0x37')]({},_0x292e8b,_0x2bfffd['options']);return db[_0x6e5c('0x3e')][_0x6e5c('0x40')](_0x292e8b)['then'](handleEntityNotFound(_0x560599,null))[_0x6e5c('0x23')](respondWithResult(_0x560599,null))['catch'](handleError(_0x560599,null));};exports['create']=function(_0x52cb0f,_0x5cbd2c){return db[_0x6e5c('0x3e')][_0x6e5c('0x41')](_0x52cb0f[_0x6e5c('0x42')],{})[_0x6e5c('0x23')](respondWithResult(_0x5cbd2c,0xc9))['catch'](handleError(_0x5cbd2c,null));};exports[_0x6e5c('0x21')]=function(_0xb7ee76,_0x3892c3){if(_0xb7ee76['body']['id']){delete _0xb7ee76[_0x6e5c('0x42')]['id'];}return db['JscriptyQuestionReport'][_0x6e5c('0x40')]({'where':{'id':_0xb7ee76['params']['id']}})[_0x6e5c('0x23')](handleEntityNotFound(_0x3892c3,null))[_0x6e5c('0x23')](saveUpdates(_0xb7ee76[_0x6e5c('0x42')],null))['then'](respondWithResult(_0x3892c3,null))[_0x6e5c('0x3c')](handleError(_0x3892c3,null));};exports['destroy']=function(_0x5156a1,_0x274f48){return db[_0x6e5c('0x3e')][_0x6e5c('0x40')]({'where':{'id':_0x5156a1[_0x6e5c('0x43')]['id']}})[_0x6e5c('0x23')](handleEntityNotFound(_0x274f48,null))['then'](removeEntity(_0x274f48,null))['catch'](handleError(_0x274f48,null));};exports['describe']=function(_0x4367c1,_0x36e723){return db[_0x6e5c('0x3e')]['describe']()[_0x6e5c('0x23')](respondWithResult(_0x36e723,null))['catch'](handleError(_0x36e723,null));}; \ No newline at end of file +var _0x3e79=['ioredis','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','where','pick','filter','merge','rows','show','params','includeAll','include','options','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x3e79,0x1e6));var _0x93e7=function(_0x508c75,_0x2052b5){_0x508c75=_0x508c75-0x0;var _0x2571eb=_0x3e79[_0x508c75];return _0x2571eb;};'use strict';var emlformat=require(_0x93e7('0x0'));var rimraf=require(_0x93e7('0x1'));var zipdir=require(_0x93e7('0x2'));var jsonpatch=require(_0x93e7('0x3'));var rp=require(_0x93e7('0x4'));var moment=require(_0x93e7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x93e7('0x6'));var util=require('util');var path=require('path');var sox=require(_0x93e7('0x7'));var csv=require(_0x93e7('0x8'));var ejs=require(_0x93e7('0x9'));var fs=require('fs');var fs_extra=require(_0x93e7('0xa'));var _=require(_0x93e7('0xb'));var squel=require(_0x93e7('0xc'));var crypto=require(_0x93e7('0xd'));var jsforce=require(_0x93e7('0xe'));var deskjs=require(_0x93e7('0xf'));var toCsv=require(_0x93e7('0x8'));var querystring=require(_0x93e7('0x10'));var Papa=require(_0x93e7('0x11'));var Redis=require(_0x93e7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x93e7('0x13'));var utils=require(_0x93e7('0x14'));var config=require(_0x93e7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x93e7('0x16'))['db'];function respondWithStatusCode(_0x51f342,_0x4999fe){_0x4999fe=_0x4999fe||0xcc;return function(_0x1e5a1e){if(_0x1e5a1e){return _0x51f342[_0x93e7('0x17')](_0x4999fe);}return _0x51f342['status'](_0x4999fe)[_0x93e7('0x18')]();};}function respondWithResult(_0x1e0a3e,_0x88232d){_0x88232d=_0x88232d||0xc8;return function(_0x1bc3b6){if(_0x1bc3b6){return _0x1e0a3e[_0x93e7('0x19')](_0x88232d)[_0x93e7('0x1a')](_0x1bc3b6);}};}function respondWithFilteredResult(_0x2f58af,_0x31b1e8){return function(_0xfdb67e){if(_0xfdb67e){var _0x578f15=typeof _0x31b1e8[_0x93e7('0x1b')]===_0x93e7('0x1c')&&typeof _0x31b1e8[_0x93e7('0x1d')]===_0x93e7('0x1c');var _0x447c13=_0xfdb67e[_0x93e7('0x1e')];var _0xf6575d=_0x578f15?0x0:_0x31b1e8[_0x93e7('0x1b')];var _0x51474f=_0x578f15?_0xfdb67e[_0x93e7('0x1e')]:_0x31b1e8['offset']+_0x31b1e8[_0x93e7('0x1d')];var _0x48a7be;if(_0x51474f>=_0x447c13){_0x51474f=_0x447c13;_0x48a7be=0xc8;}else{_0x48a7be=0xce;}_0x2f58af[_0x93e7('0x19')](_0x48a7be);return _0x2f58af[_0x93e7('0x1f')]('Content-Range',_0xf6575d+'-'+_0x51474f+'/'+_0x447c13)[_0x93e7('0x1a')](_0xfdb67e);}return null;};}function patchUpdates(_0x3e8813){return function(_0x461128){try{jsonpatch[_0x93e7('0x20')](_0x461128,_0x3e8813,!![]);}catch(_0x8c601){return BPromise[_0x93e7('0x21')](_0x8c601);}return _0x461128[_0x93e7('0x22')]();};}function saveUpdates(_0x552ca1,_0x304ef0){return function(_0x10e8c5){if(_0x10e8c5){return _0x10e8c5[_0x93e7('0x23')](_0x552ca1)[_0x93e7('0x24')](function(_0x29ff9f){return _0x29ff9f;});}return null;};}function removeEntity(_0x545943,_0x2eb39c){return function(_0x40c800){if(_0x40c800){return _0x40c800[_0x93e7('0x25')]()['then'](function(){_0x545943[_0x93e7('0x19')](0xcc)[_0x93e7('0x18')]();});}};}function handleEntityNotFound(_0x5b2d5e,_0x4b091f){return function(_0x4bac58){if(!_0x4bac58){_0x5b2d5e[_0x93e7('0x17')](0x194);}return _0x4bac58;};}function handleError(_0x2ac2a9,_0x32d96b){_0x32d96b=_0x32d96b||0x1f4;return function(_0x23972a){logger[_0x93e7('0x26')](_0x23972a[_0x93e7('0x27')]);if(_0x23972a[_0x93e7('0x28')]){delete _0x23972a[_0x93e7('0x28')];}_0x2ac2a9[_0x93e7('0x19')](_0x32d96b)[_0x93e7('0x29')](_0x23972a);};}exports['index']=function(_0x3a134c,_0x4efc3a){var _0x38099f={},_0x572d15={},_0xfb535d={'count':0x0,'rows':[]};var _0x5ed036=_['map'](db[_0x93e7('0x2a')][_0x93e7('0x2b')],function(_0x4e4a6d){return{'name':_0x4e4a6d[_0x93e7('0x2c')],'type':_0x4e4a6d[_0x93e7('0x2d')][_0x93e7('0x2e')]};});_0x572d15[_0x93e7('0x2f')]=_[_0x93e7('0x30')](_0x5ed036,_0x93e7('0x28'));_0x572d15[_0x93e7('0x31')]=_[_0x93e7('0x32')](_0x3a134c[_0x93e7('0x31')]);_0x572d15[_0x93e7('0x33')]=_[_0x93e7('0x34')](_0x572d15[_0x93e7('0x2f')],_0x572d15[_0x93e7('0x31')]);_0x38099f[_0x93e7('0x35')]=_[_0x93e7('0x34')](_0x572d15[_0x93e7('0x2f')],qs[_0x93e7('0x36')](_0x3a134c[_0x93e7('0x31')][_0x93e7('0x36')]));_0x38099f['attributes']=_0x38099f[_0x93e7('0x35')][_0x93e7('0x37')]?_0x38099f[_0x93e7('0x35')]:_0x572d15[_0x93e7('0x2f')];if(!_0x3a134c[_0x93e7('0x31')]['hasOwnProperty'](_0x93e7('0x38'))){_0x38099f[_0x93e7('0x1d')]=qs[_0x93e7('0x1d')](_0x3a134c['query'][_0x93e7('0x1d')]);_0x38099f[_0x93e7('0x1b')]=qs[_0x93e7('0x1b')](_0x3a134c[_0x93e7('0x31')][_0x93e7('0x1b')]);}_0x38099f['order']=qs['sort'](_0x3a134c['query']['sort']);_0x38099f[_0x93e7('0x39')]=qs[_0x93e7('0x33')](_[_0x93e7('0x3a')](_0x3a134c[_0x93e7('0x31')],_0x572d15['filters']),_0x5ed036);if(_0x3a134c[_0x93e7('0x31')][_0x93e7('0x3b')]){_0x38099f[_0x93e7('0x39')]=_[_0x93e7('0x3c')](_0x38099f[_0x93e7('0x39')],{'$or':_[_0x93e7('0x30')](_0x5ed036,function(_0x5ea23f){if(_0x5ea23f[_0x93e7('0x2d')]!=='VIRTUAL'){var _0x238ef5={};_0x238ef5[_0x5ea23f[_0x93e7('0x28')]]={'$like':'%'+_0x3a134c['query']['filter']+'%'};return _0x238ef5;}})});}_0x38099f=_['merge']({},_0x38099f,_0x3a134c['options']);var _0x492843={'where':_0x38099f[_0x93e7('0x39')]};return db['JscriptyQuestionReport'][_0x93e7('0x1e')](_0x492843)[_0x93e7('0x24')](function(_0xb02506){_0xfb535d[_0x93e7('0x1e')]=_0xb02506;if(_0x3a134c[_0x93e7('0x31')]['includeAll']){_0x38099f['include']=[{'all':!![]}];}return db[_0x93e7('0x2a')]['findAll'](_0x38099f);})[_0x93e7('0x24')](function(_0x1b86af){_0xfb535d[_0x93e7('0x3d')]=_0x1b86af;return _0xfb535d;})[_0x93e7('0x24')](respondWithFilteredResult(_0x4efc3a,_0x38099f))['catch'](handleError(_0x4efc3a,null));};exports[_0x93e7('0x3e')]=function(_0x2ae436,_0x229c2c){var _0x3db3bf={'raw':!![],'where':{'id':_0x2ae436[_0x93e7('0x3f')]['id']}},_0x993b7b={};_0x993b7b['model']=_[_0x93e7('0x32')](db[_0x93e7('0x2a')][_0x93e7('0x2b')]);_0x993b7b[_0x93e7('0x31')]=_[_0x93e7('0x32')](_0x2ae436[_0x93e7('0x31')]);_0x993b7b[_0x93e7('0x33')]=_[_0x93e7('0x34')](_0x993b7b[_0x93e7('0x2f')],_0x993b7b[_0x93e7('0x31')]);_0x3db3bf[_0x93e7('0x35')]=_['intersection'](_0x993b7b[_0x93e7('0x2f')],qs['fields'](_0x2ae436[_0x93e7('0x31')][_0x93e7('0x36')]));_0x3db3bf[_0x93e7('0x35')]=_0x3db3bf[_0x93e7('0x35')][_0x93e7('0x37')]?_0x3db3bf[_0x93e7('0x35')]:_0x993b7b[_0x93e7('0x2f')];if(_0x2ae436[_0x93e7('0x31')][_0x93e7('0x40')]){_0x3db3bf[_0x93e7('0x41')]=[{'all':!![]}];}_0x3db3bf=_['merge']({},_0x3db3bf,_0x2ae436[_0x93e7('0x42')]);return db[_0x93e7('0x2a')][_0x93e7('0x43')](_0x3db3bf)[_0x93e7('0x24')](handleEntityNotFound(_0x229c2c,null))[_0x93e7('0x24')](respondWithResult(_0x229c2c,null))['catch'](handleError(_0x229c2c,null));};exports['create']=function(_0xe31f86,_0x1adf7c){return db[_0x93e7('0x2a')][_0x93e7('0x44')](_0xe31f86[_0x93e7('0x45')],{})[_0x93e7('0x24')](respondWithResult(_0x1adf7c,0xc9))[_0x93e7('0x46')](handleError(_0x1adf7c,null));};exports[_0x93e7('0x23')]=function(_0x13ac97,_0x3010ad){if(_0x13ac97[_0x93e7('0x45')]['id']){delete _0x13ac97[_0x93e7('0x45')]['id'];}return db[_0x93e7('0x2a')][_0x93e7('0x43')]({'where':{'id':_0x13ac97[_0x93e7('0x3f')]['id']}})[_0x93e7('0x24')](handleEntityNotFound(_0x3010ad,null))[_0x93e7('0x24')](saveUpdates(_0x13ac97[_0x93e7('0x45')],null))[_0x93e7('0x24')](respondWithResult(_0x3010ad,null))['catch'](handleError(_0x3010ad,null));};exports[_0x93e7('0x25')]=function(_0x461de1,_0x2fd3f1){return db[_0x93e7('0x2a')][_0x93e7('0x43')]({'where':{'id':_0x461de1[_0x93e7('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2fd3f1,null))[_0x93e7('0x24')](removeEntity(_0x2fd3f1,null))[_0x93e7('0x46')](handleError(_0x2fd3f1,null));};exports['describe']=function(_0x4f4a7e,_0x401a01){return db['JscriptyQuestionReport'][_0x93e7('0x47')]()['then'](respondWithResult(_0x401a01,null))[_0x93e7('0x46')](handleError(_0x401a01,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 18006ed..81e92f9 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 _0xac22=['define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./jscriptyQuestionReport.attributes'];(function(_0x12b86b,_0x10de5c){var _0x5e1cd4=function(_0x3ff18e){while(--_0x3ff18e){_0x12b86b['push'](_0x12b86b['shift']());}};_0x5e1cd4(++_0x10de5c);}(_0xac22,0x16b));var _0x2ac2=function(_0x188358,_0x574f3e){_0x188358=_0x188358-0x0;var _0x3b4188=_0xac22[_0x188358];return _0x3b4188;};'use strict';var _=require(_0x2ac2('0x0'));var util=require(_0x2ac2('0x1'));var logger=require(_0x2ac2('0x2'))(_0x2ac2('0x3'));var moment=require(_0x2ac2('0x4'));var BPromise=require(_0x2ac2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ac2('0x6'));var rimraf=require(_0x2ac2('0x7'));var config=require('../../config/environment');var attributes=require(_0x2ac2('0x8'));module['exports']=function(_0x35f74d,_0x3004ab){return _0x35f74d[_0x2ac2('0x9')](_0x2ac2('0xa'),attributes,{'tableName':_0x2ac2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5222=['request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','JscriptyQuestionReport','lodash','util','api','moment','bluebird'];(function(_0x5c0f6d,_0x5aa4f6){var _0x388fb0=function(_0x5e2562){while(--_0x5e2562){_0x5c0f6d['push'](_0x5c0f6d['shift']());}};_0x388fb0(++_0x5aa4f6);}(_0x5222,0x103));var _0x2522=function(_0xb71bc3,_0x435a43){_0xb71bc3=_0xb71bc3-0x0;var _0x24beb7=_0x5222[_0xb71bc3];return _0x24beb7;};'use strict';var _=require(_0x2522('0x0'));var util=require(_0x2522('0x1'));var logger=require('../../config/logger')(_0x2522('0x2'));var moment=require(_0x2522('0x3'));var BPromise=require(_0x2522('0x4'));var rp=require(_0x2522('0x5'));var fs=require('fs');var path=require(_0x2522('0x6'));var rimraf=require(_0x2522('0x7'));var config=require(_0x2522('0x8'));var attributes=require(_0x2522('0x9'));module['exports']=function(_0x50611e,_0x4378f3){return _0x50611e[_0x2522('0xa')](_0x2522('0xb'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 6c249e1..5e113e5 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 _0xd915=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0xdf888c,_0x5b4636){var _0x350d5b=function(_0x36edaf){while(--_0x36edaf){_0xdf888c['push'](_0xdf888c['shift']());}};_0x350d5b(++_0x5b4636);}(_0xd915,0x14a));var _0x5d91=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xd915[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x5d91('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5d91('0x1'));var rs=require(_0x5d91('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d91('0x3'))['db'];var utils=require(_0x5d91('0x4'));var logger=require(_0x5d91('0x5'))(_0x5d91('0x6'));var config=require(_0x5d91('0x7'));var jayson=require(_0x5d91('0x8'));var client=jayson[_0x5d91('0x9')][_0x5d91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47e3ab,_0x58d7cc,_0x4796fc){return new BPromise(function(_0xf58538,_0x3d4e22){return client[_0x5d91('0xb')](_0x47e3ab,_0x4796fc)[_0x5d91('0xc')](function(_0x5e9369){logger[_0x5d91('0xd')](_0x5d91('0xe'),_0x58d7cc,_0x5d91('0xf'));logger[_0x5d91('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x58d7cc,'request\x20sent',JSON[_0x5d91('0x11')](_0x5e9369));if(_0x5e9369[_0x5d91('0x12')]){if(_0x5e9369[_0x5d91('0x12')]['code']===0x1f4){logger[_0x5d91('0x12')](_0x5d91('0xe'),_0x58d7cc,_0x5e9369[_0x5d91('0x12')]['message']);return _0x3d4e22(_0x5e9369[_0x5d91('0x12')][_0x5d91('0x13')]);}logger[_0x5d91('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x58d7cc,_0x5e9369[_0x5d91('0x12')][_0x5d91('0x13')]);return _0xf58538(_0x5e9369[_0x5d91('0x12')]['message']);}else{logger[_0x5d91('0xd')](_0x5d91('0xe'),_0x58d7cc,_0x5d91('0xf'));_0xf58538(_0x5e9369[_0x5d91('0x14')][_0x5d91('0x13')]);}})[_0x5d91('0x15')](function(_0x1cd996){logger['error'](_0x5d91('0xe'),_0x58d7cc,_0x1cd996);_0x3d4e22(_0x1cd996);});});} \ No newline at end of file +var _0x6ff8=['catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x5132c6,_0x324e5c){var _0x231de7=function(_0x130faf){while(--_0x130faf){_0x5132c6['push'](_0x5132c6['shift']());}};_0x231de7(++_0x324e5c);}(_0x6ff8,0x1e1));var _0x86ff=function(_0x2c4e1b,_0x48a2dc){_0x2c4e1b=_0x2c4e1b-0x0;var _0x335117=_0x6ff8[_0x2c4e1b];return _0x335117;};'use strict';var _=require('lodash');var util=require(_0x86ff('0x0'));var moment=require(_0x86ff('0x1'));var BPromise=require('bluebird');var rs=require(_0x86ff('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86ff('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86ff('0x4'))(_0x86ff('0x5'));var config=require('../../config/environment');var jayson=require(_0x86ff('0x6'));var client=jayson[_0x86ff('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4949ee,_0x3bc028,_0x58b1b7){return new BPromise(function(_0x3bff9c,_0xe8f9db){return client[_0x86ff('0x8')](_0x4949ee,_0x58b1b7)[_0x86ff('0x9')](function(_0x474b52){logger[_0x86ff('0xa')](_0x86ff('0xb'),_0x3bc028,_0x86ff('0xc'));logger[_0x86ff('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x3bc028,_0x86ff('0xc'),JSON[_0x86ff('0xe')](_0x474b52));if(_0x474b52[_0x86ff('0xf')]){if(_0x474b52[_0x86ff('0xf')][_0x86ff('0x10')]===0x1f4){logger[_0x86ff('0xf')](_0x86ff('0xb'),_0x3bc028,_0x474b52[_0x86ff('0xf')]['message']);return _0xe8f9db(_0x474b52[_0x86ff('0xf')][_0x86ff('0x11')]);}logger[_0x86ff('0xf')](_0x86ff('0xb'),_0x3bc028,_0x474b52['error'][_0x86ff('0x11')]);return _0x3bff9c(_0x474b52[_0x86ff('0xf')][_0x86ff('0x11')]);}else{logger[_0x86ff('0xa')](_0x86ff('0xb'),_0x3bc028,'request\x20sent');_0x3bff9c(_0x474b52[_0x86ff('0x12')]['message']);}})[_0x86ff('0x13')](function(_0x1ceb6a){logger['error'](_0x86ff('0xb'),_0x3bc028,_0x1ceb6a);_0xe8f9db(_0x1ceb6a);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 09b6d1c..a874179 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 _0x16b3=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','./jscriptySessionReport.controller','get','index','/describe','describe','show','isAuthenticated','getQuestions','update','destroy','exports','multer'];(function(_0x5f405b,_0x1fdbb9){var _0x42875b=function(_0x4fa0fc){while(--_0x4fa0fc){_0x5f405b['push'](_0x5f405b['shift']());}};_0x42875b(++_0x1fdbb9);}(_0x16b3,0x1db));var _0x316b=function(_0x5106a2,_0x2e89c0){_0x5106a2=_0x5106a2-0x0;var _0x305e1f=_0x16b3[_0x5106a2];return _0x305e1f;};'use strict';var multer=require(_0x316b('0x0'));var util=require('util');var path=require(_0x316b('0x1'));var timeout=require(_0x316b('0x2'));var express=require('express');var router=express[_0x316b('0x3')]();var fs_extra=require(_0x316b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x316b('0x5'));var config=require('../../config/environment');var controller=require(_0x316b('0x6'));router[_0x316b('0x7')]('/',auth['isAuthenticated'](),controller[_0x316b('0x8')]);router[_0x316b('0x7')](_0x316b('0x9'),auth['isAuthenticated'](),controller[_0x316b('0xa')]);router[_0x316b('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x316b('0xb')]);router[_0x316b('0x7')]('/:id/questions',auth[_0x316b('0xc')](),controller[_0x316b('0xd')]);router['post']('/',auth[_0x316b('0xc')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x316b('0xe')]);router['delete']('/:id',auth[_0x316b('0xc')](),controller[_0x316b('0xf')]);module[_0x316b('0x10')]=router; \ No newline at end of file +var _0xe6cb=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/questions','getQuestions'];(function(_0x3d7d4e,_0x1e6c95){var _0x461b4e=function(_0x3472dc){while(--_0x3472dc){_0x3d7d4e['push'](_0x3d7d4e['shift']());}};_0x461b4e(++_0x1e6c95);}(_0xe6cb,0x103));var _0xbe6c=function(_0x195303,_0x550387){_0x195303=_0x195303-0x0;var _0x51bb95=_0xe6cb[_0x195303];return _0x51bb95;};'use strict';var multer=require(_0xbe6c('0x0'));var util=require(_0xbe6c('0x1'));var path=require(_0xbe6c('0x2'));var timeout=require(_0xbe6c('0x3'));var express=require(_0xbe6c('0x4'));var router=express['Router']();var fs_extra=require(_0xbe6c('0x5'));var auth=require(_0xbe6c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe6c('0x7'));router['get']('/',auth[_0xbe6c('0x8')](),controller[_0xbe6c('0x9')]);router[_0xbe6c('0xa')](_0xbe6c('0xb'),auth[_0xbe6c('0x8')](),controller[_0xbe6c('0xc')]);router['get'](_0xbe6c('0xd'),auth[_0xbe6c('0x8')](),controller[_0xbe6c('0xe')]);router[_0xbe6c('0xa')](_0xbe6c('0xf'),auth[_0xbe6c('0x8')](),controller[_0xbe6c('0x10')]);router[_0xbe6c('0x11')]('/',auth[_0xbe6c('0x8')](),controller['create']);router[_0xbe6c('0x12')](_0xbe6c('0xd'),auth[_0xbe6c('0x8')](),controller[_0xbe6c('0x13')]);router[_0xbe6c('0x14')](_0xbe6c('0xd'),auth['isAuthenticated'](),controller[_0xbe6c('0x15')]);module[_0xbe6c('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 4adfbf9..e2b461b 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 _0xb657=['starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue'];(function(_0x19a49f,_0x444d74){var _0x5351ae=function(_0x58b1ed){while(--_0x58b1ed){_0x19a49f['push'](_0x19a49f['shift']());}};_0x5351ae(++_0x444d74);}(_0xb657,0x150));var _0x7b65=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xb657[_0x46698a];return _0x356db0;};'use strict';var moment=require(_0x7b65('0x0'));var Sequelize=require(_0x7b65('0x1'));module[_0x7b65('0x2')]={'starttime':{'type':Sequelize[_0x7b65('0x3')],'set':function(_0x480564){this[_0x7b65('0x4')](_0x7b65('0x5'),_0x480564);this[_0x7b65('0x4')](_0x7b65('0x6'),moment()[_0x7b65('0x7')](_0x7b65('0x8')));}},'endtime':{'type':Sequelize[_0x7b65('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x7b65('0x9')]},'queue':{'type':Sequelize[_0x7b65('0x9')]},'uniqueid':{'type':Sequelize[_0x7b65('0x9')]},'calleridname':{'type':Sequelize[_0x7b65('0x9')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x7b65('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0xdfe9=['DATE','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize'];(function(_0x38ed15,_0x2b12e8){var _0x29db8b=function(_0x1d0da6){while(--_0x1d0da6){_0x38ed15['push'](_0x38ed15['shift']());}};_0x29db8b(++_0x2b12e8);}(_0xdfe9,0x8a));var _0x9dfe=function(_0x2ec978,_0xd99181){_0x2ec978=_0x2ec978-0x0;var _0xc2b191=_0xdfe9[_0x2ec978];return _0xc2b191;};'use strict';var moment=require(_0x9dfe('0x0'));var Sequelize=require(_0x9dfe('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x9dfe('0x2')],'set':function(_0x493f0c){this[_0x9dfe('0x3')]('starttime',_0x493f0c);this['setDataValue']('endtime',moment()[_0x9dfe('0x4')](_0x9dfe('0x5')));}},'endtime':{'type':Sequelize[_0x9dfe('0x2')]},'membername':{'type':Sequelize[_0x9dfe('0x6')]},'projectname':{'type':Sequelize[_0x9dfe('0x6')]},'queue':{'type':Sequelize[_0x9dfe('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9dfe('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 6de4de4..4f82ea3 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 _0xe840=['destroy','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','SessionId','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','then','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','keys','options','find','create','body'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe840,0x1ee));var _0x0e84=function(_0x6d40f5,_0x301dce){_0x6d40f5=_0x6d40f5-0x0;var _0x2063b9=_0xe840[_0x6d40f5];return _0x2063b9;};'use strict';var emlformat=require(_0x0e84('0x0'));var rimraf=require(_0x0e84('0x1'));var zipdir=require(_0x0e84('0x2'));var jsonpatch=require(_0x0e84('0x3'));var rp=require(_0x0e84('0x4'));var moment=require(_0x0e84('0x5'));var BPromise=require(_0x0e84('0x6'));var Mustache=require('mustache');var util=require(_0x0e84('0x7'));var path=require('path');var sox=require(_0x0e84('0x8'));var csv=require(_0x0e84('0x9'));var ejs=require(_0x0e84('0xa'));var fs=require('fs');var fs_extra=require(_0x0e84('0xb'));var _=require(_0x0e84('0xc'));var squel=require('squel');var crypto=require(_0x0e84('0xd'));var jsforce=require(_0x0e84('0xe'));var deskjs=require(_0x0e84('0xf'));var toCsv=require(_0x0e84('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0e84('0x10'));var as=require(_0x0e84('0x11'));var hardwareService=require(_0x0e84('0x12'));var logger=require(_0x0e84('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x0e84('0x14'));var licenseUtil=require(_0x0e84('0x15'));var db=require(_0x0e84('0x16'))['db'];function respondWithStatusCode(_0x32d6d7,_0x596853){_0x596853=_0x596853||0xcc;return function(_0x4d863a){if(_0x4d863a){return _0x32d6d7[_0x0e84('0x17')](_0x596853);}return _0x32d6d7[_0x0e84('0x18')](_0x596853)[_0x0e84('0x19')]();};}function respondWithResult(_0x4fd251,_0x5a5c87){_0x5a5c87=_0x5a5c87||0xc8;return function(_0x5ce28d){if(_0x5ce28d){return _0x4fd251[_0x0e84('0x18')](_0x5a5c87)['json'](_0x5ce28d);}};}function respondWithFilteredResult(_0x19a64c,_0x1f3b48){return function(_0x49e79f){if(_0x49e79f){var _0x8a323f=typeof _0x1f3b48['offset']===_0x0e84('0x1a')&&typeof _0x1f3b48[_0x0e84('0x1b')]===_0x0e84('0x1a');var _0x4cba34=_0x49e79f['count'];var _0x410368=_0x8a323f?0x0:_0x1f3b48[_0x0e84('0x1c')];var _0xd2bb7c=_0x8a323f?_0x49e79f[_0x0e84('0x1d')]:_0x1f3b48['offset']+_0x1f3b48[_0x0e84('0x1b')];var _0x38379b;if(_0xd2bb7c>=_0x4cba34){_0xd2bb7c=_0x4cba34;_0x38379b=0xc8;}else{_0x38379b=0xce;}_0x19a64c['status'](_0x38379b);return _0x19a64c[_0x0e84('0x1e')](_0x0e84('0x1f'),_0x410368+'-'+_0xd2bb7c+'/'+_0x4cba34)[_0x0e84('0x20')](_0x49e79f);}return null;};}function patchUpdates(_0x30f9b2){return function(_0x5935fa){try{jsonpatch[_0x0e84('0x21')](_0x5935fa,_0x30f9b2,!![]);}catch(_0x20ba27){return BPromise[_0x0e84('0x22')](_0x20ba27);}return _0x5935fa[_0x0e84('0x23')]();};}function saveUpdates(_0x5473ed,_0x33494d){return function(_0x20d151){if(_0x20d151){return _0x20d151['update'](_0x5473ed)[_0x0e84('0x24')](function(_0x3cea3e){return _0x3cea3e;});}return null;};}function removeEntity(_0x102080,_0x39025c){return function(_0x88271f){if(_0x88271f){return _0x88271f['destroy']()[_0x0e84('0x24')](function(){_0x102080[_0x0e84('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bf395,_0x515d98){return function(_0x42a258){if(!_0x42a258){_0x5bf395[_0x0e84('0x17')](0x194);}return _0x42a258;};}function handleError(_0x4d8e77,_0xccd7a4){_0xccd7a4=_0xccd7a4||0x1f4;return function(_0x57cf1a){logger['error'](_0x57cf1a[_0x0e84('0x25')]);if(_0x57cf1a[_0x0e84('0x26')]){delete _0x57cf1a[_0x0e84('0x26')];}_0x4d8e77[_0x0e84('0x18')](_0xccd7a4)[_0x0e84('0x27')](_0x57cf1a);};}exports[_0x0e84('0x28')]=function(_0x47e755,_0x2bad12){var _0x4ea691={},_0x2d9da6={},_0x3500dc={'count':0x0,'rows':[]};var _0x299b7d=_['map'](db[_0x0e84('0x29')][_0x0e84('0x2a')],function(_0x84283b){return{'name':_0x84283b[_0x0e84('0x2b')],'type':_0x84283b['type'][_0x0e84('0x2c')]};});_0x2d9da6['model']=_['map'](_0x299b7d,_0x0e84('0x26'));_0x2d9da6[_0x0e84('0x2d')]=_['keys'](_0x47e755[_0x0e84('0x2d')]);_0x2d9da6[_0x0e84('0x2e')]=_[_0x0e84('0x2f')](_0x2d9da6[_0x0e84('0x30')],_0x2d9da6['query']);_0x4ea691['attributes']=_[_0x0e84('0x2f')](_0x2d9da6[_0x0e84('0x30')],qs['fields'](_0x47e755[_0x0e84('0x2d')][_0x0e84('0x31')]));_0x4ea691[_0x0e84('0x32')]=_0x4ea691[_0x0e84('0x32')][_0x0e84('0x33')]?_0x4ea691[_0x0e84('0x32')]:_0x2d9da6[_0x0e84('0x30')];if(!_0x47e755['query']['hasOwnProperty'](_0x0e84('0x34'))){_0x4ea691[_0x0e84('0x1b')]=qs[_0x0e84('0x1b')](_0x47e755['query'][_0x0e84('0x1b')]);_0x4ea691[_0x0e84('0x1c')]=qs[_0x0e84('0x1c')](_0x47e755[_0x0e84('0x2d')][_0x0e84('0x1c')]);}_0x4ea691[_0x0e84('0x35')]=qs['sort'](_0x47e755[_0x0e84('0x2d')][_0x0e84('0x36')]);_0x4ea691[_0x0e84('0x37')]=qs[_0x0e84('0x2e')](_[_0x0e84('0x38')](_0x47e755['query'],_0x2d9da6[_0x0e84('0x2e')]),_0x299b7d);if(_0x47e755[_0x0e84('0x2d')]['filter']){_0x4ea691[_0x0e84('0x37')]=_[_0x0e84('0x39')](_0x4ea691[_0x0e84('0x37')],{'$or':_[_0x0e84('0x3a')](_0x299b7d,function(_0x58f5c0){if(_0x58f5c0[_0x0e84('0x3b')]!==_0x0e84('0x3c')){var _0x3bfb00={};_0x3bfb00[_0x58f5c0[_0x0e84('0x26')]]={'$like':'%'+_0x47e755[_0x0e84('0x2d')][_0x0e84('0x3d')]+'%'};return _0x3bfb00;}})});}_0x4ea691=_[_0x0e84('0x39')]({},_0x4ea691,_0x47e755['options']);var _0x34b453={'where':_0x4ea691[_0x0e84('0x37')]};return db['JscriptySessionReport'][_0x0e84('0x1d')](_0x34b453)[_0x0e84('0x24')](function(_0x1251b6){_0x3500dc[_0x0e84('0x1d')]=_0x1251b6;if(_0x47e755[_0x0e84('0x2d')][_0x0e84('0x3e')]){_0x4ea691[_0x0e84('0x3f')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0e84('0x40')](_0x4ea691);})[_0x0e84('0x24')](function(_0x2caa6f){_0x3500dc['rows']=_0x2caa6f;return _0x3500dc;})[_0x0e84('0x24')](respondWithFilteredResult(_0x2bad12,_0x4ea691))[_0x0e84('0x41')](handleError(_0x2bad12,null));};exports[_0x0e84('0x42')]=function(_0x243c47,_0x470d29){var _0xed8f43={'raw':!![],'where':{'id':_0x243c47[_0x0e84('0x43')]['id']}},_0x48c6c9={};_0x48c6c9['model']=_[_0x0e84('0x44')](db[_0x0e84('0x29')][_0x0e84('0x2a')]);_0x48c6c9[_0x0e84('0x2d')]=_['keys'](_0x243c47['query']);_0x48c6c9['filters']=_[_0x0e84('0x2f')](_0x48c6c9[_0x0e84('0x30')],_0x48c6c9[_0x0e84('0x2d')]);_0xed8f43[_0x0e84('0x32')]=_[_0x0e84('0x2f')](_0x48c6c9[_0x0e84('0x30')],qs[_0x0e84('0x31')](_0x243c47[_0x0e84('0x2d')][_0x0e84('0x31')]));_0xed8f43[_0x0e84('0x32')]=_0xed8f43['attributes']['length']?_0xed8f43[_0x0e84('0x32')]:_0x48c6c9[_0x0e84('0x30')];if(_0x243c47['query'][_0x0e84('0x3e')]){_0xed8f43[_0x0e84('0x3f')]=[{'all':!![]}];}_0xed8f43=_[_0x0e84('0x39')]({},_0xed8f43,_0x243c47[_0x0e84('0x45')]);return db[_0x0e84('0x29')][_0x0e84('0x46')](_0xed8f43)[_0x0e84('0x24')](handleEntityNotFound(_0x470d29,null))[_0x0e84('0x24')](respondWithResult(_0x470d29,null))[_0x0e84('0x41')](handleError(_0x470d29,null));};exports[_0x0e84('0x47')]=function(_0x4125af,_0x561738){return db['JscriptySessionReport'][_0x0e84('0x47')](_0x4125af[_0x0e84('0x48')],{})[_0x0e84('0x24')](respondWithResult(_0x561738,0xc9))[_0x0e84('0x41')](handleError(_0x561738,null));};exports['update']=function(_0x3d6e55,_0x1e1035){if(_0x3d6e55['body']['id']){delete _0x3d6e55[_0x0e84('0x48')]['id'];}return db[_0x0e84('0x29')][_0x0e84('0x46')]({'where':{'id':_0x3d6e55[_0x0e84('0x43')]['id']}})[_0x0e84('0x24')](handleEntityNotFound(_0x1e1035,null))['then'](saveUpdates(_0x3d6e55[_0x0e84('0x48')],null))[_0x0e84('0x24')](respondWithResult(_0x1e1035,null))[_0x0e84('0x41')](handleError(_0x1e1035,null));};exports[_0x0e84('0x49')]=function(_0x357bc9,_0x3775d8){return db[_0x0e84('0x29')]['find']({'where':{'id':_0x357bc9[_0x0e84('0x43')]['id']}})[_0x0e84('0x24')](handleEntityNotFound(_0x3775d8,null))[_0x0e84('0x24')](removeEntity(_0x3775d8,null))['catch'](handleError(_0x3775d8,null));};exports[_0x0e84('0x4a')]=function(_0x1f4ca4,_0x3c8ca9){return db[_0x0e84('0x29')][_0x0e84('0x4a')]()['then'](respondWithResult(_0x3c8ca9,null))[_0x0e84('0x41')](handleError(_0x3c8ca9,null));};exports[_0x0e84('0x4b')]=function(_0x3fdd56,_0x13f2fd,_0x327ee6){var _0x39010d={'raw':!![],'where':{}};var _0x28e29d={};var _0x387eef={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x0e84('0x4c')]({'where':{'id':_0x3fdd56[_0x0e84('0x43')]['id']}})[_0x0e84('0x24')](handleEntityNotFound(_0x13f2fd,null))[_0x0e84('0x24')](function(_0x4be7be){if(_0x4be7be){_0x28e29d[_0x0e84('0x30')]=_[_0x0e84('0x44')](db[_0x0e84('0x4d')][_0x0e84('0x2a')]);_0x28e29d[_0x0e84('0x2d')]=_[_0x0e84('0x44')](_0x3fdd56[_0x0e84('0x2d')]);_0x28e29d[_0x0e84('0x2e')]=_[_0x0e84('0x2f')](_0x28e29d['model'],_0x28e29d[_0x0e84('0x2d')]);_0x39010d[_0x0e84('0x32')]=_[_0x0e84('0x2f')](_0x28e29d[_0x0e84('0x30')],qs[_0x0e84('0x31')](_0x3fdd56[_0x0e84('0x2d')][_0x0e84('0x31')]));_0x39010d[_0x0e84('0x32')]=_0x39010d[_0x0e84('0x32')][_0x0e84('0x33')]?_0x39010d[_0x0e84('0x32')]:_0x28e29d['model'];if(!_0x3fdd56[_0x0e84('0x2d')][_0x0e84('0x4e')]('nolimit')){_0x39010d[_0x0e84('0x1b')]=qs[_0x0e84('0x1b')](_0x3fdd56['query'][_0x0e84('0x1b')]);_0x39010d[_0x0e84('0x1c')]=qs[_0x0e84('0x1c')](_0x3fdd56[_0x0e84('0x2d')][_0x0e84('0x1c')]);}_0x39010d[_0x0e84('0x35')]=qs['sort'](_0x3fdd56['query'][_0x0e84('0x36')]);_0x39010d[_0x0e84('0x37')]=qs[_0x0e84('0x2e')](_['pick'](_0x3fdd56[_0x0e84('0x2d')],_0x28e29d[_0x0e84('0x2e')]));_0x39010d[_0x0e84('0x37')][_0x0e84('0x4f')]=_0x4be7be['id'];if(_0x3fdd56[_0x0e84('0x2d')]['filter']){_0x39010d[_0x0e84('0x37')]=_[_0x0e84('0x39')](_0x39010d[_0x0e84('0x37')],{'$or':_[_0x0e84('0x3a')](_0x39010d[_0x0e84('0x32')],function(_0x3a683a){var _0x5f0f45={};_0x5f0f45[_0x3a683a]={'$like':'%'+_0x3fdd56[_0x0e84('0x2d')][_0x0e84('0x3d')]+'%'};return _0x5f0f45;})});}_0x39010d=_[_0x0e84('0x39')]({},_0x39010d,_0x3fdd56[_0x0e84('0x45')]);return db['JscriptyQuestionReport'][_0x0e84('0x1d')]({'where':_0x39010d[_0x0e84('0x37')]})['then'](function(_0x3b85da){_0x387eef[_0x0e84('0x1d')]=_0x3b85da;if(_0x3fdd56[_0x0e84('0x2d')][_0x0e84('0x3e')]){_0x39010d[_0x0e84('0x3f')]=[{'all':!![]}];}return db[_0x0e84('0x4d')][_0x0e84('0x40')](_0x39010d);})[_0x0e84('0x24')](function(_0x4c9dfc){_0x387eef[_0x0e84('0x50')]=_0x4c9dfc;return _0x387eef;});}})[_0x0e84('0x24')](respondWithFilteredResult(_0x13f2fd,_0x39010d))[_0x0e84('0x41')](handleError(_0x13f2fd,null));}; \ No newline at end of file +var _0x3c74=['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/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','destroy','stack','name','send','index','map','rawAttributes','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','type','VIRTUAL','options','JscriptySessionReport','then','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','update','describe','getQuestions','findOne','JscriptyQuestionReport','pick','SessionId','eml-format','zip-dir','fast-json-patch'];(function(_0xf0ef33,_0x533bd0){var _0x299e7d=function(_0x1380b7){while(--_0x1380b7){_0xf0ef33['push'](_0xf0ef33['shift']());}};_0x299e7d(++_0x533bd0);}(_0x3c74,0x9f));var _0x43c7=function(_0x201e28,_0x4bb4ed){_0x201e28=_0x201e28-0x0;var _0x220aef=_0x3c74[_0x201e28];return _0x220aef;};'use strict';var emlformat=require(_0x43c7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43c7('0x1'));var jsonpatch=require(_0x43c7('0x2'));var rp=require(_0x43c7('0x3'));var moment=require(_0x43c7('0x4'));var BPromise=require(_0x43c7('0x5'));var Mustache=require(_0x43c7('0x6'));var util=require(_0x43c7('0x7'));var path=require('path');var sox=require(_0x43c7('0x8'));var csv=require(_0x43c7('0x9'));var ejs=require(_0x43c7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43c7('0xb'));var squel=require(_0x43c7('0xc'));var crypto=require('crypto');var jsforce=require(_0x43c7('0xd'));var deskjs=require(_0x43c7('0xe'));var toCsv=require(_0x43c7('0x9'));var querystring=require(_0x43c7('0xf'));var Papa=require(_0x43c7('0x10'));var Redis=require(_0x43c7('0x11'));var authService=require(_0x43c7('0x12'));var qs=require(_0x43c7('0x13'));var as=require(_0x43c7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43c7('0x15'))(_0x43c7('0x16'));var utils=require(_0x43c7('0x17'));var config=require(_0x43c7('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x130ba7,_0x2b8c01){_0x2b8c01=_0x2b8c01||0xcc;return function(_0x3fc645){if(_0x3fc645){return _0x130ba7[_0x43c7('0x19')](_0x2b8c01);}return _0x130ba7['status'](_0x2b8c01)[_0x43c7('0x1a')]();};}function respondWithResult(_0x394e38,_0x2a50f7){_0x2a50f7=_0x2a50f7||0xc8;return function(_0x54c17e){if(_0x54c17e){return _0x394e38[_0x43c7('0x1b')](_0x2a50f7)['json'](_0x54c17e);}};}function respondWithFilteredResult(_0x318e5f,_0x32bb3c){return function(_0x263956){if(_0x263956){var _0x5d8b52=typeof _0x32bb3c[_0x43c7('0x1c')]===_0x43c7('0x1d')&&typeof _0x32bb3c[_0x43c7('0x1e')]===_0x43c7('0x1d');var _0x520133=_0x263956['count'];var _0x234990=_0x5d8b52?0x0:_0x32bb3c[_0x43c7('0x1c')];var _0x20e9a3=_0x5d8b52?_0x263956[_0x43c7('0x1f')]:_0x32bb3c[_0x43c7('0x1c')]+_0x32bb3c[_0x43c7('0x1e')];var _0x3f3f2c;if(_0x20e9a3>=_0x520133){_0x20e9a3=_0x520133;_0x3f3f2c=0xc8;}else{_0x3f3f2c=0xce;}_0x318e5f[_0x43c7('0x1b')](_0x3f3f2c);return _0x318e5f['set'](_0x43c7('0x20'),_0x234990+'-'+_0x20e9a3+'/'+_0x520133)[_0x43c7('0x21')](_0x263956);}return null;};}function patchUpdates(_0x1c9130){return function(_0x1f4a18){try{jsonpatch[_0x43c7('0x22')](_0x1f4a18,_0x1c9130,!![]);}catch(_0x45484a){return BPromise[_0x43c7('0x23')](_0x45484a);}return _0x1f4a18['save']();};}function saveUpdates(_0x31523c,_0x5bd283){return function(_0x5292f3){if(_0x5292f3){return _0x5292f3['update'](_0x31523c)['then'](function(_0x37a865){return _0x37a865;});}return null;};}function removeEntity(_0x6b5d61,_0x2504c3){return function(_0x21265a){if(_0x21265a){return _0x21265a[_0x43c7('0x24')]()['then'](function(){_0x6b5d61['status'](0xcc)[_0x43c7('0x1a')]();});}};}function handleEntityNotFound(_0x4d8c52,_0x12dd6c){return function(_0x387df5){if(!_0x387df5){_0x4d8c52['sendStatus'](0x194);}return _0x387df5;};}function handleError(_0x54ff92,_0x762670){_0x762670=_0x762670||0x1f4;return function(_0x2b2e3d){logger['error'](_0x2b2e3d[_0x43c7('0x25')]);if(_0x2b2e3d['name']){delete _0x2b2e3d[_0x43c7('0x26')];}_0x54ff92[_0x43c7('0x1b')](_0x762670)[_0x43c7('0x27')](_0x2b2e3d);};}exports[_0x43c7('0x28')]=function(_0x5868a4,_0x550638){var _0x4170ce={},_0x3130d3={},_0x327f8a={'count':0x0,'rows':[]};var _0x17b5d2=_[_0x43c7('0x29')](db['JscriptySessionReport'][_0x43c7('0x2a')],function(_0x432f7f){return{'name':_0x432f7f['fieldName'],'type':_0x432f7f['type'][_0x43c7('0x2b')]};});_0x3130d3['model']=_[_0x43c7('0x29')](_0x17b5d2,_0x43c7('0x26'));_0x3130d3[_0x43c7('0x2c')]=_[_0x43c7('0x2d')](_0x5868a4[_0x43c7('0x2c')]);_0x3130d3['filters']=_[_0x43c7('0x2e')](_0x3130d3[_0x43c7('0x2f')],_0x3130d3[_0x43c7('0x2c')]);_0x4170ce[_0x43c7('0x30')]=_[_0x43c7('0x2e')](_0x3130d3[_0x43c7('0x2f')],qs[_0x43c7('0x31')](_0x5868a4['query'][_0x43c7('0x31')]));_0x4170ce[_0x43c7('0x30')]=_0x4170ce['attributes'][_0x43c7('0x32')]?_0x4170ce[_0x43c7('0x30')]:_0x3130d3[_0x43c7('0x2f')];if(!_0x5868a4[_0x43c7('0x2c')][_0x43c7('0x33')](_0x43c7('0x34'))){_0x4170ce[_0x43c7('0x1e')]=qs['limit'](_0x5868a4[_0x43c7('0x2c')][_0x43c7('0x1e')]);_0x4170ce[_0x43c7('0x1c')]=qs[_0x43c7('0x1c')](_0x5868a4['query'][_0x43c7('0x1c')]);}_0x4170ce[_0x43c7('0x35')]=qs['sort'](_0x5868a4[_0x43c7('0x2c')][_0x43c7('0x36')]);_0x4170ce[_0x43c7('0x37')]=qs[_0x43c7('0x38')](_['pick'](_0x5868a4['query'],_0x3130d3[_0x43c7('0x38')]),_0x17b5d2);if(_0x5868a4[_0x43c7('0x2c')][_0x43c7('0x39')]){_0x4170ce[_0x43c7('0x37')]=_['merge'](_0x4170ce[_0x43c7('0x37')],{'$or':_[_0x43c7('0x29')](_0x17b5d2,function(_0x4c9e45){if(_0x4c9e45[_0x43c7('0x3a')]!==_0x43c7('0x3b')){var _0x4a8743={};_0x4a8743[_0x4c9e45['name']]={'$like':'%'+_0x5868a4[_0x43c7('0x2c')]['filter']+'%'};return _0x4a8743;}})});}_0x4170ce=_['merge']({},_0x4170ce,_0x5868a4[_0x43c7('0x3c')]);var _0x4bf3e6={'where':_0x4170ce['where']};return db[_0x43c7('0x3d')][_0x43c7('0x1f')](_0x4bf3e6)[_0x43c7('0x3e')](function(_0x2c6dd7){_0x327f8a['count']=_0x2c6dd7;if(_0x5868a4[_0x43c7('0x2c')][_0x43c7('0x3f')]){_0x4170ce[_0x43c7('0x40')]=[{'all':!![]}];}return db[_0x43c7('0x3d')][_0x43c7('0x41')](_0x4170ce);})[_0x43c7('0x3e')](function(_0x4e6e16){_0x327f8a[_0x43c7('0x42')]=_0x4e6e16;return _0x327f8a;})[_0x43c7('0x3e')](respondWithFilteredResult(_0x550638,_0x4170ce))[_0x43c7('0x43')](handleError(_0x550638,null));};exports[_0x43c7('0x44')]=function(_0x13b688,_0x1eac66){var _0x136e8f={'raw':!![],'where':{'id':_0x13b688[_0x43c7('0x45')]['id']}},_0x3da60c={};_0x3da60c[_0x43c7('0x2f')]=_[_0x43c7('0x2d')](db['JscriptySessionReport'][_0x43c7('0x2a')]);_0x3da60c[_0x43c7('0x2c')]=_[_0x43c7('0x2d')](_0x13b688[_0x43c7('0x2c')]);_0x3da60c[_0x43c7('0x38')]=_['intersection'](_0x3da60c[_0x43c7('0x2f')],_0x3da60c[_0x43c7('0x2c')]);_0x136e8f[_0x43c7('0x30')]=_[_0x43c7('0x2e')](_0x3da60c['model'],qs[_0x43c7('0x31')](_0x13b688[_0x43c7('0x2c')][_0x43c7('0x31')]));_0x136e8f[_0x43c7('0x30')]=_0x136e8f[_0x43c7('0x30')]['length']?_0x136e8f[_0x43c7('0x30')]:_0x3da60c['model'];if(_0x13b688['query']['includeAll']){_0x136e8f['include']=[{'all':!![]}];}_0x136e8f=_[_0x43c7('0x46')]({},_0x136e8f,_0x13b688['options']);return db['JscriptySessionReport'][_0x43c7('0x47')](_0x136e8f)[_0x43c7('0x3e')](handleEntityNotFound(_0x1eac66,null))[_0x43c7('0x3e')](respondWithResult(_0x1eac66,null))['catch'](handleError(_0x1eac66,null));};exports['create']=function(_0x5b0069,_0x781678){return db['JscriptySessionReport'][_0x43c7('0x48')](_0x5b0069[_0x43c7('0x49')],{})[_0x43c7('0x3e')](respondWithResult(_0x781678,0xc9))['catch'](handleError(_0x781678,null));};exports[_0x43c7('0x4a')]=function(_0x17f1e7,_0x24506d){if(_0x17f1e7[_0x43c7('0x49')]['id']){delete _0x17f1e7['body']['id'];}return db[_0x43c7('0x3d')][_0x43c7('0x47')]({'where':{'id':_0x17f1e7[_0x43c7('0x45')]['id']}})['then'](handleEntityNotFound(_0x24506d,null))[_0x43c7('0x3e')](saveUpdates(_0x17f1e7[_0x43c7('0x49')],null))[_0x43c7('0x3e')](respondWithResult(_0x24506d,null))[_0x43c7('0x43')](handleError(_0x24506d,null));};exports['destroy']=function(_0x4ddc5c,_0x51235c){return db[_0x43c7('0x3d')]['find']({'where':{'id':_0x4ddc5c[_0x43c7('0x45')]['id']}})['then'](handleEntityNotFound(_0x51235c,null))[_0x43c7('0x3e')](removeEntity(_0x51235c,null))['catch'](handleError(_0x51235c,null));};exports[_0x43c7('0x4b')]=function(_0x4fd0b0,_0x4a0f50){return db[_0x43c7('0x3d')]['describe']()[_0x43c7('0x3e')](respondWithResult(_0x4a0f50,null))[_0x43c7('0x43')](handleError(_0x4a0f50,null));};exports[_0x43c7('0x4c')]=function(_0x489cd3,_0x410d6f,_0x3ba2c0){var _0x527f74={'raw':!![],'where':{}};var _0xaf196b={};var _0x13969d={'count':0x0,'rows':[]};return db[_0x43c7('0x3d')][_0x43c7('0x4d')]({'where':{'id':_0x489cd3[_0x43c7('0x45')]['id']}})[_0x43c7('0x3e')](handleEntityNotFound(_0x410d6f,null))[_0x43c7('0x3e')](function(_0x4f5f61){if(_0x4f5f61){_0xaf196b['model']=_[_0x43c7('0x2d')](db[_0x43c7('0x4e')][_0x43c7('0x2a')]);_0xaf196b['query']=_[_0x43c7('0x2d')](_0x489cd3[_0x43c7('0x2c')]);_0xaf196b[_0x43c7('0x38')]=_[_0x43c7('0x2e')](_0xaf196b['model'],_0xaf196b[_0x43c7('0x2c')]);_0x527f74[_0x43c7('0x30')]=_[_0x43c7('0x2e')](_0xaf196b[_0x43c7('0x2f')],qs['fields'](_0x489cd3['query'][_0x43c7('0x31')]));_0x527f74[_0x43c7('0x30')]=_0x527f74[_0x43c7('0x30')][_0x43c7('0x32')]?_0x527f74['attributes']:_0xaf196b[_0x43c7('0x2f')];if(!_0x489cd3[_0x43c7('0x2c')][_0x43c7('0x33')](_0x43c7('0x34'))){_0x527f74['limit']=qs['limit'](_0x489cd3['query'][_0x43c7('0x1e')]);_0x527f74['offset']=qs[_0x43c7('0x1c')](_0x489cd3[_0x43c7('0x2c')]['offset']);}_0x527f74[_0x43c7('0x35')]=qs['sort'](_0x489cd3[_0x43c7('0x2c')][_0x43c7('0x36')]);_0x527f74[_0x43c7('0x37')]=qs[_0x43c7('0x38')](_[_0x43c7('0x4f')](_0x489cd3[_0x43c7('0x2c')],_0xaf196b[_0x43c7('0x38')]));_0x527f74['where'][_0x43c7('0x50')]=_0x4f5f61['id'];if(_0x489cd3[_0x43c7('0x2c')][_0x43c7('0x39')]){_0x527f74[_0x43c7('0x37')]=_[_0x43c7('0x46')](_0x527f74[_0x43c7('0x37')],{'$or':_[_0x43c7('0x29')](_0x527f74[_0x43c7('0x30')],function(_0x192b15){var _0x4a17ce={};_0x4a17ce[_0x192b15]={'$like':'%'+_0x489cd3[_0x43c7('0x2c')]['filter']+'%'};return _0x4a17ce;})});}_0x527f74=_[_0x43c7('0x46')]({},_0x527f74,_0x489cd3['options']);return db[_0x43c7('0x4e')][_0x43c7('0x1f')]({'where':_0x527f74['where']})[_0x43c7('0x3e')](function(_0x6227ae){_0x13969d[_0x43c7('0x1f')]=_0x6227ae;if(_0x489cd3[_0x43c7('0x2c')][_0x43c7('0x3f')]){_0x527f74[_0x43c7('0x40')]=[{'all':!![]}];}return db[_0x43c7('0x4e')][_0x43c7('0x41')](_0x527f74);})[_0x43c7('0x3e')](function(_0x24329d){_0x13969d[_0x43c7('0x42')]=_0x24329d;return _0x13969d;});}})[_0x43c7('0x3e')](respondWithFilteredResult(_0x410d6f,_0x527f74))[_0x43c7('0x43')](handleError(_0x410d6f,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 67a76a0..5249c1e 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 _0xeff8=['rimraf','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport','lodash','util','api','moment','bluebird','path'];(function(_0x41a073,_0x3ea9e2){var _0x4b2c53=function(_0xa609ae){while(--_0xa609ae){_0x41a073['push'](_0x41a073['shift']());}};_0x4b2c53(++_0x3ea9e2);}(_0xeff8,0x186));var _0x8eff=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xeff8[_0x5d4607];return _0x5e4a86;};'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'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fb4=['./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x4fb4,0x190));var _0x44fb=function(_0x27d21a,_0x58da12){_0x27d21a=_0x27d21a-0x0;var _0xacb81e=_0x4fb4[_0x27d21a];return _0xacb81e;};'use strict';var _=require('lodash');var util=require(_0x44fb('0x0'));var logger=require(_0x44fb('0x1'))(_0x44fb('0x2'));var moment=require(_0x44fb('0x3'));var BPromise=require(_0x44fb('0x4'));var rp=require(_0x44fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44fb('0x6'));var config=require(_0x44fb('0x7'));var attributes=require(_0x44fb('0x8'));module[_0x44fb('0x9')]=function(_0x375d33,_0x173e70){return _0x375d33[_0x44fb('0xa')](_0x44fb('0xb'),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 b67136f..e4568df 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x132d3e,_0x39ba94){var _0x3938e4=function(_0x3d9fc5){while(--_0x3d9fc5){_0x132d3e['push'](_0x132d3e['shift']());}};_0x3938e4(++_0x39ba94);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3e4946,_0x3deebe){_0x3e4946=_0x3e4946-0x0;var _0x19fd97=_0x5f2f[_0x3e4946];return _0x19fd97;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x2fc27a,_0x24707b){var _0x4cfbf7=function(_0x2a3ba9){while(--_0x2a3ba9){_0x2fc27a['push'](_0x2fc27a['shift']());}};_0x4cfbf7(++_0x24707b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 91209a3..6f59c20 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 _0x8c79=['multer','express','fs-extra','../../components/auth/service','../../config/environment','put','isAuthenticated','update'];(function(_0x4db1ad,_0x50bb00){var _0x5b5146=function(_0x2835a2){while(--_0x2835a2){_0x4db1ad['push'](_0x4db1ad['shift']());}};_0x5b5146(++_0x50bb00);}(_0x8c79,0xa8));var _0x98c7=function(_0x490d4c,_0x50eb76){_0x490d4c=_0x490d4c-0x0;var _0x540b78=_0x8c79[_0x490d4c];return _0x540b78;};'use strict';var multer=require(_0x98c7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x98c7('0x1'));var router=express['Router']();var fs_extra=require(_0x98c7('0x2'));var auth=require(_0x98c7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x98c7('0x4'));var controller=require('./license.controller');router['get']('/',controller['index']);router[_0x98c7('0x5')]('/:id',auth[_0x98c7('0x6')](),controller[_0x98c7('0x7')]);module['exports']=router; \ No newline at end of file +var _0x83f7=['get','index','put','/:id','update','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x22589f,_0x3f33b7){var _0x4b1e54=function(_0x301401){while(--_0x301401){_0x22589f['push'](_0x22589f['shift']());}};_0x4b1e54(++_0x3f33b7);}(_0x83f7,0x84));var _0x783f=function(_0x17e2ef,_0x5df294){_0x17e2ef=_0x17e2ef-0x0;var _0x2f9f72=_0x83f7[_0x17e2ef];return _0x2f9f72;};'use strict';var multer=require(_0x783f('0x0'));var util=require(_0x783f('0x1'));var path=require(_0x783f('0x2'));var timeout=require('connect-timeout');var express=require(_0x783f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x783f('0x4'));var interaction=require(_0x783f('0x5'));var config=require(_0x783f('0x6'));var controller=require(_0x783f('0x7'));router[_0x783f('0x8')]('/',controller[_0x783f('0x9')]);router[_0x783f('0xa')](_0x783f('0xb'),auth['isAuthenticated'](),controller[_0x783f('0xc')]);module[_0x783f('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index a20c021..dbad12b 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 _0xa3b4=['exports','STRING','sequelize'];(function(_0x121b1a,_0x42fdb7){var _0x2d89a6=function(_0x1b6027){while(--_0x1b6027){_0x121b1a['push'](_0x121b1a['shift']());}};_0x2d89a6(++_0x42fdb7);}(_0xa3b4,0x170));var _0x4a3b=function(_0x1a7c48,_0x210f69){_0x1a7c48=_0x1a7c48-0x0;var _0x14fe0e=_0xa3b4[_0x1a7c48];return _0x14fe0e;};'use strict';var Sequelize=require(_0x4a3b('0x0'));module[_0x4a3b('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x4a3b('0x2')]},'data2':{'type':Sequelize[_0x4a3b('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb2d5=['exports','TEXT','STRING','sequelize'];(function(_0x33bc4d,_0x1f8422){var _0x17e63a=function(_0x264307){while(--_0x264307){_0x33bc4d['push'](_0x33bc4d['shift']());}};_0x17e63a(++_0x1f8422);}(_0xb2d5,0x7f));var _0x5b2d=function(_0x3f7edd,_0x815234){_0x3f7edd=_0x3f7edd-0x0;var _0xcf22e2=_0xb2d5[_0x3f7edd];return _0xcf22e2;};'use strict';var Sequelize=require(_0x5b2d('0x0'));module[_0x5b2d('0x1')]={'license':{'type':Sequelize[_0x5b2d('0x2')]},'data1':{'type':Sequelize[_0x5b2d('0x3')]},'data2':{'type':Sequelize['STRING']},'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 19b3cce..086dd6a 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 _0xf494=['fields','length','merge','options','getLicense','body','License','find','params','get','key','demo','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','../../config/license/util','index','model','rawAttributes','query','keys','filters','intersection','attributes'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xf494,0x1c6));var _0x4f49=function(_0x1e00ef,_0xb693c0){_0x1e00ef=_0x1e00ef-0x0;var _0x4142c9=_0xf494[_0x1e00ef];return _0x4142c9;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xa'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x18'))['db'];function respondWithStatusCode(_0x12527d,_0x4bf89f){_0x4bf89f=_0x4bf89f||0xcc;return function(_0x1e1c37){if(_0x1e1c37){return _0x12527d[_0x4f49('0x19')](_0x4bf89f);}return _0x12527d[_0x4f49('0x1a')](_0x4bf89f)[_0x4f49('0x1b')]();};}function respondWithResult(_0x1a0f1e,_0x2f0131){_0x2f0131=_0x2f0131||0xc8;return function(_0xfdb477){if(_0xfdb477){return _0x1a0f1e['status'](_0x2f0131)[_0x4f49('0x1c')](_0xfdb477);}};}function respondWithFilteredResult(_0x1f2d0d,_0x415e83){return function(_0x5878f4){if(_0x5878f4){var _0x5bdfaf=typeof _0x415e83[_0x4f49('0x1d')]===_0x4f49('0x1e')&&typeof _0x415e83[_0x4f49('0x1f')]==='undefined';var _0x1dccfd=_0x5878f4[_0x4f49('0x20')];var _0x4e85df=_0x5bdfaf?0x0:_0x415e83['offset'];var _0x5bb23b=_0x5bdfaf?_0x5878f4['count']:_0x415e83['offset']+_0x415e83[_0x4f49('0x1f')];var _0x1834f4;if(_0x5bb23b>=_0x1dccfd){_0x5bb23b=_0x1dccfd;_0x1834f4=0xc8;}else{_0x1834f4=0xce;}_0x1f2d0d[_0x4f49('0x1a')](_0x1834f4);return _0x1f2d0d[_0x4f49('0x21')]('Content-Range',_0x4e85df+'-'+_0x5bb23b+'/'+_0x1dccfd)[_0x4f49('0x1c')](_0x5878f4);}return null;};}function patchUpdates(_0x2aed27){return function(_0x197a49){try{jsonpatch[_0x4f49('0x22')](_0x197a49,_0x2aed27,!![]);}catch(_0xea82f8){return BPromise['reject'](_0xea82f8);}return _0x197a49[_0x4f49('0x23')]();};}function saveUpdates(_0x357446,_0x3ae590){return function(_0x53b57d){if(_0x53b57d){return _0x53b57d[_0x4f49('0x24')](_0x357446)[_0x4f49('0x25')](function(_0x32ca7b){return _0x32ca7b;});}return null;};}function removeEntity(_0x43c458,_0x9d30aa){return function(_0x36187b){if(_0x36187b){return _0x36187b['destroy']()['then'](function(){_0x43c458[_0x4f49('0x1a')](0xcc)[_0x4f49('0x1b')]();});}};}function handleEntityNotFound(_0x4fedbb,_0x408552){return function(_0x2c1519){if(!_0x2c1519){_0x4fedbb[_0x4f49('0x19')](0x194);}return _0x2c1519;};}function handleError(_0x525950,_0xc54070){_0xc54070=_0xc54070||0x1f4;return function(_0x2eed1c){logger[_0x4f49('0x26')](_0x2eed1c[_0x4f49('0x27')]);if(_0x2eed1c[_0x4f49('0x28')]){delete _0x2eed1c[_0x4f49('0x28')];}_0x525950['status'](_0xc54070)['send'](_0x2eed1c);};}var utilLicense=require(_0x4f49('0x29'));exports[_0x4f49('0x2a')]=function(_0x605c91,_0x560050){var _0x3cbfbd={'raw':!![],'where':{'id':0x1}},_0x206203={};_0x206203[_0x4f49('0x2b')]=_['keys'](db['License'][_0x4f49('0x2c')]);_0x206203[_0x4f49('0x2d')]=_[_0x4f49('0x2e')](_0x605c91['query']);_0x206203[_0x4f49('0x2f')]=_[_0x4f49('0x30')](_0x206203[_0x4f49('0x2b')],_0x206203[_0x4f49('0x2d')]);_0x3cbfbd[_0x4f49('0x31')]=_[_0x4f49('0x30')](_0x206203[_0x4f49('0x2b')],qs[_0x4f49('0x32')](_0x605c91[_0x4f49('0x2d')][_0x4f49('0x32')]));_0x3cbfbd[_0x4f49('0x31')]=_0x3cbfbd[_0x4f49('0x31')][_0x4f49('0x33')]?_0x3cbfbd[_0x4f49('0x31')]:_0x206203[_0x4f49('0x2b')];_0x3cbfbd=_[_0x4f49('0x34')]({},_0x3cbfbd,_0x605c91[_0x4f49('0x35')]);return utilLicense[_0x4f49('0x36')](_0x3cbfbd)[_0x4f49('0x25')](respondWithResult(_0x560050,null))['catch'](handleError(_0x560050,null));};exports[_0x4f49('0x24')]=function(_0x46b7ba,_0x24f568){if(_0x46b7ba[_0x4f49('0x37')]['id']){delete _0x46b7ba[_0x4f49('0x37')]['id'];}return db[_0x4f49('0x38')][_0x4f49('0x39')]({'where':{'id':_0x46b7ba[_0x4f49('0x3a')]['id']}})[_0x4f49('0x25')](handleEntityNotFound(_0x24f568,null))[_0x4f49('0x25')](function(_0x44e6a0){var _0x343365=_0x44e6a0[_0x4f49('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x343365,_0x46b7ba[_0x4f49('0x37')][_0x4f49('0x3c')]);})[_0x4f49('0x25')](function(_0x26014f){if(!_0x26014f[_0x4f49('0x3d')]){return saveUpdates(_0x46b7ba[_0x4f49('0x37')],null);}return _0x26014f;})[_0x4f49('0x25')](respondWithResult(_0x24f568,null))[_0x4f49('0x3e')](handleError(_0x24f568,null));}; \ No newline at end of file +var _0x57ca=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','apply','save','update','then','destroy','end','sendStatus','error','stack','name','model','keys','License','query','intersection','fields','attributes','merge','options','getLicense','catch','body','find','get','checkLicense','key','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57ca,0x108));var _0xa57c=function(_0x2735bd,_0x2d5bba){_0x2735bd=_0x2735bd-0x0;var _0x5f19b6=_0x57ca[_0x2735bd];return _0x5f19b6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa57c('0x0'));var zipdir=require(_0xa57c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var BPromise=require(_0xa57c('0x4'));var Mustache=require(_0xa57c('0x5'));var util=require(_0xa57c('0x6'));var path=require('path');var sox=require(_0xa57c('0x7'));var csv=require(_0xa57c('0x8'));var ejs=require(_0xa57c('0x9'));var fs=require('fs');var fs_extra=require(_0xa57c('0xa'));var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x8'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa57c('0x15'));var db=require(_0xa57c('0x16'))['db'];function respondWithStatusCode(_0x1f2bb5,_0x9e25bf){_0x9e25bf=_0x9e25bf||0xcc;return function(_0x205e72){if(_0x205e72){return _0x1f2bb5['sendStatus'](_0x9e25bf);}return _0x1f2bb5[_0xa57c('0x17')](_0x9e25bf)['end']();};}function respondWithResult(_0x30d23d,_0x3d5995){_0x3d5995=_0x3d5995||0xc8;return function(_0x30940d){if(_0x30940d){return _0x30d23d[_0xa57c('0x17')](_0x3d5995)[_0xa57c('0x18')](_0x30940d);}};}function respondWithFilteredResult(_0x37a323,_0x3f900a){return function(_0x4b4bdb){if(_0x4b4bdb){var _0x26607a=typeof _0x3f900a[_0xa57c('0x19')]===_0xa57c('0x1a')&&typeof _0x3f900a['limit']===_0xa57c('0x1a');var _0x5f33f1=_0x4b4bdb[_0xa57c('0x1b')];var _0x3d781d=_0x26607a?0x0:_0x3f900a[_0xa57c('0x19')];var _0xe3d505=_0x26607a?_0x4b4bdb[_0xa57c('0x1b')]:_0x3f900a[_0xa57c('0x19')]+_0x3f900a[_0xa57c('0x1c')];var _0x595c7a;if(_0xe3d505>=_0x5f33f1){_0xe3d505=_0x5f33f1;_0x595c7a=0xc8;}else{_0x595c7a=0xce;}_0x37a323['status'](_0x595c7a);return _0x37a323[_0xa57c('0x1d')]('Content-Range',_0x3d781d+'-'+_0xe3d505+'/'+_0x5f33f1)['json'](_0x4b4bdb);}return null;};}function patchUpdates(_0x418415){return function(_0xa5b314){try{jsonpatch[_0xa57c('0x1e')](_0xa5b314,_0x418415,!![]);}catch(_0x23bec0){return BPromise['reject'](_0x23bec0);}return _0xa5b314[_0xa57c('0x1f')]();};}function saveUpdates(_0x25715f,_0x34d1bc){return function(_0x2213b2){if(_0x2213b2){return _0x2213b2[_0xa57c('0x20')](_0x25715f)[_0xa57c('0x21')](function(_0x1e0192){return _0x1e0192;});}return null;};}function removeEntity(_0x42038e,_0x2e99ed){return function(_0xdf65dd){if(_0xdf65dd){return _0xdf65dd[_0xa57c('0x22')]()[_0xa57c('0x21')](function(){_0x42038e[_0xa57c('0x17')](0xcc)[_0xa57c('0x23')]();});}};}function handleEntityNotFound(_0x431bec,_0x511a26){return function(_0x2db443){if(!_0x2db443){_0x431bec[_0xa57c('0x24')](0x194);}return _0x2db443;};}function handleError(_0x27884d,_0x5228b9){_0x5228b9=_0x5228b9||0x1f4;return function(_0x315ad7){logger[_0xa57c('0x25')](_0x315ad7[_0xa57c('0x26')]);if(_0x315ad7[_0xa57c('0x27')]){delete _0x315ad7[_0xa57c('0x27')];}_0x27884d[_0xa57c('0x17')](_0x5228b9)['send'](_0x315ad7);};}var utilLicense=require(_0xa57c('0x15'));exports['index']=function(_0x54a18b,_0x257661){var _0x7d10ec={'raw':!![],'where':{'id':0x1}},_0x5a3e03={};_0x5a3e03[_0xa57c('0x28')]=_[_0xa57c('0x29')](db[_0xa57c('0x2a')]['rawAttributes']);_0x5a3e03[_0xa57c('0x2b')]=_['keys'](_0x54a18b[_0xa57c('0x2b')]);_0x5a3e03['filters']=_[_0xa57c('0x2c')](_0x5a3e03['model'],_0x5a3e03[_0xa57c('0x2b')]);_0x7d10ec['attributes']=_[_0xa57c('0x2c')](_0x5a3e03[_0xa57c('0x28')],qs[_0xa57c('0x2d')](_0x54a18b[_0xa57c('0x2b')][_0xa57c('0x2d')]));_0x7d10ec[_0xa57c('0x2e')]=_0x7d10ec[_0xa57c('0x2e')]['length']?_0x7d10ec[_0xa57c('0x2e')]:_0x5a3e03['model'];_0x7d10ec=_[_0xa57c('0x2f')]({},_0x7d10ec,_0x54a18b[_0xa57c('0x30')]);return utilLicense[_0xa57c('0x31')](_0x7d10ec)['then'](respondWithResult(_0x257661,null))[_0xa57c('0x32')](handleError(_0x257661,null));};exports['update']=function(_0x24a087,_0x501a4c){if(_0x24a087[_0xa57c('0x33')]['id']){delete _0x24a087['body']['id'];}return db[_0xa57c('0x2a')][_0xa57c('0x34')]({'where':{'id':_0x24a087['params']['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x501a4c,null))['then'](function(_0x1eeeb8){var _0x5c56d3=_0x1eeeb8[_0xa57c('0x35')]({'plain':!![]});return utilLicense[_0xa57c('0x36')](_0x5c56d3,_0x24a087[_0xa57c('0x33')][_0xa57c('0x37')]);})[_0xa57c('0x21')](function(_0x44350f){if(!_0x44350f['demo']){return saveUpdates(_0x24a087['body'],null);}return _0x44350f;})[_0xa57c('0x21')](respondWithResult(_0x501a4c,null))[_0xa57c('0x32')](handleError(_0x501a4c,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 2eb112d..21306ce 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 _0xe926=['license','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./license.attributes','exports','License'];(function(_0xe4dbae,_0x31099c){var _0x3cabed=function(_0xf9bf76){while(--_0xf9bf76){_0xe4dbae['push'](_0xe4dbae['shift']());}};_0x3cabed(++_0x31099c);}(_0xe926,0x17a));var _0x6e92=function(_0x2ade6c,_0x2d42f2){_0x2ade6c=_0x2ade6c-0x0;var _0x2cb372=_0xe926[_0x2ade6c];return _0x2cb372;};'use strict';var _=require(_0x6e92('0x0'));var util=require(_0x6e92('0x1'));var logger=require(_0x6e92('0x2'))(_0x6e92('0x3'));var moment=require(_0x6e92('0x4'));var BPromise=require(_0x6e92('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e92('0x6'));var rimraf=require(_0x6e92('0x7'));var config=require(_0x6e92('0x8'));var attributes=require(_0x6e92('0x9'));module[_0x6e92('0xa')]=function(_0x4fd0a0,_0x3f7c0c){return _0x4fd0a0['define'](_0x6e92('0xb'),attributes,{'tableName':_0x6e92('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd199=['license','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./license.attributes','exports','define','License'];(function(_0x1542cd,_0x1bb4f7){var _0x3f80ea=function(_0x153f5d){while(--_0x153f5d){_0x1542cd['push'](_0x1542cd['shift']());}};_0x3f80ea(++_0x1bb4f7);}(_0xd199,0x6d));var _0x9d19=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd199[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9d19('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9d19('0x1'));var moment=require(_0x9d19('0x2'));var BPromise=require(_0x9d19('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d19('0x4'));var rimraf=require(_0x9d19('0x5'));var config=require(_0x9d19('0x6'));var attributes=require(_0x9d19('0x7'));module[_0x9d19('0x8')]=function(_0x3f4aa9,_0x20f2ef){return _0x3f4aa9[_0x9d19('0x9')](_0x9d19('0xa'),attributes,{'tableName':_0x9d19('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index e883b83..cb2b4bc 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 _0x8fa5=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x15cbce,_0xda8402){var _0x257f29=function(_0x388132){while(--_0x388132){_0x15cbce['push'](_0x15cbce['shift']());}};_0x257f29(++_0xda8402);}(_0x8fa5,0x141));var _0x58fa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8fa5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x58fa('0x0'));var util=require('util');var moment=require(_0x58fa('0x1'));var BPromise=require(_0x58fa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x58fa('0x3'));var db=require(_0x58fa('0x4'))['db'];var utils=require(_0x58fa('0x5'));var logger=require(_0x58fa('0x6'))(_0x58fa('0x7'));var config=require(_0x58fa('0x8'));var jayson=require(_0x58fa('0x9'));var client=jayson[_0x58fa('0xa')][_0x58fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fa2c8,_0x526b92,_0x32975c){return new BPromise(function(_0x43a731,_0x3cd7ae){return client['request'](_0x2fa2c8,_0x32975c)[_0x58fa('0xc')](function(_0x317796){logger[_0x58fa('0xd')](_0x58fa('0xe'),_0x526b92,_0x58fa('0xf'));logger[_0x58fa('0x10')](_0x58fa('0x11'),_0x526b92,_0x58fa('0xf'),JSON[_0x58fa('0x12')](_0x317796));if(_0x317796[_0x58fa('0x13')]){if(_0x317796[_0x58fa('0x13')][_0x58fa('0x14')]===0x1f4){logger[_0x58fa('0x13')]('License,\x20%s,\x20%s',_0x526b92,_0x317796[_0x58fa('0x13')][_0x58fa('0x15')]);return _0x3cd7ae(_0x317796[_0x58fa('0x13')][_0x58fa('0x15')]);}logger[_0x58fa('0x13')](_0x58fa('0xe'),_0x526b92,_0x317796[_0x58fa('0x13')][_0x58fa('0x15')]);return _0x43a731(_0x317796['error'][_0x58fa('0x15')]);}else{logger[_0x58fa('0xd')](_0x58fa('0xe'),_0x526b92,_0x58fa('0xf'));_0x43a731(_0x317796[_0x58fa('0x16')]['message']);}})['catch'](function(_0x55bc96){logger['error'](_0x58fa('0xe'),_0x526b92,_0x55bc96);_0x3cd7ae(_0x55bc96);});});} \ No newline at end of file +var _0x103e=['rpc','jayson/promise','client','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','ioredis','../../config/logger'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0x103e,0x177));var _0xe103=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x103e[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xe103('0x0'));var util=require('util');var moment=require(_0xe103('0x1'));var BPromise=require('bluebird');var rs=require(_0xe103('0x2'));var fs=require('fs');var Redis=require(_0xe103('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe103('0x4'))(_0xe103('0x5'));var config=require('../../config/environment');var jayson=require(_0xe103('0x6'));var client=jayson[_0xe103('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39d2e7,_0x3a95a4,_0x300957){return new BPromise(function(_0x3c0db2,_0x191fd6){return client[_0xe103('0x8')](_0x39d2e7,_0x300957)[_0xe103('0x9')](function(_0x584dea){logger[_0xe103('0xa')](_0xe103('0xb'),_0x3a95a4,_0xe103('0xc'));logger[_0xe103('0xd')](_0xe103('0xe'),_0x3a95a4,_0xe103('0xc'),JSON[_0xe103('0xf')](_0x584dea));if(_0x584dea[_0xe103('0x10')]){if(_0x584dea[_0xe103('0x10')][_0xe103('0x11')]===0x1f4){logger['error'](_0xe103('0xb'),_0x3a95a4,_0x584dea[_0xe103('0x10')][_0xe103('0x12')]);return _0x191fd6(_0x584dea[_0xe103('0x10')][_0xe103('0x12')]);}logger[_0xe103('0x10')](_0xe103('0xb'),_0x3a95a4,_0x584dea['error'][_0xe103('0x12')]);return _0x3c0db2(_0x584dea[_0xe103('0x10')][_0xe103('0x12')]);}else{logger[_0xe103('0xa')](_0xe103('0xb'),_0x3a95a4,_0xe103('0xc'));_0x3c0db2(_0x584dea['result']['message']);}})[_0xe103('0x13')](function(_0x162bef){logger['error'](_0xe103('0xb'),_0x3a95a4,_0x162bef);_0x191fd6(_0x162bef);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 46c980c..2960118 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 _0xf8b5=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','/:id/users','getAgents','post','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','update','delete','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util'];(function(_0x20d21c,_0x55672a){var _0x266803=function(_0x4736c0){while(--_0x4736c0){_0x20d21c['push'](_0x20d21c['shift']());}};_0x266803(++_0x55672a);}(_0xf8b5,0x18a));var _0x5f8b=function(_0x36c44c,_0x4d7903){_0x36c44c=_0x36c44c-0x0;var _0x5b3d18=_0xf8b5[_0x36c44c];return _0x5b3d18;};'use strict';var multer=require(_0x5f8b('0x0'));var util=require(_0x5f8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5f8b('0x2'));var router=express['Router']();var fs_extra=require(_0x5f8b('0x3'));var auth=require(_0x5f8b('0x4'));var interaction=require(_0x5f8b('0x5'));var config=require(_0x5f8b('0x6'));var controller=require('./mailAccount.controller');router[_0x5f8b('0x7')]('/',auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x9')]);router['get']('/describe',auth[_0x5f8b('0x8')](),controller[_0x5f8b('0xa')]);router[_0x5f8b('0x7')](_0x5f8b('0xb'),auth[_0x5f8b('0x8')](),controller[_0x5f8b('0xc')]);router[_0x5f8b('0x7')]('/:id/dispositions',auth[_0x5f8b('0x8')](),controller[_0x5f8b('0xd')]);router['get'](_0x5f8b('0xe'),auth[_0x5f8b('0x8')](),controller['getAnswers']);router['get'](_0x5f8b('0xf'),auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x10')]);router[_0x5f8b('0x7')](_0x5f8b('0x11'),auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x12')]);router[_0x5f8b('0x7')](_0x5f8b('0x13'),auth['isAuthenticated'](),controller[_0x5f8b('0x14')]);router[_0x5f8b('0x7')](_0x5f8b('0x15'),auth['isAuthenticated'](),controller[_0x5f8b('0x16')]);router[_0x5f8b('0x7')]('/:id/messages',auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x17')]);router[_0x5f8b('0x7')](_0x5f8b('0x18'),auth[_0x5f8b('0x8')](),controller['verifySmtp']);router[_0x5f8b('0x7')](_0x5f8b('0x19'),auth['isAuthenticated'](),controller[_0x5f8b('0x1a')]);router[_0x5f8b('0x1b')]('/:id/dispositions',auth['isAuthenticated'](),controller['addDisposition']);router[_0x5f8b('0x1b')]('/:id/canned_answers',auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x1c')]);router[_0x5f8b('0x1b')]('/',auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x1d')]);router['post'](_0x5f8b('0xf'),auth['isAuthenticated'](),controller[_0x5f8b('0x1e')]);router[_0x5f8b('0x1b')](_0x5f8b('0x11'),auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x1f')]);router[_0x5f8b('0x1b')]('/:id/interactions',auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x20')]);router[_0x5f8b('0x1b')](_0x5f8b('0x15'),auth['isAuthenticated'](),controller[_0x5f8b('0x21')]);router[_0x5f8b('0x1b')](_0x5f8b('0x22'),auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x23')]);router['post'](_0x5f8b('0x19'),auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x24')]);router['put'](_0x5f8b('0xb'),auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x25')]);router[_0x5f8b('0x26')]('/:id/dispositions',auth[_0x5f8b('0x8')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x5f8b('0x8')](),controller['removeAnswers']);router['delete'](_0x5f8b('0xf'),auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x27')]);router[_0x5f8b('0x26')](_0x5f8b('0x11'),auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x28')]);router[_0x5f8b('0x26')](_0x5f8b('0xb'),auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x29')]);router[_0x5f8b('0x26')](_0x5f8b('0x19'),auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x2a')]);module[_0x5f8b('0x2b')]=router; \ No newline at end of file +var _0x1ca9=['/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','create','addImap','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','/:id/canned_answers','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./mailAccount.controller','isAuthenticated','index','/describe','describe','get','/:id','show','getDispositions','getAnswers'];(function(_0xc9830f,_0x5b9f13){var _0x154f73=function(_0x11872a){while(--_0x11872a){_0xc9830f['push'](_0xc9830f['shift']());}};_0x154f73(++_0x5b9f13);}(_0x1ca9,0xe9));var _0x91ca=function(_0x1d5ecd,_0x5b293c){_0x1d5ecd=_0x1d5ecd-0x0;var _0x37925c=_0x1ca9[_0x1d5ecd];return _0x37925c;};'use strict';var multer=require(_0x91ca('0x0'));var util=require(_0x91ca('0x1'));var path=require(_0x91ca('0x2'));var timeout=require(_0x91ca('0x3'));var express=require(_0x91ca('0x4'));var router=express[_0x91ca('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x91ca('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x91ca('0x7'));router['get']('/',auth[_0x91ca('0x8')](),controller[_0x91ca('0x9')]);router['get'](_0x91ca('0xa'),auth[_0x91ca('0x8')](),controller[_0x91ca('0xb')]);router[_0x91ca('0xc')](_0x91ca('0xd'),auth[_0x91ca('0x8')](),controller[_0x91ca('0xe')]);router[_0x91ca('0xc')]('/:id/dispositions',auth[_0x91ca('0x8')](),controller[_0x91ca('0xf')]);router[_0x91ca('0xc')]('/:id/canned_answers',auth[_0x91ca('0x8')](),controller[_0x91ca('0x10')]);router[_0x91ca('0xc')](_0x91ca('0x11'),auth[_0x91ca('0x8')](),controller[_0x91ca('0x12')]);router['get'](_0x91ca('0x13'),auth[_0x91ca('0x8')](),controller[_0x91ca('0x14')]);router[_0x91ca('0xc')]('/:id/interactions',auth[_0x91ca('0x8')](),controller['getInteractions']);router[_0x91ca('0xc')](_0x91ca('0x15'),auth['isAuthenticated'](),controller[_0x91ca('0x16')]);router[_0x91ca('0xc')](_0x91ca('0x17'),auth[_0x91ca('0x8')](),controller[_0x91ca('0x18')]);router[_0x91ca('0xc')](_0x91ca('0x19'),auth[_0x91ca('0x8')](),controller[_0x91ca('0x1a')]);router[_0x91ca('0xc')](_0x91ca('0x1b'),auth[_0x91ca('0x8')](),controller[_0x91ca('0x1c')]);router[_0x91ca('0x1d')](_0x91ca('0x1e'),auth[_0x91ca('0x8')](),controller[_0x91ca('0x1f')]);router[_0x91ca('0x1d')]('/:id/canned_answers',auth[_0x91ca('0x8')](),controller[_0x91ca('0x20')]);router[_0x91ca('0x1d')]('/',auth['isAuthenticated'](),controller[_0x91ca('0x21')]);router[_0x91ca('0x1d')](_0x91ca('0x11'),auth[_0x91ca('0x8')](),controller[_0x91ca('0x22')]);router[_0x91ca('0x1d')](_0x91ca('0x13'),auth[_0x91ca('0x8')](),controller[_0x91ca('0x23')]);router[_0x91ca('0x1d')](_0x91ca('0x24'),auth[_0x91ca('0x8')](),controller[_0x91ca('0x25')]);router[_0x91ca('0x1d')]('/:id/applications',auth['isAuthenticated'](),controller[_0x91ca('0x26')]);router['post'](_0x91ca('0x27'),auth[_0x91ca('0x8')](),controller[_0x91ca('0x28')]);router[_0x91ca('0x1d')](_0x91ca('0x1b'),auth[_0x91ca('0x8')](),controller[_0x91ca('0x29')]);router[_0x91ca('0x2a')](_0x91ca('0xd'),auth[_0x91ca('0x8')](),controller[_0x91ca('0x2b')]);router[_0x91ca('0x2c')](_0x91ca('0x1e'),auth[_0x91ca('0x8')](),controller[_0x91ca('0x2d')]);router[_0x91ca('0x2c')](_0x91ca('0x2e'),auth[_0x91ca('0x8')](),controller['removeAnswers']);router[_0x91ca('0x2c')](_0x91ca('0x11'),auth['isAuthenticated'](),controller['removeImap']);router[_0x91ca('0x2c')](_0x91ca('0x13'),auth[_0x91ca('0x8')](),controller['removeSmtp']);router[_0x91ca('0x2c')](_0x91ca('0xd'),auth[_0x91ca('0x8')](),controller[_0x91ca('0x2f')]);router[_0x91ca('0x2c')](_0x91ca('0x1b'),auth[_0x91ca('0x8')](),controller[_0x91ca('0x30')]);module[_0x91ca('0x31')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index da24fc9..aa2ede3 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 _0x7d86=['setDataValue','mandatoryDispositionPauseId','sequelize','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'];(function(_0x1c422d,_0x2b4a40){var _0x384bc0=function(_0x4109a2){while(--_0x4109a2){_0x1c422d['push'](_0x1c422d['shift']());}};_0x384bc0(++_0x2b4a40);}(_0x7d86,0x86));var _0x67d8=function(_0xb0372f,_0x2df789){_0xb0372f=_0xb0372f-0x0;var _0x55f98f=_0x7d86[_0xb0372f];return _0x55f98f;};'use strict';var Sequelize=require(_0x67d8('0x0'));module['exports']={'description':{'type':Sequelize[_0x67d8('0x1')]},'name':{'type':Sequelize[_0x67d8('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x67d8('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x67d8('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x67d8('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x67d8('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x67d8('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x67d8('0x1')],'allowNull':![],'defaultValue':_0x67d8('0x4')},'fontSize':{'type':Sequelize[_0x67d8('0x5')](0x2)[_0x67d8('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x67d8('0x3')],'defaultValue':function(){return _0x67d8('0x7');}},'notificationSound':{'type':Sequelize[_0x67d8('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x67d8('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x67d8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x67d8('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x67d8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x67d8('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x67d8('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x67d8('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x67d8('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x67d8('0x2')],'defaultValue':![],'comment':_0x67d8('0x9'),'set':function(_0x14d7be){if(!_0x14d7be)this[_0x67d8('0xa')](_0x67d8('0xb'),null);this[_0x67d8('0xa')]('mandatoryDisposition',_0x14d7be);}}}; \ No newline at end of file +var _0xdb94=['mandatoryDisposition','exports','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x47b4c5,_0x2cbafc){var _0x5b6292=function(_0x305568){while(--_0x305568){_0x47b4c5['push'](_0x47b4c5['shift']());}};_0x5b6292(++_0x2cbafc);}(_0xdb94,0xe5));var _0x4db9=function(_0xf2d80a,_0xf52d06){_0xf2d80a=_0xf2d80a-0x0;var _0x4ebc9e=_0xdb94[_0xf2d80a];return _0x4ebc9e;};'use strict';var Sequelize=require('sequelize');module[_0x4db9('0x0')]={'description':{'type':Sequelize[_0x4db9('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x4db9('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x4db9('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x4db9('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x4db9('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x4db9('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x4db9('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x4db9('0x4')](0x2)[_0x4db9('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x4db9('0x3')],'defaultValue':function(){return _0x4db9('0x6');}},'notificationSound':{'type':Sequelize[_0x4db9('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4db9('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4db9('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4db9('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4db9('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4db9('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x4db9('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x4db9('0x2')],'defaultValue':![],'comment':_0x4db9('0x8'),'set':function(_0xe6de11){if(!_0xe6de11)this[_0x4db9('0x9')](_0x4db9('0xa'),null);this['setDataValue'](_0x4db9('0xb'),_0xe6de11);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 331e0cf..8ad0930 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 _0xccaa=['setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','CmContact','Contact','User','Owner','Tag','Tags','color','tag','addApplications','sequelize','MailApplication','destroy','bulkCreate','priority','getApplications','getMessages','MailMessage','$gte','split','inlineCss','true','CmList','List','updatedAt','DESC','from','format','%s\x20<%s>','attachments','root','server/files/attachments','secure','auth','sendMail','Contacts','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','verifySmtp','VerifySmtp','ValidationError','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','zip-dir','moment','path','sox','to-csv','ejs','fs-extra','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','request','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','type','key','model','query','keys','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','MailServerIn','Imap','rawAttributes','intersection','find','body','params','Smtp','describe','addDisposition','Disposition','create','findOne','hasOwnProperty','MailAccountId','include','removeDispositions','ids','CannedAnswer','getAnswers','order','removeAnswers','email','ListId','isNil','active','cservice','cauthentication','user','cuser','cpassword','authentication','host','port','service','password','pass','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap'];(function(_0x52a601,_0x16c3ff){var _0x501fa4=function(_0x37c164){while(--_0x37c164){_0x52a601['push'](_0x52a601['shift']());}};_0x501fa4(++_0x16c3ff);}(_0xccaa,0x1c3));var _0xacca=function(_0x5e5d39,_0x45c2e9){_0x5e5d39=_0x5e5d39-0x0;var _0x499861=_0xccaa[_0x5e5d39];return _0x499861;};'use strict';var emlformat=require(_0xacca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xacca('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xacca('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xacca('0x3'));var sox=require(_0xacca('0x4'));var csv=require(_0xacca('0x5'));var ejs=require(_0xacca('0x6'));var fs=require('fs');var fs_extra=require(_0xacca('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xacca('0x8'));var jsforce=require(_0xacca('0x9'));var deskjs=require(_0xacca('0xa'));var toCsv=require(_0xacca('0x5'));var querystring=require(_0xacca('0xb'));var Papa=require(_0xacca('0xc'));var htmlToText=require(_0xacca('0xd'));var juice=require(_0xacca('0xe'));var Redis=require(_0xacca('0xf'));var authService=require(_0xacca('0x10'));var qs=require(_0xacca('0x11'));var as=require(_0xacca('0x12'));var hardwareService=require(_0xacca('0x13'));var logger=require(_0xacca('0x14'))('api');var utils=require(_0xacca('0x15'));var config=require(_0xacca('0x16'));var licenseUtil=require(_0xacca('0x17'));var db=require(_0xacca('0x18'))['db'];config[_0xacca('0x19')]=_[_0xacca('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xacca('0x1b'))(new Redis(config[_0xacca('0x19')]));require('./mailAccount.socket')[_0xacca('0x1c')](socket);var jayson=require(_0xacca('0x1d'));var client=jayson[_0xacca('0x1e')][_0xacca('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0xe9e6b1,_0x4c905d,_0x5b6949,_0x130883){return new BPromise(function(_0x373159,_0x94772f){var _0x56c82b=_0x130883||client;return _0x56c82b[_0xacca('0x20')](_0xe9e6b1,_0x5b6949)['then'](function(_0x32449e){logger[_0xacca('0x21')](_0xacca('0x22'),_0x4c905d,'request\x20sent');logger['debug'](_0xacca('0x23'),_0x4c905d,_0xacca('0x24'),JSON[_0xacca('0x25')](_0x32449e));if(_0x32449e[_0xacca('0x26')]){if(_0x32449e[_0xacca('0x26')][_0xacca('0x27')]===0x1f4){logger[_0xacca('0x26')](_0xacca('0x22'),_0x4c905d,_0x32449e['error'][_0xacca('0x28')]);return _0x94772f(_0x32449e[_0xacca('0x26')]['message']);}logger['error'](_0xacca('0x22'),_0x4c905d,_0x32449e[_0xacca('0x26')]['message']);return _0x373159(_0x32449e['error']['message']);}else{logger[_0xacca('0x21')](_0xacca('0x22'),_0x4c905d,_0xacca('0x24'));_0x373159(_0x32449e['result'][_0xacca('0x28')]);}})[_0xacca('0x29')](function(_0x190b87){logger[_0xacca('0x26')](_0xacca('0x22'),_0x4c905d,_0x190b87);_0x94772f(_0x190b87);});});}function respondWithStatusCode(_0x2762f9,_0x11df1d){_0x11df1d=_0x11df1d||0xcc;return function(_0x1afa63){if(_0x1afa63){return _0x2762f9[_0xacca('0x2a')](_0x11df1d);}return _0x2762f9[_0xacca('0x2b')](_0x11df1d)[_0xacca('0x2c')]();};}function respondWithResult(_0x68e1c6,_0x390319){_0x390319=_0x390319||0xc8;return function(_0x5415a2){if(_0x5415a2){return _0x68e1c6[_0xacca('0x2b')](_0x390319)['json'](_0x5415a2);}};}function respondWithFilteredResult(_0x4c0b60,_0x45869f){return function(_0x3cab7d){if(_0x3cab7d){var _0x5b3cf9=typeof _0x45869f[_0xacca('0x2d')]===_0xacca('0x2e')&&typeof _0x45869f['limit']===_0xacca('0x2e');var _0x2ef5a4=_0x3cab7d[_0xacca('0x2f')];var _0x5637b7=_0x5b3cf9?0x0:_0x45869f['offset'];var _0x48e13a=_0x5b3cf9?_0x3cab7d[_0xacca('0x2f')]:_0x45869f[_0xacca('0x2d')]+_0x45869f[_0xacca('0x30')];var _0x479e74;if(_0x48e13a>=_0x2ef5a4){_0x48e13a=_0x2ef5a4;_0x479e74=0xc8;}else{_0x479e74=0xce;}_0x4c0b60[_0xacca('0x2b')](_0x479e74);return _0x4c0b60[_0xacca('0x31')](_0xacca('0x32'),_0x5637b7+'-'+_0x48e13a+'/'+_0x2ef5a4)[_0xacca('0x33')](_0x3cab7d);}return null;};}function patchUpdates(_0x5ea8c5){return function(_0x5e657a){try{jsonpatch[_0xacca('0x34')](_0x5e657a,_0x5ea8c5,!![]);}catch(_0x15c3fa){return BPromise['reject'](_0x15c3fa);}return _0x5e657a[_0xacca('0x35')]();};}function saveUpdates(_0x57b4e8,_0x4f9a40){return function(_0x46dd32){if(_0x46dd32){return _0x46dd32[_0xacca('0x36')](_0x57b4e8)[_0xacca('0x37')](function(_0x19f9f3){return _0x19f9f3;});}return null;};}function removeEntity(_0x2fedfc,_0xfa293b){return function(_0xea7af0){if(_0xea7af0){return _0xea7af0['destroy']()['then'](function(){var _0x490e7d=_0xea7af0[_0xacca('0x38')]({'plain':!![]});var _0x4ce95c=_0xacca('0x39');return db[_0xacca('0x3a')]['destroy']({'where':{'type':_0x4ce95c,'resourceId':_0x490e7d['id']}})[_0xacca('0x37')](function(){return _0xea7af0;});})['then'](function(){_0x2fedfc[_0xacca('0x2b')](0xcc)[_0xacca('0x2c')]();});}};}function handleEntityNotFound(_0x6736ec,_0x4ed44b){return function(_0x4dd263){if(!_0x4dd263){_0x6736ec[_0xacca('0x2a')](0x194);}return _0x4dd263;};}function handleError(_0xd9db86,_0xc26697){_0xc26697=_0xc26697||0x1f4;return function(_0x45751d){logger[_0xacca('0x26')](_0x45751d[_0xacca('0x3b')]);if(_0x45751d[_0xacca('0x3c')]){delete _0x45751d[_0xacca('0x3c')];}_0xd9db86['status'](_0xc26697)[_0xacca('0x3d')](_0x45751d);};}exports[_0xacca('0x3e')]=function(_0x2d5084,_0x30e088){var _0x8a9640={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xacca('0x3f')],'as':'Smtp'},{'model':db[_0xacca('0x40')],'as':_0xacca('0x41')}]},_0x57d882={},_0xa1ef74={'count':0x0,'rows':[]};var _0x30ea7e=_[_0xacca('0x42')](db[_0xacca('0x43')]['rawAttributes'],function(_0x55d38e){return{'name':_0x55d38e['fieldName'],'type':_0x55d38e[_0xacca('0x44')][_0xacca('0x45')]};});_0x57d882[_0xacca('0x46')]=_[_0xacca('0x42')](_0x30ea7e,_0xacca('0x3c'));_0x57d882[_0xacca('0x47')]=_[_0xacca('0x48')](_0x2d5084['query']);_0x57d882['filters']=_['intersection'](_0x57d882[_0xacca('0x46')],_0x57d882[_0xacca('0x47')]);_0x8a9640['attributes']=_['intersection'](_0x57d882[_0xacca('0x46')],qs[_0xacca('0x49')](_0x2d5084['query'][_0xacca('0x49')]));_0x8a9640[_0xacca('0x4a')]=_0x8a9640[_0xacca('0x4a')][_0xacca('0x4b')]?_0x8a9640['attributes']:_0x57d882[_0xacca('0x46')];if(!_0x2d5084['query']['hasOwnProperty'](_0xacca('0x4c'))){_0x8a9640[_0xacca('0x30')]=qs[_0xacca('0x30')](_0x2d5084[_0xacca('0x47')][_0xacca('0x30')]);_0x8a9640['offset']=qs['offset'](_0x2d5084[_0xacca('0x47')][_0xacca('0x2d')]);}_0x8a9640['order']=qs[_0xacca('0x4d')](_0x2d5084[_0xacca('0x47')][_0xacca('0x4d')]);_0x8a9640[_0xacca('0x4e')]=qs[_0xacca('0x4f')](_[_0xacca('0x50')](_0x2d5084[_0xacca('0x47')],_0x57d882[_0xacca('0x4f')]),_0x30ea7e);if(_0x2d5084[_0xacca('0x47')][_0xacca('0x51')]){_0x8a9640[_0xacca('0x4e')]=_[_0xacca('0x52')](_0x8a9640[_0xacca('0x4e')],{'$or':_['map'](_0x30ea7e,function(_0x58dca3){if(_0x58dca3['type']!==_0xacca('0x53')){var _0x29f487={};_0x29f487[_0x58dca3[_0xacca('0x3c')]]={'$like':'%'+_0x2d5084['query'][_0xacca('0x51')]+'%'};return _0x29f487;}})});}_0x8a9640=_['merge']({},_0x8a9640,_0x2d5084[_0xacca('0x54')]);var _0x4de6fd={'where':_0x8a9640[_0xacca('0x4e')]};return db[_0xacca('0x43')][_0xacca('0x2f')](_0x4de6fd)[_0xacca('0x37')](function(_0x4714d8){_0xa1ef74[_0xacca('0x2f')]=_0x4714d8;if(_0x2d5084['query'][_0xacca('0x55')]){_0x8a9640['include']=[{'all':!![]}];}return db[_0xacca('0x43')][_0xacca('0x56')](_0x8a9640);})[_0xacca('0x37')](function(_0xc2be47){_0xa1ef74[_0xacca('0x57')]=_0xc2be47;return _0xa1ef74;})[_0xacca('0x37')](respondWithFilteredResult(_0x30e088,_0x8a9640))[_0xacca('0x29')](handleError(_0x30e088,null));};exports[_0xacca('0x58')]=function(_0x50a06b,_0x39ce25){var _0x2614bb={'raw':![],'where':{'id':_0x50a06b['params']['id']},'include':[{'model':db[_0xacca('0x59')],'as':_0xacca('0x5a')},{'model':db[_0xacca('0x3f')],'as':'Smtp'},{'model':db[_0xacca('0x40')],'as':_0xacca('0x41')}]},_0x3de7bf={};_0x3de7bf[_0xacca('0x46')]=_['keys'](db[_0xacca('0x43')][_0xacca('0x5b')]);_0x3de7bf[_0xacca('0x47')]=_[_0xacca('0x48')](_0x50a06b[_0xacca('0x47')]);_0x3de7bf[_0xacca('0x4f')]=_[_0xacca('0x5c')](_0x3de7bf[_0xacca('0x46')],_0x3de7bf[_0xacca('0x47')]);_0x2614bb[_0xacca('0x4a')]=_[_0xacca('0x5c')](_0x3de7bf[_0xacca('0x46')],qs[_0xacca('0x49')](_0x50a06b['query']['fields']));_0x2614bb[_0xacca('0x4a')]=_0x2614bb[_0xacca('0x4a')]['length']?_0x2614bb[_0xacca('0x4a')]:_0x3de7bf['model'];if(_0x50a06b[_0xacca('0x47')][_0xacca('0x55')]){_0x2614bb['include']=[{'all':!![]}];}_0x2614bb=_[_0xacca('0x52')]({},_0x2614bb,_0x50a06b[_0xacca('0x54')]);return db[_0xacca('0x43')][_0xacca('0x5d')](_0x2614bb)[_0xacca('0x37')](handleEntityNotFound(_0x39ce25,null))[_0xacca('0x37')](respondWithResult(_0x39ce25,null))[_0xacca('0x29')](handleError(_0x39ce25,null));};exports[_0xacca('0x36')]=function(_0x414f44,_0x324774){if(_0x414f44[_0xacca('0x5e')]['id']){delete _0x414f44[_0xacca('0x5e')]['id'];}return db[_0xacca('0x43')]['find']({'where':{'id':_0x414f44[_0xacca('0x5f')]['id']},'include':[{'model':db[_0xacca('0x59')],'as':_0xacca('0x5a')},{'model':db[_0xacca('0x3f')],'as':_0xacca('0x60')},{'model':db[_0xacca('0x40')],'as':_0xacca('0x41')}]})[_0xacca('0x37')](handleEntityNotFound(_0x324774,null))[_0xacca('0x37')](saveUpdates(_0x414f44[_0xacca('0x5e')],null))['then'](function(_0x291967){if(_0x291967&&_0x414f44[_0xacca('0x5e')][_0xacca('0x5a')]){return db[_0xacca('0x59')]['update'](_0x414f44[_0xacca('0x5e')][_0xacca('0x5a')],{'where':{'MailAccountId':_0x291967['id']}})[_0xacca('0x37')](function(){return _0x291967;});}return _0x291967;})[_0xacca('0x37')](function(_0x59ee02){if(_0x59ee02&&_0x414f44['body'][_0xacca('0x60')]){return db[_0xacca('0x3f')][_0xacca('0x36')](_0x414f44[_0xacca('0x5e')][_0xacca('0x60')],{'where':{'MailAccountId':_0x59ee02['id']}})['then'](function(){return _0x59ee02;});}return _0x59ee02;})[_0xacca('0x37')](respondWithResult(_0x324774,null))[_0xacca('0x29')](handleError(_0x324774,null));};exports[_0xacca('0x61')]=function(_0x3c645d,_0x2fff31){return db['MailAccount'][_0xacca('0x61')]()['then'](respondWithResult(_0x2fff31,null))['catch'](handleError(_0x2fff31,null));};exports[_0xacca('0x62')]=function(_0xeaf333,_0x54acc3,_0x40d20b){if(_0xeaf333[_0xacca('0x5e')]['id']){delete _0xeaf333[_0xacca('0x5e')]['id'];}return db[_0xacca('0x43')]['find']({'where':{'id':_0xeaf333[_0xacca('0x5f')]['id']}})['then'](handleEntityNotFound(_0x54acc3,null))[_0xacca('0x37')](function(_0x5222d6){if(_0x5222d6){_0xeaf333[_0xacca('0x5e')]['MailAccountId']=_0x5222d6['id'];return db[_0xacca('0x63')][_0xacca('0x64')](_0xeaf333[_0xacca('0x5e')]);}})['then'](respondWithResult(_0x54acc3,null))[_0xacca('0x29')](handleError(_0x54acc3,null));};exports['getDispositions']=function(_0x54a22c,_0x1f30b1,_0x52bbb8){var _0x48e65f={'raw':![],'where':{}};var _0x316f04={};var _0x4e9fd9={'count':0x0,'rows':[]};return db['MailAccount'][_0xacca('0x65')]({'where':{'id':_0x54a22c[_0xacca('0x5f')]['id']}})[_0xacca('0x37')](handleEntityNotFound(_0x1f30b1,null))[_0xacca('0x37')](function(_0x3c7931){if(_0x3c7931){_0x316f04[_0xacca('0x46')]=_[_0xacca('0x48')](db['Disposition'][_0xacca('0x5b')]);_0x316f04[_0xacca('0x47')]=_[_0xacca('0x48')](_0x54a22c[_0xacca('0x47')]);_0x316f04[_0xacca('0x4f')]=_['intersection'](_0x316f04[_0xacca('0x46')],_0x316f04[_0xacca('0x47')]);_0x48e65f[_0xacca('0x4a')]=_[_0xacca('0x5c')](_0x316f04[_0xacca('0x46')],qs['fields'](_0x54a22c[_0xacca('0x47')][_0xacca('0x49')]));_0x48e65f[_0xacca('0x4a')]=_0x48e65f['attributes'][_0xacca('0x4b')]?_0x48e65f[_0xacca('0x4a')]:_0x316f04['model'];if(!_0x54a22c[_0xacca('0x47')][_0xacca('0x66')]('nolimit')){_0x48e65f[_0xacca('0x30')]=qs[_0xacca('0x30')](_0x54a22c[_0xacca('0x47')]['limit']);_0x48e65f[_0xacca('0x2d')]=qs[_0xacca('0x2d')](_0x54a22c[_0xacca('0x47')][_0xacca('0x2d')]);}_0x48e65f['order']=qs[_0xacca('0x4d')](_0x54a22c[_0xacca('0x47')]['sort']);_0x48e65f['where']=qs[_0xacca('0x4f')](_[_0xacca('0x50')](_0x54a22c[_0xacca('0x47')],_0x316f04[_0xacca('0x4f')]));_0x48e65f[_0xacca('0x4e')][_0xacca('0x67')]=_0x3c7931['id'];if(_0x54a22c[_0xacca('0x47')][_0xacca('0x51')]){_0x48e65f[_0xacca('0x4e')]=_[_0xacca('0x52')](_0x48e65f['where'],{'$or':_[_0xacca('0x42')](_0x48e65f['attributes'],function(_0x23cc89){var _0x36d5c5={};_0x36d5c5[_0x23cc89]={'$like':'%'+_0x54a22c['query'][_0xacca('0x51')]+'%'};return _0x36d5c5;})});}_0x48e65f=_[_0xacca('0x52')]({},_0x48e65f,_0x54a22c[_0xacca('0x54')]);return db[_0xacca('0x63')][_0xacca('0x2f')]({'where':_0x48e65f[_0xacca('0x4e')]})['then'](function(_0x45964b){_0x4e9fd9[_0xacca('0x2f')]=_0x45964b;if(_0x54a22c[_0xacca('0x47')][_0xacca('0x55')]){_0x48e65f[_0xacca('0x68')]=[{'all':!![]}];}return db['Disposition'][_0xacca('0x56')](_0x48e65f);})[_0xacca('0x37')](function(_0x109727){_0x4e9fd9['rows']=_0x109727;return _0x4e9fd9;});}})[_0xacca('0x37')](respondWithFilteredResult(_0x1f30b1,_0x48e65f))[_0xacca('0x29')](handleError(_0x1f30b1,null));};exports[_0xacca('0x69')]=function(_0x99f254,_0x3c147f,_0x1bbe9d){return db['MailAccount'][_0xacca('0x5d')]({'where':{'id':_0x99f254[_0xacca('0x5f')]['id']}})[_0xacca('0x37')](handleEntityNotFound(_0x3c147f,null))[_0xacca('0x37')](function(_0x150979){if(_0x150979){return _0x150979[_0xacca('0x69')](_0x99f254[_0xacca('0x47')][_0xacca('0x6a')]);}})['then'](respondWithStatusCode(_0x3c147f,null))[_0xacca('0x29')](handleError(_0x3c147f,null));};exports['addAnswer']=function(_0x15906b,_0x267a26,_0x3c5abd){if(_0x15906b[_0xacca('0x5e')]['id']){delete _0x15906b['body']['id'];}return db['MailAccount'][_0xacca('0x5d')]({'where':{'id':_0x15906b[_0xacca('0x5f')]['id']}})[_0xacca('0x37')](handleEntityNotFound(_0x267a26,null))[_0xacca('0x37')](function(_0x111795){if(_0x111795){_0x15906b['body']['MailAccountId']=_0x111795['id'];return db[_0xacca('0x6b')][_0xacca('0x64')](_0x15906b['body']);}})['then'](respondWithResult(_0x267a26,null))[_0xacca('0x29')](handleError(_0x267a26,null));};exports[_0xacca('0x6c')]=function(_0x3f4f89,_0xa29e24,_0x56217f){var _0x17ea2f={'raw':![],'where':{}};var _0x4f3de0={};var _0x34b8c4={'count':0x0,'rows':[]};return db['MailAccount'][_0xacca('0x65')]({'where':{'id':_0x3f4f89[_0xacca('0x5f')]['id']}})[_0xacca('0x37')](handleEntityNotFound(_0xa29e24,null))['then'](function(_0x1eab7a){if(_0x1eab7a){_0x4f3de0[_0xacca('0x46')]=_[_0xacca('0x48')](db[_0xacca('0x6b')][_0xacca('0x5b')]);_0x4f3de0[_0xacca('0x47')]=_[_0xacca('0x48')](_0x3f4f89['query']);_0x4f3de0[_0xacca('0x4f')]=_[_0xacca('0x5c')](_0x4f3de0[_0xacca('0x46')],_0x4f3de0['query']);_0x17ea2f[_0xacca('0x4a')]=_['intersection'](_0x4f3de0[_0xacca('0x46')],qs['fields'](_0x3f4f89[_0xacca('0x47')][_0xacca('0x49')]));_0x17ea2f[_0xacca('0x4a')]=_0x17ea2f[_0xacca('0x4a')][_0xacca('0x4b')]?_0x17ea2f[_0xacca('0x4a')]:_0x4f3de0['model'];if(!_0x3f4f89[_0xacca('0x47')]['hasOwnProperty']('nolimit')){_0x17ea2f[_0xacca('0x30')]=qs[_0xacca('0x30')](_0x3f4f89[_0xacca('0x47')][_0xacca('0x30')]);_0x17ea2f[_0xacca('0x2d')]=qs[_0xacca('0x2d')](_0x3f4f89[_0xacca('0x47')][_0xacca('0x2d')]);}_0x17ea2f[_0xacca('0x6d')]=qs[_0xacca('0x4d')](_0x3f4f89[_0xacca('0x47')][_0xacca('0x4d')]);_0x17ea2f['where']=qs[_0xacca('0x4f')](_[_0xacca('0x50')](_0x3f4f89['query'],_0x4f3de0['filters']));_0x17ea2f[_0xacca('0x4e')]['MailAccountId']=_0x1eab7a['id'];if(_0x3f4f89[_0xacca('0x47')][_0xacca('0x51')]){_0x17ea2f[_0xacca('0x4e')]=_[_0xacca('0x52')](_0x17ea2f[_0xacca('0x4e')],{'$or':_[_0xacca('0x42')](_0x17ea2f[_0xacca('0x4a')],function(_0x574ae6){var _0x4ee71b={};_0x4ee71b[_0x574ae6]={'$like':'%'+_0x3f4f89[_0xacca('0x47')]['filter']+'%'};return _0x4ee71b;})});}_0x17ea2f=_[_0xacca('0x52')]({},_0x17ea2f,_0x3f4f89['options']);return db[_0xacca('0x6b')][_0xacca('0x2f')]({'where':_0x17ea2f[_0xacca('0x4e')]})[_0xacca('0x37')](function(_0x3bbae8){_0x34b8c4['count']=_0x3bbae8;if(_0x3f4f89[_0xacca('0x47')][_0xacca('0x55')]){_0x17ea2f[_0xacca('0x68')]=[{'all':!![]}];}return db[_0xacca('0x6b')][_0xacca('0x56')](_0x17ea2f);})[_0xacca('0x37')](function(_0xd2e648){_0x34b8c4[_0xacca('0x57')]=_0xd2e648;return _0x34b8c4;});}})[_0xacca('0x37')](respondWithFilteredResult(_0xa29e24,_0x17ea2f))[_0xacca('0x29')](handleError(_0xa29e24,null));};exports[_0xacca('0x6e')]=function(_0x2c10f2,_0x327365,_0x303c4d){return db[_0xacca('0x43')]['find']({'where':{'id':_0x2c10f2[_0xacca('0x5f')]['id']}})[_0xacca('0x37')](handleEntityNotFound(_0x327365,null))[_0xacca('0x37')](function(_0x1c2c5c){if(_0x1c2c5c){return _0x1c2c5c[_0xacca('0x6e')](_0x2c10f2[_0xacca('0x47')][_0xacca('0x6a')]);}})[_0xacca('0x37')](respondWithStatusCode(_0x327365,null))['catch'](handleError(_0x327365,null));};exports[_0xacca('0x64')]=function(_0x40b803,_0x16b9e){var _0x4d355c={'name':_0x40b803[_0xacca('0x5e')][_0xacca('0x3c')],'key':_0x40b803[_0xacca('0x5e')]['key'],'email':_0x40b803[_0xacca('0x5e')][_0xacca('0x6f')],'ListId':_0x40b803[_0xacca('0x5e')][_0xacca('0x70')],'active':!_[_0xacca('0x71')](_0x40b803['body'][_0xacca('0x72')])?_0x40b803[_0xacca('0x5e')][_0xacca('0x72')]:!![],'description':_0x40b803[_0xacca('0x5e')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0xacca('0x71')](_0x40b803[_0xacca('0x5e')][_0xacca('0x73')])){if(_0x40b803[_0xacca('0x5e')][_0xacca('0x74')]){_0x4d355c['Imap'][_0xacca('0x75')]=_0x4d355c[_0xacca('0x60')][_0xacca('0x75')]=_0x40b803[_0xacca('0x5e')][_0xacca('0x76')];_0x4d355c['Imap']['password']=_0x4d355c['Smtp']['pass']=_0x40b803['body'][_0xacca('0x77')];}else{_0x4d355c['Imap'][_0xacca('0x78')]=_0x4d355c[_0xacca('0x60')][_0xacca('0x78')]=![];}_0x4d355c[_0xacca('0x5a')][_0xacca('0x79')]=_0x40b803['body']['Imap'][_0xacca('0x79')];_0x4d355c[_0xacca('0x5a')]['port']=_0x40b803['body'][_0xacca('0x5a')][_0xacca('0x7a')];_0x4d355c[_0xacca('0x60')][_0xacca('0x79')]=_0x40b803['body']['Smtp'][_0xacca('0x79')];_0x4d355c['Smtp'][_0xacca('0x7a')]=_0x40b803[_0xacca('0x5e')][_0xacca('0x60')]['port'];}else{_0x4d355c[_0xacca('0x5a')][_0xacca('0x7b')]=_0x4d355c[_0xacca('0x60')][_0xacca('0x7b')]=_0x40b803[_0xacca('0x5e')][_0xacca('0x73')];_0x4d355c[_0xacca('0x5a')]['user']=_0x4d355c[_0xacca('0x60')][_0xacca('0x75')]=_0x40b803[_0xacca('0x5e')]['cuser'];_0x4d355c['Imap'][_0xacca('0x7c')]=_0x4d355c[_0xacca('0x60')][_0xacca('0x7d')]=_0x40b803['body']['cpassword'];}return db[_0xacca('0x43')][_0xacca('0x64')](_0x4d355c,{'include':[{'model':db[_0xacca('0x3f')],'as':_0xacca('0x60')},{'model':db['MailServerIn'],'as':_0xacca('0x5a')}]})[_0xacca('0x37')](function(_0x439ea7){var _0x29d9f8=_0x40b803['user']['get']({'plain':!![]});if(!_0x29d9f8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29d9f8[_0xacca('0x7e')]==='user'){var _0x1b41a7=_0x439ea7[_0xacca('0x38')]({'plain':!![]});return db[_0xacca('0x7f')][_0xacca('0x5d')]({'where':{'name':_0xacca('0x39'),'userProfileId':_0x29d9f8[_0xacca('0x80')]},'raw':!![]})[_0xacca('0x37')](function(_0x7cc63e){if(_0x7cc63e&&_0x7cc63e[_0xacca('0x81')]===0x0){return db[_0xacca('0x3a')][_0xacca('0x64')]({'name':_0x1b41a7['name'],'resourceId':_0x1b41a7['id'],'type':_0x7cc63e[_0xacca('0x3c')],'sectionId':_0x7cc63e['id']},{})[_0xacca('0x37')](function(){return _0x439ea7;});}else{return _0x439ea7;}})[_0xacca('0x29')](function(_0x626834){logger[_0xacca('0x26')](_0xacca('0x82'),_0x626834);throw _0x626834;});}return _0x439ea7;})['then'](respondWithResult(_0x16b9e,0xc9))['catch'](handleError(_0x16b9e,null));};exports[_0xacca('0x83')]=function(_0x33cfcc,_0x2f7607,_0xdef7dc){return db[_0xacca('0x43')][_0xacca('0x65')]({'where':{'id':_0x33cfcc[_0xacca('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2f7607,null))[_0xacca('0x37')](function(_0xae268f){if(_0xae268f){return _0xae268f[_0xacca('0x83')]();}return null;})['then'](respondWithResult(_0x2f7607,null))[_0xacca('0x29')](handleError(_0x2f7607,null));};exports[_0xacca('0x84')]=function(_0x19b802,_0xb8f128,_0x3e0c17){if(_0x19b802['body']['id']){delete _0x19b802['body']['id'];}return db[_0xacca('0x43')][_0xacca('0x5d')]({'where':{'id':_0x19b802['params']['id']}})[_0xacca('0x37')](handleEntityNotFound(_0xb8f128,null))[_0xacca('0x37')](function(_0x3547eb){if(_0x3547eb){_0x19b802[_0xacca('0x5e')]['MailAccountId']=_0x3547eb['id'];return db[_0xacca('0x59')]['create'](_0x19b802[_0xacca('0x5e')]);}})[_0xacca('0x37')](respondWithResult(_0xb8f128,null))[_0xacca('0x29')](handleError(_0xb8f128,null));};exports[_0xacca('0x85')]=function(_0xdba018,_0x3a352d,_0x534ab0){return db[_0xacca('0x43')]['findOne']({'where':{'id':_0xdba018[_0xacca('0x5f')]['id']}})[_0xacca('0x37')](handleEntityNotFound(_0x3a352d,null))[_0xacca('0x37')](function(_0x28d134){if(_0x28d134){return _0x28d134[_0xacca('0x86')](null);}return null;})['then'](respondWithStatusCode(_0x3a352d,null))[_0xacca('0x29')](handleError(_0x3a352d,null));};exports[_0xacca('0x87')]=function(_0x31744c,_0xc33431,_0x524d2d){return db[_0xacca('0x43')][_0xacca('0x65')]({'where':{'id':_0x31744c['params']['id']}})['then'](handleEntityNotFound(_0xc33431,null))[_0xacca('0x37')](function(_0x22fca1){if(_0x22fca1){return _0x22fca1[_0xacca('0x87')]();}return null;})[_0xacca('0x37')](respondWithResult(_0xc33431,null))[_0xacca('0x29')](handleError(_0xc33431,null));};exports[_0xacca('0x88')]=function(_0x5be74,_0x336bf5,_0x3b8005){if(_0x5be74[_0xacca('0x5e')]['id']){delete _0x5be74[_0xacca('0x5e')]['id'];}return db[_0xacca('0x43')][_0xacca('0x5d')]({'where':{'id':_0x5be74[_0xacca('0x5f')]['id']}})[_0xacca('0x37')](handleEntityNotFound(_0x336bf5,null))[_0xacca('0x37')](function(_0x1ee8a3){if(_0x1ee8a3){_0x5be74[_0xacca('0x5e')][_0xacca('0x67')]=_0x1ee8a3['id'];return db[_0xacca('0x3f')]['create'](_0x5be74[_0xacca('0x5e')]);}})[_0xacca('0x37')](respondWithResult(_0x336bf5,null))[_0xacca('0x29')](handleError(_0x336bf5,null));};exports[_0xacca('0x89')]=function(_0x1dd5da,_0x4b7b90,_0x383f37){return db[_0xacca('0x43')][_0xacca('0x65')]({'where':{'id':_0x1dd5da['params']['id']}})[_0xacca('0x37')](handleEntityNotFound(_0x4b7b90,null))['then'](function(_0xf51fc4){if(_0xf51fc4){return _0xf51fc4[_0xacca('0x8a')](null);}return null;})[_0xacca('0x37')](respondWithStatusCode(_0x4b7b90,null))[_0xacca('0x29')](handleError(_0x4b7b90,null));};exports[_0xacca('0x8b')]=function(_0x34c160,_0x2217b9,_0x35293f){return db[_0xacca('0x8c')]['find']({'where':{'id':_0x34c160['params']['id']}})[_0xacca('0x37')](handleEntityNotFound(_0x2217b9,null))['then'](function(_0x14185f){if(_0x14185f){return _0x14185f[_0xacca('0x8b')](_0x34c160[_0xacca('0x5e')]['ids'],_['omit'](_0x34c160[_0xacca('0x5e')],[_0xacca('0x6a'),'id'])||{});}})['then'](respondWithResult(_0x2217b9,null))[_0xacca('0x29')](handleError(_0x2217b9,null));};exports[_0xacca('0x8d')]=function(_0x267583,_0x10a51d,_0x12acd1){var _0x3a3d7a={'raw':![],'where':{}};var _0xcee2a8={};var _0x759db5={'count':0x0,'rows':[]};return db['MailAccount'][_0xacca('0x65')]({'where':{'id':_0x267583['params']['id']}})[_0xacca('0x37')](handleEntityNotFound(_0x10a51d,null))[_0xacca('0x37')](function(_0x55914d){if(_0x55914d){_0xcee2a8['model']=_[_0xacca('0x48')](db['MailInteraction'][_0xacca('0x5b')]);_0xcee2a8[_0xacca('0x47')]=_[_0xacca('0x48')](_0x267583['query']);_0xcee2a8[_0xacca('0x4f')]=_[_0xacca('0x5c')](_0xcee2a8[_0xacca('0x46')],_0xcee2a8[_0xacca('0x47')]);_0x3a3d7a[_0xacca('0x4a')]=_[_0xacca('0x5c')](_0xcee2a8[_0xacca('0x46')],qs[_0xacca('0x49')](_0x267583['query'][_0xacca('0x49')]));_0x3a3d7a[_0xacca('0x4a')]=_0x3a3d7a[_0xacca('0x4a')]['length']?_0x3a3d7a[_0xacca('0x4a')]:_0xcee2a8[_0xacca('0x46')];if(!_0x267583[_0xacca('0x47')][_0xacca('0x66')]('nolimit')){_0x3a3d7a[_0xacca('0x30')]=qs[_0xacca('0x30')](_0x267583[_0xacca('0x47')][_0xacca('0x30')]);_0x3a3d7a[_0xacca('0x2d')]=qs['offset'](_0x267583[_0xacca('0x47')][_0xacca('0x2d')]);}_0x3a3d7a['order']=qs[_0xacca('0x4d')](_0x267583[_0xacca('0x47')][_0xacca('0x4d')]);_0x3a3d7a[_0xacca('0x4e')]=qs[_0xacca('0x4f')](_['pick'](_0x267583[_0xacca('0x47')],_0xcee2a8[_0xacca('0x4f')]));_0x3a3d7a[_0xacca('0x4e')][_0xacca('0x67')]=_0x55914d['id'];if(_0x267583[_0xacca('0x47')][_0xacca('0x51')]){_0x3a3d7a[_0xacca('0x4e')]=_['merge'](_0x3a3d7a[_0xacca('0x4e')],{'$or':_[_0xacca('0x42')](_0x3a3d7a['attributes'],function(_0x2bb2e2){var _0x5b0146={};_0x5b0146[_0x2bb2e2]={'$like':'%'+_0x267583[_0xacca('0x47')]['filter']+'%'};return _0x5b0146;})});}_0x3a3d7a=_['merge']({},_0x3a3d7a,_0x267583[_0xacca('0x54')]);return db[_0xacca('0x8c')][_0xacca('0x2f')]({'where':_0x3a3d7a[_0xacca('0x4e')]})[_0xacca('0x37')](function(_0x20bea9){_0x759db5[_0xacca('0x2f')]=_0x20bea9;if(_0x267583[_0xacca('0x47')][_0xacca('0x55')]){_0x3a3d7a['include']=[{'model':db[_0xacca('0x8e')],'as':_0xacca('0x8f'),'required':![]},{'model':db[_0xacca('0x90')],'as':_0xacca('0x91'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0xacca('0x92')],'as':_0xacca('0x93'),'attributes':['id',_0xacca('0x3c'),_0xacca('0x94')],'where':_0x267583[_0xacca('0x47')]['tag']?{'id':_0x267583[_0xacca('0x47')]['tag']}:undefined,'required':_0x267583[_0xacca('0x47')][_0xacca('0x95')]?!![]:![]}];}return db[_0xacca('0x8c')][_0xacca('0x56')](_0x3a3d7a);})[_0xacca('0x37')](function(_0x15af45){_0x759db5['rows']=_0x15af45;return _0x759db5;});}})[_0xacca('0x37')](respondWithFilteredResult(_0x10a51d,_0x3a3d7a))[_0xacca('0x29')](handleError(_0x10a51d,null));};exports[_0xacca('0x96')]=function(_0x8bdb82,_0x293a24,_0x285846){return db[_0xacca('0x43')][_0xacca('0x65')]({'where':{'id':_0x8bdb82[_0xacca('0x5f')]['id']}})[_0xacca('0x37')](handleEntityNotFound(_0x293a24,null))[_0xacca('0x37')](function(_0x4b8567){if(_0x4b8567){return db[_0xacca('0x97')]['transaction'](function(_0x54f517){return db[_0xacca('0x98')][_0xacca('0x99')]({'where':{'MailAccountId':_0x8bdb82[_0xacca('0x5f')]['id']},'transaction':_0x54f517})['then'](function(_0x18429d){var _0x312e23=_[_0xacca('0x42')](_0x8bdb82[_0xacca('0x5e')],function(_0x31df70){_0x31df70['MailAccountId']=_0x8bdb82[_0xacca('0x5f')]['id'];return _0x31df70;});return db[_0xacca('0x98')][_0xacca('0x9a')](_0x312e23,{'transaction':_0x54f517});});})['then'](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x8bdb82[_0xacca('0x5f')]['id']},'order':_0xacca('0x9b')});});}})[_0xacca('0x37')](respondWithResult(_0x293a24,null))['catch'](handleError(_0x293a24,null));};exports[_0xacca('0x9c')]=function(_0x288492,_0x382da4,_0x7c3d43){var _0x4311c3={};var _0x22b63b={};var _0x6b6332;var _0x2f8a8e;return db['MailAccount'][_0xacca('0x65')]({'where':{'id':_0x288492[_0xacca('0x5f')]['id']}})['then'](handleEntityNotFound(_0x382da4,null))['then'](function(_0xa83e34){if(_0xa83e34){_0x6b6332=_0xa83e34;_0x22b63b['model']=_['keys'](db['MailApplication'][_0xacca('0x5b')]);_0x22b63b[_0xacca('0x47')]=_[_0xacca('0x48')](_0x288492[_0xacca('0x47')]);_0x22b63b[_0xacca('0x4f')]=_[_0xacca('0x5c')](_0x22b63b[_0xacca('0x46')],_0x22b63b[_0xacca('0x47')]);_0x4311c3[_0xacca('0x4a')]=_[_0xacca('0x5c')](_0x22b63b[_0xacca('0x46')],qs[_0xacca('0x49')](_0x288492[_0xacca('0x47')][_0xacca('0x49')]));_0x4311c3[_0xacca('0x4a')]=_0x4311c3[_0xacca('0x4a')][_0xacca('0x4b')]?_0x4311c3['attributes']:_0x22b63b['model'];_0x4311c3[_0xacca('0x6d')]=qs[_0xacca('0x4d')](_0x288492[_0xacca('0x47')][_0xacca('0x4d')]);_0x4311c3['where']=qs[_0xacca('0x4f')](_[_0xacca('0x50')](_0x288492[_0xacca('0x47')],_0x22b63b[_0xacca('0x4f')]));if(_0x288492[_0xacca('0x47')][_0xacca('0x51')]){_0x4311c3[_0xacca('0x4e')]=_[_0xacca('0x52')](_0x4311c3[_0xacca('0x4e')],{'$or':_[_0xacca('0x42')](_0x4311c3['attributes'],function(_0x2e00af){var _0x1ccb27={};_0x1ccb27[_0x2e00af]={'$like':'%'+_0x288492[_0xacca('0x47')][_0xacca('0x51')]+'%'};return _0x1ccb27;})});}_0x4311c3=_[_0xacca('0x52')]({},_0x4311c3,_0x288492[_0xacca('0x54')]);return _0x6b6332[_0xacca('0x9c')](_0x4311c3);}})[_0xacca('0x37')](function(_0x5ce7c8){if(_0x5ce7c8){_0x2f8a8e=_0x5ce7c8[_0xacca('0x4b')];if(!_0x288492[_0xacca('0x47')][_0xacca('0x66')]('nolimit')){_0x4311c3[_0xacca('0x30')]=qs[_0xacca('0x30')](_0x288492[_0xacca('0x47')]['limit']);_0x4311c3['offset']=qs['offset'](_0x288492['query'][_0xacca('0x2d')]);}return _0x6b6332[_0xacca('0x9c')](_0x4311c3);}})[_0xacca('0x37')](function(_0x1b35ff){if(_0x1b35ff){return _0x1b35ff?{'count':_0x2f8a8e,'rows':_0x1b35ff}:null;}})[_0xacca('0x37')](respondWithResult(_0x382da4,null))[_0xacca('0x29')](handleError(_0x382da4,null));};exports[_0xacca('0x9d')]=function(_0x1063a4,_0x34bb80,_0x1f1334){var _0x49099d={'raw':!![],'where':{}};var _0x46462e={};var _0x8fa54f={'count':0x0,'rows':[]};return db[_0xacca('0x43')][_0xacca('0x65')]({'where':{'id':_0x1063a4[_0xacca('0x5f')]['id']}})[_0xacca('0x37')](handleEntityNotFound(_0x34bb80,null))[_0xacca('0x37')](function(_0x5e5340){if(_0x5e5340){_0x46462e['model']=_[_0xacca('0x48')](db[_0xacca('0x9e')][_0xacca('0x5b')]);_0x46462e[_0xacca('0x47')]=_[_0xacca('0x48')](_0x1063a4[_0xacca('0x47')]);_0x46462e[_0xacca('0x4f')]=_['intersection'](_0x46462e[_0xacca('0x46')],_0x46462e[_0xacca('0x47')]);_0x49099d[_0xacca('0x4a')]=_[_0xacca('0x5c')](_0x46462e['model'],qs[_0xacca('0x49')](_0x1063a4[_0xacca('0x47')][_0xacca('0x49')]));_0x49099d[_0xacca('0x4a')]=_0x49099d[_0xacca('0x4a')]['length']?_0x49099d[_0xacca('0x4a')]:_0x46462e[_0xacca('0x46')];if(!_0x1063a4[_0xacca('0x47')]['hasOwnProperty'](_0xacca('0x4c'))){_0x49099d[_0xacca('0x30')]=qs[_0xacca('0x30')](_0x1063a4[_0xacca('0x47')]['limit']);_0x49099d[_0xacca('0x2d')]=qs['offset'](_0x1063a4['query'][_0xacca('0x2d')]);}_0x49099d[_0xacca('0x6d')]=qs['sort'](_0x1063a4['query'][_0xacca('0x4d')]);_0x49099d[_0xacca('0x4e')]=qs[_0xacca('0x4f')](_[_0xacca('0x50')](_0x1063a4['query'],_0x46462e[_0xacca('0x4f')]));_0x49099d['where'][_0xacca('0x67')]=_0x5e5340['id'];if(_0x1063a4[_0xacca('0x47')][_0xacca('0x51')]){_0x49099d[_0xacca('0x4e')]=_[_0xacca('0x52')](_0x49099d['where'],{'$or':_[_0xacca('0x42')](_0x49099d[_0xacca('0x4a')],function(_0x5ee452){var _0x2b9ec5={};_0x2b9ec5[_0x5ee452]={'$like':'%'+_0x1063a4['query'][_0xacca('0x51')]+'%'};return _0x2b9ec5;})});}if(_0x1063a4['query'][_0xacca('0x9f')]){var _0x30d0b8=_0x1063a4['query']['$gte'][_0xacca('0xa0')](',');var _0xdcc0d1={};_0xdcc0d1[_0x30d0b8[0x0]]={'$gte':moment(_0x30d0b8[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x49099d['where']=_[_0xacca('0x52')](_0x49099d[_0xacca('0x4e')],_0xdcc0d1);}_0x49099d=_[_0xacca('0x52')]({},_0x49099d,_0x1063a4[_0xacca('0x54')]);return db[_0xacca('0x9e')][_0xacca('0x2f')]({'where':_0x49099d[_0xacca('0x4e')]})[_0xacca('0x37')](function(_0x224a60){_0x8fa54f['count']=_0x224a60;if(_0x1063a4[_0xacca('0x47')][_0xacca('0x55')]){_0x49099d[_0xacca('0x68')]=[{'all':!![]}];}return db[_0xacca('0x9e')][_0xacca('0x56')](_0x49099d);})[_0xacca('0x37')](function(_0x268bcb){if(_0x1063a4[_0xacca('0x47')][_0xacca('0xa1')]===_0xacca('0xa2')){for(var _0x47db1a=0x0;_0x47db1a<_0x268bcb[_0xacca('0x4b')];_0x47db1a++){_0x268bcb[_0x47db1a][_0xacca('0x5e')]=juice(_0x268bcb[_0x47db1a][_0xacca('0x5e')]);}}_0x8fa54f[_0xacca('0x57')]=_0x268bcb;return _0x8fa54f;});}})[_0xacca('0x37')](respondWithFilteredResult(_0x34bb80,_0x49099d))['catch'](handleError(_0x34bb80,null));};exports['send']=function(_0x3ba76a,_0x59d940,_0x3e3f0e){var _0xa5b50b,_0x45c60f={},_0x3fbd6d;if(_0x3ba76a['body']['to']){_0x3fbd6d=_0x3ba76a[_0xacca('0x5e')]['to']['split'](',')[0x0];}return db[_0xacca('0x43')][_0xacca('0x5d')]({'where':{'id':_0x3ba76a[_0xacca('0x5f')]['id']},'include':[{'model':db[_0xacca('0xa3')],'as':_0xacca('0xa4'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x3fbd6d},'limit':0x1,'order':[[_0xacca('0xa5'),_0xacca('0xa6')]]}]},{'model':db[_0xacca('0x3f')],'as':'Smtp','raw':!![]}]})[_0xacca('0x37')](handleEntityNotFound(_0x59d940,null))[_0xacca('0x37')](function(_0xd31fb4){if(_0xd31fb4){_0xa5b50b=_0xd31fb4;if(_0xd31fb4['Smtp']){if(_[_0xacca('0x71')](_0x3ba76a[_0xacca('0x5e')][_0xacca('0xa7')])){_0x3ba76a[_0xacca('0x5e')]['from']=util[_0xacca('0xa8')](_0xacca('0xa9'),_0xd31fb4[_0xacca('0x3c')],_0xd31fb4['email']||_0xd31fb4[_0xacca('0x60')][_0xacca('0x75')]);}if(_0x3ba76a[_0xacca('0x5e')][_0xacca('0xaa')]&&_0x3ba76a[_0xacca('0x5e')][_0xacca('0xaa')][_0xacca('0x4b')]){for(var _0xfca5dd=0x0;_0xfca5dd<_0x3ba76a[_0xacca('0x5e')][_0xacca('0xaa')][_0xacca('0x4b')];_0xfca5dd+=0x1){_0x3ba76a['body'][_0xacca('0xaa')][_0xfca5dd]={'filename':_0x3ba76a[_0xacca('0x5e')][_0xacca('0xaa')][_0xfca5dd][_0xacca('0x3c')],'path':path['join'](config[_0xacca('0xab')],_0xacca('0xac'),_0x3ba76a['body'][_0xacca('0xaa')][_0xfca5dd]['basename'])};}}var _0x633009={'tls':{'rejectUnauthorized':![]}};if(_[_0xacca('0x71')](_0xd31fb4[_0xacca('0x60')][_0xacca('0x7b')])){if(_0xd31fb4[_0xacca('0x60')]['authentication']){_0x633009['auth']={'user':_0xd31fb4[_0xacca('0x60')][_0xacca('0x75')],'pass':_0xd31fb4['Smtp'][_0xacca('0x7d')]};}_0x633009[_0xacca('0x79')]=_0xd31fb4[_0xacca('0x60')][_0xacca('0x79')];_0x633009['port']=_0xd31fb4[_0xacca('0x60')][_0xacca('0x7a')];_0x633009['secure']=_0xd31fb4['Smtp'][_0xacca('0xad')];}else{_0x633009[_0xacca('0x7b')]=_0xd31fb4[_0xacca('0x60')][_0xacca('0x7b')];_0x633009[_0xacca('0xae')]={'user':_0xd31fb4[_0xacca('0x60')]['user'],'pass':_0xd31fb4['Smtp'][_0xacca('0x7d')]};}return respondWithRpcPromise('SendMail',_0xacca('0xaf'),{'account':_0x633009,'message':_0x3ba76a[_0xacca('0x5e')]});}else{throw new Error('List\x20not\x20found');}}})[_0xacca('0x37')](function(_0x309e21){if(_0x309e21){_0x45c60f=_0x309e21;if(_0xa5b50b[_0xacca('0xa4')]){if(_0xa5b50b[_0xacca('0xa4')][_0xacca('0xb0')][_0xacca('0x4b')]){return _0xa5b50b[_0xacca('0xa4')]['Contacts'][0x0];}else{return db[_0xacca('0x8e')][_0xacca('0x64')](_[_0xacca('0x1a')](_0x3ba76a[_0xacca('0x5e')],{'firstName':_0x3ba76a[_0xacca('0x5e')]['to'],'email':_0x3ba76a[_0xacca('0x5e')]['to'],'phone':_0x3ba76a[_0xacca('0x5e')]['to'],'ListId':_0xa5b50b[_0xacca('0x70')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0xacca('0x37')](function(_0x33c759){if(_0x33c759){var _0x3e2fbd={'UserId':_0x3ba76a['user']['id'],'ContactId':_0x33c759['id'],'MailAccountId':_0xa5b50b['id'],'inReplyTo':_0x45c60f[_0xacca('0xb1')],'to':_0x3ba76a[_0xacca('0x5e')][_0xacca('0xa7')],'cc':_0x3ba76a[_0xacca('0x5e')]['cc'],'subject':_0x3ba76a[_0xacca('0x5e')][_0xacca('0xb2')],'attach':_0x3ba76a[_0xacca('0x5e')][_0xacca('0xb3')],'firstMsgDirection':_0xacca('0xb4'),'lastMsgAt':moment()[_0xacca('0xa8')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xacca('0xb4'),'Messages':[_[_0xacca('0x52')](_0x3ba76a[_0xacca('0x5e')],{'messageId':_0x45c60f[_0xacca('0xb1')],'sentAt':moment()['format'](_0xacca('0xb5')),'read':!![],'MailAccountId':_0xa5b50b['id'],'UserId':_0x3ba76a[_0xacca('0x75')]['id'],'ContactId':_0x33c759['id']})]};if(_0x3ba76a['body'][_0xacca('0xb6')]){_0x3e2fbd=_['merge'](_0x3e2fbd,_0x3ba76a['body'][_0xacca('0xb6')]);}return db['MailInteraction'][_0xacca('0x64')](_0x3e2fbd,{'include':[{'model':db[_0xacca('0x9e')],'as':'Messages'}]});}})[_0xacca('0x37')](respondWithResult(_0x59d940,null))['catch'](handleError(_0x59d940,null));};exports[_0xacca('0xb7')]=function(_0x496c9a,_0x4da04b,_0x566821){return db[_0xacca('0x43')][_0xacca('0x5d')]({'where':{'id':_0x496c9a[_0xacca('0x5f')]['id']},'include':[{'model':db[_0xacca('0x3f')],'as':_0xacca('0x60'),'raw':!![]}]})[_0xacca('0x37')](handleEntityNotFound(_0x4da04b,null))[_0xacca('0x37')](function(_0x5f036d){if(_0x5f036d&&_0x5f036d[_0xacca('0x60')]){var _0xa15dcd={'id':_0x5f036d['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5f036d['Smtp']['service']){_0xa15dcd[_0xacca('0x7b')]=_0x5f036d['Smtp'][_0xacca('0x7b')];}else{_0xa15dcd['host']=_0x5f036d['Smtp'][_0xacca('0x79')];_0xa15dcd['port']=_0x5f036d['Smtp'][_0xacca('0x7a')];_0xa15dcd['secure']=_0x5f036d[_0xacca('0x60')]['secure'];}if(_0x5f036d[_0xacca('0x60')][_0xacca('0x78')]){_0xa15dcd[_0xacca('0xae')]={'user':_0x5f036d[_0xacca('0x60')][_0xacca('0x75')],'pass':_0x5f036d[_0xacca('0x60')]['pass']};}return respondWithRpcPromise(_0xacca('0xb8'),_0xacca('0xb7'),{'account':_0xa15dcd});}})[_0xacca('0x37')](respondWithResult(_0x4da04b,null))[_0xacca('0x29')](handleError(_0x4da04b,null));};exports[_0xacca('0x99')]=function(_0x4ba37e,_0x1380a8){return db['MailAccount'][_0xacca('0x5d')]({'where':{'id':_0x4ba37e[_0xacca('0x5f')]['id']}})[_0xacca('0x37')](handleEntityNotFound(_0x1380a8,null))['then'](function(_0x2d2d75){if(_0x2d2d75&&_0x2d2d75['service']){throw new db['Sequelize'][(_0xacca('0xb9'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x2d2d75;})['then'](removeEntity(_0x1380a8,null))[_0xacca('0x29')](handleError(_0x1380a8,null));};exports['addAgents']=function(_0x11b00a,_0x15cef3,_0x48850d){return db['MailAccount']['find']({'where':{'id':_0x11b00a['params']['id']}})[_0xacca('0x37')](handleEntityNotFound(_0x15cef3,null))[_0xacca('0x37')](function(_0x78ab1c){if(_0x78ab1c){return _0x78ab1c[_0xacca('0xba')](_0x11b00a['body'][_0xacca('0x6a')],_[_0xacca('0xbb')](_0x11b00a[_0xacca('0x5e')],[_0xacca('0x6a'),'id'])||{})[_0xacca('0xbc')](function(_0x342b37){for(var _0x328bd4=0x0;_0x328bd4<_0x11b00a['body'][_0xacca('0x6a')][_0xacca('0x4b')];_0x328bd4+=0x1){socket[_0xacca('0xbd')](_0xacca('0xbe'),{'UserId':Number(_0x11b00a['body'][_0xacca('0x6a')][_0x328bd4]),'MailAccountId':Number(_0x11b00a[_0xacca('0x5f')]['id'])});}return _0x342b37;});}})['then'](respondWithResult(_0x15cef3,null))[_0xacca('0x29')](handleError(_0x15cef3,null));};exports[_0xacca('0xbf')]=function(_0x274d5e,_0x46e22d,_0x15a07e){return db[_0xacca('0x43')][_0xacca('0x5d')]({'where':{'id':_0x274d5e['params']['id']}})[_0xacca('0x37')](handleEntityNotFound(_0x46e22d,null))[_0xacca('0x37')](function(_0x35a99c){if(_0x35a99c){return _0x35a99c[_0xacca('0xbf')](_0x274d5e[_0xacca('0x47')][_0xacca('0x6a')])[_0xacca('0x37')](function(){if(_[_0xacca('0xc0')](_0x274d5e['query'][_0xacca('0x6a')])){for(var _0x31bb5a=0x0;_0x31bb5a<_0x274d5e[_0xacca('0x47')]['ids'][_0xacca('0x4b')];_0x31bb5a+=0x1){socket[_0xacca('0xbd')](_0xacca('0xc1'),{'UserId':Number(_0x274d5e[_0xacca('0x47')][_0xacca('0x6a')][_0x31bb5a]),'MailAccountId':Number(_0x274d5e[_0xacca('0x5f')]['id'])});}}else{socket[_0xacca('0xbd')](_0xacca('0xc1'),{'UserId':Number(_0x274d5e[_0xacca('0x47')]['ids']),'MailAccountId':Number(_0x274d5e[_0xacca('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x46e22d,null))[_0xacca('0x29')](handleError(_0x46e22d,null));};exports[_0xacca('0xc2')]=function(_0x33719d,_0x48f783,_0x6e73b2){var _0x56195c={};var _0x4b47a3={};var _0x495ebf;var _0x1d5445;return db[_0xacca('0x43')][_0xacca('0x65')]({'where':{'id':_0x33719d[_0xacca('0x5f')]['id']}})['then'](handleEntityNotFound(_0x48f783,null))['then'](function(_0x78bc57){if(_0x78bc57){_0x495ebf=_0x78bc57;_0x4b47a3['model']=_[_0xacca('0x48')](db['User']['rawAttributes']);_0x4b47a3[_0xacca('0x47')]=_[_0xacca('0x48')](_0x33719d[_0xacca('0x47')]);_0x4b47a3[_0xacca('0x4f')]=_[_0xacca('0x5c')](_0x4b47a3['model'],_0x4b47a3['query']);_0x56195c[_0xacca('0x4a')]=_[_0xacca('0x5c')](_0x4b47a3[_0xacca('0x46')],qs[_0xacca('0x49')](_0x33719d[_0xacca('0x47')][_0xacca('0x49')]));_0x56195c[_0xacca('0x4a')]=_0x56195c[_0xacca('0x4a')][_0xacca('0x4b')]?_0x56195c['attributes']:_0x4b47a3[_0xacca('0x46')];_0x56195c[_0xacca('0x6d')]=qs['sort'](_0x33719d[_0xacca('0x47')][_0xacca('0x4d')]);_0x56195c[_0xacca('0x4e')]=qs[_0xacca('0x4f')](_[_0xacca('0x50')](_0x33719d[_0xacca('0x47')],_0x4b47a3[_0xacca('0x4f')]));if(_0x33719d[_0xacca('0x47')][_0xacca('0x51')]){_0x56195c['where']=_['merge'](_0x56195c[_0xacca('0x4e')],{'$or':_[_0xacca('0x42')](_0x56195c['attributes'],function(_0x202616){var _0x38a89d={};_0x38a89d[_0x202616]={'$like':'%'+_0x33719d[_0xacca('0x47')][_0xacca('0x51')]+'%'};return _0x38a89d;})});}_0x56195c=_[_0xacca('0x52')]({},_0x56195c,_0x33719d['options']);return _0x495ebf[_0xacca('0xc2')](_0x56195c);}})['then'](function(_0x14274e){if(_0x14274e){_0x1d5445=_0x14274e['length'];if(!_0x33719d['query'][_0xacca('0x66')](_0xacca('0x4c'))){_0x56195c['limit']=qs[_0xacca('0x30')](_0x33719d['query'][_0xacca('0x30')]);_0x56195c[_0xacca('0x2d')]=qs[_0xacca('0x2d')](_0x33719d[_0xacca('0x47')][_0xacca('0x2d')]);}return _0x495ebf[_0xacca('0xc2')](_0x56195c);}})[_0xacca('0x37')](function(_0x33f112){if(_0x33f112){return _0x33f112?{'count':_0x1d5445,'rows':_0x33f112}:null;}})[_0xacca('0x37')](respondWithResult(_0x48f783,null))[_0xacca('0x29')](handleError(_0x48f783,null));}; \ No newline at end of file +var _0x467a=['body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','order','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','email','ListId','isNil','active','description','cservice','cauthentication','user','password','pass','cpassword','authentication','host','port','service','cuser','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','CmContact','Contact','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','Contacts','DESC','from','format','%s\x20<%s>','attachments','join','auth','secure','SendMail','List\x20not\x20found','List','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','html-to-text','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','get','UserProfileResource','destroy','end','stack','name','send','index','MailServerIn','Imap','MailServerOut','MailAccount','fieldName','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','params','Smtp','Pause','mandatoryDispositionPause','rawAttributes','length','find'];(function(_0x4b2b3e,_0x720687){var _0x2f59a6=function(_0x29548c){while(--_0x29548c){_0x4b2b3e['push'](_0x4b2b3e['shift']());}};_0x2f59a6(++_0x720687);}(_0x467a,0x124));var _0xa467=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x467a[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xa467('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa467('0x1'));var jsonpatch=require(_0xa467('0x2'));var rp=require(_0xa467('0x3'));var moment=require('moment');var BPromise=require(_0xa467('0x4'));var Mustache=require(_0xa467('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa467('0x6'));var csv=require('to-csv');var ejs=require(_0xa467('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa467('0x8'));var squel=require('squel');var crypto=require(_0xa467('0x9'));var jsforce=require(_0xa467('0xa'));var deskjs=require(_0xa467('0xb'));var toCsv=require(_0xa467('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require(_0xa467('0xd'));var juice=require('juice');var Redis=require('ioredis');var authService=require(_0xa467('0xe'));var qs=require(_0xa467('0xf'));var as=require(_0xa467('0x10'));var hardwareService=require(_0xa467('0x11'));var logger=require(_0xa467('0x12'))('api');var utils=require(_0xa467('0x13'));var config=require(_0xa467('0x14'));var licenseUtil=require(_0xa467('0x15'));var db=require(_0xa467('0x16'))['db'];config['redis']=_[_0xa467('0x17')](config[_0xa467('0x18')],{'host':_0xa467('0x19'),'port':0x18eb});var socket=require(_0xa467('0x1a'))(new Redis(config[_0xa467('0x18')]));require('./mailAccount.socket')[_0xa467('0x1b')](socket);var jayson=require(_0xa467('0x1c'));var client=jayson[_0xa467('0x1d')]['http']({'port':0x232b});function respondWithRpcPromise(_0x40d3a1,_0x1ff21f,_0x57dcde,_0x2fc316){return new BPromise(function(_0x48599b,_0x15b7b8){var _0x26752d=_0x2fc316||client;return _0x26752d['request'](_0x40d3a1,_0x57dcde)[_0xa467('0x1e')](function(_0x15730b){logger['info'](_0xa467('0x1f'),_0x1ff21f,_0xa467('0x20'));logger[_0xa467('0x21')](_0xa467('0x22'),_0x1ff21f,'request\x20sent',JSON[_0xa467('0x23')](_0x15730b));if(_0x15730b['error']){if(_0x15730b[_0xa467('0x24')][_0xa467('0x25')]===0x1f4){logger[_0xa467('0x24')](_0xa467('0x1f'),_0x1ff21f,_0x15730b[_0xa467('0x24')][_0xa467('0x26')]);return _0x15b7b8(_0x15730b[_0xa467('0x24')][_0xa467('0x26')]);}logger[_0xa467('0x24')](_0xa467('0x1f'),_0x1ff21f,_0x15730b[_0xa467('0x24')][_0xa467('0x26')]);return _0x48599b(_0x15730b['error'][_0xa467('0x26')]);}else{logger[_0xa467('0x27')](_0xa467('0x1f'),_0x1ff21f,_0xa467('0x20'));_0x48599b(_0x15730b[_0xa467('0x28')][_0xa467('0x26')]);}})[_0xa467('0x29')](function(_0x36276a){logger[_0xa467('0x24')]('MailAccount,\x20%s,\x20%s',_0x1ff21f,_0x36276a);_0x15b7b8(_0x36276a);});});}function respondWithStatusCode(_0x4a89a9,_0x468350){_0x468350=_0x468350||0xcc;return function(_0x5e2188){if(_0x5e2188){return _0x4a89a9[_0xa467('0x2a')](_0x468350);}return _0x4a89a9[_0xa467('0x2b')](_0x468350)['end']();};}function respondWithResult(_0x345578,_0x22da4b){_0x22da4b=_0x22da4b||0xc8;return function(_0xe1f7f7){if(_0xe1f7f7){return _0x345578[_0xa467('0x2b')](_0x22da4b)[_0xa467('0x2c')](_0xe1f7f7);}};}function respondWithFilteredResult(_0x6ee905,_0xe2301e){return function(_0x49620b){if(_0x49620b){var _0xe763f5=typeof _0xe2301e[_0xa467('0x2d')]===_0xa467('0x2e')&&typeof _0xe2301e[_0xa467('0x2f')]===_0xa467('0x2e');var _0x20872d=_0x49620b[_0xa467('0x30')];var _0x104d6e=_0xe763f5?0x0:_0xe2301e[_0xa467('0x2d')];var _0x15696f=_0xe763f5?_0x49620b['count']:_0xe2301e['offset']+_0xe2301e[_0xa467('0x2f')];var _0x19ea1b;if(_0x15696f>=_0x20872d){_0x15696f=_0x20872d;_0x19ea1b=0xc8;}else{_0x19ea1b=0xce;}_0x6ee905[_0xa467('0x2b')](_0x19ea1b);return _0x6ee905['set'](_0xa467('0x31'),_0x104d6e+'-'+_0x15696f+'/'+_0x20872d)[_0xa467('0x2c')](_0x49620b);}return null;};}function patchUpdates(_0x540e1d){return function(_0x19b162){try{jsonpatch['apply'](_0x19b162,_0x540e1d,!![]);}catch(_0xf783c1){return BPromise[_0xa467('0x32')](_0xf783c1);}return _0x19b162[_0xa467('0x33')]();};}function saveUpdates(_0x5ecafd,_0x1fbd0c){return function(_0x1013c0){if(_0x1013c0){return _0x1013c0[_0xa467('0x34')](_0x5ecafd)[_0xa467('0x1e')](function(_0x2f4c49){return _0x2f4c49;});}return null;};}function removeEntity(_0x1b5d64,_0x214e05){return function(_0x422bb1){if(_0x422bb1){return _0x422bb1['destroy']()[_0xa467('0x1e')](function(){var _0x54db65=_0x422bb1[_0xa467('0x35')]({'plain':!![]});var _0x2c6d0c='MailAccounts';return db[_0xa467('0x36')][_0xa467('0x37')]({'where':{'type':_0x2c6d0c,'resourceId':_0x54db65['id']}})['then'](function(){return _0x422bb1;});})[_0xa467('0x1e')](function(){_0x1b5d64[_0xa467('0x2b')](0xcc)[_0xa467('0x38')]();});}};}function handleEntityNotFound(_0x5a68f4,_0x405952){return function(_0x21b29c){if(!_0x21b29c){_0x5a68f4['sendStatus'](0x194);}return _0x21b29c;};}function handleError(_0x476ed9,_0x53502b){_0x53502b=_0x53502b||0x1f4;return function(_0x19ee3f){logger[_0xa467('0x24')](_0x19ee3f[_0xa467('0x39')]);if(_0x19ee3f[_0xa467('0x3a')]){delete _0x19ee3f[_0xa467('0x3a')];}_0x476ed9['status'](_0x53502b)[_0xa467('0x3b')](_0x19ee3f);};}exports[_0xa467('0x3c')]=function(_0x1e8aa7,_0x479e82){var _0x249d0a={'include':[{'model':db[_0xa467('0x3d')],'as':_0xa467('0x3e')},{'model':db[_0xa467('0x3f')],'as':'Smtp'},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xfc5f21={},_0x36a798={'count':0x0,'rows':[]};var _0x25254f=_['map'](db[_0xa467('0x40')]['rawAttributes'],function(_0x5b6364){return{'name':_0x5b6364[_0xa467('0x41')],'type':_0x5b6364['type']['key']};});_0xfc5f21[_0xa467('0x42')]=_[_0xa467('0x43')](_0x25254f,_0xa467('0x3a'));_0xfc5f21[_0xa467('0x44')]=_[_0xa467('0x45')](_0x1e8aa7[_0xa467('0x44')]);_0xfc5f21[_0xa467('0x46')]=_[_0xa467('0x47')](_0xfc5f21[_0xa467('0x42')],_0xfc5f21[_0xa467('0x44')]);_0x249d0a[_0xa467('0x48')]=_[_0xa467('0x47')](_0xfc5f21[_0xa467('0x42')],qs[_0xa467('0x49')](_0x1e8aa7[_0xa467('0x44')][_0xa467('0x49')]));_0x249d0a[_0xa467('0x48')]=_0x249d0a['attributes']['length']?_0x249d0a[_0xa467('0x48')]:_0xfc5f21[_0xa467('0x42')];if(!_0x1e8aa7[_0xa467('0x44')][_0xa467('0x4a')](_0xa467('0x4b'))){_0x249d0a[_0xa467('0x2f')]=qs[_0xa467('0x2f')](_0x1e8aa7[_0xa467('0x44')][_0xa467('0x2f')]);_0x249d0a[_0xa467('0x2d')]=qs[_0xa467('0x2d')](_0x1e8aa7[_0xa467('0x44')][_0xa467('0x2d')]);}_0x249d0a['order']=qs['sort'](_0x1e8aa7['query'][_0xa467('0x4c')]);_0x249d0a[_0xa467('0x4d')]=qs[_0xa467('0x46')](_[_0xa467('0x4e')](_0x1e8aa7[_0xa467('0x44')],_0xfc5f21['filters']),_0x25254f);if(_0x1e8aa7['query'][_0xa467('0x4f')]){_0x249d0a[_0xa467('0x4d')]=_['merge'](_0x249d0a[_0xa467('0x4d')],{'$or':_['map'](_0x25254f,function(_0x286438){if(_0x286438[_0xa467('0x50')]!=='VIRTUAL'){var _0x3977a4={};_0x3977a4[_0x286438['name']]={'$like':'%'+_0x1e8aa7[_0xa467('0x44')][_0xa467('0x4f')]+'%'};return _0x3977a4;}})});}_0x249d0a=_[_0xa467('0x51')]({},_0x249d0a,_0x1e8aa7[_0xa467('0x52')]);var _0x1feab9={'where':_0x249d0a['where']};return db['MailAccount'][_0xa467('0x30')](_0x1feab9)['then'](function(_0xe09ba3){_0x36a798[_0xa467('0x30')]=_0xe09ba3;if(_0x1e8aa7[_0xa467('0x44')][_0xa467('0x53')]){_0x249d0a[_0xa467('0x54')]=[{'all':!![]}];}return db[_0xa467('0x40')][_0xa467('0x55')](_0x249d0a);})['then'](function(_0x2c0198){_0x36a798[_0xa467('0x56')]=_0x2c0198;return _0x36a798;})[_0xa467('0x1e')](respondWithFilteredResult(_0x479e82,_0x249d0a))[_0xa467('0x29')](handleError(_0x479e82,null));};exports['show']=function(_0xbe17ec,_0x1b0a52){var _0x3341f2={'raw':![],'where':{'id':_0xbe17ec[_0xa467('0x57')]['id']},'include':[{'model':db[_0xa467('0x3d')],'as':'Imap'},{'model':db[_0xa467('0x3f')],'as':_0xa467('0x58')},{'model':db[_0xa467('0x59')],'as':_0xa467('0x5a')}]},_0x5be91b={};_0x5be91b[_0xa467('0x42')]=_['keys'](db[_0xa467('0x40')][_0xa467('0x5b')]);_0x5be91b[_0xa467('0x44')]=_['keys'](_0xbe17ec[_0xa467('0x44')]);_0x5be91b[_0xa467('0x46')]=_[_0xa467('0x47')](_0x5be91b[_0xa467('0x42')],_0x5be91b[_0xa467('0x44')]);_0x3341f2['attributes']=_[_0xa467('0x47')](_0x5be91b[_0xa467('0x42')],qs[_0xa467('0x49')](_0xbe17ec[_0xa467('0x44')][_0xa467('0x49')]));_0x3341f2['attributes']=_0x3341f2[_0xa467('0x48')][_0xa467('0x5c')]?_0x3341f2[_0xa467('0x48')]:_0x5be91b['model'];if(_0xbe17ec[_0xa467('0x44')][_0xa467('0x53')]){_0x3341f2[_0xa467('0x54')]=[{'all':!![]}];}_0x3341f2=_['merge']({},_0x3341f2,_0xbe17ec[_0xa467('0x52')]);return db[_0xa467('0x40')][_0xa467('0x5d')](_0x3341f2)[_0xa467('0x1e')](handleEntityNotFound(_0x1b0a52,null))[_0xa467('0x1e')](respondWithResult(_0x1b0a52,null))['catch'](handleError(_0x1b0a52,null));};exports[_0xa467('0x34')]=function(_0x9c961a,_0x35af5a){if(_0x9c961a[_0xa467('0x5e')]['id']){delete _0x9c961a['body']['id'];}return db[_0xa467('0x40')][_0xa467('0x5d')]({'where':{'id':_0x9c961a['params']['id']},'include':[{'model':db[_0xa467('0x3d')],'as':_0xa467('0x3e')},{'model':db[_0xa467('0x3f')],'as':_0xa467('0x58')},{'model':db[_0xa467('0x59')],'as':'mandatoryDispositionPause'}]})[_0xa467('0x1e')](handleEntityNotFound(_0x35af5a,null))[_0xa467('0x1e')](saveUpdates(_0x9c961a[_0xa467('0x5e')],null))[_0xa467('0x1e')](function(_0x54d334){if(_0x54d334&&_0x9c961a[_0xa467('0x5e')][_0xa467('0x3e')]){return db['MailServerIn'][_0xa467('0x34')](_0x9c961a[_0xa467('0x5e')][_0xa467('0x3e')],{'where':{'MailAccountId':_0x54d334['id']}})['then'](function(){return _0x54d334;});}return _0x54d334;})[_0xa467('0x1e')](function(_0x1ecc8b){if(_0x1ecc8b&&_0x9c961a[_0xa467('0x5e')][_0xa467('0x58')]){return db[_0xa467('0x3f')][_0xa467('0x34')](_0x9c961a[_0xa467('0x5e')][_0xa467('0x58')],{'where':{'MailAccountId':_0x1ecc8b['id']}})[_0xa467('0x1e')](function(){return _0x1ecc8b;});}return _0x1ecc8b;})[_0xa467('0x1e')](respondWithResult(_0x35af5a,null))[_0xa467('0x29')](handleError(_0x35af5a,null));};exports['describe']=function(_0x54b9a6,_0x1e58c4){return db[_0xa467('0x40')][_0xa467('0x5f')]()[_0xa467('0x1e')](respondWithResult(_0x1e58c4,null))[_0xa467('0x29')](handleError(_0x1e58c4,null));};exports[_0xa467('0x60')]=function(_0x51923c,_0x125cde,_0xc13421){if(_0x51923c['body']['id']){delete _0x51923c[_0xa467('0x5e')]['id'];}return db[_0xa467('0x40')]['find']({'where':{'id':_0x51923c[_0xa467('0x57')]['id']}})['then'](handleEntityNotFound(_0x125cde,null))[_0xa467('0x1e')](function(_0x23faf0){if(_0x23faf0){_0x51923c[_0xa467('0x5e')][_0xa467('0x61')]=_0x23faf0['id'];return db[_0xa467('0x62')][_0xa467('0x63')](_0x51923c[_0xa467('0x5e')]);}})['then'](respondWithResult(_0x125cde,null))[_0xa467('0x29')](handleError(_0x125cde,null));};exports[_0xa467('0x64')]=function(_0x9cd017,_0x11b0fc,_0x286582){var _0x3a34e8={'raw':![],'where':{}};var _0x2f6600={};var _0x1ace2a={'count':0x0,'rows':[]};return db[_0xa467('0x40')][_0xa467('0x65')]({'where':{'id':_0x9cd017[_0xa467('0x57')]['id']}})[_0xa467('0x1e')](handleEntityNotFound(_0x11b0fc,null))[_0xa467('0x1e')](function(_0x571aea){if(_0x571aea){_0x2f6600[_0xa467('0x42')]=_[_0xa467('0x45')](db[_0xa467('0x62')]['rawAttributes']);_0x2f6600[_0xa467('0x44')]=_[_0xa467('0x45')](_0x9cd017[_0xa467('0x44')]);_0x2f6600[_0xa467('0x46')]=_[_0xa467('0x47')](_0x2f6600[_0xa467('0x42')],_0x2f6600[_0xa467('0x44')]);_0x3a34e8['attributes']=_[_0xa467('0x47')](_0x2f6600[_0xa467('0x42')],qs['fields'](_0x9cd017[_0xa467('0x44')][_0xa467('0x49')]));_0x3a34e8[_0xa467('0x48')]=_0x3a34e8[_0xa467('0x48')][_0xa467('0x5c')]?_0x3a34e8[_0xa467('0x48')]:_0x2f6600[_0xa467('0x42')];if(!_0x9cd017[_0xa467('0x44')][_0xa467('0x4a')]('nolimit')){_0x3a34e8[_0xa467('0x2f')]=qs['limit'](_0x9cd017['query'][_0xa467('0x2f')]);_0x3a34e8[_0xa467('0x2d')]=qs['offset'](_0x9cd017['query'][_0xa467('0x2d')]);}_0x3a34e8[_0xa467('0x66')]=qs[_0xa467('0x4c')](_0x9cd017[_0xa467('0x44')][_0xa467('0x4c')]);_0x3a34e8[_0xa467('0x4d')]=qs[_0xa467('0x46')](_[_0xa467('0x4e')](_0x9cd017[_0xa467('0x44')],_0x2f6600['filters']));_0x3a34e8[_0xa467('0x4d')][_0xa467('0x61')]=_0x571aea['id'];if(_0x9cd017[_0xa467('0x44')]['filter']){_0x3a34e8[_0xa467('0x4d')]=_[_0xa467('0x51')](_0x3a34e8[_0xa467('0x4d')],{'$or':_[_0xa467('0x43')](_0x3a34e8[_0xa467('0x48')],function(_0x2e55a4){var _0x3dfb60={};_0x3dfb60[_0x2e55a4]={'$like':'%'+_0x9cd017[_0xa467('0x44')]['filter']+'%'};return _0x3dfb60;})});}_0x3a34e8=_[_0xa467('0x51')]({},_0x3a34e8,_0x9cd017['options']);return db[_0xa467('0x62')]['count']({'where':_0x3a34e8[_0xa467('0x4d')]})[_0xa467('0x1e')](function(_0x31e3b3){_0x1ace2a[_0xa467('0x30')]=_0x31e3b3;if(_0x9cd017[_0xa467('0x44')]['includeAll']){_0x3a34e8['include']=[{'all':!![]}];}return db[_0xa467('0x62')]['findAll'](_0x3a34e8);})['then'](function(_0x5cfac2){_0x1ace2a[_0xa467('0x56')]=_0x5cfac2;return _0x1ace2a;});}})[_0xa467('0x1e')](respondWithFilteredResult(_0x11b0fc,_0x3a34e8))['catch'](handleError(_0x11b0fc,null));};exports[_0xa467('0x67')]=function(_0x3aef5e,_0x2e3e31,_0x197ee6){return db[_0xa467('0x40')][_0xa467('0x5d')]({'where':{'id':_0x3aef5e['params']['id']}})[_0xa467('0x1e')](handleEntityNotFound(_0x2e3e31,null))[_0xa467('0x1e')](function(_0x212d00){if(_0x212d00){return _0x212d00[_0xa467('0x67')](_0x3aef5e[_0xa467('0x44')]['ids']);}})[_0xa467('0x1e')](respondWithStatusCode(_0x2e3e31,null))['catch'](handleError(_0x2e3e31,null));};exports[_0xa467('0x68')]=function(_0x269fb0,_0x21997f,_0x35e972){if(_0x269fb0[_0xa467('0x5e')]['id']){delete _0x269fb0[_0xa467('0x5e')]['id'];}return db[_0xa467('0x40')][_0xa467('0x5d')]({'where':{'id':_0x269fb0[_0xa467('0x57')]['id']}})[_0xa467('0x1e')](handleEntityNotFound(_0x21997f,null))[_0xa467('0x1e')](function(_0x3cb65d){if(_0x3cb65d){_0x269fb0[_0xa467('0x5e')]['MailAccountId']=_0x3cb65d['id'];return db['CannedAnswer']['create'](_0x269fb0['body']);}})[_0xa467('0x1e')](respondWithResult(_0x21997f,null))[_0xa467('0x29')](handleError(_0x21997f,null));};exports[_0xa467('0x69')]=function(_0x475f9,_0x349b85,_0xa63418){var _0x4cbfe6={'raw':![],'where':{}};var _0x62bf0d={};var _0x1f43d5={'count':0x0,'rows':[]};return db[_0xa467('0x40')][_0xa467('0x65')]({'where':{'id':_0x475f9[_0xa467('0x57')]['id']}})[_0xa467('0x1e')](handleEntityNotFound(_0x349b85,null))[_0xa467('0x1e')](function(_0x2f7da0){if(_0x2f7da0){_0x62bf0d['model']=_[_0xa467('0x45')](db['CannedAnswer']['rawAttributes']);_0x62bf0d['query']=_['keys'](_0x475f9[_0xa467('0x44')]);_0x62bf0d[_0xa467('0x46')]=_[_0xa467('0x47')](_0x62bf0d[_0xa467('0x42')],_0x62bf0d[_0xa467('0x44')]);_0x4cbfe6[_0xa467('0x48')]=_[_0xa467('0x47')](_0x62bf0d[_0xa467('0x42')],qs[_0xa467('0x49')](_0x475f9[_0xa467('0x44')]['fields']));_0x4cbfe6[_0xa467('0x48')]=_0x4cbfe6[_0xa467('0x48')][_0xa467('0x5c')]?_0x4cbfe6[_0xa467('0x48')]:_0x62bf0d[_0xa467('0x42')];if(!_0x475f9[_0xa467('0x44')]['hasOwnProperty'](_0xa467('0x4b'))){_0x4cbfe6[_0xa467('0x2f')]=qs[_0xa467('0x2f')](_0x475f9['query'][_0xa467('0x2f')]);_0x4cbfe6[_0xa467('0x2d')]=qs[_0xa467('0x2d')](_0x475f9[_0xa467('0x44')][_0xa467('0x2d')]);}_0x4cbfe6[_0xa467('0x66')]=qs[_0xa467('0x4c')](_0x475f9['query'][_0xa467('0x4c')]);_0x4cbfe6['where']=qs[_0xa467('0x46')](_['pick'](_0x475f9[_0xa467('0x44')],_0x62bf0d['filters']));_0x4cbfe6['where'][_0xa467('0x61')]=_0x2f7da0['id'];if(_0x475f9['query'][_0xa467('0x4f')]){_0x4cbfe6[_0xa467('0x4d')]=_[_0xa467('0x51')](_0x4cbfe6[_0xa467('0x4d')],{'$or':_[_0xa467('0x43')](_0x4cbfe6[_0xa467('0x48')],function(_0xcf6237){var _0x1537dd={};_0x1537dd[_0xcf6237]={'$like':'%'+_0x475f9[_0xa467('0x44')][_0xa467('0x4f')]+'%'};return _0x1537dd;})});}_0x4cbfe6=_[_0xa467('0x51')]({},_0x4cbfe6,_0x475f9[_0xa467('0x52')]);return db['CannedAnswer'][_0xa467('0x30')]({'where':_0x4cbfe6[_0xa467('0x4d')]})[_0xa467('0x1e')](function(_0x143496){_0x1f43d5[_0xa467('0x30')]=_0x143496;if(_0x475f9['query'][_0xa467('0x53')]){_0x4cbfe6[_0xa467('0x54')]=[{'all':!![]}];}return db[_0xa467('0x6a')][_0xa467('0x55')](_0x4cbfe6);})['then'](function(_0x2e96ee){_0x1f43d5[_0xa467('0x56')]=_0x2e96ee;return _0x1f43d5;});}})[_0xa467('0x1e')](respondWithFilteredResult(_0x349b85,_0x4cbfe6))[_0xa467('0x29')](handleError(_0x349b85,null));};exports[_0xa467('0x6b')]=function(_0x4fdf1a,_0x489a66,_0x131c4b){return db[_0xa467('0x40')]['find']({'where':{'id':_0x4fdf1a[_0xa467('0x57')]['id']}})[_0xa467('0x1e')](handleEntityNotFound(_0x489a66,null))[_0xa467('0x1e')](function(_0x3e4996){if(_0x3e4996){return _0x3e4996['removeAnswers'](_0x4fdf1a[_0xa467('0x44')][_0xa467('0x6c')]);}})['then'](respondWithStatusCode(_0x489a66,null))[_0xa467('0x29')](handleError(_0x489a66,null));};exports[_0xa467('0x63')]=function(_0xb5662,_0x5d9789){var _0x15a969={'name':_0xb5662['body'][_0xa467('0x3a')],'key':_0xb5662['body']['key'],'email':_0xb5662['body'][_0xa467('0x6d')],'ListId':_0xb5662[_0xa467('0x5e')][_0xa467('0x6e')],'active':!_[_0xa467('0x6f')](_0xb5662['body'][_0xa467('0x70')])?_0xb5662['body'][_0xa467('0x70')]:!![],'description':_0xb5662[_0xa467('0x5e')][_0xa467('0x71')]||null,'Imap':{},'Smtp':{}};if(_[_0xa467('0x6f')](_0xb5662[_0xa467('0x5e')][_0xa467('0x72')])){if(_0xb5662[_0xa467('0x5e')][_0xa467('0x73')]){_0x15a969[_0xa467('0x3e')]['user']=_0x15a969[_0xa467('0x58')][_0xa467('0x74')]=_0xb5662['body']['cuser'];_0x15a969[_0xa467('0x3e')][_0xa467('0x75')]=_0x15a969['Smtp'][_0xa467('0x76')]=_0xb5662['body'][_0xa467('0x77')];}else{_0x15a969['Imap'][_0xa467('0x78')]=_0x15a969[_0xa467('0x58')][_0xa467('0x78')]=![];}_0x15a969[_0xa467('0x3e')][_0xa467('0x79')]=_0xb5662[_0xa467('0x5e')][_0xa467('0x3e')][_0xa467('0x79')];_0x15a969[_0xa467('0x3e')]['port']=_0xb5662[_0xa467('0x5e')][_0xa467('0x3e')][_0xa467('0x7a')];_0x15a969[_0xa467('0x58')]['host']=_0xb5662[_0xa467('0x5e')][_0xa467('0x58')]['host'];_0x15a969[_0xa467('0x58')]['port']=_0xb5662[_0xa467('0x5e')][_0xa467('0x58')][_0xa467('0x7a')];}else{_0x15a969[_0xa467('0x3e')][_0xa467('0x7b')]=_0x15a969[_0xa467('0x58')][_0xa467('0x7b')]=_0xb5662['body']['cservice'];_0x15a969[_0xa467('0x3e')][_0xa467('0x74')]=_0x15a969['Smtp'][_0xa467('0x74')]=_0xb5662[_0xa467('0x5e')][_0xa467('0x7c')];_0x15a969['Imap'][_0xa467('0x75')]=_0x15a969[_0xa467('0x58')][_0xa467('0x76')]=_0xb5662[_0xa467('0x5e')]['cpassword'];}return db[_0xa467('0x40')][_0xa467('0x63')](_0x15a969,{'include':[{'model':db[_0xa467('0x3f')],'as':_0xa467('0x58')},{'model':db[_0xa467('0x3d')],'as':_0xa467('0x3e')}]})['then'](function(_0x554324){var _0x5d50b3=_0xb5662['user']['get']({'plain':!![]});if(!_0x5d50b3)throw new Error(_0xa467('0x7d'));if(_0x5d50b3[_0xa467('0x7e')]===_0xa467('0x74')){var _0x2711a9=_0x554324[_0xa467('0x35')]({'plain':!![]});return db[_0xa467('0x7f')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x5d50b3[_0xa467('0x80')]},'raw':!![]})[_0xa467('0x1e')](function(_0xa87bae){if(_0xa87bae&&_0xa87bae[_0xa467('0x81')]===0x0){return db['UserProfileResource'][_0xa467('0x63')]({'name':_0x2711a9['name'],'resourceId':_0x2711a9['id'],'type':_0xa87bae[_0xa467('0x3a')],'sectionId':_0xa87bae['id']},{})[_0xa467('0x1e')](function(){return _0x554324;});}else{return _0x554324;}})[_0xa467('0x29')](function(_0x56d622){logger[_0xa467('0x24')](_0xa467('0x82'),_0x56d622);throw _0x56d622;});}return _0x554324;})[_0xa467('0x1e')](respondWithResult(_0x5d9789,0xc9))[_0xa467('0x29')](handleError(_0x5d9789,null));};exports['getImap']=function(_0x5efc0e,_0x34aa63,_0x196b49){return db[_0xa467('0x40')][_0xa467('0x65')]({'where':{'id':_0x5efc0e[_0xa467('0x57')]['id']}})[_0xa467('0x1e')](handleEntityNotFound(_0x34aa63,null))[_0xa467('0x1e')](function(_0x525018){if(_0x525018){return _0x525018['getImap']();}return null;})['then'](respondWithResult(_0x34aa63,null))['catch'](handleError(_0x34aa63,null));};exports[_0xa467('0x83')]=function(_0x3a7154,_0x88aa34,_0x298767){if(_0x3a7154[_0xa467('0x5e')]['id']){delete _0x3a7154[_0xa467('0x5e')]['id'];}return db['MailAccount'][_0xa467('0x5d')]({'where':{'id':_0x3a7154[_0xa467('0x57')]['id']}})[_0xa467('0x1e')](handleEntityNotFound(_0x88aa34,null))[_0xa467('0x1e')](function(_0x43482c){if(_0x43482c){_0x3a7154['body'][_0xa467('0x61')]=_0x43482c['id'];return db[_0xa467('0x3d')][_0xa467('0x63')](_0x3a7154[_0xa467('0x5e')]);}})['then'](respondWithResult(_0x88aa34,null))[_0xa467('0x29')](handleError(_0x88aa34,null));};exports[_0xa467('0x84')]=function(_0x19cbb4,_0x38fe92,_0x3529c1){return db[_0xa467('0x40')][_0xa467('0x65')]({'where':{'id':_0x19cbb4['params']['id']}})['then'](handleEntityNotFound(_0x38fe92,null))['then'](function(_0x14a2cd){if(_0x14a2cd){return _0x14a2cd[_0xa467('0x85')](null);}return null;})[_0xa467('0x1e')](respondWithStatusCode(_0x38fe92,null))[_0xa467('0x29')](handleError(_0x38fe92,null));};exports[_0xa467('0x86')]=function(_0x445cf4,_0x4c373f,_0x29b041){return db[_0xa467('0x40')][_0xa467('0x65')]({'where':{'id':_0x445cf4[_0xa467('0x57')]['id']}})['then'](handleEntityNotFound(_0x4c373f,null))[_0xa467('0x1e')](function(_0xce4e32){if(_0xce4e32){return _0xce4e32['getSmtp']();}return null;})[_0xa467('0x1e')](respondWithResult(_0x4c373f,null))['catch'](handleError(_0x4c373f,null));};exports[_0xa467('0x87')]=function(_0x327b54,_0x213937,_0xa816c1){if(_0x327b54['body']['id']){delete _0x327b54['body']['id'];}return db[_0xa467('0x40')][_0xa467('0x5d')]({'where':{'id':_0x327b54['params']['id']}})['then'](handleEntityNotFound(_0x213937,null))['then'](function(_0x1c1f18){if(_0x1c1f18){_0x327b54[_0xa467('0x5e')][_0xa467('0x61')]=_0x1c1f18['id'];return db[_0xa467('0x3f')]['create'](_0x327b54[_0xa467('0x5e')]);}})[_0xa467('0x1e')](respondWithResult(_0x213937,null))[_0xa467('0x29')](handleError(_0x213937,null));};exports[_0xa467('0x88')]=function(_0x45a703,_0x289312,_0x45f782){return db['MailAccount'][_0xa467('0x65')]({'where':{'id':_0x45a703[_0xa467('0x57')]['id']}})[_0xa467('0x1e')](handleEntityNotFound(_0x289312,null))[_0xa467('0x1e')](function(_0x5e91fd){if(_0x5e91fd){return _0x5e91fd[_0xa467('0x89')](null);}return null;})[_0xa467('0x1e')](respondWithStatusCode(_0x289312,null))[_0xa467('0x29')](handleError(_0x289312,null));};exports[_0xa467('0x8a')]=function(_0x1e9fb6,_0x3e1fc5,_0x13f9ab){return db[_0xa467('0x8b')][_0xa467('0x5d')]({'where':{'id':_0x1e9fb6['params']['id']}})[_0xa467('0x1e')](handleEntityNotFound(_0x3e1fc5,null))['then'](function(_0x5bc17b){if(_0x5bc17b){return _0x5bc17b[_0xa467('0x8a')](_0x1e9fb6[_0xa467('0x5e')][_0xa467('0x6c')],_['omit'](_0x1e9fb6[_0xa467('0x5e')],[_0xa467('0x6c'),'id'])||{});}})[_0xa467('0x1e')](respondWithResult(_0x3e1fc5,null))[_0xa467('0x29')](handleError(_0x3e1fc5,null));};exports['getInteractions']=function(_0xd4f1e,_0x26d4d3,_0x4507e8){var _0x52727b={'raw':![],'where':{}};var _0x145a56={};var _0x305a7e={'count':0x0,'rows':[]};return db[_0xa467('0x40')][_0xa467('0x65')]({'where':{'id':_0xd4f1e[_0xa467('0x57')]['id']}})[_0xa467('0x1e')](handleEntityNotFound(_0x26d4d3,null))[_0xa467('0x1e')](function(_0x2375ee){if(_0x2375ee){_0x145a56['model']=_['keys'](db['MailInteraction'][_0xa467('0x5b')]);_0x145a56['query']=_['keys'](_0xd4f1e[_0xa467('0x44')]);_0x145a56[_0xa467('0x46')]=_[_0xa467('0x47')](_0x145a56[_0xa467('0x42')],_0x145a56[_0xa467('0x44')]);_0x52727b['attributes']=_[_0xa467('0x47')](_0x145a56[_0xa467('0x42')],qs[_0xa467('0x49')](_0xd4f1e[_0xa467('0x44')][_0xa467('0x49')]));_0x52727b[_0xa467('0x48')]=_0x52727b[_0xa467('0x48')][_0xa467('0x5c')]?_0x52727b[_0xa467('0x48')]:_0x145a56['model'];if(!_0xd4f1e[_0xa467('0x44')][_0xa467('0x4a')](_0xa467('0x4b'))){_0x52727b[_0xa467('0x2f')]=qs[_0xa467('0x2f')](_0xd4f1e['query'][_0xa467('0x2f')]);_0x52727b[_0xa467('0x2d')]=qs['offset'](_0xd4f1e[_0xa467('0x44')][_0xa467('0x2d')]);}_0x52727b[_0xa467('0x66')]=qs['sort'](_0xd4f1e['query'][_0xa467('0x4c')]);_0x52727b[_0xa467('0x4d')]=qs[_0xa467('0x46')](_[_0xa467('0x4e')](_0xd4f1e[_0xa467('0x44')],_0x145a56[_0xa467('0x46')]));_0x52727b[_0xa467('0x4d')]['MailAccountId']=_0x2375ee['id'];if(_0xd4f1e[_0xa467('0x44')][_0xa467('0x4f')]){_0x52727b[_0xa467('0x4d')]=_['merge'](_0x52727b[_0xa467('0x4d')],{'$or':_['map'](_0x52727b[_0xa467('0x48')],function(_0x5b2a2d){var _0x577e79={};_0x577e79[_0x5b2a2d]={'$like':'%'+_0xd4f1e[_0xa467('0x44')]['filter']+'%'};return _0x577e79;})});}_0x52727b=_[_0xa467('0x51')]({},_0x52727b,_0xd4f1e[_0xa467('0x52')]);return db['MailInteraction'][_0xa467('0x30')]({'where':_0x52727b[_0xa467('0x4d')]})[_0xa467('0x1e')](function(_0x105365){_0x305a7e[_0xa467('0x30')]=_0x105365;if(_0xd4f1e[_0xa467('0x44')][_0xa467('0x53')]){_0x52727b['include']=[{'model':db[_0xa467('0x8c')],'as':_0xa467('0x8d'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xa467('0x3a'),_0xa467('0x8e'),_0xa467('0x8f')],'required':![]},{'model':db[_0xa467('0x90')],'as':_0xa467('0x91'),'attributes':['id',_0xa467('0x3a'),_0xa467('0x92')],'where':_0xd4f1e[_0xa467('0x44')]['tag']?{'id':_0xd4f1e[_0xa467('0x44')][_0xa467('0x93')]}:undefined,'required':_0xd4f1e['query']['tag']?!![]:![]}];}return db[_0xa467('0x8b')][_0xa467('0x55')](_0x52727b);})[_0xa467('0x1e')](function(_0x15fbd2){_0x305a7e[_0xa467('0x56')]=_0x15fbd2;return _0x305a7e;});}})[_0xa467('0x1e')](respondWithFilteredResult(_0x26d4d3,_0x52727b))[_0xa467('0x29')](handleError(_0x26d4d3,null));};exports['addApplications']=function(_0x5aa47a,_0x24155c,_0x203521){return db[_0xa467('0x40')][_0xa467('0x65')]({'where':{'id':_0x5aa47a[_0xa467('0x57')]['id']}})['then'](handleEntityNotFound(_0x24155c,null))[_0xa467('0x1e')](function(_0x3d2f22){if(_0x3d2f22){return db[_0xa467('0x94')][_0xa467('0x95')](function(_0x2e0127){return db[_0xa467('0x96')][_0xa467('0x37')]({'where':{'MailAccountId':_0x5aa47a[_0xa467('0x57')]['id']},'transaction':_0x2e0127})['then'](function(_0x6797e8){var _0x27f96f=_[_0xa467('0x43')](_0x5aa47a[_0xa467('0x5e')],function(_0x1e050d){_0x1e050d[_0xa467('0x61')]=_0x5aa47a[_0xa467('0x57')]['id'];return _0x1e050d;});return db[_0xa467('0x96')][_0xa467('0x97')](_0x27f96f,{'transaction':_0x2e0127});});})['then'](function(){return db[_0xa467('0x96')][_0xa467('0x98')]({'where':{'MailAccountId':_0x5aa47a['params']['id']},'order':_0xa467('0x99')});});}})['then'](respondWithResult(_0x24155c,null))[_0xa467('0x29')](handleError(_0x24155c,null));};exports[_0xa467('0x9a')]=function(_0x5d6162,_0x33d43d,_0x5e2d11){var _0x31bda3={};var _0x5a000d={};var _0x323160;var _0x41a58d;return db['MailAccount'][_0xa467('0x65')]({'where':{'id':_0x5d6162[_0xa467('0x57')]['id']}})['then'](handleEntityNotFound(_0x33d43d,null))['then'](function(_0xcaa669){if(_0xcaa669){_0x323160=_0xcaa669;_0x5a000d[_0xa467('0x42')]=_['keys'](db[_0xa467('0x96')][_0xa467('0x5b')]);_0x5a000d['query']=_[_0xa467('0x45')](_0x5d6162[_0xa467('0x44')]);_0x5a000d[_0xa467('0x46')]=_[_0xa467('0x47')](_0x5a000d['model'],_0x5a000d[_0xa467('0x44')]);_0x31bda3[_0xa467('0x48')]=_[_0xa467('0x47')](_0x5a000d[_0xa467('0x42')],qs['fields'](_0x5d6162[_0xa467('0x44')][_0xa467('0x49')]));_0x31bda3[_0xa467('0x48')]=_0x31bda3['attributes'][_0xa467('0x5c')]?_0x31bda3[_0xa467('0x48')]:_0x5a000d['model'];_0x31bda3[_0xa467('0x66')]=qs[_0xa467('0x4c')](_0x5d6162[_0xa467('0x44')][_0xa467('0x4c')]);_0x31bda3['where']=qs['filters'](_[_0xa467('0x4e')](_0x5d6162[_0xa467('0x44')],_0x5a000d['filters']));if(_0x5d6162[_0xa467('0x44')]['filter']){_0x31bda3[_0xa467('0x4d')]=_[_0xa467('0x51')](_0x31bda3[_0xa467('0x4d')],{'$or':_[_0xa467('0x43')](_0x31bda3['attributes'],function(_0x3e22bc){var _0x4eb058={};_0x4eb058[_0x3e22bc]={'$like':'%'+_0x5d6162[_0xa467('0x44')][_0xa467('0x4f')]+'%'};return _0x4eb058;})});}_0x31bda3=_['merge']({},_0x31bda3,_0x5d6162['options']);return _0x323160[_0xa467('0x9a')](_0x31bda3);}})[_0xa467('0x1e')](function(_0x79a42b){if(_0x79a42b){_0x41a58d=_0x79a42b[_0xa467('0x5c')];if(!_0x5d6162[_0xa467('0x44')][_0xa467('0x4a')]('nolimit')){_0x31bda3[_0xa467('0x2f')]=qs[_0xa467('0x2f')](_0x5d6162[_0xa467('0x44')][_0xa467('0x2f')]);_0x31bda3[_0xa467('0x2d')]=qs[_0xa467('0x2d')](_0x5d6162[_0xa467('0x44')][_0xa467('0x2d')]);}return _0x323160[_0xa467('0x9a')](_0x31bda3);}})[_0xa467('0x1e')](function(_0x950be8){if(_0x950be8){return _0x950be8?{'count':_0x41a58d,'rows':_0x950be8}:null;}})[_0xa467('0x1e')](respondWithResult(_0x33d43d,null))['catch'](handleError(_0x33d43d,null));};exports[_0xa467('0x9b')]=function(_0x34f09e,_0x2ed533,_0x1507a0){var _0x4cb0b2={'raw':!![],'where':{}};var _0x3f4691={};var _0x17ba66={'count':0x0,'rows':[]};return db[_0xa467('0x40')][_0xa467('0x65')]({'where':{'id':_0x34f09e['params']['id']}})[_0xa467('0x1e')](handleEntityNotFound(_0x2ed533,null))['then'](function(_0xef0717){if(_0xef0717){_0x3f4691[_0xa467('0x42')]=_[_0xa467('0x45')](db[_0xa467('0x9c')][_0xa467('0x5b')]);_0x3f4691[_0xa467('0x44')]=_[_0xa467('0x45')](_0x34f09e[_0xa467('0x44')]);_0x3f4691['filters']=_['intersection'](_0x3f4691[_0xa467('0x42')],_0x3f4691['query']);_0x4cb0b2[_0xa467('0x48')]=_['intersection'](_0x3f4691[_0xa467('0x42')],qs[_0xa467('0x49')](_0x34f09e['query'][_0xa467('0x49')]));_0x4cb0b2[_0xa467('0x48')]=_0x4cb0b2[_0xa467('0x48')]['length']?_0x4cb0b2[_0xa467('0x48')]:_0x3f4691[_0xa467('0x42')];if(!_0x34f09e[_0xa467('0x44')][_0xa467('0x4a')]('nolimit')){_0x4cb0b2[_0xa467('0x2f')]=qs['limit'](_0x34f09e[_0xa467('0x44')]['limit']);_0x4cb0b2[_0xa467('0x2d')]=qs['offset'](_0x34f09e[_0xa467('0x44')][_0xa467('0x2d')]);}_0x4cb0b2[_0xa467('0x66')]=qs[_0xa467('0x4c')](_0x34f09e[_0xa467('0x44')]['sort']);_0x4cb0b2[_0xa467('0x4d')]=qs[_0xa467('0x46')](_['pick'](_0x34f09e[_0xa467('0x44')],_0x3f4691[_0xa467('0x46')]));_0x4cb0b2[_0xa467('0x4d')][_0xa467('0x61')]=_0xef0717['id'];if(_0x34f09e['query'][_0xa467('0x4f')]){_0x4cb0b2[_0xa467('0x4d')]=_['merge'](_0x4cb0b2[_0xa467('0x4d')],{'$or':_['map'](_0x4cb0b2[_0xa467('0x48')],function(_0x3b6061){var _0x38fbe7={};_0x38fbe7[_0x3b6061]={'$like':'%'+_0x34f09e['query'][_0xa467('0x4f')]+'%'};return _0x38fbe7;})});}if(_0x34f09e[_0xa467('0x44')][_0xa467('0x9d')]){var _0xd38dda=_0x34f09e[_0xa467('0x44')][_0xa467('0x9d')][_0xa467('0x9e')](',');var _0x291c01={};_0x291c01[_0xd38dda[0x0]]={'$gte':moment(_0xd38dda[0x1])['format'](_0xa467('0x9f'))};_0x4cb0b2[_0xa467('0x4d')]=_[_0xa467('0x51')](_0x4cb0b2[_0xa467('0x4d')],_0x291c01);}_0x4cb0b2=_[_0xa467('0x51')]({},_0x4cb0b2,_0x34f09e['options']);return db['MailMessage'][_0xa467('0x30')]({'where':_0x4cb0b2[_0xa467('0x4d')]})[_0xa467('0x1e')](function(_0x2536f7){_0x17ba66[_0xa467('0x30')]=_0x2536f7;if(_0x34f09e['query'][_0xa467('0x53')]){_0x4cb0b2[_0xa467('0x54')]=[{'all':!![]}];}return db[_0xa467('0x9c')][_0xa467('0x55')](_0x4cb0b2);})[_0xa467('0x1e')](function(_0x5eaf8f){if(_0x34f09e[_0xa467('0x44')][_0xa467('0xa0')]===_0xa467('0xa1')){for(var _0x5b5278=0x0;_0x5b5278<_0x5eaf8f[_0xa467('0x5c')];_0x5b5278++){_0x5eaf8f[_0x5b5278][_0xa467('0x5e')]=juice(_0x5eaf8f[_0x5b5278][_0xa467('0x5e')]);}}_0x17ba66[_0xa467('0x56')]=_0x5eaf8f;return _0x17ba66;});}})[_0xa467('0x1e')](respondWithFilteredResult(_0x2ed533,_0x4cb0b2))[_0xa467('0x29')](handleError(_0x2ed533,null));};exports[_0xa467('0x3b')]=function(_0x173917,_0x32184f,_0x272f8d){var _0x4996d1,_0x44b01c={},_0xe8a5e4;if(_0x173917[_0xa467('0x5e')]['to']){_0xe8a5e4=_0x173917[_0xa467('0x5e')]['to'][_0xa467('0x9e')](',')[0x0];}return db['MailAccount'][_0xa467('0x5d')]({'where':{'id':_0x173917[_0xa467('0x57')]['id']},'include':[{'model':db[_0xa467('0xa2')],'as':'List','include':[{'model':db[_0xa467('0x8c')],'as':_0xa467('0xa3'),'where':{'email':_0xe8a5e4},'limit':0x1,'order':[['updatedAt',_0xa467('0xa4')]]}]},{'model':db[_0xa467('0x3f')],'as':_0xa467('0x58'),'raw':!![]}]})[_0xa467('0x1e')](handleEntityNotFound(_0x32184f,null))[_0xa467('0x1e')](function(_0x1207f7){if(_0x1207f7){_0x4996d1=_0x1207f7;if(_0x1207f7[_0xa467('0x58')]){if(_[_0xa467('0x6f')](_0x173917[_0xa467('0x5e')][_0xa467('0xa5')])){_0x173917[_0xa467('0x5e')][_0xa467('0xa5')]=util[_0xa467('0xa6')](_0xa467('0xa7'),_0x1207f7['name'],_0x1207f7[_0xa467('0x6d')]||_0x1207f7[_0xa467('0x58')][_0xa467('0x74')]);}if(_0x173917[_0xa467('0x5e')][_0xa467('0xa8')]&&_0x173917[_0xa467('0x5e')][_0xa467('0xa8')]['length']){for(var _0x2b6ff8=0x0;_0x2b6ff8<_0x173917[_0xa467('0x5e')][_0xa467('0xa8')][_0xa467('0x5c')];_0x2b6ff8+=0x1){_0x173917[_0xa467('0x5e')][_0xa467('0xa8')][_0x2b6ff8]={'filename':_0x173917[_0xa467('0x5e')]['attachments'][_0x2b6ff8]['name'],'path':path[_0xa467('0xa9')](config['root'],'server/files/attachments',_0x173917[_0xa467('0x5e')]['attachments'][_0x2b6ff8]['basename'])};}}var _0x24f078={'tls':{'rejectUnauthorized':![]}};if(_[_0xa467('0x6f')](_0x1207f7[_0xa467('0x58')][_0xa467('0x7b')])){if(_0x1207f7['Smtp']['authentication']){_0x24f078[_0xa467('0xaa')]={'user':_0x1207f7[_0xa467('0x58')][_0xa467('0x74')],'pass':_0x1207f7[_0xa467('0x58')][_0xa467('0x76')]};}_0x24f078[_0xa467('0x79')]=_0x1207f7['Smtp']['host'];_0x24f078['port']=_0x1207f7[_0xa467('0x58')][_0xa467('0x7a')];_0x24f078[_0xa467('0xab')]=_0x1207f7[_0xa467('0x58')][_0xa467('0xab')];}else{_0x24f078['service']=_0x1207f7[_0xa467('0x58')][_0xa467('0x7b')];_0x24f078['auth']={'user':_0x1207f7[_0xa467('0x58')][_0xa467('0x74')],'pass':_0x1207f7[_0xa467('0x58')][_0xa467('0x76')]};}return respondWithRpcPromise(_0xa467('0xac'),'sendMail',{'account':_0x24f078,'message':_0x173917[_0xa467('0x5e')]});}else{throw new Error(_0xa467('0xad'));}}})[_0xa467('0x1e')](function(_0x5f1dbd){if(_0x5f1dbd){_0x44b01c=_0x5f1dbd;if(_0x4996d1[_0xa467('0xae')]){if(_0x4996d1[_0xa467('0xae')][_0xa467('0xa3')]['length']){return _0x4996d1['List'][_0xa467('0xa3')][0x0];}else{return db[_0xa467('0x8c')][_0xa467('0x63')](_[_0xa467('0x17')](_0x173917[_0xa467('0x5e')],{'firstName':_0x173917['body']['to'],'email':_0x173917[_0xa467('0x5e')]['to'],'phone':_0x173917['body']['to'],'ListId':_0x4996d1[_0xa467('0x6e')]}));}}else{throw new Error(_0xa467('0xad'));}}})['then'](function(_0x5ed87e){if(_0x5ed87e){var _0x50ffc9={'UserId':_0x173917[_0xa467('0x74')]['id'],'ContactId':_0x5ed87e['id'],'MailAccountId':_0x4996d1['id'],'inReplyTo':_0x44b01c[_0xa467('0xaf')],'to':_0x173917[_0xa467('0x5e')][_0xa467('0xa5')],'cc':_0x173917[_0xa467('0x5e')]['cc'],'subject':_0x173917[_0xa467('0x5e')][_0xa467('0xb0')],'attach':_0x173917[_0xa467('0x5e')][_0xa467('0xb1')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xa467('0xa6')](_0xa467('0x9f')),'lastMsgDirection':_0xa467('0xb2'),'Messages':[_['merge'](_0x173917[_0xa467('0x5e')],{'messageId':_0x44b01c[_0xa467('0xaf')],'sentAt':moment()[_0xa467('0xa6')](_0xa467('0x9f')),'read':!![],'MailAccountId':_0x4996d1['id'],'UserId':_0x173917[_0xa467('0x74')]['id'],'ContactId':_0x5ed87e['id']})]};if(_0x173917[_0xa467('0x5e')][_0xa467('0xb3')]){_0x50ffc9=_[_0xa467('0x51')](_0x50ffc9,_0x173917[_0xa467('0x5e')][_0xa467('0xb3')]);}return db[_0xa467('0x8b')][_0xa467('0x63')](_0x50ffc9,{'include':[{'model':db[_0xa467('0x9c')],'as':'Messages'}]});}})[_0xa467('0x1e')](respondWithResult(_0x32184f,null))['catch'](handleError(_0x32184f,null));};exports[_0xa467('0xb4')]=function(_0xe5bbb0,_0x555cdb,_0x3fd2f8){return db[_0xa467('0x40')][_0xa467('0x5d')]({'where':{'id':_0xe5bbb0[_0xa467('0x57')]['id']},'include':[{'model':db[_0xa467('0x3f')],'as':_0xa467('0x58'),'raw':!![]}]})[_0xa467('0x1e')](handleEntityNotFound(_0x555cdb,null))[_0xa467('0x1e')](function(_0x5d1d13){if(_0x5d1d13&&_0x5d1d13[_0xa467('0x58')]){var _0x4b26e0={'id':_0x5d1d13['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5d1d13['Smtp']['service']){_0x4b26e0[_0xa467('0x7b')]=_0x5d1d13[_0xa467('0x58')][_0xa467('0x7b')];}else{_0x4b26e0[_0xa467('0x79')]=_0x5d1d13['Smtp'][_0xa467('0x79')];_0x4b26e0[_0xa467('0x7a')]=_0x5d1d13[_0xa467('0x58')][_0xa467('0x7a')];_0x4b26e0[_0xa467('0xab')]=_0x5d1d13[_0xa467('0x58')][_0xa467('0xab')];}if(_0x5d1d13['Smtp'][_0xa467('0x78')]){_0x4b26e0[_0xa467('0xaa')]={'user':_0x5d1d13[_0xa467('0x58')][_0xa467('0x74')],'pass':_0x5d1d13['Smtp']['pass']};}return respondWithRpcPromise(_0xa467('0xb5'),_0xa467('0xb4'),{'account':_0x4b26e0});}})[_0xa467('0x1e')](respondWithResult(_0x555cdb,null))[_0xa467('0x29')](handleError(_0x555cdb,null));};exports[_0xa467('0x37')]=function(_0x417b2a,_0x593f0c){return db[_0xa467('0x40')]['find']({'where':{'id':_0x417b2a[_0xa467('0x57')]['id']}})['then'](handleEntityNotFound(_0x593f0c,null))['then'](function(_0x36eb40){if(_0x36eb40&&_0x36eb40[_0xa467('0x7b')]){throw new db[(_0xa467('0xb6'))]['ValidationError'](_0xa467('0xb7'));}return _0x36eb40;})[_0xa467('0x1e')](removeEntity(_0x593f0c,null))['catch'](handleError(_0x593f0c,null));};exports[_0xa467('0xb8')]=function(_0x368538,_0x519250,_0x5a99d0){return db[_0xa467('0x40')][_0xa467('0x5d')]({'where':{'id':_0x368538['params']['id']}})[_0xa467('0x1e')](handleEntityNotFound(_0x519250,null))['then'](function(_0x335214){if(_0x335214){return _0x335214[_0xa467('0xb8')](_0x368538['body'][_0xa467('0x6c')],_['omit'](_0x368538[_0xa467('0x5e')],[_0xa467('0x6c'),'id'])||{})[_0xa467('0xb9')](function(_0x4e5b4c){for(var _0x1a5a46=0x0;_0x1a5a46<_0x368538[_0xa467('0x5e')][_0xa467('0x6c')][_0xa467('0x5c')];_0x1a5a46+=0x1){socket['emit'](_0xa467('0xba'),{'UserId':Number(_0x368538[_0xa467('0x5e')][_0xa467('0x6c')][_0x1a5a46]),'MailAccountId':Number(_0x368538['params']['id'])});}return _0x4e5b4c;});}})[_0xa467('0x1e')](respondWithResult(_0x519250,null))['catch'](handleError(_0x519250,null));};exports[_0xa467('0xbb')]=function(_0x5345ee,_0x204373,_0x9b9261){return db['MailAccount'][_0xa467('0x5d')]({'where':{'id':_0x5345ee[_0xa467('0x57')]['id']}})['then'](handleEntityNotFound(_0x204373,null))[_0xa467('0x1e')](function(_0x2ae249){if(_0x2ae249){return _0x2ae249['removeAgents'](_0x5345ee[_0xa467('0x44')][_0xa467('0x6c')])[_0xa467('0x1e')](function(){if(_[_0xa467('0xbc')](_0x5345ee['query'][_0xa467('0x6c')])){for(var _0x207161=0x0;_0x207161<_0x5345ee[_0xa467('0x44')][_0xa467('0x6c')][_0xa467('0x5c')];_0x207161+=0x1){socket[_0xa467('0xbd')](_0xa467('0xbe'),{'UserId':Number(_0x5345ee[_0xa467('0x44')][_0xa467('0x6c')][_0x207161]),'MailAccountId':Number(_0x5345ee[_0xa467('0x57')]['id'])});}}else{socket[_0xa467('0xbd')](_0xa467('0xbe'),{'UserId':Number(_0x5345ee[_0xa467('0x44')][_0xa467('0x6c')]),'MailAccountId':Number(_0x5345ee[_0xa467('0x57')]['id'])});}});}})[_0xa467('0x1e')](respondWithStatusCode(_0x204373,null))[_0xa467('0x29')](handleError(_0x204373,null));};exports[_0xa467('0xbf')]=function(_0x57cde1,_0x23df0b,_0x127cc9){var _0x117796={};var _0x3d21a9={};var _0x16cf8a;var _0x1196e;return db[_0xa467('0x40')][_0xa467('0x65')]({'where':{'id':_0x57cde1[_0xa467('0x57')]['id']}})[_0xa467('0x1e')](handleEntityNotFound(_0x23df0b,null))['then'](function(_0xbd3d5d){if(_0xbd3d5d){_0x16cf8a=_0xbd3d5d;_0x3d21a9[_0xa467('0x42')]=_[_0xa467('0x45')](db[_0xa467('0xc0')][_0xa467('0x5b')]);_0x3d21a9[_0xa467('0x44')]=_[_0xa467('0x45')](_0x57cde1[_0xa467('0x44')]);_0x3d21a9['filters']=_[_0xa467('0x47')](_0x3d21a9[_0xa467('0x42')],_0x3d21a9['query']);_0x117796['attributes']=_[_0xa467('0x47')](_0x3d21a9[_0xa467('0x42')],qs['fields'](_0x57cde1[_0xa467('0x44')]['fields']));_0x117796[_0xa467('0x48')]=_0x117796[_0xa467('0x48')][_0xa467('0x5c')]?_0x117796['attributes']:_0x3d21a9[_0xa467('0x42')];_0x117796['order']=qs[_0xa467('0x4c')](_0x57cde1[_0xa467('0x44')][_0xa467('0x4c')]);_0x117796[_0xa467('0x4d')]=qs[_0xa467('0x46')](_['pick'](_0x57cde1[_0xa467('0x44')],_0x3d21a9['filters']));if(_0x57cde1['query'][_0xa467('0x4f')]){_0x117796[_0xa467('0x4d')]=_[_0xa467('0x51')](_0x117796[_0xa467('0x4d')],{'$or':_['map'](_0x117796[_0xa467('0x48')],function(_0x32965f){var _0x539d08={};_0x539d08[_0x32965f]={'$like':'%'+_0x57cde1['query'][_0xa467('0x4f')]+'%'};return _0x539d08;})});}_0x117796=_[_0xa467('0x51')]({},_0x117796,_0x57cde1[_0xa467('0x52')]);return _0x16cf8a[_0xa467('0xbf')](_0x117796);}})[_0xa467('0x1e')](function(_0x5003f4){if(_0x5003f4){_0x1196e=_0x5003f4[_0xa467('0x5c')];if(!_0x57cde1[_0xa467('0x44')][_0xa467('0x4a')](_0xa467('0x4b'))){_0x117796[_0xa467('0x2f')]=qs[_0xa467('0x2f')](_0x57cde1[_0xa467('0x44')]['limit']);_0x117796['offset']=qs[_0xa467('0x2d')](_0x57cde1[_0xa467('0x44')][_0xa467('0x2d')]);}return _0x16cf8a['getAgents'](_0x117796);}})[_0xa467('0x1e')](function(_0x294217){if(_0x294217){return _0x294217?{'count':_0x1196e,'rows':_0x294217}:null;}})['then'](respondWithResult(_0x23df0b,null))[_0xa467('0x29')](handleError(_0x23df0b,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 273ca79..b19be3b 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 _0xd69e=['events','../../mysqldb','MailAccount','save','update','hasOwnProperty','hook','exports'];(function(_0x1b89a9,_0x131189){var _0x534db5=function(_0x4135be){while(--_0x4135be){_0x1b89a9['push'](_0x1b89a9['shift']());}};_0x534db5(++_0x131189);}(_0xd69e,0xa0));var _0xed69=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd69e[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0xed69('0x0'));var MailAccount=require(_0xed69('0x1'))['db'][_0xed69('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xed69('0x3'),'afterUpdate':_0xed69('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5c00fe){return function(_0x5b941a,_0x5afae1,_0x3b30c5){MailAccountEvents['emit'](_0x5c00fe+':'+_0x5b941a['id'],_0x5b941a);MailAccountEvents['emit'](_0x5c00fe,_0x5b941a);_0x3b30c5(null);};}for(var e in events){if(events[_0xed69('0x5')](e)){var event=events[e];MailAccount[_0xed69('0x6')](e,emitEvent(event));}}module[_0xed69('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x7cbc=['update','emit','hook','exports','events','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x14b0a7,_0x362bf2){var _0x3c9ac7=function(_0x206e72){while(--_0x206e72){_0x14b0a7['push'](_0x14b0a7['shift']());}};_0x3c9ac7(++_0x362bf2);}(_0x7cbc,0xa4));var _0xc7cb=function(_0x1bbbf0,_0x16e558){_0x1bbbf0=_0x1bbbf0-0x0;var _0xd75d2d=_0x7cbc[_0x1bbbf0];return _0xd75d2d;};'use strict';var EventEmitter=require(_0xc7cb('0x0'));var MailAccount=require(_0xc7cb('0x1'))['db'][_0xc7cb('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xc7cb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc7cb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2a01eb){return function(_0x2227de,_0x20a99f,_0x877152){MailAccountEvents['emit'](_0x2a01eb+':'+_0x2227de['id'],_0x2227de);MailAccountEvents[_0xc7cb('0x5')](_0x2a01eb,_0x2227de);_0x877152(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xc7cb('0x6')](e,emitEvent(event));}}module[_0xc7cb('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 29359f1..72ecac3 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 _0x345f=['../../config/environment','./mailAccount.attributes','define','MailAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x256cf0,_0x14ae71){var _0x358a13=function(_0x1f57f0){while(--_0x1f57f0){_0x256cf0['push'](_0x256cf0['shift']());}};_0x358a13(++_0x14ae71);}(_0x345f,0x70));var _0xf345=function(_0x476b00,_0x250877){_0x476b00=_0x476b00-0x0;var _0x44ec8e=_0x345f[_0x476b00];return _0x44ec8e;};'use strict';var _=require(_0xf345('0x0'));var util=require(_0xf345('0x1'));var logger=require(_0xf345('0x2'))(_0xf345('0x3'));var moment=require(_0xf345('0x4'));var BPromise=require(_0xf345('0x5'));var rp=require(_0xf345('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf345('0x7'));var config=require(_0xf345('0x8'));var attributes=require(_0xf345('0x9'));module['exports']=function(_0x4e15d9,_0x2fd4f5){return _0x4e15d9[_0xf345('0xa')](_0xf345('0xb'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12d7=['request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','util','../../config/logger','api'];(function(_0x109cdc,_0x19bdcb){var _0x9269e8=function(_0x4e7b5f){while(--_0x4e7b5f){_0x109cdc['push'](_0x109cdc['shift']());}};_0x9269e8(++_0x19bdcb);}(_0x12d7,0x1b6));var _0x712d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x712d('0x0'));var util=require(_0x712d('0x1'));var logger=require(_0x712d('0x2'))(_0x712d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x712d('0x4'));var fs=require('fs');var path=require(_0x712d('0x5'));var rimraf=require(_0x712d('0x6'));var config=require(_0x712d('0x7'));var attributes=require(_0x712d('0x8'));module[_0x712d('0x9')]=function(_0x1fe394,_0xa7a38b){return _0x1fe394[_0x712d('0xa')](_0x712d('0xb'),attributes,{'tableName':_0x712d('0xc'),'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 b7cee68..38eb6e9 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 _0xc8f6=['startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','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','findAll','options','where','attributes','limit','map','model','include','debug','ShowMailAccount','raw','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','find','account','List','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','list','orderBy','priority','asc','close','autoclose','Contacts','length','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','MailInteraction','create','Contact\x20not\x20found','spread','update','interaction','created','attachments','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachments','UserId','User','name','waitForTheAssignedAgent','Start'];(function(_0x2fb30f,_0x19e254){var _0x580292=function(_0x15ea8f){while(--_0x15ea8f){_0x2fb30f['push'](_0x2fb30f['shift']());}};_0x580292(++_0x19e254);}(_0xc8f6,0x66));var _0x6c8f=function(_0x2140bc,_0x548c28){_0x2140bc=_0x2140bc-0x0;var _0x262c82=_0xc8f6[_0x2140bc];return _0x262c82;};'use strict';var _=require(_0x6c8f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6c8f('0x1'));var rs=require(_0x6c8f('0x2'));var fs=require('fs');var Redis=require(_0x6c8f('0x3'));var db=require(_0x6c8f('0x4'))['db'];var utils=require(_0x6c8f('0x5'));var logger=require(_0x6c8f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6c8f('0x7')]['http']({'port':0x232c});config[_0x6c8f('0x8')]=_[_0x6c8f('0x9')](config[_0x6c8f('0x8')],{'host':_0x6c8f('0xa'),'port':0x18eb});var socket=require(_0x6c8f('0xb'))(new Redis(config[_0x6c8f('0x8')]));require(_0x6c8f('0xc'))['register'](socket);function respondWithRpcPromise(_0x347733,_0x2fe976,_0x99224c){return new BPromise(function(_0x1f0d96,_0x3c7139){return client[_0x6c8f('0xd')](_0x347733,_0x99224c)[_0x6c8f('0xe')](function(_0x4ffe6e){logger[_0x6c8f('0xf')](_0x6c8f('0x10'),_0x2fe976,_0x6c8f('0x11'));logger['debug'](_0x6c8f('0x12'),_0x2fe976,'request\x20sent',JSON[_0x6c8f('0x13')](_0x4ffe6e));if(_0x4ffe6e[_0x6c8f('0x14')]){if(_0x4ffe6e[_0x6c8f('0x14')][_0x6c8f('0x15')]===0x1f4){logger[_0x6c8f('0x14')]('MailAccount,\x20%s,\x20%s',_0x2fe976,_0x4ffe6e[_0x6c8f('0x14')][_0x6c8f('0x16')]);return _0x3c7139(_0x4ffe6e[_0x6c8f('0x14')][_0x6c8f('0x16')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x2fe976,_0x4ffe6e[_0x6c8f('0x14')]['message']);return _0x1f0d96(_0x4ffe6e[_0x6c8f('0x14')][_0x6c8f('0x16')]);}else{logger[_0x6c8f('0xf')](_0x6c8f('0x10'),_0x2fe976,_0x6c8f('0x11'));_0x1f0d96(_0x4ffe6e[_0x6c8f('0x17')]['message']);}})[_0x6c8f('0x18')](function(_0x59f8d6){logger['error'](_0x6c8f('0x10'),_0x2fe976,_0x59f8d6);_0x3c7139(_0x59f8d6);});});}exports[_0x6c8f('0x19')]=function(_0x14ffb3){var _0x150d1c=this;return new Promise(function(_0x2f5b09,_0xc7ac04){return db[_0x6c8f('0x1a')][_0x6c8f('0x1b')]({'raw':_0x14ffb3[_0x6c8f('0x1c')]?_0x14ffb3[_0x6c8f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x14ffb3[_0x6c8f('0x1c')]?_0x14ffb3['options'][_0x6c8f('0x1d')]||null:null,'attributes':_0x14ffb3[_0x6c8f('0x1c')]?_0x14ffb3[_0x6c8f('0x1c')][_0x6c8f('0x1e')]||null:null,'limit':_0x14ffb3[_0x6c8f('0x1c')]?_0x14ffb3[_0x6c8f('0x1c')][_0x6c8f('0x1f')]||null:null,'include':_0x14ffb3['options']?_0x14ffb3[_0x6c8f('0x1c')]['include']?_[_0x6c8f('0x20')](_0x14ffb3[_0x6c8f('0x1c')]['include'],function(_0x5b8dbd){return{'model':db[_0x5b8dbd[_0x6c8f('0x21')]],'as':_0x5b8dbd['as'],'attributes':_0x5b8dbd[_0x6c8f('0x1e')],'include':_0x5b8dbd['include']?_[_0x6c8f('0x20')](_0x5b8dbd['include'],function(_0x3a5c60){return{'model':db[_0x3a5c60[_0x6c8f('0x21')]],'as':_0x3a5c60['as'],'attributes':_0x3a5c60[_0x6c8f('0x1e')],'include':_0x3a5c60[_0x6c8f('0x22')]?_['map'](_0x3a5c60[_0x6c8f('0x22')],function(_0x50845e){return{'model':db[_0x50845e['model']],'as':_0x50845e['as'],'attributes':_0x50845e[_0x6c8f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6c8f('0xe')](function(_0x54610c){logger[_0x6c8f('0xf')](_0x6c8f('0x19'),_0x14ffb3);logger[_0x6c8f('0x23')](_0x6c8f('0x19'),_0x14ffb3,JSON['stringify'](_0x54610c));_0x2f5b09(_0x54610c);})[_0x6c8f('0x18')](function(_0x5f3adb){logger[_0x6c8f('0x14')]('GetMailAccount',_0x5f3adb['message'],_0x14ffb3);_0xc7ac04(_0x150d1c[_0x6c8f('0x14')](0x1f4,_0x5f3adb['message']));});});};exports[_0x6c8f('0x24')]=function(_0x232363){var _0x49288a=this;return new Promise(function(_0x577426,_0x1bba4c){return db[_0x6c8f('0x1a')]['find']({'raw':_0x232363[_0x6c8f('0x1c')]?_0x232363[_0x6c8f('0x1c')][_0x6c8f('0x25')]===undefined?!![]:![]:!![],'where':_0x232363[_0x6c8f('0x1c')]?_0x232363[_0x6c8f('0x1c')][_0x6c8f('0x1d')]||null:null,'attributes':_0x232363[_0x6c8f('0x1c')]?_0x232363[_0x6c8f('0x1c')][_0x6c8f('0x1e')]||null:null,'include':_0x232363['options']?_0x232363[_0x6c8f('0x1c')][_0x6c8f('0x22')]?_[_0x6c8f('0x20')](_0x232363['options'][_0x6c8f('0x22')],function(_0x335b71){return{'model':db[_0x335b71[_0x6c8f('0x21')]],'as':_0x335b71['as'],'attributes':_0x335b71['attributes'],'include':_0x335b71[_0x6c8f('0x22')]?_[_0x6c8f('0x20')](_0x335b71[_0x6c8f('0x22')],function(_0x2a2c18){return{'model':db[_0x2a2c18[_0x6c8f('0x21')]],'as':_0x2a2c18['as'],'attributes':_0x2a2c18[_0x6c8f('0x1e')],'include':_0x2a2c18[_0x6c8f('0x22')]?_[_0x6c8f('0x20')](_0x2a2c18[_0x6c8f('0x22')],function(_0x2351cb){return{'model':db[_0x2351cb[_0x6c8f('0x21')]],'as':_0x2351cb['as'],'attributes':_0x2351cb[_0x6c8f('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x329f18){logger[_0x6c8f('0xf')](_0x6c8f('0x24'),_0x232363);logger[_0x6c8f('0x23')](_0x6c8f('0x24'),_0x232363,JSON[_0x6c8f('0x13')](_0x329f18));_0x577426(_0x329f18);})[_0x6c8f('0x18')](function(_0xd3c89e){logger[_0x6c8f('0x14')](_0x6c8f('0x24'),_0xd3c89e[_0x6c8f('0x16')],_0x232363);_0x1bba4c(_0x49288a[_0x6c8f('0x14')](0x1f4,_0xd3c89e[_0x6c8f('0x16')]));});});};exports[_0x6c8f('0x26')]=function(_0x296824){var _0x4fae75=this;return new Promise(function(_0x279eee,_0x165062){var _0x260c61={'body':_0x296824[_0x6c8f('0x27')],'channel':_0x6c8f('0x28')};var _0x2c0356=_[_0x6c8f('0x29')](_[_0x6c8f('0x2a')](db[_0x6c8f('0x2b')][_0x6c8f('0x2c')]),['createdAt',_0x6c8f('0x2d'),_0x6c8f('0x2e'),_0x6c8f('0x2f')]);var _0x100b4c=![];if(_0x296824[_0x6c8f('0x27')]['id']){delete _0x296824[_0x6c8f('0x27')]['id'];}if(_[_0x6c8f('0x30')](_0x296824[_0x6c8f('0x27')]['from'])){return _0x165062(_0x4fae75['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x6c8f('0x30')](_0x296824[_0x6c8f('0x27')]['body'])||_0x296824[_0x6c8f('0x27')][_0x6c8f('0x27')]===''){return _0x165062(_0x4fae75[_0x6c8f('0x14')](0x1f4,_0x6c8f('0x31')));}if(_[_0x6c8f('0x30')](_0x296824[_0x6c8f('0x27')][_0x6c8f('0x32')])){return _0x165062(_0x4fae75[_0x6c8f('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2c0356));}if(!_[_0x6c8f('0x33')](_0x2c0356,_0x296824[_0x6c8f('0x27')][_0x6c8f('0x32')])){return _0x165062(_0x4fae75[_0x6c8f('0x14')](0x1f4,_0x6c8f('0x34')+_0x2c0356));}var _0x2a57ea={};_0x2a57ea[_0x296824['body']['mapKey']]=_0x296824[_0x6c8f('0x27')][_0x6c8f('0x35')];return db[_0x6c8f('0x1a')][_0x6c8f('0x36')]({'where':{'id':_0x296824[_0x6c8f('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x6c8f('0x38'),'include':[{'model':db[_0x6c8f('0x2b')],'as':'Contacts','where':_0x2a57ea,'limit':0x1,'order':[[_0x6c8f('0x2d'),'DESC']]}]},{'model':db[_0x6c8f('0x39')],'as':_0x6c8f('0x3a')},{'model':db[_0x6c8f('0x3b')],'as':_0x6c8f('0x3c')}]})[_0x6c8f('0xe')](function(_0x5af7c8){if(_0x5af7c8&&_0x5af7c8[_0x6c8f('0x38')]){var _0x597449=_0x5af7c8[_0x6c8f('0x3d')]({'plain':!![]});_0x260c61[_0x6c8f('0x37')]=_[_0x6c8f('0x3e')](_0x597449,[_0x6c8f('0x3a'),_0x6c8f('0x38')]);_0x260c61[_0x6c8f('0x3f')]=_0x597449[_0x6c8f('0x3a')];_0x260c61[_0x6c8f('0x40')]=_0x597449[_0x6c8f('0x38')];_0x260c61[_0x6c8f('0x3f')]=_[_0x6c8f('0x41')](_0x260c61[_0x6c8f('0x3f')],[_0x6c8f('0x42')],[_0x6c8f('0x43')]);if(_0x260c61[_0x6c8f('0x37')]&&_0x260c61['account']['autoclose']){_0x260c61[_0x6c8f('0x3f')]['push']({'id':0x0,'priority':_0x260c61[_0x6c8f('0x3f')]['length']+0x1,'app':_0x6c8f('0x44'),'appdata':_0x6c8f('0x45'),'interval':'*,*,*,*'});}if(_0x260c61[_0x6c8f('0x37')][_0x6c8f('0x3a')]){delete _0x260c61[_0x6c8f('0x37')][_0x6c8f('0x3a')];}if(_0x260c61[_0x6c8f('0x37')][_0x6c8f('0x38')]){delete _0x260c61['account'][_0x6c8f('0x38')];}if(_0x597449[_0x6c8f('0x38')][_0x6c8f('0x46')][_0x6c8f('0x47')]){return _0x597449[_0x6c8f('0x38')][_0x6c8f('0x46')][0x0];}var _0x54d86d=_[_0x6c8f('0x9')](_0x296824[_0x6c8f('0x27')],{'firstName':_0x296824['body'][_0x6c8f('0x35')],'ListId':_0x597449[_0x6c8f('0x2f')]});_0x54d86d[_0x296824[_0x6c8f('0x27')][_0x6c8f('0x32')]]=_0x296824['body'][_0x6c8f('0x35')];return db[_0x6c8f('0x2b')]['create'](_0x54d86d);}else{throw new Error('List\x20not\x20found');}})[_0x6c8f('0xe')](function(_0x3f67d9){_0x260c61[_0x6c8f('0x48')]=_0x3f67d9;if(_0x3f67d9){if(!_0x296824[_0x6c8f('0x27')][_0x6c8f('0x16')][_0x6c8f('0x49')]){_0x296824['body'][_0x6c8f('0x16')][_0x6c8f('0x49')]=rs[_0x6c8f('0x4a')]()+'\x20'+_0x296824[_0x6c8f('0x27')][_0x6c8f('0x16')][_0x6c8f('0x35')];}var _0x1fbdd7={'ContactId':_0x3f67d9['id'],'MailAccountId':_0x296824[_0x6c8f('0x37')]['id'],'inReplyTo':_0x296824['body'][_0x6c8f('0x16')]['messageId'],'to':_0x296824['body'][_0x6c8f('0x16')][_0x6c8f('0x35')],'cc':_0x296824[_0x6c8f('0x27')][_0x6c8f('0x16')]['cc'],'subject':_0x296824[_0x6c8f('0x27')]['message'][_0x6c8f('0x4b')],'attach':_0x296824['body'][_0x6c8f('0x16')][_0x6c8f('0x4c')],'lastMsgAt':moment()[_0x6c8f('0x4d')](_0x6c8f('0x4e')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x296824['account']['id']},'include':[{'model':db[_0x6c8f('0x4f')],'as':_0x6c8f('0x50'),'attributes':[_0x6c8f('0x49')],'where':{'messageId':_0x296824['body'][_0x6c8f('0x16')][_0x6c8f('0x51')]}}]})[_0x6c8f('0xe')](function(_0x5deccd){if(_0x5deccd){return[_0x5deccd,![]];}return db[_0x6c8f('0x52')][_0x6c8f('0x53')](_0x1fbdd7)[_0x6c8f('0xe')](function(_0x4359b8){return[_0x4359b8,!![]];});});}else{throw new Error(_0x6c8f('0x54'));}})[_0x6c8f('0x55')](function(_0x2096f0,_0x1c6bdf){if(_0x2096f0){_0x100b4c=_0x1c6bdf;if(!_0x1c6bdf){return _0x2096f0[_0x6c8f('0x56')]({'inReplyTo':_0x296824['body'][_0x6c8f('0x16')][_0x6c8f('0x49')],'to':_0x296824[_0x6c8f('0x27')]['message'][_0x6c8f('0x35')],'cc':_0x296824[_0x6c8f('0x27')][_0x6c8f('0x16')]['cc'],'subject':_0x296824[_0x6c8f('0x27')][_0x6c8f('0x16')][_0x6c8f('0x4b')],'attach':_0x2096f0[_0x6c8f('0x4c')]?_0x2096f0[_0x6c8f('0x4c')]:_0x296824['body'][_0x6c8f('0x16')][_0x6c8f('0x4c')],'substatus':null,'substatusAt':moment()['format'](_0x6c8f('0x4e')),'lastMsgAt':moment()[_0x6c8f('0x4d')](_0x6c8f('0x4e')),'lastMsgDirection':'in'});}else{return _0x2096f0;}}})[_0x6c8f('0xe')](function(_0x2f7c79){_0x260c61[_0x6c8f('0x57')]=_0x2f7c79[_0x6c8f('0x3d')]({'plain':!![]});_0x260c61['interaction'][_0x6c8f('0x58')]=_0x100b4c;return db[_0x6c8f('0x4f')]['create']({'body':_0x296824[_0x6c8f('0x27')][_0x6c8f('0x27')],'MailAccountId':_0x296824[_0x6c8f('0x37')]['id'],'MailInteractionId':_0x2f7c79['id'],'direction':'in','ContactId':_0x260c61[_0x6c8f('0x48')]['id'],'messageId':_0x296824['body'][_0x6c8f('0x16')][_0x6c8f('0x49')],'from':_0x296824[_0x6c8f('0x27')][_0x6c8f('0x16')][_0x6c8f('0x35')],'to':_0x296824[_0x6c8f('0x27')]['message']['to'],'cc':_0x296824[_0x6c8f('0x27')][_0x6c8f('0x16')]['cc'],'subject':_0x296824[_0x6c8f('0x27')][_0x6c8f('0x16')][_0x6c8f('0x4b')],'attach':_0x296824[_0x6c8f('0x27')][_0x6c8f('0x16')][_0x6c8f('0x4c')],'Attachments':_0x296824[_0x6c8f('0x27')][_0x6c8f('0x16')][_0x6c8f('0x59')],'originTo':_0x296824[_0x6c8f('0x27')][_0x6c8f('0x16')]['originTo'],'originCc':_0x296824[_0x6c8f('0x27')][_0x6c8f('0x16')]['originCc'],'bcc':_0x296824[_0x6c8f('0x27')][_0x6c8f('0x16')][_0x6c8f('0x5a')],'ChatWebsiteId':_0x296824[_0x6c8f('0x27')][_0x6c8f('0x16')][_0x6c8f('0x5b')]||null,'originChannel':_0x296824[_0x6c8f('0x27')][_0x6c8f('0x16')]['originChannel']||_0x6c8f('0x5c'),'ChatOfflineMessageId':_0x296824[_0x6c8f('0x27')][_0x6c8f('0x16')][_0x6c8f('0x5d')]||null},{'include':[{'model':db['Attachment'],'as':_0x6c8f('0x5e')}]});})[_0x6c8f('0xe')](function(_0x1d63ac){_0x260c61[_0x6c8f('0x16')]=_0x1d63ac;if(_0x260c61['interaction'][_0x6c8f('0x5f')]){return db[_0x6c8f('0x60')][_0x6c8f('0x36')]({'attributes':['id',_0x6c8f('0x61')],'where':{'id':_0x260c61[_0x6c8f('0x57')][_0x6c8f('0x5f')]}})[_0x6c8f('0xe')](function(_0x4ebb5d){if(_0x4ebb5d){_0x260c61[_0x6c8f('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4ebb5d[_0x6c8f('0x61')]+','+(_0x260c61[_0x6c8f('0x37')][_0x6c8f('0x62')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x6c8f('0x63'),'startRouting',_0x260c61);});}return respondWithRpcPromise(_0x6c8f('0x63'),_0x6c8f('0x64'),_0x260c61);})[_0x6c8f('0xe')](function(_0x568f2a){_0x279eee(_0x568f2a);})[_0x6c8f('0x18')](function(_0x4018a3){_0x165062(_0x4fae75[_0x6c8f('0x14')](0x1f4,_0x4018a3['message']));});});}; \ No newline at end of file +var _0x0a69=['MailMessage','create','attachments','originTo','ChatWebsiteId','ChatOfflineMessageId','Attachment','Attachments','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','randomstring','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','GetMailAccount','MailAccount','options','raw','where','map','include','attributes','model','catch','ShowMailAccount','find','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','account','CmList','List','Contacts','DESC','MailApplication','MailServerOut','get','Applications','list','orderBy','applications','length','close','autoclose','*,*,*,*','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Contact\x20not\x20found','spread','update','attach','interaction'];(function(_0x4a0392,_0x587855){var _0x4bb1c7=function(_0x46be04){while(--_0x46be04){_0x4a0392['push'](_0x4a0392['shift']());}};_0x4bb1c7(++_0x587855);}(_0x0a69,0xd0));var _0x90a6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a69[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x90a6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x90a6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x90a6('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x90a6('0x3'));var config=require('../../config/environment');var jayson=require(_0x90a6('0x4'));var client=jayson[_0x90a6('0x5')][_0x90a6('0x6')]({'port':0x232c});config[_0x90a6('0x7')]=_[_0x90a6('0x8')](config[_0x90a6('0x7')],{'host':_0x90a6('0x9'),'port':0x18eb});var socket=require(_0x90a6('0xa'))(new Redis(config[_0x90a6('0x7')]));require(_0x90a6('0xb'))[_0x90a6('0xc')](socket);function respondWithRpcPromise(_0x4bd5dc,_0x26613c,_0x119968){return new BPromise(function(_0x1ece3d,_0xb3fdf4){return client[_0x90a6('0xd')](_0x4bd5dc,_0x119968)[_0x90a6('0xe')](function(_0x56f753){logger[_0x90a6('0xf')](_0x90a6('0x10'),_0x26613c,'request\x20sent');logger[_0x90a6('0x11')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x26613c,_0x90a6('0x12'),JSON[_0x90a6('0x13')](_0x56f753));if(_0x56f753[_0x90a6('0x14')]){if(_0x56f753[_0x90a6('0x14')][_0x90a6('0x15')]===0x1f4){logger[_0x90a6('0x14')](_0x90a6('0x10'),_0x26613c,_0x56f753[_0x90a6('0x14')][_0x90a6('0x16')]);return _0xb3fdf4(_0x56f753[_0x90a6('0x14')][_0x90a6('0x16')]);}logger[_0x90a6('0x14')]('MailAccount,\x20%s,\x20%s',_0x26613c,_0x56f753[_0x90a6('0x14')]['message']);return _0x1ece3d(_0x56f753[_0x90a6('0x14')]['message']);}else{logger['info'](_0x90a6('0x10'),_0x26613c,_0x90a6('0x12'));_0x1ece3d(_0x56f753['result']['message']);}})['catch'](function(_0x4482b3){logger[_0x90a6('0x14')](_0x90a6('0x10'),_0x26613c,_0x4482b3);_0xb3fdf4(_0x4482b3);});});}exports[_0x90a6('0x17')]=function(_0x493eed){var _0xd87ba3=this;return new Promise(function(_0x34ed5a,_0x2259fc){return db[_0x90a6('0x18')]['findAll']({'raw':_0x493eed[_0x90a6('0x19')]?_0x493eed['options'][_0x90a6('0x1a')]===undefined?!![]:![]:!![],'where':_0x493eed['options']?_0x493eed['options'][_0x90a6('0x1b')]||null:null,'attributes':_0x493eed[_0x90a6('0x19')]?_0x493eed[_0x90a6('0x19')]['attributes']||null:null,'limit':_0x493eed[_0x90a6('0x19')]?_0x493eed[_0x90a6('0x19')]['limit']||null:null,'include':_0x493eed[_0x90a6('0x19')]?_0x493eed[_0x90a6('0x19')]['include']?_[_0x90a6('0x1c')](_0x493eed[_0x90a6('0x19')][_0x90a6('0x1d')],function(_0x2209c3){return{'model':db[_0x2209c3['model']],'as':_0x2209c3['as'],'attributes':_0x2209c3[_0x90a6('0x1e')],'include':_0x2209c3['include']?_['map'](_0x2209c3[_0x90a6('0x1d')],function(_0x1cc099){return{'model':db[_0x1cc099[_0x90a6('0x1f')]],'as':_0x1cc099['as'],'attributes':_0x1cc099['attributes'],'include':_0x1cc099['include']?_[_0x90a6('0x1c')](_0x1cc099[_0x90a6('0x1d')],function(_0x39a177){return{'model':db[_0x39a177['model']],'as':_0x39a177['as'],'attributes':_0x39a177[_0x90a6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x90a6('0xe')](function(_0x256172){logger[_0x90a6('0xf')](_0x90a6('0x17'),_0x493eed);logger['debug']('GetMailAccount',_0x493eed,JSON['stringify'](_0x256172));_0x34ed5a(_0x256172);})[_0x90a6('0x20')](function(_0x48a0d4){logger[_0x90a6('0x14')](_0x90a6('0x17'),_0x48a0d4[_0x90a6('0x16')],_0x493eed);_0x2259fc(_0xd87ba3['error'](0x1f4,_0x48a0d4[_0x90a6('0x16')]));});});};exports[_0x90a6('0x21')]=function(_0xb341e0){var _0x1e6797=this;return new Promise(function(_0x2d0373,_0x4a5d3c){return db[_0x90a6('0x18')][_0x90a6('0x22')]({'raw':_0xb341e0[_0x90a6('0x19')]?_0xb341e0[_0x90a6('0x19')][_0x90a6('0x1a')]===undefined?!![]:![]:!![],'where':_0xb341e0[_0x90a6('0x19')]?_0xb341e0[_0x90a6('0x19')][_0x90a6('0x1b')]||null:null,'attributes':_0xb341e0['options']?_0xb341e0[_0x90a6('0x19')][_0x90a6('0x1e')]||null:null,'include':_0xb341e0[_0x90a6('0x19')]?_0xb341e0[_0x90a6('0x19')][_0x90a6('0x1d')]?_['map'](_0xb341e0[_0x90a6('0x19')]['include'],function(_0x2671ed){return{'model':db[_0x2671ed['model']],'as':_0x2671ed['as'],'attributes':_0x2671ed[_0x90a6('0x1e')],'include':_0x2671ed[_0x90a6('0x1d')]?_[_0x90a6('0x1c')](_0x2671ed[_0x90a6('0x1d')],function(_0x55da7a){return{'model':db[_0x55da7a[_0x90a6('0x1f')]],'as':_0x55da7a['as'],'attributes':_0x55da7a['attributes'],'include':_0x55da7a[_0x90a6('0x1d')]?_[_0x90a6('0x1c')](_0x55da7a[_0x90a6('0x1d')],function(_0x3eec63){return{'model':db[_0x3eec63['model']],'as':_0x3eec63['as'],'attributes':_0x3eec63['attributes']};}):[]};}):[]};}):[]:[]})[_0x90a6('0xe')](function(_0xf2d01f){logger['info'](_0x90a6('0x21'),_0xb341e0);logger[_0x90a6('0x11')](_0x90a6('0x21'),_0xb341e0,JSON['stringify'](_0xf2d01f));_0x2d0373(_0xf2d01f);})[_0x90a6('0x20')](function(_0x4b950d){logger[_0x90a6('0x14')](_0x90a6('0x21'),_0x4b950d[_0x90a6('0x16')],_0xb341e0);_0x4a5d3c(_0x1e6797[_0x90a6('0x14')](0x1f4,_0x4b950d['message']));});});};exports['NotifyMailAccount']=function(_0x4db768){var _0x553134=this;return new Promise(function(_0x1bc0bd,_0x1b6706){var _0x24e250={'body':_0x4db768[_0x90a6('0x23')],'channel':_0x90a6('0x24')};var _0x5ea53e=_[_0x90a6('0x25')](_[_0x90a6('0x26')](db[_0x90a6('0x27')][_0x90a6('0x28')]),[_0x90a6('0x29'),_0x90a6('0x2a'),_0x90a6('0x2b'),_0x90a6('0x2c')]);var _0x1d5aaf=![];if(_0x4db768[_0x90a6('0x23')]['id']){delete _0x4db768[_0x90a6('0x23')]['id'];}if(_['isNil'](_0x4db768[_0x90a6('0x23')]['from'])){return _0x1b6706(_0x553134['error'](0x1f4,_0x90a6('0x2d')));}if(_[_0x90a6('0x2e')](_0x4db768['body']['body'])||_0x4db768[_0x90a6('0x23')][_0x90a6('0x23')]===''){return _0x1b6706(_0x553134[_0x90a6('0x14')](0x1f4,_0x90a6('0x2f')));}if(_['isNil'](_0x4db768[_0x90a6('0x23')][_0x90a6('0x30')])){return _0x1b6706(_0x553134[_0x90a6('0x14')](0x1f4,_0x90a6('0x31')+_0x5ea53e));}if(!_[_0x90a6('0x32')](_0x5ea53e,_0x4db768[_0x90a6('0x23')]['mapKey'])){return _0x1b6706(_0x553134[_0x90a6('0x14')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5ea53e));}var _0x2bcd3d={};_0x2bcd3d[_0x4db768[_0x90a6('0x23')][_0x90a6('0x30')]]=_0x4db768[_0x90a6('0x23')][_0x90a6('0x33')];return db[_0x90a6('0x18')][_0x90a6('0x22')]({'where':{'id':_0x4db768[_0x90a6('0x34')]['id']},'include':[{'model':db[_0x90a6('0x35')],'as':_0x90a6('0x36'),'include':[{'model':db[_0x90a6('0x27')],'as':_0x90a6('0x37'),'where':_0x2bcd3d,'limit':0x1,'order':[[_0x90a6('0x2a'),_0x90a6('0x38')]]}]},{'model':db[_0x90a6('0x39')],'as':'Applications'},{'model':db[_0x90a6('0x3a')],'as':'Smtp'}]})['then'](function(_0x5ed9d7){if(_0x5ed9d7&&_0x5ed9d7['List']){var _0x302165=_0x5ed9d7[_0x90a6('0x3b')]({'plain':!![]});_0x24e250['account']=_['omit'](_0x302165,['Applications','List']);_0x24e250['applications']=_0x302165[_0x90a6('0x3c')];_0x24e250[_0x90a6('0x3d')]=_0x302165[_0x90a6('0x36')];_0x24e250['applications']=_[_0x90a6('0x3e')](_0x24e250[_0x90a6('0x3f')],['priority'],['asc']);if(_0x24e250[_0x90a6('0x34')]&&_0x24e250[_0x90a6('0x34')]['autoclose']){_0x24e250[_0x90a6('0x3f')]['push']({'id':0x0,'priority':_0x24e250[_0x90a6('0x3f')][_0x90a6('0x40')]+0x1,'app':_0x90a6('0x41'),'appdata':_0x90a6('0x42'),'interval':_0x90a6('0x43')});}if(_0x24e250[_0x90a6('0x34')]['Applications']){delete _0x24e250[_0x90a6('0x34')][_0x90a6('0x3c')];}if(_0x24e250[_0x90a6('0x34')][_0x90a6('0x36')]){delete _0x24e250[_0x90a6('0x34')][_0x90a6('0x36')];}if(_0x302165[_0x90a6('0x36')][_0x90a6('0x37')][_0x90a6('0x40')]){return _0x302165[_0x90a6('0x36')][_0x90a6('0x37')][0x0];}var _0x98c050=_[_0x90a6('0x8')](_0x4db768[_0x90a6('0x23')],{'firstName':_0x4db768['body'][_0x90a6('0x33')],'ListId':_0x302165[_0x90a6('0x2c')]});_0x98c050[_0x4db768[_0x90a6('0x23')][_0x90a6('0x30')]]=_0x4db768[_0x90a6('0x23')][_0x90a6('0x33')];return db[_0x90a6('0x27')]['create'](_0x98c050);}else{throw new Error('List\x20not\x20found');}})[_0x90a6('0xe')](function(_0x3ae218){_0x24e250[_0x90a6('0x44')]=_0x3ae218;if(_0x3ae218){if(!_0x4db768[_0x90a6('0x23')]['message']['messageId']){_0x4db768[_0x90a6('0x23')]['message'][_0x90a6('0x45')]=rs[_0x90a6('0x46')]()+'\x20'+_0x4db768[_0x90a6('0x23')]['message'][_0x90a6('0x33')];}var _0x312600={'ContactId':_0x3ae218['id'],'MailAccountId':_0x4db768['account']['id'],'inReplyTo':_0x4db768[_0x90a6('0x23')][_0x90a6('0x16')]['messageId'],'to':_0x4db768[_0x90a6('0x23')][_0x90a6('0x16')][_0x90a6('0x33')],'cc':_0x4db768[_0x90a6('0x23')][_0x90a6('0x16')]['cc'],'subject':_0x4db768[_0x90a6('0x23')][_0x90a6('0x16')][_0x90a6('0x47')],'attach':_0x4db768[_0x90a6('0x23')][_0x90a6('0x16')]['attach'],'lastMsgAt':moment()[_0x90a6('0x48')](_0x90a6('0x49')),'lastMsgDirection':'in'};return db[_0x90a6('0x4a')][_0x90a6('0x22')]({'where':{'closed':![],'MailAccountId':_0x4db768['account']['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x90a6('0x45')],'where':{'messageId':_0x4db768[_0x90a6('0x23')]['message']['inReplyTo']}}]})[_0x90a6('0xe')](function(_0x4c3a1d){if(_0x4c3a1d){return[_0x4c3a1d,![]];}return db[_0x90a6('0x4a')]['create'](_0x312600)[_0x90a6('0xe')](function(_0x30e7cf){return[_0x30e7cf,!![]];});});}else{throw new Error(_0x90a6('0x4b'));}})[_0x90a6('0x4c')](function(_0x380ab8,_0x5aa5a2){if(_0x380ab8){_0x1d5aaf=_0x5aa5a2;if(!_0x5aa5a2){return _0x380ab8[_0x90a6('0x4d')]({'inReplyTo':_0x4db768[_0x90a6('0x23')][_0x90a6('0x16')][_0x90a6('0x45')],'to':_0x4db768['body']['message']['from'],'cc':_0x4db768['body'][_0x90a6('0x16')]['cc'],'subject':_0x4db768[_0x90a6('0x23')][_0x90a6('0x16')]['subject'],'attach':_0x380ab8[_0x90a6('0x4e')]?_0x380ab8[_0x90a6('0x4e')]:_0x4db768['body'][_0x90a6('0x16')][_0x90a6('0x4e')],'substatus':null,'substatusAt':moment()['format'](_0x90a6('0x49')),'lastMsgAt':moment()['format'](_0x90a6('0x49')),'lastMsgDirection':'in'});}else{return _0x380ab8;}}})[_0x90a6('0xe')](function(_0x582960){_0x24e250[_0x90a6('0x4f')]=_0x582960[_0x90a6('0x3b')]({'plain':!![]});_0x24e250['interaction']['created']=_0x1d5aaf;return db[_0x90a6('0x50')][_0x90a6('0x51')]({'body':_0x4db768[_0x90a6('0x23')][_0x90a6('0x23')],'MailAccountId':_0x4db768[_0x90a6('0x34')]['id'],'MailInteractionId':_0x582960['id'],'direction':'in','ContactId':_0x24e250[_0x90a6('0x44')]['id'],'messageId':_0x4db768[_0x90a6('0x23')][_0x90a6('0x16')]['messageId'],'from':_0x4db768[_0x90a6('0x23')]['message'][_0x90a6('0x33')],'to':_0x4db768[_0x90a6('0x23')][_0x90a6('0x16')]['to'],'cc':_0x4db768['body'][_0x90a6('0x16')]['cc'],'subject':_0x4db768['body'][_0x90a6('0x16')][_0x90a6('0x47')],'attach':_0x4db768[_0x90a6('0x23')]['message'][_0x90a6('0x4e')],'Attachments':_0x4db768[_0x90a6('0x23')][_0x90a6('0x16')][_0x90a6('0x52')],'originTo':_0x4db768[_0x90a6('0x23')][_0x90a6('0x16')][_0x90a6('0x53')],'originCc':_0x4db768['body']['message']['originCc'],'bcc':_0x4db768[_0x90a6('0x23')][_0x90a6('0x16')]['bcc'],'ChatWebsiteId':_0x4db768[_0x90a6('0x23')]['message'][_0x90a6('0x54')]||null,'originChannel':_0x4db768[_0x90a6('0x23')]['message']['originChannel']||'Email','ChatOfflineMessageId':_0x4db768[_0x90a6('0x23')]['message'][_0x90a6('0x55')]||null},{'include':[{'model':db[_0x90a6('0x56')],'as':_0x90a6('0x57')}]});})[_0x90a6('0xe')](function(_0x1bb037){_0x24e250[_0x90a6('0x16')]=_0x1bb037;if(_0x24e250['interaction'][_0x90a6('0x58')]){return db[_0x90a6('0x59')][_0x90a6('0x22')]({'attributes':['id','name'],'where':{'id':_0x24e250[_0x90a6('0x4f')][_0x90a6('0x58')]}})[_0x90a6('0xe')](function(_0x9f4a95){if(_0x9f4a95){_0x24e250[_0x90a6('0x3f')][_0x90a6('0x5a')]({'id':0x0,'priority':0x0,'app':_0x90a6('0x5b'),'appdata':_0x9f4a95[_0x90a6('0x5c')]+','+(_0x24e250['account'][_0x90a6('0x5d')]||0xa),'interval':_0x90a6('0x43')});}return respondWithRpcPromise(_0x90a6('0x5e'),_0x90a6('0x5f'),_0x24e250);});}return respondWithRpcPromise(_0x90a6('0x5e'),_0x90a6('0x5f'),_0x24e250);})[_0x90a6('0xe')](function(_0x36f7ef){_0x1bc0bd(_0x36f7ef);})['catch'](function(_0x2e44b5){_0x1b6706(_0x553134['error'](0x1f4,_0x2e44b5[_0x90a6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 5204bcc..22e4ac2 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 _0x783c=['update','./mailAccount.events','remove'];(function(_0x1b606e,_0x140f19){var _0x1b4934=function(_0x5d0571){while(--_0x5d0571){_0x1b606e['push'](_0x1b606e['shift']());}};_0x1b4934(++_0x140f19);}(_0x783c,0xaf));var _0xc783=function(_0xea0609,_0x73f97c){_0xea0609=_0xea0609-0x0;var _0x3a8f20=_0x783c[_0xea0609];return _0x3a8f20;};'use strict';var MailAccountEvents=require(_0xc783('0x0'));var events=['save',_0xc783('0x1'),_0xc783('0x2')];function createListener(_0x2ae078,_0x5ed5e1){return function(_0x215704){_0x5ed5e1['emit'](_0x2ae078,_0x215704);};}function removeListener(_0x19d54f,_0x3a9330){return function(){MailAccountEvents['removeListener'](_0x19d54f,_0x3a9330);};}exports['register']=function(_0x547328){for(var _0x39731f=0x0,_0x4f8d2d=events['length'];_0x39731f<_0x4f8d2d;_0x39731f++){var _0x62cf50=events[_0x39731f];var _0x2ad159=createListener('mailAccount:'+_0x62cf50,_0x547328);MailAccountEvents['on'](_0x62cf50,_0x2ad159);}}; \ No newline at end of file +var _0xa100=['save','remove','update','emit','length','mailAccount:','./mailAccount.events'];(function(_0x1cd47d,_0x55bc75){var _0x29d52f=function(_0x37737a){while(--_0x37737a){_0x1cd47d['push'](_0x1cd47d['shift']());}};_0x29d52f(++_0x55bc75);}(_0xa100,0x1b1));var _0x0a10=function(_0x337800,_0x1e986e){_0x337800=_0x337800-0x0;var _0x2caa1d=_0xa100[_0x337800];return _0x2caa1d;};'use strict';var MailAccountEvents=require(_0x0a10('0x0'));var events=[_0x0a10('0x1'),_0x0a10('0x2'),_0x0a10('0x3')];function createListener(_0xff423b,_0xe61b51){return function(_0x2b415d){_0xe61b51[_0x0a10('0x4')](_0xff423b,_0x2b415d);};}function removeListener(_0x2d20ca,_0x27a806){return function(){MailAccountEvents['removeListener'](_0x2d20ca,_0x27a806);};}exports['register']=function(_0xc54d40){for(var _0xd30eb4=0x0,_0x312745=events[_0x0a10('0x5')];_0xd30eb4<_0x312745;_0xd30eb4++){var _0x477354=events[_0xd30eb4];var _0x4b5db3=createListener(_0x0a10('0x6')+_0x477354,_0xc54d40);MailAccountEvents['on'](_0x477354,_0x4b5db3);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index e3d86e8..e18236d 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 _0x4b78=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports'];(function(_0x565e3c,_0xbe61c6){var _0x145dd8=function(_0x2fb4cc){while(--_0x2fb4cc){_0x565e3c['push'](_0x565e3c['shift']());}};_0x145dd8(++_0xbe61c6);}(_0x4b78,0x132));var _0x84b7=function(_0x32d91d,_0x364186){_0x32d91d=_0x32d91d-0x0;var _0x32629b=_0x4b78[_0x32d91d];return _0x32629b;};'use strict';var multer=require('multer');var util=require(_0x84b7('0x0'));var path=require(_0x84b7('0x1'));var timeout=require(_0x84b7('0x2'));var express=require(_0x84b7('0x3'));var router=express['Router']();var fs_extra=require(_0x84b7('0x4'));var auth=require(_0x84b7('0x5'));var interaction=require(_0x84b7('0x6'));var config=require(_0x84b7('0x7'));var controller=require('./mailApplication.controller');router[_0x84b7('0x8')](_0x84b7('0x9'),auth[_0x84b7('0xa')](),controller[_0x84b7('0xb')]);router[_0x84b7('0xc')](_0x84b7('0x9'),auth[_0x84b7('0xa')](),controller[_0x84b7('0xd')]);router[_0x84b7('0xe')]('/:id',auth[_0x84b7('0xa')](),controller[_0x84b7('0xf')]);module[_0x84b7('0x10')]=router; \ No newline at end of file +var _0xd927=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','put','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd927,0xf2));var _0x7d92=function(_0x413c23,_0x202f76){_0x413c23=_0x413c23-0x0;var _0x21c78a=_0xd927[_0x413c23];return _0x21c78a;};'use strict';var multer=require(_0x7d92('0x0'));var util=require(_0x7d92('0x1'));var path=require(_0x7d92('0x2'));var timeout=require(_0x7d92('0x3'));var express=require('express');var router=express[_0x7d92('0x4')]();var fs_extra=require(_0x7d92('0x5'));var auth=require(_0x7d92('0x6'));var interaction=require(_0x7d92('0x7'));var config=require(_0x7d92('0x8'));var controller=require(_0x7d92('0x9'));router['get'](_0x7d92('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7d92('0xb')](_0x7d92('0xa'),auth[_0x7d92('0xc')](),controller[_0x7d92('0xd')]);router[_0x7d92('0xe')]('/:id',auth[_0x7d92('0xc')](),controller[_0x7d92('0xf')]);module[_0x7d92('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index efdefaa..0e9860c 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 _0x1a36=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x4f2bc2,_0x1520ed){var _0x45e3e1=function(_0x274f00){while(--_0x274f00){_0x4f2bc2['push'](_0x4f2bc2['shift']());}};_0x45e3e1(++_0x1520ed);}(_0x1a36,0x90));var _0x61a3=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x1a36[_0x178e48];return _0x440d7e;};'use strict';var Sequelize=require(_0x61a3('0x0'));module[_0x61a3('0x1')]={'priority':{'type':Sequelize[_0x61a3('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x61a3('0x3')],'allowNull':![],'defaultValue':_0x61a3('0x4')},'appdata':{'type':Sequelize[_0x61a3('0x5')]()},'description':{'type':Sequelize[_0x61a3('0x3')]},'interval':{'type':Sequelize[_0x61a3('0x3')],'defaultValue':_0x61a3('0x6')}}; \ No newline at end of file +var _0xb331=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x127c7b,_0x1f65e7){var _0x1708eb=function(_0x2033e5){while(--_0x2033e5){_0x127c7b['push'](_0x127c7b['shift']());}};_0x1708eb(++_0x1f65e7);}(_0xb331,0x87));var _0x1b33=function(_0x44fa06,_0x4d848d){_0x44fa06=_0x44fa06-0x0;var _0xd9c3a6=_0xb331[_0x44fa06];return _0xd9c3a6;};'use strict';var Sequelize=require(_0x1b33('0x0'));module[_0x1b33('0x1')]={'priority':{'type':Sequelize[_0x1b33('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1b33('0x3')],'allowNull':![],'defaultValue':_0x1b33('0x4')},'appdata':{'type':Sequelize[_0x1b33('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1b33('0x3')],'defaultValue':_0x1b33('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 183ddeb..d1dd3ac 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 _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x43139b,_0x1d704c){var _0x2de4de=function(_0x434fac){while(--_0x434fac){_0x43139b['push'](_0x43139b['shift']());}};_0x2de4de(++_0x1d704c);}(_0x54ef,0x112));var _0xf54e=function(_0x2ee54a,_0x1eab0f){_0x2ee54a=_0x2ee54a-0x0;var _0x31cf1d=_0x54ef[_0x2ee54a];return _0x31cf1d;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file +var _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0xf273f9,_0x486198){var _0xb4abcc=function(_0x2f9418){while(--_0x2f9418){_0xf273f9['push'](_0xf273f9['shift']());}};_0xb4abcc(++_0x486198);}(_0x70e0,0x17b));var _0x070e=function(_0x69c00b,_0x30baf6){_0x69c00b=_0x69c00b-0x0;var _0x4ba4fd=_0x70e0[_0x69c00b];return _0x4ba4fd;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index ed9fa97..eae52a0 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 _0x8206=['../../config/logger','api','moment','bluebird','rimraf','./mailApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x408fbf,_0x15857c){var _0x3948ef=function(_0x33d25e){while(--_0x33d25e){_0x408fbf['push'](_0x408fbf['shift']());}};_0x3948ef(++_0x15857c);}(_0x8206,0x76));var _0x6820=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0x8206[_0x2ec2bf];return _0x2c279c;};'use strict';var _=require(_0x6820('0x0'));var util=require(_0x6820('0x1'));var logger=require(_0x6820('0x2'))(_0x6820('0x3'));var moment=require(_0x6820('0x4'));var BPromise=require(_0x6820('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6820('0x6'));var config=require('../../config/environment');var attributes=require(_0x6820('0x7'));module[_0x6820('0x8')]=function(_0x1c2ca5,_0x376deb){return _0x1c2ca5[_0x6820('0x9')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6820('0xa'),'collate':_0x6820('0xb')});}; \ No newline at end of file +var _0x6f48=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f48,0x149));var _0x86f4=function(_0x32c0b2,_0x4a6baa){_0x32c0b2=_0x32c0b2-0x0;var _0x967d13=_0x6f48[_0x32c0b2];return _0x967d13;};'use strict';var _=require(_0x86f4('0x0'));var util=require(_0x86f4('0x1'));var logger=require(_0x86f4('0x2'))('api');var moment=require(_0x86f4('0x3'));var BPromise=require(_0x86f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x86f4('0x5'));var rimraf=require(_0x86f4('0x6'));var config=require(_0x86f4('0x7'));var attributes=require(_0x86f4('0x8'));module[_0x86f4('0x9')]=function(_0x583488,_0x556529){return _0x583488[_0x86f4('0xa')](_0x86f4('0xb'),attributes,{'tableName':_0x86f4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x86f4('0xd'),'collate':_0x86f4('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 4f1f4fe..5d46949 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 _0xdbaa=['jayson/promise','client','http','request','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','update','body','options','where','attributes','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0xdbaa,0x1aa));var _0xadba=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xdbaa[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0xadba('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xadba('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xadba('0x2'))['db'];var utils=require(_0xadba('0x3'));var logger=require(_0xadba('0x4'))(_0xadba('0x5'));var config=require('../../config/environment');var jayson=require(_0xadba('0x6'));var client=jayson[_0xadba('0x7')][_0xadba('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xae2722,_0x3de164,_0x26ee6e){return new BPromise(function(_0x35da87,_0x39b432){return client[_0xadba('0x9')](_0xae2722,_0x26ee6e)['then'](function(_0x5ebccb){logger[_0xadba('0xa')](_0xadba('0xb'),_0x3de164,'request\x20sent');logger[_0xadba('0xc')](_0xadba('0xd'),_0x3de164,_0xadba('0xe'),JSON[_0xadba('0xf')](_0x5ebccb));if(_0x5ebccb[_0xadba('0x10')]){if(_0x5ebccb[_0xadba('0x10')][_0xadba('0x11')]===0x1f4){logger[_0xadba('0x10')](_0xadba('0xb'),_0x3de164,_0x5ebccb['error'][_0xadba('0x12')]);return _0x39b432(_0x5ebccb[_0xadba('0x10')]['message']);}logger[_0xadba('0x10')](_0xadba('0xb'),_0x3de164,_0x5ebccb[_0xadba('0x10')][_0xadba('0x12')]);return _0x35da87(_0x5ebccb[_0xadba('0x10')][_0xadba('0x12')]);}else{logger[_0xadba('0xa')](_0xadba('0xb'),_0x3de164,_0xadba('0xe'));_0x35da87(_0x5ebccb[_0xadba('0x13')][_0xadba('0x12')]);}})[_0xadba('0x14')](function(_0xe2809){logger[_0xadba('0x10')](_0xadba('0xb'),_0x3de164,_0xe2809);_0x39b432(_0xe2809);});});}exports[_0xadba('0x15')]=function(_0x1e50f9){var _0x52bf33=this;return new Promise(function(_0x186a95,_0x4bdd20){return db['MailApplication'][_0xadba('0x16')](_0x1e50f9[_0xadba('0x17')],{'raw':_0x1e50f9[_0xadba('0x18')]?_0x1e50f9[_0xadba('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e50f9['options']?_0x1e50f9[_0xadba('0x18')][_0xadba('0x19')]||null:null,'attributes':_0x1e50f9[_0xadba('0x18')]?_0x1e50f9['options'][_0xadba('0x1a')]||null:null,'limit':_0x1e50f9[_0xadba('0x18')]?_0x1e50f9['options']['limit']||null:null})['then'](function(_0x1fcadc){logger[_0xadba('0xa')](_0xadba('0x15'),_0x1e50f9);logger[_0xadba('0xc')](_0xadba('0x15'),_0x1e50f9,JSON[_0xadba('0xf')](_0x1fcadc));_0x186a95(_0x1fcadc);})[_0xadba('0x14')](function(_0x544d98){logger[_0xadba('0x10')](_0xadba('0x15'),_0x544d98[_0xadba('0x12')],_0x1e50f9);_0x4bdd20(_0x52bf33[_0xadba('0x10')](0x1f4,_0x544d98[_0xadba('0x12')]));});});}; \ No newline at end of file +var _0xd8a5=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','info','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','where','options','attributes','limit','lodash'];(function(_0x454865,_0x36efdd){var _0x32b8a6=function(_0x4e2c93){while(--_0x4e2c93){_0x454865['push'](_0x454865['shift']());}};_0x32b8a6(++_0x36efdd);}(_0xd8a5,0x81));var _0x5d8a=function(_0x309d15,_0x42be4f){_0x309d15=_0x309d15-0x0;var _0x5abbc6=_0xd8a5[_0x309d15];return _0x5abbc6;};'use strict';var _=require(_0x5d8a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5d8a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d8a('0x2'));var db=require(_0x5d8a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d8a('0x4'))('rpc');var config=require(_0x5d8a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x5d8a('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b5ab1,_0x37e9cc,_0xd423d9){return new BPromise(function(_0x50cad0,_0x3a29a1){return client[_0x5d8a('0x7')](_0x4b5ab1,_0xd423d9)['then'](function(_0xf9436f){logger[_0x5d8a('0x8')](_0x5d8a('0x9'),_0x37e9cc,'request\x20sent');logger['debug'](_0x5d8a('0xa'),_0x37e9cc,_0x5d8a('0xb'),JSON[_0x5d8a('0xc')](_0xf9436f));if(_0xf9436f[_0x5d8a('0xd')]){if(_0xf9436f[_0x5d8a('0xd')][_0x5d8a('0xe')]===0x1f4){logger['error'](_0x5d8a('0x9'),_0x37e9cc,_0xf9436f['error'][_0x5d8a('0xf')]);return _0x3a29a1(_0xf9436f['error'][_0x5d8a('0xf')]);}logger[_0x5d8a('0xd')](_0x5d8a('0x9'),_0x37e9cc,_0xf9436f[_0x5d8a('0xd')]['message']);return _0x50cad0(_0xf9436f[_0x5d8a('0xd')][_0x5d8a('0xf')]);}else{logger[_0x5d8a('0x8')]('MailApplication,\x20%s,\x20%s',_0x37e9cc,_0x5d8a('0xb'));_0x50cad0(_0xf9436f[_0x5d8a('0x10')][_0x5d8a('0xf')]);}})[_0x5d8a('0x11')](function(_0x2114ef){logger[_0x5d8a('0xd')]('MailApplication,\x20%s,\x20%s',_0x37e9cc,_0x2114ef);_0x3a29a1(_0x2114ef);});});}exports[_0x5d8a('0x12')]=function(_0x1a1e8e){var _0x25eb4e=this;return new Promise(function(_0x5b6e48,_0x441f6a){return db[_0x5d8a('0x13')][_0x5d8a('0x14')](_0x1a1e8e[_0x5d8a('0x15')],{'raw':_0x1a1e8e['options']?_0x1a1e8e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a1e8e['options']?_0x1a1e8e['options'][_0x5d8a('0x16')]||null:null,'attributes':_0x1a1e8e[_0x5d8a('0x17')]?_0x1a1e8e['options'][_0x5d8a('0x18')]||null:null,'limit':_0x1a1e8e[_0x5d8a('0x17')]?_0x1a1e8e[_0x5d8a('0x17')][_0x5d8a('0x19')]||null:null})['then'](function(_0x365796){logger[_0x5d8a('0x8')](_0x5d8a('0x12'),_0x1a1e8e);logger['debug'](_0x5d8a('0x12'),_0x1a1e8e,JSON[_0x5d8a('0xc')](_0x365796));_0x5b6e48(_0x365796);})[_0x5d8a('0x11')](function(_0x29db69){logger['error']('UpdateMailApplication',_0x29db69[_0x5d8a('0xf')],_0x1a1e8e);_0x441f6a(_0x25eb4e[_0x5d8a('0xd')](0x1f4,_0x29db69[_0x5d8a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index fc9c777..1d07d90 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 _0x1de0=['addTags','mailinteraction:update','update','delete','destroy','removeTags','exports','express','Router','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags'];(function(_0x5797cd,_0x15f7b7){var _0x20cb37=function(_0x32a0e7){while(--_0x32a0e7){_0x5797cd['push'](_0x5797cd['shift']());}};_0x20cb37(++_0x15f7b7);}(_0x1de0,0xc4));var _0x01de=function(_0x42c797,_0x16382b){_0x42c797=_0x42c797-0x0;var _0x320035=_0x1de0[_0x42c797];return _0x320035;};'use strict';var express=require(_0x01de('0x0'));var router=express[_0x01de('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x01de('0x2'));var controller=require('./mailInteraction.controller');router['get']('/',auth[_0x01de('0x3')](),controller[_0x01de('0x4')]);router[_0x01de('0x5')](_0x01de('0x6'),auth[_0x01de('0x3')](),controller['describe']);router[_0x01de('0x5')](_0x01de('0x7'),auth[_0x01de('0x3')](),controller[_0x01de('0x8')]);router[_0x01de('0x5')](_0x01de('0x9'),auth[_0x01de('0x3')](),controller[_0x01de('0xa')]);router[_0x01de('0x5')](_0x01de('0xb'),auth['isAuthenticated'](),controller[_0x01de('0xc')]);router[_0x01de('0xd')]('/',auth['isAuthenticated'](),controller[_0x01de('0xe')]);router[_0x01de('0xd')](_0x01de('0x9'),auth[_0x01de('0x3')](),controller[_0x01de('0xf')]);router[_0x01de('0xd')](_0x01de('0x10'),auth[_0x01de('0x3')](),interaction[_0x01de('0x11')](_0x01de('0x12'),_0x01de('0x13')),controller[_0x01de('0x14')]);router['put'](_0x01de('0x7'),auth[_0x01de('0x3')](),interaction[_0x01de('0x11')](_0x01de('0x12'),_0x01de('0x15')),controller[_0x01de('0x16')]);router[_0x01de('0x17')](_0x01de('0x7'),auth[_0x01de('0x3')](),interaction[_0x01de('0x11')]('mail','mailinteraction:destroy'),controller[_0x01de('0x18')]);router[_0x01de('0x17')]('/:id/tags',auth[_0x01de('0x3')](),controller[_0x01de('0x19')]);module[_0x01de('0x1a')]=router; \ No newline at end of file +var _0x31b5=['/:id/tags','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','mailinteraction:destroy','destroy'];(function(_0x38e1bd,_0x11841e){var _0x590385=function(_0x5a00f5){while(--_0x5a00f5){_0x38e1bd['push'](_0x38e1bd['shift']());}};_0x590385(++_0x11841e);}(_0x31b5,0x153));var _0x531b=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x31b5[_0x5ddb1c];return _0x354adc;};'use strict';var express=require(_0x531b('0x0'));var router=express[_0x531b('0x1')]();var auth=require(_0x531b('0x2'));var interaction=require(_0x531b('0x3'));var controller=require(_0x531b('0x4'));router[_0x531b('0x5')]('/',auth[_0x531b('0x6')](),controller['index']);router['get'](_0x531b('0x7'),auth[_0x531b('0x6')](),controller[_0x531b('0x8')]);router['get'](_0x531b('0x9'),auth[_0x531b('0x6')](),controller[_0x531b('0xa')]);router[_0x531b('0x5')](_0x531b('0xb'),auth[_0x531b('0x6')](),controller[_0x531b('0xc')]);router[_0x531b('0x5')](_0x531b('0xd'),auth[_0x531b('0x6')](),controller[_0x531b('0xe')]);router[_0x531b('0xf')]('/',auth[_0x531b('0x6')](),controller[_0x531b('0x10')]);router[_0x531b('0xf')]('/:id/messages',auth[_0x531b('0x6')](),controller['addMessage']);router[_0x531b('0xf')]('/:id/tags',auth[_0x531b('0x6')](),interaction[_0x531b('0x11')](_0x531b('0x12'),_0x531b('0x13')),controller['addTags']);router[_0x531b('0x14')]('/:id',auth[_0x531b('0x6')](),interaction['tracked']('mail',_0x531b('0x15')),controller[_0x531b('0x16')]);router['delete']('/:id',auth[_0x531b('0x6')](),interaction[_0x531b('0x11')](_0x531b('0x12'),_0x531b('0x17')),controller[_0x531b('0x18')]);router['delete'](_0x531b('0x19'),auth[_0x531b('0x6')](),controller[_0x531b('0x1a')]);module[_0x531b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index b91e2b7..860c14b 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 _0x7e46=['iconv','exports','BOOLEAN','STRING','TEXT','long','DATE','ENUM','sequelize'];(function(_0x4f35f4,_0x51a8c3){var _0x2e9a70=function(_0x110aca){while(--_0x110aca){_0x4f35f4['push'](_0x4f35f4['shift']());}};_0x2e9a70(++_0x51a8c3);}(_0x7e46,0x1a6));var _0x67e4=function(_0x4c039c,_0x18218e){_0x4c039c=_0x4c039c-0x0;var _0x2bfdee=_0x7e46[_0x4c039c];return _0x2bfdee;};'use strict';var Sequelize=require(_0x67e4('0x0'));var iconv=require(_0x67e4('0x1'));module[_0x67e4('0x2')]={'closed':{'type':Sequelize[_0x67e4('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x67e4('0x4')]},'secondDisposition':{'type':Sequelize[_0x67e4('0x4')]},'thirdDisposition':{'type':Sequelize[_0x67e4('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x67e4('0x4')](0x1fe)},'to':{'type':Sequelize[_0x67e4('0x4')]},'cc':{'type':Sequelize[_0x67e4('0x5')](_0x67e4('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x67e4('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x67e4('0x7')]},'substatus':{'type':Sequelize[_0x67e4('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x67e4('0x7')]},'firstMsgDirection':{'type':Sequelize[_0x67e4('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x67e4('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x67e4('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3baf=['BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','sequelize','iconv','exports'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x3baf,0xf7));var _0xf3ba=function(_0x132b71,_0x25f23e){_0x132b71=_0x132b71-0x0;var _0x224664=_0x3baf[_0x132b71];return _0x224664;};'use strict';var Sequelize=require(_0xf3ba('0x0'));var iconv=require(_0xf3ba('0x1'));module[_0xf3ba('0x2')]={'closed':{'type':Sequelize[_0xf3ba('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf3ba('0x4')]},'disposition':{'type':Sequelize[_0xf3ba('0x5')]},'secondDisposition':{'type':Sequelize[_0xf3ba('0x5')]},'thirdDisposition':{'type':Sequelize[_0xf3ba('0x5')]},'note':{'type':Sequelize[_0xf3ba('0x5')]},'inReplyTo':{'type':Sequelize[_0xf3ba('0x5')](0x1fe)},'to':{'type':Sequelize[_0xf3ba('0x5')]},'cc':{'type':Sequelize[_0xf3ba('0x6')](_0xf3ba('0x7'))},'subject':{'type':Sequelize[_0xf3ba('0x6')]()},'attach':{'type':Sequelize[_0xf3ba('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xf3ba('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf3ba('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xf3ba('0x8')]('in',_0xf3ba('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf3ba('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 dea7d8a..fe37651 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 _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x4a7a03,_0x288e4a){var _0x1ed2a4=function(_0x4eb658){while(--_0x4eb658){_0x4a7a03['push'](_0x4a7a03['shift']());}};_0x1ed2a4(++_0x288e4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('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');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file +var _0xa9e0=['o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','addMessage','ids','omit','getMessages','nolimit','MailInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','addTags','setTags','Tag','mailInteractionTags:save','download','join','root','server','tmp','attachments','Attachment','Attachments','subject','Messages','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','util','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','Users','fullname','Tags','split','forEach','push','TagIds','MailMessage','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','index','MailInteraction','rawAttributes','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','sort','filters','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','keys','some','compact','where','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','QueryTypes','SELECT','clone','i.id','order','contactName','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname'];(function(_0x539a36,_0x490ffd){var _0x2c558a=function(_0x5e4e17){while(--_0x5e4e17){_0x539a36['push'](_0x539a36['shift']());}};_0x2c558a(++_0x490ffd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x0a9e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x0a9e('0x4'));var squel=require(_0x0a9e('0x5'));var juice=require(_0x0a9e('0x6'));var Redis=require(_0x0a9e('0x7'));var qs=require(_0x0a9e('0x8'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0x0a9e('0x9'))(_0x0a9e('0xa'));var config=require(_0x0a9e('0xb'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0a9e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xe')]));require(_0x0a9e('0xf'))[_0x0a9e('0x10')](socket);function respondWithStatusCode(_0xfeb75b,_0xbd1168){_0xbd1168=_0xbd1168||0xcc;return function(_0x4a4c56){if(_0x4a4c56){return _0xfeb75b['sendStatus'](_0xbd1168);}return _0xfeb75b['status'](_0xbd1168)['end']();};}function respondWithResult(_0x273d4d,_0x36471c){_0x36471c=_0x36471c||0xc8;return function(_0xd5b662){if(_0xd5b662){return _0x273d4d[_0x0a9e('0x11')](_0x36471c)[_0x0a9e('0x12')](_0xd5b662);}};}function respondWithFilteredResult(_0x69aeb7,_0x5db4b0){return function(_0x4283ce){if(_0x4283ce){var _0x239b12=typeof _0x5db4b0[_0x0a9e('0x13')]===_0x0a9e('0x14')&&typeof _0x5db4b0[_0x0a9e('0x15')]===_0x0a9e('0x14');var _0x52a03d=_0x4283ce[_0x0a9e('0x16')];var _0x5d0880=_0x239b12?0x0:_0x5db4b0[_0x0a9e('0x13')];var _0x519dfd=_0x239b12?_0x4283ce[_0x0a9e('0x16')]:_0x5db4b0[_0x0a9e('0x13')]+_0x5db4b0['limit'];var _0x225616;if(_0x519dfd>=_0x52a03d){_0x519dfd=_0x52a03d;_0x225616=0xc8;}else{_0x225616=0xce;}_0x69aeb7['status'](_0x225616);return _0x69aeb7[_0x0a9e('0x17')](_0x0a9e('0x18'),_0x5d0880+'-'+_0x519dfd+'/'+_0x52a03d)[_0x0a9e('0x12')](_0x4283ce);}return null;};}function saveUpdates(_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x19')](_0x205fd6)[_0x0a9e('0x1a')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae){return function(_0x112016){if(_0x112016){return _0x112016[_0x0a9e('0x1b')]()[_0x0a9e('0x1a')](function(){_0x1314ae['status'](0xcc)[_0x0a9e('0x1c')]();});}};}function handleEntityNotFound(_0x155cce){return function(_0x53682f){if(!_0x53682f){_0x155cce[_0x0a9e('0x1d')](0x194);}return _0x53682f;};}function handleError(_0x5a09ef,_0x588269){_0x588269=_0x588269||0x1f4;return function(_0x3a02e1){logger[_0x0a9e('0x1e')](_0x3a02e1[_0x0a9e('0x1f')]);if(_0x3a02e1[_0x0a9e('0x20')]){delete _0x3a02e1['name'];}_0x5a09ef[_0x0a9e('0x11')](_0x588269)[_0x0a9e('0x21')](_0x3a02e1);};}function getInteractionUsers(_0x3b45bc,_0x4d00e6){return new BPromise(function(_0x370d86,_0x42ac8f){try{if(_0x4d00e6[_0x3b45bc['id']]){_0x3b45bc[_0x0a9e('0x22')]=_['map'](_0x4d00e6[_0x3b45bc['id']],function(_0x59181e){return{'id':_0x59181e['id'],'fullname':_0x59181e[_0x0a9e('0x23')]};});}}catch(_0x3a8e58){_0x42ac8f(_0x3a8e58);}_0x370d86(_0x3b45bc);});}function getInteractionTags(_0x40c424,_0x33161b){return new BPromise(function(_0x526cf3,_0x384319){try{if(_0x40c424['TagIds']){_0x40c424[_0x0a9e('0x24')]=[];_0x40c424['TagIds'][_0x0a9e('0x25')](',')[_0x0a9e('0x26')](function(_0x25fba9){_0x40c424[_0x0a9e('0x24')][_0x0a9e('0x27')](_0x33161b[_0x25fba9]);});}delete _0x40c424[_0x0a9e('0x28')];}catch(_0x11c3b6){_0x384319(_0x11c3b6);}_0x526cf3(_0x40c424);});}function getLastMessageText(_0x14de77){return new BPromise(function(_0x5a101a,_0x3652a7){return db[_0x0a9e('0x29')][_0x0a9e('0x2a')]({'where':{'$and':[{'MailInteractionId':_0x14de77['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0a9e('0x2b')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x0a9e('0x2c'),'raw':!![]})[_0x0a9e('0x1a')](function(_0x1843b2){if(_0x1843b2&&_0x1843b2[_0x0a9e('0x2d')]){_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1843b2[_0x0a9e('0x2d')]);}_0x5a101a(_0x14de77);})[_0x0a9e('0x30')](function(_0x1dbde2){_0x3652a7(_0x1dbde2);});});}function updateMailInteraction(_0x540530,_0x426950,_0x5d1e0e,_0x2407f9){return new BPromise(function(_0x3ae878,_0x1122db){return getInteractionUsers(_0x540530,_0x5d1e0e)[_0x0a9e('0x1a')](function(_0x25ce3a){return getInteractionTags(_0x25ce3a,_0x426950);})['then'](function(_0x66c1d2){if(_0x2407f9){_0x3ae878(getLastMessageText(_0x66c1d2));}else{_0x3ae878(_0x66c1d2);}})[_0x0a9e('0x30')](function(_0x40cb85){_0x1122db(_0x40cb85);});});}exports[_0x0a9e('0x31')]=function(_0x2b45ea,_0x409319){var _0x332d35={},_0x39e565={},_0x5583a4={'count':0x0,'rows':[]};var _0x44295a=_['map'](db[_0x0a9e('0x32')][_0x0a9e('0x33')],function(_0x2b7e7f){return{'name':_0x2b7e7f[_0x0a9e('0x34')],'type':_0x2b7e7f['type'][_0x0a9e('0x35')]};});_0x39e565[_0x0a9e('0x36')]=_[_0x0a9e('0x37')](_0x44295a,_0x0a9e('0x20'));_0x39e565['query']=_['keys'](_0x2b45ea[_0x0a9e('0x38')]);_0x39e565['filters']=_[_0x0a9e('0x39')](_0x39e565[_0x0a9e('0x36')],_0x39e565[_0x0a9e('0x38')]);_0x332d35[_0x0a9e('0x3a')]=_['intersection'](_0x39e565[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x2b45ea[_0x0a9e('0x38')]['fields']));_0x332d35[_0x0a9e('0x3a')]=_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x3c')]?_0x332d35['attributes']:_0x39e565['model'];if(!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3d')]('nolimit')){_0x332d35[_0x0a9e('0x15')]=qs[_0x0a9e('0x15')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x15')]);_0x332d35['offset']=qs['offset'](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x13')]);}_0x332d35['order']=qs[_0x0a9e('0x3e')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x332d35['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x2b45ea[_0x0a9e('0x38')],_0x39e565[_0x0a9e('0x3f')]),_0x44295a);var _0x13cb1f=[];var _0xeaa5e5=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x20'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')](_0x0a9e('0x45'));var _0x37f6cc=squel['select']()['field'](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x42')](_0x0a9e('0x48'))[_0x0a9e('0x44')](_0x0a9e('0x49'),'ui')[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'u',_0x0a9e('0x4c'));var _0x2c2cb0=squel[_0x0a9e('0x41')]()['from'](_0x0a9e('0x4d'),'i')[_0x0a9e('0x4a')](_0x0a9e('0x4e'),'c',_0x0a9e('0x4f'))[_0x0a9e('0x4a')](_0x0a9e('0x4b'),'o',_0x0a9e('0x50'))[_0x0a9e('0x4a')]('mail_accounts','a',_0x0a9e('0x51'))['left_join'](_0x0a9e('0x52'),'me',_0x0a9e('0x53'))[_0x0a9e('0x4a')]('mail_interaction_has_tags','it',_0x0a9e('0x54'))[_0x0a9e('0x4a')](_0x0a9e('0x45'),'t',_0x0a9e('0x55'));var _0x45c845=squel[_0x0a9e('0x56')]();var _0x45bf7f=[];var _0x5bbcde=squel[_0x0a9e('0x56')]();var _0x1bde3c;if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]){_0x1bde3c=as[_0x0a9e('0x58')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x57')]);var _0x19383e=_0x1bde3c[_0x0a9e('0x59')];for(var _0x58a5c2=0x0;_0x58a5c2<_0x1bde3c[_0x0a9e('0x5a')][_0x0a9e('0x3c')];_0x58a5c2++){var _0x4f7240=_0x1bde3c['conditions'][_0x58a5c2];var _0x5ddf84='i';var _0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,[_0x0a9e('0x20'),_0x4f7240[_0x0a9e('0x42')]]);if(!_0x1adfee){switch(_0x4f7240[_0x0a9e('0x42')]){case _0x0a9e('0x5c'):if(_0x4f7240[_0x0a9e('0x5d')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')]('`'+_0x4f7240['field']+'`\x20=\x200');}else{_0x2c2cb0['having']('`'+_0x4f7240[_0x0a9e('0x42')]+_0x0a9e('0x5f'));}break;case _0x0a9e('0x60'):if(_0x4f7240['operator']===_0x0a9e('0x61')){if(_0x4f7240[_0x0a9e('0x5d')]['split']('\x20')['length']>0x1){_0x45c845[_0x19383e](_0x0a9e('0x62'),qs['getFullTextValue'](_0x4f7240[_0x0a9e('0x5d')]),null);}else{var _0x4c3845='%'+_0x4f7240[_0x0a9e('0x5d')]+'%';_0x45c845[_0x19383e](_0x0a9e('0x63'),_0x4c3845,_0x4c3845,_0x4c3845);}}else{_0x1adfee=_[_0x0a9e('0x5b')](_0x44295a,['name',_0x0a9e('0x64')]);_0x4f7240[_0x0a9e('0x42')]='ContactId';_0x2244d6=as['buildExpression'](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6['value'][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'Tag':var _0xe22ccc=_0x4f7240['value']['split'](',')['map'](function(_0x2da03c){return Number(_0x2da03c);});_0xe22ccc['forEach'](function(_0x2f7092){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x2f7092+',%');});_0x45bf7f=_[_0x0a9e('0x69')](_0x45bf7f,_0xe22ccc);break;case _0x0a9e('0x6a'):if(_0x4f7240[_0x0a9e('0x6b')]===_0x0a9e('0x61')){_0x45c845[_0x19383e](_0x0a9e('0x6c'),'%'+_0x4f7240[_0x0a9e('0x5d')]+'%',null);}else{_0x1adfee=_['find'](_0x44295a,[_0x0a9e('0x20'),_0x0a9e('0x6d')]);_0x4f7240[_0x0a9e('0x42')]=_0x0a9e('0x6d');_0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}break;case'plainBody':_0x2244d6=as[_0x0a9e('0x6e')]('me',null,_0x4f7240);_0x45c845[_0x19383e](_0x2244d6['text'],_0x2244d6['value']['start'],_0x2244d6[_0x0a9e('0x5d')]['end']);break;}}else{var _0x2244d6=as[_0x0a9e('0x6e')](_0x5ddf84,_0x1adfee[_0x0a9e('0x65')],_0x4f7240);_0x45c845[_0x19383e](_0x2244d6[_0x0a9e('0x66')],_0x2244d6[_0x0a9e('0x5d')][_0x0a9e('0x67')],_0x2244d6['value'][_0x0a9e('0x1c')]);}}}else{var _0x5854cc=_(_0x2b45ea[_0x0a9e('0x38')])[_0x0a9e('0x6f')]()[_0x0a9e('0x37')](function(_0x5adf8f){return _[_0x0a9e('0x70')](_0x44295a,[_0x0a9e('0x20'),_0x5adf8f])?_0x5adf8f:undefined;})[_0x0a9e('0x71')]()[_0x0a9e('0x5d')]();if(!_['isEmpty'](_0x5854cc)){_0x5854cc[_0x0a9e('0x26')](function(_0xe05a5a){if(_0xe05a5a==='MailAccountId'){_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x73'),[][_0x0a9e('0x74')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]));}else if(_0xe05a5a===_0x0a9e('0x75')){var _0x4d4a35=JSON[_0x0a9e('0x76')](_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a])[_0x0a9e('0x77')];var _0x47bb43=JSON[_0x0a9e('0x76')](_0x2b45ea['query'][_0xe05a5a])['$lte'];_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x78'),_0x4d4a35,_0x47bb43);}else{if(_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]===_0x0a9e('0x79')){_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7a'));}else{_0x2c2cb0[_0x0a9e('0x72')]('i.'+_0xe05a5a+_0x0a9e('0x7b'),_0x2b45ea[_0x0a9e('0x38')][_0xe05a5a]);}}});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x7c')]==0x1){_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7d'));}else{_0x2c2cb0[_0x0a9e('0x5e')](_0x0a9e('0x7e'));}}if(_0x2b45ea[_0x0a9e('0x38')]['tag']){_0x45bf7f=_[_0x0a9e('0x7f')](_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x80')])?_0x2b45ea['query'][_0x0a9e('0x80')]:new Array(_0x2b45ea[_0x0a9e('0x38')]['tag']);_0x45bf7f[_0x0a9e('0x26')](function(_0x56e31e){_0x5bbcde['or'](_0x0a9e('0x68'),'%,'+_0x56e31e+',%');});}if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x81')]){var _0x4a43a8=_0x2b45ea['query']['filter'][_0x0a9e('0x82')]('\x5c','\x5c\x5c')[_0x0a9e('0x82')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x83')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x84'),_0x4a43a8+'%');}else if(qs[_0x0a9e('0x85')](_0x4a43a8)){_0x45c845['or'](_0x0a9e('0x86'),_0x4a43a8+'%');}else{_0x45c845['or'](_0x0a9e('0x87'),qs[_0x0a9e('0x88')](_0x4a43a8))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x0a9e('0x88')](_0x4a43a8));}}}_0x2c2cb0[_0x0a9e('0x72')](_0x45c845);_0x2c2cb0[_0x0a9e('0x89')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x8a')][_0x0a9e('0x8b')],'raw':!![]};var _0x4c46c1=_0x2c2cb0[_0x0a9e('0x8c')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5c'));if(_0x332d35[_0x0a9e('0x8e')]){_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x26')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x8f')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x2c2cb0[_0x0a9e('0x8e')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x90')?![]:!![]);});}if(!_['isEmpty'](_0x45bf7f)){_0x2c2cb0[_0x0a9e('0x5e')](_0x5bbcde);_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x91'),_0x45bf7f);}BPromise[_0x0a9e('0x92')]()[_0x0a9e('0x1a')](function(){if(!_0x1bde3c){if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return;_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x94'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x94'));return;}if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]!==_0x0a9e('0x97'))return;return _0x2b45ea['user'][_0x0a9e('0x98')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x1a')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x72')](_0x0a9e('0x99'));_0x2c2cb0[_0x0a9e('0x72')](_0x0a9e('0x99'));}else{_0x4c46c1['where']('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));_0x2c2cb0[_0x0a9e('0x72')]('i.MailAccountId\x20IN\x20?',_[_0x0a9e('0x37')](_0xc599b3,'id'));}});})['then'](function(){if(_0x2b45ea[_0x0a9e('0x95')][_0x0a9e('0x96')]==='agent'&&!_0x1bde3c&&!_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x93')])return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0x4c46c1[_0x0a9e('0x9b')](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x444f1f){_0x5583a4['count']=_0x444f1f[_0x0a9e('0x3c')];if(_0x5583a4[_0x0a9e('0x16')]===0x0)return[];return db[_0x0a9e('0x9a')][_0x0a9e('0x38')](_0xeaa5e5['toString'](),_0x2bdc44)[_0x0a9e('0x1a')](function(_0xf0db1){_0x13cb1f=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x9c')](_0x2bdc44,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2b45ea[_0x0a9e('0x38')][_0x0a9e('0x3b')]){_0x332d35[_0x0a9e('0x3a')][_0x0a9e('0x26')](function(_0x5af453){_0x2c2cb0['field']('i.'+_0x5af453);});}else{_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x9d'),_0x0a9e('0x5c'));_0x2c2cb0['field'](_0x0a9e('0x9e'),_0x0a9e('0x9f'));_0x2c2cb0['field']('a.mandatoryDisposition',_0x0a9e('0xa0'));_0x2c2cb0['field']('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');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0x8d'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa1'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa2'));_0x2c2cb0['field'](_0x0a9e('0xa3'));_0x2c2cb0['field'](_0x0a9e('0xa4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa5'));_0x2c2cb0[_0x0a9e('0x42')]('i.lastMsgAt');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa6'));_0x2c2cb0[_0x0a9e('0x42')]('i.subject');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa7'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xa9'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xaa'));_0x2c2cb0['field'](_0x0a9e('0xab'));_0x2c2cb0[_0x0a9e('0x42')]('i.ContactId');_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xac'));_0x2c2cb0[_0x0a9e('0x42')]('i.UserId');_0x2c2cb0[_0x0a9e('0x42')]('c.firstName',_0x0a9e('0xad'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xae'),_0x0a9e('0xaf'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb0'),_0x0a9e('0xb1'));_0x2c2cb0[_0x0a9e('0x42')]('c.phone',_0x0a9e('0xb2'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb3'),_0x0a9e('0xb4'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb5'),_0x0a9e('0xb6'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb7'),_0x0a9e('0xb8'));_0x2c2cb0[_0x0a9e('0x42')](_0x0a9e('0xb9'),_0x0a9e('0xba'));_0x2c2cb0['field'](_0x0a9e('0xbb'),_0x0a9e('0x28'));}if(_0x332d35[_0x0a9e('0x15')])_0x2c2cb0[_0x0a9e('0x15')](_0x332d35[_0x0a9e('0x15')]);if(_0x332d35['offset'])_0x2c2cb0[_0x0a9e('0x13')](_0x332d35[_0x0a9e('0x13')]);return db['sequelize'][_0x0a9e('0x38')](_0x2c2cb0['toString'](),_0x2bdc44);})[_0x0a9e('0x1a')](function(_0x27041d){if(_0x27041d[_0x0a9e('0x3c')]>0x0)_0x37f6cc[_0x0a9e('0x72')]('ui.MailInteractionId\x20IN\x20?',_[_0x0a9e('0x37')](_0x27041d,'id'));return db['sequelize'][_0x0a9e('0x38')](_0x37f6cc[_0x0a9e('0x9b')](),_0x2bdc44)['then'](function(_0x231c6a){var _0x63c9f7=_[_0x0a9e('0xbc')](_0x231c6a,'MailInteractionId');var _0x4c788f=[];return db[_0x0a9e('0xbd')][_0x0a9e('0x2a')]({'attributes':[_0x0a9e('0xbe')],'raw':!![]})[_0x0a9e('0x1a')](function(_0x3f2f40){var _0x2450a8=_0x3f2f40[_0x0a9e('0xbe')];_0x27041d[_0x0a9e('0x26')](function(_0x3f8124){_0x4c788f['push'](updateMailInteraction(_0x3f8124,_0x13cb1f,_0x63c9f7,_0x2450a8));});return BPromise[_0x0a9e('0xbf')](_0x4c788f);});});});})['then'](function(_0x287324){_0x5583a4[_0x0a9e('0xc0')]=_0x287324;return _0x5583a4;})[_0x0a9e('0x1a')](respondWithFilteredResult(_0x409319,_0x332d35))[_0x0a9e('0x30')](handleError(_0x409319,null));};exports[_0x0a9e('0xc1')]=function(_0x4e7273,_0x436313){var _0x4667bf={'raw':![],'where':{'id':_0x4e7273[_0x0a9e('0xc2')]['id']}},_0x2791c5={};_0x2791c5[_0x0a9e('0x36')]=_['keys'](db['MailInteraction'][_0x0a9e('0x33')]);_0x2791c5['query']=_[_0x0a9e('0x6f')](_0x4e7273[_0x0a9e('0x38')]);_0x2791c5[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x2791c5[_0x0a9e('0x36')],_0x2791c5[_0x0a9e('0x38')]);_0x4667bf['attributes']=_['intersection'](_0x2791c5[_0x0a9e('0x36')],qs['fields'](_0x4e7273[_0x0a9e('0x38')]['fields']));_0x4667bf[_0x0a9e('0x3a')]=_0x4667bf['attributes']['length']?_0x4667bf[_0x0a9e('0x3a')]:_0x2791c5[_0x0a9e('0x36')];if(_0x4e7273['query'][_0x0a9e('0xc3')]){_0x4667bf[_0x0a9e('0xc4')]=[{'all':!![]}];}_0x4667bf=_[_0x0a9e('0x9c')]({},_0x4667bf,_0x4e7273[_0x0a9e('0xc5')]);return db[_0x0a9e('0x32')]['find'](_0x4667bf)['then'](handleEntityNotFound(_0x436313,null))[_0x0a9e('0x1a')](respondWithResult(_0x436313,null))[_0x0a9e('0x30')](handleError(_0x436313,null));};exports[_0x0a9e('0xc6')]=function(_0x24beb6,_0x59303b){return db['MailInteraction'][_0x0a9e('0xc6')](_0x24beb6[_0x0a9e('0xc7')],{})['then'](respondWithResult(_0x59303b,0xc9))[_0x0a9e('0x30')](handleError(_0x59303b,null));};exports[_0x0a9e('0x19')]=function(_0xcacabb,_0x2427d5){if(_0xcacabb[_0x0a9e('0xc7')]['id']){delete _0xcacabb[_0x0a9e('0xc7')]['id'];}return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0xcacabb[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x2427d5,null))['then'](saveUpdates(_0xcacabb[_0x0a9e('0xc7')],null))[_0x0a9e('0x1a')](respondWithResult(_0x2427d5,null))[_0x0a9e('0x30')](handleError(_0x2427d5,null));};exports[_0x0a9e('0x1b')]=function(_0x1d0b02,_0x547e37){return db['MailInteraction'][_0x0a9e('0x5b')]({'where':{'id':_0x1d0b02[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x547e37,null))[_0x0a9e('0x1a')](removeEntity(_0x547e37,null))[_0x0a9e('0x30')](handleError(_0x547e37,null));};exports['describe']=function(_0x1339d0,_0x3c775a){return db[_0x0a9e('0x32')]['describe']()[_0x0a9e('0x1a')](respondWithResult(_0x3c775a,null))['catch'](handleError(_0x3c775a,null));};exports[_0x0a9e('0xc8')]=function(_0x4799d4,_0x25b745){return db[_0x0a9e('0x29')][_0x0a9e('0x5b')]({'where':{'id':_0x4799d4['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x25b745,null))['then'](function(_0x4383da){if(_0x4383da){return _0x4383da[_0x0a9e('0xc8')](_0x4799d4[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x4799d4[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{});}})[_0x0a9e('0x1a')](respondWithResult(_0x25b745,null))[_0x0a9e('0x30')](handleError(_0x25b745,null));};exports[_0x0a9e('0xcb')]=function(_0x4262d0,_0xc876d4){var _0x2415fe={'raw':![],'where':{}};var _0x399def={};var _0x98c62c={'count':0x0,'rows':[]};return db[_0x0a9e('0x32')]['findOne']({'where':{'id':_0x4262d0['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0xc876d4,null))['then'](function(_0x1d999b){if(_0x1d999b){_0x399def[_0x0a9e('0x36')]=_['keys'](db[_0x0a9e('0x29')][_0x0a9e('0x33')]);_0x399def[_0x0a9e('0x38')]=_[_0x0a9e('0x6f')](_0x4262d0['query']);_0x399def[_0x0a9e('0x3f')]=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],_0x399def[_0x0a9e('0x38')]);_0x2415fe['attributes']=_[_0x0a9e('0x39')](_0x399def[_0x0a9e('0x36')],qs[_0x0a9e('0x3b')](_0x4262d0['query'][_0x0a9e('0x3b')]));_0x2415fe[_0x0a9e('0x3a')]=_0x2415fe[_0x0a9e('0x3a')]['length']?_0x2415fe[_0x0a9e('0x3a')]:_0x399def[_0x0a9e('0x36')];if(!_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3d')](_0x0a9e('0xcc'))){_0x2415fe['limit']=qs[_0x0a9e('0x15')](_0x4262d0[_0x0a9e('0x38')]['limit']);_0x2415fe[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x4262d0[_0x0a9e('0x38')]['offset']);}_0x2415fe['order']=qs['sort'](_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x3e')]);_0x2415fe['where']=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x40')](_0x4262d0[_0x0a9e('0x38')],_0x399def['filters']));_0x2415fe[_0x0a9e('0x72')][_0x0a9e('0xcd')]=_0x1d999b['id'];if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x81')]){_0x2415fe[_0x0a9e('0x72')]=_[_0x0a9e('0x9c')](_0x2415fe[_0x0a9e('0x72')],{'$or':_[_0x0a9e('0x37')](_0x2415fe[_0x0a9e('0x3a')],function(_0x5a1848){var _0x43c397={};_0x43c397[_0x5a1848]={'$like':'%'+_0x4262d0['query'][_0x0a9e('0x81')]+'%'};return _0x43c397;})});}if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]){var _0x3cf222=_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0x77')]['split'](',');var _0x1a0314={};_0x1a0314[_0x3cf222[0x0]]={'$gte':moment(_0x3cf222[0x1])[_0x0a9e('0xce')](_0x0a9e('0xcf'))};_0x2415fe[_0x0a9e('0x72')]=_['merge'](_0x2415fe[_0x0a9e('0x72')],_0x1a0314);}_0x2415fe=_[_0x0a9e('0x9c')]({},_0x2415fe,_0x4262d0[_0x0a9e('0xc5')]);return db[_0x0a9e('0x29')][_0x0a9e('0x16')]({'where':_0x2415fe[_0x0a9e('0x72')]})[_0x0a9e('0x1a')](function(_0x25931e){_0x98c62c[_0x0a9e('0x16')]=_0x25931e;if(_0x4262d0[_0x0a9e('0x38')]['includeAll']){_0x2415fe[_0x0a9e('0xc4')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0xd0')](_0x2415fe);})[_0x0a9e('0x1a')](function(_0xea8bd1){if(_0x4262d0[_0x0a9e('0x38')][_0x0a9e('0xd1')]===_0x0a9e('0xd2')){for(var _0x566b90=0x0;_0x566b90<_0xea8bd1[_0x0a9e('0x3c')];_0x566b90++){_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]=juice(_0xea8bd1[_0x566b90][_0x0a9e('0xc7')]);}}_0x98c62c['rows']=_0xea8bd1;return _0x98c62c;});}})[_0x0a9e('0x1a')](respondWithFilteredResult(_0xc876d4,_0x2415fe))[_0x0a9e('0x30')](handleError(_0xc876d4,null));};exports[_0x0a9e('0xd3')]=function(_0x97d5b5,_0x370b5e){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x97d5b5[_0x0a9e('0xc2')]['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x370b5e,null))[_0x0a9e('0x1a')](function(_0x5a7dad){if(_0x5a7dad){return _0x5a7dad[_0x0a9e('0xd4')](_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')],_[_0x0a9e('0xca')](_0x97d5b5[_0x0a9e('0xc7')],[_0x0a9e('0xc9'),'id'])||{})['spread'](function(){return db[_0x0a9e('0xd5')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x97d5b5[_0x0a9e('0xc7')][_0x0a9e('0xc9')]}});})[_0x0a9e('0x1a')](function(_0x2a07d0){socket['emit'](_0x0a9e('0xd6'),{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]});return{'id':Number(_0x97d5b5[_0x0a9e('0xc2')]['id']),'tags':_0x2a07d0||[]};});}})[_0x0a9e('0x1a')](respondWithResult(_0x370b5e,null))[_0x0a9e('0x30')](handleError(_0x370b5e,null));};exports['removeTags']=function(_0x57b1b1,_0x9484c8){return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x57b1b1['params']['id']}})[_0x0a9e('0x1a')](handleEntityNotFound(_0x9484c8,null))[_0x0a9e('0x1a')](function(_0x422f0a){if(_0x422f0a){return _0x422f0a['removeTags'](_0x57b1b1[_0x0a9e('0x38')][_0x0a9e('0xc9')]);}})[_0x0a9e('0x1a')](respondWithStatusCode(_0x9484c8,null))['catch'](handleError(_0x9484c8,null));};exports[_0x0a9e('0xd7')]=function(_0x336b30,_0x3b7213){var _0x549e03=moment()['unix']()['toString']();var _0x3b04fd=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdb'));var _0x532424=path[_0x0a9e('0xd8')](config[_0x0a9e('0xd9')],_0x0a9e('0xda'),'files',_0x0a9e('0xdc'));var _0x33a26c=path[_0x0a9e('0xd8')](_0x3b04fd,_0x549e03);var _0x580dd6=util[_0x0a9e('0xce')]('transcript-%d-%s.zip',_0x336b30[_0x0a9e('0xc2')]['id'],_0x549e03);var _0x5c57e1=path[_0x0a9e('0xd8')](_0x3b04fd,_0x580dd6);var _0x57b7d4=[];if(_0x336b30[_0x0a9e('0x38')][_0x0a9e('0xdc')]){_0x57b7d4[_0x0a9e('0x27')]({'model':db[_0x0a9e('0xdd')],'as':_0x0a9e('0xde'),'raw':!![]});}var _0x251dd9=[{'model':db[_0x0a9e('0x29')],'as':'Messages','attributes':['id',_0x0a9e('0xc7'),_0x0a9e('0x44'),'to','cc','bcc',_0x0a9e('0xdf'),_0x0a9e('0x75')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x57b7d4}];return db[_0x0a9e('0x32')][_0x0a9e('0x5b')]({'where':{'id':_0x336b30[_0x0a9e('0xc2')]['id']},'include':_0x251dd9})['then'](handleEntityNotFound(_0x3b7213,null))[_0x0a9e('0x1a')](function(_0xf49ed4){if(_0xf49ed4&&_0xf49ed4[_0x0a9e('0xe0')]){var _0x3f0d64=_0xf49ed4[_0x0a9e('0xe1')]({'plain':!![]});fs[_0x0a9e('0xe2')](_0x33a26c);return BPromise[_0x0a9e('0xe3')](_0x3f0d64[_0x0a9e('0xe0')],function(_0x22767f,_0x426c3c){var _0x56e148={'from':_0x22767f[_0x0a9e('0x44')],'to':_0x22767f['to'],'subject':_0x22767f['subject'],'html':_0x22767f[_0x0a9e('0xc7')],'headers':{'Date':moment(_0x22767f[_0x0a9e('0x75')])[_0x0a9e('0xce')](_0x0a9e('0xe4'))},'attachments':[]};if(_0x22767f['cc']){_0x56e148[_0x0a9e('0xe5')]['Cc']=_0x22767f['cc'];}if(_0x22767f[_0x0a9e('0xe6')]){_0x56e148['headers'][_0x0a9e('0xe7')]=_0x22767f[_0x0a9e('0xe6')];}return new BPromise(function(_0x2977a7,_0x55a599){if(_0x22767f[_0x0a9e('0xde')]){for(var _0x402544=0x0;_0x402544<_0x22767f[_0x0a9e('0xde')][_0x0a9e('0x3c')];_0x402544++){var _0x31e1e0=_0x22767f[_0x0a9e('0xde')][_0x402544];var _0x1e93f5=path['join'](_0x532424,_0x31e1e0[_0x0a9e('0xe8')]);if(fs[_0x0a9e('0xe9')](_0x1e93f5)){_0x56e148[_0x0a9e('0xdc')][_0x0a9e('0x27')]({'name':_0x31e1e0[_0x0a9e('0x20')],'contentType':_0x31e1e0[_0x0a9e('0x65')],'data':fs[_0x0a9e('0xea')](_0x1e93f5)});}}}emlformat['build'](_0x56e148,function(_0x5c8720,_0x10aa22){if(_0x5c8720)return _0x55a599(_0x5c8720);fs[_0x0a9e('0xeb')](path[_0x0a9e('0xd8')](_0x33a26c,util[_0x0a9e('0xce')](_0x0a9e('0xec'),_0x426c3c)),_0x10aa22);return _0x2977a7(_0x10aa22);});});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x609711,_0x584854){zipdir(_0x33a26c,{'saveTo':_0x5c57e1},function(_0x39ea62,_0x1d7fc4){if(_0x39ea62)return _0x584854(_0x39ea62);return _0x609711(_0x1d7fc4);});})[_0x0a9e('0x1a')](function(){return new BPromise(function(_0x2675a5,_0x1b1757){rimraf(_0x33a26c,function(_0x3c6082){if(_0x3c6082)_0x1b1757(_0x3c6082);return _0x2675a5();});});})[_0x0a9e('0x1a')](function(){return _0x3b7213['download'](_0x5c57e1,_0x580dd6,function(_0x311288){if(!_0x311288)fs[_0x0a9e('0xed')](_0x5c57e1);});});});}else{return _0x3b7213[_0x0a9e('0x1d')](0xc8);}})['catch'](handleError(_0x3b7213,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index cb6949e..9f86809 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 _0xbb5f=['findAll','unreadMessages','length','emit','catch','hook','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','then','setDataValue','map'];(function(_0x5d5af2,_0x5b5708){var _0xa1fb0=function(_0x3a7aee){while(--_0x3a7aee){_0x5d5af2['push'](_0x5d5af2['shift']());}};_0xa1fb0(++_0x5b5708);}(_0xbb5f,0x19e));var _0xfbb5=function(_0x3d1db7,_0x5d5b4b){_0x3d1db7=_0x3d1db7-0x0;var _0xab9d36=_0xbb5f[_0x3d1db7];return _0xab9d36;};'use strict';var EventEmitter=require(_0xfbb5('0x0'));var MailInteraction=require(_0xfbb5('0x1'))['db'][_0xfbb5('0x2')];var MailMessage=require('../../mysqldb')['db'][_0xfbb5('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xfbb5('0x4')](0x0);var events={'afterCreate':_0xfbb5('0x5'),'afterUpdate':_0xfbb5('0x6'),'afterDestroy':_0xfbb5('0x7')};function emitEvent(_0x14853d){return function(_0x5b77a1,_0x780cc7,_0x12a4be){_0x5b77a1['getUsers']({'attributes':['id'],'raw':!![]})[_0xfbb5('0x8')](function(_0x37a58f){_0x5b77a1[_0xfbb5('0x9')]('Users',_0x37a58f[_0xfbb5('0xa')](function(_0x40e240){return{'id':_0x40e240['id']};}));return MailMessage[_0xfbb5('0xb')]({'where':{'MailInteractionId':_0x5b77a1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xfbb5('0x8')](function(_0x38f649){_0x5b77a1[_0xfbb5('0x9')](_0xfbb5('0xc'),_0x38f649[_0xfbb5('0xd')]);MailInteractionEvents['emit'](_0x14853d+':'+_0x5b77a1['id'],_0x5b77a1);MailInteractionEvents[_0xfbb5('0xe')](_0x14853d,_0x5b77a1);_0x12a4be(null);})[_0xfbb5('0xf')](_0x12a4be(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xfbb5('0x10')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0xb2e1=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','update','getUsers','then','map','findAll'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0xb2e1,0x98));var _0x1b2e=function(_0x38894d,_0x1883d8){_0x38894d=_0x38894d-0x0;var _0x5614fe=_0xb2e1[_0x38894d];return _0x5614fe;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x1b2e('0x0'))['db'][_0x1b2e('0x1')];var MailMessage=require(_0x1b2e('0x0'))['db'][_0x1b2e('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1b2e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x46520f){return function(_0x403dd9,_0xf6af38,_0x463542){_0x403dd9[_0x1b2e('0x4')]({'attributes':['id'],'raw':!![]})[_0x1b2e('0x5')](function(_0x59542a){_0x403dd9['setDataValue']('Users',_0x59542a[_0x1b2e('0x6')](function(_0x51b1ed){return{'id':_0x51b1ed['id']};}));return MailMessage[_0x1b2e('0x7')]({'where':{'MailInteractionId':_0x403dd9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1b2e('0x5')](function(_0x4d0308){_0x403dd9[_0x1b2e('0x8')](_0x1b2e('0x9'),_0x4d0308[_0x1b2e('0xa')]);MailInteractionEvents[_0x1b2e('0xb')](_0x46520f+':'+_0x403dd9['id'],_0x403dd9);MailInteractionEvents[_0x1b2e('0xb')](_0x46520f,_0x403dd9);_0x463542(null);})[_0x1b2e('0xc')](_0x463542(null));};}for(var e in events){if(events[_0x1b2e('0xd')](e)){var event=events[e];MailInteraction[_0x1b2e('0xe')](e,emitEvent(event));}}module[_0x1b2e('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 30556a8..3f36668 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 _0xe2f3=['utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','models','MailMessage','then','catch','utf8mb4'];(function(_0x324391,_0xea93c9){var _0x305cca=function(_0x598291){while(--_0x598291){_0x324391['push'](_0x324391['shift']());}};_0x305cca(++_0xea93c9);}(_0xe2f3,0x151));var _0x3e2f=function(_0x38831b,_0x4611ea){_0x38831b=_0x38831b-0x0;var _0x5a508a=_0xe2f3[_0x38831b];return _0x5a508a;};'use strict';var _=require('lodash');var util=require(_0x3e2f('0x0'));var logger=require(_0x3e2f('0x1'))(_0x3e2f('0x2'));var moment=require('moment');var BPromise=require(_0x3e2f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e2f('0x4'));var rimraf=require(_0x3e2f('0x5'));var config=require(_0x3e2f('0x6'));var attributes=require(_0x3e2f('0x7'));module[_0x3e2f('0x8')]=function(_0x18176a,_0x30cfab){return _0x18176a[_0x3e2f('0x9')](_0x3e2f('0xa'),attributes,{'tableName':_0x3e2f('0xb'),'paranoid':![],'indexes':[{'name':_0x3e2f('0xc'),'fields':[_0x3e2f('0xd'),'to'],'type':_0x3e2f('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4ac438,_0x56c0ca,_0x37ed97){if(_0x4ac438[_0x3e2f('0xf')]){_0x4ac438['substatusAt']=moment()[_0x3e2f('0x10')](_0x3e2f('0x11'));}if(_0x4ac438[_0x3e2f('0x12')]){_0x4ac438[_0x3e2f('0x13')]=moment()[_0x3e2f('0x10')](_0x3e2f('0x11'));}_0x37ed97(null,_0x56c0ca);},'beforeUpdate':function(_0x5af775,_0x374bbf,_0x24704b){if(_0x5af775[_0x3e2f('0x14')](_0x3e2f('0xf'))){_0x5af775[_0x3e2f('0x15')]=_0x5af775[_0x3e2f('0xf')]?moment()[_0x3e2f('0x10')](_0x3e2f('0x11')):null;}if(_0x5af775[_0x3e2f('0x14')](_0x3e2f('0x12'))){_0x5af775[_0x3e2f('0x13')]=moment()[_0x3e2f('0x10')](_0x3e2f('0x11'));_0x5af775[_0x3e2f('0xf')]=null;_0x5af775[_0x3e2f('0x15')]=null;}_0x24704b(null,_0x5af775);},'afterUpdate':function(_0x1e8097,_0x19e75d,_0x11f977){var _0x3e3625=_0x18176a[_0x3e2f('0x16')];var _0xd2ab27=_0x1e8097['get']({'plain':!![]});if(_0xd2ab27[_0x3e2f('0x12')]){return _0x3e3625[_0x3e2f('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0xd2ab27['id']}})[_0x3e2f('0x18')](function(){_0x11f977();})[_0x3e2f('0x19')](function(_0x4fb434){_0x11f977(_0x4fb434);});}else{_0x11f977();}}},'charset':_0x3e2f('0x1a'),'collate':_0x3e2f('0x1b')});}; \ No newline at end of file +var _0x8498=['update','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','MailMessage'];(function(_0x2a3420,_0x378bbf){var _0x4de6ad=function(_0x573ac8){while(--_0x573ac8){_0x2a3420['push'](_0x2a3420['shift']());}};_0x4de6ad(++_0x378bbf);}(_0x8498,0x10b));var _0x8849=function(_0x1aed60,_0x3818f1){_0x1aed60=_0x1aed60-0x0;var _0x32e8b6=_0x8498[_0x1aed60];return _0x32e8b6;};'use strict';var _=require(_0x8849('0x0'));var util=require(_0x8849('0x1'));var logger=require(_0x8849('0x2'))(_0x8849('0x3'));var moment=require(_0x8849('0x4'));var BPromise=require(_0x8849('0x5'));var rp=require(_0x8849('0x6'));var fs=require('fs');var path=require(_0x8849('0x7'));var rimraf=require('rimraf');var config=require(_0x8849('0x8'));var attributes=require(_0x8849('0x9'));module['exports']=function(_0x5e80e3,_0x446943){return _0x5e80e3['define']('MailInteraction',attributes,{'tableName':_0x8849('0xa'),'paranoid':![],'indexes':[{'name':_0x8849('0xb'),'fields':['subject','to'],'type':_0x8849('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3a7842,_0x4ea3aa,_0x3e2659){if(_0x3a7842[_0x8849('0xd')]){_0x3a7842[_0x8849('0xe')]=moment()[_0x8849('0xf')](_0x8849('0x10'));}if(_0x3a7842[_0x8849('0x11')]){_0x3a7842[_0x8849('0x12')]=moment()[_0x8849('0xf')](_0x8849('0x10'));}_0x3e2659(null,_0x4ea3aa);},'beforeUpdate':function(_0x38e54e,_0x291f49,_0x540232){if(_0x38e54e[_0x8849('0x13')](_0x8849('0xd'))){_0x38e54e[_0x8849('0xe')]=_0x38e54e[_0x8849('0xd')]?moment()['format'](_0x8849('0x10')):null;}if(_0x38e54e['changed'](_0x8849('0x11'))){_0x38e54e['closedAt']=moment()[_0x8849('0xf')](_0x8849('0x10'));_0x38e54e[_0x8849('0xd')]=null;_0x38e54e[_0x8849('0xe')]=null;}_0x540232(null,_0x38e54e);},'afterUpdate':function(_0x224c79,_0x4fc689,_0x5b18e6){var _0x2a6d93=_0x5e80e3['models'];var _0x2400ee=_0x224c79['get']({'plain':!![]});if(_0x2400ee[_0x8849('0x11')]){return _0x2a6d93[_0x8849('0x14')][_0x8849('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x2400ee['id']}})['then'](function(){_0x5b18e6();})['catch'](function(_0x3f65d9){_0x5b18e6(_0x3f65d9);});}else{_0x5b18e6();}}},'charset':_0x8849('0x16'),'collate':_0x8849('0x17')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 4b54257..cd21b61 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 _0xa267=['redis','defaults','localhost','socket.io-emitter','request','then','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','limit','catch','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x53b6ae,_0x3cb9f4){var _0x34f4b2=function(_0x4b3169){while(--_0x4b3169){_0x53b6ae['push'](_0x53b6ae['shift']());}};_0x34f4b2(++_0x3cb9f4);}(_0xa267,0xcb));var _0x7a26=function(_0x6187bc,_0x271491){_0x6187bc=_0x6187bc-0x0;var _0x247d2f=_0xa267[_0x6187bc];return _0x247d2f;};'use strict';var _=require(_0x7a26('0x0'));var util=require(_0x7a26('0x1'));var moment=require(_0x7a26('0x2'));var BPromise=require('bluebird');var rs=require(_0x7a26('0x3'));var fs=require('fs');var Redis=require(_0x7a26('0x4'));var db=require(_0x7a26('0x5'))['db'];var utils=require(_0x7a26('0x6'));var logger=require(_0x7a26('0x7'))(_0x7a26('0x8'));var config=require(_0x7a26('0x9'));var jayson=require(_0x7a26('0xa'));var client=jayson['client'][_0x7a26('0xb')]({'port':0x232a});config[_0x7a26('0xc')]=_[_0x7a26('0xd')](config['redis'],{'host':_0x7a26('0xe'),'port':0x18eb});var socket=require(_0x7a26('0xf'))(new Redis(config[_0x7a26('0xc')]));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1fd875,_0x327acd,_0x11ab4e){return new BPromise(function(_0x3f854d,_0x2d8e4a){return client[_0x7a26('0x10')](_0x1fd875,_0x11ab4e)[_0x7a26('0x11')](function(_0xf0a634){logger['info'](_0x7a26('0x12'),_0x327acd,'request\x20sent');logger[_0x7a26('0x13')](_0x7a26('0x14'),_0x327acd,_0x7a26('0x15'),JSON[_0x7a26('0x16')](_0xf0a634));if(_0xf0a634[_0x7a26('0x17')]){if(_0xf0a634[_0x7a26('0x17')][_0x7a26('0x18')]===0x1f4){logger['error'](_0x7a26('0x12'),_0x327acd,_0xf0a634[_0x7a26('0x17')][_0x7a26('0x19')]);return _0x2d8e4a(_0xf0a634[_0x7a26('0x17')][_0x7a26('0x19')]);}logger[_0x7a26('0x17')](_0x7a26('0x12'),_0x327acd,_0xf0a634[_0x7a26('0x17')]['message']);return _0x3f854d(_0xf0a634[_0x7a26('0x17')][_0x7a26('0x19')]);}else{logger[_0x7a26('0x1a')]('MailInteraction,\x20%s,\x20%s',_0x327acd,'request\x20sent');_0x3f854d(_0xf0a634[_0x7a26('0x1b')][_0x7a26('0x19')]);}})['catch'](function(_0x5dcc0a){logger[_0x7a26('0x17')]('MailInteraction,\x20%s,\x20%s',_0x327acd,_0x5dcc0a);_0x2d8e4a(_0x5dcc0a);});});}exports[_0x7a26('0x1c')]=function(_0x581354){var _0x54354e=this;return new Promise(function(_0x323b8d,_0x5019d9){return db[_0x7a26('0x1d')][_0x7a26('0x1e')](_0x581354[_0x7a26('0x1f')],{'raw':_0x581354['options']?_0x581354[_0x7a26('0x20')][_0x7a26('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x581354[_0x7a26('0x20')]?_0x581354['options']['where']||null:null,'attributes':_0x581354[_0x7a26('0x20')]?_0x581354[_0x7a26('0x20')][_0x7a26('0x22')]||null:null,'limit':_0x581354['options']?_0x581354[_0x7a26('0x20')][_0x7a26('0x23')]||null:null})[_0x7a26('0x11')](function(_0x4420d4){logger[_0x7a26('0x1a')](_0x7a26('0x1c'),_0x581354);logger['debug'](_0x7a26('0x1c'),_0x581354,JSON[_0x7a26('0x16')](_0x4420d4));_0x323b8d(_0x4420d4);})[_0x7a26('0x24')](function(_0x265e65){logger[_0x7a26('0x17')](_0x7a26('0x1c'),_0x265e65[_0x7a26('0x19')],_0x581354);_0x5019d9(_0x54354e['error'](0x1f4,_0x265e65[_0x7a26('0x19')]));});});};exports['AddTagsToMailInteraction']=function(_0x553c25){return new Promise(function(_0x503ec8,_0x1dbf1e){return db[_0x7a26('0x1d')][_0x7a26('0x25')]({'where':_0x553c25[_0x7a26('0x20')]?_0x553c25[_0x7a26('0x20')]['where']||null:null})[_0x7a26('0x11')](function(_0x186792){if(_0x186792){return _0x186792[_0x7a26('0x26')](_0x553c25[_0x7a26('0x1f')][_0x7a26('0x27')],_[_0x7a26('0x28')](_0x553c25[_0x7a26('0x1f')],['ids','id'])||{});}})[_0x7a26('0x29')](function(_0x114eea){logger[_0x7a26('0x1a')](_0x7a26('0x2a'),_0x553c25);logger['debug'](_0x7a26('0x2a'),_0x553c25,JSON[_0x7a26('0x16')](_0x114eea));_0x503ec8(_0x114eea);})[_0x7a26('0x24')](function(_0x2c788c){logger[_0x7a26('0x17')](_0x7a26('0x2a'),_0x2c788c[_0x7a26('0x19')],_0x553c25);_0x1dbf1e(_this[_0x7a26('0x17')](0x1f4,_0x2c788c['message']));});});}; \ No newline at end of file +var _0xaeeb=['where','addTags','ids','spread','AddTags','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','limit','then'];(function(_0x5b2a39,_0x5b7d5e){var _0x3b2533=function(_0x581946){while(--_0x581946){_0x5b2a39['push'](_0x5b2a39['shift']());}};_0x3b2533(++_0x5b7d5e);}(_0xaeeb,0x116));var _0xbaee=function(_0x1d997f,_0x259b5a){_0x1d997f=_0x1d997f-0x0;var _0x307704=_0xaeeb[_0x1d997f];return _0x307704;};'use strict';var _=require('lodash');var util=require(_0xbaee('0x0'));var moment=require(_0xbaee('0x1'));var BPromise=require('bluebird');var rs=require(_0xbaee('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbaee('0x3'))['db'];var utils=require(_0xbaee('0x4'));var logger=require(_0xbaee('0x5'))(_0xbaee('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbaee('0x7')][_0xbaee('0x8')]({'port':0x232a});config[_0xbaee('0x9')]=_[_0xbaee('0xa')](config[_0xbaee('0x9')],{'host':_0xbaee('0xb'),'port':0x18eb});var socket=require(_0xbaee('0xc'))(new Redis(config[_0xbaee('0x9')]));require(_0xbaee('0xd'))[_0xbaee('0xe')](socket);function respondWithRpcPromise(_0x295e77,_0x2b1f66,_0x3c3ceb){return new BPromise(function(_0x55fca5,_0x1fdbd1){return client['request'](_0x295e77,_0x3c3ceb)['then'](function(_0x5d441c){logger[_0xbaee('0xf')](_0xbaee('0x10'),_0x2b1f66,_0xbaee('0x11'));logger[_0xbaee('0x12')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x2b1f66,_0xbaee('0x11'),JSON[_0xbaee('0x13')](_0x5d441c));if(_0x5d441c['error']){if(_0x5d441c[_0xbaee('0x14')][_0xbaee('0x15')]===0x1f4){logger[_0xbaee('0x14')](_0xbaee('0x10'),_0x2b1f66,_0x5d441c[_0xbaee('0x14')][_0xbaee('0x16')]);return _0x1fdbd1(_0x5d441c[_0xbaee('0x14')][_0xbaee('0x16')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x2b1f66,_0x5d441c[_0xbaee('0x14')][_0xbaee('0x16')]);return _0x55fca5(_0x5d441c[_0xbaee('0x14')][_0xbaee('0x16')]);}else{logger[_0xbaee('0xf')](_0xbaee('0x10'),_0x2b1f66,_0xbaee('0x11'));_0x55fca5(_0x5d441c[_0xbaee('0x17')][_0xbaee('0x16')]);}})[_0xbaee('0x18')](function(_0x16489d){logger[_0xbaee('0x14')](_0xbaee('0x10'),_0x2b1f66,_0x16489d);_0x1fdbd1(_0x16489d);});});}exports[_0xbaee('0x19')]=function(_0x1831fc){var _0x470edd=this;return new Promise(function(_0x1f54c5,_0x56fe05){return db[_0xbaee('0x1a')][_0xbaee('0x1b')](_0x1831fc[_0xbaee('0x1c')],{'raw':_0x1831fc[_0xbaee('0x1d')]?_0x1831fc['options'][_0xbaee('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1831fc[_0xbaee('0x1d')]?_0x1831fc['options']['where']||null:null,'attributes':_0x1831fc['options']?_0x1831fc[_0xbaee('0x1d')][_0xbaee('0x1f')]||null:null,'limit':_0x1831fc[_0xbaee('0x1d')]?_0x1831fc[_0xbaee('0x1d')][_0xbaee('0x20')]||null:null})[_0xbaee('0x21')](function(_0x4e3184){logger[_0xbaee('0xf')]('UpdateMailInteraction',_0x1831fc);logger[_0xbaee('0x12')](_0xbaee('0x19'),_0x1831fc,JSON[_0xbaee('0x13')](_0x4e3184));_0x1f54c5(_0x4e3184);})[_0xbaee('0x18')](function(_0x2bbf64){logger[_0xbaee('0x14')](_0xbaee('0x19'),_0x2bbf64[_0xbaee('0x16')],_0x1831fc);_0x56fe05(_0x470edd['error'](0x1f4,_0x2bbf64[_0xbaee('0x16')]));});});};exports['AddTagsToMailInteraction']=function(_0x3d8c06){return new Promise(function(_0x485921,_0x1a2117){return db[_0xbaee('0x1a')]['find']({'where':_0x3d8c06[_0xbaee('0x1d')]?_0x3d8c06[_0xbaee('0x1d')][_0xbaee('0x22')]||null:null})[_0xbaee('0x21')](function(_0xf116f){if(_0xf116f){return _0xf116f[_0xbaee('0x23')](_0x3d8c06['body'][_0xbaee('0x24')],_['omit'](_0x3d8c06[_0xbaee('0x1c')],['ids','id'])||{});}})[_0xbaee('0x25')](function(_0x4006b4){logger[_0xbaee('0xf')](_0xbaee('0x26'),_0x3d8c06);logger[_0xbaee('0x12')](_0xbaee('0x26'),_0x3d8c06,JSON[_0xbaee('0x13')](_0x4006b4));_0x485921(_0x4006b4);})[_0xbaee('0x18')](function(_0x54c4cd){logger[_0xbaee('0x14')](_0xbaee('0x26'),_0x54c4cd['message'],_0x3d8c06);_0x1a2117(_this['error'](0x1f4,_0x54c4cd[_0xbaee('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 5a2fa0d..ccaee13 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 _0xdf22=['register','mailInteraction:','./mailInteraction.events','save','remove','emit','removeListener'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xdf22,0x9c));var _0x2df2=function(_0x16963c,_0xe09094){_0x16963c=_0x16963c-0x0;var _0x32c725=_0xdf22[_0x16963c];return _0x32c725;};'use strict';var MailInteractionEvents=require(_0x2df2('0x0'));var events=[_0x2df2('0x1'),_0x2df2('0x2'),'update'];function createListener(_0x35e09b,_0x43ebb2){return function(_0x5899c2){_0x43ebb2[_0x2df2('0x3')](_0x35e09b,_0x5899c2);};}function removeListener(_0x5b72eb,_0x1f8245){return function(){MailInteractionEvents[_0x2df2('0x4')](_0x5b72eb,_0x1f8245);};}exports[_0x2df2('0x5')]=function(_0x1790a6){for(var _0x1b5488=0x0,_0x2248c5=events['length'];_0x1b5488<_0x2248c5;_0x1b5488++){var _0x528463=events[_0x1b5488];var _0x3a0a9e=createListener(_0x2df2('0x6')+_0x528463,_0x1790a6);MailInteractionEvents['on'](_0x528463,_0x3a0a9e);}}; \ No newline at end of file +var _0x344e=['update','emit','removeListener','register','length','remove'];(function(_0xd8980c,_0x2f3da7){var _0x1a7e6f=function(_0x356f23){while(--_0x356f23){_0xd8980c['push'](_0xd8980c['shift']());}};_0x1a7e6f(++_0x2f3da7);}(_0x344e,0x1df));var _0xe344=function(_0x4f9885,_0x4c6175){_0x4f9885=_0x4f9885-0x0;var _0x2208e6=_0x344e[_0x4f9885];return _0x2208e6;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0xe344('0x0'),_0xe344('0x1')];function createListener(_0x2befe2,_0x5065a6){return function(_0x2a23c8){_0x5065a6[_0xe344('0x2')](_0x2befe2,_0x2a23c8);};}function removeListener(_0x1d816a,_0x4644d9){return function(){MailInteractionEvents[_0xe344('0x3')](_0x1d816a,_0x4644d9);};}exports[_0xe344('0x4')]=function(_0x3c7ecd){for(var _0x186477=0x0,_0x57436c=events[_0xe344('0x5')];_0x186477<_0x57436c;_0x186477++){var _0x36a231=events[_0x186477];var _0x2ccd8e=createListener('mailInteraction:'+_0x36a231,_0x3c7ecd);MailInteractionEvents['on'](_0x36a231,_0x2ccd8e);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 24cd5b5..45736d3 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 _0x983c=['delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id/download','download','post','tracked','mail','mailmessage:create','put','/:id','update','/:id/accept','accept','/:id/reject','reject'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x983c,0xf3));var _0xc983=function(_0x4a34e0,_0x29ff2f){_0x4a34e0=_0x4a34e0-0x0;var _0xb5ce1d=_0x983c[_0x4a34e0];return _0xb5ce1d;};'use strict';var multer=require(_0xc983('0x0'));var util=require(_0xc983('0x1'));var path=require(_0xc983('0x2'));var timeout=require(_0xc983('0x3'));var express=require(_0xc983('0x4'));var router=express['Router']();var fs_extra=require(_0xc983('0x5'));var auth=require(_0xc983('0x6'));var interaction=require(_0xc983('0x7'));var config=require(_0xc983('0x8'));var controller=require(_0xc983('0x9'));router[_0xc983('0xa')]('/',auth[_0xc983('0xb')](),controller['index']);router[_0xc983('0xa')](_0xc983('0xc'),auth[_0xc983('0xb')](),controller[_0xc983('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc983('0xa')](_0xc983('0xe'),auth[_0xc983('0xb')](),controller[_0xc983('0xf')]);router[_0xc983('0x10')]('/',auth[_0xc983('0xb')](),interaction[_0xc983('0x11')](_0xc983('0x12'),_0xc983('0x13')),controller['create']);router[_0xc983('0x14')](_0xc983('0x15'),auth[_0xc983('0xb')](),controller[_0xc983('0x16')]);router[_0xc983('0x14')](_0xc983('0x17'),auth['isAuthenticated'](),controller[_0xc983('0x18')]);router[_0xc983('0x14')](_0xc983('0x19'),auth[_0xc983('0xb')](),controller[_0xc983('0x1a')]);router[_0xc983('0x1b')]('/:id',auth[_0xc983('0xb')](),controller[_0xc983('0x1c')]);module[_0xc983('0x1d')]=router; \ No newline at end of file +var _0xe493=['download','post','tracked','mail','mailmessage:create','put','/:id','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/download'];(function(_0x338809,_0x2533ec){var _0x1fcdb8=function(_0x580576){while(--_0x580576){_0x338809['push'](_0x338809['shift']());}};_0x1fcdb8(++_0x2533ec);}(_0xe493,0x7e));var _0x3e49=function(_0x1bcc73,_0x237718){_0x1bcc73=_0x1bcc73-0x0;var _0x203fe2=_0xe493[_0x1bcc73];return _0x203fe2;};'use strict';var multer=require(_0x3e49('0x0'));var util=require(_0x3e49('0x1'));var path=require(_0x3e49('0x2'));var timeout=require(_0x3e49('0x3'));var express=require(_0x3e49('0x4'));var router=express['Router']();var fs_extra=require(_0x3e49('0x5'));var auth=require(_0x3e49('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3e49('0x7'));var controller=require('./mailMessage.controller');router[_0x3e49('0x8')]('/',auth[_0x3e49('0x9')](),controller[_0x3e49('0xa')]);router[_0x3e49('0x8')](_0x3e49('0xb'),auth[_0x3e49('0x9')](),controller['describe']);router['get']('/:id',auth[_0x3e49('0x9')](),controller[_0x3e49('0xc')]);router[_0x3e49('0x8')](_0x3e49('0xd'),auth[_0x3e49('0x9')](),controller[_0x3e49('0xe')]);router[_0x3e49('0xf')]('/',auth[_0x3e49('0x9')](),interaction[_0x3e49('0x10')](_0x3e49('0x11'),_0x3e49('0x12')),controller['create']);router[_0x3e49('0x13')](_0x3e49('0x14'),auth['isAuthenticated'](),controller[_0x3e49('0x15')]);router[_0x3e49('0x13')]('/:id/accept',auth[_0x3e49('0x9')](),controller[_0x3e49('0x16')]);router['put'](_0x3e49('0x17'),auth[_0x3e49('0x9')](),controller[_0x3e49('0x18')]);router[_0x3e49('0x19')](_0x3e49('0x14'),auth[_0x3e49('0x9')](),controller[_0x3e49('0x1a')]);module[_0x3e49('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 62cf62a..3c3ecc2 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 _0xf503=['BOOLEAN','out','INTEGER','DATE','Email','Chat','sequelize','lodash','exports','TEXT','long','medium'];(function(_0x43cd9f,_0x57d758){var _0x5cf244=function(_0xb0bd94){while(--_0xb0bd94){_0x43cd9f['push'](_0x43cd9f['shift']());}};_0x5cf244(++_0x57d758);}(_0xf503,0x11a));var _0x3f50=function(_0x5982a5,_0x3dc07b){_0x5982a5=_0x5982a5-0x0;var _0x159c80=_0xf503[_0x5982a5];return _0x159c80;};'use strict';var Sequelize=require(_0x3f50('0x0'));var _=require(_0x3f50('0x1'));module[_0x3f50('0x2')]={'body':{'type':Sequelize[_0x3f50('0x3')](_0x3f50('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x3f50('0x3')](_0x3f50('0x5'))},'read':{'type':Sequelize[_0x3f50('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3f50('0x7')),'defaultValue':_0x3f50('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x3f50('0x4'))},'cc':{'type':Sequelize[_0x3f50('0x3')](_0x3f50('0x4'))},'bcc':{'type':Sequelize[_0x3f50('0x3')](_0x3f50('0x4'))},'subject':{'type':Sequelize[_0x3f50('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x3f50('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x3f50('0x9')]},'originTo':{'type':Sequelize[_0x3f50('0x3')]('long')},'originCc':{'type':Sequelize[_0x3f50('0x3')](_0x3f50('0x4'))},'originChannel':{'type':Sequelize['ENUM'](_0x3f50('0xa'),_0x3f50('0xb')),'defaultValue':_0x3f50('0xa'),'allowNull':![]}}; \ No newline at end of file +var _0xe0bf=['sequelize','lodash','exports','TEXT','long','medium','out','STRING','INTEGER','BOOLEAN','DATE','ENUM','Email'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xe0bf,0x75));var _0xfe0b=function(_0xd67da,_0x1e449c){_0xd67da=_0xd67da-0x0;var _0x4dfbbb=_0xe0bf[_0xd67da];return _0x4dfbbb;};'use strict';var Sequelize=require(_0xfe0b('0x0'));var _=require(_0xfe0b('0x1'));module[_0xfe0b('0x2')]={'body':{'type':Sequelize[_0xfe0b('0x3')](_0xfe0b('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xfe0b('0x3')](_0xfe0b('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xfe0b('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xfe0b('0x7')]},'to':{'type':Sequelize[_0xfe0b('0x3')]('long')},'cc':{'type':Sequelize[_0xfe0b('0x3')](_0xfe0b('0x4'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xfe0b('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xfe0b('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xfe0b('0x9')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xfe0b('0xa')]},'originTo':{'type':Sequelize[_0xfe0b('0x3')](_0xfe0b('0x4'))},'originCc':{'type':Sequelize[_0xfe0b('0x3')](_0xfe0b('0x4'))},'originChannel':{'type':Sequelize[_0xfe0b('0xb')](_0xfe0b('0xc'),'Chat'),'defaultValue':_0xfe0b('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index b385425..581fbd4 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 _0xe18d=['interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','channel','fromString','EventManager','acceptmessage','reject','params','MailInteractionId','RejectMessage','rejectMessage','User','motionChannel','download','unix','toString','server','files','tmp','message-%s.eml','from','bcc','subject','createdAt','Attachment','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','Bcc','Attachments','basename','existsSync','push','readFileSync','writeFileSync','unlinkSync','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailMessage.socket','register','http','client','then','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','status','undefined','limit','count','offset','Content-Range','json','update','sendStatus','stack','name','send','map','MailMessage','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','keys','find','body','describe','create','direction','out','secret','split','findOne','CmList','CmContact','Contacts','updatedAt','DESC','Smtp','isNil','host','port','secure','service','user','pass','attachments','join','root','List','defaults','ListId','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','get','read1stAt'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xe18d,0xc9));var _0xde18=function(_0x18a447,_0x274999){_0x18a447=_0x18a447-0x0;var _0x3b1135=_0xe18d[_0x18a447];return _0x3b1135;};'use strict';var emlformat=require('eml-format');var moment=require(_0xde18('0x0'));var BPromise=require(_0xde18('0x1'));var util=require(_0xde18('0x2'));var path=require(_0xde18('0x3'));var fs=require('fs');var _=require(_0xde18('0x4'));var Redis=require(_0xde18('0x5'));var htmlToText=require('html-to-text');var qs=require(_0xde18('0x6'));var logger=require('../../config/logger')(_0xde18('0x7'));var interaction_log=require(_0xde18('0x8'))(_0xde18('0x9'));var config=require(_0xde18('0xa'));var db=require(_0xde18('0xb'))['db'];config[_0xde18('0xc')]=_['defaults'](config[_0xde18('0xc')],{'host':_0xde18('0xd'),'port':0x18eb});var socket=require(_0xde18('0xe'))(new Redis(config['redis']));require(_0xde18('0xf'))[_0xde18('0x10')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xde18('0x11')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0xde18('0x12')][_0xde18('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x1e7d6c,_0x3c3f07,_0x2c67ba,_0x136d45){return new BPromise(function(_0x5a02b4,_0x190d4c){var _0x47b3de=_0x136d45||client;return _0x47b3de['request'](_0x1e7d6c,_0x2c67ba)[_0xde18('0x13')](function(_0x287da){logger['info'](_0xde18('0x14'),_0x3c3f07,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x3c3f07,_0xde18('0x15'),JSON[_0xde18('0x16')](_0x287da));if(_0x287da[_0xde18('0x17')]){if(_0x287da[_0xde18('0x17')][_0xde18('0x18')]===0x1f4){logger[_0xde18('0x17')]('MailMessage,\x20%s,\x20%s',_0x3c3f07,_0x287da['error'][_0xde18('0x19')]);return _0x190d4c(_0x287da['error'][_0xde18('0x19')]);}logger[_0xde18('0x17')](_0xde18('0x14'),_0x3c3f07,_0x287da[_0xde18('0x17')]['message']);return _0x5a02b4(_0x287da[_0xde18('0x17')][_0xde18('0x19')]);}else{logger[_0xde18('0x1a')](_0xde18('0x14'),_0x3c3f07,_0xde18('0x15'));_0x5a02b4(_0x287da[_0xde18('0x1b')][_0xde18('0x19')]);}})[_0xde18('0x1c')](function(_0x3f65d9){logger[_0xde18('0x17')]('MailMessage,\x20%s,\x20%s',_0x3c3f07,_0x3f65d9);_0x190d4c(_0x3f65d9);});});}function respondWithResult(_0x365185,_0x1e7e6b){_0x1e7e6b=_0x1e7e6b||0xc8;return function(_0x1a7949){if(_0x1a7949){return _0x365185[_0xde18('0x1d')](_0x1e7e6b)['json'](_0x1a7949);}};}function respondWithFilteredResult(_0x5d436e,_0x357d36){return function(_0xee25b0){if(_0xee25b0){var _0x18c2db=typeof _0x357d36['offset']===_0xde18('0x1e')&&typeof _0x357d36[_0xde18('0x1f')]===_0xde18('0x1e');var _0x27262d=_0xee25b0[_0xde18('0x20')];var _0x265ea8=_0x18c2db?0x0:_0x357d36[_0xde18('0x21')];var _0x1b5be=_0x18c2db?_0xee25b0['count']:_0x357d36[_0xde18('0x21')]+_0x357d36[_0xde18('0x1f')];var _0x5ea7a9;if(_0x1b5be>=_0x27262d){_0x1b5be=_0x27262d;_0x5ea7a9=0xc8;}else{_0x5ea7a9=0xce;}_0x5d436e[_0xde18('0x1d')](_0x5ea7a9);return _0x5d436e['set'](_0xde18('0x22'),_0x265ea8+'-'+_0x1b5be+'/'+_0x27262d)[_0xde18('0x23')](_0xee25b0);}return null;};}function saveUpdates(_0x111077){return function(_0x3901a9){if(_0x3901a9){return _0x3901a9[_0xde18('0x24')](_0x111077)[_0xde18('0x13')](function(_0x7cf085){return _0x7cf085;});}return null;};}function removeEntity(_0x28d3a2){return function(_0x42fe21){if(_0x42fe21){return _0x42fe21['destroy']()[_0xde18('0x13')](function(){_0x28d3a2[_0xde18('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ea8cf){return function(_0x79a31e){if(!_0x79a31e){_0x5ea8cf[_0xde18('0x25')](0x194);}return _0x79a31e;};}function handleError(_0x109a72,_0x566c93){_0x566c93=_0x566c93||0x1f4;return function(_0x23eae1){logger[_0xde18('0x17')](_0x23eae1[_0xde18('0x26')]);if(_0x23eae1[_0xde18('0x27')]){delete _0x23eae1[_0xde18('0x27')];}_0x109a72[_0xde18('0x1d')](_0x566c93)[_0xde18('0x28')](_0x23eae1);};}exports['index']=function(_0x578ca1,_0x2d99e3){var _0x4f2846={},_0xe6491c={},_0x3430f8={'count':0x0,'rows':[]};var _0x36300b=_[_0xde18('0x29')](db[_0xde18('0x2a')][_0xde18('0x2b')],function(_0x2fbb9d){return{'name':_0x2fbb9d['fieldName'],'type':_0x2fbb9d[_0xde18('0x2c')]['key']};});_0xe6491c[_0xde18('0x2d')]=_[_0xde18('0x29')](_0x36300b,_0xde18('0x27'));_0xe6491c[_0xde18('0x2e')]=_['keys'](_0x578ca1[_0xde18('0x2e')]);_0xe6491c[_0xde18('0x2f')]=_[_0xde18('0x30')](_0xe6491c[_0xde18('0x2d')],_0xe6491c['query']);_0x4f2846[_0xde18('0x31')]=_['intersection'](_0xe6491c[_0xde18('0x2d')],qs[_0xde18('0x32')](_0x578ca1[_0xde18('0x2e')][_0xde18('0x32')]));_0x4f2846['attributes']=_0x4f2846[_0xde18('0x31')][_0xde18('0x33')]?_0x4f2846[_0xde18('0x31')]:_0xe6491c[_0xde18('0x2d')];if(!_0x578ca1[_0xde18('0x2e')]['hasOwnProperty'](_0xde18('0x34'))){_0x4f2846[_0xde18('0x1f')]=qs[_0xde18('0x1f')](_0x578ca1['query'][_0xde18('0x1f')]);_0x4f2846['offset']=qs['offset'](_0x578ca1[_0xde18('0x2e')][_0xde18('0x21')]);}_0x4f2846[_0xde18('0x35')]=qs[_0xde18('0x36')](_0x578ca1[_0xde18('0x2e')][_0xde18('0x36')]);_0x4f2846[_0xde18('0x37')]=qs[_0xde18('0x2f')](_['pick'](_0x578ca1[_0xde18('0x2e')],_0xe6491c[_0xde18('0x2f')]),_0x36300b);if(_0x578ca1['query'][_0xde18('0x38')]){_0x4f2846[_0xde18('0x37')]=_[_0xde18('0x39')](_0x4f2846[_0xde18('0x37')],{'$or':_[_0xde18('0x29')](_0x36300b,function(_0x1d742b){if(_0x1d742b[_0xde18('0x2c')]!==_0xde18('0x3a')){var _0x465696={};_0x465696[_0x1d742b[_0xde18('0x27')]]={'$like':'%'+_0x578ca1[_0xde18('0x2e')][_0xde18('0x38')]+'%'};return _0x465696;}})});}_0x4f2846=_[_0xde18('0x39')]({},_0x4f2846,_0x578ca1[_0xde18('0x3b')]);var _0x5e04d0={'where':_0x4f2846[_0xde18('0x37')]};return db[_0xde18('0x2a')][_0xde18('0x20')](_0x5e04d0)[_0xde18('0x13')](function(_0x51fd95){_0x3430f8[_0xde18('0x20')]=_0x51fd95;if(_0x578ca1[_0xde18('0x2e')][_0xde18('0x3c')]){_0x4f2846[_0xde18('0x3d')]=[{'all':!![]}];}return db[_0xde18('0x2a')]['findAll'](_0x4f2846);})['then'](function(_0x478871){_0x3430f8[_0xde18('0x3e')]=_0x478871;return _0x3430f8;})[_0xde18('0x13')](respondWithFilteredResult(_0x2d99e3,_0x4f2846))[_0xde18('0x1c')](handleError(_0x2d99e3,null));};exports[_0xde18('0x3f')]=function(_0x2faef5,_0x3c9337){var _0x1b332d={'raw':!![],'where':{'id':_0x2faef5['params']['id']}},_0x226949={};_0x226949['model']=_[_0xde18('0x40')](db['MailMessage'][_0xde18('0x2b')]);_0x226949[_0xde18('0x2e')]=_[_0xde18('0x40')](_0x2faef5[_0xde18('0x2e')]);_0x226949[_0xde18('0x2f')]=_[_0xde18('0x30')](_0x226949[_0xde18('0x2d')],_0x226949['query']);_0x1b332d['attributes']=_[_0xde18('0x30')](_0x226949[_0xde18('0x2d')],qs[_0xde18('0x32')](_0x2faef5[_0xde18('0x2e')][_0xde18('0x32')]));_0x1b332d[_0xde18('0x31')]=_0x1b332d[_0xde18('0x31')][_0xde18('0x33')]?_0x1b332d[_0xde18('0x31')]:_0x226949[_0xde18('0x2d')];if(_0x2faef5[_0xde18('0x2e')][_0xde18('0x3c')]){_0x1b332d[_0xde18('0x3d')]=[{'all':!![]}];}_0x1b332d=_[_0xde18('0x39')]({},_0x1b332d,_0x2faef5[_0xde18('0x3b')]);return db[_0xde18('0x2a')][_0xde18('0x41')](_0x1b332d)['then'](handleEntityNotFound(_0x3c9337,null))['then'](respondWithResult(_0x3c9337,null))[_0xde18('0x1c')](handleError(_0x3c9337,null));};exports[_0xde18('0x24')]=function(_0x1ba039,_0x23270c){if(_0x1ba039[_0xde18('0x42')]['id']){delete _0x1ba039[_0xde18('0x42')]['id'];}return db[_0xde18('0x2a')][_0xde18('0x41')]({'where':{'id':_0x1ba039['params']['id']}})[_0xde18('0x13')](handleEntityNotFound(_0x23270c,null))[_0xde18('0x13')](saveUpdates(_0x1ba039[_0xde18('0x42')],null))['then'](respondWithResult(_0x23270c,null))[_0xde18('0x1c')](handleError(_0x23270c,null));};exports['destroy']=function(_0x22778d,_0x43e0ee){return db['MailMessage'][_0xde18('0x41')]({'where':{'id':_0x22778d['params']['id']}})[_0xde18('0x13')](handleEntityNotFound(_0x43e0ee,null))[_0xde18('0x13')](removeEntity(_0x43e0ee,null))['catch'](handleError(_0x43e0ee,null));};exports[_0xde18('0x43')]=function(_0x2de382,_0x19f24e){return db['MailMessage'][_0xde18('0x43')]()[_0xde18('0x13')](respondWithResult(_0x19f24e,null))[_0xde18('0x1c')](handleError(_0x19f24e,null));};exports['create']=function(_0x3ecc02,_0xf94f52){return db[_0xde18('0x2a')][_0xde18('0x44')](_0x3ecc02[_0xde18('0x42')])[_0xde18('0x13')](function(_0x55fdc5){if(_0x55fdc5){if(_0x55fdc5[_0xde18('0x45')]===_0xde18('0x46')&&!_0x55fdc5[_0xde18('0x47')]){var _0x587063,_0x2d56a6,_0x192b83;if(_0x3ecc02[_0xde18('0x42')]['to']){_0x2d56a6=_0x3ecc02[_0xde18('0x42')]['to'][_0xde18('0x48')](',')[0x0];}return db['MailAccount'][_0xde18('0x49')]({'where':{'id':_0x55fdc5['MailAccountId']},'include':[{'model':db[_0xde18('0x4a')],'as':'List','include':[{'model':db[_0xde18('0x4b')],'as':_0xde18('0x4c'),'where':{'email':_0x2d56a6},'limit':0x1,'order':[[_0xde18('0x4d'),_0xde18('0x4e')]]}]},{'model':db['MailServerOut'],'as':_0xde18('0x4f'),'raw':!![]}]})['then'](function(_0x2689af){_0x587063=_0x2689af;if(_0x587063&&_0x587063[_0xde18('0x4f')]){var _0x55df8f={'tls':{'rejectUnauthorized':![]}};if(_[_0xde18('0x50')](_0x587063[_0xde18('0x4f')]['service'])){_0x55df8f[_0xde18('0x51')]=_0x587063[_0xde18('0x4f')][_0xde18('0x51')];_0x55df8f['port']=_0x587063[_0xde18('0x4f')][_0xde18('0x52')];_0x55df8f[_0xde18('0x53')]=_0x587063[_0xde18('0x4f')][_0xde18('0x53')];if(_0x587063[_0xde18('0x4f')]['authentication']){_0x55df8f['auth']={'user':_0x587063[_0xde18('0x4f')]['user'],'pass':_0x587063[_0xde18('0x4f')]['pass']};}}else{_0x55df8f[_0xde18('0x54')]=_0x587063[_0xde18('0x4f')][_0xde18('0x54')];_0x55df8f['auth']={'user':_0x587063[_0xde18('0x4f')][_0xde18('0x55')],'pass':_0x587063[_0xde18('0x4f')][_0xde18('0x56')]};_0x55df8f[_0xde18('0x53')]=_0x587063[_0xde18('0x4f')][_0xde18('0x53')];}if(_0x3ecc02[_0xde18('0x42')][_0xde18('0x57')]&&_0x3ecc02[_0xde18('0x42')][_0xde18('0x57')][_0xde18('0x33')]){for(var _0x2efc0e=0x0;_0x2efc0e<_0x3ecc02[_0xde18('0x42')][_0xde18('0x57')]['length'];_0x2efc0e+=0x1){_0x3ecc02[_0xde18('0x42')][_0xde18('0x57')][_0x2efc0e]={'filename':_0x3ecc02[_0xde18('0x42')][_0xde18('0x57')][_0x2efc0e][_0xde18('0x27')],'path':path[_0xde18('0x58')](config[_0xde18('0x59')],'server/files/attachments',_0x3ecc02['body'][_0xde18('0x57')][_0x2efc0e]['basename'])};}}_0x192b83={'account':_0x55df8f,'message':_0x3ecc02[_0xde18('0x42')]};return;}})[_0xde18('0x13')](function(){if(_0x587063[_0xde18('0x5a')]){if(_0x587063[_0xde18('0x5a')][_0xde18('0x4c')][_0xde18('0x33')]){return _0x587063[_0xde18('0x5a')][_0xde18('0x4c')][0x0];}else{return db[_0xde18('0x4b')][_0xde18('0x44')](_[_0xde18('0x5b')](_0x3ecc02[_0xde18('0x42')],{'firstName':_0x3ecc02[_0xde18('0x42')]['to'],'email':_0x3ecc02[_0xde18('0x42')]['to'],'phone':_0x3ecc02[_0xde18('0x42')]['to'],'ListId':_0x587063[_0xde18('0x5c')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xde18('0x13')](function(){if(_0x192b83){return respondWithRpcPromise(_0xde18('0x5d'),'sendMail',_0x192b83,client9003)['then'](function(_0x4f0004){return _0x55fdc5['update']({'read':!![],'messageId':_0x4f0004[_0xde18('0x5e')],'sentAt':moment()[_0xde18('0x5f')](_0xde18('0x60'))});})['catch'](function(_0x1be37e){logger[_0xde18('0x17')]('%s',JSON[_0xde18('0x16')](_0x1be37e));return _0x55fdc5;});}return _0x55fdc5;});}return _0x55fdc5;}})[_0xde18('0x13')](respondWithResult(_0xf94f52,0xc9))[_0xde18('0x1c')](handleError(_0xf94f52,null));};exports[_0xde18('0x61')]=function(_0x5c91dc,_0x31f642){var _0x18ce37={'agent':{},'channel':_0xde18('0x62')};if(_0x5c91dc['body']['id']){delete _0x5c91dc[_0xde18('0x42')]['id'];}_0x5c91dc[_0xde18('0x42')][_0xde18('0x63')]=!![];_0x5c91dc[_0xde18('0x42')][_0xde18('0x64')]=moment()['format'](_0xde18('0x60'));_0x5c91dc[_0xde18('0x42')][_0xde18('0x65')]=_0x5c91dc[_0xde18('0x42')][_0xde18('0x65')]||_0x5c91dc[_0xde18('0x55')]['id'];_0x18ce37[_0xde18('0x66')]['id']=_0x5c91dc[_0xde18('0x42')]['UserId'];return db[_0xde18('0x2a')][_0xde18('0x41')]({'where':{'id':_0x5c91dc['params']['id'],'UserId':null}})[_0xde18('0x13')](handleEntityNotFound(_0x31f642,null))['then'](saveUpdates(_0x5c91dc[_0xde18('0x42')],null))[_0xde18('0x13')](function(_0x3f4a84){if(_0x3f4a84){_0x18ce37['message']=_0x3f4a84[_0xde18('0x67')]({'plain':!![]});return db['MailInteraction'][_0xde18('0x41')]({'where':{'id':_0x3f4a84['MailInteractionId']}});}return null;})[_0xde18('0x13')](handleEntityNotFound(_0x31f642,null))[_0xde18('0x13')](function(_0xfb2b21){if(_0xfb2b21){return _0xfb2b21[_0xde18('0x24')]({'UserId':_0x5c91dc[_0xde18('0x42')][_0xde18('0x65')],'read1stAt':_[_0xde18('0x50')](_0xfb2b21[_0xde18('0x68')])?moment()[_0xde18('0x5f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4fbd2f){if(_0x4fbd2f){_0x18ce37[_0xde18('0x69')]=_0x4fbd2f[_0xde18('0x67')]({'plain':!![]});interaction_log[_0xde18('0x1a')](_0xde18('0x6a'),_0x5c91dc[_0xde18('0x55')]['id'],_0x5c91dc['user'][_0xde18('0x27')],_0x5c91dc['user'][_0xde18('0x6b')],_0x18ce37[_0xde18('0x69')]['id'],_0x5c91dc['body']?JSON[_0xde18('0x16')](_0x5c91dc[_0xde18('0x42')]):_0xde18('0x6c'));return respondWithRpcPromise(_0xde18('0x6d'),_0xde18('0x6e'),_0x18ce37);}return null;})[_0xde18('0x13')](function(_0x207c24){var _0x6fe685=_0xde18('0x6f')+_0x207c24[_0xde18('0x19')][_0xde18('0x70')];return db[_0xde18('0x71')][_0xde18('0x2e')](_0x6fe685,{'type':db[_0xde18('0x72')][_0xde18('0x73')][_0xde18('0x74')],'raw':!![]})[_0xde18('0x13')](function(_0x5394c7){return _0x5394c7;});})[_0xde18('0x13')](function(_0x1684e5){if(_0x1684e5){_0x18ce37['message'][_0xde18('0x75')]=_0x1684e5[0x0];if(!_0x5c91dc[_0xde18('0x42')][_0xde18('0x65')])return;return db['User']['find']({'where':{'id':_0x5c91dc['body'][_0xde18('0x65')],'role':_0xde18('0x66')},'attributes':['id',_0xde18('0x27'),_0xde18('0x76'),'email',_0xde18('0x77')],'raw':!![]});}return null;})[_0xde18('0x13')](function(_0xf6b2d2){if(!_0xf6b2d2)return null;_0x18ce37[_0xde18('0x19')]['agent']=_0xf6b2d2;return _0x18ce37;})[_0xde18('0x13')](function(_0x10d6be){if(_0x10d6be){if(_0x5c91dc[_0xde18('0x42')][_0xde18('0x78')]){_0x18ce37[_0xde18('0x19')]['interface']=util[_0xde18('0x5f')]('SIP/%s',_0x5c91dc['user'][_0xde18('0x27')]);_0x18ce37[_0xde18('0x19')][_0xde18('0x79')]=_0x18ce37[_0xde18('0x79')];_0x18ce37[_0xde18('0x19')]['motionChannel']=_0x18ce37[_0xde18('0x79')];_0x18ce37[_0xde18('0x19')]['event']=_0xde18('0x61');_0x18ce37[_0xde18('0x19')][_0xde18('0x42')]=htmlToText[_0xde18('0x7a')](_0x18ce37[_0xde18('0x19')][_0xde18('0x42')]);return respondWithRpcPromise(_0xde18('0x7b'),'EventManager',{'event':_0xde18('0x7c'),'message':_0x18ce37[_0xde18('0x19')]},client9002)[_0xde18('0x13')](function(){return _0x18ce37;});}return _0x18ce37;}return null;})[_0xde18('0x13')](respondWithResult(_0x31f642,null))[_0xde18('0x1c')](handleError(_0x31f642,null));};exports[_0xde18('0x7d')]=function(_0x4c56c1,_0x185af1){var _0x33da25={'agent':{},'channel':_0xde18('0x62')};if(_0x4c56c1[_0xde18('0x42')]['id']){delete _0x4c56c1[_0xde18('0x42')]['id'];}_0x4c56c1['body'][_0xde18('0x65')]=_0x4c56c1[_0xde18('0x42')][_0xde18('0x65')]||_0x4c56c1['user']['id'];_0x33da25[_0xde18('0x66')]['id']=_0x4c56c1[_0xde18('0x42')][_0xde18('0x65')];return db[_0xde18('0x2a')][_0xde18('0x41')]({'where':{'id':_0x4c56c1[_0xde18('0x7e')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x185af1,null))['then'](function(_0x3064ea){if(_0x3064ea){_0x33da25[_0xde18('0x19')]=_0x3064ea[_0xde18('0x67')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x3064ea[_0xde18('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x185af1,null))[_0xde18('0x13')](function(_0x772bde){if(_0x772bde){_0x33da25[_0xde18('0x69')]=_0x772bde[_0xde18('0x67')]({'plain':!![]});interaction_log[_0xde18('0x1a')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4c56c1['user']['id'],_0x4c56c1[_0xde18('0x55')]['name'],_0x4c56c1[_0xde18('0x55')]['role'],_0x33da25['interaction']['id'],_0x4c56c1[_0xde18('0x42')]?JSON['stringify'](_0x4c56c1[_0xde18('0x42')]):'null');return respondWithRpcPromise(_0xde18('0x80'),_0xde18('0x81'),_0x33da25);}return null;})['then'](function(_0x1819cc){var _0x1b4259='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1819cc[_0xde18('0x19')][_0xde18('0x70')];return db[_0xde18('0x71')][_0xde18('0x2e')](_0x1b4259,{'type':db[_0xde18('0x72')][_0xde18('0x73')][_0xde18('0x74')],'raw':!![]})['then'](function(_0xcb0105){return _0xcb0105;});})['then'](function(_0x194909){if(_0x194909){_0x33da25[_0xde18('0x19')]['contact']=_0x194909[0x0];if(!_0x4c56c1[_0xde18('0x42')][_0xde18('0x65')])return;return db[_0xde18('0x82')]['find']({'where':{'id':_0x4c56c1[_0xde18('0x42')]['UserId'],'role':_0xde18('0x66')},'attributes':['id','name',_0xde18('0x76'),'email','internal'],'raw':!![]});}return null;})[_0xde18('0x13')](function(_0x312fac){if(!_0x312fac)return null;_0x33da25[_0xde18('0x19')][_0xde18('0x66')]=_0x312fac;return _0x33da25;})[_0xde18('0x13')](function(_0x287c2a){if(_0x287c2a){_0x287c2a[_0xde18('0x19')]['interface']=util[_0xde18('0x5f')]('SIP/%s',_0x4c56c1[_0xde18('0x55')][_0xde18('0x27')]);_0x287c2a[_0xde18('0x19')]['channel']=_0x33da25[_0xde18('0x79')];_0x287c2a[_0xde18('0x19')][_0xde18('0x83')]=_0x33da25[_0xde18('0x79')];_0x287c2a[_0xde18('0x19')]['event']=_0xde18('0x7d');_0x287c2a[_0xde18('0x19')]['body']=htmlToText[_0xde18('0x7a')](_0x33da25['message']['body']);respondWithRpcPromise(_0xde18('0x7b'),'EventManager',{'event':'rejectmessage','message':_0x287c2a[_0xde18('0x19')]},client9002);return _0x33da25;}return null;})[_0xde18('0x13')](respondWithResult(_0x185af1,null))['catch'](handleError(_0x185af1,null));};exports[_0xde18('0x84')]=function(_0x1b4984,_0x2790f5){var _0x1387b7=moment()[_0xde18('0x85')]()[_0xde18('0x86')]();var _0x427093=path['join'](config['root'],_0xde18('0x87'),_0xde18('0x88'),_0xde18('0x89'));var _0x2773d4=path[_0xde18('0x58')](config[_0xde18('0x59')],_0xde18('0x87'),_0xde18('0x88'),_0xde18('0x57'));var _0x31f712=util[_0xde18('0x5f')](_0xde18('0x8a'),_0x1387b7);return db[_0xde18('0x2a')]['find']({'where':{'id':_0x1b4984[_0xde18('0x7e')]['id']},'attributes':['id','body',_0xde18('0x8b'),'to','cc',_0xde18('0x8c'),_0xde18('0x8d'),_0xde18('0x8e')],'include':_0x1b4984['query'][_0xde18('0x57')]?[{'model':db[_0xde18('0x8f')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x2790f5,null))[_0xde18('0x13')](function(_0x5024b4){if(_0x5024b4){var _0x2fd673=_0x5024b4;var _0x2721e7={'from':_0x2fd673[_0xde18('0x8b')],'to':_0x2fd673['to'],'subject':_0x2fd673[_0xde18('0x8d')],'html':_0x2fd673[_0xde18('0x42')],'headers':{'Date':moment(_0x2fd673[_0xde18('0x8e')])[_0xde18('0x5f')](_0xde18('0x90'))},'attachments':[]};if(_0x5024b4['cc']){_0x2721e7['headers']['Cc']=_0x5024b4['cc'];}if(_0x5024b4['bcc']){_0x2721e7['headers'][_0xde18('0x91')]=_0x5024b4[_0xde18('0x8c')];}return new BPromise(function(_0x4eb267,_0x18785f){if(_0x5024b4['Attachments']){for(var _0x42644d=0x0;_0x42644d<_0x5024b4[_0xde18('0x92')][_0xde18('0x33')];_0x42644d++){var _0x370d5e=_0x5024b4[_0xde18('0x92')][_0x42644d];var _0x143a59=path['join'](_0x2773d4,_0x370d5e[_0xde18('0x93')]);if(fs[_0xde18('0x94')](_0x143a59)){_0x2721e7[_0xde18('0x57')][_0xde18('0x95')]({'name':_0x370d5e['name'],'contentType':_0x370d5e[_0xde18('0x2c')],'data':fs[_0xde18('0x96')](_0x143a59)});}}}emlformat['build'](_0x2721e7,function(_0x2bea73,_0xd77486){if(_0x2bea73)return _0x18785f(_0x2bea73);fs[_0xde18('0x97')](path[_0xde18('0x58')](_0x427093,_0x31f712),_0xd77486);return _0x4eb267(_0xd77486);});});}})[_0xde18('0x13')](function(_0x290b94){if(_0x290b94){return _0x2790f5[_0xde18('0x84')](path[_0xde18('0x58')](_0x427093,_0x31f712),_0x31f712,function(_0x35872b){if(!_0x35872b)fs[_0xde18('0x98')](path[_0xde18('0x58')](_0x427093,_0x31f712));});}})['catch'](handleError(_0x2790f5,null));}; \ No newline at end of file +var _0xc569=['tmp','message-%s.eml','from','bcc','subject','createdAt','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','writeFileSync','unlinkSync','eml-format','moment','bluebird','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','client','http','request','then','info','MailMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','json','offset','undefined','limit','count','status','set','Content-Range','update','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailMessage','includeAll','include','findAll','rows','show','params','keys','fields','body','find','describe','create','direction','secret','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','service','host','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','agent','MailInteractionId','isNil','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','Sequelize','QueryTypes','interface','rejectmessage','download','unix','server','files'];(function(_0x576304,_0x1a7fc5){var _0x7563db=function(_0x1e26c9){while(--_0x1e26c9){_0x576304['push'](_0x576304['shift']());}};_0x7563db(++_0x1a7fc5);}(_0xc569,0x159));var _0x9c56=function(_0x1c57b7,_0x26cab8){_0x1c57b7=_0x1c57b7-0x0;var _0x3ee246=_0xc569[_0x1c57b7];return _0x3ee246;};'use strict';var emlformat=require(_0x9c56('0x0'));var moment=require(_0x9c56('0x1'));var BPromise=require(_0x9c56('0x2'));var util=require('util');var path=require(_0x9c56('0x3'));var fs=require('fs');var _=require(_0x9c56('0x4'));var Redis=require('ioredis');var htmlToText=require(_0x9c56('0x5'));var qs=require(_0x9c56('0x6'));var logger=require(_0x9c56('0x7'))('api');var interaction_log=require(_0x9c56('0x7'))(_0x9c56('0x8'));var config=require(_0x9c56('0x9'));var db=require(_0x9c56('0xa'))['db'];config['redis']=_[_0x9c56('0xb')](config[_0x9c56('0xc')],{'host':_0x9c56('0xd'),'port':0x18eb});var socket=require(_0x9c56('0xe'))(new Redis(config[_0x9c56('0xc')]));require('./mailMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x9c56('0xf')][_0x9c56('0x10')]({'port':0x232c});var client9003=jayson['client'][_0x9c56('0x10')]({'port':0x232b});var client9002=jayson['client'][_0x9c56('0x10')]({'port':0x232a});function respondWithRpcPromise(_0xeed809,_0x13243d,_0x45cdf3,_0x43b2a9){return new BPromise(function(_0x137123,_0xbec6b9){var _0x5303be=_0x43b2a9||client;return _0x5303be[_0x9c56('0x11')](_0xeed809,_0x45cdf3)[_0x9c56('0x12')](function(_0x44c0bd){logger[_0x9c56('0x13')](_0x9c56('0x14'),_0x13243d,'request\x20sent');logger[_0x9c56('0x15')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x13243d,_0x9c56('0x16'),JSON[_0x9c56('0x17')](_0x44c0bd));if(_0x44c0bd[_0x9c56('0x18')]){if(_0x44c0bd[_0x9c56('0x18')][_0x9c56('0x19')]===0x1f4){logger[_0x9c56('0x18')](_0x9c56('0x14'),_0x13243d,_0x44c0bd[_0x9c56('0x18')][_0x9c56('0x1a')]);return _0xbec6b9(_0x44c0bd[_0x9c56('0x18')][_0x9c56('0x1a')]);}logger[_0x9c56('0x18')](_0x9c56('0x14'),_0x13243d,_0x44c0bd[_0x9c56('0x18')][_0x9c56('0x1a')]);return _0x137123(_0x44c0bd['error'][_0x9c56('0x1a')]);}else{logger[_0x9c56('0x13')](_0x9c56('0x14'),_0x13243d,'request\x20sent');_0x137123(_0x44c0bd[_0x9c56('0x1b')][_0x9c56('0x1a')]);}})[_0x9c56('0x1c')](function(_0x44267e){logger[_0x9c56('0x18')](_0x9c56('0x14'),_0x13243d,_0x44267e);_0xbec6b9(_0x44267e);});});}function respondWithResult(_0x27066c,_0xf4e706){_0xf4e706=_0xf4e706||0xc8;return function(_0x31da15){if(_0x31da15){return _0x27066c['status'](_0xf4e706)[_0x9c56('0x1d')](_0x31da15);}};}function respondWithFilteredResult(_0x19ed38,_0x573983){return function(_0xe25ab2){if(_0xe25ab2){var _0x1969fe=typeof _0x573983[_0x9c56('0x1e')]===_0x9c56('0x1f')&&typeof _0x573983[_0x9c56('0x20')]==='undefined';var _0x51336b=_0xe25ab2[_0x9c56('0x21')];var _0x1e03ff=_0x1969fe?0x0:_0x573983['offset'];var _0x2b7bf7=_0x1969fe?_0xe25ab2['count']:_0x573983['offset']+_0x573983[_0x9c56('0x20')];var _0x42a685;if(_0x2b7bf7>=_0x51336b){_0x2b7bf7=_0x51336b;_0x42a685=0xc8;}else{_0x42a685=0xce;}_0x19ed38[_0x9c56('0x22')](_0x42a685);return _0x19ed38[_0x9c56('0x23')](_0x9c56('0x24'),_0x1e03ff+'-'+_0x2b7bf7+'/'+_0x51336b)[_0x9c56('0x1d')](_0xe25ab2);}return null;};}function saveUpdates(_0x4f4c27){return function(_0x14efdf){if(_0x14efdf){return _0x14efdf[_0x9c56('0x25')](_0x4f4c27)['then'](function(_0x4f88fa){return _0x4f88fa;});}return null;};}function removeEntity(_0x47c7be){return function(_0x708c75){if(_0x708c75){return _0x708c75['destroy']()[_0x9c56('0x12')](function(){_0x47c7be[_0x9c56('0x22')](0xcc)[_0x9c56('0x26')]();});}};}function handleEntityNotFound(_0x3a4ea9){return function(_0x289696){if(!_0x289696){_0x3a4ea9[_0x9c56('0x27')](0x194);}return _0x289696;};}function handleError(_0x5bfc92,_0x37cc37){_0x37cc37=_0x37cc37||0x1f4;return function(_0x566f22){logger['error'](_0x566f22[_0x9c56('0x28')]);if(_0x566f22[_0x9c56('0x29')]){delete _0x566f22[_0x9c56('0x29')];}_0x5bfc92[_0x9c56('0x22')](_0x37cc37)[_0x9c56('0x2a')](_0x566f22);};}exports[_0x9c56('0x2b')]=function(_0x9e46b7,_0x34a9ea){var _0x2969dc={},_0x158a54={},_0x4f0311={'count':0x0,'rows':[]};var _0x43119b=_[_0x9c56('0x2c')](db['MailMessage'][_0x9c56('0x2d')],function(_0x3b84a1){return{'name':_0x3b84a1[_0x9c56('0x2e')],'type':_0x3b84a1[_0x9c56('0x2f')][_0x9c56('0x30')]};});_0x158a54['model']=_[_0x9c56('0x2c')](_0x43119b,_0x9c56('0x29'));_0x158a54['query']=_['keys'](_0x9e46b7[_0x9c56('0x31')]);_0x158a54[_0x9c56('0x32')]=_[_0x9c56('0x33')](_0x158a54['model'],_0x158a54[_0x9c56('0x31')]);_0x2969dc[_0x9c56('0x34')]=_[_0x9c56('0x33')](_0x158a54[_0x9c56('0x35')],qs['fields'](_0x9e46b7[_0x9c56('0x31')]['fields']));_0x2969dc['attributes']=_0x2969dc[_0x9c56('0x34')][_0x9c56('0x36')]?_0x2969dc[_0x9c56('0x34')]:_0x158a54[_0x9c56('0x35')];if(!_0x9e46b7[_0x9c56('0x31')][_0x9c56('0x37')](_0x9c56('0x38'))){_0x2969dc[_0x9c56('0x20')]=qs[_0x9c56('0x20')](_0x9e46b7[_0x9c56('0x31')]['limit']);_0x2969dc['offset']=qs[_0x9c56('0x1e')](_0x9e46b7[_0x9c56('0x31')]['offset']);}_0x2969dc[_0x9c56('0x39')]=qs[_0x9c56('0x3a')](_0x9e46b7[_0x9c56('0x31')][_0x9c56('0x3a')]);_0x2969dc[_0x9c56('0x3b')]=qs[_0x9c56('0x32')](_[_0x9c56('0x3c')](_0x9e46b7[_0x9c56('0x31')],_0x158a54[_0x9c56('0x32')]),_0x43119b);if(_0x9e46b7[_0x9c56('0x31')][_0x9c56('0x3d')]){_0x2969dc[_0x9c56('0x3b')]=_[_0x9c56('0x3e')](_0x2969dc[_0x9c56('0x3b')],{'$or':_[_0x9c56('0x2c')](_0x43119b,function(_0x794f0a){if(_0x794f0a[_0x9c56('0x2f')]!==_0x9c56('0x3f')){var _0x2dce13={};_0x2dce13[_0x794f0a[_0x9c56('0x29')]]={'$like':'%'+_0x9e46b7[_0x9c56('0x31')][_0x9c56('0x3d')]+'%'};return _0x2dce13;}})});}_0x2969dc=_[_0x9c56('0x3e')]({},_0x2969dc,_0x9e46b7[_0x9c56('0x40')]);var _0x55af4c={'where':_0x2969dc['where']};return db[_0x9c56('0x41')][_0x9c56('0x21')](_0x55af4c)[_0x9c56('0x12')](function(_0x28bcd9){_0x4f0311[_0x9c56('0x21')]=_0x28bcd9;if(_0x9e46b7[_0x9c56('0x31')][_0x9c56('0x42')]){_0x2969dc[_0x9c56('0x43')]=[{'all':!![]}];}return db['MailMessage'][_0x9c56('0x44')](_0x2969dc);})[_0x9c56('0x12')](function(_0xe6709){_0x4f0311[_0x9c56('0x45')]=_0xe6709;return _0x4f0311;})['then'](respondWithFilteredResult(_0x34a9ea,_0x2969dc))['catch'](handleError(_0x34a9ea,null));};exports[_0x9c56('0x46')]=function(_0x2443a7,_0x408240){var _0x1b0c65={'raw':!![],'where':{'id':_0x2443a7[_0x9c56('0x47')]['id']}},_0x966fb6={};_0x966fb6[_0x9c56('0x35')]=_[_0x9c56('0x48')](db[_0x9c56('0x41')]['rawAttributes']);_0x966fb6[_0x9c56('0x31')]=_[_0x9c56('0x48')](_0x2443a7['query']);_0x966fb6[_0x9c56('0x32')]=_[_0x9c56('0x33')](_0x966fb6['model'],_0x966fb6[_0x9c56('0x31')]);_0x1b0c65[_0x9c56('0x34')]=_['intersection'](_0x966fb6['model'],qs['fields'](_0x2443a7['query'][_0x9c56('0x49')]));_0x1b0c65[_0x9c56('0x34')]=_0x1b0c65[_0x9c56('0x34')][_0x9c56('0x36')]?_0x1b0c65['attributes']:_0x966fb6[_0x9c56('0x35')];if(_0x2443a7['query']['includeAll']){_0x1b0c65[_0x9c56('0x43')]=[{'all':!![]}];}_0x1b0c65=_[_0x9c56('0x3e')]({},_0x1b0c65,_0x2443a7['options']);return db['MailMessage']['find'](_0x1b0c65)['then'](handleEntityNotFound(_0x408240,null))[_0x9c56('0x12')](respondWithResult(_0x408240,null))[_0x9c56('0x1c')](handleError(_0x408240,null));};exports[_0x9c56('0x25')]=function(_0x5315c6,_0x54e97f){if(_0x5315c6[_0x9c56('0x4a')]['id']){delete _0x5315c6[_0x9c56('0x4a')]['id'];}return db[_0x9c56('0x41')]['find']({'where':{'id':_0x5315c6[_0x9c56('0x47')]['id']}})['then'](handleEntityNotFound(_0x54e97f,null))[_0x9c56('0x12')](saveUpdates(_0x5315c6[_0x9c56('0x4a')],null))[_0x9c56('0x12')](respondWithResult(_0x54e97f,null))['catch'](handleError(_0x54e97f,null));};exports['destroy']=function(_0x319bb7,_0x2a18af){return db['MailMessage'][_0x9c56('0x4b')]({'where':{'id':_0x319bb7[_0x9c56('0x47')]['id']}})[_0x9c56('0x12')](handleEntityNotFound(_0x2a18af,null))[_0x9c56('0x12')](removeEntity(_0x2a18af,null))[_0x9c56('0x1c')](handleError(_0x2a18af,null));};exports[_0x9c56('0x4c')]=function(_0x55fb80,_0x356b1c){return db[_0x9c56('0x41')][_0x9c56('0x4c')]()[_0x9c56('0x12')](respondWithResult(_0x356b1c,null))[_0x9c56('0x1c')](handleError(_0x356b1c,null));};exports['create']=function(_0x3e36db,_0x2c757e){return db['MailMessage'][_0x9c56('0x4d')](_0x3e36db[_0x9c56('0x4a')])[_0x9c56('0x12')](function(_0x1463d2){if(_0x1463d2){if(_0x1463d2[_0x9c56('0x4e')]==='out'&&!_0x1463d2[_0x9c56('0x4f')]){var _0x5e3dd2,_0x419de0,_0x126fae;if(_0x3e36db['body']['to']){_0x419de0=_0x3e36db[_0x9c56('0x4a')]['to']['split'](',')[0x0];}return db[_0x9c56('0x50')][_0x9c56('0x51')]({'where':{'id':_0x1463d2[_0x9c56('0x52')]},'include':[{'model':db[_0x9c56('0x53')],'as':_0x9c56('0x54'),'include':[{'model':db[_0x9c56('0x55')],'as':_0x9c56('0x56'),'where':{'email':_0x419de0},'limit':0x1,'order':[[_0x9c56('0x57'),_0x9c56('0x58')]]}]},{'model':db[_0x9c56('0x59')],'as':_0x9c56('0x5a'),'raw':!![]}]})[_0x9c56('0x12')](function(_0x28f588){_0x5e3dd2=_0x28f588;if(_0x5e3dd2&&_0x5e3dd2[_0x9c56('0x5a')]){var _0x2e85c4={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5e3dd2[_0x9c56('0x5a')][_0x9c56('0x5b')])){_0x2e85c4[_0x9c56('0x5c')]=_0x5e3dd2['Smtp'][_0x9c56('0x5c')];_0x2e85c4['port']=_0x5e3dd2[_0x9c56('0x5a')]['port'];_0x2e85c4[_0x9c56('0x5d')]=_0x5e3dd2['Smtp']['secure'];if(_0x5e3dd2['Smtp'][_0x9c56('0x5e')]){_0x2e85c4[_0x9c56('0x5f')]={'user':_0x5e3dd2['Smtp'][_0x9c56('0x60')],'pass':_0x5e3dd2[_0x9c56('0x5a')][_0x9c56('0x61')]};}}else{_0x2e85c4[_0x9c56('0x5b')]=_0x5e3dd2[_0x9c56('0x5a')][_0x9c56('0x5b')];_0x2e85c4[_0x9c56('0x5f')]={'user':_0x5e3dd2[_0x9c56('0x5a')][_0x9c56('0x60')],'pass':_0x5e3dd2[_0x9c56('0x5a')]['pass']};_0x2e85c4[_0x9c56('0x5d')]=_0x5e3dd2[_0x9c56('0x5a')]['secure'];}if(_0x3e36db[_0x9c56('0x4a')][_0x9c56('0x62')]&&_0x3e36db[_0x9c56('0x4a')]['attachments'][_0x9c56('0x36')]){for(var _0x5bdb88=0x0;_0x5bdb88<_0x3e36db[_0x9c56('0x4a')][_0x9c56('0x62')][_0x9c56('0x36')];_0x5bdb88+=0x1){_0x3e36db[_0x9c56('0x4a')][_0x9c56('0x62')][_0x5bdb88]={'filename':_0x3e36db[_0x9c56('0x4a')]['attachments'][_0x5bdb88][_0x9c56('0x29')],'path':path[_0x9c56('0x63')](config[_0x9c56('0x64')],_0x9c56('0x65'),_0x3e36db['body'][_0x9c56('0x62')][_0x5bdb88][_0x9c56('0x66')])};}}_0x126fae={'account':_0x2e85c4,'message':_0x3e36db[_0x9c56('0x4a')]};return;}})[_0x9c56('0x12')](function(){if(_0x5e3dd2[_0x9c56('0x54')]){if(_0x5e3dd2[_0x9c56('0x54')][_0x9c56('0x56')][_0x9c56('0x36')]){return _0x5e3dd2[_0x9c56('0x54')][_0x9c56('0x56')][0x0];}else{return db[_0x9c56('0x55')]['create'](_[_0x9c56('0xb')](_0x3e36db['body'],{'firstName':_0x3e36db[_0x9c56('0x4a')]['to'],'email':_0x3e36db[_0x9c56('0x4a')]['to'],'phone':_0x3e36db[_0x9c56('0x4a')]['to'],'ListId':_0x5e3dd2[_0x9c56('0x67')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x9c56('0x12')](function(){if(_0x126fae){return respondWithRpcPromise(_0x9c56('0x68'),_0x9c56('0x69'),_0x126fae,client9003)[_0x9c56('0x12')](function(_0x5e967b){return _0x1463d2[_0x9c56('0x25')]({'read':!![],'messageId':_0x5e967b[_0x9c56('0x6a')],'sentAt':moment()[_0x9c56('0x6b')](_0x9c56('0x6c'))});})[_0x9c56('0x1c')](function(_0x58f7d6){logger[_0x9c56('0x18')]('%s',JSON[_0x9c56('0x17')](_0x58f7d6));return _0x1463d2;});}return _0x1463d2;});}return _0x1463d2;}})[_0x9c56('0x12')](respondWithResult(_0x2c757e,0xc9))[_0x9c56('0x1c')](handleError(_0x2c757e,null));};exports[_0x9c56('0x6d')]=function(_0x21c14d,_0x2ec67f){var _0x5d6f50={'agent':{},'channel':'mail'};if(_0x21c14d[_0x9c56('0x4a')]['id']){delete _0x21c14d['body']['id'];}_0x21c14d['body'][_0x9c56('0x6e')]=!![];_0x21c14d[_0x9c56('0x4a')][_0x9c56('0x6f')]=moment()['format'](_0x9c56('0x6c'));_0x21c14d['body'][_0x9c56('0x70')]=_0x21c14d['body'][_0x9c56('0x70')]||_0x21c14d['user']['id'];_0x5d6f50[_0x9c56('0x71')]['id']=_0x21c14d['body'][_0x9c56('0x70')];return db[_0x9c56('0x41')][_0x9c56('0x4b')]({'where':{'id':_0x21c14d['params']['id'],'UserId':null}})[_0x9c56('0x12')](handleEntityNotFound(_0x2ec67f,null))['then'](saveUpdates(_0x21c14d['body'],null))[_0x9c56('0x12')](function(_0x27ad55){if(_0x27ad55){_0x5d6f50['message']=_0x27ad55['get']({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x27ad55[_0x9c56('0x72')]}});}return null;})['then'](handleEntityNotFound(_0x2ec67f,null))[_0x9c56('0x12')](function(_0x528451){if(_0x528451){return _0x528451[_0x9c56('0x25')]({'UserId':_0x21c14d[_0x9c56('0x4a')]['UserId'],'read1stAt':_[_0x9c56('0x73')](_0x528451[_0x9c56('0x74')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9c56('0x12')](function(_0x4ddcc2){if(_0x4ddcc2){_0x5d6f50[_0x9c56('0x75')]=_0x4ddcc2[_0x9c56('0x76')]({'plain':!![]});interaction_log[_0x9c56('0x13')](_0x9c56('0x77'),_0x21c14d['user']['id'],_0x21c14d[_0x9c56('0x60')][_0x9c56('0x29')],_0x21c14d[_0x9c56('0x60')]['role'],_0x5d6f50[_0x9c56('0x75')]['id'],_0x21c14d['body']?JSON[_0x9c56('0x17')](_0x21c14d[_0x9c56('0x4a')]):_0x9c56('0x78'));return respondWithRpcPromise(_0x9c56('0x79'),_0x9c56('0x7a'),_0x5d6f50);}return null;})[_0x9c56('0x12')](function(_0x2422a9){var _0x3a76b8=_0x9c56('0x7b')+_0x2422a9[_0x9c56('0x1a')][_0x9c56('0x7c')];return db[_0x9c56('0x7d')]['query'](_0x3a76b8,{'type':db['Sequelize']['QueryTypes'][_0x9c56('0x7e')],'raw':!![]})['then'](function(_0x1be7b5){return _0x1be7b5;});})[_0x9c56('0x12')](function(_0x299b4b){if(_0x299b4b){_0x5d6f50['message'][_0x9c56('0x7f')]=_0x299b4b[0x0];if(!_0x21c14d[_0x9c56('0x4a')][_0x9c56('0x70')])return;return db[_0x9c56('0x80')][_0x9c56('0x4b')]({'where':{'id':_0x21c14d[_0x9c56('0x4a')][_0x9c56('0x70')],'role':_0x9c56('0x71')},'attributes':['id',_0x9c56('0x29'),_0x9c56('0x81'),_0x9c56('0x82'),_0x9c56('0x83')],'raw':!![]});}return null;})[_0x9c56('0x12')](function(_0x433dfe){if(!_0x433dfe)return null;_0x5d6f50[_0x9c56('0x1a')][_0x9c56('0x71')]=_0x433dfe;return _0x5d6f50;})['then'](function(_0x30cdc0){if(_0x30cdc0){if(_0x21c14d[_0x9c56('0x4a')][_0x9c56('0x84')]){_0x5d6f50['message']['interface']=util[_0x9c56('0x6b')](_0x9c56('0x85'),_0x21c14d['user'][_0x9c56('0x29')]);_0x5d6f50['message'][_0x9c56('0x86')]=_0x5d6f50[_0x9c56('0x86')];_0x5d6f50[_0x9c56('0x1a')][_0x9c56('0x87')]=_0x5d6f50['channel'];_0x5d6f50[_0x9c56('0x1a')][_0x9c56('0x88')]=_0x9c56('0x6d');_0x5d6f50[_0x9c56('0x1a')][_0x9c56('0x4a')]=htmlToText[_0x9c56('0x89')](_0x5d6f50['message'][_0x9c56('0x4a')]);return respondWithRpcPromise(_0x9c56('0x8a'),_0x9c56('0x8a'),{'event':_0x9c56('0x8b'),'message':_0x5d6f50['message']},client9002)[_0x9c56('0x12')](function(){return _0x5d6f50;});}return _0x5d6f50;}return null;})[_0x9c56('0x12')](respondWithResult(_0x2ec67f,null))[_0x9c56('0x1c')](handleError(_0x2ec67f,null));};exports[_0x9c56('0x8c')]=function(_0x11f84a,_0x1a3285){var _0x67a77d={'agent':{},'channel':'mail'};if(_0x11f84a['body']['id']){delete _0x11f84a[_0x9c56('0x4a')]['id'];}_0x11f84a[_0x9c56('0x4a')][_0x9c56('0x70')]=_0x11f84a[_0x9c56('0x4a')][_0x9c56('0x70')]||_0x11f84a[_0x9c56('0x60')]['id'];_0x67a77d['agent']['id']=_0x11f84a[_0x9c56('0x4a')][_0x9c56('0x70')];return db[_0x9c56('0x41')][_0x9c56('0x4b')]({'where':{'id':_0x11f84a['params']['id'],'UserId':null}})[_0x9c56('0x12')](handleEntityNotFound(_0x1a3285,null))[_0x9c56('0x12')](function(_0x2f2492){if(_0x2f2492){_0x67a77d['message']=_0x2f2492[_0x9c56('0x76')]({'plain':!![]});return db[_0x9c56('0x8d')][_0x9c56('0x4b')]({'where':{'id':_0x2f2492['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1a3285,null))[_0x9c56('0x12')](function(_0x1215c7){if(_0x1215c7){_0x67a77d[_0x9c56('0x75')]=_0x1215c7[_0x9c56('0x76')]({'plain':!![]});interaction_log[_0x9c56('0x13')](_0x9c56('0x8e'),_0x11f84a[_0x9c56('0x60')]['id'],_0x11f84a[_0x9c56('0x60')][_0x9c56('0x29')],_0x11f84a[_0x9c56('0x60')][_0x9c56('0x8f')],_0x67a77d[_0x9c56('0x75')]['id'],_0x11f84a[_0x9c56('0x4a')]?JSON[_0x9c56('0x17')](_0x11f84a[_0x9c56('0x4a')]):_0x9c56('0x78'));return respondWithRpcPromise('RejectMessage',_0x9c56('0x90'),_0x67a77d);}return null;})[_0x9c56('0x12')](function(_0x462414){var _0x43a527=_0x9c56('0x7b')+_0x462414[_0x9c56('0x1a')][_0x9c56('0x7c')];return db[_0x9c56('0x7d')][_0x9c56('0x31')](_0x43a527,{'type':db[_0x9c56('0x91')][_0x9c56('0x92')][_0x9c56('0x7e')],'raw':!![]})[_0x9c56('0x12')](function(_0x13ab02){return _0x13ab02;});})[_0x9c56('0x12')](function(_0x3cd2cb){if(_0x3cd2cb){_0x67a77d[_0x9c56('0x1a')]['contact']=_0x3cd2cb[0x0];if(!_0x11f84a['body'][_0x9c56('0x70')])return;return db['User'][_0x9c56('0x4b')]({'where':{'id':_0x11f84a[_0x9c56('0x4a')][_0x9c56('0x70')],'role':'agent'},'attributes':['id',_0x9c56('0x29'),_0x9c56('0x81'),_0x9c56('0x82'),_0x9c56('0x83')],'raw':!![]});}return null;})['then'](function(_0x3f028d){if(!_0x3f028d)return null;_0x67a77d['message']['agent']=_0x3f028d;return _0x67a77d;})[_0x9c56('0x12')](function(_0x1d46ba){if(_0x1d46ba){_0x1d46ba[_0x9c56('0x1a')][_0x9c56('0x93')]=util['format'](_0x9c56('0x85'),_0x11f84a[_0x9c56('0x60')][_0x9c56('0x29')]);_0x1d46ba[_0x9c56('0x1a')]['channel']=_0x67a77d[_0x9c56('0x86')];_0x1d46ba[_0x9c56('0x1a')][_0x9c56('0x87')]=_0x67a77d[_0x9c56('0x86')];_0x1d46ba[_0x9c56('0x1a')][_0x9c56('0x88')]=_0x9c56('0x8c');_0x1d46ba[_0x9c56('0x1a')][_0x9c56('0x4a')]=htmlToText[_0x9c56('0x89')](_0x67a77d[_0x9c56('0x1a')][_0x9c56('0x4a')]);respondWithRpcPromise('EventManager','EventManager',{'event':_0x9c56('0x94'),'message':_0x1d46ba[_0x9c56('0x1a')]},client9002);return _0x67a77d;}return null;})[_0x9c56('0x12')](respondWithResult(_0x1a3285,null))[_0x9c56('0x1c')](handleError(_0x1a3285,null));};exports[_0x9c56('0x95')]=function(_0x153f70,_0x5a22a7){var _0x434b9c=moment()[_0x9c56('0x96')]()['toString']();var _0x4f40d8=path[_0x9c56('0x63')](config[_0x9c56('0x64')],_0x9c56('0x97'),_0x9c56('0x98'),_0x9c56('0x99'));var _0x5998d3=path['join'](config['root'],_0x9c56('0x97'),_0x9c56('0x98'),_0x9c56('0x62'));var _0x2214b0=util[_0x9c56('0x6b')](_0x9c56('0x9a'),_0x434b9c);return db[_0x9c56('0x41')][_0x9c56('0x4b')]({'where':{'id':_0x153f70['params']['id']},'attributes':['id','body',_0x9c56('0x9b'),'to','cc',_0x9c56('0x9c'),_0x9c56('0x9d'),_0x9c56('0x9e')],'include':_0x153f70[_0x9c56('0x31')][_0x9c56('0x62')]?[{'model':db['Attachment'],'as':_0x9c56('0x9f')}]:undefined})[_0x9c56('0x12')](handleEntityNotFound(_0x5a22a7,null))[_0x9c56('0x12')](function(_0x4c5f75){if(_0x4c5f75){var _0x1bed42=_0x4c5f75;var _0x390061={'from':_0x1bed42[_0x9c56('0x9b')],'to':_0x1bed42['to'],'subject':_0x1bed42[_0x9c56('0x9d')],'html':_0x1bed42[_0x9c56('0x4a')],'headers':{'Date':moment(_0x1bed42[_0x9c56('0x9e')])[_0x9c56('0x6b')](_0x9c56('0xa0'))},'attachments':[]};if(_0x4c5f75['cc']){_0x390061[_0x9c56('0xa1')]['Cc']=_0x4c5f75['cc'];}if(_0x4c5f75[_0x9c56('0x9c')]){_0x390061['headers'][_0x9c56('0xa2')]=_0x4c5f75['bcc'];}return new BPromise(function(_0x386077,_0x34419d){if(_0x4c5f75[_0x9c56('0x9f')]){for(var _0x9c7203=0x0;_0x9c7203<_0x4c5f75[_0x9c56('0x9f')][_0x9c56('0x36')];_0x9c7203++){var _0x5afefd=_0x4c5f75[_0x9c56('0x9f')][_0x9c7203];var _0x43b483=path[_0x9c56('0x63')](_0x5998d3,_0x5afefd[_0x9c56('0x66')]);if(fs['existsSync'](_0x43b483)){_0x390061[_0x9c56('0x62')][_0x9c56('0xa3')]({'name':_0x5afefd['name'],'contentType':_0x5afefd['type'],'data':fs['readFileSync'](_0x43b483)});}}}emlformat['build'](_0x390061,function(_0x53a58d,_0x51b236){if(_0x53a58d)return _0x34419d(_0x53a58d);fs[_0x9c56('0xa4')](path[_0x9c56('0x63')](_0x4f40d8,_0x2214b0),_0x51b236);return _0x386077(_0x51b236);});});}})[_0x9c56('0x12')](function(_0xa95db9){if(_0xa95db9){return _0x5a22a7['download'](path[_0x9c56('0x63')](_0x4f40d8,_0x2214b0),_0x2214b0,function(_0x464632){if(!_0x464632)fs[_0x9c56('0xa5')](path[_0x9c56('0x63')](_0x4f40d8,_0x2214b0));});}})[_0x9c56('0x1c')](handleError(_0x5a22a7,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 552f943..f6d7a6f 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 _0x9189=['setMaxListeners','update','emit','hook','exports','events','../../mysqldb','MailMessage'];(function(_0x306aa3,_0x521e99){var _0x2d1a2a=function(_0x315428){while(--_0x315428){_0x306aa3['push'](_0x306aa3['shift']());}};_0x2d1a2a(++_0x521e99);}(_0x9189,0x175));var _0x9918=function(_0x2efa5f,_0x27fa55){_0x2efa5f=_0x2efa5f-0x0;var _0xc597bc=_0x9189[_0x2efa5f];return _0xc597bc;};'use strict';var EventEmitter=require(_0x9918('0x0'));var MailMessage=require(_0x9918('0x1'))['db'][_0x9918('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9918('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9918('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4251a8){return function(_0x27e7bc,_0xe52cd6,_0x2180ee){MailMessageEvents[_0x9918('0x5')](_0x4251a8+':'+_0x27e7bc['id'],_0x27e7bc);MailMessageEvents[_0x9918('0x5')](_0x4251a8,_0x27e7bc);_0x2180ee(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x9918('0x6')](e,emitEvent(event));}}module[_0x9918('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x90bd=['MailMessage','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0x90bd,0x15d));var _0xd90b=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0x90bd[_0x5e4563];return _0x8d1bf5;};'use strict';var EventEmitter=require(_0xd90b('0x0'));var MailMessage=require(_0xd90b('0x1'))['db'][_0xd90b('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xd90b('0x3')](0x0);var events={'afterCreate':_0xd90b('0x4'),'afterUpdate':_0xd90b('0x5'),'afterDestroy':_0xd90b('0x6')};function emitEvent(_0x3d38fd){return function(_0x29247e,_0xd9aa64,_0x288f21){MailMessageEvents[_0xd90b('0x7')](_0x3d38fd+':'+_0x29247e['id'],_0x29247e);MailMessageEvents['emit'](_0x3d38fd,_0x29247e);_0x288f21(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xd90b('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 6b30dd4..8c2b7ce 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 _0xd656=['moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','fromString','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0xccacb8,_0x1fbaad){var _0xc53a5a=function(_0x3b2955){while(--_0x3b2955){_0xccacb8['push'](_0xccacb8['shift']());}};_0xc53a5a(++_0x1fbaad);}(_0xd656,0x64));var _0x6d65=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd656[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x6d65('0x0'));var logger=require(_0x6d65('0x1'))('api');var moment=require(_0x6d65('0x2'));var BPromise=require(_0x6d65('0x3'));var rp=require(_0x6d65('0x4'));var htmlToText=require(_0x6d65('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6d65('0x6'));var config=require(_0x6d65('0x7'));var attributes=require(_0x6d65('0x8'));module['exports']=function(_0x352579,_0x39e726){return _0x352579[_0x6d65('0x9')](_0x6d65('0xa'),attributes,{'tableName':_0x6d65('0xb'),'paranoid':![],'indexes':[{'name':_0x6d65('0xc'),'fields':[_0x6d65('0xc')]},{'name':_0x6d65('0xd'),'fields':[_0x6d65('0xe'),_0x6d65('0xf')],'type':_0x6d65('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2bcfff,_0x37f138,_0x54cb39){if(_0x2bcfff['body']){_0x2bcfff[_0x6d65('0xe')]=htmlToText[_0x6d65('0x11')](_0x2bcfff[_0x6d65('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x54cb39(null,_0x37f138);},'afterCreate':function(_0x29613a,_0x448a4c,_0x267630){var _0x297d87=_0x352579[_0x6d65('0x13')];var _0xced1cb=_0x29613a[_0x6d65('0x14')]({'plain':!![]});if(_0xced1cb[_0x6d65('0x15')][_0x6d65('0x16')]()==='in'||_0xced1cb[_0x6d65('0x15')][_0x6d65('0x16')]()===_0x6d65('0x17')&&!_0xced1cb[_0x6d65('0x18')]&&!_[_0x6d65('0x19')](_0xced1cb[_0x6d65('0x1a')])){_0x297d87['MailInteraction']['findOne']({'where':{'id':_0xced1cb[_0x6d65('0x1b')]}})[_0x6d65('0x1c')](function(_0x53e203){if(_0x53e203){_0x53e203[_0x6d65('0x1d')]({'lastMsgAt':_0xced1cb[_0x6d65('0x1e')],'lastMsgDirection':_0xced1cb[_0x6d65('0x15')][_0x6d65('0x16')]()});}})[_0x6d65('0x1f')](function(_0x2ba512){console[_0x6d65('0x20')](_0x2ba512);});}_0x267630();}},'charset':'utf8mb4','collate':_0x6d65('0x21')});}; \ No newline at end of file +var _0x4f6a=['body','models','direction','toLowerCase','out','secret','MailInteraction','MailInteractionId','update','createdAt','catch','utf8mb4','lodash','api','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT'];(function(_0x117538,_0x533264){var _0x2a600c=function(_0x132d01){while(--_0x132d01){_0x117538['push'](_0x117538['shift']());}};_0x2a600c(++_0x533264);}(_0x4f6a,0x1dc));var _0xa4f6=function(_0xc051b2,_0x3d6d9d){_0xc051b2=_0xc051b2-0x0;var _0x599dc2=_0x4f6a[_0xc051b2];return _0x599dc2;};'use strict';var _=require(_0xa4f6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa4f6('0x1'));var moment=require('moment');var BPromise=require(_0xa4f6('0x2'));var rp=require(_0xa4f6('0x3'));var htmlToText=require(_0xa4f6('0x4'));var fs=require('fs');var path=require(_0xa4f6('0x5'));var rimraf=require(_0xa4f6('0x6'));var config=require(_0xa4f6('0x7'));var attributes=require(_0xa4f6('0x8'));module[_0xa4f6('0x9')]=function(_0x252732,_0x500b8c){return _0x252732[_0xa4f6('0xa')](_0xa4f6('0xb'),attributes,{'tableName':_0xa4f6('0xc'),'paranoid':![],'indexes':[{'name':_0xa4f6('0xd'),'fields':[_0xa4f6('0xd')]},{'name':'fti_mail_messages','fields':[_0xa4f6('0xe'),_0xa4f6('0xf')],'type':_0xa4f6('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x118296,_0x1ee173,_0x2f5395){if(_0x118296[_0xa4f6('0x11')]){_0x118296[_0xa4f6('0xe')]=htmlToText['fromString'](_0x118296[_0xa4f6('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2f5395(null,_0x1ee173);},'afterCreate':function(_0x342f9b,_0x5ba874,_0x3881ca){var _0x4701f2=_0x252732[_0xa4f6('0x12')];var _0x15a60f=_0x342f9b['get']({'plain':!![]});if(_0x15a60f[_0xa4f6('0x13')]['toLowerCase']()==='in'||_0x15a60f['direction'][_0xa4f6('0x14')]()===_0xa4f6('0x15')&&!_0x15a60f[_0xa4f6('0x16')]&&!_['isNil'](_0x15a60f['UserId'])){_0x4701f2[_0xa4f6('0x17')]['findOne']({'where':{'id':_0x15a60f[_0xa4f6('0x18')]}})['then'](function(_0x1dfc03){if(_0x1dfc03){_0x1dfc03[_0xa4f6('0x19')]({'lastMsgAt':_0x15a60f[_0xa4f6('0x1a')],'lastMsgDirection':_0x15a60f[_0xa4f6('0x13')][_0xa4f6('0x14')]()});}})[_0xa4f6('0x1b')](function(_0x51ffbb){console['error'](_0x51ffbb);});}_0x3881ca();}},'charset':_0xa4f6('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 0916c07..c290eb0 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 _0x8603=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','./mailMessage.socket','register','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','catch','CreateMailMessage','MailMessage','create','body','options','raw','then','util','moment','bluebird'];(function(_0x41de17,_0x3a6632){var _0x1c0f23=function(_0x4fb003){while(--_0x4fb003){_0x41de17['push'](_0x41de17['shift']());}};_0x1c0f23(++_0x3a6632);}(_0x8603,0x190));var _0x3860=function(_0x42ebf9,_0x3e3953){_0x42ebf9=_0x42ebf9-0x0;var _0x1d7fce=_0x8603[_0x42ebf9];return _0x1d7fce;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});config[_0x3860('0x9')]=_[_0x3860('0xa')](config[_0x3860('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3860('0xb'))[_0x3860('0xc')](socket);function respondWithRpcPromise(_0x52c277,_0x2fb169,_0x38737e){return new BPromise(function(_0x5909b8,_0x101263){return client[_0x3860('0xd')](_0x52c277,_0x38737e)['then'](function(_0x365579){logger[_0x3860('0xe')]('MailMessage,\x20%s,\x20%s',_0x2fb169,_0x3860('0xf'));logger[_0x3860('0x10')](_0x3860('0x11'),_0x2fb169,_0x3860('0xf'),JSON[_0x3860('0x12')](_0x365579));if(_0x365579[_0x3860('0x13')]){if(_0x365579[_0x3860('0x13')][_0x3860('0x14')]===0x1f4){logger[_0x3860('0x13')](_0x3860('0x15'),_0x2fb169,_0x365579['error'][_0x3860('0x16')]);return _0x101263(_0x365579[_0x3860('0x13')][_0x3860('0x16')]);}logger[_0x3860('0x13')](_0x3860('0x15'),_0x2fb169,_0x365579[_0x3860('0x13')][_0x3860('0x16')]);return _0x5909b8(_0x365579[_0x3860('0x13')][_0x3860('0x16')]);}else{logger[_0x3860('0xe')](_0x3860('0x15'),_0x2fb169,_0x3860('0xf'));_0x5909b8(_0x365579['result']['message']);}})[_0x3860('0x17')](function(_0x41ce59){logger[_0x3860('0x13')]('MailMessage,\x20%s,\x20%s',_0x2fb169,_0x41ce59);_0x101263(_0x41ce59);});});}exports[_0x3860('0x18')]=function(_0x145b26){var _0x22e873=this;return new Promise(function(_0x3af33a,_0x20a5b0){return db[_0x3860('0x19')][_0x3860('0x1a')](_0x145b26[_0x3860('0x1b')],{'raw':_0x145b26[_0x3860('0x1c')]?_0x145b26[_0x3860('0x1c')][_0x3860('0x1d')]===undefined?!![]:![]:!![]})[_0x3860('0x1e')](function(_0x280ea9){logger[_0x3860('0xe')](_0x3860('0x18'),_0x145b26);logger['debug'](_0x3860('0x18'),_0x145b26,JSON[_0x3860('0x12')](_0x280ea9));_0x3af33a(_0x280ea9);})[_0x3860('0x17')](function(_0x301e03){logger[_0x3860('0x13')]('CreateMailMessage',_0x301e03[_0x3860('0x16')],_0x145b26);_0x20a5b0(_0x22e873['error'](0x1f4,_0x301e03['message']));});});}; \ 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(_0x16bf82,_0x3bdb5a){var _0x2837cc=function(_0x586ee2){while(--_0x586ee2){_0x16bf82['push'](_0x16bf82['shift']());}};_0x2837cc(++_0x3bdb5a);}(_0x5eb8,0xb0));var _0x85eb=function(_0x3f1861,_0x7b4285){_0x3f1861=_0x3f1861-0x0;var _0x7ca70a=_0x5eb8[_0x3f1861];return _0x7ca70a;};'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 e4644b2..03440a7 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 _0xa4b6=['./mailMessage.events','save','remove','update','removeListener','length'];(function(_0x1d5b62,_0x4f5595){var _0x51b346=function(_0xb68ad8){while(--_0xb68ad8){_0x1d5b62['push'](_0x1d5b62['shift']());}};_0x51b346(++_0x4f5595);}(_0xa4b6,0x150));var _0x6a4b=function(_0x2bc7ea,_0x1e6f29){_0x2bc7ea=_0x2bc7ea-0x0;var _0x44fae1=_0xa4b6[_0x2bc7ea];return _0x44fae1;};'use strict';var MailMessageEvents=require(_0x6a4b('0x0'));var events=[_0x6a4b('0x1'),_0x6a4b('0x2'),_0x6a4b('0x3')];function createListener(_0x2322f6,_0x5a770f){return function(_0x3f110e){_0x5a770f['emit'](_0x2322f6,_0x3f110e);};}function removeListener(_0x44d902,_0x3911a5){return function(){MailMessageEvents[_0x6a4b('0x4')](_0x44d902,_0x3911a5);};}exports['register']=function(_0x430306){for(var _0x47bd29=0x0,_0x268d5f=events[_0x6a4b('0x5')];_0x47bd29<_0x268d5f;_0x47bd29++){var _0x25c579=events[_0x47bd29];var _0x1d2ddf=createListener('mailMessage:'+_0x25c579,_0x430306);MailMessageEvents['on'](_0x25c579,_0x1d2ddf);}}; \ No newline at end of file +var _0x078c=['mailMessage:','save','remove','emit','removeListener','register','length'];(function(_0x437976,_0x2d85ce){var _0x6a812c=function(_0xe1adf){while(--_0xe1adf){_0x437976['push'](_0x437976['shift']());}};_0x6a812c(++_0x2d85ce);}(_0x078c,0x86));var _0xc078=function(_0x196e1b,_0x55fa06){_0x196e1b=_0x196e1b-0x0;var _0x5e1f18=_0x078c[_0x196e1b];return _0x5e1f18;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xc078('0x0'),_0xc078('0x1'),'update'];function createListener(_0x53a4b6,_0x4aa8b6){return function(_0x360e2c){_0x4aa8b6[_0xc078('0x2')](_0x53a4b6,_0x360e2c);};}function removeListener(_0x552fcf,_0x1ea155){return function(){MailMessageEvents[_0xc078('0x3')](_0x552fcf,_0x1ea155);};}exports[_0xc078('0x4')]=function(_0x5fb3ff){for(var _0x446b9a=0x0,_0x3a1f78=events[_0xc078('0x5')];_0x446b9a<_0x3a1f78;_0x446b9a++){var _0x363f47=events[_0x446b9a];var _0x2224d6=createListener(_0xc078('0x6')+_0x363f47,_0x5fb3ff);MailMessageEvents['on'](_0x363f47,_0x2224d6);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 79d9583..13fb40c 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 _0x7f85=['/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','destroy','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers'];(function(_0x8a098f,_0x510a2b){var _0xab9a09=function(_0x212961){while(--_0x212961){_0x8a098f['push'](_0x8a098f['shift']());}};_0xab9a09(++_0x510a2b);}(_0x7f85,0x14f));var _0x57f8=function(_0xa34cd7,_0x589125){_0xa34cd7=_0xa34cd7-0x0;var _0x45bb92=_0x7f85[_0xa34cd7];return _0x45bb92;};'use strict';var multer=require('multer');var util=require(_0x57f8('0x0'));var path=require(_0x57f8('0x1'));var timeout=require(_0x57f8('0x2'));var express=require(_0x57f8('0x3'));var router=express[_0x57f8('0x4')]();var fs_extra=require(_0x57f8('0x5'));var auth=require(_0x57f8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x57f8('0x7'));var controller=require('./mailQueue.controller');router[_0x57f8('0x8')]('/',auth[_0x57f8('0x9')](),controller['index']);router[_0x57f8('0x8')](_0x57f8('0xa'),auth[_0x57f8('0x9')](),controller[_0x57f8('0xb')]);router[_0x57f8('0x8')](_0x57f8('0xc'),auth[_0x57f8('0x9')](),controller[_0x57f8('0xd')]);router[_0x57f8('0x8')](_0x57f8('0xe'),auth[_0x57f8('0x9')](),controller[_0x57f8('0xf')]);router['get'](_0x57f8('0x10'),auth[_0x57f8('0x9')](),controller['getTeams']);router['get'](_0x57f8('0x11'),auth[_0x57f8('0x9')](),controller[_0x57f8('0x12')]);router['post']('/',auth[_0x57f8('0x9')](),controller['create']);router[_0x57f8('0x13')](_0x57f8('0x10'),auth[_0x57f8('0x9')](),controller[_0x57f8('0x14')]);router['post'](_0x57f8('0x11'),auth[_0x57f8('0x9')](),controller[_0x57f8('0x15')]);router['put'](_0x57f8('0xc'),auth[_0x57f8('0x9')](),controller['update']);router['delete'](_0x57f8('0xc'),auth[_0x57f8('0x9')](),controller[_0x57f8('0x16')]);router[_0x57f8('0x17')](_0x57f8('0x10'),auth[_0x57f8('0x9')](),controller[_0x57f8('0x18')]);router[_0x57f8('0x17')](_0x57f8('0x11'),auth['isAuthenticated'](),controller[_0x57f8('0x19')]);module[_0x57f8('0x1a')]=router; \ No newline at end of file +var _0x1765=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','update','delete','removeAgents','exports','util','connect-timeout'];(function(_0x3e1d97,_0xe83c60){var _0x33193a=function(_0x1ceba8){while(--_0x1ceba8){_0x3e1d97['push'](_0x3e1d97['shift']());}};_0x33193a(++_0xe83c60);}(_0x1765,0xbe));var _0x5176=function(_0x3060e3,_0x14f2c6){_0x3060e3=_0x3060e3-0x0;var _0x497d2c=_0x1765[_0x3060e3];return _0x497d2c;};'use strict';var multer=require('multer');var util=require(_0x5176('0x0'));var path=require('path');var timeout=require(_0x5176('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5176('0x2'));var interaction=require(_0x5176('0x3'));var config=require(_0x5176('0x4'));var controller=require(_0x5176('0x5'));router['get']('/',auth[_0x5176('0x6')](),controller[_0x5176('0x7')]);router[_0x5176('0x8')]('/describe',auth[_0x5176('0x6')](),controller[_0x5176('0x9')]);router[_0x5176('0x8')](_0x5176('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x5176('0x8')](_0x5176('0xb'),auth[_0x5176('0x6')](),controller[_0x5176('0xc')]);router[_0x5176('0x8')](_0x5176('0xd'),auth['isAuthenticated'](),controller[_0x5176('0xe')]);router[_0x5176('0x8')](_0x5176('0xf'),auth['isAuthenticated'](),controller['getAgents']);router[_0x5176('0x10')]('/',auth[_0x5176('0x6')](),controller[_0x5176('0x11')]);router[_0x5176('0x10')](_0x5176('0xd'),auth[_0x5176('0x6')](),controller[_0x5176('0x12')]);router[_0x5176('0x10')]('/:id/users',auth[_0x5176('0x6')](),controller[_0x5176('0x13')]);router['put'](_0x5176('0xa'),auth[_0x5176('0x6')](),controller[_0x5176('0x14')]);router[_0x5176('0x15')](_0x5176('0xa'),auth[_0x5176('0x6')](),controller['destroy']);router['delete'](_0x5176('0xd'),auth[_0x5176('0x6')](),controller['removeTeams']);router[_0x5176('0x15')](_0x5176('0xf'),auth['isAuthenticated'](),controller[_0x5176('0x16')]);module[_0x5176('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 6bf918e..04d2110 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 _0xa1dd=['beepall','roundrobin','exports','name','INTEGER','ENUM','rrmemory'];(function(_0x10a3c8,_0x2bc9dd){var _0x639a8e=function(_0x2d118b){while(--_0x2d118b){_0x10a3c8['push'](_0x10a3c8['shift']());}};_0x639a8e(++_0x2bc9dd);}(_0xa1dd,0xe9));var _0xda1d=function(_0xd6c4c9,_0x559f20){_0xd6c4c9=_0xd6c4c9-0x0;var _0x5ac98c=_0xa1dd[_0xd6c4c9];return _0x5ac98c;};'use strict';var Sequelize=require('sequelize');module[_0xda1d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xda1d('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xda1d('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xda1d('0x3')](_0xda1d('0x4'),_0xda1d('0x5'),_0xda1d('0x6'))}}; \ No newline at end of file +var _0xe441=['rrmemory','beepall','exports','STRING','name','ENUM'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xe441,0xfe));var _0x1e44=function(_0x44ac31,_0x17c132){_0x44ac31=_0x44ac31-0x0;var _0x5a7b04=_0xe441[_0x44ac31];return _0x5a7b04;};'use strict';var Sequelize=require('sequelize');module[_0x1e44('0x0')]={'name':{'type':Sequelize[_0x1e44('0x1')],'unique':_0x1e44('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1e44('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1e44('0x3')](_0x1e44('0x4'),_0x1e44('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index da17331..31b86ae 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 _0x4c6b=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','redis','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','update','then','destroy','UserProfileResource','error','stack','name','map','MailQueue','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','show','params','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailQueues','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','rawAttributes','MailQueueId','User','findAndCountAll','agent','createdAt','rows','format','%s/%s','SIP','mailPause','getTeams','findOne','Team','order','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','UserMailQueue','userMailQueue:save','removeTeams','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','TeamId','includes','all','union','removeAgents','forEach','emit','userMailQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir'];(function(_0x5c0558,_0x55dfb3){var _0x4772eb=function(_0x4eac9a){while(--_0x4eac9a){_0x5c0558['push'](_0x5c0558['shift']());}};_0x4772eb(++_0x55dfb3);}(_0x4c6b,0x87));var _0xb4c6=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x4c6b[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require(_0xb4c6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb4c6('0x1'));var jsonpatch=require(_0xb4c6('0x2'));var rp=require(_0xb4c6('0x3'));var moment=require(_0xb4c6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb4c6('0x5'));var util=require(_0xb4c6('0x6'));var path=require(_0xb4c6('0x7'));var sox=require(_0xb4c6('0x8'));var csv=require(_0xb4c6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb4c6('0xa'));var _=require(_0xb4c6('0xb'));var squel=require(_0xb4c6('0xc'));var crypto=require(_0xb4c6('0xd'));var jsforce=require(_0xb4c6('0xe'));var deskjs=require(_0xb4c6('0xf'));var toCsv=require(_0xb4c6('0x9'));var querystring=require(_0xb4c6('0x10'));var Papa=require('papaparse');var Redis=require(_0xb4c6('0x11'));var authService=require(_0xb4c6('0x12'));var qs=require(_0xb4c6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb4c6('0x14'));var logger=require(_0xb4c6('0x15'))(_0xb4c6('0x16'));var utils=require(_0xb4c6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb4c6('0x18'));var db=require(_0xb4c6('0x19'))['db'];config['redis']=_[_0xb4c6('0x1a')](config['redis'],{'host':_0xb4c6('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4c6('0x1c')]));require(_0xb4c6('0x1d'))[_0xb4c6('0x1e')](socket);function respondWithStatusCode(_0xe69af0,_0x104c8f){_0x104c8f=_0x104c8f||0xcc;return function(_0x497fc5){if(_0x497fc5){return _0xe69af0[_0xb4c6('0x1f')](_0x104c8f);}return _0xe69af0[_0xb4c6('0x20')](_0x104c8f)[_0xb4c6('0x21')]();};}function respondWithResult(_0x42747c,_0x28d910){_0x28d910=_0x28d910||0xc8;return function(_0xbc84fd){if(_0xbc84fd){return _0x42747c[_0xb4c6('0x20')](_0x28d910)[_0xb4c6('0x22')](_0xbc84fd);}};}function respondWithFilteredResult(_0xe42c1,_0x1e99ab){return function(_0x26791b){if(_0x26791b){var _0x1f80d9=typeof _0x1e99ab[_0xb4c6('0x23')]===_0xb4c6('0x24')&&typeof _0x1e99ab['limit']===_0xb4c6('0x24');var _0x5c04f3=_0x26791b['count'];var _0x1e7738=_0x1f80d9?0x0:_0x1e99ab[_0xb4c6('0x23')];var _0x49526a=_0x1f80d9?_0x26791b[_0xb4c6('0x25')]:_0x1e99ab[_0xb4c6('0x23')]+_0x1e99ab['limit'];var _0x36b32b;if(_0x49526a>=_0x5c04f3){_0x49526a=_0x5c04f3;_0x36b32b=0xc8;}else{_0x36b32b=0xce;}_0xe42c1[_0xb4c6('0x20')](_0x36b32b);return _0xe42c1[_0xb4c6('0x26')](_0xb4c6('0x27'),_0x1e7738+'-'+_0x49526a+'/'+_0x5c04f3)[_0xb4c6('0x22')](_0x26791b);}return null;};}function patchUpdates(_0x1abddd){return function(_0x3e6392){try{jsonpatch['apply'](_0x3e6392,_0x1abddd,!![]);}catch(_0x4cac35){return BPromise[_0xb4c6('0x28')](_0x4cac35);}return _0x3e6392['save']();};}function saveUpdates(_0x164074,_0x204a12){return function(_0x294f45){if(_0x294f45){return _0x294f45[_0xb4c6('0x29')](_0x164074)[_0xb4c6('0x2a')](function(_0x28ed91){return _0x28ed91;});}return null;};}function removeEntity(_0x2ff5b1,_0x8cfeeb){return function(_0x586ec4){if(_0x586ec4){return _0x586ec4[_0xb4c6('0x2b')]()['then'](function(){var _0x476376=_0x586ec4['get']({'plain':!![]});var _0x2a9524='MailQueues';return db[_0xb4c6('0x2c')][_0xb4c6('0x2b')]({'where':{'type':_0x2a9524,'resourceId':_0x476376['id']}})['then'](function(){return _0x586ec4;});})['then'](function(){_0x2ff5b1[_0xb4c6('0x20')](0xcc)[_0xb4c6('0x21')]();});}};}function handleEntityNotFound(_0x28034c,_0x4c4917){return function(_0x9abc11){if(!_0x9abc11){_0x28034c[_0xb4c6('0x1f')](0x194);}return _0x9abc11;};}function handleError(_0x24065b,_0xb34c49){_0xb34c49=_0xb34c49||0x1f4;return function(_0x298784){logger[_0xb4c6('0x2d')](_0x298784[_0xb4c6('0x2e')]);if(_0x298784[_0xb4c6('0x2f')]){delete _0x298784[_0xb4c6('0x2f')];}_0x24065b[_0xb4c6('0x20')](_0xb34c49)['send'](_0x298784);};}exports['index']=function(_0x4b9050,_0x2610c8){var _0x342952={},_0x2500b9={},_0x53a0db={'count':0x0,'rows':[]};var _0x161549=_[_0xb4c6('0x30')](db[_0xb4c6('0x31')]['rawAttributes'],function(_0x3c2d3d){return{'name':_0x3c2d3d['fieldName'],'type':_0x3c2d3d['type'][_0xb4c6('0x32')]};});_0x2500b9[_0xb4c6('0x33')]=_[_0xb4c6('0x30')](_0x161549,_0xb4c6('0x2f'));_0x2500b9[_0xb4c6('0x34')]=_[_0xb4c6('0x35')](_0x4b9050[_0xb4c6('0x34')]);_0x2500b9['filters']=_[_0xb4c6('0x36')](_0x2500b9['model'],_0x2500b9[_0xb4c6('0x34')]);_0x342952[_0xb4c6('0x37')]=_[_0xb4c6('0x36')](_0x2500b9[_0xb4c6('0x33')],qs[_0xb4c6('0x38')](_0x4b9050[_0xb4c6('0x34')]['fields']));_0x342952['attributes']=_0x342952[_0xb4c6('0x37')]['length']?_0x342952[_0xb4c6('0x37')]:_0x2500b9[_0xb4c6('0x33')];if(!_0x4b9050[_0xb4c6('0x34')][_0xb4c6('0x39')](_0xb4c6('0x3a'))){_0x342952['limit']=qs[_0xb4c6('0x3b')](_0x4b9050['query'][_0xb4c6('0x3b')]);_0x342952[_0xb4c6('0x23')]=qs['offset'](_0x4b9050['query']['offset']);}_0x342952['order']=qs[_0xb4c6('0x3c')](_0x4b9050[_0xb4c6('0x34')]['sort']);_0x342952[_0xb4c6('0x3d')]=qs[_0xb4c6('0x3e')](_[_0xb4c6('0x3f')](_0x4b9050[_0xb4c6('0x34')],_0x2500b9[_0xb4c6('0x3e')]),_0x161549);if(_0x4b9050[_0xb4c6('0x34')][_0xb4c6('0x40')]){_0x342952[_0xb4c6('0x3d')]=_[_0xb4c6('0x41')](_0x342952[_0xb4c6('0x3d')],{'$or':_[_0xb4c6('0x30')](_0x161549,function(_0xcb0fba){if(_0xcb0fba[_0xb4c6('0x42')]!==_0xb4c6('0x43')){var _0x5c8991={};_0x5c8991[_0xcb0fba['name']]={'$like':'%'+_0x4b9050['query'][_0xb4c6('0x40')]+'%'};return _0x5c8991;}})});}_0x342952=_[_0xb4c6('0x41')]({},_0x342952,_0x4b9050[_0xb4c6('0x44')]);var _0x111a84={'where':_0x342952[_0xb4c6('0x3d')]};return db[_0xb4c6('0x31')][_0xb4c6('0x25')](_0x111a84)[_0xb4c6('0x2a')](function(_0x7f629d){_0x53a0db[_0xb4c6('0x25')]=_0x7f629d;if(_0x4b9050['query']['includeAll']){_0x342952[_0xb4c6('0x45')]=[{'all':!![]}];}return db[_0xb4c6('0x31')][_0xb4c6('0x46')](_0x342952);})['then'](function(_0x448f5c){_0x53a0db['rows']=_0x448f5c;return _0x53a0db;})[_0xb4c6('0x2a')](respondWithFilteredResult(_0x2610c8,_0x342952))[_0xb4c6('0x47')](handleError(_0x2610c8,null));};exports[_0xb4c6('0x48')]=function(_0x31e6b5,_0x921628){var _0x3a9217={'raw':!![],'where':{'id':_0x31e6b5[_0xb4c6('0x49')]['id']}},_0x24842d={};_0x24842d['model']=_[_0xb4c6('0x35')](db[_0xb4c6('0x31')]['rawAttributes']);_0x24842d[_0xb4c6('0x34')]=_[_0xb4c6('0x35')](_0x31e6b5[_0xb4c6('0x34')]);_0x24842d[_0xb4c6('0x3e')]=_[_0xb4c6('0x36')](_0x24842d['model'],_0x24842d[_0xb4c6('0x34')]);_0x3a9217['attributes']=_[_0xb4c6('0x36')](_0x24842d[_0xb4c6('0x33')],qs[_0xb4c6('0x38')](_0x31e6b5[_0xb4c6('0x34')][_0xb4c6('0x38')]));_0x3a9217['attributes']=_0x3a9217[_0xb4c6('0x37')][_0xb4c6('0x4a')]?_0x3a9217[_0xb4c6('0x37')]:_0x24842d['model'];if(_0x31e6b5[_0xb4c6('0x34')][_0xb4c6('0x4b')]){_0x3a9217[_0xb4c6('0x45')]=[{'all':!![]}];}_0x3a9217=_[_0xb4c6('0x41')]({},_0x3a9217,_0x31e6b5[_0xb4c6('0x44')]);return db[_0xb4c6('0x31')][_0xb4c6('0x4c')](_0x3a9217)[_0xb4c6('0x2a')](handleEntityNotFound(_0x921628,null))['then'](respondWithResult(_0x921628,null))[_0xb4c6('0x47')](handleError(_0x921628,null));};exports['create']=function(_0x1ecc40,_0x3cbc6d){return db[_0xb4c6('0x31')][_0xb4c6('0x4d')](_0x1ecc40[_0xb4c6('0x4e')],{})[_0xb4c6('0x2a')](function(_0x3cb716){var _0x1a18a2=_0x1ecc40[_0xb4c6('0x4f')][_0xb4c6('0x50')]({'plain':!![]});if(!_0x1a18a2)throw new Error(_0xb4c6('0x51'));if(_0x1a18a2['role']===_0xb4c6('0x4f')){var _0x25f7ad=_0x3cb716['get']({'plain':!![]});var _0x4b31b8=_0xb4c6('0x52');return db['UserProfileSection'][_0xb4c6('0x4c')]({'where':{'name':_0x4b31b8,'userProfileId':_0x1a18a2['userProfileId']},'raw':!![]})[_0xb4c6('0x2a')](function(_0xb87e09){if(_0xb87e09&&_0xb87e09[_0xb4c6('0x53')]===0x0){return db[_0xb4c6('0x2c')][_0xb4c6('0x4d')]({'name':_0x25f7ad[_0xb4c6('0x2f')],'resourceId':_0x25f7ad['id'],'type':_0xb87e09[_0xb4c6('0x2f')],'sectionId':_0xb87e09['id']},{})[_0xb4c6('0x2a')](function(){return _0x3cb716;});}else{return _0x3cb716;}})[_0xb4c6('0x47')](function(_0x3426d8){logger[_0xb4c6('0x2d')](_0xb4c6('0x54'),_0x3426d8);throw _0x3426d8;});}return _0x3cb716;})[_0xb4c6('0x2a')](respondWithResult(_0x3cbc6d,0xc9))['catch'](handleError(_0x3cbc6d,null));};exports['update']=function(_0xbda3e5,_0x4c028a){if(_0xbda3e5['body']['id']){delete _0xbda3e5[_0xb4c6('0x4e')]['id'];}return db['MailQueue'][_0xb4c6('0x4c')]({'where':{'id':_0xbda3e5[_0xb4c6('0x49')]['id']}})[_0xb4c6('0x2a')](handleEntityNotFound(_0x4c028a,null))[_0xb4c6('0x2a')](saveUpdates(_0xbda3e5['body'],null))[_0xb4c6('0x2a')](respondWithResult(_0x4c028a,null))[_0xb4c6('0x47')](handleError(_0x4c028a,null));};exports[_0xb4c6('0x2b')]=function(_0x360de8,_0x32fbac){return db[_0xb4c6('0x31')][_0xb4c6('0x4c')]({'where':{'id':_0x360de8[_0xb4c6('0x49')]['id']}})['then'](handleEntityNotFound(_0x32fbac,null))[_0xb4c6('0x2a')](removeEntity(_0x32fbac,null))['catch'](handleError(_0x32fbac,null));};exports[_0xb4c6('0x55')]=function(_0x282e8d,_0xb25433){return db[_0xb4c6('0x31')]['describe']()['then'](respondWithResult(_0xb25433,null))['catch'](handleError(_0xb25433,null));};exports[_0xb4c6('0x56')]=function(_0x4306f4,_0x407cef,_0x216d0b){var _0x32af40={'raw':!![],'where':{}},_0x3a57cc={},_0x14439f;return db['MailQueue']['findOne']({'where':{'id':_0x4306f4[_0xb4c6('0x49')]['id']}})[_0xb4c6('0x2a')](handleEntityNotFound(_0x407cef,null))['then'](function(_0x4c3962){if(_0x4c3962){_0x14439f=_0x4c3962['get']({'plain':!![]});_0x3a57cc[_0xb4c6('0x33')]=_[_0xb4c6('0x35')](db['UserMailQueue'][_0xb4c6('0x57')]);_0x3a57cc['query']=_[_0xb4c6('0x35')](_0x4306f4[_0xb4c6('0x34')]);_0x3a57cc[_0xb4c6('0x3e')]=_['intersection'](_0x3a57cc[_0xb4c6('0x33')],_0x3a57cc[_0xb4c6('0x34')]);_0x32af40[_0xb4c6('0x37')]=_[_0xb4c6('0x36')](_0x3a57cc['model'],qs[_0xb4c6('0x38')](_0x4306f4[_0xb4c6('0x34')][_0xb4c6('0x38')]));_0x32af40[_0xb4c6('0x37')]=_0x32af40[_0xb4c6('0x37')][_0xb4c6('0x4a')]?_0x32af40[_0xb4c6('0x37')]:_0x3a57cc[_0xb4c6('0x33')];if(!_0x4306f4[_0xb4c6('0x34')][_0xb4c6('0x39')]('nolimit')){_0x32af40[_0xb4c6('0x3b')]=qs[_0xb4c6('0x3b')](_0x4306f4[_0xb4c6('0x34')][_0xb4c6('0x3b')]);_0x32af40[_0xb4c6('0x23')]=qs[_0xb4c6('0x23')](_0x4306f4[_0xb4c6('0x34')][_0xb4c6('0x23')]);}_0x32af40['order']=qs[_0xb4c6('0x3c')](_0x4306f4[_0xb4c6('0x34')]['sort']);_0x32af40[_0xb4c6('0x3d')]=qs[_0xb4c6('0x3e')](_[_0xb4c6('0x3f')](_0x4306f4[_0xb4c6('0x34')],_0x3a57cc[_0xb4c6('0x3e')]));_0x32af40['where'][_0xb4c6('0x58')]=_0x4c3962['id'];if(_0x4306f4[_0xb4c6('0x34')][_0xb4c6('0x40')]){_0x32af40[_0xb4c6('0x3d')]=_[_0xb4c6('0x41')](_0x32af40[_0xb4c6('0x3d')],{'$or':_[_0xb4c6('0x30')](_0x32af40[_0xb4c6('0x37')],function(_0x45c37b){var _0x35ee74={};_0x35ee74[_0x45c37b]={'$like':'%'+_0x4306f4[_0xb4c6('0x34')]['filter']+'%'};return _0x35ee74;})});}_0x32af40=_[_0xb4c6('0x41')]({},_0x32af40,_0x4306f4['options']);return db['UserMailQueue'][_0xb4c6('0x46')](_0x32af40);}})[_0xb4c6('0x2a')](function(_0x522751){if(_0x522751){return db[_0xb4c6('0x59')][_0xb4c6('0x5a')]({'where':{'id':_['map'](_0x522751,'UserId'),'role':_0xb4c6('0x5b')},'attributes':['id',_0xb4c6('0x2f'),'mailPause','updatedAt',_0xb4c6('0x5c')]});}})[_0xb4c6('0x2a')](function(_0x3d951a){if(_0x3d951a){return{'count':_0x3d951a[_0xb4c6('0x25')],'rows':_['map'](_0x3d951a[_0xb4c6('0x5d')],function(_0x122299){return{'membername':_0x122299[_0xb4c6('0x2f')],'UserId':_0x122299['id'],'queue_name':_0x14439f['name'],'MailQueueId':_0x14439f['id'],'interface':util[_0xb4c6('0x5e')](_0xb4c6('0x5f'),_0xb4c6('0x60'),_0x122299[_0xb4c6('0x2f')]),'penalty':0x0,'paused':_0x122299[_0xb4c6('0x61')],'createdAt':_0x122299[_0xb4c6('0x5c')],'updatedAt':_0x122299['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb4c6('0x2a')](respondWithFilteredResult(_0x407cef,_0x32af40))[_0xb4c6('0x47')](handleError(_0x407cef,null));};exports[_0xb4c6('0x62')]=function(_0x1b6360,_0x568d79,_0x1c63c9){var _0x310dbb={};var _0x2ca6fa={};var _0x483fbb;var _0x1b9662;return db[_0xb4c6('0x31')][_0xb4c6('0x63')]({'where':{'id':_0x1b6360['params']['id']}})[_0xb4c6('0x2a')](handleEntityNotFound(_0x568d79,null))[_0xb4c6('0x2a')](function(_0x15d01c){if(_0x15d01c){_0x483fbb=_0x15d01c;_0x2ca6fa[_0xb4c6('0x33')]=_['keys'](db[_0xb4c6('0x64')]['rawAttributes']);_0x2ca6fa[_0xb4c6('0x34')]=_[_0xb4c6('0x35')](_0x1b6360[_0xb4c6('0x34')]);_0x2ca6fa[_0xb4c6('0x3e')]=_['intersection'](_0x2ca6fa['model'],_0x2ca6fa[_0xb4c6('0x34')]);_0x310dbb[_0xb4c6('0x37')]=_[_0xb4c6('0x36')](_0x2ca6fa['model'],qs['fields'](_0x1b6360[_0xb4c6('0x34')][_0xb4c6('0x38')]));_0x310dbb[_0xb4c6('0x37')]=_0x310dbb['attributes'][_0xb4c6('0x4a')]?_0x310dbb['attributes']:_0x2ca6fa[_0xb4c6('0x33')];_0x310dbb[_0xb4c6('0x65')]=qs['sort'](_0x1b6360[_0xb4c6('0x34')][_0xb4c6('0x3c')]);_0x310dbb[_0xb4c6('0x3d')]=qs[_0xb4c6('0x3e')](_[_0xb4c6('0x3f')](_0x1b6360[_0xb4c6('0x34')],_0x2ca6fa['filters']));if(_0x1b6360[_0xb4c6('0x34')][_0xb4c6('0x40')]){_0x310dbb[_0xb4c6('0x3d')]=_[_0xb4c6('0x41')](_0x310dbb[_0xb4c6('0x3d')],{'$or':_['map'](_0x310dbb[_0xb4c6('0x37')],function(_0x421d04){var _0x19b61a={};_0x19b61a[_0x421d04]={'$like':'%'+_0x1b6360[_0xb4c6('0x34')]['filter']+'%'};return _0x19b61a;})});}_0x310dbb=_[_0xb4c6('0x41')]({},_0x310dbb,_0x1b6360[_0xb4c6('0x44')]);return _0x483fbb['getTeams'](_0x310dbb);}})['then'](function(_0x30554a){if(_0x30554a){_0x1b9662=_0x30554a[_0xb4c6('0x4a')];if(!_0x1b6360[_0xb4c6('0x34')][_0xb4c6('0x39')](_0xb4c6('0x3a'))){_0x310dbb[_0xb4c6('0x3b')]=qs[_0xb4c6('0x3b')](_0x1b6360[_0xb4c6('0x34')][_0xb4c6('0x3b')]);_0x310dbb[_0xb4c6('0x23')]=qs[_0xb4c6('0x23')](_0x1b6360[_0xb4c6('0x34')][_0xb4c6('0x23')]);}return _0x483fbb['getTeams'](_0x310dbb);}})[_0xb4c6('0x2a')](function(_0x3c515f){if(_0x3c515f){return _0x3c515f?{'count':_0x1b9662,'rows':_0x3c515f}:null;}})['then'](respondWithResult(_0x568d79,null))[_0xb4c6('0x47')](handleError(_0x568d79,null));};exports[_0xb4c6('0x66')]=function(_0x19dc6b,_0x5f36a5,_0x29d45f){var _0x38a8f5=_0x19dc6b[_0xb4c6('0x4e')][_0xb4c6('0x67')];return db[_0xb4c6('0x64')][_0xb4c6('0x46')]({'where':{'id':_0x38a8f5},'attributes':['id'],'include':[{'model':db[_0xb4c6('0x59')],'as':_0xb4c6('0x68'),'attributes':['id','name',_0xb4c6('0x69'),_0xb4c6('0x6a'),_0xb4c6('0x6b')],'raw':!![]}]})[_0xb4c6('0x2a')](function(_0x3f4dbd){if(_0x3f4dbd){var _0x3bf298=_['flatMap'](_0x3f4dbd,function(_0x525387){var _0x26bc7c=_0x525387[_0xb4c6('0x50')]({'plain':!![]});return _0x26bc7c[_0xb4c6('0x68')];});return db['MailQueue'][_0xb4c6('0x4c')]({'where':{'id':_0x19dc6b[_0xb4c6('0x49')]['id']}})['then'](function(_0x151098){return db[_0xb4c6('0x6c')][_0xb4c6('0x6d')](function(_0x3c1beb){return _0x151098['addTeams'](_0x38a8f5,{'transaction':_0x3c1beb})[_0xb4c6('0x2a')](function(){return BPromise[_0xb4c6('0x6e')](_0x3bf298,function(_0xe802fd){return db[_0xb4c6('0x6f')]['findOrCreate']({'where':{'UserId':_0xe802fd['id'],'MailQueueId':_0x19dc6b[_0xb4c6('0x49')]['id']},'transaction':_0x3c1beb});});})['then'](function(){_0x3bf298['forEach'](function(_0x156251){socket['emit'](_0xb4c6('0x70'),{'UserId':_0x156251['id'],'MailQueueId':_0x151098['id']});});});});});}})['then'](respondWithStatusCode(_0x5f36a5,null))[_0xb4c6('0x47')](handleError(_0x5f36a5,null));};exports[_0xb4c6('0x71')]=function(_0xc62c40,_0x53316e,_0x5821d2){return db[_0xb4c6('0x64')][_0xb4c6('0x46')]({'where':{'id':_0xc62c40[_0xb4c6('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb4c6('0x59')],'as':_0xb4c6('0x68'),'attributes':['id'],'raw':!![]}]})[_0xb4c6('0x2a')](handleEntityNotFound(_0x53316e,null))[_0xb4c6('0x2a')](function(_0x421efa){var _0x1038ce=_[_0xb4c6('0x30')](_0x421efa,'id');var _0x11d084=[];var _0x4498b6=[];var _0x35b968=squel['select']();_0x35b968[_0xb4c6('0x72')](_0xb4c6('0x73'))['from'](_0xb4c6('0x74'),'tq')[_0xb4c6('0x75')](_0xb4c6('0x76'),'ut',_0xb4c6('0x77'))['where'](_0xb4c6('0x78'),_0xc62c40[_0xb4c6('0x49')]['id']);for(var _0xacbd7f=0x0;_0xacbd7f<_0x421efa[_0xb4c6('0x4a')];_0xacbd7f+=0x1){let _0x5f1f74=_0x421efa[_0xacbd7f];for(var _0x2f35ca=0x0;_0x2f35ca<_0x5f1f74['Agents'][_0xb4c6('0x4a')];_0x2f35ca+=0x1){let _0x209aee=_0x5f1f74[_0xb4c6('0x68')][_0x2f35ca];var _0x1e67d4=_0x35b968[_0xb4c6('0x79')]();_0x1e67d4[_0xb4c6('0x3d')](_0xb4c6('0x7a'),_0x209aee['id']);_0x4498b6['push'](db[_0xb4c6('0x6c')][_0xb4c6('0x34')](_0x1e67d4[_0xb4c6('0x7b')](),{'type':db[_0xb4c6('0x6c')]['QueryTypes'][_0xb4c6('0x7c')]})['then'](function(_0x37aaf0){if(_0x37aaf0[_0xb4c6('0x4a')]===0x1){return _0x209aee['id'];}else{var _0x2e5e09=_['every'](_['map'](_0x37aaf0,_0xb4c6('0x7d')),function(_0x10e356){return _[_0xb4c6('0x7e')](_0x1038ce,_0x10e356);});if(_0x2e5e09){return _0x209aee['id'];}}}));}}return BPromise[_0xb4c6('0x7f')](_0x4498b6)['then'](function(_0x457d06){_0x11d084=_(_0x11d084)[_0xb4c6('0x80')](_0x457d06)['compact']()['value']();return db['MailQueue'][_0xb4c6('0x4c')]({'where':{'id':_0xc62c40[_0xb4c6('0x49')]['id']}})[_0xb4c6('0x2a')](function(_0x3f3710){return db[_0xb4c6('0x6c')][_0xb4c6('0x6d')](function(_0x2317b6){return _0x3f3710[_0xb4c6('0x71')](_0xc62c40['query'][_0xb4c6('0x67')],{'transaction':_0x2317b6})['then'](function(){if(!_['isEmpty'](_0x11d084)){return _0x3f3710[_0xb4c6('0x81')](_0x11d084,{'transaction':_0x2317b6});}})[_0xb4c6('0x2a')](function(){_0x11d084[_0xb4c6('0x82')](function(_0x30060b){socket[_0xb4c6('0x83')](_0xb4c6('0x84'),{'UserId':_0x30060b,'MailQueueId':_0x3f3710['id']});});});});});});})[_0xb4c6('0x2a')](respondWithStatusCode(_0x53316e,null))[_0xb4c6('0x47')](handleError(_0x53316e,null));};exports[_0xb4c6('0x85')]=function(_0x5645b4,_0x45f0c7,_0x43defa){return db['MailQueue'][_0xb4c6('0x4c')]({'where':{'id':_0x5645b4[_0xb4c6('0x49')]['id']}})[_0xb4c6('0x2a')](handleEntityNotFound(_0x45f0c7,null))[_0xb4c6('0x2a')](function(_0x3faee3){if(_0x3faee3){return _0x3faee3[_0xb4c6('0x85')](_0x5645b4[_0xb4c6('0x4e')]['ids'],_[_0xb4c6('0x86')](_0x5645b4[_0xb4c6('0x4e')],['ids','id'])||{})[_0xb4c6('0x87')](function(_0x9b8a49){for(var _0x3fed71=0x0;_0x3fed71<_0x5645b4[_0xb4c6('0x4e')][_0xb4c6('0x67')][_0xb4c6('0x4a')];_0x3fed71+=0x1){socket[_0xb4c6('0x83')](_0xb4c6('0x70'),{'UserId':Number(_0x5645b4[_0xb4c6('0x4e')][_0xb4c6('0x67')][_0x3fed71]),'MailQueueId':Number(_0x5645b4[_0xb4c6('0x49')]['id'])});}return _0x9b8a49;});}})['then'](respondWithResult(_0x45f0c7,null))[_0xb4c6('0x47')](handleError(_0x45f0c7,null));};exports['removeAgents']=function(_0x396976,_0x267a24,_0x1cb707){return db[_0xb4c6('0x31')]['find']({'where':{'id':_0x396976['params']['id']}})['then'](handleEntityNotFound(_0x267a24,null))[_0xb4c6('0x2a')](function(_0x1edf25){if(_0x1edf25){return _0x1edf25[_0xb4c6('0x81')](_0x396976[_0xb4c6('0x34')]['ids'])[_0xb4c6('0x2a')](function(){if(_['isArray'](_0x396976[_0xb4c6('0x34')][_0xb4c6('0x67')])){for(var _0x3f01a3=0x0;_0x3f01a3<_0x396976[_0xb4c6('0x34')]['ids']['length'];_0x3f01a3+=0x1){socket[_0xb4c6('0x83')]('userMailQueue:remove',{'UserId':Number(_0x396976[_0xb4c6('0x34')][_0xb4c6('0x67')][_0x3f01a3]),'MailQueueId':Number(_0x396976[_0xb4c6('0x49')]['id'])});}}else{socket[_0xb4c6('0x83')](_0xb4c6('0x84'),{'UserId':Number(_0x396976[_0xb4c6('0x34')][_0xb4c6('0x67')]),'MailQueueId':Number(_0x396976['params']['id'])});}});}})['then'](respondWithStatusCode(_0x267a24,null))[_0xb4c6('0x47')](handleError(_0x267a24,null));};exports[_0xb4c6('0x88')]=function(_0x2a3717,_0x4c0292,_0x56ea15){var _0x4b502b={};var _0x2d6dd0={};var _0x2131aa;var _0x4d5f71;return db['MailQueue'][_0xb4c6('0x63')]({'where':{'id':_0x2a3717['params']['id']}})[_0xb4c6('0x2a')](handleEntityNotFound(_0x4c0292,null))[_0xb4c6('0x2a')](function(_0x284869){if(_0x284869){_0x2131aa=_0x284869;_0x2d6dd0[_0xb4c6('0x33')]=_[_0xb4c6('0x35')](db['User']['rawAttributes']);_0x2d6dd0[_0xb4c6('0x34')]=_[_0xb4c6('0x35')](_0x2a3717['query']);_0x2d6dd0['filters']=_[_0xb4c6('0x36')](_0x2d6dd0[_0xb4c6('0x33')],_0x2d6dd0['query']);_0x4b502b[_0xb4c6('0x37')]=_['intersection'](_0x2d6dd0['model'],qs[_0xb4c6('0x38')](_0x2a3717[_0xb4c6('0x34')][_0xb4c6('0x38')]));_0x4b502b[_0xb4c6('0x37')]=_0x4b502b[_0xb4c6('0x37')][_0xb4c6('0x4a')]?_0x4b502b[_0xb4c6('0x37')]:_0x2d6dd0[_0xb4c6('0x33')];_0x4b502b[_0xb4c6('0x65')]=qs['sort'](_0x2a3717[_0xb4c6('0x34')][_0xb4c6('0x3c')]);_0x4b502b['where']=qs[_0xb4c6('0x3e')](_[_0xb4c6('0x3f')](_0x2a3717[_0xb4c6('0x34')],_0x2d6dd0[_0xb4c6('0x3e')]));if(_0x2a3717['query'][_0xb4c6('0x40')]){_0x4b502b[_0xb4c6('0x3d')]=_['merge'](_0x4b502b['where'],{'$or':_[_0xb4c6('0x30')](_0x4b502b['attributes'],function(_0x1ac553){var _0x3d7c3f={};_0x3d7c3f[_0x1ac553]={'$like':'%'+_0x2a3717['query'][_0xb4c6('0x40')]+'%'};return _0x3d7c3f;})});}_0x4b502b=_[_0xb4c6('0x41')]({},_0x4b502b,_0x2a3717['options']);return _0x2131aa[_0xb4c6('0x88')](_0x4b502b);}})[_0xb4c6('0x2a')](function(_0x31f380){if(_0x31f380){_0x4d5f71=_0x31f380[_0xb4c6('0x4a')];if(!_0x2a3717['query']['hasOwnProperty'](_0xb4c6('0x3a'))){_0x4b502b[_0xb4c6('0x3b')]=qs[_0xb4c6('0x3b')](_0x2a3717[_0xb4c6('0x34')][_0xb4c6('0x3b')]);_0x4b502b[_0xb4c6('0x23')]=qs['offset'](_0x2a3717[_0xb4c6('0x34')]['offset']);}return _0x2131aa[_0xb4c6('0x88')](_0x4b502b);}})[_0xb4c6('0x2a')](function(_0x7be9b3){if(_0x7be9b3){return _0x7be9b3?{'count':_0x4d5f71,'rows':_0x7be9b3}:null;}})[_0xb4c6('0x2a')](respondWithResult(_0x4c0292,null))[_0xb4c6('0x47')](handleError(_0x4c0292,null));}; \ No newline at end of file +var _0x74cf=['all','union','value','emit','userMailQueue:remove','addAgents','omit','removeAgents','getAgents','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','end','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','MailQueues','UserProfileResource','sendStatus','error','name','send','index','map','MailQueue','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','filters','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','rawAttributes','nolimit','order','MailQueueId','User','findAndCountAll','UserId','agent','createdAt','format','SIP','updatedAt','getTeams','Team','filter','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','UserMailQueue','findOrCreate','forEach','userMailQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_mail_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','includes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74cf,0x126));var _0xf74c=function(_0x305bbf,_0x5647b3){_0x305bbf=_0x305bbf-0x0;var _0x4ed772=_0x74cf[_0x305bbf];return _0x4ed772;};'use strict';var emlformat=require(_0xf74c('0x0'));var rimraf=require(_0xf74c('0x1'));var zipdir=require(_0xf74c('0x2'));var jsonpatch=require(_0xf74c('0x3'));var rp=require(_0xf74c('0x4'));var moment=require(_0xf74c('0x5'));var BPromise=require(_0xf74c('0x6'));var Mustache=require('mustache');var util=require(_0xf74c('0x7'));var path=require(_0xf74c('0x8'));var sox=require(_0xf74c('0x9'));var csv=require(_0xf74c('0xa'));var ejs=require(_0xf74c('0xb'));var fs=require('fs');var fs_extra=require(_0xf74c('0xc'));var _=require(_0xf74c('0xd'));var squel=require('squel');var crypto=require(_0xf74c('0xe'));var jsforce=require(_0xf74c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf74c('0xa'));var querystring=require(_0xf74c('0x10'));var Papa=require(_0xf74c('0x11'));var Redis=require('ioredis');var authService=require(_0xf74c('0x12'));var qs=require(_0xf74c('0x13'));var as=require(_0xf74c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf74c('0x15'))(_0xf74c('0x16'));var utils=require(_0xf74c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf74c('0x18'));var db=require(_0xf74c('0x19'))['db'];config[_0xf74c('0x1a')]=_[_0xf74c('0x1b')](config[_0xf74c('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xf74c('0x1c'))(new Redis(config[_0xf74c('0x1a')]));require(_0xf74c('0x1d'))[_0xf74c('0x1e')](socket);function respondWithStatusCode(_0x421854,_0x12245b){_0x12245b=_0x12245b||0xcc;return function(_0x430341){if(_0x430341){return _0x421854['sendStatus'](_0x12245b);}return _0x421854['status'](_0x12245b)[_0xf74c('0x1f')]();};}function respondWithResult(_0x2a375a,_0x57daa7){_0x57daa7=_0x57daa7||0xc8;return function(_0x5982c7){if(_0x5982c7){return _0x2a375a[_0xf74c('0x20')](_0x57daa7)[_0xf74c('0x21')](_0x5982c7);}};}function respondWithFilteredResult(_0xe22220,_0x54479d){return function(_0x21d28a){if(_0x21d28a){var _0xfa5a7f=typeof _0x54479d[_0xf74c('0x22')]===_0xf74c('0x23')&&typeof _0x54479d['limit']===_0xf74c('0x23');var _0x16ea5b=_0x21d28a['count'];var _0x5aee40=_0xfa5a7f?0x0:_0x54479d[_0xf74c('0x22')];var _0x1a63b0=_0xfa5a7f?_0x21d28a[_0xf74c('0x24')]:_0x54479d[_0xf74c('0x22')]+_0x54479d['limit'];var _0x24709b;if(_0x1a63b0>=_0x16ea5b){_0x1a63b0=_0x16ea5b;_0x24709b=0xc8;}else{_0x24709b=0xce;}_0xe22220[_0xf74c('0x20')](_0x24709b);return _0xe22220[_0xf74c('0x25')](_0xf74c('0x26'),_0x5aee40+'-'+_0x1a63b0+'/'+_0x16ea5b)[_0xf74c('0x21')](_0x21d28a);}return null;};}function patchUpdates(_0x4d67ed){return function(_0x37ce76){try{jsonpatch[_0xf74c('0x27')](_0x37ce76,_0x4d67ed,!![]);}catch(_0xe87eb4){return BPromise['reject'](_0xe87eb4);}return _0x37ce76[_0xf74c('0x28')]();};}function saveUpdates(_0x44a209,_0x1b300f){return function(_0x13049f){if(_0x13049f){return _0x13049f[_0xf74c('0x29')](_0x44a209)[_0xf74c('0x2a')](function(_0xaebdb3){return _0xaebdb3;});}return null;};}function removeEntity(_0x214858,_0x1f5b69){return function(_0x4fd3da){if(_0x4fd3da){return _0x4fd3da[_0xf74c('0x2b')]()[_0xf74c('0x2a')](function(){var _0x52e6a6=_0x4fd3da['get']({'plain':!![]});var _0x4522cd=_0xf74c('0x2c');return db[_0xf74c('0x2d')][_0xf74c('0x2b')]({'where':{'type':_0x4522cd,'resourceId':_0x52e6a6['id']}})[_0xf74c('0x2a')](function(){return _0x4fd3da;});})[_0xf74c('0x2a')](function(){_0x214858[_0xf74c('0x20')](0xcc)[_0xf74c('0x1f')]();});}};}function handleEntityNotFound(_0x3b7ec2,_0x320bfb){return function(_0x305724){if(!_0x305724){_0x3b7ec2[_0xf74c('0x2e')](0x194);}return _0x305724;};}function handleError(_0xa4d6cc,_0x52b070){_0x52b070=_0x52b070||0x1f4;return function(_0x3fad81){logger[_0xf74c('0x2f')](_0x3fad81['stack']);if(_0x3fad81[_0xf74c('0x30')]){delete _0x3fad81['name'];}_0xa4d6cc['status'](_0x52b070)[_0xf74c('0x31')](_0x3fad81);};}exports[_0xf74c('0x32')]=function(_0x3a586d,_0x189c24){var _0x105ce2={},_0x35036b={},_0x2621fe={'count':0x0,'rows':[]};var _0x1d0f24=_[_0xf74c('0x33')](db[_0xf74c('0x34')]['rawAttributes'],function(_0x12befe){return{'name':_0x12befe[_0xf74c('0x35')],'type':_0x12befe[_0xf74c('0x36')]['key']};});_0x35036b[_0xf74c('0x37')]=_['map'](_0x1d0f24,_0xf74c('0x30'));_0x35036b[_0xf74c('0x38')]=_[_0xf74c('0x39')](_0x3a586d[_0xf74c('0x38')]);_0x35036b['filters']=_[_0xf74c('0x3a')](_0x35036b['model'],_0x35036b['query']);_0x105ce2[_0xf74c('0x3b')]=_[_0xf74c('0x3a')](_0x35036b[_0xf74c('0x37')],qs[_0xf74c('0x3c')](_0x3a586d['query'][_0xf74c('0x3c')]));_0x105ce2['attributes']=_0x105ce2[_0xf74c('0x3b')][_0xf74c('0x3d')]?_0x105ce2[_0xf74c('0x3b')]:_0x35036b['model'];if(!_0x3a586d['query'][_0xf74c('0x3e')]('nolimit')){_0x105ce2[_0xf74c('0x3f')]=qs[_0xf74c('0x3f')](_0x3a586d[_0xf74c('0x38')][_0xf74c('0x3f')]);_0x105ce2[_0xf74c('0x22')]=qs['offset'](_0x3a586d[_0xf74c('0x38')][_0xf74c('0x22')]);}_0x105ce2['order']=qs['sort'](_0x3a586d[_0xf74c('0x38')][_0xf74c('0x40')]);_0x105ce2[_0xf74c('0x41')]=qs[_0xf74c('0x42')](_['pick'](_0x3a586d[_0xf74c('0x38')],_0x35036b[_0xf74c('0x42')]),_0x1d0f24);if(_0x3a586d[_0xf74c('0x38')]['filter']){_0x105ce2['where']=_[_0xf74c('0x43')](_0x105ce2['where'],{'$or':_[_0xf74c('0x33')](_0x1d0f24,function(_0x377863){if(_0x377863['type']!==_0xf74c('0x44')){var _0x2cf08a={};_0x2cf08a[_0x377863[_0xf74c('0x30')]]={'$like':'%'+_0x3a586d['query']['filter']+'%'};return _0x2cf08a;}})});}_0x105ce2=_[_0xf74c('0x43')]({},_0x105ce2,_0x3a586d[_0xf74c('0x45')]);var _0x42a5dc={'where':_0x105ce2['where']};return db[_0xf74c('0x34')][_0xf74c('0x24')](_0x42a5dc)[_0xf74c('0x2a')](function(_0x3dbb52){_0x2621fe['count']=_0x3dbb52;if(_0x3a586d['query'][_0xf74c('0x46')]){_0x105ce2['include']=[{'all':!![]}];}return db[_0xf74c('0x34')][_0xf74c('0x47')](_0x105ce2);})[_0xf74c('0x2a')](function(_0x30f15e){_0x2621fe[_0xf74c('0x48')]=_0x30f15e;return _0x2621fe;})['then'](respondWithFilteredResult(_0x189c24,_0x105ce2))[_0xf74c('0x49')](handleError(_0x189c24,null));};exports['show']=function(_0x2365ae,_0x345538){var _0x35c177={'raw':!![],'where':{'id':_0x2365ae[_0xf74c('0x4a')]['id']}},_0xd949b3={};_0xd949b3['model']=_[_0xf74c('0x39')](db['MailQueue']['rawAttributes']);_0xd949b3[_0xf74c('0x38')]=_[_0xf74c('0x39')](_0x2365ae['query']);_0xd949b3[_0xf74c('0x42')]=_[_0xf74c('0x3a')](_0xd949b3[_0xf74c('0x37')],_0xd949b3[_0xf74c('0x38')]);_0x35c177[_0xf74c('0x3b')]=_[_0xf74c('0x3a')](_0xd949b3[_0xf74c('0x37')],qs[_0xf74c('0x3c')](_0x2365ae[_0xf74c('0x38')][_0xf74c('0x3c')]));_0x35c177[_0xf74c('0x3b')]=_0x35c177[_0xf74c('0x3b')][_0xf74c('0x3d')]?_0x35c177[_0xf74c('0x3b')]:_0xd949b3[_0xf74c('0x37')];if(_0x2365ae[_0xf74c('0x38')][_0xf74c('0x46')]){_0x35c177[_0xf74c('0x4b')]=[{'all':!![]}];}_0x35c177=_[_0xf74c('0x43')]({},_0x35c177,_0x2365ae['options']);return db[_0xf74c('0x34')][_0xf74c('0x4c')](_0x35c177)[_0xf74c('0x2a')](handleEntityNotFound(_0x345538,null))[_0xf74c('0x2a')](respondWithResult(_0x345538,null))[_0xf74c('0x49')](handleError(_0x345538,null));};exports['create']=function(_0x3771ef,_0x10f73e){return db['MailQueue'][_0xf74c('0x4d')](_0x3771ef['body'],{})[_0xf74c('0x2a')](function(_0x37d518){var _0x9766df=_0x3771ef['user'][_0xf74c('0x4e')]({'plain':!![]});if(!_0x9766df)throw new Error(_0xf74c('0x4f'));if(_0x9766df[_0xf74c('0x50')]===_0xf74c('0x51')){var _0x208872=_0x37d518[_0xf74c('0x4e')]({'plain':!![]});var _0x46a4f8=_0xf74c('0x2c');return db[_0xf74c('0x52')][_0xf74c('0x4c')]({'where':{'name':_0x46a4f8,'userProfileId':_0x9766df[_0xf74c('0x53')]},'raw':!![]})[_0xf74c('0x2a')](function(_0x498b2c){if(_0x498b2c&&_0x498b2c[_0xf74c('0x54')]===0x0){return db['UserProfileResource'][_0xf74c('0x4d')]({'name':_0x208872['name'],'resourceId':_0x208872['id'],'type':_0x498b2c[_0xf74c('0x30')],'sectionId':_0x498b2c['id']},{})[_0xf74c('0x2a')](function(){return _0x37d518;});}else{return _0x37d518;}})[_0xf74c('0x49')](function(_0x1e4bb3){logger[_0xf74c('0x2f')](_0xf74c('0x55'),_0x1e4bb3);throw _0x1e4bb3;});}return _0x37d518;})[_0xf74c('0x2a')](respondWithResult(_0x10f73e,0xc9))[_0xf74c('0x49')](handleError(_0x10f73e,null));};exports[_0xf74c('0x29')]=function(_0x808ee6,_0x4e42a3){if(_0x808ee6[_0xf74c('0x56')]['id']){delete _0x808ee6['body']['id'];}return db[_0xf74c('0x34')]['find']({'where':{'id':_0x808ee6[_0xf74c('0x4a')]['id']}})[_0xf74c('0x2a')](handleEntityNotFound(_0x4e42a3,null))[_0xf74c('0x2a')](saveUpdates(_0x808ee6[_0xf74c('0x56')],null))['then'](respondWithResult(_0x4e42a3,null))[_0xf74c('0x49')](handleError(_0x4e42a3,null));};exports[_0xf74c('0x2b')]=function(_0x3eed75,_0xf5b321){return db[_0xf74c('0x34')][_0xf74c('0x4c')]({'where':{'id':_0x3eed75[_0xf74c('0x4a')]['id']}})['then'](handleEntityNotFound(_0xf5b321,null))['then'](removeEntity(_0xf5b321,null))[_0xf74c('0x49')](handleError(_0xf5b321,null));};exports[_0xf74c('0x57')]=function(_0x2b8cbc,_0x2d919d){return db[_0xf74c('0x34')][_0xf74c('0x57')]()['then'](respondWithResult(_0x2d919d,null))[_0xf74c('0x49')](handleError(_0x2d919d,null));};exports[_0xf74c('0x58')]=function(_0x46ea93,_0x4b193c,_0x5b9eff){var _0xa3b073={'raw':!![],'where':{}},_0x31a54e={},_0x2191cf;return db[_0xf74c('0x34')][_0xf74c('0x59')]({'where':{'id':_0x46ea93[_0xf74c('0x4a')]['id']}})[_0xf74c('0x2a')](handleEntityNotFound(_0x4b193c,null))[_0xf74c('0x2a')](function(_0x327fb6){if(_0x327fb6){_0x2191cf=_0x327fb6['get']({'plain':!![]});_0x31a54e['model']=_[_0xf74c('0x39')](db['UserMailQueue'][_0xf74c('0x5a')]);_0x31a54e['query']=_['keys'](_0x46ea93[_0xf74c('0x38')]);_0x31a54e[_0xf74c('0x42')]=_[_0xf74c('0x3a')](_0x31a54e[_0xf74c('0x37')],_0x31a54e['query']);_0xa3b073['attributes']=_[_0xf74c('0x3a')](_0x31a54e[_0xf74c('0x37')],qs[_0xf74c('0x3c')](_0x46ea93[_0xf74c('0x38')]['fields']));_0xa3b073[_0xf74c('0x3b')]=_0xa3b073[_0xf74c('0x3b')][_0xf74c('0x3d')]?_0xa3b073[_0xf74c('0x3b')]:_0x31a54e[_0xf74c('0x37')];if(!_0x46ea93[_0xf74c('0x38')][_0xf74c('0x3e')](_0xf74c('0x5b'))){_0xa3b073[_0xf74c('0x3f')]=qs['limit'](_0x46ea93[_0xf74c('0x38')][_0xf74c('0x3f')]);_0xa3b073['offset']=qs[_0xf74c('0x22')](_0x46ea93[_0xf74c('0x38')][_0xf74c('0x22')]);}_0xa3b073[_0xf74c('0x5c')]=qs[_0xf74c('0x40')](_0x46ea93['query'][_0xf74c('0x40')]);_0xa3b073[_0xf74c('0x41')]=qs[_0xf74c('0x42')](_['pick'](_0x46ea93[_0xf74c('0x38')],_0x31a54e['filters']));_0xa3b073[_0xf74c('0x41')][_0xf74c('0x5d')]=_0x327fb6['id'];if(_0x46ea93['query']['filter']){_0xa3b073[_0xf74c('0x41')]=_['merge'](_0xa3b073['where'],{'$or':_['map'](_0xa3b073[_0xf74c('0x3b')],function(_0x34ab4d){var _0x595a02={};_0x595a02[_0x34ab4d]={'$like':'%'+_0x46ea93[_0xf74c('0x38')]['filter']+'%'};return _0x595a02;})});}_0xa3b073=_[_0xf74c('0x43')]({},_0xa3b073,_0x46ea93[_0xf74c('0x45')]);return db['UserMailQueue'][_0xf74c('0x47')](_0xa3b073);}})[_0xf74c('0x2a')](function(_0x345da4){if(_0x345da4){return db[_0xf74c('0x5e')][_0xf74c('0x5f')]({'where':{'id':_[_0xf74c('0x33')](_0x345da4,_0xf74c('0x60')),'role':_0xf74c('0x61')},'attributes':['id',_0xf74c('0x30'),'mailPause','updatedAt',_0xf74c('0x62')]});}})[_0xf74c('0x2a')](function(_0x32d81f){if(_0x32d81f){return{'count':_0x32d81f['count'],'rows':_[_0xf74c('0x33')](_0x32d81f[_0xf74c('0x48')],function(_0x38fb25){return{'membername':_0x38fb25['name'],'UserId':_0x38fb25['id'],'queue_name':_0x2191cf[_0xf74c('0x30')],'MailQueueId':_0x2191cf['id'],'interface':util[_0xf74c('0x63')]('%s/%s',_0xf74c('0x64'),_0x38fb25[_0xf74c('0x30')]),'penalty':0x0,'paused':_0x38fb25['mailPause'],'createdAt':_0x38fb25['createdAt'],'updatedAt':_0x38fb25[_0xf74c('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4b193c,_0xa3b073))['catch'](handleError(_0x4b193c,null));};exports[_0xf74c('0x66')]=function(_0x4ae6c4,_0x3b30ef,_0x214adf){var _0x20ba88={};var _0x4fbf17={};var _0x2c8766;var _0x1fcf07;return db['MailQueue'][_0xf74c('0x59')]({'where':{'id':_0x4ae6c4[_0xf74c('0x4a')]['id']}})[_0xf74c('0x2a')](handleEntityNotFound(_0x3b30ef,null))[_0xf74c('0x2a')](function(_0x4012cb){if(_0x4012cb){_0x2c8766=_0x4012cb;_0x4fbf17['model']=_[_0xf74c('0x39')](db[_0xf74c('0x67')]['rawAttributes']);_0x4fbf17[_0xf74c('0x38')]=_[_0xf74c('0x39')](_0x4ae6c4[_0xf74c('0x38')]);_0x4fbf17[_0xf74c('0x42')]=_[_0xf74c('0x3a')](_0x4fbf17[_0xf74c('0x37')],_0x4fbf17[_0xf74c('0x38')]);_0x20ba88['attributes']=_[_0xf74c('0x3a')](_0x4fbf17[_0xf74c('0x37')],qs[_0xf74c('0x3c')](_0x4ae6c4[_0xf74c('0x38')][_0xf74c('0x3c')]));_0x20ba88[_0xf74c('0x3b')]=_0x20ba88[_0xf74c('0x3b')][_0xf74c('0x3d')]?_0x20ba88[_0xf74c('0x3b')]:_0x4fbf17[_0xf74c('0x37')];_0x20ba88[_0xf74c('0x5c')]=qs[_0xf74c('0x40')](_0x4ae6c4['query'][_0xf74c('0x40')]);_0x20ba88[_0xf74c('0x41')]=qs[_0xf74c('0x42')](_['pick'](_0x4ae6c4[_0xf74c('0x38')],_0x4fbf17[_0xf74c('0x42')]));if(_0x4ae6c4['query'][_0xf74c('0x68')]){_0x20ba88[_0xf74c('0x41')]=_[_0xf74c('0x43')](_0x20ba88[_0xf74c('0x41')],{'$or':_[_0xf74c('0x33')](_0x20ba88[_0xf74c('0x3b')],function(_0x44bf13){var _0x11054e={};_0x11054e[_0x44bf13]={'$like':'%'+_0x4ae6c4[_0xf74c('0x38')][_0xf74c('0x68')]+'%'};return _0x11054e;})});}_0x20ba88=_[_0xf74c('0x43')]({},_0x20ba88,_0x4ae6c4['options']);return _0x2c8766[_0xf74c('0x66')](_0x20ba88);}})[_0xf74c('0x2a')](function(_0x1311c0){if(_0x1311c0){_0x1fcf07=_0x1311c0[_0xf74c('0x3d')];if(!_0x4ae6c4[_0xf74c('0x38')]['hasOwnProperty'](_0xf74c('0x5b'))){_0x20ba88[_0xf74c('0x3f')]=qs['limit'](_0x4ae6c4[_0xf74c('0x38')][_0xf74c('0x3f')]);_0x20ba88['offset']=qs['offset'](_0x4ae6c4[_0xf74c('0x38')]['offset']);}return _0x2c8766[_0xf74c('0x66')](_0x20ba88);}})[_0xf74c('0x2a')](function(_0x5c7425){if(_0x5c7425){return _0x5c7425?{'count':_0x1fcf07,'rows':_0x5c7425}:null;}})['then'](respondWithResult(_0x3b30ef,null))['catch'](handleError(_0x3b30ef,null));};exports['addTeams']=function(_0x3575f6,_0x31e21d,_0x47230d){var _0x31d3ab=_0x3575f6[_0xf74c('0x56')]['ids'];return db[_0xf74c('0x67')]['findAll']({'where':{'id':_0x31d3ab},'attributes':['id'],'include':[{'model':db[_0xf74c('0x5e')],'as':_0xf74c('0x69'),'attributes':['id',_0xf74c('0x30'),_0xf74c('0x6a'),_0xf74c('0x6b'),_0xf74c('0x6c')],'raw':!![]}]})[_0xf74c('0x2a')](function(_0x549520){if(_0x549520){var _0x529bc9=_['flatMap'](_0x549520,function(_0x39381f){var _0xaa0492=_0x39381f['get']({'plain':!![]});return _0xaa0492[_0xf74c('0x69')];});return db[_0xf74c('0x34')][_0xf74c('0x4c')]({'where':{'id':_0x3575f6['params']['id']}})[_0xf74c('0x2a')](function(_0x5960ac){return db[_0xf74c('0x6d')][_0xf74c('0x6e')](function(_0x218415){return _0x5960ac[_0xf74c('0x6f')](_0x31d3ab,{'transaction':_0x218415})[_0xf74c('0x2a')](function(){return BPromise[_0xf74c('0x70')](_0x529bc9,function(_0x1c9092){return db[_0xf74c('0x71')][_0xf74c('0x72')]({'where':{'UserId':_0x1c9092['id'],'MailQueueId':_0x3575f6['params']['id']},'transaction':_0x218415});});})[_0xf74c('0x2a')](function(){_0x529bc9[_0xf74c('0x73')](function(_0x387d3d){socket['emit'](_0xf74c('0x74'),{'UserId':_0x387d3d['id'],'MailQueueId':_0x5960ac['id']});});});});});}})[_0xf74c('0x2a')](respondWithStatusCode(_0x31e21d,null))[_0xf74c('0x49')](handleError(_0x31e21d,null));};exports[_0xf74c('0x75')]=function(_0x3b8f0e,_0x38bb5d,_0x2fde20){return db[_0xf74c('0x67')][_0xf74c('0x47')]({'where':{'id':_0x3b8f0e[_0xf74c('0x38')][_0xf74c('0x76')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf74c('0x2a')](handleEntityNotFound(_0x38bb5d,null))['then'](function(_0x3a12d5){var _0x3c26eb=_['map'](_0x3a12d5,'id');var _0x5ab0e7=[];var _0x62343e=[];var _0x584ce9=squel[_0xf74c('0x77')]();_0x584ce9['field'](_0xf74c('0x78'))[_0xf74c('0x79')](_0xf74c('0x7a'),'tq')['join'](_0xf74c('0x7b'),'ut',_0xf74c('0x7c'))[_0xf74c('0x41')](_0xf74c('0x7d'),_0x3b8f0e[_0xf74c('0x4a')]['id']);for(var _0x38c835=0x0;_0x38c835<_0x3a12d5['length'];_0x38c835+=0x1){let _0x1fa499=_0x3a12d5[_0x38c835];for(var _0x24e85a=0x0;_0x24e85a<_0x1fa499['Agents'][_0xf74c('0x3d')];_0x24e85a+=0x1){let _0x2d0d15=_0x1fa499[_0xf74c('0x69')][_0x24e85a];var _0x26e2f7=_0x584ce9[_0xf74c('0x7e')]();_0x26e2f7[_0xf74c('0x41')](_0xf74c('0x7f'),_0x2d0d15['id']);_0x62343e['push'](db[_0xf74c('0x6d')]['query'](_0x26e2f7[_0xf74c('0x80')](),{'type':db[_0xf74c('0x6d')][_0xf74c('0x81')]['SELECT']})[_0xf74c('0x2a')](function(_0x38c203){if(_0x38c203[_0xf74c('0x3d')]===0x1){return _0x2d0d15['id'];}else{var _0x53b565=_[_0xf74c('0x82')](_['map'](_0x38c203,'TeamId'),function(_0x2c3ba8){return _[_0xf74c('0x83')](_0x3c26eb,_0x2c3ba8);});if(_0x53b565){return _0x2d0d15['id'];}}}));}}return BPromise[_0xf74c('0x84')](_0x62343e)[_0xf74c('0x2a')](function(_0x2dc03c){_0x5ab0e7=_(_0x5ab0e7)[_0xf74c('0x85')](_0x2dc03c)['compact']()[_0xf74c('0x86')]();return db[_0xf74c('0x34')][_0xf74c('0x4c')]({'where':{'id':_0x3b8f0e[_0xf74c('0x4a')]['id']}})[_0xf74c('0x2a')](function(_0x2b8769){return db['sequelize'][_0xf74c('0x6e')](function(_0x2d0ad0){return _0x2b8769[_0xf74c('0x75')](_0x3b8f0e[_0xf74c('0x38')][_0xf74c('0x76')],{'transaction':_0x2d0ad0})[_0xf74c('0x2a')](function(){if(!_['isEmpty'](_0x5ab0e7)){return _0x2b8769['removeAgents'](_0x5ab0e7,{'transaction':_0x2d0ad0});}})[_0xf74c('0x2a')](function(){_0x5ab0e7[_0xf74c('0x73')](function(_0x5793ae){socket[_0xf74c('0x87')](_0xf74c('0x88'),{'UserId':_0x5793ae,'MailQueueId':_0x2b8769['id']});});});});});});})[_0xf74c('0x2a')](respondWithStatusCode(_0x38bb5d,null))['catch'](handleError(_0x38bb5d,null));};exports[_0xf74c('0x89')]=function(_0x5292d8,_0x119783,_0x335e85){return db[_0xf74c('0x34')]['find']({'where':{'id':_0x5292d8[_0xf74c('0x4a')]['id']}})[_0xf74c('0x2a')](handleEntityNotFound(_0x119783,null))['then'](function(_0x4e3cf2){if(_0x4e3cf2){return _0x4e3cf2[_0xf74c('0x89')](_0x5292d8[_0xf74c('0x56')]['ids'],_[_0xf74c('0x8a')](_0x5292d8[_0xf74c('0x56')],['ids','id'])||{})['spread'](function(_0x107f3c){for(var _0x3fc7aa=0x0;_0x3fc7aa<_0x5292d8[_0xf74c('0x56')]['ids'][_0xf74c('0x3d')];_0x3fc7aa+=0x1){socket[_0xf74c('0x87')]('userMailQueue:save',{'UserId':Number(_0x5292d8['body'][_0xf74c('0x76')][_0x3fc7aa]),'MailQueueId':Number(_0x5292d8[_0xf74c('0x4a')]['id'])});}return _0x107f3c;});}})['then'](respondWithResult(_0x119783,null))['catch'](handleError(_0x119783,null));};exports[_0xf74c('0x8b')]=function(_0xce913f,_0x113727,_0x16f9cc){return db[_0xf74c('0x34')][_0xf74c('0x4c')]({'where':{'id':_0xce913f['params']['id']}})[_0xf74c('0x2a')](handleEntityNotFound(_0x113727,null))['then'](function(_0x524b32){if(_0x524b32){return _0x524b32['removeAgents'](_0xce913f[_0xf74c('0x38')][_0xf74c('0x76')])[_0xf74c('0x2a')](function(){if(_['isArray'](_0xce913f['query'][_0xf74c('0x76')])){for(var _0x122641=0x0;_0x122641<_0xce913f['query'][_0xf74c('0x76')][_0xf74c('0x3d')];_0x122641+=0x1){socket[_0xf74c('0x87')](_0xf74c('0x88'),{'UserId':Number(_0xce913f[_0xf74c('0x38')][_0xf74c('0x76')][_0x122641]),'MailQueueId':Number(_0xce913f[_0xf74c('0x4a')]['id'])});}}else{socket[_0xf74c('0x87')]('userMailQueue:remove',{'UserId':Number(_0xce913f[_0xf74c('0x38')][_0xf74c('0x76')]),'MailQueueId':Number(_0xce913f[_0xf74c('0x4a')]['id'])});}});}})[_0xf74c('0x2a')](respondWithStatusCode(_0x113727,null))[_0xf74c('0x49')](handleError(_0x113727,null));};exports[_0xf74c('0x8c')]=function(_0x3b94d8,_0x5bfa09,_0x379acf){var _0x288639={};var _0x209f20={};var _0x4dc4ff;var _0x2ecfcd;return db[_0xf74c('0x34')]['findOne']({'where':{'id':_0x3b94d8['params']['id']}})[_0xf74c('0x2a')](handleEntityNotFound(_0x5bfa09,null))[_0xf74c('0x2a')](function(_0x19093d){if(_0x19093d){_0x4dc4ff=_0x19093d;_0x209f20[_0xf74c('0x37')]=_[_0xf74c('0x39')](db[_0xf74c('0x5e')][_0xf74c('0x5a')]);_0x209f20['query']=_['keys'](_0x3b94d8[_0xf74c('0x38')]);_0x209f20[_0xf74c('0x42')]=_['intersection'](_0x209f20[_0xf74c('0x37')],_0x209f20[_0xf74c('0x38')]);_0x288639[_0xf74c('0x3b')]=_[_0xf74c('0x3a')](_0x209f20['model'],qs[_0xf74c('0x3c')](_0x3b94d8['query'][_0xf74c('0x3c')]));_0x288639['attributes']=_0x288639[_0xf74c('0x3b')]['length']?_0x288639[_0xf74c('0x3b')]:_0x209f20['model'];_0x288639[_0xf74c('0x5c')]=qs[_0xf74c('0x40')](_0x3b94d8['query'][_0xf74c('0x40')]);_0x288639[_0xf74c('0x41')]=qs[_0xf74c('0x42')](_[_0xf74c('0x8d')](_0x3b94d8[_0xf74c('0x38')],_0x209f20[_0xf74c('0x42')]));if(_0x3b94d8[_0xf74c('0x38')][_0xf74c('0x68')]){_0x288639['where']=_[_0xf74c('0x43')](_0x288639['where'],{'$or':_[_0xf74c('0x33')](_0x288639[_0xf74c('0x3b')],function(_0x17fa19){var _0x39736c={};_0x39736c[_0x17fa19]={'$like':'%'+_0x3b94d8[_0xf74c('0x38')]['filter']+'%'};return _0x39736c;})});}_0x288639=_[_0xf74c('0x43')]({},_0x288639,_0x3b94d8[_0xf74c('0x45')]);return _0x4dc4ff[_0xf74c('0x8c')](_0x288639);}})[_0xf74c('0x2a')](function(_0x512241){if(_0x512241){_0x2ecfcd=_0x512241[_0xf74c('0x3d')];if(!_0x3b94d8['query'][_0xf74c('0x3e')](_0xf74c('0x5b'))){_0x288639['limit']=qs[_0xf74c('0x3f')](_0x3b94d8[_0xf74c('0x38')][_0xf74c('0x3f')]);_0x288639[_0xf74c('0x22')]=qs[_0xf74c('0x22')](_0x3b94d8['query'][_0xf74c('0x22')]);}return _0x4dc4ff['getAgents'](_0x288639);}})[_0xf74c('0x2a')](function(_0x2ccc62){if(_0x2ccc62){return _0x2ccc62?{'count':_0x2ecfcd,'rows':_0x2ccc62}:null;}})[_0xf74c('0x2a')](respondWithResult(_0x5bfa09,null))[_0xf74c('0x49')](handleError(_0x5bfa09,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index c9274ae..b1c346e 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 _0x991c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','update','remove'];(function(_0x3d7408,_0x50078f){var _0x208925=function(_0x5e3e06){while(--_0x5e3e06){_0x3d7408['push'](_0x3d7408['shift']());}};_0x208925(++_0x50078f);}(_0x991c,0xd6));var _0xc991=function(_0x56b7fe,_0x2e2157){_0x56b7fe=_0x56b7fe-0x0;var _0x1b9a85=_0x991c[_0x56b7fe];return _0x1b9a85;};'use strict';var EventEmitter=require(_0xc991('0x0'));var MailQueue=require(_0xc991('0x1'))['db'][_0xc991('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xc991('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc991('0x4'),'afterDestroy':_0xc991('0x5')};function emitEvent(_0x1ef242){return function(_0x7104a0,_0x4ad557,_0x43b17e){MailQueueEvents[_0xc991('0x6')](_0x1ef242+':'+_0x7104a0['id'],_0x7104a0);MailQueueEvents[_0xc991('0x6')](_0x1ef242,_0x7104a0);_0x43b17e(null);};}for(var e in events){if(events[_0xc991('0x7')](e)){var event=events[e];MailQueue[_0xc991('0x8')](e,emitEvent(event));}}module[_0xc991('0x9')]=MailQueueEvents; \ No newline at end of file +var _0xf04d=['emit','hook','exports','../../mysqldb','MailQueue','setMaxListeners','update'];(function(_0x5de6c7,_0x512101){var _0x1b591d=function(_0x296bf4){while(--_0x296bf4){_0x5de6c7['push'](_0x5de6c7['shift']());}};_0x1b591d(++_0x512101);}(_0xf04d,0x161));var _0xdf04=function(_0x4eb6ec,_0x7f2520){_0x4eb6ec=_0x4eb6ec-0x0;var _0x58881b=_0xf04d[_0x4eb6ec];return _0x58881b;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xdf04('0x0'))['db'][_0xdf04('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xdf04('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdf04('0x3'),'afterDestroy':'remove'};function emitEvent(_0xdc241a){return function(_0xf1a3b,_0xe9ccbd,_0x4414dd){MailQueueEvents[_0xdf04('0x4')](_0xdc241a+':'+_0xf1a3b['id'],_0xf1a3b);MailQueueEvents[_0xdf04('0x4')](_0xdc241a,_0xf1a3b);_0x4414dd(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xdf04('0x5')](e,emitEvent(event));}}module[_0xdf04('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 a309f35..a9826b4 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 _0x6aa7=['../../config/logger','api','path','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','util'];(function(_0x6efba,_0x14ac01){var _0x1c5526=function(_0x312f8f){while(--_0x312f8f){_0x6efba['push'](_0x6efba['shift']());}};_0x1c5526(++_0x14ac01);}(_0x6aa7,0xf8));var _0x76aa=function(_0x146caa,_0x388796){_0x146caa=_0x146caa-0x0;var _0x423960=_0x6aa7[_0x146caa];return _0x423960;};'use strict';var _=require(_0x76aa('0x0'));var util=require(_0x76aa('0x1'));var logger=require(_0x76aa('0x2'))(_0x76aa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x4'));var rimraf=require('rimraf');var config=require(_0x76aa('0x5'));var attributes=require(_0x76aa('0x6'));module[_0x76aa('0x7')]=function(_0x1aa2b6,_0x425b14){return _0x1aa2b6['define'](_0x76aa('0x8'),attributes,{'tableName':_0x76aa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b8b=['request-promise','path','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','../../config/logger','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0b8b,0xd9));var _0xb0b8=function(_0x326b5f,_0x18fac6){_0x326b5f=_0x326b5f-0x0;var _0x5bc65a=_0x0b8b[_0x326b5f];return _0x5bc65a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb0b8('0x0'))('api');var moment=require(_0xb0b8('0x1'));var BPromise=require(_0xb0b8('0x2'));var rp=require(_0xb0b8('0x3'));var fs=require('fs');var path=require(_0xb0b8('0x4'));var rimraf=require('rimraf');var config=require(_0xb0b8('0x5'));var attributes=require(_0xb0b8('0x6'));module[_0xb0b8('0x7')]=function(_0x5e1b6c,_0x3b58c8){return _0x5e1b6c['define'](_0xb0b8('0x8'),attributes,{'tableName':_0xb0b8('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 b140b9e..cad16dd 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 _0x8fe0=['debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','findAll','options','limit','include','map','model','attributes','ShowMailQueue','MailQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3021bc,_0x5cd68d){var _0x185e8f=function(_0x4eed08){while(--_0x4eed08){_0x3021bc['push'](_0x3021bc['shift']());}};_0x185e8f(++_0x5cd68d);}(_0x8fe0,0x1ab));var _0x08fe=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x8fe0[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x08fe('0x0'));var util=require(_0x08fe('0x1'));var moment=require(_0x08fe('0x2'));var BPromise=require(_0x08fe('0x3'));var rs=require(_0x08fe('0x4'));var fs=require('fs');var Redis=require(_0x08fe('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x08fe('0x6'));var logger=require(_0x08fe('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x08fe('0x8'));var client=jayson[_0x08fe('0x9')]['http']({'port':0x232a});config[_0x08fe('0xa')]=_[_0x08fe('0xb')](config[_0x08fe('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')[_0x08fe('0xc')](socket);function respondWithRpcPromise(_0x1db01a,_0x429b3f,_0x1a7f22){return new BPromise(function(_0x3f31d6,_0x43c019){return client['request'](_0x1db01a,_0x1a7f22)[_0x08fe('0xd')](function(_0x1b59b2){logger[_0x08fe('0xe')](_0x08fe('0xf'),_0x429b3f,_0x08fe('0x10'));logger[_0x08fe('0x11')](_0x08fe('0x12'),_0x429b3f,'request\x20sent',JSON[_0x08fe('0x13')](_0x1b59b2));if(_0x1b59b2['error']){if(_0x1b59b2[_0x08fe('0x14')][_0x08fe('0x15')]===0x1f4){logger['error'](_0x08fe('0xf'),_0x429b3f,_0x1b59b2[_0x08fe('0x14')][_0x08fe('0x16')]);return _0x43c019(_0x1b59b2['error'][_0x08fe('0x16')]);}logger[_0x08fe('0x14')]('MailQueue,\x20%s,\x20%s',_0x429b3f,_0x1b59b2[_0x08fe('0x14')][_0x08fe('0x16')]);return _0x3f31d6(_0x1b59b2[_0x08fe('0x14')][_0x08fe('0x16')]);}else{logger[_0x08fe('0xe')](_0x08fe('0xf'),_0x429b3f,'request\x20sent');_0x3f31d6(_0x1b59b2[_0x08fe('0x17')][_0x08fe('0x16')]);}})[_0x08fe('0x18')](function(_0x227f2f){logger[_0x08fe('0x14')](_0x08fe('0xf'),_0x429b3f,_0x227f2f);_0x43c019(_0x227f2f);});});}exports[_0x08fe('0x19')]=function(_0x3a0a9d){var _0x45e30c=this;return new Promise(function(_0x1fe693,_0x228dec){return db['MailQueue'][_0x08fe('0x1a')]({'raw':_0x3a0a9d['options']?_0x3a0a9d[_0x08fe('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3a0a9d[_0x08fe('0x1b')]?_0x3a0a9d['options']['where']||null:null,'attributes':_0x3a0a9d['options']?_0x3a0a9d[_0x08fe('0x1b')]['attributes']||null:null,'limit':_0x3a0a9d[_0x08fe('0x1b')]?_0x3a0a9d[_0x08fe('0x1b')][_0x08fe('0x1c')]||null:null,'include':_0x3a0a9d[_0x08fe('0x1b')]?_0x3a0a9d['options'][_0x08fe('0x1d')]?_[_0x08fe('0x1e')](_0x3a0a9d['options']['include'],function(_0x392d4e){return{'model':db[_0x392d4e[_0x08fe('0x1f')]],'as':_0x392d4e['as'],'attributes':_0x392d4e[_0x08fe('0x20')],'include':_0x392d4e[_0x08fe('0x1d')]?_[_0x08fe('0x1e')](_0x392d4e[_0x08fe('0x1d')],function(_0x465813){return{'model':db[_0x465813[_0x08fe('0x1f')]],'as':_0x465813['as'],'attributes':_0x465813['attributes'],'include':_0x465813['include']?_[_0x08fe('0x1e')](_0x465813[_0x08fe('0x1d')],function(_0x24da8a){return{'model':db[_0x24da8a[_0x08fe('0x1f')]],'as':_0x24da8a['as'],'attributes':_0x24da8a[_0x08fe('0x20')]};}):[]};}):[]};}):[]:[]})[_0x08fe('0xd')](function(_0x57aca5){logger[_0x08fe('0xe')](_0x08fe('0x19'),_0x3a0a9d);logger[_0x08fe('0x11')]('GetMailQueue',_0x3a0a9d,JSON[_0x08fe('0x13')](_0x57aca5));_0x1fe693(_0x57aca5);})[_0x08fe('0x18')](function(_0xd60f1f){logger['error'](_0x08fe('0x19'),_0xd60f1f[_0x08fe('0x16')],_0x3a0a9d);_0x228dec(_0x45e30c[_0x08fe('0x14')](0x1f4,_0xd60f1f['message']));});});};exports[_0x08fe('0x21')]=function(_0x53ed35){var _0x4e9d44=this;return new Promise(function(_0x3a46c1,_0x25bf51){return db[_0x08fe('0x22')][_0x08fe('0x23')]({'raw':_0x53ed35[_0x08fe('0x1b')]?_0x53ed35[_0x08fe('0x1b')][_0x08fe('0x24')]===undefined?!![]:![]:!![],'where':_0x53ed35[_0x08fe('0x1b')]?_0x53ed35[_0x08fe('0x1b')]['where']||null:null,'attributes':_0x53ed35[_0x08fe('0x1b')]?_0x53ed35['options'][_0x08fe('0x20')]||null:null,'include':_0x53ed35[_0x08fe('0x1b')]?_0x53ed35[_0x08fe('0x1b')][_0x08fe('0x1d')]?_[_0x08fe('0x1e')](_0x53ed35[_0x08fe('0x1b')][_0x08fe('0x1d')],function(_0x3ccb89){return{'model':db[_0x3ccb89['model']],'as':_0x3ccb89['as'],'attributes':_0x3ccb89[_0x08fe('0x20')],'include':_0x3ccb89[_0x08fe('0x1d')]?_[_0x08fe('0x1e')](_0x3ccb89[_0x08fe('0x1d')],function(_0x53d80f){return{'model':db[_0x53d80f[_0x08fe('0x1f')]],'as':_0x53d80f['as'],'attributes':_0x53d80f[_0x08fe('0x20')],'include':_0x53d80f[_0x08fe('0x1d')]?_['map'](_0x53d80f[_0x08fe('0x1d')],function(_0x3a7e33){return{'model':db[_0x3a7e33[_0x08fe('0x1f')]],'as':_0x3a7e33['as'],'attributes':_0x3a7e33['attributes']};}):[]};}):[]};}):[]:[]})[_0x08fe('0xd')](function(_0x6da7d6){logger[_0x08fe('0xe')](_0x08fe('0x21'),_0x53ed35);logger['debug'](_0x08fe('0x21'),_0x53ed35,JSON[_0x08fe('0x13')](_0x6da7d6));_0x3a46c1(_0x6da7d6);})[_0x08fe('0x18')](function(_0x1a575b){logger[_0x08fe('0x14')](_0x08fe('0x21'),_0x1a575b[_0x08fe('0x16')],_0x53ed35);_0x25bf51(_0x4e9d44[_0x08fe('0x14')](0x1f4,_0x1a575b[_0x08fe('0x16')]));});});}; \ No newline at end of file +var _0xcee5=['result','catch','GetMailQueue','MailQueue','options','where','attributes','limit','include','model','map','debug','stringify','ShowMailQueue','find','raw','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','error','code','MailQueue,\x20%s,\x20%s','message'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xcee5,0xd3));var _0x5cee=function(_0x3971ef,_0xfccb82){_0x3971ef=_0x3971ef-0x0;var _0x9312c9=_0xcee5[_0x3971ef];return _0x9312c9;};'use strict';var _=require(_0x5cee('0x0'));var util=require(_0x5cee('0x1'));var moment=require('moment');var BPromise=require(_0x5cee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5cee('0x3'))['db'];var utils=require(_0x5cee('0x4'));var logger=require(_0x5cee('0x5'))('rpc');var config=require(_0x5cee('0x6'));var jayson=require(_0x5cee('0x7'));var client=jayson[_0x5cee('0x8')][_0x5cee('0x9')]({'port':0x232a});config[_0x5cee('0xa')]=_['defaults'](config[_0x5cee('0xa')],{'host':_0x5cee('0xb'),'port':0x18eb});var socket=require(_0x5cee('0xc'))(new Redis(config[_0x5cee('0xa')]));require('./mailQueue.socket')[_0x5cee('0xd')](socket);function respondWithRpcPromise(_0x7dafb3,_0x3d7c6d,_0x204a03){return new BPromise(function(_0x2643a1,_0x333760){return client[_0x5cee('0xe')](_0x7dafb3,_0x204a03)[_0x5cee('0xf')](function(_0x549339){logger[_0x5cee('0x10')]('MailQueue,\x20%s,\x20%s',_0x3d7c6d,_0x5cee('0x11'));logger['debug'](_0x5cee('0x12'),_0x3d7c6d,'request\x20sent',JSON['stringify'](_0x549339));if(_0x549339['error']){if(_0x549339[_0x5cee('0x13')][_0x5cee('0x14')]===0x1f4){logger[_0x5cee('0x13')](_0x5cee('0x15'),_0x3d7c6d,_0x549339['error'][_0x5cee('0x16')]);return _0x333760(_0x549339[_0x5cee('0x13')][_0x5cee('0x16')]);}logger[_0x5cee('0x13')]('MailQueue,\x20%s,\x20%s',_0x3d7c6d,_0x549339['error'][_0x5cee('0x16')]);return _0x2643a1(_0x549339[_0x5cee('0x13')]['message']);}else{logger['info'](_0x5cee('0x15'),_0x3d7c6d,'request\x20sent');_0x2643a1(_0x549339[_0x5cee('0x17')][_0x5cee('0x16')]);}})[_0x5cee('0x18')](function(_0xe133ed){logger[_0x5cee('0x13')](_0x5cee('0x15'),_0x3d7c6d,_0xe133ed);_0x333760(_0xe133ed);});});}exports[_0x5cee('0x19')]=function(_0x42c0d6){var _0x5f1192=this;return new Promise(function(_0x42340b,_0x3ed92d){return db[_0x5cee('0x1a')]['findAll']({'raw':_0x42c0d6['options']?_0x42c0d6[_0x5cee('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x42c0d6['options']?_0x42c0d6[_0x5cee('0x1b')][_0x5cee('0x1c')]||null:null,'attributes':_0x42c0d6[_0x5cee('0x1b')]?_0x42c0d6[_0x5cee('0x1b')][_0x5cee('0x1d')]||null:null,'limit':_0x42c0d6[_0x5cee('0x1b')]?_0x42c0d6[_0x5cee('0x1b')][_0x5cee('0x1e')]||null:null,'include':_0x42c0d6[_0x5cee('0x1b')]?_0x42c0d6[_0x5cee('0x1b')][_0x5cee('0x1f')]?_['map'](_0x42c0d6[_0x5cee('0x1b')][_0x5cee('0x1f')],function(_0x23bd65){return{'model':db[_0x23bd65[_0x5cee('0x20')]],'as':_0x23bd65['as'],'attributes':_0x23bd65[_0x5cee('0x1d')],'include':_0x23bd65['include']?_[_0x5cee('0x21')](_0x23bd65[_0x5cee('0x1f')],function(_0x269f7a){return{'model':db[_0x269f7a['model']],'as':_0x269f7a['as'],'attributes':_0x269f7a[_0x5cee('0x1d')],'include':_0x269f7a[_0x5cee('0x1f')]?_[_0x5cee('0x21')](_0x269f7a['include'],function(_0x5ce048){return{'model':db[_0x5ce048[_0x5cee('0x20')]],'as':_0x5ce048['as'],'attributes':_0x5ce048['attributes']};}):[]};}):[]};}):[]:[]})[_0x5cee('0xf')](function(_0x2a2bfd){logger[_0x5cee('0x10')](_0x5cee('0x19'),_0x42c0d6);logger[_0x5cee('0x22')](_0x5cee('0x19'),_0x42c0d6,JSON[_0x5cee('0x23')](_0x2a2bfd));_0x42340b(_0x2a2bfd);})[_0x5cee('0x18')](function(_0x3ecd8e){logger[_0x5cee('0x13')](_0x5cee('0x19'),_0x3ecd8e[_0x5cee('0x16')],_0x42c0d6);_0x3ed92d(_0x5f1192[_0x5cee('0x13')](0x1f4,_0x3ecd8e[_0x5cee('0x16')]));});});};exports[_0x5cee('0x24')]=function(_0x46b55a){var _0x4ffdbb=this;return new Promise(function(_0x1fbd51,_0x4b4182){return db[_0x5cee('0x1a')][_0x5cee('0x25')]({'raw':_0x46b55a['options']?_0x46b55a[_0x5cee('0x1b')][_0x5cee('0x26')]===undefined?!![]:![]:!![],'where':_0x46b55a[_0x5cee('0x1b')]?_0x46b55a['options'][_0x5cee('0x1c')]||null:null,'attributes':_0x46b55a[_0x5cee('0x1b')]?_0x46b55a[_0x5cee('0x1b')][_0x5cee('0x1d')]||null:null,'include':_0x46b55a[_0x5cee('0x1b')]?_0x46b55a[_0x5cee('0x1b')]['include']?_[_0x5cee('0x21')](_0x46b55a[_0x5cee('0x1b')][_0x5cee('0x1f')],function(_0x3f24fc){return{'model':db[_0x3f24fc['model']],'as':_0x3f24fc['as'],'attributes':_0x3f24fc[_0x5cee('0x1d')],'include':_0x3f24fc['include']?_[_0x5cee('0x21')](_0x3f24fc[_0x5cee('0x1f')],function(_0x1f293c){return{'model':db[_0x1f293c[_0x5cee('0x20')]],'as':_0x1f293c['as'],'attributes':_0x1f293c[_0x5cee('0x1d')],'include':_0x1f293c['include']?_['map'](_0x1f293c[_0x5cee('0x1f')],function(_0x9564c){return{'model':db[_0x9564c[_0x5cee('0x20')]],'as':_0x9564c['as'],'attributes':_0x9564c[_0x5cee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5cee('0xf')](function(_0x142a9a){logger[_0x5cee('0x10')](_0x5cee('0x24'),_0x46b55a);logger[_0x5cee('0x22')](_0x5cee('0x24'),_0x46b55a,JSON[_0x5cee('0x23')](_0x142a9a));_0x1fbd51(_0x142a9a);})[_0x5cee('0x18')](function(_0x116b97){logger[_0x5cee('0x13')](_0x5cee('0x24'),_0x116b97[_0x5cee('0x16')],_0x46b55a);_0x4b4182(_0x4ffdbb[_0x5cee('0x13')](0x1f4,_0x116b97[_0x5cee('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 643d69d..9b78dfe 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 _0x1186=['removeListener','register','length','./mailQueue.events','save','update'];(function(_0x3f885e,_0x3068ff){var _0x1b1f25=function(_0x5cfe05){while(--_0x5cfe05){_0x3f885e['push'](_0x3f885e['shift']());}};_0x1b1f25(++_0x3068ff);}(_0x1186,0x75));var _0x6118=function(_0xf8a9e1,_0x123fd1){_0xf8a9e1=_0xf8a9e1-0x0;var _0x44101a=_0x1186[_0xf8a9e1];return _0x44101a;};'use strict';var MailQueueEvents=require(_0x6118('0x0'));var events=[_0x6118('0x1'),'remove',_0x6118('0x2')];function createListener(_0x11b288,_0x4cd8a3){return function(_0x432ad3){_0x4cd8a3['emit'](_0x11b288,_0x432ad3);};}function removeListener(_0x51118f,_0x4e189f){return function(){MailQueueEvents[_0x6118('0x3')](_0x51118f,_0x4e189f);};}exports[_0x6118('0x4')]=function(_0x3bc338){for(var _0x20d87f=0x0,_0x5023d1=events[_0x6118('0x5')];_0x20d87f<_0x5023d1;_0x20d87f++){var _0xa75641=events[_0x20d87f];var _0xb312b=createListener('mailQueue:'+_0xa75641,_0x3bc338);MailQueueEvents['on'](_0xa75641,_0xb312b);}}; \ No newline at end of file +var _0xf75b=['length','mailQueue:','./mailQueue.events','save','remove','emit','register'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf75b,0x1e5));var _0xbf75=function(_0x4a69bd,_0x3bd317){_0x4a69bd=_0x4a69bd-0x0;var _0x2e6992=_0xf75b[_0x4a69bd];return _0x2e6992;};'use strict';var MailQueueEvents=require(_0xbf75('0x0'));var events=[_0xbf75('0x1'),_0xbf75('0x2'),'update'];function createListener(_0x4687e9,_0x5c1767){return function(_0x160298){_0x5c1767[_0xbf75('0x3')](_0x4687e9,_0x160298);};}function removeListener(_0x1c9039,_0x4a6477){return function(){MailQueueEvents['removeListener'](_0x1c9039,_0x4a6477);};}exports[_0xbf75('0x4')]=function(_0x5cb079){for(var _0x2227b0=0x0,_0x1d46aa=events[_0xbf75('0x5')];_0x2227b0<_0x1d46aa;_0x2227b0++){var _0x47bd6b=events[_0x2227b0];var _0x39cf5c=createListener(_0xbf75('0x6')+_0x47bd6b,_0x5cb079);MailQueueEvents['on'](_0x47bd6b,_0x39cf5c);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 99128fe..daa9ba9 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 _0xc9e4=['show','post','create','update','delete','path','express','Router','fs-extra','../../components/auth/service','get','index','/:id','isAuthenticated'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xc9e4,0x18d));var _0x4c9e=function(_0x484a60,_0x63e920){_0x484a60=_0x484a60-0x0;var _0x18217b=_0xc9e4[_0x484a60];return _0x18217b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4c9e('0x0'));var timeout=require('connect-timeout');var express=require(_0x4c9e('0x1'));var router=express[_0x4c9e('0x2')]();var fs_extra=require(_0x4c9e('0x3'));var auth=require(_0x4c9e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0x4c9e('0x5')]('/',auth['isAuthenticated'](),controller[_0x4c9e('0x6')]);router[_0x4c9e('0x5')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x4c9e('0x5')](_0x4c9e('0x7'),auth[_0x4c9e('0x8')](),controller[_0x4c9e('0x9')]);router[_0x4c9e('0xa')]('/',auth['isAuthenticated'](),controller[_0x4c9e('0xb')]);router['put']('/:id',auth[_0x4c9e('0x8')](),controller[_0x4c9e('0xc')]);router[_0x4c9e('0xd')]('/:id',auth[_0x4c9e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf9e2=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','show','create','/:id','delete','multer','util'];(function(_0x254190,_0x5e27d5){var _0x56f823=function(_0x11f6cc){while(--_0x11f6cc){_0x254190['push'](_0x254190['shift']());}};_0x56f823(++_0x5e27d5);}(_0xf9e2,0x142));var _0x2f9e=function(_0xb71f2a,_0xec07ee){_0xb71f2a=_0xb71f2a-0x0;var _0x19e952=_0xf9e2[_0xb71f2a];return _0x19e952;};'use strict';var multer=require(_0x2f9e('0x0'));var util=require(_0x2f9e('0x1'));var path=require(_0x2f9e('0x2'));var timeout=require(_0x2f9e('0x3'));var express=require(_0x2f9e('0x4'));var router=express[_0x2f9e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2f9e('0x6'));var interaction=require(_0x2f9e('0x7'));var config=require(_0x2f9e('0x8'));var controller=require(_0x2f9e('0x9'));router[_0x2f9e('0xa')]('/',auth[_0x2f9e('0xb')](),controller[_0x2f9e('0xc')]);router['get'](_0x2f9e('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x2f9e('0xa')]('/:id',auth[_0x2f9e('0xb')](),controller[_0x2f9e('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2f9e('0xf')]);router['put'](_0x2f9e('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x2f9e('0x11')](_0x2f9e('0x10'),auth[_0x2f9e('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index fe54d51..42498a1 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 _0x6cc9=['STRING','DATE','moment'];(function(_0x25e109,_0x6ab24c){var _0xc0f7d6=function(_0x2fb92b){while(--_0x2fb92b){_0x25e109['push'](_0x25e109['shift']());}};_0xc0f7d6(++_0x6ab24c);}(_0x6cc9,0x188));var _0x96cc=function(_0x2e0138,_0x23da2f){_0x2e0138=_0x2e0138-0x0;var _0x42d2ed=_0x6cc9[_0x2e0138];return _0x42d2ed;};'use strict';var moment=require(_0x96cc('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x96cc('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x96cc('0x1')]},'joinAt':{'type':Sequelize[_0x96cc('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x96cc('0x2')]},'exitAt':{'type':Sequelize[_0x96cc('0x2')]},'reason':{'type':Sequelize[_0x96cc('0x1')]}}; \ No newline at end of file +var _0xa9b1=['DATE','exports','STRING'];(function(_0x47d7ec,_0x17f197){var _0x98674a=function(_0x4f7db3){while(--_0x4f7db3){_0x47d7ec['push'](_0x47d7ec['shift']());}};_0x98674a(++_0x17f197);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1a9b('0x0')]={'uniqueid':{'type':Sequelize[_0x1a9b('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x1a9b('0x1')]},'joinAt':{'type':Sequelize[_0x1a9b('0x2')]},'leaveAt':{'type':Sequelize[_0x1a9b('0x2')]},'acceptAt':{'type':Sequelize[_0x1a9b('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 811f2d6..409ceba 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 _0x8952=['filter','VIRTUAL','merge','options','findAll','rows','show','params','keys','includeAll','include','catch','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','stack','name','map','MailQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x8952,0x17e));var _0x2895=function(_0x3b33da,_0x269c9a){_0x3b33da=_0x3b33da-0x0;var _0x338846=_0x8952[_0x3b33da];return _0x338846;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2895('0x0'));var zipdir=require(_0x2895('0x1'));var jsonpatch=require(_0x2895('0x2'));var rp=require(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2895('0x5'));var util=require(_0x2895('0x6'));var path=require(_0x2895('0x7'));var sox=require('sox');var csv=require(_0x2895('0x8'));var ejs=require(_0x2895('0x9'));var fs=require('fs');var fs_extra=require(_0x2895('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x8'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];function respondWithStatusCode(_0x3924be,_0x4b1342){_0x4b1342=_0x4b1342||0xcc;return function(_0x32574c){if(_0x32574c){return _0x3924be[_0x2895('0x15')](_0x4b1342);}return _0x3924be['status'](_0x4b1342)['end']();};}function respondWithResult(_0x1d1493,_0x2ca2ac){_0x2ca2ac=_0x2ca2ac||0xc8;return function(_0x5777a0){if(_0x5777a0){return _0x1d1493[_0x2895('0x16')](_0x2ca2ac)[_0x2895('0x17')](_0x5777a0);}};}function respondWithFilteredResult(_0x27b50e,_0x1ae013){return function(_0x1d3659){if(_0x1d3659){var _0x2627e6=typeof _0x1ae013[_0x2895('0x18')]===_0x2895('0x19')&&typeof _0x1ae013[_0x2895('0x1a')]===_0x2895('0x19');var _0x10a1bf=_0x1d3659[_0x2895('0x1b')];var _0xbf8b63=_0x2627e6?0x0:_0x1ae013[_0x2895('0x18')];var _0x155124=_0x2627e6?_0x1d3659[_0x2895('0x1b')]:_0x1ae013[_0x2895('0x18')]+_0x1ae013[_0x2895('0x1a')];var _0x5a8eab;if(_0x155124>=_0x10a1bf){_0x155124=_0x10a1bf;_0x5a8eab=0xc8;}else{_0x5a8eab=0xce;}_0x27b50e['status'](_0x5a8eab);return _0x27b50e['set'](_0x2895('0x1c'),_0xbf8b63+'-'+_0x155124+'/'+_0x10a1bf)[_0x2895('0x17')](_0x1d3659);}return null;};}function patchUpdates(_0x3ec4da){return function(_0x593e47){try{jsonpatch[_0x2895('0x1d')](_0x593e47,_0x3ec4da,!![]);}catch(_0x190b79){return BPromise[_0x2895('0x1e')](_0x190b79);}return _0x593e47[_0x2895('0x1f')]();};}function saveUpdates(_0x8b75e0,_0x5dbbfe){return function(_0x30c6c3){if(_0x30c6c3){return _0x30c6c3[_0x2895('0x20')](_0x8b75e0)['then'](function(_0x142e58){return _0x142e58;});}return null;};}function removeEntity(_0x384357,_0x6f8ad4){return function(_0x511286){if(_0x511286){return _0x511286['destroy']()[_0x2895('0x21')](function(){_0x384357[_0x2895('0x16')](0xcc)[_0x2895('0x22')]();});}};}function handleEntityNotFound(_0x4a21cf,_0x3d3320){return function(_0x3690ce){if(!_0x3690ce){_0x4a21cf['sendStatus'](0x194);}return _0x3690ce;};}function handleError(_0x293ad3,_0x127540){_0x127540=_0x127540||0x1f4;return function(_0x2cd4df){logger['error'](_0x2cd4df[_0x2895('0x23')]);if(_0x2cd4df[_0x2895('0x24')]){delete _0x2cd4df['name'];}_0x293ad3[_0x2895('0x16')](_0x127540)['send'](_0x2cd4df);};}exports['index']=function(_0x18a935,_0x4ee2cc){var _0xfa4f85={},_0x381538={},_0x4fdd94={'count':0x0,'rows':[]};var _0x5574bf=_[_0x2895('0x25')](db[_0x2895('0x26')][_0x2895('0x27')],function(_0x14e343){return{'name':_0x14e343[_0x2895('0x28')],'type':_0x14e343[_0x2895('0x29')][_0x2895('0x2a')]};});_0x381538['model']=_[_0x2895('0x25')](_0x5574bf,_0x2895('0x24'));_0x381538[_0x2895('0x2b')]=_['keys'](_0x18a935[_0x2895('0x2b')]);_0x381538[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],_0x381538['query']);_0xfa4f85[_0x2895('0x2f')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x18a935[_0x2895('0x2b')]['fields']));_0xfa4f85['attributes']=_0xfa4f85[_0x2895('0x2f')][_0x2895('0x31')]?_0xfa4f85['attributes']:_0x381538[_0x2895('0x2e')];if(!_0x18a935['query'][_0x2895('0x32')](_0x2895('0x33'))){_0xfa4f85['limit']=qs[_0x2895('0x1a')](_0x18a935['query'][_0x2895('0x1a')]);_0xfa4f85['offset']=qs['offset'](_0x18a935[_0x2895('0x2b')][_0x2895('0x18')]);}_0xfa4f85[_0x2895('0x34')]=qs['sort'](_0x18a935[_0x2895('0x2b')][_0x2895('0x35')]);_0xfa4f85[_0x2895('0x36')]=qs[_0x2895('0x2c')](_[_0x2895('0x37')](_0x18a935[_0x2895('0x2b')],_0x381538[_0x2895('0x2c')]),_0x5574bf);if(_0x18a935[_0x2895('0x2b')][_0x2895('0x38')]){_0xfa4f85[_0x2895('0x36')]=_['merge'](_0xfa4f85[_0x2895('0x36')],{'$or':_[_0x2895('0x25')](_0x5574bf,function(_0x47413d){if(_0x47413d[_0x2895('0x29')]!==_0x2895('0x39')){var _0x12d7d8={};_0x12d7d8[_0x47413d[_0x2895('0x24')]]={'$like':'%'+_0x18a935['query']['filter']+'%'};return _0x12d7d8;}})});}_0xfa4f85=_[_0x2895('0x3a')]({},_0xfa4f85,_0x18a935[_0x2895('0x3b')]);var _0x24b9e0={'where':_0xfa4f85[_0x2895('0x36')]};return db[_0x2895('0x26')][_0x2895('0x1b')](_0x24b9e0)['then'](function(_0x5d18ef){_0x4fdd94[_0x2895('0x1b')]=_0x5d18ef;if(_0x18a935[_0x2895('0x2b')]['includeAll']){_0xfa4f85['include']=[{'all':!![]}];}return db[_0x2895('0x26')][_0x2895('0x3c')](_0xfa4f85);})[_0x2895('0x21')](function(_0x28967f){_0x4fdd94[_0x2895('0x3d')]=_0x28967f;return _0x4fdd94;})[_0x2895('0x21')](respondWithFilteredResult(_0x4ee2cc,_0xfa4f85))['catch'](handleError(_0x4ee2cc,null));};exports[_0x2895('0x3e')]=function(_0x2cfb24,_0x18ca24){var _0x1537fd={'raw':!![],'where':{'id':_0x2cfb24[_0x2895('0x3f')]['id']}},_0x4af6d6={};_0x4af6d6[_0x2895('0x2e')]=_[_0x2895('0x40')](db[_0x2895('0x26')]['rawAttributes']);_0x4af6d6['query']=_[_0x2895('0x40')](_0x2cfb24[_0x2895('0x2b')]);_0x4af6d6[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],_0x4af6d6['query']);_0x1537fd['attributes']=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x2cfb24[_0x2895('0x2b')][_0x2895('0x30')]));_0x1537fd[_0x2895('0x2f')]=_0x1537fd[_0x2895('0x2f')]['length']?_0x1537fd[_0x2895('0x2f')]:_0x4af6d6[_0x2895('0x2e')];if(_0x2cfb24[_0x2895('0x2b')][_0x2895('0x41')]){_0x1537fd[_0x2895('0x42')]=[{'all':!![]}];}_0x1537fd=_[_0x2895('0x3a')]({},_0x1537fd,_0x2cfb24[_0x2895('0x3b')]);return db[_0x2895('0x26')]['find'](_0x1537fd)[_0x2895('0x21')](handleEntityNotFound(_0x18ca24,null))[_0x2895('0x21')](respondWithResult(_0x18ca24,null))[_0x2895('0x43')](handleError(_0x18ca24,null));};exports['create']=function(_0xc85aa1,_0x5307a9){return db['MailQueueReport'][_0x2895('0x44')](_0xc85aa1[_0x2895('0x45')],{})[_0x2895('0x21')](respondWithResult(_0x5307a9,0xc9))[_0x2895('0x43')](handleError(_0x5307a9,null));};exports[_0x2895('0x20')]=function(_0x3cc331,_0x11e53a){if(_0x3cc331['body']['id']){delete _0x3cc331[_0x2895('0x45')]['id'];}return db[_0x2895('0x26')]['find']({'where':{'id':_0x3cc331['params']['id']}})['then'](handleEntityNotFound(_0x11e53a,null))[_0x2895('0x21')](saveUpdates(_0x3cc331[_0x2895('0x45')],null))[_0x2895('0x21')](respondWithResult(_0x11e53a,null))[_0x2895('0x43')](handleError(_0x11e53a,null));};exports[_0x2895('0x46')]=function(_0x3c5261,_0xaca46c){return db[_0x2895('0x26')][_0x2895('0x47')]({'where':{'id':_0x3c5261[_0x2895('0x3f')]['id']}})[_0x2895('0x21')](handleEntityNotFound(_0xaca46c,null))[_0x2895('0x21')](removeEntity(_0xaca46c,null))[_0x2895('0x43')](handleError(_0xaca46c,null));};exports[_0x2895('0x48')]=function(_0x356d35,_0x3c1135){return db[_0x2895('0x26')][_0x2895('0x48')]()[_0x2895('0x21')](respondWithResult(_0x3c1135,null))[_0x2895('0x43')](handleError(_0x3c1135,null));}; \ No newline at end of file +var _0xba34=['../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','MailQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0xba34,0x119));var _0x4ba3=function(_0xf9a93,_0x13e759){_0xf9a93=_0xf9a93-0x0;var _0x2626da=_0xba34[_0xf9a93];return _0x2626da;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':!![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['MailQueueReport']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));};exports['describe']=function(_0x43f820,_0x19d70f){return db[_0x4ba3('0x2d')][_0x4ba3('0x4b')]()[_0x4ba3('0x26')](respondWithResult(_0x19d70f,null))[_0x4ba3('0x46')](handleError(_0x19d70f,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index dbe4e0b..d670d7b 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 _0xa36b=['../../config/environment','exports','define','MailQueueReport','uniqueid','util','../../config/logger','api','rimraf'];(function(_0xd63642,_0xe2957c){var _0x222c71=function(_0xd481f2){while(--_0xd481f2){_0xd63642['push'](_0xd63642['shift']());}};_0x222c71(++_0xe2957c);}(_0xa36b,0x149));var _0xba36=function(_0x441736,_0x54fa8d){_0x441736=_0x441736-0x0;var _0x30aa55=_0xa36b[_0x441736];return _0x30aa55;};'use strict';var _=require('lodash');var util=require(_0xba36('0x0'));var logger=require(_0xba36('0x1'))(_0xba36('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xba36('0x3'));var config=require(_0xba36('0x4'));var attributes=require('./mailQueueReport.attributes');module[_0xba36('0x5')]=function(_0x472166,_0x376e8c){return _0x472166[_0xba36('0x6')](_0xba36('0x7'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xba36('0x8'),'fields':[_0xba36('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5e4=['define','report_mail_queue','uniqueid','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports'];(function(_0x4e3594,_0x1d073b){var _0xc8d8ad=function(_0x4fe77e){while(--_0x4fe77e){_0x4e3594['push'](_0x4e3594['shift']());}};_0xc8d8ad(++_0x1d073b);}(_0xc5e4,0x117));var _0x4c5e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc5e4[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x4c5e('0x0'));var logger=require(_0x4c5e('0x1'))('api');var moment=require(_0x4c5e('0x2'));var BPromise=require(_0x4c5e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c5e('0x4'));var rimraf=require(_0x4c5e('0x5'));var config=require(_0x4c5e('0x6'));var attributes=require(_0x4c5e('0x7'));module[_0x4c5e('0x8')]=function(_0x278244,_0x2c1a62){return _0x278244[_0x4c5e('0x9')]('MailQueueReport',attributes,{'tableName':_0x4c5e('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4c5e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 3349fe6..421de0f 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 _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x1043b7,_0x55c8fb){var _0x1edee5=function(_0x5bcc0f){while(--_0x5bcc0f){_0x1043b7['push'](_0x1043b7['shift']());}};_0x1edee5(++_0x55c8fb);}(_0xadb5,0xad));var _0x5adb=function(_0x3c8e71,_0x3af11f){_0x3c8e71=_0x3c8e71-0x0;var _0xd2ee63=_0xadb5[_0x3c8e71];return _0xd2ee63;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file +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(_0x27a125,_0x330c0e){var _0x36eac1=function(_0x49265f){while(--_0x49265f){_0x27a125['push'](_0x27a125['shift']());}};_0x36eac1(++_0x330c0e);}(_0x2ef3,0xba));var _0x32ef=function(_0x439ac3,_0x10a8c5){_0x439ac3=_0x439ac3-0x0;var _0x313332=_0x2ef3[_0x439ac3];return _0x313332;};'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 diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index a10644f..1dc4669 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5b26d4,_0x572bc8){var _0x56e498=function(_0x1080c3){while(--_0x1080c3){_0x5b26d4['push'](_0x5b26d4['shift']());}};_0x56e498(++_0x572bc8);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2ac0dd,_0x162292){var _0x2a0216=function(_0x38822d){while(--_0x38822d){_0x2ac0dd['push'](_0x2ac0dd['shift']());}};_0x2a0216(++_0x162292);}(_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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index ebd2932..6f8ce94 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 _0x4024=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x2699ed,_0x3a9030){var _0x3e99a7=function(_0x402f70){while(--_0x402f70){_0x2699ed['push'](_0x2699ed['shift']());}};_0x3e99a7(++_0x3a9030);}(_0x4024,0x89));var _0x4402=function(_0x3c3698,_0x54c21a){_0x3c3698=_0x3c3698-0x0;var _0x50b9ae=_0x4024[_0x3c3698];return _0x50b9ae;};'use strict';var Sequelize=require(_0x4402('0x0'));module[_0x4402('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x4402('0x2')]},'authentication':{'type':Sequelize[_0x4402('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x4402('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x4402('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x4402('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x4402('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x4402('0x2')]}}; \ No newline at end of file +var _0x9c2c=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc9c2('0x0'));module[_0xc9c2('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xc9c2('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xc9c2('0x3')]},'tls':{'type':Sequelize[_0xc9c2('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xc9c2('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xc9c2('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index f5f3f59..74785fc 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 _0x32a8=['MailServerIn','mail_servers_in','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x364a36,_0x1e2677){var _0x5cd6fa=function(_0x58d692){while(--_0x58d692){_0x364a36['push'](_0x364a36['shift']());}};_0x5cd6fa(++_0x1e2677);}(_0x32a8,0x18e));var _0x832a=function(_0x4c5de1,_0x31e913){_0x4c5de1=_0x4c5de1-0x0;var _0x10114a=_0x32a8[_0x4c5de1];return _0x10114a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x832a('0x0'))(_0x832a('0x1'));var moment=require(_0x832a('0x2'));var BPromise=require('bluebird');var rp=require(_0x832a('0x3'));var fs=require('fs');var path=require(_0x832a('0x4'));var rimraf=require(_0x832a('0x5'));var config=require(_0x832a('0x6'));var attributes=require(_0x832a('0x7'));module[_0x832a('0x8')]=function(_0x538070,_0x4a0112){return _0x538070['define'](_0x832a('0x9'),attributes,{'tableName':_0x832a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbda4=['exports','define','MailServerIn','mail_servers_in','util','../../config/logger','bluebird','path','rimraf','./mailServerIn.attributes'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0xbda4,0x194));var _0x4bda=function(_0x47f8e0,_0x3146e8){_0x47f8e0=_0x47f8e0-0x0;var _0x27243b=_0xbda4[_0x47f8e0];return _0x27243b;};'use strict';var _=require('lodash');var util=require(_0x4bda('0x0'));var logger=require(_0x4bda('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4bda('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bda('0x3'));var rimraf=require(_0x4bda('0x4'));var config=require('../../config/environment');var attributes=require(_0x4bda('0x5'));module[_0x4bda('0x6')]=function(_0x4163fb,_0x58d8c3){return _0x4163fb[_0x4bda('0x7')](_0x4bda('0x8'),attributes,{'tableName':_0x4bda('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 9128c33..16a98e2 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 _0x9bc3=['error','message','info','result','catch','GetMailServerIn','findAll','options','raw','attributes','limit','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x9bc3,0x137));var _0x39bc=function(_0x24a591,_0x55c6a0){_0x24a591=_0x24a591-0x0;var _0x35cc83=_0x9bc3[_0x24a591];return _0x35cc83;};'use strict';var _=require(_0x39bc('0x0'));var util=require(_0x39bc('0x1'));var moment=require(_0x39bc('0x2'));var BPromise=require('bluebird');var rs=require(_0x39bc('0x3'));var fs=require('fs');var Redis=require(_0x39bc('0x4'));var db=require(_0x39bc('0x5'))['db'];var utils=require(_0x39bc('0x6'));var logger=require('../../config/logger')(_0x39bc('0x7'));var config=require(_0x39bc('0x8'));var jayson=require(_0x39bc('0x9'));var client=jayson[_0x39bc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38d6ce,_0x1367c6,_0x86cff3){return new BPromise(function(_0x10be27,_0x3fa4bd){return client[_0x39bc('0xb')](_0x38d6ce,_0x86cff3)[_0x39bc('0xc')](function(_0x2533c1){logger['info'](_0x39bc('0xd'),_0x1367c6,_0x39bc('0xe'));logger[_0x39bc('0xf')](_0x39bc('0x10'),_0x1367c6,_0x39bc('0xe'),JSON[_0x39bc('0x11')](_0x2533c1));if(_0x2533c1['error']){if(_0x2533c1['error'][_0x39bc('0x12')]===0x1f4){logger[_0x39bc('0x13')]('MailServerIn,\x20%s,\x20%s',_0x1367c6,_0x2533c1[_0x39bc('0x13')][_0x39bc('0x14')]);return _0x3fa4bd(_0x2533c1[_0x39bc('0x13')]['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x1367c6,_0x2533c1[_0x39bc('0x13')]['message']);return _0x10be27(_0x2533c1['error'][_0x39bc('0x14')]);}else{logger[_0x39bc('0x15')]('MailServerIn,\x20%s,\x20%s',_0x1367c6,'request\x20sent');_0x10be27(_0x2533c1[_0x39bc('0x16')][_0x39bc('0x14')]);}})[_0x39bc('0x17')](function(_0x5d6b18){logger[_0x39bc('0x13')](_0x39bc('0xd'),_0x1367c6,_0x5d6b18);_0x3fa4bd(_0x5d6b18);});});}exports[_0x39bc('0x18')]=function(_0x1e121f){var _0x3064c1=this;return new Promise(function(_0x3f13c8,_0x311923){return db['MailServerIn'][_0x39bc('0x19')]({'raw':_0x1e121f[_0x39bc('0x1a')]?_0x1e121f[_0x39bc('0x1a')][_0x39bc('0x1b')]===undefined?!![]:![]:!![],'where':_0x1e121f['options']?_0x1e121f[_0x39bc('0x1a')]['where']||null:null,'attributes':_0x1e121f[_0x39bc('0x1a')]?_0x1e121f['options'][_0x39bc('0x1c')]||null:null,'limit':_0x1e121f[_0x39bc('0x1a')]?_0x1e121f[_0x39bc('0x1a')][_0x39bc('0x1d')]||null:null,'include':_0x1e121f[_0x39bc('0x1a')]?_0x1e121f['options'][_0x39bc('0x1e')]?_[_0x39bc('0x1f')](_0x1e121f['options'][_0x39bc('0x1e')],function(_0x147923){return{'model':db[_0x147923['model']],'as':_0x147923['as'],'attributes':_0x147923['attributes'],'include':_0x147923[_0x39bc('0x1e')]?_[_0x39bc('0x1f')](_0x147923['include'],function(_0x8ff9f){return{'model':db[_0x8ff9f[_0x39bc('0x20')]],'as':_0x8ff9f['as'],'attributes':_0x8ff9f['attributes'],'include':_0x8ff9f['include']?_['map'](_0x8ff9f[_0x39bc('0x1e')],function(_0x21d5cf){return{'model':db[_0x21d5cf[_0x39bc('0x20')]],'as':_0x21d5cf['as'],'attributes':_0x21d5cf[_0x39bc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x39bc('0xc')](function(_0x581148){logger[_0x39bc('0x15')](_0x39bc('0x18'),_0x1e121f);logger[_0x39bc('0xf')](_0x39bc('0x18'),_0x1e121f,JSON[_0x39bc('0x11')](_0x581148));_0x3f13c8(_0x581148);})[_0x39bc('0x17')](function(_0x2a13bc){logger[_0x39bc('0x13')](_0x39bc('0x18'),_0x2a13bc[_0x39bc('0x14')],_0x1e121f);_0x311923(_0x3064c1[_0x39bc('0x13')](0x1f4,_0x2a13bc[_0x39bc('0x14')]));});});}; \ No newline at end of file +var _0xc44d=['request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','limit','include','map','model','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info'];(function(_0x2e6a36,_0x44f57c){var _0xa10173=function(_0x155270){while(--_0x155270){_0x2e6a36['push'](_0x2e6a36['shift']());}};_0xa10173(++_0x44f57c);}(_0xc44d,0xc6));var _0xdc44=function(_0x38d348,_0x218ef3){_0x38d348=_0x38d348-0x0;var _0x299fe4=_0xc44d[_0x38d348];return _0x299fe4;};'use strict';var _=require(_0xdc44('0x0'));var util=require('util');var moment=require(_0xdc44('0x1'));var BPromise=require(_0xdc44('0x2'));var rs=require(_0xdc44('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdc44('0x4'))['db'];var utils=require(_0xdc44('0x5'));var logger=require(_0xdc44('0x6'))(_0xdc44('0x7'));var config=require('../../config/environment');var jayson=require(_0xdc44('0x8'));var client=jayson['client'][_0xdc44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4eca1a,_0x4ff515,_0x5447d1){return new BPromise(function(_0x58dc89,_0x350169){return client['request'](_0x4eca1a,_0x5447d1)[_0xdc44('0xa')](function(_0x4ae2c1){logger[_0xdc44('0xb')]('MailServerIn,\x20%s,\x20%s',_0x4ff515,_0xdc44('0xc'));logger['debug'](_0xdc44('0xd'),_0x4ff515,_0xdc44('0xc'),JSON[_0xdc44('0xe')](_0x4ae2c1));if(_0x4ae2c1[_0xdc44('0xf')]){if(_0x4ae2c1[_0xdc44('0xf')]['code']===0x1f4){logger[_0xdc44('0xf')](_0xdc44('0x10'),_0x4ff515,_0x4ae2c1[_0xdc44('0xf')]['message']);return _0x350169(_0x4ae2c1[_0xdc44('0xf')]['message']);}logger[_0xdc44('0xf')](_0xdc44('0x10'),_0x4ff515,_0x4ae2c1[_0xdc44('0xf')]['message']);return _0x58dc89(_0x4ae2c1[_0xdc44('0xf')][_0xdc44('0x11')]);}else{logger[_0xdc44('0xb')]('MailServerIn,\x20%s,\x20%s',_0x4ff515,_0xdc44('0xc'));_0x58dc89(_0x4ae2c1[_0xdc44('0x12')]['message']);}})[_0xdc44('0x13')](function(_0x40c03f){logger[_0xdc44('0xf')]('MailServerIn,\x20%s,\x20%s',_0x4ff515,_0x40c03f);_0x350169(_0x40c03f);});});}exports[_0xdc44('0x14')]=function(_0x884783){var _0x30dc89=this;return new Promise(function(_0x512162,_0x562c05){return db[_0xdc44('0x15')][_0xdc44('0x16')]({'raw':_0x884783[_0xdc44('0x17')]?_0x884783[_0xdc44('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x884783[_0xdc44('0x17')]?_0x884783[_0xdc44('0x17')]['where']||null:null,'attributes':_0x884783['options']?_0x884783['options'][_0xdc44('0x18')]||null:null,'limit':_0x884783[_0xdc44('0x17')]?_0x884783[_0xdc44('0x17')][_0xdc44('0x19')]||null:null,'include':_0x884783[_0xdc44('0x17')]?_0x884783[_0xdc44('0x17')][_0xdc44('0x1a')]?_[_0xdc44('0x1b')](_0x884783[_0xdc44('0x17')][_0xdc44('0x1a')],function(_0x1f404f){return{'model':db[_0x1f404f[_0xdc44('0x1c')]],'as':_0x1f404f['as'],'attributes':_0x1f404f[_0xdc44('0x18')],'include':_0x1f404f[_0xdc44('0x1a')]?_[_0xdc44('0x1b')](_0x1f404f[_0xdc44('0x1a')],function(_0x55f658){return{'model':db[_0x55f658[_0xdc44('0x1c')]],'as':_0x55f658['as'],'attributes':_0x55f658[_0xdc44('0x18')],'include':_0x55f658[_0xdc44('0x1a')]?_[_0xdc44('0x1b')](_0x55f658['include'],function(_0x756d87){return{'model':db[_0x756d87[_0xdc44('0x1c')]],'as':_0x756d87['as'],'attributes':_0x756d87['attributes']};}):[]};}):[]};}):[]:[]})[_0xdc44('0xa')](function(_0x49c000){logger['info'](_0xdc44('0x14'),_0x884783);logger[_0xdc44('0x1d')]('GetMailServerIn',_0x884783,JSON[_0xdc44('0xe')](_0x49c000));_0x512162(_0x49c000);})[_0xdc44('0x13')](function(_0xaa27b0){logger[_0xdc44('0xf')](_0xdc44('0x14'),_0xaa27b0['message'],_0x884783);_0x562c05(_0x30dc89['error'](0x1f4,_0xaa27b0[_0xdc44('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 9a94a64..7e71e0e 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(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x7a54,0x106));var _0x47a5=function(_0x5959ab,_0x1f9280){_0x5959ab=_0x5959ab-0x0;var _0x17b5b8=_0x7a54[_0x5959ab];return _0x17b5b8;};'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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index b84798c..0ecefaf 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 _0x5abb=['STRING','BOOLEAN','exports'];(function(_0x5618c4,_0x4e8f57){var _0xdf390f=function(_0x1406cb){while(--_0x1406cb){_0x5618c4['push'](_0x5618c4['shift']());}};_0xdf390f(++_0x4e8f57);}(_0x5abb,0xec));var _0xb5ab=function(_0x4a41ec,_0x26df67){_0x4a41ec=_0x4a41ec-0x0;var _0x451c72=_0x5abb[_0x4a41ec];return _0x451c72;};'use strict';var Sequelize=require('sequelize');module[_0xb5ab('0x0')]={'description':{'type':Sequelize[_0xb5ab('0x1')]},'host':{'type':Sequelize[_0xb5ab('0x1')]},'user':{'type':Sequelize[_0xb5ab('0x1')]},'pass':{'type':Sequelize[_0xb5ab('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xb5ab('0x2')],'defaultValue':![]},'service':{'type':Sequelize[_0xb5ab('0x1')]},'authentication':{'type':Sequelize[_0xb5ab('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4890=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x1d2fc7,_0x3ac81d){var _0x73574c=function(_0xc3624b){while(--_0xc3624b){_0x1d2fc7['push'](_0x1d2fc7['shift']());}};_0x73574c(++_0x3ac81d);}(_0x4890,0x157));var _0x0489=function(_0x389832,_0x10a4a9){_0x389832=_0x389832-0x0;var _0x59429e=_0x4890[_0x389832];return _0x59429e;};'use strict';var Sequelize=require(_0x0489('0x0'));module[_0x0489('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x0489('0x2')]},'user':{'type':Sequelize[_0x0489('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x0489('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x0489('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 6f321f5..2e52ab6 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 _0xdfe2=['show','params','rawAttributes','catch','body','find','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','destroy','error','stack','name','send','index','map','MailServerOut','type','key','query','keys','filters','intersection','model','fields','attributes','length','order','where','merge','VIRTUAL','options','includeAll','include','findAll','then','rows'];(function(_0x3b7436,_0x3ba1a9){var _0x39e59b=function(_0x36b6f2){while(--_0x36b6f2){_0x3b7436['push'](_0x3b7436['shift']());}};_0x39e59b(++_0x3ba1a9);}(_0xdfe2,0x15a));var _0x2dfe=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xdfe2[_0x29d915];return _0x160f86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2dfe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2dfe('0x1'));var rp=require(_0x2dfe('0x2'));var moment=require(_0x2dfe('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2dfe('0x4'));var util=require(_0x2dfe('0x5'));var path=require(_0x2dfe('0x6'));var sox=require(_0x2dfe('0x7'));var csv=require(_0x2dfe('0x8'));var ejs=require(_0x2dfe('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2dfe('0xa'));var squel=require(_0x2dfe('0xb'));var crypto=require(_0x2dfe('0xc'));var jsforce=require(_0x2dfe('0xd'));var deskjs=require(_0x2dfe('0xe'));var toCsv=require(_0x2dfe('0x8'));var querystring=require('querystring');var Papa=require(_0x2dfe('0xf'));var Redis=require(_0x2dfe('0x10'));var authService=require(_0x2dfe('0x11'));var qs=require(_0x2dfe('0x12'));var as=require(_0x2dfe('0x13'));var hardwareService=require(_0x2dfe('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x2dfe('0x15'));var config=require(_0x2dfe('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2dfe('0x17'))['db'];function respondWithStatusCode(_0x345e4b,_0x18ca55){_0x18ca55=_0x18ca55||0xcc;return function(_0x1d0e86){if(_0x1d0e86){return _0x345e4b[_0x2dfe('0x18')](_0x18ca55);}return _0x345e4b[_0x2dfe('0x19')](_0x18ca55)['end']();};}function respondWithResult(_0x5d14e4,_0x445ce8){_0x445ce8=_0x445ce8||0xc8;return function(_0x512a81){if(_0x512a81){return _0x5d14e4[_0x2dfe('0x19')](_0x445ce8)[_0x2dfe('0x1a')](_0x512a81);}};}function respondWithFilteredResult(_0x563100,_0x55844a){return function(_0x1337ea){if(_0x1337ea){var _0x1a3904=typeof _0x55844a['offset']===_0x2dfe('0x1b')&&typeof _0x55844a[_0x2dfe('0x1c')]===_0x2dfe('0x1b');var _0x2d5d6d=_0x1337ea[_0x2dfe('0x1d')];var _0x1d9da1=_0x1a3904?0x0:_0x55844a[_0x2dfe('0x1e')];var _0x2ad3b9=_0x1a3904?_0x1337ea[_0x2dfe('0x1d')]:_0x55844a[_0x2dfe('0x1e')]+_0x55844a[_0x2dfe('0x1c')];var _0x14aee2;if(_0x2ad3b9>=_0x2d5d6d){_0x2ad3b9=_0x2d5d6d;_0x14aee2=0xc8;}else{_0x14aee2=0xce;}_0x563100['status'](_0x14aee2);return _0x563100[_0x2dfe('0x1f')](_0x2dfe('0x20'),_0x1d9da1+'-'+_0x2ad3b9+'/'+_0x2d5d6d)['json'](_0x1337ea);}return null;};}function patchUpdates(_0x10af1c){return function(_0x4d6342){try{jsonpatch['apply'](_0x4d6342,_0x10af1c,!![]);}catch(_0x1d05dd){return BPromise['reject'](_0x1d05dd);}return _0x4d6342['save']();};}function saveUpdates(_0x4df2aa,_0x28478d){return function(_0x136bc4){if(_0x136bc4){return _0x136bc4[_0x2dfe('0x21')](_0x4df2aa)['then'](function(_0x26b163){return _0x26b163;});}return null;};}function removeEntity(_0x201e18,_0x364149){return function(_0xff8df){if(_0xff8df){return _0xff8df[_0x2dfe('0x22')]()['then'](function(){_0x201e18['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x529b82,_0x41c154){return function(_0x1259ff){if(!_0x1259ff){_0x529b82[_0x2dfe('0x18')](0x194);}return _0x1259ff;};}function handleError(_0x1a907f,_0x51d9f8){_0x51d9f8=_0x51d9f8||0x1f4;return function(_0x59d4f4){logger[_0x2dfe('0x23')](_0x59d4f4[_0x2dfe('0x24')]);if(_0x59d4f4[_0x2dfe('0x25')]){delete _0x59d4f4['name'];}_0x1a907f[_0x2dfe('0x19')](_0x51d9f8)[_0x2dfe('0x26')](_0x59d4f4);};}exports[_0x2dfe('0x27')]=function(_0x45a162,_0x156a57){var _0x3be0f9={},_0x4842f1={},_0x4daa35={'count':0x0,'rows':[]};var _0x531ff0=_[_0x2dfe('0x28')](db[_0x2dfe('0x29')]['rawAttributes'],function(_0x5dc447){return{'name':_0x5dc447['fieldName'],'type':_0x5dc447[_0x2dfe('0x2a')][_0x2dfe('0x2b')]};});_0x4842f1['model']=_[_0x2dfe('0x28')](_0x531ff0,_0x2dfe('0x25'));_0x4842f1[_0x2dfe('0x2c')]=_[_0x2dfe('0x2d')](_0x45a162[_0x2dfe('0x2c')]);_0x4842f1[_0x2dfe('0x2e')]=_[_0x2dfe('0x2f')](_0x4842f1['model'],_0x4842f1['query']);_0x3be0f9['attributes']=_[_0x2dfe('0x2f')](_0x4842f1[_0x2dfe('0x30')],qs[_0x2dfe('0x31')](_0x45a162[_0x2dfe('0x2c')]['fields']));_0x3be0f9['attributes']=_0x3be0f9[_0x2dfe('0x32')][_0x2dfe('0x33')]?_0x3be0f9[_0x2dfe('0x32')]:_0x4842f1[_0x2dfe('0x30')];if(!_0x45a162[_0x2dfe('0x2c')]['hasOwnProperty']('nolimit')){_0x3be0f9[_0x2dfe('0x1c')]=qs[_0x2dfe('0x1c')](_0x45a162['query'][_0x2dfe('0x1c')]);_0x3be0f9[_0x2dfe('0x1e')]=qs[_0x2dfe('0x1e')](_0x45a162[_0x2dfe('0x2c')][_0x2dfe('0x1e')]);}_0x3be0f9[_0x2dfe('0x34')]=qs['sort'](_0x45a162[_0x2dfe('0x2c')]['sort']);_0x3be0f9[_0x2dfe('0x35')]=qs[_0x2dfe('0x2e')](_['pick'](_0x45a162[_0x2dfe('0x2c')],_0x4842f1[_0x2dfe('0x2e')]),_0x531ff0);if(_0x45a162['query']['filter']){_0x3be0f9[_0x2dfe('0x35')]=_[_0x2dfe('0x36')](_0x3be0f9[_0x2dfe('0x35')],{'$or':_[_0x2dfe('0x28')](_0x531ff0,function(_0x2ce5cf){if(_0x2ce5cf[_0x2dfe('0x2a')]!==_0x2dfe('0x37')){var _0xc2e83c={};_0xc2e83c[_0x2ce5cf[_0x2dfe('0x25')]]={'$like':'%'+_0x45a162['query']['filter']+'%'};return _0xc2e83c;}})});}_0x3be0f9=_[_0x2dfe('0x36')]({},_0x3be0f9,_0x45a162[_0x2dfe('0x38')]);var _0x174077={'where':_0x3be0f9[_0x2dfe('0x35')]};return db['MailServerOut'][_0x2dfe('0x1d')](_0x174077)['then'](function(_0x2a614d){_0x4daa35[_0x2dfe('0x1d')]=_0x2a614d;if(_0x45a162[_0x2dfe('0x2c')][_0x2dfe('0x39')]){_0x3be0f9[_0x2dfe('0x3a')]=[{'all':!![]}];}return db[_0x2dfe('0x29')][_0x2dfe('0x3b')](_0x3be0f9);})[_0x2dfe('0x3c')](function(_0x3f6513){_0x4daa35[_0x2dfe('0x3d')]=_0x3f6513;return _0x4daa35;})['then'](respondWithFilteredResult(_0x156a57,_0x3be0f9))['catch'](handleError(_0x156a57,null));};exports[_0x2dfe('0x3e')]=function(_0x46f646,_0x300b4e){var _0x4d0daa={'raw':!![],'where':{'id':_0x46f646[_0x2dfe('0x3f')]['id']}},_0x2594f1={};_0x2594f1[_0x2dfe('0x30')]=_[_0x2dfe('0x2d')](db['MailServerOut'][_0x2dfe('0x40')]);_0x2594f1[_0x2dfe('0x2c')]=_[_0x2dfe('0x2d')](_0x46f646[_0x2dfe('0x2c')]);_0x2594f1[_0x2dfe('0x2e')]=_[_0x2dfe('0x2f')](_0x2594f1[_0x2dfe('0x30')],_0x2594f1[_0x2dfe('0x2c')]);_0x4d0daa[_0x2dfe('0x32')]=_[_0x2dfe('0x2f')](_0x2594f1[_0x2dfe('0x30')],qs[_0x2dfe('0x31')](_0x46f646[_0x2dfe('0x2c')][_0x2dfe('0x31')]));_0x4d0daa['attributes']=_0x4d0daa[_0x2dfe('0x32')]['length']?_0x4d0daa['attributes']:_0x2594f1[_0x2dfe('0x30')];if(_0x46f646[_0x2dfe('0x2c')]['includeAll']){_0x4d0daa[_0x2dfe('0x3a')]=[{'all':!![]}];}_0x4d0daa=_[_0x2dfe('0x36')]({},_0x4d0daa,_0x46f646[_0x2dfe('0x38')]);return db[_0x2dfe('0x29')]['find'](_0x4d0daa)[_0x2dfe('0x3c')](handleEntityNotFound(_0x300b4e,null))[_0x2dfe('0x3c')](respondWithResult(_0x300b4e,null))[_0x2dfe('0x41')](handleError(_0x300b4e,null));};exports['create']=function(_0x3b5a28,_0x3f18){return db[_0x2dfe('0x29')]['create'](_0x3b5a28[_0x2dfe('0x42')],{})[_0x2dfe('0x3c')](respondWithResult(_0x3f18,0xc9))[_0x2dfe('0x41')](handleError(_0x3f18,null));};exports['update']=function(_0x1b11b3,_0x51be7f){if(_0x1b11b3[_0x2dfe('0x42')]['id']){delete _0x1b11b3[_0x2dfe('0x42')]['id'];}return db[_0x2dfe('0x29')][_0x2dfe('0x43')]({'where':{'id':_0x1b11b3[_0x2dfe('0x3f')]['id']}})[_0x2dfe('0x3c')](handleEntityNotFound(_0x51be7f,null))[_0x2dfe('0x3c')](saveUpdates(_0x1b11b3['body'],null))['then'](respondWithResult(_0x51be7f,null))[_0x2dfe('0x41')](handleError(_0x51be7f,null));};exports['destroy']=function(_0x22a35b,_0x4c7f46){return db[_0x2dfe('0x29')][_0x2dfe('0x43')]({'where':{'id':_0x22a35b[_0x2dfe('0x3f')]['id']}})[_0x2dfe('0x3c')](handleEntityNotFound(_0x4c7f46,null))[_0x2dfe('0x3c')](removeEntity(_0x4c7f46,null))[_0x2dfe('0x41')](handleError(_0x4c7f46,null));}; \ No newline at end of file +var _0x8a09=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','update','then','index','MailServerOut','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','destroy','eml-format','rimraf','request-promise','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js'];(function(_0x4539c9,_0x5cb1da){var _0x18ce80=function(_0x58c456){while(--_0x58c456){_0x4539c9['push'](_0x4539c9['shift']());}};_0x18ce80(++_0x5cb1da);}(_0x8a09,0x198));var _0x98a0=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8a09[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x98a0('0x0'));var rimraf=require(_0x98a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x98a0('0x2'));var moment=require('moment');var BPromise=require(_0x98a0('0x3'));var Mustache=require(_0x98a0('0x4'));var util=require(_0x98a0('0x5'));var path=require(_0x98a0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x98a0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x98a0('0x8'));var crypto=require(_0x98a0('0x9'));var jsforce=require(_0x98a0('0xa'));var deskjs=require(_0x98a0('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x98a0('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x98a0('0xd'));var as=require(_0x98a0('0xe'));var hardwareService=require(_0x98a0('0xf'));var logger=require(_0x98a0('0x10'))(_0x98a0('0x11'));var utils=require(_0x98a0('0x12'));var config=require(_0x98a0('0x13'));var licenseUtil=require(_0x98a0('0x14'));var db=require(_0x98a0('0x15'))['db'];function respondWithStatusCode(_0x3aaae1,_0x4e2703){_0x4e2703=_0x4e2703||0xcc;return function(_0x31db2f){if(_0x31db2f){return _0x3aaae1[_0x98a0('0x16')](_0x4e2703);}return _0x3aaae1[_0x98a0('0x17')](_0x4e2703)[_0x98a0('0x18')]();};}function respondWithResult(_0x37cb06,_0x4ea71b){_0x4ea71b=_0x4ea71b||0xc8;return function(_0x1b5b3c){if(_0x1b5b3c){return _0x37cb06[_0x98a0('0x17')](_0x4ea71b)['json'](_0x1b5b3c);}};}function respondWithFilteredResult(_0x4f19c0,_0x2e2674){return function(_0x11eb9c){if(_0x11eb9c){var _0x2965b6=typeof _0x2e2674[_0x98a0('0x19')]===_0x98a0('0x1a')&&typeof _0x2e2674[_0x98a0('0x1b')]===_0x98a0('0x1a');var _0x3b05fc=_0x11eb9c[_0x98a0('0x1c')];var _0x156f8c=_0x2965b6?0x0:_0x2e2674[_0x98a0('0x19')];var _0x5354d7=_0x2965b6?_0x11eb9c[_0x98a0('0x1c')]:_0x2e2674[_0x98a0('0x19')]+_0x2e2674[_0x98a0('0x1b')];var _0x34d1b7;if(_0x5354d7>=_0x3b05fc){_0x5354d7=_0x3b05fc;_0x34d1b7=0xc8;}else{_0x34d1b7=0xce;}_0x4f19c0[_0x98a0('0x17')](_0x34d1b7);return _0x4f19c0[_0x98a0('0x1d')](_0x98a0('0x1e'),_0x156f8c+'-'+_0x5354d7+'/'+_0x3b05fc)['json'](_0x11eb9c);}return null;};}function patchUpdates(_0x1dbcad){return function(_0x24e81c){try{jsonpatch['apply'](_0x24e81c,_0x1dbcad,!![]);}catch(_0xaf478e){return BPromise[_0x98a0('0x1f')](_0xaf478e);}return _0x24e81c['save']();};}function saveUpdates(_0x2f0f01,_0x125117){return function(_0x2e9537){if(_0x2e9537){return _0x2e9537[_0x98a0('0x20')](_0x2f0f01)[_0x98a0('0x21')](function(_0x1750e7){return _0x1750e7;});}return null;};}function removeEntity(_0x215fe9,_0x3b1934){return function(_0x2f6d90){if(_0x2f6d90){return _0x2f6d90['destroy']()[_0x98a0('0x21')](function(){_0x215fe9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4018cc,_0x2be478){return function(_0x313c8c){if(!_0x313c8c){_0x4018cc[_0x98a0('0x16')](0x194);}return _0x313c8c;};}function handleError(_0x2692c2,_0x3c6e6b){_0x3c6e6b=_0x3c6e6b||0x1f4;return function(_0x417199){logger['error'](_0x417199['stack']);if(_0x417199['name']){delete _0x417199['name'];}_0x2692c2[_0x98a0('0x17')](_0x3c6e6b)['send'](_0x417199);};}exports[_0x98a0('0x22')]=function(_0x2c33b1,_0x373c89){var _0x1c67fa={},_0x59fdc8={},_0x90e40c={'count':0x0,'rows':[]};var _0x4680d9=_['map'](db[_0x98a0('0x23')][_0x98a0('0x24')],function(_0x3e4dde){return{'name':_0x3e4dde[_0x98a0('0x25')],'type':_0x3e4dde[_0x98a0('0x26')][_0x98a0('0x27')]};});_0x59fdc8['model']=_[_0x98a0('0x28')](_0x4680d9,'name');_0x59fdc8[_0x98a0('0x29')]=_['keys'](_0x2c33b1[_0x98a0('0x29')]);_0x59fdc8[_0x98a0('0x2a')]=_[_0x98a0('0x2b')](_0x59fdc8[_0x98a0('0x2c')],_0x59fdc8[_0x98a0('0x29')]);_0x1c67fa['attributes']=_['intersection'](_0x59fdc8[_0x98a0('0x2c')],qs[_0x98a0('0x2d')](_0x2c33b1[_0x98a0('0x29')][_0x98a0('0x2d')]));_0x1c67fa[_0x98a0('0x2e')]=_0x1c67fa[_0x98a0('0x2e')][_0x98a0('0x2f')]?_0x1c67fa[_0x98a0('0x2e')]:_0x59fdc8[_0x98a0('0x2c')];if(!_0x2c33b1[_0x98a0('0x29')][_0x98a0('0x30')](_0x98a0('0x31'))){_0x1c67fa['limit']=qs['limit'](_0x2c33b1[_0x98a0('0x29')][_0x98a0('0x1b')]);_0x1c67fa['offset']=qs[_0x98a0('0x19')](_0x2c33b1[_0x98a0('0x29')][_0x98a0('0x19')]);}_0x1c67fa[_0x98a0('0x32')]=qs[_0x98a0('0x33')](_0x2c33b1[_0x98a0('0x29')][_0x98a0('0x33')]);_0x1c67fa['where']=qs[_0x98a0('0x2a')](_[_0x98a0('0x34')](_0x2c33b1[_0x98a0('0x29')],_0x59fdc8[_0x98a0('0x2a')]),_0x4680d9);if(_0x2c33b1[_0x98a0('0x29')][_0x98a0('0x35')]){_0x1c67fa[_0x98a0('0x36')]=_['merge'](_0x1c67fa[_0x98a0('0x36')],{'$or':_[_0x98a0('0x28')](_0x4680d9,function(_0x4cbc1c){if(_0x4cbc1c[_0x98a0('0x26')]!==_0x98a0('0x37')){var _0x1590ac={};_0x1590ac[_0x4cbc1c['name']]={'$like':'%'+_0x2c33b1[_0x98a0('0x29')][_0x98a0('0x35')]+'%'};return _0x1590ac;}})});}_0x1c67fa=_[_0x98a0('0x38')]({},_0x1c67fa,_0x2c33b1[_0x98a0('0x39')]);var _0x4d862c={'where':_0x1c67fa[_0x98a0('0x36')]};return db[_0x98a0('0x23')][_0x98a0('0x1c')](_0x4d862c)[_0x98a0('0x21')](function(_0xc20283){_0x90e40c['count']=_0xc20283;if(_0x2c33b1[_0x98a0('0x29')][_0x98a0('0x3a')]){_0x1c67fa[_0x98a0('0x3b')]=[{'all':!![]}];}return db['MailServerOut'][_0x98a0('0x3c')](_0x1c67fa);})['then'](function(_0x2dcce2){_0x90e40c[_0x98a0('0x3d')]=_0x2dcce2;return _0x90e40c;})[_0x98a0('0x21')](respondWithFilteredResult(_0x373c89,_0x1c67fa))['catch'](handleError(_0x373c89,null));};exports[_0x98a0('0x3e')]=function(_0x387937,_0x33ffc1){var _0x5e781={'raw':!![],'where':{'id':_0x387937[_0x98a0('0x3f')]['id']}},_0x4a68fe={};_0x4a68fe[_0x98a0('0x2c')]=_[_0x98a0('0x40')](db[_0x98a0('0x23')]['rawAttributes']);_0x4a68fe[_0x98a0('0x29')]=_[_0x98a0('0x40')](_0x387937[_0x98a0('0x29')]);_0x4a68fe[_0x98a0('0x2a')]=_[_0x98a0('0x2b')](_0x4a68fe[_0x98a0('0x2c')],_0x4a68fe[_0x98a0('0x29')]);_0x5e781[_0x98a0('0x2e')]=_[_0x98a0('0x2b')](_0x4a68fe[_0x98a0('0x2c')],qs['fields'](_0x387937['query']['fields']));_0x5e781[_0x98a0('0x2e')]=_0x5e781[_0x98a0('0x2e')][_0x98a0('0x2f')]?_0x5e781[_0x98a0('0x2e')]:_0x4a68fe[_0x98a0('0x2c')];if(_0x387937[_0x98a0('0x29')][_0x98a0('0x3a')]){_0x5e781[_0x98a0('0x3b')]=[{'all':!![]}];}_0x5e781=_[_0x98a0('0x38')]({},_0x5e781,_0x387937[_0x98a0('0x39')]);return db['MailServerOut'][_0x98a0('0x41')](_0x5e781)[_0x98a0('0x21')](handleEntityNotFound(_0x33ffc1,null))[_0x98a0('0x21')](respondWithResult(_0x33ffc1,null))[_0x98a0('0x42')](handleError(_0x33ffc1,null));};exports[_0x98a0('0x43')]=function(_0x3c6d89,_0x5223ab){return db[_0x98a0('0x23')][_0x98a0('0x43')](_0x3c6d89[_0x98a0('0x44')],{})[_0x98a0('0x21')](respondWithResult(_0x5223ab,0xc9))['catch'](handleError(_0x5223ab,null));};exports[_0x98a0('0x20')]=function(_0x41752b,_0xb03e2f){if(_0x41752b['body']['id']){delete _0x41752b[_0x98a0('0x44')]['id'];}return db[_0x98a0('0x23')][_0x98a0('0x41')]({'where':{'id':_0x41752b[_0x98a0('0x3f')]['id']}})['then'](handleEntityNotFound(_0xb03e2f,null))[_0x98a0('0x21')](saveUpdates(_0x41752b[_0x98a0('0x44')],null))[_0x98a0('0x21')](respondWithResult(_0xb03e2f,null))['catch'](handleError(_0xb03e2f,null));};exports[_0x98a0('0x45')]=function(_0x306514,_0x4a09a7){return db[_0x98a0('0x23')]['find']({'where':{'id':_0x306514['params']['id']}})[_0x98a0('0x21')](handleEntityNotFound(_0x4a09a7,null))['then'](removeEntity(_0x4a09a7,null))[_0x98a0('0x42')](handleError(_0x4a09a7,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 020c41a..c645e02 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 _0xd115=['rimraf','./mailServerOut.attributes','define','MailServerOut','mail_servers_out','util','api','moment','bluebird','request-promise'];(function(_0x3210a6,_0x5c6345){var _0x2121b0=function(_0x5f285d){while(--_0x5f285d){_0x3210a6['push'](_0x3210a6['shift']());}};_0x2121b0(++_0x5c6345);}(_0xd115,0x195));var _0x5d11=function(_0x456bde,_0x4bb586){_0x456bde=_0x456bde-0x0;var _0x36d30e=_0xd115[_0x456bde];return _0x36d30e;};'use strict';var _=require('lodash');var util=require(_0x5d11('0x0'));var logger=require('../../config/logger')(_0x5d11('0x1'));var moment=require(_0x5d11('0x2'));var BPromise=require(_0x5d11('0x3'));var rp=require(_0x5d11('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d11('0x5'));var config=require('../../config/environment');var attributes=require(_0x5d11('0x6'));module['exports']=function(_0x35a779,_0x128e9f){return _0x35a779[_0x5d11('0x7')](_0x5d11('0x8'),attributes,{'tableName':_0x5d11('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a91=['exports','define','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./mailServerOut.attributes'];(function(_0x1894f8,_0x5aa125){var _0x163a5c=function(_0x4b7d15){while(--_0x4b7d15){_0x1894f8['push'](_0x1894f8['shift']());}};_0x163a5c(++_0x5aa125);}(_0x3a91,0x1ec));var _0x13a9=function(_0x544ed8,_0x1d1dc4){_0x544ed8=_0x544ed8-0x0;var _0x439609=_0x3a91[_0x544ed8];return _0x439609;};'use strict';var _=require('lodash');var util=require(_0x13a9('0x0'));var logger=require(_0x13a9('0x1'))(_0x13a9('0x2'));var moment=require(_0x13a9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x13a9('0x4'));var rimraf=require(_0x13a9('0x5'));var config=require(_0x13a9('0x6'));var attributes=require(_0x13a9('0x7'));module[_0x13a9('0x8')]=function(_0xa0d044,_0x2e9d01){return _0xa0d044[_0x13a9('0x9')]('MailServerOut',attributes,{'tableName':'mail_servers_out','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 8326497..7efe2e8 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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x4d74ac,_0x488f0a){var _0x3a114f=function(_0x3b5de0){while(--_0x3b5de0){_0x4d74ac['push'](_0x4d74ac['shift']());}};_0x3a114f(++_0x488f0a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x43a8e2,_0x49db35){_0x43a8e2=_0x43a8e2-0x0;var _0x4d30fb=_0x5f2f[_0x43a8e2];return _0x4d30fb;};'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')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x100661,_0x3f6093){var _0x1c40e2=function(_0xfb545){while(--_0xfb545){_0x100661['push'](_0x100661['shift']());}};_0x1c40e2(++_0x3f6093);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index f131a7f..9d33d33 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 _0xbde0=['destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete'];(function(_0x398110,_0x2124a4){var _0x1c3111=function(_0x7293d7){while(--_0x7293d7){_0x398110['push'](_0x398110['shift']());}};_0x1c3111(++_0x2124a4);}(_0xbde0,0x190));var _0x0bde=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xbde0[_0x243b59];return _0x3e1676;};'use strict';var multer=require(_0x0bde('0x0'));var util=require('util');var path=require(_0x0bde('0x1'));var timeout=require(_0x0bde('0x2'));var express=require(_0x0bde('0x3'));var router=express[_0x0bde('0x4')]();var fs_extra=require(_0x0bde('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0bde('0x6'));var config=require(_0x0bde('0x7'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x0bde('0x8')](),controller[_0x0bde('0x9')]);router[_0x0bde('0xa')](_0x0bde('0xb'),auth[_0x0bde('0x8')](),controller[_0x0bde('0xc')]);router[_0x0bde('0xa')](_0x0bde('0xd'),auth['isAuthenticated'](),controller[_0x0bde('0xe')]);router[_0x0bde('0xf')]('/',auth[_0x0bde('0x8')](),controller[_0x0bde('0x10')]);router[_0x0bde('0x11')]('/:id',auth[_0x0bde('0x8')](),controller[_0x0bde('0x12')]);router[_0x0bde('0x13')]('/:id',auth[_0x0bde('0x8')](),controller[_0x0bde('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd6a5=['../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','index','get','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x2e7984,_0x19406f){var _0x3aa46a=function(_0x2bcf1e){while(--_0x2bcf1e){_0x2e7984['push'](_0x2e7984['shift']());}};_0x3aa46a(++_0x19406f);}(_0xd6a5,0x1f2));var _0x5d6a=function(_0x558a01,_0x5239e3){_0x558a01=_0x558a01-0x0;var _0x319bb8=_0xd6a5[_0x558a01];return _0x319bb8;};'use strict';var multer=require(_0x5d6a('0x0'));var util=require('util');var path=require(_0x5d6a('0x1'));var timeout=require(_0x5d6a('0x2'));var express=require(_0x5d6a('0x3'));var router=express[_0x5d6a('0x4')]();var fs_extra=require(_0x5d6a('0x5'));var auth=require(_0x5d6a('0x6'));var interaction=require(_0x5d6a('0x7'));var config=require('../../config/environment');var controller=require(_0x5d6a('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5d6a('0x9')]);router[_0x5d6a('0xa')]('/describe',auth[_0x5d6a('0xb')](),controller[_0x5d6a('0xc')]);router[_0x5d6a('0xa')](_0x5d6a('0xd'),auth[_0x5d6a('0xb')](),controller[_0x5d6a('0xe')]);router[_0x5d6a('0xf')]('/',auth[_0x5d6a('0xb')](),controller['create']);router[_0x5d6a('0x10')](_0x5d6a('0xd'),auth[_0x5d6a('0xb')](),controller[_0x5d6a('0x11')]);router[_0x5d6a('0x12')](_0x5d6a('0xd'),auth[_0x5d6a('0xb')](),controller[_0x5d6a('0x13')]);module[_0x5d6a('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 7bcccae..dadc950 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 _0x5f6f=['exports','STRING','name','sequelize'];(function(_0x3009c1,_0x428c34){var _0x5dec7b=function(_0x4409e1){while(--_0x4409e1){_0x3009c1['push'](_0x3009c1['shift']());}};_0x5dec7b(++_0x428c34);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x3c3039,_0xd0a1dc){_0x3c3039=_0x3c3039-0x0;var _0xc9710d=_0x5f6f[_0x3c3039];return _0xc9710d;};'use strict';var Sequelize=require(_0xf5f6('0x0'));module[_0xf5f6('0x1')]={'name':{'type':Sequelize[_0xf5f6('0x2')],'unique':_0xf5f6('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf5f6('0x2')]}}; \ No newline at end of file +var _0xe2fe=['sequelize','name'];(function(_0x28258a,_0x22f398){var _0x4e968e=function(_0xda8c73){while(--_0xda8c73){_0x28258a['push'](_0x28258a['shift']());}};_0x4e968e(++_0x22f398);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xee2f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xee2f('0x1'),'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 cc6762a..767e9cc 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 _0x16db=['rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','nolimit','sort','where','pick','filter','merge','options','MailSubstatus','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','update','then','destroy','error','stack','name','send','index'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x16db,0xfd));var _0xb16d=function(_0x21a098,_0x204c09){_0x21a098=_0x21a098-0x0;var _0x3233a5=_0x16db[_0x21a098];return _0x3233a5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb16d('0x0'));var jsonpatch=require(_0xb16d('0x1'));var rp=require(_0xb16d('0x2'));var moment=require(_0xb16d('0x3'));var BPromise=require(_0xb16d('0x4'));var Mustache=require(_0xb16d('0x5'));var util=require(_0xb16d('0x6'));var path=require(_0xb16d('0x7'));var sox=require(_0xb16d('0x8'));var csv=require('to-csv');var ejs=require(_0xb16d('0x9'));var fs=require('fs');var fs_extra=require(_0xb16d('0xa'));var _=require('lodash');var squel=require(_0xb16d('0xb'));var crypto=require(_0xb16d('0xc'));var jsforce=require(_0xb16d('0xd'));var deskjs=require(_0xb16d('0xe'));var toCsv=require(_0xb16d('0xf'));var querystring=require(_0xb16d('0x10'));var Papa=require('papaparse');var Redis=require(_0xb16d('0x11'));var authService=require(_0xb16d('0x12'));var qs=require(_0xb16d('0x13'));var as=require(_0xb16d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb16d('0x15'))(_0xb16d('0x16'));var utils=require(_0xb16d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xb16d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19c29d,_0x5d46f6){_0x5d46f6=_0x5d46f6||0xcc;return function(_0x88e79d){if(_0x88e79d){return _0x19c29d[_0xb16d('0x19')](_0x5d46f6);}return _0x19c29d[_0xb16d('0x1a')](_0x5d46f6)[_0xb16d('0x1b')]();};}function respondWithResult(_0x268ade,_0x2b3009){_0x2b3009=_0x2b3009||0xc8;return function(_0x18e039){if(_0x18e039){return _0x268ade['status'](_0x2b3009)['json'](_0x18e039);}};}function respondWithFilteredResult(_0x7b1afc,_0x2ba4fd){return function(_0x54a897){if(_0x54a897){var _0x389277=typeof _0x2ba4fd[_0xb16d('0x1c')]===_0xb16d('0x1d')&&typeof _0x2ba4fd['limit']===_0xb16d('0x1d');var _0x751571=_0x54a897[_0xb16d('0x1e')];var _0x74717c=_0x389277?0x0:_0x2ba4fd[_0xb16d('0x1c')];var _0x2dac5e=_0x389277?_0x54a897['count']:_0x2ba4fd['offset']+_0x2ba4fd[_0xb16d('0x1f')];var _0x2ca6bf;if(_0x2dac5e>=_0x751571){_0x2dac5e=_0x751571;_0x2ca6bf=0xc8;}else{_0x2ca6bf=0xce;}_0x7b1afc['status'](_0x2ca6bf);return _0x7b1afc['set'](_0xb16d('0x20'),_0x74717c+'-'+_0x2dac5e+'/'+_0x751571)[_0xb16d('0x21')](_0x54a897);}return null;};}function patchUpdates(_0x338d84){return function(_0x3b7c4b){try{jsonpatch[_0xb16d('0x22')](_0x3b7c4b,_0x338d84,!![]);}catch(_0x240769){return BPromise['reject'](_0x240769);}return _0x3b7c4b['save']();};}function saveUpdates(_0x4dc9f0,_0x2d6a9b){return function(_0x3b7ff5){if(_0x3b7ff5){return _0x3b7ff5[_0xb16d('0x23')](_0x4dc9f0)[_0xb16d('0x24')](function(_0x7c129c){return _0x7c129c;});}return null;};}function removeEntity(_0x54860f,_0x19eeef){return function(_0x3b57bd){if(_0x3b57bd){return _0x3b57bd[_0xb16d('0x25')]()['then'](function(){_0x54860f['status'](0xcc)[_0xb16d('0x1b')]();});}};}function handleEntityNotFound(_0x2c1e05,_0x4c8333){return function(_0x3a11b8){if(!_0x3a11b8){_0x2c1e05[_0xb16d('0x19')](0x194);}return _0x3a11b8;};}function handleError(_0x26055c,_0x6db067){_0x6db067=_0x6db067||0x1f4;return function(_0x4468e0){logger[_0xb16d('0x26')](_0x4468e0[_0xb16d('0x27')]);if(_0x4468e0['name']){delete _0x4468e0[_0xb16d('0x28')];}_0x26055c['status'](_0x6db067)[_0xb16d('0x29')](_0x4468e0);};}exports[_0xb16d('0x2a')]=function(_0x21c929,_0x144151){var _0x5e74d9={},_0x45ad14={},_0x4b0821={'count':0x0,'rows':[]};var _0x2ae678=_['map'](db['MailSubstatus'][_0xb16d('0x2b')],function(_0xbdaa25){return{'name':_0xbdaa25[_0xb16d('0x2c')],'type':_0xbdaa25[_0xb16d('0x2d')][_0xb16d('0x2e')]};});_0x45ad14[_0xb16d('0x2f')]=_[_0xb16d('0x30')](_0x2ae678,_0xb16d('0x28'));_0x45ad14['query']=_[_0xb16d('0x31')](_0x21c929['query']);_0x45ad14[_0xb16d('0x32')]=_[_0xb16d('0x33')](_0x45ad14['model'],_0x45ad14[_0xb16d('0x34')]);_0x5e74d9[_0xb16d('0x35')]=_[_0xb16d('0x33')](_0x45ad14[_0xb16d('0x2f')],qs[_0xb16d('0x36')](_0x21c929['query']['fields']));_0x5e74d9['attributes']=_0x5e74d9['attributes']['length']?_0x5e74d9[_0xb16d('0x35')]:_0x45ad14[_0xb16d('0x2f')];if(!_0x21c929[_0xb16d('0x34')]['hasOwnProperty'](_0xb16d('0x37'))){_0x5e74d9[_0xb16d('0x1f')]=qs[_0xb16d('0x1f')](_0x21c929[_0xb16d('0x34')][_0xb16d('0x1f')]);_0x5e74d9['offset']=qs[_0xb16d('0x1c')](_0x21c929[_0xb16d('0x34')][_0xb16d('0x1c')]);}_0x5e74d9['order']=qs[_0xb16d('0x38')](_0x21c929[_0xb16d('0x34')][_0xb16d('0x38')]);_0x5e74d9[_0xb16d('0x39')]=qs[_0xb16d('0x32')](_[_0xb16d('0x3a')](_0x21c929[_0xb16d('0x34')],_0x45ad14[_0xb16d('0x32')]),_0x2ae678);if(_0x21c929['query'][_0xb16d('0x3b')]){_0x5e74d9['where']=_[_0xb16d('0x3c')](_0x5e74d9[_0xb16d('0x39')],{'$or':_[_0xb16d('0x30')](_0x2ae678,function(_0x823776){if(_0x823776[_0xb16d('0x2d')]!=='VIRTUAL'){var _0x45ddf3={};_0x45ddf3[_0x823776[_0xb16d('0x28')]]={'$like':'%'+_0x21c929[_0xb16d('0x34')][_0xb16d('0x3b')]+'%'};return _0x45ddf3;}})});}_0x5e74d9=_[_0xb16d('0x3c')]({},_0x5e74d9,_0x21c929[_0xb16d('0x3d')]);var _0x4dfe37={'where':_0x5e74d9[_0xb16d('0x39')]};return db[_0xb16d('0x3e')][_0xb16d('0x1e')](_0x4dfe37)['then'](function(_0x31db24){_0x4b0821['count']=_0x31db24;if(_0x21c929[_0xb16d('0x34')][_0xb16d('0x3f')]){_0x5e74d9[_0xb16d('0x40')]=[{'all':!![]}];}return db[_0xb16d('0x3e')][_0xb16d('0x41')](_0x5e74d9);})[_0xb16d('0x24')](function(_0x12b094){_0x4b0821[_0xb16d('0x42')]=_0x12b094;return _0x4b0821;})[_0xb16d('0x24')](respondWithFilteredResult(_0x144151,_0x5e74d9))[_0xb16d('0x43')](handleError(_0x144151,null));};exports[_0xb16d('0x44')]=function(_0x4d9259,_0x3577dd){var _0x366cf4={'raw':!![],'where':{'id':_0x4d9259['params']['id']}},_0x150955={};_0x150955[_0xb16d('0x2f')]=_[_0xb16d('0x31')](db[_0xb16d('0x3e')]['rawAttributes']);_0x150955[_0xb16d('0x34')]=_[_0xb16d('0x31')](_0x4d9259['query']);_0x150955[_0xb16d('0x32')]=_['intersection'](_0x150955[_0xb16d('0x2f')],_0x150955[_0xb16d('0x34')]);_0x366cf4[_0xb16d('0x35')]=_[_0xb16d('0x33')](_0x150955[_0xb16d('0x2f')],qs[_0xb16d('0x36')](_0x4d9259['query'][_0xb16d('0x36')]));_0x366cf4[_0xb16d('0x35')]=_0x366cf4[_0xb16d('0x35')]['length']?_0x366cf4[_0xb16d('0x35')]:_0x150955['model'];if(_0x4d9259[_0xb16d('0x34')][_0xb16d('0x3f')]){_0x366cf4[_0xb16d('0x40')]=[{'all':!![]}];}_0x366cf4=_[_0xb16d('0x3c')]({},_0x366cf4,_0x4d9259[_0xb16d('0x3d')]);return db[_0xb16d('0x3e')][_0xb16d('0x45')](_0x366cf4)[_0xb16d('0x24')](handleEntityNotFound(_0x3577dd,null))[_0xb16d('0x24')](respondWithResult(_0x3577dd,null))[_0xb16d('0x43')](handleError(_0x3577dd,null));};exports['create']=function(_0x8cbfec,_0x52d364){return db[_0xb16d('0x3e')][_0xb16d('0x46')](_0x8cbfec[_0xb16d('0x47')],{})[_0xb16d('0x24')](respondWithResult(_0x52d364,0xc9))[_0xb16d('0x43')](handleError(_0x52d364,null));};exports['update']=function(_0x1b3436,_0x4fe541){if(_0x1b3436[_0xb16d('0x47')]['id']){delete _0x1b3436['body']['id'];}return db[_0xb16d('0x3e')][_0xb16d('0x45')]({'where':{'id':_0x1b3436[_0xb16d('0x48')]['id']}})['then'](handleEntityNotFound(_0x4fe541,null))[_0xb16d('0x24')](saveUpdates(_0x1b3436['body'],null))[_0xb16d('0x24')](respondWithResult(_0x4fe541,null))[_0xb16d('0x43')](handleError(_0x4fe541,null));};exports[_0xb16d('0x25')]=function(_0x46c5bd,_0x3d300a){return db[_0xb16d('0x3e')]['find']({'where':{'id':_0x46c5bd[_0xb16d('0x48')]['id']}})[_0xb16d('0x24')](handleEntityNotFound(_0x3d300a,null))[_0xb16d('0x24')](removeEntity(_0x3d300a,null))[_0xb16d('0x43')](handleError(_0x3d300a,null));};exports['describe']=function(_0x34996c,_0x3b2f03){return db[_0xb16d('0x3e')][_0xb16d('0x49')]()[_0xb16d('0x24')](respondWithResult(_0x3b2f03,null))[_0xb16d('0x43')](handleError(_0x3b2f03,null));}; \ No newline at end of file +var _0x8318=['index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','options','MailSubstatus','include','findAll','rows','show','rawAttributes','includeAll','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send'];(function(_0x2c08e1,_0x22bdf5){var _0x511e72=function(_0x10a92d){while(--_0x10a92d){_0x2c08e1['push'](_0x2c08e1['shift']());}};_0x511e72(++_0x22bdf5);}(_0x8318,0x6a));var _0x8831=function(_0x5536a9,_0x3fb407){_0x5536a9=_0x5536a9-0x0;var _0x374b32=_0x8318[_0x5536a9];return _0x374b32;};'use strict';var emlformat=require(_0x8831('0x0'));var rimraf=require(_0x8831('0x1'));var zipdir=require(_0x8831('0x2'));var jsonpatch=require(_0x8831('0x3'));var rp=require(_0x8831('0x4'));var moment=require(_0x8831('0x5'));var BPromise=require(_0x8831('0x6'));var Mustache=require('mustache');var util=require(_0x8831('0x7'));var path=require('path');var sox=require(_0x8831('0x8'));var csv=require(_0x8831('0x9'));var ejs=require(_0x8831('0xa'));var fs=require('fs');var fs_extra=require(_0x8831('0xb'));var _=require(_0x8831('0xc'));var squel=require('squel');var crypto=require(_0x8831('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8831('0xe'));var toCsv=require(_0x8831('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8831('0xf'));var authService=require(_0x8831('0x10'));var qs=require(_0x8831('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8831('0x12'));var logger=require('../../config/logger')(_0x8831('0x13'));var utils=require('../../config/utils');var config=require(_0x8831('0x14'));var licenseUtil=require(_0x8831('0x15'));var db=require(_0x8831('0x16'))['db'];function respondWithStatusCode(_0x5d552a,_0x124d62){_0x124d62=_0x124d62||0xcc;return function(_0xc34820){if(_0xc34820){return _0x5d552a[_0x8831('0x17')](_0x124d62);}return _0x5d552a[_0x8831('0x18')](_0x124d62)[_0x8831('0x19')]();};}function respondWithResult(_0x5c74dc,_0x6c4b4f){_0x6c4b4f=_0x6c4b4f||0xc8;return function(_0x5dfe50){if(_0x5dfe50){return _0x5c74dc['status'](_0x6c4b4f)[_0x8831('0x1a')](_0x5dfe50);}};}function respondWithFilteredResult(_0x55bdbe,_0x1343bc){return function(_0x18abae){if(_0x18abae){var _0x5a43a6=typeof _0x1343bc[_0x8831('0x1b')]===_0x8831('0x1c')&&typeof _0x1343bc[_0x8831('0x1d')]===_0x8831('0x1c');var _0x3127b8=_0x18abae[_0x8831('0x1e')];var _0x1defe5=_0x5a43a6?0x0:_0x1343bc[_0x8831('0x1b')];var _0x1c678f=_0x5a43a6?_0x18abae['count']:_0x1343bc['offset']+_0x1343bc[_0x8831('0x1d')];var _0x1c7ab9;if(_0x1c678f>=_0x3127b8){_0x1c678f=_0x3127b8;_0x1c7ab9=0xc8;}else{_0x1c7ab9=0xce;}_0x55bdbe['status'](_0x1c7ab9);return _0x55bdbe[_0x8831('0x1f')]('Content-Range',_0x1defe5+'-'+_0x1c678f+'/'+_0x3127b8)[_0x8831('0x1a')](_0x18abae);}return null;};}function patchUpdates(_0x1610cd){return function(_0x45b613){try{jsonpatch[_0x8831('0x20')](_0x45b613,_0x1610cd,!![]);}catch(_0x873d86){return BPromise['reject'](_0x873d86);}return _0x45b613[_0x8831('0x21')]();};}function saveUpdates(_0x347ec5,_0x50316f){return function(_0x591f74){if(_0x591f74){return _0x591f74[_0x8831('0x22')](_0x347ec5)[_0x8831('0x23')](function(_0x5c9fdd){return _0x5c9fdd;});}return null;};}function removeEntity(_0x337902,_0x5154c9){return function(_0x47d68f){if(_0x47d68f){return _0x47d68f[_0x8831('0x24')]()[_0x8831('0x23')](function(){_0x337902[_0x8831('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8b0629,_0x3da1da){return function(_0x54ed3e){if(!_0x54ed3e){_0x8b0629['sendStatus'](0x194);}return _0x54ed3e;};}function handleError(_0x59991b,_0x18d34e){_0x18d34e=_0x18d34e||0x1f4;return function(_0x4997b0){logger[_0x8831('0x25')](_0x4997b0['stack']);if(_0x4997b0['name']){delete _0x4997b0[_0x8831('0x26')];}_0x59991b[_0x8831('0x18')](_0x18d34e)[_0x8831('0x27')](_0x4997b0);};}exports[_0x8831('0x28')]=function(_0x51db09,_0x3a260f){var _0x48888d={},_0x426724={},_0x5e20f5={'count':0x0,'rows':[]};var _0x42d33d=_[_0x8831('0x29')](db['MailSubstatus']['rawAttributes'],function(_0x121296){return{'name':_0x121296[_0x8831('0x2a')],'type':_0x121296['type'][_0x8831('0x2b')]};});_0x426724[_0x8831('0x2c')]=_[_0x8831('0x29')](_0x42d33d,'name');_0x426724[_0x8831('0x2d')]=_[_0x8831('0x2e')](_0x51db09[_0x8831('0x2d')]);_0x426724[_0x8831('0x2f')]=_[_0x8831('0x30')](_0x426724['model'],_0x426724[_0x8831('0x2d')]);_0x48888d[_0x8831('0x31')]=_[_0x8831('0x30')](_0x426724[_0x8831('0x2c')],qs[_0x8831('0x32')](_0x51db09[_0x8831('0x2d')]['fields']));_0x48888d[_0x8831('0x31')]=_0x48888d[_0x8831('0x31')][_0x8831('0x33')]?_0x48888d[_0x8831('0x31')]:_0x426724[_0x8831('0x2c')];if(!_0x51db09['query']['hasOwnProperty'](_0x8831('0x34'))){_0x48888d[_0x8831('0x1d')]=qs[_0x8831('0x1d')](_0x51db09[_0x8831('0x2d')][_0x8831('0x1d')]);_0x48888d[_0x8831('0x1b')]=qs[_0x8831('0x1b')](_0x51db09['query'][_0x8831('0x1b')]);}_0x48888d[_0x8831('0x35')]=qs[_0x8831('0x36')](_0x51db09[_0x8831('0x2d')]['sort']);_0x48888d[_0x8831('0x37')]=qs[_0x8831('0x2f')](_['pick'](_0x51db09['query'],_0x426724[_0x8831('0x2f')]),_0x42d33d);if(_0x51db09[_0x8831('0x2d')][_0x8831('0x38')]){_0x48888d[_0x8831('0x37')]=_[_0x8831('0x39')](_0x48888d[_0x8831('0x37')],{'$or':_[_0x8831('0x29')](_0x42d33d,function(_0x24f385){if(_0x24f385[_0x8831('0x3a')]!=='VIRTUAL'){var _0x242a09={};_0x242a09[_0x24f385['name']]={'$like':'%'+_0x51db09[_0x8831('0x2d')][_0x8831('0x38')]+'%'};return _0x242a09;}})});}_0x48888d=_[_0x8831('0x39')]({},_0x48888d,_0x51db09[_0x8831('0x3b')]);var _0x78bea4={'where':_0x48888d[_0x8831('0x37')]};return db[_0x8831('0x3c')][_0x8831('0x1e')](_0x78bea4)[_0x8831('0x23')](function(_0x8099a3){_0x5e20f5[_0x8831('0x1e')]=_0x8099a3;if(_0x51db09[_0x8831('0x2d')]['includeAll']){_0x48888d[_0x8831('0x3d')]=[{'all':!![]}];}return db[_0x8831('0x3c')][_0x8831('0x3e')](_0x48888d);})[_0x8831('0x23')](function(_0x308cdd){_0x5e20f5[_0x8831('0x3f')]=_0x308cdd;return _0x5e20f5;})['then'](respondWithFilteredResult(_0x3a260f,_0x48888d))['catch'](handleError(_0x3a260f,null));};exports[_0x8831('0x40')]=function(_0xa95488,_0x4c9b51){var _0x40c575={'raw':!![],'where':{'id':_0xa95488['params']['id']}},_0x4ef8eb={};_0x4ef8eb[_0x8831('0x2c')]=_[_0x8831('0x2e')](db[_0x8831('0x3c')][_0x8831('0x41')]);_0x4ef8eb[_0x8831('0x2d')]=_[_0x8831('0x2e')](_0xa95488['query']);_0x4ef8eb[_0x8831('0x2f')]=_[_0x8831('0x30')](_0x4ef8eb[_0x8831('0x2c')],_0x4ef8eb[_0x8831('0x2d')]);_0x40c575['attributes']=_['intersection'](_0x4ef8eb[_0x8831('0x2c')],qs['fields'](_0xa95488[_0x8831('0x2d')]['fields']));_0x40c575[_0x8831('0x31')]=_0x40c575[_0x8831('0x31')]['length']?_0x40c575[_0x8831('0x31')]:_0x4ef8eb[_0x8831('0x2c')];if(_0xa95488['query'][_0x8831('0x42')]){_0x40c575['include']=[{'all':!![]}];}_0x40c575=_['merge']({},_0x40c575,_0xa95488[_0x8831('0x3b')]);return db[_0x8831('0x3c')][_0x8831('0x43')](_0x40c575)[_0x8831('0x23')](handleEntityNotFound(_0x4c9b51,null))[_0x8831('0x23')](respondWithResult(_0x4c9b51,null))[_0x8831('0x44')](handleError(_0x4c9b51,null));};exports[_0x8831('0x45')]=function(_0x4d0edb,_0x18cb55){return db['MailSubstatus'][_0x8831('0x45')](_0x4d0edb['body'],{})['then'](respondWithResult(_0x18cb55,0xc9))[_0x8831('0x44')](handleError(_0x18cb55,null));};exports[_0x8831('0x22')]=function(_0x3e10d0,_0x59620e){if(_0x3e10d0['body']['id']){delete _0x3e10d0[_0x8831('0x46')]['id'];}return db['MailSubstatus'][_0x8831('0x43')]({'where':{'id':_0x3e10d0[_0x8831('0x47')]['id']}})[_0x8831('0x23')](handleEntityNotFound(_0x59620e,null))[_0x8831('0x23')](saveUpdates(_0x3e10d0[_0x8831('0x46')],null))['then'](respondWithResult(_0x59620e,null))[_0x8831('0x44')](handleError(_0x59620e,null));};exports['destroy']=function(_0x163a91,_0x277286){return db[_0x8831('0x3c')][_0x8831('0x43')]({'where':{'id':_0x163a91[_0x8831('0x47')]['id']}})['then'](handleEntityNotFound(_0x277286,null))[_0x8831('0x23')](removeEntity(_0x277286,null))[_0x8831('0x44')](handleError(_0x277286,null));};exports[_0x8831('0x48')]=function(_0x426e9c,_0x166faa){return db['MailSubstatus'][_0x8831('0x48')]()[_0x8831('0x23')](respondWithResult(_0x166faa,null))[_0x8831('0x44')](handleError(_0x166faa,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 8fb285b..f9f0da5 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 _0x436f=['bluebird','request-promise','path','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','moment'];(function(_0x44390d,_0x55b21a){var _0x648614=function(_0xd5760){while(--_0xd5760){_0x44390d['push'](_0x44390d['shift']());}};_0x648614(++_0x55b21a);}(_0x436f,0x110));var _0xf436=function(_0x4d62d7,_0x380ce7){_0x4d62d7=_0x4d62d7-0x0;var _0x251d8e=_0x436f[_0x4d62d7];return _0x251d8e;};'use strict';var _=require(_0xf436('0x0'));var util=require(_0xf436('0x1'));var logger=require(_0xf436('0x2'))('api');var moment=require(_0xf436('0x3'));var BPromise=require(_0xf436('0x4'));var rp=require(_0xf436('0x5'));var fs=require('fs');var path=require(_0xf436('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf436('0x7'));module[_0xf436('0x8')]=function(_0x1b8890,_0x12c1e3){return _0x1b8890[_0xf436('0x9')](_0xf436('0xa'),attributes,{'tableName':_0xf436('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad03=['../../config/environment','exports','mail_substatuses','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xad03,0x1e3));var _0x3ad0=function(_0x7a7ac9,_0x5df807){_0x7a7ac9=_0x7a7ac9-0x0;var _0x2ce03e=_0xad03[_0x7a7ac9];return _0x2ce03e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3ad0('0x0'))(_0x3ad0('0x1'));var moment=require(_0x3ad0('0x2'));var BPromise=require(_0x3ad0('0x3'));var rp=require(_0x3ad0('0x4'));var fs=require('fs');var path=require(_0x3ad0('0x5'));var rimraf=require(_0x3ad0('0x6'));var config=require(_0x3ad0('0x7'));var attributes=require('./mailSubstatus.attributes');module[_0x3ad0('0x8')]=function(_0x50ec90,_0x504d5a){return _0x50ec90['define']('MailSubstatus',attributes,{'tableName':_0x3ad0('0x9'),'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 926c7f1..2030dba 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 _0x3bee=['MailSubstatus,\x20%s,\x20%s','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code'];(function(_0x8d3b4b,_0xd1db47){var _0x509753=function(_0x2e5ef8){while(--_0x2e5ef8){_0x8d3b4b['push'](_0x8d3b4b['shift']());}};_0x509753(++_0xd1db47);}(_0x3bee,0x1bc));var _0xe3be=function(_0x344a1a,_0x16f2e4){_0x344a1a=_0x344a1a-0x0;var _0x388c9d=_0x3bee[_0x344a1a];return _0x388c9d;};'use strict';var _=require(_0xe3be('0x0'));var util=require(_0xe3be('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe3be('0x2'));var fs=require('fs');var Redis=require(_0xe3be('0x3'));var db=require(_0xe3be('0x4'))['db'];var utils=require(_0xe3be('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe3be('0x6'));var jayson=require(_0xe3be('0x7'));var client=jayson['client'][_0xe3be('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b0a15,_0x39830c,_0x240ad2){return new BPromise(function(_0x29b30f,_0x4414ef){return client[_0xe3be('0x9')](_0x1b0a15,_0x240ad2)[_0xe3be('0xa')](function(_0x21cd54){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x39830c,_0xe3be('0xb'));logger[_0xe3be('0xc')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x39830c,_0xe3be('0xb'),JSON[_0xe3be('0xd')](_0x21cd54));if(_0x21cd54[_0xe3be('0xe')]){if(_0x21cd54[_0xe3be('0xe')][_0xe3be('0xf')]===0x1f4){logger['error'](_0xe3be('0x10'),_0x39830c,_0x21cd54[_0xe3be('0xe')]['message']);return _0x4414ef(_0x21cd54[_0xe3be('0xe')][_0xe3be('0x11')]);}logger[_0xe3be('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x39830c,_0x21cd54[_0xe3be('0xe')]['message']);return _0x29b30f(_0x21cd54['error'][_0xe3be('0x11')]);}else{logger[_0xe3be('0x12')](_0xe3be('0x10'),_0x39830c,'request\x20sent');_0x29b30f(_0x21cd54[_0xe3be('0x13')][_0xe3be('0x11')]);}})['catch'](function(_0xba2d45){logger[_0xe3be('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x39830c,_0xba2d45);_0x4414ef(_0xba2d45);});});} \ No newline at end of file +var _0x3145=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','ioredis'];(function(_0x3549f8,_0x18d927){var _0x1fc988=function(_0x20110b){while(--_0x20110b){_0x3549f8['push'](_0x3549f8['shift']());}};_0x1fc988(++_0x18d927);}(_0x3145,0x11d));var _0x5314=function(_0xbd3401,_0x5c8246){_0xbd3401=_0xbd3401-0x0;var _0x1e3e2d=_0x3145[_0xbd3401];return _0x1e3e2d;};'use strict';var _=require('lodash');var util=require(_0x5314('0x0'));var moment=require('moment');var BPromise=require(_0x5314('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5314('0x2'));var db=require(_0x5314('0x3'))['db'];var utils=require(_0x5314('0x4'));var logger=require('../../config/logger')(_0x5314('0x5'));var config=require(_0x5314('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5314('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a355f,_0x53ba87,_0x2936dd){return new BPromise(function(_0x3a9fcd,_0x3afb29){return client['request'](_0x1a355f,_0x2936dd)[_0x5314('0x8')](function(_0x1757a4){logger['info'](_0x5314('0x9'),_0x53ba87,_0x5314('0xa'));logger['debug'](_0x5314('0xb'),_0x53ba87,'request\x20sent',JSON[_0x5314('0xc')](_0x1757a4));if(_0x1757a4[_0x5314('0xd')]){if(_0x1757a4[_0x5314('0xd')][_0x5314('0xe')]===0x1f4){logger[_0x5314('0xd')](_0x5314('0x9'),_0x53ba87,_0x1757a4[_0x5314('0xd')][_0x5314('0xf')]);return _0x3afb29(_0x1757a4[_0x5314('0xd')]['message']);}logger[_0x5314('0xd')](_0x5314('0x9'),_0x53ba87,_0x1757a4[_0x5314('0xd')][_0x5314('0xf')]);return _0x3a9fcd(_0x1757a4['error']['message']);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x53ba87,_0x5314('0xa'));_0x3a9fcd(_0x1757a4[_0x5314('0x10')][_0x5314('0xf')]);}})[_0x5314('0x11')](function(_0x9f7fcb){logger['error'](_0x5314('0x9'),_0x53ba87,_0x9f7fcb);_0x3afb29(_0x9f7fcb);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 216c6b0..05d7b33 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 _0x5a97=['./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x5a97,0x1f2));var _0x75a9=function(_0x289332,_0x2795a5){_0x289332=_0x289332-0x0;var _0x22aa28=_0x5a97[_0x289332];return _0x22aa28;};'use strict';var multer=require('multer');var util=require(_0x75a9('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75a9('0x1'));var router=express[_0x75a9('0x2')]();var fs_extra=require(_0x75a9('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x75a9('0x4'));var config=require(_0x75a9('0x5'));var controller=require(_0x75a9('0x6'));router[_0x75a9('0x7')]('/',auth[_0x75a9('0x8')](),controller[_0x75a9('0x9')]);router['get'](_0x75a9('0xa'),auth[_0x75a9('0x8')](),controller[_0x75a9('0xb')]);router[_0x75a9('0x7')](_0x75a9('0xc'),auth['isAuthenticated'](),controller[_0x75a9('0xd')]);router[_0x75a9('0xe')]('/',auth['isAuthenticated'](),controller[_0x75a9('0xf')]);router[_0x75a9('0x10')](_0x75a9('0xc'),auth[_0x75a9('0x8')](),controller[_0x75a9('0x11')]);router[_0x75a9('0x12')](_0x75a9('0xc'),auth[_0x75a9('0x8')](),controller[_0x75a9('0x13')]);module[_0x75a9('0x14')]=router; \ No newline at end of file +var _0xa60a=['../../components/auth/service','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3d4e74,_0x21b4e5){var _0x57613d=function(_0x2fa3b3){while(--_0x2fa3b3){_0x3d4e74['push'](_0x3d4e74['shift']());}};_0x57613d(++_0x21b4e5);}(_0xa60a,0x86));var _0xaa60=function(_0x596428,_0x306f4e){_0x596428=_0x596428-0x0;var _0x471d4d=_0xa60a[_0x596428];return _0x471d4d;};'use strict';var multer=require(_0xaa60('0x0'));var util=require(_0xaa60('0x1'));var path=require(_0xaa60('0x2'));var timeout=require(_0xaa60('0x3'));var express=require(_0xaa60('0x4'));var router=express[_0xaa60('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xaa60('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xaa60('0x7')](),controller['index']);router[_0xaa60('0x8')](_0xaa60('0x9'),auth[_0xaa60('0x7')](),controller[_0xaa60('0xa')]);router[_0xaa60('0x8')](_0xaa60('0xb'),auth['isAuthenticated'](),controller[_0xaa60('0xc')]);router[_0xaa60('0xd')]('/',auth['isAuthenticated'](),controller[_0xaa60('0xe')]);router[_0xaa60('0xf')](_0xaa60('0xb'),auth[_0xaa60('0x7')](),controller[_0xaa60('0x10')]);router[_0xaa60('0x11')](_0xaa60('0xb'),auth['isAuthenticated'](),controller[_0xaa60('0x12')]);module[_0xaa60('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 8c0f57a..98fae68 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x9bde,0xe1));var _0xe9bd=function(_0x16e98c,_0x4febcb){_0x16e98c=_0x16e98c-0x0;var _0x46d3a6=_0x9bde[_0x16e98c];return _0x46d3a6;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x2c6bad,_0x29ffed){var _0x5f5435=function(_0x23f89b){while(--_0x23f89b){_0x2c6bad['push'](_0x2c6bad['shift']());}};_0x5f5435(++_0x29ffed);}(_0x34e8,0x12c));var _0x834e=function(_0x19a65a,_0x3a0d1c){_0x19a65a=_0x19a65a-0x0;var _0x28dfe5=_0x34e8[_0x19a65a];return _0x28dfe5;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 9ceca77..1d2adb0 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 _0x4a7c=['zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','find','create','body','describe','rimraf'];(function(_0x55111b,_0x4d7848){var _0x5e343c=function(_0x104aee){while(--_0x104aee){_0x55111b['push'](_0x55111b['shift']());}};_0x5e343c(++_0x4d7848);}(_0x4a7c,0x12b));var _0xc4a7=function(_0x19da38,_0xc24ab4){_0x19da38=_0x19da38-0x0;var _0x4e63ee=_0x4a7c[_0x19da38];return _0x4e63ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4a7('0x0'));var zipdir=require(_0xc4a7('0x1'));var jsonpatch=require(_0xc4a7('0x2'));var rp=require(_0xc4a7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc4a7('0x4'));var util=require(_0xc4a7('0x5'));var path=require(_0xc4a7('0x6'));var sox=require('sox');var csv=require(_0xc4a7('0x7'));var ejs=require(_0xc4a7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4a7('0x9'));var squel=require(_0xc4a7('0xa'));var crypto=require(_0xc4a7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc4a7('0x7'));var querystring=require('querystring');var Papa=require(_0xc4a7('0xc'));var Redis=require(_0xc4a7('0xd'));var authService=require(_0xc4a7('0xe'));var qs=require(_0xc4a7('0xf'));var as=require(_0xc4a7('0x10'));var hardwareService=require(_0xc4a7('0x11'));var logger=require(_0xc4a7('0x12'))(_0xc4a7('0x13'));var utils=require('../../config/utils');var config=require(_0xc4a7('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc4a7('0x15'))['db'];function respondWithStatusCode(_0x1c3b46,_0x2d40ed){_0x2d40ed=_0x2d40ed||0xcc;return function(_0x4b685a){if(_0x4b685a){return _0x1c3b46[_0xc4a7('0x16')](_0x2d40ed);}return _0x1c3b46['status'](_0x2d40ed)[_0xc4a7('0x17')]();};}function respondWithResult(_0x56c35a,_0x687f80){_0x687f80=_0x687f80||0xc8;return function(_0x215c85){if(_0x215c85){return _0x56c35a[_0xc4a7('0x18')](_0x687f80)[_0xc4a7('0x19')](_0x215c85);}};}function respondWithFilteredResult(_0xc0d685,_0x287c51){return function(_0x19c56b){if(_0x19c56b){var _0x32c327=typeof _0x287c51[_0xc4a7('0x1a')]===_0xc4a7('0x1b')&&typeof _0x287c51[_0xc4a7('0x1c')]===_0xc4a7('0x1b');var _0x1b1b9b=_0x19c56b[_0xc4a7('0x1d')];var _0x3a776b=_0x32c327?0x0:_0x287c51[_0xc4a7('0x1a')];var _0x196460=_0x32c327?_0x19c56b[_0xc4a7('0x1d')]:_0x287c51[_0xc4a7('0x1a')]+_0x287c51[_0xc4a7('0x1c')];var _0x476da1;if(_0x196460>=_0x1b1b9b){_0x196460=_0x1b1b9b;_0x476da1=0xc8;}else{_0x476da1=0xce;}_0xc0d685[_0xc4a7('0x18')](_0x476da1);return _0xc0d685[_0xc4a7('0x1e')]('Content-Range',_0x3a776b+'-'+_0x196460+'/'+_0x1b1b9b)[_0xc4a7('0x19')](_0x19c56b);}return null;};}function patchUpdates(_0x5d99bd){return function(_0x2cc2f7){try{jsonpatch[_0xc4a7('0x1f')](_0x2cc2f7,_0x5d99bd,!![]);}catch(_0x37f1c2){return BPromise[_0xc4a7('0x20')](_0x37f1c2);}return _0x2cc2f7[_0xc4a7('0x21')]();};}function saveUpdates(_0x1b09ac,_0x2efa8e){return function(_0x2830ce){if(_0x2830ce){return _0x2830ce[_0xc4a7('0x22')](_0x1b09ac)[_0xc4a7('0x23')](function(_0x5c02b0){return _0x5c02b0;});}return null;};}function removeEntity(_0x57bfaa,_0x4e62da){return function(_0x586755){if(_0x586755){return _0x586755[_0xc4a7('0x24')]()[_0xc4a7('0x23')](function(){_0x57bfaa['status'](0xcc)[_0xc4a7('0x17')]();});}};}function handleEntityNotFound(_0x3d8a5c,_0x3672c0){return function(_0x4e4868){if(!_0x4e4868){_0x3d8a5c['sendStatus'](0x194);}return _0x4e4868;};}function handleError(_0x516232,_0x518b67){_0x518b67=_0x518b67||0x1f4;return function(_0x5dd209){logger[_0xc4a7('0x25')](_0x5dd209[_0xc4a7('0x26')]);if(_0x5dd209[_0xc4a7('0x27')]){delete _0x5dd209[_0xc4a7('0x27')];}_0x516232[_0xc4a7('0x18')](_0x518b67)[_0xc4a7('0x28')](_0x5dd209);};}exports[_0xc4a7('0x29')]=function(_0x2bd2cb,_0x5b91a5){var _0x1d3c10={},_0x24d500={},_0x441f2d={'count':0x0,'rows':[]};var _0x4fe8a0=_[_0xc4a7('0x2a')](db[_0xc4a7('0x2b')][_0xc4a7('0x2c')],function(_0x329d3a){return{'name':_0x329d3a[_0xc4a7('0x2d')],'type':_0x329d3a[_0xc4a7('0x2e')][_0xc4a7('0x2f')]};});_0x24d500['model']=_['map'](_0x4fe8a0,'name');_0x24d500[_0xc4a7('0x30')]=_['keys'](_0x2bd2cb[_0xc4a7('0x30')]);_0x24d500[_0xc4a7('0x31')]=_[_0xc4a7('0x32')](_0x24d500[_0xc4a7('0x33')],_0x24d500[_0xc4a7('0x30')]);_0x1d3c10[_0xc4a7('0x34')]=_[_0xc4a7('0x32')](_0x24d500['model'],qs[_0xc4a7('0x35')](_0x2bd2cb[_0xc4a7('0x30')][_0xc4a7('0x35')]));_0x1d3c10[_0xc4a7('0x34')]=_0x1d3c10['attributes'][_0xc4a7('0x36')]?_0x1d3c10[_0xc4a7('0x34')]:_0x24d500['model'];if(!_0x2bd2cb['query'][_0xc4a7('0x37')](_0xc4a7('0x38'))){_0x1d3c10[_0xc4a7('0x1c')]=qs[_0xc4a7('0x1c')](_0x2bd2cb[_0xc4a7('0x30')][_0xc4a7('0x1c')]);_0x1d3c10[_0xc4a7('0x1a')]=qs['offset'](_0x2bd2cb[_0xc4a7('0x30')][_0xc4a7('0x1a')]);}_0x1d3c10['order']=qs[_0xc4a7('0x39')](_0x2bd2cb[_0xc4a7('0x30')][_0xc4a7('0x39')]);_0x1d3c10[_0xc4a7('0x3a')]=qs[_0xc4a7('0x31')](_[_0xc4a7('0x3b')](_0x2bd2cb['query'],_0x24d500[_0xc4a7('0x31')]),_0x4fe8a0);if(_0x2bd2cb[_0xc4a7('0x30')][_0xc4a7('0x3c')]){_0x1d3c10[_0xc4a7('0x3a')]=_[_0xc4a7('0x3d')](_0x1d3c10[_0xc4a7('0x3a')],{'$or':_['map'](_0x4fe8a0,function(_0x59d452){if(_0x59d452[_0xc4a7('0x2e')]!==_0xc4a7('0x3e')){var _0x51e53f={};_0x51e53f[_0x59d452['name']]={'$like':'%'+_0x2bd2cb[_0xc4a7('0x30')]['filter']+'%'};return _0x51e53f;}})});}_0x1d3c10=_['merge']({},_0x1d3c10,_0x2bd2cb[_0xc4a7('0x3f')]);var _0x203d83={'where':_0x1d3c10[_0xc4a7('0x3a')]};return db[_0xc4a7('0x2b')][_0xc4a7('0x1d')](_0x203d83)[_0xc4a7('0x23')](function(_0x226e7f){_0x441f2d[_0xc4a7('0x1d')]=_0x226e7f;if(_0x2bd2cb[_0xc4a7('0x30')][_0xc4a7('0x40')]){_0x1d3c10['include']=[{'all':!![]}];}return db[_0xc4a7('0x2b')][_0xc4a7('0x41')](_0x1d3c10);})[_0xc4a7('0x23')](function(_0x73609){_0x441f2d['rows']=_0x73609;return _0x441f2d;})[_0xc4a7('0x23')](respondWithFilteredResult(_0x5b91a5,_0x1d3c10))[_0xc4a7('0x42')](handleError(_0x5b91a5,null));};exports[_0xc4a7('0x43')]=function(_0x4d3f3c,_0x4c4f1b){var _0x67e942={'raw':!![],'where':{'id':_0x4d3f3c[_0xc4a7('0x44')]['id']}},_0x41ec60={};_0x41ec60[_0xc4a7('0x33')]=_['keys'](db['MailTransferReport'][_0xc4a7('0x2c')]);_0x41ec60[_0xc4a7('0x30')]=_[_0xc4a7('0x45')](_0x4d3f3c[_0xc4a7('0x30')]);_0x41ec60[_0xc4a7('0x31')]=_['intersection'](_0x41ec60[_0xc4a7('0x33')],_0x41ec60[_0xc4a7('0x30')]);_0x67e942[_0xc4a7('0x34')]=_[_0xc4a7('0x32')](_0x41ec60[_0xc4a7('0x33')],qs['fields'](_0x4d3f3c[_0xc4a7('0x30')][_0xc4a7('0x35')]));_0x67e942[_0xc4a7('0x34')]=_0x67e942[_0xc4a7('0x34')]['length']?_0x67e942['attributes']:_0x41ec60[_0xc4a7('0x33')];if(_0x4d3f3c['query'][_0xc4a7('0x40')]){_0x67e942[_0xc4a7('0x46')]=[{'all':!![]}];}_0x67e942=_[_0xc4a7('0x3d')]({},_0x67e942,_0x4d3f3c[_0xc4a7('0x3f')]);return db[_0xc4a7('0x2b')][_0xc4a7('0x47')](_0x67e942)[_0xc4a7('0x23')](handleEntityNotFound(_0x4c4f1b,null))[_0xc4a7('0x23')](respondWithResult(_0x4c4f1b,null))['catch'](handleError(_0x4c4f1b,null));};exports[_0xc4a7('0x48')]=function(_0x23fd8e,_0xf74c93){return db[_0xc4a7('0x2b')][_0xc4a7('0x48')](_0x23fd8e[_0xc4a7('0x49')],{})[_0xc4a7('0x23')](respondWithResult(_0xf74c93,0xc9))[_0xc4a7('0x42')](handleError(_0xf74c93,null));};exports[_0xc4a7('0x22')]=function(_0x21f659,_0x538698){if(_0x21f659[_0xc4a7('0x49')]['id']){delete _0x21f659[_0xc4a7('0x49')]['id'];}return db['MailTransferReport'][_0xc4a7('0x47')]({'where':{'id':_0x21f659[_0xc4a7('0x44')]['id']}})['then'](handleEntityNotFound(_0x538698,null))[_0xc4a7('0x23')](saveUpdates(_0x21f659['body'],null))[_0xc4a7('0x23')](respondWithResult(_0x538698,null))['catch'](handleError(_0x538698,null));};exports[_0xc4a7('0x24')]=function(_0x3290b3,_0x3a4d06){return db[_0xc4a7('0x2b')][_0xc4a7('0x47')]({'where':{'id':_0x3290b3[_0xc4a7('0x44')]['id']}})[_0xc4a7('0x23')](handleEntityNotFound(_0x3a4d06,null))[_0xc4a7('0x23')](removeEntity(_0x3a4d06,null))[_0xc4a7('0x42')](handleError(_0x3a4d06,null));};exports[_0xc4a7('0x4a')]=function(_0xe56fb9,_0x4822f7){return db[_0xc4a7('0x2b')][_0xc4a7('0x4a')]()['then'](respondWithResult(_0x4822f7,null))[_0xc4a7('0x42')](handleError(_0x4822f7,null));}; \ No newline at end of file +var _0xbf6d=['end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','destroy','then','error','stack','name','send','map','MailTransferReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','update','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x43b487,_0x21893a){var _0x2f707a=function(_0x477ee0){while(--_0x477ee0){_0x43b487['push'](_0x43b487['shift']());}};_0x2f707a(++_0x21893a);}(_0xbf6d,0x1e6));var _0xdbf6=function(_0x4fa4fd,_0x4c656b){_0x4fa4fd=_0x4fa4fd-0x0;var _0x3c50d0=_0xbf6d[_0x4fa4fd];return _0x3c50d0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdbf6('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbf6('0x1'));var moment=require(_0xdbf6('0x2'));var BPromise=require(_0xdbf6('0x3'));var Mustache=require(_0xdbf6('0x4'));var util=require(_0xdbf6('0x5'));var path=require(_0xdbf6('0x6'));var sox=require(_0xdbf6('0x7'));var csv=require('to-csv');var ejs=require(_0xdbf6('0x8'));var fs=require('fs');var fs_extra=require(_0xdbf6('0x9'));var _=require('lodash');var squel=require(_0xdbf6('0xa'));var crypto=require('crypto');var jsforce=require(_0xdbf6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdbf6('0xc'));var querystring=require('querystring');var Papa=require(_0xdbf6('0xd'));var Redis=require(_0xdbf6('0xe'));var authService=require(_0xdbf6('0xf'));var qs=require(_0xdbf6('0x10'));var as=require(_0xdbf6('0x11'));var hardwareService=require(_0xdbf6('0x12'));var logger=require('../../config/logger')(_0xdbf6('0x13'));var utils=require(_0xdbf6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdbf6('0x15'));var db=require(_0xdbf6('0x16'))['db'];function respondWithStatusCode(_0x1384cd,_0x170d1b){_0x170d1b=_0x170d1b||0xcc;return function(_0x1684e8){if(_0x1684e8){return _0x1384cd[_0xdbf6('0x17')](_0x170d1b);}return _0x1384cd[_0xdbf6('0x18')](_0x170d1b)[_0xdbf6('0x19')]();};}function respondWithResult(_0x2f2374,_0x37489b){_0x37489b=_0x37489b||0xc8;return function(_0x47671c){if(_0x47671c){return _0x2f2374[_0xdbf6('0x18')](_0x37489b)['json'](_0x47671c);}};}function respondWithFilteredResult(_0x4253ac,_0xddd90f){return function(_0x4c3995){if(_0x4c3995){var _0x48b0c3=typeof _0xddd90f[_0xdbf6('0x1a')]==='undefined'&&typeof _0xddd90f[_0xdbf6('0x1b')]===_0xdbf6('0x1c');var _0x5b81c0=_0x4c3995[_0xdbf6('0x1d')];var _0xc7d6fc=_0x48b0c3?0x0:_0xddd90f[_0xdbf6('0x1a')];var _0x4ab579=_0x48b0c3?_0x4c3995[_0xdbf6('0x1d')]:_0xddd90f[_0xdbf6('0x1a')]+_0xddd90f[_0xdbf6('0x1b')];var _0x159ad8;if(_0x4ab579>=_0x5b81c0){_0x4ab579=_0x5b81c0;_0x159ad8=0xc8;}else{_0x159ad8=0xce;}_0x4253ac[_0xdbf6('0x18')](_0x159ad8);return _0x4253ac[_0xdbf6('0x1e')](_0xdbf6('0x1f'),_0xc7d6fc+'-'+_0x4ab579+'/'+_0x5b81c0)[_0xdbf6('0x20')](_0x4c3995);}return null;};}function patchUpdates(_0x320e44){return function(_0x117de0){try{jsonpatch[_0xdbf6('0x21')](_0x117de0,_0x320e44,!![]);}catch(_0x214d84){return BPromise[_0xdbf6('0x22')](_0x214d84);}return _0x117de0[_0xdbf6('0x23')]();};}function saveUpdates(_0x586c53,_0x664bce){return function(_0x59c1d6){if(_0x59c1d6){return _0x59c1d6['update'](_0x586c53)['then'](function(_0x4a5ad0){return _0x4a5ad0;});}return null;};}function removeEntity(_0x41e8d7,_0x3799d7){return function(_0x30b9ac){if(_0x30b9ac){return _0x30b9ac[_0xdbf6('0x24')]()[_0xdbf6('0x25')](function(){_0x41e8d7[_0xdbf6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6b6621,_0x2d0ba7){return function(_0x2c643f){if(!_0x2c643f){_0x6b6621['sendStatus'](0x194);}return _0x2c643f;};}function handleError(_0x47b143,_0x337934){_0x337934=_0x337934||0x1f4;return function(_0x33aabf){logger[_0xdbf6('0x26')](_0x33aabf[_0xdbf6('0x27')]);if(_0x33aabf[_0xdbf6('0x28')]){delete _0x33aabf[_0xdbf6('0x28')];}_0x47b143[_0xdbf6('0x18')](_0x337934)[_0xdbf6('0x29')](_0x33aabf);};}exports['index']=function(_0x50ffb1,_0x41d494){var _0x1ed2b2={},_0x349181={},_0x2e43dd={'count':0x0,'rows':[]};var _0x1f6a47=_[_0xdbf6('0x2a')](db[_0xdbf6('0x2b')][_0xdbf6('0x2c')],function(_0x2f415a){return{'name':_0x2f415a[_0xdbf6('0x2d')],'type':_0x2f415a[_0xdbf6('0x2e')]['key']};});_0x349181[_0xdbf6('0x2f')]=_[_0xdbf6('0x2a')](_0x1f6a47,_0xdbf6('0x28'));_0x349181[_0xdbf6('0x30')]=_['keys'](_0x50ffb1[_0xdbf6('0x30')]);_0x349181[_0xdbf6('0x31')]=_[_0xdbf6('0x32')](_0x349181[_0xdbf6('0x2f')],_0x349181[_0xdbf6('0x30')]);_0x1ed2b2[_0xdbf6('0x33')]=_[_0xdbf6('0x32')](_0x349181[_0xdbf6('0x2f')],qs[_0xdbf6('0x34')](_0x50ffb1[_0xdbf6('0x30')][_0xdbf6('0x34')]));_0x1ed2b2['attributes']=_0x1ed2b2[_0xdbf6('0x33')][_0xdbf6('0x35')]?_0x1ed2b2[_0xdbf6('0x33')]:_0x349181[_0xdbf6('0x2f')];if(!_0x50ffb1[_0xdbf6('0x30')][_0xdbf6('0x36')](_0xdbf6('0x37'))){_0x1ed2b2[_0xdbf6('0x1b')]=qs['limit'](_0x50ffb1[_0xdbf6('0x30')][_0xdbf6('0x1b')]);_0x1ed2b2[_0xdbf6('0x1a')]=qs[_0xdbf6('0x1a')](_0x50ffb1[_0xdbf6('0x30')][_0xdbf6('0x1a')]);}_0x1ed2b2['order']=qs['sort'](_0x50ffb1['query']['sort']);_0x1ed2b2[_0xdbf6('0x38')]=qs[_0xdbf6('0x31')](_[_0xdbf6('0x39')](_0x50ffb1[_0xdbf6('0x30')],_0x349181[_0xdbf6('0x31')]),_0x1f6a47);if(_0x50ffb1[_0xdbf6('0x30')][_0xdbf6('0x3a')]){_0x1ed2b2[_0xdbf6('0x38')]=_[_0xdbf6('0x3b')](_0x1ed2b2[_0xdbf6('0x38')],{'$or':_[_0xdbf6('0x2a')](_0x1f6a47,function(_0x5a66e4){if(_0x5a66e4[_0xdbf6('0x2e')]!=='VIRTUAL'){var _0x38a659={};_0x38a659[_0x5a66e4['name']]={'$like':'%'+_0x50ffb1[_0xdbf6('0x30')]['filter']+'%'};return _0x38a659;}})});}_0x1ed2b2=_[_0xdbf6('0x3b')]({},_0x1ed2b2,_0x50ffb1[_0xdbf6('0x3c')]);var _0x4178dc={'where':_0x1ed2b2[_0xdbf6('0x38')]};return db[_0xdbf6('0x2b')]['count'](_0x4178dc)['then'](function(_0x1bfa1c){_0x2e43dd[_0xdbf6('0x1d')]=_0x1bfa1c;if(_0x50ffb1['query'][_0xdbf6('0x3d')]){_0x1ed2b2[_0xdbf6('0x3e')]=[{'all':!![]}];}return db[_0xdbf6('0x2b')][_0xdbf6('0x3f')](_0x1ed2b2);})[_0xdbf6('0x25')](function(_0x44b783){_0x2e43dd[_0xdbf6('0x40')]=_0x44b783;return _0x2e43dd;})[_0xdbf6('0x25')](respondWithFilteredResult(_0x41d494,_0x1ed2b2))[_0xdbf6('0x41')](handleError(_0x41d494,null));};exports['show']=function(_0x1d01a1,_0x3be3c9){var _0x717cee={'raw':!![],'where':{'id':_0x1d01a1[_0xdbf6('0x42')]['id']}},_0x3b29eb={};_0x3b29eb[_0xdbf6('0x2f')]=_['keys'](db[_0xdbf6('0x2b')]['rawAttributes']);_0x3b29eb['query']=_[_0xdbf6('0x43')](_0x1d01a1['query']);_0x3b29eb['filters']=_[_0xdbf6('0x32')](_0x3b29eb[_0xdbf6('0x2f')],_0x3b29eb['query']);_0x717cee[_0xdbf6('0x33')]=_[_0xdbf6('0x32')](_0x3b29eb[_0xdbf6('0x2f')],qs[_0xdbf6('0x34')](_0x1d01a1['query'][_0xdbf6('0x34')]));_0x717cee[_0xdbf6('0x33')]=_0x717cee[_0xdbf6('0x33')]['length']?_0x717cee[_0xdbf6('0x33')]:_0x3b29eb[_0xdbf6('0x2f')];if(_0x1d01a1[_0xdbf6('0x30')]['includeAll']){_0x717cee['include']=[{'all':!![]}];}_0x717cee=_[_0xdbf6('0x3b')]({},_0x717cee,_0x1d01a1[_0xdbf6('0x3c')]);return db[_0xdbf6('0x2b')][_0xdbf6('0x44')](_0x717cee)[_0xdbf6('0x25')](handleEntityNotFound(_0x3be3c9,null))[_0xdbf6('0x25')](respondWithResult(_0x3be3c9,null))['catch'](handleError(_0x3be3c9,null));};exports[_0xdbf6('0x45')]=function(_0x2649b2,_0x47a270){return db['MailTransferReport'][_0xdbf6('0x45')](_0x2649b2[_0xdbf6('0x46')],{})[_0xdbf6('0x25')](respondWithResult(_0x47a270,0xc9))['catch'](handleError(_0x47a270,null));};exports[_0xdbf6('0x47')]=function(_0x2ec685,_0x3f72fb){if(_0x2ec685['body']['id']){delete _0x2ec685[_0xdbf6('0x46')]['id'];}return db[_0xdbf6('0x2b')]['find']({'where':{'id':_0x2ec685[_0xdbf6('0x42')]['id']}})[_0xdbf6('0x25')](handleEntityNotFound(_0x3f72fb,null))[_0xdbf6('0x25')](saveUpdates(_0x2ec685[_0xdbf6('0x46')],null))[_0xdbf6('0x25')](respondWithResult(_0x3f72fb,null))[_0xdbf6('0x41')](handleError(_0x3f72fb,null));};exports[_0xdbf6('0x24')]=function(_0x22666f,_0x48b7b0){return db[_0xdbf6('0x2b')]['find']({'where':{'id':_0x22666f[_0xdbf6('0x42')]['id']}})[_0xdbf6('0x25')](handleEntityNotFound(_0x48b7b0,null))[_0xdbf6('0x25')](removeEntity(_0x48b7b0,null))[_0xdbf6('0x41')](handleError(_0x48b7b0,null));};exports[_0xdbf6('0x48')]=function(_0x17baf6,_0x2ddcf4){return db[_0xdbf6('0x2b')]['describe']()[_0xdbf6('0x25')](respondWithResult(_0x2ddcf4,null))['catch'](handleError(_0x2ddcf4,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index cb28ca9..55e4926 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 _0x5df9=['./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x325c90,_0xef1cd3){var _0x4edf7f=function(_0x37424c){while(--_0x37424c){_0x325c90['push'](_0x325c90['shift']());}};_0x4edf7f(++_0xef1cd3);}(_0x5df9,0xea));var _0x95df=function(_0x3c6295,_0x1d5f78){_0x3c6295=_0x3c6295-0x0;var _0x5df6de=_0x5df9[_0x3c6295];return _0x5df6de;};'use strict';var _=require('lodash');var util=require(_0x95df('0x0'));var logger=require(_0x95df('0x1'))(_0x95df('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x95df('0x3'));var fs=require('fs');var path=require(_0x95df('0x4'));var rimraf=require('rimraf');var config=require(_0x95df('0x5'));var attributes=require(_0x95df('0x6'));module[_0x95df('0x7')]=function(_0x2658ce,_0x49414f){return _0x2658ce[_0x95df('0x8')](_0x95df('0x9'),attributes,{'tableName':_0x95df('0xa'),'paranoid':![],'indexes':[{'name':_0x95df('0xb'),'fields':[_0x95df('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b67=['moment','bluebird','path','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x1da5f4,_0x44bca7){var _0x58e944=function(_0x3393ae){while(--_0x3393ae){_0x1da5f4['push'](_0x1da5f4['shift']());}};_0x58e944(++_0x44bca7);}(_0x2b67,0xf3));var _0x72b6=function(_0x18b0ad,_0x55b470){_0x18b0ad=_0x18b0ad-0x0;var _0x143b6e=_0x2b67[_0x18b0ad];return _0x143b6e;};'use strict';var _=require(_0x72b6('0x0'));var util=require(_0x72b6('0x1'));var logger=require(_0x72b6('0x2'))(_0x72b6('0x3'));var moment=require(_0x72b6('0x4'));var BPromise=require(_0x72b6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x72b6('0x6'));var rimraf=require('rimraf');var config=require(_0x72b6('0x7'));var attributes=require(_0x72b6('0x8'));module['exports']=function(_0x572088,_0x5232be){return _0x572088[_0x72b6('0x9')](_0x72b6('0xa'),attributes,{'tableName':_0x72b6('0xb'),'paranoid':![],'indexes':[{'name':_0x72b6('0xc'),'fields':[_0x72b6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 609b3ba..e54701f 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 _0x0c8b=['error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5673c6,_0xc302ec){var _0x130bd9=function(_0x1653f5){while(--_0x1653f5){_0x5673c6['push'](_0x5673c6['shift']());}};_0x130bd9(++_0xc302ec);}(_0x0c8b,0x91));var _0xb0c8=function(_0x25b4a4,_0x2e081b){_0x25b4a4=_0x25b4a4-0x0;var _0x707267=_0x0c8b[_0x25b4a4];return _0x707267;};'use strict';var _=require('lodash');var util=require(_0xb0c8('0x0'));var moment=require(_0xb0c8('0x1'));var BPromise=require('bluebird');var rs=require(_0xb0c8('0x2'));var fs=require('fs');var Redis=require(_0xb0c8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb0c8('0x4'));var logger=require(_0xb0c8('0x5'))(_0xb0c8('0x6'));var config=require('../../config/environment');var jayson=require(_0xb0c8('0x7'));var client=jayson[_0xb0c8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15b261,_0x42f769,_0x4b1b28){return new BPromise(function(_0x2df031,_0x51f9c2){return client['request'](_0x15b261,_0x4b1b28)['then'](function(_0x4b2316){logger[_0xb0c8('0x9')](_0xb0c8('0xa'),_0x42f769,_0xb0c8('0xb'));logger[_0xb0c8('0xc')](_0xb0c8('0xd'),_0x42f769,_0xb0c8('0xb'),JSON[_0xb0c8('0xe')](_0x4b2316));if(_0x4b2316['error']){if(_0x4b2316[_0xb0c8('0xf')][_0xb0c8('0x10')]===0x1f4){logger[_0xb0c8('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x42f769,_0x4b2316[_0xb0c8('0xf')][_0xb0c8('0x11')]);return _0x51f9c2(_0x4b2316[_0xb0c8('0xf')][_0xb0c8('0x11')]);}logger[_0xb0c8('0xf')](_0xb0c8('0xa'),_0x42f769,_0x4b2316[_0xb0c8('0xf')]['message']);return _0x2df031(_0x4b2316['error'][_0xb0c8('0x11')]);}else{logger[_0xb0c8('0x9')](_0xb0c8('0xa'),_0x42f769,_0xb0c8('0xb'));_0x2df031(_0x4b2316[_0xb0c8('0x12')][_0xb0c8('0x11')]);}})[_0xb0c8('0x13')](function(_0x1ac1f6){logger[_0xb0c8('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x42f769,_0x1ac1f6);_0x51f9c2(_0x1ac1f6);});});} \ No newline at end of file +var _0xf0f3=['request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','MailTransferReport,\x20%s,\x20%s'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0xf0f3,0xd0));var _0x3f0f=function(_0x188a41,_0x3aaa14){_0x188a41=_0x188a41-0x0;var _0x4485ee=_0xf0f3[_0x188a41];return _0x4485ee;};'use strict';var _=require('lodash');var util=require(_0x3f0f('0x0'));var moment=require(_0x3f0f('0x1'));var BPromise=require(_0x3f0f('0x2'));var rs=require(_0x3f0f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3f0f('0x4'));var logger=require('../../config/logger')(_0x3f0f('0x5'));var config=require(_0x3f0f('0x6'));var jayson=require(_0x3f0f('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4902eb,_0x4e9feb,_0x769cce){return new BPromise(function(_0x27057a,_0x5ec028){return client[_0x3f0f('0x8')](_0x4902eb,_0x769cce)[_0x3f0f('0x9')](function(_0x1cff0b){logger[_0x3f0f('0xa')](_0x3f0f('0xb'),_0x4e9feb,_0x3f0f('0xc'));logger[_0x3f0f('0xd')](_0x3f0f('0xe'),_0x4e9feb,_0x3f0f('0xc'),JSON['stringify'](_0x1cff0b));if(_0x1cff0b[_0x3f0f('0xf')]){if(_0x1cff0b[_0x3f0f('0xf')][_0x3f0f('0x10')]===0x1f4){logger[_0x3f0f('0xf')](_0x3f0f('0xb'),_0x4e9feb,_0x1cff0b[_0x3f0f('0xf')][_0x3f0f('0x11')]);return _0x5ec028(_0x1cff0b['error'][_0x3f0f('0x11')]);}logger[_0x3f0f('0xf')](_0x3f0f('0xb'),_0x4e9feb,_0x1cff0b['error'][_0x3f0f('0x11')]);return _0x27057a(_0x1cff0b[_0x3f0f('0xf')][_0x3f0f('0x11')]);}else{logger[_0x3f0f('0xa')]('MailTransferReport,\x20%s,\x20%s',_0x4e9feb,_0x3f0f('0xc'));_0x27057a(_0x1cff0b[_0x3f0f('0x12')][_0x3f0f('0x11')]);}})[_0x3f0f('0x13')](function(_0x596b9f){logger['error'](_0x3f0f('0xb'),_0x4e9feb,_0x596b9f);_0x5ec028(_0x596b9f);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index a0ef69b..e74451f 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 _0x21f9=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy'];(function(_0x15b19a,_0x3f5e4f){var _0x43d292=function(_0x840416){while(--_0x840416){_0x15b19a['push'](_0x15b19a['shift']());}};_0x43d292(++_0x3f5e4f);}(_0x21f9,0x9b));var _0x921f=function(_0x597e83,_0x2a2d69){_0x597e83=_0x597e83-0x0;var _0x16028d=_0x21f9[_0x597e83];return _0x16028d;};'use strict';var multer=require(_0x921f('0x0'));var util=require(_0x921f('0x1'));var path=require(_0x921f('0x2'));var timeout=require(_0x921f('0x3'));var express=require(_0x921f('0x4'));var router=express[_0x921f('0x5')]();var fs_extra=require(_0x921f('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x921f('0x7'));var controller=require(_0x921f('0x8'));router[_0x921f('0x9')]('/',auth[_0x921f('0xa')](),controller[_0x921f('0xb')]);router[_0x921f('0x9')](_0x921f('0xc'),auth[_0x921f('0xa')](),controller[_0x921f('0xd')]);router[_0x921f('0x9')](_0x921f('0xe'),auth['isAuthenticated'](),controller[_0x921f('0xf')]);router[_0x921f('0x10')]('/',auth[_0x921f('0xa')](),controller[_0x921f('0x11')]);router['put'](_0x921f('0xe'),auth[_0x921f('0xa')](),controller[_0x921f('0x12')]);router[_0x921f('0x13')](_0x921f('0xe'),auth['isAuthenticated'](),controller[_0x921f('0x14')]);module[_0x921f('0x15')]=router; \ No newline at end of file +var _0xff95=['show','post','create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x3ac11b,_0x3236db){var _0x1d8511=function(_0x3f1d81){while(--_0x3f1d81){_0x3ac11b['push'](_0x3ac11b['shift']());}};_0x1d8511(++_0x3236db);}(_0xff95,0x77));var _0x5ff9=function(_0x20ae53,_0x597d1b){_0x20ae53=_0x20ae53-0x0;var _0x53e372=_0xff95[_0x20ae53];return _0x53e372;};'use strict';var multer=require('multer');var util=require(_0x5ff9('0x0'));var path=require(_0x5ff9('0x1'));var timeout=require(_0x5ff9('0x2'));var express=require(_0x5ff9('0x3'));var router=express['Router']();var fs_extra=require(_0x5ff9('0x4'));var auth=require(_0x5ff9('0x5'));var interaction=require(_0x5ff9('0x6'));var config=require(_0x5ff9('0x7'));var controller=require('./memberReport.controller');router[_0x5ff9('0x8')]('/',auth[_0x5ff9('0x9')](),controller[_0x5ff9('0xa')]);router['get'](_0x5ff9('0xb'),auth[_0x5ff9('0x9')](),controller[_0x5ff9('0xc')]);router[_0x5ff9('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5ff9('0xd')]);router[_0x5ff9('0xe')]('/',auth[_0x5ff9('0x9')](),controller[_0x5ff9('0xf')]);router[_0x5ff9('0x10')]('/:id',auth[_0x5ff9('0x9')](),controller[_0x5ff9('0x11')]);router[_0x5ff9('0x12')](_0x5ff9('0x13'),auth['isAuthenticated'](),controller[_0x5ff9('0x14')]);module[_0x5ff9('0x15')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 1ed83ba..1a5e05c 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 _0x5ebe=['exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','INTEGER','DATE','getDataValue','enterAt'];(function(_0x13725c,_0x2c84c5){var _0x2ae1a0=function(_0x37315a){while(--_0x37315a){_0x13725c['push'](_0x13725c['shift']());}};_0x2ae1a0(++_0x2c84c5);}(_0x5ebe,0x69));var _0xe5eb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5ebe[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe5eb('0x0'));module[_0xe5eb('0x1')]={'channel':{'type':Sequelize[_0xe5eb('0x2')]},'membername':{'type':Sequelize[_0xe5eb('0x2')]},'interface':{'type':Sequelize[_0xe5eb('0x2')]},'type':{'type':Sequelize[_0xe5eb('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xe5eb('0x3')]},'enterAt':{'type':Sequelize[_0xe5eb('0x4')]},'exitAt':{'type':Sequelize[_0xe5eb('0x4')],'set':function(_0x1f7414){var _0x3055ba=moment(_0x1f7414);var _0x3ae8d2=moment(this[_0xe5eb('0x5')](_0xe5eb('0x6')));var _0x5158f0=_0x3055ba['diff'](_0x3ae8d2,'seconds');this['setDataValue'](_0xe5eb('0x7'),_0x1f7414);this['setDataValue'](_0xe5eb('0x8'),_0x5158f0||null);}},'data1':{'type':Sequelize[_0xe5eb('0x2')],'comment':_0xe5eb('0x9')},'data2':{'type':Sequelize['STRING'],'comment':_0xe5eb('0xa')},'data3':{'type':Sequelize[_0xe5eb('0x2')],'comment':_0xe5eb('0xb')},'data4':{'type':Sequelize[_0xe5eb('0x2')],'comment':_0xe5eb('0xc')},'data5':{'type':Sequelize['STRING'],'comment':_0xe5eb('0xd')},'role':{'type':Sequelize[_0xe5eb('0x2')]},'internal':{'type':Sequelize[_0xe5eb('0x3')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x843b=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports'];(function(_0x5eaa16,_0x28ebad){var _0x352569=function(_0x4a8013){while(--_0x4a8013){_0x5eaa16['push'](_0x5eaa16['shift']());}};_0x352569(++_0x28ebad);}(_0x843b,0xc5));var _0xb843=function(_0x496391,_0x44d478){_0x496391=_0x496391-0x0;var _0x51a511=_0x843b[_0x496391];return _0x51a511;};'use strict';var Sequelize=require(_0xb843('0x0'));var moment=require(_0xb843('0x1'));module[_0xb843('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb843('0x3')]},'interface':{'type':Sequelize[_0xb843('0x3')]},'type':{'type':Sequelize[_0xb843('0x3')],'defaultValue':_0xb843('0x4'),'comment':_0xb843('0x5')},'duration':{'type':Sequelize[_0xb843('0x6')]},'enterAt':{'type':Sequelize[_0xb843('0x7')]},'exitAt':{'type':Sequelize[_0xb843('0x7')],'set':function(_0x2ad5f3){var _0x3987db=moment(_0x2ad5f3);var _0x6e3fa3=moment(this[_0xb843('0x8')](_0xb843('0x9')));var _0x15cbdd=_0x3987db[_0xb843('0xa')](_0x6e3fa3,_0xb843('0xb'));this['setDataValue'](_0xb843('0xc'),_0x2ad5f3);this[_0xb843('0xd')](_0xb843('0xe'),_0x15cbdd||null);}},'data1':{'type':Sequelize[_0xb843('0x3')],'comment':_0xb843('0xf')},'data2':{'type':Sequelize[_0xb843('0x3')],'comment':_0xb843('0x10')},'data3':{'type':Sequelize['STRING'],'comment':_0xb843('0x11')},'data4':{'type':Sequelize['STRING'],'comment':_0xb843('0x12')},'data5':{'type':Sequelize[_0xb843('0x3')],'comment':_0xb843('0x13')},'role':{'type':Sequelize[_0xb843('0x3')]},'internal':{'type':Sequelize[_0xb843('0x6')]},'uniqueid':{'type':Sequelize[_0xb843('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 2864ea0..9519ef8 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 _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(_0x4ab6d5,_0x38259b){var _0x21f586=function(_0x5a4813){while(--_0x5a4813){_0x4ab6d5['push'](_0x4ab6d5['shift']());}};_0x21f586(++_0x38259b);}(_0x3e74,0x175));var _0x43e7=function(_0x2b6b77,_0x428922){_0x2b6b77=_0x2b6b77-0x0;var _0x55db82=_0x3e74[_0x2b6b77];return _0x55db82;};'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 +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(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xedd9,0xfc));var _0x9edd=function(_0x2061b1,_0xcd8667){_0x2061b1=_0x2061b1-0x0;var _0x415845=_0xedd9[_0x2061b1];return _0x415845;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 164fca2..b3df5f3 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 _0x524a=['membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','define','MemberReport'];(function(_0x485f53,_0x104081){var _0x480f1e=function(_0x2d61d2){while(--_0x2d61d2){_0x485f53['push'](_0x485f53['shift']());}};_0x480f1e(++_0x104081);}(_0x524a,0x7a));var _0xa524=function(_0x182aa0,_0x434e2e){_0x182aa0=_0x182aa0-0x0;var _0x160ea3=_0x524a[_0x182aa0];return _0x160ea3;};'use strict';var _=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var logger=require(_0xa524('0x2'))(_0xa524('0x3'));var moment=require(_0xa524('0x4'));var BPromise=require(_0xa524('0x5'));var rp=require(_0xa524('0x6'));var fs=require('fs');var path=require(_0xa524('0x7'));var rimraf=require('rimraf');var config=require(_0xa524('0x8'));var attributes=require(_0xa524('0x9'));module[_0xa524('0xa')]=function(_0x349b6d,_0x5ca17d){return _0x349b6d[_0xa524('0xb')](_0xa524('0xc'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xa524('0xd'),_0xa524('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa1a9=['membername','lodash','api','bluebird','request-promise','./memberReport.attributes','MemberReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1a9,0x9b));var _0x9a1a=function(_0x4e5a5b,_0x3b5e11){_0x4e5a5b=_0x4e5a5b-0x0;var _0x50bd3a=_0xa1a9[_0x4e5a5b];return _0x50bd3a;};'use strict';var _=require(_0x9a1a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9a1a('0x1'));var moment=require('moment');var BPromise=require(_0x9a1a('0x2'));var rp=require(_0x9a1a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9a1a('0x4'));module['exports']=function(_0x433b6e,_0x412c30){return _0x433b6e['define'](_0x9a1a('0x5'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x9a1a('0x6'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 1db08f0..191fba0 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 _0xe599=['../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','include','model','map','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x128e04,_0x525d03){var _0x3bc682=function(_0x54ec5f){while(--_0x54ec5f){_0x128e04['push'](_0x128e04['shift']());}};_0x3bc682(++_0x525d03);}(_0xe599,0x1e5));var _0x9e59=function(_0x537c2c,_0x30936a){_0x537c2c=_0x537c2c-0x0;var _0x2de76e=_0xe599[_0x537c2c];return _0x2de76e;};'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});function respondWithRpcPromise(_0x599400,_0x290f63,_0x21c5a9){return new BPromise(function(_0x5288df,_0x1c975c){return client[_0x9e59('0xc')](_0x599400,_0x21c5a9)[_0x9e59('0xd')](function(_0x1a6a13){logger[_0x9e59('0xe')](_0x9e59('0xf'),_0x290f63,'request\x20sent');logger[_0x9e59('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x290f63,_0x9e59('0x11'),JSON[_0x9e59('0x12')](_0x1a6a13));if(_0x1a6a13[_0x9e59('0x13')]){if(_0x1a6a13[_0x9e59('0x13')]['code']===0x1f4){logger[_0x9e59('0x13')](_0x9e59('0xf'),_0x290f63,_0x1a6a13['error'][_0x9e59('0x14')]);return _0x1c975c(_0x1a6a13[_0x9e59('0x13')][_0x9e59('0x14')]);}logger[_0x9e59('0x13')]('MemberReport,\x20%s,\x20%s',_0x290f63,_0x1a6a13[_0x9e59('0x13')][_0x9e59('0x14')]);return _0x5288df(_0x1a6a13[_0x9e59('0x13')][_0x9e59('0x14')]);}else{logger[_0x9e59('0xe')](_0x9e59('0xf'),_0x290f63,_0x9e59('0x11'));_0x5288df(_0x1a6a13[_0x9e59('0x15')]['message']);}})[_0x9e59('0x16')](function(_0x4bfd39){logger['error']('MemberReport,\x20%s,\x20%s',_0x290f63,_0x4bfd39);_0x1c975c(_0x4bfd39);});});}exports[_0x9e59('0x17')]=function(_0x470f7a){var _0x51e05b=this;return new Promise(function(_0x224bc7,_0x3e6c34){return db[_0x9e59('0x18')][_0x9e59('0x19')]({'raw':_0x470f7a[_0x9e59('0x1a')]?_0x470f7a[_0x9e59('0x1a')][_0x9e59('0x1b')]===undefined?!![]:![]:!![],'where':_0x470f7a['options']?_0x470f7a[_0x9e59('0x1a')][_0x9e59('0x1c')]||null:null,'attributes':_0x470f7a['options']?_0x470f7a['options'][_0x9e59('0x1d')]||null:null,'limit':_0x470f7a[_0x9e59('0x1a')]?_0x470f7a[_0x9e59('0x1a')]['limit']||null:null,'include':_0x470f7a[_0x9e59('0x1a')]?_0x470f7a[_0x9e59('0x1a')]['include']?_['map'](_0x470f7a['options'][_0x9e59('0x1e')],function(_0x3ff1e7){return{'model':db[_0x3ff1e7[_0x9e59('0x1f')]],'as':_0x3ff1e7['as'],'attributes':_0x3ff1e7[_0x9e59('0x1d')],'include':_0x3ff1e7[_0x9e59('0x1e')]?_['map'](_0x3ff1e7['include'],function(_0x512719){return{'model':db[_0x512719[_0x9e59('0x1f')]],'as':_0x512719['as'],'attributes':_0x512719[_0x9e59('0x1d')],'include':_0x512719[_0x9e59('0x1e')]?_[_0x9e59('0x20')](_0x512719[_0x9e59('0x1e')],function(_0x12b52c){return{'model':db[_0x12b52c['model']],'as':_0x12b52c['as'],'attributes':_0x12b52c['attributes']};}):[]};}):[]};}):[]:[]})[_0x9e59('0xd')](function(_0x3c04db){logger[_0x9e59('0xe')](_0x9e59('0x17'),_0x470f7a);logger[_0x9e59('0x10')](_0x9e59('0x17'),_0x470f7a,JSON[_0x9e59('0x12')](_0x3c04db));_0x224bc7(_0x3c04db);})[_0x9e59('0x16')](function(_0x2211a8){logger[_0x9e59('0x13')](_0x9e59('0x17'),_0x2211a8[_0x9e59('0x14')],_0x470f7a);_0x3e6c34(_0x51e05b[_0x9e59('0x13')](0x1f4,_0x2211a8['message']));});});};exports[_0x9e59('0x21')]=function(_0x151ec1){var _0xced2df=this;return new Promise(function(_0x36d77d,_0x1d7616){return db[_0x9e59('0x18')][_0x9e59('0x22')](_0x151ec1[_0x9e59('0x23')],{'raw':_0x151ec1[_0x9e59('0x1a')]?_0x151ec1['options'][_0x9e59('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x3d6237){logger[_0x9e59('0xe')](_0x9e59('0x21'),_0x151ec1);logger[_0x9e59('0x10')](_0x9e59('0x21'),_0x151ec1,JSON[_0x9e59('0x12')](_0x3d6237));_0x36d77d(_0x3d6237);})[_0x9e59('0x16')](function(_0x2a99eb){logger[_0x9e59('0x13')](_0x9e59('0x21'),_0x2a99eb[_0x9e59('0x14')],_0x151ec1);_0x1d7616(_0xced2df[_0x9e59('0x13')](0x1f4,_0x2a99eb[_0x9e59('0x14')]));});});};exports[_0x9e59('0x24')]=function(_0x5af9b3){var _0x166d6c=this;return new Promise(function(_0x5a3bb1,_0x96d365){return db[_0x9e59('0x18')][_0x9e59('0x25')](_0x5af9b3['body'],{'raw':_0x5af9b3['options']?_0x5af9b3[_0x9e59('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5af9b3[_0x9e59('0x1a')]?_0x5af9b3['options'][_0x9e59('0x1c')]||null:null,'attributes':_0x5af9b3[_0x9e59('0x1a')]?_0x5af9b3['options']['attributes']||null:null,'limit':_0x5af9b3['options']?_0x5af9b3[_0x9e59('0x1a')]['limit']||null:null})[_0x9e59('0xd')](function(_0x121cf4){logger[_0x9e59('0xe')](_0x9e59('0x24'),_0x5af9b3);logger['debug'](_0x9e59('0x24'),_0x5af9b3,JSON[_0x9e59('0x12')](_0x121cf4));_0x5a3bb1(_0x121cf4);})[_0x9e59('0x16')](function(_0x452f31){logger[_0x9e59('0x13')](_0x9e59('0x24'),_0x452f31[_0x9e59('0x14')],_0x5af9b3);_0x96d365(_0x166d6c[_0x9e59('0x13')](0x1f4,_0x452f31[_0x9e59('0x14')]));});});}; \ No newline at end of file +var _0x81c6=['GetMemberReport','MemberReport','findAll','options','where','limit','include','map','model','attributes','CreateMemberReport','body','raw','UpdateMemberReport','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result','catch'];(function(_0x53fe5e,_0x331c72){var _0x14a0be=function(_0x12f77b){while(--_0x12f77b){_0x53fe5e['push'](_0x53fe5e['shift']());}};_0x14a0be(++_0x331c72);}(_0x81c6,0x1d5));var _0x681c=function(_0x56d0b2,_0x2f7c9e){_0x56d0b2=_0x56d0b2-0x0;var _0x37e421=_0x81c6[_0x56d0b2];return _0x37e421;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x681c('0x1'));var db=require(_0x681c('0x2'))['db'];var utils=require(_0x681c('0x3'));var logger=require('../../config/logger')(_0x681c('0x4'));var config=require(_0x681c('0x5'));var jayson=require(_0x681c('0x6'));var client=jayson[_0x681c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45331,_0xdc57a5,_0x5624d7){return new BPromise(function(_0x5b5f22,_0x1750e2){return client[_0x681c('0x8')](_0x45331,_0x5624d7)[_0x681c('0x9')](function(_0x5de78e){logger['info'](_0x681c('0xa'),_0xdc57a5,'request\x20sent');logger[_0x681c('0xb')](_0x681c('0xc'),_0xdc57a5,_0x681c('0xd'),JSON[_0x681c('0xe')](_0x5de78e));if(_0x5de78e['error']){if(_0x5de78e['error'][_0x681c('0xf')]===0x1f4){logger[_0x681c('0x10')](_0x681c('0xa'),_0xdc57a5,_0x5de78e['error'][_0x681c('0x11')]);return _0x1750e2(_0x5de78e['error'][_0x681c('0x11')]);}logger['error'](_0x681c('0xa'),_0xdc57a5,_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);return _0x5b5f22(_0x5de78e[_0x681c('0x10')][_0x681c('0x11')]);}else{logger[_0x681c('0x12')]('MemberReport,\x20%s,\x20%s',_0xdc57a5,_0x681c('0xd'));_0x5b5f22(_0x5de78e[_0x681c('0x13')][_0x681c('0x11')]);}})[_0x681c('0x14')](function(_0x2fce11){logger[_0x681c('0x10')]('MemberReport,\x20%s,\x20%s',_0xdc57a5,_0x2fce11);_0x1750e2(_0x2fce11);});});}exports[_0x681c('0x15')]=function(_0x42f506){var _0x4a9192=this;return new Promise(function(_0x42304f,_0x5b03fd){return db[_0x681c('0x16')][_0x681c('0x17')]({'raw':_0x42f506['options']?_0x42f506[_0x681c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x19')]||null:null,'attributes':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')]['attributes']||null:null,'limit':_0x42f506['options']?_0x42f506['options'][_0x681c('0x1a')]||null:null,'include':_0x42f506[_0x681c('0x18')]?_0x42f506[_0x681c('0x18')][_0x681c('0x1b')]?_[_0x681c('0x1c')](_0x42f506[_0x681c('0x18')][_0x681c('0x1b')],function(_0x3d0297){return{'model':db[_0x3d0297[_0x681c('0x1d')]],'as':_0x3d0297['as'],'attributes':_0x3d0297[_0x681c('0x1e')],'include':_0x3d0297[_0x681c('0x1b')]?_[_0x681c('0x1c')](_0x3d0297[_0x681c('0x1b')],function(_0x218410){return{'model':db[_0x218410[_0x681c('0x1d')]],'as':_0x218410['as'],'attributes':_0x218410[_0x681c('0x1e')],'include':_0x218410['include']?_[_0x681c('0x1c')](_0x218410['include'],function(_0x5f8d64){return{'model':db[_0x5f8d64['model']],'as':_0x5f8d64['as'],'attributes':_0x5f8d64['attributes']};}):[]};}):[]};}):[]:[]})[_0x681c('0x9')](function(_0x17ea7c){logger[_0x681c('0x12')](_0x681c('0x15'),_0x42f506);logger['debug'](_0x681c('0x15'),_0x42f506,JSON[_0x681c('0xe')](_0x17ea7c));_0x42304f(_0x17ea7c);})[_0x681c('0x14')](function(_0x936fce){logger[_0x681c('0x10')](_0x681c('0x15'),_0x936fce[_0x681c('0x11')],_0x42f506);_0x5b03fd(_0x4a9192['error'](0x1f4,_0x936fce[_0x681c('0x11')]));});});};exports[_0x681c('0x1f')]=function(_0x2e783d){var _0x4af6aa=this;return new Promise(function(_0x385b14,_0x2179cd){return db[_0x681c('0x16')]['create'](_0x2e783d[_0x681c('0x20')],{'raw':_0x2e783d['options']?_0x2e783d['options'][_0x681c('0x21')]===undefined?!![]:![]:!![]})[_0x681c('0x9')](function(_0x16277f){logger['info'](_0x681c('0x1f'),_0x2e783d);logger['debug'](_0x681c('0x1f'),_0x2e783d,JSON['stringify'](_0x16277f));_0x385b14(_0x16277f);})['catch'](function(_0x4ea825){logger[_0x681c('0x10')](_0x681c('0x1f'),_0x4ea825['message'],_0x2e783d);_0x2179cd(_0x4af6aa[_0x681c('0x10')](0x1f4,_0x4ea825['message']));});});};exports['UpdateMemberReport']=function(_0x3286e1){var _0x52261f=this;return new Promise(function(_0x35991d,_0x4e22f8){return db[_0x681c('0x16')]['update'](_0x3286e1['body'],{'raw':_0x3286e1[_0x681c('0x18')]?_0x3286e1[_0x681c('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3286e1[_0x681c('0x18')]?_0x3286e1[_0x681c('0x18')][_0x681c('0x19')]||null:null,'attributes':_0x3286e1['options']?_0x3286e1[_0x681c('0x18')][_0x681c('0x1e')]||null:null,'limit':_0x3286e1['options']?_0x3286e1[_0x681c('0x18')][_0x681c('0x1a')]||null:null})[_0x681c('0x9')](function(_0x435188){logger[_0x681c('0x12')]('UpdateMemberReport',_0x3286e1);logger['debug'](_0x681c('0x22'),_0x3286e1,JSON[_0x681c('0xe')](_0x435188));_0x35991d(_0x435188);})['catch'](function(_0x3f8618){logger[_0x681c('0x10')]('UpdateMemberReport',_0x3f8618[_0x681c('0x11')],_0x3286e1);_0x4e22f8(_0x52261f[_0x681c('0x10')](0x1f4,_0x3f8618[_0x681c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 9bb5846..1a14e0c 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 _0x186a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path'];(function(_0x1c59ed,_0x100673){var _0x1926e8=function(_0x2633aa){while(--_0x2633aa){_0x1c59ed['push'](_0x1c59ed['shift']());}};_0x1926e8(++_0x100673);}(_0x186a,0x15c));var _0xa186=function(_0x3ceb5c,_0x56884b){_0x3ceb5c=_0x3ceb5c-0x0;var _0x1aad8e=_0x186a[_0x3ceb5c];return _0x1aad8e;};'use strict';var multer=require(_0xa186('0x0'));var util=require(_0xa186('0x1'));var path=require(_0xa186('0x2'));var timeout=require('connect-timeout');var express=require(_0xa186('0x3'));var router=express[_0xa186('0x4')]();var fs_extra=require(_0xa186('0x5'));var auth=require(_0xa186('0x6'));var interaction=require(_0xa186('0x7'));var config=require(_0xa186('0x8'));var controller=require(_0xa186('0x9'));router[_0xa186('0xa')]('/',controller[_0xa186('0xb')]);module[_0xa186('0xc')]=router; \ No newline at end of file +var _0x847f=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','multer','util','path','express'];(function(_0x5c6aa1,_0x5792a2){var _0x23b899=function(_0x336149){while(--_0x336149){_0x5c6aa1['push'](_0x5c6aa1['shift']());}};_0x23b899(++_0x5792a2);}(_0x847f,0x182));var _0xf847=function(_0x4fd812,_0x575915){_0x4fd812=_0x4fd812-0x0;var _0x6064b5=_0x847f[_0x4fd812];return _0x6064b5;};'use strict';var multer=require(_0xf847('0x0'));var util=require(_0xf847('0x1'));var path=require(_0xf847('0x2'));var timeout=require('connect-timeout');var express=require(_0xf847('0x3'));var router=express[_0xf847('0x4')]();var fs_extra=require(_0xf847('0x5'));var auth=require(_0xf847('0x6'));var interaction=require(_0xf847('0x7'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0xf847('0x8')]('/',controller[_0xf847('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 64186d5..a10b5a4 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 _0xa73b=['sequelize','exports','STRING'];(function(_0x51125e,_0x56df44){var _0x39a92c=function(_0x245b4f){while(--_0x245b4f){_0x51125e['push'](_0x51125e['shift']());}};_0x39a92c(++_0x56df44);}(_0xa73b,0xed));var _0xba73=function(_0x11c39b,_0x2dd495){_0x11c39b=_0x11c39b-0x0;var _0x23e960=_0xa73b[_0x11c39b];return _0x23e960;};'use strict';var Sequelize=require(_0xba73('0x0'));module[_0xba73('0x1')]={'version':{'type':Sequelize[_0xba73('0x2')],'unique':'version'}}; \ No newline at end of file +var _0xb14f=['STRING','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb14f,0x191));var _0xfb14=function(_0x3bdcb8,_0x3c1921){_0x3bdcb8=_0x3bdcb8-0x0;var _0x2c5191=_0xb14f[_0x3bdcb8];return _0x2c5191;};'use strict';var Sequelize=require('sequelize');module[_0xfb14('0x0')]={'version':{'type':Sequelize[_0xfb14('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 74e340c..b20dacb 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 _0xb83b=['where','merge','VIRTUAL','includeAll','include','findAll','then','rows','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','save','destroy','end','error','name','send','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter'];(function(_0x9d1e6b,_0x3bdc22){var _0x2b3070=function(_0x4c4ced){while(--_0x4c4ced){_0x9d1e6b['push'](_0x9d1e6b['shift']());}};_0x2b3070(++_0x3bdc22);}(_0xb83b,0x8c));var _0xbb83=function(_0x522987,_0x4f2c10){_0x522987=_0x522987-0x0;var _0xfd19c3=_0xb83b[_0x522987];return _0xfd19c3;};'use strict';var emlformat=require(_0xbb83('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbb83('0x1'));var rp=require(_0xbb83('0x2'));var moment=require(_0xbb83('0x3'));var BPromise=require(_0xbb83('0x4'));var Mustache=require('mustache');var util=require(_0xbb83('0x5'));var path=require(_0xbb83('0x6'));var sox=require(_0xbb83('0x7'));var csv=require(_0xbb83('0x8'));var ejs=require(_0xbb83('0x9'));var fs=require('fs');var fs_extra=require(_0xbb83('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbb83('0xb'));var jsforce=require(_0xbb83('0xc'));var deskjs=require(_0xbb83('0xd'));var toCsv=require(_0xbb83('0x8'));var querystring=require(_0xbb83('0xe'));var Papa=require('papaparse');var Redis=require(_0xbb83('0xf'));var authService=require(_0xbb83('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xbb83('0x11'));var hardwareService=require(_0xbb83('0x12'));var logger=require('../../config/logger')(_0xbb83('0x13'));var utils=require(_0xbb83('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xbb83('0x15'));var db=require(_0xbb83('0x16'))['db'];function respondWithStatusCode(_0x2fb343,_0x5cf124){_0x5cf124=_0x5cf124||0xcc;return function(_0x4fdb22){if(_0x4fdb22){return _0x2fb343[_0xbb83('0x17')](_0x5cf124);}return _0x2fb343['status'](_0x5cf124)['end']();};}function respondWithResult(_0x2e54ca,_0x5ee042){_0x5ee042=_0x5ee042||0xc8;return function(_0x46c14c){if(_0x46c14c){return _0x2e54ca[_0xbb83('0x18')](_0x5ee042)[_0xbb83('0x19')](_0x46c14c);}};}function respondWithFilteredResult(_0x39f45d,_0x4eab6e){return function(_0x56cc56){if(_0x56cc56){var _0x1ab5fb=typeof _0x4eab6e[_0xbb83('0x1a')]==='undefined'&&typeof _0x4eab6e[_0xbb83('0x1b')]===_0xbb83('0x1c');var _0x5ba23f=_0x56cc56[_0xbb83('0x1d')];var _0x53dbba=_0x1ab5fb?0x0:_0x4eab6e['offset'];var _0x3297ed=_0x1ab5fb?_0x56cc56[_0xbb83('0x1d')]:_0x4eab6e[_0xbb83('0x1a')]+_0x4eab6e['limit'];var _0x24fb6f;if(_0x3297ed>=_0x5ba23f){_0x3297ed=_0x5ba23f;_0x24fb6f=0xc8;}else{_0x24fb6f=0xce;}_0x39f45d['status'](_0x24fb6f);return _0x39f45d['set'](_0xbb83('0x1e'),_0x53dbba+'-'+_0x3297ed+'/'+_0x5ba23f)['json'](_0x56cc56);}return null;};}function patchUpdates(_0x3facdc){return function(_0xb1da03){try{jsonpatch[_0xbb83('0x1f')](_0xb1da03,_0x3facdc,!![]);}catch(_0x2dade0){return BPromise['reject'](_0x2dade0);}return _0xb1da03[_0xbb83('0x20')]();};}function saveUpdates(_0x188275,_0x57ed62){return function(_0x228ec3){if(_0x228ec3){return _0x228ec3['update'](_0x188275)['then'](function(_0x53dfe2){return _0x53dfe2;});}return null;};}function removeEntity(_0xb772f9,_0x53b20d){return function(_0x24b37e){if(_0x24b37e){return _0x24b37e[_0xbb83('0x21')]()['then'](function(){_0xb772f9['status'](0xcc)[_0xbb83('0x22')]();});}};}function handleEntityNotFound(_0x35ffa2,_0x515d9d){return function(_0x4ef52b){if(!_0x4ef52b){_0x35ffa2[_0xbb83('0x17')](0x194);}return _0x4ef52b;};}function handleError(_0x5ad9d8,_0x28a8e3){_0x28a8e3=_0x28a8e3||0x1f4;return function(_0x1d8f57){logger[_0xbb83('0x23')](_0x1d8f57['stack']);if(_0x1d8f57['name']){delete _0x1d8f57[_0xbb83('0x24')];}_0x5ad9d8['status'](_0x28a8e3)[_0xbb83('0x25')](_0x1d8f57);};}exports[_0xbb83('0x26')]=function(_0x52e234,_0x1c9ef3){var _0x294b01={},_0x10c67f={},_0x2f5e5e={'count':0x0,'rows':[]};var _0x4a49f3=_[_0xbb83('0x27')](db[_0xbb83('0x28')][_0xbb83('0x29')],function(_0x276e86){return{'name':_0x276e86[_0xbb83('0x2a')],'type':_0x276e86[_0xbb83('0x2b')][_0xbb83('0x2c')]};});_0x10c67f[_0xbb83('0x2d')]=_[_0xbb83('0x27')](_0x4a49f3,_0xbb83('0x24'));_0x10c67f[_0xbb83('0x2e')]=_[_0xbb83('0x2f')](_0x52e234[_0xbb83('0x2e')]);_0x10c67f[_0xbb83('0x30')]=_['intersection'](_0x10c67f[_0xbb83('0x2d')],_0x10c67f[_0xbb83('0x2e')]);_0x294b01[_0xbb83('0x31')]=_[_0xbb83('0x32')](_0x10c67f[_0xbb83('0x2d')],qs[_0xbb83('0x33')](_0x52e234['query'][_0xbb83('0x33')]));_0x294b01[_0xbb83('0x31')]=_0x294b01[_0xbb83('0x31')]['length']?_0x294b01[_0xbb83('0x31')]:_0x10c67f['model'];if(!_0x52e234[_0xbb83('0x2e')][_0xbb83('0x34')](_0xbb83('0x35'))){_0x294b01[_0xbb83('0x1b')]=qs[_0xbb83('0x1b')](_0x52e234['query']['limit']);_0x294b01[_0xbb83('0x1a')]=qs[_0xbb83('0x1a')](_0x52e234[_0xbb83('0x2e')][_0xbb83('0x1a')]);}_0x294b01[_0xbb83('0x36')]=qs[_0xbb83('0x37')](_0x52e234[_0xbb83('0x2e')][_0xbb83('0x37')]);_0x294b01['where']=qs[_0xbb83('0x30')](_[_0xbb83('0x38')](_0x52e234[_0xbb83('0x2e')],_0x10c67f['filters']),_0x4a49f3);if(_0x52e234['query'][_0xbb83('0x39')]){_0x294b01[_0xbb83('0x3a')]=_[_0xbb83('0x3b')](_0x294b01[_0xbb83('0x3a')],{'$or':_[_0xbb83('0x27')](_0x4a49f3,function(_0x280b58){if(_0x280b58[_0xbb83('0x2b')]!==_0xbb83('0x3c')){var _0x15a821={};_0x15a821[_0x280b58[_0xbb83('0x24')]]={'$like':'%'+_0x52e234[_0xbb83('0x2e')][_0xbb83('0x39')]+'%'};return _0x15a821;}})});}_0x294b01=_[_0xbb83('0x3b')]({},_0x294b01,_0x52e234['options']);var _0x49b0ad={'where':_0x294b01['where']};return db['Migration']['count'](_0x49b0ad)['then'](function(_0x32b4e1){_0x2f5e5e[_0xbb83('0x1d')]=_0x32b4e1;if(_0x52e234['query'][_0xbb83('0x3d')]){_0x294b01[_0xbb83('0x3e')]=[{'all':!![]}];}return db['Migration'][_0xbb83('0x3f')](_0x294b01);})[_0xbb83('0x40')](function(_0x3b5ede){_0x2f5e5e[_0xbb83('0x41')]=_0x3b5ede;return _0x2f5e5e;})[_0xbb83('0x40')](respondWithFilteredResult(_0x1c9ef3,_0x294b01))['catch'](handleError(_0x1c9ef3,null));}; \ No newline at end of file +var _0xe7de=['where','pick','VIRTUAL','filter','options','rows','catch','eml-format','rimraf','zip-dir','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','Migration','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x3d8872,_0x327439){var _0x4e4f6f=function(_0x1d6dae){while(--_0x1d6dae){_0x3d8872['push'](_0x3d8872['shift']());}};_0x4e4f6f(++_0x327439);}(_0xe7de,0x165));var _0xee7d=function(_0x4a464d,_0x593063){_0x4a464d=_0x4a464d-0x0;var _0x31e602=_0xe7de[_0x4a464d];return _0x31e602;};'use strict';var emlformat=require(_0xee7d('0x0'));var rimraf=require(_0xee7d('0x1'));var zipdir=require(_0xee7d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xee7d('0x3'));var BPromise=require(_0xee7d('0x4'));var Mustache=require(_0xee7d('0x5'));var util=require(_0xee7d('0x6'));var path=require(_0xee7d('0x7'));var sox=require(_0xee7d('0x8'));var csv=require(_0xee7d('0x9'));var ejs=require(_0xee7d('0xa'));var fs=require('fs');var fs_extra=require(_0xee7d('0xb'));var _=require(_0xee7d('0xc'));var squel=require(_0xee7d('0xd'));var crypto=require(_0xee7d('0xe'));var jsforce=require(_0xee7d('0xf'));var deskjs=require(_0xee7d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xee7d('0x11'));var Papa=require(_0xee7d('0x12'));var Redis=require(_0xee7d('0x13'));var authService=require(_0xee7d('0x14'));var qs=require(_0xee7d('0x15'));var as=require(_0xee7d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee7d('0x17'))('api');var utils=require(_0xee7d('0x18'));var config=require(_0xee7d('0x19'));var licenseUtil=require(_0xee7d('0x1a'));var db=require(_0xee7d('0x1b'))['db'];function respondWithStatusCode(_0xdfb04b,_0xb4c933){_0xb4c933=_0xb4c933||0xcc;return function(_0x3e9daa){if(_0x3e9daa){return _0xdfb04b[_0xee7d('0x1c')](_0xb4c933);}return _0xdfb04b[_0xee7d('0x1d')](_0xb4c933)[_0xee7d('0x1e')]();};}function respondWithResult(_0x41ca24,_0x47eb16){_0x47eb16=_0x47eb16||0xc8;return function(_0x4bfdab){if(_0x4bfdab){return _0x41ca24[_0xee7d('0x1d')](_0x47eb16)[_0xee7d('0x1f')](_0x4bfdab);}};}function respondWithFilteredResult(_0x4ab8a6,_0x1211a1){return function(_0x1a2976){if(_0x1a2976){var _0x1dc47c=typeof _0x1211a1['offset']===_0xee7d('0x20')&&typeof _0x1211a1[_0xee7d('0x21')]===_0xee7d('0x20');var _0x62d1ec=_0x1a2976[_0xee7d('0x22')];var _0x25f3e0=_0x1dc47c?0x0:_0x1211a1['offset'];var _0x152dd6=_0x1dc47c?_0x1a2976[_0xee7d('0x22')]:_0x1211a1[_0xee7d('0x23')]+_0x1211a1['limit'];var _0x277738;if(_0x152dd6>=_0x62d1ec){_0x152dd6=_0x62d1ec;_0x277738=0xc8;}else{_0x277738=0xce;}_0x4ab8a6['status'](_0x277738);return _0x4ab8a6[_0xee7d('0x24')](_0xee7d('0x25'),_0x25f3e0+'-'+_0x152dd6+'/'+_0x62d1ec)[_0xee7d('0x1f')](_0x1a2976);}return null;};}function patchUpdates(_0x4f6445){return function(_0x113a05){try{jsonpatch['apply'](_0x113a05,_0x4f6445,!![]);}catch(_0x20aeaa){return BPromise[_0xee7d('0x26')](_0x20aeaa);}return _0x113a05[_0xee7d('0x27')]();};}function saveUpdates(_0xed4f9f,_0x52eaf4){return function(_0x32ad6e){if(_0x32ad6e){return _0x32ad6e[_0xee7d('0x28')](_0xed4f9f)[_0xee7d('0x29')](function(_0x136a7b){return _0x136a7b;});}return null;};}function removeEntity(_0x33613a,_0x4d0efb){return function(_0x172850){if(_0x172850){return _0x172850[_0xee7d('0x2a')]()[_0xee7d('0x29')](function(){_0x33613a['status'](0xcc)[_0xee7d('0x1e')]();});}};}function handleEntityNotFound(_0x293382,_0x379de9){return function(_0x576d56){if(!_0x576d56){_0x293382[_0xee7d('0x1c')](0x194);}return _0x576d56;};}function handleError(_0x38e6a6,_0x4532cb){_0x4532cb=_0x4532cb||0x1f4;return function(_0x2b9482){logger[_0xee7d('0x2b')](_0x2b9482[_0xee7d('0x2c')]);if(_0x2b9482[_0xee7d('0x2d')]){delete _0x2b9482[_0xee7d('0x2d')];}_0x38e6a6[_0xee7d('0x1d')](_0x4532cb)['send'](_0x2b9482);};}exports[_0xee7d('0x2e')]=function(_0x4e1bf5,_0x5ca947){var _0x2a5b06={},_0x4d4ff0={},_0x151094={'count':0x0,'rows':[]};var _0xc2e2c1=_['map'](db[_0xee7d('0x2f')][_0xee7d('0x30')],function(_0xac47ec){return{'name':_0xac47ec[_0xee7d('0x31')],'type':_0xac47ec[_0xee7d('0x32')]['key']};});_0x4d4ff0[_0xee7d('0x33')]=_[_0xee7d('0x34')](_0xc2e2c1,_0xee7d('0x2d'));_0x4d4ff0[_0xee7d('0x35')]=_[_0xee7d('0x36')](_0x4e1bf5[_0xee7d('0x35')]);_0x4d4ff0[_0xee7d('0x37')]=_[_0xee7d('0x38')](_0x4d4ff0['model'],_0x4d4ff0[_0xee7d('0x35')]);_0x2a5b06[_0xee7d('0x39')]=_[_0xee7d('0x38')](_0x4d4ff0['model'],qs[_0xee7d('0x3a')](_0x4e1bf5['query'][_0xee7d('0x3a')]));_0x2a5b06[_0xee7d('0x39')]=_0x2a5b06['attributes']['length']?_0x2a5b06[_0xee7d('0x39')]:_0x4d4ff0['model'];if(!_0x4e1bf5[_0xee7d('0x35')][_0xee7d('0x3b')](_0xee7d('0x3c'))){_0x2a5b06[_0xee7d('0x21')]=qs[_0xee7d('0x21')](_0x4e1bf5['query']['limit']);_0x2a5b06[_0xee7d('0x23')]=qs['offset'](_0x4e1bf5[_0xee7d('0x35')][_0xee7d('0x23')]);}_0x2a5b06[_0xee7d('0x3d')]=qs[_0xee7d('0x3e')](_0x4e1bf5[_0xee7d('0x35')][_0xee7d('0x3e')]);_0x2a5b06[_0xee7d('0x3f')]=qs[_0xee7d('0x37')](_[_0xee7d('0x40')](_0x4e1bf5[_0xee7d('0x35')],_0x4d4ff0[_0xee7d('0x37')]),_0xc2e2c1);if(_0x4e1bf5[_0xee7d('0x35')]['filter']){_0x2a5b06[_0xee7d('0x3f')]=_['merge'](_0x2a5b06[_0xee7d('0x3f')],{'$or':_[_0xee7d('0x34')](_0xc2e2c1,function(_0x13f7d2){if(_0x13f7d2['type']!==_0xee7d('0x41')){var _0x2944ac={};_0x2944ac[_0x13f7d2[_0xee7d('0x2d')]]={'$like':'%'+_0x4e1bf5['query'][_0xee7d('0x42')]+'%'};return _0x2944ac;}})});}_0x2a5b06=_['merge']({},_0x2a5b06,_0x4e1bf5[_0xee7d('0x43')]);var _0x4a1c11={'where':_0x2a5b06['where']};return db[_0xee7d('0x2f')][_0xee7d('0x22')](_0x4a1c11)[_0xee7d('0x29')](function(_0x281d7d){_0x151094['count']=_0x281d7d;if(_0x4e1bf5[_0xee7d('0x35')]['includeAll']){_0x2a5b06['include']=[{'all':!![]}];}return db[_0xee7d('0x2f')]['findAll'](_0x2a5b06);})[_0xee7d('0x29')](function(_0x527339){_0x151094[_0xee7d('0x44')]=_0x527339;return _0x151094;})[_0xee7d('0x29')](respondWithFilteredResult(_0x5ca947,_0x2a5b06))[_0xee7d('0x45')](handleError(_0x5ca947,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index f2ae6f4..20aaa62 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 _0x0ab2=['path','rimraf','../../config/environment','define','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1a0ef3,_0x535bbf){var _0x2b86da=function(_0x5d30f9){while(--_0x5d30f9){_0x1a0ef3['push'](_0x1a0ef3['shift']());}};_0x2b86da(++_0x535bbf);}(_0x0ab2,0x119));var _0x20ab=function(_0x56bcca,_0xd0bab7){_0x56bcca=_0x56bcca-0x0;var _0x24961f=_0x0ab2[_0x56bcca];return _0x24961f;};'use strict';var _=require(_0x20ab('0x0'));var util=require(_0x20ab('0x1'));var logger=require(_0x20ab('0x2'))(_0x20ab('0x3'));var moment=require(_0x20ab('0x4'));var BPromise=require(_0x20ab('0x5'));var rp=require(_0x20ab('0x6'));var fs=require('fs');var path=require(_0x20ab('0x7'));var rimraf=require(_0x20ab('0x8'));var config=require(_0x20ab('0x9'));var attributes=require('./migration.attributes');module['exports']=function(_0x5233ac,_0x205a0e){return _0x5233ac[_0x20ab('0xa')]('Migration',attributes,{'tableName':_0x20ab('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56a4=['moment','bluebird','request-promise','path','rimraf','./migration.attributes','exports','define','migrations','../../config/logger'];(function(_0xdcb614,_0x2edfa0){var _0x232807=function(_0x20ade0){while(--_0x20ade0){_0xdcb614['push'](_0xdcb614['shift']());}};_0x232807(++_0x2edfa0);}(_0x56a4,0x1e9));var _0x456a=function(_0x32b30c,_0x4c5567){_0x32b30c=_0x32b30c-0x0;var _0x59bc79=_0x56a4[_0x32b30c];return _0x59bc79;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x456a('0x0'))('api');var moment=require(_0x456a('0x1'));var BPromise=require(_0x456a('0x2'));var rp=require(_0x456a('0x3'));var fs=require('fs');var path=require(_0x456a('0x4'));var rimraf=require(_0x456a('0x5'));var config=require('../../config/environment');var attributes=require(_0x456a('0x6'));module[_0x456a('0x7')]=function(_0x238bbf,_0x5eb47a){return _0x238bbf[_0x456a('0x8')]('Migration',attributes,{'tableName':_0x456a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 080da9e..f026cde 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 _0x3eec=['debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','Migration,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x8f4e60,_0x3a5fac){_0x8f4e60=_0x8f4e60-0x0;var _0xa29ff6=_0x3eec[_0x8f4e60];return _0xa29ff6;};'use strict';var _=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var moment=require(_0xc3ee('0x2'));var BPromise=require(_0xc3ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3ee('0x4'));var db=require(_0xc3ee('0x5'))['db'];var utils=require(_0xc3ee('0x6'));var logger=require(_0xc3ee('0x7'))(_0xc3ee('0x8'));var config=require(_0xc3ee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc3ee('0xa')][_0xc3ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xea4318,_0x2cc750,_0x356374){return new BPromise(function(_0x3d74c0,_0xd88f6){return client[_0xc3ee('0xc')](_0xea4318,_0x356374)[_0xc3ee('0xd')](function(_0x23e9c0){logger['info']('Migration,\x20%s,\x20%s',_0x2cc750,_0xc3ee('0xe'));logger[_0xc3ee('0xf')](_0xc3ee('0x10'),_0x2cc750,_0xc3ee('0xe'),JSON['stringify'](_0x23e9c0));if(_0x23e9c0[_0xc3ee('0x11')]){if(_0x23e9c0['error'][_0xc3ee('0x12')]===0x1f4){logger[_0xc3ee('0x11')]('Migration,\x20%s,\x20%s',_0x2cc750,_0x23e9c0['error'][_0xc3ee('0x13')]);return _0xd88f6(_0x23e9c0['error'][_0xc3ee('0x13')]);}logger['error'](_0xc3ee('0x14'),_0x2cc750,_0x23e9c0['error'][_0xc3ee('0x13')]);return _0x3d74c0(_0x23e9c0[_0xc3ee('0x11')][_0xc3ee('0x13')]);}else{logger[_0xc3ee('0x15')](_0xc3ee('0x14'),_0x2cc750,_0xc3ee('0xe'));_0x3d74c0(_0x23e9c0[_0xc3ee('0x16')]['message']);}})[_0xc3ee('0x17')](function(_0x4eea89){logger[_0xc3ee('0x11')](_0xc3ee('0x14'),_0x2cc750,_0x4eea89);_0xd88f6(_0x4eea89);});});} \ No newline at end of file +var _0x56dc=['http','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xd91aea,_0x90202d){var _0xed7cb0=function(_0x325633){while(--_0x325633){_0xd91aea['push'](_0xd91aea['shift']());}};_0xed7cb0(++_0x90202d);}(_0x56dc,0xfd));var _0xc56d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56dc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc56d('0x0'));var util=require('util');var moment=require(_0xc56d('0x1'));var BPromise=require(_0xc56d('0x2'));var rs=require(_0xc56d('0x3'));var fs=require('fs');var Redis=require(_0xc56d('0x4'));var db=require(_0xc56d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc56d('0x6'))(_0xc56d('0x7'));var config=require(_0xc56d('0x8'));var jayson=require(_0xc56d('0x9'));var client=jayson[_0xc56d('0xa')][_0xc56d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x571341,_0x452715,_0x24b556){return new BPromise(function(_0x3ac7cd,_0x51ca01){return client[_0xc56d('0xc')](_0x571341,_0x24b556)[_0xc56d('0xd')](function(_0x3ff2cb){logger[_0xc56d('0xe')](_0xc56d('0xf'),_0x452715,'request\x20sent');logger[_0xc56d('0x10')](_0xc56d('0x11'),_0x452715,_0xc56d('0x12'),JSON['stringify'](_0x3ff2cb));if(_0x3ff2cb[_0xc56d('0x13')]){if(_0x3ff2cb[_0xc56d('0x13')][_0xc56d('0x14')]===0x1f4){logger[_0xc56d('0x13')]('Migration,\x20%s,\x20%s',_0x452715,_0x3ff2cb[_0xc56d('0x13')][_0xc56d('0x15')]);return _0x51ca01(_0x3ff2cb[_0xc56d('0x13')]['message']);}logger[_0xc56d('0x13')](_0xc56d('0xf'),_0x452715,_0x3ff2cb[_0xc56d('0x13')][_0xc56d('0x15')]);return _0x3ac7cd(_0x3ff2cb['error'][_0xc56d('0x15')]);}else{logger[_0xc56d('0xe')]('Migration,\x20%s,\x20%s',_0x452715,'request\x20sent');_0x3ac7cd(_0x3ff2cb[_0xc56d('0x16')][_0xc56d('0x15')]);}})[_0xc56d('0x17')](function(_0x1d142c){logger['error'](_0xc56d('0xf'),_0x452715,_0x1d142c);_0x51ca01(_0x1d142c);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 2d955d6..181b8f3 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 _0x5cb4=['/:id','post','create','put','update','delete','destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5cb4,0xc6));var _0x45cb=function(_0x225595,_0x1b225e){_0x225595=_0x225595-0x0;var _0x4ba8c2=_0x5cb4[_0x225595];return _0x4ba8c2;};'use strict';var multer=require(_0x45cb('0x0'));var util=require('util');var path=require(_0x45cb('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x45cb('0x2')]();var fs_extra=require(_0x45cb('0x3'));var auth=require(_0x45cb('0x4'));var interaction=require(_0x45cb('0x5'));var config=require(_0x45cb('0x6'));var controller=require(_0x45cb('0x7'));router[_0x45cb('0x8')]('/',auth[_0x45cb('0x9')](),controller[_0x45cb('0xa')]);router[_0x45cb('0x8')](_0x45cb('0xb'),auth[_0x45cb('0x9')](),controller['show']);router[_0x45cb('0xc')]('/',auth[_0x45cb('0x9')](),controller[_0x45cb('0xd')]);router[_0x45cb('0xe')](_0x45cb('0xb'),auth['isAuthenticated'](),controller[_0x45cb('0xf')]);router[_0x45cb('0x10')](_0x45cb('0xb'),auth[_0x45cb('0x9')](),controller[_0x45cb('0x11')]);module[_0x45cb('0x12')]=router; \ No newline at end of file +var _0x11c1=['get','isAuthenticated','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x11c1,0x1cb));var _0x111c=function(_0x5bb10,_0x520165){_0x5bb10=_0x5bb10-0x0;var _0x389ece=_0x11c1[_0x5bb10];return _0x389ece;};'use strict';var multer=require(_0x111c('0x0'));var util=require('util');var path=require(_0x111c('0x1'));var timeout=require(_0x111c('0x2'));var express=require(_0x111c('0x3'));var router=express[_0x111c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x111c('0x5'));var interaction=require(_0x111c('0x6'));var config=require(_0x111c('0x7'));var controller=require(_0x111c('0x8'));router[_0x111c('0x9')]('/',auth[_0x111c('0xa')](),controller['index']);router[_0x111c('0x9')](_0x111c('0xb'),auth[_0x111c('0xa')](),controller[_0x111c('0xc')]);router[_0x111c('0xd')]('/',auth[_0x111c('0xa')](),controller[_0x111c('0xe')]);router[_0x111c('0xf')](_0x111c('0xb'),auth[_0x111c('0xa')](),controller[_0x111c('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x111c('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 324c95a..63d8e76 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 _0x0b7f=['ENUM','localnet','externip','turn','STRING','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b7f,0x1c1));var _0xf0b7=function(_0xe3a0b,_0x31ff4b){_0xe3a0b=_0xe3a0b-0x0;var _0x4eb361=_0x0b7f[_0xe3a0b];return _0x4eb361;};'use strict';var Sequelize=require('sequelize');module[_0xf0b7('0x0')]={'type':{'type':Sequelize[_0xf0b7('0x1')](_0xf0b7('0x2'),_0xf0b7('0x3'),'stun',_0xf0b7('0x4'))},'value':{'type':Sequelize[_0xf0b7('0x5')]},'username':{'type':Sequelize[_0xf0b7('0x5')]},'password':{'type':Sequelize[_0xf0b7('0x5')]}}; \ No newline at end of file +var _0xac5f=['STRING','sequelize','ENUM','localnet','externip','turn'];(function(_0x1526dd,_0x3a3c2f){var _0x12103a=function(_0x18105a){while(--_0x18105a){_0x1526dd['push'](_0x1526dd['shift']());}};_0x12103a(++_0x3a3c2f);}(_0xac5f,0x103));var _0xfac5=function(_0x4e801e,_0x40c7d9){_0x4e801e=_0x4e801e-0x0;var _0x5e797e=_0xac5f[_0x4e801e];return _0x5e797e;};'use strict';var Sequelize=require(_0xfac5('0x0'));module['exports']={'type':{'type':Sequelize[_0xfac5('0x1')](_0xfac5('0x2'),_0xfac5('0x3'),'stun',_0xfac5('0x4'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfac5('0x5')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index c123896..4be3410 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 _0x303a=['moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','Network','rawAttributes','fieldName','type','map','query','filters','intersection','model','fields','attributes','length','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','keys','find','create','sequelize','transaction','body','STUN','readFileSync','join','utf8','render','writeFileSync','res_stun_monitor.so','root','server/files/templates/turn_multiple.ejs','Reload','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','params','toUpperCase','/etc/asterisk/stun_xcally.conf','TURN','/etc/asterisk/turn_xcally.conf','chan_sip.so','server/files/templates/stun_multiple.ejs','format','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x4b41b5,_0x3d4e36){var _0x3bf4df=function(_0x6d67dc){while(--_0x6d67dc){_0x4b41b5['push'](_0x4b41b5['shift']());}};_0x3bf4df(++_0x3d4e36);}(_0x303a,0x1a0));var _0xa303=function(_0xa89c3e,_0x144268){_0xa89c3e=_0xa89c3e-0x0;var _0x48072f=_0x303a[_0xa89c3e];return _0x48072f;};'use strict';var emlformat=require(_0xa303('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa303('0x1'));var jsonpatch=require(_0xa303('0x2'));var rp=require(_0xa303('0x3'));var moment=require(_0xa303('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa303('0x5'));var util=require(_0xa303('0x6'));var path=require(_0xa303('0x7'));var sox=require(_0xa303('0x8'));var csv=require(_0xa303('0x9'));var ejs=require(_0xa303('0xa'));var fs=require('fs');var fs_extra=require(_0xa303('0xb'));var _=require(_0xa303('0xc'));var squel=require(_0xa303('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa303('0x9'));var querystring=require(_0xa303('0xe'));var Papa=require('papaparse');var Redis=require(_0xa303('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa303('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa303('0x11'));var logger=require(_0xa303('0x12'))(_0xa303('0x13'));var utils=require(_0xa303('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa303('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa303('0x16'));var client=jayson[_0xa303('0x17')][_0xa303('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5b530d,_0xe87c60,_0x17d39b,_0x28cd7f){return new BPromise(function(_0xfa522c,_0xed0420){var _0x1618e6=_0x28cd7f||client;return _0x1618e6[_0xa303('0x19')](_0x5b530d,_0x17d39b)[_0xa303('0x1a')](function(_0x4c8bc1){logger[_0xa303('0x1b')](_0xa303('0x1c'),_0xe87c60,_0xa303('0x1d'));logger[_0xa303('0x1e')](_0xa303('0x1f'),_0xe87c60,_0xa303('0x1d'),JSON['stringify'](_0x4c8bc1));if(_0x4c8bc1[_0xa303('0x20')]){if(_0x4c8bc1['error'][_0xa303('0x21')]===0x1f4){logger['error'](_0xa303('0x1c'),_0xe87c60,_0x4c8bc1['error'][_0xa303('0x22')]);return _0xed0420(_0x4c8bc1[_0xa303('0x20')][_0xa303('0x22')]);}logger['error'](_0xa303('0x1c'),_0xe87c60,_0x4c8bc1[_0xa303('0x20')][_0xa303('0x22')]);return _0xfa522c(_0x4c8bc1['error'][_0xa303('0x22')]);}else{logger[_0xa303('0x1b')](_0xa303('0x1c'),_0xe87c60,_0xa303('0x1d'));_0xfa522c(_0x4c8bc1['result'][_0xa303('0x22')]);}})[_0xa303('0x23')](function(_0x565b2e){logger[_0xa303('0x20')](_0xa303('0x1c'),_0xe87c60,_0x565b2e);_0xed0420(_0x565b2e);});});}function respondWithStatusCode(_0x25db9c,_0x122d1e){_0x122d1e=_0x122d1e||0xcc;return function(_0x65ab0e){if(_0x65ab0e){return _0x25db9c[_0xa303('0x24')](_0x122d1e);}return _0x25db9c[_0xa303('0x25')](_0x122d1e)[_0xa303('0x26')]();};}function respondWithResult(_0x35d287,_0x57d584){_0x57d584=_0x57d584||0xc8;return function(_0x532d4d){if(_0x532d4d){return _0x35d287['status'](_0x57d584)['json'](_0x532d4d);}};}function respondWithFilteredResult(_0x5da2d2,_0x34cd0d){return function(_0xc1fd3a){if(_0xc1fd3a){var _0x3680fb=typeof _0x34cd0d[_0xa303('0x27')]===_0xa303('0x28')&&typeof _0x34cd0d['limit']===_0xa303('0x28');var _0xb35c22=_0xc1fd3a['count'];var _0x221f59=_0x3680fb?0x0:_0x34cd0d[_0xa303('0x27')];var _0x355025=_0x3680fb?_0xc1fd3a[_0xa303('0x29')]:_0x34cd0d[_0xa303('0x27')]+_0x34cd0d[_0xa303('0x2a')];var _0x11b175;if(_0x355025>=_0xb35c22){_0x355025=_0xb35c22;_0x11b175=0xc8;}else{_0x11b175=0xce;}_0x5da2d2[_0xa303('0x25')](_0x11b175);return _0x5da2d2[_0xa303('0x2b')](_0xa303('0x2c'),_0x221f59+'-'+_0x355025+'/'+_0xb35c22)[_0xa303('0x2d')](_0xc1fd3a);}return null;};}function patchUpdates(_0x217967){return function(_0x2f7775){try{jsonpatch[_0xa303('0x2e')](_0x2f7775,_0x217967,!![]);}catch(_0x35e324){return BPromise[_0xa303('0x2f')](_0x35e324);}return _0x2f7775[_0xa303('0x30')]();};}function saveUpdates(_0x5de180,_0x485c08){return function(_0x35c312){if(_0x35c312){return _0x35c312[_0xa303('0x31')](_0x5de180)[_0xa303('0x1a')](function(_0x273d84){return _0x273d84;});}return null;};}function removeEntity(_0x5c5d30,_0x265550){return function(_0x765ee0){if(_0x765ee0){return _0x765ee0[_0xa303('0x32')]()[_0xa303('0x1a')](function(){_0x5c5d30['status'](0xcc)[_0xa303('0x26')]();});}};}function handleEntityNotFound(_0x37376d,_0x3aca02){return function(_0x483e38){if(!_0x483e38){_0x37376d[_0xa303('0x24')](0x194);}return _0x483e38;};}function handleError(_0x4349cd,_0x1150fb){_0x1150fb=_0x1150fb||0x1f4;return function(_0x4a6328){logger[_0xa303('0x20')](_0x4a6328[_0xa303('0x33')]);if(_0x4a6328[_0xa303('0x34')]){delete _0x4a6328['name'];}_0x4349cd[_0xa303('0x25')](_0x1150fb)[_0xa303('0x35')](_0x4a6328);};}exports[_0xa303('0x36')]=function(_0x6ec021,_0x4f3c31){var _0x1835c2={},_0x23c318={},_0x107cdc={'count':0x0,'rows':[]};var _0x26ffab=_['map'](db[_0xa303('0x37')][_0xa303('0x38')],function(_0x22da2d){return{'name':_0x22da2d[_0xa303('0x39')],'type':_0x22da2d[_0xa303('0x3a')]['key']};});_0x23c318['model']=_[_0xa303('0x3b')](_0x26ffab,_0xa303('0x34'));_0x23c318[_0xa303('0x3c')]=_['keys'](_0x6ec021['query']);_0x23c318[_0xa303('0x3d')]=_[_0xa303('0x3e')](_0x23c318[_0xa303('0x3f')],_0x23c318[_0xa303('0x3c')]);_0x1835c2['attributes']=_['intersection'](_0x23c318[_0xa303('0x3f')],qs[_0xa303('0x40')](_0x6ec021[_0xa303('0x3c')][_0xa303('0x40')]));_0x1835c2[_0xa303('0x41')]=_0x1835c2['attributes'][_0xa303('0x42')]?_0x1835c2[_0xa303('0x41')]:_0x23c318[_0xa303('0x3f')];if(!_0x6ec021[_0xa303('0x3c')]['hasOwnProperty']('nolimit')){_0x1835c2['limit']=qs[_0xa303('0x2a')](_0x6ec021[_0xa303('0x3c')][_0xa303('0x2a')]);_0x1835c2[_0xa303('0x27')]=qs[_0xa303('0x27')](_0x6ec021[_0xa303('0x3c')][_0xa303('0x27')]);}_0x1835c2[_0xa303('0x43')]=qs[_0xa303('0x44')](_0x6ec021[_0xa303('0x3c')][_0xa303('0x44')]);_0x1835c2['where']=qs['filters'](_[_0xa303('0x45')](_0x6ec021['query'],_0x23c318[_0xa303('0x3d')]),_0x26ffab);if(_0x6ec021['query'][_0xa303('0x46')]){_0x1835c2[_0xa303('0x47')]=_[_0xa303('0x48')](_0x1835c2[_0xa303('0x47')],{'$or':_[_0xa303('0x3b')](_0x26ffab,function(_0x43218f){if(_0x43218f[_0xa303('0x3a')]!==_0xa303('0x49')){var _0x1040f5={};_0x1040f5[_0x43218f[_0xa303('0x34')]]={'$like':'%'+_0x6ec021[_0xa303('0x3c')][_0xa303('0x46')]+'%'};return _0x1040f5;}})});}_0x1835c2=_[_0xa303('0x48')]({},_0x1835c2,_0x6ec021['options']);var _0x297ad0={'where':_0x1835c2['where']};return db[_0xa303('0x37')][_0xa303('0x29')](_0x297ad0)[_0xa303('0x1a')](function(_0x50ad32){_0x107cdc['count']=_0x50ad32;if(_0x6ec021[_0xa303('0x3c')][_0xa303('0x4a')]){_0x1835c2[_0xa303('0x4b')]=[{'all':!![]}];}return db[_0xa303('0x37')][_0xa303('0x4c')](_0x1835c2);})[_0xa303('0x1a')](function(_0x2f9f0b){_0x107cdc[_0xa303('0x4d')]=_0x2f9f0b;return _0x107cdc;})[_0xa303('0x1a')](respondWithFilteredResult(_0x4f3c31,_0x1835c2))[_0xa303('0x23')](handleError(_0x4f3c31,null));};exports['show']=function(_0x47028e,_0x14b6f0){var _0x532003={'raw':!![],'where':{'id':_0x47028e['params']['id']}},_0x3cc97a={};_0x3cc97a[_0xa303('0x3f')]=_[_0xa303('0x4e')](db[_0xa303('0x37')][_0xa303('0x38')]);_0x3cc97a['query']=_[_0xa303('0x4e')](_0x47028e[_0xa303('0x3c')]);_0x3cc97a[_0xa303('0x3d')]=_[_0xa303('0x3e')](_0x3cc97a[_0xa303('0x3f')],_0x3cc97a[_0xa303('0x3c')]);_0x532003['attributes']=_[_0xa303('0x3e')](_0x3cc97a[_0xa303('0x3f')],qs[_0xa303('0x40')](_0x47028e[_0xa303('0x3c')]['fields']));_0x532003['attributes']=_0x532003[_0xa303('0x41')][_0xa303('0x42')]?_0x532003[_0xa303('0x41')]:_0x3cc97a['model'];if(_0x47028e[_0xa303('0x3c')]['includeAll']){_0x532003['include']=[{'all':!![]}];}_0x532003=_['merge']({},_0x532003,_0x47028e['options']);return db[_0xa303('0x37')][_0xa303('0x4f')](_0x532003)['then'](handleEntityNotFound(_0x14b6f0,null))[_0xa303('0x1a')](respondWithResult(_0x14b6f0,null))[_0xa303('0x23')](handleError(_0x14b6f0,null));};exports[_0xa303('0x50')]=function(_0x3cda19,_0x2ab156,_0x4840d7){var _0x3a2068;return db[_0xa303('0x51')][_0xa303('0x52')](function(_0x3b6a7b){return db[_0xa303('0x37')]['create'](_0x3cda19['body'],{'raw':!![]})[_0xa303('0x1a')](function(_0x17ebe6){_0x3a2068=_0x17ebe6;return db[_0xa303('0x37')][_0xa303('0x4c')]({'where':{'type':_0x3cda19[_0xa303('0x53')][_0xa303('0x3a')]},'raw':!![]});})[_0xa303('0x1a')](function(_0x15f042){if(_0x3a2068[_0xa303('0x3a')]['toUpperCase']()==_0xa303('0x54')){var _0x2a56ac=fs[_0xa303('0x55')](path[_0xa303('0x56')](config['root'],'server/files/templates/stun_multiple.ejs'),_0xa303('0x57'));var _0x4db2e2=ejs[_0xa303('0x58')](_0x2a56ac,{'networks':_0x15f042||[]});fs[_0xa303('0x59')]('/etc/asterisk/stun_xcally.conf',_0x4db2e2);return respondWithRpcPromise('Reload',_0xa303('0x50'),{'module':_0xa303('0x5a')});}else if(_0x3a2068['type']['toUpperCase']()=='TURN'){var _0x3bcc6b=fs[_0xa303('0x55')](path[_0xa303('0x56')](config[_0xa303('0x5b')],_0xa303('0x5c')),_0xa303('0x57'));var _0x1a652a=ejs[_0xa303('0x58')](_0x3bcc6b,{'networks':_0x15f042||[]});fs[_0xa303('0x59')]('/etc/asterisk/turn_xcally.conf',_0x1a652a);return respondWithRpcPromise(_0xa303('0x5d'),_0xa303('0x50'),{'module':_0xa303('0x5a')});}else{var _0x2abba7=fs[_0xa303('0x55')](path[_0xa303('0x56')](config['root'],_0xa303('0x5e')),'utf8');var _0x5df9e0=ejs[_0xa303('0x58')](_0x2abba7,{'networks':_0x15f042||[]});fs[_0xa303('0x59')](util['format'](_0xa303('0x5f'),_0x3cda19[_0xa303('0x53')][_0xa303('0x3a')][_0xa303('0x60')]()),_0x5df9e0);return respondWithRpcPromise(_0xa303('0x5d'),'create',{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x3a2068;});})[_0xa303('0x1a')](respondWithResult(_0x2ab156,0xc9))[_0xa303('0x23')](handleError(_0x2ab156,null));};exports[_0xa303('0x31')]=function(_0x5b4e93,_0x5901d9,_0x3b0f1e){var _0x56c252;return db['sequelize']['transaction'](function(_0x49426d){return db[_0xa303('0x37')][_0xa303('0x4f')]({'where':{'id':_0x5b4e93[_0xa303('0x61')]['id']}})[_0xa303('0x1a')](handleEntityNotFound(_0x5901d9,null))[_0xa303('0x1a')](saveUpdates(_0x5b4e93[_0xa303('0x53')],null))[_0xa303('0x1a')](function(_0x2e5a11){if(_0x2e5a11){_0x56c252=_0x2e5a11;return db['Network'][_0xa303('0x4c')]({'where':{'type':_0x56c252[_0xa303('0x3a')]},'raw':!![]});}return null;})[_0xa303('0x1a')](function(_0x32ffb2){if(_0x56c252[_0xa303('0x3a')][_0xa303('0x62')]()=='STUN'){var _0x29fab9=fs['readFileSync'](path['join'](config[_0xa303('0x5b')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x524e29=ejs['render'](_0x29fab9,{'networks':_0x32ffb2||[]});fs['writeFileSync'](_0xa303('0x63'),_0x524e29);return respondWithRpcPromise(_0xa303('0x5d'),_0xa303('0x31'),{'module':_0xa303('0x5a')});}else if(_0x56c252[_0xa303('0x3a')]['toUpperCase']()==_0xa303('0x64')){var _0x30b4c7=fs['readFileSync'](path['join'](config[_0xa303('0x5b')],_0xa303('0x5c')),_0xa303('0x57'));var _0x5d1400=ejs[_0xa303('0x58')](_0x30b4c7,{'networks':_0x32ffb2||[]});fs[_0xa303('0x59')](_0xa303('0x65'),_0x5d1400);return respondWithRpcPromise(_0xa303('0x5d'),_0xa303('0x31'),{'module':_0xa303('0x5a')});}else{var _0x3ca6a6=fs['readFileSync'](path[_0xa303('0x56')](config[_0xa303('0x5b')],_0xa303('0x5e')),_0xa303('0x57'));var _0x578c38=ejs[_0xa303('0x58')](_0x3ca6a6,{'networks':_0x32ffb2||[]});fs[_0xa303('0x59')](util['format'](_0xa303('0x5f'),_0x5b4e93[_0xa303('0x53')][_0xa303('0x3a')]['toLowerCase']()),_0x578c38);return respondWithRpcPromise(_0xa303('0x5d'),'update',{'module':_0xa303('0x66')});}return null;})[_0xa303('0x1a')](function(_0x3eb000){if(_0x3eb000){return _0x56c252;}return null;});})[_0xa303('0x1a')](respondWithResult(_0x5901d9,null))[_0xa303('0x23')](handleError(_0x5901d9,null));};exports[_0xa303('0x32')]=function(_0x1abbcb,_0xd47cd1,_0xd953b2){var _0x418c99;return db['Network']['find']({'where':{'id':_0x1abbcb['params']['id']}})[_0xa303('0x1a')](function(_0x58296e){_0x418c99=_0x58296e;return _0x58296e;})[_0xa303('0x1a')](handleEntityNotFound(_0xd47cd1,null))[_0xa303('0x1a')](removeEntity(_0xd47cd1,null))[_0xa303('0x1a')](function(){if(_0x418c99){return db[_0xa303('0x37')][_0xa303('0x4c')]({'where':{'type':_0x418c99[_0xa303('0x3a')]},'raw':!![]});}})[_0xa303('0x1a')](function(_0x44b43f){if(_0x418c99[_0xa303('0x3a')][_0xa303('0x62')]()==_0xa303('0x54')){var _0x14d95c=fs[_0xa303('0x55')](path[_0xa303('0x56')](config[_0xa303('0x5b')],_0xa303('0x67')),_0xa303('0x57'));var _0x4300eb=ejs['render'](_0x14d95c,{'networks':_0x44b43f||[]});fs[_0xa303('0x59')](_0xa303('0x63'),_0x4300eb);return respondWithRpcPromise('Reload',_0xa303('0x32'),{'module':_0xa303('0x5a')});}else if(_0x418c99[_0xa303('0x3a')][_0xa303('0x62')]()=='TURN'){var _0x85e8b7=fs['readFileSync'](path[_0xa303('0x56')](config['root'],_0xa303('0x5c')),'utf8');var _0x3fe38a=ejs['render'](_0x85e8b7,{'networks':_0x44b43f||[]});fs['writeFileSync'](_0xa303('0x65'),_0x3fe38a);return respondWithRpcPromise('Reload',_0xa303('0x32'),{'module':_0xa303('0x5a')});}else{var _0x25743e=fs[_0xa303('0x55')](path[_0xa303('0x56')](config[_0xa303('0x5b')],_0xa303('0x5e')),_0xa303('0x57'));var _0x5f443d=ejs['render'](_0x25743e,{'networks':_0x44b43f||[]});fs[_0xa303('0x59')](util[_0xa303('0x68')](_0xa303('0x5f'),_0x1abbcb[_0xa303('0x53')][_0xa303('0x3a')][_0xa303('0x60')]()),_0x5f443d);return respondWithRpcPromise(_0xa303('0x5d'),_0xa303('0x32'),{'module':'chan_sip.so'});}return null;})['catch'](handleError(_0xd47cd1,null));}; \ No newline at end of file +var _0x4172=['Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Network','include','rows','show','params','length','includeAll','sequelize','transaction','create','body','toUpperCase','STUN','readFileSync','join','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','findAll','server/files/templates/stun_multiple.ejs','TURN','format','chan_sip.so','find','server/files/templates/network.ejs','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','jayson/promise','client','http','request','then','info'];(function(_0x4f3d81,_0x6a323){var _0xaac319=function(_0x2bcf4c){while(--_0x2bcf4c){_0x4f3d81['push'](_0x4f3d81['shift']());}};_0xaac319(++_0x6a323);}(_0x4172,0xbc));var _0x2417=function(_0x532e7c,_0x1f2702){_0x532e7c=_0x532e7c-0x0;var _0xf96d82=_0x4172[_0x532e7c];return _0xf96d82;};'use strict';var emlformat=require(_0x2417('0x0'));var rimraf=require(_0x2417('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2417('0x2'));var rp=require(_0x2417('0x3'));var moment=require(_0x2417('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2417('0x5'));var path=require(_0x2417('0x6'));var sox=require(_0x2417('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2417('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2417('0x9'));var deskjs=require(_0x2417('0xa'));var toCsv=require(_0x2417('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2417('0xc'));var authService=require(_0x2417('0xd'));var qs=require(_0x2417('0xe'));var as=require(_0x2417('0xf'));var hardwareService=require(_0x2417('0x10'));var logger=require(_0x2417('0x11'))(_0x2417('0x12'));var utils=require(_0x2417('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x2417('0x14'));var client=jayson[_0x2417('0x15')][_0x2417('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x2e4634,_0x403c4f,_0x3c408b,_0x1ba091){return new BPromise(function(_0x58caf0,_0x418e30){var _0x20c785=_0x1ba091||client;return _0x20c785[_0x2417('0x17')](_0x2e4634,_0x3c408b)[_0x2417('0x18')](function(_0x501ce0){logger[_0x2417('0x19')](_0x2417('0x1a'),_0x403c4f,_0x2417('0x1b'));logger[_0x2417('0x1c')](_0x2417('0x1d'),_0x403c4f,'request\x20sent',JSON[_0x2417('0x1e')](_0x501ce0));if(_0x501ce0[_0x2417('0x1f')]){if(_0x501ce0[_0x2417('0x1f')]['code']===0x1f4){logger[_0x2417('0x1f')](_0x2417('0x1a'),_0x403c4f,_0x501ce0[_0x2417('0x1f')][_0x2417('0x20')]);return _0x418e30(_0x501ce0[_0x2417('0x1f')]['message']);}logger['error'](_0x2417('0x1a'),_0x403c4f,_0x501ce0[_0x2417('0x1f')]['message']);return _0x58caf0(_0x501ce0['error'][_0x2417('0x20')]);}else{logger[_0x2417('0x19')](_0x2417('0x1a'),_0x403c4f,_0x2417('0x1b'));_0x58caf0(_0x501ce0['result']['message']);}})[_0x2417('0x21')](function(_0x32368c){logger[_0x2417('0x1f')]('Network,\x20%s,\x20%s',_0x403c4f,_0x32368c);_0x418e30(_0x32368c);});});}function respondWithStatusCode(_0x51212e,_0x520b4b){_0x520b4b=_0x520b4b||0xcc;return function(_0x480e74){if(_0x480e74){return _0x51212e[_0x2417('0x22')](_0x520b4b);}return _0x51212e[_0x2417('0x23')](_0x520b4b)[_0x2417('0x24')]();};}function respondWithResult(_0x2b9407,_0x47ca6b){_0x47ca6b=_0x47ca6b||0xc8;return function(_0x678fa3){if(_0x678fa3){return _0x2b9407[_0x2417('0x23')](_0x47ca6b)[_0x2417('0x25')](_0x678fa3);}};}function respondWithFilteredResult(_0x2d7867,_0x4da68f){return function(_0x531015){if(_0x531015){var _0x509c21=typeof _0x4da68f['offset']===_0x2417('0x26')&&typeof _0x4da68f['limit']===_0x2417('0x26');var _0x1a9eb6=_0x531015['count'];var _0x3fb40c=_0x509c21?0x0:_0x4da68f['offset'];var _0x5e7efa=_0x509c21?_0x531015[_0x2417('0x27')]:_0x4da68f[_0x2417('0x28')]+_0x4da68f[_0x2417('0x29')];var _0x1d0095;if(_0x5e7efa>=_0x1a9eb6){_0x5e7efa=_0x1a9eb6;_0x1d0095=0xc8;}else{_0x1d0095=0xce;}_0x2d7867[_0x2417('0x23')](_0x1d0095);return _0x2d7867[_0x2417('0x2a')](_0x2417('0x2b'),_0x3fb40c+'-'+_0x5e7efa+'/'+_0x1a9eb6)['json'](_0x531015);}return null;};}function patchUpdates(_0x304fd6){return function(_0xffbd9f){try{jsonpatch[_0x2417('0x2c')](_0xffbd9f,_0x304fd6,!![]);}catch(_0xacadfb){return BPromise[_0x2417('0x2d')](_0xacadfb);}return _0xffbd9f[_0x2417('0x2e')]();};}function saveUpdates(_0x25bf03,_0x3a071f){return function(_0x5b1233){if(_0x5b1233){return _0x5b1233[_0x2417('0x2f')](_0x25bf03)[_0x2417('0x18')](function(_0x14cccd){return _0x14cccd;});}return null;};}function removeEntity(_0x4b348d,_0xfbbe9){return function(_0x20ed44){if(_0x20ed44){return _0x20ed44[_0x2417('0x30')]()[_0x2417('0x18')](function(){_0x4b348d[_0x2417('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26aabe,_0x55305e){return function(_0x5b8fe3){if(!_0x5b8fe3){_0x26aabe[_0x2417('0x22')](0x194);}return _0x5b8fe3;};}function handleError(_0x3bb0bd,_0x1919e1){_0x1919e1=_0x1919e1||0x1f4;return function(_0x148934){logger[_0x2417('0x1f')](_0x148934[_0x2417('0x31')]);if(_0x148934[_0x2417('0x32')]){delete _0x148934[_0x2417('0x32')];}_0x3bb0bd[_0x2417('0x23')](_0x1919e1)[_0x2417('0x33')](_0x148934);};}exports[_0x2417('0x34')]=function(_0x3a461e,_0x2c1b60){var _0x1ce5f4={},_0x2bc746={},_0x124cef={'count':0x0,'rows':[]};var _0x1e4f31=_[_0x2417('0x35')](db['Network'][_0x2417('0x36')],function(_0x54048f){return{'name':_0x54048f[_0x2417('0x37')],'type':_0x54048f[_0x2417('0x38')]['key']};});_0x2bc746[_0x2417('0x39')]=_[_0x2417('0x35')](_0x1e4f31,_0x2417('0x32'));_0x2bc746[_0x2417('0x3a')]=_[_0x2417('0x3b')](_0x3a461e[_0x2417('0x3a')]);_0x2bc746[_0x2417('0x3c')]=_[_0x2417('0x3d')](_0x2bc746['model'],_0x2bc746[_0x2417('0x3a')]);_0x1ce5f4[_0x2417('0x3e')]=_['intersection'](_0x2bc746[_0x2417('0x39')],qs['fields'](_0x3a461e['query'][_0x2417('0x3f')]));_0x1ce5f4[_0x2417('0x3e')]=_0x1ce5f4[_0x2417('0x3e')]['length']?_0x1ce5f4[_0x2417('0x3e')]:_0x2bc746[_0x2417('0x39')];if(!_0x3a461e['query'][_0x2417('0x40')](_0x2417('0x41'))){_0x1ce5f4[_0x2417('0x29')]=qs['limit'](_0x3a461e[_0x2417('0x3a')][_0x2417('0x29')]);_0x1ce5f4['offset']=qs['offset'](_0x3a461e[_0x2417('0x3a')][_0x2417('0x28')]);}_0x1ce5f4[_0x2417('0x42')]=qs['sort'](_0x3a461e[_0x2417('0x3a')][_0x2417('0x43')]);_0x1ce5f4[_0x2417('0x44')]=qs['filters'](_[_0x2417('0x45')](_0x3a461e[_0x2417('0x3a')],_0x2bc746[_0x2417('0x3c')]),_0x1e4f31);if(_0x3a461e[_0x2417('0x3a')]['filter']){_0x1ce5f4[_0x2417('0x44')]=_[_0x2417('0x46')](_0x1ce5f4[_0x2417('0x44')],{'$or':_['map'](_0x1e4f31,function(_0x4f622a){if(_0x4f622a[_0x2417('0x38')]!==_0x2417('0x47')){var _0x458492={};_0x458492[_0x4f622a[_0x2417('0x32')]]={'$like':'%'+_0x3a461e[_0x2417('0x3a')][_0x2417('0x48')]+'%'};return _0x458492;}})});}_0x1ce5f4=_[_0x2417('0x46')]({},_0x1ce5f4,_0x3a461e[_0x2417('0x49')]);var _0x1ff7cc={'where':_0x1ce5f4['where']};return db[_0x2417('0x4a')]['count'](_0x1ff7cc)[_0x2417('0x18')](function(_0x24e0d1){_0x124cef[_0x2417('0x27')]=_0x24e0d1;if(_0x3a461e[_0x2417('0x3a')]['includeAll']){_0x1ce5f4[_0x2417('0x4b')]=[{'all':!![]}];}return db[_0x2417('0x4a')]['findAll'](_0x1ce5f4);})[_0x2417('0x18')](function(_0xad8693){_0x124cef[_0x2417('0x4c')]=_0xad8693;return _0x124cef;})['then'](respondWithFilteredResult(_0x2c1b60,_0x1ce5f4))['catch'](handleError(_0x2c1b60,null));};exports[_0x2417('0x4d')]=function(_0x4af533,_0x472d71){var _0x2402c3={'raw':!![],'where':{'id':_0x4af533[_0x2417('0x4e')]['id']}},_0xe56204={};_0xe56204[_0x2417('0x39')]=_[_0x2417('0x3b')](db['Network'][_0x2417('0x36')]);_0xe56204[_0x2417('0x3a')]=_[_0x2417('0x3b')](_0x4af533[_0x2417('0x3a')]);_0xe56204[_0x2417('0x3c')]=_[_0x2417('0x3d')](_0xe56204[_0x2417('0x39')],_0xe56204[_0x2417('0x3a')]);_0x2402c3[_0x2417('0x3e')]=_[_0x2417('0x3d')](_0xe56204[_0x2417('0x39')],qs[_0x2417('0x3f')](_0x4af533[_0x2417('0x3a')]['fields']));_0x2402c3[_0x2417('0x3e')]=_0x2402c3[_0x2417('0x3e')][_0x2417('0x4f')]?_0x2402c3[_0x2417('0x3e')]:_0xe56204['model'];if(_0x4af533[_0x2417('0x3a')][_0x2417('0x50')]){_0x2402c3[_0x2417('0x4b')]=[{'all':!![]}];}_0x2402c3=_[_0x2417('0x46')]({},_0x2402c3,_0x4af533[_0x2417('0x49')]);return db['Network']['find'](_0x2402c3)['then'](handleEntityNotFound(_0x472d71,null))[_0x2417('0x18')](respondWithResult(_0x472d71,null))[_0x2417('0x21')](handleError(_0x472d71,null));};exports['create']=function(_0x253301,_0x24e388,_0x3ea680){var _0x327794;return db[_0x2417('0x51')][_0x2417('0x52')](function(_0x544183){return db['Network'][_0x2417('0x53')](_0x253301[_0x2417('0x54')],{'raw':!![]})['then'](function(_0x3e5cc0){_0x327794=_0x3e5cc0;return db[_0x2417('0x4a')]['findAll']({'where':{'type':_0x253301[_0x2417('0x54')][_0x2417('0x38')]},'raw':!![]});})[_0x2417('0x18')](function(_0x58043d){if(_0x327794['type'][_0x2417('0x55')]()==_0x2417('0x56')){var _0xa1a872=fs[_0x2417('0x57')](path[_0x2417('0x58')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x2417('0x59'));var _0x136918=ejs[_0x2417('0x5a')](_0xa1a872,{'networks':_0x58043d||[]});fs[_0x2417('0x5b')](_0x2417('0x5c'),_0x136918);return respondWithRpcPromise('Reload',_0x2417('0x53'),{'module':_0x2417('0x5d')});}else if(_0x327794[_0x2417('0x38')][_0x2417('0x55')]()=='TURN'){var _0x5721a0=fs[_0x2417('0x57')](path[_0x2417('0x58')](config[_0x2417('0x5e')],_0x2417('0x5f')),'utf8');var _0x27330b=ejs[_0x2417('0x5a')](_0x5721a0,{'networks':_0x58043d||[]});fs[_0x2417('0x5b')](_0x2417('0x60'),_0x27330b);return respondWithRpcPromise(_0x2417('0x61'),_0x2417('0x53'),{'module':_0x2417('0x5d')});}else{var _0x2e404b=fs[_0x2417('0x57')](path[_0x2417('0x58')](config[_0x2417('0x5e')],'server/files/templates/network.ejs'),_0x2417('0x59'));var _0xef4248=ejs['render'](_0x2e404b,{'networks':_0x58043d||[]});fs[_0x2417('0x5b')](util['format'](_0x2417('0x62'),_0x253301[_0x2417('0x54')][_0x2417('0x38')][_0x2417('0x63')]()),_0xef4248);return respondWithRpcPromise(_0x2417('0x61'),'create',{'module':'chan_sip.so'});}return null;})[_0x2417('0x18')](function(){return _0x327794;});})[_0x2417('0x18')](respondWithResult(_0x24e388,0xc9))['catch'](handleError(_0x24e388,null));};exports[_0x2417('0x2f')]=function(_0x4711b5,_0x1b979a,_0x14190b){var _0x41f379;return db[_0x2417('0x51')]['transaction'](function(_0x4deab1){return db['Network']['find']({'where':{'id':_0x4711b5[_0x2417('0x4e')]['id']}})[_0x2417('0x18')](handleEntityNotFound(_0x1b979a,null))[_0x2417('0x18')](saveUpdates(_0x4711b5[_0x2417('0x54')],null))[_0x2417('0x18')](function(_0x45c8c8){if(_0x45c8c8){_0x41f379=_0x45c8c8;return db['Network'][_0x2417('0x64')]({'where':{'type':_0x41f379['type']},'raw':!![]});}return null;})[_0x2417('0x18')](function(_0x55cca9){if(_0x41f379[_0x2417('0x38')]['toUpperCase']()==_0x2417('0x56')){var _0x45cdd7=fs[_0x2417('0x57')](path[_0x2417('0x58')](config[_0x2417('0x5e')],_0x2417('0x65')),'utf8');var _0x1e9827=ejs[_0x2417('0x5a')](_0x45cdd7,{'networks':_0x55cca9||[]});fs[_0x2417('0x5b')](_0x2417('0x5c'),_0x1e9827);return respondWithRpcPromise(_0x2417('0x61'),_0x2417('0x2f'),{'module':_0x2417('0x5d')});}else if(_0x41f379[_0x2417('0x38')]['toUpperCase']()==_0x2417('0x66')){var _0x2ee13c=fs['readFileSync'](path[_0x2417('0x58')](config['root'],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x194143=ejs[_0x2417('0x5a')](_0x2ee13c,{'networks':_0x55cca9||[]});fs[_0x2417('0x5b')](_0x2417('0x60'),_0x194143);return respondWithRpcPromise(_0x2417('0x61'),_0x2417('0x2f'),{'module':_0x2417('0x5d')});}else{var _0x56df07=fs[_0x2417('0x57')](path['join'](config[_0x2417('0x5e')],'server/files/templates/network.ejs'),'utf8');var _0x44b038=ejs[_0x2417('0x5a')](_0x56df07,{'networks':_0x55cca9||[]});fs[_0x2417('0x5b')](util[_0x2417('0x67')]('/etc/asterisk/sip_xcally_%s.conf',_0x4711b5[_0x2417('0x54')][_0x2417('0x38')]['toLowerCase']()),_0x44b038);return respondWithRpcPromise(_0x2417('0x61'),'update',{'module':_0x2417('0x68')});}return null;})[_0x2417('0x18')](function(_0x549abf){if(_0x549abf){return _0x41f379;}return null;});})['then'](respondWithResult(_0x1b979a,null))[_0x2417('0x21')](handleError(_0x1b979a,null));};exports['destroy']=function(_0x1107a1,_0x204b19,_0x47b2c5){var _0x5f83da;return db[_0x2417('0x4a')][_0x2417('0x69')]({'where':{'id':_0x1107a1[_0x2417('0x4e')]['id']}})[_0x2417('0x18')](function(_0x468d4e){_0x5f83da=_0x468d4e;return _0x468d4e;})[_0x2417('0x18')](handleEntityNotFound(_0x204b19,null))[_0x2417('0x18')](removeEntity(_0x204b19,null))[_0x2417('0x18')](function(){if(_0x5f83da){return db['Network'][_0x2417('0x64')]({'where':{'type':_0x5f83da[_0x2417('0x38')]},'raw':!![]});}})['then'](function(_0x483192){if(_0x5f83da['type'][_0x2417('0x55')]()=='STUN'){var _0x2f8eb6=fs[_0x2417('0x57')](path[_0x2417('0x58')](config[_0x2417('0x5e')],_0x2417('0x65')),'utf8');var _0x1bb72f=ejs[_0x2417('0x5a')](_0x2f8eb6,{'networks':_0x483192||[]});fs['writeFileSync'](_0x2417('0x5c'),_0x1bb72f);return respondWithRpcPromise(_0x2417('0x61'),_0x2417('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x5f83da[_0x2417('0x38')][_0x2417('0x55')]()==_0x2417('0x66')){var _0x5f431f=fs[_0x2417('0x57')](path[_0x2417('0x58')](config[_0x2417('0x5e')],_0x2417('0x5f')),_0x2417('0x59'));var _0x2136e0=ejs['render'](_0x5f431f,{'networks':_0x483192||[]});fs['writeFileSync'](_0x2417('0x60'),_0x2136e0);return respondWithRpcPromise(_0x2417('0x61'),_0x2417('0x30'),{'module':'res_stun_monitor.so'});}else{var _0x121489=fs[_0x2417('0x57')](path[_0x2417('0x58')](config[_0x2417('0x5e')],_0x2417('0x6a')),_0x2417('0x59'));var _0xd14e01=ejs['render'](_0x121489,{'networks':_0x483192||[]});fs['writeFileSync'](util[_0x2417('0x67')]('/etc/asterisk/sip_xcally_%s.conf',_0x1107a1[_0x2417('0x54')][_0x2417('0x38')][_0x2417('0x63')]()),_0xd14e01);return respondWithRpcPromise(_0x2417('0x61'),'destroy',{'module':'chan_sip.so'});}return null;})[_0x2417('0x21')](handleError(_0x204b19,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index ffc15b0..a78ebe3 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 _0x1152=['moment','bluebird','request-promise','path','../../config/environment','exports','lodash','util','../../config/logger','api'];(function(_0x1ae899,_0x184f7d){var _0x2e727d=function(_0x467c61){while(--_0x467c61){_0x1ae899['push'](_0x1ae899['shift']());}};_0x2e727d(++_0x184f7d);}(_0x1152,0x182));var _0x2115=function(_0x308a4e,_0x5b6c19){_0x308a4e=_0x308a4e-0x0;var _0x7e11c4=_0x1152[_0x308a4e];return _0x7e11c4;};'use strict';var _=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var logger=require(_0x2115('0x2'))(_0x2115('0x3'));var moment=require(_0x2115('0x4'));var BPromise=require(_0x2115('0x5'));var rp=require(_0x2115('0x6'));var fs=require('fs');var path=require(_0x2115('0x7'));var rimraf=require('rimraf');var config=require(_0x2115('0x8'));var attributes=require('./network.attributes');module[_0x2115('0x9')]=function(_0x241dcb,_0x51a3cf){return _0x241dcb['define']('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6d8=['../../config/logger','moment','request-promise','../../config/environment','./network.attributes','exports','define','Network','lodash'];(function(_0x3fa6ea,_0x55b832){var _0x3fc468=function(_0x1b21a1){while(--_0x1b21a1){_0x3fa6ea['push'](_0x3fa6ea['shift']());}};_0x3fc468(++_0x55b832);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x4eb3ec,_0x51b871){_0x4eb3ec=_0x4eb3ec-0x0;var _0x1a3de8=_0xc6d8[_0x4eb3ec];return _0x1a3de8;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var logger=require(_0x8c6d('0x1'))('api');var moment=require(_0x8c6d('0x2'));var BPromise=require('bluebird');var rp=require(_0x8c6d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8c6d('0x4'));var attributes=require(_0x8c6d('0x5'));module[_0x8c6d('0x6')]=function(_0x4f5e8f,_0x3c265c){return _0x4f5e8f[_0x8c6d('0x7')](_0x8c6d('0x8'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index d650f56..0a7cec1 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x1a9258,_0xba4fc2){_0x1a9258=_0x1a9258-0x0;var _0x25c9a1=_0x7a54[_0x1a9258];return _0x25c9a1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _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(_0x179701,_0x2987c9){var _0x485e40=function(_0x305b19){while(--_0x305b19){_0x179701['push'](_0x179701['shift']());}};_0x485e40(++_0x2987c9);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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 diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 65aa6de..6217e85 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 _0xf169=['/:id/notify','notify','/:id/send','send','put','/:id','update','delete','destroy','removeAnswers','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','/describe','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer'];(function(_0x411b39,_0x408242){var _0x5d37c5=function(_0x3faebe){while(--_0x3faebe){_0x411b39['push'](_0x411b39['shift']());}};_0x5d37c5(++_0x408242);}(_0xf169,0x13c));var _0x9f16=function(_0x21a7d8,_0x2fa38b){_0x21a7d8=_0x21a7d8-0x0;var _0x5e54c0=_0xf169[_0x21a7d8];return _0x5e54c0;};'use strict';var multer=require('multer');var util=require(_0x9f16('0x0'));var path=require(_0x9f16('0x1'));var timeout=require(_0x9f16('0x2'));var express=require(_0x9f16('0x3'));var router=express[_0x9f16('0x4')]();var fs_extra=require(_0x9f16('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9f16('0x6'));var config=require(_0x9f16('0x7'));var controller=require(_0x9f16('0x8'));router[_0x9f16('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9f16('0x9')](_0x9f16('0xa'),auth[_0x9f16('0xb')](),controller['describe']);router[_0x9f16('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x9f16('0xc'),auth[_0x9f16('0xb')](),controller[_0x9f16('0xd')]);router['get'](_0x9f16('0xe'),auth[_0x9f16('0xb')](),controller['getAnswers']);router['get']('/:id/applications',auth[_0x9f16('0xb')](),controller[_0x9f16('0xf')]);router[_0x9f16('0x9')](_0x9f16('0x10'),auth[_0x9f16('0xb')](),controller[_0x9f16('0x11')]);router[_0x9f16('0x9')](_0x9f16('0x12'),auth['isAuthenticated'](),controller[_0x9f16('0x13')]);router[_0x9f16('0x14')]('/',auth[_0x9f16('0xb')](),controller[_0x9f16('0x15')]);router['post'](_0x9f16('0xc'),auth[_0x9f16('0xb')](),controller[_0x9f16('0x16')]);router[_0x9f16('0x14')](_0x9f16('0xe'),auth[_0x9f16('0xb')](),controller[_0x9f16('0x17')]);router[_0x9f16('0x14')](_0x9f16('0x18'),controller[_0x9f16('0x19')]);router['post']('/:id/applications',auth[_0x9f16('0xb')](),controller['addApplications']);router[_0x9f16('0x14')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x9f16('0x14')](_0x9f16('0x1a'),auth[_0x9f16('0xb')](),controller[_0x9f16('0x1b')]);router[_0x9f16('0x1c')](_0x9f16('0x1d'),auth[_0x9f16('0xb')](),controller[_0x9f16('0x1e')]);router[_0x9f16('0x1f')](_0x9f16('0x1d'),auth[_0x9f16('0xb')](),controller[_0x9f16('0x20')]);router[_0x9f16('0x1f')](_0x9f16('0xc'),auth[_0x9f16('0xb')](),controller['removeDispositions']);router[_0x9f16('0x1f')](_0x9f16('0xe'),auth[_0x9f16('0xb')](),controller[_0x9f16('0x21')]);router['delete'](_0x9f16('0x12'),auth[_0x9f16('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xb52e=['create','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post'];(function(_0x3ce2bf,_0x5b100b){var _0x30c895=function(_0x15dda1){while(--_0x15dda1){_0x3ce2bf['push'](_0x3ce2bf['shift']());}};_0x30c895(++_0x5b100b);}(_0xb52e,0xf3));var _0xeb52=function(_0x1b295f,_0x3ef667){_0x1b295f=_0x1b295f-0x0;var _0x2a82d4=_0xb52e[_0x1b295f];return _0x2a82d4;};'use strict';var multer=require('multer');var util=require(_0xeb52('0x0'));var path=require(_0xeb52('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xeb52('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xeb52('0x3'));var interaction=require(_0xeb52('0x4'));var config=require('../../config/environment');var controller=require(_0xeb52('0x5'));router[_0xeb52('0x6')]('/',auth[_0xeb52('0x7')](),controller['index']);router[_0xeb52('0x6')](_0xeb52('0x8'),auth[_0xeb52('0x7')](),controller[_0xeb52('0x9')]);router['get'](_0xeb52('0xa'),auth[_0xeb52('0x7')](),controller[_0xeb52('0xb')]);router[_0xeb52('0x6')](_0xeb52('0xc'),auth['isAuthenticated'](),controller[_0xeb52('0xd')]);router[_0xeb52('0x6')](_0xeb52('0xe'),auth[_0xeb52('0x7')](),controller[_0xeb52('0xf')]);router['get'](_0xeb52('0x10'),auth[_0xeb52('0x7')](),controller[_0xeb52('0x11')]);router[_0xeb52('0x6')](_0xeb52('0x12'),auth[_0xeb52('0x7')](),controller[_0xeb52('0x13')]);router[_0xeb52('0x6')](_0xeb52('0x14'),auth['isAuthenticated'](),controller[_0xeb52('0x15')]);router[_0xeb52('0x16')]('/',auth['isAuthenticated'](),controller[_0xeb52('0x17')]);router[_0xeb52('0x16')](_0xeb52('0xc'),auth[_0xeb52('0x7')](),controller['addDisposition']);router[_0xeb52('0x16')]('/:id/canned_answers',auth[_0xeb52('0x7')](),controller[_0xeb52('0x18')]);router['post'](_0xeb52('0x19'),controller[_0xeb52('0x1a')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xeb52('0x1b')]);router[_0xeb52('0x16')]('/:id/users',auth[_0xeb52('0x7')](),controller[_0xeb52('0x1c')]);router[_0xeb52('0x16')](_0xeb52('0x1d'),auth[_0xeb52('0x7')](),controller[_0xeb52('0x1e')]);router[_0xeb52('0x1f')](_0xeb52('0xa'),auth[_0xeb52('0x7')](),controller[_0xeb52('0x20')]);router[_0xeb52('0x21')](_0xeb52('0xa'),auth[_0xeb52('0x7')](),controller[_0xeb52('0x22')]);router[_0xeb52('0x21')](_0xeb52('0xc'),auth[_0xeb52('0x7')](),controller['removeDispositions']);router[_0xeb52('0x21')](_0xeb52('0xe'),auth[_0xeb52('0x7')](),controller[_0xeb52('0x23')]);router[_0xeb52('0x21')](_0xeb52('0x14'),auth[_0xeb52('0x7')](),controller[_0xeb52('0x24')]);module[_0xeb52('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 bef5569..d0ac613 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 _0x2aa5=['mandatoryDisposition','randomstring','exports','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x36987c,_0x36d9d1){var _0x1e9d3f=function(_0x2bf1ca){while(--_0x2bf1ca){_0x36987c['push'](_0x36987c['shift']());}};_0x1e9d3f(++_0x36d9d1);}(_0x2aa5,0x114));var _0x52aa=function(_0x2280eb,_0x5ed8d7){_0x2280eb=_0x2280eb-0x0;var _0x5e0e7b=_0x2aa5[_0x2280eb];return _0x5e0e7b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x52aa('0x0'));module[_0x52aa('0x1')]={'name':{'type':Sequelize[_0x52aa('0x2')],'unique':_0x52aa('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x52aa('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x52aa('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x52aa('0x4')],'defaultValue':function(){return _0x52aa('0x5');}},'notificationSound':{'type':Sequelize[_0x52aa('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x52aa('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x52aa('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x52aa('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x52aa('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x52aa('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x52aa('0x8'),'set':function(_0x5e31e8){if(!_0x5e31e8)this[_0x52aa('0x9')]('mandatoryDispositionPauseId',null);this[_0x52aa('0x9')](_0x52aa('0xa'),_0x5e31e8);}}}; \ No newline at end of file +var _0x991f=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x991f,0x109));var _0xf991=function(_0x3d6eeb,_0x5e8480){_0x3d6eeb=_0x3d6eeb-0x0;var _0x1b3e24=_0x991f[_0x3d6eeb];return _0x1b3e24;};'use strict';var Sequelize=require(_0xf991('0x0'));var rs=require(_0xf991('0x1'));module[_0xf991('0x2')]={'name':{'type':Sequelize[_0xf991('0x3')],'unique':_0xf991('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xf991('0x3')]},'token':{'type':Sequelize[_0xf991('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xf991('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xf991('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf991('0x5');}},'notificationSound':{'type':Sequelize[_0xf991('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf991('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf991('0x3')]},'queueTransfer':{'type':Sequelize[_0xf991('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf991('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf991('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf991('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xf991('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xf991('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1075fb){if(!_0x1075fb)this[_0xf991('0x9')](_0xf991('0xa'),null);this[_0xf991('0x9')](_0xf991('0xb'),_0x1075fb);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 866f3df..86a0e07 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 _0xf2c6=['rows','show','params','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','body','describe','addDisposition','OpenchannelAccountId','Disposition','hasOwnProperty','removeDispositions','ids','getAnswers','findOne','CannedAnswer','removeAnswers','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','updatedAt','DESC','OpenchannelApplication','applications','Applications','list','orderBy','asc','account','Contacts','defaults','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','findAndCountAll','priority','getApplications','getInteractions','Owner','fullname','internal','Tags','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','stack','send','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','name','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filters','merge','where','filter','options','OpenchannelAccount','includeAll','include','findAll'];(function(_0x43a939,_0x20c11a){var _0x8b5d30=function(_0x3b404d){while(--_0x3b404d){_0x43a939['push'](_0x43a939['shift']());}};_0x8b5d30(++_0x20c11a);}(_0xf2c6,0x117));var _0x6f2c=function(_0x43776a,_0x4eb74c){_0x43776a=_0x43776a-0x0;var _0x18eb8f=_0xf2c6[_0x43776a];return _0x18eb8f;};'use strict';var emlformat=require(_0x6f2c('0x0'));var rimraf=require(_0x6f2c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f2c('0x2'));var rp=require(_0x6f2c('0x3'));var moment=require(_0x6f2c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6f2c('0x5'));var util=require('util');var path=require(_0x6f2c('0x6'));var sox=require(_0x6f2c('0x7'));var csv=require(_0x6f2c('0x8'));var ejs=require(_0x6f2c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6f2c('0xa'));var crypto=require(_0x6f2c('0xb'));var jsforce=require(_0x6f2c('0xc'));var deskjs=require(_0x6f2c('0xd'));var toCsv=require(_0x6f2c('0x8'));var querystring=require(_0x6f2c('0xe'));var Papa=require('papaparse');var Redis=require(_0x6f2c('0xf'));var authService=require(_0x6f2c('0x10'));var qs=require(_0x6f2c('0x11'));var as=require(_0x6f2c('0x12'));var hardwareService=require(_0x6f2c('0x13'));var logger=require(_0x6f2c('0x14'))(_0x6f2c('0x15'));var utils=require(_0x6f2c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6f2c('0x17'))['db'];config[_0x6f2c('0x18')]=_['defaults'](config[_0x6f2c('0x18')],{'host':_0x6f2c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f2c('0x18')]));require(_0x6f2c('0x1a'))[_0x6f2c('0x1b')](socket);var jayson=require(_0x6f2c('0x1c'));var client=jayson[_0x6f2c('0x1d')][_0x6f2c('0x1e')]({'port':0x232c});var client9002=jayson[_0x6f2c('0x1d')][_0x6f2c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x594fac,_0x3ead42,_0x100839,_0x39bafb){return new BPromise(function(_0x1a4fcf,_0xdfecef){var _0x38cd32=_0x39bafb||client;return _0x38cd32[_0x6f2c('0x1f')](_0x594fac,_0x100839)[_0x6f2c('0x20')](function(_0x170b6c){logger[_0x6f2c('0x21')](_0x6f2c('0x22'),_0x3ead42,_0x6f2c('0x23'));logger[_0x6f2c('0x24')](_0x6f2c('0x25'),_0x3ead42,'request\x20sent',JSON['stringify'](_0x170b6c));if(_0x170b6c[_0x6f2c('0x26')]){if(_0x170b6c[_0x6f2c('0x26')][_0x6f2c('0x27')]===0x1f4){logger[_0x6f2c('0x26')](_0x6f2c('0x22'),_0x3ead42,_0x170b6c[_0x6f2c('0x26')]['message']);return _0xdfecef(_0x170b6c[_0x6f2c('0x26')][_0x6f2c('0x28')]);}logger[_0x6f2c('0x26')](_0x6f2c('0x22'),_0x3ead42,_0x170b6c['error'][_0x6f2c('0x28')]);return _0x1a4fcf(_0x170b6c[_0x6f2c('0x26')]['message']);}else{logger[_0x6f2c('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x3ead42,_0x6f2c('0x23'));_0x1a4fcf(_0x170b6c[_0x6f2c('0x29')][_0x6f2c('0x28')]);}})[_0x6f2c('0x2a')](function(_0x244ec2){logger['error'](_0x6f2c('0x22'),_0x3ead42,_0x244ec2);_0xdfecef(_0x244ec2);});});}function respondWithStatusCode(_0x1a228a,_0x3f42c3){_0x3f42c3=_0x3f42c3||0xcc;return function(_0xbf1e60){if(_0xbf1e60){return _0x1a228a[_0x6f2c('0x2b')](_0x3f42c3);}return _0x1a228a[_0x6f2c('0x2c')](_0x3f42c3)[_0x6f2c('0x2d')]();};}function respondWithResult(_0x34d317,_0x4836eb){_0x4836eb=_0x4836eb||0xc8;return function(_0x5c4d7a){if(_0x5c4d7a){return _0x34d317[_0x6f2c('0x2c')](_0x4836eb)[_0x6f2c('0x2e')](_0x5c4d7a);}};}function respondWithFilteredResult(_0x10c96f,_0x2f74b7){return function(_0x4770ff){if(_0x4770ff){var _0x3ef226=typeof _0x2f74b7[_0x6f2c('0x2f')]===_0x6f2c('0x30')&&typeof _0x2f74b7[_0x6f2c('0x31')]==='undefined';var _0x7d8e7e=_0x4770ff['count'];var _0x1abb89=_0x3ef226?0x0:_0x2f74b7['offset'];var _0x5c0848=_0x3ef226?_0x4770ff[_0x6f2c('0x32')]:_0x2f74b7[_0x6f2c('0x2f')]+_0x2f74b7[_0x6f2c('0x31')];var _0x1dba9b;if(_0x5c0848>=_0x7d8e7e){_0x5c0848=_0x7d8e7e;_0x1dba9b=0xc8;}else{_0x1dba9b=0xce;}_0x10c96f[_0x6f2c('0x2c')](_0x1dba9b);return _0x10c96f[_0x6f2c('0x33')](_0x6f2c('0x34'),_0x1abb89+'-'+_0x5c0848+'/'+_0x7d8e7e)[_0x6f2c('0x2e')](_0x4770ff);}return null;};}function patchUpdates(_0x66c5d){return function(_0x41a155){try{jsonpatch[_0x6f2c('0x35')](_0x41a155,_0x66c5d,!![]);}catch(_0x1c8131){return BPromise[_0x6f2c('0x36')](_0x1c8131);}return _0x41a155[_0x6f2c('0x37')]();};}function saveUpdates(_0x1afdfe,_0x94c39a){return function(_0x28d76f){if(_0x28d76f){return _0x28d76f[_0x6f2c('0x38')](_0x1afdfe)['then'](function(_0x3893bf){return _0x3893bf;});}return null;};}function removeEntity(_0x3c1070,_0x1de374){return function(_0x461be3){if(_0x461be3){return _0x461be3[_0x6f2c('0x39')]()[_0x6f2c('0x20')](function(){var _0x986f5=_0x461be3['get']({'plain':!![]});var _0x4490c4=_0x6f2c('0x3a');return db[_0x6f2c('0x3b')]['destroy']({'where':{'type':_0x4490c4,'resourceId':_0x986f5['id']}})[_0x6f2c('0x20')](function(){return _0x461be3;});})[_0x6f2c('0x20')](function(){_0x3c1070['status'](0xcc)[_0x6f2c('0x2d')]();});}};}function handleEntityNotFound(_0x4567ac,_0x5ec73e){return function(_0x3c0cbc){if(!_0x3c0cbc){_0x4567ac[_0x6f2c('0x2b')](0x194);}return _0x3c0cbc;};}function handleError(_0x5402e8,_0x52949a){_0x52949a=_0x52949a||0x1f4;return function(_0x4691d7){logger[_0x6f2c('0x26')](_0x4691d7[_0x6f2c('0x3c')]);if(_0x4691d7['name']){delete _0x4691d7['name'];}_0x5402e8[_0x6f2c('0x2c')](_0x52949a)[_0x6f2c('0x3d')](_0x4691d7);};}exports['index']=function(_0x4bc286,_0x2274d3){var _0x1c0b24={'include':[{'model':db[_0x6f2c('0x3e')],'as':_0x6f2c('0x3f')}]},_0x136e8a={},_0x1a3109={'count':0x0,'rows':[]};var _0x1f6d4c=_[_0x6f2c('0x40')](db['OpenchannelAccount'][_0x6f2c('0x41')],function(_0x400897){return{'name':_0x400897['fieldName'],'type':_0x400897[_0x6f2c('0x42')][_0x6f2c('0x43')]};});_0x136e8a['model']=_['map'](_0x1f6d4c,_0x6f2c('0x44'));_0x136e8a[_0x6f2c('0x45')]=_[_0x6f2c('0x46')](_0x4bc286[_0x6f2c('0x45')]);_0x136e8a['filters']=_[_0x6f2c('0x47')](_0x136e8a[_0x6f2c('0x48')],_0x136e8a[_0x6f2c('0x45')]);_0x1c0b24[_0x6f2c('0x49')]=_['intersection'](_0x136e8a['model'],qs[_0x6f2c('0x4a')](_0x4bc286[_0x6f2c('0x45')]['fields']));_0x1c0b24['attributes']=_0x1c0b24[_0x6f2c('0x49')][_0x6f2c('0x4b')]?_0x1c0b24[_0x6f2c('0x49')]:_0x136e8a['model'];if(!_0x4bc286[_0x6f2c('0x45')]['hasOwnProperty'](_0x6f2c('0x4c'))){_0x1c0b24[_0x6f2c('0x31')]=qs[_0x6f2c('0x31')](_0x4bc286[_0x6f2c('0x45')]['limit']);_0x1c0b24[_0x6f2c('0x2f')]=qs['offset'](_0x4bc286[_0x6f2c('0x45')][_0x6f2c('0x2f')]);}_0x1c0b24[_0x6f2c('0x4d')]=qs[_0x6f2c('0x4e')](_0x4bc286[_0x6f2c('0x45')][_0x6f2c('0x4e')]);_0x1c0b24['where']=qs['filters'](_[_0x6f2c('0x4f')](_0x4bc286[_0x6f2c('0x45')],_0x136e8a[_0x6f2c('0x50')]),_0x1f6d4c);if(_0x4bc286['query']['filter']){_0x1c0b24['where']=_[_0x6f2c('0x51')](_0x1c0b24[_0x6f2c('0x52')],{'$or':_[_0x6f2c('0x40')](_0x1f6d4c,function(_0x118702){if(_0x118702['type']!=='VIRTUAL'){var _0x5ba1d1={};_0x5ba1d1[_0x118702[_0x6f2c('0x44')]]={'$like':'%'+_0x4bc286[_0x6f2c('0x45')][_0x6f2c('0x53')]+'%'};return _0x5ba1d1;}})});}_0x1c0b24=_[_0x6f2c('0x51')]({},_0x1c0b24,_0x4bc286[_0x6f2c('0x54')]);var _0x5f2f34={'where':_0x1c0b24[_0x6f2c('0x52')]};return db[_0x6f2c('0x55')][_0x6f2c('0x32')](_0x5f2f34)[_0x6f2c('0x20')](function(_0x84aac7){_0x1a3109[_0x6f2c('0x32')]=_0x84aac7;if(_0x4bc286[_0x6f2c('0x45')][_0x6f2c('0x56')]){_0x1c0b24[_0x6f2c('0x57')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x6f2c('0x58')](_0x1c0b24);})[_0x6f2c('0x20')](function(_0x4ccc24){_0x1a3109[_0x6f2c('0x59')]=_0x4ccc24;return _0x1a3109;})['then'](respondWithFilteredResult(_0x2274d3,_0x1c0b24))['catch'](handleError(_0x2274d3,null));};exports[_0x6f2c('0x5a')]=function(_0xd83701,_0x3e1d79){var _0x41c18b={'raw':![],'where':{'id':_0xd83701[_0x6f2c('0x5b')]['id']},'include':[{'model':db[_0x6f2c('0x3e')],'as':_0x6f2c('0x3f')}]},_0x5b6a27={};_0x5b6a27[_0x6f2c('0x48')]=_[_0x6f2c('0x46')](db[_0x6f2c('0x55')][_0x6f2c('0x41')]);_0x5b6a27[_0x6f2c('0x45')]=_[_0x6f2c('0x46')](_0xd83701['query']);_0x5b6a27[_0x6f2c('0x50')]=_[_0x6f2c('0x47')](_0x5b6a27['model'],_0x5b6a27[_0x6f2c('0x45')]);_0x41c18b[_0x6f2c('0x49')]=_['intersection'](_0x5b6a27[_0x6f2c('0x48')],qs[_0x6f2c('0x4a')](_0xd83701[_0x6f2c('0x45')][_0x6f2c('0x4a')]));_0x41c18b[_0x6f2c('0x49')]=_0x41c18b['attributes'][_0x6f2c('0x4b')]?_0x41c18b['attributes']:_0x5b6a27[_0x6f2c('0x48')];if(_0xd83701['query']['includeAll']){_0x41c18b['include']=[{'all':!![]}];}_0x41c18b=_[_0x6f2c('0x51')]({},_0x41c18b,_0xd83701[_0x6f2c('0x54')]);return db[_0x6f2c('0x55')][_0x6f2c('0x5c')](_0x41c18b)[_0x6f2c('0x20')](handleEntityNotFound(_0x3e1d79,null))[_0x6f2c('0x20')](respondWithResult(_0x3e1d79,null))['catch'](handleError(_0x3e1d79,null));};exports['create']=function(_0x1507d0,_0x4c09b4){return db['OpenchannelAccount']['create'](_0x1507d0['body'],{})[_0x6f2c('0x20')](function(_0xefcdbb){var _0x75b095=_0x1507d0[_0x6f2c('0x5d')][_0x6f2c('0x5e')]({'plain':!![]});if(!_0x75b095)throw new Error(_0x6f2c('0x5f'));if(_0x75b095[_0x6f2c('0x60')]===_0x6f2c('0x5d')){var _0x5ba3e8=_0xefcdbb[_0x6f2c('0x5e')]({'plain':!![]});var _0x1e781a=_0x6f2c('0x3a');return db[_0x6f2c('0x61')][_0x6f2c('0x5c')]({'where':{'name':_0x1e781a,'userProfileId':_0x75b095['userProfileId']},'raw':!![]})[_0x6f2c('0x20')](function(_0x3160b6){if(_0x3160b6&&_0x3160b6[_0x6f2c('0x62')]===0x0){return db[_0x6f2c('0x3b')][_0x6f2c('0x63')]({'name':_0x5ba3e8[_0x6f2c('0x44')],'resourceId':_0x5ba3e8['id'],'type':_0x3160b6[_0x6f2c('0x44')],'sectionId':_0x3160b6['id']},{})['then'](function(){return _0xefcdbb;});}else{return _0xefcdbb;}})[_0x6f2c('0x2a')](function(_0x3ed714){logger[_0x6f2c('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ed714);throw _0x3ed714;});}return _0xefcdbb;})[_0x6f2c('0x20')](respondWithResult(_0x4c09b4,0xc9))[_0x6f2c('0x2a')](handleError(_0x4c09b4,null));};exports[_0x6f2c('0x38')]=function(_0x27e891,_0x2b1501){if(_0x27e891[_0x6f2c('0x64')]['id']){delete _0x27e891[_0x6f2c('0x64')]['id'];}return db['OpenchannelAccount'][_0x6f2c('0x5c')]({'where':{'id':_0x27e891[_0x6f2c('0x5b')]['id']},'include':[{'model':db[_0x6f2c('0x3e')],'as':_0x6f2c('0x3f')}]})['then'](handleEntityNotFound(_0x2b1501,null))[_0x6f2c('0x20')](saveUpdates(_0x27e891[_0x6f2c('0x64')],null))[_0x6f2c('0x20')](respondWithResult(_0x2b1501,null))[_0x6f2c('0x2a')](handleError(_0x2b1501,null));};exports[_0x6f2c('0x39')]=function(_0x252243,_0x5221d3){return db[_0x6f2c('0x55')][_0x6f2c('0x5c')]({'where':{'id':_0x252243['params']['id']}})[_0x6f2c('0x20')](handleEntityNotFound(_0x5221d3,null))['then'](removeEntity(_0x5221d3,null))['catch'](handleError(_0x5221d3,null));};exports[_0x6f2c('0x65')]=function(_0x25dc13,_0x547c7a){return db['OpenchannelAccount'][_0x6f2c('0x65')]()['then'](respondWithResult(_0x547c7a,null))[_0x6f2c('0x2a')](handleError(_0x547c7a,null));};exports[_0x6f2c('0x66')]=function(_0xae04b3,_0x4f21a1,_0x3f144a){if(_0xae04b3[_0x6f2c('0x64')]['id']){delete _0xae04b3['body']['id'];}return db[_0x6f2c('0x55')]['find']({'where':{'id':_0xae04b3[_0x6f2c('0x5b')]['id']}})[_0x6f2c('0x20')](handleEntityNotFound(_0x4f21a1,null))[_0x6f2c('0x20')](function(_0x235667){if(_0x235667){_0xae04b3['body'][_0x6f2c('0x67')]=_0x235667['id'];return db[_0x6f2c('0x68')]['create'](_0xae04b3[_0x6f2c('0x64')]);}})['then'](respondWithResult(_0x4f21a1,null))[_0x6f2c('0x2a')](handleError(_0x4f21a1,null));};exports['getDispositions']=function(_0x190bdf,_0x2f7a08,_0x35fcc5){var _0x10739c={'raw':![],'where':{}};var _0x291e83={};var _0x1b182b={'count':0x0,'rows':[]};return db[_0x6f2c('0x55')]['findOne']({'where':{'id':_0x190bdf[_0x6f2c('0x5b')]['id']}})[_0x6f2c('0x20')](handleEntityNotFound(_0x2f7a08,null))[_0x6f2c('0x20')](function(_0x333460){if(_0x333460){_0x291e83[_0x6f2c('0x48')]=_[_0x6f2c('0x46')](db[_0x6f2c('0x68')][_0x6f2c('0x41')]);_0x291e83[_0x6f2c('0x45')]=_[_0x6f2c('0x46')](_0x190bdf[_0x6f2c('0x45')]);_0x291e83[_0x6f2c('0x50')]=_[_0x6f2c('0x47')](_0x291e83['model'],_0x291e83[_0x6f2c('0x45')]);_0x10739c['attributes']=_['intersection'](_0x291e83[_0x6f2c('0x48')],qs['fields'](_0x190bdf[_0x6f2c('0x45')][_0x6f2c('0x4a')]));_0x10739c['attributes']=_0x10739c['attributes'][_0x6f2c('0x4b')]?_0x10739c['attributes']:_0x291e83['model'];if(!_0x190bdf['query'][_0x6f2c('0x69')](_0x6f2c('0x4c'))){_0x10739c['limit']=qs[_0x6f2c('0x31')](_0x190bdf['query'][_0x6f2c('0x31')]);_0x10739c[_0x6f2c('0x2f')]=qs['offset'](_0x190bdf[_0x6f2c('0x45')][_0x6f2c('0x2f')]);}_0x10739c['order']=qs['sort'](_0x190bdf[_0x6f2c('0x45')][_0x6f2c('0x4e')]);_0x10739c[_0x6f2c('0x52')]=qs[_0x6f2c('0x50')](_[_0x6f2c('0x4f')](_0x190bdf[_0x6f2c('0x45')],_0x291e83[_0x6f2c('0x50')]));_0x10739c[_0x6f2c('0x52')][_0x6f2c('0x67')]=_0x333460['id'];if(_0x190bdf[_0x6f2c('0x45')][_0x6f2c('0x53')]){_0x10739c[_0x6f2c('0x52')]=_[_0x6f2c('0x51')](_0x10739c['where'],{'$or':_[_0x6f2c('0x40')](_0x10739c[_0x6f2c('0x49')],function(_0x1c69e3){var _0x5003bd={};_0x5003bd[_0x1c69e3]={'$like':'%'+_0x190bdf['query'][_0x6f2c('0x53')]+'%'};return _0x5003bd;})});}_0x10739c=_[_0x6f2c('0x51')]({},_0x10739c,_0x190bdf[_0x6f2c('0x54')]);return db[_0x6f2c('0x68')][_0x6f2c('0x32')]({'where':_0x10739c[_0x6f2c('0x52')]})[_0x6f2c('0x20')](function(_0x29f2b5){_0x1b182b[_0x6f2c('0x32')]=_0x29f2b5;if(_0x190bdf[_0x6f2c('0x45')][_0x6f2c('0x56')]){_0x10739c[_0x6f2c('0x57')]=[{'all':!![]}];}return db[_0x6f2c('0x68')][_0x6f2c('0x58')](_0x10739c);})[_0x6f2c('0x20')](function(_0x2f1e18){_0x1b182b[_0x6f2c('0x59')]=_0x2f1e18;return _0x1b182b;});}})['then'](respondWithFilteredResult(_0x2f7a08,_0x10739c))['catch'](handleError(_0x2f7a08,null));};exports[_0x6f2c('0x6a')]=function(_0x123471,_0x4c4bc3,_0x114b52){return db['OpenchannelAccount'][_0x6f2c('0x5c')]({'where':{'id':_0x123471[_0x6f2c('0x5b')]['id']}})[_0x6f2c('0x20')](handleEntityNotFound(_0x4c4bc3,null))[_0x6f2c('0x20')](function(_0x42dc29){if(_0x42dc29){return _0x42dc29[_0x6f2c('0x6a')](_0x123471[_0x6f2c('0x45')][_0x6f2c('0x6b')]);}})[_0x6f2c('0x20')](respondWithStatusCode(_0x4c4bc3,null))[_0x6f2c('0x2a')](handleError(_0x4c4bc3,null));};exports['addAnswer']=function(_0xbdc92c,_0x26f659,_0x1b25a4){if(_0xbdc92c[_0x6f2c('0x64')]['id']){delete _0xbdc92c[_0x6f2c('0x64')]['id'];}return db['OpenchannelAccount'][_0x6f2c('0x5c')]({'where':{'id':_0xbdc92c['params']['id']}})['then'](handleEntityNotFound(_0x26f659,null))['then'](function(_0x52864e){if(_0x52864e){_0xbdc92c['body'][_0x6f2c('0x67')]=_0x52864e['id'];return db['CannedAnswer'][_0x6f2c('0x63')](_0xbdc92c[_0x6f2c('0x64')]);}})[_0x6f2c('0x20')](respondWithResult(_0x26f659,null))['catch'](handleError(_0x26f659,null));};exports[_0x6f2c('0x6c')]=function(_0x32574d,_0xfcec75,_0x10866f){var _0x56d7a6={'raw':![],'where':{}};var _0x2ad475={};var _0x828f60={'count':0x0,'rows':[]};return db[_0x6f2c('0x55')][_0x6f2c('0x6d')]({'where':{'id':_0x32574d[_0x6f2c('0x5b')]['id']}})['then'](handleEntityNotFound(_0xfcec75,null))['then'](function(_0x5f2462){if(_0x5f2462){_0x2ad475[_0x6f2c('0x48')]=_['keys'](db['CannedAnswer'][_0x6f2c('0x41')]);_0x2ad475['query']=_[_0x6f2c('0x46')](_0x32574d[_0x6f2c('0x45')]);_0x2ad475['filters']=_[_0x6f2c('0x47')](_0x2ad475[_0x6f2c('0x48')],_0x2ad475[_0x6f2c('0x45')]);_0x56d7a6[_0x6f2c('0x49')]=_[_0x6f2c('0x47')](_0x2ad475[_0x6f2c('0x48')],qs[_0x6f2c('0x4a')](_0x32574d[_0x6f2c('0x45')][_0x6f2c('0x4a')]));_0x56d7a6[_0x6f2c('0x49')]=_0x56d7a6[_0x6f2c('0x49')][_0x6f2c('0x4b')]?_0x56d7a6[_0x6f2c('0x49')]:_0x2ad475[_0x6f2c('0x48')];if(!_0x32574d[_0x6f2c('0x45')][_0x6f2c('0x69')](_0x6f2c('0x4c'))){_0x56d7a6[_0x6f2c('0x31')]=qs[_0x6f2c('0x31')](_0x32574d[_0x6f2c('0x45')][_0x6f2c('0x31')]);_0x56d7a6[_0x6f2c('0x2f')]=qs['offset'](_0x32574d[_0x6f2c('0x45')][_0x6f2c('0x2f')]);}_0x56d7a6['order']=qs['sort'](_0x32574d[_0x6f2c('0x45')]['sort']);_0x56d7a6[_0x6f2c('0x52')]=qs[_0x6f2c('0x50')](_['pick'](_0x32574d[_0x6f2c('0x45')],_0x2ad475[_0x6f2c('0x50')]));_0x56d7a6[_0x6f2c('0x52')]['OpenchannelAccountId']=_0x5f2462['id'];if(_0x32574d['query']['filter']){_0x56d7a6[_0x6f2c('0x52')]=_[_0x6f2c('0x51')](_0x56d7a6[_0x6f2c('0x52')],{'$or':_[_0x6f2c('0x40')](_0x56d7a6[_0x6f2c('0x49')],function(_0x4516ec){var _0x43a2f2={};_0x43a2f2[_0x4516ec]={'$like':'%'+_0x32574d[_0x6f2c('0x45')]['filter']+'%'};return _0x43a2f2;})});}_0x56d7a6=_[_0x6f2c('0x51')]({},_0x56d7a6,_0x32574d[_0x6f2c('0x54')]);return db[_0x6f2c('0x6e')][_0x6f2c('0x32')]({'where':_0x56d7a6['where']})[_0x6f2c('0x20')](function(_0x12395a){_0x828f60['count']=_0x12395a;if(_0x32574d[_0x6f2c('0x45')]['includeAll']){_0x56d7a6[_0x6f2c('0x57')]=[{'all':!![]}];}return db[_0x6f2c('0x6e')]['findAll'](_0x56d7a6);})[_0x6f2c('0x20')](function(_0x4f83c7){_0x828f60[_0x6f2c('0x59')]=_0x4f83c7;return _0x828f60;});}})['then'](respondWithFilteredResult(_0xfcec75,_0x56d7a6))[_0x6f2c('0x2a')](handleError(_0xfcec75,null));};exports['removeAnswers']=function(_0x25fad3,_0x2246e3,_0x5b16fc){return db[_0x6f2c('0x55')][_0x6f2c('0x5c')]({'where':{'id':_0x25fad3[_0x6f2c('0x5b')]['id']}})[_0x6f2c('0x20')](handleEntityNotFound(_0x2246e3,null))[_0x6f2c('0x20')](function(_0x34e460){if(_0x34e460){return _0x34e460[_0x6f2c('0x6f')](_0x25fad3[_0x6f2c('0x45')][_0x6f2c('0x6b')]);}})['then'](respondWithStatusCode(_0x2246e3,null))[_0x6f2c('0x2a')](handleError(_0x2246e3,null));};exports['notify']=function(_0x33a57b,_0x24b12d,_0x298e5f){var _0x14af59={'body':_0x33a57b[_0x6f2c('0x64')],'channel':'openchannel'};var _0x29d896=[];var _0x548f18=[];var _0x47b817={};var _0x112886=![];return db[_0x6f2c('0x70')][_0x6f2c('0x65')]()[_0x6f2c('0x20')](function(_0x2a3a32){if(!_0x2a3a32){throw new db[(_0x6f2c('0x71'))][(_0x6f2c('0x72'))](_0x6f2c('0x73'));}_0x29d896=_[_0x6f2c('0x74')](_[_0x6f2c('0x46')](_0x2a3a32),['createdAt','updatedAt']);_0x548f18=_[_0x6f2c('0x74')](_[_0x6f2c('0x46')](_0x2a3a32),[_0x6f2c('0x75'),'updatedAt',_0x6f2c('0x76'),'ListId']);if(_0x33a57b[_0x6f2c('0x64')]['id']){delete _0x33a57b[_0x6f2c('0x64')]['id'];}if(_[_0x6f2c('0x77')](_0x33a57b[_0x6f2c('0x64')][_0x6f2c('0x78')])){throw new db[(_0x6f2c('0x71'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x6f2c('0x77')](_0x33a57b[_0x6f2c('0x64')][_0x6f2c('0x64')])||_0x33a57b[_0x6f2c('0x64')]['body']===''){throw new db[(_0x6f2c('0x71'))]['ValidationError'](_0x6f2c('0x79'));}if(_[_0x6f2c('0x77')](_0x33a57b[_0x6f2c('0x64')]['mapKey'])){throw new db[(_0x6f2c('0x71'))][(_0x6f2c('0x72'))](_0x6f2c('0x7a')+_0x548f18);}if(!_[_0x6f2c('0x7b')](_0x548f18,_0x33a57b[_0x6f2c('0x64')]['mapKey'])){throw new db[(_0x6f2c('0x71'))][(_0x6f2c('0x72'))](_0x6f2c('0x7c')+_0x548f18);}_0x47b817[_0x33a57b[_0x6f2c('0x64')][_0x6f2c('0x7d')]]=_0x33a57b[_0x6f2c('0x64')][_0x6f2c('0x78')];})[_0x6f2c('0x20')](function(){return db[_0x6f2c('0x55')][_0x6f2c('0x5c')]({'where':{'id':_0x33a57b['params']['id']},'include':[{'model':db[_0x6f2c('0x7e')],'as':_0x6f2c('0x7f'),'include':[{'model':db[_0x6f2c('0x70')],'as':'Contacts','where':_0x47b817,'limit':0x1,'order':[[_0x6f2c('0x80'),_0x6f2c('0x81')]]}]},{'model':db[_0x6f2c('0x82')],'as':'Applications'}]});})[_0x6f2c('0x20')](handleEntityNotFound(_0x24b12d,null))[_0x6f2c('0x20')](function(_0x2e6cdf){if(_0x2e6cdf&&_0x2e6cdf['List']){_0x14af59['account']=_0x2e6cdf;_0x14af59[_0x6f2c('0x83')]=_0x2e6cdf[_0x6f2c('0x84')];_0x14af59[_0x6f2c('0x85')]=_0x2e6cdf[_0x6f2c('0x7f')];_0x14af59['applications']=_[_0x6f2c('0x86')](_0x14af59[_0x6f2c('0x83')],['priority'],[_0x6f2c('0x87')]);if(_0x14af59[_0x6f2c('0x88')][_0x6f2c('0x84')]){delete _0x14af59['account'][_0x6f2c('0x84')];}if(_0x14af59[_0x6f2c('0x88')][_0x6f2c('0x7f')]&&_0x14af59[_0x6f2c('0x88')][_0x6f2c('0x7f')][_0x6f2c('0x89')][_0x6f2c('0x4b')]){return _0x14af59[_0x6f2c('0x88')][_0x6f2c('0x7f')][_0x6f2c('0x89')][0x0];}var _0x106f5e=_[_0x6f2c('0x8a')](_0x33a57b['body'],{'firstName':_0x33a57b[_0x6f2c('0x64')][_0x6f2c('0x78')],'ListId':_0x2e6cdf[_0x6f2c('0x8b')]});_0x106f5e[_0x33a57b[_0x6f2c('0x64')][_0x6f2c('0x7d')]]=_0x33a57b[_0x6f2c('0x64')][_0x6f2c('0x78')];return db[_0x6f2c('0x70')][_0x6f2c('0x63')](_0x106f5e,{'fields':_0x29d896,'raw':!![]});}})[_0x6f2c('0x20')](handleEntityNotFound(_0x24b12d,null))['then'](function(_0x34f440){_0x14af59[_0x6f2c('0x8c')]=_0x34f440;if(_0x34f440){var _0x222f2c={'ContactId':_0x34f440['id'],'OpenchannelAccountId':_0x33a57b[_0x6f2c('0x5b')]['id'],'from':(_0x34f440[_0x6f2c('0x8d')]||'')+'\x20'+(_0x34f440[_0x6f2c('0x8e')]||'')};var _0x3fa0b5={'OpenchannelAccountId':_0x33a57b[_0x6f2c('0x5b')]['id'],'closed':![]};if(_0x33a57b['body'][_0x6f2c('0x8f')]){_0x3fa0b5[_0x6f2c('0x8f')]=_0x33a57b[_0x6f2c('0x64')][_0x6f2c('0x8f')];return db[_0x6f2c('0x90')][_0x6f2c('0x5c')]({'where':_0x3fa0b5})['then'](function(_0x499107){if(_0x499107){return[_0x499107,![]];}_0x222f2c[_0x6f2c('0x8f')]=_0x33a57b[_0x6f2c('0x64')][_0x6f2c('0x8f')];_0x222f2c[_0x6f2c('0x91')]=_0x33a57b[_0x6f2c('0x64')]['externalUrl'];return db[_0x6f2c('0x90')][_0x6f2c('0x63')](_0x222f2c)[_0x6f2c('0x20')](function(_0x38d785){return[_0x38d785,!![]];});});}else{_0x3fa0b5[_0x6f2c('0x8f')]=null;}_0x3fa0b5[_0x6f2c('0x92')]=_0x34f440['id'];return db[_0x6f2c('0x90')][_0x6f2c('0x5c')]({'where':_0x3fa0b5})[_0x6f2c('0x20')](function(_0x43cece){if(_0x43cece){return[_0x43cece,![]];}return db[_0x6f2c('0x90')][_0x6f2c('0x63')](_0x222f2c)[_0x6f2c('0x20')](function(_0xa49d96){return[_0xa49d96,!![]];});});}})[_0x6f2c('0x93')](function(_0x43e70f,_0x3ad943){if(_0x43e70f){_0x112886=_0x3ad943;if(!_0x3ad943){var _0x2f72f8={'from':(_0x14af59[_0x6f2c('0x8c')][_0x6f2c('0x8d')]||'')+'\x20'+(_0x14af59[_0x6f2c('0x8c')]['lastName']||'')};if(_0x33a57b[_0x6f2c('0x64')][_0x6f2c('0x8f')]&&_0x33a57b[_0x6f2c('0x64')][_0x6f2c('0x94')]&&_0x33a57b['body'][_0x6f2c('0x8f')]!=_0x33a57b['body'][_0x6f2c('0x94')]){_0x2f72f8['threadId']=_0x33a57b[_0x6f2c('0x64')][_0x6f2c('0x94')];}return _0x43e70f['update'](_0x2f72f8);}else{return _0x43e70f;}}})[_0x6f2c('0x20')](function(_0x440022){_0x14af59['interaction']=_0x440022[_0x6f2c('0x5e')]({'plain':!![]});_0x14af59[_0x6f2c('0x95')][_0x6f2c('0x96')]=_0x112886;if(_0x14af59['interaction'][_0x6f2c('0x96')]){if(_0x14af59[_0x6f2c('0x88')]['autoclose']){_0x14af59[_0x6f2c('0x83')]['push']({'id':0x0,'priority':_0x14af59[_0x6f2c('0x83')]['length']+0x1,'app':_0x6f2c('0x97'),'appdata':'unmanaged','interval':_0x6f2c('0x98')});}}return db[_0x6f2c('0x99')][_0x6f2c('0x63')]({'body':_0x33a57b[_0x6f2c('0x64')][_0x6f2c('0x64')],'OpenchannelAccountId':_0x33a57b[_0x6f2c('0x5b')]['id'],'OpenchannelInteractionId':_0x440022['id'],'direction':'in','ContactId':_0x14af59[_0x6f2c('0x8c')]['id'],'AttachmentId':_0x33a57b[_0x6f2c('0x64')][_0x6f2c('0x9a')]});})[_0x6f2c('0x20')](function(_0x3e1723){_0x14af59[_0x6f2c('0x28')]=_0x3e1723;if(_0x14af59[_0x6f2c('0x95')][_0x6f2c('0x9b')]){return db[_0x6f2c('0x9c')][_0x6f2c('0x5c')]({'attributes':['id','name'],'where':{'id':_0x14af59['interaction'][_0x6f2c('0x9b')]}})[_0x6f2c('0x20')](function(_0x1c36d2){if(_0x1c36d2){_0x14af59[_0x6f2c('0x83')][_0x6f2c('0x9d')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1c36d2['name']+','+(_0x14af59[_0x6f2c('0x88')][_0x6f2c('0x9e')]||0xa),'interval':_0x6f2c('0x98')});_0x14af59[_0x6f2c('0x9f')]=![];}return respondWithRpcPromise(_0x6f2c('0xa0'),_0x6f2c('0xa1'),_0x14af59);});}return respondWithRpcPromise(_0x6f2c('0xa0'),_0x6f2c('0xa1'),_0x14af59);})[_0x6f2c('0x20')](function(_0x31ffb2){respondWithRpcPromise(_0x6f2c('0xa2'),_0x6f2c('0xa2'),{'event':'notify','message':_0x31ffb2},client9002);return _0x31ffb2;})[_0x6f2c('0x20')](respondWithResult(_0x24b12d,null))[_0x6f2c('0x2a')](handleError(_0x24b12d,null));};exports[_0x6f2c('0xa3')]=function(_0x40a200,_0x24d3bb,_0x27e820){return db['OpenchannelAccount'][_0x6f2c('0x6d')]({'where':{'id':_0x40a200['params']['id']}})['then'](handleEntityNotFound(_0x24d3bb,null))[_0x6f2c('0x20')](function(_0x5695f7){if(_0x5695f7){return db['sequelize'][_0x6f2c('0xa4')](function(_0x1393bd){return db['OpenchannelApplication'][_0x6f2c('0x39')]({'where':{'OpenchannelAccountId':_0x40a200[_0x6f2c('0x5b')]['id']},'transaction':_0x1393bd})[_0x6f2c('0x20')](function(_0x4a0a35){var _0x18d0b5=_[_0x6f2c('0x40')](_0x40a200[_0x6f2c('0x64')],function(_0xa50410){_0xa50410[_0x6f2c('0x67')]=_0x40a200[_0x6f2c('0x5b')]['id'];return _0xa50410;});return db[_0x6f2c('0x82')]['bulkCreate'](_0x18d0b5,{'transaction':_0x1393bd});});})[_0x6f2c('0x20')](function(){return db[_0x6f2c('0x82')][_0x6f2c('0xa5')]({'where':{'OpenchannelAccountId':_0x40a200[_0x6f2c('0x5b')]['id']},'order':_0x6f2c('0xa6')});});}})[_0x6f2c('0x20')](respondWithResult(_0x24d3bb,null))['catch'](handleError(_0x24d3bb,null));};exports[_0x6f2c('0xa7')]=function(_0x3724ce,_0x3eed50,_0x5759b9){var _0x2b940e={};var _0x5e2405={};var _0x2d3b8f;var _0x299358;return db[_0x6f2c('0x55')][_0x6f2c('0x6d')]({'where':{'id':_0x3724ce[_0x6f2c('0x5b')]['id']}})[_0x6f2c('0x20')](handleEntityNotFound(_0x3eed50,null))[_0x6f2c('0x20')](function(_0x59c04f){if(_0x59c04f){_0x2d3b8f=_0x59c04f;_0x5e2405[_0x6f2c('0x48')]=_['keys'](db['OpenchannelApplication'][_0x6f2c('0x41')]);_0x5e2405[_0x6f2c('0x45')]=_[_0x6f2c('0x46')](_0x3724ce[_0x6f2c('0x45')]);_0x5e2405[_0x6f2c('0x50')]=_[_0x6f2c('0x47')](_0x5e2405[_0x6f2c('0x48')],_0x5e2405[_0x6f2c('0x45')]);_0x2b940e[_0x6f2c('0x49')]=_['intersection'](_0x5e2405[_0x6f2c('0x48')],qs[_0x6f2c('0x4a')](_0x3724ce[_0x6f2c('0x45')]['fields']));_0x2b940e[_0x6f2c('0x49')]=_0x2b940e[_0x6f2c('0x49')]['length']?_0x2b940e['attributes']:_0x5e2405['model'];_0x2b940e['order']=qs['sort'](_0x3724ce[_0x6f2c('0x45')]['sort']);_0x2b940e['where']=qs['filters'](_['pick'](_0x3724ce[_0x6f2c('0x45')],_0x5e2405[_0x6f2c('0x50')]));if(_0x3724ce[_0x6f2c('0x45')]['filter']){_0x2b940e[_0x6f2c('0x52')]=_['merge'](_0x2b940e['where'],{'$or':_[_0x6f2c('0x40')](_0x2b940e[_0x6f2c('0x49')],function(_0x1c8e86){var _0x2709b9={};_0x2709b9[_0x1c8e86]={'$like':'%'+_0x3724ce['query'][_0x6f2c('0x53')]+'%'};return _0x2709b9;})});}_0x2b940e=_[_0x6f2c('0x51')]({},_0x2b940e,_0x3724ce[_0x6f2c('0x54')]);return _0x2d3b8f[_0x6f2c('0xa7')](_0x2b940e);}})[_0x6f2c('0x20')](function(_0xbf5fa2){if(_0xbf5fa2){_0x299358=_0xbf5fa2[_0x6f2c('0x4b')];if(!_0x3724ce[_0x6f2c('0x45')][_0x6f2c('0x69')](_0x6f2c('0x4c'))){_0x2b940e[_0x6f2c('0x31')]=qs['limit'](_0x3724ce[_0x6f2c('0x45')]['limit']);_0x2b940e[_0x6f2c('0x2f')]=qs[_0x6f2c('0x2f')](_0x3724ce['query'][_0x6f2c('0x2f')]);}return _0x2d3b8f[_0x6f2c('0xa7')](_0x2b940e);}})[_0x6f2c('0x20')](function(_0x573562){if(_0x573562){return _0x573562?{'count':_0x299358,'rows':_0x573562}:null;}})[_0x6f2c('0x20')](respondWithResult(_0x3eed50,null))[_0x6f2c('0x2a')](handleError(_0x3eed50,null));};exports[_0x6f2c('0xa8')]=function(_0x229dcc,_0x13407b,_0x4d6a2b){var _0x35fb54={'raw':![],'where':{}};var _0x3c05a8={};var _0x410b1b={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x229dcc[_0x6f2c('0x5b')]['id']}})[_0x6f2c('0x20')](handleEntityNotFound(_0x13407b,null))['then'](function(_0x40e041){if(_0x40e041){_0x3c05a8[_0x6f2c('0x48')]=_[_0x6f2c('0x46')](db[_0x6f2c('0x90')][_0x6f2c('0x41')]);_0x3c05a8[_0x6f2c('0x45')]=_[_0x6f2c('0x46')](_0x229dcc[_0x6f2c('0x45')]);_0x3c05a8['filters']=_[_0x6f2c('0x47')](_0x3c05a8[_0x6f2c('0x48')],_0x3c05a8['query']);_0x35fb54[_0x6f2c('0x49')]=_[_0x6f2c('0x47')](_0x3c05a8[_0x6f2c('0x48')],qs['fields'](_0x229dcc[_0x6f2c('0x45')][_0x6f2c('0x4a')]));_0x35fb54[_0x6f2c('0x49')]=_0x35fb54[_0x6f2c('0x49')]['length']?_0x35fb54['attributes']:_0x3c05a8[_0x6f2c('0x48')];if(!_0x229dcc[_0x6f2c('0x45')][_0x6f2c('0x69')]('nolimit')){_0x35fb54['limit']=qs['limit'](_0x229dcc[_0x6f2c('0x45')][_0x6f2c('0x31')]);_0x35fb54[_0x6f2c('0x2f')]=qs['offset'](_0x229dcc[_0x6f2c('0x45')]['offset']);}_0x35fb54[_0x6f2c('0x4d')]=qs[_0x6f2c('0x4e')](_0x229dcc['query'][_0x6f2c('0x4e')]);_0x35fb54[_0x6f2c('0x52')]=qs[_0x6f2c('0x50')](_['pick'](_0x229dcc[_0x6f2c('0x45')],_0x3c05a8[_0x6f2c('0x50')]));_0x35fb54[_0x6f2c('0x52')][_0x6f2c('0x67')]=_0x40e041['id'];if(_0x229dcc[_0x6f2c('0x45')][_0x6f2c('0x53')]){_0x35fb54[_0x6f2c('0x52')]=_[_0x6f2c('0x51')](_0x35fb54[_0x6f2c('0x52')],{'$or':_[_0x6f2c('0x40')](_0x35fb54['attributes'],function(_0x21859a){var _0x327b14={};_0x327b14[_0x21859a]={'$like':'%'+_0x229dcc[_0x6f2c('0x45')][_0x6f2c('0x53')]+'%'};return _0x327b14;})});}_0x35fb54=_[_0x6f2c('0x51')]({},_0x35fb54,_0x229dcc[_0x6f2c('0x54')]);return db[_0x6f2c('0x90')]['count']({'where':_0x35fb54['where']})[_0x6f2c('0x20')](function(_0x497025){_0x410b1b[_0x6f2c('0x32')]=_0x497025;if(_0x229dcc[_0x6f2c('0x45')][_0x6f2c('0x56')]){_0x35fb54[_0x6f2c('0x57')]=[{'model':db[_0x6f2c('0x70')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x6f2c('0xa9'),'attributes':[_0x6f2c('0x44'),_0x6f2c('0xaa'),_0x6f2c('0xab')],'required':![]},{'model':db['Tag'],'as':_0x6f2c('0xac'),'attributes':['id',_0x6f2c('0x44'),'color'],'where':_0x229dcc[_0x6f2c('0x45')]['tag']?{'id':_0x229dcc[_0x6f2c('0x45')]['tag']}:undefined,'required':_0x229dcc[_0x6f2c('0x45')][_0x6f2c('0xad')]?!![]:![]}];}return db[_0x6f2c('0x90')][_0x6f2c('0x58')](_0x35fb54);})[_0x6f2c('0x20')](function(_0x34fce9){_0x410b1b[_0x6f2c('0x59')]=_0x34fce9;return _0x410b1b;});}})[_0x6f2c('0x20')](respondWithFilteredResult(_0x13407b,_0x35fb54))[_0x6f2c('0x2a')](handleError(_0x13407b,null));};exports[_0x6f2c('0xae')]=function(_0x143ccf,_0x304a6f,_0x36fbd0){return db[_0x6f2c('0x55')][_0x6f2c('0x5c')]({'where':{'id':_0x143ccf[_0x6f2c('0x5b')]['id']}})[_0x6f2c('0x20')](handleEntityNotFound(_0x304a6f,null))[_0x6f2c('0x20')](function(_0x53da3f){if(_0x53da3f){return _0x53da3f[_0x6f2c('0xae')](_0x143ccf[_0x6f2c('0x64')][_0x6f2c('0x6b')],_[_0x6f2c('0xaf')](_0x143ccf[_0x6f2c('0x64')],[_0x6f2c('0x6b'),'id'])||{})[_0x6f2c('0x93')](function(_0x3e032b){for(var _0x336be7=0x0;_0x336be7<_0x143ccf[_0x6f2c('0x64')][_0x6f2c('0x6b')][_0x6f2c('0x4b')];_0x336be7+=0x1){socket[_0x6f2c('0xb0')]('userOpenchannelAccount:save',{'UserId':Number(_0x143ccf[_0x6f2c('0x64')][_0x6f2c('0x6b')][_0x336be7]),'OpenchannelAccountId':Number(_0x143ccf['params']['id'])});}return _0x3e032b;});}})[_0x6f2c('0x20')](respondWithResult(_0x304a6f,null))[_0x6f2c('0x2a')](handleError(_0x304a6f,null));};exports[_0x6f2c('0xb1')]=function(_0x92c95c,_0x14056b,_0x167642){return db[_0x6f2c('0x55')][_0x6f2c('0x5c')]({'where':{'id':_0x92c95c[_0x6f2c('0x5b')]['id']}})[_0x6f2c('0x20')](handleEntityNotFound(_0x14056b,null))[_0x6f2c('0x20')](function(_0x317313){if(_0x317313){return _0x317313[_0x6f2c('0xb1')](_0x92c95c[_0x6f2c('0x45')][_0x6f2c('0x6b')])['then'](function(){if(_['isArray'](_0x92c95c[_0x6f2c('0x45')]['ids'])){for(var _0x23b3c7=0x0;_0x23b3c7<_0x92c95c[_0x6f2c('0x45')][_0x6f2c('0x6b')][_0x6f2c('0x4b')];_0x23b3c7+=0x1){socket['emit'](_0x6f2c('0xb2'),{'UserId':Number(_0x92c95c[_0x6f2c('0x45')][_0x6f2c('0x6b')][_0x23b3c7]),'OpenchannelAccountId':Number(_0x92c95c[_0x6f2c('0x5b')]['id'])});}}else{socket[_0x6f2c('0xb0')]('userOpenchannelAccount:remove',{'UserId':Number(_0x92c95c[_0x6f2c('0x45')][_0x6f2c('0x6b')]),'OpenchannelAccountId':Number(_0x92c95c['params']['id'])});}});}})[_0x6f2c('0x20')](respondWithStatusCode(_0x14056b,null))[_0x6f2c('0x2a')](handleError(_0x14056b,null));};exports[_0x6f2c('0xb3')]=function(_0x557ca2,_0x517114,_0x35166e){var _0x3b6d1d={};var _0x4e4be6={};var _0x52eb5d;var _0x47ecd1;return db[_0x6f2c('0x55')][_0x6f2c('0x6d')]({'where':{'id':_0x557ca2[_0x6f2c('0x5b')]['id']}})[_0x6f2c('0x20')](handleEntityNotFound(_0x517114,null))['then'](function(_0x22f23c){if(_0x22f23c){_0x52eb5d=_0x22f23c;_0x4e4be6['model']=_[_0x6f2c('0x46')](db[_0x6f2c('0x9c')][_0x6f2c('0x41')]);_0x4e4be6['query']=_[_0x6f2c('0x46')](_0x557ca2['query']);_0x4e4be6[_0x6f2c('0x50')]=_[_0x6f2c('0x47')](_0x4e4be6[_0x6f2c('0x48')],_0x4e4be6[_0x6f2c('0x45')]);_0x3b6d1d[_0x6f2c('0x49')]=_[_0x6f2c('0x47')](_0x4e4be6[_0x6f2c('0x48')],qs[_0x6f2c('0x4a')](_0x557ca2[_0x6f2c('0x45')]['fields']));_0x3b6d1d['attributes']=_0x3b6d1d[_0x6f2c('0x49')][_0x6f2c('0x4b')]?_0x3b6d1d['attributes']:_0x4e4be6[_0x6f2c('0x48')];_0x3b6d1d['order']=qs[_0x6f2c('0x4e')](_0x557ca2[_0x6f2c('0x45')][_0x6f2c('0x4e')]);_0x3b6d1d['where']=qs[_0x6f2c('0x50')](_['pick'](_0x557ca2['query'],_0x4e4be6[_0x6f2c('0x50')]));if(_0x557ca2[_0x6f2c('0x45')]['filter']){_0x3b6d1d[_0x6f2c('0x52')]=_[_0x6f2c('0x51')](_0x3b6d1d['where'],{'$or':_[_0x6f2c('0x40')](_0x3b6d1d[_0x6f2c('0x49')],function(_0x50b3c9){var _0xe5111f={};_0xe5111f[_0x50b3c9]={'$like':'%'+_0x557ca2[_0x6f2c('0x45')]['filter']+'%'};return _0xe5111f;})});}_0x3b6d1d=_['merge']({},_0x3b6d1d,_0x557ca2['options']);return _0x52eb5d[_0x6f2c('0xb3')](_0x3b6d1d);}})[_0x6f2c('0x20')](function(_0x38159c){if(_0x38159c){_0x47ecd1=_0x38159c[_0x6f2c('0x4b')];if(!_0x557ca2['query'][_0x6f2c('0x69')](_0x6f2c('0x4c'))){_0x3b6d1d[_0x6f2c('0x31')]=qs[_0x6f2c('0x31')](_0x557ca2[_0x6f2c('0x45')]['limit']);_0x3b6d1d['offset']=qs['offset'](_0x557ca2[_0x6f2c('0x45')][_0x6f2c('0x2f')]);}return _0x52eb5d['getAgents'](_0x3b6d1d);}})['then'](function(_0x27fba8){if(_0x27fba8){return _0x27fba8?{'count':_0x47ecd1,'rows':_0x27fba8}:null;}})[_0x6f2c('0x20')](respondWithResult(_0x517114,null))['catch'](handleError(_0x517114,null));};exports[_0x6f2c('0x3d')]=function(_0x4c5ff7,_0x264d05,_0x520528){var _0x495427,_0x5cd7eb,_0x493e6b;if(_[_0x6f2c('0x77')](_0x4c5ff7[_0x6f2c('0x64')]['body'])||_0x4c5ff7[_0x6f2c('0x64')][_0x6f2c('0x64')]===''){throw new db[(_0x6f2c('0x71'))][(_0x6f2c('0x72'))](_0x6f2c('0x79'));}if(_[_0x6f2c('0x77')](_0x4c5ff7[_0x6f2c('0x64')]['to'])){}_0x495427=_0x4c5ff7[_0x6f2c('0x64')]['to'];return db['OpenchannelAccount'][_0x6f2c('0x6d')]({'where':{'id':_0x4c5ff7[_0x6f2c('0x5b')]['id']}})[_0x6f2c('0x20')](handleEntityNotFound(_0x264d05,null))[_0x6f2c('0x20')](function(_0x1181fb){if(_0x1181fb){return db[_0x6f2c('0x55')][_0x6f2c('0x5c')]({'where':{'id':_0x1181fb['id']},'include':[{'model':db['CmList'],'as':_0x6f2c('0x7f'),'include':[{'model':db[_0x6f2c('0x70')],'as':_0x6f2c('0x89'),'where':{[_0x1181fb[_0x6f2c('0x7d')]]:_0x495427},'limit':0x1,'order':[[_0x6f2c('0x80'),_0x6f2c('0x81')]]}]}]})[_0x6f2c('0x20')](handleEntityNotFound(_0x264d05,null))[_0x6f2c('0x20')](function(_0x2054c){if(_0x2054c&&_0x2054c['List']){_0x5cd7eb=_0x2054c[_0x6f2c('0x5e')]({'plain':!![]});if(_0x5cd7eb[_0x6f2c('0x7f')]&&_0x5cd7eb[_0x6f2c('0x7f')][_0x6f2c('0x89')][_0x6f2c('0x4b')]){return _0x5cd7eb[_0x6f2c('0x7f')]['Contacts'][0x0];}return db['CmContact'][_0x6f2c('0x63')](_[_0x6f2c('0x8a')](_0x4c5ff7['body'],{'firstName':_0x495427,[_0x2054c[_0x6f2c('0x7d')]]:_0x495427,'phone':_0x495427,'ListId':_0x5cd7eb[_0x6f2c('0x8b')]}));}})[_0x6f2c('0x20')](handleEntityNotFound(_0x264d05,null))['then'](function(_0x3c2a8a){if(_0x3c2a8a){_0x493e6b=_0x3c2a8a;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x493e6b['id'],'closed':![],'OpenchannelAccountId':_0x5cd7eb['id']}})['then'](function(_0x3037a4){if(_0x3037a4){return[_0x3037a4,![]];}return db[_0x6f2c('0x90')]['create']({'UserId':_0x4c5ff7[_0x6f2c('0x5d')]['id'],'ContactId':_0x493e6b['id'],'OpenchannelAccountId':_0x5cd7eb['id'],'lastMsgDirection':_0x6f2c('0xb4'),'Messages':[_[_0x6f2c('0x51')](_0x4c5ff7[_0x6f2c('0x64')],{'read':![],'body':_0x4c5ff7['body'][_0x6f2c('0x64')],'OpenchannelAccountId':_0x5cd7eb['id'],'UserId':_0x4c5ff7['user']['id'],'ContactId':_0x493e6b['id']})]},{'include':[{'model':db[_0x6f2c('0x99')],'as':_0x6f2c('0xb5')}]})[_0x6f2c('0x20')](function(_0x954029){return[_0x954029,!![]];});});}})[_0x6f2c('0x93')](function(_0x5d2c5b,_0x2ae2c3){if(_0x2ae2c3){return _0x5d2c5b;}return db['OpenchannelMessage'][_0x6f2c('0x63')](_[_0x6f2c('0x51')](_0x4c5ff7[_0x6f2c('0x64')],{'read':![],'body':_0x4c5ff7[_0x6f2c('0x64')]['body'],'OpenchannelAccountId':_0x5cd7eb['id'],'OpenchannelInteractionId':_0x5d2c5b['id'],'UserId':_0x4c5ff7[_0x6f2c('0x5d')]['id'],'ContactId':_0x493e6b['id']}))[_0x6f2c('0x20')](function(_0x30c841){_0x5d2c5b['dataValues'][_0x6f2c('0xb5')]=[];_0x5d2c5b[_0x6f2c('0xb6')][_0x6f2c('0xb5')][_0x6f2c('0xb7')](_0x30c841[_0x6f2c('0xb6')]);return _0x5d2c5b;});});}})[_0x6f2c('0x20')](respondWithResult(_0x264d05,null))[_0x6f2c('0x2a')](handleError(_0x264d05,null));}; \ No newline at end of file +var _0xb7d5=['bulkCreate','findAndCountAll','order','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','Messages','spread','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','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','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','count','limit','set','apply','reject','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','OpenchannelAccount','includeAll','include','rows','show','params','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','Pause','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','pick','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','Contacts','DESC','OpenchannelApplication','account','applications','Applications','list','orderBy','asc','contact','firstName','threadId','OpenchannelInteraction','externalUrl','lastName','messageId','interaction','created','autoclose','*,*,*,*','OpenchannelMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','sequelize','transaction'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xb7d5,0xd6));var _0x5b7d=function(_0x956475,_0x77cc4c){_0x956475=_0x956475-0x0;var _0xfee0ab=_0xb7d5[_0x956475];return _0xfee0ab;};'use strict';var emlformat=require(_0x5b7d('0x0'));var rimraf=require(_0x5b7d('0x1'));var zipdir=require(_0x5b7d('0x2'));var jsonpatch=require(_0x5b7d('0x3'));var rp=require(_0x5b7d('0x4'));var moment=require(_0x5b7d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5b7d('0x6'));var sox=require(_0x5b7d('0x7'));var csv=require(_0x5b7d('0x8'));var ejs=require(_0x5b7d('0x9'));var fs=require('fs');var fs_extra=require(_0x5b7d('0xa'));var _=require(_0x5b7d('0xb'));var squel=require(_0x5b7d('0xc'));var crypto=require(_0x5b7d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5b7d('0xe'));var toCsv=require(_0x5b7d('0x8'));var querystring=require(_0x5b7d('0xf'));var Papa=require(_0x5b7d('0x10'));var Redis=require('ioredis');var authService=require(_0x5b7d('0x11'));var qs=require(_0x5b7d('0x12'));var as=require(_0x5b7d('0x13'));var hardwareService=require(_0x5b7d('0x14'));var logger=require(_0x5b7d('0x15'))(_0x5b7d('0x16'));var utils=require(_0x5b7d('0x17'));var config=require(_0x5b7d('0x18'));var licenseUtil=require(_0x5b7d('0x19'));var db=require(_0x5b7d('0x1a'))['db'];config['redis']=_[_0x5b7d('0x1b')](config['redis'],{'host':_0x5b7d('0x1c'),'port':0x18eb});var socket=require(_0x5b7d('0x1d'))(new Redis(config['redis']));require(_0x5b7d('0x1e'))[_0x5b7d('0x1f')](socket);var jayson=require(_0x5b7d('0x20'));var client=jayson[_0x5b7d('0x21')][_0x5b7d('0x22')]({'port':0x232c});var client9002=jayson[_0x5b7d('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14e3b0,_0x2b4941,_0x4854a9,_0x275ce2){return new BPromise(function(_0x1cf134,_0x4d80c9){var _0xcf5099=_0x275ce2||client;return _0xcf5099[_0x5b7d('0x23')](_0x14e3b0,_0x4854a9)[_0x5b7d('0x24')](function(_0x43bb5b){logger[_0x5b7d('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x2b4941,_0x5b7d('0x26'));logger[_0x5b7d('0x27')](_0x5b7d('0x28'),_0x2b4941,_0x5b7d('0x26'),JSON['stringify'](_0x43bb5b));if(_0x43bb5b[_0x5b7d('0x29')]){if(_0x43bb5b[_0x5b7d('0x29')][_0x5b7d('0x2a')]===0x1f4){logger[_0x5b7d('0x29')](_0x5b7d('0x2b'),_0x2b4941,_0x43bb5b[_0x5b7d('0x29')][_0x5b7d('0x2c')]);return _0x4d80c9(_0x43bb5b[_0x5b7d('0x29')]['message']);}logger['error'](_0x5b7d('0x2b'),_0x2b4941,_0x43bb5b[_0x5b7d('0x29')][_0x5b7d('0x2c')]);return _0x1cf134(_0x43bb5b[_0x5b7d('0x29')][_0x5b7d('0x2c')]);}else{logger[_0x5b7d('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x2b4941,'request\x20sent');_0x1cf134(_0x43bb5b[_0x5b7d('0x2d')][_0x5b7d('0x2c')]);}})['catch'](function(_0x46b518){logger[_0x5b7d('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x2b4941,_0x46b518);_0x4d80c9(_0x46b518);});});}function respondWithStatusCode(_0x794ca1,_0x510b7c){_0x510b7c=_0x510b7c||0xcc;return function(_0x5199c9){if(_0x5199c9){return _0x794ca1[_0x5b7d('0x2e')](_0x510b7c);}return _0x794ca1[_0x5b7d('0x2f')](_0x510b7c)[_0x5b7d('0x30')]();};}function respondWithResult(_0x11c633,_0x3d5840){_0x3d5840=_0x3d5840||0xc8;return function(_0xa0b2ba){if(_0xa0b2ba){return _0x11c633[_0x5b7d('0x2f')](_0x3d5840)[_0x5b7d('0x31')](_0xa0b2ba);}};}function respondWithFilteredResult(_0xfa4965,_0x33ee85){return function(_0x15686b){if(_0x15686b){var _0x5663d5=typeof _0x33ee85[_0x5b7d('0x32')]==='undefined'&&typeof _0x33ee85['limit']==='undefined';var _0x5d0e31=_0x15686b[_0x5b7d('0x33')];var _0x1b50b5=_0x5663d5?0x0:_0x33ee85[_0x5b7d('0x32')];var _0x399651=_0x5663d5?_0x15686b[_0x5b7d('0x33')]:_0x33ee85[_0x5b7d('0x32')]+_0x33ee85[_0x5b7d('0x34')];var _0x583071;if(_0x399651>=_0x5d0e31){_0x399651=_0x5d0e31;_0x583071=0xc8;}else{_0x583071=0xce;}_0xfa4965[_0x5b7d('0x2f')](_0x583071);return _0xfa4965[_0x5b7d('0x35')]('Content-Range',_0x1b50b5+'-'+_0x399651+'/'+_0x5d0e31)[_0x5b7d('0x31')](_0x15686b);}return null;};}function patchUpdates(_0x41bb28){return function(_0x1346e0){try{jsonpatch[_0x5b7d('0x36')](_0x1346e0,_0x41bb28,!![]);}catch(_0xeebbb7){return BPromise[_0x5b7d('0x37')](_0xeebbb7);}return _0x1346e0[_0x5b7d('0x38')]();};}function saveUpdates(_0x295405,_0x2eac66){return function(_0x2ab65e){if(_0x2ab65e){return _0x2ab65e[_0x5b7d('0x39')](_0x295405)['then'](function(_0x43df9e){return _0x43df9e;});}return null;};}function removeEntity(_0x49e30d,_0x337941){return function(_0x28ef87){if(_0x28ef87){return _0x28ef87[_0x5b7d('0x3a')]()['then'](function(){var _0x49edb5=_0x28ef87[_0x5b7d('0x3b')]({'plain':!![]});var _0x7c31ee=_0x5b7d('0x3c');return db[_0x5b7d('0x3d')]['destroy']({'where':{'type':_0x7c31ee,'resourceId':_0x49edb5['id']}})['then'](function(){return _0x28ef87;});})[_0x5b7d('0x24')](function(){_0x49e30d[_0x5b7d('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c0c5f,_0x2dabc8){return function(_0x5ac32c){if(!_0x5ac32c){_0x4c0c5f['sendStatus'](0x194);}return _0x5ac32c;};}function handleError(_0x26f339,_0x31ae6b){_0x31ae6b=_0x31ae6b||0x1f4;return function(_0x5353fa){logger['error'](_0x5353fa[_0x5b7d('0x3e')]);if(_0x5353fa[_0x5b7d('0x3f')]){delete _0x5353fa[_0x5b7d('0x3f')];}_0x26f339['status'](_0x31ae6b)[_0x5b7d('0x40')](_0x5353fa);};}exports[_0x5b7d('0x41')]=function(_0x23afcf,_0xf652f6){var _0x433fb7={'include':[{'model':db['Pause'],'as':_0x5b7d('0x42')}]},_0x8ae505={},_0x54a12={'count':0x0,'rows':[]};var _0x3c8da9=_[_0x5b7d('0x43')](db['OpenchannelAccount'][_0x5b7d('0x44')],function(_0x47d084){return{'name':_0x47d084['fieldName'],'type':_0x47d084[_0x5b7d('0x45')][_0x5b7d('0x46')]};});_0x8ae505[_0x5b7d('0x47')]=_['map'](_0x3c8da9,_0x5b7d('0x3f'));_0x8ae505['query']=_[_0x5b7d('0x48')](_0x23afcf[_0x5b7d('0x49')]);_0x8ae505[_0x5b7d('0x4a')]=_[_0x5b7d('0x4b')](_0x8ae505[_0x5b7d('0x47')],_0x8ae505[_0x5b7d('0x49')]);_0x433fb7[_0x5b7d('0x4c')]=_['intersection'](_0x8ae505['model'],qs[_0x5b7d('0x4d')](_0x23afcf[_0x5b7d('0x49')][_0x5b7d('0x4d')]));_0x433fb7[_0x5b7d('0x4c')]=_0x433fb7[_0x5b7d('0x4c')]['length']?_0x433fb7[_0x5b7d('0x4c')]:_0x8ae505[_0x5b7d('0x47')];if(!_0x23afcf[_0x5b7d('0x49')][_0x5b7d('0x4e')](_0x5b7d('0x4f'))){_0x433fb7['limit']=qs['limit'](_0x23afcf[_0x5b7d('0x49')]['limit']);_0x433fb7['offset']=qs[_0x5b7d('0x32')](_0x23afcf[_0x5b7d('0x49')]['offset']);}_0x433fb7['order']=qs['sort'](_0x23afcf[_0x5b7d('0x49')][_0x5b7d('0x50')]);_0x433fb7[_0x5b7d('0x51')]=qs['filters'](_['pick'](_0x23afcf[_0x5b7d('0x49')],_0x8ae505[_0x5b7d('0x4a')]),_0x3c8da9);if(_0x23afcf[_0x5b7d('0x49')][_0x5b7d('0x52')]){_0x433fb7[_0x5b7d('0x51')]=_[_0x5b7d('0x53')](_0x433fb7['where'],{'$or':_[_0x5b7d('0x43')](_0x3c8da9,function(_0x33ad02){if(_0x33ad02['type']!==_0x5b7d('0x54')){var _0x4cc728={};_0x4cc728[_0x33ad02['name']]={'$like':'%'+_0x23afcf['query'][_0x5b7d('0x52')]+'%'};return _0x4cc728;}})});}_0x433fb7=_[_0x5b7d('0x53')]({},_0x433fb7,_0x23afcf[_0x5b7d('0x55')]);var _0x5b3a7c={'where':_0x433fb7[_0x5b7d('0x51')]};return db[_0x5b7d('0x56')][_0x5b7d('0x33')](_0x5b3a7c)[_0x5b7d('0x24')](function(_0x3abef4){_0x54a12[_0x5b7d('0x33')]=_0x3abef4;if(_0x23afcf['query'][_0x5b7d('0x57')]){_0x433fb7[_0x5b7d('0x58')]=[{'all':!![]}];}return db[_0x5b7d('0x56')]['findAll'](_0x433fb7);})[_0x5b7d('0x24')](function(_0x35a6ce){_0x54a12[_0x5b7d('0x59')]=_0x35a6ce;return _0x54a12;})[_0x5b7d('0x24')](respondWithFilteredResult(_0xf652f6,_0x433fb7))['catch'](handleError(_0xf652f6,null));};exports[_0x5b7d('0x5a')]=function(_0x11e53c,_0x19fcae){var _0x422dcf={'raw':![],'where':{'id':_0x11e53c[_0x5b7d('0x5b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xf2d639={};_0xf2d639['model']=_[_0x5b7d('0x48')](db[_0x5b7d('0x56')]['rawAttributes']);_0xf2d639[_0x5b7d('0x49')]=_[_0x5b7d('0x48')](_0x11e53c[_0x5b7d('0x49')]);_0xf2d639['filters']=_[_0x5b7d('0x4b')](_0xf2d639[_0x5b7d('0x47')],_0xf2d639[_0x5b7d('0x49')]);_0x422dcf[_0x5b7d('0x4c')]=_[_0x5b7d('0x4b')](_0xf2d639[_0x5b7d('0x47')],qs[_0x5b7d('0x4d')](_0x11e53c[_0x5b7d('0x49')][_0x5b7d('0x4d')]));_0x422dcf['attributes']=_0x422dcf[_0x5b7d('0x4c')][_0x5b7d('0x5c')]?_0x422dcf[_0x5b7d('0x4c')]:_0xf2d639[_0x5b7d('0x47')];if(_0x11e53c[_0x5b7d('0x49')][_0x5b7d('0x57')]){_0x422dcf[_0x5b7d('0x58')]=[{'all':!![]}];}_0x422dcf=_[_0x5b7d('0x53')]({},_0x422dcf,_0x11e53c[_0x5b7d('0x55')]);return db[_0x5b7d('0x56')]['find'](_0x422dcf)['then'](handleEntityNotFound(_0x19fcae,null))[_0x5b7d('0x24')](respondWithResult(_0x19fcae,null))['catch'](handleError(_0x19fcae,null));};exports[_0x5b7d('0x5d')]=function(_0x2c2104,_0x443e51){return db[_0x5b7d('0x56')][_0x5b7d('0x5d')](_0x2c2104[_0x5b7d('0x5e')],{})[_0x5b7d('0x24')](function(_0x38c341){var _0x15bdc8=_0x2c2104['user']['get']({'plain':!![]});if(!_0x15bdc8)throw new Error(_0x5b7d('0x5f'));if(_0x15bdc8[_0x5b7d('0x60')]===_0x5b7d('0x61')){var _0xba6b69=_0x38c341['get']({'plain':!![]});var _0x576a11=_0x5b7d('0x3c');return db['UserProfileSection'][_0x5b7d('0x62')]({'where':{'name':_0x576a11,'userProfileId':_0x15bdc8[_0x5b7d('0x63')]},'raw':!![]})[_0x5b7d('0x24')](function(_0x4a088d){if(_0x4a088d&&_0x4a088d[_0x5b7d('0x64')]===0x0){return db[_0x5b7d('0x3d')]['create']({'name':_0xba6b69[_0x5b7d('0x3f')],'resourceId':_0xba6b69['id'],'type':_0x4a088d[_0x5b7d('0x3f')],'sectionId':_0x4a088d['id']},{})[_0x5b7d('0x24')](function(){return _0x38c341;});}else{return _0x38c341;}})['catch'](function(_0x41437f){logger[_0x5b7d('0x29')](_0x5b7d('0x65'),_0x41437f);throw _0x41437f;});}return _0x38c341;})[_0x5b7d('0x24')](respondWithResult(_0x443e51,0xc9))[_0x5b7d('0x66')](handleError(_0x443e51,null));};exports[_0x5b7d('0x39')]=function(_0x5d3bf6,_0x16a5e2){if(_0x5d3bf6['body']['id']){delete _0x5d3bf6[_0x5b7d('0x5e')]['id'];}return db[_0x5b7d('0x56')][_0x5b7d('0x62')]({'where':{'id':_0x5d3bf6[_0x5b7d('0x5b')]['id']},'include':[{'model':db[_0x5b7d('0x67')],'as':_0x5b7d('0x42')}]})[_0x5b7d('0x24')](handleEntityNotFound(_0x16a5e2,null))['then'](saveUpdates(_0x5d3bf6[_0x5b7d('0x5e')],null))[_0x5b7d('0x24')](respondWithResult(_0x16a5e2,null))[_0x5b7d('0x66')](handleError(_0x16a5e2,null));};exports['destroy']=function(_0x11fae7,_0x11571f){return db['OpenchannelAccount'][_0x5b7d('0x62')]({'where':{'id':_0x11fae7['params']['id']}})['then'](handleEntityNotFound(_0x11571f,null))[_0x5b7d('0x24')](removeEntity(_0x11571f,null))[_0x5b7d('0x66')](handleError(_0x11571f,null));};exports[_0x5b7d('0x68')]=function(_0x52ef02,_0x5207c6){return db[_0x5b7d('0x56')]['describe']()[_0x5b7d('0x24')](respondWithResult(_0x5207c6,null))[_0x5b7d('0x66')](handleError(_0x5207c6,null));};exports[_0x5b7d('0x69')]=function(_0x229b49,_0x1ba81d,_0x1b485e){if(_0x229b49['body']['id']){delete _0x229b49['body']['id'];}return db[_0x5b7d('0x56')][_0x5b7d('0x62')]({'where':{'id':_0x229b49['params']['id']}})[_0x5b7d('0x24')](handleEntityNotFound(_0x1ba81d,null))['then'](function(_0x5a14c9){if(_0x5a14c9){_0x229b49[_0x5b7d('0x5e')][_0x5b7d('0x6a')]=_0x5a14c9['id'];return db[_0x5b7d('0x6b')]['create'](_0x229b49[_0x5b7d('0x5e')]);}})[_0x5b7d('0x24')](respondWithResult(_0x1ba81d,null))[_0x5b7d('0x66')](handleError(_0x1ba81d,null));};exports[_0x5b7d('0x6c')]=function(_0x2e8fb5,_0x3b7b81,_0xe81336){var _0x490b62={'raw':![],'where':{}};var _0x308036={};var _0x29eda7={'count':0x0,'rows':[]};return db[_0x5b7d('0x56')][_0x5b7d('0x6d')]({'where':{'id':_0x2e8fb5['params']['id']}})['then'](handleEntityNotFound(_0x3b7b81,null))[_0x5b7d('0x24')](function(_0x466f66){if(_0x466f66){_0x308036['model']=_[_0x5b7d('0x48')](db[_0x5b7d('0x6b')][_0x5b7d('0x44')]);_0x308036[_0x5b7d('0x49')]=_[_0x5b7d('0x48')](_0x2e8fb5['query']);_0x308036[_0x5b7d('0x4a')]=_[_0x5b7d('0x4b')](_0x308036['model'],_0x308036[_0x5b7d('0x49')]);_0x490b62[_0x5b7d('0x4c')]=_['intersection'](_0x308036[_0x5b7d('0x47')],qs[_0x5b7d('0x4d')](_0x2e8fb5[_0x5b7d('0x49')]['fields']));_0x490b62[_0x5b7d('0x4c')]=_0x490b62[_0x5b7d('0x4c')]['length']?_0x490b62['attributes']:_0x308036['model'];if(!_0x2e8fb5['query'][_0x5b7d('0x4e')](_0x5b7d('0x4f'))){_0x490b62[_0x5b7d('0x34')]=qs['limit'](_0x2e8fb5[_0x5b7d('0x49')]['limit']);_0x490b62[_0x5b7d('0x32')]=qs['offset'](_0x2e8fb5[_0x5b7d('0x49')][_0x5b7d('0x32')]);}_0x490b62['order']=qs[_0x5b7d('0x50')](_0x2e8fb5[_0x5b7d('0x49')][_0x5b7d('0x50')]);_0x490b62[_0x5b7d('0x51')]=qs[_0x5b7d('0x4a')](_[_0x5b7d('0x6e')](_0x2e8fb5[_0x5b7d('0x49')],_0x308036[_0x5b7d('0x4a')]));_0x490b62['where'][_0x5b7d('0x6a')]=_0x466f66['id'];if(_0x2e8fb5[_0x5b7d('0x49')][_0x5b7d('0x52')]){_0x490b62[_0x5b7d('0x51')]=_[_0x5b7d('0x53')](_0x490b62[_0x5b7d('0x51')],{'$or':_[_0x5b7d('0x43')](_0x490b62[_0x5b7d('0x4c')],function(_0x562724){var _0x25ab70={};_0x25ab70[_0x562724]={'$like':'%'+_0x2e8fb5['query'][_0x5b7d('0x52')]+'%'};return _0x25ab70;})});}_0x490b62=_[_0x5b7d('0x53')]({},_0x490b62,_0x2e8fb5[_0x5b7d('0x55')]);return db['Disposition'][_0x5b7d('0x33')]({'where':_0x490b62[_0x5b7d('0x51')]})[_0x5b7d('0x24')](function(_0x408684){_0x29eda7['count']=_0x408684;if(_0x2e8fb5[_0x5b7d('0x49')]['includeAll']){_0x490b62[_0x5b7d('0x58')]=[{'all':!![]}];}return db['Disposition'][_0x5b7d('0x6f')](_0x490b62);})[_0x5b7d('0x24')](function(_0x12a202){_0x29eda7['rows']=_0x12a202;return _0x29eda7;});}})[_0x5b7d('0x24')](respondWithFilteredResult(_0x3b7b81,_0x490b62))['catch'](handleError(_0x3b7b81,null));};exports[_0x5b7d('0x70')]=function(_0x21837a,_0x135ca9,_0x494277){return db[_0x5b7d('0x56')][_0x5b7d('0x62')]({'where':{'id':_0x21837a['params']['id']}})[_0x5b7d('0x24')](handleEntityNotFound(_0x135ca9,null))['then'](function(_0x337de4){if(_0x337de4){return _0x337de4[_0x5b7d('0x70')](_0x21837a['query'][_0x5b7d('0x71')]);}})[_0x5b7d('0x24')](respondWithStatusCode(_0x135ca9,null))[_0x5b7d('0x66')](handleError(_0x135ca9,null));};exports['addAnswer']=function(_0x24e208,_0x18e027,_0x1d0e58){if(_0x24e208['body']['id']){delete _0x24e208[_0x5b7d('0x5e')]['id'];}return db[_0x5b7d('0x56')][_0x5b7d('0x62')]({'where':{'id':_0x24e208[_0x5b7d('0x5b')]['id']}})[_0x5b7d('0x24')](handleEntityNotFound(_0x18e027,null))[_0x5b7d('0x24')](function(_0x3c2e7a){if(_0x3c2e7a){_0x24e208[_0x5b7d('0x5e')][_0x5b7d('0x6a')]=_0x3c2e7a['id'];return db[_0x5b7d('0x72')][_0x5b7d('0x5d')](_0x24e208[_0x5b7d('0x5e')]);}})[_0x5b7d('0x24')](respondWithResult(_0x18e027,null))[_0x5b7d('0x66')](handleError(_0x18e027,null));};exports[_0x5b7d('0x73')]=function(_0x237deb,_0x1489dd,_0xe4901a){var _0x4a2dae={'raw':![],'where':{}};var _0x35aa90={};var _0x450bf5={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x237deb[_0x5b7d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1489dd,null))[_0x5b7d('0x24')](function(_0x20d2da){if(_0x20d2da){_0x35aa90[_0x5b7d('0x47')]=_[_0x5b7d('0x48')](db['CannedAnswer'][_0x5b7d('0x44')]);_0x35aa90['query']=_['keys'](_0x237deb[_0x5b7d('0x49')]);_0x35aa90['filters']=_[_0x5b7d('0x4b')](_0x35aa90['model'],_0x35aa90['query']);_0x4a2dae['attributes']=_[_0x5b7d('0x4b')](_0x35aa90[_0x5b7d('0x47')],qs[_0x5b7d('0x4d')](_0x237deb[_0x5b7d('0x49')][_0x5b7d('0x4d')]));_0x4a2dae[_0x5b7d('0x4c')]=_0x4a2dae[_0x5b7d('0x4c')]['length']?_0x4a2dae[_0x5b7d('0x4c')]:_0x35aa90['model'];if(!_0x237deb[_0x5b7d('0x49')][_0x5b7d('0x4e')]('nolimit')){_0x4a2dae[_0x5b7d('0x34')]=qs['limit'](_0x237deb[_0x5b7d('0x49')]['limit']);_0x4a2dae[_0x5b7d('0x32')]=qs['offset'](_0x237deb[_0x5b7d('0x49')]['offset']);}_0x4a2dae['order']=qs[_0x5b7d('0x50')](_0x237deb[_0x5b7d('0x49')][_0x5b7d('0x50')]);_0x4a2dae[_0x5b7d('0x51')]=qs[_0x5b7d('0x4a')](_[_0x5b7d('0x6e')](_0x237deb[_0x5b7d('0x49')],_0x35aa90[_0x5b7d('0x4a')]));_0x4a2dae[_0x5b7d('0x51')]['OpenchannelAccountId']=_0x20d2da['id'];if(_0x237deb[_0x5b7d('0x49')][_0x5b7d('0x52')]){_0x4a2dae[_0x5b7d('0x51')]=_['merge'](_0x4a2dae[_0x5b7d('0x51')],{'$or':_[_0x5b7d('0x43')](_0x4a2dae['attributes'],function(_0x52295b){var _0x17c0d6={};_0x17c0d6[_0x52295b]={'$like':'%'+_0x237deb[_0x5b7d('0x49')]['filter']+'%'};return _0x17c0d6;})});}_0x4a2dae=_[_0x5b7d('0x53')]({},_0x4a2dae,_0x237deb[_0x5b7d('0x55')]);return db[_0x5b7d('0x72')][_0x5b7d('0x33')]({'where':_0x4a2dae['where']})[_0x5b7d('0x24')](function(_0x4ee72d){_0x450bf5[_0x5b7d('0x33')]=_0x4ee72d;if(_0x237deb['query'][_0x5b7d('0x57')]){_0x4a2dae[_0x5b7d('0x58')]=[{'all':!![]}];}return db[_0x5b7d('0x72')][_0x5b7d('0x6f')](_0x4a2dae);})[_0x5b7d('0x24')](function(_0x5d30ac){_0x450bf5[_0x5b7d('0x59')]=_0x5d30ac;return _0x450bf5;});}})['then'](respondWithFilteredResult(_0x1489dd,_0x4a2dae))[_0x5b7d('0x66')](handleError(_0x1489dd,null));};exports['removeAnswers']=function(_0x3ad08a,_0x38e51f,_0x46544a){return db[_0x5b7d('0x56')][_0x5b7d('0x62')]({'where':{'id':_0x3ad08a[_0x5b7d('0x5b')]['id']}})[_0x5b7d('0x24')](handleEntityNotFound(_0x38e51f,null))[_0x5b7d('0x24')](function(_0x5d4f2f){if(_0x5d4f2f){return _0x5d4f2f[_0x5b7d('0x74')](_0x3ad08a[_0x5b7d('0x49')]['ids']);}})[_0x5b7d('0x24')](respondWithStatusCode(_0x38e51f,null))[_0x5b7d('0x66')](handleError(_0x38e51f,null));};exports[_0x5b7d('0x75')]=function(_0x48e874,_0x83f88a,_0x1941fe){var _0x24e331={'body':_0x48e874[_0x5b7d('0x5e')],'channel':_0x5b7d('0x76')};var _0x10d58e=[];var _0x18e966=[];var _0x42139d={};var _0x2f0c87=![];return db[_0x5b7d('0x77')][_0x5b7d('0x68')]()[_0x5b7d('0x24')](function(_0x5b3d20){if(!_0x5b3d20){throw new db[(_0x5b7d('0x78'))][(_0x5b7d('0x79'))](_0x5b7d('0x7a'));}_0x10d58e=_[_0x5b7d('0x7b')](_[_0x5b7d('0x48')](_0x5b3d20),[_0x5b7d('0x7c'),_0x5b7d('0x7d')]);_0x18e966=_[_0x5b7d('0x7b')](_[_0x5b7d('0x48')](_0x5b3d20),[_0x5b7d('0x7c'),_0x5b7d('0x7d'),_0x5b7d('0x7e'),_0x5b7d('0x7f')]);if(_0x48e874[_0x5b7d('0x5e')]['id']){delete _0x48e874[_0x5b7d('0x5e')]['id'];}if(_[_0x5b7d('0x80')](_0x48e874['body'][_0x5b7d('0x81')])){throw new db[(_0x5b7d('0x78'))][(_0x5b7d('0x79'))](_0x5b7d('0x82'));}if(_[_0x5b7d('0x80')](_0x48e874[_0x5b7d('0x5e')][_0x5b7d('0x5e')])||_0x48e874[_0x5b7d('0x5e')]['body']===''){throw new db[(_0x5b7d('0x78'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5b7d('0x80')](_0x48e874[_0x5b7d('0x5e')][_0x5b7d('0x83')])){throw new db[(_0x5b7d('0x78'))]['ValidationError'](_0x5b7d('0x84')+_0x18e966);}if(!_[_0x5b7d('0x85')](_0x18e966,_0x48e874[_0x5b7d('0x5e')][_0x5b7d('0x83')])){throw new db[(_0x5b7d('0x78'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x18e966);}_0x42139d[_0x48e874[_0x5b7d('0x5e')][_0x5b7d('0x83')]]=_0x48e874[_0x5b7d('0x5e')][_0x5b7d('0x81')];})['then'](function(){return db[_0x5b7d('0x56')][_0x5b7d('0x62')]({'where':{'id':_0x48e874['params']['id']},'include':[{'model':db['CmList'],'as':_0x5b7d('0x86'),'include':[{'model':db[_0x5b7d('0x77')],'as':_0x5b7d('0x87'),'where':_0x42139d,'limit':0x1,'order':[[_0x5b7d('0x7d'),_0x5b7d('0x88')]]}]},{'model':db[_0x5b7d('0x89')],'as':'Applications'}]});})[_0x5b7d('0x24')](handleEntityNotFound(_0x83f88a,null))[_0x5b7d('0x24')](function(_0x28f7da){if(_0x28f7da&&_0x28f7da[_0x5b7d('0x86')]){_0x24e331[_0x5b7d('0x8a')]=_0x28f7da;_0x24e331[_0x5b7d('0x8b')]=_0x28f7da[_0x5b7d('0x8c')];_0x24e331[_0x5b7d('0x8d')]=_0x28f7da['List'];_0x24e331['applications']=_[_0x5b7d('0x8e')](_0x24e331[_0x5b7d('0x8b')],['priority'],[_0x5b7d('0x8f')]);if(_0x24e331[_0x5b7d('0x8a')]['Applications']){delete _0x24e331[_0x5b7d('0x8a')]['Applications'];}if(_0x24e331[_0x5b7d('0x8a')]['List']&&_0x24e331[_0x5b7d('0x8a')]['List'][_0x5b7d('0x87')][_0x5b7d('0x5c')]){return _0x24e331['account']['List'][_0x5b7d('0x87')][0x0];}var _0x4da5b9=_[_0x5b7d('0x1b')](_0x48e874['body'],{'firstName':_0x48e874[_0x5b7d('0x5e')]['from'],'ListId':_0x28f7da[_0x5b7d('0x7f')]});_0x4da5b9[_0x48e874[_0x5b7d('0x5e')][_0x5b7d('0x83')]]=_0x48e874[_0x5b7d('0x5e')][_0x5b7d('0x81')];return db[_0x5b7d('0x77')][_0x5b7d('0x5d')](_0x4da5b9,{'fields':_0x10d58e,'raw':!![]});}})[_0x5b7d('0x24')](handleEntityNotFound(_0x83f88a,null))['then'](function(_0x3b7223){_0x24e331[_0x5b7d('0x90')]=_0x3b7223;if(_0x3b7223){var _0x476d6e={'ContactId':_0x3b7223['id'],'OpenchannelAccountId':_0x48e874['params']['id'],'from':(_0x3b7223[_0x5b7d('0x91')]||'')+'\x20'+(_0x3b7223['lastName']||'')};var _0x11030f={'OpenchannelAccountId':_0x48e874[_0x5b7d('0x5b')]['id'],'closed':![]};if(_0x48e874[_0x5b7d('0x5e')][_0x5b7d('0x92')]){_0x11030f[_0x5b7d('0x92')]=_0x48e874[_0x5b7d('0x5e')][_0x5b7d('0x92')];return db[_0x5b7d('0x93')][_0x5b7d('0x62')]({'where':_0x11030f})[_0x5b7d('0x24')](function(_0x4b1ed6){if(_0x4b1ed6){return[_0x4b1ed6,![]];}_0x476d6e[_0x5b7d('0x92')]=_0x48e874['body'][_0x5b7d('0x92')];_0x476d6e[_0x5b7d('0x94')]=_0x48e874[_0x5b7d('0x5e')][_0x5b7d('0x94')];return db['OpenchannelInteraction'][_0x5b7d('0x5d')](_0x476d6e)[_0x5b7d('0x24')](function(_0x3c4d09){return[_0x3c4d09,!![]];});});}else{_0x11030f['threadId']=null;}_0x11030f['ContactId']=_0x3b7223['id'];return db[_0x5b7d('0x93')][_0x5b7d('0x62')]({'where':_0x11030f})['then'](function(_0x22e140){if(_0x22e140){return[_0x22e140,![]];}return db['OpenchannelInteraction'][_0x5b7d('0x5d')](_0x476d6e)[_0x5b7d('0x24')](function(_0x44ffa7){return[_0x44ffa7,!![]];});});}})['spread'](function(_0x296d37,_0x31b755){if(_0x296d37){_0x2f0c87=_0x31b755;if(!_0x31b755){var _0x5ebe59={'from':(_0x24e331['contact'][_0x5b7d('0x91')]||'')+'\x20'+(_0x24e331[_0x5b7d('0x90')][_0x5b7d('0x95')]||'')};if(_0x48e874[_0x5b7d('0x5e')][_0x5b7d('0x92')]&&_0x48e874[_0x5b7d('0x5e')][_0x5b7d('0x96')]&&_0x48e874[_0x5b7d('0x5e')]['threadId']!=_0x48e874[_0x5b7d('0x5e')][_0x5b7d('0x96')]){_0x5ebe59[_0x5b7d('0x92')]=_0x48e874[_0x5b7d('0x5e')][_0x5b7d('0x96')];}return _0x296d37[_0x5b7d('0x39')](_0x5ebe59);}else{return _0x296d37;}}})['then'](function(_0x44dc70){_0x24e331[_0x5b7d('0x97')]=_0x44dc70[_0x5b7d('0x3b')]({'plain':!![]});_0x24e331['interaction'][_0x5b7d('0x98')]=_0x2f0c87;if(_0x24e331[_0x5b7d('0x97')]['created']){if(_0x24e331[_0x5b7d('0x8a')][_0x5b7d('0x99')]){_0x24e331[_0x5b7d('0x8b')]['push']({'id':0x0,'priority':_0x24e331[_0x5b7d('0x8b')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x5b7d('0x9a')});}}return db[_0x5b7d('0x9b')][_0x5b7d('0x5d')]({'body':_0x48e874[_0x5b7d('0x5e')][_0x5b7d('0x5e')],'OpenchannelAccountId':_0x48e874['params']['id'],'OpenchannelInteractionId':_0x44dc70['id'],'direction':'in','ContactId':_0x24e331[_0x5b7d('0x90')]['id'],'AttachmentId':_0x48e874[_0x5b7d('0x5e')]['AttachmentId']});})[_0x5b7d('0x24')](function(_0x3b54f7){_0x24e331[_0x5b7d('0x2c')]=_0x3b54f7;if(_0x24e331['interaction'][_0x5b7d('0x9c')]){return db[_0x5b7d('0x9d')]['find']({'attributes':['id',_0x5b7d('0x3f')],'where':{'id':_0x24e331[_0x5b7d('0x97')][_0x5b7d('0x9c')]}})['then'](function(_0x30817a){if(_0x30817a){_0x24e331['applications'][_0x5b7d('0x9e')]({'id':0x0,'priority':0x0,'app':_0x5b7d('0x9f'),'appdata':_0x30817a['name']+','+(_0x24e331[_0x5b7d('0x8a')][_0x5b7d('0xa0')]||0xa),'interval':'*,*,*,*'});_0x24e331['forcedOwnership']=![];}return respondWithRpcPromise(_0x5b7d('0xa1'),_0x5b7d('0xa2'),_0x24e331);});}return respondWithRpcPromise(_0x5b7d('0xa1'),_0x5b7d('0xa2'),_0x24e331);})['then'](function(_0x311d64){respondWithRpcPromise(_0x5b7d('0xa3'),_0x5b7d('0xa3'),{'event':'notify','message':_0x311d64},client9002);return _0x311d64;})[_0x5b7d('0x24')](respondWithResult(_0x83f88a,null))['catch'](handleError(_0x83f88a,null));};exports['addApplications']=function(_0x2513fc,_0x359975,_0x4abc68){return db[_0x5b7d('0x56')][_0x5b7d('0x6d')]({'where':{'id':_0x2513fc[_0x5b7d('0x5b')]['id']}})[_0x5b7d('0x24')](handleEntityNotFound(_0x359975,null))[_0x5b7d('0x24')](function(_0x3070e5){if(_0x3070e5){return db[_0x5b7d('0xa4')][_0x5b7d('0xa5')](function(_0x2d94a3){return db[_0x5b7d('0x89')][_0x5b7d('0x3a')]({'where':{'OpenchannelAccountId':_0x2513fc[_0x5b7d('0x5b')]['id']},'transaction':_0x2d94a3})[_0x5b7d('0x24')](function(_0x41877b){var _0x207bc5=_[_0x5b7d('0x43')](_0x2513fc[_0x5b7d('0x5e')],function(_0x3cab78){_0x3cab78[_0x5b7d('0x6a')]=_0x2513fc['params']['id'];return _0x3cab78;});return db[_0x5b7d('0x89')][_0x5b7d('0xa6')](_0x207bc5,{'transaction':_0x2d94a3});});})['then'](function(){return db['OpenchannelApplication'][_0x5b7d('0xa7')]({'where':{'OpenchannelAccountId':_0x2513fc[_0x5b7d('0x5b')]['id']},'order':'priority'});});}})[_0x5b7d('0x24')](respondWithResult(_0x359975,null))[_0x5b7d('0x66')](handleError(_0x359975,null));};exports['getApplications']=function(_0x8197da,_0x227202,_0x1de729){var _0x2c7efb={};var _0x3f7129={};var _0x23004f;var _0x307cfc;return db[_0x5b7d('0x56')][_0x5b7d('0x6d')]({'where':{'id':_0x8197da[_0x5b7d('0x5b')]['id']}})[_0x5b7d('0x24')](handleEntityNotFound(_0x227202,null))['then'](function(_0x485111){if(_0x485111){_0x23004f=_0x485111;_0x3f7129[_0x5b7d('0x47')]=_[_0x5b7d('0x48')](db[_0x5b7d('0x89')][_0x5b7d('0x44')]);_0x3f7129[_0x5b7d('0x49')]=_[_0x5b7d('0x48')](_0x8197da[_0x5b7d('0x49')]);_0x3f7129[_0x5b7d('0x4a')]=_[_0x5b7d('0x4b')](_0x3f7129[_0x5b7d('0x47')],_0x3f7129[_0x5b7d('0x49')]);_0x2c7efb[_0x5b7d('0x4c')]=_[_0x5b7d('0x4b')](_0x3f7129[_0x5b7d('0x47')],qs[_0x5b7d('0x4d')](_0x8197da['query'][_0x5b7d('0x4d')]));_0x2c7efb[_0x5b7d('0x4c')]=_0x2c7efb[_0x5b7d('0x4c')][_0x5b7d('0x5c')]?_0x2c7efb['attributes']:_0x3f7129[_0x5b7d('0x47')];_0x2c7efb[_0x5b7d('0xa8')]=qs[_0x5b7d('0x50')](_0x8197da['query'][_0x5b7d('0x50')]);_0x2c7efb['where']=qs[_0x5b7d('0x4a')](_['pick'](_0x8197da[_0x5b7d('0x49')],_0x3f7129[_0x5b7d('0x4a')]));if(_0x8197da['query'][_0x5b7d('0x52')]){_0x2c7efb[_0x5b7d('0x51')]=_[_0x5b7d('0x53')](_0x2c7efb[_0x5b7d('0x51')],{'$or':_[_0x5b7d('0x43')](_0x2c7efb[_0x5b7d('0x4c')],function(_0x3e37d4){var _0x3f833c={};_0x3f833c[_0x3e37d4]={'$like':'%'+_0x8197da[_0x5b7d('0x49')][_0x5b7d('0x52')]+'%'};return _0x3f833c;})});}_0x2c7efb=_['merge']({},_0x2c7efb,_0x8197da[_0x5b7d('0x55')]);return _0x23004f[_0x5b7d('0xa9')](_0x2c7efb);}})[_0x5b7d('0x24')](function(_0x46fe73){if(_0x46fe73){_0x307cfc=_0x46fe73[_0x5b7d('0x5c')];if(!_0x8197da[_0x5b7d('0x49')]['hasOwnProperty']('nolimit')){_0x2c7efb['limit']=qs['limit'](_0x8197da[_0x5b7d('0x49')]['limit']);_0x2c7efb[_0x5b7d('0x32')]=qs['offset'](_0x8197da[_0x5b7d('0x49')]['offset']);}return _0x23004f[_0x5b7d('0xa9')](_0x2c7efb);}})[_0x5b7d('0x24')](function(_0x15f848){if(_0x15f848){return _0x15f848?{'count':_0x307cfc,'rows':_0x15f848}:null;}})[_0x5b7d('0x24')](respondWithResult(_0x227202,null))[_0x5b7d('0x66')](handleError(_0x227202,null));};exports[_0x5b7d('0xaa')]=function(_0xd82ad9,_0x3184ab,_0x49b7f9){var _0x432ca9={'raw':![],'where':{}};var _0x25d50b={};var _0x259014={'count':0x0,'rows':[]};return db[_0x5b7d('0x56')][_0x5b7d('0x6d')]({'where':{'id':_0xd82ad9[_0x5b7d('0x5b')]['id']}})[_0x5b7d('0x24')](handleEntityNotFound(_0x3184ab,null))[_0x5b7d('0x24')](function(_0x3635bd){if(_0x3635bd){_0x25d50b[_0x5b7d('0x47')]=_[_0x5b7d('0x48')](db[_0x5b7d('0x93')][_0x5b7d('0x44')]);_0x25d50b[_0x5b7d('0x49')]=_[_0x5b7d('0x48')](_0xd82ad9[_0x5b7d('0x49')]);_0x25d50b[_0x5b7d('0x4a')]=_[_0x5b7d('0x4b')](_0x25d50b[_0x5b7d('0x47')],_0x25d50b[_0x5b7d('0x49')]);_0x432ca9[_0x5b7d('0x4c')]=_['intersection'](_0x25d50b[_0x5b7d('0x47')],qs['fields'](_0xd82ad9[_0x5b7d('0x49')][_0x5b7d('0x4d')]));_0x432ca9[_0x5b7d('0x4c')]=_0x432ca9['attributes'][_0x5b7d('0x5c')]?_0x432ca9[_0x5b7d('0x4c')]:_0x25d50b[_0x5b7d('0x47')];if(!_0xd82ad9[_0x5b7d('0x49')][_0x5b7d('0x4e')](_0x5b7d('0x4f'))){_0x432ca9[_0x5b7d('0x34')]=qs[_0x5b7d('0x34')](_0xd82ad9[_0x5b7d('0x49')][_0x5b7d('0x34')]);_0x432ca9[_0x5b7d('0x32')]=qs['offset'](_0xd82ad9[_0x5b7d('0x49')][_0x5b7d('0x32')]);}_0x432ca9['order']=qs[_0x5b7d('0x50')](_0xd82ad9[_0x5b7d('0x49')]['sort']);_0x432ca9[_0x5b7d('0x51')]=qs['filters'](_[_0x5b7d('0x6e')](_0xd82ad9['query'],_0x25d50b[_0x5b7d('0x4a')]));_0x432ca9[_0x5b7d('0x51')]['OpenchannelAccountId']=_0x3635bd['id'];if(_0xd82ad9['query'][_0x5b7d('0x52')]){_0x432ca9[_0x5b7d('0x51')]=_['merge'](_0x432ca9[_0x5b7d('0x51')],{'$or':_[_0x5b7d('0x43')](_0x432ca9[_0x5b7d('0x4c')],function(_0x1d0979){var _0x2640b7={};_0x2640b7[_0x1d0979]={'$like':'%'+_0xd82ad9[_0x5b7d('0x49')][_0x5b7d('0x52')]+'%'};return _0x2640b7;})});}_0x432ca9=_[_0x5b7d('0x53')]({},_0x432ca9,_0xd82ad9[_0x5b7d('0x55')]);return db[_0x5b7d('0x93')][_0x5b7d('0x33')]({'where':_0x432ca9[_0x5b7d('0x51')]})['then'](function(_0x4a8aed){_0x259014[_0x5b7d('0x33')]=_0x4a8aed;if(_0xd82ad9[_0x5b7d('0x49')][_0x5b7d('0x57')]){_0x432ca9['include']=[{'model':db[_0x5b7d('0x77')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x5b7d('0xab'),'attributes':[_0x5b7d('0x3f'),_0x5b7d('0xac'),_0x5b7d('0xad')],'required':![]},{'model':db[_0x5b7d('0xae')],'as':_0x5b7d('0xaf'),'attributes':['id',_0x5b7d('0x3f'),_0x5b7d('0xb0')],'where':_0xd82ad9['query'][_0x5b7d('0xb1')]?{'id':_0xd82ad9[_0x5b7d('0x49')][_0x5b7d('0xb1')]}:undefined,'required':_0xd82ad9[_0x5b7d('0x49')][_0x5b7d('0xb1')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x5b7d('0x6f')](_0x432ca9);})[_0x5b7d('0x24')](function(_0x3e361e){_0x259014['rows']=_0x3e361e;return _0x259014;});}})[_0x5b7d('0x24')](respondWithFilteredResult(_0x3184ab,_0x432ca9))['catch'](handleError(_0x3184ab,null));};exports[_0x5b7d('0xb2')]=function(_0x5c496c,_0x4dee72,_0x3ae512){return db[_0x5b7d('0x56')][_0x5b7d('0x62')]({'where':{'id':_0x5c496c[_0x5b7d('0x5b')]['id']}})[_0x5b7d('0x24')](handleEntityNotFound(_0x4dee72,null))[_0x5b7d('0x24')](function(_0x16e093){if(_0x16e093){return _0x16e093[_0x5b7d('0xb2')](_0x5c496c[_0x5b7d('0x5e')][_0x5b7d('0x71')],_[_0x5b7d('0xb3')](_0x5c496c['body'],['ids','id'])||{})['spread'](function(_0x5b78a3){for(var _0x194d11=0x0;_0x194d11<_0x5c496c[_0x5b7d('0x5e')][_0x5b7d('0x71')][_0x5b7d('0x5c')];_0x194d11+=0x1){socket[_0x5b7d('0xb4')]('userOpenchannelAccount:save',{'UserId':Number(_0x5c496c['body'][_0x5b7d('0x71')][_0x194d11]),'OpenchannelAccountId':Number(_0x5c496c['params']['id'])});}return _0x5b78a3;});}})[_0x5b7d('0x24')](respondWithResult(_0x4dee72,null))[_0x5b7d('0x66')](handleError(_0x4dee72,null));};exports[_0x5b7d('0xb5')]=function(_0xf210a9,_0x1e697c,_0x92a8fa){return db['OpenchannelAccount'][_0x5b7d('0x62')]({'where':{'id':_0xf210a9[_0x5b7d('0x5b')]['id']}})[_0x5b7d('0x24')](handleEntityNotFound(_0x1e697c,null))[_0x5b7d('0x24')](function(_0x514384){if(_0x514384){return _0x514384['removeAgents'](_0xf210a9['query'][_0x5b7d('0x71')])['then'](function(){if(_[_0x5b7d('0xb6')](_0xf210a9[_0x5b7d('0x49')][_0x5b7d('0x71')])){for(var _0xc286b6=0x0;_0xc286b6<_0xf210a9['query']['ids']['length'];_0xc286b6+=0x1){socket[_0x5b7d('0xb4')]('userOpenchannelAccount:remove',{'UserId':Number(_0xf210a9[_0x5b7d('0x49')][_0x5b7d('0x71')][_0xc286b6]),'OpenchannelAccountId':Number(_0xf210a9[_0x5b7d('0x5b')]['id'])});}}else{socket[_0x5b7d('0xb4')](_0x5b7d('0xb7'),{'UserId':Number(_0xf210a9['query'][_0x5b7d('0x71')]),'OpenchannelAccountId':Number(_0xf210a9[_0x5b7d('0x5b')]['id'])});}});}})[_0x5b7d('0x24')](respondWithStatusCode(_0x1e697c,null))['catch'](handleError(_0x1e697c,null));};exports[_0x5b7d('0xb8')]=function(_0x5ebde6,_0x40652,_0x4f6326){var _0x1f1e76={};var _0x1607fa={};var _0x47268e;var _0x4d67fc;return db[_0x5b7d('0x56')][_0x5b7d('0x6d')]({'where':{'id':_0x5ebde6[_0x5b7d('0x5b')]['id']}})['then'](handleEntityNotFound(_0x40652,null))['then'](function(_0x1d3fd9){if(_0x1d3fd9){_0x47268e=_0x1d3fd9;_0x1607fa[_0x5b7d('0x47')]=_[_0x5b7d('0x48')](db['User'][_0x5b7d('0x44')]);_0x1607fa[_0x5b7d('0x49')]=_['keys'](_0x5ebde6['query']);_0x1607fa[_0x5b7d('0x4a')]=_[_0x5b7d('0x4b')](_0x1607fa[_0x5b7d('0x47')],_0x1607fa[_0x5b7d('0x49')]);_0x1f1e76[_0x5b7d('0x4c')]=_['intersection'](_0x1607fa[_0x5b7d('0x47')],qs[_0x5b7d('0x4d')](_0x5ebde6[_0x5b7d('0x49')][_0x5b7d('0x4d')]));_0x1f1e76[_0x5b7d('0x4c')]=_0x1f1e76[_0x5b7d('0x4c')][_0x5b7d('0x5c')]?_0x1f1e76[_0x5b7d('0x4c')]:_0x1607fa['model'];_0x1f1e76[_0x5b7d('0xa8')]=qs[_0x5b7d('0x50')](_0x5ebde6['query'][_0x5b7d('0x50')]);_0x1f1e76['where']=qs[_0x5b7d('0x4a')](_['pick'](_0x5ebde6['query'],_0x1607fa[_0x5b7d('0x4a')]));if(_0x5ebde6[_0x5b7d('0x49')][_0x5b7d('0x52')]){_0x1f1e76[_0x5b7d('0x51')]=_[_0x5b7d('0x53')](_0x1f1e76[_0x5b7d('0x51')],{'$or':_[_0x5b7d('0x43')](_0x1f1e76[_0x5b7d('0x4c')],function(_0x49053c){var _0x28b3b9={};_0x28b3b9[_0x49053c]={'$like':'%'+_0x5ebde6[_0x5b7d('0x49')][_0x5b7d('0x52')]+'%'};return _0x28b3b9;})});}_0x1f1e76=_[_0x5b7d('0x53')]({},_0x1f1e76,_0x5ebde6[_0x5b7d('0x55')]);return _0x47268e[_0x5b7d('0xb8')](_0x1f1e76);}})[_0x5b7d('0x24')](function(_0x183686){if(_0x183686){_0x4d67fc=_0x183686[_0x5b7d('0x5c')];if(!_0x5ebde6[_0x5b7d('0x49')][_0x5b7d('0x4e')](_0x5b7d('0x4f'))){_0x1f1e76[_0x5b7d('0x34')]=qs[_0x5b7d('0x34')](_0x5ebde6[_0x5b7d('0x49')][_0x5b7d('0x34')]);_0x1f1e76[_0x5b7d('0x32')]=qs[_0x5b7d('0x32')](_0x5ebde6[_0x5b7d('0x49')][_0x5b7d('0x32')]);}return _0x47268e[_0x5b7d('0xb8')](_0x1f1e76);}})[_0x5b7d('0x24')](function(_0x2acefc){if(_0x2acefc){return _0x2acefc?{'count':_0x4d67fc,'rows':_0x2acefc}:null;}})[_0x5b7d('0x24')](respondWithResult(_0x40652,null))[_0x5b7d('0x66')](handleError(_0x40652,null));};exports['send']=function(_0x3ad6a6,_0x1e5dab,_0x58c043){var _0x48f256,_0x325dc5,_0x494e73;if(_[_0x5b7d('0x80')](_0x3ad6a6[_0x5b7d('0x5e')][_0x5b7d('0x5e')])||_0x3ad6a6[_0x5b7d('0x5e')]['body']===''){throw new db[(_0x5b7d('0x78'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3ad6a6[_0x5b7d('0x5e')]['to'])){}_0x48f256=_0x3ad6a6['body']['to'];return db[_0x5b7d('0x56')][_0x5b7d('0x6d')]({'where':{'id':_0x3ad6a6[_0x5b7d('0x5b')]['id']}})[_0x5b7d('0x24')](handleEntityNotFound(_0x1e5dab,null))[_0x5b7d('0x24')](function(_0x398479){if(_0x398479){return db[_0x5b7d('0x56')][_0x5b7d('0x62')]({'where':{'id':_0x398479['id']},'include':[{'model':db[_0x5b7d('0xb9')],'as':_0x5b7d('0x86'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x398479['mapKey']]:_0x48f256},'limit':0x1,'order':[[_0x5b7d('0x7d'),_0x5b7d('0x88')]]}]}]})['then'](handleEntityNotFound(_0x1e5dab,null))['then'](function(_0x356f49){if(_0x356f49&&_0x356f49['List']){_0x325dc5=_0x356f49[_0x5b7d('0x3b')]({'plain':!![]});if(_0x325dc5['List']&&_0x325dc5[_0x5b7d('0x86')][_0x5b7d('0x87')][_0x5b7d('0x5c')]){return _0x325dc5[_0x5b7d('0x86')][_0x5b7d('0x87')][0x0];}return db[_0x5b7d('0x77')][_0x5b7d('0x5d')](_[_0x5b7d('0x1b')](_0x3ad6a6[_0x5b7d('0x5e')],{'firstName':_0x48f256,[_0x356f49[_0x5b7d('0x83')]]:_0x48f256,'phone':_0x48f256,'ListId':_0x325dc5[_0x5b7d('0x7f')]}));}})[_0x5b7d('0x24')](handleEntityNotFound(_0x1e5dab,null))['then'](function(_0x502bfa){if(_0x502bfa){_0x494e73=_0x502bfa;return db[_0x5b7d('0x93')][_0x5b7d('0x62')]({'where':{'ContactId':_0x494e73['id'],'closed':![],'OpenchannelAccountId':_0x325dc5['id']}})[_0x5b7d('0x24')](function(_0x17e7e7){if(_0x17e7e7){return[_0x17e7e7,![]];}return db[_0x5b7d('0x93')][_0x5b7d('0x5d')]({'UserId':_0x3ad6a6[_0x5b7d('0x61')]['id'],'ContactId':_0x494e73['id'],'OpenchannelAccountId':_0x325dc5['id'],'lastMsgDirection':'out','Messages':[_[_0x5b7d('0x53')](_0x3ad6a6['body'],{'read':![],'body':_0x3ad6a6[_0x5b7d('0x5e')][_0x5b7d('0x5e')],'OpenchannelAccountId':_0x325dc5['id'],'UserId':_0x3ad6a6['user']['id'],'ContactId':_0x494e73['id']})]},{'include':[{'model':db[_0x5b7d('0x9b')],'as':_0x5b7d('0xba')}]})[_0x5b7d('0x24')](function(_0x9475e){return[_0x9475e,!![]];});});}})[_0x5b7d('0xbb')](function(_0x3d6d9d,_0x5edd8f){if(_0x5edd8f){return _0x3d6d9d;}return db['OpenchannelMessage'][_0x5b7d('0x5d')](_[_0x5b7d('0x53')](_0x3ad6a6[_0x5b7d('0x5e')],{'read':![],'body':_0x3ad6a6[_0x5b7d('0x5e')]['body'],'OpenchannelAccountId':_0x325dc5['id'],'OpenchannelInteractionId':_0x3d6d9d['id'],'UserId':_0x3ad6a6[_0x5b7d('0x61')]['id'],'ContactId':_0x494e73['id']}))[_0x5b7d('0x24')](function(_0x1d7f59){_0x3d6d9d[_0x5b7d('0xbc')][_0x5b7d('0xba')]=[];_0x3d6d9d[_0x5b7d('0xbc')][_0x5b7d('0xba')][_0x5b7d('0xbd')](_0x1d7f59['dataValues']);return _0x3d6d9d;});});}})[_0x5b7d('0x24')](respondWithResult(_0x1e5dab,null))[_0x5b7d('0x66')](handleError(_0x1e5dab,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 865a0c4..7202965 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 _0x4522=['OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5df1a8,_0x305923){var _0x5f1670=function(_0x493e91){while(--_0x493e91){_0x5df1a8['push'](_0x5df1a8['shift']());}};_0x5f1670(++_0x305923);}(_0x4522,0x1a0));var _0x2452=function(_0x509fa1,_0x2b2755){_0x509fa1=_0x509fa1-0x0;var _0x13376e=_0x4522[_0x509fa1];return _0x13376e;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x2452('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x2452('0x1')](0x0);var events={'afterCreate':_0x2452('0x2'),'afterUpdate':'update','afterDestroy':_0x2452('0x3')};function emitEvent(_0x1fdf5b){return function(_0x35e30a,_0x2f21dc,_0x34ff44){OpenchannelAccountEvents[_0x2452('0x4')](_0x1fdf5b+':'+_0x35e30a['id'],_0x35e30a);OpenchannelAccountEvents[_0x2452('0x4')](_0x1fdf5b,_0x35e30a);_0x34ff44(null);};}for(var e in events){if(events[_0x2452('0x5')](e)){var event=events[e];OpenchannelAccount[_0x2452('0x6')](e,emitEvent(event));}}module[_0x2452('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x6c76=['update','emit','hook','events','../../mysqldb','OpenchannelAccount','save'];(function(_0xd3d327,_0x57179a){var _0x537a10=function(_0x238ab5){while(--_0x238ab5){_0xd3d327['push'](_0xd3d327['shift']());}};_0x537a10(++_0x57179a);}(_0x6c76,0x184));var _0x66c7=function(_0x947af6,_0x136315){_0x947af6=_0x947af6-0x0;var _0x3c7c34=_0x6c76[_0x947af6];return _0x3c7c34;};'use strict';var EventEmitter=require(_0x66c7('0x0'));var OpenchannelAccount=require(_0x66c7('0x1'))['db'][_0x66c7('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x66c7('0x3'),'afterUpdate':_0x66c7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x572a2b){return function(_0x2f6db7,_0x2b7cf3,_0x49d437){OpenchannelAccountEvents[_0x66c7('0x5')](_0x572a2b+':'+_0x2f6db7['id'],_0x2f6db7);OpenchannelAccountEvents[_0x66c7('0x5')](_0x572a2b,_0x2f6db7);_0x49d437(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x66c7('0x6')](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 071ac04..7a9169c 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(_0x259a5c,_0x1e2322){var _0x4dfac4=function(_0x20d4c7){while(--_0x20d4c7){_0x259a5c['push'](_0x259a5c['shift']());}};_0x4dfac4(++_0x1e2322);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x510284,_0x429726){var _0xbd7a76=function(_0x562df7){while(--_0x562df7){_0x510284['push'](_0x510284['shift']());}};_0xbd7a76(++_0x429726);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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 fbefd7d..6538cc4 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 _0xa5fa=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0xa5fa[_0x3c22e0];return _0x215811;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var rs=require(_0xaa5f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa5f('0x4'))['db'];var utils=require(_0xaa5f('0x5'));var logger=require('../../config/logger')(_0xaa5f('0x6'));var config=require(_0xaa5f('0x7'));var jayson=require(_0xaa5f('0x8'));var client=jayson[_0xaa5f('0x9')][_0xaa5f('0xa')]({'port':0x232a});config[_0xaa5f('0xb')]=_[_0xaa5f('0xc')](config[_0xaa5f('0xb')],{'host':_0xaa5f('0xd'),'port':0x18eb});var socket=require(_0xaa5f('0xe'))(new Redis(config[_0xaa5f('0xb')]));require('./openchannelAccount.socket')[_0xaa5f('0xf')](socket);function respondWithRpcPromise(_0x227ebb,_0x4d3d16,_0x538865){return new BPromise(function(_0x3fa93f,_0x4bb69d){return client['request'](_0x227ebb,_0x538865)[_0xaa5f('0x10')](function(_0x4d24d2){logger[_0xaa5f('0x11')](_0xaa5f('0x12'),_0x4d3d16,_0xaa5f('0x13'));logger[_0xaa5f('0x14')](_0xaa5f('0x15'),_0x4d3d16,'request\x20sent',JSON[_0xaa5f('0x16')](_0x4d24d2));if(_0x4d24d2['error']){if(_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x18')]===0x1f4){logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x4d24d2[_0xaa5f('0x17')]['message']);return _0x4bb69d(_0x4d24d2['error'][_0xaa5f('0x19')]);}logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x19')]);return _0x3fa93f(_0x4d24d2[_0xaa5f('0x17')][_0xaa5f('0x19')]);}else{logger[_0xaa5f('0x11')](_0xaa5f('0x12'),_0x4d3d16,_0xaa5f('0x13'));_0x3fa93f(_0x4d24d2[_0xaa5f('0x1a')][_0xaa5f('0x19')]);}})['catch'](function(_0x1c072){logger[_0xaa5f('0x17')](_0xaa5f('0x12'),_0x4d3d16,_0x1c072);_0x4bb69d(_0x1c072);});});} \ No newline at end of file +var _0x4fad=['request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x2404ed,_0x104e4d){var _0x51b96d=function(_0x4deab1){while(--_0x4deab1){_0x2404ed['push'](_0x2404ed['shift']());}};_0x51b96d(++_0x104e4d);}(_0x4fad,0xcb));var _0xd4fa=function(_0x54857e,_0x35e298){_0x54857e=_0x54857e-0x0;var _0xcb2945=_0x4fad[_0x54857e];return _0xcb2945;};'use strict';var _=require(_0xd4fa('0x0'));var util=require(_0xd4fa('0x1'));var moment=require(_0xd4fa('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4fa('0x3'));var fs=require('fs');var Redis=require(_0xd4fa('0x4'));var db=require(_0xd4fa('0x5'))['db'];var utils=require(_0xd4fa('0x6'));var logger=require(_0xd4fa('0x7'))(_0xd4fa('0x8'));var config=require(_0xd4fa('0x9'));var jayson=require(_0xd4fa('0xa'));var client=jayson['client'][_0xd4fa('0xb')]({'port':0x232a});config['redis']=_[_0xd4fa('0xc')](config[_0xd4fa('0xd')],{'host':_0xd4fa('0xe'),'port':0x18eb});var socket=require(_0xd4fa('0xf'))(new Redis(config[_0xd4fa('0xd')]));require('./openchannelAccount.socket')[_0xd4fa('0x10')](socket);function respondWithRpcPromise(_0x417404,_0x4623ba,_0x5b5443){return new BPromise(function(_0x2df3c5,_0x612e9d){return client[_0xd4fa('0x11')](_0x417404,_0x5b5443)[_0xd4fa('0x12')](function(_0x5e6a10){logger[_0xd4fa('0x13')](_0xd4fa('0x14'),_0x4623ba,_0xd4fa('0x15'));logger['debug'](_0xd4fa('0x16'),_0x4623ba,_0xd4fa('0x15'),JSON[_0xd4fa('0x17')](_0x5e6a10));if(_0x5e6a10[_0xd4fa('0x18')]){if(_0x5e6a10[_0xd4fa('0x18')][_0xd4fa('0x19')]===0x1f4){logger['error'](_0xd4fa('0x14'),_0x4623ba,_0x5e6a10[_0xd4fa('0x18')][_0xd4fa('0x1a')]);return _0x612e9d(_0x5e6a10[_0xd4fa('0x18')][_0xd4fa('0x1a')]);}logger[_0xd4fa('0x18')](_0xd4fa('0x14'),_0x4623ba,_0x5e6a10['error'][_0xd4fa('0x1a')]);return _0x2df3c5(_0x5e6a10[_0xd4fa('0x18')][_0xd4fa('0x1a')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4623ba,_0xd4fa('0x15'));_0x2df3c5(_0x5e6a10['result']['message']);}})[_0xd4fa('0x1b')](function(_0x628bc7){logger[_0xd4fa('0x18')](_0xd4fa('0x14'),_0x4623ba,_0x628bc7);_0x612e9d(_0x628bc7);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index f41ff76..a67d536 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 _0xc73e=['save','update','register','openchannelAccount:','./openchannelAccount.events'];(function(_0x53761f,_0x48906d){var _0x304c63=function(_0x47b07d){while(--_0x47b07d){_0x53761f['push'](_0x53761f['shift']());}};_0x304c63(++_0x48906d);}(_0xc73e,0x1e9));var _0xec73=function(_0x44c41d,_0x392dce){_0x44c41d=_0x44c41d-0x0;var _0x1e2ca0=_0xc73e[_0x44c41d];return _0x1e2ca0;};'use strict';var OpenchannelAccountEvents=require(_0xec73('0x0'));var events=[_0xec73('0x1'),'remove',_0xec73('0x2')];function createListener(_0x39de1c,_0x4b88fa){return function(_0x5e5526){_0x4b88fa['emit'](_0x39de1c,_0x5e5526);};}function removeListener(_0x36ed48,_0x3b35a2){return function(){OpenchannelAccountEvents['removeListener'](_0x36ed48,_0x3b35a2);};}exports[_0xec73('0x3')]=function(_0x26598a){for(var _0x3bd154=0x0,_0x28d95d=events['length'];_0x3bd154<_0x28d95d;_0x3bd154++){var _0x278b3b=events[_0x3bd154];var _0x5bab16=createListener(_0xec73('0x4')+_0x278b3b,_0x26598a);OpenchannelAccountEvents['on'](_0x278b3b,_0x5bab16);}}; \ No newline at end of file +var _0xb07f=['openchannelAccount:','./openchannelAccount.events','save','remove','update','emit','removeListener','length'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb07f,0x109));var _0xfb07=function(_0x4c5773,_0x390f63){_0x4c5773=_0x4c5773-0x0;var _0x5de7b0=_0xb07f[_0x4c5773];return _0x5de7b0;};'use strict';var OpenchannelAccountEvents=require(_0xfb07('0x0'));var events=[_0xfb07('0x1'),_0xfb07('0x2'),_0xfb07('0x3')];function createListener(_0x2e561d,_0xc9317c){return function(_0x3a262e){_0xc9317c[_0xfb07('0x4')](_0x2e561d,_0x3a262e);};}function removeListener(_0x3b3c05,_0x2fc1ce){return function(){OpenchannelAccountEvents[_0xfb07('0x5')](_0x3b3c05,_0x2fc1ce);};}exports['register']=function(_0x3c79a9){for(var _0x934f98=0x0,_0x14fc69=events[_0xfb07('0x6')];_0x934f98<_0x14fc69;_0x934f98++){var _0x41d73a=events[_0x934f98];var _0x3bb9cf=createListener(_0xfb07('0x7')+_0x41d73a,_0x3c79a9);OpenchannelAccountEvents['on'](_0x41d73a,_0x3bb9cf);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 94d084e..2851b54 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 _0x2d31=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1f6927,_0x409e90){var _0xc20c45=function(_0x63fa4e){while(--_0x63fa4e){_0x1f6927['push'](_0x1f6927['shift']());}};_0xc20c45(++_0x409e90);}(_0x2d31,0x19c));var _0x12d3=function(_0x5575cd,_0x73ab7a){_0x5575cd=_0x5575cd-0x0;var _0x4979a0=_0x2d31[_0x5575cd];return _0x4979a0;};'use strict';var multer=require(_0x12d3('0x0'));var util=require(_0x12d3('0x1'));var path=require(_0x12d3('0x2'));var timeout=require(_0x12d3('0x3'));var express=require(_0x12d3('0x4'));var router=express[_0x12d3('0x5')]();var fs_extra=require(_0x12d3('0x6'));var auth=require(_0x12d3('0x7'));var interaction=require(_0x12d3('0x8'));var config=require(_0x12d3('0x9'));var controller=require(_0x12d3('0xa'));router[_0x12d3('0xb')]('/',auth[_0x12d3('0xc')](),controller[_0x12d3('0xd')]);router[_0x12d3('0xb')](_0x12d3('0xe'),auth[_0x12d3('0xc')](),controller[_0x12d3('0xf')]);router['post']('/',auth[_0x12d3('0xc')](),controller[_0x12d3('0x10')]);router[_0x12d3('0x11')](_0x12d3('0xe'),auth[_0x12d3('0xc')](),controller[_0x12d3('0x12')]);router[_0x12d3('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x12d3('0x14')]);module[_0x12d3('0x15')]=router; \ No newline at end of file +var _0x67a7=['delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','create','update'];(function(_0xbea61a,_0x26fdde){var _0x73d5ea=function(_0x206b6e){while(--_0x206b6e){_0xbea61a['push'](_0xbea61a['shift']());}};_0x73d5ea(++_0x26fdde);}(_0x67a7,0x162));var _0x767a=function(_0x44d28c,_0x3a197b){_0x44d28c=_0x44d28c-0x0;var _0x754673=_0x67a7[_0x44d28c];return _0x754673;};'use strict';var multer=require('multer');var util=require(_0x767a('0x0'));var path=require('path');var timeout=require(_0x767a('0x1'));var express=require(_0x767a('0x2'));var router=express[_0x767a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x767a('0x4'));var interaction=require(_0x767a('0x5'));var config=require(_0x767a('0x6'));var controller=require('./openchannelApplication.controller');router[_0x767a('0x7')]('/',auth['isAuthenticated'](),controller[_0x767a('0x8')]);router[_0x767a('0x7')](_0x767a('0x9'),auth[_0x767a('0xa')](),controller[_0x767a('0xb')]);router['post']('/',auth[_0x767a('0xa')](),controller[_0x767a('0xc')]);router['put']('/:id',auth[_0x767a('0xa')](),controller[_0x767a('0xd')]);router[_0x767a('0xe')](_0x767a('0x9'),auth['isAuthenticated'](),controller[_0x767a('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index e5c8589..d30559b 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 _0xaa91=['STRING','noop','TEXT','INTEGER'];(function(_0x3ba422,_0x53303c){var _0x20b5dd=function(_0x10b8a7){while(--_0x10b8a7){_0x3ba422['push'](_0x3ba422['shift']());}};_0x20b5dd(++_0x53303c);}(_0xaa91,0x1a7));var _0x1aa9=function(_0x5890d7,_0x3cd19c){_0x5890d7=_0x5890d7-0x0;var _0x155d24=_0xaa91[_0x5890d7];return _0x155d24;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x1aa9('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x1aa9('0x1')],'allowNull':![],'defaultValue':_0x1aa9('0x2')},'appdata':{'type':Sequelize[_0x1aa9('0x3')]()},'description':{'type':Sequelize[_0x1aa9('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xb1dd=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb1dd,0x197));var _0xdb1d=function(_0x3d012d,_0x1d7bab){_0x3d012d=_0x3d012d-0x0;var _0x5329de=_0xb1dd[_0x3d012d];return _0x5329de;};'use strict';var Sequelize=require(_0xdb1d('0x0'));module[_0xdb1d('0x1')]={'priority':{'type':Sequelize[_0xdb1d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xdb1d('0x3')],'allowNull':![],'defaultValue':_0xdb1d('0x4')},'appdata':{'type':Sequelize[_0xdb1d('0x5')]()},'description':{'type':Sequelize[_0xdb1d('0x3')]},'interval':{'type':Sequelize[_0xdb1d('0x3')],'defaultValue':_0xdb1d('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 69e9ee0..edc2182 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 _0x1fa7=['json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','merge','where','type','VIRTUAL','filter','options','includeAll','rows','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x466f2e,_0x5e2a7f){var _0x22dfbb=function(_0x308bbf){while(--_0x308bbf){_0x466f2e['push'](_0x466f2e['shift']());}};_0x22dfbb(++_0x5e2a7f);}(_0x1fa7,0x15b));var _0x71fa=function(_0x6c2f1f,_0x13860e){_0x6c2f1f=_0x6c2f1f-0x0;var _0x2fda92=_0x1fa7[_0x6c2f1f];return _0x2fda92;};'use strict';var emlformat=require(_0x71fa('0x0'));var rimraf=require(_0x71fa('0x1'));var zipdir=require(_0x71fa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x71fa('0x3'));var moment=require('moment');var BPromise=require(_0x71fa('0x4'));var Mustache=require('mustache');var util=require(_0x71fa('0x5'));var path=require(_0x71fa('0x6'));var sox=require(_0x71fa('0x7'));var csv=require(_0x71fa('0x8'));var ejs=require(_0x71fa('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71fa('0xa'));var squel=require('squel');var crypto=require(_0x71fa('0xb'));var jsforce=require(_0x71fa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x71fa('0x8'));var querystring=require(_0x71fa('0xd'));var Papa=require(_0x71fa('0xe'));var Redis=require(_0x71fa('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x71fa('0x10'));var as=require(_0x71fa('0x11'));var hardwareService=require(_0x71fa('0x12'));var logger=require(_0x71fa('0x13'))(_0x71fa('0x14'));var utils=require(_0x71fa('0x15'));var config=require(_0x71fa('0x16'));var licenseUtil=require(_0x71fa('0x17'));var db=require(_0x71fa('0x18'))['db'];function respondWithStatusCode(_0x3fd9c7,_0x1338aa){_0x1338aa=_0x1338aa||0xcc;return function(_0x217b58){if(_0x217b58){return _0x3fd9c7[_0x71fa('0x19')](_0x1338aa);}return _0x3fd9c7[_0x71fa('0x1a')](_0x1338aa)[_0x71fa('0x1b')]();};}function respondWithResult(_0x1a656d,_0xf71938){_0xf71938=_0xf71938||0xc8;return function(_0x4cef7c){if(_0x4cef7c){return _0x1a656d['status'](_0xf71938)[_0x71fa('0x1c')](_0x4cef7c);}};}function respondWithFilteredResult(_0x4e3b51,_0x5374a5){return function(_0x5283e4){if(_0x5283e4){var _0x5dd5e1=typeof _0x5374a5[_0x71fa('0x1d')]===_0x71fa('0x1e')&&typeof _0x5374a5[_0x71fa('0x1f')]==='undefined';var _0x84b490=_0x5283e4[_0x71fa('0x20')];var _0xc2face=_0x5dd5e1?0x0:_0x5374a5[_0x71fa('0x1d')];var _0x5202a7=_0x5dd5e1?_0x5283e4['count']:_0x5374a5['offset']+_0x5374a5[_0x71fa('0x1f')];var _0x1248dc;if(_0x5202a7>=_0x84b490){_0x5202a7=_0x84b490;_0x1248dc=0xc8;}else{_0x1248dc=0xce;}_0x4e3b51[_0x71fa('0x1a')](_0x1248dc);return _0x4e3b51[_0x71fa('0x21')](_0x71fa('0x22'),_0xc2face+'-'+_0x5202a7+'/'+_0x84b490)[_0x71fa('0x1c')](_0x5283e4);}return null;};}function patchUpdates(_0xf017f1){return function(_0x457e07){try{jsonpatch['apply'](_0x457e07,_0xf017f1,!![]);}catch(_0x3a674a){return BPromise[_0x71fa('0x23')](_0x3a674a);}return _0x457e07[_0x71fa('0x24')]();};}function saveUpdates(_0x5ed3d1,_0x30bf6f){return function(_0x5ed284){if(_0x5ed284){return _0x5ed284[_0x71fa('0x25')](_0x5ed3d1)[_0x71fa('0x26')](function(_0x2af845){return _0x2af845;});}return null;};}function removeEntity(_0x134ab1,_0x15cffc){return function(_0x536127){if(_0x536127){return _0x536127[_0x71fa('0x27')]()[_0x71fa('0x26')](function(){_0x134ab1[_0x71fa('0x1a')](0xcc)[_0x71fa('0x1b')]();});}};}function handleEntityNotFound(_0x35989c,_0x32e70c){return function(_0x5b2392){if(!_0x5b2392){_0x35989c[_0x71fa('0x19')](0x194);}return _0x5b2392;};}function handleError(_0x301c89,_0x1c8e5a){_0x1c8e5a=_0x1c8e5a||0x1f4;return function(_0x546544){logger[_0x71fa('0x28')](_0x546544[_0x71fa('0x29')]);if(_0x546544[_0x71fa('0x2a')]){delete _0x546544[_0x71fa('0x2a')];}_0x301c89[_0x71fa('0x1a')](_0x1c8e5a)['send'](_0x546544);};}exports[_0x71fa('0x2b')]=function(_0xae2f3f,_0x54dba4){var _0x127c4c={},_0x52cb7b={},_0x52eeb5={'count':0x0,'rows':[]};var _0x3300f2=_[_0x71fa('0x2c')](db[_0x71fa('0x2d')][_0x71fa('0x2e')],function(_0x56f791){return{'name':_0x56f791[_0x71fa('0x2f')],'type':_0x56f791['type'][_0x71fa('0x30')]};});_0x52cb7b[_0x71fa('0x31')]=_[_0x71fa('0x2c')](_0x3300f2,_0x71fa('0x2a'));_0x52cb7b[_0x71fa('0x32')]=_[_0x71fa('0x33')](_0xae2f3f[_0x71fa('0x32')]);_0x52cb7b[_0x71fa('0x34')]=_[_0x71fa('0x35')](_0x52cb7b[_0x71fa('0x31')],_0x52cb7b[_0x71fa('0x32')]);_0x127c4c[_0x71fa('0x36')]=_[_0x71fa('0x35')](_0x52cb7b[_0x71fa('0x31')],qs[_0x71fa('0x37')](_0xae2f3f[_0x71fa('0x32')][_0x71fa('0x37')]));_0x127c4c[_0x71fa('0x36')]=_0x127c4c[_0x71fa('0x36')][_0x71fa('0x38')]?_0x127c4c[_0x71fa('0x36')]:_0x52cb7b[_0x71fa('0x31')];if(!_0xae2f3f[_0x71fa('0x32')][_0x71fa('0x39')]('nolimit')){_0x127c4c['limit']=qs['limit'](_0xae2f3f[_0x71fa('0x32')]['limit']);_0x127c4c['offset']=qs[_0x71fa('0x1d')](_0xae2f3f[_0x71fa('0x32')]['offset']);}_0x127c4c[_0x71fa('0x3a')]=qs['sort'](_0xae2f3f[_0x71fa('0x32')][_0x71fa('0x3b')]);_0x127c4c['where']=qs['filters'](_['pick'](_0xae2f3f[_0x71fa('0x32')],_0x52cb7b[_0x71fa('0x34')]),_0x3300f2);if(_0xae2f3f[_0x71fa('0x32')]['filter']){_0x127c4c['where']=_[_0x71fa('0x3c')](_0x127c4c[_0x71fa('0x3d')],{'$or':_[_0x71fa('0x2c')](_0x3300f2,function(_0x4ad3b2){if(_0x4ad3b2[_0x71fa('0x3e')]!==_0x71fa('0x3f')){var _0x45db5a={};_0x45db5a[_0x4ad3b2[_0x71fa('0x2a')]]={'$like':'%'+_0xae2f3f['query'][_0x71fa('0x40')]+'%'};return _0x45db5a;}})});}_0x127c4c=_['merge']({},_0x127c4c,_0xae2f3f[_0x71fa('0x41')]);var _0x15df81={'where':_0x127c4c['where']};return db['OpenchannelApplication'][_0x71fa('0x20')](_0x15df81)[_0x71fa('0x26')](function(_0x3d3825){_0x52eeb5[_0x71fa('0x20')]=_0x3d3825;if(_0xae2f3f[_0x71fa('0x32')][_0x71fa('0x42')]){_0x127c4c['include']=[{'all':!![]}];}return db[_0x71fa('0x2d')]['findAll'](_0x127c4c);})[_0x71fa('0x26')](function(_0x5a6b13){_0x52eeb5[_0x71fa('0x43')]=_0x5a6b13;return _0x52eeb5;})[_0x71fa('0x26')](respondWithFilteredResult(_0x54dba4,_0x127c4c))[_0x71fa('0x44')](handleError(_0x54dba4,null));};exports[_0x71fa('0x45')]=function(_0x591457,_0xa58fae){var _0x3830db={'raw':!![],'where':{'id':_0x591457[_0x71fa('0x46')]['id']}},_0x406eca={};_0x406eca[_0x71fa('0x31')]=_[_0x71fa('0x33')](db[_0x71fa('0x2d')]['rawAttributes']);_0x406eca[_0x71fa('0x32')]=_[_0x71fa('0x33')](_0x591457[_0x71fa('0x32')]);_0x406eca['filters']=_['intersection'](_0x406eca['model'],_0x406eca[_0x71fa('0x32')]);_0x3830db[_0x71fa('0x36')]=_[_0x71fa('0x35')](_0x406eca['model'],qs[_0x71fa('0x37')](_0x591457[_0x71fa('0x32')][_0x71fa('0x37')]));_0x3830db['attributes']=_0x3830db[_0x71fa('0x36')][_0x71fa('0x38')]?_0x3830db[_0x71fa('0x36')]:_0x406eca['model'];if(_0x591457['query'][_0x71fa('0x42')]){_0x3830db[_0x71fa('0x47')]=[{'all':!![]}];}_0x3830db=_['merge']({},_0x3830db,_0x591457[_0x71fa('0x41')]);return db[_0x71fa('0x2d')][_0x71fa('0x48')](_0x3830db)[_0x71fa('0x26')](handleEntityNotFound(_0xa58fae,null))[_0x71fa('0x26')](respondWithResult(_0xa58fae,null))[_0x71fa('0x44')](handleError(_0xa58fae,null));};exports[_0x71fa('0x49')]=function(_0x6a3d4d,_0x345f19){return db['OpenchannelApplication']['create'](_0x6a3d4d[_0x71fa('0x4a')],{})['then'](respondWithResult(_0x345f19,0xc9))['catch'](handleError(_0x345f19,null));};exports[_0x71fa('0x25')]=function(_0x3d9dd9,_0x5cbdbd){if(_0x3d9dd9['body']['id']){delete _0x3d9dd9['body']['id'];}return db[_0x71fa('0x2d')][_0x71fa('0x48')]({'where':{'id':_0x3d9dd9[_0x71fa('0x46')]['id']}})[_0x71fa('0x26')](handleEntityNotFound(_0x5cbdbd,null))[_0x71fa('0x26')](saveUpdates(_0x3d9dd9[_0x71fa('0x4a')],null))[_0x71fa('0x26')](respondWithResult(_0x5cbdbd,null))[_0x71fa('0x44')](handleError(_0x5cbdbd,null));};exports[_0x71fa('0x27')]=function(_0x11750f,_0x184862){return db['OpenchannelApplication'][_0x71fa('0x48')]({'where':{'id':_0x11750f[_0x71fa('0x46')]['id']}})['then'](handleEntityNotFound(_0x184862,null))['then'](removeEntity(_0x184862,null))[_0x71fa('0x44')](handleError(_0x184862,null));}; \ No newline at end of file +var _0xa16b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','key','query','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','OpenchannelApplication','includeAll','include','findAll','rows','catch','show','params','keys','find','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x19e01f,_0x2e0353){var _0x4476f5=function(_0x435705){while(--_0x435705){_0x19e01f['push'](_0x19e01f['shift']());}};_0x4476f5(++_0x2e0353);}(_0xa16b,0x11f));var _0xba16=function(_0x1eeacc,_0x52c7c9){_0x1eeacc=_0x1eeacc-0x0;var _0x2bc63c=_0xa16b[_0x1eeacc];return _0x2bc63c;};'use strict';var emlformat=require(_0xba16('0x0'));var rimraf=require(_0xba16('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xba16('0x2'));var rp=require(_0xba16('0x3'));var moment=require(_0xba16('0x4'));var BPromise=require(_0xba16('0x5'));var Mustache=require(_0xba16('0x6'));var util=require('util');var path=require('path');var sox=require(_0xba16('0x7'));var csv=require(_0xba16('0x8'));var ejs=require(_0xba16('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xba16('0xa'));var crypto=require(_0xba16('0xb'));var jsforce=require(_0xba16('0xc'));var deskjs=require(_0xba16('0xd'));var toCsv=require(_0xba16('0x8'));var querystring=require(_0xba16('0xe'));var Papa=require(_0xba16('0xf'));var Redis=require(_0xba16('0x10'));var authService=require(_0xba16('0x11'));var qs=require(_0xba16('0x12'));var as=require(_0xba16('0x13'));var hardwareService=require(_0xba16('0x14'));var logger=require('../../config/logger')(_0xba16('0x15'));var utils=require(_0xba16('0x16'));var config=require(_0xba16('0x17'));var licenseUtil=require(_0xba16('0x18'));var db=require(_0xba16('0x19'))['db'];function respondWithStatusCode(_0x42f3f2,_0x1e5c5f){_0x1e5c5f=_0x1e5c5f||0xcc;return function(_0x37c665){if(_0x37c665){return _0x42f3f2['sendStatus'](_0x1e5c5f);}return _0x42f3f2['status'](_0x1e5c5f)[_0xba16('0x1a')]();};}function respondWithResult(_0x139809,_0x535c69){_0x535c69=_0x535c69||0xc8;return function(_0x5427a7){if(_0x5427a7){return _0x139809[_0xba16('0x1b')](_0x535c69)[_0xba16('0x1c')](_0x5427a7);}};}function respondWithFilteredResult(_0x1dfbed,_0x54ed22){return function(_0x2c7cb5){if(_0x2c7cb5){var _0x5547a8=typeof _0x54ed22[_0xba16('0x1d')]===_0xba16('0x1e')&&typeof _0x54ed22['limit']==='undefined';var _0x252a83=_0x2c7cb5['count'];var _0xcc92f2=_0x5547a8?0x0:_0x54ed22[_0xba16('0x1d')];var _0x37aa0b=_0x5547a8?_0x2c7cb5[_0xba16('0x1f')]:_0x54ed22[_0xba16('0x1d')]+_0x54ed22[_0xba16('0x20')];var _0x1c950d;if(_0x37aa0b>=_0x252a83){_0x37aa0b=_0x252a83;_0x1c950d=0xc8;}else{_0x1c950d=0xce;}_0x1dfbed[_0xba16('0x1b')](_0x1c950d);return _0x1dfbed[_0xba16('0x21')](_0xba16('0x22'),_0xcc92f2+'-'+_0x37aa0b+'/'+_0x252a83)['json'](_0x2c7cb5);}return null;};}function patchUpdates(_0x78c483){return function(_0x2d5977){try{jsonpatch[_0xba16('0x23')](_0x2d5977,_0x78c483,!![]);}catch(_0x4097f5){return BPromise['reject'](_0x4097f5);}return _0x2d5977[_0xba16('0x24')]();};}function saveUpdates(_0x18e019,_0x14a60a){return function(_0x33143a){if(_0x33143a){return _0x33143a[_0xba16('0x25')](_0x18e019)[_0xba16('0x26')](function(_0x2cfa84){return _0x2cfa84;});}return null;};}function removeEntity(_0x5823e5,_0x21be4f){return function(_0x18661){if(_0x18661){return _0x18661[_0xba16('0x27')]()['then'](function(){_0x5823e5[_0xba16('0x1b')](0xcc)[_0xba16('0x1a')]();});}};}function handleEntityNotFound(_0x166054,_0x25d2a3){return function(_0x1ec32a){if(!_0x1ec32a){_0x166054[_0xba16('0x28')](0x194);}return _0x1ec32a;};}function handleError(_0x139155,_0x41c6a3){_0x41c6a3=_0x41c6a3||0x1f4;return function(_0x456aa3){logger['error'](_0x456aa3[_0xba16('0x29')]);if(_0x456aa3[_0xba16('0x2a')]){delete _0x456aa3[_0xba16('0x2a')];}_0x139155['status'](_0x41c6a3)[_0xba16('0x2b')](_0x456aa3);};}exports[_0xba16('0x2c')]=function(_0x53442f,_0x47bf83){var _0x7f3e28={},_0x56799c={},_0x313de1={'count':0x0,'rows':[]};var _0xf8043e=_[_0xba16('0x2d')](db['OpenchannelApplication'][_0xba16('0x2e')],function(_0x16ff74){return{'name':_0x16ff74['fieldName'],'type':_0x16ff74['type'][_0xba16('0x2f')]};});_0x56799c['model']=_[_0xba16('0x2d')](_0xf8043e,'name');_0x56799c[_0xba16('0x30')]=_['keys'](_0x53442f['query']);_0x56799c[_0xba16('0x31')]=_[_0xba16('0x32')](_0x56799c[_0xba16('0x33')],_0x56799c[_0xba16('0x30')]);_0x7f3e28['attributes']=_[_0xba16('0x32')](_0x56799c[_0xba16('0x33')],qs['fields'](_0x53442f[_0xba16('0x30')][_0xba16('0x34')]));_0x7f3e28[_0xba16('0x35')]=_0x7f3e28['attributes'][_0xba16('0x36')]?_0x7f3e28[_0xba16('0x35')]:_0x56799c['model'];if(!_0x53442f[_0xba16('0x30')]['hasOwnProperty'](_0xba16('0x37'))){_0x7f3e28[_0xba16('0x20')]=qs[_0xba16('0x20')](_0x53442f[_0xba16('0x30')]['limit']);_0x7f3e28[_0xba16('0x1d')]=qs[_0xba16('0x1d')](_0x53442f[_0xba16('0x30')][_0xba16('0x1d')]);}_0x7f3e28['order']=qs['sort'](_0x53442f[_0xba16('0x30')][_0xba16('0x38')]);_0x7f3e28[_0xba16('0x39')]=qs['filters'](_[_0xba16('0x3a')](_0x53442f[_0xba16('0x30')],_0x56799c[_0xba16('0x31')]),_0xf8043e);if(_0x53442f[_0xba16('0x30')][_0xba16('0x3b')]){_0x7f3e28[_0xba16('0x39')]=_[_0xba16('0x3c')](_0x7f3e28[_0xba16('0x39')],{'$or':_[_0xba16('0x2d')](_0xf8043e,function(_0x336d4b){if(_0x336d4b[_0xba16('0x3d')]!==_0xba16('0x3e')){var _0x2879ac={};_0x2879ac[_0x336d4b[_0xba16('0x2a')]]={'$like':'%'+_0x53442f[_0xba16('0x30')][_0xba16('0x3b')]+'%'};return _0x2879ac;}})});}_0x7f3e28=_['merge']({},_0x7f3e28,_0x53442f[_0xba16('0x3f')]);var _0x4df5a4={'where':_0x7f3e28[_0xba16('0x39')]};return db[_0xba16('0x40')][_0xba16('0x1f')](_0x4df5a4)[_0xba16('0x26')](function(_0x4e10f5){_0x313de1[_0xba16('0x1f')]=_0x4e10f5;if(_0x53442f[_0xba16('0x30')][_0xba16('0x41')]){_0x7f3e28[_0xba16('0x42')]=[{'all':!![]}];}return db[_0xba16('0x40')][_0xba16('0x43')](_0x7f3e28);})[_0xba16('0x26')](function(_0x33acea){_0x313de1[_0xba16('0x44')]=_0x33acea;return _0x313de1;})[_0xba16('0x26')](respondWithFilteredResult(_0x47bf83,_0x7f3e28))[_0xba16('0x45')](handleError(_0x47bf83,null));};exports[_0xba16('0x46')]=function(_0x42748f,_0xaf6a50){var _0x5e4cc7={'raw':!![],'where':{'id':_0x42748f[_0xba16('0x47')]['id']}},_0x4f128c={};_0x4f128c['model']=_[_0xba16('0x48')](db[_0xba16('0x40')]['rawAttributes']);_0x4f128c[_0xba16('0x30')]=_[_0xba16('0x48')](_0x42748f[_0xba16('0x30')]);_0x4f128c[_0xba16('0x31')]=_[_0xba16('0x32')](_0x4f128c[_0xba16('0x33')],_0x4f128c[_0xba16('0x30')]);_0x5e4cc7[_0xba16('0x35')]=_['intersection'](_0x4f128c[_0xba16('0x33')],qs['fields'](_0x42748f[_0xba16('0x30')][_0xba16('0x34')]));_0x5e4cc7[_0xba16('0x35')]=_0x5e4cc7['attributes'][_0xba16('0x36')]?_0x5e4cc7[_0xba16('0x35')]:_0x4f128c['model'];if(_0x42748f[_0xba16('0x30')]['includeAll']){_0x5e4cc7[_0xba16('0x42')]=[{'all':!![]}];}_0x5e4cc7=_[_0xba16('0x3c')]({},_0x5e4cc7,_0x42748f[_0xba16('0x3f')]);return db['OpenchannelApplication'][_0xba16('0x49')](_0x5e4cc7)[_0xba16('0x26')](handleEntityNotFound(_0xaf6a50,null))[_0xba16('0x26')](respondWithResult(_0xaf6a50,null))[_0xba16('0x45')](handleError(_0xaf6a50,null));};exports['create']=function(_0x37a618,_0x4caa49){return db[_0xba16('0x40')]['create'](_0x37a618[_0xba16('0x4a')],{})[_0xba16('0x26')](respondWithResult(_0x4caa49,0xc9))[_0xba16('0x45')](handleError(_0x4caa49,null));};exports[_0xba16('0x25')]=function(_0x4329bf,_0x9302f7){if(_0x4329bf[_0xba16('0x4a')]['id']){delete _0x4329bf[_0xba16('0x4a')]['id'];}return db[_0xba16('0x40')][_0xba16('0x49')]({'where':{'id':_0x4329bf[_0xba16('0x47')]['id']}})[_0xba16('0x26')](handleEntityNotFound(_0x9302f7,null))['then'](saveUpdates(_0x4329bf['body'],null))[_0xba16('0x26')](respondWithResult(_0x9302f7,null))[_0xba16('0x45')](handleError(_0x9302f7,null));};exports['destroy']=function(_0x59c5b1,_0x534fac){return db[_0xba16('0x40')][_0xba16('0x49')]({'where':{'id':_0x59c5b1[_0xba16('0x47')]['id']}})[_0xba16('0x26')](handleEntityNotFound(_0x534fac,null))[_0xba16('0x26')](removeEntity(_0x534fac,null))[_0xba16('0x45')](handleError(_0x534fac,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 14771a2..5d15242 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 _0xb7be=['exports','define','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x433546,_0x5057eb){var _0x50ab05=function(_0x4882c2){while(--_0x4882c2){_0x433546['push'](_0x433546['shift']());}};_0x50ab05(++_0x5057eb);}(_0xb7be,0x118));var _0xeb7b=function(_0x123cd1,_0x48cb5a){_0x123cd1=_0x123cd1-0x0;var _0x4c13ee=_0xb7be[_0x123cd1];return _0x4c13ee;};'use strict';var _=require(_0xeb7b('0x0'));var util=require(_0xeb7b('0x1'));var logger=require(_0xeb7b('0x2'))(_0xeb7b('0x3'));var moment=require('moment');var BPromise=require(_0xeb7b('0x4'));var rp=require(_0xeb7b('0x5'));var fs=require('fs');var path=require(_0xeb7b('0x6'));var rimraf=require(_0xeb7b('0x7'));var config=require('../../config/environment');var attributes=require('./openchannelApplication.attributes');module[_0xeb7b('0x8')]=function(_0x4242a5,_0x1f62af){return _0x4242a5[_0xeb7b('0x9')]('OpenchannelApplication',attributes,{'tableName':_0xeb7b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xeb7b('0xb')});}; \ No newline at end of file +var _0x4358=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelApplication.attributes','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4358,0x168));var _0x8435=function(_0x49beea,_0x47add1){_0x49beea=_0x49beea-0x0;var _0x27693a=_0x4358[_0x49beea];return _0x27693a;};'use strict';var _=require(_0x8435('0x0'));var util=require('util');var logger=require(_0x8435('0x1'))('api');var moment=require(_0x8435('0x2'));var BPromise=require(_0x8435('0x3'));var rp=require(_0x8435('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8435('0x5'));var config=require(_0x8435('0x6'));var attributes=require(_0x8435('0x7'));module['exports']=function(_0x54b4bc,_0x528a99){return _0x54b4bc[_0x8435('0x8')]('OpenchannelApplication',attributes,{'tableName':_0x8435('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8435('0xa'),'collate':_0x8435('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 3bde6d2..3e915f8 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 _0x1ad8=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateOpenchannelApplication','update','body','options','raw','where','attributes','limit','catch','lodash','moment','ioredis','../../config/utils'];(function(_0x209f68,_0x512003){var _0xfc642c=function(_0x464097){while(--_0x464097){_0x209f68['push'](_0x209f68['shift']());}};_0xfc642c(++_0x512003);}(_0x1ad8,0x192));var _0x81ad=function(_0x3ed71d,_0x305141){_0x3ed71d=_0x3ed71d-0x0;var _0x45b427=_0x1ad8[_0x3ed71d];return _0x45b427;};'use strict';var _=require(_0x81ad('0x0'));var util=require('util');var moment=require(_0x81ad('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x81ad('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x81ad('0x3'));var logger=require(_0x81ad('0x4'))(_0x81ad('0x5'));var config=require('../../config/environment');var jayson=require(_0x81ad('0x6'));var client=jayson[_0x81ad('0x7')][_0x81ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b25fe,_0x290a65,_0x3e4e6d){return new BPromise(function(_0x38072d,_0x9c70d4){return client[_0x81ad('0x9')](_0x1b25fe,_0x3e4e6d)[_0x81ad('0xa')](function(_0x2b7cc4){logger[_0x81ad('0xb')](_0x81ad('0xc'),_0x290a65,'request\x20sent');logger[_0x81ad('0xd')](_0x81ad('0xe'),_0x290a65,_0x81ad('0xf'),JSON[_0x81ad('0x10')](_0x2b7cc4));if(_0x2b7cc4[_0x81ad('0x11')]){if(_0x2b7cc4[_0x81ad('0x11')][_0x81ad('0x12')]===0x1f4){logger[_0x81ad('0x11')](_0x81ad('0xc'),_0x290a65,_0x2b7cc4[_0x81ad('0x11')]['message']);return _0x9c70d4(_0x2b7cc4[_0x81ad('0x11')][_0x81ad('0x13')]);}logger['error'](_0x81ad('0xc'),_0x290a65,_0x2b7cc4[_0x81ad('0x11')][_0x81ad('0x13')]);return _0x38072d(_0x2b7cc4[_0x81ad('0x11')]['message']);}else{logger[_0x81ad('0xb')](_0x81ad('0xc'),_0x290a65,_0x81ad('0xf'));_0x38072d(_0x2b7cc4['result'][_0x81ad('0x13')]);}})['catch'](function(_0x1aa28a){logger[_0x81ad('0x11')](_0x81ad('0xc'),_0x290a65,_0x1aa28a);_0x9c70d4(_0x1aa28a);});});}exports[_0x81ad('0x14')]=function(_0xd9b41f){var _0x17ba3c=this;return new Promise(function(_0xd53ded,_0x47ea1d){return db['OpenchannelApplication'][_0x81ad('0x15')](_0xd9b41f[_0x81ad('0x16')],{'raw':_0xd9b41f[_0x81ad('0x17')]?_0xd9b41f[_0x81ad('0x17')][_0x81ad('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd9b41f[_0x81ad('0x17')]?_0xd9b41f['options'][_0x81ad('0x19')]||null:null,'attributes':_0xd9b41f['options']?_0xd9b41f[_0x81ad('0x17')][_0x81ad('0x1a')]||null:null,'limit':_0xd9b41f[_0x81ad('0x17')]?_0xd9b41f[_0x81ad('0x17')][_0x81ad('0x1b')]||null:null})[_0x81ad('0xa')](function(_0x545807){logger[_0x81ad('0xb')](_0x81ad('0x14'),_0xd9b41f);logger[_0x81ad('0xd')](_0x81ad('0x14'),_0xd9b41f,JSON[_0x81ad('0x10')](_0x545807));_0xd53ded(_0x545807);})[_0x81ad('0x1c')](function(_0xb61029){logger[_0x81ad('0x11')](_0x81ad('0x14'),_0xb61029[_0x81ad('0x13')],_0xd9b41f);_0x47ea1d(_0x17ba3c['error'](0x1f4,_0xb61029['message']));});});}; \ No newline at end of file +var _0x13d7=['client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5027b1,_0x6c2346){var _0x5ef581=function(_0xb14398){while(--_0xb14398){_0x5027b1['push'](_0x5027b1['shift']());}};_0x5ef581(++_0x6c2346);}(_0x13d7,0x1f4));var _0x713d=function(_0x246d3e,_0x5c8fed){_0x246d3e=_0x246d3e-0x0;var _0x3816a8=_0x13d7[_0x246d3e];return _0x3816a8;};'use strict';var _=require(_0x713d('0x0'));var util=require('util');var moment=require(_0x713d('0x1'));var BPromise=require(_0x713d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x713d('0x3'));var db=require(_0x713d('0x4'))['db'];var utils=require(_0x713d('0x5'));var logger=require(_0x713d('0x6'))(_0x713d('0x7'));var config=require(_0x713d('0x8'));var jayson=require(_0x713d('0x9'));var client=jayson[_0x713d('0xa')][_0x713d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x22b8c9,_0x12b652,_0xbbdd93){return new BPromise(function(_0x58c8d5,_0x37ffce){return client['request'](_0x22b8c9,_0xbbdd93)[_0x713d('0xc')](function(_0x494bb2){logger[_0x713d('0xd')](_0x713d('0xe'),_0x12b652,_0x713d('0xf'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x12b652,_0x713d('0xf'),JSON[_0x713d('0x10')](_0x494bb2));if(_0x494bb2[_0x713d('0x11')]){if(_0x494bb2[_0x713d('0x11')]['code']===0x1f4){logger[_0x713d('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x12b652,_0x494bb2['error']['message']);return _0x37ffce(_0x494bb2[_0x713d('0x11')][_0x713d('0x12')]);}logger[_0x713d('0x11')](_0x713d('0xe'),_0x12b652,_0x494bb2[_0x713d('0x11')][_0x713d('0x12')]);return _0x58c8d5(_0x494bb2['error'][_0x713d('0x12')]);}else{logger[_0x713d('0xd')](_0x713d('0xe'),_0x12b652,_0x713d('0xf'));_0x58c8d5(_0x494bb2[_0x713d('0x13')]['message']);}})[_0x713d('0x14')](function(_0x755708){logger[_0x713d('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x12b652,_0x755708);_0x37ffce(_0x755708);});});}exports[_0x713d('0x15')]=function(_0x363fc2){var _0x48b249=this;return new Promise(function(_0x40ce0b,_0x17f482){return db[_0x713d('0x16')][_0x713d('0x17')](_0x363fc2[_0x713d('0x18')],{'raw':_0x363fc2[_0x713d('0x19')]?_0x363fc2[_0x713d('0x19')][_0x713d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x363fc2[_0x713d('0x19')]?_0x363fc2[_0x713d('0x19')][_0x713d('0x1b')]||null:null,'attributes':_0x363fc2[_0x713d('0x19')]?_0x363fc2[_0x713d('0x19')][_0x713d('0x1c')]||null:null,'limit':_0x363fc2[_0x713d('0x19')]?_0x363fc2[_0x713d('0x19')]['limit']||null:null})[_0x713d('0xc')](function(_0x3500bb){logger[_0x713d('0xd')]('UpdateOpenchannelApplication',_0x363fc2);logger[_0x713d('0x1d')](_0x713d('0x15'),_0x363fc2,JSON['stringify'](_0x3500bb));_0x40ce0b(_0x3500bb);})[_0x713d('0x14')](function(_0x28d62c){logger[_0x713d('0x11')](_0x713d('0x15'),_0x28d62c[_0x713d('0x12')],_0x363fc2);_0x17f482(_0x48b249[_0x713d('0x11')](0x1f4,_0x28d62c[_0x713d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index e910656..f8b3de6 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 _0x8884=['post','create','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages'];(function(_0x393500,_0x1037af){var _0x120d3b=function(_0x17234e){while(--_0x17234e){_0x393500['push'](_0x393500['shift']());}};_0x120d3b(++_0x1037af);}(_0x8884,0x150));var _0x4888=function(_0x10a0ae,_0x24d46e){_0x10a0ae=_0x10a0ae-0x0;var _0x569118=_0x8884[_0x10a0ae];return _0x569118;};'use strict';var multer=require(_0x4888('0x0'));var util=require(_0x4888('0x1'));var path=require(_0x4888('0x2'));var timeout=require('connect-timeout');var express=require(_0x4888('0x3'));var router=express['Router']();var fs_extra=require(_0x4888('0x4'));var auth=require(_0x4888('0x5'));var interaction=require(_0x4888('0x6'));var config=require('../../config/environment');var controller=require(_0x4888('0x7'));router[_0x4888('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4888('0x8')](_0x4888('0x9'),auth[_0x4888('0xa')](),controller[_0x4888('0xb')]);router['get'](_0x4888('0xc'),auth[_0x4888('0xa')](),controller[_0x4888('0xd')]);router['get'](_0x4888('0xe'),auth['isAuthenticated'](),controller[_0x4888('0xf')]);router[_0x4888('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x4888('0x10')]('/',auth['isAuthenticated'](),controller[_0x4888('0x11')]);router['post'](_0x4888('0xe'),auth['isAuthenticated'](),controller[_0x4888('0x12')]);router[_0x4888('0x10')](_0x4888('0x13'),auth[_0x4888('0xa')](),interaction['tracked'](_0x4888('0x14'),_0x4888('0x15')),controller[_0x4888('0x16')]);router[_0x4888('0x17')](_0x4888('0xc'),auth[_0x4888('0xa')](),interaction[_0x4888('0x18')](_0x4888('0x14'),_0x4888('0x19')),controller[_0x4888('0x1a')]);router[_0x4888('0x1b')](_0x4888('0xc'),auth[_0x4888('0xa')](),interaction[_0x4888('0x18')](_0x4888('0x14'),_0x4888('0x1c')),controller[_0x4888('0x1d')]);router[_0x4888('0x1b')](_0x4888('0x13'),auth[_0x4888('0xa')](),controller[_0x4888('0x1e')]);module[_0x4888('0x1f')]=router; \ No newline at end of file +var _0xa3cd=['../../components/auth/service','../../config/environment','./openchannelInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','Router','fs-extra'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0xa3cd,0xfb));var _0xda3c=function(_0x3ca665,_0x5dbff9){_0x3ca665=_0x3ca665-0x0;var _0x1f3590=_0xa3cd[_0x3ca665];return _0x1f3590;};'use strict';var multer=require(_0xda3c('0x0'));var util=require(_0xda3c('0x1'));var path=require(_0xda3c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xda3c('0x3')]();var fs_extra=require(_0xda3c('0x4'));var auth=require(_0xda3c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xda3c('0x6'));var controller=require(_0xda3c('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xda3c('0x8')]);router[_0xda3c('0x9')](_0xda3c('0xa'),auth[_0xda3c('0xb')](),controller[_0xda3c('0xc')]);router[_0xda3c('0x9')](_0xda3c('0xd'),auth[_0xda3c('0xb')](),controller[_0xda3c('0xe')]);router[_0xda3c('0x9')]('/:id/messages',auth[_0xda3c('0xb')](),controller[_0xda3c('0xf')]);router[_0xda3c('0x9')](_0xda3c('0x10'),auth[_0xda3c('0xb')](),controller[_0xda3c('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xda3c('0x12')]);router[_0xda3c('0x13')](_0xda3c('0x14'),auth['isAuthenticated'](),controller[_0xda3c('0x15')]);router[_0xda3c('0x13')](_0xda3c('0x16'),auth[_0xda3c('0xb')](),interaction['tracked']('openchannel','openchannelinteraction:addtags'),controller['addTags']);router['put'](_0xda3c('0xd'),auth[_0xda3c('0xb')](),interaction[_0xda3c('0x17')](_0xda3c('0x18'),_0xda3c('0x19')),controller[_0xda3c('0x1a')]);router[_0xda3c('0x1b')](_0xda3c('0xd'),auth[_0xda3c('0xb')](),interaction[_0xda3c('0x17')]('openchannel',_0xda3c('0x1c')),controller[_0xda3c('0x1d')]);router[_0xda3c('0x1b')](_0xda3c('0x16'),auth[_0xda3c('0xb')](),controller[_0xda3c('0x1e')]);module[_0xda3c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 5fd20b3..2ddd4b4 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 _0x0298=['BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x1768d1,_0x1f4738){var _0x4cebf8=function(_0x409da6){while(--_0x409da6){_0x1768d1['push'](_0x1768d1['shift']());}};_0x4cebf8(++_0x1f4738);}(_0x0298,0x95));var _0x8029=function(_0x23d9d,_0x5161ac){_0x23d9d=_0x23d9d-0x0;var _0x38c703=_0x0298[_0x23d9d];return _0x38c703;};'use strict';var Sequelize=require(_0x8029('0x0'));module['exports']={'closed':{'type':Sequelize[_0x8029('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8029('0x2')]},'disposition':{'type':Sequelize[_0x8029('0x3')]},'secondDisposition':{'type':Sequelize[_0x8029('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8029('0x3')]},'note':{'type':Sequelize[_0x8029('0x3')]},'read1stAt':{'type':Sequelize[_0x8029('0x2')]},'threadId':{'type':Sequelize[_0x8029('0x3')]},'externalUrl':{'type':Sequelize[_0x8029('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x8029('0x4')]('in',_0x8029('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x8029('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xf3cd=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x2c9ea3,_0x515521){var _0x5c5c65=function(_0x3878ee){while(--_0x3878ee){_0x2c9ea3['push'](_0x2c9ea3['shift']());}};_0x5c5c65(++_0x515521);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x99868f,_0xbdb8e7){_0x99868f=_0x99868f-0x0;var _0x27a71b=_0xf3cd[_0x99868f];return _0x27a71b;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'closed':{'type':Sequelize[_0xdf3c('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdf3c('0x3')]},'disposition':{'type':Sequelize[_0xdf3c('0x4')]},'secondDisposition':{'type':Sequelize[_0xdf3c('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xdf3c('0x4')]},'read1stAt':{'type':Sequelize[_0xdf3c('0x3')]},'threadId':{'type':Sequelize[_0xdf3c('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xdf3c('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xdf3c('0x5')]('in',_0xdf3c('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xdf3c('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xdf3c('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 153db59..d493ae7 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 _0x46eb=['defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','name','Users','map','fullname','TagIds','split','forEach','Tags','catch','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','select','field','color','from','tools_tags','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','users','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','user','i.OpenchannelAccountId\x20IS\x20NULL','toString','OpenchannelInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','rows','include','merge','options','create','body','params','addMessage','ids','getMessages','findOne','OpenchannelMessage','hasOwnProperty','pick','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','setTags','spread','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','User','firstName','lastName','Attachment','Messages','createdAt','direction','secret','Account','Owner','get','mkdirSync','N.A.','closed','disposition','Private','basename','createReadStream','createWriteStream','out','System','renderFile','views','.pdf','Openchannel','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis'];(function(_0xed8dd3,_0x3889c7){var _0x2a24d5=function(_0x48cc6f){while(--_0x48cc6f){_0xed8dd3['push'](_0xed8dd3['shift']());}};_0x2a24d5(++_0x3889c7);}(_0x46eb,0xd2));var _0xb46e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x46eb[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0xb46e('0x0'));var rimraf=require(_0xb46e('0x1'));var zipdir=require(_0xb46e('0x2'));var jsonpatch=require(_0xb46e('0x3'));var rp=require(_0xb46e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb46e('0x5'));var util=require(_0xb46e('0x6'));var path=require(_0xb46e('0x7'));var sox=require(_0xb46e('0x8'));var csv=require(_0xb46e('0x9'));var ejs=require(_0xb46e('0xa'));var fs=require('fs');var fs_extra=require(_0xb46e('0xb'));var _=require(_0xb46e('0xc'));var squel=require(_0xb46e('0xd'));var crypto=require(_0xb46e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb46e('0xf'));var toCsv=require(_0xb46e('0x9'));var querystring=require(_0xb46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xb46e('0x11'));var authService=require(_0xb46e('0x12'));var qs=require(_0xb46e('0x13'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb46e('0x14'))(_0xb46e('0x15'));var utils=require(_0xb46e('0x16'));var config=require(_0xb46e('0x17'));var licenseUtil=require(_0xb46e('0x18'));var db=require('../../mysqldb')['db'];config[_0xb46e('0x19')]=_[_0xb46e('0x1a')](config['redis'],{'host':_0xb46e('0x1b'),'port':0x18eb});var socket=require(_0xb46e('0x1c'))(new Redis(config[_0xb46e('0x19')]));require(_0xb46e('0x1d'))[_0xb46e('0x1e')](socket);function respondWithStatusCode(_0x21a09c,_0x4d1972){_0x4d1972=_0x4d1972||0xcc;return function(_0x242b45){if(_0x242b45){return _0x21a09c[_0xb46e('0x1f')](_0x4d1972);}return _0x21a09c[_0xb46e('0x20')](_0x4d1972)[_0xb46e('0x21')]();};}function respondWithResult(_0x334d4b,_0xf291e0){_0xf291e0=_0xf291e0||0xc8;return function(_0x5d5a5d){if(_0x5d5a5d){return _0x334d4b[_0xb46e('0x20')](_0xf291e0)[_0xb46e('0x22')](_0x5d5a5d);}};}function respondWithFilteredResult(_0x593daf,_0x2eab41){return function(_0x1659fc){if(_0x1659fc){var _0x3643c9=typeof _0x2eab41[_0xb46e('0x23')]===_0xb46e('0x24')&&typeof _0x2eab41[_0xb46e('0x25')]===_0xb46e('0x24');var _0xe44179=_0x1659fc[_0xb46e('0x26')];var _0x52959c=_0x3643c9?0x0:_0x2eab41[_0xb46e('0x23')];var _0x1ac9a0=_0x3643c9?_0x1659fc[_0xb46e('0x26')]:_0x2eab41[_0xb46e('0x23')]+_0x2eab41['limit'];var _0x184804;if(_0x1ac9a0>=_0xe44179){_0x1ac9a0=_0xe44179;_0x184804=0xc8;}else{_0x184804=0xce;}_0x593daf[_0xb46e('0x20')](_0x184804);return _0x593daf[_0xb46e('0x27')](_0xb46e('0x28'),_0x52959c+'-'+_0x1ac9a0+'/'+_0xe44179)[_0xb46e('0x22')](_0x1659fc);}return null;};}function patchUpdates(_0x3a5f91){return function(_0xddb41e){try{jsonpatch[_0xb46e('0x29')](_0xddb41e,_0x3a5f91,!![]);}catch(_0x20dd93){return BPromise[_0xb46e('0x2a')](_0x20dd93);}return _0xddb41e[_0xb46e('0x2b')]();};}function saveUpdates(_0x20ab5b,_0x72b3a7){return function(_0x32d4fe){if(_0x32d4fe){return _0x32d4fe[_0xb46e('0x2c')](_0x20ab5b)[_0xb46e('0x2d')](function(_0x38e1bf){return _0x38e1bf;});}return null;};}function removeEntity(_0x4001fa,_0x29b121){return function(_0x4659c6){if(_0x4659c6){return _0x4659c6[_0xb46e('0x2e')]()[_0xb46e('0x2d')](function(){_0x4001fa[_0xb46e('0x20')](0xcc)[_0xb46e('0x21')]();});}};}function handleEntityNotFound(_0x7b20a8,_0x16f8dd){return function(_0x574ba5){if(!_0x574ba5){_0x7b20a8[_0xb46e('0x1f')](0x194);}return _0x574ba5;};}function handleError(_0x31d193,_0x2cff3e){_0x2cff3e=_0x2cff3e||0x1f4;return function(_0x447445){logger['error'](_0x447445['stack']);if(_0x447445[_0xb46e('0x2f')]){delete _0x447445[_0xb46e('0x2f')];}_0x31d193[_0xb46e('0x20')](_0x2cff3e)['send'](_0x447445);};}function getInteractionUsers(_0x392fe6,_0x1d59bf){return new BPromise(function(_0x453f50,_0xc9ed3c){try{if(_0x1d59bf[_0x392fe6['id']]){_0x392fe6[_0xb46e('0x30')]=_[_0xb46e('0x31')](_0x1d59bf[_0x392fe6['id']],function(_0xf914e7){return{'id':_0xf914e7['id'],'fullname':_0xf914e7[_0xb46e('0x32')]};});}}catch(_0x2ce8b1){_0xc9ed3c(_0x2ce8b1);}_0x453f50(_0x392fe6);});}function getInteractionTags(_0x53441b,_0x5db012){return new BPromise(function(_0x33caba,_0x1dc547){try{if(_0x53441b[_0xb46e('0x33')]){_0x53441b['Tags']=[];_0x53441b['TagIds'][_0xb46e('0x34')](',')[_0xb46e('0x35')](function(_0x383429){_0x53441b[_0xb46e('0x36')]['push'](_0x5db012[_0x383429]);});}delete _0x53441b[_0xb46e('0x33')];}catch(_0x1e355f){_0x1dc547(_0x1e355f);}_0x33caba(_0x53441b);});}function updateOpenchannelInteraction(_0x57a383,_0xcf7d6c,_0x5556dc){return new BPromise(function(_0x56f256,_0x9dd991){return getInteractionUsers(_0x57a383,_0x5556dc)[_0xb46e('0x2d')](function(_0x57c5b0){return getInteractionTags(_0x57c5b0,_0xcf7d6c);})[_0xb46e('0x2d')](function(_0xb0988a){_0x56f256(_0xb0988a);})[_0xb46e('0x37')](function(_0x25d4ac){_0x9dd991(_0x25d4ac);});});}exports['index']=function(_0x2cedce,_0x27ce72){var _0x2b42cd={},_0x27c7b9={},_0x29b3e8={'count':0x0,'rows':[]};var _0x148c66=_[_0xb46e('0x31')](db['OpenchannelInteraction'][_0xb46e('0x38')],function(_0x1fa2e2){return{'name':_0x1fa2e2['fieldName'],'type':_0x1fa2e2[_0xb46e('0x39')][_0xb46e('0x3a')]};});_0x27c7b9['model']=_[_0xb46e('0x31')](_0x148c66,'name');_0x27c7b9['query']=_[_0xb46e('0x3b')](_0x2cedce[_0xb46e('0x3c')]);_0x27c7b9[_0xb46e('0x3d')]=_[_0xb46e('0x3e')](_0x27c7b9[_0xb46e('0x3f')],_0x27c7b9[_0xb46e('0x3c')]);_0x2b42cd[_0xb46e('0x40')]=_['intersection'](_0x27c7b9['model'],qs[_0xb46e('0x41')](_0x2cedce['query']['fields']));_0x2b42cd[_0xb46e('0x40')]=_0x2b42cd[_0xb46e('0x40')]['length']?_0x2b42cd[_0xb46e('0x40')]:_0x27c7b9[_0xb46e('0x3f')];if(!_0x2cedce[_0xb46e('0x3c')]['hasOwnProperty'](_0xb46e('0x42'))){_0x2b42cd['limit']=qs['limit'](_0x2cedce[_0xb46e('0x3c')]['limit']);_0x2b42cd['offset']=qs[_0xb46e('0x23')](_0x2cedce[_0xb46e('0x3c')][_0xb46e('0x23')]);}_0x2b42cd[_0xb46e('0x43')]=qs[_0xb46e('0x44')](_0x2cedce[_0xb46e('0x3c')]['sort']);_0x2b42cd[_0xb46e('0x45')]=qs[_0xb46e('0x3d')](_['pick'](_0x2cedce['query'],_0x27c7b9[_0xb46e('0x3d')]),_0x148c66);var _0x24a946=[];var _0x5a8d8c=squel[_0xb46e('0x46')]()[_0xb46e('0x47')]('id')[_0xb46e('0x47')](_0xb46e('0x2f'))[_0xb46e('0x47')](_0xb46e('0x48'))[_0xb46e('0x49')](_0xb46e('0x4a'));var _0xace45f=squel[_0xb46e('0x46')]()[_0xb46e('0x47')](_0xb46e('0x4b'))[_0xb46e('0x47')]('u.fullname')['field'](_0xb46e('0x4c'))['from'](_0xb46e('0x4d'),'ui')['left_join']('users','u',_0xb46e('0x4e'));var _0x774a4f=squel[_0xb46e('0x46')]()[_0xb46e('0x49')](_0xb46e('0x4f'),'i')[_0xb46e('0x50')](_0xb46e('0x51'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0xb46e('0x52'),'o',_0xb46e('0x53'))[_0xb46e('0x50')](_0xb46e('0x54'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0xb46e('0x50')](_0xb46e('0x55'),'me',_0xb46e('0x56'))[_0xb46e('0x50')](_0xb46e('0x57'),'it',_0xb46e('0x58'))['left_join']('tools_tags','t',_0xb46e('0x59'));var _0x97297a=squel[_0xb46e('0x5a')]();var _0x395853=[];var _0x1e914e=squel[_0xb46e('0x5a')]();var _0x5e3686;if(_0x2cedce[_0xb46e('0x3c')]['search']){_0x5e3686=as['parseSearch'](_0x2cedce[_0xb46e('0x3c')][_0xb46e('0x5b')]);var _0x1a5230=_0x5e3686[_0xb46e('0x5c')];for(var _0xb81a59=0x0;_0xb81a59<_0x5e3686[_0xb46e('0x5d')][_0xb46e('0x5e')];_0xb81a59++){var _0x22f422=_0x5e3686[_0xb46e('0x5d')][_0xb81a59];var _0x2263b4='i';var _0x3ab21c=_['find'](_0x148c66,[_0xb46e('0x2f'),_0x22f422[_0xb46e('0x47')]]);if(!_0x3ab21c){switch(_0x22f422['field']){case _0xb46e('0x5f'):if(_0x22f422['value']==0x1){_0x774a4f['having']('`'+_0x22f422[_0xb46e('0x47')]+'`\x20=\x200');}else{_0x774a4f[_0xb46e('0x60')]('`'+_0x22f422['field']+_0xb46e('0x61'));}break;case _0xb46e('0x62'):if(_0x22f422[_0xb46e('0x63')]===_0xb46e('0x64')){if(_0x22f422[_0xb46e('0x65')][_0xb46e('0x34')]('\x20')[_0xb46e('0x5e')]>0x1){_0x97297a[_0x1a5230](_0xb46e('0x66'),qs[_0xb46e('0x67')](_0x22f422[_0xb46e('0x65')]),null);}else{var _0x48ea48='%'+_0x22f422[_0xb46e('0x65')]+'%';_0x97297a[_0x1a5230](_0xb46e('0x68'),_0x48ea48,_0x48ea48,_0x48ea48);}}else{_0x3ab21c=_[_0xb46e('0x69')](_0x148c66,[_0xb46e('0x2f'),'ContactId']);_0x22f422[_0xb46e('0x47')]=_0xb46e('0x6a');_0x390f41=as[_0xb46e('0x6b')](_0x2263b4,_0x3ab21c[_0xb46e('0x39')],_0x22f422);_0x97297a[_0x1a5230](_0x390f41[_0xb46e('0x6c')],_0x390f41[_0xb46e('0x65')][_0xb46e('0x6d')],_0x390f41[_0xb46e('0x65')][_0xb46e('0x21')]);}break;case _0xb46e('0x6e'):var _0x14d2e7=_0x22f422[_0xb46e('0x65')]['split'](',')[_0xb46e('0x31')](function(_0x477a2d){return Number(_0x477a2d);});_0x14d2e7['forEach'](function(_0x50d8d8){_0x1e914e['or'](_0xb46e('0x6f'),'%,'+_0x50d8d8+',%');});_0x395853=_[_0xb46e('0x70')](_0x395853,_0x14d2e7);break;case'User':if(_0x22f422[_0xb46e('0x63')]===_0xb46e('0x64')){_0x97297a[_0x1a5230](_0xb46e('0x71'),'%'+_0x22f422[_0xb46e('0x65')]+'%',null);}else{_0x3ab21c=_[_0xb46e('0x69')](_0x148c66,[_0xb46e('0x2f'),_0xb46e('0x72')]);_0x22f422[_0xb46e('0x47')]=_0xb46e('0x72');_0x390f41=as[_0xb46e('0x6b')](_0x2263b4,_0x3ab21c[_0xb46e('0x39')],_0x22f422);_0x97297a[_0x1a5230](_0x390f41[_0xb46e('0x6c')],_0x390f41[_0xb46e('0x65')]['start'],_0x390f41[_0xb46e('0x65')]['end']);}break;case'body':_0x390f41=as[_0xb46e('0x6b')]('me',null,_0x22f422);_0x97297a[_0x1a5230](_0x390f41[_0xb46e('0x6c')],_0x390f41['value'][_0xb46e('0x6d')],_0x390f41[_0xb46e('0x65')][_0xb46e('0x21')]);break;}}else{var _0x390f41=as[_0xb46e('0x6b')](_0x2263b4,_0x3ab21c[_0xb46e('0x39')],_0x22f422);_0x97297a[_0x1a5230](_0x390f41[_0xb46e('0x6c')],_0x390f41[_0xb46e('0x65')][_0xb46e('0x6d')],_0x390f41[_0xb46e('0x65')][_0xb46e('0x21')]);}}}else{var _0x434c1b=_(_0x2cedce[_0xb46e('0x3c')])[_0xb46e('0x3b')]()[_0xb46e('0x31')](function(_0x5a1c90){return _[_0xb46e('0x73')](_0x148c66,[_0xb46e('0x2f'),_0x5a1c90])?_0x5a1c90:undefined;})[_0xb46e('0x74')]()[_0xb46e('0x65')]();if(!_['isEmpty'](_0x434c1b)){_0x434c1b[_0xb46e('0x35')](function(_0x58beda){if(_0x58beda===_0xb46e('0x75')){_0x774a4f['where'](_0xb46e('0x76'),[][_0xb46e('0x77')](_0x2cedce['query'][_0x58beda]));}else if(_0x58beda==='createdAt'){var _0xf641c3=JSON[_0xb46e('0x78')](_0x2cedce[_0xb46e('0x3c')][_0x58beda])[_0xb46e('0x79')];var _0x4a72f6=JSON[_0xb46e('0x78')](_0x2cedce[_0xb46e('0x3c')][_0x58beda])[_0xb46e('0x7a')];_0x774a4f[_0xb46e('0x45')](_0xb46e('0x7b'),_0xf641c3,_0x4a72f6);}else{if(_0x2cedce[_0xb46e('0x3c')][_0x58beda]==='null'){_0x774a4f[_0xb46e('0x45')]('i.'+_0x58beda+_0xb46e('0x7c'));}else{_0x774a4f[_0xb46e('0x45')]('i.'+_0x58beda+'\x20=\x20?',_0x2cedce[_0xb46e('0x3c')][_0x58beda]);}}});}if(_0x2cedce[_0xb46e('0x3c')][_0xb46e('0x7d')]){if(_0x2cedce['query'][_0xb46e('0x7d')]==0x1){_0x774a4f[_0xb46e('0x60')](_0xb46e('0x7e'));}else{_0x774a4f['having'](_0xb46e('0x7f'));}}if(_0x2cedce[_0xb46e('0x3c')][_0xb46e('0x80')]){_0x395853=_[_0xb46e('0x81')](_0x2cedce[_0xb46e('0x3c')]['tag'])?_0x2cedce[_0xb46e('0x3c')][_0xb46e('0x80')]:new Array(_0x2cedce[_0xb46e('0x3c')][_0xb46e('0x80')]);_0x395853[_0xb46e('0x35')](function(_0x335e9b){_0x1e914e['or'](_0xb46e('0x6f'),'%,'+_0x335e9b+',%');});}if(_0x2cedce[_0xb46e('0x3c')][_0xb46e('0x82')]){var _0x4ed201=_0x2cedce['query']['filter'][_0xb46e('0x83')]('\x5c','\x5c\x5c')[_0xb46e('0x83')](/'/g,'\x27\x27');if(qs[_0xb46e('0x84')](_0x4ed201)){_0x97297a['or'](_0xb46e('0x85'),_0x4ed201+'%');}else{_0x97297a['or'](_0xb46e('0x86'),qs[_0xb46e('0x67')](_0x4ed201))['or'](_0xb46e('0x87'),_0x4ed201+'%')['or'](_0xb46e('0x88'),_0x4ed201+'%');}}}_0x774a4f['where'](_0x97297a);_0x774a4f[_0xb46e('0x89')](_0xb46e('0x8a'));var _0x3a58ab={'type':db[_0xb46e('0x8b')]['QueryTypes'][_0xb46e('0x8c')],'raw':!![]};var _0x38a258=_0x774a4f[_0xb46e('0x8d')]();_0x38a258[_0xb46e('0x47')](_0xb46e('0x8a'));_0x38a258[_0xb46e('0x47')](_0xb46e('0x8e'),_0xb46e('0x5f'));if(_0x2b42cd['order']){_0x2b42cd[_0xb46e('0x43')][_0xb46e('0x35')](function(_0x3d267d){var _0x4ef7fb=_0x3d267d[0x0]===_0xb46e('0x8f')?_0x3d267d[0x0]:'i.'+_0x3d267d[0x0];_0x774a4f[_0xb46e('0x43')](_0x4ef7fb,_0x3d267d[0x1]===_0xb46e('0x90')?![]:!![]);});}if(!_[_0xb46e('0x91')](_0x395853)){_0x774a4f[_0xb46e('0x60')](_0x1e914e);_0x38a258[_0xb46e('0x45')](_0xb46e('0x92'),_0x395853);}BPromise[_0xb46e('0x93')]()['then'](function(){if(!_0x5e3686){if(_0x2cedce[_0xb46e('0x3c')][_0xb46e('0x75')])return;_0x38a258['where'](_0xb46e('0x94'));_0x774a4f[_0xb46e('0x45')](_0xb46e('0x94'));return;}if(_0x2cedce['user'][_0xb46e('0x95')]!=='agent')return;return _0x2cedce[_0xb46e('0x96')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0xb46e('0x2d')](function(_0x493dea){if(_[_0xb46e('0x91')](_0x493dea)){_0x38a258[_0xb46e('0x45')](_0xb46e('0x97'));_0x774a4f['where'](_0xb46e('0x97'));}else{_0x38a258[_0xb46e('0x45')]('i.OpenchannelAccountId\x20IN\x20?',_[_0xb46e('0x31')](_0x493dea,'id'));_0x774a4f['where'](_0xb46e('0x76'),_[_0xb46e('0x31')](_0x493dea,'id'));}});})['then'](function(){if(_0x2cedce[_0xb46e('0x96')][_0xb46e('0x95')]==='agent'&&!_0x5e3686&&!_0x2cedce[_0xb46e('0x3c')][_0xb46e('0x75')])return[];return db['sequelize'][_0xb46e('0x3c')](_0x38a258[_0xb46e('0x98')](),_0x3a58ab);})[_0xb46e('0x2d')](function(_0x5b49a5){_0x29b3e8['count']=_0x5b49a5[_0xb46e('0x5e')];if(_0x29b3e8[_0xb46e('0x26')]===0x0)return[];return db['sequelize'][_0xb46e('0x3c')](_0x5a8d8c['toString'](),_0x3a58ab)[_0xb46e('0x2d')](function(_0x45bb83){_0x24a946=_['keyBy'](_0x45bb83,'id');_0x3a58ab=_['merge'](_0x3a58ab,{'model':db[_0xb46e('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2cedce[_0xb46e('0x3c')][_0xb46e('0x41')]){_0x2b42cd[_0xb46e('0x40')]['forEach'](function(_0x4e6d1e){_0x774a4f[_0xb46e('0x47')]('i.'+_0x4e6d1e);});}else{_0x774a4f[_0xb46e('0x47')](_0xb46e('0x8e'),_0xb46e('0x5f'));_0x774a4f[_0xb46e('0x47')](_0xb46e('0x9a'),_0xb46e('0x9b'));_0x774a4f['field'](_0xb46e('0x9c'),_0xb46e('0x9d'));_0x774a4f[_0xb46e('0x47')](_0xb46e('0x9e'),_0xb46e('0x8f'));_0x774a4f[_0xb46e('0x47')](_0xb46e('0x9f'));_0x774a4f[_0xb46e('0x47')]('c.firstName','Contact.firstName');_0x774a4f[_0xb46e('0x47')](_0xb46e('0xa0'),_0xb46e('0xa1'));_0x774a4f[_0xb46e('0x47')](_0xb46e('0xa2'),_0xb46e('0xa3'));_0x774a4f['field'](_0xb46e('0xa4'),_0xb46e('0xa5'));_0x774a4f[_0xb46e('0x47')]('c.mobile',_0xb46e('0xa6'));_0x774a4f[_0xb46e('0x47')](_0xb46e('0xa7'),'Contact.fax');_0x774a4f[_0xb46e('0x47')](_0xb46e('0xa8'),_0xb46e('0xa9'));_0x774a4f['field']('o.internal','Owner.internal');_0x774a4f[_0xb46e('0x47')](_0xb46e('0xaa'),_0xb46e('0x33'));}if(_0x2b42cd[_0xb46e('0x25')])_0x774a4f[_0xb46e('0x25')](_0x2b42cd[_0xb46e('0x25')]);if(_0x2b42cd['offset'])_0x774a4f[_0xb46e('0x23')](_0x2b42cd[_0xb46e('0x23')]);return db[_0xb46e('0xab')][_0xb46e('0x3c')](_0x774a4f[_0xb46e('0x98')](),_0x3a58ab);})['then'](function(_0x54b396){if(_0x54b396[_0xb46e('0x5e')]>0x0)_0xace45f[_0xb46e('0x45')](_0xb46e('0xac'),_['map'](_0x54b396,'id'));return db[_0xb46e('0xab')][_0xb46e('0x3c')](_0xace45f[_0xb46e('0x98')](),_0x3a58ab)[_0xb46e('0x2d')](function(_0x2f17d9){var _0x4a8608=_[_0xb46e('0xad')](_0x2f17d9,_0xb46e('0xae'));var _0x510ea0=[];_0x54b396['forEach'](function(_0x23c8ef){_0x510ea0[_0xb46e('0xaf')](updateOpenchannelInteraction(_0x23c8ef,_0x24a946,_0x4a8608));});return BPromise[_0xb46e('0xb0')](_0x510ea0);});});})[_0xb46e('0x2d')](function(_0x23118c){_0x29b3e8[_0xb46e('0xb1')]=_0x23118c;return _0x29b3e8;})[_0xb46e('0x2d')](respondWithFilteredResult(_0x27ce72,_0x2b42cd))[_0xb46e('0x37')](handleError(_0x27ce72,null));};exports['show']=function(_0x57a588,_0x446b61){var _0x3c57b5={};if(_0x57a588['query']['type']&&_0x57a588[_0xb46e('0x3c')]['type']===_0xb46e('0x49')){_0x3c57b5[_0xb46e('0x49')]=_0x57a588['params']['id'];}else{_0x3c57b5['id']=_0x57a588['params']['id'];}var _0x1e893d={'raw':![],'where':_0x3c57b5},_0x1363d5={};_0x1363d5[_0xb46e('0x3f')]=_[_0xb46e('0x3b')](db[_0xb46e('0x99')][_0xb46e('0x38')]);_0x1363d5['query']=_[_0xb46e('0x3b')](_0x57a588[_0xb46e('0x3c')]);_0x1363d5[_0xb46e('0x3d')]=_[_0xb46e('0x3e')](_0x1363d5[_0xb46e('0x3f')],_0x1363d5[_0xb46e('0x3c')]);_0x1e893d[_0xb46e('0x40')]=_[_0xb46e('0x3e')](_0x1363d5['model'],qs['fields'](_0x57a588[_0xb46e('0x3c')][_0xb46e('0x41')]));_0x1e893d[_0xb46e('0x40')]=_0x1e893d[_0xb46e('0x40')][_0xb46e('0x5e')]?_0x1e893d[_0xb46e('0x40')]:_0x1363d5[_0xb46e('0x3f')];if(_0x57a588[_0xb46e('0x3c')]['includeAll']){_0x1e893d[_0xb46e('0xb2')]=[{'all':!![]}];}_0x1e893d=_[_0xb46e('0xb3')]({},_0x1e893d,_0x57a588[_0xb46e('0xb4')]);return db[_0xb46e('0x99')][_0xb46e('0x69')](_0x1e893d)[_0xb46e('0x2d')](handleEntityNotFound(_0x446b61,null))['then'](respondWithResult(_0x446b61,null))['catch'](handleError(_0x446b61,null));};exports['create']=function(_0x10ae00,_0x4f9ee5){return db['OpenchannelInteraction'][_0xb46e('0xb5')](_0x10ae00[_0xb46e('0xb6')],{})['then'](respondWithResult(_0x4f9ee5,0xc9))[_0xb46e('0x37')](handleError(_0x4f9ee5,null));};exports[_0xb46e('0x2c')]=function(_0x20fa02,_0x1457c8){if(_0x20fa02[_0xb46e('0xb6')]['id']){delete _0x20fa02['body']['id'];}return db[_0xb46e('0x99')][_0xb46e('0x69')]({'where':{'id':_0x20fa02[_0xb46e('0xb7')]['id']}})[_0xb46e('0x2d')](handleEntityNotFound(_0x1457c8,null))['then'](saveUpdates(_0x20fa02[_0xb46e('0xb6')],null))[_0xb46e('0x2d')](respondWithResult(_0x1457c8,null))[_0xb46e('0x37')](handleError(_0x1457c8,null));};exports[_0xb46e('0x2e')]=function(_0xad244b,_0x58afc1){return db[_0xb46e('0x99')][_0xb46e('0x69')]({'where':{'id':_0xad244b[_0xb46e('0xb7')]['id']}})[_0xb46e('0x2d')](handleEntityNotFound(_0x58afc1,null))[_0xb46e('0x2d')](removeEntity(_0x58afc1,null))['catch'](handleError(_0x58afc1,null));};exports['describe']=function(_0x3e54c3,_0x2b029b){return db[_0xb46e('0x99')]['describe']()[_0xb46e('0x2d')](respondWithResult(_0x2b029b,null))['catch'](handleError(_0x2b029b,null));};exports['addMessage']=function(_0x9b686d,_0x1f2795,_0x214367){return db['OpenchannelMessage'][_0xb46e('0x69')]({'where':{'id':_0x9b686d[_0xb46e('0xb7')]['id']}})[_0xb46e('0x2d')](handleEntityNotFound(_0x1f2795,null))['then'](function(_0x5d3c24){if(_0x5d3c24){return _0x5d3c24[_0xb46e('0xb8')](_0x9b686d[_0xb46e('0xb6')]['ids'],_['omit'](_0x9b686d[_0xb46e('0xb6')],[_0xb46e('0xb9'),'id'])||{});}})[_0xb46e('0x2d')](respondWithResult(_0x1f2795,null))[_0xb46e('0x37')](handleError(_0x1f2795,null));};exports[_0xb46e('0xba')]=function(_0x22ddb0,_0x37d8d3,_0x150c34){var _0x87bdd0={'raw':![],'where':{}};var _0x480ea6={};var _0x3346bc={'count':0x0,'rows':[]};return db[_0xb46e('0x99')][_0xb46e('0xbb')]({'where':{'id':_0x22ddb0[_0xb46e('0xb7')]['id']}})[_0xb46e('0x2d')](handleEntityNotFound(_0x37d8d3,null))['then'](function(_0xe852d1){if(_0xe852d1){_0x480ea6[_0xb46e('0x3f')]=_[_0xb46e('0x3b')](db[_0xb46e('0xbc')][_0xb46e('0x38')]);_0x480ea6[_0xb46e('0x3c')]=_[_0xb46e('0x3b')](_0x22ddb0[_0xb46e('0x3c')]);_0x480ea6[_0xb46e('0x3d')]=_[_0xb46e('0x3e')](_0x480ea6[_0xb46e('0x3f')],_0x480ea6[_0xb46e('0x3c')]);_0x87bdd0[_0xb46e('0x40')]=_['intersection'](_0x480ea6['model'],qs['fields'](_0x22ddb0['query'][_0xb46e('0x41')]));_0x87bdd0['attributes']=_0x87bdd0[_0xb46e('0x40')][_0xb46e('0x5e')]?_0x87bdd0['attributes']:_0x480ea6[_0xb46e('0x3f')];if(!_0x22ddb0[_0xb46e('0x3c')][_0xb46e('0xbd')](_0xb46e('0x42'))){_0x87bdd0[_0xb46e('0x25')]=qs[_0xb46e('0x25')](_0x22ddb0[_0xb46e('0x3c')][_0xb46e('0x25')]);_0x87bdd0[_0xb46e('0x23')]=qs[_0xb46e('0x23')](_0x22ddb0[_0xb46e('0x3c')][_0xb46e('0x23')]);}_0x87bdd0[_0xb46e('0x43')]=qs[_0xb46e('0x44')](_0x22ddb0['query'][_0xb46e('0x44')]);_0x87bdd0[_0xb46e('0x45')]=qs[_0xb46e('0x3d')](_[_0xb46e('0xbe')](_0x22ddb0['query'],_0x480ea6[_0xb46e('0x3d')]));_0x87bdd0[_0xb46e('0x45')]['OpenchannelInteractionId']=_0xe852d1['id'];if(_0x22ddb0[_0xb46e('0x3c')]['filter']){_0x87bdd0['where']=_['merge'](_0x87bdd0['where'],{'$or':_[_0xb46e('0x31')](_0x87bdd0['attributes'],function(_0x2ae3ad){var _0x2e744d={};_0x2e744d[_0x2ae3ad]={'$like':'%'+_0x22ddb0[_0xb46e('0x3c')]['filter']+'%'};return _0x2e744d;})});}if(_0x22ddb0['query']['$gte']){var _0x56ea86=_0x22ddb0[_0xb46e('0x3c')][_0xb46e('0x79')][_0xb46e('0x34')](',');var _0xe25356={};_0xe25356[_0x56ea86[0x0]]={'$gte':moment(_0x56ea86[0x1])[_0xb46e('0xbf')](_0xb46e('0xc0'))};_0x87bdd0[_0xb46e('0x45')]=_['merge'](_0x87bdd0[_0xb46e('0x45')],_0xe25356);}_0x87bdd0=_[_0xb46e('0xb3')]({},_0x87bdd0,_0x22ddb0[_0xb46e('0xb4')]);return db[_0xb46e('0xbc')]['count']({'where':_0x87bdd0[_0xb46e('0x45')]})[_0xb46e('0x2d')](function(_0x42a187){_0x3346bc[_0xb46e('0x26')]=_0x42a187;if(_0x22ddb0[_0xb46e('0x3c')][_0xb46e('0xc1')]){_0x87bdd0['include']=[{'all':!![]}];}return db[_0xb46e('0xbc')]['findAll'](_0x87bdd0);})['then'](function(_0x131025){_0x3346bc['rows']=_0x131025;return _0x3346bc;});}})[_0xb46e('0x2d')](respondWithFilteredResult(_0x37d8d3,_0x87bdd0))[_0xb46e('0x37')](handleError(_0x37d8d3,null));};exports[_0xb46e('0xc2')]=function(_0x5057c0,_0xcaee44,_0x6c2c10){return db[_0xb46e('0x99')][_0xb46e('0x69')]({'where':{'id':_0x5057c0[_0xb46e('0xb7')]['id']}})[_0xb46e('0x2d')](handleEntityNotFound(_0xcaee44,null))[_0xb46e('0x2d')](function(_0x3a7c49){if(_0x3a7c49){return _0x3a7c49[_0xb46e('0xc3')](_0x5057c0['body']['ids'],_['omit'](_0x5057c0['body'],[_0xb46e('0xb9'),'id'])||{})[_0xb46e('0xc4')](function(){return db[_0xb46e('0x6e')]['findAll']({'attributes':['id',_0xb46e('0x2f'),_0xb46e('0x48')],'where':{'id':_0x5057c0['body']['ids']}});})[_0xb46e('0x2d')](function(_0x43d0d7){socket['emit'](_0xb46e('0xc5'),{'id':Number(_0x5057c0[_0xb46e('0xb7')]['id']),'tags':_0x43d0d7||[]});return{'id':Number(_0x5057c0[_0xb46e('0xb7')]['id']),'tags':_0x43d0d7||[]};});}})[_0xb46e('0x2d')](respondWithResult(_0xcaee44,null))['catch'](handleError(_0xcaee44,null));};exports[_0xb46e('0xc6')]=function(_0xda02bf,_0x1003ed,_0x1d0b28){return db[_0xb46e('0x99')]['find']({'where':{'id':_0xda02bf[_0xb46e('0xb7')]['id']}})[_0xb46e('0x2d')](handleEntityNotFound(_0x1003ed,null))[_0xb46e('0x2d')](function(_0x3d70c6){if(_0x3d70c6){return _0x3d70c6['removeTags'](_0xda02bf[_0xb46e('0x3c')][_0xb46e('0xb9')]);}})[_0xb46e('0x2d')](respondWithStatusCode(_0x1003ed,null))['catch'](handleError(_0x1003ed,null));};exports[_0xb46e('0xc7')]=function(_0x80c116,_0x187162){var _0x514b8f=moment()[_0xb46e('0xc8')]()['toString']();var _0x5241f1=path[_0xb46e('0xc9')](config[_0xb46e('0xca')],_0xb46e('0xcb'),_0xb46e('0xcc'),_0xb46e('0xcd'));var _0x5ade0b=path[_0xb46e('0xc9')](config[_0xb46e('0xca')],'server',_0xb46e('0xcc'),_0xb46e('0xce'));var _0x316d00=path['join'](_0x5241f1,_0x514b8f);var _0x6654fc=util[_0xb46e('0xbf')]('transcript-%d-%s.zip',_0x80c116['params']['id'],_0x514b8f);var _0x343fac=path[_0xb46e('0xc9')](_0x5241f1,_0x6654fc);var _0x406a4b=[];_0x406a4b[_0xb46e('0xaf')]({'model':db['User'],'as':_0xb46e('0xcf'),'attributes':['id',_0xb46e('0x32')],'raw':!![]});_0x406a4b[_0xb46e('0xaf')]({'model':db['CmContact'],'as':_0xb46e('0x62'),'attributes':['id',_0xb46e('0xd0'),_0xb46e('0xd1')],'raw':!![]});if(_0x80c116[_0xb46e('0x3c')][_0xb46e('0xce')]){_0x406a4b['push']({'model':db[_0xb46e('0xd2')],'as':_0xb46e('0xd2'),'raw':!![]});}var _0x4eb344=[{'model':db[_0xb46e('0xbc')],'as':_0xb46e('0xd3'),'attributes':['id','body',_0xb46e('0xd4'),_0xb46e('0xd5'),_0xb46e('0xd6'),_0xb46e('0x7d')],'include':_0x406a4b}];_0x4eb344[_0xb46e('0xaf')]({'model':db['OpenchannelAccount'],'as':_0xb46e('0xd7'),'attributes':['id','name']});_0x4eb344[_0xb46e('0xaf')]({'model':db[_0xb46e('0xcf')],'as':_0xb46e('0xd8'),'attributes':['id',_0xb46e('0x32')]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x80c116[_0xb46e('0xb7')]['id']},'include':_0x4eb344})[_0xb46e('0x2d')](handleEntityNotFound(_0x187162,null))['then'](function(_0x55e23e){if(_0x55e23e){var _0x494901=_0x55e23e[_0xb46e('0xd9')]({'plain':!![]});fs[_0xb46e('0xda')](_0x316d00);var _0x519765={'channel':'Openchannel','account':_0x494901['Account'][_0xb46e('0x2f')],'agent':_0x494901[_0xb46e('0xd8')]?_0x494901[_0xb46e('0xd8')]['fullname']:_0xb46e('0xdb'),'createdAt':moment(_0x494901[_0xb46e('0xd4')])[_0xb46e('0xbf')](_0xb46e('0xc0'))[_0xb46e('0x98')](),'closedAt':_0x494901[_0xb46e('0xdc')]?moment(_0x494901['closedAt'])[_0xb46e('0xbf')](_0xb46e('0xc0'))[_0xb46e('0x98')]():'','disposition':_0x494901[_0xb46e('0xdd')],'visibility':_0x494901['threadId']?'Public':_0xb46e('0xde'),'messages':_(_0x494901['Messages'])[_0xb46e('0x82')]({'secret':![]})[_0xb46e('0x31')](function(_0x101e33){if(_0x101e33[_0xb46e('0xd2')]){var _0x5263af=path['join'](_0x5ade0b,_0x101e33['Attachment'][_0xb46e('0xdf')]);if(fs['existsSync'](_0x5263af)){fs[_0xb46e('0xe0')](_0x5263af)['pipe'](fs[_0xb46e('0xe1')](path[_0xb46e('0xc9')](_0x316d00,_0x101e33['Attachment']['basename'])));}}return{'date':moment(_0x101e33[_0xb46e('0xd4')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xb46e('0x98')](),'sender':_0x101e33[_0xb46e('0xd5')]===_0xb46e('0xe2')?_0x101e33[_0xb46e('0xcf')]?_0x101e33[_0xb46e('0xcf')]['fullname']:_0xb46e('0xe3'):_0x101e33[_0xb46e('0x62')][_0xb46e('0xd0')]+(_0x101e33[_0xb46e('0x62')]['lastName']?'\x20'+_0x101e33[_0xb46e('0x62')][_0xb46e('0xd1')]:''),'body':_0x101e33['Attachment']?_0x101e33[_0xb46e('0xd2')][_0xb46e('0xdf')]:_0x101e33[_0xb46e('0xb6')],'direction':_0x101e33[_0xb46e('0xd5')]===_0xb46e('0xe2')?'A':'C','secret':_0x101e33[_0xb46e('0xd6')],'read':_0x101e33['read'],'attachment':_0x101e33['Attachment']};})[_0xb46e('0x65')]()};return ejs[_0xb46e('0xe4')](path[_0xb46e('0xc9')](config[_0xb46e('0xca')],_0xb46e('0xcb'),_0xb46e('0xe5'),'downloadInteraction.ejs'),{'interaction':_0x519765})['then'](function(_0x3b3009){var _0x1be9e0=path[_0xb46e('0xc9')](_0x316d00,'transcript-'+_0x494901['id']+'-'+_0x514b8f+_0xb46e('0xe6'));var _0x24fc32={'path':_0x1be9e0,'channel':_0xb46e('0xe7'),'interactionId':_0x494901['id']};return pdf[_0xb46e('0xe8')](_0x3b3009,_0x24fc32);})[_0xb46e('0x2d')](function(){return new BPromise(function(_0x2b11e2,_0x6ca0e8){zipdir(_0x316d00,{'saveTo':_0x343fac},function(_0xc33e0e,_0x13e1df){if(_0xc33e0e)return _0x6ca0e8(_0xc33e0e);return _0x2b11e2(_0x13e1df);});})[_0xb46e('0x2d')](function(){return new BPromise(function(_0x2f250c,_0x30fb05){rimraf(_0x316d00,function(_0x39cf3b){if(_0x39cf3b)_0x30fb05(_0x39cf3b);return _0x2f250c();});});})[_0xb46e('0x2d')](function(){return _0x187162[_0xb46e('0xc7')](_0x343fac,_0x6654fc,function(_0x419271){if(_0x419271){console[_0xb46e('0xe9')](_0xb46e('0xea'),_0x419271);}else{fs[_0xb46e('0xeb')](_0x343fac);}});});});}else{return _0x187162[_0xb46e('0x1f')](0xc8);}})['catch'](handleError(_0x187162,null));}; \ No newline at end of file +var _0xf062=['secret','Owner','get','mkdirSync','Openchannel','N.A.','closed','disposition','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','.pdf','createPdfFromHTML','log','err','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','name','map','fullname','Tags','TagIds','split','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','field','color','tools_tags','select','u.id','u.fullname','ui.OpenchannelInteractionId','from','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','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','some','compact','isEmpty','forEach','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','OpenchannelAccountId','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','unreadMessages','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.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','keys','include','options','create','describe','addMessage','OpenchannelMessage','ids','findOne','merge','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','setTags','omit','spread','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','Attachment','Messages','direction'];(function(_0x2cb8d5,_0xcf6d66){var _0x42b38f=function(_0x339015){while(--_0x339015){_0x2cb8d5['push'](_0x2cb8d5['shift']());}};_0x42b38f(++_0xcf6d66);}(_0xf062,0x10b));var _0x2f06=function(_0x4dc79b,_0x381a12){_0x4dc79b=_0x4dc79b-0x0;var _0x510fcc=_0xf062[_0x4dc79b];return _0x510fcc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2f06('0x0'));var jsonpatch=require(_0x2f06('0x1'));var rp=require(_0x2f06('0x2'));var moment=require(_0x2f06('0x3'));var BPromise=require(_0x2f06('0x4'));var Mustache=require(_0x2f06('0x5'));var util=require(_0x2f06('0x6'));var path=require(_0x2f06('0x7'));var sox=require(_0x2f06('0x8'));var csv=require(_0x2f06('0x9'));var ejs=require(_0x2f06('0xa'));var fs=require('fs');var fs_extra=require(_0x2f06('0xb'));var _=require(_0x2f06('0xc'));var squel=require(_0x2f06('0xd'));var crypto=require(_0x2f06('0xe'));var jsforce=require(_0x2f06('0xf'));var deskjs=require(_0x2f06('0x10'));var toCsv=require('to-csv');var querystring=require(_0x2f06('0x11'));var Papa=require(_0x2f06('0x12'));var Redis=require(_0x2f06('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x2f06('0x14'));var as=require(_0x2f06('0x15'));var pdf=require(_0x2f06('0x16'));var hardwareService=require(_0x2f06('0x17'));var logger=require(_0x2f06('0x18'))(_0x2f06('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2f06('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x2f06('0x1b')],{'host':_0x2f06('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f06('0x1b')]));require(_0x2f06('0x1d'))[_0x2f06('0x1e')](socket);function respondWithStatusCode(_0x2a0381,_0x36fafb){_0x36fafb=_0x36fafb||0xcc;return function(_0x11febf){if(_0x11febf){return _0x2a0381[_0x2f06('0x1f')](_0x36fafb);}return _0x2a0381[_0x2f06('0x20')](_0x36fafb)[_0x2f06('0x21')]();};}function respondWithResult(_0x4ba85d,_0x56c6e0){_0x56c6e0=_0x56c6e0||0xc8;return function(_0x4c4b9d){if(_0x4c4b9d){return _0x4ba85d[_0x2f06('0x20')](_0x56c6e0)[_0x2f06('0x22')](_0x4c4b9d);}};}function respondWithFilteredResult(_0x4d382d,_0x1db5b2){return function(_0x23d37e){if(_0x23d37e){var _0x1cb13c=typeof _0x1db5b2[_0x2f06('0x23')]===_0x2f06('0x24')&&typeof _0x1db5b2['limit']==='undefined';var _0x477776=_0x23d37e[_0x2f06('0x25')];var _0x2774f5=_0x1cb13c?0x0:_0x1db5b2[_0x2f06('0x23')];var _0x594449=_0x1cb13c?_0x23d37e['count']:_0x1db5b2[_0x2f06('0x23')]+_0x1db5b2['limit'];var _0xd4c6a8;if(_0x594449>=_0x477776){_0x594449=_0x477776;_0xd4c6a8=0xc8;}else{_0xd4c6a8=0xce;}_0x4d382d[_0x2f06('0x20')](_0xd4c6a8);return _0x4d382d['set'](_0x2f06('0x26'),_0x2774f5+'-'+_0x594449+'/'+_0x477776)[_0x2f06('0x22')](_0x23d37e);}return null;};}function patchUpdates(_0x3c2f8c){return function(_0xdc6500){try{jsonpatch[_0x2f06('0x27')](_0xdc6500,_0x3c2f8c,!![]);}catch(_0x5ab4c8){return BPromise[_0x2f06('0x28')](_0x5ab4c8);}return _0xdc6500[_0x2f06('0x29')]();};}function saveUpdates(_0x17a05a,_0x4fd8be){return function(_0xd28ed6){if(_0xd28ed6){return _0xd28ed6[_0x2f06('0x2a')](_0x17a05a)[_0x2f06('0x2b')](function(_0x3582be){return _0x3582be;});}return null;};}function removeEntity(_0x20840f,_0x453bca){return function(_0x52dd24){if(_0x52dd24){return _0x52dd24['destroy']()[_0x2f06('0x2b')](function(){_0x20840f[_0x2f06('0x20')](0xcc)[_0x2f06('0x21')]();});}};}function handleEntityNotFound(_0x1d489e,_0x2a636d){return function(_0x2e5fb9){if(!_0x2e5fb9){_0x1d489e[_0x2f06('0x1f')](0x194);}return _0x2e5fb9;};}function handleError(_0x439639,_0x1681ce){_0x1681ce=_0x1681ce||0x1f4;return function(_0x575cb6){logger['error'](_0x575cb6['stack']);if(_0x575cb6[_0x2f06('0x2c')]){delete _0x575cb6[_0x2f06('0x2c')];}_0x439639['status'](_0x1681ce)['send'](_0x575cb6);};}function getInteractionUsers(_0x20db61,_0x1d2fe8){return new BPromise(function(_0x549d77,_0x5a37fe){try{if(_0x1d2fe8[_0x20db61['id']]){_0x20db61['Users']=_[_0x2f06('0x2d')](_0x1d2fe8[_0x20db61['id']],function(_0x156188){return{'id':_0x156188['id'],'fullname':_0x156188[_0x2f06('0x2e')]};});}}catch(_0x4cda50){_0x5a37fe(_0x4cda50);}_0x549d77(_0x20db61);});}function getInteractionTags(_0x7a3042,_0x1c07e1){return new BPromise(function(_0x41c964,_0x415124){try{if(_0x7a3042['TagIds']){_0x7a3042[_0x2f06('0x2f')]=[];_0x7a3042[_0x2f06('0x30')][_0x2f06('0x31')](',')['forEach'](function(_0x34a85f){_0x7a3042[_0x2f06('0x2f')][_0x2f06('0x32')](_0x1c07e1[_0x34a85f]);});}delete _0x7a3042['TagIds'];}catch(_0x54c7bb){_0x415124(_0x54c7bb);}_0x41c964(_0x7a3042);});}function updateOpenchannelInteraction(_0x4537d2,_0x5c340c,_0x5bc4ed){return new BPromise(function(_0x4b5817,_0x1c4a55){return getInteractionUsers(_0x4537d2,_0x5bc4ed)[_0x2f06('0x2b')](function(_0x4c4029){return getInteractionTags(_0x4c4029,_0x5c340c);})[_0x2f06('0x2b')](function(_0xaedbac){_0x4b5817(_0xaedbac);})[_0x2f06('0x33')](function(_0x22ba85){_0x1c4a55(_0x22ba85);});});}exports[_0x2f06('0x34')]=function(_0x239a90,_0x502410){var _0x56ea5a={},_0xdb4de9={},_0x29bf09={'count':0x0,'rows':[]};var _0x1b2316=_[_0x2f06('0x2d')](db[_0x2f06('0x35')][_0x2f06('0x36')],function(_0x525517){return{'name':_0x525517[_0x2f06('0x37')],'type':_0x525517[_0x2f06('0x38')][_0x2f06('0x39')]};});_0xdb4de9[_0x2f06('0x3a')]=_[_0x2f06('0x2d')](_0x1b2316,_0x2f06('0x2c'));_0xdb4de9[_0x2f06('0x3b')]=_['keys'](_0x239a90[_0x2f06('0x3b')]);_0xdb4de9[_0x2f06('0x3c')]=_[_0x2f06('0x3d')](_0xdb4de9[_0x2f06('0x3a')],_0xdb4de9[_0x2f06('0x3b')]);_0x56ea5a[_0x2f06('0x3e')]=_['intersection'](_0xdb4de9[_0x2f06('0x3a')],qs[_0x2f06('0x3f')](_0x239a90[_0x2f06('0x3b')][_0x2f06('0x3f')]));_0x56ea5a[_0x2f06('0x3e')]=_0x56ea5a[_0x2f06('0x3e')][_0x2f06('0x40')]?_0x56ea5a['attributes']:_0xdb4de9['model'];if(!_0x239a90[_0x2f06('0x3b')][_0x2f06('0x41')](_0x2f06('0x42'))){_0x56ea5a[_0x2f06('0x43')]=qs[_0x2f06('0x43')](_0x239a90['query'][_0x2f06('0x43')]);_0x56ea5a[_0x2f06('0x23')]=qs['offset'](_0x239a90['query'][_0x2f06('0x23')]);}_0x56ea5a[_0x2f06('0x44')]=qs['sort'](_0x239a90[_0x2f06('0x3b')][_0x2f06('0x45')]);_0x56ea5a['where']=qs[_0x2f06('0x3c')](_[_0x2f06('0x46')](_0x239a90[_0x2f06('0x3b')],_0xdb4de9[_0x2f06('0x3c')]),_0x1b2316);var _0x545f45=[];var _0x746300=squel['select']()[_0x2f06('0x47')]('id')[_0x2f06('0x47')](_0x2f06('0x2c'))['field'](_0x2f06('0x48'))['from'](_0x2f06('0x49'));var _0x269b64=squel[_0x2f06('0x4a')]()[_0x2f06('0x47')](_0x2f06('0x4b'))[_0x2f06('0x47')](_0x2f06('0x4c'))[_0x2f06('0x47')](_0x2f06('0x4d'))[_0x2f06('0x4e')]('user_has_openchannel_interactions','ui')[_0x2f06('0x4f')](_0x2f06('0x50'),'u',_0x2f06('0x51'));var _0x3b2428=squel[_0x2f06('0x4a')]()[_0x2f06('0x4e')](_0x2f06('0x52'),'i')[_0x2f06('0x4f')]('cm_contacts','c',_0x2f06('0x53'))[_0x2f06('0x4f')]('users','o',_0x2f06('0x54'))[_0x2f06('0x4f')]('openchannel_accounts','a',_0x2f06('0x55'))[_0x2f06('0x4f')](_0x2f06('0x56'),'me',_0x2f06('0x57'))[_0x2f06('0x4f')](_0x2f06('0x58'),'it',_0x2f06('0x59'))[_0x2f06('0x4f')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x16033b=squel['expr']();var _0x4fe4b4=[];var _0x13a214=squel[_0x2f06('0x5a')]();var _0x2d6822;if(_0x239a90[_0x2f06('0x3b')][_0x2f06('0x5b')]){_0x2d6822=as[_0x2f06('0x5c')](_0x239a90[_0x2f06('0x3b')][_0x2f06('0x5b')]);var _0x4371c7=_0x2d6822[_0x2f06('0x5d')];for(var _0x2f9f75=0x0;_0x2f9f75<_0x2d6822[_0x2f06('0x5e')]['length'];_0x2f9f75++){var _0x18e377=_0x2d6822[_0x2f06('0x5e')][_0x2f9f75];var _0x18ddbd='i';var _0x4f8162=_['find'](_0x1b2316,['name',_0x18e377[_0x2f06('0x47')]]);if(!_0x4f8162){switch(_0x18e377[_0x2f06('0x47')]){case'unreadMessages':if(_0x18e377[_0x2f06('0x5f')]==0x1){_0x3b2428[_0x2f06('0x60')]('`'+_0x18e377[_0x2f06('0x47')]+_0x2f06('0x61'));}else{_0x3b2428['having']('`'+_0x18e377[_0x2f06('0x47')]+_0x2f06('0x62'));}break;case'Contact':if(_0x18e377[_0x2f06('0x63')]===_0x2f06('0x64')){if(_0x18e377['value'][_0x2f06('0x31')]('\x20')[_0x2f06('0x40')]>0x1){_0x16033b[_0x4371c7](_0x2f06('0x65'),qs[_0x2f06('0x66')](_0x18e377[_0x2f06('0x5f')]),null);}else{var _0x12fe0d='%'+_0x18e377[_0x2f06('0x5f')]+'%';_0x16033b[_0x4371c7](_0x2f06('0x67'),_0x12fe0d,_0x12fe0d,_0x12fe0d);}}else{_0x4f8162=_[_0x2f06('0x68')](_0x1b2316,[_0x2f06('0x2c'),_0x2f06('0x69')]);_0x18e377[_0x2f06('0x47')]=_0x2f06('0x69');_0x43ba76=as[_0x2f06('0x6a')](_0x18ddbd,_0x4f8162['type'],_0x18e377);_0x16033b[_0x4371c7](_0x43ba76[_0x2f06('0x6b')],_0x43ba76[_0x2f06('0x5f')][_0x2f06('0x6c')],_0x43ba76[_0x2f06('0x5f')]['end']);}break;case'Tag':var _0x1a2948=_0x18e377[_0x2f06('0x5f')][_0x2f06('0x31')](',')[_0x2f06('0x2d')](function(_0x561171){return Number(_0x561171);});_0x1a2948['forEach'](function(_0x272965){_0x13a214['or'](_0x2f06('0x6d'),'%,'+_0x272965+',%');});_0x4fe4b4=_[_0x2f06('0x6e')](_0x4fe4b4,_0x1a2948);break;case _0x2f06('0x6f'):if(_0x18e377[_0x2f06('0x63')]===_0x2f06('0x64')){_0x16033b[_0x4371c7](_0x2f06('0x70'),'%'+_0x18e377[_0x2f06('0x5f')]+'%',null);}else{_0x4f8162=_[_0x2f06('0x68')](_0x1b2316,[_0x2f06('0x2c'),_0x2f06('0x71')]);_0x18e377['field']=_0x2f06('0x71');_0x43ba76=as[_0x2f06('0x6a')](_0x18ddbd,_0x4f8162[_0x2f06('0x38')],_0x18e377);_0x16033b[_0x4371c7](_0x43ba76[_0x2f06('0x6b')],_0x43ba76[_0x2f06('0x5f')]['start'],_0x43ba76[_0x2f06('0x5f')][_0x2f06('0x21')]);}break;case _0x2f06('0x72'):_0x43ba76=as[_0x2f06('0x6a')]('me',null,_0x18e377);_0x16033b[_0x4371c7](_0x43ba76[_0x2f06('0x6b')],_0x43ba76[_0x2f06('0x5f')][_0x2f06('0x6c')],_0x43ba76[_0x2f06('0x5f')][_0x2f06('0x21')]);break;}}else{var _0x43ba76=as[_0x2f06('0x6a')](_0x18ddbd,_0x4f8162[_0x2f06('0x38')],_0x18e377);_0x16033b[_0x4371c7](_0x43ba76['text'],_0x43ba76[_0x2f06('0x5f')][_0x2f06('0x6c')],_0x43ba76[_0x2f06('0x5f')][_0x2f06('0x21')]);}}}else{var _0x842e97=_(_0x239a90[_0x2f06('0x3b')])['keys']()['map'](function(_0x2da1f7){return _[_0x2f06('0x73')](_0x1b2316,[_0x2f06('0x2c'),_0x2da1f7])?_0x2da1f7:undefined;})[_0x2f06('0x74')]()['value']();if(!_[_0x2f06('0x75')](_0x842e97)){_0x842e97[_0x2f06('0x76')](function(_0x221d28){if(_0x221d28==='OpenchannelAccountId'){_0x3b2428[_0x2f06('0x77')](_0x2f06('0x78'),[][_0x2f06('0x79')](_0x239a90[_0x2f06('0x3b')][_0x221d28]));}else if(_0x221d28===_0x2f06('0x7a')){var _0x23c224=JSON['parse'](_0x239a90[_0x2f06('0x3b')][_0x221d28])[_0x2f06('0x7b')];var _0x559685=JSON[_0x2f06('0x7c')](_0x239a90[_0x2f06('0x3b')][_0x221d28])[_0x2f06('0x7d')];_0x3b2428[_0x2f06('0x77')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x23c224,_0x559685);}else{if(_0x239a90[_0x2f06('0x3b')][_0x221d28]===_0x2f06('0x7e')){_0x3b2428[_0x2f06('0x77')]('i.'+_0x221d28+_0x2f06('0x7f'));}else{_0x3b2428[_0x2f06('0x77')]('i.'+_0x221d28+'\x20=\x20?',_0x239a90[_0x2f06('0x3b')][_0x221d28]);}}});}if(_0x239a90[_0x2f06('0x3b')][_0x2f06('0x80')]){if(_0x239a90[_0x2f06('0x3b')]['read']==0x1){_0x3b2428[_0x2f06('0x60')](_0x2f06('0x81'));}else{_0x3b2428[_0x2f06('0x60')](_0x2f06('0x82'));}}if(_0x239a90[_0x2f06('0x3b')]['tag']){_0x4fe4b4=_[_0x2f06('0x83')](_0x239a90['query']['tag'])?_0x239a90[_0x2f06('0x3b')][_0x2f06('0x84')]:new Array(_0x239a90[_0x2f06('0x3b')][_0x2f06('0x84')]);_0x4fe4b4[_0x2f06('0x76')](function(_0xe1d2d8){_0x13a214['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xe1d2d8+',%');});}if(_0x239a90['query'][_0x2f06('0x85')]){var _0x59a977=_0x239a90[_0x2f06('0x3b')][_0x2f06('0x85')][_0x2f06('0x86')]('\x5c','\x5c\x5c')[_0x2f06('0x86')](/'/g,'\x27\x27');if(qs[_0x2f06('0x87')](_0x59a977)){_0x16033b['or'](_0x2f06('0x88'),_0x59a977+'%');}else{_0x16033b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2f06('0x66')](_0x59a977))['or'](_0x2f06('0x89'),_0x59a977+'%')['or'](_0x2f06('0x8a'),_0x59a977+'%');}}}_0x3b2428['where'](_0x16033b);_0x3b2428[_0x2f06('0x8b')]('i.id');var _0xba37ba={'type':db[_0x2f06('0x8c')][_0x2f06('0x8d')][_0x2f06('0x8e')],'raw':!![]};var _0x2790e5=_0x3b2428[_0x2f06('0x8f')]();_0x2790e5[_0x2f06('0x47')](_0x2f06('0x90'));_0x2790e5[_0x2f06('0x47')](_0x2f06('0x91'),'unreadMessages');if(_0x56ea5a[_0x2f06('0x44')]){_0x56ea5a['order'][_0x2f06('0x76')](function(_0x3f539f){var _0x407128=_0x3f539f[0x0]==='contactName'?_0x3f539f[0x0]:'i.'+_0x3f539f[0x0];_0x3b2428[_0x2f06('0x44')](_0x407128,_0x3f539f[0x1]==='DESC'?![]:!![]);});}if(!_[_0x2f06('0x75')](_0x4fe4b4)){_0x3b2428[_0x2f06('0x60')](_0x13a214);_0x2790e5[_0x2f06('0x77')]('t.id\x20IN\x20?',_0x4fe4b4);}BPromise['resolve']()[_0x2f06('0x2b')](function(){if(!_0x2d6822){if(_0x239a90[_0x2f06('0x3b')][_0x2f06('0x92')])return;_0x2790e5[_0x2f06('0x77')](_0x2f06('0x93'));_0x3b2428[_0x2f06('0x77')](_0x2f06('0x93'));return;}if(_0x239a90['user'][_0x2f06('0x94')]!==_0x2f06('0x95'))return;return _0x239a90[_0x2f06('0x96')][_0x2f06('0x97')]({'attributes':['id'],'raw':!![]})[_0x2f06('0x2b')](function(_0x1d62dc){if(_['isEmpty'](_0x1d62dc)){_0x2790e5[_0x2f06('0x77')](_0x2f06('0x98'));_0x3b2428[_0x2f06('0x77')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x2790e5[_0x2f06('0x77')](_0x2f06('0x78'),_[_0x2f06('0x2d')](_0x1d62dc,'id'));_0x3b2428[_0x2f06('0x77')](_0x2f06('0x78'),_[_0x2f06('0x2d')](_0x1d62dc,'id'));}});})[_0x2f06('0x2b')](function(){if(_0x239a90['user']['role']===_0x2f06('0x95')&&!_0x2d6822&&!_0x239a90[_0x2f06('0x3b')]['OpenchannelAccountId'])return[];return db[_0x2f06('0x99')][_0x2f06('0x3b')](_0x2790e5[_0x2f06('0x9a')](),_0xba37ba);})[_0x2f06('0x2b')](function(_0x47cd41){_0x29bf09[_0x2f06('0x25')]=_0x47cd41[_0x2f06('0x40')];if(_0x29bf09[_0x2f06('0x25')]===0x0)return[];return db[_0x2f06('0x99')][_0x2f06('0x3b')](_0x746300['toString'](),_0xba37ba)['then'](function(_0x56fd4b){_0x545f45=_['keyBy'](_0x56fd4b,'id');_0xba37ba=_['merge'](_0xba37ba,{'model':db[_0x2f06('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x239a90[_0x2f06('0x3b')][_0x2f06('0x3f')]){_0x56ea5a['attributes'][_0x2f06('0x76')](function(_0x28cabb){_0x3b2428[_0x2f06('0x47')]('i.'+_0x28cabb);});}else{_0x3b2428['field'](_0x2f06('0x91'),_0x2f06('0x9b'));_0x3b2428['field'](_0x2f06('0x9c'),_0x2f06('0x9d'));_0x3b2428[_0x2f06('0x47')](_0x2f06('0x9e'),_0x2f06('0x9f'));_0x3b2428[_0x2f06('0x47')](_0x2f06('0xa0'),_0x2f06('0xa1'));_0x3b2428[_0x2f06('0x47')](_0x2f06('0xa2'));_0x3b2428['field'](_0x2f06('0xa3'),_0x2f06('0xa4'));_0x3b2428[_0x2f06('0x47')](_0x2f06('0xa5'),_0x2f06('0xa6'));_0x3b2428[_0x2f06('0x47')](_0x2f06('0xa7'),_0x2f06('0xa8'));_0x3b2428[_0x2f06('0x47')](_0x2f06('0xa9'),_0x2f06('0xaa'));_0x3b2428[_0x2f06('0x47')](_0x2f06('0xab'),'Contact.mobile');_0x3b2428[_0x2f06('0x47')](_0x2f06('0xac'),'Contact.fax');_0x3b2428[_0x2f06('0x47')](_0x2f06('0xad'),'Owner.fullname');_0x3b2428[_0x2f06('0x47')](_0x2f06('0xae'),_0x2f06('0xaf'));_0x3b2428[_0x2f06('0x47')](_0x2f06('0xb0'),_0x2f06('0x30'));}if(_0x56ea5a[_0x2f06('0x43')])_0x3b2428['limit'](_0x56ea5a[_0x2f06('0x43')]);if(_0x56ea5a[_0x2f06('0x23')])_0x3b2428[_0x2f06('0x23')](_0x56ea5a[_0x2f06('0x23')]);return db['sequelize'][_0x2f06('0x3b')](_0x3b2428[_0x2f06('0x9a')](),_0xba37ba);})[_0x2f06('0x2b')](function(_0x125989){if(_0x125989['length']>0x0)_0x269b64[_0x2f06('0x77')](_0x2f06('0xb1'),_['map'](_0x125989,'id'));return db[_0x2f06('0x99')][_0x2f06('0x3b')](_0x269b64[_0x2f06('0x9a')](),_0xba37ba)[_0x2f06('0x2b')](function(_0x2299a8){var _0x5f5c1d=_[_0x2f06('0xb2')](_0x2299a8,_0x2f06('0xb3'));var _0x19018f=[];_0x125989['forEach'](function(_0x46cf3a){_0x19018f[_0x2f06('0x32')](updateOpenchannelInteraction(_0x46cf3a,_0x545f45,_0x5f5c1d));});return BPromise[_0x2f06('0xb4')](_0x19018f);});});})['then'](function(_0x141fea){_0x29bf09[_0x2f06('0xb5')]=_0x141fea;return _0x29bf09;})['then'](respondWithFilteredResult(_0x502410,_0x56ea5a))[_0x2f06('0x33')](handleError(_0x502410,null));};exports[_0x2f06('0xb6')]=function(_0x33f127,_0x20d053){var _0x1af83f={};if(_0x33f127['query'][_0x2f06('0x38')]&&_0x33f127[_0x2f06('0x3b')]['type']===_0x2f06('0x4e')){_0x1af83f['from']=_0x33f127[_0x2f06('0xb7')]['id'];}else{_0x1af83f['id']=_0x33f127[_0x2f06('0xb7')]['id'];}var _0x16fbc4={'raw':![],'where':_0x1af83f},_0x25e9f3={};_0x25e9f3[_0x2f06('0x3a')]=_[_0x2f06('0xb8')](db['OpenchannelInteraction'][_0x2f06('0x36')]);_0x25e9f3[_0x2f06('0x3b')]=_[_0x2f06('0xb8')](_0x33f127[_0x2f06('0x3b')]);_0x25e9f3[_0x2f06('0x3c')]=_['intersection'](_0x25e9f3[_0x2f06('0x3a')],_0x25e9f3[_0x2f06('0x3b')]);_0x16fbc4[_0x2f06('0x3e')]=_['intersection'](_0x25e9f3[_0x2f06('0x3a')],qs[_0x2f06('0x3f')](_0x33f127[_0x2f06('0x3b')][_0x2f06('0x3f')]));_0x16fbc4[_0x2f06('0x3e')]=_0x16fbc4[_0x2f06('0x3e')][_0x2f06('0x40')]?_0x16fbc4[_0x2f06('0x3e')]:_0x25e9f3[_0x2f06('0x3a')];if(_0x33f127[_0x2f06('0x3b')]['includeAll']){_0x16fbc4[_0x2f06('0xb9')]=[{'all':!![]}];}_0x16fbc4=_['merge']({},_0x16fbc4,_0x33f127[_0x2f06('0xba')]);return db[_0x2f06('0x35')][_0x2f06('0x68')](_0x16fbc4)[_0x2f06('0x2b')](handleEntityNotFound(_0x20d053,null))['then'](respondWithResult(_0x20d053,null))[_0x2f06('0x33')](handleError(_0x20d053,null));};exports['create']=function(_0x54fc82,_0x11c39d){return db[_0x2f06('0x35')][_0x2f06('0xbb')](_0x54fc82[_0x2f06('0x72')],{})[_0x2f06('0x2b')](respondWithResult(_0x11c39d,0xc9))[_0x2f06('0x33')](handleError(_0x11c39d,null));};exports[_0x2f06('0x2a')]=function(_0x457311,_0x36b37e){if(_0x457311[_0x2f06('0x72')]['id']){delete _0x457311[_0x2f06('0x72')]['id'];}return db[_0x2f06('0x35')][_0x2f06('0x68')]({'where':{'id':_0x457311[_0x2f06('0xb7')]['id']}})[_0x2f06('0x2b')](handleEntityNotFound(_0x36b37e,null))[_0x2f06('0x2b')](saveUpdates(_0x457311[_0x2f06('0x72')],null))[_0x2f06('0x2b')](respondWithResult(_0x36b37e,null))[_0x2f06('0x33')](handleError(_0x36b37e,null));};exports['destroy']=function(_0x1227bc,_0x50ed96){return db[_0x2f06('0x35')][_0x2f06('0x68')]({'where':{'id':_0x1227bc[_0x2f06('0xb7')]['id']}})[_0x2f06('0x2b')](handleEntityNotFound(_0x50ed96,null))[_0x2f06('0x2b')](removeEntity(_0x50ed96,null))[_0x2f06('0x33')](handleError(_0x50ed96,null));};exports['describe']=function(_0x109ec5,_0x22c9fa){return db[_0x2f06('0x35')][_0x2f06('0xbc')]()[_0x2f06('0x2b')](respondWithResult(_0x22c9fa,null))[_0x2f06('0x33')](handleError(_0x22c9fa,null));};exports[_0x2f06('0xbd')]=function(_0x568d9b,_0xede942,_0x511993){return db[_0x2f06('0xbe')][_0x2f06('0x68')]({'where':{'id':_0x568d9b['params']['id']}})[_0x2f06('0x2b')](handleEntityNotFound(_0xede942,null))['then'](function(_0x512975){if(_0x512975){return _0x512975[_0x2f06('0xbd')](_0x568d9b['body'][_0x2f06('0xbf')],_['omit'](_0x568d9b['body'],[_0x2f06('0xbf'),'id'])||{});}})[_0x2f06('0x2b')](respondWithResult(_0xede942,null))[_0x2f06('0x33')](handleError(_0xede942,null));};exports['getMessages']=function(_0x312bb9,_0x8739c3,_0x1cf712){var _0x5c9652={'raw':![],'where':{}};var _0x413992={};var _0x4bc8b8={'count':0x0,'rows':[]};return db[_0x2f06('0x35')][_0x2f06('0xc0')]({'where':{'id':_0x312bb9[_0x2f06('0xb7')]['id']}})['then'](handleEntityNotFound(_0x8739c3,null))[_0x2f06('0x2b')](function(_0x123205){if(_0x123205){_0x413992[_0x2f06('0x3a')]=_[_0x2f06('0xb8')](db[_0x2f06('0xbe')][_0x2f06('0x36')]);_0x413992['query']=_['keys'](_0x312bb9['query']);_0x413992[_0x2f06('0x3c')]=_[_0x2f06('0x3d')](_0x413992[_0x2f06('0x3a')],_0x413992[_0x2f06('0x3b')]);_0x5c9652[_0x2f06('0x3e')]=_['intersection'](_0x413992[_0x2f06('0x3a')],qs[_0x2f06('0x3f')](_0x312bb9[_0x2f06('0x3b')][_0x2f06('0x3f')]));_0x5c9652[_0x2f06('0x3e')]=_0x5c9652[_0x2f06('0x3e')][_0x2f06('0x40')]?_0x5c9652['attributes']:_0x413992['model'];if(!_0x312bb9[_0x2f06('0x3b')][_0x2f06('0x41')](_0x2f06('0x42'))){_0x5c9652[_0x2f06('0x43')]=qs[_0x2f06('0x43')](_0x312bb9[_0x2f06('0x3b')][_0x2f06('0x43')]);_0x5c9652['offset']=qs[_0x2f06('0x23')](_0x312bb9[_0x2f06('0x3b')][_0x2f06('0x23')]);}_0x5c9652[_0x2f06('0x44')]=qs[_0x2f06('0x45')](_0x312bb9[_0x2f06('0x3b')][_0x2f06('0x45')]);_0x5c9652[_0x2f06('0x77')]=qs[_0x2f06('0x3c')](_['pick'](_0x312bb9[_0x2f06('0x3b')],_0x413992[_0x2f06('0x3c')]));_0x5c9652[_0x2f06('0x77')][_0x2f06('0xb3')]=_0x123205['id'];if(_0x312bb9[_0x2f06('0x3b')]['filter']){_0x5c9652['where']=_[_0x2f06('0xc1')](_0x5c9652[_0x2f06('0x77')],{'$or':_['map'](_0x5c9652[_0x2f06('0x3e')],function(_0x2b6c85){var _0x1e7c55={};_0x1e7c55[_0x2b6c85]={'$like':'%'+_0x312bb9[_0x2f06('0x3b')][_0x2f06('0x85')]+'%'};return _0x1e7c55;})});}if(_0x312bb9[_0x2f06('0x3b')][_0x2f06('0x7b')]){var _0x14f27f=_0x312bb9['query'][_0x2f06('0x7b')][_0x2f06('0x31')](',');var _0x752d80={};_0x752d80[_0x14f27f[0x0]]={'$gte':moment(_0x14f27f[0x1])['format'](_0x2f06('0xc2'))};_0x5c9652[_0x2f06('0x77')]=_[_0x2f06('0xc1')](_0x5c9652[_0x2f06('0x77')],_0x752d80);}_0x5c9652=_[_0x2f06('0xc1')]({},_0x5c9652,_0x312bb9['options']);return db[_0x2f06('0xbe')][_0x2f06('0x25')]({'where':_0x5c9652['where']})['then'](function(_0x13ee56){_0x4bc8b8[_0x2f06('0x25')]=_0x13ee56;if(_0x312bb9[_0x2f06('0x3b')][_0x2f06('0xc3')]){_0x5c9652[_0x2f06('0xb9')]=[{'all':!![]}];}return db[_0x2f06('0xbe')]['findAll'](_0x5c9652);})[_0x2f06('0x2b')](function(_0x9ce0b4){_0x4bc8b8[_0x2f06('0xb5')]=_0x9ce0b4;return _0x4bc8b8;});}})[_0x2f06('0x2b')](respondWithFilteredResult(_0x8739c3,_0x5c9652))[_0x2f06('0x33')](handleError(_0x8739c3,null));};exports[_0x2f06('0xc4')]=function(_0x35b3bd,_0x48d143,_0x1b966d){return db[_0x2f06('0x35')][_0x2f06('0x68')]({'where':{'id':_0x35b3bd[_0x2f06('0xb7')]['id']}})[_0x2f06('0x2b')](handleEntityNotFound(_0x48d143,null))[_0x2f06('0x2b')](function(_0x330b0e){if(_0x330b0e){return _0x330b0e[_0x2f06('0xc5')](_0x35b3bd['body'][_0x2f06('0xbf')],_[_0x2f06('0xc6')](_0x35b3bd['body'],[_0x2f06('0xbf'),'id'])||{})[_0x2f06('0xc7')](function(){return db['Tag'][_0x2f06('0xc8')]({'attributes':['id',_0x2f06('0x2c'),_0x2f06('0x48')],'where':{'id':_0x35b3bd['body']['ids']}});})[_0x2f06('0x2b')](function(_0x50c362){socket[_0x2f06('0xc9')](_0x2f06('0xca'),{'id':Number(_0x35b3bd['params']['id']),'tags':_0x50c362||[]});return{'id':Number(_0x35b3bd[_0x2f06('0xb7')]['id']),'tags':_0x50c362||[]};});}})[_0x2f06('0x2b')](respondWithResult(_0x48d143,null))[_0x2f06('0x33')](handleError(_0x48d143,null));};exports[_0x2f06('0xcb')]=function(_0x2bef30,_0x860c6b,_0x339d90){return db[_0x2f06('0x35')]['find']({'where':{'id':_0x2bef30[_0x2f06('0xb7')]['id']}})[_0x2f06('0x2b')](handleEntityNotFound(_0x860c6b,null))[_0x2f06('0x2b')](function(_0x24a420){if(_0x24a420){return _0x24a420['removeTags'](_0x2bef30[_0x2f06('0x3b')][_0x2f06('0xbf')]);}})[_0x2f06('0x2b')](respondWithStatusCode(_0x860c6b,null))['catch'](handleError(_0x860c6b,null));};exports[_0x2f06('0xcc')]=function(_0x2ce0c4,_0x2c7372){var _0x46e9c4=moment()[_0x2f06('0xcd')]()[_0x2f06('0x9a')]();var _0xdf4a0=path[_0x2f06('0xce')](config[_0x2f06('0xcf')],_0x2f06('0xd0'),_0x2f06('0xd1'),_0x2f06('0xd2'));var _0x20d630=path['join'](config[_0x2f06('0xcf')],_0x2f06('0xd0'),_0x2f06('0xd1'),_0x2f06('0xd3'));var _0x635861=path[_0x2f06('0xce')](_0xdf4a0,_0x46e9c4);var _0x12d784=util[_0x2f06('0xd4')](_0x2f06('0xd5'),_0x2ce0c4['params']['id'],_0x46e9c4);var _0x236369=path['join'](_0xdf4a0,_0x12d784);var _0x5a9d1a=[];_0x5a9d1a['push']({'model':db['User'],'as':'User','attributes':['id',_0x2f06('0x2e')],'raw':!![]});_0x5a9d1a[_0x2f06('0x32')]({'model':db[_0x2f06('0xd6')],'as':_0x2f06('0xd7'),'attributes':['id',_0x2f06('0xd8'),_0x2f06('0xd9')],'raw':!![]});if(_0x2ce0c4['query']['attachments']){_0x5a9d1a[_0x2f06('0x32')]({'model':db[_0x2f06('0xda')],'as':_0x2f06('0xda'),'raw':!![]});}var _0x2c3a3a=[{'model':db['OpenchannelMessage'],'as':_0x2f06('0xdb'),'attributes':['id',_0x2f06('0x72'),_0x2f06('0x7a'),_0x2f06('0xdc'),_0x2f06('0xdd'),_0x2f06('0x80')],'include':_0x5a9d1a}];_0x2c3a3a['push']({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id',_0x2f06('0x2c')]});_0x2c3a3a[_0x2f06('0x32')]({'model':db['User'],'as':_0x2f06('0xde'),'attributes':['id',_0x2f06('0x2e')]});return db['OpenchannelInteraction'][_0x2f06('0x68')]({'where':{'id':_0x2ce0c4[_0x2f06('0xb7')]['id']},'include':_0x2c3a3a})['then'](handleEntityNotFound(_0x2c7372,null))['then'](function(_0x58c829){if(_0x58c829){var _0x102caa=_0x58c829[_0x2f06('0xdf')]({'plain':!![]});fs[_0x2f06('0xe0')](_0x635861);var _0x246d6b={'channel':_0x2f06('0xe1'),'account':_0x102caa['Account'][_0x2f06('0x2c')],'agent':_0x102caa['Owner']?_0x102caa[_0x2f06('0xde')][_0x2f06('0x2e')]:_0x2f06('0xe2'),'createdAt':moment(_0x102caa[_0x2f06('0x7a')])[_0x2f06('0xd4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2f06('0x9a')](),'closedAt':_0x102caa[_0x2f06('0xe3')]?moment(_0x102caa['closedAt'])[_0x2f06('0xd4')](_0x2f06('0xc2'))[_0x2f06('0x9a')]():'','disposition':_0x102caa[_0x2f06('0xe4')],'visibility':_0x102caa['threadId']?'Public':_0x2f06('0xe5'),'messages':_(_0x102caa['Messages'])[_0x2f06('0x85')]({'secret':![]})['map'](function(_0x54b25b){if(_0x54b25b[_0x2f06('0xda')]){var _0x590460=path['join'](_0x20d630,_0x54b25b[_0x2f06('0xda')][_0x2f06('0xe6')]);if(fs[_0x2f06('0xe7')](_0x590460)){fs[_0x2f06('0xe8')](_0x590460)[_0x2f06('0xe9')](fs[_0x2f06('0xea')](path['join'](_0x635861,_0x54b25b[_0x2f06('0xda')][_0x2f06('0xe6')])));}}return{'date':moment(_0x54b25b[_0x2f06('0x7a')])['format'](_0x2f06('0xc2'))[_0x2f06('0x9a')](),'sender':_0x54b25b[_0x2f06('0xdc')]===_0x2f06('0xeb')?_0x54b25b[_0x2f06('0x6f')]?_0x54b25b[_0x2f06('0x6f')][_0x2f06('0x2e')]:_0x2f06('0xec'):_0x54b25b[_0x2f06('0xd7')]['firstName']+(_0x54b25b[_0x2f06('0xd7')][_0x2f06('0xd9')]?'\x20'+_0x54b25b['Contact'][_0x2f06('0xd9')]:''),'body':_0x54b25b[_0x2f06('0xda')]?_0x54b25b[_0x2f06('0xda')][_0x2f06('0xe6')]:_0x54b25b['body'],'direction':_0x54b25b[_0x2f06('0xdc')]==='out'?'A':'C','secret':_0x54b25b[_0x2f06('0xdd')],'read':_0x54b25b[_0x2f06('0x80')],'attachment':_0x54b25b[_0x2f06('0xda')]};})['value']()};return ejs[_0x2f06('0xed')](path[_0x2f06('0xce')](config[_0x2f06('0xcf')],_0x2f06('0xd0'),_0x2f06('0xee'),'downloadInteraction.ejs'),{'interaction':_0x246d6b})[_0x2f06('0x2b')](function(_0x169fb0){var _0x3d5a03=path[_0x2f06('0xce')](_0x635861,'transcript-'+_0x102caa['id']+'-'+_0x46e9c4+_0x2f06('0xef'));var _0xc963ec={'path':_0x3d5a03,'channel':_0x2f06('0xe1'),'interactionId':_0x102caa['id']};return pdf[_0x2f06('0xf0')](_0x169fb0,_0xc963ec);})['then'](function(){return new BPromise(function(_0x3c5f84,_0x2e3c8d){zipdir(_0x635861,{'saveTo':_0x236369},function(_0x5b88cf,_0x32d147){if(_0x5b88cf)return _0x2e3c8d(_0x5b88cf);return _0x3c5f84(_0x32d147);});})[_0x2f06('0x2b')](function(){return new BPromise(function(_0x14b794,_0x2906d6){rimraf(_0x635861,function(_0x1c5564){if(_0x1c5564)_0x2906d6(_0x1c5564);return _0x14b794();});});})[_0x2f06('0x2b')](function(){return _0x2c7372[_0x2f06('0xcc')](_0x236369,_0x12d784,function(_0xffeb09){if(_0xffeb09){console[_0x2f06('0xf1')](_0x2f06('0xf2'),_0xffeb09);}else{fs[_0x2f06('0xf3')](_0x236369);}});});});}else{return _0x2c7372[_0x2f06('0x1f')](0xc8);}})[_0x2f06('0x33')](handleError(_0x2c7372,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 4dbc1cb..223271b 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 _0xa462=['catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit'];(function(_0x1993d6,_0x2d7ddf){var _0x52f0f7=function(_0x308d60){while(--_0x308d60){_0x1993d6['push'](_0x1993d6['shift']());}};_0x52f0f7(++_0x2d7ddf);}(_0xa462,0xee));var _0x2a46=function(_0xf5954f,_0x20d880){_0xf5954f=_0xf5954f-0x0;var _0x5eae29=_0xa462[_0xf5954f];return _0x5eae29;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x2a46('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db'][_0x2a46('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x2a46('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2a46('0x3'),'afterDestroy':_0x2a46('0x4')};function emitEvent(_0x4e6d97){return function(_0x41c83c,_0x3fc707,_0x11f91c){_0x41c83c[_0x2a46('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x6ec2b4){_0x41c83c[_0x2a46('0x6')](_0x2a46('0x7'),_0x6ec2b4[_0x2a46('0x8')](function(_0x281a55){return{'id':_0x281a55['id']};}));return OpenchannelMessage[_0x2a46('0x9')]({'where':{'OpenchannelInteractionId':_0x41c83c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2a46('0xa')](function(_0x2d4151){_0x41c83c[_0x2a46('0x6')](_0x2a46('0xb'),_0x2d4151[_0x2a46('0xc')]);OpenchannelInteractionEvents[_0x2a46('0xd')](_0x4e6d97+':'+_0x41c83c['id'],_0x41c83c);OpenchannelInteractionEvents[_0x2a46('0xd')](_0x4e6d97,_0x41c83c);_0x11f91c(null);})[_0x2a46('0xe')](_0x11f91c(null));};}for(var e in events){if(events[_0x2a46('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x2a46('0x10')](e,emitEvent(event));}}module[_0x2a46('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x1eb4=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','setMaxListeners','update','remove','then','map','findAll'];(function(_0x536adc,_0x9f2dce){var _0x27e9a8=function(_0xbb1a95){while(--_0xbb1a95){_0x536adc['push'](_0x536adc['shift']());}};_0x27e9a8(++_0x9f2dce);}(_0x1eb4,0x1b8));var _0x41eb=function(_0x3f3de7,_0x47a4b7){_0x3f3de7=_0x3f3de7-0x0;var _0x909532=_0x1eb4[_0x3f3de7];return _0x909532;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x41eb('0x0'))['db'][_0x41eb('0x1')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x41eb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x41eb('0x3'),'afterDestroy':_0x41eb('0x4')};function emitEvent(_0x453b41){return function(_0x4ee01b,_0x30e400,_0x3ad98c){_0x4ee01b['getUsers']({'attributes':['id'],'raw':!![]})[_0x41eb('0x5')](function(_0x226086){_0x4ee01b['setDataValue']('Users',_0x226086[_0x41eb('0x6')](function(_0x36b261){return{'id':_0x36b261['id']};}));return OpenchannelMessage[_0x41eb('0x7')]({'where':{'OpenchannelInteractionId':_0x4ee01b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x41eb('0x5')](function(_0x13c4ae){_0x4ee01b[_0x41eb('0x8')](_0x41eb('0x9'),_0x13c4ae[_0x41eb('0xa')]);OpenchannelInteractionEvents['emit'](_0x453b41+':'+_0x4ee01b['id'],_0x4ee01b);OpenchannelInteractionEvents[_0x41eb('0xb')](_0x453b41,_0x4ee01b);_0x3ad98c(null);})[_0x41eb('0xc')](_0x3ad98c(null));};}for(var e in events){if(events[_0x41eb('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x41eb('0xe')](e,emitEvent(event));}}module[_0x41eb('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 8b5798e..be5f2db 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 _0x2bb5=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','lodash','util','../../config/logger'];(function(_0x80d733,_0x266211){var _0x435868=function(_0x2ae0f0){while(--_0x2ae0f0){_0x80d733['push'](_0x80d733['shift']());}};_0x435868(++_0x266211);}(_0x2bb5,0x153));var _0x52bb=function(_0x3caeb5,_0x219363){_0x3caeb5=_0x3caeb5-0x0;var _0x5eca7e=_0x2bb5[_0x3caeb5];return _0x5eca7e;};'use strict';var _=require(_0x52bb('0x0'));var util=require(_0x52bb('0x1'));var logger=require(_0x52bb('0x2'))(_0x52bb('0x3'));var moment=require(_0x52bb('0x4'));var BPromise=require(_0x52bb('0x5'));var rp=require(_0x52bb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52bb('0x7'));var config=require(_0x52bb('0x8'));var attributes=require(_0x52bb('0x9'));module[_0x52bb('0xa')]=function(_0x52d1d5,_0xdd20cc){return _0x52d1d5['define']('OpenchannelInteraction',attributes,{'tableName':_0x52bb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x52bb('0xc'),'collate':_0x52bb('0xd'),'hooks':{'beforeUpdate':function(_0x4614e8,_0x4c9487,_0x271641){if(_0x4614e8[_0x52bb('0xe')](_0x52bb('0xf'))){_0x4614e8[_0x52bb('0x10')]=moment()[_0x52bb('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x271641(null,_0x4614e8);}}});}; \ No newline at end of file +var _0x42f0=['rimraf','./openchannelInteraction.attributes','exports','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','path'];(function(_0x2b9aec,_0x5b6f17){var _0x2570e6=function(_0x56ce1d){while(--_0x56ce1d){_0x2b9aec['push'](_0x2b9aec['shift']());}};_0x2570e6(++_0x5b6f17);}(_0x42f0,0xdb));var _0x042f=function(_0x43888e,_0x3d4898){_0x43888e=_0x43888e-0x0;var _0x5bd218=_0x42f0[_0x43888e];return _0x5bd218;};'use strict';var _=require('lodash');var util=require(_0x042f('0x0'));var logger=require(_0x042f('0x1'))('api');var moment=require(_0x042f('0x2'));var BPromise=require(_0x042f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x042f('0x4'));var rimraf=require(_0x042f('0x5'));var config=require('../../config/environment');var attributes=require(_0x042f('0x6'));module[_0x042f('0x7')]=function(_0x27d2da,_0x295819){return _0x27d2da['define']('OpenchannelInteraction',attributes,{'tableName':_0x042f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x042f('0x9'),'hooks':{'beforeUpdate':function(_0x40af5b,_0x16f5f4,_0x1970f0){if(_0x40af5b[_0x042f('0xa')](_0x042f('0xb'))){_0x40af5b[_0x042f('0xc')]=moment()['format'](_0x042f('0xd'));}_0x1970f0(null,_0x40af5b);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 6e37973..c725529 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 _0x7ab1=['omit','body','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','socket.io-emitter','request','then','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','attributes','limit','stringify','AddTagsToOpenchannelInteraction','find','where','addTags','ids'];(function(_0x13175d,_0xbb79c4){var _0xe6f0ee=function(_0x38d03b){while(--_0x38d03b){_0x13175d['push'](_0x13175d['shift']());}};_0xe6f0ee(++_0xbb79c4);}(_0x7ab1,0xa8));var _0x17ab=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x7ab1[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x17ab('0x0'));var util=require(_0x17ab('0x1'));var moment=require(_0x17ab('0x2'));var BPromise=require(_0x17ab('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x17ab('0x4'));var db=require(_0x17ab('0x5'))['db'];var utils=require(_0x17ab('0x6'));var logger=require(_0x17ab('0x7'))(_0x17ab('0x8'));var config=require(_0x17ab('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x17ab('0xa')][_0x17ab('0xb')]({'port':0x232a});config[_0x17ab('0xc')]=_['defaults'](config[_0x17ab('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x17ab('0xd'))(new Redis(config[_0x17ab('0xc')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x4bcdf8,_0x547d50,_0x1cb7f7){return new BPromise(function(_0x352e99,_0x55e01b){return client[_0x17ab('0xe')](_0x4bcdf8,_0x1cb7f7)[_0x17ab('0xf')](function(_0x2a9f92){logger['info'](_0x17ab('0x10'),_0x547d50,'request\x20sent');logger[_0x17ab('0x11')](_0x17ab('0x12'),_0x547d50,_0x17ab('0x13'),JSON['stringify'](_0x2a9f92));if(_0x2a9f92[_0x17ab('0x14')]){if(_0x2a9f92['error']['code']===0x1f4){logger['error'](_0x17ab('0x10'),_0x547d50,_0x2a9f92[_0x17ab('0x14')][_0x17ab('0x15')]);return _0x55e01b(_0x2a9f92['error'][_0x17ab('0x15')]);}logger['error'](_0x17ab('0x10'),_0x547d50,_0x2a9f92[_0x17ab('0x14')][_0x17ab('0x15')]);return _0x352e99(_0x2a9f92['error'][_0x17ab('0x15')]);}else{logger[_0x17ab('0x16')](_0x17ab('0x10'),_0x547d50,_0x17ab('0x13'));_0x352e99(_0x2a9f92[_0x17ab('0x17')]['message']);}})[_0x17ab('0x18')](function(_0x6ba6b0){logger[_0x17ab('0x14')](_0x17ab('0x10'),_0x547d50,_0x6ba6b0);_0x55e01b(_0x6ba6b0);});});}exports[_0x17ab('0x19')]=function(_0x345b82){var _0x32cbcd=this;return new Promise(function(_0x2578cc,_0xc66e2f){return db[_0x17ab('0x1a')][_0x17ab('0x1b')](_0x345b82['body'],{'raw':_0x345b82['options']?_0x345b82[_0x17ab('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x345b82[_0x17ab('0x1c')]?_0x345b82[_0x17ab('0x1c')]['where']||null:null,'attributes':_0x345b82['options']?_0x345b82['options'][_0x17ab('0x1d')]||null:null,'limit':_0x345b82[_0x17ab('0x1c')]?_0x345b82[_0x17ab('0x1c')][_0x17ab('0x1e')]||null:null})[_0x17ab('0xf')](function(_0x553fc6){logger['info']('UpdateOpenchannelInteraction',_0x345b82);logger[_0x17ab('0x11')](_0x17ab('0x19'),_0x345b82,JSON[_0x17ab('0x1f')](_0x553fc6));_0x2578cc(_0x553fc6);})[_0x17ab('0x18')](function(_0xd0809e){logger[_0x17ab('0x14')](_0x17ab('0x19'),_0xd0809e[_0x17ab('0x15')],_0x345b82);_0xc66e2f(_0x32cbcd[_0x17ab('0x14')](0x1f4,_0xd0809e['message']));});});};exports[_0x17ab('0x20')]=function(_0x3e2d12){return new Promise(function(_0x5bcc1a,_0x3b2dc0){return db[_0x17ab('0x1a')][_0x17ab('0x21')]({'where':_0x3e2d12[_0x17ab('0x1c')]?_0x3e2d12[_0x17ab('0x1c')][_0x17ab('0x22')]||null:null})['then'](function(_0x98ea9e){if(_0x98ea9e){return _0x98ea9e[_0x17ab('0x23')](_0x3e2d12['body'][_0x17ab('0x24')],_[_0x17ab('0x25')](_0x3e2d12[_0x17ab('0x26')],['ids','id'])||{});}})[_0x17ab('0x27')](function(_0x258f1c){logger[_0x17ab('0x16')](_0x17ab('0x28'),_0x3e2d12);logger[_0x17ab('0x11')]('AddTags',_0x3e2d12,JSON[_0x17ab('0x1f')](_0x258f1c));_0x5bcc1a(_0x258f1c);})[_0x17ab('0x18')](function(_0x49b74d){logger[_0x17ab('0x14')](_0x17ab('0x28'),_0x49b74d[_0x17ab('0x15')],_0x3e2d12);_0x3b2dc0(_this[_0x17ab('0x14')](0x1f4,_0x49b74d[_0x17ab('0x15')]));});});}; \ No newline at end of file +var _0x4345=['error','code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','raw','options','where','limit','find','addTags','body','ids','AddTags','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x53c52d,_0x567e49){var _0x42a962=function(_0x17f295){while(--_0x17f295){_0x53c52d['push'](_0x53c52d['shift']());}};_0x42a962(++_0x567e49);}(_0x4345,0xe9));var _0x5434=function(_0x163095,_0x1b26ba){_0x163095=_0x163095-0x0;var _0x11ae45=_0x4345[_0x163095];return _0x11ae45;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5434('0x0'));var BPromise=require(_0x5434('0x1'));var rs=require(_0x5434('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5434('0x3'))['db'];var utils=require(_0x5434('0x4'));var logger=require(_0x5434('0x5'))('rpc');var config=require(_0x5434('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5434('0x7')][_0x5434('0x8')]({'port':0x232a});config[_0x5434('0x9')]=_[_0x5434('0xa')](config[_0x5434('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x5434('0xb'))(new Redis(config[_0x5434('0x9')]));require('./openchannelInteraction.socket')[_0x5434('0xc')](socket);function respondWithRpcPromise(_0x2d7fba,_0x4d19d1,_0x4d01f9){return new BPromise(function(_0x3aa30b,_0x578ae4){return client[_0x5434('0xd')](_0x2d7fba,_0x4d01f9)[_0x5434('0xe')](function(_0x36964b){logger[_0x5434('0xf')](_0x5434('0x10'),_0x4d19d1,_0x5434('0x11'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x4d19d1,_0x5434('0x11'),JSON[_0x5434('0x12')](_0x36964b));if(_0x36964b[_0x5434('0x13')]){if(_0x36964b['error'][_0x5434('0x14')]===0x1f4){logger[_0x5434('0x13')](_0x5434('0x10'),_0x4d19d1,_0x36964b['error'][_0x5434('0x15')]);return _0x578ae4(_0x36964b[_0x5434('0x13')][_0x5434('0x15')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4d19d1,_0x36964b[_0x5434('0x13')][_0x5434('0x15')]);return _0x3aa30b(_0x36964b['error'][_0x5434('0x15')]);}else{logger[_0x5434('0xf')](_0x5434('0x10'),_0x4d19d1,'request\x20sent');_0x3aa30b(_0x36964b[_0x5434('0x16')]['message']);}})[_0x5434('0x17')](function(_0x5770e8){logger[_0x5434('0x13')](_0x5434('0x10'),_0x4d19d1,_0x5770e8);_0x578ae4(_0x5770e8);});});}exports[_0x5434('0x18')]=function(_0x3cd2a5){var _0x25b301=this;return new Promise(function(_0x186201,_0xb787ec){return db[_0x5434('0x19')][_0x5434('0x1a')](_0x3cd2a5['body'],{'raw':_0x3cd2a5['options']?_0x3cd2a5['options'][_0x5434('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cd2a5['options']?_0x3cd2a5[_0x5434('0x1c')][_0x5434('0x1d')]||null:null,'attributes':_0x3cd2a5[_0x5434('0x1c')]?_0x3cd2a5['options']['attributes']||null:null,'limit':_0x3cd2a5[_0x5434('0x1c')]?_0x3cd2a5['options'][_0x5434('0x1e')]||null:null})[_0x5434('0xe')](function(_0x1ec47c){logger[_0x5434('0xf')](_0x5434('0x18'),_0x3cd2a5);logger['debug'](_0x5434('0x18'),_0x3cd2a5,JSON['stringify'](_0x1ec47c));_0x186201(_0x1ec47c);})[_0x5434('0x17')](function(_0x51b6e6){logger[_0x5434('0x13')](_0x5434('0x18'),_0x51b6e6['message'],_0x3cd2a5);_0xb787ec(_0x25b301[_0x5434('0x13')](0x1f4,_0x51b6e6[_0x5434('0x15')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x28283e){return new Promise(function(_0x1d4a8e,_0x2979a3){return db[_0x5434('0x19')][_0x5434('0x1f')]({'where':_0x28283e[_0x5434('0x1c')]?_0x28283e['options']['where']||null:null})['then'](function(_0x3b758e){if(_0x3b758e){return _0x3b758e[_0x5434('0x20')](_0x28283e[_0x5434('0x21')][_0x5434('0x22')],_['omit'](_0x28283e[_0x5434('0x21')],[_0x5434('0x22'),'id'])||{});}})['spread'](function(_0x5da881){logger[_0x5434('0xf')]('AddTags',_0x28283e);logger['debug'](_0x5434('0x23'),_0x28283e,JSON[_0x5434('0x12')](_0x5da881));_0x1d4a8e(_0x5da881);})[_0x5434('0x17')](function(_0x481438){logger[_0x5434('0x13')](_0x5434('0x23'),_0x481438[_0x5434('0x15')],_0x28283e);_0x2979a3(_this[_0x5434('0x13')](0x1f4,_0x481438[_0x5434('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index cab1d6f..bc0bb18 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 _0x8eae=['update','length','remove'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x8eae,0x128));var _0xe8ea=function(_0x467488,_0x38c7ae){_0x467488=_0x467488-0x0;var _0x56107f=_0x8eae[_0x467488];return _0x56107f;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0xe8ea('0x0'),_0xe8ea('0x1')];function createListener(_0x239c3c,_0x28c3c9){return function(_0x39ee49){_0x28c3c9['emit'](_0x239c3c,_0x39ee49);};}function removeListener(_0x5d6b3d,_0x5e437f){return function(){OpenchannelInteractionEvents['removeListener'](_0x5d6b3d,_0x5e437f);};}exports['register']=function(_0x30c29c){for(var _0x4ffb61=0x0,_0x586ed0=events[_0xe8ea('0x2')];_0x4ffb61<_0x586ed0;_0x4ffb61++){var _0x3a07a7=events[_0x4ffb61];var _0x2fe1fa=createListener('openchannelInteraction:'+_0x3a07a7,_0x30c29c);OpenchannelInteractionEvents['on'](_0x3a07a7,_0x2fe1fa);}}; \ No newline at end of file +var _0x5df8=['save','remove','update','emit','removeListener','register','length','openchannelInteraction:'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0x5df8,0x78));var _0x85df=function(_0x318f2f,_0x16238d){_0x318f2f=_0x318f2f-0x0;var _0x38b707=_0x5df8[_0x318f2f];return _0x38b707;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x85df('0x0'),_0x85df('0x1'),_0x85df('0x2')];function createListener(_0xf6b268,_0x11a63b){return function(_0x93f235){_0x11a63b[_0x85df('0x3')](_0xf6b268,_0x93f235);};}function removeListener(_0x2db842,_0xb63420){return function(){OpenchannelInteractionEvents[_0x85df('0x4')](_0x2db842,_0xb63420);};}exports[_0x85df('0x5')]=function(_0x25e49e){for(var _0x3575f1=0x0,_0x377294=events[_0x85df('0x6')];_0x3575f1<_0x377294;_0x3575f1++){var _0x4559fc=events[_0x3575f1];var _0x4c995d=createListener(_0x85df('0x7')+_0x4559fc,_0x25e49e);OpenchannelInteractionEvents['on'](_0x4559fc,_0x4c995d);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 3bb00c6..0d657ed 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x42f687,_0x558724){var _0x108838=function(_0x725814){while(--_0x725814){_0x42f687['push'](_0x42f687['shift']());}};_0x108838(++_0x558724);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x4191af,_0x5783da){var _0x27bebf=function(_0x355be7){while(--_0x355be7){_0x4191af['push'](_0x4191af['shift']());}};_0x27bebf(++_0x5783da);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x49cb71,_0x2f0149){_0x49cb71=_0x49cb71-0x0;var _0x3a50fd=_0xcb91[_0x49cb71];return _0x3a50fd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 62b3ff4..1425540 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 _0xee4e=['DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x194656,_0x4f984e){var _0x3a5d4a=function(_0x36111f){while(--_0x36111f){_0x194656['push'](_0x194656['shift']());}};_0x3a5d4a(++_0x4f984e);}(_0xee4e,0x122));var _0xeee4=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xee4e[_0x5f0089];return _0x193892;};'use strict';var Sequelize=require(_0xeee4('0x0'));module[_0xeee4('0x1')]={'body':{'type':Sequelize[_0xeee4('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xeee4('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xeee4('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xeee4('0x4')]('in',_0xeee4('0x5')),'defaultValue':_0xeee4('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xeee4('0x6')]},'providerName':{'type':Sequelize[_0xeee4('0x7')]},'providerResponse':{'type':Sequelize[_0xeee4('0x2')]}}; \ No newline at end of file +var _0xb98e=['out','DATE','STRING','sequelize','exports','BOOLEAN','ENUM'];(function(_0x1c1807,_0x18aa22){var _0x15b5f0=function(_0x5ea007){while(--_0x5ea007){_0x1c1807['push'](_0x1c1807['shift']());}};_0x15b5f0(++_0x18aa22);}(_0xb98e,0x184));var _0xeb98=function(_0x513ddb,_0x522c01){_0x513ddb=_0x513ddb-0x0;var _0x25929a=_0xb98e[_0x513ddb];return _0x25929a;};'use strict';var Sequelize=require(_0xeb98('0x0'));module[_0xeb98('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xeb98('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xeb98('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xeb98('0x3')]('in','out'),'defaultValue':_0xeb98('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xeb98('0x5')]},'providerName':{'type':Sequelize[_0xeb98('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 03f3474..eb8c647 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 _0xebc8=['QueryTypes','SELECT','User','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','openchannel-interactions','get','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','contact','motionChannel','rejectmessage','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','jayson/promise','client','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','type','VIRTUAL','options','includeAll','include','findAll','params','merge','find','create','body','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteraction','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize'];(function(_0x4c06ac,_0x568788){var _0x2333cb=function(_0xdb5c64){while(--_0xdb5c64){_0x4c06ac['push'](_0x4c06ac['shift']());}};_0x2333cb(++_0x568788);}(_0xebc8,0x94));var _0x8ebc=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xebc8[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ebc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ebc('0x1'));var rp=require(_0x8ebc('0x2'));var moment=require(_0x8ebc('0x3'));var BPromise=require(_0x8ebc('0x4'));var Mustache=require(_0x8ebc('0x5'));var util=require(_0x8ebc('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x8ebc('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ebc('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8ebc('0x9'));var deskjs=require(_0x8ebc('0xa'));var toCsv=require(_0x8ebc('0x7'));var querystring=require(_0x8ebc('0xb'));var Papa=require(_0x8ebc('0xc'));var Redis=require(_0x8ebc('0xd'));var authService=require(_0x8ebc('0xe'));var qs=require(_0x8ebc('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8ebc('0x10'));var logger=require(_0x8ebc('0x11'))('api');var utils=require(_0x8ebc('0x12'));var config=require(_0x8ebc('0x13'));var licenseUtil=require(_0x8ebc('0x14'));var db=require('../../mysqldb')['db'];config[_0x8ebc('0x15')]=_['defaults'](config['redis'],{'host':_0x8ebc('0x16'),'port':0x18eb});var socket=require(_0x8ebc('0x17'))(new Redis(config[_0x8ebc('0x15')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x8ebc('0x18'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x8ebc('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x162084,_0x23222d,_0x420eb3,_0x5efcef){return new BPromise(function(_0x57051f,_0x3e634d){var _0x24100e=_0x5efcef||client;return _0x24100e[_0x8ebc('0x1a')](_0x162084,_0x420eb3)[_0x8ebc('0x1b')](function(_0x485b90){logger['info'](_0x8ebc('0x1c'),_0x23222d,_0x8ebc('0x1d'));logger['debug'](_0x8ebc('0x1e'),_0x23222d,'request\x20sent',JSON[_0x8ebc('0x1f')](_0x485b90));if(_0x485b90[_0x8ebc('0x20')]){if(_0x485b90[_0x8ebc('0x20')][_0x8ebc('0x21')]===0x1f4){logger[_0x8ebc('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x23222d,_0x485b90[_0x8ebc('0x20')]['message']);return _0x3e634d(_0x485b90[_0x8ebc('0x20')][_0x8ebc('0x22')]);}logger[_0x8ebc('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0x23222d,_0x485b90[_0x8ebc('0x20')][_0x8ebc('0x22')]);return _0x57051f(_0x485b90[_0x8ebc('0x20')][_0x8ebc('0x22')]);}else{logger[_0x8ebc('0x23')](_0x8ebc('0x1c'),_0x23222d,_0x8ebc('0x1d'));_0x57051f(_0x485b90['result'][_0x8ebc('0x22')]);}})[_0x8ebc('0x24')](function(_0x4236c9){logger[_0x8ebc('0x20')](_0x8ebc('0x1c'),_0x23222d,_0x4236c9);_0x3e634d(_0x4236c9);});});}function respondWithStatusCode(_0x2b4916,_0x24ea73){_0x24ea73=_0x24ea73||0xcc;return function(_0xcb1b81){if(_0xcb1b81){return _0x2b4916['sendStatus'](_0x24ea73);}return _0x2b4916['status'](_0x24ea73)[_0x8ebc('0x25')]();};}function respondWithResult(_0x500690,_0x39d26f){_0x39d26f=_0x39d26f||0xc8;return function(_0x4daa70){if(_0x4daa70){return _0x500690[_0x8ebc('0x26')](_0x39d26f)['json'](_0x4daa70);}};}function respondWithFilteredResult(_0x39de1d,_0x321b39){return function(_0x3f13c5){if(_0x3f13c5){var _0x5a6896=typeof _0x321b39[_0x8ebc('0x27')]===_0x8ebc('0x28')&&typeof _0x321b39[_0x8ebc('0x29')]===_0x8ebc('0x28');var _0x27a838=_0x3f13c5[_0x8ebc('0x2a')];var _0x52422d=_0x5a6896?0x0:_0x321b39[_0x8ebc('0x27')];var _0x2df41c=_0x5a6896?_0x3f13c5['count']:_0x321b39[_0x8ebc('0x27')]+_0x321b39[_0x8ebc('0x29')];var _0x21ce9a;if(_0x2df41c>=_0x27a838){_0x2df41c=_0x27a838;_0x21ce9a=0xc8;}else{_0x21ce9a=0xce;}_0x39de1d['status'](_0x21ce9a);return _0x39de1d[_0x8ebc('0x2b')](_0x8ebc('0x2c'),_0x52422d+'-'+_0x2df41c+'/'+_0x27a838)['json'](_0x3f13c5);}return null;};}function patchUpdates(_0x564dc9){return function(_0x966c32){try{jsonpatch[_0x8ebc('0x2d')](_0x966c32,_0x564dc9,!![]);}catch(_0x2460ca){return BPromise[_0x8ebc('0x2e')](_0x2460ca);}return _0x966c32[_0x8ebc('0x2f')]();};}function saveUpdates(_0x32461d,_0x518fdc){return function(_0x100f19){if(_0x100f19){return _0x100f19[_0x8ebc('0x30')](_0x32461d)[_0x8ebc('0x1b')](function(_0x1ac1f8){return _0x1ac1f8;});}return null;};}function removeEntity(_0x4aa037,_0x1107e6){return function(_0x4fb1f9){if(_0x4fb1f9){return _0x4fb1f9[_0x8ebc('0x31')]()[_0x8ebc('0x1b')](function(){_0x4aa037[_0x8ebc('0x26')](0xcc)[_0x8ebc('0x25')]();});}};}function handleEntityNotFound(_0x241130,_0x493978){return function(_0x3ee2e2){if(!_0x3ee2e2){_0x241130[_0x8ebc('0x32')](0x194);}return _0x3ee2e2;};}function handleError(_0x385a66,_0xca145b){_0xca145b=_0xca145b||0x1f4;return function(_0x8d4147){logger[_0x8ebc('0x20')](_0x8d4147[_0x8ebc('0x33')]);if(_0x8d4147[_0x8ebc('0x34')]){delete _0x8d4147['name'];}_0x385a66['status'](_0xca145b)[_0x8ebc('0x35')](_0x8d4147);};}exports[_0x8ebc('0x36')]=function(_0x13746d,_0x245c75){var _0x414379={},_0x18ee1b={},_0x4d5e63={'count':0x0,'rows':[]};var _0x3715f7=_['map'](db[_0x8ebc('0x37')][_0x8ebc('0x38')],function(_0x41a6ca){return{'name':_0x41a6ca[_0x8ebc('0x39')],'type':_0x41a6ca['type'][_0x8ebc('0x3a')]};});_0x18ee1b[_0x8ebc('0x3b')]=_[_0x8ebc('0x3c')](_0x3715f7,_0x8ebc('0x34'));_0x18ee1b[_0x8ebc('0x3d')]=_[_0x8ebc('0x3e')](_0x13746d['query']);_0x18ee1b['filters']=_[_0x8ebc('0x3f')](_0x18ee1b['model'],_0x18ee1b[_0x8ebc('0x3d')]);_0x414379[_0x8ebc('0x40')]=_[_0x8ebc('0x3f')](_0x18ee1b[_0x8ebc('0x3b')],qs[_0x8ebc('0x41')](_0x13746d['query']['fields']));_0x414379[_0x8ebc('0x40')]=_0x414379[_0x8ebc('0x40')][_0x8ebc('0x42')]?_0x414379[_0x8ebc('0x40')]:_0x18ee1b['model'];if(!_0x13746d[_0x8ebc('0x3d')][_0x8ebc('0x43')](_0x8ebc('0x44'))){_0x414379['limit']=qs[_0x8ebc('0x29')](_0x13746d[_0x8ebc('0x3d')][_0x8ebc('0x29')]);_0x414379[_0x8ebc('0x27')]=qs[_0x8ebc('0x27')](_0x13746d[_0x8ebc('0x3d')][_0x8ebc('0x27')]);}_0x414379['order']=qs[_0x8ebc('0x45')](_0x13746d['query']['sort']);_0x414379[_0x8ebc('0x46')]=qs[_0x8ebc('0x47')](_['pick'](_0x13746d[_0x8ebc('0x3d')],_0x18ee1b[_0x8ebc('0x47')]),_0x3715f7);if(_0x13746d[_0x8ebc('0x3d')][_0x8ebc('0x48')]){_0x414379[_0x8ebc('0x46')]=_['merge'](_0x414379['where'],{'$or':_[_0x8ebc('0x3c')](_0x3715f7,function(_0x4e2938){if(_0x4e2938[_0x8ebc('0x49')]!==_0x8ebc('0x4a')){var _0x531823={};_0x531823[_0x4e2938[_0x8ebc('0x34')]]={'$like':'%'+_0x13746d['query'][_0x8ebc('0x48')]+'%'};return _0x531823;}})});}_0x414379=_['merge']({},_0x414379,_0x13746d[_0x8ebc('0x4b')]);var _0x583d9f={'where':_0x414379[_0x8ebc('0x46')]};return db[_0x8ebc('0x37')][_0x8ebc('0x2a')](_0x583d9f)[_0x8ebc('0x1b')](function(_0x4b4491){_0x4d5e63[_0x8ebc('0x2a')]=_0x4b4491;if(_0x13746d[_0x8ebc('0x3d')][_0x8ebc('0x4c')]){_0x414379[_0x8ebc('0x4d')]=[{'all':!![]}];}return db[_0x8ebc('0x37')][_0x8ebc('0x4e')](_0x414379);})['then'](function(_0x512c6b){_0x4d5e63['rows']=_0x512c6b;return _0x4d5e63;})['then'](respondWithFilteredResult(_0x245c75,_0x414379))[_0x8ebc('0x24')](handleError(_0x245c75,null));};exports['show']=function(_0x340d91,_0x2b816e){var _0x107b8e={'raw':!![],'where':{'id':_0x340d91[_0x8ebc('0x4f')]['id']}},_0x4f09d6={};_0x4f09d6[_0x8ebc('0x3b')]=_['keys'](db[_0x8ebc('0x37')]['rawAttributes']);_0x4f09d6[_0x8ebc('0x3d')]=_[_0x8ebc('0x3e')](_0x340d91[_0x8ebc('0x3d')]);_0x4f09d6[_0x8ebc('0x47')]=_['intersection'](_0x4f09d6['model'],_0x4f09d6[_0x8ebc('0x3d')]);_0x107b8e[_0x8ebc('0x40')]=_['intersection'](_0x4f09d6[_0x8ebc('0x3b')],qs[_0x8ebc('0x41')](_0x340d91[_0x8ebc('0x3d')][_0x8ebc('0x41')]));_0x107b8e[_0x8ebc('0x40')]=_0x107b8e[_0x8ebc('0x40')]['length']?_0x107b8e[_0x8ebc('0x40')]:_0x4f09d6[_0x8ebc('0x3b')];if(_0x340d91['query'][_0x8ebc('0x4c')]){_0x107b8e[_0x8ebc('0x4d')]=[{'all':!![]}];}_0x107b8e=_[_0x8ebc('0x50')]({},_0x107b8e,_0x340d91[_0x8ebc('0x4b')]);return db['OpenchannelMessage'][_0x8ebc('0x51')](_0x107b8e)[_0x8ebc('0x1b')](handleEntityNotFound(_0x2b816e,null))['then'](respondWithResult(_0x2b816e,null))['catch'](handleError(_0x2b816e,null));};exports[_0x8ebc('0x52')]=function(_0x44d820,_0x1a878b){return db[_0x8ebc('0x37')][_0x8ebc('0x52')](_0x44d820[_0x8ebc('0x53')],{})['then'](respondWithResult(_0x1a878b,0xc9))[_0x8ebc('0x24')](handleError(_0x1a878b,null));};exports[_0x8ebc('0x30')]=function(_0x8fbc27,_0x6aa091){if(_0x8fbc27[_0x8ebc('0x53')]['id']){delete _0x8fbc27[_0x8ebc('0x53')]['id'];}return db[_0x8ebc('0x37')][_0x8ebc('0x51')]({'where':{'id':_0x8fbc27[_0x8ebc('0x4f')]['id']}})[_0x8ebc('0x1b')](handleEntityNotFound(_0x6aa091,null))[_0x8ebc('0x1b')](saveUpdates(_0x8fbc27[_0x8ebc('0x53')],null))[_0x8ebc('0x1b')](respondWithResult(_0x6aa091,null))[_0x8ebc('0x24')](handleError(_0x6aa091,null));};exports['destroy']=function(_0x3047ca,_0x43e30b){return db['OpenchannelMessage'][_0x8ebc('0x51')]({'where':{'id':_0x3047ca[_0x8ebc('0x4f')]['id']}})[_0x8ebc('0x1b')](handleEntityNotFound(_0x43e30b,null))[_0x8ebc('0x1b')](removeEntity(_0x43e30b,null))['catch'](handleError(_0x43e30b,null));};exports['describe']=function(_0xb43037,_0x4ff2fe){return db[_0x8ebc('0x37')][_0x8ebc('0x54')]()[_0x8ebc('0x1b')](respondWithResult(_0x4ff2fe,null))[_0x8ebc('0x24')](handleError(_0x4ff2fe,null));};var interaction_log=require(_0x8ebc('0x11'))('openchannel-interactions');exports[_0x8ebc('0x55')]=function(_0x2bf2db,_0x42598,_0x97cbe0){var _0x5277a8={'agent':{},'channel':_0x8ebc('0x56')};if(_0x2bf2db[_0x8ebc('0x53')]['id']){delete _0x2bf2db[_0x8ebc('0x53')]['id'];}_0x2bf2db[_0x8ebc('0x53')][_0x8ebc('0x57')]=!![];_0x2bf2db['body'][_0x8ebc('0x58')]=moment()[_0x8ebc('0x59')](_0x8ebc('0x5a'));_0x2bf2db[_0x8ebc('0x53')]['UserId']=_0x2bf2db['body'][_0x8ebc('0x5b')]||_0x2bf2db[_0x8ebc('0x5c')]['id'];_0x5277a8[_0x8ebc('0x5d')]['id']=_0x2bf2db[_0x8ebc('0x53')][_0x8ebc('0x5b')];return db[_0x8ebc('0x37')][_0x8ebc('0x51')]({'where':{'id':_0x2bf2db[_0x8ebc('0x4f')]['id'],'UserId':null}})[_0x8ebc('0x1b')](handleEntityNotFound(_0x42598,null))['then'](saveUpdates(_0x2bf2db[_0x8ebc('0x53')],null))[_0x8ebc('0x1b')](function(_0x15de41){if(_0x15de41){_0x5277a8['message']=_0x15de41['get']({'plain':!![]});return db[_0x8ebc('0x5e')]['find']({'where':{'id':_0x15de41['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x42598,null))[_0x8ebc('0x1b')](function(_0x155164){if(_0x155164){return _0x155164['update']({'UserId':_0x2bf2db[_0x8ebc('0x53')][_0x8ebc('0x5b')],'read1stAt':_[_0x8ebc('0x5f')](_0x155164[_0x8ebc('0x60')])?moment()[_0x8ebc('0x59')](_0x8ebc('0x5a')):undefined});}return null;})[_0x8ebc('0x1b')](function(_0x14e79d){if(_0x14e79d){_0x5277a8[_0x8ebc('0x61')]=_0x14e79d['get']({'plain':!![]});interaction_log[_0x8ebc('0x23')](_0x8ebc('0x62'),_0x2bf2db[_0x8ebc('0x5c')]['id'],_0x2bf2db['user'][_0x8ebc('0x34')],_0x2bf2db[_0x8ebc('0x5c')]['role'],_0x5277a8[_0x8ebc('0x61')]['id'],_0x2bf2db[_0x8ebc('0x53')]?JSON[_0x8ebc('0x1f')](_0x2bf2db[_0x8ebc('0x53')]):_0x8ebc('0x63'));return respondWithRpcPromise(_0x8ebc('0x64'),_0x8ebc('0x65'),_0x5277a8);}return null;})[_0x8ebc('0x1b')](function(_0x15489f){var _0x6655c7=_0x8ebc('0x66')+_0x15489f[_0x8ebc('0x22')][_0x8ebc('0x67')];return db[_0x8ebc('0x68')][_0x8ebc('0x3d')](_0x6655c7,{'type':db[_0x8ebc('0x69')][_0x8ebc('0x6a')][_0x8ebc('0x6b')],'raw':!![]})['then'](function(_0x52963c){return _0x52963c;});})['then'](function(_0x4d96fa){if(_0x4d96fa){_0x5277a8[_0x8ebc('0x22')]['contact']=_0x4d96fa[0x0];if(!_0x2bf2db[_0x8ebc('0x53')][_0x8ebc('0x5b')])return;return db[_0x8ebc('0x6c')][_0x8ebc('0x51')]({'where':{'id':_0x2bf2db[_0x8ebc('0x53')][_0x8ebc('0x5b')],'role':_0x8ebc('0x5d')},'attributes':['id','name','fullname',_0x8ebc('0x6d'),_0x8ebc('0x6e')],'raw':!![]});}return null;})[_0x8ebc('0x1b')](function(_0x8f8f4a){if(!_0x8f8f4a)return null;_0x5277a8[_0x8ebc('0x22')][_0x8ebc('0x5d')]=_0x8f8f4a;return _0x5277a8;})[_0x8ebc('0x1b')](function(_0x430005){if(_0x430005){if(_0x2bf2db[_0x8ebc('0x53')][_0x8ebc('0x6f')]){_0x5277a8[_0x8ebc('0x22')][_0x8ebc('0x70')]=util['format'](_0x8ebc('0x71'),_0x2bf2db[_0x8ebc('0x5c')][_0x8ebc('0x34')]);_0x5277a8[_0x8ebc('0x22')]['channel']=_0x5277a8[_0x8ebc('0x72')];_0x5277a8[_0x8ebc('0x22')]['motionChannel']=_0x5277a8[_0x8ebc('0x72')];_0x5277a8['message'][_0x8ebc('0x73')]=_0x8ebc('0x55');return respondWithRpcPromise(_0x8ebc('0x74'),_0x8ebc('0x74'),{'event':_0x8ebc('0x75'),'message':_0x5277a8[_0x8ebc('0x22')]},client9002)['then'](function(){return _0x5277a8;});}return _0x5277a8;}return null;})[_0x8ebc('0x1b')](respondWithResult(_0x42598,null))[_0x8ebc('0x24')](handleError(_0x42598,null));};var interaction_log=require('../../config/logger')(_0x8ebc('0x76'));exports[_0x8ebc('0x2e')]=function(_0x1e09c1,_0x439484,_0x50bfb5){var _0x4131a4={'agent':{},'channel':'openchannel'};if(_0x1e09c1[_0x8ebc('0x53')]['id']){delete _0x1e09c1[_0x8ebc('0x53')]['id'];}_0x1e09c1['body']['UserId']=_0x1e09c1['body'][_0x8ebc('0x5b')]||_0x1e09c1['user']['id'];_0x4131a4[_0x8ebc('0x5d')]['id']=_0x1e09c1[_0x8ebc('0x53')]['UserId'];return db[_0x8ebc('0x37')][_0x8ebc('0x51')]({'where':{'id':_0x1e09c1[_0x8ebc('0x4f')]['id'],'UserId':null}})[_0x8ebc('0x1b')](handleEntityNotFound(_0x439484,null))[_0x8ebc('0x1b')](function(_0x26e4ac){if(_0x26e4ac){_0x4131a4[_0x8ebc('0x22')]=_0x26e4ac[_0x8ebc('0x77')]({'plain':!![]});return db[_0x8ebc('0x5e')][_0x8ebc('0x51')]({'where':{'id':_0x26e4ac[_0x8ebc('0x78')]}});}return null;})[_0x8ebc('0x1b')](handleEntityNotFound(_0x439484,null))[_0x8ebc('0x1b')](function(_0x38097f){if(_0x38097f){_0x4131a4[_0x8ebc('0x61')]=_0x38097f['get']({'plain':!![]});interaction_log['info'](_0x8ebc('0x79'),_0x1e09c1[_0x8ebc('0x5c')]['id'],_0x1e09c1['user'][_0x8ebc('0x34')],_0x1e09c1[_0x8ebc('0x5c')][_0x8ebc('0x7a')],_0x4131a4[_0x8ebc('0x61')]['id'],_0x1e09c1[_0x8ebc('0x53')]?JSON[_0x8ebc('0x1f')](_0x1e09c1[_0x8ebc('0x53')]):'null');return respondWithRpcPromise('RejectMessage',_0x8ebc('0x7b'),_0x4131a4);}return null;})['then'](function(_0x26263b){var _0x51cb99=_0x8ebc('0x66')+_0x26263b['message'][_0x8ebc('0x67')];return db['sequelize'][_0x8ebc('0x3d')](_0x51cb99,{'type':db[_0x8ebc('0x69')][_0x8ebc('0x6a')][_0x8ebc('0x6b')],'raw':!![]})[_0x8ebc('0x1b')](function(_0x42bb1f){return _0x42bb1f;});})[_0x8ebc('0x1b')](function(_0xae6530){if(_0xae6530){_0x4131a4[_0x8ebc('0x22')][_0x8ebc('0x7c')]=_0xae6530[0x0];if(!_0x1e09c1['body'][_0x8ebc('0x5b')])return;return db[_0x8ebc('0x6c')][_0x8ebc('0x51')]({'where':{'id':_0x1e09c1[_0x8ebc('0x53')][_0x8ebc('0x5b')],'role':_0x8ebc('0x5d')},'attributes':['id',_0x8ebc('0x34'),'fullname',_0x8ebc('0x6d'),'internal'],'raw':!![]});}return null;})['then'](function(_0x47835d){if(!_0x47835d)return null;_0x4131a4[_0x8ebc('0x22')][_0x8ebc('0x5d')]=_0x47835d;return _0x4131a4;})[_0x8ebc('0x1b')](function(_0x1a1ae9){if(_0x1a1ae9){_0x1a1ae9[_0x8ebc('0x22')]['interface']=util['format'](_0x8ebc('0x71'),_0x1e09c1[_0x8ebc('0x5c')][_0x8ebc('0x34')]);_0x1a1ae9[_0x8ebc('0x22')][_0x8ebc('0x72')]=_0x4131a4[_0x8ebc('0x72')];_0x1a1ae9[_0x8ebc('0x22')][_0x8ebc('0x7d')]=_0x4131a4[_0x8ebc('0x72')];_0x1a1ae9[_0x8ebc('0x22')][_0x8ebc('0x73')]=_0x8ebc('0x2e');respondWithRpcPromise(_0x8ebc('0x74'),_0x8ebc('0x74'),{'event':_0x8ebc('0x7e'),'message':_0x1a1ae9[_0x8ebc('0x22')]},client9002);return _0x4131a4;}return null;})[_0x8ebc('0x1b')](respondWithResult(_0x439484,null))[_0x8ebc('0x24')](handleError(_0x439484,null));}; \ No newline at end of file +var _0xf8af=['event','EventManager','openchannel-interactions','openchannel','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','internal','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','http','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','name','OpenchannelMessage','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','interface','SIP/%s','channel','motionChannel'];(function(_0x3fcc20,_0x57c31b){var _0x15d3ce=function(_0x575619){while(--_0x575619){_0x3fcc20['push'](_0x3fcc20['shift']());}};_0x15d3ce(++_0x57c31b);}(_0xf8af,0x8b));var _0xff8a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf8af[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0xff8a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff8a('0x1'));var jsonpatch=require(_0xff8a('0x2'));var rp=require(_0xff8a('0x3'));var moment=require(_0xff8a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xff8a('0x5'));var util=require(_0xff8a('0x6'));var path=require(_0xff8a('0x7'));var sox=require(_0xff8a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff8a('0x9'));var _=require('lodash');var squel=require(_0xff8a('0xa'));var crypto=require(_0xff8a('0xb'));var jsforce=require(_0xff8a('0xc'));var deskjs=require(_0xff8a('0xd'));var toCsv=require(_0xff8a('0xe'));var querystring=require(_0xff8a('0xf'));var Papa=require(_0xff8a('0x10'));var Redis=require(_0xff8a('0x11'));var authService=require(_0xff8a('0x12'));var qs=require(_0xff8a('0x13'));var as=require(_0xff8a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xff8a('0x15'))(_0xff8a('0x16'));var utils=require(_0xff8a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xff8a('0x18'));var db=require(_0xff8a('0x19'))['db'];config[_0xff8a('0x1a')]=_[_0xff8a('0x1b')](config[_0xff8a('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xff8a('0x1c'))(new Redis(config[_0xff8a('0x1a')]));require(_0xff8a('0x1d'))[_0xff8a('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0xff8a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x569b15,_0x279441,_0x2917a7,_0x4e98b0){return new BPromise(function(_0x2dba7f,_0x4f9fa5){var _0x5ed382=_0x4e98b0||client;return _0x5ed382[_0xff8a('0x20')](_0x569b15,_0x2917a7)[_0xff8a('0x21')](function(_0x124cb9){logger['info'](_0xff8a('0x22'),_0x279441,'request\x20sent');logger[_0xff8a('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x279441,_0xff8a('0x24'),JSON[_0xff8a('0x25')](_0x124cb9));if(_0x124cb9[_0xff8a('0x26')]){if(_0x124cb9[_0xff8a('0x26')][_0xff8a('0x27')]===0x1f4){logger[_0xff8a('0x26')](_0xff8a('0x22'),_0x279441,_0x124cb9[_0xff8a('0x26')][_0xff8a('0x28')]);return _0x4f9fa5(_0x124cb9[_0xff8a('0x26')][_0xff8a('0x28')]);}logger[_0xff8a('0x26')](_0xff8a('0x22'),_0x279441,_0x124cb9[_0xff8a('0x26')][_0xff8a('0x28')]);return _0x2dba7f(_0x124cb9['error'][_0xff8a('0x28')]);}else{logger[_0xff8a('0x29')](_0xff8a('0x22'),_0x279441,_0xff8a('0x24'));_0x2dba7f(_0x124cb9['result'][_0xff8a('0x28')]);}})['catch'](function(_0x1c9ecc){logger[_0xff8a('0x26')](_0xff8a('0x22'),_0x279441,_0x1c9ecc);_0x4f9fa5(_0x1c9ecc);});});}function respondWithStatusCode(_0x3fdce3,_0x375285){_0x375285=_0x375285||0xcc;return function(_0x55b267){if(_0x55b267){return _0x3fdce3[_0xff8a('0x2a')](_0x375285);}return _0x3fdce3[_0xff8a('0x2b')](_0x375285)[_0xff8a('0x2c')]();};}function respondWithResult(_0x5153f6,_0x2458a0){_0x2458a0=_0x2458a0||0xc8;return function(_0x42b799){if(_0x42b799){return _0x5153f6[_0xff8a('0x2b')](_0x2458a0)[_0xff8a('0x2d')](_0x42b799);}};}function respondWithFilteredResult(_0x38188f,_0xba33b6){return function(_0x20ac09){if(_0x20ac09){var _0x59b6d4=typeof _0xba33b6['offset']===_0xff8a('0x2e')&&typeof _0xba33b6[_0xff8a('0x2f')]===_0xff8a('0x2e');var _0x279347=_0x20ac09[_0xff8a('0x30')];var _0x184254=_0x59b6d4?0x0:_0xba33b6['offset'];var _0x1936dd=_0x59b6d4?_0x20ac09[_0xff8a('0x30')]:_0xba33b6['offset']+_0xba33b6[_0xff8a('0x2f')];var _0x280120;if(_0x1936dd>=_0x279347){_0x1936dd=_0x279347;_0x280120=0xc8;}else{_0x280120=0xce;}_0x38188f[_0xff8a('0x2b')](_0x280120);return _0x38188f['set'](_0xff8a('0x31'),_0x184254+'-'+_0x1936dd+'/'+_0x279347)[_0xff8a('0x2d')](_0x20ac09);}return null;};}function patchUpdates(_0x5a1c84){return function(_0x231d1c){try{jsonpatch[_0xff8a('0x32')](_0x231d1c,_0x5a1c84,!![]);}catch(_0x3ad597){return BPromise[_0xff8a('0x33')](_0x3ad597);}return _0x231d1c[_0xff8a('0x34')]();};}function saveUpdates(_0x3b90be,_0x4387a8){return function(_0x3b894e){if(_0x3b894e){return _0x3b894e[_0xff8a('0x35')](_0x3b90be)['then'](function(_0x435dcb){return _0x435dcb;});}return null;};}function removeEntity(_0x1330ea,_0x5b7d57){return function(_0x2e3829){if(_0x2e3829){return _0x2e3829[_0xff8a('0x36')]()[_0xff8a('0x21')](function(){_0x1330ea[_0xff8a('0x2b')](0xcc)[_0xff8a('0x2c')]();});}};}function handleEntityNotFound(_0x45d948,_0x97bf3a){return function(_0x2f9f46){if(!_0x2f9f46){_0x45d948[_0xff8a('0x2a')](0x194);}return _0x2f9f46;};}function handleError(_0x52c3b9,_0x4afc20){_0x4afc20=_0x4afc20||0x1f4;return function(_0x15a96b){logger[_0xff8a('0x26')](_0x15a96b['stack']);if(_0x15a96b[_0xff8a('0x37')]){delete _0x15a96b[_0xff8a('0x37')];}_0x52c3b9['status'](_0x4afc20)['send'](_0x15a96b);};}exports['index']=function(_0x2fd75f,_0x1432c8){var _0x53ca69={},_0x191f51={},_0x43a4fd={'count':0x0,'rows':[]};var _0x30ad0d=_['map'](db[_0xff8a('0x38')]['rawAttributes'],function(_0x2e7ac7){return{'name':_0x2e7ac7[_0xff8a('0x39')],'type':_0x2e7ac7['type'][_0xff8a('0x3a')]};});_0x191f51['model']=_['map'](_0x30ad0d,_0xff8a('0x37'));_0x191f51[_0xff8a('0x3b')]=_[_0xff8a('0x3c')](_0x2fd75f[_0xff8a('0x3b')]);_0x191f51[_0xff8a('0x3d')]=_['intersection'](_0x191f51[_0xff8a('0x3e')],_0x191f51['query']);_0x53ca69[_0xff8a('0x3f')]=_[_0xff8a('0x40')](_0x191f51[_0xff8a('0x3e')],qs[_0xff8a('0x41')](_0x2fd75f[_0xff8a('0x3b')][_0xff8a('0x41')]));_0x53ca69[_0xff8a('0x3f')]=_0x53ca69['attributes'][_0xff8a('0x42')]?_0x53ca69[_0xff8a('0x3f')]:_0x191f51[_0xff8a('0x3e')];if(!_0x2fd75f[_0xff8a('0x3b')][_0xff8a('0x43')](_0xff8a('0x44'))){_0x53ca69[_0xff8a('0x2f')]=qs[_0xff8a('0x2f')](_0x2fd75f[_0xff8a('0x3b')]['limit']);_0x53ca69[_0xff8a('0x45')]=qs['offset'](_0x2fd75f[_0xff8a('0x3b')][_0xff8a('0x45')]);}_0x53ca69[_0xff8a('0x46')]=qs[_0xff8a('0x47')](_0x2fd75f[_0xff8a('0x3b')][_0xff8a('0x47')]);_0x53ca69[_0xff8a('0x48')]=qs[_0xff8a('0x3d')](_[_0xff8a('0x49')](_0x2fd75f[_0xff8a('0x3b')],_0x191f51[_0xff8a('0x3d')]),_0x30ad0d);if(_0x2fd75f['query'][_0xff8a('0x4a')]){_0x53ca69[_0xff8a('0x48')]=_[_0xff8a('0x4b')](_0x53ca69[_0xff8a('0x48')],{'$or':_[_0xff8a('0x4c')](_0x30ad0d,function(_0x4c7ddf){if(_0x4c7ddf[_0xff8a('0x4d')]!==_0xff8a('0x4e')){var _0x21ef6d={};_0x21ef6d[_0x4c7ddf['name']]={'$like':'%'+_0x2fd75f['query'][_0xff8a('0x4a')]+'%'};return _0x21ef6d;}})});}_0x53ca69=_[_0xff8a('0x4b')]({},_0x53ca69,_0x2fd75f[_0xff8a('0x4f')]);var _0x1202b9={'where':_0x53ca69['where']};return db[_0xff8a('0x38')][_0xff8a('0x30')](_0x1202b9)[_0xff8a('0x21')](function(_0x211ce2){_0x43a4fd[_0xff8a('0x30')]=_0x211ce2;if(_0x2fd75f[_0xff8a('0x3b')][_0xff8a('0x50')]){_0x53ca69[_0xff8a('0x51')]=[{'all':!![]}];}return db[_0xff8a('0x38')][_0xff8a('0x52')](_0x53ca69);})[_0xff8a('0x21')](function(_0x4f0043){_0x43a4fd[_0xff8a('0x53')]=_0x4f0043;return _0x43a4fd;})[_0xff8a('0x21')](respondWithFilteredResult(_0x1432c8,_0x53ca69))['catch'](handleError(_0x1432c8,null));};exports[_0xff8a('0x54')]=function(_0x116202,_0x5f0f2b){var _0x1fb0c9={'raw':!![],'where':{'id':_0x116202[_0xff8a('0x55')]['id']}},_0x1a294f={};_0x1a294f[_0xff8a('0x3e')]=_[_0xff8a('0x3c')](db[_0xff8a('0x38')][_0xff8a('0x56')]);_0x1a294f[_0xff8a('0x3b')]=_[_0xff8a('0x3c')](_0x116202[_0xff8a('0x3b')]);_0x1a294f[_0xff8a('0x3d')]=_[_0xff8a('0x40')](_0x1a294f[_0xff8a('0x3e')],_0x1a294f[_0xff8a('0x3b')]);_0x1fb0c9['attributes']=_[_0xff8a('0x40')](_0x1a294f[_0xff8a('0x3e')],qs[_0xff8a('0x41')](_0x116202['query'][_0xff8a('0x41')]));_0x1fb0c9[_0xff8a('0x3f')]=_0x1fb0c9[_0xff8a('0x3f')][_0xff8a('0x42')]?_0x1fb0c9[_0xff8a('0x3f')]:_0x1a294f[_0xff8a('0x3e')];if(_0x116202[_0xff8a('0x3b')][_0xff8a('0x50')]){_0x1fb0c9[_0xff8a('0x51')]=[{'all':!![]}];}_0x1fb0c9=_[_0xff8a('0x4b')]({},_0x1fb0c9,_0x116202[_0xff8a('0x4f')]);return db['OpenchannelMessage'][_0xff8a('0x57')](_0x1fb0c9)[_0xff8a('0x21')](handleEntityNotFound(_0x5f0f2b,null))[_0xff8a('0x21')](respondWithResult(_0x5f0f2b,null))[_0xff8a('0x58')](handleError(_0x5f0f2b,null));};exports[_0xff8a('0x59')]=function(_0x3a8f80,_0x1534f1){return db['OpenchannelMessage'][_0xff8a('0x59')](_0x3a8f80[_0xff8a('0x5a')],{})['then'](respondWithResult(_0x1534f1,0xc9))[_0xff8a('0x58')](handleError(_0x1534f1,null));};exports[_0xff8a('0x35')]=function(_0x96bfed,_0x26ba6c){if(_0x96bfed[_0xff8a('0x5a')]['id']){delete _0x96bfed[_0xff8a('0x5a')]['id'];}return db[_0xff8a('0x38')]['find']({'where':{'id':_0x96bfed[_0xff8a('0x55')]['id']}})['then'](handleEntityNotFound(_0x26ba6c,null))[_0xff8a('0x21')](saveUpdates(_0x96bfed[_0xff8a('0x5a')],null))[_0xff8a('0x21')](respondWithResult(_0x26ba6c,null))['catch'](handleError(_0x26ba6c,null));};exports[_0xff8a('0x36')]=function(_0x47471c,_0xf37e88){return db[_0xff8a('0x38')][_0xff8a('0x57')]({'where':{'id':_0x47471c[_0xff8a('0x55')]['id']}})[_0xff8a('0x21')](handleEntityNotFound(_0xf37e88,null))['then'](removeEntity(_0xf37e88,null))[_0xff8a('0x58')](handleError(_0xf37e88,null));};exports['describe']=function(_0x239920,_0x368ee6){return db['OpenchannelMessage']['describe']()[_0xff8a('0x21')](respondWithResult(_0x368ee6,null))[_0xff8a('0x58')](handleError(_0x368ee6,null));};var interaction_log=require(_0xff8a('0x15'))('openchannel-interactions');exports[_0xff8a('0x5b')]=function(_0x483dd6,_0x3fcd5d,_0x136053){var _0x41b797={'agent':{},'channel':'openchannel'};if(_0x483dd6['body']['id']){delete _0x483dd6[_0xff8a('0x5a')]['id'];}_0x483dd6[_0xff8a('0x5a')][_0xff8a('0x5c')]=!![];_0x483dd6[_0xff8a('0x5a')]['readAt']=moment()[_0xff8a('0x5d')](_0xff8a('0x5e'));_0x483dd6['body'][_0xff8a('0x5f')]=_0x483dd6['body'][_0xff8a('0x5f')]||_0x483dd6[_0xff8a('0x60')]['id'];_0x41b797[_0xff8a('0x61')]['id']=_0x483dd6[_0xff8a('0x5a')][_0xff8a('0x5f')];return db['OpenchannelMessage'][_0xff8a('0x57')]({'where':{'id':_0x483dd6[_0xff8a('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3fcd5d,null))['then'](saveUpdates(_0x483dd6[_0xff8a('0x5a')],null))[_0xff8a('0x21')](function(_0x491c83){if(_0x491c83){_0x41b797['message']=_0x491c83[_0xff8a('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0xff8a('0x57')]({'where':{'id':_0x491c83[_0xff8a('0x63')]}});}return null;})[_0xff8a('0x21')](handleEntityNotFound(_0x3fcd5d,null))[_0xff8a('0x21')](function(_0x19e13a){if(_0x19e13a){return _0x19e13a[_0xff8a('0x35')]({'UserId':_0x483dd6[_0xff8a('0x5a')][_0xff8a('0x5f')],'read1stAt':_[_0xff8a('0x64')](_0x19e13a[_0xff8a('0x65')])?moment()[_0xff8a('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xff8a('0x21')](function(_0x3e5b9a){if(_0x3e5b9a){_0x41b797[_0xff8a('0x66')]=_0x3e5b9a['get']({'plain':!![]});interaction_log[_0xff8a('0x29')](_0xff8a('0x67'),_0x483dd6['user']['id'],_0x483dd6[_0xff8a('0x60')]['name'],_0x483dd6[_0xff8a('0x60')][_0xff8a('0x68')],_0x41b797[_0xff8a('0x66')]['id'],_0x483dd6[_0xff8a('0x5a')]?JSON[_0xff8a('0x25')](_0x483dd6[_0xff8a('0x5a')]):_0xff8a('0x69'));return respondWithRpcPromise(_0xff8a('0x6a'),_0xff8a('0x6b'),_0x41b797);}return null;})['then'](function(_0x859f8b){var _0x22caf3=_0xff8a('0x6c')+_0x859f8b[_0xff8a('0x28')]['ContactId'];return db[_0xff8a('0x6d')][_0xff8a('0x3b')](_0x22caf3,{'type':db[_0xff8a('0x6e')][_0xff8a('0x6f')][_0xff8a('0x70')],'raw':!![]})[_0xff8a('0x21')](function(_0x4565d7){return _0x4565d7;});})[_0xff8a('0x21')](function(_0x3b2f87){if(_0x3b2f87){_0x41b797[_0xff8a('0x28')][_0xff8a('0x71')]=_0x3b2f87[0x0];if(!_0x483dd6[_0xff8a('0x5a')][_0xff8a('0x5f')])return;return db[_0xff8a('0x72')]['find']({'where':{'id':_0x483dd6['body'][_0xff8a('0x5f')],'role':_0xff8a('0x61')},'attributes':['id','name',_0xff8a('0x73'),_0xff8a('0x74'),'internal'],'raw':!![]});}return null;})[_0xff8a('0x21')](function(_0x41c20b){if(!_0x41c20b)return null;_0x41b797[_0xff8a('0x28')][_0xff8a('0x61')]=_0x41c20b;return _0x41b797;})[_0xff8a('0x21')](function(_0xa7f21c){if(_0xa7f21c){if(_0x483dd6[_0xff8a('0x5a')]['manual']){_0x41b797[_0xff8a('0x28')][_0xff8a('0x75')]=util[_0xff8a('0x5d')](_0xff8a('0x76'),_0x483dd6[_0xff8a('0x60')][_0xff8a('0x37')]);_0x41b797[_0xff8a('0x28')][_0xff8a('0x77')]=_0x41b797['channel'];_0x41b797['message'][_0xff8a('0x78')]=_0x41b797[_0xff8a('0x77')];_0x41b797[_0xff8a('0x28')][_0xff8a('0x79')]='accept';return respondWithRpcPromise(_0xff8a('0x7a'),_0xff8a('0x7a'),{'event':'acceptmessage','message':_0x41b797['message']},client9002)['then'](function(){return _0x41b797;});}return _0x41b797;}return null;})[_0xff8a('0x21')](respondWithResult(_0x3fcd5d,null))['catch'](handleError(_0x3fcd5d,null));};var interaction_log=require('../../config/logger')(_0xff8a('0x7b'));exports[_0xff8a('0x33')]=function(_0x5b078f,_0x59028d,_0x44f360){var _0x1bc68b={'agent':{},'channel':_0xff8a('0x7c')};if(_0x5b078f[_0xff8a('0x5a')]['id']){delete _0x5b078f['body']['id'];}_0x5b078f[_0xff8a('0x5a')]['UserId']=_0x5b078f[_0xff8a('0x5a')][_0xff8a('0x5f')]||_0x5b078f[_0xff8a('0x60')]['id'];_0x1bc68b[_0xff8a('0x61')]['id']=_0x5b078f[_0xff8a('0x5a')]['UserId'];return db[_0xff8a('0x38')]['find']({'where':{'id':_0x5b078f['params']['id'],'UserId':null}})[_0xff8a('0x21')](handleEntityNotFound(_0x59028d,null))[_0xff8a('0x21')](function(_0x3f47ee){if(_0x3f47ee){_0x1bc68b[_0xff8a('0x28')]=_0x3f47ee[_0xff8a('0x62')]({'plain':!![]});return db[_0xff8a('0x7d')][_0xff8a('0x57')]({'where':{'id':_0x3f47ee[_0xff8a('0x63')]}});}return null;})[_0xff8a('0x21')](handleEntityNotFound(_0x59028d,null))[_0xff8a('0x21')](function(_0x599dd9){if(_0x599dd9){_0x1bc68b['interaction']=_0x599dd9[_0xff8a('0x62')]({'plain':!![]});interaction_log[_0xff8a('0x29')](_0xff8a('0x7e'),_0x5b078f[_0xff8a('0x60')]['id'],_0x5b078f[_0xff8a('0x60')][_0xff8a('0x37')],_0x5b078f[_0xff8a('0x60')][_0xff8a('0x68')],_0x1bc68b[_0xff8a('0x66')]['id'],_0x5b078f['body']?JSON[_0xff8a('0x25')](_0x5b078f[_0xff8a('0x5a')]):_0xff8a('0x69'));return respondWithRpcPromise(_0xff8a('0x7f'),'rejectMessage',_0x1bc68b);}return null;})['then'](function(_0x3b968c){var _0x4b78ed=_0xff8a('0x6c')+_0x3b968c[_0xff8a('0x28')][_0xff8a('0x80')];return db[_0xff8a('0x6d')]['query'](_0x4b78ed,{'type':db[_0xff8a('0x6e')][_0xff8a('0x6f')]['SELECT'],'raw':!![]})['then'](function(_0x2673d5){return _0x2673d5;});})[_0xff8a('0x21')](function(_0x23994e){if(_0x23994e){_0x1bc68b[_0xff8a('0x28')]['contact']=_0x23994e[0x0];if(!_0x5b078f[_0xff8a('0x5a')][_0xff8a('0x5f')])return;return db[_0xff8a('0x72')][_0xff8a('0x57')]({'where':{'id':_0x5b078f[_0xff8a('0x5a')]['UserId'],'role':_0xff8a('0x61')},'attributes':['id',_0xff8a('0x37'),_0xff8a('0x73'),'email',_0xff8a('0x81')],'raw':!![]});}return null;})[_0xff8a('0x21')](function(_0x4a9089){if(!_0x4a9089)return null;_0x1bc68b[_0xff8a('0x28')]['agent']=_0x4a9089;return _0x1bc68b;})[_0xff8a('0x21')](function(_0x448739){if(_0x448739){_0x448739[_0xff8a('0x28')][_0xff8a('0x75')]=util[_0xff8a('0x5d')](_0xff8a('0x76'),_0x5b078f[_0xff8a('0x60')][_0xff8a('0x37')]);_0x448739[_0xff8a('0x28')][_0xff8a('0x77')]=_0x1bc68b[_0xff8a('0x77')];_0x448739['message']['motionChannel']=_0x1bc68b[_0xff8a('0x77')];_0x448739[_0xff8a('0x28')][_0xff8a('0x79')]=_0xff8a('0x33');respondWithRpcPromise('EventManager',_0xff8a('0x7a'),{'event':'rejectmessage','message':_0x448739[_0xff8a('0x28')]},client9002);return _0x1bc68b;}return null;})[_0xff8a('0x21')](respondWithResult(_0x59028d,null))[_0xff8a('0x58')](handleError(_0x59028d,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 6e7eacf..0c04dab 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 _0x7b24=['update','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save'];(function(_0x22f21e,_0x4dde19){var _0x4d5fb9=function(_0x488bb8){while(--_0x488bb8){_0x22f21e['push'](_0x22f21e['shift']());}};_0x4d5fb9(++_0x4dde19);}(_0x7b24,0xc8));var _0x47b2=function(_0x54f6a3,_0x376685){_0x54f6a3=_0x54f6a3-0x0;var _0x4e1aa3=_0x7b24[_0x54f6a3];return _0x4e1aa3;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x47b2('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x47b2('0x1')](0x0);var events={'afterCreate':_0x47b2('0x2'),'afterUpdate':_0x47b2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x15c481){return function(_0x2ad84d,_0x535087,_0x1216e0){OpenchannelMessageEvents[_0x47b2('0x4')](_0x15c481+':'+_0x2ad84d['id'],_0x2ad84d);OpenchannelMessageEvents[_0x47b2('0x4')](_0x15c481,_0x2ad84d);_0x1216e0(null);};}for(var e in events){if(events[_0x47b2('0x5')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x47b2('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x55a7=['save','update','remove','emit','hasOwnProperty','hook','events','OpenchannelMessage','setMaxListeners'];(function(_0x4d063f,_0x32f1fd){var _0x597d8a=function(_0x584b92){while(--_0x584b92){_0x4d063f['push'](_0x4d063f['shift']());}};_0x597d8a(++_0x32f1fd);}(_0x55a7,0xde));var _0x755a=function(_0x17110e,_0xb2adf3){_0x17110e=_0x17110e-0x0;var _0x5db5e6=_0x55a7[_0x17110e];return _0x5db5e6;};'use strict';var EventEmitter=require(_0x755a('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x755a('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x755a('0x2')](0x0);var events={'afterCreate':_0x755a('0x3'),'afterUpdate':_0x755a('0x4'),'afterDestroy':_0x755a('0x5')};function emitEvent(_0x26c769){return function(_0x1b7a3d,_0x590fff,_0x44d9d4){OpenchannelMessageEvents['emit'](_0x26c769+':'+_0x1b7a3d['id'],_0x1b7a3d);OpenchannelMessageEvents[_0x755a('0x6')](_0x26c769,_0x1b7a3d);_0x44d9d4(null);};}for(var e in events){if(events[_0x755a('0x7')](e)){var event=events[e];OpenchannelMessage[_0x755a('0x8')](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 cafa3d7..0f5a0d9 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 _0x14a0=['fti_openchannel_messages','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','inspect','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages'];(function(_0x4b6e34,_0x1e249f){var _0x24cc6b=function(_0x335eaf){while(--_0x335eaf){_0x4b6e34['push'](_0x4b6e34['shift']());}};_0x24cc6b(++_0x1e249f);}(_0x14a0,0x8e));var _0x014a=function(_0x468103,_0x54ce37){_0x468103=_0x468103-0x0;var _0x505c45=_0x14a0[_0x468103];return _0x505c45;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var logger=require(_0x014a('0x1'))(_0x014a('0x2'));var moment=require(_0x014a('0x3'));var BPromise=require(_0x014a('0x4'));var rp=require(_0x014a('0x5'));var fs=require('fs');var path=require(_0x014a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x014a('0x7'));module[_0x014a('0x8')]=function(_0x38a22c,_0x5ec84d){return _0x38a22c['define'](_0x014a('0x9'),attributes,{'tableName':_0x014a('0xa'),'paranoid':![],'indexes':[{'name':_0x014a('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2519e3,_0x4f5506,_0x490ea2){var _0x5aa52f=_0x38a22c['models'];var _0x330469=_0x2519e3['get']({'plain':!![]});if(_0x330469[_0x014a('0xc')][_0x014a('0xd')]()==='in'||_0x330469['direction'][_0x014a('0xd')]()===_0x014a('0xe')&&!_0x330469[_0x014a('0xf')]&&!_[_0x014a('0x10')](_0x330469[_0x014a('0x11')])){_0x5aa52f[_0x014a('0x12')][_0x014a('0x13')]({'where':{'id':_0x330469[_0x014a('0x14')]}})[_0x014a('0x15')](function(_0x71535d){if(_0x71535d){_0x71535d[_0x014a('0x16')]({'lastMsgAt':_0x330469[_0x014a('0x17')],'lastMsgDirection':_0x330469['direction'][_0x014a('0xd')]()});}})[_0x014a('0x18')](function(_0x59f207){console[_0x014a('0x19')](_0x59f207);});}if(_0x330469[_0x014a('0xc')]==='out'&&!_0x330469[_0x014a('0xf')]){var _0x17e4be;_0x5aa52f[_0x014a('0x1a')][_0x014a('0x1b')]()[_0x014a('0x15')](function(_0x12d339){return _0x5aa52f[_0x014a('0x1c')][_0x014a('0x1d')]({'where':{'id':_0x330469[_0x014a('0x1e')]},'include':[{'model':_0x5aa52f[_0x014a('0x12')],'as':_0x014a('0x1f'),'where':{'id':_0x330469[_0x014a('0x14')]},'limit':0x1,'include':[{'model':_0x5aa52f[_0x014a('0x1a')],'as':_0x014a('0x20'),'attributes':_['keys'](_0x12d339)}]}]});})[_0x014a('0x15')](function(_0x109a9c){_0x17e4be=_0x109a9c[_0x014a('0x21')]({'plain':!![]});if(_0x17e4be&&_0x17e4be[_0x014a('0x22')]){logger[_0x014a('0x23')](_0x014a('0x24'),_0x014a('0x25'),util[_0x014a('0x26')](_0x014a('0x27'),_0x330469['id'],_0x17e4be['replyUri']));if(_0x17e4be[_0x014a('0x1f')]&&_0x17e4be['Interactions'][_0x014a('0x28')]){_0x330469[_0x014a('0x29')]=_[_0x014a('0x2a')](_0x17e4be[_0x014a('0x1f')][0x0],_0x014a('0x20'));_0x330469[_0x014a('0x20')]=_0x17e4be[_0x014a('0x1f')][0x0][_0x014a('0x20')];}var _0x4f5506={'method':'POST','uri':encodeURI(_0x17e4be[_0x014a('0x22')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4f5506['method']){case _0x014a('0x2b'):_0x4f5506['qs']=_0x330469;break;case _0x014a('0x2c'):_0x4f5506['body']=_0x330469;break;}return rp(_0x4f5506)['then'](function(_0x9a901f){logger[_0x014a('0x23')](_0x014a('0x24'),'afterCreate',util[_0x014a('0x26')](_0x014a('0x2d'),_0x330469['id'],_0x17e4be['replyUri']));if(_0x9a901f[_0x014a('0x2e')][_0x014a('0x2f')]&&_0x9a901f['body']['threadId']!=_0x330469[_0x014a('0x29')][_0x014a('0x2f')]){return _0x5aa52f[_0x014a('0x12')][_0x014a('0x16')]({'threadId':_0x9a901f['body'][_0x014a('0x2f')]},{'logging':!![],'where':{'id':_0x330469[_0x014a('0x29')]['id']}});}else{return;}})[_0x014a('0x15')](function(){return _0x2519e3[_0x014a('0x16')]({'read':!![]});})[_0x014a('0x18')](function(_0x1eb007){logger[_0x014a('0x19')](_0x014a('0x24'),_0x014a('0x25'),util[_0x014a('0x30')](_0x1eb007,{'showHidden':![],'depth':null}));_0x490ea2();});}else{_0x490ea2();}})[_0x014a('0x31')](function(){_0x490ea2();});}else{_0x490ea2();}}},'charset':'utf8mb4','collate':_0x014a('0x32')});}; \ No newline at end of file +var _0x0abf=['get','toLowerCase','direction','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','CmContact','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','utf8mb4','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','body','FULLTEXT'];(function(_0x426ab4,_0x3aa799){var _0x290c07=function(_0x41ffe4){while(--_0x41ffe4){_0x426ab4['push'](_0x426ab4['shift']());}};_0x290c07(++_0x3aa799);}(_0x0abf,0xe8));var _0xf0ab=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0abf[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var logger=require(_0xf0ab('0x1'))(_0xf0ab('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf0ab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf0ab('0x4'));var config=require(_0xf0ab('0x5'));var attributes=require(_0xf0ab('0x6'));module[_0xf0ab('0x7')]=function(_0x2ab7d6,_0x4d2ea8){return _0x2ab7d6[_0xf0ab('0x8')]('OpenchannelMessage',attributes,{'tableName':_0xf0ab('0x9'),'paranoid':![],'indexes':[{'name':_0xf0ab('0xa'),'fields':[_0xf0ab('0xb')],'type':_0xf0ab('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x480f49,_0x472508,_0x4688d8){var _0x1e7887=_0x2ab7d6['models'];var _0x5d25a0=_0x480f49[_0xf0ab('0xd')]({'plain':!![]});if(_0x5d25a0['direction'][_0xf0ab('0xe')]()==='in'||_0x5d25a0[_0xf0ab('0xf')][_0xf0ab('0xe')]()===_0xf0ab('0x10')&&!_0x5d25a0[_0xf0ab('0x11')]&&!_[_0xf0ab('0x12')](_0x5d25a0[_0xf0ab('0x13')])){_0x1e7887['OpenchannelInteraction'][_0xf0ab('0x14')]({'where':{'id':_0x5d25a0[_0xf0ab('0x15')]}})[_0xf0ab('0x16')](function(_0x35c75f){if(_0x35c75f){_0x35c75f[_0xf0ab('0x17')]({'lastMsgAt':_0x5d25a0[_0xf0ab('0x18')],'lastMsgDirection':_0x5d25a0[_0xf0ab('0xf')][_0xf0ab('0xe')]()});}})[_0xf0ab('0x19')](function(_0x3c5bfd){console[_0xf0ab('0x1a')](_0x3c5bfd);});}if(_0x5d25a0[_0xf0ab('0xf')]===_0xf0ab('0x10')&&!_0x5d25a0[_0xf0ab('0x11')]){var _0x230f40;_0x1e7887['CmContact'][_0xf0ab('0x1b')]()[_0xf0ab('0x16')](function(_0x1803f0){return _0x1e7887[_0xf0ab('0x1c')][_0xf0ab('0x1d')]({'where':{'id':_0x5d25a0[_0xf0ab('0x1e')]},'include':[{'model':_0x1e7887[_0xf0ab('0x1f')],'as':_0xf0ab('0x20'),'where':{'id':_0x5d25a0[_0xf0ab('0x15')]},'limit':0x1,'include':[{'model':_0x1e7887[_0xf0ab('0x21')],'as':_0xf0ab('0x22'),'attributes':_[_0xf0ab('0x23')](_0x1803f0)}]}]});})[_0xf0ab('0x16')](function(_0x22a205){_0x230f40=_0x22a205[_0xf0ab('0xd')]({'plain':!![]});if(_0x230f40&&_0x230f40[_0xf0ab('0x24')]){logger['info'](_0xf0ab('0x25'),_0xf0ab('0x26'),util[_0xf0ab('0x27')](_0xf0ab('0x28'),_0x5d25a0['id'],_0x230f40[_0xf0ab('0x24')]));if(_0x230f40[_0xf0ab('0x20')]&&_0x230f40[_0xf0ab('0x20')][_0xf0ab('0x29')]){_0x5d25a0[_0xf0ab('0x2a')]=_[_0xf0ab('0x2b')](_0x230f40[_0xf0ab('0x20')][0x0],'Contact');_0x5d25a0['Contact']=_0x230f40['Interactions'][0x0][_0xf0ab('0x22')];}var _0x472508={'method':_0xf0ab('0x2c'),'uri':encodeURI(_0x230f40[_0xf0ab('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x472508['method']){case _0xf0ab('0x2d'):_0x472508['qs']=_0x5d25a0;break;case _0xf0ab('0x2c'):_0x472508[_0xf0ab('0xb')]=_0x5d25a0;break;}return rp(_0x472508)[_0xf0ab('0x16')](function(_0x7d4ff9){logger['info'](_0xf0ab('0x25'),'afterCreate',util['format'](_0xf0ab('0x2e'),_0x5d25a0['id'],_0x230f40[_0xf0ab('0x24')]));if(_0x7d4ff9[_0xf0ab('0xb')][_0xf0ab('0x2f')]&&_0x7d4ff9[_0xf0ab('0xb')][_0xf0ab('0x2f')]!=_0x5d25a0[_0xf0ab('0x2a')][_0xf0ab('0x2f')]){return _0x1e7887[_0xf0ab('0x1f')][_0xf0ab('0x17')]({'threadId':_0x7d4ff9[_0xf0ab('0xb')][_0xf0ab('0x2f')]},{'logging':!![],'where':{'id':_0x5d25a0['Interaction']['id']}});}else{return;}})[_0xf0ab('0x16')](function(){return _0x480f49[_0xf0ab('0x17')]({'read':!![]});})['catch'](function(_0x5e8f54){logger[_0xf0ab('0x1a')](_0xf0ab('0x25'),_0xf0ab('0x26'),util['inspect'](_0x5e8f54,{'showHidden':![],'depth':null}));_0x4688d8();});}else{_0x4688d8();}})['finally'](function(){_0x4688d8();});}else{_0x4688d8();}}},'charset':_0xf0ab('0x30'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 76988ef..9ecfc91 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(_0x591080,_0x117e1e){var _0x666f7e=function(_0x1f5fe5){while(--_0x1f5fe5){_0x591080['push'](_0x591080['shift']());}};_0x666f7e(++_0x117e1e);}(_0xdb28,0x106));var _0x8db2=function(_0x400743,_0x14c304){_0x400743=_0x400743-0x0;var _0xfcef9=_0xdb28[_0x400743];return _0xfcef9;};'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 _0x2ef3=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','CreateOpenchannelMessage','create','options','info'];(function(_0x2e0e6d,_0x375753){var _0x454fc4=function(_0xee0416){while(--_0xee0416){_0x2e0e6d['push'](_0x2e0e6d['shift']());}};_0x454fc4(++_0x375753);}(_0x2ef3,0xba));var _0x32ef=function(_0x41b49a,_0x4e0530){_0x41b49a=_0x41b49a-0x0;var _0x1565ab=_0x2ef3[_0x41b49a];return _0x1565ab;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});}exports[_0x32ef('0x1b')]=function(_0x26aff3){var _0x251084=this;return new Promise(function(_0x445cda,_0x3aec05){return db['OpenchannelMessage'][_0x32ef('0x1c')](_0x26aff3['body'],{'raw':_0x26aff3[_0x32ef('0x1d')]?_0x26aff3[_0x32ef('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x32ef('0x11')](function(_0x97780){logger[_0x32ef('0x1e')]('CreateOpenchannelMessage',_0x26aff3);logger['debug'](_0x32ef('0x1b'),_0x26aff3,JSON[_0x32ef('0x15')](_0x97780));_0x445cda(_0x97780);})[_0x32ef('0x1a')](function(_0x478bef){logger['error'](_0x32ef('0x1b'),_0x478bef['message'],_0x26aff3);_0x3aec05(_0x251084['error'](0x1f4,_0x478bef[_0x32ef('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index d9dcc7c..ae6b468 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 _0x4e09=['save','remove','emit','openchannelMessage:','./openchannelMessage.events'];(function(_0x33c663,_0x4416ed){var _0x4c6299=function(_0x4c1937){while(--_0x4c1937){_0x33c663['push'](_0x33c663['shift']());}};_0x4c6299(++_0x4416ed);}(_0x4e09,0x19e));var _0x94e0=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x4e09[_0x138adb];return _0x1b27f2;};'use strict';var OpenchannelMessageEvents=require(_0x94e0('0x0'));var events=[_0x94e0('0x1'),_0x94e0('0x2'),'update'];function createListener(_0xe59325,_0x2da1ea){return function(_0x4bdb98){_0x2da1ea[_0x94e0('0x3')](_0xe59325,_0x4bdb98);};}function removeListener(_0x41dd14,_0x363cfa){return function(){OpenchannelMessageEvents['removeListener'](_0x41dd14,_0x363cfa);};}exports['register']=function(_0x223c25){for(var _0xf6c33d=0x0,_0x457621=events['length'];_0xf6c33d<_0x457621;_0xf6c33d++){var _0x27e0dc=events[_0xf6c33d];var _0x20b916=createListener(_0x94e0('0x4')+_0x27e0dc,_0x223c25);OpenchannelMessageEvents['on'](_0x27e0dc,_0x20b916);}}; \ No newline at end of file +var _0x3f8a=['openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x16f59a,_0x1f0c24){var _0x5c4268=function(_0x4f3808){while(--_0x4f3808){_0x16f59a['push'](_0x16f59a['shift']());}};_0x5c4268(++_0x1f0c24);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x4f14cb,_0x3e514b){_0x4f14cb=_0x4f14cb-0x0;var _0x1766a5=_0x3f8a[_0x4f14cb];return _0x1766a5;};'use strict';var OpenchannelMessageEvents=require(_0xa3f8('0x0'));var events=[_0xa3f8('0x1'),_0xa3f8('0x2'),_0xa3f8('0x3')];function createListener(_0x512b4c,_0x467a6c){return function(_0x143375){_0x467a6c[_0xa3f8('0x4')](_0x512b4c,_0x143375);};}function removeListener(_0x15b6aa,_0x2553fd){return function(){OpenchannelMessageEvents[_0xa3f8('0x5')](_0x15b6aa,_0x2553fd);};}exports[_0xa3f8('0x6')]=function(_0x471464){for(var _0x1f160a=0x0,_0xf895d9=events[_0xa3f8('0x7')];_0x1f160a<_0xf895d9;_0x1f160a++){var _0x268332=events[_0x1f160a];var _0x2faf2e=createListener(_0xa3f8('0x8')+_0x268332,_0x471464);OpenchannelMessageEvents['on'](_0x268332,_0x2faf2e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index ebc3127..4aaaed6 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 _0x3e07=['removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id/teams'];(function(_0x5eff24,_0x5a68cb){var _0x4b0c7f=function(_0x34ef82){while(--_0x34ef82){_0x5eff24['push'](_0x5eff24['shift']());}};_0x4b0c7f(++_0x5a68cb);}(_0x3e07,0x136));var _0x73e0=function(_0x12c676,_0x4e075b){_0x12c676=_0x12c676-0x0;var _0x1d2c8d=_0x3e07[_0x12c676];return _0x1d2c8d;};'use strict';var multer=require('multer');var util=require(_0x73e0('0x0'));var path=require(_0x73e0('0x1'));var timeout=require(_0x73e0('0x2'));var express=require(_0x73e0('0x3'));var router=express[_0x73e0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x73e0('0x5'));var interaction=require(_0x73e0('0x6'));var config=require(_0x73e0('0x7'));var controller=require('./openchannelQueue.controller');router[_0x73e0('0x8')]('/',auth[_0x73e0('0x9')](),controller[_0x73e0('0xa')]);router[_0x73e0('0x8')](_0x73e0('0xb'),auth[_0x73e0('0x9')](),controller[_0x73e0('0xc')]);router['get'](_0x73e0('0xd'),auth[_0x73e0('0x9')](),controller[_0x73e0('0xe')]);router[_0x73e0('0x8')](_0x73e0('0xf'),auth[_0x73e0('0x9')](),controller[_0x73e0('0x10')]);router[_0x73e0('0x8')]('/:id/teams',auth[_0x73e0('0x9')](),controller[_0x73e0('0x11')]);router['get'](_0x73e0('0x12'),auth[_0x73e0('0x9')](),controller[_0x73e0('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x73e0('0x14')]('/:id/teams',auth[_0x73e0('0x9')](),controller[_0x73e0('0x15')]);router[_0x73e0('0x14')](_0x73e0('0x12'),auth[_0x73e0('0x9')](),controller[_0x73e0('0x16')]);router['put'](_0x73e0('0xd'),auth[_0x73e0('0x9')](),controller[_0x73e0('0x17')]);router[_0x73e0('0x18')](_0x73e0('0xd'),auth[_0x73e0('0x9')](),controller['destroy']);router[_0x73e0('0x18')](_0x73e0('0x19'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x73e0('0x18')](_0x73e0('0x12'),auth['isAuthenticated'](),controller[_0x73e0('0x1a')]);module[_0x73e0('0x1b')]=router; \ No newline at end of file +var _0x58d5=['destroy','removeTeams','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','/:id','show','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','delete'];(function(_0x10229e,_0x5be28c){var _0xe49eed=function(_0x4755d9){while(--_0x4755d9){_0x10229e['push'](_0x10229e['shift']());}};_0xe49eed(++_0x5be28c);}(_0x58d5,0x67));var _0x558d=function(_0x391230,_0x2fe045){_0x391230=_0x391230-0x0;var _0x3f2ca1=_0x58d5[_0x391230];return _0x3f2ca1;};'use strict';var multer=require('multer');var util=require(_0x558d('0x0'));var path=require(_0x558d('0x1'));var timeout=require(_0x558d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x558d('0x3'));var interaction=require(_0x558d('0x4'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x558d('0x5')]('/',auth[_0x558d('0x6')](),controller['index']);router[_0x558d('0x5')](_0x558d('0x7'),auth[_0x558d('0x6')](),controller['describe']);router[_0x558d('0x5')](_0x558d('0x8'),auth['isAuthenticated'](),controller[_0x558d('0x9')]);router['get']('/:id/members',auth[_0x558d('0x6')](),controller['getMembers']);router[_0x558d('0x5')](_0x558d('0xa'),auth[_0x558d('0x6')](),controller[_0x558d('0xb')]);router[_0x558d('0x5')](_0x558d('0xc'),auth['isAuthenticated'](),controller[_0x558d('0xd')]);router[_0x558d('0xe')]('/',auth[_0x558d('0x6')](),controller['create']);router[_0x558d('0xe')](_0x558d('0xa'),auth[_0x558d('0x6')](),controller['addTeams']);router['post'](_0x558d('0xc'),auth[_0x558d('0x6')](),controller[_0x558d('0xf')]);router['put'](_0x558d('0x8'),auth[_0x558d('0x6')](),controller['update']);router[_0x558d('0x10')]('/:id',auth[_0x558d('0x6')](),controller[_0x558d('0x11')]);router[_0x558d('0x10')](_0x558d('0xa'),auth['isAuthenticated'](),controller[_0x558d('0x12')]);router[_0x558d('0x10')](_0x558d('0xc'),auth[_0x558d('0x6')](),controller['removeAgents']);module[_0x558d('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index da8b8ec..896074d 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 _0x4ff1=['name','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4ff1,0x1a1));var _0x14ff=function(_0x42e98c,_0x1c6bb9){_0x42e98c=_0x42e98c-0x0;var _0x59803e=_0x4ff1[_0x42e98c];return _0x59803e;};'use strict';var Sequelize=require(_0x14ff('0x0'));module[_0x14ff('0x1')]={'name':{'type':Sequelize[_0x14ff('0x2')],'unique':_0x14ff('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x14ff('0x4'),_0x14ff('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x01a7=['sequelize','STRING','name','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x3af704,_0x58486b){var _0x4ac16c=function(_0x1a49b8){while(--_0x1a49b8){_0x3af704['push'](_0x3af704['shift']());}};_0x4ac16c(++_0x58486b);}(_0x01a7,0x17a));var _0x701a=function(_0x41e81d,_0x2be61e){_0x41e81d=_0x41e81d-0x0;var _0x40292d=_0x01a7[_0x41e81d];return _0x40292d;};'use strict';var Sequelize=require(_0x701a('0x0'));module['exports']={'name':{'type':Sequelize[_0x701a('0x1')],'unique':_0x701a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x701a('0x1')]},'timeout':{'type':Sequelize[_0x701a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x701a('0x4'),_0x701a('0x5'),_0x701a('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index b8745f8..ded020a 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 _0x71c8=['addTeams','ids','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','SELECT','every','TeamId','includes','compact','value','emit','userOpenchannelQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','eml-format','zip-dir','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','get','OpenchannelQueues','end','error','stack','name','send','index','rawAttributes','type','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','map','VIRTUAL','options','OpenchannelQueue','includeAll','findAll','params','include','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','body','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','OpenchannelQueueId','filter','User','UserId','agent','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams'];(function(_0x112a9c,_0x3fab35){var _0x2a3455=function(_0x4aa6e7){while(--_0x4aa6e7){_0x112a9c['push'](_0x112a9c['shift']());}};_0x2a3455(++_0x3fab35);}(_0x71c8,0x135));var _0x871c=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x71c8[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x871c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x871c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x871c('0x2'));var BPromise=require(_0x871c('0x3'));var Mustache=require(_0x871c('0x4'));var util=require('util');var path=require('path');var sox=require(_0x871c('0x5'));var csv=require('to-csv');var ejs=require(_0x871c('0x6'));var fs=require('fs');var fs_extra=require(_0x871c('0x7'));var _=require(_0x871c('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x871c('0x9'));var toCsv=require(_0x871c('0xa'));var querystring=require('querystring');var Papa=require(_0x871c('0xb'));var Redis=require(_0x871c('0xc'));var authService=require(_0x871c('0xd'));var qs=require(_0x871c('0xe'));var as=require(_0x871c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x871c('0x10'))(_0x871c('0x11'));var utils=require('../../config/utils');var config=require(_0x871c('0x12'));var licenseUtil=require(_0x871c('0x13'));var db=require(_0x871c('0x14'))['db'];config[_0x871c('0x15')]=_[_0x871c('0x16')](config['redis'],{'host':_0x871c('0x17'),'port':0x18eb});var socket=require(_0x871c('0x18'))(new Redis(config[_0x871c('0x15')]));require('./openchannelQueue.socket')[_0x871c('0x19')](socket);function respondWithStatusCode(_0x45edca,_0x4967c0){_0x4967c0=_0x4967c0||0xcc;return function(_0x5b1376){if(_0x5b1376){return _0x45edca[_0x871c('0x1a')](_0x4967c0);}return _0x45edca[_0x871c('0x1b')](_0x4967c0)['end']();};}function respondWithResult(_0xb74b9d,_0x294350){_0x294350=_0x294350||0xc8;return function(_0x23100a){if(_0x23100a){return _0xb74b9d[_0x871c('0x1b')](_0x294350)[_0x871c('0x1c')](_0x23100a);}};}function respondWithFilteredResult(_0xab3ffe,_0x2cb96e){return function(_0x36189b){if(_0x36189b){var _0x5a2a88=typeof _0x2cb96e[_0x871c('0x1d')]===_0x871c('0x1e')&&typeof _0x2cb96e[_0x871c('0x1f')]===_0x871c('0x1e');var _0x292c34=_0x36189b['count'];var _0x34d227=_0x5a2a88?0x0:_0x2cb96e[_0x871c('0x1d')];var _0x4722aa=_0x5a2a88?_0x36189b[_0x871c('0x20')]:_0x2cb96e['offset']+_0x2cb96e[_0x871c('0x1f')];var _0x1d0cd4;if(_0x4722aa>=_0x292c34){_0x4722aa=_0x292c34;_0x1d0cd4=0xc8;}else{_0x1d0cd4=0xce;}_0xab3ffe[_0x871c('0x1b')](_0x1d0cd4);return _0xab3ffe['set']('Content-Range',_0x34d227+'-'+_0x4722aa+'/'+_0x292c34)[_0x871c('0x1c')](_0x36189b);}return null;};}function patchUpdates(_0x1c2be0){return function(_0x32b339){try{jsonpatch[_0x871c('0x21')](_0x32b339,_0x1c2be0,!![]);}catch(_0x1ef4aa){return BPromise[_0x871c('0x22')](_0x1ef4aa);}return _0x32b339[_0x871c('0x23')]();};}function saveUpdates(_0x7995eb,_0x47d2c5){return function(_0x224d31){if(_0x224d31){return _0x224d31[_0x871c('0x24')](_0x7995eb)[_0x871c('0x25')](function(_0x471c0d){return _0x471c0d;});}return null;};}function removeEntity(_0x26f20e,_0x35fca2){return function(_0x5d0fd3){if(_0x5d0fd3){return _0x5d0fd3[_0x871c('0x26')]()[_0x871c('0x25')](function(){var _0x379266=_0x5d0fd3[_0x871c('0x27')]({'plain':!![]});var _0x4b5bd7=_0x871c('0x28');return db['UserProfileResource'][_0x871c('0x26')]({'where':{'type':_0x4b5bd7,'resourceId':_0x379266['id']}})[_0x871c('0x25')](function(){return _0x5d0fd3;});})[_0x871c('0x25')](function(){_0x26f20e['status'](0xcc)[_0x871c('0x29')]();});}};}function handleEntityNotFound(_0x287cb3,_0x3cc055){return function(_0x116f78){if(!_0x116f78){_0x287cb3['sendStatus'](0x194);}return _0x116f78;};}function handleError(_0x55583c,_0x3298be){_0x3298be=_0x3298be||0x1f4;return function(_0x5af27c){logger[_0x871c('0x2a')](_0x5af27c[_0x871c('0x2b')]);if(_0x5af27c[_0x871c('0x2c')]){delete _0x5af27c[_0x871c('0x2c')];}_0x55583c[_0x871c('0x1b')](_0x3298be)[_0x871c('0x2d')](_0x5af27c);};}exports[_0x871c('0x2e')]=function(_0x4bbfe2,_0x53473a){var _0x3fc1d5={},_0x217d31={},_0xbf512d={'count':0x0,'rows':[]};var _0x3e3fdd=_['map'](db['OpenchannelQueue'][_0x871c('0x2f')],function(_0x3effdc){return{'name':_0x3effdc['fieldName'],'type':_0x3effdc[_0x871c('0x30')]['key']};});_0x217d31[_0x871c('0x31')]=_['map'](_0x3e3fdd,_0x871c('0x2c'));_0x217d31[_0x871c('0x32')]=_[_0x871c('0x33')](_0x4bbfe2[_0x871c('0x32')]);_0x217d31['filters']=_[_0x871c('0x34')](_0x217d31['model'],_0x217d31[_0x871c('0x32')]);_0x3fc1d5['attributes']=_['intersection'](_0x217d31[_0x871c('0x31')],qs[_0x871c('0x35')](_0x4bbfe2[_0x871c('0x32')][_0x871c('0x35')]));_0x3fc1d5['attributes']=_0x3fc1d5[_0x871c('0x36')][_0x871c('0x37')]?_0x3fc1d5['attributes']:_0x217d31[_0x871c('0x31')];if(!_0x4bbfe2[_0x871c('0x32')]['hasOwnProperty'](_0x871c('0x38'))){_0x3fc1d5[_0x871c('0x1f')]=qs[_0x871c('0x1f')](_0x4bbfe2[_0x871c('0x32')][_0x871c('0x1f')]);_0x3fc1d5[_0x871c('0x1d')]=qs[_0x871c('0x1d')](_0x4bbfe2[_0x871c('0x32')][_0x871c('0x1d')]);}_0x3fc1d5[_0x871c('0x39')]=qs['sort'](_0x4bbfe2['query'][_0x871c('0x3a')]);_0x3fc1d5[_0x871c('0x3b')]=qs[_0x871c('0x3c')](_[_0x871c('0x3d')](_0x4bbfe2[_0x871c('0x32')],_0x217d31['filters']),_0x3e3fdd);if(_0x4bbfe2['query']['filter']){_0x3fc1d5['where']=_[_0x871c('0x3e')](_0x3fc1d5['where'],{'$or':_[_0x871c('0x3f')](_0x3e3fdd,function(_0x560851){if(_0x560851[_0x871c('0x30')]!==_0x871c('0x40')){var _0x3b2f72={};_0x3b2f72[_0x560851['name']]={'$like':'%'+_0x4bbfe2['query']['filter']+'%'};return _0x3b2f72;}})});}_0x3fc1d5=_[_0x871c('0x3e')]({},_0x3fc1d5,_0x4bbfe2[_0x871c('0x41')]);var _0x949daa={'where':_0x3fc1d5['where']};return db[_0x871c('0x42')][_0x871c('0x20')](_0x949daa)['then'](function(_0x3f0bde){_0xbf512d[_0x871c('0x20')]=_0x3f0bde;if(_0x4bbfe2[_0x871c('0x32')][_0x871c('0x43')]){_0x3fc1d5['include']=[{'all':!![]}];}return db[_0x871c('0x42')][_0x871c('0x44')](_0x3fc1d5);})[_0x871c('0x25')](function(_0x5c6cb6){_0xbf512d['rows']=_0x5c6cb6;return _0xbf512d;})['then'](respondWithFilteredResult(_0x53473a,_0x3fc1d5))['catch'](handleError(_0x53473a,null));};exports['show']=function(_0x50362e,_0xf52637){var _0x1a64ba={'raw':!![],'where':{'id':_0x50362e[_0x871c('0x45')]['id']}},_0x4ff22d={};_0x4ff22d['model']=_[_0x871c('0x33')](db[_0x871c('0x42')][_0x871c('0x2f')]);_0x4ff22d[_0x871c('0x32')]=_[_0x871c('0x33')](_0x50362e['query']);_0x4ff22d['filters']=_[_0x871c('0x34')](_0x4ff22d[_0x871c('0x31')],_0x4ff22d[_0x871c('0x32')]);_0x1a64ba[_0x871c('0x36')]=_[_0x871c('0x34')](_0x4ff22d[_0x871c('0x31')],qs[_0x871c('0x35')](_0x50362e[_0x871c('0x32')][_0x871c('0x35')]));_0x1a64ba['attributes']=_0x1a64ba['attributes'][_0x871c('0x37')]?_0x1a64ba[_0x871c('0x36')]:_0x4ff22d[_0x871c('0x31')];if(_0x50362e[_0x871c('0x32')][_0x871c('0x43')]){_0x1a64ba[_0x871c('0x46')]=[{'all':!![]}];}_0x1a64ba=_[_0x871c('0x3e')]({},_0x1a64ba,_0x50362e[_0x871c('0x41')]);return db[_0x871c('0x42')]['find'](_0x1a64ba)['then'](handleEntityNotFound(_0xf52637,null))[_0x871c('0x25')](respondWithResult(_0xf52637,null))[_0x871c('0x47')](handleError(_0xf52637,null));};exports['create']=function(_0x4d7965,_0x493168){return db['OpenchannelQueue'][_0x871c('0x48')](_0x4d7965['body'],{})[_0x871c('0x25')](function(_0x1e0c93){var _0x29fba0=_0x4d7965[_0x871c('0x49')][_0x871c('0x27')]({'plain':!![]});if(!_0x29fba0)throw new Error(_0x871c('0x4a'));if(_0x29fba0[_0x871c('0x4b')]===_0x871c('0x49')){var _0x30cfee=_0x1e0c93[_0x871c('0x27')]({'plain':!![]});var _0x4562d5=_0x871c('0x28');return db['UserProfileSection'][_0x871c('0x4c')]({'where':{'name':_0x4562d5,'userProfileId':_0x29fba0[_0x871c('0x4d')]},'raw':!![]})[_0x871c('0x25')](function(_0x6e2bc6){if(_0x6e2bc6&&_0x6e2bc6[_0x871c('0x4e')]===0x0){return db[_0x871c('0x4f')][_0x871c('0x48')]({'name':_0x30cfee[_0x871c('0x2c')],'resourceId':_0x30cfee['id'],'type':_0x6e2bc6[_0x871c('0x2c')],'sectionId':_0x6e2bc6['id']},{})[_0x871c('0x25')](function(){return _0x1e0c93;});}else{return _0x1e0c93;}})['catch'](function(_0x1d4f96){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d4f96);throw _0x1d4f96;});}return _0x1e0c93;})[_0x871c('0x25')](respondWithResult(_0x493168,0xc9))[_0x871c('0x47')](handleError(_0x493168,null));};exports[_0x871c('0x24')]=function(_0x4eedce,_0x4079e8){if(_0x4eedce[_0x871c('0x50')]['id']){delete _0x4eedce[_0x871c('0x50')]['id'];}return db['OpenchannelQueue'][_0x871c('0x4c')]({'where':{'id':_0x4eedce['params']['id']}})[_0x871c('0x25')](handleEntityNotFound(_0x4079e8,null))[_0x871c('0x25')](saveUpdates(_0x4eedce[_0x871c('0x50')],null))[_0x871c('0x25')](respondWithResult(_0x4079e8,null))[_0x871c('0x47')](handleError(_0x4079e8,null));};exports[_0x871c('0x26')]=function(_0x54550e,_0x67a4d2){return db[_0x871c('0x42')][_0x871c('0x4c')]({'where':{'id':_0x54550e[_0x871c('0x45')]['id']}})['then'](handleEntityNotFound(_0x67a4d2,null))[_0x871c('0x25')](removeEntity(_0x67a4d2,null))[_0x871c('0x47')](handleError(_0x67a4d2,null));};exports[_0x871c('0x51')]=function(_0x18ff0f,_0x357db5){return db['OpenchannelQueue'][_0x871c('0x51')]()['then'](respondWithResult(_0x357db5,null))['catch'](handleError(_0x357db5,null));};exports[_0x871c('0x52')]=function(_0x541368,_0x3ef0ca,_0x3e0a89){var _0x1ba8c8={'raw':!![],'where':{}},_0x2ed7a8={},_0x196524;return db[_0x871c('0x42')][_0x871c('0x53')]({'where':{'id':_0x541368[_0x871c('0x45')]['id']}})[_0x871c('0x25')](handleEntityNotFound(_0x3ef0ca,null))[_0x871c('0x25')](function(_0x2c5111){if(_0x2c5111){_0x196524=_0x2c5111[_0x871c('0x27')]({'plain':!![]});_0x2ed7a8['model']=_['keys'](db[_0x871c('0x54')]['rawAttributes']);_0x2ed7a8[_0x871c('0x32')]=_[_0x871c('0x33')](_0x541368['query']);_0x2ed7a8[_0x871c('0x3c')]=_[_0x871c('0x34')](_0x2ed7a8[_0x871c('0x31')],_0x2ed7a8[_0x871c('0x32')]);_0x1ba8c8[_0x871c('0x36')]=_[_0x871c('0x34')](_0x2ed7a8[_0x871c('0x31')],qs[_0x871c('0x35')](_0x541368[_0x871c('0x32')]['fields']));_0x1ba8c8[_0x871c('0x36')]=_0x1ba8c8[_0x871c('0x36')][_0x871c('0x37')]?_0x1ba8c8['attributes']:_0x2ed7a8[_0x871c('0x31')];if(!_0x541368[_0x871c('0x32')][_0x871c('0x55')](_0x871c('0x38'))){_0x1ba8c8[_0x871c('0x1f')]=qs['limit'](_0x541368[_0x871c('0x32')]['limit']);_0x1ba8c8[_0x871c('0x1d')]=qs[_0x871c('0x1d')](_0x541368[_0x871c('0x32')][_0x871c('0x1d')]);}_0x1ba8c8[_0x871c('0x39')]=qs[_0x871c('0x3a')](_0x541368[_0x871c('0x32')][_0x871c('0x3a')]);_0x1ba8c8[_0x871c('0x3b')]=qs['filters'](_['pick'](_0x541368[_0x871c('0x32')],_0x2ed7a8['filters']));_0x1ba8c8[_0x871c('0x3b')][_0x871c('0x56')]=_0x2c5111['id'];if(_0x541368[_0x871c('0x32')]['filter']){_0x1ba8c8[_0x871c('0x3b')]=_[_0x871c('0x3e')](_0x1ba8c8[_0x871c('0x3b')],{'$or':_[_0x871c('0x3f')](_0x1ba8c8[_0x871c('0x36')],function(_0x2759ac){var _0x415af3={};_0x415af3[_0x2759ac]={'$like':'%'+_0x541368[_0x871c('0x32')][_0x871c('0x57')]+'%'};return _0x415af3;})});}_0x1ba8c8=_[_0x871c('0x3e')]({},_0x1ba8c8,_0x541368[_0x871c('0x41')]);return db[_0x871c('0x54')]['findAll'](_0x1ba8c8);}})['then'](function(_0x1310e0){if(_0x1310e0){return db[_0x871c('0x58')]['findAndCountAll']({'where':{'id':_[_0x871c('0x3f')](_0x1310e0,_0x871c('0x59')),'role':_0x871c('0x5a')},'attributes':['id','name',_0x871c('0x5b'),_0x871c('0x5c'),_0x871c('0x5d')]});}})[_0x871c('0x25')](function(_0x2ce0cb){if(_0x2ce0cb){return{'count':_0x2ce0cb[_0x871c('0x20')],'rows':_[_0x871c('0x3f')](_0x2ce0cb[_0x871c('0x5e')],function(_0x509cc0){return{'membername':_0x509cc0[_0x871c('0x2c')],'UserId':_0x509cc0['id'],'queue_name':_0x196524[_0x871c('0x2c')],'OpenchannelQueueId':_0x196524['id'],'interface':util[_0x871c('0x5f')](_0x871c('0x60'),_0x871c('0x61'),_0x509cc0[_0x871c('0x2c')]),'penalty':0x0,'paused':_0x509cc0[_0x871c('0x5b')],'createdAt':_0x509cc0[_0x871c('0x5d')],'updatedAt':_0x509cc0[_0x871c('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x871c('0x25')](respondWithFilteredResult(_0x3ef0ca,_0x1ba8c8))[_0x871c('0x47')](handleError(_0x3ef0ca,null));};exports['getTeams']=function(_0x193e36,_0x2bb8a8,_0x321925){var _0x8b80e1={};var _0x552749={};var _0x2cccb8;var _0x27d7d9;return db[_0x871c('0x42')][_0x871c('0x53')]({'where':{'id':_0x193e36['params']['id']}})[_0x871c('0x25')](handleEntityNotFound(_0x2bb8a8,null))[_0x871c('0x25')](function(_0x319439){if(_0x319439){_0x2cccb8=_0x319439;_0x552749[_0x871c('0x31')]=_[_0x871c('0x33')](db['Team']['rawAttributes']);_0x552749[_0x871c('0x32')]=_['keys'](_0x193e36['query']);_0x552749[_0x871c('0x3c')]=_['intersection'](_0x552749[_0x871c('0x31')],_0x552749[_0x871c('0x32')]);_0x8b80e1[_0x871c('0x36')]=_['intersection'](_0x552749[_0x871c('0x31')],qs[_0x871c('0x35')](_0x193e36[_0x871c('0x32')]['fields']));_0x8b80e1['attributes']=_0x8b80e1[_0x871c('0x36')][_0x871c('0x37')]?_0x8b80e1[_0x871c('0x36')]:_0x552749[_0x871c('0x31')];_0x8b80e1[_0x871c('0x39')]=qs[_0x871c('0x3a')](_0x193e36[_0x871c('0x32')][_0x871c('0x3a')]);_0x8b80e1['where']=qs[_0x871c('0x3c')](_['pick'](_0x193e36['query'],_0x552749[_0x871c('0x3c')]));if(_0x193e36[_0x871c('0x32')][_0x871c('0x57')]){_0x8b80e1[_0x871c('0x3b')]=_[_0x871c('0x3e')](_0x8b80e1['where'],{'$or':_[_0x871c('0x3f')](_0x8b80e1[_0x871c('0x36')],function(_0x585c3e){var _0x498023={};_0x498023[_0x585c3e]={'$like':'%'+_0x193e36[_0x871c('0x32')][_0x871c('0x57')]+'%'};return _0x498023;})});}_0x8b80e1=_[_0x871c('0x3e')]({},_0x8b80e1,_0x193e36[_0x871c('0x41')]);return _0x2cccb8[_0x871c('0x62')](_0x8b80e1);}})[_0x871c('0x25')](function(_0x1f7798){if(_0x1f7798){_0x27d7d9=_0x1f7798['length'];if(!_0x193e36['query'][_0x871c('0x55')](_0x871c('0x38'))){_0x8b80e1[_0x871c('0x1f')]=qs['limit'](_0x193e36[_0x871c('0x32')][_0x871c('0x1f')]);_0x8b80e1[_0x871c('0x1d')]=qs[_0x871c('0x1d')](_0x193e36[_0x871c('0x32')][_0x871c('0x1d')]);}return _0x2cccb8[_0x871c('0x62')](_0x8b80e1);}})[_0x871c('0x25')](function(_0x25f377){if(_0x25f377){return _0x25f377?{'count':_0x27d7d9,'rows':_0x25f377}:null;}})[_0x871c('0x25')](respondWithResult(_0x2bb8a8,null))[_0x871c('0x47')](handleError(_0x2bb8a8,null));};exports[_0x871c('0x63')]=function(_0x3c7666,_0x1765ed,_0x5215f5){var _0x46a72d=_0x3c7666[_0x871c('0x50')][_0x871c('0x64')];return db[_0x871c('0x65')][_0x871c('0x44')]({'where':{'id':_0x46a72d},'attributes':['id'],'include':[{'model':db[_0x871c('0x58')],'as':_0x871c('0x66'),'attributes':['id',_0x871c('0x2c'),_0x871c('0x67'),_0x871c('0x68'),'interface'],'raw':!![]}]})[_0x871c('0x25')](function(_0x163794){if(_0x163794){var _0x436508=_[_0x871c('0x69')](_0x163794,function(_0x3ad363){var _0x7a64a6=_0x3ad363[_0x871c('0x27')]({'plain':!![]});return _0x7a64a6['Agents'];});return db[_0x871c('0x42')][_0x871c('0x4c')]({'where':{'id':_0x3c7666[_0x871c('0x45')]['id']}})['then'](function(_0x5e1466){return db[_0x871c('0x6a')][_0x871c('0x6b')](function(_0x287dfa){return _0x5e1466[_0x871c('0x63')](_0x46a72d,{'transaction':_0x287dfa})[_0x871c('0x25')](function(){return BPromise[_0x871c('0x6c')](_0x436508,function(_0x4971bd){return db['UserOpenchannelQueue'][_0x871c('0x6d')]({'where':{'UserId':_0x4971bd['id'],'OpenchannelQueueId':_0x3c7666[_0x871c('0x45')]['id']},'transaction':_0x287dfa});});})[_0x871c('0x25')](function(){_0x436508[_0x871c('0x6e')](function(_0x192dd1){socket['emit'](_0x871c('0x6f'),{'UserId':_0x192dd1['id'],'OpenchannelQueueId':_0x5e1466['id']});});});});});}})['then'](respondWithStatusCode(_0x1765ed,null))[_0x871c('0x47')](handleError(_0x1765ed,null));};exports[_0x871c('0x70')]=function(_0x4d035b,_0x3f85ce,_0xa3cf2d){return db[_0x871c('0x65')][_0x871c('0x44')]({'where':{'id':_0x4d035b[_0x871c('0x32')][_0x871c('0x64')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x871c('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3f85ce,null))[_0x871c('0x25')](function(_0x2c439c){var _0xfddeec=_[_0x871c('0x3f')](_0x2c439c,'id');var _0x3acad8=[];var _0x20efda=[];var _0x171d51=squel[_0x871c('0x71')]();_0x171d51[_0x871c('0x72')]('tq.TeamId')[_0x871c('0x73')](_0x871c('0x74'),'tq')[_0x871c('0x75')](_0x871c('0x76'),'ut',_0x871c('0x77'))[_0x871c('0x3b')](_0x871c('0x78'),_0x4d035b['params']['id']);for(var _0xff4277=0x0;_0xff4277<_0x2c439c[_0x871c('0x37')];_0xff4277+=0x1){let _0x3f9189=_0x2c439c[_0xff4277];for(var _0x126f4e=0x0;_0x126f4e<_0x3f9189[_0x871c('0x66')][_0x871c('0x37')];_0x126f4e+=0x1){let _0x535862=_0x3f9189[_0x871c('0x66')][_0x126f4e];var _0x2fa37a=_0x171d51[_0x871c('0x79')]();_0x2fa37a['where']('ut.UserId\x20=\x20?',_0x535862['id']);_0x20efda['push'](db['sequelize'][_0x871c('0x32')](_0x2fa37a[_0x871c('0x7a')](),{'type':db[_0x871c('0x6a')]['QueryTypes'][_0x871c('0x7b')]})[_0x871c('0x25')](function(_0x59abb6){if(_0x59abb6[_0x871c('0x37')]===0x1){return _0x535862['id'];}else{var _0x51a79d=_[_0x871c('0x7c')](_[_0x871c('0x3f')](_0x59abb6,_0x871c('0x7d')),function(_0x19ef40){return _[_0x871c('0x7e')](_0xfddeec,_0x19ef40);});if(_0x51a79d){return _0x535862['id'];}}}));}}return BPromise['all'](_0x20efda)['then'](function(_0xb48be4){_0x3acad8=_(_0x3acad8)['union'](_0xb48be4)[_0x871c('0x7f')]()[_0x871c('0x80')]();return db[_0x871c('0x42')][_0x871c('0x4c')]({'where':{'id':_0x4d035b[_0x871c('0x45')]['id']}})[_0x871c('0x25')](function(_0x4b6452){return db[_0x871c('0x6a')][_0x871c('0x6b')](function(_0x42cd60){return _0x4b6452[_0x871c('0x70')](_0x4d035b[_0x871c('0x32')]['ids'],{'transaction':_0x42cd60})[_0x871c('0x25')](function(){if(!_['isEmpty'](_0x3acad8)){return _0x4b6452['removeAgents'](_0x3acad8,{'transaction':_0x42cd60});}})[_0x871c('0x25')](function(){_0x3acad8['forEach'](function(_0x3b5941){socket[_0x871c('0x81')](_0x871c('0x82'),{'UserId':_0x3b5941,'OpenchannelQueueId':_0x4b6452['id']});});});});});});})[_0x871c('0x25')](respondWithStatusCode(_0x3f85ce,null))['catch'](handleError(_0x3f85ce,null));};exports[_0x871c('0x83')]=function(_0x526164,_0x3cbb6b,_0x4abef9){return db[_0x871c('0x42')][_0x871c('0x4c')]({'where':{'id':_0x526164[_0x871c('0x45')]['id']}})['then'](handleEntityNotFound(_0x3cbb6b,null))['then'](function(_0x79e4aa){if(_0x79e4aa){return _0x79e4aa['addAgents'](_0x526164[_0x871c('0x50')][_0x871c('0x64')],_[_0x871c('0x84')](_0x526164[_0x871c('0x50')],['ids','id'])||{})['spread'](function(_0x5b6f26){for(var _0x4e80d3=0x0;_0x4e80d3<_0x526164[_0x871c('0x50')]['ids'][_0x871c('0x37')];_0x4e80d3+=0x1){socket[_0x871c('0x81')](_0x871c('0x6f'),{'UserId':Number(_0x526164[_0x871c('0x50')][_0x871c('0x64')][_0x4e80d3]),'OpenchannelQueueId':Number(_0x526164[_0x871c('0x45')]['id'])});}return _0x5b6f26;});}})['then'](respondWithResult(_0x3cbb6b,null))[_0x871c('0x47')](handleError(_0x3cbb6b,null));};exports[_0x871c('0x85')]=function(_0x4d4b18,_0x3aca01,_0x3aa3ac){return db[_0x871c('0x42')][_0x871c('0x4c')]({'where':{'id':_0x4d4b18[_0x871c('0x45')]['id']}})['then'](handleEntityNotFound(_0x3aca01,null))['then'](function(_0xca1d91){if(_0xca1d91){return _0xca1d91[_0x871c('0x85')](_0x4d4b18[_0x871c('0x32')][_0x871c('0x64')])[_0x871c('0x25')](function(){if(_[_0x871c('0x86')](_0x4d4b18[_0x871c('0x32')][_0x871c('0x64')])){for(var _0x596b5b=0x0;_0x596b5b<_0x4d4b18[_0x871c('0x32')][_0x871c('0x64')][_0x871c('0x37')];_0x596b5b+=0x1){socket[_0x871c('0x81')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4d4b18[_0x871c('0x32')][_0x871c('0x64')][_0x596b5b]),'OpenchannelQueueId':Number(_0x4d4b18[_0x871c('0x45')]['id'])});}}else{socket[_0x871c('0x81')](_0x871c('0x82'),{'UserId':Number(_0x4d4b18['query'][_0x871c('0x64')]),'OpenchannelQueueId':Number(_0x4d4b18[_0x871c('0x45')]['id'])});}});}})[_0x871c('0x25')](respondWithStatusCode(_0x3aca01,null))['catch'](handleError(_0x3aca01,null));};exports[_0x871c('0x87')]=function(_0x1932d8,_0x95d23c,_0x5ea7da){var _0x5adc20={};var _0x4f9abd={};var _0x4c00a1;var _0x152a0f;return db[_0x871c('0x42')]['findOne']({'where':{'id':_0x1932d8['params']['id']}})['then'](handleEntityNotFound(_0x95d23c,null))['then'](function(_0x10af90){if(_0x10af90){_0x4c00a1=_0x10af90;_0x4f9abd[_0x871c('0x31')]=_[_0x871c('0x33')](db['User'][_0x871c('0x2f')]);_0x4f9abd['query']=_[_0x871c('0x33')](_0x1932d8['query']);_0x4f9abd['filters']=_[_0x871c('0x34')](_0x4f9abd[_0x871c('0x31')],_0x4f9abd[_0x871c('0x32')]);_0x5adc20[_0x871c('0x36')]=_[_0x871c('0x34')](_0x4f9abd[_0x871c('0x31')],qs['fields'](_0x1932d8['query'][_0x871c('0x35')]));_0x5adc20[_0x871c('0x36')]=_0x5adc20['attributes']['length']?_0x5adc20[_0x871c('0x36')]:_0x4f9abd[_0x871c('0x31')];_0x5adc20[_0x871c('0x39')]=qs[_0x871c('0x3a')](_0x1932d8[_0x871c('0x32')][_0x871c('0x3a')]);_0x5adc20[_0x871c('0x3b')]=qs[_0x871c('0x3c')](_[_0x871c('0x3d')](_0x1932d8[_0x871c('0x32')],_0x4f9abd[_0x871c('0x3c')]));if(_0x1932d8['query']['filter']){_0x5adc20[_0x871c('0x3b')]=_['merge'](_0x5adc20[_0x871c('0x3b')],{'$or':_[_0x871c('0x3f')](_0x5adc20['attributes'],function(_0xb369da){var _0x942bed={};_0x942bed[_0xb369da]={'$like':'%'+_0x1932d8[_0x871c('0x32')][_0x871c('0x57')]+'%'};return _0x942bed;})});}_0x5adc20=_[_0x871c('0x3e')]({},_0x5adc20,_0x1932d8[_0x871c('0x41')]);return _0x4c00a1[_0x871c('0x87')](_0x5adc20);}})['then'](function(_0x5442cd){if(_0x5442cd){_0x152a0f=_0x5442cd[_0x871c('0x37')];if(!_0x1932d8[_0x871c('0x32')]['hasOwnProperty']('nolimit')){_0x5adc20[_0x871c('0x1f')]=qs[_0x871c('0x1f')](_0x1932d8[_0x871c('0x32')][_0x871c('0x1f')]);_0x5adc20[_0x871c('0x1d')]=qs[_0x871c('0x1d')](_0x1932d8['query'][_0x871c('0x1d')]);}return _0x4c00a1[_0x871c('0x87')](_0x5adc20);}})[_0x871c('0x25')](function(_0x10f906){if(_0x10f906){return _0x10f906?{'count':_0x152a0f,'rows':_0x10f906}:null;}})['then'](respondWithResult(_0x95d23c,null))[_0x871c('0x47')](handleError(_0x95d23c,null));}; \ No newline at end of file +var _0xb83f=['OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','rows','%s/%s','SIP','updatedAt','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','forEach','emit','userOpenchannelQueue:save','removeTeams','ids','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','addAgents','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','get','destroy','status','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelQueues','UserProfileSection','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue'];(function(_0x341a47,_0x218ada){var _0xb5cda=function(_0xb4384e){while(--_0xb4384e){_0x341a47['push'](_0x341a47['shift']());}};_0xb5cda(++_0x218ada);}(_0xb83f,0xc0));var _0xfb83=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb83f[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0xfb83('0x0'));var rimraf=require(_0xfb83('0x1'));var zipdir=require(_0xfb83('0x2'));var jsonpatch=require(_0xfb83('0x3'));var rp=require(_0xfb83('0x4'));var moment=require(_0xfb83('0x5'));var BPromise=require(_0xfb83('0x6'));var Mustache=require(_0xfb83('0x7'));var util=require('util');var path=require(_0xfb83('0x8'));var sox=require(_0xfb83('0x9'));var csv=require(_0xfb83('0xa'));var ejs=require(_0xfb83('0xb'));var fs=require('fs');var fs_extra=require(_0xfb83('0xc'));var _=require(_0xfb83('0xd'));var squel=require('squel');var crypto=require(_0xfb83('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfb83('0xa'));var querystring=require(_0xfb83('0xf'));var Papa=require(_0xfb83('0x10'));var Redis=require(_0xfb83('0x11'));var authService=require(_0xfb83('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfb83('0x13'));var hardwareService=require(_0xfb83('0x14'));var logger=require(_0xfb83('0x15'))(_0xfb83('0x16'));var utils=require(_0xfb83('0x17'));var config=require(_0xfb83('0x18'));var licenseUtil=require(_0xfb83('0x19'));var db=require('../../mysqldb')['db'];config[_0xfb83('0x1a')]=_[_0xfb83('0x1b')](config[_0xfb83('0x1a')],{'host':_0xfb83('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfb83('0x1d'))[_0xfb83('0x1e')](socket);function respondWithStatusCode(_0x1757d8,_0x5f5009){_0x5f5009=_0x5f5009||0xcc;return function(_0x2cc723){if(_0x2cc723){return _0x1757d8[_0xfb83('0x1f')](_0x5f5009);}return _0x1757d8['status'](_0x5f5009)[_0xfb83('0x20')]();};}function respondWithResult(_0x21d79b,_0x411aa1){_0x411aa1=_0x411aa1||0xc8;return function(_0x5c1a47){if(_0x5c1a47){return _0x21d79b['status'](_0x411aa1)[_0xfb83('0x21')](_0x5c1a47);}};}function respondWithFilteredResult(_0x3ee15b,_0x5dec47){return function(_0x22cb38){if(_0x22cb38){var _0x23c193=typeof _0x5dec47[_0xfb83('0x22')]==='undefined'&&typeof _0x5dec47[_0xfb83('0x23')]===_0xfb83('0x24');var _0x5728b8=_0x22cb38[_0xfb83('0x25')];var _0x3495b5=_0x23c193?0x0:_0x5dec47[_0xfb83('0x22')];var _0x4ba262=_0x23c193?_0x22cb38[_0xfb83('0x25')]:_0x5dec47[_0xfb83('0x22')]+_0x5dec47[_0xfb83('0x23')];var _0x4db2a4;if(_0x4ba262>=_0x5728b8){_0x4ba262=_0x5728b8;_0x4db2a4=0xc8;}else{_0x4db2a4=0xce;}_0x3ee15b['status'](_0x4db2a4);return _0x3ee15b[_0xfb83('0x26')](_0xfb83('0x27'),_0x3495b5+'-'+_0x4ba262+'/'+_0x5728b8)[_0xfb83('0x21')](_0x22cb38);}return null;};}function patchUpdates(_0x6dcbcc){return function(_0x53c162){try{jsonpatch['apply'](_0x53c162,_0x6dcbcc,!![]);}catch(_0x3a48f5){return BPromise['reject'](_0x3a48f5);}return _0x53c162[_0xfb83('0x28')]();};}function saveUpdates(_0x19a939,_0x58d5b5){return function(_0xa0bd7a){if(_0xa0bd7a){return _0xa0bd7a[_0xfb83('0x29')](_0x19a939)[_0xfb83('0x2a')](function(_0x4e66d3){return _0x4e66d3;});}return null;};}function removeEntity(_0x30788e,_0x3a7d4d){return function(_0xc2c9e2){if(_0xc2c9e2){return _0xc2c9e2['destroy']()[_0xfb83('0x2a')](function(){var _0x1add2a=_0xc2c9e2[_0xfb83('0x2b')]({'plain':!![]});var _0x1127ff='OpenchannelQueues';return db['UserProfileResource'][_0xfb83('0x2c')]({'where':{'type':_0x1127ff,'resourceId':_0x1add2a['id']}})['then'](function(){return _0xc2c9e2;});})[_0xfb83('0x2a')](function(){_0x30788e[_0xfb83('0x2d')](0xcc)[_0xfb83('0x20')]();});}};}function handleEntityNotFound(_0x2962d6,_0x115792){return function(_0x5a8f6e){if(!_0x5a8f6e){_0x2962d6[_0xfb83('0x1f')](0x194);}return _0x5a8f6e;};}function handleError(_0x5af05f,_0x251c2f){_0x251c2f=_0x251c2f||0x1f4;return function(_0x420489){logger['error'](_0x420489[_0xfb83('0x2e')]);if(_0x420489[_0xfb83('0x2f')]){delete _0x420489[_0xfb83('0x2f')];}_0x5af05f[_0xfb83('0x2d')](_0x251c2f)[_0xfb83('0x30')](_0x420489);};}exports[_0xfb83('0x31')]=function(_0xe23a87,_0x414160){var _0x2c072b={},_0x1e5e64={},_0x69fbfe={'count':0x0,'rows':[]};var _0x3479ab=_[_0xfb83('0x32')](db[_0xfb83('0x33')][_0xfb83('0x34')],function(_0x397f68){return{'name':_0x397f68[_0xfb83('0x35')],'type':_0x397f68['type'][_0xfb83('0x36')]};});_0x1e5e64[_0xfb83('0x37')]=_[_0xfb83('0x32')](_0x3479ab,_0xfb83('0x2f'));_0x1e5e64[_0xfb83('0x38')]=_[_0xfb83('0x39')](_0xe23a87[_0xfb83('0x38')]);_0x1e5e64[_0xfb83('0x3a')]=_[_0xfb83('0x3b')](_0x1e5e64['model'],_0x1e5e64[_0xfb83('0x38')]);_0x2c072b[_0xfb83('0x3c')]=_['intersection'](_0x1e5e64[_0xfb83('0x37')],qs[_0xfb83('0x3d')](_0xe23a87[_0xfb83('0x38')][_0xfb83('0x3d')]));_0x2c072b[_0xfb83('0x3c')]=_0x2c072b[_0xfb83('0x3c')][_0xfb83('0x3e')]?_0x2c072b[_0xfb83('0x3c')]:_0x1e5e64[_0xfb83('0x37')];if(!_0xe23a87[_0xfb83('0x38')][_0xfb83('0x3f')](_0xfb83('0x40'))){_0x2c072b[_0xfb83('0x23')]=qs[_0xfb83('0x23')](_0xe23a87[_0xfb83('0x38')][_0xfb83('0x23')]);_0x2c072b[_0xfb83('0x22')]=qs['offset'](_0xe23a87['query'][_0xfb83('0x22')]);}_0x2c072b[_0xfb83('0x41')]=qs[_0xfb83('0x42')](_0xe23a87[_0xfb83('0x38')][_0xfb83('0x42')]);_0x2c072b[_0xfb83('0x43')]=qs[_0xfb83('0x3a')](_[_0xfb83('0x44')](_0xe23a87[_0xfb83('0x38')],_0x1e5e64[_0xfb83('0x3a')]),_0x3479ab);if(_0xe23a87['query'][_0xfb83('0x45')]){_0x2c072b['where']=_[_0xfb83('0x46')](_0x2c072b[_0xfb83('0x43')],{'$or':_[_0xfb83('0x32')](_0x3479ab,function(_0x9ac7e1){if(_0x9ac7e1[_0xfb83('0x47')]!=='VIRTUAL'){var _0x2cae73={};_0x2cae73[_0x9ac7e1[_0xfb83('0x2f')]]={'$like':'%'+_0xe23a87['query'][_0xfb83('0x45')]+'%'};return _0x2cae73;}})});}_0x2c072b=_[_0xfb83('0x46')]({},_0x2c072b,_0xe23a87[_0xfb83('0x48')]);var _0x1e8e1a={'where':_0x2c072b[_0xfb83('0x43')]};return db['OpenchannelQueue'][_0xfb83('0x25')](_0x1e8e1a)[_0xfb83('0x2a')](function(_0x299751){_0x69fbfe['count']=_0x299751;if(_0xe23a87[_0xfb83('0x38')][_0xfb83('0x49')]){_0x2c072b[_0xfb83('0x4a')]=[{'all':!![]}];}return db[_0xfb83('0x33')][_0xfb83('0x4b')](_0x2c072b);})[_0xfb83('0x2a')](function(_0x55ea44){_0x69fbfe['rows']=_0x55ea44;return _0x69fbfe;})['then'](respondWithFilteredResult(_0x414160,_0x2c072b))['catch'](handleError(_0x414160,null));};exports['show']=function(_0x3f8834,_0x4ce7cb){var _0x4c8e89={'raw':!![],'where':{'id':_0x3f8834[_0xfb83('0x4c')]['id']}},_0xfe2ad0={};_0xfe2ad0[_0xfb83('0x37')]=_[_0xfb83('0x39')](db[_0xfb83('0x33')][_0xfb83('0x34')]);_0xfe2ad0[_0xfb83('0x38')]=_[_0xfb83('0x39')](_0x3f8834[_0xfb83('0x38')]);_0xfe2ad0[_0xfb83('0x3a')]=_['intersection'](_0xfe2ad0[_0xfb83('0x37')],_0xfe2ad0[_0xfb83('0x38')]);_0x4c8e89[_0xfb83('0x3c')]=_['intersection'](_0xfe2ad0[_0xfb83('0x37')],qs[_0xfb83('0x3d')](_0x3f8834[_0xfb83('0x38')]['fields']));_0x4c8e89[_0xfb83('0x3c')]=_0x4c8e89[_0xfb83('0x3c')][_0xfb83('0x3e')]?_0x4c8e89[_0xfb83('0x3c')]:_0xfe2ad0[_0xfb83('0x37')];if(_0x3f8834[_0xfb83('0x38')][_0xfb83('0x49')]){_0x4c8e89[_0xfb83('0x4a')]=[{'all':!![]}];}_0x4c8e89=_['merge']({},_0x4c8e89,_0x3f8834[_0xfb83('0x48')]);return db[_0xfb83('0x33')][_0xfb83('0x4d')](_0x4c8e89)['then'](handleEntityNotFound(_0x4ce7cb,null))[_0xfb83('0x2a')](respondWithResult(_0x4ce7cb,null))[_0xfb83('0x4e')](handleError(_0x4ce7cb,null));};exports[_0xfb83('0x4f')]=function(_0x6b1bf3,_0x99a3ef){return db[_0xfb83('0x33')][_0xfb83('0x4f')](_0x6b1bf3['body'],{})[_0xfb83('0x2a')](function(_0x2160f9){var _0x37bf36=_0x6b1bf3[_0xfb83('0x50')]['get']({'plain':!![]});if(!_0x37bf36)throw new Error(_0xfb83('0x51'));if(_0x37bf36['role']===_0xfb83('0x50')){var _0x3a16fc=_0x2160f9[_0xfb83('0x2b')]({'plain':!![]});var _0x546550=_0xfb83('0x52');return db[_0xfb83('0x53')]['find']({'where':{'name':_0x546550,'userProfileId':_0x37bf36['userProfileId']},'raw':!![]})[_0xfb83('0x2a')](function(_0x4fd556){if(_0x4fd556&&_0x4fd556['autoAssociation']===0x0){return db[_0xfb83('0x54')][_0xfb83('0x4f')]({'name':_0x3a16fc['name'],'resourceId':_0x3a16fc['id'],'type':_0x4fd556[_0xfb83('0x2f')],'sectionId':_0x4fd556['id']},{})['then'](function(){return _0x2160f9;});}else{return _0x2160f9;}})[_0xfb83('0x4e')](function(_0x5e1777){logger[_0xfb83('0x55')](_0xfb83('0x56'),_0x5e1777);throw _0x5e1777;});}return _0x2160f9;})[_0xfb83('0x2a')](respondWithResult(_0x99a3ef,0xc9))[_0xfb83('0x4e')](handleError(_0x99a3ef,null));};exports['update']=function(_0x530bbc,_0x26993c){if(_0x530bbc[_0xfb83('0x57')]['id']){delete _0x530bbc[_0xfb83('0x57')]['id'];}return db[_0xfb83('0x33')][_0xfb83('0x4d')]({'where':{'id':_0x530bbc['params']['id']}})['then'](handleEntityNotFound(_0x26993c,null))[_0xfb83('0x2a')](saveUpdates(_0x530bbc[_0xfb83('0x57')],null))['then'](respondWithResult(_0x26993c,null))[_0xfb83('0x4e')](handleError(_0x26993c,null));};exports['destroy']=function(_0x29027e,_0x139b0c){return db[_0xfb83('0x33')][_0xfb83('0x4d')]({'where':{'id':_0x29027e[_0xfb83('0x4c')]['id']}})[_0xfb83('0x2a')](handleEntityNotFound(_0x139b0c,null))[_0xfb83('0x2a')](removeEntity(_0x139b0c,null))[_0xfb83('0x4e')](handleError(_0x139b0c,null));};exports[_0xfb83('0x58')]=function(_0x15e14a,_0x151605){return db[_0xfb83('0x33')][_0xfb83('0x58')]()[_0xfb83('0x2a')](respondWithResult(_0x151605,null))[_0xfb83('0x4e')](handleError(_0x151605,null));};exports[_0xfb83('0x59')]=function(_0x66eca,_0x4787b3,_0x2aa2a8){var _0x165ee5={'raw':!![],'where':{}},_0x530738={},_0x40bbe8;return db[_0xfb83('0x33')][_0xfb83('0x5a')]({'where':{'id':_0x66eca[_0xfb83('0x4c')]['id']}})[_0xfb83('0x2a')](handleEntityNotFound(_0x4787b3,null))[_0xfb83('0x2a')](function(_0x56036d){if(_0x56036d){_0x40bbe8=_0x56036d[_0xfb83('0x2b')]({'plain':!![]});_0x530738[_0xfb83('0x37')]=_[_0xfb83('0x39')](db[_0xfb83('0x5b')]['rawAttributes']);_0x530738[_0xfb83('0x38')]=_[_0xfb83('0x39')](_0x66eca[_0xfb83('0x38')]);_0x530738[_0xfb83('0x3a')]=_[_0xfb83('0x3b')](_0x530738[_0xfb83('0x37')],_0x530738[_0xfb83('0x38')]);_0x165ee5['attributes']=_[_0xfb83('0x3b')](_0x530738[_0xfb83('0x37')],qs[_0xfb83('0x3d')](_0x66eca[_0xfb83('0x38')][_0xfb83('0x3d')]));_0x165ee5[_0xfb83('0x3c')]=_0x165ee5[_0xfb83('0x3c')][_0xfb83('0x3e')]?_0x165ee5[_0xfb83('0x3c')]:_0x530738[_0xfb83('0x37')];if(!_0x66eca[_0xfb83('0x38')][_0xfb83('0x3f')](_0xfb83('0x40'))){_0x165ee5[_0xfb83('0x23')]=qs['limit'](_0x66eca[_0xfb83('0x38')][_0xfb83('0x23')]);_0x165ee5[_0xfb83('0x22')]=qs[_0xfb83('0x22')](_0x66eca[_0xfb83('0x38')][_0xfb83('0x22')]);}_0x165ee5[_0xfb83('0x41')]=qs[_0xfb83('0x42')](_0x66eca[_0xfb83('0x38')][_0xfb83('0x42')]);_0x165ee5[_0xfb83('0x43')]=qs['filters'](_['pick'](_0x66eca[_0xfb83('0x38')],_0x530738[_0xfb83('0x3a')]));_0x165ee5[_0xfb83('0x43')][_0xfb83('0x5c')]=_0x56036d['id'];if(_0x66eca[_0xfb83('0x38')][_0xfb83('0x45')]){_0x165ee5['where']=_[_0xfb83('0x46')](_0x165ee5[_0xfb83('0x43')],{'$or':_[_0xfb83('0x32')](_0x165ee5[_0xfb83('0x3c')],function(_0xf1bad6){var _0x405a5={};_0x405a5[_0xf1bad6]={'$like':'%'+_0x66eca['query'][_0xfb83('0x45')]+'%'};return _0x405a5;})});}_0x165ee5=_['merge']({},_0x165ee5,_0x66eca[_0xfb83('0x48')]);return db[_0xfb83('0x5b')][_0xfb83('0x4b')](_0x165ee5);}})[_0xfb83('0x2a')](function(_0xb7c946){if(_0xb7c946){return db[_0xfb83('0x5d')][_0xfb83('0x5e')]({'where':{'id':_[_0xfb83('0x32')](_0xb7c946,_0xfb83('0x5f')),'role':_0xfb83('0x60')},'attributes':['id',_0xfb83('0x2f'),_0xfb83('0x61'),'updatedAt','createdAt']});}})['then'](function(_0x1cf2e0){if(_0x1cf2e0){return{'count':_0x1cf2e0[_0xfb83('0x25')],'rows':_[_0xfb83('0x32')](_0x1cf2e0[_0xfb83('0x62')],function(_0x5e2b10){return{'membername':_0x5e2b10[_0xfb83('0x2f')],'UserId':_0x5e2b10['id'],'queue_name':_0x40bbe8[_0xfb83('0x2f')],'OpenchannelQueueId':_0x40bbe8['id'],'interface':util['format'](_0xfb83('0x63'),_0xfb83('0x64'),_0x5e2b10[_0xfb83('0x2f')]),'penalty':0x0,'paused':_0x5e2b10[_0xfb83('0x61')],'createdAt':_0x5e2b10['createdAt'],'updatedAt':_0x5e2b10[_0xfb83('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfb83('0x2a')](respondWithFilteredResult(_0x4787b3,_0x165ee5))[_0xfb83('0x4e')](handleError(_0x4787b3,null));};exports[_0xfb83('0x66')]=function(_0x103def,_0x2be461,_0x514fed){var _0x132922={};var _0x193af3={};var _0x4dcc58;var _0x25f0a4;return db[_0xfb83('0x33')][_0xfb83('0x5a')]({'where':{'id':_0x103def[_0xfb83('0x4c')]['id']}})[_0xfb83('0x2a')](handleEntityNotFound(_0x2be461,null))['then'](function(_0x37daef){if(_0x37daef){_0x4dcc58=_0x37daef;_0x193af3[_0xfb83('0x37')]=_['keys'](db[_0xfb83('0x67')]['rawAttributes']);_0x193af3[_0xfb83('0x38')]=_['keys'](_0x103def[_0xfb83('0x38')]);_0x193af3[_0xfb83('0x3a')]=_[_0xfb83('0x3b')](_0x193af3[_0xfb83('0x37')],_0x193af3[_0xfb83('0x38')]);_0x132922[_0xfb83('0x3c')]=_['intersection'](_0x193af3[_0xfb83('0x37')],qs['fields'](_0x103def[_0xfb83('0x38')]['fields']));_0x132922[_0xfb83('0x3c')]=_0x132922['attributes'][_0xfb83('0x3e')]?_0x132922['attributes']:_0x193af3[_0xfb83('0x37')];_0x132922[_0xfb83('0x41')]=qs[_0xfb83('0x42')](_0x103def[_0xfb83('0x38')][_0xfb83('0x42')]);_0x132922[_0xfb83('0x43')]=qs['filters'](_[_0xfb83('0x44')](_0x103def[_0xfb83('0x38')],_0x193af3[_0xfb83('0x3a')]));if(_0x103def[_0xfb83('0x38')][_0xfb83('0x45')]){_0x132922[_0xfb83('0x43')]=_[_0xfb83('0x46')](_0x132922[_0xfb83('0x43')],{'$or':_[_0xfb83('0x32')](_0x132922[_0xfb83('0x3c')],function(_0x904a48){var _0x54dc32={};_0x54dc32[_0x904a48]={'$like':'%'+_0x103def[_0xfb83('0x38')][_0xfb83('0x45')]+'%'};return _0x54dc32;})});}_0x132922=_[_0xfb83('0x46')]({},_0x132922,_0x103def[_0xfb83('0x48')]);return _0x4dcc58['getTeams'](_0x132922);}})[_0xfb83('0x2a')](function(_0x2f7dc3){if(_0x2f7dc3){_0x25f0a4=_0x2f7dc3[_0xfb83('0x3e')];if(!_0x103def[_0xfb83('0x38')][_0xfb83('0x3f')]('nolimit')){_0x132922[_0xfb83('0x23')]=qs['limit'](_0x103def[_0xfb83('0x38')][_0xfb83('0x23')]);_0x132922[_0xfb83('0x22')]=qs['offset'](_0x103def[_0xfb83('0x38')][_0xfb83('0x22')]);}return _0x4dcc58[_0xfb83('0x66')](_0x132922);}})[_0xfb83('0x2a')](function(_0x2b934f){if(_0x2b934f){return _0x2b934f?{'count':_0x25f0a4,'rows':_0x2b934f}:null;}})['then'](respondWithResult(_0x2be461,null))[_0xfb83('0x4e')](handleError(_0x2be461,null));};exports[_0xfb83('0x68')]=function(_0xddf26e,_0xfe9b9c,_0x44a5bb){var _0x12b450=_0xddf26e['body']['ids'];return db[_0xfb83('0x67')][_0xfb83('0x4b')]({'where':{'id':_0x12b450},'attributes':['id'],'include':[{'model':db[_0xfb83('0x5d')],'as':_0xfb83('0x69'),'attributes':['id','name',_0xfb83('0x6a'),_0xfb83('0x6b'),_0xfb83('0x6c')],'raw':!![]}]})[_0xfb83('0x2a')](function(_0x331127){if(_0x331127){var _0x5a8916=_[_0xfb83('0x6d')](_0x331127,function(_0x56eb99){var _0x134666=_0x56eb99[_0xfb83('0x2b')]({'plain':!![]});return _0x134666[_0xfb83('0x69')];});return db[_0xfb83('0x33')][_0xfb83('0x4d')]({'where':{'id':_0xddf26e[_0xfb83('0x4c')]['id']}})['then'](function(_0x5cc1b6){return db[_0xfb83('0x6e')][_0xfb83('0x6f')](function(_0xfff036){return _0x5cc1b6[_0xfb83('0x68')](_0x12b450,{'transaction':_0xfff036})['then'](function(){return BPromise[_0xfb83('0x70')](_0x5a8916,function(_0x408f0e){return db[_0xfb83('0x5b')]['findOrCreate']({'where':{'UserId':_0x408f0e['id'],'OpenchannelQueueId':_0xddf26e[_0xfb83('0x4c')]['id']},'transaction':_0xfff036});});})[_0xfb83('0x2a')](function(){_0x5a8916[_0xfb83('0x71')](function(_0x343b44){socket[_0xfb83('0x72')](_0xfb83('0x73'),{'UserId':_0x343b44['id'],'OpenchannelQueueId':_0x5cc1b6['id']});});});});});}})[_0xfb83('0x2a')](respondWithStatusCode(_0xfe9b9c,null))[_0xfb83('0x4e')](handleError(_0xfe9b9c,null));};exports[_0xfb83('0x74')]=function(_0x47d505,_0x23f6b8,_0xa36c93){return db[_0xfb83('0x67')][_0xfb83('0x4b')]({'where':{'id':_0x47d505[_0xfb83('0x38')][_0xfb83('0x75')]},'attributes':['id'],'include':[{'model':db[_0xfb83('0x5d')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x23f6b8,null))['then'](function(_0x3efc55){var _0x4a6aa5=_[_0xfb83('0x32')](_0x3efc55,'id');var _0x312ccd=[];var _0x2f1b6b=[];var _0x3a8bb2=squel[_0xfb83('0x76')]();_0x3a8bb2['field'](_0xfb83('0x77'))[_0xfb83('0x78')]('team_has_openchannel_queues','tq')[_0xfb83('0x79')](_0xfb83('0x7a'),'ut',_0xfb83('0x7b'))[_0xfb83('0x43')](_0xfb83('0x7c'),_0x47d505[_0xfb83('0x4c')]['id']);for(var _0x4c572e=0x0;_0x4c572e<_0x3efc55['length'];_0x4c572e+=0x1){let _0x430081=_0x3efc55[_0x4c572e];for(var _0x239f73=0x0;_0x239f73<_0x430081[_0xfb83('0x69')]['length'];_0x239f73+=0x1){let _0xbb7438=_0x430081[_0xfb83('0x69')][_0x239f73];var _0x2f987f=_0x3a8bb2[_0xfb83('0x7d')]();_0x2f987f[_0xfb83('0x43')]('ut.UserId\x20=\x20?',_0xbb7438['id']);_0x2f1b6b[_0xfb83('0x7e')](db[_0xfb83('0x6e')][_0xfb83('0x38')](_0x2f987f[_0xfb83('0x7f')](),{'type':db['sequelize'][_0xfb83('0x80')][_0xfb83('0x81')]})['then'](function(_0xbf87c1){if(_0xbf87c1[_0xfb83('0x3e')]===0x1){return _0xbb7438['id'];}else{var _0xbe314b=_[_0xfb83('0x82')](_[_0xfb83('0x32')](_0xbf87c1,_0xfb83('0x83')),function(_0x8f9f9c){return _['includes'](_0x4a6aa5,_0x8f9f9c);});if(_0xbe314b){return _0xbb7438['id'];}}}));}}return BPromise[_0xfb83('0x84')](_0x2f1b6b)[_0xfb83('0x2a')](function(_0x109fb9){_0x312ccd=_(_0x312ccd)[_0xfb83('0x85')](_0x109fb9)[_0xfb83('0x86')]()[_0xfb83('0x87')]();return db['OpenchannelQueue'][_0xfb83('0x4d')]({'where':{'id':_0x47d505[_0xfb83('0x4c')]['id']}})['then'](function(_0xf505c2){return db['sequelize'][_0xfb83('0x6f')](function(_0x5c7c61){return _0xf505c2[_0xfb83('0x74')](_0x47d505['query'][_0xfb83('0x75')],{'transaction':_0x5c7c61})[_0xfb83('0x2a')](function(){if(!_[_0xfb83('0x88')](_0x312ccd)){return _0xf505c2['removeAgents'](_0x312ccd,{'transaction':_0x5c7c61});}})[_0xfb83('0x2a')](function(){_0x312ccd['forEach'](function(_0x573149){socket[_0xfb83('0x72')]('userOpenchannelQueue:remove',{'UserId':_0x573149,'OpenchannelQueueId':_0xf505c2['id']});});});});});});})[_0xfb83('0x2a')](respondWithStatusCode(_0x23f6b8,null))[_0xfb83('0x4e')](handleError(_0x23f6b8,null));};exports[_0xfb83('0x89')]=function(_0x5df33c,_0x53d958,_0x1b8f08){return db[_0xfb83('0x33')]['find']({'where':{'id':_0x5df33c['params']['id']}})[_0xfb83('0x2a')](handleEntityNotFound(_0x53d958,null))[_0xfb83('0x2a')](function(_0x546b6e){if(_0x546b6e){return _0x546b6e[_0xfb83('0x89')](_0x5df33c['body'][_0xfb83('0x75')],_['omit'](_0x5df33c[_0xfb83('0x57')],[_0xfb83('0x75'),'id'])||{})[_0xfb83('0x8a')](function(_0x4ddb6f){for(var _0x162593=0x0;_0x162593<_0x5df33c[_0xfb83('0x57')]['ids'][_0xfb83('0x3e')];_0x162593+=0x1){socket[_0xfb83('0x72')](_0xfb83('0x73'),{'UserId':Number(_0x5df33c[_0xfb83('0x57')]['ids'][_0x162593]),'OpenchannelQueueId':Number(_0x5df33c[_0xfb83('0x4c')]['id'])});}return _0x4ddb6f;});}})['then'](respondWithResult(_0x53d958,null))[_0xfb83('0x4e')](handleError(_0x53d958,null));};exports[_0xfb83('0x8b')]=function(_0x540b7e,_0x465470,_0x310e1f){return db[_0xfb83('0x33')][_0xfb83('0x4d')]({'where':{'id':_0x540b7e['params']['id']}})[_0xfb83('0x2a')](handleEntityNotFound(_0x465470,null))[_0xfb83('0x2a')](function(_0xfdaf54){if(_0xfdaf54){return _0xfdaf54[_0xfb83('0x8b')](_0x540b7e[_0xfb83('0x38')][_0xfb83('0x75')])[_0xfb83('0x2a')](function(){if(_[_0xfb83('0x8c')](_0x540b7e['query'][_0xfb83('0x75')])){for(var _0x43e0b2=0x0;_0x43e0b2<_0x540b7e[_0xfb83('0x38')][_0xfb83('0x75')]['length'];_0x43e0b2+=0x1){socket[_0xfb83('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x540b7e['query'][_0xfb83('0x75')][_0x43e0b2]),'OpenchannelQueueId':Number(_0x540b7e[_0xfb83('0x4c')]['id'])});}}else{socket[_0xfb83('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x540b7e[_0xfb83('0x38')]['ids']),'OpenchannelQueueId':Number(_0x540b7e[_0xfb83('0x4c')]['id'])});}});}})[_0xfb83('0x2a')](respondWithStatusCode(_0x465470,null))['catch'](handleError(_0x465470,null));};exports[_0xfb83('0x8d')]=function(_0x138e56,_0xf8eb77,_0x19052b){var _0xad9462={};var _0x12e3c8={};var _0x16c203;var _0x327e0a;return db['OpenchannelQueue'][_0xfb83('0x5a')]({'where':{'id':_0x138e56[_0xfb83('0x4c')]['id']}})['then'](handleEntityNotFound(_0xf8eb77,null))[_0xfb83('0x2a')](function(_0x278d7f){if(_0x278d7f){_0x16c203=_0x278d7f;_0x12e3c8[_0xfb83('0x37')]=_[_0xfb83('0x39')](db['User']['rawAttributes']);_0x12e3c8['query']=_[_0xfb83('0x39')](_0x138e56[_0xfb83('0x38')]);_0x12e3c8[_0xfb83('0x3a')]=_[_0xfb83('0x3b')](_0x12e3c8['model'],_0x12e3c8[_0xfb83('0x38')]);_0xad9462['attributes']=_[_0xfb83('0x3b')](_0x12e3c8[_0xfb83('0x37')],qs['fields'](_0x138e56[_0xfb83('0x38')][_0xfb83('0x3d')]));_0xad9462['attributes']=_0xad9462[_0xfb83('0x3c')]['length']?_0xad9462['attributes']:_0x12e3c8['model'];_0xad9462[_0xfb83('0x41')]=qs[_0xfb83('0x42')](_0x138e56[_0xfb83('0x38')][_0xfb83('0x42')]);_0xad9462['where']=qs[_0xfb83('0x3a')](_['pick'](_0x138e56['query'],_0x12e3c8['filters']));if(_0x138e56[_0xfb83('0x38')][_0xfb83('0x45')]){_0xad9462[_0xfb83('0x43')]=_[_0xfb83('0x46')](_0xad9462['where'],{'$or':_[_0xfb83('0x32')](_0xad9462[_0xfb83('0x3c')],function(_0x49b07a){var _0x4541db={};_0x4541db[_0x49b07a]={'$like':'%'+_0x138e56['query'][_0xfb83('0x45')]+'%'};return _0x4541db;})});}_0xad9462=_[_0xfb83('0x46')]({},_0xad9462,_0x138e56['options']);return _0x16c203[_0xfb83('0x8d')](_0xad9462);}})[_0xfb83('0x2a')](function(_0x2fc137){if(_0x2fc137){_0x327e0a=_0x2fc137[_0xfb83('0x3e')];if(!_0x138e56[_0xfb83('0x38')][_0xfb83('0x3f')](_0xfb83('0x40'))){_0xad9462[_0xfb83('0x23')]=qs[_0xfb83('0x23')](_0x138e56['query'][_0xfb83('0x23')]);_0xad9462[_0xfb83('0x22')]=qs[_0xfb83('0x22')](_0x138e56[_0xfb83('0x38')]['offset']);}return _0x16c203['getAgents'](_0xad9462);}})[_0xfb83('0x2a')](function(_0x7c9c88){if(_0x7c9c88){return _0x7c9c88?{'count':_0x327e0a,'rows':_0x7c9c88}:null;}})['then'](respondWithResult(_0xf8eb77,null))[_0xfb83('0x4e')](handleError(_0xf8eb77,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index d3db179..407ed4e 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 _0x1263=['exports','events','OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1263,0x121));var _0x3126=function(_0x41c275,_0x37dba1){_0x41c275=_0x41c275-0x0;var _0x568d45=_0x1263[_0x41c275];return _0x568d45;};'use strict';var EventEmitter=require(_0x3126('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x3126('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3126('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3126('0x3'),'afterDestroy':_0x3126('0x4')};function emitEvent(_0x3b1987){return function(_0xeb665c,_0x4ac46f,_0x98ecc1){OpenchannelQueueEvents[_0x3126('0x5')](_0x3b1987+':'+_0xeb665c['id'],_0xeb665c);OpenchannelQueueEvents[_0x3126('0x5')](_0x3b1987,_0xeb665c);_0x98ecc1(null);};}for(var e in events){if(events[_0x3126('0x6')](e)){var event=events[e];OpenchannelQueue[_0x3126('0x7')](e,emitEvent(event));}}module[_0x3126('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xe2f8=['exports','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x3511e9,_0x564b9b){var _0x1ccacf=function(_0x5880cc){while(--_0x5880cc){_0x3511e9['push'](_0x3511e9['shift']());}};_0x1ccacf(++_0x564b9b);}(_0xe2f8,0x121));var _0x8e2f=function(_0x4e0309,_0x3cfb50){_0x4e0309=_0x4e0309-0x0;var _0x3e7e3f=_0xe2f8[_0x4e0309];return _0x3e7e3f;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x8e2f('0x0'))['db'][_0x8e2f('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x8e2f('0x2')](0x0);var events={'afterCreate':_0x8e2f('0x3'),'afterUpdate':_0x8e2f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5a6898){return function(_0x4eb3e7,_0x2092f0,_0xc20d24){OpenchannelQueueEvents[_0x8e2f('0x5')](_0x5a6898+':'+_0x4eb3e7['id'],_0x4eb3e7);OpenchannelQueueEvents['emit'](_0x5a6898,_0x4eb3e7);_0xc20d24(null);};}for(var e in events){if(events[_0x8e2f('0x6')](e)){var event=events[e];OpenchannelQueue[_0x8e2f('0x7')](e,emitEvent(event));}}module[_0x8e2f('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index b14b42a..54938fd 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 _0xea52=['./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5a4402,_0x567e1e){var _0x2c8432=function(_0xb64f86){while(--_0xb64f86){_0x5a4402['push'](_0x5a4402['shift']());}};_0x2c8432(++_0x567e1e);}(_0xea52,0x130));var _0x2ea5=function(_0x2bf5f0,_0x40df62){_0x2bf5f0=_0x2bf5f0-0x0;var _0xc57f01=_0xea52[_0x2bf5f0];return _0xc57f01;};'use strict';var _=require(_0x2ea5('0x0'));var util=require(_0x2ea5('0x1'));var logger=require('../../config/logger')(_0x2ea5('0x2'));var moment=require(_0x2ea5('0x3'));var BPromise=require(_0x2ea5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ea5('0x5'));var rimraf=require(_0x2ea5('0x6'));var config=require(_0x2ea5('0x7'));var attributes=require(_0x2ea5('0x8'));module[_0x2ea5('0x9')]=function(_0x30428d,_0x1bf60b){return _0x30428d[_0x2ea5('0xa')](_0x2ea5('0xb'),attributes,{'tableName':_0x2ea5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x78b8=['moment','request-promise','path','rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','api'];(function(_0x195e1f,_0x3304c3){var _0x1acd06=function(_0x261f2c){while(--_0x261f2c){_0x195e1f['push'](_0x195e1f['shift']());}};_0x1acd06(++_0x3304c3);}(_0x78b8,0x171));var _0x878b=function(_0x4f504e,_0x493914){_0x4f504e=_0x4f504e-0x0;var _0x36c8ff=_0x78b8[_0x4f504e];return _0x36c8ff;};'use strict';var _=require(_0x878b('0x0'));var util=require(_0x878b('0x1'));var logger=require('../../config/logger')(_0x878b('0x2'));var moment=require(_0x878b('0x3'));var BPromise=require('bluebird');var rp=require(_0x878b('0x4'));var fs=require('fs');var path=require(_0x878b('0x5'));var rimraf=require(_0x878b('0x6'));var config=require('../../config/environment');var attributes=require(_0x878b('0x7'));module[_0x878b('0x8')]=function(_0x13d9b4,_0x58d1ac){return _0x13d9b4[_0x878b('0x9')](_0x878b('0xa'),attributes,{'tableName':_0x878b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index d7dfc55..6d24aba 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 _0x0e11=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','redis','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetOpenchannelQueue','options','raw','where','limit','include','map','model','attributes','ShowOpenchannelQueue','find','lodash','util','moment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0e11,0x69));var _0x10e1=function(_0x36625e,_0x2f9135){_0x36625e=_0x36625e-0x0;var _0x303aa8=_0x0e11[_0x36625e];return _0x303aa8;};'use strict';var _=require(_0x10e1('0x0'));var util=require(_0x10e1('0x1'));var moment=require(_0x10e1('0x2'));var BPromise=require(_0x10e1('0x3'));var rs=require(_0x10e1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x10e1('0x5'))['db'];var utils=require(_0x10e1('0x6'));var logger=require(_0x10e1('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x10e1('0x8')]['http']({'port':0x232a});config[_0x10e1('0x9')]=_['defaults'](config[_0x10e1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x10e1('0xa'))(new Redis(config['redis']));require(_0x10e1('0xb'))[_0x10e1('0xc')](socket);function respondWithRpcPromise(_0x54c193,_0x518261,_0xc9ad9){return new BPromise(function(_0x32e3eb,_0x1f81c4){return client[_0x10e1('0xd')](_0x54c193,_0xc9ad9)[_0x10e1('0xe')](function(_0x3dbfb5){logger[_0x10e1('0xf')](_0x10e1('0x10'),_0x518261,_0x10e1('0x11'));logger[_0x10e1('0x12')](_0x10e1('0x13'),_0x518261,_0x10e1('0x11'),JSON[_0x10e1('0x14')](_0x3dbfb5));if(_0x3dbfb5['error']){if(_0x3dbfb5[_0x10e1('0x15')][_0x10e1('0x16')]===0x1f4){logger['error'](_0x10e1('0x10'),_0x518261,_0x3dbfb5[_0x10e1('0x15')]['message']);return _0x1f81c4(_0x3dbfb5['error'][_0x10e1('0x17')]);}logger[_0x10e1('0x15')](_0x10e1('0x10'),_0x518261,_0x3dbfb5[_0x10e1('0x15')][_0x10e1('0x17')]);return _0x32e3eb(_0x3dbfb5[_0x10e1('0x15')][_0x10e1('0x17')]);}else{logger[_0x10e1('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x518261,'request\x20sent');_0x32e3eb(_0x3dbfb5['result'][_0x10e1('0x17')]);}})[_0x10e1('0x18')](function(_0x5c3009){logger[_0x10e1('0x15')](_0x10e1('0x10'),_0x518261,_0x5c3009);_0x1f81c4(_0x5c3009);});});}exports[_0x10e1('0x19')]=function(_0x23614e){var _0x5c39a3=this;return new Promise(function(_0x503240,_0x282f7e){return db['OpenchannelQueue']['findAll']({'raw':_0x23614e[_0x10e1('0x1a')]?_0x23614e[_0x10e1('0x1a')][_0x10e1('0x1b')]===undefined?!![]:![]:!![],'where':_0x23614e[_0x10e1('0x1a')]?_0x23614e[_0x10e1('0x1a')][_0x10e1('0x1c')]||null:null,'attributes':_0x23614e[_0x10e1('0x1a')]?_0x23614e[_0x10e1('0x1a')]['attributes']||null:null,'limit':_0x23614e[_0x10e1('0x1a')]?_0x23614e['options'][_0x10e1('0x1d')]||null:null,'include':_0x23614e[_0x10e1('0x1a')]?_0x23614e[_0x10e1('0x1a')][_0x10e1('0x1e')]?_[_0x10e1('0x1f')](_0x23614e[_0x10e1('0x1a')]['include'],function(_0x3603fc){return{'model':db[_0x3603fc['model']],'as':_0x3603fc['as'],'attributes':_0x3603fc['attributes'],'include':_0x3603fc[_0x10e1('0x1e')]?_['map'](_0x3603fc[_0x10e1('0x1e')],function(_0x4fcb99){return{'model':db[_0x4fcb99[_0x10e1('0x20')]],'as':_0x4fcb99['as'],'attributes':_0x4fcb99[_0x10e1('0x21')],'include':_0x4fcb99[_0x10e1('0x1e')]?_[_0x10e1('0x1f')](_0x4fcb99[_0x10e1('0x1e')],function(_0x335c0f){return{'model':db[_0x335c0f['model']],'as':_0x335c0f['as'],'attributes':_0x335c0f[_0x10e1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x10e1('0xe')](function(_0x31b24d){logger[_0x10e1('0xf')](_0x10e1('0x19'),_0x23614e);logger['debug'](_0x10e1('0x19'),_0x23614e,JSON[_0x10e1('0x14')](_0x31b24d));_0x503240(_0x31b24d);})[_0x10e1('0x18')](function(_0x1eb83a){logger[_0x10e1('0x15')](_0x10e1('0x19'),_0x1eb83a[_0x10e1('0x17')],_0x23614e);_0x282f7e(_0x5c39a3[_0x10e1('0x15')](0x1f4,_0x1eb83a[_0x10e1('0x17')]));});});};exports[_0x10e1('0x22')]=function(_0x13450b){var _0x835b7f=this;return new Promise(function(_0x171deb,_0x5d8836){return db['OpenchannelQueue'][_0x10e1('0x23')]({'raw':_0x13450b['options']?_0x13450b[_0x10e1('0x1a')][_0x10e1('0x1b')]===undefined?!![]:![]:!![],'where':_0x13450b[_0x10e1('0x1a')]?_0x13450b[_0x10e1('0x1a')][_0x10e1('0x1c')]||null:null,'attributes':_0x13450b[_0x10e1('0x1a')]?_0x13450b[_0x10e1('0x1a')][_0x10e1('0x21')]||null:null,'include':_0x13450b[_0x10e1('0x1a')]?_0x13450b[_0x10e1('0x1a')]['include']?_[_0x10e1('0x1f')](_0x13450b['options']['include'],function(_0xb25369){return{'model':db[_0xb25369[_0x10e1('0x20')]],'as':_0xb25369['as'],'attributes':_0xb25369[_0x10e1('0x21')],'include':_0xb25369[_0x10e1('0x1e')]?_[_0x10e1('0x1f')](_0xb25369[_0x10e1('0x1e')],function(_0x397948){return{'model':db[_0x397948[_0x10e1('0x20')]],'as':_0x397948['as'],'attributes':_0x397948[_0x10e1('0x21')],'include':_0x397948['include']?_[_0x10e1('0x1f')](_0x397948[_0x10e1('0x1e')],function(_0x383349){return{'model':db[_0x383349[_0x10e1('0x20')]],'as':_0x383349['as'],'attributes':_0x383349[_0x10e1('0x21')]};}):[]};}):[]};}):[]:[]})[_0x10e1('0xe')](function(_0x43f4c4){logger[_0x10e1('0xf')]('ShowOpenchannelQueue',_0x13450b);logger[_0x10e1('0x12')]('ShowOpenchannelQueue',_0x13450b,JSON[_0x10e1('0x14')](_0x43f4c4));_0x171deb(_0x43f4c4);})['catch'](function(_0x128824){logger[_0x10e1('0x15')](_0x10e1('0x22'),_0x128824[_0x10e1('0x17')],_0x13450b);_0x5d8836(_0x835b7f['error'](0x1f4,_0x128824['message']));});});}; \ No newline at end of file +var _0x1fde=['request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetOpenchannelQueue','options','raw','limit','include','model','map','attributes','catch','ShowOpenchannelQueue','find','where','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x3b2ec1,_0x3694b7){var _0x3730ea=function(_0x51745e){while(--_0x51745e){_0x3b2ec1['push'](_0x3b2ec1['shift']());}};_0x3730ea(++_0x3694b7);}(_0x1fde,0x107));var _0xe1fd=function(_0x585ee5,_0x1c9dba){_0x585ee5=_0x585ee5-0x0;var _0x470808=_0x1fde[_0x585ee5];return _0x470808;};'use strict';var _=require(_0xe1fd('0x0'));var util=require('util');var moment=require(_0xe1fd('0x1'));var BPromise=require(_0xe1fd('0x2'));var rs=require(_0xe1fd('0x3'));var fs=require('fs');var Redis=require(_0xe1fd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe1fd('0x5'));var logger=require(_0xe1fd('0x6'))(_0xe1fd('0x7'));var config=require(_0xe1fd('0x8'));var jayson=require(_0xe1fd('0x9'));var client=jayson[_0xe1fd('0xa')][_0xe1fd('0xb')]({'port':0x232a});config[_0xe1fd('0xc')]=_[_0xe1fd('0xd')](config[_0xe1fd('0xc')],{'host':_0xe1fd('0xe'),'port':0x18eb});var socket=require(_0xe1fd('0xf'))(new Redis(config[_0xe1fd('0xc')]));require('./openchannelQueue.socket')[_0xe1fd('0x10')](socket);function respondWithRpcPromise(_0x57ab44,_0x46b06e,_0x2544a0){return new BPromise(function(_0x2f9752,_0x2519dd){return client[_0xe1fd('0x11')](_0x57ab44,_0x2544a0)[_0xe1fd('0x12')](function(_0x5a8dea){logger['info'](_0xe1fd('0x13'),_0x46b06e,_0xe1fd('0x14'));logger[_0xe1fd('0x15')](_0xe1fd('0x16'),_0x46b06e,_0xe1fd('0x14'),JSON[_0xe1fd('0x17')](_0x5a8dea));if(_0x5a8dea['error']){if(_0x5a8dea[_0xe1fd('0x18')][_0xe1fd('0x19')]===0x1f4){logger['error'](_0xe1fd('0x13'),_0x46b06e,_0x5a8dea[_0xe1fd('0x18')]['message']);return _0x2519dd(_0x5a8dea['error'][_0xe1fd('0x1a')]);}logger[_0xe1fd('0x18')](_0xe1fd('0x13'),_0x46b06e,_0x5a8dea[_0xe1fd('0x18')][_0xe1fd('0x1a')]);return _0x2f9752(_0x5a8dea['error'][_0xe1fd('0x1a')]);}else{logger[_0xe1fd('0x1b')]('OpenchannelQueue,\x20%s,\x20%s',_0x46b06e,'request\x20sent');_0x2f9752(_0x5a8dea['result'][_0xe1fd('0x1a')]);}})['catch'](function(_0x1ba4af){logger['error'](_0xe1fd('0x13'),_0x46b06e,_0x1ba4af);_0x2519dd(_0x1ba4af);});});}exports[_0xe1fd('0x1c')]=function(_0x204330){var _0x4d050d=this;return new Promise(function(_0x5922e0,_0x40424c){return db['OpenchannelQueue']['findAll']({'raw':_0x204330[_0xe1fd('0x1d')]?_0x204330[_0xe1fd('0x1d')][_0xe1fd('0x1e')]===undefined?!![]:![]:!![],'where':_0x204330[_0xe1fd('0x1d')]?_0x204330['options']['where']||null:null,'attributes':_0x204330[_0xe1fd('0x1d')]?_0x204330[_0xe1fd('0x1d')]['attributes']||null:null,'limit':_0x204330[_0xe1fd('0x1d')]?_0x204330[_0xe1fd('0x1d')][_0xe1fd('0x1f')]||null:null,'include':_0x204330[_0xe1fd('0x1d')]?_0x204330[_0xe1fd('0x1d')][_0xe1fd('0x20')]?_['map'](_0x204330[_0xe1fd('0x1d')][_0xe1fd('0x20')],function(_0xe124ce){return{'model':db[_0xe124ce[_0xe1fd('0x21')]],'as':_0xe124ce['as'],'attributes':_0xe124ce['attributes'],'include':_0xe124ce['include']?_[_0xe1fd('0x22')](_0xe124ce[_0xe1fd('0x20')],function(_0x1e4bb2){return{'model':db[_0x1e4bb2[_0xe1fd('0x21')]],'as':_0x1e4bb2['as'],'attributes':_0x1e4bb2[_0xe1fd('0x23')],'include':_0x1e4bb2[_0xe1fd('0x20')]?_[_0xe1fd('0x22')](_0x1e4bb2[_0xe1fd('0x20')],function(_0xdfafa4){return{'model':db[_0xdfafa4[_0xe1fd('0x21')]],'as':_0xdfafa4['as'],'attributes':_0xdfafa4[_0xe1fd('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe1fd('0x12')](function(_0x20db1b){logger['info']('GetOpenchannelQueue',_0x204330);logger[_0xe1fd('0x15')](_0xe1fd('0x1c'),_0x204330,JSON[_0xe1fd('0x17')](_0x20db1b));_0x5922e0(_0x20db1b);})[_0xe1fd('0x24')](function(_0x4eb78f){logger[_0xe1fd('0x18')](_0xe1fd('0x1c'),_0x4eb78f[_0xe1fd('0x1a')],_0x204330);_0x40424c(_0x4d050d[_0xe1fd('0x18')](0x1f4,_0x4eb78f['message']));});});};exports[_0xe1fd('0x25')]=function(_0x25850b){var _0x3252fa=this;return new Promise(function(_0x3e5f22,_0x4ff5aa){return db['OpenchannelQueue'][_0xe1fd('0x26')]({'raw':_0x25850b['options']?_0x25850b[_0xe1fd('0x1d')][_0xe1fd('0x1e')]===undefined?!![]:![]:!![],'where':_0x25850b[_0xe1fd('0x1d')]?_0x25850b[_0xe1fd('0x1d')][_0xe1fd('0x27')]||null:null,'attributes':_0x25850b[_0xe1fd('0x1d')]?_0x25850b[_0xe1fd('0x1d')][_0xe1fd('0x23')]||null:null,'include':_0x25850b[_0xe1fd('0x1d')]?_0x25850b['options'][_0xe1fd('0x20')]?_[_0xe1fd('0x22')](_0x25850b['options'][_0xe1fd('0x20')],function(_0x1ec476){return{'model':db[_0x1ec476[_0xe1fd('0x21')]],'as':_0x1ec476['as'],'attributes':_0x1ec476['attributes'],'include':_0x1ec476[_0xe1fd('0x20')]?_[_0xe1fd('0x22')](_0x1ec476[_0xe1fd('0x20')],function(_0x1c7b74){return{'model':db[_0x1c7b74[_0xe1fd('0x21')]],'as':_0x1c7b74['as'],'attributes':_0x1c7b74[_0xe1fd('0x23')],'include':_0x1c7b74[_0xe1fd('0x20')]?_['map'](_0x1c7b74[_0xe1fd('0x20')],function(_0x591cbd){return{'model':db[_0x591cbd[_0xe1fd('0x21')]],'as':_0x591cbd['as'],'attributes':_0x591cbd[_0xe1fd('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe1fd('0x12')](function(_0x424682){logger[_0xe1fd('0x1b')](_0xe1fd('0x25'),_0x25850b);logger[_0xe1fd('0x15')]('ShowOpenchannelQueue',_0x25850b,JSON[_0xe1fd('0x17')](_0x424682));_0x3e5f22(_0x424682);})[_0xe1fd('0x24')](function(_0x4eb0c1){logger[_0xe1fd('0x18')](_0xe1fd('0x25'),_0x4eb0c1[_0xe1fd('0x1a')],_0x25850b);_0x4ff5aa(_0x3252fa[_0xe1fd('0x18')](0x1f4,_0x4eb0c1['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 0fb1e95..49a7527 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 _0xd388=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','emit','removeListener'];(function(_0x36631d,_0x2786bf){var _0x410666=function(_0x14e77c){while(--_0x14e77c){_0x36631d['push'](_0x36631d['shift']());}};_0x410666(++_0x2786bf);}(_0xd388,0xe3));var _0x8d38=function(_0xba36ac,_0x170493){_0xba36ac=_0xba36ac-0x0;var _0xd5c7ae=_0xd388[_0xba36ac];return _0xd5c7ae;};'use strict';var OpenchannelQueueEvents=require(_0x8d38('0x0'));var events=[_0x8d38('0x1'),_0x8d38('0x2'),'update'];function createListener(_0x496875,_0x3c2785){return function(_0x1133ab){_0x3c2785[_0x8d38('0x3')](_0x496875,_0x1133ab);};}function removeListener(_0x5cf06c,_0x4b49e7){return function(){OpenchannelQueueEvents[_0x8d38('0x4')](_0x5cf06c,_0x4b49e7);};}exports[_0x8d38('0x5')]=function(_0x195d95){for(var _0x1679eb=0x0,_0x18549f=events[_0x8d38('0x6')];_0x1679eb<_0x18549f;_0x1679eb++){var _0x40d3b9=events[_0x1679eb];var _0x201c48=createListener(_0x8d38('0x7')+_0x40d3b9,_0x195d95);OpenchannelQueueEvents['on'](_0x40d3b9,_0x201c48);}}; \ No newline at end of file +var _0xfcad=['removeListener','register','length','openchannelQueue:','save','remove'];(function(_0x26b090,_0x129196){var _0x1e488a=function(_0x46563f){while(--_0x46563f){_0x26b090['push'](_0x26b090['shift']());}};_0x1e488a(++_0x129196);}(_0xfcad,0xa6));var _0xdfca=function(_0x4d9f00,_0x3591b1){_0x4d9f00=_0x4d9f00-0x0;var _0x2f158c=_0xfcad[_0x4d9f00];return _0x2f158c;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xdfca('0x0'),_0xdfca('0x1'),'update'];function createListener(_0x4e3c3e,_0x577e90){return function(_0x18bf83){_0x577e90['emit'](_0x4e3c3e,_0x18bf83);};}function removeListener(_0x31e8d3,_0x45772c){return function(){OpenchannelQueueEvents[_0xdfca('0x2')](_0x31e8d3,_0x45772c);};}exports[_0xdfca('0x3')]=function(_0x19cf70){for(var _0x1c0ca4=0x0,_0x1e0f27=events[_0xdfca('0x4')];_0x1c0ca4<_0x1e0f27;_0x1c0ca4++){var _0x14c206=events[_0x1c0ca4];var _0x4b3f94=createListener(_0xdfca('0x5')+_0x14c206,_0x19cf70);OpenchannelQueueEvents['on'](_0x14c206,_0x4b3f94);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 55ce476..cbbfab0 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 _0x3dd7=['post','put','update','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3dd7,0x1f2));var _0x73dd=function(_0x3423b0,_0x7a059e){_0x3423b0=_0x3423b0-0x0;var _0x552023=_0x3dd7[_0x3423b0];return _0x552023;};'use strict';var multer=require('multer');var util=require(_0x73dd('0x0'));var path=require(_0x73dd('0x1'));var timeout=require(_0x73dd('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x73dd('0x3'));var auth=require(_0x73dd('0x4'));var interaction=require(_0x73dd('0x5'));var config=require(_0x73dd('0x6'));var controller=require(_0x73dd('0x7'));router[_0x73dd('0x8')]('/',auth[_0x73dd('0x9')](),controller['index']);router[_0x73dd('0x8')]('/describe',auth[_0x73dd('0x9')](),controller[_0x73dd('0xa')]);router['get'](_0x73dd('0xb'),auth[_0x73dd('0x9')](),controller['show']);router[_0x73dd('0xc')]('/',auth[_0x73dd('0x9')](),controller['create']);router[_0x73dd('0xd')](_0x73dd('0xb'),auth['isAuthenticated'](),controller[_0x73dd('0xe')]);router['delete'](_0x73dd('0xb'),auth[_0x73dd('0x9')](),controller[_0x73dd('0xf')]);module[_0x73dd('0x10')]=router; \ No newline at end of file +var _0xe1ba=['/:id','show','post','create','update','delete','destroy','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x3b272c,_0x564531){var _0x18b974=function(_0x58db1e){while(--_0x58db1e){_0x3b272c['push'](_0x3b272c['shift']());}};_0x18b974(++_0x564531);}(_0xe1ba,0x124));var _0xae1b=function(_0x4f33cb,_0x46c73d){_0x4f33cb=_0x4f33cb-0x0;var _0x2b2dbd=_0xe1ba[_0x4f33cb];return _0x2b2dbd;};'use strict';var multer=require(_0xae1b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xae1b('0x1'));var router=express[_0xae1b('0x2')]();var fs_extra=require(_0xae1b('0x3'));var auth=require(_0xae1b('0x4'));var interaction=require(_0xae1b('0x5'));var config=require(_0xae1b('0x6'));var controller=require('./openchannelQueueReport.controller');router[_0xae1b('0x7')]('/',auth[_0xae1b('0x8')](),controller[_0xae1b('0x9')]);router[_0xae1b('0x7')](_0xae1b('0xa'),auth[_0xae1b('0x8')](),controller[_0xae1b('0xb')]);router['get'](_0xae1b('0xc'),auth[_0xae1b('0x8')](),controller[_0xae1b('0xd')]);router[_0xae1b('0xe')]('/',auth[_0xae1b('0x8')](),controller[_0xae1b('0xf')]);router['put'](_0xae1b('0xc'),auth[_0xae1b('0x8')](),controller[_0xae1b('0x10')]);router[_0xae1b('0x11')](_0xae1b('0xc'),auth[_0xae1b('0x8')](),controller[_0xae1b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index bbfda2b..c8c82ee 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 _0x793d=['sequelize','exports','STRING','DATE','moment'];(function(_0x3401eb,_0x28b81a){var _0x104240=function(_0xf03b0b){while(--_0xf03b0b){_0x3401eb['push'](_0x3401eb['shift']());}};_0x104240(++_0x28b81a);}(_0x793d,0x15d));var _0xd793=function(_0x3c9fe6,_0x14a0a2){_0x3c9fe6=_0x3c9fe6-0x0;var _0x305518=_0x793d[_0x3c9fe6];return _0x305518;};'use strict';var moment=require(_0xd793('0x0'));var Sequelize=require(_0xd793('0x1'));module[_0xd793('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd793('0x3')]},'joinAt':{'type':Sequelize[_0xd793('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd793('0x4')]},'exitAt':{'type':Sequelize[_0xd793('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4366=['sequelize','exports','DATE','STRING','moment'];(function(_0x25e08b,_0x5edd0d){var _0x4261d3=function(_0x263e70){while(--_0x263e70){_0x25e08b['push'](_0x25e08b['shift']());}};_0x4261d3(++_0x5edd0d);}(_0x4366,0x1b7));var _0x6436=function(_0x218245,_0x5abb20){_0x218245=_0x218245-0x0;var _0x2ec9d6=_0x4366[_0x218245];return _0x2ec9d6;};'use strict';var moment=require(_0x6436('0x0'));var Sequelize=require(_0x6436('0x1'));module[_0x6436('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6436('0x3')]},'leaveAt':{'type':Sequelize[_0x6436('0x3')]},'acceptAt':{'type':Sequelize[_0x6436('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x6436('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index affa01e..6f61880 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 _0x4aee=['fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv'];(function(_0x32ba4e,_0x289b37){var _0xbcd890=function(_0x4db8e7){while(--_0x4db8e7){_0x32ba4e['push'](_0x32ba4e['shift']());}};_0xbcd890(++_0x289b37);}(_0x4aee,0xd2));var _0xe4ae=function(_0xd024c4,_0x4e0c7c){_0xd024c4=_0xd024c4-0x0;var _0x1bdfd3=_0x4aee[_0xd024c4];return _0x1bdfd3;};'use strict';var emlformat=require(_0xe4ae('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4ae('0x1'));var jsonpatch=require(_0xe4ae('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe4ae('0x3'));var Mustache=require(_0xe4ae('0x4'));var util=require(_0xe4ae('0x5'));var path=require(_0xe4ae('0x6'));var sox=require(_0xe4ae('0x7'));var csv=require(_0xe4ae('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe4ae('0x9'));var _=require('lodash');var squel=require(_0xe4ae('0xa'));var crypto=require(_0xe4ae('0xb'));var jsforce=require(_0xe4ae('0xc'));var deskjs=require(_0xe4ae('0xd'));var toCsv=require(_0xe4ae('0x8'));var querystring=require(_0xe4ae('0xe'));var Papa=require(_0xe4ae('0xf'));var Redis=require(_0xe4ae('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe4ae('0x11'));var hardwareService=require(_0xe4ae('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xe4ae('0x13'));var config=require(_0xe4ae('0x14'));var licenseUtil=require(_0xe4ae('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17e1f0,_0x193661){_0x193661=_0x193661||0xcc;return function(_0x375f23){if(_0x375f23){return _0x17e1f0[_0xe4ae('0x16')](_0x193661);}return _0x17e1f0['status'](_0x193661)['end']();};}function respondWithResult(_0xba489b,_0x25c43f){_0x25c43f=_0x25c43f||0xc8;return function(_0x8756a2){if(_0x8756a2){return _0xba489b[_0xe4ae('0x17')](_0x25c43f)[_0xe4ae('0x18')](_0x8756a2);}};}function respondWithFilteredResult(_0xa050e6,_0x1c554e){return function(_0x283ded){if(_0x283ded){var _0x100b91=typeof _0x1c554e[_0xe4ae('0x19')]==='undefined'&&typeof _0x1c554e[_0xe4ae('0x1a')]===_0xe4ae('0x1b');var _0x4768e7=_0x283ded['count'];var _0x50ead4=_0x100b91?0x0:_0x1c554e['offset'];var _0x3c9a94=_0x100b91?_0x283ded['count']:_0x1c554e[_0xe4ae('0x19')]+_0x1c554e[_0xe4ae('0x1a')];var _0x27c177;if(_0x3c9a94>=_0x4768e7){_0x3c9a94=_0x4768e7;_0x27c177=0xc8;}else{_0x27c177=0xce;}_0xa050e6[_0xe4ae('0x17')](_0x27c177);return _0xa050e6[_0xe4ae('0x1c')]('Content-Range',_0x50ead4+'-'+_0x3c9a94+'/'+_0x4768e7)[_0xe4ae('0x18')](_0x283ded);}return null;};}function patchUpdates(_0x2ada5e){return function(_0x2b8570){try{jsonpatch[_0xe4ae('0x1d')](_0x2b8570,_0x2ada5e,!![]);}catch(_0xb626b2){return BPromise[_0xe4ae('0x1e')](_0xb626b2);}return _0x2b8570[_0xe4ae('0x1f')]();};}function saveUpdates(_0x75e114,_0x119c10){return function(_0x8d681){if(_0x8d681){return _0x8d681[_0xe4ae('0x20')](_0x75e114)[_0xe4ae('0x21')](function(_0x241933){return _0x241933;});}return null;};}function removeEntity(_0xcf960e,_0x2f7e0a){return function(_0x1a01c5){if(_0x1a01c5){return _0x1a01c5[_0xe4ae('0x22')]()[_0xe4ae('0x21')](function(){_0xcf960e[_0xe4ae('0x17')](0xcc)[_0xe4ae('0x23')]();});}};}function handleEntityNotFound(_0x52938e,_0x2061c0){return function(_0xadbb94){if(!_0xadbb94){_0x52938e['sendStatus'](0x194);}return _0xadbb94;};}function handleError(_0x374d06,_0x286b2b){_0x286b2b=_0x286b2b||0x1f4;return function(_0x1a83b0){logger[_0xe4ae('0x24')](_0x1a83b0[_0xe4ae('0x25')]);if(_0x1a83b0[_0xe4ae('0x26')]){delete _0x1a83b0[_0xe4ae('0x26')];}_0x374d06[_0xe4ae('0x17')](_0x286b2b)[_0xe4ae('0x27')](_0x1a83b0);};}exports['index']=function(_0x5d2a29,_0x257ae9){var _0x551848={},_0x35673a={},_0x47a39a={'count':0x0,'rows':[]};var _0x3fe7e9=_[_0xe4ae('0x28')](db[_0xe4ae('0x29')][_0xe4ae('0x2a')],function(_0xed09d8){return{'name':_0xed09d8[_0xe4ae('0x2b')],'type':_0xed09d8[_0xe4ae('0x2c')][_0xe4ae('0x2d')]};});_0x35673a['model']=_['map'](_0x3fe7e9,_0xe4ae('0x26'));_0x35673a[_0xe4ae('0x2e')]=_['keys'](_0x5d2a29[_0xe4ae('0x2e')]);_0x35673a[_0xe4ae('0x2f')]=_[_0xe4ae('0x30')](_0x35673a['model'],_0x35673a['query']);_0x551848[_0xe4ae('0x31')]=_[_0xe4ae('0x30')](_0x35673a[_0xe4ae('0x32')],qs[_0xe4ae('0x33')](_0x5d2a29[_0xe4ae('0x2e')]['fields']));_0x551848[_0xe4ae('0x31')]=_0x551848[_0xe4ae('0x31')][_0xe4ae('0x34')]?_0x551848['attributes']:_0x35673a[_0xe4ae('0x32')];if(!_0x5d2a29[_0xe4ae('0x2e')]['hasOwnProperty'](_0xe4ae('0x35'))){_0x551848[_0xe4ae('0x1a')]=qs[_0xe4ae('0x1a')](_0x5d2a29[_0xe4ae('0x2e')][_0xe4ae('0x1a')]);_0x551848[_0xe4ae('0x19')]=qs[_0xe4ae('0x19')](_0x5d2a29['query'][_0xe4ae('0x19')]);}_0x551848[_0xe4ae('0x36')]=qs[_0xe4ae('0x37')](_0x5d2a29[_0xe4ae('0x2e')][_0xe4ae('0x37')]);_0x551848[_0xe4ae('0x38')]=qs[_0xe4ae('0x2f')](_[_0xe4ae('0x39')](_0x5d2a29[_0xe4ae('0x2e')],_0x35673a[_0xe4ae('0x2f')]),_0x3fe7e9);if(_0x5d2a29[_0xe4ae('0x2e')]['filter']){_0x551848[_0xe4ae('0x38')]=_[_0xe4ae('0x3a')](_0x551848[_0xe4ae('0x38')],{'$or':_['map'](_0x3fe7e9,function(_0x5d141b){if(_0x5d141b[_0xe4ae('0x2c')]!==_0xe4ae('0x3b')){var _0x20cd02={};_0x20cd02[_0x5d141b[_0xe4ae('0x26')]]={'$like':'%'+_0x5d2a29[_0xe4ae('0x2e')]['filter']+'%'};return _0x20cd02;}})});}_0x551848=_[_0xe4ae('0x3a')]({},_0x551848,_0x5d2a29[_0xe4ae('0x3c')]);var _0x4df89d={'where':_0x551848[_0xe4ae('0x38')]};return db[_0xe4ae('0x29')][_0xe4ae('0x3d')](_0x4df89d)[_0xe4ae('0x21')](function(_0x3333b0){_0x47a39a[_0xe4ae('0x3d')]=_0x3333b0;if(_0x5d2a29[_0xe4ae('0x2e')][_0xe4ae('0x3e')]){_0x551848[_0xe4ae('0x3f')]=[{'all':!![]}];}return db[_0xe4ae('0x29')][_0xe4ae('0x40')](_0x551848);})[_0xe4ae('0x21')](function(_0x43345d){_0x47a39a[_0xe4ae('0x41')]=_0x43345d;return _0x47a39a;})['then'](respondWithFilteredResult(_0x257ae9,_0x551848))[_0xe4ae('0x42')](handleError(_0x257ae9,null));};exports['show']=function(_0x31fd1f,_0x1b58d3){var _0x37b48b={'raw':!![],'where':{'id':_0x31fd1f[_0xe4ae('0x43')]['id']}},_0x2a9703={};_0x2a9703['model']=_['keys'](db[_0xe4ae('0x29')][_0xe4ae('0x2a')]);_0x2a9703[_0xe4ae('0x2e')]=_[_0xe4ae('0x44')](_0x31fd1f[_0xe4ae('0x2e')]);_0x2a9703['filters']=_[_0xe4ae('0x30')](_0x2a9703[_0xe4ae('0x32')],_0x2a9703[_0xe4ae('0x2e')]);_0x37b48b[_0xe4ae('0x31')]=_['intersection'](_0x2a9703[_0xe4ae('0x32')],qs['fields'](_0x31fd1f[_0xe4ae('0x2e')][_0xe4ae('0x33')]));_0x37b48b[_0xe4ae('0x31')]=_0x37b48b['attributes']['length']?_0x37b48b[_0xe4ae('0x31')]:_0x2a9703[_0xe4ae('0x32')];if(_0x31fd1f[_0xe4ae('0x2e')]['includeAll']){_0x37b48b[_0xe4ae('0x3f')]=[{'all':!![]}];}_0x37b48b=_[_0xe4ae('0x3a')]({},_0x37b48b,_0x31fd1f['options']);return db[_0xe4ae('0x29')][_0xe4ae('0x45')](_0x37b48b)[_0xe4ae('0x21')](handleEntityNotFound(_0x1b58d3,null))[_0xe4ae('0x21')](respondWithResult(_0x1b58d3,null))[_0xe4ae('0x42')](handleError(_0x1b58d3,null));};exports[_0xe4ae('0x46')]=function(_0x1e1f2f,_0x1474ed){return db[_0xe4ae('0x29')][_0xe4ae('0x46')](_0x1e1f2f['body'],{})[_0xe4ae('0x21')](respondWithResult(_0x1474ed,0xc9))[_0xe4ae('0x42')](handleError(_0x1474ed,null));};exports[_0xe4ae('0x20')]=function(_0x369f90,_0x796f9){if(_0x369f90[_0xe4ae('0x47')]['id']){delete _0x369f90[_0xe4ae('0x47')]['id'];}return db[_0xe4ae('0x29')][_0xe4ae('0x45')]({'where':{'id':_0x369f90[_0xe4ae('0x43')]['id']}})[_0xe4ae('0x21')](handleEntityNotFound(_0x796f9,null))[_0xe4ae('0x21')](saveUpdates(_0x369f90[_0xe4ae('0x47')],null))[_0xe4ae('0x21')](respondWithResult(_0x796f9,null))[_0xe4ae('0x42')](handleError(_0x796f9,null));};exports[_0xe4ae('0x22')]=function(_0x208a15,_0x4a3a06){return db[_0xe4ae('0x29')][_0xe4ae('0x45')]({'where':{'id':_0x208a15[_0xe4ae('0x43')]['id']}})[_0xe4ae('0x21')](handleEntityNotFound(_0x4a3a06,null))[_0xe4ae('0x21')](removeEntity(_0x4a3a06,null))[_0xe4ae('0x42')](handleError(_0x4a3a06,null));};exports[_0xe4ae('0x48')]=function(_0x3ba6b4,_0x4bfa0e){return db['OpenchannelQueueReport'][_0xe4ae('0x48')]()[_0xe4ae('0x21')](respondWithResult(_0x4bfa0e,null))['catch'](handleError(_0x4bfa0e,null));}; \ No newline at end of file +var _0x2e7b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','describe','rimraf','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis'];(function(_0x437d7f,_0x1feb46){var _0x31058c=function(_0x49dd1a){while(--_0x49dd1a){_0x437d7f['push'](_0x437d7f['shift']());}};_0x31058c(++_0x1feb46);}(_0x2e7b,0x1b9));var _0xb2e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2e7b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb2e7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb2e7('0x1'));var moment=require(_0xb2e7('0x2'));var BPromise=require(_0xb2e7('0x3'));var Mustache=require(_0xb2e7('0x4'));var util=require('util');var path=require(_0xb2e7('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb2e7('0x6'));var fs=require('fs');var fs_extra=require(_0xb2e7('0x7'));var _=require(_0xb2e7('0x8'));var squel=require(_0xb2e7('0x9'));var crypto=require('crypto');var jsforce=require(_0xb2e7('0xa'));var deskjs=require(_0xb2e7('0xb'));var toCsv=require(_0xb2e7('0xc'));var querystring=require(_0xb2e7('0xd'));var Papa=require('papaparse');var Redis=require(_0xb2e7('0xe'));var authService=require(_0xb2e7('0xf'));var qs=require(_0xb2e7('0x10'));var as=require(_0xb2e7('0x11'));var hardwareService=require(_0xb2e7('0x12'));var logger=require(_0xb2e7('0x13'))(_0xb2e7('0x14'));var utils=require(_0xb2e7('0x15'));var config=require(_0xb2e7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb2e7('0x17'))['db'];function respondWithStatusCode(_0x52dd79,_0x14aabb){_0x14aabb=_0x14aabb||0xcc;return function(_0x4ac96e){if(_0x4ac96e){return _0x52dd79[_0xb2e7('0x18')](_0x14aabb);}return _0x52dd79[_0xb2e7('0x19')](_0x14aabb)[_0xb2e7('0x1a')]();};}function respondWithResult(_0x394b59,_0x37cd1c){_0x37cd1c=_0x37cd1c||0xc8;return function(_0x49d1a7){if(_0x49d1a7){return _0x394b59[_0xb2e7('0x19')](_0x37cd1c)['json'](_0x49d1a7);}};}function respondWithFilteredResult(_0x55a749,_0x13e974){return function(_0x394d20){if(_0x394d20){var _0x1ff1d9=typeof _0x13e974[_0xb2e7('0x1b')]===_0xb2e7('0x1c')&&typeof _0x13e974[_0xb2e7('0x1d')]===_0xb2e7('0x1c');var _0x43318d=_0x394d20[_0xb2e7('0x1e')];var _0x4ec790=_0x1ff1d9?0x0:_0x13e974['offset'];var _0x560e80=_0x1ff1d9?_0x394d20[_0xb2e7('0x1e')]:_0x13e974[_0xb2e7('0x1b')]+_0x13e974['limit'];var _0x1aeeb9;if(_0x560e80>=_0x43318d){_0x560e80=_0x43318d;_0x1aeeb9=0xc8;}else{_0x1aeeb9=0xce;}_0x55a749[_0xb2e7('0x19')](_0x1aeeb9);return _0x55a749[_0xb2e7('0x1f')](_0xb2e7('0x20'),_0x4ec790+'-'+_0x560e80+'/'+_0x43318d)[_0xb2e7('0x21')](_0x394d20);}return null;};}function patchUpdates(_0x1aff6f){return function(_0x5a4ee9){try{jsonpatch[_0xb2e7('0x22')](_0x5a4ee9,_0x1aff6f,!![]);}catch(_0x1ef2f2){return BPromise[_0xb2e7('0x23')](_0x1ef2f2);}return _0x5a4ee9[_0xb2e7('0x24')]();};}function saveUpdates(_0x4b5dda,_0x3ed2d7){return function(_0x1327e8){if(_0x1327e8){return _0x1327e8[_0xb2e7('0x25')](_0x4b5dda)[_0xb2e7('0x26')](function(_0x243dfd){return _0x243dfd;});}return null;};}function removeEntity(_0x53b823,_0x3e2a24){return function(_0x15f2bf){if(_0x15f2bf){return _0x15f2bf[_0xb2e7('0x27')]()[_0xb2e7('0x26')](function(){_0x53b823[_0xb2e7('0x19')](0xcc)[_0xb2e7('0x1a')]();});}};}function handleEntityNotFound(_0x2bc011,_0x53a023){return function(_0x39a3b2){if(!_0x39a3b2){_0x2bc011[_0xb2e7('0x18')](0x194);}return _0x39a3b2;};}function handleError(_0x2c208e,_0xb51ddc){_0xb51ddc=_0xb51ddc||0x1f4;return function(_0x2b6029){logger[_0xb2e7('0x28')](_0x2b6029['stack']);if(_0x2b6029[_0xb2e7('0x29')]){delete _0x2b6029[_0xb2e7('0x29')];}_0x2c208e[_0xb2e7('0x19')](_0xb51ddc)[_0xb2e7('0x2a')](_0x2b6029);};}exports[_0xb2e7('0x2b')]=function(_0x4718dd,_0x24d303){var _0x347011={},_0x3ceb3d={},_0x43856c={'count':0x0,'rows':[]};var _0x9ce73f=_[_0xb2e7('0x2c')](db[_0xb2e7('0x2d')][_0xb2e7('0x2e')],function(_0x3b145d){return{'name':_0x3b145d[_0xb2e7('0x2f')],'type':_0x3b145d[_0xb2e7('0x30')][_0xb2e7('0x31')]};});_0x3ceb3d[_0xb2e7('0x32')]=_[_0xb2e7('0x2c')](_0x9ce73f,_0xb2e7('0x29'));_0x3ceb3d[_0xb2e7('0x33')]=_[_0xb2e7('0x34')](_0x4718dd[_0xb2e7('0x33')]);_0x3ceb3d[_0xb2e7('0x35')]=_[_0xb2e7('0x36')](_0x3ceb3d['model'],_0x3ceb3d['query']);_0x347011[_0xb2e7('0x37')]=_[_0xb2e7('0x36')](_0x3ceb3d[_0xb2e7('0x32')],qs[_0xb2e7('0x38')](_0x4718dd[_0xb2e7('0x33')]['fields']));_0x347011[_0xb2e7('0x37')]=_0x347011['attributes'][_0xb2e7('0x39')]?_0x347011[_0xb2e7('0x37')]:_0x3ceb3d[_0xb2e7('0x32')];if(!_0x4718dd['query'][_0xb2e7('0x3a')]('nolimit')){_0x347011[_0xb2e7('0x1d')]=qs[_0xb2e7('0x1d')](_0x4718dd[_0xb2e7('0x33')][_0xb2e7('0x1d')]);_0x347011[_0xb2e7('0x1b')]=qs['offset'](_0x4718dd[_0xb2e7('0x33')][_0xb2e7('0x1b')]);}_0x347011['order']=qs[_0xb2e7('0x3b')](_0x4718dd[_0xb2e7('0x33')]['sort']);_0x347011[_0xb2e7('0x3c')]=qs[_0xb2e7('0x35')](_[_0xb2e7('0x3d')](_0x4718dd[_0xb2e7('0x33')],_0x3ceb3d[_0xb2e7('0x35')]),_0x9ce73f);if(_0x4718dd['query'][_0xb2e7('0x3e')]){_0x347011['where']=_[_0xb2e7('0x3f')](_0x347011[_0xb2e7('0x3c')],{'$or':_[_0xb2e7('0x2c')](_0x9ce73f,function(_0x49aead){if(_0x49aead[_0xb2e7('0x30')]!=='VIRTUAL'){var _0x4c895d={};_0x4c895d[_0x49aead[_0xb2e7('0x29')]]={'$like':'%'+_0x4718dd[_0xb2e7('0x33')]['filter']+'%'};return _0x4c895d;}})});}_0x347011=_[_0xb2e7('0x3f')]({},_0x347011,_0x4718dd['options']);var _0x3df380={'where':_0x347011[_0xb2e7('0x3c')]};return db[_0xb2e7('0x2d')]['count'](_0x3df380)[_0xb2e7('0x26')](function(_0x4417e9){_0x43856c[_0xb2e7('0x1e')]=_0x4417e9;if(_0x4718dd[_0xb2e7('0x33')][_0xb2e7('0x40')]){_0x347011[_0xb2e7('0x41')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xb2e7('0x42')](_0x347011);})['then'](function(_0x42eb4a){_0x43856c[_0xb2e7('0x43')]=_0x42eb4a;return _0x43856c;})[_0xb2e7('0x26')](respondWithFilteredResult(_0x24d303,_0x347011))['catch'](handleError(_0x24d303,null));};exports[_0xb2e7('0x44')]=function(_0x362899,_0x3a9d0a){var _0x43b47a={'raw':!![],'where':{'id':_0x362899[_0xb2e7('0x45')]['id']}},_0xf318a={};_0xf318a[_0xb2e7('0x32')]=_[_0xb2e7('0x34')](db[_0xb2e7('0x2d')][_0xb2e7('0x2e')]);_0xf318a[_0xb2e7('0x33')]=_[_0xb2e7('0x34')](_0x362899[_0xb2e7('0x33')]);_0xf318a[_0xb2e7('0x35')]=_['intersection'](_0xf318a['model'],_0xf318a[_0xb2e7('0x33')]);_0x43b47a[_0xb2e7('0x37')]=_['intersection'](_0xf318a['model'],qs['fields'](_0x362899['query'][_0xb2e7('0x38')]));_0x43b47a[_0xb2e7('0x37')]=_0x43b47a['attributes']['length']?_0x43b47a[_0xb2e7('0x37')]:_0xf318a[_0xb2e7('0x32')];if(_0x362899['query']['includeAll']){_0x43b47a[_0xb2e7('0x41')]=[{'all':!![]}];}_0x43b47a=_['merge']({},_0x43b47a,_0x362899[_0xb2e7('0x46')]);return db[_0xb2e7('0x2d')][_0xb2e7('0x47')](_0x43b47a)[_0xb2e7('0x26')](handleEntityNotFound(_0x3a9d0a,null))[_0xb2e7('0x26')](respondWithResult(_0x3a9d0a,null))[_0xb2e7('0x48')](handleError(_0x3a9d0a,null));};exports[_0xb2e7('0x49')]=function(_0x228d9c,_0x45f09e){return db['OpenchannelQueueReport'][_0xb2e7('0x49')](_0x228d9c[_0xb2e7('0x4a')],{})['then'](respondWithResult(_0x45f09e,0xc9))[_0xb2e7('0x48')](handleError(_0x45f09e,null));};exports['update']=function(_0x23c6db,_0x1c7cc7){if(_0x23c6db['body']['id']){delete _0x23c6db[_0xb2e7('0x4a')]['id'];}return db[_0xb2e7('0x2d')][_0xb2e7('0x47')]({'where':{'id':_0x23c6db[_0xb2e7('0x45')]['id']}})[_0xb2e7('0x26')](handleEntityNotFound(_0x1c7cc7,null))[_0xb2e7('0x26')](saveUpdates(_0x23c6db['body'],null))['then'](respondWithResult(_0x1c7cc7,null))['catch'](handleError(_0x1c7cc7,null));};exports[_0xb2e7('0x27')]=function(_0x572660,_0x12185c){return db[_0xb2e7('0x2d')][_0xb2e7('0x47')]({'where':{'id':_0x572660[_0xb2e7('0x45')]['id']}})[_0xb2e7('0x26')](handleEntityNotFound(_0x12185c,null))[_0xb2e7('0x26')](removeEntity(_0x12185c,null))['catch'](handleError(_0x12185c,null));};exports[_0xb2e7('0x4b')]=function(_0x1137be,_0x4dc104){return db[_0xb2e7('0x2d')][_0xb2e7('0x4b')]()[_0xb2e7('0x26')](respondWithResult(_0x4dc104,null))[_0xb2e7('0x48')](handleError(_0x4dc104,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index d082422..9c2b385 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 _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x3df9d5,_0x1a30a3){var _0x5e6c6b=function(_0x25ed53){while(--_0x25ed53){_0x3df9d5['push'](_0x3df9d5['shift']());}};_0x5e6c6b(++_0x1a30a3);}(_0x7a54,0x106));var _0x47a5=function(_0x481639,_0x43b487){_0x481639=_0x481639-0x0;var _0x5375ef=_0x7a54[_0x481639];return _0x5375ef;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x814b,0x1a2));var _0xb814=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0x814b[_0x429948];return _0x35d5d1;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index b5302ec..f793953 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0abf=['debug','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','UpdateOpenchannelQueueReport','where','attributes','limit'];(function(_0x2e11ca,_0x42c8aa){var _0x13e0e6=function(_0x14b835){while(--_0x14b835){_0x2e11ca['push'](_0x2e11ca['shift']());}};_0x13e0e6(++_0x42c8aa);}(_0x0abf,0xe8));var _0xf0ab=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0abf[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233afe,_0x57ff3b,_0x2c4628){return new BPromise(function(_0x3f7e2b,_0x3ca099){return client[_0xf0ab('0xa')](_0x233afe,_0x2c4628)['then'](function(_0x472508){logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,'request\x20sent');logger['debug'](_0xf0ab('0xd'),_0x57ff3b,'request\x20sent',JSON[_0xf0ab('0xe')](_0x472508));if(_0x472508[_0xf0ab('0xf')]){if(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x10')]===0x1f4){logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')]['message']);return _0x3ca099(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);return _0x3f7e2b(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}else{logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,_0xf0ab('0x12'));_0x3f7e2b(_0x472508[_0xf0ab('0x13')][_0xf0ab('0x11')]);}})[_0xf0ab('0x14')](function(_0x230f40){logger['error'](_0xf0ab('0xc'),_0x57ff3b,_0x230f40);_0x3ca099(_0x230f40);});});}exports[_0xf0ab('0x15')]=function(_0x1803f0){var _0x1ffeb5=this;return new Promise(function(_0x776619,_0xb9a33){return db[_0xf0ab('0x16')][_0xf0ab('0x17')](_0x1803f0[_0xf0ab('0x18')],{'raw':_0x1803f0[_0xf0ab('0x19')]?_0x1803f0[_0xf0ab('0x19')][_0xf0ab('0x1a')]===undefined?!![]:![]:!![]})[_0xf0ab('0x1b')](function(_0x22a205){logger[_0xf0ab('0xb')](_0xf0ab('0x15'),_0x1803f0);logger['debug'](_0xf0ab('0x15'),_0x1803f0,JSON[_0xf0ab('0xe')](_0x22a205));_0x776619(_0x22a205);})[_0xf0ab('0x14')](function(_0x11ab3a){logger[_0xf0ab('0xf')](_0xf0ab('0x15'),_0x11ab3a[_0xf0ab('0x11')],_0x1803f0);_0xb9a33(_0x1ffeb5[_0xf0ab('0xf')](0x1f4,_0x11ab3a[_0xf0ab('0x11')]));});});};exports[_0xf0ab('0x1c')]=function(_0x43119f){var _0x5645b2=this;return new Promise(function(_0x585841,_0x4eee21){return db[_0xf0ab('0x16')]['update'](_0x43119f[_0xf0ab('0x18')],{'raw':_0x43119f[_0xf0ab('0x19')]?_0x43119f['options'][_0xf0ab('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43119f[_0xf0ab('0x19')]?_0x43119f[_0xf0ab('0x19')][_0xf0ab('0x1d')]||null:null,'attributes':_0x43119f[_0xf0ab('0x19')]?_0x43119f['options'][_0xf0ab('0x1e')]||null:null,'limit':_0x43119f['options']?_0x43119f['options'][_0xf0ab('0x1f')]||null:null})[_0xf0ab('0x1b')](function(_0x1b223d){logger[_0xf0ab('0xb')](_0xf0ab('0x1c'),_0x43119f);logger[_0xf0ab('0x20')](_0xf0ab('0x1c'),_0x43119f,JSON[_0xf0ab('0xe')](_0x1b223d));_0x585841(_0x1b223d);})[_0xf0ab('0x14')](function(_0x2f0fcd){logger[_0xf0ab('0xf')](_0xf0ab('0x1c'),_0x2f0fcd['message'],_0x43119f);_0x4eee21(_0x5645b2[_0xf0ab('0xf')](0x1f4,_0x2f0fcd[_0xf0ab('0x11')]));});});}; \ No newline at end of file +var _0xa9fc=['body','options','raw','CreateOpenchannelQueueReport','stringify','catch','UpdateOpenchannelQueueReport','where','attributes','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','OpenchannelQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9fc,0x19f));var _0xca9f=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0xa9fc[_0x381379];return _0x3e1063;};'use strict';var _=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var moment=require(_0xca9f('0x2'));var BPromise=require(_0xca9f('0x3'));var rs=require(_0xca9f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca9f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xca9f('0x6'))(_0xca9f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xca9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x48f9ca,_0x39963d,_0x61b1b6){return new BPromise(function(_0x400980,_0xf7ebb1){return client[_0xca9f('0x9')](_0x48f9ca,_0x61b1b6)[_0xca9f('0xa')](function(_0x4713f0){logger[_0xca9f('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x39963d,_0xca9f('0xc'));logger[_0xca9f('0xd')](_0xca9f('0xe'),_0x39963d,_0xca9f('0xc'),JSON['stringify'](_0x4713f0));if(_0x4713f0[_0xca9f('0xf')]){if(_0x4713f0[_0xca9f('0xf')]['code']===0x1f4){logger[_0xca9f('0xf')](_0xca9f('0x10'),_0x39963d,_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);return _0xf7ebb1(_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);}logger[_0xca9f('0xf')](_0xca9f('0x10'),_0x39963d,_0x4713f0[_0xca9f('0xf')][_0xca9f('0x11')]);return _0x400980(_0x4713f0['error']['message']);}else{logger[_0xca9f('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x39963d,'request\x20sent');_0x400980(_0x4713f0[_0xca9f('0x12')][_0xca9f('0x11')]);}})['catch'](function(_0x4afedf){logger['error'](_0xca9f('0x10'),_0x39963d,_0x4afedf);_0xf7ebb1(_0x4afedf);});});}exports['CreateOpenchannelQueueReport']=function(_0x22c161){var _0x2b3cfc=this;return new Promise(function(_0x1543aa,_0x83aa2b){return db[_0xca9f('0x13')]['create'](_0x22c161[_0xca9f('0x14')],{'raw':_0x22c161['options']?_0x22c161[_0xca9f('0x15')][_0xca9f('0x16')]===undefined?!![]:![]:!![]})[_0xca9f('0xa')](function(_0x2799e8){logger[_0xca9f('0xb')]('CreateOpenchannelQueueReport',_0x22c161);logger[_0xca9f('0xd')](_0xca9f('0x17'),_0x22c161,JSON[_0xca9f('0x18')](_0x2799e8));_0x1543aa(_0x2799e8);})[_0xca9f('0x19')](function(_0x239b30){logger['error']('CreateOpenchannelQueueReport',_0x239b30[_0xca9f('0x11')],_0x22c161);_0x83aa2b(_0x2b3cfc[_0xca9f('0xf')](0x1f4,_0x239b30[_0xca9f('0x11')]));});});};exports[_0xca9f('0x1a')]=function(_0x319b3b){var _0x558ecd=this;return new Promise(function(_0x40ef71,_0x1f7939){return db[_0xca9f('0x13')]['update'](_0x319b3b[_0xca9f('0x14')],{'raw':_0x319b3b[_0xca9f('0x15')]?_0x319b3b[_0xca9f('0x15')][_0xca9f('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x319b3b[_0xca9f('0x15')]?_0x319b3b['options'][_0xca9f('0x1b')]||null:null,'attributes':_0x319b3b[_0xca9f('0x15')]?_0x319b3b[_0xca9f('0x15')][_0xca9f('0x1c')]||null:null,'limit':_0x319b3b[_0xca9f('0x15')]?_0x319b3b['options']['limit']||null:null})[_0xca9f('0xa')](function(_0x5dfa6f){logger[_0xca9f('0xb')](_0xca9f('0x1a'),_0x319b3b);logger[_0xca9f('0xd')](_0xca9f('0x1a'),_0x319b3b,JSON['stringify'](_0x5dfa6f));_0x40ef71(_0x5dfa6f);})['catch'](function(_0xf153c8){logger['error'](_0xca9f('0x1a'),_0xf153c8['message'],_0x319b3b);_0x1f7939(_0x558ecd[_0xca9f('0xf')](0x1f4,_0xf153c8[_0xca9f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index c915218..55a86e3 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 _0x771b=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','get','/describe','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x17f7c1,_0x2fa7b9){var _0x13c24a=function(_0x4a7f44){while(--_0x4a7f44){_0x17f7c1['push'](_0x17f7c1['shift']());}};_0x13c24a(++_0x2fa7b9);}(_0x771b,0x6e));var _0xb771=function(_0x3fdd09,_0x2853f7){_0x3fdd09=_0x3fdd09-0x0;var _0x2be280=_0x771b[_0x3fdd09];return _0x2be280;};'use strict';var multer=require(_0xb771('0x0'));var util=require(_0xb771('0x1'));var path=require(_0xb771('0x2'));var timeout=require(_0xb771('0x3'));var express=require(_0xb771('0x4'));var router=express[_0xb771('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb771('0x6'));var interaction=require(_0xb771('0x7'));var config=require(_0xb771('0x8'));var controller=require(_0xb771('0x9'));router['get']('/',auth[_0xb771('0xa')](),controller['index']);router[_0xb771('0xb')](_0xb771('0xc'),auth[_0xb771('0xa')](),controller['describe']);router[_0xb771('0xb')](_0xb771('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xb771('0xe')]('/',auth[_0xb771('0xa')](),controller['create']);router[_0xb771('0xf')](_0xb771('0xd'),auth[_0xb771('0xa')](),controller[_0xb771('0x10')]);router[_0xb771('0x11')]('/:id',auth[_0xb771('0xa')](),controller['destroy']);module[_0xb771('0x12')]=router; \ No newline at end of file +var _0x6321=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','describe','show','post','put','/:id','update'];(function(_0x46b5e2,_0x3a352b){var _0x53746a=function(_0x304dcf){while(--_0x304dcf){_0x46b5e2['push'](_0x46b5e2['shift']());}};_0x53746a(++_0x3a352b);}(_0x6321,0x13b));var _0x1632=function(_0x179e6e,_0x43d0d7){_0x179e6e=_0x179e6e-0x0;var _0x5bcd63=_0x6321[_0x179e6e];return _0x5bcd63;};'use strict';var multer=require(_0x1632('0x0'));var util=require(_0x1632('0x1'));var path=require(_0x1632('0x2'));var timeout=require(_0x1632('0x3'));var express=require(_0x1632('0x4'));var router=express[_0x1632('0x5')]();var fs_extra=require(_0x1632('0x6'));var auth=require(_0x1632('0x7'));var interaction=require(_0x1632('0x8'));var config=require(_0x1632('0x9'));var controller=require(_0x1632('0xa'));router[_0x1632('0xb')]('/',auth['isAuthenticated'](),controller[_0x1632('0xc')]);router[_0x1632('0xb')](_0x1632('0xd'),auth[_0x1632('0xe')](),controller[_0x1632('0xf')]);router[_0x1632('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x1632('0x10')]);router[_0x1632('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1632('0x12')](_0x1632('0x13'),auth[_0x1632('0xe')](),controller[_0x1632('0x14')]);router[_0x1632('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1632('0x16')]);module[_0x1632('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index bcf728d..89ca90e 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x414660,_0x3c2162){var _0x4b925d=function(_0x345d09){while(--_0x345d09){_0x414660['push'](_0x414660['shift']());}};_0x4b925d(++_0x3c2162);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x255c48,_0x2a4449){_0x255c48=_0x255c48-0x0;var _0xaebda3=_0xf3cd[_0x255c48];return _0xaebda3;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x455f1f,_0x4a997f){var _0x30f6bd=function(_0xf13930){while(--_0xf13930){_0x455f1f['push'](_0x455f1f['shift']());}};_0x30f6bd(++_0x4a997f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x4cf8d4,_0x5aee73){_0x4cf8d4=_0x4cf8d4-0x0;var _0x2c1beb=_0xf3cd[_0x4cf8d4];return _0x2c1beb;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 65481aa..a2881c3 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 _0x8d26=['send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','keys','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','stack','name'];(function(_0x55d9ac,_0x3073c2){var _0x599fee=function(_0x1cd5cc){while(--_0x1cd5cc){_0x55d9ac['push'](_0x55d9ac['shift']());}};_0x599fee(++_0x3073c2);}(_0x8d26,0xba));var _0x68d2=function(_0x2498b5,_0x514ddb){_0x2498b5=_0x2498b5-0x0;var _0x5c48d8=_0x8d26[_0x2498b5];return _0x5c48d8;};'use strict';var emlformat=require(_0x68d2('0x0'));var rimraf=require(_0x68d2('0x1'));var zipdir=require(_0x68d2('0x2'));var jsonpatch=require(_0x68d2('0x3'));var rp=require(_0x68d2('0x4'));var moment=require(_0x68d2('0x5'));var BPromise=require(_0x68d2('0x6'));var Mustache=require('mustache');var util=require(_0x68d2('0x7'));var path=require(_0x68d2('0x8'));var sox=require(_0x68d2('0x9'));var csv=require(_0x68d2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x68d2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x68d2('0xc'));var jsforce=require(_0x68d2('0xd'));var deskjs=require(_0x68d2('0xe'));var toCsv=require(_0x68d2('0xa'));var querystring=require('querystring');var Papa=require(_0x68d2('0xf'));var Redis=require(_0x68d2('0x10'));var authService=require(_0x68d2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x68d2('0x12'));var hardwareService=require(_0x68d2('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x68d2('0x14'));var config=require(_0x68d2('0x15'));var licenseUtil=require(_0x68d2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x446b82,_0x1511cf){_0x1511cf=_0x1511cf||0xcc;return function(_0x2d5fe0){if(_0x2d5fe0){return _0x446b82[_0x68d2('0x17')](_0x1511cf);}return _0x446b82[_0x68d2('0x18')](_0x1511cf)[_0x68d2('0x19')]();};}function respondWithResult(_0x4c4afe,_0x39539b){_0x39539b=_0x39539b||0xc8;return function(_0x29ffbf){if(_0x29ffbf){return _0x4c4afe[_0x68d2('0x18')](_0x39539b)[_0x68d2('0x1a')](_0x29ffbf);}};}function respondWithFilteredResult(_0x378dd4,_0x55bddf){return function(_0x569b13){if(_0x569b13){var _0x3abfa9=typeof _0x55bddf[_0x68d2('0x1b')]===_0x68d2('0x1c')&&typeof _0x55bddf[_0x68d2('0x1d')]===_0x68d2('0x1c');var _0x390a0e=_0x569b13[_0x68d2('0x1e')];var _0x43a7e6=_0x3abfa9?0x0:_0x55bddf['offset'];var _0x956ef0=_0x3abfa9?_0x569b13['count']:_0x55bddf['offset']+_0x55bddf[_0x68d2('0x1d')];var _0x5b1fe8;if(_0x956ef0>=_0x390a0e){_0x956ef0=_0x390a0e;_0x5b1fe8=0xc8;}else{_0x5b1fe8=0xce;}_0x378dd4[_0x68d2('0x18')](_0x5b1fe8);return _0x378dd4[_0x68d2('0x1f')](_0x68d2('0x20'),_0x43a7e6+'-'+_0x956ef0+'/'+_0x390a0e)[_0x68d2('0x1a')](_0x569b13);}return null;};}function patchUpdates(_0x32525f){return function(_0x38a84a){try{jsonpatch[_0x68d2('0x21')](_0x38a84a,_0x32525f,!![]);}catch(_0x1fc05d){return BPromise['reject'](_0x1fc05d);}return _0x38a84a['save']();};}function saveUpdates(_0x447f5e,_0x26fa2d){return function(_0x379526){if(_0x379526){return _0x379526[_0x68d2('0x22')](_0x447f5e)['then'](function(_0x552722){return _0x552722;});}return null;};}function removeEntity(_0x2d9dea,_0x1bbc12){return function(_0x4f9b36){if(_0x4f9b36){return _0x4f9b36[_0x68d2('0x23')]()[_0x68d2('0x24')](function(){_0x2d9dea[_0x68d2('0x18')](0xcc)[_0x68d2('0x19')]();});}};}function handleEntityNotFound(_0xb27e8c,_0x2ce115){return function(_0x5e92e5){if(!_0x5e92e5){_0xb27e8c[_0x68d2('0x17')](0x194);}return _0x5e92e5;};}function handleError(_0xe93ef7,_0x489c2c){_0x489c2c=_0x489c2c||0x1f4;return function(_0x936671){logger['error'](_0x936671[_0x68d2('0x25')]);if(_0x936671[_0x68d2('0x26')]){delete _0x936671['name'];}_0xe93ef7['status'](_0x489c2c)[_0x68d2('0x27')](_0x936671);};}exports['index']=function(_0x177de4,_0x9ad0bf){var _0x2ecb18={},_0x379dea={},_0x2bf5e7={'count':0x0,'rows':[]};var _0x572b64=_[_0x68d2('0x28')](db[_0x68d2('0x29')][_0x68d2('0x2a')],function(_0x5827a2){return{'name':_0x5827a2[_0x68d2('0x2b')],'type':_0x5827a2[_0x68d2('0x2c')][_0x68d2('0x2d')]};});_0x379dea['model']=_['map'](_0x572b64,_0x68d2('0x26'));_0x379dea['query']=_[_0x68d2('0x2e')](_0x177de4['query']);_0x379dea['filters']=_[_0x68d2('0x2f')](_0x379dea[_0x68d2('0x30')],_0x379dea[_0x68d2('0x31')]);_0x2ecb18['attributes']=_[_0x68d2('0x2f')](_0x379dea[_0x68d2('0x30')],qs[_0x68d2('0x32')](_0x177de4[_0x68d2('0x31')]['fields']));_0x2ecb18[_0x68d2('0x33')]=_0x2ecb18[_0x68d2('0x33')][_0x68d2('0x34')]?_0x2ecb18[_0x68d2('0x33')]:_0x379dea['model'];if(!_0x177de4[_0x68d2('0x31')][_0x68d2('0x35')](_0x68d2('0x36'))){_0x2ecb18[_0x68d2('0x1d')]=qs[_0x68d2('0x1d')](_0x177de4[_0x68d2('0x31')][_0x68d2('0x1d')]);_0x2ecb18[_0x68d2('0x1b')]=qs[_0x68d2('0x1b')](_0x177de4[_0x68d2('0x31')][_0x68d2('0x1b')]);}_0x2ecb18[_0x68d2('0x37')]=qs['sort'](_0x177de4[_0x68d2('0x31')][_0x68d2('0x38')]);_0x2ecb18[_0x68d2('0x39')]=qs[_0x68d2('0x3a')](_[_0x68d2('0x3b')](_0x177de4[_0x68d2('0x31')],_0x379dea[_0x68d2('0x3a')]),_0x572b64);if(_0x177de4['query'][_0x68d2('0x3c')]){_0x2ecb18['where']=_[_0x68d2('0x3d')](_0x2ecb18['where'],{'$or':_[_0x68d2('0x28')](_0x572b64,function(_0x57af2f){if(_0x57af2f[_0x68d2('0x2c')]!==_0x68d2('0x3e')){var _0x185b26={};_0x185b26[_0x57af2f[_0x68d2('0x26')]]={'$like':'%'+_0x177de4[_0x68d2('0x31')][_0x68d2('0x3c')]+'%'};return _0x185b26;}})});}_0x2ecb18=_[_0x68d2('0x3d')]({},_0x2ecb18,_0x177de4['options']);var _0xa1dcc1={'where':_0x2ecb18[_0x68d2('0x39')]};return db[_0x68d2('0x29')][_0x68d2('0x1e')](_0xa1dcc1)[_0x68d2('0x24')](function(_0x24ce40){_0x2bf5e7[_0x68d2('0x1e')]=_0x24ce40;if(_0x177de4[_0x68d2('0x31')][_0x68d2('0x3f')]){_0x2ecb18[_0x68d2('0x40')]=[{'all':!![]}];}return db[_0x68d2('0x29')][_0x68d2('0x41')](_0x2ecb18);})[_0x68d2('0x24')](function(_0x218ffe){_0x2bf5e7[_0x68d2('0x42')]=_0x218ffe;return _0x2bf5e7;})['then'](respondWithFilteredResult(_0x9ad0bf,_0x2ecb18))[_0x68d2('0x43')](handleError(_0x9ad0bf,null));};exports[_0x68d2('0x44')]=function(_0x51149b,_0x433aff){var _0x4e4d7b={'raw':!![],'where':{'id':_0x51149b[_0x68d2('0x45')]['id']}},_0x197e33={};_0x197e33[_0x68d2('0x30')]=_[_0x68d2('0x2e')](db[_0x68d2('0x29')][_0x68d2('0x2a')]);_0x197e33[_0x68d2('0x31')]=_[_0x68d2('0x2e')](_0x51149b[_0x68d2('0x31')]);_0x197e33['filters']=_[_0x68d2('0x2f')](_0x197e33['model'],_0x197e33[_0x68d2('0x31')]);_0x4e4d7b['attributes']=_[_0x68d2('0x2f')](_0x197e33[_0x68d2('0x30')],qs['fields'](_0x51149b['query'][_0x68d2('0x32')]));_0x4e4d7b[_0x68d2('0x33')]=_0x4e4d7b[_0x68d2('0x33')][_0x68d2('0x34')]?_0x4e4d7b['attributes']:_0x197e33[_0x68d2('0x30')];if(_0x51149b[_0x68d2('0x31')][_0x68d2('0x3f')]){_0x4e4d7b[_0x68d2('0x40')]=[{'all':!![]}];}_0x4e4d7b=_['merge']({},_0x4e4d7b,_0x51149b[_0x68d2('0x46')]);return db[_0x68d2('0x29')][_0x68d2('0x47')](_0x4e4d7b)[_0x68d2('0x24')](handleEntityNotFound(_0x433aff,null))[_0x68d2('0x24')](respondWithResult(_0x433aff,null))[_0x68d2('0x43')](handleError(_0x433aff,null));};exports[_0x68d2('0x48')]=function(_0xfe69df,_0x4f6989){return db['OpenchannelTransferReport'][_0x68d2('0x48')](_0xfe69df[_0x68d2('0x49')],{})[_0x68d2('0x24')](respondWithResult(_0x4f6989,0xc9))[_0x68d2('0x43')](handleError(_0x4f6989,null));};exports[_0x68d2('0x22')]=function(_0x21b1f1,_0x239463){if(_0x21b1f1['body']['id']){delete _0x21b1f1[_0x68d2('0x49')]['id'];}return db['OpenchannelTransferReport'][_0x68d2('0x47')]({'where':{'id':_0x21b1f1[_0x68d2('0x45')]['id']}})['then'](handleEntityNotFound(_0x239463,null))['then'](saveUpdates(_0x21b1f1[_0x68d2('0x49')],null))[_0x68d2('0x24')](respondWithResult(_0x239463,null))['catch'](handleError(_0x239463,null));};exports[_0x68d2('0x23')]=function(_0x5a2750,_0x5c3694){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x5a2750['params']['id']}})[_0x68d2('0x24')](handleEntityNotFound(_0x5c3694,null))['then'](removeEntity(_0x5c3694,null))[_0x68d2('0x43')](handleError(_0x5c3694,null));};exports[_0x68d2('0x4a')]=function(_0x51624b,_0x461fcc){return db[_0x68d2('0x29')][_0x68d2('0x4a')]()[_0x68d2('0x24')](respondWithResult(_0x461fcc,null))[_0x68d2('0x43')](handleError(_0x461fcc,null));}; \ No newline at end of file +var _0x8ef7=['where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','set','Content-Range','json','apply','reject','then','destroy','error','stack','send','map','OpenchannelTransferReport','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x65a1c7,_0x46bd0f){var _0x24707c=function(_0x365c93){while(--_0x365c93){_0x65a1c7['push'](_0x65a1c7['shift']());}};_0x24707c(++_0x46bd0f);}(_0x8ef7,0x175));var _0x78ef=function(_0x1d1c5a,_0x348f4f){_0x1d1c5a=_0x1d1c5a-0x0;var _0xc5df6a=_0x8ef7[_0x1d1c5a];return _0xc5df6a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78ef('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x78ef('0x1'));var rp=require(_0x78ef('0x2'));var moment=require(_0x78ef('0x3'));var BPromise=require(_0x78ef('0x4'));var Mustache=require(_0x78ef('0x5'));var util=require('util');var path=require(_0x78ef('0x6'));var sox=require(_0x78ef('0x7'));var csv=require(_0x78ef('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78ef('0x9'));var _=require(_0x78ef('0xa'));var squel=require(_0x78ef('0xb'));var crypto=require(_0x78ef('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x78ef('0xd'));var toCsv=require(_0x78ef('0x8'));var querystring=require(_0x78ef('0xe'));var Papa=require(_0x78ef('0xf'));var Redis=require(_0x78ef('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x78ef('0x11'));var as=require(_0x78ef('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x78ef('0x13'));var utils=require(_0x78ef('0x14'));var config=require(_0x78ef('0x15'));var licenseUtil=require(_0x78ef('0x16'));var db=require(_0x78ef('0x17'))['db'];function respondWithStatusCode(_0x27e43b,_0x5d8e1b){_0x5d8e1b=_0x5d8e1b||0xcc;return function(_0x23a6a0){if(_0x23a6a0){return _0x27e43b[_0x78ef('0x18')](_0x5d8e1b);}return _0x27e43b[_0x78ef('0x19')](_0x5d8e1b)[_0x78ef('0x1a')]();};}function respondWithResult(_0x4cb542,_0x3e06ba){_0x3e06ba=_0x3e06ba||0xc8;return function(_0xdaf425){if(_0xdaf425){return _0x4cb542['status'](_0x3e06ba)['json'](_0xdaf425);}};}function respondWithFilteredResult(_0x3e1b6e,_0x311c55){return function(_0x4e3e7b){if(_0x4e3e7b){var _0x2d6627=typeof _0x311c55[_0x78ef('0x1b')]===_0x78ef('0x1c')&&typeof _0x311c55[_0x78ef('0x1d')]===_0x78ef('0x1c');var _0x53181a=_0x4e3e7b['count'];var _0x24c7d9=_0x2d6627?0x0:_0x311c55['offset'];var _0x5b19aa=_0x2d6627?_0x4e3e7b[_0x78ef('0x1e')]:_0x311c55[_0x78ef('0x1b')]+_0x311c55['limit'];var _0x5fcfe0;if(_0x5b19aa>=_0x53181a){_0x5b19aa=_0x53181a;_0x5fcfe0=0xc8;}else{_0x5fcfe0=0xce;}_0x3e1b6e[_0x78ef('0x19')](_0x5fcfe0);return _0x3e1b6e[_0x78ef('0x1f')](_0x78ef('0x20'),_0x24c7d9+'-'+_0x5b19aa+'/'+_0x53181a)[_0x78ef('0x21')](_0x4e3e7b);}return null;};}function patchUpdates(_0x271884){return function(_0x13bf4f){try{jsonpatch[_0x78ef('0x22')](_0x13bf4f,_0x271884,!![]);}catch(_0x17bb8a){return BPromise[_0x78ef('0x23')](_0x17bb8a);}return _0x13bf4f['save']();};}function saveUpdates(_0x4ff6fb,_0x15bda8){return function(_0x14a2e2){if(_0x14a2e2){return _0x14a2e2['update'](_0x4ff6fb)[_0x78ef('0x24')](function(_0x54b222){return _0x54b222;});}return null;};}function removeEntity(_0x1f5486,_0x37a566){return function(_0x23e585){if(_0x23e585){return _0x23e585[_0x78ef('0x25')]()[_0x78ef('0x24')](function(){_0x1f5486['status'](0xcc)[_0x78ef('0x1a')]();});}};}function handleEntityNotFound(_0x2ab232,_0x235e4e){return function(_0x1995e3){if(!_0x1995e3){_0x2ab232['sendStatus'](0x194);}return _0x1995e3;};}function handleError(_0x47e550,_0x154798){_0x154798=_0x154798||0x1f4;return function(_0x223996){logger[_0x78ef('0x26')](_0x223996[_0x78ef('0x27')]);if(_0x223996['name']){delete _0x223996['name'];}_0x47e550[_0x78ef('0x19')](_0x154798)[_0x78ef('0x28')](_0x223996);};}exports['index']=function(_0x2fc3e1,_0x5262bd){var _0x5a6271={},_0x25c340={},_0x26ba78={'count':0x0,'rows':[]};var _0x458741=_[_0x78ef('0x29')](db[_0x78ef('0x2a')]['rawAttributes'],function(_0x4f0b5a){return{'name':_0x4f0b5a['fieldName'],'type':_0x4f0b5a['type']['key']};});_0x25c340[_0x78ef('0x2b')]=_['map'](_0x458741,'name');_0x25c340[_0x78ef('0x2c')]=_[_0x78ef('0x2d')](_0x2fc3e1[_0x78ef('0x2c')]);_0x25c340['filters']=_[_0x78ef('0x2e')](_0x25c340[_0x78ef('0x2b')],_0x25c340[_0x78ef('0x2c')]);_0x5a6271[_0x78ef('0x2f')]=_['intersection'](_0x25c340[_0x78ef('0x2b')],qs[_0x78ef('0x30')](_0x2fc3e1[_0x78ef('0x2c')][_0x78ef('0x30')]));_0x5a6271[_0x78ef('0x2f')]=_0x5a6271['attributes'][_0x78ef('0x31')]?_0x5a6271[_0x78ef('0x2f')]:_0x25c340[_0x78ef('0x2b')];if(!_0x2fc3e1[_0x78ef('0x2c')][_0x78ef('0x32')](_0x78ef('0x33'))){_0x5a6271[_0x78ef('0x1d')]=qs[_0x78ef('0x1d')](_0x2fc3e1[_0x78ef('0x2c')][_0x78ef('0x1d')]);_0x5a6271[_0x78ef('0x1b')]=qs[_0x78ef('0x1b')](_0x2fc3e1['query'][_0x78ef('0x1b')]);}_0x5a6271['order']=qs[_0x78ef('0x34')](_0x2fc3e1[_0x78ef('0x2c')]['sort']);_0x5a6271[_0x78ef('0x35')]=qs[_0x78ef('0x36')](_['pick'](_0x2fc3e1[_0x78ef('0x2c')],_0x25c340['filters']),_0x458741);if(_0x2fc3e1[_0x78ef('0x2c')][_0x78ef('0x37')]){_0x5a6271[_0x78ef('0x35')]=_[_0x78ef('0x38')](_0x5a6271[_0x78ef('0x35')],{'$or':_[_0x78ef('0x29')](_0x458741,function(_0x4fa37d){if(_0x4fa37d['type']!==_0x78ef('0x39')){var _0x4ccd4d={};_0x4ccd4d[_0x4fa37d['name']]={'$like':'%'+_0x2fc3e1[_0x78ef('0x2c')][_0x78ef('0x37')]+'%'};return _0x4ccd4d;}})});}_0x5a6271=_['merge']({},_0x5a6271,_0x2fc3e1[_0x78ef('0x3a')]);var _0x399f34={'where':_0x5a6271[_0x78ef('0x35')]};return db[_0x78ef('0x2a')][_0x78ef('0x1e')](_0x399f34)[_0x78ef('0x24')](function(_0x1f5027){_0x26ba78[_0x78ef('0x1e')]=_0x1f5027;if(_0x2fc3e1[_0x78ef('0x2c')][_0x78ef('0x3b')]){_0x5a6271[_0x78ef('0x3c')]=[{'all':!![]}];}return db[_0x78ef('0x2a')][_0x78ef('0x3d')](_0x5a6271);})[_0x78ef('0x24')](function(_0x457db3){_0x26ba78[_0x78ef('0x3e')]=_0x457db3;return _0x26ba78;})[_0x78ef('0x24')](respondWithFilteredResult(_0x5262bd,_0x5a6271))[_0x78ef('0x3f')](handleError(_0x5262bd,null));};exports[_0x78ef('0x40')]=function(_0x64e8f2,_0x2bdafa){var _0x4017c8={'raw':!![],'where':{'id':_0x64e8f2[_0x78ef('0x41')]['id']}},_0x3b43b3={};_0x3b43b3[_0x78ef('0x2b')]=_[_0x78ef('0x2d')](db[_0x78ef('0x2a')][_0x78ef('0x42')]);_0x3b43b3[_0x78ef('0x2c')]=_[_0x78ef('0x2d')](_0x64e8f2[_0x78ef('0x2c')]);_0x3b43b3[_0x78ef('0x36')]=_['intersection'](_0x3b43b3[_0x78ef('0x2b')],_0x3b43b3[_0x78ef('0x2c')]);_0x4017c8[_0x78ef('0x2f')]=_[_0x78ef('0x2e')](_0x3b43b3[_0x78ef('0x2b')],qs[_0x78ef('0x30')](_0x64e8f2[_0x78ef('0x2c')][_0x78ef('0x30')]));_0x4017c8[_0x78ef('0x2f')]=_0x4017c8['attributes'][_0x78ef('0x31')]?_0x4017c8[_0x78ef('0x2f')]:_0x3b43b3[_0x78ef('0x2b')];if(_0x64e8f2[_0x78ef('0x2c')][_0x78ef('0x3b')]){_0x4017c8[_0x78ef('0x3c')]=[{'all':!![]}];}_0x4017c8=_[_0x78ef('0x38')]({},_0x4017c8,_0x64e8f2[_0x78ef('0x3a')]);return db[_0x78ef('0x2a')]['find'](_0x4017c8)[_0x78ef('0x24')](handleEntityNotFound(_0x2bdafa,null))['then'](respondWithResult(_0x2bdafa,null))[_0x78ef('0x3f')](handleError(_0x2bdafa,null));};exports['create']=function(_0x33ad33,_0x5bdd3d){return db[_0x78ef('0x2a')][_0x78ef('0x43')](_0x33ad33[_0x78ef('0x44')],{})[_0x78ef('0x24')](respondWithResult(_0x5bdd3d,0xc9))['catch'](handleError(_0x5bdd3d,null));};exports['update']=function(_0x5d0020,_0x3abbdd){if(_0x5d0020[_0x78ef('0x44')]['id']){delete _0x5d0020['body']['id'];}return db[_0x78ef('0x2a')][_0x78ef('0x45')]({'where':{'id':_0x5d0020[_0x78ef('0x41')]['id']}})[_0x78ef('0x24')](handleEntityNotFound(_0x3abbdd,null))['then'](saveUpdates(_0x5d0020[_0x78ef('0x44')],null))[_0x78ef('0x24')](respondWithResult(_0x3abbdd,null))[_0x78ef('0x3f')](handleError(_0x3abbdd,null));};exports[_0x78ef('0x25')]=function(_0x4a6c06,_0x3c9b7a){return db[_0x78ef('0x2a')]['find']({'where':{'id':_0x4a6c06[_0x78ef('0x41')]['id']}})[_0x78ef('0x24')](handleEntityNotFound(_0x3c9b7a,null))[_0x78ef('0x24')](removeEntity(_0x3c9b7a,null))[_0x78ef('0x3f')](handleError(_0x3c9b7a,null));};exports[_0x78ef('0x46')]=function(_0x451217,_0x3d765d){return db[_0x78ef('0x2a')][_0x78ef('0x46')]()[_0x78ef('0x24')](respondWithResult(_0x3d765d,null))[_0x78ef('0x3f')](handleError(_0x3d765d,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 0c4109e..ac0d75a 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 _0xe8d7=['../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','moment','bluebird','rimraf'];(function(_0x257cb1,_0x9c0aa1){var _0x1b0f4d=function(_0x3f8007){while(--_0x3f8007){_0x257cb1['push'](_0x257cb1['shift']());}};_0x1b0f4d(++_0x9c0aa1);}(_0xe8d7,0xa3));var _0x7e8d=function(_0x343849,_0x10dbd3){_0x343849=_0x343849-0x0;var _0x2e7cbf=_0xe8d7[_0x343849];return _0x2e7cbf;};'use strict';var _=require(_0x7e8d('0x0'));var util=require(_0x7e8d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7e8d('0x2'));var BPromise=require(_0x7e8d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e8d('0x4'));var config=require(_0x7e8d('0x5'));var attributes=require(_0x7e8d('0x6'));module[_0x7e8d('0x7')]=function(_0x599b34,_0x3c8a5e){return _0x599b34[_0x7e8d('0x8')](_0x7e8d('0x9'),attributes,{'tableName':_0x7e8d('0xa'),'paranoid':![],'indexes':[{'name':_0x7e8d('0xb'),'fields':[_0x7e8d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf396=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','OpenchannelTransferReport','uniqueid'];(function(_0x6dc241,_0x3d6db7){var _0xac50e7=function(_0x42c8a1){while(--_0x42c8a1){_0x6dc241['push'](_0x6dc241['shift']());}};_0xac50e7(++_0x3d6db7);}(_0xf396,0xcc));var _0x6f39=function(_0x522104,_0x260bde){_0x522104=_0x522104-0x0;var _0x552027=_0xf396[_0x522104];return _0x552027;};'use strict';var _=require(_0x6f39('0x0'));var util=require(_0x6f39('0x1'));var logger=require(_0x6f39('0x2'))(_0x6f39('0x3'));var moment=require(_0x6f39('0x4'));var BPromise=require(_0x6f39('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f39('0x6'));var rimraf=require(_0x6f39('0x7'));var config=require(_0x6f39('0x8'));var attributes=require('./openchannelTransferReport.attributes');module[_0x6f39('0x9')]=function(_0x319a82,_0x4a9bc1){return _0x319a82['define'](_0x6f39('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x6f39('0xb'),'fields':[_0x6f39('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index ff1f4a0..b976631 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 _0xce50=['randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird'];(function(_0x492ff8,_0x24aeee){var _0x5330e5=function(_0x5366bd){while(--_0x5366bd){_0x492ff8['push'](_0x492ff8['shift']());}};_0x5330e5(++_0x24aeee);}(_0xce50,0x1d8));var _0x0ce5=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xce50[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var util=require(_0x0ce5('0x0'));var moment=require(_0x0ce5('0x1'));var BPromise=require(_0x0ce5('0x2'));var rs=require(_0x0ce5('0x3'));var fs=require('fs');var Redis=require(_0x0ce5('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0ce5('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0ce5('0x6'));var client=jayson[_0x0ce5('0x7')][_0x0ce5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3eb5b2,_0x4b2c43,_0x32610d){return new BPromise(function(_0x8d611f,_0x4d9a49){return client[_0x0ce5('0x9')](_0x3eb5b2,_0x32610d)['then'](function(_0x4475c9){logger[_0x0ce5('0xa')](_0x0ce5('0xb'),_0x4b2c43,_0x0ce5('0xc'));logger['debug'](_0x0ce5('0xd'),_0x4b2c43,_0x0ce5('0xc'),JSON[_0x0ce5('0xe')](_0x4475c9));if(_0x4475c9[_0x0ce5('0xf')]){if(_0x4475c9[_0x0ce5('0xf')]['code']===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x4b2c43,_0x4475c9[_0x0ce5('0xf')][_0x0ce5('0x10')]);return _0x4d9a49(_0x4475c9[_0x0ce5('0xf')][_0x0ce5('0x10')]);}logger['error'](_0x0ce5('0xb'),_0x4b2c43,_0x4475c9[_0x0ce5('0xf')]['message']);return _0x8d611f(_0x4475c9[_0x0ce5('0xf')]['message']);}else{logger[_0x0ce5('0xa')](_0x0ce5('0xb'),_0x4b2c43,_0x0ce5('0xc'));_0x8d611f(_0x4475c9[_0x0ce5('0x11')][_0x0ce5('0x10')]);}})[_0x0ce5('0x12')](function(_0x13486a){logger[_0x0ce5('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4b2c43,_0x13486a);_0x4d9a49(_0x13486a);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5bea4a,_0x3d0c1f){_0x5bea4a=_0x5bea4a-0x0;var _0xf74e16=_0x1cb9[_0x5bea4a];return _0xf74e16;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1a60f7f..36ced30 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 _0x608a=['path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./pause.controller','index','/:id','isAuthenticated','show','put','update','delete','exports','util'];(function(_0x33651a,_0x5a8243){var _0x4274e2=function(_0x168c73){while(--_0x168c73){_0x33651a['push'](_0x33651a['shift']());}};_0x4274e2(++_0x5a8243);}(_0x608a,0xff));var _0xa608=function(_0x4ad669,_0x4915e0){_0x4ad669=_0x4ad669-0x0;var _0x2c433b=_0x608a[_0x4ad669];return _0x2c433b;};'use strict';var multer=require('multer');var util=require(_0xa608('0x0'));var path=require(_0xa608('0x1'));var timeout=require('connect-timeout');var express=require(_0xa608('0x2'));var router=express[_0xa608('0x3')]();var fs_extra=require(_0xa608('0x4'));var auth=require(_0xa608('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa608('0x6'));var controller=require(_0xa608('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa608('0x8')]);router['get'](_0xa608('0x9'),auth[_0xa608('0xa')](),controller[_0xa608('0xb')]);router['post']('/',auth[_0xa608('0xa')](),controller['create']);router[_0xa608('0xc')](_0xa608('0x9'),auth['isAuthenticated'](),controller[_0xa608('0xd')]);router[_0xa608('0xe')](_0xa608('0x9'),auth[_0xa608('0xa')](),controller['destroy']);module[_0xa608('0xf')]=router; \ No newline at end of file +var _0xd6ef=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','multer'];(function(_0x139018,_0x1e1dbb){var _0x2ada99=function(_0x19c0ca){while(--_0x19c0ca){_0x139018['push'](_0x139018['shift']());}};_0x2ada99(++_0x1e1dbb);}(_0xd6ef,0xfb));var _0xfd6e=function(_0x3005a9,_0x388fb4){_0x3005a9=_0x3005a9-0x0;var _0xcbd5c8=_0xd6ef[_0x3005a9];return _0xcbd5c8;};'use strict';var multer=require(_0xfd6e('0x0'));var util=require(_0xfd6e('0x1'));var path=require('path');var timeout=require(_0xfd6e('0x2'));var express=require(_0xfd6e('0x3'));var router=express[_0xfd6e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfd6e('0x5'));var interaction=require(_0xfd6e('0x6'));var config=require(_0xfd6e('0x7'));var controller=require(_0xfd6e('0x8'));router[_0xfd6e('0x9')]('/',auth[_0xfd6e('0xa')](),controller[_0xfd6e('0xb')]);router[_0xfd6e('0x9')](_0xfd6e('0xc'),auth[_0xfd6e('0xa')](),controller[_0xfd6e('0xd')]);router[_0xfd6e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfd6e('0xc'),auth[_0xfd6e('0xa')](),controller[_0xfd6e('0xf')]);router[_0xfd6e('0x10')](_0xfd6e('0xc'),auth[_0xfd6e('0xa')](),controller[_0xfd6e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index dc6caa8..89da8bd 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 _0xd043=['name','sequelize','exports','STRING'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xd043,0x111));var _0x3d04=function(_0x28f0f7,_0x5e43cb){_0x28f0f7=_0x28f0f7-0x0;var _0x14eabb=_0xd043[_0x28f0f7];return _0x14eabb;};'use strict';var Sequelize=require(_0x3d04('0x0'));module[_0x3d04('0x1')]={'name':{'type':Sequelize[_0x3d04('0x2')],'unique':_0x3d04('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x54a9=['STRING','name','exports'];(function(_0xfd5f37,_0x24a79c){var _0x11bd01=function(_0x4ae9bd){while(--_0x4ae9bd){_0xfd5f37['push'](_0xfd5f37['shift']());}};_0x11bd01(++_0x24a79c);}(_0x54a9,0x11f));var _0x954a=function(_0x4f88a8,_0x3ede80){_0x4f88a8=_0x4f88a8-0x0;var _0x4b6a82=_0x54a9[_0x4f88a8];return _0x4b6a82;};'use strict';var Sequelize=require('sequelize');module[_0x954a('0x0')]={'name':{'type':Sequelize[_0x954a('0x1')],'unique':_0x954a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x954a('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 449683f..3f20b68 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 _0x6e25=['show','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','Pauses','UserProfileResource','destroy','error','name','send','index','Pause','rawAttributes','fieldName','type','key','map','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','filter','options','includeAll','findAll','rows','catch'];(function(_0x25243d,_0x450921){var _0x19e095=function(_0x1464c4){while(--_0x1464c4){_0x25243d['push'](_0x25243d['shift']());}};_0x19e095(++_0x450921);}(_0x6e25,0x19b));var _0x56e2=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0x6e25[_0x33fcbb];return _0x2efe40;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56e2('0x0'));var zipdir=require(_0x56e2('0x1'));var jsonpatch=require(_0x56e2('0x2'));var rp=require(_0x56e2('0x3'));var moment=require(_0x56e2('0x4'));var BPromise=require(_0x56e2('0x5'));var Mustache=require('mustache');var util=require(_0x56e2('0x6'));var path=require(_0x56e2('0x7'));var sox=require(_0x56e2('0x8'));var csv=require('to-csv');var ejs=require(_0x56e2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x56e2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x56e2('0xb'));var querystring=require(_0x56e2('0xc'));var Papa=require(_0x56e2('0xd'));var Redis=require(_0x56e2('0xe'));var authService=require(_0x56e2('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x56e2('0x10'));var logger=require(_0x56e2('0x11'))('api');var utils=require(_0x56e2('0x12'));var config=require(_0x56e2('0x13'));var licenseUtil=require(_0x56e2('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c487c,_0x508340){_0x508340=_0x508340||0xcc;return function(_0x3d72c3){if(_0x3d72c3){return _0x3c487c[_0x56e2('0x15')](_0x508340);}return _0x3c487c[_0x56e2('0x16')](_0x508340)[_0x56e2('0x17')]();};}function respondWithResult(_0x14aee8,_0x11d83b){_0x11d83b=_0x11d83b||0xc8;return function(_0x31a527){if(_0x31a527){return _0x14aee8[_0x56e2('0x16')](_0x11d83b)[_0x56e2('0x18')](_0x31a527);}};}function respondWithFilteredResult(_0x2dd8c4,_0x58c999){return function(_0x576460){if(_0x576460){var _0x595e7c=typeof _0x58c999[_0x56e2('0x19')]==='undefined'&&typeof _0x58c999['limit']===_0x56e2('0x1a');var _0x1a23c6=_0x576460['count'];var _0x43f23a=_0x595e7c?0x0:_0x58c999[_0x56e2('0x19')];var _0x539ee3=_0x595e7c?_0x576460[_0x56e2('0x1b')]:_0x58c999[_0x56e2('0x19')]+_0x58c999[_0x56e2('0x1c')];var _0x12c997;if(_0x539ee3>=_0x1a23c6){_0x539ee3=_0x1a23c6;_0x12c997=0xc8;}else{_0x12c997=0xce;}_0x2dd8c4[_0x56e2('0x16')](_0x12c997);return _0x2dd8c4[_0x56e2('0x1d')](_0x56e2('0x1e'),_0x43f23a+'-'+_0x539ee3+'/'+_0x1a23c6)['json'](_0x576460);}return null;};}function patchUpdates(_0x22c0e8){return function(_0x3076d5){try{jsonpatch[_0x56e2('0x1f')](_0x3076d5,_0x22c0e8,!![]);}catch(_0x15e146){return BPromise[_0x56e2('0x20')](_0x15e146);}return _0x3076d5[_0x56e2('0x21')]();};}function saveUpdates(_0x5bca11,_0x38f32d){return function(_0xf8c09){if(_0xf8c09){return _0xf8c09[_0x56e2('0x22')](_0x5bca11)[_0x56e2('0x23')](function(_0x405d03){return _0x405d03;});}return null;};}function removeEntity(_0x1272db,_0x590592){return function(_0x5e9364){if(_0x5e9364){return _0x5e9364['destroy']()[_0x56e2('0x23')](function(){var _0x4eb8e2=_0x5e9364['get']({'plain':!![]});var _0x5b6410=_0x56e2('0x24');return db[_0x56e2('0x25')][_0x56e2('0x26')]({'where':{'type':_0x5b6410,'resourceId':_0x4eb8e2['id']}})[_0x56e2('0x23')](function(){return _0x5e9364;});})['then'](function(){_0x1272db[_0x56e2('0x16')](0xcc)[_0x56e2('0x17')]();});}};}function handleEntityNotFound(_0x439ba5,_0x48689b){return function(_0x43afce){if(!_0x43afce){_0x439ba5[_0x56e2('0x15')](0x194);}return _0x43afce;};}function handleError(_0x292274,_0x2fd6e6){_0x2fd6e6=_0x2fd6e6||0x1f4;return function(_0x568f8e){logger[_0x56e2('0x27')](_0x568f8e['stack']);if(_0x568f8e[_0x56e2('0x28')]){delete _0x568f8e['name'];}_0x292274['status'](_0x2fd6e6)[_0x56e2('0x29')](_0x568f8e);};}exports[_0x56e2('0x2a')]=function(_0x2e640b,_0x29a46e){var _0xace1e5={},_0x48e74e={},_0x40ad53={'count':0x0,'rows':[]};var _0x5ed38f=_['map'](db[_0x56e2('0x2b')][_0x56e2('0x2c')],function(_0x13f35f){return{'name':_0x13f35f[_0x56e2('0x2d')],'type':_0x13f35f[_0x56e2('0x2e')][_0x56e2('0x2f')]};});_0x48e74e['model']=_[_0x56e2('0x30')](_0x5ed38f,'name');_0x48e74e['query']=_[_0x56e2('0x31')](_0x2e640b[_0x56e2('0x32')]);_0x48e74e[_0x56e2('0x33')]=_['intersection'](_0x48e74e[_0x56e2('0x34')],_0x48e74e[_0x56e2('0x32')]);_0xace1e5[_0x56e2('0x35')]=_[_0x56e2('0x36')](_0x48e74e[_0x56e2('0x34')],qs[_0x56e2('0x37')](_0x2e640b[_0x56e2('0x32')]['fields']));_0xace1e5[_0x56e2('0x35')]=_0xace1e5[_0x56e2('0x35')][_0x56e2('0x38')]?_0xace1e5['attributes']:_0x48e74e[_0x56e2('0x34')];if(!_0x2e640b['query'][_0x56e2('0x39')](_0x56e2('0x3a'))){_0xace1e5[_0x56e2('0x1c')]=qs[_0x56e2('0x1c')](_0x2e640b['query']['limit']);_0xace1e5['offset']=qs['offset'](_0x2e640b[_0x56e2('0x32')][_0x56e2('0x19')]);}_0xace1e5[_0x56e2('0x3b')]=qs['sort'](_0x2e640b[_0x56e2('0x32')]['sort']);_0xace1e5[_0x56e2('0x3c')]=qs[_0x56e2('0x33')](_[_0x56e2('0x3d')](_0x2e640b['query'],_0x48e74e[_0x56e2('0x33')]),_0x5ed38f);if(_0x2e640b[_0x56e2('0x32')]['filter']){_0xace1e5[_0x56e2('0x3c')]=_[_0x56e2('0x3e')](_0xace1e5[_0x56e2('0x3c')],{'$or':_[_0x56e2('0x30')](_0x5ed38f,function(_0x27bdaa){if(_0x27bdaa[_0x56e2('0x2e')]!=='VIRTUAL'){var _0x2c09e3={};_0x2c09e3[_0x27bdaa['name']]={'$like':'%'+_0x2e640b[_0x56e2('0x32')][_0x56e2('0x3f')]+'%'};return _0x2c09e3;}})});}_0xace1e5=_['merge']({},_0xace1e5,_0x2e640b[_0x56e2('0x40')]);var _0x99f342={'where':_0xace1e5[_0x56e2('0x3c')]};return db['Pause']['count'](_0x99f342)['then'](function(_0x1dda2d){_0x40ad53[_0x56e2('0x1b')]=_0x1dda2d;if(_0x2e640b['query'][_0x56e2('0x41')]){_0xace1e5['include']=[{'all':!![]}];}return db[_0x56e2('0x2b')][_0x56e2('0x42')](_0xace1e5);})[_0x56e2('0x23')](function(_0x46b5fe){_0x40ad53[_0x56e2('0x43')]=_0x46b5fe;return _0x40ad53;})[_0x56e2('0x23')](respondWithFilteredResult(_0x29a46e,_0xace1e5))[_0x56e2('0x44')](handleError(_0x29a46e,null));};exports[_0x56e2('0x45')]=function(_0x138863,_0x30e6ed){var _0x2de143={'raw':!![],'where':{'id':_0x138863['params']['id']}},_0x15310a={};_0x15310a[_0x56e2('0x34')]=_[_0x56e2('0x31')](db[_0x56e2('0x2b')][_0x56e2('0x2c')]);_0x15310a['query']=_[_0x56e2('0x31')](_0x138863[_0x56e2('0x32')]);_0x15310a[_0x56e2('0x33')]=_[_0x56e2('0x36')](_0x15310a['model'],_0x15310a[_0x56e2('0x32')]);_0x2de143['attributes']=_[_0x56e2('0x36')](_0x15310a[_0x56e2('0x34')],qs['fields'](_0x138863[_0x56e2('0x32')][_0x56e2('0x37')]));_0x2de143['attributes']=_0x2de143[_0x56e2('0x35')][_0x56e2('0x38')]?_0x2de143['attributes']:_0x15310a[_0x56e2('0x34')];if(_0x138863[_0x56e2('0x32')][_0x56e2('0x41')]){_0x2de143[_0x56e2('0x46')]=[{'all':!![]}];}_0x2de143=_['merge']({},_0x2de143,_0x138863['options']);return db[_0x56e2('0x2b')][_0x56e2('0x47')](_0x2de143)['then'](handleEntityNotFound(_0x30e6ed,null))[_0x56e2('0x23')](respondWithResult(_0x30e6ed,null))['catch'](handleError(_0x30e6ed,null));};exports[_0x56e2('0x48')]=function(_0x516ae8,_0x3a9e9d){return db[_0x56e2('0x2b')][_0x56e2('0x48')](_0x516ae8[_0x56e2('0x49')],{})[_0x56e2('0x23')](function(_0x1e0eeb){var _0xf133f5=_0x516ae8[_0x56e2('0x4a')][_0x56e2('0x4b')]({'plain':!![]});if(!_0xf133f5)throw new Error(_0x56e2('0x4c'));if(_0xf133f5['role']==='user'){var _0x1297a3=_0x1e0eeb[_0x56e2('0x4b')]({'plain':!![]});var _0x16e8f8='Pauses';return db[_0x56e2('0x4d')][_0x56e2('0x47')]({'where':{'name':_0x16e8f8,'userProfileId':_0xf133f5['userProfileId']},'raw':!![]})['then'](function(_0x42892d){if(_0x42892d&&_0x42892d['autoAssociation']===0x0){return db[_0x56e2('0x25')][_0x56e2('0x48')]({'name':_0x1297a3[_0x56e2('0x28')],'resourceId':_0x1297a3['id'],'type':_0x42892d[_0x56e2('0x28')],'sectionId':_0x42892d['id']},{})[_0x56e2('0x23')](function(){return _0x1e0eeb;});}else{return _0x1e0eeb;}})[_0x56e2('0x44')](function(_0x287988){logger['error'](_0x56e2('0x4e'),_0x287988);throw _0x287988;});}return _0x1e0eeb;})['then'](respondWithResult(_0x3a9e9d,0xc9))[_0x56e2('0x44')](handleError(_0x3a9e9d,null));};exports[_0x56e2('0x22')]=function(_0x1fea99,_0x1d2474){if(_0x1fea99[_0x56e2('0x49')]['id']){delete _0x1fea99['body']['id'];}return db[_0x56e2('0x2b')]['find']({'where':{'id':_0x1fea99['params']['id']}})[_0x56e2('0x23')](handleEntityNotFound(_0x1d2474,null))[_0x56e2('0x23')](saveUpdates(_0x1fea99[_0x56e2('0x49')],null))[_0x56e2('0x23')](respondWithResult(_0x1d2474,null))[_0x56e2('0x44')](handleError(_0x1d2474,null));};exports[_0x56e2('0x26')]=function(_0x15e922,_0x49d186){return db['Pause'][_0x56e2('0x47')]({'where':{'id':_0x15e922[_0x56e2('0x4f')]['id']}})[_0x56e2('0x23')](handleEntityNotFound(_0x49d186,null))[_0x56e2('0x23')](removeEntity(_0x49d186,null))[_0x56e2('0x44')](handleError(_0x49d186,null));}; \ No newline at end of file +var _0x4370=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','offset','count','set','Content-Range','save','update','then','destroy','get','Pauses','UserProfileResource','end','error','stack','name','send','map','Pause','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x4c2c23,_0x3d8d28){var _0x5c992e=function(_0x5cfed7){while(--_0x5cfed7){_0x4c2c23['push'](_0x4c2c23['shift']());}};_0x5c992e(++_0x3d8d28);}(_0x4370,0x1c3));var _0x0437=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x4370[_0xbb091];return _0x467a04;};'use strict';var emlformat=require(_0x0437('0x0'));var rimraf=require(_0x0437('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0437('0x2'));var rp=require(_0x0437('0x3'));var moment=require(_0x0437('0x4'));var BPromise=require(_0x0437('0x5'));var Mustache=require('mustache');var util=require(_0x0437('0x6'));var path=require('path');var sox=require(_0x0437('0x7'));var csv=require('to-csv');var ejs=require(_0x0437('0x8'));var fs=require('fs');var fs_extra=require(_0x0437('0x9'));var _=require(_0x0437('0xa'));var squel=require(_0x0437('0xb'));var crypto=require(_0x0437('0xc'));var jsforce=require(_0x0437('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0437('0xe'));var querystring=require(_0x0437('0xf'));var Papa=require('papaparse');var Redis=require(_0x0437('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0437('0x11'));var as=require(_0x0437('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0437('0x13'))(_0x0437('0x14'));var utils=require('../../config/utils');var config=require(_0x0437('0x15'));var licenseUtil=require(_0x0437('0x16'));var db=require(_0x0437('0x17'))['db'];function respondWithStatusCode(_0x18657e,_0x33055c){_0x33055c=_0x33055c||0xcc;return function(_0x45a4e5){if(_0x45a4e5){return _0x18657e[_0x0437('0x18')](_0x33055c);}return _0x18657e[_0x0437('0x19')](_0x33055c)['end']();};}function respondWithResult(_0x4f829e,_0xe7b8e3){_0xe7b8e3=_0xe7b8e3||0xc8;return function(_0x49cc87){if(_0x49cc87){return _0x4f829e[_0x0437('0x19')](_0xe7b8e3)[_0x0437('0x1a')](_0x49cc87);}};}function respondWithFilteredResult(_0x19cf10,_0x4d1dfa){return function(_0x2c2cce){if(_0x2c2cce){var _0x3fd864=typeof _0x4d1dfa['offset']==='undefined'&&typeof _0x4d1dfa[_0x0437('0x1b')]==='undefined';var _0x545ab9=_0x2c2cce['count'];var _0x18f963=_0x3fd864?0x0:_0x4d1dfa[_0x0437('0x1c')];var _0x5d7c68=_0x3fd864?_0x2c2cce[_0x0437('0x1d')]:_0x4d1dfa[_0x0437('0x1c')]+_0x4d1dfa[_0x0437('0x1b')];var _0x26f567;if(_0x5d7c68>=_0x545ab9){_0x5d7c68=_0x545ab9;_0x26f567=0xc8;}else{_0x26f567=0xce;}_0x19cf10[_0x0437('0x19')](_0x26f567);return _0x19cf10[_0x0437('0x1e')](_0x0437('0x1f'),_0x18f963+'-'+_0x5d7c68+'/'+_0x545ab9)[_0x0437('0x1a')](_0x2c2cce);}return null;};}function patchUpdates(_0x596287){return function(_0x1ce2cb){try{jsonpatch['apply'](_0x1ce2cb,_0x596287,!![]);}catch(_0x280dd6){return BPromise['reject'](_0x280dd6);}return _0x1ce2cb[_0x0437('0x20')]();};}function saveUpdates(_0x2c1e8a,_0x34a0a7){return function(_0x31a233){if(_0x31a233){return _0x31a233[_0x0437('0x21')](_0x2c1e8a)[_0x0437('0x22')](function(_0x3875e4){return _0x3875e4;});}return null;};}function removeEntity(_0x34d6e3,_0x4fcd05){return function(_0x1ca2d7){if(_0x1ca2d7){return _0x1ca2d7[_0x0437('0x23')]()[_0x0437('0x22')](function(){var _0x354684=_0x1ca2d7[_0x0437('0x24')]({'plain':!![]});var _0x5299c0=_0x0437('0x25');return db[_0x0437('0x26')][_0x0437('0x23')]({'where':{'type':_0x5299c0,'resourceId':_0x354684['id']}})[_0x0437('0x22')](function(){return _0x1ca2d7;});})['then'](function(){_0x34d6e3[_0x0437('0x19')](0xcc)[_0x0437('0x27')]();});}};}function handleEntityNotFound(_0x1a9420,_0x32590c){return function(_0x44b200){if(!_0x44b200){_0x1a9420[_0x0437('0x18')](0x194);}return _0x44b200;};}function handleError(_0xc91c4b,_0x4c686a){_0x4c686a=_0x4c686a||0x1f4;return function(_0x2086ce){logger[_0x0437('0x28')](_0x2086ce[_0x0437('0x29')]);if(_0x2086ce[_0x0437('0x2a')]){delete _0x2086ce['name'];}_0xc91c4b[_0x0437('0x19')](_0x4c686a)[_0x0437('0x2b')](_0x2086ce);};}exports['index']=function(_0x2d54cc,_0x2a4708){var _0x32280a={},_0x32e07f={},_0x5f5821={'count':0x0,'rows':[]};var _0x1a6bbc=_[_0x0437('0x2c')](db[_0x0437('0x2d')][_0x0437('0x2e')],function(_0x3b1992){return{'name':_0x3b1992[_0x0437('0x2f')],'type':_0x3b1992[_0x0437('0x30')][_0x0437('0x31')]};});_0x32e07f[_0x0437('0x32')]=_[_0x0437('0x2c')](_0x1a6bbc,'name');_0x32e07f[_0x0437('0x33')]=_['keys'](_0x2d54cc[_0x0437('0x33')]);_0x32e07f[_0x0437('0x34')]=_[_0x0437('0x35')](_0x32e07f[_0x0437('0x32')],_0x32e07f[_0x0437('0x33')]);_0x32280a['attributes']=_[_0x0437('0x35')](_0x32e07f[_0x0437('0x32')],qs['fields'](_0x2d54cc[_0x0437('0x33')][_0x0437('0x36')]));_0x32280a['attributes']=_0x32280a[_0x0437('0x37')][_0x0437('0x38')]?_0x32280a[_0x0437('0x37')]:_0x32e07f['model'];if(!_0x2d54cc[_0x0437('0x33')][_0x0437('0x39')](_0x0437('0x3a'))){_0x32280a[_0x0437('0x1b')]=qs[_0x0437('0x1b')](_0x2d54cc[_0x0437('0x33')][_0x0437('0x1b')]);_0x32280a[_0x0437('0x1c')]=qs[_0x0437('0x1c')](_0x2d54cc['query'][_0x0437('0x1c')]);}_0x32280a[_0x0437('0x3b')]=qs[_0x0437('0x3c')](_0x2d54cc[_0x0437('0x33')][_0x0437('0x3c')]);_0x32280a[_0x0437('0x3d')]=qs[_0x0437('0x34')](_[_0x0437('0x3e')](_0x2d54cc[_0x0437('0x33')],_0x32e07f['filters']),_0x1a6bbc);if(_0x2d54cc[_0x0437('0x33')]['filter']){_0x32280a['where']=_['merge'](_0x32280a[_0x0437('0x3d')],{'$or':_[_0x0437('0x2c')](_0x1a6bbc,function(_0x217d94){if(_0x217d94[_0x0437('0x30')]!==_0x0437('0x3f')){var _0x54dde7={};_0x54dde7[_0x217d94[_0x0437('0x2a')]]={'$like':'%'+_0x2d54cc[_0x0437('0x33')][_0x0437('0x40')]+'%'};return _0x54dde7;}})});}_0x32280a=_[_0x0437('0x41')]({},_0x32280a,_0x2d54cc[_0x0437('0x42')]);var _0x245e4c={'where':_0x32280a[_0x0437('0x3d')]};return db[_0x0437('0x2d')][_0x0437('0x1d')](_0x245e4c)[_0x0437('0x22')](function(_0x290aa2){_0x5f5821['count']=_0x290aa2;if(_0x2d54cc[_0x0437('0x33')][_0x0437('0x43')]){_0x32280a[_0x0437('0x44')]=[{'all':!![]}];}return db[_0x0437('0x2d')][_0x0437('0x45')](_0x32280a);})[_0x0437('0x22')](function(_0x27b6af){_0x5f5821[_0x0437('0x46')]=_0x27b6af;return _0x5f5821;})[_0x0437('0x22')](respondWithFilteredResult(_0x2a4708,_0x32280a))[_0x0437('0x47')](handleError(_0x2a4708,null));};exports[_0x0437('0x48')]=function(_0x1a713c,_0x210d28){var _0x25808f={'raw':!![],'where':{'id':_0x1a713c[_0x0437('0x49')]['id']}},_0x1a67c2={};_0x1a67c2['model']=_['keys'](db[_0x0437('0x2d')][_0x0437('0x2e')]);_0x1a67c2[_0x0437('0x33')]=_[_0x0437('0x4a')](_0x1a713c[_0x0437('0x33')]);_0x1a67c2[_0x0437('0x34')]=_[_0x0437('0x35')](_0x1a67c2[_0x0437('0x32')],_0x1a67c2[_0x0437('0x33')]);_0x25808f[_0x0437('0x37')]=_[_0x0437('0x35')](_0x1a67c2[_0x0437('0x32')],qs['fields'](_0x1a713c[_0x0437('0x33')][_0x0437('0x36')]));_0x25808f[_0x0437('0x37')]=_0x25808f[_0x0437('0x37')]['length']?_0x25808f[_0x0437('0x37')]:_0x1a67c2['model'];if(_0x1a713c[_0x0437('0x33')]['includeAll']){_0x25808f[_0x0437('0x44')]=[{'all':!![]}];}_0x25808f=_['merge']({},_0x25808f,_0x1a713c[_0x0437('0x42')]);return db[_0x0437('0x2d')]['find'](_0x25808f)['then'](handleEntityNotFound(_0x210d28,null))[_0x0437('0x22')](respondWithResult(_0x210d28,null))[_0x0437('0x47')](handleError(_0x210d28,null));};exports['create']=function(_0x3a3c06,_0x1b7086){return db[_0x0437('0x2d')]['create'](_0x3a3c06[_0x0437('0x4b')],{})['then'](function(_0x52e321){var _0xe7ec92=_0x3a3c06[_0x0437('0x4c')][_0x0437('0x24')]({'plain':!![]});if(!_0xe7ec92)throw new Error(_0x0437('0x4d'));if(_0xe7ec92[_0x0437('0x4e')]==='user'){var _0x347399=_0x52e321[_0x0437('0x24')]({'plain':!![]});var _0x11eb09=_0x0437('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x11eb09,'userProfileId':_0xe7ec92[_0x0437('0x4f')]},'raw':!![]})[_0x0437('0x22')](function(_0x10b30c){if(_0x10b30c&&_0x10b30c[_0x0437('0x50')]===0x0){return db[_0x0437('0x26')][_0x0437('0x51')]({'name':_0x347399[_0x0437('0x2a')],'resourceId':_0x347399['id'],'type':_0x10b30c['name'],'sectionId':_0x10b30c['id']},{})['then'](function(){return _0x52e321;});}else{return _0x52e321;}})[_0x0437('0x47')](function(_0x5146c8){logger['error'](_0x0437('0x52'),_0x5146c8);throw _0x5146c8;});}return _0x52e321;})[_0x0437('0x22')](respondWithResult(_0x1b7086,0xc9))[_0x0437('0x47')](handleError(_0x1b7086,null));};exports[_0x0437('0x21')]=function(_0x3230e7,_0x25c7c1){if(_0x3230e7[_0x0437('0x4b')]['id']){delete _0x3230e7[_0x0437('0x4b')]['id'];}return db['Pause'][_0x0437('0x53')]({'where':{'id':_0x3230e7[_0x0437('0x49')]['id']}})['then'](handleEntityNotFound(_0x25c7c1,null))[_0x0437('0x22')](saveUpdates(_0x3230e7['body'],null))['then'](respondWithResult(_0x25c7c1,null))[_0x0437('0x47')](handleError(_0x25c7c1,null));};exports['destroy']=function(_0x4178a2,_0x2f5b41){return db[_0x0437('0x2d')][_0x0437('0x53')]({'where':{'id':_0x4178a2['params']['id']}})['then'](handleEntityNotFound(_0x2f5b41,null))[_0x0437('0x22')](removeEntity(_0x2f5b41,null))[_0x0437('0x47')](handleError(_0x2f5b41,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 8f759b8..e35aecf 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0x20985c,_0x3dabe4){var _0x4aae14=function(_0x498949){while(--_0x498949){_0x20985c['push'](_0x20985c['shift']());}};_0x4aae14(++_0x3dabe4);}(_0x814b,0x1a2));var _0xb814=function(_0x11cbb5,_0x390441){_0x11cbb5=_0x11cbb5-0x0;var _0x54b8d3=_0x814b[_0x11cbb5];return _0x54b8d3;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x3496fb,_0x4bcb1b){var _0x185cf2=function(_0x3b66de){while(--_0x3b66de){_0x3496fb['push'](_0x3496fb['shift']());}};_0x185cf2(++_0x4bcb1b);}(_0x53ec,0x192));var _0xc53e=function(_0x31038b,_0x3ac1c9){_0x31038b=_0x31038b-0x0;var _0x1c9d3c=_0x53ec[_0x31038b];return _0x1c9d3c;};'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 4c5390a..cf66aa9 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x547cae,_0x33fdff){var _0x4f6d26=function(_0x4cbfbd){while(--_0x4cbfbd){_0x547cae['push'](_0x547cae['shift']());}};_0x4f6d26(++_0x33fdff);}(_0xb10b,0x12a));var _0xbb10=function(_0x235ba6,_0x315773){_0x235ba6=_0x235ba6-0x0;var _0x2aa7c4=_0xb10b[_0x235ba6];return _0x2aa7c4;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x54bda6,_0x5cd10b){var _0x1947d3=function(_0x94f167){while(--_0x94f167){_0x54bda6['push'](_0x54bda6['shift']());}};_0x1947d3(++_0x5cd10b);}(_0xb10b,0x12a));var _0xbb10=function(_0x4d3e97,_0x749913){_0x4d3e97=_0x4d3e97-0x0;var _0x3147d7=_0xb10b[_0x4d3e97];return _0x3147d7;};'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 3549143..fad4cde 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 _0x0c02=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/:id','show','/:id/download','join','root','server/files/plugins','replace','format','%s-%s%s','basename','originalname','extname','now','post','single','file','upload','/webhook','update','delete','exports'];(function(_0x55ed79,_0x1cee26){var _0xd7a6b8=function(_0x1d70cd){while(--_0x1d70cd){_0x55ed79['push'](_0x55ed79['shift']());}};_0xd7a6b8(++_0x1cee26);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20c0('0x0'));var path=require(_0x20c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x20c0('0x2'));var router=express[_0x20c0('0x3')]();var fs_extra=require(_0x20c0('0x4'));var auth=require(_0x20c0('0x5'));var interaction=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xb')]);router['get']('/webhook',controller['webhookGet']);router['get'](_0x20c0('0xc'),auth[_0x20c0('0xa')](),controller[_0x20c0('0xd')]);router[_0x20c0('0x9')](_0x20c0('0xe'),auth[_0x20c0('0xa')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x52eb0d,_0x578592,_0x56770a){_0x56770a(null,path[_0x20c0('0xf')](config[_0x20c0('0x10')],_0x20c0('0x11')));},'filename':function(_0x207b1e,_0x4ed79e,_0x56fa09){_0x4ed79e['originalname']=_0x4ed79e['originalname'][_0x20c0('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x56fa09(null,util[_0x20c0('0x13')](_0x20c0('0x14'),path[_0x20c0('0x15')](_0x4ed79e[_0x20c0('0x16')],path[_0x20c0('0x17')](_0x4ed79e[_0x20c0('0x16')])),Date[_0x20c0('0x18')](),path[_0x20c0('0x17')](_0x4ed79e['originalname'])));}})});router[_0x20c0('0x19')]('/',upload[_0x20c0('0x1a')](_0x20c0('0x1b')),controller[_0x20c0('0x1c')]);router[_0x20c0('0x19')](_0x20c0('0x1d'),controller['webhookPost']);router['put']('/:id',auth[_0x20c0('0xa')](),controller[_0x20c0('0x1e')]);router[_0x20c0('0x1f')](_0x20c0('0xc'),auth['isAuthenticated'](),controller[_0x20c0('0x1f')]);module[_0x20c0('0x20')]=router; \ No newline at end of file +var _0xa8a8=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','single','file','upload','post','put','update','delete','multer','util'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xa8a8,0xec));var _0x8a8a=function(_0x1c4b95,_0x24d077){_0x1c4b95=_0x1c4b95-0x0;var _0x1527e1=_0xa8a8[_0x1c4b95];return _0x1527e1;};'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'),controller[_0x8a8a('0xe')]);router[_0x8a8a('0xa')](_0x8a8a('0xf'),auth[_0x8a8a('0xb')](),controller['show']);router['get'](_0x8a8a('0x10'),auth['isAuthenticated'](),controller[_0x8a8a('0x11')]);var upload=multer({'storage':multer[_0x8a8a('0x12')]({'destination':function(_0x532621,_0x118380,_0x76b586){_0x76b586(null,path[_0x8a8a('0x13')](config['root'],_0x8a8a('0x14')));},'filename':function(_0x42fab7,_0x330796,_0x234481){_0x330796['originalname']=_0x330796[_0x8a8a('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x234481(null,util[_0x8a8a('0x16')](_0x8a8a('0x17'),path[_0x8a8a('0x18')](_0x330796[_0x8a8a('0x15')],path[_0x8a8a('0x19')](_0x330796[_0x8a8a('0x15')])),Date[_0x8a8a('0x1a')](),path['extname'](_0x330796[_0x8a8a('0x15')])));}})});router['post']('/',upload[_0x8a8a('0x1b')](_0x8a8a('0x1c')),controller[_0x8a8a('0x1d')]);router[_0x8a8a('0x1e')](_0x8a8a('0xd'),controller['webhookPost']);router[_0x8a8a('0x1f')](_0x8a8a('0xf'),auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x20')]);router[_0x8a8a('0x21')](_0x8a8a('0xf'),auth['isAuthenticated'](),controller['delete']);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 db4c48c..2826bc7 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 _0x4426=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','ENUM','TEXT'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0x4426,0x192));var _0x6442=function(_0x22f934,_0x8aad2d){_0x22f934=_0x22f934-0x0;var _0x58c43e=_0x4426[_0x22f934];return _0x58c43e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6442('0x0')]},'type':{'type':Sequelize[_0x6442('0x1')]('html','script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x6442('0x2')]},'path':{'type':Sequelize[_0x6442('0x0')],'comment':_0x6442('0x3')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x6442('0x4')},'sidebar':{'type':Sequelize[_0x6442('0x1')](_0x6442('0x5'),_0x6442('0x6'),'always',_0x6442('0x7')),'defaultValue':'always','comment':_0x6442('0x8')},'icon':{'type':Sequelize[_0x6442('0x0')]},'adminUrl':{'type':Sequelize[_0x6442('0x0')]},'agentUrl':{'type':Sequelize[_0x6442('0x0')]},'scriptName':{'type':Sequelize[_0x6442('0x0')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5b9c=['TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','ENUM','script'];(function(_0x524c61,_0x10722f){var _0x508e21=function(_0x3fd4a3){while(--_0x3fd4a3){_0x524c61['push'](_0x524c61['shift']());}};_0x508e21(++_0x10722f);}(_0x5b9c,0x153));var _0xc5b9=function(_0x3b7b9f,_0x1ca18f){_0x3b7b9f=_0x3b7b9f-0x0;var _0x36aaac=_0x5b9c[_0x3b7b9f];return _0x36aaac;};'use strict';var Sequelize=require(_0xc5b9('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc5b9('0x1')]('html',_0xc5b9('0x2'))},'description':{'type':Sequelize[_0xc5b9('0x3')]},'version':{'type':Sequelize[_0xc5b9('0x3')]},'path':{'type':Sequelize[_0xc5b9('0x4')],'comment':_0xc5b9('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0xc5b9('0x6'),_0xc5b9('0x7'),'always','never'),'defaultValue':'always','comment':_0xc5b9('0x8')},'icon':{'type':Sequelize[_0xc5b9('0x4')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xc5b9('0x4')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xc5b9('0x4')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index debe2bc..2e6cc6b 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 _0x79e0=['%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','dirname','node_modules/**/*','attachments/**/*','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Temporary\x20file\x20removed','upload','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20parameters\x20missing','parameters','views','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','agent','create','role','userProfileId','user','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Extracted\x20folder\x20removed','update','body','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-type','endsWith','statusCode','webhookPost','%s%s','content-length','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','extract-zip','rimraf','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','name','filter','merge','Plugin','includeAll','include','findAll','catch','show','params','options','find','download','join','root','server/files/plugins','format'];(function(_0xb36843,_0x57c1f4){var _0x227b83=function(_0x3bce6f){while(--_0x3bce6f){_0xb36843['push'](_0xb36843['shift']());}};_0x227b83(++_0x57c1f4);}(_0x79e0,0x1a9));var _0x079e=function(_0x1e081a,_0x482d6b){_0x1e081a=_0x1e081a-0x0;var _0x428209=_0x79e0[_0x1e081a];return _0x428209;};'use strict';var emlformat=require(_0x079e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x079e('0x1'));var rp=require(_0x079e('0x2'));var moment=require(_0x079e('0x3'));var BPromise=require(_0x079e('0x4'));var Mustache=require(_0x079e('0x5'));var util=require(_0x079e('0x6'));var path=require(_0x079e('0x7'));var sox=require('sox');var csv=require(_0x079e('0x8'));var ejs=require(_0x079e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x079e('0xa'));var squel=require('squel');var crypto=require(_0x079e('0xb'));var jsforce=require(_0x079e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x079e('0x8'));var querystring=require('querystring');var Papa=require(_0x079e('0xd'));var extract=require(_0x079e('0xe'));var rimraf=require(_0x079e('0xf'));var archiver=require(_0x079e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x079e('0x11'));var as=require(_0x079e('0x12'));var hardwareService=require(_0x079e('0x13'));var logger=require(_0x079e('0x14'))(_0x079e('0x15'));var utils=require(_0x079e('0x16'));var config=require(_0x079e('0x17'));var licenseUtil=require(_0x079e('0x18'));var db=require('../../mysqldb')['db'];config[_0x079e('0x19')]=_['defaults'](config['redis'],{'host':_0x079e('0x1a'),'port':0x18eb});var socket=require(_0x079e('0x1b'))(new Redis(config[_0x079e('0x19')]));require(_0x079e('0x1c'))[_0x079e('0x1d')](socket);function respondWithStatusCode(_0x59bc7f,_0x26bba0){_0x26bba0=_0x26bba0||0xcc;return function(_0x297988){if(_0x297988){return _0x59bc7f[_0x079e('0x1e')](_0x26bba0);}return _0x59bc7f[_0x079e('0x1f')](_0x26bba0)['end']();};}function respondWithResult(_0x53b214,_0x3f94aa){_0x3f94aa=_0x3f94aa||0xc8;return function(_0x4fb782){if(_0x4fb782){return _0x53b214[_0x079e('0x1f')](_0x3f94aa)[_0x079e('0x20')](_0x4fb782);}};}function respondWithFilteredResult(_0x37c97b,_0x52a61f){return function(_0x138984){if(_0x138984){var _0xa0dadb=typeof _0x52a61f[_0x079e('0x21')]===_0x079e('0x22')&&typeof _0x52a61f['limit']===_0x079e('0x22');var _0x497efa=_0x138984[_0x079e('0x23')];var _0xd9b980=_0xa0dadb?0x0:_0x52a61f[_0x079e('0x21')];var _0x2e5cda=_0xa0dadb?_0x138984[_0x079e('0x23')]:_0x52a61f['offset']+_0x52a61f[_0x079e('0x24')];var _0x145549;if(_0x2e5cda>=_0x497efa){_0x2e5cda=_0x497efa;_0x145549=0xc8;}else{_0x145549=0xce;}_0x37c97b[_0x079e('0x1f')](_0x145549);return _0x37c97b[_0x079e('0x25')](_0x079e('0x26'),_0xd9b980+'-'+_0x2e5cda+'/'+_0x497efa)[_0x079e('0x20')](_0x138984);}return null;};}function patchUpdates(_0x29caf7){return function(_0x11cc72){try{jsonpatch[_0x079e('0x27')](_0x11cc72,_0x29caf7,!![]);}catch(_0x5a6966){return BPromise[_0x079e('0x28')](_0x5a6966);}return _0x11cc72[_0x079e('0x29')]();};}function saveUpdates(_0x165f37,_0x13342f){return function(_0x268c8){if(_0x268c8){return _0x268c8['update'](_0x165f37)[_0x079e('0x2a')](function(_0x4174ef){return _0x4174ef;});}return null;};}function removeEntity(_0x14f085,_0x36fe9c){return function(_0x51727f){if(_0x51727f){return _0x51727f['destroy']()['then'](function(){var _0x2e6df8=_0x51727f[_0x079e('0x2b')]({'plain':!![]});var _0x1bc301='Plugins';return db[_0x079e('0x2c')][_0x079e('0x2d')]({'where':{'type':_0x1bc301,'resourceId':_0x2e6df8['id']}})[_0x079e('0x2a')](function(){return _0x51727f;});})[_0x079e('0x2a')](function(){_0x14f085[_0x079e('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bf3fb,_0x17f86c){return function(_0x4babfb){if(!_0x4babfb){_0x5bf3fb[_0x079e('0x1e')](0x194);}return _0x4babfb;};}function handleError(_0x4f712b,_0x4c004e){_0x4c004e=_0x4c004e||0x1f4;return function(_0x1013e8){logger[_0x079e('0x2e')](_0x1013e8[_0x079e('0x2f')]);if(_0x1013e8['name']){delete _0x1013e8['name'];}_0x4f712b[_0x079e('0x1f')](_0x4c004e)[_0x079e('0x30')](_0x1013e8);};}exports['index']=function(_0x178923,_0x55066a){var _0x3f0129={},_0x40dc87={},_0x41c52a={'count':0x0,'rows':[]};var _0x432dff=_[_0x079e('0x31')](db['Plugin'][_0x079e('0x32')],function(_0x3cbe5f){return{'name':_0x3cbe5f[_0x079e('0x33')],'type':_0x3cbe5f[_0x079e('0x34')]['key']};});_0x40dc87[_0x079e('0x35')]=_[_0x079e('0x31')](_0x432dff,'name');_0x40dc87[_0x079e('0x36')]=_[_0x079e('0x37')](_0x178923['query']);_0x40dc87[_0x079e('0x38')]=_[_0x079e('0x39')](_0x40dc87[_0x079e('0x35')],_0x40dc87[_0x079e('0x36')]);_0x3f0129[_0x079e('0x3a')]=_[_0x079e('0x39')](_0x40dc87['model'],qs[_0x079e('0x3b')](_0x178923[_0x079e('0x36')]['fields']));_0x3f0129[_0x079e('0x3a')]=_0x3f0129['attributes'][_0x079e('0x3c')]?_0x3f0129[_0x079e('0x3a')]:_0x40dc87['model'];if(!_0x178923[_0x079e('0x36')][_0x079e('0x3d')]('nolimit')){_0x3f0129['limit']=qs[_0x079e('0x24')](_0x178923['query'][_0x079e('0x24')]);_0x3f0129['offset']=qs[_0x079e('0x21')](_0x178923[_0x079e('0x36')]['offset']);}_0x3f0129[_0x079e('0x3e')]=qs['sort'](_0x178923[_0x079e('0x36')]['sort']);_0x3f0129[_0x079e('0x3f')]=qs[_0x079e('0x38')](_[_0x079e('0x40')](_0x178923['query'],_0x40dc87[_0x079e('0x38')]),_0x432dff);if(_0x178923['query']['filter']){_0x3f0129['where']=_['merge'](_0x3f0129[_0x079e('0x3f')],{'$or':_[_0x079e('0x31')](_0x432dff,function(_0x444e8){if(_0x444e8[_0x079e('0x34')]!=='VIRTUAL'){var _0x51eb63={};_0x51eb63[_0x444e8[_0x079e('0x41')]]={'$like':'%'+_0x178923[_0x079e('0x36')][_0x079e('0x42')]+'%'};return _0x51eb63;}})});}_0x3f0129=_[_0x079e('0x43')]({},_0x3f0129,_0x178923['options']);var _0x56228e={'where':_0x3f0129[_0x079e('0x3f')]};return db[_0x079e('0x44')][_0x079e('0x23')](_0x56228e)[_0x079e('0x2a')](function(_0x36e3a0){_0x41c52a[_0x079e('0x23')]=_0x36e3a0;if(_0x178923[_0x079e('0x36')][_0x079e('0x45')]){_0x3f0129[_0x079e('0x46')]=[{'all':!![]}];}return db[_0x079e('0x44')][_0x079e('0x47')](_0x3f0129);})[_0x079e('0x2a')](function(_0x14ade4){_0x41c52a['rows']=_0x14ade4;return _0x41c52a;})[_0x079e('0x2a')](respondWithFilteredResult(_0x55066a,_0x3f0129))[_0x079e('0x48')](handleError(_0x55066a,null));};exports[_0x079e('0x49')]=function(_0x287adf,_0x4d1826){var _0x4cb674={'raw':!![],'where':{'id':_0x287adf[_0x079e('0x4a')]['id']}},_0x58f5bf={};_0x58f5bf[_0x079e('0x35')]=_[_0x079e('0x37')](db[_0x079e('0x44')]['rawAttributes']);_0x58f5bf[_0x079e('0x36')]=_[_0x079e('0x37')](_0x287adf['query']);_0x58f5bf[_0x079e('0x38')]=_[_0x079e('0x39')](_0x58f5bf[_0x079e('0x35')],_0x58f5bf['query']);_0x4cb674[_0x079e('0x3a')]=_[_0x079e('0x39')](_0x58f5bf['model'],qs[_0x079e('0x3b')](_0x287adf['query'][_0x079e('0x3b')]));_0x4cb674[_0x079e('0x3a')]=_0x4cb674[_0x079e('0x3a')][_0x079e('0x3c')]?_0x4cb674['attributes']:_0x58f5bf[_0x079e('0x35')];if(_0x287adf[_0x079e('0x36')]['includeAll']){_0x4cb674['include']=[{'all':!![]}];}_0x4cb674=_['merge']({},_0x4cb674,_0x287adf[_0x079e('0x4b')]);return db[_0x079e('0x44')][_0x079e('0x4c')](_0x4cb674)[_0x079e('0x2a')](handleEntityNotFound(_0x4d1826,null))[_0x079e('0x2a')](respondWithResult(_0x4d1826,null))[_0x079e('0x48')](handleError(_0x4d1826,null));};exports[_0x079e('0x4d')]=function(_0xf376c3,_0x4de067,_0x5d6f8b){return db[_0x079e('0x44')]['find']({'where':{'id':_0xf376c3[_0x079e('0x4a')]['id']},'attributes':[_0x079e('0x41'),_0x079e('0x7')],'raw':!![]})['then'](handleEntityNotFound(_0x4de067,null))[_0x079e('0x2a')](function(_0x3eaea5){if(_0x3eaea5){var _0x4763e2=path[_0x079e('0x4e')](config[_0x079e('0x4f')],_0x079e('0x50'),util[_0x079e('0x51')](_0x079e('0x52'),path[_0x079e('0x53')](_0x3eaea5[_0x079e('0x7')])));var _0x14890c=fs[_0x079e('0x54')](_0x4763e2);var _0xe3a522=archiver(_0x079e('0x55'),{'zlib':{'level':0x9}});_0xe3a522['on'](_0x079e('0x56'),function(_0x25872e){if(_0x25872e[_0x079e('0x57')]===_0x079e('0x58')){logger[_0x079e('0x2e')](_0x25872e);}else{throw new db['Sequelize'][(_0x079e('0x59'))](_0x079e('0x5a'));}});_0xe3a522['on'](_0x079e('0x2e'),function(_0xadbc67){throw new db[(_0x079e('0x5b'))][(_0x079e('0x59'))](_0x079e('0x5a'));});_0xe3a522[_0x079e('0x5c')](_0x14890c);_0xe3a522[_0x079e('0x5d')](_0x079e('0x5e'),{'cwd':path[_0x079e('0x4e')](config[_0x079e('0x4f')],_0x079e('0x50'),path[_0x079e('0x5f')](_0x3eaea5[_0x079e('0x7')])),'ignore':[path[_0x079e('0x4e')](path[_0x079e('0x53')](_0x3eaea5[_0x079e('0x7')]),_0x079e('0x60')),path[_0x079e('0x4e')](path[_0x079e('0x53')](_0x3eaea5[_0x079e('0x7')]),_0x079e('0x61'))],'nodir':!![]})['finalize']();_0x14890c['on'](_0x079e('0x62'),function(){if(!fs[_0x079e('0x63')](_0x4763e2)){throw new db[(_0x079e('0x5b'))][(_0x079e('0x59'))](_0x079e('0x64'));}return _0x4de067[_0x079e('0x4d')](_0x4763e2,util[_0x079e('0x51')](_0x079e('0x52'),path['basename'](_0x3eaea5[_0x079e('0x7')])),function(_0x1651f4){if(_0x1651f4){throw new db['Sequelize'][(_0x079e('0x59'))](_0x079e('0x65'));}fs['unlinkSync'](_0x4763e2);logger[_0x079e('0x66')]('Download\x20completed');logger['info'](_0x079e('0x67'));});});}return null;})['catch'](handleError(_0x4de067,null));};exports[_0x079e('0x68')]=function(_0x5d60c1,_0x1bc7f4,_0x598416){var _0x3cb479=path['basename'](_0x5d60c1['file'][_0x079e('0x69')],path[_0x079e('0x6a')](_0x5d60c1['file'][_0x079e('0x69')]));var _0x17f96e=path[_0x079e('0x4e')](config[_0x079e('0x4f')],_0x079e('0x50'),_0x5d60c1[_0x079e('0x6b')][_0x079e('0x69')]);var _0x20721a=path['join'](config['root'],_0x079e('0x50'),_0x3cb479);logger[_0x079e('0x66')](_0x079e('0x6c'),_0x17f96e);logger[_0x079e('0x66')](_0x079e('0x6d'),_0x20721a);try{fs['chmodSync'](_0x17f96e,parseInt(_0x079e('0x6e'),0x8));extract(_0x17f96e,{'dir':_0x20721a},function(_0x4fc114){if(_0x4fc114){logger[_0x079e('0x2e')](_0x4fc114);handleError(_0x4fc114,!![]);};var _0x292c84=fs[_0x079e('0x6f')](_0x20721a);if(_0x292c84[_0x079e('0x3c')]>0x1){removeReferences(_0x17f96e,_0x20721a);logger[_0x079e('0x2e')](_0x079e('0x70'));return _0x598416(new Error('Invalid\x20plugin\x20structure'));}var _0x4d0982=fs[_0x079e('0x71')](path[_0x079e('0x4e')](_0x20721a,_0x292c84[0x0]));if(_0x4d0982['isFile']()){removeReferences(_0x17f96e,_0x20721a);logger[_0x079e('0x2e')](_0x079e('0x70'));return _0x598416(new Error(_0x079e('0x70')));}if(_0x4d0982[_0x079e('0x72')]()){var _0x10bd05=fs[_0x079e('0x6f')](path['join'](_0x20721a,_0x292c84[0x0]));if(_0x10bd05[_0x079e('0x3c')]===0x0){removeReferences(_0x17f96e,_0x20721a);logger['error']('Invalid\x20plugin\x20structure');return _0x598416(new Error(_0x079e('0x70')));}var _0x493c56=_0x10bd05[_0x079e('0x73')](function(_0x3e610a){return _0x3e610a===_0x079e('0x74');});if(!_0x493c56){return _0x598416(new Error('Plugin\x20manifest\x20missing'));}var _0x59e70b=fs['readFileSync'](path[_0x079e('0x4e')](_0x20721a,_0x292c84[0x0],_0x079e('0x74')));var _0x3d5958=JSON[_0x079e('0x75')](_0x59e70b);if(_0x079e('0x22')==typeof _0x3d5958[_0x079e('0x41')]){return _0x598416(new Error(_0x079e('0x76')));}if(_0x079e('0x22')==typeof _0x3d5958[_0x079e('0x34')]){return _0x598416(new Error(_0x079e('0x77')));}if('undefined'==typeof _0x3d5958['version']){return _0x598416(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x3d5958['parameters']){return _0x598416(new Error(_0x079e('0x78')));}if(_0x3d5958['type']==='html'){if(_0x079e('0x22')==typeof _0x3d5958[_0x079e('0x79')][_0x079e('0x7a')]){return _0x598416(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x079e('0x22')==typeof _0x3d5958[_0x079e('0x79')]['views'][_0x079e('0x7b')]&&_0x079e('0x22')==typeof _0x3d5958[_0x079e('0x79')][_0x079e('0x7a')]['agent']){return _0x598416(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x3d5958[_0x079e('0x34')]===_0x079e('0x7c')){if(_0x079e('0x22')==typeof _0x3d5958[_0x079e('0x79')][_0x079e('0x7d')]){return _0x598416(new Error(_0x079e('0x7e')));}if(_0x079e('0x22')==typeof _0x3d5958[_0x079e('0x79')][_0x079e('0x7f')]){return _0x598416(new Error(_0x079e('0x80')));}}else{return _0x598416(new Error(_0x079e('0x81')));}var _0x5886e0=_0x3d5958['name'];var _0x1a5118=_0x3d5958[_0x079e('0x82')];var _0x438960=_0x3d5958[_0x079e('0x34')];var _0x33c2a1=_0x3d5958['sidebar']?_0x3d5958[_0x079e('0x83')]:_0x079e('0x84');var _0x4309d8=_0x3d5958[_0x079e('0x85')]?_0x3d5958[_0x079e('0x85')]:_0x079e('0x86');var _0x21030a='';var _0x2f7899='';var _0x51c016='';var _0x177fcd='';var _0x5d7882=_0x3d5958['version'];if(_0x438960===_0x079e('0x87')){if('undefined'!=typeof _0x3d5958[_0x079e('0x79')][_0x079e('0x7a')]['admin']){var _0x59d6d5=_0x3d5958[_0x079e('0x79')][_0x079e('0x7a')][_0x079e('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x079e('0x88')](_0x59d6d5)){_0x21030a=path[_0x079e('0x4e')](_0x079e('0x89'),_0x3cb479,_0x292c84[0x0],_0x59d6d5);}else{_0x21030a=_0x59d6d5;}}else{logger[_0x079e('0x66')](_0x079e('0x8a'));}if(_0x079e('0x22')!=typeof _0x3d5958[_0x079e('0x79')][_0x079e('0x7a')]['agent']){var _0x1ca536=_0x3d5958[_0x079e('0x79')][_0x079e('0x7a')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x1ca536)){_0x2f7899=path[_0x079e('0x4e')](_0x079e('0x89'),_0x3cb479,_0x292c84[0x0],_0x1ca536);}else{_0x2f7899=_0x1ca536;}}else{logger[_0x079e('0x66')](_0x079e('0x8b'));}}else if(_0x438960===_0x079e('0x7c')){_0x51c016=_0x3d5958['parameters'][_0x079e('0x7d')];_0x177fcd=_0x3d5958['parameters'][_0x079e('0x7f')];if('undefined'!=typeof _0x3d5958[_0x079e('0x79')][_0x079e('0x7a')]){if(_0x079e('0x22')!=typeof _0x3d5958[_0x079e('0x79')][_0x079e('0x7a')][_0x079e('0x7b')]){var _0x59d6d5=_0x3d5958[_0x079e('0x79')]['views'][_0x079e('0x7b')];if(!/^(f|ht)tps?:\/\//i['test'](_0x59d6d5)){_0x21030a=path[_0x079e('0x4e')](_0x079e('0x89'),_0x3cb479,_0x292c84[0x0],_0x59d6d5);}else{_0x21030a=_0x59d6d5;}}if(_0x079e('0x22')!=typeof _0x3d5958[_0x079e('0x79')][_0x079e('0x7a')][_0x079e('0x8c')]){var _0x1ca536=_0x3d5958['parameters'][_0x079e('0x7a')][_0x079e('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x079e('0x88')](_0x1ca536)){_0x2f7899=path[_0x079e('0x4e')](_0x079e('0x89'),_0x3cb479,_0x292c84[0x0],_0x1ca536);}else{_0x2f7899=_0x1ca536;}}}}var _0x22d3e6={'name':_0x5886e0,'description':_0x1a5118,'path':path[_0x079e('0x4e')](_0x3cb479,_0x292c84[0x0]),'type':_0x438960,'sidebar':_0x33c2a1,'icon':_0x4309d8,'adminUrl':_0x21030a,'agentUrl':_0x2f7899,'scriptName':_0x51c016,'scriptPath':_0x177fcd,'version':_0x5d7882};removeReferences(_0x17f96e,null);return db[_0x079e('0x44')][_0x079e('0x8d')](_0x22d3e6)[_0x079e('0x2a')](function(_0x4836db){var _0x485c02={'role':_0x5d60c1['body'][_0x079e('0x8e')],'userProfileId':_0x5d60c1['body'][_0x079e('0x8f')]};if(!_0x485c02)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x485c02[_0x079e('0x8e')]===_0x079e('0x90')){var _0x381eeb=_0x4836db[_0x079e('0x2b')]({'plain':!![]});return db['UserProfileSection'][_0x079e('0x4c')]({'where':{'name':_0x079e('0x91'),'userProfileId':_0x485c02[_0x079e('0x8f')]},'raw':!![]})['then'](function(_0x41efa0){if(_0x41efa0&&_0x41efa0[_0x079e('0x92')]===0x0){return db[_0x079e('0x2c')][_0x079e('0x8d')]({'name':_0x381eeb[_0x079e('0x41')],'resourceId':_0x381eeb['id'],'type':_0x41efa0[_0x079e('0x41')],'sectionId':_0x41efa0['id']},{})[_0x079e('0x2a')](function(){return _0x4836db;});}else{return _0x4836db;}})[_0x079e('0x48')](function(_0x222664){logger['error'](_0x079e('0x93'),_0x222664);throw _0x222664;});}return _0x4836db;})['then'](respondWithResult(_0x1bc7f4,null))[_0x079e('0x48')](handleError(_0x1bc7f4,null));}});}catch(_0x2321b1){_0x1bc7f4[_0x079e('0x1f')](0x1f4)[_0x079e('0x30')](_0x2321b1);}};function removeReferences(_0x2ed7ba,_0x297d52){try{if(_0x2ed7ba){fs[_0x079e('0x94')](_0x2ed7ba);logger[_0x079e('0x66')]('Zip\x20archive\x20removed');}if(_0x297d52){rimraf(_0x297d52,function(){});logger['info'](_0x079e('0x95'));}}catch(_0x5013ac){logger[_0x079e('0x2e')](_0x5013ac);}}exports[_0x079e('0x96')]=function(_0x31631d,_0x14f5c4,_0x58b045){return db['Plugin']['find']({'where':{'id':_0x31631d[_0x079e('0x4a')]['id']}})[_0x079e('0x2a')](handleEntityNotFound(_0x14f5c4,null))[_0x079e('0x2a')](saveUpdates(_0x31631d[_0x079e('0x97')],null))[_0x079e('0x2a')](respondWithResult(_0x14f5c4,null))[_0x079e('0x48')](handleError(_0x14f5c4,null));};exports[_0x079e('0x98')]=function(_0x3602d7,_0x85c5b8,_0x4e8fe3){return db[_0x079e('0x44')][_0x079e('0x4c')]({'where':{'id':_0x3602d7[_0x079e('0x4a')]['id']}})[_0x079e('0x2a')](function(_0x5f5465){if(_0x5f5465){return _0x5f5465['destroy']();}})[_0x079e('0x2a')](function(_0x2a3fb2){rimraf(path[_0x079e('0x4e')](config[_0x079e('0x4f')],'server/files/plugins',path[_0x079e('0x5f')](_0x2a3fb2[_0x079e('0x7')])),function(){});return _0x2a3fb2;})['then'](handleEntityNotFound(_0x85c5b8,null))[_0x079e('0x2a')](respondWithStatusCode(_0x85c5b8,null))[_0x079e('0x48')](handleError(_0x85c5b8,null));};exports[_0x079e('0x99')]=function(_0x4749b8,_0x4abb7c,_0x29c741){return BPromise[_0x079e('0x9a')]()[_0x079e('0x2a')](function(){if(!_0x4749b8['query'][_0x079e('0x7')]){throw new Error(_0x079e('0x9b'));}if(!_0x4749b8[_0x079e('0x36')][_0x079e('0x9c')]){throw new Error(_0x079e('0x9d'));}var _0x789ec1=_0x4749b8['query'][_0x079e('0x9e')]?_0x4749b8[_0x079e('0x36')][_0x079e('0x9e')]+':'+_0x4749b8[_0x079e('0x36')][_0x079e('0x9c')]:_0x079e('0x9f')+_0x4749b8[_0x079e('0x36')][_0x079e('0x9c')];var _0x2fe0c3=_0x4749b8[_0x079e('0x36')][_0x079e('0x20')]?_0x4749b8[_0x079e('0x36')]['json']:!![];var _0x31f991=_0x4749b8['query']['encoding']?_0x4749b8[_0x079e('0x36')][_0x079e('0xa0')]:null;var _0x3ec929={'method':_0x4749b8[_0x079e('0xa1')],'uri':util['format']('%s%s',_0x789ec1,_0x4749b8[_0x079e('0x36')][_0x079e('0x7')]),'json':_0x2fe0c3,'resolveWithFullResponse':!![],'encoding':_0x31f991,'qs':_0x4749b8[_0x079e('0x36')]};if(_0x4749b8[_0x079e('0xa2')]){_0x3ec929[_0x079e('0xa2')]=_0x4749b8[_0x079e('0xa2')];if(_0x3ec929['headers']['content-length']){delete _0x3ec929['headers']['content-length'];}}if(_0x3ec929[_0x079e('0xa2')][_0x079e('0xa3')]){delete _0x3ec929[_0x079e('0xa2')][_0x079e('0xa3')];}return rp(_0x3ec929);})[_0x079e('0x2a')](function(_0x12a95e){if(_0x12a95e){_0x4abb7c[_0x079e('0x25')](_0x12a95e[_0x079e('0xa2')]);logger[_0x079e('0x66')](_0x12a95e[_0x079e('0x97')]);if(_[_0x079e('0xa4')](_0x4749b8[_0x079e('0x36')][_0x079e('0x7')],'download')&&_0x12a95e[_0x079e('0xa5')]==0x1f4){return _0x4abb7c['sendStatus'](_0x12a95e['statusCode']);}else{return _0x4abb7c[_0x079e('0x1f')](_0x12a95e['statusCode'])[_0x079e('0x30')](_0x12a95e[_0x079e('0x97')]);}}else{return _0x4abb7c[_0x079e('0x1e')](0xc8);}})['catch'](handleError(_0x4abb7c,null));};exports[_0x079e('0xa6')]=function(_0x4da111,_0x2bde03,_0x45135b){return BPromise[_0x079e('0x9a')]()['then'](function(){if(!_0x4da111[_0x079e('0x36')]['path']){throw new Error(_0x079e('0x9b'));}if(!_0x4da111[_0x079e('0x36')]['port']){throw new Error(_0x079e('0x9d'));}var _0x26841c=_0x4da111[_0x079e('0x36')][_0x079e('0x9e')]?_0x4da111['query'][_0x079e('0x9e')]+':'+_0x4da111[_0x079e('0x36')]['port']:'http://localhost:'+_0x4da111[_0x079e('0x36')][_0x079e('0x9c')];var _0x342aa4=_0x4da111['query'][_0x079e('0x20')]?_0x4da111['query'][_0x079e('0x20')]:!![];var _0x330f70=_0x4da111[_0x079e('0x36')][_0x079e('0xa0')]?_0x4da111[_0x079e('0x36')][_0x079e('0xa0')]:null;var _0x1f4876={'method':_0x4da111[_0x079e('0xa1')],'uri':util[_0x079e('0x51')](_0x079e('0xa7'),_0x26841c,_0x4da111[_0x079e('0x36')][_0x079e('0x7')]),'json':_0x342aa4,'resolveWithFullResponse':!![],'encoding':_0x330f70,'body':_0x4da111[_0x079e('0x97')]};if(_0x4da111[_0x079e('0xa2')]){_0x1f4876[_0x079e('0xa2')]=_0x4da111[_0x079e('0xa2')];if(_0x1f4876[_0x079e('0xa2')][_0x079e('0xa8')]){delete _0x1f4876['headers'][_0x079e('0xa8')];}}if(_0x1f4876['headers']['content-type']){delete _0x1f4876[_0x079e('0xa2')][_0x079e('0xa3')];}return rp(_0x1f4876);})[_0x079e('0x2a')](function(_0x47b5cd){if(_0x47b5cd){_0x2bde03[_0x079e('0x25')](_0x47b5cd[_0x079e('0xa2')]);logger[_0x079e('0x66')](_0x47b5cd[_0x079e('0x97')]);return _0x2bde03[_0x079e('0x1f')](_0x47b5cd[_0x079e('0xa5')])[_0x079e('0x30')](_0x47b5cd['body']);}else{return _0x2bde03['sendStatus'](0xc8);}})[_0x079e('0x48')](handleError(_0x2bde03,null));}; \ No newline at end of file +var _0xbeca=['script','plugins','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','format','headers','content-type','set','endsWith','statusCode','webhookPost','%s%s','content-length','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','extract-zip','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','Plugins','error','stack','name','send','Plugin','fieldName','model','map','keys','query','filters','intersection','attributes','length','order','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','include','find','join','root','server/files/plugins','%s.zip','createWriteStream','zip','warning','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','basename','finalize','close','Plugin\x20not\x20found','download','info','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','test','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xbeca,0xc5));var _0xabec=function(_0x4a2673,_0x1290a1){_0x4a2673=_0x4a2673-0x0;var _0x20f7ff=_0xbeca[_0x4a2673];return _0x20f7ff;};'use strict';var emlformat=require(_0xabec('0x0'));var rimraf=require(_0xabec('0x1'));var zipdir=require(_0xabec('0x2'));var jsonpatch=require(_0xabec('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xabec('0x4'));var Mustache=require(_0xabec('0x5'));var util=require('util');var path=require(_0xabec('0x6'));var sox=require('sox');var csv=require(_0xabec('0x7'));var ejs=require(_0xabec('0x8'));var fs=require('fs');var fs_extra=require(_0xabec('0x9'));var _=require(_0xabec('0xa'));var squel=require(_0xabec('0xb'));var crypto=require(_0xabec('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xabec('0xd'));var toCsv=require(_0xabec('0x7'));var querystring=require(_0xabec('0xe'));var Papa=require(_0xabec('0xf'));var extract=require(_0xabec('0x10'));var rimraf=require(_0xabec('0x1'));var archiver=require(_0xabec('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xabec('0x12'));var as=require(_0xabec('0x13'));var hardwareService=require(_0xabec('0x14'));var logger=require('../../config/logger')(_0xabec('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xabec('0x16'));var db=require(_0xabec('0x17'))['db'];config[_0xabec('0x18')]=_[_0xabec('0x19')](config['redis'],{'host':_0xabec('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xabec('0x18')]));require(_0xabec('0x1b'))[_0xabec('0x1c')](socket);function respondWithStatusCode(_0x2fe78f,_0x349344){_0x349344=_0x349344||0xcc;return function(_0x49e7d4){if(_0x49e7d4){return _0x2fe78f[_0xabec('0x1d')](_0x349344);}return _0x2fe78f[_0xabec('0x1e')](_0x349344)[_0xabec('0x1f')]();};}function respondWithResult(_0x24334d,_0x341e4d){_0x341e4d=_0x341e4d||0xc8;return function(_0xe20f91){if(_0xe20f91){return _0x24334d[_0xabec('0x1e')](_0x341e4d)[_0xabec('0x20')](_0xe20f91);}};}function respondWithFilteredResult(_0x31ea6a,_0x4248a2){return function(_0x9eafd6){if(_0x9eafd6){var _0x28c9c3=typeof _0x4248a2[_0xabec('0x21')]==='undefined'&&typeof _0x4248a2[_0xabec('0x22')]===_0xabec('0x23');var _0x17e18d=_0x9eafd6[_0xabec('0x24')];var _0x177a58=_0x28c9c3?0x0:_0x4248a2['offset'];var _0x4e33c5=_0x28c9c3?_0x9eafd6[_0xabec('0x24')]:_0x4248a2[_0xabec('0x21')]+_0x4248a2[_0xabec('0x22')];var _0x11923f;if(_0x4e33c5>=_0x17e18d){_0x4e33c5=_0x17e18d;_0x11923f=0xc8;}else{_0x11923f=0xce;}_0x31ea6a[_0xabec('0x1e')](_0x11923f);return _0x31ea6a['set'](_0xabec('0x25'),_0x177a58+'-'+_0x4e33c5+'/'+_0x17e18d)['json'](_0x9eafd6);}return null;};}function patchUpdates(_0x1b09f5){return function(_0x1f0ccf){try{jsonpatch[_0xabec('0x26')](_0x1f0ccf,_0x1b09f5,!![]);}catch(_0x32e846){return BPromise[_0xabec('0x27')](_0x32e846);}return _0x1f0ccf[_0xabec('0x28')]();};}function saveUpdates(_0x55f0d6,_0x399e3e){return function(_0x520faa){if(_0x520faa){return _0x520faa[_0xabec('0x29')](_0x55f0d6)[_0xabec('0x2a')](function(_0x260108){return _0x260108;});}return null;};}function removeEntity(_0x23bae7,_0x384fac){return function(_0x546302){if(_0x546302){return _0x546302[_0xabec('0x2b')]()['then'](function(){var _0x272552=_0x546302['get']({'plain':!![]});var _0x4b69a1=_0xabec('0x2c');return db['UserProfileResource'][_0xabec('0x2b')]({'where':{'type':_0x4b69a1,'resourceId':_0x272552['id']}})['then'](function(){return _0x546302;});})['then'](function(){_0x23bae7[_0xabec('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5564ae,_0x1c1bb2){return function(_0x48a2cc){if(!_0x48a2cc){_0x5564ae['sendStatus'](0x194);}return _0x48a2cc;};}function handleError(_0x3f9a44,_0x3454c3){_0x3454c3=_0x3454c3||0x1f4;return function(_0x5a1524){logger[_0xabec('0x2d')](_0x5a1524[_0xabec('0x2e')]);if(_0x5a1524['name']){delete _0x5a1524[_0xabec('0x2f')];}_0x3f9a44[_0xabec('0x1e')](_0x3454c3)[_0xabec('0x30')](_0x5a1524);};}exports['index']=function(_0x5a35c1,_0x3d575f){var _0x10c68d={},_0x8fee71={},_0x32bd5b={'count':0x0,'rows':[]};var _0x1bb33b=_['map'](db[_0xabec('0x31')]['rawAttributes'],function(_0x2a999a){return{'name':_0x2a999a[_0xabec('0x32')],'type':_0x2a999a['type']['key']};});_0x8fee71[_0xabec('0x33')]=_[_0xabec('0x34')](_0x1bb33b,'name');_0x8fee71['query']=_[_0xabec('0x35')](_0x5a35c1[_0xabec('0x36')]);_0x8fee71[_0xabec('0x37')]=_[_0xabec('0x38')](_0x8fee71[_0xabec('0x33')],_0x8fee71[_0xabec('0x36')]);_0x10c68d[_0xabec('0x39')]=_[_0xabec('0x38')](_0x8fee71[_0xabec('0x33')],qs['fields'](_0x5a35c1['query']['fields']));_0x10c68d['attributes']=_0x10c68d['attributes'][_0xabec('0x3a')]?_0x10c68d[_0xabec('0x39')]:_0x8fee71['model'];if(!_0x5a35c1[_0xabec('0x36')]['hasOwnProperty']('nolimit')){_0x10c68d[_0xabec('0x22')]=qs['limit'](_0x5a35c1[_0xabec('0x36')][_0xabec('0x22')]);_0x10c68d['offset']=qs[_0xabec('0x21')](_0x5a35c1[_0xabec('0x36')][_0xabec('0x21')]);}_0x10c68d[_0xabec('0x3b')]=qs['sort'](_0x5a35c1['query']['sort']);_0x10c68d['where']=qs[_0xabec('0x37')](_[_0xabec('0x3c')](_0x5a35c1[_0xabec('0x36')],_0x8fee71[_0xabec('0x37')]),_0x1bb33b);if(_0x5a35c1[_0xabec('0x36')][_0xabec('0x3d')]){_0x10c68d[_0xabec('0x3e')]=_[_0xabec('0x3f')](_0x10c68d[_0xabec('0x3e')],{'$or':_[_0xabec('0x34')](_0x1bb33b,function(_0x4a88b9){if(_0x4a88b9[_0xabec('0x40')]!==_0xabec('0x41')){var _0x151180={};_0x151180[_0x4a88b9[_0xabec('0x2f')]]={'$like':'%'+_0x5a35c1[_0xabec('0x36')]['filter']+'%'};return _0x151180;}})});}_0x10c68d=_[_0xabec('0x3f')]({},_0x10c68d,_0x5a35c1[_0xabec('0x42')]);var _0xbfe64b={'where':_0x10c68d['where']};return db[_0xabec('0x31')][_0xabec('0x24')](_0xbfe64b)[_0xabec('0x2a')](function(_0x549a7d){_0x32bd5b['count']=_0x549a7d;if(_0x5a35c1[_0xabec('0x36')][_0xabec('0x43')]){_0x10c68d['include']=[{'all':!![]}];}return db[_0xabec('0x31')][_0xabec('0x44')](_0x10c68d);})['then'](function(_0x279871){_0x32bd5b[_0xabec('0x45')]=_0x279871;return _0x32bd5b;})[_0xabec('0x2a')](respondWithFilteredResult(_0x3d575f,_0x10c68d))[_0xabec('0x46')](handleError(_0x3d575f,null));};exports[_0xabec('0x47')]=function(_0x26af21,_0x16d070){var _0x45f3f9={'raw':!![],'where':{'id':_0x26af21[_0xabec('0x48')]['id']}},_0x3e4008={};_0x3e4008[_0xabec('0x33')]=_[_0xabec('0x35')](db[_0xabec('0x31')][_0xabec('0x49')]);_0x3e4008[_0xabec('0x36')]=_[_0xabec('0x35')](_0x26af21[_0xabec('0x36')]);_0x3e4008[_0xabec('0x37')]=_[_0xabec('0x38')](_0x3e4008[_0xabec('0x33')],_0x3e4008['query']);_0x45f3f9['attributes']=_['intersection'](_0x3e4008[_0xabec('0x33')],qs['fields'](_0x26af21[_0xabec('0x36')][_0xabec('0x4a')]));_0x45f3f9[_0xabec('0x39')]=_0x45f3f9[_0xabec('0x39')][_0xabec('0x3a')]?_0x45f3f9[_0xabec('0x39')]:_0x3e4008[_0xabec('0x33')];if(_0x26af21[_0xabec('0x36')]['includeAll']){_0x45f3f9[_0xabec('0x4b')]=[{'all':!![]}];}_0x45f3f9=_[_0xabec('0x3f')]({},_0x45f3f9,_0x26af21[_0xabec('0x42')]);return db['Plugin'][_0xabec('0x4c')](_0x45f3f9)[_0xabec('0x2a')](handleEntityNotFound(_0x16d070,null))['then'](respondWithResult(_0x16d070,null))[_0xabec('0x46')](handleError(_0x16d070,null));};exports['download']=function(_0x738914,_0x5186c2,_0x5e2da1){return db['Plugin'][_0xabec('0x4c')]({'where':{'id':_0x738914[_0xabec('0x48')]['id']},'attributes':[_0xabec('0x2f'),'path'],'raw':!![]})[_0xabec('0x2a')](handleEntityNotFound(_0x5186c2,null))['then'](function(_0x3f26ba){if(_0x3f26ba){var _0x16ab90=path[_0xabec('0x4d')](config[_0xabec('0x4e')],_0xabec('0x4f'),util['format'](_0xabec('0x50'),path['basename'](_0x3f26ba[_0xabec('0x6')])));var _0x335d86=fs[_0xabec('0x51')](_0x16ab90);var _0x53867e=archiver(_0xabec('0x52'),{'zlib':{'level':0x9}});_0x53867e['on'](_0xabec('0x53'),function(_0xa00ece){if(_0xa00ece['code']===_0xabec('0x54')){logger[_0xabec('0x2d')](_0xa00ece);}else{throw new db[(_0xabec('0x55'))][(_0xabec('0x56'))](_0xabec('0x57'));}});_0x53867e['on'](_0xabec('0x2d'),function(_0x495794){throw new db['Sequelize']['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x53867e[_0xabec('0x58')](_0x335d86);_0x53867e['glob'](_0xabec('0x59'),{'cwd':path[_0xabec('0x4d')](config[_0xabec('0x4e')],_0xabec('0x4f'),path['dirname'](_0x3f26ba[_0xabec('0x6')])),'ignore':[path['join'](path[_0xabec('0x5a')](_0x3f26ba[_0xabec('0x6')]),'node_modules/**/*'),path[_0xabec('0x4d')](path[_0xabec('0x5a')](_0x3f26ba[_0xabec('0x6')]),'attachments/**/*')],'nodir':!![]})[_0xabec('0x5b')]();_0x335d86['on'](_0xabec('0x5c'),function(){if(!fs['existsSync'](_0x16ab90)){throw new db[(_0xabec('0x55'))][(_0xabec('0x56'))](_0xabec('0x5d'));}return _0x5186c2[_0xabec('0x5e')](_0x16ab90,util['format']('%s.zip',path['basename'](_0x3f26ba[_0xabec('0x6')])),function(_0x2e6152){if(_0x2e6152){throw new db['Sequelize'][(_0xabec('0x56'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x16ab90);logger[_0xabec('0x5f')]('Download\x20completed');logger[_0xabec('0x5f')]('Temporary\x20file\x20removed');});});}return null;})[_0xabec('0x46')](handleError(_0x5186c2,null));};exports['upload']=function(_0x35959d,_0x4cdc8b,_0x4780cc){var _0x4d2682=path[_0xabec('0x5a')](_0x35959d[_0xabec('0x60')][_0xabec('0x61')],path[_0xabec('0x62')](_0x35959d[_0xabec('0x60')][_0xabec('0x61')]));var _0x3708dd=path['join'](config['root'],_0xabec('0x4f'),_0x35959d[_0xabec('0x60')]['filename']);var _0x54c120=path[_0xabec('0x4d')](config['root'],'server/files/plugins',_0x4d2682);logger[_0xabec('0x5f')](_0xabec('0x63'),_0x3708dd);logger[_0xabec('0x5f')](_0xabec('0x64'),_0x54c120);try{fs[_0xabec('0x65')](_0x3708dd,parseInt('0777',0x8));extract(_0x3708dd,{'dir':_0x54c120},function(_0x267523){if(_0x267523){logger[_0xabec('0x2d')](_0x267523);handleError(_0x267523,!![]);};var _0x53bf1e=fs[_0xabec('0x66')](_0x54c120);if(_0x53bf1e['length']>0x1){removeReferences(_0x3708dd,_0x54c120);logger[_0xabec('0x2d')](_0xabec('0x67'));return _0x4780cc(new Error(_0xabec('0x67')));}var _0x154e71=fs['lstatSync'](path['join'](_0x54c120,_0x53bf1e[0x0]));if(_0x154e71['isFile']()){removeReferences(_0x3708dd,_0x54c120);logger[_0xabec('0x2d')](_0xabec('0x67'));return _0x4780cc(new Error(_0xabec('0x67')));}if(_0x154e71[_0xabec('0x68')]()){var _0x42fa53=fs[_0xabec('0x66')](path['join'](_0x54c120,_0x53bf1e[0x0]));if(_0x42fa53['length']===0x0){removeReferences(_0x3708dd,_0x54c120);logger[_0xabec('0x2d')](_0xabec('0x67'));return _0x4780cc(new Error(_0xabec('0x67')));}var _0x34943a=_0x42fa53[_0xabec('0x69')](function(_0x351eac){return _0x351eac===_0xabec('0x6a');});if(!_0x34943a){return _0x4780cc(new Error(_0xabec('0x6b')));}var _0x28e272=fs[_0xabec('0x6c')](path[_0xabec('0x4d')](_0x54c120,_0x53bf1e[0x0],_0xabec('0x6a')));var _0x13b47a=JSON[_0xabec('0x6d')](_0x28e272);if(_0xabec('0x23')==typeof _0x13b47a[_0xabec('0x2f')]){return _0x4780cc(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xabec('0x23')==typeof _0x13b47a['type']){return _0x4780cc(new Error(_0xabec('0x6e')));}if('undefined'==typeof _0x13b47a[_0xabec('0x6f')]){return _0x4780cc(new Error(_0xabec('0x70')));}if(_0xabec('0x23')==typeof _0x13b47a[_0xabec('0x71')]){return _0x4780cc(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x13b47a['type']===_0xabec('0x72')){if('undefined'==typeof _0x13b47a[_0xabec('0x71')][_0xabec('0x73')]){return _0x4780cc(new Error(_0xabec('0x74')));}if(_0xabec('0x23')==typeof _0x13b47a[_0xabec('0x71')]['views']['admin']&&_0xabec('0x23')==typeof _0x13b47a[_0xabec('0x71')][_0xabec('0x73')][_0xabec('0x75')]){return _0x4780cc(new Error(_0xabec('0x76')));}}else if(_0x13b47a[_0xabec('0x40')]==='script'){if('undefined'==typeof _0x13b47a[_0xabec('0x71')][_0xabec('0x77')]){return _0x4780cc(new Error(_0xabec('0x78')));}if(_0xabec('0x23')==typeof _0x13b47a[_0xabec('0x71')][_0xabec('0x79')]){return _0x4780cc(new Error(_0xabec('0x7a')));}}else{return _0x4780cc(new Error(_0xabec('0x7b')));}var _0x2023da=_0x13b47a[_0xabec('0x2f')];var _0x4acb1f=_0x13b47a[_0xabec('0x7c')];var _0x2dfb90=_0x13b47a[_0xabec('0x40')];var _0x1d35fd=_0x13b47a[_0xabec('0x7d')]?_0x13b47a[_0xabec('0x7d')]:_0xabec('0x7e');var _0x40f59a=_0x13b47a[_0xabec('0x7f')]?_0x13b47a[_0xabec('0x7f')]:_0xabec('0x80');var _0x1e9abe='';var _0x43767e='';var _0x51b6c3='';var _0x4c52bf='';var _0x25cde2=_0x13b47a[_0xabec('0x6f')];if(_0x2dfb90===_0xabec('0x72')){if(_0xabec('0x23')!=typeof _0x13b47a[_0xabec('0x71')]['views'][_0xabec('0x81')]){var _0x27dd1d=_0x13b47a['parameters'][_0xabec('0x73')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xabec('0x82')](_0x27dd1d)){_0x1e9abe=path[_0xabec('0x4d')]('plugins',_0x4d2682,_0x53bf1e[0x0],_0x27dd1d);}else{_0x1e9abe=_0x27dd1d;}}else{logger[_0xabec('0x5f')](_0xabec('0x83'));}if(_0xabec('0x23')!=typeof _0x13b47a['parameters']['views'][_0xabec('0x75')]){var _0x1f008a=_0x13b47a[_0xabec('0x71')][_0xabec('0x73')][_0xabec('0x75')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1f008a)){_0x43767e=path['join']('plugins',_0x4d2682,_0x53bf1e[0x0],_0x1f008a);}else{_0x43767e=_0x1f008a;}}else{logger[_0xabec('0x5f')](_0xabec('0x84'));}}else if(_0x2dfb90===_0xabec('0x85')){_0x51b6c3=_0x13b47a[_0xabec('0x71')][_0xabec('0x77')];_0x4c52bf=_0x13b47a[_0xabec('0x71')]['scriptPath'];if(_0xabec('0x23')!=typeof _0x13b47a[_0xabec('0x71')][_0xabec('0x73')]){if(_0xabec('0x23')!=typeof _0x13b47a['parameters']['views'][_0xabec('0x81')]){var _0x27dd1d=_0x13b47a[_0xabec('0x71')][_0xabec('0x73')][_0xabec('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xabec('0x82')](_0x27dd1d)){_0x1e9abe=path[_0xabec('0x4d')](_0xabec('0x86'),_0x4d2682,_0x53bf1e[0x0],_0x27dd1d);}else{_0x1e9abe=_0x27dd1d;}}if('undefined'!=typeof _0x13b47a[_0xabec('0x71')][_0xabec('0x73')]['agent']){var _0x1f008a=_0x13b47a['parameters'][_0xabec('0x73')][_0xabec('0x75')];if(!/^(f|ht)tps?:\/\//i[_0xabec('0x82')](_0x1f008a)){_0x43767e=path[_0xabec('0x4d')](_0xabec('0x86'),_0x4d2682,_0x53bf1e[0x0],_0x1f008a);}else{_0x43767e=_0x1f008a;}}}}var _0xf5d317={'name':_0x2023da,'description':_0x4acb1f,'path':path['join'](_0x4d2682,_0x53bf1e[0x0]),'type':_0x2dfb90,'sidebar':_0x1d35fd,'icon':_0x40f59a,'adminUrl':_0x1e9abe,'agentUrl':_0x43767e,'scriptName':_0x51b6c3,'scriptPath':_0x4c52bf,'version':_0x25cde2};removeReferences(_0x3708dd,null);return db[_0xabec('0x31')][_0xabec('0x87')](_0xf5d317)[_0xabec('0x2a')](function(_0x45373b){var _0x26eb17={'role':_0x35959d[_0xabec('0x88')][_0xabec('0x89')],'userProfileId':_0x35959d[_0xabec('0x88')][_0xabec('0x8a')]};if(!_0x26eb17)throw new Error(_0xabec('0x8b'));if(_0x26eb17[_0xabec('0x89')]==='user'){var _0x1785f7=_0x45373b[_0xabec('0x8c')]({'plain':!![]});return db[_0xabec('0x8d')][_0xabec('0x4c')]({'where':{'name':_0xabec('0x2c'),'userProfileId':_0x26eb17['userProfileId']},'raw':!![]})['then'](function(_0x24f3ca){if(_0x24f3ca&&_0x24f3ca['autoAssociation']===0x0){return db[_0xabec('0x8e')][_0xabec('0x87')]({'name':_0x1785f7[_0xabec('0x2f')],'resourceId':_0x1785f7['id'],'type':_0x24f3ca[_0xabec('0x2f')],'sectionId':_0x24f3ca['id']},{})[_0xabec('0x2a')](function(){return _0x45373b;});}else{return _0x45373b;}})[_0xabec('0x46')](function(_0x55efed){logger[_0xabec('0x2d')](_0xabec('0x8f'),_0x55efed);throw _0x55efed;});}return _0x45373b;})['then'](respondWithResult(_0x4cdc8b,null))[_0xabec('0x46')](handleError(_0x4cdc8b,null));}});}catch(_0x3de4e0){_0x4cdc8b[_0xabec('0x1e')](0x1f4)['send'](_0x3de4e0);}};function removeReferences(_0x54491d,_0x8faca5){try{if(_0x54491d){fs[_0xabec('0x90')](_0x54491d);logger['info'](_0xabec('0x91'));}if(_0x8faca5){rimraf(_0x8faca5,function(){});logger[_0xabec('0x5f')](_0xabec('0x92'));}}catch(_0x3188a0){logger[_0xabec('0x2d')](_0x3188a0);}}exports[_0xabec('0x29')]=function(_0x493994,_0x46aef8,_0x4e9ae5){return db[_0xabec('0x31')][_0xabec('0x4c')]({'where':{'id':_0x493994[_0xabec('0x48')]['id']}})[_0xabec('0x2a')](handleEntityNotFound(_0x46aef8,null))[_0xabec('0x2a')](saveUpdates(_0x493994[_0xabec('0x88')],null))[_0xabec('0x2a')](respondWithResult(_0x46aef8,null))[_0xabec('0x46')](handleError(_0x46aef8,null));};exports[_0xabec('0x93')]=function(_0x26e15e,_0x5f4c22,_0x72e8d4){return db[_0xabec('0x31')]['find']({'where':{'id':_0x26e15e[_0xabec('0x48')]['id']}})[_0xabec('0x2a')](function(_0x5c7c6){if(_0x5c7c6){return _0x5c7c6[_0xabec('0x2b')]();}})[_0xabec('0x2a')](function(_0x233ea1){rimraf(path[_0xabec('0x4d')](config['root'],_0xabec('0x4f'),path['dirname'](_0x233ea1[_0xabec('0x6')])),function(){});return _0x233ea1;})[_0xabec('0x2a')](handleEntityNotFound(_0x5f4c22,null))[_0xabec('0x2a')](respondWithStatusCode(_0x5f4c22,null))[_0xabec('0x46')](handleError(_0x5f4c22,null));};exports['webhookGet']=function(_0x23dd44,_0x118883,_0x534794){return BPromise[_0xabec('0x94')]()['then'](function(){if(!_0x23dd44['query'][_0xabec('0x6')]){throw new Error(_0xabec('0x95'));}if(!_0x23dd44[_0xabec('0x36')][_0xabec('0x96')]){throw new Error(_0xabec('0x97'));}var _0x48b115=_0x23dd44[_0xabec('0x36')][_0xabec('0x98')]?_0x23dd44['query'][_0xabec('0x98')]+':'+_0x23dd44[_0xabec('0x36')][_0xabec('0x96')]:_0xabec('0x99')+_0x23dd44[_0xabec('0x36')]['port'];var _0x51f6e3=_0x23dd44[_0xabec('0x36')][_0xabec('0x20')]?_0x23dd44[_0xabec('0x36')]['json']:!![];var _0x298126=_0x23dd44[_0xabec('0x36')][_0xabec('0x9a')]?_0x23dd44['query'][_0xabec('0x9a')]:null;var _0x3fd77e={'method':_0x23dd44[_0xabec('0x9b')],'uri':util[_0xabec('0x9c')]('%s%s',_0x48b115,_0x23dd44['query'][_0xabec('0x6')]),'json':_0x51f6e3,'resolveWithFullResponse':!![],'encoding':_0x298126,'qs':_0x23dd44[_0xabec('0x36')]};if(_0x23dd44[_0xabec('0x9d')]){_0x3fd77e[_0xabec('0x9d')]=_0x23dd44[_0xabec('0x9d')];if(_0x3fd77e[_0xabec('0x9d')]['content-length']){delete _0x3fd77e[_0xabec('0x9d')]['content-length'];}}if(_0x3fd77e[_0xabec('0x9d')][_0xabec('0x9e')]){delete _0x3fd77e[_0xabec('0x9d')][_0xabec('0x9e')];}return rp(_0x3fd77e);})[_0xabec('0x2a')](function(_0x37af48){if(_0x37af48){_0x118883[_0xabec('0x9f')](_0x37af48[_0xabec('0x9d')]);logger[_0xabec('0x5f')](_0x37af48[_0xabec('0x88')]);if(_[_0xabec('0xa0')](_0x23dd44[_0xabec('0x36')][_0xabec('0x6')],_0xabec('0x5e'))&&_0x37af48['statusCode']==0x1f4){return _0x118883[_0xabec('0x1d')](_0x37af48[_0xabec('0xa1')]);}else{return _0x118883[_0xabec('0x1e')](_0x37af48['statusCode'])[_0xabec('0x30')](_0x37af48[_0xabec('0x88')]);}}else{return _0x118883[_0xabec('0x1d')](0xc8);}})[_0xabec('0x46')](handleError(_0x118883,null));};exports[_0xabec('0xa2')]=function(_0xb5412e,_0xbfe6ff,_0x269d8c){return BPromise[_0xabec('0x94')]()[_0xabec('0x2a')](function(){if(!_0xb5412e['query'][_0xabec('0x6')]){throw new Error(_0xabec('0x95'));}if(!_0xb5412e['query'][_0xabec('0x96')]){throw new Error(_0xabec('0x97'));}var _0xa5d0af=_0xb5412e['query'][_0xabec('0x98')]?_0xb5412e[_0xabec('0x36')][_0xabec('0x98')]+':'+_0xb5412e['query'][_0xabec('0x96')]:_0xabec('0x99')+_0xb5412e[_0xabec('0x36')][_0xabec('0x96')];var _0x3a469c=_0xb5412e[_0xabec('0x36')][_0xabec('0x20')]?_0xb5412e[_0xabec('0x36')][_0xabec('0x20')]:!![];var _0x3ae9e7=_0xb5412e[_0xabec('0x36')][_0xabec('0x9a')]?_0xb5412e['query'][_0xabec('0x9a')]:null;var _0x390929={'method':_0xb5412e[_0xabec('0x9b')],'uri':util[_0xabec('0x9c')](_0xabec('0xa3'),_0xa5d0af,_0xb5412e[_0xabec('0x36')][_0xabec('0x6')]),'json':_0x3a469c,'resolveWithFullResponse':!![],'encoding':_0x3ae9e7,'body':_0xb5412e[_0xabec('0x88')]};if(_0xb5412e['headers']){_0x390929['headers']=_0xb5412e['headers'];if(_0x390929[_0xabec('0x9d')]['content-length']){delete _0x390929[_0xabec('0x9d')][_0xabec('0xa4')];}}if(_0x390929['headers'][_0xabec('0x9e')]){delete _0x390929['headers']['content-type'];}return rp(_0x390929);})[_0xabec('0x2a')](function(_0x4b875d){if(_0x4b875d){_0xbfe6ff[_0xabec('0x9f')](_0x4b875d[_0xabec('0x9d')]);logger[_0xabec('0x5f')](_0x4b875d[_0xabec('0x88')]);return _0xbfe6ff[_0xabec('0x1e')](_0x4b875d['statusCode'])[_0xabec('0x30')](_0x4b875d['body']);}else{return _0xbfe6ff[_0xabec('0x1d')](0xc8);}})[_0xabec('0x46')](handleError(_0xbfe6ff,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 12b4ea0..57c9641 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 _0x573a=['update','remove','emit','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x3c347d,_0x3b8581){var _0xedcb87=function(_0x5bef99){while(--_0x5bef99){_0x3c347d['push'](_0x3c347d['shift']());}};_0xedcb87(++_0x3b8581);}(_0x573a,0x124));var _0xa573=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0x573a[_0x5af97c];return _0x3472ae;};'use strict';var EventEmitter=require(_0xa573('0x0'));var Plugin=require(_0xa573('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0xa573('0x2')](0x0);var events={'afterCreate':_0xa573('0x3'),'afterUpdate':_0xa573('0x4'),'afterDestroy':_0xa573('0x5')};function emitEvent(_0x19bca6){return function(_0x59a1d5,_0x41fbd3,_0x4b7f7c){PluginEvents[_0xa573('0x6')](_0x19bca6+':'+_0x59a1d5['id'],_0x59a1d5);PluginEvents[_0xa573('0x6')](_0x19bca6,_0x59a1d5);_0x4b7f7c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xa573('0x7')]=PluginEvents; \ No newline at end of file +var _0x44fe=['Plugin','setMaxListeners','save','update','remove','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0x44fe,0x16f));var _0xe44f=function(_0x348d31,_0x527a69){_0x348d31=_0x348d31-0x0;var _0x2ac23d=_0x44fe[_0x348d31];return _0x2ac23d;};'use strict';var EventEmitter=require(_0xe44f('0x0'));var Plugin=require(_0xe44f('0x1'))['db'][_0xe44f('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xe44f('0x3')](0x0);var events={'afterCreate':_0xe44f('0x4'),'afterUpdate':_0xe44f('0x5'),'afterDestroy':_0xe44f('0x6')};function emitEvent(_0x3f66c9){return function(_0x1e14a5,_0x44b438,_0x2e1d0a){PluginEvents['emit'](_0x3f66c9+':'+_0x1e14a5['id'],_0x1e14a5);PluginEvents['emit'](_0x3f66c9,_0x1e14a5);_0x2e1d0a(null);};}for(var e in events){if(events[_0xe44f('0x7')](e)){var event=events[e];Plugin[_0xe44f('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index d2b5a72..4062987 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 _0xd2df=['../../config/environment','./plugin.attributes','define','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0xd2df,0x1bb));var _0xfd2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2df[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xfd2d('0x0'));var logger=require(_0xfd2d('0x1'))(_0xfd2d('0x2'));var moment=require(_0xfd2d('0x3'));var BPromise=require('bluebird');var rp=require(_0xfd2d('0x4'));var fs=require('fs');var path=require(_0xfd2d('0x5'));var rimraf=require(_0xfd2d('0x6'));var config=require(_0xfd2d('0x7'));var attributes=require(_0xfd2d('0x8'));module['exports']=function(_0x50fcff,_0x16ca7b){return _0x50fcff[_0xfd2d('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7136=['../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1a51ad,_0x167151){var _0x3ddeeb=function(_0xd1347c){while(--_0xd1347c){_0x1a51ad['push'](_0x1a51ad['shift']());}};_0x3ddeeb(++_0x167151);}(_0x7136,0x1c0));var _0x6713=function(_0xe4e303,_0x8f9657){_0xe4e303=_0xe4e303-0x0;var _0x39021e=_0x7136[_0xe4e303];return _0x39021e;};'use strict';var _=require(_0x6713('0x0'));var util=require(_0x6713('0x1'));var logger=require(_0x6713('0x2'))('api');var moment=require(_0x6713('0x3'));var BPromise=require(_0x6713('0x4'));var rp=require(_0x6713('0x5'));var fs=require('fs');var path=require(_0x6713('0x6'));var rimraf=require('rimraf');var config=require(_0x6713('0x7'));var attributes=require(_0x6713('0x8'));module[_0x6713('0x9')]=function(_0x3f588b,_0x101237){return _0x3f588b[_0x6713('0xa')](_0x6713('0xb'),attributes,{'tableName':_0x6713('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 45ab849..9c6e2e7 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 _0xd12c=['http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','Plugin,\x20%s,\x20%s','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4981ae,_0x410969){var _0x3f6f16=function(_0x15d1af){while(--_0x15d1af){_0x4981ae['push'](_0x4981ae['shift']());}};_0x3f6f16(++_0x410969);}(_0xd12c,0x64));var _0xcd12=function(_0x17876c,_0x17c9e3){_0x17876c=_0x17876c-0x0;var _0x26844b=_0xd12c[_0x17876c];return _0x26844b;};'use strict';var _=require(_0xcd12('0x0'));var util=require('util');var moment=require(_0xcd12('0x1'));var BPromise=require('bluebird');var rs=require(_0xcd12('0x2'));var fs=require('fs');var Redis=require(_0xcd12('0x3'));var db=require(_0xcd12('0x4'))['db'];var utils=require(_0xcd12('0x5'));var logger=require(_0xcd12('0x6'))(_0xcd12('0x7'));var config=require(_0xcd12('0x8'));var jayson=require(_0xcd12('0x9'));var client=jayson[_0xcd12('0xa')][_0xcd12('0xb')]({'port':0x232a});config[_0xcd12('0xc')]=_[_0xcd12('0xd')](config[_0xcd12('0xc')],{'host':_0xcd12('0xe'),'port':0x18eb});var socket=require(_0xcd12('0xf'))(new Redis(config['redis']));require(_0xcd12('0x10'))[_0xcd12('0x11')](socket);function respondWithRpcPromise(_0x1002a9,_0x561293,_0x9fb601){return new BPromise(function(_0x3310af,_0x4e6c8f){return client[_0xcd12('0x12')](_0x1002a9,_0x9fb601)[_0xcd12('0x13')](function(_0x3b5c9b){logger[_0xcd12('0x14')]('Plugin,\x20%s,\x20%s',_0x561293,_0xcd12('0x15'));logger[_0xcd12('0x16')](_0xcd12('0x17'),_0x561293,_0xcd12('0x15'),JSON[_0xcd12('0x18')](_0x3b5c9b));if(_0x3b5c9b[_0xcd12('0x19')]){if(_0x3b5c9b[_0xcd12('0x19')][_0xcd12('0x1a')]===0x1f4){logger['error'](_0xcd12('0x1b'),_0x561293,_0x3b5c9b['error']['message']);return _0x4e6c8f(_0x3b5c9b['error']['message']);}logger[_0xcd12('0x19')](_0xcd12('0x1b'),_0x561293,_0x3b5c9b[_0xcd12('0x19')]['message']);return _0x3310af(_0x3b5c9b['error'][_0xcd12('0x1c')]);}else{logger[_0xcd12('0x14')](_0xcd12('0x1b'),_0x561293,_0xcd12('0x15'));_0x3310af(_0x3b5c9b[_0xcd12('0x1d')]['message']);}})[_0xcd12('0x1e')](function(_0x17d0e9){logger[_0xcd12('0x19')]('Plugin,\x20%s,\x20%s',_0x561293,_0x17d0e9);_0x4e6c8f(_0x17d0e9);});});}exports[_0xcd12('0x1f')]=function(_0x742e67){var _0x47f32e=this;return new Promise(function(_0x200a27,_0x3ba9a2){return db[_0xcd12('0x20')][_0xcd12('0x21')](_0x742e67[_0xcd12('0x22')],{'raw':_0x742e67['options']?_0x742e67[_0xcd12('0x23')][_0xcd12('0x24')]===undefined?!![]:![]:!![]})[_0xcd12('0x13')](function(_0x580427){logger[_0xcd12('0x14')](_0xcd12('0x1f'),_0x742e67);logger[_0xcd12('0x16')]('CreatePlugin',_0x742e67,JSON[_0xcd12('0x18')](_0x580427));_0x200a27(_0x580427);})[_0xcd12('0x1e')](function(_0x34a818){logger[_0xcd12('0x19')](_0xcd12('0x1f'),_0x34a818[_0xcd12('0x1c')],_0x742e67);_0x3ba9a2(_0x47f32e['error'](0x1f4,_0x34a818[_0xcd12('0x1c')]));});});}; \ No newline at end of file +var _0xea17=['catch','CreatePlugin','Plugin','create','options','raw','debug','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./plugin.socket','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x5460aa,_0x48b3c3){var _0x66394d=function(_0x133e60){while(--_0x133e60){_0x5460aa['push'](_0x5460aa['shift']());}};_0x66394d(++_0x48b3c3);}(_0xea17,0xa3));var _0x7ea1=function(_0x1a9c78,_0x14718c){_0x1a9c78=_0x1a9c78-0x0;var _0x516254=_0xea17[_0x1a9c78];return _0x516254;};'use strict';var _=require(_0x7ea1('0x0'));var util=require(_0x7ea1('0x1'));var moment=require(_0x7ea1('0x2'));var BPromise=require(_0x7ea1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7ea1('0x4'))['db'];var utils=require(_0x7ea1('0x5'));var logger=require(_0x7ea1('0x6'))('rpc');var config=require(_0x7ea1('0x7'));var jayson=require(_0x7ea1('0x8'));var client=jayson[_0x7ea1('0x9')][_0x7ea1('0xa')]({'port':0x232a});config[_0x7ea1('0xb')]=_[_0x7ea1('0xc')](config[_0x7ea1('0xb')],{'host':_0x7ea1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ea1('0xb')]));require(_0x7ea1('0xe'))['register'](socket);function respondWithRpcPromise(_0x3c6d86,_0x50752a,_0xb613e0){return new BPromise(function(_0x2d2e33,_0x58b84c){return client['request'](_0x3c6d86,_0xb613e0)[_0x7ea1('0xf')](function(_0x4df17b){logger[_0x7ea1('0x10')](_0x7ea1('0x11'),_0x50752a,_0x7ea1('0x12'));logger['debug'](_0x7ea1('0x13'),_0x50752a,_0x7ea1('0x12'),JSON['stringify'](_0x4df17b));if(_0x4df17b[_0x7ea1('0x14')]){if(_0x4df17b[_0x7ea1('0x14')]['code']===0x1f4){logger[_0x7ea1('0x14')](_0x7ea1('0x11'),_0x50752a,_0x4df17b['error'][_0x7ea1('0x15')]);return _0x58b84c(_0x4df17b[_0x7ea1('0x14')][_0x7ea1('0x15')]);}logger[_0x7ea1('0x14')](_0x7ea1('0x11'),_0x50752a,_0x4df17b['error'][_0x7ea1('0x15')]);return _0x2d2e33(_0x4df17b[_0x7ea1('0x14')][_0x7ea1('0x15')]);}else{logger[_0x7ea1('0x10')]('Plugin,\x20%s,\x20%s',_0x50752a,'request\x20sent');_0x2d2e33(_0x4df17b[_0x7ea1('0x16')][_0x7ea1('0x15')]);}})[_0x7ea1('0x17')](function(_0x3a2846){logger[_0x7ea1('0x14')](_0x7ea1('0x11'),_0x50752a,_0x3a2846);_0x58b84c(_0x3a2846);});});}exports[_0x7ea1('0x18')]=function(_0x2d8b21){var _0xc89626=this;return new Promise(function(_0x41f2f7,_0x2b8173){return db[_0x7ea1('0x19')][_0x7ea1('0x1a')](_0x2d8b21['body'],{'raw':_0x2d8b21[_0x7ea1('0x1b')]?_0x2d8b21[_0x7ea1('0x1b')][_0x7ea1('0x1c')]===undefined?!![]:![]:!![]})[_0x7ea1('0xf')](function(_0x241beb){logger[_0x7ea1('0x10')](_0x7ea1('0x18'),_0x2d8b21);logger[_0x7ea1('0x1d')]('CreatePlugin',_0x2d8b21,JSON[_0x7ea1('0x1e')](_0x241beb));_0x41f2f7(_0x241beb);})[_0x7ea1('0x17')](function(_0x39c460){logger['error'](_0x7ea1('0x18'),_0x39c460[_0x7ea1('0x15')],_0x2d8b21);_0x2b8173(_0xc89626[_0x7ea1('0x14')](0x1f4,_0x39c460[_0x7ea1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 3410345..11cd0c9 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 _0x668e=['./plugin.events','remove','update','removeListener','register','length','plugin:'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x668e,0x13b));var _0xe668=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x668e[_0x2235bf];return _0x4c3a64;};'use strict';var PluginEvents=require(_0xe668('0x0'));var events=['save',_0xe668('0x1'),_0xe668('0x2')];function createListener(_0x2a8302,_0x529a34){return function(_0x10f970){_0x529a34['emit'](_0x2a8302,_0x10f970);};}function removeListener(_0x14b1ae,_0x5b8129){return function(){PluginEvents[_0xe668('0x3')](_0x14b1ae,_0x5b8129);};}exports[_0xe668('0x4')]=function(_0x4fffca){for(var _0x5bf2e2=0x0,_0x28c9b9=events[_0xe668('0x5')];_0x5bf2e2<_0x28c9b9;_0x5bf2e2++){var _0x2e86e6=events[_0x5bf2e2];var _0x47963e=createListener(_0xe668('0x6')+_0x2e86e6,_0x4fffca);PluginEvents['on'](_0x2e86e6,_0x47963e);}}; \ No newline at end of file +var _0x5d2e=['removeListener','plugin:','remove','update','emit'];(function(_0x30a6d6,_0x603c35){var _0x361ea1=function(_0x4d35a7){while(--_0x4d35a7){_0x30a6d6['push'](_0x30a6d6['shift']());}};_0x361ea1(++_0x603c35);}(_0x5d2e,0x1b5));var _0xe5d2=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x5d2e[_0x2064e5];return _0x21a233;};'use strict';var PluginEvents=require('./plugin.events');var events=['save',_0xe5d2('0x0'),_0xe5d2('0x1')];function createListener(_0x4c6ddd,_0x4af7d8){return function(_0x5b604e){_0x4af7d8[_0xe5d2('0x2')](_0x4c6ddd,_0x5b604e);};}function removeListener(_0x177530,_0x3a73d9){return function(){PluginEvents[_0xe5d2('0x3')](_0x177530,_0x3a73d9);};}exports['register']=function(_0x475e49){for(var _0x29e79c=0x0,_0xb1906b=events['length'];_0x29e79c<_0xb1906b;_0x29e79c++){var _0x237d9f=events[_0x29e79c];var _0x495a9f=createListener(_0xe5d2('0x4')+_0x237d9f,_0x475e49);PluginEvents['on'](_0x237d9f,_0x495a9f);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index a8aa4ce..ab730fc 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(_0x2282ef,_0x2a64b1){var _0x30488c=function(_0x1aaacc){while(--_0x1aaacc){_0x2282ef['push'](_0x2282ef['shift']());}};_0x30488c(++_0x2a64b1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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(_0x390167,_0x4e9864){var _0x456beb=function(_0x20b52e){while(--_0x20b52e){_0x390167['push'](_0x390167['shift']());}};_0x456beb(++_0x4e9864);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 81e3517..5be9230 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 _0xca66=['reject','motion2','length','catch','show','describe','params','create','body','join','../../files/plugins','script','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','Unknown\x20status','destroy','lodash','api','path','child_process','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','then'];(function(_0x1bc762,_0x523eb3){var _0x40f70c=function(_0x3c206e){while(--_0x3c206e){_0x1bc762['push'](_0x1bc762['shift']());}};_0x40f70c(++_0x523eb3);}(_0xca66,0x8b));var _0x6ca6=function(_0x5ba8c7,_0x2e1bde){_0x5ba8c7=_0x5ba8c7-0x0;var _0x458457=_0xca66[_0x5ba8c7];return _0x458457;};'use strict';var _=require(_0x6ca6('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x6ca6('0x1'));var path=require(_0x6ca6('0x2'));var exec=require(_0x6ca6('0x3'))['exec'];var BPromise=require(_0x6ca6('0x4'));function handleEntityNotFound(_0x4b1a10,_0x3ab489){return function(_0x5569aa){if(!_0x5569aa){_0x4b1a10[_0x6ca6('0x5')](0x194);;}return _0x5569aa;};}function respondWithResult(_0x27d8c6,_0x34836f){_0x34836f=_0x34836f||0xc8;return function(_0x44019c){if(_0x44019c){return _0x27d8c6[_0x6ca6('0x6')](_0x34836f)[_0x6ca6('0x7')](_0x44019c);}return null;};}function handleError(_0x27d280,_0x4f5651){_0x4f5651=_0x4f5651||0x1f4;return function(_0xf69e0f){logger[_0x6ca6('0x8')](_0xf69e0f[_0x6ca6('0x9')]);if(_0xf69e0f[_0x6ca6('0xa')]){delete _0xf69e0f[_0x6ca6('0xa')];}_0x27d280[_0x6ca6('0x6')](_0x4f5651)[_0x6ca6('0xb')](_0xf69e0f);};}function execChildProcess(){return new BPromise(function(_0x55a626,_0x38678e){exec(_0x6ca6('0xc'),function(_0x25d276,_0x46b795,_0x444243){logger[_0x6ca6('0xd')](_0x46b795);logger['info'](_0x444243);if(_0x25d276){logger[_0x6ca6('0x8')](_0x25d276);return _0x38678e(_0x25d276);}return _0x55a626(_0x46b795);});});}exports[_0x6ca6('0xe')]=function(_0x55238b,_0x412986){return pm2[_0x6ca6('0xf')]()[_0x6ca6('0x10')](function(_0x3570f1){if(_0x3570f1){var _0xc774c=_[_0x6ca6('0x11')](_0x3570f1,function(_0x4c053a){return _0x4c053a['name']==='express'||_0x4c053a[_0x6ca6('0xa')]===_0x6ca6('0x12');});return{'rows':_0xc774c,'count':_0xc774c[_0x6ca6('0x13')]};}return null;})[_0x6ca6('0x10')](respondWithResult(_0x412986,null))[_0x6ca6('0x14')](handleError(_0x412986,null));};exports[_0x6ca6('0x15')]=function(_0x25dc6c,_0x4f056d){return pm2[_0x6ca6('0x16')](_0x25dc6c[_0x6ca6('0x17')]['id'])[_0x6ca6('0x10')](respondWithResult(_0x4f056d,null))[_0x6ca6('0x10')](handleEntityNotFound(_0x4f056d,null))[_0x6ca6('0x14')](handleError(_0x4f056d,null));};exports[_0x6ca6('0x18')]=function(_0x16a3d7,_0x251072){if(_0x16a3d7[_0x6ca6('0x19')][_0x6ca6('0xa')]&&_0x16a3d7[_0x6ca6('0x19')]['script']){var _0x28a982=path[_0x6ca6('0x1a')](__dirname,_0x6ca6('0x1b'),_0x16a3d7[_0x6ca6('0x19')][_0x6ca6('0x1c')]);var _0x438694=process['cwd']();process[_0x6ca6('0x1d')](path[_0x6ca6('0x1e')](_0x28a982));return execChildProcess()['then'](function(_0x4927c1){process[_0x6ca6('0x1d')](_0x438694);return pm2[_0x6ca6('0x1f')]({'name':_0x16a3d7[_0x6ca6('0x19')][_0x6ca6('0xa')],'script':_0x28a982});})[_0x6ca6('0x10')](function(_0x541122){pm2[_0x6ca6('0x20')]();return _0x541122[0x0];})[_0x6ca6('0x10')](respondWithResult(_0x251072,0xc9))[_0x6ca6('0x14')](handleError(_0x251072,null));}else{return _0x251072[_0x6ca6('0x6')](0x1f4)[_0x6ca6('0xb')]({'message':_0x6ca6('0x21')});}};exports[_0x6ca6('0x22')]=function(_0x2a1e2d,_0x516daf){if(_0x2a1e2d['body']['id']){delete _0x2a1e2d[_0x6ca6('0x19')]['id'];}var _0x9467bd={'online':_0x6ca6('0x23'),'stopped':_0x6ca6('0x24')};if(_0x9467bd['hasOwnProperty'](_0x2a1e2d['body'][_0x6ca6('0x6')])){return pm2[_0x9467bd[_0x2a1e2d['body']['status']]](_0x2a1e2d[_0x6ca6('0x17')]['id'])[_0x6ca6('0x10')](respondWithResult(_0x516daf,0xc8))['catch'](handleError(_0x516daf,null));}else{return _0x516daf[_0x6ca6('0x6')](0x1f4)[_0x6ca6('0xb')]({'message':_0x6ca6('0x25')});}};exports[_0x6ca6('0x26')]=function(_0x484411,_0x28af50){if(_0x484411[_0x6ca6('0x19')]['id']){delete _0x484411[_0x6ca6('0x19')]['id'];}if(_0x484411[_0x6ca6('0x17')]['id']){return pm2['delete'](_0x484411[_0x6ca6('0x17')]['id'])[_0x6ca6('0x10')](function(_0x3c4af8){pm2[_0x6ca6('0x20')]();return _0x3c4af8[0x0];})['then'](respondWithResult(_0x28af50,null))['catch'](handleError(_0x28af50,null));}else{return _0x28af50['status'](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x7072=['update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','sendStatus','status','json','name','send','npm\x20install','info','error','list','then','reject','express','length','catch','show','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump'];(function(_0x39ef71,_0x185671){var _0x2b3da5=function(_0x593244){while(--_0x593244){_0x39ef71['push'](_0x39ef71['shift']());}};_0x2b3da5(++_0x185671);}(_0x7072,0x138));var _0x2707=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x7072[_0x28aea5];return _0x6a55f9;};'use strict';var _=require('lodash');var pm2=require(_0x2707('0x0'));var logger=require(_0x2707('0x1'))(_0x2707('0x2'));var path=require(_0x2707('0x3'));var exec=require(_0x2707('0x4'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0xfdfa7a,_0x5f3c1c){return function(_0xd36287){if(!_0xd36287){_0xfdfa7a[_0x2707('0x5')](0x194);;}return _0xd36287;};}function respondWithResult(_0x1e86f2,_0x194132){_0x194132=_0x194132||0xc8;return function(_0x2fd8ff){if(_0x2fd8ff){return _0x1e86f2[_0x2707('0x6')](_0x194132)[_0x2707('0x7')](_0x2fd8ff);}return null;};}function handleError(_0x745cfd,_0x4062b6){_0x4062b6=_0x4062b6||0x1f4;return function(_0x2820ef){logger['error'](_0x2820ef['stack']);if(_0x2820ef[_0x2707('0x8')]){delete _0x2820ef[_0x2707('0x8')];}_0x745cfd[_0x2707('0x6')](_0x4062b6)[_0x2707('0x9')](_0x2820ef);};}function execChildProcess(){return new BPromise(function(_0x30090e,_0x2e1a46){exec(_0x2707('0xa'),function(_0x19881c,_0x115535,_0x478717){logger[_0x2707('0xb')](_0x115535);logger[_0x2707('0xb')](_0x478717);if(_0x19881c){logger[_0x2707('0xc')](_0x19881c);return _0x2e1a46(_0x19881c);}return _0x30090e(_0x115535);});});}exports['index']=function(_0x44c1d7,_0x590152){return pm2[_0x2707('0xd')]()[_0x2707('0xe')](function(_0xfe975c){if(_0xfe975c){var _0x3a67f2=_[_0x2707('0xf')](_0xfe975c,function(_0x4e52a3){return _0x4e52a3[_0x2707('0x8')]===_0x2707('0x10')||_0x4e52a3[_0x2707('0x8')]==='motion2';});return{'rows':_0x3a67f2,'count':_0x3a67f2[_0x2707('0x11')]};}return null;})[_0x2707('0xe')](respondWithResult(_0x590152,null))[_0x2707('0x12')](handleError(_0x590152,null));};exports[_0x2707('0x13')]=function(_0x7ed037,_0x27a3ea){return pm2['describe'](_0x7ed037[_0x2707('0x14')]['id'])[_0x2707('0xe')](respondWithResult(_0x27a3ea,null))[_0x2707('0xe')](handleEntityNotFound(_0x27a3ea,null))['catch'](handleError(_0x27a3ea,null));};exports['create']=function(_0x58a4ee,_0x1da4a6){if(_0x58a4ee[_0x2707('0x15')][_0x2707('0x8')]&&_0x58a4ee[_0x2707('0x15')][_0x2707('0x16')]){var _0x3c2935=path[_0x2707('0x17')](__dirname,_0x2707('0x18'),_0x58a4ee[_0x2707('0x15')][_0x2707('0x16')]);var _0x37c475=process[_0x2707('0x19')]();process[_0x2707('0x1a')](path[_0x2707('0x1b')](_0x3c2935));return execChildProcess()['then'](function(_0x1acf22){process[_0x2707('0x1a')](_0x37c475);return pm2[_0x2707('0x1c')]({'name':_0x58a4ee[_0x2707('0x15')][_0x2707('0x8')],'script':_0x3c2935});})[_0x2707('0xe')](function(_0x4831ed){pm2[_0x2707('0x1d')]();return _0x4831ed[0x0];})[_0x2707('0xe')](respondWithResult(_0x1da4a6,0xc9))[_0x2707('0x12')](handleError(_0x1da4a6,null));}else{return _0x1da4a6[_0x2707('0x6')](0x1f4)[_0x2707('0x9')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x2707('0x1e')]=function(_0x4ca05d,_0x29dad2){if(_0x4ca05d[_0x2707('0x15')]['id']){delete _0x4ca05d[_0x2707('0x15')]['id'];}var _0x57da26={'online':_0x2707('0x1f'),'stopped':_0x2707('0x20')};if(_0x57da26[_0x2707('0x21')](_0x4ca05d['body'][_0x2707('0x6')])){return pm2[_0x57da26[_0x4ca05d[_0x2707('0x15')]['status']]](_0x4ca05d[_0x2707('0x14')]['id'])['then'](respondWithResult(_0x29dad2,0xc8))['catch'](handleError(_0x29dad2,null));}else{return _0x29dad2[_0x2707('0x6')](0x1f4)['send']({'message':_0x2707('0x22')});}};exports[_0x2707('0x23')]=function(_0x417a97,_0x36b2e9){if(_0x417a97['body']['id']){delete _0x417a97[_0x2707('0x15')]['id'];}if(_0x417a97[_0x2707('0x14')]['id']){return pm2[_0x2707('0x24')](_0x417a97[_0x2707('0x14')]['id'])[_0x2707('0xe')](function(_0x341e14){pm2[_0x2707('0x1d')]();return _0x341e14[0x0];})[_0x2707('0xe')](respondWithResult(_0x36b2e9,null))[_0x2707('0x12')](handleError(_0x36b2e9,null));}else{return _0x36b2e9['status'](0x1f4)[_0x2707('0x9')]({'message':_0x2707('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 3975155..4f6a1b8 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 _0x1a05=['isAuthenticated','getQueues','exports','express','Router','./realtime.controller','get','/queues'];(function(_0x3209f5,_0xa3d262){var _0x1d2bda=function(_0x3858c1){while(--_0x3858c1){_0x3209f5['push'](_0x3209f5['shift']());}};_0x1d2bda(++_0xa3d262);}(_0x1a05,0x153));var _0x51a0=function(_0x50b3e5,_0x25032f){_0x50b3e5=_0x50b3e5-0x0;var _0x3b3f7a=_0x1a05[_0x50b3e5];return _0x3b3f7a;};'use strict';var express=require(_0x51a0('0x0'));var router=express[_0x51a0('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x51a0('0x2'));router[_0x51a0('0x3')](_0x51a0('0x4'),auth[_0x51a0('0x5')](),controller[_0x51a0('0x6')]);module[_0x51a0('0x7')]=router; \ No newline at end of file +var _0x6eaa=['/queues','isAuthenticated','getQueues','../../components/auth/service','get'];(function(_0x2a4f5c,_0x2ba60d){var _0x4a25ca=function(_0x8007bc){while(--_0x8007bc){_0x2a4f5c['push'](_0x2a4f5c['shift']());}};_0x4a25ca(++_0x2ba60d);}(_0x6eaa,0x1ed));var _0xa6ea=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0x6eaa[_0x5a2d3f];return _0x5c65d8;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xa6ea('0x0'));var controller=require('./realtime.controller');router[_0xa6ea('0x1')](_0xa6ea('0x2'),auth[_0xa6ea('0x3')](),controller[_0xa6ea('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 21b8fe9..6a911f0 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 _0xa6b0=['limit','count','status','set','Content-Range','json','error','name','send','getQueues','mail','chat','sms','fax','whatsapp','resolve','then','query','includes','toLowerCase','Invalid\x20channel','startCase','map','rawAttributes','fieldName','key','getOptions','user','userProfileId','voice','type','outbound','QueueCampaigns','Queues','getResources','findAndCountAll','request','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','available','waiting','talking','paused','pTalking','originated','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','get','loggedInDb','loggedIn','agents','find','merge','pick','length','push','User','Queue','Pause','findAll','QueueId','online','UserId','agent','all','catch','util','lodash','../../config/logger','api','../../mysqldb','http','client','offset','undefined'];(function(_0x212fcc,_0x1a8867){var _0x4d8190=function(_0x347f7b){while(--_0x347f7b){_0x212fcc['push'](_0x212fcc['shift']());}};_0x4d8190(++_0x1a8867);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x3f65fa,_0x4cee1f){_0x3f65fa=_0x3f65fa-0x0;var _0x44b58b=_0xa6b0[_0x3f65fa];return _0x44b58b;};'use strict';var util=require(_0x0a6b('0x0'));var _=require(_0x0a6b('0x1'));var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require(_0x0a6b('0x2'))(_0x0a6b('0x3'));var db=require(_0x0a6b('0x4'))['db'];var client=jayson['client'][_0x0a6b('0x5')]({'port':0x232a});var routingClient=jayson[_0x0a6b('0x6')][_0x0a6b('0x5')]({'port':0x232c});function respondWithFilteredResult(_0xc7140c,_0x3dc2b0){return function(_0x3b6967){if(_0x3b6967){var _0x1b5fb5=typeof _0x3dc2b0[_0x0a6b('0x7')]===_0x0a6b('0x8')&&typeof _0x3dc2b0[_0x0a6b('0x9')]===_0x0a6b('0x8');var _0xdcc3e5=_0x3b6967['count'];var _0x493948=_0x1b5fb5?0x0:_0x3dc2b0[_0x0a6b('0x7')];var _0x100da8=_0x1b5fb5?_0x3b6967[_0x0a6b('0xa')]:_0x3dc2b0[_0x0a6b('0x7')]+_0x3dc2b0[_0x0a6b('0x9')];var _0xe681c9;if(_0x100da8>=_0xdcc3e5){_0x100da8=_0xdcc3e5;_0xe681c9=0xc8;}else{_0xe681c9=0xce;}_0xc7140c[_0x0a6b('0xb')](_0xe681c9);return _0xc7140c[_0x0a6b('0xc')](_0x0a6b('0xd'),_0x493948+'-'+_0x100da8+'/'+_0xdcc3e5)[_0x0a6b('0xe')](_0x3b6967);}return null;};}function handleError(_0x391fe6,_0x890493){_0x890493=_0x890493||0x1f4;return function(_0x244a7d){logger[_0x0a6b('0xf')](_0x244a7d['stack']);if(_0x244a7d['name']){delete _0x244a7d[_0x0a6b('0x10')];}_0x391fe6[_0x0a6b('0xb')](_0x890493)[_0x0a6b('0x11')](_0x244a7d);};}exports[_0x0a6b('0x12')]=function(_0x8bbc03,_0x45fc9f){var _0x9bb98e=[_0x0a6b('0x13'),_0x0a6b('0x14'),_0x0a6b('0x15'),'openchannel',_0x0a6b('0x16'),_0x0a6b('0x17'),'voice'];var _0x290f7f={'count':0x0,'rows':[]},_0x4d0e3b={},_0xcb412;Promise[_0x0a6b('0x18')]()[_0x0a6b('0x19')](function(){if(_0x8bbc03[_0x0a6b('0x1a')]['channel']){if(!_[_0x0a6b('0x1b')](_0x9bb98e,_0x8bbc03[_0x0a6b('0x1a')]['channel'][_0x0a6b('0x1c')]()))throw new Error(_0x0a6b('0x1d'));_0xcb412=_0x8bbc03[_0x0a6b('0x1a')]['channel'][_0x0a6b('0x1c')]();}var _0x93a465=_[_0x0a6b('0x1e')](_0xcb412)+'Queue';var _0x220d3e=_[_0x0a6b('0x1f')](db[_0x93a465][_0x0a6b('0x20')],function(_0x5e8206){return{'name':_0x5e8206[_0x0a6b('0x21')],'type':_0x5e8206['type'][_0x0a6b('0x22')]};});_0x4d0e3b=qs[_0x0a6b('0x23')](_0x220d3e,_0x8bbc03);if(_0x8bbc03[_0x0a6b('0x24')]['role']===_0x0a6b('0x24')){var _0x2e58fd={'params':{'id':_0x8bbc03[_0x0a6b('0x24')][_0x0a6b('0x25')]},'query':{'section':_0xcb412===_0x0a6b('0x26')&&_0x8bbc03['query'][_0x0a6b('0x27')]===_0x0a6b('0x28')?_0x0a6b('0x29'):_['startCase'](_0xcb412)+_0x0a6b('0x2a'),'type':_0x8bbc03['query'][_0x0a6b('0x27')],'nolimit':!![],'sort':_0x0a6b('0x10'),'filter':_0x8bbc03[_0x0a6b('0x1a')]['filter']}};return db['UserProfile'][_0x0a6b('0x2b')](_0x2e58fd);}return db[_0x93a465][_0x0a6b('0x2c')](_0x4d0e3b);})[_0x0a6b('0x19')](function(_0x3d649e){_0x290f7f[_0x0a6b('0xa')]=_0x3d649e[_0x0a6b('0xa')];var _0x486f0d=_0xcb412===_0x0a6b('0x26')?client:routingClient;return _0x486f0d[_0x0a6b('0x2d')](_['startCase'](_0xcb412)+_0x0a6b('0x2a'),_0x8bbc03)['then'](function(_0x4eb516){if(_0x4eb516[_0x0a6b('0xf')])throw new Error(util[_0x0a6b('0x2e')](_0x0a6b('0x2f'),_0xcb412));var _0x10dad1=_0x4eb516[_0x0a6b('0x30')];var _0x55cbd3=['loggedIn',_0x0a6b('0x31'),_0x0a6b('0x32'),_0x0a6b('0x33'),_0x0a6b('0x34')];if(_0xcb412==='voice'&&_0x8bbc03[_0x0a6b('0x1a')][_0x0a6b('0x27')]==='outbound'){_0x55cbd3['push'](_0x0a6b('0x35'),_0x0a6b('0x36'),'message',_0x0a6b('0x37'),_0x0a6b('0x38'),_0x0a6b('0x39'),_0x0a6b('0x3a'),_0x0a6b('0x3b'),_0x0a6b('0x3c'),_0x0a6b('0x3d'),_0x0a6b('0x3e'),_0x0a6b('0x3f'),_0x0a6b('0x40'),_0x0a6b('0x41'),_0x0a6b('0x42'),'predictiveIntervalAvailable',_0x0a6b('0x43'),_0x0a6b('0x44'),'predictiveIntervalDroppedCallsTimeout',_0x0a6b('0x45'),_0x0a6b('0x46'),_0x0a6b('0x47'));}var _0x10981f=_0x3d649e[_0x0a6b('0x48')][_0x0a6b('0x1f')](function(_0x28bc13){var _0x3f1be6=_0x28bc13[_0x0a6b('0x49')]({'plain':!![]});_0x3f1be6['paused']=0x0;_0x3f1be6[_0x0a6b('0x4a')]=0x0;_0x3f1be6[_0x0a6b('0x4b')]=0x0;_0x3f1be6[_0x0a6b('0x31')]=0x0;_0x3f1be6[_0x0a6b('0x34')]=0x0;_0x3f1be6[_0x0a6b('0x32')]=0x0;if(_0xcb412===_0x0a6b('0x26')){_0x3f1be6[_0x0a6b('0x33')]=0x0;if(_0x8bbc03[_0x0a6b('0x1a')][_0x0a6b('0x27')]==='outbound'){_0x3f1be6[_0x0a6b('0x35')]=0x0;_0x3f1be6[_0x0a6b('0x36')]=0x0;}}_0x3f1be6[_0x0a6b('0x4c')]=[];var _0x39df98=_[_0x0a6b('0x4d')](_0x10dad1[_0x0a6b('0x48')],['id',_0x3f1be6['id']]);if(_0x39df98)_[_0x0a6b('0x4e')](_0x3f1be6,_[_0x0a6b('0x4f')](_0x39df98,_0x55cbd3));if(_0xcb412===_0x0a6b('0x26')){return _0x28bc13['getAgents']({'attributes':['id',_0x0a6b('0x10'),'online'],'joinTableAttributes':[],'raw':!![]})['then'](function(_0xb7a7d8){return _0x28bc13['getMembers']({'raw':!![]})['then'](function(_0x2f1221){for(var _0x1f756d=0x0;_0x1f756d<_0xb7a7d8[_0x0a6b('0x50')];_0x1f756d++){var _0x4fdfeb=_[_0x0a6b('0x4d')](_0x2f1221,['UserId',_0xb7a7d8[_0x1f756d]['id']]);var _0x531f94={'id':_0xb7a7d8[_0x1f756d]['id'],'name':_0xb7a7d8[_0x1f756d][_0x0a6b('0x10')],'online':Boolean(_0xb7a7d8[_0x1f756d]['online']),'paused':_0x4fdfeb?Boolean(_0x4fdfeb[_0x0a6b('0x34')]):![]};if(_0x531f94['online'])_0x3f1be6[_0x0a6b('0x4a')]++;if(_0x531f94['paused'])_0x3f1be6['paused']++;_0x3f1be6[_0x0a6b('0x4c')][_0x0a6b('0x51')](_0x531f94);}return _0x3f1be6;});});}else{var _0x2b937c=_0x0a6b('0x52')+_['startCase'](_0xcb412)+_0x0a6b('0x53');var _0xf92e0f=_0xcb412+_0x0a6b('0x54');return db[_0x2b937c][_0x0a6b('0x55')]({'where':{[_[_0x0a6b('0x1e')](_0xcb412)+_0x0a6b('0x56')]:_0x28bc13['id']},'raw':!![]})[_0x0a6b('0x19')](function(_0x5f373b){return db[_0x0a6b('0x52')][_0x0a6b('0x55')]({'attributes':['id',_0x0a6b('0x10'),_0x0a6b('0x57'),_0xf92e0f],'where':{'id':_[_0x0a6b('0x1f')](_0x5f373b,_0x0a6b('0x58')),'role':_0x0a6b('0x59')},'raw':!![]});})[_0x0a6b('0x19')](function(_0xa20567){for(var _0x5ab75f=0x0;_0x5ab75f<_0xa20567[_0x0a6b('0x50')];_0x5ab75f++){var _0x12953b={'id':_0xa20567[_0x5ab75f]['id'],'name':_0xa20567[_0x5ab75f][_0x0a6b('0x10')],'online':Boolean(_0xa20567[_0x5ab75f][_0x0a6b('0x57')]),'paused':Boolean(_0xa20567[_0x5ab75f][_0xf92e0f])};if(_0x12953b[_0x0a6b('0x57')])_0x3f1be6[_0x0a6b('0x4a')]++;if(_0x12953b[_0x0a6b('0x34')])_0x3f1be6['paused']++;_0x3f1be6['agents'][_0x0a6b('0x51')](_0x12953b);}return _0x3f1be6;});}});return Promise[_0x0a6b('0x5a')](_0x10981f);});})[_0x0a6b('0x19')](function(_0x46352e){_0x290f7f[_0x0a6b('0x48')]=_0x46352e;return _0x290f7f;})[_0x0a6b('0x19')](respondWithFilteredResult(_0x45fc9f,_0x4d0e3b))[_0x0a6b('0x5b')](handleError(_0x45fc9f,null));}; \ No newline at end of file +var _0xb016=['limit','count','offset','status','set','json','stack','name','chat','sms','openchannel','fax','whatsapp','voice','resolve','then','channel','includes','query','toLowerCase','Invalid\x20channel','startCase','Queue','map','rawAttributes','type','key','getOptions','role','user','userProfileId','outbound','QueueCampaigns','Queues','filter','UserProfile','getResources','request','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','available','waiting','talking','push','pTalking','message','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','rows','get','paused','loggedInDb','originated','find','merge','pick','getAgents','online','getMembers','length','UserId','agents','User','findAll','QueueId','agent','util','lodash','../../config/logger','../../mysqldb','client','http','undefined'];(function(_0xd0e7ae,_0x2d3247){var _0x4be420=function(_0x4522f5){while(--_0x4522f5){_0xd0e7ae['push'](_0xd0e7ae['shift']());}};_0x4be420(++_0x2d3247);}(_0xb016,0x159));var _0x6b01=function(_0x29f94c,_0x503618){_0x29f94c=_0x29f94c-0x0;var _0x3d2791=_0xb016[_0x29f94c];return _0x3d2791;};'use strict';var util=require(_0x6b01('0x0'));var _=require(_0x6b01('0x1'));var jayson=require('jayson/promise');var qs=require('../../components/parsers/qs');var logger=require(_0x6b01('0x2'))('api');var db=require(_0x6b01('0x3'))['db'];var client=jayson[_0x6b01('0x4')][_0x6b01('0x5')]({'port':0x232a});var routingClient=jayson[_0x6b01('0x4')]['http']({'port':0x232c});function respondWithFilteredResult(_0x1b7dd6,_0x65407a){return function(_0x192b2d){if(_0x192b2d){var _0x5759a1=typeof _0x65407a['offset']===_0x6b01('0x6')&&typeof _0x65407a[_0x6b01('0x7')]==='undefined';var _0x5f4636=_0x192b2d[_0x6b01('0x8')];var _0x1cb3a6=_0x5759a1?0x0:_0x65407a[_0x6b01('0x9')];var _0x242394=_0x5759a1?_0x192b2d[_0x6b01('0x8')]:_0x65407a['offset']+_0x65407a['limit'];var _0x4627ef;if(_0x242394>=_0x5f4636){_0x242394=_0x5f4636;_0x4627ef=0xc8;}else{_0x4627ef=0xce;}_0x1b7dd6[_0x6b01('0xa')](_0x4627ef);return _0x1b7dd6[_0x6b01('0xb')]('Content-Range',_0x1cb3a6+'-'+_0x242394+'/'+_0x5f4636)[_0x6b01('0xc')](_0x192b2d);}return null;};}function handleError(_0x5c54e4,_0x51f976){_0x51f976=_0x51f976||0x1f4;return function(_0x26f2a0){logger['error'](_0x26f2a0[_0x6b01('0xd')]);if(_0x26f2a0[_0x6b01('0xe')]){delete _0x26f2a0['name'];}_0x5c54e4[_0x6b01('0xa')](_0x51f976)['send'](_0x26f2a0);};}exports['getQueues']=function(_0x51b3cf,_0x3d4666){var _0x4cbd38=['mail',_0x6b01('0xf'),_0x6b01('0x10'),_0x6b01('0x11'),_0x6b01('0x12'),_0x6b01('0x13'),_0x6b01('0x14')];var _0x122769={'count':0x0,'rows':[]},_0x33ffe8={},_0x9c6571;Promise[_0x6b01('0x15')]()[_0x6b01('0x16')](function(){if(_0x51b3cf['query'][_0x6b01('0x17')]){if(!_[_0x6b01('0x18')](_0x4cbd38,_0x51b3cf[_0x6b01('0x19')][_0x6b01('0x17')][_0x6b01('0x1a')]()))throw new Error(_0x6b01('0x1b'));_0x9c6571=_0x51b3cf[_0x6b01('0x19')][_0x6b01('0x17')]['toLowerCase']();}var _0x3029e2=_[_0x6b01('0x1c')](_0x9c6571)+_0x6b01('0x1d');var _0x2551b0=_[_0x6b01('0x1e')](db[_0x3029e2][_0x6b01('0x1f')],function(_0x2cea6e){return{'name':_0x2cea6e['fieldName'],'type':_0x2cea6e[_0x6b01('0x20')][_0x6b01('0x21')]};});_0x33ffe8=qs[_0x6b01('0x22')](_0x2551b0,_0x51b3cf);if(_0x51b3cf['user'][_0x6b01('0x23')]===_0x6b01('0x24')){var _0x304393={'params':{'id':_0x51b3cf[_0x6b01('0x24')][_0x6b01('0x25')]},'query':{'section':_0x9c6571===_0x6b01('0x14')&&_0x51b3cf[_0x6b01('0x19')][_0x6b01('0x20')]===_0x6b01('0x26')?_0x6b01('0x27'):_[_0x6b01('0x1c')](_0x9c6571)+_0x6b01('0x28'),'type':_0x51b3cf[_0x6b01('0x19')]['type'],'nolimit':!![],'sort':_0x6b01('0xe'),'filter':_0x51b3cf[_0x6b01('0x19')][_0x6b01('0x29')]}};return db[_0x6b01('0x2a')][_0x6b01('0x2b')](_0x304393);}return db[_0x3029e2]['findAndCountAll'](_0x33ffe8);})['then'](function(_0x3fae61){_0x122769[_0x6b01('0x8')]=_0x3fae61[_0x6b01('0x8')];var _0x8883d1=_0x9c6571===_0x6b01('0x14')?client:routingClient;return _0x8883d1[_0x6b01('0x2c')](_['startCase'](_0x9c6571)+_0x6b01('0x28'),_0x51b3cf)['then'](function(_0x3942d7){if(_0x3942d7['error'])throw new Error(util[_0x6b01('0x2d')](_0x6b01('0x2e'),_0x9c6571));var _0x473201=_0x3942d7[_0x6b01('0x2f')];var _0x3c8009=['loggedIn',_0x6b01('0x30'),_0x6b01('0x31'),_0x6b01('0x32'),'paused'];if(_0x9c6571==='voice'&&_0x51b3cf[_0x6b01('0x19')]['type']===_0x6b01('0x26')){_0x3c8009[_0x6b01('0x33')](_0x6b01('0x34'),'originated',_0x6b01('0x35'),_0x6b01('0x36'),_0x6b01('0x37'),'Trunk',_0x6b01('0x38'),_0x6b01('0x39'),_0x6b01('0x3a'),_0x6b01('0x3b'),_0x6b01('0x3c'),'erlangBusyFactor',_0x6b01('0x3d'),_0x6b01('0x3e'),_0x6b01('0x3f'),_0x6b01('0x40'),_0x6b01('0x41'),_0x6b01('0x42'),_0x6b01('0x43'),_0x6b01('0x44'),'predictiveIntervalAvgHoldtime',_0x6b01('0x45'));}var _0x530c91=_0x3fae61[_0x6b01('0x46')][_0x6b01('0x1e')](function(_0x1baac5){var _0x318b8b=_0x1baac5[_0x6b01('0x47')]({'plain':!![]});_0x318b8b[_0x6b01('0x48')]=0x0;_0x318b8b[_0x6b01('0x49')]=0x0;_0x318b8b['loggedIn']=0x0;_0x318b8b[_0x6b01('0x30')]=0x0;_0x318b8b[_0x6b01('0x48')]=0x0;_0x318b8b[_0x6b01('0x31')]=0x0;if(_0x9c6571===_0x6b01('0x14')){_0x318b8b[_0x6b01('0x32')]=0x0;if(_0x51b3cf[_0x6b01('0x19')][_0x6b01('0x20')]===_0x6b01('0x26')){_0x318b8b['pTalking']=0x0;_0x318b8b[_0x6b01('0x4a')]=0x0;}}_0x318b8b['agents']=[];var _0x336a67=_[_0x6b01('0x4b')](_0x473201['rows'],['id',_0x318b8b['id']]);if(_0x336a67)_[_0x6b01('0x4c')](_0x318b8b,_[_0x6b01('0x4d')](_0x336a67,_0x3c8009));if(_0x9c6571===_0x6b01('0x14')){return _0x1baac5[_0x6b01('0x4e')]({'attributes':['id',_0x6b01('0xe'),_0x6b01('0x4f')],'joinTableAttributes':[],'raw':!![]})[_0x6b01('0x16')](function(_0x93737a){return _0x1baac5[_0x6b01('0x50')]({'raw':!![]})[_0x6b01('0x16')](function(_0x5edf3f){for(var _0x3b398e=0x0;_0x3b398e<_0x93737a[_0x6b01('0x51')];_0x3b398e++){var _0x527d08=_['find'](_0x5edf3f,[_0x6b01('0x52'),_0x93737a[_0x3b398e]['id']]);var _0xd11195={'id':_0x93737a[_0x3b398e]['id'],'name':_0x93737a[_0x3b398e]['name'],'online':Boolean(_0x93737a[_0x3b398e][_0x6b01('0x4f')]),'paused':_0x527d08?Boolean(_0x527d08[_0x6b01('0x48')]):![]};if(_0xd11195['online'])_0x318b8b[_0x6b01('0x49')]++;if(_0xd11195['paused'])_0x318b8b[_0x6b01('0x48')]++;_0x318b8b[_0x6b01('0x53')][_0x6b01('0x33')](_0xd11195);}return _0x318b8b;});});}else{var _0x50b13d=_0x6b01('0x54')+_[_0x6b01('0x1c')](_0x9c6571)+'Queue';var _0x566a7a=_0x9c6571+'Pause';return db[_0x50b13d][_0x6b01('0x55')]({'where':{[_[_0x6b01('0x1c')](_0x9c6571)+_0x6b01('0x56')]:_0x1baac5['id']},'raw':!![]})[_0x6b01('0x16')](function(_0x1515a5){return db[_0x6b01('0x54')]['findAll']({'attributes':['id',_0x6b01('0xe'),_0x6b01('0x4f'),_0x566a7a],'where':{'id':_[_0x6b01('0x1e')](_0x1515a5,_0x6b01('0x52')),'role':_0x6b01('0x57')},'raw':!![]});})[_0x6b01('0x16')](function(_0x4fed93){for(var _0x1fd975=0x0;_0x1fd975<_0x4fed93['length'];_0x1fd975++){var _0x52b8dd={'id':_0x4fed93[_0x1fd975]['id'],'name':_0x4fed93[_0x1fd975][_0x6b01('0xe')],'online':Boolean(_0x4fed93[_0x1fd975][_0x6b01('0x4f')]),'paused':Boolean(_0x4fed93[_0x1fd975][_0x566a7a])};if(_0x52b8dd['online'])_0x318b8b[_0x6b01('0x49')]++;if(_0x52b8dd[_0x6b01('0x48')])_0x318b8b[_0x6b01('0x48')]++;_0x318b8b['agents']['push'](_0x52b8dd);}return _0x318b8b;});}});return Promise['all'](_0x530c91);});})[_0x6b01('0x16')](function(_0x12160f){_0x122769['rows']=_0x12160f;return _0x122769;})[_0x6b01('0x16')](respondWithFilteredResult(_0x3d4666,_0x33ffe8))['catch'](handleError(_0x3d4666,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index f75ec8a..d27124e 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(_0x36949f,_0xac8926){var _0x225ac9=function(_0x234feb){while(--_0x234feb){_0x36949f['push'](_0x36949f['shift']());}};_0x225ac9(++_0xac8926);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x569397,_0xe36908){var _0x364485=function(_0x38bdc1){while(--_0x38bdc1){_0x569397['push'](_0x569397['shift']());}};_0x364485(++_0xe36908);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 8147692..140427a 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 _0x6050=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6050,0x196));var _0x0605=function(_0x180203,_0x41706d){_0x180203=_0x180203-0x0;var _0x245bc2=_0x6050[_0x180203];return _0x245bc2;};'use strict';var Sequelize=require(_0x0605('0x0'));module[_0x0605('0x1')]={'state':{'type':Sequelize[_0x0605('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0605('0x3')]},'scheduledat':{'type':Sequelize[_0x0605('0x4')]},'uniqueid':{'type':Sequelize[_0x0605('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0605('0x4')]},'ringtime':{'type':Sequelize[_0x0605('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x0605('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2d72=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x2fea86,_0x48d3ef){var _0x24ba87=function(_0x3645e5){while(--_0x3645e5){_0x2fea86['push'](_0x2fea86['shift']());}};_0x24ba87(++_0x48d3ef);}(_0x2d72,0xa8));var _0x22d7=function(_0x28189a,_0x5061da){_0x28189a=_0x28189a-0x0;var _0x2ce0b8=_0x2d72[_0x28189a];return _0x2ce0b8;};'use strict';var Sequelize=require(_0x22d7('0x0'));module[_0x22d7('0x1')]={'state':{'type':Sequelize[_0x22d7('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x22d7('0x3')]},'scheduledat':{'type':Sequelize[_0x22d7('0x4')]},'uniqueid':{'type':Sequelize[_0x22d7('0x3')]},'starttime':{'type':Sequelize[_0x22d7('0x4')]},'responsetime':{'type':Sequelize[_0x22d7('0x4')]},'ringtime':{'type':Sequelize[_0x22d7('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x22d7('0x3')]},'campaigntype':{'type':Sequelize[_0x22d7('0x3')]},'membername':{'type':Sequelize[_0x22d7('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index d791988..007737f 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 _0x2c99=['moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2c99,0x82));var _0x92c9=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2c99[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x92c9('0x0'))(_0x92c9('0x1'));var moment=require(_0x92c9('0x2'));var BPromise=require(_0x92c9('0x3'));var rp=require(_0x92c9('0x4'));var fs=require('fs');var path=require(_0x92c9('0x5'));var rimraf=require('rimraf');var config=require(_0x92c9('0x6'));var attributes=require(_0x92c9('0x7'));module[_0x92c9('0x8')]=function(_0x4101c3,_0x13602e){return _0x4101c3[_0x92c9('0x9')]('ReportAgentPreview',attributes,{'tableName':_0x92c9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x162d=['exports','define','ReportAgentPreview','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0x162d,0xa8));var _0xd162=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x162d[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0xd162('0x0'));var logger=require(_0xd162('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd162('0x2'));var rp=require(_0xd162('0x3'));var fs=require('fs');var path=require(_0xd162('0x4'));var rimraf=require(_0xd162('0x5'));var config=require(_0xd162('0x6'));var attributes=require(_0xd162('0x7'));module[_0xd162('0x8')]=function(_0x1b06ba,_0x7afa1a){return _0x1b06ba[_0xd162('0x9')](_0xd162('0xa'),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 fd12275..0a5cb09 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 _0x325d=['raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options'];(function(_0xc43047,_0x5a8843){var _0x391ffb=function(_0x4baef5){while(--_0x4baef5){_0xc43047['push'](_0xc43047['shift']());}};_0x391ffb(++_0x5a8843);}(_0x325d,0x1e1));var _0xd325=function(_0x3ac42f,_0x54e9da){_0x3ac42f=_0x3ac42f-0x0;var _0x148f58=_0x325d[_0x3ac42f];return _0x148f58;};'use strict';var _=require(_0xd325('0x0'));var util=require(_0xd325('0x1'));var moment=require(_0xd325('0x2'));var BPromise=require(_0xd325('0x3'));var rs=require(_0xd325('0x4'));var fs=require('fs');var Redis=require(_0xd325('0x5'));var db=require(_0xd325('0x6'))['db'];var utils=require(_0xd325('0x7'));var logger=require(_0xd325('0x8'))(_0xd325('0x9'));var config=require(_0xd325('0xa'));var jayson=require(_0xd325('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x402425,_0x429c75,_0x30d9d4){return new BPromise(function(_0x22a388,_0x6245a6){return client[_0xd325('0xc')](_0x402425,_0x30d9d4)[_0xd325('0xd')](function(_0x3ae6af){logger[_0xd325('0xe')](_0xd325('0xf'),_0x429c75,_0xd325('0x10'));logger[_0xd325('0x11')](_0xd325('0x12'),_0x429c75,_0xd325('0x10'),JSON[_0xd325('0x13')](_0x3ae6af));if(_0x3ae6af[_0xd325('0x14')]){if(_0x3ae6af[_0xd325('0x14')][_0xd325('0x15')]===0x1f4){logger[_0xd325('0x14')](_0xd325('0xf'),_0x429c75,_0x3ae6af[_0xd325('0x14')][_0xd325('0x16')]);return _0x6245a6(_0x3ae6af[_0xd325('0x14')][_0xd325('0x16')]);}logger[_0xd325('0x14')](_0xd325('0xf'),_0x429c75,_0x3ae6af[_0xd325('0x14')][_0xd325('0x16')]);return _0x22a388(_0x3ae6af[_0xd325('0x14')][_0xd325('0x16')]);}else{logger['info'](_0xd325('0xf'),_0x429c75,_0xd325('0x10'));_0x22a388(_0x3ae6af['result'][_0xd325('0x16')]);}})[_0xd325('0x17')](function(_0x41bb43){logger[_0xd325('0x14')](_0xd325('0xf'),_0x429c75,_0x41bb43);_0x6245a6(_0x41bb43);});});}exports[_0xd325('0x18')]=function(_0x42a5e1){var _0x4fce26=this;return new Promise(function(_0x16f63a,_0x216d82){return db[_0xd325('0x19')][_0xd325('0x1a')](_0x42a5e1[_0xd325('0x1b')],{'raw':_0x42a5e1[_0xd325('0x1c')]?_0x42a5e1['options'][_0xd325('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x1ed6ce){logger[_0xd325('0xe')](_0xd325('0x18'),_0x42a5e1);logger[_0xd325('0x11')](_0xd325('0x18'),_0x42a5e1,JSON[_0xd325('0x13')](_0x1ed6ce));_0x16f63a(_0x1ed6ce);})[_0xd325('0x17')](function(_0x53084a){logger[_0xd325('0x14')](_0xd325('0x18'),_0x53084a['message'],_0x42a5e1);_0x216d82(_0x4fce26[_0xd325('0x14')](0x1f4,_0x53084a[_0xd325('0x16')]));});});}; \ No newline at end of file +var _0xf6e4=['ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info'];(function(_0x3a800d,_0x4e713f){var _0x91745f=function(_0x31ba68){while(--_0x31ba68){_0x3a800d['push'](_0x3a800d['shift']());}};_0x91745f(++_0x4e713f);}(_0xf6e4,0x16f));var _0x4f6e=function(_0x356d2d,_0x24b167){_0x356d2d=_0x356d2d-0x0;var _0x146308=_0xf6e4[_0x356d2d];return _0x146308;};'use strict';var _=require('lodash');var util=require(_0x4f6e('0x0'));var moment=require('moment');var BPromise=require(_0x4f6e('0x1'));var rs=require(_0x4f6e('0x2'));var fs=require('fs');var Redis=require(_0x4f6e('0x3'));var db=require(_0x4f6e('0x4'))['db'];var utils=require(_0x4f6e('0x5'));var logger=require('../../config/logger')(_0x4f6e('0x6'));var config=require(_0x4f6e('0x7'));var jayson=require(_0x4f6e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53fd17,_0x377b87,_0x16f4e8){return new BPromise(function(_0x1b22c6,_0xe4e0e9){return client['request'](_0x53fd17,_0x16f4e8)[_0x4f6e('0x9')](function(_0x318e12){logger[_0x4f6e('0xa')](_0x4f6e('0xb'),_0x377b87,'request\x20sent');logger[_0x4f6e('0xc')](_0x4f6e('0xd'),_0x377b87,_0x4f6e('0xe'),JSON[_0x4f6e('0xf')](_0x318e12));if(_0x318e12['error']){if(_0x318e12['error'][_0x4f6e('0x10')]===0x1f4){logger[_0x4f6e('0x11')](_0x4f6e('0xb'),_0x377b87,_0x318e12[_0x4f6e('0x11')][_0x4f6e('0x12')]);return _0xe4e0e9(_0x318e12[_0x4f6e('0x11')]['message']);}logger[_0x4f6e('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x377b87,_0x318e12[_0x4f6e('0x11')][_0x4f6e('0x12')]);return _0x1b22c6(_0x318e12[_0x4f6e('0x11')][_0x4f6e('0x12')]);}else{logger[_0x4f6e('0xa')](_0x4f6e('0xb'),_0x377b87,_0x4f6e('0xe'));_0x1b22c6(_0x318e12[_0x4f6e('0x13')][_0x4f6e('0x12')]);}})[_0x4f6e('0x14')](function(_0x5b6558){logger[_0x4f6e('0x11')](_0x4f6e('0xb'),_0x377b87,_0x5b6558);_0xe4e0e9(_0x5b6558);});});}exports['CreateReportAgentPreview']=function(_0xec6403){var _0x38851c=this;return new Promise(function(_0x3e7686,_0x1a17f1){return db[_0x4f6e('0x15')][_0x4f6e('0x16')](_0xec6403[_0x4f6e('0x17')],{'raw':_0xec6403[_0x4f6e('0x18')]?_0xec6403[_0x4f6e('0x18')][_0x4f6e('0x19')]===undefined?!![]:![]:!![]})[_0x4f6e('0x9')](function(_0x4f5069){logger[_0x4f6e('0xa')]('CreateReportAgentPreview',_0xec6403);logger[_0x4f6e('0xc')](_0x4f6e('0x1a'),_0xec6403,JSON['stringify'](_0x4f5069));_0x3e7686(_0x4f5069);})[_0x4f6e('0x14')](function(_0x5a4d88){logger[_0x4f6e('0x11')](_0x4f6e('0x1a'),_0x5a4d88[_0x4f6e('0x12')],_0xec6403);_0x1a17f1(_0x38851c['error'](0x1f4,_0x5a4d88[_0x4f6e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index f070186..1a28230 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 _0x9563=['fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','isAuthenticated','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','/outbound/channels','/agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues'];(function(_0xffad61,_0x5f0282){var _0x33ef10=function(_0x54fde3){while(--_0x54fde3){_0xffad61['push'](_0xffad61['shift']());}};_0x33ef10(++_0x5f0282);}(_0x9563,0x1e7));var _0x3956=function(_0x274274,_0x1b16aa){_0x274274=_0x274274-0x0;var _0x466ccb=_0x9563[_0x274274];return _0x466ccb;};'use strict';var multer=require(_0x3956('0x0'));var util=require(_0x3956('0x1'));var path=require('path');var express=require(_0x3956('0x2'));var router=express[_0x3956('0x3')]();var auth=require(_0x3956('0x4'));var controller=require(_0x3956('0x5'));router['get']('/voice/channels',auth[_0x3956('0x6')](),controller['voiceChannels']);router[_0x3956('0x7')](_0x3956('0x8'),auth[_0x3956('0x6')](),controller[_0x3956('0x9')]);router['get'](_0x3956('0xa'),auth[_0x3956('0x6')](),controller[_0x3956('0xb')]);router[_0x3956('0x7')](_0x3956('0xc'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0x3956('0x7')](_0x3956('0xd'),auth[_0x3956('0x6')](),controller[_0x3956('0xe')]);router['get'](_0x3956('0xf'),auth[_0x3956('0x6')](),controller[_0x3956('0x10')]);router[_0x3956('0x7')](_0x3956('0x11'),auth[_0x3956('0x6')](),controller[_0x3956('0x12')]);router[_0x3956('0x7')](_0x3956('0x13'),auth['isAuthenticated'](),controller['openchannelQueues']);router['get'](_0x3956('0x14'),auth[_0x3956('0x6')](),controller['smsQueues']);router[_0x3956('0x7')](_0x3956('0x15'),auth[_0x3956('0x6')](),controller[_0x3956('0x16')]);router[_0x3956('0x7')](_0x3956('0x17'),auth[_0x3956('0x6')](),controller[_0x3956('0x18')]);router[_0x3956('0x7')](_0x3956('0x19'),auth[_0x3956('0x6')](),controller[_0x3956('0x1a')]);router[_0x3956('0x7')](_0x3956('0x1b'),auth[_0x3956('0x6')](),controller[_0x3956('0x1c')]);router[_0x3956('0x7')](_0x3956('0x1d'),auth[_0x3956('0x6')](),controller[_0x3956('0x1e')]);router['get'](_0x3956('0x1f'),auth[_0x3956('0x6')](),controller['voiceQueuesChannelHangup']);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x3956('0x6')](),controller[_0x3956('0x20')]);router['get'](_0x3956('0x21'),auth['isAuthenticated'](),controller[_0x3956('0x22')]);router['put'](_0x3956('0x21'),auth[_0x3956('0x6')](),controller[_0x3956('0x23')]);router[_0x3956('0x7')](_0x3956('0x24'),auth[_0x3956('0x6')](),controller['outbound']);router['get'](_0x3956('0x25'),auth[_0x3956('0x6')](),controller['outboundChannels']);router['get'](_0x3956('0x26'),auth[_0x3956('0x6')](),controller['agents']);router[_0x3956('0x27')](_0x3956('0x28'),auth[_0x3956('0x6')](),controller[_0x3956('0x29')]);router[_0x3956('0x7')](_0x3956('0x2a'),auth['isAuthenticated'](),controller[_0x3956('0x2b')]);router[_0x3956('0x7')](_0x3956('0x2c'),auth['isAuthenticated'](),controller[_0x3956('0x2d')]);router[_0x3956('0x7')](_0x3956('0x2e'),auth['isAuthenticated'](),controller[_0x3956('0x2f')]);router[_0x3956('0x7')](_0x3956('0x30'),auth[_0x3956('0x6')](),controller[_0x3956('0x31')]);router[_0x3956('0x7')](_0x3956('0x32'),auth[_0x3956('0x6')](),controller[_0x3956('0x33')]);router[_0x3956('0x7')]('/mail/queues/waitinginteractions',auth[_0x3956('0x6')](),controller[_0x3956('0x34')]);router['get'](_0x3956('0x35'),auth[_0x3956('0x6')](),controller['openchannelQueuesWaitingInteractions']);router[_0x3956('0x7')]('/openchannel/queues/:id/waitinginteractions',auth[_0x3956('0x6')](),controller[_0x3956('0x36')]);router[_0x3956('0x7')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x3956('0x37')]);router[_0x3956('0x7')]('/whatsapp/queues/waitinginteractions',auth[_0x3956('0x6')](),controller['whatsappQueuesWaitingInteractions']);router[_0x3956('0x7')](_0x3956('0x38'),auth[_0x3956('0x6')](),controller[_0x3956('0x39')]);router[_0x3956('0x3a')](_0x3956('0x3b'),auth[_0x3956('0x6')](),controller[_0x3956('0x3c')]('mail'));router[_0x3956('0x7')]('/mail/queues/:id',auth[_0x3956('0x6')](),controller[_0x3956('0x3d')]);router[_0x3956('0x3a')](_0x3956('0x3e'),auth[_0x3956('0x6')](),controller[_0x3956('0x3c')](_0x3956('0x3f')));router[_0x3956('0x7')](_0x3956('0x40'),auth[_0x3956('0x6')](),controller[_0x3956('0x41')]);router[_0x3956('0x3a')]('/fax/queues/:id/notify',auth[_0x3956('0x6')](),controller[_0x3956('0x3c')](_0x3956('0x42')));router[_0x3956('0x7')](_0x3956('0x43'),auth[_0x3956('0x6')](),controller[_0x3956('0x44')]);router[_0x3956('0x3a')]('/openchannel/queues/:id/notify',auth[_0x3956('0x6')](),controller[_0x3956('0x3c')](_0x3956('0x45')));router['get'](_0x3956('0x46'),auth[_0x3956('0x6')](),controller['showOpenchannelQueues']);router[_0x3956('0x3a')](_0x3956('0x47'),auth[_0x3956('0x6')](),controller['queueNotify'](_0x3956('0x48')));router[_0x3956('0x3a')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0x3956('0x3c')](_0x3956('0x49')));router[_0x3956('0x7')](_0x3956('0x4a'),auth[_0x3956('0x6')](),controller['showSmsQueues']);router[_0x3956('0x7')]('/whatsapp/queues/:id',auth[_0x3956('0x6')](),controller[_0x3956('0x4b')]);router['post'](_0x3956('0x4c'),auth['isAuthenticated'](),controller[_0x3956('0x4d')]);module[_0x3956('0x4e')]=router; \ No newline at end of file +var _0x54ec=['/chat/queues/:id','showChatQueues','fax','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','multer','util','path','express','Router','./rpc.controller','get','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','chat'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x54ec,0x10f));var _0xc54e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x54ec[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc54e('0x0'));var util=require(_0xc54e('0x1'));var path=require(_0xc54e('0x2'));var express=require(_0xc54e('0x3'));var router=express[_0xc54e('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0xc54e('0x5'));router[_0xc54e('0x6')]('/voice/channels',auth['isAuthenticated'](),controller[_0xc54e('0x7')]);router['get'](_0xc54e('0x8'),auth[_0xc54e('0x9')](),controller[_0xc54e('0xa')]);router[_0xc54e('0x6')](_0xc54e('0xb'),auth[_0xc54e('0x9')](),controller[_0xc54e('0xc')]);router[_0xc54e('0x6')](_0xc54e('0xd'),auth[_0xc54e('0x9')](),controller[_0xc54e('0xe')]);router[_0xc54e('0x6')](_0xc54e('0xf'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x10')]);router[_0xc54e('0x6')](_0xc54e('0x11'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x12')]);router[_0xc54e('0x6')](_0xc54e('0x13'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x14')]);router[_0xc54e('0x6')](_0xc54e('0x15'),auth[_0xc54e('0x9')](),controller['openchannelQueues']);router[_0xc54e('0x6')](_0xc54e('0x16'),auth['isAuthenticated'](),controller[_0xc54e('0x17')]);router[_0xc54e('0x6')](_0xc54e('0x18'),auth[_0xc54e('0x9')](),controller['whatsappQueues']);router[_0xc54e('0x6')]('/fax/queues',auth[_0xc54e('0x9')](),controller[_0xc54e('0x19')]);router[_0xc54e('0x6')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller[_0xc54e('0x1a')]);router[_0xc54e('0x6')](_0xc54e('0x1b'),auth['isAuthenticated'](),controller[_0xc54e('0x1c')]);router['get'](_0xc54e('0x1d'),auth['isAuthenticated'](),controller[_0xc54e('0x1e')]);router[_0xc54e('0x6')](_0xc54e('0x1f'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x20')]);router[_0xc54e('0x6')](_0xc54e('0x21'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x22')]);router[_0xc54e('0x6')]('/voice/queues/:id',auth[_0xc54e('0x9')](),controller[_0xc54e('0x23')]);router['put'](_0xc54e('0x24'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x25')]);router['get'](_0xc54e('0x26'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x27')]);router['get'](_0xc54e('0x28'),auth['isAuthenticated'](),controller[_0xc54e('0x29')]);router[_0xc54e('0x6')](_0xc54e('0x2a'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x2b')]);router[_0xc54e('0x2c')](_0xc54e('0x2d'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x2e')]);router['get'](_0xc54e('0x2f'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x30')]);router[_0xc54e('0x6')](_0xc54e('0x31'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x32')]);router[_0xc54e('0x6')](_0xc54e('0x33'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x34')]);router[_0xc54e('0x6')](_0xc54e('0x35'),auth['isAuthenticated'](),controller[_0xc54e('0x36')]);router[_0xc54e('0x6')](_0xc54e('0x37'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x38')]);router[_0xc54e('0x6')](_0xc54e('0x39'),auth[_0xc54e('0x9')](),controller['mailQueuesWaitingInteractions']);router[_0xc54e('0x6')](_0xc54e('0x3a'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x3b')]);router[_0xc54e('0x6')](_0xc54e('0x3c'),auth['isAuthenticated'](),controller[_0xc54e('0x3d')]);router[_0xc54e('0x6')](_0xc54e('0x3e'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x3f')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0xc54e('0x9')](),controller[_0xc54e('0x40')]);router[_0xc54e('0x6')](_0xc54e('0x41'),auth[_0xc54e('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0xc54e('0x42')](_0xc54e('0x43'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x44')](_0xc54e('0x45')));router[_0xc54e('0x6')](_0xc54e('0x46'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x47')]);router['post']('/chat/queues/:id/notify',auth[_0xc54e('0x9')](),controller[_0xc54e('0x44')](_0xc54e('0x48')));router['get'](_0xc54e('0x49'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x4a')]);router[_0xc54e('0x42')]('/fax/queues/:id/notify',auth[_0xc54e('0x9')](),controller[_0xc54e('0x44')](_0xc54e('0x4b')));router[_0xc54e('0x6')]('/fax/queues/:id',auth[_0xc54e('0x9')](),controller['showFaxQueues']);router['post'](_0xc54e('0x4c'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x44')](_0xc54e('0x4d')));router['get'](_0xc54e('0x4e'),auth['isAuthenticated'](),controller[_0xc54e('0x4f')]);router[_0xc54e('0x42')]('/sms/queues/:id/notify',auth[_0xc54e('0x9')](),controller['queueNotify'](_0xc54e('0x50')));router[_0xc54e('0x42')]('/whatsapp/queues/:id/notify',auth[_0xc54e('0x9')](),controller[_0xc54e('0x44')]('whatsapp'));router['get'](_0xc54e('0x51'),auth[_0xc54e('0x9')](),controller[_0xc54e('0x52')]);router[_0xc54e('0x6')](_0xc54e('0x53'),auth['isAuthenticated'](),controller[_0xc54e('0x54')]);router['post'](_0xc54e('0x55'),auth[_0xc54e('0x9')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 4581739..4139fae 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 _0x3e74=['http','client','then','error','code','message','result','sendStatus','stack','name','status','isNil','find','rows','voiceChannels','VoiceChannels','query','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','showWhatsappQueues','WhatsappQueues','showFaxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','\x20Queue\x20not\x20found','Message','findOne','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','From','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','InteractionId','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','jayson/promise'];(function(_0x4c91dc,_0x3377c9){var _0x4556da=function(_0x7e5205){while(--_0x7e5205){_0x4c91dc['push'](_0x4c91dc['shift']());}};_0x4556da(++_0x3377c9);}(_0x3e74,0x175));var _0x43e7=function(_0x4f1ab7,_0x133eaf){_0x4f1ab7=_0x4f1ab7-0x0;var _0x49d162=_0x3e74[_0x4f1ab7];return _0x49d162;};'use strict';var BPromise=require(_0x43e7('0x0'));var moment=require('moment');var _=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var db=require(_0x43e7('0x3'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x43e7('0x4'));var amiClient=jayson['client'][_0x43e7('0x5')]({'port':0x232a});var mailClient=jayson[_0x43e7('0x6')][_0x43e7('0x5')]({'port':0x232b});var routingClient=jayson[_0x43e7('0x6')][_0x43e7('0x5')]({'port':0x232c});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){var _0x21f491=_0x3491d6?_0x3491d6:amiClient;return _0x21f491['request'](_0x503698,_0x45a0d1)[_0x43e7('0x7')](function(_0x554d44){if(_0x554d44['error']){if(_0x554d44[_0x43e7('0x8')][_0x43e7('0x9')]===0x1f4){return _0x8528fc(_0x554d44['error'][_0x43e7('0xa')]);}return _0x2ede2d(_0x554d44['error'][_0x43e7('0xa')]);}else{_0x2ede2d(_0x554d44[_0x43e7('0xb')]);}})['catch'](function(_0x3eb206){_0x8528fc(_0x3eb206);});});}function respondWithResult(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xc8;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['status'](_0x2718d3)['json'](_0x3bb83f);}return _0xc960ea[_0x43e7('0xc')](0x194);};}function handleError(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0x1f4;return function(_0x51b974){logger['error'](_0x51b974[_0x43e7('0xd')]);if(_0x51b974[_0x43e7('0xe')]){delete _0x51b974[_0x43e7('0xe')];}_0x21fdd3[_0x43e7('0xf')](_0x44b0bd)['send'](_0x51b974);};}function findById(_0x5c4eaa){return function(_0xdf16c){if(!_[_0x43e7('0x10')](_0x5c4eaa)&&!_[_0x43e7('0x10')](_0xdf16c)&&!_['isNil'](_0xdf16c['rows'])){return _[_0x43e7('0x11')](_0xdf16c[_0x43e7('0x12')],function(_0x9037d3){return _0x9037d3['id']==_0x5c4eaa;});}return null;};}exports[_0x43e7('0x13')]=function(_0x3776f5,_0x1f24fb){return respondWithRpcPromise(_0x43e7('0x14'),_0x3776f5[_0x43e7('0x15')])[_0x43e7('0x7')](respondWithResult(_0x1f24fb,null))[_0x43e7('0x16')](handleError(_0x1f24fb,null));};exports[_0x43e7('0x17')]=function(_0x177ee1,_0x4b5d64){return respondWithRpcPromise(_0x43e7('0x18'),_[_0x43e7('0x19')](_0x177ee1['query'],_0x177ee1[_0x43e7('0x1a')]))[_0x43e7('0x7')](respondWithResult(_0x4b5d64,null))[_0x43e7('0x16')](handleError(_0x4b5d64,null));};exports[_0x43e7('0x1b')]=function(_0x4077fb,_0x2f4cb4){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x43e7('0x19')](_0x4077fb['query'],_0x4077fb['params']))[_0x43e7('0x7')](respondWithResult(_0x2f4cb4,null))[_0x43e7('0x16')](handleError(_0x2f4cb4,null));};exports['voiceQueues']=function(_0x1f0673,_0x4ca5cf){return respondWithRpcPromise(_0x43e7('0x1c'),_0x1f0673['query'])[_0x43e7('0x7')](respondWithResult(_0x4ca5cf,null))[_0x43e7('0x16')](handleError(_0x4ca5cf,null));};exports[_0x43e7('0x1d')]=function(_0x405f85,_0x51f4d7){return respondWithRpcPromise('VoiceQueues',_0x405f85[_0x43e7('0x15')])['then'](findById(_0x405f85[_0x43e7('0x1a')]['id']))[_0x43e7('0x7')](respondWithResult(_0x51f4d7,null))[_0x43e7('0x16')](handleError(_0x51f4d7,null));};exports[_0x43e7('0x1e')]=function(_0x5087d7,_0x33a1a5){return respondWithRpcPromise(_0x43e7('0x1f'),_[_0x43e7('0x19')](_0x5087d7[_0x43e7('0x20')],_0x5087d7[_0x43e7('0x1a')]))[_0x43e7('0x7')](respondWithResult(_0x33a1a5,null))[_0x43e7('0x16')](handleError(_0x33a1a5,null));};exports[_0x43e7('0x21')]=function(_0x3bf475,_0x35dbcd){return respondWithRpcPromise(_0x43e7('0x22'),_[_0x43e7('0x19')](_0x3bf475[_0x43e7('0x15')],_0x3bf475[_0x43e7('0x1a')]))['then'](respondWithResult(_0x35dbcd,null))[_0x43e7('0x16')](handleError(_0x35dbcd,null));};exports[_0x43e7('0x23')]=function(_0x3b8f78,_0x183c81){return respondWithRpcPromise(_0x43e7('0x24'),_0x3b8f78['query'])[_0x43e7('0x7')](respondWithResult(_0x183c81,null))[_0x43e7('0x16')](handleError(_0x183c81,null));};exports[_0x43e7('0x25')]=function(_0x3f280d,_0x4c61b9){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x3f280d[_0x43e7('0x15')],_0x3f280d[_0x43e7('0x1a')]))[_0x43e7('0x7')](respondWithResult(_0x4c61b9,null))[_0x43e7('0x16')](handleError(_0x4c61b9,null));};exports[_0x43e7('0x26')]=function(_0xde7ed,_0x485c6c){return respondWithRpcPromise('VoiceQueuesChannelHangup',_['merge'](_0xde7ed['query'],_0xde7ed['params']))['then'](respondWithResult(_0x485c6c,null))['catch'](handleError(_0x485c6c,null));};exports[_0x43e7('0x27')]=function(_0x49cda6,_0x2b4bfd){return respondWithRpcPromise(_0x43e7('0x28'),_[_0x43e7('0x19')](_0x49cda6[_0x43e7('0x15')],_0x49cda6[_0x43e7('0x1a')]))[_0x43e7('0x7')](respondWithResult(_0x2b4bfd,null))[_0x43e7('0x16')](handleError(_0x2b4bfd,null));};exports['outbound']=function(_0x5332d9,_0x5d84f4){return respondWithRpcPromise(_0x43e7('0x29'),_0x5332d9[_0x43e7('0x15')])[_0x43e7('0x7')](respondWithResult(_0x5d84f4,null))[_0x43e7('0x16')](handleError(_0x5d84f4,null));};exports[_0x43e7('0x2a')]=function(_0x1ed538,_0x1d4589){return respondWithRpcPromise(_0x43e7('0x2b'),_0x1ed538['query'])[_0x43e7('0x7')](respondWithResult(_0x1d4589,null))[_0x43e7('0x16')](handleError(_0x1d4589,null));};exports['agents']=function(_0x2d54c1,_0x4c0c7a){var _0x44d8e4;return respondWithRpcPromise(_0x43e7('0x2c'),_0x2d54c1[_0x43e7('0x15')])[_0x43e7('0x7')](function(_0x35ac85){_0x44d8e4=_0x35ac85;return respondWithRpcPromise(_0x43e7('0x2c'),_0x2d54c1['query'],routingClient);})['then'](function(_0x30dfa9){return _[_0x43e7('0x19')]({},_0x30dfa9,_0x44d8e4);})[_0x43e7('0x7')](respondWithResult(_0x4c0c7a,null))[_0x43e7('0x16')](handleError(_0x4c0c7a,null));};exports[_0x43e7('0x2d')]=function(_0x4a4a85,_0x32a451){if(_0x4a4a85[_0x43e7('0x20')]&&_0x4a4a85['body'][_0x43e7('0x2e')]&&_0x4a4a85['user']&&_0x4a4a85[_0x43e7('0x2f')]['name']){for(var _0x3d81ae in _0x4a4a85[_0x43e7('0x20')][_0x43e7('0x2e')]){if(_0x4a4a85[_0x43e7('0x20')]['interaction']['hasOwnProperty'](_0x3d81ae)){db[_0x43e7('0x30')][_0x43e7('0x31')]({'where':{'channel':_0x3d81ae,'membername':_0x4a4a85[_0x43e7('0x2f')][_0x43e7('0xe')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4a4a85['body']['interaction'][_0x3d81ae]&&_0x4a4a85[_0x43e7('0x20')]['interaction'][_0x3d81ae][_0x43e7('0x32')]?{'$notIn':_0x4a4a85['body']['interaction'][_0x3d81ae]}:{'$ne':null}}})[_0x43e7('0x7')](function(_0x5ee1c5){var _0x2de14f=moment()[_0x43e7('0x33')](_0x43e7('0x34'));for(var _0x99b9e1=0x0,_0x4fc5e8=_0x5ee1c5[_0x43e7('0x32')];_0x99b9e1<_0x4fc5e8;_0x99b9e1+=0x1){_0x5ee1c5[_0x99b9e1][_0x43e7('0x35')]({'exitAt':_0x2de14f});}});for(var _0x23a611=0x0;_0x23a611<_0x4a4a85[_0x43e7('0x20')][_0x43e7('0x2e')][_0x3d81ae][_0x43e7('0x32')];_0x23a611+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x3d81ae,'membername':_0x4a4a85[_0x43e7('0x2f')][_0x43e7('0xe')],'type':_0x43e7('0x36'),'uniqueid':_0x4a4a85['body']['interaction'][_0x3d81ae][_0x23a611],'exitAt':null},'defaults':{'channel':_0x3d81ae,'membername':_0x4a4a85['user'][_0x43e7('0xe')],'interface':_[_0x43e7('0x10')](_0x4a4a85['user'][_0x43e7('0x37')])?util[_0x43e7('0x33')](_0x43e7('0x38'),_0x4a4a85['user']['name']):_0x4a4a85['user']['interface'],'type':_0x43e7('0x36'),'enterAt':moment()[_0x43e7('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x43e7('0x39'),'internal':_0x4a4a85[_0x43e7('0x2f')][_0x43e7('0x3a')],'uniqueid':_0x4a4a85[_0x43e7('0x20')]['interaction'][_0x3d81ae][_0x23a611]}});}}}}return respondWithRpcPromise(_0x43e7('0x3b'),{'id':_0x4a4a85['params']['id'],'capacity':_0x4a4a85['body'][_0x43e7('0x3c')]},routingClient)[_0x43e7('0x7')](respondWithResult(_0x32a451,null))[_0x43e7('0x16')](handleError(_0x32a451,null));};exports[_0x43e7('0x3d')]=function(_0x13503c,_0x2351cf){return respondWithRpcPromise(_0x43e7('0x3e'),_0x13503c[_0x43e7('0x15')])[_0x43e7('0x7')](respondWithResult(_0x2351cf,null))[_0x43e7('0x16')](handleError(_0x2351cf,null));};exports['trunks']=function(_0x119d34,_0x46c910){return respondWithRpcPromise('Trunks',_0x119d34[_0x43e7('0x15')])['then'](respondWithResult(_0x46c910,null))[_0x43e7('0x16')](handleError(_0x46c910,null));};exports[_0x43e7('0x3f')]=function(_0x34e2ec,_0x1f561f){return respondWithRpcPromise(_0x43e7('0x40'),_0x34e2ec['query'])['then'](respondWithResult(_0x1f561f,null))[_0x43e7('0x16')](handleError(_0x1f561f,null));};exports[_0x43e7('0x41')]=function(_0x399942,_0x29c53d){return respondWithRpcPromise(_0x43e7('0x42'),_0x399942[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](respondWithResult(_0x29c53d,null))[_0x43e7('0x16')](handleError(_0x29c53d,null));};exports[_0x43e7('0x43')]=function(_0x24e758,_0x312306){return respondWithRpcPromise('ChatQueues',_0x24e758[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](findById(_0x24e758['params']['id']))[_0x43e7('0x7')](respondWithResult(_0x312306,null))[_0x43e7('0x16')](handleError(_0x312306,null));};exports[_0x43e7('0x44')]=function(_0x558d54,_0x5d63c6){return respondWithRpcPromise(_0x43e7('0x45'),_0x558d54[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x5d63c6,null))[_0x43e7('0x16')](handleError(_0x5d63c6,null));};exports['showMailQueues']=function(_0x49a6ce,_0x1fa3f6){return respondWithRpcPromise(_0x43e7('0x45'),_0x49a6ce[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](findById(_0x49a6ce[_0x43e7('0x1a')]['id']))['then'](respondWithResult(_0x1fa3f6,null))[_0x43e7('0x16')](handleError(_0x1fa3f6,null));};exports[_0x43e7('0x46')]=function(_0x4d89bd,_0x20283b){return respondWithRpcPromise(_0x43e7('0x47'),_0x4d89bd[_0x43e7('0x15')],mailClient)['then'](respondWithResult(_0x20283b,null))['catch'](handleError(_0x20283b,null));};exports['openchannelQueues']=function(_0x2ada55,_0x4058ce){return respondWithRpcPromise(_0x43e7('0x48'),_0x2ada55[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x4058ce,null))['catch'](handleError(_0x4058ce,null));};exports[_0x43e7('0x49')]=function(_0x8b50bb,_0x140438){return respondWithRpcPromise(_0x43e7('0x48'),_0x8b50bb['query'],routingClient)[_0x43e7('0x7')](findById(_0x8b50bb[_0x43e7('0x1a')]['id']))[_0x43e7('0x7')](respondWithResult(_0x140438,null))[_0x43e7('0x16')](handleError(_0x140438,null));};exports[_0x43e7('0x4a')]=function(_0xd41e79,_0x4665db){return respondWithRpcPromise(_0x43e7('0x4b'),_0xd41e79[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](respondWithResult(_0x4665db,null))[_0x43e7('0x16')](handleError(_0x4665db,null));};exports['showSmsQueues']=function(_0x5f3824,_0x2b0711){return respondWithRpcPromise('SmsQueues',_0x5f3824['query'],routingClient)['then'](findById(_0x5f3824[_0x43e7('0x1a')]['id']))[_0x43e7('0x7')](respondWithResult(_0x2b0711,null))['catch'](handleError(_0x2b0711,null));};exports[_0x43e7('0x4c')]=function(_0x135791,_0x1d8438){return respondWithRpcPromise('WhatsappQueues',_0x135791[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](respondWithResult(_0x1d8438,null))[_0x43e7('0x16')](handleError(_0x1d8438,null));};exports[_0x43e7('0x4d')]=function(_0x2f43d7,_0x472a19){return respondWithRpcPromise(_0x43e7('0x4e'),_0x2f43d7['query'],routingClient)[_0x43e7('0x7')](findById(_0x2f43d7[_0x43e7('0x1a')]['id']))[_0x43e7('0x7')](respondWithResult(_0x472a19,null))['catch'](handleError(_0x472a19,null));};exports['faxQueues']=function(_0x30377a,_0x5c3ad8){return respondWithRpcPromise('FaxQueues',_0x30377a[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](respondWithResult(_0x5c3ad8,null))['catch'](handleError(_0x5c3ad8,null));};exports[_0x43e7('0x4f')]=function(_0x28b21d,_0x1e2fed){return respondWithRpcPromise(_0x43e7('0x50'),_0x28b21d[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](findById(_0x28b21d[_0x43e7('0x1a')]['id']))['then'](respondWithResult(_0x1e2fed,null))[_0x43e7('0x16')](handleError(_0x1e2fed,null));};exports[_0x43e7('0x51')]=function(_0x4e5956,_0x418213){return respondWithRpcPromise('FaxAccounts',_0x4e5956[_0x43e7('0x15')])[_0x43e7('0x7')](respondWithResult(_0x418213,null))[_0x43e7('0x16')](handleError(_0x418213,null));};exports[_0x43e7('0x52')]=function(_0x506361,_0x2d25b5){return respondWithRpcPromise(_0x43e7('0x53'),_0x506361[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x2d25b5,null))[_0x43e7('0x16')](handleError(_0x2d25b5,null));};exports[_0x43e7('0x54')]=function(_0x219dc6,_0x703a30){return respondWithRpcPromise(_0x43e7('0x55'),_0x219dc6['query'],routingClient)[_0x43e7('0x7')](respondWithResult(_0x703a30,null))[_0x43e7('0x16')](handleError(_0x703a30,null));};exports[_0x43e7('0x56')]=function(_0x2499ef,_0x433d3c){return respondWithRpcPromise(_0x43e7('0x57'),_0x2499ef[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x433d3c,null))['catch'](handleError(_0x433d3c,null));};exports[_0x43e7('0x58')]=function(_0x536477,_0x550036){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x536477[_0x43e7('0x15')],routingClient)[_0x43e7('0x7')](function(_0x230fda){if(_0x536477[_0x43e7('0x15')][_0x43e7('0x59')]!==undefined){var _0x1ae0c8=_(_0x230fda['rows'])[_0x43e7('0x5a')]([_0x536477[_0x43e7('0x15')][_0x43e7('0x59')],_0x536477['params']['id']])[_0x43e7('0x5b')](_0x43e7('0x5c'))[_0x43e7('0x5d')]()[_0x43e7('0x5e')]();return _0x230fda[_0x43e7('0x12')][_0x43e7('0x5a')](function(_0x1d4a29){return _0x1ae0c8[_0x43e7('0x5f')](_0x1d4a29['queue_id'])>-0x1;});}else{return _0x230fda['rows']['filter'](function(_0x156074){return _0x156074[_0x43e7('0x5c')]===parseInt(_0x536477['params']['id']);});}})[_0x43e7('0x7')](respondWithResult(_0x550036,null))[_0x43e7('0x16')](handleError(_0x550036,null));};exports[_0x43e7('0x60')]=function(_0x8e60f1,_0x5a5565){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x8e60f1['query'],routingClient)[_0x43e7('0x7')](respondWithResult(_0x5a5565,null))[_0x43e7('0x16')](handleError(_0x5a5565,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x58cbb7,_0x21adf7){return respondWithRpcPromise(_0x43e7('0x61'),_0x58cbb7[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0x21adf7,null))[_0x43e7('0x16')](handleError(_0x21adf7,null));};exports[_0x43e7('0x62')]=function(_0x401654,_0xb04082){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x401654[_0x43e7('0x15')],routingClient)['then'](respondWithResult(_0xb04082,null))[_0x43e7('0x16')](handleError(_0xb04082,null));};exports[_0x43e7('0x63')]=function(_0x24a168){return function(_0x90667c,_0xa7cb2c){var _0x45adef,_0x126133;var _0x5e8d4e=_[_0x43e7('0x64')](_0x24a168);var _0x40257e=_0x24a168===_0x43e7('0x65')?_0x43e7('0x66'):'Account';return db[_0x5e8d4e+'Queue']['findOne']({'raw':!![],'where':{'id':_0x90667c[_0x43e7('0x1a')]['id']}})['then'](function(_0x240f0d){if(_[_0x43e7('0x10')](_0x240f0d)){throw new Error(_0x5e8d4e+_0x43e7('0x67'));}_0x45adef=_0x240f0d;return db[_0x5e8d4e+_0x43e7('0x68')][_0x43e7('0x69')]({'where':{'id':_0x90667c[_0x43e7('0x20')][_0x43e7('0x6a')]},'include':[{'model':db[_0x5e8d4e+_0x43e7('0x6b')],'as':_0x43e7('0x6b')},{'model':db[_0x5e8d4e+_0x40257e],'as':_0x43e7('0x6c')}]});})[_0x43e7('0x7')](function(_0x5b3565){if(_[_0x43e7('0x10')](_0x5b3565)){throw new Error(_0x5e8d4e+_0x43e7('0x6d'));}_0x126133=_0x5b3565;return _0x5b3565[_0x43e7('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x43e7('0x7')](function(){var _0x206e54={'uniqueid':_0x24a168+'.'+_0x126133['id']+'.'+_0x126133['Interaction']['id'],'FromUserId':_0x90667c['user']['id'],'type':_0x43e7('0x6f')};_0x206e54[_0x5e8d4e+_0x43e7('0x70')]=_0x126133['id'];_0x206e54[_0x5e8d4e+'InteractionId']=_0x126133[_0x43e7('0x6b')]['id'];_0x206e54[_0x43e7('0x71')+_0x5e8d4e+_0x40257e+'Id']=_0x126133['Account']['id'];_0x206e54['To'+_0x5e8d4e+'QueueId']=_0x45adef['id'];return db[_0x5e8d4e+_0x43e7('0x72')][_0x43e7('0x73')](_0x206e54);})[_0x43e7('0x7')](function(){return respondWithRpcPromise(_0x43e7('0x74'),{'channel':_0x24a168,'interaction':_0x126133[_0x43e7('0x6b')],'message':_0x126133,'account':_0x126133['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x45adef[_0x43e7('0xe')]+','+(_0x126133[_0x43e7('0x6c')][_0x43e7('0x75')]||0x12c),'interval':_0x43e7('0x76')}]},routingClient);})['then'](respondWithResult(_0xa7cb2c,null))[_0x43e7('0x16')](handleError(_0xa7cb2c,null));};};exports[_0x43e7('0x77')]=function(_0x1ed590,_0x15ee83){var _0x5bc060,_0x3a4962;if(_[_0x43e7('0x10')](_0x1ed590[_0x43e7('0x20')][_0x43e7('0x78')])){throw new Error(_0x43e7('0x79'));}var _0x4ef289=_0x1ed590[_0x43e7('0x20')][_0x43e7('0x78')];var _0x509d8d=_[_0x43e7('0x64')](_0x4ef289);var _0x2ca6fb=_0x4ef289===_0x43e7('0x65')?_0x43e7('0x66'):'Account';return db[_0x43e7('0x7a')]['findOne']({'raw':!![],'where':{'id':_0x1ed590[_0x43e7('0x1a')]['id'],'role':_0x43e7('0x39')}})[_0x43e7('0x7')](function(_0x2614ff){if(_[_0x43e7('0x10')](_0x2614ff)){throw new Error(_0x43e7('0x7b'));}_0x5bc060=_0x2614ff;return db[_0x509d8d+_0x43e7('0x68')][_0x43e7('0x69')]({'where':{'id':_0x1ed590[_0x43e7('0x20')]['messageId']},'include':[{'model':db[_0x509d8d+_0x43e7('0x6b')],'as':_0x43e7('0x6b')},{'model':db[_0x509d8d+_0x2ca6fb],'as':_0x43e7('0x6c')}]});})[_0x43e7('0x7')](function(_0x56593f){if(_['isNil'](_0x56593f)){throw new Error(_0x509d8d+_0x43e7('0x6d'));}_0x3a4962=_0x56593f;return _0x56593f[_0x43e7('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x43e7('0x7')](function(){var _0x4d30f7={'uniqueid':_0x4ef289+'.'+_0x3a4962['id']+'.'+_0x3a4962[_0x43e7('0x6b')]['id'],'FromUserId':_0x1ed590['user']['id'],'type':'queue','ToUserId':_0x5bc060['id']};_0x4d30f7[_0x509d8d+'MessageId']=_0x3a4962['id'];_0x4d30f7[_0x509d8d+_0x43e7('0x7c')]=_0x3a4962['Interaction']['id'];_0x4d30f7[_0x43e7('0x71')+_0x509d8d+_0x2ca6fb+'Id']=_0x3a4962[_0x43e7('0x6c')]['id'];return db[_0x509d8d+_0x43e7('0x72')][_0x43e7('0x73')](_0x4d30f7);})[_0x43e7('0x7')](function(){return respondWithRpcPromise('Start',{'channel':_0x4ef289,'interaction':_0x3a4962['Interaction'],'message':_0x3a4962,'account':_0x3a4962[_0x43e7('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x43e7('0x39'),'appdata':_0x5bc060['name']+','+(_0x3a4962[_0x43e7('0x6c')][_0x43e7('0x7d')]||0x12c),'interval':_0x43e7('0x76')}]},routingClient);})[_0x43e7('0x7')](respondWithResult(_0x15ee83,null))[_0x43e7('0x16')](handleError(_0x15ee83,null));}; \ No newline at end of file +var _0xabce=['InteractionId','From','QueueId','TransferReport','create','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','update','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','jayson/promise','client','http','request','then','error','code','message','result','catch','json','sendStatus','stack','name','status','send','isNil','rows','find','voiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','Agents','agentCapacity','interaction','MemberReport','findAll','user','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','AgentCapacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','showWhatsappQueues','FaxAccounts','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','value','indexOf','queue_id','filter','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','queue','MessageId'];(function(_0x310d10,_0x3fe887){var _0x1fb8af=function(_0x42965b){while(--_0x42965b){_0x310d10['push'](_0x310d10['shift']());}};_0x1fb8af(++_0x3fe887);}(_0xabce,0x103));var _0xeabc=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xabce[_0x521929];return _0x632436;};'use strict';var BPromise=require(_0xeabc('0x0'));var moment=require(_0xeabc('0x1'));var _=require(_0xeabc('0x2'));var util=require(_0xeabc('0x3'));var db=require(_0xeabc('0x4'))['db'];var logger=require('../../config/logger')('api');var jayson=require(_0xeabc('0x5'));var amiClient=jayson[_0xeabc('0x6')][_0xeabc('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0xeabc('0x6')]['http']({'port':0x232c});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){var _0x5d59d5=_0x3bdc29?_0x3bdc29:amiClient;return _0x5d59d5[_0xeabc('0x8')](_0x229ba4,_0x52ede8)[_0xeabc('0x9')](function(_0x2f73e9){if(_0x2f73e9[_0xeabc('0xa')]){if(_0x2f73e9[_0xeabc('0xa')][_0xeabc('0xb')]===0x1f4){return _0x8434c5(_0x2f73e9[_0xeabc('0xa')][_0xeabc('0xc')]);}return _0x9417af(_0x2f73e9[_0xeabc('0xa')][_0xeabc('0xc')]);}else{_0x9417af(_0x2f73e9[_0xeabc('0xd')]);}})[_0xeabc('0xe')](function(_0x435ea7){_0x8434c5(_0x435ea7);});});}function respondWithResult(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xc8;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['status'](_0x36a92e)[_0xeabc('0xf')](_0xcfbf06);}return _0x3fd0b5[_0xeabc('0x10')](0x194);};}function handleError(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0x1f4;return function(_0x5f4ee8){logger[_0xeabc('0xa')](_0x5f4ee8[_0xeabc('0x11')]);if(_0x5f4ee8[_0xeabc('0x12')]){delete _0x5f4ee8['name'];}_0x3251c6[_0xeabc('0x13')](_0x55f0de)[_0xeabc('0x14')](_0x5f4ee8);};}function findById(_0x49f2d8){return function(_0x53fe28){if(!_[_0xeabc('0x15')](_0x49f2d8)&&!_['isNil'](_0x53fe28)&&!_[_0xeabc('0x15')](_0x53fe28[_0xeabc('0x16')])){return _[_0xeabc('0x17')](_0x53fe28[_0xeabc('0x16')],function(_0x31dd53){return _0x31dd53['id']==_0x49f2d8;});}return null;};}exports[_0xeabc('0x18')]=function(_0x384be5,_0x5e30ee){return respondWithRpcPromise('VoiceChannels',_0x384be5[_0xeabc('0x19')])['then'](respondWithResult(_0x5e30ee,null))[_0xeabc('0xe')](handleError(_0x5e30ee,null));};exports[_0xeabc('0x1a')]=function(_0x502947,_0x28063a){return respondWithRpcPromise(_0xeabc('0x1b'),_[_0xeabc('0x1c')](_0x502947[_0xeabc('0x19')],_0x502947[_0xeabc('0x1d')]))['then'](respondWithResult(_0x28063a,null))[_0xeabc('0xe')](handleError(_0x28063a,null));};exports[_0xeabc('0x1e')]=function(_0x91ab00,_0x5bdd57){return respondWithRpcPromise(_0xeabc('0x1f'),_[_0xeabc('0x1c')](_0x91ab00[_0xeabc('0x19')],_0x91ab00[_0xeabc('0x1d')]))['then'](respondWithResult(_0x5bdd57,null))[_0xeabc('0xe')](handleError(_0x5bdd57,null));};exports['voiceQueues']=function(_0x27dbaf,_0x4d4e29){return respondWithRpcPromise(_0xeabc('0x20'),_0x27dbaf[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x4d4e29,null))[_0xeabc('0xe')](handleError(_0x4d4e29,null));};exports[_0xeabc('0x21')]=function(_0x137293,_0x131722){return respondWithRpcPromise('VoiceQueues',_0x137293['query'])[_0xeabc('0x9')](findById(_0x137293['params']['id']))[_0xeabc('0x9')](respondWithResult(_0x131722,null))[_0xeabc('0xe')](handleError(_0x131722,null));};exports['updateVoiceQueue']=function(_0x2163e6,_0x38572d){return respondWithRpcPromise(_0xeabc('0x22'),_[_0xeabc('0x1c')](_0x2163e6[_0xeabc('0x23')],_0x2163e6[_0xeabc('0x1d')]))[_0xeabc('0x9')](respondWithResult(_0x38572d,null))[_0xeabc('0xe')](handleError(_0x38572d,null));};exports[_0xeabc('0x24')]=function(_0x5ebb86,_0x5b34dd){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xeabc('0x1c')](_0x5ebb86[_0xeabc('0x19')],_0x5ebb86[_0xeabc('0x1d')]))[_0xeabc('0x9')](respondWithResult(_0x5b34dd,null))[_0xeabc('0xe')](handleError(_0x5b34dd,null));};exports[_0xeabc('0x25')]=function(_0x61c0af,_0x545d7f){return respondWithRpcPromise(_0xeabc('0x26'),_0x61c0af[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x545d7f,null))['catch'](handleError(_0x545d7f,null));};exports[_0xeabc('0x27')]=function(_0x3777c1,_0x4492fd){return respondWithRpcPromise('VoiceQueuesChannel',_[_0xeabc('0x1c')](_0x3777c1[_0xeabc('0x19')],_0x3777c1[_0xeabc('0x1d')]))['then'](respondWithResult(_0x4492fd,null))[_0xeabc('0xe')](handleError(_0x4492fd,null));};exports[_0xeabc('0x28')]=function(_0x5d9acf,_0x50cca2){return respondWithRpcPromise(_0xeabc('0x29'),_[_0xeabc('0x1c')](_0x5d9acf['query'],_0x5d9acf[_0xeabc('0x1d')]))[_0xeabc('0x9')](respondWithResult(_0x50cca2,null))[_0xeabc('0xe')](handleError(_0x50cca2,null));};exports[_0xeabc('0x2a')]=function(_0x34057c,_0x4b7923){return respondWithRpcPromise(_0xeabc('0x2b'),_['merge'](_0x34057c[_0xeabc('0x19')],_0x34057c[_0xeabc('0x1d')]))[_0xeabc('0x9')](respondWithResult(_0x4b7923,null))['catch'](handleError(_0x4b7923,null));};exports['outbound']=function(_0x452580,_0x560d4a){return respondWithRpcPromise(_0xeabc('0x2c'),_0x452580['query'])['then'](respondWithResult(_0x560d4a,null))['catch'](handleError(_0x560d4a,null));};exports['outboundChannels']=function(_0x1e222a,_0x593588){return respondWithRpcPromise(_0xeabc('0x2d'),_0x1e222a[_0xeabc('0x19')])['then'](respondWithResult(_0x593588,null))[_0xeabc('0xe')](handleError(_0x593588,null));};exports['agents']=function(_0x3d48f4,_0x58aafe){var _0xbd7f03;return respondWithRpcPromise(_0xeabc('0x2e'),_0x3d48f4[_0xeabc('0x19')])['then'](function(_0x5a00d0){_0xbd7f03=_0x5a00d0;return respondWithRpcPromise('Agents',_0x3d48f4[_0xeabc('0x19')],routingClient);})[_0xeabc('0x9')](function(_0xafa59b){return _['merge']({},_0xafa59b,_0xbd7f03);})['then'](respondWithResult(_0x58aafe,null))[_0xeabc('0xe')](handleError(_0x58aafe,null));};exports[_0xeabc('0x2f')]=function(_0x5e9cb3,_0xc6af4d){if(_0x5e9cb3['body']&&_0x5e9cb3[_0xeabc('0x23')]['interaction']&&_0x5e9cb3['user']&&_0x5e9cb3['user'][_0xeabc('0x12')]){for(var _0x37c926 in _0x5e9cb3[_0xeabc('0x23')][_0xeabc('0x30')]){if(_0x5e9cb3['body'][_0xeabc('0x30')]['hasOwnProperty'](_0x37c926)){db[_0xeabc('0x31')][_0xeabc('0x32')]({'where':{'channel':_0x37c926,'membername':_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x12')],'type':_0xeabc('0x34'),'exitAt':null,'uniqueid':_0x5e9cb3['body']['interaction'][_0x37c926]&&_0x5e9cb3[_0xeabc('0x23')]['interaction'][_0x37c926][_0xeabc('0x35')]?{'$notIn':_0x5e9cb3[_0xeabc('0x23')]['interaction'][_0x37c926]}:{'$ne':null}}})[_0xeabc('0x9')](function(_0x2b3c28){var _0x459c98=moment()[_0xeabc('0x36')](_0xeabc('0x37'));for(var _0xcaa5b9=0x0,_0x2003a7=_0x2b3c28['length'];_0xcaa5b9<_0x2003a7;_0xcaa5b9+=0x1){_0x2b3c28[_0xcaa5b9][_0xeabc('0x38')]({'exitAt':_0x459c98});}});for(var _0x2c85f0=0x0;_0x2c85f0<_0x5e9cb3[_0xeabc('0x23')][_0xeabc('0x30')][_0x37c926][_0xeabc('0x35')];_0x2c85f0+=0x1){db[_0xeabc('0x31')][_0xeabc('0x39')]({'where':{'channel':_0x37c926,'membername':_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x12')],'type':_0xeabc('0x34'),'uniqueid':_0x5e9cb3['body'][_0xeabc('0x30')][_0x37c926][_0x2c85f0],'exitAt':null},'defaults':{'channel':_0x37c926,'membername':_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x12')],'interface':_[_0xeabc('0x15')](_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x3a')])?util[_0xeabc('0x36')]('SIP/%s',_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x12')]):_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x3a')],'type':_0xeabc('0x34'),'enterAt':moment()['format'](_0xeabc('0x37')),'role':_0xeabc('0x3b'),'internal':_0x5e9cb3[_0xeabc('0x33')][_0xeabc('0x3c')],'uniqueid':_0x5e9cb3['body'][_0xeabc('0x30')][_0x37c926][_0x2c85f0]}});}}}}return respondWithRpcPromise(_0xeabc('0x3d'),{'id':_0x5e9cb3['params']['id'],'capacity':_0x5e9cb3[_0xeabc('0x23')]['capacity']},routingClient)[_0xeabc('0x9')](respondWithResult(_0xc6af4d,null))['catch'](handleError(_0xc6af4d,null));};exports[_0xeabc('0x3e')]=function(_0x2ec94c,_0x38f988){return respondWithRpcPromise(_0xeabc('0x3f'),_0x2ec94c[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x38f988,null))[_0xeabc('0xe')](handleError(_0x38f988,null));};exports[_0xeabc('0x40')]=function(_0x31aedf,_0x6423f3){return respondWithRpcPromise('Trunks',_0x31aedf[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x6423f3,null))[_0xeabc('0xe')](handleError(_0x6423f3,null));};exports[_0xeabc('0x41')]=function(_0x555d6b,_0x1cef45){return respondWithRpcPromise(_0xeabc('0x42'),_0x555d6b[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x1cef45,null))['catch'](handleError(_0x1cef45,null));};exports[_0xeabc('0x43')]=function(_0x1c7679,_0x3a1b84){return respondWithRpcPromise(_0xeabc('0x44'),_0x1c7679[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x3a1b84,null))[_0xeabc('0xe')](handleError(_0x3a1b84,null));};exports[_0xeabc('0x45')]=function(_0x17acf8,_0x58ab08){return respondWithRpcPromise(_0xeabc('0x44'),_0x17acf8['query'],routingClient)['then'](findById(_0x17acf8['params']['id']))[_0xeabc('0x9')](respondWithResult(_0x58ab08,null))[_0xeabc('0xe')](handleError(_0x58ab08,null));};exports[_0xeabc('0x46')]=function(_0xb35103,_0xe89728){return respondWithRpcPromise(_0xeabc('0x47'),_0xb35103['query'],routingClient)[_0xeabc('0x9')](respondWithResult(_0xe89728,null))[_0xeabc('0xe')](handleError(_0xe89728,null));};exports[_0xeabc('0x48')]=function(_0x104c1e,_0x2ddc53){return respondWithRpcPromise(_0xeabc('0x47'),_0x104c1e[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](findById(_0x104c1e['params']['id']))['then'](respondWithResult(_0x2ddc53,null))[_0xeabc('0xe')](handleError(_0x2ddc53,null));};exports[_0xeabc('0x49')]=function(_0x2c0894,_0x4b3794){return respondWithRpcPromise(_0xeabc('0x4a'),_0x2c0894['query'],mailClient)['then'](respondWithResult(_0x4b3794,null))[_0xeabc('0xe')](handleError(_0x4b3794,null));};exports[_0xeabc('0x4b')]=function(_0x13f04f,_0x4f5451){return respondWithRpcPromise(_0xeabc('0x4c'),_0x13f04f[_0xeabc('0x19')],routingClient)['then'](respondWithResult(_0x4f5451,null))[_0xeabc('0xe')](handleError(_0x4f5451,null));};exports[_0xeabc('0x4d')]=function(_0x321a90,_0x7697f7){return respondWithRpcPromise(_0xeabc('0x4c'),_0x321a90[_0xeabc('0x19')],routingClient)['then'](findById(_0x321a90[_0xeabc('0x1d')]['id']))[_0xeabc('0x9')](respondWithResult(_0x7697f7,null))[_0xeabc('0xe')](handleError(_0x7697f7,null));};exports[_0xeabc('0x4e')]=function(_0x1b61a8,_0x19faa4){return respondWithRpcPromise(_0xeabc('0x4f'),_0x1b61a8[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x19faa4,null))['catch'](handleError(_0x19faa4,null));};exports[_0xeabc('0x50')]=function(_0x590439,_0x404846){return respondWithRpcPromise(_0xeabc('0x4f'),_0x590439[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](findById(_0x590439[_0xeabc('0x1d')]['id']))[_0xeabc('0x9')](respondWithResult(_0x404846,null))[_0xeabc('0xe')](handleError(_0x404846,null));};exports[_0xeabc('0x51')]=function(_0x5d4bc2,_0x24d0e5){return respondWithRpcPromise('WhatsappQueues',_0x5d4bc2[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x24d0e5,null))[_0xeabc('0xe')](handleError(_0x24d0e5,null));};exports[_0xeabc('0x52')]=function(_0x5b4430,_0x12fd48){return respondWithRpcPromise('WhatsappQueues',_0x5b4430['query'],routingClient)[_0xeabc('0x9')](findById(_0x5b4430[_0xeabc('0x1d')]['id']))[_0xeabc('0x9')](respondWithResult(_0x12fd48,null))[_0xeabc('0xe')](handleError(_0x12fd48,null));};exports['faxQueues']=function(_0x51a0c7,_0x2e712e){return respondWithRpcPromise('FaxQueues',_0x51a0c7['query'],routingClient)[_0xeabc('0x9')](respondWithResult(_0x2e712e,null))['catch'](handleError(_0x2e712e,null));};exports['showFaxQueues']=function(_0xa44f2d,_0x1c84b5){return respondWithRpcPromise('FaxQueues',_0xa44f2d['query'],routingClient)[_0xeabc('0x9')](findById(_0xa44f2d['params']['id']))[_0xeabc('0x9')](respondWithResult(_0x1c84b5,null))[_0xeabc('0xe')](handleError(_0x1c84b5,null));};exports['faxAccounts']=function(_0x5d6477,_0x24365a){return respondWithRpcPromise(_0xeabc('0x53'),_0x5d6477[_0xeabc('0x19')])[_0xeabc('0x9')](respondWithResult(_0x24365a,null))[_0xeabc('0xe')](handleError(_0x24365a,null));};exports['chatQueuesWaitingInteractions']=function(_0x53f578,_0x391cae){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x53f578[_0xeabc('0x19')],routingClient)['then'](respondWithResult(_0x391cae,null))[_0xeabc('0xe')](handleError(_0x391cae,null));};exports['mailQueuesWaitingInteractions']=function(_0x1fdaba,_0x53ac31){return respondWithRpcPromise(_0xeabc('0x54'),_0x1fdaba[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x53ac31,null))[_0xeabc('0xe')](handleError(_0x53ac31,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x6ee7cf,_0x4fa682){return respondWithRpcPromise(_0xeabc('0x55'),_0x6ee7cf[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](respondWithResult(_0x4fa682,null))[_0xeabc('0xe')](handleError(_0x4fa682,null));};exports[_0xeabc('0x56')]=function(_0x5c1ab2,_0x239350){return respondWithRpcPromise(_0xeabc('0x55'),_0x5c1ab2[_0xeabc('0x19')],routingClient)[_0xeabc('0x9')](function(_0x5427c8){if(_0x5c1ab2[_0xeabc('0x19')][_0xeabc('0x57')]!==undefined){var _0xe60b11=_(_0x5427c8[_0xeabc('0x16')])['filter']([_0x5c1ab2[_0xeabc('0x19')][_0xeabc('0x57')],_0x5c1ab2[_0xeabc('0x1d')]['id']])[_0xeabc('0x58')]('queue_id')['uniq']()[_0xeabc('0x59')]();return _0x5427c8['rows']['filter'](function(_0x3271b6){return _0xe60b11[_0xeabc('0x5a')](_0x3271b6[_0xeabc('0x5b')])>-0x1;});}else{return _0x5427c8['rows'][_0xeabc('0x5c')](function(_0x403b18){return _0x403b18['queue_id']===parseInt(_0x5c1ab2[_0xeabc('0x1d')]['id']);});}})[_0xeabc('0x9')](respondWithResult(_0x239350,null))[_0xeabc('0xe')](handleError(_0x239350,null));};exports[_0xeabc('0x5d')]=function(_0x2ece2c,_0x4bf9d8){return respondWithRpcPromise(_0xeabc('0x5e'),_0x2ece2c['query'],routingClient)['then'](respondWithResult(_0x4bf9d8,null))['catch'](handleError(_0x4bf9d8,null));};exports[_0xeabc('0x5f')]=function(_0x1c8a51,_0x1b6e9e){return respondWithRpcPromise(_0xeabc('0x60'),_0x1c8a51[_0xeabc('0x19')],routingClient)['then'](respondWithResult(_0x1b6e9e,null))[_0xeabc('0xe')](handleError(_0x1b6e9e,null));};exports['faxQueuesWaitingInteractions']=function(_0x1795fe,_0x2f95c7){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x1795fe[_0xeabc('0x19')],routingClient)['then'](respondWithResult(_0x2f95c7,null))['catch'](handleError(_0x2f95c7,null));};exports[_0xeabc('0x61')]=function(_0xa5c4ca){return function(_0x439a48,_0x3acb88){var _0x3c6a49,_0x4dfc4b;var _0x399735=_[_0xeabc('0x62')](_0xa5c4ca);var _0x33e5fb=_0xa5c4ca===_0xeabc('0x63')?_0xeabc('0x64'):_0xeabc('0x65');return db[_0x399735+_0xeabc('0x66')][_0xeabc('0x67')]({'raw':!![],'where':{'id':_0x439a48[_0xeabc('0x1d')]['id']}})[_0xeabc('0x9')](function(_0x522c6e){if(_[_0xeabc('0x15')](_0x522c6e)){throw new Error(_0x399735+_0xeabc('0x68'));}_0x3c6a49=_0x522c6e;return db[_0x399735+_0xeabc('0x69')]['findOne']({'where':{'id':_0x439a48['body'][_0xeabc('0x6a')]},'include':[{'model':db[_0x399735+_0xeabc('0x6b')],'as':_0xeabc('0x6b')},{'model':db[_0x399735+_0x33e5fb],'as':_0xeabc('0x65')}]});})[_0xeabc('0x9')](function(_0x5f5a47){if(_[_0xeabc('0x15')](_0x5f5a47)){throw new Error(_0x399735+'\x20Message\x20not\x20found');}_0x4dfc4b=_0x5f5a47;return _0x5f5a47['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xeabc('0x9')](function(){var _0x302e94={'uniqueid':_0xa5c4ca+'.'+_0x4dfc4b['id']+'.'+_0x4dfc4b['Interaction']['id'],'FromUserId':_0x439a48[_0xeabc('0x33')]['id'],'type':_0xeabc('0x6c')};_0x302e94[_0x399735+_0xeabc('0x6d')]=_0x4dfc4b['id'];_0x302e94[_0x399735+_0xeabc('0x6e')]=_0x4dfc4b[_0xeabc('0x6b')]['id'];_0x302e94[_0xeabc('0x6f')+_0x399735+_0x33e5fb+'Id']=_0x4dfc4b[_0xeabc('0x65')]['id'];_0x302e94['To'+_0x399735+_0xeabc('0x70')]=_0x3c6a49['id'];return db[_0x399735+_0xeabc('0x71')][_0xeabc('0x72')](_0x302e94);})[_0xeabc('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0xa5c4ca,'interaction':_0x4dfc4b[_0xeabc('0x6b')],'message':_0x4dfc4b,'account':_0x4dfc4b['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xeabc('0x6c'),'appdata':_0x3c6a49[_0xeabc('0x12')]+','+(_0x4dfc4b[_0xeabc('0x65')][_0xeabc('0x73')]||0x12c),'interval':_0xeabc('0x74')}]},routingClient);})[_0xeabc('0x9')](respondWithResult(_0x3acb88,null))[_0xeabc('0xe')](handleError(_0x3acb88,null));};};exports[_0xeabc('0x75')]=function(_0xb85c3d,_0x156e20){var _0x42e92b,_0x5d471f;if(_[_0xeabc('0x15')](_0xb85c3d[_0xeabc('0x23')][_0xeabc('0x76')])){throw new Error(_0xeabc('0x77'));}var _0x5b00d6=_0xb85c3d[_0xeabc('0x23')][_0xeabc('0x76')];var _0x580661=_[_0xeabc('0x62')](_0x5b00d6);var _0x22ef88=_0x5b00d6==='chat'?'Website':'Account';return db['User'][_0xeabc('0x67')]({'raw':!![],'where':{'id':_0xb85c3d[_0xeabc('0x1d')]['id'],'role':_0xeabc('0x3b')}})[_0xeabc('0x9')](function(_0x1d8dca){if(_[_0xeabc('0x15')](_0x1d8dca)){throw new Error(_0xeabc('0x78'));}_0x42e92b=_0x1d8dca;return db[_0x580661+_0xeabc('0x69')][_0xeabc('0x67')]({'where':{'id':_0xb85c3d[_0xeabc('0x23')]['messageId']},'include':[{'model':db[_0x580661+_0xeabc('0x6b')],'as':_0xeabc('0x6b')},{'model':db[_0x580661+_0x22ef88],'as':'Account'}]});})[_0xeabc('0x9')](function(_0x32063c){if(_[_0xeabc('0x15')](_0x32063c)){throw new Error(_0x580661+'\x20Message\x20not\x20found');}_0x5d471f=_0x32063c;return _0x32063c[_0xeabc('0x79')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x425e5c={'uniqueid':_0x5b00d6+'.'+_0x5d471f['id']+'.'+_0x5d471f[_0xeabc('0x6b')]['id'],'FromUserId':_0xb85c3d[_0xeabc('0x33')]['id'],'type':_0xeabc('0x6c'),'ToUserId':_0x42e92b['id']};_0x425e5c[_0x580661+_0xeabc('0x6d')]=_0x5d471f['id'];_0x425e5c[_0x580661+'InteractionId']=_0x5d471f['Interaction']['id'];_0x425e5c['From'+_0x580661+_0x22ef88+'Id']=_0x5d471f['Account']['id'];return db[_0x580661+_0xeabc('0x71')][_0xeabc('0x72')](_0x425e5c);})[_0xeabc('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x5b00d6,'interaction':_0x5d471f[_0xeabc('0x6b')],'message':_0x5d471f,'account':_0x5d471f[_0xeabc('0x65')],'applications':[{'id':0x0,'priority':0x1,'app':_0xeabc('0x3b'),'appdata':_0x42e92b[_0xeabc('0x12')]+','+(_0x5d471f[_0xeabc('0x65')][_0xeabc('0x7a')]||0x12c),'interval':_0xeabc('0x74')}]},routingClient);})[_0xeabc('0x9')](respondWithResult(_0x156e20,null))[_0xeabc('0xe')](handleError(_0x156e20,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index a35d45a..48be296 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 _0x0a71=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./schedule.controller','isAuthenticated','index','show','get','/:id/run','run','post','create','update','/:id','destroy','exports','util'];(function(_0x19b5f6,_0x5babfb){var _0x285312=function(_0x26ff44){while(--_0x26ff44){_0x19b5f6['push'](_0x19b5f6['shift']());}};_0x285312(++_0x5babfb);}(_0x0a71,0x1da));var _0x10a7=function(_0x39e644,_0x1e2605){_0x39e644=_0x39e644-0x0;var _0x2382b1=_0x0a71[_0x39e644];return _0x2382b1;};'use strict';var multer=require('multer');var util=require(_0x10a7('0x0'));var path=require(_0x10a7('0x1'));var timeout=require(_0x10a7('0x2'));var express=require(_0x10a7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x10a7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x10a7('0x5'));var controller=require(_0x10a7('0x6'));router['get']('/',auth[_0x10a7('0x7')](),controller[_0x10a7('0x8')]);router['get']('/:id',auth[_0x10a7('0x7')](),controller[_0x10a7('0x9')]);router[_0x10a7('0xa')](_0x10a7('0xb'),auth['isAuthenticated'](),controller[_0x10a7('0xc')]);router[_0x10a7('0xd')]('/',auth[_0x10a7('0x7')](),controller[_0x10a7('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x10a7('0xf')]);router['delete'](_0x10a7('0x10'),auth[_0x10a7('0x7')](),controller[_0x10a7('0x11')]);module[_0x10a7('0x12')]=router; \ No newline at end of file +var _0x0b11=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','run','post','create','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x133d9b,_0x418f67){var _0x25d343=function(_0x239c87){while(--_0x239c87){_0x133d9b['push'](_0x133d9b['shift']());}};_0x25d343(++_0x418f67);}(_0x0b11,0xee));var _0x10b1=function(_0x32ea7c,_0x3682cf){_0x32ea7c=_0x32ea7c-0x0;var _0x596076=_0x0b11[_0x32ea7c];return _0x596076;};'use strict';var multer=require(_0x10b1('0x0'));var util=require(_0x10b1('0x1'));var path=require(_0x10b1('0x2'));var timeout=require(_0x10b1('0x3'));var express=require(_0x10b1('0x4'));var router=express[_0x10b1('0x5')]();var fs_extra=require(_0x10b1('0x6'));var auth=require(_0x10b1('0x7'));var interaction=require(_0x10b1('0x8'));var config=require(_0x10b1('0x9'));var controller=require(_0x10b1('0xa'));router[_0x10b1('0xb')]('/',auth[_0x10b1('0xc')](),controller[_0x10b1('0xd')]);router[_0x10b1('0xb')](_0x10b1('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x10b1('0xb')](_0x10b1('0xf'),auth[_0x10b1('0xc')](),controller[_0x10b1('0x10')]);router[_0x10b1('0x11')]('/',auth['isAuthenticated'](),controller[_0x10b1('0x12')]);router['put'](_0x10b1('0xe'),auth[_0x10b1('0xc')](),controller[_0x10b1('0x13')]);router[_0x10b1('0x14')](_0x10b1('0xe'),auth[_0x10b1('0xc')](),controller['destroy']);module[_0x10b1('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index ed7c1cd..e826d68 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 _0x5955=['BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours','csv','xlsx','default','custom','exports','STRING'];(function(_0x27bb3b,_0x20463e){var _0x35c698=function(_0x39def0){while(--_0x39def0){_0x27bb3b['push'](_0x27bb3b['shift']());}};_0x35c698(++_0x20463e);}(_0x5955,0xd0));var _0x5595=function(_0x24679e,_0x22d9d7){_0x24679e=_0x24679e-0x0;var _0x291f21=_0x5955[_0x24679e];return _0x291f21;};'use strict';var Sequelize=require('sequelize');module[_0x5595('0x0')]={'name':{'type':Sequelize[_0x5595('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5595('0x1')]},'active':{'type':Sequelize[_0x5595('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x5595('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x5595('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x5595('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x5595('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x5595('0x5')](_0x5595('0x6'),_0x5595('0x7'),_0x5595('0x8'),_0x5595('0x9'),'days',_0x5595('0xa'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize['ENUM'](_0x5595('0xb'),'pdf',_0x5595('0xc')),'allowNull':![],'defaultValue':_0x5595('0xb')},'type':{'type':Sequelize[_0x5595('0x5')]('custom',_0x5595('0xd')),'allowNull':![],'defaultValue':_0x5595('0xe')},'sendMail':{'type':Sequelize[_0x5595('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x5595('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x5595('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xea9d=['default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','months','days','minutes','csv','pdf','xlsx','custom'];(function(_0x127a60,_0x37f33a){var _0xc1f6a3=function(_0x8ed035){while(--_0x8ed035){_0x127a60['push'](_0x127a60['shift']());}};_0xc1f6a3(++_0x37f33a);}(_0xea9d,0xac));var _0xdea9=function(_0x51f31c,_0x51876a){_0x51f31c=_0x51f31c-0x0;var _0x1135df=_0xea9d[_0x51f31c];return _0x1135df;};'use strict';var Sequelize=require(_0xdea9('0x0'));module[_0xdea9('0x1')]={'name':{'type':Sequelize[_0xdea9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdea9('0x2')]},'active':{'type':Sequelize[_0xdea9('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdea9('0x4')},'startAt':{'type':Sequelize[_0xdea9('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xdea9('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xdea9('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xdea9('0x7')]('years','quarters',_0xdea9('0x8'),'weeks',_0xdea9('0x9'),'hours',_0xdea9('0xa')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xdea9('0x7')](_0xdea9('0xb'),_0xdea9('0xc'),_0xdea9('0xd')),'allowNull':![],'defaultValue':_0xdea9('0xb')},'type':{'type':Sequelize[_0xdea9('0x7')](_0xdea9('0xe'),_0xdea9('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xdea9('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xdea9('0x2')]},'cc':{'type':Sequelize[_0xdea9('0x10')]},'bcc':{'type':Sequelize[_0xdea9('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xdea9('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 7a5bfa2..45d47b7 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 _0xa6cd=['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','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','index','map','Schedule','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','rawAttributes','includeAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa6cd,0x1cf));var _0xda6c=function(_0x3cc69c,_0x534406){_0x3cc69c=_0x3cc69c-0x0;var _0x15be76=_0xa6cd[_0x3cc69c];return _0x15be76;};'use strict';var emlformat=require(_0xda6c('0x0'));var rimraf=require(_0xda6c('0x1'));var zipdir=require(_0xda6c('0x2'));var jsonpatch=require(_0xda6c('0x3'));var rp=require(_0xda6c('0x4'));var moment=require(_0xda6c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xda6c('0x6'));var util=require(_0xda6c('0x7'));var path=require(_0xda6c('0x8'));var sox=require(_0xda6c('0x9'));var csv=require(_0xda6c('0xa'));var ejs=require(_0xda6c('0xb'));var fs=require('fs');var fs_extra=require(_0xda6c('0xc'));var _=require(_0xda6c('0xd'));var squel=require(_0xda6c('0xe'));var crypto=require(_0xda6c('0xf'));var jsforce=require(_0xda6c('0x10'));var deskjs=require(_0xda6c('0x11'));var toCsv=require('to-csv');var querystring=require(_0xda6c('0x12'));var Papa=require(_0xda6c('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xda6c('0x14'));var as=require(_0xda6c('0x15'));var hardwareService=require(_0xda6c('0x16'));var logger=require(_0xda6c('0x17'))('api');var utils=require(_0xda6c('0x18'));var config=require(_0xda6c('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fdfab,_0xab0da){_0xab0da=_0xab0da||0xcc;return function(_0x385deb){if(_0x385deb){return _0x3fdfab[_0xda6c('0x1a')](_0xab0da);}return _0x3fdfab[_0xda6c('0x1b')](_0xab0da)[_0xda6c('0x1c')]();};}function respondWithResult(_0x596c3f,_0x4a3ea7){_0x4a3ea7=_0x4a3ea7||0xc8;return function(_0x173eaf){if(_0x173eaf){return _0x596c3f[_0xda6c('0x1b')](_0x4a3ea7)[_0xda6c('0x1d')](_0x173eaf);}};}function respondWithFilteredResult(_0x47eb03,_0x415514){return function(_0x1cd07e){if(_0x1cd07e){var _0x197354=typeof _0x415514[_0xda6c('0x1e')]===_0xda6c('0x1f')&&typeof _0x415514[_0xda6c('0x20')]===_0xda6c('0x1f');var _0x372a70=_0x1cd07e[_0xda6c('0x21')];var _0x4cbbb3=_0x197354?0x0:_0x415514['offset'];var _0x1f3e75=_0x197354?_0x1cd07e['count']:_0x415514[_0xda6c('0x1e')]+_0x415514[_0xda6c('0x20')];var _0xb7a231;if(_0x1f3e75>=_0x372a70){_0x1f3e75=_0x372a70;_0xb7a231=0xc8;}else{_0xb7a231=0xce;}_0x47eb03[_0xda6c('0x1b')](_0xb7a231);return _0x47eb03[_0xda6c('0x22')](_0xda6c('0x23'),_0x4cbbb3+'-'+_0x1f3e75+'/'+_0x372a70)[_0xda6c('0x1d')](_0x1cd07e);}return null;};}function patchUpdates(_0xcd9570){return function(_0x5bf1f3){try{jsonpatch[_0xda6c('0x24')](_0x5bf1f3,_0xcd9570,!![]);}catch(_0x18bee0){return BPromise[_0xda6c('0x25')](_0x18bee0);}return _0x5bf1f3[_0xda6c('0x26')]();};}function saveUpdates(_0x383172,_0x2fc630){return function(_0x5bff88){if(_0x5bff88){return _0x5bff88[_0xda6c('0x27')](_0x383172)[_0xda6c('0x28')](function(_0x411eab){return _0x411eab;});}return null;};}function removeEntity(_0x5bb041,_0x4d4beb){return function(_0x4d2f43){if(_0x4d2f43){return _0x4d2f43[_0xda6c('0x29')]()[_0xda6c('0x28')](function(){var _0xeb2f83=_0x4d2f43[_0xda6c('0x2a')]({'plain':!![]});var _0x1369c5=_0xda6c('0x2b');return db[_0xda6c('0x2c')]['destroy']({'where':{'type':_0x1369c5,'resourceId':_0xeb2f83['id']}})['then'](function(){return _0x4d2f43;});})['then'](function(){_0x5bb041[_0xda6c('0x1b')](0xcc)[_0xda6c('0x1c')]();});}};}function handleEntityNotFound(_0xc8062b,_0x1dfc76){return function(_0x12dff3){if(!_0x12dff3){_0xc8062b[_0xda6c('0x1a')](0x194);}return _0x12dff3;};}function handleError(_0x5956f3,_0xabf297){_0xabf297=_0xabf297||0x1f4;return function(_0x1ed849){logger[_0xda6c('0x2d')](_0x1ed849[_0xda6c('0x2e')]);if(_0x1ed849['name']){delete _0x1ed849[_0xda6c('0x2f')];}_0x5956f3[_0xda6c('0x1b')](_0xabf297)[_0xda6c('0x30')](_0x1ed849);};}exports[_0xda6c('0x31')]=function(_0x56388d,_0x673d0f){var _0x21a6c5={},_0x10b4d8={},_0x6257ea={'count':0x0,'rows':[]};var _0xf6ec13=_[_0xda6c('0x32')](db[_0xda6c('0x33')]['rawAttributes'],function(_0x17ed8c){return{'name':_0x17ed8c[_0xda6c('0x34')],'type':_0x17ed8c[_0xda6c('0x35')][_0xda6c('0x36')]};});_0x10b4d8[_0xda6c('0x37')]=_['map'](_0xf6ec13,_0xda6c('0x2f'));_0x10b4d8[_0xda6c('0x38')]=_[_0xda6c('0x39')](_0x56388d[_0xda6c('0x38')]);_0x10b4d8[_0xda6c('0x3a')]=_[_0xda6c('0x3b')](_0x10b4d8['model'],_0x10b4d8[_0xda6c('0x38')]);_0x21a6c5['attributes']=_[_0xda6c('0x3b')](_0x10b4d8[_0xda6c('0x37')],qs[_0xda6c('0x3c')](_0x56388d['query'][_0xda6c('0x3c')]));_0x21a6c5[_0xda6c('0x3d')]=_0x21a6c5['attributes'][_0xda6c('0x3e')]?_0x21a6c5[_0xda6c('0x3d')]:_0x10b4d8['model'];if(!_0x56388d['query']['hasOwnProperty']('nolimit')){_0x21a6c5['limit']=qs[_0xda6c('0x20')](_0x56388d[_0xda6c('0x38')]['limit']);_0x21a6c5['offset']=qs['offset'](_0x56388d[_0xda6c('0x38')][_0xda6c('0x1e')]);}_0x21a6c5[_0xda6c('0x3f')]=qs[_0xda6c('0x40')](_0x56388d['query'][_0xda6c('0x40')]);_0x21a6c5[_0xda6c('0x41')]=qs[_0xda6c('0x3a')](_[_0xda6c('0x42')](_0x56388d[_0xda6c('0x38')],_0x10b4d8['filters']),_0xf6ec13);if(_0x56388d[_0xda6c('0x38')][_0xda6c('0x43')]){_0x21a6c5[_0xda6c('0x41')]=_[_0xda6c('0x44')](_0x21a6c5['where'],{'$or':_[_0xda6c('0x32')](_0xf6ec13,function(_0x343075){if(_0x343075[_0xda6c('0x35')]!==_0xda6c('0x45')){var _0x340925={};_0x340925[_0x343075[_0xda6c('0x2f')]]={'$like':'%'+_0x56388d['query'][_0xda6c('0x43')]+'%'};return _0x340925;}})});}_0x21a6c5=_[_0xda6c('0x44')]({},_0x21a6c5,_0x56388d[_0xda6c('0x46')]);var _0x3c3dfe={'where':_0x21a6c5[_0xda6c('0x41')]};return db[_0xda6c('0x33')][_0xda6c('0x21')](_0x3c3dfe)[_0xda6c('0x28')](function(_0x58935a){_0x6257ea[_0xda6c('0x21')]=_0x58935a;if(_0x56388d[_0xda6c('0x38')]['includeAll']){_0x21a6c5[_0xda6c('0x47')]=[{'all':!![]}];}return db[_0xda6c('0x33')][_0xda6c('0x48')](_0x21a6c5);})[_0xda6c('0x28')](function(_0x2fa9dc){_0x6257ea['rows']=_0x2fa9dc;return _0x6257ea;})[_0xda6c('0x28')](respondWithFilteredResult(_0x673d0f,_0x21a6c5))[_0xda6c('0x49')](handleError(_0x673d0f,null));};exports[_0xda6c('0x4a')]=function(_0x3e6660,_0x56a3eb){var _0x28627c={'raw':![],'where':{'id':_0x3e6660['params']['id']}},_0x19e0c2={};_0x19e0c2[_0xda6c('0x37')]=_[_0xda6c('0x39')](db[_0xda6c('0x33')][_0xda6c('0x4b')]);_0x19e0c2[_0xda6c('0x38')]=_['keys'](_0x3e6660[_0xda6c('0x38')]);_0x19e0c2[_0xda6c('0x3a')]=_[_0xda6c('0x3b')](_0x19e0c2[_0xda6c('0x37')],_0x19e0c2['query']);_0x28627c[_0xda6c('0x3d')]=_[_0xda6c('0x3b')](_0x19e0c2[_0xda6c('0x37')],qs['fields'](_0x3e6660[_0xda6c('0x38')][_0xda6c('0x3c')]));_0x28627c[_0xda6c('0x3d')]=_0x28627c[_0xda6c('0x3d')]['length']?_0x28627c[_0xda6c('0x3d')]:_0x19e0c2[_0xda6c('0x37')];if(_0x3e6660[_0xda6c('0x38')][_0xda6c('0x4c')]){_0x28627c[_0xda6c('0x47')]=[{'all':!![]}];}_0x28627c=_[_0xda6c('0x44')]({},_0x28627c,_0x3e6660[_0xda6c('0x46')]);return db[_0xda6c('0x33')][_0xda6c('0x4d')](_0x28627c)[_0xda6c('0x28')](handleEntityNotFound(_0x56a3eb,null))[_0xda6c('0x28')](respondWithResult(_0x56a3eb,null))[_0xda6c('0x49')](handleError(_0x56a3eb,null));};exports[_0xda6c('0x4e')]=function(_0x3668b9,_0x1b1052){return db[_0xda6c('0x33')][_0xda6c('0x4e')](_0x3668b9[_0xda6c('0x4f')],{})[_0xda6c('0x28')](function(_0x46d2b4){var _0x5e88ac=_0x3668b9[_0xda6c('0x50')][_0xda6c('0x2a')]({'plain':!![]});if(!_0x5e88ac)throw new Error(_0xda6c('0x51'));if(_0x5e88ac[_0xda6c('0x52')]===_0xda6c('0x50')){var _0x37d91b=_0x46d2b4[_0xda6c('0x2a')]({'plain':!![]});var _0x545563=_0xda6c('0x2b');return db[_0xda6c('0x53')]['find']({'where':{'name':_0x545563,'userProfileId':_0x5e88ac[_0xda6c('0x54')]},'raw':!![]})[_0xda6c('0x28')](function(_0x2ad341){if(_0x2ad341&&_0x2ad341[_0xda6c('0x55')]===0x0){return db[_0xda6c('0x2c')]['create']({'name':_0x37d91b[_0xda6c('0x2f')],'resourceId':_0x37d91b['id'],'type':_0x2ad341['name'],'sectionId':_0x2ad341['id']},{})[_0xda6c('0x28')](function(){return _0x46d2b4;});}else{return _0x46d2b4;}})[_0xda6c('0x49')](function(_0x226078){logger[_0xda6c('0x2d')](_0xda6c('0x56'),_0x226078);throw _0x226078;});}return _0x46d2b4;})[_0xda6c('0x28')](respondWithResult(_0x1b1052,0xc9))[_0xda6c('0x49')](handleError(_0x1b1052,null));};exports[_0xda6c('0x27')]=function(_0x1971c4,_0x3d9d29){if(_0x1971c4[_0xda6c('0x4f')]['id']){delete _0x1971c4[_0xda6c('0x4f')]['id'];}return db[_0xda6c('0x33')][_0xda6c('0x4d')]({'where':{'id':_0x1971c4[_0xda6c('0x57')]['id']}})[_0xda6c('0x28')](handleEntityNotFound(_0x3d9d29,null))[_0xda6c('0x28')](saveUpdates(_0x1971c4[_0xda6c('0x4f')],null))[_0xda6c('0x28')](respondWithResult(_0x3d9d29,null))[_0xda6c('0x49')](handleError(_0x3d9d29,null));};exports['destroy']=function(_0x4a1ad8,_0x14067e){return db[_0xda6c('0x33')]['find']({'where':{'id':_0x4a1ad8[_0xda6c('0x57')]['id']}})[_0xda6c('0x28')](handleEntityNotFound(_0x14067e,null))['then'](removeEntity(_0x14067e,null))['catch'](handleError(_0x14067e,null));};exports[_0xda6c('0x58')]=function(_0x1ab63d,_0x39ecb6,_0x358412){var _0x386c69=require(_0xda6c('0x59'));return db[_0xda6c('0x33')][_0xda6c('0x4d')]({'where':{'id':_0x1ab63d[_0xda6c('0x57')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x39ecb6,null))['then'](function(){_0x386c69[_0xda6c('0x58')](_0x1ab63d[_0xda6c('0x57')]['id']);})[_0xda6c('0x28')](respondWithStatusCode(_0x39ecb6,null))[_0xda6c('0x49')](handleError(_0x39ecb6,null));}; \ No newline at end of file +var _0xf45b=['eml-format','rimraf','request-promise','moment','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','then','Scheduler','UserProfileResource','sendStatus','error','stack','name','send','index','Schedule','rawAttributes','fieldName','key','model','map','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','includeAll','include','findAll','rows','catch','params','keys','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','../../config/schedule','run'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0xf45b,0xa8));var _0xbf45=function(_0x20be28,_0x24b925){_0x20be28=_0x20be28-0x0;var _0x8ab067=_0xf45b[_0x20be28];return _0x8ab067;};'use strict';var emlformat=require(_0xbf45('0x0'));var rimraf=require(_0xbf45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbf45('0x2'));var moment=require(_0xbf45('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbf45('0x4'));var util=require('util');var path=require(_0xbf45('0x5'));var sox=require('sox');var csv=require(_0xbf45('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf45('0x7'));var _=require(_0xbf45('0x8'));var squel=require(_0xbf45('0x9'));var crypto=require(_0xbf45('0xa'));var jsforce=require(_0xbf45('0xb'));var deskjs=require(_0xbf45('0xc'));var toCsv=require(_0xbf45('0x6'));var querystring=require(_0xbf45('0xd'));var Papa=require(_0xbf45('0xe'));var Redis=require(_0xbf45('0xf'));var authService=require(_0xbf45('0x10'));var qs=require(_0xbf45('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf45('0x12'));var logger=require('../../config/logger')(_0xbf45('0x13'));var utils=require(_0xbf45('0x14'));var config=require(_0xbf45('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf45('0x16'))['db'];function respondWithStatusCode(_0x4cd019,_0x3dd036){_0x3dd036=_0x3dd036||0xcc;return function(_0x5176ef){if(_0x5176ef){return _0x4cd019['sendStatus'](_0x3dd036);}return _0x4cd019[_0xbf45('0x17')](_0x3dd036)[_0xbf45('0x18')]();};}function respondWithResult(_0xf548a6,_0x4ac003){_0x4ac003=_0x4ac003||0xc8;return function(_0x872926){if(_0x872926){return _0xf548a6[_0xbf45('0x17')](_0x4ac003)[_0xbf45('0x19')](_0x872926);}};}function respondWithFilteredResult(_0x4f8eac,_0x4aff22){return function(_0x42c71e){if(_0x42c71e){var _0x22ab2b=typeof _0x4aff22[_0xbf45('0x1a')]==='undefined'&&typeof _0x4aff22['limit']===_0xbf45('0x1b');var _0x519c43=_0x42c71e['count'];var _0x574b49=_0x22ab2b?0x0:_0x4aff22[_0xbf45('0x1a')];var _0x20f3ca=_0x22ab2b?_0x42c71e[_0xbf45('0x1c')]:_0x4aff22['offset']+_0x4aff22[_0xbf45('0x1d')];var _0x335b11;if(_0x20f3ca>=_0x519c43){_0x20f3ca=_0x519c43;_0x335b11=0xc8;}else{_0x335b11=0xce;}_0x4f8eac['status'](_0x335b11);return _0x4f8eac[_0xbf45('0x1e')]('Content-Range',_0x574b49+'-'+_0x20f3ca+'/'+_0x519c43)[_0xbf45('0x19')](_0x42c71e);}return null;};}function patchUpdates(_0x58f0f6){return function(_0x12e01b){try{jsonpatch[_0xbf45('0x1f')](_0x12e01b,_0x58f0f6,!![]);}catch(_0x4a5a83){return BPromise[_0xbf45('0x20')](_0x4a5a83);}return _0x12e01b[_0xbf45('0x21')]();};}function saveUpdates(_0x213294,_0x5d1e78){return function(_0x3929c5){if(_0x3929c5){return _0x3929c5[_0xbf45('0x22')](_0x213294)['then'](function(_0x2f7c84){return _0x2f7c84;});}return null;};}function removeEntity(_0x4c4dd2,_0x3722d8){return function(_0x92dbb0){if(_0x92dbb0){return _0x92dbb0[_0xbf45('0x23')]()[_0xbf45('0x24')](function(){var _0x26553d=_0x92dbb0['get']({'plain':!![]});var _0x5d6657=_0xbf45('0x25');return db[_0xbf45('0x26')][_0xbf45('0x23')]({'where':{'type':_0x5d6657,'resourceId':_0x26553d['id']}})[_0xbf45('0x24')](function(){return _0x92dbb0;});})[_0xbf45('0x24')](function(){_0x4c4dd2['status'](0xcc)[_0xbf45('0x18')]();});}};}function handleEntityNotFound(_0x15f8d7,_0x4a55c4){return function(_0x512805){if(!_0x512805){_0x15f8d7[_0xbf45('0x27')](0x194);}return _0x512805;};}function handleError(_0x17be1a,_0x5d1c5d){_0x5d1c5d=_0x5d1c5d||0x1f4;return function(_0xc08c5){logger[_0xbf45('0x28')](_0xc08c5[_0xbf45('0x29')]);if(_0xc08c5[_0xbf45('0x2a')]){delete _0xc08c5[_0xbf45('0x2a')];}_0x17be1a[_0xbf45('0x17')](_0x5d1c5d)[_0xbf45('0x2b')](_0xc08c5);};}exports[_0xbf45('0x2c')]=function(_0x20ab5c,_0x3fde0f){var _0x303795={},_0x3a3ed6={},_0x3be851={'count':0x0,'rows':[]};var _0x7f723f=_['map'](db[_0xbf45('0x2d')][_0xbf45('0x2e')],function(_0x113d46){return{'name':_0x113d46[_0xbf45('0x2f')],'type':_0x113d46['type'][_0xbf45('0x30')]};});_0x3a3ed6[_0xbf45('0x31')]=_[_0xbf45('0x32')](_0x7f723f,_0xbf45('0x2a'));_0x3a3ed6[_0xbf45('0x33')]=_['keys'](_0x20ab5c[_0xbf45('0x33')]);_0x3a3ed6[_0xbf45('0x34')]=_['intersection'](_0x3a3ed6['model'],_0x3a3ed6[_0xbf45('0x33')]);_0x303795[_0xbf45('0x35')]=_['intersection'](_0x3a3ed6['model'],qs[_0xbf45('0x36')](_0x20ab5c[_0xbf45('0x33')]['fields']));_0x303795[_0xbf45('0x35')]=_0x303795[_0xbf45('0x35')][_0xbf45('0x37')]?_0x303795[_0xbf45('0x35')]:_0x3a3ed6['model'];if(!_0x20ab5c[_0xbf45('0x33')][_0xbf45('0x38')](_0xbf45('0x39'))){_0x303795['limit']=qs[_0xbf45('0x1d')](_0x20ab5c['query'][_0xbf45('0x1d')]);_0x303795[_0xbf45('0x1a')]=qs[_0xbf45('0x1a')](_0x20ab5c[_0xbf45('0x33')][_0xbf45('0x1a')]);}_0x303795[_0xbf45('0x3a')]=qs[_0xbf45('0x3b')](_0x20ab5c[_0xbf45('0x33')][_0xbf45('0x3b')]);_0x303795[_0xbf45('0x3c')]=qs[_0xbf45('0x34')](_['pick'](_0x20ab5c['query'],_0x3a3ed6[_0xbf45('0x34')]),_0x7f723f);if(_0x20ab5c[_0xbf45('0x33')][_0xbf45('0x3d')]){_0x303795[_0xbf45('0x3c')]=_[_0xbf45('0x3e')](_0x303795[_0xbf45('0x3c')],{'$or':_[_0xbf45('0x32')](_0x7f723f,function(_0x1e5e07){if(_0x1e5e07[_0xbf45('0x3f')]!=='VIRTUAL'){var _0x1b372c={};_0x1b372c[_0x1e5e07[_0xbf45('0x2a')]]={'$like':'%'+_0x20ab5c[_0xbf45('0x33')][_0xbf45('0x3d')]+'%'};return _0x1b372c;}})});}_0x303795=_['merge']({},_0x303795,_0x20ab5c['options']);var _0x208038={'where':_0x303795['where']};return db[_0xbf45('0x2d')]['count'](_0x208038)[_0xbf45('0x24')](function(_0x3760c6){_0x3be851[_0xbf45('0x1c')]=_0x3760c6;if(_0x20ab5c[_0xbf45('0x33')][_0xbf45('0x40')]){_0x303795[_0xbf45('0x41')]=[{'all':!![]}];}return db['Schedule'][_0xbf45('0x42')](_0x303795);})['then'](function(_0x2b1e53){_0x3be851[_0xbf45('0x43')]=_0x2b1e53;return _0x3be851;})[_0xbf45('0x24')](respondWithFilteredResult(_0x3fde0f,_0x303795))[_0xbf45('0x44')](handleError(_0x3fde0f,null));};exports['show']=function(_0x5bd294,_0x5b2d0b){var _0x462d34={'raw':![],'where':{'id':_0x5bd294[_0xbf45('0x45')]['id']}},_0x4e33aa={};_0x4e33aa[_0xbf45('0x31')]=_[_0xbf45('0x46')](db[_0xbf45('0x2d')][_0xbf45('0x2e')]);_0x4e33aa[_0xbf45('0x33')]=_[_0xbf45('0x46')](_0x5bd294[_0xbf45('0x33')]);_0x4e33aa[_0xbf45('0x34')]=_[_0xbf45('0x47')](_0x4e33aa['model'],_0x4e33aa['query']);_0x462d34[_0xbf45('0x35')]=_[_0xbf45('0x47')](_0x4e33aa[_0xbf45('0x31')],qs['fields'](_0x5bd294[_0xbf45('0x33')][_0xbf45('0x36')]));_0x462d34[_0xbf45('0x35')]=_0x462d34[_0xbf45('0x35')]['length']?_0x462d34['attributes']:_0x4e33aa[_0xbf45('0x31')];if(_0x5bd294[_0xbf45('0x33')][_0xbf45('0x40')]){_0x462d34[_0xbf45('0x41')]=[{'all':!![]}];}_0x462d34=_[_0xbf45('0x3e')]({},_0x462d34,_0x5bd294[_0xbf45('0x48')]);return db['Schedule'][_0xbf45('0x49')](_0x462d34)['then'](handleEntityNotFound(_0x5b2d0b,null))[_0xbf45('0x24')](respondWithResult(_0x5b2d0b,null))['catch'](handleError(_0x5b2d0b,null));};exports[_0xbf45('0x4a')]=function(_0x1ccb1e,_0x173982){return db[_0xbf45('0x2d')]['create'](_0x1ccb1e[_0xbf45('0x4b')],{})[_0xbf45('0x24')](function(_0x249f15){var _0x141db9=_0x1ccb1e[_0xbf45('0x4c')]['get']({'plain':!![]});if(!_0x141db9)throw new Error(_0xbf45('0x4d'));if(_0x141db9[_0xbf45('0x4e')]==='user'){var _0x5099b9=_0x249f15['get']({'plain':!![]});var _0x15f21a=_0xbf45('0x25');return db[_0xbf45('0x4f')][_0xbf45('0x49')]({'where':{'name':_0x15f21a,'userProfileId':_0x141db9[_0xbf45('0x50')]},'raw':!![]})[_0xbf45('0x24')](function(_0x11e9e0){if(_0x11e9e0&&_0x11e9e0[_0xbf45('0x51')]===0x0){return db[_0xbf45('0x26')][_0xbf45('0x4a')]({'name':_0x5099b9['name'],'resourceId':_0x5099b9['id'],'type':_0x11e9e0[_0xbf45('0x2a')],'sectionId':_0x11e9e0['id']},{})['then'](function(){return _0x249f15;});}else{return _0x249f15;}})['catch'](function(_0x410fc8){logger[_0xbf45('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x410fc8);throw _0x410fc8;});}return _0x249f15;})[_0xbf45('0x24')](respondWithResult(_0x173982,0xc9))[_0xbf45('0x44')](handleError(_0x173982,null));};exports[_0xbf45('0x22')]=function(_0x39417d,_0x4a61e8){if(_0x39417d[_0xbf45('0x4b')]['id']){delete _0x39417d['body']['id'];}return db['Schedule'][_0xbf45('0x49')]({'where':{'id':_0x39417d[_0xbf45('0x45')]['id']}})['then'](handleEntityNotFound(_0x4a61e8,null))[_0xbf45('0x24')](saveUpdates(_0x39417d['body'],null))[_0xbf45('0x24')](respondWithResult(_0x4a61e8,null))[_0xbf45('0x44')](handleError(_0x4a61e8,null));};exports['destroy']=function(_0x46a24c,_0x29e90e){return db[_0xbf45('0x2d')]['find']({'where':{'id':_0x46a24c[_0xbf45('0x45')]['id']}})[_0xbf45('0x24')](handleEntityNotFound(_0x29e90e,null))[_0xbf45('0x24')](removeEntity(_0x29e90e,null))[_0xbf45('0x44')](handleError(_0x29e90e,null));};exports['run']=function(_0x28ea57,_0xb9862d,_0x124893){var _0x43af24=require(_0xbf45('0x52'));return db[_0xbf45('0x2d')]['find']({'where':{'id':_0x28ea57[_0xbf45('0x45')]['id']},'raw':!![]})[_0xbf45('0x24')](handleEntityNotFound(_0xb9862d,null))['then'](function(){_0x43af24[_0xbf45('0x53')](_0x28ea57[_0xbf45('0x45')]['id']);})[_0xbf45('0x24')](respondWithStatusCode(_0xb9862d,null))[_0xbf45('0x44')](handleError(_0xb9862d,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index b93d6c7..93932d8 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 _0x1695=['exports','define','tools_schedules','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./schedule.attributes'];(function(_0x28c870,_0x1bf349){var _0x5e4de6=function(_0x418068){while(--_0x418068){_0x28c870['push'](_0x28c870['shift']());}};_0x5e4de6(++_0x1bf349);}(_0x1695,0xfd));var _0x5169=function(_0x382f26,_0x16c839){_0x382f26=_0x382f26-0x0;var _0x3d9555=_0x1695[_0x382f26];return _0x3d9555;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5169('0x0'))('api');var moment=require(_0x5169('0x1'));var BPromise=require(_0x5169('0x2'));var rp=require(_0x5169('0x3'));var fs=require('fs');var path=require(_0x5169('0x4'));var rimraf=require('rimraf');var config=require(_0x5169('0x5'));var attributes=require(_0x5169('0x6'));module[_0x5169('0x7')]=function(_0xb6be95,_0x25917a){return _0xb6be95[_0x5169('0x8')]('Schedule',attributes,{'tableName':_0x5169('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf110=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash'];(function(_0x499fca,_0x2bcda5){var _0x3382c6=function(_0x8034f8){while(--_0x8034f8){_0x499fca['push'](_0x499fca['shift']());}};_0x3382c6(++_0x2bcda5);}(_0xf110,0x141));var _0x0f11=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xf110[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0x0f11('0x0'));var util=require(_0x0f11('0x1'));var logger=require(_0x0f11('0x2'))(_0x0f11('0x3'));var moment=require(_0x0f11('0x4'));var BPromise=require(_0x0f11('0x5'));var rp=require(_0x0f11('0x6'));var fs=require('fs');var path=require(_0x0f11('0x7'));var rimraf=require('rimraf');var config=require(_0x0f11('0x8'));var attributes=require(_0x0f11('0x9'));module[_0x0f11('0xa')]=function(_0x31aeb2,_0x4f3e32){return _0x31aeb2[_0x0f11('0xb')](_0x0f11('0xc'),attributes,{'tableName':_0x0f11('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index 2949b85..431f1e4 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 _0x086a=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x4cb78f,_0x371447){var _0x64695a=function(_0x4c86b9){while(--_0x4c86b9){_0x4cb78f['push'](_0x4cb78f['shift']());}};_0x64695a(++_0x371447);}(_0x086a,0x1ac));var _0xa086=function(_0x30ab4b,_0x56648f){_0x30ab4b=_0x30ab4b-0x0;var _0x4b8bad=_0x086a[_0x30ab4b];return _0x4b8bad;};'use strict';var _=require(_0xa086('0x0'));var util=require(_0xa086('0x1'));var moment=require(_0xa086('0x2'));var BPromise=require(_0xa086('0x3'));var rs=require(_0xa086('0x4'));var fs=require('fs');var Redis=require(_0xa086('0x5'));var db=require(_0xa086('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa086('0x7'))('rpc');var config=require(_0xa086('0x8'));var jayson=require(_0xa086('0x9'));var client=jayson[_0xa086('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x398d1b,_0x11732c,_0x5737c3){return new BPromise(function(_0x151998,_0x1ab00b){return client[_0xa086('0xb')](_0x398d1b,_0x5737c3)[_0xa086('0xc')](function(_0x47fa4a){logger[_0xa086('0xd')]('Schedule,\x20%s,\x20%s',_0x11732c,_0xa086('0xe'));logger[_0xa086('0xf')](_0xa086('0x10'),_0x11732c,_0xa086('0xe'),JSON[_0xa086('0x11')](_0x47fa4a));if(_0x47fa4a[_0xa086('0x12')]){if(_0x47fa4a['error'][_0xa086('0x13')]===0x1f4){logger[_0xa086('0x12')](_0xa086('0x14'),_0x11732c,_0x47fa4a['error'][_0xa086('0x15')]);return _0x1ab00b(_0x47fa4a[_0xa086('0x12')][_0xa086('0x15')]);}logger['error'](_0xa086('0x14'),_0x11732c,_0x47fa4a[_0xa086('0x12')]['message']);return _0x151998(_0x47fa4a['error']['message']);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x11732c,_0xa086('0xe'));_0x151998(_0x47fa4a[_0xa086('0x16')][_0xa086('0x15')]);}})[_0xa086('0x17')](function(_0x3515a6){logger[_0xa086('0x12')]('Schedule,\x20%s,\x20%s',_0x11732c,_0x3515a6);_0x1ab00b(_0x3515a6);});});} \ No newline at end of file +var _0xa475=['Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0xa75a73,_0x4fd560){var _0x209746=function(_0x5bf838){while(--_0x5bf838){_0xa75a73['push'](_0xa75a73['shift']());}};_0x209746(++_0x4fd560);}(_0xa475,0x7c));var _0x5a47=function(_0x4012f7,_0x31dfd){_0x4012f7=_0x4012f7-0x0;var _0x1d3232=_0xa475[_0x4012f7];return _0x1d3232;};'use strict';var _=require(_0x5a47('0x0'));var util=require(_0x5a47('0x1'));var moment=require(_0x5a47('0x2'));var BPromise=require(_0x5a47('0x3'));var rs=require(_0x5a47('0x4'));var fs=require('fs');var Redis=require(_0x5a47('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5a47('0x6'));var logger=require(_0x5a47('0x7'))(_0x5a47('0x8'));var config=require(_0x5a47('0x9'));var jayson=require(_0x5a47('0xa'));var client=jayson[_0x5a47('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34cb0e,_0x235e69,_0x2f0297){return new BPromise(function(_0x44c58e,_0x2f1e66){return client[_0x5a47('0xc')](_0x34cb0e,_0x2f0297)['then'](function(_0x2e07d8){logger[_0x5a47('0xd')](_0x5a47('0xe'),_0x235e69,_0x5a47('0xf'));logger['debug'](_0x5a47('0x10'),_0x235e69,_0x5a47('0xf'),JSON[_0x5a47('0x11')](_0x2e07d8));if(_0x2e07d8[_0x5a47('0x12')]){if(_0x2e07d8['error'][_0x5a47('0x13')]===0x1f4){logger[_0x5a47('0x12')](_0x5a47('0xe'),_0x235e69,_0x2e07d8[_0x5a47('0x12')][_0x5a47('0x14')]);return _0x2f1e66(_0x2e07d8[_0x5a47('0x12')][_0x5a47('0x14')]);}logger[_0x5a47('0x12')]('Schedule,\x20%s,\x20%s',_0x235e69,_0x2e07d8[_0x5a47('0x12')]['message']);return _0x44c58e(_0x2e07d8['error'][_0x5a47('0x14')]);}else{logger[_0x5a47('0xd')](_0x5a47('0xe'),_0x235e69,'request\x20sent');_0x44c58e(_0x2e07d8[_0x5a47('0x15')][_0x5a47('0x14')]);}})[_0x5a47('0x16')](function(_0x5b1529){logger[_0x5a47('0x12')](_0x5a47('0xe'),_0x235e69,_0x5b1529);_0x2f1e66(_0x5b1529);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 0f0d461..159d700 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 _0xdd7e=['../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xdd7e,0x7d));var _0xedd7=function(_0x260619,_0x2ab7bd){_0x260619=_0x260619-0x0;var _0x2929e0=_0xdd7e[_0x260619];return _0x2929e0;};'use strict';var multer=require(_0xedd7('0x0'));var util=require(_0xedd7('0x1'));var path=require(_0xedd7('0x2'));var timeout=require(_0xedd7('0x3'));var express=require(_0xedd7('0x4'));var router=express[_0xedd7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xedd7('0x6'));var interaction=require(_0xedd7('0x7'));var config=require(_0xedd7('0x8'));var controller=require(_0xedd7('0x9'));router[_0xedd7('0xa')]('/',auth[_0xedd7('0xb')](),controller['index']);router[_0xedd7('0xa')](_0xedd7('0xc'),auth[_0xedd7('0xb')](),controller[_0xedd7('0xd')]);router[_0xedd7('0xa')](_0xedd7('0xe'),auth[_0xedd7('0xb')](),controller[_0xedd7('0xf')]);router[_0xedd7('0xa')](_0xedd7('0x10'),auth[_0xedd7('0xb')](),controller['download']);router[_0xedd7('0x11')]('/',auth[_0xedd7('0xb')](),controller['create']);router[_0xedd7('0x12')](_0xedd7('0xe'),auth[_0xedd7('0xb')](),controller[_0xedd7('0x13')]);router['delete'](_0xedd7('0xe'),auth['isAuthenticated'](),controller[_0xedd7('0x14')]);module[_0xedd7('0x15')]=router; \ No newline at end of file +var _0xdf8d=['destroy','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','isAuthenticated','index','/describe','describe','/:id','get','/:id/download','post','create','put','update'];(function(_0x545a26,_0x34aad7){var _0x2eec07=function(_0xd29d9){while(--_0xd29d9){_0x545a26['push'](_0x545a26['shift']());}};_0x2eec07(++_0x34aad7);}(_0xdf8d,0x1a3));var _0xddf8=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xdf8d[_0x342baa];return _0x1208f3;};'use strict';var multer=require('multer');var util=require(_0xddf8('0x0'));var path=require(_0xddf8('0x1'));var timeout=require(_0xddf8('0x2'));var express=require(_0xddf8('0x3'));var router=express[_0xddf8('0x4')]();var fs_extra=require(_0xddf8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xddf8('0x6'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0xddf8('0x7')](),controller[_0xddf8('0x8')]);router['get'](_0xddf8('0x9'),auth[_0xddf8('0x7')](),controller[_0xddf8('0xa')]);router['get'](_0xddf8('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xddf8('0xc')](_0xddf8('0xd'),auth[_0xddf8('0x7')](),controller['download']);router[_0xddf8('0xe')]('/',auth[_0xddf8('0x7')](),controller[_0xddf8('0xf')]);router[_0xddf8('0x10')](_0xddf8('0xb'),auth[_0xddf8('0x7')](),controller[_0xddf8('0x11')]);router['delete'](_0xddf8('0xb'),auth[_0xddf8('0x7')](),controller[_0xddf8('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index ca90215..0896e3b 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 _0x3fc6=['exports','VIRTUAL','value','extname','getDataValue','STRING','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','path','../../config/environment'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x3fc6,0x115));var _0x63fc=function(_0x44c6c2,_0x56fd98){_0x44c6c2=_0x44c6c2-0x0;var _0x597495=_0x3fc6[_0x44c6c2];return _0x597495;};'use strict';var Sequelize=require(_0x63fc('0x0'));var moment=require('moment');var path=require(_0x63fc('0x1'));var config=require(_0x63fc('0x2'));module[_0x63fc('0x3')]={'format':{'type':Sequelize[_0x63fc('0x4')],'get':function(){return this['getDataValue'](_0x63fc('0x5'))?path[_0x63fc('0x6')](this[_0x63fc('0x7')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x63fc('0x8')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x63fc('0x8')],'set':function(_0x1c7f72){var _0x3e8157=_0x1c7f72['replace'](/\\/g,'/');this[_0x63fc('0x9')](_0x63fc('0x5'),_0x3e8157);}},'rating':{'type':Sequelize[_0x63fc('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x63fc('0xa')],'set':function(_0x32749b){this['setDataValue'](_0x63fc('0xb'),moment()['subtract'](_0x32749b,'ms'));this['setDataValue'](_0x63fc('0xc'),moment());this[_0x63fc('0x9')](_0x63fc('0xd'),_0x32749b);}},'startedAt':{'type':Sequelize[_0x63fc('0xe')],'get':function(){return moment(this[_0x63fc('0x7')](_0x63fc('0xb')))[_0x63fc('0xf')](_0x63fc('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0x63fc('0xe')],'get':function(){return moment(this[_0x63fc('0x7')](_0x63fc('0xc')))['format'](_0x63fc('0x10'))[_0x63fc('0x11')]();}},'createdAt':{'type':Sequelize[_0x63fc('0xe')],'get':function(){return moment(this['getDataValue'](_0x63fc('0x12')))[_0x63fc('0xf')](_0x63fc('0x10'))[_0x63fc('0x11')]();}},'updatedAt':{'type':Sequelize[_0x63fc('0xe')],'get':function(){return moment(this[_0x63fc('0x7')](_0x63fc('0x13')))[_0x63fc('0xf')](_0x63fc('0x10'))[_0x63fc('0x11')]();}}}; \ No newline at end of file +var _0x8f4c=['INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','value','extname','getDataValue','STRING','setDataValue'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0x8f4c,0x113));var _0xc8f4=function(_0x19500a,_0x317e84){_0x19500a=_0x19500a-0x0;var _0x21f791=_0x8f4c[_0x19500a];return _0x21f791;};'use strict';var Sequelize=require(_0xc8f4('0x0'));var moment=require(_0xc8f4('0x1'));var path=require(_0xc8f4('0x2'));var config=require(_0xc8f4('0x3'));module[_0xc8f4('0x4')]={'format':{'type':Sequelize[_0xc8f4('0x5')],'get':function(){return this['getDataValue'](_0xc8f4('0x6'))?path[_0xc8f4('0x7')](this[_0xc8f4('0x8')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xc8f4('0x9')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x520063){var _0x373506=_0x520063['replace'](/\\/g,'/');this[_0xc8f4('0xa')](_0xc8f4('0x6'),_0x373506);}},'rating':{'type':Sequelize[_0xc8f4('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xc8f4('0xb')],'set':function(_0x34f05f){this['setDataValue'](_0xc8f4('0xc'),moment()[_0xc8f4('0xd')](_0x34f05f,'ms'));this[_0xc8f4('0xa')](_0xc8f4('0xe'),moment());this['setDataValue'](_0xc8f4('0xf'),_0x34f05f);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xc8f4('0x8')](_0xc8f4('0xc')))[_0xc8f4('0x10')](_0xc8f4('0x11'))[_0xc8f4('0x12')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xc8f4('0x8')](_0xc8f4('0xe')))[_0xc8f4('0x10')](_0xc8f4('0x11'))[_0xc8f4('0x12')]();}},'createdAt':{'type':Sequelize[_0xc8f4('0x13')],'get':function(){return moment(this['getDataValue'](_0xc8f4('0x14')))[_0xc8f4('0x10')](_0xc8f4('0x11'))[_0xc8f4('0x12')]();}},'updatedAt':{'type':Sequelize[_0xc8f4('0x13')],'get':function(){return moment(this['getDataValue'](_0xc8f4('0x15')))['format']('MM-DD-YYYY\x20HH:mm')[_0xc8f4('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index ea126b0..ed0aa76 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(_0x588d79,_0x1e019c){var _0x1c29ae=function(_0x146dcf){while(--_0x146dcf){_0x588d79['push'](_0x588d79['shift']());}};_0x1c29ae(++_0x1e019c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0x5fc3[_0x352e09];return _0x1b7094;};'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 _0xed1f=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','show','params','merge','options','catch','create','body','duration','createdAt','closedAt','value','find','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf'];(function(_0x48f6e2,_0x2949b3){var _0x5e8118=function(_0x5d4290){while(--_0x5d4290){_0x48f6e2['push'](_0x48f6e2['shift']());}};_0x5e8118(++_0x2949b3);}(_0xed1f,0x6a));var _0xfed1=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0xed1f[_0x220f3f];return _0x1f170e;};'use strict';var emlformat=require(_0xfed1('0x0'));var rimraf=require(_0xfed1('0x1'));var zipdir=require(_0xfed1('0x2'));var jsonpatch=require(_0xfed1('0x3'));var rp=require(_0xfed1('0x4'));var moment=require(_0xfed1('0x5'));var BPromise=require(_0xfed1('0x6'));var Mustache=require(_0xfed1('0x7'));var util=require(_0xfed1('0x8'));var path=require(_0xfed1('0x9'));var sox=require(_0xfed1('0xa'));var csv=require(_0xfed1('0xb'));var ejs=require(_0xfed1('0xc'));var fs=require('fs');var fs_extra=require(_0xfed1('0xd'));var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xb'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfed1('0x18'));var db=require(_0xfed1('0x19'))['db'];function respondWithStatusCode(_0x569a6e,_0x17f4fe){_0x17f4fe=_0x17f4fe||0xcc;return function(_0x5a3469){if(_0x5a3469){return _0x569a6e['sendStatus'](_0x17f4fe);}return _0x569a6e[_0xfed1('0x1a')](_0x17f4fe)[_0xfed1('0x1b')]();};}function respondWithResult(_0x532537,_0x2dde3a){_0x2dde3a=_0x2dde3a||0xc8;return function(_0x5b9455){if(_0x5b9455){return _0x532537['status'](_0x2dde3a)[_0xfed1('0x1c')](_0x5b9455);}};}function respondWithFilteredResult(_0x39aa0c,_0x1fbb7a){return function(_0x123c46){if(_0x123c46){var _0x582e67=typeof _0x1fbb7a[_0xfed1('0x1d')]==='undefined'&&typeof _0x1fbb7a[_0xfed1('0x1e')]===_0xfed1('0x1f');var _0x489a0f=_0x123c46[_0xfed1('0x20')];var _0xa72a20=_0x582e67?0x0:_0x1fbb7a['offset'];var _0x59509b=_0x582e67?_0x123c46['count']:_0x1fbb7a[_0xfed1('0x1d')]+_0x1fbb7a['limit'];var _0x201f18;if(_0x59509b>=_0x489a0f){_0x59509b=_0x489a0f;_0x201f18=0xc8;}else{_0x201f18=0xce;}_0x39aa0c[_0xfed1('0x1a')](_0x201f18);return _0x39aa0c['set'](_0xfed1('0x21'),_0xa72a20+'-'+_0x59509b+'/'+_0x489a0f)[_0xfed1('0x1c')](_0x123c46);}return null;};}function patchUpdates(_0x59ee9d){return function(_0x3ce944){try{jsonpatch[_0xfed1('0x22')](_0x3ce944,_0x59ee9d,!![]);}catch(_0xff4842){return BPromise[_0xfed1('0x23')](_0xff4842);}return _0x3ce944['save']();};}function saveUpdates(_0x203cec,_0x59333e){return function(_0x446558){if(_0x446558){return _0x446558[_0xfed1('0x24')](_0x203cec)[_0xfed1('0x25')](function(_0x532ec2){return _0x532ec2;});}return null;};}function removeEntity(_0x41d22c,_0x594917){return function(_0x460555){if(_0x460555){return _0x460555[_0xfed1('0x26')]()[_0xfed1('0x25')](function(){_0x41d22c[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();});}};}function handleEntityNotFound(_0x1199b7,_0x527fc7){return function(_0x465ce6){if(!_0x465ce6){_0x1199b7[_0xfed1('0x27')](0x194);}return _0x465ce6;};}function handleError(_0x49072b,_0x1d6c72){_0x1d6c72=_0x1d6c72||0x1f4;return function(_0x2b9dd2){logger[_0xfed1('0x28')](_0x2b9dd2[_0xfed1('0x29')]);if(_0x2b9dd2[_0xfed1('0x2a')]){delete _0x2b9dd2[_0xfed1('0x2a')];}_0x49072b['status'](_0x1d6c72)[_0xfed1('0x2b')](_0x2b9dd2);};}exports['index']=function(_0x3106ee,_0x4e5249){var _0x53b0c9={},_0x1cec64={},_0x42c950={'count':0x0,'rows':[]};var _0x2d334e=_['map'](db[_0xfed1('0x2c')][_0xfed1('0x2d')],function(_0x13f414){return{'name':_0x13f414[_0xfed1('0x2e')],'type':_0x13f414[_0xfed1('0x2f')][_0xfed1('0x30')]};});_0x1cec64['model']=_[_0xfed1('0x31')](_[_0xfed1('0x32')](_0x2d334e,'name'),['format']);_0x1cec64[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0x3106ee[_0xfed1('0x33')]);_0x1cec64[_0xfed1('0x35')]=_[_0xfed1('0x36')](_0x1cec64['model'],_0x1cec64[_0xfed1('0x33')]);_0x53b0c9[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1cec64[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0x3106ee['query'][_0xfed1('0x39')]));_0x53b0c9['attributes']=_0x53b0c9[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x53b0c9[_0xfed1('0x37')]:_0x1cec64[_0xfed1('0x38')];if(!_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3b')](_0xfed1('0x3c'))){_0x53b0c9[_0xfed1('0x1e')]=qs['limit'](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x1e')]);_0x53b0c9[_0xfed1('0x1d')]=qs[_0xfed1('0x1d')](_0x3106ee['query']['offset']);}_0x53b0c9[_0xfed1('0x3d')]=qs[_0xfed1('0x3e')](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3e')]);_0x53b0c9[_0xfed1('0x3f')]=qs[_0xfed1('0x35')](_[_0xfed1('0x40')](_0x3106ee[_0xfed1('0x33')],_0x1cec64['filters']),_0x2d334e);if(_0x3106ee['query'][_0xfed1('0x41')]){_0x53b0c9[_0xfed1('0x3f')]=_['merge'](_0x53b0c9[_0xfed1('0x3f')],{'$or':_[_0xfed1('0x32')](_0x2d334e,function(_0x3b0973){if(_0x3b0973[_0xfed1('0x2f')]!==_0xfed1('0x42')){var _0x31ffeb={};_0x31ffeb[_0x3b0973[_0xfed1('0x2a')]]={'$like':'%'+_0x3106ee[_0xfed1('0x33')][_0xfed1('0x41')]+'%'};return _0x31ffeb;}})});}_0x53b0c9=_['merge']({},_0x53b0c9,_0x3106ee['options']);var _0x5598dc={'where':_0x53b0c9[_0xfed1('0x3f')]};return db[_0xfed1('0x2c')][_0xfed1('0x20')](_0x5598dc)['then'](function(_0x3454e6){_0x42c950['count']=_0x3454e6;if(_0x3106ee[_0xfed1('0x33')][_0xfed1('0x43')]){_0x53b0c9[_0xfed1('0x44')]=[{'all':!![]}];}return db['ScreenRecording'][_0xfed1('0x45')](_0x53b0c9);})[_0xfed1('0x25')](function(_0x422433){_0x42c950['rows']=_0x422433;return _0x42c950;})[_0xfed1('0x25')](respondWithFilteredResult(_0x4e5249,_0x53b0c9))['catch'](handleError(_0x4e5249,null));};exports[_0xfed1('0x46')]=function(_0xf1f739,_0x229fc7){var _0x13c087={'raw':![],'where':{'id':_0xf1f739[_0xfed1('0x47')]['id']}},_0x1bfbe8={};_0x1bfbe8[_0xfed1('0x38')]=_[_0xfed1('0x34')](db[_0xfed1('0x2c')]['rawAttributes']);_0x1bfbe8[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0xf1f739[_0xfed1('0x33')]);_0x1bfbe8['filters']=_['intersection'](_0x1bfbe8[_0xfed1('0x38')],_0x1bfbe8[_0xfed1('0x33')]);_0x13c087[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1bfbe8[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0xf1f739[_0xfed1('0x33')][_0xfed1('0x39')]));_0x13c087[_0xfed1('0x37')]=_0x13c087[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x13c087[_0xfed1('0x37')]:_0x1bfbe8['model'];if(_0xf1f739[_0xfed1('0x33')][_0xfed1('0x43')]){_0x13c087[_0xfed1('0x44')]=[{'all':!![]}];}_0x13c087=_[_0xfed1('0x48')]({},_0x13c087,_0xf1f739[_0xfed1('0x49')]);return db[_0xfed1('0x2c')]['find'](_0x13c087)[_0xfed1('0x25')](handleEntityNotFound(_0x229fc7,null))[_0xfed1('0x25')](respondWithResult(_0x229fc7,null))[_0xfed1('0x4a')](handleError(_0x229fc7,null));};exports['create']=function(_0x22874a,_0x10f98d){return db[_0xfed1('0x2c')][_0xfed1('0x4b')](_0x22874a['body'],{})[_0xfed1('0x25')](respondWithResult(_0x10f98d,0xc9))[_0xfed1('0x4a')](handleError(_0x10f98d,null));};exports[_0xfed1('0x24')]=function(_0x42761f,_0x14745e){if(_0x42761f[_0xfed1('0x4c')]['id']){delete _0x42761f[_0xfed1('0x4c')]['id'];}delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4d')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4e')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4f')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x50')];return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x42761f[_0xfed1('0x47')]['id']}})['then'](handleEntityNotFound(_0x14745e,null))['then'](saveUpdates(_0x42761f[_0xfed1('0x4c')],null))[_0xfed1('0x25')](respondWithResult(_0x14745e,null))[_0xfed1('0x4a')](handleError(_0x14745e,null));};exports[_0xfed1('0x52')]=function(_0x5da599,_0x3c2534){return db[_0xfed1('0x2c')]['describe']()['then'](respondWithResult(_0x3c2534,null))['catch'](handleError(_0x3c2534,null));};exports[_0xfed1('0x53')]=function(_0x1aaa3d,_0x15e90f,_0x1d8ef2){var _0x2665c8=require(_0xfed1('0x54'));var _0x1a9f22=![];var _0x144102={};if(_0x1aaa3d[_0xfed1('0x33')][_0xfed1('0x2f')]&&_0x1aaa3d['query']['type']===_0xfed1('0x55')){_0x144102[_0xfed1('0x55')]=_0x1aaa3d[_0xfed1('0x47')]['id'];}else{_0x144102['id']=_0x1aaa3d[_0xfed1('0x47')]['id'];}return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':_0x144102,'attributes':['id',_0xfed1('0x50')],'raw':!![]})[_0xfed1('0x25')](handleEntityNotFound(_0x15e90f,null))[_0xfed1('0x25')](function(_0x427fa6){if(_0x427fa6){var _0xbd49dc=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x427fa6[_0xfed1('0x50')]);var _0x3a7a42=util[_0xfed1('0x59')]('%s.cypher',_0xbd49dc);if(fs['existsSync'](_0x3a7a42)){_0x1a9f22=!![];return _0x2665c8[_0xfed1('0x5a')](_0x3a7a42,_0xbd49dc,config[_0xfed1('0x5b')][_0xfed1('0x5c')])[_0xfed1('0x25')](function(){return _0x427fa6;});}return _0x427fa6;}})[_0xfed1('0x25')](function(_0x41a22a){if(_0x41a22a){var _0x2ccdc3=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x41a22a[_0xfed1('0x50')]);if(!fs[_0xfed1('0x5d')](_0x2ccdc3)){throw new db[(_0xfed1('0x5e'))][(_0xfed1('0x5f'))]('ScreenRecording\x20not\x20found');}if(_0x41a22a[_0xfed1('0x60')]){return _0x15e90f['download'](_0x2ccdc3,_0x41a22a['filename']+path[_0xfed1('0x61')](_0x2ccdc3),function(){if(_0x1a9f22){fs['unlink'](_0x2ccdc3);}});}else{return _0x15e90f[_0xfed1('0x53')](_0x2ccdc3,function(_0x5acc45){if(_0x1a9f22){fs[_0xfed1('0x62')](_0x2ccdc3);}});}}})[_0xfed1('0x4a')](function(_0x53f0ab){if(_0x53f0ab[_0xfed1('0x63')]===_0xfed1('0x64')){_0x15e90f['status'](0x194)[_0xfed1('0x2b')](_0xfed1('0x65'));}else{return handleError(_0x15e90f,null);}});};exports[_0xfed1('0x26')]=function(_0x2f37b9,_0x59a23a){return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x2f37b9[_0xfed1('0x47')]['id']}})[_0xfed1('0x25')](function(_0x23347a){if(_[_0xfed1('0x66')](_0x23347a)){throw new ReferenceError(_0xfed1('0x67'));}return _0x23347a;})[_0xfed1('0x25')](function(_0x5c043d){var _0x2d66ec=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x5c043d[_0xfed1('0x50')]);logger[_0xfed1('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x2d66ec);if(!_['isNil'](_0x5c043d['value'])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}_0x2d66ec=_0x2d66ec+_0xfed1('0x6b');if(!_['isNil'](_0x5c043d[_0xfed1('0x50')])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}return _0x5c043d;})[_0xfed1('0x25')](function(_0x6b74cb){if(!_0x6b74cb)throw new InternalError();return _0x6b74cb[_0xfed1('0x26')]();})['then'](function(){_0x59a23a[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();})[_0xfed1('0x4a')](handleError(_0x59a23a,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index ac638e0..3f85f8c 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 _0xe190=['bluebird','request-promise','path','rimraf','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','moment'];(function(_0x2a29ca,_0x33cf0f){var _0x43d0d4=function(_0xecfc8c){while(--_0xecfc8c){_0x2a29ca['push'](_0x2a29ca['shift']());}};_0x43d0d4(++_0x33cf0f);}(_0xe190,0x1d1));var _0x0e19=function(_0x251b81,_0x32e8d5){_0x251b81=_0x251b81-0x0;var _0xf320a1=_0xe190[_0x251b81];return _0xf320a1;};'use strict';var _=require('lodash');var util=require(_0x0e19('0x0'));var logger=require(_0x0e19('0x1'))('api');var moment=require(_0x0e19('0x2'));var BPromise=require(_0x0e19('0x3'));var rp=require(_0x0e19('0x4'));var fs=require('fs');var path=require(_0x0e19('0x5'));var rimraf=require(_0x0e19('0x6'));var config=require('../../config/environment');var attributes=require(_0x0e19('0x7'));module[_0x0e19('0x8')]=function(_0x1b7dfc,_0x1bf6c3){return _0x1b7dfc[_0x0e19('0x9')](_0x0e19('0xa'),attributes,{'tableName':_0x0e19('0xb'),'paranoid':![],'indexes':[{'name':_0x0e19('0xc'),'fields':[_0x0e19('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x80da=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','lodash'];(function(_0x4f6272,_0x53b79c){var _0x1b5ae5=function(_0x3099ef){while(--_0x3099ef){_0x4f6272['push'](_0x4f6272['shift']());}};_0x1b5ae5(++_0x53b79c);}(_0x80da,0x1d3));var _0xa80d=function(_0x519c4f,_0x128cf8){_0x519c4f=_0x519c4f-0x0;var _0xfec4d2=_0x80da[_0x519c4f];return _0xfec4d2;};'use strict';var _=require(_0xa80d('0x0'));var util=require(_0xa80d('0x1'));var logger=require(_0xa80d('0x2'))(_0xa80d('0x3'));var moment=require('moment');var BPromise=require(_0xa80d('0x4'));var rp=require(_0xa80d('0x5'));var fs=require('fs');var path=require(_0xa80d('0x6'));var rimraf=require('rimraf');var config=require(_0xa80d('0x7'));var attributes=require(_0xa80d('0x8'));module[_0xa80d('0x9')]=function(_0x2a8599,_0xe2c2d7){return _0x2a8599[_0xa80d('0xa')](_0xa80d('0xb'),attributes,{'tableName':_0xa80d('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 2ad2ba8..a617297 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 _0x4e5a=['stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0x4e5a,0x123));var _0xa4e5=function(_0xb468fc,_0x348a61){_0xb468fc=_0xb468fc-0x0;var _0x553cb6=_0x4e5a[_0xb468fc];return _0x553cb6;};'use strict';var _=require(_0xa4e5('0x0'));var util=require(_0xa4e5('0x1'));var moment=require(_0xa4e5('0x2'));var BPromise=require('bluebird');var rs=require(_0xa4e5('0x3'));var fs=require('fs');var Redis=require(_0xa4e5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa4e5('0x5'));var logger=require('../../config/logger')(_0xa4e5('0x6'));var config=require(_0xa4e5('0x7'));var jayson=require(_0xa4e5('0x8'));var client=jayson[_0xa4e5('0x9')][_0xa4e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d4478,_0xd581f8,_0x3d02af){return new BPromise(function(_0x15dd93,_0x382462){return client[_0xa4e5('0xb')](_0x3d4478,_0x3d02af)[_0xa4e5('0xc')](function(_0x2045c7){logger[_0xa4e5('0xd')](_0xa4e5('0xe'),_0xd581f8,_0xa4e5('0xf'));logger['debug'](_0xa4e5('0x10'),_0xd581f8,_0xa4e5('0xf'),JSON[_0xa4e5('0x11')](_0x2045c7));if(_0x2045c7['error']){if(_0x2045c7[_0xa4e5('0x12')][_0xa4e5('0x13')]===0x1f4){logger[_0xa4e5('0x12')](_0xa4e5('0xe'),_0xd581f8,_0x2045c7[_0xa4e5('0x12')][_0xa4e5('0x14')]);return _0x382462(_0x2045c7[_0xa4e5('0x12')][_0xa4e5('0x14')]);}logger[_0xa4e5('0x12')](_0xa4e5('0xe'),_0xd581f8,_0x2045c7[_0xa4e5('0x12')][_0xa4e5('0x14')]);return _0x15dd93(_0x2045c7[_0xa4e5('0x12')][_0xa4e5('0x14')]);}else{logger[_0xa4e5('0xd')](_0xa4e5('0xe'),_0xd581f8,_0xa4e5('0xf'));_0x15dd93(_0x2045c7[_0xa4e5('0x15')][_0xa4e5('0x14')]);}})['catch'](function(_0x12a78d){logger['error'](_0xa4e5('0xe'),_0xd581f8,_0x12a78d);_0x382462(_0x12a78d);});});} \ No newline at end of file +var _0x7526=['request\x20sent','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../config/logger','../../config/environment','client','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x3d80ca,_0x549db6){var _0x1cd947=function(_0xb921c1){while(--_0xb921c1){_0x3d80ca['push'](_0x3d80ca['shift']());}};_0x1cd947(++_0x549db6);}(_0x7526,0x1f4));var _0x6752=function(_0x34b3a4,_0xec16a8){_0x34b3a4=_0x34b3a4-0x0;var _0x4dd62e=_0x7526[_0x34b3a4];return _0x4dd62e;};'use strict';var _=require(_0x6752('0x0'));var util=require(_0x6752('0x1'));var moment=require(_0x6752('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6752('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6752('0x4'))('rpc');var config=require(_0x6752('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6752('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x306b21,_0x5e4c13,_0x11b4d5){return new BPromise(function(_0x4469cd,_0x2ea49d){return client[_0x6752('0x7')](_0x306b21,_0x11b4d5)[_0x6752('0x8')](function(_0x4e76f3){logger[_0x6752('0x9')](_0x6752('0xa'),_0x5e4c13,'request\x20sent');logger[_0x6752('0xb')](_0x6752('0xc'),_0x5e4c13,_0x6752('0xd'),JSON[_0x6752('0xe')](_0x4e76f3));if(_0x4e76f3['error']){if(_0x4e76f3[_0x6752('0xf')][_0x6752('0x10')]===0x1f4){logger[_0x6752('0xf')](_0x6752('0xa'),_0x5e4c13,_0x4e76f3[_0x6752('0xf')][_0x6752('0x11')]);return _0x2ea49d(_0x4e76f3[_0x6752('0xf')][_0x6752('0x11')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x5e4c13,_0x4e76f3[_0x6752('0xf')][_0x6752('0x11')]);return _0x4469cd(_0x4e76f3[_0x6752('0xf')][_0x6752('0x11')]);}else{logger[_0x6752('0x9')](_0x6752('0xa'),_0x5e4c13,'request\x20sent');_0x4469cd(_0x4e76f3['result'][_0x6752('0x11')]);}})[_0x6752('0x12')](function(_0x3f5f91){logger[_0x6752('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x5e4c13,_0x3f5f91);_0x2ea49d(_0x3f5f91);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 77f6f5a..b39216a 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 _0xf2a2=['/:id/logo_login','getLogoLogin','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','originalname','post','/:id/logo','single','file','addLogo','join','logologin','addLogoLogin','extname','addPreferred','favicon','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','show','getLogo'];(function(_0x2c8745,_0x4ba4b5){var _0x3d96dc=function(_0xc06a1e){while(--_0xc06a1e){_0x2c8745['push'](_0x2c8745['shift']());}};_0x3d96dc(++_0x4ba4b5);}(_0xf2a2,0x1d3));var _0x2f2a=function(_0x1b5af6,_0x18dfa4){_0x1b5af6=_0x1b5af6-0x0;var _0x15248b=_0xf2a2[_0x1b5af6];return _0x15248b;};'use strict';var multer=require(_0x2f2a('0x0'));var util=require(_0x2f2a('0x1'));var path=require(_0x2f2a('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f2a('0x3'));var router=express[_0x2f2a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2f2a('0x5'));var interaction=require(_0x2f2a('0x6'));var config=require(_0x2f2a('0x7'));var controller=require(_0x2f2a('0x8'));router['get']('/',auth[_0x2f2a('0x9')](),controller[_0x2f2a('0xa')]);router[_0x2f2a('0xb')](_0x2f2a('0xc'),controller[_0x2f2a('0xd')]);router[_0x2f2a('0xb')](_0x2f2a('0xe'),controller[_0x2f2a('0xf')]);router[_0x2f2a('0xb')]('/:id/logo',controller[_0x2f2a('0x10')]);router[_0x2f2a('0xb')](_0x2f2a('0x11'),controller[_0x2f2a('0x12')]);router[_0x2f2a('0xb')]('/:id/gdpr',controller['gdpr']);router[_0x2f2a('0xb')](_0x2f2a('0x13'),controller[_0x2f2a('0x14')]);router[_0x2f2a('0xb')](_0x2f2a('0x15'),controller[_0x2f2a('0x16')]);var upload=multer({'storage':multer[_0x2f2a('0x17')]({'destination':function(_0x458101,_0xe2786d,_0x2c2928){_0x2c2928(null,path['join'](config[_0x2f2a('0x18')],_0x2f2a('0x19')));},'filename':function(_0x455e69,_0x2510a1,_0x5b2d93){_0x5b2d93(null,util[_0x2f2a('0x1a')](_0x2f2a('0x1b'),_0x2f2a('0x1c'),path['extname'](_0x2510a1[_0x2f2a('0x1d')])));}})});router[_0x2f2a('0x1e')](_0x2f2a('0x1f'),upload[_0x2f2a('0x20')](_0x2f2a('0x21')),controller[_0x2f2a('0x22')]);var upload=multer({'storage':multer[_0x2f2a('0x17')]({'destination':function(_0x2f254b,_0x5d7578,_0x2679b3){_0x2679b3(null,path[_0x2f2a('0x23')](config[_0x2f2a('0x18')],_0x2f2a('0x19')));},'filename':function(_0x3cba1a,_0xaea7bb,_0x1d4032){_0x1d4032(null,util['format'](_0x2f2a('0x1b'),_0x2f2a('0x24'),path['extname'](_0xaea7bb[_0x2f2a('0x1d')])));}})});router[_0x2f2a('0x1e')](_0x2f2a('0x11'),upload['single'](_0x2f2a('0x21')),controller[_0x2f2a('0x25')]);var upload=multer({'storage':multer[_0x2f2a('0x17')]({'destination':function(_0x72b7c0,_0x504458,_0x16bf4e){_0x16bf4e(null,path[_0x2f2a('0x23')](config[_0x2f2a('0x18')],_0x2f2a('0x19')));},'filename':function(_0xd5529b,_0x2694f6,_0x2626fd){_0x2626fd(null,util[_0x2f2a('0x1a')](_0x2f2a('0x1b'),'preferred',path[_0x2f2a('0x26')](_0x2694f6[_0x2f2a('0x1d')])));}})});router[_0x2f2a('0x1e')](_0x2f2a('0x13'),upload[_0x2f2a('0x20')](_0x2f2a('0x21')),controller[_0x2f2a('0x27')]);var upload=multer({'storage':multer[_0x2f2a('0x17')]({'destination':function(_0x1604a4,_0x4b89b7,_0x69f9b){_0x69f9b(null,path['join'](config[_0x2f2a('0x18')],_0x2f2a('0x19')));},'filename':function(_0xc3c2cb,_0x4d330e,_0x408f63){_0x408f63(null,util[_0x2f2a('0x1a')](_0x2f2a('0x1b'),_0x2f2a('0x28'),path[_0x2f2a('0x26')](_0x4d330e[_0x2f2a('0x1d')])));}})});router['post'](_0x2f2a('0x15'),upload[_0x2f2a('0x20')](_0x2f2a('0x21')),controller['addFavicon']);router[_0x2f2a('0x29')](_0x2f2a('0xe'),auth[_0x2f2a('0x9')](),controller[_0x2f2a('0x2a')]);module[_0x2f2a('0x2b')]=router; \ No newline at end of file +var _0x8c32=['../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','logo','extname','originalname','post','single','file','addLogo','%s%s','logologin','preferred','addPreferred','favicon','/:id/favicon','addFavicon','update','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x24984a,_0x10fb2d){var _0x405c82=function(_0x3a7279){while(--_0x3a7279){_0x24984a['push'](_0x24984a['shift']());}};_0x405c82(++_0x10fb2d);}(_0x8c32,0x1f4));var _0x28c3=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8c32[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x28c3('0x0'));var util=require(_0x28c3('0x1'));var path=require(_0x28c3('0x2'));var timeout=require(_0x28c3('0x3'));var express=require('express');var router=express[_0x28c3('0x4')]();var fs_extra=require(_0x28c3('0x5'));var auth=require(_0x28c3('0x6'));var interaction=require(_0x28c3('0x7'));var config=require(_0x28c3('0x8'));var controller=require(_0x28c3('0x9'));router[_0x28c3('0xa')]('/',auth[_0x28c3('0xb')](),controller[_0x28c3('0xc')]);router[_0x28c3('0xa')](_0x28c3('0xd'),controller[_0x28c3('0xe')]);router[_0x28c3('0xa')](_0x28c3('0xf'),controller[_0x28c3('0x10')]);router[_0x28c3('0xa')](_0x28c3('0x11'),controller[_0x28c3('0x12')]);router['get'](_0x28c3('0x13'),controller[_0x28c3('0x14')]);router[_0x28c3('0xa')](_0x28c3('0x15'),controller[_0x28c3('0x16')]);router['get'](_0x28c3('0x17'),controller[_0x28c3('0x18')]);router[_0x28c3('0xa')]('/:id/favicon',controller[_0x28c3('0x19')]);var upload=multer({'storage':multer[_0x28c3('0x1a')]({'destination':function(_0x4888e3,_0x1fa77e,_0xd7661c){_0xd7661c(null,path[_0x28c3('0x1b')](config[_0x28c3('0x1c')],_0x28c3('0x1d')));},'filename':function(_0x2cf5c1,_0x511db3,_0x44bcf5){_0x44bcf5(null,util[_0x28c3('0x1e')]('%s%s',_0x28c3('0x1f'),path[_0x28c3('0x20')](_0x511db3[_0x28c3('0x21')])));}})});router[_0x28c3('0x22')](_0x28c3('0x11'),upload[_0x28c3('0x23')](_0x28c3('0x24')),controller[_0x28c3('0x25')]);var upload=multer({'storage':multer[_0x28c3('0x1a')]({'destination':function(_0x26f7ba,_0x3dc68b,_0x111fef){_0x111fef(null,path[_0x28c3('0x1b')](config[_0x28c3('0x1c')],_0x28c3('0x1d')));},'filename':function(_0x234b71,_0x2b9488,_0x35094e){_0x35094e(null,util[_0x28c3('0x1e')](_0x28c3('0x26'),_0x28c3('0x27'),path['extname'](_0x2b9488[_0x28c3('0x21')])));}})});router[_0x28c3('0x22')](_0x28c3('0x13'),upload['single'](_0x28c3('0x24')),controller['addLogoLogin']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x157185,_0x4320c9,_0x15059c){_0x15059c(null,path['join'](config[_0x28c3('0x1c')],_0x28c3('0x1d')));},'filename':function(_0xada62,_0x2a1f9f,_0x127e83){_0x127e83(null,util[_0x28c3('0x1e')]('%s%s',_0x28c3('0x28'),path[_0x28c3('0x20')](_0x2a1f9f['originalname'])));}})});router['post'](_0x28c3('0x17'),upload[_0x28c3('0x23')](_0x28c3('0x24')),controller[_0x28c3('0x29')]);var upload=multer({'storage':multer[_0x28c3('0x1a')]({'destination':function(_0x25d582,_0x1718ec,_0x2e4348){_0x2e4348(null,path[_0x28c3('0x1b')](config[_0x28c3('0x1c')],_0x28c3('0x1d')));},'filename':function(_0x5d39f7,_0x5ae07f,_0x22d1ff){_0x22d1ff(null,util[_0x28c3('0x1e')](_0x28c3('0x26'),_0x28c3('0x2a'),path[_0x28c3('0x20')](_0x5ae07f[_0x28c3('0x21')])));}})});router[_0x28c3('0x22')](_0x28c3('0x2b'),upload['single'](_0x28c3('0x24')),controller[_0x28c3('0x2c')]);router['put'](_0x28c3('0xf'),auth[_0x28c3('0xb')](),controller[_0x28c3('0x2d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 501dbed..21f2555 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 _0x5f2f=['INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','alternate','UNSIGNED','sequelize','exports'];(function(_0x33382a,_0x5594b8){var _0x447ab1=function(_0x17da6f){while(--_0x17da6f){_0x33382a['push'](_0x33382a['shift']());}};_0x447ab1(++_0x5594b8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x48bc31,_0x189f36){_0x48bc31=_0x48bc31-0x0;var _0x5dd035=_0x5f2f[_0x48bc31];return _0x5dd035;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'min_internal':{'type':Sequelize[_0xf5f2('0x2')](0xb),'unique':_0xf5f2('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xf5f2('0x2')](0xb),'unique':_0xf5f2('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf5f2('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf5f2('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf5f2('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xf5f2('0x5')]},'turnaddr':{'type':Sequelize[_0xf5f2('0x5')]},'turnusername':{'type':Sequelize[_0xf5f2('0x5')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0xf5f2('0x5')]},'defaultPageTitle':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xf5f2('0x5')],'defaultValue':_0xf5f2('0x7')},'chatTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf5f2('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xf5f2('0x2')]},'transcribeRegion':{'type':Sequelize[_0xf5f2('0x5')]},'sentiment':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xf5f2('0x2')]},'sentimentRegion':{'type':Sequelize[_0xf5f2('0x5')]},'language':{'type':Sequelize[_0xf5f2('0x5')]},'bucket':{'type':Sequelize[_0xf5f2('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xf5f2('0x2')](0x2)[_0xf5f2('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xf5f2('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xf5f2('0x2')](0x2)[_0xf5f2('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xf5f2('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x0b0e=['INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','sequelize'];(function(_0x5d9ec9,_0x4a9500){var _0x1fd9f4=function(_0x379788){while(--_0x379788){_0x5d9ec9['push'](_0x5d9ec9['shift']());}};_0x1fd9f4(++_0x4a9500);}(_0x0b0e,0x187));var _0xe0b0=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0x0b0e[_0x26b5ff];return _0x58603e;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xe0b0('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xe0b0('0x1')](0xb),'unique':_0xe0b0('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xe0b0('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':_0xe0b0('0x4')},'logo':{'type':Sequelize[_0xe0b0('0x3')]},'defaultLogo':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xe0b0('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xe0b0('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xe0b0('0x3')]},'turnaddr':{'type':Sequelize[_0xe0b0('0x3')]},'turnusername':{'type':Sequelize[_0xe0b0('0x3')]},'turnpassword':{'type':Sequelize[_0xe0b0('0x3')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':_0xe0b0('0x6')},'chatTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xe0b0('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xe0b0('0x3')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xe0b0('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xe0b0('0x3')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xe0b0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xe0b0('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xe0b0('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index a9581ad..8f8ee55 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 _0xef89=['favicon','default_preferred.png','\x20not\x20found','getFavicon','default_favicon.ico','default','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','Setting,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','destroy','stack','name','send','index','Setting','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','download','preferred','default_loginLogo.svg','securePassword','addPreferred'];(function(_0x2b4448,_0x5bcc69){var _0xb4b465=function(_0x5ac741){while(--_0x5ac741){_0x2b4448['push'](_0x2b4448['shift']());}};_0xb4b465(++_0x5bcc69);}(_0xef89,0xf6));var _0x9ef8=function(_0x4a2ba2,_0x5901b9){_0x4a2ba2=_0x4a2ba2-0x0;var _0x1d09fd=_0xef89[_0x4a2ba2];return _0x1d09fd;};'use strict';var emlformat=require(_0x9ef8('0x0'));var rimraf=require(_0x9ef8('0x1'));var zipdir=require(_0x9ef8('0x2'));var jsonpatch=require(_0x9ef8('0x3'));var rp=require(_0x9ef8('0x4'));var moment=require('moment');var BPromise=require(_0x9ef8('0x5'));var Mustache=require(_0x9ef8('0x6'));var util=require(_0x9ef8('0x7'));var path=require(_0x9ef8('0x8'));var sox=require(_0x9ef8('0x9'));var csv=require('to-csv');var ejs=require(_0x9ef8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9ef8('0xb'));var jsforce=require(_0x9ef8('0xc'));var deskjs=require(_0x9ef8('0xd'));var toCsv=require(_0x9ef8('0xe'));var querystring=require(_0x9ef8('0xf'));var Papa=require(_0x9ef8('0x10'));var Redis=require(_0x9ef8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9ef8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9ef8('0x13'))(_0x9ef8('0x14'));var utils=require('../../config/utils');var config=require(_0x9ef8('0x15'));var licenseUtil=require(_0x9ef8('0x16'));var db=require(_0x9ef8('0x17'))['db'];var jayson=require(_0x9ef8('0x18'));var client=jayson[_0x9ef8('0x19')][_0x9ef8('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4c13fb,_0x5b4ff7,_0x1fa362,_0x1fe8c9){return new BPromise(function(_0x14611d,_0x3a0c2b){var _0x462444=_0x1fe8c9||client;return _0x462444[_0x9ef8('0x1b')](_0x4c13fb,_0x1fa362)[_0x9ef8('0x1c')](function(_0x146075){logger['info']('Setting,\x20%s,\x20%s',_0x5b4ff7,_0x9ef8('0x1d'));logger[_0x9ef8('0x1e')](_0x9ef8('0x1f'),_0x5b4ff7,'request\x20sent',JSON[_0x9ef8('0x20')](_0x146075));if(_0x146075[_0x9ef8('0x21')]){if(_0x146075[_0x9ef8('0x21')]['code']===0x1f4){logger['error'](_0x9ef8('0x22'),_0x5b4ff7,_0x146075[_0x9ef8('0x21')][_0x9ef8('0x23')]);return _0x3a0c2b(_0x146075[_0x9ef8('0x21')]['message']);}logger['error'](_0x9ef8('0x22'),_0x5b4ff7,_0x146075[_0x9ef8('0x21')][_0x9ef8('0x23')]);return _0x14611d(_0x146075[_0x9ef8('0x21')]['message']);}else{logger[_0x9ef8('0x24')](_0x9ef8('0x22'),_0x5b4ff7,_0x9ef8('0x1d'));_0x14611d(_0x146075[_0x9ef8('0x25')]['message']);}})[_0x9ef8('0x26')](function(_0x83d172){logger[_0x9ef8('0x21')](_0x9ef8('0x22'),_0x5b4ff7,_0x83d172);_0x3a0c2b(_0x83d172);});});}function respondWithStatusCode(_0x420058,_0x19ce3a){_0x19ce3a=_0x19ce3a||0xcc;return function(_0x160ae7){if(_0x160ae7){return _0x420058[_0x9ef8('0x27')](_0x19ce3a);}return _0x420058[_0x9ef8('0x28')](_0x19ce3a)[_0x9ef8('0x29')]();};}function respondWithResult(_0x51dc27,_0x4afe14){_0x4afe14=_0x4afe14||0xc8;return function(_0x5cb6f0){if(_0x5cb6f0){return _0x51dc27[_0x9ef8('0x28')](_0x4afe14)[_0x9ef8('0x2a')](_0x5cb6f0);}};}function respondWithFilteredResult(_0x56edab,_0x29bd66){return function(_0x4e8142){if(_0x4e8142){var _0x2ac1ce=typeof _0x29bd66[_0x9ef8('0x2b')]===_0x9ef8('0x2c')&&typeof _0x29bd66[_0x9ef8('0x2d')]===_0x9ef8('0x2c');var _0x56e2d2=_0x4e8142['count'];var _0x4644f7=_0x2ac1ce?0x0:_0x29bd66[_0x9ef8('0x2b')];var _0x357728=_0x2ac1ce?_0x4e8142[_0x9ef8('0x2e')]:_0x29bd66[_0x9ef8('0x2b')]+_0x29bd66['limit'];var _0x434813;if(_0x357728>=_0x56e2d2){_0x357728=_0x56e2d2;_0x434813=0xc8;}else{_0x434813=0xce;}_0x56edab[_0x9ef8('0x28')](_0x434813);return _0x56edab[_0x9ef8('0x2f')]('Content-Range',_0x4644f7+'-'+_0x357728+'/'+_0x56e2d2)['json'](_0x4e8142);}return null;};}function patchUpdates(_0x3945fa){return function(_0x46e6bb){try{jsonpatch[_0x9ef8('0x30')](_0x46e6bb,_0x3945fa,!![]);}catch(_0x3c4730){return BPromise['reject'](_0x3c4730);}return _0x46e6bb['save']();};}function saveUpdates(_0x24d2f5,_0x177088){return function(_0x43d8dc){if(_0x43d8dc){return _0x43d8dc[_0x9ef8('0x31')](_0x24d2f5)[_0x9ef8('0x1c')](function(_0x45fec3){return _0x45fec3;});}return null;};}function removeEntity(_0x1fef44,_0x495110){return function(_0x3b94d9){if(_0x3b94d9){return _0x3b94d9[_0x9ef8('0x32')]()[_0x9ef8('0x1c')](function(){_0x1fef44['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3170c2,_0x4d8fb7){return function(_0x3ab3d7){if(!_0x3ab3d7){_0x3170c2[_0x9ef8('0x27')](0x194);}return _0x3ab3d7;};}function handleError(_0x842db2,_0x27982d){_0x27982d=_0x27982d||0x1f4;return function(_0xe43696){logger[_0x9ef8('0x21')](_0xe43696[_0x9ef8('0x33')]);if(_0xe43696[_0x9ef8('0x34')]){delete _0xe43696[_0x9ef8('0x34')];}_0x842db2['status'](_0x27982d)[_0x9ef8('0x35')](_0xe43696);};}exports[_0x9ef8('0x36')]=function(_0x1bbbd3,_0x539e3f){var _0x3f322d={},_0x35addd={},_0x38d0fe={'count':0x0,'rows':[]};var _0x359d91=_['map'](db[_0x9ef8('0x37')][_0x9ef8('0x38')],function(_0x4fad31){return{'name':_0x4fad31[_0x9ef8('0x39')],'type':_0x4fad31[_0x9ef8('0x3a')]['key']};});_0x35addd[_0x9ef8('0x3b')]=_['map'](_0x359d91,_0x9ef8('0x34'));_0x35addd[_0x9ef8('0x3c')]=_[_0x9ef8('0x3d')](_0x1bbbd3[_0x9ef8('0x3c')]);_0x35addd[_0x9ef8('0x3e')]=_[_0x9ef8('0x3f')](_0x35addd[_0x9ef8('0x3b')],_0x35addd[_0x9ef8('0x3c')]);_0x3f322d[_0x9ef8('0x40')]=_[_0x9ef8('0x3f')](_0x35addd[_0x9ef8('0x3b')],qs[_0x9ef8('0x41')](_0x1bbbd3[_0x9ef8('0x3c')][_0x9ef8('0x41')]));_0x3f322d[_0x9ef8('0x40')]=_0x3f322d[_0x9ef8('0x40')][_0x9ef8('0x42')]?_0x3f322d['attributes']:_0x35addd[_0x9ef8('0x3b')];if(!_0x1bbbd3['query'][_0x9ef8('0x43')](_0x9ef8('0x44'))){_0x3f322d[_0x9ef8('0x2d')]=qs[_0x9ef8('0x2d')](_0x1bbbd3[_0x9ef8('0x3c')][_0x9ef8('0x2d')]);_0x3f322d['offset']=qs['offset'](_0x1bbbd3['query']['offset']);}_0x3f322d[_0x9ef8('0x45')]=qs[_0x9ef8('0x46')](_0x1bbbd3[_0x9ef8('0x3c')]['sort']);_0x3f322d['where']=qs[_0x9ef8('0x3e')](_[_0x9ef8('0x47')](_0x1bbbd3[_0x9ef8('0x3c')],_0x35addd[_0x9ef8('0x3e')]),_0x359d91);if(_0x1bbbd3[_0x9ef8('0x3c')][_0x9ef8('0x48')]){_0x3f322d['where']=_[_0x9ef8('0x49')](_0x3f322d['where'],{'$or':_['map'](_0x359d91,function(_0x6d0749){if(_0x6d0749['type']!==_0x9ef8('0x4a')){var _0x412dad={};_0x412dad[_0x6d0749[_0x9ef8('0x34')]]={'$like':'%'+_0x1bbbd3['query'][_0x9ef8('0x48')]+'%'};return _0x412dad;}})});}_0x3f322d=_[_0x9ef8('0x49')]({},_0x3f322d,_0x1bbbd3[_0x9ef8('0x4b')]);var _0x5cd71e={'where':_0x3f322d['where']};return db[_0x9ef8('0x37')][_0x9ef8('0x2e')](_0x5cd71e)[_0x9ef8('0x1c')](function(_0x5b4fb7){_0x38d0fe[_0x9ef8('0x2e')]=_0x5b4fb7;if(_0x1bbbd3[_0x9ef8('0x3c')][_0x9ef8('0x4c')]){_0x3f322d[_0x9ef8('0x4d')]=[{'all':!![]}];}return db[_0x9ef8('0x37')]['findAll'](_0x3f322d);})[_0x9ef8('0x1c')](function(_0x243476){_0x38d0fe['rows']=_0x243476;return _0x38d0fe;})[_0x9ef8('0x1c')](respondWithFilteredResult(_0x539e3f,_0x3f322d))[_0x9ef8('0x26')](handleError(_0x539e3f,null));};exports[_0x9ef8('0x4e')]=function(_0x56b603,_0x2d44ea){var _0x451e17={'raw':![],'where':{'id':_0x56b603[_0x9ef8('0x4f')]['id']}},_0x3e203d={};_0x3e203d[_0x9ef8('0x3b')]=_['keys'](db['Setting'][_0x9ef8('0x38')]);_0x3e203d[_0x9ef8('0x3c')]=_[_0x9ef8('0x3d')](_0x56b603[_0x9ef8('0x3c')]);_0x3e203d['filters']=_[_0x9ef8('0x3f')](_0x3e203d['model'],_0x3e203d[_0x9ef8('0x3c')]);_0x451e17[_0x9ef8('0x40')]=_[_0x9ef8('0x3f')](_0x3e203d[_0x9ef8('0x3b')],qs[_0x9ef8('0x41')](_0x56b603['query']['fields']));_0x451e17[_0x9ef8('0x40')]=_0x451e17[_0x9ef8('0x40')][_0x9ef8('0x42')]?_0x451e17['attributes']:_0x3e203d[_0x9ef8('0x3b')];if(_0x56b603[_0x9ef8('0x3c')][_0x9ef8('0x4c')]){_0x451e17['include']=[{'all':!![]}];}_0x451e17=_['merge']({},_0x451e17,_0x56b603[_0x9ef8('0x4b')]);return db[_0x9ef8('0x37')][_0x9ef8('0x50')](_0x451e17)[_0x9ef8('0x1c')](handleEntityNotFound(_0x2d44ea,null))[_0x9ef8('0x1c')](respondWithResult(_0x2d44ea,null))['catch'](handleError(_0x2d44ea,null));};exports['update']=function(_0x2dfcbc,_0x1af52a){if(_0x2dfcbc[_0x9ef8('0x51')]['id']){delete _0x2dfcbc[_0x9ef8('0x51')]['id'];}return db[_0x9ef8('0x37')]['find']({'where':{'id':_0x2dfcbc[_0x9ef8('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1af52a,null))[_0x9ef8('0x1c')](saveUpdates(_0x2dfcbc[_0x9ef8('0x51')],null))[_0x9ef8('0x1c')](respondWithResult(_0x1af52a,null))[_0x9ef8('0x26')](handleError(_0x1af52a,null));};exports[_0x9ef8('0x52')]=function(_0x3f8ec6,_0x397317,_0x340dd6){if(_0x3f8ec6[_0x9ef8('0x53')]&&_0x3f8ec6[_0x9ef8('0x53')][_0x9ef8('0x54')]){_0x3f8ec6['body'][_0x9ef8('0x55')]=_0x3f8ec6[_0x9ef8('0x53')][_0x9ef8('0x54')];}return db[_0x9ef8('0x37')][_0x9ef8('0x50')]({'where':{'id':_0x3f8ec6[_0x9ef8('0x4f')]['id']}})[_0x9ef8('0x1c')](handleEntityNotFound(_0x397317,null))['then'](saveUpdates(_0x3f8ec6[_0x9ef8('0x51')],null))['then'](respondWithResult(_0x397317,null))[_0x9ef8('0x26')](handleError(_0x397317,null));};exports[_0x9ef8('0x56')]=function(_0x2b3abd,_0x440d48,_0x5adf1f){if(_0x2b3abd[_0x9ef8('0x53')]&&_0x2b3abd[_0x9ef8('0x53')][_0x9ef8('0x54')]){_0x2b3abd['body'][_0x9ef8('0x57')]=_0x2b3abd[_0x9ef8('0x53')]['filename'];}return db[_0x9ef8('0x37')][_0x9ef8('0x50')]({'where':{'id':_0x2b3abd[_0x9ef8('0x4f')]['id']}})[_0x9ef8('0x1c')](handleEntityNotFound(_0x440d48,null))[_0x9ef8('0x1c')](saveUpdates(_0x2b3abd[_0x9ef8('0x51')],null))[_0x9ef8('0x1c')](respondWithResult(_0x440d48,null))[_0x9ef8('0x26')](handleError(_0x440d48,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0xf3b24,_0x10196b,_0x3a1098){var _0x153fef=_0x9ef8('0x58');var _0x144bf0={'custom':![]};return utilLicense[_0x9ef8('0x59')]()[_0x9ef8('0x1c')](function(_0x2a9762){if(_0x2a9762){_0x144bf0=_0x2a9762;}return db[_0x9ef8('0x37')][_0x9ef8('0x50')]({'where':{'id':_0xf3b24[_0x9ef8('0x4f')]['id']},'attributes':[_0x9ef8('0x55'),_0x9ef8('0x57'),'preferred','favicon',_0x9ef8('0x5a'),_0x9ef8('0x5b'),_0x9ef8('0x5c'),_0x9ef8('0x5d')],'raw':!![]});})[_0x9ef8('0x1c')](handleEntityNotFound(_0x10196b,null))[_0x9ef8('0x1c')](function(_0x1bd284){if(_0x1bd284){var _0x1f8dfe=_0x1bd284[_0x9ef8('0x55')]&&fs[_0x9ef8('0x5e')](path[_0x9ef8('0x5f')](config['root'],_0x153fef,_[_0x9ef8('0x60')](_0x1bd284['logo'])))?path[_0x9ef8('0x5f')](config['root'],_0x153fef,_[_0x9ef8('0x60')](_0x1bd284['logo'])):path[_0x9ef8('0x5f')](config[_0x9ef8('0x61')],_0x153fef,_['toLower'](_0x9ef8('0x62')));var _0x3cf304='default'+_[_0x9ef8('0x63')](_0x9ef8('0x55'));if(_0x1bd284[_0x3cf304]||!_0x144bf0[_0x9ef8('0x64')]){_0x1f8dfe=path[_0x9ef8('0x5f')](config[_0x9ef8('0x61')],_0x153fef,_[_0x9ef8('0x60')]('default_logo.svg'));}if(!fs[_0x9ef8('0x5e')](_0x1f8dfe)){throw new db[(_0x9ef8('0x65'))][(_0x9ef8('0x66'))](_[_0x9ef8('0x63')](_0x9ef8('0x55'))+'\x20not\x20found');}return _0x10196b[_0x9ef8('0x67')](_0x1f8dfe);}})[_0x9ef8('0x26')](handleError(_0x10196b,null));};var utilLicense=require(_0x9ef8('0x16'));exports['getLogoLogin']=function(_0x1377d9,_0x357e27,_0x472f3c){var _0x35f2da='server/files/images/logos';var _0x212264={'custom':![]};return utilLicense[_0x9ef8('0x59')]()['then'](function(_0x43123e){if(_0x43123e){_0x212264=_0x43123e;}return db['Setting'][_0x9ef8('0x50')]({'where':{'id':_0x1377d9[_0x9ef8('0x4f')]['id']},'attributes':[_0x9ef8('0x55'),'loginLogo',_0x9ef8('0x68'),'favicon',_0x9ef8('0x5a'),_0x9ef8('0x5b'),_0x9ef8('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x9ef8('0x1c')](handleEntityNotFound(_0x357e27,null))[_0x9ef8('0x1c')](function(_0x11399a){if(_0x11399a){var _0xd227c9=_0x11399a[_0x9ef8('0x57')]&&fs[_0x9ef8('0x5e')](path[_0x9ef8('0x5f')](config['root'],_0x35f2da,_[_0x9ef8('0x60')](_0x11399a[_0x9ef8('0x57')])))?path[_0x9ef8('0x5f')](config[_0x9ef8('0x61')],_0x35f2da,_['toLower'](_0x11399a['loginLogo'])):path[_0x9ef8('0x5f')](config[_0x9ef8('0x61')],_0x35f2da,_[_0x9ef8('0x60')](_0x9ef8('0x69')));var _0x576eff='default'+_[_0x9ef8('0x63')](_0x9ef8('0x57'));if(_0x11399a[_0x576eff]||!_0x212264[_0x9ef8('0x64')]){_0xd227c9=path['join'](config[_0x9ef8('0x61')],_0x35f2da,_[_0x9ef8('0x60')](_0x9ef8('0x69')));}if(!fs[_0x9ef8('0x5e')](_0xd227c9)){throw new db[(_0x9ef8('0x65'))][(_0x9ef8('0x66'))](_['upperFirst'](_0x9ef8('0x57'))+'\x20not\x20found');}return _0x357e27['download'](_0xd227c9);}})[_0x9ef8('0x26')](handleError(_0x357e27,null));};exports['gdpr']=function(_0x5cdb6e,_0xcbe5b8){return db[_0x9ef8('0x37')]['find']({'where':{'id':_0x5cdb6e['params']['id']},'attributes':[_0x9ef8('0x6a')]})['then'](respondWithResult(_0xcbe5b8,null))[_0x9ef8('0x26')](handleError(_0xcbe5b8,null));};exports[_0x9ef8('0x6b')]=function(_0x3c9f48,_0x353a68,_0x48517f){if(_0x3c9f48[_0x9ef8('0x53')]&&_0x3c9f48[_0x9ef8('0x53')][_0x9ef8('0x54')]){_0x3c9f48[_0x9ef8('0x51')][_0x9ef8('0x68')]=_0x3c9f48[_0x9ef8('0x53')][_0x9ef8('0x54')];}return db['Setting'][_0x9ef8('0x50')]({'where':{'id':_0x3c9f48[_0x9ef8('0x4f')]['id']}})[_0x9ef8('0x1c')](handleEntityNotFound(_0x353a68,null))[_0x9ef8('0x1c')](saveUpdates(_0x3c9f48[_0x9ef8('0x51')],null))[_0x9ef8('0x1c')](respondWithResult(_0x353a68,null))['catch'](handleError(_0x353a68,null));};var utilLicense=require(_0x9ef8('0x16'));exports['getPreferred']=function(_0x2d8f86,_0x124658,_0x3252ee){var _0x16b971='server/files/images/logos';var _0x3d62c7={'custom':![]};return utilLicense[_0x9ef8('0x59')]()[_0x9ef8('0x1c')](function(_0x5d5f5d){if(_0x5d5f5d){_0x3d62c7=_0x5d5f5d;}return db[_0x9ef8('0x37')][_0x9ef8('0x50')]({'where':{'id':_0x2d8f86[_0x9ef8('0x4f')]['id']},'attributes':['logo',_0x9ef8('0x57'),_0x9ef8('0x68'),_0x9ef8('0x6c'),_0x9ef8('0x5a'),_0x9ef8('0x5b'),_0x9ef8('0x5c'),_0x9ef8('0x5d')],'raw':!![]});})[_0x9ef8('0x1c')](handleEntityNotFound(_0x124658,null))[_0x9ef8('0x1c')](function(_0x46fde1){if(_0x46fde1){var _0x237471=_0x46fde1['preferred']&&fs[_0x9ef8('0x5e')](path[_0x9ef8('0x5f')](config[_0x9ef8('0x61')],_0x16b971,_[_0x9ef8('0x60')](_0x46fde1[_0x9ef8('0x68')])))?path['join'](config[_0x9ef8('0x61')],_0x16b971,_['toLower'](_0x46fde1['preferred'])):path['join'](config[_0x9ef8('0x61')],_0x16b971,_[_0x9ef8('0x60')](_0x9ef8('0x6d')));var _0x327a09='default'+_[_0x9ef8('0x63')]('preferred');if(_0x46fde1[_0x327a09]||!_0x3d62c7[_0x9ef8('0x64')]||!_0x3d62c7[_0x9ef8('0x68')]){_0x237471=path['join'](config['root'],_0x16b971,_['toLower'](_0x9ef8('0x6d')));}if(!fs[_0x9ef8('0x5e')](_0x237471)){throw new db[(_0x9ef8('0x65'))][(_0x9ef8('0x66'))](_[_0x9ef8('0x63')](_0x9ef8('0x68'))+_0x9ef8('0x6e'));}return _0x124658[_0x9ef8('0x67')](_0x237471);}})[_0x9ef8('0x26')](handleError(_0x124658,null));};exports['addFavicon']=function(_0x5273f4,_0x114df5,_0x2f6b15){if(_0x5273f4[_0x9ef8('0x53')]&&_0x5273f4[_0x9ef8('0x53')]['filename']){_0x5273f4['body'][_0x9ef8('0x6c')]=_0x5273f4['file']['filename'];}return db['Setting'][_0x9ef8('0x50')]({'where':{'id':_0x5273f4[_0x9ef8('0x4f')]['id']}})[_0x9ef8('0x1c')](handleEntityNotFound(_0x114df5,null))[_0x9ef8('0x1c')](saveUpdates(_0x5273f4['body'],null))[_0x9ef8('0x1c')](respondWithResult(_0x114df5,null))[_0x9ef8('0x26')](handleError(_0x114df5,null));};var utilLicense=require(_0x9ef8('0x16'));exports[_0x9ef8('0x6f')]=function(_0x26bf41,_0x37d6ff,_0x2d170d){var _0x370525=_0x9ef8('0x58');var _0x5de59c={'custom':![]};return utilLicense['getLicense']()[_0x9ef8('0x1c')](function(_0xd4b3b6){if(_0xd4b3b6){_0x5de59c=_0xd4b3b6;}return db[_0x9ef8('0x37')][_0x9ef8('0x50')]({'where':{'id':_0x26bf41['params']['id']},'attributes':[_0x9ef8('0x55'),_0x9ef8('0x57'),_0x9ef8('0x68'),_0x9ef8('0x6c'),_0x9ef8('0x5a'),_0x9ef8('0x5b'),'defaultPreferred',_0x9ef8('0x5d')],'raw':!![]});})['then'](handleEntityNotFound(_0x37d6ff,null))[_0x9ef8('0x1c')](function(_0x4c43ed){if(_0x4c43ed){var _0x1a03be=_0x4c43ed[_0x9ef8('0x6c')]&&fs[_0x9ef8('0x5e')](path['join'](config['root'],_0x370525,_[_0x9ef8('0x60')](_0x4c43ed[_0x9ef8('0x6c')])))?path[_0x9ef8('0x5f')](config[_0x9ef8('0x61')],_0x370525,_[_0x9ef8('0x60')](_0x4c43ed[_0x9ef8('0x6c')])):path['join'](config['root'],_0x370525,_[_0x9ef8('0x60')](_0x9ef8('0x70')));var _0x55c194=_0x9ef8('0x71')+_['upperFirst'](_0x9ef8('0x6c'));if(_0x4c43ed[_0x55c194]||!_0x5de59c[_0x9ef8('0x64')]){_0x1a03be=path['join'](config[_0x9ef8('0x61')],_0x370525,_[_0x9ef8('0x60')](_0x9ef8('0x70')));}if(!fs[_0x9ef8('0x5e')](_0x1a03be)){throw new db['Sequelize'][(_0x9ef8('0x66'))](_[_0x9ef8('0x63')]('favicon')+_0x9ef8('0x6e'));}return _0x37d6ff[_0x9ef8('0x67')](_0x1a03be);}})[_0x9ef8('0x26')](handleError(_0x37d6ff,null));};exports[_0x9ef8('0x72')]=function(_0x1e6b55,_0xe57c83){var _0x49561e={'offset':moment()[_0x9ef8('0x73')]()};_0x49561e['now']=moment()[_0x9ef8('0x73')](_0x49561e[_0x9ef8('0x2b')])[_0x9ef8('0x74')](_0x9ef8('0x75'));return _0xe57c83[_0x9ef8('0x28')](0xc8)[_0x9ef8('0x35')](_0x49561e);}; \ No newline at end of file +var _0x38d3=['where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','keys','options','find','body','params','addLogo','file','filename','logo','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','toLower','root','default_logo.svg','custom','Sequelize','ValidationError','upperFirst','\x20not\x20found','getLogoLogin','preferred','defaultPreferred','default_loginLogo.svg','download','addPreferred','getPreferred','default','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s,\x20%s','stringify','code','error','Setting,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','end','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort'];(function(_0x535a7e,_0x4f76cd){var _0x30834a=function(_0x3057d8){while(--_0x3057d8){_0x535a7e['push'](_0x535a7e['shift']());}};_0x30834a(++_0x4f76cd);}(_0x38d3,0x1a7));var _0x338d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x38d3[_0x126558];return _0x1f6d14;};'use strict';var emlformat=require(_0x338d('0x0'));var rimraf=require(_0x338d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x338d('0x2'));var rp=require(_0x338d('0x3'));var moment=require(_0x338d('0x4'));var BPromise=require(_0x338d('0x5'));var Mustache=require(_0x338d('0x6'));var util=require(_0x338d('0x7'));var path=require(_0x338d('0x8'));var sox=require(_0x338d('0x9'));var csv=require(_0x338d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x338d('0xb'));var _=require(_0x338d('0xc'));var squel=require(_0x338d('0xd'));var crypto=require(_0x338d('0xe'));var jsforce=require(_0x338d('0xf'));var deskjs=require(_0x338d('0x10'));var toCsv=require(_0x338d('0xa'));var querystring=require('querystring');var Papa=require(_0x338d('0x11'));var Redis=require(_0x338d('0x12'));var authService=require(_0x338d('0x13'));var qs=require(_0x338d('0x14'));var as=require(_0x338d('0x15'));var hardwareService=require(_0x338d('0x16'));var logger=require('../../config/logger')(_0x338d('0x17'));var utils=require(_0x338d('0x18'));var config=require(_0x338d('0x19'));var licenseUtil=require(_0x338d('0x1a'));var db=require(_0x338d('0x1b'))['db'];var jayson=require(_0x338d('0x1c'));var client=jayson[_0x338d('0x1d')][_0x338d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x54e32b,_0x4f65f4,_0x4c9397,_0x1259d4){return new BPromise(function(_0x1e9895,_0x58f5d5){var _0x31c02c=_0x1259d4||client;return _0x31c02c['request'](_0x54e32b,_0x4c9397)[_0x338d('0x1f')](function(_0x36b054){logger[_0x338d('0x20')]('Setting,\x20%s,\x20%s',_0x4f65f4,'request\x20sent');logger['debug'](_0x338d('0x21'),_0x4f65f4,'request\x20sent',JSON[_0x338d('0x22')](_0x36b054));if(_0x36b054['error']){if(_0x36b054['error'][_0x338d('0x23')]===0x1f4){logger[_0x338d('0x24')](_0x338d('0x25'),_0x4f65f4,_0x36b054[_0x338d('0x24')][_0x338d('0x26')]);return _0x58f5d5(_0x36b054['error'][_0x338d('0x26')]);}logger[_0x338d('0x24')](_0x338d('0x25'),_0x4f65f4,_0x36b054['error'][_0x338d('0x26')]);return _0x1e9895(_0x36b054[_0x338d('0x24')][_0x338d('0x26')]);}else{logger[_0x338d('0x20')](_0x338d('0x25'),_0x4f65f4,_0x338d('0x27'));_0x1e9895(_0x36b054[_0x338d('0x28')][_0x338d('0x26')]);}})[_0x338d('0x29')](function(_0xbfa26b){logger[_0x338d('0x24')](_0x338d('0x25'),_0x4f65f4,_0xbfa26b);_0x58f5d5(_0xbfa26b);});});}function respondWithStatusCode(_0x4e859f,_0xef4cf7){_0xef4cf7=_0xef4cf7||0xcc;return function(_0x2a2877){if(_0x2a2877){return _0x4e859f[_0x338d('0x2a')](_0xef4cf7);}return _0x4e859f['status'](_0xef4cf7)['end']();};}function respondWithResult(_0x5e67d7,_0x51a9f6){_0x51a9f6=_0x51a9f6||0xc8;return function(_0xbe316e){if(_0xbe316e){return _0x5e67d7[_0x338d('0x2b')](_0x51a9f6)[_0x338d('0x2c')](_0xbe316e);}};}function respondWithFilteredResult(_0x336a41,_0xfb62d7){return function(_0x25cba2){if(_0x25cba2){var _0x2e3240=typeof _0xfb62d7[_0x338d('0x2d')]===_0x338d('0x2e')&&typeof _0xfb62d7[_0x338d('0x2f')]==='undefined';var _0x13db38=_0x25cba2[_0x338d('0x30')];var _0x6e99c4=_0x2e3240?0x0:_0xfb62d7['offset'];var _0x113f32=_0x2e3240?_0x25cba2[_0x338d('0x30')]:_0xfb62d7['offset']+_0xfb62d7[_0x338d('0x2f')];var _0x520bfc;if(_0x113f32>=_0x13db38){_0x113f32=_0x13db38;_0x520bfc=0xc8;}else{_0x520bfc=0xce;}_0x336a41[_0x338d('0x2b')](_0x520bfc);return _0x336a41[_0x338d('0x31')](_0x338d('0x32'),_0x6e99c4+'-'+_0x113f32+'/'+_0x13db38)[_0x338d('0x2c')](_0x25cba2);}return null;};}function patchUpdates(_0x3055a7){return function(_0x2287e8){try{jsonpatch['apply'](_0x2287e8,_0x3055a7,!![]);}catch(_0xdaed9b){return BPromise[_0x338d('0x33')](_0xdaed9b);}return _0x2287e8['save']();};}function saveUpdates(_0x506536,_0x337714){return function(_0x2e98d1){if(_0x2e98d1){return _0x2e98d1[_0x338d('0x34')](_0x506536)[_0x338d('0x1f')](function(_0x422861){return _0x422861;});}return null;};}function removeEntity(_0x2967cc,_0x1ace11){return function(_0x2a83e6){if(_0x2a83e6){return _0x2a83e6[_0x338d('0x35')]()[_0x338d('0x1f')](function(){_0x2967cc[_0x338d('0x2b')](0xcc)[_0x338d('0x36')]();});}};}function handleEntityNotFound(_0x4a4713,_0x595557){return function(_0xcfb62){if(!_0xcfb62){_0x4a4713[_0x338d('0x2a')](0x194);}return _0xcfb62;};}function handleError(_0xb38cd8,_0x42e59e){_0x42e59e=_0x42e59e||0x1f4;return function(_0x347817){logger['error'](_0x347817['stack']);if(_0x347817[_0x338d('0x37')]){delete _0x347817['name'];}_0xb38cd8[_0x338d('0x2b')](_0x42e59e)[_0x338d('0x38')](_0x347817);};}exports[_0x338d('0x39')]=function(_0x3b004f,_0x22a5a9){var _0x8e5ea9={},_0x277c46={},_0x2c3edb={'count':0x0,'rows':[]};var _0x2fd5f3=_[_0x338d('0x3a')](db[_0x338d('0x3b')][_0x338d('0x3c')],function(_0x378f81){return{'name':_0x378f81[_0x338d('0x3d')],'type':_0x378f81[_0x338d('0x3e')][_0x338d('0x3f')]};});_0x277c46[_0x338d('0x40')]=_['map'](_0x2fd5f3,_0x338d('0x37'));_0x277c46[_0x338d('0x41')]=_['keys'](_0x3b004f[_0x338d('0x41')]);_0x277c46[_0x338d('0x42')]=_[_0x338d('0x43')](_0x277c46[_0x338d('0x40')],_0x277c46[_0x338d('0x41')]);_0x8e5ea9[_0x338d('0x44')]=_['intersection'](_0x277c46[_0x338d('0x40')],qs['fields'](_0x3b004f[_0x338d('0x41')][_0x338d('0x45')]));_0x8e5ea9['attributes']=_0x8e5ea9[_0x338d('0x44')]['length']?_0x8e5ea9[_0x338d('0x44')]:_0x277c46[_0x338d('0x40')];if(!_0x3b004f[_0x338d('0x41')][_0x338d('0x46')](_0x338d('0x47'))){_0x8e5ea9[_0x338d('0x2f')]=qs[_0x338d('0x2f')](_0x3b004f[_0x338d('0x41')]['limit']);_0x8e5ea9[_0x338d('0x2d')]=qs['offset'](_0x3b004f[_0x338d('0x41')][_0x338d('0x2d')]);}_0x8e5ea9['order']=qs[_0x338d('0x48')](_0x3b004f['query'][_0x338d('0x48')]);_0x8e5ea9[_0x338d('0x49')]=qs[_0x338d('0x42')](_['pick'](_0x3b004f[_0x338d('0x41')],_0x277c46['filters']),_0x2fd5f3);if(_0x3b004f[_0x338d('0x41')][_0x338d('0x4a')]){_0x8e5ea9['where']=_[_0x338d('0x4b')](_0x8e5ea9[_0x338d('0x49')],{'$or':_['map'](_0x2fd5f3,function(_0x1a2c45){if(_0x1a2c45['type']!==_0x338d('0x4c')){var _0x13a821={};_0x13a821[_0x1a2c45[_0x338d('0x37')]]={'$like':'%'+_0x3b004f['query'][_0x338d('0x4a')]+'%'};return _0x13a821;}})});}_0x8e5ea9=_[_0x338d('0x4b')]({},_0x8e5ea9,_0x3b004f['options']);var _0x34805f={'where':_0x8e5ea9[_0x338d('0x49')]};return db['Setting']['count'](_0x34805f)[_0x338d('0x1f')](function(_0x3be830){_0x2c3edb[_0x338d('0x30')]=_0x3be830;if(_0x3b004f[_0x338d('0x41')][_0x338d('0x4d')]){_0x8e5ea9[_0x338d('0x4e')]=[{'all':!![]}];}return db[_0x338d('0x3b')][_0x338d('0x4f')](_0x8e5ea9);})[_0x338d('0x1f')](function(_0x4f5a75){_0x2c3edb[_0x338d('0x50')]=_0x4f5a75;return _0x2c3edb;})[_0x338d('0x1f')](respondWithFilteredResult(_0x22a5a9,_0x8e5ea9))['catch'](handleError(_0x22a5a9,null));};exports['show']=function(_0x573cc1,_0x4c5f42){var _0x3cbff8={'raw':![],'where':{'id':_0x573cc1['params']['id']}},_0x4ad1dd={};_0x4ad1dd[_0x338d('0x40')]=_[_0x338d('0x51')](db[_0x338d('0x3b')][_0x338d('0x3c')]);_0x4ad1dd[_0x338d('0x41')]=_[_0x338d('0x51')](_0x573cc1[_0x338d('0x41')]);_0x4ad1dd['filters']=_[_0x338d('0x43')](_0x4ad1dd['model'],_0x4ad1dd[_0x338d('0x41')]);_0x3cbff8[_0x338d('0x44')]=_[_0x338d('0x43')](_0x4ad1dd['model'],qs['fields'](_0x573cc1['query']['fields']));_0x3cbff8[_0x338d('0x44')]=_0x3cbff8[_0x338d('0x44')]['length']?_0x3cbff8[_0x338d('0x44')]:_0x4ad1dd[_0x338d('0x40')];if(_0x573cc1[_0x338d('0x41')][_0x338d('0x4d')]){_0x3cbff8[_0x338d('0x4e')]=[{'all':!![]}];}_0x3cbff8=_[_0x338d('0x4b')]({},_0x3cbff8,_0x573cc1[_0x338d('0x52')]);return db['Setting'][_0x338d('0x53')](_0x3cbff8)['then'](handleEntityNotFound(_0x4c5f42,null))[_0x338d('0x1f')](respondWithResult(_0x4c5f42,null))[_0x338d('0x29')](handleError(_0x4c5f42,null));};exports[_0x338d('0x34')]=function(_0x39335e,_0x751c47){if(_0x39335e[_0x338d('0x54')]['id']){delete _0x39335e[_0x338d('0x54')]['id'];}return db[_0x338d('0x3b')][_0x338d('0x53')]({'where':{'id':_0x39335e[_0x338d('0x55')]['id']}})[_0x338d('0x1f')](handleEntityNotFound(_0x751c47,null))[_0x338d('0x1f')](saveUpdates(_0x39335e['body'],null))[_0x338d('0x1f')](respondWithResult(_0x751c47,null))['catch'](handleError(_0x751c47,null));};exports[_0x338d('0x56')]=function(_0xf6d7d4,_0x252035,_0x46211d){if(_0xf6d7d4['file']&&_0xf6d7d4[_0x338d('0x57')][_0x338d('0x58')]){_0xf6d7d4[_0x338d('0x54')][_0x338d('0x59')]=_0xf6d7d4[_0x338d('0x57')][_0x338d('0x58')];}return db[_0x338d('0x3b')][_0x338d('0x53')]({'where':{'id':_0xf6d7d4['params']['id']}})['then'](handleEntityNotFound(_0x252035,null))[_0x338d('0x1f')](saveUpdates(_0xf6d7d4[_0x338d('0x54')],null))[_0x338d('0x1f')](respondWithResult(_0x252035,null))[_0x338d('0x29')](handleError(_0x252035,null));};exports['addLogoLogin']=function(_0x157972,_0x3fc26d,_0x41c25b){if(_0x157972['file']&&_0x157972['file']['filename']){_0x157972[_0x338d('0x54')][_0x338d('0x5a')]=_0x157972[_0x338d('0x57')][_0x338d('0x58')];}return db[_0x338d('0x3b')]['find']({'where':{'id':_0x157972[_0x338d('0x55')]['id']}})[_0x338d('0x1f')](handleEntityNotFound(_0x3fc26d,null))[_0x338d('0x1f')](saveUpdates(_0x157972[_0x338d('0x54')],null))[_0x338d('0x1f')](respondWithResult(_0x3fc26d,null))[_0x338d('0x29')](handleError(_0x3fc26d,null));};var utilLicense=require(_0x338d('0x1a'));exports[_0x338d('0x5b')]=function(_0x29cbba,_0x110d32,_0x10cceb){var _0x12dcae=_0x338d('0x5c');var _0x4f39fb={'custom':![]};return utilLicense[_0x338d('0x5d')]()[_0x338d('0x1f')](function(_0x2f3ccf){if(_0x2f3ccf){_0x4f39fb=_0x2f3ccf;}return db[_0x338d('0x3b')][_0x338d('0x53')]({'where':{'id':_0x29cbba[_0x338d('0x55')]['id']},'attributes':['logo',_0x338d('0x5a'),'preferred',_0x338d('0x5e'),_0x338d('0x5f'),_0x338d('0x60'),'defaultPreferred',_0x338d('0x61')],'raw':!![]});})[_0x338d('0x1f')](handleEntityNotFound(_0x110d32,null))[_0x338d('0x1f')](function(_0x178c58){if(_0x178c58){var _0xda5d9a=_0x178c58[_0x338d('0x59')]&&fs[_0x338d('0x62')](path[_0x338d('0x63')](config['root'],_0x12dcae,_[_0x338d('0x64')](_0x178c58['logo'])))?path[_0x338d('0x63')](config[_0x338d('0x65')],_0x12dcae,_[_0x338d('0x64')](_0x178c58[_0x338d('0x59')])):path['join'](config[_0x338d('0x65')],_0x12dcae,_[_0x338d('0x64')](_0x338d('0x66')));var _0xb2a349='default'+_['upperFirst']('logo');if(_0x178c58[_0xb2a349]||!_0x4f39fb[_0x338d('0x67')]){_0xda5d9a=path[_0x338d('0x63')](config[_0x338d('0x65')],_0x12dcae,_[_0x338d('0x64')](_0x338d('0x66')));}if(!fs['existsSync'](_0xda5d9a)){throw new db[(_0x338d('0x68'))][(_0x338d('0x69'))](_[_0x338d('0x6a')]('logo')+_0x338d('0x6b'));}return _0x110d32['download'](_0xda5d9a);}})[_0x338d('0x29')](handleError(_0x110d32,null));};var utilLicense=require('../../config/license/util');exports[_0x338d('0x6c')]=function(_0x1122fe,_0x2656a2,_0x1be880){var _0x1b5e9f=_0x338d('0x5c');var _0xb89bb9={'custom':![]};return utilLicense[_0x338d('0x5d')]()[_0x338d('0x1f')](function(_0x33a430){if(_0x33a430){_0xb89bb9=_0x33a430;}return db[_0x338d('0x3b')][_0x338d('0x53')]({'where':{'id':_0x1122fe[_0x338d('0x55')]['id']},'attributes':['logo','loginLogo',_0x338d('0x6d'),'favicon','defaultLogo',_0x338d('0x60'),_0x338d('0x6e'),_0x338d('0x61')],'raw':!![]});})[_0x338d('0x1f')](handleEntityNotFound(_0x2656a2,null))[_0x338d('0x1f')](function(_0x5972c9){if(_0x5972c9){var _0x116fa1=_0x5972c9[_0x338d('0x5a')]&&fs['existsSync'](path['join'](config['root'],_0x1b5e9f,_[_0x338d('0x64')](_0x5972c9[_0x338d('0x5a')])))?path[_0x338d('0x63')](config['root'],_0x1b5e9f,_[_0x338d('0x64')](_0x5972c9[_0x338d('0x5a')])):path['join'](config[_0x338d('0x65')],_0x1b5e9f,_['toLower'](_0x338d('0x6f')));var _0x30032e='default'+_[_0x338d('0x6a')](_0x338d('0x5a'));if(_0x5972c9[_0x30032e]||!_0xb89bb9[_0x338d('0x67')]){_0x116fa1=path[_0x338d('0x63')](config[_0x338d('0x65')],_0x1b5e9f,_[_0x338d('0x64')](_0x338d('0x6f')));}if(!fs[_0x338d('0x62')](_0x116fa1)){throw new db[(_0x338d('0x68'))][(_0x338d('0x69'))](_[_0x338d('0x6a')](_0x338d('0x5a'))+_0x338d('0x6b'));}return _0x2656a2[_0x338d('0x70')](_0x116fa1);}})['catch'](handleError(_0x2656a2,null));};exports['gdpr']=function(_0x1d1605,_0x1527ab){return db[_0x338d('0x3b')]['find']({'where':{'id':_0x1d1605['params']['id']},'attributes':['securePassword']})[_0x338d('0x1f')](respondWithResult(_0x1527ab,null))[_0x338d('0x29')](handleError(_0x1527ab,null));};exports[_0x338d('0x71')]=function(_0x4e4ab0,_0x2895f4,_0x315d79){if(_0x4e4ab0[_0x338d('0x57')]&&_0x4e4ab0[_0x338d('0x57')]['filename']){_0x4e4ab0[_0x338d('0x54')]['preferred']=_0x4e4ab0[_0x338d('0x57')][_0x338d('0x58')];}return db[_0x338d('0x3b')]['find']({'where':{'id':_0x4e4ab0['params']['id']}})[_0x338d('0x1f')](handleEntityNotFound(_0x2895f4,null))['then'](saveUpdates(_0x4e4ab0[_0x338d('0x54')],null))[_0x338d('0x1f')](respondWithResult(_0x2895f4,null))[_0x338d('0x29')](handleError(_0x2895f4,null));};var utilLicense=require(_0x338d('0x1a'));exports[_0x338d('0x72')]=function(_0x5cc2d1,_0x2d3281,_0x5a8c6e){var _0x130dda=_0x338d('0x5c');var _0x45abaf={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x265208){if(_0x265208){_0x45abaf=_0x265208;}return db['Setting'][_0x338d('0x53')]({'where':{'id':_0x5cc2d1[_0x338d('0x55')]['id']},'attributes':[_0x338d('0x59'),_0x338d('0x5a'),_0x338d('0x6d'),'favicon',_0x338d('0x5f'),_0x338d('0x60'),'defaultPreferred',_0x338d('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x2d3281,null))['then'](function(_0x2dc5ae){if(_0x2dc5ae){var _0x4f48ed=_0x2dc5ae[_0x338d('0x6d')]&&fs[_0x338d('0x62')](path[_0x338d('0x63')](config[_0x338d('0x65')],_0x130dda,_[_0x338d('0x64')](_0x2dc5ae[_0x338d('0x6d')])))?path[_0x338d('0x63')](config[_0x338d('0x65')],_0x130dda,_[_0x338d('0x64')](_0x2dc5ae['preferred'])):path['join'](config[_0x338d('0x65')],_0x130dda,_[_0x338d('0x64')]('default_preferred.png'));var _0x473663=_0x338d('0x73')+_[_0x338d('0x6a')](_0x338d('0x6d'));if(_0x2dc5ae[_0x473663]||!_0x45abaf['custom']||!_0x45abaf[_0x338d('0x6d')]){_0x4f48ed=path[_0x338d('0x63')](config[_0x338d('0x65')],_0x130dda,_[_0x338d('0x64')]('default_preferred.png'));}if(!fs['existsSync'](_0x4f48ed)){throw new db[(_0x338d('0x68'))]['ValidationError'](_[_0x338d('0x6a')](_0x338d('0x6d'))+_0x338d('0x6b'));}return _0x2d3281[_0x338d('0x70')](_0x4f48ed);}})['catch'](handleError(_0x2d3281,null));};exports[_0x338d('0x74')]=function(_0x101bde,_0x55dc44,_0x36f67d){if(_0x101bde[_0x338d('0x57')]&&_0x101bde[_0x338d('0x57')][_0x338d('0x58')]){_0x101bde[_0x338d('0x54')][_0x338d('0x5e')]=_0x101bde['file'][_0x338d('0x58')];}return db[_0x338d('0x3b')][_0x338d('0x53')]({'where':{'id':_0x101bde[_0x338d('0x55')]['id']}})[_0x338d('0x1f')](handleEntityNotFound(_0x55dc44,null))[_0x338d('0x1f')](saveUpdates(_0x101bde[_0x338d('0x54')],null))[_0x338d('0x1f')](respondWithResult(_0x55dc44,null))[_0x338d('0x29')](handleError(_0x55dc44,null));};var utilLicense=require(_0x338d('0x1a'));exports[_0x338d('0x75')]=function(_0x8b0962,_0x4e1c21,_0xd8ec50){var _0x46b35a=_0x338d('0x5c');var _0x92ceac={'custom':![]};return utilLicense[_0x338d('0x5d')]()[_0x338d('0x1f')](function(_0x5c4947){if(_0x5c4947){_0x92ceac=_0x5c4947;}return db[_0x338d('0x3b')]['find']({'where':{'id':_0x8b0962[_0x338d('0x55')]['id']},'attributes':[_0x338d('0x59'),_0x338d('0x5a'),_0x338d('0x6d'),_0x338d('0x5e'),'defaultLogo',_0x338d('0x60'),_0x338d('0x6e'),_0x338d('0x61')],'raw':!![]});})[_0x338d('0x1f')](handleEntityNotFound(_0x4e1c21,null))[_0x338d('0x1f')](function(_0x34ff5e){if(_0x34ff5e){var _0x4df832=_0x34ff5e['favicon']&&fs[_0x338d('0x62')](path[_0x338d('0x63')](config[_0x338d('0x65')],_0x46b35a,_['toLower'](_0x34ff5e[_0x338d('0x5e')])))?path['join'](config[_0x338d('0x65')],_0x46b35a,_[_0x338d('0x64')](_0x34ff5e[_0x338d('0x5e')])):path['join'](config[_0x338d('0x65')],_0x46b35a,_[_0x338d('0x64')](_0x338d('0x76')));var _0x38105e=_0x338d('0x73')+_[_0x338d('0x6a')](_0x338d('0x5e'));if(_0x34ff5e[_0x38105e]||!_0x92ceac[_0x338d('0x67')]){_0x4df832=path['join'](config['root'],_0x46b35a,_[_0x338d('0x64')](_0x338d('0x76')));}if(!fs[_0x338d('0x62')](_0x4df832)){throw new db[(_0x338d('0x68'))]['ValidationError'](_[_0x338d('0x6a')](_0x338d('0x5e'))+_0x338d('0x6b'));}return _0x4e1c21[_0x338d('0x70')](_0x4df832);}})[_0x338d('0x29')](handleError(_0x4e1c21,null));};exports[_0x338d('0x77')]=function(_0x5f3342,_0x331c73){var _0x456912={'offset':moment()[_0x338d('0x78')]()};_0x456912[_0x338d('0x79')]=moment()[_0x338d('0x78')](_0x456912['offset'])[_0x338d('0x7a')](_0x338d('0x7b'));return _0x331c73['status'](0xc8)['send'](_0x456912);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index e0f947d..8965e26 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 _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x573c9e,_0xd4ab71){var _0x5d0714=function(_0x127a2a){while(--_0x127a2a){_0x573c9e['push'](_0x573c9e['shift']());}};_0x5d0714(++_0xd4ab71);}(_0x008c,0x188));var _0xc008=function(_0x590d15,_0x26d156){_0x590d15=_0x590d15-0x0;var _0x16377e=_0x008c[_0x590d15];return _0x16377e;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x40f9a0,_0x3458cc){var _0x3e3144=function(_0x1f8fce){while(--_0x1f8fce){_0x40f9a0['push'](_0x40f9a0['shift']());}};_0x3e3144(++_0x3458cc);}(_0x008c,0x188));var _0xc008=function(_0x3512b2,_0x2cb54a){_0x3512b2=_0x3512b2-0x0;var _0x16c6e8=_0x008c[_0x3512b2];return _0x16c6e8;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 982863f..00e444e 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 _0x04a9=['map','model','attributes','debug','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','ShowSetting','Setting','find','options','raw','include'];(function(_0x12f1d3,_0x3c324c){var _0x1dc0d6=function(_0x14b621){while(--_0x14b621){_0x12f1d3['push'](_0x12f1d3['shift']());}};_0x1dc0d6(++_0x3c324c);}(_0x04a9,0x18c));var _0x904a=function(_0x420e3a,_0x1c378e){_0x420e3a=_0x420e3a-0x0;var _0x1d059d=_0x04a9[_0x420e3a];return _0x1d059d;};'use strict';var _=require('lodash');var util=require(_0x904a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x904a('0x1'));var fs=require('fs');var Redis=require(_0x904a('0x2'));var db=require(_0x904a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x904a('0x4'))(_0x904a('0x5'));var config=require(_0x904a('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x904a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x29df8e,_0x3619ec,_0x57a5ad){return new BPromise(function(_0x394321,_0x53a5f5){return client['request'](_0x29df8e,_0x57a5ad)[_0x904a('0x8')](function(_0x1d0609){logger[_0x904a('0x9')](_0x904a('0xa'),_0x3619ec,_0x904a('0xb'));logger['debug'](_0x904a('0xc'),_0x3619ec,_0x904a('0xb'),JSON[_0x904a('0xd')](_0x1d0609));if(_0x1d0609['error']){if(_0x1d0609['error'][_0x904a('0xe')]===0x1f4){logger[_0x904a('0xf')](_0x904a('0xa'),_0x3619ec,_0x1d0609[_0x904a('0xf')]['message']);return _0x53a5f5(_0x1d0609['error'][_0x904a('0x10')]);}logger[_0x904a('0xf')](_0x904a('0xa'),_0x3619ec,_0x1d0609[_0x904a('0xf')][_0x904a('0x10')]);return _0x394321(_0x1d0609[_0x904a('0xf')][_0x904a('0x10')]);}else{logger[_0x904a('0x9')]('Setting,\x20%s,\x20%s',_0x3619ec,'request\x20sent');_0x394321(_0x1d0609['result']['message']);}})[_0x904a('0x11')](function(_0x274041){logger[_0x904a('0xf')](_0x904a('0xa'),_0x3619ec,_0x274041);_0x53a5f5(_0x274041);});});}exports[_0x904a('0x12')]=function(_0x44a56a){var _0x1139a1=this;return new Promise(function(_0x237ca6,_0x28d33c){return db[_0x904a('0x13')][_0x904a('0x14')]({'raw':_0x44a56a[_0x904a('0x15')]?_0x44a56a['options'][_0x904a('0x16')]===undefined?!![]:![]:!![],'where':_0x44a56a[_0x904a('0x15')]?_0x44a56a[_0x904a('0x15')]['where']||null:null,'attributes':_0x44a56a[_0x904a('0x15')]?_0x44a56a[_0x904a('0x15')]['attributes']||null:null,'include':_0x44a56a[_0x904a('0x15')]?_0x44a56a[_0x904a('0x15')][_0x904a('0x17')]?_[_0x904a('0x18')](_0x44a56a[_0x904a('0x15')][_0x904a('0x17')],function(_0x37c0a6){return{'model':db[_0x37c0a6[_0x904a('0x19')]],'as':_0x37c0a6['as'],'attributes':_0x37c0a6[_0x904a('0x1a')],'include':_0x37c0a6[_0x904a('0x17')]?_[_0x904a('0x18')](_0x37c0a6[_0x904a('0x17')],function(_0x5eae87){return{'model':db[_0x5eae87[_0x904a('0x19')]],'as':_0x5eae87['as'],'attributes':_0x5eae87[_0x904a('0x1a')],'include':_0x5eae87[_0x904a('0x17')]?_['map'](_0x5eae87[_0x904a('0x17')],function(_0x93d178){return{'model':db[_0x93d178['model']],'as':_0x93d178['as'],'attributes':_0x93d178['attributes']};}):[]};}):[]};}):[]:[]})[_0x904a('0x8')](function(_0x43b234){logger[_0x904a('0x9')](_0x904a('0x12'),_0x44a56a);logger[_0x904a('0x1b')]('ShowSetting',_0x44a56a,JSON['stringify'](_0x43b234));_0x237ca6(_0x43b234);})[_0x904a('0x11')](function(_0x3640f6){logger[_0x904a('0xf')](_0x904a('0x12'),_0x3640f6['message'],_0x44a56a);_0x28d33c(_0x1139a1['error'](0x1f4,_0x3640f6['message']));});});}; \ No newline at end of file +var _0x9800=['http','request','then','info','Setting,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','Setting','raw','options','where','attributes','include','map','model','ShowSetting','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4caf0d,_0x580ea2){var _0x473297=function(_0xf159ac){while(--_0xf159ac){_0x4caf0d['push'](_0x4caf0d['shift']());}};_0x473297(++_0x580ea2);}(_0x9800,0x135));var _0x0980=function(_0x43e235,_0x216d75){_0x43e235=_0x43e235-0x0;var _0x592282=_0x9800[_0x43e235];return _0x592282;};'use strict';var _=require(_0x0980('0x0'));var util=require(_0x0980('0x1'));var moment=require(_0x0980('0x2'));var BPromise=require(_0x0980('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0980('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0980('0x5'));var logger=require(_0x0980('0x6'))(_0x0980('0x7'));var config=require(_0x0980('0x8'));var jayson=require(_0x0980('0x9'));var client=jayson[_0x0980('0xa')][_0x0980('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5456d0,_0x425965,_0x4c3d2e){return new BPromise(function(_0x11565c,_0x25afc4){return client[_0x0980('0xc')](_0x5456d0,_0x4c3d2e)[_0x0980('0xd')](function(_0x56e095){logger[_0x0980('0xe')](_0x0980('0xf'),_0x425965,'request\x20sent');logger[_0x0980('0x10')]('Setting,\x20%s,\x20%s,\x20%s',_0x425965,'request\x20sent',JSON[_0x0980('0x11')](_0x56e095));if(_0x56e095[_0x0980('0x12')]){if(_0x56e095[_0x0980('0x12')][_0x0980('0x13')]===0x1f4){logger[_0x0980('0x12')](_0x0980('0xf'),_0x425965,_0x56e095[_0x0980('0x12')]['message']);return _0x25afc4(_0x56e095[_0x0980('0x12')][_0x0980('0x14')]);}logger[_0x0980('0x12')](_0x0980('0xf'),_0x425965,_0x56e095[_0x0980('0x12')]['message']);return _0x11565c(_0x56e095[_0x0980('0x12')]['message']);}else{logger[_0x0980('0xe')](_0x0980('0xf'),_0x425965,_0x0980('0x15'));_0x11565c(_0x56e095['result']['message']);}})['catch'](function(_0x10cf5a){logger[_0x0980('0x12')]('Setting,\x20%s,\x20%s',_0x425965,_0x10cf5a);_0x25afc4(_0x10cf5a);});});}exports['ShowSetting']=function(_0x39ec1c){var _0x438e8c=this;return new Promise(function(_0x5d7874,_0x156544){return db[_0x0980('0x16')]['find']({'raw':_0x39ec1c['options']?_0x39ec1c['options'][_0x0980('0x17')]===undefined?!![]:![]:!![],'where':_0x39ec1c[_0x0980('0x18')]?_0x39ec1c[_0x0980('0x18')][_0x0980('0x19')]||null:null,'attributes':_0x39ec1c[_0x0980('0x18')]?_0x39ec1c['options'][_0x0980('0x1a')]||null:null,'include':_0x39ec1c[_0x0980('0x18')]?_0x39ec1c['options'][_0x0980('0x1b')]?_[_0x0980('0x1c')](_0x39ec1c['options'][_0x0980('0x1b')],function(_0x31ab7d){return{'model':db[_0x31ab7d[_0x0980('0x1d')]],'as':_0x31ab7d['as'],'attributes':_0x31ab7d['attributes'],'include':_0x31ab7d[_0x0980('0x1b')]?_[_0x0980('0x1c')](_0x31ab7d[_0x0980('0x1b')],function(_0x30c087){return{'model':db[_0x30c087['model']],'as':_0x30c087['as'],'attributes':_0x30c087[_0x0980('0x1a')],'include':_0x30c087[_0x0980('0x1b')]?_[_0x0980('0x1c')](_0x30c087[_0x0980('0x1b')],function(_0x11bcae){return{'model':db[_0x11bcae[_0x0980('0x1d')]],'as':_0x11bcae['as'],'attributes':_0x11bcae[_0x0980('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0980('0xd')](function(_0xda647d){logger[_0x0980('0xe')](_0x0980('0x1e'),_0x39ec1c);logger[_0x0980('0x10')](_0x0980('0x1e'),_0x39ec1c,JSON['stringify'](_0xda647d));_0x5d7874(_0xda647d);})[_0x0980('0x1f')](function(_0x5a661c){logger[_0x0980('0x12')](_0x0980('0x1e'),_0x5a661c[_0x0980('0x14')],_0x39ec1c);_0x156544(_0x438e8c[_0x0980('0x12')](0x1f4,_0x5a661c['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d8f3687..8f6c19c 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 _0xe14b=['./smsAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','statusGet','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send','send','put','update','/:id','destroy','removeDispositions','delete','/:id/users','removeAgents','multer','util','express','Router','../../components/auth/service'];(function(_0x4c4664,_0x506a85){var _0x2920cf=function(_0x54a19d){while(--_0x54a19d){_0x4c4664['push'](_0x4c4664['shift']());}};_0x2920cf(++_0x506a85);}(_0xe14b,0x93));var _0xbe14=function(_0x5893fb,_0x275b3f){_0x5893fb=_0x5893fb-0x0;var _0x2b3ab6=_0xe14b[_0x5893fb];return _0x2b3ab6;};'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['getDispositions']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x6')](_0xbe14('0x10'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x6')](_0xbe14('0x12'),controller[_0xbe14('0x13')]);router[_0xbe14('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x14')]);router[_0xbe14('0x15')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x16')]);router['post'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x15')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);router['post'](_0xbe14('0x19'),controller[_0xbe14('0x1a')]);router[_0xbe14('0x15')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1b')]);router['post'](_0xbe14('0x1c'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x1d')]);router[_0xbe14('0x15')](_0xbe14('0x12'),controller['status']);router[_0xbe14('0x15')]('/:id/users',auth[_0xbe14('0x7')](),controller['addAgents']);router[_0xbe14('0x1e')]('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0x1f')]);router['delete'](_0xbe14('0x20'),auth['isAuthenticated'](),controller[_0xbe14('0x21')]);router['delete'](_0xbe14('0xb'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x22')]);router[_0xbe14('0x23')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeAnswers']);router[_0xbe14('0x23')](_0xbe14('0x24'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x25')]);module['exports']=router; \ No newline at end of file +var _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x133786,_0x583a46){var _0x138c24=function(_0x3734ac){while(--_0x3734ac){_0x133786['push'](_0x133786['shift']());}};_0x138c24(++_0x583a46);}(_0x6aa7,0x178));var _0x76aa=function(_0x425447,_0x6e644c){_0x425447=_0x425447-0x0;var _0x58e6e6=_0x6aa7[_0x425447];return _0x58e6e6;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index a19914d..2fe398e 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 _0xcfd5=['mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','STRING','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x32dff4,_0x41653c){var _0xfd488=function(_0xb3bc58){while(--_0xb3bc58){_0x32dff4['push'](_0x32dff4['shift']());}};_0xfd488(++_0x41653c);}(_0xcfd5,0xa3));var _0x5cfd=function(_0x20e229,_0xf460){_0x20e229=_0x20e229-0x0;var _0x387c39=_0xcfd5[_0x20e229];return _0x387c39;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x5cfd('0x0'));module[_0x5cfd('0x1')]={'name':{'type':Sequelize[_0x5cfd('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x5cfd('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x5cfd('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x5cfd('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x5cfd('0x2')]},'type':{'type':Sequelize[_0x5cfd('0x3')](_0x5cfd('0x4'),_0x5cfd('0x5'),_0x5cfd('0x6'),_0x5cfd('0x7'),_0x5cfd('0x8'),_0x5cfd('0x9'),_0x5cfd('0xa'),_0x5cfd('0xb'),_0x5cfd('0xc'),_0x5cfd('0xd'))},'accountSid':{'type':Sequelize[_0x5cfd('0x2')]},'authId':{'type':Sequelize[_0x5cfd('0x2')]},'authToken':{'type':Sequelize[_0x5cfd('0x2')]},'smsMethod':{'type':Sequelize[_0x5cfd('0x3')]('SI','TI','GP')},'username':{'type':Sequelize[_0x5cfd('0x2')]},'password':{'type':Sequelize[_0x5cfd('0x2')]},'apiKey':{'type':Sequelize[_0x5cfd('0x2')]},'applicationId':{'type':Sequelize[_0x5cfd('0x2')]},'accountId':{'type':Sequelize[_0x5cfd('0x2')]},'senderString':{'type':Sequelize[_0x5cfd('0x2')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x5cfd('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x5cfd('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5cfd('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5cfd('0xf')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5cfd('0xe')],'defaultValue':![],'comment':_0x5cfd('0x10'),'set':function(_0x20c27c){if(!_0x20c27c)this['setDataValue'](_0x5cfd('0x11'),null);this[_0x5cfd('0x12')](_0x5cfd('0x13'),_0x20c27c);}}}; \ No newline at end of file +var _0x40ba=['clickatell','bandwidth','csc','infobip','intelepeer','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','STRING','ENUM','twilio','skebby','clicksend','plivo'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x40ba,0x92));var _0xa40b=function(_0x895358,_0x32f914){_0x895358=_0x895358-0x0;var _0x26e26e=_0x40ba[_0x895358];return _0x26e26e;};'use strict';var Sequelize=require(_0xa40b('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xa40b('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xa40b('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xa40b('0x1')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xa40b('0x1')]},'type':{'type':Sequelize[_0xa40b('0x2')](_0xa40b('0x3'),_0xa40b('0x4'),'connectel',_0xa40b('0x5'),_0xa40b('0x6'),_0xa40b('0x7'),_0xa40b('0x8'),_0xa40b('0x9'),_0xa40b('0xa'),_0xa40b('0xb'))},'accountSid':{'type':Sequelize[_0xa40b('0x1')]},'authId':{'type':Sequelize[_0xa40b('0x1')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0xa40b('0x2')]('SI','TI','GP')},'username':{'type':Sequelize[_0xa40b('0x1')]},'password':{'type':Sequelize[_0xa40b('0x1')]},'apiKey':{'type':Sequelize[_0xa40b('0x1')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xa40b('0x1')]},'senderString':{'type':Sequelize[_0xa40b('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xa40b('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xa40b('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa40b('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa40b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa40b('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa40b('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xa40b('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa40b('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa40b('0xd')],'defaultValue':![],'comment':_0xa40b('0xf'),'set':function(_0x47a42){if(!_0x47a42)this[_0xa40b('0x10')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x47a42);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index bab492b..482910d 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 _0xc0c4=['message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','name','send','index','Pause','map','SmsAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','includeAll','rows','show','params','mandatoryDispositionPause','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','SmsAccountId','getDispositions','findOne','Disposition','nolimit','order','pick','options','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','account','applications','Applications','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','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','CmContact','DESC','list','Contacts','defaults','contact','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','User','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','text/xml','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','internal','Tag','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','SmsMessage','Messages','spread','dataValues','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','groupName','intelepeer','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','ACCEPTD','statusGet','csc','message-id','state','addAgents','emit','isArray','userSmsAccount:remove','getAgents','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s'];(function(_0x431475,_0x1c44fa){var _0x12dc10=function(_0x13247d){while(--_0x13247d){_0x431475['push'](_0x431475['shift']());}};_0x12dc10(++_0x1c44fa);}(_0xc0c4,0xbc));var _0x4c0c=function(_0x77c2c7,_0x6e8778){_0x77c2c7=_0x77c2c7-0x0;var _0x3e6dcd=_0xc0c4[_0x77c2c7];return _0x3e6dcd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c0c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c0c('0x1'));var moment=require(_0x4c0c('0x2'));var BPromise=require(_0x4c0c('0x3'));var Mustache=require(_0x4c0c('0x4'));var util=require(_0x4c0c('0x5'));var path=require(_0x4c0c('0x6'));var sox=require(_0x4c0c('0x7'));var csv=require(_0x4c0c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4c0c('0x9'));var crypto=require(_0x4c0c('0xa'));var jsforce=require(_0x4c0c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4c0c('0x8'));var querystring=require('querystring');var Papa=require(_0x4c0c('0xc'));var Redis=require(_0x4c0c('0xd'));var authService=require(_0x4c0c('0xe'));var qs=require(_0x4c0c('0xf'));var as=require(_0x4c0c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c0c('0x11'))(_0x4c0c('0x12'));var utils=require('../../config/utils');var config=require(_0x4c0c('0x13'));var licenseUtil=require(_0x4c0c('0x14'));var db=require(_0x4c0c('0x15'))['db'];config[_0x4c0c('0x16')]=_['defaults'](config[_0x4c0c('0x16')],{'host':_0x4c0c('0x17'),'port':0x18eb});var socket=require(_0x4c0c('0x18'))(new Redis(config[_0x4c0c('0x16')]));require(_0x4c0c('0x19'))['register'](socket);var jayson=require(_0x4c0c('0x1a'));var client=jayson[_0x4c0c('0x1b')][_0x4c0c('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x5cbc65,_0x2130d0,_0x30fa29,_0x4e4c85){return new BPromise(function(_0x146066,_0x427307){var _0x23433d=_0x4e4c85||client;return _0x23433d[_0x4c0c('0x1d')](_0x5cbc65,_0x30fa29)['then'](function(_0x572a44){logger[_0x4c0c('0x1e')]('SmsAccount,\x20%s,\x20%s',_0x2130d0,_0x4c0c('0x1f'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2130d0,'request\x20sent',JSON[_0x4c0c('0x20')](_0x572a44));if(_0x572a44[_0x4c0c('0x21')]){if(_0x572a44[_0x4c0c('0x21')][_0x4c0c('0x22')]===0x1f4){logger[_0x4c0c('0x21')](_0x4c0c('0x23'),_0x2130d0,_0x572a44[_0x4c0c('0x21')][_0x4c0c('0x24')]);return _0x427307(_0x572a44[_0x4c0c('0x21')][_0x4c0c('0x24')]);}logger['error'](_0x4c0c('0x23'),_0x2130d0,_0x572a44[_0x4c0c('0x21')][_0x4c0c('0x24')]);return _0x146066(_0x572a44['error']['message']);}else{logger[_0x4c0c('0x1e')](_0x4c0c('0x23'),_0x2130d0,'request\x20sent');_0x146066(_0x572a44['result'][_0x4c0c('0x24')]);}})[_0x4c0c('0x25')](function(_0x3cbd7d){logger['error'](_0x4c0c('0x23'),_0x2130d0,_0x3cbd7d);_0x427307(_0x3cbd7d);});});}function respondWithStatusCode(_0x12bd9b,_0x1179eb){_0x1179eb=_0x1179eb||0xcc;return function(_0x541270){if(_0x541270){return _0x12bd9b[_0x4c0c('0x26')](_0x1179eb);}return _0x12bd9b[_0x4c0c('0x27')](_0x1179eb)[_0x4c0c('0x28')]();};}function respondWithResult(_0x2d5152,_0x312e19){_0x312e19=_0x312e19||0xc8;return function(_0x4bb084){if(_0x4bb084){return _0x2d5152[_0x4c0c('0x27')](_0x312e19)[_0x4c0c('0x29')](_0x4bb084);}};}function respondWithFilteredResult(_0x352d46,_0x2d93e1){return function(_0x378378){if(_0x378378){var _0x46d34a=typeof _0x2d93e1[_0x4c0c('0x2a')]===_0x4c0c('0x2b')&&typeof _0x2d93e1[_0x4c0c('0x2c')]===_0x4c0c('0x2b');var _0x649f51=_0x378378[_0x4c0c('0x2d')];var _0x48f305=_0x46d34a?0x0:_0x2d93e1[_0x4c0c('0x2a')];var _0x38445b=_0x46d34a?_0x378378[_0x4c0c('0x2d')]:_0x2d93e1[_0x4c0c('0x2a')]+_0x2d93e1[_0x4c0c('0x2c')];var _0x4aacd2;if(_0x38445b>=_0x649f51){_0x38445b=_0x649f51;_0x4aacd2=0xc8;}else{_0x4aacd2=0xce;}_0x352d46['status'](_0x4aacd2);return _0x352d46[_0x4c0c('0x2e')](_0x4c0c('0x2f'),_0x48f305+'-'+_0x38445b+'/'+_0x649f51)['json'](_0x378378);}return null;};}function patchUpdates(_0xad485a){return function(_0x37aed2){try{jsonpatch[_0x4c0c('0x30')](_0x37aed2,_0xad485a,!![]);}catch(_0x1c3634){return BPromise[_0x4c0c('0x31')](_0x1c3634);}return _0x37aed2[_0x4c0c('0x32')]();};}function saveUpdates(_0x27c6e0,_0x388120){return function(_0x242fbd){if(_0x242fbd){return _0x242fbd[_0x4c0c('0x33')](_0x27c6e0)[_0x4c0c('0x34')](function(_0x59aa05){return _0x59aa05;});}return null;};}function removeEntity(_0x2bfa39,_0x49ab2a){return function(_0x2a5f8b){if(_0x2a5f8b){return _0x2a5f8b[_0x4c0c('0x35')]()['then'](function(){var _0x531271=_0x2a5f8b[_0x4c0c('0x36')]({'plain':!![]});var _0x389df0='SmsAccounts';return db[_0x4c0c('0x37')][_0x4c0c('0x35')]({'where':{'type':_0x389df0,'resourceId':_0x531271['id']}})[_0x4c0c('0x34')](function(){return _0x2a5f8b;});})['then'](function(){_0x2bfa39[_0x4c0c('0x27')](0xcc)[_0x4c0c('0x28')]();});}};}function handleEntityNotFound(_0x498d9b,_0x466750){return function(_0x56504d){if(!_0x56504d){_0x498d9b[_0x4c0c('0x26')](0x194);}return _0x56504d;};}function handleError(_0x210b03,_0x5796b6){_0x5796b6=_0x5796b6||0x1f4;return function(_0x9f5472){logger['error'](_0x9f5472['stack']);if(_0x9f5472[_0x4c0c('0x38')]){delete _0x9f5472[_0x4c0c('0x38')];}_0x210b03[_0x4c0c('0x27')](_0x5796b6)[_0x4c0c('0x39')](_0x9f5472);};}exports[_0x4c0c('0x3a')]=function(_0x4fd905,_0x193b74){var _0x3a5879={'include':[{'model':db[_0x4c0c('0x3b')],'as':'mandatoryDispositionPause'}]},_0x152777={},_0x4c48a7={'count':0x0,'rows':[]};var _0x192739=_[_0x4c0c('0x3c')](db[_0x4c0c('0x3d')][_0x4c0c('0x3e')],function(_0x3fe299){return{'name':_0x3fe299[_0x4c0c('0x3f')],'type':_0x3fe299[_0x4c0c('0x40')]['key']};});_0x152777[_0x4c0c('0x41')]=_['map'](_0x192739,'name');_0x152777[_0x4c0c('0x42')]=_[_0x4c0c('0x43')](_0x4fd905[_0x4c0c('0x42')]);_0x152777['filters']=_[_0x4c0c('0x44')](_0x152777[_0x4c0c('0x41')],_0x152777['query']);_0x3a5879[_0x4c0c('0x45')]=_[_0x4c0c('0x44')](_0x152777[_0x4c0c('0x41')],qs[_0x4c0c('0x46')](_0x4fd905['query'][_0x4c0c('0x46')]));_0x3a5879[_0x4c0c('0x45')]=_0x3a5879[_0x4c0c('0x45')][_0x4c0c('0x47')]?_0x3a5879['attributes']:_0x152777['model'];if(!_0x4fd905[_0x4c0c('0x42')][_0x4c0c('0x48')]('nolimit')){_0x3a5879[_0x4c0c('0x2c')]=qs['limit'](_0x4fd905[_0x4c0c('0x42')]['limit']);_0x3a5879[_0x4c0c('0x2a')]=qs[_0x4c0c('0x2a')](_0x4fd905[_0x4c0c('0x42')][_0x4c0c('0x2a')]);}_0x3a5879['order']=qs[_0x4c0c('0x49')](_0x4fd905[_0x4c0c('0x42')][_0x4c0c('0x49')]);_0x3a5879[_0x4c0c('0x4a')]=qs[_0x4c0c('0x4b')](_['pick'](_0x4fd905[_0x4c0c('0x42')],_0x152777[_0x4c0c('0x4b')]),_0x192739);if(_0x4fd905[_0x4c0c('0x42')][_0x4c0c('0x4c')]){_0x3a5879[_0x4c0c('0x4a')]=_[_0x4c0c('0x4d')](_0x3a5879['where'],{'$or':_[_0x4c0c('0x3c')](_0x192739,function(_0x3695a7){if(_0x3695a7[_0x4c0c('0x40')]!==_0x4c0c('0x4e')){var _0x5abc96={};_0x5abc96[_0x3695a7[_0x4c0c('0x38')]]={'$like':'%'+_0x4fd905[_0x4c0c('0x42')][_0x4c0c('0x4c')]+'%'};return _0x5abc96;}})});}_0x3a5879=_[_0x4c0c('0x4d')]({},_0x3a5879,_0x4fd905['options']);var _0x21c844={'where':_0x3a5879[_0x4c0c('0x4a')]};return db[_0x4c0c('0x3d')]['count'](_0x21c844)['then'](function(_0x2273d1){_0x4c48a7[_0x4c0c('0x2d')]=_0x2273d1;if(_0x4fd905[_0x4c0c('0x42')][_0x4c0c('0x4f')]){_0x3a5879['include']=[{'all':!![]}];}return db[_0x4c0c('0x3d')]['findAll'](_0x3a5879);})[_0x4c0c('0x34')](function(_0x5ee043){_0x4c48a7[_0x4c0c('0x50')]=_0x5ee043;return _0x4c48a7;})[_0x4c0c('0x34')](respondWithFilteredResult(_0x193b74,_0x3a5879))[_0x4c0c('0x25')](handleError(_0x193b74,null));};exports[_0x4c0c('0x51')]=function(_0x241865,_0x14771a){var _0x4fae44={'raw':![],'where':{'id':_0x241865[_0x4c0c('0x52')]['id']},'include':[{'model':db[_0x4c0c('0x3b')],'as':_0x4c0c('0x53')}]},_0x141b7c={};_0x141b7c['model']=_[_0x4c0c('0x43')](db['SmsAccount'][_0x4c0c('0x3e')]);_0x141b7c[_0x4c0c('0x42')]=_[_0x4c0c('0x43')](_0x241865[_0x4c0c('0x42')]);_0x141b7c[_0x4c0c('0x4b')]=_[_0x4c0c('0x44')](_0x141b7c[_0x4c0c('0x41')],_0x141b7c[_0x4c0c('0x42')]);_0x4fae44[_0x4c0c('0x45')]=_[_0x4c0c('0x44')](_0x141b7c['model'],qs['fields'](_0x241865[_0x4c0c('0x42')]['fields']));_0x4fae44[_0x4c0c('0x45')]=_0x4fae44[_0x4c0c('0x45')][_0x4c0c('0x47')]?_0x4fae44[_0x4c0c('0x45')]:_0x141b7c[_0x4c0c('0x41')];if(_0x241865[_0x4c0c('0x42')]['includeAll']){_0x4fae44[_0x4c0c('0x54')]=[{'all':!![]}];}_0x4fae44=_[_0x4c0c('0x4d')]({},_0x4fae44,_0x241865['options']);return db['SmsAccount']['find'](_0x4fae44)[_0x4c0c('0x34')](handleEntityNotFound(_0x14771a,null))['then'](respondWithResult(_0x14771a,null))[_0x4c0c('0x25')](handleError(_0x14771a,null));};exports[_0x4c0c('0x55')]=function(_0xbf3a42,_0x56d6db){return db[_0x4c0c('0x3d')][_0x4c0c('0x55')](_0xbf3a42[_0x4c0c('0x56')],{})[_0x4c0c('0x34')](function(_0x22eb68){var _0x5bee3d=_0xbf3a42[_0x4c0c('0x57')]['get']({'plain':!![]});if(!_0x5bee3d)throw new Error(_0x4c0c('0x58'));if(_0x5bee3d[_0x4c0c('0x59')]===_0x4c0c('0x57')){var _0x3123d3=_0x22eb68[_0x4c0c('0x36')]({'plain':!![]});var _0x6ca6fb=_0x4c0c('0x5a');return db['UserProfileSection'][_0x4c0c('0x5b')]({'where':{'name':_0x6ca6fb,'userProfileId':_0x5bee3d[_0x4c0c('0x5c')]},'raw':!![]})[_0x4c0c('0x34')](function(_0x42eb95){if(_0x42eb95&&_0x42eb95[_0x4c0c('0x5d')]===0x0){return db[_0x4c0c('0x37')][_0x4c0c('0x55')]({'name':_0x3123d3[_0x4c0c('0x38')],'resourceId':_0x3123d3['id'],'type':_0x42eb95[_0x4c0c('0x38')],'sectionId':_0x42eb95['id']},{})['then'](function(){return _0x22eb68;});}else{return _0x22eb68;}})['catch'](function(_0x58982b){logger[_0x4c0c('0x21')](_0x4c0c('0x5e'),_0x58982b);throw _0x58982b;});}return _0x22eb68;})[_0x4c0c('0x34')](respondWithResult(_0x56d6db,0xc9))['catch'](handleError(_0x56d6db,null));};exports[_0x4c0c('0x33')]=function(_0x45e883,_0x416dec){if(_0x45e883[_0x4c0c('0x56')]['id']){delete _0x45e883['body']['id'];}return db['SmsAccount'][_0x4c0c('0x5b')]({'where':{'id':_0x45e883[_0x4c0c('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0x4c0c('0x53')}]})[_0x4c0c('0x34')](handleEntityNotFound(_0x416dec,null))[_0x4c0c('0x34')](saveUpdates(_0x45e883[_0x4c0c('0x56')],null))[_0x4c0c('0x34')](respondWithResult(_0x416dec,null))[_0x4c0c('0x25')](handleError(_0x416dec,null));};exports['destroy']=function(_0x31b3b7,_0x4f1a7c){return db[_0x4c0c('0x3d')][_0x4c0c('0x5b')]({'where':{'id':_0x31b3b7[_0x4c0c('0x52')]['id']}})[_0x4c0c('0x34')](handleEntityNotFound(_0x4f1a7c,null))['then'](removeEntity(_0x4f1a7c,null))[_0x4c0c('0x25')](handleError(_0x4f1a7c,null));};exports[_0x4c0c('0x5f')]=function(_0x5a7421,_0x4e7788){return db[_0x4c0c('0x3d')][_0x4c0c('0x5f')]()[_0x4c0c('0x34')](respondWithResult(_0x4e7788,null))['catch'](handleError(_0x4e7788,null));};exports['addDisposition']=function(_0x1d01ac,_0x2a63ec,_0x122979){if(_0x1d01ac['body']['id']){delete _0x1d01ac['body']['id'];}return db[_0x4c0c('0x3d')][_0x4c0c('0x5b')]({'where':{'id':_0x1d01ac[_0x4c0c('0x52')]['id']}})[_0x4c0c('0x34')](handleEntityNotFound(_0x2a63ec,null))[_0x4c0c('0x34')](function(_0x413772){if(_0x413772){_0x1d01ac[_0x4c0c('0x56')][_0x4c0c('0x60')]=_0x413772['id'];return db['Disposition'][_0x4c0c('0x55')](_0x1d01ac[_0x4c0c('0x56')]);}})[_0x4c0c('0x34')](respondWithResult(_0x2a63ec,null))['catch'](handleError(_0x2a63ec,null));};exports[_0x4c0c('0x61')]=function(_0x44eca2,_0x5a7c26,_0x300f1f){var _0x2c48aa={'raw':![],'where':{}};var _0x10013f={};var _0x70202f={'count':0x0,'rows':[]};return db[_0x4c0c('0x3d')][_0x4c0c('0x62')]({'where':{'id':_0x44eca2[_0x4c0c('0x52')]['id']}})['then'](handleEntityNotFound(_0x5a7c26,null))[_0x4c0c('0x34')](function(_0x9712a1){if(_0x9712a1){_0x10013f[_0x4c0c('0x41')]=_[_0x4c0c('0x43')](db[_0x4c0c('0x63')][_0x4c0c('0x3e')]);_0x10013f['query']=_[_0x4c0c('0x43')](_0x44eca2[_0x4c0c('0x42')]);_0x10013f['filters']=_['intersection'](_0x10013f[_0x4c0c('0x41')],_0x10013f[_0x4c0c('0x42')]);_0x2c48aa['attributes']=_[_0x4c0c('0x44')](_0x10013f[_0x4c0c('0x41')],qs[_0x4c0c('0x46')](_0x44eca2[_0x4c0c('0x42')][_0x4c0c('0x46')]));_0x2c48aa[_0x4c0c('0x45')]=_0x2c48aa['attributes'][_0x4c0c('0x47')]?_0x2c48aa[_0x4c0c('0x45')]:_0x10013f[_0x4c0c('0x41')];if(!_0x44eca2[_0x4c0c('0x42')][_0x4c0c('0x48')](_0x4c0c('0x64'))){_0x2c48aa['limit']=qs[_0x4c0c('0x2c')](_0x44eca2[_0x4c0c('0x42')]['limit']);_0x2c48aa[_0x4c0c('0x2a')]=qs[_0x4c0c('0x2a')](_0x44eca2[_0x4c0c('0x42')][_0x4c0c('0x2a')]);}_0x2c48aa[_0x4c0c('0x65')]=qs['sort'](_0x44eca2['query'][_0x4c0c('0x49')]);_0x2c48aa[_0x4c0c('0x4a')]=qs['filters'](_[_0x4c0c('0x66')](_0x44eca2[_0x4c0c('0x42')],_0x10013f['filters']));_0x2c48aa['where'][_0x4c0c('0x60')]=_0x9712a1['id'];if(_0x44eca2[_0x4c0c('0x42')]['filter']){_0x2c48aa[_0x4c0c('0x4a')]=_[_0x4c0c('0x4d')](_0x2c48aa['where'],{'$or':_[_0x4c0c('0x3c')](_0x2c48aa['attributes'],function(_0x565cd1){var _0x20bd93={};_0x20bd93[_0x565cd1]={'$like':'%'+_0x44eca2[_0x4c0c('0x42')][_0x4c0c('0x4c')]+'%'};return _0x20bd93;})});}_0x2c48aa=_[_0x4c0c('0x4d')]({},_0x2c48aa,_0x44eca2[_0x4c0c('0x67')]);return db['Disposition'][_0x4c0c('0x2d')]({'where':_0x2c48aa[_0x4c0c('0x4a')]})['then'](function(_0xbd7157){_0x70202f['count']=_0xbd7157;if(_0x44eca2[_0x4c0c('0x42')][_0x4c0c('0x4f')]){_0x2c48aa[_0x4c0c('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x4c0c('0x68')](_0x2c48aa);})['then'](function(_0x36b13f){_0x70202f['rows']=_0x36b13f;return _0x70202f;});}})[_0x4c0c('0x34')](respondWithFilteredResult(_0x5a7c26,_0x2c48aa))[_0x4c0c('0x25')](handleError(_0x5a7c26,null));};exports[_0x4c0c('0x69')]=function(_0x2187db,_0x55946c,_0x11b23d){return db[_0x4c0c('0x3d')][_0x4c0c('0x5b')]({'where':{'id':_0x2187db[_0x4c0c('0x52')]['id']}})[_0x4c0c('0x34')](handleEntityNotFound(_0x55946c,null))['then'](function(_0x195850){if(_0x195850){return _0x195850['removeDispositions'](_0x2187db[_0x4c0c('0x42')][_0x4c0c('0x6a')]);}})['then'](respondWithStatusCode(_0x55946c,null))[_0x4c0c('0x25')](handleError(_0x55946c,null));};exports['addAnswer']=function(_0x3f964f,_0x358c9e,_0x426b0a){if(_0x3f964f[_0x4c0c('0x56')]['id']){delete _0x3f964f['body']['id'];}return db[_0x4c0c('0x3d')]['find']({'where':{'id':_0x3f964f[_0x4c0c('0x52')]['id']}})[_0x4c0c('0x34')](handleEntityNotFound(_0x358c9e,null))[_0x4c0c('0x34')](function(_0x5de793){if(_0x5de793){_0x3f964f[_0x4c0c('0x56')]['SmsAccountId']=_0x5de793['id'];return db[_0x4c0c('0x6b')][_0x4c0c('0x55')](_0x3f964f[_0x4c0c('0x56')]);}})[_0x4c0c('0x34')](respondWithResult(_0x358c9e,null))[_0x4c0c('0x25')](handleError(_0x358c9e,null));};exports[_0x4c0c('0x6c')]=function(_0x3644c0,_0x4f63b8,_0x2572bb){var _0x302791={'raw':![],'where':{}};var _0x5d629e={};var _0x801d65={'count':0x0,'rows':[]};return db[_0x4c0c('0x3d')][_0x4c0c('0x62')]({'where':{'id':_0x3644c0[_0x4c0c('0x52')]['id']}})[_0x4c0c('0x34')](handleEntityNotFound(_0x4f63b8,null))[_0x4c0c('0x34')](function(_0x5461ee){if(_0x5461ee){_0x5d629e['model']=_['keys'](db['CannedAnswer'][_0x4c0c('0x3e')]);_0x5d629e[_0x4c0c('0x42')]=_['keys'](_0x3644c0[_0x4c0c('0x42')]);_0x5d629e[_0x4c0c('0x4b')]=_['intersection'](_0x5d629e[_0x4c0c('0x41')],_0x5d629e[_0x4c0c('0x42')]);_0x302791[_0x4c0c('0x45')]=_[_0x4c0c('0x44')](_0x5d629e[_0x4c0c('0x41')],qs['fields'](_0x3644c0['query'][_0x4c0c('0x46')]));_0x302791[_0x4c0c('0x45')]=_0x302791['attributes'][_0x4c0c('0x47')]?_0x302791[_0x4c0c('0x45')]:_0x5d629e[_0x4c0c('0x41')];if(!_0x3644c0[_0x4c0c('0x42')][_0x4c0c('0x48')](_0x4c0c('0x64'))){_0x302791['limit']=qs['limit'](_0x3644c0['query'][_0x4c0c('0x2c')]);_0x302791[_0x4c0c('0x2a')]=qs['offset'](_0x3644c0['query'][_0x4c0c('0x2a')]);}_0x302791[_0x4c0c('0x65')]=qs[_0x4c0c('0x49')](_0x3644c0[_0x4c0c('0x42')][_0x4c0c('0x49')]);_0x302791[_0x4c0c('0x4a')]=qs[_0x4c0c('0x4b')](_[_0x4c0c('0x66')](_0x3644c0['query'],_0x5d629e['filters']));_0x302791[_0x4c0c('0x4a')][_0x4c0c('0x60')]=_0x5461ee['id'];if(_0x3644c0['query'][_0x4c0c('0x4c')]){_0x302791[_0x4c0c('0x4a')]=_['merge'](_0x302791[_0x4c0c('0x4a')],{'$or':_['map'](_0x302791[_0x4c0c('0x45')],function(_0x46eb50){var _0xa33ec6={};_0xa33ec6[_0x46eb50]={'$like':'%'+_0x3644c0[_0x4c0c('0x42')][_0x4c0c('0x4c')]+'%'};return _0xa33ec6;})});}_0x302791=_[_0x4c0c('0x4d')]({},_0x302791,_0x3644c0[_0x4c0c('0x67')]);return db[_0x4c0c('0x6b')][_0x4c0c('0x2d')]({'where':_0x302791[_0x4c0c('0x4a')]})[_0x4c0c('0x34')](function(_0x151306){_0x801d65[_0x4c0c('0x2d')]=_0x151306;if(_0x3644c0[_0x4c0c('0x42')]['includeAll']){_0x302791[_0x4c0c('0x54')]=[{'all':!![]}];}return db[_0x4c0c('0x6b')]['findAll'](_0x302791);})[_0x4c0c('0x34')](function(_0x1e664d){_0x801d65[_0x4c0c('0x50')]=_0x1e664d;return _0x801d65;});}})[_0x4c0c('0x34')](respondWithFilteredResult(_0x4f63b8,_0x302791))[_0x4c0c('0x25')](handleError(_0x4f63b8,null));};exports[_0x4c0c('0x6d')]=function(_0x56f4eb,_0xcada81,_0x2fd1b7){return db[_0x4c0c('0x3d')][_0x4c0c('0x5b')]({'where':{'id':_0x56f4eb['params']['id']}})[_0x4c0c('0x34')](handleEntityNotFound(_0xcada81,null))['then'](function(_0x2d5ef1){if(_0x2d5ef1){return _0x2d5ef1[_0x4c0c('0x6d')](_0x56f4eb[_0x4c0c('0x42')][_0x4c0c('0x6a')]);}})['then'](respondWithStatusCode(_0xcada81,null))[_0x4c0c('0x25')](handleError(_0xcada81,null));};exports[_0x4c0c('0x6e')]=function(_0x4821f7,_0x41fc4a,_0x468547){var _0x56d2f0={'channel':'sms'};var _0x47f2c8=[];var _0x5c721e=[];var _0x447088={};return db[_0x4c0c('0x3d')]['find']({'where':{'id':_0x4821f7['params']['id']},'include':[{'model':db[_0x4c0c('0x6f')],'as':'Applications'}]})[_0x4c0c('0x34')](handleEntityNotFound(_0x41fc4a,null))['then'](function(_0x391760){_0x56d2f0[_0x4c0c('0x70')]=_0x391760;_0x56d2f0[_0x4c0c('0x71')]=_['orderBy'](_0x391760[_0x4c0c('0x72')],[_0x4c0c('0x73')],[_0x4c0c('0x74')]);if(_0x56d2f0[_0x4c0c('0x70')]['Applications']){delete _0x56d2f0[_0x4c0c('0x70')][_0x4c0c('0x72')];}return db['CmContact'][_0x4c0c('0x5f')]();})[_0x4c0c('0x34')](function(_0x3769f1){if(!_0x3769f1){throw new db[(_0x4c0c('0x75'))][(_0x4c0c('0x76'))](_0x4c0c('0x77'));}_0x47f2c8=_[_0x4c0c('0x78')](_['keys'](_0x3769f1),[_0x4c0c('0x79'),_0x4c0c('0x7a')]);_0x5c721e=_[_0x4c0c('0x78')](_[_0x4c0c('0x43')](_0x3769f1),[_0x4c0c('0x79'),_0x4c0c('0x7a'),_0x4c0c('0x7b'),_0x4c0c('0x7c')]);_0x56d2f0['body']={'mapKey':_0x4c0c('0x7d')};if(_0x56d2f0[_0x4c0c('0x70')][_0x4c0c('0x40')]){switch(_0x56d2f0['account'][_0x4c0c('0x40')]){case _0x4c0c('0x7e'):_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x7f')]=_0x4821f7['body']['From'];_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x56')]=_0x4821f7[_0x4c0c('0x56')]['Body'];_0x56d2f0['body'][_0x4c0c('0x80')]=_0x4821f7['body'][_0x4c0c('0x81')];break;case _0x4c0c('0x82'):_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x7f')]='+'+_0x4821f7['body'][_0x4c0c('0x83')];_0x56d2f0[_0x4c0c('0x56')]['body']=_0x4821f7[_0x4c0c('0x56')][_0x4c0c('0x84')];break;case _0x4c0c('0x85'):_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x7f')]=_0x4821f7[_0x4c0c('0x56')][_0x4c0c('0x7f')];_0x56d2f0[_0x4c0c('0x56')]['body']=_0x4821f7[_0x4c0c('0x56')][_0x4c0c('0x24')];break;case _0x4c0c('0x86'):_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x7f')]=_0x4821f7[_0x4c0c('0x56')][_0x4c0c('0x7f')];_0x56d2f0[_0x4c0c('0x56')]['body']=_0x4821f7['body']['body'];_0x56d2f0['body'][_0x4c0c('0x80')]=_0x4821f7[_0x4c0c('0x56')][_0x4c0c('0x87')];break;case _0x4c0c('0x88'):_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x7f')]=_0x4821f7[_0x4c0c('0x56')]['From'];_0x56d2f0['body'][_0x4c0c('0x56')]=_0x4821f7['body']['Text'];_0x56d2f0['body']['messageId']=_0x4821f7[_0x4c0c('0x56')][_0x4c0c('0x89')];break;case _0x4c0c('0x8a'):_0x56d2f0['body'][_0x4c0c('0x7f')]='+'+_0x4821f7[_0x4c0c('0x56')][_0x4c0c('0x8b')][0x0]['from'];_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x56')]=_0x4821f7[_0x4c0c('0x56')]['results'][0x0][_0x4c0c('0x84')];_0x56d2f0[_0x4c0c('0x56')]['messageId']=_0x4821f7['body'][_0x4c0c('0x8b')][0x0]['messageId'];break;case'csc':_0x56d2f0[_0x4c0c('0x56')]['from']=_0x4821f7[_0x4c0c('0x56')][_0x4c0c('0x8c')];_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x56')]=_0x4821f7[_0x4c0c('0x56')][_0x4c0c('0x8d')][_0x4c0c('0x24')];break;case _0x4c0c('0x8e'):_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x7f')]=_0x4821f7[_0x4c0c('0x56')][_0x4c0c('0x8f')];_0x56d2f0[_0x4c0c('0x56')]['body']=_0x4821f7['body'][_0x4c0c('0x84')];_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x80')]=_0x4821f7['body'][_0x4c0c('0x90')];break;case _0x4c0c('0x91'):_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x80')]=_0x4821f7[_0x4c0c('0x56')][0x0][_0x4c0c('0x24')]['id'];_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x7f')]=_0x4821f7['body'][0x0][_0x4c0c('0x24')][_0x4c0c('0x7f')];_0x56d2f0[_0x4c0c('0x56')]['body']=_0x4821f7[_0x4c0c('0x56')][0x0]['message'][_0x4c0c('0x84')];break;case'intelepeer':_0x56d2f0[_0x4c0c('0x56')]['from']=_0x4821f7[_0x4c0c('0x56')][_0x4c0c('0x7f')];_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x56')]=_0x4821f7[_0x4c0c('0x56')][_0x4c0c('0x24')];_0x56d2f0[_0x4c0c('0x56')]['messageId']=_0x4821f7['body'][_0x4c0c('0x92')];break;}}if(_0x56d2f0[_0x4c0c('0x56')]['id']){delete _0x56d2f0[_0x4c0c('0x56')]['id'];}if(_[_0x4c0c('0x93')](_0x56d2f0[_0x4c0c('0x56')]['from'])){throw new db[(_0x4c0c('0x75'))]['ValidationError'](_0x4c0c('0x94'));}if(_[_0x4c0c('0x93')](_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x56')])||_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x56')]===''){throw new db['Sequelize'][(_0x4c0c('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4c0c('0x93')](_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x95')])){throw new db[(_0x4c0c('0x75'))][(_0x4c0c('0x76'))](_0x4c0c('0x96')+_0x5c721e);}if(!_[_0x4c0c('0x97')](_0x5c721e,_0x56d2f0['body'][_0x4c0c('0x95')])){throw new db[(_0x4c0c('0x75'))][(_0x4c0c('0x76'))](_0x4c0c('0x98')+_0x5c721e);}_0x447088[_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x95')]]=_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x7f')];return db[_0x4c0c('0x99')][_0x4c0c('0x5b')]({'where':{'id':_0x56d2f0[_0x4c0c('0x70')][_0x4c0c('0x7c')]},'include':[{'model':db[_0x4c0c('0x9a')],'as':'Contacts','where':_0x447088,'limit':0x1,'order':[['updatedAt',_0x4c0c('0x9b')]]}]});})[_0x4c0c('0x34')](handleEntityNotFound(_0x41fc4a,null))[_0x4c0c('0x34')](function(_0x5937ec){if(_0x5937ec){_0x56d2f0[_0x4c0c('0x9c')]=_['omit'](_0x5937ec,[_0x4c0c('0x9d')]);if(_0x5937ec[_0x4c0c('0x9d')]['length']){return _0x5937ec[_0x4c0c('0x9d')][0x0];}var _0x43d067=_[_0x4c0c('0x9e')](_0x56d2f0[_0x4c0c('0x56')],{'firstName':_0x56d2f0[_0x4c0c('0x56')]['from'],'ListId':_0x5937ec['id']});_0x43d067[_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x95')]]=_0x56d2f0[_0x4c0c('0x56')]['from'];return db['CmContact'][_0x4c0c('0x55')](_0x43d067,{'fields':_0x47f2c8,'raw':!![]});}})[_0x4c0c('0x34')](handleEntityNotFound(_0x41fc4a,null))[_0x4c0c('0x34')](function(_0x540f9e){if(_0x540f9e){_0x56d2f0[_0x4c0c('0x9f')]=_0x540f9e;var _0x269ee2={'ContactId':_0x540f9e['id'],'phone':_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x7f')],'SmsAccountId':_0x4821f7[_0x4c0c('0x52')]['id']};var _0x2a3d6e={'ContactId':_0x540f9e['id'],'SmsAccountId':_0x4821f7[_0x4c0c('0x52')]['id'],'closed':![]};return db[_0x4c0c('0xa0')][_0x4c0c('0x5b')]({'where':_0x2a3d6e})['then'](function(_0xb8be8){if(_0xb8be8){return[_0xb8be8,![]];}return db[_0x4c0c('0xa0')][_0x4c0c('0x55')](_0x269ee2)[_0x4c0c('0x34')](function(_0x11727d){return[_0x11727d,!![]];});});}})['spread'](function(_0x1ac152,_0x36fb04){_0x56d2f0[_0x4c0c('0xa1')]=_0x1ac152[_0x4c0c('0x36')]({'plain':!![]});_0x56d2f0['interaction'][_0x4c0c('0xa2')]=![];if(_0x36fb04){if(_0x56d2f0[_0x4c0c('0x70')][_0x4c0c('0xa3')]){_0x56d2f0[_0x4c0c('0x71')][_0x4c0c('0xa4')]({'id':0x0,'priority':_0x56d2f0[_0x4c0c('0x71')][_0x4c0c('0x47')]+0x1,'app':_0x4c0c('0xa5'),'appdata':_0x4c0c('0xa6'),'interval':_0x4c0c('0xa7')});}_0x56d2f0[_0x4c0c('0xa1')][_0x4c0c('0xa2')]=!![];}return db['SmsMessage'][_0x4c0c('0x55')]({'phone':_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x7f')],'messageId':_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x80')],'body':_0x56d2f0[_0x4c0c('0x56')][_0x4c0c('0x56')],'SmsAccountId':_0x4821f7['params']['id'],'SmsInteractionId':_0x1ac152['id'],'direction':'in','ContactId':_0x1ac152[_0x4c0c('0xa8')],'AttachmentId':_0x56d2f0[_0x4c0c('0x56')]['AttachmentId']});})['then'](function(_0x8e27e5){_0x56d2f0[_0x4c0c('0x24')]=_0x8e27e5;if(_0x56d2f0[_0x4c0c('0xa1')]['UserId']){return db[_0x4c0c('0xa9')][_0x4c0c('0x5b')]({'attributes':['id',_0x4c0c('0x38')],'where':{'id':_0x56d2f0[_0x4c0c('0xa1')][_0x4c0c('0xaa')]}})['then'](function(_0x1d530f){if(_0x1d530f){_0x56d2f0[_0x4c0c('0x71')][_0x4c0c('0xab')]({'id':0x0,'priority':0x0,'app':_0x4c0c('0xac'),'appdata':_0x1d530f[_0x4c0c('0x38')]+','+(_0x56d2f0[_0x4c0c('0x70')][_0x4c0c('0xad')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x4c0c('0xae'),_0x56d2f0);});}return respondWithRpcPromise(_0x4c0c('0xaf'),_0x4c0c('0xae'),_0x56d2f0);})['then'](function(_0x32f535){if(_0x32f535){var _0x232502=0xc8;var _0x5e469e=_0x4c0c('0xb0');logger[_0x4c0c('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5e469e,_0x232502,_0x4c0c('0xb1'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5e469e,_0x232502,_0x4c0c('0xb1'),JSON['stringify'](_0x32f535));if(_0x56d2f0[_0x4c0c('0x70')][_0x4c0c('0x40')]==='twilio'){return _0x41fc4a[_0x4c0c('0x27')](_0x232502)['set']('Content-Type',_0x4c0c('0xb2'))['send'](_0x4c0c('0xb3'));}else{return _0x41fc4a['status'](_0x232502)[_0x4c0c('0x29')](_0x32f535);}}})['catch'](handleError(_0x41fc4a,null));};exports[_0x4c0c('0xb4')]=function(_0x5638fd,_0x4f1a45,_0x166610){return db['SmsAccount'][_0x4c0c('0x62')]({'where':{'id':_0x5638fd[_0x4c0c('0x52')]['id']}})[_0x4c0c('0x34')](handleEntityNotFound(_0x4f1a45,null))[_0x4c0c('0x34')](function(_0x52203a){if(_0x52203a){return db[_0x4c0c('0xb5')][_0x4c0c('0xb6')](function(_0x5d19ac){return db[_0x4c0c('0x6f')][_0x4c0c('0x35')]({'where':{'SmsAccountId':_0x5638fd[_0x4c0c('0x52')]['id']},'transaction':_0x5d19ac})['then'](function(_0x5b97cd){var _0x3af62b=_[_0x4c0c('0x3c')](_0x5638fd[_0x4c0c('0x56')],function(_0x473586){_0x473586[_0x4c0c('0x60')]=_0x5638fd[_0x4c0c('0x52')]['id'];return _0x473586;});return db[_0x4c0c('0x6f')][_0x4c0c('0xb7')](_0x3af62b,{'transaction':_0x5d19ac});});})[_0x4c0c('0x34')](function(){return db[_0x4c0c('0x6f')][_0x4c0c('0xb8')]({'where':{'SmsAccountId':_0x5638fd[_0x4c0c('0x52')]['id']},'order':_0x4c0c('0x73')});});}})[_0x4c0c('0x34')](respondWithResult(_0x4f1a45,null))['catch'](handleError(_0x4f1a45,null));};exports[_0x4c0c('0xb9')]=function(_0x3ec9b2,_0x1fa25f,_0x1648c4){var _0x491744={};var _0x5abb43={};var _0x2e2a79;var _0x5d8f79;return db[_0x4c0c('0x3d')]['findOne']({'where':{'id':_0x3ec9b2[_0x4c0c('0x52')]['id']}})[_0x4c0c('0x34')](handleEntityNotFound(_0x1fa25f,null))[_0x4c0c('0x34')](function(_0x216e97){if(_0x216e97){_0x2e2a79=_0x216e97;_0x5abb43[_0x4c0c('0x41')]=_['keys'](db['SmsApplication'][_0x4c0c('0x3e')]);_0x5abb43['query']=_['keys'](_0x3ec9b2['query']);_0x5abb43[_0x4c0c('0x4b')]=_[_0x4c0c('0x44')](_0x5abb43['model'],_0x5abb43['query']);_0x491744[_0x4c0c('0x45')]=_[_0x4c0c('0x44')](_0x5abb43[_0x4c0c('0x41')],qs[_0x4c0c('0x46')](_0x3ec9b2[_0x4c0c('0x42')][_0x4c0c('0x46')]));_0x491744[_0x4c0c('0x45')]=_0x491744[_0x4c0c('0x45')][_0x4c0c('0x47')]?_0x491744[_0x4c0c('0x45')]:_0x5abb43[_0x4c0c('0x41')];_0x491744['order']=qs[_0x4c0c('0x49')](_0x3ec9b2[_0x4c0c('0x42')]['sort']);_0x491744[_0x4c0c('0x4a')]=qs[_0x4c0c('0x4b')](_[_0x4c0c('0x66')](_0x3ec9b2[_0x4c0c('0x42')],_0x5abb43['filters']));if(_0x3ec9b2[_0x4c0c('0x42')]['filter']){_0x491744[_0x4c0c('0x4a')]=_[_0x4c0c('0x4d')](_0x491744[_0x4c0c('0x4a')],{'$or':_[_0x4c0c('0x3c')](_0x491744[_0x4c0c('0x45')],function(_0x165825){var _0x3516b9={};_0x3516b9[_0x165825]={'$like':'%'+_0x3ec9b2[_0x4c0c('0x42')][_0x4c0c('0x4c')]+'%'};return _0x3516b9;})});}_0x491744=_[_0x4c0c('0x4d')]({},_0x491744,_0x3ec9b2[_0x4c0c('0x67')]);return _0x2e2a79[_0x4c0c('0xb9')](_0x491744);}})[_0x4c0c('0x34')](function(_0x2de4e5){if(_0x2de4e5){_0x5d8f79=_0x2de4e5[_0x4c0c('0x47')];if(!_0x3ec9b2['query']['hasOwnProperty']('nolimit')){_0x491744[_0x4c0c('0x2c')]=qs['limit'](_0x3ec9b2[_0x4c0c('0x42')][_0x4c0c('0x2c')]);_0x491744[_0x4c0c('0x2a')]=qs['offset'](_0x3ec9b2[_0x4c0c('0x42')][_0x4c0c('0x2a')]);}return _0x2e2a79[_0x4c0c('0xb9')](_0x491744);}})['then'](function(_0x5d1191){if(_0x5d1191){return _0x5d1191?{'count':_0x5d8f79,'rows':_0x5d1191}:null;}})['then'](respondWithResult(_0x1fa25f,null))[_0x4c0c('0x25')](handleError(_0x1fa25f,null));};exports[_0x4c0c('0xba')]=function(_0x3a715b,_0x5ab66d,_0x130981){var _0x686706={'raw':![],'where':{}};var _0x239f3d={};var _0x3fb323={'count':0x0,'rows':[]};return db[_0x4c0c('0x3d')][_0x4c0c('0x62')]({'where':{'id':_0x3a715b[_0x4c0c('0x52')]['id']}})[_0x4c0c('0x34')](handleEntityNotFound(_0x5ab66d,null))['then'](function(_0x318762){if(_0x318762){_0x239f3d['model']=_[_0x4c0c('0x43')](db[_0x4c0c('0xa0')][_0x4c0c('0x3e')]);_0x239f3d['query']=_['keys'](_0x3a715b['query']);_0x239f3d[_0x4c0c('0x4b')]=_[_0x4c0c('0x44')](_0x239f3d[_0x4c0c('0x41')],_0x239f3d[_0x4c0c('0x42')]);_0x686706[_0x4c0c('0x45')]=_[_0x4c0c('0x44')](_0x239f3d[_0x4c0c('0x41')],qs[_0x4c0c('0x46')](_0x3a715b[_0x4c0c('0x42')][_0x4c0c('0x46')]));_0x686706[_0x4c0c('0x45')]=_0x686706[_0x4c0c('0x45')][_0x4c0c('0x47')]?_0x686706[_0x4c0c('0x45')]:_0x239f3d[_0x4c0c('0x41')];if(!_0x3a715b[_0x4c0c('0x42')][_0x4c0c('0x48')](_0x4c0c('0x64'))){_0x686706[_0x4c0c('0x2c')]=qs[_0x4c0c('0x2c')](_0x3a715b[_0x4c0c('0x42')][_0x4c0c('0x2c')]);_0x686706[_0x4c0c('0x2a')]=qs[_0x4c0c('0x2a')](_0x3a715b[_0x4c0c('0x42')][_0x4c0c('0x2a')]);}_0x686706[_0x4c0c('0x65')]=qs['sort'](_0x3a715b[_0x4c0c('0x42')][_0x4c0c('0x49')]);_0x686706['where']=qs['filters'](_['pick'](_0x3a715b[_0x4c0c('0x42')],_0x239f3d[_0x4c0c('0x4b')]));_0x686706[_0x4c0c('0x4a')][_0x4c0c('0x60')]=_0x318762['id'];if(_0x3a715b[_0x4c0c('0x42')][_0x4c0c('0x4c')]){_0x686706['where']=_[_0x4c0c('0x4d')](_0x686706[_0x4c0c('0x4a')],{'$or':_['map'](_0x686706['attributes'],function(_0x49a78c){var _0x23591f={};_0x23591f[_0x49a78c]={'$like':'%'+_0x3a715b[_0x4c0c('0x42')][_0x4c0c('0x4c')]+'%'};return _0x23591f;})});}_0x686706=_[_0x4c0c('0x4d')]({},_0x686706,_0x3a715b[_0x4c0c('0x67')]);return db[_0x4c0c('0xa0')][_0x4c0c('0x2d')]({'where':_0x686706['where']})[_0x4c0c('0x34')](function(_0x4e01fe){_0x3fb323['count']=_0x4e01fe;if(_0x3a715b[_0x4c0c('0x42')]['includeAll']){_0x686706[_0x4c0c('0x54')]=[{'model':db[_0x4c0c('0x9a')],'as':_0x4c0c('0xbb'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name','fullname',_0x4c0c('0xbc')],'required':![]},{'model':db[_0x4c0c('0xbd')],'as':'Tags','attributes':['id',_0x4c0c('0x38'),_0x4c0c('0xbe')],'where':_0x3a715b[_0x4c0c('0x42')][_0x4c0c('0xbf')]?{'id':_0x3a715b[_0x4c0c('0x42')][_0x4c0c('0xbf')]}:undefined,'required':_0x3a715b[_0x4c0c('0x42')]['tag']?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x686706);})[_0x4c0c('0x34')](function(_0x35b808){_0x3fb323['rows']=_0x35b808;return _0x3fb323;});}})['then'](respondWithFilteredResult(_0x5ab66d,_0x686706))[_0x4c0c('0x25')](handleError(_0x5ab66d,null));};exports[_0x4c0c('0x39')]=function(_0xef73e2,_0x1d01a0,_0x45b655){var _0x16de27,_0x2bff38,_0x1b4410;if(_[_0x4c0c('0x93')](_0xef73e2[_0x4c0c('0x56')][_0x4c0c('0x56')])||_0xef73e2['body'][_0x4c0c('0x56')]===''){throw new db[(_0x4c0c('0x75'))][(_0x4c0c('0x76'))](_0x4c0c('0xc0'));}if(_[_0x4c0c('0x93')](_0xef73e2['body']['to'])){throw new db[(_0x4c0c('0x75'))]['ValidationError'](_0x4c0c('0xc1'));}_0x16de27=_0xef73e2[_0x4c0c('0x56')]['to'];return db['SmsAccount']['find']({'where':{'id':_0xef73e2[_0x4c0c('0x52')]['id']},'include':[{'model':db[_0x4c0c('0x99')],'as':'List','include':[{'model':db[_0x4c0c('0x9a')],'as':_0x4c0c('0x9d'),'where':{'mobile':_0x16de27},'limit':0x1,'order':[[_0x4c0c('0x7a'),_0x4c0c('0x9b')]]}]}]})[_0x4c0c('0x34')](handleEntityNotFound(_0x1d01a0,null))[_0x4c0c('0x34')](function(_0x22398a){if(_0x22398a&&_0x22398a[_0x4c0c('0xc2')]){_0x2bff38=_0x22398a[_0x4c0c('0x36')]({'plain':!![]});if(_0x2bff38['List']&&_0x2bff38[_0x4c0c('0xc2')][_0x4c0c('0x9d')][_0x4c0c('0x47')]){return _0x2bff38[_0x4c0c('0xc2')]['Contacts'][0x0];}return db[_0x4c0c('0x9a')]['create'](_['defaults'](_0xef73e2['body'],{'firstName':_0x16de27,'mobile':_0x16de27,'phone':_0x16de27,'ListId':_0x2bff38[_0x4c0c('0x7c')]}));}})[_0x4c0c('0x34')](handleEntityNotFound(_0x1d01a0,null))[_0x4c0c('0x34')](function(_0x3205d7){if(_0x3205d7){_0x1b4410=_0x3205d7;return db['SmsInteraction'][_0x4c0c('0x5b')]({'where':{'ContactId':_0x1b4410['id'],'closed':![],'SmsAccountId':_0x2bff38['id']}})['then'](function(_0x1cc44a){if(_0x1cc44a){return[_0x1cc44a,![]];}return db['SmsInteraction'][_0x4c0c('0x55')]({'UserId':_0xef73e2['user']['id'],'ContactId':_0x1b4410['id'],'SmsAccountId':_0x2bff38['id'],'phone':_0x16de27,'firstMsgDirection':_0x4c0c('0xc3'),'Messages':[_['merge'](_0xef73e2[_0x4c0c('0x56')],{'read':![],'body':_0xef73e2[_0x4c0c('0x56')][_0x4c0c('0x56')],'phone':_0x16de27,'SmsAccountId':_0x2bff38['id'],'UserId':_0xef73e2['user']['id'],'ContactId':_0x1b4410['id']})]},{'include':[{'model':db[_0x4c0c('0xc4')],'as':_0x4c0c('0xc5')}]})[_0x4c0c('0x34')](function(_0x4b704f){return[_0x4b704f,!![]];});});}})[_0x4c0c('0xc6')](function(_0x2de3ae,_0x41cf4b){if(_0x41cf4b){return _0x2de3ae;}return db[_0x4c0c('0xc4')][_0x4c0c('0x55')](_[_0x4c0c('0x4d')](_0xef73e2[_0x4c0c('0x56')],{'read':![],'body':_0xef73e2[_0x4c0c('0x56')][_0x4c0c('0x56')],'phone':_0x16de27,'SmsAccountId':_0x2bff38['id'],'SmsInteractionId':_0x2de3ae['id'],'UserId':_0xef73e2[_0x4c0c('0x57')]['id'],'ContactId':_0x1b4410['id']}))[_0x4c0c('0x34')](function(_0x5ed8f6){_0x2de3ae[_0x4c0c('0xc7')][_0x4c0c('0xc5')]=[];_0x2de3ae[_0x4c0c('0xc7')][_0x4c0c('0xc5')][_0x4c0c('0xa4')](_0x5ed8f6[_0x4c0c('0xc7')]);return _0x2de3ae;});})[_0x4c0c('0x34')](respondWithResult(_0x1d01a0,null))[_0x4c0c('0x25')](handleError(_0x1d01a0,null));};exports['status']=function(_0x589844,_0x4b11b6,_0x1b349b){if(_0x589844[_0x4c0c('0x56')]['id']){delete _0x589844[_0x4c0c('0x56')]['id'];}var _0x2ccb84,_0x5abfdc,_0x443e17;return db[_0x4c0c('0x3d')]['find']({'where':{'id':_0x589844[_0x4c0c('0x52')]['id']}})[_0x4c0c('0x34')](handleEntityNotFound(_0x4b11b6,null))[_0x4c0c('0x34')](function(_0x177df3){if(_0x177df3){_0x443e17=_0x177df3;logger['debug'](_0x4c0c('0xc8'),_0x4c0c('0x27'),_0x4c0c('0xc9'),_0x177df3['type'],util[_0x4c0c('0xca')](_0x589844[_0x4c0c('0x56')],{'showHidden':![],'depth':null}));switch(_0x177df3['type']){case _0x4c0c('0x82'):if(_0x589844[_0x4c0c('0x56')]['skebby_dispatch_id']&&_0x589844['body']['status']){_0x5abfdc=_0x589844['body'][_0x4c0c('0x27')];return db[_0x4c0c('0xc4')]['find']({'where':{'messageId':_0x589844['body'][_0x4c0c('0xcb')]}});}break;case _0x4c0c('0x85'):if(_0x589844[_0x4c0c('0x56')][_0x4c0c('0xcc')]&&_0x589844[_0x4c0c('0x56')]['statusInt']){_0x5abfdc=_0x589844[_0x4c0c('0x56')][_0x4c0c('0xcd')];return db[_0x4c0c('0xc4')][_0x4c0c('0x5b')]({'where':{'messageId':_0x589844['body'][_0x4c0c('0xcc')]}});}break;case'clicksend':if(_0x589844[_0x4c0c('0x56')][_0x4c0c('0x87')]&&_0x589844['body'][_0x4c0c('0xce')]){_0x5abfdc=_0x589844['body'][_0x4c0c('0xce')];return db[_0x4c0c('0xc4')][_0x4c0c('0x5b')]({'where':{'messageId':_0x589844['body']['message_id']}});}break;case _0x4c0c('0x8a'):var _0xb9fa07=_0x589844[_0x4c0c('0x56')][_0x4c0c('0x8b')][0x0];if(_0xb9fa07[_0x4c0c('0x80')]&&_0xb9fa07[_0x4c0c('0x27')]['groupName']===_0x4c0c('0xcf')){_0x5abfdc=_0xb9fa07[_0x4c0c('0x27')][_0x4c0c('0xd0')];return db[_0x4c0c('0xc4')][_0x4c0c('0x5b')]({'where':{'messageId':_0xb9fa07['messageId']}});}break;case _0x4c0c('0x8e'):if(_0x589844[_0x4c0c('0x56')][_0x4c0c('0x80')]&&_0x589844[_0x4c0c('0x56')][_0x4c0c('0x27')]){_0x5abfdc=_0x589844['body']['status'];return db[_0x4c0c('0xc4')][_0x4c0c('0x5b')]({'where':{'messageId':_0x589844[_0x4c0c('0x56')][_0x4c0c('0x80')]}});}break;case _0x4c0c('0x91'):if(_0x589844['body'][0x0]['message']['id']){_0x5abfdc=_0x589844[_0x4c0c('0x56')][0x0][_0x4c0c('0x40')];return db['SmsMessage'][_0x4c0c('0x5b')]({'where':{'messageId':_0x589844[_0x4c0c('0x56')][0x0][_0x4c0c('0x24')]['id']}});}break;case _0x4c0c('0xd1'):if(_0x589844['body'][_0x4c0c('0xd2')]&&_0x589844['body']['status']){_0x5abfdc=_0x589844[_0x4c0c('0x56')][_0x4c0c('0x27')];return db[_0x4c0c('0xc4')][_0x4c0c('0x5b')]({'where':{'messageId':_0x589844[_0x4c0c('0x56')]['redif']}});}break;}}})[_0x4c0c('0x34')](handleEntityNotFound(_0x4b11b6,null))['then'](function(_0x1c9c75){if(_0x1c9c75){_0x2ccb84=_0x1c9c75;switch(_0x443e17['type']){case _0x4c0c('0x82'):if(_0x5abfdc===_0x4c0c('0xcf')){return _0x2ccb84[_0x4c0c('0x33')]({'read':!![]});}else{logger[_0x4c0c('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4c0c('0x27'),_0x4c0c('0x82'),util[_0x4c0c('0xca')](_0x589844['body'],{'showHidden':![],'depth':null}));}break;case _0x4c0c('0x85'):if(_0x5abfdc==='1'){return _0x2ccb84['update']({'read':!![]});}else{logger[_0x4c0c('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4c0c('0x27'),_0x4c0c('0x82'),util[_0x4c0c('0xca')](_0x589844['body'],{'showHidden':![],'depth':null}));}break;case _0x4c0c('0x86'):if(!_0x589844[_0x4c0c('0x56')][_0x4c0c('0xd3')]&&_0x5abfdc>=0xc8&&_0x5abfdc<=0xce){return _0x2ccb84[_0x4c0c('0x33')]({'read':!![]});}else{logger[_0x4c0c('0x21')](_0x4c0c('0xc8'),_0x4c0c('0x27'),_0x4c0c('0x86'),util[_0x4c0c('0xca')](_0x589844['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x2751c4=_0x589844[_0x4c0c('0x56')][_0x4c0c('0x8b')][0x0];if(_0x2751c4[_0x4c0c('0x27')][_0x4c0c('0xd0')]===_0x4c0c('0xcf')){return _0x2ccb84['update']({'read':!![]});}else{logger[_0x4c0c('0x21')](_0x4c0c('0xc8'),_0x4c0c('0x27'),_0x4c0c('0x8a'),util[_0x4c0c('0xca')](_0x589844['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x5abfdc==_0x4c0c('0xd4')||_0x5abfdc=='RECEIVED_BY_RECIPIENT'){return _0x2ccb84[_0x4c0c('0x33')]({'read':!![]});}else{logger[_0x4c0c('0x21')](_0x4c0c('0xc8'),_0x4c0c('0x27'),_0x4c0c('0x8e'),util[_0x4c0c('0xca')](_0x589844[_0x4c0c('0x56')],{'showHidden':![],'depth':null}));}break;case _0x4c0c('0x91'):if(_0x5abfdc==_0x4c0c('0xd5')){return _0x2ccb84['update']({'read':!![]});}else{logger[_0x4c0c('0x21')](_0x4c0c('0xc8'),'status','bandwidth',util[_0x4c0c('0xca')](_0x589844[_0x4c0c('0x56')],{'showHidden':![],'depth':null}));}break;case _0x4c0c('0xd1'):if(_0x5abfdc==='DELIVRD'||_0x5abfdc===_0x4c0c('0xd6')){return _0x2ccb84[_0x4c0c('0x33')]({'read':!![]});}else{logger['error'](_0x4c0c('0xc8'),_0x4c0c('0x27'),_0x4c0c('0xd1'),util[_0x4c0c('0xca')](_0x589844[_0x4c0c('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x2ccb84;}})[_0x4c0c('0x34')](respondWithResult(_0x4b11b6,null))[_0x4c0c('0x25')](handleError(_0x4b11b6,null));};exports[_0x4c0c('0xd7')]=function(_0x498039,_0x339bdb,_0x389919){var _0x3c2297,_0x404280,_0x546f97;return db[_0x4c0c('0x3d')][_0x4c0c('0x5b')]({'where':{'id':_0x498039[_0x4c0c('0x52')]['id']}})[_0x4c0c('0x34')](handleEntityNotFound(_0x339bdb,null))[_0x4c0c('0x34')](function(_0x4286d7){if(_0x4286d7){_0x546f97=_0x4286d7;logger['debug'](_0x4c0c('0xc8'),'status',_0x4c0c('0xc9'),_0x4286d7[_0x4c0c('0x40')],util[_0x4c0c('0xca')](_0x498039['query'],{'showHidden':![],'depth':null}));switch(_0x4286d7[_0x4c0c('0x40')]){case _0x4c0c('0xd8'):if(_0x498039[_0x4c0c('0x42')][_0x4c0c('0xd9')]&&_0x498039[_0x4c0c('0x42')][_0x4c0c('0xda')]){_0x404280=_0x498039[_0x4c0c('0x42')][_0x4c0c('0xda')];return db['SmsMessage'][_0x4c0c('0x5b')]({'where':{'messageId':_0x498039[_0x4c0c('0x42')][_0x4c0c('0xd9')]}});}break;}}})[_0x4c0c('0x34')](handleEntityNotFound(_0x339bdb,null))['then'](function(_0x1b70b2){if(_0x1b70b2){_0x3c2297=_0x1b70b2;switch(_0x546f97['type']){case _0x4c0c('0xd8'):if(_0x404280==='2'||_0x404280==='6'){return _0x3c2297[_0x4c0c('0x33')]({'read':!![]});}else{logger['error'](_0x4c0c('0xc8'),_0x4c0c('0x27'),_0x4c0c('0xd8'),util[_0x4c0c('0xca')](_0x498039[_0x4c0c('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x3c2297;}})[_0x4c0c('0x34')](respondWithResult(_0x339bdb,null))['catch'](handleError(_0x339bdb,null));};exports[_0x4c0c('0xdb')]=function(_0x12773a,_0x5f64c8,_0x3c71f4){return db[_0x4c0c('0x3d')][_0x4c0c('0x5b')]({'where':{'id':_0x12773a['params']['id']}})['then'](handleEntityNotFound(_0x5f64c8,null))['then'](function(_0x46db7a){if(_0x46db7a){return _0x46db7a[_0x4c0c('0xdb')](_0x12773a[_0x4c0c('0x56')][_0x4c0c('0x6a')],_['omit'](_0x12773a[_0x4c0c('0x56')],[_0x4c0c('0x6a'),'id'])||{})[_0x4c0c('0xc6')](function(_0x117b6c){for(var _0x3a163d=0x0;_0x3a163d<_0x12773a[_0x4c0c('0x56')][_0x4c0c('0x6a')][_0x4c0c('0x47')];_0x3a163d+=0x1){socket[_0x4c0c('0xdc')]('userSmsAccount:save',{'UserId':Number(_0x12773a[_0x4c0c('0x56')]['ids'][_0x3a163d]),'SmsAccountId':Number(_0x12773a[_0x4c0c('0x52')]['id'])});}return _0x117b6c;});}})[_0x4c0c('0x34')](respondWithResult(_0x5f64c8,null))['catch'](handleError(_0x5f64c8,null));};exports['removeAgents']=function(_0x12a907,_0x2cc9be,_0x637ddb){return db[_0x4c0c('0x3d')][_0x4c0c('0x5b')]({'where':{'id':_0x12a907[_0x4c0c('0x52')]['id']}})['then'](handleEntityNotFound(_0x2cc9be,null))['then'](function(_0x737a99){if(_0x737a99){return _0x737a99['removeAgents'](_0x12a907['query'][_0x4c0c('0x6a')])[_0x4c0c('0x34')](function(){if(_[_0x4c0c('0xdd')](_0x12a907[_0x4c0c('0x42')][_0x4c0c('0x6a')])){for(var _0x129e18=0x0;_0x129e18<_0x12a907[_0x4c0c('0x42')]['ids'][_0x4c0c('0x47')];_0x129e18+=0x1){socket[_0x4c0c('0xdc')](_0x4c0c('0xde'),{'UserId':Number(_0x12a907['query']['ids'][_0x129e18]),'SmsAccountId':Number(_0x12a907[_0x4c0c('0x52')]['id'])});}}else{socket[_0x4c0c('0xdc')](_0x4c0c('0xde'),{'UserId':Number(_0x12a907[_0x4c0c('0x42')][_0x4c0c('0x6a')]),'SmsAccountId':Number(_0x12a907[_0x4c0c('0x52')]['id'])});}});}})[_0x4c0c('0x34')](respondWithStatusCode(_0x2cc9be,null))[_0x4c0c('0x25')](handleError(_0x2cc9be,null));};exports[_0x4c0c('0xdf')]=function(_0x3711fb,_0xe6044f,_0x1daefc){var _0x5ea686={};var _0x2ae54d={};var _0x106d06;var _0x345616;return db[_0x4c0c('0x3d')][_0x4c0c('0x62')]({'where':{'id':_0x3711fb[_0x4c0c('0x52')]['id']}})[_0x4c0c('0x34')](handleEntityNotFound(_0xe6044f,null))[_0x4c0c('0x34')](function(_0x3aa8cf){if(_0x3aa8cf){_0x106d06=_0x3aa8cf;_0x2ae54d[_0x4c0c('0x41')]=_[_0x4c0c('0x43')](db['User']['rawAttributes']);_0x2ae54d['query']=_['keys'](_0x3711fb['query']);_0x2ae54d[_0x4c0c('0x4b')]=_[_0x4c0c('0x44')](_0x2ae54d[_0x4c0c('0x41')],_0x2ae54d[_0x4c0c('0x42')]);_0x5ea686['attributes']=_[_0x4c0c('0x44')](_0x2ae54d[_0x4c0c('0x41')],qs[_0x4c0c('0x46')](_0x3711fb['query'][_0x4c0c('0x46')]));_0x5ea686['attributes']=_0x5ea686['attributes']['length']?_0x5ea686[_0x4c0c('0x45')]:_0x2ae54d[_0x4c0c('0x41')];_0x5ea686[_0x4c0c('0x65')]=qs[_0x4c0c('0x49')](_0x3711fb[_0x4c0c('0x42')][_0x4c0c('0x49')]);_0x5ea686[_0x4c0c('0x4a')]=qs[_0x4c0c('0x4b')](_['pick'](_0x3711fb['query'],_0x2ae54d[_0x4c0c('0x4b')]));if(_0x3711fb[_0x4c0c('0x42')][_0x4c0c('0x4c')]){_0x5ea686[_0x4c0c('0x4a')]=_[_0x4c0c('0x4d')](_0x5ea686[_0x4c0c('0x4a')],{'$or':_[_0x4c0c('0x3c')](_0x5ea686[_0x4c0c('0x45')],function(_0x145e33){var _0x22cc6a={};_0x22cc6a[_0x145e33]={'$like':'%'+_0x3711fb[_0x4c0c('0x42')][_0x4c0c('0x4c')]+'%'};return _0x22cc6a;})});}_0x5ea686=_[_0x4c0c('0x4d')]({},_0x5ea686,_0x3711fb[_0x4c0c('0x67')]);return _0x106d06['getAgents'](_0x5ea686);}})[_0x4c0c('0x34')](function(_0x164118){if(_0x164118){_0x345616=_0x164118[_0x4c0c('0x47')];if(!_0x3711fb[_0x4c0c('0x42')][_0x4c0c('0x48')](_0x4c0c('0x64'))){_0x5ea686[_0x4c0c('0x2c')]=qs[_0x4c0c('0x2c')](_0x3711fb[_0x4c0c('0x42')]['limit']);_0x5ea686[_0x4c0c('0x2a')]=qs[_0x4c0c('0x2a')](_0x3711fb['query']['offset']);}return _0x106d06[_0x4c0c('0xdf')](_0x5ea686);}})['then'](function(_0x6ee414){if(_0x6ee414){return _0x6ee414?{'count':_0x345616,'rows':_0x6ee414}:null;}})['then'](respondWithResult(_0xe6044f,null))[_0x4c0c('0x25')](handleError(_0xe6044f,null));}; \ No newline at end of file +var _0x4174=['Applications','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','sender','connectel','clicksend','message_id','plivo','MessageUUID','results','text','csc','originatingAddress','fromNumber','replyMessageId','intelepeer','refid','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','omit','contact','SmsInteraction','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','UserId','User','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','set','Content-Type','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner','fullname','Tag','Tags','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','SmsMessage','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','requestid','statusInt','status_code','infobip','groupName','clickatell','redif','error_code','DELIVERED','bandwidth','message-delivered','DELIVRD','statusGet','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./smsAccount.socket','register','client','http','request','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','SmsAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','map','SmsAccount','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','include','show','mandatoryDispositionPause','rawAttributes','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','getDispositions','findOne','order','pick','SmsAccountId','options','findAll','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','sms','SmsApplication','account','applications','orderBy'];(function(_0x2bcd43,_0x48cdc0){var _0x30140f=function(_0x365bb6){while(--_0x365bb6){_0x2bcd43['push'](_0x2bcd43['shift']());}};_0x30140f(++_0x48cdc0);}(_0x4174,0x147));var _0x4417=function(_0x1389b6,_0x3c2c63){_0x1389b6=_0x1389b6-0x0;var _0x4e3c0c=_0x4174[_0x1389b6];return _0x4e3c0c;};'use strict';var emlformat=require(_0x4417('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4417('0x1'));var jsonpatch=require(_0x4417('0x2'));var rp=require(_0x4417('0x3'));var moment=require('moment');var BPromise=require(_0x4417('0x4'));var Mustache=require(_0x4417('0x5'));var util=require(_0x4417('0x6'));var path=require(_0x4417('0x7'));var sox=require(_0x4417('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4417('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4417('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4417('0xb'));var querystring=require(_0x4417('0xc'));var Papa=require(_0x4417('0xd'));var Redis=require(_0x4417('0xe'));var authService=require(_0x4417('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4417('0x10'));var hardwareService=require(_0x4417('0x11'));var logger=require(_0x4417('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4417('0x13'));var licenseUtil=require(_0x4417('0x14'));var db=require(_0x4417('0x15'))['db'];config['redis']=_[_0x4417('0x16')](config[_0x4417('0x17')],{'host':_0x4417('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4417('0x19'))[_0x4417('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4417('0x1b')][_0x4417('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x409428,_0x3d8246,_0xaa2ae7,_0x53b46d){return new BPromise(function(_0x275cbd,_0x37634e){var _0x5e1609=_0x53b46d||client;return _0x5e1609[_0x4417('0x1d')](_0x409428,_0xaa2ae7)[_0x4417('0x1e')](function(_0x4526c0){logger[_0x4417('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x3d8246,'request\x20sent');logger[_0x4417('0x20')](_0x4417('0x21'),_0x3d8246,_0x4417('0x22'),JSON['stringify'](_0x4526c0));if(_0x4526c0[_0x4417('0x23')]){if(_0x4526c0[_0x4417('0x23')]['code']===0x1f4){logger[_0x4417('0x23')](_0x4417('0x24'),_0x3d8246,_0x4526c0[_0x4417('0x23')][_0x4417('0x25')]);return _0x37634e(_0x4526c0[_0x4417('0x23')][_0x4417('0x25')]);}logger[_0x4417('0x23')](_0x4417('0x24'),_0x3d8246,_0x4526c0[_0x4417('0x23')][_0x4417('0x25')]);return _0x275cbd(_0x4526c0[_0x4417('0x23')]['message']);}else{logger['info'](_0x4417('0x24'),_0x3d8246,'request\x20sent');_0x275cbd(_0x4526c0[_0x4417('0x26')][_0x4417('0x25')]);}})[_0x4417('0x27')](function(_0x1c5ab8){logger[_0x4417('0x23')](_0x4417('0x24'),_0x3d8246,_0x1c5ab8);_0x37634e(_0x1c5ab8);});});}function respondWithStatusCode(_0x6c5bb8,_0x148658){_0x148658=_0x148658||0xcc;return function(_0x5715bb){if(_0x5715bb){return _0x6c5bb8[_0x4417('0x28')](_0x148658);}return _0x6c5bb8[_0x4417('0x29')](_0x148658)[_0x4417('0x2a')]();};}function respondWithResult(_0x504bd8,_0x2b430b){_0x2b430b=_0x2b430b||0xc8;return function(_0x135abf){if(_0x135abf){return _0x504bd8[_0x4417('0x29')](_0x2b430b)[_0x4417('0x2b')](_0x135abf);}};}function respondWithFilteredResult(_0x57bece,_0x2f1157){return function(_0x5c9f6b){if(_0x5c9f6b){var _0x9c974a=typeof _0x2f1157[_0x4417('0x2c')]===_0x4417('0x2d')&&typeof _0x2f1157[_0x4417('0x2e')]==='undefined';var _0x5374f8=_0x5c9f6b[_0x4417('0x2f')];var _0x198c22=_0x9c974a?0x0:_0x2f1157[_0x4417('0x2c')];var _0x44dd32=_0x9c974a?_0x5c9f6b['count']:_0x2f1157[_0x4417('0x2c')]+_0x2f1157['limit'];var _0x5a0889;if(_0x44dd32>=_0x5374f8){_0x44dd32=_0x5374f8;_0x5a0889=0xc8;}else{_0x5a0889=0xce;}_0x57bece[_0x4417('0x29')](_0x5a0889);return _0x57bece['set']('Content-Range',_0x198c22+'-'+_0x44dd32+'/'+_0x5374f8)[_0x4417('0x2b')](_0x5c9f6b);}return null;};}function patchUpdates(_0x61806c){return function(_0x562285){try{jsonpatch[_0x4417('0x30')](_0x562285,_0x61806c,!![]);}catch(_0x421b0b){return BPromise[_0x4417('0x31')](_0x421b0b);}return _0x562285[_0x4417('0x32')]();};}function saveUpdates(_0x409017,_0x8152d9){return function(_0x3d4f1a){if(_0x3d4f1a){return _0x3d4f1a[_0x4417('0x33')](_0x409017)[_0x4417('0x1e')](function(_0x417824){return _0x417824;});}return null;};}function removeEntity(_0x2c0fb8,_0x32e3e7){return function(_0x5cf5d3){if(_0x5cf5d3){return _0x5cf5d3['destroy']()[_0x4417('0x1e')](function(){var _0x598506=_0x5cf5d3['get']({'plain':!![]});var _0x30a884=_0x4417('0x34');return db[_0x4417('0x35')][_0x4417('0x36')]({'where':{'type':_0x30a884,'resourceId':_0x598506['id']}})[_0x4417('0x1e')](function(){return _0x5cf5d3;});})['then'](function(){_0x2c0fb8[_0x4417('0x29')](0xcc)[_0x4417('0x2a')]();});}};}function handleEntityNotFound(_0x4eaf88,_0x210eec){return function(_0x36b8d9){if(!_0x36b8d9){_0x4eaf88['sendStatus'](0x194);}return _0x36b8d9;};}function handleError(_0x48c364,_0x4c0fce){_0x4c0fce=_0x4c0fce||0x1f4;return function(_0xd53598){logger[_0x4417('0x23')](_0xd53598[_0x4417('0x37')]);if(_0xd53598[_0x4417('0x38')]){delete _0xd53598['name'];}_0x48c364[_0x4417('0x29')](_0x4c0fce)[_0x4417('0x39')](_0xd53598);};}exports[_0x4417('0x3a')]=function(_0x4ab263,_0x55e4cc){var _0x1ebf18={'include':[{'model':db[_0x4417('0x3b')],'as':'mandatoryDispositionPause'}]},_0x3a4ec5={},_0x153cf9={'count':0x0,'rows':[]};var _0xbcc41e=_[_0x4417('0x3c')](db[_0x4417('0x3d')]['rawAttributes'],function(_0x3c83f7){return{'name':_0x3c83f7['fieldName'],'type':_0x3c83f7['type'][_0x4417('0x3e')]};});_0x3a4ec5[_0x4417('0x3f')]=_[_0x4417('0x3c')](_0xbcc41e,'name');_0x3a4ec5[_0x4417('0x40')]=_[_0x4417('0x41')](_0x4ab263['query']);_0x3a4ec5[_0x4417('0x42')]=_[_0x4417('0x43')](_0x3a4ec5[_0x4417('0x3f')],_0x3a4ec5[_0x4417('0x40')]);_0x1ebf18[_0x4417('0x44')]=_[_0x4417('0x43')](_0x3a4ec5['model'],qs[_0x4417('0x45')](_0x4ab263[_0x4417('0x40')][_0x4417('0x45')]));_0x1ebf18[_0x4417('0x44')]=_0x1ebf18[_0x4417('0x44')][_0x4417('0x46')]?_0x1ebf18[_0x4417('0x44')]:_0x3a4ec5[_0x4417('0x3f')];if(!_0x4ab263['query'][_0x4417('0x47')](_0x4417('0x48'))){_0x1ebf18[_0x4417('0x2e')]=qs[_0x4417('0x2e')](_0x4ab263[_0x4417('0x40')]['limit']);_0x1ebf18[_0x4417('0x2c')]=qs[_0x4417('0x2c')](_0x4ab263[_0x4417('0x40')][_0x4417('0x2c')]);}_0x1ebf18['order']=qs[_0x4417('0x49')](_0x4ab263[_0x4417('0x40')][_0x4417('0x49')]);_0x1ebf18[_0x4417('0x4a')]=qs[_0x4417('0x42')](_['pick'](_0x4ab263[_0x4417('0x40')],_0x3a4ec5[_0x4417('0x42')]),_0xbcc41e);if(_0x4ab263[_0x4417('0x40')][_0x4417('0x4b')]){_0x1ebf18[_0x4417('0x4a')]=_['merge'](_0x1ebf18[_0x4417('0x4a')],{'$or':_[_0x4417('0x3c')](_0xbcc41e,function(_0x128785){if(_0x128785[_0x4417('0x4c')]!==_0x4417('0x4d')){var _0x3bb576={};_0x3bb576[_0x128785[_0x4417('0x38')]]={'$like':'%'+_0x4ab263['query'][_0x4417('0x4b')]+'%'};return _0x3bb576;}})});}_0x1ebf18=_[_0x4417('0x4e')]({},_0x1ebf18,_0x4ab263['options']);var _0x317191={'where':_0x1ebf18[_0x4417('0x4a')]};return db[_0x4417('0x3d')][_0x4417('0x2f')](_0x317191)[_0x4417('0x1e')](function(_0x22da7f){_0x153cf9[_0x4417('0x2f')]=_0x22da7f;if(_0x4ab263[_0x4417('0x40')]['includeAll']){_0x1ebf18[_0x4417('0x4f')]=[{'all':!![]}];}return db[_0x4417('0x3d')]['findAll'](_0x1ebf18);})[_0x4417('0x1e')](function(_0x421825){_0x153cf9['rows']=_0x421825;return _0x153cf9;})[_0x4417('0x1e')](respondWithFilteredResult(_0x55e4cc,_0x1ebf18))[_0x4417('0x27')](handleError(_0x55e4cc,null));};exports[_0x4417('0x50')]=function(_0x49d582,_0x2ed563){var _0x2d1070={'raw':![],'where':{'id':_0x49d582['params']['id']},'include':[{'model':db[_0x4417('0x3b')],'as':_0x4417('0x51')}]},_0x17aa5b={};_0x17aa5b['model']=_[_0x4417('0x41')](db[_0x4417('0x3d')][_0x4417('0x52')]);_0x17aa5b[_0x4417('0x40')]=_[_0x4417('0x41')](_0x49d582['query']);_0x17aa5b[_0x4417('0x42')]=_[_0x4417('0x43')](_0x17aa5b[_0x4417('0x3f')],_0x17aa5b['query']);_0x2d1070[_0x4417('0x44')]=_['intersection'](_0x17aa5b[_0x4417('0x3f')],qs['fields'](_0x49d582[_0x4417('0x40')]['fields']));_0x2d1070[_0x4417('0x44')]=_0x2d1070[_0x4417('0x44')][_0x4417('0x46')]?_0x2d1070[_0x4417('0x44')]:_0x17aa5b['model'];if(_0x49d582['query'][_0x4417('0x53')]){_0x2d1070[_0x4417('0x4f')]=[{'all':!![]}];}_0x2d1070=_[_0x4417('0x4e')]({},_0x2d1070,_0x49d582['options']);return db['SmsAccount'][_0x4417('0x54')](_0x2d1070)[_0x4417('0x1e')](handleEntityNotFound(_0x2ed563,null))[_0x4417('0x1e')](respondWithResult(_0x2ed563,null))['catch'](handleError(_0x2ed563,null));};exports[_0x4417('0x55')]=function(_0x37cbf2,_0x502c30){return db['SmsAccount'][_0x4417('0x55')](_0x37cbf2[_0x4417('0x56')],{})[_0x4417('0x1e')](function(_0x1bfcfc){var _0x195e10=_0x37cbf2[_0x4417('0x57')][_0x4417('0x58')]({'plain':!![]});if(!_0x195e10)throw new Error(_0x4417('0x59'));if(_0x195e10['role']===_0x4417('0x57')){var _0x3c4c12=_0x1bfcfc[_0x4417('0x58')]({'plain':!![]});var _0x56b82=_0x4417('0x34');return db['UserProfileSection'][_0x4417('0x54')]({'where':{'name':_0x56b82,'userProfileId':_0x195e10['userProfileId']},'raw':!![]})[_0x4417('0x1e')](function(_0x3f1e41){if(_0x3f1e41&&_0x3f1e41[_0x4417('0x5a')]===0x0){return db[_0x4417('0x35')]['create']({'name':_0x3c4c12[_0x4417('0x38')],'resourceId':_0x3c4c12['id'],'type':_0x3f1e41[_0x4417('0x38')],'sectionId':_0x3f1e41['id']},{})['then'](function(){return _0x1bfcfc;});}else{return _0x1bfcfc;}})[_0x4417('0x27')](function(_0x5f6e33){logger[_0x4417('0x23')](_0x4417('0x5b'),_0x5f6e33);throw _0x5f6e33;});}return _0x1bfcfc;})[_0x4417('0x1e')](respondWithResult(_0x502c30,0xc9))[_0x4417('0x27')](handleError(_0x502c30,null));};exports[_0x4417('0x33')]=function(_0x5ba796,_0x29a186){if(_0x5ba796[_0x4417('0x56')]['id']){delete _0x5ba796[_0x4417('0x56')]['id'];}return db[_0x4417('0x3d')][_0x4417('0x54')]({'where':{'id':_0x5ba796[_0x4417('0x5c')]['id']},'include':[{'model':db[_0x4417('0x3b')],'as':_0x4417('0x51')}]})[_0x4417('0x1e')](handleEntityNotFound(_0x29a186,null))[_0x4417('0x1e')](saveUpdates(_0x5ba796[_0x4417('0x56')],null))[_0x4417('0x1e')](respondWithResult(_0x29a186,null))[_0x4417('0x27')](handleError(_0x29a186,null));};exports['destroy']=function(_0x525bef,_0x2628a7){return db[_0x4417('0x3d')][_0x4417('0x54')]({'where':{'id':_0x525bef[_0x4417('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2628a7,null))[_0x4417('0x1e')](removeEntity(_0x2628a7,null))[_0x4417('0x27')](handleError(_0x2628a7,null));};exports[_0x4417('0x5d')]=function(_0x36224c,_0x2789ed){return db[_0x4417('0x3d')][_0x4417('0x5d')]()[_0x4417('0x1e')](respondWithResult(_0x2789ed,null))['catch'](handleError(_0x2789ed,null));};exports[_0x4417('0x5e')]=function(_0x5dd504,_0x48e230,_0x1a3c0a){if(_0x5dd504[_0x4417('0x56')]['id']){delete _0x5dd504[_0x4417('0x56')]['id'];}return db['SmsAccount'][_0x4417('0x54')]({'where':{'id':_0x5dd504[_0x4417('0x5c')]['id']}})[_0x4417('0x1e')](handleEntityNotFound(_0x48e230,null))['then'](function(_0x284df5){if(_0x284df5){_0x5dd504[_0x4417('0x56')]['SmsAccountId']=_0x284df5['id'];return db[_0x4417('0x5f')]['create'](_0x5dd504['body']);}})['then'](respondWithResult(_0x48e230,null))[_0x4417('0x27')](handleError(_0x48e230,null));};exports[_0x4417('0x60')]=function(_0x36ee89,_0x368fb0,_0x10a16e){var _0xdaaccc={'raw':![],'where':{}};var _0x3225ba={};var _0x4b86c6={'count':0x0,'rows':[]};return db[_0x4417('0x3d')][_0x4417('0x61')]({'where':{'id':_0x36ee89[_0x4417('0x5c')]['id']}})[_0x4417('0x1e')](handleEntityNotFound(_0x368fb0,null))[_0x4417('0x1e')](function(_0x482cfd){if(_0x482cfd){_0x3225ba['model']=_['keys'](db[_0x4417('0x5f')]['rawAttributes']);_0x3225ba[_0x4417('0x40')]=_['keys'](_0x36ee89[_0x4417('0x40')]);_0x3225ba['filters']=_[_0x4417('0x43')](_0x3225ba[_0x4417('0x3f')],_0x3225ba['query']);_0xdaaccc[_0x4417('0x44')]=_[_0x4417('0x43')](_0x3225ba[_0x4417('0x3f')],qs[_0x4417('0x45')](_0x36ee89[_0x4417('0x40')][_0x4417('0x45')]));_0xdaaccc[_0x4417('0x44')]=_0xdaaccc[_0x4417('0x44')][_0x4417('0x46')]?_0xdaaccc[_0x4417('0x44')]:_0x3225ba[_0x4417('0x3f')];if(!_0x36ee89[_0x4417('0x40')][_0x4417('0x47')]('nolimit')){_0xdaaccc[_0x4417('0x2e')]=qs[_0x4417('0x2e')](_0x36ee89[_0x4417('0x40')][_0x4417('0x2e')]);_0xdaaccc['offset']=qs[_0x4417('0x2c')](_0x36ee89['query'][_0x4417('0x2c')]);}_0xdaaccc[_0x4417('0x62')]=qs[_0x4417('0x49')](_0x36ee89[_0x4417('0x40')][_0x4417('0x49')]);_0xdaaccc[_0x4417('0x4a')]=qs[_0x4417('0x42')](_[_0x4417('0x63')](_0x36ee89[_0x4417('0x40')],_0x3225ba[_0x4417('0x42')]));_0xdaaccc[_0x4417('0x4a')][_0x4417('0x64')]=_0x482cfd['id'];if(_0x36ee89[_0x4417('0x40')][_0x4417('0x4b')]){_0xdaaccc['where']=_[_0x4417('0x4e')](_0xdaaccc[_0x4417('0x4a')],{'$or':_['map'](_0xdaaccc[_0x4417('0x44')],function(_0x2914a1){var _0xdf4909={};_0xdf4909[_0x2914a1]={'$like':'%'+_0x36ee89[_0x4417('0x40')][_0x4417('0x4b')]+'%'};return _0xdf4909;})});}_0xdaaccc=_[_0x4417('0x4e')]({},_0xdaaccc,_0x36ee89[_0x4417('0x65')]);return db['Disposition']['count']({'where':_0xdaaccc[_0x4417('0x4a')]})[_0x4417('0x1e')](function(_0x288fd4){_0x4b86c6['count']=_0x288fd4;if(_0x36ee89['query'][_0x4417('0x53')]){_0xdaaccc[_0x4417('0x4f')]=[{'all':!![]}];}return db['Disposition'][_0x4417('0x66')](_0xdaaccc);})[_0x4417('0x1e')](function(_0x3ca4b8){_0x4b86c6[_0x4417('0x67')]=_0x3ca4b8;return _0x4b86c6;});}})[_0x4417('0x1e')](respondWithFilteredResult(_0x368fb0,_0xdaaccc))['catch'](handleError(_0x368fb0,null));};exports[_0x4417('0x68')]=function(_0x1103ff,_0x29fce8,_0x4f27b7){return db[_0x4417('0x3d')][_0x4417('0x54')]({'where':{'id':_0x1103ff['params']['id']}})[_0x4417('0x1e')](handleEntityNotFound(_0x29fce8,null))['then'](function(_0x4e9cfb){if(_0x4e9cfb){return _0x4e9cfb[_0x4417('0x68')](_0x1103ff[_0x4417('0x40')][_0x4417('0x69')]);}})[_0x4417('0x1e')](respondWithStatusCode(_0x29fce8,null))[_0x4417('0x27')](handleError(_0x29fce8,null));};exports[_0x4417('0x6a')]=function(_0x42fe81,_0x4d579b,_0x4e1a3d){if(_0x42fe81[_0x4417('0x56')]['id']){delete _0x42fe81[_0x4417('0x56')]['id'];}return db[_0x4417('0x3d')]['find']({'where':{'id':_0x42fe81[_0x4417('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4d579b,null))[_0x4417('0x1e')](function(_0x4cdc09){if(_0x4cdc09){_0x42fe81[_0x4417('0x56')][_0x4417('0x64')]=_0x4cdc09['id'];return db['CannedAnswer'][_0x4417('0x55')](_0x42fe81[_0x4417('0x56')]);}})[_0x4417('0x1e')](respondWithResult(_0x4d579b,null))[_0x4417('0x27')](handleError(_0x4d579b,null));};exports[_0x4417('0x6b')]=function(_0x3dbc39,_0xfa8fea,_0x5a6bdf){var _0x15cac1={'raw':![],'where':{}};var _0x98a0e2={};var _0x550d9a={'count':0x0,'rows':[]};return db[_0x4417('0x3d')]['findOne']({'where':{'id':_0x3dbc39[_0x4417('0x5c')]['id']}})[_0x4417('0x1e')](handleEntityNotFound(_0xfa8fea,null))['then'](function(_0x3d4ed6){if(_0x3d4ed6){_0x98a0e2[_0x4417('0x3f')]=_[_0x4417('0x41')](db[_0x4417('0x6c')][_0x4417('0x52')]);_0x98a0e2[_0x4417('0x40')]=_[_0x4417('0x41')](_0x3dbc39['query']);_0x98a0e2[_0x4417('0x42')]=_[_0x4417('0x43')](_0x98a0e2[_0x4417('0x3f')],_0x98a0e2['query']);_0x15cac1[_0x4417('0x44')]=_[_0x4417('0x43')](_0x98a0e2['model'],qs[_0x4417('0x45')](_0x3dbc39[_0x4417('0x40')][_0x4417('0x45')]));_0x15cac1['attributes']=_0x15cac1[_0x4417('0x44')]['length']?_0x15cac1[_0x4417('0x44')]:_0x98a0e2[_0x4417('0x3f')];if(!_0x3dbc39[_0x4417('0x40')]['hasOwnProperty'](_0x4417('0x48'))){_0x15cac1[_0x4417('0x2e')]=qs[_0x4417('0x2e')](_0x3dbc39[_0x4417('0x40')]['limit']);_0x15cac1[_0x4417('0x2c')]=qs[_0x4417('0x2c')](_0x3dbc39['query'][_0x4417('0x2c')]);}_0x15cac1[_0x4417('0x62')]=qs[_0x4417('0x49')](_0x3dbc39[_0x4417('0x40')][_0x4417('0x49')]);_0x15cac1[_0x4417('0x4a')]=qs[_0x4417('0x42')](_[_0x4417('0x63')](_0x3dbc39[_0x4417('0x40')],_0x98a0e2[_0x4417('0x42')]));_0x15cac1[_0x4417('0x4a')][_0x4417('0x64')]=_0x3d4ed6['id'];if(_0x3dbc39['query'][_0x4417('0x4b')]){_0x15cac1[_0x4417('0x4a')]=_[_0x4417('0x4e')](_0x15cac1[_0x4417('0x4a')],{'$or':_[_0x4417('0x3c')](_0x15cac1[_0x4417('0x44')],function(_0x12e778){var _0x32e732={};_0x32e732[_0x12e778]={'$like':'%'+_0x3dbc39[_0x4417('0x40')][_0x4417('0x4b')]+'%'};return _0x32e732;})});}_0x15cac1=_[_0x4417('0x4e')]({},_0x15cac1,_0x3dbc39['options']);return db['CannedAnswer'][_0x4417('0x2f')]({'where':_0x15cac1[_0x4417('0x4a')]})[_0x4417('0x1e')](function(_0xdc10d8){_0x550d9a[_0x4417('0x2f')]=_0xdc10d8;if(_0x3dbc39['query'][_0x4417('0x53')]){_0x15cac1[_0x4417('0x4f')]=[{'all':!![]}];}return db[_0x4417('0x6c')]['findAll'](_0x15cac1);})[_0x4417('0x1e')](function(_0x335c04){_0x550d9a[_0x4417('0x67')]=_0x335c04;return _0x550d9a;});}})[_0x4417('0x1e')](respondWithFilteredResult(_0xfa8fea,_0x15cac1))[_0x4417('0x27')](handleError(_0xfa8fea,null));};exports[_0x4417('0x6d')]=function(_0x70a7d7,_0x53494f,_0x333cd5){return db[_0x4417('0x3d')][_0x4417('0x54')]({'where':{'id':_0x70a7d7[_0x4417('0x5c')]['id']}})[_0x4417('0x1e')](handleEntityNotFound(_0x53494f,null))[_0x4417('0x1e')](function(_0x186f58){if(_0x186f58){return _0x186f58[_0x4417('0x6d')](_0x70a7d7[_0x4417('0x40')][_0x4417('0x69')]);}})[_0x4417('0x1e')](respondWithStatusCode(_0x53494f,null))['catch'](handleError(_0x53494f,null));};exports['notify']=function(_0x32c3bc,_0x1c1d31,_0x2ce78b){var _0x2cfb0b={'channel':_0x4417('0x6e')};var _0x500aee=[];var _0x51ec78=[];var _0x5091d6={};return db[_0x4417('0x3d')][_0x4417('0x54')]({'where':{'id':_0x32c3bc[_0x4417('0x5c')]['id']},'include':[{'model':db[_0x4417('0x6f')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x1c1d31,null))['then'](function(_0x512032){_0x2cfb0b[_0x4417('0x70')]=_0x512032;_0x2cfb0b[_0x4417('0x71')]=_[_0x4417('0x72')](_0x512032[_0x4417('0x73')],[_0x4417('0x74')],[_0x4417('0x75')]);if(_0x2cfb0b[_0x4417('0x70')]['Applications']){delete _0x2cfb0b[_0x4417('0x70')][_0x4417('0x73')];}return db['CmContact'][_0x4417('0x5d')]();})[_0x4417('0x1e')](function(_0x21a363){if(!_0x21a363){throw new db[(_0x4417('0x76'))][(_0x4417('0x77'))](_0x4417('0x78'));}_0x500aee=_[_0x4417('0x79')](_[_0x4417('0x41')](_0x21a363),[_0x4417('0x7a'),_0x4417('0x7b')]);_0x51ec78=_[_0x4417('0x79')](_[_0x4417('0x41')](_0x21a363),[_0x4417('0x7a'),'updatedAt',_0x4417('0x7c'),_0x4417('0x7d')]);_0x2cfb0b[_0x4417('0x56')]={'mapKey':_0x4417('0x7e')};if(_0x2cfb0b['account'][_0x4417('0x4c')]){switch(_0x2cfb0b[_0x4417('0x70')][_0x4417('0x4c')]){case _0x4417('0x7f'):_0x2cfb0b[_0x4417('0x56')][_0x4417('0x80')]=_0x32c3bc['body'][_0x4417('0x81')];_0x2cfb0b[_0x4417('0x56')][_0x4417('0x56')]=_0x32c3bc[_0x4417('0x56')][_0x4417('0x82')];_0x2cfb0b['body'][_0x4417('0x83')]=_0x32c3bc[_0x4417('0x56')]['MessageSid'];break;case'skebby':_0x2cfb0b[_0x4417('0x56')][_0x4417('0x80')]='+'+_0x32c3bc[_0x4417('0x56')][_0x4417('0x84')];_0x2cfb0b['body'][_0x4417('0x56')]=_0x32c3bc[_0x4417('0x56')]['text'];break;case _0x4417('0x85'):_0x2cfb0b[_0x4417('0x56')][_0x4417('0x80')]=_0x32c3bc[_0x4417('0x56')][_0x4417('0x80')];_0x2cfb0b[_0x4417('0x56')][_0x4417('0x56')]=_0x32c3bc[_0x4417('0x56')]['message'];break;case _0x4417('0x86'):_0x2cfb0b[_0x4417('0x56')][_0x4417('0x80')]=_0x32c3bc[_0x4417('0x56')][_0x4417('0x80')];_0x2cfb0b[_0x4417('0x56')][_0x4417('0x56')]=_0x32c3bc[_0x4417('0x56')][_0x4417('0x56')];_0x2cfb0b[_0x4417('0x56')][_0x4417('0x83')]=_0x32c3bc['body'][_0x4417('0x87')];break;case _0x4417('0x88'):_0x2cfb0b[_0x4417('0x56')][_0x4417('0x80')]=_0x32c3bc[_0x4417('0x56')][_0x4417('0x81')];_0x2cfb0b['body'][_0x4417('0x56')]=_0x32c3bc['body']['Text'];_0x2cfb0b['body'][_0x4417('0x83')]=_0x32c3bc['body'][_0x4417('0x89')];break;case'infobip':_0x2cfb0b[_0x4417('0x56')][_0x4417('0x80')]='+'+_0x32c3bc['body'][_0x4417('0x8a')][0x0][_0x4417('0x80')];_0x2cfb0b[_0x4417('0x56')][_0x4417('0x56')]=_0x32c3bc[_0x4417('0x56')]['results'][0x0][_0x4417('0x8b')];_0x2cfb0b['body']['messageId']=_0x32c3bc[_0x4417('0x56')]['results'][0x0]['messageId'];break;case _0x4417('0x8c'):_0x2cfb0b[_0x4417('0x56')][_0x4417('0x80')]=_0x32c3bc[_0x4417('0x56')][_0x4417('0x8d')];_0x2cfb0b[_0x4417('0x56')][_0x4417('0x56')]=_0x32c3bc[_0x4417('0x56')]['segmentedMessage'][_0x4417('0x25')];break;case'clickatell':_0x2cfb0b[_0x4417('0x56')][_0x4417('0x80')]=_0x32c3bc[_0x4417('0x56')][_0x4417('0x8e')];_0x2cfb0b[_0x4417('0x56')][_0x4417('0x56')]=_0x32c3bc[_0x4417('0x56')][_0x4417('0x8b')];_0x2cfb0b['body'][_0x4417('0x83')]=_0x32c3bc[_0x4417('0x56')][_0x4417('0x8f')];break;case'bandwidth':_0x2cfb0b[_0x4417('0x56')][_0x4417('0x83')]=_0x32c3bc[_0x4417('0x56')][0x0][_0x4417('0x25')]['id'];_0x2cfb0b[_0x4417('0x56')]['from']=_0x32c3bc[_0x4417('0x56')][0x0]['message'][_0x4417('0x80')];_0x2cfb0b[_0x4417('0x56')][_0x4417('0x56')]=_0x32c3bc[_0x4417('0x56')][0x0][_0x4417('0x25')][_0x4417('0x8b')];break;case _0x4417('0x90'):_0x2cfb0b[_0x4417('0x56')][_0x4417('0x80')]=_0x32c3bc['body'][_0x4417('0x80')];_0x2cfb0b[_0x4417('0x56')]['body']=_0x32c3bc[_0x4417('0x56')][_0x4417('0x25')];_0x2cfb0b[_0x4417('0x56')][_0x4417('0x83')]=_0x32c3bc['body'][_0x4417('0x91')];break;}}if(_0x2cfb0b[_0x4417('0x56')]['id']){delete _0x2cfb0b[_0x4417('0x56')]['id'];}if(_['isNil'](_0x2cfb0b[_0x4417('0x56')][_0x4417('0x80')])){throw new db[(_0x4417('0x76'))][(_0x4417('0x77'))](_0x4417('0x92'));}if(_[_0x4417('0x93')](_0x2cfb0b[_0x4417('0x56')][_0x4417('0x56')])||_0x2cfb0b[_0x4417('0x56')][_0x4417('0x56')]===''){throw new db[(_0x4417('0x76'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2cfb0b['body'][_0x4417('0x94')])){throw new db[(_0x4417('0x76'))]['ValidationError'](_0x4417('0x95')+_0x51ec78);}if(!_['includes'](_0x51ec78,_0x2cfb0b[_0x4417('0x56')]['mapKey'])){throw new db['Sequelize'][(_0x4417('0x77'))](_0x4417('0x96')+_0x51ec78);}_0x5091d6[_0x2cfb0b[_0x4417('0x56')][_0x4417('0x94')]]=_0x2cfb0b[_0x4417('0x56')][_0x4417('0x80')];return db[_0x4417('0x97')][_0x4417('0x54')]({'where':{'id':_0x2cfb0b[_0x4417('0x70')][_0x4417('0x7d')]},'include':[{'model':db[_0x4417('0x98')],'as':_0x4417('0x99'),'where':_0x5091d6,'limit':0x1,'order':[['updatedAt',_0x4417('0x9a')]]}]});})[_0x4417('0x1e')](handleEntityNotFound(_0x1c1d31,null))[_0x4417('0x1e')](function(_0x474f17){if(_0x474f17){_0x2cfb0b[_0x4417('0x9b')]=_[_0x4417('0x9c')](_0x474f17,['Contacts']);if(_0x474f17['Contacts'][_0x4417('0x46')]){return _0x474f17[_0x4417('0x99')][0x0];}var _0x58c5af=_[_0x4417('0x16')](_0x2cfb0b[_0x4417('0x56')],{'firstName':_0x2cfb0b[_0x4417('0x56')][_0x4417('0x80')],'ListId':_0x474f17['id']});_0x58c5af[_0x2cfb0b[_0x4417('0x56')][_0x4417('0x94')]]=_0x2cfb0b['body'][_0x4417('0x80')];return db[_0x4417('0x98')][_0x4417('0x55')](_0x58c5af,{'fields':_0x500aee,'raw':!![]});}})[_0x4417('0x1e')](handleEntityNotFound(_0x1c1d31,null))[_0x4417('0x1e')](function(_0xd14119){if(_0xd14119){_0x2cfb0b[_0x4417('0x9d')]=_0xd14119;var _0x40e26a={'ContactId':_0xd14119['id'],'phone':_0x2cfb0b[_0x4417('0x56')][_0x4417('0x80')],'SmsAccountId':_0x32c3bc[_0x4417('0x5c')]['id']};var _0x2540ff={'ContactId':_0xd14119['id'],'SmsAccountId':_0x32c3bc['params']['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x2540ff})[_0x4417('0x1e')](function(_0x213719){if(_0x213719){return[_0x213719,![]];}return db[_0x4417('0x9e')][_0x4417('0x55')](_0x40e26a)['then'](function(_0x86e94a){return[_0x86e94a,!![]];});});}})['spread'](function(_0x337a08,_0x225852){_0x2cfb0b['interaction']=_0x337a08[_0x4417('0x58')]({'plain':!![]});_0x2cfb0b[_0x4417('0x9f')][_0x4417('0xa0')]=![];if(_0x225852){if(_0x2cfb0b[_0x4417('0x70')]['autoclose']){_0x2cfb0b['applications'][_0x4417('0xa1')]({'id':0x0,'priority':_0x2cfb0b[_0x4417('0x71')][_0x4417('0x46')]+0x1,'app':_0x4417('0xa2'),'appdata':_0x4417('0xa3'),'interval':_0x4417('0xa4')});}_0x2cfb0b['interaction']['created']=!![];}return db['SmsMessage'][_0x4417('0x55')]({'phone':_0x2cfb0b[_0x4417('0x56')][_0x4417('0x80')],'messageId':_0x2cfb0b['body'][_0x4417('0x83')],'body':_0x2cfb0b['body'][_0x4417('0x56')],'SmsAccountId':_0x32c3bc['params']['id'],'SmsInteractionId':_0x337a08['id'],'direction':'in','ContactId':_0x337a08[_0x4417('0xa5')],'AttachmentId':_0x2cfb0b[_0x4417('0x56')]['AttachmentId']});})[_0x4417('0x1e')](function(_0x2a2f83){_0x2cfb0b[_0x4417('0x25')]=_0x2a2f83;if(_0x2cfb0b[_0x4417('0x9f')][_0x4417('0xa6')]){return db[_0x4417('0xa7')]['find']({'attributes':['id',_0x4417('0x38')],'where':{'id':_0x2cfb0b[_0x4417('0x9f')][_0x4417('0xa6')]}})[_0x4417('0x1e')](function(_0x37ad2b){if(_0x37ad2b){_0x2cfb0b[_0x4417('0x71')][_0x4417('0xa8')]({'id':0x0,'priority':0x0,'app':_0x4417('0xa9'),'appdata':_0x37ad2b[_0x4417('0x38')]+','+(_0x2cfb0b[_0x4417('0x70')]['waitForTheAssignedAgent']||0xa),'interval':_0x4417('0xa4')});}return respondWithRpcPromise(_0x4417('0xaa'),_0x4417('0xab'),_0x2cfb0b);});}return respondWithRpcPromise(_0x4417('0xaa'),_0x4417('0xab'),_0x2cfb0b);})[_0x4417('0x1e')](function(_0x3876ba){if(_0x3876ba){var _0x557867=0xc8;var _0x218aea=_0x4417('0xac');logger[_0x4417('0x1f')](_0x4417('0x21'),_0x218aea,_0x557867,_0x4417('0xad'));logger[_0x4417('0x20')](_0x4417('0xae'),_0x218aea,_0x557867,'entity\x20found',JSON[_0x4417('0xaf')](_0x3876ba));if(_0x2cfb0b[_0x4417('0x70')][_0x4417('0x4c')]===_0x4417('0x7f')){return _0x1c1d31[_0x4417('0x29')](_0x557867)[_0x4417('0xb0')](_0x4417('0xb1'),'text/xml')[_0x4417('0x39')]('\x0a');}else{return _0x1c1d31[_0x4417('0x29')](_0x557867)[_0x4417('0x2b')](_0x3876ba);}}})[_0x4417('0x27')](handleError(_0x1c1d31,null));};exports[_0x4417('0xb2')]=function(_0x388719,_0x16b621,_0x1c127b){return db[_0x4417('0x3d')]['findOne']({'where':{'id':_0x388719[_0x4417('0x5c')]['id']}})[_0x4417('0x1e')](handleEntityNotFound(_0x16b621,null))[_0x4417('0x1e')](function(_0x5396e8){if(_0x5396e8){return db[_0x4417('0xb3')][_0x4417('0xb4')](function(_0x57086a){return db[_0x4417('0x6f')][_0x4417('0x36')]({'where':{'SmsAccountId':_0x388719[_0x4417('0x5c')]['id']},'transaction':_0x57086a})[_0x4417('0x1e')](function(_0x3fe49a){var _0x5e6c41=_[_0x4417('0x3c')](_0x388719[_0x4417('0x56')],function(_0xc319b4){_0xc319b4[_0x4417('0x64')]=_0x388719[_0x4417('0x5c')]['id'];return _0xc319b4;});return db['SmsApplication'][_0x4417('0xb5')](_0x5e6c41,{'transaction':_0x57086a});});})[_0x4417('0x1e')](function(){return db[_0x4417('0x6f')][_0x4417('0xb6')]({'where':{'SmsAccountId':_0x388719['params']['id']},'order':_0x4417('0x74')});});}})[_0x4417('0x1e')](respondWithResult(_0x16b621,null))[_0x4417('0x27')](handleError(_0x16b621,null));};exports[_0x4417('0xb7')]=function(_0x4ed99b,_0x4a1a5a,_0x1231c3){var _0xb8448d={};var _0x250acf={};var _0x4d6ebe;var _0x3b7f28;return db[_0x4417('0x3d')][_0x4417('0x61')]({'where':{'id':_0x4ed99b[_0x4417('0x5c')]['id']}})[_0x4417('0x1e')](handleEntityNotFound(_0x4a1a5a,null))['then'](function(_0x2f229e){if(_0x2f229e){_0x4d6ebe=_0x2f229e;_0x250acf[_0x4417('0x3f')]=_['keys'](db[_0x4417('0x6f')]['rawAttributes']);_0x250acf[_0x4417('0x40')]=_['keys'](_0x4ed99b[_0x4417('0x40')]);_0x250acf['filters']=_[_0x4417('0x43')](_0x250acf[_0x4417('0x3f')],_0x250acf[_0x4417('0x40')]);_0xb8448d[_0x4417('0x44')]=_[_0x4417('0x43')](_0x250acf['model'],qs[_0x4417('0x45')](_0x4ed99b[_0x4417('0x40')][_0x4417('0x45')]));_0xb8448d[_0x4417('0x44')]=_0xb8448d[_0x4417('0x44')]['length']?_0xb8448d[_0x4417('0x44')]:_0x250acf[_0x4417('0x3f')];_0xb8448d[_0x4417('0x62')]=qs['sort'](_0x4ed99b[_0x4417('0x40')][_0x4417('0x49')]);_0xb8448d[_0x4417('0x4a')]=qs[_0x4417('0x42')](_[_0x4417('0x63')](_0x4ed99b[_0x4417('0x40')],_0x250acf[_0x4417('0x42')]));if(_0x4ed99b[_0x4417('0x40')][_0x4417('0x4b')]){_0xb8448d[_0x4417('0x4a')]=_[_0x4417('0x4e')](_0xb8448d[_0x4417('0x4a')],{'$or':_[_0x4417('0x3c')](_0xb8448d['attributes'],function(_0x5e596b){var _0x442c86={};_0x442c86[_0x5e596b]={'$like':'%'+_0x4ed99b[_0x4417('0x40')][_0x4417('0x4b')]+'%'};return _0x442c86;})});}_0xb8448d=_[_0x4417('0x4e')]({},_0xb8448d,_0x4ed99b[_0x4417('0x65')]);return _0x4d6ebe[_0x4417('0xb7')](_0xb8448d);}})['then'](function(_0x32a5eb){if(_0x32a5eb){_0x3b7f28=_0x32a5eb['length'];if(!_0x4ed99b[_0x4417('0x40')][_0x4417('0x47')](_0x4417('0x48'))){_0xb8448d[_0x4417('0x2e')]=qs[_0x4417('0x2e')](_0x4ed99b[_0x4417('0x40')][_0x4417('0x2e')]);_0xb8448d[_0x4417('0x2c')]=qs[_0x4417('0x2c')](_0x4ed99b[_0x4417('0x40')][_0x4417('0x2c')]);}return _0x4d6ebe[_0x4417('0xb7')](_0xb8448d);}})['then'](function(_0x40ddf9){if(_0x40ddf9){return _0x40ddf9?{'count':_0x3b7f28,'rows':_0x40ddf9}:null;}})[_0x4417('0x1e')](respondWithResult(_0x4a1a5a,null))[_0x4417('0x27')](handleError(_0x4a1a5a,null));};exports[_0x4417('0xb8')]=function(_0x4ff997,_0xb865bb,_0x55e9a6){var _0x4a95a5={'raw':![],'where':{}};var _0x53e1b6={};var _0x5a5bb4={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4417('0x61')]({'where':{'id':_0x4ff997[_0x4417('0x5c')]['id']}})[_0x4417('0x1e')](handleEntityNotFound(_0xb865bb,null))[_0x4417('0x1e')](function(_0x5e97eb){if(_0x5e97eb){_0x53e1b6[_0x4417('0x3f')]=_[_0x4417('0x41')](db['SmsInteraction'][_0x4417('0x52')]);_0x53e1b6[_0x4417('0x40')]=_[_0x4417('0x41')](_0x4ff997[_0x4417('0x40')]);_0x53e1b6[_0x4417('0x42')]=_[_0x4417('0x43')](_0x53e1b6['model'],_0x53e1b6['query']);_0x4a95a5[_0x4417('0x44')]=_[_0x4417('0x43')](_0x53e1b6[_0x4417('0x3f')],qs['fields'](_0x4ff997[_0x4417('0x40')]['fields']));_0x4a95a5[_0x4417('0x44')]=_0x4a95a5[_0x4417('0x44')][_0x4417('0x46')]?_0x4a95a5[_0x4417('0x44')]:_0x53e1b6[_0x4417('0x3f')];if(!_0x4ff997[_0x4417('0x40')][_0x4417('0x47')](_0x4417('0x48'))){_0x4a95a5[_0x4417('0x2e')]=qs[_0x4417('0x2e')](_0x4ff997[_0x4417('0x40')][_0x4417('0x2e')]);_0x4a95a5[_0x4417('0x2c')]=qs['offset'](_0x4ff997[_0x4417('0x40')]['offset']);}_0x4a95a5[_0x4417('0x62')]=qs['sort'](_0x4ff997[_0x4417('0x40')][_0x4417('0x49')]);_0x4a95a5[_0x4417('0x4a')]=qs[_0x4417('0x42')](_[_0x4417('0x63')](_0x4ff997[_0x4417('0x40')],_0x53e1b6[_0x4417('0x42')]));_0x4a95a5[_0x4417('0x4a')][_0x4417('0x64')]=_0x5e97eb['id'];if(_0x4ff997['query'][_0x4417('0x4b')]){_0x4a95a5[_0x4417('0x4a')]=_[_0x4417('0x4e')](_0x4a95a5['where'],{'$or':_[_0x4417('0x3c')](_0x4a95a5[_0x4417('0x44')],function(_0x5b3b8b){var _0x415b78={};_0x415b78[_0x5b3b8b]={'$like':'%'+_0x4ff997['query'][_0x4417('0x4b')]+'%'};return _0x415b78;})});}_0x4a95a5=_[_0x4417('0x4e')]({},_0x4a95a5,_0x4ff997[_0x4417('0x65')]);return db[_0x4417('0x9e')][_0x4417('0x2f')]({'where':_0x4a95a5[_0x4417('0x4a')]})[_0x4417('0x1e')](function(_0x16e782){_0x5a5bb4[_0x4417('0x2f')]=_0x16e782;if(_0x4ff997['query'][_0x4417('0x53')]){_0x4a95a5['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x4417('0xb9'),'attributes':['name',_0x4417('0xba'),'internal'],'required':![]},{'model':db[_0x4417('0xbb')],'as':_0x4417('0xbc'),'attributes':['id',_0x4417('0x38'),'color'],'where':_0x4ff997['query'][_0x4417('0xbd')]?{'id':_0x4ff997[_0x4417('0x40')]['tag']}:undefined,'required':_0x4ff997[_0x4417('0x40')][_0x4417('0xbd')]?!![]:![]}];}return db[_0x4417('0x9e')][_0x4417('0x66')](_0x4a95a5);})['then'](function(_0x3e84a7){_0x5a5bb4[_0x4417('0x67')]=_0x3e84a7;return _0x5a5bb4;});}})[_0x4417('0x1e')](respondWithFilteredResult(_0xb865bb,_0x4a95a5))['catch'](handleError(_0xb865bb,null));};exports[_0x4417('0x39')]=function(_0x146877,_0x16e23f,_0x148bdb){var _0x1b3afe,_0x296612,_0x43f290;if(_[_0x4417('0x93')](_0x146877[_0x4417('0x56')][_0x4417('0x56')])||_0x146877[_0x4417('0x56')]['body']===''){throw new db['Sequelize'][(_0x4417('0x77'))](_0x4417('0xbe'));}if(_['isNil'](_0x146877['body']['to'])){throw new db[(_0x4417('0x76'))][(_0x4417('0x77'))](_0x4417('0xbf'));}_0x1b3afe=_0x146877[_0x4417('0x56')]['to'];return db[_0x4417('0x3d')]['find']({'where':{'id':_0x146877[_0x4417('0x5c')]['id']},'include':[{'model':db[_0x4417('0x97')],'as':_0x4417('0xc0'),'include':[{'model':db[_0x4417('0x98')],'as':_0x4417('0x99'),'where':{'mobile':_0x1b3afe},'limit':0x1,'order':[[_0x4417('0x7b'),_0x4417('0x9a')]]}]}]})[_0x4417('0x1e')](handleEntityNotFound(_0x16e23f,null))[_0x4417('0x1e')](function(_0x34c5a9){if(_0x34c5a9&&_0x34c5a9['List']){_0x296612=_0x34c5a9[_0x4417('0x58')]({'plain':!![]});if(_0x296612['List']&&_0x296612[_0x4417('0xc0')][_0x4417('0x99')]['length']){return _0x296612[_0x4417('0xc0')][_0x4417('0x99')][0x0];}return db[_0x4417('0x98')]['create'](_[_0x4417('0x16')](_0x146877[_0x4417('0x56')],{'firstName':_0x1b3afe,'mobile':_0x1b3afe,'phone':_0x1b3afe,'ListId':_0x296612[_0x4417('0x7d')]}));}})[_0x4417('0x1e')](handleEntityNotFound(_0x16e23f,null))[_0x4417('0x1e')](function(_0x4e70fe){if(_0x4e70fe){_0x43f290=_0x4e70fe;return db[_0x4417('0x9e')][_0x4417('0x54')]({'where':{'ContactId':_0x43f290['id'],'closed':![],'SmsAccountId':_0x296612['id']}})[_0x4417('0x1e')](function(_0x3bd610){if(_0x3bd610){return[_0x3bd610,![]];}return db[_0x4417('0x9e')][_0x4417('0x55')]({'UserId':_0x146877[_0x4417('0x57')]['id'],'ContactId':_0x43f290['id'],'SmsAccountId':_0x296612['id'],'phone':_0x1b3afe,'firstMsgDirection':_0x4417('0xc1'),'Messages':[_[_0x4417('0x4e')](_0x146877['body'],{'read':![],'body':_0x146877[_0x4417('0x56')][_0x4417('0x56')],'phone':_0x1b3afe,'SmsAccountId':_0x296612['id'],'UserId':_0x146877['user']['id'],'ContactId':_0x43f290['id']})]},{'include':[{'model':db[_0x4417('0xc2')],'as':_0x4417('0xc3')}]})['then'](function(_0x177ae9){return[_0x177ae9,!![]];});});}})[_0x4417('0xc4')](function(_0x2ffdd9,_0x89828f){if(_0x89828f){return _0x2ffdd9;}return db[_0x4417('0xc2')]['create'](_[_0x4417('0x4e')](_0x146877[_0x4417('0x56')],{'read':![],'body':_0x146877[_0x4417('0x56')]['body'],'phone':_0x1b3afe,'SmsAccountId':_0x296612['id'],'SmsInteractionId':_0x2ffdd9['id'],'UserId':_0x146877['user']['id'],'ContactId':_0x43f290['id']}))['then'](function(_0x57e12d){_0x2ffdd9[_0x4417('0xc5')][_0x4417('0xc3')]=[];_0x2ffdd9[_0x4417('0xc5')][_0x4417('0xc3')]['push'](_0x57e12d['dataValues']);return _0x2ffdd9;});})[_0x4417('0x1e')](respondWithResult(_0x16e23f,null))[_0x4417('0x27')](handleError(_0x16e23f,null));};exports['status']=function(_0x411c73,_0x5649ae,_0x11c6d6){if(_0x411c73[_0x4417('0x56')]['id']){delete _0x411c73[_0x4417('0x56')]['id'];}var _0x4e958b,_0x44992a,_0x3fbc62;return db[_0x4417('0x3d')]['find']({'where':{'id':_0x411c73[_0x4417('0x5c')]['id']}})[_0x4417('0x1e')](handleEntityNotFound(_0x5649ae,null))[_0x4417('0x1e')](function(_0x31e260){if(_0x31e260){_0x3fbc62=_0x31e260;logger[_0x4417('0x20')](_0x4417('0x21'),_0x4417('0x29'),_0x4417('0xc6'),_0x31e260[_0x4417('0x4c')],util[_0x4417('0xc7')](_0x411c73[_0x4417('0x56')],{'showHidden':![],'depth':null}));switch(_0x31e260[_0x4417('0x4c')]){case _0x4417('0xc8'):if(_0x411c73[_0x4417('0x56')]['skebby_dispatch_id']&&_0x411c73[_0x4417('0x56')][_0x4417('0x29')]){_0x44992a=_0x411c73[_0x4417('0x56')][_0x4417('0x29')];return db[_0x4417('0xc2')][_0x4417('0x54')]({'where':{'messageId':_0x411c73['body']['skebby_dispatch_id']}});}break;case _0x4417('0x85'):if(_0x411c73['body'][_0x4417('0xc9')]&&_0x411c73[_0x4417('0x56')][_0x4417('0xca')]){_0x44992a=_0x411c73[_0x4417('0x56')]['statusInt'];return db[_0x4417('0xc2')][_0x4417('0x54')]({'where':{'messageId':_0x411c73[_0x4417('0x56')][_0x4417('0xc9')]}});}break;case'clicksend':if(_0x411c73['body'][_0x4417('0x87')]&&_0x411c73[_0x4417('0x56')]['status_code']){_0x44992a=_0x411c73[_0x4417('0x56')][_0x4417('0xcb')];return db[_0x4417('0xc2')][_0x4417('0x54')]({'where':{'messageId':_0x411c73[_0x4417('0x56')][_0x4417('0x87')]}});}break;case _0x4417('0xcc'):var _0x4dd2cd=_0x411c73[_0x4417('0x56')][_0x4417('0x8a')][0x0];if(_0x4dd2cd[_0x4417('0x83')]&&_0x4dd2cd[_0x4417('0x29')][_0x4417('0xcd')]==='DELIVERED'){_0x44992a=_0x4dd2cd[_0x4417('0x29')][_0x4417('0xcd')];return db[_0x4417('0xc2')][_0x4417('0x54')]({'where':{'messageId':_0x4dd2cd[_0x4417('0x83')]}});}break;case _0x4417('0xce'):if(_0x411c73['body'][_0x4417('0x83')]&&_0x411c73['body']['status']){_0x44992a=_0x411c73[_0x4417('0x56')][_0x4417('0x29')];return db[_0x4417('0xc2')][_0x4417('0x54')]({'where':{'messageId':_0x411c73[_0x4417('0x56')][_0x4417('0x83')]}});}break;case'bandwidth':if(_0x411c73[_0x4417('0x56')][0x0][_0x4417('0x25')]['id']){_0x44992a=_0x411c73[_0x4417('0x56')][0x0][_0x4417('0x4c')];return db[_0x4417('0xc2')][_0x4417('0x54')]({'where':{'messageId':_0x411c73[_0x4417('0x56')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x411c73[_0x4417('0x56')][_0x4417('0xcf')]&&_0x411c73[_0x4417('0x56')][_0x4417('0x29')]){_0x44992a=_0x411c73['body'][_0x4417('0x29')];return db[_0x4417('0xc2')][_0x4417('0x54')]({'where':{'messageId':_0x411c73['body'][_0x4417('0xcf')]}});}break;}}})[_0x4417('0x1e')](handleEntityNotFound(_0x5649ae,null))['then'](function(_0x4a0f95){if(_0x4a0f95){_0x4e958b=_0x4a0f95;switch(_0x3fbc62[_0x4417('0x4c')]){case _0x4417('0xc8'):if(_0x44992a==='DELIVERED'){return _0x4e958b['update']({'read':!![]});}else{logger['error'](_0x4417('0x21'),_0x4417('0x29'),_0x4417('0xc8'),util[_0x4417('0xc7')](_0x411c73[_0x4417('0x56')],{'showHidden':![],'depth':null}));}break;case _0x4417('0x85'):if(_0x44992a==='1'){return _0x4e958b[_0x4417('0x33')]({'read':!![]});}else{logger[_0x4417('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4417('0x29'),'skebby',util[_0x4417('0xc7')](_0x411c73[_0x4417('0x56')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x411c73[_0x4417('0x56')][_0x4417('0xd0')]&&_0x44992a>=0xc8&&_0x44992a<=0xce){return _0x4e958b['update']({'read':!![]});}else{logger[_0x4417('0x23')](_0x4417('0x21'),'status',_0x4417('0x86'),util[_0x4417('0xc7')](_0x411c73['body'],{'showHidden':![],'depth':null}));}break;case _0x4417('0xcc'):var _0x5c3dc3=_0x411c73['body']['results'][0x0];if(_0x5c3dc3[_0x4417('0x29')]['groupName']===_0x4417('0xd1')){return _0x4e958b['update']({'read':!![]});}else{logger[_0x4417('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x4417('0xcc'),util[_0x4417('0xc7')](_0x411c73['body'],{'showHidden':![],'depth':null}));}break;case _0x4417('0xce'):if(_0x44992a=='DELIVERED_TO_GATEWAY'||_0x44992a=='RECEIVED_BY_RECIPIENT'){return _0x4e958b[_0x4417('0x33')]({'read':!![]});}else{logger[_0x4417('0x23')](_0x4417('0x21'),_0x4417('0x29'),'clickatell',util[_0x4417('0xc7')](_0x411c73[_0x4417('0x56')],{'showHidden':![],'depth':null}));}break;case _0x4417('0xd2'):if(_0x44992a==_0x4417('0xd3')){return _0x4e958b[_0x4417('0x33')]({'read':!![]});}else{logger[_0x4417('0x23')](_0x4417('0x21'),_0x4417('0x29'),_0x4417('0xd2'),util[_0x4417('0xc7')](_0x411c73[_0x4417('0x56')],{'showHidden':![],'depth':null}));}break;case _0x4417('0x90'):if(_0x44992a===_0x4417('0xd4')||_0x44992a==='ACCEPTD'){return _0x4e958b[_0x4417('0x33')]({'read':!![]});}else{logger[_0x4417('0x23')](_0x4417('0x21'),_0x4417('0x29'),_0x4417('0x90'),util[_0x4417('0xc7')](_0x411c73[_0x4417('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x4e958b;}})['then'](respondWithResult(_0x5649ae,null))[_0x4417('0x27')](handleError(_0x5649ae,null));};exports[_0x4417('0xd5')]=function(_0x2a531f,_0x27cfaa,_0x1df02a){var _0x57b5f2,_0xa3d140,_0x52a1cb;return db[_0x4417('0x3d')][_0x4417('0x54')]({'where':{'id':_0x2a531f[_0x4417('0x5c')]['id']}})['then'](handleEntityNotFound(_0x27cfaa,null))[_0x4417('0x1e')](function(_0x2fb97f){if(_0x2fb97f){_0x52a1cb=_0x2fb97f;logger[_0x4417('0x20')](_0x4417('0x21'),_0x4417('0x29'),_0x4417('0xc6'),_0x2fb97f['type'],util[_0x4417('0xc7')](_0x2a531f['query'],{'showHidden':![],'depth':null}));switch(_0x2fb97f[_0x4417('0x4c')]){case'csc':if(_0x2a531f[_0x4417('0x40')]['message-id']&&_0x2a531f['query']['state']){_0xa3d140=_0x2a531f[_0x4417('0x40')]['state'];return db['SmsMessage'][_0x4417('0x54')]({'where':{'messageId':_0x2a531f[_0x4417('0x40')][_0x4417('0xd6')]}});}break;}}})[_0x4417('0x1e')](handleEntityNotFound(_0x27cfaa,null))[_0x4417('0x1e')](function(_0x326878){if(_0x326878){_0x57b5f2=_0x326878;switch(_0x52a1cb[_0x4417('0x4c')]){case'csc':if(_0xa3d140==='2'||_0xa3d140==='6'){return _0x57b5f2[_0x4417('0x33')]({'read':!![]});}else{logger[_0x4417('0x23')](_0x4417('0x21'),_0x4417('0x29'),_0x4417('0x8c'),util['inspect'](_0x2a531f['query'],{'showHidden':![],'depth':null}));};break;}return _0x57b5f2;}})[_0x4417('0x1e')](respondWithResult(_0x27cfaa,null))[_0x4417('0x27')](handleError(_0x27cfaa,null));};exports[_0x4417('0xd7')]=function(_0x3e2ad8,_0x243ecb,_0x5a1831){return db['SmsAccount'][_0x4417('0x54')]({'where':{'id':_0x3e2ad8[_0x4417('0x5c')]['id']}})['then'](handleEntityNotFound(_0x243ecb,null))['then'](function(_0x3b3ded){if(_0x3b3ded){return _0x3b3ded[_0x4417('0xd7')](_0x3e2ad8['body'][_0x4417('0x69')],_['omit'](_0x3e2ad8[_0x4417('0x56')],[_0x4417('0x69'),'id'])||{})[_0x4417('0xc4')](function(_0xd9e184){for(var _0x489f69=0x0;_0x489f69<_0x3e2ad8[_0x4417('0x56')][_0x4417('0x69')][_0x4417('0x46')];_0x489f69+=0x1){socket[_0x4417('0xd8')](_0x4417('0xd9'),{'UserId':Number(_0x3e2ad8['body'][_0x4417('0x69')][_0x489f69]),'SmsAccountId':Number(_0x3e2ad8[_0x4417('0x5c')]['id'])});}return _0xd9e184;});}})[_0x4417('0x1e')](respondWithResult(_0x243ecb,null))[_0x4417('0x27')](handleError(_0x243ecb,null));};exports[_0x4417('0xda')]=function(_0x2116a0,_0x5f0976,_0x420c0e){return db[_0x4417('0x3d')][_0x4417('0x54')]({'where':{'id':_0x2116a0[_0x4417('0x5c')]['id']}})[_0x4417('0x1e')](handleEntityNotFound(_0x5f0976,null))['then'](function(_0x5176a2){if(_0x5176a2){return _0x5176a2[_0x4417('0xda')](_0x2116a0[_0x4417('0x40')][_0x4417('0x69')])[_0x4417('0x1e')](function(){if(_[_0x4417('0xdb')](_0x2116a0[_0x4417('0x40')][_0x4417('0x69')])){for(var _0xf6e08a=0x0;_0xf6e08a<_0x2116a0[_0x4417('0x40')][_0x4417('0x69')][_0x4417('0x46')];_0xf6e08a+=0x1){socket[_0x4417('0xd8')]('userSmsAccount:remove',{'UserId':Number(_0x2116a0[_0x4417('0x40')][_0x4417('0x69')][_0xf6e08a]),'SmsAccountId':Number(_0x2116a0[_0x4417('0x5c')]['id'])});}}else{socket[_0x4417('0xd8')]('userSmsAccount:remove',{'UserId':Number(_0x2116a0[_0x4417('0x40')][_0x4417('0x69')]),'SmsAccountId':Number(_0x2116a0[_0x4417('0x5c')]['id'])});}});}})[_0x4417('0x1e')](respondWithStatusCode(_0x5f0976,null))[_0x4417('0x27')](handleError(_0x5f0976,null));};exports[_0x4417('0xdc')]=function(_0x7cc8a1,_0x395d82,_0x2926b8){var _0x3c58e1={};var _0x536a73={};var _0x14e8ea;var _0x119408;return db[_0x4417('0x3d')]['findOne']({'where':{'id':_0x7cc8a1[_0x4417('0x5c')]['id']}})[_0x4417('0x1e')](handleEntityNotFound(_0x395d82,null))[_0x4417('0x1e')](function(_0x189344){if(_0x189344){_0x14e8ea=_0x189344;_0x536a73[_0x4417('0x3f')]=_[_0x4417('0x41')](db[_0x4417('0xa7')][_0x4417('0x52')]);_0x536a73[_0x4417('0x40')]=_[_0x4417('0x41')](_0x7cc8a1[_0x4417('0x40')]);_0x536a73['filters']=_[_0x4417('0x43')](_0x536a73[_0x4417('0x3f')],_0x536a73[_0x4417('0x40')]);_0x3c58e1[_0x4417('0x44')]=_[_0x4417('0x43')](_0x536a73['model'],qs[_0x4417('0x45')](_0x7cc8a1[_0x4417('0x40')][_0x4417('0x45')]));_0x3c58e1[_0x4417('0x44')]=_0x3c58e1[_0x4417('0x44')][_0x4417('0x46')]?_0x3c58e1[_0x4417('0x44')]:_0x536a73[_0x4417('0x3f')];_0x3c58e1['order']=qs[_0x4417('0x49')](_0x7cc8a1[_0x4417('0x40')][_0x4417('0x49')]);_0x3c58e1[_0x4417('0x4a')]=qs[_0x4417('0x42')](_[_0x4417('0x63')](_0x7cc8a1['query'],_0x536a73[_0x4417('0x42')]));if(_0x7cc8a1[_0x4417('0x40')][_0x4417('0x4b')]){_0x3c58e1['where']=_['merge'](_0x3c58e1[_0x4417('0x4a')],{'$or':_[_0x4417('0x3c')](_0x3c58e1[_0x4417('0x44')],function(_0x4752ad){var _0x12750e={};_0x12750e[_0x4752ad]={'$like':'%'+_0x7cc8a1[_0x4417('0x40')][_0x4417('0x4b')]+'%'};return _0x12750e;})});}_0x3c58e1=_['merge']({},_0x3c58e1,_0x7cc8a1['options']);return _0x14e8ea[_0x4417('0xdc')](_0x3c58e1);}})[_0x4417('0x1e')](function(_0x564e39){if(_0x564e39){_0x119408=_0x564e39[_0x4417('0x46')];if(!_0x7cc8a1[_0x4417('0x40')]['hasOwnProperty'](_0x4417('0x48'))){_0x3c58e1['limit']=qs[_0x4417('0x2e')](_0x7cc8a1[_0x4417('0x40')]['limit']);_0x3c58e1[_0x4417('0x2c')]=qs[_0x4417('0x2c')](_0x7cc8a1[_0x4417('0x40')]['offset']);}return _0x14e8ea[_0x4417('0xdc')](_0x3c58e1);}})[_0x4417('0x1e')](function(_0x1bbb11){if(_0x1bbb11){return _0x1bbb11?{'count':_0x119408,'rows':_0x1bbb11}:null;}})['then'](respondWithResult(_0x395d82,null))[_0x4417('0x27')](handleError(_0x395d82,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 72b4123..29f3d12 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 _0x8f3b=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','SmsAccount'];(function(_0x17e510,_0x583732){var _0x35294e=function(_0x5ca50e){while(--_0x5ca50e){_0x17e510['push'](_0x17e510['shift']());}};_0x35294e(++_0x583732);}(_0x8f3b,0x183));var _0xb8f3=function(_0x1c44b0,_0x476d57){_0x1c44b0=_0x1c44b0-0x0;var _0x39781f=_0x8f3b[_0x1c44b0];return _0x39781f;};'use strict';var EventEmitter=require(_0xb8f3('0x0'));var SmsAccount=require(_0xb8f3('0x1'))['db'][_0xb8f3('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xb8f3('0x3')](0x0);var events={'afterCreate':_0xb8f3('0x4'),'afterUpdate':_0xb8f3('0x5'),'afterDestroy':_0xb8f3('0x6')};function emitEvent(_0x577d15){return function(_0x58ec00,_0x59cc93,_0x39a806){SmsAccountEvents['emit'](_0x577d15+':'+_0x58ec00['id'],_0x58ec00);SmsAccountEvents[_0xb8f3('0x7')](_0x577d15,_0x58ec00);_0x39a806(null);};}for(var e in events){if(events[_0xb8f3('0x8')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xb8f3('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xe979=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x330b29,_0x4cd053){var _0x392bcf=function(_0x5e95e7){while(--_0x5e95e7){_0x330b29['push'](_0x330b29['shift']());}};_0x392bcf(++_0x4cd053);}(_0xe979,0x1e6));var _0x9e97=function(_0x2ff9a2,_0x547286){_0x2ff9a2=_0x2ff9a2-0x0;var _0x131670=_0xe979[_0x2ff9a2];return _0x131670;};'use strict';var EventEmitter=require(_0x9e97('0x0'));var SmsAccount=require(_0x9e97('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x9e97('0x2')](0x0);var events={'afterCreate':_0x9e97('0x3'),'afterUpdate':_0x9e97('0x4'),'afterDestroy':_0x9e97('0x5')};function emitEvent(_0x6e5976){return function(_0x1a2a2e,_0x18ec88,_0x270008){SmsAccountEvents[_0x9e97('0x6')](_0x6e5976+':'+_0x1a2a2e['id'],_0x1a2a2e);SmsAccountEvents['emit'](_0x6e5976,_0x1a2a2e);_0x270008(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x9e97('0x7')](e,emitEvent(event));}}module[_0x9e97('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 8592e67..1a3d684 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 _0xbc0c=['path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','api','moment','bluebird'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbc0c,0xeb));var _0xcbc0=function(_0x123a54,_0x449d1d){_0x123a54=_0x123a54-0x0;var _0x4711ec=_0xbc0c[_0x123a54];return _0x4711ec;};'use strict';var _=require(_0xcbc0('0x0'));var util=require(_0xcbc0('0x1'));var logger=require('../../config/logger')(_0xcbc0('0x2'));var moment=require(_0xcbc0('0x3'));var BPromise=require(_0xcbc0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcbc0('0x5'));var rimraf=require(_0xcbc0('0x6'));var config=require(_0xcbc0('0x7'));var attributes=require(_0xcbc0('0x8'));module[_0xcbc0('0x9')]=function(_0x3a04a3,_0x5131d8){return _0x3a04a3[_0xcbc0('0xa')](_0xcbc0('0xb'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0122=['./smsAccount.attributes','exports','define','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x435716,_0x20bb7f){var _0x591bcc=function(_0x5099c1){while(--_0x5099c1){_0x435716['push'](_0x435716['shift']());}};_0x591bcc(++_0x20bb7f);}(_0x0122,0x19d));var _0x2012=function(_0x1709a6,_0x3b2599){_0x1709a6=_0x1709a6-0x0;var _0x1fedcc=_0x0122[_0x1709a6];return _0x1fedcc;};'use strict';var _=require(_0x2012('0x0'));var util=require(_0x2012('0x1'));var logger=require('../../config/logger')(_0x2012('0x2'));var moment=require(_0x2012('0x3'));var BPromise=require(_0x2012('0x4'));var rp=require(_0x2012('0x5'));var fs=require('fs');var path=require(_0x2012('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2012('0x7'));module[_0x2012('0x8')]=function(_0xebc02c,_0x21796d){return _0xebc02c[_0x2012('0x9')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index e04b673..e03c5ef 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 _0x481b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSmsAccount','find','options','raw','attributes','include','map','model','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x574bc6,_0x3a4ef1){var _0x145779=function(_0x27adb1){while(--_0x27adb1){_0x574bc6['push'](_0x574bc6['shift']());}};_0x145779(++_0x3a4ef1);}(_0x481b,0x8d));var _0xb481=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x481b[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xb481('0x0'));var util=require(_0xb481('0x1'));var moment=require(_0xb481('0x2'));var BPromise=require(_0xb481('0x3'));var rs=require(_0xb481('0x4'));var fs=require('fs');var Redis=require(_0xb481('0x5'));var db=require(_0xb481('0x6'))['db'];var utils=require(_0xb481('0x7'));var logger=require(_0xb481('0x8'))(_0xb481('0x9'));var config=require(_0xb481('0xa'));var jayson=require(_0xb481('0xb'));var client=jayson[_0xb481('0xc')]['http']({'port':0x232a});config[_0xb481('0xd')]=_[_0xb481('0xe')](config[_0xb481('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xb481('0xf'))(new Redis(config[_0xb481('0xd')]));require('./smsAccount.socket')[_0xb481('0x10')](socket);function respondWithRpcPromise(_0x248c4e,_0x220fc7,_0x2ab579){return new BPromise(function(_0x33f2cc,_0x4ce520){return client[_0xb481('0x11')](_0x248c4e,_0x2ab579)[_0xb481('0x12')](function(_0x175159){logger['info'](_0xb481('0x13'),_0x220fc7,'request\x20sent');logger[_0xb481('0x14')](_0xb481('0x15'),_0x220fc7,_0xb481('0x16'),JSON['stringify'](_0x175159));if(_0x175159[_0xb481('0x17')]){if(_0x175159['error'][_0xb481('0x18')]===0x1f4){logger['error'](_0xb481('0x13'),_0x220fc7,_0x175159[_0xb481('0x17')][_0xb481('0x19')]);return _0x4ce520(_0x175159[_0xb481('0x17')]['message']);}logger[_0xb481('0x17')](_0xb481('0x13'),_0x220fc7,_0x175159[_0xb481('0x17')][_0xb481('0x19')]);return _0x33f2cc(_0x175159[_0xb481('0x17')][_0xb481('0x19')]);}else{logger['info'](_0xb481('0x13'),_0x220fc7,_0xb481('0x16'));_0x33f2cc(_0x175159[_0xb481('0x1a')]['message']);}})[_0xb481('0x1b')](function(_0x5e4aa4){logger[_0xb481('0x17')](_0xb481('0x13'),_0x220fc7,_0x5e4aa4);_0x4ce520(_0x5e4aa4);});});}exports[_0xb481('0x1c')]=function(_0x24e98f){var _0x31acd2=this;return new Promise(function(_0x150070,_0x4bd8e9){return db['SmsAccount'][_0xb481('0x1d')]({'raw':_0x24e98f[_0xb481('0x1e')]?_0x24e98f[_0xb481('0x1e')][_0xb481('0x1f')]===undefined?!![]:![]:!![],'where':_0x24e98f[_0xb481('0x1e')]?_0x24e98f[_0xb481('0x1e')]['where']||null:null,'attributes':_0x24e98f[_0xb481('0x1e')]?_0x24e98f[_0xb481('0x1e')][_0xb481('0x20')]||null:null,'include':_0x24e98f[_0xb481('0x1e')]?_0x24e98f[_0xb481('0x1e')][_0xb481('0x21')]?_[_0xb481('0x22')](_0x24e98f[_0xb481('0x1e')][_0xb481('0x21')],function(_0x18ce74){return{'model':db[_0x18ce74['model']],'as':_0x18ce74['as'],'attributes':_0x18ce74[_0xb481('0x20')],'include':_0x18ce74[_0xb481('0x21')]?_[_0xb481('0x22')](_0x18ce74[_0xb481('0x21')],function(_0x76f70e){return{'model':db[_0x76f70e[_0xb481('0x23')]],'as':_0x76f70e['as'],'attributes':_0x76f70e['attributes'],'include':_0x76f70e['include']?_[_0xb481('0x22')](_0x76f70e[_0xb481('0x21')],function(_0x257517){return{'model':db[_0x257517[_0xb481('0x23')]],'as':_0x257517['as'],'attributes':_0x257517[_0xb481('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb481('0x12')](function(_0x32f0ad){logger[_0xb481('0x24')](_0xb481('0x1c'),_0x24e98f);logger[_0xb481('0x14')]('ShowSmsAccount',_0x24e98f,JSON['stringify'](_0x32f0ad));_0x150070(_0x32f0ad);})[_0xb481('0x1b')](function(_0x2f5619){logger[_0xb481('0x17')](_0xb481('0x1c'),_0x2f5619['message'],_0x24e98f);_0x4bd8e9(_0x31acd2['error'](0x1f4,_0x2f5619[_0xb481('0x19')]));});});}; \ No newline at end of file +var _0xf85c=['../../config/environment','http','redis','defaults','localhost','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','SmsAccount','find','options','raw','where','attributes','include','map','model','ShowSmsAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x4f2023,_0x3cfb01){var _0x58e5f8=function(_0x55919b){while(--_0x55919b){_0x4f2023['push'](_0x4f2023['shift']());}};_0x58e5f8(++_0x3cfb01);}(_0xf85c,0x184));var _0xcf85=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xf85c[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0xcf85('0x0'));var util=require(_0xcf85('0x1'));var moment=require(_0xcf85('0x2'));var BPromise=require(_0xcf85('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf85('0x4'));var db=require(_0xcf85('0x5'))['db'];var utils=require(_0xcf85('0x6'));var logger=require('../../config/logger')(_0xcf85('0x7'));var config=require(_0xcf85('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcf85('0x9')]({'port':0x232a});config[_0xcf85('0xa')]=_[_0xcf85('0xb')](config[_0xcf85('0xa')],{'host':_0xcf85('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcf85('0xa')]));require(_0xcf85('0xd'))[_0xcf85('0xe')](socket);function respondWithRpcPromise(_0x5ae217,_0x2a4c84,_0x287510){return new BPromise(function(_0xf06128,_0x433fd3){return client[_0xcf85('0xf')](_0x5ae217,_0x287510)[_0xcf85('0x10')](function(_0xe4a77c){logger[_0xcf85('0x11')](_0xcf85('0x12'),_0x2a4c84,_0xcf85('0x13'));logger[_0xcf85('0x14')](_0xcf85('0x15'),_0x2a4c84,_0xcf85('0x13'),JSON[_0xcf85('0x16')](_0xe4a77c));if(_0xe4a77c[_0xcf85('0x17')]){if(_0xe4a77c[_0xcf85('0x17')]['code']===0x1f4){logger[_0xcf85('0x17')]('SmsAccount,\x20%s,\x20%s',_0x2a4c84,_0xe4a77c[_0xcf85('0x17')]['message']);return _0x433fd3(_0xe4a77c['error'][_0xcf85('0x18')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x2a4c84,_0xe4a77c['error']['message']);return _0xf06128(_0xe4a77c[_0xcf85('0x17')][_0xcf85('0x18')]);}else{logger[_0xcf85('0x11')]('SmsAccount,\x20%s,\x20%s',_0x2a4c84,_0xcf85('0x13'));_0xf06128(_0xe4a77c['result'][_0xcf85('0x18')]);}})[_0xcf85('0x19')](function(_0x26a59a){logger[_0xcf85('0x17')](_0xcf85('0x12'),_0x2a4c84,_0x26a59a);_0x433fd3(_0x26a59a);});});}exports['ShowSmsAccount']=function(_0x2878bf){var _0x4ceb3c=this;return new Promise(function(_0x84a7b4,_0x187b49){return db[_0xcf85('0x1a')][_0xcf85('0x1b')]({'raw':_0x2878bf[_0xcf85('0x1c')]?_0x2878bf[_0xcf85('0x1c')][_0xcf85('0x1d')]===undefined?!![]:![]:!![],'where':_0x2878bf[_0xcf85('0x1c')]?_0x2878bf[_0xcf85('0x1c')][_0xcf85('0x1e')]||null:null,'attributes':_0x2878bf[_0xcf85('0x1c')]?_0x2878bf[_0xcf85('0x1c')][_0xcf85('0x1f')]||null:null,'include':_0x2878bf['options']?_0x2878bf[_0xcf85('0x1c')][_0xcf85('0x20')]?_['map'](_0x2878bf['options']['include'],function(_0x453bed){return{'model':db[_0x453bed['model']],'as':_0x453bed['as'],'attributes':_0x453bed[_0xcf85('0x1f')],'include':_0x453bed[_0xcf85('0x20')]?_[_0xcf85('0x21')](_0x453bed[_0xcf85('0x20')],function(_0x466c8f){return{'model':db[_0x466c8f[_0xcf85('0x22')]],'as':_0x466c8f['as'],'attributes':_0x466c8f[_0xcf85('0x1f')],'include':_0x466c8f[_0xcf85('0x20')]?_[_0xcf85('0x21')](_0x466c8f[_0xcf85('0x20')],function(_0x13ca37){return{'model':db[_0x13ca37['model']],'as':_0x13ca37['as'],'attributes':_0x13ca37['attributes']};}):[]};}):[]};}):[]:[]})[_0xcf85('0x10')](function(_0x46c1ba){logger[_0xcf85('0x11')]('ShowSmsAccount',_0x2878bf);logger[_0xcf85('0x14')](_0xcf85('0x23'),_0x2878bf,JSON[_0xcf85('0x16')](_0x46c1ba));_0x84a7b4(_0x46c1ba);})[_0xcf85('0x19')](function(_0x19e9c7){logger[_0xcf85('0x17')](_0xcf85('0x23'),_0x19e9c7[_0xcf85('0x18')],_0x2878bf);_0x187b49(_0x4ceb3c[_0xcf85('0x17')](0x1f4,_0x19e9c7['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0aa7872..cd6171d 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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 602d947..cd6f729 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 _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x35235f,_0x58bc88){var _0x2f273f=function(_0x4c5d11){while(--_0x4c5d11){_0x35235f['push'](_0x35235f['shift']());}};_0x2f273f(++_0x58bc88);}(_0x008c,0x188));var _0xc008=function(_0x2447cf,_0x969bb3){_0x2447cf=_0x2447cf-0x0;var _0x449b2a=_0x008c[_0x2447cf];return _0x449b2a;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +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(_0x1fd19b,_0x228bea){var _0x2228f4=function(_0x1af7f2){while(--_0x1af7f2){_0x1fd19b['push'](_0x1fd19b['shift']());}};_0x2228f4(++_0x228bea);}(_0x7217,0x19e));var _0x7721=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x7217[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0xd')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0xf')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router[_0x7721('0x10')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 88dd2e9..32131d9 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 _0xa15e=['STRING','noop','*,*,*,*','exports','INTEGER'];(function(_0x287af1,_0x41ca22){var _0x400219=function(_0x442632){while(--_0x442632){_0x287af1['push'](_0x287af1['shift']());}};_0x400219(++_0x41ca22);}(_0xa15e,0xe9));var _0xea15=function(_0x5d48ec,_0x3fc88a){_0x5d48ec=_0x5d48ec-0x0;var _0x4f8e42=_0xa15e[_0x5d48ec];return _0x4f8e42;};'use strict';var Sequelize=require('sequelize');module[_0xea15('0x0')]={'priority':{'type':Sequelize[_0xea15('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xea15('0x2')],'allowNull':![],'defaultValue':_0xea15('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xea15('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xea15('0x4')}}; \ No newline at end of file +var _0x9828=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x2ca625,_0x382f1e){var _0x466b71=function(_0x2e6f4b){while(--_0x2e6f4b){_0x2ca625['push'](_0x2ca625['shift']());}};_0x466b71(++_0x382f1e);}(_0x9828,0xfd));var _0x8982=function(_0x209478,_0x154020){_0x209478=_0x209478-0x0;var _0x2a2a43=_0x9828[_0x209478];return _0x2a2a43;};'use strict';var Sequelize=require(_0x8982('0x0'));module[_0x8982('0x1')]={'priority':{'type':Sequelize[_0x8982('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8982('0x3')],'allowNull':![],'defaultValue':_0x8982('0x4')},'appdata':{'type':Sequelize[_0x8982('0x5')]()},'description':{'type':Sequelize[_0x8982('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8982('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 4997ea7..ad758bd 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 _0x19f2=['ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','SmsApplication','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x19f2,0x1b7));var _0x219f=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x19f2[_0x3054be];return _0x3df150;};'use strict';var emlformat=require(_0x219f('0x0'));var rimraf=require(_0x219f('0x1'));var zipdir=require(_0x219f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x219f('0x3'));var moment=require(_0x219f('0x4'));var BPromise=require(_0x219f('0x5'));var Mustache=require(_0x219f('0x6'));var util=require(_0x219f('0x7'));var path=require(_0x219f('0x8'));var sox=require(_0x219f('0x9'));var csv=require(_0x219f('0xa'));var ejs=require(_0x219f('0xb'));var fs=require('fs');var fs_extra=require(_0x219f('0xc'));var _=require(_0x219f('0xd'));var squel=require(_0x219f('0xe'));var crypto=require('crypto');var jsforce=require(_0x219f('0xf'));var deskjs=require(_0x219f('0x10'));var toCsv=require(_0x219f('0xa'));var querystring=require(_0x219f('0x11'));var Papa=require(_0x219f('0x12'));var Redis=require('ioredis');var authService=require(_0x219f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x219f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x219f('0x15'));var utils=require(_0x219f('0x16'));var config=require(_0x219f('0x17'));var licenseUtil=require(_0x219f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31d8f1,_0x51ad25){_0x51ad25=_0x51ad25||0xcc;return function(_0x4050d3){if(_0x4050d3){return _0x31d8f1[_0x219f('0x19')](_0x51ad25);}return _0x31d8f1[_0x219f('0x1a')](_0x51ad25)[_0x219f('0x1b')]();};}function respondWithResult(_0x57110f,_0x2e6a36){_0x2e6a36=_0x2e6a36||0xc8;return function(_0x2bc723){if(_0x2bc723){return _0x57110f[_0x219f('0x1a')](_0x2e6a36)['json'](_0x2bc723);}};}function respondWithFilteredResult(_0x65a568,_0x47d754){return function(_0x4a74e1){if(_0x4a74e1){var _0x20fce6=typeof _0x47d754[_0x219f('0x1c')]===_0x219f('0x1d')&&typeof _0x47d754[_0x219f('0x1e')]===_0x219f('0x1d');var _0x314c9a=_0x4a74e1[_0x219f('0x1f')];var _0x3287bf=_0x20fce6?0x0:_0x47d754[_0x219f('0x1c')];var _0x5aeeaa=_0x20fce6?_0x4a74e1[_0x219f('0x1f')]:_0x47d754[_0x219f('0x1c')]+_0x47d754['limit'];var _0x342645;if(_0x5aeeaa>=_0x314c9a){_0x5aeeaa=_0x314c9a;_0x342645=0xc8;}else{_0x342645=0xce;}_0x65a568[_0x219f('0x1a')](_0x342645);return _0x65a568[_0x219f('0x20')](_0x219f('0x21'),_0x3287bf+'-'+_0x5aeeaa+'/'+_0x314c9a)[_0x219f('0x22')](_0x4a74e1);}return null;};}function patchUpdates(_0x597923){return function(_0x4b88b8){try{jsonpatch[_0x219f('0x23')](_0x4b88b8,_0x597923,!![]);}catch(_0x316bd5){return BPromise[_0x219f('0x24')](_0x316bd5);}return _0x4b88b8[_0x219f('0x25')]();};}function saveUpdates(_0x2fe493,_0x3b11f5){return function(_0x2e61af){if(_0x2e61af){return _0x2e61af[_0x219f('0x26')](_0x2fe493)[_0x219f('0x27')](function(_0x5ed9a2){return _0x5ed9a2;});}return null;};}function removeEntity(_0x25bb01,_0xb33988){return function(_0x45c744){if(_0x45c744){return _0x45c744['destroy']()[_0x219f('0x27')](function(){_0x25bb01[_0x219f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38a85e,_0x318228){return function(_0x543615){if(!_0x543615){_0x38a85e[_0x219f('0x19')](0x194);}return _0x543615;};}function handleError(_0x17931c,_0x39473e){_0x39473e=_0x39473e||0x1f4;return function(_0x15f9e8){logger[_0x219f('0x28')](_0x15f9e8[_0x219f('0x29')]);if(_0x15f9e8[_0x219f('0x2a')]){delete _0x15f9e8[_0x219f('0x2a')];}_0x17931c['status'](_0x39473e)['send'](_0x15f9e8);};}exports[_0x219f('0x2b')]=function(_0x5f29bf,_0x3aa375){var _0x40f6b4={},_0xb44b02={},_0xc69626={'count':0x0,'rows':[]};var _0x23c00c=_[_0x219f('0x2c')](db[_0x219f('0x2d')][_0x219f('0x2e')],function(_0x39140b){return{'name':_0x39140b[_0x219f('0x2f')],'type':_0x39140b[_0x219f('0x30')]['key']};});_0xb44b02[_0x219f('0x31')]=_['map'](_0x23c00c,_0x219f('0x2a'));_0xb44b02[_0x219f('0x32')]=_['keys'](_0x5f29bf[_0x219f('0x32')]);_0xb44b02['filters']=_[_0x219f('0x33')](_0xb44b02[_0x219f('0x31')],_0xb44b02[_0x219f('0x32')]);_0x40f6b4['attributes']=_['intersection'](_0xb44b02['model'],qs[_0x219f('0x34')](_0x5f29bf[_0x219f('0x32')]['fields']));_0x40f6b4[_0x219f('0x35')]=_0x40f6b4[_0x219f('0x35')][_0x219f('0x36')]?_0x40f6b4['attributes']:_0xb44b02['model'];if(!_0x5f29bf['query'][_0x219f('0x37')](_0x219f('0x38'))){_0x40f6b4[_0x219f('0x1e')]=qs['limit'](_0x5f29bf[_0x219f('0x32')][_0x219f('0x1e')]);_0x40f6b4[_0x219f('0x1c')]=qs['offset'](_0x5f29bf[_0x219f('0x32')][_0x219f('0x1c')]);}_0x40f6b4[_0x219f('0x39')]=qs[_0x219f('0x3a')](_0x5f29bf[_0x219f('0x32')][_0x219f('0x3a')]);_0x40f6b4[_0x219f('0x3b')]=qs['filters'](_['pick'](_0x5f29bf[_0x219f('0x32')],_0xb44b02[_0x219f('0x3c')]),_0x23c00c);if(_0x5f29bf[_0x219f('0x32')][_0x219f('0x3d')]){_0x40f6b4['where']=_[_0x219f('0x3e')](_0x40f6b4['where'],{'$or':_[_0x219f('0x2c')](_0x23c00c,function(_0x18ecc1){if(_0x18ecc1[_0x219f('0x30')]!=='VIRTUAL'){var _0x27cd62={};_0x27cd62[_0x18ecc1[_0x219f('0x2a')]]={'$like':'%'+_0x5f29bf[_0x219f('0x32')][_0x219f('0x3d')]+'%'};return _0x27cd62;}})});}_0x40f6b4=_[_0x219f('0x3e')]({},_0x40f6b4,_0x5f29bf[_0x219f('0x3f')]);var _0x3a0fc6={'where':_0x40f6b4[_0x219f('0x3b')]};return db[_0x219f('0x2d')][_0x219f('0x1f')](_0x3a0fc6)[_0x219f('0x27')](function(_0x4c8022){_0xc69626['count']=_0x4c8022;if(_0x5f29bf[_0x219f('0x32')][_0x219f('0x40')]){_0x40f6b4[_0x219f('0x41')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x40f6b4);})[_0x219f('0x27')](function(_0x374615){_0xc69626[_0x219f('0x42')]=_0x374615;return _0xc69626;})[_0x219f('0x27')](respondWithFilteredResult(_0x3aa375,_0x40f6b4))[_0x219f('0x43')](handleError(_0x3aa375,null));};exports[_0x219f('0x44')]=function(_0x102706,_0x2d5032){var _0x3960d3={'raw':!![],'where':{'id':_0x102706[_0x219f('0x45')]['id']}},_0x148e73={};_0x148e73[_0x219f('0x31')]=_[_0x219f('0x46')](db[_0x219f('0x2d')][_0x219f('0x2e')]);_0x148e73['query']=_[_0x219f('0x46')](_0x102706[_0x219f('0x32')]);_0x148e73[_0x219f('0x3c')]=_['intersection'](_0x148e73['model'],_0x148e73[_0x219f('0x32')]);_0x3960d3['attributes']=_[_0x219f('0x33')](_0x148e73[_0x219f('0x31')],qs[_0x219f('0x34')](_0x102706[_0x219f('0x32')][_0x219f('0x34')]));_0x3960d3[_0x219f('0x35')]=_0x3960d3[_0x219f('0x35')][_0x219f('0x36')]?_0x3960d3[_0x219f('0x35')]:_0x148e73[_0x219f('0x31')];if(_0x102706[_0x219f('0x32')][_0x219f('0x40')]){_0x3960d3[_0x219f('0x41')]=[{'all':!![]}];}_0x3960d3=_[_0x219f('0x3e')]({},_0x3960d3,_0x102706[_0x219f('0x3f')]);return db[_0x219f('0x2d')]['find'](_0x3960d3)['then'](handleEntityNotFound(_0x2d5032,null))[_0x219f('0x27')](respondWithResult(_0x2d5032,null))[_0x219f('0x43')](handleError(_0x2d5032,null));};exports[_0x219f('0x47')]=function(_0x128373,_0x11aec6){return db[_0x219f('0x2d')][_0x219f('0x47')](_0x128373[_0x219f('0x48')],{})[_0x219f('0x27')](respondWithResult(_0x11aec6,0xc9))[_0x219f('0x43')](handleError(_0x11aec6,null));};exports[_0x219f('0x26')]=function(_0x2ed898,_0x11997e){if(_0x2ed898[_0x219f('0x48')]['id']){delete _0x2ed898[_0x219f('0x48')]['id'];}return db[_0x219f('0x2d')][_0x219f('0x49')]({'where':{'id':_0x2ed898[_0x219f('0x45')]['id']}})[_0x219f('0x27')](handleEntityNotFound(_0x11997e,null))['then'](saveUpdates(_0x2ed898['body'],null))[_0x219f('0x27')](respondWithResult(_0x11997e,null))[_0x219f('0x43')](handleError(_0x11997e,null));};exports[_0x219f('0x4a')]=function(_0x3824c2,_0x549b6f){return db[_0x219f('0x2d')][_0x219f('0x49')]({'where':{'id':_0x3824c2[_0x219f('0x45')]['id']}})['then'](handleEntityNotFound(_0x549b6f,null))[_0x219f('0x27')](removeEntity(_0x549b6f,null))[_0x219f('0x43')](handleError(_0x549b6f,null));}; \ No newline at end of file +var _0x648b=['length','hasOwnProperty','nolimit','order','where','filters','filter','SmsApplication','includeAll','include','catch','merge','options','find','create','params','destroy','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields'];(function(_0x318984,_0x15b82f){var _0x19650a=function(_0x5c5b5a){while(--_0x5c5b5a){_0x318984['push'](_0x318984['shift']());}};_0x19650a(++_0x15b82f);}(_0x648b,0x1af));var _0xb648=function(_0x4cad10,_0x11d696){_0x4cad10=_0x4cad10-0x0;var _0x55a2bd=_0x648b[_0x4cad10];return _0x55a2bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb648('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb648('0x1'));var rp=require('request-promise');var moment=require(_0xb648('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb648('0x3'));var util=require(_0xb648('0x4'));var path=require(_0xb648('0x5'));var sox=require(_0xb648('0x6'));var csv=require(_0xb648('0x7'));var ejs=require(_0xb648('0x8'));var fs=require('fs');var fs_extra=require(_0xb648('0x9'));var _=require('lodash');var squel=require(_0xb648('0xa'));var crypto=require(_0xb648('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb648('0xc'));var toCsv=require(_0xb648('0x7'));var querystring=require(_0xb648('0xd'));var Papa=require(_0xb648('0xe'));var Redis=require(_0xb648('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb648('0x10'));var as=require(_0xb648('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb648('0x12'))(_0xb648('0x13'));var utils=require(_0xb648('0x14'));var config=require(_0xb648('0x15'));var licenseUtil=require(_0xb648('0x16'));var db=require(_0xb648('0x17'))['db'];function respondWithStatusCode(_0x1d49ff,_0x5c3d80){_0x5c3d80=_0x5c3d80||0xcc;return function(_0x3436da){if(_0x3436da){return _0x1d49ff[_0xb648('0x18')](_0x5c3d80);}return _0x1d49ff['status'](_0x5c3d80)[_0xb648('0x19')]();};}function respondWithResult(_0x4a283a,_0x1a0798){_0x1a0798=_0x1a0798||0xc8;return function(_0x1f3a90){if(_0x1f3a90){return _0x4a283a[_0xb648('0x1a')](_0x1a0798)['json'](_0x1f3a90);}};}function respondWithFilteredResult(_0x1cd91b,_0x235491){return function(_0x3bc1a1){if(_0x3bc1a1){var _0x5688bd=typeof _0x235491[_0xb648('0x1b')]===_0xb648('0x1c')&&typeof _0x235491[_0xb648('0x1d')]===_0xb648('0x1c');var _0x299ac5=_0x3bc1a1['count'];var _0x1e7baa=_0x5688bd?0x0:_0x235491[_0xb648('0x1b')];var _0x36a79b=_0x5688bd?_0x3bc1a1[_0xb648('0x1e')]:_0x235491['offset']+_0x235491['limit'];var _0x155cbe;if(_0x36a79b>=_0x299ac5){_0x36a79b=_0x299ac5;_0x155cbe=0xc8;}else{_0x155cbe=0xce;}_0x1cd91b[_0xb648('0x1a')](_0x155cbe);return _0x1cd91b[_0xb648('0x1f')](_0xb648('0x20'),_0x1e7baa+'-'+_0x36a79b+'/'+_0x299ac5)['json'](_0x3bc1a1);}return null;};}function patchUpdates(_0x7b8687){return function(_0x43d2a9){try{jsonpatch[_0xb648('0x21')](_0x43d2a9,_0x7b8687,!![]);}catch(_0x103bc9){return BPromise['reject'](_0x103bc9);}return _0x43d2a9[_0xb648('0x22')]();};}function saveUpdates(_0x50be7e,_0x1988a5){return function(_0x59856f){if(_0x59856f){return _0x59856f[_0xb648('0x23')](_0x50be7e)[_0xb648('0x24')](function(_0x52d8a5){return _0x52d8a5;});}return null;};}function removeEntity(_0x4d4002,_0x55b8be){return function(_0x4dda20){if(_0x4dda20){return _0x4dda20['destroy']()[_0xb648('0x24')](function(){_0x4d4002[_0xb648('0x1a')](0xcc)[_0xb648('0x19')]();});}};}function handleEntityNotFound(_0x152426,_0x1dcc51){return function(_0x38e9b4){if(!_0x38e9b4){_0x152426[_0xb648('0x18')](0x194);}return _0x38e9b4;};}function handleError(_0x521144,_0x33b50a){_0x33b50a=_0x33b50a||0x1f4;return function(_0x376d8b){logger[_0xb648('0x25')](_0x376d8b[_0xb648('0x26')]);if(_0x376d8b[_0xb648('0x27')]){delete _0x376d8b[_0xb648('0x27')];}_0x521144[_0xb648('0x1a')](_0x33b50a)[_0xb648('0x28')](_0x376d8b);};}exports['index']=function(_0x412daf,_0x18f1fc){var _0x44114f={},_0x5e4de3={},_0x1ed8e1={'count':0x0,'rows':[]};var _0x290076=_[_0xb648('0x29')](db['SmsApplication'][_0xb648('0x2a')],function(_0x3295c8){return{'name':_0x3295c8[_0xb648('0x2b')],'type':_0x3295c8[_0xb648('0x2c')][_0xb648('0x2d')]};});_0x5e4de3[_0xb648('0x2e')]=_[_0xb648('0x29')](_0x290076,_0xb648('0x27'));_0x5e4de3['query']=_[_0xb648('0x2f')](_0x412daf[_0xb648('0x30')]);_0x5e4de3['filters']=_[_0xb648('0x31')](_0x5e4de3[_0xb648('0x2e')],_0x5e4de3[_0xb648('0x30')]);_0x44114f[_0xb648('0x32')]=_[_0xb648('0x31')](_0x5e4de3[_0xb648('0x2e')],qs[_0xb648('0x33')](_0x412daf[_0xb648('0x30')][_0xb648('0x33')]));_0x44114f['attributes']=_0x44114f[_0xb648('0x32')][_0xb648('0x34')]?_0x44114f[_0xb648('0x32')]:_0x5e4de3[_0xb648('0x2e')];if(!_0x412daf['query'][_0xb648('0x35')](_0xb648('0x36'))){_0x44114f['limit']=qs[_0xb648('0x1d')](_0x412daf['query']['limit']);_0x44114f[_0xb648('0x1b')]=qs[_0xb648('0x1b')](_0x412daf[_0xb648('0x30')][_0xb648('0x1b')]);}_0x44114f[_0xb648('0x37')]=qs['sort'](_0x412daf[_0xb648('0x30')]['sort']);_0x44114f[_0xb648('0x38')]=qs[_0xb648('0x39')](_['pick'](_0x412daf[_0xb648('0x30')],_0x5e4de3[_0xb648('0x39')]),_0x290076);if(_0x412daf['query']['filter']){_0x44114f[_0xb648('0x38')]=_['merge'](_0x44114f[_0xb648('0x38')],{'$or':_[_0xb648('0x29')](_0x290076,function(_0x46a7a2){if(_0x46a7a2[_0xb648('0x2c')]!=='VIRTUAL'){var _0x430f92={};_0x430f92[_0x46a7a2[_0xb648('0x27')]]={'$like':'%'+_0x412daf['query'][_0xb648('0x3a')]+'%'};return _0x430f92;}})});}_0x44114f=_['merge']({},_0x44114f,_0x412daf['options']);var _0x56a8b9={'where':_0x44114f['where']};return db[_0xb648('0x3b')][_0xb648('0x1e')](_0x56a8b9)[_0xb648('0x24')](function(_0x25800f){_0x1ed8e1[_0xb648('0x1e')]=_0x25800f;if(_0x412daf[_0xb648('0x30')][_0xb648('0x3c')]){_0x44114f[_0xb648('0x3d')]=[{'all':!![]}];}return db[_0xb648('0x3b')]['findAll'](_0x44114f);})['then'](function(_0x988295){_0x1ed8e1['rows']=_0x988295;return _0x1ed8e1;})['then'](respondWithFilteredResult(_0x18f1fc,_0x44114f))[_0xb648('0x3e')](handleError(_0x18f1fc,null));};exports['show']=function(_0x17dc97,_0x4ecb19){var _0x57adcc={'raw':!![],'where':{'id':_0x17dc97['params']['id']}},_0x1dc321={};_0x1dc321[_0xb648('0x2e')]=_[_0xb648('0x2f')](db[_0xb648('0x3b')][_0xb648('0x2a')]);_0x1dc321[_0xb648('0x30')]=_[_0xb648('0x2f')](_0x17dc97[_0xb648('0x30')]);_0x1dc321[_0xb648('0x39')]=_[_0xb648('0x31')](_0x1dc321[_0xb648('0x2e')],_0x1dc321[_0xb648('0x30')]);_0x57adcc[_0xb648('0x32')]=_[_0xb648('0x31')](_0x1dc321['model'],qs['fields'](_0x17dc97['query'][_0xb648('0x33')]));_0x57adcc[_0xb648('0x32')]=_0x57adcc['attributes'][_0xb648('0x34')]?_0x57adcc['attributes']:_0x1dc321['model'];if(_0x17dc97[_0xb648('0x30')][_0xb648('0x3c')]){_0x57adcc[_0xb648('0x3d')]=[{'all':!![]}];}_0x57adcc=_[_0xb648('0x3f')]({},_0x57adcc,_0x17dc97[_0xb648('0x40')]);return db[_0xb648('0x3b')][_0xb648('0x41')](_0x57adcc)['then'](handleEntityNotFound(_0x4ecb19,null))[_0xb648('0x24')](respondWithResult(_0x4ecb19,null))[_0xb648('0x3e')](handleError(_0x4ecb19,null));};exports[_0xb648('0x42')]=function(_0x3be32e,_0x2db867){return db['SmsApplication'][_0xb648('0x42')](_0x3be32e['body'],{})[_0xb648('0x24')](respondWithResult(_0x2db867,0xc9))[_0xb648('0x3e')](handleError(_0x2db867,null));};exports[_0xb648('0x23')]=function(_0x313673,_0x56699b){if(_0x313673['body']['id']){delete _0x313673['body']['id'];}return db[_0xb648('0x3b')][_0xb648('0x41')]({'where':{'id':_0x313673[_0xb648('0x43')]['id']}})[_0xb648('0x24')](handleEntityNotFound(_0x56699b,null))[_0xb648('0x24')](saveUpdates(_0x313673['body'],null))[_0xb648('0x24')](respondWithResult(_0x56699b,null))[_0xb648('0x3e')](handleError(_0x56699b,null));};exports[_0xb648('0x44')]=function(_0x25fbda,_0x13aee5){return db[_0xb648('0x3b')][_0xb648('0x41')]({'where':{'id':_0x25fbda[_0xb648('0x43')]['id']}})[_0xb648('0x24')](handleEntityNotFound(_0x13aee5,null))[_0xb648('0x24')](removeEntity(_0x13aee5,null))[_0xb648('0x3e')](handleError(_0x13aee5,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index d93a965..8971871 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 _0x18a8=['exports','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf','./smsApplication.attributes'];(function(_0x57bb3a,_0x237ede){var _0x5decaa=function(_0x262a8f){while(--_0x262a8f){_0x57bb3a['push'](_0x57bb3a['shift']());}};_0x5decaa(++_0x237ede);}(_0x18a8,0x160));var _0x818a=function(_0x2dd6d5,_0x4deb1d){_0x2dd6d5=_0x2dd6d5-0x0;var _0x55599a=_0x18a8[_0x2dd6d5];return _0x55599a;};'use strict';var _=require(_0x818a('0x0'));var util=require('util');var logger=require(_0x818a('0x1'))(_0x818a('0x2'));var moment=require(_0x818a('0x3'));var BPromise=require('bluebird');var rp=require(_0x818a('0x4'));var fs=require('fs');var path=require(_0x818a('0x5'));var rimraf=require(_0x818a('0x6'));var config=require('../../config/environment');var attributes=require(_0x818a('0x7'));module[_0x818a('0x8')]=function(_0x113c58,_0x4afd40){return _0x113c58['define']('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x818a('0x9')});}; \ No newline at end of file +var _0x1755=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1755,0xce));var _0x5175=function(_0x5aa5f8,_0x3b4662){_0x5aa5f8=_0x5aa5f8-0x0;var _0xb33c91=_0x1755[_0x5aa5f8];return _0xb33c91;};'use strict';var _=require(_0x5175('0x0'));var util=require(_0x5175('0x1'));var logger=require(_0x5175('0x2'))(_0x5175('0x3'));var moment=require(_0x5175('0x4'));var BPromise=require(_0x5175('0x5'));var rp=require(_0x5175('0x6'));var fs=require('fs');var path=require(_0x5175('0x7'));var rimraf=require(_0x5175('0x8'));var config=require(_0x5175('0x9'));var attributes=require(_0x5175('0xa'));module['exports']=function(_0x1dc0d9,_0x43f324){return _0x1dc0d9[_0x5175('0xb')](_0x5175('0xc'),attributes,{'tableName':_0x5175('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5175('0xe'),'collate':_0x5175('0xf')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 6e8cebe..f50ed75 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 _0xa701=['rpc','../../config/environment','jayson/promise','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','ioredis','../../config/logger'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa701,0xd4));var _0x1a70=function(_0x4b61c2,_0x376c83){_0x4b61c2=_0x4b61c2-0x0;var _0x1edc59=_0xa701[_0x4b61c2];return _0x1edc59;};'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});function respondWithRpcPromise(_0x1c700b,_0x191a56,_0x1e5432){return new BPromise(function(_0x85bfd0,_0x1dd89b){return client[_0x1a70('0x7')](_0x1c700b,_0x1e5432)[_0x1a70('0x8')](function(_0x55b5e2){logger[_0x1a70('0x9')](_0x1a70('0xa'),_0x191a56,_0x1a70('0xb'));logger[_0x1a70('0xc')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x191a56,_0x1a70('0xb'),JSON[_0x1a70('0xd')](_0x55b5e2));if(_0x55b5e2[_0x1a70('0xe')]){if(_0x55b5e2['error']['code']===0x1f4){logger[_0x1a70('0xe')]('SmsApplication,\x20%s,\x20%s',_0x191a56,_0x55b5e2[_0x1a70('0xe')]['message']);return _0x1dd89b(_0x55b5e2[_0x1a70('0xe')]['message']);}logger[_0x1a70('0xe')]('SmsApplication,\x20%s,\x20%s',_0x191a56,_0x55b5e2[_0x1a70('0xe')][_0x1a70('0xf')]);return _0x85bfd0(_0x55b5e2[_0x1a70('0xe')][_0x1a70('0xf')]);}else{logger[_0x1a70('0x9')]('SmsApplication,\x20%s,\x20%s',_0x191a56,'request\x20sent');_0x85bfd0(_0x55b5e2[_0x1a70('0x10')]['message']);}})[_0x1a70('0x11')](function(_0x3d8745){logger['error'](_0x1a70('0xa'),_0x191a56,_0x3d8745);_0x1dd89b(_0x3d8745);});});} \ No newline at end of file +var _0x9f37=['lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x1cdeec,_0x34c557){var _0x13ba9b=function(_0xbd4865){while(--_0xbd4865){_0x1cdeec['push'](_0x1cdeec['shift']());}};_0x13ba9b(++_0x34c557);}(_0x9f37,0xd1));var _0x79f3=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x9f37[_0x36eaaa];return _0x461349;};'use strict';var _=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var moment=require('moment');var BPromise=require(_0x79f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x79f3('0x3'))['db'];var utils=require(_0x79f3('0x4'));var logger=require(_0x79f3('0x5'))('rpc');var config=require(_0x79f3('0x6'));var jayson=require(_0x79f3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x171940,_0x42b440,_0x2ad818){return new BPromise(function(_0xe4ed49,_0x59efc6){return client[_0x79f3('0x8')](_0x171940,_0x2ad818)[_0x79f3('0x9')](function(_0x4b4562){logger[_0x79f3('0xa')](_0x79f3('0xb'),_0x42b440,_0x79f3('0xc'));logger[_0x79f3('0xd')](_0x79f3('0xe'),_0x42b440,'request\x20sent',JSON[_0x79f3('0xf')](_0x4b4562));if(_0x4b4562[_0x79f3('0x10')]){if(_0x4b4562['error']['code']===0x1f4){logger[_0x79f3('0x10')](_0x79f3('0xb'),_0x42b440,_0x4b4562[_0x79f3('0x10')][_0x79f3('0x11')]);return _0x59efc6(_0x4b4562['error'][_0x79f3('0x11')]);}logger[_0x79f3('0x10')](_0x79f3('0xb'),_0x42b440,_0x4b4562[_0x79f3('0x10')][_0x79f3('0x11')]);return _0xe4ed49(_0x4b4562[_0x79f3('0x10')]['message']);}else{logger['info'](_0x79f3('0xb'),_0x42b440,_0x79f3('0xc'));_0xe4ed49(_0x4b4562['result'][_0x79f3('0x11')]);}})[_0x79f3('0x12')](function(_0x23874b){logger[_0x79f3('0x10')]('SmsApplication,\x20%s,\x20%s',_0x42b440,_0x23874b);_0x59efc6(_0x23874b);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 4bb8691..77b08f2 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 _0x34b7=['/:id/tags','removeTags','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','sms','smsinteraction:addtags','addTags','put','/:id','smsinteraction:update','delete','destroy'];(function(_0x273f77,_0xe5b0cb){var _0x71e147=function(_0x564056){while(--_0x564056){_0x273f77['push'](_0x273f77['shift']());}};_0x71e147(++_0xe5b0cb);}(_0x34b7,0x196));var _0x734b=function(_0x3e2936,_0x1d57a9){_0x3e2936=_0x3e2936-0x0;var _0x35d87a=_0x34b7[_0x3e2936];return _0x35d87a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x734b('0x7')]('/:id/messages',auth[_0x734b('0x8')](),controller[_0x734b('0xc')]);router[_0x734b('0x7')](_0x734b('0xd'),auth[_0x734b('0x8')](),controller[_0x734b('0xe')]);router[_0x734b('0xf')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x10')]);router[_0x734b('0xf')](_0x734b('0x11'),auth[_0x734b('0x8')](),controller[_0x734b('0x12')]);router[_0x734b('0xf')]('/:id/tags',auth[_0x734b('0x8')](),interaction[_0x734b('0x13')](_0x734b('0x14'),_0x734b('0x15')),controller[_0x734b('0x16')]);router[_0x734b('0x17')](_0x734b('0x18'),auth[_0x734b('0x8')](),interaction[_0x734b('0x13')](_0x734b('0x14'),_0x734b('0x19')),controller['update']);router[_0x734b('0x1a')](_0x734b('0x18'),auth[_0x734b('0x8')](),interaction[_0x734b('0x13')]('sms','smsinteraction:destroy'),controller[_0x734b('0x1b')]);router[_0x734b('0x1a')](_0x734b('0x1c'),auth[_0x734b('0x8')](),controller[_0x734b('0x1d')]);module[_0x734b('0x1e')]=router; \ No newline at end of file +var _0xa571=['get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xa571,0x107));var _0x1a57=function(_0x58fd09,_0x4ded2e){_0x58fd09=_0x58fd09-0x0;var _0x48a59e=_0xa571[_0x58fd09];return _0x48a59e;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./smsInteraction.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['describe']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')](_0x1a57('0xc'),auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),interaction['tracked'](_0x1a57('0x13'),_0x1a57('0x14')),controller[_0x1a57('0x15')]);router[_0x1a57('0x16')]('/:id',auth[_0x1a57('0x8')](),interaction['tracked']('sms',_0x1a57('0x17')),controller[_0x1a57('0x18')]);router[_0x1a57('0x19')]('/:id',auth[_0x1a57('0x8')](),interaction[_0x1a57('0x1a')](_0x1a57('0x13'),'smsinteraction:destroy'),controller[_0x1a57('0x1b')]);router[_0x1a57('0x19')](_0x1a57('0x1c'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index f96d43f..9c47625 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 _0xa381=['BOOLEAN','sequelize','moment','DATE','STRING','ENUM'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa381,0x79));var _0x1a38=function(_0x28298a,_0x27cbd5){_0x28298a=_0x28298a-0x0;var _0x1826fd=_0xa381[_0x28298a];return _0x1826fd;};'use strict';var Sequelize=require(_0x1a38('0x0'));var moment=require(_0x1a38('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1a38('0x2')]},'disposition':{'type':Sequelize[_0x1a38('0x3')]},'secondDisposition':{'type':Sequelize[_0x1a38('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1a38('0x3')]},'phone':{'type':Sequelize[_0x1a38('0x3')]},'read1stAt':{'type':Sequelize[_0x1a38('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x1a38('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1a38('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1a38('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x1b94=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x1fd5be,_0x46beb5){var _0x3801d2=function(_0x41e601){while(--_0x41e601){_0x1fd5be['push'](_0x1fd5be['shift']());}};_0x3801d2(++_0x46beb5);}(_0x1b94,0x1f2));var _0x41b9=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x1b94[_0x42bdad];return _0x122626;};'use strict';var Sequelize=require(_0x41b9('0x0'));var moment=require(_0x41b9('0x1'));module[_0x41b9('0x2')]={'closed':{'type':Sequelize[_0x41b9('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x41b9('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x41b9('0x5')]},'thirdDisposition':{'type':Sequelize[_0x41b9('0x5')]},'note':{'type':Sequelize[_0x41b9('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x41b9('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x41b9('0x6')]('in',_0x41b9('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x41b9('0x6')]('in',_0x41b9('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x41b9('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 ffd3ad5..679682b 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 _0x3dc4=['parseSearch','search','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','split','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','SmsAccountId','where','concat','createdAt','parse','null','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','user','role','toString','count','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','c.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','all','rows','params','rawAttributes','include','options','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','color','emit','smsInteractionTags:save','removeTags','download','server','files','tmp','join','root','attachments','User','push','CmContact','firstName','lastName','Messages','direction','secret','read','Account','Owner','get','N.A.','format','closed','disposition','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','err','unlinkSync','eml-format','rimraf','request-promise','moment','bluebird','util','sox','ejs','squel','crypto','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','fullname','TagIds','Tags','forEach','catch','index','map','SmsInteraction','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','field','from','tools_tags','select','u.id','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr'];(function(_0x11a5a2,_0x1411fb){var _0xaf1ed0=function(_0x374416){while(--_0x374416){_0x11a5a2['push'](_0x11a5a2['shift']());}};_0xaf1ed0(++_0x1411fb);}(_0x3dc4,0x163));var _0x43dc=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3dc4[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x43dc('0x0'));var rimraf=require(_0x43dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x43dc('0x2'));var moment=require(_0x43dc('0x3'));var BPromise=require(_0x43dc('0x4'));var Mustache=require('mustache');var util=require(_0x43dc('0x5'));var path=require('path');var sox=require(_0x43dc('0x6'));var csv=require('to-csv');var ejs=require(_0x43dc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x43dc('0x8'));var crypto=require(_0x43dc('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x43dc('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43dc('0xb'));var as=require(_0x43dc('0xc'));var pdf=require(_0x43dc('0xd'));var hardwareService=require(_0x43dc('0xe'));var logger=require(_0x43dc('0xf'))('api');var utils=require(_0x43dc('0x10'));var config=require(_0x43dc('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0x43dc('0x12'))['db'];config[_0x43dc('0x13')]=_[_0x43dc('0x14')](config[_0x43dc('0x13')],{'host':_0x43dc('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')[_0x43dc('0x16')](socket);function respondWithStatusCode(_0x44b5e4,_0x2ad0e5){_0x2ad0e5=_0x2ad0e5||0xcc;return function(_0x951b73){if(_0x951b73){return _0x44b5e4['sendStatus'](_0x2ad0e5);}return _0x44b5e4[_0x43dc('0x17')](_0x2ad0e5)[_0x43dc('0x18')]();};}function respondWithResult(_0x41783c,_0x531433){_0x531433=_0x531433||0xc8;return function(_0x9e09da){if(_0x9e09da){return _0x41783c[_0x43dc('0x17')](_0x531433)[_0x43dc('0x19')](_0x9e09da);}};}function respondWithFilteredResult(_0x5d936c,_0x6c0f04){return function(_0x24f6e5){if(_0x24f6e5){var _0x3afd1d=typeof _0x6c0f04[_0x43dc('0x1a')]===_0x43dc('0x1b')&&typeof _0x6c0f04['limit']===_0x43dc('0x1b');var _0x2ab992=_0x24f6e5['count'];var _0x408c95=_0x3afd1d?0x0:_0x6c0f04[_0x43dc('0x1a')];var _0x40f77a=_0x3afd1d?_0x24f6e5['count']:_0x6c0f04[_0x43dc('0x1a')]+_0x6c0f04[_0x43dc('0x1c')];var _0x187fe5;if(_0x40f77a>=_0x2ab992){_0x40f77a=_0x2ab992;_0x187fe5=0xc8;}else{_0x187fe5=0xce;}_0x5d936c['status'](_0x187fe5);return _0x5d936c[_0x43dc('0x1d')](_0x43dc('0x1e'),_0x408c95+'-'+_0x40f77a+'/'+_0x2ab992)[_0x43dc('0x19')](_0x24f6e5);}return null;};}function patchUpdates(_0x312281){return function(_0x2e2a2e){try{jsonpatch[_0x43dc('0x1f')](_0x2e2a2e,_0x312281,!![]);}catch(_0x9d2902){return BPromise[_0x43dc('0x20')](_0x9d2902);}return _0x2e2a2e[_0x43dc('0x21')]();};}function saveUpdates(_0x26504a,_0x17bc94){return function(_0x26757d){if(_0x26757d){return _0x26757d[_0x43dc('0x22')](_0x26504a)[_0x43dc('0x23')](function(_0x48f630){return _0x48f630;});}return null;};}function removeEntity(_0x30df8f,_0x1e5d26){return function(_0x5a38df){if(_0x5a38df){return _0x5a38df[_0x43dc('0x24')]()['then'](function(){_0x30df8f[_0x43dc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10c28f,_0x49a621){return function(_0x503a88){if(!_0x503a88){_0x10c28f[_0x43dc('0x25')](0x194);}return _0x503a88;};}function handleError(_0xe8e833,_0x1bd565){_0x1bd565=_0x1bd565||0x1f4;return function(_0x26da42){logger['error'](_0x26da42[_0x43dc('0x26')]);if(_0x26da42[_0x43dc('0x27')]){delete _0x26da42[_0x43dc('0x27')];}_0xe8e833[_0x43dc('0x17')](_0x1bd565)[_0x43dc('0x28')](_0x26da42);};}function getInteractionUsers(_0x352d56,_0x43ce99){return new BPromise(function(_0x5074ef,_0x492b3a){try{if(_0x43ce99[_0x352d56['id']]){_0x352d56['Users']=_['map'](_0x43ce99[_0x352d56['id']],function(_0x5c55a6){return{'id':_0x5c55a6['id'],'fullname':_0x5c55a6[_0x43dc('0x29')]};});}}catch(_0x126c66){_0x492b3a(_0x126c66);}_0x5074ef(_0x352d56);});}function getInteractionTags(_0x2a10b0,_0x12bcc3){return new BPromise(function(_0x4eba68,_0x24cbc3){try{if(_0x2a10b0[_0x43dc('0x2a')]){_0x2a10b0[_0x43dc('0x2b')]=[];_0x2a10b0[_0x43dc('0x2a')]['split'](',')[_0x43dc('0x2c')](function(_0x294aa9){_0x2a10b0[_0x43dc('0x2b')]['push'](_0x12bcc3[_0x294aa9]);});}delete _0x2a10b0[_0x43dc('0x2a')];}catch(_0x8c9db7){_0x24cbc3(_0x8c9db7);}_0x4eba68(_0x2a10b0);});}function updateSmsInteraction(_0x4ab149,_0x1c63f6,_0x5d2058){return new BPromise(function(_0x40ea57,_0x632856){return getInteractionUsers(_0x4ab149,_0x5d2058)['then'](function(_0x3a0cfa){return getInteractionTags(_0x3a0cfa,_0x1c63f6);})[_0x43dc('0x23')](function(_0x1519af){_0x40ea57(_0x1519af);})[_0x43dc('0x2d')](function(_0x4947e4){_0x632856(_0x4947e4);});});}exports[_0x43dc('0x2e')]=function(_0x4408a4,_0x5c4cf9){var _0x351505={},_0x1128f8={},_0x304a18={'count':0x0,'rows':[]};var _0x2130e3=_[_0x43dc('0x2f')](db[_0x43dc('0x30')]['rawAttributes'],function(_0x5cb4cc){return{'name':_0x5cb4cc[_0x43dc('0x31')],'type':_0x5cb4cc['type'][_0x43dc('0x32')]};});_0x1128f8[_0x43dc('0x33')]=_['map'](_0x2130e3,_0x43dc('0x27'));_0x1128f8['query']=_[_0x43dc('0x34')](_0x4408a4['query']);_0x1128f8[_0x43dc('0x35')]=_[_0x43dc('0x36')](_0x1128f8[_0x43dc('0x33')],_0x1128f8[_0x43dc('0x37')]);_0x351505[_0x43dc('0x38')]=_['intersection'](_0x1128f8['model'],qs[_0x43dc('0x39')](_0x4408a4['query'][_0x43dc('0x39')]));_0x351505[_0x43dc('0x38')]=_0x351505[_0x43dc('0x38')][_0x43dc('0x3a')]?_0x351505[_0x43dc('0x38')]:_0x1128f8[_0x43dc('0x33')];if(!_0x4408a4[_0x43dc('0x37')][_0x43dc('0x3b')](_0x43dc('0x3c'))){_0x351505[_0x43dc('0x1c')]=qs['limit'](_0x4408a4[_0x43dc('0x37')][_0x43dc('0x1c')]);_0x351505[_0x43dc('0x1a')]=qs[_0x43dc('0x1a')](_0x4408a4[_0x43dc('0x37')][_0x43dc('0x1a')]);}_0x351505[_0x43dc('0x3d')]=qs[_0x43dc('0x3e')](_0x4408a4['query']['sort']);_0x351505['where']=qs['filters'](_[_0x43dc('0x3f')](_0x4408a4['query'],_0x1128f8[_0x43dc('0x35')]),_0x2130e3);var _0x122165=[];var _0x36499c=squel['select']()[_0x43dc('0x40')]('id')[_0x43dc('0x40')](_0x43dc('0x27'))[_0x43dc('0x40')]('color')[_0x43dc('0x41')](_0x43dc('0x42'));var _0x1263a9=squel[_0x43dc('0x43')]()[_0x43dc('0x40')](_0x43dc('0x44'))[_0x43dc('0x40')]('u.fullname')[_0x43dc('0x40')]('ui.SmsInteractionId')['from'](_0x43dc('0x45'),'ui')[_0x43dc('0x46')](_0x43dc('0x47'),'u',_0x43dc('0x48'));var _0x16d852=squel[_0x43dc('0x43')]()[_0x43dc('0x41')](_0x43dc('0x49'),'i')['left_join'](_0x43dc('0x4a'),'c',_0x43dc('0x4b'))[_0x43dc('0x46')](_0x43dc('0x47'),'o','o.id\x20=\x20i.UserId')[_0x43dc('0x46')]('sms_accounts','a',_0x43dc('0x4c'))[_0x43dc('0x46')](_0x43dc('0x4d'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x43dc('0x46')]('sms_interaction_has_tags','it',_0x43dc('0x4e'))[_0x43dc('0x46')](_0x43dc('0x42'),'t',_0x43dc('0x4f'));var _0x27e49a=squel[_0x43dc('0x50')]();var _0x17cf63=[];var _0x43305d=squel[_0x43dc('0x50')]();var _0x3379c8;if(_0x4408a4['query']['search']){_0x3379c8=as[_0x43dc('0x51')](_0x4408a4[_0x43dc('0x37')][_0x43dc('0x52')]);var _0x4edaf6=_0x3379c8[_0x43dc('0x53')];for(var _0x5b7a04=0x0;_0x5b7a04<_0x3379c8[_0x43dc('0x54')]['length'];_0x5b7a04++){var _0x52e283=_0x3379c8[_0x43dc('0x54')][_0x5b7a04];var _0x356371='i';var _0x10519d=_['find'](_0x2130e3,[_0x43dc('0x27'),_0x52e283['field']]);if(!_0x10519d){switch(_0x52e283['field']){case _0x43dc('0x55'):if(_0x52e283[_0x43dc('0x56')]==0x1){_0x16d852['having']('`'+_0x52e283[_0x43dc('0x40')]+_0x43dc('0x57'));}else{_0x16d852[_0x43dc('0x58')]('`'+_0x52e283['field']+_0x43dc('0x59'));}break;case _0x43dc('0x5a'):if(_0x52e283['operator']==='$substring'){if(_0x52e283[_0x43dc('0x56')][_0x43dc('0x5b')]('\x20')[_0x43dc('0x3a')]>0x1){_0x27e49a[_0x4edaf6]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x43dc('0x5c')](_0x52e283['value']),null);}else{var _0x31217b='%'+_0x52e283[_0x43dc('0x56')]+'%';_0x27e49a[_0x4edaf6](_0x43dc('0x5d'),_0x31217b,_0x31217b,_0x31217b);}}else{_0x10519d=_[_0x43dc('0x5e')](_0x2130e3,[_0x43dc('0x27'),_0x43dc('0x5f')]);_0x52e283[_0x43dc('0x40')]=_0x43dc('0x5f');_0x3abf71=as[_0x43dc('0x60')](_0x356371,_0x10519d[_0x43dc('0x61')],_0x52e283);_0x27e49a[_0x4edaf6](_0x3abf71[_0x43dc('0x62')],_0x3abf71[_0x43dc('0x56')][_0x43dc('0x63')],_0x3abf71[_0x43dc('0x56')][_0x43dc('0x18')]);}break;case _0x43dc('0x64'):var _0x18be0e=_0x52e283[_0x43dc('0x56')][_0x43dc('0x5b')](',')[_0x43dc('0x2f')](function(_0x482008){return Number(_0x482008);});_0x18be0e[_0x43dc('0x2c')](function(_0x416a48){_0x43305d['or'](_0x43dc('0x65'),'%,'+_0x416a48+',%');});_0x17cf63=_['union'](_0x17cf63,_0x18be0e);break;case'User':if(_0x52e283[_0x43dc('0x66')]===_0x43dc('0x67')){_0x27e49a[_0x4edaf6](_0x43dc('0x68'),'%'+_0x52e283['value']+'%',null);}else{_0x10519d=_[_0x43dc('0x5e')](_0x2130e3,[_0x43dc('0x27'),'UserId']);_0x52e283[_0x43dc('0x40')]=_0x43dc('0x69');_0x3abf71=as[_0x43dc('0x60')](_0x356371,_0x10519d[_0x43dc('0x61')],_0x52e283);_0x27e49a[_0x4edaf6](_0x3abf71[_0x43dc('0x62')],_0x3abf71['value'][_0x43dc('0x63')],_0x3abf71[_0x43dc('0x56')]['end']);}break;case _0x43dc('0x6a'):_0x3abf71=as['buildExpression']('me',null,_0x52e283);_0x27e49a[_0x4edaf6](_0x3abf71[_0x43dc('0x62')],_0x3abf71[_0x43dc('0x56')][_0x43dc('0x63')],_0x3abf71[_0x43dc('0x56')][_0x43dc('0x18')]);break;}}else{var _0x3abf71=as[_0x43dc('0x60')](_0x356371,_0x10519d['type'],_0x52e283);_0x27e49a[_0x4edaf6](_0x3abf71[_0x43dc('0x62')],_0x3abf71[_0x43dc('0x56')][_0x43dc('0x63')],_0x3abf71[_0x43dc('0x56')]['end']);}}}else{var _0x3804bd=_(_0x4408a4['query'])[_0x43dc('0x34')]()['map'](function(_0x41a088){return _[_0x43dc('0x6b')](_0x2130e3,[_0x43dc('0x27'),_0x41a088])?_0x41a088:undefined;})[_0x43dc('0x6c')]()[_0x43dc('0x56')]();if(!_[_0x43dc('0x6d')](_0x3804bd)){_0x3804bd[_0x43dc('0x2c')](function(_0x23c92e){if(_0x23c92e===_0x43dc('0x6e')){_0x16d852[_0x43dc('0x6f')]('i.SmsAccountId\x20IN\x20?',[][_0x43dc('0x70')](_0x4408a4[_0x43dc('0x37')][_0x23c92e]));}else if(_0x23c92e===_0x43dc('0x71')){var _0x8cd1b8=JSON[_0x43dc('0x72')](_0x4408a4[_0x43dc('0x37')][_0x23c92e])['$gte'];var _0x459857=JSON[_0x43dc('0x72')](_0x4408a4[_0x43dc('0x37')][_0x23c92e])['$lte'];_0x16d852[_0x43dc('0x6f')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x8cd1b8,_0x459857);}else{if(_0x4408a4[_0x43dc('0x37')][_0x23c92e]===_0x43dc('0x73')){_0x16d852[_0x43dc('0x6f')]('i.'+_0x23c92e+'\x20IS\x20NULL');}else{_0x16d852['where']('i.'+_0x23c92e+_0x43dc('0x74'),_0x4408a4[_0x43dc('0x37')][_0x23c92e]);}}});}if(_0x4408a4[_0x43dc('0x37')]['read']){if(_0x4408a4[_0x43dc('0x37')]['read']==0x1){_0x16d852[_0x43dc('0x58')](_0x43dc('0x75'));}else{_0x16d852[_0x43dc('0x58')](_0x43dc('0x76'));}}if(_0x4408a4[_0x43dc('0x37')]['tag']){_0x17cf63=_[_0x43dc('0x77')](_0x4408a4[_0x43dc('0x37')]['tag'])?_0x4408a4[_0x43dc('0x37')][_0x43dc('0x78')]:new Array(_0x4408a4['query']['tag']);_0x17cf63['forEach'](function(_0x14e105){_0x43305d['or'](_0x43dc('0x65'),'%,'+_0x14e105+',%');});}if(_0x4408a4[_0x43dc('0x37')]['filter']){var _0x329107=_0x4408a4[_0x43dc('0x37')][_0x43dc('0x79')][_0x43dc('0x7a')]('\x5c','\x5c\x5c')[_0x43dc('0x7a')](/'/g,'\x27\x27');if(qs[_0x43dc('0x7b')](_0x329107)){_0x27e49a['or']('i.id\x20LIKE\x20?',_0x329107+'%')['or'](_0x43dc('0x7c'),_0x329107+'%');}else{_0x27e49a['or'](_0x43dc('0x7d'),qs[_0x43dc('0x5c')](_0x329107))['or'](_0x43dc('0x7e'),_0x329107+'%');}}}_0x16d852[_0x43dc('0x6f')](_0x27e49a);_0x16d852[_0x43dc('0x7f')](_0x43dc('0x80'));var _0x2ff4e8={'type':db[_0x43dc('0x81')]['QueryTypes']['SELECT'],'raw':!![]};var _0x26409f=_0x16d852['clone']();_0x26409f['field'](_0x43dc('0x80'));_0x26409f[_0x43dc('0x40')](_0x43dc('0x82'),_0x43dc('0x55'));if(_0x351505[_0x43dc('0x3d')]){_0x351505['order'][_0x43dc('0x2c')](function(_0x183f06){var _0x559ee1=_0x183f06[0x0]===_0x43dc('0x83')?_0x183f06[0x0]:'i.'+_0x183f06[0x0];_0x16d852[_0x43dc('0x3d')](_0x559ee1,_0x183f06[0x1]===_0x43dc('0x84')?![]:!![]);});}if(!_[_0x43dc('0x6d')](_0x17cf63)){_0x16d852[_0x43dc('0x58')](_0x43305d);_0x26409f['where']('t.id\x20IN\x20?',_0x17cf63);}BPromise[_0x43dc('0x85')]()[_0x43dc('0x23')](function(){if(!_0x3379c8){if(_0x4408a4[_0x43dc('0x37')][_0x43dc('0x6e')])return;_0x26409f[_0x43dc('0x6f')](_0x43dc('0x86'));_0x16d852[_0x43dc('0x6f')](_0x43dc('0x86'));return;}if(_0x4408a4['user']['role']!==_0x43dc('0x87'))return;return _0x4408a4['user'][_0x43dc('0x88')]({'attributes':['id'],'raw':!![]})[_0x43dc('0x23')](function(_0x2fb065){if(_[_0x43dc('0x6d')](_0x2fb065)){_0x26409f['where'](_0x43dc('0x89'));_0x16d852[_0x43dc('0x6f')](_0x43dc('0x89'));}else{_0x26409f[_0x43dc('0x6f')](_0x43dc('0x8a'),_[_0x43dc('0x2f')](_0x2fb065,'id'));_0x16d852[_0x43dc('0x6f')]('i.SmsAccountId\x20IN\x20?',_[_0x43dc('0x2f')](_0x2fb065,'id'));}});})[_0x43dc('0x23')](function(){if(_0x4408a4[_0x43dc('0x8b')][_0x43dc('0x8c')]==='agent'&&!_0x3379c8&&!_0x4408a4[_0x43dc('0x37')][_0x43dc('0x6e')])return[];return db['sequelize'][_0x43dc('0x37')](_0x26409f[_0x43dc('0x8d')](),_0x2ff4e8);})[_0x43dc('0x23')](function(_0x7cecb4){_0x304a18['count']=_0x7cecb4[_0x43dc('0x3a')];if(_0x304a18[_0x43dc('0x8e')]===0x0)return[];return db[_0x43dc('0x8f')]['query'](_0x36499c[_0x43dc('0x8d')](),_0x2ff4e8)[_0x43dc('0x23')](function(_0x51dc21){_0x122165=_[_0x43dc('0x90')](_0x51dc21,'id');_0x2ff4e8=_[_0x43dc('0x91')](_0x2ff4e8,{'model':db[_0x43dc('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4408a4[_0x43dc('0x37')][_0x43dc('0x39')]){_0x351505[_0x43dc('0x38')][_0x43dc('0x2c')](function(_0x316d47){_0x16d852[_0x43dc('0x40')]('i.'+_0x316d47);});}else{_0x16d852['field'](_0x43dc('0x82'),_0x43dc('0x55'));_0x16d852['field'](_0x43dc('0x92'),_0x43dc('0x93'));_0x16d852['field'](_0x43dc('0x94'),_0x43dc('0x95'));_0x16d852[_0x43dc('0x40')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x43dc('0x83'));_0x16d852['field'](_0x43dc('0x96'));_0x16d852[_0x43dc('0x40')](_0x43dc('0x97'),'Contact.firstName');_0x16d852[_0x43dc('0x40')](_0x43dc('0x98'),'Contact.lastName');_0x16d852[_0x43dc('0x40')](_0x43dc('0x99'),_0x43dc('0x9a'));_0x16d852[_0x43dc('0x40')](_0x43dc('0x9b'),'Contact.phone');_0x16d852[_0x43dc('0x40')](_0x43dc('0x9c'),'Contact.mobile');_0x16d852[_0x43dc('0x40')](_0x43dc('0x9d'),_0x43dc('0x9e'));_0x16d852['field']('o.fullname',_0x43dc('0x9f'));_0x16d852[_0x43dc('0x40')]('o.internal',_0x43dc('0xa0'));_0x16d852[_0x43dc('0x40')](_0x43dc('0xa1'),_0x43dc('0x2a'));}if(_0x351505[_0x43dc('0x1c')])_0x16d852[_0x43dc('0x1c')](_0x351505[_0x43dc('0x1c')]);if(_0x351505[_0x43dc('0x1a')])_0x16d852['offset'](_0x351505[_0x43dc('0x1a')]);return db[_0x43dc('0x8f')][_0x43dc('0x37')](_0x16d852[_0x43dc('0x8d')](),_0x2ff4e8);})[_0x43dc('0x23')](function(_0x46fe7b){if(_0x46fe7b['length']>0x0)_0x1263a9[_0x43dc('0x6f')](_0x43dc('0xa2'),_['map'](_0x46fe7b,'id'));return db[_0x43dc('0x8f')]['query'](_0x1263a9[_0x43dc('0x8d')](),_0x2ff4e8)['then'](function(_0x3237c9){var _0x5901fe=_['groupBy'](_0x3237c9,'SmsInteractionId');var _0x459da8=[];_0x46fe7b[_0x43dc('0x2c')](function(_0x2c7ad3){_0x459da8['push'](updateSmsInteraction(_0x2c7ad3,_0x122165,_0x5901fe));});return BPromise[_0x43dc('0xa3')](_0x459da8);});});})['then'](function(_0x379e83){_0x304a18[_0x43dc('0xa4')]=_0x379e83;return _0x304a18;})[_0x43dc('0x23')](respondWithFilteredResult(_0x5c4cf9,_0x351505))[_0x43dc('0x2d')](handleError(_0x5c4cf9,null));};exports['show']=function(_0x2c48ff,_0x6581d){var _0x4d2d42={'raw':![],'where':{'id':_0x2c48ff[_0x43dc('0xa5')]['id']}},_0x5182e9={};_0x5182e9[_0x43dc('0x33')]=_[_0x43dc('0x34')](db[_0x43dc('0x30')][_0x43dc('0xa6')]);_0x5182e9[_0x43dc('0x37')]=_[_0x43dc('0x34')](_0x2c48ff[_0x43dc('0x37')]);_0x5182e9[_0x43dc('0x35')]=_[_0x43dc('0x36')](_0x5182e9[_0x43dc('0x33')],_0x5182e9[_0x43dc('0x37')]);_0x4d2d42[_0x43dc('0x38')]=_[_0x43dc('0x36')](_0x5182e9['model'],qs[_0x43dc('0x39')](_0x2c48ff['query'][_0x43dc('0x39')]));_0x4d2d42[_0x43dc('0x38')]=_0x4d2d42[_0x43dc('0x38')][_0x43dc('0x3a')]?_0x4d2d42[_0x43dc('0x38')]:_0x5182e9[_0x43dc('0x33')];if(_0x2c48ff['query']['includeAll']){_0x4d2d42[_0x43dc('0xa7')]=[{'all':!![]}];}_0x4d2d42=_[_0x43dc('0x91')]({},_0x4d2d42,_0x2c48ff[_0x43dc('0xa8')]);return db[_0x43dc('0x30')]['find'](_0x4d2d42)[_0x43dc('0x23')](handleEntityNotFound(_0x6581d,null))['then'](respondWithResult(_0x6581d,null))[_0x43dc('0x2d')](handleError(_0x6581d,null));};exports['create']=function(_0x358bd3,_0x1f7c0c){return db[_0x43dc('0x30')]['create'](_0x358bd3[_0x43dc('0x6a')],{})[_0x43dc('0x23')](respondWithResult(_0x1f7c0c,0xc9))[_0x43dc('0x2d')](handleError(_0x1f7c0c,null));};exports[_0x43dc('0x22')]=function(_0x322ec5,_0x2cd32b){if(_0x322ec5['body']['id']){delete _0x322ec5['body']['id'];}return db[_0x43dc('0x30')][_0x43dc('0x5e')]({'where':{'id':_0x322ec5[_0x43dc('0xa5')]['id']}})[_0x43dc('0x23')](handleEntityNotFound(_0x2cd32b,null))[_0x43dc('0x23')](saveUpdates(_0x322ec5[_0x43dc('0x6a')],null))['then'](respondWithResult(_0x2cd32b,null))[_0x43dc('0x2d')](handleError(_0x2cd32b,null));};exports[_0x43dc('0x24')]=function(_0x4a203a,_0x50ba24){return db[_0x43dc('0x30')][_0x43dc('0x5e')]({'where':{'id':_0x4a203a[_0x43dc('0xa5')]['id']}})[_0x43dc('0x23')](handleEntityNotFound(_0x50ba24,null))[_0x43dc('0x23')](removeEntity(_0x50ba24,null))[_0x43dc('0x2d')](handleError(_0x50ba24,null));};exports[_0x43dc('0xa9')]=function(_0x5dd42b,_0x4f8faf){return db['SmsInteraction']['describe']()['then'](respondWithResult(_0x4f8faf,null))[_0x43dc('0x2d')](handleError(_0x4f8faf,null));};exports[_0x43dc('0xaa')]=function(_0x3d4ea9,_0x15db2b,_0x65bf63){return db[_0x43dc('0xab')][_0x43dc('0x5e')]({'where':{'id':_0x3d4ea9[_0x43dc('0xa5')]['id']}})[_0x43dc('0x23')](handleEntityNotFound(_0x15db2b,null))[_0x43dc('0x23')](function(_0x374a8b){if(_0x374a8b){return _0x374a8b[_0x43dc('0xaa')](_0x3d4ea9[_0x43dc('0x6a')][_0x43dc('0xac')],_[_0x43dc('0xad')](_0x3d4ea9[_0x43dc('0x6a')],[_0x43dc('0xac'),'id'])||{});}})[_0x43dc('0x23')](respondWithResult(_0x15db2b,null))['catch'](handleError(_0x15db2b,null));};exports[_0x43dc('0xae')]=function(_0x47e2ff,_0x1d6048,_0x5daf3b){var _0x514b8c={'raw':![],'where':{}};var _0x4d7bb2={};var _0xb168fd={'count':0x0,'rows':[]};return db[_0x43dc('0x30')][_0x43dc('0xaf')]({'where':{'id':_0x47e2ff['params']['id']}})['then'](handleEntityNotFound(_0x1d6048,null))[_0x43dc('0x23')](function(_0x318633){if(_0x318633){_0x4d7bb2[_0x43dc('0x33')]=_[_0x43dc('0x34')](db[_0x43dc('0xab')][_0x43dc('0xa6')]);_0x4d7bb2[_0x43dc('0x37')]=_['keys'](_0x47e2ff[_0x43dc('0x37')]);_0x4d7bb2['filters']=_[_0x43dc('0x36')](_0x4d7bb2[_0x43dc('0x33')],_0x4d7bb2[_0x43dc('0x37')]);_0x514b8c[_0x43dc('0x38')]=_['intersection'](_0x4d7bb2['model'],qs['fields'](_0x47e2ff[_0x43dc('0x37')][_0x43dc('0x39')]));_0x514b8c[_0x43dc('0x38')]=_0x514b8c[_0x43dc('0x38')]['length']?_0x514b8c[_0x43dc('0x38')]:_0x4d7bb2[_0x43dc('0x33')];if(!_0x47e2ff[_0x43dc('0x37')][_0x43dc('0x3b')]('nolimit')){_0x514b8c[_0x43dc('0x1c')]=qs['limit'](_0x47e2ff[_0x43dc('0x37')][_0x43dc('0x1c')]);_0x514b8c[_0x43dc('0x1a')]=qs[_0x43dc('0x1a')](_0x47e2ff['query']['offset']);}_0x514b8c[_0x43dc('0x3d')]=qs[_0x43dc('0x3e')](_0x47e2ff['query'][_0x43dc('0x3e')]);_0x514b8c['where']=qs[_0x43dc('0x35')](_[_0x43dc('0x3f')](_0x47e2ff[_0x43dc('0x37')],_0x4d7bb2[_0x43dc('0x35')]));_0x514b8c[_0x43dc('0x6f')]['SmsInteractionId']=_0x318633['id'];if(_0x47e2ff['query']['filter']){_0x514b8c[_0x43dc('0x6f')]=_[_0x43dc('0x91')](_0x514b8c['where'],{'$or':_[_0x43dc('0x2f')](_0x514b8c[_0x43dc('0x38')],function(_0x2a321c){var _0x29f82f={};_0x29f82f[_0x2a321c]={'$like':'%'+_0x47e2ff[_0x43dc('0x37')][_0x43dc('0x79')]+'%'};return _0x29f82f;})});}if(_0x47e2ff[_0x43dc('0x37')][_0x43dc('0xb0')]){var _0x3e47c4=_0x47e2ff[_0x43dc('0x37')]['$gte'][_0x43dc('0x5b')](',');var _0x47ec99={};_0x47ec99[_0x3e47c4[0x0]]={'$gte':moment(_0x3e47c4[0x1])['format'](_0x43dc('0xb1'))};_0x514b8c[_0x43dc('0x6f')]=_[_0x43dc('0x91')](_0x514b8c[_0x43dc('0x6f')],_0x47ec99);}_0x514b8c=_['merge']({},_0x514b8c,_0x47e2ff[_0x43dc('0xa8')]);return db[_0x43dc('0xab')][_0x43dc('0x8e')]({'where':_0x514b8c['where']})['then'](function(_0x566e79){_0xb168fd['count']=_0x566e79;if(_0x47e2ff[_0x43dc('0x37')][_0x43dc('0xb2')]){_0x514b8c[_0x43dc('0xa7')]=[{'all':!![]}];}return db[_0x43dc('0xab')][_0x43dc('0xb3')](_0x514b8c);})[_0x43dc('0x23')](function(_0x2ab833){_0xb168fd[_0x43dc('0xa4')]=_0x2ab833;return _0xb168fd;});}})['then'](respondWithFilteredResult(_0x1d6048,_0x514b8c))[_0x43dc('0x2d')](handleError(_0x1d6048,null));};exports[_0x43dc('0xb4')]=function(_0xd83306,_0x2722a7,_0x2401c7){return db['SmsInteraction'][_0x43dc('0x5e')]({'where':{'id':_0xd83306['params']['id']}})[_0x43dc('0x23')](handleEntityNotFound(_0x2722a7,null))[_0x43dc('0x23')](function(_0x2167a0){if(_0x2167a0){return _0x2167a0[_0x43dc('0xb5')](_0xd83306['body']['ids'],_[_0x43dc('0xad')](_0xd83306[_0x43dc('0x6a')],['ids','id'])||{})[_0x43dc('0xb6')](function(){return db[_0x43dc('0x64')][_0x43dc('0xb3')]({'attributes':['id',_0x43dc('0x27'),_0x43dc('0xb7')],'where':{'id':_0xd83306['body'][_0x43dc('0xac')]}});})['then'](function(_0x45abe0){socket[_0x43dc('0xb8')](_0x43dc('0xb9'),{'id':Number(_0xd83306[_0x43dc('0xa5')]['id']),'tags':_0x45abe0||[]});return{'id':Number(_0xd83306[_0x43dc('0xa5')]['id']),'tags':_0x45abe0||[]};});}})[_0x43dc('0x23')](respondWithResult(_0x2722a7,null))[_0x43dc('0x2d')](handleError(_0x2722a7,null));};exports[_0x43dc('0xba')]=function(_0x4d67b9,_0xa79185,_0x41b383){return db[_0x43dc('0x30')][_0x43dc('0x5e')]({'where':{'id':_0x4d67b9[_0x43dc('0xa5')]['id']}})[_0x43dc('0x23')](handleEntityNotFound(_0xa79185,null))[_0x43dc('0x23')](function(_0x381ec0){if(_0x381ec0){return _0x381ec0['removeTags'](_0x4d67b9[_0x43dc('0x37')]['ids']);}})['then'](respondWithStatusCode(_0xa79185,null))['catch'](handleError(_0xa79185,null));};exports[_0x43dc('0xbb')]=function(_0x5d38d6,_0x27a47d){var _0xfa9e64=moment()['unix']()[_0x43dc('0x8d')]();var _0x1501b9=path['join'](config['root'],_0x43dc('0xbc'),_0x43dc('0xbd'),_0x43dc('0xbe'));var _0x107374=path[_0x43dc('0xbf')](config[_0x43dc('0xc0')],_0x43dc('0xbc'),_0x43dc('0xbd'),_0x43dc('0xc1'));var _0x2b6a23=path[_0x43dc('0xbf')](_0x1501b9,_0xfa9e64);var _0x971f4b=util['format']('transcript-%d-%s.zip',_0x5d38d6[_0x43dc('0xa5')]['id'],_0xfa9e64);var _0x1ca241=path[_0x43dc('0xbf')](_0x1501b9,_0x971f4b);var _0x4eef2c=[];_0x4eef2c['push']({'model':db[_0x43dc('0xc2')],'as':_0x43dc('0xc2'),'attributes':['id',_0x43dc('0x29')],'raw':!![]});_0x4eef2c[_0x43dc('0xc3')]({'model':db[_0x43dc('0xc4')],'as':_0x43dc('0x5a'),'attributes':['id',_0x43dc('0xc5'),_0x43dc('0xc6')],'raw':!![]});var _0x4b6829=[{'model':db['SmsMessage'],'as':_0x43dc('0xc7'),'attributes':['id',_0x43dc('0x6a'),_0x43dc('0x71'),_0x43dc('0xc8'),_0x43dc('0xc9'),_0x43dc('0xca')],'include':_0x4eef2c}];_0x4b6829[_0x43dc('0xc3')]({'model':db['SmsAccount'],'as':_0x43dc('0xcb'),'attributes':['id',_0x43dc('0x27')]});_0x4b6829[_0x43dc('0xc3')]({'model':db[_0x43dc('0xc2')],'as':_0x43dc('0xcc'),'attributes':['id',_0x43dc('0x29')]});return db[_0x43dc('0x30')][_0x43dc('0x5e')]({'where':{'id':_0x5d38d6[_0x43dc('0xa5')]['id']},'include':_0x4b6829})[_0x43dc('0x23')](handleEntityNotFound(_0x27a47d,null))[_0x43dc('0x23')](function(_0x22a8c4){if(_0x22a8c4){var _0x505b85=_0x22a8c4[_0x43dc('0xcd')]({'plain':!![]});fs['mkdirSync'](_0x2b6a23);var _0x4a621e={'channel':'Sms','account':_0x505b85[_0x43dc('0xcb')]['name'],'agent':_0x505b85[_0x43dc('0xcc')]?_0x505b85[_0x43dc('0xcc')][_0x43dc('0x29')]:_0x43dc('0xce'),'createdAt':moment(_0x505b85['createdAt'])[_0x43dc('0xcf')](_0x43dc('0xb1'))[_0x43dc('0x8d')](),'closedAt':_0x505b85[_0x43dc('0xd0')]?moment(_0x505b85['closedAt'])['format'](_0x43dc('0xb1'))[_0x43dc('0x8d')]():'','disposition':_0x505b85[_0x43dc('0xd1')],'messages':_(_0x505b85[_0x43dc('0xc7')])[_0x43dc('0x79')]({'secret':![]})[_0x43dc('0x2f')](function(_0x4f9cf4){return{'date':moment(_0x4f9cf4[_0x43dc('0x71')])[_0x43dc('0xcf')](_0x43dc('0xb1'))[_0x43dc('0x8d')](),'sender':_0x4f9cf4['direction']===_0x43dc('0xd2')?_0x4f9cf4[_0x43dc('0xc2')]?_0x4f9cf4[_0x43dc('0xc2')][_0x43dc('0x29')]:'System':_0x4f9cf4['Contact'][_0x43dc('0xc5')]+(_0x4f9cf4[_0x43dc('0x5a')][_0x43dc('0xc6')]?'\x20'+_0x4f9cf4[_0x43dc('0x5a')][_0x43dc('0xc6')]:''),'body':_0x4f9cf4[_0x43dc('0x6a')],'direction':_0x4f9cf4['direction']==='out'?'A':'C','secret':_0x4f9cf4[_0x43dc('0xc9')],'read':_0x4f9cf4['read']};})[_0x43dc('0x56')]()};return ejs[_0x43dc('0xd3')](path[_0x43dc('0xbf')](config[_0x43dc('0xc0')],_0x43dc('0xbc'),_0x43dc('0xd4'),_0x43dc('0xd5')),{'interaction':_0x4a621e})[_0x43dc('0x23')](function(_0x63096d){var _0x2c9d57=path['join'](_0x2b6a23,_0x43dc('0xd6')+_0x505b85['id']+'-'+_0xfa9e64+_0x43dc('0xd7'));var _0x1f2577={'path':_0x2c9d57,'channel':'Sms','interactionId':_0x505b85['id']};return pdf['createPdfFromHTML'](_0x63096d,_0x1f2577);})['then'](function(){return new BPromise(function(_0x1d724b,_0x47f03d){zipdir(_0x2b6a23,{'saveTo':_0x1ca241},function(_0x192a61,_0x5a5baf){if(_0x192a61)return _0x47f03d(_0x192a61);return _0x1d724b(_0x5a5baf);});})[_0x43dc('0x23')](function(){return new BPromise(function(_0x36283d,_0x46c0d5){rimraf(_0x2b6a23,function(_0x3735b3){if(_0x3735b3)_0x46c0d5(_0x3735b3);return _0x36283d();});});})[_0x43dc('0x23')](function(){return _0x27a47d[_0x43dc('0xbb')](_0x1ca241,_0x971f4b,function(_0x2c8e4d){if(_0x2c8e4d){console['log'](_0x43dc('0xd8'),_0x2c8e4d);}else{fs[_0x43dc('0xd9')](_0x1ca241);}});});});}else{return _0x27a47d['sendStatus'](0xc8);}})[_0x43dc('0x2d')](handleError(_0x27a47d,null));}; \ No newline at end of file +var _0x0362=['User','UserId','body','some','isEmpty','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','contactName','DESC','t.id\x20IN\x20?','resolve','SmsAccountId','user','agent','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','all','rows','show','params','includeAll','include','options','create','destroy','describe','addMessage','SmsMessage','ids','format','findAll','addTags','omit','color','smsInteractionTags:save','removeTags','download','unix','root','server','tmp','join','transcript-%d-%s.zip','push','CmContact','lastName','Messages','secret','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','closed','closedAt','disposition','YYYY-MM-DD\x20HH:mm:ss','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','status','json','undefined','count','offset','set','Content-Range','apply','update','then','end','sendStatus','error','name','Users','fullname','TagIds','Tags','catch','SmsInteraction','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','limit','sort','filters','pick','select','field','from','tools_tags','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','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','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','length','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','split','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?','find','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union'];(function(_0xd90ab,_0x3abc45){var _0x26d613=function(_0x26ad14){while(--_0x26ad14){_0xd90ab['push'](_0xd90ab['shift']());}};_0x26d613(++_0x3abc45);}(_0x0362,0x15d));var _0x2036=function(_0x5218e0,_0x2ac511){_0x5218e0=_0x5218e0-0x0;var _0x2edfc3=_0x0362[_0x5218e0];return _0x2edfc3;};'use strict';var emlformat=require(_0x2036('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2036('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2036('0x2'));var moment=require(_0x2036('0x3'));var BPromise=require(_0x2036('0x4'));var Mustache=require('mustache');var util=require(_0x2036('0x5'));var path=require(_0x2036('0x6'));var sox=require(_0x2036('0x7'));var csv=require(_0x2036('0x8'));var ejs=require(_0x2036('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2036('0xa'));var squel=require(_0x2036('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2036('0xc'));var toCsv=require(_0x2036('0x8'));var querystring=require('querystring');var Papa=require(_0x2036('0xd'));var Redis=require(_0x2036('0xe'));var authService=require(_0x2036('0xf'));var qs=require(_0x2036('0x10'));var as=require(_0x2036('0x11'));var pdf=require(_0x2036('0x12'));var hardwareService=require(_0x2036('0x13'));var logger=require(_0x2036('0x14'))(_0x2036('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2036('0x16'));var db=require(_0x2036('0x17'))['db'];config[_0x2036('0x18')]=_[_0x2036('0x19')](config[_0x2036('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x2036('0x1a'))(new Redis(config[_0x2036('0x18')]));require(_0x2036('0x1b'))['register'](socket);function respondWithStatusCode(_0x5b4ecb,_0x20bf89){_0x20bf89=_0x20bf89||0xcc;return function(_0x1781c3){if(_0x1781c3){return _0x5b4ecb['sendStatus'](_0x20bf89);}return _0x5b4ecb[_0x2036('0x1c')](_0x20bf89)['end']();};}function respondWithResult(_0x4e5531,_0x140245){_0x140245=_0x140245||0xc8;return function(_0x2eb7fe){if(_0x2eb7fe){return _0x4e5531[_0x2036('0x1c')](_0x140245)[_0x2036('0x1d')](_0x2eb7fe);}};}function respondWithFilteredResult(_0x51be1d,_0x431032){return function(_0x6e4b8d){if(_0x6e4b8d){var _0x37adda=typeof _0x431032['offset']===_0x2036('0x1e')&&typeof _0x431032['limit']===_0x2036('0x1e');var _0x19c40e=_0x6e4b8d['count'];var _0x162a8b=_0x37adda?0x0:_0x431032['offset'];var _0x59cd0c=_0x37adda?_0x6e4b8d[_0x2036('0x1f')]:_0x431032[_0x2036('0x20')]+_0x431032['limit'];var _0x207c1a;if(_0x59cd0c>=_0x19c40e){_0x59cd0c=_0x19c40e;_0x207c1a=0xc8;}else{_0x207c1a=0xce;}_0x51be1d[_0x2036('0x1c')](_0x207c1a);return _0x51be1d[_0x2036('0x21')](_0x2036('0x22'),_0x162a8b+'-'+_0x59cd0c+'/'+_0x19c40e)[_0x2036('0x1d')](_0x6e4b8d);}return null;};}function patchUpdates(_0x281587){return function(_0xd7e7ef){try{jsonpatch[_0x2036('0x23')](_0xd7e7ef,_0x281587,!![]);}catch(_0x5b4fdf){return BPromise['reject'](_0x5b4fdf);}return _0xd7e7ef['save']();};}function saveUpdates(_0x30e89c,_0x1ad4b4){return function(_0x24da6e){if(_0x24da6e){return _0x24da6e[_0x2036('0x24')](_0x30e89c)['then'](function(_0x19bb80){return _0x19bb80;});}return null;};}function removeEntity(_0x14c8b0,_0xcf1d52){return function(_0x34f0f5){if(_0x34f0f5){return _0x34f0f5['destroy']()[_0x2036('0x25')](function(){_0x14c8b0[_0x2036('0x1c')](0xcc)[_0x2036('0x26')]();});}};}function handleEntityNotFound(_0x20c66e,_0x586ef9){return function(_0x6f43d4){if(!_0x6f43d4){_0x20c66e[_0x2036('0x27')](0x194);}return _0x6f43d4;};}function handleError(_0x482f48,_0x51b495){_0x51b495=_0x51b495||0x1f4;return function(_0x1cb623){logger[_0x2036('0x28')](_0x1cb623['stack']);if(_0x1cb623[_0x2036('0x29')]){delete _0x1cb623[_0x2036('0x29')];}_0x482f48['status'](_0x51b495)['send'](_0x1cb623);};}function getInteractionUsers(_0x4627d3,_0x263f30){return new BPromise(function(_0x14b18c,_0x27cc06){try{if(_0x263f30[_0x4627d3['id']]){_0x4627d3[_0x2036('0x2a')]=_['map'](_0x263f30[_0x4627d3['id']],function(_0x22ced9){return{'id':_0x22ced9['id'],'fullname':_0x22ced9[_0x2036('0x2b')]};});}}catch(_0x1190b3){_0x27cc06(_0x1190b3);}_0x14b18c(_0x4627d3);});}function getInteractionTags(_0x4704ea,_0x26abf4){return new BPromise(function(_0x4e0d73,_0xabcb80){try{if(_0x4704ea[_0x2036('0x2c')]){_0x4704ea[_0x2036('0x2d')]=[];_0x4704ea[_0x2036('0x2c')]['split'](',')['forEach'](function(_0x39b739){_0x4704ea[_0x2036('0x2d')]['push'](_0x26abf4[_0x39b739]);});}delete _0x4704ea['TagIds'];}catch(_0x1f9e69){_0xabcb80(_0x1f9e69);}_0x4e0d73(_0x4704ea);});}function updateSmsInteraction(_0x2e6a28,_0x1a75a0,_0x20f400){return new BPromise(function(_0x513d63,_0x255df8){return getInteractionUsers(_0x2e6a28,_0x20f400)['then'](function(_0x45b295){return getInteractionTags(_0x45b295,_0x1a75a0);})[_0x2036('0x25')](function(_0x501759){_0x513d63(_0x501759);})[_0x2036('0x2e')](function(_0x4b3e5a){_0x255df8(_0x4b3e5a);});});}exports['index']=function(_0x3a52ab,_0x1cbc7e){var _0x15eb9c={},_0x3255bc={},_0x580b5e={'count':0x0,'rows':[]};var _0x411db6=_['map'](db[_0x2036('0x2f')][_0x2036('0x30')],function(_0x2c4441){return{'name':_0x2c4441[_0x2036('0x31')],'type':_0x2c4441[_0x2036('0x32')]['key']};});_0x3255bc[_0x2036('0x33')]=_[_0x2036('0x34')](_0x411db6,_0x2036('0x29'));_0x3255bc[_0x2036('0x35')]=_[_0x2036('0x36')](_0x3a52ab[_0x2036('0x35')]);_0x3255bc['filters']=_[_0x2036('0x37')](_0x3255bc[_0x2036('0x33')],_0x3255bc[_0x2036('0x35')]);_0x15eb9c[_0x2036('0x38')]=_[_0x2036('0x37')](_0x3255bc[_0x2036('0x33')],qs[_0x2036('0x39')](_0x3a52ab[_0x2036('0x35')][_0x2036('0x39')]));_0x15eb9c[_0x2036('0x38')]=_0x15eb9c[_0x2036('0x38')]['length']?_0x15eb9c[_0x2036('0x38')]:_0x3255bc[_0x2036('0x33')];if(!_0x3a52ab['query'][_0x2036('0x3a')]('nolimit')){_0x15eb9c[_0x2036('0x3b')]=qs['limit'](_0x3a52ab[_0x2036('0x35')][_0x2036('0x3b')]);_0x15eb9c[_0x2036('0x20')]=qs[_0x2036('0x20')](_0x3a52ab['query']['offset']);}_0x15eb9c['order']=qs[_0x2036('0x3c')](_0x3a52ab['query'][_0x2036('0x3c')]);_0x15eb9c['where']=qs[_0x2036('0x3d')](_[_0x2036('0x3e')](_0x3a52ab[_0x2036('0x35')],_0x3255bc['filters']),_0x411db6);var _0x44561e=[];var _0x3b44fc=squel[_0x2036('0x3f')]()[_0x2036('0x40')]('id')['field']('name')[_0x2036('0x40')]('color')[_0x2036('0x41')](_0x2036('0x42'));var _0xd0b69a=squel['select']()[_0x2036('0x40')]('u.id')[_0x2036('0x40')](_0x2036('0x43'))[_0x2036('0x40')](_0x2036('0x44'))[_0x2036('0x41')](_0x2036('0x45'),'ui')[_0x2036('0x46')](_0x2036('0x47'),'u',_0x2036('0x48'));var _0x5b0bd0=squel[_0x2036('0x3f')]()[_0x2036('0x41')](_0x2036('0x49'),'i')[_0x2036('0x46')](_0x2036('0x4a'),'c',_0x2036('0x4b'))[_0x2036('0x46')]('users','o',_0x2036('0x4c'))[_0x2036('0x46')](_0x2036('0x4d'),'a',_0x2036('0x4e'))['left_join'](_0x2036('0x4f'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x2036('0x46')](_0x2036('0x50'),'it',_0x2036('0x51'))[_0x2036('0x46')](_0x2036('0x42'),'t',_0x2036('0x52'));var _0xea0f49=squel[_0x2036('0x53')]();var _0x4bb133=[];var _0x1258a1=squel['expr']();var _0x267d91;if(_0x3a52ab[_0x2036('0x35')][_0x2036('0x54')]){_0x267d91=as[_0x2036('0x55')](_0x3a52ab['query'][_0x2036('0x54')]);var _0x3ba7dc=_0x267d91['sqlOperator'];for(var _0x2e43a3=0x0;_0x2e43a3<_0x267d91[_0x2036('0x56')][_0x2036('0x57')];_0x2e43a3++){var _0x1fcc9f=_0x267d91[_0x2036('0x56')][_0x2e43a3];var _0x72e9c8='i';var _0x42aeca=_['find'](_0x411db6,[_0x2036('0x29'),_0x1fcc9f[_0x2036('0x40')]]);if(!_0x42aeca){switch(_0x1fcc9f['field']){case _0x2036('0x58'):if(_0x1fcc9f[_0x2036('0x59')]==0x1){_0x5b0bd0[_0x2036('0x5a')]('`'+_0x1fcc9f[_0x2036('0x40')]+_0x2036('0x5b'));}else{_0x5b0bd0[_0x2036('0x5a')]('`'+_0x1fcc9f[_0x2036('0x40')]+_0x2036('0x5c'));}break;case _0x2036('0x5d'):if(_0x1fcc9f['operator']===_0x2036('0x5e')){if(_0x1fcc9f['value'][_0x2036('0x5f')]('\x20')[_0x2036('0x57')]>0x1){_0xea0f49[_0x3ba7dc](_0x2036('0x60'),qs['getFullTextValue'](_0x1fcc9f['value']),null);}else{var _0x862cee='%'+_0x1fcc9f['value']+'%';_0xea0f49[_0x3ba7dc](_0x2036('0x61'),_0x862cee,_0x862cee,_0x862cee);}}else{_0x42aeca=_[_0x2036('0x62')](_0x411db6,[_0x2036('0x29'),_0x2036('0x63')]);_0x1fcc9f[_0x2036('0x40')]=_0x2036('0x63');_0x225849=as[_0x2036('0x64')](_0x72e9c8,_0x42aeca[_0x2036('0x32')],_0x1fcc9f);_0xea0f49[_0x3ba7dc](_0x225849[_0x2036('0x65')],_0x225849['value'][_0x2036('0x66')],_0x225849[_0x2036('0x59')][_0x2036('0x26')]);}break;case _0x2036('0x67'):var _0x49b3e0=_0x1fcc9f[_0x2036('0x59')][_0x2036('0x5f')](',')[_0x2036('0x34')](function(_0x22dd31){return Number(_0x22dd31);});_0x49b3e0[_0x2036('0x68')](function(_0x5f06c3){_0x1258a1['or'](_0x2036('0x69'),'%,'+_0x5f06c3+',%');});_0x4bb133=_[_0x2036('0x6a')](_0x4bb133,_0x49b3e0);break;case _0x2036('0x6b'):if(_0x1fcc9f['operator']===_0x2036('0x5e')){_0xea0f49[_0x3ba7dc]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1fcc9f['value']+'%',null);}else{_0x42aeca=_[_0x2036('0x62')](_0x411db6,[_0x2036('0x29'),_0x2036('0x6c')]);_0x1fcc9f['field']='UserId';_0x225849=as['buildExpression'](_0x72e9c8,_0x42aeca[_0x2036('0x32')],_0x1fcc9f);_0xea0f49[_0x3ba7dc](_0x225849[_0x2036('0x65')],_0x225849[_0x2036('0x59')][_0x2036('0x66')],_0x225849[_0x2036('0x59')][_0x2036('0x26')]);}break;case _0x2036('0x6d'):_0x225849=as['buildExpression']('me',null,_0x1fcc9f);_0xea0f49[_0x3ba7dc](_0x225849[_0x2036('0x65')],_0x225849[_0x2036('0x59')][_0x2036('0x66')],_0x225849[_0x2036('0x59')][_0x2036('0x26')]);break;}}else{var _0x225849=as[_0x2036('0x64')](_0x72e9c8,_0x42aeca['type'],_0x1fcc9f);_0xea0f49[_0x3ba7dc](_0x225849[_0x2036('0x65')],_0x225849[_0x2036('0x59')][_0x2036('0x66')],_0x225849[_0x2036('0x59')][_0x2036('0x26')]);}}}else{var _0x19c07d=_(_0x3a52ab[_0x2036('0x35')])['keys']()[_0x2036('0x34')](function(_0x3be698){return _[_0x2036('0x6e')](_0x411db6,['name',_0x3be698])?_0x3be698:undefined;})['compact']()[_0x2036('0x59')]();if(!_[_0x2036('0x6f')](_0x19c07d)){_0x19c07d[_0x2036('0x68')](function(_0x43715a){if(_0x43715a==='SmsAccountId'){_0x5b0bd0[_0x2036('0x70')](_0x2036('0x71'),[][_0x2036('0x72')](_0x3a52ab['query'][_0x43715a]));}else if(_0x43715a===_0x2036('0x73')){var _0x5bbbff=JSON[_0x2036('0x74')](_0x3a52ab[_0x2036('0x35')][_0x43715a])[_0x2036('0x75')];var _0x5bc15d=JSON['parse'](_0x3a52ab['query'][_0x43715a])[_0x2036('0x76')];_0x5b0bd0[_0x2036('0x70')](_0x2036('0x77'),_0x5bbbff,_0x5bc15d);}else{if(_0x3a52ab[_0x2036('0x35')][_0x43715a]===_0x2036('0x78')){_0x5b0bd0[_0x2036('0x70')]('i.'+_0x43715a+_0x2036('0x79'));}else{_0x5b0bd0[_0x2036('0x70')]('i.'+_0x43715a+_0x2036('0x7a'),_0x3a52ab[_0x2036('0x35')][_0x43715a]);}}});}if(_0x3a52ab[_0x2036('0x35')][_0x2036('0x7b')]){if(_0x3a52ab[_0x2036('0x35')][_0x2036('0x7b')]==0x1){_0x5b0bd0['having']('`unreadMessages`\x20=\x200');}else{_0x5b0bd0[_0x2036('0x5a')](_0x2036('0x7c'));}}if(_0x3a52ab[_0x2036('0x35')]['tag']){_0x4bb133=_[_0x2036('0x7d')](_0x3a52ab['query']['tag'])?_0x3a52ab[_0x2036('0x35')]['tag']:new Array(_0x3a52ab['query'][_0x2036('0x7e')]);_0x4bb133['forEach'](function(_0x79bfe1){_0x1258a1['or'](_0x2036('0x69'),'%,'+_0x79bfe1+',%');});}if(_0x3a52ab['query'][_0x2036('0x7f')]){var _0x30caee=_0x3a52ab[_0x2036('0x35')]['filter'][_0x2036('0x80')]('\x5c','\x5c\x5c')[_0x2036('0x80')](/'/g,'\x27\x27');if(qs[_0x2036('0x81')](_0x30caee)){_0xea0f49['or']('i.id\x20LIKE\x20?',_0x30caee+'%')['or'](_0x2036('0x82'),_0x30caee+'%');}else{_0xea0f49['or'](_0x2036('0x83'),qs[_0x2036('0x84')](_0x30caee))['or'](_0x2036('0x85'),_0x30caee+'%');}}}_0x5b0bd0[_0x2036('0x70')](_0xea0f49);_0x5b0bd0[_0x2036('0x86')](_0x2036('0x87'));var _0x34b019={'type':db[_0x2036('0x88')][_0x2036('0x89')][_0x2036('0x8a')],'raw':!![]};var _0x270aaf=_0x5b0bd0[_0x2036('0x8b')]();_0x270aaf[_0x2036('0x40')](_0x2036('0x87'));_0x270aaf[_0x2036('0x40')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x15eb9c[_0x2036('0x8c')]){_0x15eb9c['order'][_0x2036('0x68')](function(_0x48922a){var _0x3f7b34=_0x48922a[0x0]===_0x2036('0x8d')?_0x48922a[0x0]:'i.'+_0x48922a[0x0];_0x5b0bd0['order'](_0x3f7b34,_0x48922a[0x1]===_0x2036('0x8e')?![]:!![]);});}if(!_[_0x2036('0x6f')](_0x4bb133)){_0x5b0bd0['having'](_0x1258a1);_0x270aaf[_0x2036('0x70')](_0x2036('0x8f'),_0x4bb133);}BPromise[_0x2036('0x90')]()[_0x2036('0x25')](function(){if(!_0x267d91){if(_0x3a52ab[_0x2036('0x35')][_0x2036('0x91')])return;_0x270aaf[_0x2036('0x70')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x5b0bd0['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3a52ab[_0x2036('0x92')]['role']!==_0x2036('0x93'))return;return _0x3a52ab[_0x2036('0x92')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x2036('0x25')](function(_0x3de0f3){if(_[_0x2036('0x6f')](_0x3de0f3)){_0x270aaf[_0x2036('0x70')](_0x2036('0x94'));_0x5b0bd0[_0x2036('0x70')](_0x2036('0x94'));}else{_0x270aaf[_0x2036('0x70')](_0x2036('0x71'),_[_0x2036('0x34')](_0x3de0f3,'id'));_0x5b0bd0[_0x2036('0x70')]('i.SmsAccountId\x20IN\x20?',_[_0x2036('0x34')](_0x3de0f3,'id'));}});})['then'](function(){if(_0x3a52ab[_0x2036('0x92')]['role']==='agent'&&!_0x267d91&&!_0x3a52ab[_0x2036('0x35')][_0x2036('0x91')])return[];return db[_0x2036('0x95')][_0x2036('0x35')](_0x270aaf[_0x2036('0x96')](),_0x34b019);})['then'](function(_0x5f2f41){_0x580b5e[_0x2036('0x1f')]=_0x5f2f41[_0x2036('0x57')];if(_0x580b5e[_0x2036('0x1f')]===0x0)return[];return db[_0x2036('0x95')][_0x2036('0x35')](_0x3b44fc[_0x2036('0x96')](),_0x34b019)[_0x2036('0x25')](function(_0x1692b0){_0x44561e=_[_0x2036('0x97')](_0x1692b0,'id');_0x34b019=_[_0x2036('0x98')](_0x34b019,{'model':db[_0x2036('0x2f')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3a52ab[_0x2036('0x35')][_0x2036('0x39')]){_0x15eb9c['attributes'][_0x2036('0x68')](function(_0x52164c){_0x5b0bd0['field']('i.'+_0x52164c);});}else{_0x5b0bd0[_0x2036('0x40')](_0x2036('0x99'),_0x2036('0x58'));_0x5b0bd0[_0x2036('0x40')](_0x2036('0x9a'),_0x2036('0x9b'));_0x5b0bd0[_0x2036('0x40')](_0x2036('0x9c'),_0x2036('0x9d'));_0x5b0bd0[_0x2036('0x40')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x5b0bd0[_0x2036('0x40')]('i.*');_0x5b0bd0[_0x2036('0x40')](_0x2036('0x9e'),_0x2036('0x9f'));_0x5b0bd0['field'](_0x2036('0xa0'),_0x2036('0xa1'));_0x5b0bd0['field'](_0x2036('0xa2'),_0x2036('0xa3'));_0x5b0bd0['field'](_0x2036('0xa4'),'Contact.phone');_0x5b0bd0[_0x2036('0x40')](_0x2036('0xa5'),_0x2036('0xa6'));_0x5b0bd0[_0x2036('0x40')]('c.fax',_0x2036('0xa7'));_0x5b0bd0[_0x2036('0x40')](_0x2036('0xa8'),'Owner.fullname');_0x5b0bd0[_0x2036('0x40')](_0x2036('0xa9'),_0x2036('0xaa'));_0x5b0bd0[_0x2036('0x40')](_0x2036('0xab'),'TagIds');}if(_0x15eb9c[_0x2036('0x3b')])_0x5b0bd0[_0x2036('0x3b')](_0x15eb9c[_0x2036('0x3b')]);if(_0x15eb9c[_0x2036('0x20')])_0x5b0bd0[_0x2036('0x20')](_0x15eb9c[_0x2036('0x20')]);return db['sequelize'][_0x2036('0x35')](_0x5b0bd0['toString'](),_0x34b019);})[_0x2036('0x25')](function(_0x225fad){if(_0x225fad[_0x2036('0x57')]>0x0)_0xd0b69a[_0x2036('0x70')]('ui.SmsInteractionId\x20IN\x20?',_[_0x2036('0x34')](_0x225fad,'id'));return db[_0x2036('0x95')][_0x2036('0x35')](_0xd0b69a['toString'](),_0x34b019)[_0x2036('0x25')](function(_0x32b989){var _0x481d82=_[_0x2036('0xac')](_0x32b989,_0x2036('0xad'));var _0x29e519=[];_0x225fad[_0x2036('0x68')](function(_0x346716){_0x29e519['push'](updateSmsInteraction(_0x346716,_0x44561e,_0x481d82));});return BPromise[_0x2036('0xae')](_0x29e519);});});})[_0x2036('0x25')](function(_0x1244f0){_0x580b5e[_0x2036('0xaf')]=_0x1244f0;return _0x580b5e;})[_0x2036('0x25')](respondWithFilteredResult(_0x1cbc7e,_0x15eb9c))[_0x2036('0x2e')](handleError(_0x1cbc7e,null));};exports[_0x2036('0xb0')]=function(_0x4ad701,_0x3c5420){var _0x1102b8={'raw':![],'where':{'id':_0x4ad701[_0x2036('0xb1')]['id']}},_0x5aef49={};_0x5aef49[_0x2036('0x33')]=_[_0x2036('0x36')](db[_0x2036('0x2f')][_0x2036('0x30')]);_0x5aef49[_0x2036('0x35')]=_[_0x2036('0x36')](_0x4ad701['query']);_0x5aef49[_0x2036('0x3d')]=_[_0x2036('0x37')](_0x5aef49[_0x2036('0x33')],_0x5aef49['query']);_0x1102b8['attributes']=_['intersection'](_0x5aef49['model'],qs[_0x2036('0x39')](_0x4ad701['query'][_0x2036('0x39')]));_0x1102b8[_0x2036('0x38')]=_0x1102b8[_0x2036('0x38')][_0x2036('0x57')]?_0x1102b8[_0x2036('0x38')]:_0x5aef49[_0x2036('0x33')];if(_0x4ad701[_0x2036('0x35')][_0x2036('0xb2')]){_0x1102b8[_0x2036('0xb3')]=[{'all':!![]}];}_0x1102b8=_['merge']({},_0x1102b8,_0x4ad701[_0x2036('0xb4')]);return db[_0x2036('0x2f')][_0x2036('0x62')](_0x1102b8)[_0x2036('0x25')](handleEntityNotFound(_0x3c5420,null))['then'](respondWithResult(_0x3c5420,null))['catch'](handleError(_0x3c5420,null));};exports[_0x2036('0xb5')]=function(_0x1e7629,_0x344291){return db[_0x2036('0x2f')][_0x2036('0xb5')](_0x1e7629['body'],{})[_0x2036('0x25')](respondWithResult(_0x344291,0xc9))[_0x2036('0x2e')](handleError(_0x344291,null));};exports[_0x2036('0x24')]=function(_0x588a29,_0x258ef5){if(_0x588a29[_0x2036('0x6d')]['id']){delete _0x588a29[_0x2036('0x6d')]['id'];}return db[_0x2036('0x2f')][_0x2036('0x62')]({'where':{'id':_0x588a29[_0x2036('0xb1')]['id']}})[_0x2036('0x25')](handleEntityNotFound(_0x258ef5,null))[_0x2036('0x25')](saveUpdates(_0x588a29['body'],null))[_0x2036('0x25')](respondWithResult(_0x258ef5,null))[_0x2036('0x2e')](handleError(_0x258ef5,null));};exports[_0x2036('0xb6')]=function(_0x39551b,_0x1b0a2d){return db[_0x2036('0x2f')][_0x2036('0x62')]({'where':{'id':_0x39551b[_0x2036('0xb1')]['id']}})[_0x2036('0x25')](handleEntityNotFound(_0x1b0a2d,null))[_0x2036('0x25')](removeEntity(_0x1b0a2d,null))[_0x2036('0x2e')](handleError(_0x1b0a2d,null));};exports[_0x2036('0xb7')]=function(_0x339cc7,_0x121924){return db['SmsInteraction'][_0x2036('0xb7')]()[_0x2036('0x25')](respondWithResult(_0x121924,null))[_0x2036('0x2e')](handleError(_0x121924,null));};exports[_0x2036('0xb8')]=function(_0x54d75d,_0x236f8c,_0x3c0530){return db[_0x2036('0xb9')]['find']({'where':{'id':_0x54d75d[_0x2036('0xb1')]['id']}})[_0x2036('0x25')](handleEntityNotFound(_0x236f8c,null))[_0x2036('0x25')](function(_0x566853){if(_0x566853){return _0x566853['addMessage'](_0x54d75d['body'][_0x2036('0xba')],_['omit'](_0x54d75d[_0x2036('0x6d')],[_0x2036('0xba'),'id'])||{});}})[_0x2036('0x25')](respondWithResult(_0x236f8c,null))[_0x2036('0x2e')](handleError(_0x236f8c,null));};exports['getMessages']=function(_0x41ade8,_0x4cc956,_0x17b4eb){var _0x2589bd={'raw':![],'where':{}};var _0x242f6f={};var _0x2e4920={'count':0x0,'rows':[]};return db[_0x2036('0x2f')]['findOne']({'where':{'id':_0x41ade8[_0x2036('0xb1')]['id']}})['then'](handleEntityNotFound(_0x4cc956,null))['then'](function(_0x12eeee){if(_0x12eeee){_0x242f6f[_0x2036('0x33')]=_[_0x2036('0x36')](db[_0x2036('0xb9')]['rawAttributes']);_0x242f6f['query']=_[_0x2036('0x36')](_0x41ade8[_0x2036('0x35')]);_0x242f6f[_0x2036('0x3d')]=_['intersection'](_0x242f6f['model'],_0x242f6f[_0x2036('0x35')]);_0x2589bd[_0x2036('0x38')]=_['intersection'](_0x242f6f[_0x2036('0x33')],qs[_0x2036('0x39')](_0x41ade8[_0x2036('0x35')][_0x2036('0x39')]));_0x2589bd[_0x2036('0x38')]=_0x2589bd[_0x2036('0x38')][_0x2036('0x57')]?_0x2589bd[_0x2036('0x38')]:_0x242f6f['model'];if(!_0x41ade8['query']['hasOwnProperty']('nolimit')){_0x2589bd[_0x2036('0x3b')]=qs[_0x2036('0x3b')](_0x41ade8[_0x2036('0x35')][_0x2036('0x3b')]);_0x2589bd['offset']=qs['offset'](_0x41ade8[_0x2036('0x35')]['offset']);}_0x2589bd[_0x2036('0x8c')]=qs['sort'](_0x41ade8[_0x2036('0x35')][_0x2036('0x3c')]);_0x2589bd[_0x2036('0x70')]=qs[_0x2036('0x3d')](_[_0x2036('0x3e')](_0x41ade8['query'],_0x242f6f[_0x2036('0x3d')]));_0x2589bd[_0x2036('0x70')][_0x2036('0xad')]=_0x12eeee['id'];if(_0x41ade8[_0x2036('0x35')][_0x2036('0x7f')]){_0x2589bd[_0x2036('0x70')]=_[_0x2036('0x98')](_0x2589bd[_0x2036('0x70')],{'$or':_[_0x2036('0x34')](_0x2589bd['attributes'],function(_0x238a9a){var _0x112f93={};_0x112f93[_0x238a9a]={'$like':'%'+_0x41ade8[_0x2036('0x35')][_0x2036('0x7f')]+'%'};return _0x112f93;})});}if(_0x41ade8['query'][_0x2036('0x75')]){var _0x29881a=_0x41ade8[_0x2036('0x35')][_0x2036('0x75')][_0x2036('0x5f')](',');var _0x31e7be={};_0x31e7be[_0x29881a[0x0]]={'$gte':moment(_0x29881a[0x1])[_0x2036('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2589bd[_0x2036('0x70')]=_['merge'](_0x2589bd['where'],_0x31e7be);}_0x2589bd=_['merge']({},_0x2589bd,_0x41ade8[_0x2036('0xb4')]);return db[_0x2036('0xb9')][_0x2036('0x1f')]({'where':_0x2589bd[_0x2036('0x70')]})[_0x2036('0x25')](function(_0x5d0c1e){_0x2e4920[_0x2036('0x1f')]=_0x5d0c1e;if(_0x41ade8['query'][_0x2036('0xb2')]){_0x2589bd['include']=[{'all':!![]}];}return db[_0x2036('0xb9')][_0x2036('0xbc')](_0x2589bd);})['then'](function(_0x341ea9){_0x2e4920[_0x2036('0xaf')]=_0x341ea9;return _0x2e4920;});}})[_0x2036('0x25')](respondWithFilteredResult(_0x4cc956,_0x2589bd))[_0x2036('0x2e')](handleError(_0x4cc956,null));};exports[_0x2036('0xbd')]=function(_0x17b283,_0x51810f,_0x5a7f77){return db[_0x2036('0x2f')][_0x2036('0x62')]({'where':{'id':_0x17b283['params']['id']}})[_0x2036('0x25')](handleEntityNotFound(_0x51810f,null))[_0x2036('0x25')](function(_0x54fa63){if(_0x54fa63){return _0x54fa63['setTags'](_0x17b283[_0x2036('0x6d')][_0x2036('0xba')],_[_0x2036('0xbe')](_0x17b283[_0x2036('0x6d')],[_0x2036('0xba'),'id'])||{})['spread'](function(){return db[_0x2036('0x67')]['findAll']({'attributes':['id',_0x2036('0x29'),_0x2036('0xbf')],'where':{'id':_0x17b283[_0x2036('0x6d')]['ids']}});})['then'](function(_0x55821f){socket['emit'](_0x2036('0xc0'),{'id':Number(_0x17b283[_0x2036('0xb1')]['id']),'tags':_0x55821f||[]});return{'id':Number(_0x17b283[_0x2036('0xb1')]['id']),'tags':_0x55821f||[]};});}})[_0x2036('0x25')](respondWithResult(_0x51810f,null))[_0x2036('0x2e')](handleError(_0x51810f,null));};exports[_0x2036('0xc1')]=function(_0xa7513c,_0x3e08ff,_0xe0980){return db[_0x2036('0x2f')][_0x2036('0x62')]({'where':{'id':_0xa7513c['params']['id']}})[_0x2036('0x25')](handleEntityNotFound(_0x3e08ff,null))[_0x2036('0x25')](function(_0x20c63a){if(_0x20c63a){return _0x20c63a[_0x2036('0xc1')](_0xa7513c[_0x2036('0x35')]['ids']);}})[_0x2036('0x25')](respondWithStatusCode(_0x3e08ff,null))[_0x2036('0x2e')](handleError(_0x3e08ff,null));};exports[_0x2036('0xc2')]=function(_0x52fe8d,_0xf6799f){var _0x160a4e=moment()[_0x2036('0xc3')]()[_0x2036('0x96')]();var _0x5a25bf=path['join'](config[_0x2036('0xc4')],_0x2036('0xc5'),'files',_0x2036('0xc6'));var _0x227904=path['join'](config[_0x2036('0xc4')],'server','files','attachments');var _0x43bb4d=path[_0x2036('0xc7')](_0x5a25bf,_0x160a4e);var _0x3fb248=util[_0x2036('0xbb')](_0x2036('0xc8'),_0x52fe8d[_0x2036('0xb1')]['id'],_0x160a4e);var _0x136f1b=path['join'](_0x5a25bf,_0x3fb248);var _0x363309=[];_0x363309[_0x2036('0xc9')]({'model':db[_0x2036('0x6b')],'as':_0x2036('0x6b'),'attributes':['id',_0x2036('0x2b')],'raw':!![]});_0x363309[_0x2036('0xc9')]({'model':db[_0x2036('0xca')],'as':_0x2036('0x5d'),'attributes':['id','firstName',_0x2036('0xcb')],'raw':!![]});var _0xbfdfe5=[{'model':db[_0x2036('0xb9')],'as':_0x2036('0xcc'),'attributes':['id',_0x2036('0x6d'),_0x2036('0x73'),'direction',_0x2036('0xcd'),_0x2036('0x7b')],'include':_0x363309}];_0xbfdfe5[_0x2036('0xc9')]({'model':db[_0x2036('0xce')],'as':_0x2036('0xcf'),'attributes':['id','name']});_0xbfdfe5[_0x2036('0xc9')]({'model':db[_0x2036('0x6b')],'as':_0x2036('0xd0'),'attributes':['id','fullname']});return db[_0x2036('0x2f')][_0x2036('0x62')]({'where':{'id':_0x52fe8d[_0x2036('0xb1')]['id']},'include':_0xbfdfe5})[_0x2036('0x25')](handleEntityNotFound(_0xf6799f,null))[_0x2036('0x25')](function(_0x134bda){if(_0x134bda){var _0x2e8f9e=_0x134bda[_0x2036('0xd1')]({'plain':!![]});fs[_0x2036('0xd2')](_0x43bb4d);var _0x5d0412={'channel':_0x2036('0xd3'),'account':_0x2e8f9e[_0x2036('0xcf')][_0x2036('0x29')],'agent':_0x2e8f9e['Owner']?_0x2e8f9e[_0x2036('0xd0')]['fullname']:_0x2036('0xd4'),'createdAt':moment(_0x2e8f9e['createdAt'])[_0x2036('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2036('0x96')](),'closedAt':_0x2e8f9e[_0x2036('0xd5')]?moment(_0x2e8f9e[_0x2036('0xd6')])[_0x2036('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2036('0x96')]():'','disposition':_0x2e8f9e[_0x2036('0xd7')],'messages':_(_0x2e8f9e[_0x2036('0xcc')])[_0x2036('0x7f')]({'secret':![]})['map'](function(_0x419d33){return{'date':moment(_0x419d33['createdAt'])[_0x2036('0xbb')](_0x2036('0xd8'))[_0x2036('0x96')](),'sender':_0x419d33['direction']===_0x2036('0xd9')?_0x419d33[_0x2036('0x6b')]?_0x419d33[_0x2036('0x6b')][_0x2036('0x2b')]:_0x2036('0xda'):_0x419d33[_0x2036('0x5d')]['firstName']+(_0x419d33[_0x2036('0x5d')]['lastName']?'\x20'+_0x419d33[_0x2036('0x5d')][_0x2036('0xcb')]:''),'body':_0x419d33['body'],'direction':_0x419d33['direction']===_0x2036('0xd9')?'A':'C','secret':_0x419d33[_0x2036('0xcd')],'read':_0x419d33[_0x2036('0x7b')]};})[_0x2036('0x59')]()};return ejs[_0x2036('0xdb')](path[_0x2036('0xc7')](config[_0x2036('0xc4')],_0x2036('0xc5'),_0x2036('0xdc'),_0x2036('0xdd')),{'interaction':_0x5d0412})[_0x2036('0x25')](function(_0x11045f){var _0xa4d3d2=path[_0x2036('0xc7')](_0x43bb4d,_0x2036('0xde')+_0x2e8f9e['id']+'-'+_0x160a4e+_0x2036('0xdf'));var _0x24604b={'path':_0xa4d3d2,'channel':_0x2036('0xd3'),'interactionId':_0x2e8f9e['id']};return pdf[_0x2036('0xe0')](_0x11045f,_0x24604b);})['then'](function(){return new BPromise(function(_0x3d37ed,_0x59145c){zipdir(_0x43bb4d,{'saveTo':_0x136f1b},function(_0x52431b,_0x4e1bd3){if(_0x52431b)return _0x59145c(_0x52431b);return _0x3d37ed(_0x4e1bd3);});})[_0x2036('0x25')](function(){return new BPromise(function(_0x37973b,_0x4e264a){rimraf(_0x43bb4d,function(_0xad15d8){if(_0xad15d8)_0x4e264a(_0xad15d8);return _0x37973b();});});})[_0x2036('0x25')](function(){return _0xf6799f['download'](_0x136f1b,_0x3fb248,function(_0x187e27){if(_0x187e27){console[_0x2036('0xe1')](_0x2036('0xe2'),_0x187e27);}else{fs[_0x2036('0xe3')](_0x136f1b);}});});});}else{return _0xf6799f[_0x2036('0x27')](0xc8);}})[_0x2036('0x2e')](handleError(_0xf6799f,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index f9c8592..ced3466 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 _0x065e=['emit','catch','hasOwnProperty','events','SmsMessage','setMaxListeners','save','getUsers','then','setDataValue','map','findAll','unreadMessages','length'];(function(_0x305a92,_0x5d949c){var _0x535ff7=function(_0x3b513d){while(--_0x3b513d){_0x305a92['push'](_0x305a92['shift']());}};_0x535ff7(++_0x5d949c);}(_0x065e,0x1a7));var _0xe065=function(_0x4cef0d,_0x5053c2){_0x4cef0d=_0x4cef0d-0x0;var _0x2dbd60=_0x065e[_0x4cef0d];return _0x2dbd60;};'use strict';var EventEmitter=require(_0xe065('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require('../../mysqldb')['db'][_0xe065('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xe065('0x2')](0x0);var events={'afterCreate':_0xe065('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4610a3){return function(_0x2f90aa,_0x5b099e,_0x10b45f){_0x2f90aa[_0xe065('0x4')]({'attributes':['id'],'raw':!![]})[_0xe065('0x5')](function(_0x52403a){_0x2f90aa[_0xe065('0x6')]('Users',_0x52403a[_0xe065('0x7')](function(_0x2f072e){return{'id':_0x2f072e['id']};}));return SmsMessage[_0xe065('0x8')]({'where':{'SmsInteractionId':_0x2f90aa['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe065('0x5')](function(_0x85001e){_0x2f90aa['setDataValue'](_0xe065('0x9'),_0x85001e[_0xe065('0xa')]);SmsInteractionEvents[_0xe065('0xb')](_0x4610a3+':'+_0x2f90aa['id'],_0x2f90aa);SmsInteractionEvents[_0xe065('0xb')](_0x4610a3,_0x2f90aa);_0x10b45f(null);})[_0xe065('0xc')](_0x10b45f(null));};}for(var e in events){if(events[_0xe065('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x4888=['../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers','then','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x5e269d,_0x1b6492){var _0x38f86d=function(_0x2f6883){while(--_0x2f6883){_0x5e269d['push'](_0x5e269d['shift']());}};_0x38f86d(++_0x1b6492);}(_0x4888,0x198));var _0x8488=function(_0x27ccb6,_0x103913){_0x27ccb6=_0x27ccb6-0x0;var _0x412043=_0x4888[_0x27ccb6];return _0x412043;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x8488('0x0'))['db'][_0x8488('0x1')];var SmsMessage=require(_0x8488('0x0'))['db'][_0x8488('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x8488('0x3')](0x0);var events={'afterCreate':_0x8488('0x4'),'afterUpdate':_0x8488('0x5'),'afterDestroy':'remove'};function emitEvent(_0x267093){return function(_0xf45c3f,_0x1a97f4,_0x421292){_0xf45c3f[_0x8488('0x6')]({'attributes':['id'],'raw':!![]})[_0x8488('0x7')](function(_0x5250a1){_0xf45c3f['setDataValue']('Users',_0x5250a1['map'](function(_0x151528){return{'id':_0x151528['id']};}));return SmsMessage[_0x8488('0x8')]({'where':{'SmsInteractionId':_0xf45c3f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x19c994){_0xf45c3f[_0x8488('0x9')](_0x8488('0xa'),_0x19c994[_0x8488('0xb')]);SmsInteractionEvents['emit'](_0x267093+':'+_0xf45c3f['id'],_0xf45c3f);SmsInteractionEvents[_0x8488('0xc')](_0x267093,_0xf45c3f);_0x421292(null);})[_0x8488('0xd')](_0x421292(null));};}for(var e in events){if(events[_0x8488('0xe')](e)){var event=events[e];SmsInteraction[_0x8488('0xf')](e,emitEvent(event));}}module[_0x8488('0x10')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index fa41cfb..dc829e6 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 _0x5c6a=['define','SmsInteraction','sms_interactions','changed','closed','format','lodash','util','api','moment','path','../../config/environment','./smsInteraction.attributes','exports'];(function(_0x291cd4,_0x44288d){var _0x3bc45c=function(_0x8011cc){while(--_0x8011cc){_0x291cd4['push'](_0x291cd4['shift']());}};_0x3bc45c(++_0x44288d);}(_0x5c6a,0xa0));var _0xa5c6=function(_0x8186c,_0x4b0323){_0x8186c=_0x8186c-0x0;var _0x177da4=_0x5c6a[_0x8186c];return _0x177da4;};'use strict';var _=require(_0xa5c6('0x0'));var util=require(_0xa5c6('0x1'));var logger=require('../../config/logger')(_0xa5c6('0x2'));var moment=require(_0xa5c6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5c6('0x4'));var rimraf=require('rimraf');var config=require(_0xa5c6('0x5'));var attributes=require(_0xa5c6('0x6'));module[_0xa5c6('0x7')]=function(_0x591dab,_0x1cf208){return _0x591dab[_0xa5c6('0x8')](_0xa5c6('0x9'),attributes,{'tableName':_0xa5c6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3081ea,_0x4860c2,_0x297fd5){if(_0x3081ea[_0xa5c6('0xb')](_0xa5c6('0xc'))){_0x3081ea['closedAt']=moment()[_0xa5c6('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x297fd5(null,_0x3081ea);}}});}; \ No newline at end of file +var _0x4d98=['SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./smsInteraction.attributes','exports'];(function(_0x5affff,_0x2c0ef9){var _0x3129db=function(_0x513e83){while(--_0x513e83){_0x5affff['push'](_0x5affff['shift']());}};_0x3129db(++_0x2c0ef9);}(_0x4d98,0xa7));var _0x84d9=function(_0x2350c0,_0x422b5f){_0x2350c0=_0x2350c0-0x0;var _0xfc82e5=_0x4d98[_0x2350c0];return _0xfc82e5;};'use strict';var _=require('lodash');var util=require(_0x84d9('0x0'));var logger=require(_0x84d9('0x1'))(_0x84d9('0x2'));var moment=require('moment');var BPromise=require(_0x84d9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x84d9('0x4'));var rimraf=require(_0x84d9('0x5'));var config=require(_0x84d9('0x6'));var attributes=require(_0x84d9('0x7'));module[_0x84d9('0x8')]=function(_0xc3e58,_0x5f2b94){return _0xc3e58['define'](_0x84d9('0x9'),attributes,{'tableName':_0x84d9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f9c60,_0xd7aa57,_0x4f2fbc){if(_0x3f9c60[_0x84d9('0xb')](_0x84d9('0xc'))){_0x3f9c60[_0x84d9('0xd')]=moment()[_0x84d9('0xe')](_0x84d9('0xf'));}_0x4f2fbc(null,_0x3f9c60);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 7cab028..83dbbdd 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 _0x8c76=['AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','body','options','raw','attributes','UpdateSmsInteraction','stringify','AddTagsToSmsInteraction','SmsInteraction','where','addTags','ids','omit','spread'];(function(_0x1569cd,_0x16b7c2){var _0xa11350=function(_0x2146d9){while(--_0x2146d9){_0x1569cd['push'](_0x1569cd['shift']());}};_0xa11350(++_0x16b7c2);}(_0x8c76,0x1c4));var _0x68c7=function(_0x19d53b,_0x11dbb5){_0x19d53b=_0x19d53b-0x0;var _0x34076b=_0x8c76[_0x19d53b];return _0x34076b;};'use strict';var _=require(_0x68c7('0x0'));var util=require(_0x68c7('0x1'));var moment=require(_0x68c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x68c7('0x3'));var fs=require('fs');var Redis=require(_0x68c7('0x4'));var db=require(_0x68c7('0x5'))['db'];var utils=require(_0x68c7('0x6'));var logger=require(_0x68c7('0x7'))('rpc');var config=require(_0x68c7('0x8'));var jayson=require(_0x68c7('0x9'));var client=jayson[_0x68c7('0xa')][_0x68c7('0xb')]({'port':0x232a});config[_0x68c7('0xc')]=_[_0x68c7('0xd')](config[_0x68c7('0xc')],{'host':_0x68c7('0xe'),'port':0x18eb});var socket=require(_0x68c7('0xf'))(new Redis(config[_0x68c7('0xc')]));require(_0x68c7('0x10'))['register'](socket);function respondWithRpcPromise(_0x7c5a2a,_0x201162,_0x490169){return new BPromise(function(_0x4aa3d8,_0x2840e7){return client[_0x68c7('0x11')](_0x7c5a2a,_0x490169)[_0x68c7('0x12')](function(_0x1f2579){logger[_0x68c7('0x13')](_0x68c7('0x14'),_0x201162,_0x68c7('0x15'));logger[_0x68c7('0x16')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x201162,_0x68c7('0x15'),JSON['stringify'](_0x1f2579));if(_0x1f2579[_0x68c7('0x17')]){if(_0x1f2579[_0x68c7('0x17')][_0x68c7('0x18')]===0x1f4){logger[_0x68c7('0x17')](_0x68c7('0x14'),_0x201162,_0x1f2579['error'][_0x68c7('0x19')]);return _0x2840e7(_0x1f2579['error'][_0x68c7('0x19')]);}logger['error'](_0x68c7('0x14'),_0x201162,_0x1f2579['error']['message']);return _0x4aa3d8(_0x1f2579['error'][_0x68c7('0x19')]);}else{logger[_0x68c7('0x13')](_0x68c7('0x14'),_0x201162,'request\x20sent');_0x4aa3d8(_0x1f2579['result'][_0x68c7('0x19')]);}})[_0x68c7('0x1a')](function(_0x5f054e){logger[_0x68c7('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x201162,_0x5f054e);_0x2840e7(_0x5f054e);});});}exports['UpdateSmsInteraction']=function(_0x522ddd){var _0x53c06d=this;return new Promise(function(_0x46b141,_0x2d3594){return db['SmsInteraction']['update'](_0x522ddd[_0x68c7('0x1b')],{'raw':_0x522ddd['options']?_0x522ddd[_0x68c7('0x1c')][_0x68c7('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x522ddd['options']?_0x522ddd['options']['where']||null:null,'attributes':_0x522ddd[_0x68c7('0x1c')]?_0x522ddd[_0x68c7('0x1c')][_0x68c7('0x1e')]||null:null,'limit':_0x522ddd['options']?_0x522ddd[_0x68c7('0x1c')]['limit']||null:null})[_0x68c7('0x12')](function(_0x4be735){logger['info'](_0x68c7('0x1f'),_0x522ddd);logger[_0x68c7('0x16')](_0x68c7('0x1f'),_0x522ddd,JSON[_0x68c7('0x20')](_0x4be735));_0x46b141(_0x4be735);})[_0x68c7('0x1a')](function(_0x2719c7){logger[_0x68c7('0x17')](_0x68c7('0x1f'),_0x2719c7['message'],_0x522ddd);_0x2d3594(_0x53c06d['error'](0x1f4,_0x2719c7[_0x68c7('0x19')]));});});};exports[_0x68c7('0x21')]=function(_0x349f43){return new Promise(function(_0x1a2b9f,_0x3e1564){return db[_0x68c7('0x22')]['find']({'where':_0x349f43['options']?_0x349f43[_0x68c7('0x1c')][_0x68c7('0x23')]||null:null})['then'](function(_0x55c46f){if(_0x55c46f){return _0x55c46f[_0x68c7('0x24')](_0x349f43[_0x68c7('0x1b')][_0x68c7('0x25')],_[_0x68c7('0x26')](_0x349f43[_0x68c7('0x1b')],[_0x68c7('0x25'),'id'])||{});}})[_0x68c7('0x27')](function(_0x254ef4){logger[_0x68c7('0x13')]('AddTags',_0x349f43);logger[_0x68c7('0x16')](_0x68c7('0x28'),_0x349f43,JSON[_0x68c7('0x20')](_0x254ef4));_0x1a2b9f(_0x254ef4);})['catch'](function(_0x269ccd){logger[_0x68c7('0x17')](_0x68c7('0x28'),_0x269ccd[_0x68c7('0x19')],_0x349f43);_0x3e1564(_this[_0x68c7('0x17')](0x1f4,_0x269ccd[_0x68c7('0x19')]));});});}; \ No newline at end of file +var _0x186a=['debug','AddTagsToSmsInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsInteraction','update','raw','where','options','attributes','limit','UpdateSmsInteraction'];(function(_0x4c630b,_0x25f8ef){var _0x181259=function(_0x5d0e58){while(--_0x5d0e58){_0x4c630b['push'](_0x4c630b['shift']());}};_0x181259(++_0x25f8ef);}(_0x186a,0xbd));var _0xa186=function(_0xd48e03,_0xeac46a){_0xd48e03=_0xd48e03-0x0;var _0x4b7a26=_0x186a[_0xd48e03];return _0x4b7a26;};'use strict';var _=require(_0xa186('0x0'));var util=require(_0xa186('0x1'));var moment=require('moment');var BPromise=require(_0xa186('0x2'));var rs=require(_0xa186('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa186('0x4'))['db'];var utils=require(_0xa186('0x5'));var logger=require(_0xa186('0x6'))(_0xa186('0x7'));var config=require(_0xa186('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa186('0x9')][_0xa186('0xa')]({'port':0x232a});config[_0xa186('0xb')]=_[_0xa186('0xc')](config['redis'],{'host':_0xa186('0xd'),'port':0x18eb});var socket=require(_0xa186('0xe'))(new Redis(config[_0xa186('0xb')]));require(_0xa186('0xf'))[_0xa186('0x10')](socket);function respondWithRpcPromise(_0xff1b67,_0x4c11c3,_0xcc051d){return new BPromise(function(_0x1c3877,_0x50760f){return client['request'](_0xff1b67,_0xcc051d)[_0xa186('0x11')](function(_0x52e720){logger[_0xa186('0x12')](_0xa186('0x13'),_0x4c11c3,_0xa186('0x14'));logger['debug'](_0xa186('0x15'),_0x4c11c3,_0xa186('0x14'),JSON[_0xa186('0x16')](_0x52e720));if(_0x52e720['error']){if(_0x52e720[_0xa186('0x17')][_0xa186('0x18')]===0x1f4){logger[_0xa186('0x17')](_0xa186('0x13'),_0x4c11c3,_0x52e720['error']['message']);return _0x50760f(_0x52e720['error']['message']);}logger[_0xa186('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x4c11c3,_0x52e720[_0xa186('0x17')][_0xa186('0x19')]);return _0x1c3877(_0x52e720[_0xa186('0x17')][_0xa186('0x19')]);}else{logger[_0xa186('0x12')](_0xa186('0x13'),_0x4c11c3,_0xa186('0x14'));_0x1c3877(_0x52e720[_0xa186('0x1a')][_0xa186('0x19')]);}})[_0xa186('0x1b')](function(_0x274260){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x4c11c3,_0x274260);_0x50760f(_0x274260);});});}exports['UpdateSmsInteraction']=function(_0x168388){var _0x22855b=this;return new Promise(function(_0x4977ac,_0x543a90){return db[_0xa186('0x1c')][_0xa186('0x1d')](_0x168388['body'],{'raw':_0x168388['options']?_0x168388['options'][_0xa186('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x168388['options']?_0x168388['options'][_0xa186('0x1f')]||null:null,'attributes':_0x168388[_0xa186('0x20')]?_0x168388['options'][_0xa186('0x21')]||null:null,'limit':_0x168388[_0xa186('0x20')]?_0x168388[_0xa186('0x20')][_0xa186('0x22')]||null:null})[_0xa186('0x11')](function(_0x111cec){logger[_0xa186('0x12')](_0xa186('0x23'),_0x168388);logger[_0xa186('0x24')](_0xa186('0x23'),_0x168388,JSON['stringify'](_0x111cec));_0x4977ac(_0x111cec);})[_0xa186('0x1b')](function(_0x4c192e){logger[_0xa186('0x17')](_0xa186('0x23'),_0x4c192e[_0xa186('0x19')],_0x168388);_0x543a90(_0x22855b[_0xa186('0x17')](0x1f4,_0x4c192e['message']));});});};exports[_0xa186('0x25')]=function(_0x59efee){return new Promise(function(_0xf27c03,_0x4f4bdb){return db[_0xa186('0x1c')][_0xa186('0x26')]({'where':_0x59efee[_0xa186('0x20')]?_0x59efee[_0xa186('0x20')][_0xa186('0x1f')]||null:null})[_0xa186('0x11')](function(_0x598f9e){if(_0x598f9e){return _0x598f9e[_0xa186('0x27')](_0x59efee[_0xa186('0x28')][_0xa186('0x29')],_[_0xa186('0x2a')](_0x59efee['body'],['ids','id'])||{});}})[_0xa186('0x2b')](function(_0x1f563b){logger[_0xa186('0x12')]('AddTags',_0x59efee);logger['debug'](_0xa186('0x2c'),_0x59efee,JSON[_0xa186('0x16')](_0x1f563b));_0xf27c03(_0x1f563b);})[_0xa186('0x1b')](function(_0x310260){logger[_0xa186('0x17')](_0xa186('0x2c'),_0x310260[_0xa186('0x19')],_0x59efee);_0x4f4bdb(_this[_0xa186('0x17')](0x1f4,_0x310260['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index a7fc43b..d39900f 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 _0x1cbb=['remove','emit','removeListener','register','length','./smsInteraction.events'];(function(_0x201b93,_0x25e6b8){var _0x276f01=function(_0x1f1274){while(--_0x1f1274){_0x201b93['push'](_0x201b93['shift']());}};_0x276f01(++_0x25e6b8);}(_0x1cbb,0x143));var _0xb1cb=function(_0x4df59b,_0x96ba6a){_0x4df59b=_0x4df59b-0x0;var _0x1ea4ec=_0x1cbb[_0x4df59b];return _0x1ea4ec;};'use strict';var SmsInteractionEvents=require(_0xb1cb('0x0'));var events=['save',_0xb1cb('0x1'),'update'];function createListener(_0x718c0,_0x5c0872){return function(_0x350cb2){_0x5c0872[_0xb1cb('0x2')](_0x718c0,_0x350cb2);};}function removeListener(_0x439d86,_0x230c2f){return function(){SmsInteractionEvents[_0xb1cb('0x3')](_0x439d86,_0x230c2f);};}exports[_0xb1cb('0x4')]=function(_0x1fb6f6){for(var _0x516443=0x0,_0x36fed4=events[_0xb1cb('0x5')];_0x516443<_0x36fed4;_0x516443++){var _0x278c57=events[_0x516443];var _0x159978=createListener('smsInteraction:'+_0x278c57,_0x1fb6f6);SmsInteractionEvents['on'](_0x278c57,_0x159978);}}; \ No newline at end of file +var _0xa7ae=['remove','update','emit','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x21fc80,_0x4e4f75){var _0x5ba457=function(_0x5e11d4){while(--_0x5e11d4){_0x21fc80['push'](_0x21fc80['shift']());}};_0x5ba457(++_0x4e4f75);}(_0xa7ae,0x8b));var _0xea7a=function(_0x4a978f,_0xd78db0){_0x4a978f=_0x4a978f-0x0;var _0x557fd6=_0xa7ae[_0x4a978f];return _0x557fd6;};'use strict';var SmsInteractionEvents=require(_0xea7a('0x0'));var events=['save',_0xea7a('0x1'),_0xea7a('0x2')];function createListener(_0x3f1cc8,_0x54d468){return function(_0x4eacf1){_0x54d468[_0xea7a('0x3')](_0x3f1cc8,_0x4eacf1);};}function removeListener(_0x23a6b8,_0x17c670){return function(){SmsInteractionEvents[_0xea7a('0x4')](_0x23a6b8,_0x17c670);};}exports['register']=function(_0x25909e){for(var _0x47c823=0x0,_0x19caaa=events[_0xea7a('0x5')];_0x47c823<_0x19caaa;_0x47c823++){var _0x504480=events[_0x47c823];var _0x3c7a28=createListener(_0xea7a('0x6')+_0x504480,_0x25909e);SmsInteractionEvents['on'](_0x504480,_0x3c7a28);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index d17fbe3..154d829 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 _0x3278=['Router','../../components/auth/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','describe','get','show','post','tracked','sms','smsmessage:create','/:id/status','status','put','/:id','update','/:id/accept','accept','reject','delete','destroy','exports','path','connect-timeout'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x3278,0x11c));var _0x8327=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3278[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8327('0x0'));var timeout=require(_0x8327('0x1'));var express=require('express');var router=express[_0x8327('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8327('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x8327('0x4'));var controller=require(_0x8327('0x5'));router['get']('/',auth[_0x8327('0x6')](),controller[_0x8327('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8327('0x8')]);router[_0x8327('0x9')]('/:id',auth[_0x8327('0x6')](),controller[_0x8327('0xa')]);router[_0x8327('0xb')]('/',auth[_0x8327('0x6')](),interaction[_0x8327('0xc')](_0x8327('0xd'),_0x8327('0xe')),controller['create']);router[_0x8327('0xb')](_0x8327('0xf'),controller[_0x8327('0x10')]);router[_0x8327('0x11')](_0x8327('0x12'),auth[_0x8327('0x6')](),controller[_0x8327('0x13')]);router[_0x8327('0x11')](_0x8327('0x14'),auth[_0x8327('0x6')](),controller[_0x8327('0x15')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x8327('0x16')]);router[_0x8327('0x17')](_0x8327('0x12'),auth['isAuthenticated'](),controller[_0x8327('0x18')]);module[_0x8327('0x19')]=router; \ No newline at end of file +var _0x98dc=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','index','isAuthenticated','describe','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id','accept','/:id/reject','reject'];(function(_0x40a150,_0x15ba6c){var _0x2ff0c3=function(_0x15562d){while(--_0x15562d){_0x40a150['push'](_0x40a150['shift']());}};_0x2ff0c3(++_0x15ba6c);}(_0x98dc,0x18a));var _0xc98d=function(_0x1ddf62,_0x403f9f){_0x1ddf62=_0x1ddf62-0x0;var _0x3cdc9d=_0x98dc[_0x1ddf62];return _0x3cdc9d;};'use strict';var multer=require(_0xc98d('0x0'));var util=require(_0xc98d('0x1'));var path=require(_0xc98d('0x2'));var timeout=require(_0xc98d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc98d('0x4'));var auth=require(_0xc98d('0x5'));var interaction=require(_0xc98d('0x6'));var config=require(_0xc98d('0x7'));var controller=require(_0xc98d('0x8'));router[_0xc98d('0x9')]('/',auth['isAuthenticated'](),controller[_0xc98d('0xa')]);router[_0xc98d('0x9')]('/describe',auth[_0xc98d('0xb')](),controller[_0xc98d('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc98d('0xd')]);router[_0xc98d('0xe')]('/',auth[_0xc98d('0xb')](),interaction[_0xc98d('0xf')](_0xc98d('0x10'),_0xc98d('0x11')),controller[_0xc98d('0x12')]);router[_0xc98d('0xe')](_0xc98d('0x13'),controller[_0xc98d('0x14')]);router[_0xc98d('0x15')](_0xc98d('0x16'),auth['isAuthenticated'](),controller['update']);router[_0xc98d('0x15')]('/:id/accept',auth['isAuthenticated'](),controller[_0xc98d('0x17')]);router[_0xc98d('0x15')](_0xc98d('0x18'),auth[_0xc98d('0xb')](),controller[_0xc98d('0x19')]);router['delete'](_0xc98d('0x16'),auth['isAuthenticated'](),controller[_0xc98d('0x1a')]);module[_0xc98d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index ddc3bb4..304f719 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 _0xd89f=['sequelize','exports','medium','out','STRING','TEXT'];(function(_0x43177e,_0x4c59e4){var _0xf277eb=function(_0x3b83fc){while(--_0x3b83fc){_0x43177e['push'](_0x43177e['shift']());}};_0xf277eb(++_0x4c59e4);}(_0xd89f,0x13e));var _0xfd89=function(_0x5d3cff,_0x16dec1){_0x5d3cff=_0x5d3cff-0x0;var _0x210e75=_0xd89f[_0x5d3cff];return _0x210e75;};'use strict';var Sequelize=require(_0xfd89('0x0'));module[_0xfd89('0x1')]={'body':{'type':Sequelize['TEXT'](_0xfd89('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xfd89('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xfd89('0x4')](0xbe)},'phone':{'type':Sequelize[_0xfd89('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xfd89('0x4')]},'providerResponse':{'type':Sequelize[_0xfd89('0x5')]}}; \ No newline at end of file +var _0x5267=['TEXT','medium','BOOLEAN','out','STRING','DATE','sequelize'];(function(_0x33814f,_0x39200a){var _0x3679a8=function(_0xa53356){while(--_0xa53356){_0x33814f['push'](_0x33814f['shift']());}};_0x3679a8(++_0x39200a);}(_0x5267,0x1f0));var _0x7526=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5267[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7526('0x0'));module['exports']={'body':{'type':Sequelize[_0x7526('0x1')](_0x7526('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7526('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x7526('0x4')),'defaultValue':_0x7526('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x7526('0x5')]},'readAt':{'type':Sequelize[_0x7526('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7526('0x5')]},'providerResponse':{'type':Sequelize[_0x7526('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index bcfb28d..52ba21a 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 _0xbd9e=['request','info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','end','name','send','index','SmsMessage','rawAttributes','type','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','intersection','include','find','create','body','describe','accept','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','agent','manual','channel','motionChannel','event','EventManager','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','QueryTypes','interface','SIP/%s','rejectmessage','SmsAccount','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http'];(function(_0x5be068,_0x38c10a){var _0x1da6ce=function(_0x18c84a){while(--_0x18c84a){_0x5be068['push'](_0x5be068['shift']());}};_0x1da6ce(++_0x38c10a);}(_0xbd9e,0x108));var _0xebd9=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xbd9e[_0x4e9628];return _0x27bc8c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xebd9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xebd9('0x1'));var moment=require(_0xebd9('0x2'));var BPromise=require(_0xebd9('0x3'));var Mustache=require(_0xebd9('0x4'));var util=require(_0xebd9('0x5'));var path=require('path');var sox=require(_0xebd9('0x6'));var csv=require('to-csv');var ejs=require(_0xebd9('0x7'));var fs=require('fs');var fs_extra=require(_0xebd9('0x8'));var _=require(_0xebd9('0x9'));var squel=require(_0xebd9('0xa'));var crypto=require(_0xebd9('0xb'));var jsforce=require(_0xebd9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xebd9('0xd'));var querystring=require(_0xebd9('0xe'));var Papa=require(_0xebd9('0xf'));var Redis=require(_0xebd9('0x10'));var authService=require(_0xebd9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebd9('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xebd9('0x13'))('api');var utils=require(_0xebd9('0x14'));var config=require(_0xebd9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xebd9('0x16'))['db'];config[_0xebd9('0x17')]=_['defaults'](config[_0xebd9('0x17')],{'host':_0xebd9('0x18'),'port':0x18eb});var socket=require(_0xebd9('0x19'))(new Redis(config[_0xebd9('0x17')]));require('./smsMessage.socket')[_0xebd9('0x1a')](socket);var jayson=require(_0xebd9('0x1b'));var client=jayson[_0xebd9('0x1c')][_0xebd9('0x1d')]({'port':0x232c});var client9002=jayson[_0xebd9('0x1c')][_0xebd9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x29fde8,_0x35095e,_0x1ecb8f,_0x2767fb){return new BPromise(function(_0x37cdf3,_0x2e9284){var _0x296341=_0x2767fb||client;return _0x296341[_0xebd9('0x1e')](_0x29fde8,_0x1ecb8f)['then'](function(_0x3d949b){logger[_0xebd9('0x1f')](_0xebd9('0x20'),_0x35095e,'request\x20sent');logger[_0xebd9('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x35095e,_0xebd9('0x22'),JSON[_0xebd9('0x23')](_0x3d949b));if(_0x3d949b['error']){if(_0x3d949b['error']['code']===0x1f4){logger[_0xebd9('0x24')](_0xebd9('0x20'),_0x35095e,_0x3d949b[_0xebd9('0x24')]['message']);return _0x2e9284(_0x3d949b[_0xebd9('0x24')][_0xebd9('0x25')]);}logger[_0xebd9('0x24')](_0xebd9('0x20'),_0x35095e,_0x3d949b[_0xebd9('0x24')][_0xebd9('0x25')]);return _0x37cdf3(_0x3d949b['error'][_0xebd9('0x25')]);}else{logger[_0xebd9('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x35095e,'request\x20sent');_0x37cdf3(_0x3d949b[_0xebd9('0x26')][_0xebd9('0x25')]);}})[_0xebd9('0x27')](function(_0x1f2bbb){logger['error'](_0xebd9('0x20'),_0x35095e,_0x1f2bbb);_0x2e9284(_0x1f2bbb);});});}function respondWithStatusCode(_0x13ff98,_0x2ef023){_0x2ef023=_0x2ef023||0xcc;return function(_0x1d2330){if(_0x1d2330){return _0x13ff98['sendStatus'](_0x2ef023);}return _0x13ff98[_0xebd9('0x28')](_0x2ef023)['end']();};}function respondWithResult(_0x5924d6,_0x449c4b){_0x449c4b=_0x449c4b||0xc8;return function(_0x3c6764){if(_0x3c6764){return _0x5924d6[_0xebd9('0x28')](_0x449c4b)[_0xebd9('0x29')](_0x3c6764);}};}function respondWithFilteredResult(_0x472601,_0x576834){return function(_0x5310a8){if(_0x5310a8){var _0x4e12bf=typeof _0x576834[_0xebd9('0x2a')]===_0xebd9('0x2b')&&typeof _0x576834[_0xebd9('0x2c')]===_0xebd9('0x2b');var _0x19ea23=_0x5310a8[_0xebd9('0x2d')];var _0x35fb13=_0x4e12bf?0x0:_0x576834[_0xebd9('0x2a')];var _0x4144ef=_0x4e12bf?_0x5310a8[_0xebd9('0x2d')]:_0x576834[_0xebd9('0x2a')]+_0x576834[_0xebd9('0x2c')];var _0x4b593b;if(_0x4144ef>=_0x19ea23){_0x4144ef=_0x19ea23;_0x4b593b=0xc8;}else{_0x4b593b=0xce;}_0x472601[_0xebd9('0x28')](_0x4b593b);return _0x472601['set'](_0xebd9('0x2e'),_0x35fb13+'-'+_0x4144ef+'/'+_0x19ea23)[_0xebd9('0x29')](_0x5310a8);}return null;};}function patchUpdates(_0x4e4934){return function(_0x5ed3ac){try{jsonpatch[_0xebd9('0x2f')](_0x5ed3ac,_0x4e4934,!![]);}catch(_0x1d90bb){return BPromise[_0xebd9('0x30')](_0x1d90bb);}return _0x5ed3ac[_0xebd9('0x31')]();};}function saveUpdates(_0x179cd3,_0x9b4b5a){return function(_0x4c4dda){if(_0x4c4dda){return _0x4c4dda[_0xebd9('0x32')](_0x179cd3)['then'](function(_0x385c90){return _0x385c90;});}return null;};}function removeEntity(_0x1608f2,_0x2dec09){return function(_0x30525f){if(_0x30525f){return _0x30525f[_0xebd9('0x33')]()[_0xebd9('0x34')](function(){_0x1608f2[_0xebd9('0x28')](0xcc)[_0xebd9('0x35')]();});}};}function handleEntityNotFound(_0x3b34eb,_0x5b598a){return function(_0x12476d){if(!_0x12476d){_0x3b34eb['sendStatus'](0x194);}return _0x12476d;};}function handleError(_0x43266c,_0x50e214){_0x50e214=_0x50e214||0x1f4;return function(_0x3e0f54){logger[_0xebd9('0x24')](_0x3e0f54['stack']);if(_0x3e0f54[_0xebd9('0x36')]){delete _0x3e0f54[_0xebd9('0x36')];}_0x43266c['status'](_0x50e214)[_0xebd9('0x37')](_0x3e0f54);};}exports[_0xebd9('0x38')]=function(_0x379ceb,_0x499236){var _0x390002={},_0x49ba42={},_0x391b3c={'count':0x0,'rows':[]};var _0x281077=_['map'](db[_0xebd9('0x39')][_0xebd9('0x3a')],function(_0x115e7c){return{'name':_0x115e7c['fieldName'],'type':_0x115e7c[_0xebd9('0x3b')]['key']};});_0x49ba42[_0xebd9('0x3c')]=_[_0xebd9('0x3d')](_0x281077,_0xebd9('0x36'));_0x49ba42[_0xebd9('0x3e')]=_[_0xebd9('0x3f')](_0x379ceb[_0xebd9('0x3e')]);_0x49ba42[_0xebd9('0x40')]=_['intersection'](_0x49ba42[_0xebd9('0x3c')],_0x49ba42[_0xebd9('0x3e')]);_0x390002['attributes']=_['intersection'](_0x49ba42['model'],qs[_0xebd9('0x41')](_0x379ceb[_0xebd9('0x3e')][_0xebd9('0x41')]));_0x390002[_0xebd9('0x42')]=_0x390002[_0xebd9('0x42')][_0xebd9('0x43')]?_0x390002['attributes']:_0x49ba42[_0xebd9('0x3c')];if(!_0x379ceb['query'][_0xebd9('0x44')](_0xebd9('0x45'))){_0x390002['limit']=qs['limit'](_0x379ceb['query'][_0xebd9('0x2c')]);_0x390002[_0xebd9('0x2a')]=qs[_0xebd9('0x2a')](_0x379ceb[_0xebd9('0x3e')][_0xebd9('0x2a')]);}_0x390002[_0xebd9('0x46')]=qs[_0xebd9('0x47')](_0x379ceb[_0xebd9('0x3e')]['sort']);_0x390002[_0xebd9('0x48')]=qs['filters'](_[_0xebd9('0x49')](_0x379ceb[_0xebd9('0x3e')],_0x49ba42[_0xebd9('0x40')]),_0x281077);if(_0x379ceb['query'][_0xebd9('0x4a')]){_0x390002[_0xebd9('0x48')]=_[_0xebd9('0x4b')](_0x390002['where'],{'$or':_[_0xebd9('0x3d')](_0x281077,function(_0x1f79c8){if(_0x1f79c8[_0xebd9('0x3b')]!==_0xebd9('0x4c')){var _0x14edbe={};_0x14edbe[_0x1f79c8[_0xebd9('0x36')]]={'$like':'%'+_0x379ceb[_0xebd9('0x3e')][_0xebd9('0x4a')]+'%'};return _0x14edbe;}})});}_0x390002=_['merge']({},_0x390002,_0x379ceb[_0xebd9('0x4d')]);var _0x498184={'where':_0x390002[_0xebd9('0x48')]};return db['SmsMessage'][_0xebd9('0x2d')](_0x498184)[_0xebd9('0x34')](function(_0x210a5e){_0x391b3c[_0xebd9('0x2d')]=_0x210a5e;if(_0x379ceb[_0xebd9('0x3e')][_0xebd9('0x4e')]){_0x390002['include']=[{'all':!![]}];}return db[_0xebd9('0x39')]['findAll'](_0x390002);})[_0xebd9('0x34')](function(_0x123ea1){_0x391b3c[_0xebd9('0x4f')]=_0x123ea1;return _0x391b3c;})[_0xebd9('0x34')](respondWithFilteredResult(_0x499236,_0x390002))[_0xebd9('0x27')](handleError(_0x499236,null));};exports[_0xebd9('0x50')]=function(_0x435d8d,_0x44e5b0){var _0x1ae6bc={'raw':!![],'where':{'id':_0x435d8d[_0xebd9('0x51')]['id']}},_0x186d67={};_0x186d67[_0xebd9('0x3c')]=_[_0xebd9('0x3f')](db[_0xebd9('0x39')]['rawAttributes']);_0x186d67['query']=_[_0xebd9('0x3f')](_0x435d8d['query']);_0x186d67[_0xebd9('0x40')]=_[_0xebd9('0x52')](_0x186d67[_0xebd9('0x3c')],_0x186d67[_0xebd9('0x3e')]);_0x1ae6bc[_0xebd9('0x42')]=_[_0xebd9('0x52')](_0x186d67[_0xebd9('0x3c')],qs['fields'](_0x435d8d[_0xebd9('0x3e')]['fields']));_0x1ae6bc[_0xebd9('0x42')]=_0x1ae6bc[_0xebd9('0x42')][_0xebd9('0x43')]?_0x1ae6bc['attributes']:_0x186d67[_0xebd9('0x3c')];if(_0x435d8d[_0xebd9('0x3e')]['includeAll']){_0x1ae6bc[_0xebd9('0x53')]=[{'all':!![]}];}_0x1ae6bc=_[_0xebd9('0x4b')]({},_0x1ae6bc,_0x435d8d[_0xebd9('0x4d')]);return db[_0xebd9('0x39')][_0xebd9('0x54')](_0x1ae6bc)['then'](handleEntityNotFound(_0x44e5b0,null))[_0xebd9('0x34')](respondWithResult(_0x44e5b0,null))['catch'](handleError(_0x44e5b0,null));};exports[_0xebd9('0x55')]=function(_0x5cae61,_0xdcaf11){return db[_0xebd9('0x39')][_0xebd9('0x55')](_0x5cae61[_0xebd9('0x56')],{})['then'](respondWithResult(_0xdcaf11,0xc9))[_0xebd9('0x27')](handleError(_0xdcaf11,null));};exports[_0xebd9('0x32')]=function(_0x4972ee,_0x3d31a0){if(_0x4972ee[_0xebd9('0x56')]['id']){delete _0x4972ee[_0xebd9('0x56')]['id'];}return db[_0xebd9('0x39')]['find']({'where':{'id':_0x4972ee[_0xebd9('0x51')]['id']}})[_0xebd9('0x34')](handleEntityNotFound(_0x3d31a0,null))['then'](saveUpdates(_0x4972ee[_0xebd9('0x56')],null))[_0xebd9('0x34')](respondWithResult(_0x3d31a0,null))[_0xebd9('0x27')](handleError(_0x3d31a0,null));};exports[_0xebd9('0x33')]=function(_0x4afa4e,_0x1b1cb3){return db['SmsMessage'][_0xebd9('0x54')]({'where':{'id':_0x4afa4e[_0xebd9('0x51')]['id']}})[_0xebd9('0x34')](handleEntityNotFound(_0x1b1cb3,null))[_0xebd9('0x34')](removeEntity(_0x1b1cb3,null))[_0xebd9('0x27')](handleError(_0x1b1cb3,null));};exports[_0xebd9('0x57')]=function(_0x4808b4,_0x3eabc8){return db['SmsMessage']['describe']()[_0xebd9('0x34')](respondWithResult(_0x3eabc8,null))['catch'](handleError(_0x3eabc8,null));};var interaction_log=require(_0xebd9('0x13'))('sms-interactions');exports[_0xebd9('0x58')]=function(_0x210ffd,_0x3216ef,_0x510a54){var _0xae2107={'agent':{},'channel':_0xebd9('0x59')};if(_0x210ffd[_0xebd9('0x56')]['id']){delete _0x210ffd[_0xebd9('0x56')]['id'];}_0x210ffd[_0xebd9('0x56')][_0xebd9('0x5a')]=!![];_0x210ffd[_0xebd9('0x56')]['readAt']=moment()['format'](_0xebd9('0x5b'));_0x210ffd[_0xebd9('0x56')][_0xebd9('0x5c')]=_0x210ffd[_0xebd9('0x56')]['UserId']||_0x210ffd['user']['id'];_0xae2107['agent']['id']=_0x210ffd[_0xebd9('0x56')][_0xebd9('0x5c')];return db[_0xebd9('0x39')][_0xebd9('0x54')]({'where':{'id':_0x210ffd[_0xebd9('0x51')]['id'],'UserId':null}})[_0xebd9('0x34')](handleEntityNotFound(_0x3216ef,null))['then'](saveUpdates(_0x210ffd['body'],null))[_0xebd9('0x34')](function(_0x20c057){if(_0x20c057){_0xae2107[_0xebd9('0x25')]=_0x20c057[_0xebd9('0x5d')]({'plain':!![]});return db[_0xebd9('0x5e')][_0xebd9('0x54')]({'where':{'id':_0x20c057[_0xebd9('0x5f')]}});}return null;})[_0xebd9('0x34')](handleEntityNotFound(_0x3216ef,null))[_0xebd9('0x34')](function(_0x305388){if(_0x305388){return _0x305388[_0xebd9('0x32')]({'UserId':_0x210ffd[_0xebd9('0x56')][_0xebd9('0x5c')],'read1stAt':_[_0xebd9('0x60')](_0x305388[_0xebd9('0x61')])?moment()[_0xebd9('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xebd9('0x34')](function(_0x19ce31){if(_0x19ce31){_0xae2107[_0xebd9('0x63')]=_0x19ce31[_0xebd9('0x5d')]({'plain':!![]});interaction_log[_0xebd9('0x1f')](_0xebd9('0x64'),_0x210ffd['user']['id'],_0x210ffd[_0xebd9('0x65')][_0xebd9('0x36')],_0x210ffd[_0xebd9('0x65')]['role'],_0xae2107['interaction']['id'],_0x210ffd[_0xebd9('0x56')]?JSON['stringify'](_0x210ffd[_0xebd9('0x56')]):'null');return respondWithRpcPromise(_0xebd9('0x66'),_0xebd9('0x67'),_0xae2107);}return null;})[_0xebd9('0x34')](function(_0x5d839e){var _0x167602=_0xebd9('0x68')+_0x5d839e[_0xebd9('0x25')][_0xebd9('0x69')];return db[_0xebd9('0x6a')][_0xebd9('0x3e')](_0x167602,{'type':db[_0xebd9('0x6b')]['QueryTypes'][_0xebd9('0x6c')],'raw':!![]})[_0xebd9('0x34')](function(_0x3b16d8){return _0x3b16d8;});})[_0xebd9('0x34')](function(_0x54c444){if(_0x54c444){_0xae2107['message'][_0xebd9('0x6d')]=_0x54c444[0x0];if(!_0x210ffd[_0xebd9('0x56')][_0xebd9('0x5c')])return;return db[_0xebd9('0x6e')][_0xebd9('0x54')]({'where':{'id':_0x210ffd[_0xebd9('0x56')][_0xebd9('0x5c')],'role':'agent'},'attributes':['id',_0xebd9('0x36'),_0xebd9('0x6f'),_0xebd9('0x70'),_0xebd9('0x71')],'raw':!![]});}return null;})[_0xebd9('0x34')](function(_0x216099){if(!_0x216099)return null;_0xae2107[_0xebd9('0x25')][_0xebd9('0x72')]=_0x216099;return _0xae2107;})[_0xebd9('0x34')](function(_0x135400){if(_0x135400){if(_0x210ffd['body'][_0xebd9('0x73')]){_0xae2107[_0xebd9('0x25')]['interface']=util[_0xebd9('0x62')]('SIP/%s',_0x210ffd[_0xebd9('0x65')][_0xebd9('0x36')]);_0xae2107[_0xebd9('0x25')][_0xebd9('0x74')]=_0xae2107[_0xebd9('0x74')];_0xae2107[_0xebd9('0x25')][_0xebd9('0x75')]=_0xae2107[_0xebd9('0x74')];_0xae2107[_0xebd9('0x25')][_0xebd9('0x76')]=_0xebd9('0x58');return respondWithRpcPromise(_0xebd9('0x77'),'EventManager',{'event':'acceptmessage','message':_0xae2107[_0xebd9('0x25')]},client9002)[_0xebd9('0x34')](function(){return _0xae2107;});}return _0xae2107;}return null;})[_0xebd9('0x34')](respondWithResult(_0x3216ef,null))[_0xebd9('0x27')](handleError(_0x3216ef,null));};var interaction_log=require(_0xebd9('0x13'))('sms-interactions');exports['reject']=function(_0x4fd0ea,_0x160e85,_0x3bf12b){var _0x5b6d46={'agent':{},'channel':'sms'};if(_0x4fd0ea[_0xebd9('0x56')]['id']){delete _0x4fd0ea[_0xebd9('0x56')]['id'];}_0x4fd0ea[_0xebd9('0x56')][_0xebd9('0x5c')]=_0x4fd0ea[_0xebd9('0x56')]['UserId']||_0x4fd0ea[_0xebd9('0x65')]['id'];_0x5b6d46[_0xebd9('0x72')]['id']=_0x4fd0ea[_0xebd9('0x56')][_0xebd9('0x5c')];return db[_0xebd9('0x39')][_0xebd9('0x54')]({'where':{'id':_0x4fd0ea[_0xebd9('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x160e85,null))['then'](function(_0xb225c9){if(_0xb225c9){_0x5b6d46[_0xebd9('0x25')]=_0xb225c9[_0xebd9('0x5d')]({'plain':!![]});return db['SmsInteraction'][_0xebd9('0x54')]({'where':{'id':_0xb225c9['SmsInteractionId']}});}return null;})[_0xebd9('0x34')](handleEntityNotFound(_0x160e85,null))['then'](function(_0x475adc){if(_0x475adc){_0x5b6d46[_0xebd9('0x63')]=_0x475adc[_0xebd9('0x5d')]({'plain':!![]});interaction_log['info'](_0xebd9('0x78'),_0x4fd0ea[_0xebd9('0x65')]['id'],_0x4fd0ea[_0xebd9('0x65')][_0xebd9('0x36')],_0x4fd0ea['user'][_0xebd9('0x79')],_0x5b6d46[_0xebd9('0x63')]['id'],_0x4fd0ea[_0xebd9('0x56')]?JSON[_0xebd9('0x23')](_0x4fd0ea[_0xebd9('0x56')]):_0xebd9('0x7a'));return respondWithRpcPromise(_0xebd9('0x7b'),_0xebd9('0x7c'),_0x5b6d46);}return null;})['then'](function(_0x3b6a36){var _0x47eb14=_0xebd9('0x68')+_0x3b6a36['message'][_0xebd9('0x69')];return db[_0xebd9('0x6a')][_0xebd9('0x3e')](_0x47eb14,{'type':db[_0xebd9('0x6b')][_0xebd9('0x7d')][_0xebd9('0x6c')],'raw':!![]})[_0xebd9('0x34')](function(_0x50233b){return _0x50233b;});})[_0xebd9('0x34')](function(_0x350370){if(_0x350370){_0x5b6d46[_0xebd9('0x25')][_0xebd9('0x6d')]=_0x350370[0x0];if(!_0x4fd0ea[_0xebd9('0x56')]['UserId'])return;return db[_0xebd9('0x6e')][_0xebd9('0x54')]({'where':{'id':_0x4fd0ea[_0xebd9('0x56')][_0xebd9('0x5c')],'role':'agent'},'attributes':['id','name',_0xebd9('0x6f'),'email',_0xebd9('0x71')],'raw':!![]});}return null;})['then'](function(_0x910b78){if(!_0x910b78)return null;_0x5b6d46[_0xebd9('0x25')]['agent']=_0x910b78;return _0x5b6d46;})[_0xebd9('0x34')](function(_0x15852c){if(_0x15852c){_0x15852c[_0xebd9('0x25')][_0xebd9('0x7e')]=util[_0xebd9('0x62')](_0xebd9('0x7f'),_0x4fd0ea[_0xebd9('0x65')][_0xebd9('0x36')]);_0x15852c[_0xebd9('0x25')][_0xebd9('0x74')]=_0x5b6d46[_0xebd9('0x74')];_0x15852c[_0xebd9('0x25')]['motionChannel']=_0x5b6d46[_0xebd9('0x74')];_0x15852c[_0xebd9('0x25')][_0xebd9('0x76')]=_0xebd9('0x30');respondWithRpcPromise(_0xebd9('0x77'),'EventManager',{'event':_0xebd9('0x80'),'message':_0x15852c[_0xebd9('0x25')]},client9002);return _0x5b6d46;}return null;})[_0xebd9('0x34')](respondWithResult(_0x160e85,null))[_0xebd9('0x27')](handleError(_0x160e85,null));};exports[_0xebd9('0x28')]=function(_0x57876e,_0x5c1191,_0x5ef464){if(_0x57876e[_0xebd9('0x56')]['id']){delete _0x57876e[_0xebd9('0x56')]['id'];}var _0x1cd1ae;return db['SmsMessage'][_0xebd9('0x54')]({'where':{'id':_0x57876e[_0xebd9('0x51')]['id']}})[_0xebd9('0x34')](handleEntityNotFound(_0x5c1191,null))[_0xebd9('0x34')](function(_0x3f6dbd){if(_0x3f6dbd){_0x1cd1ae=_0x3f6dbd;return db[_0xebd9('0x81')][_0xebd9('0x54')]({'where':{'id':_0x3f6dbd['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x5c1191,null))[_0xebd9('0x34')](function(_0x951420){if(_0x951420){logger[_0xebd9('0x21')](_0xebd9('0x82'),_0xebd9('0x28'),_0xebd9('0x83'),_0x951420['type'],util[_0xebd9('0x84')](_0x57876e[_0xebd9('0x56')],{'showHidden':![],'depth':null}));switch(_0x951420[_0xebd9('0x3b')]){case _0xebd9('0x85'):if(_0x57876e[_0xebd9('0x56')][_0xebd9('0x86')]&&_0x57876e[_0xebd9('0x56')]['MessageSid']===_0x1cd1ae['messageId']){return _0x1cd1ae[_0xebd9('0x32')]({'read':!![]});}else{logger[_0xebd9('0x24')](_0xebd9('0x87'),_0xebd9('0x28'),_0xebd9('0x85'),util['inspect'](_0x57876e[_0xebd9('0x56')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x57876e[_0xebd9('0x56')][_0xebd9('0x88')]&&_0x57876e[_0xebd9('0x56')][_0xebd9('0x88')]===_0x1cd1ae[_0xebd9('0x89')]&&_[_0xebd9('0x8a')]([_0xebd9('0x8b'),_0xebd9('0x8c')],_0x57876e['body'][_0xebd9('0x8d')])>=0x0){return _0x1cd1ae['update']({'read':!![]});}else{logger['error'](_0xebd9('0x87'),_0xebd9('0x28'),_0xebd9('0x8e'),util[_0xebd9('0x84')](_0x57876e[_0xebd9('0x56')],{'showHidden':![],'depth':null}));}break;case _0xebd9('0x8f'):var _0x2fccf2=_0x57876e[_0xebd9('0x56')][_0xebd9('0x90')][0x0];if(_0x2fccf2['status'][_0xebd9('0x91')]===_0xebd9('0x92')){return _0x1cd1ae[_0xebd9('0x32')]({'read':!![]});}else{logger[_0xebd9('0x24')](_0xebd9('0x87'),_0xebd9('0x28'),_0xebd9('0x8f'),util[_0xebd9('0x84')](_0x57876e[_0xebd9('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x1cd1ae;}})[_0xebd9('0x34')](respondWithResult(_0x5c1191,null))[_0xebd9('0x27')](handleError(_0x5c1191,null));}; \ No newline at end of file +var _0xb7ac=['undefined','count','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','params','find','create','body','describe','sms-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteractionId','isNil','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','get','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','QueryTypes','interface','motionChannel','SmsAccount','SmsAccountId','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','code','SmsMessage,\x20%s,\x20%s','error','message','result','catch','status','end','json','offset'];(function(_0x4a06ca,_0x1bae44){var _0x5704ef=function(_0x525b02){while(--_0x525b02){_0x4a06ca['push'](_0x4a06ca['shift']());}};_0x5704ef(++_0x1bae44);}(_0xb7ac,0x18a));var _0xcb7a=function(_0x58a1e1,_0x9a3b72){_0x58a1e1=_0x58a1e1-0x0;var _0x333c76=_0xb7ac[_0x58a1e1];return _0x333c76;};'use strict';var emlformat=require(_0xcb7a('0x0'));var rimraf=require(_0xcb7a('0x1'));var zipdir=require(_0xcb7a('0x2'));var jsonpatch=require(_0xcb7a('0x3'));var rp=require(_0xcb7a('0x4'));var moment=require('moment');var BPromise=require(_0xcb7a('0x5'));var Mustache=require('mustache');var util=require(_0xcb7a('0x6'));var path=require(_0xcb7a('0x7'));var sox=require('sox');var csv=require(_0xcb7a('0x8'));var ejs=require(_0xcb7a('0x9'));var fs=require('fs');var fs_extra=require(_0xcb7a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcb7a('0xb'));var jsforce=require(_0xcb7a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcb7a('0x8'));var querystring=require(_0xcb7a('0xd'));var Papa=require(_0xcb7a('0xe'));var Redis=require(_0xcb7a('0xf'));var authService=require(_0xcb7a('0x10'));var qs=require(_0xcb7a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb7a('0x12'));var logger=require(_0xcb7a('0x13'))(_0xcb7a('0x14'));var utils=require('../../config/utils');var config=require(_0xcb7a('0x15'));var licenseUtil=require(_0xcb7a('0x16'));var db=require('../../mysqldb')['db'];config[_0xcb7a('0x17')]=_[_0xcb7a('0x18')](config[_0xcb7a('0x17')],{'host':_0xcb7a('0x19'),'port':0x18eb});var socket=require(_0xcb7a('0x1a'))(new Redis(config[_0xcb7a('0x17')]));require(_0xcb7a('0x1b'))[_0xcb7a('0x1c')](socket);var jayson=require(_0xcb7a('0x1d'));var client=jayson['client'][_0xcb7a('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xcb7a('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x38acef,_0x7f1071,_0x37ea19,_0x53721a){return new BPromise(function(_0x2bb2e9,_0x39b3b7){var _0x28d09d=_0x53721a||client;return _0x28d09d[_0xcb7a('0x1f')](_0x38acef,_0x37ea19)[_0xcb7a('0x20')](function(_0x28be52){logger[_0xcb7a('0x21')]('SmsMessage,\x20%s,\x20%s',_0x7f1071,_0xcb7a('0x22'));logger[_0xcb7a('0x23')](_0xcb7a('0x24'),_0x7f1071,_0xcb7a('0x22'),JSON['stringify'](_0x28be52));if(_0x28be52['error']){if(_0x28be52['error'][_0xcb7a('0x25')]===0x1f4){logger['error'](_0xcb7a('0x26'),_0x7f1071,_0x28be52[_0xcb7a('0x27')][_0xcb7a('0x28')]);return _0x39b3b7(_0x28be52[_0xcb7a('0x27')][_0xcb7a('0x28')]);}logger[_0xcb7a('0x27')](_0xcb7a('0x26'),_0x7f1071,_0x28be52[_0xcb7a('0x27')][_0xcb7a('0x28')]);return _0x2bb2e9(_0x28be52[_0xcb7a('0x27')][_0xcb7a('0x28')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x7f1071,'request\x20sent');_0x2bb2e9(_0x28be52[_0xcb7a('0x29')][_0xcb7a('0x28')]);}})[_0xcb7a('0x2a')](function(_0x28682a){logger['error'](_0xcb7a('0x26'),_0x7f1071,_0x28682a);_0x39b3b7(_0x28682a);});});}function respondWithStatusCode(_0xe20b78,_0x282350){_0x282350=_0x282350||0xcc;return function(_0x2c59d8){if(_0x2c59d8){return _0xe20b78['sendStatus'](_0x282350);}return _0xe20b78[_0xcb7a('0x2b')](_0x282350)[_0xcb7a('0x2c')]();};}function respondWithResult(_0x4fd6bf,_0x3b7fc8){_0x3b7fc8=_0x3b7fc8||0xc8;return function(_0x1f3a3d){if(_0x1f3a3d){return _0x4fd6bf[_0xcb7a('0x2b')](_0x3b7fc8)[_0xcb7a('0x2d')](_0x1f3a3d);}};}function respondWithFilteredResult(_0x4680ea,_0x5ba723){return function(_0x3aa77c){if(_0x3aa77c){var _0x59c56a=typeof _0x5ba723[_0xcb7a('0x2e')]==='undefined'&&typeof _0x5ba723['limit']===_0xcb7a('0x2f');var _0x3b17f9=_0x3aa77c[_0xcb7a('0x30')];var _0x1303d9=_0x59c56a?0x0:_0x5ba723[_0xcb7a('0x2e')];var _0x55e6a4=_0x59c56a?_0x3aa77c[_0xcb7a('0x30')]:_0x5ba723[_0xcb7a('0x2e')]+_0x5ba723[_0xcb7a('0x31')];var _0x2efb4b;if(_0x55e6a4>=_0x3b17f9){_0x55e6a4=_0x3b17f9;_0x2efb4b=0xc8;}else{_0x2efb4b=0xce;}_0x4680ea[_0xcb7a('0x2b')](_0x2efb4b);return _0x4680ea[_0xcb7a('0x32')](_0xcb7a('0x33'),_0x1303d9+'-'+_0x55e6a4+'/'+_0x3b17f9)[_0xcb7a('0x2d')](_0x3aa77c);}return null;};}function patchUpdates(_0x3bb4f6){return function(_0x272920){try{jsonpatch[_0xcb7a('0x34')](_0x272920,_0x3bb4f6,!![]);}catch(_0x1062a4){return BPromise[_0xcb7a('0x35')](_0x1062a4);}return _0x272920['save']();};}function saveUpdates(_0xc58d05,_0x5adfc1){return function(_0x3f99fb){if(_0x3f99fb){return _0x3f99fb[_0xcb7a('0x36')](_0xc58d05)[_0xcb7a('0x20')](function(_0x212cbf){return _0x212cbf;});}return null;};}function removeEntity(_0x52557e,_0x2132e4){return function(_0x5de97f){if(_0x5de97f){return _0x5de97f[_0xcb7a('0x37')]()[_0xcb7a('0x20')](function(){_0x52557e[_0xcb7a('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d62ac,_0x231331){return function(_0x50c745){if(!_0x50c745){_0x2d62ac[_0xcb7a('0x38')](0x194);}return _0x50c745;};}function handleError(_0x22f86f,_0x8e900f){_0x8e900f=_0x8e900f||0x1f4;return function(_0xb62490){logger['error'](_0xb62490[_0xcb7a('0x39')]);if(_0xb62490[_0xcb7a('0x3a')]){delete _0xb62490[_0xcb7a('0x3a')];}_0x22f86f['status'](_0x8e900f)[_0xcb7a('0x3b')](_0xb62490);};}exports[_0xcb7a('0x3c')]=function(_0x4636d7,_0x403d42){var _0x31371a={},_0x2b10d1={},_0x4ee2c3={'count':0x0,'rows':[]};var _0xae1541=_[_0xcb7a('0x3d')](db[_0xcb7a('0x3e')][_0xcb7a('0x3f')],function(_0x4c4dfc){return{'name':_0x4c4dfc[_0xcb7a('0x40')],'type':_0x4c4dfc[_0xcb7a('0x41')][_0xcb7a('0x42')]};});_0x2b10d1[_0xcb7a('0x43')]=_[_0xcb7a('0x3d')](_0xae1541,_0xcb7a('0x3a'));_0x2b10d1[_0xcb7a('0x44')]=_[_0xcb7a('0x45')](_0x4636d7[_0xcb7a('0x44')]);_0x2b10d1[_0xcb7a('0x46')]=_[_0xcb7a('0x47')](_0x2b10d1['model'],_0x2b10d1['query']);_0x31371a['attributes']=_[_0xcb7a('0x47')](_0x2b10d1['model'],qs[_0xcb7a('0x48')](_0x4636d7[_0xcb7a('0x44')][_0xcb7a('0x48')]));_0x31371a['attributes']=_0x31371a[_0xcb7a('0x49')][_0xcb7a('0x4a')]?_0x31371a[_0xcb7a('0x49')]:_0x2b10d1[_0xcb7a('0x43')];if(!_0x4636d7['query'][_0xcb7a('0x4b')](_0xcb7a('0x4c'))){_0x31371a[_0xcb7a('0x31')]=qs[_0xcb7a('0x31')](_0x4636d7['query'][_0xcb7a('0x31')]);_0x31371a[_0xcb7a('0x2e')]=qs['offset'](_0x4636d7[_0xcb7a('0x44')]['offset']);}_0x31371a[_0xcb7a('0x4d')]=qs['sort'](_0x4636d7[_0xcb7a('0x44')]['sort']);_0x31371a['where']=qs[_0xcb7a('0x46')](_[_0xcb7a('0x4e')](_0x4636d7[_0xcb7a('0x44')],_0x2b10d1['filters']),_0xae1541);if(_0x4636d7[_0xcb7a('0x44')][_0xcb7a('0x4f')]){_0x31371a[_0xcb7a('0x50')]=_[_0xcb7a('0x51')](_0x31371a[_0xcb7a('0x50')],{'$or':_['map'](_0xae1541,function(_0x14af47){if(_0x14af47['type']!==_0xcb7a('0x52')){var _0x2a7315={};_0x2a7315[_0x14af47[_0xcb7a('0x3a')]]={'$like':'%'+_0x4636d7[_0xcb7a('0x44')][_0xcb7a('0x4f')]+'%'};return _0x2a7315;}})});}_0x31371a=_[_0xcb7a('0x51')]({},_0x31371a,_0x4636d7[_0xcb7a('0x53')]);var _0x3ce8db={'where':_0x31371a[_0xcb7a('0x50')]};return db[_0xcb7a('0x3e')][_0xcb7a('0x30')](_0x3ce8db)[_0xcb7a('0x20')](function(_0xbccabc){_0x4ee2c3[_0xcb7a('0x30')]=_0xbccabc;if(_0x4636d7[_0xcb7a('0x44')][_0xcb7a('0x54')]){_0x31371a['include']=[{'all':!![]}];}return db[_0xcb7a('0x3e')][_0xcb7a('0x55')](_0x31371a);})[_0xcb7a('0x20')](function(_0xfefd29){_0x4ee2c3[_0xcb7a('0x56')]=_0xfefd29;return _0x4ee2c3;})[_0xcb7a('0x20')](respondWithFilteredResult(_0x403d42,_0x31371a))[_0xcb7a('0x2a')](handleError(_0x403d42,null));};exports['show']=function(_0x18dbce,_0x45d267){var _0x4094a3={'raw':!![],'where':{'id':_0x18dbce[_0xcb7a('0x57')]['id']}},_0x284055={};_0x284055[_0xcb7a('0x43')]=_[_0xcb7a('0x45')](db[_0xcb7a('0x3e')][_0xcb7a('0x3f')]);_0x284055[_0xcb7a('0x44')]=_[_0xcb7a('0x45')](_0x18dbce[_0xcb7a('0x44')]);_0x284055[_0xcb7a('0x46')]=_[_0xcb7a('0x47')](_0x284055['model'],_0x284055[_0xcb7a('0x44')]);_0x4094a3[_0xcb7a('0x49')]=_['intersection'](_0x284055[_0xcb7a('0x43')],qs['fields'](_0x18dbce[_0xcb7a('0x44')][_0xcb7a('0x48')]));_0x4094a3['attributes']=_0x4094a3['attributes']['length']?_0x4094a3[_0xcb7a('0x49')]:_0x284055[_0xcb7a('0x43')];if(_0x18dbce[_0xcb7a('0x44')][_0xcb7a('0x54')]){_0x4094a3['include']=[{'all':!![]}];}_0x4094a3=_[_0xcb7a('0x51')]({},_0x4094a3,_0x18dbce[_0xcb7a('0x53')]);return db[_0xcb7a('0x3e')][_0xcb7a('0x58')](_0x4094a3)[_0xcb7a('0x20')](handleEntityNotFound(_0x45d267,null))[_0xcb7a('0x20')](respondWithResult(_0x45d267,null))[_0xcb7a('0x2a')](handleError(_0x45d267,null));};exports['create']=function(_0x101888,_0x57a4ce){return db[_0xcb7a('0x3e')][_0xcb7a('0x59')](_0x101888['body'],{})[_0xcb7a('0x20')](respondWithResult(_0x57a4ce,0xc9))[_0xcb7a('0x2a')](handleError(_0x57a4ce,null));};exports[_0xcb7a('0x36')]=function(_0x1095d9,_0x44f3f8){if(_0x1095d9[_0xcb7a('0x5a')]['id']){delete _0x1095d9['body']['id'];}return db['SmsMessage'][_0xcb7a('0x58')]({'where':{'id':_0x1095d9['params']['id']}})['then'](handleEntityNotFound(_0x44f3f8,null))[_0xcb7a('0x20')](saveUpdates(_0x1095d9['body'],null))[_0xcb7a('0x20')](respondWithResult(_0x44f3f8,null))['catch'](handleError(_0x44f3f8,null));};exports[_0xcb7a('0x37')]=function(_0x25f14e,_0x19b885){return db[_0xcb7a('0x3e')][_0xcb7a('0x58')]({'where':{'id':_0x25f14e[_0xcb7a('0x57')]['id']}})[_0xcb7a('0x20')](handleEntityNotFound(_0x19b885,null))[_0xcb7a('0x20')](removeEntity(_0x19b885,null))[_0xcb7a('0x2a')](handleError(_0x19b885,null));};exports[_0xcb7a('0x5b')]=function(_0x4b536d,_0x5984f2){return db[_0xcb7a('0x3e')]['describe']()[_0xcb7a('0x20')](respondWithResult(_0x5984f2,null))['catch'](handleError(_0x5984f2,null));};var interaction_log=require(_0xcb7a('0x13'))(_0xcb7a('0x5c'));exports[_0xcb7a('0x5d')]=function(_0x213b84,_0x2d70f0,_0x5128b7){var _0x24365f={'agent':{},'channel':'sms'};if(_0x213b84[_0xcb7a('0x5a')]['id']){delete _0x213b84[_0xcb7a('0x5a')]['id'];}_0x213b84[_0xcb7a('0x5a')][_0xcb7a('0x5e')]=!![];_0x213b84['body'][_0xcb7a('0x5f')]=moment()['format'](_0xcb7a('0x60'));_0x213b84['body'][_0xcb7a('0x61')]=_0x213b84[_0xcb7a('0x5a')]['UserId']||_0x213b84[_0xcb7a('0x62')]['id'];_0x24365f[_0xcb7a('0x63')]['id']=_0x213b84[_0xcb7a('0x5a')][_0xcb7a('0x61')];return db[_0xcb7a('0x3e')]['find']({'where':{'id':_0x213b84[_0xcb7a('0x57')]['id'],'UserId':null}})[_0xcb7a('0x20')](handleEntityNotFound(_0x2d70f0,null))[_0xcb7a('0x20')](saveUpdates(_0x213b84[_0xcb7a('0x5a')],null))[_0xcb7a('0x20')](function(_0x2c587c){if(_0x2c587c){_0x24365f['message']=_0x2c587c['get']({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x2c587c[_0xcb7a('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x2d70f0,null))['then'](function(_0x250515){if(_0x250515){return _0x250515[_0xcb7a('0x36')]({'UserId':_0x213b84[_0xcb7a('0x5a')]['UserId'],'read1stAt':_[_0xcb7a('0x65')](_0x250515['read1stAt'])?moment()[_0xcb7a('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x7921c8){if(_0x7921c8){_0x24365f['interaction']=_0x7921c8['get']({'plain':!![]});interaction_log['info'](_0xcb7a('0x67'),_0x213b84['user']['id'],_0x213b84[_0xcb7a('0x62')]['name'],_0x213b84[_0xcb7a('0x62')]['role'],_0x24365f[_0xcb7a('0x68')]['id'],_0x213b84[_0xcb7a('0x5a')]?JSON[_0xcb7a('0x69')](_0x213b84[_0xcb7a('0x5a')]):_0xcb7a('0x6a'));return respondWithRpcPromise(_0xcb7a('0x6b'),_0xcb7a('0x6c'),_0x24365f);}return null;})[_0xcb7a('0x20')](function(_0x3b5ee4){var _0x4126eb=_0xcb7a('0x6d')+_0x3b5ee4[_0xcb7a('0x28')]['ContactId'];return db[_0xcb7a('0x6e')]['query'](_0x4126eb,{'type':db['Sequelize']['QueryTypes'][_0xcb7a('0x6f')],'raw':!![]})['then'](function(_0x29e61c){return _0x29e61c;});})[_0xcb7a('0x20')](function(_0x531a11){if(_0x531a11){_0x24365f[_0xcb7a('0x28')][_0xcb7a('0x70')]=_0x531a11[0x0];if(!_0x213b84[_0xcb7a('0x5a')][_0xcb7a('0x61')])return;return db[_0xcb7a('0x71')]['find']({'where':{'id':_0x213b84[_0xcb7a('0x5a')][_0xcb7a('0x61')],'role':_0xcb7a('0x63')},'attributes':['id',_0xcb7a('0x3a'),_0xcb7a('0x72'),_0xcb7a('0x73'),_0xcb7a('0x74')],'raw':!![]});}return null;})['then'](function(_0x3c2dee){if(!_0x3c2dee)return null;_0x24365f[_0xcb7a('0x28')][_0xcb7a('0x63')]=_0x3c2dee;return _0x24365f;})[_0xcb7a('0x20')](function(_0x1fdce8){if(_0x1fdce8){if(_0x213b84['body'][_0xcb7a('0x75')]){_0x24365f[_0xcb7a('0x28')]['interface']=util[_0xcb7a('0x66')](_0xcb7a('0x76'),_0x213b84[_0xcb7a('0x62')][_0xcb7a('0x3a')]);_0x24365f[_0xcb7a('0x28')][_0xcb7a('0x77')]=_0x24365f[_0xcb7a('0x77')];_0x24365f['message']['motionChannel']=_0x24365f[_0xcb7a('0x77')];_0x24365f[_0xcb7a('0x28')][_0xcb7a('0x78')]='accept';return respondWithRpcPromise(_0xcb7a('0x79'),_0xcb7a('0x79'),{'event':_0xcb7a('0x7a'),'message':_0x24365f[_0xcb7a('0x28')]},client9002)[_0xcb7a('0x20')](function(){return _0x24365f;});}return _0x24365f;}return null;})['then'](respondWithResult(_0x2d70f0,null))[_0xcb7a('0x2a')](handleError(_0x2d70f0,null));};var interaction_log=require('../../config/logger')(_0xcb7a('0x5c'));exports[_0xcb7a('0x35')]=function(_0x5e4d3b,_0x21c6fa,_0x4c755c){var _0x4b7a04={'agent':{},'channel':'sms'};if(_0x5e4d3b[_0xcb7a('0x5a')]['id']){delete _0x5e4d3b[_0xcb7a('0x5a')]['id'];}_0x5e4d3b[_0xcb7a('0x5a')][_0xcb7a('0x61')]=_0x5e4d3b[_0xcb7a('0x5a')][_0xcb7a('0x61')]||_0x5e4d3b[_0xcb7a('0x62')]['id'];_0x4b7a04[_0xcb7a('0x63')]['id']=_0x5e4d3b[_0xcb7a('0x5a')][_0xcb7a('0x61')];return db['SmsMessage']['find']({'where':{'id':_0x5e4d3b[_0xcb7a('0x57')]['id'],'UserId':null}})[_0xcb7a('0x20')](handleEntityNotFound(_0x21c6fa,null))[_0xcb7a('0x20')](function(_0x3c9980){if(_0x3c9980){_0x4b7a04[_0xcb7a('0x28')]=_0x3c9980[_0xcb7a('0x7b')]({'plain':!![]});return db[_0xcb7a('0x7c')][_0xcb7a('0x58')]({'where':{'id':_0x3c9980[_0xcb7a('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x21c6fa,null))[_0xcb7a('0x20')](function(_0xd97cda){if(_0xd97cda){_0x4b7a04[_0xcb7a('0x68')]=_0xd97cda[_0xcb7a('0x7b')]({'plain':!![]});interaction_log['info'](_0xcb7a('0x7d'),_0x5e4d3b[_0xcb7a('0x62')]['id'],_0x5e4d3b[_0xcb7a('0x62')][_0xcb7a('0x3a')],_0x5e4d3b[_0xcb7a('0x62')][_0xcb7a('0x7e')],_0x4b7a04['interaction']['id'],_0x5e4d3b['body']?JSON[_0xcb7a('0x69')](_0x5e4d3b[_0xcb7a('0x5a')]):'null');return respondWithRpcPromise(_0xcb7a('0x7f'),'rejectMessage',_0x4b7a04);}return null;})[_0xcb7a('0x20')](function(_0x243e30){var _0x58930a=_0xcb7a('0x6d')+_0x243e30[_0xcb7a('0x28')]['ContactId'];return db[_0xcb7a('0x6e')][_0xcb7a('0x44')](_0x58930a,{'type':db['Sequelize'][_0xcb7a('0x80')][_0xcb7a('0x6f')],'raw':!![]})['then'](function(_0x31987d){return _0x31987d;});})[_0xcb7a('0x20')](function(_0x23ffc7){if(_0x23ffc7){_0x4b7a04[_0xcb7a('0x28')][_0xcb7a('0x70')]=_0x23ffc7[0x0];if(!_0x5e4d3b[_0xcb7a('0x5a')][_0xcb7a('0x61')])return;return db[_0xcb7a('0x71')][_0xcb7a('0x58')]({'where':{'id':_0x5e4d3b[_0xcb7a('0x5a')]['UserId'],'role':_0xcb7a('0x63')},'attributes':['id',_0xcb7a('0x3a'),'fullname',_0xcb7a('0x73'),'internal'],'raw':!![]});}return null;})[_0xcb7a('0x20')](function(_0x58097e){if(!_0x58097e)return null;_0x4b7a04[_0xcb7a('0x28')][_0xcb7a('0x63')]=_0x58097e;return _0x4b7a04;})[_0xcb7a('0x20')](function(_0x2ea8a0){if(_0x2ea8a0){_0x2ea8a0[_0xcb7a('0x28')][_0xcb7a('0x81')]=util[_0xcb7a('0x66')](_0xcb7a('0x76'),_0x5e4d3b[_0xcb7a('0x62')][_0xcb7a('0x3a')]);_0x2ea8a0['message'][_0xcb7a('0x77')]=_0x4b7a04[_0xcb7a('0x77')];_0x2ea8a0[_0xcb7a('0x28')][_0xcb7a('0x82')]=_0x4b7a04[_0xcb7a('0x77')];_0x2ea8a0[_0xcb7a('0x28')][_0xcb7a('0x78')]=_0xcb7a('0x35');respondWithRpcPromise(_0xcb7a('0x79'),_0xcb7a('0x79'),{'event':'rejectmessage','message':_0x2ea8a0['message']},client9002);return _0x4b7a04;}return null;})[_0xcb7a('0x20')](respondWithResult(_0x21c6fa,null))['catch'](handleError(_0x21c6fa,null));};exports['status']=function(_0x2aa719,_0x26535d,_0x1fbb70){if(_0x2aa719['body']['id']){delete _0x2aa719[_0xcb7a('0x5a')]['id'];}var _0x4384d2;return db[_0xcb7a('0x3e')][_0xcb7a('0x58')]({'where':{'id':_0x2aa719[_0xcb7a('0x57')]['id']}})['then'](handleEntityNotFound(_0x26535d,null))[_0xcb7a('0x20')](function(_0x33c0f5){if(_0x33c0f5){_0x4384d2=_0x33c0f5;return db[_0xcb7a('0x83')]['find']({'where':{'id':_0x33c0f5[_0xcb7a('0x84')]}});}})['then'](handleEntityNotFound(_0x26535d,null))['then'](function(_0xa9aefb){if(_0xa9aefb){logger[_0xcb7a('0x23')](_0xcb7a('0x24'),_0xcb7a('0x2b'),'received\x20delivery\x20report\x20from',_0xa9aefb['type'],util[_0xcb7a('0x85')](_0x2aa719[_0xcb7a('0x5a')],{'showHidden':![],'depth':null}));switch(_0xa9aefb[_0xcb7a('0x41')]){case _0xcb7a('0x86'):if(_0x2aa719['body'][_0xcb7a('0x87')]&&_0x2aa719[_0xcb7a('0x5a')][_0xcb7a('0x87')]===_0x4384d2[_0xcb7a('0x88')]){return _0x4384d2[_0xcb7a('0x36')]({'read':!![]});}else{logger[_0xcb7a('0x27')](_0xcb7a('0x89'),_0xcb7a('0x2b'),_0xcb7a('0x86'),util[_0xcb7a('0x85')](_0x2aa719[_0xcb7a('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xcb7a('0x8a'):if(_0x2aa719[_0xcb7a('0x5a')]['MessageUUID']&&_0x2aa719[_0xcb7a('0x5a')][_0xcb7a('0x8b')]===_0x4384d2[_0xcb7a('0x88')]&&_[_0xcb7a('0x8c')]([_0xcb7a('0x8d'),_0xcb7a('0x8e')],_0x2aa719[_0xcb7a('0x5a')][_0xcb7a('0x8f')])>=0x0){return _0x4384d2['update']({'read':!![]});}else{logger[_0xcb7a('0x27')](_0xcb7a('0x89'),_0xcb7a('0x2b'),'plivio',util[_0xcb7a('0x85')](_0x2aa719[_0xcb7a('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xcb7a('0x90'):var _0x31146f=_0x2aa719[_0xcb7a('0x5a')]['results'][0x0];if(_0x31146f[_0xcb7a('0x2b')][_0xcb7a('0x91')]===_0xcb7a('0x92')){return _0x4384d2[_0xcb7a('0x36')]({'read':!![]});}else{logger[_0xcb7a('0x27')](_0xcb7a('0x89'),_0xcb7a('0x2b'),_0xcb7a('0x90'),util[_0xcb7a('0x85')](_0x2aa719[_0xcb7a('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x4384d2;}})['then'](respondWithResult(_0x26535d,null))[_0xcb7a('0x2a')](handleError(_0x26535d,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index ace8b04..390f2d0 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 _0x45e8=['remove','emit','hasOwnProperty','hook','events','SmsMessage','setMaxListeners','save'];(function(_0x16f52f,_0x5603a3){var _0x7d8b6f=function(_0x4c5a87){while(--_0x4c5a87){_0x16f52f['push'](_0x16f52f['shift']());}};_0x7d8b6f(++_0x5603a3);}(_0x45e8,0xc4));var _0x845e=function(_0x12e3d2,_0x77a0e0){_0x12e3d2=_0x12e3d2-0x0;var _0x2e632c=_0x45e8[_0x12e3d2];return _0x2e632c;};'use strict';var EventEmitter=require(_0x845e('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x845e('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x845e('0x2')](0x0);var events={'afterCreate':_0x845e('0x3'),'afterUpdate':'update','afterDestroy':_0x845e('0x4')};function emitEvent(_0x39b504){return function(_0x3e6755,_0x372299,_0x4b31e8){SmsMessageEvents[_0x845e('0x5')](_0x39b504+':'+_0x3e6755['id'],_0x3e6755);SmsMessageEvents[_0x845e('0x5')](_0x39b504,_0x3e6755);_0x4b31e8(null);};}for(var e in events){if(events[_0x845e('0x6')](e)){var event=events[e];SmsMessage[_0x845e('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x4796=['remove','emit','hasOwnProperty','hook','SmsMessage','setMaxListeners','save','update'];(function(_0x3435ba,_0x3efcd4){var _0x1cd58e=function(_0x2174f2){while(--_0x2174f2){_0x3435ba['push'](_0x3435ba['shift']());}};_0x1cd58e(++_0x3efcd4);}(_0x4796,0x14c));var _0x6479=function(_0x1f7d79,_0x555960){_0x1f7d79=_0x1f7d79-0x0;var _0x2f9e15=_0x4796[_0x1f7d79];return _0x2f9e15;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0x6479('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6479('0x1')](0x0);var events={'afterCreate':_0x6479('0x2'),'afterUpdate':_0x6479('0x3'),'afterDestroy':_0x6479('0x4')};function emitEvent(_0x146bbf){return function(_0xf6dd8f,_0x3ceb52,_0x149bdc){SmsMessageEvents[_0x6479('0x5')](_0x146bbf+':'+_0xf6dd8f['id'],_0xf6dd8f);SmsMessageEvents[_0x6479('0x5')](_0x146bbf,_0xf6dd8f);_0x149bdc(null);};}for(var e in events){if(events[_0x6479('0x6')](e)){var event=events[e];SmsMessage[_0x6479('0x7')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index d855d93..22333e2 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 _0x8868=['createdAt','catch','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','error','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','GET','sms','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','base64','http_code','data','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','csc','crypto','apiKey','login','text','timestamp','keys','length','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','applicationId','intelepeer','Bearer\x20','code','message','refid','status','Token\x20not\x20received','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','toLowerCase','direction','out','isNil','UserId','findOne','then','update'];(function(_0x466459,_0x4562cb){var _0x2ea4c8=function(_0x18a3fb){while(--_0x18a3fb){_0x466459['push'](_0x466459['shift']());}};_0x2ea4c8(++_0x4562cb);}(_0x8868,0x1ca));var _0x8886=function(_0x327422,_0x231301){_0x327422=_0x327422-0x0;var _0x2a7330=_0x8868[_0x327422];return _0x2a7330;};'use strict';var _=require(_0x8886('0x0'));var util=require(_0x8886('0x1'));var logger=require(_0x8886('0x2'))(_0x8886('0x3'));var moment=require(_0x8886('0x4'));var BPromise=require(_0x8886('0x5'));var rp=require(_0x8886('0x6'));var fs=require('fs');var path=require(_0x8886('0x7'));var rimraf=require(_0x8886('0x8'));var config=require(_0x8886('0x9'));var attributes=require(_0x8886('0xa'));module['exports']=function(_0x544272,_0x2b2f5d){return _0x544272[_0x8886('0xb')]('SmsMessage',attributes,{'tableName':_0x8886('0xc'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x8886('0xd')]},{'name':_0x8886('0xe'),'fields':[_0x8886('0xf')],'type':_0x8886('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d25b0,_0x57b50,_0x4d16aa){var _0x3e4720=_0x544272['models'];var _0x53b896=_0x1d25b0[_0x8886('0x11')]({'plain':!![]});if(_0x53b896['direction'][_0x8886('0x12')]()==='in'||_0x53b896[_0x8886('0x13')][_0x8886('0x12')]()===_0x8886('0x14')&&!_0x53b896['secret']&&!_[_0x8886('0x15')](_0x53b896[_0x8886('0x16')])){_0x3e4720['SmsInteraction'][_0x8886('0x17')]({'where':{'id':_0x53b896['SmsInteractionId']}})[_0x8886('0x18')](function(_0x1110fd){if(_0x1110fd){_0x1110fd[_0x8886('0x19')]({'lastMsgAt':_0x53b896[_0x8886('0x1a')],'lastMsgDirection':_0x53b896['direction']['toLowerCase']()});}})[_0x8886('0x1b')](function(_0x11905e){console['error'](_0x11905e);});}if(_0x53b896['direction']==='out'&&!_0x53b896['secret']){var _0x438f1a;_0x3e4720[_0x8886('0x1c')][_0x8886('0x1d')]({'where':{'id':_0x53b896[_0x8886('0x1e')]},'raw':!![]})[_0x8886('0x18')](function(_0x20072e){_0x438f1a=_0x20072e;if(_0x438f1a&&_0x438f1a[_0x8886('0x1f')]){switch(_0x438f1a[_0x8886('0x1f')]){case _0x8886('0x20'):var _0x85abb6=require(_0x8886('0x20'));if(_0x438f1a[_0x8886('0x21')]&&_0x438f1a[_0x8886('0x22')]&&_0x438f1a[_0x8886('0x23')]){var _0x5103f9=new _0x85abb6(_0x438f1a[_0x8886('0x21')],_0x438f1a['authToken']);_0x5103f9[_0x8886('0x24')][_0x8886('0x25')]({'body':_0x53b896['body'],'to':_0x53b896[_0x8886('0x23')],'from':_0x438f1a[_0x8886('0x23')],'statusCallback':_0x438f1a[_0x8886('0x26')]+_0x8886('0x27')+_0x53b896['id']+_0x8886('0x28')+_0x438f1a[_0x8886('0x29')]})['then'](function(_0x3df299){if(_0x3df299['sid']){return _0x1d25b0[_0x8886('0x19')]({'messageId':_0x3df299[_0x8886('0x2a')]});}})[_0x8886('0x1b')](function(_0x48280f){logger[_0x8886('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8886('0x2c'),_0x8886('0x20'),util[_0x8886('0x2d')](_0x48280f,{'showHidden':![],'depth':null}));});}else{logger[_0x8886('0x2b')](_0x8886('0x2e'),_0x8886('0x2c'),_0x8886('0x20'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x458e84=_0x8886('0x2f');if(_0x438f1a['username']&&_0x438f1a[_0x8886('0x30')]){var _0x45b714={'recipient':[_0x53b896[_0x8886('0x23')]],'message':_0x53b896['body'],'message_type':_0x438f1a['smsMethod']};if(_0x438f1a[_0x8886('0x31')]&&_0x438f1a[_0x8886('0x31')]!=='SI'){_0x45b714[_0x8886('0x32')]=_0x438f1a[_0x8886('0x23')];}var _0x48ccb0={'url':_0x458e84+_0x8886('0x33')+_0x438f1a[_0x8886('0x34')]+'&password='+_0x438f1a[_0x8886('0x30')],'method':_0x8886('0x35')};rp(_0x48ccb0)[_0x8886('0x18')](function(_0x4a9c2c){var _0x2ebafa=_0x4a9c2c['split'](';');var _0x257cc1={'user_key':_0x2ebafa[0x0],'session_key':_0x2ebafa[0x1]};_0x48ccb0={'url':_0x458e84+_0x8886('0x36'),'method':'POST','headers':{'user_key':_0x257cc1[_0x8886('0x37')],'Session_key':_0x257cc1[_0x8886('0x38')]},'json':!![],'body':_0x45b714};return rp(_0x48ccb0);})[_0x8886('0x18')](function(_0x1cf91b){if(_0x1cf91b[_0x8886('0x39')]>=0x1){var _0x43d6f2={'messageId':_0x1cf91b[_0x8886('0x3a')]};if(_0x438f1a['smsMethod']!=='GP'||!_0x438f1a[_0x8886('0x3b')]){_0x43d6f2[_0x8886('0x3c')]=!![];}return _0x1d25b0[_0x8886('0x19')](_0x43d6f2);}else{return logger[_0x8886('0x2b')](_0x8886('0x2e'),_0x8886('0x2c'),'skebby',util[_0x8886('0x2d')](_0x1cf91b,{'showHidden':![],'depth':null}));}})[_0x8886('0x1b')](function(_0x44b6bb){return logger[_0x8886('0x2b')](_0x8886('0x2e'),'afterCreate',_0x8886('0x3d'),util[_0x8886('0x2d')](_0x44b6bb,{'showHidden':![],'depth':null}));});}else{logger[_0x8886('0x2b')](_0x8886('0x2e'),_0x8886('0x2c'),_0x8886('0x3d'),_0x8886('0x3e'));}break;case'connectel':if(_0x438f1a[_0x8886('0x22')]){var _0x347961={'recipient':_0x53b896['phone'],'message':_0x53b896['body'],'sender':_0x438f1a[_0x8886('0x3f')]||_0x438f1a[_0x8886('0x23')],'authorization':_0x438f1a['authToken']};var _0x57b50={'method':_0x8886('0x40'),'uri':_0x8886('0x41'),'body':_0x347961,'json':!![]};rp(_0x57b50)[_0x8886('0x18')](function(_0x2125cd){var _0x344a2f={'messageId':_0x2125cd[_0x8886('0x42')]};if(!_0x438f1a[_0x8886('0x3b')]){_0x344a2f[_0x8886('0x3c')]=!![];}return _0x1d25b0['update'](_0x344a2f);})[_0x8886('0x1b')](function(_0x3d2ab5){logger['error'](_0x8886('0x2e'),_0x8886('0x2c'),'connectel',util[_0x8886('0x2d')](_0x3d2ab5,{'showHidden':![],'depth':null}));});}else{logger[_0x8886('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','connectel',_0x8886('0x43'));}break;case _0x8886('0x44'):if(_0x438f1a[_0x8886('0x34')]&&_0x438f1a[_0x8886('0x30')]){var _0x347961={'messages':[{'source':_0x8886('0x45'),'to':_0x53b896[_0x8886('0x23')],'body':_0x53b896['body'],'from':_0x438f1a['senderString']||_0x438f1a['phone']}]};var _0x5ce50c=util['format'](_0x8886('0x46'),_0x438f1a[_0x8886('0x34')],_0x438f1a[_0x8886('0x30')]);var _0x57b50={'method':_0x8886('0x40'),'uri':_0x8886('0x47'),'body':_0x347961,'headers':{'Authorization':util[_0x8886('0x48')](_0x8886('0x49'),new Buffer(_0x5ce50c)['toString'](_0x8886('0x4a')))},'json':!![]};rp(_0x57b50)[_0x8886('0x18')](function(_0x19334f){if(_0x19334f[_0x8886('0x4b')]>=0xc8&&_0x19334f[_0x8886('0x4b')]<=0xce){if(_0x19334f['data']&&_0x19334f[_0x8886('0x4c')]['queued_count']>0x0){var _0x297cdc=_[_0x8886('0x4d')](_0x19334f[_0x8886('0x4c')][_0x8886('0x24')]);var _0x374380={'messageId':_0x297cdc[_0x8886('0x4e')]};if(!_0x438f1a[_0x8886('0x3b')]){_0x374380['read']=!![];}return _0x1d25b0['update'](_0x374380);}else{logger[_0x8886('0x2b')](_0x8886('0x2e'),_0x8886('0x2c'),_0x8886('0x4f'),util[_0x8886('0x2d')](_0x19334f,{'showHidden':![],'depth':null}));}}else{logger[_0x8886('0x2b')](_0x8886('0x2e'),_0x8886('0x2c'),_0x8886('0x4f'),util[_0x8886('0x2d')](_0x19334f,{'showHidden':![],'depth':null}));}})[_0x8886('0x1b')](function(_0x103682){logger['error'](_0x8886('0x2e'),_0x8886('0x2c'),_0x8886('0x4f'),util['inspect'](_0x103682,{'showHidden':![],'depth':null}));});}else{logger[_0x8886('0x2b')](_0x8886('0x2e'),_0x8886('0x2c'),'clickSend',_0x8886('0x3e'));}break;case _0x8886('0x50'):if(_0x438f1a[_0x8886('0x51')]&&_0x438f1a['authToken']){var _0x347961={'dst':_0x53b896['phone'],'text':_0x53b896[_0x8886('0xf')],'src':_0x438f1a[_0x8886('0x3f')]||_0x438f1a['phone'],'url':_0x438f1a[_0x8886('0x26')]+'/api/sms/messages/'+_0x53b896['id']+'/status?token='+_0x438f1a[_0x8886('0x29')]};var _0x5ce50c=util[_0x8886('0x48')](_0x8886('0x46'),_0x438f1a[_0x8886('0x51')],_0x438f1a[_0x8886('0x22')]);var _0x57b50={'method':_0x8886('0x40'),'uri':util[_0x8886('0x48')](_0x8886('0x52'),_0x438f1a['authId']),'body':_0x347961,'headers':{'Authorization':util[_0x8886('0x48')](_0x8886('0x49'),new Buffer(_0x5ce50c)[_0x8886('0x53')](_0x8886('0x4a')))},'json':!![]};rp(_0x57b50)[_0x8886('0x18')](function(_0x2b0ebe){var _0x243195={'messageId':_0x2b0ebe[_0x8886('0x54')][0x0]};return _0x1d25b0[_0x8886('0x19')](_0x243195);})[_0x8886('0x1b')](function(_0x359eec){logger[_0x8886('0x2b')](_0x8886('0x2e'),_0x8886('0x2c'),'plivo',util[_0x8886('0x2d')](_0x359eec,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8886('0x2c'),'plivo',_0x8886('0x55'));}break;case'infobip':if(_0x438f1a[_0x8886('0x34')]&&_0x438f1a[_0x8886('0x30')]){if(_0x438f1a[_0x8886('0x56')]){var _0x20fc92={'method':'POST','uri':_0x438f1a[_0x8886('0x56')]+_0x8886('0x57'),'body':{'username':_0x438f1a[_0x8886('0x34')],'password':_0x438f1a['password']},'json':!![]};return rp(_0x20fc92)[_0x8886('0x18')](function(_0x3e981b){var _0x14f5c6={'method':'POST','uri':_0x438f1a[_0x8886('0x56')]+_0x8886('0x58'),'body':{'messages':[{'from':_0x438f1a['phone'],'destinations':[{'to':_0x53b896[_0x8886('0x23')]}],'text':_0x53b896[_0x8886('0xf')],'notifyUrl':_0x438f1a[_0x8886('0x26')]+_0x8886('0x27')+_0x53b896['id']+_0x8886('0x28')+_0x438f1a['token'],'notifyContentType':_0x8886('0x59'),'callbackData':_0x438f1a[_0x8886('0x23')]+';'+_0x53b896['body']}]},'headers':{'Authorization':_0x8886('0x5a')+_0x3e981b[_0x8886('0x29')]},'json':!![]};return rp(_0x14f5c6)[_0x8886('0x18')](function(_0x8a7dd2){if(_0x8a7dd2['messages']){var _0x210f19={'messageId':_0x8a7dd2['messages'][0x0][_0x8886('0xd')]};if(!_0x438f1a[_0x8886('0x3b')]){_0x210f19['read']=!![];}return _0x1d25b0[_0x8886('0x19')](_0x210f19);}else{return logger[_0x8886('0x2b')](_0x8886('0x2e'),_0x8886('0x2c'),_0x8886('0x5b'),util[_0x8886('0x2d')](_0x8a7dd2,{'showHidden':![],'depth':null}));}});})[_0x8886('0x1b')](function(_0x3c1d07){return logger[_0x8886('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8886('0x2c'),_0x8886('0x5b'),util[_0x8886('0x2d')](_0x3c1d07,{'showHidden':![],'depth':null}));});}else{logger[_0x8886('0x2b')](_0x8886('0x2e'),_0x8886('0x2c'),_0x8886('0x5b'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0x8886('0x2e'),_0x8886('0x2c'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0x8886('0x5c'):var _0x2d51f7=require(_0x8886('0x5d'));if(_0x438f1a[_0x8886('0x5e')]){var _0x59cf19={};_0x59cf19[_0x8886('0x5f')]=_0x438f1a['username'];_0x59cf19[_0x8886('0x23')]=_0x53b896['phone'];_0x59cf19[_0x8886('0x32')]=_0x438f1a[_0x8886('0x23')];_0x59cf19[_0x8886('0x60')]=_0x53b896[_0x8886('0xf')];_0x59cf19[_0x8886('0x61')]=+new Date();var _0x57b656='';var _0x2f701a='';var _0x1e904c=Object[_0x8886('0x62')](_0x59cf19);_0x1e904c['sort']();for(var _0x5140a1=0x0;_0x5140a1<_0x1e904c[_0x8886('0x63')];_0x5140a1++){if(_0x57b656!=''){_0x57b656+='&';}_0x57b656+=_0x1e904c[_0x5140a1]+'='+encodeURIComponent(_0x59cf19[_0x1e904c[_0x5140a1]]);_0x2f701a+=_0x59cf19[_0x1e904c[_0x5140a1]];}_0x2f701a+=_0x438f1a[_0x8886('0x5e')];_0x2f701a=_0x2d51f7['createHash'](_0x8886('0x64'))[_0x8886('0x19')](_0x2f701a)[_0x8886('0x65')](_0x8886('0x66'));if(_0x57b656!==''){_0x57b656+='&';}_0x57b656+=_0x8886('0x67')+_0x2f701a;var _0x48ccb0={'method':_0x8886('0x35'),'uri':_0x438f1a[_0x8886('0x56')]+_0x8886('0x68')+_0x57b656,'json':!![]};return rp(_0x48ccb0)['then'](function(_0x11808d){var _0x3da7bb=Object[_0x8886('0x62')](_0x11808d);if(_0x11808d[_0x3da7bb[0x0]]['error']&&parseInt(_0x11808d[_0x3da7bb[0x0]][_0x8886('0x2b')])===0x0){var _0x3ea6cb={'messageId':_0x11808d[_0x3da7bb[0x0]][_0x8886('0x69')]};if(!_0x438f1a[_0x8886('0x3b')]){_0x3ea6cb[_0x8886('0x3c')]=!![];}return _0x1d25b0[_0x8886('0x19')](_0x3ea6cb);}else{return logger[_0x8886('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8886('0x2c'),_0x8886('0x5c'),util[_0x8886('0x2d')](_0x11808d['error'],{'showHidden':![],'depth':null}));}})[_0x8886('0x1b')](function(_0x1bfdeb){return logger[_0x8886('0x2b')](_0x8886('0x2e'),'afterCreate',_0x8886('0x5c'),util[_0x8886('0x2d')](_0x1bfdeb,{'showHidden':![],'depth':null}));});}else{logger[_0x8886('0x2b')](_0x8886('0x2e'),'afterCreate','csc',_0x8886('0x6a'));}break;case _0x8886('0x6b'):if(_0x438f1a[_0x8886('0x5e')]){var _0x541454={'method':_0x8886('0x40'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x438f1a[_0x8886('0x5e')]},'body':{'content':_0x53b896[_0x8886('0xf')],'to':[_0x53b896[_0x8886('0x23')]],'from':_0x438f1a['phone'],'binary':![],'clientMessageId':_0x8886('0x6c'),'charset':_0x8886('0x6d')},'json':!![]};rp(_0x541454)[_0x8886('0x18')](function(_0x329ef6){if(!_0x329ef6[_0x8886('0x2b')]){var _0x57dfbb={'messageId':_0x329ef6[_0x8886('0x24')][0x0][_0x8886('0x6e')]};if(!_0x438f1a[_0x8886('0x3b')]){_0x57dfbb['read']=!![];}return _0x1d25b0[_0x8886('0x19')](_0x57dfbb);}else{return logger[_0x8886('0x2b')](_0x8886('0x2e'),'afterCreate',_0x8886('0x6b'),util['inspect'](_0x329ef6[_0x8886('0x2b')],{'showHidden':![],'depth':null}));}})[_0x8886('0x1b')](function(_0x3a1b05){return logger[_0x8886('0x2b')](_0x8886('0x2e'),'afterCreate',_0x8886('0x6b'),util['inspect'](_0x3a1b05,{'showHidden':![],'depth':null}));});}else{logger[_0x8886('0x2b')](_0x8886('0x2e'),_0x8886('0x2c'),_0x8886('0x6b'),_0x8886('0x6a'));}break;case _0x8886('0x6f'):if(_0x438f1a[_0x8886('0x34')]&&_0x438f1a['password']){var _0x5ce50c=util[_0x8886('0x48')](_0x8886('0x46'),_0x438f1a[_0x8886('0x34')],_0x438f1a[_0x8886('0x30')]);var _0x57b50={'method':_0x8886('0x40'),'uri':_0x8886('0x70')+_0x438f1a['accountId']+'/messages','body':{'to':[_0x53b896['phone']],'text':_0x53b896['body'],'from':_0x438f1a['phone'],'applicationId':_0x438f1a[_0x8886('0x71')]},'headers':{'Authorization':util[_0x8886('0x48')](_0x8886('0x49'),new Buffer(_0x5ce50c)[_0x8886('0x53')](_0x8886('0x4a')))},'json':!![]};rp(_0x57b50)[_0x8886('0x18')](function(_0x4c9351){if(_0x4c9351['id']){var _0x4cfdf6={'messageId':_0x4c9351['id']};return _0x1d25b0[_0x8886('0x19')](_0x4cfdf6);}else{logger[_0x8886('0x2b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x8886('0x6f'),util['inspect'](_0x4c9351,{'showHidden':![],'depth':null}));}})[_0x8886('0x1b')](function(_0x1e4074){logger[_0x8886('0x2b')](_0x8886('0x2e'),_0x8886('0x2c'),_0x8886('0x6f'),util[_0x8886('0x2d')](_0x1e4074,{'showHidden':![],'depth':null}));});}else{logger[_0x8886('0x2b')](_0x8886('0x2e'),'afterCreate',_0x8886('0x6f'),_0x8886('0x3e'));}break;case _0x8886('0x72'):if(_0x438f1a['apiKey']){var _0x4b39cb={};var _0x48ccb0={'method':_0x8886('0x40'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x8886('0x73')+_0x438f1a[_0x8886('0x5e')],'Content-Type':'application/json'},'body':{'from':_0x438f1a[_0x8886('0x23')],'to':_0x53b896[_0x8886('0x23')],'text':_0x53b896[_0x8886('0xf')]},'json':!![]};return rp(_0x48ccb0)[_0x8886('0x18')](function(_0xc9fb45){if(_0xc9fb45[_0x8886('0x74')]==0xca){_0x4b39cb[_0x8886('0x75')]=_0xc9fb45;var _0x18011a={'method':_0x8886('0x40'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x8886('0x73')+_0x438f1a['apiKey'],'Content-Type':_0x8886('0x59')},'body':{'refid':_0x4b39cb['message'][_0x8886('0x76')]},'json':!![]};return rp(_0x18011a)[_0x8886('0x18')](function(_0x198e33){_0x4b39cb[_0x8886('0x77')]=_0x198e33;var _0x47c4c2={'messageId':_0x4b39cb['message'][_0x8886('0x76')],'read':!![]};return _0x1d25b0[_0x8886('0x19')](_0x47c4c2);});}else{return logger[_0x8886('0x2b')](_0x8886('0x2e'),_0x8886('0x2c'),_0x8886('0x72'),util[_0x8886('0x2d')](_0xc9fb45,{'showHidden':![],'depth':null}));}})[_0x8886('0x1b')](function(_0x285ea9){return logger[_0x8886('0x2b')](_0x8886('0x2e'),'afterCreate',_0x8886('0x72'),util[_0x8886('0x2d')](_0x285ea9,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x8886('0x2e'),_0x8886('0x2c'),_0x8886('0x72'),_0x8886('0x78'));}break;}}})['finally'](function(){_0x4d16aa();});}else{_0x4d16aa();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xe3db=['sms','POST','user_key','session_key','read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','toString','base64','http_code','data','queued_count','head','message_id','deliveryReport','clickSend','plivo','/status?token=','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','IBSSO\x20','crypto','login','text','keys','sort','length','apiKey','createHash','md5','hex','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','sender','&password=','GET','split'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe3db,0xc8));var _0xbe3d=function(_0x4981b7,_0x34cc89){_0x4981b7=_0x4981b7-0x0;var _0x2acd60=_0xe3db[_0x4981b7];return _0x2acd60;};'use strict';var _=require(_0xbe3d('0x0'));var util=require(_0xbe3d('0x1'));var logger=require('../../config/logger')(_0xbe3d('0x2'));var moment=require(_0xbe3d('0x3'));var BPromise=require(_0xbe3d('0x4'));var rp=require(_0xbe3d('0x5'));var fs=require('fs');var path=require(_0xbe3d('0x6'));var rimraf=require(_0xbe3d('0x7'));var config=require(_0xbe3d('0x8'));var attributes=require(_0xbe3d('0x9'));module[_0xbe3d('0xa')]=function(_0xd5a81,_0x2b4c19){return _0xd5a81['define'](_0xbe3d('0xb'),attributes,{'tableName':_0xbe3d('0xc'),'paranoid':![],'indexes':[{'name':_0xbe3d('0xd'),'fields':[_0xbe3d('0xd')]},{'name':'fti_sms_messages','fields':[_0xbe3d('0xe')],'type':_0xbe3d('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x514464,_0x5eddd8,_0x3b313c){var _0x29d4d6=_0xd5a81[_0xbe3d('0x10')];var _0x18e9f7=_0x514464[_0xbe3d('0x11')]({'plain':!![]});if(_0x18e9f7[_0xbe3d('0x12')][_0xbe3d('0x13')]()==='in'||_0x18e9f7[_0xbe3d('0x12')][_0xbe3d('0x13')]()===_0xbe3d('0x14')&&!_0x18e9f7[_0xbe3d('0x15')]&&!_[_0xbe3d('0x16')](_0x18e9f7['UserId'])){_0x29d4d6[_0xbe3d('0x17')][_0xbe3d('0x18')]({'where':{'id':_0x18e9f7[_0xbe3d('0x19')]}})[_0xbe3d('0x1a')](function(_0x81f5c7){if(_0x81f5c7){_0x81f5c7[_0xbe3d('0x1b')]({'lastMsgAt':_0x18e9f7[_0xbe3d('0x1c')],'lastMsgDirection':_0x18e9f7[_0xbe3d('0x12')][_0xbe3d('0x13')]()});}})[_0xbe3d('0x1d')](function(_0x2a45ef){console[_0xbe3d('0x1e')](_0x2a45ef);});}if(_0x18e9f7[_0xbe3d('0x12')]===_0xbe3d('0x14')&&!_0x18e9f7['secret']){var _0x16f473;_0x29d4d6[_0xbe3d('0x1f')][_0xbe3d('0x20')]({'where':{'id':_0x18e9f7[_0xbe3d('0x21')]},'raw':!![]})[_0xbe3d('0x1a')](function(_0x1a35af){_0x16f473=_0x1a35af;if(_0x16f473&&_0x16f473[_0xbe3d('0x22')]){switch(_0x16f473[_0xbe3d('0x22')]){case _0xbe3d('0x23'):var _0x5f0b4b=require(_0xbe3d('0x23'));if(_0x16f473[_0xbe3d('0x24')]&&_0x16f473[_0xbe3d('0x25')]&&_0x16f473[_0xbe3d('0x26')]){var _0x316a83=new _0x5f0b4b(_0x16f473[_0xbe3d('0x24')],_0x16f473[_0xbe3d('0x25')]);_0x316a83[_0xbe3d('0x27')][_0xbe3d('0x28')]({'body':_0x18e9f7[_0xbe3d('0xe')],'to':_0x18e9f7[_0xbe3d('0x26')],'from':_0x16f473['phone'],'statusCallback':_0x16f473[_0xbe3d('0x29')]+_0xbe3d('0x2a')+_0x18e9f7['id']+'/status?token='+_0x16f473[_0xbe3d('0x2b')]})['then'](function(_0x638959){if(_0x638959[_0xbe3d('0x2c')]){return _0x514464['update']({'messageId':_0x638959[_0xbe3d('0x2c')]});}})[_0xbe3d('0x1d')](function(_0x39c4d2){logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),_0xbe3d('0x2e'),_0xbe3d('0x23'),util[_0xbe3d('0x2f')](_0x39c4d2,{'showHidden':![],'depth':null}));});}else{logger[_0xbe3d('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbe3d('0x2e'),'twilio',_0xbe3d('0x30'));}break;case'skebby':var _0x40083f='https://api.skebby.it/API/v1.0/REST/';if(_0x16f473[_0xbe3d('0x31')]&&_0x16f473[_0xbe3d('0x32')]){var _0x44c3dc={'recipient':[_0x18e9f7[_0xbe3d('0x26')]],'message':_0x18e9f7[_0xbe3d('0xe')],'message_type':_0x16f473[_0xbe3d('0x33')]};if(_0x16f473[_0xbe3d('0x33')]&&_0x16f473['smsMethod']!=='SI'){_0x44c3dc[_0xbe3d('0x34')]=_0x16f473[_0xbe3d('0x26')];}var _0x1620e4={'url':_0x40083f+'login?username='+_0x16f473[_0xbe3d('0x31')]+_0xbe3d('0x35')+_0x16f473[_0xbe3d('0x32')],'method':_0xbe3d('0x36')};rp(_0x1620e4)[_0xbe3d('0x1a')](function(_0x159479){var _0x3b8b42=_0x159479[_0xbe3d('0x37')](';');var _0x553a45={'user_key':_0x3b8b42[0x0],'session_key':_0x3b8b42[0x1]};_0x1620e4={'url':_0x40083f+_0xbe3d('0x38'),'method':_0xbe3d('0x39'),'headers':{'user_key':_0x553a45[_0xbe3d('0x3a')],'Session_key':_0x553a45[_0xbe3d('0x3b')]},'json':!![],'body':_0x44c3dc};return rp(_0x1620e4);})[_0xbe3d('0x1a')](function(_0x569785){if(_0x569785['total_sent']>=0x1){var _0x217f2f={'messageId':_0x569785['internal_order_id']};if(_0x16f473['smsMethod']!=='GP'||!_0x16f473['deliveryReport']){_0x217f2f[_0xbe3d('0x3c')]=!![];}return _0x514464[_0xbe3d('0x1b')](_0x217f2f);}else{return logger[_0xbe3d('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbe3d('0x2e'),_0xbe3d('0x3d'),util[_0xbe3d('0x2f')](_0x569785,{'showHidden':![],'depth':null}));}})['catch'](function(_0x466020){return logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),_0xbe3d('0x2e'),_0xbe3d('0x3d'),util[_0xbe3d('0x2f')](_0x466020,{'showHidden':![],'depth':null}));});}else{logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),_0xbe3d('0x2e'),_0xbe3d('0x3d'),_0xbe3d('0x3e'));}break;case _0xbe3d('0x3f'):if(_0x16f473['authToken']){var _0x5131fa={'recipient':_0x18e9f7[_0xbe3d('0x26')],'message':_0x18e9f7[_0xbe3d('0xe')],'sender':_0x16f473[_0xbe3d('0x40')]||_0x16f473[_0xbe3d('0x26')],'authorization':_0x16f473[_0xbe3d('0x25')]};var _0x5eddd8={'method':_0xbe3d('0x39'),'uri':_0xbe3d('0x41'),'body':_0x5131fa,'json':!![]};rp(_0x5eddd8)[_0xbe3d('0x1a')](function(_0x42adb8){var _0x549459={'messageId':_0x42adb8[_0xbe3d('0x42')]};if(!_0x16f473['deliveryReport']){_0x549459[_0xbe3d('0x3c')]=!![];}return _0x514464[_0xbe3d('0x1b')](_0x549459);})[_0xbe3d('0x1d')](function(_0x479400){logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),_0xbe3d('0x2e'),_0xbe3d('0x3f'),util[_0xbe3d('0x2f')](_0x479400,{'showHidden':![],'depth':null}));});}else{logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),_0xbe3d('0x2e'),_0xbe3d('0x3f'),'Missing\x20parameters:\x20authToken');}break;case _0xbe3d('0x43'):if(_0x16f473[_0xbe3d('0x31')]&&_0x16f473[_0xbe3d('0x32')]){var _0x5131fa={'messages':[{'source':_0xbe3d('0x44'),'to':_0x18e9f7['phone'],'body':_0x18e9f7[_0xbe3d('0xe')],'from':_0x16f473['senderString']||_0x16f473[_0xbe3d('0x26')]}]};var _0x7f1a50=util['format'](_0xbe3d('0x45'),_0x16f473[_0xbe3d('0x31')],_0x16f473[_0xbe3d('0x32')]);var _0x5eddd8={'method':_0xbe3d('0x39'),'uri':_0xbe3d('0x46'),'body':_0x5131fa,'headers':{'Authorization':util[_0xbe3d('0x47')]('Basic\x20%s',new Buffer(_0x7f1a50)[_0xbe3d('0x48')](_0xbe3d('0x49')))},'json':!![]};rp(_0x5eddd8)[_0xbe3d('0x1a')](function(_0xad5c96){if(_0xad5c96['http_code']>=0xc8&&_0xad5c96[_0xbe3d('0x4a')]<=0xce){if(_0xad5c96[_0xbe3d('0x4b')]&&_0xad5c96[_0xbe3d('0x4b')][_0xbe3d('0x4c')]>0x0){var _0x3810c8=_[_0xbe3d('0x4d')](_0xad5c96[_0xbe3d('0x4b')][_0xbe3d('0x27')]);var _0x30750d={'messageId':_0x3810c8[_0xbe3d('0x4e')]};if(!_0x16f473[_0xbe3d('0x4f')]){_0x30750d[_0xbe3d('0x3c')]=!![];}return _0x514464['update'](_0x30750d);}else{logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),_0xbe3d('0x2e'),'clickSend',util[_0xbe3d('0x2f')](_0xad5c96,{'showHidden':![],'depth':null}));}}else{logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),'afterCreate',_0xbe3d('0x50'),util[_0xbe3d('0x2f')](_0xad5c96,{'showHidden':![],'depth':null}));}})[_0xbe3d('0x1d')](function(_0x5cbe72){logger[_0xbe3d('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xbe3d('0x50'),util[_0xbe3d('0x2f')](_0x5cbe72,{'showHidden':![],'depth':null}));});}else{logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),_0xbe3d('0x2e'),'clickSend',_0xbe3d('0x3e'));}break;case _0xbe3d('0x51'):if(_0x16f473['authId']&&_0x16f473[_0xbe3d('0x25')]){var _0x5131fa={'dst':_0x18e9f7[_0xbe3d('0x26')],'text':_0x18e9f7[_0xbe3d('0xe')],'src':_0x16f473['senderString']||_0x16f473[_0xbe3d('0x26')],'url':_0x16f473[_0xbe3d('0x29')]+_0xbe3d('0x2a')+_0x18e9f7['id']+_0xbe3d('0x52')+_0x16f473[_0xbe3d('0x2b')]};var _0x7f1a50=util[_0xbe3d('0x47')]('%s:%s',_0x16f473[_0xbe3d('0x53')],_0x16f473[_0xbe3d('0x25')]);var _0x5eddd8={'method':_0xbe3d('0x39'),'uri':util['format'](_0xbe3d('0x54'),_0x16f473[_0xbe3d('0x53')]),'body':_0x5131fa,'headers':{'Authorization':util[_0xbe3d('0x47')](_0xbe3d('0x55'),new Buffer(_0x7f1a50)['toString'](_0xbe3d('0x49')))},'json':!![]};rp(_0x5eddd8)[_0xbe3d('0x1a')](function(_0x5f3a33){var _0xd83ee2={'messageId':_0x5f3a33[_0xbe3d('0x56')][0x0]};return _0x514464[_0xbe3d('0x1b')](_0xd83ee2);})[_0xbe3d('0x1d')](function(_0x3ed7cb){logger['error'](_0xbe3d('0x2d'),'afterCreate','plivo',util[_0xbe3d('0x2f')](_0x3ed7cb,{'showHidden':![],'depth':null}));});}else{logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),_0xbe3d('0x2e'),_0xbe3d('0x51'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xbe3d('0x57'):if(_0x16f473['username']&&_0x16f473[_0xbe3d('0x32')]){if(_0x16f473[_0xbe3d('0x58')]){var _0x16787a={'method':_0xbe3d('0x39'),'uri':_0x16f473[_0xbe3d('0x58')]+_0xbe3d('0x59'),'body':{'username':_0x16f473['username'],'password':_0x16f473['password']},'json':!![]};return rp(_0x16787a)[_0xbe3d('0x1a')](function(_0x2a8aba){var _0x42b757={'method':_0xbe3d('0x39'),'uri':_0x16f473['baseUrl']+_0xbe3d('0x5a'),'body':{'messages':[{'from':_0x16f473[_0xbe3d('0x26')],'destinations':[{'to':_0x18e9f7['phone']}],'text':_0x18e9f7[_0xbe3d('0xe')],'notifyUrl':_0x16f473[_0xbe3d('0x29')]+'/api/sms/messages/'+_0x18e9f7['id']+_0xbe3d('0x52')+_0x16f473[_0xbe3d('0x2b')],'notifyContentType':'application/json','callbackData':_0x16f473[_0xbe3d('0x26')]+';'+_0x18e9f7['body']}]},'headers':{'Authorization':_0xbe3d('0x5b')+_0x2a8aba['token']},'json':!![]};return rp(_0x42b757)[_0xbe3d('0x1a')](function(_0x334175){if(_0x334175[_0xbe3d('0x27')]){var _0x488acb={'messageId':_0x334175['messages'][0x0][_0xbe3d('0xd')]};if(!_0x16f473[_0xbe3d('0x4f')]){_0x488acb[_0xbe3d('0x3c')]=!![];}return _0x514464[_0xbe3d('0x1b')](_0x488acb);}else{return logger['error'](_0xbe3d('0x2d'),_0xbe3d('0x2e'),'infobip',util[_0xbe3d('0x2f')](_0x334175,{'showHidden':![],'depth':null}));}});})[_0xbe3d('0x1d')](function(_0x421f12){return logger['error'](_0xbe3d('0x2d'),'afterCreate',_0xbe3d('0x57'),util[_0xbe3d('0x2f')](_0x421f12,{'showHidden':![],'depth':null}));});}else{logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),_0xbe3d('0x2e'),_0xbe3d('0x57'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xbe3d('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbe3d('0x2e'),_0xbe3d('0x57'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x594470=require(_0xbe3d('0x5c'));if(_0x16f473['apiKey']){var _0x9eee30={};_0x9eee30[_0xbe3d('0x5d')]=_0x16f473[_0xbe3d('0x31')];_0x9eee30[_0xbe3d('0x26')]=_0x18e9f7[_0xbe3d('0x26')];_0x9eee30[_0xbe3d('0x34')]=_0x16f473[_0xbe3d('0x26')];_0x9eee30[_0xbe3d('0x5e')]=_0x18e9f7[_0xbe3d('0xe')];_0x9eee30['timestamp']=+new Date();var _0x2e02fc='';var _0x4e29e3='';var _0x24901c=Object[_0xbe3d('0x5f')](_0x9eee30);_0x24901c[_0xbe3d('0x60')]();for(var _0x36ff47=0x0;_0x36ff47<_0x24901c[_0xbe3d('0x61')];_0x36ff47++){if(_0x2e02fc!=''){_0x2e02fc+='&';}_0x2e02fc+=_0x24901c[_0x36ff47]+'='+encodeURIComponent(_0x9eee30[_0x24901c[_0x36ff47]]);_0x4e29e3+=_0x9eee30[_0x24901c[_0x36ff47]];}_0x4e29e3+=_0x16f473[_0xbe3d('0x62')];_0x4e29e3=_0x594470[_0xbe3d('0x63')](_0xbe3d('0x64'))[_0xbe3d('0x1b')](_0x4e29e3)['digest'](_0xbe3d('0x65'));if(_0x2e02fc!==''){_0x2e02fc+='&';}_0x2e02fc+=_0xbe3d('0x66')+_0x4e29e3;var _0x1620e4={'method':_0xbe3d('0x36'),'uri':_0x16f473[_0xbe3d('0x58')]+_0xbe3d('0x67')+_0x2e02fc,'json':!![]};return rp(_0x1620e4)['then'](function(_0x2bbb28){var _0x35aa5a=Object[_0xbe3d('0x5f')](_0x2bbb28);if(_0x2bbb28[_0x35aa5a[0x0]][_0xbe3d('0x1e')]&&parseInt(_0x2bbb28[_0x35aa5a[0x0]]['error'])===0x0){var _0x52926f={'messageId':_0x2bbb28[_0x35aa5a[0x0]][_0xbe3d('0x68')]};if(!_0x16f473[_0xbe3d('0x4f')]){_0x52926f['read']=!![];}return _0x514464[_0xbe3d('0x1b')](_0x52926f);}else{return logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),_0xbe3d('0x2e'),_0xbe3d('0x69'),util[_0xbe3d('0x2f')](_0x2bbb28[_0xbe3d('0x1e')],{'showHidden':![],'depth':null}));}})[_0xbe3d('0x1d')](function(_0x53da5a){return logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),'afterCreate','csc',util[_0xbe3d('0x2f')](_0x53da5a,{'showHidden':![],'depth':null}));});}else{logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),_0xbe3d('0x2e'),_0xbe3d('0x69'),_0xbe3d('0x6a'));}break;case _0xbe3d('0x6b'):if(_0x16f473[_0xbe3d('0x62')]){var _0x415780={'method':_0xbe3d('0x39'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x16f473[_0xbe3d('0x62')]},'body':{'content':_0x18e9f7[_0xbe3d('0xe')],'to':[_0x18e9f7[_0xbe3d('0x26')]],'from':_0x16f473['phone'],'binary':![],'clientMessageId':_0xbe3d('0x6c'),'charset':'UTF-8'},'json':!![]};rp(_0x415780)['then'](function(_0x5e9c59){if(!_0x5e9c59[_0xbe3d('0x1e')]){var _0x1e1d84={'messageId':_0x5e9c59[_0xbe3d('0x27')][0x0][_0xbe3d('0x6d')]};if(!_0x16f473[_0xbe3d('0x4f')]){_0x1e1d84[_0xbe3d('0x3c')]=!![];}return _0x514464[_0xbe3d('0x1b')](_0x1e1d84);}else{return logger[_0xbe3d('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xbe3d('0x6b'),util[_0xbe3d('0x2f')](_0x5e9c59['error'],{'showHidden':![],'depth':null}));}})[_0xbe3d('0x1d')](function(_0x4bbaf4){return logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),_0xbe3d('0x2e'),_0xbe3d('0x6b'),util[_0xbe3d('0x2f')](_0x4bbaf4,{'showHidden':![],'depth':null}));});}else{logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),_0xbe3d('0x2e'),'clickatell',_0xbe3d('0x6a'));}break;case _0xbe3d('0x6e'):if(_0x16f473[_0xbe3d('0x31')]&&_0x16f473[_0xbe3d('0x32')]){var _0x7f1a50=util[_0xbe3d('0x47')](_0xbe3d('0x45'),_0x16f473[_0xbe3d('0x31')],_0x16f473['password']);var _0x5eddd8={'method':_0xbe3d('0x39'),'uri':_0xbe3d('0x6f')+_0x16f473[_0xbe3d('0x70')]+_0xbe3d('0x71'),'body':{'to':[_0x18e9f7[_0xbe3d('0x26')]],'text':_0x18e9f7['body'],'from':_0x16f473[_0xbe3d('0x26')],'applicationId':_0x16f473[_0xbe3d('0x72')]},'headers':{'Authorization':util[_0xbe3d('0x47')](_0xbe3d('0x55'),new Buffer(_0x7f1a50)[_0xbe3d('0x48')](_0xbe3d('0x49')))},'json':!![]};rp(_0x5eddd8)['then'](function(_0x561af1){if(_0x561af1['id']){var _0x4f36ee={'messageId':_0x561af1['id']};return _0x514464[_0xbe3d('0x1b')](_0x4f36ee);}else{logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),'afterCreate',_0xbe3d('0x6e'),util[_0xbe3d('0x2f')](_0x561af1,{'showHidden':![],'depth':null}));}})[_0xbe3d('0x1d')](function(_0x594737){logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),_0xbe3d('0x2e'),'bandwidth',util['inspect'](_0x594737,{'showHidden':![],'depth':null}));});}else{logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),_0xbe3d('0x2e'),_0xbe3d('0x6e'),_0xbe3d('0x3e'));}break;case _0xbe3d('0x73'):if(_0x16f473['apiKey']){var _0x5d7a74={};var _0x1620e4={'method':_0xbe3d('0x39'),'uri':_0xbe3d('0x74'),'headers':{'Authorization':_0xbe3d('0x75')+_0x16f473[_0xbe3d('0x62')],'Content-Type':_0xbe3d('0x76')},'body':{'from':_0x16f473[_0xbe3d('0x26')],'to':_0x18e9f7[_0xbe3d('0x26')],'text':_0x18e9f7[_0xbe3d('0xe')]},'json':!![]};return rp(_0x1620e4)['then'](function(_0x50dd97){if(_0x50dd97[_0xbe3d('0x77')]==0xca){_0x5d7a74[_0xbe3d('0x78')]=_0x50dd97;var _0x3fa490={'method':'POST','uri':_0xbe3d('0x79'),'headers':{'Authorization':'Bearer\x20'+_0x16f473[_0xbe3d('0x62')],'Content-Type':_0xbe3d('0x76')},'body':{'refid':_0x5d7a74['message'][_0xbe3d('0x7a')]},'json':!![]};return rp(_0x3fa490)[_0xbe3d('0x1a')](function(_0x301fd8){_0x5d7a74[_0xbe3d('0x7b')]=_0x301fd8;var _0x3ee086={'messageId':_0x5d7a74[_0xbe3d('0x78')][_0xbe3d('0x7a')],'read':!![]};return _0x514464[_0xbe3d('0x1b')](_0x3ee086);});}else{return logger[_0xbe3d('0x1e')](_0xbe3d('0x2d'),'afterCreate','intelepeer',util[_0xbe3d('0x2f')](_0x50dd97,{'showHidden':![],'depth':null}));}})['catch'](function(_0x35ff8d){return logger['error'](_0xbe3d('0x2d'),'afterCreate','intelepeer',util[_0xbe3d('0x2f')](_0x35ff8d,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xbe3d('0x2d'),_0xbe3d('0x2e'),'intelepeer',_0xbe3d('0x7c'));}break;}}})[_0xbe3d('0x7d')](function(){_0x3b313c();});}else{_0x3b313c();}}},'charset':_0xbe3d('0x7e'),'collate':_0xbe3d('0x7f')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index eb2bde2..388c040 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 _0xc697=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','error','message','catch','SmsMessage','create','options','raw','CreateSmsMessage','debug','stringify','lodash'];(function(_0x2c1265,_0x5526f4){var _0x16a191=function(_0x59f6a9){while(--_0x59f6a9){_0x2c1265['push'](_0x2c1265['shift']());}};_0x16a191(++_0x5526f4);}(_0xc697,0x104));var _0x7c69=function(_0x41f663,_0x5996bd){_0x41f663=_0x41f663-0x0;var _0x1cd296=_0xc697[_0x41f663];return _0x1cd296;};'use strict';var _=require(_0x7c69('0x0'));var util=require(_0x7c69('0x1'));var moment=require(_0x7c69('0x2'));var BPromise=require(_0x7c69('0x3'));var rs=require(_0x7c69('0x4'));var fs=require('fs');var Redis=require(_0x7c69('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c69('0x6'));var logger=require(_0x7c69('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c69('0x8'));var client=jayson[_0x7c69('0x9')]['http']({'port':0x232a});config[_0x7c69('0xa')]=_[_0x7c69('0xb')](config[_0x7c69('0xa')],{'host':_0x7c69('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c69('0xa')]));require('./smsMessage.socket')[_0x7c69('0xd')](socket);function respondWithRpcPromise(_0x3fbfd8,_0x24a949,_0x15dee3){return new BPromise(function(_0x4bd6e8,_0x1e3f8c){return client[_0x7c69('0xe')](_0x3fbfd8,_0x15dee3)[_0x7c69('0xf')](function(_0x584409){logger[_0x7c69('0x10')](_0x7c69('0x11'),_0x24a949,_0x7c69('0x12'));logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x24a949,_0x7c69('0x12'),JSON['stringify'](_0x584409));if(_0x584409['error']){if(_0x584409[_0x7c69('0x13')]['code']===0x1f4){logger['error'](_0x7c69('0x11'),_0x24a949,_0x584409[_0x7c69('0x13')][_0x7c69('0x14')]);return _0x1e3f8c(_0x584409[_0x7c69('0x13')][_0x7c69('0x14')]);}logger['error'](_0x7c69('0x11'),_0x24a949,_0x584409[_0x7c69('0x13')][_0x7c69('0x14')]);return _0x4bd6e8(_0x584409[_0x7c69('0x13')][_0x7c69('0x14')]);}else{logger[_0x7c69('0x10')](_0x7c69('0x11'),_0x24a949,'request\x20sent');_0x4bd6e8(_0x584409['result'][_0x7c69('0x14')]);}})[_0x7c69('0x15')](function(_0x31290d){logger[_0x7c69('0x13')]('SmsMessage,\x20%s,\x20%s',_0x24a949,_0x31290d);_0x1e3f8c(_0x31290d);});});}exports['CreateSmsMessage']=function(_0x3961ce){var _0x49f040=this;return new Promise(function(_0x3e29ec,_0xf58cbb){return db[_0x7c69('0x16')][_0x7c69('0x17')](_0x3961ce['body'],{'raw':_0x3961ce[_0x7c69('0x18')]?_0x3961ce[_0x7c69('0x18')][_0x7c69('0x19')]===undefined?!![]:![]:!![]})[_0x7c69('0xf')](function(_0x21acf4){logger['info'](_0x7c69('0x1a'),_0x3961ce);logger[_0x7c69('0x1b')](_0x7c69('0x1a'),_0x3961ce,JSON[_0x7c69('0x1c')](_0x21acf4));_0x3e29ec(_0x21acf4);})[_0x7c69('0x15')](function(_0x5dd4b6){logger[_0x7c69('0x13')](_0x7c69('0x1a'),_0x5dd4b6[_0x7c69('0x14')],_0x3961ce);_0xf58cbb(_0x49f040[_0x7c69('0x13')](0x1f4,_0x5dd4b6['message']));});});}; \ No newline at end of file +var _0xec9d=['moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','./smsMessage.socket','register','request','then','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','create','body','options','raw','info','lodash','util'];(function(_0x2430b6,_0x3c4ebf){var _0x574f3c=function(_0x1736ff){while(--_0x1736ff){_0x2430b6['push'](_0x2430b6['shift']());}};_0x574f3c(++_0x3c4ebf);}(_0xec9d,0x1ee));var _0xdec9=function(_0x5eaa24,_0x551639){_0x5eaa24=_0x5eaa24-0x0;var _0x34eb10=_0xec9d[_0x5eaa24];return _0x34eb10;};'use strict';var _=require(_0xdec9('0x0'));var util=require(_0xdec9('0x1'));var moment=require(_0xdec9('0x2'));var BPromise=require('bluebird');var rs=require(_0xdec9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdec9('0x4'));var logger=require(_0xdec9('0x5'))(_0xdec9('0x6'));var config=require(_0xdec9('0x7'));var jayson=require(_0xdec9('0x8'));var client=jayson[_0xdec9('0x9')]['http']({'port':0x232a});config['redis']=_[_0xdec9('0xa')](config[_0xdec9('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdec9('0xb')]));require(_0xdec9('0xc'))[_0xdec9('0xd')](socket);function respondWithRpcPromise(_0x32466e,_0x2c7c75,_0x35c64d){return new BPromise(function(_0x1283d3,_0x1bebc9){return client[_0xdec9('0xe')](_0x32466e,_0x35c64d)[_0xdec9('0xf')](function(_0x4ba37c){logger['info']('SmsMessage,\x20%s,\x20%s',_0x2c7c75,_0xdec9('0x10'));logger[_0xdec9('0x11')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2c7c75,'request\x20sent',JSON[_0xdec9('0x12')](_0x4ba37c));if(_0x4ba37c[_0xdec9('0x13')]){if(_0x4ba37c[_0xdec9('0x13')][_0xdec9('0x14')]===0x1f4){logger[_0xdec9('0x13')](_0xdec9('0x15'),_0x2c7c75,_0x4ba37c[_0xdec9('0x13')][_0xdec9('0x16')]);return _0x1bebc9(_0x4ba37c[_0xdec9('0x13')][_0xdec9('0x16')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x2c7c75,_0x4ba37c[_0xdec9('0x13')]['message']);return _0x1283d3(_0x4ba37c[_0xdec9('0x13')][_0xdec9('0x16')]);}else{logger['info'](_0xdec9('0x15'),_0x2c7c75,_0xdec9('0x10'));_0x1283d3(_0x4ba37c[_0xdec9('0x17')][_0xdec9('0x16')]);}})[_0xdec9('0x18')](function(_0x1a2c4e){logger[_0xdec9('0x13')]('SmsMessage,\x20%s,\x20%s',_0x2c7c75,_0x1a2c4e);_0x1bebc9(_0x1a2c4e);});});}exports[_0xdec9('0x19')]=function(_0x5177ea){var _0x143bc9=this;return new Promise(function(_0x365781,_0x58705f){return db['SmsMessage'][_0xdec9('0x1a')](_0x5177ea[_0xdec9('0x1b')],{'raw':_0x5177ea[_0xdec9('0x1c')]?_0x5177ea[_0xdec9('0x1c')][_0xdec9('0x1d')]===undefined?!![]:![]:!![]})[_0xdec9('0xf')](function(_0xc02d0){logger[_0xdec9('0x1e')](_0xdec9('0x19'),_0x5177ea);logger['debug'](_0xdec9('0x19'),_0x5177ea,JSON[_0xdec9('0x12')](_0xc02d0));_0x365781(_0xc02d0);})[_0xdec9('0x18')](function(_0x473290){logger['error'](_0xdec9('0x19'),_0x473290[_0xdec9('0x16')],_0x5177ea);_0x58705f(_0x143bc9[_0xdec9('0x13')](0x1f4,_0x473290[_0xdec9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ce07265..62248c1 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 _0xefbf=['remove','emit','removeListener','smsMessage:'];(function(_0x1d1301,_0x253c3a){var _0x125db4=function(_0x268889){while(--_0x268889){_0x1d1301['push'](_0x1d1301['shift']());}};_0x125db4(++_0x253c3a);}(_0xefbf,0xe0));var _0xfefb=function(_0x3005b9,_0x5f009f){_0x3005b9=_0x3005b9-0x0;var _0xef310c=_0xefbf[_0x3005b9];return _0xef310c;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0xfefb('0x0'),'update'];function createListener(_0x564aae,_0x4af11f){return function(_0x5882da){_0x4af11f[_0xfefb('0x1')](_0x564aae,_0x5882da);};}function removeListener(_0x7b9343,_0x1f528c){return function(){SmsMessageEvents[_0xfefb('0x2')](_0x7b9343,_0x1f528c);};}exports['register']=function(_0x18ac21){for(var _0x228c59=0x0,_0x2b9a63=events['length'];_0x228c59<_0x2b9a63;_0x228c59++){var _0xbad13e=events[_0x228c59];var _0x1a3493=createListener(_0xfefb('0x3')+_0xbad13e,_0x18ac21);SmsMessageEvents['on'](_0xbad13e,_0x1a3493);}}; \ No newline at end of file +var _0x7e30=['smsMessage:','save','update','emit','removeListener','register','length'];(function(_0x3994c2,_0x3efb77){var _0x4cd709=function(_0x1b1dc5){while(--_0x1b1dc5){_0x3994c2['push'](_0x3994c2['shift']());}};_0x4cd709(++_0x3efb77);}(_0x7e30,0x1b3));var _0x07e3=function(_0x103d74,_0x2747a4){_0x103d74=_0x103d74-0x0;var _0x3798c6=_0x7e30[_0x103d74];return _0x3798c6;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x07e3('0x0'),'remove',_0x07e3('0x1')];function createListener(_0x4ab31d,_0x38bd30){return function(_0x1b7ab6){_0x38bd30[_0x07e3('0x2')](_0x4ab31d,_0x1b7ab6);};}function removeListener(_0x3015d6,_0x47e80e){return function(){SmsMessageEvents[_0x07e3('0x3')](_0x3015d6,_0x47e80e);};}exports[_0x07e3('0x4')]=function(_0x50017b){for(var _0x41ffec=0x0,_0x1f1d7c=events[_0x07e3('0x5')];_0x41ffec<_0x1f1d7c;_0x41ffec++){var _0x4ba760=events[_0x41ffec];var _0x193651=createListener(_0x07e3('0x6')+_0x4ba760,_0x50017b);SmsMessageEvents['on'](_0x4ba760,_0x193651);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 3ee5118..09960cd 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 _0x4983=['multer','path','connect-timeout','express','Router','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x44a998,_0x2e1f91){var _0x1a8c53=function(_0x1cb567){while(--_0x1cb567){_0x44a998['push'](_0x44a998['shift']());}};_0x1a8c53(++_0x2e1f91);}(_0x4983,0x1a4));var _0x3498=function(_0x16e163,_0x57fb12){_0x16e163=_0x16e163-0x0;var _0x5bf6ad=_0x4983[_0x16e163];return _0x5bf6ad;};'use strict';var multer=require(_0x3498('0x0'));var util=require('util');var path=require(_0x3498('0x1'));var timeout=require(_0x3498('0x2'));var express=require(_0x3498('0x3'));var router=express[_0x3498('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3498('0x5'));var controller=require(_0x3498('0x6'));router[_0x3498('0x7')]('/',auth[_0x3498('0x8')](),controller['index']);router[_0x3498('0x7')](_0x3498('0x9'),auth[_0x3498('0x8')](),controller[_0x3498('0xa')]);router[_0x3498('0x7')](_0x3498('0xb'),auth[_0x3498('0x8')](),controller[_0x3498('0xc')]);router['get'](_0x3498('0xd'),auth[_0x3498('0x8')](),controller['getMembers']);router['get'](_0x3498('0xe'),auth[_0x3498('0x8')](),controller[_0x3498('0xf')]);router[_0x3498('0x7')](_0x3498('0x10'),auth[_0x3498('0x8')](),controller[_0x3498('0x11')]);router[_0x3498('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3498('0xe'),auth[_0x3498('0x8')](),controller[_0x3498('0x13')]);router[_0x3498('0x12')]('/:id/users',auth[_0x3498('0x8')](),controller[_0x3498('0x14')]);router[_0x3498('0x15')](_0x3498('0xb'),auth[_0x3498('0x8')](),controller[_0x3498('0x16')]);router[_0x3498('0x17')](_0x3498('0xb'),auth[_0x3498('0x8')](),controller[_0x3498('0x18')]);router[_0x3498('0x17')](_0x3498('0xe'),auth[_0x3498('0x8')](),controller[_0x3498('0x19')]);router[_0x3498('0x17')](_0x3498('0x10'),auth[_0x3498('0x8')](),controller[_0x3498('0x1a')]);module[_0x3498('0x1b')]=router; \ No newline at end of file +var _0x5365=['../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','express','Router','fs-extra','../../components/interaction/service'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0x5365,0xa9));var _0x5536=function(_0x39b9a3,_0x51857f){_0x39b9a3=_0x39b9a3-0x0;var _0x4fccc6=_0x5365[_0x39b9a3];return _0x4fccc6;};'use strict';var multer=require(_0x5536('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5536('0x1'));var router=express[_0x5536('0x2')]();var fs_extra=require(_0x5536('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5536('0x4'));var config=require(_0x5536('0x5'));var controller=require(_0x5536('0x6'));router['get']('/',auth[_0x5536('0x7')](),controller[_0x5536('0x8')]);router[_0x5536('0x9')](_0x5536('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x5536('0xb'),auth['isAuthenticated'](),controller[_0x5536('0xc')]);router[_0x5536('0x9')](_0x5536('0xd'),auth[_0x5536('0x7')](),controller[_0x5536('0xe')]);router[_0x5536('0x9')](_0x5536('0xf'),auth['isAuthenticated'](),controller[_0x5536('0x10')]);router['get'](_0x5536('0x11'),auth[_0x5536('0x7')](),controller[_0x5536('0x12')]);router[_0x5536('0x13')]('/',auth[_0x5536('0x7')](),controller[_0x5536('0x14')]);router[_0x5536('0x13')](_0x5536('0xf'),auth[_0x5536('0x7')](),controller[_0x5536('0x15')]);router['post'](_0x5536('0x11'),auth[_0x5536('0x7')](),controller[_0x5536('0x16')]);router[_0x5536('0x17')]('/:id',auth[_0x5536('0x7')](),controller[_0x5536('0x18')]);router[_0x5536('0x19')](_0x5536('0xb'),auth[_0x5536('0x7')](),controller[_0x5536('0x1a')]);router[_0x5536('0x19')](_0x5536('0xf'),auth[_0x5536('0x7')](),controller[_0x5536('0x1b')]);router['delete'](_0x5536('0x11'),auth[_0x5536('0x7')](),controller[_0x5536('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 0c95baa..c68f6b1 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 _0x8544=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x30c294,_0x1bf878){var _0x377b38=function(_0x3a2704){while(--_0x3a2704){_0x30c294['push'](_0x30c294['shift']());}};_0x377b38(++_0x1bf878);}(_0x8544,0xa6));var _0x4854=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x8544[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require(_0x4854('0x0'));module[_0x4854('0x1')]={'name':{'type':Sequelize[_0x4854('0x2')],'unique':_0x4854('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4854('0x2')]},'timeout':{'type':Sequelize[_0x4854('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4854('0x5')](_0x4854('0x6'),'beepall',_0x4854('0x7'))}}; \ No newline at end of file +var _0xb9e5=['sequelize','exports','STRING','INTEGER','rrmemory','roundrobin'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xb9e5,0x19e));var _0x5b9e=function(_0x173b35,_0x5830a){_0x173b35=_0x173b35-0x0;var _0x5d68fb=_0xb9e5[_0x173b35];return _0x5d68fb;};'use strict';var Sequelize=require(_0x5b9e('0x0'));module[_0x5b9e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5b9e('0x2')]},'timeout':{'type':Sequelize[_0x5b9e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5b9e('0x4'),'beepall',_0x5b9e('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index f890cdc..82432f9 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 _0xe941=['sort','SmsQueueId','UserSmsQueue','findAll','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','addTeams','ids','User','online','voicePause','interface','flatMap','transaction','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','Team','Agents','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','SmsQueues','UserProfileResource','end','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','SmsQueue','catch','show','rawAttributes','length','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','params','destroy','describe','getMembers','findOne','nolimit'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0xe941,0xc4));var _0x1e94=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xe941[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e94('0x0'));var zipdir=require(_0x1e94('0x1'));var jsonpatch=require(_0x1e94('0x2'));var rp=require(_0x1e94('0x3'));var moment=require(_0x1e94('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1e94('0x5'));var util=require(_0x1e94('0x6'));var path=require(_0x1e94('0x7'));var sox=require(_0x1e94('0x8'));var csv=require(_0x1e94('0x9'));var ejs=require(_0x1e94('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e94('0xb'));var squel=require(_0x1e94('0xc'));var crypto=require('crypto');var jsforce=require(_0x1e94('0xd'));var deskjs=require(_0x1e94('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1e94('0xf'));var Papa=require('papaparse');var Redis=require(_0x1e94('0x10'));var authService=require(_0x1e94('0x11'));var qs=require(_0x1e94('0x12'));var as=require(_0x1e94('0x13'));var hardwareService=require(_0x1e94('0x14'));var logger=require(_0x1e94('0x15'))('api');var utils=require(_0x1e94('0x16'));var config=require(_0x1e94('0x17'));var licenseUtil=require(_0x1e94('0x18'));var db=require(_0x1e94('0x19'))['db'];config[_0x1e94('0x1a')]=_['defaults'](config['redis'],{'host':_0x1e94('0x1b'),'port':0x18eb});var socket=require(_0x1e94('0x1c'))(new Redis(config['redis']));require(_0x1e94('0x1d'))[_0x1e94('0x1e')](socket);function respondWithStatusCode(_0x4eeaed,_0x3b54d1){_0x3b54d1=_0x3b54d1||0xcc;return function(_0x51cf0f){if(_0x51cf0f){return _0x4eeaed[_0x1e94('0x1f')](_0x3b54d1);}return _0x4eeaed['status'](_0x3b54d1)['end']();};}function respondWithResult(_0xffe984,_0x391551){_0x391551=_0x391551||0xc8;return function(_0x12c902){if(_0x12c902){return _0xffe984[_0x1e94('0x20')](_0x391551)[_0x1e94('0x21')](_0x12c902);}};}function respondWithFilteredResult(_0x57b7e8,_0x2bb78d){return function(_0x428e34){if(_0x428e34){var _0x651cbc=typeof _0x2bb78d[_0x1e94('0x22')]===_0x1e94('0x23')&&typeof _0x2bb78d[_0x1e94('0x24')]===_0x1e94('0x23');var _0x1b64bf=_0x428e34[_0x1e94('0x25')];var _0x159361=_0x651cbc?0x0:_0x2bb78d[_0x1e94('0x22')];var _0x50c51d=_0x651cbc?_0x428e34[_0x1e94('0x25')]:_0x2bb78d[_0x1e94('0x22')]+_0x2bb78d[_0x1e94('0x24')];var _0xe5826;if(_0x50c51d>=_0x1b64bf){_0x50c51d=_0x1b64bf;_0xe5826=0xc8;}else{_0xe5826=0xce;}_0x57b7e8[_0x1e94('0x20')](_0xe5826);return _0x57b7e8[_0x1e94('0x26')]('Content-Range',_0x159361+'-'+_0x50c51d+'/'+_0x1b64bf)[_0x1e94('0x21')](_0x428e34);}return null;};}function patchUpdates(_0x9c2206){return function(_0x89261a){try{jsonpatch[_0x1e94('0x27')](_0x89261a,_0x9c2206,!![]);}catch(_0x4fd5ab){return BPromise[_0x1e94('0x28')](_0x4fd5ab);}return _0x89261a[_0x1e94('0x29')]();};}function saveUpdates(_0x1790ec,_0x548288){return function(_0x6b4c2b){if(_0x6b4c2b){return _0x6b4c2b[_0x1e94('0x2a')](_0x1790ec)[_0x1e94('0x2b')](function(_0x2cb1e6){return _0x2cb1e6;});}return null;};}function removeEntity(_0x58c364,_0x92652f){return function(_0x4d3adc){if(_0x4d3adc){return _0x4d3adc['destroy']()[_0x1e94('0x2b')](function(){var _0x3c1c7f=_0x4d3adc['get']({'plain':!![]});var _0x590960=_0x1e94('0x2c');return db[_0x1e94('0x2d')]['destroy']({'where':{'type':_0x590960,'resourceId':_0x3c1c7f['id']}})['then'](function(){return _0x4d3adc;});})[_0x1e94('0x2b')](function(){_0x58c364[_0x1e94('0x20')](0xcc)[_0x1e94('0x2e')]();});}};}function handleEntityNotFound(_0x2ca82c,_0x26d32a){return function(_0x2f9eb1){if(!_0x2f9eb1){_0x2ca82c[_0x1e94('0x1f')](0x194);}return _0x2f9eb1;};}function handleError(_0x3d035d,_0x27db74){_0x27db74=_0x27db74||0x1f4;return function(_0x3751f8){logger['error'](_0x3751f8[_0x1e94('0x2f')]);if(_0x3751f8[_0x1e94('0x30')]){delete _0x3751f8[_0x1e94('0x30')];}_0x3d035d[_0x1e94('0x20')](_0x27db74)[_0x1e94('0x31')](_0x3751f8);};}exports[_0x1e94('0x32')]=function(_0x815cc3,_0x52f1e5){var _0x57c2b1={},_0x11540d={},_0x3647db={'count':0x0,'rows':[]};var _0x33ede3=_[_0x1e94('0x33')](db['SmsQueue']['rawAttributes'],function(_0x3041c6){return{'name':_0x3041c6[_0x1e94('0x34')],'type':_0x3041c6['type'][_0x1e94('0x35')]};});_0x11540d[_0x1e94('0x36')]=_[_0x1e94('0x33')](_0x33ede3,_0x1e94('0x30'));_0x11540d[_0x1e94('0x37')]=_[_0x1e94('0x38')](_0x815cc3[_0x1e94('0x37')]);_0x11540d[_0x1e94('0x39')]=_[_0x1e94('0x3a')](_0x11540d[_0x1e94('0x36')],_0x11540d[_0x1e94('0x37')]);_0x57c2b1[_0x1e94('0x3b')]=_[_0x1e94('0x3a')](_0x11540d[_0x1e94('0x36')],qs['fields'](_0x815cc3[_0x1e94('0x37')][_0x1e94('0x3c')]));_0x57c2b1[_0x1e94('0x3b')]=_0x57c2b1[_0x1e94('0x3b')]['length']?_0x57c2b1[_0x1e94('0x3b')]:_0x11540d[_0x1e94('0x36')];if(!_0x815cc3['query'][_0x1e94('0x3d')]('nolimit')){_0x57c2b1[_0x1e94('0x24')]=qs['limit'](_0x815cc3['query'][_0x1e94('0x24')]);_0x57c2b1[_0x1e94('0x22')]=qs[_0x1e94('0x22')](_0x815cc3['query'][_0x1e94('0x22')]);}_0x57c2b1[_0x1e94('0x3e')]=qs['sort'](_0x815cc3[_0x1e94('0x37')]['sort']);_0x57c2b1[_0x1e94('0x3f')]=qs['filters'](_[_0x1e94('0x40')](_0x815cc3[_0x1e94('0x37')],_0x11540d[_0x1e94('0x39')]),_0x33ede3);if(_0x815cc3['query'][_0x1e94('0x41')]){_0x57c2b1[_0x1e94('0x3f')]=_[_0x1e94('0x42')](_0x57c2b1[_0x1e94('0x3f')],{'$or':_[_0x1e94('0x33')](_0x33ede3,function(_0x342012){if(_0x342012[_0x1e94('0x43')]!==_0x1e94('0x44')){var _0x267c7e={};_0x267c7e[_0x342012[_0x1e94('0x30')]]={'$like':'%'+_0x815cc3[_0x1e94('0x37')][_0x1e94('0x41')]+'%'};return _0x267c7e;}})});}_0x57c2b1=_[_0x1e94('0x42')]({},_0x57c2b1,_0x815cc3[_0x1e94('0x45')]);var _0x570266={'where':_0x57c2b1[_0x1e94('0x3f')]};return db['SmsQueue'][_0x1e94('0x25')](_0x570266)[_0x1e94('0x2b')](function(_0x47bc0f){_0x3647db[_0x1e94('0x25')]=_0x47bc0f;if(_0x815cc3[_0x1e94('0x37')][_0x1e94('0x46')]){_0x57c2b1[_0x1e94('0x47')]=[{'all':!![]}];}return db[_0x1e94('0x48')]['findAll'](_0x57c2b1);})[_0x1e94('0x2b')](function(_0xfc26df){_0x3647db['rows']=_0xfc26df;return _0x3647db;})[_0x1e94('0x2b')](respondWithFilteredResult(_0x52f1e5,_0x57c2b1))[_0x1e94('0x49')](handleError(_0x52f1e5,null));};exports[_0x1e94('0x4a')]=function(_0x5471fc,_0x1b8616){var _0x45fed2={'raw':!![],'where':{'id':_0x5471fc['params']['id']}},_0xe6c974={};_0xe6c974['model']=_['keys'](db[_0x1e94('0x48')][_0x1e94('0x4b')]);_0xe6c974[_0x1e94('0x37')]=_[_0x1e94('0x38')](_0x5471fc['query']);_0xe6c974['filters']=_[_0x1e94('0x3a')](_0xe6c974[_0x1e94('0x36')],_0xe6c974[_0x1e94('0x37')]);_0x45fed2[_0x1e94('0x3b')]=_[_0x1e94('0x3a')](_0xe6c974[_0x1e94('0x36')],qs[_0x1e94('0x3c')](_0x5471fc['query'][_0x1e94('0x3c')]));_0x45fed2[_0x1e94('0x3b')]=_0x45fed2[_0x1e94('0x3b')][_0x1e94('0x4c')]?_0x45fed2[_0x1e94('0x3b')]:_0xe6c974[_0x1e94('0x36')];if(_0x5471fc[_0x1e94('0x37')]['includeAll']){_0x45fed2[_0x1e94('0x47')]=[{'all':!![]}];}_0x45fed2=_[_0x1e94('0x42')]({},_0x45fed2,_0x5471fc[_0x1e94('0x45')]);return db['SmsQueue'][_0x1e94('0x4d')](_0x45fed2)[_0x1e94('0x2b')](handleEntityNotFound(_0x1b8616,null))['then'](respondWithResult(_0x1b8616,null))['catch'](handleError(_0x1b8616,null));};exports[_0x1e94('0x4e')]=function(_0x34eb02,_0x3cdcc5){return db['SmsQueue'][_0x1e94('0x4e')](_0x34eb02[_0x1e94('0x4f')],{})[_0x1e94('0x2b')](function(_0x564961){var _0x77f93e=_0x34eb02[_0x1e94('0x50')]['get']({'plain':!![]});if(!_0x77f93e)throw new Error(_0x1e94('0x51'));if(_0x77f93e[_0x1e94('0x52')]===_0x1e94('0x50')){var _0x10a90e=_0x564961[_0x1e94('0x53')]({'plain':!![]});var _0xb9c91=_0x1e94('0x2c');return db[_0x1e94('0x54')][_0x1e94('0x4d')]({'where':{'name':_0xb9c91,'userProfileId':_0x77f93e[_0x1e94('0x55')]},'raw':!![]})[_0x1e94('0x2b')](function(_0x4bb06c){if(_0x4bb06c&&_0x4bb06c[_0x1e94('0x56')]===0x0){return db['UserProfileResource'][_0x1e94('0x4e')]({'name':_0x10a90e['name'],'resourceId':_0x10a90e['id'],'type':_0x4bb06c[_0x1e94('0x30')],'sectionId':_0x4bb06c['id']},{})[_0x1e94('0x2b')](function(){return _0x564961;});}else{return _0x564961;}})[_0x1e94('0x49')](function(_0x154019){logger['error'](_0x1e94('0x57'),_0x154019);throw _0x154019;});}return _0x564961;})[_0x1e94('0x2b')](respondWithResult(_0x3cdcc5,0xc9))[_0x1e94('0x49')](handleError(_0x3cdcc5,null));};exports[_0x1e94('0x2a')]=function(_0x499dc4,_0x3aea17){if(_0x499dc4[_0x1e94('0x4f')]['id']){delete _0x499dc4[_0x1e94('0x4f')]['id'];}return db[_0x1e94('0x48')][_0x1e94('0x4d')]({'where':{'id':_0x499dc4[_0x1e94('0x58')]['id']}})['then'](handleEntityNotFound(_0x3aea17,null))[_0x1e94('0x2b')](saveUpdates(_0x499dc4[_0x1e94('0x4f')],null))[_0x1e94('0x2b')](respondWithResult(_0x3aea17,null))[_0x1e94('0x49')](handleError(_0x3aea17,null));};exports[_0x1e94('0x59')]=function(_0x488ef5,_0x5150bf){return db[_0x1e94('0x48')][_0x1e94('0x4d')]({'where':{'id':_0x488ef5[_0x1e94('0x58')]['id']}})['then'](handleEntityNotFound(_0x5150bf,null))['then'](removeEntity(_0x5150bf,null))[_0x1e94('0x49')](handleError(_0x5150bf,null));};exports[_0x1e94('0x5a')]=function(_0x5e8dfc,_0x4208b1){return db[_0x1e94('0x48')]['describe']()[_0x1e94('0x2b')](respondWithResult(_0x4208b1,null))['catch'](handleError(_0x4208b1,null));};exports[_0x1e94('0x5b')]=function(_0x23f242,_0x20b845,_0x4381b4){var _0x5ad3df={'raw':!![],'where':{}},_0x478ade={},_0x488771;return db[_0x1e94('0x48')][_0x1e94('0x5c')]({'where':{'id':_0x23f242[_0x1e94('0x58')]['id']}})['then'](handleEntityNotFound(_0x20b845,null))[_0x1e94('0x2b')](function(_0x41e946){if(_0x41e946){_0x488771=_0x41e946[_0x1e94('0x53')]({'plain':!![]});_0x478ade[_0x1e94('0x36')]=_['keys'](db['UserSmsQueue']['rawAttributes']);_0x478ade['query']=_[_0x1e94('0x38')](_0x23f242[_0x1e94('0x37')]);_0x478ade[_0x1e94('0x39')]=_[_0x1e94('0x3a')](_0x478ade[_0x1e94('0x36')],_0x478ade[_0x1e94('0x37')]);_0x5ad3df[_0x1e94('0x3b')]=_['intersection'](_0x478ade['model'],qs[_0x1e94('0x3c')](_0x23f242[_0x1e94('0x37')]['fields']));_0x5ad3df[_0x1e94('0x3b')]=_0x5ad3df['attributes'][_0x1e94('0x4c')]?_0x5ad3df['attributes']:_0x478ade[_0x1e94('0x36')];if(!_0x23f242[_0x1e94('0x37')]['hasOwnProperty'](_0x1e94('0x5d'))){_0x5ad3df[_0x1e94('0x24')]=qs[_0x1e94('0x24')](_0x23f242[_0x1e94('0x37')][_0x1e94('0x24')]);_0x5ad3df['offset']=qs[_0x1e94('0x22')](_0x23f242[_0x1e94('0x37')]['offset']);}_0x5ad3df['order']=qs[_0x1e94('0x5e')](_0x23f242[_0x1e94('0x37')][_0x1e94('0x5e')]);_0x5ad3df[_0x1e94('0x3f')]=qs[_0x1e94('0x39')](_[_0x1e94('0x40')](_0x23f242['query'],_0x478ade[_0x1e94('0x39')]));_0x5ad3df[_0x1e94('0x3f')][_0x1e94('0x5f')]=_0x41e946['id'];if(_0x23f242['query'][_0x1e94('0x41')]){_0x5ad3df[_0x1e94('0x3f')]=_[_0x1e94('0x42')](_0x5ad3df[_0x1e94('0x3f')],{'$or':_['map'](_0x5ad3df['attributes'],function(_0x364afd){var _0x425c16={};_0x425c16[_0x364afd]={'$like':'%'+_0x23f242[_0x1e94('0x37')][_0x1e94('0x41')]+'%'};return _0x425c16;})});}_0x5ad3df=_[_0x1e94('0x42')]({},_0x5ad3df,_0x23f242[_0x1e94('0x45')]);return db[_0x1e94('0x60')][_0x1e94('0x61')](_0x5ad3df);}})[_0x1e94('0x2b')](function(_0x159555){if(_0x159555){return db['User'][_0x1e94('0x62')]({'where':{'id':_[_0x1e94('0x33')](_0x159555,_0x1e94('0x63')),'role':_0x1e94('0x64')},'attributes':['id',_0x1e94('0x30'),_0x1e94('0x65'),_0x1e94('0x66'),_0x1e94('0x67')]});}})[_0x1e94('0x2b')](function(_0x31d8e6){if(_0x31d8e6){return{'count':_0x31d8e6[_0x1e94('0x25')],'rows':_[_0x1e94('0x33')](_0x31d8e6['rows'],function(_0x507583){return{'membername':_0x507583[_0x1e94('0x30')],'UserId':_0x507583['id'],'queue_name':_0x488771[_0x1e94('0x30')],'SmsQueueId':_0x488771['id'],'interface':util[_0x1e94('0x68')]('%s/%s',_0x1e94('0x69'),_0x507583['name']),'penalty':0x0,'paused':_0x507583[_0x1e94('0x65')],'createdAt':_0x507583[_0x1e94('0x67')],'updatedAt':_0x507583[_0x1e94('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1e94('0x2b')](respondWithFilteredResult(_0x20b845,_0x5ad3df))[_0x1e94('0x49')](handleError(_0x20b845,null));};exports[_0x1e94('0x6a')]=function(_0x1cbdab,_0x79df52,_0x21881b){var _0x54ae5e={};var _0x1d7201={};var _0x479baf;var _0x3680ec;return db[_0x1e94('0x48')]['findOne']({'where':{'id':_0x1cbdab[_0x1e94('0x58')]['id']}})['then'](handleEntityNotFound(_0x79df52,null))[_0x1e94('0x2b')](function(_0x26ef26){if(_0x26ef26){_0x479baf=_0x26ef26;_0x1d7201[_0x1e94('0x36')]=_[_0x1e94('0x38')](db['Team'][_0x1e94('0x4b')]);_0x1d7201[_0x1e94('0x37')]=_[_0x1e94('0x38')](_0x1cbdab[_0x1e94('0x37')]);_0x1d7201['filters']=_[_0x1e94('0x3a')](_0x1d7201[_0x1e94('0x36')],_0x1d7201[_0x1e94('0x37')]);_0x54ae5e[_0x1e94('0x3b')]=_[_0x1e94('0x3a')](_0x1d7201['model'],qs[_0x1e94('0x3c')](_0x1cbdab[_0x1e94('0x37')][_0x1e94('0x3c')]));_0x54ae5e[_0x1e94('0x3b')]=_0x54ae5e[_0x1e94('0x3b')][_0x1e94('0x4c')]?_0x54ae5e[_0x1e94('0x3b')]:_0x1d7201[_0x1e94('0x36')];_0x54ae5e[_0x1e94('0x3e')]=qs[_0x1e94('0x5e')](_0x1cbdab['query']['sort']);_0x54ae5e[_0x1e94('0x3f')]=qs[_0x1e94('0x39')](_[_0x1e94('0x40')](_0x1cbdab[_0x1e94('0x37')],_0x1d7201[_0x1e94('0x39')]));if(_0x1cbdab['query']['filter']){_0x54ae5e[_0x1e94('0x3f')]=_[_0x1e94('0x42')](_0x54ae5e[_0x1e94('0x3f')],{'$or':_[_0x1e94('0x33')](_0x54ae5e[_0x1e94('0x3b')],function(_0x161bdb){var _0x1a7473={};_0x1a7473[_0x161bdb]={'$like':'%'+_0x1cbdab[_0x1e94('0x37')][_0x1e94('0x41')]+'%'};return _0x1a7473;})});}_0x54ae5e=_['merge']({},_0x54ae5e,_0x1cbdab[_0x1e94('0x45')]);return _0x479baf[_0x1e94('0x6a')](_0x54ae5e);}})[_0x1e94('0x2b')](function(_0x5717e8){if(_0x5717e8){_0x3680ec=_0x5717e8[_0x1e94('0x4c')];if(!_0x1cbdab[_0x1e94('0x37')][_0x1e94('0x3d')](_0x1e94('0x5d'))){_0x54ae5e[_0x1e94('0x24')]=qs[_0x1e94('0x24')](_0x1cbdab[_0x1e94('0x37')][_0x1e94('0x24')]);_0x54ae5e[_0x1e94('0x22')]=qs['offset'](_0x1cbdab[_0x1e94('0x37')]['offset']);}return _0x479baf[_0x1e94('0x6a')](_0x54ae5e);}})[_0x1e94('0x2b')](function(_0x36134f){if(_0x36134f){return _0x36134f?{'count':_0x3680ec,'rows':_0x36134f}:null;}})[_0x1e94('0x2b')](respondWithResult(_0x79df52,null))['catch'](handleError(_0x79df52,null));};exports[_0x1e94('0x6b')]=function(_0xb66773,_0xcf3925,_0x7bd105){var _0x3ab88d=_0xb66773[_0x1e94('0x4f')][_0x1e94('0x6c')];return db['Team']['findAll']({'where':{'id':_0x3ab88d},'attributes':['id'],'include':[{'model':db[_0x1e94('0x6d')],'as':'Agents','attributes':['id',_0x1e94('0x30'),_0x1e94('0x6e'),_0x1e94('0x6f'),_0x1e94('0x70')],'raw':!![]}]})['then'](function(_0x3cc1b3){if(_0x3cc1b3){var _0x481a55=_[_0x1e94('0x71')](_0x3cc1b3,function(_0x44cf50){var _0x419c9a=_0x44cf50[_0x1e94('0x53')]({'plain':!![]});return _0x419c9a['Agents'];});return db[_0x1e94('0x48')]['find']({'where':{'id':_0xb66773[_0x1e94('0x58')]['id']}})[_0x1e94('0x2b')](function(_0x48d562){return db['sequelize'][_0x1e94('0x72')](function(_0x58c31c){return _0x48d562[_0x1e94('0x6b')](_0x3ab88d,{'transaction':_0x58c31c})['then'](function(){return BPromise['each'](_0x481a55,function(_0x28118c){return db[_0x1e94('0x60')][_0x1e94('0x73')]({'where':{'UserId':_0x28118c['id'],'SmsQueueId':_0xb66773[_0x1e94('0x58')]['id']},'transaction':_0x58c31c});});})[_0x1e94('0x2b')](function(){_0x481a55[_0x1e94('0x74')](function(_0x490327){socket[_0x1e94('0x75')](_0x1e94('0x76'),{'UserId':_0x490327['id'],'SmsQueueId':_0x48d562['id']});});});});});}})['then'](respondWithStatusCode(_0xcf3925,null))[_0x1e94('0x49')](handleError(_0xcf3925,null));};exports[_0x1e94('0x77')]=function(_0x42e3e4,_0x31cd94,_0x876d3a){return db[_0x1e94('0x78')][_0x1e94('0x61')]({'where':{'id':_0x42e3e4[_0x1e94('0x37')][_0x1e94('0x6c')]},'attributes':['id'],'include':[{'model':db[_0x1e94('0x6d')],'as':_0x1e94('0x79'),'attributes':['id'],'raw':!![]}]})[_0x1e94('0x2b')](handleEntityNotFound(_0x31cd94,null))[_0x1e94('0x2b')](function(_0x4ea0b2){var _0x234bd4=_['map'](_0x4ea0b2,'id');var _0x2a022c=[];var _0x23b852=[];var _0x35c2ed=squel['select']();_0x35c2ed['field'](_0x1e94('0x7a'))['from'](_0x1e94('0x7b'),'tq')[_0x1e94('0x7c')](_0x1e94('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x42e3e4[_0x1e94('0x58')]['id']);for(var _0x111171=0x0;_0x111171<_0x4ea0b2[_0x1e94('0x4c')];_0x111171+=0x1){let _0x262a25=_0x4ea0b2[_0x111171];for(var _0x1dcda2=0x0;_0x1dcda2<_0x262a25[_0x1e94('0x79')][_0x1e94('0x4c')];_0x1dcda2+=0x1){let _0x395a8d=_0x262a25[_0x1e94('0x79')][_0x1dcda2];var _0x37c8cf=_0x35c2ed['clone']();_0x37c8cf[_0x1e94('0x3f')](_0x1e94('0x7e'),_0x395a8d['id']);_0x23b852['push'](db[_0x1e94('0x7f')][_0x1e94('0x37')](_0x37c8cf[_0x1e94('0x80')](),{'type':db['sequelize'][_0x1e94('0x81')][_0x1e94('0x82')]})[_0x1e94('0x2b')](function(_0x552746){if(_0x552746[_0x1e94('0x4c')]===0x1){return _0x395a8d['id'];}else{var _0x20bd3e=_[_0x1e94('0x83')](_[_0x1e94('0x33')](_0x552746,_0x1e94('0x84')),function(_0x34860e){return _[_0x1e94('0x85')](_0x234bd4,_0x34860e);});if(_0x20bd3e){return _0x395a8d['id'];}}}));}}return BPromise['all'](_0x23b852)[_0x1e94('0x2b')](function(_0x5cbdc1){_0x2a022c=_(_0x2a022c)[_0x1e94('0x86')](_0x5cbdc1)[_0x1e94('0x87')]()[_0x1e94('0x88')]();return db[_0x1e94('0x48')][_0x1e94('0x4d')]({'where':{'id':_0x42e3e4['params']['id']}})['then'](function(_0x56be1c){return db['sequelize']['transaction'](function(_0x5c4ff5){return _0x56be1c[_0x1e94('0x77')](_0x42e3e4[_0x1e94('0x37')][_0x1e94('0x6c')],{'transaction':_0x5c4ff5})[_0x1e94('0x2b')](function(){if(!_[_0x1e94('0x89')](_0x2a022c)){return _0x56be1c[_0x1e94('0x8a')](_0x2a022c,{'transaction':_0x5c4ff5});}})[_0x1e94('0x2b')](function(){_0x2a022c['forEach'](function(_0x482a55){socket['emit'](_0x1e94('0x8b'),{'UserId':_0x482a55,'SmsQueueId':_0x56be1c['id']});});});});});});})[_0x1e94('0x2b')](respondWithStatusCode(_0x31cd94,null))[_0x1e94('0x49')](handleError(_0x31cd94,null));};exports[_0x1e94('0x8c')]=function(_0x262642,_0x1697e8,_0xe39db9){return db[_0x1e94('0x48')][_0x1e94('0x4d')]({'where':{'id':_0x262642['params']['id']}})[_0x1e94('0x2b')](handleEntityNotFound(_0x1697e8,null))[_0x1e94('0x2b')](function(_0x4306e0){if(_0x4306e0){return _0x4306e0[_0x1e94('0x8c')](_0x262642[_0x1e94('0x4f')][_0x1e94('0x6c')],_[_0x1e94('0x8d')](_0x262642[_0x1e94('0x4f')],['ids','id'])||{})[_0x1e94('0x8e')](function(_0x1a7a9e){for(var _0x301115=0x0;_0x301115<_0x262642['body'][_0x1e94('0x6c')]['length'];_0x301115+=0x1){socket['emit'](_0x1e94('0x76'),{'UserId':Number(_0x262642[_0x1e94('0x4f')]['ids'][_0x301115]),'SmsQueueId':Number(_0x262642[_0x1e94('0x58')]['id'])});}return _0x1a7a9e;});}})[_0x1e94('0x2b')](respondWithResult(_0x1697e8,null))[_0x1e94('0x49')](handleError(_0x1697e8,null));};exports[_0x1e94('0x8a')]=function(_0x165547,_0x346638,_0x146ab1){return db[_0x1e94('0x48')]['find']({'where':{'id':_0x165547[_0x1e94('0x58')]['id']}})[_0x1e94('0x2b')](handleEntityNotFound(_0x346638,null))[_0x1e94('0x2b')](function(_0x12b2f7){if(_0x12b2f7){return _0x12b2f7['removeAgents'](_0x165547[_0x1e94('0x37')][_0x1e94('0x6c')])[_0x1e94('0x2b')](function(){if(_[_0x1e94('0x8f')](_0x165547[_0x1e94('0x37')][_0x1e94('0x6c')])){for(var _0x439554=0x0;_0x439554<_0x165547[_0x1e94('0x37')][_0x1e94('0x6c')]['length'];_0x439554+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x165547[_0x1e94('0x37')]['ids'][_0x439554]),'SmsQueueId':Number(_0x165547[_0x1e94('0x58')]['id'])});}}else{socket[_0x1e94('0x75')](_0x1e94('0x8b'),{'UserId':Number(_0x165547[_0x1e94('0x37')][_0x1e94('0x6c')]),'SmsQueueId':Number(_0x165547['params']['id'])});}});}})[_0x1e94('0x2b')](respondWithStatusCode(_0x346638,null))[_0x1e94('0x49')](handleError(_0x346638,null));};exports[_0x1e94('0x90')]=function(_0x31c98b,_0x16915d,_0x24aed0){var _0xd04790={};var _0x568cdd={};var _0x26cd97;var _0x3f2dc6;return db[_0x1e94('0x48')][_0x1e94('0x5c')]({'where':{'id':_0x31c98b[_0x1e94('0x58')]['id']}})['then'](handleEntityNotFound(_0x16915d,null))['then'](function(_0x2a9a06){if(_0x2a9a06){_0x26cd97=_0x2a9a06;_0x568cdd[_0x1e94('0x36')]=_[_0x1e94('0x38')](db[_0x1e94('0x6d')][_0x1e94('0x4b')]);_0x568cdd[_0x1e94('0x37')]=_[_0x1e94('0x38')](_0x31c98b[_0x1e94('0x37')]);_0x568cdd[_0x1e94('0x39')]=_[_0x1e94('0x3a')](_0x568cdd['model'],_0x568cdd[_0x1e94('0x37')]);_0xd04790[_0x1e94('0x3b')]=_[_0x1e94('0x3a')](_0x568cdd[_0x1e94('0x36')],qs[_0x1e94('0x3c')](_0x31c98b[_0x1e94('0x37')][_0x1e94('0x3c')]));_0xd04790[_0x1e94('0x3b')]=_0xd04790[_0x1e94('0x3b')][_0x1e94('0x4c')]?_0xd04790['attributes']:_0x568cdd[_0x1e94('0x36')];_0xd04790[_0x1e94('0x3e')]=qs[_0x1e94('0x5e')](_0x31c98b[_0x1e94('0x37')][_0x1e94('0x5e')]);_0xd04790[_0x1e94('0x3f')]=qs[_0x1e94('0x39')](_['pick'](_0x31c98b['query'],_0x568cdd[_0x1e94('0x39')]));if(_0x31c98b[_0x1e94('0x37')]['filter']){_0xd04790['where']=_[_0x1e94('0x42')](_0xd04790[_0x1e94('0x3f')],{'$or':_[_0x1e94('0x33')](_0xd04790['attributes'],function(_0xd06412){var _0x4d4687={};_0x4d4687[_0xd06412]={'$like':'%'+_0x31c98b[_0x1e94('0x37')][_0x1e94('0x41')]+'%'};return _0x4d4687;})});}_0xd04790=_[_0x1e94('0x42')]({},_0xd04790,_0x31c98b[_0x1e94('0x45')]);return _0x26cd97[_0x1e94('0x90')](_0xd04790);}})[_0x1e94('0x2b')](function(_0x406f81){if(_0x406f81){_0x3f2dc6=_0x406f81[_0x1e94('0x4c')];if(!_0x31c98b[_0x1e94('0x37')]['hasOwnProperty']('nolimit')){_0xd04790[_0x1e94('0x24')]=qs[_0x1e94('0x24')](_0x31c98b['query'][_0x1e94('0x24')]);_0xd04790[_0x1e94('0x22')]=qs[_0x1e94('0x22')](_0x31c98b['query'][_0x1e94('0x22')]);}return _0x26cd97[_0x1e94('0x90')](_0xd04790);}})[_0x1e94('0x2b')](function(_0x5833cd){if(_0x5833cd){return _0x5833cd?{'count':_0x3f2dc6,'rows':_0x5833cd}:null;}})[_0x1e94('0x2b')](respondWithResult(_0x16915d,null))[_0x1e94('0x49')](handleError(_0x16915d,null));}; \ No newline at end of file +var _0x4e52=['union','value','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','./smsQueue.socket','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','then','get','SmsQueues','end','error','stack','name','send','index','map','SmsQueue','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserSmsQueue','SmsQueueId','User','UserId','agent','smsPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','pick','addTeams','ids','Agents','online','voicePause','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','TeamId','includes','all'];(function(_0x4090f9,_0x4f9df8){var _0x392998=function(_0xef8a4b){while(--_0xef8a4b){_0x4090f9['push'](_0x4090f9['shift']());}};_0x392998(++_0x4f9df8);}(_0x4e52,0x1b8));var _0x24e5=function(_0x467380,_0x55a883){_0x467380=_0x467380-0x0;var _0x281343=_0x4e52[_0x467380];return _0x281343;};'use strict';var emlformat=require(_0x24e5('0x0'));var rimraf=require(_0x24e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x24e5('0x2'));var rp=require(_0x24e5('0x3'));var moment=require(_0x24e5('0x4'));var BPromise=require(_0x24e5('0x5'));var Mustache=require(_0x24e5('0x6'));var util=require(_0x24e5('0x7'));var path=require('path');var sox=require(_0x24e5('0x8'));var csv=require(_0x24e5('0x9'));var ejs=require(_0x24e5('0xa'));var fs=require('fs');var fs_extra=require(_0x24e5('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x24e5('0xc'));var jsforce=require(_0x24e5('0xd'));var deskjs=require(_0x24e5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x24e5('0xf'));var Papa=require(_0x24e5('0x10'));var Redis=require(_0x24e5('0x11'));var authService=require(_0x24e5('0x12'));var qs=require(_0x24e5('0x13'));var as=require(_0x24e5('0x14'));var hardwareService=require(_0x24e5('0x15'));var logger=require('../../config/logger')(_0x24e5('0x16'));var utils=require(_0x24e5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x24e5('0x18'));var db=require(_0x24e5('0x19'))['db'];config['redis']=_[_0x24e5('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x24e5('0x1b'))(new Redis(config['redis']));require(_0x24e5('0x1c'))['register'](socket);function respondWithStatusCode(_0x443f1f,_0xf9477a){_0xf9477a=_0xf9477a||0xcc;return function(_0x2c9e09){if(_0x2c9e09){return _0x443f1f[_0x24e5('0x1d')](_0xf9477a);}return _0x443f1f['status'](_0xf9477a)['end']();};}function respondWithResult(_0x1ce30d,_0x23714c){_0x23714c=_0x23714c||0xc8;return function(_0x204be3){if(_0x204be3){return _0x1ce30d[_0x24e5('0x1e')](_0x23714c)[_0x24e5('0x1f')](_0x204be3);}};}function respondWithFilteredResult(_0x2bc0ef,_0x18dcc5){return function(_0x5a8d99){if(_0x5a8d99){var _0x26e06b=typeof _0x18dcc5['offset']===_0x24e5('0x20')&&typeof _0x18dcc5[_0x24e5('0x21')]===_0x24e5('0x20');var _0xf0ba72=_0x5a8d99[_0x24e5('0x22')];var _0x81056a=_0x26e06b?0x0:_0x18dcc5[_0x24e5('0x23')];var _0x1f2b9a=_0x26e06b?_0x5a8d99[_0x24e5('0x22')]:_0x18dcc5['offset']+_0x18dcc5['limit'];var _0x53d935;if(_0x1f2b9a>=_0xf0ba72){_0x1f2b9a=_0xf0ba72;_0x53d935=0xc8;}else{_0x53d935=0xce;}_0x2bc0ef[_0x24e5('0x1e')](_0x53d935);return _0x2bc0ef[_0x24e5('0x24')](_0x24e5('0x25'),_0x81056a+'-'+_0x1f2b9a+'/'+_0xf0ba72)[_0x24e5('0x1f')](_0x5a8d99);}return null;};}function patchUpdates(_0x233031){return function(_0x4c979a){try{jsonpatch['apply'](_0x4c979a,_0x233031,!![]);}catch(_0x1fd407){return BPromise['reject'](_0x1fd407);}return _0x4c979a[_0x24e5('0x26')]();};}function saveUpdates(_0x3d8f1d,_0x598634){return function(_0x13b4a3){if(_0x13b4a3){return _0x13b4a3[_0x24e5('0x27')](_0x3d8f1d)['then'](function(_0x3f5faa){return _0x3f5faa;});}return null;};}function removeEntity(_0x54601f,_0x2fe45f){return function(_0xb81a68){if(_0xb81a68){return _0xb81a68[_0x24e5('0x28')]()[_0x24e5('0x29')](function(){var _0x2b5ef9=_0xb81a68[_0x24e5('0x2a')]({'plain':!![]});var _0x4696ee=_0x24e5('0x2b');return db['UserProfileResource']['destroy']({'where':{'type':_0x4696ee,'resourceId':_0x2b5ef9['id']}})['then'](function(){return _0xb81a68;});})[_0x24e5('0x29')](function(){_0x54601f[_0x24e5('0x1e')](0xcc)[_0x24e5('0x2c')]();});}};}function handleEntityNotFound(_0x64ac6d,_0x3bd812){return function(_0x4b640e){if(!_0x4b640e){_0x64ac6d[_0x24e5('0x1d')](0x194);}return _0x4b640e;};}function handleError(_0x459644,_0x3f4e00){_0x3f4e00=_0x3f4e00||0x1f4;return function(_0x24311d){logger[_0x24e5('0x2d')](_0x24311d[_0x24e5('0x2e')]);if(_0x24311d[_0x24e5('0x2f')]){delete _0x24311d[_0x24e5('0x2f')];}_0x459644[_0x24e5('0x1e')](_0x3f4e00)[_0x24e5('0x30')](_0x24311d);};}exports[_0x24e5('0x31')]=function(_0x4d8e4a,_0x2aa7dd){var _0x5a8208={},_0x1d2c6e={},_0x50c72e={'count':0x0,'rows':[]};var _0x24161f=_[_0x24e5('0x32')](db[_0x24e5('0x33')]['rawAttributes'],function(_0x48b714){return{'name':_0x48b714[_0x24e5('0x34')],'type':_0x48b714[_0x24e5('0x35')][_0x24e5('0x36')]};});_0x1d2c6e[_0x24e5('0x37')]=_[_0x24e5('0x32')](_0x24161f,_0x24e5('0x2f'));_0x1d2c6e[_0x24e5('0x38')]=_[_0x24e5('0x39')](_0x4d8e4a[_0x24e5('0x38')]);_0x1d2c6e[_0x24e5('0x3a')]=_[_0x24e5('0x3b')](_0x1d2c6e[_0x24e5('0x37')],_0x1d2c6e[_0x24e5('0x38')]);_0x5a8208[_0x24e5('0x3c')]=_[_0x24e5('0x3b')](_0x1d2c6e[_0x24e5('0x37')],qs[_0x24e5('0x3d')](_0x4d8e4a[_0x24e5('0x38')][_0x24e5('0x3d')]));_0x5a8208['attributes']=_0x5a8208[_0x24e5('0x3c')][_0x24e5('0x3e')]?_0x5a8208[_0x24e5('0x3c')]:_0x1d2c6e[_0x24e5('0x37')];if(!_0x4d8e4a[_0x24e5('0x38')][_0x24e5('0x3f')](_0x24e5('0x40'))){_0x5a8208[_0x24e5('0x21')]=qs['limit'](_0x4d8e4a['query'][_0x24e5('0x21')]);_0x5a8208[_0x24e5('0x23')]=qs[_0x24e5('0x23')](_0x4d8e4a['query'][_0x24e5('0x23')]);}_0x5a8208[_0x24e5('0x41')]=qs[_0x24e5('0x42')](_0x4d8e4a[_0x24e5('0x38')][_0x24e5('0x42')]);_0x5a8208[_0x24e5('0x43')]=qs[_0x24e5('0x3a')](_['pick'](_0x4d8e4a[_0x24e5('0x38')],_0x1d2c6e[_0x24e5('0x3a')]),_0x24161f);if(_0x4d8e4a[_0x24e5('0x38')][_0x24e5('0x44')]){_0x5a8208['where']=_[_0x24e5('0x45')](_0x5a8208[_0x24e5('0x43')],{'$or':_[_0x24e5('0x32')](_0x24161f,function(_0x457f19){if(_0x457f19[_0x24e5('0x35')]!==_0x24e5('0x46')){var _0x15f925={};_0x15f925[_0x457f19['name']]={'$like':'%'+_0x4d8e4a[_0x24e5('0x38')][_0x24e5('0x44')]+'%'};return _0x15f925;}})});}_0x5a8208=_['merge']({},_0x5a8208,_0x4d8e4a[_0x24e5('0x47')]);var _0x4aea07={'where':_0x5a8208[_0x24e5('0x43')]};return db[_0x24e5('0x33')][_0x24e5('0x22')](_0x4aea07)['then'](function(_0x4af6d0){_0x50c72e[_0x24e5('0x22')]=_0x4af6d0;if(_0x4d8e4a[_0x24e5('0x38')][_0x24e5('0x48')]){_0x5a8208[_0x24e5('0x49')]=[{'all':!![]}];}return db[_0x24e5('0x33')][_0x24e5('0x4a')](_0x5a8208);})[_0x24e5('0x29')](function(_0x4ee256){_0x50c72e['rows']=_0x4ee256;return _0x50c72e;})['then'](respondWithFilteredResult(_0x2aa7dd,_0x5a8208))[_0x24e5('0x4b')](handleError(_0x2aa7dd,null));};exports[_0x24e5('0x4c')]=function(_0x53e783,_0x3e69b9){var _0x8e26b1={'raw':!![],'where':{'id':_0x53e783[_0x24e5('0x4d')]['id']}},_0xdc89e9={};_0xdc89e9['model']=_[_0x24e5('0x39')](db['SmsQueue'][_0x24e5('0x4e')]);_0xdc89e9[_0x24e5('0x38')]=_[_0x24e5('0x39')](_0x53e783[_0x24e5('0x38')]);_0xdc89e9['filters']=_['intersection'](_0xdc89e9[_0x24e5('0x37')],_0xdc89e9[_0x24e5('0x38')]);_0x8e26b1[_0x24e5('0x3c')]=_[_0x24e5('0x3b')](_0xdc89e9['model'],qs[_0x24e5('0x3d')](_0x53e783['query']['fields']));_0x8e26b1[_0x24e5('0x3c')]=_0x8e26b1[_0x24e5('0x3c')][_0x24e5('0x3e')]?_0x8e26b1[_0x24e5('0x3c')]:_0xdc89e9[_0x24e5('0x37')];if(_0x53e783['query'][_0x24e5('0x48')]){_0x8e26b1['include']=[{'all':!![]}];}_0x8e26b1=_['merge']({},_0x8e26b1,_0x53e783[_0x24e5('0x47')]);return db[_0x24e5('0x33')]['find'](_0x8e26b1)['then'](handleEntityNotFound(_0x3e69b9,null))[_0x24e5('0x29')](respondWithResult(_0x3e69b9,null))['catch'](handleError(_0x3e69b9,null));};exports[_0x24e5('0x4f')]=function(_0x258447,_0x3912f3){return db[_0x24e5('0x33')][_0x24e5('0x4f')](_0x258447[_0x24e5('0x50')],{})[_0x24e5('0x29')](function(_0x54f54a){var _0x2879c9=_0x258447[_0x24e5('0x51')][_0x24e5('0x2a')]({'plain':!![]});if(!_0x2879c9)throw new Error(_0x24e5('0x52'));if(_0x2879c9[_0x24e5('0x53')]===_0x24e5('0x51')){var _0x127a4d=_0x54f54a['get']({'plain':!![]});var _0x13abaa=_0x24e5('0x2b');return db[_0x24e5('0x54')][_0x24e5('0x55')]({'where':{'name':_0x13abaa,'userProfileId':_0x2879c9[_0x24e5('0x56')]},'raw':!![]})['then'](function(_0x3dfeef){if(_0x3dfeef&&_0x3dfeef[_0x24e5('0x57')]===0x0){return db[_0x24e5('0x58')][_0x24e5('0x4f')]({'name':_0x127a4d[_0x24e5('0x2f')],'resourceId':_0x127a4d['id'],'type':_0x3dfeef[_0x24e5('0x2f')],'sectionId':_0x3dfeef['id']},{})[_0x24e5('0x29')](function(){return _0x54f54a;});}else{return _0x54f54a;}})[_0x24e5('0x4b')](function(_0x50db13){logger[_0x24e5('0x2d')](_0x24e5('0x59'),_0x50db13);throw _0x50db13;});}return _0x54f54a;})[_0x24e5('0x29')](respondWithResult(_0x3912f3,0xc9))['catch'](handleError(_0x3912f3,null));};exports[_0x24e5('0x27')]=function(_0x4618d2,_0x9d0c86){if(_0x4618d2[_0x24e5('0x50')]['id']){delete _0x4618d2[_0x24e5('0x50')]['id'];}return db['SmsQueue'][_0x24e5('0x55')]({'where':{'id':_0x4618d2[_0x24e5('0x4d')]['id']}})[_0x24e5('0x29')](handleEntityNotFound(_0x9d0c86,null))[_0x24e5('0x29')](saveUpdates(_0x4618d2[_0x24e5('0x50')],null))['then'](respondWithResult(_0x9d0c86,null))['catch'](handleError(_0x9d0c86,null));};exports[_0x24e5('0x28')]=function(_0x19b4e9,_0x3205c6){return db['SmsQueue'][_0x24e5('0x55')]({'where':{'id':_0x19b4e9[_0x24e5('0x4d')]['id']}})[_0x24e5('0x29')](handleEntityNotFound(_0x3205c6,null))[_0x24e5('0x29')](removeEntity(_0x3205c6,null))[_0x24e5('0x4b')](handleError(_0x3205c6,null));};exports[_0x24e5('0x5a')]=function(_0xd5fa9f,_0x2f840d){return db[_0x24e5('0x33')][_0x24e5('0x5a')]()['then'](respondWithResult(_0x2f840d,null))[_0x24e5('0x4b')](handleError(_0x2f840d,null));};exports['getMembers']=function(_0x1f72f5,_0x30c88c,_0x4f90a1){var _0x3e90bc={'raw':!![],'where':{}},_0x28cc6b={},_0x27f26b;return db[_0x24e5('0x33')][_0x24e5('0x5b')]({'where':{'id':_0x1f72f5[_0x24e5('0x4d')]['id']}})['then'](handleEntityNotFound(_0x30c88c,null))['then'](function(_0x372484){if(_0x372484){_0x27f26b=_0x372484[_0x24e5('0x2a')]({'plain':!![]});_0x28cc6b[_0x24e5('0x37')]=_[_0x24e5('0x39')](db[_0x24e5('0x5c')][_0x24e5('0x4e')]);_0x28cc6b[_0x24e5('0x38')]=_['keys'](_0x1f72f5[_0x24e5('0x38')]);_0x28cc6b[_0x24e5('0x3a')]=_[_0x24e5('0x3b')](_0x28cc6b[_0x24e5('0x37')],_0x28cc6b[_0x24e5('0x38')]);_0x3e90bc[_0x24e5('0x3c')]=_[_0x24e5('0x3b')](_0x28cc6b[_0x24e5('0x37')],qs[_0x24e5('0x3d')](_0x1f72f5[_0x24e5('0x38')][_0x24e5('0x3d')]));_0x3e90bc[_0x24e5('0x3c')]=_0x3e90bc[_0x24e5('0x3c')][_0x24e5('0x3e')]?_0x3e90bc['attributes']:_0x28cc6b['model'];if(!_0x1f72f5[_0x24e5('0x38')][_0x24e5('0x3f')](_0x24e5('0x40'))){_0x3e90bc[_0x24e5('0x21')]=qs[_0x24e5('0x21')](_0x1f72f5[_0x24e5('0x38')]['limit']);_0x3e90bc[_0x24e5('0x23')]=qs[_0x24e5('0x23')](_0x1f72f5['query'][_0x24e5('0x23')]);}_0x3e90bc['order']=qs[_0x24e5('0x42')](_0x1f72f5['query'][_0x24e5('0x42')]);_0x3e90bc['where']=qs[_0x24e5('0x3a')](_['pick'](_0x1f72f5[_0x24e5('0x38')],_0x28cc6b[_0x24e5('0x3a')]));_0x3e90bc[_0x24e5('0x43')][_0x24e5('0x5d')]=_0x372484['id'];if(_0x1f72f5[_0x24e5('0x38')]['filter']){_0x3e90bc[_0x24e5('0x43')]=_[_0x24e5('0x45')](_0x3e90bc[_0x24e5('0x43')],{'$or':_[_0x24e5('0x32')](_0x3e90bc[_0x24e5('0x3c')],function(_0x1327ea){var _0x2426c2={};_0x2426c2[_0x1327ea]={'$like':'%'+_0x1f72f5[_0x24e5('0x38')]['filter']+'%'};return _0x2426c2;})});}_0x3e90bc=_[_0x24e5('0x45')]({},_0x3e90bc,_0x1f72f5['options']);return db[_0x24e5('0x5c')][_0x24e5('0x4a')](_0x3e90bc);}})[_0x24e5('0x29')](function(_0x176a6b){if(_0x176a6b){return db[_0x24e5('0x5e')]['findAndCountAll']({'where':{'id':_['map'](_0x176a6b,_0x24e5('0x5f')),'role':_0x24e5('0x60')},'attributes':['id',_0x24e5('0x2f'),_0x24e5('0x61'),_0x24e5('0x62'),'createdAt']});}})[_0x24e5('0x29')](function(_0x25771c){if(_0x25771c){return{'count':_0x25771c['count'],'rows':_[_0x24e5('0x32')](_0x25771c[_0x24e5('0x63')],function(_0x12003b){return{'membername':_0x12003b[_0x24e5('0x2f')],'UserId':_0x12003b['id'],'queue_name':_0x27f26b['name'],'SmsQueueId':_0x27f26b['id'],'interface':util[_0x24e5('0x64')](_0x24e5('0x65'),_0x24e5('0x66'),_0x12003b[_0x24e5('0x2f')]),'penalty':0x0,'paused':_0x12003b[_0x24e5('0x61')],'createdAt':_0x12003b[_0x24e5('0x67')],'updatedAt':_0x12003b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x24e5('0x29')](respondWithFilteredResult(_0x30c88c,_0x3e90bc))[_0x24e5('0x4b')](handleError(_0x30c88c,null));};exports[_0x24e5('0x68')]=function(_0x17daff,_0x215124,_0xc90729){var _0x3da2fc={};var _0x3b6a8a={};var _0x12f69b;var _0x2e85b2;return db[_0x24e5('0x33')][_0x24e5('0x5b')]({'where':{'id':_0x17daff['params']['id']}})['then'](handleEntityNotFound(_0x215124,null))[_0x24e5('0x29')](function(_0x104dbc){if(_0x104dbc){_0x12f69b=_0x104dbc;_0x3b6a8a[_0x24e5('0x37')]=_[_0x24e5('0x39')](db[_0x24e5('0x69')][_0x24e5('0x4e')]);_0x3b6a8a[_0x24e5('0x38')]=_[_0x24e5('0x39')](_0x17daff['query']);_0x3b6a8a[_0x24e5('0x3a')]=_[_0x24e5('0x3b')](_0x3b6a8a[_0x24e5('0x37')],_0x3b6a8a[_0x24e5('0x38')]);_0x3da2fc[_0x24e5('0x3c')]=_[_0x24e5('0x3b')](_0x3b6a8a[_0x24e5('0x37')],qs['fields'](_0x17daff[_0x24e5('0x38')][_0x24e5('0x3d')]));_0x3da2fc[_0x24e5('0x3c')]=_0x3da2fc[_0x24e5('0x3c')][_0x24e5('0x3e')]?_0x3da2fc[_0x24e5('0x3c')]:_0x3b6a8a[_0x24e5('0x37')];_0x3da2fc[_0x24e5('0x41')]=qs[_0x24e5('0x42')](_0x17daff[_0x24e5('0x38')]['sort']);_0x3da2fc[_0x24e5('0x43')]=qs[_0x24e5('0x3a')](_[_0x24e5('0x6a')](_0x17daff['query'],_0x3b6a8a[_0x24e5('0x3a')]));if(_0x17daff[_0x24e5('0x38')][_0x24e5('0x44')]){_0x3da2fc['where']=_['merge'](_0x3da2fc['where'],{'$or':_[_0x24e5('0x32')](_0x3da2fc[_0x24e5('0x3c')],function(_0xba0dcb){var _0x14fb5d={};_0x14fb5d[_0xba0dcb]={'$like':'%'+_0x17daff[_0x24e5('0x38')]['filter']+'%'};return _0x14fb5d;})});}_0x3da2fc=_['merge']({},_0x3da2fc,_0x17daff[_0x24e5('0x47')]);return _0x12f69b[_0x24e5('0x68')](_0x3da2fc);}})[_0x24e5('0x29')](function(_0x91e56e){if(_0x91e56e){_0x2e85b2=_0x91e56e['length'];if(!_0x17daff['query']['hasOwnProperty'](_0x24e5('0x40'))){_0x3da2fc['limit']=qs[_0x24e5('0x21')](_0x17daff[_0x24e5('0x38')][_0x24e5('0x21')]);_0x3da2fc['offset']=qs['offset'](_0x17daff[_0x24e5('0x38')][_0x24e5('0x23')]);}return _0x12f69b[_0x24e5('0x68')](_0x3da2fc);}})[_0x24e5('0x29')](function(_0x3f8193){if(_0x3f8193){return _0x3f8193?{'count':_0x2e85b2,'rows':_0x3f8193}:null;}})['then'](respondWithResult(_0x215124,null))['catch'](handleError(_0x215124,null));};exports[_0x24e5('0x6b')]=function(_0x4aa66a,_0x109542,_0x1afa25){var _0x5d64b6=_0x4aa66a[_0x24e5('0x50')][_0x24e5('0x6c')];return db[_0x24e5('0x69')][_0x24e5('0x4a')]({'where':{'id':_0x5d64b6},'attributes':['id'],'include':[{'model':db[_0x24e5('0x5e')],'as':_0x24e5('0x6d'),'attributes':['id',_0x24e5('0x2f'),_0x24e5('0x6e'),_0x24e5('0x6f'),'interface'],'raw':!![]}]})['then'](function(_0x155df6){if(_0x155df6){var _0x5cf07a=_['flatMap'](_0x155df6,function(_0x194ac1){var _0x19be91=_0x194ac1[_0x24e5('0x2a')]({'plain':!![]});return _0x19be91[_0x24e5('0x6d')];});return db['SmsQueue'][_0x24e5('0x55')]({'where':{'id':_0x4aa66a['params']['id']}})[_0x24e5('0x29')](function(_0x38f4bf){return db[_0x24e5('0x70')][_0x24e5('0x71')](function(_0xf778b4){return _0x38f4bf['addTeams'](_0x5d64b6,{'transaction':_0xf778b4})[_0x24e5('0x29')](function(){return BPromise[_0x24e5('0x72')](_0x5cf07a,function(_0x304002){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x304002['id'],'SmsQueueId':_0x4aa66a[_0x24e5('0x4d')]['id']},'transaction':_0xf778b4});});})[_0x24e5('0x29')](function(){_0x5cf07a[_0x24e5('0x73')](function(_0x3017d9){socket['emit'](_0x24e5('0x74'),{'UserId':_0x3017d9['id'],'SmsQueueId':_0x38f4bf['id']});});});});});}})[_0x24e5('0x29')](respondWithStatusCode(_0x109542,null))['catch'](handleError(_0x109542,null));};exports[_0x24e5('0x75')]=function(_0x509729,_0x525f17,_0x145fe1){return db[_0x24e5('0x69')][_0x24e5('0x4a')]({'where':{'id':_0x509729['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x24e5('0x5e')],'as':_0x24e5('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x24e5('0x29')](handleEntityNotFound(_0x525f17,null))[_0x24e5('0x29')](function(_0x22e9a1){var _0x53a5a5=_[_0x24e5('0x32')](_0x22e9a1,'id');var _0x4ed50e=[];var _0x55c7dd=[];var _0x416557=squel['select']();_0x416557[_0x24e5('0x76')](_0x24e5('0x77'))[_0x24e5('0x78')]('team_has_sms_queues','tq')[_0x24e5('0x79')](_0x24e5('0x7a'),'ut',_0x24e5('0x7b'))[_0x24e5('0x43')](_0x24e5('0x7c'),_0x509729['params']['id']);for(var _0x20b035=0x0;_0x20b035<_0x22e9a1[_0x24e5('0x3e')];_0x20b035+=0x1){let _0x36da6e=_0x22e9a1[_0x20b035];for(var _0x20d996=0x0;_0x20d996<_0x36da6e[_0x24e5('0x6d')]['length'];_0x20d996+=0x1){let _0x52e242=_0x36da6e['Agents'][_0x20d996];var _0x11d7f0=_0x416557[_0x24e5('0x7d')]();_0x11d7f0[_0x24e5('0x43')](_0x24e5('0x7e'),_0x52e242['id']);_0x55c7dd[_0x24e5('0x7f')](db[_0x24e5('0x70')]['query'](_0x11d7f0[_0x24e5('0x80')](),{'type':db[_0x24e5('0x70')]['QueryTypes']['SELECT']})[_0x24e5('0x29')](function(_0x305854){if(_0x305854['length']===0x1){return _0x52e242['id'];}else{var _0x495e3e=_['every'](_[_0x24e5('0x32')](_0x305854,_0x24e5('0x81')),function(_0x1b1353){return _[_0x24e5('0x82')](_0x53a5a5,_0x1b1353);});if(_0x495e3e){return _0x52e242['id'];}}}));}}return BPromise[_0x24e5('0x83')](_0x55c7dd)[_0x24e5('0x29')](function(_0x32b10d){_0x4ed50e=_(_0x4ed50e)[_0x24e5('0x84')](_0x32b10d)['compact']()[_0x24e5('0x85')]();return db['SmsQueue'][_0x24e5('0x55')]({'where':{'id':_0x509729['params']['id']}})[_0x24e5('0x29')](function(_0x93928b){return db[_0x24e5('0x70')][_0x24e5('0x71')](function(_0x17a920){return _0x93928b[_0x24e5('0x75')](_0x509729[_0x24e5('0x38')][_0x24e5('0x6c')],{'transaction':_0x17a920})[_0x24e5('0x29')](function(){if(!_[_0x24e5('0x86')](_0x4ed50e)){return _0x93928b[_0x24e5('0x87')](_0x4ed50e,{'transaction':_0x17a920});}})[_0x24e5('0x29')](function(){_0x4ed50e[_0x24e5('0x73')](function(_0x9579d2){socket[_0x24e5('0x88')](_0x24e5('0x89'),{'UserId':_0x9579d2,'SmsQueueId':_0x93928b['id']});});});});});});})[_0x24e5('0x29')](respondWithStatusCode(_0x525f17,null))[_0x24e5('0x4b')](handleError(_0x525f17,null));};exports[_0x24e5('0x8a')]=function(_0x1934e4,_0x25cba2,_0x1a4f68){return db[_0x24e5('0x33')][_0x24e5('0x55')]({'where':{'id':_0x1934e4[_0x24e5('0x4d')]['id']}})[_0x24e5('0x29')](handleEntityNotFound(_0x25cba2,null))[_0x24e5('0x29')](function(_0x4e6300){if(_0x4e6300){return _0x4e6300[_0x24e5('0x8a')](_0x1934e4[_0x24e5('0x50')][_0x24e5('0x6c')],_[_0x24e5('0x8b')](_0x1934e4[_0x24e5('0x50')],[_0x24e5('0x6c'),'id'])||{})[_0x24e5('0x8c')](function(_0x4ce9f1){for(var _0x3ece3e=0x0;_0x3ece3e<_0x1934e4[_0x24e5('0x50')]['ids'][_0x24e5('0x3e')];_0x3ece3e+=0x1){socket[_0x24e5('0x88')](_0x24e5('0x74'),{'UserId':Number(_0x1934e4[_0x24e5('0x50')][_0x24e5('0x6c')][_0x3ece3e]),'SmsQueueId':Number(_0x1934e4[_0x24e5('0x4d')]['id'])});}return _0x4ce9f1;});}})['then'](respondWithResult(_0x25cba2,null))[_0x24e5('0x4b')](handleError(_0x25cba2,null));};exports[_0x24e5('0x87')]=function(_0x4c6494,_0x7f13e8,_0x14d907){return db['SmsQueue'][_0x24e5('0x55')]({'where':{'id':_0x4c6494[_0x24e5('0x4d')]['id']}})[_0x24e5('0x29')](handleEntityNotFound(_0x7f13e8,null))['then'](function(_0x2baf31){if(_0x2baf31){return _0x2baf31['removeAgents'](_0x4c6494[_0x24e5('0x38')][_0x24e5('0x6c')])['then'](function(){if(_[_0x24e5('0x8d')](_0x4c6494[_0x24e5('0x38')][_0x24e5('0x6c')])){for(var _0x24e9ce=0x0;_0x24e9ce<_0x4c6494[_0x24e5('0x38')]['ids'][_0x24e5('0x3e')];_0x24e9ce+=0x1){socket[_0x24e5('0x88')]('userSmsQueue:remove',{'UserId':Number(_0x4c6494[_0x24e5('0x38')][_0x24e5('0x6c')][_0x24e9ce]),'SmsQueueId':Number(_0x4c6494['params']['id'])});}}else{socket[_0x24e5('0x88')](_0x24e5('0x89'),{'UserId':Number(_0x4c6494[_0x24e5('0x38')]['ids']),'SmsQueueId':Number(_0x4c6494[_0x24e5('0x4d')]['id'])});}});}})[_0x24e5('0x29')](respondWithStatusCode(_0x7f13e8,null))['catch'](handleError(_0x7f13e8,null));};exports[_0x24e5('0x8e')]=function(_0x3ccd19,_0x5a88bb,_0x26296f){var _0x48b0dd={};var _0x55fd9a={};var _0x2e8803;var _0x404be0;return db[_0x24e5('0x33')]['findOne']({'where':{'id':_0x3ccd19[_0x24e5('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5a88bb,null))[_0x24e5('0x29')](function(_0x3c8fb2){if(_0x3c8fb2){_0x2e8803=_0x3c8fb2;_0x55fd9a[_0x24e5('0x37')]=_['keys'](db['User'][_0x24e5('0x4e')]);_0x55fd9a[_0x24e5('0x38')]=_[_0x24e5('0x39')](_0x3ccd19[_0x24e5('0x38')]);_0x55fd9a[_0x24e5('0x3a')]=_[_0x24e5('0x3b')](_0x55fd9a[_0x24e5('0x37')],_0x55fd9a[_0x24e5('0x38')]);_0x48b0dd[_0x24e5('0x3c')]=_[_0x24e5('0x3b')](_0x55fd9a[_0x24e5('0x37')],qs['fields'](_0x3ccd19[_0x24e5('0x38')][_0x24e5('0x3d')]));_0x48b0dd[_0x24e5('0x3c')]=_0x48b0dd['attributes'][_0x24e5('0x3e')]?_0x48b0dd[_0x24e5('0x3c')]:_0x55fd9a[_0x24e5('0x37')];_0x48b0dd[_0x24e5('0x41')]=qs[_0x24e5('0x42')](_0x3ccd19['query'][_0x24e5('0x42')]);_0x48b0dd[_0x24e5('0x43')]=qs['filters'](_[_0x24e5('0x6a')](_0x3ccd19[_0x24e5('0x38')],_0x55fd9a[_0x24e5('0x3a')]));if(_0x3ccd19[_0x24e5('0x38')]['filter']){_0x48b0dd[_0x24e5('0x43')]=_['merge'](_0x48b0dd[_0x24e5('0x43')],{'$or':_[_0x24e5('0x32')](_0x48b0dd[_0x24e5('0x3c')],function(_0x3c94f5){var _0x366ba7={};_0x366ba7[_0x3c94f5]={'$like':'%'+_0x3ccd19[_0x24e5('0x38')][_0x24e5('0x44')]+'%'};return _0x366ba7;})});}_0x48b0dd=_[_0x24e5('0x45')]({},_0x48b0dd,_0x3ccd19[_0x24e5('0x47')]);return _0x2e8803['getAgents'](_0x48b0dd);}})['then'](function(_0x1ee6cf){if(_0x1ee6cf){_0x404be0=_0x1ee6cf[_0x24e5('0x3e')];if(!_0x3ccd19['query'][_0x24e5('0x3f')](_0x24e5('0x40'))){_0x48b0dd[_0x24e5('0x21')]=qs[_0x24e5('0x21')](_0x3ccd19[_0x24e5('0x38')][_0x24e5('0x21')]);_0x48b0dd[_0x24e5('0x23')]=qs[_0x24e5('0x23')](_0x3ccd19[_0x24e5('0x38')][_0x24e5('0x23')]);}return _0x2e8803[_0x24e5('0x8e')](_0x48b0dd);}})[_0x24e5('0x29')](function(_0x1b23a5){if(_0x1b23a5){return _0x1b23a5?{'count':_0x404be0,'rows':_0x1b23a5}:null;}})['then'](respondWithResult(_0x5a88bb,null))[_0x24e5('0x4b')](handleError(_0x5a88bb,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 96ce1c9..e576a20 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 _0x340f=['emit','hasOwnProperty','hook','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x116574,_0xda33d9){var _0x3fa50f=function(_0x35a459){while(--_0x35a459){_0x116574['push'](_0x116574['shift']());}};_0x3fa50f(++_0xda33d9);}(_0x340f,0x157));var _0xf340=function(_0x19f8a6,_0x555fa9){_0x19f8a6=_0x19f8a6-0x0;var _0x442231=_0x340f[_0x19f8a6];return _0x442231;};'use strict';var EventEmitter=require(_0xf340('0x0'));var SmsQueue=require(_0xf340('0x1'))['db'][_0xf340('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xf340('0x3')](0x0);var events={'afterCreate':_0xf340('0x4'),'afterUpdate':_0xf340('0x5'),'afterDestroy':_0xf340('0x6')};function emitEvent(_0x3d89c2){return function(_0x6966c6,_0x5decc2,_0x170af2){SmsQueueEvents[_0xf340('0x7')](_0x3d89c2+':'+_0x6966c6['id'],_0x6966c6);SmsQueueEvents['emit'](_0x3d89c2,_0x6966c6);_0x170af2(null);};}for(var e in events){if(events[_0xf340('0x8')](e)){var event=events[e];SmsQueue[_0xf340('0x9')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x2aa8=['exports','../../mysqldb','SmsQueue','setMaxListeners','update','emit'];(function(_0x352c74,_0x46ad00){var _0x58ef81=function(_0xebb7ac){while(--_0xebb7ac){_0x352c74['push'](_0x352c74['shift']());}};_0x58ef81(++_0x46ad00);}(_0x2aa8,0x1c3));var _0x82aa=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2aa8[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x82aa('0x0'))['db'][_0x82aa('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x82aa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x82aa('0x3'),'afterDestroy':'remove'};function emitEvent(_0x47c333){return function(_0x5807ca,_0x599ed6,_0x23e3a3){SmsQueueEvents['emit'](_0x47c333+':'+_0x5807ca['id'],_0x5807ca);SmsQueueEvents[_0x82aa('0x4')](_0x47c333,_0x5807ca);_0x23e3a3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x82aa('0x5')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 923ee71..cb54dfd 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 _0x6573=['request-promise','rimraf','../../config/environment','./smsQueue.attributes','define','sms_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x49fbb1,_0x4e7b6d){var _0x599efc=function(_0x3cba53){while(--_0x3cba53){_0x49fbb1['push'](_0x49fbb1['shift']());}};_0x599efc(++_0x4e7b6d);}(_0x6573,0xea));var _0x3657=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6573[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3657('0x0'));var util=require(_0x3657('0x1'));var logger=require(_0x3657('0x2'))(_0x3657('0x3'));var moment=require(_0x3657('0x4'));var BPromise=require(_0x3657('0x5'));var rp=require(_0x3657('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3657('0x7'));var config=require(_0x3657('0x8'));var attributes=require(_0x3657('0x9'));module['exports']=function(_0x4118d2,_0x20ebae){return _0x4118d2[_0x3657('0xa')]('SmsQueue',attributes,{'tableName':_0x3657('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b73=['bluebird','path','rimraf','../../config/environment','exports','define','SmsQueue','lodash','moment'];(function(_0x16e27a,_0xbac2b1){var _0x4fd272=function(_0x2909cb){while(--_0x2909cb){_0x16e27a['push'](_0x16e27a['shift']());}};_0x4fd272(++_0xbac2b1);}(_0x5b73,0x18a));var _0x35b7=function(_0x1a9e78,_0x180720){_0x1a9e78=_0x1a9e78-0x0;var _0x113e06=_0x5b73[_0x1a9e78];return _0x113e06;};'use strict';var _=require(_0x35b7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x35b7('0x1'));var BPromise=require(_0x35b7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x35b7('0x3'));var rimraf=require(_0x35b7('0x4'));var config=require(_0x35b7('0x5'));var attributes=require('./smsQueue.attributes');module[_0x35b7('0x6')]=function(_0x310da8,_0x378873){return _0x310da8[_0x35b7('0x7')](_0x35b7('0x8'),attributes,{'tableName':'sms_queues','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 245b002..9d7a1da 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 _0xf6e4=['raw','attributes','limit','include','map','model','then','ShowSmsQueue','where','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./smsQueue.socket','register','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','SmsQueue','findAll','options'];(function(_0xc174ca,_0x1abcb2){var _0x3cc1d9=function(_0x3d49f5){while(--_0x3d49f5){_0xc174ca['push'](_0xc174ca['shift']());}};_0x3cc1d9(++_0x1abcb2);}(_0xf6e4,0x121));var _0x4f6e=function(_0x354fe1,_0x1cf097){_0x354fe1=_0x354fe1-0x0;var _0x2b15a2=_0xf6e4[_0x354fe1];return _0x2b15a2;};'use strict';var _=require(_0x4f6e('0x0'));var util=require(_0x4f6e('0x1'));var moment=require(_0x4f6e('0x2'));var BPromise=require(_0x4f6e('0x3'));var rs=require(_0x4f6e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f6e('0x5'));var logger=require(_0x4f6e('0x6'))('rpc');var config=require(_0x4f6e('0x7'));var jayson=require(_0x4f6e('0x8'));var client=jayson[_0x4f6e('0x9')][_0x4f6e('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4f6e('0xb')],{'host':_0x4f6e('0xc'),'port':0x18eb});var socket=require(_0x4f6e('0xd'))(new Redis(config['redis']));require(_0x4f6e('0xe'))[_0x4f6e('0xf')](socket);function respondWithRpcPromise(_0x104cdb,_0x368961,_0x4e9624){return new BPromise(function(_0x1888d3,_0x1e516a){return client['request'](_0x104cdb,_0x4e9624)['then'](function(_0x323a9c){logger[_0x4f6e('0x10')]('SmsQueue,\x20%s,\x20%s',_0x368961,_0x4f6e('0x11'));logger[_0x4f6e('0x12')](_0x4f6e('0x13'),_0x368961,'request\x20sent',JSON[_0x4f6e('0x14')](_0x323a9c));if(_0x323a9c[_0x4f6e('0x15')]){if(_0x323a9c[_0x4f6e('0x15')][_0x4f6e('0x16')]===0x1f4){logger[_0x4f6e('0x15')](_0x4f6e('0x17'),_0x368961,_0x323a9c[_0x4f6e('0x15')][_0x4f6e('0x18')]);return _0x1e516a(_0x323a9c['error'][_0x4f6e('0x18')]);}logger['error'](_0x4f6e('0x17'),_0x368961,_0x323a9c['error'][_0x4f6e('0x18')]);return _0x1888d3(_0x323a9c['error'][_0x4f6e('0x18')]);}else{logger[_0x4f6e('0x10')](_0x4f6e('0x17'),_0x368961,_0x4f6e('0x11'));_0x1888d3(_0x323a9c[_0x4f6e('0x19')][_0x4f6e('0x18')]);}})[_0x4f6e('0x1a')](function(_0x4ee770){logger[_0x4f6e('0x15')](_0x4f6e('0x17'),_0x368961,_0x4ee770);_0x1e516a(_0x4ee770);});});}exports[_0x4f6e('0x1b')]=function(_0x26832b){var _0x4dcf60=this;return new Promise(function(_0x356585,_0x33c747){return db[_0x4f6e('0x1c')][_0x4f6e('0x1d')]({'raw':_0x26832b['options']?_0x26832b[_0x4f6e('0x1e')][_0x4f6e('0x1f')]===undefined?!![]:![]:!![],'where':_0x26832b[_0x4f6e('0x1e')]?_0x26832b[_0x4f6e('0x1e')]['where']||null:null,'attributes':_0x26832b[_0x4f6e('0x1e')]?_0x26832b[_0x4f6e('0x1e')][_0x4f6e('0x20')]||null:null,'limit':_0x26832b[_0x4f6e('0x1e')]?_0x26832b[_0x4f6e('0x1e')][_0x4f6e('0x21')]||null:null,'include':_0x26832b[_0x4f6e('0x1e')]?_0x26832b[_0x4f6e('0x1e')][_0x4f6e('0x22')]?_[_0x4f6e('0x23')](_0x26832b[_0x4f6e('0x1e')][_0x4f6e('0x22')],function(_0x41caa5){return{'model':db[_0x41caa5[_0x4f6e('0x24')]],'as':_0x41caa5['as'],'attributes':_0x41caa5[_0x4f6e('0x20')],'include':_0x41caa5[_0x4f6e('0x22')]?_['map'](_0x41caa5['include'],function(_0x1070ad){return{'model':db[_0x1070ad[_0x4f6e('0x24')]],'as':_0x1070ad['as'],'attributes':_0x1070ad[_0x4f6e('0x20')],'include':_0x1070ad[_0x4f6e('0x22')]?_[_0x4f6e('0x23')](_0x1070ad[_0x4f6e('0x22')],function(_0x77837){return{'model':db[_0x77837[_0x4f6e('0x24')]],'as':_0x77837['as'],'attributes':_0x77837[_0x4f6e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4f6e('0x25')](function(_0x25ee1d){logger['info'](_0x4f6e('0x1b'),_0x26832b);logger['debug'](_0x4f6e('0x1b'),_0x26832b,JSON[_0x4f6e('0x14')](_0x25ee1d));_0x356585(_0x25ee1d);})[_0x4f6e('0x1a')](function(_0x2e2c14){logger['error']('GetSmsQueue',_0x2e2c14[_0x4f6e('0x18')],_0x26832b);_0x33c747(_0x4dcf60[_0x4f6e('0x15')](0x1f4,_0x2e2c14[_0x4f6e('0x18')]));});});};exports[_0x4f6e('0x26')]=function(_0x5c3b78){var _0x576a32=this;return new Promise(function(_0x212930,_0x3664ec){return db[_0x4f6e('0x1c')]['find']({'raw':_0x5c3b78[_0x4f6e('0x1e')]?_0x5c3b78['options'][_0x4f6e('0x1f')]===undefined?!![]:![]:!![],'where':_0x5c3b78[_0x4f6e('0x1e')]?_0x5c3b78[_0x4f6e('0x1e')][_0x4f6e('0x27')]||null:null,'attributes':_0x5c3b78[_0x4f6e('0x1e')]?_0x5c3b78[_0x4f6e('0x1e')][_0x4f6e('0x20')]||null:null,'include':_0x5c3b78[_0x4f6e('0x1e')]?_0x5c3b78['options'][_0x4f6e('0x22')]?_[_0x4f6e('0x23')](_0x5c3b78['options'][_0x4f6e('0x22')],function(_0x62efb1){return{'model':db[_0x62efb1[_0x4f6e('0x24')]],'as':_0x62efb1['as'],'attributes':_0x62efb1[_0x4f6e('0x20')],'include':_0x62efb1[_0x4f6e('0x22')]?_['map'](_0x62efb1['include'],function(_0x35e2c8){return{'model':db[_0x35e2c8[_0x4f6e('0x24')]],'as':_0x35e2c8['as'],'attributes':_0x35e2c8[_0x4f6e('0x20')],'include':_0x35e2c8[_0x4f6e('0x22')]?_['map'](_0x35e2c8[_0x4f6e('0x22')],function(_0x1f04b8){return{'model':db[_0x1f04b8[_0x4f6e('0x24')]],'as':_0x1f04b8['as'],'attributes':_0x1f04b8['attributes']};}):[]};}):[]};}):[]:[]})[_0x4f6e('0x25')](function(_0x36717b){logger[_0x4f6e('0x10')](_0x4f6e('0x26'),_0x5c3b78);logger[_0x4f6e('0x12')](_0x4f6e('0x26'),_0x5c3b78,JSON[_0x4f6e('0x14')](_0x36717b));_0x212930(_0x36717b);})['catch'](function(_0x1c7275){logger[_0x4f6e('0x15')](_0x4f6e('0x26'),_0x1c7275[_0x4f6e('0x18')],_0x5c3b78);_0x3664ec(_0x576a32[_0x4f6e('0x15')](0x1f4,_0x1c7275['message']));});});}; \ No newline at end of file +var _0xfff3=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','./smsQueue.socket','request','then','info','request\x20sent','debug','stringify','error','SmsQueue,\x20%s,\x20%s','message','result','GetSmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','SmsQueue','find','ShowSmsQueue','lodash'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xfff3,0x17b));var _0x3fff=function(_0x411199,_0x2ee864){_0x411199=_0x411199-0x0;var _0x46e80d=_0xfff3[_0x411199];return _0x46e80d;};'use strict';var _=require(_0x3fff('0x0'));var util=require(_0x3fff('0x1'));var moment=require(_0x3fff('0x2'));var BPromise=require(_0x3fff('0x3'));var rs=require(_0x3fff('0x4'));var fs=require('fs');var Redis=require(_0x3fff('0x5'));var db=require(_0x3fff('0x6'))['db'];var utils=require(_0x3fff('0x7'));var logger=require(_0x3fff('0x8'))(_0x3fff('0x9'));var config=require('../../config/environment');var jayson=require(_0x3fff('0xa'));var client=jayson['client'][_0x3fff('0xb')]({'port':0x232a});config['redis']=_[_0x3fff('0xc')](config[_0x3fff('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3fff('0xe'))['register'](socket);function respondWithRpcPromise(_0x17cfe6,_0x290707,_0x2c9be2){return new BPromise(function(_0x3ef9c0,_0x20911c){return client[_0x3fff('0xf')](_0x17cfe6,_0x2c9be2)[_0x3fff('0x10')](function(_0x5d9a14){logger[_0x3fff('0x11')]('SmsQueue,\x20%s,\x20%s',_0x290707,_0x3fff('0x12'));logger[_0x3fff('0x13')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x290707,_0x3fff('0x12'),JSON[_0x3fff('0x14')](_0x5d9a14));if(_0x5d9a14['error']){if(_0x5d9a14[_0x3fff('0x15')]['code']===0x1f4){logger[_0x3fff('0x15')](_0x3fff('0x16'),_0x290707,_0x5d9a14[_0x3fff('0x15')][_0x3fff('0x17')]);return _0x20911c(_0x5d9a14[_0x3fff('0x15')][_0x3fff('0x17')]);}logger[_0x3fff('0x15')](_0x3fff('0x16'),_0x290707,_0x5d9a14[_0x3fff('0x15')][_0x3fff('0x17')]);return _0x3ef9c0(_0x5d9a14[_0x3fff('0x15')][_0x3fff('0x17')]);}else{logger[_0x3fff('0x11')](_0x3fff('0x16'),_0x290707,_0x3fff('0x12'));_0x3ef9c0(_0x5d9a14[_0x3fff('0x18')][_0x3fff('0x17')]);}})['catch'](function(_0x3a79e5){logger[_0x3fff('0x15')]('SmsQueue,\x20%s,\x20%s',_0x290707,_0x3a79e5);_0x20911c(_0x3a79e5);});});}exports[_0x3fff('0x19')]=function(_0x199cef){var _0x40cd56=this;return new Promise(function(_0x7bb0a0,_0x1ff4ee){return db['SmsQueue'][_0x3fff('0x1a')]({'raw':_0x199cef[_0x3fff('0x1b')]?_0x199cef['options'][_0x3fff('0x1c')]===undefined?!![]:![]:!![],'where':_0x199cef[_0x3fff('0x1b')]?_0x199cef[_0x3fff('0x1b')][_0x3fff('0x1d')]||null:null,'attributes':_0x199cef[_0x3fff('0x1b')]?_0x199cef[_0x3fff('0x1b')][_0x3fff('0x1e')]||null:null,'limit':_0x199cef[_0x3fff('0x1b')]?_0x199cef['options'][_0x3fff('0x1f')]||null:null,'include':_0x199cef[_0x3fff('0x1b')]?_0x199cef[_0x3fff('0x1b')][_0x3fff('0x20')]?_[_0x3fff('0x21')](_0x199cef[_0x3fff('0x1b')][_0x3fff('0x20')],function(_0x355f44){return{'model':db[_0x355f44[_0x3fff('0x22')]],'as':_0x355f44['as'],'attributes':_0x355f44[_0x3fff('0x1e')],'include':_0x355f44['include']?_[_0x3fff('0x21')](_0x355f44['include'],function(_0x5d30c6){return{'model':db[_0x5d30c6[_0x3fff('0x22')]],'as':_0x5d30c6['as'],'attributes':_0x5d30c6[_0x3fff('0x1e')],'include':_0x5d30c6[_0x3fff('0x20')]?_[_0x3fff('0x21')](_0x5d30c6[_0x3fff('0x20')],function(_0x8342a7){return{'model':db[_0x8342a7['model']],'as':_0x8342a7['as'],'attributes':_0x8342a7[_0x3fff('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3fff('0x10')](function(_0x1437ba){logger[_0x3fff('0x11')](_0x3fff('0x19'),_0x199cef);logger[_0x3fff('0x13')](_0x3fff('0x19'),_0x199cef,JSON[_0x3fff('0x14')](_0x1437ba));_0x7bb0a0(_0x1437ba);})['catch'](function(_0x547cfb){logger[_0x3fff('0x15')]('GetSmsQueue',_0x547cfb[_0x3fff('0x17')],_0x199cef);_0x1ff4ee(_0x40cd56['error'](0x1f4,_0x547cfb['message']));});});};exports['ShowSmsQueue']=function(_0x582464){var _0x393238=this;return new Promise(function(_0x16d750,_0xb03317){return db[_0x3fff('0x23')][_0x3fff('0x24')]({'raw':_0x582464[_0x3fff('0x1b')]?_0x582464[_0x3fff('0x1b')][_0x3fff('0x1c')]===undefined?!![]:![]:!![],'where':_0x582464['options']?_0x582464[_0x3fff('0x1b')]['where']||null:null,'attributes':_0x582464[_0x3fff('0x1b')]?_0x582464[_0x3fff('0x1b')][_0x3fff('0x1e')]||null:null,'include':_0x582464[_0x3fff('0x1b')]?_0x582464['options'][_0x3fff('0x20')]?_[_0x3fff('0x21')](_0x582464['options'][_0x3fff('0x20')],function(_0x2fbe41){return{'model':db[_0x2fbe41[_0x3fff('0x22')]],'as':_0x2fbe41['as'],'attributes':_0x2fbe41[_0x3fff('0x1e')],'include':_0x2fbe41[_0x3fff('0x20')]?_['map'](_0x2fbe41[_0x3fff('0x20')],function(_0x3468b2){return{'model':db[_0x3468b2[_0x3fff('0x22')]],'as':_0x3468b2['as'],'attributes':_0x3468b2[_0x3fff('0x1e')],'include':_0x3468b2['include']?_['map'](_0x3468b2[_0x3fff('0x20')],function(_0x46812d){return{'model':db[_0x46812d[_0x3fff('0x22')]],'as':_0x46812d['as'],'attributes':_0x46812d[_0x3fff('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3fff('0x10')](function(_0x46a393){logger['info'](_0x3fff('0x25'),_0x582464);logger[_0x3fff('0x13')](_0x3fff('0x25'),_0x582464,JSON['stringify'](_0x46a393));_0x16d750(_0x46a393);})['catch'](function(_0x318eb6){logger[_0x3fff('0x15')](_0x3fff('0x25'),_0x318eb6[_0x3fff('0x17')],_0x582464);_0xb03317(_0x393238[_0x3fff('0x15')](0x1f4,_0x318eb6[_0x3fff('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index aa13013..ea9d1dd 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 _0xcaa6=['smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x4d2ef5,_0x465bfb){var _0x32c356=function(_0x2bd5fc){while(--_0x2bd5fc){_0x4d2ef5['push'](_0x4d2ef5['shift']());}};_0x32c356(++_0x465bfb);}(_0xcaa6,0x111));var _0x6caa=function(_0x350e3b,_0x5b913d){_0x350e3b=_0x350e3b-0x0;var _0x3ffc12=_0xcaa6[_0x350e3b];return _0x3ffc12;};'use strict';var SmsQueueEvents=require(_0x6caa('0x0'));var events=[_0x6caa('0x1'),_0x6caa('0x2'),_0x6caa('0x3')];function createListener(_0xc056e5,_0x448323){return function(_0x2a90a5){_0x448323[_0x6caa('0x4')](_0xc056e5,_0x2a90a5);};}function removeListener(_0x5cff07,_0x4dd02f){return function(){SmsQueueEvents[_0x6caa('0x5')](_0x5cff07,_0x4dd02f);};}exports[_0x6caa('0x6')]=function(_0x4b09c3){for(var _0x4142c8=0x0,_0x5833d6=events['length'];_0x4142c8<_0x5833d6;_0x4142c8++){var _0x400933=events[_0x4142c8];var _0x43852e=createListener(_0x6caa('0x7')+_0x400933,_0x4b09c3);SmsQueueEvents['on'](_0x400933,_0x43852e);}}; \ No newline at end of file +var _0xb556=['length','smsQueue:','./smsQueue.events','save','remove','emit','removeListener','register'];(function(_0x309be0,_0x5704f3){var _0x324e18=function(_0x144a65){while(--_0x144a65){_0x309be0['push'](_0x309be0['shift']());}};_0x324e18(++_0x5704f3);}(_0xb556,0xe2));var _0x6b55=function(_0x40ff53,_0x4930c9){_0x40ff53=_0x40ff53-0x0;var _0x585a0e=_0xb556[_0x40ff53];return _0x585a0e;};'use strict';var SmsQueueEvents=require(_0x6b55('0x0'));var events=[_0x6b55('0x1'),_0x6b55('0x2'),'update'];function createListener(_0x2ed6b3,_0xae37a0){return function(_0x58e400){_0xae37a0[_0x6b55('0x3')](_0x2ed6b3,_0x58e400);};}function removeListener(_0x949927,_0x5c68ed){return function(){SmsQueueEvents[_0x6b55('0x4')](_0x949927,_0x5c68ed);};}exports[_0x6b55('0x5')]=function(_0x171605){for(var _0x23eeb9=0x0,_0x2ca3f1=events[_0x6b55('0x6')];_0x23eeb9<_0x2ca3f1;_0x23eeb9++){var _0x2b0e43=events[_0x23eeb9];var _0x1c180f=createListener(_0x6b55('0x7')+_0x2b0e43,_0x171605);SmsQueueEvents['on'](_0x2b0e43,_0x1c180f);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index e1cf465..d50faa7 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 _0x2ec6=['../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x19136f,_0x43b2bb){var _0x378c46=function(_0x26a290){while(--_0x26a290){_0x19136f['push'](_0x19136f['shift']());}};_0x378c46(++_0x43b2bb);}(_0x2ec6,0x6a));var _0x62ec=function(_0x69af80,_0x45fed3){_0x69af80=_0x69af80-0x0;var _0x3c13a9=_0x2ec6[_0x69af80];return _0x3c13a9;};'use strict';var multer=require(_0x62ec('0x0'));var util=require(_0x62ec('0x1'));var path=require(_0x62ec('0x2'));var timeout=require(_0x62ec('0x3'));var express=require(_0x62ec('0x4'));var router=express[_0x62ec('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x62ec('0x6'));var interaction=require(_0x62ec('0x7'));var config=require(_0x62ec('0x8'));var controller=require('./smsQueueReport.controller');router[_0x62ec('0x9')]('/',auth[_0x62ec('0xa')](),controller[_0x62ec('0xb')]);router[_0x62ec('0x9')](_0x62ec('0xc'),auth[_0x62ec('0xa')](),controller['describe']);router[_0x62ec('0x9')](_0x62ec('0xd'),auth[_0x62ec('0xa')](),controller[_0x62ec('0xe')]);router[_0x62ec('0xf')]('/',auth[_0x62ec('0xa')](),controller['create']);router[_0x62ec('0x10')](_0x62ec('0xd'),auth[_0x62ec('0xa')](),controller[_0x62ec('0x11')]);router['delete']('/:id',auth[_0x62ec('0xa')](),controller[_0x62ec('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2fa9=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','/describe','describe','get','show','post','create','/:id','update','delete','destroy','exports','multer','util'];(function(_0x1bc792,_0x2c5029){var _0xebae5f=function(_0x5c885a){while(--_0x5c885a){_0x1bc792['push'](_0x1bc792['shift']());}};_0xebae5f(++_0x2c5029);}(_0x2fa9,0x91));var _0x92fa=function(_0x3689a7,_0x2aabcc){_0x3689a7=_0x3689a7-0x0;var _0x15ee82=_0x2fa9[_0x3689a7];return _0x15ee82;};'use strict';var multer=require(_0x92fa('0x0'));var util=require(_0x92fa('0x1'));var path=require('path');var timeout=require(_0x92fa('0x2'));var express=require(_0x92fa('0x3'));var router=express[_0x92fa('0x4')]();var fs_extra=require(_0x92fa('0x5'));var auth=require(_0x92fa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x92fa('0x7'));var controller=require(_0x92fa('0x8'));router['get']('/',auth[_0x92fa('0x9')](),controller['index']);router['get'](_0x92fa('0xa'),auth[_0x92fa('0x9')](),controller[_0x92fa('0xb')]);router[_0x92fa('0xc')]('/:id',auth[_0x92fa('0x9')](),controller[_0x92fa('0xd')]);router[_0x92fa('0xe')]('/',auth['isAuthenticated'](),controller[_0x92fa('0xf')]);router['put'](_0x92fa('0x10'),auth[_0x92fa('0x9')](),controller[_0x92fa('0x11')]);router[_0x92fa('0x12')]('/:id',auth[_0x92fa('0x9')](),controller[_0x92fa('0x13')]);module[_0x92fa('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 1564eb5..3094fd6 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 _0x4599=['DATE','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4599,0x1b9));var _0x9459=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4599[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var Sequelize=require(_0x9459('0x0'));module[_0x9459('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9459('0x2')]},'joinAt':{'type':Sequelize[_0x9459('0x3')]},'leaveAt':{'type':Sequelize[_0x9459('0x3')]},'acceptAt':{'type':Sequelize[_0x9459('0x3')]},'exitAt':{'type':Sequelize[_0x9459('0x3')]},'reason':{'type':Sequelize[_0x9459('0x2')]}}; \ No newline at end of file +var _0x5692=['exports','STRING','DATE','sequelize'];(function(_0x99228a,_0x52c305){var _0x4b6345=function(_0x227362){while(--_0x227362){_0x99228a['push'](_0x99228a['shift']());}};_0x4b6345(++_0x52c305);}(_0x5692,0x8b));var _0x2569=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5692[_0x465028];return _0xb783d4;};'use strict';var moment=require('moment');var Sequelize=require(_0x2569('0x0'));module[_0x2569('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x2569('0x2')]},'joinAt':{'type':Sequelize[_0x2569('0x3')]},'leaveAt':{'type':Sequelize[_0x2569('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x2569('0x3')]},'reason':{'type':Sequelize[_0x2569('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 08847ce..142f4a4 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 _0x0c13=['util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','SmsQueueReport','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','merge','filter','includeAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0x0c13,0x162));var _0x30c1=function(_0x3a10e3,_0x3cdb35){_0x3a10e3=_0x3a10e3-0x0;var _0xf067c8=_0x0c13[_0x3a10e3];return _0xf067c8;};'use strict';var emlformat=require(_0x30c1('0x0'));var rimraf=require(_0x30c1('0x1'));var zipdir=require(_0x30c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x30c1('0x3'));var moment=require(_0x30c1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x30c1('0x5'));var util=require(_0x30c1('0x6'));var path=require('path');var sox=require(_0x30c1('0x7'));var csv=require('to-csv');var ejs=require(_0x30c1('0x8'));var fs=require('fs');var fs_extra=require(_0x30c1('0x9'));var _=require('lodash');var squel=require(_0x30c1('0xa'));var crypto=require('crypto');var jsforce=require(_0x30c1('0xb'));var deskjs=require(_0x30c1('0xc'));var toCsv=require(_0x30c1('0xd'));var querystring=require(_0x30c1('0xe'));var Papa=require(_0x30c1('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x30c1('0x10'));var hardwareService=require(_0x30c1('0x11'));var logger=require(_0x30c1('0x12'))('api');var utils=require(_0x30c1('0x13'));var config=require(_0x30c1('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x30c1('0x15'))['db'];function respondWithStatusCode(_0x494fa3,_0x34a1f4){_0x34a1f4=_0x34a1f4||0xcc;return function(_0x10a497){if(_0x10a497){return _0x494fa3[_0x30c1('0x16')](_0x34a1f4);}return _0x494fa3[_0x30c1('0x17')](_0x34a1f4)[_0x30c1('0x18')]();};}function respondWithResult(_0x311d17,_0x2e5981){_0x2e5981=_0x2e5981||0xc8;return function(_0x154a47){if(_0x154a47){return _0x311d17[_0x30c1('0x17')](_0x2e5981)[_0x30c1('0x19')](_0x154a47);}};}function respondWithFilteredResult(_0x240623,_0x3ecb9c){return function(_0x3fe667){if(_0x3fe667){var _0x57f257=typeof _0x3ecb9c[_0x30c1('0x1a')]==='undefined'&&typeof _0x3ecb9c['limit']===_0x30c1('0x1b');var _0x442291=_0x3fe667[_0x30c1('0x1c')];var _0x22750b=_0x57f257?0x0:_0x3ecb9c[_0x30c1('0x1a')];var _0x5e9737=_0x57f257?_0x3fe667[_0x30c1('0x1c')]:_0x3ecb9c[_0x30c1('0x1a')]+_0x3ecb9c[_0x30c1('0x1d')];var _0x2735c6;if(_0x5e9737>=_0x442291){_0x5e9737=_0x442291;_0x2735c6=0xc8;}else{_0x2735c6=0xce;}_0x240623[_0x30c1('0x17')](_0x2735c6);return _0x240623[_0x30c1('0x1e')](_0x30c1('0x1f'),_0x22750b+'-'+_0x5e9737+'/'+_0x442291)[_0x30c1('0x19')](_0x3fe667);}return null;};}function patchUpdates(_0x5140b3){return function(_0x581342){try{jsonpatch[_0x30c1('0x20')](_0x581342,_0x5140b3,!![]);}catch(_0x2c5bdd){return BPromise['reject'](_0x2c5bdd);}return _0x581342[_0x30c1('0x21')]();};}function saveUpdates(_0x31b24f,_0x2a635a){return function(_0x3a7247){if(_0x3a7247){return _0x3a7247['update'](_0x31b24f)[_0x30c1('0x22')](function(_0x5b9828){return _0x5b9828;});}return null;};}function removeEntity(_0x868c81,_0x40e813){return function(_0x415040){if(_0x415040){return _0x415040[_0x30c1('0x23')]()[_0x30c1('0x22')](function(){_0x868c81[_0x30c1('0x17')](0xcc)[_0x30c1('0x18')]();});}};}function handleEntityNotFound(_0x3c5021,_0x5f08a4){return function(_0x61add0){if(!_0x61add0){_0x3c5021[_0x30c1('0x16')](0x194);}return _0x61add0;};}function handleError(_0x439cd4,_0x41caaa){_0x41caaa=_0x41caaa||0x1f4;return function(_0x2d412c){logger[_0x30c1('0x24')](_0x2d412c[_0x30c1('0x25')]);if(_0x2d412c['name']){delete _0x2d412c[_0x30c1('0x26')];}_0x439cd4[_0x30c1('0x17')](_0x41caaa)[_0x30c1('0x27')](_0x2d412c);};}exports[_0x30c1('0x28')]=function(_0x450cf4,_0x23a808){var _0x5517b5={},_0xa8deb={},_0x252e9f={'count':0x0,'rows':[]};var _0x1daa0c=_['map'](db[_0x30c1('0x29')]['rawAttributes'],function(_0x4d10c7){return{'name':_0x4d10c7[_0x30c1('0x2a')],'type':_0x4d10c7[_0x30c1('0x2b')][_0x30c1('0x2c')]};});_0xa8deb[_0x30c1('0x2d')]=_[_0x30c1('0x2e')](_0x1daa0c,_0x30c1('0x26'));_0xa8deb[_0x30c1('0x2f')]=_[_0x30c1('0x30')](_0x450cf4[_0x30c1('0x2f')]);_0xa8deb['filters']=_[_0x30c1('0x31')](_0xa8deb[_0x30c1('0x2d')],_0xa8deb[_0x30c1('0x2f')]);_0x5517b5[_0x30c1('0x32')]=_[_0x30c1('0x31')](_0xa8deb[_0x30c1('0x2d')],qs['fields'](_0x450cf4[_0x30c1('0x2f')][_0x30c1('0x33')]));_0x5517b5['attributes']=_0x5517b5[_0x30c1('0x32')][_0x30c1('0x34')]?_0x5517b5[_0x30c1('0x32')]:_0xa8deb[_0x30c1('0x2d')];if(!_0x450cf4[_0x30c1('0x2f')][_0x30c1('0x35')](_0x30c1('0x36'))){_0x5517b5[_0x30c1('0x1d')]=qs['limit'](_0x450cf4['query'][_0x30c1('0x1d')]);_0x5517b5[_0x30c1('0x1a')]=qs[_0x30c1('0x1a')](_0x450cf4[_0x30c1('0x2f')][_0x30c1('0x1a')]);}_0x5517b5[_0x30c1('0x37')]=qs[_0x30c1('0x38')](_0x450cf4[_0x30c1('0x2f')]['sort']);_0x5517b5['where']=qs[_0x30c1('0x39')](_['pick'](_0x450cf4[_0x30c1('0x2f')],_0xa8deb[_0x30c1('0x39')]),_0x1daa0c);if(_0x450cf4[_0x30c1('0x2f')]['filter']){_0x5517b5['where']=_[_0x30c1('0x3a')](_0x5517b5['where'],{'$or':_[_0x30c1('0x2e')](_0x1daa0c,function(_0x12e8a2){if(_0x12e8a2[_0x30c1('0x2b')]!=='VIRTUAL'){var _0x1ba003={};_0x1ba003[_0x12e8a2[_0x30c1('0x26')]]={'$like':'%'+_0x450cf4[_0x30c1('0x2f')][_0x30c1('0x3b')]+'%'};return _0x1ba003;}})});}_0x5517b5=_['merge']({},_0x5517b5,_0x450cf4['options']);var _0xac7757={'where':_0x5517b5['where']};return db[_0x30c1('0x29')][_0x30c1('0x1c')](_0xac7757)[_0x30c1('0x22')](function(_0x556df2){_0x252e9f['count']=_0x556df2;if(_0x450cf4['query'][_0x30c1('0x3c')]){_0x5517b5['include']=[{'all':!![]}];}return db[_0x30c1('0x29')]['findAll'](_0x5517b5);})[_0x30c1('0x22')](function(_0xd78003){_0x252e9f[_0x30c1('0x3d')]=_0xd78003;return _0x252e9f;})[_0x30c1('0x22')](respondWithFilteredResult(_0x23a808,_0x5517b5))[_0x30c1('0x3e')](handleError(_0x23a808,null));};exports[_0x30c1('0x3f')]=function(_0x18ff55,_0x109b62){var _0x5af759={'raw':!![],'where':{'id':_0x18ff55[_0x30c1('0x40')]['id']}},_0x2a4da9={};_0x2a4da9['model']=_[_0x30c1('0x30')](db[_0x30c1('0x29')][_0x30c1('0x41')]);_0x2a4da9['query']=_[_0x30c1('0x30')](_0x18ff55['query']);_0x2a4da9['filters']=_[_0x30c1('0x31')](_0x2a4da9[_0x30c1('0x2d')],_0x2a4da9[_0x30c1('0x2f')]);_0x5af759[_0x30c1('0x32')]=_['intersection'](_0x2a4da9[_0x30c1('0x2d')],qs[_0x30c1('0x33')](_0x18ff55[_0x30c1('0x2f')][_0x30c1('0x33')]));_0x5af759[_0x30c1('0x32')]=_0x5af759[_0x30c1('0x32')][_0x30c1('0x34')]?_0x5af759[_0x30c1('0x32')]:_0x2a4da9['model'];if(_0x18ff55['query'][_0x30c1('0x3c')]){_0x5af759[_0x30c1('0x42')]=[{'all':!![]}];}_0x5af759=_[_0x30c1('0x3a')]({},_0x5af759,_0x18ff55[_0x30c1('0x43')]);return db[_0x30c1('0x29')][_0x30c1('0x44')](_0x5af759)[_0x30c1('0x22')](handleEntityNotFound(_0x109b62,null))[_0x30c1('0x22')](respondWithResult(_0x109b62,null))[_0x30c1('0x3e')](handleError(_0x109b62,null));};exports[_0x30c1('0x45')]=function(_0x3d4b4c,_0x102149){return db[_0x30c1('0x29')][_0x30c1('0x45')](_0x3d4b4c[_0x30c1('0x46')],{})[_0x30c1('0x22')](respondWithResult(_0x102149,0xc9))[_0x30c1('0x3e')](handleError(_0x102149,null));};exports[_0x30c1('0x47')]=function(_0x5338fd,_0xb9bc98){if(_0x5338fd[_0x30c1('0x46')]['id']){delete _0x5338fd['body']['id'];}return db[_0x30c1('0x29')][_0x30c1('0x44')]({'where':{'id':_0x5338fd[_0x30c1('0x40')]['id']}})[_0x30c1('0x22')](handleEntityNotFound(_0xb9bc98,null))[_0x30c1('0x22')](saveUpdates(_0x5338fd[_0x30c1('0x46')],null))[_0x30c1('0x22')](respondWithResult(_0xb9bc98,null))[_0x30c1('0x3e')](handleError(_0xb9bc98,null));};exports['destroy']=function(_0x173731,_0x1ebf50){return db[_0x30c1('0x29')][_0x30c1('0x44')]({'where':{'id':_0x173731[_0x30c1('0x40')]['id']}})[_0x30c1('0x22')](handleEntityNotFound(_0x1ebf50,null))['then'](removeEntity(_0x1ebf50,null))[_0x30c1('0x3e')](handleError(_0x1ebf50,null));};exports['describe']=function(_0x130572,_0x3b4873){return db['SmsQueueReport']['describe']()[_0x30c1('0x22')](respondWithResult(_0x3b4873,null))['catch'](handleError(_0x3b4873,null));}; \ No newline at end of file +var _0x8d84=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','apply','update','then','destroy','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SmsQueueReport','include','findAll','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2d2e85,_0x22faa9){var _0x3e9f5e=function(_0x101c22){while(--_0x101c22){_0x2d2e85['push'](_0x2d2e85['shift']());}};_0x3e9f5e(++_0x22faa9);}(_0x8d84,0x87));var _0x48d8=function(_0x3b19e5,_0x16ffd7){_0x3b19e5=_0x3b19e5-0x0;var _0x13871d=_0x8d84[_0x3b19e5];return _0x13871d;};'use strict';var emlformat=require(_0x48d8('0x0'));var rimraf=require(_0x48d8('0x1'));var zipdir=require(_0x48d8('0x2'));var jsonpatch=require(_0x48d8('0x3'));var rp=require(_0x48d8('0x4'));var moment=require(_0x48d8('0x5'));var BPromise=require(_0x48d8('0x6'));var Mustache=require(_0x48d8('0x7'));var util=require('util');var path=require(_0x48d8('0x8'));var sox=require(_0x48d8('0x9'));var csv=require('to-csv');var ejs=require(_0x48d8('0xa'));var fs=require('fs');var fs_extra=require(_0x48d8('0xb'));var _=require(_0x48d8('0xc'));var squel=require(_0x48d8('0xd'));var crypto=require(_0x48d8('0xe'));var jsforce=require(_0x48d8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x48d8('0x10'));var querystring=require(_0x48d8('0x11'));var Papa=require('papaparse');var Redis=require(_0x48d8('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x48d8('0x13'));var as=require(_0x48d8('0x14'));var hardwareService=require(_0x48d8('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x48d8('0x16'));var config=require(_0x48d8('0x17'));var licenseUtil=require(_0x48d8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x560338,_0x5ccf41){_0x5ccf41=_0x5ccf41||0xcc;return function(_0x5c720a){if(_0x5c720a){return _0x560338[_0x48d8('0x19')](_0x5ccf41);}return _0x560338[_0x48d8('0x1a')](_0x5ccf41)['end']();};}function respondWithResult(_0x1247ec,_0x55cbac){_0x55cbac=_0x55cbac||0xc8;return function(_0x4bbe3b){if(_0x4bbe3b){return _0x1247ec[_0x48d8('0x1a')](_0x55cbac)[_0x48d8('0x1b')](_0x4bbe3b);}};}function respondWithFilteredResult(_0x3bc689,_0x316129){return function(_0x377297){if(_0x377297){var _0xb118de=typeof _0x316129[_0x48d8('0x1c')]===_0x48d8('0x1d')&&typeof _0x316129['limit']===_0x48d8('0x1d');var _0x552992=_0x377297[_0x48d8('0x1e')];var _0x3525ed=_0xb118de?0x0:_0x316129[_0x48d8('0x1c')];var _0x438da0=_0xb118de?_0x377297[_0x48d8('0x1e')]:_0x316129[_0x48d8('0x1c')]+_0x316129[_0x48d8('0x1f')];var _0x1f4020;if(_0x438da0>=_0x552992){_0x438da0=_0x552992;_0x1f4020=0xc8;}else{_0x1f4020=0xce;}_0x3bc689[_0x48d8('0x1a')](_0x1f4020);return _0x3bc689[_0x48d8('0x20')]('Content-Range',_0x3525ed+'-'+_0x438da0+'/'+_0x552992)[_0x48d8('0x1b')](_0x377297);}return null;};}function patchUpdates(_0x1b12a7){return function(_0x24967a){try{jsonpatch[_0x48d8('0x21')](_0x24967a,_0x1b12a7,!![]);}catch(_0x52bb3d){return BPromise['reject'](_0x52bb3d);}return _0x24967a['save']();};}function saveUpdates(_0x13bbf4,_0x199c20){return function(_0x1e8246){if(_0x1e8246){return _0x1e8246[_0x48d8('0x22')](_0x13bbf4)[_0x48d8('0x23')](function(_0x43ee55){return _0x43ee55;});}return null;};}function removeEntity(_0x2ae42c,_0x256c85){return function(_0x1725f3){if(_0x1725f3){return _0x1725f3[_0x48d8('0x24')]()[_0x48d8('0x23')](function(){_0x2ae42c[_0x48d8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2038ac,_0x18c68a){return function(_0x59c11b){if(!_0x59c11b){_0x2038ac['sendStatus'](0x194);}return _0x59c11b;};}function handleError(_0x4d4080,_0x4b48f8){_0x4b48f8=_0x4b48f8||0x1f4;return function(_0x2da4f3){logger['error'](_0x2da4f3[_0x48d8('0x25')]);if(_0x2da4f3[_0x48d8('0x26')]){delete _0x2da4f3[_0x48d8('0x26')];}_0x4d4080['status'](_0x4b48f8)['send'](_0x2da4f3);};}exports['index']=function(_0x4c49f7,_0xcfa047){var _0x1775e4={},_0x35aff0={},_0x6b58b7={'count':0x0,'rows':[]};var _0x2b5796=_[_0x48d8('0x27')](db['SmsQueueReport'][_0x48d8('0x28')],function(_0x2b9fb1){return{'name':_0x2b9fb1[_0x48d8('0x29')],'type':_0x2b9fb1[_0x48d8('0x2a')]['key']};});_0x35aff0[_0x48d8('0x2b')]=_['map'](_0x2b5796,_0x48d8('0x26'));_0x35aff0[_0x48d8('0x2c')]=_[_0x48d8('0x2d')](_0x4c49f7['query']);_0x35aff0[_0x48d8('0x2e')]=_[_0x48d8('0x2f')](_0x35aff0[_0x48d8('0x2b')],_0x35aff0[_0x48d8('0x2c')]);_0x1775e4[_0x48d8('0x30')]=_['intersection'](_0x35aff0[_0x48d8('0x2b')],qs['fields'](_0x4c49f7[_0x48d8('0x2c')][_0x48d8('0x31')]));_0x1775e4[_0x48d8('0x30')]=_0x1775e4[_0x48d8('0x30')][_0x48d8('0x32')]?_0x1775e4[_0x48d8('0x30')]:_0x35aff0[_0x48d8('0x2b')];if(!_0x4c49f7['query'][_0x48d8('0x33')](_0x48d8('0x34'))){_0x1775e4['limit']=qs[_0x48d8('0x1f')](_0x4c49f7[_0x48d8('0x2c')][_0x48d8('0x1f')]);_0x1775e4[_0x48d8('0x1c')]=qs[_0x48d8('0x1c')](_0x4c49f7[_0x48d8('0x2c')][_0x48d8('0x1c')]);}_0x1775e4[_0x48d8('0x35')]=qs[_0x48d8('0x36')](_0x4c49f7[_0x48d8('0x2c')][_0x48d8('0x36')]);_0x1775e4[_0x48d8('0x37')]=qs['filters'](_[_0x48d8('0x38')](_0x4c49f7[_0x48d8('0x2c')],_0x35aff0[_0x48d8('0x2e')]),_0x2b5796);if(_0x4c49f7[_0x48d8('0x2c')][_0x48d8('0x39')]){_0x1775e4[_0x48d8('0x37')]=_['merge'](_0x1775e4[_0x48d8('0x37')],{'$or':_[_0x48d8('0x27')](_0x2b5796,function(_0x46bfea){if(_0x46bfea[_0x48d8('0x2a')]!==_0x48d8('0x3a')){var _0x150049={};_0x150049[_0x46bfea[_0x48d8('0x26')]]={'$like':'%'+_0x4c49f7[_0x48d8('0x2c')]['filter']+'%'};return _0x150049;}})});}_0x1775e4=_[_0x48d8('0x3b')]({},_0x1775e4,_0x4c49f7[_0x48d8('0x3c')]);var _0x2a7f83={'where':_0x1775e4[_0x48d8('0x37')]};return db[_0x48d8('0x3d')][_0x48d8('0x1e')](_0x2a7f83)['then'](function(_0x29083a){_0x6b58b7[_0x48d8('0x1e')]=_0x29083a;if(_0x4c49f7['query']['includeAll']){_0x1775e4[_0x48d8('0x3e')]=[{'all':!![]}];}return db[_0x48d8('0x3d')][_0x48d8('0x3f')](_0x1775e4);})[_0x48d8('0x23')](function(_0x4739e1){_0x6b58b7['rows']=_0x4739e1;return _0x6b58b7;})[_0x48d8('0x23')](respondWithFilteredResult(_0xcfa047,_0x1775e4))['catch'](handleError(_0xcfa047,null));};exports['show']=function(_0x1c7d6d,_0x5d49e1){var _0x2681dc={'raw':!![],'where':{'id':_0x1c7d6d['params']['id']}},_0x2f5cf5={};_0x2f5cf5[_0x48d8('0x2b')]=_[_0x48d8('0x2d')](db['SmsQueueReport']['rawAttributes']);_0x2f5cf5[_0x48d8('0x2c')]=_[_0x48d8('0x2d')](_0x1c7d6d[_0x48d8('0x2c')]);_0x2f5cf5[_0x48d8('0x2e')]=_[_0x48d8('0x2f')](_0x2f5cf5[_0x48d8('0x2b')],_0x2f5cf5[_0x48d8('0x2c')]);_0x2681dc[_0x48d8('0x30')]=_[_0x48d8('0x2f')](_0x2f5cf5[_0x48d8('0x2b')],qs[_0x48d8('0x31')](_0x1c7d6d[_0x48d8('0x2c')][_0x48d8('0x31')]));_0x2681dc['attributes']=_0x2681dc[_0x48d8('0x30')][_0x48d8('0x32')]?_0x2681dc['attributes']:_0x2f5cf5[_0x48d8('0x2b')];if(_0x1c7d6d[_0x48d8('0x2c')]['includeAll']){_0x2681dc[_0x48d8('0x3e')]=[{'all':!![]}];}_0x2681dc=_[_0x48d8('0x3b')]({},_0x2681dc,_0x1c7d6d['options']);return db['SmsQueueReport'][_0x48d8('0x40')](_0x2681dc)[_0x48d8('0x23')](handleEntityNotFound(_0x5d49e1,null))[_0x48d8('0x23')](respondWithResult(_0x5d49e1,null))[_0x48d8('0x41')](handleError(_0x5d49e1,null));};exports[_0x48d8('0x42')]=function(_0x5f37cf,_0x518cb7){return db[_0x48d8('0x3d')][_0x48d8('0x42')](_0x5f37cf['body'],{})[_0x48d8('0x23')](respondWithResult(_0x518cb7,0xc9))[_0x48d8('0x41')](handleError(_0x518cb7,null));};exports[_0x48d8('0x22')]=function(_0x180d89,_0x2ed0d9){if(_0x180d89['body']['id']){delete _0x180d89[_0x48d8('0x43')]['id'];}return db[_0x48d8('0x3d')][_0x48d8('0x40')]({'where':{'id':_0x180d89[_0x48d8('0x44')]['id']}})[_0x48d8('0x23')](handleEntityNotFound(_0x2ed0d9,null))['then'](saveUpdates(_0x180d89['body'],null))[_0x48d8('0x23')](respondWithResult(_0x2ed0d9,null))[_0x48d8('0x41')](handleError(_0x2ed0d9,null));};exports[_0x48d8('0x24')]=function(_0x3ec9de,_0x209ad1){return db['SmsQueueReport'][_0x48d8('0x40')]({'where':{'id':_0x3ec9de['params']['id']}})['then'](handleEntityNotFound(_0x209ad1,null))[_0x48d8('0x23')](removeEntity(_0x209ad1,null))[_0x48d8('0x41')](handleError(_0x209ad1,null));};exports['describe']=function(_0x11c554,_0x8c0520){return db[_0x48d8('0x3d')][_0x48d8('0x45')]()[_0x48d8('0x23')](respondWithResult(_0x8c0520,null))[_0x48d8('0x41')](handleError(_0x8c0520,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 85c3ff6..b62c919 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 _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5079cd,_0x5741f8){var _0xaadfa6=function(_0x49cd06){while(--_0x49cd06){_0x5079cd['push'](_0x5079cd['shift']());}};_0xaadfa6(++_0x5741f8);}(_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('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x329242,_0x501ac6){var _0x894e6c=function(_0x14e95f){while(--_0x14e95f){_0x329242['push'](_0x329242['shift']());}};_0x894e6c(++_0x501ac6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index bff0a44..21792dc 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 _0xae39=['result','catch','CreateSmsQueueReport','SmsQueueReport','body','options','raw','stringify','UpdateSmsQueueReport','where','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xae39,0x88));var _0x9ae3=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xae39[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x9ae3('0x0'));var moment=require(_0x9ae3('0x1'));var BPromise=require(_0x9ae3('0x2'));var rs=require(_0x9ae3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ae3('0x4'))['db'];var utils=require(_0x9ae3('0x5'));var logger=require(_0x9ae3('0x6'))(_0x9ae3('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9ae3('0x8')][_0x9ae3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55603a,_0x35d5aa,_0x8f484){return new BPromise(function(_0x5d7fde,_0x2a1df3){return client[_0x9ae3('0xa')](_0x55603a,_0x8f484)[_0x9ae3('0xb')](function(_0x27f864){logger[_0x9ae3('0xc')](_0x9ae3('0xd'),_0x35d5aa,_0x9ae3('0xe'));logger[_0x9ae3('0xf')](_0x9ae3('0x10'),_0x35d5aa,'request\x20sent',JSON['stringify'](_0x27f864));if(_0x27f864[_0x9ae3('0x11')]){if(_0x27f864[_0x9ae3('0x11')]['code']===0x1f4){logger[_0x9ae3('0x11')](_0x9ae3('0xd'),_0x35d5aa,_0x27f864[_0x9ae3('0x11')][_0x9ae3('0x12')]);return _0x2a1df3(_0x27f864[_0x9ae3('0x11')][_0x9ae3('0x12')]);}logger[_0x9ae3('0x11')](_0x9ae3('0xd'),_0x35d5aa,_0x27f864[_0x9ae3('0x11')]['message']);return _0x5d7fde(_0x27f864[_0x9ae3('0x11')][_0x9ae3('0x12')]);}else{logger['info'](_0x9ae3('0xd'),_0x35d5aa,'request\x20sent');_0x5d7fde(_0x27f864[_0x9ae3('0x13')][_0x9ae3('0x12')]);}})[_0x9ae3('0x14')](function(_0x117491){logger[_0x9ae3('0x11')](_0x9ae3('0xd'),_0x35d5aa,_0x117491);_0x2a1df3(_0x117491);});});}exports[_0x9ae3('0x15')]=function(_0x15d234){var _0x26f127=this;return new Promise(function(_0x287242,_0x57f39e){return db[_0x9ae3('0x16')]['create'](_0x15d234[_0x9ae3('0x17')],{'raw':_0x15d234[_0x9ae3('0x18')]?_0x15d234['options'][_0x9ae3('0x19')]===undefined?!![]:![]:!![]})[_0x9ae3('0xb')](function(_0x675b67){logger[_0x9ae3('0xc')]('CreateSmsQueueReport',_0x15d234);logger['debug'](_0x9ae3('0x15'),_0x15d234,JSON[_0x9ae3('0x1a')](_0x675b67));_0x287242(_0x675b67);})['catch'](function(_0x45de9b){logger[_0x9ae3('0x11')](_0x9ae3('0x15'),_0x45de9b[_0x9ae3('0x12')],_0x15d234);_0x57f39e(_0x26f127[_0x9ae3('0x11')](0x1f4,_0x45de9b[_0x9ae3('0x12')]));});});};exports[_0x9ae3('0x1b')]=function(_0x1b8f86){var _0x412407=this;return new Promise(function(_0xd97604,_0x3bd5fb){return db[_0x9ae3('0x16')]['update'](_0x1b8f86[_0x9ae3('0x17')],{'raw':_0x1b8f86[_0x9ae3('0x18')]?_0x1b8f86[_0x9ae3('0x18')][_0x9ae3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b8f86[_0x9ae3('0x18')]?_0x1b8f86[_0x9ae3('0x18')][_0x9ae3('0x1c')]||null:null,'attributes':_0x1b8f86[_0x9ae3('0x18')]?_0x1b8f86[_0x9ae3('0x18')][_0x9ae3('0x1d')]||null:null,'limit':_0x1b8f86[_0x9ae3('0x18')]?_0x1b8f86[_0x9ae3('0x18')][_0x9ae3('0x1e')]||null:null})[_0x9ae3('0xb')](function(_0x3fef45){logger[_0x9ae3('0xc')](_0x9ae3('0x1b'),_0x1b8f86);logger['debug'](_0x9ae3('0x1b'),_0x1b8f86,JSON[_0x9ae3('0x1a')](_0x3fef45));_0xd97604(_0x3fef45);})[_0x9ae3('0x14')](function(_0xd52b07){logger[_0x9ae3('0x11')](_0x9ae3('0x1b'),_0xd52b07['message'],_0x1b8f86);_0x3bd5fb(_0x412407[_0x9ae3('0x11')](0x1f4,_0xd52b07['message']));});});}; \ No newline at end of file +var _0xdd7b=['http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','create','options','raw','debug','UpdateSmsQueueReport','SmsQueueReport','update','body','where','attributes','limit','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1d9d5e,_0x5d582a){var _0x391428=function(_0x24b08e){while(--_0x24b08e){_0x1d9d5e['push'](_0x1d9d5e['shift']());}};_0x391428(++_0x5d582a);}(_0xdd7b,0x131));var _0xbdd7=function(_0x30dd03,_0x323c2b){_0x30dd03=_0x30dd03-0x0;var _0x259a9a=_0xdd7b[_0x30dd03];return _0x259a9a;};'use strict';var _=require(_0xbdd7('0x0'));var util=require('util');var moment=require(_0xbdd7('0x1'));var BPromise=require(_0xbdd7('0x2'));var rs=require(_0xbdd7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbdd7('0x4'));var logger=require(_0xbdd7('0x5'))(_0xbdd7('0x6'));var config=require(_0xbdd7('0x7'));var jayson=require(_0xbdd7('0x8'));var client=jayson[_0xbdd7('0x9')][_0xbdd7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x595f61,_0x377664,_0x415f04){return new BPromise(function(_0x2fe774,_0x3458b8){return client[_0xbdd7('0xb')](_0x595f61,_0x415f04)[_0xbdd7('0xc')](function(_0x257195){logger[_0xbdd7('0xd')](_0xbdd7('0xe'),_0x377664,_0xbdd7('0xf'));logger['debug'](_0xbdd7('0x10'),_0x377664,_0xbdd7('0xf'),JSON[_0xbdd7('0x11')](_0x257195));if(_0x257195[_0xbdd7('0x12')]){if(_0x257195['error'][_0xbdd7('0x13')]===0x1f4){logger['error'](_0xbdd7('0xe'),_0x377664,_0x257195[_0xbdd7('0x12')][_0xbdd7('0x14')]);return _0x3458b8(_0x257195[_0xbdd7('0x12')][_0xbdd7('0x14')]);}logger[_0xbdd7('0x12')](_0xbdd7('0xe'),_0x377664,_0x257195['error'][_0xbdd7('0x14')]);return _0x2fe774(_0x257195[_0xbdd7('0x12')][_0xbdd7('0x14')]);}else{logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x377664,_0xbdd7('0xf'));_0x2fe774(_0x257195[_0xbdd7('0x15')]['message']);}})[_0xbdd7('0x16')](function(_0x228f13){logger[_0xbdd7('0x12')](_0xbdd7('0xe'),_0x377664,_0x228f13);_0x3458b8(_0x228f13);});});}exports[_0xbdd7('0x17')]=function(_0x396e04){var _0x24e15a=this;return new Promise(function(_0x371af4,_0x1abb5b){return db['SmsQueueReport'][_0xbdd7('0x18')](_0x396e04['body'],{'raw':_0x396e04[_0xbdd7('0x19')]?_0x396e04[_0xbdd7('0x19')][_0xbdd7('0x1a')]===undefined?!![]:![]:!![]})[_0xbdd7('0xc')](function(_0x5f36c7){logger['info'](_0xbdd7('0x17'),_0x396e04);logger[_0xbdd7('0x1b')]('CreateSmsQueueReport',_0x396e04,JSON[_0xbdd7('0x11')](_0x5f36c7));_0x371af4(_0x5f36c7);})[_0xbdd7('0x16')](function(_0x9f4557){logger['error']('CreateSmsQueueReport',_0x9f4557[_0xbdd7('0x14')],_0x396e04);_0x1abb5b(_0x24e15a[_0xbdd7('0x12')](0x1f4,_0x9f4557[_0xbdd7('0x14')]));});});};exports[_0xbdd7('0x1c')]=function(_0x55d53b){var _0x2f7c7b=this;return new Promise(function(_0xbd7fb5,_0x5e349e){return db[_0xbdd7('0x1d')][_0xbdd7('0x1e')](_0x55d53b[_0xbdd7('0x1f')],{'raw':_0x55d53b[_0xbdd7('0x19')]?_0x55d53b[_0xbdd7('0x19')][_0xbdd7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55d53b[_0xbdd7('0x19')]?_0x55d53b['options'][_0xbdd7('0x20')]||null:null,'attributes':_0x55d53b[_0xbdd7('0x19')]?_0x55d53b[_0xbdd7('0x19')][_0xbdd7('0x21')]||null:null,'limit':_0x55d53b[_0xbdd7('0x19')]?_0x55d53b['options'][_0xbdd7('0x22')]||null:null})['then'](function(_0x1f74c6){logger['info'](_0xbdd7('0x1c'),_0x55d53b);logger[_0xbdd7('0x1b')]('UpdateSmsQueueReport',_0x55d53b,JSON[_0xbdd7('0x11')](_0x1f74c6));_0xbd7fb5(_0x1f74c6);})[_0xbdd7('0x16')](function(_0x42b869){logger[_0xbdd7('0x12')](_0xbdd7('0x1c'),_0x42b869[_0xbdd7('0x14')],_0x55d53b);_0x5e349e(_0x2f7c7b[_0xbdd7('0x12')](0x1f4,_0x42b869[_0xbdd7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index d445ad8..cd40b16 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 _0x6c7b=['./smsTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','update','delete','destroy','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x2b354b,_0x20e157){_0x2b354b=_0x2b354b-0x0;var _0x13e924=_0x6c7b[_0x2b354b];return _0x13e924;};'use strict';var multer=require(_0xb6c7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb6c7('0x1'));var router=express['Router']();var fs_extra=require(_0xb6c7('0x2'));var auth=require(_0xb6c7('0x3'));var interaction=require(_0xb6c7('0x4'));var config=require('../../config/environment');var controller=require(_0xb6c7('0x5'));router[_0xb6c7('0x6')]('/',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x8')]);router[_0xb6c7('0x6')]('/describe',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x9')]);router[_0xb6c7('0x6')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xb')]);router[_0xb6c7('0xc')]('/',auth[_0xb6c7('0x7')](),controller['create']);router['put'](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xd')]);router[_0xb6c7('0xe')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe0ae=['exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','index','get','/describe','isAuthenticated','show','post','put','/:id','update'];(function(_0x7bd49d,_0x90c058){var _0x4f5b47=function(_0x332fbb){while(--_0x332fbb){_0x7bd49d['push'](_0x7bd49d['shift']());}};_0x4f5b47(++_0x90c058);}(_0xe0ae,0xa1));var _0xee0a=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0xe0ae[_0x3aeb36];return _0xa2ef21;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0a('0x0'));var timeout=require(_0xee0a('0x1'));var express=require('express');var router=express[_0xee0a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xee0a('0x3'));var interaction=require(_0xee0a('0x4'));var config=require('../../config/environment');var controller=require(_0xee0a('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xee0a('0x6')]);router[_0xee0a('0x7')](_0xee0a('0x8'),auth[_0xee0a('0x9')](),controller['describe']);router[_0xee0a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xee0a('0xa')]);router[_0xee0a('0xb')]('/',auth[_0xee0a('0x9')](),controller['create']);router[_0xee0a('0xc')](_0xee0a('0xd'),auth['isAuthenticated'](),controller[_0xee0a('0xe')]);router['delete'](_0xee0a('0xd'),auth[_0xee0a('0x9')](),controller['destroy']);module[_0xee0a('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index fe5cb6f..90cc003 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x12d573,_0x20ae28){var _0x5c7071=function(_0x16ea02){while(--_0x16ea02){_0x12d573['push'](_0x12d573['shift']());}};_0x5c7071(++_0x20ae28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x4dc8c6,_0x3fba52){var _0x69ce1d=function(_0x1a726d){while(--_0x1a726d){_0x4dc8c6['push'](_0x4dc8c6['shift']());}};_0x69ce1d(++_0x3fba52);}(_0x54ef,0x112));var _0xf54e=function(_0x4e9a82,_0x13dd82){_0x4e9a82=_0x4e9a82-0x0;var _0xd05003=_0x54ef[_0x4e9a82];return _0xd05003;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index faf8a7c..19f9e91 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 _0x1bb1=['map','SmsTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','catch','show','params','length','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index'];(function(_0x3f9c5d,_0x12bfde){var _0x238e59=function(_0x51940e){while(--_0x51940e){_0x3f9c5d['push'](_0x3f9c5d['shift']());}};_0x238e59(++_0x12bfde);}(_0x1bb1,0x156));var _0x11bb=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x1bb1[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0x11bb('0x0'));var rimraf=require(_0x11bb('0x1'));var zipdir=require(_0x11bb('0x2'));var jsonpatch=require(_0x11bb('0x3'));var rp=require('request-promise');var moment=require(_0x11bb('0x4'));var BPromise=require(_0x11bb('0x5'));var Mustache=require('mustache');var util=require(_0x11bb('0x6'));var path=require('path');var sox=require(_0x11bb('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x11bb('0x8'));var _=require(_0x11bb('0x9'));var squel=require(_0x11bb('0xa'));var crypto=require('crypto');var jsforce=require(_0x11bb('0xb'));var deskjs=require(_0x11bb('0xc'));var toCsv=require(_0x11bb('0xd'));var querystring=require(_0x11bb('0xe'));var Papa=require(_0x11bb('0xf'));var Redis=require(_0x11bb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x11bb('0x11'));var as=require(_0x11bb('0x12'));var hardwareService=require(_0x11bb('0x13'));var logger=require(_0x11bb('0x14'))(_0x11bb('0x15'));var utils=require(_0x11bb('0x16'));var config=require(_0x11bb('0x17'));var licenseUtil=require(_0x11bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x572624,_0x1e39b7){_0x1e39b7=_0x1e39b7||0xcc;return function(_0x4924f0){if(_0x4924f0){return _0x572624[_0x11bb('0x19')](_0x1e39b7);}return _0x572624['status'](_0x1e39b7)[_0x11bb('0x1a')]();};}function respondWithResult(_0x43c3f3,_0x339ee8){_0x339ee8=_0x339ee8||0xc8;return function(_0x56c126){if(_0x56c126){return _0x43c3f3[_0x11bb('0x1b')](_0x339ee8)['json'](_0x56c126);}};}function respondWithFilteredResult(_0x11feb1,_0x50c62a){return function(_0x117edc){if(_0x117edc){var _0x1d5664=typeof _0x50c62a[_0x11bb('0x1c')]===_0x11bb('0x1d')&&typeof _0x50c62a[_0x11bb('0x1e')]===_0x11bb('0x1d');var _0x11b655=_0x117edc[_0x11bb('0x1f')];var _0x54d3fb=_0x1d5664?0x0:_0x50c62a[_0x11bb('0x1c')];var _0x5118a3=_0x1d5664?_0x117edc['count']:_0x50c62a[_0x11bb('0x1c')]+_0x50c62a['limit'];var _0x29c75f;if(_0x5118a3>=_0x11b655){_0x5118a3=_0x11b655;_0x29c75f=0xc8;}else{_0x29c75f=0xce;}_0x11feb1['status'](_0x29c75f);return _0x11feb1[_0x11bb('0x20')]('Content-Range',_0x54d3fb+'-'+_0x5118a3+'/'+_0x11b655)['json'](_0x117edc);}return null;};}function patchUpdates(_0x1133ef){return function(_0x46502f){try{jsonpatch[_0x11bb('0x21')](_0x46502f,_0x1133ef,!![]);}catch(_0x2529b0){return BPromise[_0x11bb('0x22')](_0x2529b0);}return _0x46502f[_0x11bb('0x23')]();};}function saveUpdates(_0x89c0cb,_0x336ad0){return function(_0x4e1ab4){if(_0x4e1ab4){return _0x4e1ab4[_0x11bb('0x24')](_0x89c0cb)[_0x11bb('0x25')](function(_0x592123){return _0x592123;});}return null;};}function removeEntity(_0x1d8769,_0x38db2a){return function(_0x244849){if(_0x244849){return _0x244849['destroy']()[_0x11bb('0x25')](function(){_0x1d8769[_0x11bb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x190c5e,_0xb56dff){return function(_0x4e421a){if(!_0x4e421a){_0x190c5e[_0x11bb('0x19')](0x194);}return _0x4e421a;};}function handleError(_0x1ce4bf,_0x2da7fb){_0x2da7fb=_0x2da7fb||0x1f4;return function(_0x234898){logger[_0x11bb('0x26')](_0x234898[_0x11bb('0x27')]);if(_0x234898[_0x11bb('0x28')]){delete _0x234898[_0x11bb('0x28')];}_0x1ce4bf['status'](_0x2da7fb)[_0x11bb('0x29')](_0x234898);};}exports[_0x11bb('0x2a')]=function(_0x3153c4,_0x749e43){var _0x44f211={},_0x62ec7f={},_0x349d86={'count':0x0,'rows':[]};var _0x3857a6=_[_0x11bb('0x2b')](db[_0x11bb('0x2c')][_0x11bb('0x2d')],function(_0x3b389e){return{'name':_0x3b389e[_0x11bb('0x2e')],'type':_0x3b389e['type'][_0x11bb('0x2f')]};});_0x62ec7f[_0x11bb('0x30')]=_[_0x11bb('0x2b')](_0x3857a6,'name');_0x62ec7f[_0x11bb('0x31')]=_[_0x11bb('0x32')](_0x3153c4[_0x11bb('0x31')]);_0x62ec7f[_0x11bb('0x33')]=_[_0x11bb('0x34')](_0x62ec7f[_0x11bb('0x30')],_0x62ec7f['query']);_0x44f211['attributes']=_[_0x11bb('0x34')](_0x62ec7f[_0x11bb('0x30')],qs[_0x11bb('0x35')](_0x3153c4[_0x11bb('0x31')][_0x11bb('0x35')]));_0x44f211['attributes']=_0x44f211[_0x11bb('0x36')]['length']?_0x44f211['attributes']:_0x62ec7f[_0x11bb('0x30')];if(!_0x3153c4[_0x11bb('0x31')][_0x11bb('0x37')](_0x11bb('0x38'))){_0x44f211[_0x11bb('0x1e')]=qs[_0x11bb('0x1e')](_0x3153c4['query'][_0x11bb('0x1e')]);_0x44f211[_0x11bb('0x1c')]=qs[_0x11bb('0x1c')](_0x3153c4[_0x11bb('0x31')]['offset']);}_0x44f211[_0x11bb('0x39')]=qs[_0x11bb('0x3a')](_0x3153c4['query'][_0x11bb('0x3a')]);_0x44f211[_0x11bb('0x3b')]=qs['filters'](_[_0x11bb('0x3c')](_0x3153c4['query'],_0x62ec7f[_0x11bb('0x33')]),_0x3857a6);if(_0x3153c4[_0x11bb('0x31')][_0x11bb('0x3d')]){_0x44f211[_0x11bb('0x3b')]=_['merge'](_0x44f211[_0x11bb('0x3b')],{'$or':_[_0x11bb('0x2b')](_0x3857a6,function(_0x13e49f){if(_0x13e49f[_0x11bb('0x3e')]!==_0x11bb('0x3f')){var _0x2b2a54={};_0x2b2a54[_0x13e49f['name']]={'$like':'%'+_0x3153c4[_0x11bb('0x31')][_0x11bb('0x3d')]+'%'};return _0x2b2a54;}})});}_0x44f211=_[_0x11bb('0x40')]({},_0x44f211,_0x3153c4[_0x11bb('0x41')]);var _0x50e7f4={'where':_0x44f211[_0x11bb('0x3b')]};return db[_0x11bb('0x2c')][_0x11bb('0x1f')](_0x50e7f4)[_0x11bb('0x25')](function(_0x30aee9){_0x349d86[_0x11bb('0x1f')]=_0x30aee9;if(_0x3153c4[_0x11bb('0x31')][_0x11bb('0x42')]){_0x44f211['include']=[{'all':!![]}];}return db[_0x11bb('0x2c')]['findAll'](_0x44f211);})['then'](function(_0x35f2dc){_0x349d86['rows']=_0x35f2dc;return _0x349d86;})['then'](respondWithFilteredResult(_0x749e43,_0x44f211))[_0x11bb('0x43')](handleError(_0x749e43,null));};exports[_0x11bb('0x44')]=function(_0x19a341,_0x53a58a){var _0x2a219c={'raw':!![],'where':{'id':_0x19a341[_0x11bb('0x45')]['id']}},_0x2fea13={};_0x2fea13[_0x11bb('0x30')]=_[_0x11bb('0x32')](db[_0x11bb('0x2c')][_0x11bb('0x2d')]);_0x2fea13[_0x11bb('0x31')]=_['keys'](_0x19a341[_0x11bb('0x31')]);_0x2fea13['filters']=_[_0x11bb('0x34')](_0x2fea13[_0x11bb('0x30')],_0x2fea13[_0x11bb('0x31')]);_0x2a219c[_0x11bb('0x36')]=_[_0x11bb('0x34')](_0x2fea13[_0x11bb('0x30')],qs['fields'](_0x19a341[_0x11bb('0x31')][_0x11bb('0x35')]));_0x2a219c[_0x11bb('0x36')]=_0x2a219c[_0x11bb('0x36')][_0x11bb('0x46')]?_0x2a219c[_0x11bb('0x36')]:_0x2fea13[_0x11bb('0x30')];if(_0x19a341[_0x11bb('0x31')]['includeAll']){_0x2a219c[_0x11bb('0x47')]=[{'all':!![]}];}_0x2a219c=_[_0x11bb('0x40')]({},_0x2a219c,_0x19a341['options']);return db['SmsTransferReport'][_0x11bb('0x48')](_0x2a219c)[_0x11bb('0x25')](handleEntityNotFound(_0x53a58a,null))[_0x11bb('0x25')](respondWithResult(_0x53a58a,null))[_0x11bb('0x43')](handleError(_0x53a58a,null));};exports[_0x11bb('0x49')]=function(_0x4a7ba0,_0x2e0fd8){return db[_0x11bb('0x2c')]['create'](_0x4a7ba0[_0x11bb('0x4a')],{})[_0x11bb('0x25')](respondWithResult(_0x2e0fd8,0xc9))[_0x11bb('0x43')](handleError(_0x2e0fd8,null));};exports[_0x11bb('0x24')]=function(_0x5e84a0,_0x3e8f30){if(_0x5e84a0['body']['id']){delete _0x5e84a0[_0x11bb('0x4a')]['id'];}return db[_0x11bb('0x2c')]['find']({'where':{'id':_0x5e84a0[_0x11bb('0x45')]['id']}})['then'](handleEntityNotFound(_0x3e8f30,null))[_0x11bb('0x25')](saveUpdates(_0x5e84a0[_0x11bb('0x4a')],null))[_0x11bb('0x25')](respondWithResult(_0x3e8f30,null))[_0x11bb('0x43')](handleError(_0x3e8f30,null));};exports[_0x11bb('0x4b')]=function(_0xe11163,_0x4e1647){return db['SmsTransferReport'][_0x11bb('0x48')]({'where':{'id':_0xe11163[_0x11bb('0x45')]['id']}})[_0x11bb('0x25')](handleEntityNotFound(_0x4e1647,null))['then'](removeEntity(_0x4e1647,null))[_0x11bb('0x43')](handleError(_0x4e1647,null));};exports['describe']=function(_0x1067c0,_0x5dafbe){return db['SmsTransferReport'][_0x11bb('0x4c')]()[_0x11bb('0x25')](respondWithResult(_0x5dafbe,null))['catch'](handleError(_0x5dafbe,null));}; \ No newline at end of file +var _0x6868=['find','create','body','describe','eml-format','rimraf','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','SmsTransferReport','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','rawAttributes','options'];(function(_0x3a3c17,_0x5b7b7e){var _0xd07f21=function(_0xeaad44){while(--_0xeaad44){_0x3a3c17['push'](_0x3a3c17['shift']());}};_0xd07f21(++_0x5b7b7e);}(_0x6868,0x90));var _0x8686=function(_0x19d0d5,_0x478107){_0x19d0d5=_0x19d0d5-0x0;var _0x32f8cd=_0x6868[_0x19d0d5];return _0x32f8cd;};'use strict';var emlformat=require(_0x8686('0x0'));var rimraf=require(_0x8686('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8686('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8686('0x3'));var util=require(_0x8686('0x4'));var path=require('path');var sox=require(_0x8686('0x5'));var csv=require(_0x8686('0x6'));var ejs=require(_0x8686('0x7'));var fs=require('fs');var fs_extra=require(_0x8686('0x8'));var _=require('lodash');var squel=require(_0x8686('0x9'));var crypto=require(_0x8686('0xa'));var jsforce=require(_0x8686('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8686('0x6'));var querystring=require(_0x8686('0xc'));var Papa=require(_0x8686('0xd'));var Redis=require('ioredis');var authService=require(_0x8686('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8686('0xf'));var hardwareService=require(_0x8686('0x10'));var logger=require(_0x8686('0x11'))(_0x8686('0x12'));var utils=require('../../config/utils');var config=require(_0x8686('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b6076,_0x1ea71f){_0x1ea71f=_0x1ea71f||0xcc;return function(_0x5a7100){if(_0x5a7100){return _0x3b6076[_0x8686('0x14')](_0x1ea71f);}return _0x3b6076[_0x8686('0x15')](_0x1ea71f)[_0x8686('0x16')]();};}function respondWithResult(_0x4f4c12,_0x181312){_0x181312=_0x181312||0xc8;return function(_0x1cfbb3){if(_0x1cfbb3){return _0x4f4c12[_0x8686('0x15')](_0x181312)[_0x8686('0x17')](_0x1cfbb3);}};}function respondWithFilteredResult(_0x1d1927,_0x2b16ab){return function(_0x7c94d4){if(_0x7c94d4){var _0x301aaa=typeof _0x2b16ab['offset']==='undefined'&&typeof _0x2b16ab[_0x8686('0x18')]==='undefined';var _0x45533b=_0x7c94d4[_0x8686('0x19')];var _0x3397eb=_0x301aaa?0x0:_0x2b16ab['offset'];var _0x263e64=_0x301aaa?_0x7c94d4[_0x8686('0x19')]:_0x2b16ab[_0x8686('0x1a')]+_0x2b16ab[_0x8686('0x18')];var _0x491a37;if(_0x263e64>=_0x45533b){_0x263e64=_0x45533b;_0x491a37=0xc8;}else{_0x491a37=0xce;}_0x1d1927[_0x8686('0x15')](_0x491a37);return _0x1d1927['set'](_0x8686('0x1b'),_0x3397eb+'-'+_0x263e64+'/'+_0x45533b)[_0x8686('0x17')](_0x7c94d4);}return null;};}function patchUpdates(_0x5beeb7){return function(_0x19ad0d){try{jsonpatch[_0x8686('0x1c')](_0x19ad0d,_0x5beeb7,!![]);}catch(_0x3afd00){return BPromise['reject'](_0x3afd00);}return _0x19ad0d[_0x8686('0x1d')]();};}function saveUpdates(_0x4b2fd3,_0x428922){return function(_0x4a2faf){if(_0x4a2faf){return _0x4a2faf[_0x8686('0x1e')](_0x4b2fd3)[_0x8686('0x1f')](function(_0x5ca7ca){return _0x5ca7ca;});}return null;};}function removeEntity(_0x92a1f0,_0x3605bd){return function(_0x2f0ed9){if(_0x2f0ed9){return _0x2f0ed9[_0x8686('0x20')]()[_0x8686('0x1f')](function(){_0x92a1f0[_0x8686('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58e11e,_0x4cdbf9){return function(_0x29c5a4){if(!_0x29c5a4){_0x58e11e[_0x8686('0x14')](0x194);}return _0x29c5a4;};}function handleError(_0x2f7a7f,_0xc5d08d){_0xc5d08d=_0xc5d08d||0x1f4;return function(_0x56c53e){logger[_0x8686('0x21')](_0x56c53e[_0x8686('0x22')]);if(_0x56c53e['name']){delete _0x56c53e[_0x8686('0x23')];}_0x2f7a7f[_0x8686('0x15')](_0xc5d08d)[_0x8686('0x24')](_0x56c53e);};}exports['index']=function(_0x383722,_0x3d85cb){var _0x1237e5={},_0x578d7d={},_0x1d2cc4={'count':0x0,'rows':[]};var _0x571636=_[_0x8686('0x25')](db[_0x8686('0x26')]['rawAttributes'],function(_0x50a2d5){return{'name':_0x50a2d5[_0x8686('0x27')],'type':_0x50a2d5['type']['key']};});_0x578d7d[_0x8686('0x28')]=_[_0x8686('0x25')](_0x571636,_0x8686('0x23'));_0x578d7d[_0x8686('0x29')]=_[_0x8686('0x2a')](_0x383722[_0x8686('0x29')]);_0x578d7d['filters']=_[_0x8686('0x2b')](_0x578d7d[_0x8686('0x28')],_0x578d7d[_0x8686('0x29')]);_0x1237e5[_0x8686('0x2c')]=_[_0x8686('0x2b')](_0x578d7d[_0x8686('0x28')],qs[_0x8686('0x2d')](_0x383722['query'][_0x8686('0x2d')]));_0x1237e5[_0x8686('0x2c')]=_0x1237e5[_0x8686('0x2c')][_0x8686('0x2e')]?_0x1237e5[_0x8686('0x2c')]:_0x578d7d['model'];if(!_0x383722[_0x8686('0x29')][_0x8686('0x2f')](_0x8686('0x30'))){_0x1237e5[_0x8686('0x18')]=qs[_0x8686('0x18')](_0x383722[_0x8686('0x29')][_0x8686('0x18')]);_0x1237e5[_0x8686('0x1a')]=qs['offset'](_0x383722['query'][_0x8686('0x1a')]);}_0x1237e5[_0x8686('0x31')]=qs[_0x8686('0x32')](_0x383722[_0x8686('0x29')][_0x8686('0x32')]);_0x1237e5[_0x8686('0x33')]=qs[_0x8686('0x34')](_[_0x8686('0x35')](_0x383722['query'],_0x578d7d['filters']),_0x571636);if(_0x383722[_0x8686('0x29')][_0x8686('0x36')]){_0x1237e5[_0x8686('0x33')]=_[_0x8686('0x37')](_0x1237e5[_0x8686('0x33')],{'$or':_[_0x8686('0x25')](_0x571636,function(_0x1d0b34){if(_0x1d0b34[_0x8686('0x38')]!==_0x8686('0x39')){var _0x19c127={};_0x19c127[_0x1d0b34[_0x8686('0x23')]]={'$like':'%'+_0x383722['query'][_0x8686('0x36')]+'%'};return _0x19c127;}})});}_0x1237e5=_[_0x8686('0x37')]({},_0x1237e5,_0x383722['options']);var _0x39d19e={'where':_0x1237e5[_0x8686('0x33')]};return db[_0x8686('0x26')][_0x8686('0x19')](_0x39d19e)[_0x8686('0x1f')](function(_0x242b9c){_0x1d2cc4[_0x8686('0x19')]=_0x242b9c;if(_0x383722[_0x8686('0x29')][_0x8686('0x3a')]){_0x1237e5[_0x8686('0x3b')]=[{'all':!![]}];}return db[_0x8686('0x26')]['findAll'](_0x1237e5);})[_0x8686('0x1f')](function(_0x37ee99){_0x1d2cc4[_0x8686('0x3c')]=_0x37ee99;return _0x1d2cc4;})[_0x8686('0x1f')](respondWithFilteredResult(_0x3d85cb,_0x1237e5))[_0x8686('0x3d')](handleError(_0x3d85cb,null));};exports[_0x8686('0x3e')]=function(_0x4bc2ef,_0x3ec724){var _0x4b6a39={'raw':!![],'where':{'id':_0x4bc2ef[_0x8686('0x3f')]['id']}},_0x264675={};_0x264675[_0x8686('0x28')]=_[_0x8686('0x2a')](db['SmsTransferReport'][_0x8686('0x40')]);_0x264675[_0x8686('0x29')]=_[_0x8686('0x2a')](_0x4bc2ef[_0x8686('0x29')]);_0x264675['filters']=_[_0x8686('0x2b')](_0x264675[_0x8686('0x28')],_0x264675['query']);_0x4b6a39['attributes']=_[_0x8686('0x2b')](_0x264675['model'],qs[_0x8686('0x2d')](_0x4bc2ef[_0x8686('0x29')]['fields']));_0x4b6a39[_0x8686('0x2c')]=_0x4b6a39[_0x8686('0x2c')]['length']?_0x4b6a39['attributes']:_0x264675['model'];if(_0x4bc2ef[_0x8686('0x29')]['includeAll']){_0x4b6a39['include']=[{'all':!![]}];}_0x4b6a39=_[_0x8686('0x37')]({},_0x4b6a39,_0x4bc2ef[_0x8686('0x41')]);return db['SmsTransferReport'][_0x8686('0x42')](_0x4b6a39)['then'](handleEntityNotFound(_0x3ec724,null))[_0x8686('0x1f')](respondWithResult(_0x3ec724,null))[_0x8686('0x3d')](handleError(_0x3ec724,null));};exports[_0x8686('0x43')]=function(_0x506b64,_0x412ec2){return db[_0x8686('0x26')][_0x8686('0x43')](_0x506b64[_0x8686('0x44')],{})[_0x8686('0x1f')](respondWithResult(_0x412ec2,0xc9))['catch'](handleError(_0x412ec2,null));};exports[_0x8686('0x1e')]=function(_0x3a73ef,_0x611b22){if(_0x3a73ef['body']['id']){delete _0x3a73ef[_0x8686('0x44')]['id'];}return db[_0x8686('0x26')][_0x8686('0x42')]({'where':{'id':_0x3a73ef[_0x8686('0x3f')]['id']}})[_0x8686('0x1f')](handleEntityNotFound(_0x611b22,null))[_0x8686('0x1f')](saveUpdates(_0x3a73ef[_0x8686('0x44')],null))[_0x8686('0x1f')](respondWithResult(_0x611b22,null))[_0x8686('0x3d')](handleError(_0x611b22,null));};exports['destroy']=function(_0x45a2e1,_0x487668){return db['SmsTransferReport'][_0x8686('0x42')]({'where':{'id':_0x45a2e1[_0x8686('0x3f')]['id']}})[_0x8686('0x1f')](handleEntityNotFound(_0x487668,null))[_0x8686('0x1f')](removeEntity(_0x487668,null))['catch'](handleError(_0x487668,null));};exports[_0x8686('0x45')]=function(_0x4fe3c7,_0x45e7f0){return db[_0x8686('0x26')][_0x8686('0x45')]()['then'](respondWithResult(_0x45e7f0,null))[_0x8686('0x3d')](handleError(_0x45e7f0,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index aad8767..c493b35 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 _0xd04b=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd04b,0x145));var _0xbd04=function(_0x493990,_0x598136){_0x493990=_0x493990-0x0;var _0x430a3e=_0xd04b[_0x493990];return _0x430a3e;};'use strict';var _=require(_0xbd04('0x0'));var util=require(_0xbd04('0x1'));var logger=require(_0xbd04('0x2'))('api');var moment=require(_0xbd04('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd04('0x4'));var fs=require('fs');var path=require(_0xbd04('0x5'));var rimraf=require(_0xbd04('0x6'));var config=require(_0xbd04('0x7'));var attributes=require(_0xbd04('0x8'));module[_0xbd04('0x9')]=function(_0x11d6ce,_0x2d8811){return _0x11d6ce[_0xbd04('0xa')](_0xbd04('0xb'),attributes,{'tableName':_0xbd04('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbd04('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfe3f=['path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','util','bluebird','request-promise'];(function(_0x1cadda,_0x3f569f){var _0x43c5a3=function(_0x2deb2c){while(--_0x2deb2c){_0x1cadda['push'](_0x1cadda['shift']());}};_0x43c5a3(++_0x3f569f);}(_0xfe3f,0x194));var _0xffe3=function(_0x481006,_0x21c63f){_0x481006=_0x481006-0x0;var _0x549da2=_0xfe3f[_0x481006];return _0x549da2;};'use strict';var _=require(_0xffe3('0x0'));var util=require(_0xffe3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xffe3('0x2'));var rp=require(_0xffe3('0x3'));var fs=require('fs');var path=require(_0xffe3('0x4'));var rimraf=require(_0xffe3('0x5'));var config=require(_0xffe3('0x6'));var attributes=require(_0xffe3('0x7'));module[_0xffe3('0x8')]=function(_0x316acf,_0x46f6f9){return _0x316acf[_0xffe3('0x9')](_0xffe3('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xffe3('0xb'),'fields':[_0xffe3('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 404ee6d..adfbd69 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 _0x3036=['moment','bluebird','randomstring','../../mysqldb','../../config/environment','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x22ada8,_0x23a7ea){var _0x506e36=function(_0xd6ed10){while(--_0xd6ed10){_0x22ada8['push'](_0x22ada8['shift']());}};_0x506e36(++_0x23a7ea);}(_0x3036,0x1a9));var _0x6303=function(_0x5f49f1,_0x73d934){_0x5f49f1=_0x5f49f1-0x0;var _0x5ecac3=_0x3036[_0x5f49f1];return _0x5ecac3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6303('0x0'));var BPromise=require(_0x6303('0x1'));var rs=require(_0x6303('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6303('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6303('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x6303('0x5')][_0x6303('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x25a0ce,_0x48c936,_0x8a0038){return new BPromise(function(_0x420da8,_0x2e2be8){return client[_0x6303('0x7')](_0x25a0ce,_0x8a0038)[_0x6303('0x8')](function(_0x2684ac){logger[_0x6303('0x9')](_0x6303('0xa'),_0x48c936,_0x6303('0xb'));logger['debug'](_0x6303('0xc'),_0x48c936,_0x6303('0xb'),JSON[_0x6303('0xd')](_0x2684ac));if(_0x2684ac[_0x6303('0xe')]){if(_0x2684ac[_0x6303('0xe')]['code']===0x1f4){logger[_0x6303('0xe')](_0x6303('0xa'),_0x48c936,_0x2684ac[_0x6303('0xe')][_0x6303('0xf')]);return _0x2e2be8(_0x2684ac[_0x6303('0xe')]['message']);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x48c936,_0x2684ac[_0x6303('0xe')][_0x6303('0xf')]);return _0x420da8(_0x2684ac[_0x6303('0xe')][_0x6303('0xf')]);}else{logger[_0x6303('0x9')](_0x6303('0xa'),_0x48c936,_0x6303('0xb'));_0x420da8(_0x2684ac[_0x6303('0x10')][_0x6303('0xf')]);}})['catch'](function(_0x50a19c){logger[_0x6303('0xe')](_0x6303('0xa'),_0x48c936,_0x50a19c);_0x2e2be8(_0x50a19c);});});} \ No newline at end of file +var _0xf767=['debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SmsTransferReport,\x20%s,\x20%s'];(function(_0x1edf37,_0xd7c2fd){var _0x4d6ac9=function(_0x25977d){while(--_0x25977d){_0x1edf37['push'](_0x1edf37['shift']());}};_0x4d6ac9(++_0xd7c2fd);}(_0xf767,0x76));var _0x7f76=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0xf767[_0x2932cf];return _0x1711dd;};'use strict';var _=require('lodash');var util=require(_0x7f76('0x0'));var moment=require(_0x7f76('0x1'));var BPromise=require(_0x7f76('0x2'));var rs=require(_0x7f76('0x3'));var fs=require('fs');var Redis=require(_0x7f76('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f76('0x5'));var logger=require(_0x7f76('0x6'))(_0x7f76('0x7'));var config=require(_0x7f76('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7f76('0x9')][_0x7f76('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45ddcc,_0x1eeb08,_0x1fc46c){return new BPromise(function(_0x5acfee,_0x8b5dce){return client[_0x7f76('0xb')](_0x45ddcc,_0x1fc46c)[_0x7f76('0xc')](function(_0x15dcd9){logger['info'](_0x7f76('0xd'),_0x1eeb08,'request\x20sent');logger[_0x7f76('0xe')](_0x7f76('0xf'),_0x1eeb08,_0x7f76('0x10'),JSON[_0x7f76('0x11')](_0x15dcd9));if(_0x15dcd9[_0x7f76('0x12')]){if(_0x15dcd9[_0x7f76('0x12')]['code']===0x1f4){logger[_0x7f76('0x12')](_0x7f76('0xd'),_0x1eeb08,_0x15dcd9[_0x7f76('0x12')][_0x7f76('0x13')]);return _0x8b5dce(_0x15dcd9[_0x7f76('0x12')]['message']);}logger[_0x7f76('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x1eeb08,_0x15dcd9[_0x7f76('0x12')][_0x7f76('0x13')]);return _0x5acfee(_0x15dcd9['error']['message']);}else{logger['info'](_0x7f76('0xd'),_0x1eeb08,_0x7f76('0x10'));_0x5acfee(_0x15dcd9[_0x7f76('0x14')]['message']);}})[_0x7f76('0x15')](function(_0x522a2c){logger[_0x7f76('0x12')](_0x7f76('0xd'),_0x1eeb08,_0x522a2c);_0x8b5dce(_0x522a2c);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 0b0d0a4..c3adda3 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 _0x1082=['post','single','file','create','put','update','delete','path','Router','fs-extra','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','/:id/download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','now'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1082,0x19c));var _0x2108=function(_0x1f5300,_0x3b60d0){_0x1f5300=_0x1f5300-0x0;var _0x27abea=_0x1082[_0x1f5300];return _0x27abea;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2108('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2108('0x1')]();var fs_extra=require(_0x2108('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2108('0x3'));var controller=require(_0x2108('0x4'));router['get']('/',auth[_0x2108('0x5')](),controller[_0x2108('0x6')]);router[_0x2108('0x7')](_0x2108('0x8'),auth[_0x2108('0x5')](),controller['show']);router[_0x2108('0x7')](_0x2108('0x9'),auth[_0x2108('0x5')](),controller['download']);var upload=multer({'storage':multer[_0x2108('0xa')]({'destination':function(_0x3147ae,_0x40e885,_0x43171c){_0x43171c(null,path[_0x2108('0xb')](config[_0x2108('0xc')],_0x2108('0xd')));},'filename':function(_0x48c680,_0x105c4d,_0x376a62){_0x105c4d[_0x2108('0xe')]=_0x105c4d[_0x2108('0xe')][_0x2108('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x376a62(null,util['format'](_0x2108('0x10'),path[_0x2108('0x11')](_0x105c4d[_0x2108('0xe')],path[_0x2108('0x12')](_0x105c4d['originalname'])),Date[_0x2108('0x13')](),path[_0x2108('0x12')](_0x105c4d['originalname'])));}})});router[_0x2108('0x14')]('/',upload[_0x2108('0x15')](_0x2108('0x16')),controller[_0x2108('0x17')]);router[_0x2108('0x18')](_0x2108('0x8'),auth[_0x2108('0x5')](),controller[_0x2108('0x19')]);router[_0x2108('0x1a')]('/:id',auth[_0x2108('0x5')](),controller[_0x2108('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xbe70=['express','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','index','isAuthenticated','show','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','single','put','/:id','delete','exports','multer','util','connect-timeout'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0xbe70,0xc8));var _0x0be7=function(_0xb1c8ac,_0x1c3acb){_0xb1c8ac=_0xb1c8ac-0x0;var _0xc0b537=_0xbe70[_0xb1c8ac];return _0xc0b537;};'use strict';var multer=require(_0x0be7('0x0'));var util=require(_0x0be7('0x1'));var path=require('path');var timeout=require(_0x0be7('0x2'));var express=require(_0x0be7('0x3'));var router=express['Router']();var fs_extra=require(_0x0be7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0be7('0x5'));var config=require(_0x0be7('0x6'));var controller=require(_0x0be7('0x7'));router[_0x0be7('0x8')]('/',auth['isAuthenticated'](),controller[_0x0be7('0x9')]);router[_0x0be7('0x8')]('/:id',auth[_0x0be7('0xa')](),controller[_0x0be7('0xb')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x0be7('0xc')]);var upload=multer({'storage':multer[_0x0be7('0xd')]({'destination':function(_0x3180f7,_0x2af24e,_0x76aeb4){_0x76aeb4(null,path[_0x0be7('0xe')](config[_0x0be7('0xf')],_0x0be7('0x10')));},'filename':function(_0x46847c,_0x4a5403,_0x3e03f8){_0x4a5403[_0x0be7('0x11')]=_0x4a5403['originalname'][_0x0be7('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e03f8(null,util[_0x0be7('0x13')](_0x0be7('0x14'),path[_0x0be7('0x15')](_0x4a5403[_0x0be7('0x11')],path[_0x0be7('0x16')](_0x4a5403[_0x0be7('0x11')])),Date[_0x0be7('0x17')](),path[_0x0be7('0x16')](_0x4a5403[_0x0be7('0x11')])));}})});router['post']('/',upload[_0x0be7('0x18')]('file'),controller['create']);router[_0x0be7('0x19')](_0x0be7('0x1a'),auth[_0x0be7('0xa')](),controller['update']);router[_0x0be7('0x1b')](_0x0be7('0x1a'),auth['isAuthenticated'](),controller[_0x0be7('0x1b')]);module[_0x0be7('0x1c')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index c504c03..be85cdd 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 _0x3d42=['name','FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3d42,0x6d));var _0x23d4=function(_0x25733b,_0x5afd29){_0x25733b=_0x25733b-0x0;var _0x520cd0=_0x3d42[_0x25733b];return _0x520cd0;};'use strict';var Sequelize=require(_0x23d4('0x0'));module[_0x23d4('0x1')]={'name':{'type':Sequelize[_0x23d4('0x2')],'unique':_0x23d4('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x23d4('0x2')]},'display_name':{'type':Sequelize[_0x23d4('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x23d4('0x2')]},'original_format':{'type':Sequelize[_0x23d4('0x2')]},'original_duration':{'type':Sequelize[_0x23d4('0x4')]},'original_sampleCount':{'type':Sequelize[_0x23d4('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x23d4('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x23d4('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x23d4('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x23d4('0x6')]}}; \ No newline at end of file +var _0x9a4e=['INTEGER','exports','STRING','name','FLOAT','BIGINT'];(function(_0x8af54b,_0x280be5){var _0x27d8f0=function(_0x559734){while(--_0x559734){_0x8af54b['push'](_0x8af54b['shift']());}};_0x27d8f0(++_0x280be5);}(_0x9a4e,0x139));var _0xe9a4=function(_0x20954a,_0x2005f8){_0x20954a=_0x20954a-0x0;var _0x41f955=_0x9a4e[_0x20954a];return _0x41f955;};'use strict';var Sequelize=require('sequelize');module[_0xe9a4('0x0')]={'name':{'type':Sequelize[_0xe9a4('0x1')],'unique':_0xe9a4('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xe9a4('0x1')]},'display_name':{'type':Sequelize[_0xe9a4('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xe9a4('0x1')]},'original_format':{'type':Sequelize[_0xe9a4('0x1')]},'original_duration':{'type':Sequelize[_0xe9a4('0x3')]},'original_sampleCount':{'type':Sequelize[_0xe9a4('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xe9a4('0x4')]},'original_sampleRate':{'type':Sequelize[_0xe9a4('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xe9a4('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xe9a4('0x4')]},'converted_channelCount':{'type':Sequelize[_0xe9a4('0x5')]},'converted_bitRate':{'type':Sequelize[_0xe9a4('0x4')]},'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 d0a4939..6b41827 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 _0x61dd=['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','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','Sounds','UserProfileResource','error','stack','name','Sound','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','includeAll','include','rows','show','params','options','find','catch','download','save_name','converted_format','join','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','originalname','extname','file','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','send','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_sampleCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x1f821a,_0x22ab44){var _0x1f7408=function(_0x128ad2){while(--_0x128ad2){_0x1f821a['push'](_0x1f821a['shift']());}};_0x1f7408(++_0x22ab44);}(_0x61dd,0x1f1));var _0xd61d=function(_0x131c81,_0x12fe63){_0x131c81=_0x131c81-0x0;var _0x241e7a=_0x61dd[_0x131c81];return _0x241e7a;};'use strict';var emlformat=require(_0xd61d('0x0'));var rimraf=require(_0xd61d('0x1'));var zipdir=require(_0xd61d('0x2'));var jsonpatch=require(_0xd61d('0x3'));var rp=require(_0xd61d('0x4'));var moment=require(_0xd61d('0x5'));var BPromise=require(_0xd61d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd61d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd61d('0x8'));var fs=require('fs');var fs_extra=require(_0xd61d('0x9'));var _=require(_0xd61d('0xa'));var squel=require(_0xd61d('0xb'));var crypto=require(_0xd61d('0xc'));var jsforce=require(_0xd61d('0xd'));var deskjs=require(_0xd61d('0xe'));var toCsv=require(_0xd61d('0xf'));var querystring=require('querystring');var Papa=require(_0xd61d('0x10'));var Redis=require(_0xd61d('0x11'));var authService=require(_0xd61d('0x12'));var qs=require(_0xd61d('0x13'));var as=require(_0xd61d('0x14'));var hardwareService=require(_0xd61d('0x15'));var logger=require(_0xd61d('0x16'))(_0xd61d('0x17'));var utils=require(_0xd61d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd61d('0x19'));var db=require(_0xd61d('0x1a'))['db'];function respondWithStatusCode(_0x80e274,_0x403e86){_0x403e86=_0x403e86||0xcc;return function(_0x247ce7){if(_0x247ce7){return _0x80e274[_0xd61d('0x1b')](_0x403e86);}return _0x80e274[_0xd61d('0x1c')](_0x403e86)[_0xd61d('0x1d')]();};}function respondWithResult(_0x17427d,_0x48d54e){_0x48d54e=_0x48d54e||0xc8;return function(_0x32f006){if(_0x32f006){return _0x17427d[_0xd61d('0x1c')](_0x48d54e)[_0xd61d('0x1e')](_0x32f006);}};}function respondWithFilteredResult(_0x1794d5,_0x62d1f0){return function(_0x38aed8){if(_0x38aed8){var _0x164719=typeof _0x62d1f0[_0xd61d('0x1f')]===_0xd61d('0x20')&&typeof _0x62d1f0['limit']===_0xd61d('0x20');var _0x342a2=_0x38aed8[_0xd61d('0x21')];var _0x1a542b=_0x164719?0x0:_0x62d1f0['offset'];var _0x10e0f2=_0x164719?_0x38aed8[_0xd61d('0x21')]:_0x62d1f0[_0xd61d('0x1f')]+_0x62d1f0[_0xd61d('0x22')];var _0x47f127;if(_0x10e0f2>=_0x342a2){_0x10e0f2=_0x342a2;_0x47f127=0xc8;}else{_0x47f127=0xce;}_0x1794d5[_0xd61d('0x1c')](_0x47f127);return _0x1794d5[_0xd61d('0x23')]('Content-Range',_0x1a542b+'-'+_0x10e0f2+'/'+_0x342a2)[_0xd61d('0x1e')](_0x38aed8);}return null;};}function patchUpdates(_0x2b32c3){return function(_0x137cf5){try{jsonpatch['apply'](_0x137cf5,_0x2b32c3,!![]);}catch(_0x34f558){return BPromise[_0xd61d('0x24')](_0x34f558);}return _0x137cf5[_0xd61d('0x25')]();};}function saveUpdates(_0x27b730,_0x876213){return function(_0x4d7daf){if(_0x4d7daf){return _0x4d7daf[_0xd61d('0x26')](_0x27b730)[_0xd61d('0x27')](function(_0x40cfcf){return _0x40cfcf;});}return null;};}function removeEntity(_0x3d9833,_0x5c2e5f){return function(_0x4e4041){if(_0x4e4041){return _0x4e4041[_0xd61d('0x28')]()['then'](function(){var _0x4b31fd=_0x4e4041['get']({'plain':!![]});var _0x2bc6b9=_0xd61d('0x29');return db[_0xd61d('0x2a')][_0xd61d('0x28')]({'where':{'type':_0x2bc6b9,'resourceId':_0x4b31fd['id']}})[_0xd61d('0x27')](function(){return _0x4e4041;});})[_0xd61d('0x27')](function(){_0x3d9833['status'](0xcc)[_0xd61d('0x1d')]();});}};}function handleEntityNotFound(_0x5d024c,_0x508811){return function(_0x13a0f2){if(!_0x13a0f2){_0x5d024c['sendStatus'](0x194);}return _0x13a0f2;};}function handleError(_0x3fdde9,_0x25b17a){_0x25b17a=_0x25b17a||0x1f4;return function(_0x3a0ee4){logger[_0xd61d('0x2b')](_0x3a0ee4[_0xd61d('0x2c')]);if(_0x3a0ee4[_0xd61d('0x2d')]){delete _0x3a0ee4[_0xd61d('0x2d')];}_0x3fdde9[_0xd61d('0x1c')](_0x25b17a)['send'](_0x3a0ee4);};}exports['index']=function(_0x15c84e,_0xef1534){var _0x54d08e={},_0xa80547={},_0x1ff63e={'count':0x0,'rows':[]};var _0x4d61bf=_['map'](db[_0xd61d('0x2e')]['rawAttributes'],function(_0xe215b7){return{'name':_0xe215b7[_0xd61d('0x2f')],'type':_0xe215b7[_0xd61d('0x30')][_0xd61d('0x31')]};});_0xa80547[_0xd61d('0x32')]=_[_0xd61d('0x33')](_0x4d61bf,_0xd61d('0x2d'));_0xa80547[_0xd61d('0x34')]=_[_0xd61d('0x35')](_0x15c84e['query']);_0xa80547[_0xd61d('0x36')]=_[_0xd61d('0x37')](_0xa80547[_0xd61d('0x32')],_0xa80547['query']);_0x54d08e['attributes']=_[_0xd61d('0x37')](_0xa80547['model'],qs[_0xd61d('0x38')](_0x15c84e[_0xd61d('0x34')][_0xd61d('0x38')]));_0x54d08e[_0xd61d('0x39')]=_0x54d08e['attributes'][_0xd61d('0x3a')]?_0x54d08e[_0xd61d('0x39')]:_0xa80547['model'];if(!_0x15c84e[_0xd61d('0x34')][_0xd61d('0x3b')](_0xd61d('0x3c'))){_0x54d08e[_0xd61d('0x22')]=qs[_0xd61d('0x22')](_0x15c84e[_0xd61d('0x34')][_0xd61d('0x22')]);_0x54d08e[_0xd61d('0x1f')]=qs[_0xd61d('0x1f')](_0x15c84e[_0xd61d('0x34')][_0xd61d('0x1f')]);}_0x54d08e[_0xd61d('0x3d')]=qs[_0xd61d('0x3e')](_0x15c84e[_0xd61d('0x34')][_0xd61d('0x3e')]);_0x54d08e['where']=qs['filters'](_['pick'](_0x15c84e['query'],_0xa80547[_0xd61d('0x36')]),_0x4d61bf);if(_0x15c84e[_0xd61d('0x34')][_0xd61d('0x3f')]){_0x54d08e[_0xd61d('0x40')]=_['merge'](_0x54d08e[_0xd61d('0x40')],{'$or':_[_0xd61d('0x33')](_0x4d61bf,function(_0x47f410){if(_0x47f410['type']!==_0xd61d('0x41')){var _0x28f364={};_0x28f364[_0x47f410[_0xd61d('0x2d')]]={'$like':'%'+_0x15c84e[_0xd61d('0x34')][_0xd61d('0x3f')]+'%'};return _0x28f364;}})});}_0x54d08e=_[_0xd61d('0x42')]({},_0x54d08e,_0x15c84e['options']);var _0x370751={'where':_0x54d08e[_0xd61d('0x40')]};return db[_0xd61d('0x2e')][_0xd61d('0x21')](_0x370751)['then'](function(_0x3418ad){_0x1ff63e['count']=_0x3418ad;if(_0x15c84e[_0xd61d('0x34')][_0xd61d('0x43')]){_0x54d08e[_0xd61d('0x44')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x54d08e);})[_0xd61d('0x27')](function(_0xa2a68c){_0x1ff63e[_0xd61d('0x45')]=_0xa2a68c;return _0x1ff63e;})[_0xd61d('0x27')](respondWithFilteredResult(_0xef1534,_0x54d08e))['catch'](handleError(_0xef1534,null));};exports[_0xd61d('0x46')]=function(_0x3fa4f4,_0xd3e91b){var _0x198c15={'raw':!![],'where':{'id':_0x3fa4f4[_0xd61d('0x47')]['id']}},_0x30ff1f={};_0x30ff1f[_0xd61d('0x32')]=_[_0xd61d('0x35')](db['Sound']['rawAttributes']);_0x30ff1f[_0xd61d('0x34')]=_[_0xd61d('0x35')](_0x3fa4f4[_0xd61d('0x34')]);_0x30ff1f[_0xd61d('0x36')]=_['intersection'](_0x30ff1f[_0xd61d('0x32')],_0x30ff1f['query']);_0x198c15['attributes']=_[_0xd61d('0x37')](_0x30ff1f[_0xd61d('0x32')],qs[_0xd61d('0x38')](_0x3fa4f4[_0xd61d('0x34')][_0xd61d('0x38')]));_0x198c15[_0xd61d('0x39')]=_0x198c15[_0xd61d('0x39')][_0xd61d('0x3a')]?_0x198c15['attributes']:_0x30ff1f[_0xd61d('0x32')];if(_0x3fa4f4[_0xd61d('0x34')][_0xd61d('0x43')]){_0x198c15[_0xd61d('0x44')]=[{'all':!![]}];}_0x198c15=_[_0xd61d('0x42')]({},_0x198c15,_0x3fa4f4[_0xd61d('0x48')]);return db[_0xd61d('0x2e')][_0xd61d('0x49')](_0x198c15)[_0xd61d('0x27')](handleEntityNotFound(_0xd3e91b,null))['then'](respondWithResult(_0xd3e91b,null))[_0xd61d('0x4a')](handleError(_0xd3e91b,null));};exports[_0xd61d('0x4b')]=function(_0x5a31b3,_0x35e187,_0x176912){return db[_0xd61d('0x2e')]['find']({'where':{'id':_0x5a31b3[_0xd61d('0x47')]['id']},'attributes':[_0xd61d('0x2d'),_0xd61d('0x4c'),_0xd61d('0x4d')],'raw':!![]})[_0xd61d('0x27')](handleEntityNotFound(_0x35e187,null))[_0xd61d('0x27')](function(_0x101dd4){if(_0x101dd4){if(!fs['existsSync'](path[_0xd61d('0x4e')](config['root'],_0xd61d('0x4f'),_0x101dd4[_0xd61d('0x4c')]+'.'+_0x101dd4[_0xd61d('0x4d')]))){throw new db[(_0xd61d('0x50'))][(_0xd61d('0x51'))](_0xd61d('0x52'));}return _0x35e187[_0xd61d('0x4b')](path[_0xd61d('0x4e')](config[_0xd61d('0x53')],_0xd61d('0x4f'),util[_0xd61d('0x54')](_0xd61d('0x55'),_0x101dd4[_0xd61d('0x4c')],_0x101dd4[_0xd61d('0x4d')])),util[_0xd61d('0x54')](_0xd61d('0x55'),_0x101dd4[_0xd61d('0x2d')],_0x101dd4['converted_format']));}return null;})[_0xd61d('0x4a')](handleError(_0x35e187,null));};exports[_0xd61d('0x56')]=function(_0x5965ef,_0x12af5a,_0x3657a1){var _0x66ed9e={'name':path[_0xd61d('0x57')](_0x5965ef['file'][_0xd61d('0x58')],path[_0xd61d('0x59')](_0x5965ef[_0xd61d('0x5a')][_0xd61d('0x58')])),'save_name':path['basename'](_0x5965ef[_0xd61d('0x5a')][_0xd61d('0x5b')],path[_0xd61d('0x59')](_0x5965ef[_0xd61d('0x5a')]['filename'])),'original_format':path['extname'](_0x5965ef[_0xd61d('0x5a')][_0xd61d('0x58')])[_0xd61d('0x5c')](0x1),'converted_format':_0xd61d('0x5d')};var _0x20d1a2=path[_0xd61d('0x4e')](config[_0xd61d('0x53')],_0xd61d('0x5e'),_0x5965ef['file'][_0xd61d('0x5b')]);var _0x255769=path[_0xd61d('0x4e')](config[_0xd61d('0x53')],'server/files/sounds/converted',util['format'](_0xd61d('0x55'),path[_0xd61d('0x57')](_0x5965ef[_0xd61d('0x5a')]['filename'],path[_0xd61d('0x59')](_0x5965ef[_0xd61d('0x5a')][_0xd61d('0x5b')])),_0x66ed9e[_0xd61d('0x4d')]));logger['info'](_0xd61d('0x5f'),_0x20d1a2);logger[_0xd61d('0x60')](_0xd61d('0x61'),_0x255769);try{fs[_0xd61d('0x62')](_0x20d1a2,parseInt(_0xd61d('0x63'),0x8));var _0x39f1ef=sox['transcode'](_0x20d1a2,_0x255769,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x39f1ef['on'](_0xd61d('0x2b'),function(_0x1bca60){fs[_0xd61d('0x64')](_0x20d1a2);_0x12af5a[_0xd61d('0x1c')](0x1f4)[_0xd61d('0x65')](_0x1bca60);});_0x39f1ef['on'](_0xd61d('0x66'),function(_0x218dc8){_0x66ed9e['original_duration']=isNaN(_0x218dc8[_0xd61d('0x67')])?null:_0x218dc8[_0xd61d('0x67')]*0x3e8;_0x66ed9e[_0xd61d('0x68')]=isNaN(_0x218dc8[_0xd61d('0x69')])?null:_0x218dc8[_0xd61d('0x69')];_0x66ed9e[_0xd61d('0x6a')]=isNaN(_0x218dc8[_0xd61d('0x6b')])?null:_0x218dc8[_0xd61d('0x6b')];_0x66ed9e[_0xd61d('0x6c')]=isNaN(_0x218dc8[_0xd61d('0x6d')])?null:_0x218dc8[_0xd61d('0x6d')];_0x66ed9e[_0xd61d('0x6e')]=isNaN(_0x218dc8[_0xd61d('0x6f')])?null:_0x218dc8[_0xd61d('0x6f')];});_0x39f1ef['on']('dest',function(_0x4836a6){_0x66ed9e['converted_duration']=isNaN(_0x4836a6[_0xd61d('0x67')])?null:_0x4836a6[_0xd61d('0x67')]*0x3e8;_0x66ed9e[_0xd61d('0x70')]=isNaN(_0x4836a6[_0xd61d('0x69')])?null:_0x4836a6[_0xd61d('0x69')];_0x66ed9e['converted_channelCount']=isNaN(_0x4836a6['channelCount'])?null:_0x4836a6[_0xd61d('0x6b')];_0x66ed9e[_0xd61d('0x71')]=isNaN(_0x4836a6[_0xd61d('0x6d')])?null:_0x4836a6[_0xd61d('0x6d')];_0x66ed9e[_0xd61d('0x72')]=isNaN(_0x4836a6[_0xd61d('0x6f')])?null:_0x4836a6[_0xd61d('0x6f')];});_0x39f1ef['on'](_0xd61d('0x1d'),function(){fs[_0xd61d('0x62')](_0x255769,parseInt('0777',0x8));return db[_0xd61d('0x2e')][_0xd61d('0x56')](_0x66ed9e)[_0xd61d('0x27')](function(_0x479a04){var _0x23ba03={'role':_0x5965ef[_0xd61d('0x73')][_0xd61d('0x74')],'userProfileId':_0x5965ef['body'][_0xd61d('0x75')]};if(!_0x23ba03)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23ba03[_0xd61d('0x74')]===_0xd61d('0x76')){var _0x2f4243=_0x479a04[_0xd61d('0x77')]({'plain':!![]});return db[_0xd61d('0x78')][_0xd61d('0x49')]({'where':{'name':_0xd61d('0x29'),'userProfileId':_0x23ba03[_0xd61d('0x75')]},'raw':!![]})[_0xd61d('0x27')](function(_0x16ca57){if(_0x16ca57&&_0x16ca57[_0xd61d('0x79')]===0x0){return db[_0xd61d('0x2a')][_0xd61d('0x56')]({'name':_0x2f4243[_0xd61d('0x2d')],'resourceId':_0x2f4243['id'],'type':_0x16ca57[_0xd61d('0x2d')],'sectionId':_0x16ca57['id']},{})[_0xd61d('0x27')](function(){return _0x479a04;});}else{return _0x479a04;}})[_0xd61d('0x4a')](function(_0x46d400){logger['error'](_0xd61d('0x7a'),_0x46d400);throw _0x46d400;});}return _0x479a04;})[_0xd61d('0x27')](respondWithResult(_0x12af5a,null))[_0xd61d('0x4a')](handleError(_0x12af5a,null));});_0x39f1ef[_0xd61d('0x7b')]();}catch(_0x515643){_0x12af5a[_0xd61d('0x1c')](0x1f4)[_0xd61d('0x65')](_0x515643);}};exports[_0xd61d('0x26')]=function(_0x225a22,_0x15efe2,_0x4a7285){return db['Sound']['find']({'where':{'id':_0x225a22[_0xd61d('0x47')]['id']}})[_0xd61d('0x27')](handleEntityNotFound(_0x15efe2,null))['then'](saveUpdates(_[_0xd61d('0x7c')](_0x225a22[_0xd61d('0x73')],['name',_0xd61d('0x7d')]),null))[_0xd61d('0x27')](respondWithResult(_0x15efe2,null))['catch'](handleError(_0x15efe2,null));};exports[_0xd61d('0x7e')]=function(_0x37722e,_0x4c1e9a,_0x13785a){return db['Sound'][_0xd61d('0x49')]({'where':{'id':_0x37722e[_0xd61d('0x47')]['id']}})['then'](function(_0x1a4310){if(_0x1a4310){return _0x1a4310[_0xd61d('0x28')]();}})[_0xd61d('0x27')](function(_0x51b0d1){var _0x20f100=path['join'](config[_0xd61d('0x53')],_0xd61d('0x5e'),util[_0xd61d('0x54')](_0xd61d('0x55'),_0x51b0d1['save_name'],_0x51b0d1[_0xd61d('0x7f')]));var _0x1cc6af=path['join'](config[_0xd61d('0x53')],_0xd61d('0x4f'),util['format']('%s.%s',_0x51b0d1['save_name'],_0x51b0d1[_0xd61d('0x4d')]));fs['unlinkSync'](_0x20f100);fs[_0xd61d('0x64')](_0x1cc6af);return _0x51b0d1;})[_0xd61d('0x27')](function(_0xc368df){if(_0xc368df){return _0x4c1e9a[_0xd61d('0x1c')](0xcc)[_0xd61d('0x1d')]();}})[_0xd61d('0x27')](handleEntityNotFound(_0x4c1e9a,null))[_0xd61d('0x4a')](handleError(_0x4c1e9a,null));}; \ No newline at end of file +var _0x4492=['length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','merge','options','includeAll','include','findAll','rows','catch','show','params','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','create','file','originalname','extname','filename','substring','wav','basename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','duration','original_sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','sampleCount','converted_channelCount','converted_bitRate','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','start','body','description','server/files/sounds/original','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','stack','name','send','index','Sound','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes'];(function(_0x9c4b8e,_0x3a995d){var _0x12eb91=function(_0x204709){while(--_0x204709){_0x9c4b8e['push'](_0x9c4b8e['shift']());}};_0x12eb91(++_0x3a995d);}(_0x4492,0x14c));var _0x2449=function(_0x517d65,_0x29cbc3){_0x517d65=_0x517d65-0x0;var _0xf911de=_0x4492[_0x517d65];return _0xf911de;};'use strict';var emlformat=require(_0x2449('0x0'));var rimraf=require(_0x2449('0x1'));var zipdir=require(_0x2449('0x2'));var jsonpatch=require(_0x2449('0x3'));var rp=require(_0x2449('0x4'));var moment=require(_0x2449('0x5'));var BPromise=require(_0x2449('0x6'));var Mustache=require(_0x2449('0x7'));var util=require(_0x2449('0x8'));var path=require(_0x2449('0x9'));var sox=require('sox');var csv=require(_0x2449('0xa'));var ejs=require(_0x2449('0xb'));var fs=require('fs');var fs_extra=require(_0x2449('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2449('0xd'));var jsforce=require(_0x2449('0xe'));var deskjs=require(_0x2449('0xf'));var toCsv=require(_0x2449('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2449('0x10'));var qs=require(_0x2449('0x11'));var as=require(_0x2449('0x12'));var hardwareService=require(_0x2449('0x13'));var logger=require(_0x2449('0x14'))(_0x2449('0x15'));var utils=require(_0x2449('0x16'));var config=require(_0x2449('0x17'));var licenseUtil=require(_0x2449('0x18'));var db=require(_0x2449('0x19'))['db'];function respondWithStatusCode(_0x573565,_0x4847b2){_0x4847b2=_0x4847b2||0xcc;return function(_0x2f2681){if(_0x2f2681){return _0x573565['sendStatus'](_0x4847b2);}return _0x573565[_0x2449('0x1a')](_0x4847b2)[_0x2449('0x1b')]();};}function respondWithResult(_0x2db24a,_0x42ec14){_0x42ec14=_0x42ec14||0xc8;return function(_0x4a183d){if(_0x4a183d){return _0x2db24a[_0x2449('0x1a')](_0x42ec14)[_0x2449('0x1c')](_0x4a183d);}};}function respondWithFilteredResult(_0xe1cc91,_0x34e8c6){return function(_0x488af2){if(_0x488af2){var _0x4ad289=typeof _0x34e8c6[_0x2449('0x1d')]==='undefined'&&typeof _0x34e8c6[_0x2449('0x1e')]===_0x2449('0x1f');var _0x29b195=_0x488af2['count'];var _0x1b8cad=_0x4ad289?0x0:_0x34e8c6[_0x2449('0x1d')];var _0x1c1a9f=_0x4ad289?_0x488af2[_0x2449('0x20')]:_0x34e8c6[_0x2449('0x1d')]+_0x34e8c6[_0x2449('0x1e')];var _0x3a3872;if(_0x1c1a9f>=_0x29b195){_0x1c1a9f=_0x29b195;_0x3a3872=0xc8;}else{_0x3a3872=0xce;}_0xe1cc91[_0x2449('0x1a')](_0x3a3872);return _0xe1cc91[_0x2449('0x21')](_0x2449('0x22'),_0x1b8cad+'-'+_0x1c1a9f+'/'+_0x29b195)[_0x2449('0x1c')](_0x488af2);}return null;};}function patchUpdates(_0x44ac7b){return function(_0x280d32){try{jsonpatch[_0x2449('0x23')](_0x280d32,_0x44ac7b,!![]);}catch(_0x208607){return BPromise[_0x2449('0x24')](_0x208607);}return _0x280d32[_0x2449('0x25')]();};}function saveUpdates(_0x3e3e30,_0x47c465){return function(_0x4c0764){if(_0x4c0764){return _0x4c0764[_0x2449('0x26')](_0x3e3e30)[_0x2449('0x27')](function(_0x33974d){return _0x33974d;});}return null;};}function removeEntity(_0x345815,_0x2317d3){return function(_0x353633){if(_0x353633){return _0x353633[_0x2449('0x28')]()['then'](function(){var _0x3b34fc=_0x353633['get']({'plain':!![]});var _0x183efa='Sounds';return db[_0x2449('0x29')][_0x2449('0x28')]({'where':{'type':_0x183efa,'resourceId':_0x3b34fc['id']}})[_0x2449('0x27')](function(){return _0x353633;});})[_0x2449('0x27')](function(){_0x345815['status'](0xcc)[_0x2449('0x1b')]();});}};}function handleEntityNotFound(_0x266883,_0x334c7d){return function(_0x141b03){if(!_0x141b03){_0x266883[_0x2449('0x2a')](0x194);}return _0x141b03;};}function handleError(_0x33f4cc,_0x256cdb){_0x256cdb=_0x256cdb||0x1f4;return function(_0x62b3d1){logger['error'](_0x62b3d1[_0x2449('0x2b')]);if(_0x62b3d1[_0x2449('0x2c')]){delete _0x62b3d1['name'];}_0x33f4cc['status'](_0x256cdb)[_0x2449('0x2d')](_0x62b3d1);};}exports[_0x2449('0x2e')]=function(_0x2ca62a,_0x5a6d0f){var _0x187679={},_0x4cd2d4={},_0x58bf64={'count':0x0,'rows':[]};var _0x473037=_['map'](db[_0x2449('0x2f')][_0x2449('0x30')],function(_0x45eda1){return{'name':_0x45eda1[_0x2449('0x31')],'type':_0x45eda1['type'][_0x2449('0x32')]};});_0x4cd2d4[_0x2449('0x33')]=_[_0x2449('0x34')](_0x473037,_0x2449('0x2c'));_0x4cd2d4[_0x2449('0x35')]=_[_0x2449('0x36')](_0x2ca62a[_0x2449('0x35')]);_0x4cd2d4['filters']=_[_0x2449('0x37')](_0x4cd2d4['model'],_0x4cd2d4[_0x2449('0x35')]);_0x187679['attributes']=_[_0x2449('0x37')](_0x4cd2d4[_0x2449('0x33')],qs[_0x2449('0x38')](_0x2ca62a[_0x2449('0x35')][_0x2449('0x38')]));_0x187679['attributes']=_0x187679[_0x2449('0x39')][_0x2449('0x3a')]?_0x187679['attributes']:_0x4cd2d4[_0x2449('0x33')];if(!_0x2ca62a[_0x2449('0x35')][_0x2449('0x3b')](_0x2449('0x3c'))){_0x187679[_0x2449('0x1e')]=qs['limit'](_0x2ca62a[_0x2449('0x35')]['limit']);_0x187679['offset']=qs[_0x2449('0x1d')](_0x2ca62a[_0x2449('0x35')]['offset']);}_0x187679[_0x2449('0x3d')]=qs['sort'](_0x2ca62a[_0x2449('0x35')][_0x2449('0x3e')]);_0x187679['where']=qs[_0x2449('0x3f')](_[_0x2449('0x40')](_0x2ca62a[_0x2449('0x35')],_0x4cd2d4[_0x2449('0x3f')]),_0x473037);if(_0x2ca62a[_0x2449('0x35')][_0x2449('0x41')]){_0x187679[_0x2449('0x42')]=_['merge'](_0x187679[_0x2449('0x42')],{'$or':_['map'](_0x473037,function(_0x186b87){if(_0x186b87[_0x2449('0x43')]!=='VIRTUAL'){var _0x4b352c={};_0x4b352c[_0x186b87[_0x2449('0x2c')]]={'$like':'%'+_0x2ca62a[_0x2449('0x35')][_0x2449('0x41')]+'%'};return _0x4b352c;}})});}_0x187679=_[_0x2449('0x44')]({},_0x187679,_0x2ca62a[_0x2449('0x45')]);var _0x507f3e={'where':_0x187679[_0x2449('0x42')]};return db['Sound'][_0x2449('0x20')](_0x507f3e)[_0x2449('0x27')](function(_0x5494cf){_0x58bf64[_0x2449('0x20')]=_0x5494cf;if(_0x2ca62a[_0x2449('0x35')][_0x2449('0x46')]){_0x187679[_0x2449('0x47')]=[{'all':!![]}];}return db[_0x2449('0x2f')][_0x2449('0x48')](_0x187679);})[_0x2449('0x27')](function(_0x2d7093){_0x58bf64[_0x2449('0x49')]=_0x2d7093;return _0x58bf64;})[_0x2449('0x27')](respondWithFilteredResult(_0x5a6d0f,_0x187679))[_0x2449('0x4a')](handleError(_0x5a6d0f,null));};exports[_0x2449('0x4b')]=function(_0x4427e6,_0x4d92c9){var _0xe6b0d3={'raw':!![],'where':{'id':_0x4427e6[_0x2449('0x4c')]['id']}},_0x2a7931={};_0x2a7931[_0x2449('0x33')]=_[_0x2449('0x36')](db['Sound'][_0x2449('0x30')]);_0x2a7931[_0x2449('0x35')]=_[_0x2449('0x36')](_0x4427e6['query']);_0x2a7931[_0x2449('0x3f')]=_[_0x2449('0x37')](_0x2a7931[_0x2449('0x33')],_0x2a7931['query']);_0xe6b0d3[_0x2449('0x39')]=_['intersection'](_0x2a7931[_0x2449('0x33')],qs['fields'](_0x4427e6[_0x2449('0x35')][_0x2449('0x38')]));_0xe6b0d3['attributes']=_0xe6b0d3[_0x2449('0x39')][_0x2449('0x3a')]?_0xe6b0d3[_0x2449('0x39')]:_0x2a7931[_0x2449('0x33')];if(_0x4427e6[_0x2449('0x35')][_0x2449('0x46')]){_0xe6b0d3[_0x2449('0x47')]=[{'all':!![]}];}_0xe6b0d3=_[_0x2449('0x44')]({},_0xe6b0d3,_0x4427e6['options']);return db[_0x2449('0x2f')][_0x2449('0x4d')](_0xe6b0d3)[_0x2449('0x27')](handleEntityNotFound(_0x4d92c9,null))[_0x2449('0x27')](respondWithResult(_0x4d92c9,null))[_0x2449('0x4a')](handleError(_0x4d92c9,null));};exports[_0x2449('0x4e')]=function(_0x4c3efa,_0x38fba3,_0x332e86){return db[_0x2449('0x2f')][_0x2449('0x4d')]({'where':{'id':_0x4c3efa[_0x2449('0x4c')]['id']},'attributes':[_0x2449('0x2c'),_0x2449('0x4f'),_0x2449('0x50')],'raw':!![]})[_0x2449('0x27')](handleEntityNotFound(_0x38fba3,null))[_0x2449('0x27')](function(_0x2b335f){if(_0x2b335f){if(!fs[_0x2449('0x51')](path[_0x2449('0x52')](config[_0x2449('0x53')],_0x2449('0x54'),_0x2b335f[_0x2449('0x4f')]+'.'+_0x2b335f[_0x2449('0x50')]))){throw new db[(_0x2449('0x55'))][(_0x2449('0x56'))](_0x2449('0x57'));}return _0x38fba3['download'](path[_0x2449('0x52')](config[_0x2449('0x53')],_0x2449('0x54'),util['format'](_0x2449('0x58'),_0x2b335f[_0x2449('0x4f')],_0x2b335f[_0x2449('0x50')])),util[_0x2449('0x59')](_0x2449('0x58'),_0x2b335f['name'],_0x2b335f[_0x2449('0x50')]));}return null;})['catch'](handleError(_0x38fba3,null));};exports[_0x2449('0x5a')]=function(_0x326fdd,_0x58b2dd,_0x2a4f17){var _0x1fd86e={'name':path['basename'](_0x326fdd[_0x2449('0x5b')][_0x2449('0x5c')],path[_0x2449('0x5d')](_0x326fdd['file'][_0x2449('0x5c')])),'save_name':path['basename'](_0x326fdd[_0x2449('0x5b')][_0x2449('0x5e')],path[_0x2449('0x5d')](_0x326fdd[_0x2449('0x5b')]['filename'])),'original_format':path[_0x2449('0x5d')](_0x326fdd['file'][_0x2449('0x5c')])[_0x2449('0x5f')](0x1),'converted_format':_0x2449('0x60')};var _0x3b0ce2=path['join'](config[_0x2449('0x53')],'server/files/sounds/original',_0x326fdd['file'][_0x2449('0x5e')]);var _0x493421=path[_0x2449('0x52')](config[_0x2449('0x53')],'server/files/sounds/converted',util[_0x2449('0x59')](_0x2449('0x58'),path[_0x2449('0x61')](_0x326fdd['file'][_0x2449('0x5e')],path[_0x2449('0x5d')](_0x326fdd[_0x2449('0x5b')]['filename'])),_0x1fd86e[_0x2449('0x50')]));logger[_0x2449('0x62')](_0x2449('0x63'),_0x3b0ce2);logger[_0x2449('0x62')](_0x2449('0x64'),_0x493421);try{fs[_0x2449('0x65')](_0x3b0ce2,parseInt(_0x2449('0x66'),0x8));var _0x1e7d74=sox[_0x2449('0x67')](_0x3b0ce2,_0x493421,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1e7d74['on'](_0x2449('0x68'),function(_0x369d77){fs[_0x2449('0x69')](_0x3b0ce2);_0x58b2dd['status'](0x1f4)[_0x2449('0x2d')](_0x369d77);});_0x1e7d74['on']('src',function(_0x1b5bc0){_0x1fd86e['original_duration']=isNaN(_0x1b5bc0[_0x2449('0x6a')])?null:_0x1b5bc0[_0x2449('0x6a')]*0x3e8;_0x1fd86e[_0x2449('0x6b')]=isNaN(_0x1b5bc0['sampleCount'])?null:_0x1b5bc0['sampleCount'];_0x1fd86e[_0x2449('0x6c')]=isNaN(_0x1b5bc0[_0x2449('0x6d')])?null:_0x1b5bc0['channelCount'];_0x1fd86e['original_bitRate']=isNaN(_0x1b5bc0[_0x2449('0x6e')])?null:_0x1b5bc0[_0x2449('0x6e')];_0x1fd86e[_0x2449('0x6f')]=isNaN(_0x1b5bc0[_0x2449('0x70')])?null:_0x1b5bc0[_0x2449('0x70')];});_0x1e7d74['on'](_0x2449('0x71'),function(_0x36b37b){_0x1fd86e[_0x2449('0x72')]=isNaN(_0x36b37b['duration'])?null:_0x36b37b[_0x2449('0x6a')]*0x3e8;_0x1fd86e['converted_sampleCount']=isNaN(_0x36b37b[_0x2449('0x73')])?null:_0x36b37b['sampleCount'];_0x1fd86e[_0x2449('0x74')]=isNaN(_0x36b37b['channelCount'])?null:_0x36b37b[_0x2449('0x6d')];_0x1fd86e[_0x2449('0x75')]=isNaN(_0x36b37b[_0x2449('0x6e')])?null:_0x36b37b['bitRate'];_0x1fd86e['converted_sampleRate']=isNaN(_0x36b37b[_0x2449('0x70')])?null:_0x36b37b[_0x2449('0x70')];});_0x1e7d74['on'](_0x2449('0x1b'),function(){fs['chmodSync'](_0x493421,parseInt(_0x2449('0x66'),0x8));return db[_0x2449('0x2f')][_0x2449('0x5a')](_0x1fd86e)['then'](function(_0x1929c0){var _0x2ac8e4={'role':_0x326fdd['body'][_0x2449('0x76')],'userProfileId':_0x326fdd['body'][_0x2449('0x77')]};if(!_0x2ac8e4)throw new Error(_0x2449('0x78'));if(_0x2ac8e4['role']===_0x2449('0x79')){var _0x27d572=_0x1929c0[_0x2449('0x7a')]({'plain':!![]});return db[_0x2449('0x7b')][_0x2449('0x4d')]({'where':{'name':'Sounds','userProfileId':_0x2ac8e4[_0x2449('0x77')]},'raw':!![]})[_0x2449('0x27')](function(_0x3766e8){if(_0x3766e8&&_0x3766e8[_0x2449('0x7c')]===0x0){return db[_0x2449('0x29')][_0x2449('0x5a')]({'name':_0x27d572[_0x2449('0x2c')],'resourceId':_0x27d572['id'],'type':_0x3766e8[_0x2449('0x2c')],'sectionId':_0x3766e8['id']},{})['then'](function(){return _0x1929c0;});}else{return _0x1929c0;}})[_0x2449('0x4a')](function(_0x3880f9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3880f9);throw _0x3880f9;});}return _0x1929c0;})[_0x2449('0x27')](respondWithResult(_0x58b2dd,null))[_0x2449('0x4a')](handleError(_0x58b2dd,null));});_0x1e7d74[_0x2449('0x7d')]();}catch(_0x21d909){_0x58b2dd[_0x2449('0x1a')](0x1f4)['send'](_0x21d909);}};exports[_0x2449('0x26')]=function(_0x27a729,_0x59d5c0,_0x7c8dc3){return db[_0x2449('0x2f')][_0x2449('0x4d')]({'where':{'id':_0x27a729[_0x2449('0x4c')]['id']}})[_0x2449('0x27')](handleEntityNotFound(_0x59d5c0,null))[_0x2449('0x27')](saveUpdates(_[_0x2449('0x40')](_0x27a729[_0x2449('0x7e')],[_0x2449('0x2c'),_0x2449('0x7f')]),null))[_0x2449('0x27')](respondWithResult(_0x59d5c0,null))[_0x2449('0x4a')](handleError(_0x59d5c0,null));};exports['delete']=function(_0x51e578,_0x23ab78,_0x118d7f){return db[_0x2449('0x2f')][_0x2449('0x4d')]({'where':{'id':_0x51e578[_0x2449('0x4c')]['id']}})[_0x2449('0x27')](function(_0x274087){if(_0x274087){return _0x274087[_0x2449('0x28')]();}})[_0x2449('0x27')](function(_0x1c5f52){var _0x37cdb1=path['join'](config[_0x2449('0x53')],_0x2449('0x80'),util[_0x2449('0x59')](_0x2449('0x58'),_0x1c5f52[_0x2449('0x4f')],_0x1c5f52[_0x2449('0x81')]));var _0x432ab5=path[_0x2449('0x52')](config[_0x2449('0x53')],_0x2449('0x54'),util[_0x2449('0x59')]('%s.%s',_0x1c5f52[_0x2449('0x4f')],_0x1c5f52[_0x2449('0x50')]));fs[_0x2449('0x69')](_0x37cdb1);fs[_0x2449('0x69')](_0x432ab5);return _0x1c5f52;})['then'](function(_0x504159){if(_0x504159){return _0x23ab78[_0x2449('0x1a')](0xcc)['end']();}})[_0x2449('0x27')](handleEntityNotFound(_0x23ab78,null))[_0x2449('0x4a')](handleError(_0x23ab78,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index ece7806..0ae9147 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 _0xec07=['tools_sounds','lodash','util','api','moment','request-promise','../../config/environment','./sound.attributes','exports','define','Sound'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xec07,0xa6));var _0x7ec0=function(_0x19d7fe,_0x42bdb5){_0x19d7fe=_0x19d7fe-0x0;var _0x4db4e9=_0xec07[_0x19d7fe];return _0x4db4e9;};'use strict';var _=require(_0x7ec0('0x0'));var util=require(_0x7ec0('0x1'));var logger=require('../../config/logger')(_0x7ec0('0x2'));var moment=require(_0x7ec0('0x3'));var BPromise=require('bluebird');var rp=require(_0x7ec0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7ec0('0x5'));var attributes=require(_0x7ec0('0x6'));module[_0x7ec0('0x7')]=function(_0x103d69,_0x377f68){return _0x103d69[_0x7ec0('0x8')](_0x7ec0('0x9'),attributes,{'tableName':_0x7ec0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec7e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','util'];(function(_0x22e00a,_0x23991a){var _0x13537f=function(_0xbf78b4){while(--_0xbf78b4){_0x22e00a['push'](_0x22e00a['shift']());}};_0x13537f(++_0x23991a);}(_0xec7e,0xe6));var _0xeec7=function(_0x534bdb,_0x48b300){_0x534bdb=_0x534bdb-0x0;var _0x502a5b=_0xec7e[_0x534bdb];return _0x502a5b;};'use strict';var _=require('lodash');var util=require(_0xeec7('0x0'));var logger=require('../../config/logger')(_0xeec7('0x1'));var moment=require(_0xeec7('0x2'));var BPromise=require(_0xeec7('0x3'));var rp=require(_0xeec7('0x4'));var fs=require('fs');var path=require(_0xeec7('0x5'));var rimraf=require(_0xeec7('0x6'));var config=require(_0xeec7('0x7'));var attributes=require(_0xeec7('0x8'));module[_0xeec7('0x9')]=function(_0x4361c4,_0x5735ab){return _0x4361c4[_0xeec7('0xa')]('Sound',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 29e108f..7484d6c 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 _0x5b04=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowSound','Sound','find','options','where','attributes','include','map','model','stringify','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5b04,0x15f));var _0x45b0=function(_0x4ab35e,_0x9919a1){_0x4ab35e=_0x4ab35e-0x0;var _0x336164=_0x5b04[_0x4ab35e];return _0x336164;};'use strict';var _=require(_0x45b0('0x0'));var util=require(_0x45b0('0x1'));var moment=require(_0x45b0('0x2'));var BPromise=require(_0x45b0('0x3'));var rs=require(_0x45b0('0x4'));var fs=require('fs');var Redis=require(_0x45b0('0x5'));var db=require(_0x45b0('0x6'))['db'];var utils=require(_0x45b0('0x7'));var logger=require(_0x45b0('0x8'))(_0x45b0('0x9'));var config=require(_0x45b0('0xa'));var jayson=require(_0x45b0('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5780c2,_0x11177a,_0x1a84f6){return new BPromise(function(_0x45bf8e,_0x80a433){return client['request'](_0x5780c2,_0x1a84f6)[_0x45b0('0xc')](function(_0x39a415){logger[_0x45b0('0xd')](_0x45b0('0xe'),_0x11177a,_0x45b0('0xf'));logger[_0x45b0('0x10')](_0x45b0('0x11'),_0x11177a,'request\x20sent',JSON['stringify'](_0x39a415));if(_0x39a415['error']){if(_0x39a415[_0x45b0('0x12')]['code']===0x1f4){logger[_0x45b0('0x12')]('Sound,\x20%s,\x20%s',_0x11177a,_0x39a415[_0x45b0('0x12')][_0x45b0('0x13')]);return _0x80a433(_0x39a415[_0x45b0('0x12')][_0x45b0('0x13')]);}logger[_0x45b0('0x12')](_0x45b0('0xe'),_0x11177a,_0x39a415['error']['message']);return _0x45bf8e(_0x39a415[_0x45b0('0x12')][_0x45b0('0x13')]);}else{logger[_0x45b0('0xd')]('Sound,\x20%s,\x20%s',_0x11177a,_0x45b0('0xf'));_0x45bf8e(_0x39a415[_0x45b0('0x14')][_0x45b0('0x13')]);}})[_0x45b0('0x15')](function(_0x1db6a3){logger[_0x45b0('0x12')](_0x45b0('0xe'),_0x11177a,_0x1db6a3);_0x80a433(_0x1db6a3);});});}exports[_0x45b0('0x16')]=function(_0x475fdc){var _0x7870d2=this;return new Promise(function(_0x50a465,_0x2f85b8){return db[_0x45b0('0x17')][_0x45b0('0x18')]({'raw':_0x475fdc[_0x45b0('0x19')]?_0x475fdc[_0x45b0('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x475fdc[_0x45b0('0x19')]?_0x475fdc[_0x45b0('0x19')][_0x45b0('0x1a')]||null:null,'attributes':_0x475fdc[_0x45b0('0x19')]?_0x475fdc[_0x45b0('0x19')][_0x45b0('0x1b')]||null:null,'include':_0x475fdc['options']?_0x475fdc[_0x45b0('0x19')][_0x45b0('0x1c')]?_[_0x45b0('0x1d')](_0x475fdc['options'][_0x45b0('0x1c')],function(_0x3832cd){return{'model':db[_0x3832cd[_0x45b0('0x1e')]],'as':_0x3832cd['as'],'attributes':_0x3832cd[_0x45b0('0x1b')],'include':_0x3832cd[_0x45b0('0x1c')]?_[_0x45b0('0x1d')](_0x3832cd[_0x45b0('0x1c')],function(_0x9fa3f3){return{'model':db[_0x9fa3f3[_0x45b0('0x1e')]],'as':_0x9fa3f3['as'],'attributes':_0x9fa3f3['attributes'],'include':_0x9fa3f3['include']?_[_0x45b0('0x1d')](_0x9fa3f3[_0x45b0('0x1c')],function(_0x504ef7){return{'model':db[_0x504ef7[_0x45b0('0x1e')]],'as':_0x504ef7['as'],'attributes':_0x504ef7[_0x45b0('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c7bf0){logger[_0x45b0('0xd')](_0x45b0('0x16'),_0x475fdc);logger[_0x45b0('0x10')](_0x45b0('0x16'),_0x475fdc,JSON[_0x45b0('0x1f')](_0x1c7bf0));_0x50a465(_0x1c7bf0);})[_0x45b0('0x15')](function(_0xb75aa0){logger[_0x45b0('0x12')]('ShowSound',_0xb75aa0[_0x45b0('0x13')],_0x475fdc);_0x2f85b8(_0x7870d2[_0x45b0('0x12')](0x1f4,_0xb75aa0[_0x45b0('0x13')]));});});}; \ No newline at end of file +var _0x06c5=['ShowSound','find','options','raw','where','attributes','include','map','model','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x39b9df,_0x54b93b){var _0xa2da9d=function(_0x58482){while(--_0x58482){_0x39b9df['push'](_0x39b9df['shift']());}};_0xa2da9d(++_0x54b93b);}(_0x06c5,0xe9));var _0x506c=function(_0x281093,_0x1b183a){_0x281093=_0x281093-0x0;var _0x853252=_0x06c5[_0x281093];return _0x853252;};'use strict';var _=require('lodash');var util=require(_0x506c('0x0'));var moment=require(_0x506c('0x1'));var BPromise=require(_0x506c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x506c('0x3'));var db=require(_0x506c('0x4'))['db'];var utils=require(_0x506c('0x5'));var logger=require('../../config/logger')(_0x506c('0x6'));var config=require(_0x506c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x506c('0x8')][_0x506c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x249cab,_0x3513df,_0x108ab9){return new BPromise(function(_0x34975c,_0x6141c4){return client[_0x506c('0xa')](_0x249cab,_0x108ab9)[_0x506c('0xb')](function(_0xedb53c){logger[_0x506c('0xc')](_0x506c('0xd'),_0x3513df,_0x506c('0xe'));logger[_0x506c('0xf')](_0x506c('0x10'),_0x3513df,_0x506c('0xe'),JSON[_0x506c('0x11')](_0xedb53c));if(_0xedb53c[_0x506c('0x12')]){if(_0xedb53c['error'][_0x506c('0x13')]===0x1f4){logger[_0x506c('0x12')](_0x506c('0xd'),_0x3513df,_0xedb53c['error']['message']);return _0x6141c4(_0xedb53c[_0x506c('0x12')][_0x506c('0x14')]);}logger[_0x506c('0x12')](_0x506c('0xd'),_0x3513df,_0xedb53c[_0x506c('0x12')][_0x506c('0x14')]);return _0x34975c(_0xedb53c[_0x506c('0x12')][_0x506c('0x14')]);}else{logger[_0x506c('0xc')]('Sound,\x20%s,\x20%s',_0x3513df,_0x506c('0xe'));_0x34975c(_0xedb53c[_0x506c('0x15')][_0x506c('0x14')]);}})[_0x506c('0x16')](function(_0x2fd65c){logger[_0x506c('0x12')]('Sound,\x20%s,\x20%s',_0x3513df,_0x2fd65c);_0x6141c4(_0x2fd65c);});});}exports[_0x506c('0x17')]=function(_0x199659){var _0x1a26c1=this;return new Promise(function(_0x128e99,_0x5e37ed){return db['Sound'][_0x506c('0x18')]({'raw':_0x199659[_0x506c('0x19')]?_0x199659[_0x506c('0x19')][_0x506c('0x1a')]===undefined?!![]:![]:!![],'where':_0x199659['options']?_0x199659[_0x506c('0x19')][_0x506c('0x1b')]||null:null,'attributes':_0x199659[_0x506c('0x19')]?_0x199659[_0x506c('0x19')][_0x506c('0x1c')]||null:null,'include':_0x199659['options']?_0x199659[_0x506c('0x19')][_0x506c('0x1d')]?_[_0x506c('0x1e')](_0x199659[_0x506c('0x19')][_0x506c('0x1d')],function(_0x1ac21c){return{'model':db[_0x1ac21c['model']],'as':_0x1ac21c['as'],'attributes':_0x1ac21c[_0x506c('0x1c')],'include':_0x1ac21c[_0x506c('0x1d')]?_[_0x506c('0x1e')](_0x1ac21c['include'],function(_0x595951){return{'model':db[_0x595951[_0x506c('0x1f')]],'as':_0x595951['as'],'attributes':_0x595951['attributes'],'include':_0x595951[_0x506c('0x1d')]?_[_0x506c('0x1e')](_0x595951[_0x506c('0x1d')],function(_0x317d52){return{'model':db[_0x317d52[_0x506c('0x1f')]],'as':_0x317d52['as'],'attributes':_0x317d52[_0x506c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x506c('0xb')](function(_0x9dfec5){logger[_0x506c('0xc')]('ShowSound',_0x199659);logger['debug'](_0x506c('0x17'),_0x199659,JSON['stringify'](_0x9dfec5));_0x128e99(_0x9dfec5);})['catch'](function(_0x1ad183){logger[_0x506c('0x12')](_0x506c('0x17'),_0x1ad183[_0x506c('0x14')],_0x199659);_0x5e37ed(_0x1a26c1[_0x506c('0x12')](0x1f4,_0x1ad183[_0x506c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index e9ccc40..68e2492 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 _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x3bfc70,_0x5719e9){var _0x4fa9a2=function(_0x21d524){while(--_0x21d524){_0x3bfc70['push'](_0x3bfc70['shift']());}};_0x4fa9a2(++_0x5719e9);}(_0x5eb8,0xb0));var _0x85eb=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0x5eb8[_0xac0de1];return _0x1c1995;};'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['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +var _0x0b0e=['./squareMessage.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x100e0c,_0x5523b8){var _0x4db1aa=function(_0x29f480){while(--_0x29f480){_0x100e0c['push'](_0x100e0c['shift']());}};_0x4db1aa(++_0x5523b8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x42e4d7,_0x4bd202){_0x42e4d7=_0x42e4d7-0x0;var _0x346cd8=_0x0b0e[_0x42e4d7];return _0x346cd8;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 29f15bc..495cc30 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 _0xb1f7=['ENUM','out','STRING','sequelize','exports','TEXT','medium'];(function(_0x4a4f9e,_0x21a713){var _0x12beea=function(_0xdf9cb7){while(--_0xdf9cb7){_0x4a4f9e['push'](_0x4a4f9e['shift']());}};_0x12beea(++_0x21a713);}(_0xb1f7,0x184));var _0x7b1f=function(_0x4ab48b,_0x33fd57){_0x4ab48b=_0x4ab48b-0x0;var _0x3d13=_0xb1f7[_0x4ab48b];return _0x3d13;};'use strict';var Sequelize=require(_0x7b1f('0x0'));module[_0x7b1f('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x7b1f('0x2')](_0x7b1f('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x7b1f('0x4')]('in',_0x7b1f('0x5')),'defaultValue':_0x7b1f('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x7b1f('0x6')]},'providerResponse':{'type':Sequelize[_0x7b1f('0x2')]}}; \ No newline at end of file +var _0xd922=['sequelize','exports','STRING','TEXT','medium','ENUM','out'];(function(_0x1e34b1,_0x47b7f0){var _0x18aeec=function(_0x2e5dd4){while(--_0x2e5dd4){_0x1e34b1['push'](_0x1e34b1['shift']());}};_0x18aeec(++_0x47b7f0);}(_0xd922,0x12d));var _0x2d92=function(_0x238e2e,_0x10105e){_0x238e2e=_0x238e2e-0x0;var _0x4dd2db=_0xd922[_0x238e2e];return _0x4dd2db;};'use strict';var Sequelize=require(_0x2d92('0x0'));module[_0x2d92('0x1')]={'uniqueid':{'type':Sequelize[_0x2d92('0x2')]},'body':{'type':Sequelize[_0x2d92('0x3')](_0x2d92('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x2d92('0x5')]('in',_0x2d92('0x6')),'defaultValue':_0x2d92('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x2d92('0x2')]},'providerResponse':{'type':Sequelize[_0x2d92('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index f348db1..646f41d 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 _0xff2e=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset','count','limit','set','json','apply','then','destroy','sendStatus','name','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','sort','pick','filter','where','map','type','SquareMessage','include','findAll','rows','catch','show','params','keys','includeAll','merge','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x34b3f9,_0x3eedbc){var _0x3b0d22=function(_0xa7df09){while(--_0xa7df09){_0x34b3f9['push'](_0x34b3f9['shift']());}};_0x3b0d22(++_0x3eedbc);}(_0xff2e,0xff));var _0xeff2=function(_0x44e9da,_0x49dfc7){_0x44e9da=_0x44e9da-0x0;var _0x36ed46=_0xff2e[_0x44e9da];return _0x36ed46;};'use strict';var emlformat=require(_0xeff2('0x0'));var rimraf=require(_0xeff2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeff2('0x2'));var rp=require(_0xeff2('0x3'));var moment=require(_0xeff2('0x4'));var BPromise=require(_0xeff2('0x5'));var Mustache=require(_0xeff2('0x6'));var util=require(_0xeff2('0x7'));var path=require(_0xeff2('0x8'));var sox=require(_0xeff2('0x9'));var csv=require(_0xeff2('0xa'));var ejs=require(_0xeff2('0xb'));var fs=require('fs');var fs_extra=require(_0xeff2('0xc'));var _=require('lodash');var squel=require(_0xeff2('0xd'));var crypto=require(_0xeff2('0xe'));var jsforce=require(_0xeff2('0xf'));var deskjs=require(_0xeff2('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeff2('0x11'));var Papa=require(_0xeff2('0x12'));var Redis=require(_0xeff2('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xeff2('0x14'));var as=require(_0xeff2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeff2('0x16'))(_0xeff2('0x17'));var utils=require(_0xeff2('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeff2('0x19'))['db'];function respondWithStatusCode(_0x43a459,_0x4dc43e){_0x4dc43e=_0x4dc43e||0xcc;return function(_0x3b91bc){if(_0x3b91bc){return _0x43a459['sendStatus'](_0x4dc43e);}return _0x43a459[_0xeff2('0x1a')](_0x4dc43e)[_0xeff2('0x1b')]();};}function respondWithResult(_0x11f1d3,_0x2ece68){_0x2ece68=_0x2ece68||0xc8;return function(_0x2f0379){if(_0x2f0379){return _0x11f1d3[_0xeff2('0x1a')](_0x2ece68)['json'](_0x2f0379);}};}function respondWithFilteredResult(_0x12e1c2,_0x5c7611){return function(_0x1fa53d){if(_0x1fa53d){var _0x59c9d5=typeof _0x5c7611[_0xeff2('0x1c')]==='undefined'&&typeof _0x5c7611['limit']==='undefined';var _0x2b3ef0=_0x1fa53d[_0xeff2('0x1d')];var _0x32946f=_0x59c9d5?0x0:_0x5c7611[_0xeff2('0x1c')];var _0x3e0a5d=_0x59c9d5?_0x1fa53d[_0xeff2('0x1d')]:_0x5c7611[_0xeff2('0x1c')]+_0x5c7611[_0xeff2('0x1e')];var _0x28a0c9;if(_0x3e0a5d>=_0x2b3ef0){_0x3e0a5d=_0x2b3ef0;_0x28a0c9=0xc8;}else{_0x28a0c9=0xce;}_0x12e1c2[_0xeff2('0x1a')](_0x28a0c9);return _0x12e1c2[_0xeff2('0x1f')]('Content-Range',_0x32946f+'-'+_0x3e0a5d+'/'+_0x2b3ef0)[_0xeff2('0x20')](_0x1fa53d);}return null;};}function patchUpdates(_0xff496b){return function(_0x5bf6ca){try{jsonpatch[_0xeff2('0x21')](_0x5bf6ca,_0xff496b,!![]);}catch(_0x3d19a2){return BPromise['reject'](_0x3d19a2);}return _0x5bf6ca['save']();};}function saveUpdates(_0x49411f,_0x48608b){return function(_0x30ce29){if(_0x30ce29){return _0x30ce29['update'](_0x49411f)[_0xeff2('0x22')](function(_0x34f396){return _0x34f396;});}return null;};}function removeEntity(_0x139350,_0x7aa3d9){return function(_0x56554e){if(_0x56554e){return _0x56554e[_0xeff2('0x23')]()['then'](function(){_0x139350[_0xeff2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23ec5f,_0x221607){return function(_0x1e393e){if(!_0x1e393e){_0x23ec5f[_0xeff2('0x24')](0x194);}return _0x1e393e;};}function handleError(_0x14105f,_0x34bee0){_0x34bee0=_0x34bee0||0x1f4;return function(_0x1d2fbf){logger['error'](_0x1d2fbf['stack']);if(_0x1d2fbf['name']){delete _0x1d2fbf[_0xeff2('0x25')];}_0x14105f[_0xeff2('0x1a')](_0x34bee0)['send'](_0x1d2fbf);};}exports['index']=function(_0x5c6254,_0x2cba21){var _0x2cc14b={},_0x3fc93c={},_0x26fa1a={'count':0x0,'rows':[]};var _0x554033=_['map'](db['SquareMessage'][_0xeff2('0x26')],function(_0x39e7ae){return{'name':_0x39e7ae[_0xeff2('0x27')],'type':_0x39e7ae['type']['key']};});_0x3fc93c[_0xeff2('0x28')]=_['map'](_0x554033,_0xeff2('0x25'));_0x3fc93c[_0xeff2('0x29')]=_['keys'](_0x5c6254[_0xeff2('0x29')]);_0x3fc93c[_0xeff2('0x2a')]=_[_0xeff2('0x2b')](_0x3fc93c[_0xeff2('0x28')],_0x3fc93c['query']);_0x2cc14b[_0xeff2('0x2c')]=_['intersection'](_0x3fc93c['model'],qs['fields'](_0x5c6254[_0xeff2('0x29')][_0xeff2('0x2d')]));_0x2cc14b[_0xeff2('0x2c')]=_0x2cc14b[_0xeff2('0x2c')][_0xeff2('0x2e')]?_0x2cc14b[_0xeff2('0x2c')]:_0x3fc93c[_0xeff2('0x28')];if(!_0x5c6254[_0xeff2('0x29')]['hasOwnProperty']('nolimit')){_0x2cc14b[_0xeff2('0x1e')]=qs['limit'](_0x5c6254[_0xeff2('0x29')]['limit']);_0x2cc14b[_0xeff2('0x1c')]=qs['offset'](_0x5c6254['query'][_0xeff2('0x1c')]);}_0x2cc14b['order']=qs[_0xeff2('0x2f')](_0x5c6254['query'][_0xeff2('0x2f')]);_0x2cc14b['where']=qs[_0xeff2('0x2a')](_[_0xeff2('0x30')](_0x5c6254[_0xeff2('0x29')],_0x3fc93c[_0xeff2('0x2a')]),_0x554033);if(_0x5c6254[_0xeff2('0x29')][_0xeff2('0x31')]){_0x2cc14b[_0xeff2('0x32')]=_['merge'](_0x2cc14b['where'],{'$or':_[_0xeff2('0x33')](_0x554033,function(_0x9e5201){if(_0x9e5201[_0xeff2('0x34')]!=='VIRTUAL'){var _0x50ef48={};_0x50ef48[_0x9e5201[_0xeff2('0x25')]]={'$like':'%'+_0x5c6254[_0xeff2('0x29')][_0xeff2('0x31')]+'%'};return _0x50ef48;}})});}_0x2cc14b=_['merge']({},_0x2cc14b,_0x5c6254['options']);var _0x575653={'where':_0x2cc14b['where']};return db[_0xeff2('0x35')][_0xeff2('0x1d')](_0x575653)[_0xeff2('0x22')](function(_0x537304){_0x26fa1a[_0xeff2('0x1d')]=_0x537304;if(_0x5c6254[_0xeff2('0x29')]['includeAll']){_0x2cc14b[_0xeff2('0x36')]=[{'all':!![]}];}return db[_0xeff2('0x35')][_0xeff2('0x37')](_0x2cc14b);})[_0xeff2('0x22')](function(_0x2f2ed9){_0x26fa1a[_0xeff2('0x38')]=_0x2f2ed9;return _0x26fa1a;})['then'](respondWithFilteredResult(_0x2cba21,_0x2cc14b))[_0xeff2('0x39')](handleError(_0x2cba21,null));};exports[_0xeff2('0x3a')]=function(_0x545b3c,_0x27ff03){var _0x37e912={'raw':!![],'where':{'id':_0x545b3c[_0xeff2('0x3b')]['id']}},_0x2268d7={};_0x2268d7['model']=_[_0xeff2('0x3c')](db[_0xeff2('0x35')][_0xeff2('0x26')]);_0x2268d7['query']=_[_0xeff2('0x3c')](_0x545b3c[_0xeff2('0x29')]);_0x2268d7[_0xeff2('0x2a')]=_[_0xeff2('0x2b')](_0x2268d7[_0xeff2('0x28')],_0x2268d7['query']);_0x37e912['attributes']=_[_0xeff2('0x2b')](_0x2268d7[_0xeff2('0x28')],qs[_0xeff2('0x2d')](_0x545b3c[_0xeff2('0x29')][_0xeff2('0x2d')]));_0x37e912[_0xeff2('0x2c')]=_0x37e912['attributes'][_0xeff2('0x2e')]?_0x37e912[_0xeff2('0x2c')]:_0x2268d7[_0xeff2('0x28')];if(_0x545b3c[_0xeff2('0x29')][_0xeff2('0x3d')]){_0x37e912[_0xeff2('0x36')]=[{'all':!![]}];}_0x37e912=_[_0xeff2('0x3e')]({},_0x37e912,_0x545b3c[_0xeff2('0x3f')]);return db['SquareMessage'][_0xeff2('0x40')](_0x37e912)[_0xeff2('0x22')](handleEntityNotFound(_0x27ff03,null))[_0xeff2('0x22')](respondWithResult(_0x27ff03,null))['catch'](handleError(_0x27ff03,null));};exports[_0xeff2('0x41')]=function(_0x2223aa,_0x5ca7e9){return db['SquareMessage'][_0xeff2('0x41')](_0x2223aa[_0xeff2('0x42')],{})['then'](respondWithResult(_0x5ca7e9,0xc9))[_0xeff2('0x39')](handleError(_0x5ca7e9,null));};exports['update']=function(_0x53c2f9,_0x48b97e){if(_0x53c2f9[_0xeff2('0x42')]['id']){delete _0x53c2f9[_0xeff2('0x42')]['id'];}return db[_0xeff2('0x35')][_0xeff2('0x40')]({'where':{'id':_0x53c2f9[_0xeff2('0x3b')]['id']}})[_0xeff2('0x22')](handleEntityNotFound(_0x48b97e,null))[_0xeff2('0x22')](saveUpdates(_0x53c2f9[_0xeff2('0x42')],null))[_0xeff2('0x22')](respondWithResult(_0x48b97e,null))[_0xeff2('0x39')](handleError(_0x48b97e,null));};exports['destroy']=function(_0x5c6587,_0x552fad){return db[_0xeff2('0x35')][_0xeff2('0x40')]({'where':{'id':_0x5c6587[_0xeff2('0x3b')]['id']}})[_0xeff2('0x22')](handleEntityNotFound(_0x552fad,null))['then'](removeEntity(_0x552fad,null))['catch'](handleError(_0x552fad,null));}; \ No newline at end of file +var _0x4eb8=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge','options','includeAll','include','show','params','rawAttributes','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1de28e,_0x88e63c){var _0x2c85de=function(_0x5ebb90){while(--_0x5ebb90){_0x1de28e['push'](_0x1de28e['shift']());}};_0x2c85de(++_0x88e63c);}(_0x4eb8,0x1b5));var _0x84eb=function(_0x4375fb,_0x22650a){_0x4375fb=_0x4375fb-0x0;var _0x445a97=_0x4eb8[_0x4375fb];return _0x445a97;};'use strict';var emlformat=require(_0x84eb('0x0'));var rimraf=require(_0x84eb('0x1'));var zipdir=require(_0x84eb('0x2'));var jsonpatch=require(_0x84eb('0x3'));var rp=require('request-promise');var moment=require(_0x84eb('0x4'));var BPromise=require(_0x84eb('0x5'));var Mustache=require(_0x84eb('0x6'));var util=require(_0x84eb('0x7'));var path=require(_0x84eb('0x8'));var sox=require(_0x84eb('0x9'));var csv=require(_0x84eb('0xa'));var ejs=require(_0x84eb('0xb'));var fs=require('fs');var fs_extra=require(_0x84eb('0xc'));var _=require('lodash');var squel=require(_0x84eb('0xd'));var crypto=require(_0x84eb('0xe'));var jsforce=require(_0x84eb('0xf'));var deskjs=require(_0x84eb('0x10'));var toCsv=require(_0x84eb('0xa'));var querystring=require(_0x84eb('0x11'));var Papa=require(_0x84eb('0x12'));var Redis=require(_0x84eb('0x13'));var authService=require(_0x84eb('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x84eb('0x15'));var hardwareService=require(_0x84eb('0x16'));var logger=require(_0x84eb('0x17'))(_0x84eb('0x18'));var utils=require('../../config/utils');var config=require(_0x84eb('0x19'));var licenseUtil=require(_0x84eb('0x1a'));var db=require(_0x84eb('0x1b'))['db'];function respondWithStatusCode(_0xf15f82,_0x24b04a){_0x24b04a=_0x24b04a||0xcc;return function(_0x57c8f7){if(_0x57c8f7){return _0xf15f82[_0x84eb('0x1c')](_0x24b04a);}return _0xf15f82[_0x84eb('0x1d')](_0x24b04a)[_0x84eb('0x1e')]();};}function respondWithResult(_0x10f4e1,_0x216068){_0x216068=_0x216068||0xc8;return function(_0x44783b){if(_0x44783b){return _0x10f4e1[_0x84eb('0x1d')](_0x216068)[_0x84eb('0x1f')](_0x44783b);}};}function respondWithFilteredResult(_0x2670ae,_0xb19d09){return function(_0x264565){if(_0x264565){var _0x2f2785=typeof _0xb19d09['offset']===_0x84eb('0x20')&&typeof _0xb19d09[_0x84eb('0x21')]===_0x84eb('0x20');var _0x522e7e=_0x264565['count'];var _0x5718a4=_0x2f2785?0x0:_0xb19d09['offset'];var _0x529357=_0x2f2785?_0x264565[_0x84eb('0x22')]:_0xb19d09[_0x84eb('0x23')]+_0xb19d09[_0x84eb('0x21')];var _0x5bac61;if(_0x529357>=_0x522e7e){_0x529357=_0x522e7e;_0x5bac61=0xc8;}else{_0x5bac61=0xce;}_0x2670ae[_0x84eb('0x1d')](_0x5bac61);return _0x2670ae[_0x84eb('0x24')](_0x84eb('0x25'),_0x5718a4+'-'+_0x529357+'/'+_0x522e7e)[_0x84eb('0x1f')](_0x264565);}return null;};}function patchUpdates(_0x26dcfd){return function(_0x37994b){try{jsonpatch[_0x84eb('0x26')](_0x37994b,_0x26dcfd,!![]);}catch(_0x5730fd){return BPromise[_0x84eb('0x27')](_0x5730fd);}return _0x37994b[_0x84eb('0x28')]();};}function saveUpdates(_0x4c62d7,_0x1e2e76){return function(_0x5d64cb){if(_0x5d64cb){return _0x5d64cb[_0x84eb('0x29')](_0x4c62d7)[_0x84eb('0x2a')](function(_0x5a8e60){return _0x5a8e60;});}return null;};}function removeEntity(_0x352989,_0x1fb507){return function(_0x466746){if(_0x466746){return _0x466746[_0x84eb('0x2b')]()[_0x84eb('0x2a')](function(){_0x352989[_0x84eb('0x1d')](0xcc)[_0x84eb('0x1e')]();});}};}function handleEntityNotFound(_0x3ecf72,_0x48528a){return function(_0x1e71f7){if(!_0x1e71f7){_0x3ecf72[_0x84eb('0x1c')](0x194);}return _0x1e71f7;};}function handleError(_0x1dc5f2,_0xa0ef02){_0xa0ef02=_0xa0ef02||0x1f4;return function(_0xb13f7){logger[_0x84eb('0x2c')](_0xb13f7[_0x84eb('0x2d')]);if(_0xb13f7[_0x84eb('0x2e')]){delete _0xb13f7[_0x84eb('0x2e')];}_0x1dc5f2[_0x84eb('0x1d')](_0xa0ef02)[_0x84eb('0x2f')](_0xb13f7);};}exports[_0x84eb('0x30')]=function(_0x22e11c,_0x44e4de){var _0x5d812d={},_0x53447d={},_0x105774={'count':0x0,'rows':[]};var _0x181146=_[_0x84eb('0x31')](db[_0x84eb('0x32')]['rawAttributes'],function(_0x430920){return{'name':_0x430920[_0x84eb('0x33')],'type':_0x430920[_0x84eb('0x34')]['key']};});_0x53447d[_0x84eb('0x35')]=_[_0x84eb('0x31')](_0x181146,_0x84eb('0x2e'));_0x53447d['query']=_[_0x84eb('0x36')](_0x22e11c['query']);_0x53447d[_0x84eb('0x37')]=_[_0x84eb('0x38')](_0x53447d[_0x84eb('0x35')],_0x53447d[_0x84eb('0x39')]);_0x5d812d[_0x84eb('0x3a')]=_[_0x84eb('0x38')](_0x53447d[_0x84eb('0x35')],qs[_0x84eb('0x3b')](_0x22e11c['query'][_0x84eb('0x3b')]));_0x5d812d[_0x84eb('0x3a')]=_0x5d812d['attributes'][_0x84eb('0x3c')]?_0x5d812d[_0x84eb('0x3a')]:_0x53447d[_0x84eb('0x35')];if(!_0x22e11c[_0x84eb('0x39')][_0x84eb('0x3d')]('nolimit')){_0x5d812d[_0x84eb('0x21')]=qs[_0x84eb('0x21')](_0x22e11c[_0x84eb('0x39')][_0x84eb('0x21')]);_0x5d812d[_0x84eb('0x23')]=qs[_0x84eb('0x23')](_0x22e11c[_0x84eb('0x39')]['offset']);}_0x5d812d['order']=qs[_0x84eb('0x3e')](_0x22e11c['query'][_0x84eb('0x3e')]);_0x5d812d[_0x84eb('0x3f')]=qs[_0x84eb('0x37')](_['pick'](_0x22e11c[_0x84eb('0x39')],_0x53447d[_0x84eb('0x37')]),_0x181146);if(_0x22e11c['query'][_0x84eb('0x40')]){_0x5d812d[_0x84eb('0x3f')]=_['merge'](_0x5d812d[_0x84eb('0x3f')],{'$or':_[_0x84eb('0x31')](_0x181146,function(_0x24d1aa){if(_0x24d1aa[_0x84eb('0x34')]!==_0x84eb('0x41')){var _0x29f18a={};_0x29f18a[_0x24d1aa[_0x84eb('0x2e')]]={'$like':'%'+_0x22e11c[_0x84eb('0x39')]['filter']+'%'};return _0x29f18a;}})});}_0x5d812d=_[_0x84eb('0x42')]({},_0x5d812d,_0x22e11c[_0x84eb('0x43')]);var _0x5ddd8a={'where':_0x5d812d['where']};return db['SquareMessage'][_0x84eb('0x22')](_0x5ddd8a)[_0x84eb('0x2a')](function(_0x119a99){_0x105774['count']=_0x119a99;if(_0x22e11c[_0x84eb('0x39')][_0x84eb('0x44')]){_0x5d812d[_0x84eb('0x45')]=[{'all':!![]}];}return db[_0x84eb('0x32')]['findAll'](_0x5d812d);})[_0x84eb('0x2a')](function(_0x200454){_0x105774['rows']=_0x200454;return _0x105774;})[_0x84eb('0x2a')](respondWithFilteredResult(_0x44e4de,_0x5d812d))['catch'](handleError(_0x44e4de,null));};exports[_0x84eb('0x46')]=function(_0x269068,_0x35201b){var _0x4ccee1={'raw':!![],'where':{'id':_0x269068[_0x84eb('0x47')]['id']}},_0x57427e={};_0x57427e[_0x84eb('0x35')]=_['keys'](db[_0x84eb('0x32')][_0x84eb('0x48')]);_0x57427e[_0x84eb('0x39')]=_['keys'](_0x269068[_0x84eb('0x39')]);_0x57427e[_0x84eb('0x37')]=_[_0x84eb('0x38')](_0x57427e['model'],_0x57427e[_0x84eb('0x39')]);_0x4ccee1['attributes']=_[_0x84eb('0x38')](_0x57427e['model'],qs[_0x84eb('0x3b')](_0x269068[_0x84eb('0x39')][_0x84eb('0x3b')]));_0x4ccee1[_0x84eb('0x3a')]=_0x4ccee1['attributes'][_0x84eb('0x3c')]?_0x4ccee1['attributes']:_0x57427e[_0x84eb('0x35')];if(_0x269068[_0x84eb('0x39')][_0x84eb('0x44')]){_0x4ccee1[_0x84eb('0x45')]=[{'all':!![]}];}_0x4ccee1=_[_0x84eb('0x42')]({},_0x4ccee1,_0x269068[_0x84eb('0x43')]);return db[_0x84eb('0x32')][_0x84eb('0x49')](_0x4ccee1)['then'](handleEntityNotFound(_0x35201b,null))['then'](respondWithResult(_0x35201b,null))[_0x84eb('0x4a')](handleError(_0x35201b,null));};exports[_0x84eb('0x4b')]=function(_0x41be86,_0x58dd2b){return db['SquareMessage']['create'](_0x41be86[_0x84eb('0x4c')],{})[_0x84eb('0x2a')](respondWithResult(_0x58dd2b,0xc9))[_0x84eb('0x4a')](handleError(_0x58dd2b,null));};exports[_0x84eb('0x29')]=function(_0x2600f2,_0x55763a){if(_0x2600f2['body']['id']){delete _0x2600f2['body']['id'];}return db[_0x84eb('0x32')][_0x84eb('0x49')]({'where':{'id':_0x2600f2[_0x84eb('0x47')]['id']}})[_0x84eb('0x2a')](handleEntityNotFound(_0x55763a,null))[_0x84eb('0x2a')](saveUpdates(_0x2600f2[_0x84eb('0x4c')],null))[_0x84eb('0x2a')](respondWithResult(_0x55763a,null))[_0x84eb('0x4a')](handleError(_0x55763a,null));};exports[_0x84eb('0x2b')]=function(_0x1f0417,_0x1f14b3){return db[_0x84eb('0x32')][_0x84eb('0x49')]({'where':{'id':_0x1f0417[_0x84eb('0x47')]['id']}})[_0x84eb('0x2a')](handleEntityNotFound(_0x1f14b3,null))[_0x84eb('0x2a')](removeEntity(_0x1f14b3,null))[_0x84eb('0x4a')](handleError(_0x1f14b3,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index e512695..a98cb11 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 _0xa4ee=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages'];(function(_0x11cf77,_0x3c2473){var _0x315bdf=function(_0x3fd74d){while(--_0x3fd74d){_0x11cf77['push'](_0x11cf77['shift']());}};_0x315bdf(++_0x3c2473);}(_0xa4ee,0x70));var _0xea4e=function(_0x2a1275,_0x20c2d2){_0x2a1275=_0x2a1275-0x0;var _0x2e4ed9=_0xa4ee[_0x2a1275];return _0x2e4ed9;};'use strict';var _=require(_0xea4e('0x0'));var util=require(_0xea4e('0x1'));var logger=require(_0xea4e('0x2'))(_0xea4e('0x3'));var moment=require('moment');var BPromise=require(_0xea4e('0x4'));var rp=require(_0xea4e('0x5'));var fs=require('fs');var path=require(_0xea4e('0x6'));var rimraf=require(_0xea4e('0x7'));var config=require(_0xea4e('0x8'));var attributes=require(_0xea4e('0x9'));module[_0xea4e('0xa')]=function(_0x50bc26,_0x4c7763){return _0x50bc26[_0xea4e('0xb')](_0xea4e('0xc'),attributes,{'tableName':_0xea4e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c7a=['SquareMessage','square_messages','lodash','util','../../config/logger','api','rimraf','../../config/environment','exports'];(function(_0x303d9d,_0x363884){var _0x4ccd15=function(_0x1b497b){while(--_0x1b497b){_0x303d9d['push'](_0x303d9d['shift']());}};_0x4ccd15(++_0x363884);}(_0x8c7a,0x18e));var _0xa8c7=function(_0x4222d8,_0x3836cf){_0x4222d8=_0x4222d8-0x0;var _0x537911=_0x8c7a[_0x4222d8];return _0x537911;};'use strict';var _=require(_0xa8c7('0x0'));var util=require(_0xa8c7('0x1'));var logger=require(_0xa8c7('0x2'))(_0xa8c7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa8c7('0x4'));var config=require(_0xa8c7('0x5'));var attributes=require('./squareMessage.attributes');module[_0xa8c7('0x6')]=function(_0x126971,_0x2db3e2){return _0x126971['define'](_0xa8c7('0x7'),attributes,{'tableName':_0xa8c7('0x8'),'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 210a343..8d1ac62 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 _0xfbc2=['rpc','../../config/environment','client','http','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','then','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3c162a,_0x56d4ac){var _0x340794=function(_0x2c3c14){while(--_0x2c3c14){_0x3c162a['push'](_0x3c162a['shift']());}};_0x340794(++_0x56d4ac);}(_0xfbc2,0xb7));var _0x2fbc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfbc2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2fbc('0x0'));var util=require('util');var moment=require(_0x2fbc('0x1'));var BPromise=require(_0x2fbc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2fbc('0x3'))['db'];var utils=require(_0x2fbc('0x4'));var logger=require(_0x2fbc('0x5'))(_0x2fbc('0x6'));var config=require(_0x2fbc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2fbc('0x8')][_0x2fbc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46b8f7,_0xd825e4,_0xe3419e){return new BPromise(function(_0x2688a4,_0x2406bf){return client['request'](_0x46b8f7,_0xe3419e)['then'](function(_0x39ad42){logger[_0x2fbc('0xa')](_0x2fbc('0xb'),_0xd825e4,'request\x20sent');logger[_0x2fbc('0xc')](_0x2fbc('0xd'),_0xd825e4,_0x2fbc('0xe'),JSON[_0x2fbc('0xf')](_0x39ad42));if(_0x39ad42[_0x2fbc('0x10')]){if(_0x39ad42['error'][_0x2fbc('0x11')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0xd825e4,_0x39ad42[_0x2fbc('0x10')][_0x2fbc('0x12')]);return _0x2406bf(_0x39ad42['error'][_0x2fbc('0x12')]);}logger[_0x2fbc('0x10')](_0x2fbc('0xb'),_0xd825e4,_0x39ad42['error'][_0x2fbc('0x12')]);return _0x2688a4(_0x39ad42[_0x2fbc('0x10')]['message']);}else{logger[_0x2fbc('0xa')]('SquareMessage,\x20%s,\x20%s',_0xd825e4,_0x2fbc('0xe'));_0x2688a4(_0x39ad42['result'][_0x2fbc('0x12')]);}})[_0x2fbc('0x13')](function(_0x567dcd){logger['error'](_0x2fbc('0xb'),_0xd825e4,_0x567dcd);_0x2406bf(_0x567dcd);});});}exports[_0x2fbc('0x14')]=function(_0x1be90d){var _0x31ae23=this;return new Promise(function(_0x524137,_0x42fd56){return db[_0x2fbc('0x15')][_0x2fbc('0x16')](_0x1be90d[_0x2fbc('0x17')],{'raw':_0x1be90d[_0x2fbc('0x18')]?_0x1be90d[_0x2fbc('0x18')][_0x2fbc('0x19')]===undefined?!![]:![]:!![]})[_0x2fbc('0x1a')](function(_0x2061c8){logger[_0x2fbc('0xa')](_0x2fbc('0x14'),_0x1be90d);logger['debug']('CreateSquareMessage',_0x1be90d,JSON[_0x2fbc('0xf')](_0x2061c8));_0x524137(_0x2061c8);})[_0x2fbc('0x13')](function(_0x5a1e86){logger[_0x2fbc('0x10')](_0x2fbc('0x14'),_0x5a1e86['message'],_0x1be90d);_0x42fd56(_0x31ae23[_0x2fbc('0x10')](0x1f4,_0x5a1e86['message']));});});}; \ No newline at end of file +var _0xa6f7=['create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateSquareMessage'];(function(_0x1c9f12,_0x387041){var _0x48a3fc=function(_0x1f0030){while(--_0x1f0030){_0x1c9f12['push'](_0x1c9f12['shift']());}};_0x48a3fc(++_0x387041);}(_0xa6f7,0x1e5));var _0x7a6f=function(_0x22eae1,_0x49d4e3){_0x22eae1=_0x22eae1-0x0;var _0x5eb074=_0xa6f7[_0x22eae1];return _0x5eb074;};'use strict';var _=require(_0x7a6f('0x0'));var util=require(_0x7a6f('0x1'));var moment=require(_0x7a6f('0x2'));var BPromise=require(_0x7a6f('0x3'));var rs=require(_0x7a6f('0x4'));var fs=require('fs');var Redis=require(_0x7a6f('0x5'));var db=require(_0x7a6f('0x6'))['db'];var utils=require(_0x7a6f('0x7'));var logger=require(_0x7a6f('0x8'))(_0x7a6f('0x9'));var config=require(_0x7a6f('0xa'));var jayson=require(_0x7a6f('0xb'));var client=jayson['client'][_0x7a6f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2779d6,_0x4cfdc6,_0x2a636b){return new BPromise(function(_0x3d82a8,_0xe3eabf){return client[_0x7a6f('0xd')](_0x2779d6,_0x2a636b)[_0x7a6f('0xe')](function(_0x8e336f){logger[_0x7a6f('0xf')](_0x7a6f('0x10'),_0x4cfdc6,_0x7a6f('0x11'));logger[_0x7a6f('0x12')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x4cfdc6,'request\x20sent',JSON['stringify'](_0x8e336f));if(_0x8e336f[_0x7a6f('0x13')]){if(_0x8e336f['error'][_0x7a6f('0x14')]===0x1f4){logger['error'](_0x7a6f('0x10'),_0x4cfdc6,_0x8e336f[_0x7a6f('0x13')][_0x7a6f('0x15')]);return _0xe3eabf(_0x8e336f[_0x7a6f('0x13')][_0x7a6f('0x15')]);}logger[_0x7a6f('0x13')](_0x7a6f('0x10'),_0x4cfdc6,_0x8e336f[_0x7a6f('0x13')][_0x7a6f('0x15')]);return _0x3d82a8(_0x8e336f['error'][_0x7a6f('0x15')]);}else{logger['info'](_0x7a6f('0x10'),_0x4cfdc6,_0x7a6f('0x11'));_0x3d82a8(_0x8e336f[_0x7a6f('0x16')][_0x7a6f('0x15')]);}})[_0x7a6f('0x17')](function(_0x57423a){logger[_0x7a6f('0x13')](_0x7a6f('0x10'),_0x4cfdc6,_0x57423a);_0xe3eabf(_0x57423a);});});}exports[_0x7a6f('0x18')]=function(_0x563953){var _0x3dde59=this;return new Promise(function(_0x3d43b0,_0x11f29e){return db['SquareMessage'][_0x7a6f('0x19')](_0x563953[_0x7a6f('0x1a')],{'raw':_0x563953[_0x7a6f('0x1b')]?_0x563953['options'][_0x7a6f('0x1c')]===undefined?!![]:![]:!![]})[_0x7a6f('0xe')](function(_0xf40693){logger[_0x7a6f('0xf')](_0x7a6f('0x18'),_0x563953);logger[_0x7a6f('0x12')](_0x7a6f('0x18'),_0x563953,JSON[_0x7a6f('0x1d')](_0xf40693));_0x3d43b0(_0xf40693);})['catch'](function(_0xa30ff2){logger['error'](_0x7a6f('0x18'),_0xa30ff2[_0x7a6f('0x15')],_0x563953);_0x11f29e(_0x3dde59[_0x7a6f('0x13')](0x1f4,_0xa30ff2[_0x7a6f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index e597b94..3a423b9 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 _0xd1dd=['/:id/test','15s','test','post','isAuthenticated','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x51639a,_0x35f006){var _0x3abae4=function(_0x89b35e){while(--_0x89b35e){_0x51639a['push'](_0x51639a['shift']());}};_0x3abae4(++_0x35f006);}(_0xd1dd,0x1ad));var _0xdd1d=function(_0x27903f,_0x163869){_0x27903f=_0x27903f-0x0;var _0x77a31=_0xd1dd[_0x27903f];return _0x77a31;};'use strict';var multer=require('multer');var util=require(_0xdd1d('0x0'));var path=require('path');var timeout=require(_0xdd1d('0x1'));var express=require(_0xdd1d('0x2'));var router=express[_0xdd1d('0x3')]();var fs_extra=require(_0xdd1d('0x4'));var auth=require(_0xdd1d('0x5'));var interaction=require(_0xdd1d('0x6'));var config=require(_0xdd1d('0x7'));var controller=require('./squareOdbc.controller');router[_0xdd1d('0x8')]('/',auth['isAuthenticated'](),controller[_0xdd1d('0x9')]);router[_0xdd1d('0x8')](_0xdd1d('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xdd1d('0x8')](_0xdd1d('0xb'),auth['isAuthenticated'](),timeout(_0xdd1d('0xc')),controller[_0xdd1d('0xd')]);router[_0xdd1d('0xe')]('/',auth[_0xdd1d('0xf')](),controller[_0xdd1d('0x10')]);router[_0xdd1d('0x11')]('/:id',auth[_0xdd1d('0xf')](),controller[_0xdd1d('0x12')]);router[_0xdd1d('0x13')]('/:id',auth[_0xdd1d('0xf')](),controller[_0xdd1d('0x14')]);module[_0xdd1d('0x15')]=router; \ No newline at end of file +var _0xe0c3=['put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s','test','create'];(function(_0x436cb5,_0x52275a){var _0x39dad2=function(_0x15e644){while(--_0x15e644){_0x436cb5['push'](_0x436cb5['shift']());}};_0x39dad2(++_0x52275a);}(_0xe0c3,0x17f));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x3e0c('0x0'));var path=require('path');var timeout=require(_0x3e0c('0x1'));var express=require('express');var router=express[_0x3e0c('0x2')]();var fs_extra=require(_0x3e0c('0x3'));var auth=require(_0x3e0c('0x4'));var interaction=require(_0x3e0c('0x5'));var config=require(_0x3e0c('0x6'));var controller=require(_0x3e0c('0x7'));router[_0x3e0c('0x8')]('/',auth[_0x3e0c('0x9')](),controller[_0x3e0c('0xa')]);router[_0x3e0c('0x8')](_0x3e0c('0xb'),auth[_0x3e0c('0x9')](),controller[_0x3e0c('0xc')]);router['get']('/:id/test',auth[_0x3e0c('0x9')](),timeout(_0x3e0c('0xd')),controller[_0x3e0c('0xe')]);router['post']('/',auth[_0x3e0c('0x9')](),controller[_0x3e0c('0xf')]);router[_0x3e0c('0x10')](_0x3e0c('0xb'),auth['isAuthenticated'](),controller[_0x3e0c('0x11')]);router[_0x3e0c('0x12')](_0x3e0c('0xb'),auth[_0x3e0c('0x9')](),controller[_0x3e0c('0x13')]);module[_0x3e0c('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index a4133c7..cc2a126 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 _0x5642=['name','STRING','sequelize','exports'];(function(_0x4d745e,_0x508b76){var _0x4b759a=function(_0x22813a){while(--_0x22813a){_0x4d745e['push'](_0x4d745e['shift']());}};_0x4b759a(++_0x508b76);}(_0x5642,0x142));var _0x2564=function(_0x56871d,_0x3d472b){_0x56871d=_0x56871d-0x0;var _0x31be03=_0x5642[_0x56871d];return _0x31be03;};'use strict';var Sequelize=require(_0x2564('0x0'));module[_0x2564('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2564('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x2564('0x3')]},'description':{'type':Sequelize[_0x2564('0x3')]}}; \ No newline at end of file +var _0x9bde=['exports'];(function(_0x2cc589,_0x1f9977){var _0x390ee8=function(_0x39cff8){while(--_0x39cff8){_0x2cc589['push'](_0x2cc589['shift']());}};_0x390ee8(++_0x1f9977);}(_0x9bde,0x183));var _0xe9bd=function(_0x1a1c89,_0x3e6659){_0x1a1c89=_0x1a1c89-0x0;var _0x16d785=_0x9bde[_0x1a1c89];return _0x16d785;};'use strict';var Sequelize=require('sequelize');module[_0xe9bd('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 0b77a64..5e1555a 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 _0xa759=['UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','params','dsn','odbc','openSync','closeSync','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','ODBC','destroy','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','SquareOdbc','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation'];(function(_0x252314,_0x760a80){var _0x5b68c0=function(_0x251251){while(--_0x251251){_0x252314['push'](_0x252314['shift']());}};_0x5b68c0(++_0x760a80);}(_0xa759,0xb6));var _0x9a75=function(_0x415603,_0x21320c){_0x415603=_0x415603-0x0;var _0x131e72=_0xa759[_0x415603];return _0x131e72;};'use strict';var emlformat=require(_0x9a75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a75('0x1'));var jsonpatch=require(_0x9a75('0x2'));var rp=require('request-promise');var moment=require(_0x9a75('0x3'));var BPromise=require(_0x9a75('0x4'));var Mustache=require(_0x9a75('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9a75('0x6'));var csv=require(_0x9a75('0x7'));var ejs=require(_0x9a75('0x8'));var fs=require('fs');var fs_extra=require(_0x9a75('0x9'));var _=require(_0x9a75('0xa'));var squel=require(_0x9a75('0xb'));var crypto=require(_0x9a75('0xc'));var jsforce=require(_0x9a75('0xd'));var deskjs=require(_0x9a75('0xe'));var toCsv=require(_0x9a75('0x7'));var querystring=require(_0x9a75('0xf'));var Papa=require(_0x9a75('0x10'));var Redis=require(_0x9a75('0x11'));var authService=require(_0x9a75('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9a75('0x13'));var hardwareService=require(_0x9a75('0x14'));var logger=require(_0x9a75('0x15'))(_0x9a75('0x16'));var utils=require(_0x9a75('0x17'));var config=require(_0x9a75('0x18'));var licenseUtil=require(_0x9a75('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d48d9,_0x5f25ef){_0x5f25ef=_0x5f25ef||0xcc;return function(_0x14c787){if(_0x14c787){return _0x4d48d9[_0x9a75('0x1a')](_0x5f25ef);}return _0x4d48d9[_0x9a75('0x1b')](_0x5f25ef)['end']();};}function respondWithResult(_0x36bd3f,_0x1bec7e){_0x1bec7e=_0x1bec7e||0xc8;return function(_0x386353){if(_0x386353){return _0x36bd3f[_0x9a75('0x1b')](_0x1bec7e)[_0x9a75('0x1c')](_0x386353);}};}function respondWithFilteredResult(_0x7ea4a8,_0x46ab5d){return function(_0x113605){if(_0x113605){var _0x3d3600=typeof _0x46ab5d[_0x9a75('0x1d')]===_0x9a75('0x1e')&&typeof _0x46ab5d[_0x9a75('0x1f')]===_0x9a75('0x1e');var _0x53f52f=_0x113605['count'];var _0x5a2ff4=_0x3d3600?0x0:_0x46ab5d['offset'];var _0x520559=_0x3d3600?_0x113605[_0x9a75('0x20')]:_0x46ab5d[_0x9a75('0x1d')]+_0x46ab5d['limit'];var _0x14e4e3;if(_0x520559>=_0x53f52f){_0x520559=_0x53f52f;_0x14e4e3=0xc8;}else{_0x14e4e3=0xce;}_0x7ea4a8[_0x9a75('0x1b')](_0x14e4e3);return _0x7ea4a8['set'](_0x9a75('0x21'),_0x5a2ff4+'-'+_0x520559+'/'+_0x53f52f)[_0x9a75('0x1c')](_0x113605);}return null;};}function patchUpdates(_0x1cca1c){return function(_0x71787f){try{jsonpatch[_0x9a75('0x22')](_0x71787f,_0x1cca1c,!![]);}catch(_0x364885){return BPromise['reject'](_0x364885);}return _0x71787f[_0x9a75('0x23')]();};}function saveUpdates(_0x1bccf8,_0x20eae4){return function(_0x9028cf){if(_0x9028cf){return _0x9028cf[_0x9a75('0x24')](_0x1bccf8)[_0x9a75('0x25')](function(_0x281faf){return _0x281faf;});}return null;};}function removeEntity(_0x28db61,_0x214791){return function(_0x304090){if(_0x304090){return _0x304090['destroy']()[_0x9a75('0x25')](function(){var _0x23e3d1=_0x304090[_0x9a75('0x26')]({'plain':!![]});var _0x27120c=_0x9a75('0x27');return db['UserProfileResource'][_0x9a75('0x28')]({'where':{'type':_0x27120c,'resourceId':_0x23e3d1['id']}})['then'](function(){return _0x304090;});})[_0x9a75('0x25')](function(){_0x28db61[_0x9a75('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15905b,_0x1f6344){return function(_0x22b2ba){if(!_0x22b2ba){_0x15905b[_0x9a75('0x1a')](0x194);}return _0x22b2ba;};}function handleError(_0x482630,_0x1ebb8d){_0x1ebb8d=_0x1ebb8d||0x1f4;return function(_0x3bc520){logger['error'](_0x3bc520['stack']);if(_0x3bc520[_0x9a75('0x29')]){delete _0x3bc520[_0x9a75('0x29')];}_0x482630['status'](_0x1ebb8d)[_0x9a75('0x2a')](_0x3bc520);};}exports[_0x9a75('0x2b')]=function(_0x1d6abc,_0x551fca){var _0x5d34be={},_0x315c69={},_0x146194={'count':0x0,'rows':[]};var _0x23e623=_[_0x9a75('0x2c')](db['SquareOdbc'][_0x9a75('0x2d')],function(_0x5056ad){return{'name':_0x5056ad[_0x9a75('0x2e')],'type':_0x5056ad['type'][_0x9a75('0x2f')]};});_0x315c69[_0x9a75('0x30')]=_['map'](_0x23e623,_0x9a75('0x29'));_0x315c69[_0x9a75('0x31')]=_[_0x9a75('0x32')](_0x1d6abc[_0x9a75('0x31')]);_0x315c69[_0x9a75('0x33')]=_[_0x9a75('0x34')](_0x315c69[_0x9a75('0x30')],_0x315c69[_0x9a75('0x31')]);_0x5d34be[_0x9a75('0x35')]=_[_0x9a75('0x34')](_0x315c69['model'],qs['fields'](_0x1d6abc[_0x9a75('0x31')][_0x9a75('0x36')]));_0x5d34be[_0x9a75('0x35')]=_0x5d34be['attributes'][_0x9a75('0x37')]?_0x5d34be[_0x9a75('0x35')]:_0x315c69[_0x9a75('0x30')];if(!_0x1d6abc[_0x9a75('0x31')]['hasOwnProperty'](_0x9a75('0x38'))){_0x5d34be[_0x9a75('0x1f')]=qs[_0x9a75('0x1f')](_0x1d6abc[_0x9a75('0x31')][_0x9a75('0x1f')]);_0x5d34be[_0x9a75('0x1d')]=qs[_0x9a75('0x1d')](_0x1d6abc['query']['offset']);}_0x5d34be[_0x9a75('0x39')]=qs[_0x9a75('0x3a')](_0x1d6abc['query'][_0x9a75('0x3a')]);_0x5d34be[_0x9a75('0x3b')]=qs['filters'](_[_0x9a75('0x3c')](_0x1d6abc[_0x9a75('0x31')],_0x315c69[_0x9a75('0x33')]),_0x23e623);if(_0x1d6abc[_0x9a75('0x31')][_0x9a75('0x3d')]){_0x5d34be[_0x9a75('0x3b')]=_[_0x9a75('0x3e')](_0x5d34be[_0x9a75('0x3b')],{'$or':_[_0x9a75('0x2c')](_0x23e623,function(_0x24b903){if(_0x24b903[_0x9a75('0x3f')]!=='VIRTUAL'){var _0x2fbaad={};_0x2fbaad[_0x24b903[_0x9a75('0x29')]]={'$like':'%'+_0x1d6abc[_0x9a75('0x31')][_0x9a75('0x3d')]+'%'};return _0x2fbaad;}})});}_0x5d34be=_[_0x9a75('0x3e')]({},_0x5d34be,_0x1d6abc[_0x9a75('0x40')]);var _0x4bc4de={'where':_0x5d34be[_0x9a75('0x3b')]};return db['SquareOdbc'][_0x9a75('0x20')](_0x4bc4de)['then'](function(_0x1a20cf){_0x146194[_0x9a75('0x20')]=_0x1a20cf;if(_0x1d6abc['query'][_0x9a75('0x41')]){_0x5d34be[_0x9a75('0x42')]=[{'all':!![]}];}return db[_0x9a75('0x43')]['findAll'](_0x5d34be);})['then'](function(_0x1b9c9c){_0x146194['rows']=_0x1b9c9c;return _0x146194;})[_0x9a75('0x25')](respondWithFilteredResult(_0x551fca,_0x5d34be))[_0x9a75('0x44')](handleError(_0x551fca,null));};exports[_0x9a75('0x45')]=function(_0x5504d3,_0x3a970b){var _0x3c6a32={'raw':!![],'where':{'id':_0x5504d3['params']['id']}},_0x152e77={};_0x152e77[_0x9a75('0x30')]=_[_0x9a75('0x32')](db[_0x9a75('0x43')]['rawAttributes']);_0x152e77[_0x9a75('0x31')]=_[_0x9a75('0x32')](_0x5504d3['query']);_0x152e77[_0x9a75('0x33')]=_[_0x9a75('0x34')](_0x152e77[_0x9a75('0x30')],_0x152e77[_0x9a75('0x31')]);_0x3c6a32[_0x9a75('0x35')]=_['intersection'](_0x152e77[_0x9a75('0x30')],qs[_0x9a75('0x36')](_0x5504d3[_0x9a75('0x31')][_0x9a75('0x36')]));_0x3c6a32['attributes']=_0x3c6a32[_0x9a75('0x35')][_0x9a75('0x37')]?_0x3c6a32['attributes']:_0x152e77[_0x9a75('0x30')];if(_0x5504d3['query'][_0x9a75('0x41')]){_0x3c6a32[_0x9a75('0x42')]=[{'all':!![]}];}_0x3c6a32=_[_0x9a75('0x3e')]({},_0x3c6a32,_0x5504d3[_0x9a75('0x40')]);return db[_0x9a75('0x43')]['find'](_0x3c6a32)[_0x9a75('0x25')](handleEntityNotFound(_0x3a970b,null))['then'](respondWithResult(_0x3a970b,null))[_0x9a75('0x44')](handleError(_0x3a970b,null));};exports[_0x9a75('0x46')]=function(_0x4d6e35,_0x483915){return db[_0x9a75('0x43')]['create'](_0x4d6e35[_0x9a75('0x47')],{})[_0x9a75('0x25')](function(_0x1a55d2){var _0xe2aa01=_0x4d6e35[_0x9a75('0x48')][_0x9a75('0x26')]({'plain':!![]});if(!_0xe2aa01)throw new Error(_0x9a75('0x49'));if(_0xe2aa01[_0x9a75('0x4a')]==='user'){var _0x1f22f1=_0x1a55d2[_0x9a75('0x26')]({'plain':!![]});var _0x5ed3ee='ODBC';return db[_0x9a75('0x4b')][_0x9a75('0x4c')]({'where':{'name':_0x5ed3ee,'userProfileId':_0xe2aa01[_0x9a75('0x4d')]},'raw':!![]})[_0x9a75('0x25')](function(_0x3fa7c1){if(_0x3fa7c1&&_0x3fa7c1[_0x9a75('0x4e')]===0x0){return db[_0x9a75('0x4f')]['create']({'name':_0x1f22f1[_0x9a75('0x29')],'resourceId':_0x1f22f1['id'],'type':_0x3fa7c1[_0x9a75('0x29')],'sectionId':_0x3fa7c1['id']},{})['then'](function(){return _0x1a55d2;});}else{return _0x1a55d2;}})['catch'](function(_0x4a6e7a){logger['error'](_0x9a75('0x50'),_0x4a6e7a);throw _0x4a6e7a;});}return _0x1a55d2;})['then'](respondWithResult(_0x483915,0xc9))[_0x9a75('0x44')](handleError(_0x483915,null));};exports[_0x9a75('0x24')]=function(_0x227e32,_0x1a03f8){if(_0x227e32['body']['id']){delete _0x227e32[_0x9a75('0x47')]['id'];}return db[_0x9a75('0x43')][_0x9a75('0x4c')]({'where':{'id':_0x227e32['params']['id']}})[_0x9a75('0x25')](handleEntityNotFound(_0x1a03f8,null))[_0x9a75('0x25')](saveUpdates(_0x227e32[_0x9a75('0x47')],null))[_0x9a75('0x25')](respondWithResult(_0x1a03f8,null))[_0x9a75('0x44')](handleError(_0x1a03f8,null));};exports[_0x9a75('0x28')]=function(_0x3b2bf3,_0x31899a){return db['SquareOdbc'][_0x9a75('0x4c')]({'where':{'id':_0x3b2bf3['params']['id']}})[_0x9a75('0x25')](handleEntityNotFound(_0x31899a,null))['then'](removeEntity(_0x31899a,null))[_0x9a75('0x44')](handleError(_0x31899a,null));};exports[_0x9a75('0x51')]=function(_0x35192d,_0x3a06d2,_0x110247){var _0x2ae47d;return db[_0x9a75('0x43')][_0x9a75('0x4c')]({'where':{'id':_0x35192d[_0x9a75('0x52')]['id']},'attributes':['id',_0x9a75('0x53')]})[_0x9a75('0x25')](handleEntityNotFound(_0x3a06d2,null))[_0x9a75('0x25')](function(_0x2edccd){if(_0x2edccd){var _0xa2cd94=require(_0x9a75('0x54'))();_0xa2cd94[_0x9a75('0x55')](_0x2edccd[_0x9a75('0x53')]);_0xa2cd94[_0x9a75('0x56')]();return _0x2edccd;}})[_0x9a75('0x25')](respondWithResult(_0x3a06d2,null))[_0x9a75('0x44')](handleError(_0x3a06d2,null));}; \ No newline at end of file +var _0x8f38=['params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','odbc','openSync','dsn','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','ODBC','destroy','error','stack','index','map','rawAttributes','fieldName','key','model','name','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','type','options','SquareOdbc','findAll','rows','show'];(function(_0xd5f6c4,_0x3453ed){var _0x249a17=function(_0x270f8e){while(--_0x270f8e){_0xd5f6c4['push'](_0xd5f6c4['shift']());}};_0x249a17(++_0x3453ed);}(_0x8f38,0x67));var _0x88f3=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0x8f38[_0xcaf223];return _0x17e00d;};'use strict';var emlformat=require(_0x88f3('0x0'));var rimraf=require(_0x88f3('0x1'));var zipdir=require(_0x88f3('0x2'));var jsonpatch=require(_0x88f3('0x3'));var rp=require(_0x88f3('0x4'));var moment=require(_0x88f3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x88f3('0x6'));var util=require(_0x88f3('0x7'));var path=require(_0x88f3('0x8'));var sox=require(_0x88f3('0x9'));var csv=require('to-csv');var ejs=require(_0x88f3('0xa'));var fs=require('fs');var fs_extra=require(_0x88f3('0xb'));var _=require(_0x88f3('0xc'));var squel=require(_0x88f3('0xd'));var crypto=require(_0x88f3('0xe'));var jsforce=require(_0x88f3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x88f3('0x10'));var querystring=require(_0x88f3('0x11'));var Papa=require(_0x88f3('0x12'));var Redis=require(_0x88f3('0x13'));var authService=require(_0x88f3('0x14'));var qs=require(_0x88f3('0x15'));var as=require(_0x88f3('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88f3('0x17'))('api');var utils=require(_0x88f3('0x18'));var config=require(_0x88f3('0x19'));var licenseUtil=require(_0x88f3('0x1a'));var db=require(_0x88f3('0x1b'))['db'];function respondWithStatusCode(_0x42e1f9,_0x4fade1){_0x4fade1=_0x4fade1||0xcc;return function(_0x37c3f5){if(_0x37c3f5){return _0x42e1f9[_0x88f3('0x1c')](_0x4fade1);}return _0x42e1f9[_0x88f3('0x1d')](_0x4fade1)[_0x88f3('0x1e')]();};}function respondWithResult(_0x47318c,_0x2bd145){_0x2bd145=_0x2bd145||0xc8;return function(_0x2fa1bc){if(_0x2fa1bc){return _0x47318c[_0x88f3('0x1d')](_0x2bd145)[_0x88f3('0x1f')](_0x2fa1bc);}};}function respondWithFilteredResult(_0x414152,_0x5cba54){return function(_0x53358e){if(_0x53358e){var _0x497b27=typeof _0x5cba54[_0x88f3('0x20')]===_0x88f3('0x21')&&typeof _0x5cba54[_0x88f3('0x22')]===_0x88f3('0x21');var _0x24d8a1=_0x53358e[_0x88f3('0x23')];var _0x41866b=_0x497b27?0x0:_0x5cba54[_0x88f3('0x20')];var _0x32534c=_0x497b27?_0x53358e[_0x88f3('0x23')]:_0x5cba54[_0x88f3('0x20')]+_0x5cba54[_0x88f3('0x22')];var _0x373956;if(_0x32534c>=_0x24d8a1){_0x32534c=_0x24d8a1;_0x373956=0xc8;}else{_0x373956=0xce;}_0x414152[_0x88f3('0x1d')](_0x373956);return _0x414152[_0x88f3('0x24')](_0x88f3('0x25'),_0x41866b+'-'+_0x32534c+'/'+_0x24d8a1)[_0x88f3('0x1f')](_0x53358e);}return null;};}function patchUpdates(_0x29e2bf){return function(_0x1a8798){try{jsonpatch[_0x88f3('0x26')](_0x1a8798,_0x29e2bf,!![]);}catch(_0x3aa65f){return BPromise[_0x88f3('0x27')](_0x3aa65f);}return _0x1a8798['save']();};}function saveUpdates(_0x2893f1,_0x5d815d){return function(_0x25fd79){if(_0x25fd79){return _0x25fd79[_0x88f3('0x28')](_0x2893f1)['then'](function(_0x42db34){return _0x42db34;});}return null;};}function removeEntity(_0x2acb30,_0x2eab84){return function(_0x110946){if(_0x110946){return _0x110946['destroy']()[_0x88f3('0x29')](function(){var _0x305aca=_0x110946[_0x88f3('0x2a')]({'plain':!![]});var _0x27d4ff=_0x88f3('0x2b');return db['UserProfileResource'][_0x88f3('0x2c')]({'where':{'type':_0x27d4ff,'resourceId':_0x305aca['id']}})[_0x88f3('0x29')](function(){return _0x110946;});})['then'](function(){_0x2acb30[_0x88f3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38a6db,_0x3be640){return function(_0x1bcaa1){if(!_0x1bcaa1){_0x38a6db[_0x88f3('0x1c')](0x194);}return _0x1bcaa1;};}function handleError(_0x5561a2,_0x343f9b){_0x343f9b=_0x343f9b||0x1f4;return function(_0x471e16){logger[_0x88f3('0x2d')](_0x471e16[_0x88f3('0x2e')]);if(_0x471e16['name']){delete _0x471e16['name'];}_0x5561a2[_0x88f3('0x1d')](_0x343f9b)['send'](_0x471e16);};}exports[_0x88f3('0x2f')]=function(_0x12f190,_0x376c8e){var _0x10edff={},_0x2ba100={},_0x3ec944={'count':0x0,'rows':[]};var _0xf02281=_[_0x88f3('0x30')](db['SquareOdbc'][_0x88f3('0x31')],function(_0x71221){return{'name':_0x71221[_0x88f3('0x32')],'type':_0x71221['type'][_0x88f3('0x33')]};});_0x2ba100[_0x88f3('0x34')]=_[_0x88f3('0x30')](_0xf02281,_0x88f3('0x35'));_0x2ba100[_0x88f3('0x36')]=_[_0x88f3('0x37')](_0x12f190[_0x88f3('0x36')]);_0x2ba100['filters']=_[_0x88f3('0x38')](_0x2ba100['model'],_0x2ba100[_0x88f3('0x36')]);_0x10edff[_0x88f3('0x39')]=_[_0x88f3('0x38')](_0x2ba100['model'],qs[_0x88f3('0x3a')](_0x12f190[_0x88f3('0x36')][_0x88f3('0x3a')]));_0x10edff[_0x88f3('0x39')]=_0x10edff['attributes'][_0x88f3('0x3b')]?_0x10edff[_0x88f3('0x39')]:_0x2ba100[_0x88f3('0x34')];if(!_0x12f190['query']['hasOwnProperty'](_0x88f3('0x3c'))){_0x10edff['limit']=qs['limit'](_0x12f190[_0x88f3('0x36')][_0x88f3('0x22')]);_0x10edff['offset']=qs[_0x88f3('0x20')](_0x12f190[_0x88f3('0x36')][_0x88f3('0x20')]);}_0x10edff['order']=qs[_0x88f3('0x3d')](_0x12f190['query'][_0x88f3('0x3d')]);_0x10edff[_0x88f3('0x3e')]=qs[_0x88f3('0x3f')](_[_0x88f3('0x40')](_0x12f190[_0x88f3('0x36')],_0x2ba100[_0x88f3('0x3f')]),_0xf02281);if(_0x12f190[_0x88f3('0x36')][_0x88f3('0x41')]){_0x10edff[_0x88f3('0x3e')]=_[_0x88f3('0x42')](_0x10edff[_0x88f3('0x3e')],{'$or':_[_0x88f3('0x30')](_0xf02281,function(_0x436b62){if(_0x436b62[_0x88f3('0x43')]!=='VIRTUAL'){var _0x26d057={};_0x26d057[_0x436b62['name']]={'$like':'%'+_0x12f190[_0x88f3('0x36')][_0x88f3('0x41')]+'%'};return _0x26d057;}})});}_0x10edff=_[_0x88f3('0x42')]({},_0x10edff,_0x12f190[_0x88f3('0x44')]);var _0x3e7324={'where':_0x10edff[_0x88f3('0x3e')]};return db['SquareOdbc'][_0x88f3('0x23')](_0x3e7324)[_0x88f3('0x29')](function(_0xc15e56){_0x3ec944[_0x88f3('0x23')]=_0xc15e56;if(_0x12f190['query']['includeAll']){_0x10edff['include']=[{'all':!![]}];}return db[_0x88f3('0x45')][_0x88f3('0x46')](_0x10edff);})[_0x88f3('0x29')](function(_0x464c0e){_0x3ec944[_0x88f3('0x47')]=_0x464c0e;return _0x3ec944;})[_0x88f3('0x29')](respondWithFilteredResult(_0x376c8e,_0x10edff))['catch'](handleError(_0x376c8e,null));};exports[_0x88f3('0x48')]=function(_0x5b31be,_0x3ebe4d){var _0x43d841={'raw':!![],'where':{'id':_0x5b31be[_0x88f3('0x49')]['id']}},_0x58c647={};_0x58c647['model']=_[_0x88f3('0x37')](db[_0x88f3('0x45')][_0x88f3('0x31')]);_0x58c647[_0x88f3('0x36')]=_['keys'](_0x5b31be[_0x88f3('0x36')]);_0x58c647[_0x88f3('0x3f')]=_['intersection'](_0x58c647[_0x88f3('0x34')],_0x58c647[_0x88f3('0x36')]);_0x43d841['attributes']=_[_0x88f3('0x38')](_0x58c647[_0x88f3('0x34')],qs[_0x88f3('0x3a')](_0x5b31be[_0x88f3('0x36')]['fields']));_0x43d841['attributes']=_0x43d841[_0x88f3('0x39')][_0x88f3('0x3b')]?_0x43d841[_0x88f3('0x39')]:_0x58c647[_0x88f3('0x34')];if(_0x5b31be[_0x88f3('0x36')]['includeAll']){_0x43d841['include']=[{'all':!![]}];}_0x43d841=_[_0x88f3('0x42')]({},_0x43d841,_0x5b31be[_0x88f3('0x44')]);return db['SquareOdbc'][_0x88f3('0x4a')](_0x43d841)['then'](handleEntityNotFound(_0x3ebe4d,null))[_0x88f3('0x29')](respondWithResult(_0x3ebe4d,null))[_0x88f3('0x4b')](handleError(_0x3ebe4d,null));};exports[_0x88f3('0x4c')]=function(_0x613324,_0x743a62){return db[_0x88f3('0x45')][_0x88f3('0x4c')](_0x613324['body'],{})[_0x88f3('0x29')](function(_0x466bfd){var _0x1ef6c7=_0x613324[_0x88f3('0x4d')][_0x88f3('0x2a')]({'plain':!![]});if(!_0x1ef6c7)throw new Error(_0x88f3('0x4e'));if(_0x1ef6c7[_0x88f3('0x4f')]==='user'){var _0x19ddba=_0x466bfd['get']({'plain':!![]});var _0x41f00b=_0x88f3('0x2b');return db['UserProfileSection'][_0x88f3('0x4a')]({'where':{'name':_0x41f00b,'userProfileId':_0x1ef6c7[_0x88f3('0x50')]},'raw':!![]})[_0x88f3('0x29')](function(_0x1ebf36){if(_0x1ebf36&&_0x1ebf36[_0x88f3('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x19ddba[_0x88f3('0x35')],'resourceId':_0x19ddba['id'],'type':_0x1ebf36[_0x88f3('0x35')],'sectionId':_0x1ebf36['id']},{})['then'](function(){return _0x466bfd;});}else{return _0x466bfd;}})['catch'](function(_0x4c109e){logger[_0x88f3('0x2d')](_0x88f3('0x52'),_0x4c109e);throw _0x4c109e;});}return _0x466bfd;})[_0x88f3('0x29')](respondWithResult(_0x743a62,0xc9))[_0x88f3('0x4b')](handleError(_0x743a62,null));};exports[_0x88f3('0x28')]=function(_0x2a9f1e,_0x2fa105){if(_0x2a9f1e[_0x88f3('0x53')]['id']){delete _0x2a9f1e[_0x88f3('0x53')]['id'];}return db[_0x88f3('0x45')][_0x88f3('0x4a')]({'where':{'id':_0x2a9f1e[_0x88f3('0x49')]['id']}})[_0x88f3('0x29')](handleEntityNotFound(_0x2fa105,null))[_0x88f3('0x29')](saveUpdates(_0x2a9f1e['body'],null))[_0x88f3('0x29')](respondWithResult(_0x2fa105,null))[_0x88f3('0x4b')](handleError(_0x2fa105,null));};exports[_0x88f3('0x2c')]=function(_0x432ec3,_0x5badc9){return db[_0x88f3('0x45')][_0x88f3('0x4a')]({'where':{'id':_0x432ec3[_0x88f3('0x49')]['id']}})[_0x88f3('0x29')](handleEntityNotFound(_0x5badc9,null))[_0x88f3('0x29')](removeEntity(_0x5badc9,null))['catch'](handleError(_0x5badc9,null));};exports[_0x88f3('0x54')]=function(_0x4f15d9,_0x5342ee,_0xc246b2){var _0x164e40;return db[_0x88f3('0x45')][_0x88f3('0x4a')]({'where':{'id':_0x4f15d9[_0x88f3('0x49')]['id']},'attributes':['id','dsn']})[_0x88f3('0x29')](handleEntityNotFound(_0x5342ee,null))[_0x88f3('0x29')](function(_0x57072e){if(_0x57072e){var _0x1a0f1a=require(_0x88f3('0x55'))();_0x1a0f1a[_0x88f3('0x56')](_0x57072e[_0x88f3('0x57')]);_0x1a0f1a['closeSync']();return _0x57072e;}})[_0x88f3('0x29')](respondWithResult(_0x5342ee,null))[_0x88f3('0x4b')](handleError(_0x5342ee,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index f3410ab..54b2ef6 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 _0xdd0e=['util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','lodash'];(function(_0x3b11f5,_0x4ba9ed){var _0x19d9f3=function(_0x59335b){while(--_0x59335b){_0x3b11f5['push'](_0x3b11f5['shift']());}};_0x19d9f3(++_0x4ba9ed);}(_0xdd0e,0x1d5));var _0xedd0=function(_0x5e339a,_0x4322b8){_0x5e339a=_0x5e339a-0x0;var _0x3cd631=_0xdd0e[_0x5e339a];return _0x3cd631;};'use strict';var _=require(_0xedd0('0x0'));var util=require(_0xedd0('0x1'));var logger=require(_0xedd0('0x2'))(_0xedd0('0x3'));var moment=require(_0xedd0('0x4'));var BPromise=require(_0xedd0('0x5'));var rp=require(_0xedd0('0x6'));var fs=require('fs');var path=require(_0xedd0('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xedd0('0x8')]=function(_0x2b6b5a,_0x38cabb){return _0x2b6b5a[_0xedd0('0x9')]('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7be1=['SquareOdbc','lodash','util','../../config/logger','api','bluebird','request-promise','path','./squareOdbc.attributes','exports','define'];(function(_0x4589e2,_0x50d57d){var _0x4efe37=function(_0x1c8ae7){while(--_0x1c8ae7){_0x4589e2['push'](_0x4589e2['shift']());}};_0x4efe37(++_0x50d57d);}(_0x7be1,0xfe));var _0x17be=function(_0x2f71c1,_0x319017){_0x2f71c1=_0x2f71c1-0x0;var _0x411bb7=_0x7be1[_0x2f71c1];return _0x411bb7;};'use strict';var _=require(_0x17be('0x0'));var util=require(_0x17be('0x1'));var logger=require(_0x17be('0x2'))(_0x17be('0x3'));var moment=require('moment');var BPromise=require(_0x17be('0x4'));var rp=require(_0x17be('0x5'));var fs=require('fs');var path=require(_0x17be('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x17be('0x7'));module[_0x17be('0x8')]=function(_0x35b50e,_0x235585){return _0x35b50e[_0x17be('0x9')](_0x17be('0xa'),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 50d76e1..af6128a 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 _0xce41=['ShowSquareOdbc','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','find','options','raw','where','attributes','include','model','map','then'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0xce41,0x13d));var _0x1ce4=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0xce41[_0x368e09];return _0x14b7df;};'use strict';var _=require(_0x1ce4('0x0'));var util=require(_0x1ce4('0x1'));var moment=require(_0x1ce4('0x2'));var BPromise=require(_0x1ce4('0x3'));var rs=require(_0x1ce4('0x4'));var fs=require('fs');var Redis=require(_0x1ce4('0x5'));var db=require(_0x1ce4('0x6'))['db'];var utils=require(_0x1ce4('0x7'));var logger=require(_0x1ce4('0x8'))(_0x1ce4('0x9'));var config=require(_0x1ce4('0xa'));var jayson=require(_0x1ce4('0xb'));var client=jayson[_0x1ce4('0xc')][_0x1ce4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x25d6de,_0x4ebde2,_0x55b61b){return new BPromise(function(_0x56ee70,_0x9e83b2){return client[_0x1ce4('0xe')](_0x25d6de,_0x55b61b)['then'](function(_0x206e35){logger[_0x1ce4('0xf')](_0x1ce4('0x10'),_0x4ebde2,'request\x20sent');logger[_0x1ce4('0x11')](_0x1ce4('0x12'),_0x4ebde2,_0x1ce4('0x13'),JSON[_0x1ce4('0x14')](_0x206e35));if(_0x206e35['error']){if(_0x206e35[_0x1ce4('0x15')][_0x1ce4('0x16')]===0x1f4){logger[_0x1ce4('0x15')]('SquareOdbc,\x20%s,\x20%s',_0x4ebde2,_0x206e35[_0x1ce4('0x15')][_0x1ce4('0x17')]);return _0x9e83b2(_0x206e35[_0x1ce4('0x15')][_0x1ce4('0x17')]);}logger[_0x1ce4('0x15')](_0x1ce4('0x10'),_0x4ebde2,_0x206e35[_0x1ce4('0x15')][_0x1ce4('0x17')]);return _0x56ee70(_0x206e35['error'][_0x1ce4('0x17')]);}else{logger[_0x1ce4('0xf')](_0x1ce4('0x10'),_0x4ebde2,'request\x20sent');_0x56ee70(_0x206e35['result'][_0x1ce4('0x17')]);}})['catch'](function(_0x318533){logger[_0x1ce4('0x15')](_0x1ce4('0x10'),_0x4ebde2,_0x318533);_0x9e83b2(_0x318533);});});}exports['ShowSquareOdbc']=function(_0x293722){var _0x42282a=this;return new Promise(function(_0x223b3c,_0x19c525){return db['SquareOdbc'][_0x1ce4('0x18')]({'raw':_0x293722['options']?_0x293722[_0x1ce4('0x19')][_0x1ce4('0x1a')]===undefined?!![]:![]:!![],'where':_0x293722[_0x1ce4('0x19')]?_0x293722[_0x1ce4('0x19')][_0x1ce4('0x1b')]||null:null,'attributes':_0x293722['options']?_0x293722[_0x1ce4('0x19')][_0x1ce4('0x1c')]||null:null,'include':_0x293722[_0x1ce4('0x19')]?_0x293722[_0x1ce4('0x19')][_0x1ce4('0x1d')]?_['map'](_0x293722[_0x1ce4('0x19')][_0x1ce4('0x1d')],function(_0x33388a){return{'model':db[_0x33388a[_0x1ce4('0x1e')]],'as':_0x33388a['as'],'attributes':_0x33388a[_0x1ce4('0x1c')],'include':_0x33388a[_0x1ce4('0x1d')]?_[_0x1ce4('0x1f')](_0x33388a[_0x1ce4('0x1d')],function(_0x1945b0){return{'model':db[_0x1945b0[_0x1ce4('0x1e')]],'as':_0x1945b0['as'],'attributes':_0x1945b0[_0x1ce4('0x1c')],'include':_0x1945b0['include']?_['map'](_0x1945b0[_0x1ce4('0x1d')],function(_0x29d6c8){return{'model':db[_0x29d6c8[_0x1ce4('0x1e')]],'as':_0x29d6c8['as'],'attributes':_0x29d6c8[_0x1ce4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1ce4('0x20')](function(_0x110950){logger[_0x1ce4('0xf')](_0x1ce4('0x21'),_0x293722);logger[_0x1ce4('0x11')](_0x1ce4('0x21'),_0x293722,JSON['stringify'](_0x110950));_0x223b3c(_0x110950);})[_0x1ce4('0x22')](function(_0x383efa){logger[_0x1ce4('0x15')](_0x1ce4('0x21'),_0x383efa[_0x1ce4('0x17')],_0x293722);_0x19c525(_0x42282a[_0x1ce4('0x15')](0x1f4,_0x383efa[_0x1ce4('0x17')]));});});}; \ No newline at end of file +var _0x1829=['catch','ShowSquareOdbc','options','raw','where','attributes','include','map','model','stringify','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','SquareOdbc,\x20%s,\x20%s','message','result'];(function(_0xda0bb1,_0x1dfb5a){var _0x350077=function(_0x56c38f){while(--_0x56c38f){_0xda0bb1['push'](_0xda0bb1['shift']());}};_0x350077(++_0x1dfb5a);}(_0x1829,0x121));var _0x9182=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x1829[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0x9182('0x0'));var util=require(_0x9182('0x1'));var moment=require(_0x9182('0x2'));var BPromise=require('bluebird');var rs=require(_0x9182('0x3'));var fs=require('fs');var Redis=require(_0x9182('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9182('0x5'));var logger=require(_0x9182('0x6'))('rpc');var config=require(_0x9182('0x7'));var jayson=require(_0x9182('0x8'));var client=jayson[_0x9182('0x9')][_0x9182('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x296a15,_0xc8afd8,_0x30a042){return new BPromise(function(_0x50419a,_0x2dc343){return client[_0x9182('0xb')](_0x296a15,_0x30a042)[_0x9182('0xc')](function(_0x3c4b09){logger[_0x9182('0xd')]('SquareOdbc,\x20%s,\x20%s',_0xc8afd8,_0x9182('0xe'));logger[_0x9182('0xf')](_0x9182('0x10'),_0xc8afd8,_0x9182('0xe'),JSON['stringify'](_0x3c4b09));if(_0x3c4b09[_0x9182('0x11')]){if(_0x3c4b09[_0x9182('0x11')]['code']===0x1f4){logger[_0x9182('0x11')](_0x9182('0x12'),_0xc8afd8,_0x3c4b09[_0x9182('0x11')][_0x9182('0x13')]);return _0x2dc343(_0x3c4b09[_0x9182('0x11')][_0x9182('0x13')]);}logger[_0x9182('0x11')]('SquareOdbc,\x20%s,\x20%s',_0xc8afd8,_0x3c4b09['error'][_0x9182('0x13')]);return _0x50419a(_0x3c4b09['error'][_0x9182('0x13')]);}else{logger['info'](_0x9182('0x12'),_0xc8afd8,_0x9182('0xe'));_0x50419a(_0x3c4b09[_0x9182('0x14')][_0x9182('0x13')]);}})[_0x9182('0x15')](function(_0x562603){logger[_0x9182('0x11')](_0x9182('0x12'),_0xc8afd8,_0x562603);_0x2dc343(_0x562603);});});}exports[_0x9182('0x16')]=function(_0x34596b){var _0x17541a=this;return new Promise(function(_0x33bd63,_0x4fc07a){return db['SquareOdbc']['find']({'raw':_0x34596b['options']?_0x34596b[_0x9182('0x17')][_0x9182('0x18')]===undefined?!![]:![]:!![],'where':_0x34596b[_0x9182('0x17')]?_0x34596b[_0x9182('0x17')][_0x9182('0x19')]||null:null,'attributes':_0x34596b[_0x9182('0x17')]?_0x34596b['options'][_0x9182('0x1a')]||null:null,'include':_0x34596b[_0x9182('0x17')]?_0x34596b['options'][_0x9182('0x1b')]?_[_0x9182('0x1c')](_0x34596b[_0x9182('0x17')][_0x9182('0x1b')],function(_0x351cad){return{'model':db[_0x351cad[_0x9182('0x1d')]],'as':_0x351cad['as'],'attributes':_0x351cad[_0x9182('0x1a')],'include':_0x351cad[_0x9182('0x1b')]?_[_0x9182('0x1c')](_0x351cad[_0x9182('0x1b')],function(_0x1e8014){return{'model':db[_0x1e8014[_0x9182('0x1d')]],'as':_0x1e8014['as'],'attributes':_0x1e8014[_0x9182('0x1a')],'include':_0x1e8014['include']?_['map'](_0x1e8014[_0x9182('0x1b')],function(_0x197f37){return{'model':db[_0x197f37[_0x9182('0x1d')]],'as':_0x197f37['as'],'attributes':_0x197f37[_0x9182('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9182('0xc')](function(_0x3ba77f){logger[_0x9182('0xd')](_0x9182('0x16'),_0x34596b);logger['debug']('ShowSquareOdbc',_0x34596b,JSON[_0x9182('0x1e')](_0x3ba77f));_0x33bd63(_0x3ba77f);})['catch'](function(_0x2d17f1){logger[_0x9182('0x11')](_0x9182('0x16'),_0x2d17f1[_0x9182('0x13')],_0x34596b);_0x4fc07a(_0x17541a['error'](0x1f4,_0x2d17f1[_0x9182('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 6084e38..cf3c40f 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 _0xbcff=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/users','post','create','addUsers','update','delete','destroy','removeUsers','exports','multer','path','express'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xbcff,0xbb));var _0xfbcf=function(_0x51ea69,_0x258606){_0x51ea69=_0x51ea69-0x0;var _0x1c5d59=_0xbcff[_0x51ea69];return _0x1c5d59;};'use strict';var multer=require(_0xfbcf('0x0'));var util=require('util');var path=require(_0xfbcf('0x1'));var timeout=require('connect-timeout');var express=require(_0xfbcf('0x2'));var router=express[_0xfbcf('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfbcf('0x4'));var config=require(_0xfbcf('0x5'));var controller=require('./squareProject.controller');router[_0xfbcf('0x6')]('/',auth[_0xfbcf('0x7')](),controller[_0xfbcf('0x8')]);router[_0xfbcf('0x6')](_0xfbcf('0x9'),auth[_0xfbcf('0x7')](),controller['show']);router[_0xfbcf('0x6')](_0xfbcf('0xa'),auth[_0xfbcf('0x7')](),controller['getUsers']);router[_0xfbcf('0xb')]('/',auth[_0xfbcf('0x7')](),controller[_0xfbcf('0xc')]);router[_0xfbcf('0xb')](_0xfbcf('0xa'),auth[_0xfbcf('0x7')](),controller[_0xfbcf('0xd')]);router['put'](_0xfbcf('0x9'),auth[_0xfbcf('0x7')](),controller[_0xfbcf('0xe')]);router[_0xfbcf('0xf')](_0xfbcf('0x9'),auth[_0xfbcf('0x7')](),controller[_0xfbcf('0x10')]);router[_0xfbcf('0xf')](_0xfbcf('0xa'),auth['isAuthenticated'](),controller[_0xfbcf('0x11')]);module[_0xfbcf('0x12')]=router; \ No newline at end of file +var _0x2340=['put','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','create','post','addUsers'];(function(_0x41ae11,_0x336007){var _0x5d9dd7=function(_0x15647e){while(--_0x15647e){_0x41ae11['push'](_0x41ae11['shift']());}};_0x5d9dd7(++_0x336007);}(_0x2340,0x1e6));var _0x0234=function(_0x4bd252,_0x329c9e){_0x4bd252=_0x4bd252-0x0;var _0x525efb=_0x2340[_0x4bd252];return _0x525efb;};'use strict';var multer=require(_0x0234('0x0'));var util=require(_0x0234('0x1'));var path=require(_0x0234('0x2'));var timeout=require(_0x0234('0x3'));var express=require('express');var router=express[_0x0234('0x4')]();var fs_extra=require(_0x0234('0x5'));var auth=require(_0x0234('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0234('0x7'));var controller=require(_0x0234('0x8'));router[_0x0234('0x9')]('/',auth[_0x0234('0xa')](),controller[_0x0234('0xb')]);router[_0x0234('0x9')](_0x0234('0xc'),auth[_0x0234('0xa')](),controller[_0x0234('0xd')]);router[_0x0234('0x9')](_0x0234('0xe'),auth['isAuthenticated'](),controller['getUsers']);router['post']('/',auth[_0x0234('0xa')](),controller[_0x0234('0xf')]);router[_0x0234('0x10')](_0x0234('0xe'),auth[_0x0234('0xa')](),controller[_0x0234('0x11')]);router[_0x0234('0x12')](_0x0234('0xc'),auth[_0x0234('0xa')](),controller[_0x0234('0x13')]);router[_0x0234('0x14')](_0x0234('0xc'),auth[_0x0234('0xa')](),controller[_0x0234('0x15')]);router[_0x0234('0x14')](_0x0234('0xe'),auth[_0x0234('0xa')](),controller[_0x0234('0x16')]);module[_0x0234('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 628a7e2..149430e 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 _0x3b83=['STRING','name','TEXT','BLOB','long','getDataValue','preproduction','utf8','production','toString','DATE','sequelize','exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3b83,0x10f));var _0x33b8=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x3b83[_0x4b7895];return _0x264180;};'use strict';var Sequelize=require(_0x33b8('0x0'));module[_0x33b8('0x1')]={'name':{'type':Sequelize[_0x33b8('0x2')],'unique':_0x33b8('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x33b8('0x2')]},'notes':{'type':Sequelize[_0x33b8('0x4')]},'preproduction':{'type':Sequelize[_0x33b8('0x5')](_0x33b8('0x6')),'get':function(){if(this[_0x33b8('0x7')](_0x33b8('0x8'))){return this[_0x33b8('0x7')](_0x33b8('0x8'))['toString'](_0x33b8('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0x33b8('0x6')),'get':function(){if(this[_0x33b8('0x7')](_0x33b8('0xa'))){return this[_0x33b8('0x7')]('production')[_0x33b8('0xb')](_0x33b8('0x9'));}}},'savedAt':{'type':Sequelize[_0x33b8('0xc')]},'publishedAt':{'type':Sequelize[_0x33b8('0xc')]}}; \ No newline at end of file +var _0xa8b1=['long','getDataValue','preproduction','toString','utf8','DATE','exports','STRING','name','TEXT','BLOB'];(function(_0x414973,_0x2dacad){var _0x42b727=function(_0x4b4344){while(--_0x4b4344){_0x414973['push'](_0x414973['shift']());}};_0x42b727(++_0x2dacad);}(_0xa8b1,0xd7));var _0x1a8b=function(_0x1a4e0a,_0x2a2adb){_0x1a4e0a=_0x1a4e0a-0x0;var _0x4bcb3d=_0xa8b1[_0x1a4e0a];return _0x4bcb3d;};'use strict';var Sequelize=require('sequelize');module[_0x1a8b('0x0')]={'name':{'type':Sequelize[_0x1a8b('0x1')],'unique':_0x1a8b('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x1a8b('0x1')]},'notes':{'type':Sequelize[_0x1a8b('0x3')]},'preproduction':{'type':Sequelize[_0x1a8b('0x4')](_0x1a8b('0x5')),'get':function(){if(this[_0x1a8b('0x6')](_0x1a8b('0x7'))){return this['getDataValue'](_0x1a8b('0x7'))[_0x1a8b('0x8')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x1a8b('0x5')),'get':function(){if(this[_0x1a8b('0x6')]('production')){return this['getDataValue']('production')['toString'](_0x1a8b('0x9'));}}},'savedAt':{'type':Sequelize[_0x1a8b('0xa')]},'publishedAt':{'type':Sequelize[_0x1a8b('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index a185c6e..bb0efca 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 _0xcbc2=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','removeUsers','isArray','length','emit','userSquareProject:remove','getUsers','User','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./squareProject.socket','register','sendStatus','end','offset','undefined','limit','count','status','set','reject','save','then','SquareProjects','UserProfileResource','destroy','error','send','map','SquareProject','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','catch','params','find','create'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0xcbc2,0x130));var _0x2cbc=function(_0x85b464,_0xb32a20){_0x85b464=_0x85b464-0x0;var _0x75dc19=_0xcbc2[_0x85b464];return _0x75dc19;};'use strict';var emlformat=require(_0x2cbc('0x0'));var rimraf=require(_0x2cbc('0x1'));var zipdir=require(_0x2cbc('0x2'));var jsonpatch=require(_0x2cbc('0x3'));var rp=require(_0x2cbc('0x4'));var moment=require(_0x2cbc('0x5'));var BPromise=require(_0x2cbc('0x6'));var Mustache=require(_0x2cbc('0x7'));var util=require(_0x2cbc('0x8'));var path=require(_0x2cbc('0x9'));var sox=require(_0x2cbc('0xa'));var csv=require(_0x2cbc('0xb'));var ejs=require(_0x2cbc('0xc'));var fs=require('fs');var fs_extra=require(_0x2cbc('0xd'));var _=require('lodash');var squel=require(_0x2cbc('0xe'));var crypto=require(_0x2cbc('0xf'));var jsforce=require(_0x2cbc('0x10'));var deskjs=require(_0x2cbc('0x11'));var toCsv=require(_0x2cbc('0xb'));var querystring=require('querystring');var Papa=require(_0x2cbc('0x12'));var Redis=require(_0x2cbc('0x13'));var authService=require(_0x2cbc('0x14'));var qs=require(_0x2cbc('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2cbc('0x16'));var logger=require(_0x2cbc('0x17'))(_0x2cbc('0x18'));var utils=require('../../config/utils');var config=require(_0x2cbc('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2cbc('0x1a'))['db'];config[_0x2cbc('0x1b')]=_[_0x2cbc('0x1c')](config[_0x2cbc('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2cbc('0x1d'))[_0x2cbc('0x1e')](socket);function respondWithStatusCode(_0x20941a,_0x5470af){_0x5470af=_0x5470af||0xcc;return function(_0x700ea2){if(_0x700ea2){return _0x20941a[_0x2cbc('0x1f')](_0x5470af);}return _0x20941a['status'](_0x5470af)[_0x2cbc('0x20')]();};}function respondWithResult(_0x24f8ea,_0x4c380f){_0x4c380f=_0x4c380f||0xc8;return function(_0x1b93c8){if(_0x1b93c8){return _0x24f8ea['status'](_0x4c380f)['json'](_0x1b93c8);}};}function respondWithFilteredResult(_0xf6169e,_0x1a7203){return function(_0x1207ab){if(_0x1207ab){var _0x470c4f=typeof _0x1a7203[_0x2cbc('0x21')]===_0x2cbc('0x22')&&typeof _0x1a7203[_0x2cbc('0x23')]===_0x2cbc('0x22');var _0x4c9628=_0x1207ab[_0x2cbc('0x24')];var _0x5eeaaa=_0x470c4f?0x0:_0x1a7203['offset'];var _0x540e1a=_0x470c4f?_0x1207ab[_0x2cbc('0x24')]:_0x1a7203[_0x2cbc('0x21')]+_0x1a7203[_0x2cbc('0x23')];var _0x53de7f;if(_0x540e1a>=_0x4c9628){_0x540e1a=_0x4c9628;_0x53de7f=0xc8;}else{_0x53de7f=0xce;}_0xf6169e[_0x2cbc('0x25')](_0x53de7f);return _0xf6169e[_0x2cbc('0x26')]('Content-Range',_0x5eeaaa+'-'+_0x540e1a+'/'+_0x4c9628)['json'](_0x1207ab);}return null;};}function patchUpdates(_0x21aab4){return function(_0x3f3399){try{jsonpatch['apply'](_0x3f3399,_0x21aab4,!![]);}catch(_0x12c5cd){return BPromise[_0x2cbc('0x27')](_0x12c5cd);}return _0x3f3399[_0x2cbc('0x28')]();};}function saveUpdates(_0x59b248,_0x1eb587){return function(_0x500ef6){if(_0x500ef6){return _0x500ef6['update'](_0x59b248)[_0x2cbc('0x29')](function(_0x1c0263){return _0x1c0263;});}return null;};}function removeEntity(_0x3a9bbf,_0x5049d0){return function(_0x277f1e){if(_0x277f1e){return _0x277f1e['destroy']()['then'](function(){var _0x2f41f2=_0x277f1e['get']({'plain':!![]});var _0x46ab9f=_0x2cbc('0x2a');return db[_0x2cbc('0x2b')][_0x2cbc('0x2c')]({'where':{'type':_0x46ab9f,'resourceId':_0x2f41f2['id']}})[_0x2cbc('0x29')](function(){return _0x277f1e;});})['then'](function(){_0x3a9bbf['status'](0xcc)[_0x2cbc('0x20')]();});}};}function handleEntityNotFound(_0x50e82a,_0x28a180){return function(_0x40023b){if(!_0x40023b){_0x50e82a[_0x2cbc('0x1f')](0x194);}return _0x40023b;};}function handleError(_0x2b71d7,_0x5d8b6f){_0x5d8b6f=_0x5d8b6f||0x1f4;return function(_0x29f800){logger[_0x2cbc('0x2d')](_0x29f800['stack']);if(_0x29f800['name']){delete _0x29f800['name'];}_0x2b71d7['status'](_0x5d8b6f)[_0x2cbc('0x2e')](_0x29f800);};}exports['index']=function(_0x58a420,_0x7aea86){var _0x5e4829={},_0x43509a={},_0x357dab={'count':0x0,'rows':[]};var _0x53daed=_[_0x2cbc('0x2f')](db[_0x2cbc('0x30')][_0x2cbc('0x31')],function(_0x4880a2){return{'name':_0x4880a2[_0x2cbc('0x32')],'type':_0x4880a2[_0x2cbc('0x33')]['key']};});_0x43509a[_0x2cbc('0x34')]=_[_0x2cbc('0x2f')](_0x53daed,_0x2cbc('0x35'));_0x43509a['query']=_[_0x2cbc('0x36')](_0x58a420[_0x2cbc('0x37')]);_0x43509a[_0x2cbc('0x38')]=_[_0x2cbc('0x39')](_0x43509a[_0x2cbc('0x34')],_0x43509a[_0x2cbc('0x37')]);_0x5e4829[_0x2cbc('0x3a')]=_[_0x2cbc('0x39')](_0x43509a['model'],qs[_0x2cbc('0x3b')](_0x58a420['query'][_0x2cbc('0x3b')]));_0x5e4829[_0x2cbc('0x3a')]=_0x5e4829[_0x2cbc('0x3a')]['length']?_0x5e4829[_0x2cbc('0x3a')]:_0x43509a['model'];if(!_0x58a420[_0x2cbc('0x37')][_0x2cbc('0x3c')](_0x2cbc('0x3d'))){_0x5e4829['limit']=qs[_0x2cbc('0x23')](_0x58a420[_0x2cbc('0x37')][_0x2cbc('0x23')]);_0x5e4829[_0x2cbc('0x21')]=qs[_0x2cbc('0x21')](_0x58a420[_0x2cbc('0x37')]['offset']);}_0x5e4829['order']=qs[_0x2cbc('0x3e')](_0x58a420[_0x2cbc('0x37')][_0x2cbc('0x3e')]);_0x5e4829['where']=qs[_0x2cbc('0x38')](_[_0x2cbc('0x3f')](_0x58a420['query'],_0x43509a['filters']),_0x53daed);if(_0x58a420[_0x2cbc('0x37')][_0x2cbc('0x40')]){_0x5e4829['where']=_[_0x2cbc('0x41')](_0x5e4829[_0x2cbc('0x42')],{'$or':_[_0x2cbc('0x2f')](_0x53daed,function(_0x1da130){if(_0x1da130[_0x2cbc('0x33')]!==_0x2cbc('0x43')){var _0x5df4bd={};_0x5df4bd[_0x1da130[_0x2cbc('0x35')]]={'$like':'%'+_0x58a420[_0x2cbc('0x37')][_0x2cbc('0x40')]+'%'};return _0x5df4bd;}})});}_0x5e4829=_[_0x2cbc('0x41')]({},_0x5e4829,_0x58a420[_0x2cbc('0x44')]);var _0x3dcab2={'where':_0x5e4829[_0x2cbc('0x42')]};return db[_0x2cbc('0x30')][_0x2cbc('0x24')](_0x3dcab2)[_0x2cbc('0x29')](function(_0x587ea5){_0x357dab[_0x2cbc('0x24')]=_0x587ea5;if(_0x58a420[_0x2cbc('0x37')][_0x2cbc('0x45')]){_0x5e4829['include']=[{'all':!![]}];}return db['SquareProject'][_0x2cbc('0x46')](_0x5e4829);})[_0x2cbc('0x29')](function(_0x4650e3){_0x357dab[_0x2cbc('0x47')]=_0x4650e3;return _0x357dab;})['then'](respondWithFilteredResult(_0x7aea86,_0x5e4829))[_0x2cbc('0x48')](handleError(_0x7aea86,null));};exports['show']=function(_0x3c82b0,_0x4313fe){var _0x3feb9d={'raw':![],'where':{'id':_0x3c82b0[_0x2cbc('0x49')]['id']}},_0x5a2fa1={};_0x5a2fa1['model']=_[_0x2cbc('0x36')](db[_0x2cbc('0x30')][_0x2cbc('0x31')]);_0x5a2fa1[_0x2cbc('0x37')]=_[_0x2cbc('0x36')](_0x3c82b0[_0x2cbc('0x37')]);_0x5a2fa1[_0x2cbc('0x38')]=_[_0x2cbc('0x39')](_0x5a2fa1[_0x2cbc('0x34')],_0x5a2fa1[_0x2cbc('0x37')]);_0x3feb9d[_0x2cbc('0x3a')]=_['intersection'](_0x5a2fa1['model'],qs[_0x2cbc('0x3b')](_0x3c82b0['query'][_0x2cbc('0x3b')]));_0x3feb9d[_0x2cbc('0x3a')]=_0x3feb9d['attributes']['length']?_0x3feb9d[_0x2cbc('0x3a')]:_0x5a2fa1[_0x2cbc('0x34')];if(_0x3c82b0['query'][_0x2cbc('0x45')]){_0x3feb9d['include']=[{'all':!![]}];}_0x3feb9d=_[_0x2cbc('0x41')]({},_0x3feb9d,_0x3c82b0[_0x2cbc('0x44')]);return db[_0x2cbc('0x30')][_0x2cbc('0x4a')](_0x3feb9d)['then'](handleEntityNotFound(_0x4313fe,null))[_0x2cbc('0x29')](respondWithResult(_0x4313fe,null))['catch'](handleError(_0x4313fe,null));};exports[_0x2cbc('0x4b')]=function(_0x3a2c02,_0x3552c3){return db['SquareProject'][_0x2cbc('0x4b')](_0x3a2c02[_0x2cbc('0x4c')],{})[_0x2cbc('0x29')](function(_0x351703){var _0x429ccb=_0x3a2c02[_0x2cbc('0x4d')]['get']({'plain':!![]});if(!_0x429ccb)throw new Error(_0x2cbc('0x4e'));if(_0x429ccb['role']==='user'){var _0x2e9d05=_0x351703[_0x2cbc('0x4f')]({'plain':!![]});var _0x284a82=_0x2cbc('0x2a');return db[_0x2cbc('0x50')]['find']({'where':{'name':_0x284a82,'userProfileId':_0x429ccb[_0x2cbc('0x51')]},'raw':!![]})[_0x2cbc('0x29')](function(_0x107ab9){if(_0x107ab9&&_0x107ab9[_0x2cbc('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x2e9d05[_0x2cbc('0x35')],'resourceId':_0x2e9d05['id'],'type':_0x107ab9[_0x2cbc('0x35')],'sectionId':_0x107ab9['id']},{})[_0x2cbc('0x29')](function(){return _0x351703;});}else{return _0x351703;}})[_0x2cbc('0x48')](function(_0xdbf25){logger[_0x2cbc('0x2d')](_0x2cbc('0x53'),_0xdbf25);throw _0xdbf25;});}return _0x351703;})['then'](respondWithResult(_0x3552c3,0xc9))['catch'](handleError(_0x3552c3,null));};exports[_0x2cbc('0x54')]=function(_0x18a695,_0x43b050){if(_0x18a695[_0x2cbc('0x4c')]['id']){delete _0x18a695[_0x2cbc('0x4c')]['id'];}return db[_0x2cbc('0x30')][_0x2cbc('0x4a')]({'where':{'id':_0x18a695[_0x2cbc('0x49')]['id']}})[_0x2cbc('0x29')](handleEntityNotFound(_0x43b050,null))[_0x2cbc('0x29')](saveUpdates(_0x18a695[_0x2cbc('0x4c')],null))[_0x2cbc('0x29')](respondWithResult(_0x43b050,null))[_0x2cbc('0x48')](handleError(_0x43b050,null));};exports[_0x2cbc('0x2c')]=function(_0x4f29ab,_0x3c38cc){return db['SquareProject'][_0x2cbc('0x4a')]({'where':{'id':_0x4f29ab[_0x2cbc('0x49')]['id']}})[_0x2cbc('0x29')](handleEntityNotFound(_0x3c38cc,null))['then'](removeEntity(_0x3c38cc,null))['catch'](handleError(_0x3c38cc,null));};exports[_0x2cbc('0x55')]=function(_0x408d12,_0x1b0ef5,_0x94128f){return db[_0x2cbc('0x30')][_0x2cbc('0x4a')]({'where':{'id':_0x408d12[_0x2cbc('0x49')]['id']}})[_0x2cbc('0x29')](handleEntityNotFound(_0x1b0ef5,null))[_0x2cbc('0x29')](function(_0x3558fc){if(_0x3558fc){return _0x3558fc[_0x2cbc('0x55')](_0x408d12[_0x2cbc('0x4c')][_0x2cbc('0x56')],_['omit'](_0x408d12[_0x2cbc('0x4c')],[_0x2cbc('0x56'),'id'])||{});}})[_0x2cbc('0x29')](respondWithResult(_0x1b0ef5,null))['catch'](handleError(_0x1b0ef5,null));};exports[_0x2cbc('0x57')]=function(_0xbf0d00,_0x9dc025,_0x30b880){return db[_0x2cbc('0x30')][_0x2cbc('0x4a')]({'where':{'id':_0xbf0d00[_0x2cbc('0x49')]['id']}})[_0x2cbc('0x29')](handleEntityNotFound(_0x9dc025,null))['then'](function(_0x3d7762){if(_0x3d7762){return _0x3d7762[_0x2cbc('0x57')](_0xbf0d00['query']['ids'])[_0x2cbc('0x29')](function(){if(_[_0x2cbc('0x58')](_0xbf0d00[_0x2cbc('0x37')]['ids'])){for(var _0x31c5ba=0x0;_0x31c5ba<_0xbf0d00[_0x2cbc('0x37')][_0x2cbc('0x56')][_0x2cbc('0x59')];_0x31c5ba+=0x1){socket[_0x2cbc('0x5a')](_0x2cbc('0x5b'),{'UserId':Number(_0xbf0d00[_0x2cbc('0x37')][_0x2cbc('0x56')][_0x31c5ba]),'SquareProjectId':Number(_0xbf0d00[_0x2cbc('0x49')]['id'])});}}else{socket[_0x2cbc('0x5a')](_0x2cbc('0x5b'),{'UserId':Number(_0xbf0d00[_0x2cbc('0x37')][_0x2cbc('0x56')]),'SquareProjectId':Number(_0xbf0d00['params']['id'])});}});}})[_0x2cbc('0x29')](respondWithStatusCode(_0x9dc025,null))[_0x2cbc('0x48')](handleError(_0x9dc025,null));};exports[_0x2cbc('0x5c')]=function(_0x1ac42b,_0x10b7c4,_0x28254d){var _0x3135a2={};var _0x224808={};var _0x27b1e4;var _0x5c5f78;return db[_0x2cbc('0x30')]['findOne']({'where':{'id':_0x1ac42b[_0x2cbc('0x49')]['id']}})[_0x2cbc('0x29')](handleEntityNotFound(_0x10b7c4,null))[_0x2cbc('0x29')](function(_0x1c06e3){if(_0x1c06e3){_0x27b1e4=_0x1c06e3;_0x224808[_0x2cbc('0x34')]=_['keys'](db[_0x2cbc('0x5d')][_0x2cbc('0x31')]);_0x224808['query']=_[_0x2cbc('0x36')](_0x1ac42b[_0x2cbc('0x37')]);_0x224808[_0x2cbc('0x38')]=_['intersection'](_0x224808[_0x2cbc('0x34')],_0x224808[_0x2cbc('0x37')]);_0x3135a2[_0x2cbc('0x3a')]=_['intersection'](_0x224808[_0x2cbc('0x34')],qs['fields'](_0x1ac42b[_0x2cbc('0x37')][_0x2cbc('0x3b')]));_0x3135a2[_0x2cbc('0x3a')]=_0x3135a2[_0x2cbc('0x3a')]['length']?_0x3135a2[_0x2cbc('0x3a')]:_0x224808[_0x2cbc('0x34')];_0x3135a2[_0x2cbc('0x5e')]=qs[_0x2cbc('0x3e')](_0x1ac42b[_0x2cbc('0x37')]['sort']);_0x3135a2['where']=qs[_0x2cbc('0x38')](_[_0x2cbc('0x3f')](_0x1ac42b[_0x2cbc('0x37')],_0x224808[_0x2cbc('0x38')]));if(_0x1ac42b[_0x2cbc('0x37')][_0x2cbc('0x40')]){_0x3135a2[_0x2cbc('0x42')]=_[_0x2cbc('0x41')](_0x3135a2[_0x2cbc('0x42')],{'$or':_['map'](_0x3135a2[_0x2cbc('0x3a')],function(_0x461cf6){var _0x1f39af={};_0x1f39af[_0x461cf6]={'$like':'%'+_0x1ac42b['query']['filter']+'%'};return _0x1f39af;})});}_0x3135a2=_[_0x2cbc('0x41')]({},_0x3135a2,_0x1ac42b[_0x2cbc('0x44')]);return _0x27b1e4[_0x2cbc('0x5c')](_0x3135a2);}})[_0x2cbc('0x29')](function(_0x3b996e){if(_0x3b996e){_0x5c5f78=_0x3b996e['length'];if(!_0x1ac42b['query'][_0x2cbc('0x3c')](_0x2cbc('0x3d'))){_0x3135a2[_0x2cbc('0x23')]=qs[_0x2cbc('0x23')](_0x1ac42b[_0x2cbc('0x37')][_0x2cbc('0x23')]);_0x3135a2[_0x2cbc('0x21')]=qs['offset'](_0x1ac42b[_0x2cbc('0x37')]['offset']);}return _0x27b1e4[_0x2cbc('0x5c')](_0x3135a2);}})['then'](function(_0x11be8c){if(_0x11be8c){return _0x11be8c?{'count':_0x5c5f78,'rows':_0x11be8c}:null;}})[_0x2cbc('0x29')](respondWithResult(_0x10b7c4,null))[_0x2cbc('0x48')](handleError(_0x10b7c4,null));}; \ No newline at end of file +var _0xc576=['destroy','SquareProjects','sendStatus','error','stack','name','send','SquareProject','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','create','body','role','user','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','order','nolimit','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xc576,0x1be));var _0x6c57=function(_0x39979b,_0x2111f9){_0x39979b=_0x39979b-0x0;var _0x560b41=_0xc576[_0x39979b];return _0x560b41;};'use strict';var emlformat=require(_0x6c57('0x0'));var rimraf=require(_0x6c57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6c57('0x2'));var rp=require('request-promise');var moment=require(_0x6c57('0x3'));var BPromise=require(_0x6c57('0x4'));var Mustache=require(_0x6c57('0x5'));var util=require(_0x6c57('0x6'));var path=require(_0x6c57('0x7'));var sox=require('sox');var csv=require(_0x6c57('0x8'));var ejs=require(_0x6c57('0x9'));var fs=require('fs');var fs_extra=require(_0x6c57('0xa'));var _=require(_0x6c57('0xb'));var squel=require(_0x6c57('0xc'));var crypto=require(_0x6c57('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6c57('0xe'));var toCsv=require(_0x6c57('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6c57('0xf'));var authService=require(_0x6c57('0x10'));var qs=require(_0x6c57('0x11'));var as=require(_0x6c57('0x12'));var hardwareService=require(_0x6c57('0x13'));var logger=require(_0x6c57('0x14'))(_0x6c57('0x15'));var utils=require('../../config/utils');var config=require(_0x6c57('0x16'));var licenseUtil=require(_0x6c57('0x17'));var db=require(_0x6c57('0x18'))['db'];config[_0x6c57('0x19')]=_[_0x6c57('0x1a')](config[_0x6c57('0x19')],{'host':_0x6c57('0x1b'),'port':0x18eb});var socket=require(_0x6c57('0x1c'))(new Redis(config['redis']));require(_0x6c57('0x1d'))['register'](socket);function respondWithStatusCode(_0x162dce,_0x5ac543){_0x5ac543=_0x5ac543||0xcc;return function(_0xe82971){if(_0xe82971){return _0x162dce['sendStatus'](_0x5ac543);}return _0x162dce[_0x6c57('0x1e')](_0x5ac543)[_0x6c57('0x1f')]();};}function respondWithResult(_0x20d7c0,_0xfa00de){_0xfa00de=_0xfa00de||0xc8;return function(_0x19dc1d){if(_0x19dc1d){return _0x20d7c0[_0x6c57('0x1e')](_0xfa00de)[_0x6c57('0x20')](_0x19dc1d);}};}function respondWithFilteredResult(_0x3a5f9e,_0xa33215){return function(_0x5b9f4b){if(_0x5b9f4b){var _0x213878=typeof _0xa33215['offset']===_0x6c57('0x21')&&typeof _0xa33215[_0x6c57('0x22')]===_0x6c57('0x21');var _0xe3649c=_0x5b9f4b[_0x6c57('0x23')];var _0x2d52c8=_0x213878?0x0:_0xa33215[_0x6c57('0x24')];var _0x2e7d79=_0x213878?_0x5b9f4b[_0x6c57('0x23')]:_0xa33215[_0x6c57('0x24')]+_0xa33215[_0x6c57('0x22')];var _0x3b9fa0;if(_0x2e7d79>=_0xe3649c){_0x2e7d79=_0xe3649c;_0x3b9fa0=0xc8;}else{_0x3b9fa0=0xce;}_0x3a5f9e[_0x6c57('0x1e')](_0x3b9fa0);return _0x3a5f9e[_0x6c57('0x25')](_0x6c57('0x26'),_0x2d52c8+'-'+_0x2e7d79+'/'+_0xe3649c)['json'](_0x5b9f4b);}return null;};}function patchUpdates(_0x1a1823){return function(_0x4cd77f){try{jsonpatch[_0x6c57('0x27')](_0x4cd77f,_0x1a1823,!![]);}catch(_0x986799){return BPromise[_0x6c57('0x28')](_0x986799);}return _0x4cd77f[_0x6c57('0x29')]();};}function saveUpdates(_0x43c3fd,_0x5b51c3){return function(_0x125737){if(_0x125737){return _0x125737[_0x6c57('0x2a')](_0x43c3fd)[_0x6c57('0x2b')](function(_0x127f80){return _0x127f80;});}return null;};}function removeEntity(_0x331126,_0x5ecf6c){return function(_0x4a288d){if(_0x4a288d){return _0x4a288d[_0x6c57('0x2c')]()[_0x6c57('0x2b')](function(){var _0x9e47bb=_0x4a288d['get']({'plain':!![]});var _0x3c6a78=_0x6c57('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c6a78,'resourceId':_0x9e47bb['id']}})['then'](function(){return _0x4a288d;});})[_0x6c57('0x2b')](function(){_0x331126[_0x6c57('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x349d1c,_0x36b2c1){return function(_0x43a959){if(!_0x43a959){_0x349d1c[_0x6c57('0x2e')](0x194);}return _0x43a959;};}function handleError(_0x357849,_0x34db2e){_0x34db2e=_0x34db2e||0x1f4;return function(_0x46a517){logger[_0x6c57('0x2f')](_0x46a517[_0x6c57('0x30')]);if(_0x46a517[_0x6c57('0x31')]){delete _0x46a517[_0x6c57('0x31')];}_0x357849['status'](_0x34db2e)[_0x6c57('0x32')](_0x46a517);};}exports['index']=function(_0x12d1d8,_0x44670e){var _0x5b4e97={},_0x2c125f={},_0x510cda={'count':0x0,'rows':[]};var _0x370c09=_['map'](db[_0x6c57('0x33')][_0x6c57('0x34')],function(_0xf27d25){return{'name':_0xf27d25[_0x6c57('0x35')],'type':_0xf27d25[_0x6c57('0x36')]['key']};});_0x2c125f[_0x6c57('0x37')]=_[_0x6c57('0x38')](_0x370c09,_0x6c57('0x31'));_0x2c125f[_0x6c57('0x39')]=_[_0x6c57('0x3a')](_0x12d1d8[_0x6c57('0x39')]);_0x2c125f[_0x6c57('0x3b')]=_[_0x6c57('0x3c')](_0x2c125f['model'],_0x2c125f['query']);_0x5b4e97[_0x6c57('0x3d')]=_[_0x6c57('0x3c')](_0x2c125f[_0x6c57('0x37')],qs[_0x6c57('0x3e')](_0x12d1d8['query'][_0x6c57('0x3e')]));_0x5b4e97[_0x6c57('0x3d')]=_0x5b4e97[_0x6c57('0x3d')][_0x6c57('0x3f')]?_0x5b4e97[_0x6c57('0x3d')]:_0x2c125f[_0x6c57('0x37')];if(!_0x12d1d8['query'][_0x6c57('0x40')]('nolimit')){_0x5b4e97['limit']=qs[_0x6c57('0x22')](_0x12d1d8['query'][_0x6c57('0x22')]);_0x5b4e97['offset']=qs[_0x6c57('0x24')](_0x12d1d8[_0x6c57('0x39')][_0x6c57('0x24')]);}_0x5b4e97['order']=qs[_0x6c57('0x41')](_0x12d1d8[_0x6c57('0x39')][_0x6c57('0x41')]);_0x5b4e97[_0x6c57('0x42')]=qs[_0x6c57('0x3b')](_[_0x6c57('0x43')](_0x12d1d8['query'],_0x2c125f['filters']),_0x370c09);if(_0x12d1d8[_0x6c57('0x39')][_0x6c57('0x44')]){_0x5b4e97['where']=_['merge'](_0x5b4e97[_0x6c57('0x42')],{'$or':_[_0x6c57('0x38')](_0x370c09,function(_0x5e30b4){if(_0x5e30b4[_0x6c57('0x36')]!=='VIRTUAL'){var _0x42ea48={};_0x42ea48[_0x5e30b4[_0x6c57('0x31')]]={'$like':'%'+_0x12d1d8[_0x6c57('0x39')]['filter']+'%'};return _0x42ea48;}})});}_0x5b4e97=_[_0x6c57('0x45')]({},_0x5b4e97,_0x12d1d8[_0x6c57('0x46')]);var _0x1db421={'where':_0x5b4e97[_0x6c57('0x42')]};return db['SquareProject'][_0x6c57('0x23')](_0x1db421)[_0x6c57('0x2b')](function(_0x1da012){_0x510cda[_0x6c57('0x23')]=_0x1da012;if(_0x12d1d8[_0x6c57('0x39')][_0x6c57('0x47')]){_0x5b4e97[_0x6c57('0x48')]=[{'all':!![]}];}return db['SquareProject']['findAll'](_0x5b4e97);})[_0x6c57('0x2b')](function(_0x5d730a){_0x510cda[_0x6c57('0x49')]=_0x5d730a;return _0x510cda;})['then'](respondWithFilteredResult(_0x44670e,_0x5b4e97))[_0x6c57('0x4a')](handleError(_0x44670e,null));};exports[_0x6c57('0x4b')]=function(_0x5c37ba,_0x116251){var _0x41d8fd={'raw':![],'where':{'id':_0x5c37ba[_0x6c57('0x4c')]['id']}},_0x33e35f={};_0x33e35f[_0x6c57('0x37')]=_[_0x6c57('0x3a')](db['SquareProject'][_0x6c57('0x34')]);_0x33e35f[_0x6c57('0x39')]=_[_0x6c57('0x3a')](_0x5c37ba[_0x6c57('0x39')]);_0x33e35f[_0x6c57('0x3b')]=_[_0x6c57('0x3c')](_0x33e35f[_0x6c57('0x37')],_0x33e35f[_0x6c57('0x39')]);_0x41d8fd[_0x6c57('0x3d')]=_[_0x6c57('0x3c')](_0x33e35f[_0x6c57('0x37')],qs[_0x6c57('0x3e')](_0x5c37ba['query'][_0x6c57('0x3e')]));_0x41d8fd['attributes']=_0x41d8fd[_0x6c57('0x3d')]['length']?_0x41d8fd['attributes']:_0x33e35f[_0x6c57('0x37')];if(_0x5c37ba[_0x6c57('0x39')][_0x6c57('0x47')]){_0x41d8fd['include']=[{'all':!![]}];}_0x41d8fd=_[_0x6c57('0x45')]({},_0x41d8fd,_0x5c37ba[_0x6c57('0x46')]);return db[_0x6c57('0x33')][_0x6c57('0x4d')](_0x41d8fd)['then'](handleEntityNotFound(_0x116251,null))[_0x6c57('0x2b')](respondWithResult(_0x116251,null))[_0x6c57('0x4a')](handleError(_0x116251,null));};exports[_0x6c57('0x4e')]=function(_0x1ee006,_0x3bb09b){return db['SquareProject']['create'](_0x1ee006[_0x6c57('0x4f')],{})[_0x6c57('0x2b')](function(_0x137578){var _0x39bb5e=_0x1ee006['user']['get']({'plain':!![]});if(!_0x39bb5e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x39bb5e[_0x6c57('0x50')]===_0x6c57('0x51')){var _0x54698f=_0x137578[_0x6c57('0x52')]({'plain':!![]});var _0x3972ac=_0x6c57('0x2d');return db[_0x6c57('0x53')][_0x6c57('0x4d')]({'where':{'name':_0x3972ac,'userProfileId':_0x39bb5e[_0x6c57('0x54')]},'raw':!![]})[_0x6c57('0x2b')](function(_0x45fe0e){if(_0x45fe0e&&_0x45fe0e[_0x6c57('0x55')]===0x0){return db[_0x6c57('0x56')]['create']({'name':_0x54698f[_0x6c57('0x31')],'resourceId':_0x54698f['id'],'type':_0x45fe0e['name'],'sectionId':_0x45fe0e['id']},{})['then'](function(){return _0x137578;});}else{return _0x137578;}})['catch'](function(_0x101ae6){logger[_0x6c57('0x2f')](_0x6c57('0x57'),_0x101ae6);throw _0x101ae6;});}return _0x137578;})[_0x6c57('0x2b')](respondWithResult(_0x3bb09b,0xc9))[_0x6c57('0x4a')](handleError(_0x3bb09b,null));};exports[_0x6c57('0x2a')]=function(_0x16117a,_0x2b08ee){if(_0x16117a[_0x6c57('0x4f')]['id']){delete _0x16117a[_0x6c57('0x4f')]['id'];}return db['SquareProject'][_0x6c57('0x4d')]({'where':{'id':_0x16117a[_0x6c57('0x4c')]['id']}})[_0x6c57('0x2b')](handleEntityNotFound(_0x2b08ee,null))['then'](saveUpdates(_0x16117a['body'],null))[_0x6c57('0x2b')](respondWithResult(_0x2b08ee,null))[_0x6c57('0x4a')](handleError(_0x2b08ee,null));};exports[_0x6c57('0x2c')]=function(_0x3b7efc,_0x572ada){return db[_0x6c57('0x33')]['find']({'where':{'id':_0x3b7efc['params']['id']}})[_0x6c57('0x2b')](handleEntityNotFound(_0x572ada,null))['then'](removeEntity(_0x572ada,null))[_0x6c57('0x4a')](handleError(_0x572ada,null));};exports[_0x6c57('0x58')]=function(_0x2c75d6,_0x31372f,_0x349a6a){return db[_0x6c57('0x33')]['find']({'where':{'id':_0x2c75d6[_0x6c57('0x4c')]['id']}})[_0x6c57('0x2b')](handleEntityNotFound(_0x31372f,null))[_0x6c57('0x2b')](function(_0x274a18){if(_0x274a18){return _0x274a18[_0x6c57('0x58')](_0x2c75d6['body'][_0x6c57('0x59')],_['omit'](_0x2c75d6[_0x6c57('0x4f')],[_0x6c57('0x59'),'id'])||{});}})[_0x6c57('0x2b')](respondWithResult(_0x31372f,null))[_0x6c57('0x4a')](handleError(_0x31372f,null));};exports[_0x6c57('0x5a')]=function(_0x4664da,_0x2441f6,_0x1705f8){return db[_0x6c57('0x33')][_0x6c57('0x4d')]({'where':{'id':_0x4664da[_0x6c57('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2441f6,null))['then'](function(_0x589480){if(_0x589480){return _0x589480['removeUsers'](_0x4664da[_0x6c57('0x39')][_0x6c57('0x59')])['then'](function(){if(_[_0x6c57('0x5b')](_0x4664da['query']['ids'])){for(var _0x432fb9=0x0;_0x432fb9<_0x4664da[_0x6c57('0x39')][_0x6c57('0x59')][_0x6c57('0x3f')];_0x432fb9+=0x1){socket[_0x6c57('0x5c')]('userSquareProject:remove',{'UserId':Number(_0x4664da[_0x6c57('0x39')][_0x6c57('0x59')][_0x432fb9]),'SquareProjectId':Number(_0x4664da[_0x6c57('0x4c')]['id'])});}}else{socket[_0x6c57('0x5c')](_0x6c57('0x5d'),{'UserId':Number(_0x4664da[_0x6c57('0x39')]['ids']),'SquareProjectId':Number(_0x4664da[_0x6c57('0x4c')]['id'])});}});}})[_0x6c57('0x2b')](respondWithStatusCode(_0x2441f6,null))[_0x6c57('0x4a')](handleError(_0x2441f6,null));};exports[_0x6c57('0x5e')]=function(_0x32c3ed,_0xcddbd7,_0x271670){var _0x404e2e={};var _0x1e2d91={};var _0x392b42;var _0x16e234;return db['SquareProject'][_0x6c57('0x5f')]({'where':{'id':_0x32c3ed[_0x6c57('0x4c')]['id']}})[_0x6c57('0x2b')](handleEntityNotFound(_0xcddbd7,null))[_0x6c57('0x2b')](function(_0x3a7516){if(_0x3a7516){_0x392b42=_0x3a7516;_0x1e2d91[_0x6c57('0x37')]=_[_0x6c57('0x3a')](db['User'][_0x6c57('0x34')]);_0x1e2d91[_0x6c57('0x39')]=_[_0x6c57('0x3a')](_0x32c3ed[_0x6c57('0x39')]);_0x1e2d91['filters']=_['intersection'](_0x1e2d91[_0x6c57('0x37')],_0x1e2d91[_0x6c57('0x39')]);_0x404e2e[_0x6c57('0x3d')]=_[_0x6c57('0x3c')](_0x1e2d91[_0x6c57('0x37')],qs[_0x6c57('0x3e')](_0x32c3ed[_0x6c57('0x39')]['fields']));_0x404e2e['attributes']=_0x404e2e[_0x6c57('0x3d')]['length']?_0x404e2e['attributes']:_0x1e2d91[_0x6c57('0x37')];_0x404e2e[_0x6c57('0x60')]=qs['sort'](_0x32c3ed[_0x6c57('0x39')]['sort']);_0x404e2e['where']=qs['filters'](_[_0x6c57('0x43')](_0x32c3ed[_0x6c57('0x39')],_0x1e2d91[_0x6c57('0x3b')]));if(_0x32c3ed[_0x6c57('0x39')][_0x6c57('0x44')]){_0x404e2e['where']=_['merge'](_0x404e2e[_0x6c57('0x42')],{'$or':_[_0x6c57('0x38')](_0x404e2e[_0x6c57('0x3d')],function(_0x5b2556){var _0x2d3578={};_0x2d3578[_0x5b2556]={'$like':'%'+_0x32c3ed[_0x6c57('0x39')][_0x6c57('0x44')]+'%'};return _0x2d3578;})});}_0x404e2e=_[_0x6c57('0x45')]({},_0x404e2e,_0x32c3ed[_0x6c57('0x46')]);return _0x392b42[_0x6c57('0x5e')](_0x404e2e);}})[_0x6c57('0x2b')](function(_0x2dfd3e){if(_0x2dfd3e){_0x16e234=_0x2dfd3e[_0x6c57('0x3f')];if(!_0x32c3ed['query'][_0x6c57('0x40')](_0x6c57('0x61'))){_0x404e2e['limit']=qs['limit'](_0x32c3ed[_0x6c57('0x39')][_0x6c57('0x22')]);_0x404e2e[_0x6c57('0x24')]=qs[_0x6c57('0x24')](_0x32c3ed[_0x6c57('0x39')][_0x6c57('0x24')]);}return _0x392b42[_0x6c57('0x5e')](_0x404e2e);}})[_0x6c57('0x2b')](function(_0x19ea03){if(_0x19ea03){return _0x19ea03?{'count':_0x16e234,'rows':_0x19ea03}:null;}})['then'](respondWithResult(_0xcddbd7,null))[_0x6c57('0x4a')](handleError(_0xcddbd7,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 2505fc3..0bfda93 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 _0xbe45=['hook','exports','events','SquareProject','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x417549,_0x273eb9){var _0x4e9b53=function(_0x542592){while(--_0x542592){_0x417549['push'](_0x417549['shift']());}};_0x4e9b53(++_0x273eb9);}(_0xbe45,0x65));var _0x5be4=function(_0x1e1849,_0x138bfb){_0x1e1849=_0x1e1849-0x0;var _0x1cbb09=_0xbe45[_0x1e1849];return _0x1cbb09;};'use strict';var EventEmitter=require(_0x5be4('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x5be4('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x5be4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5be4('0x3'),'afterDestroy':_0x5be4('0x4')};function emitEvent(_0x14fcac){return function(_0x439212,_0x45206b,_0xf5b642){SquareProjectEvents['emit'](_0x14fcac+':'+_0x439212['id'],_0x439212);SquareProjectEvents[_0x5be4('0x5')](_0x14fcac,_0x439212);_0xf5b642(null);};}for(var e in events){if(events[_0x5be4('0x6')](e)){var event=events[e];SquareProject[_0x5be4('0x7')](e,emitEvent(event));}}module[_0x5be4('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x7989=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject'];(function(_0x4a6a1f,_0x4b95d3){var _0x562a3e=function(_0x505933){while(--_0x505933){_0x4a6a1f['push'](_0x4a6a1f['shift']());}};_0x562a3e(++_0x4b95d3);}(_0x7989,0x1ac));var _0x9798=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x7989[_0x48d6a3];return _0x38bfa0;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x9798('0x0'))['db'][_0x9798('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9798('0x2')](0x0);var events={'afterCreate':_0x9798('0x3'),'afterUpdate':_0x9798('0x4'),'afterDestroy':_0x9798('0x5')};function emitEvent(_0x5ae515){return function(_0x47e0bb,_0xa60931,_0x100080){SquareProjectEvents['emit'](_0x5ae515+':'+_0x47e0bb['id'],_0x47e0bb);SquareProjectEvents[_0x9798('0x6')](_0x5ae515,_0x47e0bb);_0x100080(null);};}for(var e in events){if(events[_0x9798('0x7')](e)){var event=events[e];SquareProject[_0x9798('0x8')](e,emitEvent(event));}}module[_0x9798('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 6cccd41..7d9a1c6 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 _0x4018=['savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','util','../../config/logger','api','moment','bluebird','path','rimraf','./squareProject.attributes','exports','SquareProject','square_projects','changed','preproduction'];(function(_0x40d411,_0x4642f1){var _0x51fd22=function(_0x1031c5){while(--_0x1031c5){_0x40d411['push'](_0x40d411['shift']());}};_0x51fd22(++_0x4642f1);}(_0x4018,0x83));var _0x8401=function(_0x1caf4f,_0xd0b32d){_0x1caf4f=_0x1caf4f-0x0;var _0x11b9e2=_0x4018[_0x1caf4f];return _0x11b9e2;};'use strict';var _=require('lodash');var util=require(_0x8401('0x0'));var logger=require(_0x8401('0x1'))(_0x8401('0x2'));var moment=require(_0x8401('0x3'));var BPromise=require(_0x8401('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8401('0x5'));var rimraf=require(_0x8401('0x6'));var config=require('../../config/environment');var attributes=require(_0x8401('0x7'));module[_0x8401('0x8')]=function(_0x238f89,_0x19da5a){return _0x238f89['define'](_0x8401('0x9'),attributes,{'tableName':_0x8401('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5b7cdb,_0x194af3,_0xaf0d7f){if(_0x5b7cdb[_0x8401('0xb')](_0x8401('0xc'))){_0x5b7cdb[_0x8401('0xd')]=moment()[_0x8401('0xe')](_0x8401('0xf'));}if(_0x5b7cdb['changed'](_0x8401('0x10'))){_0x5b7cdb[_0x8401('0x11')]=moment()[_0x8401('0xe')](_0x8401('0xf'));}_0xaf0d7f(null,_0x5b7cdb);}}});}; \ No newline at end of file +var _0x2cac=['rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','preproduction','savedAt','format','changed','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x15b592,_0x2a6a71){var _0x108363=function(_0x15045d){while(--_0x15045d){_0x15b592['push'](_0x15b592['shift']());}};_0x108363(++_0x2a6a71);}(_0x2cac,0xa8));var _0xc2ca=function(_0x30791a,_0x4db565){_0x30791a=_0x30791a-0x0;var _0x5393e6=_0x2cac[_0x30791a];return _0x5393e6;};'use strict';var _=require(_0xc2ca('0x0'));var util=require(_0xc2ca('0x1'));var logger=require(_0xc2ca('0x2'))(_0xc2ca('0x3'));var moment=require(_0xc2ca('0x4'));var BPromise=require(_0xc2ca('0x5'));var rp=require(_0xc2ca('0x6'));var fs=require('fs');var path=require(_0xc2ca('0x7'));var rimraf=require(_0xc2ca('0x8'));var config=require(_0xc2ca('0x9'));var attributes=require(_0xc2ca('0xa'));module[_0xc2ca('0xb')]=function(_0x52290a,_0x15ddcc){return _0x52290a[_0xc2ca('0xc')](_0xc2ca('0xd'),attributes,{'tableName':_0xc2ca('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34648d,_0x1fbd85,_0x1480e1){if(_0x34648d['changed'](_0xc2ca('0xf'))){_0x34648d[_0xc2ca('0x10')]=moment()[_0xc2ca('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x34648d[_0xc2ca('0x12')](_0xc2ca('0x13'))){_0x34648d[_0xc2ca('0x14')]=moment()[_0xc2ca('0x11')](_0xc2ca('0x15'));}_0x1480e1(null,_0x34648d);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 34cea62..d2d3299 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 _0x98e5=['debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','request','then','info'];(function(_0x3c71eb,_0x1c8d2f){var _0x569c90=function(_0x46dc93){while(--_0x46dc93){_0x3c71eb['push'](_0x3c71eb['shift']());}};_0x569c90(++_0x1c8d2f);}(_0x98e5,0x18e));var _0x598e=function(_0x34064a,_0xe97180){_0x34064a=_0x34064a-0x0;var _0x28d10d=_0x98e5[_0x34064a];return _0x28d10d;};'use strict';var _=require(_0x598e('0x0'));var util=require(_0x598e('0x1'));var moment=require(_0x598e('0x2'));var BPromise=require(_0x598e('0x3'));var rs=require(_0x598e('0x4'));var fs=require('fs');var Redis=require(_0x598e('0x5'));var db=require(_0x598e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x598e('0x7'))('rpc');var config=require(_0x598e('0x8'));var jayson=require(_0x598e('0x9'));var client=jayson[_0x598e('0xa')][_0x598e('0xb')]({'port':0x232a});config[_0x598e('0xc')]=_[_0x598e('0xd')](config[_0x598e('0xc')],{'host':_0x598e('0xe'),'port':0x18eb});var socket=require(_0x598e('0xf'))(new Redis(config[_0x598e('0xc')]));require(_0x598e('0x10'))['register'](socket);function respondWithRpcPromise(_0x547980,_0x42ec73,_0x21b541){return new BPromise(function(_0x4387a7,_0xb03132){return client[_0x598e('0x11')](_0x547980,_0x21b541)[_0x598e('0x12')](function(_0x20e63a){logger[_0x598e('0x13')]('SquareProject,\x20%s,\x20%s',_0x42ec73,'request\x20sent');logger[_0x598e('0x14')](_0x598e('0x15'),_0x42ec73,_0x598e('0x16'),JSON[_0x598e('0x17')](_0x20e63a));if(_0x20e63a[_0x598e('0x18')]){if(_0x20e63a['error'][_0x598e('0x19')]===0x1f4){logger[_0x598e('0x18')]('SquareProject,\x20%s,\x20%s',_0x42ec73,_0x20e63a[_0x598e('0x18')]['message']);return _0xb03132(_0x20e63a[_0x598e('0x18')][_0x598e('0x1a')]);}logger[_0x598e('0x18')]('SquareProject,\x20%s,\x20%s',_0x42ec73,_0x20e63a[_0x598e('0x18')][_0x598e('0x1a')]);return _0x4387a7(_0x20e63a[_0x598e('0x18')][_0x598e('0x1a')]);}else{logger[_0x598e('0x13')]('SquareProject,\x20%s,\x20%s',_0x42ec73,_0x598e('0x16'));_0x4387a7(_0x20e63a['result'][_0x598e('0x1a')]);}})[_0x598e('0x1b')](function(_0x27d153){logger[_0x598e('0x18')]('SquareProject,\x20%s,\x20%s',_0x42ec73,_0x27d153);_0xb03132(_0x27d153);});});}exports[_0x598e('0x1c')]=function(_0x37f10c){var _0x19a906=this;return new Promise(function(_0x206c66,_0x527d1a){return db[_0x598e('0x1d')][_0x598e('0x1e')]({'raw':_0x37f10c['options']?_0x37f10c[_0x598e('0x1f')][_0x598e('0x20')]===undefined?!![]:![]:!![],'where':_0x37f10c[_0x598e('0x1f')]?_0x37f10c['options'][_0x598e('0x21')]||null:null,'attributes':_0x37f10c['options']?_0x37f10c[_0x598e('0x1f')][_0x598e('0x22')]||null:null,'include':_0x37f10c[_0x598e('0x1f')]?_0x37f10c['options'][_0x598e('0x23')]?_[_0x598e('0x24')](_0x37f10c[_0x598e('0x1f')][_0x598e('0x23')],function(_0x466276){return{'model':db[_0x466276[_0x598e('0x25')]],'as':_0x466276['as'],'attributes':_0x466276['attributes'],'include':_0x466276['include']?_[_0x598e('0x24')](_0x466276[_0x598e('0x23')],function(_0x3f629c){return{'model':db[_0x3f629c['model']],'as':_0x3f629c['as'],'attributes':_0x3f629c[_0x598e('0x22')],'include':_0x3f629c[_0x598e('0x23')]?_['map'](_0x3f629c['include'],function(_0x3e78d4){return{'model':db[_0x3e78d4[_0x598e('0x25')]],'as':_0x3e78d4['as'],'attributes':_0x3e78d4[_0x598e('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58b463){logger[_0x598e('0x13')](_0x598e('0x1c'),_0x37f10c);logger[_0x598e('0x14')](_0x598e('0x1c'),_0x37f10c,JSON[_0x598e('0x17')](_0x58b463));_0x206c66(_0x58b463);})[_0x598e('0x1b')](function(_0x17772f){logger[_0x598e('0x18')](_0x598e('0x1c'),_0x17772f[_0x598e('0x1a')],_0x37f10c);_0x527d1a(_0x19a906[_0x598e('0x18')](0x1f4,_0x17772f[_0x598e('0x1a')]));});});}; \ No newline at end of file +var _0x103d=['map','then','ShowSquareProject','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','SquareProject','find','options','raw','where','attributes','include','model'];(function(_0x2f2dd0,_0x242127){var _0x3c48d1=function(_0x4516b1){while(--_0x4516b1){_0x2f2dd0['push'](_0x2f2dd0['shift']());}};_0x3c48d1(++_0x242127);}(_0x103d,0x11b));var _0xd103=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x103d[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0xd103('0x0'));var util=require(_0xd103('0x1'));var moment=require(_0xd103('0x2'));var BPromise=require(_0xd103('0x3'));var rs=require(_0xd103('0x4'));var fs=require('fs');var Redis=require(_0xd103('0x5'));var db=require(_0xd103('0x6'))['db'];var utils=require(_0xd103('0x7'));var logger=require(_0xd103('0x8'))('rpc');var config=require(_0xd103('0x9'));var jayson=require(_0xd103('0xa'));var client=jayson[_0xd103('0xb')][_0xd103('0xc')]({'port':0x232a});config[_0xd103('0xd')]=_[_0xd103('0xe')](config[_0xd103('0xd')],{'host':_0xd103('0xf'),'port':0x18eb});var socket=require(_0xd103('0x10'))(new Redis(config[_0xd103('0xd')]));require(_0xd103('0x11'))['register'](socket);function respondWithRpcPromise(_0x4257d1,_0x3a41f7,_0x21a468){return new BPromise(function(_0x31bb4a,_0x204b2a){return client[_0xd103('0x12')](_0x4257d1,_0x21a468)['then'](function(_0x33931c){logger[_0xd103('0x13')](_0xd103('0x14'),_0x3a41f7,_0xd103('0x15'));logger[_0xd103('0x16')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x3a41f7,_0xd103('0x15'),JSON[_0xd103('0x17')](_0x33931c));if(_0x33931c[_0xd103('0x18')]){if(_0x33931c['error'][_0xd103('0x19')]===0x1f4){logger[_0xd103('0x18')]('SquareProject,\x20%s,\x20%s',_0x3a41f7,_0x33931c[_0xd103('0x18')][_0xd103('0x1a')]);return _0x204b2a(_0x33931c[_0xd103('0x18')][_0xd103('0x1a')]);}logger[_0xd103('0x18')](_0xd103('0x14'),_0x3a41f7,_0x33931c[_0xd103('0x18')][_0xd103('0x1a')]);return _0x31bb4a(_0x33931c['error'][_0xd103('0x1a')]);}else{logger['info'](_0xd103('0x14'),_0x3a41f7,'request\x20sent');_0x31bb4a(_0x33931c[_0xd103('0x1b')][_0xd103('0x1a')]);}})[_0xd103('0x1c')](function(_0x42c8a3){logger[_0xd103('0x18')](_0xd103('0x14'),_0x3a41f7,_0x42c8a3);_0x204b2a(_0x42c8a3);});});}exports['ShowSquareProject']=function(_0x510b7c){var _0x549ee4=this;return new Promise(function(_0x26b56c,_0xcff50e){return db[_0xd103('0x1d')][_0xd103('0x1e')]({'raw':_0x510b7c[_0xd103('0x1f')]?_0x510b7c[_0xd103('0x1f')][_0xd103('0x20')]===undefined?!![]:![]:!![],'where':_0x510b7c['options']?_0x510b7c['options'][_0xd103('0x21')]||null:null,'attributes':_0x510b7c['options']?_0x510b7c['options'][_0xd103('0x22')]||null:null,'include':_0x510b7c['options']?_0x510b7c[_0xd103('0x1f')][_0xd103('0x23')]?_['map'](_0x510b7c[_0xd103('0x1f')][_0xd103('0x23')],function(_0x2c2a2c){return{'model':db[_0x2c2a2c[_0xd103('0x24')]],'as':_0x2c2a2c['as'],'attributes':_0x2c2a2c['attributes'],'include':_0x2c2a2c['include']?_[_0xd103('0x25')](_0x2c2a2c[_0xd103('0x23')],function(_0x5678a0){return{'model':db[_0x5678a0[_0xd103('0x24')]],'as':_0x5678a0['as'],'attributes':_0x5678a0['attributes'],'include':_0x5678a0[_0xd103('0x23')]?_['map'](_0x5678a0['include'],function(_0xb79ee9){return{'model':db[_0xb79ee9[_0xd103('0x24')]],'as':_0xb79ee9['as'],'attributes':_0xb79ee9[_0xd103('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd103('0x26')](function(_0xc460e0){logger[_0xd103('0x13')](_0xd103('0x27'),_0x510b7c);logger[_0xd103('0x16')](_0xd103('0x27'),_0x510b7c,JSON[_0xd103('0x17')](_0xc460e0));_0x26b56c(_0xc460e0);})[_0xd103('0x1c')](function(_0x3be41c){logger[_0xd103('0x18')]('ShowSquareProject',_0x3be41c[_0xd103('0x1a')],_0x510b7c);_0xcff50e(_0x549ee4[_0xd103('0x18')](0x1f4,_0x3be41c['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 03eb1f3..402111e 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 _0x908c=['length','squareProject:','update','removeListener','register'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x908c,0x1ce));var _0xc908=function(_0x1db260,_0xba7088){_0x1db260=_0x1db260-0x0;var _0x9d052a=_0x908c[_0x1db260];return _0x9d052a;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save','remove',_0xc908('0x0')];function createListener(_0x2231a0,_0x5c14df){return function(_0x2bf882){_0x5c14df['emit'](_0x2231a0,_0x2bf882);};}function removeListener(_0x11f957,_0x27ef28){return function(){SquareProjectEvents[_0xc908('0x1')](_0x11f957,_0x27ef28);};}exports[_0xc908('0x2')]=function(_0x5f2747){for(var _0x364eca=0x0,_0x584702=events[_0xc908('0x3')];_0x364eca<_0x584702;_0x364eca++){var _0x419f5c=events[_0x364eca];var _0x5cd1e2=createListener(_0xc908('0x4')+_0x419f5c,_0x5f2747);SquareProjectEvents['on'](_0x419f5c,_0x5cd1e2);}}; \ No newline at end of file +var _0x5313=['save','remove','update','emit','removeListener','register','squareProject:','./squareProject.events'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0x5313,0x117));var _0x3531=function(_0x158745,_0x169ea1){_0x158745=_0x158745-0x0;var _0x489604=_0x5313[_0x158745];return _0x489604;};'use strict';var SquareProjectEvents=require(_0x3531('0x0'));var events=[_0x3531('0x1'),_0x3531('0x2'),_0x3531('0x3')];function createListener(_0x43f3fa,_0x5bbb5c){return function(_0x340151){_0x5bbb5c[_0x3531('0x4')](_0x43f3fa,_0x340151);};}function removeListener(_0x3f8c0f,_0x2d2d8a){return function(){SquareProjectEvents[_0x3531('0x5')](_0x3f8c0f,_0x2d2d8a);};}exports[_0x3531('0x6')]=function(_0x1df2ce){for(var _0x40ece4=0x0,_0x19f4f6=events['length'];_0x40ece4<_0x19f4f6;_0x40ece4++){var _0x32f711=events[_0x40ece4];var _0x39761c=createListener(_0x3531('0x7')+_0x32f711,_0x1df2ce);SquareProjectEvents['on'](_0x32f711,_0x39761c);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index b824534..791faba 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 _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x2581b1,_0x555602){var _0x3a46a6=function(_0x13a67c){while(--_0x13a67c){_0x2581b1['push'](_0x2581b1['shift']());}};_0x3a46a6(++_0x555602);}(_0x1261,0x144));var _0x1126=function(_0xcd9ece,_0x33ff67){_0xcd9ece=_0xcd9ece-0x0;var _0x36f54f=_0x1261[_0xcd9ece];return _0x36f54f;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x248e06,_0x5e7715){var _0x2353de=function(_0x1ac66f){while(--_0x1ac66f){_0x248e06['push'](_0x248e06['shift']());}};_0x2353de(++_0x5e7715);}(_0x53ec,0x192));var _0xc53e=function(_0x2d48fa,_0x103065){_0x2d48fa=_0x2d48fa-0x0;var _0x4645b7=_0x53ec[_0x2d48fa];return _0x4645b7;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 01bfebe..011b2c8 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 _0x6aa7=['VIRTUAL','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x101a17,_0x5d047a){var _0x3b76ee=function(_0x89be1b){while(--_0x89be1b){_0x101a17['push'](_0x101a17['shift']());}};_0x3b76ee(++_0x5d047a);}(_0x6aa7,0x178));var _0x76aa=function(_0x3d70d0,_0x1290be){_0x3d70d0=_0x3d70d0-0x0;var _0x5733ee=_0x6aa7[_0x3d70d0];return _0x5733ee;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'callerid':{'type':Sequelize[_0x76aa('0x1')]},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'context':{'type':Sequelize[_0x76aa('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x1')]},'accountcode':{'type':Sequelize[_0x76aa('0x1')]},'dnid':{'type':Sequelize[_0x76aa('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x76aa('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x76aa('0x2')],'get':function(){var _0x36d12b='';var _0xa9b695=this['getDataValue'](_0x76aa('0x3'));if(_0xa9b695){_0x36d12b=_0xa9b695[_0x76aa('0x4')](_0xa9b695[_0x76aa('0x5')]('.'));}return _0x36d12b;}}}; \ No newline at end of file +var _0xeda8=['substring','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xeda8,0x104));var _0x8eda=function(_0x3d6e8a,_0xcc7b25){_0x3d6e8a=_0x3d6e8a-0x0;var _0x1eb26a=_0xeda8[_0x3d6e8a];return _0x1eb26a;};'use strict';var Sequelize=require(_0x8eda('0x0'));module[_0x8eda('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x8eda('0x2')]},'calleridname':{'type':Sequelize[_0x8eda('0x2')]},'context':{'type':Sequelize[_0x8eda('0x2')]},'extension':{'type':Sequelize[_0x8eda('0x2')]},'priority':{'type':Sequelize[_0x8eda('0x2')]},'accountcode':{'type':Sequelize[_0x8eda('0x2')]},'dnid':{'type':Sequelize[_0x8eda('0x2')]},'projectName':{'type':Sequelize[_0x8eda('0x2')]},'saveName':{'type':Sequelize[_0x8eda('0x2')]},'filename':{'type':Sequelize[_0x8eda('0x2')]},'savePath':{'type':Sequelize[_0x8eda('0x2')]},'format':{'type':Sequelize[_0x8eda('0x3')],'get':function(){var _0x4e2ebb='';var _0x28b721=this[_0x8eda('0x4')](_0x8eda('0x5'));if(_0x28b721){_0x4e2ebb=_0x28b721[_0x8eda('0x6')](_0x28b721['lastIndexOf']('.'));}return _0x4e2ebb;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 4f005c8..59419af 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 _0x47f6=['fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','download','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','destroy','isNil','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','error','stack','name','send','index','map','SquareRecording','rawAttributes','type','model','query','keys','filters','intersection','attributes'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x47f6,0xec));var _0x647f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x47f6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x647f('0x0'));var zipdir=require(_0x647f('0x1'));var jsonpatch=require(_0x647f('0x2'));var rp=require(_0x647f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x647f('0x4'));var util=require(_0x647f('0x5'));var path=require('path');var sox=require(_0x647f('0x6'));var csv=require(_0x647f('0x7'));var ejs=require(_0x647f('0x8'));var fs=require('fs');var fs_extra=require(_0x647f('0x9'));var _=require(_0x647f('0xa'));var squel=require(_0x647f('0xb'));var crypto=require(_0x647f('0xc'));var jsforce=require(_0x647f('0xd'));var deskjs=require(_0x647f('0xe'));var toCsv=require(_0x647f('0x7'));var querystring=require(_0x647f('0xf'));var Papa=require(_0x647f('0x10'));var Redis=require(_0x647f('0x11'));var authService=require(_0x647f('0x12'));var qs=require(_0x647f('0x13'));var as=require(_0x647f('0x14'));var hardwareService=require(_0x647f('0x15'));var logger=require(_0x647f('0x16'))(_0x647f('0x17'));var utils=require(_0x647f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x647f('0x19'));var db=require(_0x647f('0x1a'))['db'];function respondWithStatusCode(_0x3abf82,_0x2777d0){_0x2777d0=_0x2777d0||0xcc;return function(_0x3bee9d){if(_0x3bee9d){return _0x3abf82[_0x647f('0x1b')](_0x2777d0);}return _0x3abf82[_0x647f('0x1c')](_0x2777d0)[_0x647f('0x1d')]();};}function respondWithResult(_0x132049,_0x44b864){_0x44b864=_0x44b864||0xc8;return function(_0x1f9d69){if(_0x1f9d69){return _0x132049[_0x647f('0x1c')](_0x44b864)[_0x647f('0x1e')](_0x1f9d69);}};}function respondWithFilteredResult(_0x1fc8f3,_0x2a4367){return function(_0x229df5){if(_0x229df5){var _0x121e4f=typeof _0x2a4367[_0x647f('0x1f')]==='undefined'&&typeof _0x2a4367['limit']===_0x647f('0x20');var _0x1a362c=_0x229df5[_0x647f('0x21')];var _0x47d016=_0x121e4f?0x0:_0x2a4367[_0x647f('0x1f')];var _0xad3a10=_0x121e4f?_0x229df5[_0x647f('0x21')]:_0x2a4367['offset']+_0x2a4367[_0x647f('0x22')];var _0xfe90f0;if(_0xad3a10>=_0x1a362c){_0xad3a10=_0x1a362c;_0xfe90f0=0xc8;}else{_0xfe90f0=0xce;}_0x1fc8f3['status'](_0xfe90f0);return _0x1fc8f3['set'](_0x647f('0x23'),_0x47d016+'-'+_0xad3a10+'/'+_0x1a362c)[_0x647f('0x1e')](_0x229df5);}return null;};}function patchUpdates(_0x49611){return function(_0x131621){try{jsonpatch['apply'](_0x131621,_0x49611,!![]);}catch(_0x4f280a){return BPromise[_0x647f('0x24')](_0x4f280a);}return _0x131621[_0x647f('0x25')]();};}function saveUpdates(_0x1ef3f8,_0x1db8d9){return function(_0x2a3515){if(_0x2a3515){return _0x2a3515[_0x647f('0x26')](_0x1ef3f8)['then'](function(_0x3a6c85){return _0x3a6c85;});}return null;};}function removeEntity(_0x3feeec,_0x2f7435){return function(_0x10f991){if(_0x10f991){return _0x10f991['destroy']()[_0x647f('0x27')](function(){_0x3feeec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7468eb,_0x3cee06){return function(_0x4a31c1){if(!_0x4a31c1){_0x7468eb[_0x647f('0x1b')](0x194);}return _0x4a31c1;};}function handleError(_0x4fc3a9,_0x4803cd){_0x4803cd=_0x4803cd||0x1f4;return function(_0x55864a){logger[_0x647f('0x28')](_0x55864a[_0x647f('0x29')]);if(_0x55864a[_0x647f('0x2a')]){delete _0x55864a[_0x647f('0x2a')];}_0x4fc3a9[_0x647f('0x1c')](_0x4803cd)[_0x647f('0x2b')](_0x55864a);};}exports[_0x647f('0x2c')]=function(_0x5a578a,_0x379c89){var _0x53ca49={},_0x133a1d={},_0x5d4ecc={'count':0x0,'rows':[]};var _0x5c2eb0=_[_0x647f('0x2d')](db[_0x647f('0x2e')][_0x647f('0x2f')],function(_0x39c5d8){return{'name':_0x39c5d8['fieldName'],'type':_0x39c5d8[_0x647f('0x30')]['key']};});_0x133a1d[_0x647f('0x31')]=_['map'](_0x5c2eb0,_0x647f('0x2a'));_0x133a1d[_0x647f('0x32')]=_[_0x647f('0x33')](_0x5a578a['query']);_0x133a1d[_0x647f('0x34')]=_[_0x647f('0x35')](_0x133a1d[_0x647f('0x31')],_0x133a1d['query']);_0x53ca49[_0x647f('0x36')]=_[_0x647f('0x35')](_0x133a1d[_0x647f('0x31')],qs[_0x647f('0x37')](_0x5a578a['query'][_0x647f('0x37')]));_0x53ca49[_0x647f('0x36')]=_0x53ca49[_0x647f('0x36')][_0x647f('0x38')]?_0x53ca49[_0x647f('0x36')]:_0x133a1d[_0x647f('0x31')];if(!_0x5a578a[_0x647f('0x32')][_0x647f('0x39')](_0x647f('0x3a'))){_0x53ca49['limit']=qs['limit'](_0x5a578a[_0x647f('0x32')]['limit']);_0x53ca49[_0x647f('0x1f')]=qs[_0x647f('0x1f')](_0x5a578a[_0x647f('0x32')]['offset']);}_0x53ca49[_0x647f('0x3b')]=qs[_0x647f('0x3c')](_0x5a578a['query'][_0x647f('0x3c')]);_0x53ca49[_0x647f('0x3d')]=qs[_0x647f('0x34')](_['pick'](_0x5a578a[_0x647f('0x32')],_0x133a1d[_0x647f('0x34')]),_0x5c2eb0);if(_0x5a578a[_0x647f('0x32')][_0x647f('0x3e')]){_0x53ca49[_0x647f('0x3d')]=_[_0x647f('0x3f')](_0x53ca49[_0x647f('0x3d')],{'$or':_['map'](_0x5c2eb0,function(_0x217dad){if(_0x217dad[_0x647f('0x30')]!=='VIRTUAL'){var _0x3f8b72={};_0x3f8b72[_0x217dad[_0x647f('0x2a')]]={'$like':'%'+_0x5a578a[_0x647f('0x32')]['filter']+'%'};return _0x3f8b72;}})});}_0x53ca49=_[_0x647f('0x3f')]({},_0x53ca49,_0x5a578a[_0x647f('0x40')]);var _0x92babc={'where':_0x53ca49[_0x647f('0x3d')]};return db[_0x647f('0x2e')][_0x647f('0x21')](_0x92babc)[_0x647f('0x27')](function(_0x5c41e8){_0x5d4ecc[_0x647f('0x21')]=_0x5c41e8;if(_0x5a578a['query'][_0x647f('0x41')]){_0x53ca49['include']=[{'all':!![]}];}return db[_0x647f('0x2e')][_0x647f('0x42')](_0x53ca49);})['then'](function(_0xaf842e){_0x5d4ecc[_0x647f('0x43')]=_0xaf842e;return _0x5d4ecc;})[_0x647f('0x27')](respondWithFilteredResult(_0x379c89,_0x53ca49))[_0x647f('0x44')](handleError(_0x379c89,null));};exports[_0x647f('0x45')]=function(_0x236686,_0x1143cb){var _0x181c3a={'raw':!![],'where':{'id':_0x236686['params']['id']}},_0x32be34={};_0x32be34[_0x647f('0x31')]=_['keys'](db[_0x647f('0x2e')][_0x647f('0x2f')]);_0x32be34[_0x647f('0x32')]=_['keys'](_0x236686[_0x647f('0x32')]);_0x32be34['filters']=_['intersection'](_0x32be34['model'],_0x32be34[_0x647f('0x32')]);_0x181c3a[_0x647f('0x36')]=_[_0x647f('0x35')](_0x32be34[_0x647f('0x31')],qs[_0x647f('0x37')](_0x236686[_0x647f('0x32')][_0x647f('0x37')]));_0x181c3a[_0x647f('0x36')]=_0x181c3a[_0x647f('0x36')][_0x647f('0x38')]?_0x181c3a[_0x647f('0x36')]:_0x32be34['model'];if(_0x236686['query'][_0x647f('0x41')]){_0x181c3a[_0x647f('0x46')]=[{'all':!![]}];}_0x181c3a=_['merge']({},_0x181c3a,_0x236686[_0x647f('0x40')]);return db[_0x647f('0x2e')][_0x647f('0x47')](_0x181c3a)[_0x647f('0x27')](handleEntityNotFound(_0x1143cb,null))[_0x647f('0x27')](respondWithResult(_0x1143cb,null))['catch'](handleError(_0x1143cb,null));};exports[_0x647f('0x48')]=function(_0xdaefef,_0x183e84){return db[_0x647f('0x2e')][_0x647f('0x48')](_0xdaefef[_0x647f('0x49')],{})[_0x647f('0x27')](respondWithResult(_0x183e84,0xc9))[_0x647f('0x44')](handleError(_0x183e84,null));};exports[_0x647f('0x26')]=function(_0xed7118,_0x40ba08){if(_0xed7118[_0x647f('0x49')]['id']){delete _0xed7118[_0x647f('0x49')]['id'];}return db['SquareRecording'][_0x647f('0x47')]({'where':{'id':_0xed7118[_0x647f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x40ba08,null))[_0x647f('0x27')](saveUpdates(_0xed7118['body'],null))[_0x647f('0x27')](respondWithResult(_0x40ba08,null))[_0x647f('0x44')](handleError(_0x40ba08,null));};exports[_0x647f('0x4b')]=function(_0x3b7785,_0x2bcc16,_0x2be7d4){var _0x3c8e96=require(_0x647f('0x4c'));var _0x7b8fdf=![];var _0x3abdce={};if(_0x3b7785[_0x647f('0x32')][_0x647f('0x30')]&&_0x3b7785[_0x647f('0x32')][_0x647f('0x30')]===_0x647f('0x4d')){_0x3abdce[_0x647f('0x4d')]=_0x3b7785['params']['id'];}else{_0x3abdce['id']=_0x3b7785[_0x647f('0x4a')]['id'];}return db[_0x647f('0x2e')][_0x647f('0x47')]({'where':_0x3abdce,'attributes':['id','savePath',_0x647f('0x4e')],'raw':!![]})[_0x647f('0x27')](handleEntityNotFound(_0x2bcc16,null))['then'](function(_0xe7c613){if(_0xe7c613){var _0x5a0c85=_0xe7c613[_0x647f('0x4f')];var _0x5ba61e=util[_0x647f('0x50')](_0x647f('0x51'),_0x5a0c85);if(fs[_0x647f('0x52')](_0x5ba61e)){_0x7b8fdf=!![];return _0x3c8e96[_0x647f('0x53')](_0x5ba61e,_0x5a0c85,config[_0x647f('0x54')]['recording'])[_0x647f('0x27')](function(){return _0xe7c613;});}return _0xe7c613;}})[_0x647f('0x27')](function(_0x532995){if(_0x532995){var _0x4e56d0=_0x532995[_0x647f('0x4f')];if(!fs['existsSync'](_0x4e56d0)){throw new db[(_0x647f('0x55'))][(_0x647f('0x56'))](_0x647f('0x57'));}if(_0x532995['filename']){return _0x2bcc16[_0x647f('0x4b')](_0x4e56d0,_0x532995[_0x647f('0x4e')]+path[_0x647f('0x58')](_0x4e56d0),function(){if(_0x7b8fdf){fs[_0x647f('0x59')](_0x4e56d0);}});}else{return _0x2bcc16[_0x647f('0x4b')](_0x4e56d0,function(_0x335fbd){if(_0x7b8fdf){fs[_0x647f('0x59')](_0x4e56d0);}});}}})[_0x647f('0x44')](function(_0x574e31){if(_0x574e31[_0x647f('0x5a')]===_0x647f('0x57')){_0x2bcc16[_0x647f('0x1c')](0x194)[_0x647f('0x2b')]('Not\x20found');}else{return handleError(_0x2bcc16,null);}});};exports[_0x647f('0x5b')]=function(_0x247d7d,_0xfcee37){return db['SquareRecording'][_0x647f('0x47')]({'where':{'id':_0x247d7d[_0x647f('0x4a')]['id']}})['then'](function(_0x3a530e){if(_[_0x647f('0x5c')](_0x3a530e)){throw new ReferenceError(_0x647f('0x5d'));}return _0x3a530e;})[_0x647f('0x27')](function(_0x8784cd){var _0x1eb0ac=_0x8784cd[_0x647f('0x4f')];logger[_0x647f('0x5e')]('cancellazione\x20fisica\x20documento\x20%s',_0x1eb0ac);if(!_[_0x647f('0x5c')](_0x8784cd['savePath'])&&fs['existsSync'](_0x1eb0ac)){logger['info']('File:\x20\x22'+_0x1eb0ac+_0x647f('0x5f'));fs[_0x647f('0x60')](_0x1eb0ac);}_0x1eb0ac=_0x1eb0ac+'.cypher';if(!_['isNil'](_0x8784cd[_0x647f('0x4f')])&&fs['existsSync'](_0x1eb0ac)){logger[_0x647f('0x5e')]('File:\x20\x22'+_0x1eb0ac+_0x647f('0x5f'));fs['unlinkSync'](_0x1eb0ac);}return _0x8784cd;})[_0x647f('0x27')](function(_0x4de2b5){if(!_0x4de2b5)throw new InternalError();return _0x4de2b5[_0x647f('0x5b')]();})[_0x647f('0x27')](function(){_0xfcee37['status'](0xcc)[_0x647f('0x1d')]();})[_0x647f('0x44')](handleError(_0xfcee37,null));}; \ No newline at end of file +var _0x13e0=['ValidationError','SquareRecording\x20not\x20found','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','unlinkSync','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','SquareRecording','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','download','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','existsSync','Sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13e0,0xc7));var _0x013e=function(_0x3a9a6f,_0x275999){_0x3a9a6f=_0x3a9a6f-0x0;var _0xe4272d=_0x13e0[_0x3a9a6f];return _0xe4272d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x013e('0x0'));var zipdir=require(_0x013e('0x1'));var jsonpatch=require(_0x013e('0x2'));var rp=require('request-promise');var moment=require(_0x013e('0x3'));var BPromise=require(_0x013e('0x4'));var Mustache=require(_0x013e('0x5'));var util=require(_0x013e('0x6'));var path=require('path');var sox=require(_0x013e('0x7'));var csv=require(_0x013e('0x8'));var ejs=require(_0x013e('0x9'));var fs=require('fs');var fs_extra=require(_0x013e('0xa'));var _=require(_0x013e('0xb'));var squel=require(_0x013e('0xc'));var crypto=require(_0x013e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x013e('0x8'));var querystring=require(_0x013e('0xe'));var Papa=require(_0x013e('0xf'));var Redis=require('ioredis');var authService=require(_0x013e('0x10'));var qs=require(_0x013e('0x11'));var as=require(_0x013e('0x12'));var hardwareService=require(_0x013e('0x13'));var logger=require(_0x013e('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x013e('0x15'));var licenseUtil=require(_0x013e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x448f26,_0x5b9632){_0x5b9632=_0x5b9632||0xcc;return function(_0x562772){if(_0x562772){return _0x448f26[_0x013e('0x17')](_0x5b9632);}return _0x448f26[_0x013e('0x18')](_0x5b9632)['end']();};}function respondWithResult(_0x4da529,_0x2468e2){_0x2468e2=_0x2468e2||0xc8;return function(_0xafd0bc){if(_0xafd0bc){return _0x4da529[_0x013e('0x18')](_0x2468e2)[_0x013e('0x19')](_0xafd0bc);}};}function respondWithFilteredResult(_0x163a55,_0x47aaff){return function(_0x3c716e){if(_0x3c716e){var _0x432295=typeof _0x47aaff['offset']===_0x013e('0x1a')&&typeof _0x47aaff[_0x013e('0x1b')]===_0x013e('0x1a');var _0xe72704=_0x3c716e[_0x013e('0x1c')];var _0x42b0f8=_0x432295?0x0:_0x47aaff['offset'];var _0x4254e4=_0x432295?_0x3c716e['count']:_0x47aaff['offset']+_0x47aaff[_0x013e('0x1b')];var _0x4078bb;if(_0x4254e4>=_0xe72704){_0x4254e4=_0xe72704;_0x4078bb=0xc8;}else{_0x4078bb=0xce;}_0x163a55[_0x013e('0x18')](_0x4078bb);return _0x163a55[_0x013e('0x1d')](_0x013e('0x1e'),_0x42b0f8+'-'+_0x4254e4+'/'+_0xe72704)[_0x013e('0x19')](_0x3c716e);}return null;};}function patchUpdates(_0xec63a2){return function(_0x48ecce){try{jsonpatch[_0x013e('0x1f')](_0x48ecce,_0xec63a2,!![]);}catch(_0x536521){return BPromise[_0x013e('0x20')](_0x536521);}return _0x48ecce[_0x013e('0x21')]();};}function saveUpdates(_0x416f45,_0xbaa60){return function(_0x182903){if(_0x182903){return _0x182903[_0x013e('0x22')](_0x416f45)[_0x013e('0x23')](function(_0x24120d){return _0x24120d;});}return null;};}function removeEntity(_0x593079,_0x220f94){return function(_0xe888c2){if(_0xe888c2){return _0xe888c2[_0x013e('0x24')]()[_0x013e('0x23')](function(){_0x593079[_0x013e('0x18')](0xcc)[_0x013e('0x25')]();});}};}function handleEntityNotFound(_0x4b5c02,_0x57aeef){return function(_0x2ef8b6){if(!_0x2ef8b6){_0x4b5c02[_0x013e('0x17')](0x194);}return _0x2ef8b6;};}function handleError(_0x5170a8,_0x3e62fc){_0x3e62fc=_0x3e62fc||0x1f4;return function(_0x43d3f4){logger['error'](_0x43d3f4[_0x013e('0x26')]);if(_0x43d3f4[_0x013e('0x27')]){delete _0x43d3f4[_0x013e('0x27')];}_0x5170a8['status'](_0x3e62fc)[_0x013e('0x28')](_0x43d3f4);};}exports[_0x013e('0x29')]=function(_0x399aba,_0x4c191c){var _0x20ee2c={},_0x559abf={},_0x58d14f={'count':0x0,'rows':[]};var _0x20d15a=_[_0x013e('0x2a')](db[_0x013e('0x2b')][_0x013e('0x2c')],function(_0x4e5d6b){return{'name':_0x4e5d6b['fieldName'],'type':_0x4e5d6b[_0x013e('0x2d')][_0x013e('0x2e')]};});_0x559abf[_0x013e('0x2f')]=_[_0x013e('0x2a')](_0x20d15a,_0x013e('0x27'));_0x559abf[_0x013e('0x30')]=_[_0x013e('0x31')](_0x399aba[_0x013e('0x30')]);_0x559abf[_0x013e('0x32')]=_[_0x013e('0x33')](_0x559abf[_0x013e('0x2f')],_0x559abf[_0x013e('0x30')]);_0x20ee2c[_0x013e('0x34')]=_[_0x013e('0x33')](_0x559abf['model'],qs[_0x013e('0x35')](_0x399aba['query']['fields']));_0x20ee2c[_0x013e('0x34')]=_0x20ee2c[_0x013e('0x34')][_0x013e('0x36')]?_0x20ee2c[_0x013e('0x34')]:_0x559abf['model'];if(!_0x399aba[_0x013e('0x30')][_0x013e('0x37')](_0x013e('0x38'))){_0x20ee2c[_0x013e('0x1b')]=qs[_0x013e('0x1b')](_0x399aba[_0x013e('0x30')][_0x013e('0x1b')]);_0x20ee2c[_0x013e('0x39')]=qs['offset'](_0x399aba[_0x013e('0x30')][_0x013e('0x39')]);}_0x20ee2c['order']=qs[_0x013e('0x3a')](_0x399aba[_0x013e('0x30')]['sort']);_0x20ee2c['where']=qs[_0x013e('0x32')](_[_0x013e('0x3b')](_0x399aba[_0x013e('0x30')],_0x559abf['filters']),_0x20d15a);if(_0x399aba[_0x013e('0x30')][_0x013e('0x3c')]){_0x20ee2c[_0x013e('0x3d')]=_[_0x013e('0x3e')](_0x20ee2c[_0x013e('0x3d')],{'$or':_[_0x013e('0x2a')](_0x20d15a,function(_0x5ab239){if(_0x5ab239[_0x013e('0x2d')]!=='VIRTUAL'){var _0x48a516={};_0x48a516[_0x5ab239[_0x013e('0x27')]]={'$like':'%'+_0x399aba[_0x013e('0x30')][_0x013e('0x3c')]+'%'};return _0x48a516;}})});}_0x20ee2c=_[_0x013e('0x3e')]({},_0x20ee2c,_0x399aba[_0x013e('0x3f')]);var _0x2f4ef8={'where':_0x20ee2c['where']};return db[_0x013e('0x2b')]['count'](_0x2f4ef8)['then'](function(_0x32e0a6){_0x58d14f[_0x013e('0x1c')]=_0x32e0a6;if(_0x399aba['query'][_0x013e('0x40')]){_0x20ee2c[_0x013e('0x41')]=[{'all':!![]}];}return db[_0x013e('0x2b')][_0x013e('0x42')](_0x20ee2c);})['then'](function(_0x211621){_0x58d14f['rows']=_0x211621;return _0x58d14f;})[_0x013e('0x23')](respondWithFilteredResult(_0x4c191c,_0x20ee2c))[_0x013e('0x43')](handleError(_0x4c191c,null));};exports[_0x013e('0x44')]=function(_0x490d94,_0x56d785){var _0x3c536d={'raw':!![],'where':{'id':_0x490d94[_0x013e('0x45')]['id']}},_0x4afe78={};_0x4afe78[_0x013e('0x2f')]=_[_0x013e('0x31')](db['SquareRecording'][_0x013e('0x2c')]);_0x4afe78[_0x013e('0x30')]=_[_0x013e('0x31')](_0x490d94[_0x013e('0x30')]);_0x4afe78['filters']=_['intersection'](_0x4afe78[_0x013e('0x2f')],_0x4afe78[_0x013e('0x30')]);_0x3c536d[_0x013e('0x34')]=_[_0x013e('0x33')](_0x4afe78[_0x013e('0x2f')],qs[_0x013e('0x35')](_0x490d94[_0x013e('0x30')][_0x013e('0x35')]));_0x3c536d['attributes']=_0x3c536d['attributes'][_0x013e('0x36')]?_0x3c536d[_0x013e('0x34')]:_0x4afe78['model'];if(_0x490d94[_0x013e('0x30')]['includeAll']){_0x3c536d[_0x013e('0x41')]=[{'all':!![]}];}_0x3c536d=_['merge']({},_0x3c536d,_0x490d94['options']);return db['SquareRecording'][_0x013e('0x46')](_0x3c536d)['then'](handleEntityNotFound(_0x56d785,null))[_0x013e('0x23')](respondWithResult(_0x56d785,null))[_0x013e('0x43')](handleError(_0x56d785,null));};exports[_0x013e('0x47')]=function(_0x55124f,_0x5076c4){return db[_0x013e('0x2b')][_0x013e('0x47')](_0x55124f[_0x013e('0x48')],{})['then'](respondWithResult(_0x5076c4,0xc9))[_0x013e('0x43')](handleError(_0x5076c4,null));};exports[_0x013e('0x22')]=function(_0x6dbc1a,_0x1a150f){if(_0x6dbc1a[_0x013e('0x48')]['id']){delete _0x6dbc1a[_0x013e('0x48')]['id'];}return db[_0x013e('0x2b')][_0x013e('0x46')]({'where':{'id':_0x6dbc1a[_0x013e('0x45')]['id']}})[_0x013e('0x23')](handleEntityNotFound(_0x1a150f,null))[_0x013e('0x23')](saveUpdates(_0x6dbc1a[_0x013e('0x48')],null))[_0x013e('0x23')](respondWithResult(_0x1a150f,null))[_0x013e('0x43')](handleError(_0x1a150f,null));};exports[_0x013e('0x49')]=function(_0x2866d,_0x278597,_0xf79b77){var _0x3d7851=require('../../components/encryptor');var _0x2816d2=![];var _0x5ed6a3={};if(_0x2866d[_0x013e('0x30')]['type']&&_0x2866d[_0x013e('0x30')][_0x013e('0x2d')]==='uniqueid'){_0x5ed6a3[_0x013e('0x4a')]=_0x2866d[_0x013e('0x45')]['id'];}else{_0x5ed6a3['id']=_0x2866d['params']['id'];}return db[_0x013e('0x2b')]['find']({'where':_0x5ed6a3,'attributes':['id',_0x013e('0x4b'),_0x013e('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x278597,null))[_0x013e('0x23')](function(_0x382018){if(_0x382018){var _0x5ba7c1=_0x382018['savePath'];var _0x1085a8=util[_0x013e('0x4d')](_0x013e('0x4e'),_0x5ba7c1);if(fs['existsSync'](_0x1085a8)){_0x2816d2=!![];return _0x3d7851[_0x013e('0x4f')](_0x1085a8,_0x5ba7c1,config[_0x013e('0x50')]['recording'])[_0x013e('0x23')](function(){return _0x382018;});}return _0x382018;}})[_0x013e('0x23')](function(_0x573ea6){if(_0x573ea6){var _0x3e6d2a=_0x573ea6[_0x013e('0x4b')];if(!fs[_0x013e('0x51')](_0x3e6d2a)){throw new db[(_0x013e('0x52'))][(_0x013e('0x53'))](_0x013e('0x54'));}if(_0x573ea6[_0x013e('0x4c')]){return _0x278597['download'](_0x3e6d2a,_0x573ea6[_0x013e('0x4c')]+path['extname'](_0x3e6d2a),function(){if(_0x2816d2){fs[_0x013e('0x55')](_0x3e6d2a);}});}else{return _0x278597['download'](_0x3e6d2a,function(_0x2d7b14){if(_0x2816d2){fs[_0x013e('0x55')](_0x3e6d2a);}});}}})[_0x013e('0x43')](function(_0x57163e){if(_0x57163e['message']===_0x013e('0x54')){_0x278597[_0x013e('0x18')](0x194)[_0x013e('0x28')](_0x013e('0x56'));}else{return handleError(_0x278597,null);}});};exports['destroy']=function(_0x487ac6,_0x43649b){return db[_0x013e('0x2b')][_0x013e('0x46')]({'where':{'id':_0x487ac6[_0x013e('0x45')]['id']}})[_0x013e('0x23')](function(_0x27c5ce){if(_[_0x013e('0x57')](_0x27c5ce)){throw new ReferenceError(_0x013e('0x58'));}return _0x27c5ce;})['then'](function(_0x4558ad){var _0x19dbae=_0x4558ad[_0x013e('0x4b')];logger[_0x013e('0x59')]('cancellazione\x20fisica\x20documento\x20%s',_0x19dbae);if(!_[_0x013e('0x57')](_0x4558ad[_0x013e('0x4b')])&&fs[_0x013e('0x51')](_0x19dbae)){logger[_0x013e('0x59')]('File:\x20\x22'+_0x19dbae+_0x013e('0x5a'));fs['unlinkSync'](_0x19dbae);}_0x19dbae=_0x19dbae+_0x013e('0x5b');if(!_[_0x013e('0x57')](_0x4558ad[_0x013e('0x4b')])&&fs[_0x013e('0x51')](_0x19dbae)){logger[_0x013e('0x59')](_0x013e('0x5c')+_0x19dbae+_0x013e('0x5a'));fs[_0x013e('0x5d')](_0x19dbae);}return _0x4558ad;})[_0x013e('0x23')](function(_0x1ce5ea){if(!_0x1ce5ea)throw new InternalError();return _0x1ce5ea[_0x013e('0x24')]();})[_0x013e('0x23')](function(){_0x43649b[_0x013e('0x18')](0xcc)[_0x013e('0x25')]();})[_0x013e('0x43')](handleError(_0x43649b,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 2eca062..69b35d2 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 _0xa3eb=['define','SquareRecording','square_recordings','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xa3eb,0x1ed));var _0xba3e=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xa3eb[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xba3e('0x0'));var util=require(_0xba3e('0x1'));var logger=require(_0xba3e('0x2'))('api');var moment=require(_0xba3e('0x3'));var BPromise=require(_0xba3e('0x4'));var rp=require(_0xba3e('0x5'));var fs=require('fs');var path=require(_0xba3e('0x6'));var rimraf=require(_0xba3e('0x7'));var config=require(_0xba3e('0x8'));var attributes=require(_0xba3e('0x9'));module[_0xba3e('0xa')]=function(_0x259b23,_0x298ece){return _0x259b23[_0xba3e('0xb')](_0xba3e('0xc'),attributes,{'tableName':_0xba3e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fb4=['./squareRecording.attributes','exports','define','SquareRecording','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4fb4,0x190));var _0x44fb=function(_0x44541e,_0x1a8d74){_0x44541e=_0x44541e-0x0;var _0x3eab08=_0x4fb4[_0x44541e];return _0x3eab08;};'use strict';var _=require('lodash');var util=require(_0x44fb('0x0'));var logger=require(_0x44fb('0x1'))(_0x44fb('0x2'));var moment=require(_0x44fb('0x3'));var BPromise=require(_0x44fb('0x4'));var rp=require(_0x44fb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x44fb('0x6'));var config=require(_0x44fb('0x7'));var attributes=require(_0x44fb('0x8'));module[_0x44fb('0x9')]=function(_0x375d33,_0x173e70){return _0x375d33[_0x44fb('0xa')](_0x44fb('0xb'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 96c347f..e6fa174 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 _0x44ea=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateSquareRecording','SquareRecording','body','options','raw','catch','lodash','util','moment'];(function(_0x1151ec,_0x4576b9){var _0xce4b78=function(_0x9d4742){while(--_0x9d4742){_0x1151ec['push'](_0x1151ec['shift']());}};_0xce4b78(++_0x4576b9);}(_0x44ea,0xb7));var _0xa44e=function(_0x366202,_0x230fd1){_0x366202=_0x366202-0x0;var _0x4cea09=_0x44ea[_0x366202];return _0x4cea09;};'use strict';var _=require(_0xa44e('0x0'));var util=require(_0xa44e('0x1'));var moment=require(_0xa44e('0x2'));var BPromise=require(_0xa44e('0x3'));var rs=require(_0xa44e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa44e('0x5'))['db'];var utils=require(_0xa44e('0x6'));var logger=require(_0xa44e('0x7'))(_0xa44e('0x8'));var config=require(_0xa44e('0x9'));var jayson=require(_0xa44e('0xa'));var client=jayson[_0xa44e('0xb')][_0xa44e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd5bed8,_0x18f084,_0x525d1b){return new BPromise(function(_0x5762cc,_0x2ffbe6){return client[_0xa44e('0xd')](_0xd5bed8,_0x525d1b)[_0xa44e('0xe')](function(_0x3cd015){logger['info'](_0xa44e('0xf'),_0x18f084,_0xa44e('0x10'));logger[_0xa44e('0x11')](_0xa44e('0x12'),_0x18f084,_0xa44e('0x10'),JSON[_0xa44e('0x13')](_0x3cd015));if(_0x3cd015[_0xa44e('0x14')]){if(_0x3cd015[_0xa44e('0x14')][_0xa44e('0x15')]===0x1f4){logger[_0xa44e('0x14')](_0xa44e('0xf'),_0x18f084,_0x3cd015['error'][_0xa44e('0x16')]);return _0x2ffbe6(_0x3cd015['error'][_0xa44e('0x16')]);}logger[_0xa44e('0x14')](_0xa44e('0xf'),_0x18f084,_0x3cd015['error'][_0xa44e('0x16')]);return _0x5762cc(_0x3cd015[_0xa44e('0x14')][_0xa44e('0x16')]);}else{logger[_0xa44e('0x17')](_0xa44e('0xf'),_0x18f084,_0xa44e('0x10'));_0x5762cc(_0x3cd015[_0xa44e('0x18')]['message']);}})['catch'](function(_0x4bb850){logger[_0xa44e('0x14')](_0xa44e('0xf'),_0x18f084,_0x4bb850);_0x2ffbe6(_0x4bb850);});});}exports[_0xa44e('0x19')]=function(_0x397d08){var _0x5d0805=this;return new Promise(function(_0xebb90b,_0x3365bb){return db[_0xa44e('0x1a')]['create'](_0x397d08[_0xa44e('0x1b')],{'raw':_0x397d08[_0xa44e('0x1c')]?_0x397d08[_0xa44e('0x1c')][_0xa44e('0x1d')]===undefined?!![]:![]:!![]})[_0xa44e('0xe')](function(_0x511fd0){logger[_0xa44e('0x17')](_0xa44e('0x19'),_0x397d08);logger[_0xa44e('0x11')]('CreateSquareRecording',_0x397d08,JSON[_0xa44e('0x13')](_0x511fd0));_0xebb90b(_0x511fd0);})[_0xa44e('0x1e')](function(_0x51b54f){logger[_0xa44e('0x14')](_0xa44e('0x19'),_0x51b54f['message'],_0x397d08);_0x3365bb(_0x5d0805['error'](0x1f4,_0x51b54f['message']));});});}; \ No newline at end of file +var _0x512e=['code','message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','util','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4a5356,_0x20f134){var _0x4beb93=function(_0x151541){while(--_0x151541){_0x4a5356['push'](_0x4a5356['shift']());}};_0x4beb93(++_0x20f134);}(_0x512e,0x1a9));var _0xe512=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x512e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe512('0x0'));var moment=require('moment');var BPromise=require(_0xe512('0x1'));var rs=require(_0xe512('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe512('0x3'))['db'];var utils=require(_0xe512('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe512('0x5'));var client=jayson[_0xe512('0x6')][_0xe512('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5eb6ac,_0x342d6f,_0x4fce12){return new BPromise(function(_0xa4879a,_0x1f96d3){return client[_0xe512('0x8')](_0x5eb6ac,_0x4fce12)[_0xe512('0x9')](function(_0x115a33){logger[_0xe512('0xa')](_0xe512('0xb'),_0x342d6f,_0xe512('0xc'));logger[_0xe512('0xd')](_0xe512('0xe'),_0x342d6f,_0xe512('0xc'),JSON[_0xe512('0xf')](_0x115a33));if(_0x115a33[_0xe512('0x10')]){if(_0x115a33[_0xe512('0x10')][_0xe512('0x11')]===0x1f4){logger[_0xe512('0x10')]('SquareRecording,\x20%s,\x20%s',_0x342d6f,_0x115a33[_0xe512('0x10')][_0xe512('0x12')]);return _0x1f96d3(_0x115a33[_0xe512('0x10')]['message']);}logger[_0xe512('0x10')](_0xe512('0xb'),_0x342d6f,_0x115a33[_0xe512('0x10')][_0xe512('0x12')]);return _0xa4879a(_0x115a33[_0xe512('0x10')][_0xe512('0x12')]);}else{logger[_0xe512('0xa')](_0xe512('0xb'),_0x342d6f,_0xe512('0xc'));_0xa4879a(_0x115a33[_0xe512('0x13')][_0xe512('0x12')]);}})[_0xe512('0x14')](function(_0x2d5752){logger[_0xe512('0x10')]('SquareRecording,\x20%s,\x20%s',_0x342d6f,_0x2d5752);_0x1f96d3(_0x2d5752);});});}exports[_0xe512('0x15')]=function(_0x23ab40){var _0x5226fb=this;return new Promise(function(_0x5e1baf,_0x495fb6){return db[_0xe512('0x16')][_0xe512('0x17')](_0x23ab40['body'],{'raw':_0x23ab40[_0xe512('0x18')]?_0x23ab40['options'][_0xe512('0x19')]===undefined?!![]:![]:!![]})[_0xe512('0x9')](function(_0x3488b6){logger[_0xe512('0xa')]('CreateSquareRecording',_0x23ab40);logger['debug'](_0xe512('0x15'),_0x23ab40,JSON[_0xe512('0xf')](_0x3488b6));_0x5e1baf(_0x3488b6);})['catch'](function(_0x4f0534){logger[_0xe512('0x10')](_0xe512('0x15'),_0x4f0534[_0xe512('0x12')],_0x23ab40);_0x495fb6(_0x5226fb[_0xe512('0x10')](0x1f4,_0x4f0534[_0xe512('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index abc7485..8339615 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 _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(_0x5d751e,_0x1de880){var _0x3ed5c8=function(_0x22a512){while(--_0x22a512){_0x5d751e['push'](_0x5d751e['shift']());}};_0x3ed5c8(++_0x1de880);}(_0xe706,0xa3));var _0x6e70=function(_0x3cd590,_0x54deaa){_0x3cd590=_0x3cd590-0x0;var _0x149858=_0xe706[_0x3cd590];return _0x149858;};'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 +var _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x436d8d,_0x100347){var _0x4db924=function(_0x5e2aa5){while(--_0x5e2aa5){_0x436d8d['push'](_0x436d8d['shift']());}};_0x4db924(++_0x100347);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b47d9,_0x1327ce){_0x5b47d9=_0x5b47d9-0x0;var _0x4151f0=_0xb10b[_0x5b47d9];return _0x4151f0;};'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/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 57f91d4..633baad 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 _0x1f57=['DATE','sequelize','exports','STRING'];(function(_0x57d7f7,_0x335c81){var _0x1a6800=function(_0x251345){while(--_0x251345){_0x57d7f7['push'](_0x57d7f7['shift']());}};_0x1a6800(++_0x335c81);}(_0x1f57,0x131));var _0x71f5=function(_0x4e69d3,_0x2264c0){_0x4e69d3=_0x4e69d3-0x0;var _0x40cd05=_0x1f57[_0x4e69d3];return _0x40cd05;};'use strict';var Sequelize=require(_0x71f5('0x0'));module[_0x71f5('0x1')]={'network':{'type':Sequelize[_0x71f5('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x71f5('0x2')]},'channel':{'type':Sequelize[_0x71f5('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x71f5('0x2')]},'uniqueid':{'type':Sequelize[_0x71f5('0x2')]},'version':{'type':Sequelize[_0x71f5('0x2')]},'callerid':{'type':Sequelize[_0x71f5('0x2')]},'calleridname':{'type':Sequelize[_0x71f5('0x2')]},'callingpres':{'type':Sequelize[_0x71f5('0x2')]},'callingani2':{'type':Sequelize[_0x71f5('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x71f5('0x2')]},'dnid':{'type':Sequelize[_0x71f5('0x2')]},'rdnis':{'type':Sequelize[_0x71f5('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x71f5('0x2')]},'priority':{'type':Sequelize[_0x71f5('0x2')]},'enhanced':{'type':Sequelize[_0x71f5('0x2')]},'accountcode':{'type':Sequelize[_0x71f5('0x2')]},'threadid':{'type':Sequelize[_0x71f5('0x2')]},'project_name':{'type':Sequelize[_0x71f5('0x2')]},'joinAt':{'type':Sequelize[_0x71f5('0x3')]},'leaveAt':{'type':Sequelize[_0x71f5('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9877=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x5ef186,_0x5a0ac8){var _0x68ec1b=function(_0x5d5e50){while(--_0x5d5e50){_0x5ef186['push'](_0x5ef186['shift']());}};_0x68ec1b(++_0x5a0ac8);}(_0x9877,0x11b));var _0x7987=function(_0x26021f,_0x4fc7d4){_0x26021f=_0x26021f-0x0;var _0x274428=_0x9877[_0x26021f];return _0x274428;};'use strict';var Sequelize=require(_0x7987('0x0'));module[_0x7987('0x1')]={'network':{'type':Sequelize[_0x7987('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x7987('0x2')]},'channel':{'type':Sequelize[_0x7987('0x2')]},'language':{'type':Sequelize[_0x7987('0x2')]},'type':{'type':Sequelize[_0x7987('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x7987('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x7987('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x7987('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7987('0x2')]},'priority':{'type':Sequelize[_0x7987('0x2')]},'enhanced':{'type':Sequelize[_0x7987('0x2')]},'accountcode':{'type':Sequelize[_0x7987('0x2')]},'threadid':{'type':Sequelize[_0x7987('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x7987('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x7987('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 1ab5743..0ae9cbf 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 _0x4649=['rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','include','show','params','find','catch','create','body','describe','eml-format'];(function(_0x59db74,_0x299fdd){var _0x1a48c2=function(_0x4d4288){while(--_0x4d4288){_0x59db74['push'](_0x59db74['shift']());}};_0x1a48c2(++_0x299fdd);}(_0x4649,0x167));var _0x9464=function(_0x1b9459,_0x5cdd54){_0x1b9459=_0x1b9459-0x0;var _0x1db6e6=_0x4649[_0x1b9459];return _0x1db6e6;};'use strict';var emlformat=require(_0x9464('0x0'));var rimraf=require(_0x9464('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9464('0x2'));var rp=require(_0x9464('0x3'));var moment=require(_0x9464('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9464('0x5'));var util=require(_0x9464('0x6'));var path=require(_0x9464('0x7'));var sox=require(_0x9464('0x8'));var csv=require('to-csv');var ejs=require(_0x9464('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9464('0xa'));var squel=require(_0x9464('0xb'));var crypto=require(_0x9464('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9464('0xd'));var Papa=require(_0x9464('0xe'));var Redis=require(_0x9464('0xf'));var authService=require(_0x9464('0x10'));var qs=require(_0x9464('0x11'));var as=require(_0x9464('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9464('0x13'))(_0x9464('0x14'));var utils=require(_0x9464('0x15'));var config=require(_0x9464('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37d674,_0x2e582f){_0x2e582f=_0x2e582f||0xcc;return function(_0x306e42){if(_0x306e42){return _0x37d674[_0x9464('0x17')](_0x2e582f);}return _0x37d674[_0x9464('0x18')](_0x2e582f)[_0x9464('0x19')]();};}function respondWithResult(_0x2c0f2b,_0x2681d9){_0x2681d9=_0x2681d9||0xc8;return function(_0x3bbbdb){if(_0x3bbbdb){return _0x2c0f2b['status'](_0x2681d9)[_0x9464('0x1a')](_0x3bbbdb);}};}function respondWithFilteredResult(_0x4c7ae1,_0x28d816){return function(_0x10b1dc){if(_0x10b1dc){var _0x4249b7=typeof _0x28d816[_0x9464('0x1b')]===_0x9464('0x1c')&&typeof _0x28d816[_0x9464('0x1d')]===_0x9464('0x1c');var _0x4f1d9c=_0x10b1dc[_0x9464('0x1e')];var _0x45522c=_0x4249b7?0x0:_0x28d816['offset'];var _0x2bbf60=_0x4249b7?_0x10b1dc['count']:_0x28d816['offset']+_0x28d816[_0x9464('0x1d')];var _0x160936;if(_0x2bbf60>=_0x4f1d9c){_0x2bbf60=_0x4f1d9c;_0x160936=0xc8;}else{_0x160936=0xce;}_0x4c7ae1[_0x9464('0x18')](_0x160936);return _0x4c7ae1['set']('Content-Range',_0x45522c+'-'+_0x2bbf60+'/'+_0x4f1d9c)[_0x9464('0x1a')](_0x10b1dc);}return null;};}function patchUpdates(_0x359dc9){return function(_0x494e32){try{jsonpatch[_0x9464('0x1f')](_0x494e32,_0x359dc9,!![]);}catch(_0x154edd){return BPromise[_0x9464('0x20')](_0x154edd);}return _0x494e32[_0x9464('0x21')]();};}function saveUpdates(_0x5ba1c9,_0x425f2e){return function(_0xcafc4b){if(_0xcafc4b){return _0xcafc4b[_0x9464('0x22')](_0x5ba1c9)[_0x9464('0x23')](function(_0x4ca913){return _0x4ca913;});}return null;};}function removeEntity(_0x2ee4af,_0x188a18){return function(_0xd6fd1e){if(_0xd6fd1e){return _0xd6fd1e[_0x9464('0x24')]()[_0x9464('0x23')](function(){_0x2ee4af[_0x9464('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a2665,_0xd2e816){return function(_0x3244d7){if(!_0x3244d7){_0x2a2665[_0x9464('0x17')](0x194);}return _0x3244d7;};}function handleError(_0x543e9c,_0x354598){_0x354598=_0x354598||0x1f4;return function(_0x27826c){logger['error'](_0x27826c[_0x9464('0x25')]);if(_0x27826c[_0x9464('0x26')]){delete _0x27826c['name'];}_0x543e9c[_0x9464('0x18')](_0x354598)[_0x9464('0x27')](_0x27826c);};}exports[_0x9464('0x28')]=function(_0x15ad58,_0x5b1d69){var _0x5c6ffd={},_0x559275={},_0xdde69d={'count':0x0,'rows':[]};var _0x136e34=_[_0x9464('0x29')](db[_0x9464('0x2a')][_0x9464('0x2b')],function(_0x1a32b6){return{'name':_0x1a32b6[_0x9464('0x2c')],'type':_0x1a32b6[_0x9464('0x2d')][_0x9464('0x2e')]};});_0x559275[_0x9464('0x2f')]=_['map'](_0x136e34,_0x9464('0x26'));_0x559275[_0x9464('0x30')]=_[_0x9464('0x31')](_0x15ad58[_0x9464('0x30')]);_0x559275[_0x9464('0x32')]=_[_0x9464('0x33')](_0x559275['model'],_0x559275[_0x9464('0x30')]);_0x5c6ffd[_0x9464('0x34')]=_[_0x9464('0x33')](_0x559275['model'],qs[_0x9464('0x35')](_0x15ad58[_0x9464('0x30')][_0x9464('0x35')]));_0x5c6ffd[_0x9464('0x34')]=_0x5c6ffd['attributes'][_0x9464('0x36')]?_0x5c6ffd['attributes']:_0x559275[_0x9464('0x2f')];if(!_0x15ad58[_0x9464('0x30')][_0x9464('0x37')](_0x9464('0x38'))){_0x5c6ffd[_0x9464('0x1d')]=qs[_0x9464('0x1d')](_0x15ad58[_0x9464('0x30')][_0x9464('0x1d')]);_0x5c6ffd['offset']=qs[_0x9464('0x1b')](_0x15ad58[_0x9464('0x30')][_0x9464('0x1b')]);}_0x5c6ffd['order']=qs[_0x9464('0x39')](_0x15ad58[_0x9464('0x30')][_0x9464('0x39')]);_0x5c6ffd[_0x9464('0x3a')]=qs[_0x9464('0x32')](_[_0x9464('0x3b')](_0x15ad58['query'],_0x559275[_0x9464('0x32')]),_0x136e34);if(_0x15ad58['query']['filter']){_0x5c6ffd['where']=_[_0x9464('0x3c')](_0x5c6ffd['where'],{'$or':_[_0x9464('0x29')](_0x136e34,function(_0x41adae){if(_0x41adae[_0x9464('0x2d')]!=='VIRTUAL'){var _0x1d6492={};_0x1d6492[_0x41adae[_0x9464('0x26')]]={'$like':'%'+_0x15ad58['query'][_0x9464('0x3d')]+'%'};return _0x1d6492;}})});}_0x5c6ffd=_[_0x9464('0x3c')]({},_0x5c6ffd,_0x15ad58[_0x9464('0x3e')]);var _0x168f06={'where':_0x5c6ffd[_0x9464('0x3a')]};return db[_0x9464('0x2a')][_0x9464('0x1e')](_0x168f06)[_0x9464('0x23')](function(_0x359c36){_0xdde69d[_0x9464('0x1e')]=_0x359c36;if(_0x15ad58[_0x9464('0x30')][_0x9464('0x3f')]){_0x5c6ffd[_0x9464('0x40')]=[{'all':!![]}];}return db[_0x9464('0x2a')]['findAll'](_0x5c6ffd);})[_0x9464('0x23')](function(_0x8ee550){_0xdde69d['rows']=_0x8ee550;return _0xdde69d;})[_0x9464('0x23')](respondWithFilteredResult(_0x5b1d69,_0x5c6ffd))['catch'](handleError(_0x5b1d69,null));};exports[_0x9464('0x41')]=function(_0x212dac,_0x1cfb61){var _0x4d18f6={'raw':!![],'where':{'id':_0x212dac[_0x9464('0x42')]['id']}},_0x44bdca={};_0x44bdca['model']=_['keys'](db['SquareReport'][_0x9464('0x2b')]);_0x44bdca[_0x9464('0x30')]=_[_0x9464('0x31')](_0x212dac[_0x9464('0x30')]);_0x44bdca[_0x9464('0x32')]=_[_0x9464('0x33')](_0x44bdca[_0x9464('0x2f')],_0x44bdca['query']);_0x4d18f6[_0x9464('0x34')]=_[_0x9464('0x33')](_0x44bdca[_0x9464('0x2f')],qs['fields'](_0x212dac[_0x9464('0x30')][_0x9464('0x35')]));_0x4d18f6[_0x9464('0x34')]=_0x4d18f6[_0x9464('0x34')]['length']?_0x4d18f6[_0x9464('0x34')]:_0x44bdca[_0x9464('0x2f')];if(_0x212dac['query'][_0x9464('0x3f')]){_0x4d18f6['include']=[{'all':!![]}];}_0x4d18f6=_[_0x9464('0x3c')]({},_0x4d18f6,_0x212dac[_0x9464('0x3e')]);return db['SquareReport'][_0x9464('0x43')](_0x4d18f6)[_0x9464('0x23')](handleEntityNotFound(_0x1cfb61,null))[_0x9464('0x23')](respondWithResult(_0x1cfb61,null))[_0x9464('0x44')](handleError(_0x1cfb61,null));};exports[_0x9464('0x45')]=function(_0x168f81,_0x553efa){return db['SquareReport'][_0x9464('0x45')](_0x168f81[_0x9464('0x46')],{})['then'](respondWithResult(_0x553efa,0xc9))[_0x9464('0x44')](handleError(_0x553efa,null));};exports['update']=function(_0x2a40cd,_0x48d0f0){if(_0x2a40cd[_0x9464('0x46')]['id']){delete _0x2a40cd[_0x9464('0x46')]['id'];}return db['SquareReport'][_0x9464('0x43')]({'where':{'id':_0x2a40cd['params']['id']}})['then'](handleEntityNotFound(_0x48d0f0,null))[_0x9464('0x23')](saveUpdates(_0x2a40cd['body'],null))[_0x9464('0x23')](respondWithResult(_0x48d0f0,null))[_0x9464('0x44')](handleError(_0x48d0f0,null));};exports[_0x9464('0x24')]=function(_0x1ec9a5,_0x4f81e5){return db['SquareReport'][_0x9464('0x43')]({'where':{'id':_0x1ec9a5[_0x9464('0x42')]['id']}})[_0x9464('0x23')](handleEntityNotFound(_0x4f81e5,null))[_0x9464('0x23')](removeEntity(_0x4f81e5,null))['catch'](handleError(_0x4f81e5,null));};exports[_0x9464('0x47')]=function(_0xa1b938,_0xbb02ae){return db[_0x9464('0x2a')][_0x9464('0x47')]()[_0x9464('0x23')](respondWithResult(_0xbb02ae,null))['catch'](handleError(_0xbb02ae,null));}; \ No newline at end of file +var _0x3377=['stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error'];(function(_0xc8b76c,_0x4be9a5){var _0x1d3b97=function(_0x1f5b3c){while(--_0x1f5b3c){_0xc8b76c['push'](_0xc8b76c['shift']());}};_0x1d3b97(++_0x4be9a5);}(_0x3377,0xc7));var _0x7337=function(_0x322eef,_0x25ea9c){_0x322eef=_0x322eef-0x0;var _0x1528d3=_0x3377[_0x322eef];return _0x1528d3;};'use strict';var emlformat=require(_0x7337('0x0'));var rimraf=require(_0x7337('0x1'));var zipdir=require(_0x7337('0x2'));var jsonpatch=require(_0x7337('0x3'));var rp=require(_0x7337('0x4'));var moment=require(_0x7337('0x5'));var BPromise=require(_0x7337('0x6'));var Mustache=require(_0x7337('0x7'));var util=require(_0x7337('0x8'));var path=require(_0x7337('0x9'));var sox=require(_0x7337('0xa'));var csv=require(_0x7337('0xb'));var ejs=require(_0x7337('0xc'));var fs=require('fs');var fs_extra=require(_0x7337('0xd'));var _=require(_0x7337('0xe'));var squel=require(_0x7337('0xf'));var crypto=require('crypto');var jsforce=require(_0x7337('0x10'));var deskjs=require(_0x7337('0x11'));var toCsv=require(_0x7337('0xb'));var querystring=require(_0x7337('0x12'));var Papa=require(_0x7337('0x13'));var Redis=require('ioredis');var authService=require(_0x7337('0x14'));var qs=require(_0x7337('0x15'));var as=require(_0x7337('0x16'));var hardwareService=require(_0x7337('0x17'));var logger=require('../../config/logger')(_0x7337('0x18'));var utils=require(_0x7337('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x7337('0x1a'));var db=require(_0x7337('0x1b'))['db'];function respondWithStatusCode(_0x38748b,_0x3447ec){_0x3447ec=_0x3447ec||0xcc;return function(_0x3270d3){if(_0x3270d3){return _0x38748b[_0x7337('0x1c')](_0x3447ec);}return _0x38748b['status'](_0x3447ec)['end']();};}function respondWithResult(_0x4ab314,_0xa52eb8){_0xa52eb8=_0xa52eb8||0xc8;return function(_0x12049e){if(_0x12049e){return _0x4ab314[_0x7337('0x1d')](_0xa52eb8)[_0x7337('0x1e')](_0x12049e);}};}function respondWithFilteredResult(_0x436d02,_0x2e8126){return function(_0x10da06){if(_0x10da06){var _0x54161f=typeof _0x2e8126[_0x7337('0x1f')]==='undefined'&&typeof _0x2e8126[_0x7337('0x20')]==='undefined';var _0x3eec3b=_0x10da06[_0x7337('0x21')];var _0x1c29e8=_0x54161f?0x0:_0x2e8126[_0x7337('0x1f')];var _0x2ab021=_0x54161f?_0x10da06[_0x7337('0x21')]:_0x2e8126[_0x7337('0x1f')]+_0x2e8126[_0x7337('0x20')];var _0x5377a3;if(_0x2ab021>=_0x3eec3b){_0x2ab021=_0x3eec3b;_0x5377a3=0xc8;}else{_0x5377a3=0xce;}_0x436d02[_0x7337('0x1d')](_0x5377a3);return _0x436d02[_0x7337('0x22')](_0x7337('0x23'),_0x1c29e8+'-'+_0x2ab021+'/'+_0x3eec3b)[_0x7337('0x1e')](_0x10da06);}return null;};}function patchUpdates(_0x50cab1){return function(_0x3639ad){try{jsonpatch[_0x7337('0x24')](_0x3639ad,_0x50cab1,!![]);}catch(_0x4ed0c5){return BPromise[_0x7337('0x25')](_0x4ed0c5);}return _0x3639ad[_0x7337('0x26')]();};}function saveUpdates(_0x3aff0f,_0xae1df2){return function(_0x377ced){if(_0x377ced){return _0x377ced[_0x7337('0x27')](_0x3aff0f)[_0x7337('0x28')](function(_0x316825){return _0x316825;});}return null;};}function removeEntity(_0x384c2d,_0x398e6c){return function(_0x311ae8){if(_0x311ae8){return _0x311ae8[_0x7337('0x29')]()[_0x7337('0x28')](function(){_0x384c2d[_0x7337('0x1d')](0xcc)[_0x7337('0x2a')]();});}};}function handleEntityNotFound(_0x2daa29,_0x5d456f){return function(_0x1836e5){if(!_0x1836e5){_0x2daa29[_0x7337('0x1c')](0x194);}return _0x1836e5;};}function handleError(_0x4e0dca,_0x560443){_0x560443=_0x560443||0x1f4;return function(_0x3dff45){logger[_0x7337('0x2b')](_0x3dff45[_0x7337('0x2c')]);if(_0x3dff45['name']){delete _0x3dff45[_0x7337('0x2d')];}_0x4e0dca[_0x7337('0x1d')](_0x560443)[_0x7337('0x2e')](_0x3dff45);};}exports[_0x7337('0x2f')]=function(_0x5aed20,_0x3c23d6){var _0x585030={},_0x3a3585={},_0x5c1781={'count':0x0,'rows':[]};var _0x326d3c=_[_0x7337('0x30')](db[_0x7337('0x31')][_0x7337('0x32')],function(_0x25ada9){return{'name':_0x25ada9[_0x7337('0x33')],'type':_0x25ada9[_0x7337('0x34')][_0x7337('0x35')]};});_0x3a3585[_0x7337('0x36')]=_['map'](_0x326d3c,_0x7337('0x2d'));_0x3a3585[_0x7337('0x37')]=_[_0x7337('0x38')](_0x5aed20[_0x7337('0x37')]);_0x3a3585[_0x7337('0x39')]=_[_0x7337('0x3a')](_0x3a3585[_0x7337('0x36')],_0x3a3585[_0x7337('0x37')]);_0x585030[_0x7337('0x3b')]=_[_0x7337('0x3a')](_0x3a3585[_0x7337('0x36')],qs[_0x7337('0x3c')](_0x5aed20[_0x7337('0x37')][_0x7337('0x3c')]));_0x585030[_0x7337('0x3b')]=_0x585030[_0x7337('0x3b')][_0x7337('0x3d')]?_0x585030['attributes']:_0x3a3585['model'];if(!_0x5aed20[_0x7337('0x37')][_0x7337('0x3e')](_0x7337('0x3f'))){_0x585030['limit']=qs['limit'](_0x5aed20[_0x7337('0x37')][_0x7337('0x20')]);_0x585030[_0x7337('0x1f')]=qs[_0x7337('0x1f')](_0x5aed20[_0x7337('0x37')]['offset']);}_0x585030['order']=qs[_0x7337('0x40')](_0x5aed20[_0x7337('0x37')][_0x7337('0x40')]);_0x585030['where']=qs[_0x7337('0x39')](_[_0x7337('0x41')](_0x5aed20[_0x7337('0x37')],_0x3a3585['filters']),_0x326d3c);if(_0x5aed20['query'][_0x7337('0x42')]){_0x585030[_0x7337('0x43')]=_['merge'](_0x585030[_0x7337('0x43')],{'$or':_[_0x7337('0x30')](_0x326d3c,function(_0x182d55){if(_0x182d55[_0x7337('0x34')]!==_0x7337('0x44')){var _0x32c28f={};_0x32c28f[_0x182d55[_0x7337('0x2d')]]={'$like':'%'+_0x5aed20[_0x7337('0x37')][_0x7337('0x42')]+'%'};return _0x32c28f;}})});}_0x585030=_[_0x7337('0x45')]({},_0x585030,_0x5aed20[_0x7337('0x46')]);var _0x5e6709={'where':_0x585030['where']};return db['SquareReport']['count'](_0x5e6709)[_0x7337('0x28')](function(_0x2ef52a){_0x5c1781[_0x7337('0x21')]=_0x2ef52a;if(_0x5aed20[_0x7337('0x37')][_0x7337('0x47')]){_0x585030['include']=[{'all':!![]}];}return db[_0x7337('0x31')][_0x7337('0x48')](_0x585030);})['then'](function(_0x2964dc){_0x5c1781[_0x7337('0x49')]=_0x2964dc;return _0x5c1781;})[_0x7337('0x28')](respondWithFilteredResult(_0x3c23d6,_0x585030))[_0x7337('0x4a')](handleError(_0x3c23d6,null));};exports[_0x7337('0x4b')]=function(_0x38c831,_0x5055bd){var _0x49b399={'raw':!![],'where':{'id':_0x38c831[_0x7337('0x4c')]['id']}},_0xcee03={};_0xcee03[_0x7337('0x36')]=_[_0x7337('0x38')](db[_0x7337('0x31')][_0x7337('0x32')]);_0xcee03[_0x7337('0x37')]=_[_0x7337('0x38')](_0x38c831[_0x7337('0x37')]);_0xcee03[_0x7337('0x39')]=_['intersection'](_0xcee03[_0x7337('0x36')],_0xcee03[_0x7337('0x37')]);_0x49b399[_0x7337('0x3b')]=_[_0x7337('0x3a')](_0xcee03['model'],qs[_0x7337('0x3c')](_0x38c831[_0x7337('0x37')][_0x7337('0x3c')]));_0x49b399[_0x7337('0x3b')]=_0x49b399[_0x7337('0x3b')][_0x7337('0x3d')]?_0x49b399[_0x7337('0x3b')]:_0xcee03[_0x7337('0x36')];if(_0x38c831[_0x7337('0x37')][_0x7337('0x47')]){_0x49b399[_0x7337('0x4d')]=[{'all':!![]}];}_0x49b399=_['merge']({},_0x49b399,_0x38c831[_0x7337('0x46')]);return db[_0x7337('0x31')]['find'](_0x49b399)[_0x7337('0x28')](handleEntityNotFound(_0x5055bd,null))[_0x7337('0x28')](respondWithResult(_0x5055bd,null))[_0x7337('0x4a')](handleError(_0x5055bd,null));};exports[_0x7337('0x4e')]=function(_0x2cd0d4,_0x318da4){return db[_0x7337('0x31')]['create'](_0x2cd0d4[_0x7337('0x4f')],{})[_0x7337('0x28')](respondWithResult(_0x318da4,0xc9))[_0x7337('0x4a')](handleError(_0x318da4,null));};exports[_0x7337('0x27')]=function(_0x5918db,_0x705eb1){if(_0x5918db[_0x7337('0x4f')]['id']){delete _0x5918db[_0x7337('0x4f')]['id'];}return db['SquareReport'][_0x7337('0x50')]({'where':{'id':_0x5918db['params']['id']}})['then'](handleEntityNotFound(_0x705eb1,null))[_0x7337('0x28')](saveUpdates(_0x5918db['body'],null))[_0x7337('0x28')](respondWithResult(_0x705eb1,null))[_0x7337('0x4a')](handleError(_0x705eb1,null));};exports[_0x7337('0x29')]=function(_0x332127,_0x4563ff){return db[_0x7337('0x31')]['find']({'where':{'id':_0x332127['params']['id']}})['then'](handleEntityNotFound(_0x4563ff,null))[_0x7337('0x28')](removeEntity(_0x4563ff,null))['catch'](handleError(_0x4563ff,null));};exports['describe']=function(_0x4cfaed,_0x3c17ab){return db[_0x7337('0x31')]['describe']()['then'](respondWithResult(_0x3c17ab,null))[_0x7337('0x4a')](handleError(_0x3c17ab,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 0749fbb..fd27746 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 _0x6328=['bluebird','request-promise','path','../../config/environment','exports','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','util','api','moment'];(function(_0x59c4cd,_0x40d5cc){var _0x42e7a2=function(_0x1a318c){while(--_0x1a318c){_0x59c4cd['push'](_0x59c4cd['shift']());}};_0x42e7a2(++_0x40d5cc);}(_0x6328,0x6c));var _0x8632=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0x6328[_0x2678d6];return _0x475503;};'use strict';var _=require(_0x8632('0x0'));var util=require(_0x8632('0x1'));var logger=require('../../config/logger')(_0x8632('0x2'));var moment=require(_0x8632('0x3'));var BPromise=require(_0x8632('0x4'));var rp=require(_0x8632('0x5'));var fs=require('fs');var path=require(_0x8632('0x6'));var rimraf=require('rimraf');var config=require(_0x8632('0x7'));var attributes=require('./squareReport.attributes');module[_0x8632('0x8')]=function(_0x440478,_0xe2fded){return _0x440478['define'](_0x8632('0x9'),attributes,{'tableName':_0x8632('0xa'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x8632('0xb'),_0x8632('0xc')]},{'name':'leaveAt','fields':[_0x8632('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2363=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','uid_pname','project_name','leaveAt','lodash'];(function(_0x3bf3aa,_0x7c9a3d){var _0x32a532=function(_0x15b721){while(--_0x15b721){_0x3bf3aa['push'](_0x3bf3aa['shift']());}};_0x32a532(++_0x7c9a3d);}(_0x2363,0x167));var _0x3236=function(_0x18adb2,_0x4198c8){_0x18adb2=_0x18adb2-0x0;var _0x587337=_0x2363[_0x18adb2];return _0x587337;};'use strict';var _=require(_0x3236('0x0'));var util=require(_0x3236('0x1'));var logger=require(_0x3236('0x2'))(_0x3236('0x3'));var moment=require(_0x3236('0x4'));var BPromise=require('bluebird');var rp=require(_0x3236('0x5'));var fs=require('fs');var path=require(_0x3236('0x6'));var rimraf=require(_0x3236('0x7'));var config=require(_0x3236('0x8'));var attributes=require(_0x3236('0x9'));module[_0x3236('0xa')]=function(_0x510d7b,_0x4b8008){return _0x510d7b['define'](_0x3236('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x3236('0xc'),'fields':['uniqueid',_0x3236('0xd')]},{'name':'leaveAt','fields':[_0x3236('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 8ac8e99..cc04f1d 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 _0x0b01=['jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateSquareReport','create','options','raw','stringify','SquareReport','update','body','attributes','limit','then','UpdateSquareReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0b01,0x158));var _0x10b0=function(_0x1eb0cb,_0x3ec602){_0x1eb0cb=_0x1eb0cb-0x0;var _0x1327d8=_0x0b01[_0x1eb0cb];return _0x1327d8;};'use strict';var _=require(_0x10b0('0x0'));var util=require(_0x10b0('0x1'));var moment=require(_0x10b0('0x2'));var BPromise=require('bluebird');var rs=require(_0x10b0('0x3'));var fs=require('fs');var Redis=require(_0x10b0('0x4'));var db=require(_0x10b0('0x5'))['db'];var utils=require(_0x10b0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x10b0('0x7'));var jayson=require(_0x10b0('0x8'));var client=jayson[_0x10b0('0x9')][_0x10b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1aa237,_0xaf0061,_0x535169){return new BPromise(function(_0x1b91a3,_0x5b7cb1){return client[_0x10b0('0xb')](_0x1aa237,_0x535169)['then'](function(_0x4424c3){logger[_0x10b0('0xc')](_0x10b0('0xd'),_0xaf0061,_0x10b0('0xe'));logger['debug'](_0x10b0('0xf'),_0xaf0061,_0x10b0('0xe'),JSON['stringify'](_0x4424c3));if(_0x4424c3[_0x10b0('0x10')]){if(_0x4424c3[_0x10b0('0x10')]['code']===0x1f4){logger[_0x10b0('0x10')](_0x10b0('0xd'),_0xaf0061,_0x4424c3[_0x10b0('0x10')][_0x10b0('0x11')]);return _0x5b7cb1(_0x4424c3[_0x10b0('0x10')][_0x10b0('0x11')]);}logger[_0x10b0('0x10')]('SquareReport,\x20%s,\x20%s',_0xaf0061,_0x4424c3[_0x10b0('0x10')][_0x10b0('0x11')]);return _0x1b91a3(_0x4424c3['error'][_0x10b0('0x11')]);}else{logger[_0x10b0('0xc')](_0x10b0('0xd'),_0xaf0061,'request\x20sent');_0x1b91a3(_0x4424c3[_0x10b0('0x12')]['message']);}})[_0x10b0('0x13')](function(_0x37d51a){logger[_0x10b0('0x10')](_0x10b0('0xd'),_0xaf0061,_0x37d51a);_0x5b7cb1(_0x37d51a);});});}exports[_0x10b0('0x14')]=function(_0x365555){var _0x33dd90=this;return new Promise(function(_0x397332,_0x20d0e9){return db['SquareReport'][_0x10b0('0x15')](_0x365555['body'],{'raw':_0x365555[_0x10b0('0x16')]?_0x365555[_0x10b0('0x16')][_0x10b0('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x367f79){logger[_0x10b0('0xc')]('CreateSquareReport',_0x365555);logger['debug'](_0x10b0('0x14'),_0x365555,JSON[_0x10b0('0x18')](_0x367f79));_0x397332(_0x367f79);})[_0x10b0('0x13')](function(_0x357e83){logger[_0x10b0('0x10')](_0x10b0('0x14'),_0x357e83[_0x10b0('0x11')],_0x365555);_0x20d0e9(_0x33dd90[_0x10b0('0x10')](0x1f4,_0x357e83[_0x10b0('0x11')]));});});};exports['UpdateSquareReport']=function(_0x102d10){var _0x4a8bb5=this;return new Promise(function(_0x1d6cca,_0x11930a){return db[_0x10b0('0x19')][_0x10b0('0x1a')](_0x102d10[_0x10b0('0x1b')],{'raw':_0x102d10[_0x10b0('0x16')]?_0x102d10[_0x10b0('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x102d10[_0x10b0('0x16')]?_0x102d10['options']['where']||null:null,'attributes':_0x102d10[_0x10b0('0x16')]?_0x102d10[_0x10b0('0x16')][_0x10b0('0x1c')]||null:null,'limit':_0x102d10[_0x10b0('0x16')]?_0x102d10[_0x10b0('0x16')][_0x10b0('0x1d')]||null:null})[_0x10b0('0x1e')](function(_0x278d9a){logger['info'](_0x10b0('0x1f'),_0x102d10);logger['debug'](_0x10b0('0x1f'),_0x102d10,JSON[_0x10b0('0x18')](_0x278d9a));_0x1d6cca(_0x278d9a);})[_0x10b0('0x13')](function(_0x4b7e1e){logger['error'](_0x10b0('0x1f'),_0x4b7e1e['message'],_0x102d10);_0x11930a(_0x4a8bb5[_0x10b0('0x10')](0x1f4,_0x4b7e1e['message']));});});}; \ No newline at end of file +var _0xe4e7=['SquareReport','create','body','options','raw','CreateSquareReport','UpdateSquareReport','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x350693,_0x5680b2){var _0x581311=function(_0x235165){while(--_0x235165){_0x350693['push'](_0x350693['shift']());}};_0x581311(++_0x5680b2);}(_0xe4e7,0x1d8));var _0x7e4e=function(_0x4fae85,_0x370e6a){_0x4fae85=_0x4fae85-0x0;var _0x121bab=_0xe4e7[_0x4fae85];return _0x121bab;};'use strict';var _=require('lodash');var util=require(_0x7e4e('0x0'));var moment=require(_0x7e4e('0x1'));var BPromise=require(_0x7e4e('0x2'));var rs=require(_0x7e4e('0x3'));var fs=require('fs');var Redis=require(_0x7e4e('0x4'));var db=require(_0x7e4e('0x5'))['db'];var utils=require(_0x7e4e('0x6'));var logger=require(_0x7e4e('0x7'))(_0x7e4e('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x7e4e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x85c0e5,_0x590812,_0x43e0b0){return new BPromise(function(_0x16c20b,_0x234ee8){return client[_0x7e4e('0xa')](_0x85c0e5,_0x43e0b0)[_0x7e4e('0xb')](function(_0x881ac7){logger['info'](_0x7e4e('0xc'),_0x590812,_0x7e4e('0xd'));logger[_0x7e4e('0xe')](_0x7e4e('0xf'),_0x590812,_0x7e4e('0xd'),JSON[_0x7e4e('0x10')](_0x881ac7));if(_0x881ac7[_0x7e4e('0x11')]){if(_0x881ac7[_0x7e4e('0x11')][_0x7e4e('0x12')]===0x1f4){logger[_0x7e4e('0x11')](_0x7e4e('0xc'),_0x590812,_0x881ac7['error'][_0x7e4e('0x13')]);return _0x234ee8(_0x881ac7[_0x7e4e('0x11')]['message']);}logger['error'](_0x7e4e('0xc'),_0x590812,_0x881ac7[_0x7e4e('0x11')][_0x7e4e('0x13')]);return _0x16c20b(_0x881ac7['error']['message']);}else{logger[_0x7e4e('0x14')](_0x7e4e('0xc'),_0x590812,'request\x20sent');_0x16c20b(_0x881ac7[_0x7e4e('0x15')][_0x7e4e('0x13')]);}})[_0x7e4e('0x16')](function(_0x41bac1){logger[_0x7e4e('0x11')]('SquareReport,\x20%s,\x20%s',_0x590812,_0x41bac1);_0x234ee8(_0x41bac1);});});}exports['CreateSquareReport']=function(_0x3d7392){var _0x89900a=this;return new Promise(function(_0x1dc7d6,_0x9129f){return db[_0x7e4e('0x17')][_0x7e4e('0x18')](_0x3d7392[_0x7e4e('0x19')],{'raw':_0x3d7392['options']?_0x3d7392[_0x7e4e('0x1a')][_0x7e4e('0x1b')]===undefined?!![]:![]:!![]})[_0x7e4e('0xb')](function(_0x161dc8){logger[_0x7e4e('0x14')](_0x7e4e('0x1c'),_0x3d7392);logger['debug'](_0x7e4e('0x1c'),_0x3d7392,JSON[_0x7e4e('0x10')](_0x161dc8));_0x1dc7d6(_0x161dc8);})['catch'](function(_0xb84513){logger[_0x7e4e('0x11')](_0x7e4e('0x1c'),_0xb84513[_0x7e4e('0x13')],_0x3d7392);_0x9129f(_0x89900a['error'](0x1f4,_0xb84513[_0x7e4e('0x13')]));});});};exports[_0x7e4e('0x1d')]=function(_0x58a648){var _0x1a9778=this;return new Promise(function(_0x1c1325,_0x1204a9){return db[_0x7e4e('0x17')]['update'](_0x58a648[_0x7e4e('0x19')],{'raw':_0x58a648['options']?_0x58a648['options'][_0x7e4e('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58a648['options']?_0x58a648['options'][_0x7e4e('0x1e')]||null:null,'attributes':_0x58a648[_0x7e4e('0x1a')]?_0x58a648['options'][_0x7e4e('0x1f')]||null:null,'limit':_0x58a648[_0x7e4e('0x1a')]?_0x58a648[_0x7e4e('0x1a')][_0x7e4e('0x20')]||null:null})[_0x7e4e('0xb')](function(_0x575c6c){logger[_0x7e4e('0x14')]('UpdateSquareReport',_0x58a648);logger[_0x7e4e('0xe')]('UpdateSquareReport',_0x58a648,JSON[_0x7e4e('0x10')](_0x575c6c));_0x1c1325(_0x575c6c);})[_0x7e4e('0x16')](function(_0x1c0edb){logger['error'](_0x7e4e('0x1d'),_0x1c0edb[_0x7e4e('0x13')],_0x58a648);_0x1204a9(_0x1a9778[_0x7e4e('0x11')](0x1f4,_0x1c0edb[_0x7e4e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index ae2b8da..d183251 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 _0x9ab8=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2e5f9c,_0x134a52){var _0x538b44=function(_0x38ef13){while(--_0x38ef13){_0x2e5f9c['push'](_0x2e5f9c['shift']());}};_0x538b44(++_0x134a52);}(_0x9ab8,0x14f));var _0x89ab=function(_0x13835a,_0x4378cb){_0x13835a=_0x13835a-0x0;var _0xb69de3=_0x9ab8[_0x13835a];return _0xb69de3;};'use strict';var multer=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var path=require(_0x89ab('0x2'));var timeout=require('connect-timeout');var express=require(_0x89ab('0x3'));var router=express[_0x89ab('0x4')]();var fs_extra=require(_0x89ab('0x5'));var auth=require(_0x89ab('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x89ab('0x7'));var controller=require('./squareReportDetail.controller');router[_0x89ab('0x8')]('/',auth[_0x89ab('0x9')](),controller[_0x89ab('0xa')]);router['get'](_0x89ab('0xb'),auth['isAuthenticated'](),controller[_0x89ab('0xc')]);router[_0x89ab('0x8')](_0x89ab('0xd'),auth[_0x89ab('0x9')](),controller[_0x89ab('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x89ab('0xf')]('/:id',auth[_0x89ab('0x9')](),controller[_0x89ab('0x10')]);router['delete'](_0x89ab('0xd'),auth[_0x89ab('0x9')](),controller[_0x89ab('0x11')]);module[_0x89ab('0x12')]=router; \ No newline at end of file +var _0xb39e=['./squareReportDetail.controller','isAuthenticated','index','/describe','describe','get','/:id','show','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x424ebf,_0x4c64d3){var _0x4c6aef=function(_0x3e17eb){while(--_0x3e17eb){_0x424ebf['push'](_0x424ebf['shift']());}};_0x4c6aef(++_0x4c64d3);}(_0xb39e,0x1af));var _0xeb39=function(_0x1229d1,_0x178640){_0x1229d1=_0x1229d1-0x0;var _0x3803f6=_0xb39e[_0x1229d1];return _0x3803f6;};'use strict';var multer=require(_0xeb39('0x0'));var util=require(_0xeb39('0x1'));var path=require(_0xeb39('0x2'));var timeout=require(_0xeb39('0x3'));var express=require(_0xeb39('0x4'));var router=express[_0xeb39('0x5')]();var fs_extra=require(_0xeb39('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xeb39('0x7'));var config=require(_0xeb39('0x8'));var controller=require(_0xeb39('0x9'));router['get']('/',auth[_0xeb39('0xa')](),controller[_0xeb39('0xb')]);router['get'](_0xeb39('0xc'),auth[_0xeb39('0xa')](),controller[_0xeb39('0xd')]);router[_0xeb39('0xe')](_0xeb39('0xf'),auth[_0xeb39('0xa')](),controller[_0xeb39('0x10')]);router['post']('/',auth[_0xeb39('0xa')](),controller[_0xeb39('0x11')]);router[_0xeb39('0x12')](_0xeb39('0xf'),auth[_0xeb39('0xa')](),controller[_0xeb39('0x13')]);router[_0xeb39('0x14')](_0xeb39('0xf'),auth['isAuthenticated'](),controller[_0xeb39('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index f576e92..0a3ce2f 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 _0x301d=['exports','STRING','sequelize'];(function(_0x2aee2f,_0xad9887){var _0x19337f=function(_0x2e62d){while(--_0x2e62d){_0x2aee2f['push'](_0x2aee2f['shift']());}};_0x19337f(++_0xad9887);}(_0x301d,0xe6));var _0xd301=function(_0x4ac1cf,_0x5beb1d){_0x4ac1cf=_0x4ac1cf-0x0;var _0x5dbb93=_0x301d[_0x4ac1cf];return _0x5dbb93;};'use strict';var Sequelize=require(_0xd301('0x0'));module[_0xd301('0x1')]={'uniqueid':{'type':Sequelize[_0xd301('0x2')]},'node':{'type':Sequelize[_0xd301('0x2')]},'application':{'type':Sequelize[_0xd301('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xd301('0x2')]}}; \ No newline at end of file +var _0xd79f=['TEXT','exports','STRING'];(function(_0x41234a,_0x4ac1dc){var _0x4f3426=function(_0x3de402){while(--_0x3de402){_0x41234a['push'](_0x41234a['shift']());}};_0x4f3426(++_0x4ac1dc);}(_0xd79f,0xee));var _0xfd79=function(_0x4475dc,_0x90570a){_0x4475dc=_0x4475dc-0x0;var _0x5b5dd1=_0xd79f[_0x4475dc];return _0x5b5dd1;};'use strict';var Sequelize=require('sequelize');module[_0xfd79('0x0')]={'uniqueid':{'type':Sequelize[_0xfd79('0x1')]},'node':{'type':Sequelize[_0xfd79('0x1')]},'application':{'type':Sequelize[_0xfd79('0x1')]},'data':{'type':Sequelize[_0xfd79('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index da257a0..68cca3a 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 _0x7d51=['attributes','hasOwnProperty','nolimit','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','update','params','destroy','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields'];(function(_0x23e4c7,_0x57110d){var _0x14a4d8=function(_0x4274df){while(--_0x4274df){_0x23e4c7['push'](_0x23e4c7['shift']());}};_0x14a4d8(++_0x57110d);}(_0x7d51,0x18c));var _0x17d5=function(_0x1b0c66,_0x721990){_0x1b0c66=_0x1b0c66-0x0;var _0x185648=_0x7d51[_0x1b0c66];return _0x185648;};'use strict';var emlformat=require(_0x17d5('0x0'));var rimraf=require(_0x17d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x17d5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x17d5('0x3'));var Mustache=require(_0x17d5('0x4'));var util=require(_0x17d5('0x5'));var path=require(_0x17d5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x17d5('0x7'));var _=require(_0x17d5('0x8'));var squel=require(_0x17d5('0x9'));var crypto=require(_0x17d5('0xa'));var jsforce=require(_0x17d5('0xb'));var deskjs=require(_0x17d5('0xc'));var toCsv=require(_0x17d5('0xd'));var querystring=require(_0x17d5('0xe'));var Papa=require(_0x17d5('0xf'));var Redis=require('ioredis');var authService=require(_0x17d5('0x10'));var qs=require(_0x17d5('0x11'));var as=require(_0x17d5('0x12'));var hardwareService=require(_0x17d5('0x13'));var logger=require(_0x17d5('0x14'))(_0x17d5('0x15'));var utils=require(_0x17d5('0x16'));var config=require(_0x17d5('0x17'));var licenseUtil=require(_0x17d5('0x18'));var db=require(_0x17d5('0x19'))['db'];function respondWithStatusCode(_0x2a9ded,_0x409557){_0x409557=_0x409557||0xcc;return function(_0x383773){if(_0x383773){return _0x2a9ded['sendStatus'](_0x409557);}return _0x2a9ded[_0x17d5('0x1a')](_0x409557)[_0x17d5('0x1b')]();};}function respondWithResult(_0x21d3bf,_0x1ae5ff){_0x1ae5ff=_0x1ae5ff||0xc8;return function(_0x3cb823){if(_0x3cb823){return _0x21d3bf[_0x17d5('0x1a')](_0x1ae5ff)[_0x17d5('0x1c')](_0x3cb823);}};}function respondWithFilteredResult(_0x956ee3,_0x24ac3c){return function(_0x2eacca){if(_0x2eacca){var _0x10f142=typeof _0x24ac3c[_0x17d5('0x1d')]===_0x17d5('0x1e')&&typeof _0x24ac3c[_0x17d5('0x1f')]==='undefined';var _0x525ee8=_0x2eacca['count'];var _0x2d1942=_0x10f142?0x0:_0x24ac3c[_0x17d5('0x1d')];var _0x47da15=_0x10f142?_0x2eacca[_0x17d5('0x20')]:_0x24ac3c[_0x17d5('0x1d')]+_0x24ac3c[_0x17d5('0x1f')];var _0x1206c2;if(_0x47da15>=_0x525ee8){_0x47da15=_0x525ee8;_0x1206c2=0xc8;}else{_0x1206c2=0xce;}_0x956ee3[_0x17d5('0x1a')](_0x1206c2);return _0x956ee3[_0x17d5('0x21')]('Content-Range',_0x2d1942+'-'+_0x47da15+'/'+_0x525ee8)['json'](_0x2eacca);}return null;};}function patchUpdates(_0xdcbbf2){return function(_0x30bed2){try{jsonpatch[_0x17d5('0x22')](_0x30bed2,_0xdcbbf2,!![]);}catch(_0xb06d1c){return BPromise[_0x17d5('0x23')](_0xb06d1c);}return _0x30bed2[_0x17d5('0x24')]();};}function saveUpdates(_0x46498e,_0x4b73a1){return function(_0x579613){if(_0x579613){return _0x579613['update'](_0x46498e)[_0x17d5('0x25')](function(_0x5006e5){return _0x5006e5;});}return null;};}function removeEntity(_0x33c50c,_0x43c2e3){return function(_0x58ff1e){if(_0x58ff1e){return _0x58ff1e['destroy']()[_0x17d5('0x25')](function(){_0x33c50c[_0x17d5('0x1a')](0xcc)[_0x17d5('0x1b')]();});}};}function handleEntityNotFound(_0x8b7665,_0x5ba8d6){return function(_0x5e767d){if(!_0x5e767d){_0x8b7665['sendStatus'](0x194);}return _0x5e767d;};}function handleError(_0x508dfa,_0x359e68){_0x359e68=_0x359e68||0x1f4;return function(_0x89b420){logger[_0x17d5('0x26')](_0x89b420['stack']);if(_0x89b420[_0x17d5('0x27')]){delete _0x89b420[_0x17d5('0x27')];}_0x508dfa['status'](_0x359e68)[_0x17d5('0x28')](_0x89b420);};}exports[_0x17d5('0x29')]=function(_0x3b6c96,_0x171b5c){var _0x2e0f67={},_0x3704c9={},_0x4cb678={'count':0x0,'rows':[]};var _0x252c45=_[_0x17d5('0x2a')](db[_0x17d5('0x2b')][_0x17d5('0x2c')],function(_0x5b19e5){return{'name':_0x5b19e5[_0x17d5('0x2d')],'type':_0x5b19e5[_0x17d5('0x2e')][_0x17d5('0x2f')]};});_0x3704c9[_0x17d5('0x30')]=_[_0x17d5('0x2a')](_0x252c45,_0x17d5('0x27'));_0x3704c9[_0x17d5('0x31')]=_[_0x17d5('0x32')](_0x3b6c96[_0x17d5('0x31')]);_0x3704c9[_0x17d5('0x33')]=_['intersection'](_0x3704c9[_0x17d5('0x30')],_0x3704c9[_0x17d5('0x31')]);_0x2e0f67['attributes']=_[_0x17d5('0x34')](_0x3704c9['model'],qs[_0x17d5('0x35')](_0x3b6c96['query']['fields']));_0x2e0f67['attributes']=_0x2e0f67[_0x17d5('0x36')]['length']?_0x2e0f67[_0x17d5('0x36')]:_0x3704c9[_0x17d5('0x30')];if(!_0x3b6c96['query'][_0x17d5('0x37')](_0x17d5('0x38'))){_0x2e0f67[_0x17d5('0x1f')]=qs[_0x17d5('0x1f')](_0x3b6c96[_0x17d5('0x31')][_0x17d5('0x1f')]);_0x2e0f67[_0x17d5('0x1d')]=qs[_0x17d5('0x1d')](_0x3b6c96[_0x17d5('0x31')]['offset']);}_0x2e0f67['order']=qs['sort'](_0x3b6c96[_0x17d5('0x31')]['sort']);_0x2e0f67['where']=qs['filters'](_[_0x17d5('0x39')](_0x3b6c96[_0x17d5('0x31')],_0x3704c9[_0x17d5('0x33')]),_0x252c45);if(_0x3b6c96[_0x17d5('0x31')][_0x17d5('0x3a')]){_0x2e0f67[_0x17d5('0x3b')]=_[_0x17d5('0x3c')](_0x2e0f67[_0x17d5('0x3b')],{'$or':_[_0x17d5('0x2a')](_0x252c45,function(_0x546331){if(_0x546331[_0x17d5('0x2e')]!==_0x17d5('0x3d')){var _0x5582bc={};_0x5582bc[_0x546331[_0x17d5('0x27')]]={'$like':'%'+_0x3b6c96[_0x17d5('0x31')][_0x17d5('0x3a')]+'%'};return _0x5582bc;}})});}_0x2e0f67=_['merge']({},_0x2e0f67,_0x3b6c96['options']);var _0x2333c1={'where':_0x2e0f67[_0x17d5('0x3b')]};return db[_0x17d5('0x2b')]['count'](_0x2333c1)[_0x17d5('0x25')](function(_0x393b42){_0x4cb678[_0x17d5('0x20')]=_0x393b42;if(_0x3b6c96['query'][_0x17d5('0x3e')]){_0x2e0f67[_0x17d5('0x3f')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x17d5('0x40')](_0x2e0f67);})[_0x17d5('0x25')](function(_0x30997d){_0x4cb678[_0x17d5('0x41')]=_0x30997d;return _0x4cb678;})['then'](respondWithFilteredResult(_0x171b5c,_0x2e0f67))[_0x17d5('0x42')](handleError(_0x171b5c,null));};exports[_0x17d5('0x43')]=function(_0x14f459,_0x411b63){var _0x54f4cc={'raw':!![],'where':{'id':_0x14f459['params']['id']}},_0x3d65b9={};_0x3d65b9[_0x17d5('0x30')]=_[_0x17d5('0x32')](db[_0x17d5('0x2b')][_0x17d5('0x2c')]);_0x3d65b9['query']=_[_0x17d5('0x32')](_0x14f459[_0x17d5('0x31')]);_0x3d65b9['filters']=_[_0x17d5('0x34')](_0x3d65b9['model'],_0x3d65b9[_0x17d5('0x31')]);_0x54f4cc[_0x17d5('0x36')]=_[_0x17d5('0x34')](_0x3d65b9[_0x17d5('0x30')],qs[_0x17d5('0x35')](_0x14f459[_0x17d5('0x31')][_0x17d5('0x35')]));_0x54f4cc[_0x17d5('0x36')]=_0x54f4cc[_0x17d5('0x36')]['length']?_0x54f4cc[_0x17d5('0x36')]:_0x3d65b9['model'];if(_0x14f459[_0x17d5('0x31')]['includeAll']){_0x54f4cc[_0x17d5('0x3f')]=[{'all':!![]}];}_0x54f4cc=_['merge']({},_0x54f4cc,_0x14f459[_0x17d5('0x44')]);return db[_0x17d5('0x2b')][_0x17d5('0x45')](_0x54f4cc)['then'](handleEntityNotFound(_0x411b63,null))['then'](respondWithResult(_0x411b63,null))[_0x17d5('0x42')](handleError(_0x411b63,null));};exports[_0x17d5('0x46')]=function(_0x42bf9a,_0x1d7bd6){return db['SquareDetailsReport'][_0x17d5('0x46')](_0x42bf9a[_0x17d5('0x47')],{})[_0x17d5('0x25')](respondWithResult(_0x1d7bd6,0xc9))[_0x17d5('0x42')](handleError(_0x1d7bd6,null));};exports[_0x17d5('0x48')]=function(_0x457172,_0x25a750){if(_0x457172['body']['id']){delete _0x457172[_0x17d5('0x47')]['id'];}return db[_0x17d5('0x2b')][_0x17d5('0x45')]({'where':{'id':_0x457172[_0x17d5('0x49')]['id']}})['then'](handleEntityNotFound(_0x25a750,null))[_0x17d5('0x25')](saveUpdates(_0x457172[_0x17d5('0x47')],null))[_0x17d5('0x25')](respondWithResult(_0x25a750,null))[_0x17d5('0x42')](handleError(_0x25a750,null));};exports[_0x17d5('0x4a')]=function(_0x43f29d,_0x1fc469){return db['SquareDetailsReport'][_0x17d5('0x45')]({'where':{'id':_0x43f29d[_0x17d5('0x49')]['id']}})[_0x17d5('0x25')](handleEntityNotFound(_0x1fc469,null))[_0x17d5('0x25')](removeEntity(_0x1fc469,null))[_0x17d5('0x42')](handleError(_0x1fc469,null));};exports['describe']=function(_0x10653f,_0x13f959){return db[_0x17d5('0x2b')]['describe']()[_0x17d5('0x25')](respondWithResult(_0x13f959,null))[_0x17d5('0x42')](handleError(_0x13f959,null));}; \ No newline at end of file +var _0xf3a0=['pick','filter','map','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','SquareDetailsReport','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where'];(function(_0x341f7f,_0x5e9bdd){var _0x7174dd=function(_0xb43ad2){while(--_0xb43ad2){_0x341f7f['push'](_0x341f7f['shift']());}};_0x7174dd(++_0x5e9bdd);}(_0xf3a0,0x182));var _0x0f3a=function(_0x253b37,_0xdb7ae0){_0x253b37=_0x253b37-0x0;var _0x24b147=_0xf3a0[_0x253b37];return _0x24b147;};'use strict';var emlformat=require(_0x0f3a('0x0'));var rimraf=require(_0x0f3a('0x1'));var zipdir=require(_0x0f3a('0x2'));var jsonpatch=require(_0x0f3a('0x3'));var rp=require(_0x0f3a('0x4'));var moment=require(_0x0f3a('0x5'));var BPromise=require(_0x0f3a('0x6'));var Mustache=require(_0x0f3a('0x7'));var util=require(_0x0f3a('0x8'));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(_0x0f3a('0x9'));var _=require(_0x0f3a('0xa'));var squel=require(_0x0f3a('0xb'));var crypto=require(_0x0f3a('0xc'));var jsforce=require(_0x0f3a('0xd'));var deskjs=require(_0x0f3a('0xe'));var toCsv=require(_0x0f3a('0xf'));var querystring=require(_0x0f3a('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0f3a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0f3a('0x12'));var hardwareService=require(_0x0f3a('0x13'));var logger=require(_0x0f3a('0x14'))('api');var utils=require(_0x0f3a('0x15'));var config=require(_0x0f3a('0x16'));var licenseUtil=require(_0x0f3a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x592485,_0x41e86b){_0x41e86b=_0x41e86b||0xcc;return function(_0xe834f){if(_0xe834f){return _0x592485['sendStatus'](_0x41e86b);}return _0x592485[_0x0f3a('0x18')](_0x41e86b)[_0x0f3a('0x19')]();};}function respondWithResult(_0x3c7023,_0x1b48a6){_0x1b48a6=_0x1b48a6||0xc8;return function(_0x5a18c6){if(_0x5a18c6){return _0x3c7023[_0x0f3a('0x18')](_0x1b48a6)[_0x0f3a('0x1a')](_0x5a18c6);}};}function respondWithFilteredResult(_0x2f591e,_0x27d84c){return function(_0x2e5c2e){if(_0x2e5c2e){var _0x43649e=typeof _0x27d84c['offset']===_0x0f3a('0x1b')&&typeof _0x27d84c['limit']===_0x0f3a('0x1b');var _0x23763c=_0x2e5c2e['count'];var _0x55258b=_0x43649e?0x0:_0x27d84c['offset'];var _0x2f0de1=_0x43649e?_0x2e5c2e[_0x0f3a('0x1c')]:_0x27d84c[_0x0f3a('0x1d')]+_0x27d84c[_0x0f3a('0x1e')];var _0x1de808;if(_0x2f0de1>=_0x23763c){_0x2f0de1=_0x23763c;_0x1de808=0xc8;}else{_0x1de808=0xce;}_0x2f591e[_0x0f3a('0x18')](_0x1de808);return _0x2f591e[_0x0f3a('0x1f')](_0x0f3a('0x20'),_0x55258b+'-'+_0x2f0de1+'/'+_0x23763c)[_0x0f3a('0x1a')](_0x2e5c2e);}return null;};}function patchUpdates(_0x1858d4){return function(_0x1711fe){try{jsonpatch[_0x0f3a('0x21')](_0x1711fe,_0x1858d4,!![]);}catch(_0x2dc398){return BPromise['reject'](_0x2dc398);}return _0x1711fe[_0x0f3a('0x22')]();};}function saveUpdates(_0x364613,_0xccfd80){return function(_0x35e0e4){if(_0x35e0e4){return _0x35e0e4[_0x0f3a('0x23')](_0x364613)[_0x0f3a('0x24')](function(_0x589dc1){return _0x589dc1;});}return null;};}function removeEntity(_0x2c92f5,_0x3e8fae){return function(_0x382e36){if(_0x382e36){return _0x382e36[_0x0f3a('0x25')]()[_0x0f3a('0x24')](function(){_0x2c92f5[_0x0f3a('0x18')](0xcc)[_0x0f3a('0x19')]();});}};}function handleEntityNotFound(_0x51cd91,_0x415ff6){return function(_0x4b3d34){if(!_0x4b3d34){_0x51cd91['sendStatus'](0x194);}return _0x4b3d34;};}function handleError(_0x160d87,_0x1259bd){_0x1259bd=_0x1259bd||0x1f4;return function(_0x239dc7){logger[_0x0f3a('0x26')](_0x239dc7[_0x0f3a('0x27')]);if(_0x239dc7[_0x0f3a('0x28')]){delete _0x239dc7[_0x0f3a('0x28')];}_0x160d87[_0x0f3a('0x18')](_0x1259bd)[_0x0f3a('0x29')](_0x239dc7);};}exports[_0x0f3a('0x2a')]=function(_0x3458a5,_0x411307){var _0x4fe389={},_0x1c2576={},_0x27618f={'count':0x0,'rows':[]};var _0x3cee0f=_['map'](db[_0x0f3a('0x2b')]['rawAttributes'],function(_0x513c7c){return{'name':_0x513c7c[_0x0f3a('0x2c')],'type':_0x513c7c[_0x0f3a('0x2d')]['key']};});_0x1c2576[_0x0f3a('0x2e')]=_['map'](_0x3cee0f,_0x0f3a('0x28'));_0x1c2576[_0x0f3a('0x2f')]=_[_0x0f3a('0x30')](_0x3458a5['query']);_0x1c2576[_0x0f3a('0x31')]=_[_0x0f3a('0x32')](_0x1c2576['model'],_0x1c2576[_0x0f3a('0x2f')]);_0x4fe389['attributes']=_['intersection'](_0x1c2576['model'],qs[_0x0f3a('0x33')](_0x3458a5['query'][_0x0f3a('0x33')]));_0x4fe389['attributes']=_0x4fe389[_0x0f3a('0x34')][_0x0f3a('0x35')]?_0x4fe389[_0x0f3a('0x34')]:_0x1c2576[_0x0f3a('0x2e')];if(!_0x3458a5[_0x0f3a('0x2f')][_0x0f3a('0x36')](_0x0f3a('0x37'))){_0x4fe389[_0x0f3a('0x1e')]=qs[_0x0f3a('0x1e')](_0x3458a5[_0x0f3a('0x2f')][_0x0f3a('0x1e')]);_0x4fe389[_0x0f3a('0x1d')]=qs[_0x0f3a('0x1d')](_0x3458a5[_0x0f3a('0x2f')][_0x0f3a('0x1d')]);}_0x4fe389['order']=qs[_0x0f3a('0x38')](_0x3458a5[_0x0f3a('0x2f')][_0x0f3a('0x38')]);_0x4fe389[_0x0f3a('0x39')]=qs[_0x0f3a('0x31')](_[_0x0f3a('0x3a')](_0x3458a5['query'],_0x1c2576[_0x0f3a('0x31')]),_0x3cee0f);if(_0x3458a5[_0x0f3a('0x2f')][_0x0f3a('0x3b')]){_0x4fe389['where']=_['merge'](_0x4fe389[_0x0f3a('0x39')],{'$or':_[_0x0f3a('0x3c')](_0x3cee0f,function(_0xe3de40){if(_0xe3de40['type']!=='VIRTUAL'){var _0x1bcc38={};_0x1bcc38[_0xe3de40[_0x0f3a('0x28')]]={'$like':'%'+_0x3458a5[_0x0f3a('0x2f')]['filter']+'%'};return _0x1bcc38;}})});}_0x4fe389=_[_0x0f3a('0x3d')]({},_0x4fe389,_0x3458a5[_0x0f3a('0x3e')]);var _0x2b9312={'where':_0x4fe389[_0x0f3a('0x39')]};return db[_0x0f3a('0x2b')][_0x0f3a('0x1c')](_0x2b9312)[_0x0f3a('0x24')](function(_0x4da01b){_0x27618f[_0x0f3a('0x1c')]=_0x4da01b;if(_0x3458a5[_0x0f3a('0x2f')][_0x0f3a('0x3f')]){_0x4fe389[_0x0f3a('0x40')]=[{'all':!![]}];}return db[_0x0f3a('0x2b')][_0x0f3a('0x41')](_0x4fe389);})[_0x0f3a('0x24')](function(_0x311103){_0x27618f[_0x0f3a('0x42')]=_0x311103;return _0x27618f;})[_0x0f3a('0x24')](respondWithFilteredResult(_0x411307,_0x4fe389))['catch'](handleError(_0x411307,null));};exports[_0x0f3a('0x43')]=function(_0x40ebb0,_0x510752){var _0x43e13a={'raw':!![],'where':{'id':_0x40ebb0[_0x0f3a('0x44')]['id']}},_0xefd435={};_0xefd435[_0x0f3a('0x2e')]=_[_0x0f3a('0x30')](db['SquareDetailsReport']['rawAttributes']);_0xefd435[_0x0f3a('0x2f')]=_['keys'](_0x40ebb0[_0x0f3a('0x2f')]);_0xefd435[_0x0f3a('0x31')]=_[_0x0f3a('0x32')](_0xefd435[_0x0f3a('0x2e')],_0xefd435['query']);_0x43e13a[_0x0f3a('0x34')]=_[_0x0f3a('0x32')](_0xefd435['model'],qs[_0x0f3a('0x33')](_0x40ebb0[_0x0f3a('0x2f')][_0x0f3a('0x33')]));_0x43e13a[_0x0f3a('0x34')]=_0x43e13a[_0x0f3a('0x34')]['length']?_0x43e13a['attributes']:_0xefd435[_0x0f3a('0x2e')];if(_0x40ebb0[_0x0f3a('0x2f')]['includeAll']){_0x43e13a[_0x0f3a('0x40')]=[{'all':!![]}];}_0x43e13a=_[_0x0f3a('0x3d')]({},_0x43e13a,_0x40ebb0[_0x0f3a('0x3e')]);return db[_0x0f3a('0x2b')][_0x0f3a('0x45')](_0x43e13a)['then'](handleEntityNotFound(_0x510752,null))[_0x0f3a('0x24')](respondWithResult(_0x510752,null))[_0x0f3a('0x46')](handleError(_0x510752,null));};exports[_0x0f3a('0x47')]=function(_0x49b099,_0x2cbb2d){return db[_0x0f3a('0x2b')][_0x0f3a('0x47')](_0x49b099[_0x0f3a('0x48')],{})['then'](respondWithResult(_0x2cbb2d,0xc9))[_0x0f3a('0x46')](handleError(_0x2cbb2d,null));};exports[_0x0f3a('0x23')]=function(_0x204e07,_0x1cbc58){if(_0x204e07[_0x0f3a('0x48')]['id']){delete _0x204e07[_0x0f3a('0x48')]['id'];}return db[_0x0f3a('0x2b')]['find']({'where':{'id':_0x204e07['params']['id']}})[_0x0f3a('0x24')](handleEntityNotFound(_0x1cbc58,null))[_0x0f3a('0x24')](saveUpdates(_0x204e07[_0x0f3a('0x48')],null))[_0x0f3a('0x24')](respondWithResult(_0x1cbc58,null))[_0x0f3a('0x46')](handleError(_0x1cbc58,null));};exports[_0x0f3a('0x25')]=function(_0x4f35fb,_0x1ded09){return db[_0x0f3a('0x2b')][_0x0f3a('0x45')]({'where':{'id':_0x4f35fb[_0x0f3a('0x44')]['id']}})[_0x0f3a('0x24')](handleEntityNotFound(_0x1ded09,null))['then'](removeEntity(_0x1ded09,null))['catch'](handleError(_0x1ded09,null));};exports['describe']=function(_0x20556a,_0x4dba84){return db[_0x0f3a('0x2b')][_0x0f3a('0x49')]()[_0x0f3a('0x24')](respondWithResult(_0x4dba84,null))['catch'](handleError(_0x4dba84,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index ff40f11..bdd39c9 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 _0xa7cd=['define','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports'];(function(_0x464c27,_0x4d170a){var _0x39d64f=function(_0x407a41){while(--_0x407a41){_0x464c27['push'](_0x464c27['shift']());}};_0x39d64f(++_0x4d170a);}(_0xa7cd,0x198));var _0xda7c=function(_0x43a8eb,_0x4b03b9){_0x43a8eb=_0x43a8eb-0x0;var _0xd1aa1=_0xa7cd[_0x43a8eb];return _0xd1aa1;};'use strict';var _=require(_0xda7c('0x0'));var util=require(_0xda7c('0x1'));var logger=require(_0xda7c('0x2'))(_0xda7c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xda7c('0x4'));var fs=require('fs');var path=require(_0xda7c('0x5'));var rimraf=require(_0xda7c('0x6'));var config=require(_0xda7c('0x7'));var attributes=require(_0xda7c('0x8'));module[_0xda7c('0x9')]=function(_0x183d3c,_0x1f6e31){return _0x183d3c[_0xda7c('0xa')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee44=['define','report_square_details','lodash','util','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x501ec6,_0x5e8377){var _0x136f06=function(_0x154bc4){while(--_0x154bc4){_0x501ec6['push'](_0x501ec6['shift']());}};_0x136f06(++_0x5e8377);}(_0xee44,0x89));var _0x4ee4=function(_0x182bac,_0x5a08a0){_0x182bac=_0x182bac-0x0;var _0x3a1458=_0xee44[_0x182bac];return _0x3a1458;};'use strict';var _=require(_0x4ee4('0x0'));var util=require(_0x4ee4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4ee4('0x2'));var fs=require('fs');var path=require(_0x4ee4('0x3'));var rimraf=require(_0x4ee4('0x4'));var config=require(_0x4ee4('0x5'));var attributes=require('./squareReportDetail.attributes');module[_0x4ee4('0x6')]=function(_0x15c91f,_0x585e04){return _0x15c91f[_0x4ee4('0x7')]('SquareDetailsReport',attributes,{'tableName':_0x4ee4('0x8'),'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 650fb9c..a89b847 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 _0x5eb8=['CreateSquareDetailsReport','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','catch','SquareDetailsReport','create','body','options','raw','then'];(function(_0x56ef43,_0x1ff7bd){var _0x1f8646=function(_0x352804){while(--_0x352804){_0x56ef43['push'](_0x56ef43['shift']());}};_0x1f8646(++_0x1ff7bd);}(_0x5eb8,0xb0));var _0x85eb=function(_0x4b980d,_0x32fc6a){_0x4b980d=_0x4b980d-0x0;var _0x5c7974=_0x5eb8[_0x4b980d];return _0x5c7974;};'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});function respondWithRpcPromise(_0x4a8814,_0x16d7b9,_0x3af658){return new BPromise(function(_0x448345,_0x5cd4ec){return client[_0x85eb('0xc')](_0x4a8814,_0x3af658)['then'](function(_0x1f0036){logger[_0x85eb('0xd')](_0x85eb('0xe'),_0x16d7b9,_0x85eb('0xf'));logger[_0x85eb('0x10')](_0x85eb('0x11'),_0x16d7b9,_0x85eb('0xf'),JSON['stringify'](_0x1f0036));if(_0x1f0036[_0x85eb('0x12')]){if(_0x1f0036[_0x85eb('0x12')]['code']===0x1f4){logger[_0x85eb('0x12')](_0x85eb('0xe'),_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x5cd4ec(_0x1f0036['error']['message']);}logger[_0x85eb('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x16d7b9,_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);return _0x448345(_0x1f0036[_0x85eb('0x12')][_0x85eb('0x13')]);}else{logger[_0x85eb('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0x16d7b9,_0x85eb('0xf'));_0x448345(_0x1f0036['result'][_0x85eb('0x13')]);}})[_0x85eb('0x14')](function(_0x3e23e8){logger[_0x85eb('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x16d7b9,_0x3e23e8);_0x5cd4ec(_0x3e23e8);});});}exports['CreateSquareDetailsReport']=function(_0x50d2a8){var _0xe198ca=this;return new Promise(function(_0x39ca96,_0x10cf2f){return db[_0x85eb('0x15')][_0x85eb('0x16')](_0x50d2a8[_0x85eb('0x17')],{'raw':_0x50d2a8['options']?_0x50d2a8[_0x85eb('0x18')][_0x85eb('0x19')]===undefined?!![]:![]:!![]})[_0x85eb('0x1a')](function(_0x4e8041){logger['info']('CreateSquareDetailsReport',_0x50d2a8);logger['debug'](_0x85eb('0x1b'),_0x50d2a8,JSON[_0x85eb('0x1c')](_0x4e8041));_0x39ca96(_0x4e8041);})[_0x85eb('0x14')](function(_0x255ca7){logger[_0x85eb('0x12')](_0x85eb('0x1b'),_0x255ca7['message'],_0x50d2a8);_0x10cf2f(_0xe198ca['error'](0x1f4,_0x255ca7['message']));});});}; \ No newline at end of file +var _0x5ed9=['stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x309df4,_0x3391db){var _0x4be8fc=function(_0x2261e4){while(--_0x2261e4){_0x309df4['push'](_0x309df4['shift']());}};_0x4be8fc(++_0x3391db);}(_0x5ed9,0x1e9));var _0x95ed=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5ed9[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x95ed('0x0'));var util=require(_0x95ed('0x1'));var moment=require('moment');var BPromise=require(_0x95ed('0x2'));var rs=require(_0x95ed('0x3'));var fs=require('fs');var Redis=require(_0x95ed('0x4'));var db=require(_0x95ed('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95ed('0x6'))(_0x95ed('0x7'));var config=require(_0x95ed('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x95ed('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32bf25,_0xaa1eb1,_0x3753b5){return new BPromise(function(_0x1df51f,_0x46ed43){return client[_0x95ed('0xa')](_0x32bf25,_0x3753b5)['then'](function(_0x2b59f5){logger[_0x95ed('0xb')](_0x95ed('0xc'),_0xaa1eb1,'request\x20sent');logger[_0x95ed('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0xaa1eb1,_0x95ed('0xe'),JSON[_0x95ed('0xf')](_0x2b59f5));if(_0x2b59f5[_0x95ed('0x10')]){if(_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x11')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xaa1eb1,_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x12')]);return _0x46ed43(_0x2b59f5['error']['message']);}logger[_0x95ed('0x10')](_0x95ed('0xc'),_0xaa1eb1,_0x2b59f5[_0x95ed('0x10')][_0x95ed('0x12')]);return _0x1df51f(_0x2b59f5['error'][_0x95ed('0x12')]);}else{logger[_0x95ed('0xb')](_0x95ed('0xc'),_0xaa1eb1,_0x95ed('0xe'));_0x1df51f(_0x2b59f5[_0x95ed('0x13')]['message']);}})[_0x95ed('0x14')](function(_0x54ad78){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xaa1eb1,_0x54ad78);_0x46ed43(_0x54ad78);});});}exports[_0x95ed('0x15')]=function(_0x58fb9e){var _0x421ab9=this;return new Promise(function(_0x1bc47c,_0x4ad26d){return db[_0x95ed('0x16')][_0x95ed('0x17')](_0x58fb9e[_0x95ed('0x18')],{'raw':_0x58fb9e[_0x95ed('0x19')]?_0x58fb9e[_0x95ed('0x19')][_0x95ed('0x1a')]===undefined?!![]:![]:!![]})[_0x95ed('0x1b')](function(_0x3e05cf){logger[_0x95ed('0xb')](_0x95ed('0x15'),_0x58fb9e);logger['debug'](_0x95ed('0x15'),_0x58fb9e,JSON[_0x95ed('0xf')](_0x3e05cf));_0x1bc47c(_0x3e05cf);})['catch'](function(_0x5d5afe){logger['error'](_0x95ed('0x15'),_0x5d5afe[_0x95ed('0x12')],_0x58fb9e);_0x4ad26d(_0x421ab9[_0x95ed('0x10')](0x1f4,_0x5d5afe[_0x95ed('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index b1bcd0e..996bda7 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 _0xc54b=['./system.controller','get','isAuthenticated','index','exports','express','Router','../../components/auth/service'];(function(_0x291fff,_0x12f5ea){var _0x1eb6e9=function(_0x529be8){while(--_0x529be8){_0x291fff['push'](_0x291fff['shift']());}};_0x1eb6e9(++_0x12f5ea);}(_0xc54b,0x9d));var _0xbc54=function(_0x2d8d86,_0x16e75d){_0x2d8d86=_0x2d8d86-0x0;var _0x4d91a4=_0xc54b[_0x2d8d86];return _0x4d91a4;};'use strict';var express=require(_0xbc54('0x0'));var router=express[_0xbc54('0x1')]();var auth=require(_0xbc54('0x2'));var controller=require(_0xbc54('0x3'));router[_0xbc54('0x4')]('/',auth[_0xbc54('0x5')](),controller[_0xbc54('0x6')]);router[_0xbc54('0x4')]('/process/:pid/kill',auth['isAuthenticated'](),controller['killProcess']);module[_0xbc54('0x7')]=router; \ No newline at end of file +var _0x1c04=['index','express','Router','./system.controller','get','isAuthenticated'];(function(_0x273517,_0x50b234){var _0x2c6334=function(_0x26c055){while(--_0x26c055){_0x273517['push'](_0x273517['shift']());}};_0x2c6334(++_0x50b234);}(_0x1c04,0x12d));var _0x41c0=function(_0xe05ae6,_0x2b82a7){_0xe05ae6=_0xe05ae6-0x0;var _0x4f3030=_0x1c04[_0xe05ae6];return _0x4f3030;};'use strict';var express=require(_0x41c0('0x0'));var router=express[_0x41c0('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x41c0('0x2'));router[_0x41c0('0x3')]('/',auth[_0x41c0('0x4')](),controller[_0x41c0('0x5')]);router[_0x41c0('0x3')]('/process/:pid/kill',auth['isAuthenticated'](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 9da6b14..c9b9279 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 _0xc6c4=['exec','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','then','status','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation'];(function(_0x27afc9,_0x57c938){var _0x34893e=function(_0x56bdf9){while(--_0x56bdf9){_0x27afc9['push'](_0x27afc9['shift']());}};_0x34893e(++_0x57c938);}(_0xc6c4,0x6f));var _0x4c6c=function(_0x354db6,_0x4c59bd){_0x354db6=_0x354db6-0x0;var _0x5460f2=_0xc6c4[_0x354db6];return _0x5460f2;};'use strict';var info=require(_0x4c6c('0x0'));var exec=require('child_process')[_0x4c6c('0x1')];var logger=require('../../config/logger')(_0x4c6c('0x2'));var util=require(_0x4c6c('0x3'));var BPromise=require(_0x4c6c('0x4'));var _=require(_0x4c6c('0x5'));function handleError(_0x658f52,_0x241aba,_0x279b7c){_0x241aba=_0x241aba||0x1f4;return function(_0x5f2d03){logger['error'](_0x4c6c('0x6'),_0x279b7c,_0x241aba,util[_0x4c6c('0x7')](_0x5f2d03,{'showHidden':![],'depth':null}));delete _0x5f2d03[_0x4c6c('0x8')];_0x658f52['status'](_0x241aba)[_0x4c6c('0x9')](_0x5f2d03);};}exports[_0x4c6c('0xa')]=function(_0x1b5861,_0x3e11a4){return info[_0x4c6c('0xb')]()[_0x4c6c('0xc')](function(_0x5f5aa8){return _0x3e11a4[_0x4c6c('0xd')](0xc8)['json'](_0x5f5aa8);})[_0x4c6c('0xe')](function(_0xf36569){return _0x3e11a4[_0x4c6c('0xd')](0x1f4)[_0x4c6c('0xf')](_0xf36569);});};exports[_0x4c6c('0x10')]=function(_0x53af0c,_0x40415e){var _0x4b8ac5=[_0x4c6c('0x11')];return new BPromise(function(_0x51de21,_0x4bd4de){return exec(util[_0x4c6c('0x12')](_0x4c6c('0x13'),_0x53af0c[_0x4c6c('0x14')][_0x4c6c('0x15')]),function(_0x1efac7,_0x3ffb2c,_0x461efa){if(_0x1efac7){return _0x4bd4de(_0x1efac7);}return _0x51de21(_0x3ffb2c);});})['then'](function(_0x833f8e){var _0x445cc6=![];var _0x48c7fa=_0x833f8e['split'](/\n/);for(var _0x3307c9=0x0,_0x5ac844=_0x4b8ac5[_0x4c6c('0x16')];_0x3307c9<_0x5ac844,_0x445cc6===![];_0x3307c9+=0x1){if(_0x833f8e[_0x4c6c('0x17')](_0x4b8ac5[_0x3307c9])>=0x0){_0x445cc6=!![];}}if(!_0x445cc6){throw new Error(util[_0x4c6c('0x12')](_0x4c6c('0x18'),_0x53af0c['params'][_0x4c6c('0x15')]));}process[_0x4c6c('0x19')](_0x53af0c[_0x4c6c('0x14')][_0x4c6c('0x15')],_0x4c6c('0x1a'));return _0x40415e['status'](0xc8)[_0x4c6c('0xf')]({'message':util[_0x4c6c('0x12')](_0x4c6c('0x1b'),_0x53af0c[_0x4c6c('0x14')]['pid'])});})[_0x4c6c('0xe')](handleError(_0x40415e,null,_0x4c6c('0x10')));}; \ No newline at end of file +var _0xc6b6=['indexOf','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','util','bluebird','lodash','inspect','status','send','index','getAllData','json','catch','killProcess','components/import/cm','format','params','pid','split','length'];(function(_0x4af5a5,_0x3626f6){var _0x42ce51=function(_0x2cb2ce){while(--_0x2cb2ce){_0x4af5a5['push'](_0x4af5a5['shift']());}};_0x42ce51(++_0x3626f6);}(_0xc6b6,0x1e5));var _0x6c6b=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc6b6[_0x19950b];return _0x3c6b41;};'use strict';var info=require(_0x6c6b('0x0'));var exec=require(_0x6c6b('0x1'))[_0x6c6b('0x2')];var logger=require(_0x6c6b('0x3'))('api');var util=require(_0x6c6b('0x4'));var BPromise=require(_0x6c6b('0x5'));var _=require(_0x6c6b('0x6'));function handleError(_0x2191f8,_0x4d3aaf,_0x4d4b3d){_0x4d3aaf=_0x4d3aaf||0x1f4;return function(_0x5a21a9){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4d4b3d,_0x4d3aaf,util[_0x6c6b('0x7')](_0x5a21a9,{'showHidden':![],'depth':null}));delete _0x5a21a9['name'];_0x2191f8[_0x6c6b('0x8')](_0x4d3aaf)[_0x6c6b('0x9')](_0x5a21a9);};}exports[_0x6c6b('0xa')]=function(_0x1c8a61,_0x39deb9){return info[_0x6c6b('0xb')]()['then'](function(_0x199798){return _0x39deb9[_0x6c6b('0x8')](0xc8)[_0x6c6b('0xc')](_0x199798);})[_0x6c6b('0xd')](function(_0x5e9756){return _0x39deb9[_0x6c6b('0x8')](0x1f4)[_0x6c6b('0xc')](_0x5e9756);});};exports[_0x6c6b('0xe')]=function(_0x325df9,_0x5ad933){var _0x8bbcc4=[_0x6c6b('0xf')];return new BPromise(function(_0x3036c8,_0x185da8){return exec(util[_0x6c6b('0x10')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x325df9[_0x6c6b('0x11')][_0x6c6b('0x12')]),function(_0x17bf24,_0x5b34df,_0x40e8a4){if(_0x17bf24){return _0x185da8(_0x17bf24);}return _0x3036c8(_0x5b34df);});})['then'](function(_0x2f5707){var _0x474d63=![];var _0x496bfb=_0x2f5707[_0x6c6b('0x13')](/\n/);for(var _0x5d5b25=0x0,_0x242a08=_0x8bbcc4[_0x6c6b('0x14')];_0x5d5b25<_0x242a08,_0x474d63===![];_0x5d5b25+=0x1){if(_0x2f5707[_0x6c6b('0x15')](_0x8bbcc4[_0x5d5b25])>=0x0){_0x474d63=!![];}}if(!_0x474d63){throw new Error(util[_0x6c6b('0x10')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x325df9[_0x6c6b('0x11')][_0x6c6b('0x12')]));}process['kill'](_0x325df9[_0x6c6b('0x11')][_0x6c6b('0x12')],'SIGINT');return _0x5ad933[_0x6c6b('0x8')](0xc8)[_0x6c6b('0xc')]({'message':util[_0x6c6b('0x10')](_0x6c6b('0x16'),_0x325df9[_0x6c6b('0x11')]['pid'])});})[_0x6c6b('0xd')](handleError(_0x5ad933,null,_0x6c6b('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 1373ffe..e0ab491 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 _0xe0de=['isAuthenticated','index','show','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get'];(function(_0x37c681,_0xd49ca3){var _0x568bbf=function(_0x341391){while(--_0x341391){_0x37c681['push'](_0x37c681['shift']());}};_0x568bbf(++_0xd49ca3);}(_0xe0de,0x1e4));var _0xee0d=function(_0xf1c984,_0x5d7b78){_0xf1c984=_0xf1c984-0x0;var _0x524ce7=_0xe0de[_0xf1c984];return _0x524ce7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee0d('0x0'));var timeout=require(_0xee0d('0x1'));var express=require(_0xee0d('0x2'));var router=express[_0xee0d('0x3')]();var fs_extra=require(_0xee0d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xee0d('0x5'));var config=require(_0xee0d('0x6'));var controller=require(_0xee0d('0x7'));router[_0xee0d('0x8')]('/',auth[_0xee0d('0x9')](),controller[_0xee0d('0xa')]);router[_0xee0d('0x8')]('/:id',auth[_0xee0d('0x9')](),controller[_0xee0d('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xee0d('0xc')]('/:id',auth[_0xee0d('0x9')](),controller[_0xee0d('0xd')]);router[_0xee0d('0xe')]('/:id',auth[_0xee0d('0x9')](),controller[_0xee0d('0xf')]);module[_0xee0d('0x10')]=router; \ No newline at end of file +var _0x95e0=['../../config/environment','./tag.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0x95e0,0x163));var _0x095e=function(_0x5d7294,_0x1bf034){_0x5d7294=_0x5d7294-0x0;var _0x2e5ecd=_0x95e0[_0x5d7294];return _0x2e5ecd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x095e('0x0'));var timeout=require('connect-timeout');var express=require(_0x095e('0x1'));var router=express[_0x095e('0x2')]();var fs_extra=require(_0x095e('0x3'));var auth=require(_0x095e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x095e('0x5'));var controller=require(_0x095e('0x6'));router[_0x095e('0x7')]('/',auth[_0x095e('0x8')](),controller[_0x095e('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x095e('0xa')]);router[_0x095e('0xb')]('/',auth['isAuthenticated'](),controller[_0x095e('0xc')]);router[_0x095e('0xd')](_0x095e('0xe'),auth[_0x095e('0x8')](),controller[_0x095e('0xf')]);router[_0x095e('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x095e('0x11')]);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 6ef622e..2a1b916 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 _0xa887=['#0091EA','sequelize','STRING','name'];(function(_0x2cb169,_0x38ec0a){var _0x54c758=function(_0x3f3cf4){while(--_0x3f3cf4){_0x2cb169['push'](_0x2cb169['shift']());}};_0x54c758(++_0x38ec0a);}(_0xa887,0x89));var _0x7a88=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa887[_0x34bf97];return _0x292719;};'use strict';var Sequelize=require(_0x7a88('0x0'));module['exports']={'name':{'type':Sequelize[_0x7a88('0x1')],'unique':_0x7a88('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x7a88('0x3')},'description':{'type':Sequelize[_0x7a88('0x1')]}}; \ No newline at end of file +var _0x71f4=['STRING','name','#0091EA'];(function(_0x5ca1e7,_0x21f8cb){var _0x2c62f5=function(_0xd82af0){while(--_0xd82af0){_0x5ca1e7['push'](_0x5ca1e7['shift']());}};_0x2c62f5(++_0x21f8cb);}(_0x71f4,0xf9));var _0x471f=function(_0x572021,_0x50f149){_0x572021=_0x572021-0x0;var _0x1e221d=_0x71f4[_0x572021];return _0x1e221d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x471f('0x0')],'unique':_0x471f('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x471f('0x0')],'defaultValue':_0x471f('0x2')},'description':{'type':Sequelize[_0x471f('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 0070668..20a4582 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 _0x9b9b=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','options','includeAll','rows','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','userProfileId','autoAssociation','error','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','sendStatus','stack','name','send','index','map','Tag','rawAttributes','type','key'];(function(_0x2bdba7,_0x24f2c3){var _0x283dfe=function(_0x1065dc){while(--_0x1065dc){_0x2bdba7['push'](_0x2bdba7['shift']());}};_0x283dfe(++_0x24f2c3);}(_0x9b9b,0x114));var _0xb9b9=function(_0x4a9a17,_0x273a09){_0x4a9a17=_0x4a9a17-0x0;var _0x30e831=_0x9b9b[_0x4a9a17];return _0x30e831;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9b9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb9b9('0x1'));var moment=require(_0xb9b9('0x2'));var BPromise=require(_0xb9b9('0x3'));var Mustache=require(_0xb9b9('0x4'));var util=require(_0xb9b9('0x5'));var path=require(_0xb9b9('0x6'));var sox=require(_0xb9b9('0x7'));var csv=require(_0xb9b9('0x8'));var ejs=require(_0xb9b9('0x9'));var fs=require('fs');var fs_extra=require(_0xb9b9('0xa'));var _=require(_0xb9b9('0xb'));var squel=require(_0xb9b9('0xc'));var crypto=require(_0xb9b9('0xd'));var jsforce=require(_0xb9b9('0xe'));var deskjs=require(_0xb9b9('0xf'));var toCsv=require(_0xb9b9('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb9b9('0x10'));var authService=require(_0xb9b9('0x11'));var qs=require(_0xb9b9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9b9('0x13'));var logger=require(_0xb9b9('0x14'))(_0xb9b9('0x15'));var utils=require('../../config/utils');var config=require(_0xb9b9('0x16'));var licenseUtil=require(_0xb9b9('0x17'));var db=require(_0xb9b9('0x18'))['db'];function respondWithStatusCode(_0x26fa04,_0x230fea){_0x230fea=_0x230fea||0xcc;return function(_0x135cdc){if(_0x135cdc){return _0x26fa04['sendStatus'](_0x230fea);}return _0x26fa04['status'](_0x230fea)[_0xb9b9('0x19')]();};}function respondWithResult(_0x4ef543,_0xe78d58){_0xe78d58=_0xe78d58||0xc8;return function(_0x50e5d6){if(_0x50e5d6){return _0x4ef543[_0xb9b9('0x1a')](_0xe78d58)[_0xb9b9('0x1b')](_0x50e5d6);}};}function respondWithFilteredResult(_0x21fa2a,_0x29794c){return function(_0x177ad9){if(_0x177ad9){var _0x3fd09c=typeof _0x29794c[_0xb9b9('0x1c')]===_0xb9b9('0x1d')&&typeof _0x29794c['limit']===_0xb9b9('0x1d');var _0x48d9ae=_0x177ad9[_0xb9b9('0x1e')];var _0x3e6d23=_0x3fd09c?0x0:_0x29794c[_0xb9b9('0x1c')];var _0x11bb05=_0x3fd09c?_0x177ad9['count']:_0x29794c[_0xb9b9('0x1c')]+_0x29794c[_0xb9b9('0x1f')];var _0x398f3d;if(_0x11bb05>=_0x48d9ae){_0x11bb05=_0x48d9ae;_0x398f3d=0xc8;}else{_0x398f3d=0xce;}_0x21fa2a[_0xb9b9('0x1a')](_0x398f3d);return _0x21fa2a[_0xb9b9('0x20')](_0xb9b9('0x21'),_0x3e6d23+'-'+_0x11bb05+'/'+_0x48d9ae)[_0xb9b9('0x1b')](_0x177ad9);}return null;};}function patchUpdates(_0x3d0edb){return function(_0xb16391){try{jsonpatch[_0xb9b9('0x22')](_0xb16391,_0x3d0edb,!![]);}catch(_0xbf7c16){return BPromise[_0xb9b9('0x23')](_0xbf7c16);}return _0xb16391[_0xb9b9('0x24')]();};}function saveUpdates(_0x4e33a0,_0x10b7e1){return function(_0xe1e1d7){if(_0xe1e1d7){return _0xe1e1d7[_0xb9b9('0x25')](_0x4e33a0)['then'](function(_0x9898bc){return _0x9898bc;});}return null;};}function removeEntity(_0x46525d,_0x5efa01){return function(_0x18e2ca){if(_0x18e2ca){return _0x18e2ca[_0xb9b9('0x26')]()[_0xb9b9('0x27')](function(){var _0x40b801=_0x18e2ca[_0xb9b9('0x28')]({'plain':!![]});var _0x5299fb='Tags';return db[_0xb9b9('0x29')][_0xb9b9('0x26')]({'where':{'type':_0x5299fb,'resourceId':_0x40b801['id']}})['then'](function(){return _0x18e2ca;});})[_0xb9b9('0x27')](function(){_0x46525d[_0xb9b9('0x1a')](0xcc)[_0xb9b9('0x19')]();});}};}function handleEntityNotFound(_0x21f68f,_0x125f6c){return function(_0x54bf18){if(!_0x54bf18){_0x21f68f[_0xb9b9('0x2a')](0x194);}return _0x54bf18;};}function handleError(_0x554850,_0x1e0c5e){_0x1e0c5e=_0x1e0c5e||0x1f4;return function(_0xe28f3c){logger['error'](_0xe28f3c[_0xb9b9('0x2b')]);if(_0xe28f3c[_0xb9b9('0x2c')]){delete _0xe28f3c[_0xb9b9('0x2c')];}_0x554850['status'](_0x1e0c5e)[_0xb9b9('0x2d')](_0xe28f3c);};}exports[_0xb9b9('0x2e')]=function(_0x2e1d12,_0x300453){var _0x4f002a={},_0xc40dda={},_0xdbc1f1={'count':0x0,'rows':[]};var _0x49757e=_[_0xb9b9('0x2f')](db[_0xb9b9('0x30')][_0xb9b9('0x31')],function(_0xc47845){return{'name':_0xc47845['fieldName'],'type':_0xc47845[_0xb9b9('0x32')][_0xb9b9('0x33')]};});_0xc40dda[_0xb9b9('0x34')]=_[_0xb9b9('0x2f')](_0x49757e,'name');_0xc40dda[_0xb9b9('0x35')]=_[_0xb9b9('0x36')](_0x2e1d12['query']);_0xc40dda[_0xb9b9('0x37')]=_[_0xb9b9('0x38')](_0xc40dda[_0xb9b9('0x34')],_0xc40dda[_0xb9b9('0x35')]);_0x4f002a[_0xb9b9('0x39')]=_[_0xb9b9('0x38')](_0xc40dda['model'],qs[_0xb9b9('0x3a')](_0x2e1d12[_0xb9b9('0x35')]['fields']));_0x4f002a[_0xb9b9('0x39')]=_0x4f002a[_0xb9b9('0x39')][_0xb9b9('0x3b')]?_0x4f002a['attributes']:_0xc40dda[_0xb9b9('0x34')];if(!_0x2e1d12['query'][_0xb9b9('0x3c')]('nolimit')){_0x4f002a[_0xb9b9('0x1f')]=qs[_0xb9b9('0x1f')](_0x2e1d12[_0xb9b9('0x35')][_0xb9b9('0x1f')]);_0x4f002a[_0xb9b9('0x1c')]=qs[_0xb9b9('0x1c')](_0x2e1d12[_0xb9b9('0x35')]['offset']);}_0x4f002a['order']=qs[_0xb9b9('0x3d')](_0x2e1d12[_0xb9b9('0x35')][_0xb9b9('0x3d')]);_0x4f002a['where']=qs[_0xb9b9('0x37')](_['pick'](_0x2e1d12[_0xb9b9('0x35')],_0xc40dda[_0xb9b9('0x37')]),_0x49757e);if(_0x2e1d12[_0xb9b9('0x35')][_0xb9b9('0x3e')]){_0x4f002a[_0xb9b9('0x3f')]=_[_0xb9b9('0x40')](_0x4f002a[_0xb9b9('0x3f')],{'$or':_[_0xb9b9('0x2f')](_0x49757e,function(_0x496cf){if(_0x496cf[_0xb9b9('0x32')]!=='VIRTUAL'){var _0xf484fd={};_0xf484fd[_0x496cf[_0xb9b9('0x2c')]]={'$like':'%'+_0x2e1d12[_0xb9b9('0x35')][_0xb9b9('0x3e')]+'%'};return _0xf484fd;}})});}_0x4f002a=_[_0xb9b9('0x40')]({},_0x4f002a,_0x2e1d12[_0xb9b9('0x41')]);var _0x36717c={'where':_0x4f002a[_0xb9b9('0x3f')]};return db[_0xb9b9('0x30')][_0xb9b9('0x1e')](_0x36717c)['then'](function(_0x357b9c){_0xdbc1f1[_0xb9b9('0x1e')]=_0x357b9c;if(_0x2e1d12[_0xb9b9('0x35')][_0xb9b9('0x42')]){_0x4f002a['include']=[{'all':!![]}];}return db[_0xb9b9('0x30')]['findAll'](_0x4f002a);})['then'](function(_0x3e374e){_0xdbc1f1[_0xb9b9('0x43')]=_0x3e374e;return _0xdbc1f1;})['then'](respondWithFilteredResult(_0x300453,_0x4f002a))['catch'](handleError(_0x300453,null));};exports[_0xb9b9('0x44')]=function(_0x1a5888,_0x375543){var _0x3f4388={'raw':!![],'where':{'id':_0x1a5888[_0xb9b9('0x45')]['id']}},_0x493786={};_0x493786[_0xb9b9('0x34')]=_[_0xb9b9('0x36')](db['Tag']['rawAttributes']);_0x493786[_0xb9b9('0x35')]=_['keys'](_0x1a5888[_0xb9b9('0x35')]);_0x493786[_0xb9b9('0x37')]=_[_0xb9b9('0x38')](_0x493786[_0xb9b9('0x34')],_0x493786['query']);_0x3f4388[_0xb9b9('0x39')]=_[_0xb9b9('0x38')](_0x493786[_0xb9b9('0x34')],qs[_0xb9b9('0x3a')](_0x1a5888[_0xb9b9('0x35')][_0xb9b9('0x3a')]));_0x3f4388[_0xb9b9('0x39')]=_0x3f4388[_0xb9b9('0x39')][_0xb9b9('0x3b')]?_0x3f4388[_0xb9b9('0x39')]:_0x493786[_0xb9b9('0x34')];if(_0x1a5888[_0xb9b9('0x35')]['includeAll']){_0x3f4388[_0xb9b9('0x46')]=[{'all':!![]}];}_0x3f4388=_['merge']({},_0x3f4388,_0x1a5888[_0xb9b9('0x41')]);return db[_0xb9b9('0x30')][_0xb9b9('0x47')](_0x3f4388)[_0xb9b9('0x27')](handleEntityNotFound(_0x375543,null))['then'](respondWithResult(_0x375543,null))[_0xb9b9('0x48')](handleError(_0x375543,null));};exports['create']=function(_0x2b3e22,_0x576c06){return db[_0xb9b9('0x30')][_0xb9b9('0x49')](_0x2b3e22[_0xb9b9('0x4a')],{})[_0xb9b9('0x27')](function(_0x25bfa1){var _0x1a406c=_0x2b3e22[_0xb9b9('0x4b')][_0xb9b9('0x28')]({'plain':!![]});if(!_0x1a406c)throw new Error(_0xb9b9('0x4c'));if(_0x1a406c['role']==='user'){var _0x4da7d8=_0x25bfa1[_0xb9b9('0x28')]({'plain':!![]});var _0x504c1d=_0xb9b9('0x4d');return db[_0xb9b9('0x4e')][_0xb9b9('0x47')]({'where':{'name':_0x504c1d,'userProfileId':_0x1a406c[_0xb9b9('0x4f')]},'raw':!![]})['then'](function(_0x39c444){if(_0x39c444&&_0x39c444[_0xb9b9('0x50')]===0x0){return db['UserProfileResource'][_0xb9b9('0x49')]({'name':_0x4da7d8[_0xb9b9('0x2c')],'resourceId':_0x4da7d8['id'],'type':_0x39c444['name'],'sectionId':_0x39c444['id']},{})['then'](function(){return _0x25bfa1;});}else{return _0x25bfa1;}})[_0xb9b9('0x48')](function(_0x2bbe9f){logger[_0xb9b9('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bbe9f);throw _0x2bbe9f;});}return _0x25bfa1;})[_0xb9b9('0x27')](respondWithResult(_0x576c06,0xc9))[_0xb9b9('0x48')](handleError(_0x576c06,null));};exports['update']=function(_0x17b032,_0xb0b883){if(_0x17b032[_0xb9b9('0x4a')]['id']){delete _0x17b032[_0xb9b9('0x4a')]['id'];}return db['Tag'][_0xb9b9('0x47')]({'where':{'id':_0x17b032[_0xb9b9('0x45')]['id']}})[_0xb9b9('0x27')](handleEntityNotFound(_0xb0b883,null))['then'](saveUpdates(_0x17b032[_0xb9b9('0x4a')],null))[_0xb9b9('0x27')](respondWithResult(_0xb0b883,null))[_0xb9b9('0x48')](handleError(_0xb0b883,null));};exports[_0xb9b9('0x26')]=function(_0x1e88f1,_0x49956d){return db['Tag'][_0xb9b9('0x47')]({'where':{'id':_0x1e88f1[_0xb9b9('0x45')]['id']}})[_0xb9b9('0x27')](handleEntityNotFound(_0x49956d,null))[_0xb9b9('0x27')](removeEntity(_0x49956d,null))[_0xb9b9('0x48')](handleError(_0x49956d,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(_0xa87d0f,_0x2b8af3){var _0xbd29f7=function(_0x1a7094){while(--_0x1a7094){_0xa87d0f['push'](_0xa87d0f['shift']());}};_0xbd29f7(++_0x2b8af3);}(_0xfc03,0x16f));var _0x3fc0=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xfc03[_0x1928c9];return _0x51b5fb;};'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 b75fb1e..6ed5329 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 _0x3518=['request-promise','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','api','moment'];(function(_0x438d40,_0x54e013){var _0x5fe6fd=function(_0x17647b){while(--_0x17647b){_0x438d40['push'](_0x438d40['shift']());}};_0x5fe6fd(++_0x54e013);}(_0x3518,0xbc));var _0x8351=function(_0xa4f636,_0xaca1b6){_0xa4f636=_0xa4f636-0x0;var _0x37e02a=_0x3518[_0xa4f636];return _0x37e02a;};'use strict';var _=require(_0x8351('0x0'));var util=require(_0x8351('0x1'));var logger=require('../../config/logger')(_0x8351('0x2'));var moment=require(_0x8351('0x3'));var BPromise=require('bluebird');var rp=require(_0x8351('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8351('0x5'));var config=require(_0x8351('0x6'));var attributes=require(_0x8351('0x7'));module[_0x8351('0x8')]=function(_0x155685,_0x66e994){return _0x155685[_0x8351('0x9')](_0x8351('0xa'),attributes,{'tableName':_0x8351('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d0d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./tag.attributes','Tag','tools_tags'];(function(_0x41c99a,_0x12414d){var _0x303bf9=function(_0x219646){while(--_0x219646){_0x41c99a['push'](_0x41c99a['shift']());}};_0x303bf9(++_0x12414d);}(_0x2d0d,0xa5));var _0xd2d0=function(_0x54f493,_0x385811){_0x54f493=_0x54f493-0x0;var _0x5f2b47=_0x2d0d[_0x54f493];return _0x5f2b47;};'use strict';var _=require('lodash');var util=require(_0xd2d0('0x0'));var logger=require(_0xd2d0('0x1'))(_0xd2d0('0x2'));var moment=require(_0xd2d0('0x3'));var BPromise=require(_0xd2d0('0x4'));var rp=require(_0xd2d0('0x5'));var fs=require('fs');var path=require(_0xd2d0('0x6'));var rimraf=require(_0xd2d0('0x7'));var config=require('../../config/environment');var attributes=require(_0xd2d0('0x8'));module['exports']=function(_0x39afb2,_0x1651da){return _0x39afb2['define'](_0xd2d0('0x9'),attributes,{'tableName':_0xd2d0('0xa'),'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 db94a2c..2b0175a 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 _0x81bd=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x3adc50,_0x17f801){var _0x13a3b5=function(_0x23e8b3){while(--_0x23e8b3){_0x3adc50['push'](_0x3adc50['shift']());}};_0x13a3b5(++_0x17f801);}(_0x81bd,0x7c));var _0xd81b=function(_0x47848c,_0x1c52f3){_0x47848c=_0x47848c-0x0;var _0x520324=_0x81bd[_0x47848c];return _0x520324;};'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')]('Tag,\x20%s,\x20%s',_0x562084,_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);return _0xa4cf97(_0x3420a7[_0xd81b('0x14')][_0xd81b('0x16')]);}else{logger[_0xd81b('0xe')]('Tag,\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 _0x04de=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Tag,\x20%s,\x20%s','result','catch','lodash'];(function(_0x5adee3,_0x39a628){var _0x22d2e2=function(_0x5b86db){while(--_0x5b86db){_0x5adee3['push'](_0x5adee3['shift']());}};_0x22d2e2(++_0x39a628);}(_0x04de,0x107));var _0xe04d=function(_0x1db315,_0x191499){_0x1db315=_0x1db315-0x0;var _0x57cfb8=_0x04de[_0x1db315];return _0x57cfb8;};'use strict';var _=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var moment=require(_0xe04d('0x2'));var BPromise=require(_0xe04d('0x3'));var rs=require(_0xe04d('0x4'));var fs=require('fs');var Redis=require(_0xe04d('0x5'));var db=require(_0xe04d('0x6'))['db'];var utils=require(_0xe04d('0x7'));var logger=require(_0xe04d('0x8'))(_0xe04d('0x9'));var config=require(_0xe04d('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x531688,_0x55efb5,_0x210e93){return new BPromise(function(_0x72b1ce,_0x1be121){return client[_0xe04d('0xb')](_0x531688,_0x210e93)[_0xe04d('0xc')](function(_0x2ae3c9){logger[_0xe04d('0xd')]('Tag,\x20%s,\x20%s',_0x55efb5,_0xe04d('0xe'));logger[_0xe04d('0xf')](_0xe04d('0x10'),_0x55efb5,_0xe04d('0xe'),JSON[_0xe04d('0x11')](_0x2ae3c9));if(_0x2ae3c9[_0xe04d('0x12')]){if(_0x2ae3c9[_0xe04d('0x12')][_0xe04d('0x13')]===0x1f4){logger[_0xe04d('0x12')]('Tag,\x20%s,\x20%s',_0x55efb5,_0x2ae3c9[_0xe04d('0x12')][_0xe04d('0x14')]);return _0x1be121(_0x2ae3c9[_0xe04d('0x12')][_0xe04d('0x14')]);}logger[_0xe04d('0x12')](_0xe04d('0x15'),_0x55efb5,_0x2ae3c9[_0xe04d('0x12')][_0xe04d('0x14')]);return _0x72b1ce(_0x2ae3c9[_0xe04d('0x12')][_0xe04d('0x14')]);}else{logger[_0xe04d('0xd')](_0xe04d('0x15'),_0x55efb5,'request\x20sent');_0x72b1ce(_0x2ae3c9[_0xe04d('0x16')]['message']);}})[_0xe04d('0x17')](function(_0x49c063){logger[_0xe04d('0x12')](_0xe04d('0x15'),_0x55efb5,_0x49c063);_0x1be121(_0x49c063);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 9c26f7e..aa3d967 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 97c8492..38b61aa 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 _0xb7e7=['STRING','sequelize'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xb7e7[_0x5c9307];return _0x373e29;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe706,0xa3));var _0x6e70=function(_0x2197c3,_0x310b38){_0x2197c3=_0x2197c3-0x0;var _0x120c87=_0xe706[_0x2197c3];return _0x120c87;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index e891d44..752fa29 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 _0x61ae=['capitalize','Queue','toLowerCase','Queues','addQueues','isValidChannel','Sequelize','Unknown\x20channel','ids','removeQueues','remove','addAgents','Voice','Chat','Sms','Fax','Whatsapp','sequelize','transaction','through','penalty','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','QueueId','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','all','parse','TeamVoicePrefix','VoicePrefixId','spread','removeAgents','Mail','Openchannel','Queue:remove','UserVoicePrefix','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','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','localhost','socket.io-emitter','./team.socket','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','get','Teams','UserProfileResource','end','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','params','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','getQueues','findOne','channel','ValidationError'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x61ae,0x13f));var _0xe61a=function(_0x58aff1,_0x4d8805){_0x58aff1=_0x58aff1-0x0;var _0x1c730f=_0x61ae[_0x58aff1];return _0x1c730f;};'use strict';var emlformat=require(_0xe61a('0x0'));var rimraf=require(_0xe61a('0x1'));var zipdir=require(_0xe61a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe61a('0x3'));var moment=require(_0xe61a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe61a('0x5'));var csv=require(_0xe61a('0x6'));var ejs=require(_0xe61a('0x7'));var fs=require('fs');var fs_extra=require(_0xe61a('0x8'));var _=require(_0xe61a('0x9'));var squel=require('squel');var crypto=require(_0xe61a('0xa'));var jsforce=require(_0xe61a('0xb'));var deskjs=require(_0xe61a('0xc'));var toCsv=require(_0xe61a('0x6'));var querystring=require(_0xe61a('0xd'));var Papa=require(_0xe61a('0xe'));var Redis=require('ioredis');var authService=require(_0xe61a('0xf'));var qs=require(_0xe61a('0x10'));var as=require(_0xe61a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe61a('0x12'))(_0xe61a('0x13'));var utils=require(_0xe61a('0x14'));var config=require(_0xe61a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe61a('0x16'))['db'];config[_0xe61a('0x17')]=_[_0xe61a('0x18')](config[_0xe61a('0x17')],{'host':_0xe61a('0x19'),'port':0x18eb});var socket=require(_0xe61a('0x1a'))(new Redis(config[_0xe61a('0x17')]));require(_0xe61a('0x1b'))['register'](socket);function respondWithStatusCode(_0x38f772,_0x29724e){_0x29724e=_0x29724e||0xcc;return function(_0x4b5f1c){if(_0x4b5f1c){return _0x38f772[_0xe61a('0x1c')](_0x29724e);}return _0x38f772[_0xe61a('0x1d')](_0x29724e)['end']();};}function respondWithResult(_0x12a7cb,_0x29a156){_0x29a156=_0x29a156||0xc8;return function(_0x2880eb){if(_0x2880eb){return _0x12a7cb[_0xe61a('0x1d')](_0x29a156)[_0xe61a('0x1e')](_0x2880eb);}};}function respondWithFilteredResult(_0x1e9c93,_0x19a64a){return function(_0x45550e){if(_0x45550e){var _0xde9651=typeof _0x19a64a[_0xe61a('0x1f')]===_0xe61a('0x20')&&typeof _0x19a64a['limit']===_0xe61a('0x20');var _0x4dba44=_0x45550e[_0xe61a('0x21')];var _0x27de09=_0xde9651?0x0:_0x19a64a[_0xe61a('0x1f')];var _0x3a2194=_0xde9651?_0x45550e[_0xe61a('0x21')]:_0x19a64a[_0xe61a('0x1f')]+_0x19a64a[_0xe61a('0x22')];var _0x558469;if(_0x3a2194>=_0x4dba44){_0x3a2194=_0x4dba44;_0x558469=0xc8;}else{_0x558469=0xce;}_0x1e9c93[_0xe61a('0x1d')](_0x558469);return _0x1e9c93[_0xe61a('0x23')](_0xe61a('0x24'),_0x27de09+'-'+_0x3a2194+'/'+_0x4dba44)[_0xe61a('0x1e')](_0x45550e);}return null;};}function patchUpdates(_0x4c4625){return function(_0x36abaa){try{jsonpatch[_0xe61a('0x25')](_0x36abaa,_0x4c4625,!![]);}catch(_0x876a55){return BPromise[_0xe61a('0x26')](_0x876a55);}return _0x36abaa['save']();};}function saveUpdates(_0x104f4a,_0x55d41c){return function(_0x1f552e){if(_0x1f552e){return _0x1f552e[_0xe61a('0x27')](_0x104f4a)[_0xe61a('0x28')](function(_0x467594){return _0x467594;});}return null;};}function removeEntity(_0x49ef90,_0x5a8f4e){return function(_0x4d23bf){if(_0x4d23bf){return _0x4d23bf[_0xe61a('0x29')]()[_0xe61a('0x28')](function(){var _0x249f0c=_0x4d23bf[_0xe61a('0x2a')]({'plain':!![]});var _0x3992c5=_0xe61a('0x2b');return db[_0xe61a('0x2c')][_0xe61a('0x29')]({'where':{'type':_0x3992c5,'resourceId':_0x249f0c['id']}})[_0xe61a('0x28')](function(){return _0x4d23bf;});})[_0xe61a('0x28')](function(){_0x49ef90['status'](0xcc)[_0xe61a('0x2d')]();});}};}function handleEntityNotFound(_0xe3551,_0x1dd303){return function(_0x51b0f6){if(!_0x51b0f6){_0xe3551['sendStatus'](0x194);}return _0x51b0f6;};}function handleError(_0x7cdff9,_0x3f628c){_0x3f628c=_0x3f628c||0x1f4;return function(_0x2f27df){logger[_0xe61a('0x2e')](_0x2f27df[_0xe61a('0x2f')]);if(_0x2f27df[_0xe61a('0x30')]){delete _0x2f27df[_0xe61a('0x30')];}_0x7cdff9['status'](_0x3f628c)[_0xe61a('0x31')](_0x2f27df);};}exports[_0xe61a('0x32')]=function(_0x45c9a2,_0x8d0063){var _0xb4cd58={},_0x490c0e={},_0x52a69b={'count':0x0,'rows':[]};var _0x10e32a=_[_0xe61a('0x33')](db[_0xe61a('0x34')][_0xe61a('0x35')],function(_0x2a85d8){return{'name':_0x2a85d8[_0xe61a('0x36')],'type':_0x2a85d8[_0xe61a('0x37')][_0xe61a('0x38')]};});_0x490c0e[_0xe61a('0x39')]=_[_0xe61a('0x33')](_0x10e32a,_0xe61a('0x30'));_0x490c0e[_0xe61a('0x3a')]=_[_0xe61a('0x3b')](_0x45c9a2[_0xe61a('0x3a')]);_0x490c0e['filters']=_['intersection'](_0x490c0e[_0xe61a('0x39')],_0x490c0e[_0xe61a('0x3a')]);_0xb4cd58['attributes']=_[_0xe61a('0x3c')](_0x490c0e['model'],qs[_0xe61a('0x3d')](_0x45c9a2[_0xe61a('0x3a')][_0xe61a('0x3d')]));_0xb4cd58[_0xe61a('0x3e')]=_0xb4cd58['attributes']['length']?_0xb4cd58[_0xe61a('0x3e')]:_0x490c0e[_0xe61a('0x39')];if(!_0x45c9a2['query'][_0xe61a('0x3f')](_0xe61a('0x40'))){_0xb4cd58['limit']=qs['limit'](_0x45c9a2[_0xe61a('0x3a')][_0xe61a('0x22')]);_0xb4cd58[_0xe61a('0x1f')]=qs[_0xe61a('0x1f')](_0x45c9a2[_0xe61a('0x3a')][_0xe61a('0x1f')]);}_0xb4cd58[_0xe61a('0x41')]=qs[_0xe61a('0x42')](_0x45c9a2[_0xe61a('0x3a')][_0xe61a('0x42')]);_0xb4cd58[_0xe61a('0x43')]=qs[_0xe61a('0x44')](_[_0xe61a('0x45')](_0x45c9a2['query'],_0x490c0e[_0xe61a('0x44')]),_0x10e32a);if(_0x45c9a2[_0xe61a('0x3a')][_0xe61a('0x46')]){_0xb4cd58[_0xe61a('0x43')]=_[_0xe61a('0x47')](_0xb4cd58[_0xe61a('0x43')],{'$or':_[_0xe61a('0x33')](_0x10e32a,function(_0x4effda){if(_0x4effda[_0xe61a('0x37')]!==_0xe61a('0x48')){var _0x5a7220={};_0x5a7220[_0x4effda[_0xe61a('0x30')]]={'$like':'%'+_0x45c9a2[_0xe61a('0x3a')]['filter']+'%'};return _0x5a7220;}})});}_0xb4cd58=_['merge']({},_0xb4cd58,_0x45c9a2[_0xe61a('0x49')]);var _0x3b6cb7={'where':_0xb4cd58[_0xe61a('0x43')]};return db['Team'][_0xe61a('0x21')](_0x3b6cb7)['then'](function(_0x11cec3){_0x52a69b[_0xe61a('0x21')]=_0x11cec3;if(_0x45c9a2[_0xe61a('0x3a')]['includeAll']){_0xb4cd58[_0xe61a('0x4a')]=[{'all':!![]}];}return db['Team']['findAll'](_0xb4cd58);})[_0xe61a('0x28')](function(_0x300b6e){_0x52a69b[_0xe61a('0x4b')]=_0x300b6e;return _0x52a69b;})[_0xe61a('0x28')](respondWithFilteredResult(_0x8d0063,_0xb4cd58))[_0xe61a('0x4c')](handleError(_0x8d0063,null));};exports[_0xe61a('0x4d')]=function(_0x2e0753,_0x5ad94e){var _0x33462a={'raw':![],'where':{'id':_0x2e0753[_0xe61a('0x4e')]['id']}},_0xb9361={};_0xb9361[_0xe61a('0x39')]=_[_0xe61a('0x3b')](db['Team'][_0xe61a('0x35')]);_0xb9361[_0xe61a('0x3a')]=_[_0xe61a('0x3b')](_0x2e0753[_0xe61a('0x3a')]);_0xb9361[_0xe61a('0x44')]=_[_0xe61a('0x3c')](_0xb9361['model'],_0xb9361[_0xe61a('0x3a')]);_0x33462a[_0xe61a('0x3e')]=_[_0xe61a('0x3c')](_0xb9361['model'],qs[_0xe61a('0x3d')](_0x2e0753[_0xe61a('0x3a')][_0xe61a('0x3d')]));_0x33462a['attributes']=_0x33462a['attributes'][_0xe61a('0x4f')]?_0x33462a[_0xe61a('0x3e')]:_0xb9361[_0xe61a('0x39')];if(_0x2e0753[_0xe61a('0x3a')]['includeAll']){_0x33462a[_0xe61a('0x4a')]=[{'all':!![]}];}_0x33462a=_['merge']({},_0x33462a,_0x2e0753[_0xe61a('0x49')]);return db[_0xe61a('0x34')][_0xe61a('0x50')](_0x33462a)[_0xe61a('0x28')](handleEntityNotFound(_0x5ad94e,null))[_0xe61a('0x28')](respondWithResult(_0x5ad94e,null))[_0xe61a('0x4c')](handleError(_0x5ad94e,null));};exports[_0xe61a('0x51')]=function(_0xb981e1,_0x3d81a2){return db[_0xe61a('0x34')][_0xe61a('0x51')](_0xb981e1[_0xe61a('0x52')],{})[_0xe61a('0x28')](function(_0x3531e5){var _0xece44=_0xb981e1[_0xe61a('0x53')][_0xe61a('0x2a')]({'plain':!![]});if(!_0xece44)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xece44[_0xe61a('0x54')]===_0xe61a('0x53')){var _0x260358=_0x3531e5['get']({'plain':!![]});var _0x564430=_0xe61a('0x2b');return db[_0xe61a('0x55')][_0xe61a('0x50')]({'where':{'name':_0x564430,'userProfileId':_0xece44[_0xe61a('0x56')]},'raw':!![]})[_0xe61a('0x28')](function(_0x255d40){if(_0x255d40&&_0x255d40[_0xe61a('0x57')]===0x0){return db[_0xe61a('0x2c')]['create']({'name':_0x260358[_0xe61a('0x30')],'resourceId':_0x260358['id'],'type':_0x255d40['name'],'sectionId':_0x255d40['id']},{})['then'](function(){return _0x3531e5;});}else{return _0x3531e5;}})[_0xe61a('0x4c')](function(_0x1218e9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1218e9);throw _0x1218e9;});}return _0x3531e5;})[_0xe61a('0x28')](respondWithResult(_0x3d81a2,0xc9))[_0xe61a('0x4c')](handleError(_0x3d81a2,null));};exports[_0xe61a('0x27')]=function(_0x29593c,_0x53d1a7){if(_0x29593c['body']['id']){delete _0x29593c[_0xe61a('0x52')]['id'];}return db[_0xe61a('0x34')][_0xe61a('0x50')]({'where':{'id':_0x29593c[_0xe61a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x53d1a7,null))[_0xe61a('0x28')](saveUpdates(_0x29593c[_0xe61a('0x52')],null))[_0xe61a('0x28')](respondWithResult(_0x53d1a7,null))[_0xe61a('0x4c')](handleError(_0x53d1a7,null));};exports[_0xe61a('0x29')]=function(_0x5597b2,_0x401819){return db[_0xe61a('0x34')][_0xe61a('0x50')]({'where':{'id':_0x5597b2['params']['id']}})[_0xe61a('0x28')](handleEntityNotFound(_0x401819,null))[_0xe61a('0x28')](removeEntity(_0x401819,null))[_0xe61a('0x4c')](handleError(_0x401819,null));};exports[_0xe61a('0x58')]=function(_0x3bc396,_0x5efd17,_0x1ff1ec){return db[_0xe61a('0x34')][_0xe61a('0x59')]({'where':{'id':_0x3bc396['params']['id']}})['then'](handleEntityNotFound(_0x5efd17,null))[_0xe61a('0x28')](function(_0x28f1b0){if(!_0x3bc396[_0xe61a('0x3a')]['channel']||!utils['isValidChannel'](_0x3bc396[_0xe61a('0x3a')][_0xe61a('0x5a')])){throw new db['Sequelize'][(_0xe61a('0x5b'))]('Unknown\x20channel');}var _0x6c05c8={};var _0x5d8327={};_0x5d8327[_0xe61a('0x39')]=_['keys'](db[_[_0xe61a('0x5c')](_0x3bc396[_0xe61a('0x3a')][_0xe61a('0x5a')]['toLowerCase']())+_0xe61a('0x5d')][_0xe61a('0x35')]);_0x5d8327[_0xe61a('0x3a')]=_[_0xe61a('0x3b')](_0x3bc396['query']);_0x5d8327[_0xe61a('0x44')]=_[_0xe61a('0x3c')](_0x5d8327[_0xe61a('0x39')],_0x5d8327[_0xe61a('0x3a')]);_0x6c05c8[_0xe61a('0x3e')]=_[_0xe61a('0x3c')](_0x5d8327[_0xe61a('0x39')],qs[_0xe61a('0x3d')](_0x3bc396['query'][_0xe61a('0x3d')]));_0x6c05c8[_0xe61a('0x3e')]=_0x6c05c8[_0xe61a('0x3e')]['length']?_0x6c05c8['attributes']:_0x5d8327[_0xe61a('0x39')];_0x6c05c8['limit']=qs[_0xe61a('0x22')](_0x3bc396[_0xe61a('0x3a')][_0xe61a('0x22')]);_0x6c05c8['offset']=qs['offset'](_0x3bc396['query']['offset']);_0x6c05c8['order']=qs[_0xe61a('0x42')](_0x3bc396['query'][_0xe61a('0x42')]);_0x6c05c8['where']=qs['filters'](_[_0xe61a('0x45')](_0x3bc396[_0xe61a('0x3a')],_0x5d8327[_0xe61a('0x44')]));_0x6c05c8=_[_0xe61a('0x47')]({},_0x6c05c8,_0x3bc396[_0xe61a('0x49')]);return _0x28f1b0[_0xe61a('0x2a')+_[_0xe61a('0x5c')](_0x3bc396[_0xe61a('0x3a')][_0xe61a('0x5a')][_0xe61a('0x5e')]())+_0xe61a('0x5f')](_0x6c05c8);})['then'](respondWithResult(_0x5efd17,null))['catch'](handleError(_0x5efd17,null));};exports[_0xe61a('0x60')]=function(_0x5a0862,_0x43f27e,_0x418d6d){return db[_0xe61a('0x34')]['findOne']({'where':{'id':_0x5a0862[_0xe61a('0x4e')]['id']}})[_0xe61a('0x28')](function(_0x2212cf){if(_0x2212cf){if(!_0x5a0862[_0xe61a('0x52')][_0xe61a('0x5a')]||!utils[_0xe61a('0x61')](_0x5a0862[_0xe61a('0x52')][_0xe61a('0x5a')])){throw new db[(_0xe61a('0x62'))][(_0xe61a('0x5b'))](_0xe61a('0x63'));}return _0x2212cf['add'+_[_0xe61a('0x5c')](_0x5a0862[_0xe61a('0x52')]['channel'][_0xe61a('0x5e')]())+'Queues'](_0x5a0862['body'][_0xe61a('0x64')]);}return null;})[_0xe61a('0x28')](handleEntityNotFound(_0x43f27e,null))['then'](respondWithStatusCode(_0x43f27e,null))['catch'](handleError(_0x43f27e,null));};exports[_0xe61a('0x65')]=function(_0x24c862,_0x11f0f7,_0x5026f2){return db[_0xe61a('0x34')][_0xe61a('0x59')]({'where':{'id':_0x24c862[_0xe61a('0x4e')]['id']}})[_0xe61a('0x28')](function(_0x2895cc){if(_0x2895cc){if(!_0x24c862[_0xe61a('0x3a')][_0xe61a('0x5a')]||!utils['isValidChannel'](_0x24c862[_0xe61a('0x3a')][_0xe61a('0x5a')])){throw new db[(_0xe61a('0x62'))][(_0xe61a('0x5b'))](_0xe61a('0x63'));}return _0x2895cc[_0xe61a('0x66')+_[_0xe61a('0x5c')](_0x24c862[_0xe61a('0x3a')][_0xe61a('0x5a')][_0xe61a('0x5e')]())+_0xe61a('0x5f')](_0x24c862[_0xe61a('0x3a')][_0xe61a('0x64')]);}return null;})[_0xe61a('0x28')](handleEntityNotFound(_0x11f0f7,null))['then'](respondWithStatusCode(_0x11f0f7,null))[_0xe61a('0x4c')](handleError(_0x11f0f7,null));};exports[_0xe61a('0x67')]=function(_0x202d7a,_0x27af46){return db['Team'][_0xe61a('0x50')]({'where':{'id':_0x202d7a['params']['id']}})['then'](handleEntityNotFound(_0x27af46,null))[_0xe61a('0x28')](function(_0x5939b8){if(_0x5939b8){var _0xa3200b=[_0xe61a('0x68'),_0xe61a('0x69'),'Mail',_0xe61a('0x6a'),_0xe61a('0x6b'),'Openchannel',_0xe61a('0x6c')];return db[_0xe61a('0x6d')][_0xe61a('0x6e')](function(_0x19445f){var _0x5f5152=_['map'](_0xa3200b,function(_0x5e2ac9){var _0x503ecd={'attributes':['id',_0xe61a('0x30')]};if(_0x5e2ac9===_0xe61a('0x68')){_0x503ecd[_0xe61a('0x6f')]={'attributes':[_0xe61a('0x70')]};}return _0x5939b8[_0xe61a('0x2a')+_0x5e2ac9+_0xe61a('0x5f')](_0x503ecd)['then'](function(_0x5689ad){var _0x351d5d=_['map'](_0x5689ad,function(_0x59838d){var _0xc69049=_[_0xe61a('0x33')](_0x202d7a[_0xe61a('0x52')]['ids'],function(_0x5111dd){var _0x4f427f={'where':{'UserId':_0x5111dd,[_0x5e2ac9+'QueueId']:_0x59838d['id']},'transaction':_0x19445f};if(_0x5e2ac9===_0xe61a('0x68')){_0x4f427f[_0xe61a('0x18')]={'penalty':_0x59838d[_0xe61a('0x71')][_0xe61a('0x70')]};}return db[_0xe61a('0x72')+_0x5e2ac9+_0xe61a('0x5d')][_0xe61a('0x73')](_0x4f427f)['then'](function(){socket[_0xe61a('0x74')](_0xe61a('0x53')+_0x5e2ac9+_0xe61a('0x75'),{'UserId':_0x5111dd,[_0x5e2ac9+_0xe61a('0x76')]:_0x59838d['id']});if(_0x5e2ac9!==_0xe61a('0x68'))return;return db[_0xe61a('0x72')]['findAll']({'where':{'id':_0x202d7a['body'][_0xe61a('0x64')],'online':0x1},'attributes':['id',_0xe61a('0x30'),_0xe61a('0x77'),_0xe61a('0x78'),_0xe61a('0x79')],'raw':!![]})['then'](function(_0x509dd3){var _0x547fb1=_[_0xe61a('0x33')](_0x509dd3,function(_0x4042aa){return db[_0xe61a('0x7a')][_0xe61a('0x7b')]({'membername':_0x4042aa[_0xe61a('0x30')],'UserId':_0x4042aa['id'],'queue_name':_0x59838d[_0xe61a('0x30')],'VoiceQueueId':_0x59838d['id'],'interface':_[_0xe61a('0x7c')](_0x4042aa['interface'])?util['format'](_0xe61a('0x7d'),_0x4042aa[_0xe61a('0x30')]):_0x4042aa[_0xe61a('0x79')],'paused':_0x4042aa[_0xe61a('0x78')]||![],'penalty':_0x59838d[_0xe61a('0x71')][_0xe61a('0x70')]},{'transaction':_0x19445f});});return Promise[_0xe61a('0x7e')](_0x547fb1);});});});return Promise[_0xe61a('0x7e')](_0xc69049);});return Promise[_0xe61a('0x7e')](_0x351d5d);})[_0xe61a('0x28')](function(){var _0x1e0ffa=JSON[_0xe61a('0x7f')]('['+_0x202d7a[_0xe61a('0x52')][_0xe61a('0x64')]+']');db[_0xe61a('0x80')][_0xe61a('0x59')]({'where':{'teamId':_0x202d7a['params']['id']}})[_0xe61a('0x28')](function(_0x30aed9){if(_0x30aed9){for(var _0x12bc0b=0x0;_0x12bc0b<_0x1e0ffa['length'];_0x12bc0b++){var _0x224d81=_0x1e0ffa[_0x12bc0b];db['UserVoicePrefix'][_0xe61a('0x7b')]({'UserId':_0x224d81,'VoicePrefixId':_0x30aed9[_0xe61a('0x81')]});}}});});});return Promise['all'](_0x5f5152)[_0xe61a('0x28')](function(){return _0x5939b8['addAgents'](_0x202d7a['body'][_0xe61a('0x64')],{'transaction':_0x19445f})[_0xe61a('0x82')](function(_0x3b4111){return _0x3b4111;});});});}})['then'](respondWithResult(_0x27af46,null))[_0xe61a('0x4c')](handleError(_0x27af46,null));};exports[_0xe61a('0x83')]=function(_0x1dcfd4,_0x3e5bee){return db[_0xe61a('0x34')][_0xe61a('0x50')]({'where':{'id':_0x1dcfd4[_0xe61a('0x4e')]['id']}})[_0xe61a('0x28')](handleEntityNotFound(_0x3e5bee,null))[_0xe61a('0x28')](function(_0x21ee40){if(_0x21ee40){var _0x5cc5f5=[_0xe61a('0x68'),_0xe61a('0x69'),_0xe61a('0x84'),_0xe61a('0x6a'),'Fax',_0xe61a('0x85'),_0xe61a('0x6c')];return db[_0xe61a('0x6d')][_0xe61a('0x6e')](function(_0x2a7287){var _0xdf0f44=_[_0xe61a('0x33')](_0x5cc5f5,function(_0x51f00a){var _0x1d28e5={'attributes':['id',_0xe61a('0x30')]};return _0x21ee40['get'+_0x51f00a+_0xe61a('0x5f')](_0x1d28e5)[_0xe61a('0x28')](function(_0x751e66){var _0x1a6289=_['map'](_0x751e66,function(_0x12ead0){return _0x12ead0[_0xe61a('0x83')](_0x1dcfd4[_0xe61a('0x3a')]['ids'],{'transaction':_0x2a7287})['then'](function(){var _0xa4c2c4=JSON['parse']('['+_0x1dcfd4[_0xe61a('0x3a')]['ids']+']');var _0x5d5295=_[_0xe61a('0x33')](_0xa4c2c4,function(_0x23087f){socket[_0xe61a('0x74')](_0xe61a('0x53')+_0x51f00a+_0xe61a('0x86'),{'UserId':Number(_0x23087f),[_0x51f00a+'QueueId']:_0x12ead0['id']});if(_0x51f00a!==_0xe61a('0x68'))return;return db['UserVoiceQueueRt'][_0xe61a('0x29')]({'where':{'VoiceQueueId':_0x12ead0['id'],'UserId':_0x23087f},'transaction':_0x2a7287});});return Promise[_0xe61a('0x7e')](_0x5d5295);});});return Promise[_0xe61a('0x7e')](_0x1a6289);});});return Promise[_0xe61a('0x7e')](_0xdf0f44)[_0xe61a('0x28')](function(){return _0x21ee40[_0xe61a('0x83')](_0x1dcfd4[_0xe61a('0x3a')][_0xe61a('0x64')],{'transaction':_0x2a7287});})['then'](function(){var _0x1bed1b=JSON[_0xe61a('0x7f')]('['+_0x1dcfd4[_0xe61a('0x3a')][_0xe61a('0x64')]+']');db['TeamVoicePrefix'][_0xe61a('0x59')]({'where':{'teamId':_0x1dcfd4['params']['id']}})[_0xe61a('0x28')](function(_0x17ebd3){if(_0x17ebd3){for(var _0x4a89a7=0x0;_0x4a89a7<_0x1bed1b[_0xe61a('0x4f')];_0x4a89a7++){var _0x515d09=_0x1bed1b[_0x4a89a7];db[_0xe61a('0x87')]['destroy']({'where':{'UserId':_0x515d09,'VoicePrefixId':_0x17ebd3[_0xe61a('0x81')]}});}}});});});}})[_0xe61a('0x28')](respondWithStatusCode(_0x3e5bee,null))['catch'](handleError(_0x3e5bee,null));};exports[_0xe61a('0x88')]=function(_0xa0f6f,_0x237c6e,_0x37b8fc){var _0x50f630={};var _0x4ef96a={};var _0x1a3ca2;var _0x52dea7;return db['Team'][_0xe61a('0x59')]({'where':{'id':_0xa0f6f['params']['id']}})[_0xe61a('0x28')](handleEntityNotFound(_0x237c6e,null))[_0xe61a('0x28')](function(_0x271e1f){if(_0x271e1f){_0x1a3ca2=_0x271e1f;_0x4ef96a[_0xe61a('0x39')]=_[_0xe61a('0x3b')](db[_0xe61a('0x72')][_0xe61a('0x35')]);_0x4ef96a['query']=_['keys'](_0xa0f6f[_0xe61a('0x3a')]);_0x4ef96a['filters']=_[_0xe61a('0x3c')](_0x4ef96a['model'],_0x4ef96a['query']);_0x50f630['attributes']=_[_0xe61a('0x3c')](_0x4ef96a[_0xe61a('0x39')],qs[_0xe61a('0x3d')](_0xa0f6f[_0xe61a('0x3a')][_0xe61a('0x3d')]));_0x50f630['attributes']=_0x50f630[_0xe61a('0x3e')][_0xe61a('0x4f')]?_0x50f630[_0xe61a('0x3e')]:_0x4ef96a[_0xe61a('0x39')];_0x50f630['order']=qs[_0xe61a('0x42')](_0xa0f6f[_0xe61a('0x3a')][_0xe61a('0x42')]);_0x50f630[_0xe61a('0x43')]=qs[_0xe61a('0x44')](_[_0xe61a('0x45')](_0xa0f6f['query'],_0x4ef96a[_0xe61a('0x44')]));if(_0xa0f6f['query'][_0xe61a('0x46')]){_0x50f630[_0xe61a('0x43')]=_[_0xe61a('0x47')](_0x50f630[_0xe61a('0x43')],{'$or':_[_0xe61a('0x33')](_0x50f630[_0xe61a('0x3e')],function(_0x5b5b8c){var _0x196ec8={};_0x196ec8[_0x5b5b8c]={'$like':'%'+_0xa0f6f[_0xe61a('0x3a')][_0xe61a('0x46')]+'%'};return _0x196ec8;})});}_0x50f630=_[_0xe61a('0x47')]({},_0x50f630,_0xa0f6f[_0xe61a('0x49')]);return _0x1a3ca2[_0xe61a('0x88')](_0x50f630);}})[_0xe61a('0x28')](function(_0x50a631){if(_0x50a631){_0x52dea7=_0x50a631['length'];if(!_0xa0f6f[_0xe61a('0x3a')][_0xe61a('0x3f')](_0xe61a('0x40'))){_0x50f630[_0xe61a('0x22')]=qs['limit'](_0xa0f6f[_0xe61a('0x3a')][_0xe61a('0x22')]);_0x50f630[_0xe61a('0x1f')]=qs[_0xe61a('0x1f')](_0xa0f6f['query']['offset']);}return _0x1a3ca2[_0xe61a('0x88')](_0x50f630);}})[_0xe61a('0x28')](function(_0x10a925){if(_0x10a925){return _0x10a925?{'count':_0x52dea7,'rows':_0x10a925}:null;}})[_0xe61a('0x28')](respondWithResult(_0x237c6e,null))[_0xe61a('0x4c')](handleError(_0x237c6e,null));}; \ No newline at end of file +var _0x34ff=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./team.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','Teams','UserProfileResource','then','name','index','map','Team','rawAttributes','type','model','query','intersection','fields','attributes','length','hasOwnProperty','sort','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','where','Queues','add','ids','addAgents','Sms','Fax','Openchannel','Whatsapp','sequelize','transaction','Voice','through','penalty','QueueId','findOrCreate','Queue:save','User','findAll','voicePause','interface','UserVoiceQueueRt','isNil','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','spread','removeAgents','Chat','parse','emit','Queue:remove','UserVoicePrefix','getAgents','filters','order','eml-format','rimraf','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34ff,0xe9));var _0xf34f=function(_0x2042c7,_0x603f62){_0x2042c7=_0x2042c7-0x0;var _0x103ba0=_0x34ff[_0x2042c7];return _0x103ba0;};'use strict';var emlformat=require(_0xf34f('0x0'));var rimraf=require(_0xf34f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf34f('0x2'));var rp=require(_0xf34f('0x3'));var moment=require(_0xf34f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf34f('0x5'));var csv=require(_0xf34f('0x6'));var ejs=require(_0xf34f('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf34f('0x8'));var squel=require(_0xf34f('0x9'));var crypto=require(_0xf34f('0xa'));var jsforce=require(_0xf34f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf34f('0xc'));var Papa=require(_0xf34f('0xd'));var Redis=require(_0xf34f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf34f('0xf'));var as=require(_0xf34f('0x10'));var hardwareService=require(_0xf34f('0x11'));var logger=require(_0xf34f('0x12'))('api');var utils=require(_0xf34f('0x13'));var config=require(_0xf34f('0x14'));var licenseUtil=require(_0xf34f('0x15'));var db=require(_0xf34f('0x16'))['db'];config[_0xf34f('0x17')]=_['defaults'](config[_0xf34f('0x17')],{'host':_0xf34f('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf34f('0x19'))[_0xf34f('0x1a')](socket);function respondWithStatusCode(_0x5d2706,_0x330ad8){_0x330ad8=_0x330ad8||0xcc;return function(_0x922ff){if(_0x922ff){return _0x5d2706[_0xf34f('0x1b')](_0x330ad8);}return _0x5d2706[_0xf34f('0x1c')](_0x330ad8)[_0xf34f('0x1d')]();};}function respondWithResult(_0x121658,_0x364af4){_0x364af4=_0x364af4||0xc8;return function(_0x17d891){if(_0x17d891){return _0x121658[_0xf34f('0x1c')](_0x364af4)['json'](_0x17d891);}};}function respondWithFilteredResult(_0x406f36,_0x4c35fd){return function(_0x5952e8){if(_0x5952e8){var _0x579549=typeof _0x4c35fd[_0xf34f('0x1e')]===_0xf34f('0x1f')&&typeof _0x4c35fd[_0xf34f('0x20')]===_0xf34f('0x1f');var _0xe8eb1=_0x5952e8[_0xf34f('0x21')];var _0x5a573e=_0x579549?0x0:_0x4c35fd['offset'];var _0x392b06=_0x579549?_0x5952e8[_0xf34f('0x21')]:_0x4c35fd[_0xf34f('0x1e')]+_0x4c35fd[_0xf34f('0x20')];var _0x106f6b;if(_0x392b06>=_0xe8eb1){_0x392b06=_0xe8eb1;_0x106f6b=0xc8;}else{_0x106f6b=0xce;}_0x406f36[_0xf34f('0x1c')](_0x106f6b);return _0x406f36[_0xf34f('0x22')](_0xf34f('0x23'),_0x5a573e+'-'+_0x392b06+'/'+_0xe8eb1)['json'](_0x5952e8);}return null;};}function patchUpdates(_0x1fdd06){return function(_0x19e9f4){try{jsonpatch[_0xf34f('0x24')](_0x19e9f4,_0x1fdd06,!![]);}catch(_0x27eb29){return BPromise[_0xf34f('0x25')](_0x27eb29);}return _0x19e9f4['save']();};}function saveUpdates(_0x5af805,_0x37d251){return function(_0x1431de){if(_0x1431de){return _0x1431de[_0xf34f('0x26')](_0x5af805)['then'](function(_0x40867e){return _0x40867e;});}return null;};}function removeEntity(_0x24b1b6,_0x9d1209){return function(_0x449feb){if(_0x449feb){return _0x449feb[_0xf34f('0x27')]()['then'](function(){var _0x513338=_0x449feb[_0xf34f('0x28')]({'plain':!![]});var _0x5bf283=_0xf34f('0x29');return db[_0xf34f('0x2a')][_0xf34f('0x27')]({'where':{'type':_0x5bf283,'resourceId':_0x513338['id']}})[_0xf34f('0x2b')](function(){return _0x449feb;});})[_0xf34f('0x2b')](function(){_0x24b1b6[_0xf34f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a3b56,_0x4d59f4){return function(_0x50daa1){if(!_0x50daa1){_0x1a3b56['sendStatus'](0x194);}return _0x50daa1;};}function handleError(_0x5d2cc0,_0x5739a8){_0x5739a8=_0x5739a8||0x1f4;return function(_0x5000fe){logger['error'](_0x5000fe['stack']);if(_0x5000fe[_0xf34f('0x2c')]){delete _0x5000fe[_0xf34f('0x2c')];}_0x5d2cc0[_0xf34f('0x1c')](_0x5739a8)['send'](_0x5000fe);};}exports[_0xf34f('0x2d')]=function(_0x43c954,_0x326ad4){var _0x3eb489={},_0x1ebb97={},_0x4ce6dc={'count':0x0,'rows':[]};var _0x3c974b=_[_0xf34f('0x2e')](db[_0xf34f('0x2f')][_0xf34f('0x30')],function(_0x2b8958){return{'name':_0x2b8958['fieldName'],'type':_0x2b8958[_0xf34f('0x31')]['key']};});_0x1ebb97[_0xf34f('0x32')]=_[_0xf34f('0x2e')](_0x3c974b,_0xf34f('0x2c'));_0x1ebb97[_0xf34f('0x33')]=_['keys'](_0x43c954[_0xf34f('0x33')]);_0x1ebb97['filters']=_[_0xf34f('0x34')](_0x1ebb97[_0xf34f('0x32')],_0x1ebb97[_0xf34f('0x33')]);_0x3eb489['attributes']=_[_0xf34f('0x34')](_0x1ebb97[_0xf34f('0x32')],qs[_0xf34f('0x35')](_0x43c954['query'][_0xf34f('0x35')]));_0x3eb489['attributes']=_0x3eb489[_0xf34f('0x36')][_0xf34f('0x37')]?_0x3eb489[_0xf34f('0x36')]:_0x1ebb97[_0xf34f('0x32')];if(!_0x43c954[_0xf34f('0x33')][_0xf34f('0x38')]('nolimit')){_0x3eb489[_0xf34f('0x20')]=qs['limit'](_0x43c954[_0xf34f('0x33')]['limit']);_0x3eb489['offset']=qs[_0xf34f('0x1e')](_0x43c954[_0xf34f('0x33')][_0xf34f('0x1e')]);}_0x3eb489['order']=qs[_0xf34f('0x39')](_0x43c954[_0xf34f('0x33')][_0xf34f('0x39')]);_0x3eb489['where']=qs['filters'](_[_0xf34f('0x3a')](_0x43c954['query'],_0x1ebb97['filters']),_0x3c974b);if(_0x43c954[_0xf34f('0x33')]['filter']){_0x3eb489['where']=_[_0xf34f('0x3b')](_0x3eb489['where'],{'$or':_[_0xf34f('0x2e')](_0x3c974b,function(_0x26f606){if(_0x26f606[_0xf34f('0x31')]!==_0xf34f('0x3c')){var _0x3b0b61={};_0x3b0b61[_0x26f606[_0xf34f('0x2c')]]={'$like':'%'+_0x43c954[_0xf34f('0x33')][_0xf34f('0x3d')]+'%'};return _0x3b0b61;}})});}_0x3eb489=_[_0xf34f('0x3b')]({},_0x3eb489,_0x43c954[_0xf34f('0x3e')]);var _0x5bcd9a={'where':_0x3eb489['where']};return db[_0xf34f('0x2f')][_0xf34f('0x21')](_0x5bcd9a)[_0xf34f('0x2b')](function(_0x5f1f3b){_0x4ce6dc[_0xf34f('0x21')]=_0x5f1f3b;if(_0x43c954[_0xf34f('0x33')][_0xf34f('0x3f')]){_0x3eb489[_0xf34f('0x40')]=[{'all':!![]}];}return db['Team']['findAll'](_0x3eb489);})['then'](function(_0x64621){_0x4ce6dc[_0xf34f('0x41')]=_0x64621;return _0x4ce6dc;})['then'](respondWithFilteredResult(_0x326ad4,_0x3eb489))[_0xf34f('0x42')](handleError(_0x326ad4,null));};exports[_0xf34f('0x43')]=function(_0x3215f5,_0x39aecc){var _0x295055={'raw':![],'where':{'id':_0x3215f5[_0xf34f('0x44')]['id']}},_0x2157ea={};_0x2157ea[_0xf34f('0x32')]=_[_0xf34f('0x45')](db[_0xf34f('0x2f')][_0xf34f('0x30')]);_0x2157ea[_0xf34f('0x33')]=_[_0xf34f('0x45')](_0x3215f5[_0xf34f('0x33')]);_0x2157ea['filters']=_['intersection'](_0x2157ea[_0xf34f('0x32')],_0x2157ea[_0xf34f('0x33')]);_0x295055['attributes']=_[_0xf34f('0x34')](_0x2157ea[_0xf34f('0x32')],qs[_0xf34f('0x35')](_0x3215f5[_0xf34f('0x33')][_0xf34f('0x35')]));_0x295055['attributes']=_0x295055[_0xf34f('0x36')][_0xf34f('0x37')]?_0x295055[_0xf34f('0x36')]:_0x2157ea[_0xf34f('0x32')];if(_0x3215f5[_0xf34f('0x33')][_0xf34f('0x3f')]){_0x295055[_0xf34f('0x40')]=[{'all':!![]}];}_0x295055=_[_0xf34f('0x3b')]({},_0x295055,_0x3215f5[_0xf34f('0x3e')]);return db[_0xf34f('0x2f')][_0xf34f('0x46')](_0x295055)[_0xf34f('0x2b')](handleEntityNotFound(_0x39aecc,null))[_0xf34f('0x2b')](respondWithResult(_0x39aecc,null))['catch'](handleError(_0x39aecc,null));};exports['create']=function(_0x529616,_0x5b1cb5){return db['Team'][_0xf34f('0x47')](_0x529616[_0xf34f('0x48')],{})[_0xf34f('0x2b')](function(_0x5b434a){var _0x3283a1=_0x529616['user'][_0xf34f('0x28')]({'plain':!![]});if(!_0x3283a1)throw new Error(_0xf34f('0x49'));if(_0x3283a1['role']===_0xf34f('0x4a')){var _0x40d070=_0x5b434a[_0xf34f('0x28')]({'plain':!![]});var _0xe5e3eb='Teams';return db[_0xf34f('0x4b')][_0xf34f('0x46')]({'where':{'name':_0xe5e3eb,'userProfileId':_0x3283a1['userProfileId']},'raw':!![]})[_0xf34f('0x2b')](function(_0x27bd9c){if(_0x27bd9c&&_0x27bd9c[_0xf34f('0x4c')]===0x0){return db['UserProfileResource'][_0xf34f('0x47')]({'name':_0x40d070[_0xf34f('0x2c')],'resourceId':_0x40d070['id'],'type':_0x27bd9c['name'],'sectionId':_0x27bd9c['id']},{})['then'](function(){return _0x5b434a;});}else{return _0x5b434a;}})[_0xf34f('0x42')](function(_0x34d9f0){logger[_0xf34f('0x4d')](_0xf34f('0x4e'),_0x34d9f0);throw _0x34d9f0;});}return _0x5b434a;})[_0xf34f('0x2b')](respondWithResult(_0x5b1cb5,0xc9))['catch'](handleError(_0x5b1cb5,null));};exports['update']=function(_0x13674e,_0x443bc1){if(_0x13674e[_0xf34f('0x48')]['id']){delete _0x13674e[_0xf34f('0x48')]['id'];}return db[_0xf34f('0x2f')][_0xf34f('0x46')]({'where':{'id':_0x13674e[_0xf34f('0x44')]['id']}})['then'](handleEntityNotFound(_0x443bc1,null))[_0xf34f('0x2b')](saveUpdates(_0x13674e[_0xf34f('0x48')],null))[_0xf34f('0x2b')](respondWithResult(_0x443bc1,null))[_0xf34f('0x42')](handleError(_0x443bc1,null));};exports[_0xf34f('0x27')]=function(_0x9506e6,_0x4eadcf){return db['Team'][_0xf34f('0x46')]({'where':{'id':_0x9506e6[_0xf34f('0x44')]['id']}})[_0xf34f('0x2b')](handleEntityNotFound(_0x4eadcf,null))[_0xf34f('0x2b')](removeEntity(_0x4eadcf,null))[_0xf34f('0x42')](handleError(_0x4eadcf,null));};exports[_0xf34f('0x4f')]=function(_0x262e7a,_0x129857,_0x199f2f){return db[_0xf34f('0x2f')][_0xf34f('0x50')]({'where':{'id':_0x262e7a['params']['id']}})['then'](handleEntityNotFound(_0x129857,null))[_0xf34f('0x2b')](function(_0x5b9cb2){if(!_0x262e7a[_0xf34f('0x33')][_0xf34f('0x51')]||!utils[_0xf34f('0x52')](_0x262e7a['query']['channel'])){throw new db[(_0xf34f('0x53'))][(_0xf34f('0x54'))](_0xf34f('0x55'));}var _0x54ce3f={};var _0x181bec={};_0x181bec['model']=_[_0xf34f('0x45')](db[_[_0xf34f('0x56')](_0x262e7a[_0xf34f('0x33')][_0xf34f('0x51')][_0xf34f('0x57')]())+_0xf34f('0x58')][_0xf34f('0x30')]);_0x181bec[_0xf34f('0x33')]=_[_0xf34f('0x45')](_0x262e7a[_0xf34f('0x33')]);_0x181bec['filters']=_[_0xf34f('0x34')](_0x181bec['model'],_0x181bec[_0xf34f('0x33')]);_0x54ce3f['attributes']=_[_0xf34f('0x34')](_0x181bec['model'],qs['fields'](_0x262e7a[_0xf34f('0x33')][_0xf34f('0x35')]));_0x54ce3f[_0xf34f('0x36')]=_0x54ce3f[_0xf34f('0x36')][_0xf34f('0x37')]?_0x54ce3f[_0xf34f('0x36')]:_0x181bec[_0xf34f('0x32')];_0x54ce3f[_0xf34f('0x20')]=qs[_0xf34f('0x20')](_0x262e7a[_0xf34f('0x33')][_0xf34f('0x20')]);_0x54ce3f[_0xf34f('0x1e')]=qs['offset'](_0x262e7a[_0xf34f('0x33')][_0xf34f('0x1e')]);_0x54ce3f['order']=qs[_0xf34f('0x39')](_0x262e7a['query'][_0xf34f('0x39')]);_0x54ce3f[_0xf34f('0x59')]=qs['filters'](_['pick'](_0x262e7a[_0xf34f('0x33')],_0x181bec['filters']));_0x54ce3f=_['merge']({},_0x54ce3f,_0x262e7a[_0xf34f('0x3e')]);return _0x5b9cb2['get'+_[_0xf34f('0x56')](_0x262e7a['query'][_0xf34f('0x51')][_0xf34f('0x57')]())+_0xf34f('0x5a')](_0x54ce3f);})[_0xf34f('0x2b')](respondWithResult(_0x129857,null))[_0xf34f('0x42')](handleError(_0x129857,null));};exports['addQueues']=function(_0x23c527,_0x352165,_0x561f9b){return db[_0xf34f('0x2f')]['findOne']({'where':{'id':_0x23c527[_0xf34f('0x44')]['id']}})[_0xf34f('0x2b')](function(_0x343336){if(_0x343336){if(!_0x23c527[_0xf34f('0x48')][_0xf34f('0x51')]||!utils[_0xf34f('0x52')](_0x23c527['body']['channel'])){throw new db['Sequelize'][(_0xf34f('0x54'))](_0xf34f('0x55'));}return _0x343336[_0xf34f('0x5b')+_[_0xf34f('0x56')](_0x23c527[_0xf34f('0x48')][_0xf34f('0x51')]['toLowerCase']())+_0xf34f('0x5a')](_0x23c527[_0xf34f('0x48')]['ids']);}return null;})[_0xf34f('0x2b')](handleEntityNotFound(_0x352165,null))['then'](respondWithStatusCode(_0x352165,null))[_0xf34f('0x42')](handleError(_0x352165,null));};exports['removeQueues']=function(_0xd4db0a,_0x399f26,_0x2d9319){return db[_0xf34f('0x2f')][_0xf34f('0x50')]({'where':{'id':_0xd4db0a[_0xf34f('0x44')]['id']}})['then'](function(_0x46c404){if(_0x46c404){if(!_0xd4db0a[_0xf34f('0x33')][_0xf34f('0x51')]||!utils['isValidChannel'](_0xd4db0a[_0xf34f('0x33')][_0xf34f('0x51')])){throw new db[(_0xf34f('0x53'))][(_0xf34f('0x54'))](_0xf34f('0x55'));}return _0x46c404['remove'+_['capitalize'](_0xd4db0a[_0xf34f('0x33')][_0xf34f('0x51')][_0xf34f('0x57')]())+_0xf34f('0x5a')](_0xd4db0a[_0xf34f('0x33')][_0xf34f('0x5c')]);}return null;})[_0xf34f('0x2b')](handleEntityNotFound(_0x399f26,null))[_0xf34f('0x2b')](respondWithStatusCode(_0x399f26,null))[_0xf34f('0x42')](handleError(_0x399f26,null));};exports[_0xf34f('0x5d')]=function(_0x5d3cda,_0x27291f){return db[_0xf34f('0x2f')][_0xf34f('0x46')]({'where':{'id':_0x5d3cda[_0xf34f('0x44')]['id']}})['then'](handleEntityNotFound(_0x27291f,null))[_0xf34f('0x2b')](function(_0x444e37){if(_0x444e37){var _0xe76c65=['Voice','Chat','Mail',_0xf34f('0x5e'),_0xf34f('0x5f'),_0xf34f('0x60'),_0xf34f('0x61')];return db[_0xf34f('0x62')][_0xf34f('0x63')](function(_0x308c04){var _0x2361a9=_['map'](_0xe76c65,function(_0x15a99a){var _0x2e79eb={'attributes':['id',_0xf34f('0x2c')]};if(_0x15a99a===_0xf34f('0x64')){_0x2e79eb[_0xf34f('0x65')]={'attributes':[_0xf34f('0x66')]};}return _0x444e37['get'+_0x15a99a+_0xf34f('0x5a')](_0x2e79eb)[_0xf34f('0x2b')](function(_0x48bc51){var _0x22ead5=_[_0xf34f('0x2e')](_0x48bc51,function(_0x427b30){var _0x522c66=_['map'](_0x5d3cda[_0xf34f('0x48')][_0xf34f('0x5c')],function(_0x508feb){var _0x5bfba6={'where':{'UserId':_0x508feb,[_0x15a99a+_0xf34f('0x67')]:_0x427b30['id']},'transaction':_0x308c04};if(_0x15a99a===_0xf34f('0x64')){_0x5bfba6['defaults']={'penalty':_0x427b30['TeamVoiceQueue'][_0xf34f('0x66')]};}return db['User'+_0x15a99a+_0xf34f('0x58')][_0xf34f('0x68')](_0x5bfba6)[_0xf34f('0x2b')](function(){socket['emit'](_0xf34f('0x4a')+_0x15a99a+_0xf34f('0x69'),{'UserId':_0x508feb,[_0x15a99a+_0xf34f('0x67')]:_0x427b30['id']});if(_0x15a99a!==_0xf34f('0x64'))return;return db[_0xf34f('0x6a')][_0xf34f('0x6b')]({'where':{'id':_0x5d3cda[_0xf34f('0x48')][_0xf34f('0x5c')],'online':0x1},'attributes':['id',_0xf34f('0x2c'),'online',_0xf34f('0x6c'),_0xf34f('0x6d')],'raw':!![]})[_0xf34f('0x2b')](function(_0x369576){var _0x431a7d=_[_0xf34f('0x2e')](_0x369576,function(_0x2b658f){return db[_0xf34f('0x6e')]['upsert']({'membername':_0x2b658f[_0xf34f('0x2c')],'UserId':_0x2b658f['id'],'queue_name':_0x427b30[_0xf34f('0x2c')],'VoiceQueueId':_0x427b30['id'],'interface':_[_0xf34f('0x6f')](_0x2b658f['interface'])?util['format'](_0xf34f('0x70'),_0x2b658f[_0xf34f('0x2c')]):_0x2b658f[_0xf34f('0x6d')],'paused':_0x2b658f[_0xf34f('0x6c')]||![],'penalty':_0x427b30[_0xf34f('0x71')]['penalty']},{'transaction':_0x308c04});});return Promise[_0xf34f('0x72')](_0x431a7d);});});});return Promise[_0xf34f('0x72')](_0x522c66);});return Promise[_0xf34f('0x72')](_0x22ead5);})[_0xf34f('0x2b')](function(){var _0xa36b3f=JSON['parse']('['+_0x5d3cda['body']['ids']+']');db[_0xf34f('0x73')][_0xf34f('0x50')]({'where':{'teamId':_0x5d3cda[_0xf34f('0x44')]['id']}})[_0xf34f('0x2b')](function(_0x12e9a6){if(_0x12e9a6){for(var _0x3947ef=0x0;_0x3947ef<_0xa36b3f[_0xf34f('0x37')];_0x3947ef++){var _0x3947d3=_0xa36b3f[_0x3947ef];db['UserVoicePrefix']['upsert']({'UserId':_0x3947d3,'VoicePrefixId':_0x12e9a6['VoicePrefixId']});}}});});});return Promise['all'](_0x2361a9)[_0xf34f('0x2b')](function(){return _0x444e37[_0xf34f('0x5d')](_0x5d3cda[_0xf34f('0x48')][_0xf34f('0x5c')],{'transaction':_0x308c04})[_0xf34f('0x74')](function(_0x1e91d7){return _0x1e91d7;});});});}})['then'](respondWithResult(_0x27291f,null))[_0xf34f('0x42')](handleError(_0x27291f,null));};exports[_0xf34f('0x75')]=function(_0x35cc71,_0x34dc5c){return db[_0xf34f('0x2f')][_0xf34f('0x46')]({'where':{'id':_0x35cc71['params']['id']}})[_0xf34f('0x2b')](handleEntityNotFound(_0x34dc5c,null))[_0xf34f('0x2b')](function(_0x589d39){if(_0x589d39){var _0x10ac92=['Voice',_0xf34f('0x76'),'Mail',_0xf34f('0x5e'),_0xf34f('0x5f'),'Openchannel',_0xf34f('0x61')];return db[_0xf34f('0x62')][_0xf34f('0x63')](function(_0x39024e){var _0x30ad23=_[_0xf34f('0x2e')](_0x10ac92,function(_0x290a8d){var _0x540451={'attributes':['id',_0xf34f('0x2c')]};return _0x589d39[_0xf34f('0x28')+_0x290a8d+_0xf34f('0x5a')](_0x540451)[_0xf34f('0x2b')](function(_0x1795ac){var _0x590495=_['map'](_0x1795ac,function(_0x2b542f){return _0x2b542f[_0xf34f('0x75')](_0x35cc71['query'][_0xf34f('0x5c')],{'transaction':_0x39024e})[_0xf34f('0x2b')](function(){var _0x166f22=JSON[_0xf34f('0x77')]('['+_0x35cc71[_0xf34f('0x33')][_0xf34f('0x5c')]+']');var _0x49673d=_['map'](_0x166f22,function(_0x173617){socket[_0xf34f('0x78')]('user'+_0x290a8d+_0xf34f('0x79'),{'UserId':Number(_0x173617),[_0x290a8d+'QueueId']:_0x2b542f['id']});if(_0x290a8d!==_0xf34f('0x64'))return;return db['UserVoiceQueueRt'][_0xf34f('0x27')]({'where':{'VoiceQueueId':_0x2b542f['id'],'UserId':_0x173617},'transaction':_0x39024e});});return Promise[_0xf34f('0x72')](_0x49673d);});});return Promise['all'](_0x590495);});});return Promise[_0xf34f('0x72')](_0x30ad23)['then'](function(){return _0x589d39['removeAgents'](_0x35cc71[_0xf34f('0x33')]['ids'],{'transaction':_0x39024e});})['then'](function(){var _0x1732eb=JSON[_0xf34f('0x77')]('['+_0x35cc71['query'][_0xf34f('0x5c')]+']');db['TeamVoicePrefix'][_0xf34f('0x50')]({'where':{'teamId':_0x35cc71[_0xf34f('0x44')]['id']}})['then'](function(_0x543cc2){if(_0x543cc2){for(var _0x4b1324=0x0;_0x4b1324<_0x1732eb['length'];_0x4b1324++){var _0x2228bd=_0x1732eb[_0x4b1324];db[_0xf34f('0x7a')]['destroy']({'where':{'UserId':_0x2228bd,'VoicePrefixId':_0x543cc2['VoicePrefixId']}});}}});});});}})['then'](respondWithStatusCode(_0x34dc5c,null))[_0xf34f('0x42')](handleError(_0x34dc5c,null));};exports[_0xf34f('0x7b')]=function(_0x551f93,_0x172e75,_0x455c9d){var _0x371d82={};var _0x5ed930={};var _0x463904;var _0x1d813a;return db['Team'][_0xf34f('0x50')]({'where':{'id':_0x551f93[_0xf34f('0x44')]['id']}})[_0xf34f('0x2b')](handleEntityNotFound(_0x172e75,null))[_0xf34f('0x2b')](function(_0x2732c9){if(_0x2732c9){_0x463904=_0x2732c9;_0x5ed930[_0xf34f('0x32')]=_[_0xf34f('0x45')](db['User']['rawAttributes']);_0x5ed930[_0xf34f('0x33')]=_[_0xf34f('0x45')](_0x551f93['query']);_0x5ed930[_0xf34f('0x7c')]=_[_0xf34f('0x34')](_0x5ed930[_0xf34f('0x32')],_0x5ed930[_0xf34f('0x33')]);_0x371d82[_0xf34f('0x36')]=_[_0xf34f('0x34')](_0x5ed930[_0xf34f('0x32')],qs[_0xf34f('0x35')](_0x551f93['query'][_0xf34f('0x35')]));_0x371d82[_0xf34f('0x36')]=_0x371d82[_0xf34f('0x36')][_0xf34f('0x37')]?_0x371d82[_0xf34f('0x36')]:_0x5ed930[_0xf34f('0x32')];_0x371d82[_0xf34f('0x7d')]=qs[_0xf34f('0x39')](_0x551f93['query'][_0xf34f('0x39')]);_0x371d82[_0xf34f('0x59')]=qs['filters'](_['pick'](_0x551f93[_0xf34f('0x33')],_0x5ed930[_0xf34f('0x7c')]));if(_0x551f93[_0xf34f('0x33')][_0xf34f('0x3d')]){_0x371d82['where']=_[_0xf34f('0x3b')](_0x371d82[_0xf34f('0x59')],{'$or':_[_0xf34f('0x2e')](_0x371d82[_0xf34f('0x36')],function(_0x2659e1){var _0x353de0={};_0x353de0[_0x2659e1]={'$like':'%'+_0x551f93[_0xf34f('0x33')]['filter']+'%'};return _0x353de0;})});}_0x371d82=_[_0xf34f('0x3b')]({},_0x371d82,_0x551f93[_0xf34f('0x3e')]);return _0x463904[_0xf34f('0x7b')](_0x371d82);}})[_0xf34f('0x2b')](function(_0x2fdac6){if(_0x2fdac6){_0x1d813a=_0x2fdac6['length'];if(!_0x551f93[_0xf34f('0x33')]['hasOwnProperty']('nolimit')){_0x371d82[_0xf34f('0x20')]=qs[_0xf34f('0x20')](_0x551f93[_0xf34f('0x33')][_0xf34f('0x20')]);_0x371d82[_0xf34f('0x1e')]=qs[_0xf34f('0x1e')](_0x551f93[_0xf34f('0x33')][_0xf34f('0x1e')]);}return _0x463904[_0xf34f('0x7b')](_0x371d82);}})[_0xf34f('0x2b')](function(_0x3af574){if(_0x3af574){return _0x3af574?{'count':_0x1d813a,'rows':_0x3af574}:null;}})[_0xf34f('0x2b')](respondWithResult(_0x172e75,null))[_0xf34f('0x42')](handleError(_0x172e75,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 6ca9994..43f9a00 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 _0xf548=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0xf548,0x18a));var _0x8f54=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0xf548[_0x365e54];return _0x13317a;};'use strict';var EventEmitter=require(_0x8f54('0x0'));var Team=require(_0x8f54('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x8f54('0x2')](0x0);var events={'afterCreate':_0x8f54('0x3'),'afterUpdate':'update','afterDestroy':_0x8f54('0x4')};function emitEvent(_0x11d3d3){return function(_0x9478a7,_0x3a74c7,_0x3e646c){TeamEvents[_0x8f54('0x5')](_0x11d3d3+':'+_0x9478a7['id'],_0x9478a7);TeamEvents['emit'](_0x11d3d3,_0x9478a7);_0x3e646c(null);};}for(var e in events){if(events[_0x8f54('0x6')](e)){var event=events[e];Team[_0x8f54('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x3089=['../../mysqldb','Team','update','remove','hasOwnProperty','hook','events'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3089,0x76));var _0x9308=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x3089[_0x18a79d];return _0x4f8848;};'use strict';var EventEmitter=require(_0x9308('0x0'));var Team=require(_0x9308('0x1'))['db'][_0x9308('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9308('0x3'),'afterDestroy':_0x9308('0x4')};function emitEvent(_0x5167d1){return function(_0x1b397a,_0x252954,_0x2aa92d){TeamEvents['emit'](_0x5167d1+':'+_0x1b397a['id'],_0x1b397a);TeamEvents['emit'](_0x5167d1,_0x1b397a);_0x2aa92d(null);};}for(var e in events){if(events[_0x9308('0x5')](e)){var event=events[e];Team[_0x9308('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 049fa39..a0027a1 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 _0xc213=['../../config/environment','./team.attributes','define','Team','teams','../../config/logger','api','moment','request-promise','path'];(function(_0x191131,_0x1609e7){var _0x3a464e=function(_0x44e388){while(--_0x44e388){_0x191131['push'](_0x191131['shift']());}};_0x3a464e(++_0x1609e7);}(_0xc213,0x1db));var _0x3c21=function(_0x13f8d4,_0x21405a){_0x13f8d4=_0x13f8d4-0x0;var _0x3ed02d=_0xc213[_0x13f8d4];return _0x3ed02d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3c21('0x0'))(_0x3c21('0x1'));var moment=require(_0x3c21('0x2'));var BPromise=require('bluebird');var rp=require(_0x3c21('0x3'));var fs=require('fs');var path=require(_0x3c21('0x4'));var rimraf=require('rimraf');var config=require(_0x3c21('0x5'));var attributes=require(_0x3c21('0x6'));module['exports']=function(_0xeeaf84,_0x2e7bba){return _0xeeaf84[_0x3c21('0x7')](_0x3c21('0x8'),attributes,{'tableName':_0x3c21('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88b3=['./team.attributes','exports','define','Team','teams','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x88b3,0x155));var _0x388b=function(_0x200ccd,_0x38366c){_0x200ccd=_0x200ccd-0x0;var _0x2b6b18=_0x88b3[_0x200ccd];return _0x2b6b18;};'use strict';var _=require(_0x388b('0x0'));var util=require('util');var logger=require(_0x388b('0x1'))(_0x388b('0x2'));var moment=require('moment');var BPromise=require(_0x388b('0x3'));var rp=require(_0x388b('0x4'));var fs=require('fs');var path=require(_0x388b('0x5'));var rimraf=require(_0x388b('0x6'));var config=require('../../config/environment');var attributes=require(_0x388b('0x7'));module[_0x388b('0x8')]=function(_0x556d20,_0x3e4d86){return _0x556d20[_0x388b('0x9')](_0x388b('0xa'),attributes,{'tableName':_0x388b('0xb'),'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 68d9e00..4feb87f 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 _0x000b=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','localhost','socket.io-emitter','redis','register','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x2b1198,_0x7ad49){var _0x30f5c7=function(_0x62d2d1){while(--_0x62d2d1){_0x2b1198['push'](_0x2b1198['shift']());}};_0x30f5c7(++_0x7ad49);}(_0x000b,0xf4));var _0xb000=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x000b[_0x568496];return _0x26c5c1;};'use strict';var _=require(_0xb000('0x0'));var util=require(_0xb000('0x1'));var moment=require(_0xb000('0x2'));var BPromise=require(_0xb000('0x3'));var rs=require(_0xb000('0x4'));var fs=require('fs');var Redis=require(_0xb000('0x5'));var db=require(_0xb000('0x6'))['db'];var utils=require(_0xb000('0x7'));var logger=require(_0xb000('0x8'))(_0xb000('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb000('0xa')][_0xb000('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xb000('0xc'),'port':0x18eb});var socket=require(_0xb000('0xd'))(new Redis(config[_0xb000('0xe')]));require('./team.socket')[_0xb000('0xf')](socket);function respondWithRpcPromise(_0x57aff2,_0x5ad3e5,_0x138d9f){return new BPromise(function(_0x5a2807,_0x3c0d5a){return client[_0xb000('0x10')](_0x57aff2,_0x138d9f)['then'](function(_0x33d032){logger[_0xb000('0x11')](_0xb000('0x12'),_0x5ad3e5,_0xb000('0x13'));logger[_0xb000('0x14')](_0xb000('0x15'),_0x5ad3e5,_0xb000('0x13'),JSON['stringify'](_0x33d032));if(_0x33d032[_0xb000('0x16')]){if(_0x33d032[_0xb000('0x16')][_0xb000('0x17')]===0x1f4){logger['error'](_0xb000('0x12'),_0x5ad3e5,_0x33d032[_0xb000('0x16')][_0xb000('0x18')]);return _0x3c0d5a(_0x33d032[_0xb000('0x16')]['message']);}logger[_0xb000('0x16')](_0xb000('0x12'),_0x5ad3e5,_0x33d032['error']['message']);return _0x5a2807(_0x33d032[_0xb000('0x16')]['message']);}else{logger[_0xb000('0x11')](_0xb000('0x12'),_0x5ad3e5,_0xb000('0x13'));_0x5a2807(_0x33d032[_0xb000('0x19')][_0xb000('0x18')]);}})[_0xb000('0x1a')](function(_0x419166){logger[_0xb000('0x16')](_0xb000('0x12'),_0x5ad3e5,_0x419166);_0x3c0d5a(_0x419166);});});} \ No newline at end of file +var _0xe380=['client','http','redis','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xe380,0x119));var _0x0e38=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xe380[_0x1caf6a];return _0x1bf493;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0e38('0x0'));var BPromise=require(_0x0e38('0x1'));var rs=require(_0x0e38('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e38('0x3'))['db'];var utils=require(_0x0e38('0x4'));var logger=require('../../config/logger')(_0x0e38('0x5'));var config=require('../../config/environment');var jayson=require(_0x0e38('0x6'));var client=jayson[_0x0e38('0x7')][_0x0e38('0x8')]({'port':0x232a});config[_0x0e38('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0e38('0xa'))(new Redis(config['redis']));require(_0x0e38('0xb'))['register'](socket);function respondWithRpcPromise(_0x1472cc,_0x4b860b,_0x2719cc){return new BPromise(function(_0x4f0444,_0x1a8dbb){return client[_0x0e38('0xc')](_0x1472cc,_0x2719cc)[_0x0e38('0xd')](function(_0x1a2233){logger[_0x0e38('0xe')](_0x0e38('0xf'),_0x4b860b,_0x0e38('0x10'));logger['debug'](_0x0e38('0x11'),_0x4b860b,_0x0e38('0x10'),JSON[_0x0e38('0x12')](_0x1a2233));if(_0x1a2233[_0x0e38('0x13')]){if(_0x1a2233[_0x0e38('0x13')][_0x0e38('0x14')]===0x1f4){logger[_0x0e38('0x13')](_0x0e38('0xf'),_0x4b860b,_0x1a2233[_0x0e38('0x13')]['message']);return _0x1a8dbb(_0x1a2233[_0x0e38('0x13')]['message']);}logger[_0x0e38('0x13')]('Team,\x20%s,\x20%s',_0x4b860b,_0x1a2233[_0x0e38('0x13')][_0x0e38('0x15')]);return _0x4f0444(_0x1a2233[_0x0e38('0x13')][_0x0e38('0x15')]);}else{logger['info'](_0x0e38('0xf'),_0x4b860b,_0x0e38('0x10'));_0x4f0444(_0x1a2233[_0x0e38('0x16')][_0x0e38('0x15')]);}})[_0x0e38('0x17')](function(_0x586b78){logger[_0x0e38('0x13')](_0x0e38('0xf'),_0x4b860b,_0x586b78);_0x1a8dbb(_0x586b78);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index bb741a5..9abd76a 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 _0x578c=['team:','./team.events','save','remove','removeListener','register','length'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x578c,0x158));var _0xc578=function(_0x1ad4f0,_0x1c632c){_0x1ad4f0=_0x1ad4f0-0x0;var _0x568881=_0x578c[_0x1ad4f0];return _0x568881;};'use strict';var TeamEvents=require(_0xc578('0x0'));var events=[_0xc578('0x1'),_0xc578('0x2'),'update'];function createListener(_0x2a7b52,_0x3ca6a8){return function(_0x42db00){_0x3ca6a8['emit'](_0x2a7b52,_0x42db00);};}function removeListener(_0x1dc6b3,_0x3259ef){return function(){TeamEvents[_0xc578('0x3')](_0x1dc6b3,_0x3259ef);};}exports[_0xc578('0x4')]=function(_0x178786){for(var _0x3305c9=0x0,_0x3e619d=events[_0xc578('0x5')];_0x3305c9<_0x3e619d;_0x3305c9++){var _0x198c3d=events[_0x3305c9];var _0x258f93=createListener(_0xc578('0x6')+_0x198c3d,_0x178786);TeamEvents['on'](_0x198c3d,_0x258f93);}}; \ No newline at end of file +var _0xccfe=['remove','update','emit','removeListener','register','team:','./team.events','save'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0xccfe,0x186));var _0xeccf=function(_0x3a463b,_0x5d3db7){_0x3a463b=_0x3a463b-0x0;var _0x1d90b4=_0xccfe[_0x3a463b];return _0x1d90b4;};'use strict';var TeamEvents=require(_0xeccf('0x0'));var events=[_0xeccf('0x1'),_0xeccf('0x2'),_0xeccf('0x3')];function createListener(_0x1b5663,_0x422a55){return function(_0x51fc29){_0x422a55[_0xeccf('0x4')](_0x1b5663,_0x51fc29);};}function removeListener(_0x46688a,_0x4c92e2){return function(){TeamEvents[_0xeccf('0x5')](_0x46688a,_0x4c92e2);};}exports[_0xeccf('0x6')]=function(_0x2db794){for(var _0xb0df78=0x0,_0x2aa916=events['length'];_0xb0df78<_0x2aa916;_0xb0df78++){var _0x176da2=events[_0xb0df78];var _0x55ead3=createListener(_0xeccf('0x7')+_0x176da2,_0x2db794);TeamEvents['on'](_0x176da2,_0x55ead3);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/index.js b/server/api/teamVoicePrefix/index.js index 06001dd..8365a08 100644 --- a/server/api/teamVoicePrefix/index.js +++ b/server/api/teamVoicePrefix/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(_0x480843,_0x8121e6){var _0x1d5cd9=function(_0x54ca2a){while(--_0x54ca2a){_0x480843['push'](_0x480843['shift']());}};_0x1d5cd9(++_0x8121e6);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');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(_0x1e2f8d,_0x662e3f){var _0x264535=function(_0x5426e9){while(--_0x5426e9){_0x1e2f8d['push'](_0x1e2f8d['shift']());}};_0x264535(++_0x662e3f);}(_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/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 3bfe1d4..7ffd535 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 _0x0e9f=['sequelize','exports'];(function(_0x3724ce,_0x3c29e2){var _0x393409=function(_0x22299d){while(--_0x22299d){_0x3724ce['push'](_0x3724ce['shift']());}};_0x393409(++_0x3c29e2);}(_0x0e9f,0x116));var _0xf0e9=function(_0x4a4185,_0x5df1e6){_0x4a4185=_0x4a4185-0x0;var _0x16babc=_0x0e9f[_0x4a4185];return _0x16babc;};'use strict';var Sequelize=require(_0xf0e9('0x0'));module[_0xf0e9('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3dbb=['INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3dbb,0x67));var _0xb3db=function(_0x5c3107,_0x3d1516){_0x5c3107=_0x5c3107-0x0;var _0x4773b8=_0x3dbb[_0x5c3107];return _0x4773b8;};'use strict';var Sequelize=require(_0xb3db('0x0'));module['exports']={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xb3db('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index ba6a39a..a161c87 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 _0xf8f2=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf8f2,0xc2));var _0x2f8f=function(_0x24c57b,_0x5714ba){_0x24c57b=_0x24c57b-0x0;var _0x569199=_0xf8f2[_0x24c57b];return _0x569199;};'use strict';var _=require(_0x2f8f('0x0'));var util=require(_0x2f8f('0x1'));var logger=require(_0x2f8f('0x2'))(_0x2f8f('0x3'));var moment=require('moment');var BPromise=require(_0x2f8f('0x4'));var rp=require(_0x2f8f('0x5'));var fs=require('fs');var path=require(_0x2f8f('0x6'));var rimraf=require(_0x2f8f('0x7'));var config=require(_0x2f8f('0x8'));var attributes=require('./teamVoicePrefix.attributes');module[_0x2f8f('0x9')]=function(_0x45f175,_0x3d2aad){return _0x45f175[_0x2f8f('0xa')](_0x2f8f('0xb'),attributes,{'tableName':_0x2f8f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7229=['api','moment','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','lodash','util','../../config/logger'];(function(_0x26c6a2,_0x5b9d20){var _0x47fe9d=function(_0x42780d){while(--_0x42780d){_0x26c6a2['push'](_0x26c6a2['shift']());}};_0x47fe9d(++_0x5b9d20);}(_0x7229,0x76));var _0x9722=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x7229[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x9722('0x0'));var util=require(_0x9722('0x1'));var logger=require(_0x9722('0x2'))(_0x9722('0x3'));var moment=require(_0x9722('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9722('0x5'));var rimraf=require(_0x9722('0x6'));var config=require(_0x9722('0x7'));var attributes=require(_0x9722('0x8'));module[_0x9722('0x9')]=function(_0x43e0ed,_0x2689b3){return _0x43e0ed['define'](_0x9722('0xa'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js b/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js index 11dd17c..fcc9409 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7424=['info','TeamVoicePrefix,\x20%s,\x20%s','request\x20sent','debug','TeamVoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then'];(function(_0x3e1ccc,_0x56f33f){var _0x2181a0=function(_0x89a731){while(--_0x89a731){_0x3e1ccc['push'](_0x3e1ccc['shift']());}};_0x2181a0(++_0x56f33f);}(_0x7424,0x1d9));var _0x4742=function(_0x15f395,_0x3e6bd7){_0x15f395=_0x15f395-0x0;var _0x53472c=_0x7424[_0x15f395];return _0x53472c;};'use strict';var _=require(_0x4742('0x0'));var util=require(_0x4742('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4742('0x2'));var fs=require('fs');var Redis=require(_0x4742('0x3'));var db=require(_0x4742('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4742('0x5'));var config=require(_0x4742('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4742('0x7')][_0x4742('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xde0870,_0x2396e0,_0x26234a){return new BPromise(function(_0xcfa18a,_0x46cbdd){return client[_0x4742('0x9')](_0xde0870,_0x26234a)[_0x4742('0xa')](function(_0x190e1d){logger[_0x4742('0xb')](_0x4742('0xc'),_0x2396e0,_0x4742('0xd'));logger[_0x4742('0xe')](_0x4742('0xf'),_0x2396e0,'request\x20sent',JSON[_0x4742('0x10')](_0x190e1d));if(_0x190e1d[_0x4742('0x11')]){if(_0x190e1d[_0x4742('0x11')][_0x4742('0x12')]===0x1f4){logger[_0x4742('0x11')](_0x4742('0xc'),_0x2396e0,_0x190e1d[_0x4742('0x11')]['message']);return _0x46cbdd(_0x190e1d[_0x4742('0x11')][_0x4742('0x13')]);}logger[_0x4742('0x11')](_0x4742('0xc'),_0x2396e0,_0x190e1d[_0x4742('0x11')][_0x4742('0x13')]);return _0xcfa18a(_0x190e1d['error'][_0x4742('0x13')]);}else{logger[_0x4742('0xb')](_0x4742('0xc'),_0x2396e0,'request\x20sent');_0xcfa18a(_0x190e1d[_0x4742('0x14')]['message']);}})[_0x4742('0x15')](function(_0x44b80b){logger[_0x4742('0x11')](_0x4742('0xc'),_0x2396e0,_0x44b80b);_0x46cbdd(_0x44b80b);});});} \ No newline at end of file +var _0xf976=['http','request','then','info','request\x20sent','debug','TeamVoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x492dbf,_0x362610){var _0x3a1759=function(_0x4f1739){while(--_0x4f1739){_0x492dbf['push'](_0x492dbf['shift']());}};_0x3a1759(++_0x362610);}(_0xf976,0xb6));var _0x6f97=function(_0x312ee3,_0x24fc86){_0x312ee3=_0x312ee3-0x0;var _0x38e66e=_0xf976[_0x312ee3];return _0x38e66e;};'use strict';var _=require(_0x6f97('0x0'));var util=require(_0x6f97('0x1'));var moment=require(_0x6f97('0x2'));var BPromise=require(_0x6f97('0x3'));var rs=require(_0x6f97('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f97('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f97('0x6'))(_0x6f97('0x7'));var config=require(_0x6f97('0x8'));var jayson=require(_0x6f97('0x9'));var client=jayson['client'][_0x6f97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f0c48,_0x27d139,_0x47c513){return new BPromise(function(_0x26e710,_0x1d0ffe){return client[_0x6f97('0xb')](_0x5f0c48,_0x47c513)[_0x6f97('0xc')](function(_0x2d477f){logger[_0x6f97('0xd')]('TeamVoicePrefix,\x20%s,\x20%s',_0x27d139,_0x6f97('0xe'));logger[_0x6f97('0xf')](_0x6f97('0x10'),_0x27d139,_0x6f97('0xe'),JSON[_0x6f97('0x11')](_0x2d477f));if(_0x2d477f[_0x6f97('0x12')]){if(_0x2d477f['error'][_0x6f97('0x13')]===0x1f4){logger[_0x6f97('0x12')](_0x6f97('0x14'),_0x27d139,_0x2d477f[_0x6f97('0x12')]['message']);return _0x1d0ffe(_0x2d477f[_0x6f97('0x12')]['message']);}logger[_0x6f97('0x12')](_0x6f97('0x14'),_0x27d139,_0x2d477f[_0x6f97('0x12')]['message']);return _0x26e710(_0x2d477f[_0x6f97('0x12')][_0x6f97('0x15')]);}else{logger[_0x6f97('0xd')](_0x6f97('0x14'),_0x27d139,_0x6f97('0xe'));_0x26e710(_0x2d477f[_0x6f97('0x16')][_0x6f97('0x15')]);}})[_0x6f97('0x17')](function(_0x4f6624){logger[_0x6f97('0x12')](_0x6f97('0x14'),_0x27d139,_0x4f6624);_0x1d0ffe(_0x4f6624);});});} \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 7584025..176deba 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x49136f,_0xb4b51e){var _0x2a258d=function(_0x1d486e){while(--_0x1d486e){_0x49136f['push'](_0x49136f['shift']());}};_0x2a258d(++_0xb4b51e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 82f7396..6a4a673 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 _0x236f=['sequelize'];(function(_0x2c40cb,_0xa113de){var _0x38fe03=function(_0x3a1956){while(--_0x3a1956){_0x2c40cb['push'](_0x2c40cb['shift']());}};_0x38fe03(++_0xa113de);}(_0x236f,0xb0));var _0xf236=function(_0x2790e7,_0x40bbe4){_0x2790e7=_0x2790e7-0x0;var _0x1ee42f=_0x236f[_0x2790e7];return _0x1ee42f;};'use strict';var Sequelize=require(_0xf236('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x2d05=['INTEGER'];(function(_0xb7e28a,_0x5cf4be){var _0x369be6=function(_0x3a3e69){while(--_0x3a3e69){_0xb7e28a['push'](_0xb7e28a['shift']());}};_0x369be6(++_0x5cf4be);}(_0x2d05,0x144));var _0x52d0=function(_0x3f49c8,_0x5d49bf){_0x3f49c8=_0x3f49c8-0x0;var _0x400c3=_0x2d05[_0x3f49c8];return _0x400c3;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x52d0('0x0')],'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 2b5e7b4..38c1ed1 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 _0xb6f1=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','team_has_voice_queues'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb6f1,0x118));var _0x1b6f=function(_0x21a2b3,_0x5d6564){_0x21a2b3=_0x21a2b3-0x0;var _0x4651a7=_0xb6f1[_0x21a2b3];return _0x4651a7;};'use strict';var _=require(_0x1b6f('0x0'));var util=require('util');var logger=require(_0x1b6f('0x1'))('api');var moment=require(_0x1b6f('0x2'));var BPromise=require(_0x1b6f('0x3'));var rp=require(_0x1b6f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1b6f('0x5'));var config=require('../../config/environment');var attributes=require(_0x1b6f('0x6'));module[_0x1b6f('0x7')]=function(_0xd4703b,_0x493c91){return _0xd4703b['define'](_0x1b6f('0x8'),attributes,{'tableName':_0x1b6f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x40ca=['bluebird','request-promise','rimraf','./teamVoiceQueue.attributes','define','TeamVoiceQueue','team_has_voice_queues','lodash','api','moment'];(function(_0x589f05,_0x1c5a16){var _0x3a11b4=function(_0x1ec7fb){while(--_0x1ec7fb){_0x589f05['push'](_0x589f05['shift']());}};_0x3a11b4(++_0x1c5a16);}(_0x40ca,0x1a1));var _0xa40c=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x40ca[_0x5b561d];return _0x431060;};'use strict';var _=require(_0xa40c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa40c('0x1'));var moment=require(_0xa40c('0x2'));var BPromise=require(_0xa40c('0x3'));var rp=require(_0xa40c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa40c('0x5'));var config=require('../../config/environment');var attributes=require(_0xa40c('0x6'));module['exports']=function(_0x46eff2,_0x4e1eb2){return _0x46eff2[_0xa40c('0x7')](_0xa40c('0x8'),attributes,{'tableName':_0xa40c('0x9'),'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 a15ee5f..82e85a1 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 _0x574d=['jayson/promise','client','http','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','result','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x48bd49,_0x4ff56e){var _0x3b54d2=function(_0x1da3ed){while(--_0x1da3ed){_0x48bd49['push'](_0x48bd49['shift']());}};_0x3b54d2(++_0x4ff56e);}(_0x574d,0x85));var _0xd574=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x574d[_0x36c5b0];return _0xf19333;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd574('0x0'));var BPromise=require('bluebird');var rs=require(_0xd574('0x1'));var fs=require('fs');var Redis=require(_0xd574('0x2'));var db=require(_0xd574('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd574('0x4'))(_0xd574('0x5'));var config=require(_0xd574('0x6'));var jayson=require(_0xd574('0x7'));var client=jayson[_0xd574('0x8')][_0xd574('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f84af,_0x30a6c0,_0x3bab7f){return new BPromise(function(_0x41832a,_0x55c08a){return client['request'](_0x3f84af,_0x3bab7f)[_0xd574('0xa')](function(_0x5a5ea2){logger[_0xd574('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x30a6c0,_0xd574('0xc'));logger[_0xd574('0xd')](_0xd574('0xe'),_0x30a6c0,_0xd574('0xc'),JSON['stringify'](_0x5a5ea2));if(_0x5a5ea2[_0xd574('0xf')]){if(_0x5a5ea2[_0xd574('0xf')][_0xd574('0x10')]===0x1f4){logger[_0xd574('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x30a6c0,_0x5a5ea2[_0xd574('0xf')][_0xd574('0x11')]);return _0x55c08a(_0x5a5ea2[_0xd574('0xf')][_0xd574('0x11')]);}logger[_0xd574('0xf')](_0xd574('0x12'),_0x30a6c0,_0x5a5ea2[_0xd574('0xf')]['message']);return _0x41832a(_0x5a5ea2[_0xd574('0xf')][_0xd574('0x11')]);}else{logger[_0xd574('0xb')](_0xd574('0x12'),_0x30a6c0,_0xd574('0xc'));_0x41832a(_0x5a5ea2[_0xd574('0x13')][_0xd574('0x11')]);}})['catch'](function(_0x5a5002){logger['error'](_0xd574('0x12'),_0x30a6c0,_0x5a5002);_0x55c08a(_0x5a5002);});});} \ No newline at end of file +var _0x615a=['catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0x615a,0x119));var _0xa615=function(_0x3c7d53,_0x2826d0){_0x3c7d53=_0x3c7d53-0x0;var _0x2c8387=_0x615a[_0x3c7d53];return _0x2c8387;};'use strict';var _=require(_0xa615('0x0'));var util=require('util');var moment=require(_0xa615('0x1'));var BPromise=require('bluebird');var rs=require(_0xa615('0x2'));var fs=require('fs');var Redis=require(_0xa615('0x3'));var db=require(_0xa615('0x4'))['db'];var utils=require(_0xa615('0x5'));var logger=require('../../config/logger')(_0xa615('0x6'));var config=require(_0xa615('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa615('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44afda,_0x389dd4,_0x2db48d){return new BPromise(function(_0x1e714d,_0x2eae10){return client['request'](_0x44afda,_0x2db48d)[_0xa615('0x9')](function(_0x52470e){logger[_0xa615('0xa')](_0xa615('0xb'),_0x389dd4,'request\x20sent');logger[_0xa615('0xc')](_0xa615('0xd'),_0x389dd4,_0xa615('0xe'),JSON[_0xa615('0xf')](_0x52470e));if(_0x52470e[_0xa615('0x10')]){if(_0x52470e['error']['code']===0x1f4){logger[_0xa615('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x389dd4,_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);return _0x2eae10(_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x389dd4,_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);return _0x1e714d(_0x52470e[_0xa615('0x10')][_0xa615('0x11')]);}else{logger[_0xa615('0xa')](_0xa615('0xb'),_0x389dd4,_0xa615('0xe'));_0x1e714d(_0x52470e[_0xa615('0x12')][_0xa615('0x11')]);}})[_0xa615('0x13')](function(_0xa86873){logger[_0xa615('0x10')](_0xa615('0xb'),_0x389dd4,_0xa86873);_0x2eae10(_0xa86873);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 5a7abd8..fc6a02a 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 _0x8d62=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x1ae4a9,_0x4c0ed9){var _0x54d0b0=function(_0x4fff20){while(--_0x4fff20){_0x1ae4a9['push'](_0x1ae4a9['shift']());}};_0x54d0b0(++_0x4c0ed9);}(_0x8d62,0xf8));var _0x28d6=function(_0x41ea16,_0x3e3e78){_0x41ea16=_0x41ea16-0x0;var _0x26d590=_0x8d62[_0x41ea16];return _0x26d590;};'use strict';var multer=require('multer');var util=require(_0x28d6('0x0'));var path=require(_0x28d6('0x1'));var timeout=require(_0x28d6('0x2'));var express=require(_0x28d6('0x3'));var router=express[_0x28d6('0x4')]();var fs_extra=require(_0x28d6('0x5'));var auth=require(_0x28d6('0x6'));var interaction=require(_0x28d6('0x7'));var config=require(_0x28d6('0x8'));var controller=require(_0x28d6('0x9'));router[_0x28d6('0xa')]('/',auth[_0x28d6('0xb')](),controller[_0x28d6('0xc')]);router[_0x28d6('0xa')]('/:id',auth[_0x28d6('0xb')](),controller[_0x28d6('0xd')]);router[_0x28d6('0xe')]('/',auth['isAuthenticated'](),controller[_0x28d6('0xf')]);router['put'](_0x28d6('0x10'),auth[_0x28d6('0xb')](),controller[_0x28d6('0x11')]);router[_0x28d6('0x12')](_0x28d6('0x10'),auth['isAuthenticated'](),controller[_0x28d6('0x13')]);module[_0x28d6('0x14')]=router; \ No newline at end of file +var _0x6db4=['../../config/environment','./template.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x31b556,_0x1ccc16){var _0x37f0e4=function(_0x32d512){while(--_0x32d512){_0x31b556['push'](_0x31b556['shift']());}};_0x37f0e4(++_0x1ccc16);}(_0x6db4,0x111));var _0x46db=function(_0x566511,_0x13c400){_0x566511=_0x566511-0x0;var _0x4cffe4=_0x6db4[_0x566511];return _0x4cffe4;};'use strict';var multer=require('multer');var util=require(_0x46db('0x0'));var path=require(_0x46db('0x1'));var timeout=require(_0x46db('0x2'));var express=require(_0x46db('0x3'));var router=express[_0x46db('0x4')]();var fs_extra=require(_0x46db('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x46db('0x6'));var config=require(_0x46db('0x7'));var controller=require(_0x46db('0x8'));router[_0x46db('0x9')]('/',auth[_0x46db('0xa')](),controller[_0x46db('0xb')]);router[_0x46db('0x9')]('/:id',auth[_0x46db('0xa')](),controller[_0x46db('0xc')]);router[_0x46db('0xd')]('/',auth[_0x46db('0xa')](),controller[_0x46db('0xe')]);router[_0x46db('0xf')](_0x46db('0x10'),auth[_0x46db('0xa')](),controller[_0x46db('0x11')]);router[_0x46db('0x12')](_0x46db('0x10'),auth[_0x46db('0xa')](),controller['destroy']);module[_0x46db('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0a65033..8acc660 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 _0x3122=['TEXT','sequelize','STRING'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x3122,0x11e));var _0x2312=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3122[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x2312('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2312('0x1')]},'html':{'type':Sequelize[_0x2312('0x2')]}}; \ No newline at end of file +var _0xd50b=['exports','STRING','TEXT','sequelize'];(function(_0xcf4e86,_0x4a6baa){var _0x122aec=function(_0x212622){while(--_0x212622){_0xcf4e86['push'](_0xcf4e86['shift']());}};_0x122aec(++_0x4a6baa);}(_0xd50b,0xeb));var _0xbd50=function(_0x261832,_0x5a24e6){_0x261832=_0x261832-0x0;var _0x186143=_0xd50b[_0x261832];return _0x186143;};'use strict';var Sequelize=require(_0xbd50('0x0'));module[_0xbd50('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbd50('0x2')]},'html':{'type':Sequelize[_0xbd50('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index f62b422..13b846e 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 _0x1f3a=['status','offset','undefined','limit','set','Content-Range','json','apply','reject','update','then','destroy','Templates','UserProfileResource','error','name','index','map','Template','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x556344,_0x8b94e8){var _0x93fc35=function(_0x2521f8){while(--_0x2521f8){_0x556344['push'](_0x556344['shift']());}};_0x93fc35(++_0x8b94e8);}(_0x1f3a,0xe1));var _0xa1f3=function(_0x329ca4,_0x5e0cac){_0x329ca4=_0x329ca4-0x0;var _0x5e393a=_0x1f3a[_0x329ca4];return _0x5e393a;};'use strict';var emlformat=require(_0xa1f3('0x0'));var rimraf=require(_0xa1f3('0x1'));var zipdir=require(_0xa1f3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1f3('0x3'));var moment=require(_0xa1f3('0x4'));var BPromise=require(_0xa1f3('0x5'));var Mustache=require('mustache');var util=require(_0xa1f3('0x6'));var path=require('path');var sox=require(_0xa1f3('0x7'));var csv=require(_0xa1f3('0x8'));var ejs=require(_0xa1f3('0x9'));var fs=require('fs');var fs_extra=require(_0xa1f3('0xa'));var _=require(_0xa1f3('0xb'));var squel=require(_0xa1f3('0xc'));var crypto=require(_0xa1f3('0xd'));var jsforce=require(_0xa1f3('0xe'));var deskjs=require(_0xa1f3('0xf'));var toCsv=require(_0xa1f3('0x8'));var querystring=require(_0xa1f3('0x10'));var Papa=require(_0xa1f3('0x11'));var Redis=require(_0xa1f3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa1f3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1f3('0x14'));var logger=require(_0xa1f3('0x15'))(_0xa1f3('0x16'));var utils=require(_0xa1f3('0x17'));var config=require(_0xa1f3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa1f3('0x19'))['db'];function respondWithStatusCode(_0x3b79a7,_0x3f515e){_0x3f515e=_0x3f515e||0xcc;return function(_0x344fb8){if(_0x344fb8){return _0x3b79a7[_0xa1f3('0x1a')](_0x3f515e);}return _0x3b79a7[_0xa1f3('0x1b')](_0x3f515e)['end']();};}function respondWithResult(_0x3ae3ee,_0x3a00a3){_0x3a00a3=_0x3a00a3||0xc8;return function(_0x264c23){if(_0x264c23){return _0x3ae3ee[_0xa1f3('0x1b')](_0x3a00a3)['json'](_0x264c23);}};}function respondWithFilteredResult(_0xde1fa,_0x18314a){return function(_0x3e4e4b){if(_0x3e4e4b){var _0x59aa60=typeof _0x18314a[_0xa1f3('0x1c')]===_0xa1f3('0x1d')&&typeof _0x18314a['limit']==='undefined';var _0x4c02a4=_0x3e4e4b['count'];var _0x6570e5=_0x59aa60?0x0:_0x18314a[_0xa1f3('0x1c')];var _0x57056d=_0x59aa60?_0x3e4e4b['count']:_0x18314a[_0xa1f3('0x1c')]+_0x18314a[_0xa1f3('0x1e')];var _0x412fe5;if(_0x57056d>=_0x4c02a4){_0x57056d=_0x4c02a4;_0x412fe5=0xc8;}else{_0x412fe5=0xce;}_0xde1fa['status'](_0x412fe5);return _0xde1fa[_0xa1f3('0x1f')](_0xa1f3('0x20'),_0x6570e5+'-'+_0x57056d+'/'+_0x4c02a4)[_0xa1f3('0x21')](_0x3e4e4b);}return null;};}function patchUpdates(_0xb27612){return function(_0x193c71){try{jsonpatch[_0xa1f3('0x22')](_0x193c71,_0xb27612,!![]);}catch(_0x365673){return BPromise[_0xa1f3('0x23')](_0x365673);}return _0x193c71['save']();};}function saveUpdates(_0x42e14c,_0x4838c3){return function(_0x43c290){if(_0x43c290){return _0x43c290[_0xa1f3('0x24')](_0x42e14c)[_0xa1f3('0x25')](function(_0x16844e){return _0x16844e;});}return null;};}function removeEntity(_0x2b2a60,_0x2ae928){return function(_0x4955dc){if(_0x4955dc){return _0x4955dc[_0xa1f3('0x26')]()[_0xa1f3('0x25')](function(){var _0x79c545=_0x4955dc['get']({'plain':!![]});var _0x2002a5=_0xa1f3('0x27');return db[_0xa1f3('0x28')][_0xa1f3('0x26')]({'where':{'type':_0x2002a5,'resourceId':_0x79c545['id']}})[_0xa1f3('0x25')](function(){return _0x4955dc;});})[_0xa1f3('0x25')](function(){_0x2b2a60[_0xa1f3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2da9ef,_0x3ca269){return function(_0x4f3758){if(!_0x4f3758){_0x2da9ef[_0xa1f3('0x1a')](0x194);}return _0x4f3758;};}function handleError(_0x3d2508,_0x1512ce){_0x1512ce=_0x1512ce||0x1f4;return function(_0x22709c){logger[_0xa1f3('0x29')](_0x22709c['stack']);if(_0x22709c[_0xa1f3('0x2a')]){delete _0x22709c[_0xa1f3('0x2a')];}_0x3d2508[_0xa1f3('0x1b')](_0x1512ce)['send'](_0x22709c);};}exports[_0xa1f3('0x2b')]=function(_0x295bd9,_0x184fb2){var _0x1684a5={},_0x38b945={},_0x304d54={'count':0x0,'rows':[]};var _0x425255=_[_0xa1f3('0x2c')](db[_0xa1f3('0x2d')][_0xa1f3('0x2e')],function(_0x41b9ba){return{'name':_0x41b9ba[_0xa1f3('0x2f')],'type':_0x41b9ba[_0xa1f3('0x30')][_0xa1f3('0x31')]};});_0x38b945[_0xa1f3('0x32')]=_[_0xa1f3('0x2c')](_0x425255,'name');_0x38b945['query']=_[_0xa1f3('0x33')](_0x295bd9[_0xa1f3('0x34')]);_0x38b945[_0xa1f3('0x35')]=_[_0xa1f3('0x36')](_0x38b945[_0xa1f3('0x32')],_0x38b945[_0xa1f3('0x34')]);_0x1684a5[_0xa1f3('0x37')]=_[_0xa1f3('0x36')](_0x38b945[_0xa1f3('0x32')],qs[_0xa1f3('0x38')](_0x295bd9[_0xa1f3('0x34')][_0xa1f3('0x38')]));_0x1684a5[_0xa1f3('0x37')]=_0x1684a5[_0xa1f3('0x37')][_0xa1f3('0x39')]?_0x1684a5[_0xa1f3('0x37')]:_0x38b945[_0xa1f3('0x32')];if(!_0x295bd9[_0xa1f3('0x34')][_0xa1f3('0x3a')]('nolimit')){_0x1684a5['limit']=qs['limit'](_0x295bd9[_0xa1f3('0x34')][_0xa1f3('0x1e')]);_0x1684a5[_0xa1f3('0x1c')]=qs['offset'](_0x295bd9[_0xa1f3('0x34')]['offset']);}_0x1684a5[_0xa1f3('0x3b')]=qs[_0xa1f3('0x3c')](_0x295bd9[_0xa1f3('0x34')][_0xa1f3('0x3c')]);_0x1684a5[_0xa1f3('0x3d')]=qs[_0xa1f3('0x35')](_[_0xa1f3('0x3e')](_0x295bd9[_0xa1f3('0x34')],_0x38b945['filters']),_0x425255);if(_0x295bd9[_0xa1f3('0x34')][_0xa1f3('0x3f')]){_0x1684a5[_0xa1f3('0x3d')]=_[_0xa1f3('0x40')](_0x1684a5[_0xa1f3('0x3d')],{'$or':_[_0xa1f3('0x2c')](_0x425255,function(_0x255d18){if(_0x255d18[_0xa1f3('0x30')]!==_0xa1f3('0x41')){var _0x4d7021={};_0x4d7021[_0x255d18['name']]={'$like':'%'+_0x295bd9['query']['filter']+'%'};return _0x4d7021;}})});}_0x1684a5=_['merge']({},_0x1684a5,_0x295bd9[_0xa1f3('0x42')]);var _0x114b45={'where':_0x1684a5[_0xa1f3('0x3d')]};return db[_0xa1f3('0x2d')][_0xa1f3('0x43')](_0x114b45)[_0xa1f3('0x25')](function(_0x5b984a){_0x304d54[_0xa1f3('0x43')]=_0x5b984a;if(_0x295bd9[_0xa1f3('0x34')][_0xa1f3('0x44')]){_0x1684a5[_0xa1f3('0x45')]=[{'all':!![]}];}return db[_0xa1f3('0x2d')][_0xa1f3('0x46')](_0x1684a5);})[_0xa1f3('0x25')](function(_0xc4202e){_0x304d54['rows']=_0xc4202e;return _0x304d54;})[_0xa1f3('0x25')](respondWithFilteredResult(_0x184fb2,_0x1684a5))['catch'](handleError(_0x184fb2,null));};exports[_0xa1f3('0x47')]=function(_0x18abf7,_0x103a48){var _0x1bf3ce={'raw':!![],'where':{'id':_0x18abf7['params']['id']}},_0x456f15={};_0x456f15['model']=_[_0xa1f3('0x33')](db['Template'][_0xa1f3('0x2e')]);_0x456f15[_0xa1f3('0x34')]=_['keys'](_0x18abf7[_0xa1f3('0x34')]);_0x456f15[_0xa1f3('0x35')]=_[_0xa1f3('0x36')](_0x456f15['model'],_0x456f15[_0xa1f3('0x34')]);_0x1bf3ce[_0xa1f3('0x37')]=_[_0xa1f3('0x36')](_0x456f15['model'],qs[_0xa1f3('0x38')](_0x18abf7['query'][_0xa1f3('0x38')]));_0x1bf3ce[_0xa1f3('0x37')]=_0x1bf3ce[_0xa1f3('0x37')][_0xa1f3('0x39')]?_0x1bf3ce[_0xa1f3('0x37')]:_0x456f15[_0xa1f3('0x32')];if(_0x18abf7[_0xa1f3('0x34')][_0xa1f3('0x44')]){_0x1bf3ce[_0xa1f3('0x45')]=[{'all':!![]}];}_0x1bf3ce=_[_0xa1f3('0x40')]({},_0x1bf3ce,_0x18abf7[_0xa1f3('0x42')]);return db[_0xa1f3('0x2d')]['find'](_0x1bf3ce)[_0xa1f3('0x25')](handleEntityNotFound(_0x103a48,null))[_0xa1f3('0x25')](respondWithResult(_0x103a48,null))[_0xa1f3('0x48')](handleError(_0x103a48,null));};exports[_0xa1f3('0x49')]=function(_0x496666,_0x25d39f){return db[_0xa1f3('0x2d')][_0xa1f3('0x49')](_0x496666[_0xa1f3('0x4a')],{})[_0xa1f3('0x25')](function(_0x2ed641){var _0x1a5ac8=_0x496666[_0xa1f3('0x4b')][_0xa1f3('0x4c')]({'plain':!![]});if(!_0x1a5ac8)throw new Error(_0xa1f3('0x4d'));if(_0x1a5ac8[_0xa1f3('0x4e')]===_0xa1f3('0x4b')){var _0x135df7=_0x2ed641['get']({'plain':!![]});var _0x511010=_0xa1f3('0x27');return db[_0xa1f3('0x4f')][_0xa1f3('0x50')]({'where':{'name':_0x511010,'userProfileId':_0x1a5ac8['userProfileId']},'raw':!![]})['then'](function(_0x5387fa){if(_0x5387fa&&_0x5387fa[_0xa1f3('0x51')]===0x0){return db[_0xa1f3('0x28')]['create']({'name':_0x135df7[_0xa1f3('0x2a')],'resourceId':_0x135df7['id'],'type':_0x5387fa[_0xa1f3('0x2a')],'sectionId':_0x5387fa['id']},{})[_0xa1f3('0x25')](function(){return _0x2ed641;});}else{return _0x2ed641;}})[_0xa1f3('0x48')](function(_0x2959cc){logger[_0xa1f3('0x29')](_0xa1f3('0x52'),_0x2959cc);throw _0x2959cc;});}return _0x2ed641;})[_0xa1f3('0x25')](respondWithResult(_0x25d39f,0xc9))['catch'](handleError(_0x25d39f,null));};exports['update']=function(_0x5a0627,_0x315f13){if(_0x5a0627[_0xa1f3('0x4a')]['id']){delete _0x5a0627[_0xa1f3('0x4a')]['id'];}return db['Template'][_0xa1f3('0x50')]({'where':{'id':_0x5a0627[_0xa1f3('0x53')]['id']}})[_0xa1f3('0x25')](handleEntityNotFound(_0x315f13,null))['then'](saveUpdates(_0x5a0627['body'],null))[_0xa1f3('0x25')](respondWithResult(_0x315f13,null))[_0xa1f3('0x48')](handleError(_0x315f13,null));};exports[_0xa1f3('0x26')]=function(_0xe18b06,_0x1dc0f0){return db['Template'][_0xa1f3('0x50')]({'where':{'id':_0xe18b06[_0xa1f3('0x53')]['id']}})[_0xa1f3('0x25')](handleEntityNotFound(_0x1dc0f0,null))[_0xa1f3('0x25')](removeEntity(_0x1dc0f0,null))[_0xa1f3('0x48')](handleError(_0x1dc0f0,null));}; \ No newline at end of file +var _0x4dc0=['keys','rawAttributes','length','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','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','limit','count','Content-Range','apply','reject','save','destroy','then','get','Templates','UserProfileResource','stack','name','index','map','Template','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','includeAll','include','catch','params'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4dc0,0x101));var _0x04dc=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4dc0[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04dc('0x0'));var zipdir=require(_0x04dc('0x1'));var jsonpatch=require(_0x04dc('0x2'));var rp=require(_0x04dc('0x3'));var moment=require(_0x04dc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x04dc('0x5'));var util=require(_0x04dc('0x6'));var path=require(_0x04dc('0x7'));var sox=require(_0x04dc('0x8'));var csv=require(_0x04dc('0x9'));var ejs=require(_0x04dc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x04dc('0xb'));var squel=require(_0x04dc('0xc'));var crypto=require(_0x04dc('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x04dc('0x9'));var querystring=require('querystring');var Papa=require(_0x04dc('0xe'));var Redis=require(_0x04dc('0xf'));var authService=require(_0x04dc('0x10'));var qs=require(_0x04dc('0x11'));var as=require(_0x04dc('0x12'));var hardwareService=require(_0x04dc('0x13'));var logger=require(_0x04dc('0x14'))(_0x04dc('0x15'));var utils=require(_0x04dc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x04dc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc3173,_0x5157bf){_0x5157bf=_0x5157bf||0xcc;return function(_0x4e3458){if(_0x4e3458){return _0xc3173[_0x04dc('0x18')](_0x5157bf);}return _0xc3173[_0x04dc('0x19')](_0x5157bf)[_0x04dc('0x1a')]();};}function respondWithResult(_0x48f4bb,_0xfc78a2){_0xfc78a2=_0xfc78a2||0xc8;return function(_0x288734){if(_0x288734){return _0x48f4bb['status'](_0xfc78a2)[_0x04dc('0x1b')](_0x288734);}};}function respondWithFilteredResult(_0x3a86d4,_0x48b288){return function(_0x4e1eef){if(_0x4e1eef){var _0x28395c=typeof _0x48b288[_0x04dc('0x1c')]===_0x04dc('0x1d')&&typeof _0x48b288[_0x04dc('0x1e')]===_0x04dc('0x1d');var _0x1f6718=_0x4e1eef['count'];var _0x15b2b8=_0x28395c?0x0:_0x48b288[_0x04dc('0x1c')];var _0x3a1893=_0x28395c?_0x4e1eef[_0x04dc('0x1f')]:_0x48b288['offset']+_0x48b288[_0x04dc('0x1e')];var _0xdaaa43;if(_0x3a1893>=_0x1f6718){_0x3a1893=_0x1f6718;_0xdaaa43=0xc8;}else{_0xdaaa43=0xce;}_0x3a86d4['status'](_0xdaaa43);return _0x3a86d4['set'](_0x04dc('0x20'),_0x15b2b8+'-'+_0x3a1893+'/'+_0x1f6718)[_0x04dc('0x1b')](_0x4e1eef);}return null;};}function patchUpdates(_0x579726){return function(_0x531512){try{jsonpatch[_0x04dc('0x21')](_0x531512,_0x579726,!![]);}catch(_0x4fd2e6){return BPromise[_0x04dc('0x22')](_0x4fd2e6);}return _0x531512[_0x04dc('0x23')]();};}function saveUpdates(_0x4af93d,_0x270b70){return function(_0x238754){if(_0x238754){return _0x238754['update'](_0x4af93d)['then'](function(_0x11886f){return _0x11886f;});}return null;};}function removeEntity(_0x2226ab,_0x35a639){return function(_0x34b117){if(_0x34b117){return _0x34b117[_0x04dc('0x24')]()[_0x04dc('0x25')](function(){var _0x52c487=_0x34b117[_0x04dc('0x26')]({'plain':!![]});var _0x4bf456=_0x04dc('0x27');return db[_0x04dc('0x28')][_0x04dc('0x24')]({'where':{'type':_0x4bf456,'resourceId':_0x52c487['id']}})['then'](function(){return _0x34b117;});})[_0x04dc('0x25')](function(){_0x2226ab[_0x04dc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29b704,_0x29f65d){return function(_0x18be82){if(!_0x18be82){_0x29b704[_0x04dc('0x18')](0x194);}return _0x18be82;};}function handleError(_0x36c895,_0x2ce8fe){_0x2ce8fe=_0x2ce8fe||0x1f4;return function(_0x4e5ead){logger['error'](_0x4e5ead[_0x04dc('0x29')]);if(_0x4e5ead[_0x04dc('0x2a')]){delete _0x4e5ead[_0x04dc('0x2a')];}_0x36c895[_0x04dc('0x19')](_0x2ce8fe)['send'](_0x4e5ead);};}exports[_0x04dc('0x2b')]=function(_0x105ad7,_0x2a8f9e){var _0x323943={},_0x7b2549={},_0x4698a1={'count':0x0,'rows':[]};var _0x475e9c=_[_0x04dc('0x2c')](db[_0x04dc('0x2d')]['rawAttributes'],function(_0x4c8235){return{'name':_0x4c8235[_0x04dc('0x2e')],'type':_0x4c8235['type'][_0x04dc('0x2f')]};});_0x7b2549['model']=_[_0x04dc('0x2c')](_0x475e9c,_0x04dc('0x2a'));_0x7b2549[_0x04dc('0x30')]=_['keys'](_0x105ad7[_0x04dc('0x30')]);_0x7b2549[_0x04dc('0x31')]=_[_0x04dc('0x32')](_0x7b2549[_0x04dc('0x33')],_0x7b2549[_0x04dc('0x30')]);_0x323943[_0x04dc('0x34')]=_[_0x04dc('0x32')](_0x7b2549[_0x04dc('0x33')],qs[_0x04dc('0x35')](_0x105ad7[_0x04dc('0x30')][_0x04dc('0x35')]));_0x323943[_0x04dc('0x34')]=_0x323943['attributes']['length']?_0x323943[_0x04dc('0x34')]:_0x7b2549[_0x04dc('0x33')];if(!_0x105ad7['query'][_0x04dc('0x36')](_0x04dc('0x37'))){_0x323943[_0x04dc('0x1e')]=qs[_0x04dc('0x1e')](_0x105ad7['query'][_0x04dc('0x1e')]);_0x323943[_0x04dc('0x1c')]=qs['offset'](_0x105ad7[_0x04dc('0x30')][_0x04dc('0x1c')]);}_0x323943[_0x04dc('0x38')]=qs[_0x04dc('0x39')](_0x105ad7['query']['sort']);_0x323943['where']=qs[_0x04dc('0x31')](_[_0x04dc('0x3a')](_0x105ad7[_0x04dc('0x30')],_0x7b2549['filters']),_0x475e9c);if(_0x105ad7[_0x04dc('0x30')][_0x04dc('0x3b')]){_0x323943['where']=_[_0x04dc('0x3c')](_0x323943[_0x04dc('0x3d')],{'$or':_[_0x04dc('0x2c')](_0x475e9c,function(_0x7468cc){if(_0x7468cc[_0x04dc('0x3e')]!=='VIRTUAL'){var _0x59a948={};_0x59a948[_0x7468cc['name']]={'$like':'%'+_0x105ad7[_0x04dc('0x30')][_0x04dc('0x3b')]+'%'};return _0x59a948;}})});}_0x323943=_['merge']({},_0x323943,_0x105ad7['options']);var _0x22c4f4={'where':_0x323943[_0x04dc('0x3d')]};return db[_0x04dc('0x2d')][_0x04dc('0x1f')](_0x22c4f4)[_0x04dc('0x25')](function(_0x510d85){_0x4698a1[_0x04dc('0x1f')]=_0x510d85;if(_0x105ad7['query'][_0x04dc('0x3f')]){_0x323943[_0x04dc('0x40')]=[{'all':!![]}];}return db[_0x04dc('0x2d')]['findAll'](_0x323943);})[_0x04dc('0x25')](function(_0x29fd39){_0x4698a1['rows']=_0x29fd39;return _0x4698a1;})['then'](respondWithFilteredResult(_0x2a8f9e,_0x323943))[_0x04dc('0x41')](handleError(_0x2a8f9e,null));};exports['show']=function(_0x19d9e1,_0x49d95d){var _0x25f21f={'raw':!![],'where':{'id':_0x19d9e1[_0x04dc('0x42')]['id']}},_0x427e88={};_0x427e88['model']=_[_0x04dc('0x43')](db[_0x04dc('0x2d')][_0x04dc('0x44')]);_0x427e88[_0x04dc('0x30')]=_['keys'](_0x19d9e1[_0x04dc('0x30')]);_0x427e88[_0x04dc('0x31')]=_[_0x04dc('0x32')](_0x427e88[_0x04dc('0x33')],_0x427e88['query']);_0x25f21f['attributes']=_[_0x04dc('0x32')](_0x427e88[_0x04dc('0x33')],qs[_0x04dc('0x35')](_0x19d9e1[_0x04dc('0x30')][_0x04dc('0x35')]));_0x25f21f[_0x04dc('0x34')]=_0x25f21f['attributes'][_0x04dc('0x45')]?_0x25f21f[_0x04dc('0x34')]:_0x427e88[_0x04dc('0x33')];if(_0x19d9e1[_0x04dc('0x30')]['includeAll']){_0x25f21f[_0x04dc('0x40')]=[{'all':!![]}];}_0x25f21f=_[_0x04dc('0x3c')]({},_0x25f21f,_0x19d9e1[_0x04dc('0x46')]);return db[_0x04dc('0x2d')][_0x04dc('0x47')](_0x25f21f)[_0x04dc('0x25')](handleEntityNotFound(_0x49d95d,null))['then'](respondWithResult(_0x49d95d,null))[_0x04dc('0x41')](handleError(_0x49d95d,null));};exports['create']=function(_0x380bd6,_0x307909){return db[_0x04dc('0x2d')][_0x04dc('0x48')](_0x380bd6['body'],{})[_0x04dc('0x25')](function(_0x349bb9){var _0x4a76b7=_0x380bd6['user'][_0x04dc('0x26')]({'plain':!![]});if(!_0x4a76b7)throw new Error(_0x04dc('0x49'));if(_0x4a76b7['role']===_0x04dc('0x4a')){var _0xbb0038=_0x349bb9[_0x04dc('0x26')]({'plain':!![]});var _0x2ae737=_0x04dc('0x27');return db[_0x04dc('0x4b')]['find']({'where':{'name':_0x2ae737,'userProfileId':_0x4a76b7[_0x04dc('0x4c')]},'raw':!![]})[_0x04dc('0x25')](function(_0x14f7f6){if(_0x14f7f6&&_0x14f7f6['autoAssociation']===0x0){return db[_0x04dc('0x28')][_0x04dc('0x48')]({'name':_0xbb0038[_0x04dc('0x2a')],'resourceId':_0xbb0038['id'],'type':_0x14f7f6[_0x04dc('0x2a')],'sectionId':_0x14f7f6['id']},{})[_0x04dc('0x25')](function(){return _0x349bb9;});}else{return _0x349bb9;}})[_0x04dc('0x41')](function(_0x6da642){logger[_0x04dc('0x4d')](_0x04dc('0x4e'),_0x6da642);throw _0x6da642;});}return _0x349bb9;})[_0x04dc('0x25')](respondWithResult(_0x307909,0xc9))[_0x04dc('0x41')](handleError(_0x307909,null));};exports[_0x04dc('0x4f')]=function(_0x5e30e1,_0x50e9c1){if(_0x5e30e1[_0x04dc('0x50')]['id']){delete _0x5e30e1['body']['id'];}return db[_0x04dc('0x2d')]['find']({'where':{'id':_0x5e30e1[_0x04dc('0x42')]['id']}})[_0x04dc('0x25')](handleEntityNotFound(_0x50e9c1,null))[_0x04dc('0x25')](saveUpdates(_0x5e30e1[_0x04dc('0x50')],null))[_0x04dc('0x25')](respondWithResult(_0x50e9c1,null))['catch'](handleError(_0x50e9c1,null));};exports['destroy']=function(_0x3b6e66,_0x49487d){return db['Template'][_0x04dc('0x47')]({'where':{'id':_0x3b6e66['params']['id']}})['then'](handleEntityNotFound(_0x49487d,null))[_0x04dc('0x25')](removeEntity(_0x49487d,null))[_0x04dc('0x41')](handleError(_0x49487d,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 63e975e..61f460f 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 _0x3e4c=['util','../../config/logger','rimraf','../../config/environment','./template.attributes','exports','Template','tools_templates'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e4c,0xc0));var _0xc3e4=function(_0x306fdf,_0x36f953){_0x306fdf=_0x306fdf-0x0;var _0x4f1227=_0x3e4c[_0x306fdf];return _0x4f1227;};'use strict';var _=require('lodash');var util=require(_0xc3e4('0x0'));var logger=require(_0xc3e4('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc3e4('0x2'));var config=require(_0xc3e4('0x3'));var attributes=require(_0xc3e4('0x4'));module[_0xc3e4('0x5')]=function(_0x185849,_0xac13cf){return _0x185849['define'](_0xc3e4('0x6'),attributes,{'tableName':_0xc3e4('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x731c=['bluebird','request-promise','rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','moment'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x731c,0xf0));var _0xc731=function(_0x2196b1,_0x5918c0){_0x2196b1=_0x2196b1-0x0;var _0x5b598f=_0x731c[_0x2196b1];return _0x5b598f;};'use strict';var _=require(_0xc731('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc731('0x1'));var BPromise=require(_0xc731('0x2'));var rp=require(_0xc731('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc731('0x4'));var config=require(_0xc731('0x5'));var attributes=require(_0xc731('0x6'));module[_0xc731('0x7')]=function(_0x4ad19d,_0x55847c){return _0x4ad19d[_0xc731('0x8')](_0xc731('0x9'),attributes,{'tableName':_0xc731('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 6862c96..d7c23b9 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 _0x84b5=['catch','GetTemplate','findAll','options','raw','where','attributes','include','map','model','then','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x83bba4,_0x17e821){var _0x4fc298=function(_0x1af34b){while(--_0x1af34b){_0x83bba4['push'](_0x83bba4['shift']());}};_0x4fc298(++_0x17e821);}(_0x84b5,0x1dd));var _0x584b=function(_0x1b9f74,_0x2fe102){_0x1b9f74=_0x1b9f74-0x0;var _0x32db41=_0x84b5[_0x1b9f74];return _0x32db41;};'use strict';var _=require(_0x584b('0x0'));var util=require(_0x584b('0x1'));var moment=require(_0x584b('0x2'));var BPromise=require(_0x584b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x584b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x584b('0x5'));var logger=require(_0x584b('0x6'))(_0x584b('0x7'));var config=require('../../config/environment');var jayson=require(_0x584b('0x8'));var client=jayson[_0x584b('0x9')][_0x584b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x244c86,_0x37bd82,_0x1b7625){return new BPromise(function(_0x3a9b2c,_0x36073c){return client['request'](_0x244c86,_0x1b7625)['then'](function(_0x2f9a29){logger[_0x584b('0xb')](_0x584b('0xc'),_0x37bd82,_0x584b('0xd'));logger['debug'](_0x584b('0xe'),_0x37bd82,'request\x20sent',JSON[_0x584b('0xf')](_0x2f9a29));if(_0x2f9a29['error']){if(_0x2f9a29[_0x584b('0x10')][_0x584b('0x11')]===0x1f4){logger[_0x584b('0x10')](_0x584b('0xc'),_0x37bd82,_0x2f9a29['error']['message']);return _0x36073c(_0x2f9a29[_0x584b('0x10')]['message']);}logger[_0x584b('0x10')](_0x584b('0xc'),_0x37bd82,_0x2f9a29['error'][_0x584b('0x12')]);return _0x3a9b2c(_0x2f9a29[_0x584b('0x10')][_0x584b('0x12')]);}else{logger[_0x584b('0xb')](_0x584b('0xc'),_0x37bd82,'request\x20sent');_0x3a9b2c(_0x2f9a29['result'][_0x584b('0x12')]);}})[_0x584b('0x13')](function(_0x41ac29){logger['error'](_0x584b('0xc'),_0x37bd82,_0x41ac29);_0x36073c(_0x41ac29);});});}exports[_0x584b('0x14')]=function(_0x2388fa){var _0x1cde6c=this;return new Promise(function(_0x5e075b,_0x5a28d0){return db['Template'][_0x584b('0x15')]({'raw':_0x2388fa[_0x584b('0x16')]?_0x2388fa['options'][_0x584b('0x17')]===undefined?!![]:![]:!![],'where':_0x2388fa[_0x584b('0x16')]?_0x2388fa[_0x584b('0x16')][_0x584b('0x18')]||null:null,'attributes':_0x2388fa[_0x584b('0x16')]?_0x2388fa['options'][_0x584b('0x19')]||null:null,'limit':_0x2388fa[_0x584b('0x16')]?_0x2388fa[_0x584b('0x16')]['limit']||null:null,'include':_0x2388fa[_0x584b('0x16')]?_0x2388fa[_0x584b('0x16')][_0x584b('0x1a')]?_[_0x584b('0x1b')](_0x2388fa['options'][_0x584b('0x1a')],function(_0x265239){return{'model':db[_0x265239[_0x584b('0x1c')]],'as':_0x265239['as'],'attributes':_0x265239[_0x584b('0x19')],'include':_0x265239[_0x584b('0x1a')]?_[_0x584b('0x1b')](_0x265239[_0x584b('0x1a')],function(_0x10f0ce){return{'model':db[_0x10f0ce[_0x584b('0x1c')]],'as':_0x10f0ce['as'],'attributes':_0x10f0ce[_0x584b('0x19')],'include':_0x10f0ce[_0x584b('0x1a')]?_['map'](_0x10f0ce['include'],function(_0x2909b3){return{'model':db[_0x2909b3[_0x584b('0x1c')]],'as':_0x2909b3['as'],'attributes':_0x2909b3[_0x584b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x584b('0x1d')](function(_0x2e13a5){logger[_0x584b('0xb')](_0x584b('0x14'),_0x2388fa);logger[_0x584b('0x1e')](_0x584b('0x14'),_0x2388fa,JSON['stringify'](_0x2e13a5));_0x5e075b(_0x2e13a5);})[_0x584b('0x13')](function(_0x486d43){logger[_0x584b('0x10')](_0x584b('0x14'),_0x486d43[_0x584b('0x12')],_0x2388fa);_0x5a28d0(_0x1cde6c[_0x584b('0x10')](0x1f4,_0x486d43[_0x584b('0x12')]));});});}; \ No newline at end of file +var _0xbffb=['raw','options','where','attributes','limit','include','map','model','debug','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','GetTemplate','findAll'];(function(_0x58ecb4,_0x2c03c4){var _0x4b2adc=function(_0x1f4ac0){while(--_0x1f4ac0){_0x58ecb4['push'](_0x58ecb4['shift']());}};_0x4b2adc(++_0x2c03c4);}(_0xbffb,0x1b7));var _0xbbff=function(_0x56cfc3,_0x152640){_0x56cfc3=_0x56cfc3-0x0;var _0x2eeac6=_0xbffb[_0x56cfc3];return _0x2eeac6;};'use strict';var _=require(_0xbbff('0x0'));var util=require(_0xbbff('0x1'));var moment=require(_0xbbff('0x2'));var BPromise=require(_0xbbff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbbff('0x5'));var logger=require(_0xbbff('0x6'))(_0xbbff('0x7'));var config=require(_0xbbff('0x8'));var jayson=require(_0xbbff('0x9'));var client=jayson['client'][_0xbbff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e0c7b,_0x28d992,_0x2620d8){return new BPromise(function(_0x273ead,_0x5a4526){return client[_0xbbff('0xb')](_0x1e0c7b,_0x2620d8)[_0xbbff('0xc')](function(_0x234733){logger['info'](_0xbbff('0xd'),_0x28d992,'request\x20sent');logger['debug'](_0xbbff('0xe'),_0x28d992,_0xbbff('0xf'),JSON[_0xbbff('0x10')](_0x234733));if(_0x234733[_0xbbff('0x11')]){if(_0x234733['error'][_0xbbff('0x12')]===0x1f4){logger[_0xbbff('0x11')](_0xbbff('0xd'),_0x28d992,_0x234733['error'][_0xbbff('0x13')]);return _0x5a4526(_0x234733[_0xbbff('0x11')]['message']);}logger['error'](_0xbbff('0xd'),_0x28d992,_0x234733['error'][_0xbbff('0x13')]);return _0x273ead(_0x234733['error'][_0xbbff('0x13')]);}else{logger[_0xbbff('0x14')](_0xbbff('0xd'),_0x28d992,_0xbbff('0xf'));_0x273ead(_0x234733['result'][_0xbbff('0x13')]);}})['catch'](function(_0x340ca2){logger[_0xbbff('0x11')](_0xbbff('0xd'),_0x28d992,_0x340ca2);_0x5a4526(_0x340ca2);});});}exports[_0xbbff('0x15')]=function(_0x5e85d0){var _0x53c7c8=this;return new Promise(function(_0xdf68e8,_0x4f5f11){return db['Template'][_0xbbff('0x16')]({'raw':_0x5e85d0['options']?_0x5e85d0['options'][_0xbbff('0x17')]===undefined?!![]:![]:!![],'where':_0x5e85d0['options']?_0x5e85d0[_0xbbff('0x18')][_0xbbff('0x19')]||null:null,'attributes':_0x5e85d0[_0xbbff('0x18')]?_0x5e85d0['options'][_0xbbff('0x1a')]||null:null,'limit':_0x5e85d0['options']?_0x5e85d0[_0xbbff('0x18')][_0xbbff('0x1b')]||null:null,'include':_0x5e85d0[_0xbbff('0x18')]?_0x5e85d0[_0xbbff('0x18')][_0xbbff('0x1c')]?_[_0xbbff('0x1d')](_0x5e85d0[_0xbbff('0x18')][_0xbbff('0x1c')],function(_0x523dc5){return{'model':db[_0x523dc5[_0xbbff('0x1e')]],'as':_0x523dc5['as'],'attributes':_0x523dc5[_0xbbff('0x1a')],'include':_0x523dc5[_0xbbff('0x1c')]?_[_0xbbff('0x1d')](_0x523dc5[_0xbbff('0x1c')],function(_0x4d6f2e){return{'model':db[_0x4d6f2e['model']],'as':_0x4d6f2e['as'],'attributes':_0x4d6f2e['attributes'],'include':_0x4d6f2e[_0xbbff('0x1c')]?_[_0xbbff('0x1d')](_0x4d6f2e[_0xbbff('0x1c')],function(_0x58b65f){return{'model':db[_0x58b65f[_0xbbff('0x1e')]],'as':_0x58b65f['as'],'attributes':_0x58b65f[_0xbbff('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbbff('0xc')](function(_0x5d3e38){logger[_0xbbff('0x14')](_0xbbff('0x15'),_0x5e85d0);logger[_0xbbff('0x1f')]('GetTemplate',_0x5e85d0,JSON[_0xbbff('0x10')](_0x5d3e38));_0xdf68e8(_0x5d3e38);})[_0xbbff('0x20')](function(_0x351957){logger[_0xbbff('0x11')]('GetTemplate',_0x351957[_0xbbff('0x13')],_0x5e85d0);_0x4f5f11(_0x53c7c8[_0xbbff('0x11')](0x1f4,_0x351957[_0xbbff('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 54874e4..35091e9 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 _0x34c9=['create','post','/:id/any_conditions','addAnyCondition','addAction','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions'];(function(_0x1157e7,_0x3c1f54){var _0xa23a53=function(_0x147e89){while(--_0x147e89){_0x1157e7['push'](_0x1157e7['shift']());}};_0xa23a53(++_0x3c1f54);}(_0x34c9,0x149));var _0x934c=function(_0x35c728,_0x50b8e5){_0x35c728=_0x35c728-0x0;var _0x27fdfc=_0x34c9[_0x35c728];return _0x27fdfc;};'use strict';var multer=require('multer');var util=require(_0x934c('0x0'));var path=require(_0x934c('0x1'));var timeout=require(_0x934c('0x2'));var express=require(_0x934c('0x3'));var router=express['Router']();var fs_extra=require(_0x934c('0x4'));var auth=require(_0x934c('0x5'));var interaction=require(_0x934c('0x6'));var config=require('../../config/environment');var controller=require(_0x934c('0x7'));router[_0x934c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x934c('0x8')](_0x934c('0x9'),auth[_0x934c('0xa')](),controller[_0x934c('0xb')]);router['get'](_0x934c('0xc'),auth[_0x934c('0xa')](),controller[_0x934c('0xd')]);router[_0x934c('0x8')]('/:id/any_conditions',auth[_0x934c('0xa')](),controller[_0x934c('0xe')]);router['get'](_0x934c('0xf'),auth[_0x934c('0xa')](),controller['getActions']);router['post']('/',auth[_0x934c('0xa')](),controller[_0x934c('0x10')]);router[_0x934c('0x11')]('/:id/all_conditions',auth[_0x934c('0xa')](),controller['addAllCondition']);router[_0x934c('0x11')](_0x934c('0x12'),auth[_0x934c('0xa')](),controller[_0x934c('0x13')]);router[_0x934c('0x11')]('/:id/actions',auth[_0x934c('0xa')](),controller[_0x934c('0x14')]);router['put'](_0x934c('0x9'),auth[_0x934c('0xa')](),controller['update']);router['delete'](_0x934c('0x9'),auth[_0x934c('0xa')](),controller[_0x934c('0x15')]);module[_0x934c('0x16')]=router; \ No newline at end of file +var _0xbeb6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5e8731,_0x3a7c5e){var _0x1f9986=function(_0x5966e0){while(--_0x5966e0){_0x5e8731['push'](_0x5e8731['shift']());}};_0x1f9986(++_0x3a7c5e);}(_0xbeb6,0x19e));var _0x6beb=function(_0x312499,_0x182457){_0x312499=_0x312499-0x0;var _0xeecf38=_0xbeb6[_0x312499];return _0xeecf38;};'use strict';var multer=require('multer');var util=require(_0x6beb('0x0'));var path=require(_0x6beb('0x1'));var timeout=require(_0x6beb('0x2'));var express=require(_0x6beb('0x3'));var router=express[_0x6beb('0x4')]();var fs_extra=require(_0x6beb('0x5'));var auth=require(_0x6beb('0x6'));var interaction=require(_0x6beb('0x7'));var config=require(_0x6beb('0x8'));var controller=require(_0x6beb('0x9'));router[_0x6beb('0xa')]('/',auth[_0x6beb('0xb')](),controller[_0x6beb('0xc')]);router[_0x6beb('0xa')]('/:id',auth[_0x6beb('0xb')](),controller[_0x6beb('0xd')]);router[_0x6beb('0xa')]('/:id/all_conditions',auth[_0x6beb('0xb')](),controller[_0x6beb('0xe')]);router[_0x6beb('0xa')]('/:id/any_conditions',auth[_0x6beb('0xb')](),controller[_0x6beb('0xf')]);router['get'](_0x6beb('0x10'),auth['isAuthenticated'](),controller[_0x6beb('0x11')]);router[_0x6beb('0x12')]('/',auth[_0x6beb('0xb')](),controller[_0x6beb('0x13')]);router[_0x6beb('0x12')](_0x6beb('0x14'),auth[_0x6beb('0xb')](),controller[_0x6beb('0x15')]);router['post']('/:id/any_conditions',auth[_0x6beb('0xb')](),controller[_0x6beb('0x16')]);router[_0x6beb('0x12')](_0x6beb('0x10'),auth[_0x6beb('0xb')](),controller[_0x6beb('0x17')]);router[_0x6beb('0x18')](_0x6beb('0x19'),auth[_0x6beb('0xb')](),controller[_0x6beb('0x1a')]);router[_0x6beb('0x1b')](_0x6beb('0x19'),auth[_0x6beb('0xb')](),controller[_0x6beb('0x1c')]);module[_0x6beb('0x1d')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index b702913..9ce689c 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 _0x2dbb=['STRING','BOOLEAN','sequelize'];(function(_0x52ae40,_0x23c2bf){var _0xab6ed1=function(_0x36d880){while(--_0x36d880){_0x52ae40['push'](_0x52ae40['shift']());}};_0xab6ed1(++_0x23c2bf);}(_0x2dbb,0x9b));var _0xb2db=function(_0x3ba70b,_0x40745d){_0x3ba70b=_0x3ba70b-0x0;var _0x47b144=_0x2dbb[_0x3ba70b];return _0x47b144;};'use strict';var Sequelize=require(_0xb2db('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb2db('0x1')]},'description':{'type':Sequelize[_0xb2db('0x1')]},'status':{'type':Sequelize[_0xb2db('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x6d95=['BOOLEAN','sequelize','STRING'];(function(_0x27ff0a,_0x469915){var _0x590123=function(_0x3403c1){while(--_0x3403c1){_0x27ff0a['push'](_0x27ff0a['shift']());}};_0x590123(++_0x469915);}(_0x6d95,0x163));var _0x56d9=function(_0x2d64ca,_0x2f734e){_0x2d64ca=_0x2d64ca-0x0;var _0x3269ad=_0x6d95[_0x2d64ca];return _0x3269ad;};'use strict';var Sequelize=require(_0x56d9('0x0'));module['exports']={'name':{'type':Sequelize[_0x56d9('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x56d9('0x1')]},'status':{'type':Sequelize[_0x56d9('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 5eb7ec0..613b94c 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 _0x1ca2=['limit','count','set','apply','save','then','Triggers','destroy','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','show','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','addAction','TriggerId','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1ca2,0x1c6));var _0x21ca=function(_0x37fa2b,_0x3adbf7){_0x37fa2b=_0x37fa2b-0x0;var _0x44efee=_0x1ca2[_0x37fa2b];return _0x44efee;};'use strict';var emlformat=require(_0x21ca('0x0'));var rimraf=require(_0x21ca('0x1'));var zipdir=require(_0x21ca('0x2'));var jsonpatch=require(_0x21ca('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x21ca('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x21ca('0x5'));var sox=require(_0x21ca('0x6'));var csv=require(_0x21ca('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x21ca('0x8'));var _=require('lodash');var squel=require(_0x21ca('0x9'));var crypto=require(_0x21ca('0xa'));var jsforce=require(_0x21ca('0xb'));var deskjs=require(_0x21ca('0xc'));var toCsv=require(_0x21ca('0x7'));var querystring=require(_0x21ca('0xd'));var Papa=require(_0x21ca('0xe'));var Redis=require(_0x21ca('0xf'));var authService=require(_0x21ca('0x10'));var qs=require(_0x21ca('0x11'));var as=require(_0x21ca('0x12'));var hardwareService=require(_0x21ca('0x13'));var logger=require(_0x21ca('0x14'))(_0x21ca('0x15'));var utils=require(_0x21ca('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x21ca('0x17'));var db=require(_0x21ca('0x18'))['db'];function respondWithStatusCode(_0x2b1080,_0x2dc9ea){_0x2dc9ea=_0x2dc9ea||0xcc;return function(_0x4a648d){if(_0x4a648d){return _0x2b1080[_0x21ca('0x19')](_0x2dc9ea);}return _0x2b1080[_0x21ca('0x1a')](_0x2dc9ea)[_0x21ca('0x1b')]();};}function respondWithResult(_0x28b524,_0x3e444f){_0x3e444f=_0x3e444f||0xc8;return function(_0x4bf18f){if(_0x4bf18f){return _0x28b524[_0x21ca('0x1a')](_0x3e444f)[_0x21ca('0x1c')](_0x4bf18f);}};}function respondWithFilteredResult(_0x1ff501,_0x12592b){return function(_0x89ea4b){if(_0x89ea4b){var _0x1f3ae6=typeof _0x12592b[_0x21ca('0x1d')]===_0x21ca('0x1e')&&typeof _0x12592b[_0x21ca('0x1f')]===_0x21ca('0x1e');var _0x21d5a4=_0x89ea4b[_0x21ca('0x20')];var _0x523143=_0x1f3ae6?0x0:_0x12592b[_0x21ca('0x1d')];var _0x43eb9d=_0x1f3ae6?_0x89ea4b[_0x21ca('0x20')]:_0x12592b[_0x21ca('0x1d')]+_0x12592b['limit'];var _0x358d1e;if(_0x43eb9d>=_0x21d5a4){_0x43eb9d=_0x21d5a4;_0x358d1e=0xc8;}else{_0x358d1e=0xce;}_0x1ff501[_0x21ca('0x1a')](_0x358d1e);return _0x1ff501[_0x21ca('0x21')]('Content-Range',_0x523143+'-'+_0x43eb9d+'/'+_0x21d5a4)[_0x21ca('0x1c')](_0x89ea4b);}return null;};}function patchUpdates(_0x2a1cd5){return function(_0x453d42){try{jsonpatch[_0x21ca('0x22')](_0x453d42,_0x2a1cd5,!![]);}catch(_0x4d6cc1){return BPromise['reject'](_0x4d6cc1);}return _0x453d42[_0x21ca('0x23')]();};}function saveUpdates(_0x17665d,_0x113e5d){return function(_0x2670d5){if(_0x2670d5){return _0x2670d5['update'](_0x17665d)[_0x21ca('0x24')](function(_0x462bac){return _0x462bac;});}return null;};}function removeEntity(_0x1045ab,_0x2b592d){return function(_0x3c900d){if(_0x3c900d){return _0x3c900d['destroy']()[_0x21ca('0x24')](function(){var _0x583245=_0x3c900d['get']({'plain':!![]});var _0x109c15=_0x21ca('0x25');return db['UserProfileResource'][_0x21ca('0x26')]({'where':{'type':_0x109c15,'resourceId':_0x583245['id']}})[_0x21ca('0x24')](function(){return _0x3c900d;});})[_0x21ca('0x24')](function(){_0x1045ab[_0x21ca('0x1a')](0xcc)[_0x21ca('0x1b')]();});}};}function handleEntityNotFound(_0x5c2cbd,_0x32b94c){return function(_0x39d45a){if(!_0x39d45a){_0x5c2cbd[_0x21ca('0x19')](0x194);}return _0x39d45a;};}function handleError(_0x2cc8e3,_0x461efe){_0x461efe=_0x461efe||0x1f4;return function(_0x5be64b){logger[_0x21ca('0x27')](_0x5be64b[_0x21ca('0x28')]);if(_0x5be64b['name']){delete _0x5be64b[_0x21ca('0x29')];}_0x2cc8e3['status'](_0x461efe)[_0x21ca('0x2a')](_0x5be64b);};}exports[_0x21ca('0x2b')]=function(_0x95f0eb,_0x26709c){var _0x188f69={},_0x31ce56={},_0xbddab9={'count':0x0,'rows':[]};var _0x2076ce=_[_0x21ca('0x2c')](db[_0x21ca('0x2d')][_0x21ca('0x2e')],function(_0x1cc084){return{'name':_0x1cc084[_0x21ca('0x2f')],'type':_0x1cc084[_0x21ca('0x30')][_0x21ca('0x31')]};});_0x31ce56['model']=_[_0x21ca('0x2c')](_0x2076ce,'name');_0x31ce56['query']=_[_0x21ca('0x32')](_0x95f0eb[_0x21ca('0x33')]);_0x31ce56[_0x21ca('0x34')]=_[_0x21ca('0x35')](_0x31ce56[_0x21ca('0x36')],_0x31ce56[_0x21ca('0x33')]);_0x188f69[_0x21ca('0x37')]=_[_0x21ca('0x35')](_0x31ce56[_0x21ca('0x36')],qs[_0x21ca('0x38')](_0x95f0eb[_0x21ca('0x33')][_0x21ca('0x38')]));_0x188f69['attributes']=_0x188f69[_0x21ca('0x37')][_0x21ca('0x39')]?_0x188f69[_0x21ca('0x37')]:_0x31ce56[_0x21ca('0x36')];if(!_0x95f0eb[_0x21ca('0x33')][_0x21ca('0x3a')](_0x21ca('0x3b'))){_0x188f69['limit']=qs[_0x21ca('0x1f')](_0x95f0eb[_0x21ca('0x33')][_0x21ca('0x1f')]);_0x188f69[_0x21ca('0x1d')]=qs[_0x21ca('0x1d')](_0x95f0eb['query'][_0x21ca('0x1d')]);}_0x188f69[_0x21ca('0x3c')]=qs[_0x21ca('0x3d')](_0x95f0eb[_0x21ca('0x33')][_0x21ca('0x3d')]);_0x188f69[_0x21ca('0x3e')]=qs[_0x21ca('0x34')](_[_0x21ca('0x3f')](_0x95f0eb[_0x21ca('0x33')],_0x31ce56['filters']),_0x2076ce);if(_0x95f0eb[_0x21ca('0x33')][_0x21ca('0x40')]){_0x188f69[_0x21ca('0x3e')]=_[_0x21ca('0x41')](_0x188f69[_0x21ca('0x3e')],{'$or':_[_0x21ca('0x2c')](_0x2076ce,function(_0x47710e){if(_0x47710e[_0x21ca('0x30')]!==_0x21ca('0x42')){var _0x37fb1f={};_0x37fb1f[_0x47710e[_0x21ca('0x29')]]={'$like':'%'+_0x95f0eb['query'][_0x21ca('0x40')]+'%'};return _0x37fb1f;}})});}_0x188f69=_[_0x21ca('0x41')]({},_0x188f69,_0x95f0eb[_0x21ca('0x43')]);var _0x39a3fc={'where':_0x188f69[_0x21ca('0x3e')]};return db[_0x21ca('0x2d')][_0x21ca('0x20')](_0x39a3fc)[_0x21ca('0x24')](function(_0x5bc50e){_0xbddab9[_0x21ca('0x20')]=_0x5bc50e;if(_0x95f0eb[_0x21ca('0x33')]['includeAll']){_0x188f69['include']=[{'all':!![]}];}return db[_0x21ca('0x2d')]['findAll'](_0x188f69);})[_0x21ca('0x24')](function(_0xc80b98){_0xbddab9[_0x21ca('0x44')]=_0xc80b98;return _0xbddab9;})['then'](respondWithFilteredResult(_0x26709c,_0x188f69))[_0x21ca('0x45')](handleError(_0x26709c,null));};exports[_0x21ca('0x46')]=function(_0x292a4a,_0x41918a){var _0x3f2592={'raw':![],'where':{'id':_0x292a4a['params']['id']}},_0x142188={};_0x142188['model']=_['keys'](db[_0x21ca('0x2d')][_0x21ca('0x2e')]);_0x142188[_0x21ca('0x33')]=_[_0x21ca('0x32')](_0x292a4a[_0x21ca('0x33')]);_0x142188[_0x21ca('0x34')]=_[_0x21ca('0x35')](_0x142188[_0x21ca('0x36')],_0x142188[_0x21ca('0x33')]);_0x3f2592[_0x21ca('0x37')]=_[_0x21ca('0x35')](_0x142188['model'],qs[_0x21ca('0x38')](_0x292a4a['query'][_0x21ca('0x38')]));_0x3f2592[_0x21ca('0x37')]=_0x3f2592[_0x21ca('0x37')][_0x21ca('0x39')]?_0x3f2592['attributes']:_0x142188[_0x21ca('0x36')];if(_0x292a4a['query'][_0x21ca('0x47')]){_0x3f2592['include']=[{'all':!![]}];}_0x3f2592=_[_0x21ca('0x41')]({},_0x3f2592,_0x292a4a[_0x21ca('0x43')]);return db[_0x21ca('0x2d')][_0x21ca('0x48')](_0x3f2592)['then'](handleEntityNotFound(_0x41918a,null))[_0x21ca('0x24')](respondWithResult(_0x41918a,null))[_0x21ca('0x45')](handleError(_0x41918a,null));};exports[_0x21ca('0x49')]=function(_0x2ce1eb,_0x5c7dfe){return db['Trigger'][_0x21ca('0x49')](_0x2ce1eb['body'],{})[_0x21ca('0x24')](function(_0x31a825){var _0x38f54a=_0x2ce1eb[_0x21ca('0x4a')][_0x21ca('0x4b')]({'plain':!![]});if(!_0x38f54a)throw new Error(_0x21ca('0x4c'));if(_0x38f54a[_0x21ca('0x4d')]===_0x21ca('0x4a')){var _0x3d3563=_0x31a825[_0x21ca('0x4b')]({'plain':!![]});var _0x2921bf=_0x21ca('0x25');return db[_0x21ca('0x4e')][_0x21ca('0x48')]({'where':{'name':_0x2921bf,'userProfileId':_0x38f54a[_0x21ca('0x4f')]},'raw':!![]})[_0x21ca('0x24')](function(_0x5f35ce){if(_0x5f35ce&&_0x5f35ce[_0x21ca('0x50')]===0x0){return db['UserProfileResource'][_0x21ca('0x49')]({'name':_0x3d3563[_0x21ca('0x29')],'resourceId':_0x3d3563['id'],'type':_0x5f35ce[_0x21ca('0x29')],'sectionId':_0x5f35ce['id']},{})['then'](function(){return _0x31a825;});}else{return _0x31a825;}})['catch'](function(_0x77e64d){logger['error'](_0x21ca('0x51'),_0x77e64d);throw _0x77e64d;});}return _0x31a825;})[_0x21ca('0x24')](respondWithResult(_0x5c7dfe,0xc9))[_0x21ca('0x45')](handleError(_0x5c7dfe,null));};exports[_0x21ca('0x52')]=function(_0x6d3959,_0x478f06){if(_0x6d3959['body']['id']){delete _0x6d3959[_0x21ca('0x53')]['id'];}return db[_0x21ca('0x2d')][_0x21ca('0x48')]({'where':{'id':_0x6d3959[_0x21ca('0x54')]['id']}})[_0x21ca('0x24')](handleEntityNotFound(_0x478f06,null))[_0x21ca('0x24')](saveUpdates(_0x6d3959['body'],null))['then'](respondWithResult(_0x478f06,null))[_0x21ca('0x45')](handleError(_0x478f06,null));};exports[_0x21ca('0x26')]=function(_0x475eb7,_0x2b6c54){return db[_0x21ca('0x2d')][_0x21ca('0x48')]({'where':{'id':_0x475eb7[_0x21ca('0x54')]['id']}})[_0x21ca('0x24')](handleEntityNotFound(_0x2b6c54,null))['then'](removeEntity(_0x2b6c54,null))['catch'](handleError(_0x2b6c54,null));};exports[_0x21ca('0x55')]=function(_0x4ba1b6,_0x2d8ff1,_0x22c354){if(_0x4ba1b6['body']['id']){delete _0x4ba1b6[_0x21ca('0x53')]['id'];}return db[_0x21ca('0x2d')]['find']({'where':{'id':_0x4ba1b6[_0x21ca('0x54')]['id']}})[_0x21ca('0x24')](handleEntityNotFound(_0x2d8ff1,null))[_0x21ca('0x24')](function(_0x2f35a1){if(_0x2f35a1){_0x4ba1b6[_0x21ca('0x53')][_0x21ca('0x56')]=_0x2f35a1['id'];return db[_0x21ca('0x57')][_0x21ca('0x49')](_0x4ba1b6[_0x21ca('0x53')]);}})[_0x21ca('0x24')](respondWithResult(_0x2d8ff1,null))['catch'](handleError(_0x2d8ff1,null));};exports[_0x21ca('0x58')]=function(_0x368c9d,_0x11cc7d,_0x4f87ab){if(_0x368c9d[_0x21ca('0x53')]['id']){delete _0x368c9d[_0x21ca('0x53')]['id'];}return db[_0x21ca('0x2d')][_0x21ca('0x48')]({'where':{'id':_0x368c9d[_0x21ca('0x54')]['id']}})[_0x21ca('0x24')](handleEntityNotFound(_0x11cc7d,null))[_0x21ca('0x24')](function(_0x15be59){if(_0x15be59){_0x368c9d[_0x21ca('0x53')][_0x21ca('0x59')]=_0x15be59['id'];return db['Condition'][_0x21ca('0x49')](_0x368c9d[_0x21ca('0x53')]);}})['then'](respondWithResult(_0x11cc7d,null))[_0x21ca('0x45')](handleError(_0x11cc7d,null));};exports['getAllConditions']=function(_0x29ffd1,_0x3541c3,_0x4587aa){var _0x48b1a6={};var _0x550b75={};var _0x3e2e42;var _0x50bbe4;return db['Trigger'][_0x21ca('0x5a')]({'where':{'id':_0x29ffd1[_0x21ca('0x54')]['id']}})['then'](handleEntityNotFound(_0x3541c3,null))['then'](function(_0x517adb){if(_0x517adb){_0x3e2e42=_0x517adb;_0x550b75[_0x21ca('0x36')]=_[_0x21ca('0x32')](db[_0x21ca('0x57')][_0x21ca('0x2e')]);_0x550b75[_0x21ca('0x33')]=_[_0x21ca('0x32')](_0x29ffd1[_0x21ca('0x33')]);_0x550b75[_0x21ca('0x34')]=_[_0x21ca('0x35')](_0x550b75[_0x21ca('0x36')],_0x550b75[_0x21ca('0x33')]);_0x48b1a6['attributes']=_[_0x21ca('0x35')](_0x550b75[_0x21ca('0x36')],qs[_0x21ca('0x38')](_0x29ffd1['query'][_0x21ca('0x38')]));_0x48b1a6[_0x21ca('0x37')]=_0x48b1a6[_0x21ca('0x37')][_0x21ca('0x39')]?_0x48b1a6['attributes']:_0x550b75[_0x21ca('0x36')];_0x48b1a6['order']=qs['sort'](_0x29ffd1[_0x21ca('0x33')]['sort']);_0x48b1a6['where']=qs[_0x21ca('0x34')](_[_0x21ca('0x3f')](_0x29ffd1['query'],_0x550b75[_0x21ca('0x34')]));if(_0x29ffd1[_0x21ca('0x33')][_0x21ca('0x40')]){_0x48b1a6[_0x21ca('0x3e')]=_[_0x21ca('0x41')](_0x48b1a6[_0x21ca('0x3e')],{'$or':_['map'](_0x48b1a6[_0x21ca('0x37')],function(_0x535422){var _0x1f3130={};_0x1f3130[_0x535422]={'$like':'%'+_0x29ffd1[_0x21ca('0x33')][_0x21ca('0x40')]+'%'};return _0x1f3130;})});}_0x48b1a6=_['merge']({},_0x48b1a6,_0x29ffd1[_0x21ca('0x43')]);return _0x3e2e42[_0x21ca('0x5b')](_0x48b1a6);}})[_0x21ca('0x24')](function(_0x27e25f){if(_0x27e25f){_0x50bbe4=_0x27e25f['length'];if(!_0x29ffd1['query'][_0x21ca('0x3a')](_0x21ca('0x3b'))){_0x48b1a6['limit']=qs[_0x21ca('0x1f')](_0x29ffd1['query'][_0x21ca('0x1f')]);_0x48b1a6['offset']=qs[_0x21ca('0x1d')](_0x29ffd1['query'][_0x21ca('0x1d')]);}return _0x3e2e42['getAllConditions'](_0x48b1a6);}})[_0x21ca('0x24')](function(_0x3041aa){if(_0x3041aa){return _0x3041aa?{'count':_0x50bbe4,'rows':_0x3041aa}:null;}})[_0x21ca('0x24')](respondWithResult(_0x3541c3,null))[_0x21ca('0x45')](handleError(_0x3541c3,null));};exports[_0x21ca('0x5c')]=function(_0x3c48f7,_0x351afc,_0x51a677){var _0x909e73={};var _0x39bd12={};var _0x19f3b2;var _0x26e657;return db[_0x21ca('0x2d')]['findOne']({'where':{'id':_0x3c48f7[_0x21ca('0x54')]['id']}})[_0x21ca('0x24')](handleEntityNotFound(_0x351afc,null))[_0x21ca('0x24')](function(_0x1db739){if(_0x1db739){_0x19f3b2=_0x1db739;_0x39bd12[_0x21ca('0x36')]=_[_0x21ca('0x32')](db[_0x21ca('0x57')][_0x21ca('0x2e')]);_0x39bd12[_0x21ca('0x33')]=_[_0x21ca('0x32')](_0x3c48f7[_0x21ca('0x33')]);_0x39bd12['filters']=_[_0x21ca('0x35')](_0x39bd12[_0x21ca('0x36')],_0x39bd12[_0x21ca('0x33')]);_0x909e73[_0x21ca('0x37')]=_[_0x21ca('0x35')](_0x39bd12[_0x21ca('0x36')],qs[_0x21ca('0x38')](_0x3c48f7[_0x21ca('0x33')][_0x21ca('0x38')]));_0x909e73['attributes']=_0x909e73['attributes']['length']?_0x909e73[_0x21ca('0x37')]:_0x39bd12['model'];_0x909e73[_0x21ca('0x3c')]=qs['sort'](_0x3c48f7[_0x21ca('0x33')][_0x21ca('0x3d')]);_0x909e73[_0x21ca('0x3e')]=qs[_0x21ca('0x34')](_['pick'](_0x3c48f7[_0x21ca('0x33')],_0x39bd12[_0x21ca('0x34')]));if(_0x3c48f7[_0x21ca('0x33')][_0x21ca('0x40')]){_0x909e73[_0x21ca('0x3e')]=_[_0x21ca('0x41')](_0x909e73[_0x21ca('0x3e')],{'$or':_[_0x21ca('0x2c')](_0x909e73[_0x21ca('0x37')],function(_0xb240e7){var _0x158aa9={};_0x158aa9[_0xb240e7]={'$like':'%'+_0x3c48f7['query'][_0x21ca('0x40')]+'%'};return _0x158aa9;})});}_0x909e73=_['merge']({},_0x909e73,_0x3c48f7[_0x21ca('0x43')]);return _0x19f3b2['getAnyConditions'](_0x909e73);}})['then'](function(_0x3b3260){if(_0x3b3260){_0x26e657=_0x3b3260['length'];if(!_0x3c48f7[_0x21ca('0x33')][_0x21ca('0x3a')]('nolimit')){_0x909e73[_0x21ca('0x1f')]=qs['limit'](_0x3c48f7[_0x21ca('0x33')][_0x21ca('0x1f')]);_0x909e73[_0x21ca('0x1d')]=qs[_0x21ca('0x1d')](_0x3c48f7[_0x21ca('0x33')][_0x21ca('0x1d')]);}return _0x19f3b2['getAnyConditions'](_0x909e73);}})['then'](function(_0x21bfc5){if(_0x21bfc5){return _0x21bfc5?{'count':_0x26e657,'rows':_0x21bfc5}:null;}})[_0x21ca('0x24')](respondWithResult(_0x351afc,null))[_0x21ca('0x45')](handleError(_0x351afc,null));};exports[_0x21ca('0x5d')]=function(_0x5c95d1,_0x148c23,_0x1cd3b6){if(_0x5c95d1['body']['id']){delete _0x5c95d1[_0x21ca('0x53')]['id'];}return db[_0x21ca('0x2d')][_0x21ca('0x48')]({'where':{'id':_0x5c95d1[_0x21ca('0x54')]['id']}})['then'](handleEntityNotFound(_0x148c23,null))[_0x21ca('0x24')](function(_0x5a9820){if(_0x5a9820){_0x5c95d1[_0x21ca('0x53')][_0x21ca('0x5e')]=_0x5a9820['id'];return db['Action'][_0x21ca('0x49')](_0x5c95d1[_0x21ca('0x53')]);}})[_0x21ca('0x24')](respondWithResult(_0x148c23,null))[_0x21ca('0x45')](handleError(_0x148c23,null));};exports[_0x21ca('0x5f')]=function(_0x282ffa,_0x14379e,_0x413528){var _0x4f6c23={};var _0x239fa6={};var _0x27ed65;var _0xecbf41;return db['Trigger'][_0x21ca('0x5a')]({'where':{'id':_0x282ffa[_0x21ca('0x54')]['id']}})[_0x21ca('0x24')](handleEntityNotFound(_0x14379e,null))[_0x21ca('0x24')](function(_0x236e5c){if(_0x236e5c){_0x27ed65=_0x236e5c;_0x239fa6[_0x21ca('0x36')]=_[_0x21ca('0x32')](db[_0x21ca('0x60')][_0x21ca('0x2e')]);_0x239fa6['query']=_['keys'](_0x282ffa[_0x21ca('0x33')]);_0x239fa6[_0x21ca('0x34')]=_[_0x21ca('0x35')](_0x239fa6[_0x21ca('0x36')],_0x239fa6[_0x21ca('0x33')]);_0x4f6c23[_0x21ca('0x37')]=_['intersection'](_0x239fa6[_0x21ca('0x36')],qs[_0x21ca('0x38')](_0x282ffa[_0x21ca('0x33')][_0x21ca('0x38')]));_0x4f6c23[_0x21ca('0x37')]=_0x4f6c23[_0x21ca('0x37')][_0x21ca('0x39')]?_0x4f6c23[_0x21ca('0x37')]:_0x239fa6['model'];_0x4f6c23[_0x21ca('0x3c')]=qs[_0x21ca('0x3d')](_0x282ffa['query'][_0x21ca('0x3d')]);_0x4f6c23[_0x21ca('0x3e')]=qs['filters'](_[_0x21ca('0x3f')](_0x282ffa['query'],_0x239fa6['filters']));if(_0x282ffa[_0x21ca('0x33')]['filter']){_0x4f6c23['where']=_[_0x21ca('0x41')](_0x4f6c23['where'],{'$or':_[_0x21ca('0x2c')](_0x4f6c23[_0x21ca('0x37')],function(_0x33c120){var _0x4cee49={};_0x4cee49[_0x33c120]={'$like':'%'+_0x282ffa['query'][_0x21ca('0x40')]+'%'};return _0x4cee49;})});}_0x4f6c23=_[_0x21ca('0x41')]({},_0x4f6c23,_0x282ffa['options']);return _0x27ed65[_0x21ca('0x5f')](_0x4f6c23);}})[_0x21ca('0x24')](function(_0x11ff5c){if(_0x11ff5c){_0xecbf41=_0x11ff5c['length'];if(!_0x282ffa[_0x21ca('0x33')][_0x21ca('0x3a')]('nolimit')){_0x4f6c23[_0x21ca('0x1f')]=qs['limit'](_0x282ffa[_0x21ca('0x33')][_0x21ca('0x1f')]);_0x4f6c23[_0x21ca('0x1d')]=qs['offset'](_0x282ffa['query']['offset']);}return _0x27ed65[_0x21ca('0x5f')](_0x4f6c23);}})[_0x21ca('0x24')](function(_0x2e7d59){if(_0x2e7d59){return _0x2e7d59?{'count':_0xecbf41,'rows':_0x2e7d59}:null;}})[_0x21ca('0x24')](respondWithResult(_0x14379e,null))[_0x21ca('0x45')](handleError(_0x14379e,null));}; \ No newline at end of file +var _0x6886=['squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','Triggers','UserProfileResource','then','stack','send','index','Trigger','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','name','options','include','rows','show','params','length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','Condition','addAnyCondition','TriggerAnyId','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x368f49,_0x25d8f2){var _0x3c5bf7=function(_0x50f5f3){while(--_0x50f5f3){_0x368f49['push'](_0x368f49['shift']());}};_0x3c5bf7(++_0x25d8f2);}(_0x6886,0x10d));var _0x6688=function(_0x4a2385,_0x14a8b2){_0x4a2385=_0x4a2385-0x0;var _0x17ff6f=_0x6886[_0x4a2385];return _0x17ff6f;};'use strict';var emlformat=require(_0x6688('0x0'));var rimraf=require(_0x6688('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6688('0x2'));var rp=require(_0x6688('0x3'));var moment=require(_0x6688('0x4'));var BPromise=require(_0x6688('0x5'));var Mustache=require(_0x6688('0x6'));var util=require(_0x6688('0x7'));var path=require(_0x6688('0x8'));var sox=require(_0x6688('0x9'));var csv=require(_0x6688('0xa'));var ejs=require(_0x6688('0xb'));var fs=require('fs');var fs_extra=require(_0x6688('0xc'));var _=require('lodash');var squel=require(_0x6688('0xd'));var crypto=require('crypto');var jsforce=require(_0x6688('0xe'));var deskjs=require(_0x6688('0xf'));var toCsv=require(_0x6688('0xa'));var querystring=require(_0x6688('0x10'));var Papa=require(_0x6688('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6688('0x12'));var as=require(_0x6688('0x13'));var hardwareService=require(_0x6688('0x14'));var logger=require(_0x6688('0x15'))(_0x6688('0x16'));var utils=require('../../config/utils');var config=require(_0x6688('0x17'));var licenseUtil=require(_0x6688('0x18'));var db=require(_0x6688('0x19'))['db'];function respondWithStatusCode(_0xd76f0f,_0x9d370f){_0x9d370f=_0x9d370f||0xcc;return function(_0x40294a){if(_0x40294a){return _0xd76f0f[_0x6688('0x1a')](_0x9d370f);}return _0xd76f0f[_0x6688('0x1b')](_0x9d370f)[_0x6688('0x1c')]();};}function respondWithResult(_0x92118,_0x37afee){_0x37afee=_0x37afee||0xc8;return function(_0x991681){if(_0x991681){return _0x92118[_0x6688('0x1b')](_0x37afee)['json'](_0x991681);}};}function respondWithFilteredResult(_0x3773f1,_0x1a00a5){return function(_0x1e6c6d){if(_0x1e6c6d){var _0x5127ea=typeof _0x1a00a5[_0x6688('0x1d')]===_0x6688('0x1e')&&typeof _0x1a00a5[_0x6688('0x1f')]===_0x6688('0x1e');var _0x54fa24=_0x1e6c6d[_0x6688('0x20')];var _0xe7c5f0=_0x5127ea?0x0:_0x1a00a5[_0x6688('0x1d')];var _0x18038f=_0x5127ea?_0x1e6c6d['count']:_0x1a00a5['offset']+_0x1a00a5['limit'];var _0x27d714;if(_0x18038f>=_0x54fa24){_0x18038f=_0x54fa24;_0x27d714=0xc8;}else{_0x27d714=0xce;}_0x3773f1[_0x6688('0x1b')](_0x27d714);return _0x3773f1[_0x6688('0x21')](_0x6688('0x22'),_0xe7c5f0+'-'+_0x18038f+'/'+_0x54fa24)['json'](_0x1e6c6d);}return null;};}function patchUpdates(_0x1ef5b0){return function(_0x3351e5){try{jsonpatch[_0x6688('0x23')](_0x3351e5,_0x1ef5b0,!![]);}catch(_0x40ecfa){return BPromise[_0x6688('0x24')](_0x40ecfa);}return _0x3351e5['save']();};}function saveUpdates(_0x555c20,_0x3fc430){return function(_0x4a4a3e){if(_0x4a4a3e){return _0x4a4a3e[_0x6688('0x25')](_0x555c20)['then'](function(_0x5a0e40){return _0x5a0e40;});}return null;};}function removeEntity(_0x561ae2,_0x4e6b02){return function(_0xc158d8){if(_0xc158d8){return _0xc158d8[_0x6688('0x26')]()['then'](function(){var _0x1ebd39=_0xc158d8[_0x6688('0x27')]({'plain':!![]});var _0x385991=_0x6688('0x28');return db[_0x6688('0x29')][_0x6688('0x26')]({'where':{'type':_0x385991,'resourceId':_0x1ebd39['id']}})['then'](function(){return _0xc158d8;});})[_0x6688('0x2a')](function(){_0x561ae2[_0x6688('0x1b')](0xcc)[_0x6688('0x1c')]();});}};}function handleEntityNotFound(_0x42b028,_0xda148d){return function(_0x1c74c5){if(!_0x1c74c5){_0x42b028[_0x6688('0x1a')](0x194);}return _0x1c74c5;};}function handleError(_0x3eefc7,_0x5d0aa8){_0x5d0aa8=_0x5d0aa8||0x1f4;return function(_0x32dab6){logger['error'](_0x32dab6[_0x6688('0x2b')]);if(_0x32dab6['name']){delete _0x32dab6['name'];}_0x3eefc7[_0x6688('0x1b')](_0x5d0aa8)[_0x6688('0x2c')](_0x32dab6);};}exports[_0x6688('0x2d')]=function(_0x1851b8,_0x5c11dc){var _0x5a165b={},_0x73d631={},_0x5ba8f3={'count':0x0,'rows':[]};var _0x34951c=_['map'](db[_0x6688('0x2e')][_0x6688('0x2f')],function(_0x251443){return{'name':_0x251443[_0x6688('0x30')],'type':_0x251443[_0x6688('0x31')]['key']};});_0x73d631[_0x6688('0x32')]=_[_0x6688('0x33')](_0x34951c,'name');_0x73d631[_0x6688('0x34')]=_[_0x6688('0x35')](_0x1851b8[_0x6688('0x34')]);_0x73d631['filters']=_[_0x6688('0x36')](_0x73d631[_0x6688('0x32')],_0x73d631[_0x6688('0x34')]);_0x5a165b[_0x6688('0x37')]=_[_0x6688('0x36')](_0x73d631[_0x6688('0x32')],qs[_0x6688('0x38')](_0x1851b8[_0x6688('0x34')]['fields']));_0x5a165b[_0x6688('0x37')]=_0x5a165b[_0x6688('0x37')]['length']?_0x5a165b[_0x6688('0x37')]:_0x73d631['model'];if(!_0x1851b8['query'][_0x6688('0x39')]('nolimit')){_0x5a165b[_0x6688('0x1f')]=qs[_0x6688('0x1f')](_0x1851b8[_0x6688('0x34')][_0x6688('0x1f')]);_0x5a165b[_0x6688('0x1d')]=qs[_0x6688('0x1d')](_0x1851b8[_0x6688('0x34')][_0x6688('0x1d')]);}_0x5a165b[_0x6688('0x3a')]=qs['sort'](_0x1851b8[_0x6688('0x34')][_0x6688('0x3b')]);_0x5a165b[_0x6688('0x3c')]=qs[_0x6688('0x3d')](_[_0x6688('0x3e')](_0x1851b8[_0x6688('0x34')],_0x73d631[_0x6688('0x3d')]),_0x34951c);if(_0x1851b8[_0x6688('0x34')][_0x6688('0x3f')]){_0x5a165b[_0x6688('0x3c')]=_[_0x6688('0x40')](_0x5a165b[_0x6688('0x3c')],{'$or':_['map'](_0x34951c,function(_0x183c7b){if(_0x183c7b['type']!=='VIRTUAL'){var _0x4e76e5={};_0x4e76e5[_0x183c7b[_0x6688('0x41')]]={'$like':'%'+_0x1851b8[_0x6688('0x34')]['filter']+'%'};return _0x4e76e5;}})});}_0x5a165b=_[_0x6688('0x40')]({},_0x5a165b,_0x1851b8[_0x6688('0x42')]);var _0x4a56ee={'where':_0x5a165b['where']};return db[_0x6688('0x2e')][_0x6688('0x20')](_0x4a56ee)[_0x6688('0x2a')](function(_0x1208df){_0x5ba8f3[_0x6688('0x20')]=_0x1208df;if(_0x1851b8['query']['includeAll']){_0x5a165b[_0x6688('0x43')]=[{'all':!![]}];}return db[_0x6688('0x2e')]['findAll'](_0x5a165b);})[_0x6688('0x2a')](function(_0x146055){_0x5ba8f3[_0x6688('0x44')]=_0x146055;return _0x5ba8f3;})['then'](respondWithFilteredResult(_0x5c11dc,_0x5a165b))['catch'](handleError(_0x5c11dc,null));};exports[_0x6688('0x45')]=function(_0x298d75,_0x2b926c){var _0x157435={'raw':![],'where':{'id':_0x298d75[_0x6688('0x46')]['id']}},_0x3d9c63={};_0x3d9c63['model']=_[_0x6688('0x35')](db[_0x6688('0x2e')][_0x6688('0x2f')]);_0x3d9c63[_0x6688('0x34')]=_[_0x6688('0x35')](_0x298d75[_0x6688('0x34')]);_0x3d9c63[_0x6688('0x3d')]=_[_0x6688('0x36')](_0x3d9c63[_0x6688('0x32')],_0x3d9c63['query']);_0x157435[_0x6688('0x37')]=_[_0x6688('0x36')](_0x3d9c63[_0x6688('0x32')],qs[_0x6688('0x38')](_0x298d75['query'][_0x6688('0x38')]));_0x157435[_0x6688('0x37')]=_0x157435[_0x6688('0x37')][_0x6688('0x47')]?_0x157435[_0x6688('0x37')]:_0x3d9c63[_0x6688('0x32')];if(_0x298d75[_0x6688('0x34')][_0x6688('0x48')]){_0x157435['include']=[{'all':!![]}];}_0x157435=_[_0x6688('0x40')]({},_0x157435,_0x298d75[_0x6688('0x42')]);return db[_0x6688('0x2e')][_0x6688('0x49')](_0x157435)['then'](handleEntityNotFound(_0x2b926c,null))[_0x6688('0x2a')](respondWithResult(_0x2b926c,null))[_0x6688('0x4a')](handleError(_0x2b926c,null));};exports[_0x6688('0x4b')]=function(_0x25912f,_0x513ec1){return db['Trigger']['create'](_0x25912f[_0x6688('0x4c')],{})['then'](function(_0x30fdd5){var _0x2e43ea=_0x25912f[_0x6688('0x4d')][_0x6688('0x27')]({'plain':!![]});if(!_0x2e43ea)throw new Error(_0x6688('0x4e'));if(_0x2e43ea[_0x6688('0x4f')]===_0x6688('0x4d')){var _0x322b57=_0x30fdd5[_0x6688('0x27')]({'plain':!![]});var _0x62976d=_0x6688('0x28');return db[_0x6688('0x50')][_0x6688('0x49')]({'where':{'name':_0x62976d,'userProfileId':_0x2e43ea[_0x6688('0x51')]},'raw':!![]})[_0x6688('0x2a')](function(_0x34a10f){if(_0x34a10f&&_0x34a10f['autoAssociation']===0x0){return db['UserProfileResource'][_0x6688('0x4b')]({'name':_0x322b57[_0x6688('0x41')],'resourceId':_0x322b57['id'],'type':_0x34a10f['name'],'sectionId':_0x34a10f['id']},{})[_0x6688('0x2a')](function(){return _0x30fdd5;});}else{return _0x30fdd5;}})['catch'](function(_0xc581bf){logger['error'](_0x6688('0x52'),_0xc581bf);throw _0xc581bf;});}return _0x30fdd5;})[_0x6688('0x2a')](respondWithResult(_0x513ec1,0xc9))['catch'](handleError(_0x513ec1,null));};exports[_0x6688('0x25')]=function(_0xab766a,_0x3b2cf3){if(_0xab766a[_0x6688('0x4c')]['id']){delete _0xab766a[_0x6688('0x4c')]['id'];}return db['Trigger'][_0x6688('0x49')]({'where':{'id':_0xab766a[_0x6688('0x46')]['id']}})[_0x6688('0x2a')](handleEntityNotFound(_0x3b2cf3,null))[_0x6688('0x2a')](saveUpdates(_0xab766a[_0x6688('0x4c')],null))[_0x6688('0x2a')](respondWithResult(_0x3b2cf3,null))[_0x6688('0x4a')](handleError(_0x3b2cf3,null));};exports['destroy']=function(_0x20c667,_0x541d91){return db[_0x6688('0x2e')][_0x6688('0x49')]({'where':{'id':_0x20c667[_0x6688('0x46')]['id']}})['then'](handleEntityNotFound(_0x541d91,null))[_0x6688('0x2a')](removeEntity(_0x541d91,null))[_0x6688('0x4a')](handleError(_0x541d91,null));};exports[_0x6688('0x53')]=function(_0x5d2636,_0x1c2eff,_0x520bf8){if(_0x5d2636[_0x6688('0x4c')]['id']){delete _0x5d2636['body']['id'];}return db[_0x6688('0x2e')][_0x6688('0x49')]({'where':{'id':_0x5d2636[_0x6688('0x46')]['id']}})[_0x6688('0x2a')](handleEntityNotFound(_0x1c2eff,null))[_0x6688('0x2a')](function(_0x598149){if(_0x598149){_0x5d2636[_0x6688('0x4c')]['TriggerAllId']=_0x598149['id'];return db[_0x6688('0x54')][_0x6688('0x4b')](_0x5d2636['body']);}})['then'](respondWithResult(_0x1c2eff,null))[_0x6688('0x4a')](handleError(_0x1c2eff,null));};exports[_0x6688('0x55')]=function(_0x27e5d4,_0x16806c,_0x429b83){if(_0x27e5d4[_0x6688('0x4c')]['id']){delete _0x27e5d4[_0x6688('0x4c')]['id'];}return db[_0x6688('0x2e')][_0x6688('0x49')]({'where':{'id':_0x27e5d4[_0x6688('0x46')]['id']}})[_0x6688('0x2a')](handleEntityNotFound(_0x16806c,null))[_0x6688('0x2a')](function(_0x1051ed){if(_0x1051ed){_0x27e5d4[_0x6688('0x4c')][_0x6688('0x56')]=_0x1051ed['id'];return db[_0x6688('0x54')]['create'](_0x27e5d4[_0x6688('0x4c')]);}})[_0x6688('0x2a')](respondWithResult(_0x16806c,null))['catch'](handleError(_0x16806c,null));};exports[_0x6688('0x57')]=function(_0x1f4853,_0x3d50a4,_0x3ca339){var _0x195ab3={};var _0x4a5e3d={};var _0x53a3c3;var _0x1c53ef;return db[_0x6688('0x2e')]['findOne']({'where':{'id':_0x1f4853[_0x6688('0x46')]['id']}})[_0x6688('0x2a')](handleEntityNotFound(_0x3d50a4,null))[_0x6688('0x2a')](function(_0x38a7ee){if(_0x38a7ee){_0x53a3c3=_0x38a7ee;_0x4a5e3d[_0x6688('0x32')]=_[_0x6688('0x35')](db[_0x6688('0x54')]['rawAttributes']);_0x4a5e3d[_0x6688('0x34')]=_[_0x6688('0x35')](_0x1f4853['query']);_0x4a5e3d[_0x6688('0x3d')]=_['intersection'](_0x4a5e3d[_0x6688('0x32')],_0x4a5e3d[_0x6688('0x34')]);_0x195ab3[_0x6688('0x37')]=_[_0x6688('0x36')](_0x4a5e3d['model'],qs[_0x6688('0x38')](_0x1f4853['query'][_0x6688('0x38')]));_0x195ab3[_0x6688('0x37')]=_0x195ab3[_0x6688('0x37')][_0x6688('0x47')]?_0x195ab3[_0x6688('0x37')]:_0x4a5e3d[_0x6688('0x32')];_0x195ab3[_0x6688('0x3a')]=qs[_0x6688('0x3b')](_0x1f4853['query']['sort']);_0x195ab3[_0x6688('0x3c')]=qs[_0x6688('0x3d')](_[_0x6688('0x3e')](_0x1f4853[_0x6688('0x34')],_0x4a5e3d[_0x6688('0x3d')]));if(_0x1f4853[_0x6688('0x34')][_0x6688('0x3f')]){_0x195ab3[_0x6688('0x3c')]=_['merge'](_0x195ab3['where'],{'$or':_[_0x6688('0x33')](_0x195ab3[_0x6688('0x37')],function(_0x15aa3a){var _0x27bc75={};_0x27bc75[_0x15aa3a]={'$like':'%'+_0x1f4853[_0x6688('0x34')]['filter']+'%'};return _0x27bc75;})});}_0x195ab3=_[_0x6688('0x40')]({},_0x195ab3,_0x1f4853[_0x6688('0x42')]);return _0x53a3c3['getAllConditions'](_0x195ab3);}})[_0x6688('0x2a')](function(_0x58a816){if(_0x58a816){_0x1c53ef=_0x58a816['length'];if(!_0x1f4853[_0x6688('0x34')]['hasOwnProperty']('nolimit')){_0x195ab3[_0x6688('0x1f')]=qs[_0x6688('0x1f')](_0x1f4853[_0x6688('0x34')][_0x6688('0x1f')]);_0x195ab3[_0x6688('0x1d')]=qs[_0x6688('0x1d')](_0x1f4853[_0x6688('0x34')]['offset']);}return _0x53a3c3[_0x6688('0x57')](_0x195ab3);}})[_0x6688('0x2a')](function(_0xa1f3de){if(_0xa1f3de){return _0xa1f3de?{'count':_0x1c53ef,'rows':_0xa1f3de}:null;}})['then'](respondWithResult(_0x3d50a4,null))[_0x6688('0x4a')](handleError(_0x3d50a4,null));};exports[_0x6688('0x58')]=function(_0x23dad,_0x4e4e53,_0x583eba){var _0x84a75f={};var _0x5f2389={};var _0xb12b9d;var _0x5ed739;return db[_0x6688('0x2e')]['findOne']({'where':{'id':_0x23dad['params']['id']}})[_0x6688('0x2a')](handleEntityNotFound(_0x4e4e53,null))[_0x6688('0x2a')](function(_0x1570e8){if(_0x1570e8){_0xb12b9d=_0x1570e8;_0x5f2389[_0x6688('0x32')]=_[_0x6688('0x35')](db[_0x6688('0x54')][_0x6688('0x2f')]);_0x5f2389[_0x6688('0x34')]=_[_0x6688('0x35')](_0x23dad[_0x6688('0x34')]);_0x5f2389[_0x6688('0x3d')]=_[_0x6688('0x36')](_0x5f2389[_0x6688('0x32')],_0x5f2389[_0x6688('0x34')]);_0x84a75f[_0x6688('0x37')]=_['intersection'](_0x5f2389['model'],qs[_0x6688('0x38')](_0x23dad['query'][_0x6688('0x38')]));_0x84a75f['attributes']=_0x84a75f[_0x6688('0x37')][_0x6688('0x47')]?_0x84a75f[_0x6688('0x37')]:_0x5f2389[_0x6688('0x32')];_0x84a75f[_0x6688('0x3a')]=qs[_0x6688('0x3b')](_0x23dad['query'][_0x6688('0x3b')]);_0x84a75f[_0x6688('0x3c')]=qs[_0x6688('0x3d')](_[_0x6688('0x3e')](_0x23dad[_0x6688('0x34')],_0x5f2389[_0x6688('0x3d')]));if(_0x23dad['query'][_0x6688('0x3f')]){_0x84a75f[_0x6688('0x3c')]=_[_0x6688('0x40')](_0x84a75f[_0x6688('0x3c')],{'$or':_[_0x6688('0x33')](_0x84a75f[_0x6688('0x37')],function(_0x5976b8){var _0x49ccfb={};_0x49ccfb[_0x5976b8]={'$like':'%'+_0x23dad[_0x6688('0x34')][_0x6688('0x3f')]+'%'};return _0x49ccfb;})});}_0x84a75f=_['merge']({},_0x84a75f,_0x23dad['options']);return _0xb12b9d[_0x6688('0x58')](_0x84a75f);}})[_0x6688('0x2a')](function(_0x5b6795){if(_0x5b6795){_0x5ed739=_0x5b6795[_0x6688('0x47')];if(!_0x23dad['query'][_0x6688('0x39')]('nolimit')){_0x84a75f['limit']=qs['limit'](_0x23dad[_0x6688('0x34')][_0x6688('0x1f')]);_0x84a75f[_0x6688('0x1d')]=qs[_0x6688('0x1d')](_0x23dad[_0x6688('0x34')][_0x6688('0x1d')]);}return _0xb12b9d[_0x6688('0x58')](_0x84a75f);}})[_0x6688('0x2a')](function(_0x1aa100){if(_0x1aa100){return _0x1aa100?{'count':_0x5ed739,'rows':_0x1aa100}:null;}})[_0x6688('0x2a')](respondWithResult(_0x4e4e53,null))[_0x6688('0x4a')](handleError(_0x4e4e53,null));};exports[_0x6688('0x59')]=function(_0x40c2d9,_0x392cb6,_0x39df42){if(_0x40c2d9[_0x6688('0x4c')]['id']){delete _0x40c2d9[_0x6688('0x4c')]['id'];}return db[_0x6688('0x2e')]['find']({'where':{'id':_0x40c2d9['params']['id']}})[_0x6688('0x2a')](handleEntityNotFound(_0x392cb6,null))[_0x6688('0x2a')](function(_0x146b34){if(_0x146b34){_0x40c2d9[_0x6688('0x4c')][_0x6688('0x5a')]=_0x146b34['id'];return db[_0x6688('0x5b')][_0x6688('0x4b')](_0x40c2d9[_0x6688('0x4c')]);}})['then'](respondWithResult(_0x392cb6,null))[_0x6688('0x4a')](handleError(_0x392cb6,null));};exports[_0x6688('0x5c')]=function(_0x392e36,_0x41139b,_0x3cf622){var _0x43105d={};var _0x34eb16={};var _0x7a8df2;var _0x16f55b;return db['Trigger']['findOne']({'where':{'id':_0x392e36[_0x6688('0x46')]['id']}})[_0x6688('0x2a')](handleEntityNotFound(_0x41139b,null))[_0x6688('0x2a')](function(_0x5288a4){if(_0x5288a4){_0x7a8df2=_0x5288a4;_0x34eb16['model']=_[_0x6688('0x35')](db[_0x6688('0x5b')]['rawAttributes']);_0x34eb16['query']=_[_0x6688('0x35')](_0x392e36[_0x6688('0x34')]);_0x34eb16['filters']=_[_0x6688('0x36')](_0x34eb16[_0x6688('0x32')],_0x34eb16[_0x6688('0x34')]);_0x43105d[_0x6688('0x37')]=_[_0x6688('0x36')](_0x34eb16['model'],qs[_0x6688('0x38')](_0x392e36[_0x6688('0x34')][_0x6688('0x38')]));_0x43105d[_0x6688('0x37')]=_0x43105d[_0x6688('0x37')][_0x6688('0x47')]?_0x43105d[_0x6688('0x37')]:_0x34eb16[_0x6688('0x32')];_0x43105d['order']=qs['sort'](_0x392e36[_0x6688('0x34')][_0x6688('0x3b')]);_0x43105d[_0x6688('0x3c')]=qs[_0x6688('0x3d')](_['pick'](_0x392e36[_0x6688('0x34')],_0x34eb16['filters']));if(_0x392e36[_0x6688('0x34')][_0x6688('0x3f')]){_0x43105d[_0x6688('0x3c')]=_[_0x6688('0x40')](_0x43105d['where'],{'$or':_[_0x6688('0x33')](_0x43105d[_0x6688('0x37')],function(_0x39d58d){var _0x2454d0={};_0x2454d0[_0x39d58d]={'$like':'%'+_0x392e36[_0x6688('0x34')][_0x6688('0x3f')]+'%'};return _0x2454d0;})});}_0x43105d=_[_0x6688('0x40')]({},_0x43105d,_0x392e36[_0x6688('0x42')]);return _0x7a8df2[_0x6688('0x5c')](_0x43105d);}})[_0x6688('0x2a')](function(_0x8bae01){if(_0x8bae01){_0x16f55b=_0x8bae01[_0x6688('0x47')];if(!_0x392e36[_0x6688('0x34')][_0x6688('0x39')](_0x6688('0x5d'))){_0x43105d[_0x6688('0x1f')]=qs[_0x6688('0x1f')](_0x392e36[_0x6688('0x34')][_0x6688('0x1f')]);_0x43105d[_0x6688('0x1d')]=qs[_0x6688('0x1d')](_0x392e36[_0x6688('0x34')]['offset']);}return _0x7a8df2['getActions'](_0x43105d);}})[_0x6688('0x2a')](function(_0x2d24a2){if(_0x2d24a2){return _0x2d24a2?{'count':_0x16f55b,'rows':_0x2d24a2}:null;}})['then'](respondWithResult(_0x41139b,null))['catch'](handleError(_0x41139b,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index a479f8c..465b0cf 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 _0x6597=['../../config/logger','moment','request-promise','./trigger.attributes','exports','define','lodash','util'];(function(_0x39dfaa,_0x2ffb72){var _0x45dc94=function(_0x2a74d1){while(--_0x2a74d1){_0x39dfaa['push'](_0x39dfaa['shift']());}};_0x45dc94(++_0x2ffb72);}(_0x6597,0x16e));var _0x7659=function(_0x3ae2ff,_0x2a1fcb){_0x3ae2ff=_0x3ae2ff-0x0;var _0x18d74a=_0x6597[_0x3ae2ff];return _0x18d74a;};'use strict';var _=require(_0x7659('0x0'));var util=require(_0x7659('0x1'));var logger=require(_0x7659('0x2'))('api');var moment=require(_0x7659('0x3'));var BPromise=require('bluebird');var rp=require(_0x7659('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7659('0x5'));module[_0x7659('0x6')]=function(_0x4e09cc,_0xb90fa2){return _0x4e09cc[_0x7659('0x7')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc524=['bluebird','request-promise','path','rimraf','exports','define','../../config/logger','api','moment'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0xc524,0x1bf));var _0x4c52=function(_0x57505e,_0x8fc4d3){_0x57505e=_0x57505e-0x0;var _0xfdf2cf=_0xc524[_0x57505e];return _0xfdf2cf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4c52('0x0'))(_0x4c52('0x1'));var moment=require(_0x4c52('0x2'));var BPromise=require(_0x4c52('0x3'));var rp=require(_0x4c52('0x4'));var fs=require('fs');var path=require(_0x4c52('0x5'));var rimraf=require(_0x4c52('0x6'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0x4c52('0x7')]=function(_0xdaf126,_0x72d0ec){return _0xdaf126[_0x4c52('0x8')]('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 cc94712..8e0bb10 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 _0xaa51=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','Trigger,\x20%s,\x20%s','message','catch','GetTrigger','Trigger','findAll','options','raw','where','include','map','attributes','model','debug','ShowTrigger','find','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5f5c6c,_0x113567){var _0x3bc21c=function(_0x52d4b8){while(--_0x52d4b8){_0x5f5c6c['push'](_0x5f5c6c['shift']());}};_0x3bc21c(++_0x113567);}(_0xaa51,0xae));var _0x1aa5=function(_0x182e32,_0x9f2b7){_0x182e32=_0x182e32-0x0;var _0x562b32=_0xaa51[_0x182e32];return _0x562b32;};'use strict';var _=require(_0x1aa5('0x0'));var util=require(_0x1aa5('0x1'));var moment=require(_0x1aa5('0x2'));var BPromise=require(_0x1aa5('0x3'));var rs=require(_0x1aa5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1aa5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1aa5('0x6'))(_0x1aa5('0x7'));var config=require(_0x1aa5('0x8'));var jayson=require(_0x1aa5('0x9'));var client=jayson[_0x1aa5('0xa')][_0x1aa5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x187e61,_0x1e22b9,_0x270810){return new BPromise(function(_0x19d670,_0x403bac){return client[_0x1aa5('0xc')](_0x187e61,_0x270810)[_0x1aa5('0xd')](function(_0x5967bc){logger[_0x1aa5('0xe')]('Trigger,\x20%s,\x20%s',_0x1e22b9,_0x1aa5('0xf'));logger['debug'](_0x1aa5('0x10'),_0x1e22b9,'request\x20sent',JSON[_0x1aa5('0x11')](_0x5967bc));if(_0x5967bc[_0x1aa5('0x12')]){if(_0x5967bc[_0x1aa5('0x12')][_0x1aa5('0x13')]===0x1f4){logger[_0x1aa5('0x12')](_0x1aa5('0x14'),_0x1e22b9,_0x5967bc[_0x1aa5('0x12')][_0x1aa5('0x15')]);return _0x403bac(_0x5967bc[_0x1aa5('0x12')][_0x1aa5('0x15')]);}logger[_0x1aa5('0x12')]('Trigger,\x20%s,\x20%s',_0x1e22b9,_0x5967bc[_0x1aa5('0x12')]['message']);return _0x19d670(_0x5967bc[_0x1aa5('0x12')]['message']);}else{logger[_0x1aa5('0xe')](_0x1aa5('0x14'),_0x1e22b9,'request\x20sent');_0x19d670(_0x5967bc['result'][_0x1aa5('0x15')]);}})[_0x1aa5('0x16')](function(_0x42db9f){logger['error']('Trigger,\x20%s,\x20%s',_0x1e22b9,_0x42db9f);_0x403bac(_0x42db9f);});});}exports[_0x1aa5('0x17')]=function(_0x38f10c){var _0x43513d=this;return new Promise(function(_0x5e4aec,_0x588d6b){return db[_0x1aa5('0x18')][_0x1aa5('0x19')]({'raw':_0x38f10c[_0x1aa5('0x1a')]?_0x38f10c['options'][_0x1aa5('0x1b')]===undefined?!![]:![]:!![],'where':_0x38f10c['options']?_0x38f10c[_0x1aa5('0x1a')][_0x1aa5('0x1c')]||null:null,'attributes':_0x38f10c[_0x1aa5('0x1a')]?_0x38f10c[_0x1aa5('0x1a')]['attributes']||null:null,'limit':_0x38f10c[_0x1aa5('0x1a')]?_0x38f10c[_0x1aa5('0x1a')]['limit']||null:null,'include':_0x38f10c[_0x1aa5('0x1a')]?_0x38f10c[_0x1aa5('0x1a')][_0x1aa5('0x1d')]?_[_0x1aa5('0x1e')](_0x38f10c[_0x1aa5('0x1a')][_0x1aa5('0x1d')],function(_0x47730d){return{'model':db[_0x47730d['model']],'as':_0x47730d['as'],'attributes':_0x47730d[_0x1aa5('0x1f')],'include':_0x47730d[_0x1aa5('0x1d')]?_[_0x1aa5('0x1e')](_0x47730d[_0x1aa5('0x1d')],function(_0x2762a8){return{'model':db[_0x2762a8[_0x1aa5('0x20')]],'as':_0x2762a8['as'],'attributes':_0x2762a8[_0x1aa5('0x1f')],'include':_0x2762a8[_0x1aa5('0x1d')]?_['map'](_0x2762a8[_0x1aa5('0x1d')],function(_0x284849){return{'model':db[_0x284849[_0x1aa5('0x20')]],'as':_0x284849['as'],'attributes':_0x284849[_0x1aa5('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24d727){logger[_0x1aa5('0xe')]('GetTrigger',_0x38f10c);logger[_0x1aa5('0x21')](_0x1aa5('0x17'),_0x38f10c,JSON[_0x1aa5('0x11')](_0x24d727));_0x5e4aec(_0x24d727);})[_0x1aa5('0x16')](function(_0x11f1ca){logger['error'](_0x1aa5('0x17'),_0x11f1ca[_0x1aa5('0x15')],_0x38f10c);_0x588d6b(_0x43513d[_0x1aa5('0x12')](0x1f4,_0x11f1ca[_0x1aa5('0x15')]));});});};exports[_0x1aa5('0x22')]=function(_0x2ea45d){var _0x276269=this;return new Promise(function(_0x4aa90e,_0x1ef417){return db['Trigger'][_0x1aa5('0x23')]({'raw':_0x2ea45d[_0x1aa5('0x1a')]?_0x2ea45d[_0x1aa5('0x1a')][_0x1aa5('0x1b')]===undefined?!![]:![]:!![],'where':_0x2ea45d[_0x1aa5('0x1a')]?_0x2ea45d[_0x1aa5('0x1a')][_0x1aa5('0x1c')]||null:null,'attributes':_0x2ea45d[_0x1aa5('0x1a')]?_0x2ea45d[_0x1aa5('0x1a')][_0x1aa5('0x1f')]||null:null,'include':_0x2ea45d[_0x1aa5('0x1a')]?_0x2ea45d[_0x1aa5('0x1a')][_0x1aa5('0x1d')]?_['map'](_0x2ea45d[_0x1aa5('0x1a')]['include'],function(_0x3cebaa){return{'model':db[_0x3cebaa[_0x1aa5('0x20')]],'as':_0x3cebaa['as'],'attributes':_0x3cebaa[_0x1aa5('0x1f')],'include':_0x3cebaa[_0x1aa5('0x1d')]?_[_0x1aa5('0x1e')](_0x3cebaa['include'],function(_0x2b3a49){return{'model':db[_0x2b3a49[_0x1aa5('0x20')]],'as':_0x2b3a49['as'],'attributes':_0x2b3a49[_0x1aa5('0x1f')],'include':_0x2b3a49[_0x1aa5('0x1d')]?_[_0x1aa5('0x1e')](_0x2b3a49['include'],function(_0x4a99d0){return{'model':db[_0x4a99d0['model']],'as':_0x4a99d0['as'],'attributes':_0x4a99d0[_0x1aa5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1aa5('0xd')](function(_0x167c1d){logger['info'](_0x1aa5('0x22'),_0x2ea45d);logger[_0x1aa5('0x21')](_0x1aa5('0x22'),_0x2ea45d,JSON[_0x1aa5('0x11')](_0x167c1d));_0x4aa90e(_0x167c1d);})[_0x1aa5('0x16')](function(_0x4684db){logger['error']('ShowTrigger',_0x4684db[_0x1aa5('0x15')],_0x2ea45d);_0x1ef417(_0x276269[_0x1aa5('0x12')](0x1f4,_0x4684db[_0x1aa5('0x15')]));});});}; \ No newline at end of file +var _0x395f=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','info','result','catch','findAll','options','raw','attributes','limit','map','include','model','GetTrigger','Trigger','find','ShowTrigger','util','bluebird','randomstring','ioredis'];(function(_0x30d618,_0x590668){var _0x39731a=function(_0x53e0fe){while(--_0x53e0fe){_0x30d618['push'](_0x30d618['shift']());}};_0x39731a(++_0x590668);}(_0x395f,0x84));var _0xf395=function(_0x16bd7f,_0x179be7){_0x16bd7f=_0x16bd7f-0x0;var _0xbf7a02=_0x395f[_0x16bd7f];return _0xbf7a02;};'use strict';var _=require('lodash');var util=require(_0xf395('0x0'));var moment=require('moment');var BPromise=require(_0xf395('0x1'));var rs=require(_0xf395('0x2'));var fs=require('fs');var Redis=require(_0xf395('0x3'));var db=require(_0xf395('0x4'))['db'];var utils=require(_0xf395('0x5'));var logger=require(_0xf395('0x6'))(_0xf395('0x7'));var config=require('../../config/environment');var jayson=require(_0xf395('0x8'));var client=jayson['client'][_0xf395('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x511c6e,_0x504547,_0x371432){return new BPromise(function(_0x5b03c5,_0x3043bc){return client[_0xf395('0xa')](_0x511c6e,_0x371432)[_0xf395('0xb')](function(_0x234554){logger['info']('Trigger,\x20%s,\x20%s',_0x504547,_0xf395('0xc'));logger[_0xf395('0xd')](_0xf395('0xe'),_0x504547,_0xf395('0xc'),JSON[_0xf395('0xf')](_0x234554));if(_0x234554[_0xf395('0x10')]){if(_0x234554['error']['code']===0x1f4){logger[_0xf395('0x10')](_0xf395('0x11'),_0x504547,_0x234554[_0xf395('0x10')][_0xf395('0x12')]);return _0x3043bc(_0x234554[_0xf395('0x10')]['message']);}logger[_0xf395('0x10')](_0xf395('0x11'),_0x504547,_0x234554[_0xf395('0x10')][_0xf395('0x12')]);return _0x5b03c5(_0x234554[_0xf395('0x10')][_0xf395('0x12')]);}else{logger[_0xf395('0x13')](_0xf395('0x11'),_0x504547,_0xf395('0xc'));_0x5b03c5(_0x234554[_0xf395('0x14')][_0xf395('0x12')]);}})[_0xf395('0x15')](function(_0x10a53b){logger['error'](_0xf395('0x11'),_0x504547,_0x10a53b);_0x3043bc(_0x10a53b);});});}exports['GetTrigger']=function(_0x21878b){var _0x5eae2c=this;return new Promise(function(_0x3dd71c,_0x5a18a8){return db['Trigger'][_0xf395('0x16')]({'raw':_0x21878b[_0xf395('0x17')]?_0x21878b[_0xf395('0x17')][_0xf395('0x18')]===undefined?!![]:![]:!![],'where':_0x21878b[_0xf395('0x17')]?_0x21878b[_0xf395('0x17')]['where']||null:null,'attributes':_0x21878b['options']?_0x21878b[_0xf395('0x17')][_0xf395('0x19')]||null:null,'limit':_0x21878b['options']?_0x21878b[_0xf395('0x17')][_0xf395('0x1a')]||null:null,'include':_0x21878b[_0xf395('0x17')]?_0x21878b[_0xf395('0x17')]['include']?_[_0xf395('0x1b')](_0x21878b[_0xf395('0x17')][_0xf395('0x1c')],function(_0x3fccba){return{'model':db[_0x3fccba['model']],'as':_0x3fccba['as'],'attributes':_0x3fccba[_0xf395('0x19')],'include':_0x3fccba[_0xf395('0x1c')]?_[_0xf395('0x1b')](_0x3fccba['include'],function(_0x5cea96){return{'model':db[_0x5cea96['model']],'as':_0x5cea96['as'],'attributes':_0x5cea96[_0xf395('0x19')],'include':_0x5cea96[_0xf395('0x1c')]?_['map'](_0x5cea96[_0xf395('0x1c')],function(_0x2cce42){return{'model':db[_0x2cce42[_0xf395('0x1d')]],'as':_0x2cce42['as'],'attributes':_0x2cce42[_0xf395('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf395('0xb')](function(_0x5e9568){logger[_0xf395('0x13')](_0xf395('0x1e'),_0x21878b);logger[_0xf395('0xd')]('GetTrigger',_0x21878b,JSON[_0xf395('0xf')](_0x5e9568));_0x3dd71c(_0x5e9568);})[_0xf395('0x15')](function(_0x210e11){logger[_0xf395('0x10')](_0xf395('0x1e'),_0x210e11[_0xf395('0x12')],_0x21878b);_0x5a18a8(_0x5eae2c[_0xf395('0x10')](0x1f4,_0x210e11[_0xf395('0x12')]));});});};exports['ShowTrigger']=function(_0x8024cf){var _0x4ea308=this;return new Promise(function(_0x29ba33,_0xbc0772){return db[_0xf395('0x1f')][_0xf395('0x20')]({'raw':_0x8024cf[_0xf395('0x17')]?_0x8024cf[_0xf395('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x8024cf[_0xf395('0x17')]?_0x8024cf['options']['where']||null:null,'attributes':_0x8024cf[_0xf395('0x17')]?_0x8024cf[_0xf395('0x17')][_0xf395('0x19')]||null:null,'include':_0x8024cf[_0xf395('0x17')]?_0x8024cf[_0xf395('0x17')][_0xf395('0x1c')]?_[_0xf395('0x1b')](_0x8024cf[_0xf395('0x17')][_0xf395('0x1c')],function(_0x1711b0){return{'model':db[_0x1711b0[_0xf395('0x1d')]],'as':_0x1711b0['as'],'attributes':_0x1711b0['attributes'],'include':_0x1711b0[_0xf395('0x1c')]?_[_0xf395('0x1b')](_0x1711b0[_0xf395('0x1c')],function(_0xe6a19){return{'model':db[_0xe6a19[_0xf395('0x1d')]],'as':_0xe6a19['as'],'attributes':_0xe6a19[_0xf395('0x19')],'include':_0xe6a19[_0xf395('0x1c')]?_[_0xf395('0x1b')](_0xe6a19['include'],function(_0x2d56b7){return{'model':db[_0x2d56b7[_0xf395('0x1d')]],'as':_0x2d56b7['as'],'attributes':_0x2d56b7['attributes']};}):[]};}):[]};}):[]:[]})[_0xf395('0xb')](function(_0x5ac8fb){logger[_0xf395('0x13')]('ShowTrigger',_0x8024cf);logger[_0xf395('0xd')](_0xf395('0x21'),_0x8024cf,JSON['stringify'](_0x5ac8fb));_0x29ba33(_0x5ac8fb);})[_0xf395('0x15')](function(_0x4238e5){logger[_0xf395('0x10')](_0xf395('0x21'),_0x4238e5[_0xf395('0x12')],_0x8024cf);_0xbc0772(_0x4ea308[_0xf395('0x10')](0x1f4,_0x4238e5[_0xf395('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 5429271..bd87edc 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 _0x7bfe=['express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','clone','create','delete','exports','multer','util','path','connect-timeout'];(function(_0x5cd553,_0x31f5eb){var _0x121d20=function(_0x38af78){while(--_0x38af78){_0x5cd553['push'](_0x5cd553['shift']());}};_0x121d20(++_0x31f5eb);}(_0x7bfe,0x10a));var _0xe7bf=function(_0x2c782b,_0x3864de){_0x2c782b=_0x2c782b-0x0;var _0x5999d4=_0x7bfe[_0x2c782b];return _0x5999d4;};'use strict';var multer=require(_0xe7bf('0x0'));var util=require(_0xe7bf('0x1'));var path=require(_0xe7bf('0x2'));var timeout=require(_0xe7bf('0x3'));var express=require(_0xe7bf('0x4'));var router=express['Router']();var fs_extra=require(_0xe7bf('0x5'));var auth=require(_0xe7bf('0x6'));var interaction=require(_0xe7bf('0x7'));var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0xe7bf('0x8')]('/',auth[_0xe7bf('0x9')](),controller[_0xe7bf('0xa')]);router[_0xe7bf('0x8')](_0xe7bf('0xb'),auth[_0xe7bf('0x9')](),controller[_0xe7bf('0xc')]);router[_0xe7bf('0xd')]('/:id/clone',auth['isAuthenticated'](),controller[_0xe7bf('0xe')]);router[_0xe7bf('0xd')]('/',auth[_0xe7bf('0x9')](),controller[_0xe7bf('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe7bf('0x10')]('/:id',auth[_0xe7bf('0x9')](),controller['destroy']);module[_0xe7bf('0x11')]=router; \ No newline at end of file +var _0x420d=['index','clone','post','create','put','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x4d9450,_0x4e487c){var _0x5f32ff=function(_0x2fe4aa){while(--_0x2fe4aa){_0x4d9450['push'](_0x4d9450['shift']());}};_0x5f32ff(++_0x4e487c);}(_0x420d,0x15c));var _0xd420=function(_0x3ec957,_0x67d1ef){_0x3ec957=_0x3ec957-0x0;var _0x216b3d=_0x420d[_0x3ec957];return _0x216b3d;};'use strict';var multer=require(_0xd420('0x0'));var util=require(_0xd420('0x1'));var path=require('path');var timeout=require(_0xd420('0x2'));var express=require('express');var router=express[_0xd420('0x3')]();var fs_extra=require(_0xd420('0x4'));var auth=require(_0xd420('0x5'));var interaction=require(_0xd420('0x6'));var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0xd420('0x7')]('/',auth[_0xd420('0x8')](),controller[_0xd420('0x9')]);router['get']('/:id',auth[_0xd420('0x8')](),controller['show']);router['post']('/:id/clone',auth[_0xd420('0x8')](),controller[_0xd420('0xa')]);router[_0xd420('0xb')]('/',auth['isAuthenticated'](),controller[_0xd420('0xc')]);router[_0xd420('0xd')](_0xd420('0xe'),auth[_0xd420('0x8')](),controller['update']);router['delete'](_0xd420('0xe'),auth[_0xd420('0x8')](),controller[_0xd420('0xf')]);module[_0xd420('0x10')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index f735164..d42e77f 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 _0x45c2=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','uas','pai','certificate','active','actpass','dynamic','nonat','sequelize','exports','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','STRING','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','yes','update','outgoing','join','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure'];(function(_0x3bf188,_0x19cec9){var _0xe26e3a=function(_0x409249){while(--_0x409249){_0x3bf188['push'](_0x3bf188['shift']());}};_0xe26e3a(++_0x19cec9);}(_0x45c2,0x12d));var _0x245c=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0x45c2[_0x136619];return _0x38c4a5;};'use strict';var Sequelize=require(_0x245c('0x0'));module[_0x245c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x245c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x4'),_0x245c('0x5'),_0x245c('0x6')),'allowNull':![],'defaultValue':_0x245c('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x245c('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0x245c('0x8'),_0x245c('0x9'),_0x245c('0xa'),'ALLOWED',_0x245c('0xb'),_0x245c('0xc'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x245c('0xd')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x245c('0xd')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x245c('0xd')],'defaultValue':_0x245c('0xe'),'set':function(_0x3aa486){this[_0x245c('0xf')](_0x245c('0x10'),_0x3aa486?_0x3aa486['join'](','):null);},'get':function(){return this[_0x245c('0x11')]('transport')?this[_0x245c('0x11')](_0x245c('0x10'))[_0x245c('0x12')](','):null;},'comment':_0x245c('0x13')},'dtmfmode':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x14'),_0x245c('0x15'),'shortinfo',_0x245c('0x16'),_0x245c('0x17')),'defaultValue':_0x245c('0x14')},'directmedia':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x18'),'no','nonat',_0x245c('0x19'),_0x245c('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x245c('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x245c('0xd')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x245c('0xd')],'defaultValue':'force_rport,comedia','set':function(_0x5f31af){this[_0x245c('0xf')]('nat',_0x5f31af?_0x5f31af[_0x245c('0x1b')](','):null);},'get':function(){return this[_0x245c('0x11')](_0x245c('0x1c'))?this[_0x245c('0x11')](_0x245c('0x1c'))[_0x245c('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x245c('0xd')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x245c('0xd')]},'language':{'type':Sequelize[_0x245c('0xd')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x245c('0xd')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x245c('0xd')],'defaultValue':_0x245c('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x245c('0x1e'),'set':function(_0x43b352){this[_0x245c('0xf')]('allow',_0x43b352?_0x43b352[_0x245c('0x1b')](';'):_0x245c('0x1e'));},'get':function(){return this[_0x245c('0x11')](_0x245c('0x1f'))?this[_0x245c('0x11')]('allow')[_0x245c('0x12')](';'):null;},'comment':_0x245c('0x20')},'autoframing':{'type':Sequelize['ENUM'](_0x245c('0x18'),'no')},'insecure':{'type':Sequelize[_0x245c('0xd')],'defaultValue':_0x245c('0x21'),'set':function(_0x10f5e5){this[_0x245c('0xf')](_0x245c('0x22'),_0x10f5e5?_0x10f5e5[_0x245c('0x1b')](','):null);},'get':function(){return this[_0x245c('0x11')]('insecure')?this[_0x245c('0x11')]('insecure')['split'](','):null;},'comment':_0x245c('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0x245c('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x18'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x245c('0x18'),'no',_0x245c('0x24'))},'promiscredir':{'type':Sequelize[_0x245c('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x18'),'no')},'accountcode':{'type':Sequelize[_0x245c('0x25')](0xb)},'setvar':{'type':Sequelize[_0x245c('0xd')]},'callerid':{'type':Sequelize[_0x245c('0xd')],'defaultValue':_0x245c('0x26')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x18'),'no'),'defaultValue':_0x245c('0x18')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x18'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x245c('0x18'),'no')},'allowtransfer':{'type':Sequelize[_0x245c('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x18'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x18'),'no',_0x245c('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x18'),'no')},'mailbox':{'type':Sequelize[_0x245c('0xd')]},'session_timers':{'type':Sequelize[_0x245c('0x3')]('accept',_0x245c('0x28'),'originate')},'session_expires':{'type':Sequelize[_0x245c('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x245c('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x245c('0x3')]('uac',_0x245c('0x29')),'defaultValue':_0x245c('0x29')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x245c('0xd')]},'fromdomain':{'type':Sequelize[_0x245c('0xd')]},'fromuser':{'type':Sequelize[_0x245c('0xd')]},'port':{'type':Sequelize[_0x245c('0x25')](0x5)},'qualify':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x18'),'no'),'defaultValue':_0x245c('0x18')},'keepalive':{'type':Sequelize[_0x245c('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x245c('0xd')]},'defaultuser':{'type':Sequelize[_0x245c('0xd')]},'rtptimeout':{'type':Sequelize[_0x245c('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x245c('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x245c('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x18'),'no',_0x245c('0x2a')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x245c('0xd')]},'callbackextension':{'type':Sequelize[_0x245c('0xd')]},'timert1':{'type':Sequelize[_0x245c('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x245c('0x25')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x245c('0xd')]},'contactacl':{'type':Sequelize[_0x245c('0xd')]},'unsolicited_mailbox':{'type':Sequelize[_0x245c('0xd')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x245c('0x25')](0xb)},'encryption':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x18'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x245c('0x18'),'no')},'force_avp':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x18'),'no')},'icesupport':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x18'),'no')},'dtlsverify':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x18'),'no','fingerprint',_0x245c('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x245c('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x245c('0xd')]},'dtlsprivatekey':{'type':Sequelize[_0x245c('0xd')]},'dtlscipher':{'type':Sequelize[_0x245c('0xd')]},'dtlscafile':{'type':Sequelize[_0x245c('0xd')]},'dtlscapath':{'type':Sequelize[_0x245c('0xd')]},'dtlssetup':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x2c'),'passive',_0x245c('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x245c('0xd')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x245c('0xd')]},'call_limit':{'type':Sequelize[_0x245c('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0x245c('0x3')](_0x245c('0x18'),'no')},'vmexten':{'type':Sequelize[_0x245c('0xd')]},'mohinterpret':{'type':Sequelize[_0x245c('0xd')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x245c('0xd')]},'description':{'type':Sequelize[_0x245c('0xd')]},'host':{'type':Sequelize[_0x245c('0xd')],'defaultValue':_0x245c('0x2e')},'canreinvite':{'type':Sequelize[_0x245c('0x3')]('yes','no',_0x245c('0x2f'),_0x245c('0x19'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x245c('0xd')]},'otherFields':{'type':Sequelize[_0x245c('0xd')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x245c('0xd')],'defaultValue':'no'}}; \ No newline at end of file +var _0x8a44=['uas','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uac'];(function(_0x408b34,_0xb7d872){var _0x1182aa=function(_0x1825c4){while(--_0x1825c4){_0x408b34['push'](_0x408b34['shift']());}};_0x1182aa(++_0xb7d872);}(_0x8a44,0x117));var _0x48a4=function(_0x1442e6,_0x5f335d){_0x1442e6=_0x1442e6-0x0;var _0x44ea30=_0x8a44[_0x1442e6];return _0x44ea30;};'use strict';var Sequelize=require('sequelize');module[_0x48a4('0x0')]={'name':{'type':Sequelize[_0x48a4('0x1')],'allowNull':![],'unique':_0x48a4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x4'),_0x48a4('0x5'),_0x48a4('0x6')),'allowNull':![],'defaultValue':_0x48a4('0x4')},'context':{'type':Sequelize[_0x48a4('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0x48a4('0x7'),_0x48a4('0x8'),_0x48a4('0x9'),_0x48a4('0xa'),_0x48a4('0xb'),_0x48a4('0xc'),_0x48a4('0xd'),_0x48a4('0xe'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x48a4('0x1')]},'remotesecret':{'type':Sequelize[_0x48a4('0x1')]},'transport':{'type':Sequelize[_0x48a4('0x1')],'defaultValue':_0x48a4('0xf'),'set':function(_0x3436a4){this[_0x48a4('0x10')]('transport',_0x3436a4?_0x3436a4[_0x48a4('0x11')](','):null);},'get':function(){return this[_0x48a4('0x12')]('transport')?this[_0x48a4('0x12')](_0x48a4('0x13'))[_0x48a4('0x14')](','):null;},'comment':_0x48a4('0x15')},'dtmfmode':{'type':Sequelize['ENUM'](_0x48a4('0x16'),_0x48a4('0x17'),_0x48a4('0x18'),_0x48a4('0x19'),'auto'),'defaultValue':_0x48a4('0x16')},'directmedia':{'type':Sequelize['ENUM'](_0x48a4('0x1a'),'no',_0x48a4('0x1b'),_0x48a4('0x1c'),_0x48a4('0x1d')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x48a4('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x48a4('0x1')],'defaultValue':_0x48a4('0x1e'),'set':function(_0x256e9d){this[_0x48a4('0x10')](_0x48a4('0x1f'),_0x256e9d?_0x256e9d[_0x48a4('0x11')](','):null);},'get':function(){return this[_0x48a4('0x12')]('nat')?this[_0x48a4('0x12')](_0x48a4('0x1f'))[_0x48a4('0x14')](','):null;},'comment':_0x48a4('0x20')},'callgroup':{'type':Sequelize[_0x48a4('0x1')]},'namedcallgroup':{'type':Sequelize[_0x48a4('0x1')]},'pickupgroup':{'type':Sequelize[_0x48a4('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x48a4('0x1')]},'language':{'type':Sequelize[_0x48a4('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x48a4('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x48a4('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x488da1){this['setDataValue'](_0x48a4('0x21'),_0x488da1?_0x488da1[_0x48a4('0x11')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x48a4('0x12')]('allow')?this[_0x48a4('0x12')](_0x48a4('0x21'))[_0x48a4('0x14')](';'):null;},'comment':_0x48a4('0x22')},'autoframing':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x1a'),'no')},'insecure':{'type':Sequelize[_0x48a4('0x1')],'defaultValue':_0x48a4('0x23'),'set':function(_0x23be22){this[_0x48a4('0x10')]('insecure',_0x23be22?_0x23be22[_0x48a4('0x11')](','):null);},'get':function(){return this['getDataValue'](_0x48a4('0x24'))?this[_0x48a4('0x12')](_0x48a4('0x24'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x48a4('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x1a'),'no',_0x48a4('0x25'))},'promiscredir':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x1a'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x48a4('0x1')]},'callerid':{'type':Sequelize[_0x48a4('0x1')],'defaultValue':_0x48a4('0x26')},'amaflags':{'type':Sequelize[_0x48a4('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x48a4('0x1a'),'no'),'defaultValue':_0x48a4('0x1a')},'busylevel':{'type':Sequelize[_0x48a4('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x48a4('0x1')]},'template':{'type':Sequelize[_0x48a4('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x48a4('0x1a'),'no',_0x48a4('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x48a4('0x27')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x48a4('0x1a'),'no')},'mailbox':{'type':Sequelize[_0x48a4('0x1')]},'session_timers':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x29'),_0x48a4('0x2a'),_0x48a4('0x2b'))},'session_expires':{'type':Sequelize[_0x48a4('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x48a4('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x2c'),_0x48a4('0x2d')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x48a4('0x1')]},'regexten':{'type':Sequelize[_0x48a4('0x1')]},'fromdomain':{'type':Sequelize[_0x48a4('0x1')]},'fromuser':{'type':Sequelize[_0x48a4('0x1')]},'port':{'type':Sequelize[_0x48a4('0x27')](0x5)},'qualify':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x1a'),'no'),'defaultValue':_0x48a4('0x1a')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x48a4('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x48a4('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x48a4('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x1a'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x48a4('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x48a4('0x27')](0xb)},'timerb':{'type':Sequelize[_0x48a4('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x48a4('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0x48a4('0x1')]},'contactdeny':{'type':Sequelize[_0x48a4('0x1')]},'contactacl':{'type':Sequelize[_0x48a4('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x48a4('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x48a4('0x27')](0xb)},'encryption':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x48a4('0x1a'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0x48a4('0x1a'),'no')},'icesupport':{'type':Sequelize[_0x48a4('0x3')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x1a'),'no')},'dtlsverify':{'type':Sequelize[_0x48a4('0x3')]('yes','no',_0x48a4('0x2e'),_0x48a4('0x2f'))},'dtlsrekey':{'type':Sequelize[_0x48a4('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x48a4('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x48a4('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x48a4('0x1')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x30'),_0x48a4('0x31'),_0x48a4('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x48a4('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x48a4('0x1')]},'recordofffeature':{'type':Sequelize[_0x48a4('0x1')]},'call_limit':{'type':Sequelize[_0x48a4('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x48a4('0x3')]('yes','no')},'subscribemwi':{'type':Sequelize[_0x48a4('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0x48a4('0x1')]},'mohinterpret':{'type':Sequelize[_0x48a4('0x1')]},'mohsuggest':{'type':Sequelize[_0x48a4('0x1')]},'parkinglot':{'type':Sequelize[_0x48a4('0x1')]},'description':{'type':Sequelize[_0x48a4('0x1')]},'host':{'type':Sequelize[_0x48a4('0x1')],'defaultValue':_0x48a4('0x33')},'canreinvite':{'type':Sequelize[_0x48a4('0x3')](_0x48a4('0x1a'),'no',_0x48a4('0x1b'),_0x48a4('0x1c'),_0x48a4('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x48a4('0x1')]},'otherFields':{'type':Sequelize[_0x48a4('0x1')]},'active':{'type':Sequelize[_0x48a4('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x48a4('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 3fcfa02..d28847a 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 _0x425d=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','UserProfileSection','userProfileId','/etc/asterisk/sip_xcally_trunks.conf','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','Trunk,\x20%s,\x20%s','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','get','Trunks','UserProfileResource','stack','name','send','index','map','Trunk','rawAttributes','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','clone','find','omit','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8'];(function(_0x4978c8,_0x195631){var _0x42c3e2=function(_0x270461){while(--_0x270461){_0x4978c8['push'](_0x4978c8['shift']());}};_0x42c3e2(++_0x195631);}(_0x425d,0x1e0));var _0xd425=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0x425d[_0xabfec4];return _0x7bafa2;};'use strict';var emlformat=require(_0xd425('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd425('0x1'));var jsonpatch=require(_0xd425('0x2'));var rp=require(_0xd425('0x3'));var moment=require(_0xd425('0x4'));var BPromise=require(_0xd425('0x5'));var Mustache=require(_0xd425('0x6'));var util=require(_0xd425('0x7'));var path=require('path');var sox=require(_0xd425('0x8'));var csv=require(_0xd425('0x9'));var ejs=require(_0xd425('0xa'));var fs=require('fs');var fs_extra=require(_0xd425('0xb'));var _=require(_0xd425('0xc'));var squel=require(_0xd425('0xd'));var crypto=require('crypto');var jsforce=require(_0xd425('0xe'));var deskjs=require(_0xd425('0xf'));var toCsv=require(_0xd425('0x9'));var querystring=require(_0xd425('0x10'));var Papa=require(_0xd425('0x11'));var Redis=require(_0xd425('0x12'));var authService=require(_0xd425('0x13'));var qs=require(_0xd425('0x14'));var as=require(_0xd425('0x15'));var hardwareService=require(_0xd425('0x16'));var logger=require(_0xd425('0x17'))(_0xd425('0x18'));var utils=require(_0xd425('0x19'));var config=require(_0xd425('0x1a'));var licenseUtil=require(_0xd425('0x1b'));var db=require(_0xd425('0x1c'))['db'];var jayson=require(_0xd425('0x1d'));var client=jayson[_0xd425('0x1e')][_0xd425('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x18eafb,_0x51263f,_0x27318c,_0x17a498){return new BPromise(function(_0x336dc3,_0x5d3d60){var _0x309263=_0x17a498||client;return _0x309263[_0xd425('0x20')](_0x18eafb,_0x27318c)[_0xd425('0x21')](function(_0x41f34d){logger[_0xd425('0x22')]('Trunk,\x20%s,\x20%s',_0x51263f,_0xd425('0x23'));logger[_0xd425('0x24')](_0xd425('0x25'),_0x51263f,_0xd425('0x23'),JSON['stringify'](_0x41f34d));if(_0x41f34d[_0xd425('0x26')]){if(_0x41f34d[_0xd425('0x26')][_0xd425('0x27')]===0x1f4){logger[_0xd425('0x26')]('Trunk,\x20%s,\x20%s',_0x51263f,_0x41f34d['error']['message']);return _0x5d3d60(_0x41f34d['error'][_0xd425('0x28')]);}logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x41f34d['error'][_0xd425('0x28')]);return _0x336dc3(_0x41f34d[_0xd425('0x26')]['message']);}else{logger[_0xd425('0x22')](_0xd425('0x29'),_0x51263f,_0xd425('0x23'));_0x336dc3(_0x41f34d[_0xd425('0x2a')][_0xd425('0x28')]);}})[_0xd425('0x2b')](function(_0x2480a0){logger[_0xd425('0x26')](_0xd425('0x29'),_0x51263f,_0x2480a0);_0x5d3d60(_0x2480a0);});});}function respondWithStatusCode(_0x2b030b,_0x151ad9){_0x151ad9=_0x151ad9||0xcc;return function(_0x40e84b){if(_0x40e84b){return _0x2b030b['sendStatus'](_0x151ad9);}return _0x2b030b[_0xd425('0x2c')](_0x151ad9)[_0xd425('0x2d')]();};}function respondWithResult(_0x398985,_0x1908a5){_0x1908a5=_0x1908a5||0xc8;return function(_0x2afcdb){if(_0x2afcdb){return _0x398985[_0xd425('0x2c')](_0x1908a5)[_0xd425('0x2e')](_0x2afcdb);}};}function respondWithFilteredResult(_0x577e4b,_0x12f951){return function(_0x177de2){if(_0x177de2){var _0x1d8861=typeof _0x12f951['offset']===_0xd425('0x2f')&&typeof _0x12f951[_0xd425('0x30')]===_0xd425('0x2f');var _0x999fb9=_0x177de2[_0xd425('0x31')];var _0x185d7e=_0x1d8861?0x0:_0x12f951[_0xd425('0x32')];var _0x37b63c=_0x1d8861?_0x177de2[_0xd425('0x31')]:_0x12f951[_0xd425('0x32')]+_0x12f951['limit'];var _0x471e3e;if(_0x37b63c>=_0x999fb9){_0x37b63c=_0x999fb9;_0x471e3e=0xc8;}else{_0x471e3e=0xce;}_0x577e4b[_0xd425('0x2c')](_0x471e3e);return _0x577e4b[_0xd425('0x33')](_0xd425('0x34'),_0x185d7e+'-'+_0x37b63c+'/'+_0x999fb9)[_0xd425('0x2e')](_0x177de2);}return null;};}function patchUpdates(_0x1abf33){return function(_0x47405f){try{jsonpatch[_0xd425('0x35')](_0x47405f,_0x1abf33,!![]);}catch(_0x3ec51b){return BPromise[_0xd425('0x36')](_0x3ec51b);}return _0x47405f[_0xd425('0x37')]();};}function saveUpdates(_0x5f3dab,_0x316493){return function(_0x2a2a9b){if(_0x2a2a9b){return _0x2a2a9b[_0xd425('0x38')](_0x5f3dab)[_0xd425('0x21')](function(_0x28870f){return _0x28870f;});}return null;};}function removeEntity(_0x4eddbc,_0x4aa168){return function(_0x3badcc){if(_0x3badcc){return _0x3badcc['destroy']()['then'](function(){var _0x51669d=_0x3badcc[_0xd425('0x39')]({'plain':!![]});var _0xfb0c8=_0xd425('0x3a');return db[_0xd425('0x3b')]['destroy']({'where':{'type':_0xfb0c8,'resourceId':_0x51669d['id']}})[_0xd425('0x21')](function(){return _0x3badcc;});})[_0xd425('0x21')](function(){_0x4eddbc[_0xd425('0x2c')](0xcc)[_0xd425('0x2d')]();});}};}function handleEntityNotFound(_0x27b9e2,_0x1e12f2){return function(_0x35bbec){if(!_0x35bbec){_0x27b9e2['sendStatus'](0x194);}return _0x35bbec;};}function handleError(_0x363fb0,_0x59b3d3){_0x59b3d3=_0x59b3d3||0x1f4;return function(_0x22df81){logger[_0xd425('0x26')](_0x22df81[_0xd425('0x3c')]);if(_0x22df81['name']){delete _0x22df81[_0xd425('0x3d')];}_0x363fb0[_0xd425('0x2c')](_0x59b3d3)[_0xd425('0x3e')](_0x22df81);};}exports[_0xd425('0x3f')]=function(_0x58f36d,_0x1d38fa){var _0x3cf540={},_0x59e326={},_0x5d310e={'count':0x0,'rows':[]};var _0x48fc85=_[_0xd425('0x40')](db[_0xd425('0x41')][_0xd425('0x42')],function(_0x588688){return{'name':_0x588688['fieldName'],'type':_0x588688['type'][_0xd425('0x43')]};});_0x59e326[_0xd425('0x44')]=_[_0xd425('0x40')](_0x48fc85,_0xd425('0x3d'));_0x59e326[_0xd425('0x45')]=_[_0xd425('0x46')](_0x58f36d[_0xd425('0x45')]);_0x59e326['filters']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],_0x59e326[_0xd425('0x45')]);_0x3cf540['attributes']=_[_0xd425('0x47')](_0x59e326[_0xd425('0x44')],qs[_0xd425('0x48')](_0x58f36d['query'][_0xd425('0x48')]));_0x3cf540[_0xd425('0x49')]=_0x3cf540[_0xd425('0x49')][_0xd425('0x4a')]?_0x3cf540['attributes']:_0x59e326[_0xd425('0x44')];if(!_0x58f36d[_0xd425('0x45')][_0xd425('0x4b')](_0xd425('0x4c'))){_0x3cf540[_0xd425('0x30')]=qs[_0xd425('0x30')](_0x58f36d[_0xd425('0x45')]['limit']);_0x3cf540[_0xd425('0x32')]=qs[_0xd425('0x32')](_0x58f36d['query'][_0xd425('0x32')]);}_0x3cf540['order']=qs['sort'](_0x58f36d[_0xd425('0x45')]['sort']);_0x3cf540[_0xd425('0x4d')]=qs['filters'](_[_0xd425('0x4e')](_0x58f36d[_0xd425('0x45')],_0x59e326[_0xd425('0x4f')]),_0x48fc85);if(_0x58f36d[_0xd425('0x45')][_0xd425('0x50')]){_0x3cf540['where']=_[_0xd425('0x51')](_0x3cf540['where'],{'$or':_[_0xd425('0x40')](_0x48fc85,function(_0x55a15d){if(_0x55a15d[_0xd425('0x52')]!==_0xd425('0x53')){var _0x3fd2ce={};_0x3fd2ce[_0x55a15d[_0xd425('0x3d')]]={'$like':'%'+_0x58f36d[_0xd425('0x45')]['filter']+'%'};return _0x3fd2ce;}})});}_0x3cf540=_[_0xd425('0x51')]({},_0x3cf540,_0x58f36d[_0xd425('0x54')]);var _0x35e77b={'where':_0x3cf540[_0xd425('0x4d')]};return db[_0xd425('0x41')]['count'](_0x35e77b)[_0xd425('0x21')](function(_0x177704){_0x5d310e[_0xd425('0x31')]=_0x177704;if(_0x58f36d[_0xd425('0x45')][_0xd425('0x55')]){_0x3cf540[_0xd425('0x56')]=[{'all':!![]}];}return db['Trunk'][_0xd425('0x57')](_0x3cf540);})[_0xd425('0x21')](function(_0x5bfac6){_0x5d310e[_0xd425('0x58')]=_0x5bfac6;return _0x5d310e;})[_0xd425('0x21')](respondWithFilteredResult(_0x1d38fa,_0x3cf540))[_0xd425('0x2b')](handleError(_0x1d38fa,null));};exports[_0xd425('0x59')]=function(_0x5c0219,_0x54f1d){var _0x2b8882={'raw':![],'where':{'id':_0x5c0219[_0xd425('0x5a')]['id']}},_0x4552cd={};_0x4552cd[_0xd425('0x44')]=_['keys'](db['Trunk'][_0xd425('0x42')]);_0x4552cd['query']=_[_0xd425('0x46')](_0x5c0219[_0xd425('0x45')]);_0x4552cd['filters']=_[_0xd425('0x47')](_0x4552cd['model'],_0x4552cd['query']);_0x2b8882[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4552cd[_0xd425('0x44')],qs[_0xd425('0x48')](_0x5c0219[_0xd425('0x45')][_0xd425('0x48')]));_0x2b8882[_0xd425('0x49')]=_0x2b8882[_0xd425('0x49')]['length']?_0x2b8882[_0xd425('0x49')]:_0x4552cd[_0xd425('0x44')];if(_0x5c0219[_0xd425('0x45')][_0xd425('0x55')]){_0x2b8882[_0xd425('0x56')]=[{'all':!![]}];}_0x2b8882=_[_0xd425('0x51')]({},_0x2b8882,_0x5c0219[_0xd425('0x54')]);return db[_0xd425('0x41')]['find'](_0x2b8882)['then'](handleEntityNotFound(_0x54f1d,null))['then'](respondWithResult(_0x54f1d,null))[_0xd425('0x2b')](handleError(_0x54f1d,null));};exports[_0xd425('0x5b')]=function(_0x3dec61,_0x3c6b49){var _0x59c286={'where':{'id':_0x3dec61['params']['id']}},_0x4fedc0={};_0x4fedc0['model']=_[_0xd425('0x46')](db[_0xd425('0x41')]['rawAttributes']);_0x59c286[_0xd425('0x49')]=_[_0xd425('0x47')](_0x4fedc0[_0xd425('0x44')],qs['fields'](_0x3dec61['query'][_0xd425('0x48')]));_0x59c286['attributes']=_0x59c286['attributes']['length']?_0x59c286[_0xd425('0x49')]:_0x4fedc0[_0xd425('0x44')];if(_0x3dec61[_0xd425('0x45')]['includeAll']){_0x59c286[_0xd425('0x56')]=[{'all':!![]}];}_0x59c286=_['merge']({},_0x59c286,_0x3dec61[_0xd425('0x54')]);return db[_0xd425('0x41')][_0xd425('0x5c')](_0x59c286)[_0xd425('0x21')](handleEntityNotFound(_0x3c6b49,null))[_0xd425('0x21')](function(_0xd261a){if(_0xd261a){var _0xa21f7c=_0xd261a[_0xd425('0x39')]({'plain':!![]});_0xa21f7c=qs[_0xd425('0x5d')](_0xa21f7c,['id','createdAt',_0xd425('0x5e')]);_0x3dec61[_0xd425('0x5f')]=_[_0xd425('0x5d')](_0x3dec61[_0xd425('0x5f')],['id','createdAt','updatedAt']);return db[_0xd425('0x41')][_0xd425('0x60')](_[_0xd425('0x51')](_0xa21f7c,_0x3dec61[_0xd425('0x5f')]),{'include':_0x3dec61[_0xd425('0x45')][_0xd425('0x55')]?[{'all':!![]}]:undefined})[_0xd425('0x21')](function(_0x44782a){var _0x1fcde4=_0x3dec61[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x1fcde4)throw new Error(_0xd425('0x62'));if(_0x1fcde4[_0xd425('0x63')]===_0xd425('0x61')){var _0x5e72db=_0x44782a[_0xd425('0x39')]({'plain':!![]});var _0x343cc1=_0xd425('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x343cc1,'userProfileId':_0x1fcde4['userProfileId']},'raw':!![]})[_0xd425('0x21')](function(_0x34d065){if(_0x34d065&&_0x34d065[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x5e72db['name'],'resourceId':_0x5e72db['id'],'type':_0x34d065[_0xd425('0x3d')],'sectionId':_0x34d065['id']},{})[_0xd425('0x21')](function(){return _0x44782a;});}else{return _0x44782a;}})[_0xd425('0x2b')](function(_0x5113fc){logger[_0xd425('0x26')](_0xd425('0x65'),_0x5113fc);throw _0x5113fc;});}return _0x44782a;});}})[_0xd425('0x21')](respondWithResult(_0x3c6b49,0xc9))[_0xd425('0x2b')](handleError(_0x3c6b49,null));};exports[_0xd425('0x60')]=function(_0x43b1a9,_0x38a762,_0x44db7f){var _0xcb1a64;return db[_0xd425('0x41')][_0xd425('0x60')](_0x43b1a9[_0xd425('0x5f')],{'raw':!![]})[_0xd425('0x21')](function(_0x285d54){_0xcb1a64=_0x285d54;return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})[_0xd425('0x21')](function(_0x25cae6){var _0x541218=fs['readFileSync'](path[_0xd425('0x66')](config['root'],_0xd425('0x67')),_0xd425('0x68'));var _0xb407bb=fs[_0xd425('0x69')](path['join'](config[_0xd425('0x6a')],_0xd425('0x6b')),_0xd425('0x68'));var _0x689332=ejs[_0xd425('0x6c')](_0x541218,{'trunks':_0x25cae6||[]});fs[_0xd425('0x6d')]('/etc/asterisk/sip_xcally_trunks.conf',_0x689332);if(_0xcb1a64['registry']){var _0x3ccffe=ejs[_0xd425('0x6c')](_0xb407bb,{'trunks':_0x25cae6||[]});fs['writeFileSync'](_0xd425('0x6e'),_0x3ccffe);}})['then'](function(){return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x60'),{'module':_0xd425('0x70')});})[_0xd425('0x21')](function(){var _0x376134=_0x43b1a9[_0xd425('0x61')][_0xd425('0x39')]({'plain':!![]});if(!_0x376134)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x376134[_0xd425('0x63')]===_0xd425('0x61')){var _0x24af3=_0xcb1a64[_0xd425('0x39')]({'plain':!![]});return db[_0xd425('0x71')]['find']({'where':{'name':_0xd425('0x3a'),'userProfileId':_0x376134[_0xd425('0x72')]},'raw':!![]})['then'](function(_0x2bb36f){if(_0x2bb36f&&_0x2bb36f[_0xd425('0x64')]===0x0){return db['UserProfileResource'][_0xd425('0x60')]({'name':_0x24af3[_0xd425('0x3d')],'resourceId':_0x24af3['id'],'type':_0x2bb36f[_0xd425('0x3d')],'sectionId':_0x2bb36f['id']},{})[_0xd425('0x21')](function(){return _0xcb1a64;});}else{return _0xcb1a64;}})[_0xd425('0x2b')](function(_0x572f23){logger[_0xd425('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x572f23);throw _0x572f23;});}return _0xcb1a64;})[_0xd425('0x21')](respondWithResult(_0x38a762,0xc9))[_0xd425('0x2b')](handleError(_0x38a762,null));};exports['update']=function(_0x2bf8e6,_0xcf7b51,_0x66d87b){var _0x1fc64d;return db['Trunk']['find']({'where':{'id':_0x2bf8e6[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0xcf7b51,null))[_0xd425('0x21')](saveUpdates(_0x2bf8e6['body'],null))[_0xd425('0x21')](function(_0xb1479e){if(_0xb1479e){_0x1fc64d=_0xb1479e;return db['Trunk'][_0xd425('0x57')]({'raw':!![]});}})['then'](function(_0x998ad1){if(_0x998ad1){var _0x46346c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config['root'],'server/files/templates/trunk.ejs'),_0xd425('0x68'));var _0x413a65=fs['readFileSync'](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x369f8b=ejs[_0xd425('0x6c')](_0x46346c,{'trunks':_0x998ad1||[]});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x369f8b);var _0xf251e6=ejs[_0xd425('0x6c')](_0x413a65,{'trunks':_0x998ad1||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0xf251e6);return respondWithRpcPromise(_0xd425('0x6f'),'update',{'module':_0xd425('0x70')});}return null;})[_0xd425('0x21')](function(_0x58cad5){if(_0x58cad5){return _0x1fc64d;}})[_0xd425('0x21')](respondWithResult(_0xcf7b51,null))[_0xd425('0x2b')](handleError(_0xcf7b51,null));};exports['destroy']=function(_0x592c40,_0x750685,_0x242ed8){var _0x16eac6;return db[_0xd425('0x41')][_0xd425('0x5c')]({'where':{'id':_0x592c40[_0xd425('0x5a')]['id']}})[_0xd425('0x21')](handleEntityNotFound(_0x750685,null))[_0xd425('0x21')](removeEntity(_0x750685,null))['then'](function(){return db[_0xd425('0x41')][_0xd425('0x57')]({'raw':!![]});})['then'](function(_0x2bbcf3){var _0x1d386c=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],_0xd425('0x67')),_0xd425('0x68'));var _0x2c3995=fs[_0xd425('0x69')](path[_0xd425('0x66')](config[_0xd425('0x6a')],'server/files/templates/registry.ejs'),_0xd425('0x68'));var _0x498e81=ejs['render'](_0x1d386c,{'trunks':_0x2bbcf3});var _0x2c8d63=ejs['render'](_0x2c3995,{'trunks':_0x2bbcf3});fs[_0xd425('0x6d')](_0xd425('0x73'),_0x498e81);fs[_0xd425('0x6d')](_0xd425('0x6e'),_0x2c8d63);return respondWithRpcPromise(_0xd425('0x6f'),_0xd425('0x74'),{'module':_0xd425('0x70')});})['catch'](handleError(_0x750685,null));}; \ No newline at end of file +var _0x00bb=['includeAll','findAll','rows','params','find','clone','rawAttributes','include','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','client','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Trunks','UserProfileResource','status','stack','name','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x36e9ed,_0x1f6c4c){var _0x226d7c=function(_0xf59265){while(--_0xf59265){_0x36e9ed['push'](_0x36e9ed['shift']());}};_0x226d7c(++_0x1f6c4c);}(_0x00bb,0x1d8));var _0xb00b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x00bb[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];var jayson=require(_0xb00b('0x15'));var client=jayson[_0xb00b('0x16')][_0xb00b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xef5d52,_0x1f1c1d,_0x4ada81,_0x218de2){return new BPromise(function(_0xb0d42e,_0x482fe6){var _0x88d95e=_0x218de2||client;return _0x88d95e[_0xb00b('0x18')](_0xef5d52,_0x4ada81)['then'](function(_0x5da36b){logger[_0xb00b('0x19')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,'request\x20sent');logger[_0xb00b('0x1a')](_0xb00b('0x1b'),_0x1f1c1d,_0xb00b('0x1c'),JSON[_0xb00b('0x1d')](_0x5da36b));if(_0x5da36b['error']){if(_0x5da36b[_0xb00b('0x1e')]['code']===0x1f4){logger[_0xb00b('0x1e')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0x482fe6(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0xb0d42e(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}else{logger[_0xb00b('0x19')](_0xb00b('0x20'),_0x1f1c1d,'request\x20sent');_0xb0d42e(_0x5da36b[_0xb00b('0x21')]['message']);}})[_0xb00b('0x22')](function(_0x121ec7){logger['error'](_0xb00b('0x20'),_0x1f1c1d,_0x121ec7);_0x482fe6(_0x121ec7);});});}function respondWithStatusCode(_0x2896d1,_0x520444){_0x520444=_0x520444||0xcc;return function(_0x3ab3cc){if(_0x3ab3cc){return _0x2896d1[_0xb00b('0x23')](_0x520444);}return _0x2896d1['status'](_0x520444)[_0xb00b('0x24')]();};}function respondWithResult(_0x243fdb,_0x3c9500){_0x3c9500=_0x3c9500||0xc8;return function(_0x8caadf){if(_0x8caadf){return _0x243fdb['status'](_0x3c9500)['json'](_0x8caadf);}};}function respondWithFilteredResult(_0x3785e9,_0x490380){return function(_0x550587){if(_0x550587){var _0x4a635e=typeof _0x490380[_0xb00b('0x25')]===_0xb00b('0x26')&&typeof _0x490380[_0xb00b('0x27')]===_0xb00b('0x26');var _0x1f14fa=_0x550587[_0xb00b('0x28')];var _0x15d3b9=_0x4a635e?0x0:_0x490380['offset'];var _0x22c22d=_0x4a635e?_0x550587['count']:_0x490380[_0xb00b('0x25')]+_0x490380[_0xb00b('0x27')];var _0x5424ca;if(_0x22c22d>=_0x1f14fa){_0x22c22d=_0x1f14fa;_0x5424ca=0xc8;}else{_0x5424ca=0xce;}_0x3785e9['status'](_0x5424ca);return _0x3785e9[_0xb00b('0x29')](_0xb00b('0x2a'),_0x15d3b9+'-'+_0x22c22d+'/'+_0x1f14fa)[_0xb00b('0x2b')](_0x550587);}return null;};}function patchUpdates(_0x183233){return function(_0x303625){try{jsonpatch[_0xb00b('0x2c')](_0x303625,_0x183233,!![]);}catch(_0x2e160a){return BPromise[_0xb00b('0x2d')](_0x2e160a);}return _0x303625[_0xb00b('0x2e')]();};}function saveUpdates(_0x54e247,_0x2b5f41){return function(_0x44918d){if(_0x44918d){return _0x44918d['update'](_0x54e247)[_0xb00b('0x2f')](function(_0x2f3b37){return _0x2f3b37;});}return null;};}function removeEntity(_0x5a5e5a,_0x456241){return function(_0x4d2ee5){if(_0x4d2ee5){return _0x4d2ee5[_0xb00b('0x30')]()[_0xb00b('0x2f')](function(){var _0x322879=_0x4d2ee5[_0xb00b('0x31')]({'plain':!![]});var _0x338864=_0xb00b('0x32');return db[_0xb00b('0x33')]['destroy']({'where':{'type':_0x338864,'resourceId':_0x322879['id']}})['then'](function(){return _0x4d2ee5;});})['then'](function(){_0x5a5e5a[_0xb00b('0x34')](0xcc)[_0xb00b('0x24')]();});}};}function handleEntityNotFound(_0x45dcda,_0x2589cb){return function(_0x5cfa60){if(!_0x5cfa60){_0x45dcda[_0xb00b('0x23')](0x194);}return _0x5cfa60;};}function handleError(_0x266f8e,_0x341f46){_0x341f46=_0x341f46||0x1f4;return function(_0x1c7a9f){logger[_0xb00b('0x1e')](_0x1c7a9f[_0xb00b('0x35')]);if(_0x1c7a9f[_0xb00b('0x36')]){delete _0x1c7a9f[_0xb00b('0x36')];}_0x266f8e['status'](_0x341f46)['send'](_0x1c7a9f);};}exports[_0xb00b('0x37')]=function(_0x56022e,_0x1c8258){var _0x1c5400={},_0x29579b={},_0x45ca74={'count':0x0,'rows':[]};var _0x37c017=_[_0xb00b('0x38')](db[_0xb00b('0x39')]['rawAttributes'],function(_0x35f1ca){return{'name':_0x35f1ca[_0xb00b('0x3a')],'type':_0x35f1ca[_0xb00b('0x3b')][_0xb00b('0x3c')]};});_0x29579b[_0xb00b('0x3d')]=_[_0xb00b('0x38')](_0x37c017,'name');_0x29579b[_0xb00b('0x3e')]=_[_0xb00b('0x3f')](_0x56022e['query']);_0x29579b[_0xb00b('0x40')]=_[_0xb00b('0x41')](_0x29579b[_0xb00b('0x3d')],_0x29579b[_0xb00b('0x3e')]);_0x1c5400[_0xb00b('0x42')]=_['intersection'](_0x29579b[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x1c5400['attributes']=_0x1c5400['attributes'][_0xb00b('0x44')]?_0x1c5400[_0xb00b('0x42')]:_0x29579b[_0xb00b('0x3d')];if(!_0x56022e[_0xb00b('0x3e')][_0xb00b('0x45')](_0xb00b('0x46'))){_0x1c5400[_0xb00b('0x27')]=qs['limit'](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x27')]);_0x1c5400[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x25')]);}_0x1c5400[_0xb00b('0x47')]=qs[_0xb00b('0x48')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x48')]);_0x1c5400[_0xb00b('0x49')]=qs[_0xb00b('0x40')](_['pick'](_0x56022e[_0xb00b('0x3e')],_0x29579b[_0xb00b('0x40')]),_0x37c017);if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4a')]){_0x1c5400[_0xb00b('0x49')]=_[_0xb00b('0x4b')](_0x1c5400[_0xb00b('0x49')],{'$or':_[_0xb00b('0x38')](_0x37c017,function(_0x10ba60){if(_0x10ba60[_0xb00b('0x3b')]!==_0xb00b('0x4c')){var _0x3b3031={};_0x3b3031[_0x10ba60['name']]={'$like':'%'+_0x56022e['query']['filter']+'%'};return _0x3b3031;}})});}_0x1c5400=_[_0xb00b('0x4b')]({},_0x1c5400,_0x56022e[_0xb00b('0x4d')]);var _0x481154={'where':_0x1c5400[_0xb00b('0x49')]};return db[_0xb00b('0x39')][_0xb00b('0x28')](_0x481154)[_0xb00b('0x2f')](function(_0x4b62b3){_0x45ca74['count']=_0x4b62b3;if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x1c5400['include']=[{'all':!![]}];}return db['Trunk'][_0xb00b('0x4f')](_0x1c5400);})[_0xb00b('0x2f')](function(_0x4e0be4){_0x45ca74[_0xb00b('0x50')]=_0x4e0be4;return _0x45ca74;})['then'](respondWithFilteredResult(_0x1c8258,_0x1c5400))['catch'](handleError(_0x1c8258,null));};exports['show']=function(_0x465d90,_0x481515){var _0x1f7b86={'raw':![],'where':{'id':_0x465d90[_0xb00b('0x51')]['id']}},_0x3178aa={};_0x3178aa[_0xb00b('0x3d')]=_[_0xb00b('0x3f')](db[_0xb00b('0x39')]['rawAttributes']);_0x3178aa['query']=_[_0xb00b('0x3f')](_0x465d90[_0xb00b('0x3e')]);_0x3178aa['filters']=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],_0x3178aa['query']);_0x1f7b86[_0xb00b('0x42')]=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],qs['fields'](_0x465d90['query'][_0xb00b('0x43')]));_0x1f7b86[_0xb00b('0x42')]=_0x1f7b86[_0xb00b('0x42')][_0xb00b('0x44')]?_0x1f7b86['attributes']:_0x3178aa[_0xb00b('0x3d')];if(_0x465d90[_0xb00b('0x3e')]['includeAll']){_0x1f7b86['include']=[{'all':!![]}];}_0x1f7b86=_[_0xb00b('0x4b')]({},_0x1f7b86,_0x465d90['options']);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x1f7b86)[_0xb00b('0x2f')](handleEntityNotFound(_0x481515,null))[_0xb00b('0x2f')](respondWithResult(_0x481515,null))[_0xb00b('0x22')](handleError(_0x481515,null));};exports[_0xb00b('0x53')]=function(_0x5a3b85,_0x5d52a5){var _0x51c9e3={'where':{'id':_0x5a3b85[_0xb00b('0x51')]['id']}},_0x37d4d2={};_0x37d4d2[_0xb00b('0x3d')]=_['keys'](db[_0xb00b('0x39')][_0xb00b('0x54')]);_0x51c9e3[_0xb00b('0x42')]=_['intersection'](_0x37d4d2[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x51c9e3[_0xb00b('0x42')]=_0x51c9e3[_0xb00b('0x42')][_0xb00b('0x44')]?_0x51c9e3[_0xb00b('0x42')]:_0x37d4d2['model'];if(_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x51c9e3[_0xb00b('0x55')]=[{'all':!![]}];}_0x51c9e3=_['merge']({},_0x51c9e3,_0x5a3b85[_0xb00b('0x4d')]);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x51c9e3)[_0xb00b('0x2f')](handleEntityNotFound(_0x5d52a5,null))[_0xb00b('0x2f')](function(_0x4bfe0b){if(_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b[_0xb00b('0x31')]({'plain':!![]});_0xfd4ecc=qs[_0xb00b('0x56')](_0xfd4ecc,['id',_0xb00b('0x57'),'updatedAt']);_0x5a3b85[_0xb00b('0x58')]=_[_0xb00b('0x56')](_0x5a3b85[_0xb00b('0x58')],['id',_0xb00b('0x57'),_0xb00b('0x59')]);return db[_0xb00b('0x39')][_0xb00b('0x5a')](_['merge'](_0xfd4ecc,_0x5a3b85[_0xb00b('0x58')]),{'include':_0x5a3b85['query'][_0xb00b('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x3b3272){var _0x530d4a=_0x5a3b85[_0xb00b('0x5b')]['get']({'plain':!![]});if(!_0x530d4a)throw new Error(_0xb00b('0x5c'));if(_0x530d4a[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x4d1cec=_0x3b3272['get']({'plain':!![]});var _0x4f7a59=_0xb00b('0x32');return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0x4f7a59,'userProfileId':_0x530d4a['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37ae88){if(_0x37ae88&&_0x37ae88[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x4d1cec['name'],'resourceId':_0x4d1cec['id'],'type':_0x37ae88[_0xb00b('0x36')],'sectionId':_0x37ae88['id']},{})[_0xb00b('0x2f')](function(){return _0x3b3272;});}else{return _0x3b3272;}})['catch'](function(_0xe1316d){logger[_0xb00b('0x1e')](_0xb00b('0x60'),_0xe1316d);throw _0xe1316d;});}return _0x3b3272;});}})['then'](respondWithResult(_0x5d52a5,0xc9))['catch'](handleError(_0x5d52a5,null));};exports[_0xb00b('0x5a')]=function(_0x188da7,_0x23762e,_0x49f0a2){var _0x5aac5f;return db['Trunk']['create'](_0x188da7[_0xb00b('0x58')],{'raw':!![]})['then'](function(_0x2434a0){_0x5aac5f=_0x2434a0;return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x1e7f3a){var _0x2d21ec=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0x3d4482=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config[_0xb00b('0x65')],_0xb00b('0x66')),'utf8');var _0x27b3ae=ejs[_0xb00b('0x67')](_0x2d21ec,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x27b3ae);if(_0x5aac5f[_0xb00b('0x6a')]){var _0x432b68=ejs[_0xb00b('0x67')](_0x3d4482,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x432b68);}})[_0xb00b('0x2f')](function(){return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x5a'),{'module':_0xb00b('0x6c')});})[_0xb00b('0x2f')](function(){var _0xfb2b68=_0x188da7[_0xb00b('0x5b')][_0xb00b('0x31')]({'plain':!![]});if(!_0xfb2b68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfb2b68[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x7803a0=_0x5aac5f[_0xb00b('0x31')]({'plain':!![]});return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0xb00b('0x32'),'userProfileId':_0xfb2b68['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37a4c0){if(_0x37a4c0&&_0x37a4c0[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x7803a0[_0xb00b('0x36')],'resourceId':_0x7803a0['id'],'type':_0x37a4c0['name'],'sectionId':_0x37a4c0['id']},{})[_0xb00b('0x2f')](function(){return _0x5aac5f;});}else{return _0x5aac5f;}})['catch'](function(_0x135cbf){logger['error'](_0xb00b('0x60'),_0x135cbf);throw _0x135cbf;});}return _0x5aac5f;})[_0xb00b('0x2f')](respondWithResult(_0x23762e,0xc9))[_0xb00b('0x22')](handleError(_0x23762e,null));};exports['update']=function(_0x5287cc,_0x9ad1c6,_0x3c4850){var _0x33a483;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0x5287cc[_0xb00b('0x51')]['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x9ad1c6,null))[_0xb00b('0x2f')](saveUpdates(_0x5287cc[_0xb00b('0x58')],null))[_0xb00b('0x2f')](function(_0x257430){if(_0x257430){_0x33a483=_0x257430;return db[_0xb00b('0x39')][_0xb00b('0x4f')]({'raw':!![]});}})[_0xb00b('0x2f')](function(_0x4eb17d){if(_0x4eb17d){var _0x59503c=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],'server/files/templates/trunk.ejs'),_0xb00b('0x64'));var _0x391e98=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],_0xb00b('0x66')),_0xb00b('0x64'));var _0x45c9cd=ejs[_0xb00b('0x67')](_0x59503c,{'trunks':_0x4eb17d||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x45c9cd);var _0x4a9125=ejs[_0xb00b('0x67')](_0x391e98,{'trunks':_0x4eb17d||[]});fs['writeFileSync'](_0xb00b('0x6d'),_0x4a9125);return respondWithRpcPromise(_0xb00b('0x6b'),'update',{'module':_0xb00b('0x6c')});}return null;})[_0xb00b('0x2f')](function(_0xe80a21){if(_0xe80a21){return _0x33a483;}})[_0xb00b('0x2f')](respondWithResult(_0x9ad1c6,null))[_0xb00b('0x22')](handleError(_0x9ad1c6,null));};exports[_0xb00b('0x30')]=function(_0xc41c1f,_0x2423b2,_0x36ba5c){var _0x383d16;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0xc41c1f['params']['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x2423b2,null))[_0xb00b('0x2f')](removeEntity(_0x2423b2,null))[_0xb00b('0x2f')](function(){return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x17503d){var _0x32508b=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0xa4fe1e=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],'server/files/templates/registry.ejs'),_0xb00b('0x64'));var _0x202d5f=ejs[_0xb00b('0x67')](_0x32508b,{'trunks':_0x17503d});var _0x165442=ejs[_0xb00b('0x67')](_0xa4fe1e,{'trunks':_0x17503d});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x202d5f);fs[_0xb00b('0x68')](_0xb00b('0x6d'),_0x165442);return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x30'),{'module':'chan_sip.so'});})[_0xb00b('0x22')](handleError(_0x2423b2,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 874c39e..cd459b8 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 _0x1eb2=['request-promise','path','rimraf','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment'];(function(_0x317725,_0x1bd734){var _0x1e08cb=function(_0x42d51c){while(--_0x42d51c){_0x317725['push'](_0x317725['shift']());}};_0x1e08cb(++_0x1bd734);}(_0x1eb2,0x1ab));var _0x21eb=function(_0x15b40e,_0x354c12){_0x15b40e=_0x15b40e-0x0;var _0x3f7ee4=_0x1eb2[_0x15b40e];return _0x3f7ee4;};'use strict';var _=require(_0x21eb('0x0'));var util=require(_0x21eb('0x1'));var logger=require(_0x21eb('0x2'))(_0x21eb('0x3'));var moment=require(_0x21eb('0x4'));var BPromise=require('bluebird');var rp=require(_0x21eb('0x5'));var fs=require('fs');var path=require(_0x21eb('0x6'));var rimraf=require(_0x21eb('0x7'));var config=require('../../config/environment');var attributes=require('./trunk.attributes');module[_0x21eb('0x8')]=function(_0x177afa,_0x4615f1){return _0x177afa[_0x21eb('0x9')](_0x21eb('0xa'),attributes,{'tableName':_0x21eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02ef=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./trunk.attributes','exports','define','Trunk','tools_trunks'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x02ef,0x15c));var _0xf02e=function(_0x4281ab,_0x29af8d){_0x4281ab=_0x4281ab-0x0;var _0x4c3dbd=_0x02ef[_0x4281ab];return _0x4c3dbd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf02e('0x0'))(_0xf02e('0x1'));var moment=require(_0xf02e('0x2'));var BPromise=require(_0xf02e('0x3'));var rp=require(_0xf02e('0x4'));var fs=require('fs');var path=require(_0xf02e('0x5'));var rimraf=require(_0xf02e('0x6'));var config=require('../../config/environment');var attributes=require(_0xf02e('0x7'));module[_0xf02e('0x8')]=function(_0x3178b0,_0x584338){return _0x3178b0[_0xf02e('0x9')](_0xf02e('0xa'),attributes,{'tableName':_0xf02e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index affb78e..2dbfaac 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 _0x3876=['catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','model','map','ShowTrunk','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x57645b,_0x25f73a){var _0xe82f00=function(_0x526b4){while(--_0x526b4){_0x57645b['push'](_0x57645b['shift']());}};_0xe82f00(++_0x25f73a);}(_0x3876,0x1ca));var _0x6387=function(_0x3a304a,_0x1fe629){_0x3a304a=_0x3a304a-0x0;var _0x5d42c8=_0x3876[_0x3a304a];return _0x5d42c8;};'use strict';var _=require(_0x6387('0x0'));var util=require(_0x6387('0x1'));var moment=require(_0x6387('0x2'));var BPromise=require(_0x6387('0x3'));var rs=require(_0x6387('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6387('0x5'))['db'];var utils=require(_0x6387('0x6'));var logger=require(_0x6387('0x7'))(_0x6387('0x8'));var config=require(_0x6387('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6387('0xa')][_0x6387('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x81272d,_0x3493c4,_0x4be959){return new BPromise(function(_0x2671b6,_0x18fb0e){return client[_0x6387('0xc')](_0x81272d,_0x4be959)[_0x6387('0xd')](function(_0x12638d){logger[_0x6387('0xe')](_0x6387('0xf'),_0x3493c4,_0x6387('0x10'));logger[_0x6387('0x11')](_0x6387('0x12'),_0x3493c4,_0x6387('0x10'),JSON[_0x6387('0x13')](_0x12638d));if(_0x12638d['error']){if(_0x12638d[_0x6387('0x14')][_0x6387('0x15')]===0x1f4){logger[_0x6387('0x14')]('Trunk,\x20%s,\x20%s',_0x3493c4,_0x12638d[_0x6387('0x14')][_0x6387('0x16')]);return _0x18fb0e(_0x12638d['error']['message']);}logger['error']('Trunk,\x20%s,\x20%s',_0x3493c4,_0x12638d[_0x6387('0x14')][_0x6387('0x16')]);return _0x2671b6(_0x12638d[_0x6387('0x14')][_0x6387('0x16')]);}else{logger[_0x6387('0xe')](_0x6387('0xf'),_0x3493c4,'request\x20sent');_0x2671b6(_0x12638d['result'][_0x6387('0x16')]);}})[_0x6387('0x17')](function(_0x90eeed){logger[_0x6387('0x14')]('Trunk,\x20%s,\x20%s',_0x3493c4,_0x90eeed);_0x18fb0e(_0x90eeed);});});}exports[_0x6387('0x18')]=function(_0x5b227f){var _0x4e4f11=this;return new Promise(function(_0x4e8805,_0xc3e307){return db[_0x6387('0x19')][_0x6387('0x1a')]({'raw':_0x5b227f[_0x6387('0x1b')]?_0x5b227f['options']['raw']===undefined?!![]:![]:!![],'where':_0x5b227f['options']?_0x5b227f['options'][_0x6387('0x1c')]||null:null,'attributes':_0x5b227f[_0x6387('0x1b')]?_0x5b227f[_0x6387('0x1b')][_0x6387('0x1d')]||null:null,'limit':_0x5b227f[_0x6387('0x1b')]?_0x5b227f[_0x6387('0x1b')][_0x6387('0x1e')]||null:null,'include':_0x5b227f[_0x6387('0x1b')]?_0x5b227f['options'][_0x6387('0x1f')]?_['map'](_0x5b227f[_0x6387('0x1b')][_0x6387('0x1f')],function(_0x583da9){return{'model':db[_0x583da9[_0x6387('0x20')]],'as':_0x583da9['as'],'attributes':_0x583da9['attributes'],'include':_0x583da9[_0x6387('0x1f')]?_[_0x6387('0x21')](_0x583da9[_0x6387('0x1f')],function(_0x63f0c9){return{'model':db[_0x63f0c9[_0x6387('0x20')]],'as':_0x63f0c9['as'],'attributes':_0x63f0c9[_0x6387('0x1d')],'include':_0x63f0c9['include']?_[_0x6387('0x21')](_0x63f0c9[_0x6387('0x1f')],function(_0x352ee2){return{'model':db[_0x352ee2['model']],'as':_0x352ee2['as'],'attributes':_0x352ee2[_0x6387('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6387('0xd')](function(_0x2d7e2a){logger[_0x6387('0xe')](_0x6387('0x18'),_0x5b227f);logger[_0x6387('0x11')]('GetTrunk',_0x5b227f,JSON[_0x6387('0x13')](_0x2d7e2a));_0x4e8805(_0x2d7e2a);})[_0x6387('0x17')](function(_0x2d389d){logger[_0x6387('0x14')](_0x6387('0x18'),_0x2d389d[_0x6387('0x16')],_0x5b227f);_0xc3e307(_0x4e4f11['error'](0x1f4,_0x2d389d['message']));});});};exports[_0x6387('0x22')]=function(_0x43e8af){var _0x5603b4=this;return new Promise(function(_0x358a21,_0x25a919){return db[_0x6387('0x19')][_0x6387('0x23')]({'raw':_0x43e8af[_0x6387('0x1b')]?_0x43e8af['options'][_0x6387('0x24')]===undefined?!![]:![]:!![],'where':_0x43e8af[_0x6387('0x1b')]?_0x43e8af[_0x6387('0x1b')]['where']||null:null,'attributes':_0x43e8af[_0x6387('0x1b')]?_0x43e8af[_0x6387('0x1b')][_0x6387('0x1d')]||null:null,'include':_0x43e8af[_0x6387('0x1b')]?_0x43e8af[_0x6387('0x1b')]['include']?_[_0x6387('0x21')](_0x43e8af[_0x6387('0x1b')][_0x6387('0x1f')],function(_0x53db94){return{'model':db[_0x53db94[_0x6387('0x20')]],'as':_0x53db94['as'],'attributes':_0x53db94[_0x6387('0x1d')],'include':_0x53db94['include']?_['map'](_0x53db94[_0x6387('0x1f')],function(_0x2a05da){return{'model':db[_0x2a05da['model']],'as':_0x2a05da['as'],'attributes':_0x2a05da['attributes'],'include':_0x2a05da[_0x6387('0x1f')]?_[_0x6387('0x21')](_0x2a05da['include'],function(_0xf42b85){return{'model':db[_0xf42b85[_0x6387('0x20')]],'as':_0xf42b85['as'],'attributes':_0xf42b85[_0x6387('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6387('0xd')](function(_0x2bde01){logger[_0x6387('0xe')](_0x6387('0x22'),_0x43e8af);logger[_0x6387('0x11')]('ShowTrunk',_0x43e8af,JSON['stringify'](_0x2bde01));_0x358a21(_0x2bde01);})[_0x6387('0x17')](function(_0x515c4b){logger[_0x6387('0x14')](_0x6387('0x22'),_0x515c4b[_0x6387('0x16')],_0x43e8af);_0x25a919(_0x5603b4[_0x6387('0x14')](0x1f4,_0x515c4b[_0x6387('0x16')]));});});}; \ No newline at end of file +var _0xb1d0=['Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetTrunk','findAll','options','where','attributes','limit','include','model','map','catch','ShowTrunk','find','raw','lodash','util','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x32f87d,_0x5ef536){var _0x180ba0=function(_0x37cf80){while(--_0x37cf80){_0x32f87d['push'](_0x32f87d['shift']());}};_0x180ba0(++_0x5ef536);}(_0xb1d0,0x154));var _0x0b1d=function(_0x202055,_0x3e4838){_0x202055=_0x202055-0x0;var _0x5314a5=_0xb1d0[_0x202055];return _0x5314a5;};'use strict';var _=require(_0x0b1d('0x0'));var util=require(_0x0b1d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0b1d('0x2'));var fs=require('fs');var Redis=require(_0x0b1d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b1d('0x4'));var logger=require('../../config/logger')(_0x0b1d('0x5'));var config=require(_0x0b1d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0b1d('0x7')][_0x0b1d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x323b0f,_0x5ef20a,_0x5349fa){return new BPromise(function(_0x513ceb,_0x30f797){return client[_0x0b1d('0x9')](_0x323b0f,_0x5349fa)[_0x0b1d('0xa')](function(_0x401344){logger[_0x0b1d('0xb')](_0x0b1d('0xc'),_0x5ef20a,_0x0b1d('0xd'));logger[_0x0b1d('0xe')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5ef20a,_0x0b1d('0xd'),JSON[_0x0b1d('0xf')](_0x401344));if(_0x401344['error']){if(_0x401344[_0x0b1d('0x10')][_0x0b1d('0x11')]===0x1f4){logger['error'](_0x0b1d('0xc'),_0x5ef20a,_0x401344[_0x0b1d('0x10')]['message']);return _0x30f797(_0x401344[_0x0b1d('0x10')]['message']);}logger['error'](_0x0b1d('0xc'),_0x5ef20a,_0x401344[_0x0b1d('0x10')][_0x0b1d('0x12')]);return _0x513ceb(_0x401344[_0x0b1d('0x10')]['message']);}else{logger[_0x0b1d('0xb')](_0x0b1d('0xc'),_0x5ef20a,'request\x20sent');_0x513ceb(_0x401344['result'][_0x0b1d('0x12')]);}})['catch'](function(_0x3bc47e){logger[_0x0b1d('0x10')](_0x0b1d('0xc'),_0x5ef20a,_0x3bc47e);_0x30f797(_0x3bc47e);});});}exports[_0x0b1d('0x13')]=function(_0x1a0141){var _0xce4766=this;return new Promise(function(_0x3a225b,_0x5e8750){return db['Trunk'][_0x0b1d('0x14')]({'raw':_0x1a0141['options']?_0x1a0141[_0x0b1d('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1a0141[_0x0b1d('0x15')]?_0x1a0141[_0x0b1d('0x15')][_0x0b1d('0x16')]||null:null,'attributes':_0x1a0141[_0x0b1d('0x15')]?_0x1a0141[_0x0b1d('0x15')][_0x0b1d('0x17')]||null:null,'limit':_0x1a0141[_0x0b1d('0x15')]?_0x1a0141[_0x0b1d('0x15')][_0x0b1d('0x18')]||null:null,'include':_0x1a0141[_0x0b1d('0x15')]?_0x1a0141[_0x0b1d('0x15')][_0x0b1d('0x19')]?_['map'](_0x1a0141[_0x0b1d('0x15')][_0x0b1d('0x19')],function(_0xa04e97){return{'model':db[_0xa04e97[_0x0b1d('0x1a')]],'as':_0xa04e97['as'],'attributes':_0xa04e97[_0x0b1d('0x17')],'include':_0xa04e97['include']?_[_0x0b1d('0x1b')](_0xa04e97[_0x0b1d('0x19')],function(_0x322f82){return{'model':db[_0x322f82[_0x0b1d('0x1a')]],'as':_0x322f82['as'],'attributes':_0x322f82[_0x0b1d('0x17')],'include':_0x322f82[_0x0b1d('0x19')]?_[_0x0b1d('0x1b')](_0x322f82[_0x0b1d('0x19')],function(_0xab3c64){return{'model':db[_0xab3c64['model']],'as':_0xab3c64['as'],'attributes':_0xab3c64[_0x0b1d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x0b1d('0xa')](function(_0x53557d){logger[_0x0b1d('0xb')](_0x0b1d('0x13'),_0x1a0141);logger['debug'](_0x0b1d('0x13'),_0x1a0141,JSON['stringify'](_0x53557d));_0x3a225b(_0x53557d);})[_0x0b1d('0x1c')](function(_0x3cf63d){logger['error']('GetTrunk',_0x3cf63d[_0x0b1d('0x12')],_0x1a0141);_0x5e8750(_0xce4766['error'](0x1f4,_0x3cf63d[_0x0b1d('0x12')]));});});};exports[_0x0b1d('0x1d')]=function(_0x317267){var _0x4ed4d7=this;return new Promise(function(_0xbc3346,_0x114a39){return db['Trunk'][_0x0b1d('0x1e')]({'raw':_0x317267[_0x0b1d('0x15')]?_0x317267[_0x0b1d('0x15')][_0x0b1d('0x1f')]===undefined?!![]:![]:!![],'where':_0x317267[_0x0b1d('0x15')]?_0x317267[_0x0b1d('0x15')]['where']||null:null,'attributes':_0x317267[_0x0b1d('0x15')]?_0x317267['options'][_0x0b1d('0x17')]||null:null,'include':_0x317267[_0x0b1d('0x15')]?_0x317267[_0x0b1d('0x15')][_0x0b1d('0x19')]?_[_0x0b1d('0x1b')](_0x317267[_0x0b1d('0x15')]['include'],function(_0x4a0642){return{'model':db[_0x4a0642['model']],'as':_0x4a0642['as'],'attributes':_0x4a0642[_0x0b1d('0x17')],'include':_0x4a0642['include']?_[_0x0b1d('0x1b')](_0x4a0642[_0x0b1d('0x19')],function(_0x100fd1){return{'model':db[_0x100fd1[_0x0b1d('0x1a')]],'as':_0x100fd1['as'],'attributes':_0x100fd1[_0x0b1d('0x17')],'include':_0x100fd1[_0x0b1d('0x19')]?_[_0x0b1d('0x1b')](_0x100fd1['include'],function(_0x55ce08){return{'model':db[_0x55ce08[_0x0b1d('0x1a')]],'as':_0x55ce08['as'],'attributes':_0x55ce08['attributes']};}):[]};}):[]};}):[]:[]})[_0x0b1d('0xa')](function(_0x54721f){logger[_0x0b1d('0xb')]('ShowTrunk',_0x317267);logger[_0x0b1d('0xe')](_0x0b1d('0x1d'),_0x317267,JSON[_0x0b1d('0xf')](_0x54721f));_0xbc3346(_0x54721f);})[_0x0b1d('0x1c')](function(_0x34a3e3){logger[_0x0b1d('0x10')](_0x0b1d('0x1d'),_0x34a3e3['message'],_0x317267);_0x114a39(_0x4ed4d7['error'](0x1f4,_0x34a3e3[_0x0b1d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 0fd9cd7..77fc4e6 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 _0x614e=['getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','getApiKey','post','addContacts','create','bulkCreate','server/files/images/','format','now','originalname','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/presence','/:id','show','/:id/avatar'];(function(_0x1895ce,_0x81e9b2){var _0x4c3c7f=function(_0x2e4d0b){while(--_0x2e4d0b){_0x1895ce['push'](_0x1895ce['shift']());}};_0x4c3c7f(++_0x81e9b2);}(_0x614e,0x1c7));var _0xe614=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x614e[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xe614('0x0'));var util=require(_0xe614('0x1'));var path=require(_0xe614('0x2'));var timeout=require(_0xe614('0x3'));var express=require(_0xe614('0x4'));var router=express[_0xe614('0x5')]();var fs_extra=require(_0xe614('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe614('0x7'));var config=require(_0xe614('0x8'));var controller=require(_0xe614('0x9'));router['get']('/',auth[_0xe614('0xa')](),controller[_0xe614('0xb')]);router[_0xe614('0xc')](_0xe614('0xd'),auth[_0xe614('0xa')](),controller[_0xe614('0xe')]);router[_0xe614('0xc')](_0xe614('0xf'),auth[_0xe614('0xa')](),controller[_0xe614('0x10')]);router[_0xe614('0xc')](_0xe614('0x11'),auth[_0xe614('0xa')](),controller['getPresence']);router[_0xe614('0xc')](_0xe614('0x12'),auth[_0xe614('0xa')](),controller[_0xe614('0x13')]);router[_0xe614('0xc')](_0xe614('0x14'),controller[_0xe614('0x15')]);router[_0xe614('0xc')]('/:id/open_tabs',auth['isAuthenticated'](),controller[_0xe614('0x16')]);router['get'](_0xe614('0x17'),auth['isAuthenticated'](),controller[_0xe614('0x18')]);router[_0xe614('0xc')](_0xe614('0x19'),auth['isAuthenticated'](),controller[_0xe614('0x1a')]);router['get'](_0xe614('0x1b'),auth[_0xe614('0xa')](),controller[_0xe614('0x1c')]);router[_0xe614('0xc')](_0xe614('0x1d'),auth[_0xe614('0xa')](),controller['getGroups']);router[_0xe614('0xc')](_0xe614('0x1e'),auth[_0xe614('0xa')](),controller[_0xe614('0x1f')]);router[_0xe614('0xc')](_0xe614('0x20'),auth[_0xe614('0xa')](),controller[_0xe614('0x21')]);router[_0xe614('0xc')](_0xe614('0x22'),auth[_0xe614('0xa')](),controller[_0xe614('0x23')]);router[_0xe614('0xc')]('/:id/openchannel/interactions',auth[_0xe614('0xa')](),controller[_0xe614('0x24')]);router[_0xe614('0xc')](_0xe614('0x25'),auth[_0xe614('0xa')](),controller[_0xe614('0x26')]);router['get'](_0xe614('0x27'),auth['isAuthenticated'](),controller[_0xe614('0x28')]);router['get'](_0xe614('0x29'),auth[_0xe614('0xa')](),controller[_0xe614('0x2a')]);router[_0xe614('0xc')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0xe614('0x2b')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0xe614('0xc')](_0xe614('0x2c'),auth[_0xe614('0xa')](),controller['getLists']);router[_0xe614('0xc')](_0xe614('0x2d'),auth[_0xe614('0xa')](),controller[_0xe614('0x2e')]);router[_0xe614('0xc')](_0xe614('0x2f'),auth[_0xe614('0xa')](),controller[_0xe614('0x30')]);router[_0xe614('0xc')](_0xe614('0x31'),auth[_0xe614('0xa')](),controller['getFaxAccounts']);router[_0xe614('0xc')](_0xe614('0x32'),auth['isAuthenticated'](),controller[_0xe614('0x33')]);router[_0xe614('0xc')]('/:id/openchannel_accounts',auth[_0xe614('0xa')](),controller[_0xe614('0x34')]);router[_0xe614('0xc')](_0xe614('0x35'),auth[_0xe614('0xa')](),controller[_0xe614('0x36')]);router[_0xe614('0xc')](_0xe614('0x37'),auth[_0xe614('0xa')](),controller[_0xe614('0x38')]);router['get'](_0xe614('0x39'),auth[_0xe614('0xa')](),controller[_0xe614('0x3a')]);router['get'](_0xe614('0x3b'),auth[_0xe614('0xa')](),controller[_0xe614('0x3c')]);router[_0xe614('0xc')]('/:id/scheduled_calls',auth[_0xe614('0xa')](),controller[_0xe614('0x3d')]);router[_0xe614('0xc')]('/:id/api_key',auth[_0xe614('0xa')](),controller[_0xe614('0x3e')]);router[_0xe614('0x3f')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xe614('0x40')]);router[_0xe614('0x3f')]('/',auth[_0xe614('0xa')](),controller[_0xe614('0x41')]);router[_0xe614('0x3f')]('/create_many',auth[_0xe614('0xa')](),controller[_0xe614('0x42')]);router[_0xe614('0x3f')]('/:id/queues',auth[_0xe614('0xa')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d1507,_0xcb5cb3,_0x315103){_0x315103(null,path['join'](config['root'],_0xe614('0x43')));},'filename':function(_0x48adb4,_0x3b5a07,_0x4a674d){_0x4a674d(null,util[_0xe614('0x44')]('%s-%s',Date[_0xe614('0x45')](),_0x3b5a07[_0xe614('0x46')]));}})});router[_0xe614('0x3f')]('/:id/avatar',upload[_0xe614('0x47')](_0xe614('0x48')),controller['addAvatar']);router[_0xe614('0x3f')](_0xe614('0x49'),auth['isAuthenticated'](),controller[_0xe614('0x4a')]);router['post'](_0xe614('0x4b'),auth['isAuthenticated'](),controller[_0xe614('0x4c')]);router[_0xe614('0x3f')](_0xe614('0x4d'),auth[_0xe614('0xa')](),controller['pause']);router[_0xe614('0x3f')]('/:id/unpause',auth[_0xe614('0xa')](),controller[_0xe614('0x4e')]);router['post'](_0xe614('0x4f'),auth[_0xe614('0xa')](),controller[_0xe614('0x50')]);router[_0xe614('0x3f')](_0xe614('0x51'),auth[_0xe614('0xa')](),controller[_0xe614('0x52')]);router[_0xe614('0x3f')]('/:id/mail_interactions',auth[_0xe614('0xa')](),controller[_0xe614('0x53')]);router[_0xe614('0x3f')]('/:id/fax_interactions',auth[_0xe614('0xa')](),controller[_0xe614('0x54')]);router[_0xe614('0x3f')](_0xe614('0x55'),auth[_0xe614('0xa')](),controller[_0xe614('0x56')]);router['post'](_0xe614('0x57'),auth['isAuthenticated'](),controller[_0xe614('0x58')]);router[_0xe614('0x3f')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xe614('0x59')]);router['post']('/:id/fax_accounts',auth[_0xe614('0xa')](),controller[_0xe614('0x5a')]);router[_0xe614('0x3f')](_0xe614('0x32'),auth['isAuthenticated'](),controller['addMailAccounts']);router['post'](_0xe614('0x5b'),auth[_0xe614('0xa')](),controller[_0xe614('0x5c')]);router['post'](_0xe614('0x35'),auth[_0xe614('0xa')](),controller[_0xe614('0x5d')]);router['post']('/:id/chat_websites',auth[_0xe614('0xa')](),controller[_0xe614('0x5e')]);router[_0xe614('0x3f')](_0xe614('0x39'),auth[_0xe614('0xa')](),controller[_0xe614('0x5f')]);router[_0xe614('0x3f')](_0xe614('0x3b'),auth[_0xe614('0xa')](),controller['addSquareProjects']);router[_0xe614('0x3f')](_0xe614('0x60'),auth[_0xe614('0xa')](),controller[_0xe614('0x61')]);router['put']('/:id',auth[_0xe614('0xa')](),controller[_0xe614('0x62')]);router[_0xe614('0x63')](_0xe614('0x64'),auth[_0xe614('0xa')](),controller[_0xe614('0x65')]);router[_0xe614('0x66')]('/:id/queues',auth[_0xe614('0xa')](),controller[_0xe614('0x67')]);router['delete'](_0xe614('0x4f'),auth[_0xe614('0xa')](),controller[_0xe614('0x68')]);router[_0xe614('0x66')]('/:id',auth[_0xe614('0xa')](),controller[_0xe614('0x69')]);router[_0xe614('0x66')](_0xe614('0x51'),auth[_0xe614('0xa')](),controller[_0xe614('0x6a')]);router[_0xe614('0x66')]('/:id/mail_interactions',auth[_0xe614('0xa')](),controller['removeMailInteractions']);router['delete'](_0xe614('0x6b'),auth[_0xe614('0xa')](),controller[_0xe614('0x6c')]);router[_0xe614('0x66')](_0xe614('0x55'),auth[_0xe614('0xa')](),controller[_0xe614('0x6d')]);router['delete']('/:id/openchannel_interactions',auth[_0xe614('0xa')](),controller['removeOpenchannelInteractions']);router[_0xe614('0x66')](_0xe614('0x6e'),auth[_0xe614('0xa')](),controller[_0xe614('0x6f')]);router[_0xe614('0x66')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xe614('0x70')]);router[_0xe614('0x66')](_0xe614('0x32'),auth[_0xe614('0xa')](),controller[_0xe614('0x71')]);router['delete']('/:id/openchannel_accounts',auth[_0xe614('0xa')](),controller['removeOpenchannelAccounts']);router['delete']('/:id/sms_accounts',auth[_0xe614('0xa')](),controller[_0xe614('0x72')]);router['delete']('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xe614('0x73')]);router['delete'](_0xe614('0x39'),auth[_0xe614('0xa')](),controller['removeWhatsappAccounts']);router['delete']('/:id/square_projects',auth[_0xe614('0xa')](),controller[_0xe614('0x74')]);router[_0xe614('0x66')](_0xe614('0x60'),auth[_0xe614('0xa')](),controller[_0xe614('0x75')]);module[_0xe614('0x76')]=router; \ No newline at end of file +var _0x98fa=['addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','file','addAvatar','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addSmsAccounts','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','/:id/password','changePassword','delete','removeQueues','/:id/chat_interactions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/sms_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','get','/describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getLists','/:id/agents','/:id/prefixes','/:id/fax_accounts','/:id/mail_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','/create_many'];(function(_0x2a4095,_0x13f4f0){var _0x52eeab=function(_0x3950dd){while(--_0x3950dd){_0x2a4095['push'](_0x2a4095['shift']());}};_0x52eeab(++_0x13f4f0);}(_0x98fa,0xaa));var _0xa98f=function(_0xbfb130,_0x5313e7){_0xbfb130=_0xbfb130-0x0;var _0x3a9f23=_0x98fa[_0xbfb130];return _0x3a9f23;};'use strict';var multer=require(_0xa98f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa98f('0x1'));var express=require(_0xa98f('0x2'));var router=express[_0xa98f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa98f('0x4'));var interaction=require(_0xa98f('0x5'));var config=require('../../config/environment');var controller=require(_0xa98f('0x6'));router['get']('/',auth[_0xa98f('0x7')](),controller['index']);router[_0xa98f('0x8')](_0xa98f('0x9'),auth[_0xa98f('0x7')](),controller['describe']);router[_0xa98f('0x8')](_0xa98f('0xa'),auth[_0xa98f('0x7')](),controller[_0xa98f('0xb')]);router['get'](_0xa98f('0xc'),auth[_0xa98f('0x7')](),controller[_0xa98f('0xd')]);router[_0xa98f('0x8')](_0xa98f('0xe'),auth['isAuthenticated'](),controller[_0xa98f('0xf')]);router[_0xa98f('0x8')](_0xa98f('0x10'),controller[_0xa98f('0x11')]);router[_0xa98f('0x8')](_0xa98f('0x12'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x13')]);router['get'](_0xa98f('0x14'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x15')]);router[_0xa98f('0x8')](_0xa98f('0x16'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x17')]);router[_0xa98f('0x8')](_0xa98f('0x18'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x19')]);router['get']('/:id/groups',auth[_0xa98f('0x7')](),controller[_0xa98f('0x1a')]);router[_0xa98f('0x8')](_0xa98f('0x1b'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x1c')]);router['get'](_0xa98f('0x1d'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x1e')]);router['get'](_0xa98f('0x1f'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x20')]);router[_0xa98f('0x8')](_0xa98f('0x21'),auth[_0xa98f('0x7')](),controller['getOpenchannelInteractions']);router[_0xa98f('0x8')](_0xa98f('0x22'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x23')]);router[_0xa98f('0x8')](_0xa98f('0x24'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x25')]);router['get'](_0xa98f('0x26'),auth['isAuthenticated'](),controller[_0xa98f('0x27')]);router[_0xa98f('0x8')](_0xa98f('0x28'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x29')]);router[_0xa98f('0x8')](_0xa98f('0x2a'),auth[_0xa98f('0x7')](),controller['getTeams']);router[_0xa98f('0x8')]('/:id/lists',auth[_0xa98f('0x7')](),controller[_0xa98f('0x2b')]);router[_0xa98f('0x8')](_0xa98f('0x2c'),auth[_0xa98f('0x7')](),controller['getAgents']);router['get'](_0xa98f('0x2d'),auth[_0xa98f('0x7')](),controller['getVoicePrefixes']);router[_0xa98f('0x8')](_0xa98f('0x2e'),auth['isAuthenticated'](),controller['getFaxAccounts']);router[_0xa98f('0x8')](_0xa98f('0x2f'),auth[_0xa98f('0x7')](),controller['getMailAccounts']);router[_0xa98f('0x8')]('/:id/openchannel_accounts',auth[_0xa98f('0x7')](),controller['getOpenchannelAccounts']);router['get'](_0xa98f('0x30'),auth['isAuthenticated'](),controller[_0xa98f('0x31')]);router[_0xa98f('0x8')](_0xa98f('0x32'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x33')]);router[_0xa98f('0x8')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xa98f('0x34')]);router[_0xa98f('0x8')](_0xa98f('0x35'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x36')]);router[_0xa98f('0x8')](_0xa98f('0x37'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x38')]);router[_0xa98f('0x8')](_0xa98f('0x39'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x3a')]);router[_0xa98f('0x3b')]('/:id/contacts',auth[_0xa98f('0x7')](),controller[_0xa98f('0x3c')]);router[_0xa98f('0x3b')]('/',auth[_0xa98f('0x7')](),controller['create']);router[_0xa98f('0x3b')](_0xa98f('0x3d'),auth[_0xa98f('0x7')](),controller['bulkCreate']);router[_0xa98f('0x3b')]('/:id/queues',auth[_0xa98f('0x7')](),controller[_0xa98f('0x3e')]);var upload=multer({'storage':multer[_0xa98f('0x3f')]({'destination':function(_0x1d1203,_0x29b93a,_0x399306){_0x399306(null,path[_0xa98f('0x40')](config[_0xa98f('0x41')],_0xa98f('0x42')));},'filename':function(_0x96d795,_0x1217f2,_0x1ba0f5){_0x1ba0f5(null,util[_0xa98f('0x43')](_0xa98f('0x44'),Date[_0xa98f('0x45')](),_0x1217f2[_0xa98f('0x46')]));}})});router[_0xa98f('0x3b')](_0xa98f('0x10'),upload['single'](_0xa98f('0x47')),controller[_0xa98f('0x48')]);router[_0xa98f('0x3b')]('/:id/login',auth['isAuthenticated'](),controller[_0xa98f('0x49')]);router['post'](_0xa98f('0x4a'),auth['isAuthenticated'](),controller[_0xa98f('0x4b')]);router[_0xa98f('0x3b')](_0xa98f('0x4c'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x4d')]);router['post'](_0xa98f('0x4e'),auth['isAuthenticated'](),controller[_0xa98f('0x4f')]);router[_0xa98f('0x3b')](_0xa98f('0x2a'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x50')]);router[_0xa98f('0x3b')]('/:id/chat_interactions',auth[_0xa98f('0x7')](),controller[_0xa98f('0x51')]);router[_0xa98f('0x3b')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0xa98f('0x52')]);router[_0xa98f('0x3b')](_0xa98f('0x53'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x54')]);router[_0xa98f('0x3b')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0xa98f('0x55')]);router[_0xa98f('0x3b')](_0xa98f('0x56'),auth['isAuthenticated'](),controller[_0xa98f('0x57')]);router[_0xa98f('0x3b')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xa98f('0x58')]);router[_0xa98f('0x3b')]('/:id/fax_accounts',auth[_0xa98f('0x7')](),controller[_0xa98f('0x59')]);router[_0xa98f('0x3b')](_0xa98f('0x2f'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x5a')]);router[_0xa98f('0x3b')]('/:id/openchannel_accounts',auth[_0xa98f('0x7')](),controller['addOpenchannelAccounts']);router[_0xa98f('0x3b')]('/:id/sms_accounts',auth[_0xa98f('0x7')](),controller[_0xa98f('0x5b')]);router['post'](_0xa98f('0x32'),auth['isAuthenticated'](),controller['addChatWebsites']);router['post'](_0xa98f('0x5c'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x5d')]);router[_0xa98f('0x3b')](_0xa98f('0x35'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x5e')]);router[_0xa98f('0x3b')](_0xa98f('0x39'),auth['isAuthenticated'](),controller[_0xa98f('0x5f')]);router[_0xa98f('0x60')]('/:id',auth['isAuthenticated'](),controller[_0xa98f('0x61')]);router[_0xa98f('0x60')](_0xa98f('0x62'),auth['isAuthenticated'](),controller[_0xa98f('0x63')]);router[_0xa98f('0x64')](_0xa98f('0x16'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x65')]);router[_0xa98f('0x64')](_0xa98f('0x2a'),auth[_0xa98f('0x7')](),controller['removeTeams']);router[_0xa98f('0x64')](_0xa98f('0xe'),auth[_0xa98f('0x7')](),controller['destroy']);router[_0xa98f('0x64')](_0xa98f('0x66'),auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0xa98f('0x64')](_0xa98f('0x67'),auth['isAuthenticated'](),controller[_0xa98f('0x68')]);router[_0xa98f('0x64')](_0xa98f('0x53'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x69')]);router[_0xa98f('0x64')](_0xa98f('0x6a'),auth[_0xa98f('0x7')](),controller['removeSmsInteractions']);router[_0xa98f('0x64')](_0xa98f('0x56'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x6b')]);router[_0xa98f('0x64')]('/:id/whatsapp_interactions',auth[_0xa98f('0x7')](),controller[_0xa98f('0x6c')]);router[_0xa98f('0x64')](_0xa98f('0x2e'),auth['isAuthenticated'](),controller[_0xa98f('0x6d')]);router[_0xa98f('0x64')](_0xa98f('0x2f'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x6e')]);router[_0xa98f('0x64')]('/:id/openchannel_accounts',auth[_0xa98f('0x7')](),controller[_0xa98f('0x6f')]);router[_0xa98f('0x64')](_0xa98f('0x30'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x70')]);router[_0xa98f('0x64')](_0xa98f('0x32'),auth['isAuthenticated'](),controller[_0xa98f('0x71')]);router[_0xa98f('0x64')](_0xa98f('0x5c'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x72')]);router[_0xa98f('0x64')]('/:id/square_projects',auth[_0xa98f('0x7')](),controller['removeSquareProjects']);router[_0xa98f('0x64')](_0xa98f('0x39'),auth[_0xa98f('0x7')](),controller[_0xa98f('0x73')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index ae593bf..3ef9e38 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 _0xfb65=['allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','update','TEXT','get','isArray','wss','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','avpf','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','moment','util','exports','name','setDataValue','defaultuser','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','STRING','email','toLowerCase','ENUM','admin','agent','telephone','local','INTEGER','accountcode','callerid','BOOLEAN','DATE','dynamic','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','auto','rfc2833','nonat','yes','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm'];(function(_0x420515,_0x15486c){var _0x35996c=function(_0xd4b040){while(--_0xd4b040){_0x420515['push'](_0x420515['shift']());}};_0x35996c(++_0x15486c);}(_0xfb65,0x82));var _0x5fb6=function(_0x5b5662,_0x218418){_0x5b5662=_0x5b5662-0x0;var _0x5df9a4=_0xfb65[_0x5b5662];return _0x5df9a4;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5fb6('0x0'));var util=require(_0x5fb6('0x1'));var _=require('lodash');module[_0x5fb6('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5fb6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x15d15c){this[_0x5fb6('0x4')](_0x5fb6('0x3'),_0x15d15c);this[_0x5fb6('0x4')](_0x5fb6('0x5'),_0x15d15c);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x238914){this[_0x5fb6('0x4')](_0x5fb6('0x6'),_0x238914);this[_0x5fb6('0x4')]('callerid',util[_0x5fb6('0x7')](_0x5fb6('0x8'),_0x238914,this[_0x5fb6('0x9')](_0x5fb6('0xa'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':![],'unique':_0x5fb6('0xc'),'validate':{'isEmail':!![]},'set':function(_0x491bb6){if(_0x491bb6){this[_0x5fb6('0x4')](_0x5fb6('0xc'),_0x491bb6[_0x5fb6('0xd')]());}}},'role':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0xf'),'user',_0x5fb6('0x10'),_0x5fb6('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x5fb6('0xb')],'defaultValue':_0x5fb6('0x12')},'internal':{'type':Sequelize[_0x5fb6('0x13')](0xb),'allowNull':![],'unique':_0x5fb6('0xa'),'set':function(_0x1ded21){this['setDataValue']('internal',_0x1ded21);this[_0x5fb6('0x4')](_0x5fb6('0x14'),_0x1ded21);this['setDataValue'](_0x5fb6('0x15'),util[_0x5fb6('0x7')](_0x5fb6('0x8'),this['getDataValue'](_0x5fb6('0x6')),_0x1ded21));}},'salt':{'type':Sequelize[_0x5fb6('0xb')]},'phone':{'type':Sequelize[_0x5fb6('0xb')]},'mobile':{'type':Sequelize[_0x5fb6('0xb')]},'address':{'type':Sequelize[_0x5fb6('0xb')]},'zipcode':{'type':Sequelize[_0x5fb6('0xb')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x5fb6('0xb')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x5fb6('0x17')]},'chatCapacity':{'type':Sequelize[_0x5fb6('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x5fb6('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x5fb6('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x5fb6('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x5fb6('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x5fb6('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x5fb6('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x5fb6('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'host':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![],'defaultValue':_0x5fb6('0x18')},'ipaddr':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'port':{'type':Sequelize[_0x5fb6('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x5fb6('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x5fb6('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x5fb6('0xe')]('friend',_0x5fb6('0x19'),_0x5fb6('0x1a')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![],'defaultValue':_0x5fb6('0x1b')},'callingpres':{'type':Sequelize['ENUM'](_0x5fb6('0x1c'),'ALLOWED_PASSED_SCREEN',_0x5fb6('0x1d'),'ALLOWED','PROHIB_NOT_SCREENED',_0x5fb6('0x1e'),_0x5fb6('0x1f'),_0x5fb6('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'permit':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'secret':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'transport':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![],'defaultValue':_0x5fb6('0x21'),'set':function(_0x295e93){this[_0x5fb6('0x4')](_0x5fb6('0x22'),_0x295e93?_0x295e93[_0x5fb6('0x23')](','):null);},'get':function(){return this[_0x5fb6('0x9')](_0x5fb6('0x22'))?this[_0x5fb6('0x9')](_0x5fb6('0x22'))['split'](','):null;},'comment':_0x5fb6('0x24')},'dtmfmode':{'type':Sequelize[_0x5fb6('0xe')]('rfc2833',_0x5fb6('0x25'),'shortinfo','inband',_0x5fb6('0x26')),'allowNull':!![],'defaultValue':_0x5fb6('0x27')},'directmedia':{'type':Sequelize[_0x5fb6('0xe')]('yes','no',_0x5fb6('0x28'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'nat':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![],'defaultValue':_0x5fb6('0x2a'),'set':function(_0x3a6f88){this[_0x5fb6('0x4')](_0x5fb6('0x2b'),_0x3a6f88?_0x3a6f88[_0x5fb6('0x23')](','):null);},'get':function(){return this[_0x5fb6('0x9')](_0x5fb6('0x2b'))?this['getDataValue'](_0x5fb6('0x2b'))[_0x5fb6('0x2c')](','):null;},'comment':_0x5fb6('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x5fb6('0xb')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x5fb6('0xb')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x5fb6('0xb')]},'disallow':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':![],'defaultValue':_0x5fb6('0x2e')},'allow':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':![],'defaultValue':_0x5fb6('0x2f'),'set':function(_0x59875a){this[_0x5fb6('0x4')](_0x5fb6('0x30'),_0x59875a?_0x59875a[_0x5fb6('0x23')](';'):_0x5fb6('0x2f'));},'get':function(){return this['getDataValue'](_0x5fb6('0x30'))?this[_0x5fb6('0x9')](_0x5fb6('0x30'))[_0x5fb6('0x2c')](';'):null;},'comment':_0x5fb6('0x31')},'autoframing':{'type':Sequelize[_0x5fb6('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![],'set':function(_0x18c88c){this[_0x5fb6('0x4')](_0x5fb6('0x32'),_0x18c88c?_0x18c88c[_0x5fb6('0x23')](','):null);},'get':function(){return this[_0x5fb6('0x9')](_0x5fb6('0x32'))?this[_0x5fb6('0x9')](_0x5fb6('0x32'))[_0x5fb6('0x2c')](','):null;},'comment':_0x5fb6('0x33')},'trustrpid':{'type':Sequelize['ENUM'](_0x5fb6('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x5fb6('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x5fb6('0xe')]('yes','no',_0x5fb6('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x5fb6('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![],'defaultValue':_0x5fb6('0x35')},'amaflags':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x29'),'no'),'allowNull':!![],'defaultValue':_0x5fb6('0x29')},'busylevel':{'type':Sequelize[_0x5fb6('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x5fb6('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'template':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x29'),'no',_0x5fb6('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x37'),_0x5fb6('0x38'),_0x5fb6('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x5fb6('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x5fb6('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x3a'),'uas'),'allowNull':!![],'defaultValue':_0x5fb6('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x5fb6('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x5fb6('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x5fb6('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x5fb6('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x5fb6('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x5fb6('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x5fb6('0xe')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x5fb6('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x29'),'no',_0x5fb6('0x3c'),_0x5fb6('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x3e'),'passive',_0x5fb6('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x5fb6('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x5fb6('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x5fb6('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x29'),'no',_0x5fb6('0x28'),_0x5fb6('0x40'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x5fb6('0xb')]},'resetPasswordExpires':{'type':Sequelize[_0x5fb6('0x17')]},'passwordResetAt':{'type':Sequelize[_0x5fb6('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x5fb6('0x41')]},'showWebBar':{'type':Sequelize[_0x5fb6('0x13')],'defaultValue':0x0,'set':function(_0x53d30a){this[_0x5fb6('0x4')]('showWebBar',_0x53d30a);var _0x40bdcf=this[_0x5fb6('0x42')]({'plain':!![]});switch(_0x53d30a){case 0x0:case 0x1:var _0x2c5c89=_0x40bdcf[_0x5fb6('0x22')]?_[_0x5fb6('0x43')](_0x40bdcf[_0x5fb6('0x22')])?_0x40bdcf[_0x5fb6('0x22')][_0x5fb6('0x23')]():_0x40bdcf['transport']:'udp';if(_0x2c5c89===_0x5fb6('0x44')){_0x2c5c89=_0x5fb6('0x21');}this[_0x5fb6('0x4')](_0x5fb6('0x22'),_0x2c5c89);this['setDataValue']('encryption','no');this[_0x5fb6('0x4')]('avpf',null);this['setDataValue'](_0x5fb6('0x45'),null);this[_0x5fb6('0x4')](_0x5fb6('0x46'),null);this[_0x5fb6('0x4')](_0x5fb6('0x47'),null);this['setDataValue'](_0x5fb6('0x48'),null);this['setDataValue'](_0x5fb6('0x49'),null);this[_0x5fb6('0x4')](_0x5fb6('0x4a'),null);this[_0x5fb6('0x4')](_0x5fb6('0x4b'),null);this[_0x5fb6('0x4')]('rtcp_mux','no');break;case 0x2:this[_0x5fb6('0x4')](_0x5fb6('0x22'),_0x5fb6('0x44'));this['setDataValue']('encryption','yes');this[_0x5fb6('0x4')](_0x5fb6('0x4c'),_0x5fb6('0x29'));this[_0x5fb6('0x4')](_0x5fb6('0x45'),_0x5fb6('0x29'));this[_0x5fb6('0x4')]('icesupport',_0x5fb6('0x29'));this[_0x5fb6('0x4')](_0x5fb6('0x47'),_0x5fb6('0x29'));this[_0x5fb6('0x4')]('dtlsverify','no');this['setDataValue'](_0x5fb6('0x49'),'actpass');this['setDataValue'](_0x5fb6('0x4a'),_0x40bdcf['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this['setDataValue'](_0x5fb6('0x4b'),_0x40bdcf[_0x5fb6('0x4b')]||_0x5fb6('0x4d'));this[_0x5fb6('0x4')](_0x5fb6('0x4e'),_0x5fb6('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0x5fb6('0x41')],'set':function(_0x266e7c){this[_0x5fb6('0x4')](_0x5fb6('0x4f'),_0x266e7c?_0x266e7c[_0x5fb6('0x23')](','):[]);},'get':function(){return this[_0x5fb6('0x9')](_0x5fb6('0x4f'))?_[_0x5fb6('0x50')](this[_0x5fb6('0x9')](_0x5fb6('0x4f'))[_0x5fb6('0x2c')](','),function(_0x333976){return parseInt(_0x333976,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x5fb6('0xb')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x5fb6('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x5fb6('0xb')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x5fb6('0xe')](_0x5fb6('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x5fb6('0xb')]},'phoneBarEnableJaws':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x5fb6('0x51'))?this[_0x5fb6('0x9')](_0x5fb6('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x5fb6('0xb')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x5fb6('0xb')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![],'set':function(_0x502646){if(typeof _0x502646==='string'){var _0x4af45b=_0x502646==='1'?!![]:_0x502646==='0'?![]:_0x502646===_0x5fb6('0x52')?!![]:_0x502646===_0x5fb6('0x53')?![]:![];this[_0x5fb6('0x4')](_0x5fb6('0x54'),_0x4af45b);}else{this[_0x5fb6('0x4')]('screenrecording',_0x502646);}}},'blocked':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![],'set':function(_0x519101){this[_0x5fb6('0x4')](_0x5fb6('0x55'),_0x519101);if(_0x519101===!![]){this['setDataValue'](_0x5fb6('0x56'),moment());this['setDataValue'](_0x5fb6('0x57'),0x0);}else{this[_0x5fb6('0x4')](_0x5fb6('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x5fb6('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x5fb6('0x13')](0x5)[_0x5fb6('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x5fb6('0x16')],'defaultValue':!![]}}; \ No newline at end of file +var _0xbedb=['refuse','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update','TEXT','showWebBar','get','isArray','udp','wss','encryption','avpf','force_avp','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','icesupport','dtlsverify','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','phoneBarEnableScreenRecordingByAgent','string','screenrecording','blocked','blockedAt','loginAttempts','sequelize','util','lodash','exports','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','getDataValue','internal','email','toLowerCase','ENUM','admin','agent','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','user','peer','friend','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','nonat','outgoing','yes','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','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'];(function(_0x471833,_0x4fe15e){var _0x59b7a7=function(_0x5d1285){while(--_0x5d1285){_0x471833['push'](_0x471833['shift']());}};_0x59b7a7(++_0x4fe15e);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xbbed('0x0'));var moment=require('moment');var util=require(_0xbbed('0x1'));var _=require(_0xbbed('0x2'));module[_0xbbed('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3b6c41){this[_0xbbed('0x4')](_0xbbed('0x5'),_0x3b6c41);this[_0xbbed('0x4')](_0xbbed('0x6'),_0x3b6c41);},'comment':_0xbbed('0x7')},'fullname':{'type':Sequelize[_0xbbed('0x8')],'allowNull':![],'set':function(_0x3a3d9c){this[_0xbbed('0x4')](_0xbbed('0x9'),_0x3a3d9c);this['setDataValue'](_0xbbed('0xa'),util['format']('\x22%s\x22\x20<%s>',_0x3a3d9c,this[_0xbbed('0xb')](_0xbbed('0xc'))));}},'alias':{'type':Sequelize[_0xbbed('0x8')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x22a117){if(_0x22a117){this[_0xbbed('0x4')](_0xbbed('0xd'),_0x22a117[_0xbbed('0xe')]());}}},'role':{'type':Sequelize[_0xbbed('0xf')](_0xbbed('0x10'),'user',_0xbbed('0x11'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xbbed('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xbbed('0x8')],'defaultValue':_0xbbed('0x12')},'internal':{'type':Sequelize[_0xbbed('0x13')](0xb),'allowNull':![],'unique':_0xbbed('0xc'),'set':function(_0x194cea){this[_0xbbed('0x4')](_0xbbed('0xc'),_0x194cea);this[_0xbbed('0x4')](_0xbbed('0x14'),_0x194cea);this['setDataValue'](_0xbbed('0xa'),util['format'](_0xbbed('0x15'),this[_0xbbed('0xb')](_0xbbed('0x9')),_0x194cea));}},'salt':{'type':Sequelize[_0xbbed('0x8')]},'phone':{'type':Sequelize[_0xbbed('0x8')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xbbed('0x8')]},'zipcode':{'type':Sequelize[_0xbbed('0x8')]},'userpic':{'type':Sequelize[_0xbbed('0x8')]},'city':{'type':Sequelize[_0xbbed('0x8')]},'country':{'type':Sequelize[_0xbbed('0x8')]},'online':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xbbed('0x17')]},'voicePause':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xbbed('0x8')],'defaultValue':_0xbbed('0x18')},'lastPauseAt':{'type':Sequelize[_0xbbed('0x17')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xbbed('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xbbed('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xbbed('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xbbed('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xbbed('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xbbed('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xbbed('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'host':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xbbed('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xbbed('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xbbed('0xf')]('friend',_0xbbed('0x19'),_0xbbed('0x1a')),'allowNull':!![],'defaultValue':_0xbbed('0x1b')},'context':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xbbed('0xf')]('ALLOWED_NOT_SCREENED',_0xbbed('0x1c'),_0xbbed('0x1d'),'ALLOWED',_0xbbed('0x1e'),_0xbbed('0x1f'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0xafaa37){this[_0xbbed('0x4')]('transport',_0xafaa37?_0xafaa37[_0xbbed('0x20')](','):null);},'get':function(){return this['getDataValue'](_0xbbed('0x21'))?this[_0xbbed('0xb')](_0xbbed('0x21'))['split'](','):null;},'comment':_0xbbed('0x22')},'dtmfmode':{'type':Sequelize[_0xbbed('0xf')](_0xbbed('0x23'),_0xbbed('0x24'),_0xbbed('0x25'),_0xbbed('0x26'),'auto'),'allowNull':!![],'defaultValue':_0xbbed('0x23')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0xbbed('0x27'),'update',_0xbbed('0x28')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xbbed('0xf')](_0xbbed('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![],'defaultValue':_0xbbed('0x2a'),'set':function(_0x4e3f61){this['setDataValue']('nat',_0x4e3f61?_0x4e3f61[_0xbbed('0x20')](','):null);},'get':function(){return this[_0xbbed('0xb')](_0xbbed('0x2b'))?this[_0xbbed('0xb')](_0xbbed('0x2b'))[_0xbbed('0x2c')](','):null;},'comment':_0xbbed('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xbbed('0x8')]},'pickupgroup':{'type':Sequelize[_0xbbed('0x8')]},'namedpickupgroup':{'type':Sequelize[_0xbbed('0x8')]},'language':{'type':Sequelize[_0xbbed('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xbbed('0x8')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbbed('0x2e')},'allow':{'type':Sequelize[_0xbbed('0x8')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x1278d1){this[_0xbbed('0x4')](_0xbbed('0x2f'),_0x1278d1?_0x1278d1[_0xbbed('0x20')](';'):_0xbbed('0x30'));},'get':function(){return this[_0xbbed('0xb')]('allow')?this['getDataValue'](_0xbbed('0x2f'))['split'](';'):null;},'comment':_0xbbed('0x31')},'autoframing':{'type':Sequelize['ENUM'](_0xbbed('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![],'set':function(_0x3b6964){this[_0xbbed('0x4')](_0xbbed('0x32'),_0x3b6964?_0x3b6964[_0xbbed('0x20')](','):null);},'get':function(){return this['getDataValue'](_0xbbed('0x32'))?this['getDataValue'](_0xbbed('0x32'))[_0xbbed('0x2c')](','):null;},'comment':_0xbbed('0x33')},'trustrpid':{'type':Sequelize['ENUM'](_0xbbed('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xbbed('0xf')]('yes','no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xbbed('0xf')](_0xbbed('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xbbed('0xf')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xbbed('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xbbed('0x34')},'amaflags':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xbbed('0xf')](_0xbbed('0x29'),'no'),'allowNull':!![],'defaultValue':_0xbbed('0x29')},'busylevel':{'type':Sequelize[_0xbbed('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xbbed('0xf')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xbbed('0xf')](_0xbbed('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xbbed('0xf')](_0xbbed('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xbbed('0xf')](_0xbbed('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0xbbed('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xbbed('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xbbed('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xbbed('0xf')]('accept',_0xbbed('0x36'),_0xbbed('0x37')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xbbed('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xbbed('0xf')](_0xbbed('0x38'),_0xbbed('0x39')),'allowNull':!![],'defaultValue':_0xbbed('0x39')},'t38pt_usertpsource':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xbbed('0xf')](_0xbbed('0x29'),'no'),'allowNull':!![],'defaultValue':_0xbbed('0x29')},'keepalive':{'type':Sequelize[_0xbbed('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xbbed('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xbbed('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xbbed('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xbbed('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xbbed('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xbbed('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xbbed('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xbbed('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xbbed('0xf')](_0xbbed('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xbbed('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xbbed('0xf')](_0xbbed('0x29'),'no',_0xbbed('0x3a'),_0xbbed('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xbbed('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xbbed('0x3c'),_0xbbed('0x3d'),_0xbbed('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xbbed('0xf')](_0xbbed('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xbbed('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xbbed('0xf')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xbbed('0xf')](_0xbbed('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xbbed('0xf')](_0xbbed('0x29'),'no',_0xbbed('0x27'),_0xbbed('0x3f'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xbbed('0x8')]},'resetPasswordExpires':{'type':Sequelize[_0xbbed('0x17')]},'passwordResetAt':{'type':Sequelize[_0xbbed('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xbbed('0x40')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x587eed){this['setDataValue'](_0xbbed('0x41'),_0x587eed);var _0x14a702=this[_0xbbed('0x42')]({'plain':!![]});switch(_0x587eed){case 0x0:case 0x1:var _0x22dfed=_0x14a702[_0xbbed('0x21')]?_[_0xbbed('0x43')](_0x14a702[_0xbbed('0x21')])?_0x14a702[_0xbbed('0x21')][_0xbbed('0x20')]():_0x14a702['transport']:_0xbbed('0x44');if(_0x22dfed===_0xbbed('0x45')){_0x22dfed=_0xbbed('0x44');}this[_0xbbed('0x4')]('transport',_0x22dfed);this[_0xbbed('0x4')](_0xbbed('0x46'),'no');this[_0xbbed('0x4')](_0xbbed('0x47'),null);this[_0xbbed('0x4')](_0xbbed('0x48'),null);this[_0xbbed('0x4')]('icesupport',null);this[_0xbbed('0x4')](_0xbbed('0x49'),null);this['setDataValue']('dtlsverify',null);this[_0xbbed('0x4')](_0xbbed('0x4a'),null);this[_0xbbed('0x4')](_0xbbed('0x4b'),null);this[_0xbbed('0x4')]('dtlsprivatekey',null);this['setDataValue'](_0xbbed('0x4c'),'no');break;case 0x2:this['setDataValue'](_0xbbed('0x21'),'wss');this[_0xbbed('0x4')]('encryption',_0xbbed('0x29'));this[_0xbbed('0x4')](_0xbbed('0x47'),_0xbbed('0x29'));this[_0xbbed('0x4')]('force_avp',_0xbbed('0x29'));this[_0xbbed('0x4')](_0xbbed('0x4d'),'yes');this[_0xbbed('0x4')](_0xbbed('0x49'),_0xbbed('0x29'));this[_0xbbed('0x4')](_0xbbed('0x4e'),'no');this['setDataValue'](_0xbbed('0x4a'),_0xbbed('0x3e'));this[_0xbbed('0x4')]('dtlscertfile',_0x14a702[_0xbbed('0x4b')]||_0xbbed('0x4f'));this['setDataValue']('dtlsprivatekey',_0x14a702['dtlsprivatekey']||_0xbbed('0x50'));this['setDataValue'](_0xbbed('0x4c'),_0xbbed('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0xbbed('0x40')],'set':function(_0x42b469){this['setDataValue'](_0xbbed('0x51'),_0x42b469?_0x42b469['join'](','):[]);},'get':function(){return this[_0xbbed('0xb')](_0xbbed('0x51'))?_[_0xbbed('0x52')](this['getDataValue'](_0xbbed('0x51'))[_0xbbed('0x2c')](','),function(_0x218f79){return parseInt(_0x218f79,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xbbed('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xbbed('0x8')]},'phoneBarUnconditional':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xbbed('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xbbed('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xbbed('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xbbed('0xf')](_0xbbed('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xbbed('0x8')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xbbed('0xb')](_0xbbed('0x53'))?this[_0xbbed('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xbbed('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xbbed('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x9b8149){if(typeof _0x9b8149===_0xbbed('0x54')){var _0xe613b0=_0x9b8149==='1'?!![]:_0x9b8149==='0'?![]:_0x9b8149==='true'?!![]:_0x9b8149==='false'?![]:![];this[_0xbbed('0x4')](_0xbbed('0x55'),_0xe613b0);}else{this[_0xbbed('0x4')](_0xbbed('0x55'),_0x9b8149);}}},'blocked':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![],'set':function(_0x3b2b94){this[_0xbbed('0x4')](_0xbbed('0x56'),_0x3b2b94);if(_0x3b2b94===!![]){this[_0xbbed('0x4')](_0xbbed('0x57'),moment());this[_0xbbed('0x4')](_0xbbed('0x58'),0x0);}else{this['setDataValue'](_0xbbed('0x57'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xbbed('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xbbed('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xbbed('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 8bbd021..7582547 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 _0x0b70=['../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','socket.io-emitter','redis','./user.socket','defaults','localhost','client','then','info','User,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','get','role','admin','Users','Agents','agent','Telephones','telephone','ignore','value','find','name','stack','index','rawAttributes','map','key','getOptions','where','User','include','includes','attributes','push','findAll','rows','openTabs','true','length','chat','dataValues','sms','fax','mail','openchannel','whatsapp','all','show','params','model','differenceBy','password','salt','query','keys','filters','fields','merge','options','body','describe','addContacts','ids','internal','Setting','findById','securePassword','validatePasswordPattern','max','min_internal','isNil','sequelize','SELECT','from','voicemail','fullname','email','permissions','102','103','113','110','104','105','106','107','108','111','115','create','Unauthorized','user','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','enforcePasswordHistory','previousPasswords','passwordHistoryLimit','updatePasswordsHistory','addQueues','online','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','penalty','spread','QueueId','emit','Queue:save','VoiceQueue','interface','format','SIP/%s','upsert','removeQueues','channel','remove','Queues','isArray','Queue:remove','voice','addAvatar','filename','join','server/files/images/logos/default_profile.png','userpic','existsSync','download','root','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','findOne','intersection','order','sort','pick','filter','includeAll','CmList','Tag','Tags','tag','hasOwnProperty','nolimit','Queue','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','intrf','headers','x-forwarded-for','remoteAddress','socket','connection','UserVoiceQueueRt','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','type','DEFAULT\x20PAUSE','unpause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','lastPauseAt','QueuePause','manual','%s%s','getTeams','Team','addTeams','omit','setDataValue','Voice','Mail','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','flatten','transaction','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','getChatQueues','Chat','getMailQueues','Openchannel','removeAgent','getLists','getAgents','values','send','addChatInteractions','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','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','concat','$gt','$gte','$ne','$eq','$notBetween','$in','$notIn','$like','$notLike','$iLike','$overlap','$contains','CmHopper','firstName','lastName','phone','CmContact','getApiKey','retrieveApiKey','status','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','lower','col','toString','desc','asc','substring','uniqBy','orderBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','user_has_','_interactions','ui.UserId\x20=\x20?','moment','bluebird','util','path','lodash','jayson/promise','ioredis'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x0b70,0x192));var _0x00b7=function(_0x59e1f4,_0x29e7c9){_0x59e1f4=_0x59e1f4-0x0;var _0x46a5aa=_0x0b70[_0x59e1f4];return _0x46a5aa;};'use strict';var moment=require(_0x00b7('0x0'));var BPromise=require(_0x00b7('0x1'));var util=require(_0x00b7('0x2'));var path=require(_0x00b7('0x3'));var fs=require('fs');var _=require(_0x00b7('0x4'));var squel=require('squel');var jayson=require(_0x00b7('0x5'));var Redis=require(_0x00b7('0x6'));var authService=require(_0x00b7('0x7'));var qs=require(_0x00b7('0x8'));var logger=require(_0x00b7('0x9'))(_0x00b7('0xa'));var utils=require(_0x00b7('0xb'));var config=require(_0x00b7('0xc'));var licenseUtil=require(_0x00b7('0xd'));var db=require('../../mysqldb')['db'];var socket=require(_0x00b7('0xe'))(new Redis(config[_0x00b7('0xf')]));require(_0x00b7('0x10'))['register'](socket);config[_0x00b7('0xf')]=_[_0x00b7('0x11')](config['redis'],{'host':_0x00b7('0x12'),'port':0x18eb});var client=jayson[_0x00b7('0x13')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x3b72be,_0x1af668,_0x4dd09e,_0x640dc0){return new BPromise(function(_0x2619ed,_0x518e94){var _0x42fb4b=_0x640dc0||client;return _0x42fb4b['request'](_0x3b72be,_0x4dd09e)[_0x00b7('0x14')](function(_0x5410b8){logger[_0x00b7('0x15')](_0x00b7('0x16'),_0x1af668,'request\x20sent');logger[_0x00b7('0x17')]('User,\x20%s,\x20%s,\x20%s',_0x1af668,_0x00b7('0x18'),JSON['stringify'](_0x5410b8));if(_0x5410b8[_0x00b7('0x19')]){if(_0x5410b8[_0x00b7('0x19')][_0x00b7('0x1a')]===0x1f4){logger[_0x00b7('0x19')](_0x00b7('0x16'),_0x1af668,_0x5410b8[_0x00b7('0x19')][_0x00b7('0x1b')]);return _0x518e94(_0x5410b8[_0x00b7('0x19')][_0x00b7('0x1b')]);}logger[_0x00b7('0x19')](_0x00b7('0x16'),_0x1af668,_0x5410b8[_0x00b7('0x19')][_0x00b7('0x1b')]);return _0x2619ed(_0x5410b8['error']['message']);}else{logger['info'](_0x00b7('0x16'),_0x1af668,'request\x20sent');_0x2619ed(_0x5410b8[_0x00b7('0x1c')][_0x00b7('0x1b')]);}})[_0x00b7('0x1d')](function(_0xe8a9d0){logger[_0x00b7('0x19')](_0x00b7('0x16'),_0x1af668,_0xe8a9d0);_0x518e94(_0xe8a9d0);});});}function respondWithStatusCode(_0x4434cc,_0x5390ac){_0x5390ac=_0x5390ac||0xcc;return function(_0x437538){if(_0x437538){return _0x4434cc[_0x00b7('0x1e')](_0x5390ac);}return _0x4434cc['status'](_0x5390ac)[_0x00b7('0x1f')]();};}function respondWithResult(_0x275ff4,_0x26c696){_0x26c696=_0x26c696||0xc8;return function(_0x2100c3){if(_0x2100c3){return _0x275ff4['status'](_0x26c696)[_0x00b7('0x20')](_0x2100c3);}};}function respondWithFilteredResult(_0x4c32a5,_0x2ae06c){return function(_0x4b1960){if(_0x4b1960){var _0x51db13=typeof _0x2ae06c[_0x00b7('0x21')]===_0x00b7('0x22')&&typeof _0x2ae06c[_0x00b7('0x23')]===_0x00b7('0x22');var _0x3413cd=_0x4b1960[_0x00b7('0x24')];var _0x2da630=_0x51db13?0x0:_0x2ae06c[_0x00b7('0x21')];var _0x519cd2=_0x51db13?_0x4b1960[_0x00b7('0x24')]:_0x2ae06c[_0x00b7('0x21')]+_0x2ae06c[_0x00b7('0x23')];var _0x1581cd;if(_0x519cd2>=_0x3413cd){_0x519cd2=_0x3413cd;_0x1581cd=0xc8;}else{_0x1581cd=0xce;}_0x4c32a5['status'](_0x1581cd);return _0x4c32a5[_0x00b7('0x25')](_0x00b7('0x26'),_0x2da630+'-'+_0x519cd2+'/'+_0x3413cd)[_0x00b7('0x20')](_0x4b1960);}return null;};}function saveUpdates(_0x434387){return function(_0x2eda06){if(_0x2eda06){return _0x2eda06[_0x00b7('0x27')](_0x434387)[_0x00b7('0x14')](function(_0x147c6b){return _0x147c6b;});}return null;};}function removeEntity(_0x4a9357){return function(_0x4c357b){if(_0x4c357b){return _0x4c357b[_0x00b7('0x28')]()[_0x00b7('0x14')](function(){var _0x3872f0=_0x4c357b[_0x00b7('0x29')]({'plain':!![]});if(_0x3872f0[_0x00b7('0x2a')]===_0x00b7('0x2b'))return;var _0x111ed9=[{'name':_0x00b7('0x2c'),'value':'user','ignore':!![]},{'name':_0x00b7('0x2d'),'value':_0x00b7('0x2e'),'ignore':![]},{'name':_0x00b7('0x2f'),'value':_0x00b7('0x30'),'ignore':![]}];var _0x2bc4bd=_(_0x111ed9)['filter'](_0x00b7('0x31'))['map']('value')[_0x00b7('0x32')]();if(_['includes'](_0x2bc4bd,_0x3872f0[_0x00b7('0x2a')])){return;}var _0x20b291=_[_0x00b7('0x33')](_0x111ed9,[_0x00b7('0x32'),_0x3872f0['role']])[_0x00b7('0x34')];return db['UserProfileResource'][_0x00b7('0x28')]({'where':{'type':_0x20b291,'resourceId':_0x3872f0['id']}})['then'](function(){return _0x4c357b;});})[_0x00b7('0x14')](function(){_0x4a9357['status'](0xcc)[_0x00b7('0x1f')]();});}};}function handleEntityNotFound(_0x2caba6){return function(_0x152a97){if(!_0x152a97){_0x2caba6[_0x00b7('0x1e')](0x194);}return _0x152a97;};}function handleError(_0x44f856,_0x5c1852){_0x5c1852=_0x5c1852||0x1f4;return function(_0x53fd6c){logger[_0x00b7('0x19')](_0x53fd6c[_0x00b7('0x35')]);if(_0x53fd6c[_0x00b7('0x34')]){delete _0x53fd6c[_0x00b7('0x34')];}_0x44f856['status'](_0x5c1852)['send'](_0x53fd6c);};}exports[_0x00b7('0x36')]=function(_0x295927,_0x36da8b){var _0x115cc3={},_0x25ad4b={'count':0x0,'rows':[]};var _0x348912=_(db['User'][_0x00b7('0x37')])[_0x00b7('0x38')](function(_0xff99bb){return{'name':_0xff99bb['fieldName'],'type':_0xff99bb['type'][_0x00b7('0x39')]};})['filter'](function(_0x528a10){return!_['includes'](['password','salt'],_0x528a10[_0x00b7('0x34')]);})[_0x00b7('0x32')]();_0x115cc3=qs[_0x00b7('0x3a')](_0x348912,_0x295927);var _0x52fb69={'where':_0x115cc3[_0x00b7('0x3b')]};return db[_0x00b7('0x3c')][_0x00b7('0x24')](_0x52fb69)[_0x00b7('0x14')](function(_0x4ed379){_0x25ad4b[_0x00b7('0x24')]=_0x4ed379;if(_0x295927['query']['includeAll']){_0x115cc3[_0x00b7('0x3d')]=[{'all':!![]}];}if(!_[_0x00b7('0x3e')](_0x115cc3[_0x00b7('0x3f')],'id')){_0x115cc3[_0x00b7('0x3f')][_0x00b7('0x40')]('id');}return db[_0x00b7('0x3c')][_0x00b7('0x41')](_0x115cc3);})[_0x00b7('0x14')](function(_0x5c055e){_0x25ad4b[_0x00b7('0x42')]=_0x5c055e;if(_0x295927['query'][_0x00b7('0x43')]===_0x00b7('0x44')){var _0xb5870b=[];for(var _0x566fa4=0x0;_0x566fa4<_0x25ad4b[_0x00b7('0x42')][_0x00b7('0x45')];_0x566fa4++){_0xb5870b[_0x00b7('0x40')](get_open_tabs(_0x00b7('0x46'),_0x25ad4b[_0x00b7('0x42')][_0x566fa4][_0x00b7('0x47')]));_0xb5870b[_0x00b7('0x40')](get_open_tabs(_0x00b7('0x48'),_0x25ad4b['rows'][_0x566fa4][_0x00b7('0x47')]));_0xb5870b[_0x00b7('0x40')](get_open_tabs(_0x00b7('0x49'),_0x25ad4b[_0x00b7('0x42')][_0x566fa4][_0x00b7('0x47')]));_0xb5870b[_0x00b7('0x40')](get_open_tabs(_0x00b7('0x4a'),_0x25ad4b['rows'][_0x566fa4][_0x00b7('0x47')]));_0xb5870b['push'](get_open_tabs(_0x00b7('0x4b'),_0x25ad4b[_0x00b7('0x42')][_0x566fa4][_0x00b7('0x47')]));_0xb5870b[_0x00b7('0x40')](get_open_tabs(_0x00b7('0x4c'),_0x25ad4b[_0x00b7('0x42')][_0x566fa4][_0x00b7('0x47')]));}return BPromise[_0x00b7('0x4d')](_0xb5870b)['then'](function(_0x4eaffd){return _0x25ad4b;});}else{return _0x25ad4b;}})[_0x00b7('0x14')](respondWithFilteredResult(_0x36da8b,_0x115cc3))['catch'](handleError(_0x36da8b,null));};exports[_0x00b7('0x4e')]=function(_0x59194f,_0x1659a2){var _0x265fa1={'raw':![],'where':{'id':_0x59194f[_0x00b7('0x4f')]['id']}},_0x2dcd0e={};_0x2dcd0e[_0x00b7('0x50')]=_[_0x00b7('0x51')](_['keys'](db[_0x00b7('0x3c')][_0x00b7('0x37')]),[_0x00b7('0x52'),_0x00b7('0x53')]);_0x2dcd0e[_0x00b7('0x54')]=_[_0x00b7('0x55')](_0x59194f['query']);_0x2dcd0e[_0x00b7('0x56')]=_['intersection'](_0x2dcd0e[_0x00b7('0x50')],_0x2dcd0e[_0x00b7('0x54')]);_0x265fa1[_0x00b7('0x3f')]=_['intersection'](_0x2dcd0e['model'],qs[_0x00b7('0x57')](_0x59194f['query']['fields']));_0x265fa1[_0x00b7('0x3f')]=_0x265fa1['attributes']['length']?_0x265fa1['attributes']:_0x2dcd0e[_0x00b7('0x50')];if(_0x59194f['query']['includeAll']){_0x265fa1['include']=[{'all':!![]}];}_0x265fa1=_[_0x00b7('0x58')]({},_0x265fa1,_0x59194f[_0x00b7('0x59')]);if(!_[_0x00b7('0x3e')](_0x265fa1['attributes'],'id')){_0x265fa1[_0x00b7('0x3f')][_0x00b7('0x40')]('id');}return db[_0x00b7('0x3c')][_0x00b7('0x33')](_0x265fa1)[_0x00b7('0x14')](handleEntityNotFound(_0x1659a2,null))[_0x00b7('0x14')](function(_0x12a257){var _0x25287b=[];values=_0x12a257;if(_0x59194f[_0x00b7('0x54')][_0x00b7('0x43')]==='true'){_0x25287b[_0x00b7('0x40')](get_open_tabs(_0x00b7('0x46'),_0x12a257['dataValues']));_0x25287b['push'](get_open_tabs(_0x00b7('0x48'),_0x12a257['dataValues']));_0x25287b[_0x00b7('0x40')](get_open_tabs(_0x00b7('0x4b'),_0x12a257[_0x00b7('0x47')]));_0x25287b['push'](get_open_tabs(_0x00b7('0x4c'),_0x12a257['dataValues']));_0x25287b[_0x00b7('0x40')](get_open_tabs(_0x00b7('0x49'),_0x12a257[_0x00b7('0x47')]));_0x25287b[_0x00b7('0x40')](get_open_tabs(_0x00b7('0x4a'),_0x12a257[_0x00b7('0x47')]));return BPromise[_0x00b7('0x4d')](_0x25287b);}else{return values;}})[_0x00b7('0x14')](function(_0x1e06d4){return values;})['then'](respondWithResult(_0x1659a2,null))[_0x00b7('0x1d')](handleError(_0x1659a2,null));};exports[_0x00b7('0x27')]=function(_0x213946,_0x4970de){if(_0x213946[_0x00b7('0x5a')]['id']){delete _0x213946[_0x00b7('0x5a')]['id'];}delete _0x213946['body'][_0x00b7('0x2a')];return db[_0x00b7('0x3c')]['find']({'where':{'id':_0x213946[_0x00b7('0x4f')]['id']}})[_0x00b7('0x14')](handleEntityNotFound(_0x4970de,null))[_0x00b7('0x14')](saveUpdates(_0x213946[_0x00b7('0x5a')],null))[_0x00b7('0x14')](respondWithResult(_0x4970de,null))[_0x00b7('0x1d')](handleError(_0x4970de,null));};exports[_0x00b7('0x5b')]=function(_0x1caeb7,_0x27ffc9){return db[_0x00b7('0x3c')][_0x00b7('0x5b')]()[_0x00b7('0x14')](respondWithResult(_0x27ffc9,null))[_0x00b7('0x1d')](handleError(_0x27ffc9,null));};exports['addContacts']=function(_0x40aa16,_0x3e2398){return db['User'][_0x00b7('0x33')]({'where':{'id':_0x40aa16[_0x00b7('0x4f')]['id']}})[_0x00b7('0x14')](handleEntityNotFound(_0x3e2398,null))[_0x00b7('0x14')](function(_0xc79399){if(_0xc79399){return _0xc79399[_0x00b7('0x5c')](_0x40aa16[_0x00b7('0x5a')][_0x00b7('0x5d')],_['omit'](_0x40aa16[_0x00b7('0x5a')],[_0x00b7('0x5d'),'id'])||{});}})[_0x00b7('0x14')](respondWithResult(_0x3e2398,null))[_0x00b7('0x1d')](handleError(_0x3e2398,null));};function validateUser(_0x288ada){return new BPromise(function(_0x4a6b91,_0x3b0bd5){if(_0x288ada[_0x00b7('0x5e')])return _0x4a6b91(_0x288ada);return db[_0x00b7('0x5f')][_0x00b7('0x60')](0x1)[_0x00b7('0x14')](function(_0x1b6023){if(_0x1b6023[_0x00b7('0x61')])authService[_0x00b7('0x62')](_0x288ada[_0x00b7('0x52')]);db['User'][_0x00b7('0x63')]('internal')[_0x00b7('0x14')](function(_0x7428b2){if(_['isNil'](_0x7428b2)){_0x288ada[_0x00b7('0x5e')]=_0x1b6023[_0x00b7('0x64')]||0x1;return;}if(_[_0x00b7('0x65')](_0x1b6023[_0x00b7('0x64')])||_0x1b6023['min_internal']===_0x7428b2){_0x288ada[_0x00b7('0x5e')]=_0x7428b2+0x1;return;}if(_0x1b6023['min_internal']>_0x7428b2){_0x288ada[_0x00b7('0x5e')]=_0x1b6023[_0x00b7('0x64')];return;}return db[_0x00b7('0x66')][_0x00b7('0x54')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize']['QueryTypes'][_0x00b7('0x67')]})[_0x00b7('0x14')](function(_0x1456e1){if(_0x1456e1&&_0x1456e1[_0x00b7('0x45')]){for(var _0xc27e9=0x0,_0x5db221=_0x1456e1['length'];_0xc27e9<_0x5db221&&_['isNil'](_0x288ada[_0x00b7('0x5e')]);_0xc27e9++){if(_0x1b6023[_0x00b7('0x64')]<=_0x1456e1[_0xc27e9][_0x00b7('0x68')]){_0x288ada[_0x00b7('0x5e')]=_0x1456e1[_0xc27e9][_0x00b7('0x68')];}else if(_0x1b6023[_0x00b7('0x64')]>_0x1456e1[_0xc27e9][_0x00b7('0x68')]&&_0x1b6023['min_internal']<=_0x1456e1[_0xc27e9]['to']){_0x288ada[_0x00b7('0x5e')]=_0x1b6023[_0x00b7('0x64')];}}}if(_[_0x00b7('0x65')](_0x288ada[_0x00b7('0x5e')])){_0x288ada[_0x00b7('0x5e')]=_0x7428b2+0x1;}return _0x4a6b91(_0x288ada);});});})[_0x00b7('0x1d')](function(_0x330ca5){_0x3b0bd5(_0x330ca5);});});}function updateUser(_0x405683){return new BPromise(function(_0x578407,_0x310fb4){try{if(_0x405683[_0x00b7('0x69')]){_0x405683['mailbox']=_0x405683['internal'];_0x405683['VoiceMail']={'mailbox':_0x405683['internal'],'password':_0x405683[_0x00b7('0x52')],'fullname':_0x405683[_0x00b7('0x6a')],'email':_0x405683[_0x00b7('0x6b')]};}if(_0x405683[_0x00b7('0x2a')]===_0x00b7('0x2e')){if(!_0x405683[_0x00b7('0x6c')])_0x405683[_0x00b7('0x6c')]=['101',_0x00b7('0x6d'),_0x00b7('0x6e'),_0x00b7('0x6f'),_0x00b7('0x70'),_0x00b7('0x71'),_0x00b7('0x72'),_0x00b7('0x73'),_0x00b7('0x74'),_0x00b7('0x75'),'109','100',_0x00b7('0x76'),'114',_0x00b7('0x77')];}_0x578407(_0x405683);}catch(_0x2016ad){_0x310fb4(_0x2016ad);}});}exports[_0x00b7('0x78')]=function(_0x407113,_0x222d9b){if(_0x407113['user'][_0x00b7('0x2a')]==='agent')throw new Error(_0x00b7('0x79'));if(_0x407113[_0x00b7('0x5a')][_0x00b7('0x2a')]===_0x00b7('0x7a')&&_0x407113[_0x00b7('0x7a')][_0x00b7('0x2a')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x407113[_0x00b7('0x5a')][_0x00b7('0x2a')]===_0x00b7('0x2b')&&_0x407113[_0x00b7('0x7a')][_0x00b7('0x2a')]!==_0x00b7('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x00b7('0x7b')]([_0x407113[_0x00b7('0x5a')]])[_0x00b7('0x14')](function(){return validateUser(_0x407113[_0x00b7('0x5a')]);})[_0x00b7('0x14')](function(_0x5bc41e){return updateUser(_0x5bc41e)['then'](function(_0x28860b){if(_0x28860b[_0x00b7('0x2a')]===_0x00b7('0x2b')){_0x28860b[_0x00b7('0x7c')]=_0x407113[_0x00b7('0x7a')][_0x00b7('0x7c')];delete _0x28860b[_0x00b7('0x7d')];}return _0x28860b;});})['then'](function(_0x145596){return db[_0x00b7('0x3c')]['create'](_0x145596,{'include':[{'model':db[_0x00b7('0x7e')],'as':_0x00b7('0x7e')}]});})[_0x00b7('0x14')](function(_0x28801f){if(_0x407113[_0x00b7('0x5a')][_0x00b7('0x2a')]===_0x00b7('0x7a'))return _0x28801f;if(_0x407113[_0x00b7('0x7a')][_0x00b7('0x2a')]!==_0x00b7('0x7a'))return _0x28801f;return db[_0x00b7('0x7f')][_0x00b7('0x33')]({'where':{'name':_0x28801f['role']===_0x00b7('0x2e')?'Agents':'Telephones','userProfileId':_0x407113['user']['userProfileId']},'raw':!![]})[_0x00b7('0x14')](function(_0x2c5cdc){if(!_0x2c5cdc||_0x2c5cdc[_0x00b7('0x80')]!=0x0)return _0x28801f;return db[_0x00b7('0x81')][_0x00b7('0x78')]({'name':_0x28801f['name'],'resourceId':_0x28801f['id'],'type':_0x2c5cdc['name'],'sectionId':_0x2c5cdc['id']},{})[_0x00b7('0x14')](function(){return _0x28801f;});})['catch'](function(_0x580afa){logger['error'](_0x00b7('0x82'),_0x580afa);throw _0x580afa;});})['then'](respondWithResult(_0x222d9b,0xc9))[_0x00b7('0x1d')](handleError(_0x222d9b,null));};exports[_0x00b7('0x83')]=function(_0x287fc7,_0x45e16e){var _0x4778ce=_0x287fc7[_0x00b7('0x5a')];var _0x137a88=[];if(_0x287fc7['user'][_0x00b7('0x2a')]===_0x00b7('0x2e'))throw new Error(_0x00b7('0x79'));if(_[_0x00b7('0x84')](_0x4778ce,['role',_0x00b7('0x7a')])&&_0x287fc7[_0x00b7('0x7a')]['role']!==_0x00b7('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x00b7('0x84')](_0x4778ce,[_0x00b7('0x2a'),_0x00b7('0x2b')])&&_0x287fc7[_0x00b7('0x7a')]['role']!==_0x00b7('0x2b')){throw new Error(_0x00b7('0x85'));}return licenseUtil['checkUserLimits'](_0x4778ce)[_0x00b7('0x14')](function(){return validateUser(_0x4778ce[0x0]);})[_0x00b7('0x14')](function(){for(var _0x577093=0x1;_0x577093<_0x4778ce['length'];_0x577093++){var _0x2775d1=_0x4778ce[_0x577093-0x1]['internal'];if(!_0x4778ce[_0x577093]['internal'])_0x4778ce[_0x577093][_0x00b7('0x5e')]=_0x2775d1+0x1;_0x137a88['push'](validateUser(_0x4778ce[_0x577093]));}return BPromise[_0x00b7('0x4d')](_0x137a88);})[_0x00b7('0x14')](function(){_0x137a88=[];for(var _0x22ce1f=0x0;_0x22ce1f<_0x4778ce['length'];_0x22ce1f++){_0x137a88[_0x00b7('0x40')](updateUser(_0x4778ce[_0x22ce1f]));}return BPromise[_0x00b7('0x4d')](_0x137a88);})[_0x00b7('0x14')](function(){return BPromise[_0x00b7('0x86')](_0x4778ce,function(_0x4335d0){return db[_0x00b7('0x3c')][_0x00b7('0x78')](_0x4335d0,{'include':[{'model':db[_0x00b7('0x7e')],'as':_0x00b7('0x7e')}]})['then'](function(_0x397876){_0x4335d0['id']=_0x397876['id'];return _0x4335d0;});});})[_0x00b7('0x14')](function(_0x19a643){if(_0x287fc7['body'][_0x00b7('0x2a')]===_0x00b7('0x7a'))return _0x19a643;if(_0x287fc7['user'][_0x00b7('0x2a')]!==_0x00b7('0x7a'))return _0x19a643;var _0x5c8c7c=_[_0x00b7('0x84')](_0x19a643,function(_0x339f57){return _0x339f57['role']==='agent'||_0x339f57['role']===_0x00b7('0x30');});if(!_0x5c8c7c)return _0x19a643;return db[_0x00b7('0x7f')][_0x00b7('0x41')]({'where':{'name':{'$or':[_0x00b7('0x2d'),_0x00b7('0x2f')]},'userProfileId':_0x287fc7[_0x00b7('0x7a')]['userProfileId']},'raw':!![]})[_0x00b7('0x14')](function(_0x16996b){if(_[_0x00b7('0x87')](_0x16996b)||!_['some'](_0x16996b,[_0x00b7('0x80'),0x0]))return _0x19a643;_0x137a88=[];var _0x416533=_(_0x16996b)[_0x00b7('0x38')](function(_0x567ab8){if(_0x567ab8[_0x00b7('0x80')]===0x1)return;return _0x567ab8['name']==='Agents'?_0x00b7('0x2e'):_0x00b7('0x30');})[_0x00b7('0x88')]()[_0x00b7('0x32')]();for(var _0x54a100=0x0;_0x54a100<_0x19a643['length'];_0x54a100++){if(!_[_0x00b7('0x3e')](_0x416533,_0x19a643[_0x54a100][_0x00b7('0x2a')]))return;var _0x1b3cfe=_0x19a643[_0x54a100][_0x00b7('0x2a')]==='agent'?'Agents':_0x00b7('0x2f');_0x137a88['push'](db[_0x00b7('0x81')][_0x00b7('0x78')]({'name':_0x19a643[_0x54a100]['name'],'resourceId':_0x19a643[_0x54a100]['id'],'type':_0x1b3cfe,'sectionId':_[_0x00b7('0x33')](_0x16996b,['name',_0x1b3cfe])['id']},{}));}return BPromise['all'](_0x137a88);});})[_0x00b7('0x14')](respondWithResult(_0x45e16e,0xc9))[_0x00b7('0x1d')](handleError(_0x45e16e,null));};exports[_0x00b7('0x89')]=function(_0x1f10f5,_0x72dbc7){if(_0x1f10f5['body']['id']){delete _0x1f10f5[_0x00b7('0x5a')]['id'];}return db['User']['find']({'where':{'id':_0x1f10f5['params']['id']}})[_0x00b7('0x14')](function(_0x5dc1ec){if(!_0x5dc1ec)return null;if(_0x5dc1ec['id']===_0x1f10f5[_0x00b7('0x7a')]['id']){if(!_0x1f10f5[_0x00b7('0x5a')][_0x00b7('0x8a')]||!_0x1f10f5[_0x00b7('0x5a')][_0x00b7('0x8b')]){throw new db[(_0x00b7('0x8c'))]['ValidationError'](_0x00b7('0x8d'));}if(!_0x5dc1ec[_0x00b7('0x8e')](_0x1f10f5[_0x00b7('0x5a')][_0x00b7('0x8a')])){throw new db['Sequelize'][(_0x00b7('0x8f'))](_0x00b7('0x90'));}if(_0x1f10f5['body']['oldPassword']===_0x1f10f5['body'][_0x00b7('0x8b')]){throw new db['Sequelize'][(_0x00b7('0x8f'))](_0x00b7('0x91'));}}else if(_0x1f10f5[_0x00b7('0x7a')][_0x00b7('0x2a')]===_0x00b7('0x2b')){if(!_0x1f10f5['body'][_0x00b7('0x8b')]){throw new db['Sequelize'][(_0x00b7('0x8f'))](_0x00b7('0x92'));}}else if(_0x1f10f5['user'][_0x00b7('0x2a')]===_0x00b7('0x7a')){if(!_0x1f10f5[_0x00b7('0x5a')]['newPassword']){throw new db[(_0x00b7('0x8c'))][(_0x00b7('0x8f'))](_0x00b7('0x92'));}if(_0x5dc1ec[_0x00b7('0x2a')]!=='agent'){throw new db[(_0x00b7('0x8c'))][(_0x00b7('0x8f'))](_0x00b7('0x79'));}}else{throw new db['Sequelize'][(_0x00b7('0x8f'))](_0x00b7('0x79'));}return _0x5dc1ec;})[_0x00b7('0x14')](handleEntityNotFound(_0x72dbc7,null))[_0x00b7('0x14')](function(_0x3ef141){return db[_0x00b7('0x5f')]['findOne']({'attributes':['id','securePassword',_0x00b7('0x93'),'passwordHistoryLimit']})['then'](function(_0x59189c){if(_0x59189c[_0x00b7('0x61')])authService[_0x00b7('0x62')](_0x1f10f5[_0x00b7('0x5a')][_0x00b7('0x8b')]);if(!_0x59189c[_0x00b7('0x93')]||!_0x3ef141[_0x00b7('0x94')])return _0x3ef141;authService['validatePasswordHistory'](_0x1f10f5['body']['newPassword'],_0x3ef141['previousPasswords'],_0x59189c[_0x00b7('0x95')]);return _0x3ef141;})[_0x00b7('0x14')](saveUpdates({'password':_0x1f10f5[_0x00b7('0x5a')][_0x00b7('0x8b')],'passwordResetAt':_0x1f10f5['user']['id']==_0x1f10f5[_0x00b7('0x4f')]['id']?moment():null,'previousPasswords':authService[_0x00b7('0x96')](_0x1f10f5[_0x00b7('0x5a')]['newPassword'],_0x3ef141[_0x00b7('0x94')])},null));})['then'](respondWithResult(_0x72dbc7,null))[_0x00b7('0x1d')](handleError(_0x72dbc7,null));};exports[_0x00b7('0x97')]=function(_0x33aef3,_0x35d3c4){var _0x4e9233=_0x33aef3[_0x00b7('0x5a')]['channel'];return db[_0x00b7('0x3c')]['find']({'where':{'id':_0x33aef3['params']['id']},'attributes':['id',_0x00b7('0x34'),_0x00b7('0x2a'),_0x00b7('0x98'),_0x00b7('0x99'),_0x00b7('0x9a'),'interface']})['then'](handleEntityNotFound(_0x35d3c4,null))['then'](function(_0x44eda0){if(_0x44eda0){if(!utils[_0x00b7('0x9b')](_0x4e9233)){throw new db['Sequelize'][(_0x00b7('0x8f'))](_0x00b7('0x9c'));}return _0x44eda0[_0x00b7('0x9d')+_[_0x00b7('0x9e')](_0x4e9233[_0x00b7('0x9f')]())+'Queues'](_0x33aef3[_0x00b7('0x5a')][_0x00b7('0x5d')],{'penalty':_0x33aef3[_0x00b7('0x5a')][_0x00b7('0xa0')]||0x0})[_0x00b7('0xa1')](function(_0x4d56d4){for(var _0x43d2bb=0x0;_0x43d2bb<_0x33aef3[_0x00b7('0x5a')][_0x00b7('0x5d')][_0x00b7('0x45')];_0x43d2bb+=0x1){var _0x45a87d={'UserId':Number(_0x33aef3['params']['id'])};_0x45a87d[_[_0x00b7('0x9e')](_0x4e9233[_0x00b7('0x9f')]())+_0x00b7('0xa2')]=Number(_0x33aef3[_0x00b7('0x5a')][_0x00b7('0x5d')][_0x43d2bb]);socket[_0x00b7('0xa3')](_0x00b7('0x7a')+_[_0x00b7('0x9e')](_0x4e9233[_0x00b7('0x9f')]())+_0x00b7('0xa4'),_0x45a87d);}return _0x4d56d4;})[_0x00b7('0x14')](function(){if(_0x4e9233==='voice'){return db[_0x00b7('0xa5')][_0x00b7('0x41')]({'where':{'id':_0x33aef3['body'][_0x00b7('0x5d')]||[]},'raw':!![],'attributes':['id',_0x00b7('0x34')]});}})[_0x00b7('0x14')](function(_0xecacd2){var _0x13cca8=_0x44eda0[_0x00b7('0x29')]({'plain':!![]});var _0x56f230=[];if(_0x4e9233==='voice'&&_0x13cca8[_0x00b7('0x2a')]===_0x00b7('0x2e')&&_0x13cca8['online']){for(var _0x373303=0x0;_0x373303<_0xecacd2[_0x00b7('0x45')];_0x373303+=0x1){_0x56f230[_0x00b7('0x40')]({'membername':_0x13cca8[_0x00b7('0x34')],'UserId':_0x13cca8['id'],'queue_name':_0xecacd2[_0x373303][_0x00b7('0x34')],'VoiceQueueId':_0xecacd2[_0x373303]['id'],'interface':_[_0x00b7('0x65')](_0x13cca8[_0x00b7('0xa6')])?util[_0x00b7('0xa7')](_0x00b7('0xa8'),_0x13cca8['name']):_0x13cca8['interface'],'paused':_0x13cca8[_0x00b7('0x9a')]||![],'penalty':_0x33aef3[_0x00b7('0x5a')]['penalty']||0x0});}return BPromise[_0x00b7('0x86')](_0x56f230,function(_0x43c14d){return db['UserVoiceQueueRt'][_0x00b7('0xa9')](_0x43c14d);});}return _0x44eda0;});}})[_0x00b7('0x14')](respondWithStatusCode(_0x35d3c4,null))[_0x00b7('0x1d')](handleError(_0x35d3c4,null));};exports[_0x00b7('0xaa')]=function(_0x175e7a,_0x1d5df4){var _0x48675f;return db[_0x00b7('0x3c')][_0x00b7('0x33')]({'where':{'id':_0x175e7a[_0x00b7('0x4f')]['id']},'attributes':['id',_0x00b7('0x34'),'role']})[_0x00b7('0x14')](handleEntityNotFound(_0x1d5df4,null))[_0x00b7('0x14')](function(_0x5b1e34){if(_0x5b1e34){_0x48675f=_0x5b1e34;if(!_0x175e7a[_0x00b7('0x54')][_0x00b7('0xab')]||!utils[_0x00b7('0x9b')](_0x175e7a[_0x00b7('0x54')][_0x00b7('0xab')])){throw new db[(_0x00b7('0x8c'))][(_0x00b7('0x8f'))](_0x00b7('0x9c'));}return _0x5b1e34[_0x00b7('0xac')+_[_0x00b7('0x9e')](_0x175e7a['query'][_0x00b7('0xab')]['toLowerCase']())+_0x00b7('0xad')](_0x175e7a[_0x00b7('0x54')][_0x00b7('0x5d')]);}})[_0x00b7('0x14')](function(_0x31387f){if(_[_0x00b7('0xae')](_0x175e7a['query'][_0x00b7('0x5d')])){for(var _0x202e1f=0x0;_0x202e1f<_0x175e7a['query']['ids'][_0x00b7('0x45')];_0x202e1f+=0x1){var _0x54bc6e={'UserId':Number(_0x175e7a[_0x00b7('0x4f')]['id'])};_0x54bc6e[_['capitalize'](_0x175e7a[_0x00b7('0x54')]['channel'][_0x00b7('0x9f')]())+_0x00b7('0xa2')]=Number(_0x175e7a['query'][_0x00b7('0x5d')][_0x202e1f]);socket['emit'](_0x00b7('0x7a')+_['capitalize'](_0x175e7a[_0x00b7('0x54')][_0x00b7('0xab')]['toLowerCase']())+_0x00b7('0xaf'),_0x54bc6e);}}else{var _0x54bc6e={'UserId':Number(_0x175e7a['params']['id'])};_0x54bc6e[_['capitalize'](_0x175e7a[_0x00b7('0x54')][_0x00b7('0xab')]['toLowerCase']())+_0x00b7('0xa2')]=Number(_0x175e7a[_0x00b7('0x54')]['ids']);socket[_0x00b7('0xa3')](_0x00b7('0x7a')+_[_0x00b7('0x9e')](_0x175e7a[_0x00b7('0x54')]['channel'][_0x00b7('0x9f')]())+'Queue:remove',_0x54bc6e);}return _0x31387f;})[_0x00b7('0x14')](function(){if(_0x175e7a[_0x00b7('0x54')][_0x00b7('0xab')]===_0x00b7('0xb0')){return db['UserVoiceQueueRt'][_0x00b7('0x28')]({'where':{'UserId':_0x175e7a[_0x00b7('0x4f')]['id'],'VoiceQueueId':_0x175e7a[_0x00b7('0x54')][_0x00b7('0x5d')]},'individualHooks':!![]})['then'](function(){return _0x48675f;});}return _0x48675f;})[_0x00b7('0x14')](respondWithStatusCode(_0x1d5df4,null))[_0x00b7('0x1d')](handleError(_0x1d5df4,null));};exports[_0x00b7('0xb1')]=function(_0x951cca,_0x4de6e6){_0x951cca[_0x00b7('0x5a')]['userpic']=_0x951cca['file'][_0x00b7('0xb2')];return db[_0x00b7('0x3c')][_0x00b7('0x33')]({'where':{'id':_0x951cca[_0x00b7('0x4f')]['id']}})[_0x00b7('0x14')](handleEntityNotFound(_0x4de6e6,null))[_0x00b7('0x14')](saveUpdates(_0x951cca[_0x00b7('0x5a')],null))[_0x00b7('0x14')](respondWithResult(_0x4de6e6,null))[_0x00b7('0x1d')](handleError(_0x4de6e6,null));};exports['getAvatar']=function(_0x3fd75,_0x120efe){var _0x320522=path[_0x00b7('0xb3')](config['root'],_0x00b7('0xb4'));return db[_0x00b7('0x3c')][_0x00b7('0x33')]({'where':{'id':_0x3fd75[_0x00b7('0x4f')]['id']},'attributes':['id',_0x00b7('0xb5')],'raw':!![]})[_0x00b7('0x14')](handleEntityNotFound(_0x120efe,null))[_0x00b7('0x14')](function(_0x166b2a){if(_0x166b2a){if(_[_0x00b7('0x65')](_0x166b2a['userpic'])){return _0x120efe['download'](_0x320522);}else{if(!fs[_0x00b7('0xb6')](path[_0x00b7('0xb3')](config['root'],'server/files/images/',_0x166b2a['userpic']))){return _0x120efe['download'](_0x320522);}return _0x120efe[_0x00b7('0xb7')](path['join'](config[_0x00b7('0xb8')],_0x00b7('0xb9'),_0x166b2a[_0x00b7('0xb5')]));}}})[_0x00b7('0x1d')](handleError(_0x120efe,null));};exports[_0x00b7('0xba')]=function(_0x53c650,_0x5f1cb3){return db[_0x00b7('0x3c')][_0x00b7('0x33')]({'where':{'id':_0x53c650['params']['id']},'attributes':['id']})[_0x00b7('0x14')](handleEntityNotFound(_0x5f1cb3,null))[_0x00b7('0x14')](function(_0x46074e){var _0x3cdfda=[];values=_0x46074e[_0x00b7('0x47')];_0x3cdfda[_0x00b7('0x40')](get_open_tabs('chat',_0x46074e[_0x00b7('0x47')]));_0x3cdfda[_0x00b7('0x40')](get_open_tabs(_0x00b7('0x48'),_0x46074e[_0x00b7('0x47')]));_0x3cdfda[_0x00b7('0x40')](get_open_tabs(_0x00b7('0x4b'),_0x46074e[_0x00b7('0x47')]));_0x3cdfda['push'](get_open_tabs(_0x00b7('0x4c'),_0x46074e[_0x00b7('0x47')]));_0x3cdfda[_0x00b7('0x40')](get_open_tabs(_0x00b7('0x49'),_0x46074e[_0x00b7('0x47')]));_0x3cdfda[_0x00b7('0x40')](get_open_tabs('mail',_0x46074e[_0x00b7('0x47')]));return BPromise[_0x00b7('0x4d')](_0x3cdfda);})[_0x00b7('0x14')](function(_0x5a0a98){var _0x3da250=[];if(_0x5a0a98){for(var _0xd6c234=0x0;_0xd6c234=_0x2baed0){_0x3544ba=_0x2baed0;_0x483aee=0xc8;}else{_0x483aee=0xce;}_0x256202[_0x8db2('0x20')](_0x483aee);return _0x256202[_0x8db2('0x26')](_0x8db2('0x27'),_0x8d4f54+'-'+_0x3544ba+'/'+_0x2baed0)[_0x8db2('0x28')](_0x5725f0);}return null;};}function saveUpdates(_0xbe5ece){return function(_0x21bae5){if(_0x21bae5){return _0x21bae5[_0x8db2('0x29')](_0xbe5ece)[_0x8db2('0x15')](function(_0xbc5366){return _0xbc5366;});}return null;};}function removeEntity(_0x493cab){return function(_0x4718ec){if(_0x4718ec){return _0x4718ec['destroy']()['then'](function(){var _0x302188=_0x4718ec[_0x8db2('0x2a')]({'plain':!![]});if(_0x302188[_0x8db2('0x2b')]==='admin')return;var _0x42b272=[{'name':'Users','value':_0x8db2('0x2c'),'ignore':!![]},{'name':_0x8db2('0x2d'),'value':_0x8db2('0x2e'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x35d337=_(_0x42b272)[_0x8db2('0x2f')]('ignore')['map'](_0x8db2('0x30'))[_0x8db2('0x30')]();if(_[_0x8db2('0x31')](_0x35d337,_0x302188[_0x8db2('0x2b')])){return;}var _0x17ad44=_[_0x8db2('0x32')](_0x42b272,[_0x8db2('0x30'),_0x302188[_0x8db2('0x2b')]])[_0x8db2('0x33')];return db[_0x8db2('0x34')]['destroy']({'where':{'type':_0x17ad44,'resourceId':_0x302188['id']}})[_0x8db2('0x15')](function(){return _0x4718ec;});})[_0x8db2('0x15')](function(){_0x493cab['status'](0xcc)[_0x8db2('0x21')]();});}};}function handleEntityNotFound(_0x3ca80b){return function(_0x5962e6){if(!_0x5962e6){_0x3ca80b['sendStatus'](0x194);}return _0x5962e6;};}function handleError(_0x3c1983,_0x4a45dd){_0x4a45dd=_0x4a45dd||0x1f4;return function(_0x3dfbaa){logger[_0x8db2('0x1b')](_0x3dfbaa[_0x8db2('0x35')]);if(_0x3dfbaa[_0x8db2('0x33')]){delete _0x3dfbaa['name'];}_0x3c1983[_0x8db2('0x20')](_0x4a45dd)['send'](_0x3dfbaa);};}exports[_0x8db2('0x36')]=function(_0xd550ae,_0x2c8bc9){var _0x4599c3={},_0x50e88a={'count':0x0,'rows':[]};var _0x50ee17=_(db[_0x8db2('0x37')][_0x8db2('0x38')])['map'](function(_0x2bac57){return{'name':_0x2bac57[_0x8db2('0x39')],'type':_0x2bac57[_0x8db2('0x3a')]['key']};})[_0x8db2('0x2f')](function(_0x149186){return!_[_0x8db2('0x31')]([_0x8db2('0x3b'),_0x8db2('0x3c')],_0x149186[_0x8db2('0x33')]);})[_0x8db2('0x30')]();_0x4599c3=qs[_0x8db2('0x3d')](_0x50ee17,_0xd550ae);var _0x3793a4={'where':_0x4599c3[_0x8db2('0x3e')]};return db[_0x8db2('0x37')][_0x8db2('0x24')](_0x3793a4)[_0x8db2('0x15')](function(_0x4a1c60){_0x50e88a[_0x8db2('0x24')]=_0x4a1c60;if(_0xd550ae[_0x8db2('0x3f')]['includeAll']){_0x4599c3['include']=[{'all':!![]}];}if(!_[_0x8db2('0x31')](_0x4599c3['attributes'],'id')){_0x4599c3[_0x8db2('0x40')][_0x8db2('0x41')]('id');}return db[_0x8db2('0x37')][_0x8db2('0x42')](_0x4599c3);})[_0x8db2('0x15')](function(_0x30d606){_0x50e88a[_0x8db2('0x43')]=_0x30d606;if(_0xd550ae['query'][_0x8db2('0x44')]===_0x8db2('0x45')){var _0x40c69e=[];for(var _0x4a0b56=0x0;_0x4a0b56<_0x50e88a['rows'][_0x8db2('0x46')];_0x4a0b56++){_0x40c69e[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x47'),_0x50e88a[_0x8db2('0x43')][_0x4a0b56]['dataValues']));_0x40c69e[_0x8db2('0x41')](get_open_tabs('sms',_0x50e88a[_0x8db2('0x43')][_0x4a0b56][_0x8db2('0x48')]));_0x40c69e[_0x8db2('0x41')](get_open_tabs('fax',_0x50e88a['rows'][_0x4a0b56][_0x8db2('0x48')]));_0x40c69e['push'](get_open_tabs(_0x8db2('0x49'),_0x50e88a[_0x8db2('0x43')][_0x4a0b56][_0x8db2('0x48')]));_0x40c69e[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x4a'),_0x50e88a[_0x8db2('0x43')][_0x4a0b56][_0x8db2('0x48')]));_0x40c69e[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x4b'),_0x50e88a[_0x8db2('0x43')][_0x4a0b56][_0x8db2('0x48')]));}return BPromise[_0x8db2('0x4c')](_0x40c69e)['then'](function(_0x449109){return _0x50e88a;});}else{return _0x50e88a;}})[_0x8db2('0x15')](respondWithFilteredResult(_0x2c8bc9,_0x4599c3))[_0x8db2('0x4d')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x4e')]=function(_0x4f5018,_0x4ffd9d){var _0x11c224={'raw':![],'where':{'id':_0x4f5018[_0x8db2('0x4f')]['id']}},_0x2e46d4={};_0x2e46d4['model']=_['differenceBy'](_['keys'](db[_0x8db2('0x37')][_0x8db2('0x38')]),[_0x8db2('0x3b'),_0x8db2('0x3c')]);_0x2e46d4[_0x8db2('0x3f')]=_[_0x8db2('0x50')](_0x4f5018[_0x8db2('0x3f')]);_0x2e46d4['filters']=_['intersection'](_0x2e46d4[_0x8db2('0x51')],_0x2e46d4[_0x8db2('0x3f')]);_0x11c224[_0x8db2('0x40')]=_[_0x8db2('0x52')](_0x2e46d4[_0x8db2('0x51')],qs[_0x8db2('0x53')](_0x4f5018[_0x8db2('0x3f')][_0x8db2('0x53')]));_0x11c224[_0x8db2('0x40')]=_0x11c224[_0x8db2('0x40')][_0x8db2('0x46')]?_0x11c224[_0x8db2('0x40')]:_0x2e46d4[_0x8db2('0x51')];if(_0x4f5018[_0x8db2('0x3f')][_0x8db2('0x54')]){_0x11c224['include']=[{'all':!![]}];}_0x11c224=_[_0x8db2('0x55')]({},_0x11c224,_0x4f5018[_0x8db2('0x56')]);if(!_['includes'](_0x11c224[_0x8db2('0x40')],'id')){_0x11c224[_0x8db2('0x40')][_0x8db2('0x41')]('id');}return db['User'][_0x8db2('0x32')](_0x11c224)[_0x8db2('0x15')](handleEntityNotFound(_0x4ffd9d,null))[_0x8db2('0x15')](function(_0x1f41f2){var _0x1167d5=[];values=_0x1f41f2;if(_0x4f5018['query'][_0x8db2('0x44')]===_0x8db2('0x45')){_0x1167d5[_0x8db2('0x41')](get_open_tabs('chat',_0x1f41f2[_0x8db2('0x48')]));_0x1167d5[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x57'),_0x1f41f2[_0x8db2('0x48')]));_0x1167d5[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x4a'),_0x1f41f2[_0x8db2('0x48')]));_0x1167d5['push'](get_open_tabs(_0x8db2('0x4b'),_0x1f41f2[_0x8db2('0x48')]));_0x1167d5['push'](get_open_tabs(_0x8db2('0x58'),_0x1f41f2[_0x8db2('0x48')]));_0x1167d5['push'](get_open_tabs(_0x8db2('0x49'),_0x1f41f2[_0x8db2('0x48')]));return BPromise[_0x8db2('0x4c')](_0x1167d5);}else{return values;}})[_0x8db2('0x15')](function(_0x42b941){return values;})[_0x8db2('0x15')](respondWithResult(_0x4ffd9d,null))[_0x8db2('0x4d')](handleError(_0x4ffd9d,null));};exports[_0x8db2('0x29')]=function(_0x120ef2,_0x173a5e){if(_0x120ef2[_0x8db2('0x59')]['id']){delete _0x120ef2[_0x8db2('0x59')]['id'];}delete _0x120ef2[_0x8db2('0x59')][_0x8db2('0x2b')];return db[_0x8db2('0x37')][_0x8db2('0x32')]({'where':{'id':_0x120ef2['params']['id']}})[_0x8db2('0x15')](handleEntityNotFound(_0x173a5e,null))[_0x8db2('0x15')](saveUpdates(_0x120ef2[_0x8db2('0x59')],null))[_0x8db2('0x15')](respondWithResult(_0x173a5e,null))[_0x8db2('0x4d')](handleError(_0x173a5e,null));};exports['describe']=function(_0x3dd6b1,_0x2c3087){return db[_0x8db2('0x37')][_0x8db2('0x5a')]()[_0x8db2('0x15')](respondWithResult(_0x2c3087,null))[_0x8db2('0x4d')](handleError(_0x2c3087,null));};exports[_0x8db2('0x5b')]=function(_0x2c7b04,_0x24cfe9){return db[_0x8db2('0x37')][_0x8db2('0x32')]({'where':{'id':_0x2c7b04[_0x8db2('0x4f')]['id']}})[_0x8db2('0x15')](handleEntityNotFound(_0x24cfe9,null))[_0x8db2('0x15')](function(_0xed9d36){if(_0xed9d36){return _0xed9d36[_0x8db2('0x5b')](_0x2c7b04[_0x8db2('0x59')][_0x8db2('0x5c')],_['omit'](_0x2c7b04[_0x8db2('0x59')],['ids','id'])||{});}})[_0x8db2('0x15')](respondWithResult(_0x24cfe9,null))['catch'](handleError(_0x24cfe9,null));};function validateUser(_0x3de11e){return new BPromise(function(_0x39330c,_0xe4fd6a){if(_0x3de11e[_0x8db2('0x5d')])return _0x39330c(_0x3de11e);return db[_0x8db2('0x5e')]['findById'](0x1)['then'](function(_0x3d1128){if(_0x3d1128[_0x8db2('0x5f')])authService[_0x8db2('0x60')](_0x3de11e[_0x8db2('0x3b')]);db[_0x8db2('0x37')][_0x8db2('0x61')](_0x8db2('0x5d'))[_0x8db2('0x15')](function(_0x504039){if(_[_0x8db2('0x62')](_0x504039)){_0x3de11e[_0x8db2('0x5d')]=_0x3d1128[_0x8db2('0x63')]||0x1;return;}if(_[_0x8db2('0x62')](_0x3d1128[_0x8db2('0x63')])||_0x3d1128[_0x8db2('0x63')]===_0x504039){_0x3de11e[_0x8db2('0x5d')]=_0x504039+0x1;return;}if(_0x3d1128[_0x8db2('0x63')]>_0x504039){_0x3de11e['internal']=_0x3d1128['min_internal'];return;}return db[_0x8db2('0x64')][_0x8db2('0x3f')](_0x8db2('0x65'),{'type':db[_0x8db2('0x64')][_0x8db2('0x66')]['SELECT']})['then'](function(_0x3611da){if(_0x3611da&&_0x3611da[_0x8db2('0x46')]){for(var _0x54f0d4=0x0,_0xa698bd=_0x3611da[_0x8db2('0x46')];_0x54f0d4<_0xa698bd&&_[_0x8db2('0x62')](_0x3de11e['internal']);_0x54f0d4++){if(_0x3d1128[_0x8db2('0x63')]<=_0x3611da[_0x54f0d4][_0x8db2('0x67')]){_0x3de11e[_0x8db2('0x5d')]=_0x3611da[_0x54f0d4]['from'];}else if(_0x3d1128[_0x8db2('0x63')]>_0x3611da[_0x54f0d4][_0x8db2('0x67')]&&_0x3d1128[_0x8db2('0x63')]<=_0x3611da[_0x54f0d4]['to']){_0x3de11e[_0x8db2('0x5d')]=_0x3d1128[_0x8db2('0x63')];}}}if(_['isNil'](_0x3de11e[_0x8db2('0x5d')])){_0x3de11e[_0x8db2('0x5d')]=_0x504039+0x1;}return _0x39330c(_0x3de11e);});});})[_0x8db2('0x4d')](function(_0x4b79e7){_0xe4fd6a(_0x4b79e7);});});}function updateUser(_0x59e740){return new BPromise(function(_0x2cdf3c,_0xbe05ca){try{if(_0x59e740['voicemail']){_0x59e740[_0x8db2('0x68')]=_0x59e740[_0x8db2('0x5d')];_0x59e740[_0x8db2('0x69')]={'mailbox':_0x59e740[_0x8db2('0x5d')],'password':_0x59e740[_0x8db2('0x3b')],'fullname':_0x59e740[_0x8db2('0x6a')],'email':_0x59e740[_0x8db2('0x6b')]};}if(_0x59e740[_0x8db2('0x2b')]===_0x8db2('0x2e')){if(!_0x59e740[_0x8db2('0x6c')])_0x59e740[_0x8db2('0x6c')]=[_0x8db2('0x6d'),_0x8db2('0x6e'),'103',_0x8db2('0x6f'),'110',_0x8db2('0x70'),_0x8db2('0x71'),'106',_0x8db2('0x72'),_0x8db2('0x73'),'109',_0x8db2('0x74'),_0x8db2('0x75'),_0x8db2('0x76'),_0x8db2('0x77')];}_0x2cdf3c(_0x59e740);}catch(_0x242379){_0xbe05ca(_0x242379);}});}exports[_0x8db2('0x78')]=function(_0x1f5565,_0x3ac0fa){if(_0x1f5565[_0x8db2('0x2c')]['role']==='agent')throw new Error(_0x8db2('0x79'));if(_0x1f5565['body'][_0x8db2('0x2b')]===_0x8db2('0x2c')&&_0x1f5565[_0x8db2('0x2c')]['role']!==_0x8db2('0x7a')){throw new Error(_0x8db2('0x7b'));}if(_0x1f5565[_0x8db2('0x59')]['role']===_0x8db2('0x7a')&&_0x1f5565[_0x8db2('0x2c')][_0x8db2('0x2b')]!==_0x8db2('0x7a')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x8db2('0x7c')]([_0x1f5565[_0x8db2('0x59')]])[_0x8db2('0x15')](function(){return validateUser(_0x1f5565[_0x8db2('0x59')]);})[_0x8db2('0x15')](function(_0x15fd4){return updateUser(_0x15fd4)[_0x8db2('0x15')](function(_0x3682bf){if(_0x3682bf[_0x8db2('0x2b')]===_0x8db2('0x7a')){_0x3682bf[_0x8db2('0x7d')]=_0x1f5565['user'][_0x8db2('0x7d')];delete _0x3682bf[_0x8db2('0x7e')];}return _0x3682bf;});})[_0x8db2('0x15')](function(_0x4b297f){return db['User']['create'](_0x4b297f,{'include':[{'model':db[_0x8db2('0x69')],'as':_0x8db2('0x69')}]});})[_0x8db2('0x15')](function(_0x454377){if(_0x1f5565[_0x8db2('0x59')][_0x8db2('0x2b')]===_0x8db2('0x2c'))return _0x454377;if(_0x1f5565[_0x8db2('0x2c')][_0x8db2('0x2b')]!==_0x8db2('0x2c'))return _0x454377;return db[_0x8db2('0x7f')]['find']({'where':{'name':_0x454377[_0x8db2('0x2b')]===_0x8db2('0x2e')?_0x8db2('0x2d'):_0x8db2('0x80'),'userProfileId':_0x1f5565['user']['userProfileId']},'raw':!![]})[_0x8db2('0x15')](function(_0x3c3f3e){if(!_0x3c3f3e||_0x3c3f3e['autoAssociation']!=0x0)return _0x454377;return db[_0x8db2('0x34')][_0x8db2('0x78')]({'name':_0x454377[_0x8db2('0x33')],'resourceId':_0x454377['id'],'type':_0x3c3f3e['name'],'sectionId':_0x3c3f3e['id']},{})['then'](function(){return _0x454377;});})['catch'](function(_0x468f90){logger[_0x8db2('0x1b')](_0x8db2('0x81'),_0x468f90);throw _0x468f90;});})[_0x8db2('0x15')](respondWithResult(_0x3ac0fa,0xc9))[_0x8db2('0x4d')](handleError(_0x3ac0fa,null));};exports['bulkCreate']=function(_0x30930a,_0x5e349c){var _0x8c54c=_0x30930a[_0x8db2('0x59')];var _0xa083b1=[];if(_0x30930a[_0x8db2('0x2c')][_0x8db2('0x2b')]==='agent')throw new Error('Unauthorized');if(_[_0x8db2('0x82')](_0x8c54c,['role',_0x8db2('0x2c')])&&_0x30930a[_0x8db2('0x2c')][_0x8db2('0x2b')]!==_0x8db2('0x7a')){throw new Error(_0x8db2('0x7b'));}if(_[_0x8db2('0x82')](_0x8c54c,['role',_0x8db2('0x7a')])&&_0x30930a[_0x8db2('0x2c')][_0x8db2('0x2b')]!=='admin'){throw new Error(_0x8db2('0x83'));}return licenseUtil[_0x8db2('0x7c')](_0x8c54c)['then'](function(){return validateUser(_0x8c54c[0x0]);})[_0x8db2('0x15')](function(){for(var _0x7cb97d=0x1;_0x7cb97d<_0x8c54c[_0x8db2('0x46')];_0x7cb97d++){var _0x15307d=_0x8c54c[_0x7cb97d-0x1][_0x8db2('0x5d')];if(!_0x8c54c[_0x7cb97d][_0x8db2('0x5d')])_0x8c54c[_0x7cb97d][_0x8db2('0x5d')]=_0x15307d+0x1;_0xa083b1[_0x8db2('0x41')](validateUser(_0x8c54c[_0x7cb97d]));}return BPromise[_0x8db2('0x4c')](_0xa083b1);})['then'](function(){_0xa083b1=[];for(var _0x44c0cc=0x0;_0x44c0cc<_0x8c54c[_0x8db2('0x46')];_0x44c0cc++){_0xa083b1[_0x8db2('0x41')](updateUser(_0x8c54c[_0x44c0cc]));}return BPromise[_0x8db2('0x4c')](_0xa083b1);})[_0x8db2('0x15')](function(){return BPromise[_0x8db2('0x84')](_0x8c54c,function(_0x16d1c5){return db[_0x8db2('0x37')][_0x8db2('0x78')](_0x16d1c5,{'include':[{'model':db[_0x8db2('0x69')],'as':'VoiceMail'}]})[_0x8db2('0x15')](function(_0x7e4bf){_0x16d1c5['id']=_0x7e4bf['id'];return _0x16d1c5;});});})[_0x8db2('0x15')](function(_0x1587e8){if(_0x30930a['body'][_0x8db2('0x2b')]===_0x8db2('0x2c'))return _0x1587e8;if(_0x30930a[_0x8db2('0x2c')]['role']!=='user')return _0x1587e8;var _0x1fdeee=_[_0x8db2('0x82')](_0x1587e8,function(_0x15b85e){return _0x15b85e[_0x8db2('0x2b')]==='agent'||_0x15b85e[_0x8db2('0x2b')]===_0x8db2('0x85');});if(!_0x1fdeee)return _0x1587e8;return db[_0x8db2('0x7f')][_0x8db2('0x42')]({'where':{'name':{'$or':['Agents',_0x8db2('0x80')]},'userProfileId':_0x30930a[_0x8db2('0x2c')][_0x8db2('0x7e')]},'raw':!![]})['then'](function(_0x5742c5){if(_['isEmpty'](_0x5742c5)||!_[_0x8db2('0x82')](_0x5742c5,[_0x8db2('0x86'),0x0]))return _0x1587e8;_0xa083b1=[];var _0x122029=_(_0x5742c5)[_0x8db2('0x87')](function(_0x53ae6f){if(_0x53ae6f['autoAssociation']===0x1)return;return _0x53ae6f[_0x8db2('0x33')]===_0x8db2('0x2d')?_0x8db2('0x2e'):_0x8db2('0x85');})[_0x8db2('0x88')]()[_0x8db2('0x30')]();for(var _0x57c265=0x0;_0x57c265<_0x1587e8[_0x8db2('0x46')];_0x57c265++){if(!_['includes'](_0x122029,_0x1587e8[_0x57c265][_0x8db2('0x2b')]))return;var _0x23457b=_0x1587e8[_0x57c265][_0x8db2('0x2b')]===_0x8db2('0x2e')?_0x8db2('0x2d'):'Telephones';_0xa083b1[_0x8db2('0x41')](db[_0x8db2('0x34')]['create']({'name':_0x1587e8[_0x57c265][_0x8db2('0x33')],'resourceId':_0x1587e8[_0x57c265]['id'],'type':_0x23457b,'sectionId':_[_0x8db2('0x32')](_0x5742c5,[_0x8db2('0x33'),_0x23457b])['id']},{}));}return BPromise[_0x8db2('0x4c')](_0xa083b1);});})['then'](respondWithResult(_0x5e349c,0xc9))[_0x8db2('0x4d')](handleError(_0x5e349c,null));};exports['changePassword']=function(_0x58ab95,_0xaa90b9){if(_0x58ab95[_0x8db2('0x59')]['id']){delete _0x58ab95[_0x8db2('0x59')]['id'];}return db[_0x8db2('0x37')][_0x8db2('0x32')]({'where':{'id':_0x58ab95[_0x8db2('0x4f')]['id']}})[_0x8db2('0x15')](function(_0x48c718){if(!_0x48c718)return null;if(_0x48c718['id']===_0x58ab95[_0x8db2('0x2c')]['id']){if(!_0x58ab95['body']['oldPassword']||!_0x58ab95[_0x8db2('0x59')]['newPassword']){throw new db['Sequelize'][(_0x8db2('0x89'))](_0x8db2('0x8a'));}if(!_0x48c718[_0x8db2('0x8b')](_0x58ab95['body'][_0x8db2('0x8c')])){throw new db[(_0x8db2('0x8d'))][(_0x8db2('0x89'))]('Wrong\x20credentials');}if(_0x58ab95[_0x8db2('0x59')][_0x8db2('0x8c')]===_0x58ab95[_0x8db2('0x59')][_0x8db2('0x8e')]){throw new db[(_0x8db2('0x8d'))][(_0x8db2('0x89'))](_0x8db2('0x8f'));}}else if(_0x58ab95[_0x8db2('0x2c')]['role']===_0x8db2('0x7a')){if(!_0x58ab95[_0x8db2('0x59')][_0x8db2('0x8e')]){throw new db[(_0x8db2('0x8d'))][(_0x8db2('0x89'))](_0x8db2('0x90'));}}else if(_0x58ab95[_0x8db2('0x2c')][_0x8db2('0x2b')]===_0x8db2('0x2c')){if(!_0x58ab95[_0x8db2('0x59')][_0x8db2('0x8e')]){throw new db['Sequelize'][(_0x8db2('0x89'))](_0x8db2('0x90'));}if(_0x48c718[_0x8db2('0x2b')]!=='agent'){throw new db[(_0x8db2('0x8d'))][(_0x8db2('0x89'))](_0x8db2('0x79'));}}else{throw new db['Sequelize']['ValidationError'](_0x8db2('0x79'));}return _0x48c718;})[_0x8db2('0x15')](handleEntityNotFound(_0xaa90b9,null))[_0x8db2('0x15')](function(_0x1f205d){return db[_0x8db2('0x5e')][_0x8db2('0x91')]({'attributes':['id',_0x8db2('0x5f'),_0x8db2('0x92'),_0x8db2('0x93')]})[_0x8db2('0x15')](function(_0x581ef1){if(_0x581ef1[_0x8db2('0x5f')])authService[_0x8db2('0x60')](_0x58ab95['body'][_0x8db2('0x8e')]);if(!_0x581ef1[_0x8db2('0x92')]||!_0x1f205d[_0x8db2('0x94')])return _0x1f205d;authService[_0x8db2('0x95')](_0x58ab95[_0x8db2('0x59')][_0x8db2('0x8e')],_0x1f205d[_0x8db2('0x94')],_0x581ef1[_0x8db2('0x93')]);return _0x1f205d;})[_0x8db2('0x15')](saveUpdates({'password':_0x58ab95[_0x8db2('0x59')][_0x8db2('0x8e')],'passwordResetAt':_0x58ab95['user']['id']==_0x58ab95[_0x8db2('0x4f')]['id']?moment():null,'previousPasswords':authService[_0x8db2('0x96')](_0x58ab95[_0x8db2('0x59')][_0x8db2('0x8e')],_0x1f205d[_0x8db2('0x94')])},null));})[_0x8db2('0x15')](respondWithResult(_0xaa90b9,null))['catch'](handleError(_0xaa90b9,null));};exports[_0x8db2('0x97')]=function(_0x19bc4d,_0x339dbf){var _0x858bbc=_0x19bc4d[_0x8db2('0x59')][_0x8db2('0x98')];return db[_0x8db2('0x37')][_0x8db2('0x32')]({'where':{'id':_0x19bc4d[_0x8db2('0x4f')]['id']},'attributes':['id',_0x8db2('0x33'),_0x8db2('0x2b'),'online','loginInPause',_0x8db2('0x99'),'interface']})[_0x8db2('0x15')](handleEntityNotFound(_0x339dbf,null))[_0x8db2('0x15')](function(_0x2428f1){if(_0x2428f1){if(!utils['isValidChannel'](_0x858bbc)){throw new db[(_0x8db2('0x8d'))][(_0x8db2('0x89'))](_0x8db2('0x9a'));}return _0x2428f1[_0x8db2('0x9b')+_['capitalize'](_0x858bbc[_0x8db2('0x9c')]())+_0x8db2('0x9d')](_0x19bc4d[_0x8db2('0x59')]['ids'],{'penalty':_0x19bc4d[_0x8db2('0x59')][_0x8db2('0x9e')]||0x0})[_0x8db2('0x9f')](function(_0x5e04be){for(var _0x38099e=0x0;_0x38099e<_0x19bc4d[_0x8db2('0x59')][_0x8db2('0x5c')]['length'];_0x38099e+=0x1){var _0x18ac5c={'UserId':Number(_0x19bc4d[_0x8db2('0x4f')]['id'])};_0x18ac5c[_['capitalize'](_0x858bbc[_0x8db2('0x9c')]())+_0x8db2('0xa0')]=Number(_0x19bc4d['body'][_0x8db2('0x5c')][_0x38099e]);socket[_0x8db2('0xa1')](_0x8db2('0x2c')+_['capitalize'](_0x858bbc['toLowerCase']())+_0x8db2('0xa2'),_0x18ac5c);}return _0x5e04be;})['then'](function(){if(_0x858bbc==='voice'){return db[_0x8db2('0xa3')][_0x8db2('0x42')]({'where':{'id':_0x19bc4d[_0x8db2('0x59')][_0x8db2('0x5c')]||[]},'raw':!![],'attributes':['id',_0x8db2('0x33')]});}})[_0x8db2('0x15')](function(_0x54d389){var _0x4f7dcd=_0x2428f1[_0x8db2('0x2a')]({'plain':!![]});var _0x2bb457=[];if(_0x858bbc===_0x8db2('0xa4')&&_0x4f7dcd[_0x8db2('0x2b')]==='agent'&&_0x4f7dcd[_0x8db2('0xa5')]){for(var _0x51d15e=0x0;_0x51d15e<_0x54d389[_0x8db2('0x46')];_0x51d15e+=0x1){_0x2bb457['push']({'membername':_0x4f7dcd[_0x8db2('0x33')],'UserId':_0x4f7dcd['id'],'queue_name':_0x54d389[_0x51d15e][_0x8db2('0x33')],'VoiceQueueId':_0x54d389[_0x51d15e]['id'],'interface':_[_0x8db2('0x62')](_0x4f7dcd[_0x8db2('0xa6')])?util[_0x8db2('0xa7')](_0x8db2('0xa8'),_0x4f7dcd['name']):_0x4f7dcd['interface'],'paused':_0x4f7dcd[_0x8db2('0x99')]||![],'penalty':_0x19bc4d[_0x8db2('0x59')][_0x8db2('0x9e')]||0x0});}return BPromise['each'](_0x2bb457,function(_0x4eb531){return db[_0x8db2('0xa9')][_0x8db2('0xaa')](_0x4eb531);});}return _0x2428f1;});}})[_0x8db2('0x15')](respondWithStatusCode(_0x339dbf,null))['catch'](handleError(_0x339dbf,null));};exports['removeQueues']=function(_0x31613c,_0x109d59){var _0x5e7912;return db[_0x8db2('0x37')][_0x8db2('0x32')]({'where':{'id':_0x31613c[_0x8db2('0x4f')]['id']},'attributes':['id',_0x8db2('0x33'),_0x8db2('0x2b')]})[_0x8db2('0x15')](handleEntityNotFound(_0x109d59,null))[_0x8db2('0x15')](function(_0x3bffd9){if(_0x3bffd9){_0x5e7912=_0x3bffd9;if(!_0x31613c[_0x8db2('0x3f')]['channel']||!utils['isValidChannel'](_0x31613c['query'][_0x8db2('0x98')])){throw new db[(_0x8db2('0x8d'))][(_0x8db2('0x89'))](_0x8db2('0x9a'));}return _0x3bffd9[_0x8db2('0xab')+_['capitalize'](_0x31613c[_0x8db2('0x3f')]['channel'][_0x8db2('0x9c')]())+_0x8db2('0x9d')](_0x31613c[_0x8db2('0x3f')][_0x8db2('0x5c')]);}})['then'](function(_0x44da4b){if(_['isArray'](_0x31613c[_0x8db2('0x3f')][_0x8db2('0x5c')])){for(var _0x4ad5c5=0x0;_0x4ad5c5<_0x31613c['query']['ids'][_0x8db2('0x46')];_0x4ad5c5+=0x1){var _0x340686={'UserId':Number(_0x31613c[_0x8db2('0x4f')]['id'])};_0x340686[_[_0x8db2('0xac')](_0x31613c['query'][_0x8db2('0x98')][_0x8db2('0x9c')]())+_0x8db2('0xa0')]=Number(_0x31613c[_0x8db2('0x3f')][_0x8db2('0x5c')][_0x4ad5c5]);socket['emit']('user'+_[_0x8db2('0xac')](_0x31613c[_0x8db2('0x3f')]['channel'][_0x8db2('0x9c')]())+_0x8db2('0xad'),_0x340686);}}else{var _0x340686={'UserId':Number(_0x31613c['params']['id'])};_0x340686[_[_0x8db2('0xac')](_0x31613c[_0x8db2('0x3f')][_0x8db2('0x98')][_0x8db2('0x9c')]())+_0x8db2('0xa0')]=Number(_0x31613c[_0x8db2('0x3f')][_0x8db2('0x5c')]);socket[_0x8db2('0xa1')](_0x8db2('0x2c')+_[_0x8db2('0xac')](_0x31613c[_0x8db2('0x3f')][_0x8db2('0x98')]['toLowerCase']())+_0x8db2('0xad'),_0x340686);}return _0x44da4b;})[_0x8db2('0x15')](function(){if(_0x31613c['query'][_0x8db2('0x98')]===_0x8db2('0xa4')){return db[_0x8db2('0xa9')][_0x8db2('0xae')]({'where':{'UserId':_0x31613c[_0x8db2('0x4f')]['id'],'VoiceQueueId':_0x31613c[_0x8db2('0x3f')][_0x8db2('0x5c')]},'individualHooks':!![]})[_0x8db2('0x15')](function(){return _0x5e7912;});}return _0x5e7912;})[_0x8db2('0x15')](respondWithStatusCode(_0x109d59,null))[_0x8db2('0x4d')](handleError(_0x109d59,null));};exports[_0x8db2('0xaf')]=function(_0x1748b4,_0x5c1870){_0x1748b4['body'][_0x8db2('0xb0')]=_0x1748b4[_0x8db2('0xb1')]['filename'];return db[_0x8db2('0x37')]['find']({'where':{'id':_0x1748b4[_0x8db2('0x4f')]['id']}})[_0x8db2('0x15')](handleEntityNotFound(_0x5c1870,null))[_0x8db2('0x15')](saveUpdates(_0x1748b4[_0x8db2('0x59')],null))[_0x8db2('0x15')](respondWithResult(_0x5c1870,null))[_0x8db2('0x4d')](handleError(_0x5c1870,null));};exports[_0x8db2('0xb2')]=function(_0x1c28c2,_0x505017){var _0x1c3e0f=path[_0x8db2('0xb3')](config[_0x8db2('0xb4')],_0x8db2('0xb5'));return db['User'][_0x8db2('0x32')]({'where':{'id':_0x1c28c2['params']['id']},'attributes':['id',_0x8db2('0xb0')],'raw':!![]})['then'](handleEntityNotFound(_0x505017,null))[_0x8db2('0x15')](function(_0x3155a6){if(_0x3155a6){if(_[_0x8db2('0x62')](_0x3155a6[_0x8db2('0xb0')])){return _0x505017['download'](_0x1c3e0f);}else{if(!fs[_0x8db2('0xb6')](path[_0x8db2('0xb3')](config[_0x8db2('0xb4')],_0x8db2('0xb7'),_0x3155a6[_0x8db2('0xb0')]))){return _0x505017[_0x8db2('0xb8')](_0x1c3e0f);}return _0x505017[_0x8db2('0xb8')](path[_0x8db2('0xb3')](config[_0x8db2('0xb4')],_0x8db2('0xb7'),_0x3155a6['userpic']));}}})['catch'](handleError(_0x505017,null));};exports['getOpenTabs']=function(_0x280d6a,_0x3191a5){return db[_0x8db2('0x37')][_0x8db2('0x32')]({'where':{'id':_0x280d6a[_0x8db2('0x4f')]['id']},'attributes':['id']})[_0x8db2('0x15')](handleEntityNotFound(_0x3191a5,null))[_0x8db2('0x15')](function(_0xd5a052){var _0x4bb49c=[];values=_0xd5a052[_0x8db2('0x48')];_0x4bb49c[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x47'),_0xd5a052[_0x8db2('0x48')]));_0x4bb49c[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x57'),_0xd5a052['dataValues']));_0x4bb49c[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x4a'),_0xd5a052['dataValues']));_0x4bb49c[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x4b'),_0xd5a052['dataValues']));_0x4bb49c[_0x8db2('0x41')](get_open_tabs('fax',_0xd5a052[_0x8db2('0x48')]));_0x4bb49c[_0x8db2('0x41')](get_open_tabs(_0x8db2('0x49'),_0xd5a052[_0x8db2('0x48')]));return BPromise[_0x8db2('0x4c')](_0x4bb49c);})[_0x8db2('0x15')](function(_0x165cda){var _0x4905e3=[];if(_0x165cda){for(var _0x3a254b=0x0;_0x3a254b=_0x275cc4[_0x555b('0x4f')]){throw new Error(_0x555b('0x50'));}})['then'](function(){if(_0x25eb3e){return db[_0x555b('0x29')][_0x555b('0x51')]({'where':{'membername':_0x25eb3e['name']},'individualHooks':!![]});}})[_0x555b('0xe')](function(){if(_0x25eb3e){return _0x25eb3e[_0x555b('0x52')]({'raw':!![]});}})[_0x555b('0xe')](function(_0x1f148b){if(_0x25eb3e){if(_0x1f148b){var _0x5424fe=[];_0x324ff3=_0x1f148b;if(_0x324ff3['length']){for(var _0x25e56e=0x0;_0x25e56e<_0x324ff3[_0x555b('0x2c')];_0x25e56e++){_0x5424fe[_0x555b('0x32')](db['UserVoiceQueueRt'][_0x555b('0x53')]({'membername':_0x25eb3e['name'],'UserId':_0x25eb3e['id'],'queue_name':_0x324ff3[_0x25e56e]['name'],'VoiceQueueId':_0x324ff3[_0x25e56e]['id'],'interface':_0x150782,'paused':_0x25eb3e[_0x555b('0x4a')]||![],'penalty':_0x324ff3[_0x25e56e][_0x555b('0x54')]||0x0}));}return BPromise[_0x555b('0x46')](_0x5424fe);}}}})[_0x555b('0xe')](function(){if(_0x25eb3e){return db[_0x555b('0x2b')][_0x555b('0x18')]({'where':{'membername':_0x25eb3e['name'],'exitAt':null}});}})[_0x555b('0xe')](function(_0x26d19a){if(_0x25eb3e){if(_0x26d19a&&_0x26d19a[_0x555b('0x2c')]){var _0x2a3829=[];_0x26d19a[_0x555b('0x31')](function(_0x179945){_0x2a3829[_0x555b('0x32')](_0x179945[_0x555b('0x2a')]({'exitAt':moment()[_0x555b('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x555b('0x46')](_0x2a3829);}}})[_0x555b('0xe')](function(_0x23f899){if(_0x25eb3e){var _0x25fefa=[];var _0x42946e=[];var _0x11711b=utils['getChannels']();var _0x8c161c={'membername':_0x25eb3e[_0x555b('0x25')],'interface':_0x150782,'enterAt':moment()[_0x555b('0x2d')](_0x555b('0x2e')),'role':_0x25eb3e[_0x555b('0x26')],'internal':_0x25eb3e[_0x555b('0x27')]};_0x11711b[_0x555b('0x31')](function(_0x4cd215){_0x25fefa[_0x555b('0x32')](_[_0x555b('0x55')]({'channel':_0x4cd215,'type':_0x555b('0x56'),'data1':'callysquare','data2':_0x150782},_0x8c161c));if(_0x25eb3e['loginInPause']){_0x42946e['push'](_['merge']({'channel':_0x4cd215,'type':_0x555b('0x35'),'data1':_0x555b('0x57')},_0x8c161c));}});return db['MemberReport']['bulkCreate'](_0x25fefa[_0x555b('0x58')](_0x42946e),{'individualHooks':!![]});}})[_0x555b('0xe')](function(){if(_0x25eb3e){return _0x25eb3e['update']({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x25eb3e[_0x555b('0x4a')]||![],'mailPause':_0x25eb3e['loginInPause']||![],'chatPause':_0x25eb3e['loginInPause']||![],'faxPause':_0x25eb3e['loginInPause']||![],'smsPause':_0x25eb3e[_0x555b('0x4a')]||![],'openchannelPause':_0x25eb3e['loginInPause']||![],'pauseType':_0x25eb3e[_0x555b('0x4a')]?'LOGININPAUSE':null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x150782});}})[_0x555b('0xe')](function(_0x396d61){_0x29acb5(_0x396d61);})[_0x555b('0x16')](function(_0x298a8e){_0x3b77c5(_0x124dbd[_0x555b('0x14')](0x1f4,_0x298a8e[_0x555b('0x15')]));});});}; \ No newline at end of file +var _0xd5ed=['internal','UserVoiceQueueRt','update','MemberReport','name','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','interface','PAUSE','body','type','DEFAULT\x20PAUSE','role','uniqueid','bulkCreate','findOne','isValidChannel','channel','Unknown\x20channel','voice','system','chat','sms','openchannel','whatsapp','set','%s%s','push','all','LogoutUser','destroy','LoginUser','mobile','loginInPause','agent','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./user.socket','register','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetUser','findAll','options','raw','where','attributes','include','map','model','then','ShowUser','User','find','PauseUser'];(function(_0x50d326,_0x1fc7e2){var _0x10f473=function(_0x2588fd){while(--_0x2588fd){_0x50d326['push'](_0x50d326['shift']());}};_0x10f473(++_0x1fc7e2);}(_0xd5ed,0x8d));var _0xdd5e=function(_0x29e194,_0x4875bf){_0x29e194=_0x29e194-0x0;var _0x3ac51c=_0xd5ed[_0x29e194];return _0x3ac51c;};'use strict';var _=require(_0xdd5e('0x0'));var util=require('util');var moment=require(_0xdd5e('0x1'));var BPromise=require(_0xdd5e('0x2'));var rs=require(_0xdd5e('0x3'));var fs=require('fs');var Redis=require(_0xdd5e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd5e('0x5'));var logger=require('../../config/logger')(_0xdd5e('0x6'));var config=require(_0xdd5e('0x7'));var jayson=require(_0xdd5e('0x8'));var client=jayson['client'][_0xdd5e('0x9')]({'port':0x232a});config['redis']=_[_0xdd5e('0xa')](config['redis'],{'host':_0xdd5e('0xb'),'port':0x18eb});var socket=require(_0xdd5e('0xc'))(new Redis(config[_0xdd5e('0xd')]));require(_0xdd5e('0xe'))[_0xdd5e('0xf')](socket);function respondWithRpcPromise(_0x253762,_0xb1d5e4,_0x2b0f72){return new BPromise(function(_0x39e2cf,_0x539990){return client[_0xdd5e('0x10')](_0x253762,_0x2b0f72)['then'](function(_0x20dbc4){logger[_0xdd5e('0x11')](_0xdd5e('0x12'),_0xb1d5e4,_0xdd5e('0x13'));logger[_0xdd5e('0x14')](_0xdd5e('0x15'),_0xb1d5e4,_0xdd5e('0x13'),JSON[_0xdd5e('0x16')](_0x20dbc4));if(_0x20dbc4['error']){if(_0x20dbc4[_0xdd5e('0x17')][_0xdd5e('0x18')]===0x1f4){logger[_0xdd5e('0x17')](_0xdd5e('0x12'),_0xb1d5e4,_0x20dbc4[_0xdd5e('0x17')]['message']);return _0x539990(_0x20dbc4[_0xdd5e('0x17')][_0xdd5e('0x19')]);}logger[_0xdd5e('0x17')](_0xdd5e('0x12'),_0xb1d5e4,_0x20dbc4[_0xdd5e('0x17')][_0xdd5e('0x19')]);return _0x39e2cf(_0x20dbc4['error']['message']);}else{logger[_0xdd5e('0x11')](_0xdd5e('0x12'),_0xb1d5e4,'request\x20sent');_0x39e2cf(_0x20dbc4['result'][_0xdd5e('0x19')]);}})[_0xdd5e('0x1a')](function(_0x2c1fc8){logger[_0xdd5e('0x17')]('User,\x20%s,\x20%s',_0xb1d5e4,_0x2c1fc8);_0x539990(_0x2c1fc8);});});}exports[_0xdd5e('0x1b')]=function(_0x44b2b4){var _0x3c8f61=this;return new Promise(function(_0x1bc411,_0x1dca20){return db['User'][_0xdd5e('0x1c')]({'raw':_0x44b2b4[_0xdd5e('0x1d')]?_0x44b2b4[_0xdd5e('0x1d')][_0xdd5e('0x1e')]===undefined?!![]:![]:!![],'where':_0x44b2b4[_0xdd5e('0x1d')]?_0x44b2b4[_0xdd5e('0x1d')][_0xdd5e('0x1f')]||null:null,'attributes':_0x44b2b4[_0xdd5e('0x1d')]?_0x44b2b4[_0xdd5e('0x1d')][_0xdd5e('0x20')]||null:null,'limit':_0x44b2b4[_0xdd5e('0x1d')]?_0x44b2b4[_0xdd5e('0x1d')]['limit']||null:null,'include':_0x44b2b4[_0xdd5e('0x1d')]?_0x44b2b4[_0xdd5e('0x1d')][_0xdd5e('0x21')]?_[_0xdd5e('0x22')](_0x44b2b4[_0xdd5e('0x1d')][_0xdd5e('0x21')],function(_0x167a5e){return{'model':db[_0x167a5e['model']],'as':_0x167a5e['as'],'attributes':_0x167a5e[_0xdd5e('0x20')],'include':_0x167a5e[_0xdd5e('0x21')]?_[_0xdd5e('0x22')](_0x167a5e['include'],function(_0xda785b){return{'model':db[_0xda785b['model']],'as':_0xda785b['as'],'attributes':_0xda785b['attributes'],'include':_0xda785b['include']?_[_0xdd5e('0x22')](_0xda785b[_0xdd5e('0x21')],function(_0x3653ff){return{'model':db[_0x3653ff[_0xdd5e('0x23')]],'as':_0x3653ff['as'],'attributes':_0x3653ff[_0xdd5e('0x20')]};}):[]};}):[]};}):[]:[]})[_0xdd5e('0x24')](function(_0x1f58d4){logger[_0xdd5e('0x11')](_0xdd5e('0x1b'),_0x44b2b4);logger[_0xdd5e('0x14')]('GetUser',_0x44b2b4,JSON[_0xdd5e('0x16')](_0x1f58d4));_0x1bc411(_0x1f58d4);})[_0xdd5e('0x1a')](function(_0x4eadb3){logger[_0xdd5e('0x17')](_0xdd5e('0x1b'),_0x4eadb3['message'],_0x44b2b4);_0x1dca20(_0x3c8f61[_0xdd5e('0x17')](0x1f4,_0x4eadb3['message']));});});};exports[_0xdd5e('0x25')]=function(_0x358e71){var _0xde7a17=this;return new Promise(function(_0x2d6d2d,_0x4807fc){return db[_0xdd5e('0x26')][_0xdd5e('0x27')]({'raw':_0x358e71[_0xdd5e('0x1d')]?_0x358e71[_0xdd5e('0x1d')][_0xdd5e('0x1e')]===undefined?!![]:![]:!![],'where':_0x358e71[_0xdd5e('0x1d')]?_0x358e71[_0xdd5e('0x1d')][_0xdd5e('0x1f')]||null:null,'attributes':_0x358e71['options']?_0x358e71[_0xdd5e('0x1d')][_0xdd5e('0x20')]||null:null,'include':_0x358e71[_0xdd5e('0x1d')]?_0x358e71[_0xdd5e('0x1d')][_0xdd5e('0x21')]?_['map'](_0x358e71[_0xdd5e('0x1d')]['include'],function(_0xd69d1a){return{'model':db[_0xd69d1a[_0xdd5e('0x23')]],'as':_0xd69d1a['as'],'attributes':_0xd69d1a[_0xdd5e('0x20')],'include':_0xd69d1a[_0xdd5e('0x21')]?_[_0xdd5e('0x22')](_0xd69d1a[_0xdd5e('0x21')],function(_0x18a74e){return{'model':db[_0x18a74e[_0xdd5e('0x23')]],'as':_0x18a74e['as'],'attributes':_0x18a74e['attributes'],'include':_0x18a74e[_0xdd5e('0x21')]?_[_0xdd5e('0x22')](_0x18a74e[_0xdd5e('0x21')],function(_0x199cc8){return{'model':db[_0x199cc8[_0xdd5e('0x23')]],'as':_0x199cc8['as'],'attributes':_0x199cc8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ea277){logger['info'](_0xdd5e('0x25'),_0x358e71);logger[_0xdd5e('0x14')](_0xdd5e('0x25'),_0x358e71,JSON[_0xdd5e('0x16')](_0x2ea277));_0x2d6d2d(_0x2ea277);})[_0xdd5e('0x1a')](function(_0x569a86){logger[_0xdd5e('0x17')](_0xdd5e('0x25'),_0x569a86[_0xdd5e('0x19')],_0x358e71);_0x4807fc(_0xde7a17['error'](0x1f4,_0x569a86[_0xdd5e('0x19')]));});});};exports[_0xdd5e('0x28')]=function(_0x262fff){var _0x38fe0d=this;return new Promise(function(_0x1de322,_0x3e86ce){var _0x559230;return db[_0xdd5e('0x26')][_0xdd5e('0x27')]({'where':_0x262fff[_0xdd5e('0x1d')]['where']||{},'attributes':['id','name','role',_0xdd5e('0x29'),'interface']})[_0xdd5e('0x24')](function(_0x508748){if(_0x508748){_0x559230=_0x508748;return db[_0xdd5e('0x2a')][_0xdd5e('0x2b')]({'paused':0x1},{'where':{'UserId':_0x559230['id']},'individualHooks':!![]});}})[_0xdd5e('0x24')](function(){if(_0x559230){return db[_0xdd5e('0x2c')][_0xdd5e('0x1c')]({'where':{'membername':_0x559230[_0xdd5e('0x2d')],'type':'PAUSE','exitAt':null}});}})[_0xdd5e('0x24')](function(_0x3dbb96){if(_0x559230){if(_0x3dbb96&&_0x3dbb96[_0xdd5e('0x2e')]){var _0x1e1e69=moment()[_0xdd5e('0x2f')](_0xdd5e('0x30'));for(var _0x290990=0x0,_0x35cb83=_0x3dbb96[_0xdd5e('0x2e')];_0x290990<_0x35cb83;_0x290990++){_0x3dbb96[_0x290990][_0xdd5e('0x31')]({'exitAt':_0x1e1e69});}}}})[_0xdd5e('0x24')](function(){if(_0x559230){var _0x4c48d6=[];var _0x13e08b=utils[_0xdd5e('0x32')]();_0x13e08b[_0xdd5e('0x33')](function(_0x551dc9){_0x4c48d6['push']({'channel':_0x551dc9,'membername':_0x559230[_0xdd5e('0x2d')],'interface':_[_0xdd5e('0x34')](_0x559230[_0xdd5e('0x35')])?util[_0xdd5e('0x2f')]('SIP/%s',_0x559230[_0xdd5e('0x2d')]):_0x559230[_0xdd5e('0x35')],'type':_0xdd5e('0x36'),'enterAt':moment()[_0xdd5e('0x2f')](_0xdd5e('0x30')),'data1':_0x262fff[_0xdd5e('0x37')][_0xdd5e('0x38')]||_0xdd5e('0x39'),'role':_0x559230[_0xdd5e('0x3a')],'internal':_0x559230[_0xdd5e('0x29')],'uniqueid':_0x262fff[_0xdd5e('0x37')][_0xdd5e('0x3b')]||null});});return db[_0xdd5e('0x2c')][_0xdd5e('0x3c')](_0x4c48d6,{'individualHooks':!![]});}})[_0xdd5e('0x24')](function(){if(_0x559230){return _0x559230[_0xdd5e('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x262fff[_0xdd5e('0x37')]['type']||_0xdd5e('0x39'),'lastPauseAt':moment()[_0xdd5e('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xdd5e('0x24')](function(_0x3d74a4){_0x1de322(_0x3d74a4);})[_0xdd5e('0x1a')](function(_0x3df74d){_0x3e86ce(_0x38fe0d['error'](0x1f4,_0x3df74d[_0xdd5e('0x19')]));});});};exports['UnpauseUser']=function(_0x5557a8){var _0x280acf=this;return new Promise(function(_0xdbae3d,_0x41e55b){var _0x182bb1;return db[_0xdd5e('0x26')][_0xdd5e('0x3d')]({'where':_0x5557a8[_0xdd5e('0x1d')][_0xdd5e('0x1f')]||{},'attributes':['id',_0xdd5e('0x2d')]})['then'](function(_0x39682b){if(_0x39682b){_0x182bb1=_0x39682b;if(_0x5557a8['body']['channel']&&!utils[_0xdd5e('0x3e')](_0x5557a8[_0xdd5e('0x37')][_0xdd5e('0x3f')])){throw new Error(_0xdd5e('0x40'));}switch(_0x5557a8[_0xdd5e('0x37')]['channel']){case _0xdd5e('0x41'):return db['UserVoiceQueueRt'][_0xdd5e('0x2b')]({'paused':0x0},{'where':{'UserId':_0x182bb1['id']}})[_0xdd5e('0x24')](function(){return db[_0xdd5e('0x2c')]['find']({'where':{'channel':_0x5557a8[_0xdd5e('0x37')][_0xdd5e('0x3f')],'membername':_0x182bb1[_0xdd5e('0x2d')],'type':_0xdd5e('0x36'),'exitAt':null}});})['then'](function(_0x3ea3fb){if(_0x3ea3fb){return _0x3ea3fb[_0xdd5e('0x2b')]({'exitAt':moment()['format'](_0xdd5e('0x30')),'data2':_0xdd5e('0x42')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x182bb1[_0xdd5e('0x2b')]({'voicePause':![]});});case'mail':case _0xdd5e('0x43'):case'fax':case _0xdd5e('0x44'):case _0xdd5e('0x45'):case _0xdd5e('0x46'):return db[_0xdd5e('0x2c')][_0xdd5e('0x27')]({'where':{'channel':_0x5557a8['body']['channel'],'membername':_0x182bb1[_0xdd5e('0x2d')],'type':_0xdd5e('0x36'),'exitAt':null}})[_0xdd5e('0x24')](function(_0x286d23){return _0x286d23[_0xdd5e('0x2b')]({'exitAt':moment()[_0xdd5e('0x2f')](_0xdd5e('0x30')),'data2':_0xdd5e('0x42')},{'individualHooks':!![]});})['then'](function(){var _0x48cf2b={};_[_0xdd5e('0x47')](_0x48cf2b,util[_0xdd5e('0x2f')](_0xdd5e('0x48'),_0x5557a8[_0xdd5e('0x37')][_0xdd5e('0x3f')],'Pause'),![]);return _0x182bb1[_0xdd5e('0x2b')](_0x48cf2b);});default:return db[_0xdd5e('0x2a')][_0xdd5e('0x2b')]({'paused':0x0},{'where':{'UserId':_0x182bb1['id']}})[_0xdd5e('0x24')](function(){return db[_0xdd5e('0x2c')]['findAll']({'where':{'membername':_0x182bb1[_0xdd5e('0x2d')],'type':_0xdd5e('0x36'),'exitAt':null}});})[_0xdd5e('0x24')](function(_0x34fee6){var _0x1e39dc=[];_0x34fee6[_0xdd5e('0x33')](function(_0x1d8642){_0x1e39dc[_0xdd5e('0x49')](_0x1d8642['update']({'exitAt':moment()['format'](_0xdd5e('0x30')),'data2':_0xdd5e('0x42')}));});return BPromise[_0xdd5e('0x4a')](_0x1e39dc);})[_0xdd5e('0x24')](function(){return _0x182bb1[_0xdd5e('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x53ac01){_0xdbae3d(_0x53ac01);})[_0xdd5e('0x1a')](function(_0x1b9532){_0x41e55b(_0x280acf[_0xdd5e('0x17')](0x1f4,_0x1b9532[_0xdd5e('0x19')]));});});};exports[_0xdd5e('0x4b')]=function(_0x294327){var _0x110ea0=this;return new Promise(function(_0x30369e,_0x16bbff){var _0xb976ae;return db[_0xdd5e('0x26')][_0xdd5e('0x3d')]({'where':_0x294327['options'][_0xdd5e('0x1f')]||{},'attributes':['id',_0xdd5e('0x2d')]})[_0xdd5e('0x24')](function(_0x582360){if(_0x582360){_0xb976ae=_0x582360;return db[_0xdd5e('0x2a')][_0xdd5e('0x4c')]({'where':{'membername':_0xb976ae[_0xdd5e('0x2d')]},'individualHooks':!![]});}})['then'](function(){if(_0xb976ae){return db[_0xdd5e('0x2c')][_0xdd5e('0x1c')]({'where':{'membername':_0xb976ae[_0xdd5e('0x2d')],'exitAt':null}});}})['then'](function(_0x2c6a31){if(_0xb976ae){if(_0x2c6a31&&_0x2c6a31[_0xdd5e('0x2e')]){var _0x33dd72=[];_0x2c6a31[_0xdd5e('0x33')](function(_0x47fdda){_0x33dd72[_0xdd5e('0x49')](_0x47fdda[_0xdd5e('0x2b')]({'exitAt':moment()[_0xdd5e('0x2f')](_0xdd5e('0x30'))}));});return BPromise[_0xdd5e('0x4a')](_0x33dd72);}}})[_0xdd5e('0x24')](function(){if(_0xb976ae){return _0xb976ae[_0xdd5e('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xdd5e('0x24')](function(_0x4dde19){_0x30369e(_0x4dde19);})[_0xdd5e('0x1a')](function(_0x565847){_0x16bbff(_0x110ea0[_0xdd5e('0x17')](0x1f4,_0x565847[_0xdd5e('0x19')]));});});};exports[_0xdd5e('0x4d')]=function(_0x16f0cd){var _0x252247=this;return new Promise(function(_0x89a663,_0x4ccd99){var _0x1431c6;var _0x14a124;var _0x203b76;var _0x1d04ed;return db['User'][_0xdd5e('0x3d')]({'where':_0x16f0cd[_0xdd5e('0x1d')][_0xdd5e('0x1f')]||{},'attributes':['id',_0xdd5e('0x2d'),_0xdd5e('0x3a'),_0xdd5e('0x4e'),'phone','internal',_0xdd5e('0x4f'),'interface']})[_0xdd5e('0x24')](function(_0x51c081){if(_0x51c081){_0x1431c6=_0x51c081;_0x1d04ed=_0x16f0cd['body'][_0xdd5e('0x35')]?_0x16f0cd[_0xdd5e('0x37')][_0xdd5e('0x35')]:util[_0xdd5e('0x2f')]('SIP/%s',_0x1431c6['name']);return db[_0xdd5e('0x26')]['count']({'where':{'role':_0xdd5e('0x50'),'online':!![],'id':{'$ne':_0x1431c6['id']}}});}})[_0xdd5e('0x24')](function(_0x4b2da8){if(_0x4b2da8){_0x203b76=_0x4b2da8;return require('../../config/license/util')[_0xdd5e('0x51')]();}})[_0xdd5e('0x24')](function(_0x4eeca1){if(_0x4eeca1&&_0x4eeca1[_0xdd5e('0x52')]&&_0x203b76>=_0x4eeca1['agents']){throw new Error(_0xdd5e('0x53'));}})[_0xdd5e('0x24')](function(){if(_0x1431c6){return db[_0xdd5e('0x2a')][_0xdd5e('0x4c')]({'where':{'membername':_0x1431c6[_0xdd5e('0x2d')]},'individualHooks':!![]});}})['then'](function(){if(_0x1431c6){return _0x1431c6['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x267812){if(_0x1431c6){if(_0x267812){var _0x3564ae=[];_0x14a124=_0x267812;if(_0x14a124['length']){for(var _0x21791e=0x0;_0x21791e<_0x14a124[_0xdd5e('0x2e')];_0x21791e++){_0x3564ae[_0xdd5e('0x49')](db[_0xdd5e('0x2a')][_0xdd5e('0x54')]({'membername':_0x1431c6['name'],'UserId':_0x1431c6['id'],'queue_name':_0x14a124[_0x21791e][_0xdd5e('0x2d')],'VoiceQueueId':_0x14a124[_0x21791e]['id'],'interface':_0x1d04ed,'paused':_0x1431c6[_0xdd5e('0x4f')]||![],'penalty':_0x14a124[_0x21791e][_0xdd5e('0x55')]||0x0}));}return BPromise['all'](_0x3564ae);}}}})[_0xdd5e('0x24')](function(){if(_0x1431c6){return db['MemberReport'][_0xdd5e('0x1c')]({'where':{'membername':_0x1431c6[_0xdd5e('0x2d')],'exitAt':null}});}})[_0xdd5e('0x24')](function(_0x1705c6){if(_0x1431c6){if(_0x1705c6&&_0x1705c6[_0xdd5e('0x2e')]){var _0x198eb0=[];_0x1705c6['forEach'](function(_0x2ff5aa){_0x198eb0['push'](_0x2ff5aa[_0xdd5e('0x2b')]({'exitAt':moment()[_0xdd5e('0x2f')](_0xdd5e('0x30'))}));});return BPromise[_0xdd5e('0x4a')](_0x198eb0);}}})[_0xdd5e('0x24')](function(_0x139aa5){if(_0x1431c6){var _0x22117a=[];var _0x5b8447=[];var _0x46e447=utils[_0xdd5e('0x32')]();var _0x1e33f9={'membername':_0x1431c6[_0xdd5e('0x2d')],'interface':_0x1d04ed,'enterAt':moment()[_0xdd5e('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x1431c6[_0xdd5e('0x3a')],'internal':_0x1431c6[_0xdd5e('0x29')]};_0x46e447[_0xdd5e('0x33')](function(_0x4d7445){_0x22117a[_0xdd5e('0x49')](_[_0xdd5e('0x56')]({'channel':_0x4d7445,'type':_0xdd5e('0x57'),'data1':_0xdd5e('0x58'),'data2':_0x1d04ed},_0x1e33f9));if(_0x1431c6[_0xdd5e('0x4f')]){_0x5b8447[_0xdd5e('0x49')](_['merge']({'channel':_0x4d7445,'type':_0xdd5e('0x36'),'data1':_0xdd5e('0x59')},_0x1e33f9));}});return db[_0xdd5e('0x2c')][_0xdd5e('0x3c')](_0x22117a[_0xdd5e('0x5a')](_0x5b8447),{'individualHooks':!![]});}})[_0xdd5e('0x24')](function(){if(_0x1431c6){return _0x1431c6[_0xdd5e('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xdd5e('0x2f')](_0xdd5e('0x30')),'voicePause':_0x1431c6['loginInPause']||![],'mailPause':_0x1431c6[_0xdd5e('0x4f')]||![],'chatPause':_0x1431c6['loginInPause']||![],'faxPause':_0x1431c6[_0xdd5e('0x4f')]||![],'smsPause':_0x1431c6[_0xdd5e('0x4f')]||![],'openchannelPause':_0x1431c6[_0xdd5e('0x4f')]||![],'pauseType':_0x1431c6[_0xdd5e('0x4f')]?_0xdd5e('0x59'):null,'lastPauseAt':moment()[_0xdd5e('0x2f')](_0xdd5e('0x30')),'interface':_0x1d04ed});}})[_0xdd5e('0x24')](function(_0x85129f){_0x89a663(_0x85129f);})['catch'](function(_0x432265){_0x4ccd99(_0x252247['error'](0x1f4,_0x432265[_0xdd5e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 7c068c8..4a301ad 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 _0x748f=['remove','register','length','user:'];(function(_0x4ef951,_0x4b5745){var _0x518328=function(_0x17e868){while(--_0x17e868){_0x4ef951['push'](_0x4ef951['shift']());}};_0x518328(++_0x4b5745);}(_0x748f,0xe8));var _0xf748=function(_0x157f71,_0x3c7207){_0x157f71=_0x157f71-0x0;var _0x52711d=_0x748f[_0x157f71];return _0x52711d;};'use strict';var UserEvents=require('./user.events');var events=['save',_0xf748('0x0'),'update'];function createListener(_0x190029,_0xaaf428){return function(_0x25457a){_0xaaf428['emit'](_0x190029,_0x25457a);};}function removeListener(_0xedfea5,_0x39adf4){return function(){UserEvents['removeListener'](_0xedfea5,_0x39adf4);};}exports[_0xf748('0x1')]=function(_0x186a4d){for(var _0x1a18e9=0x0,_0x478770=events[_0xf748('0x2')];_0x1a18e9<_0x478770;_0x1a18e9++){var _0x3d464a=events[_0x1a18e9];var _0x1a9dfe=createListener(_0xf748('0x3')+_0x3d464a,_0x186a4d);UserEvents['on'](_0x3d464a,_0x1a9dfe);}}; \ No newline at end of file +var _0xccbe=['removeListener','register','length','user:','save','remove','update','emit'];(function(_0x5de81a,_0x55373f){var _0x454605=function(_0x45a9fc){while(--_0x45a9fc){_0x5de81a['push'](_0x5de81a['shift']());}};_0x454605(++_0x55373f);}(_0xccbe,0x11c));var _0xeccb=function(_0x11309c,_0xe18a74){_0x11309c=_0x11309c-0x0;var _0x3fea9c=_0xccbe[_0x11309c];return _0x3fea9c;};'use strict';var UserEvents=require('./user.events');var events=[_0xeccb('0x0'),_0xeccb('0x1'),_0xeccb('0x2')];function createListener(_0x25fc23,_0x386c14){return function(_0x57cb98){_0x386c14[_0xeccb('0x3')](_0x25fc23,_0x57cb98);};}function removeListener(_0x527478,_0x3552c0){return function(){UserEvents[_0xeccb('0x4')](_0x527478,_0x3552c0);};}exports[_0xeccb('0x5')]=function(_0x43cea6){for(var _0x286187=0x0,_0x50e4ff=events[_0xeccb('0x6')];_0x286187<_0x50e4ff;_0x286187++){var _0x3262dc=events[_0x286187];var _0x518b7b=createListener(_0xeccb('0x7')+_0x3262dc,_0x43cea6);UserEvents['on'](_0x3262dc,_0x518b7b);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 7660587..210a4f1 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x54a614,_0x577745){var _0x3c2459=function(_0x3487da){while(--_0x3487da){_0x54a614['push'](_0x54a614['shift']());}};_0x3c2459(++_0x577745);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x14477e,_0x44d4da){_0x14477e=_0x14477e-0x0;var _0x5d4a05=_0xcb91[_0x14477e];return _0x5d4a05;};'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(_0x2edf17,_0x5c731d){var _0x3c028a=function(_0x1c5909){while(--_0x1c5909){_0x2edf17['push'](_0x2edf17['shift']());}};_0x3c028a(++_0x5c731d);}(_0x9c44,0x178));var _0x49c4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9c44[_0x13b02f];return _0x12e9a6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index ef7d9b2..fa5c9bf 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 _0x9cd2=['INTEGER','sequelize'];(function(_0x288f4d,_0x1313b1){var _0x334960=function(_0x38b7ae){while(--_0x38b7ae){_0x288f4d['push'](_0x288f4d['shift']());}};_0x334960(++_0x1313b1);}(_0x9cd2,0x85));var _0x29cd=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0x9cd2[_0x2d61ac];return _0x3f7d3c;};'use strict';var Sequelize=require(_0x29cd('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x29cd('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4550=['exports','INTEGER'];(function(_0x111305,_0x3e92cd){var _0xdad1a0=function(_0x55f47e){while(--_0x55f47e){_0x111305['push'](_0x111305['shift']());}};_0xdad1a0(++_0x3e92cd);}(_0x4550,0x92));var _0x0455=function(_0x11ca4a,_0x2d2dd7){_0x11ca4a=_0x11ca4a-0x0;var _0x6d7856=_0x4550[_0x11ca4a];return _0x6d7856;};'use strict';var Sequelize=require('sequelize');module[_0x0455('0x0')]={'penalty':{'type':Sequelize[_0x0455('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index c152c1f..8b3c010 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 _0x4822=['../../config/environment','define','UserChatQueue','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x9026c0,_0x22712c){var _0x13b9c8=function(_0x24046e){while(--_0x24046e){_0x9026c0['push'](_0x9026c0['shift']());}};_0x13b9c8(++_0x22712c);}(_0x4822,0xbe));var _0x2482=function(_0xbc4560,_0x4020b8){_0xbc4560=_0xbc4560-0x0;var _0x298cfb=_0x4822[_0xbc4560];return _0x298cfb;};'use strict';var _=require(_0x2482('0x0'));var util=require(_0x2482('0x1'));var logger=require(_0x2482('0x2'))(_0x2482('0x3'));var moment=require(_0x2482('0x4'));var BPromise=require(_0x2482('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2482('0x6'));var rimraf=require(_0x2482('0x7'));var config=require(_0x2482('0x8'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x403a75,_0x52b0ad){return _0x403a75[_0x2482('0x9')](_0x2482('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x028e=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','util'];(function(_0x3b3cc6,_0x1a6e24){var _0x1161e4=function(_0x19cc52){while(--_0x19cc52){_0x3b3cc6['push'](_0x3b3cc6['shift']());}};_0x1161e4(++_0x1a6e24);}(_0x028e,0x1ab));var _0xe028=function(_0x344821,_0x103137){_0x344821=_0x344821-0x0;var _0x56da3b=_0x028e[_0x344821];return _0x56da3b;};'use strict';var _=require(_0xe028('0x0'));var util=require(_0xe028('0x1'));var logger=require(_0xe028('0x2'))('api');var moment=require(_0xe028('0x3'));var BPromise=require(_0xe028('0x4'));var rp=require(_0xe028('0x5'));var fs=require('fs');var path=require(_0xe028('0x6'));var rimraf=require(_0xe028('0x7'));var config=require(_0xe028('0x8'));var attributes=require(_0xe028('0x9'));module[_0xe028('0xa')]=function(_0x175009,_0x102971){return _0x175009[_0xe028('0xb')]('UserChatQueue',attributes,{'tableName':_0xe028('0xc'),'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 9fa9e4e..243f6b6 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 _0x7730=['request','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x7730,0x8f));var _0x0773=function(_0x117417,_0x214c67){_0x117417=_0x117417-0x0;var _0x5ba86d=_0x7730[_0x117417];return _0x5ba86d;};'use strict';var _=require(_0x0773('0x0'));var util=require(_0x0773('0x1'));var moment=require(_0x0773('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0773('0x3'));var db=require(_0x0773('0x4'))['db'];var utils=require(_0x0773('0x5'));var logger=require(_0x0773('0x6'))('rpc');var config=require(_0x0773('0x7'));var jayson=require(_0x0773('0x8'));var client=jayson[_0x0773('0x9')][_0x0773('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ccd76,_0xba28c4,_0x4a8d67){return new BPromise(function(_0x19d5cf,_0x468dde){return client[_0x0773('0xb')](_0x4ccd76,_0x4a8d67)['then'](function(_0xe9b3d){logger[_0x0773('0xc')](_0x0773('0xd'),_0xba28c4,'request\x20sent');logger[_0x0773('0xe')](_0x0773('0xf'),_0xba28c4,_0x0773('0x10'),JSON[_0x0773('0x11')](_0xe9b3d));if(_0xe9b3d['error']){if(_0xe9b3d['error']['code']===0x1f4){logger[_0x0773('0x12')]('UserChatQueue,\x20%s,\x20%s',_0xba28c4,_0xe9b3d[_0x0773('0x12')]['message']);return _0x468dde(_0xe9b3d[_0x0773('0x12')]['message']);}logger[_0x0773('0x12')](_0x0773('0xd'),_0xba28c4,_0xe9b3d['error'][_0x0773('0x13')]);return _0x19d5cf(_0xe9b3d[_0x0773('0x12')]['message']);}else{logger['info'](_0x0773('0xd'),_0xba28c4,_0x0773('0x10'));_0x19d5cf(_0xe9b3d[_0x0773('0x14')][_0x0773('0x13')]);}})[_0x0773('0x15')](function(_0x48f810){logger[_0x0773('0x12')]('UserChatQueue,\x20%s,\x20%s',_0xba28c4,_0x48f810);_0x468dde(_0x48f810);});});} \ No newline at end of file +var _0xcb10=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x52a1f4,_0x39fc92){var _0x1dce54=function(_0x5aa5ac){while(--_0x5aa5ac){_0x52a1f4['push'](_0x52a1f4['shift']());}};_0x1dce54(++_0x39fc92);}(_0xcb10,0xee));var _0x0cb1=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xcb10[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x0cb1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0cb1('0x1'));var rs=require(_0x0cb1('0x2'));var fs=require('fs');var Redis=require(_0x0cb1('0x3'));var db=require(_0x0cb1('0x4'))['db'];var utils=require(_0x0cb1('0x5'));var logger=require(_0x0cb1('0x6'))(_0x0cb1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0cb1('0x8')][_0x0cb1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15e533,_0x10a23c,_0x54138c){return new BPromise(function(_0x271d39,_0x312933){return client[_0x0cb1('0xa')](_0x15e533,_0x54138c)['then'](function(_0x4944b4){logger[_0x0cb1('0xb')](_0x0cb1('0xc'),_0x10a23c,'request\x20sent');logger[_0x0cb1('0xd')](_0x0cb1('0xe'),_0x10a23c,_0x0cb1('0xf'),JSON[_0x0cb1('0x10')](_0x4944b4));if(_0x4944b4[_0x0cb1('0x11')]){if(_0x4944b4[_0x0cb1('0x11')][_0x0cb1('0x12')]===0x1f4){logger[_0x0cb1('0x11')](_0x0cb1('0xc'),_0x10a23c,_0x4944b4[_0x0cb1('0x11')][_0x0cb1('0x13')]);return _0x312933(_0x4944b4[_0x0cb1('0x11')][_0x0cb1('0x13')]);}logger['error'](_0x0cb1('0xc'),_0x10a23c,_0x4944b4[_0x0cb1('0x11')][_0x0cb1('0x13')]);return _0x271d39(_0x4944b4[_0x0cb1('0x11')]['message']);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x10a23c,'request\x20sent');_0x271d39(_0x4944b4[_0x0cb1('0x14')][_0x0cb1('0x13')]);}})[_0x0cb1('0x15')](function(_0x24da74){logger[_0x0cb1('0x11')](_0x0cb1('0xc'),_0x10a23c,_0x24da74);_0x312933(_0x24da74);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 9049b0e..f7c7eaa 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x21d3c4,_0x48d915){var _0x341584=function(_0x35aaa7){while(--_0x35aaa7){_0x21d3c4['push'](_0x21d3c4['shift']());}};_0x341584(++_0x48d915);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1e6d87,_0x65b604){var _0x2d05b5=function(_0x4d5098){while(--_0x4d5098){_0x1e6d87['push'](_0x1e6d87['shift']());}};_0x2d05b5(++_0x65b604);}(_0x70e0,0x17b));var _0x070e=function(_0x123e7e,_0x2f3e00){_0x123e7e=_0x123e7e-0x0;var _0x5192cf=_0x70e0[_0x123e7e];return _0x5192cf;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 4a012ce..de50aa0 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 _0xb0c4=['sequelize','exports','INTEGER','STRING'];(function(_0x5b3d65,_0x170475){var _0x5e6f8c=function(_0x3dcb26){while(--_0x3dcb26){_0x5b3d65['push'](_0x5b3d65['shift']());}};_0x5e6f8c(++_0x170475);}(_0xb0c4,0x140));var _0x4b0c=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xb0c4[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0x4b0c('0x0'));module[_0x4b0c('0x1')]={'penalty':{'type':Sequelize[_0x4b0c('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4b0c('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x4b0c('0x3')]}}; \ No newline at end of file +var _0x9274=['INTEGER','sequelize'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9274,0xbd));var _0x4927=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9274[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x4927('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4927('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x4927('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 3c2d629..da991c7 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 _0x34a2=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','lodash'];(function(_0x52fa6d,_0x1797a6){var _0x31cbd4=function(_0x3804ad){while(--_0x3804ad){_0x52fa6d['push'](_0x52fa6d['shift']());}};_0x31cbd4(++_0x1797a6);}(_0x34a2,0x13e));var _0x234a=function(_0x279451,_0x3ced5c){_0x279451=_0x279451-0x0;var _0x9ce2ce=_0x34a2[_0x279451];return _0x9ce2ce;};'use strict';var _=require(_0x234a('0x0'));var util=require('util');var logger=require(_0x234a('0x1'))(_0x234a('0x2'));var moment=require('moment');var BPromise=require(_0x234a('0x3'));var rp=require(_0x234a('0x4'));var fs=require('fs');var path=require(_0x234a('0x5'));var rimraf=require(_0x234a('0x6'));var config=require(_0x234a('0x7'));var attributes=require(_0x234a('0x8'));module[_0x234a('0x9')]=function(_0x4e334c,_0x3039fd){return _0x4e334c['define'](_0x234a('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb016=['define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports'];(function(_0x4fefe0,_0x1e4b1f){var _0xd9c6f=function(_0x59f41e){while(--_0x59f41e){_0x4fefe0['push'](_0x4fefe0['shift']());}};_0xd9c6f(++_0x1e4b1f);}(_0xb016,0x9d));var _0x6b01=function(_0x23f2e4,_0x533f90){_0x23f2e4=_0x23f2e4-0x0;var _0x247e41=_0xb016[_0x23f2e4];return _0x247e41;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var logger=require(_0x6b01('0x2'))(_0x6b01('0x3'));var moment=require(_0x6b01('0x4'));var BPromise=require('bluebird');var rp=require(_0x6b01('0x5'));var fs=require('fs');var path=require(_0x6b01('0x6'));var rimraf=require(_0x6b01('0x7'));var config=require(_0x6b01('0x8'));var attributes=require(_0x6b01('0x9'));module[_0x6b01('0xa')]=function(_0x4ee960,_0x2d4693){return _0x4ee960[_0x6b01('0xb')](_0x6b01('0xc'),attributes,{'tableName':_0x6b01('0xd'),'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 492c0ca..a9178fc 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 _0xd007=['http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4c7410,_0x43bf77){var _0x2cf87d=function(_0x5f3db0){while(--_0x5f3db0){_0x4c7410['push'](_0x4c7410['shift']());}};_0x2cf87d(++_0x43bf77);}(_0xd007,0x1cf));var _0x7d00=function(_0x22ee76,_0x238a03){_0x22ee76=_0x22ee76-0x0;var _0x8ab0fc=_0xd007[_0x22ee76];return _0x8ab0fc;};'use strict';var _=require(_0x7d00('0x0'));var util=require(_0x7d00('0x1'));var moment=require(_0x7d00('0x2'));var BPromise=require(_0x7d00('0x3'));var rs=require(_0x7d00('0x4'));var fs=require('fs');var Redis=require(_0x7d00('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7d00('0x6'));var logger=require(_0x7d00('0x7'))(_0x7d00('0x8'));var config=require(_0x7d00('0x9'));var jayson=require(_0x7d00('0xa'));var client=jayson[_0x7d00('0xb')][_0x7d00('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f2a81,_0xcb886b,_0x398c2c){return new BPromise(function(_0x10a70e,_0x330a29){return client[_0x7d00('0xd')](_0x5f2a81,_0x398c2c)[_0x7d00('0xe')](function(_0x1b3db3){logger[_0x7d00('0xf')](_0x7d00('0x10'),_0xcb886b,_0x7d00('0x11'));logger[_0x7d00('0x12')](_0x7d00('0x13'),_0xcb886b,_0x7d00('0x11'),JSON['stringify'](_0x1b3db3));if(_0x1b3db3[_0x7d00('0x14')]){if(_0x1b3db3[_0x7d00('0x14')][_0x7d00('0x15')]===0x1f4){logger[_0x7d00('0x14')](_0x7d00('0x10'),_0xcb886b,_0x1b3db3[_0x7d00('0x14')]['message']);return _0x330a29(_0x1b3db3[_0x7d00('0x14')][_0x7d00('0x16')]);}logger[_0x7d00('0x14')](_0x7d00('0x10'),_0xcb886b,_0x1b3db3[_0x7d00('0x14')][_0x7d00('0x16')]);return _0x10a70e(_0x1b3db3[_0x7d00('0x14')][_0x7d00('0x16')]);}else{logger[_0x7d00('0xf')](_0x7d00('0x10'),_0xcb886b,'request\x20sent');_0x10a70e(_0x1b3db3[_0x7d00('0x17')][_0x7d00('0x16')]);}})[_0x7d00('0x18')](function(_0x195c17){logger[_0x7d00('0x14')](_0x7d00('0x10'),_0xcb886b,_0x195c17);_0x330a29(_0x195c17);});});} \ No newline at end of file +var _0xf58f=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0xf58f,0x14d));var _0xff58=function(_0x3c9d9e,_0x424953){_0x3c9d9e=_0x3c9d9e-0x0;var _0x47f4fa=_0xf58f[_0x3c9d9e];return _0x47f4fa;};'use strict';var _=require(_0xff58('0x0'));var util=require(_0xff58('0x1'));var moment=require(_0xff58('0x2'));var BPromise=require(_0xff58('0x3'));var rs=require(_0xff58('0x4'));var fs=require('fs');var Redis=require(_0xff58('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xff58('0x6'));var logger=require(_0xff58('0x7'))(_0xff58('0x8'));var config=require(_0xff58('0x9'));var jayson=require(_0xff58('0xa'));var client=jayson[_0xff58('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x123b54,_0x239746,_0x5c2402){return new BPromise(function(_0x36f8e5,_0x1bd762){return client[_0xff58('0xc')](_0x123b54,_0x5c2402)['then'](function(_0x38be06){logger[_0xff58('0xd')](_0xff58('0xe'),_0x239746,'request\x20sent');logger[_0xff58('0xf')](_0xff58('0x10'),_0x239746,_0xff58('0x11'),JSON[_0xff58('0x12')](_0x38be06));if(_0x38be06[_0xff58('0x13')]){if(_0x38be06['error'][_0xff58('0x14')]===0x1f4){logger['error'](_0xff58('0xe'),_0x239746,_0x38be06[_0xff58('0x13')][_0xff58('0x15')]);return _0x1bd762(_0x38be06[_0xff58('0x13')][_0xff58('0x15')]);}logger['error'](_0xff58('0xe'),_0x239746,_0x38be06['error'][_0xff58('0x15')]);return _0x36f8e5(_0x38be06[_0xff58('0x13')]['message']);}else{logger[_0xff58('0xd')](_0xff58('0xe'),_0x239746,_0xff58('0x11'));_0x36f8e5(_0x38be06[_0xff58('0x16')]['message']);}})[_0xff58('0x17')](function(_0x13878a){logger[_0xff58('0x13')](_0xff58('0xe'),_0x239746,_0x13878a);_0x1bd762(_0x13878a);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 96dd89b..ecda00a 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2b7fa0,_0xfbfd02){var _0x583375=function(_0x44021b){while(--_0x44021b){_0x2b7fa0['push'](_0x2b7fa0['shift']());}};_0x583375(++_0xfbfd02);}(_0xedd9,0xfc));var _0x9edd=function(_0x2a23e7,_0x2d5cc9){_0x2a23e7=_0x2a23e7-0x0;var _0x484a6f=_0xedd9[_0x2a23e7];return _0x484a6f;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5d2e36,_0x5ebd1a){var _0x47f214=function(_0x23f0e1){while(--_0x23f0e1){_0x5d2e36['push'](_0x5d2e36['shift']());}};_0x47f214(++_0x5ebd1a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 2cd2c99..dc2be12 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 _0xeb87=['INTEGER'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xeb87,0x6f));var _0x7eb8=function(_0x5245a8,_0x4fdd18){_0x5245a8=_0x5245a8-0x0;var _0x111401=_0xeb87[_0x5245a8];return _0x111401;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x7eb8('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6f69=['INTEGER','sequelize'];(function(_0x3e8e4c,_0x502a81){var _0xb95f27=function(_0x2b4931){while(--_0x2b4931){_0x3e8e4c['push'](_0x3e8e4c['shift']());}};_0xb95f27(++_0x502a81);}(_0x6f69,0x8d));var _0x96f6=function(_0x5a778f,_0x2bec4f){_0x5a778f=_0x5a778f-0x0;var _0x1d5a3d=_0x6f69[_0x5a778f];return _0x1d5a3d;};'use strict';var Sequelize=require(_0x96f6('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x96f6('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index b8d7e1e..45efcc6 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 _0x730d=['lodash','api','bluebird','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues'];(function(_0x742a08,_0x283a0e){var _0xc13a6b=function(_0x2053ed){while(--_0x2053ed){_0x742a08['push'](_0x742a08['shift']());}};_0xc13a6b(++_0x283a0e);}(_0x730d,0x1a4));var _0xd730=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x730d[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0xd730('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd730('0x1'));var moment=require('moment');var BPromise=require(_0xd730('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd730('0x3'));var config=require(_0xd730('0x4'));var attributes=require(_0xd730('0x5'));module[_0xd730('0x6')]=function(_0x455898,_0x235c86){return _0x455898[_0xd730('0x7')](_0xd730('0x8'),attributes,{'tableName':_0xd730('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cbe=['user_has_mail_queues','util','api','moment','bluebird','request-promise','path','../../config/environment','./userMailQueue.attributes','exports','define'];(function(_0x4080dd,_0x5b595d){var _0x4ecf85=function(_0x5d281a){while(--_0x5d281a){_0x4080dd['push'](_0x4080dd['shift']());}};_0x4ecf85(++_0x5b595d);}(_0x7cbe,0x182));var _0xe7cb=function(_0x4373fe,_0x3c3c6e){_0x4373fe=_0x4373fe-0x0;var _0x4d6e86=_0x7cbe[_0x4373fe];return _0x4d6e86;};'use strict';var _=require('lodash');var util=require(_0xe7cb('0x0'));var logger=require('../../config/logger')(_0xe7cb('0x1'));var moment=require(_0xe7cb('0x2'));var BPromise=require(_0xe7cb('0x3'));var rp=require(_0xe7cb('0x4'));var fs=require('fs');var path=require(_0xe7cb('0x5'));var rimraf=require('rimraf');var config=require(_0xe7cb('0x6'));var attributes=require(_0xe7cb('0x7'));module[_0xe7cb('0x8')]=function(_0x3424b5,_0x43f724){return _0x3424b5[_0xe7cb('0x9')]('UserMailQueue',attributes,{'tableName':_0xe7cb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 54f7d0a..b949065 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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x26698e,_0x4a024a){_0x26698e=_0x26698e-0x0;var _0x227bed=_0x1cb9[_0x26698e];return _0x227bed;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x846364,_0x1a843c){var _0x2537d1=function(_0x49edcf){while(--_0x49edcf){_0x846364['push'](_0x846364['shift']());}};_0x2537d1(++_0x1a843c);}(_0x3e74,0x175));var _0x43e7=function(_0x4f2e1d,_0x413360){_0x4f2e1d=_0x4f2e1d-0x0;var _0x43b3b5=_0x3e74[_0x4f2e1d];return _0x43b3b5;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 064d6f4..f646fb8 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 _0x0868=['../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util','express','Router','fs-extra'];(function(_0x4160a6,_0x387f64){var _0x27899b=function(_0x43dde5){while(--_0x43dde5){_0x4160a6['push'](_0x4160a6['shift']());}};_0x27899b(++_0x387f64);}(_0x0868,0x7d));var _0x8086=function(_0x33768e,_0x5aba5a){_0x33768e=_0x33768e-0x0;var _0x309732=_0x0868[_0x33768e];return _0x309732;};'use strict';var multer=require(_0x8086('0x0'));var util=require(_0x8086('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8086('0x2'));var router=express[_0x8086('0x3')]();var fs_extra=require(_0x8086('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8086('0x5'));var controller=require(_0x8086('0x6'));router['post']('/',auth[_0x8086('0x7')](),controller[_0x8086('0x8')]);module[_0x8086('0x9')]=router; \ No newline at end of file +var _0x4ff2=['../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x698af9,_0x51e11b){var _0x34f7ac=function(_0x2b2c64){while(--_0x2b2c64){_0x698af9['push'](_0x698af9['shift']());}};_0x34f7ac(++_0x51e11b);}(_0x4ff2,0x88));var _0x24ff=function(_0x300d68,_0x881b5c){_0x300d68=_0x300d68-0x0;var _0x37661d=_0x4ff2[_0x300d68];return _0x37661d;};'use strict';var multer=require(_0x24ff('0x0'));var util=require('util');var path=require(_0x24ff('0x1'));var timeout=require(_0x24ff('0x2'));var express=require(_0x24ff('0x3'));var router=express[_0x24ff('0x4')]();var fs_extra=require(_0x24ff('0x5'));var auth=require(_0x24ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24ff('0x7'));var controller=require(_0x24ff('0x8'));router[_0x24ff('0x9')]('/',auth[_0x24ff('0xa')](),controller[_0x24ff('0xb')]);module[_0x24ff('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 5480437..2774100 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 _0x0d87=['BOOLEAN','sequelize','exports','STRING'];(function(_0x171258,_0x51975a){var _0x398c5d=function(_0x25ce57){while(--_0x25ce57){_0x171258['push'](_0x171258['shift']());}};_0x398c5d(++_0x51975a);}(_0x0d87,0x131));var _0x70d8=function(_0x8ee7da,_0x1e810f){_0x8ee7da=_0x8ee7da-0x0;var _0x58ad04=_0x0d87[_0x8ee7da];return _0x58ad04;};'use strict';var Sequelize=require(_0x70d8('0x0'));module[_0x70d8('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x70d8('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x70d8('0x3')]}}; \ No newline at end of file +var _0xdb10=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xdb10,0x1a1));var _0x0db1=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0xdb10[_0x2bf466];return _0x856885;};'use strict';var Sequelize=require(_0x0db1('0x0'));module[_0x0db1('0x1')]={'body':{'type':Sequelize[_0x0db1('0x2')]},'senderName':{'type':Sequelize[_0x0db1('0x3')]},'recipientsId':{'type':Sequelize[_0x0db1('0x2')]},'recipientsDescription':{'type':Sequelize[_0x0db1('0x3')]},'beep':{'type':Sequelize[_0x0db1('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 43e04be..4fc481f 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 _0x8ca8=['body','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','hasOwnProperty','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','then','sortBy','join','sequelize','UserNotification','create','forEach','recipient','emit','userNotification:send','text','findOne','html','render','catch','model','User','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','./userNotification.socket','sendStatus','status','offset','limit','undefined','count','set','apply','reject','save','destroy','end','stack','name','send','sendUserNotification'];(function(_0x4a2c7a,_0x459d5b){var _0x5ae184=function(_0x230738){while(--_0x230738){_0x4a2c7a['push'](_0x4a2c7a['shift']());}};_0x5ae184(++_0x459d5b);}(_0x8ca8,0x103));var _0x88ca=function(_0x8da898,_0x329720){_0x8da898=_0x8da898-0x0;var _0x52226f=_0x8ca8[_0x8da898];return _0x52226f;};'use strict';var emlformat=require(_0x88ca('0x0'));var rimraf=require(_0x88ca('0x1'));var zipdir=require(_0x88ca('0x2'));var jsonpatch=require(_0x88ca('0x3'));var rp=require(_0x88ca('0x4'));var moment=require(_0x88ca('0x5'));var BPromise=require(_0x88ca('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x88ca('0x7'));var sox=require(_0x88ca('0x8'));var csv=require(_0x88ca('0x9'));var ejs=require(_0x88ca('0xa'));var fs=require('fs');var fs_extra=require(_0x88ca('0xb'));var _=require(_0x88ca('0xc'));var squel=require(_0x88ca('0xd'));var crypto=require('crypto');var jsforce=require(_0x88ca('0xe'));var deskjs=require(_0x88ca('0xf'));var toCsv=require(_0x88ca('0x9'));var querystring=require(_0x88ca('0x10'));var Papa=require(_0x88ca('0x11'));var Redis=require(_0x88ca('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x88ca('0x13'));var as=require(_0x88ca('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x88ca('0x15'));var utils=require(_0x88ca('0x16'));var config=require(_0x88ca('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x88ca('0x18'))['db'];config['redis']=_[_0x88ca('0x19')](config[_0x88ca('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x88ca('0x1a')]));require(_0x88ca('0x1b'))['register'](socket);function respondWithStatusCode(_0xa20641,_0x1662f8){_0x1662f8=_0x1662f8||0xcc;return function(_0x487859){if(_0x487859){return _0xa20641[_0x88ca('0x1c')](_0x1662f8);}return _0xa20641['status'](_0x1662f8)['end']();};}function respondWithResult(_0x59720b,_0x2fd43b){_0x2fd43b=_0x2fd43b||0xc8;return function(_0x23eccd){if(_0x23eccd){return _0x59720b[_0x88ca('0x1d')](_0x2fd43b)['json'](_0x23eccd);}};}function respondWithFilteredResult(_0x434c46,_0x37d6a0){return function(_0x21c790){if(_0x21c790){var _0x3240fc=typeof _0x37d6a0[_0x88ca('0x1e')]==='undefined'&&typeof _0x37d6a0[_0x88ca('0x1f')]===_0x88ca('0x20');var _0x24a079=_0x21c790['count'];var _0xfd5b81=_0x3240fc?0x0:_0x37d6a0['offset'];var _0x50f913=_0x3240fc?_0x21c790[_0x88ca('0x21')]:_0x37d6a0[_0x88ca('0x1e')]+_0x37d6a0[_0x88ca('0x1f')];var _0x475f7b;if(_0x50f913>=_0x24a079){_0x50f913=_0x24a079;_0x475f7b=0xc8;}else{_0x475f7b=0xce;}_0x434c46[_0x88ca('0x1d')](_0x475f7b);return _0x434c46[_0x88ca('0x22')]('Content-Range',_0xfd5b81+'-'+_0x50f913+'/'+_0x24a079)['json'](_0x21c790);}return null;};}function patchUpdates(_0x173b3b){return function(_0x1216fe){try{jsonpatch[_0x88ca('0x23')](_0x1216fe,_0x173b3b,!![]);}catch(_0x1acbfa){return BPromise[_0x88ca('0x24')](_0x1acbfa);}return _0x1216fe[_0x88ca('0x25')]();};}function saveUpdates(_0x220550,_0x26f3ca){return function(_0x4b8418){if(_0x4b8418){return _0x4b8418['update'](_0x220550)['then'](function(_0x1686b2){return _0x1686b2;});}return null;};}function removeEntity(_0x4906cc,_0x9c24a){return function(_0x86fb34){if(_0x86fb34){return _0x86fb34[_0x88ca('0x26')]()['then'](function(){_0x4906cc[_0x88ca('0x1d')](0xcc)[_0x88ca('0x27')]();});}};}function handleEntityNotFound(_0x16636d,_0x5e507b){return function(_0x106ba4){if(!_0x106ba4){_0x16636d['sendStatus'](0x194);}return _0x106ba4;};}function handleError(_0x5595a2,_0x5cb495){_0x5cb495=_0x5cb495||0x1f4;return function(_0x5b7ebf){logger['error'](_0x5b7ebf[_0x88ca('0x28')]);if(_0x5b7ebf['name']){delete _0x5b7ebf[_0x88ca('0x29')];}_0x5595a2[_0x88ca('0x1d')](_0x5cb495)[_0x88ca('0x2a')](_0x5b7ebf);};}exports[_0x88ca('0x2b')]=function(_0xff3119,_0x42223f,_0x23e898){if(!_0xff3119[_0x88ca('0x2c')]['hasOwnProperty']('text')&&!_0xff3119['body']['hasOwnProperty']('TemplateId')){throw new db[(_0x88ca('0x2d'))][(_0x88ca('0x2e'))](_0x88ca('0x2f'));}else{if(_0xff3119['body'][_0x88ca('0x30')](_0x88ca('0x31'))&&!_0xff3119[_0x88ca('0x2c')][_0x88ca('0x30')](_0x88ca('0x32'))){throw new db['Sequelize'][(_0x88ca('0x2e'))](_0x88ca('0x33'));}if(!_0xff3119[_0x88ca('0x2c')][_0x88ca('0x30')](_0x88ca('0x34'))){throw new db['Sequelize'][(_0x88ca('0x2e'))](_0x88ca('0x35'));}else{try{var _0x2e9526=JSON[_0x88ca('0x36')](_0xff3119[_0x88ca('0x2c')][_0x88ca('0x34')]);}catch(_0x56b7ad){logger[_0x88ca('0x37')](_0x56b7ad);throw new db[(_0x88ca('0x2d'))][(_0x88ca('0x2e'))](_0x88ca('0x38'));}var _0x2a8b64=[_0x88ca('0x39'),_0x88ca('0x3a'),'mailqueue','openchannelqueue',_0x88ca('0x3b'),_0x88ca('0x3c'),_0x88ca('0x3d'),_0x88ca('0x3e'),_0x88ca('0x3f')];if(_[_0x88ca('0x40')](_0x2e9526,function(_0x40fcfb){return!_[_0x88ca('0x41')](_0x2a8b64,_0x40fcfb['model'][_0x88ca('0x42')]());})){throw new db[(_0x88ca('0x2d'))][(_0x88ca('0x2e'))](_0x88ca('0x43'));}}}var _0x43ec19={};_0x43ec19[_0x88ca('0x44')]=_0xff3119[_0x88ca('0x2c')][_0x88ca('0x30')](_0x88ca('0x44'))?_0xff3119[_0x88ca('0x2c')][_0x88ca('0x44')]:_0xff3119[_0x88ca('0x3f')][_0x88ca('0x45')];_0x43ec19[_0x88ca('0x46')]=_[_0x88ca('0x47')](_0xff3119['body'][_0x88ca('0x46')])?null:_0xff3119[_0x88ca('0x2c')][_0x88ca('0x46')];_0x43ec19[_0x88ca('0x48')]=_0xff3119['body'][_0x88ca('0x48')]||![];_0x43ec19[_0x88ca('0x49')]=_0xff3119['user']['id'];return getContent(_0xff3119[_0x88ca('0x2c')])[_0x88ca('0x4a')](function(_0x3e49a5){_0x43ec19[_0x88ca('0x2c')]=_0x3e49a5;return getRecipients(_0x2e9526);})[_0x88ca('0x4a')](function(_0xbf7bda){_0x43ec19['recipientsId']=_[_0x88ca('0x4b')](_0xbf7bda)[_0x88ca('0x4c')](',');return db[_0x88ca('0x4d')]['transaction'](function(_0x415a1a){return db[_0x88ca('0x4e')][_0x88ca('0x4f')](_0x43ec19,{'raw':!![],'transaction':_0x415a1a})[_0x88ca('0x4a')](function(_0x401c18){var _0x2d0176={'sender':_0x43ec19[_0x88ca('0x44')],'description':_0x43ec19[_0x88ca('0x46')],'content':_0x43ec19[_0x88ca('0x2c')],'beep':_0x43ec19[_0x88ca('0x48')]};_0xbf7bda[_0x88ca('0x50')](function(_0xa8afe3){_0x2d0176[_0x88ca('0x51')]=_0xa8afe3;socket[_0x88ca('0x52')](_0x88ca('0x53'),_0x2d0176);});return _0x401c18;});});})[_0x88ca('0x4a')](respondWithResult(_0x42223f,0xc9))['catch'](handleError(_0x42223f,null));};function getContent(_0x195ae1){return new BPromise(function(_0xc240d4,_0x109b27){if(_0x195ae1[_0x88ca('0x54')]){_0xc240d4(_0x195ae1[_0x88ca('0x54')]);return;}return db['Template'][_0x88ca('0x55')]({'attributes':[_0x88ca('0x56')],'where':{'id':_0x195ae1['TemplateId']},'raw':!![]})[_0x88ca('0x4a')](function(_0x454847){if(!_0x454847)throw new db[(_0x88ca('0x2d'))][(_0x88ca('0x2e'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x36eb3f=Mustache[_0x88ca('0x57')](_0x454847[_0x88ca('0x56')],_0x195ae1[_0x88ca('0x32')]);_0xc240d4(_0x36eb3f);})[_0x88ca('0x58')](function(_0x181f96){_0x109b27(_0x181f96);});});}function getRecipients(_0x2220c2){return new BPromise(function(_0x4d20f6,_0x4833df){var _0x56f0ae=[];var _0x5f533b=[];_0x2220c2[_0x88ca('0x50')](function(_0xc7cccb){var _0x2b0079=_['startCase'](_0xc7cccb[_0x88ca('0x59')][_0x88ca('0x42')]());if(_0x2b0079===_0x88ca('0x5a')){_0x56f0ae=_[_0x88ca('0x5b')](_0x56f0ae,_0xc7cccb[_0x88ca('0x5c')]);}else{if(_[_0x88ca('0x41')](_0x2b0079,_0x88ca('0x5d')))_0x2b0079=_0x2b0079[_0x88ca('0x5e')](_0x88ca('0x5d'),_0x88ca('0x5f'));_0xc7cccb['ids'][_0x88ca('0x50')](function(_0x3d18e9){_0x5f533b[_0x88ca('0x60')](getAgents(_0x2b0079,_0x3d18e9));});}});return BPromise[_0x88ca('0x61')](_0x5f533b)[_0x88ca('0x4a')](function(_0x18affa){_0x56f0ae=_['union'](_0x56f0ae,_[_0x88ca('0x62')](_0x18affa));_0x4d20f6(_0x56f0ae);})[_0x88ca('0x58')](function(_0x133619){_0x4833df(_0x133619);});});}function getAgents(_0x19dcb9,_0x3e7a93){return new BPromise(function(_0x118f40,_0x21525d){return db[_0x19dcb9][_0x88ca('0x55')]({'where':{'id':_0x3e7a93}})['then'](function(_0x2e6681){return _0x2e6681[_0x88ca('0x63')]({'attributes':['id'],'raw':!![]})[_0x88ca('0x4a')](function(_0x15ada8){var _0x138c8d=_[_0x88ca('0x64')](_0x15ada8,'id');_0x118f40(_0x138c8d);});})[_0x88ca('0x58')](function(_0x178685){_0x21525d(_0x178685);});});} \ No newline at end of file +var _0xadf3=['ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','beep','forEach','emit','catch','findOne','html','render','startCase','User','union','ids','replace','queue','Queue','push','all','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./userNotification.socket','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','body','hasOwnProperty','text','Sequelize'];(function(_0x197e39,_0x3cb727){var _0x994024=function(_0x54d154){while(--_0x54d154){_0x197e39['push'](_0x197e39['shift']());}};_0x994024(++_0x3cb727);}(_0xadf3,0x158));var _0x3adf=function(_0x4a7653,_0x44cccd){_0x4a7653=_0x4a7653-0x0;var _0x3a6d28=_0xadf3[_0x4a7653];return _0x3a6d28;};'use strict';var emlformat=require(_0x3adf('0x0'));var rimraf=require(_0x3adf('0x1'));var zipdir=require(_0x3adf('0x2'));var jsonpatch=require(_0x3adf('0x3'));var rp=require(_0x3adf('0x4'));var moment=require(_0x3adf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3adf('0x6'));var util=require(_0x3adf('0x7'));var path=require(_0x3adf('0x8'));var sox=require('sox');var csv=require(_0x3adf('0x9'));var ejs=require(_0x3adf('0xa'));var fs=require('fs');var fs_extra=require(_0x3adf('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3adf('0xc'));var jsforce=require(_0x3adf('0xd'));var deskjs=require(_0x3adf('0xe'));var toCsv=require(_0x3adf('0x9'));var querystring=require(_0x3adf('0xf'));var Papa=require(_0x3adf('0x10'));var Redis=require(_0x3adf('0x11'));var authService=require(_0x3adf('0x12'));var qs=require(_0x3adf('0x13'));var as=require(_0x3adf('0x14'));var hardwareService=require(_0x3adf('0x15'));var logger=require(_0x3adf('0x16'))(_0x3adf('0x17'));var utils=require(_0x3adf('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3adf('0x19'));var db=require('../../mysqldb')['db'];config[_0x3adf('0x1a')]=_[_0x3adf('0x1b')](config['redis'],{'host':_0x3adf('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3adf('0x1d'))['register'](socket);function respondWithStatusCode(_0x39bedc,_0x3898c2){_0x3898c2=_0x3898c2||0xcc;return function(_0x57422a){if(_0x57422a){return _0x39bedc['sendStatus'](_0x3898c2);}return _0x39bedc[_0x3adf('0x1e')](_0x3898c2)[_0x3adf('0x1f')]();};}function respondWithResult(_0x44e839,_0x55cc06){_0x55cc06=_0x55cc06||0xc8;return function(_0x367839){if(_0x367839){return _0x44e839['status'](_0x55cc06)['json'](_0x367839);}};}function respondWithFilteredResult(_0x2579b8,_0x158ec5){return function(_0x44cd22){if(_0x44cd22){var _0x5cfd5a=typeof _0x158ec5[_0x3adf('0x20')]===_0x3adf('0x21')&&typeof _0x158ec5[_0x3adf('0x22')]===_0x3adf('0x21');var _0x1ed2c9=_0x44cd22[_0x3adf('0x23')];var _0x581770=_0x5cfd5a?0x0:_0x158ec5[_0x3adf('0x20')];var _0x1ef814=_0x5cfd5a?_0x44cd22[_0x3adf('0x23')]:_0x158ec5[_0x3adf('0x20')]+_0x158ec5['limit'];var _0x27defb;if(_0x1ef814>=_0x1ed2c9){_0x1ef814=_0x1ed2c9;_0x27defb=0xc8;}else{_0x27defb=0xce;}_0x2579b8[_0x3adf('0x1e')](_0x27defb);return _0x2579b8[_0x3adf('0x24')](_0x3adf('0x25'),_0x581770+'-'+_0x1ef814+'/'+_0x1ed2c9)[_0x3adf('0x26')](_0x44cd22);}return null;};}function patchUpdates(_0x3bec98){return function(_0x1e5cd9){try{jsonpatch[_0x3adf('0x27')](_0x1e5cd9,_0x3bec98,!![]);}catch(_0x1977bf){return BPromise[_0x3adf('0x28')](_0x1977bf);}return _0x1e5cd9[_0x3adf('0x29')]();};}function saveUpdates(_0x6e7a65,_0x5807bc){return function(_0x3a842a){if(_0x3a842a){return _0x3a842a['update'](_0x6e7a65)[_0x3adf('0x2a')](function(_0x1405a2){return _0x1405a2;});}return null;};}function removeEntity(_0x47af87,_0x52f281){return function(_0x10e0db){if(_0x10e0db){return _0x10e0db['destroy']()[_0x3adf('0x2a')](function(){_0x47af87[_0x3adf('0x1e')](0xcc)[_0x3adf('0x1f')]();});}};}function handleEntityNotFound(_0xe4d950,_0x1cde45){return function(_0x2807c0){if(!_0x2807c0){_0xe4d950[_0x3adf('0x2b')](0x194);}return _0x2807c0;};}function handleError(_0x10252e,_0x144c02){_0x144c02=_0x144c02||0x1f4;return function(_0x537fec){logger[_0x3adf('0x2c')](_0x537fec[_0x3adf('0x2d')]);if(_0x537fec['name']){delete _0x537fec[_0x3adf('0x2e')];}_0x10252e[_0x3adf('0x1e')](_0x144c02)[_0x3adf('0x2f')](_0x537fec);};}exports['sendUserNotification']=function(_0x1cc7bd,_0x43f314,_0x59b1e8){if(!_0x1cc7bd[_0x3adf('0x30')][_0x3adf('0x31')](_0x3adf('0x32'))&&!_0x1cc7bd[_0x3adf('0x30')][_0x3adf('0x31')]('TemplateId')){throw new db[(_0x3adf('0x33'))][(_0x3adf('0x34'))](_0x3adf('0x35'));}else{if(_0x1cc7bd[_0x3adf('0x30')][_0x3adf('0x31')](_0x3adf('0x36'))&&!_0x1cc7bd[_0x3adf('0x30')][_0x3adf('0x31')](_0x3adf('0x37'))){throw new db[(_0x3adf('0x33'))]['ValidationError'](_0x3adf('0x38'));}if(!_0x1cc7bd[_0x3adf('0x30')][_0x3adf('0x31')](_0x3adf('0x39'))){throw new db[(_0x3adf('0x33'))][(_0x3adf('0x34'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x419ea1=JSON[_0x3adf('0x3a')](_0x1cc7bd[_0x3adf('0x30')]['recipients']);}catch(_0x39bdec){logger[_0x3adf('0x2c')](_0x39bdec);throw new db['Sequelize']['ValidationError'](_0x3adf('0x3b'));}var _0x5cfbd4=[_0x3adf('0x3c'),_0x3adf('0x3d'),_0x3adf('0x3e'),'openchannelqueue',_0x3adf('0x3f'),_0x3adf('0x40'),'whatsappqueue','team',_0x3adf('0x41')];if(_['some'](_0x419ea1,function(_0x4e3602){return!_[_0x3adf('0x42')](_0x5cfbd4,_0x4e3602[_0x3adf('0x43')][_0x3adf('0x44')]());})){throw new db[(_0x3adf('0x33'))][(_0x3adf('0x34'))](_0x3adf('0x45'));}}}var _0x13b3a9={};_0x13b3a9[_0x3adf('0x46')]=_0x1cc7bd[_0x3adf('0x30')]['hasOwnProperty'](_0x3adf('0x46'))?_0x1cc7bd['body'][_0x3adf('0x46')]:_0x1cc7bd[_0x3adf('0x41')][_0x3adf('0x47')];_0x13b3a9[_0x3adf('0x48')]=_[_0x3adf('0x49')](_0x1cc7bd[_0x3adf('0x30')][_0x3adf('0x48')])?null:_0x1cc7bd['body'][_0x3adf('0x48')];_0x13b3a9['beep']=_0x1cc7bd[_0x3adf('0x30')]['beep']||![];_0x13b3a9[_0x3adf('0x4a')]=_0x1cc7bd[_0x3adf('0x41')]['id'];return getContent(_0x1cc7bd[_0x3adf('0x30')])[_0x3adf('0x2a')](function(_0x14e263){_0x13b3a9[_0x3adf('0x30')]=_0x14e263;return getRecipients(_0x419ea1);})[_0x3adf('0x2a')](function(_0x175c2c){_0x13b3a9[_0x3adf('0x4b')]=_[_0x3adf('0x4c')](_0x175c2c)[_0x3adf('0x4d')](',');return db[_0x3adf('0x4e')][_0x3adf('0x4f')](function(_0x288a14){return db[_0x3adf('0x50')]['create'](_0x13b3a9,{'raw':!![],'transaction':_0x288a14})[_0x3adf('0x2a')](function(_0x80b252){var _0x299f5d={'sender':_0x13b3a9[_0x3adf('0x46')],'description':_0x13b3a9['recipientsDescription'],'content':_0x13b3a9['body'],'beep':_0x13b3a9[_0x3adf('0x51')]};_0x175c2c[_0x3adf('0x52')](function(_0x1c5608){_0x299f5d['recipient']=_0x1c5608;socket[_0x3adf('0x53')]('userNotification:send',_0x299f5d);});return _0x80b252;});});})['then'](respondWithResult(_0x43f314,0xc9))[_0x3adf('0x54')](handleError(_0x43f314,null));};function getContent(_0xbc8bed){return new BPromise(function(_0xbad961,_0x46c5f4){if(_0xbc8bed['text']){_0xbad961(_0xbc8bed[_0x3adf('0x32')]);return;}return db['Template'][_0x3adf('0x55')]({'attributes':[_0x3adf('0x56')],'where':{'id':_0xbc8bed[_0x3adf('0x36')]},'raw':!![]})[_0x3adf('0x2a')](function(_0x9db09d){if(!_0x9db09d)throw new db[(_0x3adf('0x33'))][(_0x3adf('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x501c85=Mustache[_0x3adf('0x57')](_0x9db09d[_0x3adf('0x56')],_0xbc8bed[_0x3adf('0x37')]);_0xbad961(_0x501c85);})[_0x3adf('0x54')](function(_0x180bf9){_0x46c5f4(_0x180bf9);});});}function getRecipients(_0x43f585){return new BPromise(function(_0x1aa91c,_0x2a97eb){var _0x439a3e=[];var _0x41c8ee=[];_0x43f585[_0x3adf('0x52')](function(_0x2d80e2){var _0x1b1ef3=_[_0x3adf('0x58')](_0x2d80e2[_0x3adf('0x43')]['toLowerCase']());if(_0x1b1ef3===_0x3adf('0x59')){_0x439a3e=_[_0x3adf('0x5a')](_0x439a3e,_0x2d80e2[_0x3adf('0x5b')]);}else{if(_[_0x3adf('0x42')](_0x1b1ef3,'queue'))_0x1b1ef3=_0x1b1ef3[_0x3adf('0x5c')](_0x3adf('0x5d'),_0x3adf('0x5e'));_0x2d80e2[_0x3adf('0x5b')][_0x3adf('0x52')](function(_0x312f4a){_0x41c8ee[_0x3adf('0x5f')](getAgents(_0x1b1ef3,_0x312f4a));});}});return BPromise[_0x3adf('0x60')](_0x41c8ee)['then'](function(_0x3ea84b){_0x439a3e=_[_0x3adf('0x5a')](_0x439a3e,_[_0x3adf('0x61')](_0x3ea84b));_0x1aa91c(_0x439a3e);})[_0x3adf('0x54')](function(_0x5592b7){_0x2a97eb(_0x5592b7);});});}function getAgents(_0x2b8b5c,_0x1d62a2){return new BPromise(function(_0x4e8410,_0x177d15){return db[_0x2b8b5c][_0x3adf('0x55')]({'where':{'id':_0x1d62a2}})[_0x3adf('0x2a')](function(_0x3a3858){return _0x3a3858['getAgents']({'attributes':['id'],'raw':!![]})[_0x3adf('0x2a')](function(_0x194939){var _0x55597c=_[_0x3adf('0x62')](_0x194939,'id');_0x4e8410(_0x55597c);});})[_0x3adf('0x54')](function(_0x1c8a61){_0x177d15(_0x1c8a61);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 8490e68..c7db644 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 _0x31b6=['emit','hasOwnProperty','exports','events','setMaxListeners','update','remove'];(function(_0x5621e7,_0x37bb52){var _0x131aad=function(_0x4ef81c){while(--_0x4ef81c){_0x5621e7['push'](_0x5621e7['shift']());}};_0x131aad(++_0x37bb52);}(_0x31b6,0x16f));var _0x631b=function(_0x52fc04,_0x225ac2){_0x52fc04=_0x52fc04-0x0;var _0x5e1bd5=_0x31b6[_0x52fc04];return _0x5e1bd5;};'use strict';var EventEmitter=require(_0x631b('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x631b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x631b('0x2'),'afterDestroy':_0x631b('0x3')};function emitEvent(_0x2a5848){return function(_0x590667,_0x23f24e,_0x32c7fd){UserNotificationEvents[_0x631b('0x4')](_0x2a5848+':'+_0x590667['id'],_0x590667);UserNotificationEvents[_0x631b('0x4')](_0x2a5848,_0x590667);_0x32c7fd(null);};}for(var e in events){if(events[_0x631b('0x5')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x631b('0x6')]=UserNotificationEvents; \ No newline at end of file +var _0x2f65=['update','remove','emit','hook','events','../../mysqldb','UserNotification','save'];(function(_0x911353,_0x1648ed){var _0x2f05fa=function(_0x4a00a4){while(--_0x4a00a4){_0x911353['push'](_0x911353['shift']());}};_0x2f05fa(++_0x1648ed);}(_0x2f65,0x154));var _0x52f6=function(_0x43b17d,_0x5e8ad3){_0x43b17d=_0x43b17d-0x0;var _0x161cde=_0x2f65[_0x43b17d];return _0x161cde;};'use strict';var EventEmitter=require(_0x52f6('0x0'));var UserNotification=require(_0x52f6('0x1'))['db'][_0x52f6('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x52f6('0x3'),'afterUpdate':_0x52f6('0x4'),'afterDestroy':_0x52f6('0x5')};function emitEvent(_0x50f58f){return function(_0x5a749b,_0x4a8aad,_0x1906e5){UserNotificationEvents['emit'](_0x50f58f+':'+_0x5a749b['id'],_0x5a749b);UserNotificationEvents[_0x52f6('0x6')](_0x50f58f,_0x5a749b);_0x1906e5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x52f6('0x7')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index bc1f22f..178044d 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 _0x19c1=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4'];(function(_0x22bcbf,_0x1ebec7){var _0x5aefb6=function(_0x69e712){while(--_0x69e712){_0x22bcbf['push'](_0x22bcbf['shift']());}};_0x5aefb6(++_0x1ebec7);}(_0x19c1,0x131));var _0x119c=function(_0x5d5b0c,_0x2b31ed){_0x5d5b0c=_0x5d5b0c-0x0;var _0x1d1d85=_0x19c1[_0x5d5b0c];return _0x1d1d85;};'use strict';var _=require('lodash');var util=require(_0x119c('0x0'));var logger=require(_0x119c('0x1'))(_0x119c('0x2'));var moment=require(_0x119c('0x3'));var BPromise=require(_0x119c('0x4'));var rp=require(_0x119c('0x5'));var fs=require('fs');var path=require(_0x119c('0x6'));var rimraf=require(_0x119c('0x7'));var config=require(_0x119c('0x8'));var attributes=require(_0x119c('0x9'));module[_0x119c('0xa')]=function(_0x12ca67,_0x1fa28d){return _0x12ca67[_0x119c('0xb')](_0x119c('0xc'),attributes,{'tableName':_0x119c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x119c('0xe'),'collate':_0x119c('0xf')});}; \ No newline at end of file +var _0xc2ea=['bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2ea,0x191));var _0xac2e=function(_0x5a2299,_0x3e2922){_0x5a2299=_0x5a2299-0x0;var _0xedff0f=_0xc2ea[_0x5a2299];return _0xedff0f;};'use strict';var _=require(_0xac2e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xac2e('0x1'));var moment=require('moment');var BPromise=require(_0xac2e('0x2'));var rp=require(_0xac2e('0x3'));var fs=require('fs');var path=require(_0xac2e('0x4'));var rimraf=require(_0xac2e('0x5'));var config=require(_0xac2e('0x6'));var attributes=require(_0xac2e('0x7'));module[_0xac2e('0x8')]=function(_0x1d0dd1,_0x484a21){return _0x1d0dd1['define'](_0xac2e('0x9'),attributes,{'tableName':_0xac2e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xac2e('0xb'),'collate':_0xac2e('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index e7a0738..a4b8a8f 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 _0x2858=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','http','redis','localhost','socket.io-emitter','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x51235c,_0x240587){var _0x14a5a0=function(_0x3cff6a){while(--_0x3cff6a){_0x51235c['push'](_0x51235c['shift']());}};_0x14a5a0(++_0x240587);}(_0x2858,0x1b6));var _0x8285=function(_0x4a3bd9,_0x4c6ea8){_0x4a3bd9=_0x4a3bd9-0x0;var _0x45b132=_0x2858[_0x4a3bd9];return _0x45b132;};'use strict';var _=require(_0x8285('0x0'));var util=require('util');var moment=require(_0x8285('0x1'));var BPromise=require(_0x8285('0x2'));var rs=require(_0x8285('0x3'));var fs=require('fs');var Redis=require(_0x8285('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8285('0x5'))(_0x8285('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8285('0x7')]({'port':0x232a});config[_0x8285('0x8')]=_['defaults'](config[_0x8285('0x8')],{'host':_0x8285('0x9'),'port':0x18eb});var socket=require(_0x8285('0xa'))(new Redis(config[_0x8285('0x8')]));require('./userNotification.socket')[_0x8285('0xb')](socket);function respondWithRpcPromise(_0xb7fc51,_0x5170b5,_0x120c34){return new BPromise(function(_0x26ec6d,_0x11cae8){return client[_0x8285('0xc')](_0xb7fc51,_0x120c34)['then'](function(_0x39a3b4){logger[_0x8285('0xd')](_0x8285('0xe'),_0x5170b5,_0x8285('0xf'));logger[_0x8285('0x10')](_0x8285('0x11'),_0x5170b5,_0x8285('0xf'),JSON[_0x8285('0x12')](_0x39a3b4));if(_0x39a3b4[_0x8285('0x13')]){if(_0x39a3b4[_0x8285('0x13')][_0x8285('0x14')]===0x1f4){logger['error'](_0x8285('0xe'),_0x5170b5,_0x39a3b4[_0x8285('0x13')][_0x8285('0x15')]);return _0x11cae8(_0x39a3b4[_0x8285('0x13')][_0x8285('0x15')]);}logger[_0x8285('0x13')](_0x8285('0xe'),_0x5170b5,_0x39a3b4['error'][_0x8285('0x15')]);return _0x26ec6d(_0x39a3b4[_0x8285('0x13')]['message']);}else{logger['info'](_0x8285('0xe'),_0x5170b5,_0x8285('0xf'));_0x26ec6d(_0x39a3b4[_0x8285('0x16')]['message']);}})[_0x8285('0x17')](function(_0x13f163){logger[_0x8285('0x13')]('UserNotification,\x20%s,\x20%s',_0x5170b5,_0x13f163);_0x11cae8(_0x13f163);});});} \ No newline at end of file +var _0x68e1=['randomstring','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0x125425,_0x4b6bab){var _0xd04dc4=function(_0x37fc01){while(--_0x37fc01){_0x125425['push'](_0x125425['shift']());}};_0xd04dc4(++_0x4b6bab);}(_0x68e1,0x16e));var _0x168e=function(_0x40a857,_0x3f7963){_0x40a857=_0x40a857-0x0;var _0x785a53=_0x68e1[_0x40a857];return _0x785a53;};'use strict';var _=require('lodash');var util=require(_0x168e('0x0'));var moment=require(_0x168e('0x1'));var BPromise=require('bluebird');var rs=require(_0x168e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x168e('0x3'))('rpc');var config=require(_0x168e('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x168e('0x5')][_0x168e('0x6')]({'port':0x232a});config['redis']=_[_0x168e('0x7')](config[_0x168e('0x8')],{'host':_0x168e('0x9'),'port':0x18eb});var socket=require(_0x168e('0xa'))(new Redis(config[_0x168e('0x8')]));require(_0x168e('0xb'))['register'](socket);function respondWithRpcPromise(_0x4e19f9,_0x25c089,_0x54f270){return new BPromise(function(_0x14a1c6,_0x561795){return client[_0x168e('0xc')](_0x4e19f9,_0x54f270)[_0x168e('0xd')](function(_0x299e97){logger[_0x168e('0xe')](_0x168e('0xf'),_0x25c089,_0x168e('0x10'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x25c089,_0x168e('0x10'),JSON[_0x168e('0x11')](_0x299e97));if(_0x299e97[_0x168e('0x12')]){if(_0x299e97[_0x168e('0x12')][_0x168e('0x13')]===0x1f4){logger[_0x168e('0x12')](_0x168e('0xf'),_0x25c089,_0x299e97[_0x168e('0x12')][_0x168e('0x14')]);return _0x561795(_0x299e97[_0x168e('0x12')][_0x168e('0x14')]);}logger['error']('UserNotification,\x20%s,\x20%s',_0x25c089,_0x299e97[_0x168e('0x12')][_0x168e('0x14')]);return _0x14a1c6(_0x299e97['error'][_0x168e('0x14')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x25c089,'request\x20sent');_0x14a1c6(_0x299e97[_0x168e('0x15')][_0x168e('0x14')]);}})[_0x168e('0x16')](function(_0x2b19f0){logger[_0x168e('0x12')](_0x168e('0xf'),_0x25c089,_0x2b19f0);_0x561795(_0x2b19f0);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index a39834f..6f16610 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 _0x8ae4=['register','length','userNotification:','./userNotification.events','save','remove','emit','removeListener'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x8ae4,0x83));var _0x48ae=function(_0x1fac98,_0x3a615e){_0x1fac98=_0x1fac98-0x0;var _0x56dfff=_0x8ae4[_0x1fac98];return _0x56dfff;};'use strict';var UserNotificationEvents=require(_0x48ae('0x0'));var events=[_0x48ae('0x1'),_0x48ae('0x2'),'update'];function createListener(_0x29f907,_0xff7681){return function(_0x57adc3){_0xff7681[_0x48ae('0x3')](_0x29f907,_0x57adc3);};}function removeListener(_0xb07711,_0x40c536){return function(){UserNotificationEvents[_0x48ae('0x4')](_0xb07711,_0x40c536);};}exports[_0x48ae('0x5')]=function(_0x3e140a){for(var _0x4a12ed=0x0,_0x47f6f0=events[_0x48ae('0x6')];_0x4a12ed<_0x47f6f0;_0x4a12ed++){var _0x250cd7=events[_0x4a12ed];var _0x33012c=createListener(_0x48ae('0x7')+_0x250cd7,_0x3e140a);UserNotificationEvents['on'](_0x250cd7,_0x33012c);}}; \ No newline at end of file +var _0xf668=['remove','update','removeListener','register','length','userNotification:','./userNotification.events'];(function(_0x6c7fb,_0x5edfe9){var _0x2b14b7=function(_0x11e9fb){while(--_0x11e9fb){_0x6c7fb['push'](_0x6c7fb['shift']());}};_0x2b14b7(++_0x5edfe9);}(_0xf668,0x117));var _0x8f66=function(_0x42359d,_0x537a2e){_0x42359d=_0x42359d-0x0;var _0x5d280a=_0xf668[_0x42359d];return _0x5d280a;};'use strict';var UserNotificationEvents=require(_0x8f66('0x0'));var events=['save',_0x8f66('0x1'),_0x8f66('0x2')];function createListener(_0x2b4b5a,_0x544d43){return function(_0x319aeb){_0x544d43['emit'](_0x2b4b5a,_0x319aeb);};}function removeListener(_0x459359,_0x235a26){return function(){UserNotificationEvents[_0x8f66('0x3')](_0x459359,_0x235a26);};}exports[_0x8f66('0x4')]=function(_0x1907b7){for(var _0x52372d=0x0,_0x290cb9=events[_0x8f66('0x5')];_0x52372d<_0x290cb9;_0x52372d++){var _0x18429f=events[_0x52372d];var _0x3ac81a=createListener(_0x8f66('0x6')+_0x18429f,_0x1907b7);UserNotificationEvents['on'](_0x18429f,_0x3ac81a);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index cd512e7..111a2b0 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x24f7a1,_0x787269){var _0x4a5807=function(_0x432711){while(--_0x432711){_0x24f7a1['push'](_0x24f7a1['shift']());}};_0x4a5807(++_0x787269);}(_0xe706,0xa3));var _0x6e70=function(_0x130d82,_0x25f49b){_0x130d82=_0x130d82-0x0;var _0x112070=_0xe706[_0x130d82];return _0x112070;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x37e198,_0x349ae8){var _0x1f8b81=function(_0x1deb70){while(--_0x1deb70){_0x37e198['push'](_0x37e198['shift']());}};_0x1f8b81(++_0x349ae8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0xcb91[_0x2bf888];return _0x3038d6;};'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 424be50..dbfa1d5 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 _0xc15e=['INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc15e,0x191));var _0xec15=function(_0x3d65ca,_0x3b4bb4){_0x3d65ca=_0x3d65ca-0x0;var _0x3bd82e=_0xc15e[_0x3d65ca];return _0x3bd82e;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0xec15('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xda05=['exports','INTEGER','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xda05,0x179));var _0x5da0=function(_0x26cd4c,_0x40b396){_0x26cd4c=_0x26cd4c-0x0;var _0x314cfa=_0xda05[_0x26cd4c];return _0x314cfa;};'use strict';var Sequelize=require(_0x5da0('0x0'));module[_0x5da0('0x1')]={'penalty':{'type':Sequelize[_0x5da0('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index d8763ac..a4d3a9d 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 _0x121e=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0x411152,_0x265001){var _0x57306a=function(_0x567f54){while(--_0x567f54){_0x411152['push'](_0x411152['shift']());}};_0x57306a(++_0x265001);}(_0x121e,0x84));var _0xe121=function(_0x303717,_0x4d3c3e){_0x303717=_0x303717-0x0;var _0x1f0e3f=_0x121e[_0x303717];return _0x1f0e3f;};'use strict';var _=require(_0xe121('0x0'));var util=require('util');var logger=require(_0xe121('0x1'))(_0xe121('0x2'));var moment=require('moment');var BPromise=require(_0xe121('0x3'));var rp=require(_0xe121('0x4'));var fs=require('fs');var path=require(_0xe121('0x5'));var rimraf=require(_0xe121('0x6'));var config=require(_0xe121('0x7'));var attributes=require(_0xe121('0x8'));module[_0xe121('0x9')]=function(_0x140e77,_0x31b78c){return _0x140e77[_0xe121('0xa')](_0xe121('0xb'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3054=['api','moment','bluebird','request-promise','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash','util','../../config/logger'];(function(_0x33995d,_0x2acf86){var _0x50e10e=function(_0x11ff03){while(--_0x11ff03){_0x33995d['push'](_0x33995d['shift']());}};_0x50e10e(++_0x2acf86);}(_0x3054,0x1a1));var _0x4305=function(_0x39e364,_0x31423c){_0x39e364=_0x39e364-0x0;var _0x3a8138=_0x3054[_0x39e364];return _0x3a8138;};'use strict';var _=require(_0x4305('0x0'));var util=require(_0x4305('0x1'));var logger=require(_0x4305('0x2'))(_0x4305('0x3'));var moment=require(_0x4305('0x4'));var BPromise=require(_0x4305('0x5'));var rp=require(_0x4305('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4305('0x7'));var config=require('../../config/environment');var attributes=require(_0x4305('0x8'));module[_0x4305('0x9')]=function(_0x4c1caf,_0x2a84ff){return _0x4c1caf[_0x4305('0xa')](_0x4305('0xb'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 8f6f6cc..850093f 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 _0x43eb=['client','request','then','debug','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','info','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x51fd64,_0x4be038){var _0x1f5a6f=function(_0x4af9a2){while(--_0x4af9a2){_0x51fd64['push'](_0x51fd64['shift']());}};_0x1f5a6f(++_0x4be038);}(_0x43eb,0x199));var _0xb43e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x43eb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb43e('0x0'));var util=require(_0xb43e('0x1'));var moment=require(_0xb43e('0x2'));var BPromise=require('bluebird');var rs=require(_0xb43e('0x3'));var fs=require('fs');var Redis=require(_0xb43e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb43e('0x5'));var logger=require('../../config/logger')(_0xb43e('0x6'));var config=require(_0xb43e('0x7'));var jayson=require(_0xb43e('0x8'));var client=jayson[_0xb43e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5decf3,_0xaad51f,_0x5be2f3){return new BPromise(function(_0x3d8937,_0x2ca0a7){return client[_0xb43e('0xa')](_0x5decf3,_0x5be2f3)[_0xb43e('0xb')](function(_0x423e9e){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0xaad51f,'request\x20sent');logger[_0xb43e('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xaad51f,'request\x20sent',JSON[_0xb43e('0xd')](_0x423e9e));if(_0x423e9e[_0xb43e('0xe')]){if(_0x423e9e[_0xb43e('0xe')][_0xb43e('0xf')]===0x1f4){logger[_0xb43e('0xe')](_0xb43e('0x10'),_0xaad51f,_0x423e9e[_0xb43e('0xe')][_0xb43e('0x11')]);return _0x2ca0a7(_0x423e9e[_0xb43e('0xe')][_0xb43e('0x11')]);}logger[_0xb43e('0xe')](_0xb43e('0x10'),_0xaad51f,_0x423e9e[_0xb43e('0xe')]['message']);return _0x3d8937(_0x423e9e[_0xb43e('0xe')][_0xb43e('0x11')]);}else{logger[_0xb43e('0x12')](_0xb43e('0x10'),_0xaad51f,_0xb43e('0x13'));_0x3d8937(_0x423e9e[_0xb43e('0x14')][_0xb43e('0x11')]);}})[_0xb43e('0x15')](function(_0x4d0aa7){logger['error'](_0xb43e('0x10'),_0xaad51f,_0x4d0aa7);_0x2ca0a7(_0x4d0aa7);});});} \ No newline at end of file +var _0xae9b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','UserOpenchannelQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','lodash','util'];(function(_0x370951,_0xd0ef2c){var _0x2be4e5=function(_0x1a7a0a){while(--_0x1a7a0a){_0x370951['push'](_0x370951['shift']());}};_0x2be4e5(++_0xd0ef2c);}(_0xae9b,0xe4));var _0xbae9=function(_0x4d31c0,_0x4bf043){_0x4d31c0=_0x4d31c0-0x0;var _0x52439b=_0xae9b[_0x4d31c0];return _0x52439b;};'use strict';var _=require(_0xbae9('0x0'));var util=require(_0xbae9('0x1'));var moment=require(_0xbae9('0x2'));var BPromise=require(_0xbae9('0x3'));var rs=require(_0xbae9('0x4'));var fs=require('fs');var Redis=require(_0xbae9('0x5'));var db=require(_0xbae9('0x6'))['db'];var utils=require(_0xbae9('0x7'));var logger=require(_0xbae9('0x8'))(_0xbae9('0x9'));var config=require(_0xbae9('0xa'));var jayson=require(_0xbae9('0xb'));var client=jayson[_0xbae9('0xc')][_0xbae9('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xde858b,_0xb3f9e1,_0x595681){return new BPromise(function(_0x39685d,_0x56e083){return client[_0xbae9('0xe')](_0xde858b,_0x595681)['then'](function(_0x343372){logger['info'](_0xbae9('0xf'),_0xb3f9e1,'request\x20sent');logger[_0xbae9('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0xb3f9e1,_0xbae9('0x11'),JSON['stringify'](_0x343372));if(_0x343372[_0xbae9('0x12')]){if(_0x343372[_0xbae9('0x12')][_0xbae9('0x13')]===0x1f4){logger['error'](_0xbae9('0xf'),_0xb3f9e1,_0x343372[_0xbae9('0x12')][_0xbae9('0x14')]);return _0x56e083(_0x343372['error']['message']);}logger[_0xbae9('0x12')](_0xbae9('0xf'),_0xb3f9e1,_0x343372[_0xbae9('0x12')]['message']);return _0x39685d(_0x343372[_0xbae9('0x12')][_0xbae9('0x14')]);}else{logger[_0xbae9('0x15')](_0xbae9('0xf'),_0xb3f9e1,_0xbae9('0x11'));_0x39685d(_0x343372['result'][_0xbae9('0x14')]);}})[_0xbae9('0x16')](function(_0x56b8de){logger[_0xbae9('0x12')](_0xbae9('0xf'),_0xb3f9e1,_0x56b8de);_0x56e083(_0x56b8de);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 6206ccb..3cdc139 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 _0xb654=['/:id','show','/:id/sections','getResources','create','post','/:id/clone','clone','delete','destroy','removeSections','/:id/resources','removeResources','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x4998bc,_0x3a199b){var _0x9f00b0=function(_0x3c772b){while(--_0x3c772b){_0x4998bc['push'](_0x4998bc['shift']());}};_0x9f00b0(++_0x3a199b);}(_0xb654,0xc3));var _0x4b65=function(_0x270888,_0x316090){_0x270888=_0x270888-0x0;var _0x207f8b=_0xb654[_0x270888];return _0x207f8b;};'use strict';var multer=require('multer');var util=require(_0x4b65('0x0'));var path=require(_0x4b65('0x1'));var timeout=require(_0x4b65('0x2'));var express=require(_0x4b65('0x3'));var router=express['Router']();var fs_extra=require(_0x4b65('0x4'));var auth=require(_0x4b65('0x5'));var interaction=require(_0x4b65('0x6'));var config=require('../../config/environment');var controller=require(_0x4b65('0x7'));router['get']('/',auth[_0x4b65('0x8')](),controller[_0x4b65('0x9')]);router[_0x4b65('0xa')](_0x4b65('0xb'),auth[_0x4b65('0x8')](),controller[_0x4b65('0xc')]);router[_0x4b65('0xa')](_0x4b65('0xd'),auth[_0x4b65('0x8')](),controller[_0x4b65('0xe')]);router[_0x4b65('0xa')](_0x4b65('0xf'),auth[_0x4b65('0x8')](),controller['getSections']);router['get']('/:id/resources',auth[_0x4b65('0x8')](),controller[_0x4b65('0x10')]);router['post']('/',auth[_0x4b65('0x8')](),controller[_0x4b65('0x11')]);router[_0x4b65('0x12')](_0x4b65('0x13'),auth[_0x4b65('0x8')](),controller[_0x4b65('0x14')]);router[_0x4b65('0x12')](_0x4b65('0xf'),auth[_0x4b65('0x8')](),controller['addSections']);router[_0x4b65('0x12')]('/:id/resources',auth[_0x4b65('0x8')](),controller['addResources']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4b65('0x15')](_0x4b65('0xd'),auth[_0x4b65('0x8')](),controller[_0x4b65('0x16')]);router['delete'](_0x4b65('0xf'),auth[_0x4b65('0x8')](),controller[_0x4b65('0x17')]);router[_0x4b65('0x15')](_0x4b65('0x18'),auth['isAuthenticated'](),controller[_0x4b65('0x19')]);module['exports']=router; \ No newline at end of file +var _0x61e1=['put','update','delete','/:id','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','/describe','describe','show','get','/:id/sections','/:id/resources','getResources','create','/:id/clone','clone','post','addResources'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x61e1,0x19b));var _0x161e=function(_0x5bb257,_0x2ac141){_0x5bb257=_0x5bb257-0x0;var _0x1c3de2=_0x61e1[_0x5bb257];return _0x1c3de2;};'use strict';var multer=require(_0x161e('0x0'));var util=require(_0x161e('0x1'));var path=require(_0x161e('0x2'));var timeout=require(_0x161e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x161e('0x4'));var auth=require(_0x161e('0x5'));var interaction=require(_0x161e('0x6'));var config=require(_0x161e('0x7'));var controller=require(_0x161e('0x8'));router['get']('/',auth[_0x161e('0x9')](),controller[_0x161e('0xa')]);router['get'](_0x161e('0xb'),auth[_0x161e('0x9')](),controller[_0x161e('0xc')]);router['get']('/:id',auth[_0x161e('0x9')](),controller[_0x161e('0xd')]);router[_0x161e('0xe')](_0x161e('0xf'),auth[_0x161e('0x9')](),controller['getSections']);router['get'](_0x161e('0x10'),auth[_0x161e('0x9')](),controller[_0x161e('0x11')]);router['post']('/',auth[_0x161e('0x9')](),controller[_0x161e('0x12')]);router['post'](_0x161e('0x13'),auth['isAuthenticated'](),controller[_0x161e('0x14')]);router[_0x161e('0x15')](_0x161e('0xf'),auth[_0x161e('0x9')](),controller['addSections']);router['post'](_0x161e('0x10'),auth[_0x161e('0x9')](),controller[_0x161e('0x16')]);router[_0x161e('0x17')]('/:id',auth[_0x161e('0x9')](),controller[_0x161e('0x18')]);router[_0x161e('0x19')](_0x161e('0x1a'),auth['isAuthenticated'](),controller[_0x161e('0x1b')]);router['delete'](_0x161e('0xf'),auth[_0x161e('0x9')](),controller[_0x161e('0x1c')]);router[_0x161e('0x19')](_0x161e('0x10'),auth[_0x161e('0x9')](),controller[_0x161e('0x1d')]);module[_0x161e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 2a2eb67..bf69a17 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 _0x149e=['sequelize','exports','name','setDataValue','crudPermissions','join','getDataValue','BOOLEAN'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x149e,0x108));var _0xe149=function(_0x575436,_0x3ab3cc){_0x575436=_0x575436-0x0;var _0x59dca1=_0x149e[_0x575436];return _0x59dca1;};'use strict';var Sequelize=require(_0xe149('0x0'));module[_0xe149('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe149('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x5c0e1c){this[_0xe149('0x3')](_0xe149('0x4'),_0x5c0e1c?_0x5c0e1c[_0xe149('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xe149('0x4'))?this[_0xe149('0x6')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xe149('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xe149('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xe149('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe149('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xe149('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe149('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5754=['STRING','name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5754,0xc6));var _0x4575=function(_0x5bc8cd,_0x2aec56){_0x5bc8cd=_0x5bc8cd-0x0;var _0x5b9c02=_0x5754[_0x5bc8cd];return _0x5b9c02;};'use strict';var Sequelize=require(_0x4575('0x0'));module[_0x4575('0x1')]={'name':{'type':Sequelize[_0x4575('0x2')],'allowNull':![],'unique':_0x4575('0x3')},'crudPermissions':{'type':Sequelize[_0x4575('0x2')],'set':function(_0x265e19){this[_0x4575('0x4')](_0x4575('0x5'),_0x265e19?_0x265e19[_0x4575('0x6')](''):[]);},'get':function(){return this[_0x4575('0x7')](_0x4575('0x5'))?this[_0x4575('0x7')](_0x4575('0x5'))[_0x4575('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x4575('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x4575('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x4575('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x4575('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x4575('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4575('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 4ffe0b3..0a34ecf 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 _0xb91a=['getSections','filter','sectionId','isEmpty','subsections','includes','enabled','Dashboard','forEach','resourceId','Plugin','addResources','removeResources','section','Missing\x20section\x20parameter','hasOwnProperty','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','squel','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','localhost','./userProfile.socket','register','status','undefined','limit','count','offset','set','apply','save','then','destroy','sendStatus','name','send','index','UserProfile','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','model','find','body','get','omit','createdAt','updatedAt','crudPermissions','transaction','create','each','autoAssociation','userProfileId','Resources','UserProfileSection','UserProfileResource','update','describe','push','removeSections','ids'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb91a,0xe5));var _0xab91=function(_0x4e912c,_0x33bdf7){_0x4e912c=_0x4e912c-0x0;var _0x3fc66a=_0xb91a[_0x4e912c];return _0x3fc66a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab91('0x0'));var zipdir=require(_0xab91('0x1'));var jsonpatch=require(_0xab91('0x2'));var rp=require(_0xab91('0x3'));var moment=require('moment');var BPromise=require(_0xab91('0x4'));var Mustache=require(_0xab91('0x5'));var util=require('util');var path=require(_0xab91('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xab91('0x7'));var fs=require('fs');var fs_extra=require(_0xab91('0x8'));var _=require('lodash');var squel=require(_0xab91('0x9'));var crypto=require(_0xab91('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xab91('0xb'));var toCsv=require(_0xab91('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xab91('0xd'));var qs=require(_0xab91('0xe'));var as=require(_0xab91('0xf'));var hardwareService=require(_0xab91('0x10'));var logger=require('../../config/logger')(_0xab91('0x11'));var utils=require(_0xab91('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xab91('0x13'));var db=require('../../mysqldb')['db'];config[_0xab91('0x14')]=_['defaults'](config['redis'],{'host':_0xab91('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab91('0x14')]));require(_0xab91('0x16'))[_0xab91('0x17')](socket);function respondWithStatusCode(_0x29fadc,_0x293193){_0x293193=_0x293193||0xcc;return function(_0x441121){if(_0x441121){return _0x29fadc['sendStatus'](_0x293193);}return _0x29fadc[_0xab91('0x18')](_0x293193)['end']();};}function respondWithResult(_0x23c3d8,_0xbf0ed8){_0xbf0ed8=_0xbf0ed8||0xc8;return function(_0x312a4e){if(_0x312a4e){return _0x23c3d8[_0xab91('0x18')](_0xbf0ed8)['json'](_0x312a4e);}};}function respondWithFilteredResult(_0x434dcd,_0xa63f1d){return function(_0x1ece47){if(_0x1ece47){var _0x5835e1=typeof _0xa63f1d['offset']===_0xab91('0x19')&&typeof _0xa63f1d[_0xab91('0x1a')]===_0xab91('0x19');var _0x1f9fa9=_0x1ece47[_0xab91('0x1b')];var _0x62aa5f=_0x5835e1?0x0:_0xa63f1d[_0xab91('0x1c')];var _0x26627c=_0x5835e1?_0x1ece47[_0xab91('0x1b')]:_0xa63f1d[_0xab91('0x1c')]+_0xa63f1d['limit'];var _0x25f2d3;if(_0x26627c>=_0x1f9fa9){_0x26627c=_0x1f9fa9;_0x25f2d3=0xc8;}else{_0x25f2d3=0xce;}_0x434dcd[_0xab91('0x18')](_0x25f2d3);return _0x434dcd[_0xab91('0x1d')]('Content-Range',_0x62aa5f+'-'+_0x26627c+'/'+_0x1f9fa9)['json'](_0x1ece47);}return null;};}function patchUpdates(_0xad9571){return function(_0x87358a){try{jsonpatch[_0xab91('0x1e')](_0x87358a,_0xad9571,!![]);}catch(_0x5995de){return BPromise['reject'](_0x5995de);}return _0x87358a[_0xab91('0x1f')]();};}function saveUpdates(_0x5b0c6a,_0x17967a){return function(_0x49d225){if(_0x49d225){return _0x49d225['update'](_0x5b0c6a)[_0xab91('0x20')](function(_0x43f334){return _0x43f334;});}return null;};}function removeEntity(_0x1a57e2,_0x2a1e5e){return function(_0x239542){if(_0x239542){return _0x239542[_0xab91('0x21')]()[_0xab91('0x20')](function(){_0x1a57e2[_0xab91('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d822d,_0x364b84){return function(_0x1a3f68){if(!_0x1a3f68){_0x3d822d[_0xab91('0x22')](0x194);}return _0x1a3f68;};}function handleError(_0x4e8f14,_0x1b68e6){_0x1b68e6=_0x1b68e6||0x1f4;return function(_0x284270){logger['error'](_0x284270['stack']);if(_0x284270[_0xab91('0x23')]){delete _0x284270[_0xab91('0x23')];}_0x4e8f14[_0xab91('0x18')](_0x1b68e6)[_0xab91('0x24')](_0x284270);};}exports[_0xab91('0x25')]=function(_0x475f97,_0x11cdd8){var _0x2e022d={},_0x19c9a5={},_0x1e4b6f={'count':0x0,'rows':[]};var _0x6852ca=_['map'](db[_0xab91('0x26')][_0xab91('0x27')],function(_0x548013){return{'name':_0x548013[_0xab91('0x28')],'type':_0x548013[_0xab91('0x29')][_0xab91('0x2a')]};});_0x19c9a5['model']=_[_0xab91('0x2b')](_0x6852ca,'name');_0x19c9a5[_0xab91('0x2c')]=_[_0xab91('0x2d')](_0x475f97['query']);_0x19c9a5[_0xab91('0x2e')]=_[_0xab91('0x2f')](_0x19c9a5['model'],_0x19c9a5[_0xab91('0x2c')]);_0x2e022d[_0xab91('0x30')]=_[_0xab91('0x2f')](_0x19c9a5['model'],qs[_0xab91('0x31')](_0x475f97[_0xab91('0x2c')]['fields']));_0x2e022d[_0xab91('0x30')]=_0x2e022d[_0xab91('0x30')][_0xab91('0x32')]?_0x2e022d['attributes']:_0x19c9a5['model'];if(!_0x475f97[_0xab91('0x2c')]['hasOwnProperty']('nolimit')){_0x2e022d[_0xab91('0x1a')]=qs[_0xab91('0x1a')](_0x475f97['query'][_0xab91('0x1a')]);_0x2e022d[_0xab91('0x1c')]=qs[_0xab91('0x1c')](_0x475f97[_0xab91('0x2c')][_0xab91('0x1c')]);}_0x2e022d[_0xab91('0x33')]=qs['sort'](_0x475f97[_0xab91('0x2c')][_0xab91('0x34')]);_0x2e022d[_0xab91('0x35')]=qs[_0xab91('0x2e')](_[_0xab91('0x36')](_0x475f97[_0xab91('0x2c')],_0x19c9a5[_0xab91('0x2e')]),_0x6852ca);if(_0x475f97['query']['filter']){_0x2e022d[_0xab91('0x35')]=_[_0xab91('0x37')](_0x2e022d['where'],{'$or':_['map'](_0x6852ca,function(_0x1d6dba){if(_0x1d6dba['type']!==_0xab91('0x38')){var _0x47c956={};_0x47c956[_0x1d6dba[_0xab91('0x23')]]={'$like':'%'+_0x475f97[_0xab91('0x2c')]['filter']+'%'};return _0x47c956;}})});}_0x2e022d=_['merge']({},_0x2e022d,_0x475f97[_0xab91('0x39')]);var _0x43793e={'where':_0x2e022d['where']};return db['UserProfile']['count'](_0x43793e)[_0xab91('0x20')](function(_0x2a2024){_0x1e4b6f[_0xab91('0x1b')]=_0x2a2024;if(_0x475f97['query'][_0xab91('0x3a')]){_0x2e022d[_0xab91('0x3b')]=[{'all':!![]}];}return db[_0xab91('0x26')][_0xab91('0x3c')](_0x2e022d);})[_0xab91('0x20')](function(_0x1a3bdf){_0x1e4b6f[_0xab91('0x3d')]=_0x1a3bdf;return _0x1e4b6f;})[_0xab91('0x20')](respondWithFilteredResult(_0x11cdd8,_0x2e022d))[_0xab91('0x3e')](handleError(_0x11cdd8,null));};exports[_0xab91('0x3f')]=function(_0x573bbf,_0x4f255d){var _0x2025e0={'raw':![],'where':{'id':_0x573bbf[_0xab91('0x40')]['id']}},_0x2033df={};_0x2033df[_0xab91('0x41')]=_[_0xab91('0x2d')](db[_0xab91('0x26')][_0xab91('0x27')]);_0x2033df[_0xab91('0x2c')]=_[_0xab91('0x2d')](_0x573bbf[_0xab91('0x2c')]);_0x2033df[_0xab91('0x2e')]=_[_0xab91('0x2f')](_0x2033df[_0xab91('0x41')],_0x2033df['query']);_0x2025e0[_0xab91('0x30')]=_['intersection'](_0x2033df['model'],qs[_0xab91('0x31')](_0x573bbf['query'][_0xab91('0x31')]));_0x2025e0[_0xab91('0x30')]=_0x2025e0[_0xab91('0x30')][_0xab91('0x32')]?_0x2025e0[_0xab91('0x30')]:_0x2033df[_0xab91('0x41')];if(_0x573bbf['query'][_0xab91('0x3a')]){_0x2025e0[_0xab91('0x3b')]=[{'all':!![]}];}_0x2025e0=_['merge']({},_0x2025e0,_0x573bbf[_0xab91('0x39')]);return db[_0xab91('0x26')][_0xab91('0x42')](_0x2025e0)[_0xab91('0x20')](handleEntityNotFound(_0x4f255d,null))[_0xab91('0x20')](respondWithResult(_0x4f255d,null))[_0xab91('0x3e')](handleError(_0x4f255d,null));};exports['create']=function(_0x5648ad,_0xb02842){return db[_0xab91('0x26')]['create'](_0x5648ad[_0xab91('0x43')],{})['then'](respondWithResult(_0xb02842,0xc9))[_0xab91('0x3e')](handleError(_0xb02842,null));};exports['clone']=function(_0x27c3b3,_0x26d754){var _0x2d2d09={'where':{'id':_0x27c3b3[_0xab91('0x40')]['id']}},_0x40e157={};_0x40e157[_0xab91('0x41')]=_[_0xab91('0x2d')](db[_0xab91('0x26')]['rawAttributes']);_0x2d2d09[_0xab91('0x30')]=_[_0xab91('0x2f')](_0x40e157[_0xab91('0x41')],qs['fields'](_0x27c3b3[_0xab91('0x2c')][_0xab91('0x31')]));_0x2d2d09[_0xab91('0x30')]=_0x2d2d09[_0xab91('0x30')][_0xab91('0x32')]?_0x2d2d09['attributes']:_0x40e157['model'];if(_0x27c3b3[_0xab91('0x2c')][_0xab91('0x3a')]){_0x2d2d09['include']=[{'all':!![]}];}_0x2d2d09=_[_0xab91('0x37')]({},_0x2d2d09,_0x27c3b3[_0xab91('0x39')]);return db[_0xab91('0x26')][_0xab91('0x42')](_0x2d2d09)[_0xab91('0x20')](handleEntityNotFound(_0x26d754,null))[_0xab91('0x20')](function(_0x5e3cd3){if(_0x5e3cd3){var _0x128934=_0x5e3cd3[_0xab91('0x44')]({'plain':!![]});_0x128934=qs[_0xab91('0x45')](_0x128934,['id',_0xab91('0x46'),_0xab91('0x47'),_0xab91('0x48')]);_0x27c3b3[_0xab91('0x43')]=_[_0xab91('0x45')](_0x27c3b3[_0xab91('0x43')],['id',_0xab91('0x46'),'updatedAt']);return db['sequelize'][_0xab91('0x49')](function(_0x3cec33){return db['UserProfile'][_0xab91('0x4a')](_[_0xab91('0x37')](_0x128934,_0x27c3b3['body']),{'include':_0x27c3b3[_0xab91('0x2c')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x3cec33})['then'](function(_0x151b0d){var _0x3fb19c=_0x151b0d['get']({'plain':!![]});return db['UserProfileSection'][_0xab91('0x3c')]({'where':{'userProfileId':_0x27c3b3[_0xab91('0x40')]['id']},'raw':!![]})[_0xab91('0x20')](function(_0x59af1f){if(_0x59af1f){return BPromise[_0xab91('0x4b')](_0x59af1f,function(_0x1be78f){return new BPromise(function(_0x31f90d,_0x1628f8){if(_0x1be78f[_0xab91('0x4c')]===null||_0x1be78f[_0xab91('0x4c')]===0x1)_0x31f90d(null);return db['UserProfileResource'][_0xab91('0x3c')]({'where':{'sectionId':_0x1be78f['id']},'raw':!![]})['then'](function(_0x3c2637){var _0x61d51f=_[_0xab91('0x2b')](_0x3c2637,function(_0xc90d7b){return qs[_0xab91('0x45')](_0xc90d7b,['id',_0xab91('0x46'),_0xab91('0x47'),'sectionId']);});_0x31f90d(_0x61d51f);})[_0xab91('0x3e')](function(_0x547e80){_0x1628f8(_0x547e80);});})[_0xab91('0x20')](function(_0x13f36e){var _0xbebd11=qs['omit'](_0x1be78f,['id','createdAt',_0xab91('0x47')]);_0xbebd11[_0xab91('0x4d')]=_0x3fb19c['id'];if(_0x13f36e)_0xbebd11[_0xab91('0x4e')]=_0x13f36e;return _0xbebd11;})[_0xab91('0x20')](function(_0x587308){return db[_0xab91('0x4f')]['create'](_0x587308,{'include':[{'model':db[_0xab91('0x50')],'as':_0xab91('0x4e')}],'raw':!![],'transaction':_0x3cec33});});})['then'](function(){return _0x3fb19c;});}});});});}})[_0xab91('0x20')](respondWithResult(_0x26d754,0xc9))[_0xab91('0x3e')](handleError(_0x26d754,null));};exports[_0xab91('0x51')]=function(_0x36a80b,_0x39e1ae){if(_0x36a80b[_0xab91('0x43')]['id']){delete _0x36a80b[_0xab91('0x43')]['id'];}return db[_0xab91('0x26')][_0xab91('0x42')]({'where':{'id':_0x36a80b[_0xab91('0x40')]['id']}})[_0xab91('0x20')](handleEntityNotFound(_0x39e1ae,null))['then'](saveUpdates(_0x36a80b[_0xab91('0x43')],null))[_0xab91('0x20')](respondWithResult(_0x39e1ae,null))[_0xab91('0x3e')](handleError(_0x39e1ae,null));};exports[_0xab91('0x21')]=function(_0x5eb7b7,_0x15c88f){return db[_0xab91('0x26')]['find']({'where':{'id':_0x5eb7b7[_0xab91('0x40')]['id']}})[_0xab91('0x20')](handleEntityNotFound(_0x15c88f,null))[_0xab91('0x20')](removeEntity(_0x15c88f,null))['catch'](handleError(_0x15c88f,null));};exports[_0xab91('0x52')]=function(_0x9eab34,_0x22f1a4){return db[_0xab91('0x26')][_0xab91('0x52')]()[_0xab91('0x20')](respondWithResult(_0x22f1a4,null))[_0xab91('0x3e')](handleError(_0x22f1a4,null));};exports['addSections']=function(_0x164bdd,_0x4ed860){var _0x12c23e=_0x164bdd['body'];return db[_0xab91('0x26')]['find']({'where':{'id':_0x164bdd[_0xab91('0x40')]['id']}})[_0xab91('0x20')](handleEntityNotFound(_0x4ed860,null))[_0xab91('0x20')](function(_0x48f469){if(_0x48f469){return db['sequelize'][_0xab91('0x49')](function(_0x29c565){return db[_0xab91('0x4f')][_0xab91('0x21')]({'where':{'userProfileId':_0x164bdd[_0xab91('0x40')]['id'],'sectionId':_[_0xab91('0x2b')](_0x12c23e,function(_0x4f6cd3){return _0x4f6cd3['sectionId'];})},'transaction':_0x29c565})[_0xab91('0x20')](function(){var _0x1a524b=_[_0xab91('0x2b')](_0x12c23e,function(_0x4b3f34){_0x4b3f34[_0xab91('0x4d')]=_0x164bdd[_0xab91('0x40')]['id'];return _0x4b3f34;});var _0x19939a=[];return BPromise[_0xab91('0x4b')](_0x1a524b,function(_0x36eefe){return db[_0xab91('0x4f')]['create'](_0x36eefe,{'include':[{'model':db['UserProfileResource'],'as':_0xab91('0x4e')}],'raw':!![],'transaction':_0x29c565})['then'](function(_0x1342a2){_0x19939a[_0xab91('0x53')](_0x1342a2[_0xab91('0x44')]({'plain':!![]}));});})[_0xab91('0x20')](function(){return _0x19939a;});});});}})['then'](function(_0x59fe78){return _0x59fe78;})['then'](respondWithResult(_0x4ed860,null))[_0xab91('0x3e')](handleError(_0x4ed860,null));};exports[_0xab91('0x54')]=function(_0x1aa9cc,_0x337d9b){var _0x362806;return db['UserProfile'][_0xab91('0x42')]({'where':{'id':_0x1aa9cc[_0xab91('0x40')]['id']},'attributes':['id',_0xab91('0x23')]})[_0xab91('0x20')](handleEntityNotFound(_0x337d9b,null))[_0xab91('0x20')](function(_0x1b54c4){if(_0x1b54c4){_0x362806=_0x1b54c4;return db[_0xab91('0x4f')]['destroy']({'where':{'userProfileId':_0x1aa9cc['params']['id'],'sectionId':_0x1aa9cc[_0xab91('0x2c')][_0xab91('0x55')]}});}})[_0xab91('0x20')](function(){return _0x362806;})['then'](respondWithStatusCode(_0x337d9b,null))[_0xab91('0x3e')](handleError(_0x337d9b,null));};exports[_0xab91('0x56')]=function(_0x19e5e1,_0x253cc1){var _0x3ecd2e=[];var _0x48edc7=[];return db[_0xab91('0x4f')][_0xab91('0x3c')]({'where':{'userProfileId':_0x19e5e1['params']['id']},'raw':!![]})[_0xab91('0x20')](function(_0x1c6004){_0x3ecd2e=_[_0xab91('0x57')](_0x1c6004,function(_0xe697be){return _0xe697be['enabled']===0x1||_['includes']([0x3eb,0x709],_0xe697be[_0xab91('0x58')]);});if(!_[_0xab91('0x59')](_0x3ecd2e)){return _['map'](_0x3ecd2e,function(_0xc9fa4e){return _0xc9fa4e[_0xab91('0x58')];});}else{return;}})['then'](function(_0x1757b8){if(_0x1757b8)_0x48edc7=_0x1757b8;if(_['includes'](_0x48edc7,0x64)){var _0x11760f=_[_0xab91('0x42')](_0x3ecd2e,{'sectionId':0x64});return hasDefaultDashboard(_0x11760f)[_0xab91('0x20')](function(_0x109d61){return _[_0xab91('0x2b')](_0x3ecd2e,function(_0x51d6bd){if(_0x51d6bd[_0xab91('0x58')]===0x64){_0x51d6bd[_0xab91('0x5a')]=_0x109d61;}return _0x51d6bd;});});}else{return;}})[_0xab91('0x20')](function(_0x342984){if(_0x342984)_0x3ecd2e=_0x342984;if(_[_0xab91('0x5b')](_0x48edc7,0x3eb)){var _0x1a1e93=_['find'](_0x3ecd2e,{'sectionId':0x3eb});return getCustomDashboards(_0x1a1e93)[_0xab91('0x20')](function(_0x4aa74c){return _[_0xab91('0x2b')](_0x3ecd2e,function(_0x423b92){if(_0x1a1e93['enabled']){if(_0x423b92['sectionId']===0x3eb){_0x423b92[_0xab91('0x5a')]=_0x4aa74c;}}else{if(_0x423b92[_0xab91('0x58')]===0x64){_0x423b92[_0xab91('0x5a')]=_0x4aa74c;}}return _0x423b92;});});}else{return;}})[_0xab91('0x20')](function(_0x5655ab){if(_0x5655ab)_0x3ecd2e=_0x5655ab;if(_[_0xab91('0x5b')](_0x48edc7,0x709)){var _0x15601b=_[_0xab91('0x42')](_0x3ecd2e,{'sectionId':0x709});return getPlugins(_0x15601b)[_0xab91('0x20')](function(_0x459cb9){if(_0x15601b[_0xab91('0x5c')]){return _[_0xab91('0x2b')](_0x3ecd2e,function(_0x50f27a){if(_0x50f27a[_0xab91('0x58')]===0x709){_0x50f27a['subsections']=_0x459cb9;}return _0x50f27a;});}else{var _0x4dab10={'sectionId':0x76c,'enabled':0x1,'subsections':_0x459cb9};var _0x28efca=_['map'](_0x3ecd2e);_0x28efca[_0xab91('0x53')](_0x4dab10);return _0x28efca;}});}else{return;}})[_0xab91('0x20')](function(_0x5e0061){if(_0x5e0061)_0x3ecd2e=_0x5e0061;return _[_0xab91('0x57')](_0x3ecd2e,[_0xab91('0x5c'),0x1]);})[_0xab91('0x20')](respondWithResult(_0x253cc1,null))[_0xab91('0x3e')](handleError(_0x253cc1,null));};function hasDefaultDashboard(_0x420505){var _0x38f84a=[0x65];return new BPromise(function(_0x134120,_0x1784ed){try{if(_0x420505[_0xab91('0x4c')]){_0x134120(_0x38f84a);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x420505['id']},'raw':!![]})[_0xab91('0x20')](function(_0x129c38){_0x129c38?_0x134120(_0x38f84a):_0x134120();});}}catch(_0x439b8d){_0x1784ed(_0x439b8d);}});}function getCustomDashboards(_0x1a682e){var _0x12d90a=[];return new BPromise(function(_0x3f7f95,_0x4d79e7){try{if(_0x1a682e[_0xab91('0x4c')]){return db[_0xab91('0x5d')][_0xab91('0x3c')]({'raw':!![]})[_0xab91('0x20')](function(_0x5aea94){_0x5aea94[_0xab91('0x5e')](function(_0x594f5c){_0x12d90a['push'](_0x594f5c['id']+0x1869f);});_0x3f7f95(_0x12d90a);});}else{return db[_0xab91('0x50')]['findAll']({'where':{'sectionId':_0x1a682e['id']},'raw':!![]})[_0xab91('0x20')](function(_0x259c0c){_0x259c0c['forEach'](function(_0x252ebb){_0x12d90a[_0xab91('0x53')](_0x252ebb[_0xab91('0x5f')]+0x1869f);});_0x3f7f95(_0x12d90a);});}}catch(_0x333072){_0x4d79e7(_0x333072);}});}function getPlugins(_0x496990){var _0x18dc4b=[];return new BPromise(function(_0x576682,_0x29594e){try{if(_0x496990[_0xab91('0x4c')]){return db[_0xab91('0x60')]['findAll']({'raw':!![]})[_0xab91('0x20')](function(_0x576efe){_0x576efe[_0xab91('0x5e')](function(_0x5c80e0){_0x18dc4b[_0xab91('0x53')](_0x5c80e0['id']+0x15b38);});_0x576682(_0x18dc4b);});}else{return db[_0xab91('0x50')][_0xab91('0x3c')]({'where':{'sectionId':_0x496990['id']},'raw':!![]})['then'](function(_0x390083){_0x390083[_0xab91('0x5e')](function(_0xcba1ef){_0x18dc4b[_0xab91('0x53')](_0xcba1ef[_0xab91('0x5f')]+0x15b38);});_0x576682(_0x18dc4b);});}}catch(_0x339fd6){_0x29594e(_0x339fd6);}});}exports[_0xab91('0x61')]=function(_0x985210,_0x5a2bb2){return db[_0xab91('0x26')][_0xab91('0x42')]({'where':{'id':_0x985210[_0xab91('0x40')]['id']}})[_0xab91('0x20')](handleEntityNotFound(_0x5a2bb2,null))[_0xab91('0x20')](function(_0x120088){if(_0x120088){return db['sequelize'][_0xab91('0x49')](function(_0x4676d0){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x985210[_0xab91('0x40')]['id']},'attributes':['id'],'raw':!![]})[_0xab91('0x20')](function(_0x3167f0){if(_0x3167f0){return db[_0xab91('0x4f')]['destroy']({'where':{'userProfileId':_0x985210[_0xab91('0x40')]['id'],'id':_[_0xab91('0x2b')](_0x3167f0,function(_0x2e0749){return _0x2e0749['id'];})},'transaction':_0x4676d0});}})[_0xab91('0x20')](function(_0x40d63b){var _0x20f30e=_[_0xab91('0x2b')](_0x985210[_0xab91('0x43')],function(_0x2339e1){_0x2339e1[_0xab91('0x4d')]=_0x985210[_0xab91('0x40')]['id'];return _0x2339e1;});return db[_0xab91('0x4f')]['bulkCreate'](_0x20f30e,{'raw':!![],'transaction':_0x4676d0});})[_0xab91('0x20')](function(_0x4b5993){var _0x5bc4f5=_[_0xab91('0x57')](_[_0xab91('0x2b')](_0x4b5993,function(_0x585b00){return _0x585b00['get']({'plain':!![]});}),{'includeAll':![]});if(_0x5bc4f5){return db[_0xab91('0x4f')][_0xab91('0x3c')]({'where':{'userProfileId':_0x985210['params']['id'],'sectionId':_[_0xab91('0x2b')](_0x5bc4f5,function(_0x4ac5bd){return _0x4ac5bd[_0xab91('0x58')];})},'attributes':['id',_0xab91('0x58')],'raw':!![]})[_0xab91('0x20')](function(_0x5a8b1d){var _0x4a0ed6=_['map'](_0x985210[_0xab91('0x43')],function(_0x544ea8){_0x544ea8[_0xab91('0x4d')]=_0x985210[_0xab91('0x40')]['id'];return _0x544ea8;});return db['UserProfileResource']['bulkCreate'](_0x4a0ed6,{'raw':!![],'transaction':_0x4676d0});});}})['catch'](handleError(_0x5a2bb2,null));});}})[_0xab91('0x20')](function(_0x177968){var _0x506e58=_['map'](_0x177968,function(_0x25d7e9){return _0x25d7e9[_0xab91('0x44')]({'plain':!![]});});})[_0xab91('0x20')](respondWithResult(_0x5a2bb2,null))[_0xab91('0x3e')](handleError(_0x5a2bb2,null));};exports[_0xab91('0x62')]=function(_0x2b664e,_0x278971,_0x554db7){return db['UserProfile']['find']({'where':{'id':_0x2b664e[_0xab91('0x40')]['id']}})['then'](handleEntityNotFound(_0x278971,null))['then'](function(_0x51f9d0){if(_0x51f9d0){return _0x51f9d0['removeResources'](_0x2b664e['query'][_0xab91('0x55')]);}})[_0xab91('0x20')](respondWithStatusCode(_0x278971,null))[_0xab91('0x3e')](handleError(_0x278971,null));};exports['getResources']=function(_0x4fc2ad,_0x2b5ea9){var _0x1e3174={};if(!_0x4fc2ad[_0xab91('0x2c')][_0xab91('0x63')])throw new Error(_0xab91('0x64'));if(!_0x4fc2ad[_0xab91('0x2c')][_0xab91('0x65')](_0xab91('0x66'))){_0x1e3174[_0xab91('0x1a')]=qs[_0xab91('0x1a')](_0x4fc2ad[_0xab91('0x2c')][_0xab91('0x1a')]);_0x1e3174[_0xab91('0x1c')]=qs[_0xab91('0x1c')](_0x4fc2ad[_0xab91('0x2c')][_0xab91('0x1c')]);}return db[_0xab91('0x26')]['find']({'where':{'id':_0x4fc2ad['params']['id']}})[_0xab91('0x20')](function(_0x507a4e){if(!_0x507a4e)throw new Error(_0xab91('0x67')+_0x4fc2ad['params']['id']);return db[_0xab91('0x26')][_0xab91('0x68')](_0x4fc2ad);})['then'](respondWithFilteredResult(_0x2b5ea9,_0x1e3174))[_0xab91('0x3e')](handleError(_0x2b5ea9,null));}; \ No newline at end of file +var _0xd05a=['path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','index','map','UserProfile','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','transaction','each','autoAssociation','UserProfileResource','findAll','userProfileId','UserProfileSection','Resources','describe','sequelize','sectionId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','mustache','util'];(function(_0x643564,_0x2d61df){var _0x17d67d=function(_0x4307c6){while(--_0x4307c6){_0x643564['push'](_0x643564['shift']());}};_0x17d67d(++_0x2d61df);}(_0xd05a,0x143));var _0xad05=function(_0x29de21,_0x380a8f){_0x29de21=_0x29de21-0x0;var _0x1a60d8=_0xd05a[_0x29de21];return _0x1a60d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad05('0x0'));var zipdir=require(_0xad05('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xad05('0x2'));var util=require(_0xad05('0x3'));var path=require(_0xad05('0x4'));var sox=require(_0xad05('0x5'));var csv=require(_0xad05('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xad05('0x7'));var squel=require(_0xad05('0x8'));var crypto=require(_0xad05('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xad05('0xa'));var toCsv=require(_0xad05('0x6'));var querystring=require(_0xad05('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xad05('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xad05('0xd'));var hardwareService=require(_0xad05('0xe'));var logger=require(_0xad05('0xf'))(_0xad05('0x10'));var utils=require(_0xad05('0x11'));var config=require(_0xad05('0x12'));var licenseUtil=require(_0xad05('0x13'));var db=require(_0xad05('0x14'))['db'];config[_0xad05('0x15')]=_[_0xad05('0x16')](config['redis'],{'host':_0xad05('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xad05('0x15')]));require('./userProfile.socket')[_0xad05('0x18')](socket);function respondWithStatusCode(_0x24da60,_0x44a508){_0x44a508=_0x44a508||0xcc;return function(_0x50609d){if(_0x50609d){return _0x24da60[_0xad05('0x19')](_0x44a508);}return _0x24da60['status'](_0x44a508)[_0xad05('0x1a')]();};}function respondWithResult(_0x2bf8e9,_0x29c296){_0x29c296=_0x29c296||0xc8;return function(_0x3d7eda){if(_0x3d7eda){return _0x2bf8e9[_0xad05('0x1b')](_0x29c296)[_0xad05('0x1c')](_0x3d7eda);}};}function respondWithFilteredResult(_0x534b28,_0x30d013){return function(_0x6c363b){if(_0x6c363b){var _0x9dc4d3=typeof _0x30d013[_0xad05('0x1d')]===_0xad05('0x1e')&&typeof _0x30d013[_0xad05('0x1f')]===_0xad05('0x1e');var _0x4578af=_0x6c363b[_0xad05('0x20')];var _0x2a7e2f=_0x9dc4d3?0x0:_0x30d013[_0xad05('0x1d')];var _0x530ce3=_0x9dc4d3?_0x6c363b[_0xad05('0x20')]:_0x30d013[_0xad05('0x1d')]+_0x30d013[_0xad05('0x1f')];var _0x5e6354;if(_0x530ce3>=_0x4578af){_0x530ce3=_0x4578af;_0x5e6354=0xc8;}else{_0x5e6354=0xce;}_0x534b28[_0xad05('0x1b')](_0x5e6354);return _0x534b28['set'](_0xad05('0x21'),_0x2a7e2f+'-'+_0x530ce3+'/'+_0x4578af)[_0xad05('0x1c')](_0x6c363b);}return null;};}function patchUpdates(_0x46a3be){return function(_0x37ddb5){try{jsonpatch[_0xad05('0x22')](_0x37ddb5,_0x46a3be,!![]);}catch(_0x1fdc81){return BPromise[_0xad05('0x23')](_0x1fdc81);}return _0x37ddb5[_0xad05('0x24')]();};}function saveUpdates(_0x33c97e,_0x422698){return function(_0x545637){if(_0x545637){return _0x545637[_0xad05('0x25')](_0x33c97e)[_0xad05('0x26')](function(_0x2a4620){return _0x2a4620;});}return null;};}function removeEntity(_0x2b515d,_0x48d25f){return function(_0x391bf0){if(_0x391bf0){return _0x391bf0[_0xad05('0x27')]()[_0xad05('0x26')](function(){_0x2b515d[_0xad05('0x1b')](0xcc)[_0xad05('0x1a')]();});}};}function handleEntityNotFound(_0x206abc,_0x44d8d4){return function(_0x5c04f3){if(!_0x5c04f3){_0x206abc['sendStatus'](0x194);}return _0x5c04f3;};}function handleError(_0x264287,_0x32953a){_0x32953a=_0x32953a||0x1f4;return function(_0x91ed1d){logger['error'](_0x91ed1d['stack']);if(_0x91ed1d[_0xad05('0x28')]){delete _0x91ed1d[_0xad05('0x28')];}_0x264287[_0xad05('0x1b')](_0x32953a)['send'](_0x91ed1d);};}exports[_0xad05('0x29')]=function(_0xcfea8c,_0x594ea3){var _0x206a17={},_0x19b9f1={},_0x203158={'count':0x0,'rows':[]};var _0x36face=_[_0xad05('0x2a')](db[_0xad05('0x2b')][_0xad05('0x2c')],function(_0x5ea097){return{'name':_0x5ea097[_0xad05('0x2d')],'type':_0x5ea097[_0xad05('0x2e')]['key']};});_0x19b9f1[_0xad05('0x2f')]=_[_0xad05('0x2a')](_0x36face,'name');_0x19b9f1[_0xad05('0x30')]=_[_0xad05('0x31')](_0xcfea8c[_0xad05('0x30')]);_0x19b9f1[_0xad05('0x32')]=_[_0xad05('0x33')](_0x19b9f1[_0xad05('0x2f')],_0x19b9f1[_0xad05('0x30')]);_0x206a17[_0xad05('0x34')]=_[_0xad05('0x33')](_0x19b9f1[_0xad05('0x2f')],qs[_0xad05('0x35')](_0xcfea8c['query']['fields']));_0x206a17['attributes']=_0x206a17['attributes'][_0xad05('0x36')]?_0x206a17[_0xad05('0x34')]:_0x19b9f1[_0xad05('0x2f')];if(!_0xcfea8c[_0xad05('0x30')]['hasOwnProperty'](_0xad05('0x37'))){_0x206a17[_0xad05('0x1f')]=qs[_0xad05('0x1f')](_0xcfea8c[_0xad05('0x30')]['limit']);_0x206a17[_0xad05('0x1d')]=qs['offset'](_0xcfea8c[_0xad05('0x30')][_0xad05('0x1d')]);}_0x206a17[_0xad05('0x38')]=qs['sort'](_0xcfea8c[_0xad05('0x30')][_0xad05('0x39')]);_0x206a17[_0xad05('0x3a')]=qs[_0xad05('0x32')](_[_0xad05('0x3b')](_0xcfea8c[_0xad05('0x30')],_0x19b9f1[_0xad05('0x32')]),_0x36face);if(_0xcfea8c[_0xad05('0x30')]['filter']){_0x206a17[_0xad05('0x3a')]=_[_0xad05('0x3c')](_0x206a17[_0xad05('0x3a')],{'$or':_[_0xad05('0x2a')](_0x36face,function(_0x4655cb){if(_0x4655cb[_0xad05('0x2e')]!==_0xad05('0x3d')){var _0x1ccfde={};_0x1ccfde[_0x4655cb[_0xad05('0x28')]]={'$like':'%'+_0xcfea8c['query'][_0xad05('0x3e')]+'%'};return _0x1ccfde;}})});}_0x206a17=_[_0xad05('0x3c')]({},_0x206a17,_0xcfea8c[_0xad05('0x3f')]);var _0x26bd70={'where':_0x206a17[_0xad05('0x3a')]};return db[_0xad05('0x2b')][_0xad05('0x20')](_0x26bd70)[_0xad05('0x26')](function(_0x4cfcf0){_0x203158[_0xad05('0x20')]=_0x4cfcf0;if(_0xcfea8c[_0xad05('0x30')]['includeAll']){_0x206a17[_0xad05('0x40')]=[{'all':!![]}];}return db[_0xad05('0x2b')]['findAll'](_0x206a17);})[_0xad05('0x26')](function(_0x21007b){_0x203158[_0xad05('0x41')]=_0x21007b;return _0x203158;})['then'](respondWithFilteredResult(_0x594ea3,_0x206a17))[_0xad05('0x42')](handleError(_0x594ea3,null));};exports[_0xad05('0x43')]=function(_0x14fc94,_0x41fbd0){var _0x513ecb={'raw':![],'where':{'id':_0x14fc94[_0xad05('0x44')]['id']}},_0x26c338={};_0x26c338[_0xad05('0x2f')]=_[_0xad05('0x31')](db[_0xad05('0x2b')]['rawAttributes']);_0x26c338[_0xad05('0x30')]=_[_0xad05('0x31')](_0x14fc94[_0xad05('0x30')]);_0x26c338['filters']=_[_0xad05('0x33')](_0x26c338[_0xad05('0x2f')],_0x26c338[_0xad05('0x30')]);_0x513ecb[_0xad05('0x34')]=_[_0xad05('0x33')](_0x26c338[_0xad05('0x2f')],qs[_0xad05('0x35')](_0x14fc94['query'][_0xad05('0x35')]));_0x513ecb['attributes']=_0x513ecb[_0xad05('0x34')][_0xad05('0x36')]?_0x513ecb[_0xad05('0x34')]:_0x26c338[_0xad05('0x2f')];if(_0x14fc94[_0xad05('0x30')][_0xad05('0x45')]){_0x513ecb[_0xad05('0x40')]=[{'all':!![]}];}_0x513ecb=_[_0xad05('0x3c')]({},_0x513ecb,_0x14fc94[_0xad05('0x3f')]);return db[_0xad05('0x2b')][_0xad05('0x46')](_0x513ecb)[_0xad05('0x26')](handleEntityNotFound(_0x41fbd0,null))[_0xad05('0x26')](respondWithResult(_0x41fbd0,null))[_0xad05('0x42')](handleError(_0x41fbd0,null));};exports[_0xad05('0x47')]=function(_0x56d036,_0x3e61a4){return db[_0xad05('0x2b')][_0xad05('0x47')](_0x56d036[_0xad05('0x48')],{})[_0xad05('0x26')](respondWithResult(_0x3e61a4,0xc9))['catch'](handleError(_0x3e61a4,null));};exports[_0xad05('0x49')]=function(_0x540a4f,_0x5b7d80){var _0x2164e7={'where':{'id':_0x540a4f[_0xad05('0x44')]['id']}},_0x4ceb17={};_0x4ceb17['model']=_['keys'](db['UserProfile'][_0xad05('0x2c')]);_0x2164e7['attributes']=_[_0xad05('0x33')](_0x4ceb17[_0xad05('0x2f')],qs[_0xad05('0x35')](_0x540a4f['query'][_0xad05('0x35')]));_0x2164e7[_0xad05('0x34')]=_0x2164e7['attributes'][_0xad05('0x36')]?_0x2164e7[_0xad05('0x34')]:_0x4ceb17['model'];if(_0x540a4f[_0xad05('0x30')]['includeAll']){_0x2164e7['include']=[{'all':!![]}];}_0x2164e7=_[_0xad05('0x3c')]({},_0x2164e7,_0x540a4f[_0xad05('0x3f')]);return db[_0xad05('0x2b')][_0xad05('0x46')](_0x2164e7)[_0xad05('0x26')](handleEntityNotFound(_0x5b7d80,null))[_0xad05('0x26')](function(_0x1cc306){if(_0x1cc306){var _0x21883b=_0x1cc306[_0xad05('0x4a')]({'plain':!![]});_0x21883b=qs[_0xad05('0x4b')](_0x21883b,['id',_0xad05('0x4c'),_0xad05('0x4d'),_0xad05('0x4e')]);_0x540a4f['body']=_[_0xad05('0x4b')](_0x540a4f[_0xad05('0x48')],['id','createdAt',_0xad05('0x4d')]);return db['sequelize'][_0xad05('0x4f')](function(_0xd4d00f){return db[_0xad05('0x2b')][_0xad05('0x47')](_[_0xad05('0x3c')](_0x21883b,_0x540a4f['body']),{'include':_0x540a4f['query'][_0xad05('0x45')]?[{'all':!![]}]:undefined,'transaction':_0xd4d00f})[_0xad05('0x26')](function(_0x4fcdd5){var _0x2604f1=_0x4fcdd5[_0xad05('0x4a')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x540a4f[_0xad05('0x44')]['id']},'raw':!![]})[_0xad05('0x26')](function(_0x59c8c5){if(_0x59c8c5){return BPromise[_0xad05('0x50')](_0x59c8c5,function(_0x670d2d){return new BPromise(function(_0x1e10e8,_0x49c73a){if(_0x670d2d[_0xad05('0x51')]===null||_0x670d2d[_0xad05('0x51')]===0x1)_0x1e10e8(null);return db[_0xad05('0x52')][_0xad05('0x53')]({'where':{'sectionId':_0x670d2d['id']},'raw':!![]})[_0xad05('0x26')](function(_0x39ea3f){var _0x350e6f=_[_0xad05('0x2a')](_0x39ea3f,function(_0x44f659){return qs[_0xad05('0x4b')](_0x44f659,['id',_0xad05('0x4c'),_0xad05('0x4d'),'sectionId']);});_0x1e10e8(_0x350e6f);})[_0xad05('0x42')](function(_0x4b4907){_0x49c73a(_0x4b4907);});})[_0xad05('0x26')](function(_0x2f80da){var _0x251256=qs[_0xad05('0x4b')](_0x670d2d,['id',_0xad05('0x4c'),_0xad05('0x4d')]);_0x251256[_0xad05('0x54')]=_0x2604f1['id'];if(_0x2f80da)_0x251256['Resources']=_0x2f80da;return _0x251256;})[_0xad05('0x26')](function(_0x5071ed){return db[_0xad05('0x55')][_0xad05('0x47')](_0x5071ed,{'include':[{'model':db['UserProfileResource'],'as':_0xad05('0x56')}],'raw':!![],'transaction':_0xd4d00f});});})[_0xad05('0x26')](function(){return _0x2604f1;});}});});});}})[_0xad05('0x26')](respondWithResult(_0x5b7d80,0xc9))['catch'](handleError(_0x5b7d80,null));};exports[_0xad05('0x25')]=function(_0x292c9b,_0x3d4ce9){if(_0x292c9b['body']['id']){delete _0x292c9b[_0xad05('0x48')]['id'];}return db['UserProfile'][_0xad05('0x46')]({'where':{'id':_0x292c9b[_0xad05('0x44')]['id']}})[_0xad05('0x26')](handleEntityNotFound(_0x3d4ce9,null))['then'](saveUpdates(_0x292c9b[_0xad05('0x48')],null))['then'](respondWithResult(_0x3d4ce9,null))[_0xad05('0x42')](handleError(_0x3d4ce9,null));};exports[_0xad05('0x27')]=function(_0x3fe887,_0x2ac74a){return db['UserProfile'][_0xad05('0x46')]({'where':{'id':_0x3fe887[_0xad05('0x44')]['id']}})[_0xad05('0x26')](handleEntityNotFound(_0x2ac74a,null))[_0xad05('0x26')](removeEntity(_0x2ac74a,null))['catch'](handleError(_0x2ac74a,null));};exports[_0xad05('0x57')]=function(_0x3df464,_0x4f6e91){return db['UserProfile']['describe']()[_0xad05('0x26')](respondWithResult(_0x4f6e91,null))['catch'](handleError(_0x4f6e91,null));};exports['addSections']=function(_0x51f805,_0x5abf6b){var _0x278d1e=_0x51f805['body'];return db[_0xad05('0x2b')]['find']({'where':{'id':_0x51f805[_0xad05('0x44')]['id']}})[_0xad05('0x26')](handleEntityNotFound(_0x5abf6b,null))['then'](function(_0x2d1d83){if(_0x2d1d83){return db[_0xad05('0x58')][_0xad05('0x4f')](function(_0x1b1508){return db[_0xad05('0x55')][_0xad05('0x27')]({'where':{'userProfileId':_0x51f805['params']['id'],'sectionId':_[_0xad05('0x2a')](_0x278d1e,function(_0x3fd5b0){return _0x3fd5b0[_0xad05('0x59')];})},'transaction':_0x1b1508})['then'](function(){var _0x29a0f4=_['map'](_0x278d1e,function(_0x5b5a13){_0x5b5a13[_0xad05('0x54')]=_0x51f805[_0xad05('0x44')]['id'];return _0x5b5a13;});var _0x1786b4=[];return BPromise[_0xad05('0x50')](_0x29a0f4,function(_0x3200a9){return db[_0xad05('0x55')][_0xad05('0x47')](_0x3200a9,{'include':[{'model':db[_0xad05('0x52')],'as':'Resources'}],'raw':!![],'transaction':_0x1b1508})[_0xad05('0x26')](function(_0x4f1117){_0x1786b4[_0xad05('0x5a')](_0x4f1117[_0xad05('0x4a')]({'plain':!![]}));});})[_0xad05('0x26')](function(){return _0x1786b4;});});});}})[_0xad05('0x26')](function(_0xfdec36){return _0xfdec36;})[_0xad05('0x26')](respondWithResult(_0x5abf6b,null))[_0xad05('0x42')](handleError(_0x5abf6b,null));};exports[_0xad05('0x5b')]=function(_0xb79167,_0x5814e9){var _0x47680d;return db[_0xad05('0x2b')]['find']({'where':{'id':_0xb79167[_0xad05('0x44')]['id']},'attributes':['id',_0xad05('0x28')]})[_0xad05('0x26')](handleEntityNotFound(_0x5814e9,null))[_0xad05('0x26')](function(_0x35e985){if(_0x35e985){_0x47680d=_0x35e985;return db[_0xad05('0x55')][_0xad05('0x27')]({'where':{'userProfileId':_0xb79167['params']['id'],'sectionId':_0xb79167[_0xad05('0x30')][_0xad05('0x5c')]}});}})[_0xad05('0x26')](function(){return _0x47680d;})[_0xad05('0x26')](respondWithStatusCode(_0x5814e9,null))[_0xad05('0x42')](handleError(_0x5814e9,null));};exports[_0xad05('0x5d')]=function(_0x17b4e1,_0x4410c6){var _0x233870=[];var _0x39d656=[];return db[_0xad05('0x55')][_0xad05('0x53')]({'where':{'userProfileId':_0x17b4e1[_0xad05('0x44')]['id']},'raw':!![]})[_0xad05('0x26')](function(_0x318c5d){_0x233870=_[_0xad05('0x3e')](_0x318c5d,function(_0x5e117e){return _0x5e117e[_0xad05('0x5e')]===0x1||_[_0xad05('0x5f')]([0x3eb,0x709],_0x5e117e[_0xad05('0x59')]);});if(!_[_0xad05('0x60')](_0x233870)){return _[_0xad05('0x2a')](_0x233870,function(_0x19086f){return _0x19086f['sectionId'];});}else{return;}})[_0xad05('0x26')](function(_0x4152c2){if(_0x4152c2)_0x39d656=_0x4152c2;if(_[_0xad05('0x5f')](_0x39d656,0x64)){var _0x2682dc=_[_0xad05('0x46')](_0x233870,{'sectionId':0x64});return hasDefaultDashboard(_0x2682dc)[_0xad05('0x26')](function(_0xdd7134){return _[_0xad05('0x2a')](_0x233870,function(_0xd95d11){if(_0xd95d11[_0xad05('0x59')]===0x64){_0xd95d11[_0xad05('0x61')]=_0xdd7134;}return _0xd95d11;});});}else{return;}})['then'](function(_0x26bd2c){if(_0x26bd2c)_0x233870=_0x26bd2c;if(_[_0xad05('0x5f')](_0x39d656,0x3eb)){var _0x82dd58=_['find'](_0x233870,{'sectionId':0x3eb});return getCustomDashboards(_0x82dd58)[_0xad05('0x26')](function(_0x290a89){return _[_0xad05('0x2a')](_0x233870,function(_0x191b77){if(_0x82dd58['enabled']){if(_0x191b77[_0xad05('0x59')]===0x3eb){_0x191b77[_0xad05('0x61')]=_0x290a89;}}else{if(_0x191b77[_0xad05('0x59')]===0x64){_0x191b77[_0xad05('0x61')]=_0x290a89;}}return _0x191b77;});});}else{return;}})[_0xad05('0x26')](function(_0x2ac7fa){if(_0x2ac7fa)_0x233870=_0x2ac7fa;if(_[_0xad05('0x5f')](_0x39d656,0x709)){var _0x18fff1=_[_0xad05('0x46')](_0x233870,{'sectionId':0x709});return getPlugins(_0x18fff1)[_0xad05('0x26')](function(_0x374226){if(_0x18fff1[_0xad05('0x5e')]){return _['map'](_0x233870,function(_0x2fd57f){if(_0x2fd57f['sectionId']===0x709){_0x2fd57f[_0xad05('0x61')]=_0x374226;}return _0x2fd57f;});}else{var _0x68f303={'sectionId':0x76c,'enabled':0x1,'subsections':_0x374226};var _0x5d9ad3=_[_0xad05('0x2a')](_0x233870);_0x5d9ad3[_0xad05('0x5a')](_0x68f303);return _0x5d9ad3;}});}else{return;}})[_0xad05('0x26')](function(_0x33813e){if(_0x33813e)_0x233870=_0x33813e;return _['filter'](_0x233870,[_0xad05('0x5e'),0x1]);})[_0xad05('0x26')](respondWithResult(_0x4410c6,null))[_0xad05('0x42')](handleError(_0x4410c6,null));};function hasDefaultDashboard(_0x415ce5){var _0x8dbb9a=[0x65];return new BPromise(function(_0x494eae,_0x120ee1){try{if(_0x415ce5[_0xad05('0x51')]){_0x494eae(_0x8dbb9a);}else{return db[_0xad05('0x52')][_0xad05('0x62')]({'where':{'sectionId':_0x415ce5['id']},'raw':!![]})[_0xad05('0x26')](function(_0xecffd2){_0xecffd2?_0x494eae(_0x8dbb9a):_0x494eae();});}}catch(_0x5a9f98){_0x120ee1(_0x5a9f98);}});}function getCustomDashboards(_0x521ee0){var _0x58ed8b=[];return new BPromise(function(_0x597a77,_0x15434a){try{if(_0x521ee0[_0xad05('0x51')]){return db[_0xad05('0x63')][_0xad05('0x53')]({'raw':!![]})[_0xad05('0x26')](function(_0x389c7a){_0x389c7a[_0xad05('0x64')](function(_0xb536f4){_0x58ed8b[_0xad05('0x5a')](_0xb536f4['id']+0x1869f);});_0x597a77(_0x58ed8b);});}else{return db['UserProfileResource'][_0xad05('0x53')]({'where':{'sectionId':_0x521ee0['id']},'raw':!![]})[_0xad05('0x26')](function(_0x42ec49){_0x42ec49[_0xad05('0x64')](function(_0x8a615f){_0x58ed8b[_0xad05('0x5a')](_0x8a615f['resourceId']+0x1869f);});_0x597a77(_0x58ed8b);});}}catch(_0x346ba1){_0x15434a(_0x346ba1);}});}function getPlugins(_0x172302){var _0x2d4e76=[];return new BPromise(function(_0x32dfa7,_0x105930){try{if(_0x172302['autoAssociation']){return db[_0xad05('0x65')][_0xad05('0x53')]({'raw':!![]})['then'](function(_0xd7b3b1){_0xd7b3b1[_0xad05('0x64')](function(_0x37b99c){_0x2d4e76[_0xad05('0x5a')](_0x37b99c['id']+0x15b38);});_0x32dfa7(_0x2d4e76);});}else{return db[_0xad05('0x52')]['findAll']({'where':{'sectionId':_0x172302['id']},'raw':!![]})['then'](function(_0x4b0105){_0x4b0105['forEach'](function(_0x510b99){_0x2d4e76[_0xad05('0x5a')](_0x510b99[_0xad05('0x66')]+0x15b38);});_0x32dfa7(_0x2d4e76);});}}catch(_0x5a63ad){_0x105930(_0x5a63ad);}});}exports[_0xad05('0x67')]=function(_0x29059a,_0x4088bc){return db[_0xad05('0x2b')][_0xad05('0x46')]({'where':{'id':_0x29059a['params']['id']}})[_0xad05('0x26')](handleEntityNotFound(_0x4088bc,null))[_0xad05('0x26')](function(_0x495df8){if(_0x495df8){return db['sequelize'][_0xad05('0x4f')](function(_0x5c4531){return db[_0xad05('0x55')][_0xad05('0x53')]({'where':{'userProfileId':_0x29059a[_0xad05('0x44')]['id']},'attributes':['id'],'raw':!![]})[_0xad05('0x26')](function(_0x13cc9b){if(_0x13cc9b){return db['UserProfileSection'][_0xad05('0x27')]({'where':{'userProfileId':_0x29059a[_0xad05('0x44')]['id'],'id':_['map'](_0x13cc9b,function(_0x41057f){return _0x41057f['id'];})},'transaction':_0x5c4531});}})[_0xad05('0x26')](function(_0x163d5f){var _0x204239=_[_0xad05('0x2a')](_0x29059a[_0xad05('0x48')],function(_0x39f7ec){_0x39f7ec[_0xad05('0x54')]=_0x29059a[_0xad05('0x44')]['id'];return _0x39f7ec;});return db[_0xad05('0x55')]['bulkCreate'](_0x204239,{'raw':!![],'transaction':_0x5c4531});})[_0xad05('0x26')](function(_0x310dfc){var _0x305676=_[_0xad05('0x3e')](_['map'](_0x310dfc,function(_0x13244d){return _0x13244d[_0xad05('0x4a')]({'plain':!![]});}),{'includeAll':![]});if(_0x305676){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x29059a[_0xad05('0x44')]['id'],'sectionId':_[_0xad05('0x2a')](_0x305676,function(_0x110376){return _0x110376['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0xad05('0x26')](function(_0x103d73){var _0x606772=_[_0xad05('0x2a')](_0x29059a[_0xad05('0x48')],function(_0x2cefda){_0x2cefda[_0xad05('0x54')]=_0x29059a['params']['id'];return _0x2cefda;});return db['UserProfileResource'][_0xad05('0x68')](_0x606772,{'raw':!![],'transaction':_0x5c4531});});}})[_0xad05('0x42')](handleError(_0x4088bc,null));});}})[_0xad05('0x26')](function(_0x206ac8){var _0x5f5062=_[_0xad05('0x2a')](_0x206ac8,function(_0xa11296){return _0xa11296['get']({'plain':!![]});});})[_0xad05('0x26')](respondWithResult(_0x4088bc,null))['catch'](handleError(_0x4088bc,null));};exports['removeResources']=function(_0x86a5a7,_0x405905,_0x17d2a1){return db[_0xad05('0x2b')][_0xad05('0x46')]({'where':{'id':_0x86a5a7[_0xad05('0x44')]['id']}})[_0xad05('0x26')](handleEntityNotFound(_0x405905,null))[_0xad05('0x26')](function(_0x5e7a7e){if(_0x5e7a7e){return _0x5e7a7e['removeResources'](_0x86a5a7[_0xad05('0x30')][_0xad05('0x5c')]);}})[_0xad05('0x26')](respondWithStatusCode(_0x405905,null))[_0xad05('0x42')](handleError(_0x405905,null));};exports[_0xad05('0x69')]=function(_0x6df81e,_0xd561e4){var _0x3f0536={};if(!_0x6df81e[_0xad05('0x30')][_0xad05('0x6a')])throw new Error(_0xad05('0x6b'));if(!_0x6df81e['query']['hasOwnProperty']('nolimit')){_0x3f0536[_0xad05('0x1f')]=qs[_0xad05('0x1f')](_0x6df81e[_0xad05('0x30')][_0xad05('0x1f')]);_0x3f0536['offset']=qs[_0xad05('0x1d')](_0x6df81e[_0xad05('0x30')][_0xad05('0x1d')]);}return db[_0xad05('0x2b')][_0xad05('0x46')]({'where':{'id':_0x6df81e[_0xad05('0x44')]['id']}})[_0xad05('0x26')](function(_0x8a656){if(!_0x8a656)throw new Error(_0xad05('0x6c')+_0x6df81e['params']['id']);return db[_0xad05('0x2b')][_0xad05('0x69')](_0x6df81e);})[_0xad05('0x26')](respondWithFilteredResult(_0xd561e4,_0x3f0536))['catch'](handleError(_0xd561e4,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index d8f8d61..ec0e7da 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 _0xfbbb=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save'];(function(_0x195fb7,_0x477bf3){var _0xd6a1e9=function(_0x460d19){while(--_0x460d19){_0x195fb7['push'](_0x195fb7['shift']());}};_0xd6a1e9(++_0x477bf3);}(_0xfbbb,0x1b3));var _0xbfbb=function(_0x335522,_0x3745ce){_0x335522=_0x335522-0x0;var _0x63f13c=_0xfbbb[_0x335522];return _0x63f13c;};'use strict';var EventEmitter=require(_0xbfbb('0x0'));var UserProfile=require(_0xbfbb('0x1'))['db'][_0xbfbb('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xbfbb('0x3')](0x0);var events={'afterCreate':_0xbfbb('0x4'),'afterUpdate':_0xbfbb('0x5'),'afterDestroy':_0xbfbb('0x6')};function emitEvent(_0x45a353){return function(_0x1d94cd,_0x509549,_0x5dff98){UserProfileEvents[_0xbfbb('0x7')](_0x45a353+':'+_0x1d94cd['id'],_0x1d94cd);UserProfileEvents['emit'](_0x45a353,_0x1d94cd);_0x5dff98(null);};}for(var e in events){if(events[_0xbfbb('0x8')](e)){var event=events[e];UserProfile[_0xbfbb('0x9')](e,emitEvent(event));}}module[_0xbfbb('0xa')]=UserProfileEvents; \ No newline at end of file +var _0x2272=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners'];(function(_0xcb19e1,_0x465489){var _0x121872=function(_0x5c9cd1){while(--_0x5c9cd1){_0xcb19e1['push'](_0xcb19e1['shift']());}};_0x121872(++_0x465489);}(_0x2272,0xd8));var _0x2227=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2272[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0x2227('0x0'));var UserProfile=require(_0x2227('0x1'))['db'][_0x2227('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x2227('0x3')](0x0);var events={'afterCreate':_0x2227('0x4'),'afterUpdate':'update','afterDestroy':_0x2227('0x5')};function emitEvent(_0x3bb7ba){return function(_0x1f5a4a,_0x4c17c2,_0x4ebde3){UserProfileEvents[_0x2227('0x6')](_0x3bb7ba+':'+_0x1f5a4a['id'],_0x1f5a4a);UserProfileEvents[_0x2227('0x6')](_0x3bb7ba,_0x1f5a4a);_0x4ebde3(null);};}for(var e in events){if(events[_0x2227('0x7')](e)){var event=events[e];UserProfile[_0x2227('0x8')](e,emitEvent(event));}}module[_0x2227('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 0e9da25..456a11c 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 _0x90b1=['tags','Tag','templates','Template','Trigger','trunks','Trunk','Variable','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','select','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','OpenTabs','define','UserProfile','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','ignore','union','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','merge','options','includeAll','include','default','DefaultReports','custom','CustomReports','count','rows','CmContact','color','tag','ThroughTags','openTabs','true','chat','dataValues','fax','openchannel','all','lodash','./userProfile.attributes','../../components/parsers/qs','models','filter','field','value','findAll','associatedResources','map','catch','model','then','name','resolve','UserProfileResource','resourceId','toLowerCase','squareprojects','odbc','childModel','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','lists','companies','CmCompany','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','membername','User','role','Telephones','VoiceQueues','queue','type','inbound','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailAccount','mailsubstatuses','openchannelaccounts','smsqueues','SmsQueue','SmsAccount','whatsappaccounts','WhatsappAccount','voicequeues','queuecampaigns','VoiceQueue','QueueCampaigns','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','Sound'];(function(_0x2c16ab,_0xaa3f47){var _0x50d50c=function(_0x4bd914){while(--_0x4bd914){_0x2c16ab['push'](_0x2c16ab['shift']());}};_0x50d50c(++_0xaa3f47);}(_0x90b1,0x1bb));var _0x190b=function(_0x36609a,_0x316990){_0x36609a=_0x36609a-0x0;var _0x1a7b26=_0x90b1[_0x36609a];return _0x1a7b26;};'use strict';var _=require(_0x190b('0x0'));var attributes=require(_0x190b('0x1'));var qs=require(_0x190b('0x2'));var squel=require('squel');module['exports']=function(_0x1e5984){var _0x44ca85=_0x1e5984[_0x190b('0x3')];function _0x120ddc(_0x4fbcad,_0x4c355f){return new Promise(function(_0x5cbebb,_0x5da9c1){if(!_0x4c355f)return _0x5cbebb(null);var _0x27ff8c=_0x4c355f[_0x190b('0x4')]?{[_0x4c355f[_0x190b('0x4')][_0x190b('0x5')]]:_0x4c355f[_0x190b('0x4')][_0x190b('0x6')]}:undefined;return _0x44ca85[_0x4fbcad][_0x190b('0x7')]({'where':_0x27ff8c,'raw':!![]})['then'](function(_0x14b93d){_0x4c355f[_0x190b('0x8')]=_[_0x190b('0x9')](_0x14b93d,'id');_0x5cbebb(_0x4c355f);})[_0x190b('0xa')](function(_0x41b788){_0x5da9c1(_0x41b788);});});}function _0x409aa3(_0x3e99a3,_0x1da225){return new Promise(function(_0x5d6497,_0xb3f47b){var _0x5cf995=_0x3e99a3['filter']?{[_0x3e99a3[_0x190b('0x4')][_0x190b('0x5')]]:_0x3e99a3[_0x190b('0x4')][_0x190b('0x6')]}:undefined;return _0x44ca85[_0x3e99a3[_0x190b('0xb')]][_0x190b('0x7')]({'where':_0x5cf995,'raw':!![]})[_0x190b('0xc')](function(_0x13544c){_0x1da225[_0x190b('0x8')]=_[_0x190b('0x9')](_0x13544c,function(_0x186941){return _0x186941[_0x190b('0xd')];});_0x5d6497(_0x1da225);})[_0x190b('0xa')](function(_0x3e8781){_0xb3f47b(_0x3e8781);});});}function _0x3fbfc3(_0x121867,_0x1b4f4c,_0x5c63d9){if(!_0x1b4f4c)return Promise[_0x190b('0xe')](null);return new Promise(function(_0x5efbed,_0x2a9323){return _0x44ca85[_0x190b('0xf')][_0x190b('0x7')]({'where':{'sectionId':_0x1b4f4c['id']},'raw':!![]})[_0x190b('0xc')](function(_0x50a3c4){if(_0x121867[_0x190b('0x5')]&&_0x121867[_0x190b('0x5')]!=='id'){_0x1b4f4c[_0x190b('0x8')]=_[_0x190b('0x9')](_0x50a3c4,function(_0x1b5427){return _0x1b5427[_0x121867[_0x190b('0x5')]];});}else{if(_0x5c63d9==='AnalyticExtractedReport'){_0x1b4f4c[_0x190b('0x8')]=_[_0x190b('0x9')](_0x50a3c4,function(_0x5092dd){return{'id':_0x5092dd[_0x190b('0x10')],'type':_0x5092dd['type']};});}else{_0x1b4f4c['associatedResources']=_[_0x190b('0x9')](_0x50a3c4,function(_0x42e7f2){return _0x42e7f2[_0x190b('0x10')];});}}_0x5efbed(_0x1b4f4c);})['catch'](function(_0x37465e){_0x2a9323(_0x37465e);});});}function _0x2e633e(_0x16e989,_0x292ce3){var _0x3b8c74={'parentSections':[]};switch(_0x16e989[_0x190b('0x11')]()){case _0x190b('0x12'):_0x3b8c74['childModel']='SquareProject';break;case _0x190b('0x13'):_0x3b8c74[_0x190b('0x14')]='SquareOdbc';break;case'squarerecordings':_0x3b8c74[_0x190b('0x14')]='SquareRecording';_0x3b8c74[_0x190b('0x15')]=[{'name':_0x190b('0x16'),'field':'name','foreignKey':_0x190b('0x17')}];break;case _0x190b('0x18'):_0x3b8c74['childModel']=_0x190b('0x19');break;case _0x190b('0x1a'):_0x3b8c74[_0x190b('0x14')]='CmContact';_0x3b8c74['parentSections']=[{'name':_0x190b('0x1b'),'field':'id','foreignKey':'ListId'}];break;case _0x190b('0x1c'):_0x3b8c74[_0x190b('0x14')]='CmList';break;case _0x190b('0x1d'):_0x3b8c74['childModel']=_0x190b('0x1e');break;case'globalcustomfields':_0x3b8c74[_0x190b('0x14')]='CmCustomField';break;case _0x190b('0x1f'):_0x3b8c74[_0x190b('0x14')]='ChatQueue';break;case _0x190b('0x20'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x21');break;case _0x190b('0x22'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x23');break;case _0x190b('0x24'):_0x3b8c74[_0x190b('0x14')]='FaxAccount';break;case'inboundroutes':case _0x190b('0x25'):case _0x190b('0x26'):_0x3b8c74['childModel']=_0x190b('0x27');break;case _0x190b('0x28'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x29');break;case _0x190b('0x2a'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x2b');break;case'voicerecordings':_0x3b8c74['childModel']=_0x190b('0x2c');_0x3b8c74[_0x190b('0x15')]=[{'name':_0x190b('0x2d'),'field':'name','foreignKey':_0x190b('0x2e'),'model':_0x190b('0x2f'),'filter':{'field':_0x190b('0x30'),'value':['agent']}},{'name':_0x190b('0x31'),'field':'name','foreignKey':'membername','model':_0x190b('0x2f'),'filter':{'field':_0x190b('0x30'),'value':['telephone']}},{'name':_0x190b('0x32'),'field':_0x190b('0xd'),'foreignKey':_0x190b('0x33'),'model':'VoiceQueue','filter':{'field':_0x190b('0x34'),'value':[_0x190b('0x35')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x190b('0x33'),'model':'VoiceQueue','filter':{'field':_0x190b('0x34'),'value':[_0x190b('0x36')]}}];break;case _0x190b('0x37'):_0x3b8c74[_0x190b('0x14')]='VoiceMusicOnHold';break;case _0x190b('0x38'):_0x3b8c74['childModel']=_0x190b('0x39');break;case _0x190b('0x3a'):_0x3b8c74['childModel']=_0x190b('0x3b');break;case _0x190b('0x3c'):_0x3b8c74[_0x190b('0x14')]='Campaign';break;case _0x190b('0x3d'):_0x3b8c74['childModel']='MailQueue';break;case'mailaccounts':_0x3b8c74[_0x190b('0x14')]=_0x190b('0x3e');break;case _0x190b('0x3f'):_0x3b8c74[_0x190b('0x14')]='MailSubstatus';break;case'openchannelqueues':_0x3b8c74[_0x190b('0x14')]='OpenchannelQueue';break;case _0x190b('0x40'):_0x3b8c74[_0x190b('0x14')]='OpenchannelAccount';break;case _0x190b('0x41'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x42');break;case'smsaccounts':_0x3b8c74[_0x190b('0x14')]=_0x190b('0x43');break;case'whatsappqueues':_0x3b8c74[_0x190b('0x14')]='WhatsappQueue';break;case _0x190b('0x44'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x45');break;case'teams':_0x3b8c74[_0x190b('0x14')]='Team';break;case _0x190b('0x46'):case _0x190b('0x47'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x48');if(_0x292ce3){_0x3b8c74[_0x190b('0x15')]=[{'name':_0x190b('0x32')},{'name':_0x190b('0x49')}];}break;case'users':case _0x190b('0x4a'):case _0x190b('0x4b'):_0x3b8c74[_0x190b('0x14')]='User';if(_0x292ce3){_0x3b8c74[_0x190b('0x15')]=[{'name':_0x190b('0x4c'),'filter':{'field':_0x190b('0x30'),'value':[_0x190b('0x4d'),_0x190b('0x4e')]},'ignore':!![]},{'name':'Agents'},{'name':_0x190b('0x31')}];}break;case _0x190b('0x4f'):_0x3b8c74[_0x190b('0x14')]='ZendeskAccount';break;case _0x190b('0x50'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x51');break;case'freshdeskaccounts':_0x3b8c74['childModel']=_0x190b('0x52');break;case _0x190b('0x53'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x54');break;case _0x190b('0x55'):_0x3b8c74[_0x190b('0x14')]='DeskAccount';break;case _0x190b('0x56'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x57');break;case'vtigeraccounts':_0x3b8c74[_0x190b('0x14')]=_0x190b('0x2f');break;case _0x190b('0x58'):_0x3b8c74['childModel']=_0x190b('0x59');break;case _0x190b('0x5a'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x5b');break;case _0x190b('0x5c'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x5d');break;case _0x190b('0x5e'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x5f');break;case _0x190b('0x60'):_0x3b8c74['childModel']=_0x190b('0x61');break;case'scheduler':_0x3b8c74[_0x190b('0x14')]=_0x190b('0x62');break;case'sounds':_0x3b8c74[_0x190b('0x14')]=_0x190b('0x63');break;case _0x190b('0x64'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x65');break;case _0x190b('0x66'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x67');break;case'triggers':_0x3b8c74[_0x190b('0x14')]=_0x190b('0x68');break;case _0x190b('0x69'):_0x3b8c74['childModel']=_0x190b('0x6a');break;case'variables':_0x3b8c74['childModel']=_0x190b('0x6b');break;case _0x190b('0x6c'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x6d');break;case _0x190b('0x6e'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x6f');_0x3b8c74[_0x190b('0x15')]=[{'name':_0x190b('0x70'),'field':'id','foreignKey':_0x190b('0x71')}];break;case _0x190b('0x72'):_0x3b8c74[_0x190b('0x14')]=_0x190b('0x73');break;}return _0x3b8c74;}function _0x142f7f(_0x5a42b1,_0x3f80ce){var _0x2fa65a=_0x5a42b1[_0x190b('0x74')](0x0)[_0x190b('0x75')]()+_0x5a42b1['slice'](0x1);var _0x50f9f7={'type':_0x44ca85[_0x190b('0x76')][_0x190b('0x77')]['SELECT'],'raw':!![]};return new Promise(function(_0x1195f9,_0x53cb6f){var _0x313f29=squel[_0x190b('0x78')]()[_0x190b('0x5')]('ui.'+_0x2fa65a+_0x190b('0x79'),'id')[_0x190b('0x5')](_0x190b('0x7a'))[_0x190b('0x7b')](_0x190b('0x7c')+_0x5a42b1+_0x190b('0x7d'),'ui')[_0x190b('0x7e')](_0x190b('0x7f'),_0x3f80ce['id']);return _0x44ca85[_0x190b('0x80')]['query'](_0x313f29['toString'](),_0x50f9f7)[_0x190b('0xc')](function(_0x30b6ac){_0x3f80ce[_0x2fa65a+_0x190b('0x81')]=_0x30b6ac;_0x1195f9(_0x30b6ac);})[_0x190b('0xa')](function(_0x4af037){_0x53cb6f(_0x4af037);});});}return _0x1e5984[_0x190b('0x82')](_0x190b('0x83'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x29395d){var _0x3d5d38={'raw':![],'where':{}};var _0xf3af5b={};var _0x227fa5={'count':0x0,'rows':[]};var _0x42f0a1=_0x29395d[_0x190b('0x84')][_0x190b('0x85')];var _0x146f9c=_0x29395d['query'][_0x190b('0x86')]||![];var _0x5deaf2=_0x2e633e(_0x42f0a1,_0x146f9c);if(!_0x5deaf2['childModel'])throw new Error(_0x190b('0x87')+_0x42f0a1+'\x27');var _0x4590b7=[{'name':_0x42f0a1}];if(!_[_0x190b('0x88')](_0x5deaf2['parentSections']))_0x4590b7=_0x5deaf2['parentSections'];var _0x1d1a72=[];for(var _0xdc7579=0x0;_0xdc7579<_0x4590b7[_0x190b('0x89')];_0xdc7579++){_0x1d1a72[_0x190b('0x8a')](_0x44ca85[_0x190b('0x8b')][_0x190b('0x8c')]({'where':{'userProfileId':_0x29395d[_0x190b('0x8d')]['id'],'name':_0x4590b7[_0xdc7579][_0x190b('0xd')]},'raw':!![]}));}return Promise['all'](_0x1d1a72)[_0x190b('0xc')](function(_0x419547){var _0x331fb3=_[_0x190b('0x4')](_0x419547,function(_0x172f19){return _0x172f19?_0x172f19:undefined;});var _0x5aa9cb=_[_0x190b('0x4')](_0x4590b7,[_0x190b('0x8e'),!![]]);var _0x6fe403=_['isEmpty'](_0x331fb3)&&_[_0x190b('0x88')](_0x5aa9cb)?null:_[_0x190b('0x8f')](_0x5aa9cb,_0x331fb3);if(!_0x6fe403)return null;var _0x33703e=[];for(var _0x2b0362=0x0;_0x2b0362<_0x6fe403['length'];_0x2b0362++){var _0x540da5=_[_0x190b('0x8c')](_0x4590b7,function(_0x2bf55e){return _0x6fe403[_0x2b0362]?_0x2bf55e[_0x190b('0xd')]===_0x6fe403[_0x2b0362]['name']:null;});if(_0x540da5){if(_0x6fe403[_0x2b0362][_0x190b('0x8e')]){_0x33703e['push'](_0x120ddc(_0x5deaf2[_0x190b('0x14')],_0x6fe403[_0x2b0362]));}else{if(!_0x6fe403[_0x2b0362][_0x190b('0x90')]){_0x33703e[_0x190b('0x8a')](_0x3fbfc3(_0x540da5,_0x6fe403[_0x2b0362],_0x5deaf2[_0x190b('0x14')]));}else{if(_0x540da5['model']){_0x33703e[_0x190b('0x8a')](_0x409aa3(_0x540da5,_0x6fe403[_0x2b0362]));}}}}}return Promise['all'](_0x33703e);})[_0x190b('0xc')](function(_0x5073d2){var _0x49b60c=_0x5073d2;var _0xb71e51=null;if(_0x49b60c){_0xb71e51=_0x49b60c['length']===0x1?_0x49b60c[0x0]:null;}if(!_0xb71e51&&!_0x49b60c)return _0x227fa5;var _0x362297=_0x44ca85[_0x5deaf2[_0x190b('0x14')]][_0x190b('0x91')];_0xf3af5b[_0x190b('0xb')]=_[_0x190b('0x92')](_0x362297);_0xf3af5b['query']=_[_0x190b('0x92')](_0x29395d[_0x190b('0x84')]);_0xf3af5b[_0x190b('0x93')]=_['intersection'](_0xf3af5b[_0x190b('0xb')],_0xf3af5b[_0x190b('0x84')]);_0x3d5d38['attributes']=_[_0x190b('0x94')](_0xf3af5b[_0x190b('0xb')],qs[_0x190b('0x95')](_0x29395d['query'][_0x190b('0x95')]));_0x3d5d38[_0x190b('0x96')]=_0x3d5d38[_0x190b('0x96')][_0x190b('0x89')]?_0x3d5d38['attributes']:_0xf3af5b[_0x190b('0xb')];if(!_0x29395d[_0x190b('0x84')][_0x190b('0x97')]('nolimit')){_0x3d5d38[_0x190b('0x98')]=qs[_0x190b('0x98')](_0x29395d[_0x190b('0x84')]['limit']);_0x3d5d38[_0x190b('0x99')]=qs[_0x190b('0x99')](_0x29395d[_0x190b('0x84')][_0x190b('0x99')]);}_0x3d5d38[_0x190b('0x9a')]=qs['sort'](_0x29395d['query'][_0x190b('0x9b')]);_0x3d5d38[_0x190b('0x7e')]=qs['filters'](_[_0x190b('0x9c')](_0x29395d[_0x190b('0x84')],_0xf3af5b['filters']));if(_0x29395d['query'][_0x190b('0x4')]){_0x3d5d38[_0x190b('0x7e')]=_['merge'](_0x3d5d38['where'],{'$or':_[_0x190b('0x9')](_0x362297,function(_0x454402){if(_0x454402[_0x190b('0x34')][_0x190b('0x9d')]!==_0x190b('0x9e')){var _0x47c9c6={};_0x47c9c6[_0x454402['field']]={'$like':'%'+_0x29395d[_0x190b('0x84')]['filter']+'%'};return _0x47c9c6;}})});}var _0x254be3=[];var _0x82050a=null;var _0x472dea={};if(_0xb71e51){_0x82050a=_[_0x190b('0x8c')](_0x4590b7,[_0x190b('0xd'),_0xb71e51[_0x190b('0xd')]]);if(_0x82050a[_0x190b('0x5')]){_0x472dea={};if(_0x5deaf2[_0x190b('0x14')]===_0x190b('0x6f')){_0x472dea[_0x82050a[_0x190b('0x9f')]]=_[_0x190b('0x9')](_0xb71e51['associatedResources'],'id');}else{_0x472dea[_0x82050a[_0x190b('0x9f')]]=_0xb71e51[_0x190b('0x8')];}_0x254be3[_0x190b('0x8a')](_0x472dea);}else{_0x3d5d38['where']['id']=_0xb71e51['associatedResources'];}}else{for(var _0x4e0f63=0x0;_0x4e0f63<_0x49b60c[_0x190b('0x89')];_0x4e0f63++){_0x82050a=_['find'](_0x4590b7,[_0x190b('0xd'),_0x49b60c[_0x4e0f63][_0x190b('0xd')]]);if(_0x82050a[_0x190b('0x5')]){_0x472dea={};_0x472dea[_0x82050a['foreignKey']]=_0x49b60c[_0x4e0f63][_0x190b('0x8')];_0x254be3[_0x190b('0x8a')](_0x472dea);}else{if(!_0x3d5d38['where']['id'])_0x3d5d38[_0x190b('0x7e')]['id']=[];_0x49b60c[_0x4e0f63][_0x190b('0x8')]['forEach'](function(_0x60705e){_0x3d5d38['where']['id']['push'](_0x60705e);});}}}if(!_['isEmpty'](_0x254be3)){_0x3d5d38['where']=_[_0x190b('0xa0')](_0x3d5d38[_0x190b('0x7e')],{'$and':{'$or':_0x254be3}});}_0x3d5d38=_['merge']({},_0x3d5d38,_0x29395d[_0x190b('0xa1')]);if(_0xb71e51&&!_0xb71e51[_0x190b('0x90')]&&_0x5deaf2['childModel']===_0x190b('0x6f')){if(_0x29395d[_0x190b('0x84')][_0x190b('0xa2')]){_0x3d5d38[_0x190b('0xa3')]=[{'all':!![]}];}return _0x44ca85[_0x5deaf2[_0x190b('0x14')]][_0x190b('0x7')](_0x3d5d38)[_0x190b('0xc')](function(_0x29e335){var _0xc3610b=[];_0x29e335['forEach'](function(_0x19ec6c){var _0x5865b5;switch(_0x19ec6c['reportType']){case _0x190b('0xa4'):_0x5865b5=_[_0x190b('0x8c')](_0xb71e51[_0x190b('0x8')],function(_0x42169f){return _0x42169f['id']===_0x19ec6c[_0x190b('0x71')]&&_0x42169f[_0x190b('0x34')]===_0x190b('0xa5');});break;case _0x190b('0xa6'):_0x5865b5=_[_0x190b('0x8c')](_0xb71e51[_0x190b('0x8')],function(_0x3fd5c3){return _0x3fd5c3['id']===_0x19ec6c[_0x190b('0x71')]&&_0x3fd5c3['type']===_0x190b('0xa7');});break;}if(_0x5865b5)_0xc3610b[_0x190b('0x8a')](_0x19ec6c);});_0x227fa5[_0x190b('0xa8')]=_0xc3610b[_0x190b('0x89')];_0x227fa5[_0x190b('0xa9')]=_0xc3610b;return _0x227fa5;});}else{return _0x44ca85[_0x5deaf2[_0x190b('0x14')]][_0x190b('0xa8')]({'where':_0x3d5d38[_0x190b('0x7e')]})[_0x190b('0xc')](function(_0x4e35a4){_0x227fa5[_0x190b('0xa8')]=_0x4e35a4;if(_0x29395d[_0x190b('0x84')][_0x190b('0xa2')]){if(_0x5deaf2['childModel']===_0x190b('0xaa')){_0x3d5d38[_0x190b('0xa3')]=[{'model':_0x44ca85['Tag'],'as':'Tags','attributes':['id',_0x190b('0xd'),_0x190b('0xab')],'required':_0x29395d[_0x190b('0x84')][_0x190b('0xac')]?!![]:![]},{'model':_0x44ca85[_0x190b('0x65')],'as':_0x190b('0xad'),'attributes':['id',_0x190b('0xd'),_0x190b('0xab')],'through':_0x29395d[_0x190b('0x84')][_0x190b('0xac')]?{'attributes':[],'where':{'TagId':_0x29395d['query'][_0x190b('0xac')]||undefined}}:{},'required':_0x29395d[_0x190b('0x84')][_0x190b('0xac')]?!![]:![]}];}else{_0x3d5d38['include']=[{'all':!![]}];}}return _0x44ca85[_0x5deaf2[_0x190b('0x14')]][_0x190b('0x7')](_0x3d5d38);})[_0x190b('0xc')](function(_0x3ac90d){_0x227fa5[_0x190b('0xa9')]=_0x3ac90d;if(_0x42f0a1===_0x190b('0x2d')&&_0x29395d['query'][_0x190b('0xae')]===_0x190b('0xaf')){var _0x5e7c76=[];for(var _0x282768=0x0;_0x282768<_0x227fa5[_0x190b('0xa9')][_0x190b('0x89')];_0x282768++){_0x5e7c76[_0x190b('0x8a')](_0x142f7f(_0x190b('0xb0'),_0x227fa5[_0x190b('0xa9')][_0x282768][_0x190b('0xb1')]));_0x5e7c76[_0x190b('0x8a')](_0x142f7f('sms',_0x227fa5[_0x190b('0xa9')][_0x282768][_0x190b('0xb1')]));_0x5e7c76[_0x190b('0x8a')](_0x142f7f(_0x190b('0xb2'),_0x227fa5['rows'][_0x282768][_0x190b('0xb1')]));_0x5e7c76[_0x190b('0x8a')](_0x142f7f('mail',_0x227fa5[_0x190b('0xa9')][_0x282768][_0x190b('0xb1')]));_0x5e7c76[_0x190b('0x8a')](_0x142f7f(_0x190b('0xb3'),_0x227fa5[_0x190b('0xa9')][_0x282768][_0x190b('0xb1')]));_0x5e7c76[_0x190b('0x8a')](_0x142f7f('whatsapp',_0x227fa5[_0x190b('0xa9')][_0x282768][_0x190b('0xb1')]));}return Promise[_0x190b('0xb4')](_0x5e7c76)['then'](function(){return _0x227fa5;});}return _0x227fa5;});}});}}});}; \ No newline at end of file +var _0xb145=['name','resourceId','type','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','companies','globalcustomfields','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxaccounts','FaxAccount','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','membername','role','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','voiceprefixes','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','voicequeues','agents','telephones','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','deskaccounts','DeskAccount','zohoaccounts','CannedAnswer','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Variable','plugins','Plugin','extractedreports','Reports','AnalyticMetric','toUpperCase','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','query','toString','OpenTabs','UserProfile','user_profiles','Invalid\x20section\x20\x27','length','push','UserProfileSection','params','all','ignore','find','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','where','key','VIRTUAL','foreignKey','forEach','merge','options','AnalyticExtractedReport','include','reportType','DefaultReports','reportId','CustomReports','count','includeAll','color','ThroughTags','tag','rows','Agents','chat','dataValues','sms','fax','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','associatedResources','catch','model','then','map'];(function(_0x5eb0e2,_0x2d7ce0){var _0x115576=function(_0x3d2c99){while(--_0x3d2c99){_0x5eb0e2['push'](_0x5eb0e2['shift']());}};_0x115576(++_0x2d7ce0);}(_0xb145,0xa3));var _0x5b14=function(_0x8aebea,_0x25d02f){_0x8aebea=_0x8aebea-0x0;var _0x246a79=_0xb145[_0x8aebea];return _0x246a79;};'use strict';var _=require('lodash');var attributes=require(_0x5b14('0x0'));var qs=require(_0x5b14('0x1'));var squel=require(_0x5b14('0x2'));module[_0x5b14('0x3')]=function(_0x40609d){var _0x3defa8=_0x40609d[_0x5b14('0x4')];function _0x34b4cd(_0x5111cd,_0x1e0b5b){return new Promise(function(_0x15490e,_0x392425){if(!_0x1e0b5b)return _0x15490e(null);var _0x4d82ad=_0x1e0b5b['filter']?{[_0x1e0b5b[_0x5b14('0x5')][_0x5b14('0x6')]]:_0x1e0b5b[_0x5b14('0x5')][_0x5b14('0x7')]}:undefined;return _0x3defa8[_0x5111cd][_0x5b14('0x8')]({'where':_0x4d82ad,'raw':!![]})['then'](function(_0x32d729){_0x1e0b5b[_0x5b14('0x9')]=_['map'](_0x32d729,'id');_0x15490e(_0x1e0b5b);})[_0x5b14('0xa')](function(_0x17047f){_0x392425(_0x17047f);});});}function _0x1ecffb(_0xe146e8,_0x2102f0){return new Promise(function(_0x4fb6da,_0x265df3){var _0x50997e=_0xe146e8[_0x5b14('0x5')]?{[_0xe146e8[_0x5b14('0x5')][_0x5b14('0x6')]]:_0xe146e8[_0x5b14('0x5')][_0x5b14('0x7')]}:undefined;return _0x3defa8[_0xe146e8[_0x5b14('0xb')]]['findAll']({'where':_0x50997e,'raw':!![]})[_0x5b14('0xc')](function(_0x16f2a1){_0x2102f0[_0x5b14('0x9')]=_[_0x5b14('0xd')](_0x16f2a1,function(_0xba7e13){return _0xba7e13[_0x5b14('0xe')];});_0x4fb6da(_0x2102f0);})[_0x5b14('0xa')](function(_0xe5af75){_0x265df3(_0xe5af75);});});}function _0x183b0a(_0x287bb7,_0x221344,_0x2c3efb){if(!_0x221344)return Promise['resolve'](null);return new Promise(function(_0x24cfd0,_0x50866a){return _0x3defa8['UserProfileResource']['findAll']({'where':{'sectionId':_0x221344['id']},'raw':!![]})[_0x5b14('0xc')](function(_0x3035b5){if(_0x287bb7[_0x5b14('0x6')]&&_0x287bb7[_0x5b14('0x6')]!=='id'){_0x221344[_0x5b14('0x9')]=_[_0x5b14('0xd')](_0x3035b5,function(_0x19e6f8){return _0x19e6f8[_0x287bb7['field']];});}else{if(_0x2c3efb==='AnalyticExtractedReport'){_0x221344['associatedResources']=_[_0x5b14('0xd')](_0x3035b5,function(_0x2afa17){return{'id':_0x2afa17[_0x5b14('0xf')],'type':_0x2afa17[_0x5b14('0x10')]};});}else{_0x221344['associatedResources']=_[_0x5b14('0xd')](_0x3035b5,function(_0x1577f7){return _0x1577f7['resourceId'];});}}_0x24cfd0(_0x221344);})[_0x5b14('0xa')](function(_0x30734f){_0x50866a(_0x30734f);});});}function _0x50951f(_0x33a293,_0x54073f){var _0x59282c={'parentSections':[]};switch(_0x33a293['toLowerCase']()){case'squareprojects':_0x59282c[_0x5b14('0x11')]=_0x5b14('0x12');break;case _0x5b14('0x13'):_0x59282c['childModel']=_0x5b14('0x14');break;case _0x5b14('0x15'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x16');_0x59282c[_0x5b14('0x17')]=[{'name':_0x5b14('0x18'),'field':_0x5b14('0xe'),'foreignKey':_0x5b14('0x19')}];break;case _0x5b14('0x1a'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x1b');break;case _0x5b14('0x1c'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x1d');_0x59282c['parentSections']=[{'name':_0x5b14('0x1e'),'field':'id','foreignKey':_0x5b14('0x1f')}];break;case'lists':_0x59282c['childModel']=_0x5b14('0x20');break;case _0x5b14('0x21'):_0x59282c['childModel']='CmCompany';break;case _0x5b14('0x22'):_0x59282c['childModel']=_0x5b14('0x23');break;case _0x5b14('0x24'):_0x59282c['childModel']='ChatQueue';break;case _0x5b14('0x25'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x26');break;case'faxqueues':_0x59282c[_0x5b14('0x11')]='FaxQueue';break;case _0x5b14('0x27'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x28');break;case _0x5b14('0x29'):case'internalroutes':case _0x5b14('0x2a'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x2b');break;case _0x5b14('0x2c'):_0x59282c['childModel']=_0x5b14('0x2d');break;case _0x5b14('0x2e'):_0x59282c[_0x5b14('0x11')]='VoiceMail';break;case _0x5b14('0x2f'):_0x59282c['childModel']=_0x5b14('0x30');_0x59282c[_0x5b14('0x17')]=[{'name':'Agents','field':_0x5b14('0xe'),'foreignKey':_0x5b14('0x31'),'model':'User','filter':{'field':_0x5b14('0x32'),'value':['agent']}},{'name':_0x5b14('0x33'),'field':_0x5b14('0xe'),'foreignKey':_0x5b14('0x31'),'model':_0x5b14('0x34'),'filter':{'field':'role','value':[_0x5b14('0x35')]}},{'name':_0x5b14('0x36'),'field':_0x5b14('0xe'),'foreignKey':_0x5b14('0x37'),'model':_0x5b14('0x38'),'filter':{'field':_0x5b14('0x10'),'value':[_0x5b14('0x39')]}},{'name':_0x5b14('0x3a'),'field':_0x5b14('0xe'),'foreignKey':_0x5b14('0x37'),'model':_0x5b14('0x38'),'filter':{'field':_0x5b14('0x10'),'value':[_0x5b14('0x3b')]}}];break;case _0x5b14('0x3c'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x3d');break;case'chanspies':_0x59282c[_0x5b14('0x11')]='VoiceChanSpy';break;case _0x5b14('0x3e'):_0x59282c[_0x5b14('0x11')]='VoicePrefix';break;case'ivrcampaigns':_0x59282c['childModel']=_0x5b14('0x3f');break;case _0x5b14('0x40'):_0x59282c['childModel']=_0x5b14('0x41');break;case _0x5b14('0x42'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x43');break;case _0x5b14('0x44'):_0x59282c['childModel']=_0x5b14('0x45');break;case _0x5b14('0x46'):_0x59282c['childModel']=_0x5b14('0x47');break;case _0x5b14('0x48'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x49');break;case'smsqueues':_0x59282c[_0x5b14('0x11')]=_0x5b14('0x4a');break;case _0x5b14('0x4b'):_0x59282c[_0x5b14('0x11')]='SmsAccount';break;case _0x5b14('0x4c'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x4d');break;case _0x5b14('0x4e'):_0x59282c['childModel']='WhatsappAccount';break;case _0x5b14('0x4f'):_0x59282c[_0x5b14('0x11')]='Team';break;case _0x5b14('0x50'):case'queuecampaigns':_0x59282c[_0x5b14('0x11')]=_0x5b14('0x38');if(_0x54073f){_0x59282c[_0x5b14('0x17')]=[{'name':_0x5b14('0x36')},{'name':_0x5b14('0x3a')}];}break;case'users':case _0x5b14('0x51'):case _0x5b14('0x52'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x34');if(_0x54073f){_0x59282c[_0x5b14('0x17')]=[{'name':'Users','filter':{'field':'role','value':[_0x5b14('0x53'),'user']},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case _0x5b14('0x54'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x55');break;case _0x5b14('0x56'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x57');break;case _0x5b14('0x58'):_0x59282c['childModel']='FreshdeskAccount';break;case'sugarcrmaccounts':_0x59282c['childModel']='SugarcrmAccount';break;case _0x5b14('0x59'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x5a');break;case _0x5b14('0x5b'):_0x59282c[_0x5b14('0x11')]='ZohoAccount';break;case'vtigeraccounts':_0x59282c[_0x5b14('0x11')]=_0x5b14('0x34');break;case'cannedanswers':_0x59282c[_0x5b14('0x11')]=_0x5b14('0x5c');break;case'dispositions':_0x59282c['childModel']=_0x5b14('0x5d');break;case _0x5b14('0x5e'):_0x59282c[_0x5b14('0x11')]='Dashboard';break;case _0x5b14('0x5f'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x60');break;case _0x5b14('0x61'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x62');break;case _0x5b14('0x63'):_0x59282c['childModel']=_0x5b14('0x64');break;case'sounds':_0x59282c[_0x5b14('0x11')]=_0x5b14('0x65');break;case _0x5b14('0x66'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x67');break;case _0x5b14('0x68'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x69');break;case _0x5b14('0x6a'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x6b');break;case _0x5b14('0x6c'):_0x59282c['childModel']='Trunk';break;case'variables':_0x59282c[_0x5b14('0x11')]=_0x5b14('0x6d');break;case _0x5b14('0x6e'):_0x59282c[_0x5b14('0x11')]=_0x5b14('0x6f');break;case _0x5b14('0x70'):_0x59282c[_0x5b14('0x11')]='AnalyticExtractedReport';_0x59282c[_0x5b14('0x17')]=[{'name':_0x5b14('0x71'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x59282c[_0x5b14('0x11')]=_0x5b14('0x72');break;}return _0x59282c;}function _0x414f79(_0x16c74e,_0x32629d){var _0x1009e5=_0x16c74e['charAt'](0x0)[_0x5b14('0x73')]()+_0x16c74e['slice'](0x1);var _0x426c27={'type':_0x3defa8['Sequelize'][_0x5b14('0x74')][_0x5b14('0x75')],'raw':!![]};return new Promise(function(_0x3f7786,_0x49f348){var _0x2084c9=squel['select']()[_0x5b14('0x6')](_0x5b14('0x76')+_0x1009e5+_0x5b14('0x77'),'id')['field'](_0x5b14('0x78'))[_0x5b14('0x79')](_0x5b14('0x7a')+_0x16c74e+_0x5b14('0x7b'),'ui')['where'](_0x5b14('0x7c'),_0x32629d['id']);return _0x3defa8['sequelize'][_0x5b14('0x7d')](_0x2084c9[_0x5b14('0x7e')](),_0x426c27)['then'](function(_0x4a506a){_0x32629d[_0x1009e5+_0x5b14('0x7f')]=_0x4a506a;_0x3f7786(_0x4a506a);})[_0x5b14('0xa')](function(_0xb50187){_0x49f348(_0xb50187);});});}return _0x40609d['define'](_0x5b14('0x80'),attributes,{'tableName':_0x5b14('0x81'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5c9afe){var _0x4b9720={'raw':![],'where':{}};var _0x3f4e96={};var _0x18ae4f={'count':0x0,'rows':[]};var _0x23db69=_0x5c9afe[_0x5b14('0x7d')]['section'];var _0x25b569=_0x5c9afe[_0x5b14('0x7d')]['mergeResources']||![];var _0x5e950d=_0x50951f(_0x23db69,_0x25b569);if(!_0x5e950d[_0x5b14('0x11')])throw new Error(_0x5b14('0x82')+_0x23db69+'\x27');var _0x4d3667=[{'name':_0x23db69}];if(!_['isEmpty'](_0x5e950d[_0x5b14('0x17')]))_0x4d3667=_0x5e950d[_0x5b14('0x17')];var _0x327b7e=[];for(var _0x5b4831=0x0;_0x5b4831<_0x4d3667[_0x5b14('0x83')];_0x5b4831++){_0x327b7e[_0x5b14('0x84')](_0x3defa8[_0x5b14('0x85')]['find']({'where':{'userProfileId':_0x5c9afe[_0x5b14('0x86')]['id'],'name':_0x4d3667[_0x5b4831][_0x5b14('0xe')]},'raw':!![]}));}return Promise[_0x5b14('0x87')](_0x327b7e)['then'](function(_0x439817){var _0x404adb=_[_0x5b14('0x5')](_0x439817,function(_0x2ca6dd){return _0x2ca6dd?_0x2ca6dd:undefined;});var _0x1c0fa2=_[_0x5b14('0x5')](_0x4d3667,[_0x5b14('0x88'),!![]]);var _0x51c15d=_['isEmpty'](_0x404adb)&&_['isEmpty'](_0x1c0fa2)?null:_['union'](_0x1c0fa2,_0x404adb);if(!_0x51c15d)return null;var _0x34e049=[];for(var _0x1f0867=0x0;_0x1f0867<_0x51c15d[_0x5b14('0x83')];_0x1f0867++){var _0x2d93a=_[_0x5b14('0x89')](_0x4d3667,function(_0x58f544){return _0x51c15d[_0x1f0867]?_0x58f544['name']===_0x51c15d[_0x1f0867][_0x5b14('0xe')]:null;});if(_0x2d93a){if(_0x51c15d[_0x1f0867][_0x5b14('0x88')]){_0x34e049[_0x5b14('0x84')](_0x34b4cd(_0x5e950d[_0x5b14('0x11')],_0x51c15d[_0x1f0867]));}else{if(!_0x51c15d[_0x1f0867][_0x5b14('0x8a')]){_0x34e049['push'](_0x183b0a(_0x2d93a,_0x51c15d[_0x1f0867],_0x5e950d['childModel']));}else{if(_0x2d93a[_0x5b14('0xb')]){_0x34e049[_0x5b14('0x84')](_0x1ecffb(_0x2d93a,_0x51c15d[_0x1f0867]));}}}}}return Promise[_0x5b14('0x87')](_0x34e049);})[_0x5b14('0xc')](function(_0x18de83){var _0x1c464f=_0x18de83;var _0x221759=null;if(_0x1c464f){_0x221759=_0x1c464f[_0x5b14('0x83')]===0x1?_0x1c464f[0x0]:null;}if(!_0x221759&&!_0x1c464f)return _0x18ae4f;var _0x334792=_0x3defa8[_0x5e950d['childModel']][_0x5b14('0x8b')];_0x3f4e96['model']=_[_0x5b14('0x8c')](_0x334792);_0x3f4e96[_0x5b14('0x7d')]=_[_0x5b14('0x8c')](_0x5c9afe[_0x5b14('0x7d')]);_0x3f4e96[_0x5b14('0x8d')]=_[_0x5b14('0x8e')](_0x3f4e96[_0x5b14('0xb')],_0x3f4e96['query']);_0x4b9720['attributes']=_[_0x5b14('0x8e')](_0x3f4e96[_0x5b14('0xb')],qs[_0x5b14('0x8f')](_0x5c9afe[_0x5b14('0x7d')][_0x5b14('0x8f')]));_0x4b9720['attributes']=_0x4b9720[_0x5b14('0x90')][_0x5b14('0x83')]?_0x4b9720[_0x5b14('0x90')]:_0x3f4e96[_0x5b14('0xb')];if(!_0x5c9afe[_0x5b14('0x7d')][_0x5b14('0x91')](_0x5b14('0x92'))){_0x4b9720[_0x5b14('0x93')]=qs[_0x5b14('0x93')](_0x5c9afe[_0x5b14('0x7d')]['limit']);_0x4b9720['offset']=qs[_0x5b14('0x94')](_0x5c9afe[_0x5b14('0x7d')]['offset']);}_0x4b9720[_0x5b14('0x95')]=qs[_0x5b14('0x96')](_0x5c9afe[_0x5b14('0x7d')][_0x5b14('0x96')]);_0x4b9720['where']=qs[_0x5b14('0x8d')](_[_0x5b14('0x97')](_0x5c9afe[_0x5b14('0x7d')],_0x3f4e96[_0x5b14('0x8d')]));if(_0x5c9afe[_0x5b14('0x7d')][_0x5b14('0x5')]){_0x4b9720[_0x5b14('0x98')]=_['merge'](_0x4b9720['where'],{'$or':_['map'](_0x334792,function(_0x12a1dd){if(_0x12a1dd[_0x5b14('0x10')][_0x5b14('0x99')]!==_0x5b14('0x9a')){var _0x3449df={};_0x3449df[_0x12a1dd[_0x5b14('0x6')]]={'$like':'%'+_0x5c9afe[_0x5b14('0x7d')][_0x5b14('0x5')]+'%'};return _0x3449df;}})});}var _0x2364bc=[];var _0x18d88b=null;var _0x29d158={};if(_0x221759){_0x18d88b=_['find'](_0x4d3667,[_0x5b14('0xe'),_0x221759[_0x5b14('0xe')]]);if(_0x18d88b[_0x5b14('0x6')]){_0x29d158={};if(_0x5e950d[_0x5b14('0x11')]==='AnalyticExtractedReport'){_0x29d158[_0x18d88b[_0x5b14('0x9b')]]=_[_0x5b14('0xd')](_0x221759[_0x5b14('0x9')],'id');}else{_0x29d158[_0x18d88b[_0x5b14('0x9b')]]=_0x221759[_0x5b14('0x9')];}_0x2364bc[_0x5b14('0x84')](_0x29d158);}else{_0x4b9720[_0x5b14('0x98')]['id']=_0x221759[_0x5b14('0x9')];}}else{for(var _0x189368=0x0;_0x189368<_0x1c464f[_0x5b14('0x83')];_0x189368++){_0x18d88b=_[_0x5b14('0x89')](_0x4d3667,[_0x5b14('0xe'),_0x1c464f[_0x189368][_0x5b14('0xe')]]);if(_0x18d88b[_0x5b14('0x6')]){_0x29d158={};_0x29d158[_0x18d88b[_0x5b14('0x9b')]]=_0x1c464f[_0x189368]['associatedResources'];_0x2364bc[_0x5b14('0x84')](_0x29d158);}else{if(!_0x4b9720[_0x5b14('0x98')]['id'])_0x4b9720[_0x5b14('0x98')]['id']=[];_0x1c464f[_0x189368][_0x5b14('0x9')][_0x5b14('0x9c')](function(_0x5939ae){_0x4b9720['where']['id'][_0x5b14('0x84')](_0x5939ae);});}}}if(!_['isEmpty'](_0x2364bc)){_0x4b9720[_0x5b14('0x98')]=_[_0x5b14('0x9d')](_0x4b9720[_0x5b14('0x98')],{'$and':{'$or':_0x2364bc}});}_0x4b9720=_[_0x5b14('0x9d')]({},_0x4b9720,_0x5c9afe[_0x5b14('0x9e')]);if(_0x221759&&!_0x221759[_0x5b14('0x8a')]&&_0x5e950d['childModel']===_0x5b14('0x9f')){if(_0x5c9afe['query']['includeAll']){_0x4b9720[_0x5b14('0xa0')]=[{'all':!![]}];}return _0x3defa8[_0x5e950d[_0x5b14('0x11')]][_0x5b14('0x8')](_0x4b9720)['then'](function(_0x5b8e11){var _0x5c9aa0=[];_0x5b8e11['forEach'](function(_0x1f2d2e){var _0x1f7304;switch(_0x1f2d2e[_0x5b14('0xa1')]){case'default':_0x1f7304=_['find'](_0x221759[_0x5b14('0x9')],function(_0x317f33){return _0x317f33['id']===_0x1f2d2e['reportId']&&_0x317f33[_0x5b14('0x10')]===_0x5b14('0xa2');});break;case'custom':_0x1f7304=_['find'](_0x221759['associatedResources'],function(_0x522cc5){return _0x522cc5['id']===_0x1f2d2e[_0x5b14('0xa3')]&&_0x522cc5['type']===_0x5b14('0xa4');});break;}if(_0x1f7304)_0x5c9aa0[_0x5b14('0x84')](_0x1f2d2e);});_0x18ae4f['count']=_0x5c9aa0[_0x5b14('0x83')];_0x18ae4f['rows']=_0x5c9aa0;return _0x18ae4f;});}else{return _0x3defa8[_0x5e950d[_0x5b14('0x11')]]['count']({'where':_0x4b9720[_0x5b14('0x98')]})[_0x5b14('0xc')](function(_0x52df2d){_0x18ae4f[_0x5b14('0xa5')]=_0x52df2d;if(_0x5c9afe[_0x5b14('0x7d')][_0x5b14('0xa6')]){if(_0x5e950d[_0x5b14('0x11')]==='CmContact'){_0x4b9720[_0x5b14('0xa0')]=[{'model':_0x3defa8[_0x5b14('0x67')],'as':'Tags','attributes':['id',_0x5b14('0xe'),_0x5b14('0xa7')],'required':_0x5c9afe[_0x5b14('0x7d')]['tag']?!![]:![]},{'model':_0x3defa8[_0x5b14('0x67')],'as':_0x5b14('0xa8'),'attributes':['id',_0x5b14('0xe'),'color'],'through':_0x5c9afe[_0x5b14('0x7d')]['tag']?{'attributes':[],'where':{'TagId':_0x5c9afe[_0x5b14('0x7d')]['tag']||undefined}}:{},'required':_0x5c9afe[_0x5b14('0x7d')][_0x5b14('0xa9')]?!![]:![]}];}else{_0x4b9720['include']=[{'all':!![]}];}}return _0x3defa8[_0x5e950d[_0x5b14('0x11')]]['findAll'](_0x4b9720);})[_0x5b14('0xc')](function(_0x891dee){_0x18ae4f[_0x5b14('0xaa')]=_0x891dee;if(_0x23db69===_0x5b14('0xab')&&_0x5c9afe[_0x5b14('0x7d')]['openTabs']==='true'){var _0x343fe3=[];for(var _0x5c5f1c=0x0;_0x5c5f1c<_0x18ae4f[_0x5b14('0xaa')][_0x5b14('0x83')];_0x5c5f1c++){_0x343fe3[_0x5b14('0x84')](_0x414f79(_0x5b14('0xac'),_0x18ae4f['rows'][_0x5c5f1c][_0x5b14('0xad')]));_0x343fe3[_0x5b14('0x84')](_0x414f79(_0x5b14('0xae'),_0x18ae4f[_0x5b14('0xaa')][_0x5c5f1c][_0x5b14('0xad')]));_0x343fe3[_0x5b14('0x84')](_0x414f79(_0x5b14('0xaf'),_0x18ae4f[_0x5b14('0xaa')][_0x5c5f1c][_0x5b14('0xad')]));_0x343fe3[_0x5b14('0x84')](_0x414f79('mail',_0x18ae4f['rows'][_0x5c5f1c]['dataValues']));_0x343fe3['push'](_0x414f79('openchannel',_0x18ae4f[_0x5b14('0xaa')][_0x5c5f1c][_0x5b14('0xad')]));_0x343fe3[_0x5b14('0x84')](_0x414f79(_0x5b14('0xb0'),_0x18ae4f['rows'][_0x5c5f1c][_0x5b14('0xad')]));}return Promise[_0x5b14('0x87')](_0x343fe3)[_0x5b14('0xc')](function(){return _0x18ae4f;});}return _0x18ae4f;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 261ae2f..974496e 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 _0xb422=['localhost','socket.io-emitter','register','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','bluebird','../../mysqldb','../../config/logger','../../config/environment','client','http','redis'];(function(_0x3edf96,_0x11e492){var _0x128e0e=function(_0x2db51f){while(--_0x2db51f){_0x3edf96['push'](_0x3edf96['shift']());}};_0x128e0e(++_0x11e492);}(_0xb422,0x85));var _0x2b42=function(_0x254120,_0x947983){_0x254120=_0x254120-0x0;var _0x22da73=_0xb422[_0x254120];return _0x22da73;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2b42('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b42('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b42('0x2'))('rpc');var config=require(_0x2b42('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x2b42('0x4')][_0x2b42('0x5')]({'port':0x232a});config[_0x2b42('0x6')]=_['defaults'](config[_0x2b42('0x6')],{'host':_0x2b42('0x7'),'port':0x18eb});var socket=require(_0x2b42('0x8'))(new Redis(config['redis']));require('./userProfile.socket')[_0x2b42('0x9')](socket);function respondWithRpcPromise(_0x5dc850,_0x132066,_0xcc84af){return new BPromise(function(_0x1dcab0,_0x1ec844){return client['request'](_0x5dc850,_0xcc84af)[_0x2b42('0xa')](function(_0x18f30b){logger['info'](_0x2b42('0xb'),_0x132066,_0x2b42('0xc'));logger[_0x2b42('0xd')](_0x2b42('0xe'),_0x132066,'request\x20sent',JSON['stringify'](_0x18f30b));if(_0x18f30b[_0x2b42('0xf')]){if(_0x18f30b[_0x2b42('0xf')]['code']===0x1f4){logger[_0x2b42('0xf')](_0x2b42('0xb'),_0x132066,_0x18f30b[_0x2b42('0xf')][_0x2b42('0x10')]);return _0x1ec844(_0x18f30b[_0x2b42('0xf')][_0x2b42('0x10')]);}logger[_0x2b42('0xf')](_0x2b42('0xb'),_0x132066,_0x18f30b[_0x2b42('0xf')][_0x2b42('0x10')]);return _0x1dcab0(_0x18f30b['error'][_0x2b42('0x10')]);}else{logger[_0x2b42('0x11')](_0x2b42('0xb'),_0x132066,_0x2b42('0xc'));_0x1dcab0(_0x18f30b[_0x2b42('0x12')][_0x2b42('0x10')]);}})[_0x2b42('0x13')](function(_0x4728f4){logger['error'](_0x2b42('0xb'),_0x132066,_0x4728f4);_0x1ec844(_0x4728f4);});});} \ No newline at end of file +var _0x147b=['info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./userProfile.socket','register','request','then'];(function(_0x1ffd16,_0x22dc34){var _0x157037=function(_0x46d3d4){while(--_0x46d3d4){_0x1ffd16['push'](_0x1ffd16['shift']());}};_0x157037(++_0x22dc34);}(_0x147b,0x193));var _0xb147=function(_0x19d828,_0x2439ce){_0x19d828=_0x19d828-0x0;var _0x25b133=_0x147b[_0x19d828];return _0x25b133;};'use strict';var _=require(_0xb147('0x0'));var util=require(_0xb147('0x1'));var moment=require('moment');var BPromise=require(_0xb147('0x2'));var rs=require(_0xb147('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb147('0x4'))['db'];var utils=require(_0xb147('0x5'));var logger=require(_0xb147('0x6'))('rpc');var config=require(_0xb147('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb147('0x8')][_0xb147('0x9')]({'port':0x232a});config[_0xb147('0xa')]=_['defaults'](config['redis'],{'host':_0xb147('0xb'),'port':0x18eb});var socket=require(_0xb147('0xc'))(new Redis(config[_0xb147('0xa')]));require(_0xb147('0xd'))[_0xb147('0xe')](socket);function respondWithRpcPromise(_0x22d125,_0x92a1fb,_0x275800){return new BPromise(function(_0x4f1031,_0x4a33ae){return client[_0xb147('0xf')](_0x22d125,_0x275800)[_0xb147('0x10')](function(_0xf0c7cc){logger[_0xb147('0x11')](_0xb147('0x12'),_0x92a1fb,_0xb147('0x13'));logger[_0xb147('0x14')](_0xb147('0x15'),_0x92a1fb,_0xb147('0x13'),JSON[_0xb147('0x16')](_0xf0c7cc));if(_0xf0c7cc[_0xb147('0x17')]){if(_0xf0c7cc['error'][_0xb147('0x18')]===0x1f4){logger[_0xb147('0x17')](_0xb147('0x12'),_0x92a1fb,_0xf0c7cc[_0xb147('0x17')]['message']);return _0x4a33ae(_0xf0c7cc[_0xb147('0x17')][_0xb147('0x19')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0x92a1fb,_0xf0c7cc[_0xb147('0x17')][_0xb147('0x19')]);return _0x4f1031(_0xf0c7cc[_0xb147('0x17')]['message']);}else{logger['info'](_0xb147('0x12'),_0x92a1fb,'request\x20sent');_0x4f1031(_0xf0c7cc[_0xb147('0x1a')][_0xb147('0x19')]);}})[_0xb147('0x1b')](function(_0x4a1c81){logger['error']('UserProfile,\x20%s,\x20%s',_0x92a1fb,_0x4a1c81);_0x4a33ae(_0x4a1c81);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e04bdc6..6677355 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 _0x02f1=['remove','emit','register','length','userProfile:','./userProfile.events'];(function(_0x35c97a,_0x513aba){var _0x388917=function(_0xa1f4e1){while(--_0xa1f4e1){_0x35c97a['push'](_0x35c97a['shift']());}};_0x388917(++_0x513aba);}(_0x02f1,0x1d9));var _0x102f=function(_0x516f39,_0x36068c){_0x516f39=_0x516f39-0x0;var _0x205498=_0x02f1[_0x516f39];return _0x205498;};'use strict';var UserProfileEvents=require(_0x102f('0x0'));var events=['save',_0x102f('0x1'),'update'];function createListener(_0x548745,_0xc7d02b){return function(_0x50f770){_0xc7d02b[_0x102f('0x2')](_0x548745,_0x50f770);};}function removeListener(_0x36e37f,_0x197202){return function(){UserProfileEvents['removeListener'](_0x36e37f,_0x197202);};}exports[_0x102f('0x3')]=function(_0x9a38a2){for(var _0x49982f=0x0,_0x3edf50=events[_0x102f('0x4')];_0x49982f<_0x3edf50;_0x49982f++){var _0x1f0daa=events[_0x49982f];var _0x29eaeb=createListener(_0x102f('0x5')+_0x1f0daa,_0x9a38a2);UserProfileEvents['on'](_0x1f0daa,_0x29eaeb);}}; \ No newline at end of file +var _0x9fac=['emit','register','length','userProfile:','save','remove'];(function(_0x20a522,_0x2e52cb){var _0x2265f1=function(_0x2a7724){while(--_0x2a7724){_0x20a522['push'](_0x20a522['shift']());}};_0x2265f1(++_0x2e52cb);}(_0x9fac,0x70));var _0xc9fa=function(_0x4a8c1d,_0x4c717a){_0x4a8c1d=_0x4a8c1d-0x0;var _0x95d97d=_0x9fac[_0x4a8c1d];return _0x95d97d;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xc9fa('0x0'),_0xc9fa('0x1'),'update'];function createListener(_0x42f99e,_0xcc5836){return function(_0x416b1c){_0xcc5836[_0xc9fa('0x2')](_0x42f99e,_0x416b1c);};}function removeListener(_0x2dffdc,_0x57132a){return function(){UserProfileEvents['removeListener'](_0x2dffdc,_0x57132a);};}exports[_0xc9fa('0x3')]=function(_0x2ebb87){for(var _0x4cbf68=0x0,_0x18e25c=events[_0xc9fa('0x4')];_0x4cbf68<_0x18e25c;_0x4cbf68++){var _0x581b76=events[_0x4cbf68];var _0x45e976=createListener(_0xc9fa('0x5')+_0x581b76,_0x2ebb87);UserProfileEvents['on'](_0x581b76,_0x45e976);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 79a1385..9b71627 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 _0x1eb4=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4e44f6,_0x17c136){var _0x461044=function(_0x31d9b9){while(--_0x31d9b9){_0x4e44f6['push'](_0x4e44f6['shift']());}};_0x461044(++_0x17c136);}(_0x1eb4,0xca));var _0x41eb=function(_0x47f30d,_0x3fc30c){_0x47f30d=_0x47f30d-0x0;var _0x75ca0c=_0x1eb4[_0x47f30d];return _0x75ca0c;};'use strict';var multer=require(_0x41eb('0x0'));var util=require(_0x41eb('0x1'));var path=require(_0x41eb('0x2'));var timeout=require(_0x41eb('0x3'));var express=require(_0x41eb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x41eb('0x5'));var interaction=require(_0x41eb('0x6'));var config=require(_0x41eb('0x7'));var controller=require('./userProfileResource.controller');router[_0x41eb('0x8')]('/',auth[_0x41eb('0x9')](),controller[_0x41eb('0xa')]);router[_0x41eb('0x8')](_0x41eb('0xb'),auth['isAuthenticated'](),controller[_0x41eb('0xc')]);router[_0x41eb('0x8')](_0x41eb('0xd'),auth[_0x41eb('0x9')](),controller[_0x41eb('0xe')]);router[_0x41eb('0xf')]('/',auth[_0x41eb('0x9')](),controller[_0x41eb('0x10')]);router['put']('/:id',auth[_0x41eb('0x9')](),controller[_0x41eb('0x11')]);router[_0x41eb('0x12')](_0x41eb('0xd'),auth[_0x41eb('0x9')](),controller[_0x41eb('0x13')]);module[_0x41eb('0x14')]=router; \ No newline at end of file +var _0x933e=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x933e,0x194));var _0xe933=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x933e[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xe933('0x0'));var util=require(_0xe933('0x1'));var path=require(_0xe933('0x2'));var timeout=require(_0xe933('0x3'));var express=require(_0xe933('0x4'));var router=express['Router']();var fs_extra=require(_0xe933('0x5'));var auth=require(_0xe933('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe933('0x7'));var controller=require(_0xe933('0x8'));router[_0xe933('0x9')]('/',auth[_0xe933('0xa')](),controller['index']);router[_0xe933('0x9')](_0xe933('0xb'),auth['isAuthenticated'](),controller[_0xe933('0xc')]);router[_0xe933('0x9')](_0xe933('0xd'),auth[_0xe933('0xa')](),controller[_0xe933('0xe')]);router[_0xe933('0xf')]('/',auth[_0xe933('0xa')](),controller[_0xe933('0x10')]);router['put'](_0xe933('0xd'),auth[_0xe933('0xa')](),controller[_0xe933('0x11')]);router[_0xe933('0x12')](_0xe933('0xd'),auth[_0xe933('0xa')](),controller[_0xe933('0x13')]);module[_0xe933('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index b94a808..6732d5f 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 _0x3ca8=['exports','INTEGER','STRING','sequelize'];(function(_0x20714a,_0x7de591){var _0x15e877=function(_0x3f9f8d){while(--_0x3f9f8d){_0x20714a['push'](_0x20714a['shift']());}};_0x15e877(++_0x7de591);}(_0x3ca8,0x19b));var _0x83ca=function(_0x3fa8f8,_0x4fff4c){_0x3fa8f8=_0x3fa8f8-0x0;var _0x146446=_0x3ca8[_0x3fa8f8];return _0x146446;};'use strict';var Sequelize=require(_0x83ca('0x0'));module[_0x83ca('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x83ca('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x83ca('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x1bae=['STRING','sequelize','exports'];(function(_0x4c380d,_0x565822){var _0x2b27d1=function(_0x3d42f7){while(--_0x3d42f7){_0x4c380d['push'](_0x4c380d['shift']());}};_0x2b27d1(++_0x565822);}(_0x1bae,0xfd));var _0xe1ba=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1bae[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xe1ba('0x0'));module[_0xe1ba('0x1')]={'name':{'type':Sequelize[_0xe1ba('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xe1ba('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 62ac2c5..889fdba 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 _0x5496=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x3a68c2,_0x4e3879){var _0x49772f=function(_0x3ebe59){while(--_0x3ebe59){_0x3a68c2['push'](_0x3a68c2['shift']());}};_0x49772f(++_0x4e3879);}(_0x5496,0x175));var _0x6549=function(_0x41173e,_0x6a2667){_0x41173e=_0x41173e-0x0;var _0x1d81b7=_0x5496[_0x41173e];return _0x1d81b7;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['create'](_0x41d675[_0x6549('0x4c')],{})[_0x6549('0x26')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0xa4c650,_0x25a6ee){if(_0xa4c650[_0x6549('0x4c')]['id']){delete _0xa4c650[_0x6549('0x4c')]['id'];}return db['UserProfileResource'][_0x6549('0x4a')]({'where':{'id':_0xa4c650['params']['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x25a6ee,null))[_0x6549('0x26')](saveUpdates(_0xa4c650[_0x6549('0x4c')],null))['then'](respondWithResult(_0x25a6ee,null))[_0x6549('0x43')](handleError(_0x25a6ee,null));};exports[_0x6549('0x4d')]=function(_0x2ef4d2,_0x5300c8){return db[_0x6549('0x2b')][_0x6549('0x4a')]({'where':{'id':_0x2ef4d2[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x5300c8,null))[_0x6549('0x26')](removeEntity(_0x5300c8,null))[_0x6549('0x43')](handleError(_0x5300c8,null));};exports['describe']=function(_0x28af00,_0x4bbc61){return db[_0x6549('0x2b')][_0x6549('0x4e')]()[_0x6549('0x26')](respondWithResult(_0x4bbc61,null))[_0x6549('0x43')](handleError(_0x4bbc61,null));}; \ No newline at end of file +var _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','UserProfileResource','includeAll','rows','catch','show'];(function(_0x28beaf,_0x122959){var _0x2df201=function(_0x583fd1){while(--_0x583fd1){_0x28beaf['push'](_0x28beaf['shift']());}};_0x2df201(++_0x122959);}(_0x0295,0x1f0));var _0x5029=function(_0x4dc0bc,_0x490bf0){_0x4dc0bc=_0x4dc0bc-0x0;var _0x470317=_0x0295[_0x4dc0bc];return _0x470317;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['UserProfileResource'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['UserProfileResource'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));};exports['describe']=function(_0x544fb3,_0x1510bb){return db[_0x5029('0x3b')]['describe']()[_0x5029('0x20')](respondWithResult(_0x1510bb,null))['catch'](handleError(_0x1510bb,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 609f5db..99a9d93 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 _0xa1e9=['lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','resourceId'];(function(_0x5b4a2e,_0x1bd0eb){var _0xda56b0=function(_0xf4eec1){while(--_0xf4eec1){_0x5b4a2e['push'](_0x5b4a2e['shift']());}};_0xda56b0(++_0x1bd0eb);}(_0xa1e9,0xcc));var _0x9a1e=function(_0x1fd1ad,_0x332b5a){_0x1fd1ad=_0x1fd1ad-0x0;var _0x31f1be=_0xa1e9[_0x1fd1ad];return _0x31f1be;};'use strict';var _=require(_0x9a1e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9a1e('0x1'));var moment=require(_0x9a1e('0x2'));var BPromise=require(_0x9a1e('0x3'));var rp=require(_0x9a1e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a1e('0x5'));var config=require(_0x9a1e('0x6'));var attributes=require(_0x9a1e('0x7'));module[_0x9a1e('0x8')]=function(_0x4b36cd,_0x46c602){return _0x4b36cd['define'](_0x9a1e('0x9'),attributes,{'tableName':_0x9a1e('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x9a1e('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5e9e=['sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x447ae5,_0x28dc83){var _0x54c1e7=function(_0x455e2e){while(--_0x455e2e){_0x447ae5['push'](_0x447ae5['shift']());}};_0x54c1e7(++_0x28dc83);}(_0x5e9e,0x141));var _0xe5e9=function(_0x115ae3,_0x78c8ca){_0x115ae3=_0x115ae3-0x0;var _0x561107=_0x5e9e[_0x115ae3];return _0x561107;};'use strict';var _=require(_0xe5e9('0x0'));var util=require(_0xe5e9('0x1'));var logger=require(_0xe5e9('0x2'))(_0xe5e9('0x3'));var moment=require(_0xe5e9('0x4'));var BPromise=require(_0xe5e9('0x5'));var rp=require(_0xe5e9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe5e9('0x7'));var config=require(_0xe5e9('0x8'));var attributes=require(_0xe5e9('0x9'));module[_0xe5e9('0xa')]=function(_0x370c54,_0x520bc8){return _0x370c54['define'](_0xe5e9('0xb'),attributes,{'tableName':_0xe5e9('0xc'),'paranoid':![],'indexes':[{'name':_0xe5e9('0xd'),'fields':[_0xe5e9('0xe'),_0xe5e9('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index babc43a..f21b5e8 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 _0xa9c1=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','UserProfileResource,\x20%s,\x20%s','result','catch','util','moment','bluebird'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0xa9c1,0x15d));var _0x1a9c=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xa9c1[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require('lodash');var util=require(_0x1a9c('0x0'));var moment=require(_0x1a9c('0x1'));var BPromise=require(_0x1a9c('0x2'));var rs=require(_0x1a9c('0x3'));var fs=require('fs');var Redis=require(_0x1a9c('0x4'));var db=require(_0x1a9c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a9c('0x6'))(_0x1a9c('0x7'));var config=require(_0x1a9c('0x8'));var jayson=require(_0x1a9c('0x9'));var client=jayson[_0x1a9c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x339bbb,_0x1d9fe4,_0x33bbc8){return new BPromise(function(_0x727e9b,_0x529ac8){return client[_0x1a9c('0xb')](_0x339bbb,_0x33bbc8)['then'](function(_0xd4091){logger[_0x1a9c('0xc')]('UserProfileResource,\x20%s,\x20%s',_0x1d9fe4,_0x1a9c('0xd'));logger[_0x1a9c('0xe')](_0x1a9c('0xf'),_0x1d9fe4,_0x1a9c('0xd'),JSON[_0x1a9c('0x10')](_0xd4091));if(_0xd4091['error']){if(_0xd4091[_0x1a9c('0x11')]['code']===0x1f4){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x1d9fe4,_0xd4091[_0x1a9c('0x11')]['message']);return _0x529ac8(_0xd4091[_0x1a9c('0x11')][_0x1a9c('0x12')]);}logger[_0x1a9c('0x11')](_0x1a9c('0x13'),_0x1d9fe4,_0xd4091[_0x1a9c('0x11')][_0x1a9c('0x12')]);return _0x727e9b(_0xd4091[_0x1a9c('0x11')][_0x1a9c('0x12')]);}else{logger['info'](_0x1a9c('0x13'),_0x1d9fe4,_0x1a9c('0xd'));_0x727e9b(_0xd4091[_0x1a9c('0x14')]['message']);}})[_0x1a9c('0x15')](function(_0x213305){logger[_0x1a9c('0x11')](_0x1a9c('0x13'),_0x1d9fe4,_0x213305);_0x529ac8(_0x213305);});});} \ No newline at end of file +var _0x2b4b=['http','request','then','info','debug','request\x20sent','stringify','error','UserProfileResource,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x2b4b,0xb3));var _0xb2b4=function(_0x2755a2,_0x2a1197){_0x2755a2=_0x2755a2-0x0;var _0x719d22=_0x2b4b[_0x2755a2];return _0x719d22;};'use strict';var _=require(_0xb2b4('0x0'));var util=require('util');var moment=require(_0xb2b4('0x1'));var BPromise=require(_0xb2b4('0x2'));var rs=require(_0xb2b4('0x3'));var fs=require('fs');var Redis=require(_0xb2b4('0x4'));var db=require(_0xb2b4('0x5'))['db'];var utils=require(_0xb2b4('0x6'));var logger=require('../../config/logger')(_0xb2b4('0x7'));var config=require(_0xb2b4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb2b4('0x9')][_0xb2b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x385c54,_0x6ea985,_0x4f4f52){return new BPromise(function(_0x5e0309,_0x4e70d6){return client[_0xb2b4('0xb')](_0x385c54,_0x4f4f52)[_0xb2b4('0xc')](function(_0x2be47d){logger[_0xb2b4('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x6ea985,'request\x20sent');logger[_0xb2b4('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x6ea985,_0xb2b4('0xf'),JSON[_0xb2b4('0x10')](_0x2be47d));if(_0x2be47d['error']){if(_0x2be47d[_0xb2b4('0x11')]['code']===0x1f4){logger[_0xb2b4('0x11')](_0xb2b4('0x12'),_0x6ea985,_0x2be47d[_0xb2b4('0x11')][_0xb2b4('0x13')]);return _0x4e70d6(_0x2be47d[_0xb2b4('0x11')][_0xb2b4('0x13')]);}logger[_0xb2b4('0x11')](_0xb2b4('0x12'),_0x6ea985,_0x2be47d[_0xb2b4('0x11')]['message']);return _0x5e0309(_0x2be47d[_0xb2b4('0x11')]['message']);}else{logger[_0xb2b4('0xd')](_0xb2b4('0x12'),_0x6ea985,_0xb2b4('0xf'));_0x5e0309(_0x2be47d['result']['message']);}})[_0xb2b4('0x14')](function(_0x19c928){logger[_0xb2b4('0x11')](_0xb2b4('0x12'),_0x6ea985,_0x19c928);_0x4e70d6(_0x19c928);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 6bc5371..67eb3f8 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 _0x04e7=['get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./userProfileSection.controller'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0x04e7,0x1e6));var _0x704e=function(_0x4687df,_0x12099c){_0x4687df=_0x4687df-0x0;var _0x32eaef=_0x04e7[_0x4687df];return _0x32eaef;};'use strict';var multer=require(_0x704e('0x0'));var util=require('util');var path=require(_0x704e('0x1'));var timeout=require(_0x704e('0x2'));var express=require(_0x704e('0x3'));var router=express[_0x704e('0x4')]();var fs_extra=require(_0x704e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x704e('0x6'));var controller=require(_0x704e('0x7'));router[_0x704e('0x8')]('/',auth[_0x704e('0x9')](),controller[_0x704e('0xa')]);router[_0x704e('0x8')]('/describe',auth[_0x704e('0x9')](),controller['describe']);router[_0x704e('0x8')](_0x704e('0xb'),auth[_0x704e('0x9')](),controller[_0x704e('0xc')]);router[_0x704e('0xd')]('/',auth[_0x704e('0x9')](),controller['create']);router[_0x704e('0xe')]('/:id',auth[_0x704e('0x9')](),controller[_0x704e('0xf')]);router[_0x704e('0x10')](_0x704e('0xb'),auth[_0x704e('0x9')](),controller[_0x704e('0x11')]);module[_0x704e('0x12')]=router; \ No newline at end of file +var _0x06c0=['put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create'];(function(_0x486d18,_0x31df44){var _0x1322d5=function(_0x30c3f5){while(--_0x30c3f5){_0x486d18['push'](_0x486d18['shift']());}};_0x1322d5(++_0x31df44);}(_0x06c0,0xea));var _0x006c=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x06c0[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require(_0x006c('0x0'));var util=require(_0x006c('0x1'));var path=require('path');var timeout=require(_0x006c('0x2'));var express=require(_0x006c('0x3'));var router=express[_0x006c('0x4')]();var fs_extra=require(_0x006c('0x5'));var auth=require(_0x006c('0x6'));var interaction=require(_0x006c('0x7'));var config=require(_0x006c('0x8'));var controller=require(_0x006c('0x9'));router[_0x006c('0xa')]('/',auth['isAuthenticated'](),controller[_0x006c('0xb')]);router[_0x006c('0xa')](_0x006c('0xc'),auth[_0x006c('0xd')](),controller[_0x006c('0xe')]);router[_0x006c('0xa')](_0x006c('0xf'),auth[_0x006c('0xd')](),controller[_0x006c('0x10')]);router[_0x006c('0x11')]('/',auth[_0x006c('0xd')](),controller[_0x006c('0x12')]);router[_0x006c('0x13')]('/:id',auth[_0x006c('0xd')](),controller[_0x006c('0x14')]);router[_0x006c('0x15')](_0x006c('0xf'),auth[_0x006c('0xd')](),controller[_0x006c('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index f1f1e02..76a3dda 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 _0xa478=['sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x390b37,_0x23ed18){var _0x265e6e=function(_0x2a06b9){while(--_0x2a06b9){_0x390b37['push'](_0x390b37['shift']());}};_0x265e6e(++_0x23ed18);}(_0xa478,0x136));var _0x8a47=function(_0x26df48,_0x22aa50){_0x26df48=_0x26df48-0x0;var _0x209047=_0xa478[_0x26df48];return _0x209047;};'use strict';var Sequelize=require(_0x8a47('0x0'));module[_0x8a47('0x1')]={'name':{'type':Sequelize[_0x8a47('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x8a47('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x8a47('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x8a47('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x8a47('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x8a47('0x2')],'set':function(_0x2b3110){this[_0x8a47('0x5')](_0x8a47('0x6'),_0x2b3110?_0x2b3110[_0x8a47('0x7')](''):[]);},'get':function(){return this['getDataValue'](_0x8a47('0x6'))?this[_0x8a47('0x8')](_0x8a47('0x6'))[_0x8a47('0x9')](''):[];}}}; \ No newline at end of file +var _0x2547=['BOOLEAN','crudPermissions','join','getDataValue','split','exports','STRING','INTEGER'];(function(_0x2eeff0,_0x4d5c8d){var _0x2dd9a8=function(_0x1f40b0){while(--_0x1f40b0){_0x2eeff0['push'](_0x2eeff0['shift']());}};_0x2dd9a8(++_0x4d5c8d);}(_0x2547,0x1cd));var _0x7254=function(_0x1a5c12,_0x4e2d96){_0x1a5c12=_0x1a5c12-0x0;var _0xbe2099=_0x2547[_0x1a5c12];return _0xbe2099;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'name':{'type':Sequelize[_0x7254('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x7254('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x7254('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x7254('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x7254('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x7254('0x1')],'set':function(_0x265ebf){this['setDataValue'](_0x7254('0x4'),_0x265ebf?_0x265ebf[_0x7254('0x5')](''):[]);},'get':function(){return this[_0x7254('0x6')](_0x7254('0x4'))?this['getDataValue'](_0x7254('0x4'))[_0x7254('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index f5ee501..e7411c2 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 _0xb77a=['params','length','includeAll','include','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','then','error','stack','name','index','map','UserProfileSection','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','catch'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb77a,0x176));var _0xab77=function(_0x299a1b,_0x50fc1a){_0x299a1b=_0x299a1b-0x0;var _0x557504=_0xb77a[_0x299a1b];return _0x557504;};'use strict';var emlformat=require(_0xab77('0x0'));var rimraf=require(_0xab77('0x1'));var zipdir=require(_0xab77('0x2'));var jsonpatch=require(_0xab77('0x3'));var rp=require(_0xab77('0x4'));var moment=require(_0xab77('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xab77('0x6'));var util=require(_0xab77('0x7'));var path=require(_0xab77('0x8'));var sox=require('sox');var csv=require(_0xab77('0x9'));var ejs=require(_0xab77('0xa'));var fs=require('fs');var fs_extra=require(_0xab77('0xb'));var _=require(_0xab77('0xc'));var squel=require(_0xab77('0xd'));var crypto=require(_0xab77('0xe'));var jsforce=require(_0xab77('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xab77('0x9'));var querystring=require('querystring');var Papa=require(_0xab77('0x10'));var Redis=require(_0xab77('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab77('0x12'));var logger=require(_0xab77('0x13'))('api');var utils=require(_0xab77('0x14'));var config=require(_0xab77('0x15'));var licenseUtil=require(_0xab77('0x16'));var db=require(_0xab77('0x17'))['db'];function respondWithStatusCode(_0xbaa327,_0x1edf1f){_0x1edf1f=_0x1edf1f||0xcc;return function(_0x228e35){if(_0x228e35){return _0xbaa327[_0xab77('0x18')](_0x1edf1f);}return _0xbaa327[_0xab77('0x19')](_0x1edf1f)[_0xab77('0x1a')]();};}function respondWithResult(_0x3da125,_0x2bbca4){_0x2bbca4=_0x2bbca4||0xc8;return function(_0x37de7a){if(_0x37de7a){return _0x3da125['status'](_0x2bbca4)['json'](_0x37de7a);}};}function respondWithFilteredResult(_0x3cdb73,_0x1a5154){return function(_0x416bdb){if(_0x416bdb){var _0x5660aa=typeof _0x1a5154[_0xab77('0x1b')]===_0xab77('0x1c')&&typeof _0x1a5154[_0xab77('0x1d')]==='undefined';var _0x4f8e3e=_0x416bdb[_0xab77('0x1e')];var _0x4ad415=_0x5660aa?0x0:_0x1a5154[_0xab77('0x1b')];var _0x4646ae=_0x5660aa?_0x416bdb[_0xab77('0x1e')]:_0x1a5154[_0xab77('0x1b')]+_0x1a5154[_0xab77('0x1d')];var _0x49d4e3;if(_0x4646ae>=_0x4f8e3e){_0x4646ae=_0x4f8e3e;_0x49d4e3=0xc8;}else{_0x49d4e3=0xce;}_0x3cdb73[_0xab77('0x19')](_0x49d4e3);return _0x3cdb73[_0xab77('0x1f')](_0xab77('0x20'),_0x4ad415+'-'+_0x4646ae+'/'+_0x4f8e3e)[_0xab77('0x21')](_0x416bdb);}return null;};}function patchUpdates(_0x5a0d8e){return function(_0x10d8eb){try{jsonpatch['apply'](_0x10d8eb,_0x5a0d8e,!![]);}catch(_0x2661e8){return BPromise[_0xab77('0x22')](_0x2661e8);}return _0x10d8eb[_0xab77('0x23')]();};}function saveUpdates(_0x560eec,_0xf9d7ec){return function(_0x216f58){if(_0x216f58){return _0x216f58['update'](_0x560eec)['then'](function(_0x20fe26){return _0x20fe26;});}return null;};}function removeEntity(_0x301868,_0x443008){return function(_0x2fcc99){if(_0x2fcc99){return _0x2fcc99[_0xab77('0x24')]()[_0xab77('0x25')](function(){_0x301868[_0xab77('0x19')](0xcc)[_0xab77('0x1a')]();});}};}function handleEntityNotFound(_0x5b7537,_0x16334f){return function(_0x59f745){if(!_0x59f745){_0x5b7537['sendStatus'](0x194);}return _0x59f745;};}function handleError(_0x2d2ec4,_0x8d026b){_0x8d026b=_0x8d026b||0x1f4;return function(_0x4859f7){logger[_0xab77('0x26')](_0x4859f7[_0xab77('0x27')]);if(_0x4859f7['name']){delete _0x4859f7[_0xab77('0x28')];}_0x2d2ec4[_0xab77('0x19')](_0x8d026b)['send'](_0x4859f7);};}exports[_0xab77('0x29')]=function(_0x2f1961,_0x35fa37){var _0x1a2d2e={},_0x7209de={},_0x22b192={'count':0x0,'rows':[]};var _0x16022f=_[_0xab77('0x2a')](db[_0xab77('0x2b')][_0xab77('0x2c')],function(_0x2f8bb2){return{'name':_0x2f8bb2['fieldName'],'type':_0x2f8bb2['type'][_0xab77('0x2d')]};});_0x7209de[_0xab77('0x2e')]=_[_0xab77('0x2a')](_0x16022f,_0xab77('0x28'));_0x7209de[_0xab77('0x2f')]=_[_0xab77('0x30')](_0x2f1961['query']);_0x7209de[_0xab77('0x31')]=_[_0xab77('0x32')](_0x7209de[_0xab77('0x2e')],_0x7209de['query']);_0x1a2d2e[_0xab77('0x33')]=_[_0xab77('0x32')](_0x7209de[_0xab77('0x2e')],qs[_0xab77('0x34')](_0x2f1961[_0xab77('0x2f')][_0xab77('0x34')]));_0x1a2d2e['attributes']=_0x1a2d2e[_0xab77('0x33')]['length']?_0x1a2d2e[_0xab77('0x33')]:_0x7209de[_0xab77('0x2e')];if(!_0x2f1961['query'][_0xab77('0x35')]('nolimit')){_0x1a2d2e['limit']=qs['limit'](_0x2f1961['query']['limit']);_0x1a2d2e['offset']=qs[_0xab77('0x1b')](_0x2f1961[_0xab77('0x2f')][_0xab77('0x1b')]);}_0x1a2d2e['order']=qs[_0xab77('0x36')](_0x2f1961[_0xab77('0x2f')][_0xab77('0x36')]);_0x1a2d2e[_0xab77('0x37')]=qs[_0xab77('0x31')](_[_0xab77('0x38')](_0x2f1961['query'],_0x7209de[_0xab77('0x31')]),_0x16022f);if(_0x2f1961[_0xab77('0x2f')][_0xab77('0x39')]){_0x1a2d2e[_0xab77('0x37')]=_[_0xab77('0x3a')](_0x1a2d2e['where'],{'$or':_[_0xab77('0x2a')](_0x16022f,function(_0x265f80){if(_0x265f80[_0xab77('0x3b')]!==_0xab77('0x3c')){var _0x244de2={};_0x244de2[_0x265f80['name']]={'$like':'%'+_0x2f1961['query']['filter']+'%'};return _0x244de2;}})});}_0x1a2d2e=_[_0xab77('0x3a')]({},_0x1a2d2e,_0x2f1961[_0xab77('0x3d')]);var _0x109860={'where':_0x1a2d2e[_0xab77('0x37')]};return db['UserProfileSection'][_0xab77('0x1e')](_0x109860)['then'](function(_0x516d3f){_0x22b192[_0xab77('0x1e')]=_0x516d3f;if(_0x2f1961[_0xab77('0x2f')]['includeAll']){_0x1a2d2e['include']=[{'all':!![]}];}return db[_0xab77('0x2b')][_0xab77('0x3e')](_0x1a2d2e);})[_0xab77('0x25')](function(_0x1571b7){_0x22b192['rows']=_0x1571b7;return _0x22b192;})[_0xab77('0x25')](respondWithFilteredResult(_0x35fa37,_0x1a2d2e))[_0xab77('0x3f')](handleError(_0x35fa37,null));};exports['show']=function(_0x226359,_0x3aeb8e){var _0x493d13={'raw':![],'where':{'id':_0x226359[_0xab77('0x40')]['id']}},_0x382a9c={};_0x382a9c[_0xab77('0x2e')]=_[_0xab77('0x30')](db[_0xab77('0x2b')][_0xab77('0x2c')]);_0x382a9c['query']=_[_0xab77('0x30')](_0x226359['query']);_0x382a9c[_0xab77('0x31')]=_[_0xab77('0x32')](_0x382a9c[_0xab77('0x2e')],_0x382a9c['query']);_0x493d13[_0xab77('0x33')]=_[_0xab77('0x32')](_0x382a9c[_0xab77('0x2e')],qs[_0xab77('0x34')](_0x226359[_0xab77('0x2f')][_0xab77('0x34')]));_0x493d13[_0xab77('0x33')]=_0x493d13[_0xab77('0x33')][_0xab77('0x41')]?_0x493d13[_0xab77('0x33')]:_0x382a9c[_0xab77('0x2e')];if(_0x226359[_0xab77('0x2f')][_0xab77('0x42')]){_0x493d13[_0xab77('0x43')]=[{'all':!![]}];}_0x493d13=_[_0xab77('0x3a')]({},_0x493d13,_0x226359['options']);return db['UserProfileSection']['find'](_0x493d13)[_0xab77('0x25')](handleEntityNotFound(_0x3aeb8e,null))['then'](respondWithResult(_0x3aeb8e,null))[_0xab77('0x3f')](handleError(_0x3aeb8e,null));};exports[_0xab77('0x44')]=function(_0x5c73ab,_0x27582f){return db[_0xab77('0x2b')][_0xab77('0x44')](_0x5c73ab[_0xab77('0x45')],{})['then'](respondWithResult(_0x27582f,0xc9))[_0xab77('0x3f')](handleError(_0x27582f,null));};exports[_0xab77('0x46')]=function(_0x3a68df,_0x75112d){if(_0x3a68df[_0xab77('0x45')]['id']){delete _0x3a68df[_0xab77('0x45')]['id'];}return db[_0xab77('0x2b')]['find']({'where':{'id':_0x3a68df[_0xab77('0x40')]['id']}})[_0xab77('0x25')](handleEntityNotFound(_0x75112d,null))[_0xab77('0x25')](saveUpdates(_0x3a68df[_0xab77('0x45')],null))[_0xab77('0x25')](respondWithResult(_0x75112d,null))['catch'](handleError(_0x75112d,null));};exports[_0xab77('0x24')]=function(_0x3cbfcf,_0x3b16d0){return db[_0xab77('0x2b')][_0xab77('0x47')]({'where':{'id':_0x3cbfcf[_0xab77('0x40')]['id']}})[_0xab77('0x25')](handleEntityNotFound(_0x3b16d0,null))[_0xab77('0x25')](removeEntity(_0x3b16d0,null))[_0xab77('0x3f')](handleError(_0x3b16d0,null));};exports[_0xab77('0x48')]=function(_0x592a5f,_0x18bece){return db[_0xab77('0x2b')][_0xab77('0x48')]()[_0xab77('0x25')](respondWithResult(_0x18bece,null))['catch'](handleError(_0x18bece,null));}; \ No newline at end of file +var _0xbf6f=['squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','UserProfileSection','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash'];(function(_0x340da7,_0x13d6fc){var _0x43b466=function(_0x59e11e){while(--_0x59e11e){_0x340da7['push'](_0x340da7['shift']());}};_0x43b466(++_0x13d6fc);}(_0xbf6f,0xd9));var _0xfbf6=function(_0x460561,_0x400139){_0x460561=_0x460561-0x0;var _0x25fac2=_0xbf6f[_0x460561];return _0x25fac2;};'use strict';var emlformat=require(_0xfbf6('0x0'));var rimraf=require(_0xfbf6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfbf6('0x2'));var rp=require(_0xfbf6('0x3'));var moment=require(_0xfbf6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfbf6('0x5'));var util=require(_0xfbf6('0x6'));var path=require(_0xfbf6('0x7'));var sox=require('sox');var csv=require(_0xfbf6('0x8'));var ejs=require(_0xfbf6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbf6('0xa'));var squel=require(_0xfbf6('0xb'));var crypto=require(_0xfbf6('0xc'));var jsforce=require(_0xfbf6('0xd'));var deskjs=require(_0xfbf6('0xe'));var toCsv=require(_0xfbf6('0x8'));var querystring=require(_0xfbf6('0xf'));var Papa=require(_0xfbf6('0x10'));var Redis=require(_0xfbf6('0x11'));var authService=require(_0xfbf6('0x12'));var qs=require(_0xfbf6('0x13'));var as=require(_0xfbf6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfbf6('0x15'));var utils=require(_0xfbf6('0x16'));var config=require(_0xfbf6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfbf6('0x18'))['db'];function respondWithStatusCode(_0x3b2b7a,_0x1b4392){_0x1b4392=_0x1b4392||0xcc;return function(_0xb7483a){if(_0xb7483a){return _0x3b2b7a[_0xfbf6('0x19')](_0x1b4392);}return _0x3b2b7a[_0xfbf6('0x1a')](_0x1b4392)[_0xfbf6('0x1b')]();};}function respondWithResult(_0x1be1f8,_0x33fbfe){_0x33fbfe=_0x33fbfe||0xc8;return function(_0x447290){if(_0x447290){return _0x1be1f8[_0xfbf6('0x1a')](_0x33fbfe)[_0xfbf6('0x1c')](_0x447290);}};}function respondWithFilteredResult(_0x3fcf26,_0x2a8533){return function(_0x3617a4){if(_0x3617a4){var _0x1634b8=typeof _0x2a8533[_0xfbf6('0x1d')]===_0xfbf6('0x1e')&&typeof _0x2a8533[_0xfbf6('0x1f')]===_0xfbf6('0x1e');var _0x1832f6=_0x3617a4[_0xfbf6('0x20')];var _0x21c8ad=_0x1634b8?0x0:_0x2a8533['offset'];var _0x48adef=_0x1634b8?_0x3617a4[_0xfbf6('0x20')]:_0x2a8533[_0xfbf6('0x1d')]+_0x2a8533[_0xfbf6('0x1f')];var _0x4315df;if(_0x48adef>=_0x1832f6){_0x48adef=_0x1832f6;_0x4315df=0xc8;}else{_0x4315df=0xce;}_0x3fcf26[_0xfbf6('0x1a')](_0x4315df);return _0x3fcf26[_0xfbf6('0x21')](_0xfbf6('0x22'),_0x21c8ad+'-'+_0x48adef+'/'+_0x1832f6)['json'](_0x3617a4);}return null;};}function patchUpdates(_0x473927){return function(_0x259d28){try{jsonpatch[_0xfbf6('0x23')](_0x259d28,_0x473927,!![]);}catch(_0x24ccda){return BPromise[_0xfbf6('0x24')](_0x24ccda);}return _0x259d28['save']();};}function saveUpdates(_0x3f561d,_0x47d419){return function(_0x1de873){if(_0x1de873){return _0x1de873[_0xfbf6('0x25')](_0x3f561d)[_0xfbf6('0x26')](function(_0x2089fb){return _0x2089fb;});}return null;};}function removeEntity(_0x35d76c,_0x456513){return function(_0x426a2b){if(_0x426a2b){return _0x426a2b[_0xfbf6('0x27')]()[_0xfbf6('0x26')](function(){_0x35d76c[_0xfbf6('0x1a')](0xcc)[_0xfbf6('0x1b')]();});}};}function handleEntityNotFound(_0x10aa4a,_0x3fc15f){return function(_0x47fea9){if(!_0x47fea9){_0x10aa4a[_0xfbf6('0x19')](0x194);}return _0x47fea9;};}function handleError(_0x3f730c,_0x2173ee){_0x2173ee=_0x2173ee||0x1f4;return function(_0x45f77c){logger[_0xfbf6('0x28')](_0x45f77c[_0xfbf6('0x29')]);if(_0x45f77c[_0xfbf6('0x2a')]){delete _0x45f77c[_0xfbf6('0x2a')];}_0x3f730c['status'](_0x2173ee)['send'](_0x45f77c);};}exports[_0xfbf6('0x2b')]=function(_0x297e57,_0xac0442){var _0x2d39f3={},_0x3b427a={},_0x89fb78={'count':0x0,'rows':[]};var _0x3da299=_[_0xfbf6('0x2c')](db[_0xfbf6('0x2d')][_0xfbf6('0x2e')],function(_0x3175eb){return{'name':_0x3175eb['fieldName'],'type':_0x3175eb['type'][_0xfbf6('0x2f')]};});_0x3b427a[_0xfbf6('0x30')]=_[_0xfbf6('0x2c')](_0x3da299,_0xfbf6('0x2a'));_0x3b427a[_0xfbf6('0x31')]=_[_0xfbf6('0x32')](_0x297e57['query']);_0x3b427a[_0xfbf6('0x33')]=_[_0xfbf6('0x34')](_0x3b427a[_0xfbf6('0x30')],_0x3b427a[_0xfbf6('0x31')]);_0x2d39f3['attributes']=_[_0xfbf6('0x34')](_0x3b427a[_0xfbf6('0x30')],qs[_0xfbf6('0x35')](_0x297e57[_0xfbf6('0x31')][_0xfbf6('0x35')]));_0x2d39f3[_0xfbf6('0x36')]=_0x2d39f3[_0xfbf6('0x36')][_0xfbf6('0x37')]?_0x2d39f3['attributes']:_0x3b427a[_0xfbf6('0x30')];if(!_0x297e57[_0xfbf6('0x31')]['hasOwnProperty'](_0xfbf6('0x38'))){_0x2d39f3[_0xfbf6('0x1f')]=qs[_0xfbf6('0x1f')](_0x297e57[_0xfbf6('0x31')][_0xfbf6('0x1f')]);_0x2d39f3[_0xfbf6('0x1d')]=qs['offset'](_0x297e57[_0xfbf6('0x31')]['offset']);}_0x2d39f3[_0xfbf6('0x39')]=qs[_0xfbf6('0x3a')](_0x297e57[_0xfbf6('0x31')]['sort']);_0x2d39f3[_0xfbf6('0x3b')]=qs['filters'](_['pick'](_0x297e57[_0xfbf6('0x31')],_0x3b427a[_0xfbf6('0x33')]),_0x3da299);if(_0x297e57[_0xfbf6('0x31')][_0xfbf6('0x3c')]){_0x2d39f3[_0xfbf6('0x3b')]=_[_0xfbf6('0x3d')](_0x2d39f3['where'],{'$or':_[_0xfbf6('0x2c')](_0x3da299,function(_0x403508){if(_0x403508[_0xfbf6('0x3e')]!==_0xfbf6('0x3f')){var _0x11722f={};_0x11722f[_0x403508[_0xfbf6('0x2a')]]={'$like':'%'+_0x297e57[_0xfbf6('0x31')][_0xfbf6('0x3c')]+'%'};return _0x11722f;}})});}_0x2d39f3=_[_0xfbf6('0x3d')]({},_0x2d39f3,_0x297e57[_0xfbf6('0x40')]);var _0x45530c={'where':_0x2d39f3[_0xfbf6('0x3b')]};return db[_0xfbf6('0x2d')][_0xfbf6('0x20')](_0x45530c)[_0xfbf6('0x26')](function(_0x55f16f){_0x89fb78[_0xfbf6('0x20')]=_0x55f16f;if(_0x297e57['query'][_0xfbf6('0x41')]){_0x2d39f3[_0xfbf6('0x42')]=[{'all':!![]}];}return db[_0xfbf6('0x2d')][_0xfbf6('0x43')](_0x2d39f3);})[_0xfbf6('0x26')](function(_0x2aac17){_0x89fb78[_0xfbf6('0x44')]=_0x2aac17;return _0x89fb78;})['then'](respondWithFilteredResult(_0xac0442,_0x2d39f3))[_0xfbf6('0x45')](handleError(_0xac0442,null));};exports[_0xfbf6('0x46')]=function(_0x51e168,_0x57e1e5){var _0x4d6d59={'raw':![],'where':{'id':_0x51e168[_0xfbf6('0x47')]['id']}},_0x36750c={};_0x36750c['model']=_[_0xfbf6('0x32')](db[_0xfbf6('0x2d')][_0xfbf6('0x2e')]);_0x36750c[_0xfbf6('0x31')]=_[_0xfbf6('0x32')](_0x51e168[_0xfbf6('0x31')]);_0x36750c[_0xfbf6('0x33')]=_[_0xfbf6('0x34')](_0x36750c['model'],_0x36750c['query']);_0x4d6d59['attributes']=_[_0xfbf6('0x34')](_0x36750c[_0xfbf6('0x30')],qs[_0xfbf6('0x35')](_0x51e168[_0xfbf6('0x31')][_0xfbf6('0x35')]));_0x4d6d59['attributes']=_0x4d6d59[_0xfbf6('0x36')][_0xfbf6('0x37')]?_0x4d6d59[_0xfbf6('0x36')]:_0x36750c[_0xfbf6('0x30')];if(_0x51e168[_0xfbf6('0x31')][_0xfbf6('0x41')]){_0x4d6d59['include']=[{'all':!![]}];}_0x4d6d59=_[_0xfbf6('0x3d')]({},_0x4d6d59,_0x51e168['options']);return db['UserProfileSection']['find'](_0x4d6d59)[_0xfbf6('0x26')](handleEntityNotFound(_0x57e1e5,null))[_0xfbf6('0x26')](respondWithResult(_0x57e1e5,null))[_0xfbf6('0x45')](handleError(_0x57e1e5,null));};exports['create']=function(_0x2b8d5d,_0xbebab5){return db[_0xfbf6('0x2d')][_0xfbf6('0x48')](_0x2b8d5d[_0xfbf6('0x49')],{})[_0xfbf6('0x26')](respondWithResult(_0xbebab5,0xc9))[_0xfbf6('0x45')](handleError(_0xbebab5,null));};exports['update']=function(_0x3c80f0,_0x32860f){if(_0x3c80f0['body']['id']){delete _0x3c80f0[_0xfbf6('0x49')]['id'];}return db[_0xfbf6('0x2d')][_0xfbf6('0x4a')]({'where':{'id':_0x3c80f0[_0xfbf6('0x47')]['id']}})[_0xfbf6('0x26')](handleEntityNotFound(_0x32860f,null))['then'](saveUpdates(_0x3c80f0[_0xfbf6('0x49')],null))[_0xfbf6('0x26')](respondWithResult(_0x32860f,null))[_0xfbf6('0x45')](handleError(_0x32860f,null));};exports[_0xfbf6('0x27')]=function(_0x595323,_0x29396f){return db[_0xfbf6('0x2d')][_0xfbf6('0x4a')]({'where':{'id':_0x595323[_0xfbf6('0x47')]['id']}})['then'](handleEntityNotFound(_0x29396f,null))[_0xfbf6('0x26')](removeEntity(_0x29396f,null))[_0xfbf6('0x45')](handleError(_0x29396f,null));};exports['describe']=function(_0x3a42a8,_0x9150fa){return db[_0xfbf6('0x2d')][_0xfbf6('0x4b')]()['then'](respondWithResult(_0x9150fa,null))[_0xfbf6('0x45')](handleError(_0x9150fa,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 4bb9f5d..518e68a 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 _0xce9d=['api','moment','bluebird','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','userProfileId','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xce9d,0x142));var _0xdce9=function(_0x1612f0,_0x452fa9){_0x1612f0=_0x1612f0-0x0;var _0xc92af7=_0xce9d[_0x1612f0];return _0xc92af7;};'use strict';var _=require('lodash');var util=require(_0xdce9('0x0'));var logger=require(_0xdce9('0x1'))(_0xdce9('0x2'));var moment=require(_0xdce9('0x3'));var BPromise=require(_0xdce9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdce9('0x5'));var attributes=require(_0xdce9('0x6'));module[_0xdce9('0x7')]=function(_0x274158,_0x41922f){return _0x274158[_0xdce9('0x8')](_0xdce9('0x9'),attributes,{'tableName':_0xdce9('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0xdce9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x33e2=['compositeIndex','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections'];(function(_0x24d451,_0x4b5a2d){var _0x5015bd=function(_0x491952){while(--_0x491952){_0x24d451['push'](_0x24d451['shift']());}};_0x5015bd(++_0x4b5a2d);}(_0x33e2,0x119));var _0x233e=function(_0xbf1875,_0x34b144){_0xbf1875=_0xbf1875-0x0;var _0x2e598b=_0x33e2[_0xbf1875];return _0x2e598b;};'use strict';var _=require(_0x233e('0x0'));var util=require(_0x233e('0x1'));var logger=require(_0x233e('0x2'))('api');var moment=require(_0x233e('0x3'));var BPromise=require(_0x233e('0x4'));var rp=require(_0x233e('0x5'));var fs=require('fs');var path=require(_0x233e('0x6'));var rimraf=require(_0x233e('0x7'));var config=require('../../config/environment');var attributes=require(_0x233e('0x8'));module[_0x233e('0x9')]=function(_0x40968c,_0x20b330){return _0x40968c[_0x233e('0xa')](_0x233e('0xb'),attributes,{'tableName':_0x233e('0xc'),'paranoid':![],'indexes':[{'name':_0x233e('0xd'),'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 33d4d59..037901c 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 _0x138c=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','UserProfileSection,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb'];(function(_0x327ef9,_0x217299){var _0x378a72=function(_0x3c92e4){while(--_0x3c92e4){_0x327ef9['push'](_0x327ef9['shift']());}};_0x378a72(++_0x217299);}(_0x138c,0x13c));var _0xc138=function(_0x21e351,_0x1f2ef8){_0x21e351=_0x21e351-0x0;var _0x6ccaa9=_0x138c[_0x21e351];return _0x6ccaa9;};'use strict';var _=require('lodash');var util=require(_0xc138('0x0'));var moment=require(_0xc138('0x1'));var BPromise=require(_0xc138('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc138('0x3'))['db'];var utils=require(_0xc138('0x4'));var logger=require(_0xc138('0x5'))(_0xc138('0x6'));var config=require(_0xc138('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc138('0x8')][_0xc138('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x357ff7,_0x5a2ed4,_0x8f20ec){return new BPromise(function(_0x2a5e72,_0x4fa699){return client['request'](_0x357ff7,_0x8f20ec)['then'](function(_0x350f9e){logger[_0xc138('0xa')]('UserProfileSection,\x20%s,\x20%s',_0x5a2ed4,_0xc138('0xb'));logger[_0xc138('0xc')](_0xc138('0xd'),_0x5a2ed4,_0xc138('0xb'),JSON[_0xc138('0xe')](_0x350f9e));if(_0x350f9e[_0xc138('0xf')]){if(_0x350f9e[_0xc138('0xf')]['code']===0x1f4){logger[_0xc138('0xf')](_0xc138('0x10'),_0x5a2ed4,_0x350f9e[_0xc138('0xf')][_0xc138('0x11')]);return _0x4fa699(_0x350f9e[_0xc138('0xf')][_0xc138('0x11')]);}logger['error'](_0xc138('0x10'),_0x5a2ed4,_0x350f9e[_0xc138('0xf')][_0xc138('0x11')]);return _0x2a5e72(_0x350f9e['error'][_0xc138('0x11')]);}else{logger[_0xc138('0xa')](_0xc138('0x10'),_0x5a2ed4,_0xc138('0xb'));_0x2a5e72(_0x350f9e[_0xc138('0x12')][_0xc138('0x11')]);}})[_0xc138('0x13')](function(_0x45d863){logger[_0xc138('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x5a2ed4,_0x45d863);_0x4fa699(_0x45d863);});});} \ No newline at end of file +var _0x3b0d=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x3b0d,0x87));var _0xd3b0=function(_0x5773e0,_0x42143c){_0x5773e0=_0x5773e0-0x0;var _0x4ece69=_0x3b0d[_0x5773e0];return _0x4ece69;};'use strict';var _=require(_0xd3b0('0x0'));var util=require(_0xd3b0('0x1'));var moment=require('moment');var BPromise=require(_0xd3b0('0x2'));var rs=require(_0xd3b0('0x3'));var fs=require('fs');var Redis=require(_0xd3b0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd3b0('0x5'));var logger=require(_0xd3b0('0x6'))(_0xd3b0('0x7'));var config=require('../../config/environment');var jayson=require(_0xd3b0('0x8'));var client=jayson[_0xd3b0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a27e,_0x58c3bb,_0x23353d){return new BPromise(function(_0x30bc53,_0x1b10fc){return client[_0xd3b0('0xa')](_0x5a27e,_0x23353d)[_0xd3b0('0xb')](function(_0x118b1c){logger[_0xd3b0('0xc')](_0xd3b0('0xd'),_0x58c3bb,_0xd3b0('0xe'));logger[_0xd3b0('0xf')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x58c3bb,_0xd3b0('0xe'),JSON[_0xd3b0('0x10')](_0x118b1c));if(_0x118b1c[_0xd3b0('0x11')]){if(_0x118b1c['error'][_0xd3b0('0x12')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x58c3bb,_0x118b1c[_0xd3b0('0x11')][_0xd3b0('0x13')]);return _0x1b10fc(_0x118b1c[_0xd3b0('0x11')][_0xd3b0('0x13')]);}logger[_0xd3b0('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x58c3bb,_0x118b1c['error'][_0xd3b0('0x13')]);return _0x30bc53(_0x118b1c[_0xd3b0('0x11')]['message']);}else{logger['info'](_0xd3b0('0xd'),_0x58c3bb,'request\x20sent');_0x30bc53(_0x118b1c[_0xd3b0('0x14')][_0xd3b0('0x13')]);}})[_0xd3b0('0x15')](function(_0x532aec){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x58c3bb,_0x532aec);_0x1b10fc(_0x532aec);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index b3b23c9..973a638 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2d2a9b,_0x5870ff){var _0x3d2d49=function(_0x13884d){while(--_0x13884d){_0x2d2a9b['push'](_0x2d2a9b['shift']());}};_0x3d2d49(++_0x5870ff);}(_0x9c44,0x178));var _0x49c4=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x9c44[_0x5d2803];return _0xdcad2c;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3d0ab3,_0x2e1926){var _0x17fd2c=function(_0x237c2e){while(--_0x237c2e){_0x3d0ab3['push'](_0x3d0ab3['shift']());}};_0x17fd2c(++_0x2e1926);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index a5f31b6..c9a0b05 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 _0xc253=['exports','sequelize'];(function(_0x2310cb,_0x5067a3){var _0x3a35b2=function(_0x4c98fe){while(--_0x4c98fe){_0x2310cb['push'](_0x2310cb['shift']());}};_0x3a35b2(++_0x5067a3);}(_0xc253,0x125));var _0x3c25=function(_0xea343d,_0x311197){_0xea343d=_0xea343d-0x0;var _0x2c6e9c=_0xc253[_0xea343d];return _0x2c6e9c;};'use strict';var Sequelize=require(_0x3c25('0x0'));module[_0x3c25('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x5203=['INTEGER','sequelize','exports'];(function(_0x53bad1,_0x37d39b){var _0x451b16=function(_0x5984ac){while(--_0x5984ac){_0x53bad1['push'](_0x53bad1['shift']());}};_0x451b16(++_0x37d39b);}(_0x5203,0xd3));var _0x3520=function(_0x5b3904,_0x302d9b){_0x5b3904=_0x5b3904-0x0;var _0x2f560a=_0x5203[_0x5b3904];return _0x2f560a;};'use strict';var Sequelize=require(_0x3520('0x0'));module[_0x3520('0x1')]={'penalty':{'type':Sequelize[_0x3520('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 4720129..84e12c0 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 _0x49c1=['../../config/logger','api','moment','request-promise','path','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','lodash'];(function(_0x29e3e8,_0x57bf1a){var _0x103eb8=function(_0x27c43d){while(--_0x27c43d){_0x29e3e8['push'](_0x29e3e8['shift']());}};_0x103eb8(++_0x57bf1a);}(_0x49c1,0xef));var _0x149c=function(_0x2c6de9,_0x29480b){_0x2c6de9=_0x2c6de9-0x0;var _0x32b31a=_0x49c1[_0x2c6de9];return _0x32b31a;};'use strict';var _=require(_0x149c('0x0'));var util=require('util');var logger=require(_0x149c('0x1'))(_0x149c('0x2'));var moment=require(_0x149c('0x3'));var BPromise=require('bluebird');var rp=require(_0x149c('0x4'));var fs=require('fs');var path=require(_0x149c('0x5'));var rimraf=require('rimraf');var config=require(_0x149c('0x6'));var attributes=require(_0x149c('0x7'));module['exports']=function(_0x46c725,_0x561d00){return _0x46c725[_0x149c('0x8')](_0x149c('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8506=['util','api','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x143792,_0x280dff){var _0x187063=function(_0x5312bb){while(--_0x5312bb){_0x143792['push'](_0x143792['shift']());}};_0x187063(++_0x280dff);}(_0x8506,0xe8));var _0x6850=function(_0xdcf063,_0x5e52d6){_0xdcf063=_0xdcf063-0x0;var _0x38e407=_0x8506[_0xdcf063];return _0x38e407;};'use strict';var _=require('lodash');var util=require(_0x6850('0x0'));var logger=require('../../config/logger')(_0x6850('0x1'));var moment=require('moment');var BPromise=require(_0x6850('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6850('0x3'));var rimraf=require(_0x6850('0x4'));var config=require(_0x6850('0x5'));var attributes=require('./userSmsQueue.attributes');module[_0x6850('0x6')]=function(_0x372f0b,_0x232459){return _0x372f0b[_0x6850('0x7')]('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 be995d3..af0966f 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 _0x162d=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x305486,_0x24acd4){var _0xa04940=function(_0x29e866){while(--_0x29e866){_0x305486['push'](_0x305486['shift']());}};_0xa04940(++_0x24acd4);}(_0x162d,0x10b));var _0xd162=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x162d[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xd162('0x0'));var util=require(_0xd162('0x1'));var moment=require(_0xd162('0x2'));var BPromise=require(_0xd162('0x3'));var rs=require(_0xd162('0x4'));var fs=require('fs');var Redis=require(_0xd162('0x5'));var db=require(_0xd162('0x6'))['db'];var utils=require(_0xd162('0x7'));var logger=require('../../config/logger')(_0xd162('0x8'));var config=require(_0xd162('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd162('0xa')][_0xd162('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41a2cc,_0x4e7f90,_0xca04f1){return new BPromise(function(_0x33c6ea,_0x373cd4){return client[_0xd162('0xc')](_0x41a2cc,_0xca04f1)[_0xd162('0xd')](function(_0x48888d){logger[_0xd162('0xe')](_0xd162('0xf'),_0x4e7f90,_0xd162('0x10'));logger[_0xd162('0x11')](_0xd162('0x12'),_0x4e7f90,'request\x20sent',JSON['stringify'](_0x48888d));if(_0x48888d[_0xd162('0x13')]){if(_0x48888d[_0xd162('0x13')][_0xd162('0x14')]===0x1f4){logger['error'](_0xd162('0xf'),_0x4e7f90,_0x48888d[_0xd162('0x13')][_0xd162('0x15')]);return _0x373cd4(_0x48888d[_0xd162('0x13')][_0xd162('0x15')]);}logger['error'](_0xd162('0xf'),_0x4e7f90,_0x48888d[_0xd162('0x13')][_0xd162('0x15')]);return _0x33c6ea(_0x48888d[_0xd162('0x13')][_0xd162('0x15')]);}else{logger['info'](_0xd162('0xf'),_0x4e7f90,_0xd162('0x10'));_0x33c6ea(_0x48888d[_0xd162('0x16')][_0xd162('0x15')]);}})[_0xd162('0x17')](function(_0x71ec3f){logger[_0xd162('0x13')](_0xd162('0xf'),_0x4e7f90,_0x71ec3f);_0x373cd4(_0x71ec3f);});});} \ No newline at end of file +var _0x2ed7=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2fc4ad,_0x10cf24){var _0x59a428=function(_0x42f870){while(--_0x42f870){_0x2fc4ad['push'](_0x2fc4ad['shift']());}};_0x59a428(++_0x10cf24);}(_0x2ed7,0x111));var _0x72ed=function(_0x440e1c,_0x69cf94){_0x440e1c=_0x440e1c-0x0;var _0x372ba9=_0x2ed7[_0x440e1c];return _0x372ba9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x72ed('0x0'));var BPromise=require('bluebird');var rs=require(_0x72ed('0x1'));var fs=require('fs');var Redis=require(_0x72ed('0x2'));var db=require(_0x72ed('0x3'))['db'];var utils=require(_0x72ed('0x4'));var logger=require(_0x72ed('0x5'))(_0x72ed('0x6'));var config=require('../../config/environment');var jayson=require(_0x72ed('0x7'));var client=jayson[_0x72ed('0x8')][_0x72ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53c281,_0x367f9a,_0x43f9d2){return new BPromise(function(_0x58c533,_0x5f4657){return client[_0x72ed('0xa')](_0x53c281,_0x43f9d2)[_0x72ed('0xb')](function(_0x3b2736){logger[_0x72ed('0xc')](_0x72ed('0xd'),_0x367f9a,_0x72ed('0xe'));logger[_0x72ed('0xf')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x367f9a,_0x72ed('0xe'),JSON[_0x72ed('0x10')](_0x3b2736));if(_0x3b2736[_0x72ed('0x11')]){if(_0x3b2736['error'][_0x72ed('0x12')]===0x1f4){logger[_0x72ed('0x11')](_0x72ed('0xd'),_0x367f9a,_0x3b2736['error'][_0x72ed('0x13')]);return _0x5f4657(_0x3b2736[_0x72ed('0x11')][_0x72ed('0x13')]);}logger['error'](_0x72ed('0xd'),_0x367f9a,_0x3b2736['error'][_0x72ed('0x13')]);return _0x58c533(_0x3b2736[_0x72ed('0x11')][_0x72ed('0x13')]);}else{logger[_0x72ed('0xc')](_0x72ed('0xd'),_0x367f9a,'request\x20sent');_0x58c533(_0x3b2736[_0x72ed('0x14')][_0x72ed('0x13')]);}})[_0x72ed('0x15')](function(_0x48439a){logger['error'](_0x72ed('0xd'),_0x367f9a,_0x48439a);_0x5f4657(_0x48439a);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/index.js b/server/api/userVoicePrefix/index.js index 2b747ac..b8de353 100644 --- a/server/api/userVoicePrefix/index.js +++ b/server/api/userVoicePrefix/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(_0x4628c6,_0x212c5e){var _0x181ddc=function(_0x36280a){while(--_0x36280a){_0x4628c6['push'](_0x4628c6['shift']());}};_0x181ddc(++_0x212c5e);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x31fb16,_0x3a4f55){var _0x50f4b7=function(_0x42f60f){while(--_0x42f60f){_0x31fb16['push'](_0x31fb16['shift']());}};_0x50f4b7(++_0x3a4f55);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 6082657..1e6e044 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 _0x7008=['exports','INTEGER','sequelize'];(function(_0x4eb4b2,_0x15c6f5){var _0x586371=function(_0xc51689){while(--_0xc51689){_0x4eb4b2['push'](_0x4eb4b2['shift']());}};_0x586371(++_0x15c6f5);}(_0x7008,0x86));var _0x8700=function(_0x16dca1,_0x37c40a){_0x16dca1=_0x16dca1-0x0;var _0xa8787d=_0x7008[_0x16dca1];return _0xa8787d;};'use strict';var Sequelize=require(_0x8700('0x0'));module[_0x8700('0x1')]={'UserId':{'type':Sequelize[_0x8700('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x8700('0x2')]}}; \ No newline at end of file +var _0x0efd=['INTEGER','exports'];(function(_0x388550,_0x3fd74b){var _0x735860=function(_0x50783c){while(--_0x50783c){_0x388550['push'](_0x388550['shift']());}};_0x735860(++_0x3fd74b);}(_0x0efd,0xcb));var _0xd0ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0efd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xd0ef('0x0')]={'UserId':{'type':Sequelize[_0xd0ef('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xd0ef('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 539cf2e..202c436 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(_0x5e478d,_0x4f7720){var _0x2e4b66=function(_0x31796e){while(--_0x31796e){_0x5e478d['push'](_0x5e478d['shift']());}};_0x2e4b66(++_0x4f7720);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x325fac,_0x3449ed){var _0x26e730=function(_0x5decb7){while(--_0x5decb7){_0x325fac['push'](_0x325fac['shift']());}};_0x26e730(++_0x3449ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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/userVoicePrefix/userVoicePrefix.rpc.js b/server/api/userVoicePrefix/userVoicePrefix.rpc.js index 88444e6..daae999 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.rpc.js +++ b/server/api/userVoicePrefix/userVoicePrefix.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x12ab=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','UserVoicePrefix,\x20%s,\x20%s','request\x20sent','UserVoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4c50d2,_0x157990){var _0x3dbb08=function(_0xc0806a){while(--_0xc0806a){_0x4c50d2['push'](_0x4c50d2['shift']());}};_0x3dbb08(++_0x157990);}(_0x12ab,0xab));var _0xb12a=function(_0x5a8544,_0x5a3ece){_0x5a8544=_0x5a8544-0x0;var _0x301c65=_0x12ab[_0x5a8544];return _0x301c65;};'use strict';var _=require(_0xb12a('0x0'));var util=require('util');var moment=require(_0xb12a('0x1'));var BPromise=require(_0xb12a('0x2'));var rs=require(_0xb12a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb12a('0x4'))['db'];var utils=require(_0xb12a('0x5'));var logger=require(_0xb12a('0x6'))(_0xb12a('0x7'));var config=require('../../config/environment');var jayson=require(_0xb12a('0x8'));var client=jayson['client'][_0xb12a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x402345,_0x190993,_0x3ed5ad){return new BPromise(function(_0x1bf197,_0x29e5a3){return client['request'](_0x402345,_0x3ed5ad)[_0xb12a('0xa')](function(_0x52927){logger[_0xb12a('0xb')](_0xb12a('0xc'),_0x190993,_0xb12a('0xd'));logger['debug'](_0xb12a('0xe'),_0x190993,_0xb12a('0xd'),JSON[_0xb12a('0xf')](_0x52927));if(_0x52927[_0xb12a('0x10')]){if(_0x52927[_0xb12a('0x10')][_0xb12a('0x11')]===0x1f4){logger[_0xb12a('0x10')](_0xb12a('0xc'),_0x190993,_0x52927[_0xb12a('0x10')][_0xb12a('0x12')]);return _0x29e5a3(_0x52927[_0xb12a('0x10')][_0xb12a('0x12')]);}logger[_0xb12a('0x10')](_0xb12a('0xc'),_0x190993,_0x52927[_0xb12a('0x10')][_0xb12a('0x12')]);return _0x1bf197(_0x52927[_0xb12a('0x10')][_0xb12a('0x12')]);}else{logger[_0xb12a('0xb')](_0xb12a('0xc'),_0x190993,'request\x20sent');_0x1bf197(_0x52927[_0xb12a('0x13')]['message']);}})[_0xb12a('0x14')](function(_0x3eb182){logger[_0xb12a('0x10')](_0xb12a('0xc'),_0x190993,_0x3eb182);_0x29e5a3(_0x3eb182);});});} \ No newline at end of file +var _0xf71d=['request\x20sent','debug','UserVoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','client','http','request','then','info','UserVoicePrefix,\x20%s,\x20%s'];(function(_0x28796d,_0x2a9870){var _0x34dce3=function(_0x57afa9){while(--_0x57afa9){_0x28796d['push'](_0x28796d['shift']());}};_0x34dce3(++_0x2a9870);}(_0xf71d,0x1d7));var _0xdf71=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0xf71d[_0x2272b5];return _0x110156;};'use strict';var _=require(_0xdf71('0x0'));var util=require('util');var moment=require(_0xdf71('0x1'));var BPromise=require(_0xdf71('0x2'));var rs=require(_0xdf71('0x3'));var fs=require('fs');var Redis=require(_0xdf71('0x4'));var db=require(_0xdf71('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf71('0x6')][_0xdf71('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x169b5f,_0xae5065,_0x88cc77){return new BPromise(function(_0x118d24,_0x52ef20){return client[_0xdf71('0x8')](_0x169b5f,_0x88cc77)[_0xdf71('0x9')](function(_0x184d75){logger[_0xdf71('0xa')](_0xdf71('0xb'),_0xae5065,_0xdf71('0xc'));logger[_0xdf71('0xd')](_0xdf71('0xe'),_0xae5065,_0xdf71('0xc'),JSON[_0xdf71('0xf')](_0x184d75));if(_0x184d75[_0xdf71('0x10')]){if(_0x184d75[_0xdf71('0x10')][_0xdf71('0x11')]===0x1f4){logger['error'](_0xdf71('0xb'),_0xae5065,_0x184d75[_0xdf71('0x10')][_0xdf71('0x12')]);return _0x52ef20(_0x184d75['error'][_0xdf71('0x12')]);}logger[_0xdf71('0x10')](_0xdf71('0xb'),_0xae5065,_0x184d75['error'][_0xdf71('0x12')]);return _0x118d24(_0x184d75[_0xdf71('0x10')][_0xdf71('0x12')]);}else{logger['info'](_0xdf71('0xb'),_0xae5065,_0xdf71('0xc'));_0x118d24(_0x184d75[_0xdf71('0x13')]['message']);}})[_0xdf71('0x14')](function(_0x3fdf05){logger[_0xdf71('0x10')](_0xdf71('0xb'),_0xae5065,_0x3fdf05);_0x52ef20(_0x3fdf05);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index ca2e57c..1ad943d 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(_0x127b21,_0x29c2b0){var _0x531dd1=function(_0x228527){while(--_0x228527){_0x127b21['push'](_0x127b21['shift']());}};_0x531dd1(++_0x29c2b0);}(_0x70e0,0x17b));var _0x070e=function(_0x19b5d0,_0x5ca19b){_0x19b5d0=_0x19b5d0-0x0;var _0x214d84=_0x70e0[_0x19b5d0];return _0x214d84;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x409c71,_0x33395c){var _0x50fe7d=function(_0x1e88f3){while(--_0x1e88f3){_0x409c71['push'](_0x409c71['shift']());}};_0x50fe7d(++_0x33395c);}(_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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 31b07b0..59fa6a0 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 _0x78bd=['exports','sequelize'];(function(_0x2ddd46,_0x415799){var _0x35bb84=function(_0x1773d8){while(--_0x1773d8){_0x2ddd46['push'](_0x2ddd46['shift']());}};_0x35bb84(++_0x415799);}(_0x78bd,0x17d));var _0xd78b=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0x78bd[_0x46f1a6];return _0x38429a;};'use strict';var Sequelize=require(_0xd78b('0x0'));module[_0xd78b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xea85=['INTEGER','sequelize','exports'];(function(_0x1d28e3,_0x1244da){var _0x5e30d3=function(_0x52aa10){while(--_0x52aa10){_0x1d28e3['push'](_0x1d28e3['shift']());}};_0x5e30d3(++_0x1244da);}(_0xea85,0x1ea));var _0x5ea8=function(_0xfd062c,_0xeb85f2){_0xfd062c=_0xfd062c-0x0;var _0xc14ee9=_0xea85[_0xfd062c];return _0xc14ee9;};'use strict';var Sequelize=require(_0x5ea8('0x0'));module[_0x5ea8('0x1')]={'penalty':{'type':Sequelize[_0x5ea8('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 dfe6e6a..b4e1711 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 _0x624b=['path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x624b,0x85));var _0xb624=function(_0x2c9537,_0x1b5489){_0x2c9537=_0x2c9537-0x0;var _0x2cad40=_0x624b[_0x2c9537];return _0x2cad40;};'use strict';var _=require(_0xb624('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb624('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb624('0x2'));var rimraf=require(_0xb624('0x3'));var config=require(_0xb624('0x4'));var attributes=require(_0xb624('0x5'));module[_0xb624('0x6')]=function(_0x5408a8,_0x28acc4){return _0x5408a8[_0xb624('0x7')]('UserVoiceQueue',attributes,{'tableName':_0xb624('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8115=['define','UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x8115,0x12e));var _0x5811=function(_0x1a9f5d,_0x32afba){_0x1a9f5d=_0x1a9f5d-0x0;var _0x57e193=_0x8115[_0x1a9f5d];return _0x57e193;};'use strict';var _=require(_0x5811('0x0'));var util=require(_0x5811('0x1'));var logger=require('../../config/logger')(_0x5811('0x2'));var moment=require(_0x5811('0x3'));var BPromise=require(_0x5811('0x4'));var rp=require(_0x5811('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5811('0x6'));var config=require(_0x5811('0x7'));var attributes=require(_0x5811('0x8'));module[_0x5811('0x9')]=function(_0x4772d5,_0x4925bb){return _0x4772d5[_0x5811('0xa')](_0x5811('0xb'),attributes,{'tableName':_0x5811('0xc'),'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 d06d160..a683338 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 _0x673f=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','request\x20sent','debug','stringify','error','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4dd479,_0x26d87a){var _0x1b6807=function(_0x2bec19){while(--_0x2bec19){_0x4dd479['push'](_0x4dd479['shift']());}};_0x1b6807(++_0x26d87a);}(_0x673f,0xaa));var _0xf673=function(_0xa3400,_0x3a980a){_0xa3400=_0xa3400-0x0;var _0x33dba2=_0x673f[_0xa3400];return _0x33dba2;};'use strict';var _=require(_0xf673('0x0'));var util=require(_0xf673('0x1'));var moment=require(_0xf673('0x2'));var BPromise=require(_0xf673('0x3'));var rs=require(_0xf673('0x4'));var fs=require('fs');var Redis=require(_0xf673('0x5'));var db=require(_0xf673('0x6'))['db'];var utils=require(_0xf673('0x7'));var logger=require(_0xf673('0x8'))(_0xf673('0x9'));var config=require('../../config/environment');var jayson=require(_0xf673('0xa'));var client=jayson[_0xf673('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f33d5,_0x30c380,_0x57ef45){return new BPromise(function(_0x496792,_0x8ad588){return client[_0xf673('0xc')](_0x4f33d5,_0x57ef45)['then'](function(_0x1bec25){logger[_0xf673('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x30c380,_0xf673('0xe'));logger[_0xf673('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x30c380,_0xf673('0xe'),JSON[_0xf673('0x10')](_0x1bec25));if(_0x1bec25['error']){if(_0x1bec25[_0xf673('0x11')]['code']===0x1f4){logger['error'](_0xf673('0x12'),_0x30c380,_0x1bec25['error'][_0xf673('0x13')]);return _0x8ad588(_0x1bec25[_0xf673('0x11')]['message']);}logger[_0xf673('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x30c380,_0x1bec25['error'][_0xf673('0x13')]);return _0x496792(_0x1bec25[_0xf673('0x11')][_0xf673('0x13')]);}else{logger[_0xf673('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x30c380,'request\x20sent');_0x496792(_0x1bec25[_0xf673('0x14')][_0xf673('0x13')]);}})[_0xf673('0x15')](function(_0x6fe30c){logger[_0xf673('0x11')](_0xf673('0x12'),_0x30c380,_0x6fe30c);_0x8ad588(_0x6fe30c);});});} \ No newline at end of file +var _0x5543=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x18e6e9,_0x174b0d){var _0x3f6b70=function(_0x3e2121){while(--_0x3e2121){_0x18e6e9['push'](_0x18e6e9['shift']());}};_0x3f6b70(++_0x174b0d);}(_0x5543,0xb1));var _0x3554=function(_0x454e6d,_0x1e1f38){_0x454e6d=_0x454e6d-0x0;var _0x4bc294=_0x5543[_0x454e6d];return _0x4bc294;};'use strict';var _=require(_0x3554('0x0'));var util=require(_0x3554('0x1'));var moment=require(_0x3554('0x2'));var BPromise=require(_0x3554('0x3'));var rs=require(_0x3554('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3554('0x5'))['db'];var utils=require(_0x3554('0x6'));var logger=require(_0x3554('0x7'))(_0x3554('0x8'));var config=require(_0x3554('0x9'));var jayson=require(_0x3554('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1e9d7d,_0x57ca94,_0x899411){return new BPromise(function(_0x2e4959,_0x5a53b0){return client[_0x3554('0xb')](_0x1e9d7d,_0x899411)[_0x3554('0xc')](function(_0x47071c){logger[_0x3554('0xd')](_0x3554('0xe'),_0x57ca94,_0x3554('0xf'));logger['debug'](_0x3554('0x10'),_0x57ca94,_0x3554('0xf'),JSON[_0x3554('0x11')](_0x47071c));if(_0x47071c[_0x3554('0x12')]){if(_0x47071c[_0x3554('0x12')][_0x3554('0x13')]===0x1f4){logger[_0x3554('0x12')](_0x3554('0xe'),_0x57ca94,_0x47071c['error'][_0x3554('0x14')]);return _0x5a53b0(_0x47071c[_0x3554('0x12')]['message']);}logger['error'](_0x3554('0xe'),_0x57ca94,_0x47071c[_0x3554('0x12')][_0x3554('0x14')]);return _0x2e4959(_0x47071c[_0x3554('0x12')]['message']);}else{logger['info'](_0x3554('0xe'),_0x57ca94,_0x3554('0xf'));_0x2e4959(_0x47071c[_0x3554('0x15')]['message']);}})[_0x3554('0x16')](function(_0x2ae078){logger[_0x3554('0x12')](_0x3554('0xe'),_0x57ca94,_0x2ae078);_0x5a53b0(_0x2ae078);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index f761fa5..fb384fb 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2db8fc,_0xf3bb6){var _0x13daea=function(_0x207aed){while(--_0x207aed){_0x2db8fc['push'](_0x2db8fc['shift']());}};_0x13daea(++_0xf3bb6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0xcb91[_0x35007a];return _0x574f68;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x48b831,_0x267923){var _0x3f3dfd=function(_0x2f4e8c){while(--_0x2f4e8c){_0x48b831['push'](_0x48b831['shift']());}};_0x3f3dfd(++_0x267923);}(_0xe706,0xa3));var _0x6e70=function(_0x3cfb0d,_0x4df584){_0x3cfb0d=_0x3cfb0d-0x0;var _0x3486b4=_0xe706[_0x3cfb0d];return _0x3486b4;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 859f711..fd4d3a3 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 _0xd27c=['Required\x20by\x20Asterisk','INTEGER','queue_interface','STRING'];(function(_0x44a2fb,_0x487474){var _0x4f4dff=function(_0x59e847){while(--_0x59e847){_0x44a2fb['push'](_0x44a2fb['shift']());}};_0x4f4dff(++_0x487474);}(_0xd27c,0x93));var _0xcd27=function(_0x1ece00,_0x29e271){_0x1ece00=_0x1ece00-0x0;var _0x3019aa=_0xd27c[_0x1ece00];return _0x3019aa;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xcd27('0x0')],'allowNull':![],'comment':_0xcd27('0x1')},'UserId':{'type':Sequelize[_0xcd27('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xcd27('0x0')],'allowNull':![],'unique':_0xcd27('0x3'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xcd27('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xcd27('0x0')],'allowNull':![],'unique':_0xcd27('0x3'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xcd27('0x2')](0xb),'defaultValue':0x0,'comment':_0xcd27('0x1')},'paused':{'type':Sequelize[_0xcd27('0x2')](0xb),'defaultValue':0x0,'comment':_0xcd27('0x1')}}; \ No newline at end of file +var _0x71f7=['Required\x20by\x20Asterisk','STRING','queue_interface','exports','INTEGER'];(function(_0x4691b9,_0x13e2f8){var _0x550a6a=function(_0x2cfbec){while(--_0x2cfbec){_0x4691b9['push'](_0x4691b9['shift']());}};_0x550a6a(++_0x13e2f8);}(_0x71f7,0xbc));var _0x771f=function(_0x1cbf42,_0x5f109c){_0x1cbf42=_0x1cbf42-0x0;var _0x53db59=_0x71f7[_0x1cbf42];return _0x53db59;};'use strict';var Sequelize=require('sequelize');module[_0x771f('0x0')]={'uniqueid':{'type':Sequelize[_0x771f('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x771f('0x2')},'UserId':{'type':Sequelize[_0x771f('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x771f('0x3')],'allowNull':![],'unique':_0x771f('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x771f('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x771f('0x3')],'allowNull':![],'unique':_0x771f('0x4'),'comment':_0x771f('0x2')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x771f('0x2')},'paused':{'type':Sequelize[_0x771f('0x1')](0xb),'defaultValue':0x0,'comment':_0x771f('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 2208918..264ddd5 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 _0xe0fa=['events','../../mysqldb','UserVoiceQueueRt','save','update','emit','hasOwnProperty','hook'];(function(_0xfd5f37,_0x24a79c){var _0x11bd01=function(_0x4ae9bd){while(--_0x4ae9bd){_0xfd5f37['push'](_0xfd5f37['shift']());}};_0x11bd01(++_0x24a79c);}(_0xe0fa,0x120));var _0xae0f=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0xe0fa[_0xf0ec6e];return _0x8bbc27;};'use strict';var EventEmitter=require(_0xae0f('0x0'));var UserVoiceQueueRt=require(_0xae0f('0x1'))['db'][_0xae0f('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xae0f('0x3'),'afterUpdate':_0xae0f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x527a3e){return function(_0x70f53,_0x15fec3,_0x20be9a){UserVoiceQueueRtEvents[_0xae0f('0x5')](_0x527a3e+':'+_0x70f53['id'],_0x70f53);UserVoiceQueueRtEvents[_0xae0f('0x5')](_0x527a3e,_0x70f53);_0x20be9a(null);};}for(var e in events){if(events[_0xae0f('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xae0f('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x5f9e=['../../mysqldb','UserVoiceQueueRt','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x125b80,_0x41db3b){var _0x414ba8=function(_0x1bef00){while(--_0x1bef00){_0x125b80['push'](_0x125b80['shift']());}};_0x414ba8(++_0x41db3b);}(_0x5f9e,0x1ca));var _0xe5f9=function(_0x1bec0d,_0x338db4){_0x1bec0d=_0x1bec0d-0x0;var _0x49e3e3=_0x5f9e[_0x1bec0d];return _0x49e3e3;};'use strict';var EventEmitter=require(_0xe5f9('0x0'));var UserVoiceQueueRt=require(_0xe5f9('0x1'))['db'][_0xe5f9('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe5f9('0x3'),'afterDestroy':_0xe5f9('0x4')};function emitEvent(_0xa03933){return function(_0x4ab0ea,_0x48a130,_0x4b4167){UserVoiceQueueRtEvents[_0xe5f9('0x5')](_0xa03933+':'+_0x4ab0ea['id'],_0x4ab0ea);UserVoiceQueueRtEvents[_0xe5f9('0x5')](_0xa03933,_0x4ab0ea);_0x4b4167(null);};}for(var e in events){if(events[_0xe5f9('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xe5f9('0x7')](e,emitEvent(event));}}module[_0xe5f9('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 1e3432c..da4a578 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 _0x0346=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0346,0x9c));var _0x6034=function(_0x158629,_0xb0ea67){_0x158629=_0x158629-0x0;var _0x182892=_0x0346[_0x158629];return _0x182892;};'use strict';var _=require(_0x6034('0x0'));var util=require(_0x6034('0x1'));var logger=require(_0x6034('0x2'))(_0x6034('0x3'));var moment=require(_0x6034('0x4'));var BPromise=require(_0x6034('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6034('0x6'));var rimraf=require(_0x6034('0x7'));var config=require('../../config/environment');var attributes=require(_0x6034('0x8'));module[_0x6034('0x9')]=function(_0x49f74b,_0x54849f){return _0x49f74b[_0x6034('0xa')](_0x6034('0xb'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6af7=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','define','user_has_voice_queues_rt','lodash','util'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0x6af7,0x10c));var _0x76af=function(_0x1ee5e5,_0x2b7990){_0x1ee5e5=_0x1ee5e5-0x0;var _0x2dfb2c=_0x6af7[_0x1ee5e5];return _0x2dfb2c;};'use strict';var _=require(_0x76af('0x0'));var util=require(_0x76af('0x1'));var logger=require(_0x76af('0x2'))('api');var moment=require(_0x76af('0x3'));var BPromise=require(_0x76af('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76af('0x5'));var rimraf=require(_0x76af('0x6'));var config=require(_0x76af('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x193ca4,_0x3e99c6){return _0x193ca4[_0x76af('0x8')]('UserVoiceQueueRt',attributes,{'tableName':_0x76af('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index ca8e023..9954166 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 _0xdd37=['request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UserVoiceQueueRt','options','raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','stringify','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x42e675,_0x4f24ef){var _0x1e18b9=function(_0x115a6a){while(--_0x115a6a){_0x42e675['push'](_0x42e675['shift']());}};_0x1e18b9(++_0x4f24ef);}(_0xdd37,0x19d));var _0x7dd3=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xdd37[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7dd3('0x0'));var util=require('util');var moment=require(_0x7dd3('0x1'));var BPromise=require('bluebird');var rs=require(_0x7dd3('0x2'));var fs=require('fs');var Redis=require(_0x7dd3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7dd3('0x4'))(_0x7dd3('0x5'));var config=require(_0x7dd3('0x6'));var jayson=require(_0x7dd3('0x7'));var client=jayson[_0x7dd3('0x8')][_0x7dd3('0x9')]({'port':0x232a});config[_0x7dd3('0xa')]=_[_0x7dd3('0xb')](config[_0x7dd3('0xa')],{'host':_0x7dd3('0xc'),'port':0x18eb});var socket=require(_0x7dd3('0xd'))(new Redis(config[_0x7dd3('0xa')]));require(_0x7dd3('0xe'))[_0x7dd3('0xf')](socket);function respondWithRpcPromise(_0x30ef18,_0x542b82,_0x550b7f){return new BPromise(function(_0xf3ad16,_0x1d9e6f){return client['request'](_0x30ef18,_0x550b7f)[_0x7dd3('0x10')](function(_0xf31a32){logger[_0x7dd3('0x11')](_0x7dd3('0x12'),_0x542b82,_0x7dd3('0x13'));logger[_0x7dd3('0x14')](_0x7dd3('0x15'),_0x542b82,_0x7dd3('0x13'),JSON['stringify'](_0xf31a32));if(_0xf31a32[_0x7dd3('0x16')]){if(_0xf31a32[_0x7dd3('0x16')][_0x7dd3('0x17')]===0x1f4){logger[_0x7dd3('0x16')](_0x7dd3('0x12'),_0x542b82,_0xf31a32[_0x7dd3('0x16')][_0x7dd3('0x18')]);return _0x1d9e6f(_0xf31a32[_0x7dd3('0x16')]['message']);}logger[_0x7dd3('0x16')](_0x7dd3('0x12'),_0x542b82,_0xf31a32[_0x7dd3('0x16')][_0x7dd3('0x18')]);return _0xf3ad16(_0xf31a32[_0x7dd3('0x16')][_0x7dd3('0x18')]);}else{logger[_0x7dd3('0x11')](_0x7dd3('0x12'),_0x542b82,_0x7dd3('0x13'));_0xf3ad16(_0xf31a32[_0x7dd3('0x19')][_0x7dd3('0x18')]);}})[_0x7dd3('0x1a')](function(_0xaca5b1){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x542b82,_0xaca5b1);_0x1d9e6f(_0xaca5b1);});});}exports['GetVoiceQueueRtPauses']=function(_0x52bbb1){var _0xfc39f8=this;return new Promise(function(_0x265016,_0xcdbb86){return db[_0x7dd3('0x1b')]['findAll']({'raw':_0x52bbb1['options']?_0x52bbb1[_0x7dd3('0x1c')][_0x7dd3('0x1d')]===undefined?!![]:![]:!![],'where':_0x52bbb1[_0x7dd3('0x1c')]?_0x52bbb1['options']['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x7dd3('0x1e')]['fn']('IF',db[_0x7dd3('0x1e')][_0x7dd3('0x1f')](_0x7dd3('0x20')))),_0x7dd3('0x21')]]})['then'](function(_0x3261fc){logger[_0x7dd3('0x11')](_0x7dd3('0x22'),_0x52bbb1);logger['debug'](_0x7dd3('0x22'),_0x52bbb1,JSON[_0x7dd3('0x23')](_0x3261fc));_0x265016(_0x3261fc);})[_0x7dd3('0x1a')](function(_0x219bf8){logger[_0x7dd3('0x16')](_0x7dd3('0x22'),_0x219bf8[_0x7dd3('0x18')],_0x52bbb1);_0xcdbb86(_0xfc39f8[_0x7dd3('0x16')](0x1f4,_0x219bf8[_0x7dd3('0x18')]));});});}; \ No newline at end of file +var _0x0eff=['UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UserVoiceQueueRt','findAll','options','where','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','GetVoiceQueueRtPauses','debug','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./userVoiceQueueRt.socket','register','request','info'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x0eff,0x195));var _0xf0ef=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0x0eff[_0x29ce14];return _0x48f289;};'use strict';var _=require(_0xf0ef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf0ef('0x1'));var rs=require(_0xf0ef('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ef('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ef('0x4'))(_0xf0ef('0x5'));var config=require(_0xf0ef('0x6'));var jayson=require(_0xf0ef('0x7'));var client=jayson[_0xf0ef('0x8')][_0xf0ef('0x9')]({'port':0x232a});config[_0xf0ef('0xa')]=_['defaults'](config[_0xf0ef('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf0ef('0xb'))[_0xf0ef('0xc')](socket);function respondWithRpcPromise(_0x2686a9,_0x414791,_0x5cdb3a){return new BPromise(function(_0x3018bb,_0x1e9034){return client[_0xf0ef('0xd')](_0x2686a9,_0x5cdb3a)['then'](function(_0x3fab03){logger[_0xf0ef('0xe')](_0xf0ef('0xf'),_0x414791,_0xf0ef('0x10'));logger['debug'](_0xf0ef('0x11'),_0x414791,_0xf0ef('0x10'),JSON[_0xf0ef('0x12')](_0x3fab03));if(_0x3fab03['error']){if(_0x3fab03[_0xf0ef('0x13')][_0xf0ef('0x14')]===0x1f4){logger[_0xf0ef('0x13')](_0xf0ef('0xf'),_0x414791,_0x3fab03[_0xf0ef('0x13')][_0xf0ef('0x15')]);return _0x1e9034(_0x3fab03[_0xf0ef('0x13')][_0xf0ef('0x15')]);}logger[_0xf0ef('0x13')](_0xf0ef('0xf'),_0x414791,_0x3fab03[_0xf0ef('0x13')][_0xf0ef('0x15')]);return _0x3018bb(_0x3fab03[_0xf0ef('0x13')][_0xf0ef('0x15')]);}else{logger[_0xf0ef('0xe')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x414791,'request\x20sent');_0x3018bb(_0x3fab03[_0xf0ef('0x16')][_0xf0ef('0x15')]);}})[_0xf0ef('0x17')](function(_0x5921e6){logger[_0xf0ef('0x13')](_0xf0ef('0xf'),_0x414791,_0x5921e6);_0x1e9034(_0x5921e6);});});}exports['GetVoiceQueueRtPauses']=function(_0xa4dbb8){var _0x338d2a=this;return new Promise(function(_0x43ac1e,_0x162739){return db[_0xf0ef('0x18')][_0xf0ef('0x19')]({'raw':_0xa4dbb8[_0xf0ef('0x1a')]?_0xa4dbb8['options']['raw']===undefined?!![]:![]:!![],'where':_0xa4dbb8[_0xf0ef('0x1a')]?_0xa4dbb8[_0xf0ef('0x1a')][_0xf0ef('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0xf0ef('0x1c'),db[_0xf0ef('0x1d')]['fn']('IF',db[_0xf0ef('0x1d')]['literal'](_0xf0ef('0x1e')))),_0xf0ef('0x1f')]]})[_0xf0ef('0x20')](function(_0x1ec0fe){logger[_0xf0ef('0xe')](_0xf0ef('0x21'),_0xa4dbb8);logger[_0xf0ef('0x22')](_0xf0ef('0x21'),_0xa4dbb8,JSON[_0xf0ef('0x12')](_0x1ec0fe));_0x43ac1e(_0x1ec0fe);})[_0xf0ef('0x17')](function(_0xd9decc){logger[_0xf0ef('0x13')](_0xf0ef('0x21'),_0xd9decc['message'],_0xa4dbb8);_0x162739(_0x338d2a[_0xf0ef('0x13')](0x1f4,_0xd9decc[_0xf0ef('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 53f3aad..e5b36d4 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 _0x8917=['emit','removeListener','length','./userVoiceQueueRt.events','remove','update'];(function(_0x27db3d,_0x19fe38){var _0x4d5688=function(_0xe29061){while(--_0xe29061){_0x27db3d['push'](_0x27db3d['shift']());}};_0x4d5688(++_0x19fe38);}(_0x8917,0x1d7));var _0x7891=function(_0x50c146,_0x1f331b){_0x50c146=_0x50c146-0x0;var _0x5b4215=_0x8917[_0x50c146];return _0x5b4215;};'use strict';var UserVoiceQueueRtEvents=require(_0x7891('0x0'));var events=['save',_0x7891('0x1'),_0x7891('0x2')];function createListener(_0xfc1628,_0x129608){return function(_0xdf5de1){_0x129608[_0x7891('0x3')](_0xfc1628,_0xdf5de1);};}function removeListener(_0x2b5570,_0x24234b){return function(){UserVoiceQueueRtEvents[_0x7891('0x4')](_0x2b5570,_0x24234b);};}exports['register']=function(_0x46b52a){for(var _0x43a48e=0x0,_0x442944=events[_0x7891('0x5')];_0x43a48e<_0x442944;_0x43a48e++){var _0x4722b7=events[_0x43a48e];var _0x452a6d=createListener('userVoiceQueueRt:'+_0x4722b7,_0x46b52a);UserVoiceQueueRtEvents['on'](_0x4722b7,_0x452a6d);}}; \ No newline at end of file +var _0x01db=['removeListener','register','length','./userVoiceQueueRt.events','update','emit'];(function(_0x1a9b94,_0x4d763e){var _0x379102=function(_0x1d9e7c){while(--_0x1d9e7c){_0x1a9b94['push'](_0x1a9b94['shift']());}};_0x379102(++_0x4d763e);}(_0x01db,0x171));var _0xb01d=function(_0x136cbc,_0x40f74c){_0x136cbc=_0x136cbc-0x0;var _0x336c9c=_0x01db[_0x136cbc];return _0x336c9c;};'use strict';var UserVoiceQueueRtEvents=require(_0xb01d('0x0'));var events=['save','remove',_0xb01d('0x1')];function createListener(_0x2ed146,_0x105113){return function(_0x4df2c9){_0x105113[_0xb01d('0x2')](_0x2ed146,_0x4df2c9);};}function removeListener(_0x5c3864,_0x4cc905){return function(){UserVoiceQueueRtEvents[_0xb01d('0x3')](_0x5c3864,_0x4cc905);};}exports[_0xb01d('0x4')]=function(_0x30bddd){for(var _0x30f6b5=0x0,_0x2622e9=events[_0xb01d('0x5')];_0x30f6b5<_0x2622e9;_0x30f6b5++){var _0x3c45a3=events[_0x30f6b5];var _0x4429dd=createListener('userVoiceQueueRt:'+_0x3c45a3,_0x30bddd);UserVoiceQueueRtEvents['on'](_0x3c45a3,_0x4429dd);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 201045e..6db9e4b 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4dd693,_0x20ed73){var _0x164ce3=function(_0x21b554){while(--_0x21b554){_0x4dd693['push'](_0x4dd693['shift']());}};_0x164ce3(++_0x20ed73);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x49fcfc,_0x104175){var _0x4ab162=function(_0x2fb28b){while(--_0x2fb28b){_0x49fcfc['push'](_0x49fcfc['shift']());}};_0x4ab162(++_0x104175);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 322cdd4..c3dd031 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 _0x79b2=['sequelize','INTEGER'];(function(_0x239d45,_0x3d20b4){var _0x673d44=function(_0x354ff1){while(--_0x354ff1){_0x239d45['push'](_0x239d45['shift']());}};_0x673d44(++_0x3d20b4);}(_0x79b2,0x142));var _0x279b=function(_0x30f849,_0xfd4642){_0x30f849=_0x30f849-0x0;var _0x17945a=_0x79b2[_0x30f849];return _0x17945a;};'use strict';var Sequelize=require(_0x279b('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x279b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5c06=['sequelize','INTEGER'];(function(_0x57d3ec,_0x457fab){var _0x472f4b=function(_0x4bb59a){while(--_0x4bb59a){_0x57d3ec['push'](_0x57d3ec['shift']());}};_0x472f4b(++_0x457fab);}(_0x5c06,0x6c));var _0x65c0=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x5c06[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x65c0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x65c0('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index e336bb3..db23503 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 _0x2c12=['path','rimraf','exports','define','lodash','util','moment','bluebird','request-promise'];(function(_0x13fdb3,_0x493557){var _0x212e46=function(_0x47b3e0){while(--_0x47b3e0){_0x13fdb3['push'](_0x13fdb3['shift']());}};_0x212e46(++_0x493557);}(_0x2c12,0x1b4));var _0x22c1=function(_0x44ae0b,_0x3e9865){_0x44ae0b=_0x44ae0b-0x0;var _0x69232a=_0x2c12[_0x44ae0b];return _0x69232a;};'use strict';var _=require(_0x22c1('0x0'));var util=require(_0x22c1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x22c1('0x2'));var BPromise=require(_0x22c1('0x3'));var rp=require(_0x22c1('0x4'));var fs=require('fs');var path=require(_0x22c1('0x5'));var rimraf=require(_0x22c1('0x6'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x22c1('0x7')]=function(_0x571eb5,_0x46cace){return _0x571eb5[_0x22c1('0x8')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf01f=['user_has_whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0xf01f,0x9d));var _0xff01=function(_0x14b01b,_0x29f6f9){_0x14b01b=_0x14b01b-0x0;var _0x394f74=_0xf01f[_0x14b01b];return _0x394f74;};'use strict';var _=require(_0xff01('0x0'));var util=require('util');var logger=require(_0xff01('0x1'))(_0xff01('0x2'));var moment=require(_0xff01('0x3'));var BPromise=require(_0xff01('0x4'));var rp=require(_0xff01('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xff01('0x6'));var config=require('../../config/environment');var attributes=require(_0xff01('0x7'));module[_0xff01('0x8')]=function(_0x432b3e,_0x46d7d8){return _0x432b3e[_0xff01('0x9')](_0xff01('0xa'),attributes,{'tableName':_0xff01('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 b50935a..f6a7f93 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 _0x4785=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4d7018,_0x1be22d){var _0x4c1b9b=function(_0x574826){while(--_0x574826){_0x4d7018['push'](_0x4d7018['shift']());}};_0x4c1b9b(++_0x1be22d);}(_0x4785,0xb8));var _0x5478=function(_0x485865,_0x11d29a){_0x485865=_0x485865-0x0;var _0x11ef06=_0x4785[_0x485865];return _0x11ef06;};'use strict';var _=require(_0x5478('0x0'));var util=require(_0x5478('0x1'));var moment=require(_0x5478('0x2'));var BPromise=require(_0x5478('0x3'));var rs=require(_0x5478('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5478('0x5'));var config=require(_0x5478('0x6'));var jayson=require(_0x5478('0x7'));var client=jayson[_0x5478('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d49c5,_0x1e7b77,_0x214fbf){return new BPromise(function(_0x24fcdf,_0x528cee){return client[_0x5478('0x9')](_0x2d49c5,_0x214fbf)['then'](function(_0x3bd651){logger[_0x5478('0xa')](_0x5478('0xb'),_0x1e7b77,_0x5478('0xc'));logger['debug'](_0x5478('0xd'),_0x1e7b77,_0x5478('0xc'),JSON[_0x5478('0xe')](_0x3bd651));if(_0x3bd651[_0x5478('0xf')]){if(_0x3bd651[_0x5478('0xf')][_0x5478('0x10')]===0x1f4){logger[_0x5478('0xf')](_0x5478('0xb'),_0x1e7b77,_0x3bd651['error'][_0x5478('0x11')]);return _0x528cee(_0x3bd651['error'][_0x5478('0x11')]);}logger[_0x5478('0xf')](_0x5478('0xb'),_0x1e7b77,_0x3bd651[_0x5478('0xf')][_0x5478('0x11')]);return _0x24fcdf(_0x3bd651[_0x5478('0xf')][_0x5478('0x11')]);}else{logger[_0x5478('0xa')](_0x5478('0xb'),_0x1e7b77,_0x5478('0xc'));_0x24fcdf(_0x3bd651[_0x5478('0x12')][_0x5478('0x11')]);}})[_0x5478('0x13')](function(_0x76880d){logger[_0x5478('0xf')](_0x5478('0xb'),_0x1e7b77,_0x76880d);_0x528cee(_0x76880d);});});} \ No newline at end of file +var _0xd8a6=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x3d0e15,_0xdb46ae){var _0x4723bc=function(_0x5a02d4){while(--_0x5a02d4){_0x3d0e15['push'](_0x3d0e15['shift']());}};_0x4723bc(++_0xdb46ae);}(_0xd8a6,0x1b8));var _0x6d8a=function(_0xade007,_0x14a845){_0xade007=_0xade007-0x0;var _0x2abcff=_0xd8a6[_0xade007];return _0x2abcff;};'use strict';var _=require(_0x6d8a('0x0'));var util=require('util');var moment=require(_0x6d8a('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d8a('0x2'));var fs=require('fs');var Redis=require(_0x6d8a('0x3'));var db=require(_0x6d8a('0x4'))['db'];var utils=require(_0x6d8a('0x5'));var logger=require('../../config/logger')(_0x6d8a('0x6'));var config=require(_0x6d8a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6d8a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x334781,_0x1cb1ea,_0xe84ea2){return new BPromise(function(_0x3efde8,_0x37d28e){return client[_0x6d8a('0x9')](_0x334781,_0xe84ea2)[_0x6d8a('0xa')](function(_0x3ba7d2){logger[_0x6d8a('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1cb1ea,_0x6d8a('0xc'));logger[_0x6d8a('0xd')](_0x6d8a('0xe'),_0x1cb1ea,_0x6d8a('0xc'),JSON['stringify'](_0x3ba7d2));if(_0x3ba7d2[_0x6d8a('0xf')]){if(_0x3ba7d2['error'][_0x6d8a('0x10')]===0x1f4){logger['error'](_0x6d8a('0x11'),_0x1cb1ea,_0x3ba7d2[_0x6d8a('0xf')]['message']);return _0x37d28e(_0x3ba7d2['error'][_0x6d8a('0x12')]);}logger[_0x6d8a('0xf')](_0x6d8a('0x11'),_0x1cb1ea,_0x3ba7d2['error'][_0x6d8a('0x12')]);return _0x3efde8(_0x3ba7d2['error'][_0x6d8a('0x12')]);}else{logger['info'](_0x6d8a('0x11'),_0x1cb1ea,'request\x20sent');_0x3efde8(_0x3ba7d2[_0x6d8a('0x13')]['message']);}})[_0x6d8a('0x14')](function(_0x30be5d){logger[_0x6d8a('0xf')](_0x6d8a('0x11'),_0x1cb1ea,_0x30be5d);_0x37d28e(_0x30be5d);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 8615545..aa2eb45 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 _0x1738=['fs-extra','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','put','destroy','exports','multer','util','express','Router'];(function(_0x4b8044,_0x4f905f){var _0x11dcaf=function(_0x566e80){while(--_0x566e80){_0x4b8044['push'](_0x4b8044['shift']());}};_0x11dcaf(++_0x4f905f);}(_0x1738,0x1bc));var _0x8173=function(_0x16207e,_0x3d06ff){_0x16207e=_0x16207e-0x0;var _0x1d0441=_0x1738[_0x16207e];return _0x1d0441;};'use strict';var multer=require(_0x8173('0x0'));var util=require(_0x8173('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8173('0x2'));var router=express[_0x8173('0x3')]();var fs_extra=require(_0x8173('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8173('0x5'));var controller=require(_0x8173('0x6'));router[_0x8173('0x7')]('/',auth[_0x8173('0x8')](),controller[_0x8173('0x9')]);router[_0x8173('0x7')](_0x8173('0xa'),auth[_0x8173('0x8')](),controller[_0x8173('0xb')]);router[_0x8173('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8173('0xd')](_0x8173('0xa'),auth[_0x8173('0x8')](),controller['update']);router['delete'](_0x8173('0xa'),auth[_0x8173('0x8')](),controller[_0x8173('0xe')]);module[_0x8173('0xf')]=router; \ No newline at end of file +var _0x579c=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util'];(function(_0x4f6605,_0x2972b6){var _0x463ebb=function(_0x2d5851){while(--_0x2d5851){_0x4f6605['push'](_0x4f6605['shift']());}};_0x463ebb(++_0x2972b6);}(_0x579c,0xda));var _0xc579=function(_0x267e53,_0x3fd4ca){_0x267e53=_0x267e53-0x0;var _0x41d92d=_0x579c[_0x267e53];return _0x41d92d;};'use strict';var multer=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var path=require(_0xc579('0x2'));var timeout=require(_0xc579('0x3'));var express=require(_0xc579('0x4'));var router=express['Router']();var fs_extra=require(_0xc579('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc579('0x6'));var config=require(_0xc579('0x7'));var controller=require(_0xc579('0x8'));router[_0xc579('0x9')]('/',auth[_0xc579('0xa')](),controller[_0xc579('0xb')]);router[_0xc579('0x9')]('/:id',auth[_0xc579('0xa')](),controller[_0xc579('0xc')]);router[_0xc579('0xd')]('/',auth[_0xc579('0xa')](),controller[_0xc579('0xe')]);router[_0xc579('0xf')](_0xc579('0x10'),auth[_0xc579('0xa')](),controller['update']);router[_0xc579('0x11')](_0xc579('0x10'),auth[_0xc579('0xa')](),controller[_0xc579('0x12')]);module[_0xc579('0x13')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 9e66b56..dcda381 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 _0x1be1=['exports','STRING','name','sequelize'];(function(_0x3da0c7,_0x317328){var _0x4b80a0=function(_0x3b632a){while(--_0x3b632a){_0x3da0c7['push'](_0x3da0c7['shift']());}};_0x4b80a0(++_0x317328);}(_0x1be1,0x19f));var _0x11be=function(_0x505df1,_0x2221e9){_0x505df1=_0x505df1-0x0;var _0x3bd35a=_0x1be1[_0x505df1];return _0x3bd35a;};'use strict';var Sequelize=require(_0x11be('0x0'));module[_0x11be('0x1')]={'name':{'type':Sequelize[_0x11be('0x2')],'unique':_0x11be('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x089f=['STRING','name','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x089f,0x1c7));var _0xf089=function(_0x20357f,_0x29f43b){_0x20357f=_0x20357f-0x0;var _0xaefe76=_0x089f[_0x20357f];return _0xaefe76;};'use strict';var Sequelize=require('sequelize');module[_0xf089('0x0')]={'name':{'type':Sequelize[_0xf089('0x1')],'unique':_0xf089('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf089('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index f59c7e7..052387a 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 _0x3717=['set','Content-Range','apply','reject','save','update','then','Variables','error','stack','index','Variable','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','pick','filter','where','type','VIRTUAL','merge','options','include','rows','show','params','find','catch','create','body','get','user','UserProfileSection','userProfileId','name','destroy','zip-dir','fast-json-patch','moment','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0x3717,0xc0));var _0x7371=function(_0x46ddbc,_0xdf83d2){_0x46ddbc=_0x46ddbc-0x0;var _0x322c35=_0x3717[_0x46ddbc];return _0x322c35;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7371('0x0'));var jsonpatch=require(_0x7371('0x1'));var rp=require('request-promise');var moment=require(_0x7371('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7371('0x3'));var path=require('path');var sox=require(_0x7371('0x4'));var csv=require('to-csv');var ejs=require(_0x7371('0x5'));var fs=require('fs');var fs_extra=require(_0x7371('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7371('0x7'));var jsforce=require(_0x7371('0x8'));var deskjs=require(_0x7371('0x9'));var toCsv=require(_0x7371('0xa'));var querystring=require('querystring');var Papa=require(_0x7371('0xb'));var Redis=require(_0x7371('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x7371('0xd'));var as=require(_0x7371('0xe'));var hardwareService=require(_0x7371('0xf'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7371('0x10'));var licenseUtil=require(_0x7371('0x11'));var db=require(_0x7371('0x12'))['db'];function respondWithStatusCode(_0x48ff1c,_0x2a23a6){_0x2a23a6=_0x2a23a6||0xcc;return function(_0x94b203){if(_0x94b203){return _0x48ff1c[_0x7371('0x13')](_0x2a23a6);}return _0x48ff1c[_0x7371('0x14')](_0x2a23a6)[_0x7371('0x15')]();};}function respondWithResult(_0x58aaa8,_0x1a10ca){_0x1a10ca=_0x1a10ca||0xc8;return function(_0x5c2157){if(_0x5c2157){return _0x58aaa8[_0x7371('0x14')](_0x1a10ca)[_0x7371('0x16')](_0x5c2157);}};}function respondWithFilteredResult(_0x5139ae,_0xa70d1e){return function(_0x3efcc5){if(_0x3efcc5){var _0x1d28e4=typeof _0xa70d1e[_0x7371('0x17')]==='undefined'&&typeof _0xa70d1e[_0x7371('0x18')]===_0x7371('0x19');var _0xd3fd6a=_0x3efcc5[_0x7371('0x1a')];var _0x10a4ba=_0x1d28e4?0x0:_0xa70d1e[_0x7371('0x17')];var _0x12d154=_0x1d28e4?_0x3efcc5[_0x7371('0x1a')]:_0xa70d1e[_0x7371('0x17')]+_0xa70d1e[_0x7371('0x18')];var _0x326580;if(_0x12d154>=_0xd3fd6a){_0x12d154=_0xd3fd6a;_0x326580=0xc8;}else{_0x326580=0xce;}_0x5139ae[_0x7371('0x14')](_0x326580);return _0x5139ae[_0x7371('0x1b')](_0x7371('0x1c'),_0x10a4ba+'-'+_0x12d154+'/'+_0xd3fd6a)['json'](_0x3efcc5);}return null;};}function patchUpdates(_0x36546f){return function(_0x2cd4c2){try{jsonpatch[_0x7371('0x1d')](_0x2cd4c2,_0x36546f,!![]);}catch(_0x17d333){return BPromise[_0x7371('0x1e')](_0x17d333);}return _0x2cd4c2[_0x7371('0x1f')]();};}function saveUpdates(_0x3b350e,_0x312b65){return function(_0x34c1e1){if(_0x34c1e1){return _0x34c1e1[_0x7371('0x20')](_0x3b350e)[_0x7371('0x21')](function(_0x46b458){return _0x46b458;});}return null;};}function removeEntity(_0x450d62,_0x3902a1){return function(_0x34fd5f){if(_0x34fd5f){return _0x34fd5f['destroy']()[_0x7371('0x21')](function(){var _0x41f5c5=_0x34fd5f['get']({'plain':!![]});var _0x451a8c=_0x7371('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x451a8c,'resourceId':_0x41f5c5['id']}})[_0x7371('0x21')](function(){return _0x34fd5f;});})['then'](function(){_0x450d62[_0x7371('0x14')](0xcc)[_0x7371('0x15')]();});}};}function handleEntityNotFound(_0x48067f,_0x3ce661){return function(_0xc1f39c){if(!_0xc1f39c){_0x48067f[_0x7371('0x13')](0x194);}return _0xc1f39c;};}function handleError(_0x443d39,_0x25dbe1){_0x25dbe1=_0x25dbe1||0x1f4;return function(_0xd43db9){logger[_0x7371('0x23')](_0xd43db9[_0x7371('0x24')]);if(_0xd43db9['name']){delete _0xd43db9['name'];}_0x443d39[_0x7371('0x14')](_0x25dbe1)['send'](_0xd43db9);};}exports[_0x7371('0x25')]=function(_0x4bb27b,_0x370254){var _0x1c1f66={},_0x21ce68={},_0x3c8be4={'count':0x0,'rows':[]};var _0x5359ca=_['map'](db[_0x7371('0x26')][_0x7371('0x27')],function(_0x3cc1a0){return{'name':_0x3cc1a0[_0x7371('0x28')],'type':_0x3cc1a0['type'][_0x7371('0x29')]};});_0x21ce68['model']=_[_0x7371('0x2a')](_0x5359ca,'name');_0x21ce68[_0x7371('0x2b')]=_[_0x7371('0x2c')](_0x4bb27b[_0x7371('0x2b')]);_0x21ce68[_0x7371('0x2d')]=_[_0x7371('0x2e')](_0x21ce68[_0x7371('0x2f')],_0x21ce68[_0x7371('0x2b')]);_0x1c1f66[_0x7371('0x30')]=_['intersection'](_0x21ce68[_0x7371('0x2f')],qs[_0x7371('0x31')](_0x4bb27b[_0x7371('0x2b')][_0x7371('0x31')]));_0x1c1f66[_0x7371('0x30')]=_0x1c1f66['attributes']['length']?_0x1c1f66[_0x7371('0x30')]:_0x21ce68[_0x7371('0x2f')];if(!_0x4bb27b[_0x7371('0x2b')][_0x7371('0x32')]('nolimit')){_0x1c1f66[_0x7371('0x18')]=qs['limit'](_0x4bb27b[_0x7371('0x2b')][_0x7371('0x18')]);_0x1c1f66[_0x7371('0x17')]=qs[_0x7371('0x17')](_0x4bb27b[_0x7371('0x2b')][_0x7371('0x17')]);}_0x1c1f66['order']=qs['sort'](_0x4bb27b[_0x7371('0x2b')][_0x7371('0x33')]);_0x1c1f66['where']=qs['filters'](_[_0x7371('0x34')](_0x4bb27b[_0x7371('0x2b')],_0x21ce68[_0x7371('0x2d')]),_0x5359ca);if(_0x4bb27b['query'][_0x7371('0x35')]){_0x1c1f66[_0x7371('0x36')]=_['merge'](_0x1c1f66[_0x7371('0x36')],{'$or':_[_0x7371('0x2a')](_0x5359ca,function(_0x4c39f5){if(_0x4c39f5[_0x7371('0x37')]!==_0x7371('0x38')){var _0x1659c4={};_0x1659c4[_0x4c39f5['name']]={'$like':'%'+_0x4bb27b[_0x7371('0x2b')][_0x7371('0x35')]+'%'};return _0x1659c4;}})});}_0x1c1f66=_[_0x7371('0x39')]({},_0x1c1f66,_0x4bb27b[_0x7371('0x3a')]);var _0x3cebac={'where':_0x1c1f66['where']};return db['Variable'][_0x7371('0x1a')](_0x3cebac)['then'](function(_0x1a51f1){_0x3c8be4[_0x7371('0x1a')]=_0x1a51f1;if(_0x4bb27b['query']['includeAll']){_0x1c1f66[_0x7371('0x3b')]=[{'all':!![]}];}return db[_0x7371('0x26')]['findAll'](_0x1c1f66);})[_0x7371('0x21')](function(_0x1005b8){_0x3c8be4[_0x7371('0x3c')]=_0x1005b8;return _0x3c8be4;})[_0x7371('0x21')](respondWithFilteredResult(_0x370254,_0x1c1f66))['catch'](handleError(_0x370254,null));};exports[_0x7371('0x3d')]=function(_0x375662,_0x10c9ef){var _0x577872={'raw':!![],'where':{'id':_0x375662[_0x7371('0x3e')]['id']}},_0x4a6844={};_0x4a6844[_0x7371('0x2f')]=_[_0x7371('0x2c')](db[_0x7371('0x26')][_0x7371('0x27')]);_0x4a6844[_0x7371('0x2b')]=_[_0x7371('0x2c')](_0x375662[_0x7371('0x2b')]);_0x4a6844[_0x7371('0x2d')]=_[_0x7371('0x2e')](_0x4a6844[_0x7371('0x2f')],_0x4a6844[_0x7371('0x2b')]);_0x577872[_0x7371('0x30')]=_['intersection'](_0x4a6844['model'],qs[_0x7371('0x31')](_0x375662[_0x7371('0x2b')][_0x7371('0x31')]));_0x577872[_0x7371('0x30')]=_0x577872[_0x7371('0x30')]['length']?_0x577872[_0x7371('0x30')]:_0x4a6844[_0x7371('0x2f')];if(_0x375662[_0x7371('0x2b')]['includeAll']){_0x577872[_0x7371('0x3b')]=[{'all':!![]}];}_0x577872=_[_0x7371('0x39')]({},_0x577872,_0x375662[_0x7371('0x3a')]);return db[_0x7371('0x26')][_0x7371('0x3f')](_0x577872)[_0x7371('0x21')](handleEntityNotFound(_0x10c9ef,null))[_0x7371('0x21')](respondWithResult(_0x10c9ef,null))[_0x7371('0x40')](handleError(_0x10c9ef,null));};exports[_0x7371('0x41')]=function(_0x36f4a8,_0x51fb27){return db[_0x7371('0x26')]['create'](_0x36f4a8[_0x7371('0x42')],{})[_0x7371('0x21')](function(_0x213b37){var _0xf221e6=_0x36f4a8['user'][_0x7371('0x43')]({'plain':!![]});if(!_0xf221e6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf221e6['role']===_0x7371('0x44')){var _0x46b6d0=_0x213b37[_0x7371('0x43')]({'plain':!![]});var _0x37e069=_0x7371('0x22');return db[_0x7371('0x45')][_0x7371('0x3f')]({'where':{'name':_0x37e069,'userProfileId':_0xf221e6[_0x7371('0x46')]},'raw':!![]})[_0x7371('0x21')](function(_0x13bc7a){if(_0x13bc7a&&_0x13bc7a['autoAssociation']===0x0){return db['UserProfileResource'][_0x7371('0x41')]({'name':_0x46b6d0[_0x7371('0x47')],'resourceId':_0x46b6d0['id'],'type':_0x13bc7a[_0x7371('0x47')],'sectionId':_0x13bc7a['id']},{})[_0x7371('0x21')](function(){return _0x213b37;});}else{return _0x213b37;}})[_0x7371('0x40')](function(_0x4c914c){logger[_0x7371('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c914c);throw _0x4c914c;});}return _0x213b37;})[_0x7371('0x21')](respondWithResult(_0x51fb27,0xc9))[_0x7371('0x40')](handleError(_0x51fb27,null));};exports[_0x7371('0x20')]=function(_0x43b8f9,_0x57f76f){if(_0x43b8f9[_0x7371('0x42')]['id']){delete _0x43b8f9[_0x7371('0x42')]['id'];}return db[_0x7371('0x26')]['find']({'where':{'id':_0x43b8f9['params']['id']}})[_0x7371('0x21')](handleEntityNotFound(_0x57f76f,null))[_0x7371('0x21')](saveUpdates(_0x43b8f9['body'],null))['then'](respondWithResult(_0x57f76f,null))['catch'](handleError(_0x57f76f,null));};exports[_0x7371('0x48')]=function(_0x359590,_0x5aa134){return db[_0x7371('0x26')][_0x7371('0x3f')]({'where':{'id':_0x359590[_0x7371('0x3e')]['id']}})[_0x7371('0x21')](handleEntityNotFound(_0x5aa134,null))[_0x7371('0x21')](removeEntity(_0x5aa134,null))[_0x7371('0x40')](handleError(_0x5aa134,null));}; \ No newline at end of file +var _0x5c24=['index','map','rawAttributes','fieldName','model','keys','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','include','Variable','catch','show','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x5c24,0x76));var _0x45c2=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x5c24[_0x25e7cb];return _0x375d92;};'use strict';var emlformat=require(_0x45c2('0x0'));var rimraf=require(_0x45c2('0x1'));var zipdir=require(_0x45c2('0x2'));var jsonpatch=require(_0x45c2('0x3'));var rp=require(_0x45c2('0x4'));var moment=require(_0x45c2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x45c2('0x6'));var util=require(_0x45c2('0x7'));var path=require(_0x45c2('0x8'));var sox=require('sox');var csv=require(_0x45c2('0x9'));var ejs=require(_0x45c2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x45c2('0xb'));var squel=require(_0x45c2('0xc'));var crypto=require(_0x45c2('0xd'));var jsforce=require(_0x45c2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x45c2('0x9'));var querystring=require(_0x45c2('0xf'));var Papa=require(_0x45c2('0x10'));var Redis=require(_0x45c2('0x11'));var authService=require(_0x45c2('0x12'));var qs=require(_0x45c2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x45c2('0x14'));var logger=require(_0x45c2('0x15'))(_0x45c2('0x16'));var utils=require(_0x45c2('0x17'));var config=require(_0x45c2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x45c2('0x19'))['db'];function respondWithStatusCode(_0x468134,_0x4a2d0c){_0x4a2d0c=_0x4a2d0c||0xcc;return function(_0x20c4e4){if(_0x20c4e4){return _0x468134[_0x45c2('0x1a')](_0x4a2d0c);}return _0x468134[_0x45c2('0x1b')](_0x4a2d0c)[_0x45c2('0x1c')]();};}function respondWithResult(_0x297522,_0x48bc09){_0x48bc09=_0x48bc09||0xc8;return function(_0x4a9259){if(_0x4a9259){return _0x297522[_0x45c2('0x1b')](_0x48bc09)[_0x45c2('0x1d')](_0x4a9259);}};}function respondWithFilteredResult(_0x568f86,_0x35acfa){return function(_0x10df9e){if(_0x10df9e){var _0x510c62=typeof _0x35acfa[_0x45c2('0x1e')]===_0x45c2('0x1f')&&typeof _0x35acfa[_0x45c2('0x20')]===_0x45c2('0x1f');var _0x4b43e8=_0x10df9e[_0x45c2('0x21')];var _0x2c3de3=_0x510c62?0x0:_0x35acfa['offset'];var _0x4eb2=_0x510c62?_0x10df9e[_0x45c2('0x21')]:_0x35acfa['offset']+_0x35acfa['limit'];var _0x3d615c;if(_0x4eb2>=_0x4b43e8){_0x4eb2=_0x4b43e8;_0x3d615c=0xc8;}else{_0x3d615c=0xce;}_0x568f86[_0x45c2('0x1b')](_0x3d615c);return _0x568f86[_0x45c2('0x22')](_0x45c2('0x23'),_0x2c3de3+'-'+_0x4eb2+'/'+_0x4b43e8)['json'](_0x10df9e);}return null;};}function patchUpdates(_0x4808ff){return function(_0x991611){try{jsonpatch[_0x45c2('0x24')](_0x991611,_0x4808ff,!![]);}catch(_0x28c076){return BPromise[_0x45c2('0x25')](_0x28c076);}return _0x991611[_0x45c2('0x26')]();};}function saveUpdates(_0x101599,_0x39263d){return function(_0xab15bc){if(_0xab15bc){return _0xab15bc[_0x45c2('0x27')](_0x101599)[_0x45c2('0x28')](function(_0x4b3d26){return _0x4b3d26;});}return null;};}function removeEntity(_0x1136b5,_0x5ba247){return function(_0x55bf8b){if(_0x55bf8b){return _0x55bf8b[_0x45c2('0x29')]()[_0x45c2('0x28')](function(){var _0x1798ec=_0x55bf8b[_0x45c2('0x2a')]({'plain':!![]});var _0x4d8233=_0x45c2('0x2b');return db[_0x45c2('0x2c')][_0x45c2('0x29')]({'where':{'type':_0x4d8233,'resourceId':_0x1798ec['id']}})[_0x45c2('0x28')](function(){return _0x55bf8b;});})[_0x45c2('0x28')](function(){_0x1136b5['status'](0xcc)[_0x45c2('0x1c')]();});}};}function handleEntityNotFound(_0x58df0a,_0x522635){return function(_0x33a3ea){if(!_0x33a3ea){_0x58df0a[_0x45c2('0x1a')](0x194);}return _0x33a3ea;};}function handleError(_0x4d2d70,_0x3fa8f9){_0x3fa8f9=_0x3fa8f9||0x1f4;return function(_0x4011d2){logger[_0x45c2('0x2d')](_0x4011d2[_0x45c2('0x2e')]);if(_0x4011d2[_0x45c2('0x2f')]){delete _0x4011d2['name'];}_0x4d2d70['status'](_0x3fa8f9)['send'](_0x4011d2);};}exports[_0x45c2('0x30')]=function(_0x145030,_0x851764){var _0x52511e={},_0x5b543c={},_0x1293bc={'count':0x0,'rows':[]};var _0x484067=_[_0x45c2('0x31')](db['Variable'][_0x45c2('0x32')],function(_0x1e6908){return{'name':_0x1e6908[_0x45c2('0x33')],'type':_0x1e6908['type']['key']};});_0x5b543c[_0x45c2('0x34')]=_[_0x45c2('0x31')](_0x484067,'name');_0x5b543c['query']=_[_0x45c2('0x35')](_0x145030[_0x45c2('0x36')]);_0x5b543c['filters']=_['intersection'](_0x5b543c[_0x45c2('0x34')],_0x5b543c[_0x45c2('0x36')]);_0x52511e[_0x45c2('0x37')]=_['intersection'](_0x5b543c[_0x45c2('0x34')],qs[_0x45c2('0x38')](_0x145030['query']['fields']));_0x52511e[_0x45c2('0x37')]=_0x52511e[_0x45c2('0x37')][_0x45c2('0x39')]?_0x52511e[_0x45c2('0x37')]:_0x5b543c[_0x45c2('0x34')];if(!_0x145030['query'][_0x45c2('0x3a')]('nolimit')){_0x52511e[_0x45c2('0x20')]=qs[_0x45c2('0x20')](_0x145030[_0x45c2('0x36')][_0x45c2('0x20')]);_0x52511e[_0x45c2('0x1e')]=qs['offset'](_0x145030[_0x45c2('0x36')][_0x45c2('0x1e')]);}_0x52511e[_0x45c2('0x3b')]=qs[_0x45c2('0x3c')](_0x145030[_0x45c2('0x36')][_0x45c2('0x3c')]);_0x52511e[_0x45c2('0x3d')]=qs[_0x45c2('0x3e')](_[_0x45c2('0x3f')](_0x145030[_0x45c2('0x36')],_0x5b543c[_0x45c2('0x3e')]),_0x484067);if(_0x145030[_0x45c2('0x36')]['filter']){_0x52511e[_0x45c2('0x3d')]=_[_0x45c2('0x40')](_0x52511e[_0x45c2('0x3d')],{'$or':_[_0x45c2('0x31')](_0x484067,function(_0x161509){if(_0x161509[_0x45c2('0x41')]!==_0x45c2('0x42')){var _0x245d65={};_0x245d65[_0x161509['name']]={'$like':'%'+_0x145030[_0x45c2('0x36')]['filter']+'%'};return _0x245d65;}})});}_0x52511e=_[_0x45c2('0x40')]({},_0x52511e,_0x145030[_0x45c2('0x43')]);var _0x4a7f86={'where':_0x52511e[_0x45c2('0x3d')]};return db['Variable'][_0x45c2('0x21')](_0x4a7f86)[_0x45c2('0x28')](function(_0x2a19e9){_0x1293bc['count']=_0x2a19e9;if(_0x145030[_0x45c2('0x36')][_0x45c2('0x44')]){_0x52511e[_0x45c2('0x45')]=[{'all':!![]}];}return db[_0x45c2('0x46')]['findAll'](_0x52511e);})[_0x45c2('0x28')](function(_0x4d1c4f){_0x1293bc['rows']=_0x4d1c4f;return _0x1293bc;})[_0x45c2('0x28')](respondWithFilteredResult(_0x851764,_0x52511e))[_0x45c2('0x47')](handleError(_0x851764,null));};exports[_0x45c2('0x48')]=function(_0x3fc3ed,_0x41449a){var _0x4473ff={'raw':!![],'where':{'id':_0x3fc3ed[_0x45c2('0x49')]['id']}},_0x272da5={};_0x272da5[_0x45c2('0x34')]=_[_0x45c2('0x35')](db[_0x45c2('0x46')][_0x45c2('0x32')]);_0x272da5[_0x45c2('0x36')]=_['keys'](_0x3fc3ed[_0x45c2('0x36')]);_0x272da5['filters']=_[_0x45c2('0x4a')](_0x272da5[_0x45c2('0x34')],_0x272da5['query']);_0x4473ff['attributes']=_['intersection'](_0x272da5[_0x45c2('0x34')],qs[_0x45c2('0x38')](_0x3fc3ed[_0x45c2('0x36')]['fields']));_0x4473ff[_0x45c2('0x37')]=_0x4473ff[_0x45c2('0x37')][_0x45c2('0x39')]?_0x4473ff['attributes']:_0x272da5[_0x45c2('0x34')];if(_0x3fc3ed['query'][_0x45c2('0x44')]){_0x4473ff[_0x45c2('0x45')]=[{'all':!![]}];}_0x4473ff=_[_0x45c2('0x40')]({},_0x4473ff,_0x3fc3ed['options']);return db[_0x45c2('0x46')][_0x45c2('0x4b')](_0x4473ff)[_0x45c2('0x28')](handleEntityNotFound(_0x41449a,null))[_0x45c2('0x28')](respondWithResult(_0x41449a,null))[_0x45c2('0x47')](handleError(_0x41449a,null));};exports[_0x45c2('0x4c')]=function(_0x19712e,_0x31c7d3){return db['Variable'][_0x45c2('0x4c')](_0x19712e[_0x45c2('0x4d')],{})[_0x45c2('0x28')](function(_0x1b6c52){var _0xa7d284=_0x19712e[_0x45c2('0x4e')]['get']({'plain':!![]});if(!_0xa7d284)throw new Error(_0x45c2('0x4f'));if(_0xa7d284[_0x45c2('0x50')]===_0x45c2('0x4e')){var _0x177262=_0x1b6c52['get']({'plain':!![]});var _0x3e2620=_0x45c2('0x2b');return db[_0x45c2('0x51')][_0x45c2('0x4b')]({'where':{'name':_0x3e2620,'userProfileId':_0xa7d284['userProfileId']},'raw':!![]})[_0x45c2('0x28')](function(_0x1a32ee){if(_0x1a32ee&&_0x1a32ee[_0x45c2('0x52')]===0x0){return db[_0x45c2('0x2c')][_0x45c2('0x4c')]({'name':_0x177262[_0x45c2('0x2f')],'resourceId':_0x177262['id'],'type':_0x1a32ee[_0x45c2('0x2f')],'sectionId':_0x1a32ee['id']},{})[_0x45c2('0x28')](function(){return _0x1b6c52;});}else{return _0x1b6c52;}})['catch'](function(_0x5c7004){logger[_0x45c2('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c7004);throw _0x5c7004;});}return _0x1b6c52;})[_0x45c2('0x28')](respondWithResult(_0x31c7d3,0xc9))[_0x45c2('0x47')](handleError(_0x31c7d3,null));};exports[_0x45c2('0x27')]=function(_0x19db9d,_0x1f0ffe){if(_0x19db9d[_0x45c2('0x4d')]['id']){delete _0x19db9d[_0x45c2('0x4d')]['id'];}return db[_0x45c2('0x46')]['find']({'where':{'id':_0x19db9d[_0x45c2('0x49')]['id']}})[_0x45c2('0x28')](handleEntityNotFound(_0x1f0ffe,null))[_0x45c2('0x28')](saveUpdates(_0x19db9d['body'],null))['then'](respondWithResult(_0x1f0ffe,null))[_0x45c2('0x47')](handleError(_0x1f0ffe,null));};exports[_0x45c2('0x29')]=function(_0x9704cc,_0x2f6e10){return db[_0x45c2('0x46')][_0x45c2('0x4b')]({'where':{'id':_0x9704cc[_0x45c2('0x49')]['id']}})[_0x45c2('0x28')](handleEntityNotFound(_0x2f6e10,null))[_0x45c2('0x28')](removeEntity(_0x2f6e10,null))[_0x45c2('0x47')](handleError(_0x2f6e10,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index d5015cc..0b001ce 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 _0x876f=['rimraf','../../config/environment','./variable.attributes','define','Variable','tools_variables','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0xf5080f,_0x172a89){var _0x3ea3fb=function(_0x23f23f){while(--_0x23f23f){_0xf5080f['push'](_0xf5080f['shift']());}};_0x3ea3fb(++_0x172a89);}(_0x876f,0x13e));var _0xf876=function(_0x316cf6,_0x2acd21){_0x316cf6=_0x316cf6-0x0;var _0x59e4f2=_0x876f[_0x316cf6];return _0x59e4f2;};'use strict';var _=require(_0xf876('0x0'));var util=require(_0xf876('0x1'));var logger=require(_0xf876('0x2'))(_0xf876('0x3'));var moment=require('moment');var BPromise=require(_0xf876('0x4'));var rp=require(_0xf876('0x5'));var fs=require('fs');var path=require(_0xf876('0x6'));var rimraf=require(_0xf876('0x7'));var config=require(_0xf876('0x8'));var attributes=require(_0xf876('0x9'));module['exports']=function(_0xe1be0e,_0x99d3a4){return _0xe1be0e[_0xf876('0xa')](_0xf876('0xb'),attributes,{'tableName':_0xf876('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x521a=['tools_variables','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Variable'];(function(_0x3314cc,_0x158c72){var _0x2ef318=function(_0x280ff7){while(--_0x280ff7){_0x3314cc['push'](_0x3314cc['shift']());}};_0x2ef318(++_0x158c72);}(_0x521a,0x199));var _0xa521=function(_0x44846a,_0x5bd96c){_0x44846a=_0x44846a-0x0;var _0x20ba4b=_0x521a[_0x44846a];return _0x20ba4b;};'use strict';var _=require('lodash');var util=require(_0xa521('0x0'));var logger=require(_0xa521('0x1'))('api');var moment=require(_0xa521('0x2'));var BPromise=require(_0xa521('0x3'));var rp=require(_0xa521('0x4'));var fs=require('fs');var path=require(_0xa521('0x5'));var rimraf=require(_0xa521('0x6'));var config=require(_0xa521('0x7'));var attributes=require('./variable.attributes');module[_0xa521('0x8')]=function(_0x2e7cf1,_0x3e1ac9){return _0x2e7cf1[_0xa521('0x9')](_0xa521('0xa'),attributes,{'tableName':_0xa521('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 62479ff..c03fcf1 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 _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x4c0405,_0x1d263c){var _0x125158=function(_0x5d8b54){while(--_0x5d8b54){_0x4c0405['push'](_0x4c0405['shift']());}};_0x125158(++_0x1d263c);}(_0x3e74,0x175));var _0x43e7=function(_0x3abe27,_0x5a4a91){_0x3abe27=_0x3abe27-0x0;var _0x1bb75b=_0x3e74[_0x3abe27];return _0x1bb75b;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowVariable','Variable','find'];(function(_0x333767,_0x3e6f9c){var _0x51661b=function(_0x46e5d6){while(--_0x46e5d6){_0x333767['push'](_0x333767['shift']());}};_0x51661b(++_0x3e6f9c);}(_0x55ca,0x126));var _0xa55c=function(_0x3e436c,_0xebf949){_0x3e436c=_0x3e436c-0x0;var _0x3e4924=_0x55ca[_0x3e436c];return _0x3e4924;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Variable,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Variable,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index c0dec33..7a1b56e 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 _0xb7ee=['reset','get','/pull','pull','/restart','/migrations','migrations','express','Router','../../components/auth/service','index','/fetch','isAuthenticated','canUpdate','fetch','/reset'];(function(_0x491c87,_0xcf52b8){var _0x39ac31=function(_0x49ae0e){while(--_0x49ae0e){_0x491c87['push'](_0x491c87['shift']());}};_0x39ac31(++_0xcf52b8);}(_0xb7ee,0x67));var _0xeb7e=function(_0x9910dc,_0x1736e6){_0x9910dc=_0x9910dc-0x0;var _0x86e5aa=_0xb7ee[_0x9910dc];return _0x86e5aa;};'use strict';var express=require(_0xeb7e('0x0'));var router=express[_0xeb7e('0x1')]();var auth=require(_0xeb7e('0x2'));var controller=require('./version.controller');router['get']('/',controller[_0xeb7e('0x3')]);router['get'](_0xeb7e('0x4'),auth[_0xeb7e('0x5')](),auth[_0xeb7e('0x6')](),controller[_0xeb7e('0x7')]);router['get'](_0xeb7e('0x8'),auth[_0xeb7e('0x5')](),auth[_0xeb7e('0x6')](),controller[_0xeb7e('0x9')]);router[_0xeb7e('0xa')](_0xeb7e('0xb'),auth[_0xeb7e('0x5')](),auth[_0xeb7e('0x6')](),controller[_0xeb7e('0xc')]);router[_0xeb7e('0xa')](_0xeb7e('0xd'),auth[_0xeb7e('0x5')](),controller['restart']);router[_0xeb7e('0xa')](_0xeb7e('0xe'),controller[_0xeb7e('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5442=['/fetch','isAuthenticated','canUpdate','/reset','reset','/pull','pull','/restart','migrations','exports','express','../../components/auth/service','./version.controller','index','get'];(function(_0x456300,_0x252ea2){var _0x177852=function(_0x54c2c7){while(--_0x54c2c7){_0x456300['push'](_0x456300['shift']());}};_0x177852(++_0x252ea2);}(_0x5442,0x1ae));var _0x2544=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x5442[_0x2d2c16];return _0x53f2fb;};'use strict';var express=require(_0x2544('0x0'));var router=express['Router']();var auth=require(_0x2544('0x1'));var controller=require(_0x2544('0x2'));router['get']('/',controller[_0x2544('0x3')]);router[_0x2544('0x4')](_0x2544('0x5'),auth[_0x2544('0x6')](),auth[_0x2544('0x7')](),controller['fetch']);router[_0x2544('0x4')](_0x2544('0x8'),auth[_0x2544('0x6')](),auth[_0x2544('0x7')](),controller[_0x2544('0x9')]);router[_0x2544('0x4')](_0x2544('0xa'),auth['isAuthenticated'](),auth[_0x2544('0x7')](),controller[_0x2544('0xb')]);router[_0x2544('0x4')](_0x2544('0xc'),auth['isAuthenticated'](),controller['restart']);router['get']('/migrations',controller[_0x2544('0xd')]);module[_0x2544('0xe')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 8be050f..42f84da 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 _0x0188=['exports','query','latest','tags','2.0.0','status','json','fetch','origin','master','git\x20fetch','reset','--hard','FETCH_HEAD','error','info','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','join','server','replace','.js','length','sort','Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','sequelize','UniqueConstraintError','Database\x20already\x20up-to-date','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0188,0x1e7));var _0x8018=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x0188[_0x166742];return _0xb7814a;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require(_0x8018('0x0'));var pkginfo=require(_0x8018('0x1'))(module,_0x8018('0x2'));var compareVersions=require(_0x8018('0x3'));var exec=require(_0x8018('0x4'))[_0x8018('0x5')];var db=require(_0x8018('0x6'))['db'];var config=require(_0x8018('0x7'));var pm2=require(_0x8018('0x8'));var logger=require(_0x8018('0x9'))('update');var git=require(_0x8018('0xa'))(config[_0x8018('0xb')]);exports[_0x8018('0xc')]=function(_0xd41589,_0x685473){var _0x253523={'current':module[_0x8018('0xd')][_0x8018('0x2')],'phonebar':0x2};if(_0xd41589[_0x8018('0xe')]&&_0xd41589[_0x8018('0xe')][_0x8018('0xf')]){return git['fetch']()[_0x8018('0x10')](function(_0x389eb3,_0x1f81e9){_0x253523[_0x8018('0xf')]=(_0x389eb3?module[_0x8018('0xd')][_0x8018('0x2')]:_0x1f81e9['latest'])||_0x8018('0x11');return _0x685473[_0x8018('0x12')](0xc8)[_0x8018('0x13')](_0x253523);});}else{return _0x685473[_0x8018('0x12')](0xc8)[_0x8018('0x13')](_0x253523);}};exports['fetch']=function(_0x292d1e,_0x5369b0){return git[_0x8018('0x14')]([_0x8018('0x15'),_0x8018('0x16')],function(_0x4c6f36){if(_0x4c6f36){logger['error'](_0x4c6f36);return _0x5369b0['status'](0x1f4)[_0x8018('0x13')](_0x4c6f36);}logger['info'](_0x8018('0x17'));return _0x5369b0[_0x8018('0x12')](0xc8)[_0x8018('0x13')]({'output':'git\x20fetch\x20origin\x20master'});});};exports['reset']=function(_0x3d209b,_0x402361){return git[_0x8018('0x18')]([_0x8018('0x19'),_0x8018('0x1a')],function(_0x49b77c){if(_0x49b77c){logger[_0x8018('0x1b')](_0x49b77c);return _0x402361[_0x8018('0x12')](0x1f4)['json'](_0x49b77c);}logger[_0x8018('0x1c')](_0x8018('0x1d'));return _0x402361[_0x8018('0x12')](0xc8)[_0x8018('0x13')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x5e471e,_0xfdacf9){exec(_0x8018('0x1e'),function(_0x448bbe,_0x4535fc,_0x4736fc){logger[_0x8018('0x1c')](_0x4535fc);logger['info'](_0x4736fc);if(_0x448bbe){logger[_0x8018('0x1b')](_0x448bbe);return _0xfdacf9['status'](0x1f4)['json'](_0x448bbe);}return _0xfdacf9[_0x8018('0x12')](0xc8)[_0x8018('0x13')]({'output':_0x4535fc});});};exports[_0x8018('0x1f')]=function(_0x2d71ec,_0x27350b){return pm2[_0x8018('0x1f')]('motion2')[_0x8018('0x20')](function(_0x55c6e1){logger[_0x8018('0x1c')](_0x8018('0x21'),_0x55c6e1);return _0x27350b[_0x8018('0x12')](0xc8)[_0x8018('0x13')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x8018('0x22')](function(_0x368434){logger[_0x8018('0x1b')](_0x368434);return _0x27350b[_0x8018('0x12')](0x1f4)[_0x8018('0x13')](_0x368434);});};exports[_0x8018('0x23')]=function(_0x5690c8,_0x3d723b){var _0x716d41=fs['readdirSync'](path[_0x8018('0x24')](config[_0x8018('0xb')],_0x8018('0x25'),_0x8018('0x23')));var _0x1715d2=[];for(var _0x3220e3=0x0;_0x3220e3<_0x716d41['length'];_0x3220e3++){var _0x1cca1e=_0x716d41[_0x3220e3][_0x8018('0x26')](_0x8018('0x27'),'');if(compareVersions(module[_0x8018('0xd')]['version'],_0x1cca1e)===-0x1){_0x1715d2['push'](_0x1cca1e);}}if(_0x1715d2[_0x8018('0x28')]){var _0x235043=_0x1715d2[_0x8018('0x29')](compareVersions);var _0xef0614=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x8018('0x2a')],'modelName':_0x8018('0x2a'),'columnName':'version'},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize']['constructor'],function(){throw new Error(_0x8018('0x2b'));}],'path':path['join'](config[_0x8018('0xb')],_0x8018('0x25'),_0x8018('0x23')),'pattern':/\.js$/}});_0xef0614['up']({'migrations':_['map'](_0x235043,function(_0x4cf8e2){return _0x4cf8e2+'.js';})})[_0x8018('0x20')](function(){return _0x3d723b[_0x8018('0x12')](0xc8)[_0x8018('0x13')]({'output':_0x8018('0x2c')+module['exports']['version']+_0x8018('0x2d')+_[_0x8018('0x2e')](_0x235043),'migrations':_[_0x8018('0x24')](_0x235043)});})['catch'](function(_0x3e8487){if(_0x3e8487 instanceof db[_0x8018('0x2f')][_0x8018('0x30')]){return _0x3d723b[_0x8018('0x12')](0xc8)[_0x8018('0x13')]({'output':_0x8018('0x31')});}else{return _0x3d723b[_0x8018('0x12')](0x1f4)['json'](_0x3e8487);}});}else{return _0x3d723b[_0x8018('0x12')](0xc8)[_0x8018('0x13')]({'output':_0x8018('0x31')});}}; \ No newline at end of file +var _0x6f6c=['2.0.0','status','json','origin','master','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','catch','migrations','length','replace','.js','push','sequelize','Migration','getQueryInterface','constructor','join','root','server','map','then','last','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','simple-git','index','exports','query','latest','fetch','tags'];(function(_0x21aebf,_0xef9b13){var _0x438f27=function(_0x18e56c){while(--_0x18e56c){_0x21aebf['push'](_0x21aebf['shift']());}};_0x438f27(++_0xef9b13);}(_0x6f6c,0x1d9));var _0xc6f6=function(_0x2db903,_0x2e6484){_0x2db903=_0x2db903-0x0;var _0x574ac8=_0x6f6c[_0x2db903];return _0x574ac8;};'use strict';var Umzug=require(_0xc6f6('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xc6f6('0x1'));var pkginfo=require(_0xc6f6('0x2'))(module,_0xc6f6('0x3'));var compareVersions=require(_0xc6f6('0x4'));var exec=require(_0xc6f6('0x5'))[_0xc6f6('0x6')];var db=require(_0xc6f6('0x7'))['db'];var config=require('../../config/environment');var pm2=require(_0xc6f6('0x8'));var logger=require(_0xc6f6('0x9'))('update');var git=require(_0xc6f6('0xa'))(config['root']);exports[_0xc6f6('0xb')]=function(_0x1e1145,_0x1f0ba2){var _0x3cefd3={'current':module[_0xc6f6('0xc')][_0xc6f6('0x3')],'phonebar':0x2};if(_0x1e1145[_0xc6f6('0xd')]&&_0x1e1145[_0xc6f6('0xd')][_0xc6f6('0xe')]){return git[_0xc6f6('0xf')]()[_0xc6f6('0x10')](function(_0x1e230d,_0x3d4fa4){_0x3cefd3['latest']=(_0x1e230d?module[_0xc6f6('0xc')][_0xc6f6('0x3')]:_0x3d4fa4[_0xc6f6('0xe')])||_0xc6f6('0x11');return _0x1f0ba2[_0xc6f6('0x12')](0xc8)[_0xc6f6('0x13')](_0x3cefd3);});}else{return _0x1f0ba2[_0xc6f6('0x12')](0xc8)[_0xc6f6('0x13')](_0x3cefd3);}};exports['fetch']=function(_0x4d3fac,_0x2258fb){return git[_0xc6f6('0xf')]([_0xc6f6('0x14'),_0xc6f6('0x15')],function(_0x500a05){if(_0x500a05){logger[_0xc6f6('0x16')](_0x500a05);return _0x2258fb[_0xc6f6('0x12')](0x1f4)[_0xc6f6('0x13')](_0x500a05);}logger['info'](_0xc6f6('0x17'));return _0x2258fb[_0xc6f6('0x12')](0xc8)['json']({'output':_0xc6f6('0x18')});});};exports['reset']=function(_0x30691b,_0x55027e){return git[_0xc6f6('0x19')]([_0xc6f6('0x1a'),'FETCH_HEAD'],function(_0x2b639e){if(_0x2b639e){logger[_0xc6f6('0x16')](_0x2b639e);return _0x55027e[_0xc6f6('0x12')](0x1f4)['json'](_0x2b639e);}logger[_0xc6f6('0x1b')](_0xc6f6('0x1c'));return _0x55027e[_0xc6f6('0x12')](0xc8)['json']({'output':_0xc6f6('0x1d')});});};exports[_0xc6f6('0x1e')]=function(_0x42e378,_0x380c55){exec(_0xc6f6('0x1f'),function(_0x14b813,_0x191092,_0x445d89){logger[_0xc6f6('0x1b')](_0x191092);logger[_0xc6f6('0x1b')](_0x445d89);if(_0x14b813){logger[_0xc6f6('0x16')](_0x14b813);return _0x380c55[_0xc6f6('0x12')](0x1f4)['json'](_0x14b813);}return _0x380c55['status'](0xc8)[_0xc6f6('0x13')]({'output':_0x191092});});};exports['restart']=function(_0x2197b7,_0xb35dab){return pm2['restart']('motion2')['then'](function(_0x51cf30){logger[_0xc6f6('0x1b')]('pm2\x20restart\x20motion\x20%s',_0x51cf30);return _0xb35dab[_0xc6f6('0x12')](0xc8)[_0xc6f6('0x13')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xc6f6('0x20')](function(_0x191bd7){logger['error'](_0x191bd7);return _0xb35dab[_0xc6f6('0x12')](0x1f4)['json'](_0x191bd7);});};exports[_0xc6f6('0x21')]=function(_0xa71239,_0x61d1ec){var _0x8675fc=fs['readdirSync'](path['join'](config['root'],'server','migrations'));var _0x51e334=[];for(var _0x1bfa80=0x0;_0x1bfa80<_0x8675fc[_0xc6f6('0x22')];_0x1bfa80++){var _0xc08311=_0x8675fc[_0x1bfa80][_0xc6f6('0x23')](_0xc6f6('0x24'),'');if(compareVersions(module['exports'][_0xc6f6('0x3')],_0xc08311)===-0x1){_0x51e334[_0xc6f6('0x25')](_0xc08311);}}if(_0x51e334['length']){var _0xbbb64e=_0x51e334['sort'](compareVersions);var _0x5f21c9=new Umzug({'storage':_0xc6f6('0x26'),'storageOptions':{'model':db[_0xc6f6('0x27')],'modelName':_0xc6f6('0x27'),'columnName':_0xc6f6('0x3')},'migrations':{'params':[db['sequelize'][_0xc6f6('0x28')](),db[_0xc6f6('0x26')][_0xc6f6('0x29')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xc6f6('0x2a')](config[_0xc6f6('0x2b')],_0xc6f6('0x2c'),'migrations'),'pattern':/\.js$/}});_0x5f21c9['up']({'migrations':_[_0xc6f6('0x2d')](_0xbbb64e,function(_0x253e0e){return _0x253e0e+_0xc6f6('0x24');})})[_0xc6f6('0x2e')](function(){return _0x61d1ec[_0xc6f6('0x12')](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0xc6f6('0x3')]+'\x20to\x20'+_[_0xc6f6('0x2f')](_0xbbb64e),'migrations':_[_0xc6f6('0x2a')](_0xbbb64e)});})[_0xc6f6('0x20')](function(_0x6c755f){if(_0x6c755f instanceof db['sequelize']['UniqueConstraintError']){return _0x61d1ec[_0xc6f6('0x12')](0xc8)[_0xc6f6('0x13')]({'output':_0xc6f6('0x30')});}else{return _0x61d1ec[_0xc6f6('0x12')](0x1f4)[_0xc6f6('0x13')](_0x6c755f);}});}else{return _0x61d1ec[_0xc6f6('0x12')](0xc8)[_0xc6f6('0x13')]({'output':_0xc6f6('0x30')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 34d1e36..e4144a3 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 _0x8d29=['index','/describe','describe','/:id','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated'];(function(_0x2324e9,_0x5947b7){var _0x5d7c4a=function(_0x24392a){while(--_0x24392a){_0x2324e9['push'](_0x2324e9['shift']());}};_0x5d7c4a(++_0x5947b7);}(_0x8d29,0x15d));var _0x98d2=function(_0x26dde1,_0xabd82){_0x26dde1=_0x26dde1-0x0;var _0x2a63f1=_0x8d29[_0x26dde1];return _0x2a63f1;};'use strict';var multer=require(_0x98d2('0x0'));var util=require(_0x98d2('0x1'));var path=require(_0x98d2('0x2'));var timeout=require(_0x98d2('0x3'));var express=require('express');var router=express[_0x98d2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x98d2('0x5'));var interaction=require(_0x98d2('0x6'));var config=require(_0x98d2('0x7'));var controller=require(_0x98d2('0x8'));router[_0x98d2('0x9')]('/',auth[_0x98d2('0xa')](),controller[_0x98d2('0xb')]);router[_0x98d2('0x9')](_0x98d2('0xc'),auth[_0x98d2('0xa')](),controller[_0x98d2('0xd')]);router[_0x98d2('0x9')](_0x98d2('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x98d2('0xa')](),controller[_0x98d2('0xf')]);router[_0x98d2('0x10')](_0x98d2('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x98d2('0x11')](_0x98d2('0xe'),auth[_0x98d2('0xa')](),controller[_0x98d2('0x12')]);module[_0x98d2('0x13')]=router; \ No newline at end of file +var _0x3d0c=['/describe','create','/:id','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x570f6b,_0x3f919f){var _0x197f34=function(_0x12824c){while(--_0x12824c){_0x570f6b['push'](_0x570f6b['shift']());}};_0x197f34(++_0x3f919f);}(_0x3d0c,0x1c8));var _0xc3d0=function(_0x5a27e8,_0x492a2f){_0x5a27e8=_0x5a27e8-0x0;var _0x4e38f7=_0x3d0c[_0x5a27e8];return _0x4e38f7;};'use strict';var multer=require(_0xc3d0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc3d0('0x1'));var express=require(_0xc3d0('0x2'));var router=express[_0xc3d0('0x3')]();var fs_extra=require(_0xc3d0('0x4'));var auth=require(_0xc3d0('0x5'));var interaction=require(_0xc3d0('0x6'));var config=require(_0xc3d0('0x7'));var controller=require(_0xc3d0('0x8'));router[_0xc3d0('0x9')]('/',auth[_0xc3d0('0xa')](),controller[_0xc3d0('0xb')]);router[_0xc3d0('0x9')](_0xc3d0('0xc'),auth[_0xc3d0('0xa')](),controller['describe']);router[_0xc3d0('0x9')]('/:id',auth[_0xc3d0('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xc3d0('0xd')]);router['put'](_0xc3d0('0xe'),auth[_0xc3d0('0xa')](),controller[_0xc3d0('0xf')]);router[_0xc3d0('0x10')]('/:id',auth[_0xc3d0('0xa')](),controller['destroy']);module[_0xc3d0('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index b115cfb..0af7103 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 _0x087b=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x5da398,_0x13a526){var _0x4db43a=function(_0x377646){while(--_0x377646){_0x5da398['push'](_0x5da398['shift']());}};_0x4db43a(++_0x13a526);}(_0x087b,0x11a));var _0xb087=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x087b[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0xb087('0x0'));module[_0xb087('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb087('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb087('0x2')]},'interface':{'type':Sequelize[_0xb087('0x2')]},'membername':{'type':Sequelize[_0xb087('0x2')]},'agentcalledAt':{'type':Sequelize[_0xb087('0x3')]},'agentconnectAt':{'type':Sequelize[_0xb087('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xb087('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xb087('0x3')]},'agentdumpAt':{'type':Sequelize[_0xb087('0x3')]},'holdtime':{'type':Sequelize[_0xb087('0x4')]},'agentcomplete':{'type':Sequelize[_0xb087('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xb087('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xb087('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xb087('0x4')]},'agentacw':{'type':Sequelize[_0xb087('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb087('0x4')]},'reason':{'type':Sequelize[_0xb087('0x2')]},'lastevent':{'type':Sequelize[_0xb087('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb087('0x4')]},'channelstatedesc':{'type':Sequelize[_0xb087('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb087('0x2')]},'connectedlinename':{'type':Sequelize[_0xb087('0x2')]},'language':{'type':Sequelize[_0xb087('0x2')]},'accountcode':{'type':Sequelize[_0xb087('0x2')]},'context':{'type':Sequelize[_0xb087('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb087('0x2')]},'destchannel':{'type':Sequelize[_0xb087('0x2')]},'destchannelstate':{'type':Sequelize[_0xb087('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb087('0x2')]},'destcalleridname':{'type':Sequelize[_0xb087('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xb087('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb087('0x2')]},'destlanguage':{'type':Sequelize[_0xb087('0x2')]},'destaccountcode':{'type':Sequelize[_0xb087('0x2')]},'destcontext':{'type':Sequelize[_0xb087('0x2')]},'destexten':{'type':Sequelize[_0xb087('0x2')]},'destpriority':{'type':Sequelize[_0xb087('0x2')]},'destuniqueid':{'type':Sequelize[_0xb087('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xb087('0x2')]},'transfer':{'type':Sequelize[_0xb087('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xb087('0x6')},'transferexten':{'type':Sequelize[_0xb087('0x2')]},'transferuniqueid':{'type':Sequelize[_0xb087('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x1cc3=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1cc3,0x11b));var _0x31cc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1cc3[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x31cc('0x0'));module[_0x31cc('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x31cc('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x31cc('0x2')]},'queue':{'type':Sequelize[_0x31cc('0x2')]},'interface':{'type':Sequelize[_0x31cc('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x31cc('0x3')]},'agentconnectAt':{'type':Sequelize[_0x31cc('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x31cc('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x31cc('0x3')]},'holdtime':{'type':Sequelize[_0x31cc('0x4')]},'agentcomplete':{'type':Sequelize[_0x31cc('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x31cc('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x31cc('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x31cc('0x4')]},'agentacw':{'type':Sequelize[_0x31cc('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x31cc('0x4')]},'reason':{'type':Sequelize[_0x31cc('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x31cc('0x2')]},'channelstate':{'type':Sequelize[_0x31cc('0x4')]},'channelstatedesc':{'type':Sequelize[_0x31cc('0x2')]},'connectedlinenum':{'type':Sequelize[_0x31cc('0x2')]},'connectedlinename':{'type':Sequelize[_0x31cc('0x2')]},'language':{'type':Sequelize[_0x31cc('0x2')]},'accountcode':{'type':Sequelize[_0x31cc('0x2')]},'context':{'type':Sequelize[_0x31cc('0x2')]},'exten':{'type':Sequelize[_0x31cc('0x2')]},'priority':{'type':Sequelize[_0x31cc('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x31cc('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x31cc('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x31cc('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x31cc('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x31cc('0x2')]},'destlanguage':{'type':Sequelize[_0x31cc('0x2')]},'destaccountcode':{'type':Sequelize[_0x31cc('0x2')]},'destcontext':{'type':Sequelize[_0x31cc('0x2')]},'destexten':{'type':Sequelize[_0x31cc('0x2')]},'destpriority':{'type':Sequelize[_0x31cc('0x2')]},'destuniqueid':{'type':Sequelize[_0x31cc('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x31cc('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x31cc('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x31cc('0x2')],'comment':_0x31cc('0x6')},'transferexten':{'type':Sequelize[_0x31cc('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x31cc('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 393194e..fdf9ea1 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(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];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(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 2cd708b..3b981b4 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 _0x7bae=['report_agent','uniqueid','destuniqueid','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport'];(function(_0x2390f3,_0xc3cc70){var _0x4558b0=function(_0x2735a5){while(--_0x2735a5){_0x2390f3['push'](_0x2390f3['shift']());}};_0x4558b0(++_0xc3cc70);}(_0x7bae,0x13b));var _0xe7ba=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x7bae[_0x550d12];return _0x12103d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7ba('0x0'))(_0xe7ba('0x1'));var moment=require('moment');var BPromise=require(_0xe7ba('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7ba('0x3'));var rimraf=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var attributes=require(_0xe7ba('0x6'));module[_0xe7ba('0x7')]=function(_0xfd3a22,_0x2d31df){return _0xfd3a22[_0xe7ba('0x8')](_0xe7ba('0x9'),attributes,{'tableName':_0xe7ba('0xa'),'paranoid':![],'indexes':[{'fields':[_0xe7ba('0xb'),_0xe7ba('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdcc4=['path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xdcc4,0xea));var _0x4dcc=function(_0x4d260b,_0x3cad9f){_0x4d260b=_0x4d260b-0x0;var _0x1d227a=_0xdcc4[_0x4d260b];return _0x1d227a;};'use strict';var _=require(_0x4dcc('0x0'));var util=require(_0x4dcc('0x1'));var logger=require(_0x4dcc('0x2'))(_0x4dcc('0x3'));var moment=require(_0x4dcc('0x4'));var BPromise=require('bluebird');var rp=require(_0x4dcc('0x5'));var fs=require('fs');var path=require(_0x4dcc('0x6'));var rimraf=require(_0x4dcc('0x7'));var config=require(_0x4dcc('0x8'));var attributes=require(_0x4dcc('0x9'));module[_0x4dcc('0xa')]=function(_0x5ce6e6,_0x1f8ef7){return _0x5ce6e6['define'](_0x4dcc('0xb'),attributes,{'tableName':_0x4dcc('0xc'),'paranoid':![],'indexes':[{'fields':[_0x4dcc('0xd'),_0x4dcc('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 6ad6b5f..4fa64a7 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 _0xcbdb=['create','body','options','raw','UpdateVoiceAgentReport','VoiceAgentReport','update','where','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceAgentReport'];(function(_0x4c14ee,_0x21c1ea){var _0x1daf81=function(_0x13642c){while(--_0x13642c){_0x4c14ee['push'](_0x4c14ee['shift']());}};_0x1daf81(++_0x21c1ea);}(_0xcbdb,0x1d7));var _0xbcbd=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xcbdb[_0x20c9b2];return _0x2c6030;};'use strict';var _=require(_0xbcbd('0x0'));var util=require('util');var moment=require(_0xbcbd('0x1'));var BPromise=require(_0xbcbd('0x2'));var rs=require(_0xbcbd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbcbd('0x4'))['db'];var utils=require(_0xbcbd('0x5'));var logger=require('../../config/logger')(_0xbcbd('0x6'));var config=require(_0xbcbd('0x7'));var jayson=require(_0xbcbd('0x8'));var client=jayson[_0xbcbd('0x9')][_0xbcbd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8acedc,_0x39b9a2,_0x396ad0){return new BPromise(function(_0x699385,_0x4b88c0){return client[_0xbcbd('0xb')](_0x8acedc,_0x396ad0)[_0xbcbd('0xc')](function(_0x308db0){logger[_0xbcbd('0xd')](_0xbcbd('0xe'),_0x39b9a2,_0xbcbd('0xf'));logger[_0xbcbd('0x10')](_0xbcbd('0x11'),_0x39b9a2,_0xbcbd('0xf'),JSON[_0xbcbd('0x12')](_0x308db0));if(_0x308db0[_0xbcbd('0x13')]){if(_0x308db0[_0xbcbd('0x13')]['code']===0x1f4){logger[_0xbcbd('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x39b9a2,_0x308db0[_0xbcbd('0x13')]['message']);return _0x4b88c0(_0x308db0[_0xbcbd('0x13')][_0xbcbd('0x14')]);}logger[_0xbcbd('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x39b9a2,_0x308db0[_0xbcbd('0x13')][_0xbcbd('0x14')]);return _0x699385(_0x308db0[_0xbcbd('0x13')][_0xbcbd('0x14')]);}else{logger[_0xbcbd('0xd')](_0xbcbd('0xe'),_0x39b9a2,'request\x20sent');_0x699385(_0x308db0[_0xbcbd('0x15')][_0xbcbd('0x14')]);}})[_0xbcbd('0x16')](function(_0xb0d47e){logger[_0xbcbd('0x13')](_0xbcbd('0xe'),_0x39b9a2,_0xb0d47e);_0x4b88c0(_0xb0d47e);});});}exports[_0xbcbd('0x17')]=function(_0x862e92){var _0x1ad55f=this;return new Promise(function(_0x5d50d3,_0x599bd6){return db['VoiceAgentReport'][_0xbcbd('0x18')](_0x862e92[_0xbcbd('0x19')],{'raw':_0x862e92[_0xbcbd('0x1a')]?_0x862e92[_0xbcbd('0x1a')][_0xbcbd('0x1b')]===undefined?!![]:![]:!![]})[_0xbcbd('0xc')](function(_0x307ee9){logger['info'](_0xbcbd('0x17'),_0x862e92);logger[_0xbcbd('0x10')](_0xbcbd('0x17'),_0x862e92,JSON[_0xbcbd('0x12')](_0x307ee9));_0x5d50d3(_0x307ee9);})[_0xbcbd('0x16')](function(_0x459064){logger[_0xbcbd('0x13')](_0xbcbd('0x17'),_0x459064[_0xbcbd('0x14')],_0x862e92);_0x599bd6(_0x1ad55f['error'](0x1f4,_0x459064[_0xbcbd('0x14')]));});});};exports[_0xbcbd('0x1c')]=function(_0x1fdccf){var _0x1e0d46=this;return new Promise(function(_0x53a6a1,_0x564df5){return db[_0xbcbd('0x1d')][_0xbcbd('0x1e')](_0x1fdccf[_0xbcbd('0x19')],{'raw':_0x1fdccf['options']?_0x1fdccf['options'][_0xbcbd('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fdccf[_0xbcbd('0x1a')]?_0x1fdccf[_0xbcbd('0x1a')][_0xbcbd('0x1f')]||null:null,'attributes':_0x1fdccf[_0xbcbd('0x1a')]?_0x1fdccf['options'][_0xbcbd('0x20')]||null:null,'limit':_0x1fdccf[_0xbcbd('0x1a')]?_0x1fdccf[_0xbcbd('0x1a')]['limit']||null:null})[_0xbcbd('0xc')](function(_0x49898f){logger['info'](_0xbcbd('0x1c'),_0x1fdccf);logger[_0xbcbd('0x10')](_0xbcbd('0x1c'),_0x1fdccf,JSON[_0xbcbd('0x12')](_0x49898f));_0x53a6a1(_0x49898f);})[_0xbcbd('0x16')](function(_0x86f0e2){logger[_0xbcbd('0x13')]('UpdateVoiceAgentReport',_0x86f0e2[_0xbcbd('0x14')],_0x1fdccf);_0x564df5(_0x1e0d46[_0xbcbd('0x13')](0x1f4,_0x86f0e2[_0xbcbd('0x14')]));});});}; \ No newline at end of file +var _0x7dd3=['options','raw','then','UpdateVoiceAgentReport','update','body','where','attributes','limit','stringify','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create'];(function(_0x2f79c5,_0x605ac9){var _0x49614c=function(_0x1ba33f){while(--_0x1ba33f){_0x2f79c5['push'](_0x2f79c5['shift']());}};_0x49614c(++_0x605ac9);}(_0x7dd3,0x1ea));var _0x37dd=function(_0x290b74,_0x4186b7){_0x290b74=_0x290b74-0x0;var _0x2cd1b0=_0x7dd3[_0x290b74];return _0x2cd1b0;};'use strict';var _=require(_0x37dd('0x0'));var util=require(_0x37dd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x37dd('0x2'));var db=require(_0x37dd('0x3'))['db'];var utils=require(_0x37dd('0x4'));var logger=require(_0x37dd('0x5'))(_0x37dd('0x6'));var config=require(_0x37dd('0x7'));var jayson=require(_0x37dd('0x8'));var client=jayson['client'][_0x37dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x276ac0,_0x2b4f30,_0x3c7136){return new BPromise(function(_0xa7c565,_0x2b157a){return client['request'](_0x276ac0,_0x3c7136)['then'](function(_0x1e45ae){logger[_0x37dd('0xa')](_0x37dd('0xb'),_0x2b4f30,_0x37dd('0xc'));logger[_0x37dd('0xd')](_0x37dd('0xe'),_0x2b4f30,_0x37dd('0xc'),JSON['stringify'](_0x1e45ae));if(_0x1e45ae[_0x37dd('0xf')]){if(_0x1e45ae[_0x37dd('0xf')][_0x37dd('0x10')]===0x1f4){logger[_0x37dd('0xf')](_0x37dd('0xb'),_0x2b4f30,_0x1e45ae[_0x37dd('0xf')][_0x37dd('0x11')]);return _0x2b157a(_0x1e45ae[_0x37dd('0xf')]['message']);}logger[_0x37dd('0xf')](_0x37dd('0xb'),_0x2b4f30,_0x1e45ae['error'][_0x37dd('0x11')]);return _0xa7c565(_0x1e45ae['error'][_0x37dd('0x11')]);}else{logger[_0x37dd('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x2b4f30,_0x37dd('0xc'));_0xa7c565(_0x1e45ae['result'][_0x37dd('0x11')]);}})[_0x37dd('0x12')](function(_0x572f66){logger[_0x37dd('0xf')](_0x37dd('0xb'),_0x2b4f30,_0x572f66);_0x2b157a(_0x572f66);});});}exports[_0x37dd('0x13')]=function(_0x1ceae2){var _0x226099=this;return new Promise(function(_0x33eda1,_0x51831e){return db[_0x37dd('0x14')][_0x37dd('0x15')](_0x1ceae2['body'],{'raw':_0x1ceae2[_0x37dd('0x16')]?_0x1ceae2[_0x37dd('0x16')][_0x37dd('0x17')]===undefined?!![]:![]:!![]})[_0x37dd('0x18')](function(_0xe48708){logger[_0x37dd('0xa')](_0x37dd('0x13'),_0x1ceae2);logger[_0x37dd('0xd')](_0x37dd('0x13'),_0x1ceae2,JSON['stringify'](_0xe48708));_0x33eda1(_0xe48708);})[_0x37dd('0x12')](function(_0x21fbb9){logger[_0x37dd('0xf')](_0x37dd('0x13'),_0x21fbb9[_0x37dd('0x11')],_0x1ceae2);_0x51831e(_0x226099['error'](0x1f4,_0x21fbb9[_0x37dd('0x11')]));});});};exports[_0x37dd('0x19')]=function(_0x43d068){var _0x1918b2=this;return new Promise(function(_0x333972,_0x13c5b2){return db['VoiceAgentReport'][_0x37dd('0x1a')](_0x43d068[_0x37dd('0x1b')],{'raw':_0x43d068[_0x37dd('0x16')]?_0x43d068[_0x37dd('0x16')][_0x37dd('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43d068[_0x37dd('0x16')]?_0x43d068[_0x37dd('0x16')][_0x37dd('0x1c')]||null:null,'attributes':_0x43d068['options']?_0x43d068['options'][_0x37dd('0x1d')]||null:null,'limit':_0x43d068[_0x37dd('0x16')]?_0x43d068[_0x37dd('0x16')][_0x37dd('0x1e')]||null:null})[_0x37dd('0x18')](function(_0x8e501f){logger[_0x37dd('0xa')]('UpdateVoiceAgentReport',_0x43d068);logger[_0x37dd('0xd')](_0x37dd('0x19'),_0x43d068,JSON[_0x37dd('0x1f')](_0x8e501f));_0x333972(_0x8e501f);})[_0x37dd('0x12')](function(_0x13acf6){logger['error'](_0x37dd('0x19'),_0x13acf6[_0x37dd('0x11')],_0x43d068);_0x13c5b2(_0x1918b2[_0x37dd('0xf')](0x1f4,_0x13acf6[_0x37dd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 6a2a3c0..9eccd65 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 _0x8ef6=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4f4937,_0x4491df){var _0x2ed0ea=function(_0x1bb670){while(--_0x1bb670){_0x4f4937['push'](_0x4f4937['shift']());}};_0x2ed0ea(++_0x4491df);}(_0x8ef6,0xf2));var _0x68ef=function(_0x468ad4,_0x4addb0){_0x468ad4=_0x468ad4-0x0;var _0x4511c6=_0x8ef6[_0x468ad4];return _0x4511c6;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xf')]('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0x11')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router[_0x68ef('0x13')]('/:id',auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);module[_0x68ef('0x15')]=router; \ No newline at end of file +var _0x6b8f=['destroy','exports','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put'];(function(_0x39609a,_0x28a563){var _0xecd92=function(_0x57241a){while(--_0x57241a){_0x39609a['push'](_0x39609a['shift']());}};_0xecd92(++_0x28a563);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x51c48c,_0x5640ce){_0x51c48c=_0x51c48c-0x0;var _0x8d7b49=_0x6b8f[_0x51c48c];return _0x8d7b49;};'use strict';var multer=require('multer');var util=require(_0xf6b8('0x0'));var path=require('path');var timeout=require(_0xf6b8('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf6b8('0x2'));var auth=require(_0xf6b8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xf6b8('0x4'));var controller=require(_0xf6b8('0x5'));router[_0xf6b8('0x6')]('/',auth['isAuthenticated'](),controller[_0xf6b8('0x7')]);router[_0xf6b8('0x6')](_0xf6b8('0x8'),auth[_0xf6b8('0x9')](),controller['describe']);router['get'](_0xf6b8('0xa'),auth['isAuthenticated'](),controller[_0xf6b8('0xb')]);router[_0xf6b8('0xc')]('/',auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xd')]);router[_0xf6b8('0xe')](_0xf6b8('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xf6b8('0xa'),auth[_0xf6b8('0x9')](),controller[_0xf6b8('0xf')]);module[_0xf6b8('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 17cd666..31418f4 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 _0x8533=['inbound','internal','inbound-fax','dialer','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x179a4d,_0x5c70e5){var _0x3db02c=function(_0x324f5a){while(--_0x324f5a){_0x179a4d['push'](_0x179a4d['shift']());}};_0x3db02c(++_0x5c70e5);}(_0x8533,0x141));var _0x3853=function(_0x5a84b9,_0x15bed4){_0x5a84b9=_0x5a84b9-0x0;var _0x4fb1ca=_0x8533[_0x5a84b9];return _0x4fb1ca;};'use strict';var Sequelize=require(_0x3853('0x0'));module[_0x3853('0x1')]={'uniqueid':{'type':Sequelize[_0x3853('0x2')]},'type':{'type':Sequelize['ENUM'](_0x3853('0x3'),_0x3853('0x4'),'outbound',_0x3853('0x5'),'outbound-fax',_0x3853('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3853('0x2')]},'source':{'type':Sequelize[_0x3853('0x2')]},'destination':{'type':Sequelize[_0x3853('0x2')]},'destinationcontext':{'type':Sequelize[_0x3853('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3853('0x2')]},'destinationchannel':{'type':Sequelize[_0x3853('0x2')]},'lastapplication':{'type':Sequelize[_0x3853('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x3853('0x7')]},'answertime':{'type':Sequelize[_0x3853('0x7')]},'endtime':{'type':Sequelize[_0x3853('0x7')]},'duration':{'type':Sequelize[_0x3853('0x8')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x3853('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3853('0x2')]},'amaflags':{'type':Sequelize[_0x3853('0x2')]},'userfield':{'type':Sequelize[_0x3853('0x2')]},'userDisposition':{'type':Sequelize[_0x3853('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x3853('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3853('0x2')]},'prefix':{'type':Sequelize[_0x3853('0x2')]},'routeid':{'type':Sequelize[_0x3853('0x8')]},'sipcallid':{'type':Sequelize[_0x3853('0x2')]}}; \ No newline at end of file +var _0x70de=['inbound','internal','outbound','inbound-fax','dialer','TEXT','DATE','INTEGER','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x70de,0xb3));var _0xe70d=function(_0x1d326a,_0x89b53){_0x1d326a=_0x1d326a-0x0;var _0x5804d5=_0x70de[_0x1d326a];return _0x5804d5;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe70d('0x0')]},'type':{'type':Sequelize['ENUM'](_0xe70d('0x1'),_0xe70d('0x2'),_0xe70d('0x3'),_0xe70d('0x4'),'outbound-fax',_0xe70d('0x5'))},'tag':{'type':Sequelize[_0xe70d('0x0')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xe70d('0x0')]},'destinationcontext':{'type':Sequelize[_0xe70d('0x0')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe70d('0x0')]},'destinationchannel':{'type':Sequelize[_0xe70d('0x0')]},'lastapplication':{'type':Sequelize[_0xe70d('0x0')]},'lastdata':{'type':Sequelize[_0xe70d('0x6')]},'starttime':{'type':Sequelize[_0xe70d('0x7')]},'systemanswertime':{'type':Sequelize[_0xe70d('0x7')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xe70d('0x7')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xe70d('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xe70d('0x0')]},'userDisposition':{'type':Sequelize[_0xe70d('0x0')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xe70d('0x0')]},'note':{'type':Sequelize[_0xe70d('0x0')]},'prefix':{'type':Sequelize[_0xe70d('0x0')]},'routeid':{'type':Sequelize[_0xe70d('0x8')]},'sipcallid':{'type':Sequelize[_0xe70d('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 7bd4d84..a6088b8 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file +var _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(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'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 ac7d44d..3b5dcdf 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 _0x7b2d=['./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x9843e6,_0x8c534a){var _0x447679=function(_0x405fc9){while(--_0x405fc9){_0x9843e6['push'](_0x9843e6['shift']());}};_0x447679(++_0x8c534a);}(_0x7b2d,0x1d7));var _0xd7b2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7b2d[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xd7b2('0x0'));var logger=require(_0xd7b2('0x1'))(_0xd7b2('0x2'));var moment=require(_0xd7b2('0x3'));var BPromise=require(_0xd7b2('0x4'));var rp=require(_0xd7b2('0x5'));var fs=require('fs');var path=require(_0xd7b2('0x6'));var rimraf=require(_0xd7b2('0x7'));var config=require(_0xd7b2('0x8'));var attributes=require(_0xd7b2('0x9'));module[_0xd7b2('0xa')]=function(_0x14f8a8,_0x5bb857){return _0x14f8a8[_0xd7b2('0xb')](_0xd7b2('0xc'),attributes,{'tableName':_0xd7b2('0xd'),'paranoid':![],'indexes':[{'fields':[_0xd7b2('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1b6d=['path','rimraf','../../config/environment','./voiceCallReport.attributes','VoiceCallReport','report_call','lodash','../../config/logger','moment','bluebird'];(function(_0x203032,_0x155200){var _0xd84060=function(_0x1c512c){while(--_0x1c512c){_0x203032['push'](_0x203032['shift']());}};_0xd84060(++_0x155200);}(_0x1b6d,0x1e6));var _0xd1b6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1b6d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd1b6('0x0'));var util=require('util');var logger=require(_0xd1b6('0x1'))('api');var moment=require(_0xd1b6('0x2'));var BPromise=require(_0xd1b6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1b6('0x4'));var rimraf=require(_0xd1b6('0x5'));var config=require(_0xd1b6('0x6'));var attributes=require(_0xd1b6('0x7'));module['exports']=function(_0x206666,_0x4c053c){return _0x206666['define'](_0xd1b6('0x8'),attributes,{'tableName':_0xd1b6('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 5db1623..58ff5ac 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 _0xd972=['CreateVoiceCallReport','create','body','update','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceCallReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','VoiceCallReport','findAll','options','raw','where','attributes','include','map','model','GetVoiceCallReport','stringify'];(function(_0x12eba7,_0x308f3d){var _0x48ec3f=function(_0x303a73){while(--_0x303a73){_0x12eba7['push'](_0x12eba7['shift']());}};_0x48ec3f(++_0x308f3d);}(_0xd972,0x108));var _0x2d97=function(_0x28ad97,_0x3f4dca){_0x28ad97=_0x28ad97-0x0;var _0x1ffb6a=_0xd972[_0x28ad97];return _0x1ffb6a;};'use strict';var _=require(_0x2d97('0x0'));var util=require('util');var moment=require(_0x2d97('0x1'));var BPromise=require(_0x2d97('0x2'));var rs=require(_0x2d97('0x3'));var fs=require('fs');var Redis=require(_0x2d97('0x4'));var db=require(_0x2d97('0x5'))['db'];var utils=require(_0x2d97('0x6'));var logger=require(_0x2d97('0x7'))(_0x2d97('0x8'));var config=require(_0x2d97('0x9'));var jayson=require(_0x2d97('0xa'));var client=jayson[_0x2d97('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40691b,_0x3aa961,_0x30be1f){return new BPromise(function(_0x5f42d5,_0x53e5f2){return client['request'](_0x40691b,_0x30be1f)[_0x2d97('0xc')](function(_0xca75a1){logger[_0x2d97('0xd')](_0x2d97('0xe'),_0x3aa961,'request\x20sent');logger[_0x2d97('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x3aa961,_0x2d97('0x10'),JSON['stringify'](_0xca75a1));if(_0xca75a1[_0x2d97('0x11')]){if(_0xca75a1['error'][_0x2d97('0x12')]===0x1f4){logger[_0x2d97('0x11')](_0x2d97('0xe'),_0x3aa961,_0xca75a1[_0x2d97('0x11')][_0x2d97('0x13')]);return _0x53e5f2(_0xca75a1[_0x2d97('0x11')]['message']);}logger[_0x2d97('0x11')](_0x2d97('0xe'),_0x3aa961,_0xca75a1['error'][_0x2d97('0x13')]);return _0x5f42d5(_0xca75a1[_0x2d97('0x11')][_0x2d97('0x13')]);}else{logger[_0x2d97('0xd')](_0x2d97('0xe'),_0x3aa961,_0x2d97('0x10'));_0x5f42d5(_0xca75a1['result'][_0x2d97('0x13')]);}})[_0x2d97('0x14')](function(_0x266de0){logger[_0x2d97('0x11')](_0x2d97('0xe'),_0x3aa961,_0x266de0);_0x53e5f2(_0x266de0);});});}exports['GetVoiceCallReport']=function(_0xa96eec){var _0x2dc0fa=this;return new Promise(function(_0x15f964,_0x45b285){return db[_0x2d97('0x15')][_0x2d97('0x16')]({'raw':_0xa96eec['options']?_0xa96eec[_0x2d97('0x17')][_0x2d97('0x18')]===undefined?!![]:![]:!![],'where':_0xa96eec[_0x2d97('0x17')]?_0xa96eec[_0x2d97('0x17')][_0x2d97('0x19')]||null:null,'attributes':_0xa96eec['options']?_0xa96eec[_0x2d97('0x17')][_0x2d97('0x1a')]||null:null,'limit':_0xa96eec[_0x2d97('0x17')]?_0xa96eec[_0x2d97('0x17')]['limit']||null:null,'include':_0xa96eec[_0x2d97('0x17')]?_0xa96eec['options'][_0x2d97('0x1b')]?_[_0x2d97('0x1c')](_0xa96eec['options']['include'],function(_0x1fd6a5){return{'model':db[_0x1fd6a5[_0x2d97('0x1d')]],'as':_0x1fd6a5['as'],'attributes':_0x1fd6a5[_0x2d97('0x1a')],'include':_0x1fd6a5[_0x2d97('0x1b')]?_[_0x2d97('0x1c')](_0x1fd6a5[_0x2d97('0x1b')],function(_0x380162){return{'model':db[_0x380162['model']],'as':_0x380162['as'],'attributes':_0x380162[_0x2d97('0x1a')],'include':_0x380162[_0x2d97('0x1b')]?_[_0x2d97('0x1c')](_0x380162['include'],function(_0x2870e5){return{'model':db[_0x2870e5[_0x2d97('0x1d')]],'as':_0x2870e5['as'],'attributes':_0x2870e5[_0x2d97('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2d97('0xc')](function(_0x35a0a5){logger[_0x2d97('0xd')](_0x2d97('0x1e'),_0xa96eec);logger[_0x2d97('0xf')](_0x2d97('0x1e'),_0xa96eec,JSON[_0x2d97('0x1f')](_0x35a0a5));_0x15f964(_0x35a0a5);})[_0x2d97('0x14')](function(_0x4bcce6){logger[_0x2d97('0x11')](_0x2d97('0x1e'),_0x4bcce6[_0x2d97('0x13')],_0xa96eec);_0x45b285(_0x2dc0fa['error'](0x1f4,_0x4bcce6['message']));});});};exports[_0x2d97('0x20')]=function(_0x5418e6){var _0x4e15c0=this;return new Promise(function(_0x1a0f45,_0x3a3702){return db[_0x2d97('0x15')][_0x2d97('0x21')](_0x5418e6[_0x2d97('0x22')],{'raw':_0x5418e6[_0x2d97('0x17')]?_0x5418e6[_0x2d97('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x2d97('0xc')](function(_0xa99a1c){logger['info'](_0x2d97('0x20'),_0x5418e6);logger[_0x2d97('0xf')](_0x2d97('0x20'),_0x5418e6,JSON[_0x2d97('0x1f')](_0xa99a1c));_0x1a0f45(_0xa99a1c);})['catch'](function(_0x21a598){logger['error'](_0x2d97('0x20'),_0x21a598[_0x2d97('0x13')],_0x5418e6);_0x3a3702(_0x4e15c0['error'](0x1f4,_0x21a598[_0x2d97('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0x10b552){var _0x2d2667=this;return new Promise(function(_0x4860cb,_0xac9997){return db[_0x2d97('0x15')][_0x2d97('0x23')](_0x10b552[_0x2d97('0x22')],{'raw':_0x10b552[_0x2d97('0x17')]?_0x10b552['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10b552[_0x2d97('0x17')]?_0x10b552['options'][_0x2d97('0x19')]||null:null,'attributes':_0x10b552['options']?_0x10b552[_0x2d97('0x17')]['attributes']||null:null,'limit':_0x10b552[_0x2d97('0x17')]?_0x10b552[_0x2d97('0x17')][_0x2d97('0x24')]||null:null})['then'](function(_0x20372c){logger[_0x2d97('0xd')]('UpdateVoiceCallReport',_0x10b552);logger[_0x2d97('0xf')]('UpdateVoiceCallReport',_0x10b552,JSON[_0x2d97('0x1f')](_0x20372c));_0x4860cb(_0x20372c);})[_0x2d97('0x14')](function(_0x54c564){logger['error']('UpdateVoiceCallReport',_0x54c564[_0x2d97('0x13')],_0x10b552);_0xac9997(_0x2d2667[_0x2d97('0x11')](0x1f4,_0x54c564[_0x2d97('0x13')]));});});}; \ No newline at end of file +var _0x9170=['options','raw','where','attributes','limit','include','map','model','GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','UpdateVoiceCallReport','update','body','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','catch'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x9170,0x164));var _0x0917=function(_0x2c5497,_0x2d4357){_0x2c5497=_0x2c5497-0x0;var _0x94fac=_0x9170[_0x2c5497];return _0x94fac;};'use strict';var _=require('lodash');var util=require(_0x0917('0x0'));var moment=require(_0x0917('0x1'));var BPromise=require(_0x0917('0x2'));var rs=require(_0x0917('0x3'));var fs=require('fs');var Redis=require(_0x0917('0x4'));var db=require(_0x0917('0x5'))['db'];var utils=require(_0x0917('0x6'));var logger=require(_0x0917('0x7'))(_0x0917('0x8'));var config=require(_0x0917('0x9'));var jayson=require(_0x0917('0xa'));var client=jayson['client'][_0x0917('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3351a5,_0x16290e,_0x4a2518){return new BPromise(function(_0x59bcd8,_0x1961e1){return client[_0x0917('0xc')](_0x3351a5,_0x4a2518)[_0x0917('0xd')](function(_0x7cdb69){logger[_0x0917('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x16290e,_0x0917('0xf'));logger[_0x0917('0x10')](_0x0917('0x11'),_0x16290e,_0x0917('0xf'),JSON[_0x0917('0x12')](_0x7cdb69));if(_0x7cdb69[_0x0917('0x13')]){if(_0x7cdb69[_0x0917('0x13')][_0x0917('0x14')]===0x1f4){logger['error'](_0x0917('0x15'),_0x16290e,_0x7cdb69[_0x0917('0x13')]['message']);return _0x1961e1(_0x7cdb69[_0x0917('0x13')][_0x0917('0x16')]);}logger['error'](_0x0917('0x15'),_0x16290e,_0x7cdb69[_0x0917('0x13')][_0x0917('0x16')]);return _0x59bcd8(_0x7cdb69[_0x0917('0x13')]['message']);}else{logger['info'](_0x0917('0x15'),_0x16290e,_0x0917('0xf'));_0x59bcd8(_0x7cdb69['result']['message']);}})[_0x0917('0x17')](function(_0x506664){logger['error'](_0x0917('0x15'),_0x16290e,_0x506664);_0x1961e1(_0x506664);});});}exports['GetVoiceCallReport']=function(_0x262621){var _0x2a3646=this;return new Promise(function(_0x241d61,_0x5733ff){return db['VoiceCallReport']['findAll']({'raw':_0x262621[_0x0917('0x18')]?_0x262621[_0x0917('0x18')][_0x0917('0x19')]===undefined?!![]:![]:!![],'where':_0x262621[_0x0917('0x18')]?_0x262621[_0x0917('0x18')][_0x0917('0x1a')]||null:null,'attributes':_0x262621[_0x0917('0x18')]?_0x262621[_0x0917('0x18')][_0x0917('0x1b')]||null:null,'limit':_0x262621[_0x0917('0x18')]?_0x262621[_0x0917('0x18')][_0x0917('0x1c')]||null:null,'include':_0x262621['options']?_0x262621[_0x0917('0x18')][_0x0917('0x1d')]?_['map'](_0x262621['options'][_0x0917('0x1d')],function(_0x1bda10){return{'model':db[_0x1bda10['model']],'as':_0x1bda10['as'],'attributes':_0x1bda10['attributes'],'include':_0x1bda10[_0x0917('0x1d')]?_[_0x0917('0x1e')](_0x1bda10[_0x0917('0x1d')],function(_0x40ae68){return{'model':db[_0x40ae68[_0x0917('0x1f')]],'as':_0x40ae68['as'],'attributes':_0x40ae68[_0x0917('0x1b')],'include':_0x40ae68['include']?_[_0x0917('0x1e')](_0x40ae68['include'],function(_0x2ee522){return{'model':db[_0x2ee522[_0x0917('0x1f')]],'as':_0x2ee522['as'],'attributes':_0x2ee522[_0x0917('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0917('0xd')](function(_0x27addc){logger[_0x0917('0xe')](_0x0917('0x20'),_0x262621);logger[_0x0917('0x10')]('GetVoiceCallReport',_0x262621,JSON[_0x0917('0x12')](_0x27addc));_0x241d61(_0x27addc);})[_0x0917('0x17')](function(_0x1d62b5){logger[_0x0917('0x13')](_0x0917('0x20'),_0x1d62b5[_0x0917('0x16')],_0x262621);_0x5733ff(_0x2a3646[_0x0917('0x13')](0x1f4,_0x1d62b5[_0x0917('0x16')]));});});};exports[_0x0917('0x21')]=function(_0x19dccf){var _0x2e7404=this;return new Promise(function(_0x5332cc,_0x3012c6){return db[_0x0917('0x22')]['create'](_0x19dccf['body'],{'raw':_0x19dccf['options']?_0x19dccf[_0x0917('0x18')][_0x0917('0x19')]===undefined?!![]:![]:!![]})[_0x0917('0xd')](function(_0x39059e){logger[_0x0917('0xe')](_0x0917('0x21'),_0x19dccf);logger[_0x0917('0x10')]('CreateVoiceCallReport',_0x19dccf,JSON[_0x0917('0x12')](_0x39059e));_0x5332cc(_0x39059e);})[_0x0917('0x17')](function(_0x43b626){logger[_0x0917('0x13')](_0x0917('0x21'),_0x43b626[_0x0917('0x16')],_0x19dccf);_0x3012c6(_0x2e7404[_0x0917('0x13')](0x1f4,_0x43b626[_0x0917('0x16')]));});});};exports[_0x0917('0x23')]=function(_0x2bd60e){var _0x52e962=this;return new Promise(function(_0x59b28c,_0x4d9d5e){return db[_0x0917('0x22')][_0x0917('0x24')](_0x2bd60e[_0x0917('0x25')],{'raw':_0x2bd60e['options']?_0x2bd60e[_0x0917('0x18')][_0x0917('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bd60e['options']?_0x2bd60e[_0x0917('0x18')][_0x0917('0x1a')]||null:null,'attributes':_0x2bd60e[_0x0917('0x18')]?_0x2bd60e[_0x0917('0x18')][_0x0917('0x1b')]||null:null,'limit':_0x2bd60e['options']?_0x2bd60e[_0x0917('0x18')]['limit']||null:null})[_0x0917('0xd')](function(_0x42c5e9){logger[_0x0917('0xe')](_0x0917('0x23'),_0x2bd60e);logger[_0x0917('0x10')](_0x0917('0x23'),_0x2bd60e,JSON['stringify'](_0x42c5e9));_0x59b28c(_0x42c5e9);})[_0x0917('0x17')](function(_0x9bbf6){logger[_0x0917('0x13')](_0x0917('0x23'),_0x9bbf6[_0x0917('0x16')],_0x2bd60e);_0x4d9d5e(_0x52e962[_0x0917('0x13')](0x1f4,_0x9bbf6['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 3d5cc31..0bbb233 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 _0x7b05=['post','create','put','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4868fa,_0x442b36){var _0xc5d93a=function(_0x74057c){while(--_0x74057c){_0x4868fa['push'](_0x4868fa['shift']());}};_0xc5d93a(++_0x442b36);}(_0x7b05,0xc2));var _0x57b0=function(_0x1488cd,_0x25a893){_0x1488cd=_0x1488cd-0x0;var _0x63fa13=_0x7b05[_0x1488cd];return _0x63fa13;};'use strict';var multer=require(_0x57b0('0x0'));var util=require(_0x57b0('0x1'));var path=require(_0x57b0('0x2'));var timeout=require(_0x57b0('0x3'));var express=require(_0x57b0('0x4'));var router=express['Router']();var fs_extra=require(_0x57b0('0x5'));var auth=require(_0x57b0('0x6'));var interaction=require(_0x57b0('0x7'));var config=require(_0x57b0('0x8'));var controller=require(_0x57b0('0x9'));router[_0x57b0('0xa')]('/',auth[_0x57b0('0xb')](),controller[_0x57b0('0xc')]);router[_0x57b0('0xa')](_0x57b0('0xd'),auth[_0x57b0('0xb')](),controller[_0x57b0('0xe')]);router[_0x57b0('0xf')]('/',auth[_0x57b0('0xb')](),controller[_0x57b0('0x10')]);router[_0x57b0('0x11')](_0x57b0('0xd'),auth[_0x57b0('0xb')](),controller['update']);router['delete'](_0x57b0('0xd'),auth[_0x57b0('0xb')](),controller['destroy']);module[_0x57b0('0x12')]=router; \ No newline at end of file +var _0xf168=['update','delete','destroy','exports','path','express','Router','fs-extra','./voiceChanSpy.controller','isAuthenticated','post','put','/:id'];(function(_0x1a58b3,_0x2e191e){var _0xc153b3=function(_0x2fd92e){while(--_0x2fd92e){_0x1a58b3['push'](_0x1a58b3['shift']());}};_0xc153b3(++_0x2e191e);}(_0xf168,0x12f));var _0x8f16=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0xf168[_0x3c4f1f];return _0x19cb69;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8f16('0x0'));var timeout=require('connect-timeout');var express=require(_0x8f16('0x1'));var router=express[_0x8f16('0x2')]();var fs_extra=require(_0x8f16('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8f16('0x4'));router['get']('/',auth[_0x8f16('0x5')](),controller['index']);router['get']('/:id',auth[_0x8f16('0x5')](),controller['show']);router[_0x8f16('0x6')]('/',auth[_0x8f16('0x5')](),controller['create']);router[_0x8f16('0x7')](_0x8f16('0x8'),auth['isAuthenticated'](),controller[_0x8f16('0x9')]);router[_0x8f16('0xa')](_0x8f16('0x8'),auth[_0x8f16('0x5')](),controller[_0x8f16('0xb')]);module[_0x8f16('0xc')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 117dbfb..e3b86b8 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 _0x1cac=['setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x1cac,0x182));var _0xc1ca=function(_0x4c2ed3,_0x58c14d){_0x4c2ed3=_0x4c2ed3-0x0;var _0x4a3785=_0x1cac[_0x4c2ed3];return _0x4a3785;};'use strict';var Sequelize=require(_0xc1ca('0x0'));module[_0xc1ca('0x1')]={'name':{'type':Sequelize[_0xc1ca('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xc1ca('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xc1ca('0x2')],'set':function(_0x57cde7){this[_0xc1ca('0x4')](_0xc1ca('0x5'),_0x57cde7?_0x57cde7[_0xc1ca('0x6')](''):[]);},'get':function(){return this[_0xc1ca('0x7')]('options')?this[_0xc1ca('0x7')](_0xc1ca('0x5'))[_0xc1ca('0x8')](''):[];}},'auth':{'type':Sequelize[_0xc1ca('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0xc1ca('0x2')]},'record':{'type':Sequelize[_0xc1ca('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc1ca('0x2')]},'description':{'type':Sequelize[_0xc1ca('0x2')]}}; \ No newline at end of file +var _0xcd34=['getDataValue','options','split','BOOLEAN','sequelize','STRING','setDataValue'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0xcd34,0x11c));var _0x4cd3=function(_0x113d46,_0x3fad3f){_0x113d46=_0x113d46-0x0;var _0xa647c9=_0xcd34[_0x113d46];return _0xa647c9;};'use strict';var Sequelize=require(_0x4cd3('0x0'));module['exports']={'name':{'type':Sequelize[_0x4cd3('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x4cd3('0x1')],'set':function(_0x40d651){this[_0x4cd3('0x2')]('options',_0x40d651?_0x40d651['join'](''):[]);},'get':function(){return this[_0x4cd3('0x3')]('options')?this[_0x4cd3('0x3')](_0x4cd3('0x4'))[_0x4cd3('0x5')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x4cd3('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4cd3('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 13ea4ff..7841f7b 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 _0x2e54=['apply','reject','save','then','get','ChanSpies','stack','name','send','index','map','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','VoiceChanSpy','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x13765d,_0x1914a0){var _0x3d652d=function(_0x4ac147){while(--_0x4ac147){_0x13765d['push'](_0x13765d['shift']());}};_0x3d652d(++_0x1914a0);}(_0x2e54,0x1dd));var _0x42e5=function(_0x524197,_0x596500){_0x524197=_0x524197-0x0;var _0x45fa57=_0x2e54[_0x524197];return _0x45fa57;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];function respondWithStatusCode(_0x12385d,_0x4530ba){_0x4530ba=_0x4530ba||0xcc;return function(_0x41598d){if(_0x41598d){return _0x12385d[_0x42e5('0x18')](_0x4530ba);}return _0x12385d[_0x42e5('0x19')](_0x4530ba)[_0x42e5('0x1a')]();};}function respondWithResult(_0x96fae2,_0x447648){_0x447648=_0x447648||0xc8;return function(_0x23957f){if(_0x23957f){return _0x96fae2['status'](_0x447648)[_0x42e5('0x1b')](_0x23957f);}};}function respondWithFilteredResult(_0x1d8e52,_0x4034bd){return function(_0x388300){if(_0x388300){var _0x2f4999=typeof _0x4034bd[_0x42e5('0x1c')]===_0x42e5('0x1d')&&typeof _0x4034bd[_0x42e5('0x1e')]===_0x42e5('0x1d');var _0x3c7b79=_0x388300[_0x42e5('0x1f')];var _0x38282d=_0x2f4999?0x0:_0x4034bd[_0x42e5('0x1c')];var _0x23fe09=_0x2f4999?_0x388300['count']:_0x4034bd[_0x42e5('0x1c')]+_0x4034bd['limit'];var _0x5f4428;if(_0x23fe09>=_0x3c7b79){_0x23fe09=_0x3c7b79;_0x5f4428=0xc8;}else{_0x5f4428=0xce;}_0x1d8e52[_0x42e5('0x19')](_0x5f4428);return _0x1d8e52[_0x42e5('0x20')]('Content-Range',_0x38282d+'-'+_0x23fe09+'/'+_0x3c7b79)[_0x42e5('0x1b')](_0x388300);}return null;};}function patchUpdates(_0x39a3e2){return function(_0x1c2169){try{jsonpatch[_0x42e5('0x21')](_0x1c2169,_0x39a3e2,!![]);}catch(_0x1150f4){return BPromise[_0x42e5('0x22')](_0x1150f4);}return _0x1c2169[_0x42e5('0x23')]();};}function saveUpdates(_0x58eee5,_0x4da508){return function(_0x283d44){if(_0x283d44){return _0x283d44['update'](_0x58eee5)[_0x42e5('0x24')](function(_0x2e9574){return _0x2e9574;});}return null;};}function removeEntity(_0x37d10e,_0x49490f){return function(_0x32380f){if(_0x32380f){return _0x32380f['destroy']()[_0x42e5('0x24')](function(){var _0xf29221=_0x32380f[_0x42e5('0x25')]({'plain':!![]});var _0x275c80=_0x42e5('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x275c80,'resourceId':_0xf29221['id']}})[_0x42e5('0x24')](function(){return _0x32380f;});})['then'](function(){_0x37d10e['status'](0xcc)[_0x42e5('0x1a')]();});}};}function handleEntityNotFound(_0x5b1727,_0x392c6b){return function(_0x2d9e65){if(!_0x2d9e65){_0x5b1727[_0x42e5('0x18')](0x194);}return _0x2d9e65;};}function handleError(_0x1c8ee4,_0x27ae27){_0x27ae27=_0x27ae27||0x1f4;return function(_0x2f1edc){logger['error'](_0x2f1edc[_0x42e5('0x27')]);if(_0x2f1edc[_0x42e5('0x28')]){delete _0x2f1edc[_0x42e5('0x28')];}_0x1c8ee4[_0x42e5('0x19')](_0x27ae27)[_0x42e5('0x29')](_0x2f1edc);};}exports[_0x42e5('0x2a')]=function(_0x383e97,_0x282cbf){var _0x5a4930={},_0x2ba9ef={},_0x2c7542={'count':0x0,'rows':[]};var _0x3d9e8b=_[_0x42e5('0x2b')](db['VoiceChanSpy'][_0x42e5('0x2c')],function(_0xf5a3dc){return{'name':_0xf5a3dc[_0x42e5('0x2d')],'type':_0xf5a3dc[_0x42e5('0x2e')]['key']};});_0x2ba9ef['model']=_[_0x42e5('0x2b')](_0x3d9e8b,'name');_0x2ba9ef[_0x42e5('0x2f')]=_['keys'](_0x383e97[_0x42e5('0x2f')]);_0x2ba9ef[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0x2ba9ef['model'],_0x2ba9ef[_0x42e5('0x2f')]);_0x5a4930[_0x42e5('0x32')]=_['intersection'](_0x2ba9ef[_0x42e5('0x33')],qs['fields'](_0x383e97[_0x42e5('0x2f')][_0x42e5('0x34')]));_0x5a4930[_0x42e5('0x32')]=_0x5a4930[_0x42e5('0x32')][_0x42e5('0x35')]?_0x5a4930[_0x42e5('0x32')]:_0x2ba9ef[_0x42e5('0x33')];if(!_0x383e97['query']['hasOwnProperty'](_0x42e5('0x36'))){_0x5a4930[_0x42e5('0x1e')]=qs[_0x42e5('0x1e')](_0x383e97['query']['limit']);_0x5a4930['offset']=qs['offset'](_0x383e97[_0x42e5('0x2f')][_0x42e5('0x1c')]);}_0x5a4930[_0x42e5('0x37')]=qs[_0x42e5('0x38')](_0x383e97[_0x42e5('0x2f')][_0x42e5('0x38')]);_0x5a4930[_0x42e5('0x39')]=qs[_0x42e5('0x30')](_['pick'](_0x383e97[_0x42e5('0x2f')],_0x2ba9ef['filters']),_0x3d9e8b);if(_0x383e97[_0x42e5('0x2f')][_0x42e5('0x3a')]){_0x5a4930[_0x42e5('0x39')]=_[_0x42e5('0x3b')](_0x5a4930[_0x42e5('0x39')],{'$or':_[_0x42e5('0x2b')](_0x3d9e8b,function(_0xd5e7f5){if(_0xd5e7f5['type']!==_0x42e5('0x3c')){var _0x356ff6={};_0x356ff6[_0xd5e7f5['name']]={'$like':'%'+_0x383e97[_0x42e5('0x2f')]['filter']+'%'};return _0x356ff6;}})});}_0x5a4930=_['merge']({},_0x5a4930,_0x383e97['options']);var _0x1105ea={'where':_0x5a4930[_0x42e5('0x39')]};return db[_0x42e5('0x3d')][_0x42e5('0x1f')](_0x1105ea)[_0x42e5('0x24')](function(_0x77aa22){_0x2c7542[_0x42e5('0x1f')]=_0x77aa22;if(_0x383e97['query'][_0x42e5('0x3e')]){_0x5a4930[_0x42e5('0x3f')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x42e5('0x40')](_0x5a4930);})[_0x42e5('0x24')](function(_0x5db771){_0x2c7542[_0x42e5('0x41')]=_0x5db771;return _0x2c7542;})[_0x42e5('0x24')](respondWithFilteredResult(_0x282cbf,_0x5a4930))[_0x42e5('0x42')](handleError(_0x282cbf,null));};exports[_0x42e5('0x43')]=function(_0x424304,_0x4d32f4){var _0x41e1fd={'raw':![],'where':{'id':_0x424304[_0x42e5('0x44')]['id']}},_0xc34e51={};_0xc34e51[_0x42e5('0x33')]=_['keys'](db[_0x42e5('0x3d')][_0x42e5('0x2c')]);_0xc34e51[_0x42e5('0x2f')]=_[_0x42e5('0x45')](_0x424304[_0x42e5('0x2f')]);_0xc34e51[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0xc34e51[_0x42e5('0x33')],_0xc34e51['query']);_0x41e1fd[_0x42e5('0x32')]=_['intersection'](_0xc34e51['model'],qs[_0x42e5('0x34')](_0x424304[_0x42e5('0x2f')][_0x42e5('0x34')]));_0x41e1fd[_0x42e5('0x32')]=_0x41e1fd[_0x42e5('0x32')][_0x42e5('0x35')]?_0x41e1fd[_0x42e5('0x32')]:_0xc34e51['model'];if(_0x424304[_0x42e5('0x2f')][_0x42e5('0x3e')]){_0x41e1fd[_0x42e5('0x3f')]=[{'all':!![]}];}_0x41e1fd=_[_0x42e5('0x3b')]({},_0x41e1fd,_0x424304[_0x42e5('0x46')]);return db[_0x42e5('0x3d')][_0x42e5('0x47')](_0x41e1fd)[_0x42e5('0x24')](handleEntityNotFound(_0x4d32f4,null))['then'](respondWithResult(_0x4d32f4,null))[_0x42e5('0x42')](handleError(_0x4d32f4,null));};exports[_0x42e5('0x48')]=function(_0x3616f4,_0x48757e){return db[_0x42e5('0x3d')][_0x42e5('0x48')](_0x3616f4[_0x42e5('0x49')],{})[_0x42e5('0x24')](function(_0x2586b0){var _0x528ddd=_0x3616f4[_0x42e5('0x4a')]['get']({'plain':!![]});if(!_0x528ddd)throw new Error(_0x42e5('0x4b'));if(_0x528ddd[_0x42e5('0x4c')]===_0x42e5('0x4a')){var _0x48b63b=_0x2586b0['get']({'plain':!![]});var _0x4f0639=_0x42e5('0x26');return db[_0x42e5('0x4d')][_0x42e5('0x47')]({'where':{'name':_0x4f0639,'userProfileId':_0x528ddd[_0x42e5('0x4e')]},'raw':!![]})['then'](function(_0x3ae9de){if(_0x3ae9de&&_0x3ae9de[_0x42e5('0x4f')]===0x0){return db[_0x42e5('0x50')]['create']({'name':_0x48b63b[_0x42e5('0x28')],'resourceId':_0x48b63b['id'],'type':_0x3ae9de['name'],'sectionId':_0x3ae9de['id']},{})[_0x42e5('0x24')](function(){return _0x2586b0;});}else{return _0x2586b0;}})[_0x42e5('0x42')](function(_0x53e29b){logger[_0x42e5('0x51')](_0x42e5('0x52'),_0x53e29b);throw _0x53e29b;});}return _0x2586b0;})[_0x42e5('0x24')](respondWithResult(_0x48757e,0xc9))[_0x42e5('0x42')](handleError(_0x48757e,null));};exports[_0x42e5('0x53')]=function(_0x3f043f,_0x41c1dc){if(_0x3f043f[_0x42e5('0x49')]['id']){delete _0x3f043f[_0x42e5('0x49')]['id'];}return db[_0x42e5('0x3d')]['find']({'where':{'id':_0x3f043f[_0x42e5('0x44')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0x41c1dc,null))[_0x42e5('0x24')](saveUpdates(_0x3f043f[_0x42e5('0x49')],null))[_0x42e5('0x24')](respondWithResult(_0x41c1dc,null))['catch'](handleError(_0x41c1dc,null));};exports[_0x42e5('0x54')]=function(_0x2b226f,_0x40b633){return db[_0x42e5('0x3d')]['find']({'where':{'id':_0x2b226f['params']['id']}})['then'](handleEntityNotFound(_0x40b633,null))[_0x42e5('0x24')](removeEntity(_0x40b633,null))[_0x42e5('0x42')](handleError(_0x40b633,null));}; \ No newline at end of file +var _0x4584=['reject','update','then','get','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','VoiceChanSpy','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','count','set','Content-Range','apply'];(function(_0x3a6bb5,_0x3fa8ee){var _0x3713ff=function(_0x290ece){while(--_0x290ece){_0x3a6bb5['push'](_0x3a6bb5['shift']());}};_0x3713ff(++_0x3fa8ee);}(_0x4584,0x1cf));var _0x4458=function(_0x2e87e4,_0x591ef7){_0x2e87e4=_0x2e87e4-0x0;var _0x3c9855=_0x4584[_0x2e87e4];return _0x3c9855;};'use strict';var emlformat=require(_0x4458('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4458('0x1'));var jsonpatch=require(_0x4458('0x2'));var rp=require(_0x4458('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4458('0x4'));var util=require(_0x4458('0x5'));var path=require(_0x4458('0x6'));var sox=require(_0x4458('0x7'));var csv=require(_0x4458('0x8'));var ejs=require(_0x4458('0x9'));var fs=require('fs');var fs_extra=require(_0x4458('0xa'));var _=require(_0x4458('0xb'));var squel=require(_0x4458('0xc'));var crypto=require('crypto');var jsforce=require(_0x4458('0xd'));var deskjs=require(_0x4458('0xe'));var toCsv=require(_0x4458('0x8'));var querystring=require(_0x4458('0xf'));var Papa=require(_0x4458('0x10'));var Redis=require(_0x4458('0x11'));var authService=require(_0x4458('0x12'));var qs=require(_0x4458('0x13'));var as=require(_0x4458('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4458('0x15'))(_0x4458('0x16'));var utils=require(_0x4458('0x17'));var config=require(_0x4458('0x18'));var licenseUtil=require(_0x4458('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x302552,_0x527809){_0x527809=_0x527809||0xcc;return function(_0x1f13ab){if(_0x1f13ab){return _0x302552['sendStatus'](_0x527809);}return _0x302552[_0x4458('0x1a')](_0x527809)[_0x4458('0x1b')]();};}function respondWithResult(_0x4abaf9,_0x5e2f05){_0x5e2f05=_0x5e2f05||0xc8;return function(_0x42771e){if(_0x42771e){return _0x4abaf9[_0x4458('0x1a')](_0x5e2f05)[_0x4458('0x1c')](_0x42771e);}};}function respondWithFilteredResult(_0x2619ed,_0x30d440){return function(_0x21ff11){if(_0x21ff11){var _0x225679=typeof _0x30d440[_0x4458('0x1d')]==='undefined'&&typeof _0x30d440[_0x4458('0x1e')]==='undefined';var _0x3bb7f4=_0x21ff11[_0x4458('0x1f')];var _0x130d39=_0x225679?0x0:_0x30d440['offset'];var _0x319247=_0x225679?_0x21ff11[_0x4458('0x1f')]:_0x30d440[_0x4458('0x1d')]+_0x30d440[_0x4458('0x1e')];var _0x463809;if(_0x319247>=_0x3bb7f4){_0x319247=_0x3bb7f4;_0x463809=0xc8;}else{_0x463809=0xce;}_0x2619ed[_0x4458('0x1a')](_0x463809);return _0x2619ed[_0x4458('0x20')](_0x4458('0x21'),_0x130d39+'-'+_0x319247+'/'+_0x3bb7f4)[_0x4458('0x1c')](_0x21ff11);}return null;};}function patchUpdates(_0x2dfcf1){return function(_0x531ab6){try{jsonpatch[_0x4458('0x22')](_0x531ab6,_0x2dfcf1,!![]);}catch(_0x24ecd1){return BPromise[_0x4458('0x23')](_0x24ecd1);}return _0x531ab6['save']();};}function saveUpdates(_0xe09a2b,_0x1688f2){return function(_0x58aeca){if(_0x58aeca){return _0x58aeca[_0x4458('0x24')](_0xe09a2b)[_0x4458('0x25')](function(_0x5d3df2){return _0x5d3df2;});}return null;};}function removeEntity(_0xcf668c,_0x17e482){return function(_0x3e7945){if(_0x3e7945){return _0x3e7945['destroy']()[_0x4458('0x25')](function(){var _0x597e89=_0x3e7945[_0x4458('0x26')]({'plain':!![]});var _0x504a86='ChanSpies';return db[_0x4458('0x27')][_0x4458('0x28')]({'where':{'type':_0x504a86,'resourceId':_0x597e89['id']}})[_0x4458('0x25')](function(){return _0x3e7945;});})[_0x4458('0x25')](function(){_0xcf668c[_0x4458('0x1a')](0xcc)[_0x4458('0x1b')]();});}};}function handleEntityNotFound(_0xa1f81e,_0x63bef){return function(_0x452ec4){if(!_0x452ec4){_0xa1f81e[_0x4458('0x29')](0x194);}return _0x452ec4;};}function handleError(_0x14df7b,_0x47f369){_0x47f369=_0x47f369||0x1f4;return function(_0x179be7){logger['error'](_0x179be7[_0x4458('0x2a')]);if(_0x179be7['name']){delete _0x179be7[_0x4458('0x2b')];}_0x14df7b[_0x4458('0x1a')](_0x47f369)[_0x4458('0x2c')](_0x179be7);};}exports[_0x4458('0x2d')]=function(_0x652afc,_0x235832){var _0x1494d2={},_0x164b01={},_0xe21853={'count':0x0,'rows':[]};var _0x3ea32d=_[_0x4458('0x2e')](db[_0x4458('0x2f')][_0x4458('0x30')],function(_0x328a9f){return{'name':_0x328a9f['fieldName'],'type':_0x328a9f[_0x4458('0x31')][_0x4458('0x32')]};});_0x164b01[_0x4458('0x33')]=_[_0x4458('0x2e')](_0x3ea32d,_0x4458('0x2b'));_0x164b01[_0x4458('0x34')]=_[_0x4458('0x35')](_0x652afc[_0x4458('0x34')]);_0x164b01['filters']=_['intersection'](_0x164b01['model'],_0x164b01[_0x4458('0x34')]);_0x1494d2[_0x4458('0x36')]=_[_0x4458('0x37')](_0x164b01[_0x4458('0x33')],qs[_0x4458('0x38')](_0x652afc[_0x4458('0x34')][_0x4458('0x38')]));_0x1494d2[_0x4458('0x36')]=_0x1494d2[_0x4458('0x36')][_0x4458('0x39')]?_0x1494d2[_0x4458('0x36')]:_0x164b01[_0x4458('0x33')];if(!_0x652afc[_0x4458('0x34')]['hasOwnProperty'](_0x4458('0x3a'))){_0x1494d2['limit']=qs[_0x4458('0x1e')](_0x652afc[_0x4458('0x34')][_0x4458('0x1e')]);_0x1494d2[_0x4458('0x1d')]=qs['offset'](_0x652afc['query'][_0x4458('0x1d')]);}_0x1494d2[_0x4458('0x3b')]=qs[_0x4458('0x3c')](_0x652afc['query'][_0x4458('0x3c')]);_0x1494d2[_0x4458('0x3d')]=qs[_0x4458('0x3e')](_[_0x4458('0x3f')](_0x652afc[_0x4458('0x34')],_0x164b01[_0x4458('0x3e')]),_0x3ea32d);if(_0x652afc[_0x4458('0x34')][_0x4458('0x40')]){_0x1494d2[_0x4458('0x3d')]=_[_0x4458('0x41')](_0x1494d2['where'],{'$or':_['map'](_0x3ea32d,function(_0x778878){if(_0x778878[_0x4458('0x31')]!==_0x4458('0x42')){var _0x3feb47={};_0x3feb47[_0x778878[_0x4458('0x2b')]]={'$like':'%'+_0x652afc[_0x4458('0x34')][_0x4458('0x40')]+'%'};return _0x3feb47;}})});}_0x1494d2=_[_0x4458('0x41')]({},_0x1494d2,_0x652afc[_0x4458('0x43')]);var _0x524b6c={'where':_0x1494d2[_0x4458('0x3d')]};return db[_0x4458('0x2f')][_0x4458('0x1f')](_0x524b6c)[_0x4458('0x25')](function(_0x2e98ce){_0xe21853[_0x4458('0x1f')]=_0x2e98ce;if(_0x652afc[_0x4458('0x34')][_0x4458('0x44')]){_0x1494d2[_0x4458('0x45')]=[{'all':!![]}];}return db[_0x4458('0x2f')]['findAll'](_0x1494d2);})[_0x4458('0x25')](function(_0x474735){_0xe21853[_0x4458('0x46')]=_0x474735;return _0xe21853;})[_0x4458('0x25')](respondWithFilteredResult(_0x235832,_0x1494d2))[_0x4458('0x47')](handleError(_0x235832,null));};exports['show']=function(_0x4a7ee7,_0x5b4a72){var _0x477dde={'raw':![],'where':{'id':_0x4a7ee7[_0x4458('0x48')]['id']}},_0x339175={};_0x339175['model']=_[_0x4458('0x35')](db['VoiceChanSpy']['rawAttributes']);_0x339175['query']=_[_0x4458('0x35')](_0x4a7ee7[_0x4458('0x34')]);_0x339175['filters']=_[_0x4458('0x37')](_0x339175[_0x4458('0x33')],_0x339175['query']);_0x477dde['attributes']=_[_0x4458('0x37')](_0x339175[_0x4458('0x33')],qs[_0x4458('0x38')](_0x4a7ee7[_0x4458('0x34')][_0x4458('0x38')]));_0x477dde['attributes']=_0x477dde[_0x4458('0x36')]['length']?_0x477dde['attributes']:_0x339175['model'];if(_0x4a7ee7['query'][_0x4458('0x44')]){_0x477dde[_0x4458('0x45')]=[{'all':!![]}];}_0x477dde=_['merge']({},_0x477dde,_0x4a7ee7[_0x4458('0x43')]);return db['VoiceChanSpy'][_0x4458('0x49')](_0x477dde)[_0x4458('0x25')](handleEntityNotFound(_0x5b4a72,null))[_0x4458('0x25')](respondWithResult(_0x5b4a72,null))[_0x4458('0x47')](handleError(_0x5b4a72,null));};exports[_0x4458('0x4a')]=function(_0x455931,_0x3dd938){return db[_0x4458('0x2f')][_0x4458('0x4a')](_0x455931[_0x4458('0x4b')],{})[_0x4458('0x25')](function(_0x39aed8){var _0x367b3a=_0x455931[_0x4458('0x4c')][_0x4458('0x26')]({'plain':!![]});if(!_0x367b3a)throw new Error(_0x4458('0x4d'));if(_0x367b3a['role']===_0x4458('0x4c')){var _0x5251e1=_0x39aed8[_0x4458('0x26')]({'plain':!![]});var _0x50f86c=_0x4458('0x4e');return db['UserProfileSection'][_0x4458('0x49')]({'where':{'name':_0x50f86c,'userProfileId':_0x367b3a[_0x4458('0x4f')]},'raw':!![]})['then'](function(_0x1d9d48){if(_0x1d9d48&&_0x1d9d48[_0x4458('0x50')]===0x0){return db[_0x4458('0x27')][_0x4458('0x4a')]({'name':_0x5251e1[_0x4458('0x2b')],'resourceId':_0x5251e1['id'],'type':_0x1d9d48[_0x4458('0x2b')],'sectionId':_0x1d9d48['id']},{})['then'](function(){return _0x39aed8;});}else{return _0x39aed8;}})['catch'](function(_0x1d043f){logger[_0x4458('0x51')](_0x4458('0x52'),_0x1d043f);throw _0x1d043f;});}return _0x39aed8;})[_0x4458('0x25')](respondWithResult(_0x3dd938,0xc9))[_0x4458('0x47')](handleError(_0x3dd938,null));};exports[_0x4458('0x24')]=function(_0x53ff8a,_0x13535f){if(_0x53ff8a[_0x4458('0x4b')]['id']){delete _0x53ff8a['body']['id'];}return db[_0x4458('0x2f')][_0x4458('0x49')]({'where':{'id':_0x53ff8a[_0x4458('0x48')]['id']}})['then'](handleEntityNotFound(_0x13535f,null))[_0x4458('0x25')](saveUpdates(_0x53ff8a[_0x4458('0x4b')],null))[_0x4458('0x25')](respondWithResult(_0x13535f,null))['catch'](handleError(_0x13535f,null));};exports['destroy']=function(_0x54bb3f,_0x1f1899){return db[_0x4458('0x2f')][_0x4458('0x49')]({'where':{'id':_0x54bb3f[_0x4458('0x48')]['id']}})[_0x4458('0x25')](handleEntityNotFound(_0x1f1899,null))[_0x4458('0x25')](removeEntity(_0x1f1899,null))[_0x4458('0x47')](handleError(_0x1f1899,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index b8f4ebe..87b9037 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 _0xa97a=['ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','findAll','agent','then','catch','exports','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','prefix','system','merge','Set','format','chanspy','record','push','${UNIQUEID}.%s,a','recordingFormat'];(function(_0x5bdb14,_0x4f87c1){var _0x5b3d71=function(_0x3c27a6){while(--_0x3c27a6){_0x5bdb14['push'](_0x5bdb14['shift']());}};_0x5b3d71(++_0x4f87c1);}(_0xa97a,0xed));var _0xaa97=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0xa97a[_0x541ea6];return _0x3c3e84;};'use strict';var _=require('lodash');var util=require(_0xaa97('0x0'));var BPromise=require(_0xaa97('0x1'));var attributes=require(_0xaa97('0x2'));var getUserApplications=function(_0x402e23,_0x320ebf,_0x345054){var _0xeccaed=0x1;var _0x216d3c=[];var _0x20ee15={'context':_0x320ebf[_0xaa97('0x3')]||_0xaa97('0x4'),'exten':util['format']('%s%s',_0x402e23[_0xaa97('0x5')],_0x345054),'type':_0xaa97('0x6'),'isApp':![],'ChanSpyId':_0x402e23['id'],'UserId':_0x320ebf['id']};_0x216d3c['push'](_[_0xaa97('0x7')]({'app':_0xaa97('0x8'),'appdata':util[_0xaa97('0x9')]('CDR(type)=%s',_0xaa97('0xa')),'priority':_0xeccaed++},_0x20ee15));if(_0x402e23[_0xaa97('0xb')]){_0x216d3c[_0xaa97('0xc')](_['merge']({'app':'MixMonitor','appdata':util[_0xaa97('0x9')](_0xaa97('0xd'),_0x402e23[_0xaa97('0xe')]),'priority':_0xeccaed++},_0x20ee15));}if(_0x402e23['auth']){_0x216d3c[_0xaa97('0xc')](_['merge']({'app':'Authenticate','appdata':_0x402e23['password'],'priority':_0xeccaed++},_0x20ee15));}_0x216d3c['push'](_[_0xaa97('0x7')]({'app':_0xaa97('0xf'),'appdata':util[_0xaa97('0x9')](_0xaa97('0x10'),_0x320ebf['name'],_0x402e23[_0xaa97('0x11')]?_0x402e23[_0xaa97('0x11')][_0xaa97('0x12')](''):''),'priority':_0xeccaed++},_0x20ee15));if(_0x402e23[_0xaa97('0xb')]){_0x216d3c[_0xaa97('0xc')](_[_0xaa97('0x7')]({'app':_0xaa97('0x13'),'priority':_0xeccaed++},_0x20ee15));}return _0x216d3c;};var getChanSpyApplications=function(_0x5305c3,_0x528efb){var _0x27bcc3=[];for(var _0x2bd9e0=0x0,_0x30a4b1=0x1;_0x2bd9e0<_0x528efb[_0xaa97('0x14')];_0x2bd9e0++,_0x30a4b1=0x1){_0x27bcc3=_0x27bcc3[_0xaa97('0x15')](getUserApplications(_0x5305c3,_0x528efb[_0x2bd9e0],_0x528efb[_0x2bd9e0]['internal']));if(_0x528efb[_0x2bd9e0][_0xaa97('0x16')]!=_0x528efb[_0x2bd9e0][_0xaa97('0x17')]){_0x27bcc3=_0x27bcc3[_0xaa97('0x15')](getUserApplications(_0x5305c3,_0x528efb[_0x2bd9e0],_0x528efb[_0x2bd9e0][_0xaa97('0x17')]));}}return _0x27bcc3;};var getChanSpyPromise=function(_0xe3a2fb,_0x53e63c){return new BPromise(function(_0x14ea6c,_0xea8bbe){return _0xe3a2fb[_0xaa97('0x18')][_0xaa97('0x19')]({'attributes':['id',_0xaa97('0x17'),_0xaa97('0x16')],'where':{'role':_0xaa97('0x1a'),'chanspy':!![]},'raw':!![]})[_0xaa97('0x1b')](function(_0x2801eb){if(_0x2801eb){return _0x14ea6c(getChanSpyApplications(_0x53e63c,_0x2801eb));}return _0x14ea6c([]);})[_0xaa97('0x1c')](function(_0x39f58b){_0xea8bbe(_0x39f58b);});});};module[_0xaa97('0x1d')]=function(_0x15be99,_0x4e1d0b){var _0x3e3a61=_0x15be99['models'];return _0x15be99[_0xaa97('0x1e')](_0xaa97('0x1f'),attributes,{'tableName':_0xaa97('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ae06c,_0x2a0119,_0xa48f96){return getChanSpyPromise(_0x3e3a61,_0x4ae06c)[_0xaa97('0x1b')](function(_0x2f7f57){if(_0x2f7f57&&_0x2f7f57['length']){return _0x3e3a61[_0xaa97('0x21')][_0xaa97('0x22')](_0x2f7f57);}})[_0xaa97('0x1b')](function(){_0xa48f96();})[_0xaa97('0x1c')](function(_0x499b96){_0xa48f96(_0x499b96);});},'afterUpdate':function(_0x39d97f,_0x23ff01,_0x161b3f){return _0x3e3a61[_0xaa97('0x21')]['destroy']({'where':{'ChanSpyId':_0x39d97f['id']}})[_0xaa97('0x1b')](function(){return getChanSpyPromise(_0x3e3a61,_0x39d97f);})[_0xaa97('0x1b')](function(_0x5c7a0e){if(_0x5c7a0e&&_0x5c7a0e[_0xaa97('0x14')]){return _0x3e3a61[_0xaa97('0x21')][_0xaa97('0x22')](_0x5c7a0e);}})[_0xaa97('0x1b')](function(){_0x161b3f();})[_0xaa97('0x1c')](function(_0x3cbfeb){_0x161b3f(_0x3cbfeb);});},'afterDestroy':function(_0x48142d,_0x2905ba,_0xacbceb){return _0x3e3a61[_0xaa97('0x21')][_0xaa97('0x23')]({'where':{'ChanSpyId':_0x48142d['id']}})[_0xaa97('0x1b')](function(){_0xacbceb();})[_0xaa97('0x1c')](function(_0x515532){_0xacbceb(_0x515532);});}}});}; \ No newline at end of file +var _0x0584=['chanspy','record','push','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','findAll','agent','then','catch','exports','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','bluebird','./voiceChanSpy.attributes','format','%s%s','merge','Set','CDR(type)=%s'];(function(_0x4b4d6b,_0x6d8b84){var _0x221945=function(_0x46ce44){while(--_0x46ce44){_0x4b4d6b['push'](_0x4b4d6b['shift']());}};_0x221945(++_0x6d8b84);}(_0x0584,0x16e));var _0x4058=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x0584[_0x174ef5];return _0x1cc379;};'use strict';var _=require(_0x4058('0x0'));var util=require('util');var BPromise=require(_0x4058('0x1'));var attributes=require(_0x4058('0x2'));var getUserApplications=function(_0x37eb1c,_0x588382,_0x414b46){var _0x2a2cb1=0x1;var _0x160497=[];var _0x5277a6={'context':_0x588382['context']||'from-sip','exten':util[_0x4058('0x3')](_0x4058('0x4'),_0x37eb1c['prefix'],_0x414b46),'type':'system','isApp':![],'ChanSpyId':_0x37eb1c['id'],'UserId':_0x588382['id']};_0x160497['push'](_[_0x4058('0x5')]({'app':_0x4058('0x6'),'appdata':util['format'](_0x4058('0x7'),_0x4058('0x8')),'priority':_0x2a2cb1++},_0x5277a6));if(_0x37eb1c[_0x4058('0x9')]){_0x160497[_0x4058('0xa')](_[_0x4058('0x5')]({'app':'MixMonitor','appdata':util[_0x4058('0x3')]('${UNIQUEID}.%s,a',_0x37eb1c[_0x4058('0xb')]),'priority':_0x2a2cb1++},_0x5277a6));}if(_0x37eb1c[_0x4058('0xc')]){_0x160497[_0x4058('0xa')](_['merge']({'app':_0x4058('0xd'),'appdata':_0x37eb1c[_0x4058('0xe')],'priority':_0x2a2cb1++},_0x5277a6));}_0x160497[_0x4058('0xa')](_[_0x4058('0x5')]({'app':_0x4058('0xf'),'appdata':util[_0x4058('0x3')](_0x4058('0x10'),_0x588382[_0x4058('0x11')],_0x37eb1c[_0x4058('0x12')]?_0x37eb1c['options'][_0x4058('0x13')](''):''),'priority':_0x2a2cb1++},_0x5277a6));if(_0x37eb1c[_0x4058('0x9')]){_0x160497['push'](_['merge']({'app':_0x4058('0x14'),'priority':_0x2a2cb1++},_0x5277a6));}return _0x160497;};var getChanSpyApplications=function(_0x4c2b5c,_0x22861e){var _0x55617e=[];for(var _0x2edcf2=0x0,_0x18bdc9=0x1;_0x2edcf2<_0x22861e[_0x4058('0x15')];_0x2edcf2++,_0x18bdc9=0x1){_0x55617e=_0x55617e[_0x4058('0x16')](getUserApplications(_0x4c2b5c,_0x22861e[_0x2edcf2],_0x22861e[_0x2edcf2][_0x4058('0x17')]));if(_0x22861e[_0x2edcf2][_0x4058('0x17')]!=_0x22861e[_0x2edcf2][_0x4058('0x11')]){_0x55617e=_0x55617e[_0x4058('0x16')](getUserApplications(_0x4c2b5c,_0x22861e[_0x2edcf2],_0x22861e[_0x2edcf2][_0x4058('0x11')]));}}return _0x55617e;};var getChanSpyPromise=function(_0x4312bf,_0x5ecc5f){return new BPromise(function(_0x510749,_0x3f9b11){return _0x4312bf['User'][_0x4058('0x18')]({'attributes':['id',_0x4058('0x11'),_0x4058('0x17')],'where':{'role':_0x4058('0x19'),'chanspy':!![]},'raw':!![]})[_0x4058('0x1a')](function(_0x245ed9){if(_0x245ed9){return _0x510749(getChanSpyApplications(_0x5ecc5f,_0x245ed9));}return _0x510749([]);})[_0x4058('0x1b')](function(_0x51ad38){_0x3f9b11(_0x51ad38);});});};module[_0x4058('0x1c')]=function(_0x494788,_0x2912d7){var _0x42c28c=_0x494788['models'];return _0x494788['define'](_0x4058('0x1d'),attributes,{'tableName':_0x4058('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x99df08,_0xba58fc,_0x53967a){return getChanSpyPromise(_0x42c28c,_0x99df08)[_0x4058('0x1a')](function(_0x403250){if(_0x403250&&_0x403250['length']){return _0x42c28c[_0x4058('0x1f')][_0x4058('0x20')](_0x403250);}})[_0x4058('0x1a')](function(){_0x53967a();})['catch'](function(_0x15c609){_0x53967a(_0x15c609);});},'afterUpdate':function(_0x10217b,_0x4f8cbe,_0x5f084d){return _0x42c28c['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x10217b['id']}})['then'](function(){return getChanSpyPromise(_0x42c28c,_0x10217b);})[_0x4058('0x1a')](function(_0x1b6a05){if(_0x1b6a05&&_0x1b6a05['length']){return _0x42c28c[_0x4058('0x1f')]['bulkCreate'](_0x1b6a05);}})['then'](function(){_0x5f084d();})[_0x4058('0x1b')](function(_0x15d17f){_0x5f084d(_0x15d17f);});},'afterDestroy':function(_0x5aeb21,_0x4ee3ba,_0x3b8c3b){return _0x42c28c[_0x4058('0x1f')][_0x4058('0x21')]({'where':{'ChanSpyId':_0x5aeb21['id']}})[_0x4058('0x1a')](function(){_0x3b8c3b();})[_0x4058('0x1b')](function(_0x2a0fb3){_0x3b8c3b(_0x2a0fb3);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 9233918..4178dc6 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 _0x9099=['../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x39e15b,_0x555185){var _0x4e5766=function(_0x45ef45){while(--_0x45ef45){_0x39e15b['push'](_0x39e15b['shift']());}};_0x4e5766(++_0x555185);}(_0x9099,0x1ac));var _0x9909=function(_0x15dbca,_0x1d7c3c){_0x15dbca=_0x15dbca-0x0;var _0x326533=_0x9099[_0x15dbca];return _0x326533;};'use strict';var _=require(_0x9909('0x0'));var util=require('util');var moment=require(_0x9909('0x1'));var BPromise=require(_0x9909('0x2'));var rs=require(_0x9909('0x3'));var fs=require('fs');var Redis=require(_0x9909('0x4'));var db=require(_0x9909('0x5'))['db'];var utils=require(_0x9909('0x6'));var logger=require(_0x9909('0x7'))(_0x9909('0x8'));var config=require(_0x9909('0x9'));var jayson=require(_0x9909('0xa'));var client=jayson[_0x9909('0xb')][_0x9909('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b7391,_0x3dc2dd,_0x54011f){return new BPromise(function(_0x6d755a,_0x5dcd39){return client['request'](_0x3b7391,_0x54011f)['then'](function(_0x5023b7){logger[_0x9909('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x3dc2dd,_0x9909('0xe'));logger[_0x9909('0xf')](_0x9909('0x10'),_0x3dc2dd,'request\x20sent',JSON[_0x9909('0x11')](_0x5023b7));if(_0x5023b7['error']){if(_0x5023b7[_0x9909('0x12')][_0x9909('0x13')]===0x1f4){logger[_0x9909('0x12')](_0x9909('0x14'),_0x3dc2dd,_0x5023b7[_0x9909('0x12')][_0x9909('0x15')]);return _0x5dcd39(_0x5023b7[_0x9909('0x12')][_0x9909('0x15')]);}logger[_0x9909('0x12')](_0x9909('0x14'),_0x3dc2dd,_0x5023b7[_0x9909('0x12')][_0x9909('0x15')]);return _0x6d755a(_0x5023b7[_0x9909('0x12')]['message']);}else{logger[_0x9909('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x3dc2dd,_0x9909('0xe'));_0x6d755a(_0x5023b7['result'][_0x9909('0x15')]);}})[_0x9909('0x16')](function(_0x245f0d){logger['error'](_0x9909('0x14'),_0x3dc2dd,_0x245f0d);_0x5dcd39(_0x245f0d);});});} \ No newline at end of file +var _0x49e9=['stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x5dcb7b,_0x388d57){var _0x2f6976=function(_0xeb5a43){while(--_0xeb5a43){_0x5dcb7b['push'](_0x5dcb7b['shift']());}};_0x2f6976(++_0x388d57);}(_0x49e9,0x10f));var _0x949e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x49e9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x949e('0x0'));var util=require(_0x949e('0x1'));var moment=require('moment');var BPromise=require(_0x949e('0x2'));var rs=require(_0x949e('0x3'));var fs=require('fs');var Redis=require(_0x949e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x949e('0x5'))('rpc');var config=require(_0x949e('0x6'));var jayson=require(_0x949e('0x7'));var client=jayson[_0x949e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17f649,_0x16c669,_0xfc4f8a){return new BPromise(function(_0x34ee57,_0x40d442){return client[_0x949e('0x9')](_0x17f649,_0xfc4f8a)[_0x949e('0xa')](function(_0x56e31d){logger[_0x949e('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x16c669,_0x949e('0xc'));logger[_0x949e('0xd')](_0x949e('0xe'),_0x16c669,'request\x20sent',JSON[_0x949e('0xf')](_0x56e31d));if(_0x56e31d[_0x949e('0x10')]){if(_0x56e31d[_0x949e('0x10')][_0x949e('0x11')]===0x1f4){logger[_0x949e('0x10')](_0x949e('0x12'),_0x16c669,_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);return _0x40d442(_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);}logger[_0x949e('0x10')](_0x949e('0x12'),_0x16c669,_0x56e31d[_0x949e('0x10')][_0x949e('0x13')]);return _0x34ee57(_0x56e31d[_0x949e('0x10')]['message']);}else{logger[_0x949e('0xb')](_0x949e('0x12'),_0x16c669,_0x949e('0xc'));_0x34ee57(_0x56e31d[_0x949e('0x14')]['message']);}})[_0x949e('0x15')](function(_0x441b80){logger['error'](_0x949e('0x12'),_0x16c669,_0x441b80);_0x40d442(_0x441b80);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index b093d69..a12f506 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 _0x691d=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','/:id','isAuthenticated','show','post','create','update'];(function(_0x55ff3e,_0x41077f){var _0x2709eb=function(_0x45563a){while(--_0x45563a){_0x55ff3e['push'](_0x55ff3e['shift']());}};_0x2709eb(++_0x41077f);}(_0x691d,0x1cb));var _0xd691=function(_0x2d9b4d,_0x3101b9){_0x2d9b4d=_0x2d9b4d-0x0;var _0x4a3e64=_0x691d[_0x2d9b4d];return _0x4a3e64;};'use strict';var multer=require(_0xd691('0x0'));var util=require(_0xd691('0x1'));var path=require('path');var timeout=require(_0xd691('0x2'));var express=require(_0xd691('0x3'));var router=express[_0xd691('0x4')]();var fs_extra=require(_0xd691('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd691('0x6'));var config=require(_0xd691('0x7'));var controller=require(_0xd691('0x8'));router[_0xd691('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd691('0xa'),auth[_0xd691('0xb')](),controller[_0xd691('0xc')]);router[_0xd691('0xd')]('/',auth['isAuthenticated'](),controller[_0xd691('0xe')]);router['put']('/:id',auth[_0xd691('0xb')](),controller[_0xd691('0xf')]);router[_0xd691('0x10')](_0xd691('0xa'),auth[_0xd691('0xb')](),controller[_0xd691('0x11')]);module[_0xd691('0x12')]=router; \ No newline at end of file +var _0x8455=['./voiceContext.controller','get','/:id','isAuthenticated','show','create','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x12fc6d,_0x1b2dc1){var _0x2929f0=function(_0x406001){while(--_0x406001){_0x12fc6d['push'](_0x12fc6d['shift']());}};_0x2929f0(++_0x1b2dc1);}(_0x8455,0x1b9));var _0x5845=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8455[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x5845('0x0'));var path=require(_0x5845('0x1'));var timeout=require(_0x5845('0x2'));var express=require(_0x5845('0x3'));var router=express['Router']();var fs_extra=require(_0x5845('0x4'));var auth=require(_0x5845('0x5'));var interaction=require(_0x5845('0x6'));var config=require('../../config/environment');var controller=require(_0x5845('0x7'));router[_0x5845('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5845('0x8')](_0x5845('0x9'),auth[_0x5845('0xa')](),controller[_0x5845('0xb')]);router['post']('/',auth[_0x5845('0xa')](),controller[_0x5845('0xc')]);router['put']('/:id',auth[_0x5845('0xa')](),controller['update']);router[_0x5845('0xd')](_0x5845('0x9'),auth[_0x5845('0xa')](),controller[_0x5845('0xe')]);module[_0x5845('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 1ecc761..f519275 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 _0xa3e5=['BOOLEAN','sequelize','STRING'];(function(_0x449013,_0x3dbd7d){var _0x4c9386=function(_0x73b0c9){while(--_0x73b0c9){_0x449013['push'](_0x449013['shift']());}};_0x4c9386(++_0x3dbd7d);}(_0xa3e5,0x17e));var _0x5a3e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa3e5[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0x5a3e('0x0'));module['exports']={'name':{'type':Sequelize[_0x5a3e('0x1')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x5a3e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x37b2=['BOOLEAN','sequelize','exports'];(function(_0x2feef9,_0x3155cf){var _0x190b38=function(_0x4bff3c){while(--_0x4bff3c){_0x2feef9['push'](_0x2feef9['shift']());}};_0x190b38(++_0x3155cf);}(_0x37b2,0x199));var _0x237b=function(_0x1d69ba,_0x4090c9){_0x1d69ba=_0x1d69ba-0x0;var _0x8bab8c=_0x37b2[_0x1d69ba];return _0x8bab8c;};'use strict';var Sequelize=require(_0x237b('0x0'));module[_0x237b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x237b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index f289056..ce303f6 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 _0xb916=['nolimit','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','readFileSync','root','server/files/templates/context.ejs','utf8','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Contexts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','join','render','writeFileSync','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','status','offset','undefined','limit','count','set','Content-Range','save','destroy','get','end','sendStatus','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x49da2f,_0x1c5db3){var _0x265f85=function(_0x1cd7ff){while(--_0x1cd7ff){_0x49da2f['push'](_0x49da2f['shift']());}};_0x265f85(++_0x1c5db3);}(_0xb916,0xed));var _0x6b91=function(_0x5d4876,_0x11e6b0){_0x5d4876=_0x5d4876-0x0;var _0x6927ac=_0xb916[_0x5d4876];return _0x6927ac;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6b91('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b91('0x1'));var moment=require(_0x6b91('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6b91('0x3'));var util=require(_0x6b91('0x4'));var path=require(_0x6b91('0x5'));var sox=require(_0x6b91('0x6'));var csv=require(_0x6b91('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b91('0x8'));var _=require(_0x6b91('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b91('0xa'));var deskjs=require(_0x6b91('0xb'));var toCsv=require(_0x6b91('0x7'));var querystring=require(_0x6b91('0xc'));var Papa=require('papaparse');var Redis=require(_0x6b91('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6b91('0xe'));var hardwareService=require(_0x6b91('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x6b91('0x10'));var config=require(_0x6b91('0x11'));var licenseUtil=require(_0x6b91('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6b91('0x13'));var client=jayson[_0x6b91('0x14')][_0x6b91('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x4cd91d,_0xcb5088,_0x3a5c24,_0x29794b){return new BPromise(function(_0x4ee737,_0x14b615){var _0xee3af3=_0x29794b||client;return _0xee3af3[_0x6b91('0x16')](_0x4cd91d,_0x3a5c24)[_0x6b91('0x17')](function(_0x4c3478){logger[_0x6b91('0x18')]('VoiceContext,\x20%s,\x20%s',_0xcb5088,'request\x20sent');logger[_0x6b91('0x19')](_0x6b91('0x1a'),_0xcb5088,_0x6b91('0x1b'),JSON[_0x6b91('0x1c')](_0x4c3478));if(_0x4c3478[_0x6b91('0x1d')]){if(_0x4c3478[_0x6b91('0x1d')][_0x6b91('0x1e')]===0x1f4){logger[_0x6b91('0x1d')](_0x6b91('0x1f'),_0xcb5088,_0x4c3478[_0x6b91('0x1d')][_0x6b91('0x20')]);return _0x14b615(_0x4c3478['error'][_0x6b91('0x20')]);}logger[_0x6b91('0x1d')](_0x6b91('0x1f'),_0xcb5088,_0x4c3478[_0x6b91('0x1d')][_0x6b91('0x20')]);return _0x4ee737(_0x4c3478['error'][_0x6b91('0x20')]);}else{logger[_0x6b91('0x18')]('VoiceContext,\x20%s,\x20%s',_0xcb5088,_0x6b91('0x1b'));_0x4ee737(_0x4c3478['result']['message']);}})['catch'](function(_0x4cc859){logger[_0x6b91('0x1d')](_0x6b91('0x1f'),_0xcb5088,_0x4cc859);_0x14b615(_0x4cc859);});});}function respondWithStatusCode(_0x2ae48f,_0x519dc1){_0x519dc1=_0x519dc1||0xcc;return function(_0x37140a){if(_0x37140a){return _0x2ae48f['sendStatus'](_0x519dc1);}return _0x2ae48f[_0x6b91('0x21')](_0x519dc1)['end']();};}function respondWithResult(_0xbc49db,_0x3f4907){_0x3f4907=_0x3f4907||0xc8;return function(_0x27e888){if(_0x27e888){return _0xbc49db['status'](_0x3f4907)['json'](_0x27e888);}};}function respondWithFilteredResult(_0x4a3209,_0x575847){return function(_0x5a213a){if(_0x5a213a){var _0x3acc94=typeof _0x575847[_0x6b91('0x22')]===_0x6b91('0x23')&&typeof _0x575847[_0x6b91('0x24')]===_0x6b91('0x23');var _0xd3bad9=_0x5a213a[_0x6b91('0x25')];var _0x58fd0f=_0x3acc94?0x0:_0x575847['offset'];var _0xb2764c=_0x3acc94?_0x5a213a[_0x6b91('0x25')]:_0x575847[_0x6b91('0x22')]+_0x575847['limit'];var _0x132817;if(_0xb2764c>=_0xd3bad9){_0xb2764c=_0xd3bad9;_0x132817=0xc8;}else{_0x132817=0xce;}_0x4a3209[_0x6b91('0x21')](_0x132817);return _0x4a3209[_0x6b91('0x26')](_0x6b91('0x27'),_0x58fd0f+'-'+_0xb2764c+'/'+_0xd3bad9)['json'](_0x5a213a);}return null;};}function patchUpdates(_0x525af7){return function(_0xa66c61){try{jsonpatch['apply'](_0xa66c61,_0x525af7,!![]);}catch(_0x367539){return BPromise['reject'](_0x367539);}return _0xa66c61[_0x6b91('0x28')]();};}function saveUpdates(_0xbd94c4,_0x1e579b){return function(_0x23e2a3){if(_0x23e2a3){return _0x23e2a3['update'](_0xbd94c4)['then'](function(_0x448800){return _0x448800;});}return null;};}function removeEntity(_0x20c176,_0x14c094){return function(_0xf0e227){if(_0xf0e227){return _0xf0e227[_0x6b91('0x29')]()[_0x6b91('0x17')](function(){var _0x266f47=_0xf0e227[_0x6b91('0x2a')]({'plain':!![]});var _0x154320='Contexts';return db['UserProfileResource']['destroy']({'where':{'type':_0x154320,'resourceId':_0x266f47['id']}})[_0x6b91('0x17')](function(){return _0xf0e227;});})[_0x6b91('0x17')](function(){_0x20c176[_0x6b91('0x21')](0xcc)[_0x6b91('0x2b')]();});}};}function handleEntityNotFound(_0x3bb0fa,_0x376698){return function(_0x44928b){if(!_0x44928b){_0x3bb0fa[_0x6b91('0x2c')](0x194);}return _0x44928b;};}function handleError(_0x226483,_0xec7de9){_0xec7de9=_0xec7de9||0x1f4;return function(_0xd37057){logger[_0x6b91('0x1d')](_0xd37057[_0x6b91('0x2d')]);if(_0xd37057[_0x6b91('0x2e')]){delete _0xd37057['name'];}_0x226483[_0x6b91('0x21')](_0xec7de9)[_0x6b91('0x2f')](_0xd37057);};}exports[_0x6b91('0x30')]=function(_0x4dbd63,_0x7f1df6){var _0x515253={},_0x5bb412={},_0x5776d5={'count':0x0,'rows':[]};var _0x5ee98f=_[_0x6b91('0x31')](db[_0x6b91('0x32')][_0x6b91('0x33')],function(_0x62bd57){return{'name':_0x62bd57[_0x6b91('0x34')],'type':_0x62bd57[_0x6b91('0x35')][_0x6b91('0x36')]};});_0x5bb412[_0x6b91('0x37')]=_['map'](_0x5ee98f,_0x6b91('0x2e'));_0x5bb412[_0x6b91('0x38')]=_[_0x6b91('0x39')](_0x4dbd63['query']);_0x5bb412[_0x6b91('0x3a')]=_[_0x6b91('0x3b')](_0x5bb412[_0x6b91('0x37')],_0x5bb412[_0x6b91('0x38')]);_0x515253[_0x6b91('0x3c')]=_[_0x6b91('0x3b')](_0x5bb412[_0x6b91('0x37')],qs[_0x6b91('0x3d')](_0x4dbd63['query'][_0x6b91('0x3d')]));_0x515253[_0x6b91('0x3c')]=_0x515253[_0x6b91('0x3c')][_0x6b91('0x3e')]?_0x515253['attributes']:_0x5bb412[_0x6b91('0x37')];if(!_0x4dbd63['query']['hasOwnProperty'](_0x6b91('0x3f'))){_0x515253[_0x6b91('0x24')]=qs[_0x6b91('0x24')](_0x4dbd63[_0x6b91('0x38')][_0x6b91('0x24')]);_0x515253[_0x6b91('0x22')]=qs[_0x6b91('0x22')](_0x4dbd63['query'][_0x6b91('0x22')]);}_0x515253[_0x6b91('0x40')]=qs['sort'](_0x4dbd63[_0x6b91('0x38')][_0x6b91('0x41')]);_0x515253[_0x6b91('0x42')]=qs[_0x6b91('0x3a')](_['pick'](_0x4dbd63[_0x6b91('0x38')],_0x5bb412[_0x6b91('0x3a')]),_0x5ee98f);if(_0x4dbd63[_0x6b91('0x38')][_0x6b91('0x43')]){_0x515253[_0x6b91('0x42')]=_[_0x6b91('0x44')](_0x515253[_0x6b91('0x42')],{'$or':_[_0x6b91('0x31')](_0x5ee98f,function(_0x3f8301){if(_0x3f8301['type']!=='VIRTUAL'){var _0x32ef04={};_0x32ef04[_0x3f8301['name']]={'$like':'%'+_0x4dbd63['query'][_0x6b91('0x43')]+'%'};return _0x32ef04;}})});}_0x515253=_[_0x6b91('0x44')]({},_0x515253,_0x4dbd63[_0x6b91('0x45')]);var _0x328dc1={'where':_0x515253[_0x6b91('0x42')]};return db['VoiceContext'][_0x6b91('0x25')](_0x328dc1)[_0x6b91('0x17')](function(_0x5dcb6f){_0x5776d5[_0x6b91('0x25')]=_0x5dcb6f;if(_0x4dbd63['query']['includeAll']){_0x515253[_0x6b91('0x46')]=[{'all':!![]}];}return db[_0x6b91('0x32')][_0x6b91('0x47')](_0x515253);})[_0x6b91('0x17')](function(_0x533cc6){_0x5776d5[_0x6b91('0x48')]=_0x533cc6;return _0x5776d5;})['then'](respondWithFilteredResult(_0x7f1df6,_0x515253))[_0x6b91('0x49')](handleError(_0x7f1df6,null));};exports[_0x6b91('0x4a')]=function(_0x173927,_0x2047c8){var _0x22f2e2={'raw':![],'where':{'id':_0x173927[_0x6b91('0x4b')]['id']}},_0x558000={};_0x558000['model']=_[_0x6b91('0x39')](db[_0x6b91('0x32')]['rawAttributes']);_0x558000[_0x6b91('0x38')]=_[_0x6b91('0x39')](_0x173927[_0x6b91('0x38')]);_0x558000[_0x6b91('0x3a')]=_[_0x6b91('0x3b')](_0x558000[_0x6b91('0x37')],_0x558000[_0x6b91('0x38')]);_0x22f2e2[_0x6b91('0x3c')]=_[_0x6b91('0x3b')](_0x558000[_0x6b91('0x37')],qs[_0x6b91('0x3d')](_0x173927['query'][_0x6b91('0x3d')]));_0x22f2e2[_0x6b91('0x3c')]=_0x22f2e2[_0x6b91('0x3c')]['length']?_0x22f2e2[_0x6b91('0x3c')]:_0x558000[_0x6b91('0x37')];if(_0x173927[_0x6b91('0x38')][_0x6b91('0x4c')]){_0x22f2e2[_0x6b91('0x46')]=[{'all':!![]}];}_0x22f2e2=_[_0x6b91('0x44')]({},_0x22f2e2,_0x173927['options']);return db['VoiceContext'][_0x6b91('0x4d')](_0x22f2e2)[_0x6b91('0x17')](handleEntityNotFound(_0x2047c8,null))[_0x6b91('0x17')](respondWithResult(_0x2047c8,null))[_0x6b91('0x49')](handleError(_0x2047c8,null));};exports['create']=function(_0x4559f5,_0x150771,_0x278f18){var _0x344211;return db['VoiceContext'][_0x6b91('0x4e')](_0x4559f5[_0x6b91('0x4f')],{'raw':!![]})[_0x6b91('0x17')](function(_0x40e3fb){_0x344211=_0x40e3fb;return db[_0x6b91('0x32')][_0x6b91('0x47')]({'raw':!![]});})[_0x6b91('0x17')](function(_0x4134f0){var _0x404717=fs[_0x6b91('0x50')](path['join'](config[_0x6b91('0x51')],_0x6b91('0x52')),_0x6b91('0x53'));var _0x573b1a=ejs['render'](_0x404717,{'contexts':_0x4134f0||[]});fs['writeFileSync'](_0x6b91('0x54'),_0x573b1a);})[_0x6b91('0x17')](function(){return respondWithRpcPromise(_0x6b91('0x55'),'create',{'module':_0x6b91('0x56')});})[_0x6b91('0x17')](function(){var _0x3fb61a=_0x4559f5['user'][_0x6b91('0x2a')]({'plain':!![]});if(!_0x3fb61a)throw new Error(_0x6b91('0x57'));if(_0x3fb61a[_0x6b91('0x58')]===_0x6b91('0x59')){var _0x3a7827=_0x344211[_0x6b91('0x2a')]({'plain':!![]});return db[_0x6b91('0x5a')][_0x6b91('0x4d')]({'where':{'name':_0x6b91('0x5b'),'userProfileId':_0x3fb61a[_0x6b91('0x5c')]},'raw':!![]})[_0x6b91('0x17')](function(_0x240ebc){if(_0x240ebc&&_0x240ebc[_0x6b91('0x5d')]===0x0){return db[_0x6b91('0x5e')][_0x6b91('0x4e')]({'name':_0x3a7827[_0x6b91('0x2e')],'resourceId':_0x3a7827['id'],'type':_0x240ebc[_0x6b91('0x2e')],'sectionId':_0x240ebc['id']},{})[_0x6b91('0x17')](function(){return _0x344211;});}else{return _0x344211;}})[_0x6b91('0x49')](function(_0x103854){logger[_0x6b91('0x1d')](_0x6b91('0x5f'),_0x103854);throw _0x103854;});}return _0x344211;})[_0x6b91('0x17')](respondWithResult(_0x150771,0xc9))[_0x6b91('0x49')](handleError(_0x150771,null));};exports[_0x6b91('0x60')]=function(_0x4d823f,_0x4fb7e3,_0x155b77){var _0x300677;return db[_0x6b91('0x32')][_0x6b91('0x4d')]({'where':{'id':_0x4d823f[_0x6b91('0x4b')]['id']}})[_0x6b91('0x17')](handleEntityNotFound(_0x4fb7e3,null))[_0x6b91('0x17')](saveUpdates(_0x4d823f[_0x6b91('0x4f')],null))['then'](function(_0x324b10){if(_0x324b10){_0x300677=_0x324b10;return db[_0x6b91('0x32')]['findAll']({'raw':!![]});}})['then'](function(_0x1288d1){var _0x1a4339=fs[_0x6b91('0x50')](path[_0x6b91('0x61')](config[_0x6b91('0x51')],'server/files/templates/context.ejs'),_0x6b91('0x53'));var _0x981f45=ejs['render'](_0x1a4339,{'contexts':_0x1288d1||[]});fs['writeFileSync'](_0x6b91('0x54'),_0x981f45);})[_0x6b91('0x17')](function(){return respondWithRpcPromise('Reload',_0x6b91('0x60'),{'module':'chan_sip.so'});})[_0x6b91('0x17')](function(){return _0x300677;})[_0x6b91('0x17')](respondWithResult(_0x4fb7e3,null))['catch'](handleError(_0x4fb7e3,null));};exports['destroy']=function(_0x3a75b9,_0x51adca,_0x1d5b55){var _0x5b5355;return db[_0x6b91('0x32')][_0x6b91('0x4d')]({'where':{'id':_0x3a75b9[_0x6b91('0x4b')]['id']}})['then'](handleEntityNotFound(_0x51adca,null))[_0x6b91('0x17')](removeEntity(_0x51adca,null))[_0x6b91('0x17')](function(){return db[_0x6b91('0x32')]['findAll']({'raw':!![]});})[_0x6b91('0x17')](function(_0x2815aa){var _0x49466b=fs['readFileSync'](path[_0x6b91('0x61')](config[_0x6b91('0x51')],'server/files/templates/context.ejs'),'utf8');var _0x5717df=ejs[_0x6b91('0x62')](_0x49466b,{'contexts':_0x2815aa});fs[_0x6b91('0x63')](_0x6b91('0x54'),_0x5717df);return respondWithRpcPromise(_0x6b91('0x55'),_0x6b91('0x29'),{'module':_0x6b91('0x56')});})[_0x6b91('0x49')](handleError(_0x51adca,null));}; \ No newline at end of file +var _0x634b=['body','join','root','render','/etc/asterisk/extensions_xcally_contexts.conf','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','server/files/templates/context.ejs','utf8','writeFileSync','Reload','chan_sip.so','eml-format','zip-dir','fast-json-patch','bluebird','path','sox','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','destroy','Contexts','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','filter','merge','options','VoiceContext','includeAll','include','findAll','rows','show','params','create'];(function(_0x14788d,_0x3dba49){var _0x57abc9=function(_0x53147a){while(--_0x53147a){_0x14788d['push'](_0x14788d['shift']());}};_0x57abc9(++_0x3dba49);}(_0x634b,0x72));var _0xb634=function(_0x455aae,_0x1afcb2){_0x455aae=_0x455aae-0x0;var _0x56bc94=_0x634b[_0x455aae];return _0x56bc94;};'use strict';var emlformat=require(_0xb634('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb634('0x1'));var jsonpatch=require(_0xb634('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb634('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb634('0x4'));var sox=require(_0xb634('0x5'));var csv=require('to-csv');var ejs=require(_0xb634('0x6'));var fs=require('fs');var fs_extra=require(_0xb634('0x7'));var _=require(_0xb634('0x8'));var squel=require(_0xb634('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb634('0xa'));var Redis=require(_0xb634('0xb'));var authService=require(_0xb634('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xb634('0xd'));var hardwareService=require(_0xb634('0xe'));var logger=require('../../config/logger')(_0xb634('0xf'));var utils=require(_0xb634('0x10'));var config=require(_0xb634('0x11'));var licenseUtil=require(_0xb634('0x12'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xb634('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x36ac0e,_0x23ed89,_0x33b86b,_0x4985e5){return new BPromise(function(_0x2290b5,_0x53462f){var _0x204aeb=_0x4985e5||client;return _0x204aeb[_0xb634('0x14')](_0x36ac0e,_0x33b86b)[_0xb634('0x15')](function(_0x224737){logger[_0xb634('0x16')](_0xb634('0x17'),_0x23ed89,_0xb634('0x18'));logger['debug'](_0xb634('0x19'),_0x23ed89,_0xb634('0x18'),JSON[_0xb634('0x1a')](_0x224737));if(_0x224737[_0xb634('0x1b')]){if(_0x224737[_0xb634('0x1b')][_0xb634('0x1c')]===0x1f4){logger['error'](_0xb634('0x17'),_0x23ed89,_0x224737[_0xb634('0x1b')][_0xb634('0x1d')]);return _0x53462f(_0x224737[_0xb634('0x1b')]['message']);}logger['error'](_0xb634('0x17'),_0x23ed89,_0x224737[_0xb634('0x1b')][_0xb634('0x1d')]);return _0x2290b5(_0x224737[_0xb634('0x1b')]['message']);}else{logger[_0xb634('0x16')](_0xb634('0x17'),_0x23ed89,_0xb634('0x18'));_0x2290b5(_0x224737['result'][_0xb634('0x1d')]);}})[_0xb634('0x1e')](function(_0x2d1893){logger[_0xb634('0x1b')](_0xb634('0x17'),_0x23ed89,_0x2d1893);_0x53462f(_0x2d1893);});});}function respondWithStatusCode(_0x346659,_0xf2ee4e){_0xf2ee4e=_0xf2ee4e||0xcc;return function(_0x2fae0b){if(_0x2fae0b){return _0x346659[_0xb634('0x1f')](_0xf2ee4e);}return _0x346659[_0xb634('0x20')](_0xf2ee4e)[_0xb634('0x21')]();};}function respondWithResult(_0x343798,_0x13af02){_0x13af02=_0x13af02||0xc8;return function(_0xb22754){if(_0xb22754){return _0x343798[_0xb634('0x20')](_0x13af02)[_0xb634('0x22')](_0xb22754);}};}function respondWithFilteredResult(_0x2dce84,_0x4340bb){return function(_0x1228ff){if(_0x1228ff){var _0x2dfed9=typeof _0x4340bb[_0xb634('0x23')]===_0xb634('0x24')&&typeof _0x4340bb['limit']===_0xb634('0x24');var _0x213bbb=_0x1228ff[_0xb634('0x25')];var _0x25cd88=_0x2dfed9?0x0:_0x4340bb['offset'];var _0x456c00=_0x2dfed9?_0x1228ff[_0xb634('0x25')]:_0x4340bb[_0xb634('0x23')]+_0x4340bb['limit'];var _0x5ec3d8;if(_0x456c00>=_0x213bbb){_0x456c00=_0x213bbb;_0x5ec3d8=0xc8;}else{_0x5ec3d8=0xce;}_0x2dce84[_0xb634('0x20')](_0x5ec3d8);return _0x2dce84[_0xb634('0x26')](_0xb634('0x27'),_0x25cd88+'-'+_0x456c00+'/'+_0x213bbb)[_0xb634('0x22')](_0x1228ff);}return null;};}function patchUpdates(_0x3b68c9){return function(_0x2835b0){try{jsonpatch[_0xb634('0x28')](_0x2835b0,_0x3b68c9,!![]);}catch(_0x2b290b){return BPromise['reject'](_0x2b290b);}return _0x2835b0[_0xb634('0x29')]();};}function saveUpdates(_0xff8a57,_0x44d874){return function(_0x1eb1fa){if(_0x1eb1fa){return _0x1eb1fa[_0xb634('0x2a')](_0xff8a57)[_0xb634('0x15')](function(_0x55fdbd){return _0x55fdbd;});}return null;};}function removeEntity(_0x1f6916,_0x29381d){return function(_0x282b9b){if(_0x282b9b){return _0x282b9b[_0xb634('0x2b')]()[_0xb634('0x15')](function(){var _0x20cd23=_0x282b9b['get']({'plain':!![]});var _0x21a7db=_0xb634('0x2c');return db[_0xb634('0x2d')][_0xb634('0x2b')]({'where':{'type':_0x21a7db,'resourceId':_0x20cd23['id']}})['then'](function(){return _0x282b9b;});})[_0xb634('0x15')](function(){_0x1f6916[_0xb634('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc48cb8,_0x91471c){return function(_0x2f0b8a){if(!_0x2f0b8a){_0xc48cb8['sendStatus'](0x194);}return _0x2f0b8a;};}function handleError(_0x5d55e5,_0x27ded5){_0x27ded5=_0x27ded5||0x1f4;return function(_0x5e7233){logger[_0xb634('0x1b')](_0x5e7233[_0xb634('0x2e')]);if(_0x5e7233[_0xb634('0x2f')]){delete _0x5e7233[_0xb634('0x2f')];}_0x5d55e5[_0xb634('0x20')](_0x27ded5)[_0xb634('0x30')](_0x5e7233);};}exports[_0xb634('0x31')]=function(_0x1704dd,_0x440573){var _0x9e0ee3={},_0x689582={},_0x4f63ae={'count':0x0,'rows':[]};var _0x57cd82=_[_0xb634('0x32')](db['VoiceContext'][_0xb634('0x33')],function(_0x5e8714){return{'name':_0x5e8714[_0xb634('0x34')],'type':_0x5e8714[_0xb634('0x35')]['key']};});_0x689582[_0xb634('0x36')]=_[_0xb634('0x32')](_0x57cd82,'name');_0x689582[_0xb634('0x37')]=_[_0xb634('0x38')](_0x1704dd['query']);_0x689582[_0xb634('0x39')]=_[_0xb634('0x3a')](_0x689582[_0xb634('0x36')],_0x689582['query']);_0x9e0ee3[_0xb634('0x3b')]=_[_0xb634('0x3a')](_0x689582[_0xb634('0x36')],qs['fields'](_0x1704dd[_0xb634('0x37')][_0xb634('0x3c')]));_0x9e0ee3[_0xb634('0x3b')]=_0x9e0ee3[_0xb634('0x3b')][_0xb634('0x3d')]?_0x9e0ee3[_0xb634('0x3b')]:_0x689582[_0xb634('0x36')];if(!_0x1704dd[_0xb634('0x37')]['hasOwnProperty']('nolimit')){_0x9e0ee3['limit']=qs[_0xb634('0x3e')](_0x1704dd[_0xb634('0x37')][_0xb634('0x3e')]);_0x9e0ee3[_0xb634('0x23')]=qs['offset'](_0x1704dd[_0xb634('0x37')][_0xb634('0x23')]);}_0x9e0ee3[_0xb634('0x3f')]=qs[_0xb634('0x40')](_0x1704dd[_0xb634('0x37')][_0xb634('0x40')]);_0x9e0ee3[_0xb634('0x41')]=qs[_0xb634('0x39')](_[_0xb634('0x42')](_0x1704dd[_0xb634('0x37')],_0x689582[_0xb634('0x39')]),_0x57cd82);if(_0x1704dd[_0xb634('0x37')][_0xb634('0x43')]){_0x9e0ee3[_0xb634('0x41')]=_[_0xb634('0x44')](_0x9e0ee3['where'],{'$or':_[_0xb634('0x32')](_0x57cd82,function(_0x499ad8){if(_0x499ad8[_0xb634('0x35')]!=='VIRTUAL'){var _0x48a3d9={};_0x48a3d9[_0x499ad8[_0xb634('0x2f')]]={'$like':'%'+_0x1704dd[_0xb634('0x37')][_0xb634('0x43')]+'%'};return _0x48a3d9;}})});}_0x9e0ee3=_['merge']({},_0x9e0ee3,_0x1704dd[_0xb634('0x45')]);var _0x35188a={'where':_0x9e0ee3['where']};return db[_0xb634('0x46')]['count'](_0x35188a)[_0xb634('0x15')](function(_0x5c6568){_0x4f63ae[_0xb634('0x25')]=_0x5c6568;if(_0x1704dd[_0xb634('0x37')][_0xb634('0x47')]){_0x9e0ee3[_0xb634('0x48')]=[{'all':!![]}];}return db[_0xb634('0x46')][_0xb634('0x49')](_0x9e0ee3);})[_0xb634('0x15')](function(_0x43a83e){_0x4f63ae[_0xb634('0x4a')]=_0x43a83e;return _0x4f63ae;})['then'](respondWithFilteredResult(_0x440573,_0x9e0ee3))['catch'](handleError(_0x440573,null));};exports[_0xb634('0x4b')]=function(_0x392ff6,_0x4dc398){var _0x208feb={'raw':![],'where':{'id':_0x392ff6[_0xb634('0x4c')]['id']}},_0x36ccb7={};_0x36ccb7['model']=_[_0xb634('0x38')](db[_0xb634('0x46')][_0xb634('0x33')]);_0x36ccb7[_0xb634('0x37')]=_[_0xb634('0x38')](_0x392ff6[_0xb634('0x37')]);_0x36ccb7[_0xb634('0x39')]=_[_0xb634('0x3a')](_0x36ccb7[_0xb634('0x36')],_0x36ccb7[_0xb634('0x37')]);_0x208feb['attributes']=_['intersection'](_0x36ccb7[_0xb634('0x36')],qs[_0xb634('0x3c')](_0x392ff6[_0xb634('0x37')][_0xb634('0x3c')]));_0x208feb[_0xb634('0x3b')]=_0x208feb[_0xb634('0x3b')][_0xb634('0x3d')]?_0x208feb['attributes']:_0x36ccb7[_0xb634('0x36')];if(_0x392ff6['query'][_0xb634('0x47')]){_0x208feb['include']=[{'all':!![]}];}_0x208feb=_[_0xb634('0x44')]({},_0x208feb,_0x392ff6['options']);return db['VoiceContext']['find'](_0x208feb)[_0xb634('0x15')](handleEntityNotFound(_0x4dc398,null))['then'](respondWithResult(_0x4dc398,null))[_0xb634('0x1e')](handleError(_0x4dc398,null));};exports['create']=function(_0x3e64f8,_0x7e3cb0,_0x332697){var _0x54f32;return db[_0xb634('0x46')][_0xb634('0x4d')](_0x3e64f8[_0xb634('0x4e')],{'raw':!![]})[_0xb634('0x15')](function(_0x498892){_0x54f32=_0x498892;return db[_0xb634('0x46')][_0xb634('0x49')]({'raw':!![]});})[_0xb634('0x15')](function(_0x302353){var _0x26ac6b=fs['readFileSync'](path[_0xb634('0x4f')](config[_0xb634('0x50')],'server/files/templates/context.ejs'),'utf8');var _0x401b99=ejs[_0xb634('0x51')](_0x26ac6b,{'contexts':_0x302353||[]});fs['writeFileSync'](_0xb634('0x52'),_0x401b99);})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0xb634('0x15')](function(){var _0x2f8243=_0x3e64f8[_0xb634('0x53')][_0xb634('0x54')]({'plain':!![]});if(!_0x2f8243)throw new Error(_0xb634('0x55'));if(_0x2f8243['role']===_0xb634('0x53')){var _0x3d7b04=_0x54f32[_0xb634('0x54')]({'plain':!![]});return db[_0xb634('0x56')][_0xb634('0x57')]({'where':{'name':'Contexts','userProfileId':_0x2f8243['userProfileId']},'raw':!![]})[_0xb634('0x15')](function(_0x31e765){if(_0x31e765&&_0x31e765[_0xb634('0x58')]===0x0){return db[_0xb634('0x2d')][_0xb634('0x4d')]({'name':_0x3d7b04['name'],'resourceId':_0x3d7b04['id'],'type':_0x31e765[_0xb634('0x2f')],'sectionId':_0x31e765['id']},{})['then'](function(){return _0x54f32;});}else{return _0x54f32;}})[_0xb634('0x1e')](function(_0x181eba){logger[_0xb634('0x1b')](_0xb634('0x59'),_0x181eba);throw _0x181eba;});}return _0x54f32;})[_0xb634('0x15')](respondWithResult(_0x7e3cb0,0xc9))['catch'](handleError(_0x7e3cb0,null));};exports['update']=function(_0x3cf958,_0x1481d8,_0x3d24ef){var _0x5d80c9;return db['VoiceContext'][_0xb634('0x57')]({'where':{'id':_0x3cf958['params']['id']}})[_0xb634('0x15')](handleEntityNotFound(_0x1481d8,null))[_0xb634('0x15')](saveUpdates(_0x3cf958[_0xb634('0x4e')],null))[_0xb634('0x15')](function(_0x12c05a){if(_0x12c05a){_0x5d80c9=_0x12c05a;return db['VoiceContext'][_0xb634('0x49')]({'raw':!![]});}})[_0xb634('0x15')](function(_0x1543ba){var _0x3548b7=fs[_0xb634('0x5a')](path['join'](config[_0xb634('0x50')],_0xb634('0x5b')),_0xb634('0x5c'));var _0x21808d=ejs[_0xb634('0x51')](_0x3548b7,{'contexts':_0x1543ba||[]});fs[_0xb634('0x5d')](_0xb634('0x52'),_0x21808d);})[_0xb634('0x15')](function(){return respondWithRpcPromise(_0xb634('0x5e'),_0xb634('0x2a'),{'module':_0xb634('0x5f')});})[_0xb634('0x15')](function(){return _0x5d80c9;})['then'](respondWithResult(_0x1481d8,null))['catch'](handleError(_0x1481d8,null));};exports['destroy']=function(_0x292489,_0x26d9bd,_0x1d6574){var _0x210278;return db['VoiceContext']['find']({'where':{'id':_0x292489['params']['id']}})[_0xb634('0x15')](handleEntityNotFound(_0x26d9bd,null))['then'](removeEntity(_0x26d9bd,null))['then'](function(){return db[_0xb634('0x46')][_0xb634('0x49')]({'raw':!![]});})['then'](function(_0x337183){var _0x3ff7d2=fs['readFileSync'](path['join'](config['root'],_0xb634('0x5b')),_0xb634('0x5c'));var _0x37adca=ejs[_0xb634('0x51')](_0x3ff7d2,{'contexts':_0x337183});fs['writeFileSync'](_0xb634('0x52'),_0x37adca);return respondWithRpcPromise(_0xb634('0x5e'),_0xb634('0x2b'),{'module':'chan_sip.so'});})[_0xb634('0x1e')](handleError(_0x26d9bd,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index fa9b4eb..af2ab22 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 _0x50c2=['api','moment','bluebird','../../config/environment','exports','VoiceContext','voice_contexts','util','../../config/logger'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x50c2,0x127));var _0x250c=function(_0x14a735,_0x5322d1){_0x14a735=_0x14a735-0x0;var _0x4467cf=_0x50c2[_0x14a735];return _0x4467cf;};'use strict';var _=require('lodash');var util=require(_0x250c('0x0'));var logger=require(_0x250c('0x1'))(_0x250c('0x2'));var moment=require(_0x250c('0x3'));var BPromise=require(_0x250c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x250c('0x5'));var attributes=require('./voiceContext.attributes');module[_0x250c('0x6')]=function(_0x4193f5,_0x1d015){return _0x4193f5['define'](_0x250c('0x7'),attributes,{'tableName':_0x250c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5746=['exports','define','VoiceContext','voice_contexts','lodash','util','api','bluebird','rimraf','./voiceContext.attributes'];(function(_0x466c18,_0x18ef34){var _0x2a9f08=function(_0x1cbf6b){while(--_0x1cbf6b){_0x466c18['push'](_0x466c18['shift']());}};_0x2a9f08(++_0x18ef34);}(_0x5746,0x176));var _0x6574=function(_0x4fd313,_0x2ab65d){_0x4fd313=_0x4fd313-0x0;var _0x28a582=_0x5746[_0x4fd313];return _0x28a582;};'use strict';var _=require(_0x6574('0x0'));var util=require(_0x6574('0x1'));var logger=require('../../config/logger')(_0x6574('0x2'));var moment=require('moment');var BPromise=require(_0x6574('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6574('0x4'));var config=require('../../config/environment');var attributes=require(_0x6574('0x5'));module[_0x6574('0x6')]=function(_0x46c5ed,_0x8123cf){return _0x46c5ed[_0x6574('0x7')](_0x6574('0x8'),attributes,{'tableName':_0x6574('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index b1d0de3..ac2c016 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 _0x2a84=['request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','VoiceContext,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x85bf37,_0x31ec7c){var _0x32f46c=function(_0x2d5da0){while(--_0x2d5da0){_0x85bf37['push'](_0x85bf37['shift']());}};_0x32f46c(++_0x31ec7c);}(_0x2a84,0x170));var _0x42a8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2a84[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x42a8('0x0'));var util=require(_0x42a8('0x1'));var moment=require('moment');var BPromise=require(_0x42a8('0x2'));var rs=require(_0x42a8('0x3'));var fs=require('fs');var Redis=require(_0x42a8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x42a8('0x5'));var logger=require('../../config/logger')(_0x42a8('0x6'));var config=require(_0x42a8('0x7'));var jayson=require(_0x42a8('0x8'));var client=jayson['client'][_0x42a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b17b7,_0x434dc9,_0x10c2fe){return new BPromise(function(_0x4ff8e0,_0x2aa872){return client[_0x42a8('0xa')](_0x4b17b7,_0x10c2fe)['then'](function(_0x40062e){logger[_0x42a8('0xb')]('VoiceContext,\x20%s,\x20%s',_0x434dc9,_0x42a8('0xc'));logger[_0x42a8('0xd')](_0x42a8('0xe'),_0x434dc9,'request\x20sent',JSON['stringify'](_0x40062e));if(_0x40062e[_0x42a8('0xf')]){if(_0x40062e['error'][_0x42a8('0x10')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x434dc9,_0x40062e[_0x42a8('0xf')][_0x42a8('0x11')]);return _0x2aa872(_0x40062e[_0x42a8('0xf')][_0x42a8('0x11')]);}logger[_0x42a8('0xf')](_0x42a8('0x12'),_0x434dc9,_0x40062e[_0x42a8('0xf')][_0x42a8('0x11')]);return _0x4ff8e0(_0x40062e['error']['message']);}else{logger[_0x42a8('0xb')](_0x42a8('0x12'),_0x434dc9,_0x42a8('0xc'));_0x4ff8e0(_0x40062e['result'][_0x42a8('0x11')]);}})[_0x42a8('0x13')](function(_0x3c0d41){logger[_0x42a8('0xf')](_0x42a8('0x12'),_0x434dc9,_0x3c0d41);_0x2aa872(_0x3c0d41);});});} \ No newline at end of file +var _0xb7e7=['VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x5c26e0,_0x4bd79b){var _0x411e98=function(_0x1934c1){while(--_0x1934c1){_0x5c26e0['push'](_0x5c26e0['shift']());}};_0x411e98(++_0x4bd79b);}(_0xb7e7,0x121));var _0x7b7e=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xb7e7[_0xa6cc5c];return _0x44803d;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('VoiceContext,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 98977a7..4fb1b86 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 _0x0694=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','describe','show','post','update'];(function(_0x1e4016,_0x16a60f){var _0x21b7f0=function(_0x5d71d2){while(--_0x5d71d2){_0x1e4016['push'](_0x1e4016['shift']());}};_0x21b7f0(++_0x16a60f);}(_0x0694,0x180));var _0x4069=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x0694[_0x3c4f1f];return _0x19cb69;};'use strict';var multer=require(_0x4069('0x0'));var util=require(_0x4069('0x1'));var path=require(_0x4069('0x2'));var timeout=require(_0x4069('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4069('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4069('0x5'));var controller=require(_0x4069('0x6'));router[_0x4069('0x7')]('/',auth['isAuthenticated'](),controller[_0x4069('0x8')]);router[_0x4069('0x7')](_0x4069('0x9'),auth[_0x4069('0xa')](),controller[_0x4069('0xb')]);router[_0x4069('0x7')]('/:id',auth[_0x4069('0xa')](),controller[_0x4069('0xc')]);router[_0x4069('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x4069('0xa')](),controller[_0x4069('0xe')]);router[_0x4069('0xf')](_0x4069('0x10'),auth[_0x4069('0xa')](),controller[_0x4069('0x11')]);module[_0x4069('0x12')]=router; \ No newline at end of file +var _0xbd5b=['create','destroy','exports','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','/describe','describe','get','/:id','show'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xbd5b,0x124));var _0xbbd5=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0xbd5b[_0xf73c09];return _0xa8923c;};'use strict';var multer=require('multer');var util=require(_0xbbd5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbbd5('0x1'));var router=express['Router']();var fs_extra=require(_0xbbd5('0x2'));var auth=require(_0xbbd5('0x3'));var interaction=require(_0xbbd5('0x4'));var config=require(_0xbbd5('0x5'));var controller=require(_0xbbd5('0x6'));router['get']('/',auth[_0xbbd5('0x7')](),controller[_0xbbd5('0x8')]);router['get'](_0xbbd5('0x9'),auth[_0xbbd5('0x7')](),controller[_0xbbd5('0xa')]);router[_0xbbd5('0xb')](_0xbbd5('0xc'),auth[_0xbbd5('0x7')](),controller[_0xbbd5('0xd')]);router['post']('/',auth[_0xbbd5('0x7')](),controller[_0xbbd5('0xe')]);router['put'](_0xbbd5('0xc'),auth[_0xbbd5('0x7')](),controller['update']);router['delete'](_0xbbd5('0xc'),auth[_0xbbd5('0x7')](),controller[_0xbbd5('0xf')]);module[_0xbbd5('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 75c7461..2e49545 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 _0x24ca=['STRING','INTEGER','DATE','called,connect,complete','sequelize'];(function(_0x3603cc,_0x882407){var _0x4e6b60=function(_0x5c1384){while(--_0x5c1384){_0x3603cc['push'](_0x3603cc['shift']());}};_0x4e6b60(++_0x882407);}(_0x24ca,0x1bc));var _0xa24c=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0x24ca[_0x151721];return _0x2deaa7;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'privilege':{'type':Sequelize[_0xa24c('0x1')]},'channel':{'type':Sequelize[_0xa24c('0x1')]},'channelstate':{'type':Sequelize[_0xa24c('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'connectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'language':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize[_0xa24c('0x1')]},'exten':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x2')]},'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'linkedid':{'type':Sequelize[_0xa24c('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xa24c('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xa24c('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xa24c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xa24c('0x1')]},'destlanguage':{'type':Sequelize[_0xa24c('0x1')]},'destaccountcode':{'type':Sequelize[_0xa24c('0x1')]},'destcontext':{'type':Sequelize[_0xa24c('0x1')]},'destexten':{'type':Sequelize[_0xa24c('0x1')]},'destpriority':{'type':Sequelize[_0xa24c('0x2')]},'destuniqueid':{'type':Sequelize[_0xa24c('0x1')]},'destlinkedid':{'type':Sequelize[_0xa24c('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xa24c('0x1')]},'starttime':{'type':Sequelize[_0xa24c('0x3')]},'answertime':{'type':Sequelize[_0xa24c('0x3')]},'endtime':{'type':Sequelize[_0xa24c('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0xa24c('0x4')},'routeId':{'type':Sequelize[_0xa24c('0x2')]},'duration':{'type':Sequelize[_0xa24c('0x2')]},'holdtime':{'type':Sequelize[_0xa24c('0x2')]},'billableseconds':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file +var _0x4b84=['INTEGER','STRING','DATE','called,connect,complete','sequelize','exports'];(function(_0x44353d,_0x267761){var _0x93dd90=function(_0x218cc1){while(--_0x218cc1){_0x44353d['push'](_0x44353d['shift']());}};_0x93dd90(++_0x267761);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0x4b84[_0x2b9cf5];return _0xd0cf15;};'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 diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 85acb55..20a0d34 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 _0x7de8=['zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','error','name','send','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','describe','eml-format','rimraf'];(function(_0x1e0ca4,_0x407a22){var _0xaaf501=function(_0x3ea9a9){while(--_0x3ea9a9){_0x1e0ca4['push'](_0x1e0ca4['shift']());}};_0xaaf501(++_0x407a22);}(_0x7de8,0x122));var _0x87de=function(_0x49ee2e,_0x113d9d){_0x49ee2e=_0x49ee2e-0x0;var _0x5ac9fd=_0x7de8[_0x49ee2e];return _0x5ac9fd;};'use strict';var emlformat=require(_0x87de('0x0'));var rimraf=require(_0x87de('0x1'));var zipdir=require(_0x87de('0x2'));var jsonpatch=require(_0x87de('0x3'));var rp=require(_0x87de('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x87de('0x5'));var util=require(_0x87de('0x6'));var path=require(_0x87de('0x7'));var sox=require(_0x87de('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x87de('0x9'));var _=require(_0x87de('0xa'));var squel=require(_0x87de('0xb'));var crypto=require(_0x87de('0xc'));var jsforce=require(_0x87de('0xd'));var deskjs=require(_0x87de('0xe'));var toCsv=require(_0x87de('0xf'));var querystring=require(_0x87de('0x10'));var Papa=require('papaparse');var Redis=require(_0x87de('0x11'));var authService=require(_0x87de('0x12'));var qs=require(_0x87de('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x87de('0x14'))(_0x87de('0x15'));var utils=require('../../config/utils');var config=require(_0x87de('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd531ad,_0x32b181){_0x32b181=_0x32b181||0xcc;return function(_0x986835){if(_0x986835){return _0xd531ad[_0x87de('0x17')](_0x32b181);}return _0xd531ad[_0x87de('0x18')](_0x32b181)[_0x87de('0x19')]();};}function respondWithResult(_0x261223,_0x322729){_0x322729=_0x322729||0xc8;return function(_0x4a0dfa){if(_0x4a0dfa){return _0x261223[_0x87de('0x18')](_0x322729)[_0x87de('0x1a')](_0x4a0dfa);}};}function respondWithFilteredResult(_0x184139,_0x50040f){return function(_0x334730){if(_0x334730){var _0x4a9499=typeof _0x50040f[_0x87de('0x1b')]==='undefined'&&typeof _0x50040f[_0x87de('0x1c')]===_0x87de('0x1d');var _0x2a8cde=_0x334730[_0x87de('0x1e')];var _0x241ca3=_0x4a9499?0x0:_0x50040f['offset'];var _0x3edc95=_0x4a9499?_0x334730[_0x87de('0x1e')]:_0x50040f[_0x87de('0x1b')]+_0x50040f['limit'];var _0x939d5b;if(_0x3edc95>=_0x2a8cde){_0x3edc95=_0x2a8cde;_0x939d5b=0xc8;}else{_0x939d5b=0xce;}_0x184139[_0x87de('0x18')](_0x939d5b);return _0x184139['set'](_0x87de('0x1f'),_0x241ca3+'-'+_0x3edc95+'/'+_0x2a8cde)[_0x87de('0x1a')](_0x334730);}return null;};}function patchUpdates(_0x3805c2){return function(_0x3e5885){try{jsonpatch[_0x87de('0x20')](_0x3e5885,_0x3805c2,!![]);}catch(_0x4b54a5){return BPromise[_0x87de('0x21')](_0x4b54a5);}return _0x3e5885['save']();};}function saveUpdates(_0x21dfca,_0x5acd4f){return function(_0x2b6e2e){if(_0x2b6e2e){return _0x2b6e2e[_0x87de('0x22')](_0x21dfca)[_0x87de('0x23')](function(_0x26b352){return _0x26b352;});}return null;};}function removeEntity(_0x476e13,_0x2ebc8b){return function(_0x1dbec9){if(_0x1dbec9){return _0x1dbec9[_0x87de('0x24')]()[_0x87de('0x23')](function(){_0x476e13[_0x87de('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57575f,_0x2ad70f){return function(_0x2ac860){if(!_0x2ac860){_0x57575f[_0x87de('0x17')](0x194);}return _0x2ac860;};}function handleError(_0x143d49,_0x7eae07){_0x7eae07=_0x7eae07||0x1f4;return function(_0x19efea){logger[_0x87de('0x25')](_0x19efea['stack']);if(_0x19efea[_0x87de('0x26')]){delete _0x19efea[_0x87de('0x26')];}_0x143d49[_0x87de('0x18')](_0x7eae07)[_0x87de('0x27')](_0x19efea);};}exports['index']=function(_0x33fa8c,_0x1e52d0){var _0x527b87={},_0x40b4e5={},_0x47d620={'count':0x0,'rows':[]};var _0x9279b4=_[_0x87de('0x28')](db[_0x87de('0x29')][_0x87de('0x2a')],function(_0x1f97be){return{'name':_0x1f97be[_0x87de('0x2b')],'type':_0x1f97be[_0x87de('0x2c')]['key']};});_0x40b4e5[_0x87de('0x2d')]=_[_0x87de('0x28')](_0x9279b4,'name');_0x40b4e5[_0x87de('0x2e')]=_[_0x87de('0x2f')](_0x33fa8c[_0x87de('0x2e')]);_0x40b4e5[_0x87de('0x30')]=_[_0x87de('0x31')](_0x40b4e5['model'],_0x40b4e5[_0x87de('0x2e')]);_0x527b87['attributes']=_[_0x87de('0x31')](_0x40b4e5[_0x87de('0x2d')],qs[_0x87de('0x32')](_0x33fa8c[_0x87de('0x2e')]['fields']));_0x527b87[_0x87de('0x33')]=_0x527b87[_0x87de('0x33')]['length']?_0x527b87[_0x87de('0x33')]:_0x40b4e5['model'];if(!_0x33fa8c[_0x87de('0x2e')][_0x87de('0x34')](_0x87de('0x35'))){_0x527b87[_0x87de('0x1c')]=qs[_0x87de('0x1c')](_0x33fa8c[_0x87de('0x2e')][_0x87de('0x1c')]);_0x527b87[_0x87de('0x1b')]=qs['offset'](_0x33fa8c[_0x87de('0x2e')][_0x87de('0x1b')]);}_0x527b87[_0x87de('0x36')]=qs[_0x87de('0x37')](_0x33fa8c[_0x87de('0x2e')]['sort']);_0x527b87[_0x87de('0x38')]=qs[_0x87de('0x30')](_[_0x87de('0x39')](_0x33fa8c[_0x87de('0x2e')],_0x40b4e5[_0x87de('0x30')]),_0x9279b4);if(_0x33fa8c[_0x87de('0x2e')][_0x87de('0x3a')]){_0x527b87['where']=_['merge'](_0x527b87[_0x87de('0x38')],{'$or':_[_0x87de('0x28')](_0x9279b4,function(_0xeda6e2){if(_0xeda6e2[_0x87de('0x2c')]!==_0x87de('0x3b')){var _0x4533d4={};_0x4533d4[_0xeda6e2[_0x87de('0x26')]]={'$like':'%'+_0x33fa8c['query'][_0x87de('0x3a')]+'%'};return _0x4533d4;}})});}_0x527b87=_['merge']({},_0x527b87,_0x33fa8c[_0x87de('0x3c')]);var _0x17508b={'where':_0x527b87[_0x87de('0x38')]};return db[_0x87de('0x29')][_0x87de('0x1e')](_0x17508b)['then'](function(_0x130862){_0x47d620[_0x87de('0x1e')]=_0x130862;if(_0x33fa8c[_0x87de('0x2e')][_0x87de('0x3d')]){_0x527b87[_0x87de('0x3e')]=[{'all':!![]}];}return db[_0x87de('0x29')][_0x87de('0x3f')](_0x527b87);})[_0x87de('0x23')](function(_0x5adaa9){_0x47d620[_0x87de('0x40')]=_0x5adaa9;return _0x47d620;})[_0x87de('0x23')](respondWithFilteredResult(_0x1e52d0,_0x527b87))[_0x87de('0x41')](handleError(_0x1e52d0,null));};exports[_0x87de('0x42')]=function(_0x161b7f,_0x5e9f58){var _0x38c8be={'raw':!![],'where':{'id':_0x161b7f[_0x87de('0x43')]['id']}},_0x9bddd2={};_0x9bddd2['model']=_['keys'](db[_0x87de('0x29')][_0x87de('0x2a')]);_0x9bddd2['query']=_[_0x87de('0x2f')](_0x161b7f[_0x87de('0x2e')]);_0x9bddd2[_0x87de('0x30')]=_[_0x87de('0x31')](_0x9bddd2['model'],_0x9bddd2[_0x87de('0x2e')]);_0x38c8be['attributes']=_[_0x87de('0x31')](_0x9bddd2[_0x87de('0x2d')],qs['fields'](_0x161b7f[_0x87de('0x2e')][_0x87de('0x32')]));_0x38c8be[_0x87de('0x33')]=_0x38c8be[_0x87de('0x33')]['length']?_0x38c8be[_0x87de('0x33')]:_0x9bddd2['model'];if(_0x161b7f[_0x87de('0x2e')][_0x87de('0x3d')]){_0x38c8be[_0x87de('0x3e')]=[{'all':!![]}];}_0x38c8be=_[_0x87de('0x44')]({},_0x38c8be,_0x161b7f[_0x87de('0x3c')]);return db[_0x87de('0x29')]['find'](_0x38c8be)['then'](handleEntityNotFound(_0x5e9f58,null))[_0x87de('0x23')](respondWithResult(_0x5e9f58,null))[_0x87de('0x41')](handleError(_0x5e9f58,null));};exports[_0x87de('0x45')]=function(_0x147660,_0x3ac4d4){return db['VoiceDialReport'][_0x87de('0x45')](_0x147660[_0x87de('0x46')],{})[_0x87de('0x23')](respondWithResult(_0x3ac4d4,0xc9))['catch'](handleError(_0x3ac4d4,null));};exports[_0x87de('0x22')]=function(_0x2a14c1,_0x245e32){if(_0x2a14c1['body']['id']){delete _0x2a14c1['body']['id'];}return db[_0x87de('0x29')][_0x87de('0x47')]({'where':{'id':_0x2a14c1[_0x87de('0x43')]['id']}})['then'](handleEntityNotFound(_0x245e32,null))[_0x87de('0x23')](saveUpdates(_0x2a14c1[_0x87de('0x46')],null))[_0x87de('0x23')](respondWithResult(_0x245e32,null))[_0x87de('0x41')](handleError(_0x245e32,null));};exports[_0x87de('0x24')]=function(_0x49caad,_0x44890f){return db[_0x87de('0x29')]['find']({'where':{'id':_0x49caad['params']['id']}})[_0x87de('0x23')](handleEntityNotFound(_0x44890f,null))[_0x87de('0x23')](removeEntity(_0x44890f,null))[_0x87de('0x41')](handleError(_0x44890f,null));};exports['describe']=function(_0x451bf4,_0x1a7393){return db[_0x87de('0x29')][_0x87de('0x48')]()[_0x87de('0x23')](respondWithResult(_0x1a7393,null))['catch'](handleError(_0x1a7393,null));}; \ No newline at end of file +var _0x44ee=['map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','name','send'];(function(_0x344060,_0x46bf19){var _0x299c27=function(_0x6beb11){while(--_0x6beb11){_0x344060['push'](_0x344060['shift']());}};_0x299c27(++_0x46bf19);}(_0x44ee,0x156));var _0xe44e=function(_0x151c7c,_0x46edce){_0x151c7c=_0x151c7c-0x0;var _0x1734fa=_0x44ee[_0x151c7c];return _0x1734fa;};'use strict';var emlformat=require(_0xe44e('0x0'));var rimraf=require(_0xe44e('0x1'));var zipdir=require(_0xe44e('0x2'));var jsonpatch=require(_0xe44e('0x3'));var rp=require('request-promise');var moment=require(_0xe44e('0x4'));var BPromise=require(_0xe44e('0x5'));var Mustache=require(_0xe44e('0x6'));var util=require(_0xe44e('0x7'));var path=require(_0xe44e('0x8'));var sox=require(_0xe44e('0x9'));var csv=require(_0xe44e('0xa'));var ejs=require(_0xe44e('0xb'));var fs=require('fs');var fs_extra=require(_0xe44e('0xc'));var _=require(_0xe44e('0xd'));var squel=require('squel');var crypto=require(_0xe44e('0xe'));var jsforce=require(_0xe44e('0xf'));var deskjs=require(_0xe44e('0x10'));var toCsv=require(_0xe44e('0xa'));var querystring=require(_0xe44e('0x11'));var Papa=require(_0xe44e('0x12'));var Redis=require(_0xe44e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xe44e('0x14'));var as=require(_0xe44e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe44e('0x16'))(_0xe44e('0x17'));var utils=require(_0xe44e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe44e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x483e9b,_0x377698){_0x377698=_0x377698||0xcc;return function(_0x21dc71){if(_0x21dc71){return _0x483e9b[_0xe44e('0x1a')](_0x377698);}return _0x483e9b[_0xe44e('0x1b')](_0x377698)['end']();};}function respondWithResult(_0xddacfd,_0x38eb61){_0x38eb61=_0x38eb61||0xc8;return function(_0x51b0e8){if(_0x51b0e8){return _0xddacfd['status'](_0x38eb61)[_0xe44e('0x1c')](_0x51b0e8);}};}function respondWithFilteredResult(_0x4633b0,_0x3a2bf3){return function(_0x1863d3){if(_0x1863d3){var _0x1b0093=typeof _0x3a2bf3['offset']===_0xe44e('0x1d')&&typeof _0x3a2bf3[_0xe44e('0x1e')]===_0xe44e('0x1d');var _0x2ff410=_0x1863d3[_0xe44e('0x1f')];var _0x3accef=_0x1b0093?0x0:_0x3a2bf3['offset'];var _0x4e983f=_0x1b0093?_0x1863d3['count']:_0x3a2bf3['offset']+_0x3a2bf3[_0xe44e('0x1e')];var _0x175571;if(_0x4e983f>=_0x2ff410){_0x4e983f=_0x2ff410;_0x175571=0xc8;}else{_0x175571=0xce;}_0x4633b0[_0xe44e('0x1b')](_0x175571);return _0x4633b0[_0xe44e('0x20')](_0xe44e('0x21'),_0x3accef+'-'+_0x4e983f+'/'+_0x2ff410)['json'](_0x1863d3);}return null;};}function patchUpdates(_0x4bdf20){return function(_0x34bfdd){try{jsonpatch['apply'](_0x34bfdd,_0x4bdf20,!![]);}catch(_0x595e3d){return BPromise[_0xe44e('0x22')](_0x595e3d);}return _0x34bfdd[_0xe44e('0x23')]();};}function saveUpdates(_0x23415b,_0x316d84){return function(_0x2a57e6){if(_0x2a57e6){return _0x2a57e6[_0xe44e('0x24')](_0x23415b)[_0xe44e('0x25')](function(_0x49d6df){return _0x49d6df;});}return null;};}function removeEntity(_0x1814b,_0x5df3d6){return function(_0x5abb4f){if(_0x5abb4f){return _0x5abb4f[_0xe44e('0x26')]()['then'](function(){_0x1814b[_0xe44e('0x1b')](0xcc)[_0xe44e('0x27')]();});}};}function handleEntityNotFound(_0x59a200,_0x1766bf){return function(_0x3da5c8){if(!_0x3da5c8){_0x59a200[_0xe44e('0x1a')](0x194);}return _0x3da5c8;};}function handleError(_0x455672,_0x1a8542){_0x1a8542=_0x1a8542||0x1f4;return function(_0x3073e8){logger[_0xe44e('0x28')](_0x3073e8['stack']);if(_0x3073e8[_0xe44e('0x29')]){delete _0x3073e8[_0xe44e('0x29')];}_0x455672[_0xe44e('0x1b')](_0x1a8542)[_0xe44e('0x2a')](_0x3073e8);};}exports['index']=function(_0x192a4b,_0x58b2c7){var _0x2c5b6a={},_0x45f36b={},_0x4a487a={'count':0x0,'rows':[]};var _0x34e062=_[_0xe44e('0x2b')](db[_0xe44e('0x2c')][_0xe44e('0x2d')],function(_0x5587ff){return{'name':_0x5587ff[_0xe44e('0x2e')],'type':_0x5587ff[_0xe44e('0x2f')][_0xe44e('0x30')]};});_0x45f36b[_0xe44e('0x31')]=_['map'](_0x34e062,_0xe44e('0x29'));_0x45f36b[_0xe44e('0x32')]=_[_0xe44e('0x33')](_0x192a4b['query']);_0x45f36b[_0xe44e('0x34')]=_[_0xe44e('0x35')](_0x45f36b[_0xe44e('0x31')],_0x45f36b[_0xe44e('0x32')]);_0x2c5b6a[_0xe44e('0x36')]=_[_0xe44e('0x35')](_0x45f36b[_0xe44e('0x31')],qs['fields'](_0x192a4b['query'][_0xe44e('0x37')]));_0x2c5b6a[_0xe44e('0x36')]=_0x2c5b6a[_0xe44e('0x36')][_0xe44e('0x38')]?_0x2c5b6a[_0xe44e('0x36')]:_0x45f36b[_0xe44e('0x31')];if(!_0x192a4b[_0xe44e('0x32')][_0xe44e('0x39')](_0xe44e('0x3a'))){_0x2c5b6a[_0xe44e('0x1e')]=qs[_0xe44e('0x1e')](_0x192a4b[_0xe44e('0x32')][_0xe44e('0x1e')]);_0x2c5b6a['offset']=qs['offset'](_0x192a4b[_0xe44e('0x32')][_0xe44e('0x3b')]);}_0x2c5b6a[_0xe44e('0x3c')]=qs[_0xe44e('0x3d')](_0x192a4b['query'][_0xe44e('0x3d')]);_0x2c5b6a['where']=qs[_0xe44e('0x34')](_[_0xe44e('0x3e')](_0x192a4b[_0xe44e('0x32')],_0x45f36b[_0xe44e('0x34')]),_0x34e062);if(_0x192a4b['query']['filter']){_0x2c5b6a['where']=_[_0xe44e('0x3f')](_0x2c5b6a[_0xe44e('0x40')],{'$or':_[_0xe44e('0x2b')](_0x34e062,function(_0x4d1ae4){if(_0x4d1ae4['type']!==_0xe44e('0x41')){var _0x2fc568={};_0x2fc568[_0x4d1ae4['name']]={'$like':'%'+_0x192a4b[_0xe44e('0x32')]['filter']+'%'};return _0x2fc568;}})});}_0x2c5b6a=_[_0xe44e('0x3f')]({},_0x2c5b6a,_0x192a4b[_0xe44e('0x42')]);var _0x4d7306={'where':_0x2c5b6a[_0xe44e('0x40')]};return db[_0xe44e('0x2c')][_0xe44e('0x1f')](_0x4d7306)[_0xe44e('0x25')](function(_0x58750e){_0x4a487a[_0xe44e('0x1f')]=_0x58750e;if(_0x192a4b['query'][_0xe44e('0x43')]){_0x2c5b6a[_0xe44e('0x44')]=[{'all':!![]}];}return db[_0xe44e('0x2c')][_0xe44e('0x45')](_0x2c5b6a);})[_0xe44e('0x25')](function(_0x1b8405){_0x4a487a[_0xe44e('0x46')]=_0x1b8405;return _0x4a487a;})[_0xe44e('0x25')](respondWithFilteredResult(_0x58b2c7,_0x2c5b6a))['catch'](handleError(_0x58b2c7,null));};exports[_0xe44e('0x47')]=function(_0x3cc397,_0x5e8282){var _0x38a29e={'raw':!![],'where':{'id':_0x3cc397[_0xe44e('0x48')]['id']}},_0x1b28d0={};_0x1b28d0['model']=_[_0xe44e('0x33')](db['VoiceDialReport'][_0xe44e('0x2d')]);_0x1b28d0[_0xe44e('0x32')]=_[_0xe44e('0x33')](_0x3cc397[_0xe44e('0x32')]);_0x1b28d0['filters']=_['intersection'](_0x1b28d0[_0xe44e('0x31')],_0x1b28d0['query']);_0x38a29e[_0xe44e('0x36')]=_['intersection'](_0x1b28d0[_0xe44e('0x31')],qs[_0xe44e('0x37')](_0x3cc397[_0xe44e('0x32')][_0xe44e('0x37')]));_0x38a29e[_0xe44e('0x36')]=_0x38a29e['attributes'][_0xe44e('0x38')]?_0x38a29e['attributes']:_0x1b28d0[_0xe44e('0x31')];if(_0x3cc397[_0xe44e('0x32')][_0xe44e('0x43')]){_0x38a29e['include']=[{'all':!![]}];}_0x38a29e=_[_0xe44e('0x3f')]({},_0x38a29e,_0x3cc397[_0xe44e('0x42')]);return db['VoiceDialReport'][_0xe44e('0x49')](_0x38a29e)[_0xe44e('0x25')](handleEntityNotFound(_0x5e8282,null))[_0xe44e('0x25')](respondWithResult(_0x5e8282,null))[_0xe44e('0x4a')](handleError(_0x5e8282,null));};exports[_0xe44e('0x4b')]=function(_0x3144b8,_0x411007){return db[_0xe44e('0x2c')][_0xe44e('0x4b')](_0x3144b8['body'],{})[_0xe44e('0x25')](respondWithResult(_0x411007,0xc9))[_0xe44e('0x4a')](handleError(_0x411007,null));};exports['update']=function(_0x35805b,_0xa35a95){if(_0x35805b[_0xe44e('0x4c')]['id']){delete _0x35805b[_0xe44e('0x4c')]['id'];}return db['VoiceDialReport'][_0xe44e('0x49')]({'where':{'id':_0x35805b[_0xe44e('0x48')]['id']}})[_0xe44e('0x25')](handleEntityNotFound(_0xa35a95,null))[_0xe44e('0x25')](saveUpdates(_0x35805b[_0xe44e('0x4c')],null))[_0xe44e('0x25')](respondWithResult(_0xa35a95,null))[_0xe44e('0x4a')](handleError(_0xa35a95,null));};exports[_0xe44e('0x26')]=function(_0x4a3ddd,_0x167bf9){return db[_0xe44e('0x2c')][_0xe44e('0x49')]({'where':{'id':_0x4a3ddd[_0xe44e('0x48')]['id']}})[_0xe44e('0x25')](handleEntityNotFound(_0x167bf9,null))[_0xe44e('0x25')](removeEntity(_0x167bf9,null))[_0xe44e('0x4a')](handleError(_0x167bf9,null));};exports['describe']=function(_0xcfcb9d,_0x4e669a){return db[_0xe44e('0x2c')]['describe']()[_0xe44e('0x25')](respondWithResult(_0x4e669a,null))['catch'](handleError(_0x4e669a,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index a1f816e..d355cf4 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 _0x9fdc=['request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','lodash','util','api','moment','bluebird'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9fdc,0x18e));var _0xc9fd=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x9fdc[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0xc9fd('0x0'));var util=require(_0xc9fd('0x1'));var logger=require('../../config/logger')(_0xc9fd('0x2'));var moment=require(_0xc9fd('0x3'));var BPromise=require(_0xc9fd('0x4'));var rp=require(_0xc9fd('0x5'));var fs=require('fs');var path=require(_0xc9fd('0x6'));var rimraf=require(_0xc9fd('0x7'));var config=require(_0xc9fd('0x8'));var attributes=require(_0xc9fd('0x9'));module[_0xc9fd('0xa')]=function(_0x40cbaa,_0x4697b7){return _0x40cbaa[_0xc9fd('0xb')](_0xc9fd('0xc'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc8fd=['report_dial','uniqueid','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x967959,_0x53c5c1){var _0x5c4489=function(_0x1ae5c6){while(--_0x1ae5c6){_0x967959['push'](_0x967959['shift']());}};_0x5c4489(++_0x53c5c1);}(_0xc8fd,0x162));var _0xdc8f=function(_0x3a9a78,_0xc21ee3){_0x3a9a78=_0x3a9a78-0x0;var _0x921ffc=_0xc8fd[_0x3a9a78];return _0x921ffc;};'use strict';var _=require('lodash');var util=require(_0xdc8f('0x0'));var logger=require(_0xdc8f('0x1'))('api');var moment=require(_0xdc8f('0x2'));var BPromise=require('bluebird');var rp=require(_0xdc8f('0x3'));var fs=require('fs');var path=require(_0xdc8f('0x4'));var rimraf=require(_0xdc8f('0x5'));var config=require(_0xdc8f('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0xdc8f('0x7')]=function(_0x14a4e5,_0x5a47bf){return _0x14a4e5[_0xdc8f('0x8')]('VoiceDialReport',attributes,{'tableName':_0xdc8f('0x9'),'paranoid':![],'indexes':[{'fields':[_0xdc8f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 4ff046d..9ec1bc2 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 _0xee85=['attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','create','body','options','then','UpdateVoiceDialReport','update'];(function(_0x5808ed,_0xa2bbfd){var _0x421a29=function(_0x301659){while(--_0x301659){_0x5808ed['push'](_0x5808ed['shift']());}};_0x421a29(++_0xa2bbfd);}(_0xee85,0x9d));var _0x5ee8=function(_0x5df61d,_0x158640){_0x5df61d=_0x5df61d-0x0;var _0x24cc4c=_0xee85[_0x5df61d];return _0x24cc4c;};'use strict';var _=require('lodash');var util=require(_0x5ee8('0x0'));var moment=require(_0x5ee8('0x1'));var BPromise=require(_0x5ee8('0x2'));var rs=require(_0x5ee8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ee8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ee8('0x5'))(_0x5ee8('0x6'));var config=require(_0x5ee8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5ee8('0x8')][_0x5ee8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x540227,_0x268d7d,_0x17b9cc){return new BPromise(function(_0x48d9ef,_0x11ec53){return client[_0x5ee8('0xa')](_0x540227,_0x17b9cc)['then'](function(_0x18d2a8){logger[_0x5ee8('0xb')](_0x5ee8('0xc'),_0x268d7d,_0x5ee8('0xd'));logger[_0x5ee8('0xe')](_0x5ee8('0xf'),_0x268d7d,_0x5ee8('0xd'),JSON[_0x5ee8('0x10')](_0x18d2a8));if(_0x18d2a8[_0x5ee8('0x11')]){if(_0x18d2a8[_0x5ee8('0x11')][_0x5ee8('0x12')]===0x1f4){logger[_0x5ee8('0x11')](_0x5ee8('0xc'),_0x268d7d,_0x18d2a8[_0x5ee8('0x11')][_0x5ee8('0x13')]);return _0x11ec53(_0x18d2a8['error'][_0x5ee8('0x13')]);}logger[_0x5ee8('0x11')](_0x5ee8('0xc'),_0x268d7d,_0x18d2a8['error'][_0x5ee8('0x13')]);return _0x48d9ef(_0x18d2a8[_0x5ee8('0x11')][_0x5ee8('0x13')]);}else{logger[_0x5ee8('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x268d7d,'request\x20sent');_0x48d9ef(_0x18d2a8[_0x5ee8('0x14')][_0x5ee8('0x13')]);}})[_0x5ee8('0x15')](function(_0x5a5f1b){logger[_0x5ee8('0x11')](_0x5ee8('0xc'),_0x268d7d,_0x5a5f1b);_0x11ec53(_0x5a5f1b);});});}exports[_0x5ee8('0x16')]=function(_0x9014a7){var _0x2f510d=this;return new Promise(function(_0x2962c2,_0x133e2d){return db['VoiceDialReport'][_0x5ee8('0x17')](_0x9014a7[_0x5ee8('0x18')],{'raw':_0x9014a7['options']?_0x9014a7[_0x5ee8('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x5ee8('0x1a')](function(_0x2aed4c){logger[_0x5ee8('0xb')](_0x5ee8('0x16'),_0x9014a7);logger[_0x5ee8('0xe')]('CreateVoiceDialReport',_0x9014a7,JSON[_0x5ee8('0x10')](_0x2aed4c));_0x2962c2(_0x2aed4c);})['catch'](function(_0x263b8e){logger[_0x5ee8('0x11')]('CreateVoiceDialReport',_0x263b8e[_0x5ee8('0x13')],_0x9014a7);_0x133e2d(_0x2f510d['error'](0x1f4,_0x263b8e[_0x5ee8('0x13')]));});});};exports[_0x5ee8('0x1b')]=function(_0x542f82){var _0x243756=this;return new Promise(function(_0xb1f986,_0x595d3e){return db['VoiceDialReport'][_0x5ee8('0x1c')](_0x542f82[_0x5ee8('0x18')],{'raw':_0x542f82[_0x5ee8('0x19')]?_0x542f82[_0x5ee8('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x542f82[_0x5ee8('0x19')]?_0x542f82[_0x5ee8('0x19')]['where']||null:null,'attributes':_0x542f82[_0x5ee8('0x19')]?_0x542f82[_0x5ee8('0x19')][_0x5ee8('0x1d')]||null:null,'limit':_0x542f82[_0x5ee8('0x19')]?_0x542f82['options'][_0x5ee8('0x1e')]||null:null})['then'](function(_0x187949){logger['info']('UpdateVoiceDialReport',_0x542f82);logger[_0x5ee8('0xe')](_0x5ee8('0x1b'),_0x542f82,JSON['stringify'](_0x187949));_0xb1f986(_0x187949);})[_0x5ee8('0x15')](function(_0x32cc52){logger[_0x5ee8('0x11')](_0x5ee8('0x1b'),_0x32cc52[_0x5ee8('0x13')],_0x542f82);_0x595d3e(_0x243756[_0x5ee8('0x11')](0x1f4,_0x32cc52['message']));});});}; \ No newline at end of file +var _0x6704=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceDialReport,\x20%s,\x20%s','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','debug','UpdateVoiceDialReport','update','raw','where','attributes','lodash','util','bluebird','randomstring'];(function(_0x41c099,_0x2f885c){var _0x479333=function(_0x1cac9d){while(--_0x1cac9d){_0x41c099['push'](_0x41c099['shift']());}};_0x479333(++_0x2f885c);}(_0x6704,0x1d8));var _0x4670=function(_0x2eaff4,_0x4852b7){_0x2eaff4=_0x2eaff4-0x0;var _0x278c7a=_0x6704[_0x2eaff4];return _0x278c7a;};'use strict';var _=require(_0x4670('0x0'));var util=require(_0x4670('0x1'));var moment=require('moment');var BPromise=require(_0x4670('0x2'));var rs=require(_0x4670('0x3'));var fs=require('fs');var Redis=require(_0x4670('0x4'));var db=require(_0x4670('0x5'))['db'];var utils=require(_0x4670('0x6'));var logger=require(_0x4670('0x7'))(_0x4670('0x8'));var config=require(_0x4670('0x9'));var jayson=require(_0x4670('0xa'));var client=jayson['client'][_0x4670('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11593f,_0x571835,_0x128e7b){return new BPromise(function(_0x554fe8,_0x4dda84){return client['request'](_0x11593f,_0x128e7b)[_0x4670('0xc')](function(_0x42287a){logger[_0x4670('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x571835,_0x4670('0xe'));logger['debug'](_0x4670('0xf'),_0x571835,_0x4670('0xe'),JSON[_0x4670('0x10')](_0x42287a));if(_0x42287a['error']){if(_0x42287a[_0x4670('0x11')][_0x4670('0x12')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x571835,_0x42287a[_0x4670('0x11')][_0x4670('0x13')]);return _0x4dda84(_0x42287a[_0x4670('0x11')]['message']);}logger[_0x4670('0x11')](_0x4670('0x14'),_0x571835,_0x42287a[_0x4670('0x11')][_0x4670('0x13')]);return _0x554fe8(_0x42287a[_0x4670('0x11')][_0x4670('0x13')]);}else{logger[_0x4670('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x571835,'request\x20sent');_0x554fe8(_0x42287a[_0x4670('0x15')][_0x4670('0x13')]);}})[_0x4670('0x16')](function(_0x5db35d){logger['error'](_0x4670('0x14'),_0x571835,_0x5db35d);_0x4dda84(_0x5db35d);});});}exports[_0x4670('0x17')]=function(_0x14bd82){var _0x5a9ff7=this;return new Promise(function(_0x516106,_0x5959a8){return db[_0x4670('0x18')][_0x4670('0x19')](_0x14bd82[_0x4670('0x1a')],{'raw':_0x14bd82[_0x4670('0x1b')]?_0x14bd82[_0x4670('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x4670('0xc')](function(_0x5510ec){logger[_0x4670('0xd')](_0x4670('0x17'),_0x14bd82);logger[_0x4670('0x1c')](_0x4670('0x17'),_0x14bd82,JSON[_0x4670('0x10')](_0x5510ec));_0x516106(_0x5510ec);})[_0x4670('0x16')](function(_0xe32ef1){logger[_0x4670('0x11')](_0x4670('0x17'),_0xe32ef1[_0x4670('0x13')],_0x14bd82);_0x5959a8(_0x5a9ff7[_0x4670('0x11')](0x1f4,_0xe32ef1['message']));});});};exports[_0x4670('0x1d')]=function(_0xe3e7ff){var _0xcff7b2=this;return new Promise(function(_0x2e6fe7,_0x41d32a){return db[_0x4670('0x18')][_0x4670('0x1e')](_0xe3e7ff['body'],{'raw':_0xe3e7ff[_0x4670('0x1b')]?_0xe3e7ff['options'][_0x4670('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe3e7ff[_0x4670('0x1b')]?_0xe3e7ff[_0x4670('0x1b')][_0x4670('0x20')]||null:null,'attributes':_0xe3e7ff['options']?_0xe3e7ff[_0x4670('0x1b')][_0x4670('0x21')]||null:null,'limit':_0xe3e7ff[_0x4670('0x1b')]?_0xe3e7ff[_0x4670('0x1b')]['limit']||null:null})[_0x4670('0xc')](function(_0x57b69f){logger[_0x4670('0xd')](_0x4670('0x1d'),_0xe3e7ff);logger[_0x4670('0x1c')]('UpdateVoiceDialReport',_0xe3e7ff,JSON[_0x4670('0x10')](_0x57b69f));_0x2e6fe7(_0x57b69f);})['catch'](function(_0xcc4bda){logger['error'](_0x4670('0x1d'),_0xcc4bda[_0x4670('0x13')],_0xe3e7ff);_0x41d32a(_0xcff7b2[_0x4670('0x11')](0x1f4,_0xcc4bda[_0x4670('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f75db89..573b613 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 _0xf793=['update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','addApplications','put'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xf793,0xcc));var _0x3f79=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf793[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x3f79('0x0'));var util=require(_0x3f79('0x1'));var path=require('path');var timeout=require(_0x3f79('0x2'));var express=require('express');var router=express[_0x3f79('0x3')]();var fs_extra=require(_0x3f79('0x4'));var auth=require(_0x3f79('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3f79('0x6'));var controller=require(_0x3f79('0x7'));router[_0x3f79('0x8')]('/',auth[_0x3f79('0x9')](),controller[_0x3f79('0xa')]);router[_0x3f79('0x8')](_0x3f79('0xb'),auth['isAuthenticated'](),controller[_0x3f79('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3f79('0xd')]('/:id/applications',auth[_0x3f79('0x9')](),controller[_0x3f79('0xe')]);router[_0x3f79('0xf')]('/:id',auth[_0x3f79('0x9')](),controller[_0x3f79('0x10')]);router[_0x3f79('0x11')]('/:id',auth[_0x3f79('0x9')](),controller[_0x3f79('0x12')]);module[_0x3f79('0x13')]=router; \ No newline at end of file +var _0x11f2=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x29e0eb,_0x9acb52){var _0x597d2d=function(_0x596ef9){while(--_0x596ef9){_0x29e0eb['push'](_0x29e0eb['shift']());}};_0x597d2d(++_0x9acb52);}(_0x11f2,0xa2));var _0x211f=function(_0x1cd8ed,_0x2c541c){_0x1cd8ed=_0x1cd8ed-0x0;var _0x50da39=_0x11f2[_0x1cd8ed];return _0x50da39;};'use strict';var multer=require('multer');var util=require(_0x211f('0x0'));var path=require(_0x211f('0x1'));var timeout=require(_0x211f('0x2'));var express=require(_0x211f('0x3'));var router=express[_0x211f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x211f('0x5'));var interaction=require(_0x211f('0x6'));var config=require(_0x211f('0x7'));var controller=require(_0x211f('0x8'));router[_0x211f('0x9')]('/',auth[_0x211f('0xa')](),controller[_0x211f('0xb')]);router[_0x211f('0x9')](_0x211f('0xc'),auth['isAuthenticated'](),controller[_0x211f('0xd')]);router[_0x211f('0xe')]('/',auth['isAuthenticated'](),controller[_0x211f('0xf')]);router[_0x211f('0xe')]('/:id/applications',auth['isAuthenticated'](),controller['addApplications']);router[_0x211f('0x10')](_0x211f('0xc'),auth[_0x211f('0xa')](),controller[_0x211f('0x11')]);router[_0x211f('0x12')](_0x211f('0xc'),auth[_0x211f('0xa')](),controller[_0x211f('0x13')]);module[_0x211f('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index cf06a17..c7e4bc6 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 _0x1b13=['BOOLEAN','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','outbound','internal','inbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x51f52e,_0x42be46){var _0x5e779c=function(_0x4b70d3){while(--_0x4b70d3){_0x51f52e['push'](_0x51f52e['shift']());}};_0x5e779c(++_0x42be46);}(_0x1b13,0x113));var _0x31b1=function(_0x40b674,_0x14af74){_0x40b674=_0x40b674-0x0;var _0x3b61c8=_0x1b13[_0x40b674];return _0x3b61c8;};'use strict';var Sequelize=require(_0x31b1('0x0'));module[_0x31b1('0x1')]={'context':{'type':Sequelize[_0x31b1('0x2')],'allowNull':![],'unique':_0x31b1('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x31b1('0x3')},'priority':{'type':Sequelize[_0x31b1('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x31b1('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x31b1('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x31b1('0x5')]('inbound',_0x31b1('0x6'),_0x31b1('0x7'),_0x31b1('0x8'),'outbound-fax',_0x31b1('0x9'),_0x31b1('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x31b1('0x2')],'allowNull':![],'defaultValue':_0x31b1('0xb')},'IntervalId':{'type':Sequelize[_0x31b1('0xc')]},'isApp':{'type':Sequelize[_0x31b1('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x31b1('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x31b1('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x31b1('0xc')]},'recordingFormat':{'type':Sequelize[_0x31b1('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x31b1('0xd')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x918a61){return this[_0x31b1('0xe')](_0x31b1('0xf'));}},'alias':{'type':Sequelize[_0x31b1('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x66c3=['getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','INTEGER','BOOLEAN','VIRTUAL'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x66c3,0x167));var _0x366c=function(_0x41c451,_0x3be9df){_0x41c451=_0x41c451-0x0;var _0x35f342=_0x66c3[_0x41c451];return _0x35f342;};'use strict';var Sequelize=require(_0x366c('0x0'));module[_0x366c('0x1')]={'context':{'type':Sequelize[_0x366c('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x366c('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x366c('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x366c('0x3')},'tag':{'type':Sequelize[_0x366c('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x366c('0x2')],'allowNull':![],'defaultValue':_0x366c('0x4')},'appdata':{'type':Sequelize[_0x366c('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x366c('0x5'),_0x366c('0x6'),_0x366c('0x7'),_0x366c('0x8'),_0x366c('0x9'),_0x366c('0xa'),_0x366c('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x366c('0x2')]},'interval':{'type':Sequelize[_0x366c('0x2')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0x366c('0xc')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x366c('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x366c('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x366c('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x366c('0x2')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x366c('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x366c('0xe')],'get':function(_0x52372e){return this[_0x366c('0xf')](_0x366c('0x10'));}},'alias':{'type':Sequelize[_0x366c('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 26fb119..a9716ba 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 _0x7255=['internal','ignore','value','type','UserProfileResource','error','stack','name','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','VoiceExtension','includeAll','catch','show','params','rawAttributes','include','options','find','create','startsWith','body','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','UserProfileSection','userProfileId','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','findOne','sequelize','transaction','VoiceExtensionId','rewriteDial','toLowerCase','true','createRouting','findAndCountAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','inbound','OutboundRoutes','outbound'];(function(_0x2b6dbe,_0x562268){var _0x47442d=function(_0x382a54){while(--_0x382a54){_0x2b6dbe['push'](_0x2b6dbe['shift']());}};_0x47442d(++_0x562268);}(_0x7255,0x117));var _0x5725=function(_0x490da9,_0x31214f){_0x490da9=_0x490da9-0x0;var _0x5b9821=_0x7255[_0x490da9];return _0x5b9821;};'use strict';var emlformat=require(_0x5725('0x0'));var rimraf=require(_0x5725('0x1'));var zipdir=require(_0x5725('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5725('0x3'));var moment=require(_0x5725('0x4'));var BPromise=require(_0x5725('0x5'));var Mustache=require(_0x5725('0x6'));var util=require(_0x5725('0x7'));var path=require('path');var sox=require(_0x5725('0x8'));var csv=require(_0x5725('0x9'));var ejs=require(_0x5725('0xa'));var fs=require('fs');var fs_extra=require(_0x5725('0xb'));var _=require(_0x5725('0xc'));var squel=require(_0x5725('0xd'));var crypto=require(_0x5725('0xe'));var jsforce=require(_0x5725('0xf'));var deskjs=require(_0x5725('0x10'));var toCsv=require(_0x5725('0x9'));var querystring=require('querystring');var Papa=require(_0x5725('0x11'));var Redis=require(_0x5725('0x12'));var authService=require(_0x5725('0x13'));var qs=require(_0x5725('0x14'));var as=require(_0x5725('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5725('0x16'));var licenseUtil=require(_0x5725('0x17'));var db=require('../../mysqldb')['db'];config[_0x5725('0x18')]=_[_0x5725('0x19')](config[_0x5725('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x5725('0x1a'))(new Redis(config[_0x5725('0x18')]));require(_0x5725('0x1b'))[_0x5725('0x1c')](socket);function respondWithStatusCode(_0x3536c4,_0x1c4ed1){_0x1c4ed1=_0x1c4ed1||0xcc;return function(_0x531a5d){if(_0x531a5d){return _0x3536c4[_0x5725('0x1d')](_0x1c4ed1);}return _0x3536c4[_0x5725('0x1e')](_0x1c4ed1)[_0x5725('0x1f')]();};}function respondWithResult(_0x38e7bd,_0x466d08){_0x466d08=_0x466d08||0xc8;return function(_0x1d1b38){if(_0x1d1b38){return _0x38e7bd[_0x5725('0x1e')](_0x466d08)['json'](_0x1d1b38);}};}function respondWithFilteredResult(_0x50f2d5,_0x469ff3){return function(_0x2df023){if(_0x2df023){var _0x61f134=typeof _0x469ff3[_0x5725('0x20')]==='undefined'&&typeof _0x469ff3['limit']===_0x5725('0x21');var _0x29c564=_0x2df023[_0x5725('0x22')];var _0x5c0c6b=_0x61f134?0x0:_0x469ff3[_0x5725('0x20')];var _0x5b9028=_0x61f134?_0x2df023[_0x5725('0x22')]:_0x469ff3['offset']+_0x469ff3[_0x5725('0x23')];var _0x3a6e5c;if(_0x5b9028>=_0x29c564){_0x5b9028=_0x29c564;_0x3a6e5c=0xc8;}else{_0x3a6e5c=0xce;}_0x50f2d5['status'](_0x3a6e5c);return _0x50f2d5[_0x5725('0x24')](_0x5725('0x25'),_0x5c0c6b+'-'+_0x5b9028+'/'+_0x29c564)['json'](_0x2df023);}return null;};}function patchUpdates(_0x1a39c2){return function(_0x50a281){try{jsonpatch[_0x5725('0x26')](_0x50a281,_0x1a39c2,!![]);}catch(_0x384fda){return BPromise[_0x5725('0x27')](_0x384fda);}return _0x50a281[_0x5725('0x28')]();};}function saveUpdates(_0x40f912,_0x258355){return function(_0x5ac436){if(_0x5ac436){return _0x5ac436[_0x5725('0x29')](_0x40f912)[_0x5725('0x2a')](function(_0x30efc7){return _0x30efc7;});}return null;};}function removeEntity(_0x2b5766,_0x45341a){return function(_0x407576){if(_0x407576){return _0x407576[_0x5725('0x2b')]()[_0x5725('0x2a')](function(){var _0x2d33ee=_0x407576[_0x5725('0x2c')]({'plain':!![]});var _0x4b8efd=[{'name':'InboundRoutes','value':_0x5725('0x2d'),'ignore':![]},{'name':_0x5725('0x2e'),'value':_0x5725('0x2f'),'ignore':![]},{'name':'InternalRoutes','value':_0x5725('0x30'),'ignore':![]}];var _0x42192c=_(_0x4b8efd)['filter'](_0x5725('0x31'))['map'](_0x5725('0x32'))['value']();if(_['includes'](_0x42192c,_0x2d33ee[_0x5725('0x33')])){return;}var _0x367455=_['find'](_0x4b8efd,['value',_0x2d33ee[_0x5725('0x33')]])['name'];return db[_0x5725('0x34')][_0x5725('0x2b')]({'where':{'type':_0x367455,'resourceId':_0x2d33ee['id']}})[_0x5725('0x2a')](function(){return _0x407576;});})['then'](function(){_0x2b5766['status'](0xcc)[_0x5725('0x1f')]();});}};}function handleEntityNotFound(_0x370b5c,_0x1dcdf5){return function(_0x1d0466){if(!_0x1d0466){_0x370b5c['sendStatus'](0x194);}return _0x1d0466;};}function handleError(_0x20184b,_0x3f3b30){_0x3f3b30=_0x3f3b30||0x1f4;return function(_0x3637f1){logger[_0x5725('0x35')](_0x3637f1[_0x5725('0x36')]);if(_0x3637f1['name']){delete _0x3637f1[_0x5725('0x37')];}_0x20184b[_0x5725('0x1e')](_0x3f3b30)['send'](_0x3637f1);};}exports['index']=function(_0x22dc0d,_0x4f9b0c){var _0x5b947f={},_0x52209a={},_0xe0b201={'count':0x0,'rows':[]};var _0x1a9479=_[_0x5725('0x38')](db['VoiceExtension']['rawAttributes'],function(_0x4c743f){return{'name':_0x4c743f[_0x5725('0x39')],'type':_0x4c743f['type'][_0x5725('0x3a')]};});_0x52209a[_0x5725('0x3b')]=_[_0x5725('0x38')](_0x1a9479,'name');_0x52209a[_0x5725('0x3c')]=_[_0x5725('0x3d')](_0x22dc0d[_0x5725('0x3c')]);_0x52209a[_0x5725('0x3e')]=_[_0x5725('0x3f')](_0x52209a[_0x5725('0x3b')],_0x52209a[_0x5725('0x3c')]);_0x5b947f[_0x5725('0x40')]=_[_0x5725('0x3f')](_0x52209a[_0x5725('0x3b')],qs[_0x5725('0x41')](_0x22dc0d['query'][_0x5725('0x41')]));_0x5b947f[_0x5725('0x40')]=_0x5b947f['attributes'][_0x5725('0x42')]?_0x5b947f[_0x5725('0x40')]:_0x52209a['model'];if(!_0x22dc0d['query'][_0x5725('0x43')](_0x5725('0x44'))){_0x5b947f['limit']=qs[_0x5725('0x23')](_0x22dc0d[_0x5725('0x3c')]['limit']);_0x5b947f[_0x5725('0x20')]=qs['offset'](_0x22dc0d['query'][_0x5725('0x20')]);}_0x5b947f['order']=qs[_0x5725('0x45')](_0x22dc0d[_0x5725('0x3c')][_0x5725('0x45')]);_0x5b947f[_0x5725('0x46')]=qs[_0x5725('0x3e')](_[_0x5725('0x47')](_0x22dc0d[_0x5725('0x3c')],_0x52209a[_0x5725('0x3e')]),_0x1a9479);if(_0x22dc0d['query'][_0x5725('0x48')]){_0x5b947f[_0x5725('0x46')]=_['merge'](_0x5b947f['where'],{'$or':_[_0x5725('0x38')](_0x1a9479,function(_0x593e07){if(_0x593e07['type']!==_0x5725('0x49')){var _0x205a48={};_0x205a48[_0x593e07[_0x5725('0x37')]]={'$like':'%'+_0x22dc0d[_0x5725('0x3c')][_0x5725('0x48')]+'%'};return _0x205a48;}})});}_0x5b947f=_[_0x5725('0x4a')]({},_0x5b947f,_0x22dc0d['options']);var _0x502392={'where':_0x5b947f[_0x5725('0x46')]};return db[_0x5725('0x4b')]['count'](_0x502392)[_0x5725('0x2a')](function(_0x4a48c2){_0xe0b201[_0x5725('0x22')]=_0x4a48c2;if(_0x22dc0d[_0x5725('0x3c')][_0x5725('0x4c')]){_0x5b947f['include']=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x5b947f);})['then'](function(_0x33c087){_0xe0b201['rows']=_0x33c087;return _0xe0b201;})[_0x5725('0x2a')](respondWithFilteredResult(_0x4f9b0c,_0x5b947f))[_0x5725('0x4d')](handleError(_0x4f9b0c,null));};exports[_0x5725('0x4e')]=function(_0x300cba,_0x52f331){var _0xaf6dfc={'raw':![],'where':{'id':_0x300cba[_0x5725('0x4f')]['id']}},_0xa132c7={};_0xa132c7[_0x5725('0x3b')]=_[_0x5725('0x3d')](db['VoiceExtension'][_0x5725('0x50')]);_0xa132c7[_0x5725('0x3c')]=_['keys'](_0x300cba[_0x5725('0x3c')]);_0xa132c7[_0x5725('0x3e')]=_[_0x5725('0x3f')](_0xa132c7[_0x5725('0x3b')],_0xa132c7[_0x5725('0x3c')]);_0xaf6dfc[_0x5725('0x40')]=_[_0x5725('0x3f')](_0xa132c7[_0x5725('0x3b')],qs['fields'](_0x300cba['query'][_0x5725('0x41')]));_0xaf6dfc[_0x5725('0x40')]=_0xaf6dfc[_0x5725('0x40')][_0x5725('0x42')]?_0xaf6dfc[_0x5725('0x40')]:_0xa132c7['model'];if(_0x300cba[_0x5725('0x3c')]['includeAll']){_0xaf6dfc[_0x5725('0x51')]=[{'all':!![]}];}_0xaf6dfc=_[_0x5725('0x4a')]({},_0xaf6dfc,_0x300cba[_0x5725('0x52')]);return db[_0x5725('0x4b')][_0x5725('0x53')](_0xaf6dfc)[_0x5725('0x2a')](handleEntityNotFound(_0x52f331,null))[_0x5725('0x2a')](respondWithResult(_0x52f331,null))[_0x5725('0x4d')](handleError(_0x52f331,null));};exports['destroy']=function(_0x31ede8,_0x487569){return db[_0x5725('0x4b')][_0x5725('0x53')]({'where':{'id':_0x31ede8[_0x5725('0x4f')]['id']}})['then'](handleEntityNotFound(_0x487569,null))[_0x5725('0x2a')](removeEntity(_0x487569,null))[_0x5725('0x4d')](handleError(_0x487569,null));};exports[_0x5725('0x54')]=function(_0x2f2e33,_0x43aa3b){if(_0x2f2e33['body'][_0x5725('0x33')]===_0x5725('0x2f')&&!_[_0x5725('0x55')](_0x2f2e33[_0x5725('0x56')][_0x5725('0x57')],'_')){_0x2f2e33[_0x5725('0x56')]['exten']='_'['concat'](_0x2f2e33[_0x5725('0x56')][_0x5725('0x57')]);}return db['VoiceExtension'][_0x5725('0x54')](_0x2f2e33[_0x5725('0x56')],{'raw':![]})[_0x5725('0x2a')](function(_0x19e497){var _0x517736=_0x2f2e33[_0x5725('0x58')][_0x5725('0x2c')]({'plain':!![]});if(!_0x517736)throw new Error(_0x5725('0x59'));if(_0x517736[_0x5725('0x5a')]===_0x5725('0x58')){var _0x3945f7=_0x19e497[_0x5725('0x2c')]({'plain':!![]});var _0x2198d4=[{'name':'InboundRoutes','value':_0x5725('0x2d')},{'name':_0x5725('0x2e'),'value':_0x5725('0x2f')},{'name':_0x5725('0x5b'),'value':_0x5725('0x30')}];var _0x57734f=_[_0x5725('0x53')](_0x2198d4,['value',_0x3945f7[_0x5725('0x33')]])[_0x5725('0x37')];return db[_0x5725('0x5c')][_0x5725('0x53')]({'where':{'name':_0x57734f,'userProfileId':_0x517736[_0x5725('0x5d')]},'raw':!![]})[_0x5725('0x2a')](function(_0x4bb3c5){if(_0x4bb3c5&&_0x4bb3c5['autoAssociation']===0x0){return db[_0x5725('0x34')]['create']({'name':_0x3945f7[_0x5725('0x37')],'resourceId':_0x3945f7['id'],'type':_0x4bb3c5['name'],'sectionId':_0x4bb3c5['id']},{})[_0x5725('0x2a')](function(){return _0x19e497;});}else{return _0x19e497;}})[_0x5725('0x4d')](function(_0x11015a){logger[_0x5725('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11015a);throw _0x11015a;});}return _0x19e497;})[_0x5725('0x2a')](respondWithResult(_0x43aa3b,0xc9))[_0x5725('0x4d')](handleError(_0x43aa3b,null));};exports['update']=function(_0x4f73d6,_0x5d36fd){if(_0x4f73d6[_0x5725('0x56')]['id']){delete _0x4f73d6['body']['id'];}return db[_0x5725('0x4b')][_0x5725('0x53')]({'where':{'id':_0x4f73d6[_0x5725('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5d36fd,null))[_0x5725('0x2a')](function(_0x23e497){if(_0x23e497){return db['VoiceExtension']['update'](_['pick'](_0x4f73d6[_0x5725('0x56')],[_0x5725('0x57'),'context',_0x5725('0x5e'),_0x5725('0x5f'),_0x5725('0x60'),_0x5725('0x61'),_0x5725('0x62')]),{'where':{'context':_0x23e497['context'],'exten':_0x23e497[_0x5725('0x57')]},'individualHooks':!![]})[_0x5725('0x2a')](function(_0x28f511){return _0x28f511;});}return null;})[_0x5725('0x2a')](respondWithStatusCode(_0x5d36fd,null))['catch'](handleError(_0x5d36fd,null));};exports[_0x5725('0x63')]=function(_0x237597,_0x99139){return db[_0x5725('0x4b')][_0x5725('0x64')]({'where':{'id':_0x237597[_0x5725('0x4f')]['id']}})[_0x5725('0x2a')](function(_0x1bcc21){if(_0x1bcc21){return db[_0x5725('0x65')][_0x5725('0x66')](function(_0x371b63){return db[_0x5725('0x4b')][_0x5725('0x2b')]({'where':{'VoiceExtensionId':_0x237597[_0x5725('0x4f')]['id']},'transaction':_0x371b63})[_0x5725('0x2a')](function(){var _0x13f4a=_[_0x5725('0x38')](_0x237597['body'],function(_0x12bbf2){_0x12bbf2[_0x5725('0x67')]=_0x237597[_0x5725('0x4f')]['id'];_0x12bbf2['isApp']=!![];return _0x12bbf2;});var _0x58fc3e=_0x237597[_0x5725('0x3c')][_0x5725('0x68')]&&_0x237597[_0x5725('0x3c')]['rewriteDial'][_0x5725('0x69')]()===_0x5725('0x6a')?!![]:![];return _0x1bcc21[_0x5725('0x6b')](_0x13f4a,_0x58fc3e);})[_0x5725('0x2a')](function(_0x273623){return db[_0x5725('0x4b')]['bulkCreate'](_0x273623,{'transaction':_0x371b63});});})[_0x5725('0x2a')](function(){return db[_0x5725('0x4b')][_0x5725('0x6c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x237597[_0x5725('0x4f')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x5725('0x2a')](respondWithResult(_0x99139,null))[_0x5725('0x4d')](handleError(_0x99139,null));}; \ No newline at end of file +var _0x82d8=['filter','ignore','value','includes','type','find','name','UserProfileResource','send','index','rawAttributes','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','include','catch','show','params','keys','create','body','outbound','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','internal','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','mandatoryDisposition','addApplications','findOne','sequelize','transaction','rewriteDial','toLowerCase','true','bulkCreate','cast(priority\x20as\x20unsigned)','zip-dir','moment','bluebird','util','sox','to-csv','fs-extra','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','apply','reject','save','then','destroy','get','InboundRoutes','OutboundRoutes','InternalRoutes'];(function(_0x4b3f3e,_0x47dfcc){var _0x921fc3=function(_0x3e4b3b){while(--_0x3e4b3b){_0x4b3f3e['push'](_0x4b3f3e['shift']());}};_0x921fc3(++_0x47dfcc);}(_0x82d8,0x171));var _0x882d=function(_0x33186f,_0x39b6e9){_0x33186f=_0x33186f-0x0;var _0x325f59=_0x82d8[_0x33186f];return _0x325f59;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x882d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x882d('0x1'));var BPromise=require(_0x882d('0x2'));var Mustache=require('mustache');var util=require(_0x882d('0x3'));var path=require('path');var sox=require(_0x882d('0x4'));var csv=require(_0x882d('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x882d('0x6'));var _=require('lodash');var squel=require(_0x882d('0x7'));var crypto=require('crypto');var jsforce=require(_0x882d('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x882d('0x9'));var Redis=require(_0x882d('0xa'));var authService=require(_0x882d('0xb'));var qs=require(_0x882d('0xc'));var as=require(_0x882d('0xd'));var hardwareService=require(_0x882d('0xe'));var logger=require(_0x882d('0xf'))(_0x882d('0x10'));var utils=require(_0x882d('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x882d('0x12'));var db=require('../../mysqldb')['db'];config[_0x882d('0x13')]=_['defaults'](config[_0x882d('0x13')],{'host':_0x882d('0x14'),'port':0x18eb});var socket=require(_0x882d('0x15'))(new Redis(config[_0x882d('0x13')]));require(_0x882d('0x16'))[_0x882d('0x17')](socket);function respondWithStatusCode(_0x2c7a7a,_0x3ebc99){_0x3ebc99=_0x3ebc99||0xcc;return function(_0x5dc3a4){if(_0x5dc3a4){return _0x2c7a7a[_0x882d('0x18')](_0x3ebc99);}return _0x2c7a7a['status'](_0x3ebc99)[_0x882d('0x19')]();};}function respondWithResult(_0x3bc1f7,_0x5c9af3){_0x5c9af3=_0x5c9af3||0xc8;return function(_0x498679){if(_0x498679){return _0x3bc1f7['status'](_0x5c9af3)['json'](_0x498679);}};}function respondWithFilteredResult(_0x2ff214,_0x4f8ddd){return function(_0x1a9167){if(_0x1a9167){var _0x57949b=typeof _0x4f8ddd[_0x882d('0x1a')]==='undefined'&&typeof _0x4f8ddd[_0x882d('0x1b')]===_0x882d('0x1c');var _0x5ccda6=_0x1a9167[_0x882d('0x1d')];var _0x3cc36c=_0x57949b?0x0:_0x4f8ddd['offset'];var _0x312527=_0x57949b?_0x1a9167[_0x882d('0x1d')]:_0x4f8ddd[_0x882d('0x1a')]+_0x4f8ddd[_0x882d('0x1b')];var _0x486250;if(_0x312527>=_0x5ccda6){_0x312527=_0x5ccda6;_0x486250=0xc8;}else{_0x486250=0xce;}_0x2ff214[_0x882d('0x1e')](_0x486250);return _0x2ff214[_0x882d('0x1f')](_0x882d('0x20'),_0x3cc36c+'-'+_0x312527+'/'+_0x5ccda6)[_0x882d('0x21')](_0x1a9167);}return null;};}function patchUpdates(_0x29496f){return function(_0x511116){try{jsonpatch[_0x882d('0x22')](_0x511116,_0x29496f,!![]);}catch(_0x19bd66){return BPromise[_0x882d('0x23')](_0x19bd66);}return _0x511116[_0x882d('0x24')]();};}function saveUpdates(_0x3e2fa9,_0x5cbbec){return function(_0x1c7c63){if(_0x1c7c63){return _0x1c7c63['update'](_0x3e2fa9)[_0x882d('0x25')](function(_0x1abc50){return _0x1abc50;});}return null;};}function removeEntity(_0x3f1b2a,_0x1f7e8c){return function(_0xbd3cd1){if(_0xbd3cd1){return _0xbd3cd1[_0x882d('0x26')]()[_0x882d('0x25')](function(){var _0x167eaf=_0xbd3cd1[_0x882d('0x27')]({'plain':!![]});var _0x1e448c=[{'name':_0x882d('0x28'),'value':'inbound','ignore':![]},{'name':_0x882d('0x29'),'value':'outbound','ignore':![]},{'name':_0x882d('0x2a'),'value':'internal','ignore':![]}];var _0x77d588=_(_0x1e448c)[_0x882d('0x2b')](_0x882d('0x2c'))['map']('value')[_0x882d('0x2d')]();if(_[_0x882d('0x2e')](_0x77d588,_0x167eaf[_0x882d('0x2f')])){return;}var _0x1fa94b=_[_0x882d('0x30')](_0x1e448c,[_0x882d('0x2d'),_0x167eaf[_0x882d('0x2f')]])[_0x882d('0x31')];return db[_0x882d('0x32')][_0x882d('0x26')]({'where':{'type':_0x1fa94b,'resourceId':_0x167eaf['id']}})[_0x882d('0x25')](function(){return _0xbd3cd1;});})[_0x882d('0x25')](function(){_0x3f1b2a[_0x882d('0x1e')](0xcc)[_0x882d('0x19')]();});}};}function handleEntityNotFound(_0x3cbef5,_0x116552){return function(_0x807b7){if(!_0x807b7){_0x3cbef5[_0x882d('0x18')](0x194);}return _0x807b7;};}function handleError(_0x41e063,_0xa006ce){_0xa006ce=_0xa006ce||0x1f4;return function(_0xfac88e){logger['error'](_0xfac88e['stack']);if(_0xfac88e[_0x882d('0x31')]){delete _0xfac88e[_0x882d('0x31')];}_0x41e063[_0x882d('0x1e')](_0xa006ce)[_0x882d('0x33')](_0xfac88e);};}exports[_0x882d('0x34')]=function(_0x39badd,_0x393d29){var _0x53a013={},_0x3aba6f={},_0x38b693={'count':0x0,'rows':[]};var _0x2bbe38=_['map'](db['VoiceExtension'][_0x882d('0x35')],function(_0x7b53ba){return{'name':_0x7b53ba['fieldName'],'type':_0x7b53ba[_0x882d('0x2f')][_0x882d('0x36')]};});_0x3aba6f['model']=_[_0x882d('0x37')](_0x2bbe38,_0x882d('0x31'));_0x3aba6f['query']=_['keys'](_0x39badd[_0x882d('0x38')]);_0x3aba6f['filters']=_[_0x882d('0x39')](_0x3aba6f[_0x882d('0x3a')],_0x3aba6f['query']);_0x53a013[_0x882d('0x3b')]=_[_0x882d('0x39')](_0x3aba6f['model'],qs[_0x882d('0x3c')](_0x39badd[_0x882d('0x38')]['fields']));_0x53a013['attributes']=_0x53a013[_0x882d('0x3b')][_0x882d('0x3d')]?_0x53a013[_0x882d('0x3b')]:_0x3aba6f[_0x882d('0x3a')];if(!_0x39badd[_0x882d('0x38')][_0x882d('0x3e')](_0x882d('0x3f'))){_0x53a013[_0x882d('0x1b')]=qs[_0x882d('0x1b')](_0x39badd[_0x882d('0x38')]['limit']);_0x53a013['offset']=qs[_0x882d('0x1a')](_0x39badd[_0x882d('0x38')][_0x882d('0x1a')]);}_0x53a013['order']=qs[_0x882d('0x40')](_0x39badd['query']['sort']);_0x53a013[_0x882d('0x41')]=qs[_0x882d('0x42')](_[_0x882d('0x43')](_0x39badd[_0x882d('0x38')],_0x3aba6f['filters']),_0x2bbe38);if(_0x39badd[_0x882d('0x38')][_0x882d('0x2b')]){_0x53a013['where']=_[_0x882d('0x44')](_0x53a013[_0x882d('0x41')],{'$or':_[_0x882d('0x37')](_0x2bbe38,function(_0x268e58){if(_0x268e58[_0x882d('0x2f')]!==_0x882d('0x45')){var _0x1d1d40={};_0x1d1d40[_0x268e58['name']]={'$like':'%'+_0x39badd[_0x882d('0x38')][_0x882d('0x2b')]+'%'};return _0x1d1d40;}})});}_0x53a013=_[_0x882d('0x44')]({},_0x53a013,_0x39badd[_0x882d('0x46')]);var _0x5a4648={'where':_0x53a013[_0x882d('0x41')]};return db[_0x882d('0x47')][_0x882d('0x1d')](_0x5a4648)[_0x882d('0x25')](function(_0x1b907b){_0x38b693[_0x882d('0x1d')]=_0x1b907b;if(_0x39badd[_0x882d('0x38')][_0x882d('0x48')]){_0x53a013[_0x882d('0x49')]=[{'all':!![]}];}return db[_0x882d('0x47')]['findAll'](_0x53a013);})[_0x882d('0x25')](function(_0x118670){_0x38b693['rows']=_0x118670;return _0x38b693;})['then'](respondWithFilteredResult(_0x393d29,_0x53a013))[_0x882d('0x4a')](handleError(_0x393d29,null));};exports[_0x882d('0x4b')]=function(_0x5087e3,_0x255187){var _0x2ef265={'raw':![],'where':{'id':_0x5087e3[_0x882d('0x4c')]['id']}},_0x1281bc={};_0x1281bc[_0x882d('0x3a')]=_[_0x882d('0x4d')](db[_0x882d('0x47')][_0x882d('0x35')]);_0x1281bc['query']=_['keys'](_0x5087e3[_0x882d('0x38')]);_0x1281bc['filters']=_['intersection'](_0x1281bc['model'],_0x1281bc[_0x882d('0x38')]);_0x2ef265[_0x882d('0x3b')]=_[_0x882d('0x39')](_0x1281bc['model'],qs['fields'](_0x5087e3['query'][_0x882d('0x3c')]));_0x2ef265['attributes']=_0x2ef265['attributes']['length']?_0x2ef265[_0x882d('0x3b')]:_0x1281bc[_0x882d('0x3a')];if(_0x5087e3[_0x882d('0x38')][_0x882d('0x48')]){_0x2ef265[_0x882d('0x49')]=[{'all':!![]}];}_0x2ef265=_[_0x882d('0x44')]({},_0x2ef265,_0x5087e3[_0x882d('0x46')]);return db[_0x882d('0x47')][_0x882d('0x30')](_0x2ef265)[_0x882d('0x25')](handleEntityNotFound(_0x255187,null))['then'](respondWithResult(_0x255187,null))['catch'](handleError(_0x255187,null));};exports['destroy']=function(_0x3dc6f2,_0x3a82c2){return db['VoiceExtension']['find']({'where':{'id':_0x3dc6f2['params']['id']}})[_0x882d('0x25')](handleEntityNotFound(_0x3a82c2,null))[_0x882d('0x25')](removeEntity(_0x3a82c2,null))['catch'](handleError(_0x3a82c2,null));};exports[_0x882d('0x4e')]=function(_0x54552f,_0x1573fb){if(_0x54552f[_0x882d('0x4f')][_0x882d('0x2f')]===_0x882d('0x50')&&!_['startsWith'](_0x54552f[_0x882d('0x4f')][_0x882d('0x51')],'_')){_0x54552f['body'][_0x882d('0x51')]='_'[_0x882d('0x52')](_0x54552f[_0x882d('0x4f')][_0x882d('0x51')]);}return db[_0x882d('0x47')][_0x882d('0x4e')](_0x54552f[_0x882d('0x4f')],{'raw':![]})[_0x882d('0x25')](function(_0x1b8596){var _0x33ad21=_0x54552f[_0x882d('0x53')][_0x882d('0x27')]({'plain':!![]});if(!_0x33ad21)throw new Error(_0x882d('0x54'));if(_0x33ad21[_0x882d('0x55')]===_0x882d('0x53')){var _0x4503a6=_0x1b8596[_0x882d('0x27')]({'plain':!![]});var _0x1c3e46=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x882d('0x29'),'value':_0x882d('0x50')},{'name':_0x882d('0x2a'),'value':_0x882d('0x56')}];var _0x3dab1f=_['find'](_0x1c3e46,[_0x882d('0x2d'),_0x4503a6[_0x882d('0x2f')]])[_0x882d('0x31')];return db[_0x882d('0x57')][_0x882d('0x30')]({'where':{'name':_0x3dab1f,'userProfileId':_0x33ad21['userProfileId']},'raw':!![]})[_0x882d('0x25')](function(_0x58ee8a){if(_0x58ee8a&&_0x58ee8a[_0x882d('0x58')]===0x0){return db[_0x882d('0x32')][_0x882d('0x4e')]({'name':_0x4503a6['name'],'resourceId':_0x4503a6['id'],'type':_0x58ee8a[_0x882d('0x31')],'sectionId':_0x58ee8a['id']},{})[_0x882d('0x25')](function(){return _0x1b8596;});}else{return _0x1b8596;}})['catch'](function(_0x190c9b){logger['error'](_0x882d('0x59'),_0x190c9b);throw _0x190c9b;});}return _0x1b8596;})['then'](respondWithResult(_0x1573fb,0xc9))['catch'](handleError(_0x1573fb,null));};exports[_0x882d('0x5a')]=function(_0x4f1427,_0x1f7610){if(_0x4f1427[_0x882d('0x4f')]['id']){delete _0x4f1427[_0x882d('0x4f')]['id'];}return db[_0x882d('0x47')][_0x882d('0x30')]({'where':{'id':_0x4f1427['params']['id']}})[_0x882d('0x25')](handleEntityNotFound(_0x1f7610,null))['then'](function(_0x521e80){if(_0x521e80){return db[_0x882d('0x47')]['update'](_[_0x882d('0x43')](_0x4f1427['body'],[_0x882d('0x51'),_0x882d('0x5b'),_0x882d('0x5c'),'recordingFormat','cutdigits',_0x882d('0x5d'),'alias']),{'where':{'context':_0x521e80[_0x882d('0x5b')],'exten':_0x521e80[_0x882d('0x51')]},'individualHooks':!![]})[_0x882d('0x25')](function(_0x5c8938){return _0x5c8938;});}return null;})[_0x882d('0x25')](respondWithStatusCode(_0x1f7610,null))[_0x882d('0x4a')](handleError(_0x1f7610,null));};exports[_0x882d('0x5e')]=function(_0x270515,_0x1a1faf){return db[_0x882d('0x47')][_0x882d('0x5f')]({'where':{'id':_0x270515['params']['id']}})[_0x882d('0x25')](function(_0x5edd7c){if(_0x5edd7c){return db[_0x882d('0x60')][_0x882d('0x61')](function(_0x521763){return db['VoiceExtension'][_0x882d('0x26')]({'where':{'VoiceExtensionId':_0x270515['params']['id']},'transaction':_0x521763})[_0x882d('0x25')](function(){var _0x11151e=_[_0x882d('0x37')](_0x270515[_0x882d('0x4f')],function(_0xd1f1f4){_0xd1f1f4['VoiceExtensionId']=_0x270515[_0x882d('0x4c')]['id'];_0xd1f1f4['isApp']=!![];return _0xd1f1f4;});var _0x32ba3d=_0x270515[_0x882d('0x38')][_0x882d('0x62')]&&_0x270515[_0x882d('0x38')][_0x882d('0x62')][_0x882d('0x63')]()===_0x882d('0x64')?!![]:![];return _0x5edd7c['createRouting'](_0x11151e,_0x32ba3d);})['then'](function(_0x79ca41){return db[_0x882d('0x47')][_0x882d('0x65')](_0x79ca41,{'transaction':_0x521763});});})[_0x882d('0x25')](function(){return db[_0x882d('0x47')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x270515[_0x882d('0x4c')]['id']},'order':_0x882d('0x66')});});}})[_0x882d('0x25')](respondWithResult(_0x1a1faf,null))[_0x882d('0x4a')](handleError(_0x1a1faf,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 680e684..bda8f27 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 _0xd2f0=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x2519d7,_0x13c5ef){var _0x579eda=function(_0x14a8b2){while(--_0x14a8b2){_0x2519d7['push'](_0x2519d7['shift']());}};_0x579eda(++_0x13c5ef);}(_0xd2f0,0x110));var _0x0d2f=function(_0x480046,_0x367404){_0x480046=_0x480046-0x0;var _0x1acb2c=_0xd2f0[_0x480046];return _0x1acb2c;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x0d2f('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x0d2f('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d2f('0x2'),'afterDestroy':_0x0d2f('0x3')};function emitEvent(_0x541f93){return function(_0x5475c3,_0x2ef846,_0x540662){VoiceExtensionEvents[_0x0d2f('0x4')](_0x541f93+':'+_0x5475c3['id'],_0x5475c3);VoiceExtensionEvents[_0x0d2f('0x4')](_0x541f93,_0x5475c3);_0x540662(null);};}for(var e in events){if(events[_0x0d2f('0x5')](e)){var event=events[e];VoiceExtension[_0x0d2f('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x1b50=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','VoiceExtension'];(function(_0x1e0ca5,_0x57fd4f){var _0x410923=function(_0x5bd94d){while(--_0x5bd94d){_0x1e0ca5['push'](_0x1e0ca5['shift']());}};_0x410923(++_0x57fd4f);}(_0x1b50,0x6a));var _0x01b5=function(_0x10fc08,_0x47aa05){_0x10fc08=_0x10fc08-0x0;var _0x3f6a1a=_0x1b50[_0x10fc08];return _0x3f6a1a;};'use strict';var EventEmitter=require(_0x01b5('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x01b5('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x01b5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x01b5('0x3'),'afterDestroy':_0x01b5('0x4')};function emitEvent(_0x3007d9){return function(_0x210cdf,_0x363b65,_0x5d4145){VoiceExtensionEvents[_0x01b5('0x5')](_0x3007d9+':'+_0x210cdf['id'],_0x210cdf);VoiceExtensionEvents['emit'](_0x3007d9,_0x210cdf);_0x5d4145(null);};}for(var e in events){if(events[_0x01b5('0x6')](e)){var event=events[e];VoiceExtension[_0x01b5('0x7')](e,emitEvent(event));}}module[_0x01b5('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 a6c7810..6c33391 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 _0xc4a9=['U(xcally-mixmonitor-context)','replace','isEmpty','Interval','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','appType','ExecIf','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','priority','last','define','VoiceExtension','voice_extensions','then','Hangup','util','lodash','./voiceExtension.attributes','exports','CDR(type)=','type','context','exten','alias','Set','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','length','name','param','phone','prefix','SIP','join','indexOf'];(function(_0x2c1026,_0x44620b){var _0x1020c9=function(_0x24ada0){while(--_0x24ada0){_0x2c1026['push'](_0x2c1026['shift']());}};_0x1020c9(++_0x44620b);}(_0xc4a9,0x11e));var _0x9c4a=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xc4a9[_0x1f9f37];return _0x21c080;};'use strict';var util=require(_0x9c4a('0x0'));var _=require(_0x9c4a('0x1'));var attributes=require(_0x9c4a('0x2'));module[_0x9c4a('0x3')]=function(_0x4ad319){var _0xcfe3e0=_0x4ad319['models'];function _0xdbd418(_0x11219a){var _0x519cee=0x2;var _0x4c3cab=[{'type':_0x11219a['type'],'app':'Set','appdata':_0x9c4a('0x4')+_0x11219a[_0x9c4a('0x5')],'context':_0x11219a[_0x9c4a('0x6')],'exten':_0x11219a[_0x9c4a('0x7')],'priority':_0x519cee++,'VoiceExtensionId':_0x11219a['id']},{'type':_0x11219a[_0x9c4a('0x5')],'app':_0x11219a[_0x9c4a('0x8')]?_0x9c4a('0x9'):_0x9c4a('0xa'),'appdata':_0x11219a[_0x9c4a('0x8')]?_0x9c4a('0xb')+_0x11219a[_0x9c4a('0x8')]:_0x9c4a('0xc'),'context':_0x11219a['context'],'exten':_0x11219a['exten'],'priority':_0x519cee++,'VoiceExtensionId':_0x11219a['id']}];if(_0x11219a[_0x9c4a('0x5')]===_0x9c4a('0xd')){_0x4c3cab[_0x9c4a('0xe')]({'type':_0x9c4a('0xd'),'app':_0x9c4a('0x9'),'appdata':_0x9c4a('0xf')+_0x11219a['id'],'context':_0x11219a['context'],'exten':_0x11219a[_0x9c4a('0x7')],'priority':_0x519cee++,'VoiceExtensionId':_0x11219a['id']});}_0x4c3cab[_0x9c4a('0xe')]({'type':_0x11219a[_0x9c4a('0x5')],'app':_0x9c4a('0x9'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x11219a['context'],'exten':_0x11219a[_0x9c4a('0x7')],'priority':_0x519cee++,'VoiceExtensionId':_0x11219a['id']},{'type':_0x11219a[_0x9c4a('0x5')],'app':_0x9c4a('0x9'),'appdata':_0x9c4a('0x10'),'context':_0x11219a[_0x9c4a('0x6')],'exten':_0x11219a['exten'],'priority':_0x519cee++,'VoiceExtensionId':_0x11219a['id']},{'type':_0x11219a['type'],'app':_0x9c4a('0x9'),'appdata':_0x9c4a('0x11'),'context':_0x11219a[_0x9c4a('0x6')],'exten':_0x11219a['exten'],'priority':_0x519cee++,'VoiceExtensionId':_0x11219a['id']});return _0x4c3cab;}function _0x428d9f(_0x4a30a6){var _0x5a635a=0x2;var _0xb631c7=[{'type':_0x9c4a('0x12'),'app':'Set','appdata':_0x9c4a('0x13'),'context':_0x4a30a6[_0x9c4a('0x6')],'exten':_0x4a30a6[_0x9c4a('0x7')],'priority':_0x5a635a++,'VoiceExtensionId':_0x4a30a6['id']},{'type':_0x9c4a('0x12'),'app':_0x4a30a6[_0x9c4a('0x8')]?_0x9c4a('0x9'):'NoOp','appdata':_0x4a30a6['alias']?_0x9c4a('0xb')+_0x4a30a6['alias']:_0x9c4a('0xc'),'context':_0x4a30a6[_0x9c4a('0x6')],'exten':_0x4a30a6[_0x9c4a('0x7')],'priority':_0x5a635a++,'VoiceExtensionId':_0x4a30a6['id']},{'type':_0x9c4a('0x12'),'app':_0x9c4a('0x9'),'appdata':_0x9c4a('0x14')+(_0x4a30a6['cutdigits']?_0x9c4a('0x15')+_0x4a30a6[_0x9c4a('0x16')]+'}':_0x9c4a('0x17')),'context':_0x4a30a6[_0x9c4a('0x6')],'exten':_0x4a30a6['exten'],'priority':_0x5a635a++,'VoiceExtensionId':_0x4a30a6['id']},{'type':_0x9c4a('0x12'),'app':_0x9c4a('0x9'),'appdata':_0x9c4a('0xf')+_0x4a30a6['id'],'context':_0x4a30a6[_0x9c4a('0x6')],'exten':_0x4a30a6[_0x9c4a('0x7')],'priority':_0x5a635a++,'VoiceExtensionId':_0x4a30a6['id']},{'type':_0x9c4a('0x12'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5a635a+0x2)+_0x9c4a('0x18')+(_0x5a635a+0x1)+')','context':_0x4a30a6[_0x9c4a('0x6')],'exten':_0x4a30a6[_0x9c4a('0x7')],'priority':_0x5a635a++,'VoiceExtensionId':_0x4a30a6['id']},{'type':'outbound','app':'Set','appdata':_0x4a30a6[_0x9c4a('0x16')]?'CDR(prefix)=${EXTEN:0:'+_0x4a30a6['cutdigits']+'}':_0x9c4a('0x19'),'context':_0x4a30a6[_0x9c4a('0x6')],'exten':_0x4a30a6[_0x9c4a('0x7')],'priority':_0x5a635a++,'VoiceExtensionId':_0x4a30a6['id']},{'type':_0x9c4a('0x12'),'app':_0x9c4a('0x9'),'appdata':_0x9c4a('0x1a'),'context':_0x4a30a6[_0x9c4a('0x6')],'exten':_0x4a30a6[_0x9c4a('0x7')],'priority':_0x5a635a++,'VoiceExtensionId':_0x4a30a6['id']},{'type':_0x9c4a('0x12'),'app':'Set','appdata':_0x9c4a('0x10'),'context':_0x4a30a6['context'],'exten':_0x4a30a6[_0x9c4a('0x7')],'priority':_0x5a635a++,'VoiceExtensionId':_0x4a30a6['id']},{'type':_0x9c4a('0x12'),'app':_0x9c4a('0x9'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4a30a6[_0x9c4a('0x6')],'exten':_0x4a30a6[_0x9c4a('0x7')],'priority':_0x5a635a++,'VoiceExtensionId':_0x4a30a6['id']},{'type':'outbound','app':_0x9c4a('0x9'),'appdata':_0x9c4a('0x1b')+_0x4a30a6['id'],'context':_0x4a30a6[_0x9c4a('0x6')],'exten':_0x4a30a6[_0x9c4a('0x7')],'priority':_0x5a635a++,'VoiceExtensionId':_0x4a30a6['id']}];if(_0x4a30a6[_0x9c4a('0x1c')](_0x9c4a('0x1d'))&&_0x4a30a6[_0x9c4a('0x1d')]!==_0x9c4a('0x1e')){_0xb631c7['push']({'type':_0x9c4a('0x12'),'app':_0x9c4a('0x9'),'appdata':_0x9c4a('0x1f'),'context':_0x4a30a6[_0x9c4a('0x6')],'exten':_0x4a30a6[_0x9c4a('0x7')],'priority':_0x5a635a++,'VoiceExtensionId':_0x4a30a6['id']},{'type':'outbound','app':_0x9c4a('0x9'),'appdata':_0x9c4a('0x20')+_0x4a30a6[_0x9c4a('0x1d')]||_0x9c4a('0x21'),'context':_0x4a30a6[_0x9c4a('0x6')],'exten':_0x4a30a6[_0x9c4a('0x7')],'priority':_0x5a635a++,'VoiceExtensionId':_0x4a30a6['id']});}return _0xb631c7;}function _0x2e838f(_0x27563a){var _0x10c6fc=[{'name':_0x9c4a('0x22'),'param':0x0},{'name':_0x9c4a('0x23'),'param':0x1},{'name':_0x9c4a('0x24'),'param':0x2},{'name':'url','param':0x3}];var _0x5ef157={};var _0x38346a=_0x27563a[_0x9c4a('0x25')](',');var _0x125e26=[];for(var _0x2470db=0x0;_0x2470db<_0x10c6fc[_0x9c4a('0x26')];_0x2470db++){switch(_0x10c6fc[_0x2470db][_0x9c4a('0x27')]){case'trunk':_0x5ef157[_0x9c4a('0x22')]=_0x38346a[_0x10c6fc[_0x2470db][_0x9c4a('0x28')]][_0x9c4a('0x25')]('/')[0x1];_0x5ef157[_0x9c4a('0x29')]=_0x38346a[_0x10c6fc[_0x2470db]['param']]['split']('/')[0x2];_0x5ef157[_0x9c4a('0x2a')]=_0x5ef157[_0x9c4a('0x29')]?_0x5ef157[_0x9c4a('0x29')][_0x9c4a('0x25')]('$')[0x0]:undefined;_0x5ef157[_0x9c4a('0x29')]=route[_0x9c4a('0x16')]?(_0x5ef157[_0x9c4a('0x2a')]||'')+'${EXTEN:'+route[_0x9c4a('0x16')]+'}':(_0x5ef157[_0x9c4a('0x2a')]||'')+_0x9c4a('0x17');_0x125e26[_0x10c6fc[_0x2470db][_0x9c4a('0x28')]]=[_0x9c4a('0x2b'),_0x5ef157[_0x9c4a('0x22')],_0x5ef157[_0x9c4a('0x29')]][_0x9c4a('0x2c')]('/');break;case _0x9c4a('0x24'):_0x5ef157[_0x9c4a('0x24')]=_0x38346a[_0x10c6fc[_0x2470db][_0x9c4a('0x28')]];if(route['recordingFormat']!==_0x9c4a('0x1e')){if(_0x5ef157[_0x9c4a('0x24')][_0x9c4a('0x2d')](_0x9c4a('0x2e'))<0x0){_0x5ef157[_0x9c4a('0x24')]+=_0x9c4a('0x2e');}}else{_0x5ef157[_0x9c4a('0x24')]=_0x5ef157[_0x9c4a('0x24')][_0x9c4a('0x2f')]('U(xcally-mixmonitor-context)','');}_0x125e26[_0x10c6fc[_0x2470db][_0x9c4a('0x28')]]=_0x5ef157[_0x9c4a('0x24')];break;default:_0x125e26[_0x10c6fc[_0x2470db][_0x9c4a('0x28')]]=_0x38346a[_0x10c6fc[_0x2470db]['param']];}}return _0x125e26[_0x9c4a('0x2c')](',');}function _0x15c68b(_0x5b6454,_0x56af27,_0x42c0c2,_0x2fb13e){return new Promise(function(_0x1b1662,_0x5f51ad){var _0x1d5ea7=[];if(_[_0x9c4a('0x30')](_0x56af27))return _0x1b1662(_0x1d5ea7);_0xcfe3e0[_0x9c4a('0x31')]['findAll']({'attributes':['id',_0x9c4a('0x32'),_0x9c4a('0x33')],'raw':!![]})['then'](function(_0x59651a){for(var _0x15aae6=0x0,_0x4911cd=0x0;_0x15aae6<_0x56af27[_0x9c4a('0x26')];_0x15aae6++,_0x4911cd=0x0){var _0x218dbc=_0x56af27[_0x15aae6];var _0x3c2877=[];var _0x442947=[];if(_0x218dbc['interval']!==_0x9c4a('0x34')){_0x218dbc[_0x9c4a('0x35')]=[_0x218dbc[_0x9c4a('0x32')]];}else{_0x218dbc[_0x9c4a('0x35')]=_0x218dbc[_0x9c4a('0x33')]?_[_0x9c4a('0x36')](_[_0x9c4a('0x37')](_0x59651a,{'IntervalId':_0x218dbc[_0x9c4a('0x33')]}),_0x9c4a('0x32')):[];}_0x218dbc[_0x9c4a('0x6')]=_0x5b6454[_0x9c4a('0x6')];_0x218dbc[_0x9c4a('0x7')]=_0x5b6454[_0x9c4a('0x7')];if(_0x218dbc['type'])_0x218dbc[_0x9c4a('0x5')]=_0x218dbc[_0x9c4a('0x5')][_0x9c4a('0x38')]();if(_0x5b6454[_0x9c4a('0x5')]===_0x9c4a('0x12')){if(_0x218dbc[_0x9c4a('0x1c')](_0x9c4a('0x39'))&&_0x218dbc[_0x9c4a('0x39')]&&_0x218dbc[_0x9c4a('0x39')]!=='--'){_0x3c2877[_0x9c4a('0xe')]({'type':_0x218dbc[_0x9c4a('0x5')][_0x9c4a('0x38')](),'app':_0x9c4a('0x9'),'appdata':_0x9c4a('0x3a')+_0x218dbc[_0x9c4a('0x39')],'context':_0x5b6454[_0x9c4a('0x6')],'exten':_0x5b6454[_0x9c4a('0x7')],'priority':_0x218dbc[_0x9c4a('0x35')][_0x9c4a('0x26')]+_0x42c0c2+_0x4911cd++,'VoiceExtensionId':_0x5b6454['id']});}_0x3c2877[_0x9c4a('0xe')]({'type':_0x218dbc['type']['toLowerCase'](),'app':'ExecIf','appdata':_0x9c4a('0x3b')+(_0x218dbc[_0x9c4a('0x3c')]?'Set(CALLERID(all)='+_0x218dbc[_0x9c4a('0x3c')]+')':_0x9c4a('0x3d')),'context':_0x5b6454[_0x9c4a('0x6')],'exten':_0x5b6454[_0x9c4a('0x7')],'priority':_0x218dbc['intervals'][_0x9c4a('0x26')]+_0x42c0c2+_0x4911cd++,'VoiceExtensionId':_0x5b6454['id']});}else{if(_0x218dbc['hasOwnProperty'](_0x9c4a('0x3e'))){if([_0x9c4a('0x3f'),_0x9c4a('0x40')][_0x9c4a('0x41')](_0x218dbc['app'][_0x9c4a('0x38')]())&&_0x218dbc[_0x9c4a('0x42')]!=='custom'){if(_0x218dbc[_0x9c4a('0x3e')]){_0x3c2877[_0x9c4a('0xe')]({'type':_0x218dbc[_0x9c4a('0x5')][_0x9c4a('0x38')](),'app':_0x9c4a('0x43'),'appdata':_0x9c4a('0x44'),'context':_0x5b6454[_0x9c4a('0x6')],'exten':_0x5b6454[_0x9c4a('0x7')],'priority':_0x218dbc[_0x9c4a('0x35')][_0x9c4a('0x26')]+_0x42c0c2+_0x4911cd++,'VoiceExtensionId':_0x5b6454['id']});_0x3c2877[_0x9c4a('0xe')]({'type':_0x218dbc[_0x9c4a('0x5')][_0x9c4a('0x38')](),'app':_0x9c4a('0x9'),'appdata':_0x9c4a('0x45'),'context':_0x5b6454['context'],'exten':_0x5b6454[_0x9c4a('0x7')],'priority':_0x218dbc[_0x9c4a('0x35')]['length']+_0x42c0c2+_0x4911cd++,'VoiceExtensionId':_0x5b6454['id']});}else{_0x3c2877[_0x9c4a('0xe')]({'type':_0x218dbc[_0x9c4a('0x5')]['toLowerCase'](),'app':_0x9c4a('0x43'),'appdata':_0x9c4a('0x46'),'context':_0x5b6454[_0x9c4a('0x6')],'exten':_0x5b6454['exten'],'priority':_0x218dbc[_0x9c4a('0x35')]['length']+_0x42c0c2+_0x4911cd++,'VoiceExtensionId':_0x5b6454['id']});_0x3c2877[_0x9c4a('0xe')]({'type':_0x218dbc[_0x9c4a('0x5')][_0x9c4a('0x38')](),'app':_0x9c4a('0x9'),'appdata':_0x9c4a('0x47'),'context':_0x5b6454[_0x9c4a('0x6')],'exten':_0x5b6454[_0x9c4a('0x7')],'priority':_0x218dbc[_0x9c4a('0x35')][_0x9c4a('0x26')]+_0x42c0c2+_0x4911cd++,'VoiceExtensionId':_0x5b6454['id']});}}}}for(var _0x450c6f=0x0;_0x450c6f<_0x218dbc[_0x9c4a('0x35')]['length'];_0x450c6f++){var _0x348d01=_0x42c0c2+_0x218dbc[_0x9c4a('0x35')][_0x9c4a('0x26')];var _0x5c339a=_0x450c6f===_0x218dbc[_0x9c4a('0x35')]['length']-0x1?_0x42c0c2+_0x3c2877[_0x9c4a('0x26')]+_0x442947['length']+0x2:_0x42c0c2+_0x450c6f+0x1;_0x3c2877[_0x9c4a('0x48')](_0x450c6f,0x0,{'type':_0x5b6454[_0x9c4a('0x5')],'app':_0x9c4a('0x49'),'appdata':_0x218dbc[_0x9c4a('0x35')][_0x450c6f]+'?'+_0x5b6454[_0x9c4a('0x6')]+_0x9c4a('0x4a')+_0x348d01+':'+_0x5b6454['context']+_0x9c4a('0x4a')+_0x5c339a,'exten':_0x5b6454['exten'],'context':_0x5b6454[_0x9c4a('0x6')],'priority':_0x42c0c2+_0x450c6f,'VoiceExtensionId':_0x5b6454['id']});}if(_0x2fb13e&&_0x218dbc['appType']===_0x9c4a('0x4b'))_0x218dbc['appdata']=_0x2e838f(_0x218dbc['appdata']);_0x218dbc[_0x9c4a('0x4c')]=_0x3c2877[_0x9c4a('0x26')]?_[_0x9c4a('0x4d')](_0x3c2877)['priority']+0x1:_0x42c0c2;_0x1d5ea7=_['concat'](_0x1d5ea7,_0x3c2877,[_0x218dbc],_0x442947);_0x42c0c2=_['last'](_0x1d5ea7)[_0x9c4a('0x4c')]+0x1;}return _0x1b1662(_0x1d5ea7);})['catch'](function(_0x53287b){_0x5f51ad(_0x53287b);});});}return _0x4ad319[_0x9c4a('0x4e')](_0x9c4a('0x4f'),attributes,{'tableName':_0x9c4a('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5d80a3,_0x557891){var _0x1f6bb1=this;var _0x17bdf0=_0x1f6bb1[_0x9c4a('0x5')]==='outbound'?_0x428d9f(_0x1f6bb1):_0xdbd418(_0x1f6bb1);return _0x15c68b(_0x1f6bb1,_0x5d80a3,_[_0x9c4a('0x4d')](_0x17bdf0)[_0x9c4a('0x4c')]+0x1,_0x557891)[_0x9c4a('0x51')](function(_0x1b61a6){var _0x527675=_['concat'](_0x17bdf0,_0x1b61a6);_0x527675[_0x9c4a('0xe')]({'type':_0x1f6bb1[_0x9c4a('0x5')],'app':_0x9c4a('0x52'),'exten':_0x1f6bb1['exten'],'context':_0x1f6bb1[_0x9c4a('0x6')],'priority':_[_0x9c4a('0x4d')](_0x527675)[_0x9c4a('0x4c')]+0x1,'VoiceExtensionId':_0x1f6bb1['id']});return _0x527675;});}}});}; \ No newline at end of file +var _0x939a=['priority','last','define','VoiceExtension','Hangup','util','lodash','./voiceExtension.attributes','models','type','Set','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','timeout','options','url','split','name','trunk','param','phone','prefix','${EXTEN:','indexOf','U(xcally-mixmonitor-context)','join','isEmpty','Interval','findAll','interval','then','length','*,*,*,*','intervals','IntervalId','map','filter','tag','toLowerCase','callerID','NoOp(No\x20number\x20available)','answer','playback','includes','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata'];(function(_0x497d84,_0x4fad8d){var _0x28b334=function(_0xf9fa69){while(--_0xf9fa69){_0x497d84['push'](_0x497d84['shift']());}};_0x28b334(++_0x4fad8d);}(_0x939a,0xe3));var _0xa939=function(_0x515b08,_0x5ba9e1){_0x515b08=_0x515b08-0x0;var _0x5e661f=_0x939a[_0x515b08];return _0x5e661f;};'use strict';var util=require(_0xa939('0x0'));var _=require(_0xa939('0x1'));var attributes=require(_0xa939('0x2'));module['exports']=function(_0x251789){var _0x4fbf0c=_0x251789[_0xa939('0x3')];function _0x36a582(_0x37620c){var _0x1285cc=0x2;var _0x5a7df7=[{'type':_0x37620c[_0xa939('0x4')],'app':_0xa939('0x5'),'appdata':_0xa939('0x6')+_0x37620c[_0xa939('0x4')],'context':_0x37620c[_0xa939('0x7')],'exten':_0x37620c[_0xa939('0x8')],'priority':_0x1285cc++,'VoiceExtensionId':_0x37620c['id']},{'type':_0x37620c[_0xa939('0x4')],'app':_0x37620c[_0xa939('0x9')]?_0xa939('0x5'):_0xa939('0xa'),'appdata':_0x37620c['alias']?_0xa939('0xb')+_0x37620c['alias']:_0xa939('0xc'),'context':_0x37620c[_0xa939('0x7')],'exten':_0x37620c[_0xa939('0x8')],'priority':_0x1285cc++,'VoiceExtensionId':_0x37620c['id']}];if(_0x37620c[_0xa939('0x4')]===_0xa939('0xd')){_0x5a7df7[_0xa939('0xe')]({'type':_0xa939('0xd'),'app':_0xa939('0x5'),'appdata':'CDR(routeid)='+_0x37620c['id'],'context':_0x37620c[_0xa939('0x7')],'exten':_0x37620c[_0xa939('0x8')],'priority':_0x1285cc++,'VoiceExtensionId':_0x37620c['id']});}_0x5a7df7[_0xa939('0xe')]({'type':_0x37620c[_0xa939('0x4')],'app':_0xa939('0x5'),'appdata':_0xa939('0xf'),'context':_0x37620c['context'],'exten':_0x37620c['exten'],'priority':_0x1285cc++,'VoiceExtensionId':_0x37620c['id']},{'type':_0x37620c[_0xa939('0x4')],'app':'Set','appdata':_0xa939('0x10'),'context':_0x37620c[_0xa939('0x7')],'exten':_0x37620c[_0xa939('0x8')],'priority':_0x1285cc++,'VoiceExtensionId':_0x37620c['id']},{'type':_0x37620c[_0xa939('0x4')],'app':'Set','appdata':_0xa939('0x11'),'context':_0x37620c[_0xa939('0x7')],'exten':_0x37620c[_0xa939('0x8')],'priority':_0x1285cc++,'VoiceExtensionId':_0x37620c['id']});return _0x5a7df7;}function _0x32c5b8(_0x999c68){var _0x4c81e2=0x2;var _0xfb48e1=[{'type':_0xa939('0x12'),'app':_0xa939('0x5'),'appdata':_0xa939('0x13'),'context':_0x999c68[_0xa939('0x7')],'exten':_0x999c68[_0xa939('0x8')],'priority':_0x4c81e2++,'VoiceExtensionId':_0x999c68['id']},{'type':_0xa939('0x12'),'app':_0x999c68[_0xa939('0x9')]?_0xa939('0x5'):_0xa939('0xa'),'appdata':_0x999c68['alias']?_0xa939('0xb')+_0x999c68[_0xa939('0x9')]:'No\x20alias\x20set','context':_0x999c68[_0xa939('0x7')],'exten':_0x999c68['exten'],'priority':_0x4c81e2++,'VoiceExtensionId':_0x999c68['id']},{'type':'outbound','app':_0xa939('0x5'),'appdata':_0xa939('0x14')+(_0x999c68[_0xa939('0x15')]?'${EXTEN:'+_0x999c68[_0xa939('0x15')]+'}':_0xa939('0x16')),'context':_0x999c68[_0xa939('0x7')],'exten':_0x999c68[_0xa939('0x8')],'priority':_0x4c81e2++,'VoiceExtensionId':_0x999c68['id']},{'type':_0xa939('0x12'),'app':'Set','appdata':_0xa939('0x17')+_0x999c68['id'],'context':_0x999c68[_0xa939('0x7')],'exten':_0x999c68[_0xa939('0x8')],'priority':_0x4c81e2++,'VoiceExtensionId':_0x999c68['id']},{'type':_0xa939('0x12'),'app':_0xa939('0x18'),'appdata':_0xa939('0x19')+(_0x4c81e2+0x2)+_0xa939('0x1a')+(_0x4c81e2+0x1)+')','context':_0x999c68[_0xa939('0x7')],'exten':_0x999c68[_0xa939('0x8')],'priority':_0x4c81e2++,'VoiceExtensionId':_0x999c68['id']},{'type':_0xa939('0x12'),'app':'Set','appdata':_0x999c68[_0xa939('0x15')]?'CDR(prefix)=${EXTEN:0:'+_0x999c68[_0xa939('0x15')]+'}':_0xa939('0x1b'),'context':_0x999c68[_0xa939('0x7')],'exten':_0x999c68[_0xa939('0x8')],'priority':_0x4c81e2++,'VoiceExtensionId':_0x999c68['id']},{'type':'outbound','app':_0xa939('0x5'),'appdata':_0xa939('0xf'),'context':_0x999c68[_0xa939('0x7')],'exten':_0x999c68[_0xa939('0x8')],'priority':_0x4c81e2++,'VoiceExtensionId':_0x999c68['id']},{'type':_0xa939('0x12'),'app':_0xa939('0x5'),'appdata':_0xa939('0x10'),'context':_0x999c68[_0xa939('0x7')],'exten':_0x999c68[_0xa939('0x8')],'priority':_0x4c81e2++,'VoiceExtensionId':_0x999c68['id']},{'type':_0xa939('0x12'),'app':_0xa939('0x5'),'appdata':_0xa939('0x11'),'context':_0x999c68['context'],'exten':_0x999c68[_0xa939('0x8')],'priority':_0x4c81e2++,'VoiceExtensionId':_0x999c68['id']},{'type':_0xa939('0x12'),'app':_0xa939('0x5'),'appdata':'outboundrouteid='+_0x999c68['id'],'context':_0x999c68['context'],'exten':_0x999c68[_0xa939('0x8')],'priority':_0x4c81e2++,'VoiceExtensionId':_0x999c68['id']}];if(_0x999c68[_0xa939('0x1c')](_0xa939('0x1d'))&&_0x999c68['recordingFormat']!=='none'){_0xfb48e1[_0xa939('0xe')]({'type':_0xa939('0x12'),'app':_0xa939('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x999c68[_0xa939('0x7')],'exten':_0x999c68['exten'],'priority':_0x4c81e2++,'VoiceExtensionId':_0x999c68['id']},{'type':_0xa939('0x12'),'app':_0xa939('0x5'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x999c68[_0xa939('0x1d')]||'wav','context':_0x999c68[_0xa939('0x7')],'exten':_0x999c68[_0xa939('0x8')],'priority':_0x4c81e2++,'VoiceExtensionId':_0x999c68['id']});}return _0xfb48e1;}function _0x4c570c(_0x5b773b){var _0x24545e=[{'name':'trunk','param':0x0},{'name':_0xa939('0x1e'),'param':0x1},{'name':_0xa939('0x1f'),'param':0x2},{'name':_0xa939('0x20'),'param':0x3}];var _0x5e2f84={};var _0x256fb8=_0x5b773b[_0xa939('0x21')](',');var _0x4b74d7=[];for(var _0x2ae62e=0x0;_0x2ae62e<_0x24545e['length'];_0x2ae62e++){switch(_0x24545e[_0x2ae62e][_0xa939('0x22')]){case _0xa939('0x23'):_0x5e2f84[_0xa939('0x23')]=_0x256fb8[_0x24545e[_0x2ae62e][_0xa939('0x24')]][_0xa939('0x21')]('/')[0x1];_0x5e2f84[_0xa939('0x25')]=_0x256fb8[_0x24545e[_0x2ae62e]['param']][_0xa939('0x21')]('/')[0x2];_0x5e2f84[_0xa939('0x26')]=_0x5e2f84[_0xa939('0x25')]?_0x5e2f84['phone'][_0xa939('0x21')]('$')[0x0]:undefined;_0x5e2f84['phone']=route[_0xa939('0x15')]?(_0x5e2f84[_0xa939('0x26')]||'')+_0xa939('0x27')+route[_0xa939('0x15')]+'}':(_0x5e2f84[_0xa939('0x26')]||'')+_0xa939('0x16');_0x4b74d7[_0x24545e[_0x2ae62e][_0xa939('0x24')]]=['SIP',_0x5e2f84[_0xa939('0x23')],_0x5e2f84[_0xa939('0x25')]]['join']('/');break;case'options':_0x5e2f84[_0xa939('0x1f')]=_0x256fb8[_0x24545e[_0x2ae62e][_0xa939('0x24')]];if(route[_0xa939('0x1d')]!=='none'){if(_0x5e2f84[_0xa939('0x1f')][_0xa939('0x28')](_0xa939('0x29'))<0x0){_0x5e2f84[_0xa939('0x1f')]+=_0xa939('0x29');}}else{_0x5e2f84['options']=_0x5e2f84[_0xa939('0x1f')]['replace']('U(xcally-mixmonitor-context)','');}_0x4b74d7[_0x24545e[_0x2ae62e][_0xa939('0x24')]]=_0x5e2f84[_0xa939('0x1f')];break;default:_0x4b74d7[_0x24545e[_0x2ae62e][_0xa939('0x24')]]=_0x256fb8[_0x24545e[_0x2ae62e][_0xa939('0x24')]];}}return _0x4b74d7[_0xa939('0x2a')](',');}function _0x13bb44(_0x54b94a,_0x17ad4d,_0xd79ac7,_0x4dfc99){return new Promise(function(_0xbfac83,_0x2edc44){var _0x5f4574=[];if(_[_0xa939('0x2b')](_0x17ad4d))return _0xbfac83(_0x5f4574);_0x4fbf0c[_0xa939('0x2c')][_0xa939('0x2d')]({'attributes':['id',_0xa939('0x2e'),'IntervalId'],'raw':!![]})[_0xa939('0x2f')](function(_0x15c88c){for(var _0x2ded25=0x0,_0x1ed0fd=0x0;_0x2ded25<_0x17ad4d[_0xa939('0x30')];_0x2ded25++,_0x1ed0fd=0x0){var _0x59b4e8=_0x17ad4d[_0x2ded25];var _0x158220=[];var _0x1cccf1=[];if(_0x59b4e8['interval']!==_0xa939('0x31')){_0x59b4e8[_0xa939('0x32')]=[_0x59b4e8[_0xa939('0x2e')]];}else{_0x59b4e8[_0xa939('0x32')]=_0x59b4e8[_0xa939('0x33')]?_[_0xa939('0x34')](_[_0xa939('0x35')](_0x15c88c,{'IntervalId':_0x59b4e8['IntervalId']}),_0xa939('0x2e')):[];}_0x59b4e8[_0xa939('0x7')]=_0x54b94a[_0xa939('0x7')];_0x59b4e8[_0xa939('0x8')]=_0x54b94a['exten'];if(_0x59b4e8[_0xa939('0x4')])_0x59b4e8[_0xa939('0x4')]=_0x59b4e8[_0xa939('0x4')]['toLowerCase']();if(_0x54b94a['type']===_0xa939('0x12')){if(_0x59b4e8[_0xa939('0x1c')](_0xa939('0x36'))&&_0x59b4e8[_0xa939('0x36')]&&_0x59b4e8[_0xa939('0x36')]!=='--'){_0x158220[_0xa939('0xe')]({'type':_0x59b4e8['type']['toLowerCase'](),'app':_0xa939('0x5'),'appdata':'CDR(tag)='+_0x59b4e8['tag'],'context':_0x54b94a[_0xa939('0x7')],'exten':_0x54b94a[_0xa939('0x8')],'priority':_0x59b4e8['intervals'][_0xa939('0x30')]+_0xd79ac7+_0x1ed0fd++,'VoiceExtensionId':_0x54b94a['id']});}_0x158220[_0xa939('0xe')]({'type':_0x59b4e8[_0xa939('0x4')][_0xa939('0x37')](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x59b4e8['callerID']?'Set(CALLERID(all)='+_0x59b4e8[_0xa939('0x38')]+')':_0xa939('0x39')),'context':_0x54b94a[_0xa939('0x7')],'exten':_0x54b94a['exten'],'priority':_0x59b4e8[_0xa939('0x32')][_0xa939('0x30')]+_0xd79ac7+_0x1ed0fd++,'VoiceExtensionId':_0x54b94a['id']});}else{if(_0x59b4e8[_0xa939('0x1c')](_0xa939('0x3a'))){if(['queue',_0xa939('0x3b')][_0xa939('0x3c')](_0x59b4e8[_0xa939('0x3d')][_0xa939('0x37')]())&&_0x59b4e8['appType']!=='custom'){if(_0x59b4e8[_0xa939('0x3a')]){_0x158220['push']({'type':_0x59b4e8['type']['toLowerCase'](),'app':_0xa939('0x18'),'appdata':_0xa939('0x3e'),'context':_0x54b94a[_0xa939('0x7')],'exten':_0x54b94a['exten'],'priority':_0x59b4e8[_0xa939('0x32')][_0xa939('0x30')]+_0xd79ac7+_0x1ed0fd++,'VoiceExtensionId':_0x54b94a['id']});_0x158220[_0xa939('0xe')]({'type':_0x59b4e8[_0xa939('0x4')][_0xa939('0x37')](),'app':'Set','appdata':_0xa939('0x3f'),'context':_0x54b94a[_0xa939('0x7')],'exten':_0x54b94a[_0xa939('0x8')],'priority':_0x59b4e8[_0xa939('0x32')][_0xa939('0x30')]+_0xd79ac7+_0x1ed0fd++,'VoiceExtensionId':_0x54b94a['id']});}else{_0x158220['push']({'type':_0x59b4e8['type'][_0xa939('0x37')](),'app':_0xa939('0x18'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x54b94a['context'],'exten':_0x54b94a[_0xa939('0x8')],'priority':_0x59b4e8[_0xa939('0x32')][_0xa939('0x30')]+_0xd79ac7+_0x1ed0fd++,'VoiceExtensionId':_0x54b94a['id']});_0x158220[_0xa939('0xe')]({'type':_0x59b4e8[_0xa939('0x4')][_0xa939('0x37')](),'app':'Set','appdata':_0xa939('0x40'),'context':_0x54b94a[_0xa939('0x7')],'exten':_0x54b94a['exten'],'priority':_0x59b4e8[_0xa939('0x32')][_0xa939('0x30')]+_0xd79ac7+_0x1ed0fd++,'VoiceExtensionId':_0x54b94a['id']});}}}}for(var _0x3d9656=0x0;_0x3d9656<_0x59b4e8[_0xa939('0x32')][_0xa939('0x30')];_0x3d9656++){var _0x45ab44=_0xd79ac7+_0x59b4e8['intervals'][_0xa939('0x30')];var _0x5ac29b=_0x3d9656===_0x59b4e8['intervals'][_0xa939('0x30')]-0x1?_0xd79ac7+_0x158220[_0xa939('0x30')]+_0x1cccf1['length']+0x2:_0xd79ac7+_0x3d9656+0x1;_0x158220['splice'](_0x3d9656,0x0,{'type':_0x54b94a[_0xa939('0x4')],'app':_0xa939('0x41'),'appdata':_0x59b4e8[_0xa939('0x32')][_0x3d9656]+'?'+_0x54b94a[_0xa939('0x7')]+',${EXTEN},'+_0x45ab44+':'+_0x54b94a[_0xa939('0x7')]+_0xa939('0x42')+_0x5ac29b,'exten':_0x54b94a['exten'],'context':_0x54b94a[_0xa939('0x7')],'priority':_0xd79ac7+_0x3d9656,'VoiceExtensionId':_0x54b94a['id']});}if(_0x4dfc99&&_0x59b4e8['appType']===_0xa939('0x43'))_0x59b4e8[_0xa939('0x44')]=_0x4c570c(_0x59b4e8[_0xa939('0x44')]);_0x59b4e8[_0xa939('0x45')]=_0x158220[_0xa939('0x30')]?_[_0xa939('0x46')](_0x158220)['priority']+0x1:_0xd79ac7;_0x5f4574=_['concat'](_0x5f4574,_0x158220,[_0x59b4e8],_0x1cccf1);_0xd79ac7=_['last'](_0x5f4574)[_0xa939('0x45')]+0x1;}return _0xbfac83(_0x5f4574);})['catch'](function(_0x53a7e3){_0x2edc44(_0x53a7e3);});});}return _0x251789[_0xa939('0x47')](_0xa939('0x48'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5ca133,_0x53222a){var _0x599e8b=this;var _0x511e00=_0x599e8b[_0xa939('0x4')]==='outbound'?_0x32c5b8(_0x599e8b):_0x36a582(_0x599e8b);return _0x13bb44(_0x599e8b,_0x5ca133,_[_0xa939('0x46')](_0x511e00)[_0xa939('0x45')]+0x1,_0x53222a)[_0xa939('0x2f')](function(_0x516eec){var _0x201127=_['concat'](_0x511e00,_0x516eec);_0x201127[_0xa939('0xe')]({'type':_0x599e8b['type'],'app':_0xa939('0x49'),'exten':_0x599e8b[_0xa939('0x8')],'context':_0x599e8b[_0xa939('0x7')],'priority':_[_0xa939('0x46')](_0x201127)[_0xa939('0x45')]+0x1,'VoiceExtensionId':_0x599e8b['id']});return _0x201127;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index bd27643..e90be3b 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 _0x02ca=['options','raw','attributes','include','map','model','GetVoiceExtension','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','findAll'];(function(_0x360ea5,_0x4460b4){var _0x2358d2=function(_0x3c216d){while(--_0x3c216d){_0x360ea5['push'](_0x360ea5['shift']());}};_0x2358d2(++_0x4460b4);}(_0x02ca,0x97));var _0xa02c=function(_0x126e86,_0x30db99){_0x126e86=_0x126e86-0x0;var _0x10b35c=_0x02ca[_0x126e86];return _0x10b35c;};'use strict';var _=require(_0xa02c('0x0'));var util=require('util');var moment=require(_0xa02c('0x1'));var BPromise=require(_0xa02c('0x2'));var rs=require(_0xa02c('0x3'));var fs=require('fs');var Redis=require(_0xa02c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa02c('0x5'));var logger=require(_0xa02c('0x6'))(_0xa02c('0x7'));var config=require(_0xa02c('0x8'));var jayson=require(_0xa02c('0x9'));var client=jayson[_0xa02c('0xa')][_0xa02c('0xb')]({'port':0x232a});config[_0xa02c('0xc')]=_[_0xa02c('0xd')](config[_0xa02c('0xc')],{'host':_0xa02c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa02c('0xc')]));require(_0xa02c('0xf'))[_0xa02c('0x10')](socket);function respondWithRpcPromise(_0x30e1aa,_0x14ffc2,_0x565373){return new BPromise(function(_0x5c553f,_0x50df17){return client['request'](_0x30e1aa,_0x565373)[_0xa02c('0x11')](function(_0x14c96f){logger[_0xa02c('0x12')](_0xa02c('0x13'),_0x14ffc2,'request\x20sent');logger[_0xa02c('0x14')](_0xa02c('0x15'),_0x14ffc2,_0xa02c('0x16'),JSON[_0xa02c('0x17')](_0x14c96f));if(_0x14c96f['error']){if(_0x14c96f[_0xa02c('0x18')][_0xa02c('0x19')]===0x1f4){logger[_0xa02c('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x14ffc2,_0x14c96f[_0xa02c('0x18')][_0xa02c('0x1a')]);return _0x50df17(_0x14c96f['error'][_0xa02c('0x1a')]);}logger[_0xa02c('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x14ffc2,_0x14c96f[_0xa02c('0x18')][_0xa02c('0x1a')]);return _0x5c553f(_0x14c96f[_0xa02c('0x18')]['message']);}else{logger[_0xa02c('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x14ffc2,'request\x20sent');_0x5c553f(_0x14c96f['result'][_0xa02c('0x1a')]);}})[_0xa02c('0x1b')](function(_0x16ac46){logger['error'](_0xa02c('0x13'),_0x14ffc2,_0x16ac46);_0x50df17(_0x16ac46);});});}exports['GetVoiceExtension']=function(_0x3311d2){var _0x12ff75=this;return new Promise(function(_0x38c479,_0x476777){return db['VoiceExtension'][_0xa02c('0x1c')]({'raw':_0x3311d2['options']?_0x3311d2[_0xa02c('0x1d')][_0xa02c('0x1e')]===undefined?!![]:![]:!![],'where':_0x3311d2[_0xa02c('0x1d')]?_0x3311d2['options']['where']||null:null,'attributes':_0x3311d2['options']?_0x3311d2[_0xa02c('0x1d')][_0xa02c('0x1f')]||null:null,'limit':_0x3311d2[_0xa02c('0x1d')]?_0x3311d2['options']['limit']||null:null,'include':_0x3311d2[_0xa02c('0x1d')]?_0x3311d2[_0xa02c('0x1d')][_0xa02c('0x20')]?_[_0xa02c('0x21')](_0x3311d2[_0xa02c('0x1d')]['include'],function(_0x4de358){return{'model':db[_0x4de358[_0xa02c('0x22')]],'as':_0x4de358['as'],'attributes':_0x4de358[_0xa02c('0x1f')],'include':_0x4de358[_0xa02c('0x20')]?_[_0xa02c('0x21')](_0x4de358[_0xa02c('0x20')],function(_0x3f4e0d){return{'model':db[_0x3f4e0d[_0xa02c('0x22')]],'as':_0x3f4e0d['as'],'attributes':_0x3f4e0d[_0xa02c('0x1f')],'include':_0x3f4e0d['include']?_[_0xa02c('0x21')](_0x3f4e0d[_0xa02c('0x20')],function(_0x31b520){return{'model':db[_0x31b520[_0xa02c('0x22')]],'as':_0x31b520['as'],'attributes':_0x31b520[_0xa02c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa02c('0x11')](function(_0x19f1c9){logger[_0xa02c('0x12')](_0xa02c('0x23'),_0x3311d2);logger['debug'](_0xa02c('0x23'),_0x3311d2,JSON[_0xa02c('0x17')](_0x19f1c9));_0x38c479(_0x19f1c9);})[_0xa02c('0x1b')](function(_0x4de1ac){logger['error'](_0xa02c('0x23'),_0x4de1ac[_0xa02c('0x1a')],_0x3311d2);_0x476777(_0x12ff75[_0xa02c('0x18')](0x1f4,_0x4de1ac[_0xa02c('0x1a')]));});});}; \ No newline at end of file +var _0x31af=['lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','limit','map','include','model','attributes'];(function(_0x34a47b,_0x109857){var _0x3bd3d7=function(_0x30e79a){while(--_0x30e79a){_0x34a47b['push'](_0x34a47b['shift']());}};_0x3bd3d7(++_0x109857);}(_0x31af,0xde));var _0xf31a=function(_0x5ba4eb,_0x2af89f){_0x5ba4eb=_0x5ba4eb-0x0;var _0x2c5bbc=_0x31af[_0x5ba4eb];return _0x2c5bbc;};'use strict';var _=require(_0xf31a('0x0'));var util=require(_0xf31a('0x1'));var moment=require(_0xf31a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf31a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf31a('0x4'));var logger=require(_0xf31a('0x5'))(_0xf31a('0x6'));var config=require(_0xf31a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf31a('0x8')][_0xf31a('0x9')]({'port':0x232a});config[_0xf31a('0xa')]=_[_0xf31a('0xb')](config['redis'],{'host':_0xf31a('0xc'),'port':0x18eb});var socket=require(_0xf31a('0xd'))(new Redis(config[_0xf31a('0xa')]));require(_0xf31a('0xe'))['register'](socket);function respondWithRpcPromise(_0x1c56e9,_0x138d52,_0xcff55c){return new BPromise(function(_0x1ceac2,_0xf2e284){return client['request'](_0x1c56e9,_0xcff55c)[_0xf31a('0xf')](function(_0x1e31d3){logger[_0xf31a('0x10')](_0xf31a('0x11'),_0x138d52,'request\x20sent');logger[_0xf31a('0x12')](_0xf31a('0x13'),_0x138d52,'request\x20sent',JSON[_0xf31a('0x14')](_0x1e31d3));if(_0x1e31d3[_0xf31a('0x15')]){if(_0x1e31d3[_0xf31a('0x15')][_0xf31a('0x16')]===0x1f4){logger[_0xf31a('0x15')](_0xf31a('0x11'),_0x138d52,_0x1e31d3[_0xf31a('0x15')][_0xf31a('0x17')]);return _0xf2e284(_0x1e31d3[_0xf31a('0x15')][_0xf31a('0x17')]);}logger[_0xf31a('0x15')](_0xf31a('0x11'),_0x138d52,_0x1e31d3[_0xf31a('0x15')][_0xf31a('0x17')]);return _0x1ceac2(_0x1e31d3[_0xf31a('0x15')]['message']);}else{logger[_0xf31a('0x10')](_0xf31a('0x11'),_0x138d52,_0xf31a('0x18'));_0x1ceac2(_0x1e31d3[_0xf31a('0x19')]['message']);}})[_0xf31a('0x1a')](function(_0x15f6a9){logger[_0xf31a('0x15')](_0xf31a('0x11'),_0x138d52,_0x15f6a9);_0xf2e284(_0x15f6a9);});});}exports[_0xf31a('0x1b')]=function(_0x516672){var _0xcd2148=this;return new Promise(function(_0xd3ac94,_0x5861df){return db[_0xf31a('0x1c')][_0xf31a('0x1d')]({'raw':_0x516672['options']?_0x516672[_0xf31a('0x1e')][_0xf31a('0x1f')]===undefined?!![]:![]:!![],'where':_0x516672['options']?_0x516672['options']['where']||null:null,'attributes':_0x516672[_0xf31a('0x1e')]?_0x516672[_0xf31a('0x1e')]['attributes']||null:null,'limit':_0x516672[_0xf31a('0x1e')]?_0x516672[_0xf31a('0x1e')][_0xf31a('0x20')]||null:null,'include':_0x516672[_0xf31a('0x1e')]?_0x516672['options']['include']?_[_0xf31a('0x21')](_0x516672[_0xf31a('0x1e')]['include'],function(_0x4e115c){return{'model':db[_0x4e115c['model']],'as':_0x4e115c['as'],'attributes':_0x4e115c['attributes'],'include':_0x4e115c[_0xf31a('0x22')]?_[_0xf31a('0x21')](_0x4e115c[_0xf31a('0x22')],function(_0x595db6){return{'model':db[_0x595db6[_0xf31a('0x23')]],'as':_0x595db6['as'],'attributes':_0x595db6[_0xf31a('0x24')],'include':_0x595db6[_0xf31a('0x22')]?_[_0xf31a('0x21')](_0x595db6[_0xf31a('0x22')],function(_0x5a55c6){return{'model':db[_0x5a55c6[_0xf31a('0x23')]],'as':_0x5a55c6['as'],'attributes':_0x5a55c6[_0xf31a('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x52da7d){logger[_0xf31a('0x10')](_0xf31a('0x1b'),_0x516672);logger['debug'](_0xf31a('0x1b'),_0x516672,JSON[_0xf31a('0x14')](_0x52da7d));_0xd3ac94(_0x52da7d);})[_0xf31a('0x1a')](function(_0x5385ba){logger[_0xf31a('0x15')](_0xf31a('0x1b'),_0x5385ba[_0xf31a('0x17')],_0x516672);_0x5861df(_0xcd2148[_0xf31a('0x15')](0x1f4,_0x5385ba[_0xf31a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 0996d48..1b58f08 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 _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x48815e,_0x696159){var _0x364774=function(_0x2bd48d){while(--_0x2bd48d){_0x48815e['push'](_0x48815e['shift']());}};_0x364774(++_0x696159);}(_0x4975,0x86));var _0x5497=function(_0x2859d6,_0x2a3cc0){_0x2859d6=_0x2859d6-0x0;var _0x2a3d03=_0x4975[_0x2859d6];return _0x2a3d03;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file +var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x331e57,_0x7732de){var _0x4ec9c3=function(_0x5bcffc){while(--_0x5bcffc){_0x331e57['push'](_0x331e57['shift']());}};_0x4ec9c3(++_0x7732de);}(_0x4975,0x86));var _0x5497=function(_0x3c7fe9,_0x462794){_0x3c7fe9=_0x3c7fe9-0x0;var _0x4ea569=_0x4975[_0x3c7fe9];return _0x4ea569;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 738c7f7..140c670 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 _0x1261=['isAuthenticated','show','/:id/messages','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','index','get'];(function(_0x4b1710,_0x3dfd28){var _0x2de752=function(_0x3d7723){while(--_0x3d7723){_0x4b1710['push'](_0x4b1710['shift']());}};_0x2de752(++_0x3dfd28);}(_0x1261,0x144));var _0x1126=function(_0x3fd50c,_0x1b41ed){_0x3fd50c=_0x3fd50c-0x0;var _0x4cebb2=_0x1261[_0x3fd50c];return _0x4cebb2;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['getMessages']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0x687b=['../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','getMessages','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x4f3008,_0x2ea90e){var _0x3b1cc1=function(_0x8838bb){while(--_0x8838bb){_0x4f3008['push'](_0x4f3008['shift']());}};_0x3b1cc1(++_0x2ea90e);}(_0x687b,0x14a));var _0xb687=function(_0x44dcf0,_0x1402cd){_0x44dcf0=_0x44dcf0-0x0;var _0x206867=_0x687b[_0x44dcf0];return _0x206867;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb687('0x4'));var auth=require(_0xb687('0x5'));var interaction=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var controller=require(_0xb687('0x8'));router[_0xb687('0x9')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0x9')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0x9')]('/:id/messages',auth[_0xb687('0xa')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0x10')]);router[_0xb687('0x11')](_0xb687('0xc'),auth[_0xb687('0xa')](),controller[_0xb687('0x12')]);router['delete'](_0xb687('0xc'),auth[_0xb687('0xa')](),controller[_0xb687('0x13')]);module[_0xb687('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index d9bf1da..5ffe399 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 _0x8e3f=['contest_mailbox','email','string','trim','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail'];(function(_0x57bab9,_0x4aeae7){var _0x159668=function(_0x30f7e4){while(--_0x30f7e4){_0x57bab9['push'](_0x57bab9['shift']());}};_0x159668(++_0x4aeae7);}(_0x8e3f,0x96));var _0xf8e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8e3f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0xf8e3('0x0')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf8e3('0x1')],'defaultValue':_0xf8e3('0x2'),'unique':_0xf8e3('0x3')},'mailbox':{'type':Sequelize[_0xf8e3('0x1')],'defaultValue':'','allowNull':![],'unique':_0xf8e3('0x3')},'password':{'type':Sequelize[_0xf8e3('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x454124){this['setDataValue'](_0xf8e3('0x4'),typeof _0x454124===_0xf8e3('0x5')&&_0x454124[_0xf8e3('0x6')]()?_0x454124[_0xf8e3('0x6')]():null);}},'pager':{'type':Sequelize[_0xf8e3('0x1')]},'tz':{'type':Sequelize[_0xf8e3('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0xf8e3('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xf8e3('0x7'),'allowNull':![]},'dialout':{'type':Sequelize[_0xf8e3('0x1')]},'callback':{'type':Sequelize[_0xf8e3('0x1')]},'review':{'type':Sequelize[_0xf8e3('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xf8e3('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf8e3('0x8')](_0xf8e3('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf8e3('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf8e3('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf8e3('0x8')](_0xf8e3('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xf8e3('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xf8e3('0x8')](_0xf8e3('0x7'),'no'),'defaultValue':_0xf8e3('0x7'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xf8e3('0x8')](_0xf8e3('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf8e3('0x8')](_0xf8e3('0x7'),'no'),'defaultValue':_0xf8e3('0x7'),'allowNull':![]},'stamp':{'type':_0xf8e3('0xa')},'emailsubject':{'type':Sequelize[_0xf8e3('0x1')]},'emailbody':{'type':Sequelize[_0xf8e3('0x1')]},'maxsecs':{'type':Sequelize[_0xf8e3('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf8e3('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf8e3('0xc')],'get':function(){return this[_0xf8e3('0xd')](_0xf8e3('0xe'))+_0xf8e3('0xf')+this[_0xf8e3('0xd')](_0xf8e3('0x10'));}}}; \ No newline at end of file +var _0x1d2a=['sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','fullname','\x20-\x20','getDataValue','mailbox'];(function(_0x5ea7fe,_0x42befa){var _0x37a348=function(_0x12231b){while(--_0x12231b){_0x5ea7fe['push'](_0x5ea7fe['shift']());}};_0x37a348(++_0x42befa);}(_0x1d2a,0xb4));var _0xa1d2=function(_0x53ba10,_0x30787c){_0x53ba10=_0x53ba10-0x0;var _0x144b55=_0x1d2a[_0x53ba10];return _0x144b55;};'use strict';var Sequelize=require(_0xa1d2('0x0'));module[_0xa1d2('0x1')]={'customer_id':{'type':Sequelize[_0xa1d2('0x2')]},'context':{'type':Sequelize[_0xa1d2('0x2')],'defaultValue':_0xa1d2('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xa1d2('0x2')],'defaultValue':'','allowNull':![],'unique':_0xa1d2('0x4')},'password':{'type':Sequelize[_0xa1d2('0x2')]},'fullname':{'type':Sequelize[_0xa1d2('0x2')]},'email':{'type':Sequelize[_0xa1d2('0x2')],'validate':{'isEmail':!![]},'set':function(_0x56bc93){this[_0xa1d2('0x5')](_0xa1d2('0x6'),typeof _0x56bc93==='string'&&_0x56bc93[_0xa1d2('0x7')]()?_0x56bc93[_0xa1d2('0x7')]():null);}},'pager':{'type':Sequelize[_0xa1d2('0x2')]},'tz':{'type':Sequelize[_0xa1d2('0x2')],'defaultValue':_0xa1d2('0x8')},'attach':{'type':Sequelize[_0xa1d2('0x9')](_0xa1d2('0xa'),'no'),'defaultValue':_0xa1d2('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xa1d2('0x9')](_0xa1d2('0xa'),'no'),'defaultValue':_0xa1d2('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xa1d2('0x2')]},'callback':{'type':Sequelize[_0xa1d2('0x2')]},'review':{'type':Sequelize['ENUM'](_0xa1d2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xa1d2('0x9')](_0xa1d2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xa1d2('0x9')](_0xa1d2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xa1d2('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xa1d2('0x9')](_0xa1d2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xa1d2('0xa'),'no'),'defaultValue':_0xa1d2('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xa1d2('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xa1d2('0x9')](_0xa1d2('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xa1d2('0x9')](_0xa1d2('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xa1d2('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xa1d2('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xa1d2('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xa1d2('0xe'))+_0xa1d2('0xf')+this[_0xa1d2('0x10')](_0xa1d2('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 27942ed..95e0b29 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 _0x58a4=['catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','pick','mailbox','VoiceMailMessage','findAndCountAll','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','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x297add,_0x2a3b3a){var _0x347f28=function(_0x230f57){while(--_0x230f57){_0x297add['push'](_0x297add['shift']());}};_0x347f28(++_0x2a3b3a);}(_0x58a4,0xbf));var _0x458a=function(_0xd63b06,_0x34850f){_0xd63b06=_0xd63b06-0x0;var _0x343035=_0x58a4[_0xd63b06];return _0x343035;};'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'];function respondWithStatusCode(_0xee09c6,_0x2a4934){_0x2a4934=_0x2a4934||0xcc;return function(_0x2e788b){if(_0x2e788b){return _0xee09c6['sendStatus'](_0x2a4934);}return _0xee09c6['status'](_0x2a4934)[_0x458a('0x1a')]();};}function respondWithResult(_0x56436f,_0x2c7528){_0x2c7528=_0x2c7528||0xc8;return function(_0x44f683){if(_0x44f683){return _0x56436f[_0x458a('0x1b')](_0x2c7528)[_0x458a('0x1c')](_0x44f683);}};}function respondWithFilteredResult(_0xad80f9,_0x29acee){return function(_0x507b0f){if(_0x507b0f){var _0x4b26be=typeof _0x29acee['offset']===_0x458a('0x1d')&&typeof _0x29acee[_0x458a('0x1e')]===_0x458a('0x1d');var _0x5c5b41=_0x507b0f[_0x458a('0x1f')];var _0x260c87=_0x4b26be?0x0:_0x29acee[_0x458a('0x20')];var _0x392986=_0x4b26be?_0x507b0f[_0x458a('0x1f')]:_0x29acee['offset']+_0x29acee['limit'];var _0x178db9;if(_0x392986>=_0x5c5b41){_0x392986=_0x5c5b41;_0x178db9=0xc8;}else{_0x178db9=0xce;}_0xad80f9['status'](_0x178db9);return _0xad80f9[_0x458a('0x21')](_0x458a('0x22'),_0x260c87+'-'+_0x392986+'/'+_0x5c5b41)['json'](_0x507b0f);}return null;};}function patchUpdates(_0x468416){return function(_0x55a588){try{jsonpatch[_0x458a('0x23')](_0x55a588,_0x468416,!![]);}catch(_0x1c79cb){return BPromise['reject'](_0x1c79cb);}return _0x55a588[_0x458a('0x24')]();};}function saveUpdates(_0xead884,_0x5a2bcb){return function(_0xa6b8ff){if(_0xa6b8ff){return _0xa6b8ff['update'](_0xead884)[_0x458a('0x25')](function(_0x5bca42){return _0x5bca42;});}return null;};}function removeEntity(_0x4080fc,_0x5dfc6c){return function(_0x36b08e){if(_0x36b08e){return _0x36b08e[_0x458a('0x26')]()[_0x458a('0x25')](function(){var _0xcda8cc=_0x36b08e[_0x458a('0x27')]({'plain':!![]});var _0x19bd5=_0x458a('0x28');return db[_0x458a('0x29')][_0x458a('0x26')]({'where':{'type':_0x19bd5,'resourceId':_0xcda8cc['id']}})[_0x458a('0x25')](function(){return _0x36b08e;});})[_0x458a('0x25')](function(){_0x4080fc[_0x458a('0x1b')](0xcc)[_0x458a('0x1a')]();});}};}function handleEntityNotFound(_0x5a55b7,_0xb94bd9){return function(_0x112fa6){if(!_0x112fa6){_0x5a55b7['sendStatus'](0x194);}return _0x112fa6;};}function handleError(_0x5df150,_0x41b23d){_0x41b23d=_0x41b23d||0x1f4;return function(_0x596fe2){logger[_0x458a('0x2a')](_0x596fe2[_0x458a('0x2b')]);if(_0x596fe2[_0x458a('0x2c')]){delete _0x596fe2['name'];}_0x5df150[_0x458a('0x1b')](_0x41b23d)[_0x458a('0x2d')](_0x596fe2);};}exports[_0x458a('0x2e')]=function(_0x562c36,_0x47e20d){var _0x18c890={},_0x4cf059={},_0x185f1c={'count':0x0,'rows':[]};var _0x56e0b9=_[_0x458a('0x2f')](db[_0x458a('0x30')]['rawAttributes'],function(_0x309a6a){return{'name':_0x309a6a[_0x458a('0x31')],'type':_0x309a6a[_0x458a('0x32')]['key']};});_0x4cf059[_0x458a('0x33')]=_[_0x458a('0x2f')](_0x56e0b9,_0x458a('0x2c'));_0x4cf059[_0x458a('0x34')]=_[_0x458a('0x35')](_0x562c36['query']);_0x4cf059[_0x458a('0x36')]=_[_0x458a('0x37')](_0x4cf059[_0x458a('0x33')],_0x4cf059[_0x458a('0x34')]);_0x18c890[_0x458a('0x38')]=_[_0x458a('0x37')](_0x4cf059['model'],qs[_0x458a('0x39')](_0x562c36[_0x458a('0x34')][_0x458a('0x39')]));_0x18c890[_0x458a('0x38')]=_0x18c890[_0x458a('0x38')][_0x458a('0x3a')]?_0x18c890[_0x458a('0x38')]:_0x4cf059[_0x458a('0x33')];if(!_0x562c36[_0x458a('0x34')]['hasOwnProperty'](_0x458a('0x3b'))){_0x18c890[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x562c36[_0x458a('0x34')][_0x458a('0x1e')]);_0x18c890[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x562c36[_0x458a('0x34')][_0x458a('0x20')]);}_0x18c890[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x562c36[_0x458a('0x34')][_0x458a('0x3d')]);_0x18c890[_0x458a('0x3e')]=qs[_0x458a('0x36')](_['pick'](_0x562c36[_0x458a('0x34')],_0x4cf059[_0x458a('0x36')]),_0x56e0b9);if(_0x562c36[_0x458a('0x34')][_0x458a('0x3f')]){_0x18c890[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x18c890[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x56e0b9,function(_0x41d125){if(_0x41d125[_0x458a('0x32')]!==_0x458a('0x41')){var _0x4efbeb={};_0x4efbeb[_0x41d125[_0x458a('0x2c')]]={'$like':'%'+_0x562c36[_0x458a('0x34')]['filter']+'%'};return _0x4efbeb;}})});}_0x18c890=_[_0x458a('0x40')]({},_0x18c890,_0x562c36[_0x458a('0x42')]);var _0x4286a3={'where':_0x18c890['where']};return db[_0x458a('0x30')][_0x458a('0x1f')](_0x4286a3)[_0x458a('0x25')](function(_0x1e51d2){_0x185f1c[_0x458a('0x1f')]=_0x1e51d2;if(_0x562c36[_0x458a('0x34')][_0x458a('0x43')]){_0x18c890[_0x458a('0x44')]=[{'all':!![]}];}return db['VoiceMail'][_0x458a('0x45')](_0x18c890);})[_0x458a('0x25')](function(_0x2b9030){_0x185f1c['rows']=_0x2b9030;return _0x185f1c;})[_0x458a('0x25')](respondWithFilteredResult(_0x47e20d,_0x18c890))[_0x458a('0x46')](handleError(_0x47e20d,null));};exports['show']=function(_0x598707,_0x124f64){var _0x2be08f={'raw':!![],'where':{'id':_0x598707[_0x458a('0x47')]['id']}},_0x36c391={};_0x36c391['model']=_['keys'](db[_0x458a('0x30')][_0x458a('0x48')]);_0x36c391[_0x458a('0x34')]=_[_0x458a('0x35')](_0x598707['query']);_0x36c391[_0x458a('0x36')]=_[_0x458a('0x37')](_0x36c391['model'],_0x36c391[_0x458a('0x34')]);_0x2be08f['attributes']=_[_0x458a('0x37')](_0x36c391[_0x458a('0x33')],qs[_0x458a('0x39')](_0x598707['query'][_0x458a('0x39')]));_0x2be08f[_0x458a('0x38')]=_0x2be08f[_0x458a('0x38')]['length']?_0x2be08f['attributes']:_0x36c391[_0x458a('0x33')];if(_0x598707[_0x458a('0x34')][_0x458a('0x43')]){_0x2be08f['include']=[{'all':!![]}];}_0x2be08f=_['merge']({},_0x2be08f,_0x598707[_0x458a('0x42')]);return db[_0x458a('0x30')][_0x458a('0x49')](_0x2be08f)[_0x458a('0x25')](handleEntityNotFound(_0x124f64,null))[_0x458a('0x25')](respondWithResult(_0x124f64,null))[_0x458a('0x46')](handleError(_0x124f64,null));};exports[_0x458a('0x4a')]=function(_0x30cdaf,_0xb22232){return db[_0x458a('0x30')][_0x458a('0x4a')](_0x30cdaf[_0x458a('0x4b')],{})[_0x458a('0x25')](function(_0x1b0c11){var _0x1ddc39=_0x30cdaf[_0x458a('0x4c')]['get']({'plain':!![]});if(!_0x1ddc39)throw new Error(_0x458a('0x4d'));if(_0x1ddc39[_0x458a('0x4e')]===_0x458a('0x4c')){var _0x396bb3=_0x1b0c11[_0x458a('0x27')]({'plain':!![]});var _0x5630cf='Voicemails';return db['UserProfileSection'][_0x458a('0x49')]({'where':{'name':_0x5630cf,'userProfileId':_0x1ddc39['userProfileId']},'raw':!![]})[_0x458a('0x25')](function(_0x58946){if(_0x58946&&_0x58946[_0x458a('0x4f')]===0x0){return db[_0x458a('0x29')][_0x458a('0x4a')]({'name':_0x396bb3['name'],'resourceId':_0x396bb3['id'],'type':_0x58946['name'],'sectionId':_0x58946['id']},{})[_0x458a('0x25')](function(){return _0x1b0c11;});}else{return _0x1b0c11;}})[_0x458a('0x46')](function(_0x2587a1){logger[_0x458a('0x2a')](_0x458a('0x50'),_0x2587a1);throw _0x2587a1;});}return _0x1b0c11;})['then'](respondWithResult(_0xb22232,0xc9))[_0x458a('0x46')](handleError(_0xb22232,null));};exports['update']=function(_0xa51e28,_0x5b428c){if(_0xa51e28[_0x458a('0x4b')]['id']){delete _0xa51e28['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0xa51e28[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x5b428c,null))['then'](saveUpdates(_0xa51e28[_0x458a('0x4b')],null))[_0x458a('0x25')](respondWithResult(_0x5b428c,null))[_0x458a('0x46')](handleError(_0x5b428c,null));};exports['destroy']=function(_0x2c1230,_0x212de5){return db[_0x458a('0x30')][_0x458a('0x49')]({'where':{'id':_0x2c1230[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x212de5,null))['then'](removeEntity(_0x212de5,null))[_0x458a('0x46')](handleError(_0x212de5,null));};exports[_0x458a('0x51')]=function(_0x45325f,_0x39e5b5,_0x3ab86a){return db[_0x458a('0x30')][_0x458a('0x52')]({'where':{'id':_0x45325f[_0x458a('0x47')]['id']}})['then'](handleEntityNotFound(_0x39e5b5,null))[_0x458a('0x25')](function(_0x4abe93){var _0x1f93ad;var _0x2921ba={},_0x222aa4={};_0x222aa4[_0x458a('0x33')]=_['keys'](db['VoiceMailMessage'][_0x458a('0x48')]);_0x222aa4[_0x458a('0x34')]=_[_0x458a('0x35')](_0x45325f[_0x458a('0x34')]);_0x222aa4[_0x458a('0x36')]=_[_0x458a('0x37')](_0x222aa4['model'],_0x222aa4[_0x458a('0x34')]);_0x2921ba[_0x458a('0x38')]=_['intersection'](_0x222aa4[_0x458a('0x33')],qs['fields'](_0x45325f[_0x458a('0x34')][_0x458a('0x39')]));_0x2921ba[_0x458a('0x38')]=_0x2921ba[_0x458a('0x38')][_0x458a('0x3a')]?_0x2921ba[_0x458a('0x38')]:_0x222aa4[_0x458a('0x33')];if(!_0x45325f[_0x458a('0x34')]['hasOwnProperty'](_0x458a('0x3b'))){_0x2921ba[_0x458a('0x1e')]=qs['limit'](_0x45325f[_0x458a('0x34')][_0x458a('0x1e')]);_0x2921ba['offset']=qs[_0x458a('0x20')](_0x45325f[_0x458a('0x34')]['offset']);}_0x2921ba[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x45325f['query'][_0x458a('0x3d')]);_0x2921ba[_0x458a('0x3e')]=qs[_0x458a('0x36')](_[_0x458a('0x53')](_0x45325f[_0x458a('0x34')],_0x222aa4[_0x458a('0x36')]));if(_0x45325f[_0x458a('0x34')][_0x458a('0x3f')]){_0x2921ba['where']=_[_0x458a('0x40')](_0x2921ba[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x2921ba[_0x458a('0x38')],function(_0x250238){var _0x2930ae={};_0x2930ae[_0x250238]={'$like':'%'+_0x45325f[_0x458a('0x34')][_0x458a('0x3f')]+'%'};return _0x2930ae;})});}_0x2921ba[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x2921ba['where'],{'mailboxuser':_0x4abe93[_0x458a('0x54')]});_0x2921ba=_['merge']({},_0x2921ba,_0x45325f[_0x458a('0x42')]);return db[_0x458a('0x55')][_0x458a('0x56')](_0x2921ba)[_0x458a('0x25')](respondWithFilteredResult(_0x39e5b5,_0x2921ba));})[_0x458a('0x46')](handleError(_0x39e5b5,null));}; \ No newline at end of file +var _0x97c1=['error','stack','name','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','getMessages','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Voicemails','sendStatus'];(function(_0x48d217,_0x595988){var _0x2bb0ec=function(_0x8f199d){while(--_0x8f199d){_0x48d217['push'](_0x48d217['shift']());}};_0x2bb0ec(++_0x595988);}(_0x97c1,0xdf));var _0x197c=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x97c1[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x197c('0x0'));var rimraf=require(_0x197c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x197c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x197c('0x3'));var Mustache=require(_0x197c('0x4'));var util=require(_0x197c('0x5'));var path=require(_0x197c('0x6'));var sox=require(_0x197c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x197c('0x8'));var _=require(_0x197c('0x9'));var squel=require(_0x197c('0xa'));var crypto=require(_0x197c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197c('0xc'));var querystring=require('querystring');var Papa=require(_0x197c('0xd'));var Redis=require(_0x197c('0xe'));var authService=require(_0x197c('0xf'));var qs=require(_0x197c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197c('0x11'));var logger=require(_0x197c('0x12'))(_0x197c('0x13'));var utils=require(_0x197c('0x14'));var config=require(_0x197c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197c('0x16'))['db'];function respondWithStatusCode(_0x668f8,_0x27e46f){_0x27e46f=_0x27e46f||0xcc;return function(_0x1adcfa){if(_0x1adcfa){return _0x668f8['sendStatus'](_0x27e46f);}return _0x668f8[_0x197c('0x17')](_0x27e46f)[_0x197c('0x18')]();};}function respondWithResult(_0x5a7e1c,_0xf735ce){_0xf735ce=_0xf735ce||0xc8;return function(_0x188ff2){if(_0x188ff2){return _0x5a7e1c[_0x197c('0x17')](_0xf735ce)['json'](_0x188ff2);}};}function respondWithFilteredResult(_0x5194c3,_0x422dfa){return function(_0x2bc612){if(_0x2bc612){var _0x2083d4=typeof _0x422dfa[_0x197c('0x19')]===_0x197c('0x1a')&&typeof _0x422dfa[_0x197c('0x1b')]===_0x197c('0x1a');var _0x75beba=_0x2bc612['count'];var _0x372311=_0x2083d4?0x0:_0x422dfa['offset'];var _0x50ac52=_0x2083d4?_0x2bc612[_0x197c('0x1c')]:_0x422dfa[_0x197c('0x19')]+_0x422dfa[_0x197c('0x1b')];var _0x2ce10d;if(_0x50ac52>=_0x75beba){_0x50ac52=_0x75beba;_0x2ce10d=0xc8;}else{_0x2ce10d=0xce;}_0x5194c3['status'](_0x2ce10d);return _0x5194c3[_0x197c('0x1d')](_0x197c('0x1e'),_0x372311+'-'+_0x50ac52+'/'+_0x75beba)[_0x197c('0x1f')](_0x2bc612);}return null;};}function patchUpdates(_0x5c278a){return function(_0x1adb43){try{jsonpatch[_0x197c('0x20')](_0x1adb43,_0x5c278a,!![]);}catch(_0x3b5c4c){return BPromise[_0x197c('0x21')](_0x3b5c4c);}return _0x1adb43[_0x197c('0x22')]();};}function saveUpdates(_0x3c2151,_0x362bbf){return function(_0x2092a0){if(_0x2092a0){return _0x2092a0[_0x197c('0x23')](_0x3c2151)[_0x197c('0x24')](function(_0x29b266){return _0x29b266;});}return null;};}function removeEntity(_0x177bc9,_0x174942){return function(_0x2a1310){if(_0x2a1310){return _0x2a1310[_0x197c('0x25')]()[_0x197c('0x24')](function(){var _0x5f4a02=_0x2a1310[_0x197c('0x26')]({'plain':!![]});var _0x2911dd=_0x197c('0x27');return db['UserProfileResource'][_0x197c('0x25')]({'where':{'type':_0x2911dd,'resourceId':_0x5f4a02['id']}})[_0x197c('0x24')](function(){return _0x2a1310;});})['then'](function(){_0x177bc9['status'](0xcc)[_0x197c('0x18')]();});}};}function handleEntityNotFound(_0x48f759,_0xfbca7a){return function(_0x14b0aa){if(!_0x14b0aa){_0x48f759[_0x197c('0x28')](0x194);}return _0x14b0aa;};}function handleError(_0x16e026,_0x2f031c){_0x2f031c=_0x2f031c||0x1f4;return function(_0x3cdcd8){logger[_0x197c('0x29')](_0x3cdcd8[_0x197c('0x2a')]);if(_0x3cdcd8[_0x197c('0x2b')]){delete _0x3cdcd8['name'];}_0x16e026['status'](_0x2f031c)['send'](_0x3cdcd8);};}exports['index']=function(_0x5f7425,_0x4c9256){var _0x252cde={},_0x35dbf3={},_0x58bc60={'count':0x0,'rows':[]};var _0x422ac6=_['map'](db[_0x197c('0x2c')][_0x197c('0x2d')],function(_0x2ace33){return{'name':_0x2ace33[_0x197c('0x2e')],'type':_0x2ace33[_0x197c('0x2f')][_0x197c('0x30')]};});_0x35dbf3[_0x197c('0x31')]=_[_0x197c('0x32')](_0x422ac6,_0x197c('0x2b'));_0x35dbf3['query']=_['keys'](_0x5f7425[_0x197c('0x33')]);_0x35dbf3[_0x197c('0x34')]=_[_0x197c('0x35')](_0x35dbf3[_0x197c('0x31')],_0x35dbf3[_0x197c('0x33')]);_0x252cde[_0x197c('0x36')]=_[_0x197c('0x35')](_0x35dbf3['model'],qs['fields'](_0x5f7425[_0x197c('0x33')][_0x197c('0x37')]));_0x252cde['attributes']=_0x252cde['attributes'][_0x197c('0x38')]?_0x252cde[_0x197c('0x36')]:_0x35dbf3[_0x197c('0x31')];if(!_0x5f7425[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x252cde[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x5f7425[_0x197c('0x33')]['limit']);_0x252cde[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x5f7425[_0x197c('0x33')][_0x197c('0x19')]);}_0x252cde[_0x197c('0x3b')]=qs[_0x197c('0x3c')](_0x5f7425['query'][_0x197c('0x3c')]);_0x252cde[_0x197c('0x3d')]=qs[_0x197c('0x34')](_['pick'](_0x5f7425[_0x197c('0x33')],_0x35dbf3[_0x197c('0x34')]),_0x422ac6);if(_0x5f7425[_0x197c('0x33')][_0x197c('0x3e')]){_0x252cde[_0x197c('0x3d')]=_[_0x197c('0x3f')](_0x252cde[_0x197c('0x3d')],{'$or':_[_0x197c('0x32')](_0x422ac6,function(_0x323a14){if(_0x323a14[_0x197c('0x2f')]!=='VIRTUAL'){var _0x2705f5={};_0x2705f5[_0x323a14[_0x197c('0x2b')]]={'$like':'%'+_0x5f7425['query']['filter']+'%'};return _0x2705f5;}})});}_0x252cde=_[_0x197c('0x3f')]({},_0x252cde,_0x5f7425[_0x197c('0x40')]);var _0x3517a6={'where':_0x252cde[_0x197c('0x3d')]};return db[_0x197c('0x2c')]['count'](_0x3517a6)[_0x197c('0x24')](function(_0x3efae){_0x58bc60[_0x197c('0x1c')]=_0x3efae;if(_0x5f7425[_0x197c('0x33')][_0x197c('0x41')]){_0x252cde['include']=[{'all':!![]}];}return db[_0x197c('0x2c')][_0x197c('0x42')](_0x252cde);})[_0x197c('0x24')](function(_0x197b27){_0x58bc60[_0x197c('0x43')]=_0x197b27;return _0x58bc60;})['then'](respondWithFilteredResult(_0x4c9256,_0x252cde))[_0x197c('0x44')](handleError(_0x4c9256,null));};exports[_0x197c('0x45')]=function(_0x3b7fc1,_0x35f36d){var _0x3e6d6e={'raw':!![],'where':{'id':_0x3b7fc1[_0x197c('0x46')]['id']}},_0x41eb51={};_0x41eb51[_0x197c('0x31')]=_[_0x197c('0x47')](db[_0x197c('0x2c')][_0x197c('0x2d')]);_0x41eb51['query']=_['keys'](_0x3b7fc1['query']);_0x41eb51['filters']=_[_0x197c('0x35')](_0x41eb51[_0x197c('0x31')],_0x41eb51['query']);_0x3e6d6e[_0x197c('0x36')]=_[_0x197c('0x35')](_0x41eb51['model'],qs[_0x197c('0x37')](_0x3b7fc1[_0x197c('0x33')]['fields']));_0x3e6d6e[_0x197c('0x36')]=_0x3e6d6e[_0x197c('0x36')]['length']?_0x3e6d6e[_0x197c('0x36')]:_0x41eb51[_0x197c('0x31')];if(_0x3b7fc1[_0x197c('0x33')]['includeAll']){_0x3e6d6e[_0x197c('0x48')]=[{'all':!![]}];}_0x3e6d6e=_[_0x197c('0x3f')]({},_0x3e6d6e,_0x3b7fc1[_0x197c('0x40')]);return db[_0x197c('0x2c')]['find'](_0x3e6d6e)[_0x197c('0x24')](handleEntityNotFound(_0x35f36d,null))[_0x197c('0x24')](respondWithResult(_0x35f36d,null))[_0x197c('0x44')](handleError(_0x35f36d,null));};exports['create']=function(_0x5994bf,_0x3a5089){return db[_0x197c('0x2c')][_0x197c('0x49')](_0x5994bf[_0x197c('0x4a')],{})[_0x197c('0x24')](function(_0x28fac4){var _0x4c82d5=_0x5994bf[_0x197c('0x4b')]['get']({'plain':!![]});if(!_0x4c82d5)throw new Error(_0x197c('0x4c'));if(_0x4c82d5[_0x197c('0x4d')]===_0x197c('0x4b')){var _0x9e8c6a=_0x28fac4[_0x197c('0x26')]({'plain':!![]});var _0x2ab21f=_0x197c('0x27');return db[_0x197c('0x4e')]['find']({'where':{'name':_0x2ab21f,'userProfileId':_0x4c82d5[_0x197c('0x4f')]},'raw':!![]})[_0x197c('0x24')](function(_0x43e9b7){if(_0x43e9b7&&_0x43e9b7['autoAssociation']===0x0){return db[_0x197c('0x50')]['create']({'name':_0x9e8c6a[_0x197c('0x2b')],'resourceId':_0x9e8c6a['id'],'type':_0x43e9b7[_0x197c('0x2b')],'sectionId':_0x43e9b7['id']},{})[_0x197c('0x24')](function(){return _0x28fac4;});}else{return _0x28fac4;}})[_0x197c('0x44')](function(_0x1d7cdd){logger[_0x197c('0x29')](_0x197c('0x51'),_0x1d7cdd);throw _0x1d7cdd;});}return _0x28fac4;})[_0x197c('0x24')](respondWithResult(_0x3a5089,0xc9))['catch'](handleError(_0x3a5089,null));};exports[_0x197c('0x23')]=function(_0x3a9261,_0x275294){if(_0x3a9261['body']['id']){delete _0x3a9261[_0x197c('0x4a')]['id'];}return db[_0x197c('0x2c')][_0x197c('0x52')]({'where':{'id':_0x3a9261[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x275294,null))['then'](saveUpdates(_0x3a9261['body'],null))[_0x197c('0x24')](respondWithResult(_0x275294,null))[_0x197c('0x44')](handleError(_0x275294,null));};exports[_0x197c('0x25')]=function(_0x42a13f,_0x15e50f){return db['VoiceMail']['find']({'where':{'id':_0x42a13f[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x15e50f,null))['then'](removeEntity(_0x15e50f,null))[_0x197c('0x44')](handleError(_0x15e50f,null));};exports[_0x197c('0x53')]=function(_0x1a607c,_0x40867c,_0xc10419){return db[_0x197c('0x2c')]['findOne']({'where':{'id':_0x1a607c[_0x197c('0x46')]['id']}})[_0x197c('0x24')](handleEntityNotFound(_0x40867c,null))['then'](function(_0x480cab){var _0x1b71cf;var _0x5a70dd={},_0xfc9461={};_0xfc9461[_0x197c('0x31')]=_[_0x197c('0x47')](db['VoiceMailMessage'][_0x197c('0x2d')]);_0xfc9461[_0x197c('0x33')]=_['keys'](_0x1a607c[_0x197c('0x33')]);_0xfc9461[_0x197c('0x34')]=_[_0x197c('0x35')](_0xfc9461['model'],_0xfc9461[_0x197c('0x33')]);_0x5a70dd[_0x197c('0x36')]=_['intersection'](_0xfc9461['model'],qs[_0x197c('0x37')](_0x1a607c[_0x197c('0x33')][_0x197c('0x37')]));_0x5a70dd['attributes']=_0x5a70dd[_0x197c('0x36')][_0x197c('0x38')]?_0x5a70dd[_0x197c('0x36')]:_0xfc9461['model'];if(!_0x1a607c[_0x197c('0x33')][_0x197c('0x39')](_0x197c('0x3a'))){_0x5a70dd[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x1a607c[_0x197c('0x33')][_0x197c('0x1b')]);_0x5a70dd[_0x197c('0x19')]=qs[_0x197c('0x19')](_0x1a607c[_0x197c('0x33')]['offset']);}_0x5a70dd[_0x197c('0x3b')]=qs['sort'](_0x1a607c['query']['sort']);_0x5a70dd['where']=qs[_0x197c('0x34')](_[_0x197c('0x54')](_0x1a607c[_0x197c('0x33')],_0xfc9461[_0x197c('0x34')]));if(_0x1a607c['query'][_0x197c('0x3e')]){_0x5a70dd['where']=_[_0x197c('0x3f')](_0x5a70dd['where'],{'$or':_[_0x197c('0x32')](_0x5a70dd['attributes'],function(_0x12d31a){var _0x1f6c6f={};_0x1f6c6f[_0x12d31a]={'$like':'%'+_0x1a607c[_0x197c('0x33')][_0x197c('0x3e')]+'%'};return _0x1f6c6f;})});}_0x5a70dd['where']=_[_0x197c('0x3f')](_0x5a70dd[_0x197c('0x3d')],{'mailboxuser':_0x480cab[_0x197c('0x55')]});_0x5a70dd=_['merge']({},_0x5a70dd,_0x1a607c[_0x197c('0x40')]);return db[_0x197c('0x56')][_0x197c('0x57')](_0x5a70dd)[_0x197c('0x24')](respondWithFilteredResult(_0x40867c,_0x5a70dd));})[_0x197c('0x44')](handleError(_0x40867c,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 47c5014..f677f0d 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 _0xcda6=['rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1bd266,_0xe4fc20){var _0x3073fd=function(_0x51d1e){while(--_0x51d1e){_0x1bd266['push'](_0x1bd266['shift']());}};_0x3073fd(++_0xe4fc20);}(_0xcda6,0x139));var _0x6cda=function(_0x2fbfca,_0x127896){_0x2fbfca=_0x2fbfca-0x0;var _0x4a6298=_0xcda6[_0x2fbfca];return _0x4a6298;};'use strict';var _=require(_0x6cda('0x0'));var util=require(_0x6cda('0x1'));var logger=require(_0x6cda('0x2'))(_0x6cda('0x3'));var moment=require(_0x6cda('0x4'));var BPromise=require(_0x6cda('0x5'));var rp=require(_0x6cda('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6cda('0x7'));var config=require(_0x6cda('0x8'));var attributes=require(_0x6cda('0x9'));module[_0x6cda('0xa')]=function(_0x47556c,_0x28417c){return _0x47556c[_0x6cda('0xb')](_0x6cda('0xc'),attributes,{'tableName':_0x6cda('0xd'),'paranoid':![],'indexes':[{'name':_0x6cda('0xe'),'fields':['mailbox',_0x6cda('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0bce=['define','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3ed4e0,_0x4494a6){var _0x2b3ed1=function(_0x19d73c){while(--_0x19d73c){_0x3ed4e0['push'](_0x3ed4e0['shift']());}};_0x2b3ed1(++_0x4494a6);}(_0x0bce,0x165));var _0xe0bc=function(_0xeec58c,_0x44313d){_0xeec58c=_0xeec58c-0x0;var _0x2dec93=_0x0bce[_0xeec58c];return _0x2dec93;};'use strict';var _=require(_0xe0bc('0x0'));var util=require(_0xe0bc('0x1'));var logger=require(_0xe0bc('0x2'))(_0xe0bc('0x3'));var moment=require(_0xe0bc('0x4'));var BPromise=require(_0xe0bc('0x5'));var rp=require(_0xe0bc('0x6'));var fs=require('fs');var path=require(_0xe0bc('0x7'));var rimraf=require(_0xe0bc('0x8'));var config=require(_0xe0bc('0x9'));var attributes=require('./voiceMail.attributes');module[_0xe0bc('0xa')]=function(_0x27e8d5,_0x19c13b){return _0x27e8d5[_0xe0bc('0xb')]('VoiceMail',attributes,{'tableName':_0xe0bc('0xc'),'paranoid':![],'indexes':[{'name':_0xe0bc('0xd'),'fields':[_0xe0bc('0xe'),_0xe0bc('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 4ad19ff..62904c8 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 _0x46c6=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','bluebird'];(function(_0x23676b,_0xd20f0f){var _0x110696=function(_0x4b11f1){while(--_0x4b11f1){_0x23676b['push'](_0x23676b['shift']());}};_0x110696(++_0xd20f0f);}(_0x46c6,0x1c9));var _0x646c=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x46c6[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x646c('0x0'));var util=require(_0x646c('0x1'));var moment=require('moment');var BPromise=require(_0x646c('0x2'));var rs=require(_0x646c('0x3'));var fs=require('fs');var Redis=require(_0x646c('0x4'));var db=require(_0x646c('0x5'))['db'];var utils=require(_0x646c('0x6'));var logger=require(_0x646c('0x7'))(_0x646c('0x8'));var config=require(_0x646c('0x9'));var jayson=require(_0x646c('0xa'));var client=jayson[_0x646c('0xb')][_0x646c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2652de,_0x552f86,_0x3cbf95){return new BPromise(function(_0x309a40,_0x234a76){return client[_0x646c('0xd')](_0x2652de,_0x3cbf95)['then'](function(_0x447f91){logger[_0x646c('0xe')](_0x646c('0xf'),_0x552f86,'request\x20sent');logger[_0x646c('0x10')](_0x646c('0x11'),_0x552f86,_0x646c('0x12'),JSON[_0x646c('0x13')](_0x447f91));if(_0x447f91[_0x646c('0x14')]){if(_0x447f91[_0x646c('0x14')][_0x646c('0x15')]===0x1f4){logger['error'](_0x646c('0xf'),_0x552f86,_0x447f91['error']['message']);return _0x234a76(_0x447f91[_0x646c('0x14')][_0x646c('0x16')]);}logger[_0x646c('0x14')](_0x646c('0xf'),_0x552f86,_0x447f91[_0x646c('0x14')]['message']);return _0x309a40(_0x447f91[_0x646c('0x14')]['message']);}else{logger[_0x646c('0xe')](_0x646c('0xf'),_0x552f86,'request\x20sent');_0x309a40(_0x447f91['result'][_0x646c('0x16')]);}})['catch'](function(_0x289dce){logger[_0x646c('0x14')](_0x646c('0xf'),_0x552f86,_0x289dce);_0x234a76(_0x289dce);});});} \ No newline at end of file +var _0xa42f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','VoiceMail,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x3725ee,_0x543bd9){var _0x399c71=function(_0xaf9400){while(--_0xaf9400){_0x3725ee['push'](_0x3725ee['shift']());}};_0x399c71(++_0x543bd9);}(_0xa42f,0x81));var _0xfa42=function(_0x41a56b,_0x1defbf){_0x41a56b=_0x41a56b-0x0;var _0x1b6e53=_0xa42f[_0x41a56b];return _0x1b6e53;};'use strict';var _=require(_0xfa42('0x0'));var util=require(_0xfa42('0x1'));var moment=require(_0xfa42('0x2'));var BPromise=require(_0xfa42('0x3'));var rs=require(_0xfa42('0x4'));var fs=require('fs');var Redis=require(_0xfa42('0x5'));var db=require(_0xfa42('0x6'))['db'];var utils=require(_0xfa42('0x7'));var logger=require(_0xfa42('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfa42('0x9'));var client=jayson[_0xfa42('0xa')][_0xfa42('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2123bb,_0x1da2a7,_0x8f4940){return new BPromise(function(_0x57380b,_0x529f4a){return client[_0xfa42('0xc')](_0x2123bb,_0x8f4940)[_0xfa42('0xd')](function(_0x32f805){logger[_0xfa42('0xe')]('VoiceMail,\x20%s,\x20%s',_0x1da2a7,'request\x20sent');logger[_0xfa42('0xf')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x1da2a7,_0xfa42('0x10'),JSON[_0xfa42('0x11')](_0x32f805));if(_0x32f805[_0xfa42('0x12')]){if(_0x32f805['error']['code']===0x1f4){logger[_0xfa42('0x12')](_0xfa42('0x13'),_0x1da2a7,_0x32f805[_0xfa42('0x12')][_0xfa42('0x14')]);return _0x529f4a(_0x32f805[_0xfa42('0x12')][_0xfa42('0x14')]);}logger[_0xfa42('0x12')]('VoiceMail,\x20%s,\x20%s',_0x1da2a7,_0x32f805['error'][_0xfa42('0x14')]);return _0x57380b(_0x32f805[_0xfa42('0x12')][_0xfa42('0x14')]);}else{logger[_0xfa42('0xe')](_0xfa42('0x13'),_0x1da2a7,_0xfa42('0x10'));_0x57380b(_0x32f805['result'][_0xfa42('0x14')]);}})[_0xfa42('0x15')](function(_0x5b620b){logger['error']('VoiceMail,\x20%s,\x20%s',_0x1da2a7,_0x5b620b);_0x529f4a(_0x5b620b);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 2499bee..9aff2ab 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 _0x6158=['exports','util','path','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update','delete','destroy'];(function(_0x28d93a,_0x3a962a){var _0x282994=function(_0x3d9a76){while(--_0x3d9a76){_0x28d93a['push'](_0x28d93a['shift']());}};_0x282994(++_0x3a962a);}(_0x6158,0xbf));var _0x8615=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6158[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x8615('0x0'));var path=require(_0x8615('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8615('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8615('0x3'));var config=require(_0x8615('0x4'));var controller=require(_0x8615('0x5'));router[_0x8615('0x6')]('/',auth[_0x8615('0x7')](),controller[_0x8615('0x8')]);router[_0x8615('0x6')](_0x8615('0x9'),auth[_0x8615('0x7')](),controller['show']);router[_0x8615('0x6')](_0x8615('0xa'),auth[_0x8615('0x7')](),controller[_0x8615('0xb')]);router[_0x8615('0xc')]('/',auth[_0x8615('0x7')](),controller[_0x8615('0xd')]);router[_0x8615('0xe')](_0x8615('0x9'),auth['isAuthenticated'](),controller[_0x8615('0xf')]);router[_0x8615('0x10')](_0x8615('0x9'),auth[_0x8615('0x7')](),controller[_0x8615('0x11')]);module[_0x8615('0x12')]=router; \ No newline at end of file +var _0xe318=['put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','/:id/download','post','create'];(function(_0x135565,_0x219ee8){var _0x2b03b4=function(_0x1d457d){while(--_0x1d457d){_0x135565['push'](_0x135565['shift']());}};_0x2b03b4(++_0x219ee8);}(_0xe318,0x9b));var _0x8e31=function(_0x5a854f,_0x1182d8){_0x5a854f=_0x5a854f-0x0;var _0x307de6=_0xe318[_0x5a854f];return _0x307de6;};'use strict';var multer=require(_0x8e31('0x0'));var util=require(_0x8e31('0x1'));var path=require(_0x8e31('0x2'));var timeout=require(_0x8e31('0x3'));var express=require(_0x8e31('0x4'));var router=express[_0x8e31('0x5')]();var fs_extra=require(_0x8e31('0x6'));var auth=require(_0x8e31('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8e31('0x8'));router[_0x8e31('0x9')]('/',auth[_0x8e31('0xa')](),controller[_0x8e31('0xb')]);router['get'](_0x8e31('0xc'),auth[_0x8e31('0xa')](),controller['show']);router['get'](_0x8e31('0xd'),auth['isAuthenticated'](),controller['download']);router[_0x8e31('0xe')]('/',auth['isAuthenticated'](),controller[_0x8e31('0xf')]);router[_0x8e31('0x10')]('/:id',auth[_0x8e31('0xa')](),controller[_0x8e31('0x11')]);router['delete'](_0x8e31('0xc'),auth[_0x8e31('0xa')](),controller[_0x8e31('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 5044f2e..666f48c 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 _0xb2c7=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','STRING','long','TIMESTAMP'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xb2c7,0x97));var _0x7b2c=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xb2c7[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0x7b2c('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b2c('0x1')],'get':function(_0x368c48){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x7b2c('0x2')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x7b2c('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0x7b2c('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x7b2c('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x7b2c('0x2')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x7b2c('0x3')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x7b2c('0x4'),'defaultValue':Sequelize['literal'](_0x7b2c('0x5'))}}; \ No newline at end of file +var _0xe856=['STRING','BLOB','long','TIMESTAMP','literal','exports','INTEGER'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0xe856,0xc2));var _0x6e85=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xe856[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require('sequelize');module[_0x6e85('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2ede34){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x6e85('0x1')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x6e85('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0x6e85('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x6e85('0x2')],'defaultValue':''},'origtime':{'type':Sequelize[_0x6e85('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0x6e85('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6e85('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x6e85('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0x6e85('0x3')](_0x6e85('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x6e85('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6e85('0x2')],'defaultValue':''},'stamp':{'type':_0x6e85('0x5'),'defaultValue':Sequelize[_0x6e85('0x6')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index ab06599..c73b77e 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 _0x89b8=['attachment','msg_id','Content-Disposition','.wav\x22','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','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','limit','count','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','VoiceMailMessage','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','where','filters','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','download','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav'];(function(_0x45bafb,_0x5605f0){var _0x2dfadc=function(_0x512942){while(--_0x512942){_0x45bafb['push'](_0x45bafb['shift']());}};_0x2dfadc(++_0x5605f0);}(_0x89b8,0x18a));var _0x889b=function(_0x50d359,_0x5b6124){_0x50d359=_0x50d359-0x0;var _0x5afa85=_0x89b8[_0x50d359];return _0x5afa85;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x889b('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x889b('0x1'));var moment=require('moment');var BPromise=require(_0x889b('0x2'));var Mustache=require(_0x889b('0x3'));var util=require(_0x889b('0x4'));var path=require(_0x889b('0x5'));var sox=require(_0x889b('0x6'));var csv=require(_0x889b('0x7'));var ejs=require(_0x889b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x889b('0x9'));var squel=require(_0x889b('0xa'));var crypto=require(_0x889b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x889b('0x7'));var querystring=require('querystring');var Papa=require(_0x889b('0xc'));var Redis=require(_0x889b('0xd'));var authService=require(_0x889b('0xe'));var qs=require(_0x889b('0xf'));var as=require(_0x889b('0x10'));var hardwareService=require(_0x889b('0x11'));var logger=require(_0x889b('0x12'))(_0x889b('0x13'));var utils=require(_0x889b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x889b('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c2507,_0x1568e8){_0x1568e8=_0x1568e8||0xcc;return function(_0x269334){if(_0x269334){return _0x4c2507[_0x889b('0x16')](_0x1568e8);}return _0x4c2507[_0x889b('0x17')](_0x1568e8)[_0x889b('0x18')]();};}function respondWithResult(_0x5dc075,_0x13e64e){_0x13e64e=_0x13e64e||0xc8;return function(_0x54d9c6){if(_0x54d9c6){return _0x5dc075[_0x889b('0x17')](_0x13e64e)[_0x889b('0x19')](_0x54d9c6);}};}function respondWithFilteredResult(_0x5a24fb,_0x244e8b){return function(_0x2914f9){if(_0x2914f9){var _0xc75f73=typeof _0x244e8b[_0x889b('0x1a')]==='undefined'&&typeof _0x244e8b[_0x889b('0x1b')]==='undefined';var _0x27843e=_0x2914f9[_0x889b('0x1c')];var _0x54e78b=_0xc75f73?0x0:_0x244e8b['offset'];var _0x2b3e5b=_0xc75f73?_0x2914f9[_0x889b('0x1c')]:_0x244e8b[_0x889b('0x1a')]+_0x244e8b['limit'];var _0x264e91;if(_0x2b3e5b>=_0x27843e){_0x2b3e5b=_0x27843e;_0x264e91=0xc8;}else{_0x264e91=0xce;}_0x5a24fb[_0x889b('0x17')](_0x264e91);return _0x5a24fb[_0x889b('0x1d')]('Content-Range',_0x54e78b+'-'+_0x2b3e5b+'/'+_0x27843e)['json'](_0x2914f9);}return null;};}function patchUpdates(_0x242a35){return function(_0x393a3a){try{jsonpatch[_0x889b('0x1e')](_0x393a3a,_0x242a35,!![]);}catch(_0x16a89b){return BPromise[_0x889b('0x1f')](_0x16a89b);}return _0x393a3a[_0x889b('0x20')]();};}function saveUpdates(_0x19f4e0,_0x3e7dfc){return function(_0x156926){if(_0x156926){return _0x156926[_0x889b('0x21')](_0x19f4e0)['then'](function(_0x3acd6c){return _0x3acd6c;});}return null;};}function removeEntity(_0x44451c,_0x566805){return function(_0xc2676c){if(_0xc2676c){return _0xc2676c[_0x889b('0x22')]()[_0x889b('0x23')](function(){_0x44451c['status'](0xcc)[_0x889b('0x18')]();});}};}function handleEntityNotFound(_0x25f75a,_0x411f62){return function(_0x124fc7){if(!_0x124fc7){_0x25f75a[_0x889b('0x16')](0x194);}return _0x124fc7;};}function handleError(_0x54fa2d,_0x5d8393){_0x5d8393=_0x5d8393||0x1f4;return function(_0x4a31ab){logger['error'](_0x4a31ab[_0x889b('0x24')]);if(_0x4a31ab[_0x889b('0x25')]){delete _0x4a31ab['name'];}_0x54fa2d[_0x889b('0x17')](_0x5d8393)[_0x889b('0x26')](_0x4a31ab);};}exports[_0x889b('0x27')]=function(_0x43fd85,_0x188a1b){var _0x4d62c5={},_0x55f602={},_0x527d61={'count':0x0,'rows':[]};var _0x1a800a=_[_0x889b('0x28')](db[_0x889b('0x29')]['rawAttributes'],function(_0x2eb4b1){return{'name':_0x2eb4b1[_0x889b('0x2a')],'type':_0x2eb4b1[_0x889b('0x2b')][_0x889b('0x2c')]};});_0x55f602['model']=_['differenceBy'](_[_0x889b('0x28')](_0x1a800a,_0x889b('0x25')),[_0x889b('0x25')]);_0x55f602[_0x889b('0x2d')]=_[_0x889b('0x2e')](_0x43fd85[_0x889b('0x2d')]);_0x55f602['filters']=_[_0x889b('0x2f')](_0x55f602[_0x889b('0x30')],_0x55f602[_0x889b('0x2d')]);_0x4d62c5[_0x889b('0x31')]=_[_0x889b('0x2f')](_0x55f602[_0x889b('0x30')],qs[_0x889b('0x32')](_0x43fd85[_0x889b('0x2d')]['fields']));_0x4d62c5[_0x889b('0x31')]=_0x4d62c5[_0x889b('0x31')][_0x889b('0x33')]?_0x4d62c5[_0x889b('0x31')]:_0x55f602['model'];if(!_0x43fd85['query'][_0x889b('0x34')]('nolimit')){_0x4d62c5[_0x889b('0x1b')]=qs[_0x889b('0x1b')](_0x43fd85[_0x889b('0x2d')][_0x889b('0x1b')]);_0x4d62c5[_0x889b('0x1a')]=qs['offset'](_0x43fd85['query']['offset']);}_0x4d62c5[_0x889b('0x35')]=qs['sort'](_0x43fd85['query']['sort']);_0x4d62c5[_0x889b('0x36')]=qs[_0x889b('0x37')](_['pick'](_0x43fd85['query'],_0x55f602[_0x889b('0x37')]),_0x1a800a);if(_0x43fd85[_0x889b('0x2d')][_0x889b('0x38')]){_0x4d62c5[_0x889b('0x36')]=_[_0x889b('0x39')](_0x4d62c5[_0x889b('0x36')],{'$or':_[_0x889b('0x28')](_0x1a800a,function(_0x436f57){if(_0x436f57['type']!==_0x889b('0x3a')){var _0x2226d4={};_0x2226d4[_0x436f57[_0x889b('0x25')]]={'$like':'%'+_0x43fd85['query'][_0x889b('0x38')]+'%'};return _0x2226d4;}})});}_0x4d62c5=_[_0x889b('0x39')]({},_0x4d62c5,_0x43fd85[_0x889b('0x3b')]);var _0xd49f19={'where':_0x4d62c5[_0x889b('0x36')]};return db[_0x889b('0x29')]['count'](_0xd49f19)[_0x889b('0x23')](function(_0x2f94a7){_0x527d61[_0x889b('0x1c')]=_0x2f94a7;if(_0x43fd85['query'][_0x889b('0x3c')]){_0x4d62c5['include']=[{'all':!![]}];}return db[_0x889b('0x29')]['findAll'](_0x4d62c5);})[_0x889b('0x23')](function(_0x4f02b5){_0x527d61[_0x889b('0x3d')]=_0x4f02b5;return _0x527d61;})['then'](respondWithFilteredResult(_0x188a1b,_0x4d62c5))[_0x889b('0x3e')](handleError(_0x188a1b,null));};exports[_0x889b('0x3f')]=function(_0x17fb98,_0x2add61){var _0x27ffb5={'raw':!![],'where':{'id':_0x17fb98[_0x889b('0x40')]['id']}},_0xfb016a={};_0xfb016a['model']=_['keys'](db[_0x889b('0x29')]['rawAttributes']);_0xfb016a[_0x889b('0x2d')]=_[_0x889b('0x2e')](_0x17fb98[_0x889b('0x2d')]);_0xfb016a[_0x889b('0x37')]=_[_0x889b('0x2f')](_0xfb016a[_0x889b('0x30')],_0xfb016a['query']);_0x27ffb5[_0x889b('0x31')]=_['intersection'](_0xfb016a[_0x889b('0x30')],qs[_0x889b('0x32')](_0x17fb98[_0x889b('0x2d')]['fields']));_0x27ffb5[_0x889b('0x31')]=_0x27ffb5[_0x889b('0x31')][_0x889b('0x33')]?_0x27ffb5[_0x889b('0x31')]:_0xfb016a[_0x889b('0x30')];if(_0x17fb98['query'][_0x889b('0x3c')]){_0x27ffb5[_0x889b('0x41')]=[{'all':!![]}];}_0x27ffb5=_[_0x889b('0x39')]({},_0x27ffb5,_0x17fb98[_0x889b('0x3b')]);return db[_0x889b('0x29')][_0x889b('0x42')](_0x27ffb5)['then'](handleEntityNotFound(_0x2add61,null))[_0x889b('0x23')](respondWithResult(_0x2add61,null))['catch'](handleError(_0x2add61,null));};exports[_0x889b('0x43')]=function(_0x840d75,_0x5842e3){return db[_0x889b('0x29')][_0x889b('0x43')](_0x840d75[_0x889b('0x44')],{})['then'](respondWithResult(_0x5842e3,0xc9))[_0x889b('0x3e')](handleError(_0x5842e3,null));};exports[_0x889b('0x21')]=function(_0x261e02,_0x3b7e86){if(_0x261e02[_0x889b('0x44')]['id']){delete _0x261e02[_0x889b('0x44')]['id'];}return db[_0x889b('0x29')][_0x889b('0x42')]({'where':{'id':_0x261e02[_0x889b('0x40')]['id']}})['then'](handleEntityNotFound(_0x3b7e86,null))[_0x889b('0x23')](saveUpdates(_0x261e02[_0x889b('0x44')],null))['then'](respondWithResult(_0x3b7e86,null))[_0x889b('0x3e')](handleError(_0x3b7e86,null));};exports[_0x889b('0x22')]=function(_0x3bbcbb,_0x44eafd){return db[_0x889b('0x29')]['find']({'where':{'id':_0x3bbcbb[_0x889b('0x40')]['id']}})[_0x889b('0x23')](handleEntityNotFound(_0x44eafd,null))[_0x889b('0x23')](removeEntity(_0x44eafd,null))[_0x889b('0x3e')](handleError(_0x44eafd,null));};exports[_0x889b('0x45')]=function(_0x365f61,_0x2776f5,_0x427b51){return db[_0x889b('0x29')][_0x889b('0x42')]({'where':{'id':_0x365f61['params']['id']},'attributes':['id','recording','msg_id']})[_0x889b('0x23')](handleEntityNotFound(_0x2776f5,null))[_0x889b('0x23')](function(_0x15c929){if(_0x15c929){if(!_0x15c929[_0x889b('0x46')]){throw new db['Sequelize'][(_0x889b('0x47'))](_0x889b('0x48'));}var _0x210759={'Content-Type':_0x889b('0x49'),'Content-Disposition':_0x889b('0x4a')};if(_0x15c929[_0x889b('0x4b')]){_0x210759[_0x889b('0x4c')]='attachment;\x20filename=\x22'+_0x15c929[_0x889b('0x4b')]+_0x889b('0x4d');}_0x2776f5['set'](_0x210759);return _0x2776f5[_0x889b('0x26')](new Buffer(_0x15c929[_0x889b('0x46')]));}})['catch'](handleError(_0x2776f5,null));}; \ No newline at end of file +var _0xa116=['msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','set','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','differenceBy','query','filters','intersection','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceMailMessage','includeAll','include','findAll','rows','show','params','keys','fields','length','create','body','find','catch','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0xa116,0x169));var _0x6a11=function(_0x483c6d,_0x2ab69b){_0x483c6d=_0x483c6d-0x0;var _0x39bd48=_0xa116[_0x483c6d];return _0x39bd48;};'use strict';var emlformat=require(_0x6a11('0x0'));var rimraf=require(_0x6a11('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a11('0x2'));var rp=require(_0x6a11('0x3'));var moment=require(_0x6a11('0x4'));var BPromise=require(_0x6a11('0x5'));var Mustache=require(_0x6a11('0x6'));var util=require(_0x6a11('0x7'));var path=require(_0x6a11('0x8'));var sox=require(_0x6a11('0x9'));var csv=require(_0x6a11('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a11('0xb'));var _=require(_0x6a11('0xc'));var squel=require(_0x6a11('0xd'));var crypto=require(_0x6a11('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6a11('0xa'));var querystring=require(_0x6a11('0xf'));var Papa=require(_0x6a11('0x10'));var Redis=require(_0x6a11('0x11'));var authService=require(_0x6a11('0x12'));var qs=require(_0x6a11('0x13'));var as=require(_0x6a11('0x14'));var hardwareService=require(_0x6a11('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6a11('0x16'));var config=require(_0x6a11('0x17'));var licenseUtil=require(_0x6a11('0x18'));var db=require(_0x6a11('0x19'))['db'];function respondWithStatusCode(_0x5ad6a8,_0x3b4b6c){_0x3b4b6c=_0x3b4b6c||0xcc;return function(_0x12f595){if(_0x12f595){return _0x5ad6a8[_0x6a11('0x1a')](_0x3b4b6c);}return _0x5ad6a8[_0x6a11('0x1b')](_0x3b4b6c)[_0x6a11('0x1c')]();};}function respondWithResult(_0x3f8dfb,_0x52d4fe){_0x52d4fe=_0x52d4fe||0xc8;return function(_0xba7360){if(_0xba7360){return _0x3f8dfb[_0x6a11('0x1b')](_0x52d4fe)[_0x6a11('0x1d')](_0xba7360);}};}function respondWithFilteredResult(_0x2e9bdd,_0x1ac6ef){return function(_0x2b35a7){if(_0x2b35a7){var _0x304403=typeof _0x1ac6ef[_0x6a11('0x1e')]===_0x6a11('0x1f')&&typeof _0x1ac6ef[_0x6a11('0x20')]===_0x6a11('0x1f');var _0x131b71=_0x2b35a7[_0x6a11('0x21')];var _0x25df97=_0x304403?0x0:_0x1ac6ef[_0x6a11('0x1e')];var _0x5e4120=_0x304403?_0x2b35a7[_0x6a11('0x21')]:_0x1ac6ef[_0x6a11('0x1e')]+_0x1ac6ef[_0x6a11('0x20')];var _0x122ae4;if(_0x5e4120>=_0x131b71){_0x5e4120=_0x131b71;_0x122ae4=0xc8;}else{_0x122ae4=0xce;}_0x2e9bdd[_0x6a11('0x1b')](_0x122ae4);return _0x2e9bdd['set']('Content-Range',_0x25df97+'-'+_0x5e4120+'/'+_0x131b71)[_0x6a11('0x1d')](_0x2b35a7);}return null;};}function patchUpdates(_0x5b1a68){return function(_0x5151a5){try{jsonpatch[_0x6a11('0x22')](_0x5151a5,_0x5b1a68,!![]);}catch(_0x82f501){return BPromise[_0x6a11('0x23')](_0x82f501);}return _0x5151a5[_0x6a11('0x24')]();};}function saveUpdates(_0x4c0d6,_0x313347){return function(_0x482808){if(_0x482808){return _0x482808[_0x6a11('0x25')](_0x4c0d6)[_0x6a11('0x26')](function(_0x483bdb){return _0x483bdb;});}return null;};}function removeEntity(_0x24ff37,_0x20bfe9){return function(_0x91425c){if(_0x91425c){return _0x91425c[_0x6a11('0x27')]()['then'](function(){_0x24ff37[_0x6a11('0x1b')](0xcc)[_0x6a11('0x1c')]();});}};}function handleEntityNotFound(_0x5c1a88,_0x121884){return function(_0x533bed){if(!_0x533bed){_0x5c1a88[_0x6a11('0x1a')](0x194);}return _0x533bed;};}function handleError(_0x3c1f24,_0x5c9251){_0x5c9251=_0x5c9251||0x1f4;return function(_0x1ab6f0){logger['error'](_0x1ab6f0[_0x6a11('0x28')]);if(_0x1ab6f0[_0x6a11('0x29')]){delete _0x1ab6f0[_0x6a11('0x29')];}_0x3c1f24[_0x6a11('0x1b')](_0x5c9251)[_0x6a11('0x2a')](_0x1ab6f0);};}exports[_0x6a11('0x2b')]=function(_0x24ee26,_0x49ec0c){var _0x526227={},_0x216833={},_0x1fc58f={'count':0x0,'rows':[]};var _0x45fd04=_[_0x6a11('0x2c')](db['VoiceMailMessage'][_0x6a11('0x2d')],function(_0x23fe5f){return{'name':_0x23fe5f[_0x6a11('0x2e')],'type':_0x23fe5f['type'][_0x6a11('0x2f')]};});_0x216833[_0x6a11('0x30')]=_[_0x6a11('0x31')](_['map'](_0x45fd04,_0x6a11('0x29')),[_0x6a11('0x29')]);_0x216833[_0x6a11('0x32')]=_['keys'](_0x24ee26[_0x6a11('0x32')]);_0x216833[_0x6a11('0x33')]=_[_0x6a11('0x34')](_0x216833['model'],_0x216833[_0x6a11('0x32')]);_0x526227[_0x6a11('0x35')]=_[_0x6a11('0x34')](_0x216833[_0x6a11('0x30')],qs['fields'](_0x24ee26[_0x6a11('0x32')]['fields']));_0x526227[_0x6a11('0x35')]=_0x526227[_0x6a11('0x35')]['length']?_0x526227[_0x6a11('0x35')]:_0x216833[_0x6a11('0x30')];if(!_0x24ee26[_0x6a11('0x32')]['hasOwnProperty'](_0x6a11('0x36'))){_0x526227[_0x6a11('0x20')]=qs[_0x6a11('0x20')](_0x24ee26['query'][_0x6a11('0x20')]);_0x526227[_0x6a11('0x1e')]=qs[_0x6a11('0x1e')](_0x24ee26[_0x6a11('0x32')][_0x6a11('0x1e')]);}_0x526227[_0x6a11('0x37')]=qs[_0x6a11('0x38')](_0x24ee26[_0x6a11('0x32')]['sort']);_0x526227[_0x6a11('0x39')]=qs[_0x6a11('0x33')](_[_0x6a11('0x3a')](_0x24ee26['query'],_0x216833['filters']),_0x45fd04);if(_0x24ee26['query']['filter']){_0x526227['where']=_[_0x6a11('0x3b')](_0x526227[_0x6a11('0x39')],{'$or':_['map'](_0x45fd04,function(_0x31e28f){if(_0x31e28f['type']!==_0x6a11('0x3c')){var _0x28b91c={};_0x28b91c[_0x31e28f[_0x6a11('0x29')]]={'$like':'%'+_0x24ee26[_0x6a11('0x32')][_0x6a11('0x3d')]+'%'};return _0x28b91c;}})});}_0x526227=_[_0x6a11('0x3b')]({},_0x526227,_0x24ee26[_0x6a11('0x3e')]);var _0x1c5c93={'where':_0x526227[_0x6a11('0x39')]};return db[_0x6a11('0x3f')][_0x6a11('0x21')](_0x1c5c93)[_0x6a11('0x26')](function(_0x5fef85){_0x1fc58f[_0x6a11('0x21')]=_0x5fef85;if(_0x24ee26[_0x6a11('0x32')][_0x6a11('0x40')]){_0x526227[_0x6a11('0x41')]=[{'all':!![]}];}return db[_0x6a11('0x3f')][_0x6a11('0x42')](_0x526227);})[_0x6a11('0x26')](function(_0x1c907e){_0x1fc58f[_0x6a11('0x43')]=_0x1c907e;return _0x1fc58f;})['then'](respondWithFilteredResult(_0x49ec0c,_0x526227))['catch'](handleError(_0x49ec0c,null));};exports[_0x6a11('0x44')]=function(_0x5cc6c4,_0x590ed7){var _0x481b49={'raw':!![],'where':{'id':_0x5cc6c4[_0x6a11('0x45')]['id']}},_0x2936fa={};_0x2936fa[_0x6a11('0x30')]=_[_0x6a11('0x46')](db[_0x6a11('0x3f')]['rawAttributes']);_0x2936fa[_0x6a11('0x32')]=_[_0x6a11('0x46')](_0x5cc6c4[_0x6a11('0x32')]);_0x2936fa[_0x6a11('0x33')]=_[_0x6a11('0x34')](_0x2936fa[_0x6a11('0x30')],_0x2936fa[_0x6a11('0x32')]);_0x481b49[_0x6a11('0x35')]=_['intersection'](_0x2936fa['model'],qs['fields'](_0x5cc6c4[_0x6a11('0x32')][_0x6a11('0x47')]));_0x481b49[_0x6a11('0x35')]=_0x481b49[_0x6a11('0x35')][_0x6a11('0x48')]?_0x481b49[_0x6a11('0x35')]:_0x2936fa[_0x6a11('0x30')];if(_0x5cc6c4['query'][_0x6a11('0x40')]){_0x481b49[_0x6a11('0x41')]=[{'all':!![]}];}_0x481b49=_[_0x6a11('0x3b')]({},_0x481b49,_0x5cc6c4[_0x6a11('0x3e')]);return db['VoiceMailMessage']['find'](_0x481b49)[_0x6a11('0x26')](handleEntityNotFound(_0x590ed7,null))['then'](respondWithResult(_0x590ed7,null))['catch'](handleError(_0x590ed7,null));};exports[_0x6a11('0x49')]=function(_0x36433a,_0x724e36){return db['VoiceMailMessage'][_0x6a11('0x49')](_0x36433a[_0x6a11('0x4a')],{})[_0x6a11('0x26')](respondWithResult(_0x724e36,0xc9))['catch'](handleError(_0x724e36,null));};exports[_0x6a11('0x25')]=function(_0x36a8fa,_0x524905){if(_0x36a8fa['body']['id']){delete _0x36a8fa[_0x6a11('0x4a')]['id'];}return db[_0x6a11('0x3f')][_0x6a11('0x4b')]({'where':{'id':_0x36a8fa[_0x6a11('0x45')]['id']}})[_0x6a11('0x26')](handleEntityNotFound(_0x524905,null))[_0x6a11('0x26')](saveUpdates(_0x36a8fa['body'],null))[_0x6a11('0x26')](respondWithResult(_0x524905,null))[_0x6a11('0x4c')](handleError(_0x524905,null));};exports[_0x6a11('0x27')]=function(_0x98a736,_0x31515a){return db[_0x6a11('0x3f')]['find']({'where':{'id':_0x98a736[_0x6a11('0x45')]['id']}})[_0x6a11('0x26')](handleEntityNotFound(_0x31515a,null))[_0x6a11('0x26')](removeEntity(_0x31515a,null))[_0x6a11('0x4c')](handleError(_0x31515a,null));};exports[_0x6a11('0x4d')]=function(_0x4fe691,_0x97bfba,_0x67e402){return db[_0x6a11('0x3f')][_0x6a11('0x4b')]({'where':{'id':_0x4fe691[_0x6a11('0x45')]['id']},'attributes':['id',_0x6a11('0x4e'),'msg_id']})['then'](handleEntityNotFound(_0x97bfba,null))[_0x6a11('0x26')](function(_0x54101d){if(_0x54101d){if(!_0x54101d[_0x6a11('0x4e')]){throw new db[(_0x6a11('0x4f'))][(_0x6a11('0x50'))](_0x6a11('0x51'));}var _0x3b6e09={'Content-Type':_0x6a11('0x52'),'Content-Disposition':_0x6a11('0x53')};if(_0x54101d[_0x6a11('0x54')]){_0x3b6e09[_0x6a11('0x55')]=_0x6a11('0x56')+_0x54101d[_0x6a11('0x54')]+_0x6a11('0x57');}_0x97bfba[_0x6a11('0x58')](_0x3b6e09);return _0x97bfba['send'](new Buffer(_0x54101d['recording']));}})[_0x6a11('0x4c')](handleError(_0x97bfba,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 865a0e5..2c66cfe 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 _0x468d=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','../../config/logger','api','moment','request-promise','../../config/environment','./voiceMailMessage.attributes'];(function(_0x27c7b7,_0x3ac29c){var _0x22e7d5=function(_0x1a5494){while(--_0x1a5494){_0x27c7b7['push'](_0x27c7b7['shift']());}};_0x22e7d5(++_0x3ac29c);}(_0x468d,0x65));var _0xd468=function(_0x3186af,_0x127aeb){_0x3186af=_0x3186af-0x0;var _0x121689=_0x468d[_0x3186af];return _0x121689;};'use strict';var _=require(_0xd468('0x0'));var util=require('util');var logger=require(_0xd468('0x1'))(_0xd468('0x2'));var moment=require(_0xd468('0x3'));var BPromise=require('bluebird');var rp=require(_0xd468('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd468('0x5'));var attributes=require(_0xd468('0x6'));module[_0xd468('0x7')]=function(_0x5070dd,_0x66601){return _0x5070dd[_0xd468('0x8')](_0xd468('0x9'),attributes,{'tableName':_0xd468('0xa'),'paranoid':![],'indexes':[{'name':_0xd468('0xb'),'fields':[_0xd468('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xf195=['VoiceMailMessage','dir','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes','exports','define'];(function(_0x608b35,_0x69f514){var _0x58bc5a=function(_0x8df09d){while(--_0x8df09d){_0x608b35['push'](_0x608b35['shift']());}};_0x58bc5a(++_0x69f514);}(_0xf195,0x188));var _0x5f19=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0xf195[_0x175e89];return _0x2ed996;};'use strict';var _=require(_0x5f19('0x0'));var util=require('util');var logger=require(_0x5f19('0x1'))(_0x5f19('0x2'));var moment=require(_0x5f19('0x3'));var BPromise=require(_0x5f19('0x4'));var rp=require(_0x5f19('0x5'));var fs=require('fs');var path=require(_0x5f19('0x6'));var rimraf=require(_0x5f19('0x7'));var config=require('../../config/environment');var attributes=require(_0x5f19('0x8'));module[_0x5f19('0x9')]=function(_0x8978a5,_0x4fd642){return _0x8978a5[_0x5f19('0xa')](_0x5f19('0xb'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x5f19('0xc'),'fields':[_0x5f19('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 43d43f7..10312b2 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 _0x8385=['request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s'];(function(_0x1841ac,_0xd1f51a){var _0x29512a=function(_0x42f363){while(--_0x42f363){_0x1841ac['push'](_0x1841ac['shift']());}};_0x29512a(++_0xd1f51a);}(_0x8385,0xcf));var _0x5838=function(_0x4eeba6,_0x1b15aa){_0x4eeba6=_0x4eeba6-0x0;var _0x238e3c=_0x8385[_0x4eeba6];return _0x238e3c;};'use strict';var _=require('lodash');var util=require(_0x5838('0x0'));var moment=require(_0x5838('0x1'));var BPromise=require(_0x5838('0x2'));var rs=require(_0x5838('0x3'));var fs=require('fs');var Redis=require(_0x5838('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5838('0x5'));var logger=require(_0x5838('0x6'))(_0x5838('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5838('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x143718,_0x5ebfe6,_0x289a70){return new BPromise(function(_0x374f7a,_0x4871a2){return client[_0x5838('0x9')](_0x143718,_0x289a70)[_0x5838('0xa')](function(_0x2f0dd7){logger[_0x5838('0xb')](_0x5838('0xc'),_0x5ebfe6,_0x5838('0xd'));logger[_0x5838('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x5ebfe6,_0x5838('0xd'),JSON[_0x5838('0xf')](_0x2f0dd7));if(_0x2f0dd7[_0x5838('0x10')]){if(_0x2f0dd7[_0x5838('0x10')]['code']===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x5ebfe6,_0x2f0dd7[_0x5838('0x10')][_0x5838('0x11')]);return _0x4871a2(_0x2f0dd7['error'][_0x5838('0x11')]);}logger[_0x5838('0x10')](_0x5838('0xc'),_0x5ebfe6,_0x2f0dd7[_0x5838('0x10')][_0x5838('0x11')]);return _0x374f7a(_0x2f0dd7['error']['message']);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x5ebfe6,_0x5838('0xd'));_0x374f7a(_0x2f0dd7[_0x5838('0x12')][_0x5838('0x11')]);}})[_0x5838('0x13')](function(_0x3acb69){logger[_0x5838('0x10')](_0x5838('0xc'),_0x5ebfe6,_0x3acb69);_0x4871a2(_0x3acb69);});});} \ No newline at end of file +var _0xd503=['../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x337f9d,_0x46455d){var _0x402e96=function(_0xf20ac4){while(--_0xf20ac4){_0x337f9d['push'](_0x337f9d['shift']());}};_0x402e96(++_0x46455d);}(_0xd503,0x19b));var _0x3d50=function(_0x20787b,_0x3efb42){_0x20787b=_0x20787b-0x0;var _0x2ed710=_0xd503[_0x20787b];return _0x2ed710;};'use strict';var _=require('lodash');var util=require(_0x3d50('0x0'));var moment=require(_0x3d50('0x1'));var BPromise=require('bluebird');var rs=require(_0x3d50('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d50('0x3'))['db'];var utils=require(_0x3d50('0x4'));var logger=require(_0x3d50('0x5'))(_0x3d50('0x6'));var config=require(_0x3d50('0x7'));var jayson=require(_0x3d50('0x8'));var client=jayson[_0x3d50('0x9')][_0x3d50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19f97a,_0xef56e9,_0x4149a6){return new BPromise(function(_0x253e85,_0x19e925){return client[_0x3d50('0xb')](_0x19f97a,_0x4149a6)['then'](function(_0x538e96){logger[_0x3d50('0xc')](_0x3d50('0xd'),_0xef56e9,_0x3d50('0xe'));logger[_0x3d50('0xf')](_0x3d50('0x10'),_0xef56e9,_0x3d50('0xe'),JSON[_0x3d50('0x11')](_0x538e96));if(_0x538e96[_0x3d50('0x12')]){if(_0x538e96[_0x3d50('0x12')][_0x3d50('0x13')]===0x1f4){logger['error'](_0x3d50('0xd'),_0xef56e9,_0x538e96[_0x3d50('0x12')]['message']);return _0x19e925(_0x538e96[_0x3d50('0x12')][_0x3d50('0x14')]);}logger[_0x3d50('0x12')](_0x3d50('0xd'),_0xef56e9,_0x538e96[_0x3d50('0x12')][_0x3d50('0x14')]);return _0x253e85(_0x538e96[_0x3d50('0x12')][_0x3d50('0x14')]);}else{logger[_0x3d50('0xc')](_0x3d50('0xd'),_0xef56e9,_0x3d50('0xe'));_0x253e85(_0x538e96[_0x3d50('0x15')]['message']);}})['catch'](function(_0x276620){logger[_0x3d50('0x12')](_0x3d50('0xd'),_0xef56e9,_0x276620);_0x19e925(_0x276620);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 007fc15..a452f10 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 _0xa349=['../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','create','addSound','put','/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x32a372,_0x518b9c){var _0x2e35b0=function(_0x1241d3){while(--_0x1241d3){_0x32a372['push'](_0x32a372['shift']());}};_0x2e35b0(++_0x518b9c);}(_0xa349,0x193));var _0x9a34=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa349[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9a34('0x0'));var util=require(_0x9a34('0x1'));var path=require('path');var timeout=require(_0x9a34('0x2'));var express=require('express');var router=express[_0x9a34('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9a34('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9a34('0x5'));var controller=require(_0x9a34('0x6'));router[_0x9a34('0x7')]('/',auth[_0x9a34('0x8')](),controller[_0x9a34('0x9')]);router[_0x9a34('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9a34('0xa')]);router['get'](_0x9a34('0xb'),auth['isAuthenticated'](),controller[_0x9a34('0xc')]);router[_0x9a34('0xd')]('/',auth[_0x9a34('0x8')](),controller[_0x9a34('0xe')]);router['post'](_0x9a34('0xb'),auth[_0x9a34('0x8')](),controller[_0x9a34('0xf')]);router[_0x9a34('0x10')](_0x9a34('0x11'),auth['isAuthenticated'](),controller[_0x9a34('0x12')]);router[_0x9a34('0x13')](_0x9a34('0x11'),auth[_0x9a34('0x8')](),controller[_0x9a34('0x14')]);router[_0x9a34('0x13')](_0x9a34('0x15'),auth['isAuthenticated'](),controller[_0x9a34('0x16')]);module[_0x9a34('0x17')]=router; \ No newline at end of file +var _0xfc47=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/sounds','getSounds','post','create','addSound','update','delete','destroy','/:id/sounds/:id2','exports','multer','util','path'];(function(_0x30853f,_0x4aa320){var _0x3c416d=function(_0x15d3d2){while(--_0x15d3d2){_0x30853f['push'](_0x30853f['shift']());}};_0x3c416d(++_0x4aa320);}(_0xfc47,0xad));var _0x7fc4=function(_0x2cb633,_0x5caee0){_0x2cb633=_0x2cb633-0x0;var _0x4b1a20=_0xfc47[_0x2cb633];return _0x4b1a20;};'use strict';var multer=require(_0x7fc4('0x0'));var util=require(_0x7fc4('0x1'));var path=require(_0x7fc4('0x2'));var timeout=require(_0x7fc4('0x3'));var express=require(_0x7fc4('0x4'));var router=express[_0x7fc4('0x5')]();var fs_extra=require(_0x7fc4('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7fc4('0x7'));var config=require(_0x7fc4('0x8'));var controller=require('./voiceMusicOnHold.controller');router[_0x7fc4('0x9')]('/',auth[_0x7fc4('0xa')](),controller['index']);router[_0x7fc4('0x9')](_0x7fc4('0xb'),auth[_0x7fc4('0xa')](),controller['show']);router[_0x7fc4('0x9')](_0x7fc4('0xc'),auth[_0x7fc4('0xa')](),controller[_0x7fc4('0xd')]);router[_0x7fc4('0xe')]('/',auth['isAuthenticated'](),controller[_0x7fc4('0xf')]);router[_0x7fc4('0xe')]('/:id/sounds',auth['isAuthenticated'](),controller[_0x7fc4('0x10')]);router['put'](_0x7fc4('0xb'),auth[_0x7fc4('0xa')](),controller[_0x7fc4('0x11')]);router[_0x7fc4('0x12')](_0x7fc4('0xb'),auth[_0x7fc4('0xa')](),controller[_0x7fc4('0x13')]);router[_0x7fc4('0x12')](_0x7fc4('0x14'),auth['isAuthenticated'](),controller['removeSound']);module[_0x7fc4('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 484a73d..d792d04 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 _0x5609=['TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM','custom','files','mp3nb','quietmp3nb','alpha'];(function(_0x324218,_0x59513f){var _0x47cd42=function(_0x425c50){while(--_0x425c50){_0x324218['push'](_0x324218['shift']());}};_0x47cd42(++_0x59513f);}(_0x5609,0x157));var _0x9560=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x5609[_0x46e363];return _0x3fb059;};'use strict';var Sequelize=require(_0x9560('0x0'));module[_0x9560('0x1')]={'name':{'type':Sequelize[_0x9560('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x9560('0x3')](_0x9560('0x4'),_0x9560('0x5'),_0x9560('0x6'),_0x9560('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':_0x9560('0x5')},'directory':{'type':Sequelize[_0x9560('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x9560('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x9560('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x9560('0x2')],'allowNull':!![],'defaultValue':_0x9560('0x8')},'format':{'type':Sequelize[_0x9560('0x2')],'allowNull':!![]},'stamp':{'type':_0x9560('0x9')},'defaultEntry':{'type':Sequelize[_0x9560('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5b04=['sequelize','exports','STRING','name','ENUM','custom','quietmp3nb','mp3','files','alpha'];(function(_0x115d95,_0x5e7589){var _0x27fe57=function(_0x4149c9){while(--_0x4149c9){_0x115d95['push'](_0x115d95['shift']());}};_0x27fe57(++_0x5e7589);}(_0x5b04,0xfa));var _0x45b0=function(_0x59b43b,_0x3aeec3){_0x59b43b=_0x59b43b-0x0;var _0x241ef4=_0x5b04[_0x59b43b];return _0x241ef4;};'use strict';var Sequelize=require(_0x45b0('0x0'));module[_0x45b0('0x1')]={'name':{'type':Sequelize[_0x45b0('0x2')],'allowNull':![],'unique':_0x45b0('0x3')},'mode':{'type':Sequelize[_0x45b0('0x4')](_0x45b0('0x5'),'files','mp3nb',_0x45b0('0x6'),'quietmp3',_0x45b0('0x7')),'allowNull':!![],'defaultValue':_0x45b0('0x8')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x45b0('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x45b0('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x45b0('0x9')},'format':{'type':Sequelize[_0x45b0('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index e5e59af..5985d67 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 _0xf590=['error','name','send','index','VoiceMusicOnHold','rawAttributes','type','model','map','query','keys','filters','attributes','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','catch','params','intersection','fields','length','options','body','create','sequelize','files','directory','mode','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction','readdirSync','forEach','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','createdAt','server/files/sounds/converted','%s.%s','save_name','extname','converted_format','root','format','symlinkSync','removeSound','id2','getSounds','order','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','get','MusicOnHolds'];(function(_0x382d33,_0xb8304a){var _0x175f85=function(_0x25aa8f){while(--_0x25aa8f){_0x382d33['push'](_0x382d33['shift']());}};_0x175f85(++_0xb8304a);}(_0xf590,0x183));var _0x0f59=function(_0x37596a,_0xeaf59b){_0x37596a=_0x37596a-0x0;var _0x40228a=_0xf590[_0x37596a];return _0x40228a;};'use strict';var emlformat=require(_0x0f59('0x0'));var rimraf=require(_0x0f59('0x1'));var zipdir=require(_0x0f59('0x2'));var jsonpatch=require(_0x0f59('0x3'));var rp=require(_0x0f59('0x4'));var moment=require('moment');var BPromise=require(_0x0f59('0x5'));var Mustache=require(_0x0f59('0x6'));var util=require('util');var path=require(_0x0f59('0x7'));var sox=require(_0x0f59('0x8'));var csv=require(_0x0f59('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f59('0xa'));var _=require(_0x0f59('0xb'));var squel=require(_0x0f59('0xc'));var crypto=require(_0x0f59('0xd'));var jsforce=require(_0x0f59('0xe'));var deskjs=require(_0x0f59('0xf'));var toCsv=require(_0x0f59('0x9'));var querystring=require('querystring');var Papa=require(_0x0f59('0x10'));var Redis=require(_0x0f59('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0f59('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0f59('0x13'));var utils=require(_0x0f59('0x14'));var config=require(_0x0f59('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d8276,_0x445d7a){_0x445d7a=_0x445d7a||0xcc;return function(_0x27b90e){if(_0x27b90e){return _0x4d8276['sendStatus'](_0x445d7a);}return _0x4d8276[_0x0f59('0x16')](_0x445d7a)[_0x0f59('0x17')]();};}function respondWithResult(_0x1732b3,_0x3cf888){_0x3cf888=_0x3cf888||0xc8;return function(_0x44ff9c){if(_0x44ff9c){return _0x1732b3[_0x0f59('0x16')](_0x3cf888)[_0x0f59('0x18')](_0x44ff9c);}};}function respondWithFilteredResult(_0x11a478,_0xb4ddb2){return function(_0x5504c7){if(_0x5504c7){var _0x548250=typeof _0xb4ddb2['offset']===_0x0f59('0x19')&&typeof _0xb4ddb2['limit']===_0x0f59('0x19');var _0x3fd637=_0x5504c7[_0x0f59('0x1a')];var _0xa2e7c7=_0x548250?0x0:_0xb4ddb2[_0x0f59('0x1b')];var _0x3c86c5=_0x548250?_0x5504c7[_0x0f59('0x1a')]:_0xb4ddb2[_0x0f59('0x1b')]+_0xb4ddb2[_0x0f59('0x1c')];var _0x4828ed;if(_0x3c86c5>=_0x3fd637){_0x3c86c5=_0x3fd637;_0x4828ed=0xc8;}else{_0x4828ed=0xce;}_0x11a478[_0x0f59('0x16')](_0x4828ed);return _0x11a478['set'](_0x0f59('0x1d'),_0xa2e7c7+'-'+_0x3c86c5+'/'+_0x3fd637)['json'](_0x5504c7);}return null;};}function patchUpdates(_0x5abf39){return function(_0x5e7e84){try{jsonpatch[_0x0f59('0x1e')](_0x5e7e84,_0x5abf39,!![]);}catch(_0x1fbce3){return BPromise[_0x0f59('0x1f')](_0x1fbce3);}return _0x5e7e84[_0x0f59('0x20')]();};}function saveUpdates(_0x35f83f,_0x4ecb00){return function(_0xf8bfea){if(_0xf8bfea){return _0xf8bfea[_0x0f59('0x21')](_0x35f83f)[_0x0f59('0x22')](function(_0x3eeb6e){return _0x3eeb6e;});}return null;};}function removeEntity(_0x5cacd7,_0x1a666d){return function(_0x53ecd4){if(_0x53ecd4){return _0x53ecd4['destroy']()['then'](function(){var _0x46af3a=_0x53ecd4[_0x0f59('0x23')]({'plain':!![]});var _0x1581aa=_0x0f59('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x1581aa,'resourceId':_0x46af3a['id']}})['then'](function(){return _0x53ecd4;});})[_0x0f59('0x22')](function(){_0x5cacd7[_0x0f59('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x110380,_0x1376a6){return function(_0x3f0630){if(!_0x3f0630){_0x110380['sendStatus'](0x194);}return _0x3f0630;};}function handleError(_0x37ba10,_0x3450b7){_0x3450b7=_0x3450b7||0x1f4;return function(_0x5c4d22){logger[_0x0f59('0x25')](_0x5c4d22['stack']);if(_0x5c4d22[_0x0f59('0x26')]){delete _0x5c4d22[_0x0f59('0x26')];}_0x37ba10['status'](_0x3450b7)[_0x0f59('0x27')](_0x5c4d22);};}exports[_0x0f59('0x28')]=function(_0x8fde49,_0x455789){var _0x3004ae={},_0x7fef88={},_0x4c2635={'count':0x0,'rows':[]};var _0x1b7c71=_['map'](db[_0x0f59('0x29')][_0x0f59('0x2a')],function(_0x27f5df){return{'name':_0x27f5df['fieldName'],'type':_0x27f5df[_0x0f59('0x2b')]['key']};});_0x7fef88[_0x0f59('0x2c')]=_[_0x0f59('0x2d')](_0x1b7c71,_0x0f59('0x26'));_0x7fef88[_0x0f59('0x2e')]=_[_0x0f59('0x2f')](_0x8fde49[_0x0f59('0x2e')]);_0x7fef88[_0x0f59('0x30')]=_['intersection'](_0x7fef88[_0x0f59('0x2c')],_0x7fef88[_0x0f59('0x2e')]);_0x3004ae[_0x0f59('0x31')]=_['intersection'](_0x7fef88[_0x0f59('0x2c')],qs['fields'](_0x8fde49['query']['fields']));_0x3004ae[_0x0f59('0x31')]=_0x3004ae['attributes']['length']?_0x3004ae['attributes']:_0x7fef88['model'];if(!_0x8fde49['query']['hasOwnProperty']('nolimit')){_0x3004ae[_0x0f59('0x1c')]=qs[_0x0f59('0x1c')](_0x8fde49[_0x0f59('0x2e')][_0x0f59('0x1c')]);_0x3004ae[_0x0f59('0x1b')]=qs[_0x0f59('0x1b')](_0x8fde49['query'][_0x0f59('0x1b')]);}_0x3004ae['order']=qs[_0x0f59('0x32')](_0x8fde49[_0x0f59('0x2e')][_0x0f59('0x32')]);delete _0x8fde49[_0x0f59('0x2e')]['sort'];_0x3004ae[_0x0f59('0x33')]=qs['filters'](_['pick'](_0x8fde49[_0x0f59('0x2e')],_0x7fef88[_0x0f59('0x30')]),_0x1b7c71);if(_0x8fde49[_0x0f59('0x2e')]['filter']){_0x3004ae[_0x0f59('0x33')]=_[_0x0f59('0x34')](_0x3004ae[_0x0f59('0x33')],{'$or':_[_0x0f59('0x2d')](_0x1b7c71,function(_0x5aafa9){if(_0x5aafa9[_0x0f59('0x2b')]!==_0x0f59('0x35')){var _0x339529={};_0x339529[_0x5aafa9['name']]={'$like':'%'+_0x8fde49[_0x0f59('0x2e')][_0x0f59('0x36')]+'%'};return _0x339529;}})});}_0x3004ae=_['merge']({},_0x3004ae,_0x8fde49['options']);var _0x404144={'where':_0x3004ae['where']};return db['VoiceMusicOnHold']['count'](_0x404144)['then'](function(_0x6e3761){_0x4c2635[_0x0f59('0x1a')]=_0x6e3761;if(_0x8fde49[_0x0f59('0x2e')][_0x0f59('0x37')]){_0x3004ae[_0x0f59('0x38')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x0f59('0x39')](_0x3004ae);})[_0x0f59('0x22')](function(_0x5a0c2b){_0x4c2635['rows']=_0x5a0c2b;return _0x4c2635;})[_0x0f59('0x22')](respondWithFilteredResult(_0x455789,_0x3004ae))[_0x0f59('0x3a')](handleError(_0x455789,null));};exports['show']=function(_0x24a215,_0x4098d6){var _0x7526c5={'raw':![],'where':{'id':_0x24a215[_0x0f59('0x3b')]['id']}},_0x28940b={};_0x28940b[_0x0f59('0x2c')]=_[_0x0f59('0x2f')](db['VoiceMusicOnHold'][_0x0f59('0x2a')]);_0x28940b[_0x0f59('0x2e')]=_['keys'](_0x24a215[_0x0f59('0x2e')]);_0x28940b[_0x0f59('0x30')]=_[_0x0f59('0x3c')](_0x28940b[_0x0f59('0x2c')],_0x28940b[_0x0f59('0x2e')]);_0x7526c5[_0x0f59('0x31')]=_[_0x0f59('0x3c')](_0x28940b[_0x0f59('0x2c')],qs[_0x0f59('0x3d')](_0x24a215[_0x0f59('0x2e')][_0x0f59('0x3d')]));_0x7526c5['attributes']=_0x7526c5[_0x0f59('0x31')][_0x0f59('0x3e')]?_0x7526c5[_0x0f59('0x31')]:_0x28940b['model'];if(_0x24a215['query'][_0x0f59('0x37')]){_0x7526c5['include']=[{'all':!![]}];}_0x7526c5=_[_0x0f59('0x34')]({},_0x7526c5,_0x24a215[_0x0f59('0x3f')]);return db[_0x0f59('0x29')]['find'](_0x7526c5)['then'](handleEntityNotFound(_0x4098d6,null))[_0x0f59('0x22')](respondWithResult(_0x4098d6,null))[_0x0f59('0x3a')](handleError(_0x4098d6,null));};exports[_0x0f59('0x21')]=function(_0x2edb80,_0x451668){if(_0x2edb80['body']['id']){delete _0x2edb80[_0x0f59('0x40')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x2edb80[_0x0f59('0x3b')]['id']}})['then'](handleEntityNotFound(_0x451668,null))['then'](saveUpdates(_0x2edb80['body'],null))[_0x0f59('0x22')](respondWithResult(_0x451668,null))[_0x0f59('0x3a')](handleError(_0x451668,null));};exports[_0x0f59('0x41')]=function(_0x1fb68e,_0x2c5f47,_0x40a887){return db[_0x0f59('0x42')]['transaction'](function(_0x41b4f0){if(_0x1fb68e[_0x0f59('0x40')]['mode']===_0x0f59('0x43')){_0x1fb68e[_0x0f59('0x40')][_0x0f59('0x44')]=path['join'](config['root'],'server/files/moh',_0x1fb68e[_0x0f59('0x40')][_0x0f59('0x26')]);}return db[_0x0f59('0x29')]['create'](_0x1fb68e['body'],{'transaction':_0x41b4f0})[_0x0f59('0x22')](function(_0x4cfb5f){if(_0x1fb68e['body'][_0x0f59('0x45')]===_0x0f59('0x43')){fs[_0x0f59('0x46')](_0x4cfb5f[_0x0f59('0x44')],parseInt(_0x0f59('0x47'),0x8));}var _0x1ef72c=_0x1fb68e[_0x0f59('0x48')][_0x0f59('0x23')]({'plain':!![]});if(!_0x1ef72c)throw new Error(_0x0f59('0x49'));if(_0x1ef72c[_0x0f59('0x4a')]===_0x0f59('0x48')){var _0x31bf9c=_0x4cfb5f[_0x0f59('0x23')]({'plain':!![]});return db[_0x0f59('0x4b')]['find']({'where':{'name':_0x0f59('0x24'),'userProfileId':_0x1ef72c[_0x0f59('0x4c')]},'raw':!![]})[_0x0f59('0x22')](function(_0x152bfe){if(_0x152bfe&&_0x152bfe['autoAssociation']===0x0){return db[_0x0f59('0x4d')][_0x0f59('0x41')]({'name':_0x31bf9c[_0x0f59('0x26')],'resourceId':_0x31bf9c['id'],'type':_0x152bfe['name'],'sectionId':_0x152bfe['id']},{})[_0x0f59('0x22')](function(){return _0x4cfb5f;});}else{return _0x4cfb5f;}})['catch'](function(_0x4c0d63){logger[_0x0f59('0x25')](_0x0f59('0x4e'),_0x4c0d63);});}return _0x4cfb5f;});})[_0x0f59('0x22')](respondWithResult(_0x2c5f47,0xc9))[_0x0f59('0x3a')](handleError(_0x2c5f47,null));};exports[_0x0f59('0x4f')]=function(_0x4460bc,_0x36d241,_0x1a09db){var _0x73872c;return db[_0x0f59('0x29')]['find']({'where':{'id':_0x4460bc[_0x0f59('0x3b')]['id']}})[_0x0f59('0x22')](function(_0xcb4ed9){if(_0xcb4ed9){return db[_0x0f59('0x42')][_0x0f59('0x50')](function(_0x3acfde){return _0xcb4ed9['destroy']({'transaction':_0x3acfde,'raw':!![]})['then'](function(_0x537b66){if(_0x537b66[_0x0f59('0x44')]){fs[_0x0f59('0x51')](_0x537b66[_0x0f59('0x44')])[_0x0f59('0x52')](function(_0x3b5b4a){fs['unlinkSync'](path[_0x0f59('0x53')](_0x537b66['directory'],_0x3b5b4a));});fs[_0x0f59('0x54')](_0x537b66[_0x0f59('0x44')]);}return _0x537b66;});})[_0x0f59('0x3a')](function(_0x5628b7){throw new db[(_0x0f59('0x55'))][(_0x0f59('0x56'))](_0x5628b7[_0x0f59('0x57')]);});}})['then'](handleEntityNotFound(_0x36d241,null))['then'](removeEntity(_0x36d241,null))['catch'](handleError(_0x36d241,null));};exports[_0x0f59('0x58')]=function(_0x229e6f,_0x51c150,_0x19bfa2){return db[_0x0f59('0x42')][_0x0f59('0x50')](function(_0x2276be){var _0x454800;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x229e6f['params']['id']}})[_0x0f59('0x22')](function(_0x5ee387){if(_0x5ee387){_0x454800=_0x5ee387;return _0x5ee387['addSound'](_0x229e6f[_0x0f59('0x40')]['id'],{'transaction':_0x2276be});}})[_0x0f59('0x22')](function(_0xd6462a){if(_0xd6462a){return db[_0x0f59('0x59')][_0x0f59('0x5a')]({'where':{'id':_0x229e6f[_0x0f59('0x40')]['id']},'attributes':['id',_0x0f59('0x26'),'save_name','converted_format',_0x0f59('0x5b')],'raw':!![]});}})[_0x0f59('0x22')](function(_0x41fe7e){if(_0x41fe7e){var _0x169720=path['join'](config['root'],_0x0f59('0x5c'),util['format'](_0x0f59('0x5d'),path['basename'](_0x41fe7e[_0x0f59('0x5e')],path[_0x0f59('0x5f')](_0x41fe7e[_0x0f59('0x5e')])),_0x41fe7e[_0x0f59('0x60')]));var _0x2208ad=path[_0x0f59('0x53')](config[_0x0f59('0x61')],'server/files/moh',_0x454800[_0x0f59('0x26')],util[_0x0f59('0x62')]('%s.%s',_0x41fe7e[_0x0f59('0x26')],_0x41fe7e[_0x0f59('0x60')]));fs[_0x0f59('0x63')](_0x169720,_0x2208ad);return _0x41fe7e;}})[_0x0f59('0x3a')](function(_0x4bd2d4){throw new db[(_0x0f59('0x55'))][(_0x0f59('0x56'))](_0x4bd2d4[_0x0f59('0x57')]);});})[_0x0f59('0x22')](handleEntityNotFound(_0x51c150,null))[_0x0f59('0x22')](respondWithResult(_0x51c150,0xc9))[_0x0f59('0x3a')](handleError(_0x51c150,null));};exports[_0x0f59('0x64')]=function(_0x36d309,_0x14b43f,_0xbc91af){return db[_0x0f59('0x42')]['transaction'](function(_0x14a185){var _0x20f43a;return db[_0x0f59('0x29')]['findOne']({'where':{'id':_0x36d309[_0x0f59('0x3b')]['id']}})['then'](handleEntityNotFound(_0x14b43f,null))[_0x0f59('0x22')](function(_0x3e39c3){if(_0x3e39c3){_0x20f43a=_0x3e39c3;return _0x3e39c3['removeSound'](_0x36d309[_0x0f59('0x3b')][_0x0f59('0x65')]);}})[_0x0f59('0x22')](function(_0xdc6fb2){if(_0xdc6fb2){return db[_0x0f59('0x59')][_0x0f59('0x5a')]({'where':{'id':_0x36d309[_0x0f59('0x3b')][_0x0f59('0x65')]},'attributes':['id',_0x0f59('0x26'),'save_name',_0x0f59('0x60'),_0x0f59('0x5b')],'raw':!![]});}})['then'](function(_0x65eb1c){if(_0x65eb1c){fs['unlinkSync'](path['join'](_0x20f43a[_0x0f59('0x44')],util[_0x0f59('0x62')](_0x0f59('0x5d'),_0x65eb1c[_0x0f59('0x26')],_0x65eb1c['converted_format'])));return _0x65eb1c;}})[_0x0f59('0x3a')](function(_0x338984){throw new db[(_0x0f59('0x55'))]['ValidationError'](_0x338984['message']);});})[_0x0f59('0x22')](handleEntityNotFound(_0x14b43f,null))[_0x0f59('0x22')](respondWithStatusCode(_0x14b43f,0xcc))['catch'](handleError(_0x14b43f,null));};exports[_0x0f59('0x66')]=function(_0x494ace,_0x213beb,_0x1092fc){var _0x102fb1={};var _0x152905={};var _0x11b67b;var _0x34b6c3;return db[_0x0f59('0x29')][_0x0f59('0x5a')]({'where':{'id':_0x494ace[_0x0f59('0x3b')]['id']}})['then'](handleEntityNotFound(_0x213beb,null))[_0x0f59('0x22')](function(_0x43da53){if(_0x43da53){_0x11b67b=_0x43da53;_0x152905[_0x0f59('0x2c')]=_['keys'](db['Sound'][_0x0f59('0x2a')]);_0x152905[_0x0f59('0x2e')]=_['keys'](_0x494ace['query']);_0x152905[_0x0f59('0x30')]=_['intersection'](_0x152905[_0x0f59('0x2c')],_0x152905[_0x0f59('0x2e')]);_0x102fb1[_0x0f59('0x31')]=_[_0x0f59('0x3c')](_0x152905[_0x0f59('0x2c')],qs['fields'](_0x494ace['query'][_0x0f59('0x3d')]));_0x102fb1[_0x0f59('0x31')]=_0x102fb1[_0x0f59('0x31')]['length']?_0x102fb1[_0x0f59('0x31')]:_0x152905[_0x0f59('0x2c')];_0x102fb1[_0x0f59('0x67')]=qs[_0x0f59('0x32')](_0x494ace[_0x0f59('0x2e')][_0x0f59('0x32')]);_0x102fb1[_0x0f59('0x33')]=qs[_0x0f59('0x30')](_['pick'](_0x494ace[_0x0f59('0x2e')],_0x152905[_0x0f59('0x30')]));if(_0x494ace[_0x0f59('0x2e')][_0x0f59('0x36')]){_0x102fb1[_0x0f59('0x33')]=_[_0x0f59('0x34')](_0x102fb1[_0x0f59('0x33')],{'$or':_[_0x0f59('0x2d')](_0x102fb1[_0x0f59('0x31')],function(_0x24f0e8){var _0x46f8fc={};_0x46f8fc[_0x24f0e8]={'$like':'%'+_0x494ace[_0x0f59('0x2e')][_0x0f59('0x36')]+'%'};return _0x46f8fc;})});}_0x102fb1=_['merge']({},_0x102fb1,_0x494ace[_0x0f59('0x3f')]);return _0x11b67b['getSounds'](_0x102fb1);}})[_0x0f59('0x22')](function(_0x229831){if(_0x229831){_0x34b6c3=_0x229831[_0x0f59('0x3e')];if(!_0x494ace[_0x0f59('0x2e')][_0x0f59('0x68')](_0x0f59('0x69'))){_0x102fb1[_0x0f59('0x1c')]=qs[_0x0f59('0x1c')](_0x494ace[_0x0f59('0x2e')][_0x0f59('0x1c')]);_0x102fb1[_0x0f59('0x1b')]=qs[_0x0f59('0x1b')](_0x494ace['query'][_0x0f59('0x1b')]);}return _0x11b67b[_0x0f59('0x66')](_0x102fb1);}})[_0x0f59('0x22')](function(_0x16f922){if(_0x16f922){return _0x16f922?{'count':_0x34b6c3,'rows':_0x16f922}:null;}})['then'](respondWithResult(_0x213beb,null))['catch'](handleError(_0x213beb,null));}; \ No newline at end of file +var _0x506d=['forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','symlinkSync','removeSound','findOne','id2','getSounds','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','get','MusicOnHolds','UserProfileResource','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','update','body','sequelize','transaction','mode','files','root','server/files/moh','create','directory','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','readdirSync'];(function(_0x5e8157,_0x5aa29d){var _0x5c85af=function(_0x2856ff){while(--_0x2856ff){_0x5e8157['push'](_0x5e8157['shift']());}};_0x5c85af(++_0x5aa29d);}(_0x506d,0x82));var _0xd506=function(_0x2f894b,_0x45c62b){_0x2f894b=_0x2f894b-0x0;var _0x5e9870=_0x506d[_0x2f894b];return _0x5e9870;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd506('0x0'));var jsonpatch=require(_0xd506('0x1'));var rp=require(_0xd506('0x2'));var moment=require(_0xd506('0x3'));var BPromise=require(_0xd506('0x4'));var Mustache=require('mustache');var util=require(_0xd506('0x5'));var path=require(_0xd506('0x6'));var sox=require(_0xd506('0x7'));var csv=require(_0xd506('0x8'));var ejs=require(_0xd506('0x9'));var fs=require('fs');var fs_extra=require(_0xd506('0xa'));var _=require(_0xd506('0xb'));var squel=require(_0xd506('0xc'));var crypto=require('crypto');var jsforce=require(_0xd506('0xd'));var deskjs=require(_0xd506('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd506('0xf'));var Papa=require(_0xd506('0x10'));var Redis=require(_0xd506('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd506('0x12'));var hardwareService=require(_0xd506('0x13'));var logger=require(_0xd506('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd506('0x15'));var db=require(_0xd506('0x16'))['db'];function respondWithStatusCode(_0x174387,_0x44acee){_0x44acee=_0x44acee||0xcc;return function(_0x6a9ca){if(_0x6a9ca){return _0x174387[_0xd506('0x17')](_0x44acee);}return _0x174387[_0xd506('0x18')](_0x44acee)[_0xd506('0x19')]();};}function respondWithResult(_0x5bcc22,_0x424437){_0x424437=_0x424437||0xc8;return function(_0x5d2450){if(_0x5d2450){return _0x5bcc22[_0xd506('0x18')](_0x424437)['json'](_0x5d2450);}};}function respondWithFilteredResult(_0x10bb66,_0x3c804f){return function(_0x4fe841){if(_0x4fe841){var _0x504dd1=typeof _0x3c804f[_0xd506('0x1a')]==='undefined'&&typeof _0x3c804f['limit']===_0xd506('0x1b');var _0x43643b=_0x4fe841['count'];var _0x207175=_0x504dd1?0x0:_0x3c804f[_0xd506('0x1a')];var _0x2cfe17=_0x504dd1?_0x4fe841[_0xd506('0x1c')]:_0x3c804f[_0xd506('0x1a')]+_0x3c804f[_0xd506('0x1d')];var _0x730ac8;if(_0x2cfe17>=_0x43643b){_0x2cfe17=_0x43643b;_0x730ac8=0xc8;}else{_0x730ac8=0xce;}_0x10bb66[_0xd506('0x18')](_0x730ac8);return _0x10bb66[_0xd506('0x1e')](_0xd506('0x1f'),_0x207175+'-'+_0x2cfe17+'/'+_0x43643b)['json'](_0x4fe841);}return null;};}function patchUpdates(_0x38166e){return function(_0x5d9866){try{jsonpatch[_0xd506('0x20')](_0x5d9866,_0x38166e,!![]);}catch(_0x337eb9){return BPromise[_0xd506('0x21')](_0x337eb9);}return _0x5d9866['save']();};}function saveUpdates(_0x57447c,_0x2d1881){return function(_0x4fc9ea){if(_0x4fc9ea){return _0x4fc9ea['update'](_0x57447c)[_0xd506('0x22')](function(_0x1a145d){return _0x1a145d;});}return null;};}function removeEntity(_0x5a498a,_0x4f7fd5){return function(_0x464393){if(_0x464393){return _0x464393[_0xd506('0x23')]()[_0xd506('0x22')](function(){var _0x3be62b=_0x464393[_0xd506('0x24')]({'plain':!![]});var _0x5339b9=_0xd506('0x25');return db[_0xd506('0x26')][_0xd506('0x23')]({'where':{'type':_0x5339b9,'resourceId':_0x3be62b['id']}})[_0xd506('0x22')](function(){return _0x464393;});})[_0xd506('0x22')](function(){_0x5a498a['status'](0xcc)[_0xd506('0x19')]();});}};}function handleEntityNotFound(_0x52aeca,_0xd37ab2){return function(_0x548574){if(!_0x548574){_0x52aeca[_0xd506('0x17')](0x194);}return _0x548574;};}function handleError(_0x3d6ab1,_0x174cf8){_0x174cf8=_0x174cf8||0x1f4;return function(_0x4b8f53){logger[_0xd506('0x27')](_0x4b8f53['stack']);if(_0x4b8f53[_0xd506('0x28')]){delete _0x4b8f53[_0xd506('0x28')];}_0x3d6ab1[_0xd506('0x18')](_0x174cf8)[_0xd506('0x29')](_0x4b8f53);};}exports[_0xd506('0x2a')]=function(_0x1af319,_0x5dc645){var _0x5bb180={},_0x3cddca={},_0x35eab4={'count':0x0,'rows':[]};var _0x357679=_[_0xd506('0x2b')](db[_0xd506('0x2c')][_0xd506('0x2d')],function(_0x48fb56){return{'name':_0x48fb56[_0xd506('0x2e')],'type':_0x48fb56[_0xd506('0x2f')]['key']};});_0x3cddca[_0xd506('0x30')]=_[_0xd506('0x2b')](_0x357679,_0xd506('0x28'));_0x3cddca[_0xd506('0x31')]=_['keys'](_0x1af319['query']);_0x3cddca['filters']=_[_0xd506('0x32')](_0x3cddca[_0xd506('0x30')],_0x3cddca[_0xd506('0x31')]);_0x5bb180[_0xd506('0x33')]=_[_0xd506('0x32')](_0x3cddca[_0xd506('0x30')],qs[_0xd506('0x34')](_0x1af319[_0xd506('0x31')][_0xd506('0x34')]));_0x5bb180[_0xd506('0x33')]=_0x5bb180[_0xd506('0x33')][_0xd506('0x35')]?_0x5bb180[_0xd506('0x33')]:_0x3cddca['model'];if(!_0x1af319[_0xd506('0x31')][_0xd506('0x36')](_0xd506('0x37'))){_0x5bb180[_0xd506('0x1d')]=qs[_0xd506('0x1d')](_0x1af319[_0xd506('0x31')][_0xd506('0x1d')]);_0x5bb180['offset']=qs[_0xd506('0x1a')](_0x1af319[_0xd506('0x31')]['offset']);}_0x5bb180[_0xd506('0x38')]=qs[_0xd506('0x39')](_0x1af319[_0xd506('0x31')]['sort']);delete _0x1af319['query'][_0xd506('0x39')];_0x5bb180[_0xd506('0x3a')]=qs[_0xd506('0x3b')](_[_0xd506('0x3c')](_0x1af319[_0xd506('0x31')],_0x3cddca[_0xd506('0x3b')]),_0x357679);if(_0x1af319['query'][_0xd506('0x3d')]){_0x5bb180[_0xd506('0x3a')]=_[_0xd506('0x3e')](_0x5bb180[_0xd506('0x3a')],{'$or':_['map'](_0x357679,function(_0x230568){if(_0x230568[_0xd506('0x2f')]!==_0xd506('0x3f')){var _0x19ddc3={};_0x19ddc3[_0x230568[_0xd506('0x28')]]={'$like':'%'+_0x1af319['query'][_0xd506('0x3d')]+'%'};return _0x19ddc3;}})});}_0x5bb180=_[_0xd506('0x3e')]({},_0x5bb180,_0x1af319[_0xd506('0x40')]);var _0x5dd42e={'where':_0x5bb180[_0xd506('0x3a')]};return db[_0xd506('0x2c')]['count'](_0x5dd42e)[_0xd506('0x22')](function(_0x34c86e){_0x35eab4['count']=_0x34c86e;if(_0x1af319[_0xd506('0x31')][_0xd506('0x41')]){_0x5bb180[_0xd506('0x42')]=[{'all':!![]}];}return db[_0xd506('0x2c')][_0xd506('0x43')](_0x5bb180);})[_0xd506('0x22')](function(_0x327608){_0x35eab4[_0xd506('0x44')]=_0x327608;return _0x35eab4;})['then'](respondWithFilteredResult(_0x5dc645,_0x5bb180))[_0xd506('0x45')](handleError(_0x5dc645,null));};exports['show']=function(_0x89bb7d,_0x391e19){var _0xd64d77={'raw':![],'where':{'id':_0x89bb7d['params']['id']}},_0x2a9f3b={};_0x2a9f3b['model']=_[_0xd506('0x46')](db[_0xd506('0x2c')][_0xd506('0x2d')]);_0x2a9f3b[_0xd506('0x31')]=_[_0xd506('0x46')](_0x89bb7d['query']);_0x2a9f3b[_0xd506('0x3b')]=_[_0xd506('0x32')](_0x2a9f3b[_0xd506('0x30')],_0x2a9f3b[_0xd506('0x31')]);_0xd64d77[_0xd506('0x33')]=_[_0xd506('0x32')](_0x2a9f3b[_0xd506('0x30')],qs[_0xd506('0x34')](_0x89bb7d[_0xd506('0x31')][_0xd506('0x34')]));_0xd64d77[_0xd506('0x33')]=_0xd64d77[_0xd506('0x33')]['length']?_0xd64d77[_0xd506('0x33')]:_0x2a9f3b[_0xd506('0x30')];if(_0x89bb7d['query'][_0xd506('0x41')]){_0xd64d77[_0xd506('0x42')]=[{'all':!![]}];}_0xd64d77=_[_0xd506('0x3e')]({},_0xd64d77,_0x89bb7d['options']);return db['VoiceMusicOnHold'][_0xd506('0x47')](_0xd64d77)['then'](handleEntityNotFound(_0x391e19,null))[_0xd506('0x22')](respondWithResult(_0x391e19,null))[_0xd506('0x45')](handleError(_0x391e19,null));};exports[_0xd506('0x48')]=function(_0x36895e,_0x4d9965){if(_0x36895e[_0xd506('0x49')]['id']){delete _0x36895e[_0xd506('0x49')]['id'];}return db[_0xd506('0x2c')][_0xd506('0x47')]({'where':{'id':_0x36895e['params']['id']}})[_0xd506('0x22')](handleEntityNotFound(_0x4d9965,null))[_0xd506('0x22')](saveUpdates(_0x36895e[_0xd506('0x49')],null))[_0xd506('0x22')](respondWithResult(_0x4d9965,null))[_0xd506('0x45')](handleError(_0x4d9965,null));};exports['create']=function(_0x4d366e,_0xaec6e1,_0x2f534b){return db[_0xd506('0x4a')][_0xd506('0x4b')](function(_0x3ba720){if(_0x4d366e[_0xd506('0x49')][_0xd506('0x4c')]===_0xd506('0x4d')){_0x4d366e[_0xd506('0x49')]['directory']=path['join'](config[_0xd506('0x4e')],_0xd506('0x4f'),_0x4d366e[_0xd506('0x49')][_0xd506('0x28')]);}return db['VoiceMusicOnHold'][_0xd506('0x50')](_0x4d366e['body'],{'transaction':_0x3ba720})[_0xd506('0x22')](function(_0x219ed8){if(_0x4d366e[_0xd506('0x49')][_0xd506('0x4c')]===_0xd506('0x4d')){fs['mkdirSync'](_0x219ed8[_0xd506('0x51')],parseInt('0777',0x8));}var _0x239e05=_0x4d366e[_0xd506('0x52')]['get']({'plain':!![]});if(!_0x239e05)throw new Error(_0xd506('0x53'));if(_0x239e05[_0xd506('0x54')]===_0xd506('0x52')){var _0x532d91=_0x219ed8['get']({'plain':!![]});return db[_0xd506('0x55')][_0xd506('0x47')]({'where':{'name':_0xd506('0x25'),'userProfileId':_0x239e05[_0xd506('0x56')]},'raw':!![]})[_0xd506('0x22')](function(_0x26c6b3){if(_0x26c6b3&&_0x26c6b3['autoAssociation']===0x0){return db[_0xd506('0x26')][_0xd506('0x50')]({'name':_0x532d91['name'],'resourceId':_0x532d91['id'],'type':_0x26c6b3[_0xd506('0x28')],'sectionId':_0x26c6b3['id']},{})[_0xd506('0x22')](function(){return _0x219ed8;});}else{return _0x219ed8;}})['catch'](function(_0x4db2ad){logger[_0xd506('0x27')](_0xd506('0x57'),_0x4db2ad);});}return _0x219ed8;});})[_0xd506('0x22')](respondWithResult(_0xaec6e1,0xc9))[_0xd506('0x45')](handleError(_0xaec6e1,null));};exports[_0xd506('0x23')]=function(_0x405c54,_0x2598dd,_0x445860){var _0x9223d1;return db['VoiceMusicOnHold'][_0xd506('0x47')]({'where':{'id':_0x405c54[_0xd506('0x58')]['id']}})[_0xd506('0x22')](function(_0x45ff51){if(_0x45ff51){return db['sequelize']['transaction'](function(_0x158863){return _0x45ff51[_0xd506('0x23')]({'transaction':_0x158863,'raw':!![]})['then'](function(_0x20b7dd){if(_0x20b7dd[_0xd506('0x51')]){fs[_0xd506('0x59')](_0x20b7dd[_0xd506('0x51')])[_0xd506('0x5a')](function(_0x20db6b){fs[_0xd506('0x5b')](path['join'](_0x20b7dd[_0xd506('0x51')],_0x20db6b));});fs[_0xd506('0x5c')](_0x20b7dd['directory']);}return _0x20b7dd;});})[_0xd506('0x45')](function(_0x57db4a){throw new db[(_0xd506('0x5d'))][(_0xd506('0x5e'))](_0x57db4a[_0xd506('0x5f')]);});}})['then'](handleEntityNotFound(_0x2598dd,null))[_0xd506('0x22')](removeEntity(_0x2598dd,null))['catch'](handleError(_0x2598dd,null));};exports[_0xd506('0x60')]=function(_0x40819e,_0x41920d,_0x480bcd){return db[_0xd506('0x4a')][_0xd506('0x4b')](function(_0x4f861a){var _0x4d2a22;return db['VoiceMusicOnHold'][_0xd506('0x47')]({'where':{'id':_0x40819e[_0xd506('0x58')]['id']}})[_0xd506('0x22')](function(_0x22787f){if(_0x22787f){_0x4d2a22=_0x22787f;return _0x22787f[_0xd506('0x60')](_0x40819e[_0xd506('0x49')]['id'],{'transaction':_0x4f861a});}})[_0xd506('0x22')](function(_0x547a08){if(_0x547a08){return db[_0xd506('0x61')]['findOne']({'where':{'id':_0x40819e[_0xd506('0x49')]['id']},'attributes':['id',_0xd506('0x28'),'save_name',_0xd506('0x62'),_0xd506('0x63')],'raw':!![]});}})[_0xd506('0x22')](function(_0x1da534){if(_0x1da534){var _0x174927=path['join'](config[_0xd506('0x4e')],_0xd506('0x64'),util[_0xd506('0x65')](_0xd506('0x66'),path[_0xd506('0x67')](_0x1da534[_0xd506('0x68')],path['extname'](_0x1da534['save_name'])),_0x1da534[_0xd506('0x62')]));var _0x4ef9b8=path['join'](config[_0xd506('0x4e')],'server/files/moh',_0x4d2a22[_0xd506('0x28')],util[_0xd506('0x65')](_0xd506('0x66'),_0x1da534[_0xd506('0x28')],_0x1da534[_0xd506('0x62')]));fs[_0xd506('0x69')](_0x174927,_0x4ef9b8);return _0x1da534;}})[_0xd506('0x45')](function(_0x580c25){throw new db[(_0xd506('0x5d'))][(_0xd506('0x5e'))](_0x580c25['message']);});})['then'](handleEntityNotFound(_0x41920d,null))['then'](respondWithResult(_0x41920d,0xc9))[_0xd506('0x45')](handleError(_0x41920d,null));};exports[_0xd506('0x6a')]=function(_0x4b9f39,_0x4096b3,_0x1cb593){return db[_0xd506('0x4a')][_0xd506('0x4b')](function(_0x5461b7){var _0x28744f;return db[_0xd506('0x2c')][_0xd506('0x6b')]({'where':{'id':_0x4b9f39[_0xd506('0x58')]['id']}})[_0xd506('0x22')](handleEntityNotFound(_0x4096b3,null))['then'](function(_0x20d97d){if(_0x20d97d){_0x28744f=_0x20d97d;return _0x20d97d['removeSound'](_0x4b9f39['params'][_0xd506('0x6c')]);}})[_0xd506('0x22')](function(_0x12720d){if(_0x12720d){return db[_0xd506('0x61')][_0xd506('0x6b')]({'where':{'id':_0x4b9f39['params'][_0xd506('0x6c')]},'attributes':['id',_0xd506('0x28'),'save_name',_0xd506('0x62'),_0xd506('0x63')],'raw':!![]});}})[_0xd506('0x22')](function(_0x5d7e22){if(_0x5d7e22){fs[_0xd506('0x5b')](path['join'](_0x28744f[_0xd506('0x51')],util['format']('%s.%s',_0x5d7e22[_0xd506('0x28')],_0x5d7e22[_0xd506('0x62')])));return _0x5d7e22;}})['catch'](function(_0x529354){throw new db[(_0xd506('0x5d'))][(_0xd506('0x5e'))](_0x529354[_0xd506('0x5f')]);});})[_0xd506('0x22')](handleEntityNotFound(_0x4096b3,null))[_0xd506('0x22')](respondWithStatusCode(_0x4096b3,0xcc))[_0xd506('0x45')](handleError(_0x4096b3,null));};exports[_0xd506('0x6d')]=function(_0x5098c4,_0x5d79f6,_0xfb42d3){var _0x1c9343={};var _0x195c24={};var _0x595b1c;var _0x3cfb5d;return db[_0xd506('0x2c')]['findOne']({'where':{'id':_0x5098c4[_0xd506('0x58')]['id']}})[_0xd506('0x22')](handleEntityNotFound(_0x5d79f6,null))[_0xd506('0x22')](function(_0x5f279f){if(_0x5f279f){_0x595b1c=_0x5f279f;_0x195c24[_0xd506('0x30')]=_[_0xd506('0x46')](db[_0xd506('0x61')]['rawAttributes']);_0x195c24[_0xd506('0x31')]=_[_0xd506('0x46')](_0x5098c4['query']);_0x195c24[_0xd506('0x3b')]=_[_0xd506('0x32')](_0x195c24[_0xd506('0x30')],_0x195c24[_0xd506('0x31')]);_0x1c9343['attributes']=_[_0xd506('0x32')](_0x195c24[_0xd506('0x30')],qs['fields'](_0x5098c4['query'][_0xd506('0x34')]));_0x1c9343[_0xd506('0x33')]=_0x1c9343[_0xd506('0x33')][_0xd506('0x35')]?_0x1c9343['attributes']:_0x195c24[_0xd506('0x30')];_0x1c9343['order']=qs['sort'](_0x5098c4[_0xd506('0x31')]['sort']);_0x1c9343['where']=qs['filters'](_[_0xd506('0x3c')](_0x5098c4[_0xd506('0x31')],_0x195c24[_0xd506('0x3b')]));if(_0x5098c4[_0xd506('0x31')]['filter']){_0x1c9343[_0xd506('0x3a')]=_[_0xd506('0x3e')](_0x1c9343[_0xd506('0x3a')],{'$or':_[_0xd506('0x2b')](_0x1c9343[_0xd506('0x33')],function(_0xed53ae){var _0x224998={};_0x224998[_0xed53ae]={'$like':'%'+_0x5098c4['query'][_0xd506('0x3d')]+'%'};return _0x224998;})});}_0x1c9343=_['merge']({},_0x1c9343,_0x5098c4[_0xd506('0x40')]);return _0x595b1c[_0xd506('0x6d')](_0x1c9343);}})['then'](function(_0x35a14c){if(_0x35a14c){_0x3cfb5d=_0x35a14c[_0xd506('0x35')];if(!_0x5098c4['query']['hasOwnProperty'](_0xd506('0x37'))){_0x1c9343[_0xd506('0x1d')]=qs[_0xd506('0x1d')](_0x5098c4[_0xd506('0x31')][_0xd506('0x1d')]);_0x1c9343[_0xd506('0x1a')]=qs[_0xd506('0x1a')](_0x5098c4[_0xd506('0x31')][_0xd506('0x1a')]);}return _0x595b1c[_0xd506('0x6d')](_0x1c9343);}})[_0xd506('0x22')](function(_0x1d9fa9){if(_0x1d9fa9){return _0x1d9fa9?{'count':_0x3cfb5d,'rows':_0x1d9fa9}:null;}})['then'](respondWithResult(_0x5d79f6,null))[_0xd506('0x45')](handleError(_0x5d79f6,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 6a10f37..8d45074 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 _0x3ef0=['moment','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','lodash','../../config/logger','api'];(function(_0xd043c3,_0xcfa03e){var _0x35d80c=function(_0x4f47df){while(--_0x4f47df){_0xd043c3['push'](_0xd043c3['shift']());}};_0x35d80c(++_0xcfa03e);}(_0x3ef0,0x165));var _0x03ef=function(_0x1c8851,_0x539bb1){_0x1c8851=_0x1c8851-0x0;var _0x52ff28=_0x3ef0[_0x1c8851];return _0x52ff28;};'use strict';var _=require(_0x03ef('0x0'));var util=require('util');var logger=require(_0x03ef('0x1'))(_0x03ef('0x2'));var moment=require(_0x03ef('0x3'));var BPromise=require('bluebird');var rp=require(_0x03ef('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x03ef('0x5'));var config=require(_0x03ef('0x6'));var attributes=require(_0x03ef('0x7'));module[_0x03ef('0x8')]=function(_0x5dab60,_0x380a46){return _0x5dab60['define'](_0x03ef('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d2e=['../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x205328,_0x12c15a){var _0x4a30eb=function(_0x226d48){while(--_0x226d48){_0x205328['push'](_0x205328['shift']());}};_0x4a30eb(++_0x12c15a);}(_0x0d2e,0x110));var _0xe0d2=function(_0x551aef,_0x3a75be){_0x551aef=_0x551aef-0x0;var _0x4b5526=_0x0d2e[_0x551aef];return _0x4b5526;};'use strict';var _=require(_0xe0d2('0x0'));var util=require(_0xe0d2('0x1'));var logger=require(_0xe0d2('0x2'))(_0xe0d2('0x3'));var moment=require('moment');var BPromise=require(_0xe0d2('0x4'));var rp=require(_0xe0d2('0x5'));var fs=require('fs');var path=require(_0xe0d2('0x6'));var rimraf=require(_0xe0d2('0x7'));var config=require(_0xe0d2('0x8'));var attributes=require(_0xe0d2('0x9'));module[_0xe0d2('0xa')]=function(_0x595684,_0x316466){return _0x595684[_0xe0d2('0xb')](_0xe0d2('0xc'),attributes,{'tableName':_0xe0d2('0xd'),'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 0596ed2..b5ce466 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(_0x13ca70,_0x187fc0){var _0x119b55=function(_0x1044e1){while(--_0x1044e1){_0x13ca70['push'](_0x13ca70['shift']());}};_0x119b55(++_0x187fc0);}(_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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x127198,_0x1e0b1c){var _0x129aa4=function(_0x204b94){while(--_0x204b94){_0x127198['push'](_0x127198['shift']());}};_0x129aa4(++_0x1e0b1c);}(_0xe706,0xa3));var _0x6e70=function(_0x5dac46,_0x28e9dc){_0x5dac46=_0x5dac46-0x0;var _0x51095c=_0xe706[_0x5dac46];return _0x51095c;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index e20b4f4..f5cbc97 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 _0xc0c2=['destroy','removeAgents','removeTeams','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','/:id','update','delete'];(function(_0x3365ac,_0x5b9c67){var _0x3ec760=function(_0x3ab90f){while(--_0x3ab90f){_0x3365ac['push'](_0x3365ac['shift']());}};_0x3ec760(++_0x5b9c67);}(_0xc0c2,0x1b7));var _0x2c0c=function(_0x15ada9,_0x50f0a2){_0x15ada9=_0x15ada9-0x0;var _0x587361=_0xc0c2[_0x15ada9];return _0x587361;};'use strict';var multer=require('multer');var util=require(_0x2c0c('0x0'));var path=require(_0x2c0c('0x1'));var timeout=require(_0x2c0c('0x2'));var express=require(_0x2c0c('0x3'));var router=express['Router']();var fs_extra=require(_0x2c0c('0x4'));var auth=require(_0x2c0c('0x5'));var interaction=require(_0x2c0c('0x6'));var config=require(_0x2c0c('0x7'));var controller=require(_0x2c0c('0x8'));router[_0x2c0c('0x9')]('/',auth[_0x2c0c('0xa')](),controller[_0x2c0c('0xb')]);router['get']('/describe',auth[_0x2c0c('0xa')](),controller[_0x2c0c('0xc')]);router[_0x2c0c('0x9')]('/:id',auth[_0x2c0c('0xa')](),controller['show']);router[_0x2c0c('0x9')](_0x2c0c('0xd'),auth['isAuthenticated'](),controller[_0x2c0c('0xe')]);router[_0x2c0c('0x9')](_0x2c0c('0xf'),auth[_0x2c0c('0xa')](),controller[_0x2c0c('0x10')]);router[_0x2c0c('0x11')]('/',auth[_0x2c0c('0xa')](),controller[_0x2c0c('0x12')]);router[_0x2c0c('0x11')](_0x2c0c('0xd'),auth[_0x2c0c('0xa')](),controller[_0x2c0c('0x13')]);router['post'](_0x2c0c('0xf'),auth['isAuthenticated'](),controller[_0x2c0c('0x14')]);router[_0x2c0c('0x15')](_0x2c0c('0x16'),auth[_0x2c0c('0xa')](),controller[_0x2c0c('0x17')]);router[_0x2c0c('0x18')](_0x2c0c('0x16'),auth['isAuthenticated'](),controller[_0x2c0c('0x19')]);router[_0x2c0c('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0x2c0c('0x1a')]);router[_0x2c0c('0x18')](_0x2c0c('0xf'),auth[_0x2c0c('0xa')](),controller[_0x2c0c('0x1b')]);module[_0x2c0c('0x1c')]=router; \ No newline at end of file +var _0xf534=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','/:id/teams','getTeams','create','post','addAgents','put','update','delete','removeAgents','exports','multer','util'];(function(_0x5faafb,_0x2e763a){var _0x1d725b=function(_0xdfe0b){while(--_0xdfe0b){_0x5faafb['push'](_0x5faafb['shift']());}};_0x1d725b(++_0x2e763a);}(_0xf534,0x9a));var _0x4f53=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf534[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x4f53('0x0'));var util=require(_0x4f53('0x1'));var path=require('path');var timeout=require(_0x4f53('0x2'));var express=require('express');var router=express[_0x4f53('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4f53('0x4'));var interaction=require(_0x4f53('0x5'));var config=require(_0x4f53('0x6'));var controller=require(_0x4f53('0x7'));router[_0x4f53('0x8')]('/',auth[_0x4f53('0x9')](),controller[_0x4f53('0xa')]);router['get'](_0x4f53('0xb'),auth['isAuthenticated'](),controller[_0x4f53('0xc')]);router[_0x4f53('0x8')](_0x4f53('0xd'),auth[_0x4f53('0x9')](),controller[_0x4f53('0xe')]);router[_0x4f53('0x8')](_0x4f53('0xf'),auth[_0x4f53('0x9')](),controller['getAgents']);router[_0x4f53('0x8')](_0x4f53('0x10'),auth[_0x4f53('0x9')](),controller[_0x4f53('0x11')]);router['post']('/',auth[_0x4f53('0x9')](),controller[_0x4f53('0x12')]);router[_0x4f53('0x13')]('/:id/users',auth[_0x4f53('0x9')](),controller[_0x4f53('0x14')]);router[_0x4f53('0x13')](_0x4f53('0x10'),auth[_0x4f53('0x9')](),controller['addTeams']);router[_0x4f53('0x15')]('/:id',auth[_0x4f53('0x9')](),controller[_0x4f53('0x16')]);router[_0x4f53('0x17')](_0x4f53('0xd'),auth[_0x4f53('0x9')](),controller['destroy']);router['delete']('/:id/users',auth[_0x4f53('0x9')](),controller[_0x4f53('0x18')]);router['delete'](_0x4f53('0x10'),auth[_0x4f53('0x9')](),controller['removeTeams']);module[_0x4f53('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 2e0e6f6..715218a 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 _0x9a2f=['name','VIRTUAL','system-','getDataValue','STRING','INTEGER','sequelize'];(function(_0x541c1a,_0x540f9c){var _0x3b81df=function(_0x46cee7){while(--_0x46cee7){_0x541c1a['push'](_0x541c1a['shift']());}};_0x3b81df(++_0x540f9c);}(_0x9a2f,0x125));var _0xf9a2=function(_0x542be7,_0x5b042a){_0x542be7=_0x542be7-0x0;var _0x4d3814=_0x9a2f[_0x542be7];return _0x4d3814;};'use strict';var Sequelize=require(_0xf9a2('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf9a2('0x1')},'prefix':{'type':Sequelize[_0xf9a2('0x2')],'get':function(_0x12c053){return _0xf9a2('0x3')+this[_0xf9a2('0x4')](_0xf9a2('0x1'))+'-';}},'description':{'type':Sequelize[_0xf9a2('0x5')]},'callerIdAll':{'type':Sequelize[_0xf9a2('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0xf9a2('0x6')]}}; \ No newline at end of file +var _0xe8af=['STRING','INTEGER','sequelize','exports','name','VIRTUAL','system-','getDataValue'];(function(_0x6a62f5,_0x42b15a){var _0x3d6f3d=function(_0x5b2c3e){while(--_0x5b2c3e){_0x6a62f5['push'](_0x6a62f5['shift']());}};_0x3d6f3d(++_0x42b15a);}(_0xe8af,0xba));var _0xfe8a=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0xe8af[_0x39772f];return _0xc9edbf;};'use strict';var Sequelize=require(_0xfe8a('0x0'));module[_0xfe8a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfe8a('0x2')},'prefix':{'type':Sequelize[_0xfe8a('0x3')],'get':function(_0x54cce6){return _0xfe8a('0x4')+this[_0xfe8a('0x5')](_0xfe8a('0x2'))+'-';}},'description':{'type':Sequelize[_0xfe8a('0x6')]},'callerIdAll':{'type':Sequelize[_0xfe8a('0x6')]},'VoiceExtensionId':{'type':Sequelize[_0xfe8a('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index de3a112..ee0cdc5 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 _0xef0f=['sequelize','transaction','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','order','where','filter','getTeams','findOne','Team','online','interface','Agents','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','SELECT','every','TeamId','includes','all','compact','isEmpty','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','end','status','json','offset','undefined','limit','count','set','reject','save','destroy','then','get','UserProfileResource','sendStatus','error','name','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','VIRTUAL','options','VoicePrefix','includeAll','include','findAll','catch','show','params','rawAttributes','find','describe','create','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','VoicePrefixes','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','map','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','${EXTEN:','charAt','update','system-'];(function(_0x2757d0,_0x1b806d){var _0x220254=function(_0x27bcdb){while(--_0x27bcdb){_0x2757d0['push'](_0x2757d0['shift']());}};_0x220254(++_0x1b806d);}(_0xef0f,0x168));var _0xfef0=function(_0x2ca117,_0x436b00){_0x2ca117=_0x2ca117-0x0;var _0x9b4a25=_0xef0f[_0x2ca117];return _0x9b4a25;};'use strict';var emlformat=require(_0xfef0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfef0('0x1'));var jsonpatch=require(_0xfef0('0x2'));var rp=require(_0xfef0('0x3'));var moment=require('moment');var BPromise=require(_0xfef0('0x4'));var Mustache=require(_0xfef0('0x5'));var util=require(_0xfef0('0x6'));var path=require('path');var sox=require(_0xfef0('0x7'));var csv=require(_0xfef0('0x8'));var ejs=require(_0xfef0('0x9'));var fs=require('fs');var fs_extra=require(_0xfef0('0xa'));var _=require(_0xfef0('0xb'));var squel=require(_0xfef0('0xc'));var crypto=require('crypto');var jsforce=require(_0xfef0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xfef0('0x8'));var querystring=require(_0xfef0('0xe'));var Papa=require(_0xfef0('0xf'));var Redis=require(_0xfef0('0x10'));var authService=require(_0xfef0('0x11'));var qs=require(_0xfef0('0x12'));var as=require(_0xfef0('0x13'));var hardwareService=require(_0xfef0('0x14'));var logger=require(_0xfef0('0x15'))(_0xfef0('0x16'));var utils=require(_0xfef0('0x17'));var config=require(_0xfef0('0x18'));var licenseUtil=require(_0xfef0('0x19'));var db=require(_0xfef0('0x1a'))['db'];config['redis']=_[_0xfef0('0x1b')](config[_0xfef0('0x1c')],{'host':_0xfef0('0x1d'),'port':0x18eb});var socket=require(_0xfef0('0x1e'))(new Redis(config[_0xfef0('0x1c')]));require(_0xfef0('0x1f'))[_0xfef0('0x20')](socket);function respondWithStatusCode(_0x573ae7,_0x3d1f02){_0x3d1f02=_0x3d1f02||0xcc;return function(_0x554aaa){if(_0x554aaa){return _0x573ae7['sendStatus'](_0x3d1f02);}return _0x573ae7['status'](_0x3d1f02)[_0xfef0('0x21')]();};}function respondWithResult(_0x284b6d,_0x3510a7){_0x3510a7=_0x3510a7||0xc8;return function(_0x1bce2f){if(_0x1bce2f){return _0x284b6d[_0xfef0('0x22')](_0x3510a7)[_0xfef0('0x23')](_0x1bce2f);}};}function respondWithFilteredResult(_0x155833,_0x2887e6){return function(_0x581459){if(_0x581459){var _0xd60678=typeof _0x2887e6[_0xfef0('0x24')]===_0xfef0('0x25')&&typeof _0x2887e6[_0xfef0('0x26')]===_0xfef0('0x25');var _0x55912f=_0x581459[_0xfef0('0x27')];var _0x4e24de=_0xd60678?0x0:_0x2887e6[_0xfef0('0x24')];var _0x1a0aa0=_0xd60678?_0x581459[_0xfef0('0x27')]:_0x2887e6['offset']+_0x2887e6[_0xfef0('0x26')];var _0x4c304d;if(_0x1a0aa0>=_0x55912f){_0x1a0aa0=_0x55912f;_0x4c304d=0xc8;}else{_0x4c304d=0xce;}_0x155833[_0xfef0('0x22')](_0x4c304d);return _0x155833[_0xfef0('0x28')]('Content-Range',_0x4e24de+'-'+_0x1a0aa0+'/'+_0x55912f)['json'](_0x581459);}return null;};}function patchUpdates(_0x4b8b22){return function(_0x19fde8){try{jsonpatch['apply'](_0x19fde8,_0x4b8b22,!![]);}catch(_0x1f9970){return BPromise[_0xfef0('0x29')](_0x1f9970);}return _0x19fde8[_0xfef0('0x2a')]();};}function saveUpdates(_0x4483f2,_0x249fe4){return function(_0xd687ed){if(_0xd687ed){return _0xd687ed['update'](_0x4483f2)['then'](function(_0x316e20){return _0x316e20;});}return null;};}function removeEntity(_0x1ffaa4,_0x924f6e){return function(_0x34ca65){if(_0x34ca65){return _0x34ca65[_0xfef0('0x2b')]()[_0xfef0('0x2c')](function(){var _0x5df04f=_0x34ca65[_0xfef0('0x2d')]({'plain':!![]});var _0x391279='VoicePrefixes';return db[_0xfef0('0x2e')][_0xfef0('0x2b')]({'where':{'type':_0x391279,'resourceId':_0x5df04f['id']}})[_0xfef0('0x2c')](function(){return _0x34ca65;});})[_0xfef0('0x2c')](function(){_0x1ffaa4[_0xfef0('0x22')](0xcc)[_0xfef0('0x21')]();});}};}function handleEntityNotFound(_0x3e3c4c,_0x3e026a){return function(_0x26cb9a){if(!_0x26cb9a){_0x3e3c4c[_0xfef0('0x2f')](0x194);}return _0x26cb9a;};}function handleError(_0x3ee42f,_0x3ffea0){_0x3ffea0=_0x3ffea0||0x1f4;return function(_0x51af0f){logger[_0xfef0('0x30')](_0x51af0f['stack']);if(_0x51af0f['name']){delete _0x51af0f[_0xfef0('0x31')];}_0x3ee42f[_0xfef0('0x22')](_0x3ffea0)['send'](_0x51af0f);};}exports['index']=function(_0x5cf518,_0x4f65cd){var _0x4cce8a={},_0x417535={},_0x172d94={'count':0x0,'rows':[]};var _0x2fffae=_['map'](db['VoicePrefix']['rawAttributes'],function(_0x1f8110){return{'name':_0x1f8110['fieldName'],'type':_0x1f8110[_0xfef0('0x32')][_0xfef0('0x33')]};});_0x417535[_0xfef0('0x34')]=_['map'](_0x2fffae,_0xfef0('0x31'));_0x417535['query']=_[_0xfef0('0x35')](_0x5cf518[_0xfef0('0x36')]);_0x417535[_0xfef0('0x37')]=_[_0xfef0('0x38')](_0x417535[_0xfef0('0x34')],_0x417535[_0xfef0('0x36')]);_0x4cce8a[_0xfef0('0x39')]=_[_0xfef0('0x38')](_0x417535['model'],qs[_0xfef0('0x3a')](_0x5cf518[_0xfef0('0x36')][_0xfef0('0x3a')]));_0x4cce8a[_0xfef0('0x39')]=_0x4cce8a[_0xfef0('0x39')][_0xfef0('0x3b')]?_0x4cce8a[_0xfef0('0x39')]:_0x417535[_0xfef0('0x34')];if(!_0x5cf518[_0xfef0('0x36')][_0xfef0('0x3c')](_0xfef0('0x3d'))){_0x4cce8a[_0xfef0('0x26')]=qs[_0xfef0('0x26')](_0x5cf518['query'][_0xfef0('0x26')]);_0x4cce8a['offset']=qs[_0xfef0('0x24')](_0x5cf518[_0xfef0('0x36')][_0xfef0('0x24')]);}_0x4cce8a['order']=qs[_0xfef0('0x3e')](_0x5cf518[_0xfef0('0x36')][_0xfef0('0x3e')]);_0x4cce8a['where']=qs[_0xfef0('0x37')](_[_0xfef0('0x3f')](_0x5cf518[_0xfef0('0x36')],_0x417535['filters']),_0x2fffae);if(_0x5cf518[_0xfef0('0x36')]['filter']){_0x4cce8a['where']=_[_0xfef0('0x40')](_0x4cce8a['where'],{'$or':_['map'](_0x2fffae,function(_0xbf6ddd){if(_0xbf6ddd[_0xfef0('0x32')]!==_0xfef0('0x41')){var _0x1a6593={};_0x1a6593[_0xbf6ddd[_0xfef0('0x31')]]={'$like':'%'+_0x5cf518[_0xfef0('0x36')]['filter']+'%'};return _0x1a6593;}})});}_0x4cce8a=_[_0xfef0('0x40')]({},_0x4cce8a,_0x5cf518[_0xfef0('0x42')]);var _0x5a9ed3={'where':_0x4cce8a['where']};return db[_0xfef0('0x43')]['count'](_0x5a9ed3)[_0xfef0('0x2c')](function(_0x22c940){_0x172d94[_0xfef0('0x27')]=_0x22c940;if(_0x5cf518[_0xfef0('0x36')][_0xfef0('0x44')]){_0x4cce8a[_0xfef0('0x45')]=[{'all':!![]}];}return db[_0xfef0('0x43')][_0xfef0('0x46')](_0x4cce8a);})['then'](function(_0x1813dc){_0x172d94['rows']=_0x1813dc;return _0x172d94;})['then'](respondWithFilteredResult(_0x4f65cd,_0x4cce8a))[_0xfef0('0x47')](handleError(_0x4f65cd,null));};exports[_0xfef0('0x48')]=function(_0x5bf416,_0x2af79f){var _0x5587a9={'raw':![],'where':{'id':_0x5bf416[_0xfef0('0x49')]['id']}},_0x39df7c={};_0x39df7c[_0xfef0('0x34')]=_[_0xfef0('0x35')](db['VoicePrefix'][_0xfef0('0x4a')]);_0x39df7c[_0xfef0('0x36')]=_['keys'](_0x5bf416['query']);_0x39df7c[_0xfef0('0x37')]=_['intersection'](_0x39df7c[_0xfef0('0x34')],_0x39df7c[_0xfef0('0x36')]);_0x5587a9[_0xfef0('0x39')]=_[_0xfef0('0x38')](_0x39df7c[_0xfef0('0x34')],qs[_0xfef0('0x3a')](_0x5bf416['query'][_0xfef0('0x3a')]));_0x5587a9['attributes']=_0x5587a9['attributes'][_0xfef0('0x3b')]?_0x5587a9[_0xfef0('0x39')]:_0x39df7c[_0xfef0('0x34')];if(_0x5bf416['query'][_0xfef0('0x44')]){_0x5587a9['include']=[{'all':!![]}];}_0x5587a9=_['merge']({},_0x5587a9,_0x5bf416['options']);return db[_0xfef0('0x43')][_0xfef0('0x4b')](_0x5587a9)[_0xfef0('0x2c')](handleEntityNotFound(_0x2af79f,null))[_0xfef0('0x2c')](respondWithResult(_0x2af79f,null))[_0xfef0('0x47')](handleError(_0x2af79f,null));};exports[_0xfef0('0x2b')]=function(_0x1b78af,_0x3853bb){return db[_0xfef0('0x43')]['find']({'where':{'id':_0x1b78af['params']['id']}})[_0xfef0('0x2c')](handleEntityNotFound(_0x3853bb,null))[_0xfef0('0x2c')](removeEntity(_0x3853bb,null))[_0xfef0('0x47')](handleError(_0x3853bb,null));};exports[_0xfef0('0x4c')]=function(_0x393fee,_0x1e1458){return db[_0xfef0('0x43')][_0xfef0('0x4c')]()['then'](respondWithResult(_0x1e1458,null))[_0xfef0('0x47')](handleError(_0x1e1458,null));};exports[_0xfef0('0x4d')]=function(_0x247caf,_0x10378e){var _0x6591d4;return db['sequelize']['transaction'](function(_0x523763){return db[_0xfef0('0x43')][_0xfef0('0x4d')](_0x247caf[_0xfef0('0x4e')],{'transaction':_0x523763})[_0xfef0('0x2c')](function(_0x4e959e){_0x6591d4=_0x4e959e[_0xfef0('0x2d')]({'plain':!![]});return db[_0xfef0('0x4f')][_0xfef0('0x4b')]({'where':{'id':_0x6591d4[_0xfef0('0x50')]},'raw':!![]})[_0xfef0('0x2c')](function(_0x2f94c4){return createVoicePrefixExtensions(_0x6591d4,_0x2f94c4,_0x523763);});});})[_0xfef0('0x2c')](function(){var _0x4cd0fd=_0x247caf[_0xfef0('0x51')][_0xfef0('0x2d')]({'plain':!![]});if(!_0x4cd0fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4cd0fd[_0xfef0('0x52')]==='user'){var _0x175e97=_0x6591d4;return db[_0xfef0('0x53')]['find']({'where':{'name':_0xfef0('0x54'),'userProfileId':_0x4cd0fd['userProfileId']},'raw':!![]})['then'](function(_0x4812c7){if(_0x4812c7&&_0x4812c7[_0xfef0('0x55')]===0x0){return db[_0xfef0('0x2e')][_0xfef0('0x4d')]({'name':_0x175e97[_0xfef0('0x31')],'resourceId':_0x175e97['id'],'type':_0x4812c7[_0xfef0('0x31')],'sectionId':_0x4812c7['id']},{})[_0xfef0('0x2c')](function(){return _0x6591d4;});}else{return _0x6591d4;}})['catch'](function(_0xa365e5){logger[_0xfef0('0x30')](_0xfef0('0x56'),_0xa365e5);throw _0xa365e5;});}return _0x6591d4;})[_0xfef0('0x2c')](respondWithResult(_0x10378e,null))[_0xfef0('0x47')](handleError(_0x10378e,null));};function Extension(_0x58d95e,_0x59d1b6,_0x4aef94,_0x135653){this['context']=_0xfef0('0x57');this[_0xfef0('0x58')]=_0x58d95e;this[_0xfef0('0x59')]=_0x4aef94;this[_0xfef0('0x32')]=_0xfef0('0x5a');this['description']=_0xfef0('0x5b');this['priority']=_0x59d1b6;this[_0xfef0('0x5c')]=_0x135653;}function createVoicePrefixExtensions(_0x4a1316,_0x4a4d36,_0x3a12c5){return new BPromise(function(_0x3c5640,_0xd6de4d){var _0x35a486=new Extension(formatPrefixName(_0x4a1316[_0xfef0('0x5d')]),0x1,_0xfef0('0x5e'),_0xfef0('0x5f'));_0x35a486[_0xfef0('0x60')]=_0x4a1316['id'];return db[_0xfef0('0x4f')][_0xfef0('0x4d')](_0x35a486,{'transaction':_0x3a12c5})[_0xfef0('0x2c')](function(_0x46d0bb){var _0x5df358=_0x46d0bb[_0xfef0('0x2d')]({'plain':!![]});var _0x3b660c=_[_0xfef0('0x61')](addVoicePrefixExtensions(_0x4a1316,_0x4a4d36),function(_0x312dcf){_0x312dcf[_0xfef0('0x50')]=_0x5df358['id'];_0x312dcf['VoicePrefixId']=_0x4a1316['id'];return _0x312dcf;});return db[_0xfef0('0x4f')][_0xfef0('0x62')](_0x3b660c,{'transaction':_0x3a12c5})[_0xfef0('0x2c')](function(_0x3c6bb8){if(!_0x3c6bb8){return _0xd6de4d(_0xfef0('0x63'));}else{return _0x3c5640(_0x3c6bb8);}})[_0xfef0('0x47')](function(_0xb9693b){return _0xd6de4d(_0xb9693b);});});;});};function addVoicePrefixExtensions(_0x103ca3,_0x14d53d){var _0x3f26d9=[];var _0x4f7ad3=formatPrefixName(_0x103ca3[_0xfef0('0x5d')]);_0x3f26d9['push'](new Extension(_0x4f7ad3,0x2,_0xfef0('0x64'),_0xfef0('0x65')+_0x103ca3['name']));if(_0x103ca3[_0xfef0('0x66')]){_0x3f26d9[_0xfef0('0x67')](new Extension(_0x4f7ad3,0x3,_0xfef0('0x64'),_0xfef0('0x68')+_0x103ca3[_0xfef0('0x66')]));}else{_0x3f26d9['push'](new Extension(_0x4f7ad3,0x3,_0xfef0('0x5e'),_0xfef0('0x69')));}_0x3f26d9[_0xfef0('0x67')](new Extension(_0x4f7ad3,0x4,'goto',_0x14d53d[_0xfef0('0x6a')]+','+_0xfef0('0x6b')+(0x8+_0x103ca3[_0xfef0('0x31')][_0xfef0('0x3b')])+'}'+','+0x1));return _0x3f26d9;}function formatPrefixName(_0x7186c8){var _0x3cfe32='_';for(var _0x45ba65=0x0;_0x45ba65<_0x7186c8['length'];_0x45ba65++){if(_0x7186c8[_0xfef0('0x6c')](_0x45ba65)=='-'){_0x3cfe32+=_0x7186c8[_0xfef0('0x6c')](_0x45ba65);}else{_0x3cfe32+='['+_0x7186c8[_0xfef0('0x6c')](_0x45ba65)+']';}}_0x3cfe32+='.';return _0x3cfe32;}exports[_0xfef0('0x6d')]=function(_0x317eda,_0x2dde67,_0x488db4){var _0x340517=_0x317eda[_0xfef0('0x4e')];_0x340517[_0xfef0('0x5d')]=_0xfef0('0x6e')+_0x340517['name']+'-';return db[_0xfef0('0x6f')][_0xfef0('0x70')](function(_0x5a33a1){return db[_0xfef0('0x43')][_0xfef0('0x6d')](_0x340517,{'where':{'id':_0x340517['id']},'transaction':_0x5a33a1})[_0xfef0('0x2c')](function(){return db[_0xfef0('0x4f')][_0xfef0('0x2b')]({'where':{'VoicePrefixId':_0x340517['id']},'transaction':_0x5a33a1})['then'](function(){return db['VoiceExtension']['find']({'where':{'id':_0x340517[_0xfef0('0x50')]},'raw':!![]})[_0xfef0('0x2c')](function(_0x2474b2){return createVoicePrefixExtensions(_0x340517,_0x2474b2,_0x5a33a1);});});});})['then'](function(){return db[_0xfef0('0x43')]['findById'](_0x340517['id']);})['then'](respondWithResult(_0x2dde67,null))['catch'](handleError(_0x2dde67,null));};exports[_0xfef0('0x71')]=function(_0x1cf182,_0x50cd7a,_0x166aab){return db[_0xfef0('0x43')][_0xfef0('0x4b')]({'where':{'id':_0x1cf182['params']['id']}})[_0xfef0('0x2c')](handleEntityNotFound(_0x50cd7a,null))['then'](function(_0x5ee0c0){if(_0x5ee0c0){return _0x5ee0c0[_0xfef0('0x71')](_0x1cf182[_0xfef0('0x4e')][_0xfef0('0x72')],_[_0xfef0('0x73')](_0x1cf182['body'],['ids','id'])||{})['spread'](function(_0xd973d3){for(var _0x546455=0x0;_0x546455<_0x1cf182[_0xfef0('0x4e')][_0xfef0('0x72')][_0xfef0('0x3b')];_0x546455+=0x1){socket[_0xfef0('0x74')](_0xfef0('0x75'),{'UserId':Number(_0x1cf182['body'][_0xfef0('0x72')][_0x546455]),'VoicePrefixId':Number(_0x1cf182['params']['id'])});}return _0xd973d3;});}})['then'](respondWithResult(_0x50cd7a,null))[_0xfef0('0x47')](handleError(_0x50cd7a,null));};exports[_0xfef0('0x76')]=function(_0xc30175,_0x3bfe3f,_0x5a17a9){return db['VoicePrefix'][_0xfef0('0x4b')]({'where':{'id':_0xc30175[_0xfef0('0x49')]['id']}})['then'](handleEntityNotFound(_0x3bfe3f,null))[_0xfef0('0x2c')](function(_0x3bbb7e){if(_0x3bbb7e){return _0x3bbb7e[_0xfef0('0x76')](_0xc30175[_0xfef0('0x36')][_0xfef0('0x72')])[_0xfef0('0x2c')](function(){if(_[_0xfef0('0x77')](_0xc30175[_0xfef0('0x36')][_0xfef0('0x72')])){for(var _0x52fe45=0x0;_0x52fe45<_0xc30175[_0xfef0('0x36')][_0xfef0('0x72')][_0xfef0('0x3b')];_0x52fe45+=0x1){socket[_0xfef0('0x74')](_0xfef0('0x78'),{'UserId':Number(_0xc30175[_0xfef0('0x36')][_0xfef0('0x72')][_0x52fe45]),'VoicePrefixId':Number(_0xc30175['params']['id'])});}}else{socket[_0xfef0('0x74')](_0xfef0('0x78'),{'UserId':Number(_0xc30175[_0xfef0('0x36')][_0xfef0('0x72')]),'VoicePrefixId':Number(_0xc30175[_0xfef0('0x49')]['id'])});}});}})[_0xfef0('0x2c')](respondWithStatusCode(_0x3bfe3f,null))[_0xfef0('0x47')](handleError(_0x3bfe3f,null));};exports[_0xfef0('0x79')]=function(_0x32944e,_0x39c591,_0x1f2413){var _0x17c350={};var _0x283d5a={};var _0x5630a6;var _0x32aab6;return db['VoicePrefix']['findOne']({'where':{'id':_0x32944e[_0xfef0('0x49')]['id']}})[_0xfef0('0x2c')](handleEntityNotFound(_0x39c591,null))['then'](function(_0x299116){if(_0x299116){_0x5630a6=_0x299116;_0x283d5a['model']=_['keys'](db[_0xfef0('0x7a')][_0xfef0('0x4a')]);_0x283d5a[_0xfef0('0x36')]=_[_0xfef0('0x35')](_0x32944e['query']);_0x283d5a[_0xfef0('0x37')]=_[_0xfef0('0x38')](_0x283d5a['model'],_0x283d5a[_0xfef0('0x36')]);_0x17c350[_0xfef0('0x39')]=_[_0xfef0('0x38')](_0x283d5a['model'],qs['fields'](_0x32944e[_0xfef0('0x36')]['fields']));_0x17c350['attributes']=_0x17c350[_0xfef0('0x39')]['length']?_0x17c350[_0xfef0('0x39')]:_0x283d5a[_0xfef0('0x34')];_0x17c350[_0xfef0('0x7b')]=qs[_0xfef0('0x3e')](_0x32944e[_0xfef0('0x36')][_0xfef0('0x3e')]);_0x17c350[_0xfef0('0x7c')]=qs[_0xfef0('0x37')](_[_0xfef0('0x3f')](_0x32944e[_0xfef0('0x36')],_0x283d5a['filters']));if(_0x32944e[_0xfef0('0x36')]['filter']){_0x17c350['where']=_[_0xfef0('0x40')](_0x17c350['where'],{'$or':_[_0xfef0('0x61')](_0x17c350[_0xfef0('0x39')],function(_0x2e7268){var _0x34b802={};_0x34b802[_0x2e7268]={'$like':'%'+_0x32944e[_0xfef0('0x36')][_0xfef0('0x7d')]+'%'};return _0x34b802;})});}_0x17c350=_['merge']({},_0x17c350,_0x32944e[_0xfef0('0x42')]);return _0x5630a6[_0xfef0('0x79')](_0x17c350);}})[_0xfef0('0x2c')](function(_0x17a514){if(_0x17a514){_0x32aab6=_0x17a514[_0xfef0('0x3b')];if(!_0x32944e[_0xfef0('0x36')][_0xfef0('0x3c')](_0xfef0('0x3d'))){_0x17c350['limit']=qs[_0xfef0('0x26')](_0x32944e[_0xfef0('0x36')]['limit']);_0x17c350[_0xfef0('0x24')]=qs[_0xfef0('0x24')](_0x32944e[_0xfef0('0x36')]['offset']);}return _0x5630a6[_0xfef0('0x79')](_0x17c350);}})['then'](function(_0x1cb952){if(_0x1cb952){return _0x1cb952?{'count':_0x32aab6,'rows':_0x1cb952}:null;}})[_0xfef0('0x2c')](respondWithResult(_0x39c591,null))['catch'](handleError(_0x39c591,null));};exports[_0xfef0('0x7e')]=function(_0x51f79b,_0x1fa881,_0x8c4979){var _0x1b8ee7={};var _0x3eff14={};var _0x14d871;var _0x306319;return db[_0xfef0('0x43')][_0xfef0('0x7f')]({'where':{'id':_0x51f79b[_0xfef0('0x49')]['id']}})[_0xfef0('0x2c')](handleEntityNotFound(_0x1fa881,null))[_0xfef0('0x2c')](function(_0x5b7ffa){if(_0x5b7ffa){_0x14d871=_0x5b7ffa;_0x3eff14[_0xfef0('0x34')]=_['keys'](db['Team'][_0xfef0('0x4a')]);_0x3eff14['query']=_[_0xfef0('0x35')](_0x51f79b['query']);_0x3eff14['filters']=_[_0xfef0('0x38')](_0x3eff14['model'],_0x3eff14['query']);_0x1b8ee7['attributes']=_[_0xfef0('0x38')](_0x3eff14[_0xfef0('0x34')],qs[_0xfef0('0x3a')](_0x51f79b[_0xfef0('0x36')]['fields']));_0x1b8ee7[_0xfef0('0x39')]=_0x1b8ee7[_0xfef0('0x39')][_0xfef0('0x3b')]?_0x1b8ee7[_0xfef0('0x39')]:_0x3eff14[_0xfef0('0x34')];_0x1b8ee7['order']=qs['sort'](_0x51f79b[_0xfef0('0x36')][_0xfef0('0x3e')]);_0x1b8ee7['where']=qs[_0xfef0('0x37')](_[_0xfef0('0x3f')](_0x51f79b[_0xfef0('0x36')],_0x3eff14[_0xfef0('0x37')]));if(_0x51f79b[_0xfef0('0x36')][_0xfef0('0x7d')]){_0x1b8ee7[_0xfef0('0x7c')]=_[_0xfef0('0x40')](_0x1b8ee7['where'],{'$or':_['map'](_0x1b8ee7[_0xfef0('0x39')],function(_0x4135b0){var _0x14fc20={};_0x14fc20[_0x4135b0]={'$like':'%'+_0x51f79b[_0xfef0('0x36')][_0xfef0('0x7d')]+'%'};return _0x14fc20;})});}_0x1b8ee7=_[_0xfef0('0x40')]({},_0x1b8ee7,_0x51f79b[_0xfef0('0x42')]);return _0x14d871[_0xfef0('0x7e')](_0x1b8ee7);}})['then'](function(_0x5d7df9){if(_0x5d7df9){_0x306319=_0x5d7df9[_0xfef0('0x3b')];if(!_0x51f79b[_0xfef0('0x36')][_0xfef0('0x3c')](_0xfef0('0x3d'))){_0x1b8ee7[_0xfef0('0x26')]=qs[_0xfef0('0x26')](_0x51f79b['query'][_0xfef0('0x26')]);_0x1b8ee7[_0xfef0('0x24')]=qs['offset'](_0x51f79b[_0xfef0('0x36')][_0xfef0('0x24')]);}return _0x14d871[_0xfef0('0x7e')](_0x1b8ee7);}})[_0xfef0('0x2c')](function(_0x3b8b10){if(_0x3b8b10){return _0x3b8b10?{'count':_0x306319,'rows':_0x3b8b10}:null;}})[_0xfef0('0x2c')](respondWithResult(_0x1fa881,null))['catch'](handleError(_0x1fa881,null));};exports['addTeams']=function(_0x1084b9,_0xd7c5b,_0xd2c0be){var _0x15eefc=_0x1084b9[_0xfef0('0x4e')][_0xfef0('0x72')];var _0x4df302;return db[_0xfef0('0x80')]['findAll']({'where':{'id':_0x15eefc},'attributes':['id'],'include':[{'model':db[_0xfef0('0x7a')],'as':'Agents','attributes':['id',_0xfef0('0x31'),_0xfef0('0x81'),'voicePause',_0xfef0('0x82')],'raw':!![]}]})[_0xfef0('0x2c')](function(_0xc91fea){if(_0xc91fea){_0x4df302=_0xc91fea;var _0x4d56e5=_['flatMap'](_0xc91fea,function(_0x57083a){var _0x3a28b2=_0x57083a['get']({'plain':!![]});return _0x3a28b2[_0xfef0('0x83')];});return db[_0xfef0('0x43')]['find']({'where':{'id':_0x1084b9[_0xfef0('0x49')]['id']}})['then'](function(_0x43ee5f){return db[_0xfef0('0x6f')][_0xfef0('0x70')](function(_0x1a9ed3){return _0x43ee5f[_0xfef0('0x84')](_0x15eefc,{'transaction':_0x1a9ed3})[_0xfef0('0x2c')](function(){return BPromise[_0xfef0('0x85')](_0x4df302,function(_0x53ecba){return db[_0xfef0('0x86')][_0xfef0('0x87')]({'TeamId':_0x53ecba['id'],'VoicePrefixId':_0x1084b9[_0xfef0('0x49')]['id']},{'transaction':_0x1a9ed3});});})[_0xfef0('0x2c')](function(){return BPromise[_0xfef0('0x85')](_0x4d56e5,function(_0x110ef9){return db[_0xfef0('0x88')][_0xfef0('0x89')]({'where':{'UserId':_0x110ef9['id'],'VoicePrefixId':_0x1084b9[_0xfef0('0x49')]['id']},'transaction':_0x1a9ed3});});})[_0xfef0('0x2c')](function(){_0x4d56e5[_0xfef0('0x8a')](function(_0x34f1db){socket[_0xfef0('0x74')](_0xfef0('0x75'),{'UserId':_0x34f1db['id'],'VoicePrefixId':_0x43ee5f['id']});});});});});}})['then'](respondWithStatusCode(_0xd7c5b,null))[_0xfef0('0x47')](handleError(_0xd7c5b,null));};exports[_0xfef0('0x8b')]=function(_0x29ad24,_0x1ee5ad,_0xeea2ff){return db[_0xfef0('0x80')][_0xfef0('0x46')]({'where':{'id':_0x29ad24[_0xfef0('0x36')][_0xfef0('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfef0('0x2c')](handleEntityNotFound(_0x1ee5ad,null))['then'](function(_0x63704){var _0x3d85ec=_[_0xfef0('0x61')](_0x63704,'id');var _0x17ab00=[];var _0xd9c290=[];var _0x365938=squel[_0xfef0('0x8c')]();_0x365938[_0xfef0('0x8d')](_0xfef0('0x8e'))[_0xfef0('0x8f')](_0xfef0('0x90'),'tq')['join'](_0xfef0('0x91'),'ut',_0xfef0('0x92'))['where'](_0xfef0('0x93'),_0x29ad24[_0xfef0('0x49')]['id']);for(var _0x524db7=0x0;_0x524db7<_0x63704[_0xfef0('0x3b')];_0x524db7+=0x1){let _0x591f01=_0x63704[_0x524db7];for(var _0x6ccbf8=0x0;_0x6ccbf8<_0x591f01[_0xfef0('0x83')][_0xfef0('0x3b')];_0x6ccbf8+=0x1){let _0xdf3db9=_0x591f01[_0xfef0('0x83')][_0x6ccbf8];var _0x520ff3=_0x365938[_0xfef0('0x94')]();_0x520ff3[_0xfef0('0x7c')]('ut.UserId\x20=\x20?',_0xdf3db9['id']);_0xd9c290[_0xfef0('0x67')](db['sequelize'][_0xfef0('0x36')](_0x520ff3[_0xfef0('0x95')](),{'type':db[_0xfef0('0x6f')]['QueryTypes'][_0xfef0('0x96')]})['then'](function(_0x5dde37){if(_0x5dde37[_0xfef0('0x3b')]===0x1){return _0xdf3db9['id'];}else{var _0x57b2b4=_[_0xfef0('0x97')](_[_0xfef0('0x61')](_0x5dde37,_0xfef0('0x98')),function(_0x11c5f0){return _[_0xfef0('0x99')](_0x3d85ec,_0x11c5f0);});if(_0x57b2b4){return _0xdf3db9['id'];}}}));}}return BPromise[_0xfef0('0x9a')](_0xd9c290)[_0xfef0('0x2c')](function(_0x547b4d){_0x17ab00=_(_0x17ab00)['union'](_0x547b4d)[_0xfef0('0x9b')]()['value']();return db[_0xfef0('0x43')][_0xfef0('0x4b')]({'where':{'id':_0x29ad24[_0xfef0('0x49')]['id']}})[_0xfef0('0x2c')](function(_0x3f9588){return db[_0xfef0('0x6f')][_0xfef0('0x70')](function(_0x326c85){return _0x3f9588['removeTeams'](_0x29ad24['query'][_0xfef0('0x72')],{'transaction':_0x326c85})[_0xfef0('0x2c')](function(){if(!_[_0xfef0('0x9c')](_0x17ab00)){return _0x3f9588[_0xfef0('0x76')](_0x17ab00,{'transaction':_0x326c85});}})[_0xfef0('0x2c')](function(){_0x17ab00['forEach'](function(_0x54d98e){socket['emit'](_0xfef0('0x78'),{'UserId':_0x54d98e,'VoicePrefixId':_0x3f9588['id']});});});});});});})[_0xfef0('0x2c')](respondWithStatusCode(_0x1ee5ad,null))['catch'](handleError(_0x1ee5ad,null));}; \ No newline at end of file +var _0xbaf0=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','VoicePrefixes','UserProfileResource','end','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','find','catch','describe','create','sequelize','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','VoiceExtension','VoicePrefixId','bulkCreate','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','body','prefix','system-','ids','omit','spread','userVoicePrefix:save','params','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','QueryTypes','SELECT','TeamId','includes','compact','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js'];(function(_0x4b2e44,_0x3303f7){var _0x4fe1ed=function(_0x3293ba){while(--_0x3293ba){_0x4b2e44['push'](_0x4b2e44['shift']());}};_0x4fe1ed(++_0x3303f7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0baf('0x0'));var zipdir=require(_0x0baf('0x1'));var jsonpatch=require(_0x0baf('0x2'));var rp=require(_0x0baf('0x3'));var moment=require(_0x0baf('0x4'));var BPromise=require(_0x0baf('0x5'));var Mustache=require('mustache');var util=require(_0x0baf('0x6'));var path=require(_0x0baf('0x7'));var sox=require(_0x0baf('0x8'));var csv=require(_0x0baf('0x9'));var ejs=require(_0x0baf('0xa'));var fs=require('fs');var fs_extra=require(_0x0baf('0xb'));var _=require(_0x0baf('0xc'));var squel=require(_0x0baf('0xd'));var crypto=require(_0x0baf('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0baf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0baf('0x10'));var Papa=require(_0x0baf('0x11'));var Redis=require(_0x0baf('0x12'));var authService=require(_0x0baf('0x13'));var qs=require(_0x0baf('0x14'));var as=require(_0x0baf('0x15'));var hardwareService=require(_0x0baf('0x16'));var logger=require(_0x0baf('0x17'))(_0x0baf('0x18'));var utils=require(_0x0baf('0x19'));var config=require(_0x0baf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0baf('0x1b')]=_[_0x0baf('0x1c')](config[_0x0baf('0x1b')],{'host':_0x0baf('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0baf('0x1b')]));require('./voicePrefix.socket')[_0x0baf('0x1e')](socket);function respondWithStatusCode(_0x1f50c3,_0x7fbf67){_0x7fbf67=_0x7fbf67||0xcc;return function(_0x2bc381){if(_0x2bc381){return _0x1f50c3[_0x0baf('0x1f')](_0x7fbf67);}return _0x1f50c3[_0x0baf('0x20')](_0x7fbf67)['end']();};}function respondWithResult(_0x4cd79d,_0x2312c7){_0x2312c7=_0x2312c7||0xc8;return function(_0x38395b){if(_0x38395b){return _0x4cd79d[_0x0baf('0x20')](_0x2312c7)[_0x0baf('0x21')](_0x38395b);}};}function respondWithFilteredResult(_0x2cf7da,_0x288a98){return function(_0x53c338){if(_0x53c338){var _0x63c820=typeof _0x288a98[_0x0baf('0x22')]===_0x0baf('0x23')&&typeof _0x288a98[_0x0baf('0x24')]===_0x0baf('0x23');var _0x42b7f2=_0x53c338['count'];var _0x5cff5d=_0x63c820?0x0:_0x288a98[_0x0baf('0x22')];var _0x154f48=_0x63c820?_0x53c338[_0x0baf('0x25')]:_0x288a98[_0x0baf('0x22')]+_0x288a98[_0x0baf('0x24')];var _0x3e3e20;if(_0x154f48>=_0x42b7f2){_0x154f48=_0x42b7f2;_0x3e3e20=0xc8;}else{_0x3e3e20=0xce;}_0x2cf7da[_0x0baf('0x20')](_0x3e3e20);return _0x2cf7da[_0x0baf('0x26')](_0x0baf('0x27'),_0x5cff5d+'-'+_0x154f48+'/'+_0x42b7f2)[_0x0baf('0x21')](_0x53c338);}return null;};}function patchUpdates(_0x54f2fa){return function(_0x334bd6){try{jsonpatch['apply'](_0x334bd6,_0x54f2fa,!![]);}catch(_0xf6c158){return BPromise['reject'](_0xf6c158);}return _0x334bd6['save']();};}function saveUpdates(_0x2ef0aa,_0x48a0e9){return function(_0x4be1b9){if(_0x4be1b9){return _0x4be1b9[_0x0baf('0x28')](_0x2ef0aa)[_0x0baf('0x29')](function(_0x34e264){return _0x34e264;});}return null;};}function removeEntity(_0x19d9fd,_0x3a1ba1){return function(_0x56b299){if(_0x56b299){return _0x56b299[_0x0baf('0x2a')]()[_0x0baf('0x29')](function(){var _0x1ca35a=_0x56b299[_0x0baf('0x2b')]({'plain':!![]});var _0x3843b8=_0x0baf('0x2c');return db[_0x0baf('0x2d')]['destroy']({'where':{'type':_0x3843b8,'resourceId':_0x1ca35a['id']}})[_0x0baf('0x29')](function(){return _0x56b299;});})[_0x0baf('0x29')](function(){_0x19d9fd[_0x0baf('0x20')](0xcc)[_0x0baf('0x2e')]();});}};}function handleEntityNotFound(_0x55c715,_0x29dbdf){return function(_0x34a58a){if(!_0x34a58a){_0x55c715['sendStatus'](0x194);}return _0x34a58a;};}function handleError(_0x44ec31,_0x32e4fb){_0x32e4fb=_0x32e4fb||0x1f4;return function(_0x478ce8){logger[_0x0baf('0x2f')](_0x478ce8[_0x0baf('0x30')]);if(_0x478ce8[_0x0baf('0x31')]){delete _0x478ce8[_0x0baf('0x31')];}_0x44ec31['status'](_0x32e4fb)[_0x0baf('0x32')](_0x478ce8);};}exports[_0x0baf('0x33')]=function(_0x37be4e,_0x3ed995){var _0x24ecee={},_0x275ea1={},_0x2fc983={'count':0x0,'rows':[]};var _0x2f0a45=_[_0x0baf('0x34')](db[_0x0baf('0x35')][_0x0baf('0x36')],function(_0x165d14){return{'name':_0x165d14[_0x0baf('0x37')],'type':_0x165d14[_0x0baf('0x38')]['key']};});_0x275ea1[_0x0baf('0x39')]=_['map'](_0x2f0a45,_0x0baf('0x31'));_0x275ea1[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x37be4e[_0x0baf('0x3a')]);_0x275ea1['filters']=_[_0x0baf('0x3c')](_0x275ea1[_0x0baf('0x39')],_0x275ea1['query']);_0x24ecee[_0x0baf('0x3d')]=_[_0x0baf('0x3c')](_0x275ea1[_0x0baf('0x39')],qs[_0x0baf('0x3e')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x24ecee[_0x0baf('0x3d')]=_0x24ecee[_0x0baf('0x3d')]['length']?_0x24ecee[_0x0baf('0x3d')]:_0x275ea1[_0x0baf('0x39')];if(!_0x37be4e['query'][_0x0baf('0x3f')]('nolimit')){_0x24ecee['limit']=qs[_0x0baf('0x24')](_0x37be4e[_0x0baf('0x3a')]['limit']);_0x24ecee['offset']=qs[_0x0baf('0x22')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x22')]);}_0x24ecee[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x41')]);_0x24ecee[_0x0baf('0x42')]=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x37be4e[_0x0baf('0x3a')],_0x275ea1[_0x0baf('0x43')]),_0x2f0a45);if(_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x45')]){_0x24ecee['where']=_[_0x0baf('0x46')](_0x24ecee[_0x0baf('0x42')],{'$or':_['map'](_0x2f0a45,function(_0x38006a){if(_0x38006a[_0x0baf('0x38')]!==_0x0baf('0x47')){var _0x299f93={};_0x299f93[_0x38006a[_0x0baf('0x31')]]={'$like':'%'+_0x37be4e[_0x0baf('0x3a')]['filter']+'%'};return _0x299f93;}})});}_0x24ecee=_[_0x0baf('0x46')]({},_0x24ecee,_0x37be4e[_0x0baf('0x48')]);var _0x540c41={'where':_0x24ecee[_0x0baf('0x42')]};return db[_0x0baf('0x35')][_0x0baf('0x25')](_0x540c41)[_0x0baf('0x29')](function(_0x504031){_0x2fc983[_0x0baf('0x25')]=_0x504031;if(_0x37be4e[_0x0baf('0x3a')][_0x0baf('0x49')]){_0x24ecee[_0x0baf('0x4a')]=[{'all':!![]}];}return db[_0x0baf('0x35')][_0x0baf('0x4b')](_0x24ecee);})[_0x0baf('0x29')](function(_0x1fa237){_0x2fc983[_0x0baf('0x4c')]=_0x1fa237;return _0x2fc983;})[_0x0baf('0x29')](respondWithFilteredResult(_0x3ed995,_0x24ecee))['catch'](handleError(_0x3ed995,null));};exports[_0x0baf('0x4d')]=function(_0x2bc755,_0x1daf1d){var _0x339aff={'raw':![],'where':{'id':_0x2bc755['params']['id']}},_0x22207a={};_0x22207a[_0x0baf('0x39')]=_[_0x0baf('0x3b')](db[_0x0baf('0x35')][_0x0baf('0x36')]);_0x22207a[_0x0baf('0x3a')]=_['keys'](_0x2bc755[_0x0baf('0x3a')]);_0x22207a[_0x0baf('0x43')]=_[_0x0baf('0x3c')](_0x22207a[_0x0baf('0x39')],_0x22207a[_0x0baf('0x3a')]);_0x339aff[_0x0baf('0x3d')]=_[_0x0baf('0x3c')](_0x22207a['model'],qs[_0x0baf('0x3e')](_0x2bc755[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x339aff['attributes']=_0x339aff[_0x0baf('0x3d')][_0x0baf('0x4e')]?_0x339aff[_0x0baf('0x3d')]:_0x22207a[_0x0baf('0x39')];if(_0x2bc755[_0x0baf('0x3a')][_0x0baf('0x49')]){_0x339aff[_0x0baf('0x4a')]=[{'all':!![]}];}_0x339aff=_['merge']({},_0x339aff,_0x2bc755[_0x0baf('0x48')]);return db[_0x0baf('0x35')][_0x0baf('0x4f')](_0x339aff)[_0x0baf('0x29')](handleEntityNotFound(_0x1daf1d,null))[_0x0baf('0x29')](respondWithResult(_0x1daf1d,null))[_0x0baf('0x50')](handleError(_0x1daf1d,null));};exports[_0x0baf('0x2a')]=function(_0x1af4aa,_0x2be7fe){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x1af4aa['params']['id']}})['then'](handleEntityNotFound(_0x2be7fe,null))[_0x0baf('0x29')](removeEntity(_0x2be7fe,null))[_0x0baf('0x50')](handleError(_0x2be7fe,null));};exports[_0x0baf('0x51')]=function(_0xb8fa28,_0x21b108){return db[_0x0baf('0x35')][_0x0baf('0x51')]()['then'](respondWithResult(_0x21b108,null))[_0x0baf('0x50')](handleError(_0x21b108,null));};exports[_0x0baf('0x52')]=function(_0xf2424,_0x16d9fb){var _0x3fdb41;return db[_0x0baf('0x53')]['transaction'](function(_0x3eebe5){return db['VoicePrefix'][_0x0baf('0x52')](_0xf2424['body'],{'transaction':_0x3eebe5})[_0x0baf('0x29')](function(_0x5eaeb2){_0x3fdb41=_0x5eaeb2[_0x0baf('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0x0baf('0x4f')]({'where':{'id':_0x3fdb41[_0x0baf('0x54')]},'raw':!![]})[_0x0baf('0x29')](function(_0x4520d1){return createVoicePrefixExtensions(_0x3fdb41,_0x4520d1,_0x3eebe5);});});})[_0x0baf('0x29')](function(){var _0x576475=_0xf2424[_0x0baf('0x55')][_0x0baf('0x2b')]({'plain':!![]});if(!_0x576475)throw new Error(_0x0baf('0x56'));if(_0x576475[_0x0baf('0x57')]===_0x0baf('0x55')){var _0xa19b21=_0x3fdb41;return db['UserProfileSection'][_0x0baf('0x4f')]({'where':{'name':_0x0baf('0x2c'),'userProfileId':_0x576475[_0x0baf('0x58')]},'raw':!![]})[_0x0baf('0x29')](function(_0xbc7cc2){if(_0xbc7cc2&&_0xbc7cc2[_0x0baf('0x59')]===0x0){return db[_0x0baf('0x2d')]['create']({'name':_0xa19b21['name'],'resourceId':_0xa19b21['id'],'type':_0xbc7cc2[_0x0baf('0x31')],'sectionId':_0xbc7cc2['id']},{})[_0x0baf('0x29')](function(){return _0x3fdb41;});}else{return _0x3fdb41;}})[_0x0baf('0x50')](function(_0x337d94){logger[_0x0baf('0x2f')](_0x0baf('0x5a'),_0x337d94);throw _0x337d94;});}return _0x3fdb41;})[_0x0baf('0x29')](respondWithResult(_0x16d9fb,null))[_0x0baf('0x50')](handleError(_0x16d9fb,null));};function Extension(_0x3d9a32,_0x585969,_0x3238f9,_0x268be8){this[_0x0baf('0x5b')]=_0x0baf('0x5c');this[_0x0baf('0x5d')]=_0x3d9a32;this[_0x0baf('0x5e')]=_0x3238f9;this[_0x0baf('0x38')]='system';this[_0x0baf('0x5f')]=_0x0baf('0x60');this[_0x0baf('0x61')]=_0x585969;this[_0x0baf('0x62')]=_0x268be8;}function createVoicePrefixExtensions(_0x1c7d88,_0x1a6d22,_0x14e6d0){return new BPromise(function(_0x12543e,_0x498405){var _0x178495=new Extension(formatPrefixName(_0x1c7d88['prefix']),0x1,_0x0baf('0x63'),'Voice\x20Prefix');_0x178495['VoicePrefixId']=_0x1c7d88['id'];return db[_0x0baf('0x64')]['create'](_0x178495,{'transaction':_0x14e6d0})[_0x0baf('0x29')](function(_0x2b17f8){var _0x49d713=_0x2b17f8[_0x0baf('0x2b')]({'plain':!![]});var _0xfb6708=_[_0x0baf('0x34')](addVoicePrefixExtensions(_0x1c7d88,_0x1a6d22),function(_0x5b3c1d){_0x5b3c1d['VoiceExtensionId']=_0x49d713['id'];_0x5b3c1d[_0x0baf('0x65')]=_0x1c7d88['id'];return _0x5b3c1d;});return db[_0x0baf('0x64')][_0x0baf('0x66')](_0xfb6708,{'transaction':_0x14e6d0})[_0x0baf('0x29')](function(_0x784e1a){if(!_0x784e1a){return _0x498405('Extensions\x20creation\x20failed');}else{return _0x12543e(_0x784e1a);}})[_0x0baf('0x50')](function(_0x4c02ca){return _0x498405(_0x4c02ca);});});;});};function addVoicePrefixExtensions(_0x5d5751,_0x59a0b2){var _0x427ed1=[];var _0x58a366=formatPrefixName(_0x5d5751['prefix']);_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x2,_0x0baf('0x68'),_0x0baf('0x69')+_0x5d5751[_0x0baf('0x31')]));if(_0x5d5751[_0x0baf('0x6a')]){_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x3,'Set',_0x0baf('0x6b')+_0x5d5751[_0x0baf('0x6a')]));}else{_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x3,_0x0baf('0x63'),_0x0baf('0x6c')));}_0x427ed1[_0x0baf('0x67')](new Extension(_0x58a366,0x4,'goto',_0x59a0b2[_0x0baf('0x5b')]+','+_0x0baf('0x6d')+(0x8+_0x5d5751[_0x0baf('0x31')]['length'])+'}'+','+0x1));return _0x427ed1;}function formatPrefixName(_0x89484d){var _0x1e474f='_';for(var _0x3d333d=0x0;_0x3d333d<_0x89484d[_0x0baf('0x4e')];_0x3d333d++){if(_0x89484d[_0x0baf('0x6e')](_0x3d333d)=='-'){_0x1e474f+=_0x89484d[_0x0baf('0x6e')](_0x3d333d);}else{_0x1e474f+='['+_0x89484d[_0x0baf('0x6e')](_0x3d333d)+']';}}_0x1e474f+='.';return _0x1e474f;}exports['update']=function(_0x54353a,_0x4b7caa,_0x6ce83c){var _0x89bec7=_0x54353a[_0x0baf('0x6f')];_0x89bec7[_0x0baf('0x70')]=_0x0baf('0x71')+_0x89bec7[_0x0baf('0x31')]+'-';return db['sequelize']['transaction'](function(_0x34c1f4){return db['VoicePrefix'][_0x0baf('0x28')](_0x89bec7,{'where':{'id':_0x89bec7['id']},'transaction':_0x34c1f4})[_0x0baf('0x29')](function(){return db['VoiceExtension'][_0x0baf('0x2a')]({'where':{'VoicePrefixId':_0x89bec7['id']},'transaction':_0x34c1f4})[_0x0baf('0x29')](function(){return db[_0x0baf('0x64')][_0x0baf('0x4f')]({'where':{'id':_0x89bec7[_0x0baf('0x54')]},'raw':!![]})[_0x0baf('0x29')](function(_0x1b6b73){return createVoicePrefixExtensions(_0x89bec7,_0x1b6b73,_0x34c1f4);});});});})[_0x0baf('0x29')](function(){return db[_0x0baf('0x35')]['findById'](_0x89bec7['id']);})['then'](respondWithResult(_0x4b7caa,null))['catch'](handleError(_0x4b7caa,null));};exports['addAgents']=function(_0x5361a5,_0x418c45,_0x18963f){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x5361a5['params']['id']}})[_0x0baf('0x29')](handleEntityNotFound(_0x418c45,null))[_0x0baf('0x29')](function(_0x58caee){if(_0x58caee){return _0x58caee['addAgents'](_0x5361a5[_0x0baf('0x6f')][_0x0baf('0x72')],_[_0x0baf('0x73')](_0x5361a5[_0x0baf('0x6f')],[_0x0baf('0x72'),'id'])||{})[_0x0baf('0x74')](function(_0x3ce111){for(var _0x399f40=0x0;_0x399f40<_0x5361a5['body'][_0x0baf('0x72')][_0x0baf('0x4e')];_0x399f40+=0x1){socket['emit'](_0x0baf('0x75'),{'UserId':Number(_0x5361a5[_0x0baf('0x6f')]['ids'][_0x399f40]),'VoicePrefixId':Number(_0x5361a5[_0x0baf('0x76')]['id'])});}return _0x3ce111;});}})[_0x0baf('0x29')](respondWithResult(_0x418c45,null))[_0x0baf('0x50')](handleError(_0x418c45,null));};exports[_0x0baf('0x77')]=function(_0x167977,_0x4fc5af,_0x4807fc){return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x167977['params']['id']}})[_0x0baf('0x29')](handleEntityNotFound(_0x4fc5af,null))[_0x0baf('0x29')](function(_0x21ad25){if(_0x21ad25){return _0x21ad25['removeAgents'](_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')])[_0x0baf('0x29')](function(){if(_['isArray'](_0x167977[_0x0baf('0x3a')]['ids'])){for(var _0x316397=0x0;_0x316397<_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')][_0x0baf('0x4e')];_0x316397+=0x1){socket[_0x0baf('0x78')]('userVoicePrefix:remove',{'UserId':Number(_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')][_0x316397]),'VoicePrefixId':Number(_0x167977['params']['id'])});}}else{socket[_0x0baf('0x78')](_0x0baf('0x79'),{'UserId':Number(_0x167977[_0x0baf('0x3a')][_0x0baf('0x72')]),'VoicePrefixId':Number(_0x167977[_0x0baf('0x76')]['id'])});}});}})[_0x0baf('0x29')](respondWithStatusCode(_0x4fc5af,null))[_0x0baf('0x50')](handleError(_0x4fc5af,null));};exports[_0x0baf('0x7a')]=function(_0x44ef57,_0x1ca3a6,_0x3b7abf){var _0x2c2f09={};var _0x5985f9={};var _0x599ac0;var _0x29a036;return db[_0x0baf('0x35')][_0x0baf('0x7b')]({'where':{'id':_0x44ef57['params']['id']}})['then'](handleEntityNotFound(_0x1ca3a6,null))[_0x0baf('0x29')](function(_0x368e23){if(_0x368e23){_0x599ac0=_0x368e23;_0x5985f9[_0x0baf('0x39')]=_[_0x0baf('0x3b')](db[_0x0baf('0x7c')][_0x0baf('0x36')]);_0x5985f9[_0x0baf('0x3a')]=_[_0x0baf('0x3b')](_0x44ef57[_0x0baf('0x3a')]);_0x5985f9['filters']=_[_0x0baf('0x3c')](_0x5985f9[_0x0baf('0x39')],_0x5985f9[_0x0baf('0x3a')]);_0x2c2f09[_0x0baf('0x3d')]=_['intersection'](_0x5985f9['model'],qs['fields'](_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x2c2f09['attributes']=_0x2c2f09['attributes'][_0x0baf('0x4e')]?_0x2c2f09[_0x0baf('0x3d')]:_0x5985f9['model'];_0x2c2f09[_0x0baf('0x40')]=qs[_0x0baf('0x41')](_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x41')]);_0x2c2f09[_0x0baf('0x42')]=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x44ef57[_0x0baf('0x3a')],_0x5985f9[_0x0baf('0x43')]));if(_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x45')]){_0x2c2f09[_0x0baf('0x42')]=_['merge'](_0x2c2f09[_0x0baf('0x42')],{'$or':_[_0x0baf('0x34')](_0x2c2f09[_0x0baf('0x3d')],function(_0x3bd15b){var _0x3c37b4={};_0x3c37b4[_0x3bd15b]={'$like':'%'+_0x44ef57[_0x0baf('0x3a')]['filter']+'%'};return _0x3c37b4;})});}_0x2c2f09=_[_0x0baf('0x46')]({},_0x2c2f09,_0x44ef57[_0x0baf('0x48')]);return _0x599ac0[_0x0baf('0x7a')](_0x2c2f09);}})[_0x0baf('0x29')](function(_0x4376a1){if(_0x4376a1){_0x29a036=_0x4376a1['length'];if(!_0x44ef57[_0x0baf('0x3a')][_0x0baf('0x3f')](_0x0baf('0x7d'))){_0x2c2f09[_0x0baf('0x24')]=qs[_0x0baf('0x24')](_0x44ef57['query']['limit']);_0x2c2f09[_0x0baf('0x22')]=qs['offset'](_0x44ef57[_0x0baf('0x3a')]['offset']);}return _0x599ac0[_0x0baf('0x7a')](_0x2c2f09);}})[_0x0baf('0x29')](function(_0x1ce7bb){if(_0x1ce7bb){return _0x1ce7bb?{'count':_0x29a036,'rows':_0x1ce7bb}:null;}})[_0x0baf('0x29')](respondWithResult(_0x1ca3a6,null))['catch'](handleError(_0x1ca3a6,null));};exports[_0x0baf('0x7e')]=function(_0x106ffa,_0xf7a9d0,_0x551df3){var _0x487aec={};var _0x591cc2={};var _0x4d4884;var _0x427638;return db[_0x0baf('0x35')][_0x0baf('0x7b')]({'where':{'id':_0x106ffa[_0x0baf('0x76')]['id']}})['then'](handleEntityNotFound(_0xf7a9d0,null))[_0x0baf('0x29')](function(_0x37594e){if(_0x37594e){_0x4d4884=_0x37594e;_0x591cc2[_0x0baf('0x39')]=_['keys'](db[_0x0baf('0x7f')][_0x0baf('0x36')]);_0x591cc2['query']=_[_0x0baf('0x3b')](_0x106ffa['query']);_0x591cc2[_0x0baf('0x43')]=_[_0x0baf('0x3c')](_0x591cc2[_0x0baf('0x39')],_0x591cc2[_0x0baf('0x3a')]);_0x487aec['attributes']=_['intersection'](_0x591cc2[_0x0baf('0x39')],qs['fields'](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x3e')]));_0x487aec[_0x0baf('0x3d')]=_0x487aec[_0x0baf('0x3d')][_0x0baf('0x4e')]?_0x487aec['attributes']:_0x591cc2[_0x0baf('0x39')];_0x487aec['order']=qs[_0x0baf('0x41')](_0x106ffa['query'][_0x0baf('0x41')]);_0x487aec['where']=qs[_0x0baf('0x43')](_[_0x0baf('0x44')](_0x106ffa[_0x0baf('0x3a')],_0x591cc2['filters']));if(_0x106ffa['query'][_0x0baf('0x45')]){_0x487aec[_0x0baf('0x42')]=_[_0x0baf('0x46')](_0x487aec[_0x0baf('0x42')],{'$or':_[_0x0baf('0x34')](_0x487aec[_0x0baf('0x3d')],function(_0x4e6059){var _0xd4170d={};_0xd4170d[_0x4e6059]={'$like':'%'+_0x106ffa['query'][_0x0baf('0x45')]+'%'};return _0xd4170d;})});}_0x487aec=_['merge']({},_0x487aec,_0x106ffa[_0x0baf('0x48')]);return _0x4d4884[_0x0baf('0x7e')](_0x487aec);}})[_0x0baf('0x29')](function(_0x557a38){if(_0x557a38){_0x427638=_0x557a38[_0x0baf('0x4e')];if(!_0x106ffa[_0x0baf('0x3a')]['hasOwnProperty']('nolimit')){_0x487aec[_0x0baf('0x24')]=qs[_0x0baf('0x24')](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x24')]);_0x487aec['offset']=qs['offset'](_0x106ffa[_0x0baf('0x3a')][_0x0baf('0x22')]);}return _0x4d4884[_0x0baf('0x7e')](_0x487aec);}})[_0x0baf('0x29')](function(_0xfc91ce){if(_0xfc91ce){return _0xfc91ce?{'count':_0x427638,'rows':_0xfc91ce}:null;}})[_0x0baf('0x29')](respondWithResult(_0xf7a9d0,null))[_0x0baf('0x50')](handleError(_0xf7a9d0,null));};exports[_0x0baf('0x80')]=function(_0x205de6,_0x2369f0,_0x58f95c){var _0xdb96c0=_0x205de6['body'][_0x0baf('0x72')];var _0x42abcf;return db[_0x0baf('0x7f')][_0x0baf('0x4b')]({'where':{'id':_0xdb96c0},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0baf('0x81'),'attributes':['id',_0x0baf('0x31'),_0x0baf('0x82'),_0x0baf('0x83'),_0x0baf('0x84')],'raw':!![]}]})[_0x0baf('0x29')](function(_0x3b9101){if(_0x3b9101){_0x42abcf=_0x3b9101;var _0x205075=_[_0x0baf('0x85')](_0x3b9101,function(_0x4b6cd5){var _0x8d1bae=_0x4b6cd5[_0x0baf('0x2b')]({'plain':!![]});return _0x8d1bae['Agents'];});return db[_0x0baf('0x35')][_0x0baf('0x4f')]({'where':{'id':_0x205de6[_0x0baf('0x76')]['id']}})[_0x0baf('0x29')](function(_0x97f5d6){return db[_0x0baf('0x53')][_0x0baf('0x86')](function(_0x8c1dc2){return _0x97f5d6[_0x0baf('0x80')](_0xdb96c0,{'transaction':_0x8c1dc2})['then'](function(){return BPromise[_0x0baf('0x87')](_0x42abcf,function(_0x218fc5){return db[_0x0baf('0x88')][_0x0baf('0x89')]({'TeamId':_0x218fc5['id'],'VoicePrefixId':_0x205de6[_0x0baf('0x76')]['id']},{'transaction':_0x8c1dc2});});})[_0x0baf('0x29')](function(){return BPromise['each'](_0x205075,function(_0x121718){return db[_0x0baf('0x8a')][_0x0baf('0x8b')]({'where':{'UserId':_0x121718['id'],'VoicePrefixId':_0x205de6['params']['id']},'transaction':_0x8c1dc2});});})['then'](function(){_0x205075[_0x0baf('0x8c')](function(_0x1adb84){socket[_0x0baf('0x78')]('userVoicePrefix:save',{'UserId':_0x1adb84['id'],'VoicePrefixId':_0x97f5d6['id']});});});});});}})[_0x0baf('0x29')](respondWithStatusCode(_0x2369f0,null))['catch'](handleError(_0x2369f0,null));};exports[_0x0baf('0x8d')]=function(_0x5f09be,_0x41b216,_0x3f2838){return db['Team'][_0x0baf('0x4b')]({'where':{'id':_0x5f09be[_0x0baf('0x3a')][_0x0baf('0x72')]},'attributes':['id'],'include':[{'model':db[_0x0baf('0x7c')],'as':_0x0baf('0x81'),'attributes':['id'],'raw':!![]}]})[_0x0baf('0x29')](handleEntityNotFound(_0x41b216,null))[_0x0baf('0x29')](function(_0x5508db){var _0x727cad=_[_0x0baf('0x34')](_0x5508db,'id');var _0x2766fb=[];var _0x2e1629=[];var _0x275cc4=squel[_0x0baf('0x8e')]();_0x275cc4[_0x0baf('0x8f')](_0x0baf('0x90'))[_0x0baf('0x91')](_0x0baf('0x92'),'tq')[_0x0baf('0x93')](_0x0baf('0x94'),'ut',_0x0baf('0x95'))[_0x0baf('0x42')]('VoicePrefixId\x20=\x20?',_0x5f09be['params']['id']);for(var _0x1cd215=0x0;_0x1cd215<_0x5508db[_0x0baf('0x4e')];_0x1cd215+=0x1){let _0x3b9429=_0x5508db[_0x1cd215];for(var _0x41d397=0x0;_0x41d397<_0x3b9429['Agents'][_0x0baf('0x4e')];_0x41d397+=0x1){let _0xc6c049=_0x3b9429[_0x0baf('0x81')][_0x41d397];var _0x2fb267=_0x275cc4[_0x0baf('0x96')]();_0x2fb267[_0x0baf('0x42')]('ut.UserId\x20=\x20?',_0xc6c049['id']);_0x2e1629[_0x0baf('0x67')](db[_0x0baf('0x53')][_0x0baf('0x3a')](_0x2fb267['toString'](),{'type':db[_0x0baf('0x53')][_0x0baf('0x97')][_0x0baf('0x98')]})['then'](function(_0x4f7145){if(_0x4f7145['length']===0x1){return _0xc6c049['id'];}else{var _0x11a85a=_['every'](_[_0x0baf('0x34')](_0x4f7145,_0x0baf('0x99')),function(_0x55124b){return _[_0x0baf('0x9a')](_0x727cad,_0x55124b);});if(_0x11a85a){return _0xc6c049['id'];}}}));}}return BPromise['all'](_0x2e1629)['then'](function(_0x21516f){_0x2766fb=_(_0x2766fb)['union'](_0x21516f)[_0x0baf('0x9b')]()['value']();return db['VoicePrefix']['find']({'where':{'id':_0x5f09be[_0x0baf('0x76')]['id']}})[_0x0baf('0x29')](function(_0x3d1f80){return db[_0x0baf('0x53')][_0x0baf('0x86')](function(_0x4f9904){return _0x3d1f80[_0x0baf('0x8d')](_0x5f09be['query'][_0x0baf('0x72')],{'transaction':_0x4f9904})[_0x0baf('0x29')](function(){if(!_[_0x0baf('0x9c')](_0x2766fb)){return _0x3d1f80['removeAgents'](_0x2766fb,{'transaction':_0x4f9904});}})[_0x0baf('0x29')](function(){_0x2766fb[_0x0baf('0x8c')](function(_0x12311d){socket['emit'](_0x0baf('0x79'),{'UserId':_0x12311d,'VoicePrefixId':_0x3d1f80['id']});});});});});});})['then'](respondWithStatusCode(_0x41b216,null))[_0x0baf('0x50')](handleError(_0x41b216,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 4fba511..18be207 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 _0xca1e=['hook','events','../../mysqldb','save','remove','emit','hasOwnProperty'];(function(_0xbc9ae6,_0x3b7c66){var _0x33446e=function(_0x2222c1){while(--_0x2222c1){_0xbc9ae6['push'](_0xbc9ae6['shift']());}};_0x33446e(++_0x3b7c66);}(_0xca1e,0x1c1));var _0xeca1=function(_0x19fc35,_0x34adf9){_0x19fc35=_0x19fc35-0x0;var _0x55ce9d=_0xca1e[_0x19fc35];return _0x55ce9d;};'use strict';var EventEmitter=require(_0xeca1('0x0'));var VoicePrefix=require(_0xeca1('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeca1('0x2'),'afterUpdate':'update','afterDestroy':_0xeca1('0x3')};function emitEvent(_0xe4f307){return function(_0x1374b7,_0x35404c,_0x1ececb){VoicePrefixEvents[_0xeca1('0x4')](_0xe4f307+':'+_0x1374b7['id'],_0x1374b7);VoicePrefixEvents[_0xeca1('0x4')](_0xe4f307,_0x1374b7);_0x1ececb(null);};}for(var e in events){if(events[_0xeca1('0x5')](e)){var event=events[e];VoicePrefix[_0xeca1('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0xcd4b=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4fb41f,_0x2cfcce){var _0x17393d=function(_0x325d09){while(--_0x325d09){_0x4fb41f['push'](_0x4fb41f['shift']());}};_0x17393d(++_0x2cfcce);}(_0xcd4b,0xc4));var _0xbcd4=function(_0x29678a,_0xd09044){_0x29678a=_0x29678a-0x0;var _0xd762b6=_0xcd4b[_0x29678a];return _0xd762b6;};'use strict';var EventEmitter=require(_0xbcd4('0x0'));var VoicePrefix=require(_0xbcd4('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xbcd4('0x2')](0x0);var events={'afterCreate':_0xbcd4('0x3'),'afterUpdate':'update','afterDestroy':_0xbcd4('0x4')};function emitEvent(_0x20f4fb){return function(_0x34eec6,_0x46083a,_0x21da88){VoicePrefixEvents[_0xbcd4('0x5')](_0x20f4fb+':'+_0x34eec6['id'],_0x34eec6);VoicePrefixEvents[_0xbcd4('0x5')](_0x20f4fb,_0x34eec6);_0x21da88(null);};}for(var e in events){if(events[_0xbcd4('0x6')](e)){var event=events[e];VoicePrefix[_0xbcd4('0x7')](e,emitEvent(event));}}module[_0xbcd4('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 fe1813d..8853f44 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 _0x2da2=['./voicePrefix.attributes','exports','VoicePrefix','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x39cddd,_0x308243){var _0x51f55f=function(_0x3c3bc3){while(--_0x3c3bc3){_0x39cddd['push'](_0x39cddd['shift']());}};_0x51f55f(++_0x308243);}(_0x2da2,0x85));var _0x22da=function(_0xb8dc95,_0x4fdda5){_0xb8dc95=_0xb8dc95-0x0;var _0x73714a=_0x2da2[_0xb8dc95];return _0x73714a;};'use strict';var _=require('lodash');var util=require(_0x22da('0x0'));var logger=require('../../config/logger')(_0x22da('0x1'));var moment=require(_0x22da('0x2'));var BPromise=require('bluebird');var rp=require(_0x22da('0x3'));var fs=require('fs');var path=require(_0x22da('0x4'));var rimraf=require(_0x22da('0x5'));var config=require(_0x22da('0x6'));var attributes=require(_0x22da('0x7'));module[_0x22da('0x8')]=function(_0x2a501e,_0x2c38e2){return _0x2a501e['define'](_0x22da('0x9'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x771e=['path','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','../../config/logger','api','bluebird','request-promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x771e,0x96));var _0xe771=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x771e[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe771('0x0'))(_0xe771('0x1'));var moment=require('moment');var BPromise=require(_0xe771('0x2'));var rp=require(_0xe771('0x3'));var fs=require('fs');var path=require(_0xe771('0x4'));var rimraf=require('rimraf');var config=require(_0xe771('0x5'));var attributes=require(_0xe771('0x6'));module[_0xe771('0x7')]=function(_0x389809,_0x2934f0){return _0x389809[_0xe771('0x8')](_0xe771('0x9'),attributes,{'tableName':_0xe771('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index fcb4b31..122430f 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 _0xa1c5=['stringify','code','VoicePrefix,\x20%s,\x20%s','error','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./voicePrefix.socket','register','request','info','request\x20sent','debug'];(function(_0x335ff5,_0x480071){var _0x5d91c0=function(_0x3bb76d){while(--_0x3bb76d){_0x335ff5['push'](_0x335ff5['shift']());}};_0x5d91c0(++_0x480071);}(_0xa1c5,0x96));var _0x5a1c=function(_0x2f5b45,_0x260f93){_0x2f5b45=_0x2f5b45-0x0;var _0x4c5bc1=_0xa1c5[_0x2f5b45];return _0x4c5bc1;};'use strict';var _=require(_0x5a1c('0x0'));var util=require(_0x5a1c('0x1'));var moment=require(_0x5a1c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a1c('0x3'));var db=require(_0x5a1c('0x4'))['db'];var utils=require(_0x5a1c('0x5'));var logger=require('../../config/logger')(_0x5a1c('0x6'));var config=require(_0x5a1c('0x7'));var jayson=require(_0x5a1c('0x8'));var client=jayson['client'][_0x5a1c('0x9')]({'port':0x232a});config[_0x5a1c('0xa')]=_['defaults'](config[_0x5a1c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x5a1c('0xb'))(new Redis(config[_0x5a1c('0xa')]));require(_0x5a1c('0xc'))[_0x5a1c('0xd')](socket);function respondWithRpcPromise(_0x263cd8,_0x5e6568,_0x2f9e97){return new BPromise(function(_0x4a255c,_0x2677da){return client[_0x5a1c('0xe')](_0x263cd8,_0x2f9e97)['then'](function(_0x3a7a5c){logger[_0x5a1c('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x5e6568,_0x5a1c('0x10'));logger[_0x5a1c('0x11')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x5e6568,_0x5a1c('0x10'),JSON[_0x5a1c('0x12')](_0x3a7a5c));if(_0x3a7a5c['error']){if(_0x3a7a5c['error'][_0x5a1c('0x13')]===0x1f4){logger['error'](_0x5a1c('0x14'),_0x5e6568,_0x3a7a5c[_0x5a1c('0x15')][_0x5a1c('0x16')]);return _0x2677da(_0x3a7a5c['error']['message']);}logger[_0x5a1c('0x15')](_0x5a1c('0x14'),_0x5e6568,_0x3a7a5c[_0x5a1c('0x15')][_0x5a1c('0x16')]);return _0x4a255c(_0x3a7a5c[_0x5a1c('0x15')]['message']);}else{logger[_0x5a1c('0xf')](_0x5a1c('0x14'),_0x5e6568,_0x5a1c('0x10'));_0x4a255c(_0x3a7a5c[_0x5a1c('0x17')][_0x5a1c('0x16')]);}})['catch'](function(_0x1d8836){logger[_0x5a1c('0x15')](_0x5a1c('0x14'),_0x5e6568,_0x1d8836);_0x2677da(_0x1d8836);});});} \ No newline at end of file +var _0xb4b6=['jayson/promise','http','redis','defaults','localhost','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xcf09e0,_0x363681){var _0x33f327=function(_0x6d9060){while(--_0x6d9060){_0xcf09e0['push'](_0xcf09e0['shift']());}};_0x33f327(++_0x363681);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x462361,_0x3dfebb){_0x462361=_0x462361-0x0;var _0x4b4970=_0xb4b6[_0x462361];return _0x4b4970;};'use strict';var _=require('lodash');var util=require(_0x6b4b('0x0'));var moment=require(_0x6b4b('0x1'));var BPromise=require(_0x6b4b('0x2'));var rs=require(_0x6b4b('0x3'));var fs=require('fs');var Redis=require(_0x6b4b('0x4'));var db=require(_0x6b4b('0x5'))['db'];var utils=require(_0x6b4b('0x6'));var logger=require(_0x6b4b('0x7'))(_0x6b4b('0x8'));var config=require('../../config/environment');var jayson=require(_0x6b4b('0x9'));var client=jayson['client'][_0x6b4b('0xa')]({'port':0x232a});config[_0x6b4b('0xb')]=_[_0x6b4b('0xc')](config[_0x6b4b('0xb')],{'host':_0x6b4b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b4b('0xb')]));require(_0x6b4b('0xe'))[_0x6b4b('0xf')](socket);function respondWithRpcPromise(_0x3f398a,_0x46688a,_0x350e8f){return new BPromise(function(_0x387ac4,_0x214ebb){return client['request'](_0x3f398a,_0x350e8f)[_0x6b4b('0x10')](function(_0x4ab06f){logger[_0x6b4b('0x11')](_0x6b4b('0x12'),_0x46688a,_0x6b4b('0x13'));logger[_0x6b4b('0x14')](_0x6b4b('0x15'),_0x46688a,_0x6b4b('0x13'),JSON[_0x6b4b('0x16')](_0x4ab06f));if(_0x4ab06f['error']){if(_0x4ab06f[_0x6b4b('0x17')][_0x6b4b('0x18')]===0x1f4){logger[_0x6b4b('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x46688a,_0x4ab06f['error'][_0x6b4b('0x19')]);return _0x214ebb(_0x4ab06f[_0x6b4b('0x17')]['message']);}logger[_0x6b4b('0x17')](_0x6b4b('0x12'),_0x46688a,_0x4ab06f[_0x6b4b('0x17')][_0x6b4b('0x19')]);return _0x387ac4(_0x4ab06f[_0x6b4b('0x17')][_0x6b4b('0x19')]);}else{logger[_0x6b4b('0x11')](_0x6b4b('0x12'),_0x46688a,_0x6b4b('0x13'));_0x387ac4(_0x4ab06f['result']['message']);}})[_0x6b4b('0x1a')](function(_0x5b37ce){logger[_0x6b4b('0x17')](_0x6b4b('0x12'),_0x46688a,_0x5b37ce);_0x214ebb(_0x5b37ce);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index d12d839..e4a95e8 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 _0xceb0=['register','length','voicePrefix:','emit'];(function(_0x8e60ae,_0x1a9a70){var _0x2d5b7f=function(_0x9a12c){while(--_0x9a12c){_0x8e60ae['push'](_0x8e60ae['shift']());}};_0x2d5b7f(++_0x1a9a70);}(_0xceb0,0x173));var _0x0ceb=function(_0x30c3ec,_0x1f772a){_0x30c3ec=_0x30c3ec-0x0;var _0x20b54d=_0xceb0[_0x30c3ec];return _0x20b54d;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=['save','remove','update'];function createListener(_0x3a9748,_0x48c8b1){return function(_0x1659e3){_0x48c8b1[_0x0ceb('0x0')](_0x3a9748,_0x1659e3);};}function removeListener(_0x2e72bb,_0x496d9f){return function(){VoicePrefixEvents['removeListener'](_0x2e72bb,_0x496d9f);};}exports[_0x0ceb('0x1')]=function(_0x218237){for(var _0x3f650d=0x0,_0x52e6bb=events[_0x0ceb('0x2')];_0x3f650d<_0x52e6bb;_0x3f650d++){var _0x19e438=events[_0x3f650d];var _0x4ec03a=createListener(_0x0ceb('0x3')+_0x19e438,_0x218237);VoicePrefixEvents['on'](_0x19e438,_0x4ec03a);}}; \ No newline at end of file +var _0xda55=['voicePrefix:','./voicePrefix.events','save','emit','removeListener','length'];(function(_0x3084d,_0x5aed83){var _0x25558e=function(_0x5b031c){while(--_0x5b031c){_0x3084d['push'](_0x3084d['shift']());}};_0x25558e(++_0x5aed83);}(_0xda55,0x6d));var _0x5da5=function(_0x2fc5db,_0x2253b1){_0x2fc5db=_0x2fc5db-0x0;var _0x1ef11b=_0xda55[_0x2fc5db];return _0x1ef11b;};'use strict';var VoicePrefixEvents=require(_0x5da5('0x0'));var events=[_0x5da5('0x1'),'remove','update'];function createListener(_0x13ecbc,_0x240a49){return function(_0x26a443){_0x240a49[_0x5da5('0x2')](_0x13ecbc,_0x26a443);};}function removeListener(_0x1c3afd,_0x5da254){return function(){VoicePrefixEvents[_0x5da5('0x3')](_0x1c3afd,_0x5da254);};}exports['register']=function(_0x356a37){for(var _0x58e7b3=0x0,_0x2fd877=events[_0x5da5('0x4')];_0x58e7b3<_0x2fd877;_0x58e7b3++){var _0x71b187=events[_0x58e7b3];var _0x46290d=createListener(_0x5da5('0x5')+_0x71b187,_0x356a37);VoicePrefixEvents['on'](_0x71b187,_0x46290d);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 7c1aa88..2461a7b 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 _0xba2e=['/:id/teams','getTeams','/:id/users','getAgents','getMembers','/:id/lists','getLists','getBlackLists','post','create','addTeams','addAgents','addLists','/:id/blacklists','addBlackLists','put','/:id','update','delete','destroy','removeTeams','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals'];(function(_0x15b380,_0x1a3c5f){var _0x232c5c=function(_0x12f8e0){while(--_0x12f8e0){_0x15b380['push'](_0x15b380['shift']());}};_0x232c5c(++_0x1a3c5f);}(_0xba2e,0x137));var _0xeba2=function(_0x5c1ebe,_0xcf9f4f){_0x5c1ebe=_0x5c1ebe-0x0;var _0x3685a9=_0xba2e[_0x5c1ebe];return _0x3685a9;};'use strict';var multer=require(_0xeba2('0x0'));var util=require(_0xeba2('0x1'));var path=require(_0xeba2('0x2'));var timeout=require(_0xeba2('0x3'));var express=require(_0xeba2('0x4'));var router=express[_0xeba2('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xeba2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeba2('0x7'));var controller=require('./voiceQueue.controller');router[_0xeba2('0x8')]('/',auth[_0xeba2('0x9')](),controller['index']);router[_0xeba2('0x8')]('/:id',auth[_0xeba2('0x9')](),controller[_0xeba2('0xa')]);router[_0xeba2('0x8')](_0xeba2('0xb'),auth[_0xeba2('0x9')](),controller[_0xeba2('0xc')]);router[_0xeba2('0x8')](_0xeba2('0xd'),auth[_0xeba2('0x9')](),controller[_0xeba2('0xe')]);router[_0xeba2('0x8')](_0xeba2('0xf'),auth['isAuthenticated'](),controller[_0xeba2('0x10')]);router[_0xeba2('0x8')]('/:id/hopper_black',auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0xeba2('0x8')](_0xeba2('0x11'),auth[_0xeba2('0x9')](),controller[_0xeba2('0x12')]);router[_0xeba2('0x8')](_0xeba2('0x13'),auth[_0xeba2('0x9')](),controller[_0xeba2('0x14')]);router[_0xeba2('0x8')]('/:id/members',auth[_0xeba2('0x9')](),controller[_0xeba2('0x15')]);router['get'](_0xeba2('0x16'),auth[_0xeba2('0x9')](),controller[_0xeba2('0x17')]);router[_0xeba2('0x8')]('/:id/blacklists',auth[_0xeba2('0x9')](),controller[_0xeba2('0x18')]);router[_0xeba2('0x19')]('/',auth[_0xeba2('0x9')](),controller[_0xeba2('0x1a')]);router['post']('/:id/clone',auth[_0xeba2('0x9')](),controller['clone']);router['post']('/:id/teams',auth[_0xeba2('0x9')](),controller[_0xeba2('0x1b')]);router[_0xeba2('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0xeba2('0x1c')]);router[_0xeba2('0x19')](_0xeba2('0x16'),auth[_0xeba2('0x9')](),controller[_0xeba2('0x1d')]);router['post'](_0xeba2('0x1e'),auth[_0xeba2('0x9')](),controller[_0xeba2('0x1f')]);router[_0xeba2('0x20')](_0xeba2('0x21'),auth[_0xeba2('0x9')](),controller[_0xeba2('0x22')]);router[_0xeba2('0x23')](_0xeba2('0x21'),auth[_0xeba2('0x9')](),controller[_0xeba2('0x24')]);router['delete']('/:id/teams',auth[_0xeba2('0x9')](),controller[_0xeba2('0x25')]);router[_0xeba2('0x23')]('/:id/users',auth[_0xeba2('0x9')](),controller['removeAgents']);router[_0xeba2('0x23')](_0xeba2('0x16'),auth['isAuthenticated'](),controller[_0xeba2('0x26')]);router[_0xeba2('0x23')](_0xeba2('0x1e'),auth[_0xeba2('0x9')](),controller[_0xeba2('0x27')]);module[_0xeba2('0x28')]=router; \ No newline at end of file +var _0xc1e8=['getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getMembers','getLists','/:id/blacklists','post','clone','addTeams','addAgents','/:id/lists','addLists','addBlackLists','update','destroy','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','isAuthenticated','/:id/hoppers'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc1e8,0xbf));var _0x8c1e=function(_0x4a6156,_0x2b8ce6){_0x4a6156=_0x4a6156-0x0;var _0x12c1f6=_0xc1e8[_0x4a6156];return _0x12c1f6;};'use strict';var multer=require(_0x8c1e('0x0'));var util=require(_0x8c1e('0x1'));var path=require('path');var timeout=require(_0x8c1e('0x2'));var express=require(_0x8c1e('0x3'));var router=express['Router']();var fs_extra=require(_0x8c1e('0x4'));var auth=require(_0x8c1e('0x5'));var interaction=require(_0x8c1e('0x6'));var config=require(_0x8c1e('0x7'));var controller=require(_0x8c1e('0x8'));router[_0x8c1e('0x9')]('/',auth['isAuthenticated'](),controller[_0x8c1e('0xa')]);router[_0x8c1e('0x9')](_0x8c1e('0xb'),auth[_0x8c1e('0xc')](),controller['show']);router[_0x8c1e('0x9')](_0x8c1e('0xd'),auth[_0x8c1e('0xc')](),controller[_0x8c1e('0xe')]);router['get'](_0x8c1e('0xf'),auth[_0x8c1e('0xc')](),controller[_0x8c1e('0x10')]);router[_0x8c1e('0x9')]('/:id/hopper_finals',auth[_0x8c1e('0xc')](),controller[_0x8c1e('0x11')]);router['get'](_0x8c1e('0x12'),auth['isAuthenticated'](),controller[_0x8c1e('0x13')]);router[_0x8c1e('0x9')](_0x8c1e('0x14'),auth[_0x8c1e('0xc')](),controller[_0x8c1e('0x15')]);router[_0x8c1e('0x9')](_0x8c1e('0x16'),auth[_0x8c1e('0xc')](),controller['getAgents']);router[_0x8c1e('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0x8c1e('0x17')]);router[_0x8c1e('0x9')]('/:id/lists',auth['isAuthenticated'](),controller[_0x8c1e('0x18')]);router[_0x8c1e('0x9')](_0x8c1e('0x19'),auth['isAuthenticated'](),controller['getBlackLists']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8c1e('0x1a')]('/:id/clone',auth['isAuthenticated'](),controller[_0x8c1e('0x1b')]);router[_0x8c1e('0x1a')](_0x8c1e('0x14'),auth[_0x8c1e('0xc')](),controller[_0x8c1e('0x1c')]);router[_0x8c1e('0x1a')](_0x8c1e('0x16'),auth['isAuthenticated'](),controller[_0x8c1e('0x1d')]);router[_0x8c1e('0x1a')](_0x8c1e('0x1e'),auth[_0x8c1e('0xc')](),controller[_0x8c1e('0x1f')]);router['post'](_0x8c1e('0x19'),auth[_0x8c1e('0xc')](),controller[_0x8c1e('0x20')]);router['put']('/:id',auth[_0x8c1e('0xc')](),controller[_0x8c1e('0x21')]);router['delete'](_0x8c1e('0xb'),auth[_0x8c1e('0xc')](),controller[_0x8c1e('0x22')]);router[_0x8c1e('0x23')](_0x8c1e('0x14'),auth[_0x8c1e('0xc')](),controller[_0x8c1e('0x24')]);router[_0x8c1e('0x23')]('/:id/users',auth[_0x8c1e('0xc')](),controller[_0x8c1e('0x25')]);router['delete'](_0x8c1e('0x1e'),auth[_0x8c1e('0xc')](),controller[_0x8c1e('0x26')]);router[_0x8c1e('0x23')](_0x8c1e('0x19'),auth[_0x8c1e('0xc')](),controller[_0x8c1e('0x27')]);module[_0x8c1e('0x28')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 0796297..632e63f 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 _0x5144=['random','rrmemory','linear','ringall','setDataValue','strategy','type','getDataValue','dialMethod','booked','roundrobin','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','wrapuptime','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','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','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','exports','STRING','name','ENUM','inbound','default','leastrecent','fewestcalls'];(function(_0x41e80b,_0x3cecb6){var _0x401aad=function(_0x49ac56){while(--_0x49ac56){_0x41e80b['push'](_0x41e80b['shift']());}};_0x401aad(++_0x3cecb6);}(_0x5144,0xe2));var _0x4514=function(_0x310d62,_0x49fa3b){_0x310d62=_0x310d62-0x0;var _0x341fe1=_0x5144[_0x310d62];return _0x341fe1;};'use strict';var Sequelize=require('sequelize');module[_0x4514('0x0')]={'name':{'type':Sequelize[_0x4514('0x1')],'allowNull':![],'unique':_0x4514('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4514('0x3')](_0x4514('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x4514('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x4514('0x5')},'announce':{'type':Sequelize[_0x4514('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x4514('0x3')]('rr','ringall',_0x4514('0x6'),_0x4514('0x7'),_0x4514('0x8'),_0x4514('0x9'),_0x4514('0xa'),'wrandom','rrordered'),'allowNull':![],'defaultValue':_0x4514('0xb'),'set':function(_0x138b92){this[_0x4514('0xc')](_0x4514('0xd'),_0x138b92?_0x138b92:_0x4514('0x9'));},'get':function(){var _0x4b71ca=this['getDataValue'](_0x4514('0xe'));var _0x158d40=this[_0x4514('0xf')](_0x4514('0x10'));var _0x374ec0=this['getDataValue'](_0x4514('0xd'));if(_0x4b71ca===_0x4514('0x4')){return _0x374ec0;}if(_0x158d40===_0x4514('0x11')&&_0x374ec0==='rrmemory'||_0x158d40===_0x4514('0x11')&&_0x374ec0===_0x4514('0x12')){return _0x374ec0;}if(_0x158d40==='progressive'||_0x158d40===_0x4514('0x13')||_0x158d40===_0x4514('0x14')){return _0x374ec0;}return null;}},'servicelevel':{'type':Sequelize[_0x4514('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x4514('0x15')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x4514('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x4514('0x1')]},'weight':{'type':Sequelize[_0x4514('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x4514('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x4514('0x3')](_0x4514('0x16'),'no'),'defaultValue':_0x4514('0x16')},'autopause':{'type':Sequelize[_0x4514('0x3')](_0x4514('0x16'),'no',_0x4514('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x4514('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x4514('0x3')](_0x4514('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x4514('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x4514('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x4514('0x3')](_0x4514('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x4514('0x3')](_0x4514('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x4514('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x4514('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x4514('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x4514('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x4514('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x4514('0x16')},'announce_holdtime':{'type':Sequelize[_0x4514('0x3')](_0x4514('0x16'),'no',_0x4514('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x4514('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x4514('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x4514('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x4514('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x4514('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x4514('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x4514('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x4514('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x4514('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x4514('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x4514('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x4514('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x4514('0x1')]},'queue_quantity2':{'type':Sequelize[_0x4514('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x4514('0x1')]},'periodic_announce':{'type':Sequelize[_0x4514('0x19')],'set':function(_0x18c468){this[_0x4514('0xc')](_0x4514('0x1a'),_0x18c468?_0x18c468[_0x4514('0x1b')](','):[]);},'get':function(){return this[_0x4514('0xf')](_0x4514('0x1a'))?this[_0x4514('0xf')](_0x4514('0x1a'))[_0x4514('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x4514('0x1')],'defaultValue':_0x4514('0x16'),'set':function(_0x5da059){this[_0x4514('0xc')](_0x4514('0x1d'),_0x5da059?_0x5da059[_0x4514('0x1b')](','):undefined);},'get':function(){return this[_0x4514('0xf')](_0x4514('0x1d'))?this['getDataValue'](_0x4514('0x1d'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x4514('0x1')],'defaultValue':'no','set':function(_0x5c8aae){this[_0x4514('0xc')](_0x4514('0x1e'),_0x5c8aae?_0x5c8aae[_0x4514('0x1b')](','):undefined);},'get':function(){return this[_0x4514('0xf')](_0x4514('0x1e'))?this[_0x4514('0xf')](_0x4514('0x1e'))[_0x4514('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x4514('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x4514('0x3')](_0x4514('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x4514('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x4514('0x3')](_0x4514('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x4514('0x1')]},'description':{'type':Sequelize[_0x4514('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x4251a7){this['setDataValue']('acw',_0x4251a7);if(_0x4251a7){if(this[_0x4514('0xf')]('wrapuptime')<0x2){this['setDataValue'](_0x4514('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x4514('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x4514('0x3')]('preview',_0x4514('0x20'),'power',_0x4514('0x13'),_0x4514('0x11')),'defaultValue':_0x4514('0x20'),'comment':_0x4514('0x21')},'dialLimitChannel':{'type':Sequelize[_0x4514('0x15')](0x4)[_0x4514('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4514('0x23')},'dialLimitQueue':{'type':Sequelize[_0x4514('0x15')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4514('0x24')},'dialPowerLevel':{'type':Sequelize[_0x4514('0x25')](0x2)[_0x4514('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x4514('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x4514('0x3')]('agentBusyFactor',_0x4514('0x27')),'defaultValue':_0x4514('0x27'),'comment':_0x4514('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x4514('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x4514('0x29')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x4514('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x4514('0x2a')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4514('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x4514('0x15')](0x3)[_0x4514('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4514('0x2b')},'dialQueueOptions':{'type':Sequelize[_0x4514('0x1')],'defaultValue':_0x4514('0x2c'),'comment':_0x4514('0x2d')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4514('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x4514('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4514('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4514('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4514('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4514('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x4514('0x15')](0x3)[_0x4514('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4514('0x30')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4514('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4514('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x4514('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4514('0x15')](0x5)[_0x4514('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4514('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4514('0x15')](0x3)[_0x4514('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x4514('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4514('0x1')],'defaultValue':_0x4514('0x34')},'dialPrefix':{'type':Sequelize[_0x4514('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x4514('0x3')](_0x4514('0x35'),_0x4514('0x36'),'onlyIfOpen'),'defaultValue':_0x4514('0x35')},'dialAMDActive':{'type':Sequelize[_0x4514('0x37')],'defaultValue':0x0,'comment':_0x4514('0x38')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4514('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4514('0x39')},'dialAMDGreeting':{'type':Sequelize[_0x4514('0x15')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4514('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4514('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4514('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4514('0x15')](0x9)[_0x4514('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4514('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x4514('0x15')](0x9)[_0x4514('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4514('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4514('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4514('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4514('0x15')](0x9)[_0x4514('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4514('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4514('0x15')](0x5)[_0x4514('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4514('0x15')](0x9)[_0x4514('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4514('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x4514('0x15')](0x5)[_0x4514('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x4514('0x41')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4514('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4514('0x3')](_0x4514('0x43'),_0x4514('0x44')),'defaultValue':_0x4514('0x43')},'dialQueueProject2':{'type':Sequelize[_0x4514('0x1')],'comment':_0x4514('0x45')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x4514('0x37')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x4514('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x4514('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4514('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4514('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4514('0x15')](0x5)[_0x4514('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4514('0x48')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4514('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4514('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4514('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4514('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4514('0x15')](0x5)[_0x4514('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x4514('0x15')](0x3)[_0x4514('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4514('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4514('0x15')](0x5)[_0x4514('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4514('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4514('0x15')](0x5)[_0x4514('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4514('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4514('0x15')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4514('0x37')],'defaultValue':![],'comment':_0x4514('0x4c'),'set':function(_0x162c5a){if(!_0x162c5a)this[_0x4514('0xc')](_0x4514('0x4d'),null);this[_0x4514('0xc')]('mandatoryDisposition',_0x162c5a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x4514('0x15')](0x3)[_0x4514('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x4514('0x15')](0x3)[_0x4514('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x09f4=['FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','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)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','inbound','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','booked','predictive','power','INTEGER','yes','once','join','periodic_announce','joinempty','split','leavewhenempty','acw','wrapuptime','preview','progressive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x09f4,0x1a5));var _0x409f=function(_0x245e2d,_0x1515a6){_0x245e2d=_0x245e2d-0x0;var _0x2d1b6f=_0x09f4[_0x245e2d];return _0x2d1b6f;};'use strict';var Sequelize=require('sequelize');module[_0x409f('0x0')]={'name':{'type':Sequelize[_0x409f('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x409f('0x2')](_0x409f('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x409f('0x3')},'musiconhold':{'type':Sequelize[_0x409f('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x409f('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x409f('0x2')]('rr',_0x409f('0x4'),_0x409f('0x5'),_0x409f('0x6'),_0x409f('0x7'),_0x409f('0x8'),_0x409f('0x9'),_0x409f('0xa'),_0x409f('0xb')),'allowNull':![],'defaultValue':_0x409f('0x4'),'set':function(_0xc1b11c){this[_0x409f('0xc')](_0x409f('0xd'),_0xc1b11c?_0xc1b11c:_0x409f('0x8'));},'get':function(){var _0x18fb4f=this[_0x409f('0xe')](_0x409f('0xf'));var _0x3e8d0b=this[_0x409f('0xe')](_0x409f('0x10'));var _0x51cc41=this['getDataValue'](_0x409f('0xd'));if(_0x18fb4f===_0x409f('0x3')){return _0x51cc41;}if(_0x3e8d0b===_0x409f('0x11')&&_0x51cc41===_0x409f('0x8')||_0x3e8d0b===_0x409f('0x11')&&_0x51cc41==='roundrobin'){return _0x51cc41;}if(_0x3e8d0b==='progressive'||_0x3e8d0b===_0x409f('0x12')||_0x3e8d0b===_0x409f('0x13')){return _0x51cc41;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x409f('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x409f('0x14')](0xb)},'timeout':{'type':Sequelize[_0x409f('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x409f('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x409f('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x409f('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x409f('0x2')](_0x409f('0x15'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x409f('0x2')](_0x409f('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x409f('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x409f('0x2')](_0x409f('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x409f('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x409f('0x2')](_0x409f('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x409f('0x2')](_0x409f('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x409f('0x2')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x409f('0x2')](_0x409f('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x409f('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x409f('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x409f('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x409f('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x409f('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x409f('0x2')](_0x409f('0x15'),'no'),'defaultValue':_0x409f('0x15')},'announce_holdtime':{'type':Sequelize[_0x409f('0x2')](_0x409f('0x15'),'no',_0x409f('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x409f('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x409f('0x2')](_0x409f('0x15'),'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[_0x409f('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x409f('0x1')]},'queue_youarenext':{'type':Sequelize[_0x409f('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x409f('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x409f('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x409f('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x409f('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x409f('0x1')]},'queue_quantity1':{'type':Sequelize[_0x409f('0x1')]},'queue_quantity2':{'type':Sequelize[_0x409f('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x1cb172){this[_0x409f('0xc')]('periodic_announce',_0x1cb172?_0x1cb172[_0x409f('0x17')](','):[]);},'get':function(){return this[_0x409f('0xe')]('periodic_announce')?this[_0x409f('0xe')](_0x409f('0x18'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x409f('0x1')],'defaultValue':_0x409f('0x15'),'set':function(_0x50a99d){this[_0x409f('0xc')]('joinempty',_0x50a99d?_0x50a99d[_0x409f('0x17')](','):undefined);},'get':function(){return this[_0x409f('0xe')](_0x409f('0x19'))?this[_0x409f('0xe')](_0x409f('0x19'))[_0x409f('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x409f('0x1')],'defaultValue':'no','set':function(_0x4db384){this['setDataValue'](_0x409f('0x1b'),_0x4db384?_0x4db384[_0x409f('0x17')](','):undefined);},'get':function(){return this[_0x409f('0xe')](_0x409f('0x1b'))?this[_0x409f('0xe')](_0x409f('0x1b'))[_0x409f('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x409f('0x2')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x409f('0x2')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x409f('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x409f('0x2')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x409f('0x1')]},'description':{'type':Sequelize[_0x409f('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x40c8d3){this[_0x409f('0xc')](_0x409f('0x1c'),_0x40c8d3);if(_0x40c8d3){if(this[_0x409f('0xe')](_0x409f('0x1d'))<0x2){this[_0x409f('0xc')](_0x409f('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x409f('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x409f('0x2')](_0x409f('0x1e'),_0x409f('0x1f'),'power','predictive',_0x409f('0x11')),'defaultValue':_0x409f('0x1f'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x409f('0x14')](0x4)[_0x409f('0x20')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x409f('0x21')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x409f('0x20')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x409f('0x22')},'dialPowerLevel':{'type':Sequelize[_0x409f('0x23')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x409f('0x24')},'dialPredictiveOptimization':{'type':Sequelize[_0x409f('0x2')](_0x409f('0x25'),'dropRate'),'defaultValue':'dropRate','comment':_0x409f('0x26')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x409f('0x23')](0x2)[_0x409f('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x409f('0x27')},'dialPredictiveInterval':{'type':Sequelize[_0x409f('0x14')](0x3)[_0x409f('0x20')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x409f('0x28')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x409f('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x409f('0x14')](0x3)[_0x409f('0x20')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x409f('0x29')},'dialQueueOptions':{'type':Sequelize[_0x409f('0x1')],'defaultValue':_0x409f('0x2a'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x409f('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x409f('0x2b')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x409f('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x409f('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x409f('0x14')](0x5)[_0x409f('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x409f('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x409f('0x2d')},'dialBusyRetryFrequency':{'type':Sequelize[_0x409f('0x14')](0x5)[_0x409f('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x409f('0x20')],'defaultValue':0x3,'comment':_0x409f('0x2e')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x409f('0x14')](0x5)[_0x409f('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x409f('0x2f')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x409f('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x409f('0x1')],'defaultValue':_0x409f('0x30')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x409f('0x31'),_0x409f('0x32'),_0x409f('0x33')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x409f('0x34')],'defaultValue':0x0,'comment':_0x409f('0x35')},'dialAMDInitialSilence':{'type':Sequelize[_0x409f('0x14')](0x9)[_0x409f('0x20')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x409f('0x36')},'dialAMDGreeting':{'type':Sequelize[_0x409f('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x409f('0x20')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x409f('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x409f('0x37')},'dialAMDMinWordLength':{'type':Sequelize[_0x409f('0x14')](0x9)[_0x409f('0x20')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x409f('0x14')](0x9)[_0x409f('0x20')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x409f('0x38')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x409f('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x409f('0x39')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x409f('0x14')](0x5)[_0x409f('0x20')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x409f('0x14')](0x9)[_0x409f('0x20')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x409f('0x3a')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x409f('0x20')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x409f('0x3b')},'dialRecallInQueue':{'type':Sequelize[_0x409f('0x34')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x409f('0x2')]('DESC',_0x409f('0x3c')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x409f('0x1')],'comment':_0x409f('0x2b')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x409f('0x34')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x409f('0x34')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x409f('0x14')](0x3)[_0x409f('0x20')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x409f('0x3d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x409f('0x20')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x409f('0x3e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x409f('0x14')](0x3)[_0x409f('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x409f('0x3f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x409f('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x409f('0x40')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x409f('0x41')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x409f('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x409f('0x42')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x409f('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x409f('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x409f('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x409f('0x44')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x409f('0x20')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x409f('0x45')},'dialMachineRetryFrequency':{'type':Sequelize[_0x409f('0x14')](0x5)[_0x409f('0x20')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x409f('0x46')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x409f('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x409f('0x47')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x409f('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x409f('0x48')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x409f('0x34')],'defaultValue':![],'comment':_0x409f('0x49'),'set':function(_0x3763cc){if(!_0x3763cc)this[_0x409f('0xc')](_0x409f('0x4a'),null);this[_0x409f('0xc')](_0x409f('0x4b'),_0x3763cc);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x409f('0x14')](0x3)[_0x409f('0x20')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x409f('0x14')](0x3)[_0x409f('0x20')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 0e77c1e..69e2367 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 _0xa945=['CmHopperBlack','getTeams','Team','teams','User','Agents','voicePause','forEach','penalty','transaction','addTeams','TeamVoiceQueue','UserVoiceQueue','each','UserVoiceQueueRt','interface','format','SIP/%s','emit','userVoiceQueue:save','ids','select','field','tq.TeamId','from','join','user_has_teams','VoiceQueueId\x20=\x20?','push','toString','QueryTypes','every','all','union','compact','sequelize','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','online','upsert','isNil','isArray','getAgents','getMembers','CmList','getLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','sendStatus','status','end','limit','count','offset','Content-Range','json','save','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','options','create','user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','getHoppers','findOne','CmHopper','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks'];(function(_0x4785aa,_0x5de0ea){var _0x208114=function(_0x1cb97e){while(--_0x1cb97e){_0x4785aa['push'](_0x4785aa['shift']());}};_0x208114(++_0x5de0ea);}(_0xa945,0x1af));var _0x5a94=function(_0x412faa,_0x6d5ea8){_0x412faa=_0x412faa-0x0;var _0x204402=_0xa945[_0x412faa];return _0x204402;};'use strict';var emlformat=require(_0x5a94('0x0'));var rimraf=require(_0x5a94('0x1'));var zipdir=require(_0x5a94('0x2'));var jsonpatch=require(_0x5a94('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5a94('0x4'));var Mustache=require('mustache');var util=require(_0x5a94('0x5'));var path=require('path');var sox=require(_0x5a94('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5a94('0x7'));var _=require(_0x5a94('0x8'));var squel=require(_0x5a94('0x9'));var crypto=require(_0x5a94('0xa'));var jsforce=require(_0x5a94('0xb'));var deskjs=require(_0x5a94('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5a94('0xd'));var Redis=require(_0x5a94('0xe'));var authService=require(_0x5a94('0xf'));var qs=require(_0x5a94('0x10'));var as=require(_0x5a94('0x11'));var hardwareService=require(_0x5a94('0x12'));var logger=require(_0x5a94('0x13'))('api');var utils=require(_0x5a94('0x14'));var config=require(_0x5a94('0x15'));var licenseUtil=require(_0x5a94('0x16'));var db=require(_0x5a94('0x17'))['db'];config[_0x5a94('0x18')]=_[_0x5a94('0x19')](config[_0x5a94('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x4efa85,_0x4da4ca){_0x4da4ca=_0x4da4ca||0xcc;return function(_0x222583){if(_0x222583){return _0x4efa85[_0x5a94('0x1a')](_0x4da4ca);}return _0x4efa85[_0x5a94('0x1b')](_0x4da4ca)[_0x5a94('0x1c')]();};}function respondWithResult(_0x3048e4,_0x510b53){_0x510b53=_0x510b53||0xc8;return function(_0x1d314a){if(_0x1d314a){return _0x3048e4[_0x5a94('0x1b')](_0x510b53)['json'](_0x1d314a);}};}function respondWithFilteredResult(_0x3f8aa0,_0x59ac57){return function(_0x5f22c3){if(_0x5f22c3){var _0x5a7d19=typeof _0x59ac57['offset']==='undefined'&&typeof _0x59ac57[_0x5a94('0x1d')]==='undefined';var _0xfc4b81=_0x5f22c3[_0x5a94('0x1e')];var _0x256e8a=_0x5a7d19?0x0:_0x59ac57[_0x5a94('0x1f')];var _0xd3e218=_0x5a7d19?_0x5f22c3[_0x5a94('0x1e')]:_0x59ac57['offset']+_0x59ac57[_0x5a94('0x1d')];var _0xf4029e;if(_0xd3e218>=_0xfc4b81){_0xd3e218=_0xfc4b81;_0xf4029e=0xc8;}else{_0xf4029e=0xce;}_0x3f8aa0[_0x5a94('0x1b')](_0xf4029e);return _0x3f8aa0['set'](_0x5a94('0x20'),_0x256e8a+'-'+_0xd3e218+'/'+_0xfc4b81)[_0x5a94('0x21')](_0x5f22c3);}return null;};}function patchUpdates(_0x57a534){return function(_0x23892c){try{jsonpatch['apply'](_0x23892c,_0x57a534,!![]);}catch(_0x5d4bb0){return BPromise['reject'](_0x5d4bb0);}return _0x23892c[_0x5a94('0x22')]();};}function saveUpdates(_0x2ee398,_0x3866be){return function(_0x1b9aff){if(_0x1b9aff){return _0x1b9aff['update'](_0x2ee398)[_0x5a94('0x23')](function(_0xd32442){return _0xd32442;});}return null;};}function removeEntity(_0x24ac49,_0x4c5164){return function(_0x23db9c){if(_0x23db9c){return _0x23db9c[_0x5a94('0x24')]()[_0x5a94('0x23')](function(){var _0x137f2e=_0x23db9c['get']({'plain':!![]});var _0x171da9=[{'name':_0x5a94('0x25'),'value':_0x5a94('0x26'),'ignore':![]},{'name':_0x5a94('0x27'),'value':_0x5a94('0x28'),'ignore':![]}];var _0x1d547d=_(_0x171da9)[_0x5a94('0x29')](_0x5a94('0x2a'))[_0x5a94('0x2b')]('value')[_0x5a94('0x2c')]();if(_[_0x5a94('0x2d')](_0x1d547d,_0x137f2e[_0x5a94('0x2e')])){return;}var _0x2965d4=_[_0x5a94('0x2f')](_0x171da9,[_0x5a94('0x2c'),_0x137f2e[_0x5a94('0x2e')]])[_0x5a94('0x30')];return db[_0x5a94('0x31')][_0x5a94('0x24')]({'where':{'type':_0x2965d4,'resourceId':_0x137f2e['id']}})[_0x5a94('0x23')](function(){return _0x23db9c;});})[_0x5a94('0x23')](function(){_0x24ac49[_0x5a94('0x1b')](0xcc)[_0x5a94('0x1c')]();});}};}function handleEntityNotFound(_0x4f5dec,_0x4ed3a9){return function(_0x32393f){if(!_0x32393f){_0x4f5dec[_0x5a94('0x1a')](0x194);}return _0x32393f;};}function handleError(_0xd5b70f,_0x3f45e7){_0x3f45e7=_0x3f45e7||0x1f4;return function(_0x4951ab){logger[_0x5a94('0x32')](_0x4951ab[_0x5a94('0x33')]);if(_0x4951ab[_0x5a94('0x30')]){delete _0x4951ab[_0x5a94('0x30')];}_0xd5b70f['status'](_0x3f45e7)[_0x5a94('0x34')](_0x4951ab);};}exports[_0x5a94('0x35')]=function(_0x1ebeb7,_0x3173e1){var _0x425355={},_0x170647={},_0xad3ea9={'count':0x0,'rows':[]};var _0x1db479=_['map'](db[_0x5a94('0x36')][_0x5a94('0x37')],function(_0x354fef){return{'name':_0x354fef[_0x5a94('0x38')],'type':_0x354fef[_0x5a94('0x2e')][_0x5a94('0x39')]};});_0x170647[_0x5a94('0x3a')]=_['map'](_0x1db479,'name');_0x170647['query']=_[_0x5a94('0x3b')](_0x1ebeb7[_0x5a94('0x3c')]);_0x170647[_0x5a94('0x3d')]=_[_0x5a94('0x3e')](_0x170647[_0x5a94('0x3a')],_0x170647[_0x5a94('0x3c')]);_0x425355['attributes']=_[_0x5a94('0x3e')](_0x170647[_0x5a94('0x3a')],qs[_0x5a94('0x3f')](_0x1ebeb7['query']['fields']));_0x425355[_0x5a94('0x40')]=_0x425355[_0x5a94('0x40')][_0x5a94('0x41')]?_0x425355['attributes']:_0x170647[_0x5a94('0x3a')];if(!_0x1ebeb7[_0x5a94('0x3c')][_0x5a94('0x42')](_0x5a94('0x43'))){_0x425355[_0x5a94('0x1d')]=qs[_0x5a94('0x1d')](_0x1ebeb7[_0x5a94('0x3c')][_0x5a94('0x1d')]);_0x425355[_0x5a94('0x1f')]=qs['offset'](_0x1ebeb7[_0x5a94('0x3c')][_0x5a94('0x1f')]);}_0x425355[_0x5a94('0x44')]=qs['sort'](_0x1ebeb7[_0x5a94('0x3c')][_0x5a94('0x45')]);_0x425355[_0x5a94('0x46')]=qs[_0x5a94('0x3d')](_[_0x5a94('0x47')](_0x1ebeb7[_0x5a94('0x3c')],_0x170647['filters']),_0x1db479);if(_0x1ebeb7[_0x5a94('0x3c')][_0x5a94('0x29')]){_0x425355[_0x5a94('0x46')]=_[_0x5a94('0x48')](_0x425355['where'],{'$or':_[_0x5a94('0x2b')](_0x1db479,function(_0x1ce919){if(_0x1ce919[_0x5a94('0x2e')]!==_0x5a94('0x49')){var _0x2bc12d={};_0x2bc12d[_0x1ce919[_0x5a94('0x30')]]={'$like':'%'+_0x1ebeb7[_0x5a94('0x3c')][_0x5a94('0x29')]+'%'};return _0x2bc12d;}})});}_0x425355=_['merge']({},_0x425355,_0x1ebeb7['options']);var _0x34339d={'where':_0x425355['where']};return db[_0x5a94('0x36')]['count'](_0x34339d)[_0x5a94('0x23')](function(_0x5df959){_0xad3ea9[_0x5a94('0x1e')]=_0x5df959;if(_0x1ebeb7[_0x5a94('0x3c')]['includeAll']){_0x425355[_0x5a94('0x4a')]=[{'all':!![]}];}return db[_0x5a94('0x36')][_0x5a94('0x4b')](_0x425355);})[_0x5a94('0x23')](function(_0x954a3f){_0xad3ea9['rows']=_0x954a3f;return _0xad3ea9;})[_0x5a94('0x23')](respondWithFilteredResult(_0x3173e1,_0x425355))[_0x5a94('0x4c')](handleError(_0x3173e1,null));};exports[_0x5a94('0x4d')]=function(_0x3aeffb,_0x669976){var _0x328575={'raw':![],'where':{'id':_0x3aeffb[_0x5a94('0x4e')]['id']}},_0xa8766c={};_0xa8766c[_0x5a94('0x3a')]=_[_0x5a94('0x3b')](db[_0x5a94('0x36')][_0x5a94('0x37')]);_0xa8766c['query']=_[_0x5a94('0x3b')](_0x3aeffb[_0x5a94('0x3c')]);_0xa8766c['filters']=_[_0x5a94('0x3e')](_0xa8766c[_0x5a94('0x3a')],_0xa8766c[_0x5a94('0x3c')]);_0x328575[_0x5a94('0x40')]=_['intersection'](_0xa8766c[_0x5a94('0x3a')],qs[_0x5a94('0x3f')](_0x3aeffb[_0x5a94('0x3c')][_0x5a94('0x3f')]));_0x328575['attributes']=_0x328575[_0x5a94('0x40')]['length']?_0x328575['attributes']:_0xa8766c[_0x5a94('0x3a')];if(_0x3aeffb[_0x5a94('0x3c')][_0x5a94('0x4f')]){_0x328575[_0x5a94('0x4a')]=[{'all':!![]}];}_0x328575=_['merge']({},_0x328575,_0x3aeffb[_0x5a94('0x50')]);return db[_0x5a94('0x36')]['find'](_0x328575)[_0x5a94('0x23')](handleEntityNotFound(_0x669976,null))[_0x5a94('0x23')](respondWithResult(_0x669976,null))[_0x5a94('0x4c')](handleError(_0x669976,null));};exports[_0x5a94('0x51')]=function(_0x2b38eb,_0x80b7e2){return db[_0x5a94('0x36')][_0x5a94('0x51')](_0x2b38eb['body'],{})[_0x5a94('0x23')](function(_0x55a216){var _0x1709a2=_0x2b38eb[_0x5a94('0x52')][_0x5a94('0x53')]({'plain':!![]});if(!_0x1709a2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1709a2['role']===_0x5a94('0x52')){var _0x51a00f=_0x55a216[_0x5a94('0x53')]({'plain':!![]});var _0x290daf=[{'name':_0x5a94('0x25'),'value':_0x5a94('0x26')},{'name':_0x5a94('0x27'),'value':_0x5a94('0x28')}];var _0x3b1e56=_[_0x5a94('0x2f')](_0x290daf,['value',_0x51a00f[_0x5a94('0x2e')]])[_0x5a94('0x30')];return db[_0x5a94('0x54')][_0x5a94('0x2f')]({'where':{'name':_0x3b1e56,'userProfileId':_0x1709a2[_0x5a94('0x55')]},'raw':!![]})['then'](function(_0xfc4949){if(_0xfc4949&&_0xfc4949['autoAssociation']===0x0){return db[_0x5a94('0x31')][_0x5a94('0x51')]({'name':_0x51a00f[_0x5a94('0x30')],'resourceId':_0x51a00f['id'],'type':_0xfc4949[_0x5a94('0x30')],'sectionId':_0xfc4949['id']},{})[_0x5a94('0x23')](function(){return _0x55a216;});}else{return _0x55a216;}})['catch'](function(_0x459588){logger[_0x5a94('0x32')](_0x5a94('0x56'),_0x459588);throw _0x459588;});}return _0x55a216;})[_0x5a94('0x23')](respondWithResult(_0x80b7e2,0xc9))[_0x5a94('0x4c')](handleError(_0x80b7e2,null));};exports[_0x5a94('0x57')]=function(_0x5d463c,_0x2a7278){var _0x39e16b={'where':{'id':_0x5d463c[_0x5a94('0x4e')]['id']}},_0x4556ed={};_0x4556ed[_0x5a94('0x3a')]=_[_0x5a94('0x3b')](db['VoiceQueue'][_0x5a94('0x37')]);_0x39e16b[_0x5a94('0x40')]=_[_0x5a94('0x3e')](_0x4556ed[_0x5a94('0x3a')],qs[_0x5a94('0x3f')](_0x5d463c['query'][_0x5a94('0x3f')]));_0x39e16b[_0x5a94('0x40')]=_0x39e16b[_0x5a94('0x40')][_0x5a94('0x41')]?_0x39e16b['attributes']:_0x4556ed['model'];if(_0x5d463c[_0x5a94('0x3c')][_0x5a94('0x4f')]){_0x39e16b[_0x5a94('0x4a')]=[{'all':!![]}];}_0x39e16b=_['merge']({},_0x39e16b,_0x5d463c[_0x5a94('0x50')]);return db[_0x5a94('0x36')][_0x5a94('0x2f')](_0x39e16b)[_0x5a94('0x23')](handleEntityNotFound(_0x2a7278,null))[_0x5a94('0x23')](function(_0x34effb){if(_0x34effb){var _0x163050=_0x34effb[_0x5a94('0x53')]({'plain':!![]});_0x163050=qs[_0x5a94('0x58')](_0x163050,['id',_0x5a94('0x59'),_0x5a94('0x5a')]);_0x5d463c[_0x5a94('0x5b')]=_['omit'](_0x5d463c[_0x5a94('0x5b')],['id',_0x5a94('0x59'),_0x5a94('0x5a')]);return db[_0x5a94('0x36')][_0x5a94('0x51')](_[_0x5a94('0x48')](_0x163050,_0x5d463c[_0x5a94('0x5b')]),{'include':_0x5d463c[_0x5a94('0x3c')]['includeAll']?[{'all':!![]}]:undefined})[_0x5a94('0x23')](function(_0x3c75fd){var _0x4d3af4=_0x5d463c['user'][_0x5a94('0x53')]({'plain':!![]});if(!_0x4d3af4)throw new Error(_0x5a94('0x5c'));if(_0x4d3af4['role']===_0x5a94('0x52')){var _0x15d04f=_0x3c75fd[_0x5a94('0x53')]({'plain':!![]});var _0x2888d2=[{'name':'VoiceQueues','value':_0x5a94('0x26')},{'name':_0x5a94('0x27'),'value':_0x5a94('0x28')}];var _0xdca719=_[_0x5a94('0x2f')](_0x2888d2,[_0x5a94('0x2c'),_0x15d04f[_0x5a94('0x2e')]])[_0x5a94('0x30')];return db[_0x5a94('0x54')]['find']({'where':{'name':_0xdca719,'userProfileId':_0x4d3af4[_0x5a94('0x55')]},'raw':!![]})[_0x5a94('0x23')](function(_0x524740){if(_0x524740&&_0x524740['autoAssociation']===0x0){return db[_0x5a94('0x31')][_0x5a94('0x51')]({'name':_0x15d04f[_0x5a94('0x30')],'resourceId':_0x15d04f['id'],'type':_0x524740[_0x5a94('0x30')],'sectionId':_0x524740['id']},{})[_0x5a94('0x23')](function(){return _0x3c75fd;});}else{return _0x3c75fd;}})[_0x5a94('0x4c')](function(_0x62c22d){logger['error'](_0x5a94('0x56'),_0x62c22d);throw _0x62c22d;});}return _0x3c75fd;});}})[_0x5a94('0x23')](respondWithResult(_0x2a7278,0xc9))[_0x5a94('0x4c')](handleError(_0x2a7278,null));};exports[_0x5a94('0x5d')]=function(_0x580054,_0x22cc61){if(_0x580054[_0x5a94('0x5b')]['id']){delete _0x580054['body']['id'];}return db['VoiceQueue'][_0x5a94('0x2f')]({'where':{'id':_0x580054['params']['id']}})[_0x5a94('0x23')](handleEntityNotFound(_0x22cc61,null))['then'](saveUpdates(_0x580054[_0x5a94('0x5b')],null))[_0x5a94('0x23')](respondWithResult(_0x22cc61,null))['catch'](handleError(_0x22cc61,null));};exports[_0x5a94('0x24')]=function(_0x3e1392,_0x26fd50){return db[_0x5a94('0x36')][_0x5a94('0x2f')]({'where':{'id':_0x3e1392[_0x5a94('0x4e')]['id']}})[_0x5a94('0x23')](handleEntityNotFound(_0x26fd50,null))[_0x5a94('0x23')](removeEntity(_0x26fd50,null))['catch'](handleError(_0x26fd50,null));};exports[_0x5a94('0x5e')]=function(_0x4b2a0e,_0x4e48fb,_0x4a3177){var _0x5e53b3={'raw':![],'where':{}};var _0x4ab79c={};var _0x31a09e={'count':0x0,'rows':[]};return db[_0x5a94('0x36')][_0x5a94('0x5f')]({'where':{'id':_0x4b2a0e[_0x5a94('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4e48fb,null))[_0x5a94('0x23')](function(_0x4faa7a){if(_0x4faa7a){_0x4ab79c[_0x5a94('0x3a')]=_[_0x5a94('0x3b')](db[_0x5a94('0x60')][_0x5a94('0x37')]);_0x4ab79c[_0x5a94('0x3c')]=_[_0x5a94('0x3b')](_0x4b2a0e[_0x5a94('0x3c')]);_0x4ab79c[_0x5a94('0x3d')]=_['intersection'](_0x4ab79c[_0x5a94('0x3a')],_0x4ab79c[_0x5a94('0x3c')]);_0x5e53b3[_0x5a94('0x40')]=_[_0x5a94('0x3e')](_0x4ab79c['model'],qs[_0x5a94('0x3f')](_0x4b2a0e['query'][_0x5a94('0x3f')]));_0x5e53b3[_0x5a94('0x40')]=_0x5e53b3['attributes'][_0x5a94('0x41')]?_0x5e53b3[_0x5a94('0x40')]:_0x4ab79c[_0x5a94('0x3a')];if(!_0x4b2a0e[_0x5a94('0x3c')][_0x5a94('0x42')](_0x5a94('0x43'))){_0x5e53b3[_0x5a94('0x1d')]=qs['limit'](_0x4b2a0e[_0x5a94('0x3c')][_0x5a94('0x1d')]);_0x5e53b3['offset']=qs[_0x5a94('0x1f')](_0x4b2a0e[_0x5a94('0x3c')]['offset']);}_0x5e53b3['order']=qs[_0x5a94('0x45')](_0x4b2a0e[_0x5a94('0x3c')][_0x5a94('0x45')]);_0x5e53b3[_0x5a94('0x46')]=qs[_0x5a94('0x3d')](_['pick'](_0x4b2a0e[_0x5a94('0x3c')],_0x4ab79c[_0x5a94('0x3d')]));_0x5e53b3[_0x5a94('0x46')][_0x5a94('0x61')]=_0x4faa7a['id'];if(_0x4b2a0e['query'][_0x5a94('0x29')]){_0x5e53b3[_0x5a94('0x46')]=_[_0x5a94('0x48')](_0x5e53b3[_0x5a94('0x46')],{'$or':_[_0x5a94('0x2b')](_0x5e53b3[_0x5a94('0x40')],function(_0xd5e760){var _0x3e02a1={};_0x3e02a1[_0xd5e760]={'$like':'%'+_0x4b2a0e['query'][_0x5a94('0x29')]+'%'};return _0x3e02a1;})});}_0x5e53b3=_[_0x5a94('0x48')]({},_0x5e53b3,_0x4b2a0e[_0x5a94('0x50')]);return db[_0x5a94('0x60')]['count']({'where':_0x5e53b3['where']})[_0x5a94('0x23')](function(_0xdd5500){_0x31a09e[_0x5a94('0x1e')]=_0xdd5500;if(_0x4b2a0e[_0x5a94('0x3c')][_0x5a94('0x4f')]){_0x5e53b3[_0x5a94('0x4a')]=[{'all':!![]}];}return db[_0x5a94('0x60')]['findAll'](_0x5e53b3);})['then'](function(_0x5bfcad){_0x31a09e[_0x5a94('0x62')]=_0x5bfcad;return _0x31a09e;});}})[_0x5a94('0x23')](respondWithFilteredResult(_0x4e48fb,_0x5e53b3))[_0x5a94('0x4c')](handleError(_0x4e48fb,null));};exports[_0x5a94('0x63')]=function(_0x19132d,_0x505a56,_0x460499){var _0x2b19ed={'raw':!![],'where':{}};var _0x7f7cca={};var _0x57079e={'count':0x0,'rows':[]};return db[_0x5a94('0x36')]['findOne']({'where':{'id':_0x19132d['params']['id']}})[_0x5a94('0x23')](handleEntityNotFound(_0x505a56,null))[_0x5a94('0x23')](function(_0x54ae30){if(_0x54ae30){_0x7f7cca['model']=_[_0x5a94('0x3b')](db[_0x5a94('0x64')][_0x5a94('0x37')]);_0x7f7cca[_0x5a94('0x3c')]=_['keys'](_0x19132d[_0x5a94('0x3c')]);_0x7f7cca['filters']=_[_0x5a94('0x3e')](_0x7f7cca[_0x5a94('0x3a')],_0x7f7cca[_0x5a94('0x3c')]);_0x2b19ed[_0x5a94('0x40')]=_[_0x5a94('0x3e')](_0x7f7cca[_0x5a94('0x3a')],qs['fields'](_0x19132d[_0x5a94('0x3c')][_0x5a94('0x3f')]));_0x2b19ed[_0x5a94('0x40')]=_0x2b19ed[_0x5a94('0x40')][_0x5a94('0x41')]?_0x2b19ed[_0x5a94('0x40')]:_0x7f7cca[_0x5a94('0x3a')];if(!_0x19132d[_0x5a94('0x3c')]['hasOwnProperty'](_0x5a94('0x43'))){_0x2b19ed['limit']=qs['limit'](_0x19132d[_0x5a94('0x3c')][_0x5a94('0x1d')]);_0x2b19ed[_0x5a94('0x1f')]=qs[_0x5a94('0x1f')](_0x19132d['query'][_0x5a94('0x1f')]);}_0x2b19ed['order']=qs[_0x5a94('0x45')](_0x19132d['query'][_0x5a94('0x45')]);_0x2b19ed[_0x5a94('0x46')]=qs['filters'](_['pick'](_0x19132d['query'],_0x7f7cca[_0x5a94('0x3d')]));_0x2b19ed['where'][_0x5a94('0x61')]=_0x54ae30['id'];if(_0x19132d['query'][_0x5a94('0x29')]){_0x2b19ed[_0x5a94('0x46')]=_[_0x5a94('0x48')](_0x2b19ed[_0x5a94('0x46')],{'$or':_[_0x5a94('0x2b')](_0x2b19ed[_0x5a94('0x40')],function(_0x4f33ff){var _0x3bbd56={};_0x3bbd56[_0x4f33ff]={'$like':'%'+_0x19132d[_0x5a94('0x3c')][_0x5a94('0x29')]+'%'};return _0x3bbd56;})});}_0x2b19ed=_[_0x5a94('0x48')]({},_0x2b19ed,_0x19132d[_0x5a94('0x50')]);return db['CmHopperHistory']['count']({'where':_0x2b19ed['where']})[_0x5a94('0x23')](function(_0x569fbb){_0x57079e[_0x5a94('0x1e')]=_0x569fbb;if(_0x19132d['query'][_0x5a94('0x4f')]){_0x2b19ed[_0x5a94('0x4a')]=[{'all':!![]}];}return db[_0x5a94('0x64')]['findAll'](_0x2b19ed);})['then'](function(_0x3a2c13){_0x57079e[_0x5a94('0x62')]=_0x3a2c13;return _0x57079e;});}})[_0x5a94('0x23')](respondWithFilteredResult(_0x505a56,_0x2b19ed))['catch'](handleError(_0x505a56,null));};exports['getHopperFinals']=function(_0x4b247c,_0x53bd40,_0x3291fc){var _0x5eb87f={'raw':!![],'where':{}};var _0x361008={};var _0x2e76dd={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x5a94('0x5f')]({'where':{'id':_0x4b247c[_0x5a94('0x4e')]['id']}})[_0x5a94('0x23')](handleEntityNotFound(_0x53bd40,null))['then'](function(_0x18b2b9){if(_0x18b2b9){_0x361008[_0x5a94('0x3a')]=_['keys'](db[_0x5a94('0x65')][_0x5a94('0x37')]);_0x361008[_0x5a94('0x3c')]=_[_0x5a94('0x3b')](_0x4b247c[_0x5a94('0x3c')]);_0x361008[_0x5a94('0x3d')]=_['intersection'](_0x361008[_0x5a94('0x3a')],_0x361008[_0x5a94('0x3c')]);_0x5eb87f['attributes']=_[_0x5a94('0x3e')](_0x361008['model'],qs[_0x5a94('0x3f')](_0x4b247c['query'][_0x5a94('0x3f')]));_0x5eb87f[_0x5a94('0x40')]=_0x5eb87f[_0x5a94('0x40')][_0x5a94('0x41')]?_0x5eb87f[_0x5a94('0x40')]:_0x361008['model'];if(!_0x4b247c[_0x5a94('0x3c')]['hasOwnProperty']('nolimit')){_0x5eb87f[_0x5a94('0x1d')]=qs[_0x5a94('0x1d')](_0x4b247c[_0x5a94('0x3c')]['limit']);_0x5eb87f[_0x5a94('0x1f')]=qs[_0x5a94('0x1f')](_0x4b247c[_0x5a94('0x3c')][_0x5a94('0x1f')]);}_0x5eb87f['order']=qs['sort'](_0x4b247c[_0x5a94('0x3c')][_0x5a94('0x45')]);_0x5eb87f[_0x5a94('0x46')]=qs['filters'](_['pick'](_0x4b247c[_0x5a94('0x3c')],_0x361008['filters']));_0x5eb87f[_0x5a94('0x46')][_0x5a94('0x61')]=_0x18b2b9['id'];if(_0x4b247c[_0x5a94('0x3c')]['filter']){_0x5eb87f[_0x5a94('0x46')]=_[_0x5a94('0x48')](_0x5eb87f[_0x5a94('0x46')],{'$or':_[_0x5a94('0x2b')](_0x5eb87f[_0x5a94('0x40')],function(_0x191435){var _0x39b775={};_0x39b775[_0x191435]={'$like':'%'+_0x4b247c['query'][_0x5a94('0x29')]+'%'};return _0x39b775;})});}_0x5eb87f=_['merge']({},_0x5eb87f,_0x4b247c['options']);return db[_0x5a94('0x65')]['count']({'where':_0x5eb87f['where']})[_0x5a94('0x23')](function(_0x50616e){_0x2e76dd[_0x5a94('0x1e')]=_0x50616e;if(_0x4b247c[_0x5a94('0x3c')]['includeAll']){_0x5eb87f[_0x5a94('0x4a')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x5a94('0x4b')](_0x5eb87f);})[_0x5a94('0x23')](function(_0x570711){_0x2e76dd['rows']=_0x570711;return _0x2e76dd;});}})[_0x5a94('0x23')](respondWithFilteredResult(_0x53bd40,_0x5eb87f))['catch'](handleError(_0x53bd40,null));};exports[_0x5a94('0x66')]=function(_0x35b236,_0x357341,_0xc0f6bf){var _0x2fa988={'raw':!![],'where':{}};var _0x361b70={};var _0x29cc9c={'count':0x0,'rows':[]};return db[_0x5a94('0x36')][_0x5a94('0x5f')]({'where':{'id':_0x35b236['params']['id']}})[_0x5a94('0x23')](handleEntityNotFound(_0x357341,null))['then'](function(_0x7ae773){if(_0x7ae773){_0x361b70[_0x5a94('0x3a')]=_[_0x5a94('0x3b')](db[_0x5a94('0x67')][_0x5a94('0x37')]);_0x361b70[_0x5a94('0x3c')]=_[_0x5a94('0x3b')](_0x35b236[_0x5a94('0x3c')]);_0x361b70[_0x5a94('0x3d')]=_[_0x5a94('0x3e')](_0x361b70[_0x5a94('0x3a')],_0x361b70[_0x5a94('0x3c')]);_0x2fa988[_0x5a94('0x40')]=_[_0x5a94('0x3e')](_0x361b70[_0x5a94('0x3a')],qs[_0x5a94('0x3f')](_0x35b236[_0x5a94('0x3c')][_0x5a94('0x3f')]));_0x2fa988['attributes']=_0x2fa988[_0x5a94('0x40')][_0x5a94('0x41')]?_0x2fa988[_0x5a94('0x40')]:_0x361b70[_0x5a94('0x3a')];if(!_0x35b236[_0x5a94('0x3c')][_0x5a94('0x42')](_0x5a94('0x43'))){_0x2fa988['limit']=qs[_0x5a94('0x1d')](_0x35b236[_0x5a94('0x3c')][_0x5a94('0x1d')]);_0x2fa988[_0x5a94('0x1f')]=qs[_0x5a94('0x1f')](_0x35b236[_0x5a94('0x3c')][_0x5a94('0x1f')]);}_0x2fa988[_0x5a94('0x44')]=qs[_0x5a94('0x45')](_0x35b236[_0x5a94('0x3c')][_0x5a94('0x45')]);_0x2fa988[_0x5a94('0x46')]=qs[_0x5a94('0x3d')](_[_0x5a94('0x47')](_0x35b236[_0x5a94('0x3c')],_0x361b70[_0x5a94('0x3d')]));_0x2fa988['where'][_0x5a94('0x61')]=_0x7ae773['id'];if(_0x35b236['query'][_0x5a94('0x29')]){_0x2fa988[_0x5a94('0x46')]=_['merge'](_0x2fa988[_0x5a94('0x46')],{'$or':_['map'](_0x2fa988[_0x5a94('0x40')],function(_0x5ad026){var _0x5e93b2={};_0x5e93b2[_0x5ad026]={'$like':'%'+_0x35b236[_0x5a94('0x3c')][_0x5a94('0x29')]+'%'};return _0x5e93b2;})});}_0x2fa988=_[_0x5a94('0x48')]({},_0x2fa988,_0x35b236['options']);return db[_0x5a94('0x67')]['count']({'where':_0x2fa988[_0x5a94('0x46')]})[_0x5a94('0x23')](function(_0x499470){_0x29cc9c[_0x5a94('0x1e')]=_0x499470;if(_0x35b236[_0x5a94('0x3c')][_0x5a94('0x4f')]){_0x2fa988[_0x5a94('0x4a')]=[{'all':!![]}];}return db[_0x5a94('0x67')][_0x5a94('0x4b')](_0x2fa988);})[_0x5a94('0x23')](function(_0x296bad){_0x29cc9c['rows']=_0x296bad;return _0x29cc9c;});}})[_0x5a94('0x23')](respondWithFilteredResult(_0x357341,_0x2fa988))[_0x5a94('0x4c')](handleError(_0x357341,null));};exports[_0x5a94('0x68')]=function(_0x2a64ef,_0x2fd6fc,_0x140445){var _0x4a7ab3={};var _0xbe7208={};var _0x5dfeeb;var _0x3e519a;return db[_0x5a94('0x36')][_0x5a94('0x5f')]({'where':{'id':_0x2a64ef[_0x5a94('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2fd6fc,null))['then'](function(_0x1923f8){if(_0x1923f8){_0x5dfeeb=_0x1923f8;_0xbe7208[_0x5a94('0x3a')]=_[_0x5a94('0x3b')](db[_0x5a94('0x69')]['rawAttributes']);_0xbe7208[_0x5a94('0x3c')]=_[_0x5a94('0x3b')](_0x2a64ef[_0x5a94('0x3c')]);_0xbe7208['filters']=_[_0x5a94('0x3e')](_0xbe7208['model'],_0xbe7208['query']);_0x4a7ab3[_0x5a94('0x40')]=_[_0x5a94('0x3e')](_0xbe7208[_0x5a94('0x3a')],qs[_0x5a94('0x3f')](_0x2a64ef[_0x5a94('0x3c')]['fields']));_0x4a7ab3[_0x5a94('0x40')]=_0x4a7ab3[_0x5a94('0x40')][_0x5a94('0x41')]?_0x4a7ab3[_0x5a94('0x40')]:_0xbe7208['model'];_0x4a7ab3['order']=qs[_0x5a94('0x45')](_0x2a64ef[_0x5a94('0x3c')]['sort']);_0x4a7ab3[_0x5a94('0x46')]=qs['filters'](_[_0x5a94('0x47')](_0x2a64ef[_0x5a94('0x3c')],_0xbe7208['filters']));if(_0x2a64ef[_0x5a94('0x3c')][_0x5a94('0x29')]){_0x4a7ab3[_0x5a94('0x46')]=_[_0x5a94('0x48')](_0x4a7ab3[_0x5a94('0x46')],{'$or':_[_0x5a94('0x2b')](_0x4a7ab3[_0x5a94('0x40')],function(_0x49f726){var _0x52c40c={};_0x52c40c[_0x49f726]={'$like':'%'+_0x2a64ef[_0x5a94('0x3c')][_0x5a94('0x29')]+'%'};return _0x52c40c;})});}_0x4a7ab3=_['merge']({},_0x4a7ab3,_0x2a64ef[_0x5a94('0x50')]);return _0x5dfeeb[_0x5a94('0x68')](_0x4a7ab3);}})[_0x5a94('0x23')](function(_0x5cfa44){if(_0x5cfa44){_0x3e519a=_0x5cfa44[_0x5a94('0x41')];if(!_0x2a64ef['query']['hasOwnProperty'](_0x5a94('0x43'))){_0x4a7ab3[_0x5a94('0x1d')]=qs[_0x5a94('0x1d')](_0x2a64ef[_0x5a94('0x3c')][_0x5a94('0x1d')]);_0x4a7ab3[_0x5a94('0x1f')]=qs[_0x5a94('0x1f')](_0x2a64ef[_0x5a94('0x3c')][_0x5a94('0x1f')]);}return _0x5dfeeb[_0x5a94('0x68')](_0x4a7ab3);}})[_0x5a94('0x23')](function(_0x12bf1e){if(_0x12bf1e){return _0x12bf1e?{'count':_0x3e519a,'rows':_0x12bf1e}:null;}})[_0x5a94('0x23')](respondWithResult(_0x2fd6fc,null))[_0x5a94('0x4c')](handleError(_0x2fd6fc,null));};exports['addTeams']=function(_0x461d04,_0xc9c44b,_0x23bf55){var _0x23c318=_0x461d04[_0x5a94('0x5b')][_0x5a94('0x6a')];var _0x34d68d=_[_0x5a94('0x2b')](_0x23c318,'id');return db['Team'][_0x5a94('0x4b')]({'where':{'id':_0x34d68d},'attributes':['id'],'include':[{'model':db[_0x5a94('0x6b')],'as':_0x5a94('0x6c'),'attributes':['id',_0x5a94('0x30'),'online',_0x5a94('0x6d'),'interface'],'raw':!![]}]})['then'](function(_0x36f55d){if(_0x36f55d){var _0x316680=_['flatMap'](_0x36f55d,function(_0x5d1c7e){var _0x586fdf=_0x5d1c7e['get']({'plain':!![]});_0x586fdf['Agents'][_0x5a94('0x6e')](function(_0x56aede){_0x56aede[_0x5a94('0x6f')]=_[_0x5a94('0x2f')](_0x23c318,{'id':_0x586fdf['id']})['penalty'];});return _0x586fdf[_0x5a94('0x6c')];});return db['VoiceQueue']['find']({'where':{'id':_0x461d04[_0x5a94('0x4e')]['id']}})[_0x5a94('0x23')](function(_0x415e5b){return db['sequelize'][_0x5a94('0x70')](function(_0xa106a7){return _0x415e5b[_0x5a94('0x71')](_0x34d68d,{'transaction':_0xa106a7})[_0x5a94('0x23')](function(){return BPromise['each'](_0x23c318,function(_0x24df7b){return db[_0x5a94('0x72')]['upsert']({'TeamId':_0x24df7b['id'],'VoiceQueueId':_0x461d04[_0x5a94('0x4e')]['id'],'penalty':_0x24df7b[_0x5a94('0x6f')]},{'transaction':_0xa106a7});});})[_0x5a94('0x23')](function(){return BPromise['each'](_0x316680,function(_0x8792e6){return db[_0x5a94('0x73')]['findOrCreate']({'where':{'UserId':_0x8792e6['id'],'VoiceQueueId':_0x461d04[_0x5a94('0x4e')]['id']},'defaults':{'penalty':_0x8792e6[_0x5a94('0x6f')]},'transaction':_0xa106a7});});})[_0x5a94('0x23')](function(){return BPromise[_0x5a94('0x74')](_[_0x5a94('0x29')](_0x316680,{'online':!![]}),function(_0x750a7c){return db[_0x5a94('0x75')]['upsert']({'membername':_0x750a7c[_0x5a94('0x30')],'UserId':_0x750a7c['id'],'queue_name':_0x415e5b['name'],'VoiceQueueId':_0x415e5b['id'],'interface':_['isNil'](_0x750a7c[_0x5a94('0x76')])?util[_0x5a94('0x77')](_0x5a94('0x78'),_0x750a7c[_0x5a94('0x30')]):_0x750a7c[_0x5a94('0x76')],'paused':_0x750a7c[_0x5a94('0x6d')]||![],'penalty':_0x750a7c[_0x5a94('0x6f')]},{'transaction':_0xa106a7});});})[_0x5a94('0x23')](function(){_0x316680[_0x5a94('0x6e')](function(_0x2b2107){socket[_0x5a94('0x79')](_0x5a94('0x7a'),{'UserId':_0x2b2107['id'],'VoiceQueueId':_0x415e5b['id']});});});});});}})[_0x5a94('0x23')](respondWithStatusCode(_0xc9c44b,null))['catch'](handleError(_0xc9c44b,null));};exports['removeTeams']=function(_0x4ec3df,_0x2945b3,_0x21cb00){return db[_0x5a94('0x69')]['findAll']({'where':{'id':_0x4ec3df['query'][_0x5a94('0x7b')]},'attributes':['id'],'include':[{'model':db[_0x5a94('0x6b')],'as':_0x5a94('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x5a94('0x23')](handleEntityNotFound(_0x2945b3,null))[_0x5a94('0x23')](function(_0x1eeb44){var _0x128089=_[_0x5a94('0x2b')](_0x1eeb44,'id');var _0x5309ae=[];var _0x16dab8=[];var _0x4c6029=squel[_0x5a94('0x7c')]();_0x4c6029[_0x5a94('0x7d')](_0x5a94('0x7e'))[_0x5a94('0x7f')]('team_has_voice_queues','tq')[_0x5a94('0x80')](_0x5a94('0x81'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x5a94('0x46')](_0x5a94('0x82'),_0x4ec3df[_0x5a94('0x4e')]['id']);for(var _0x5e67c4=0x0;_0x5e67c4<_0x1eeb44[_0x5a94('0x41')];_0x5e67c4+=0x1){let _0x108755=_0x1eeb44[_0x5e67c4];for(var _0x30b363=0x0;_0x30b363<_0x108755[_0x5a94('0x6c')][_0x5a94('0x41')];_0x30b363+=0x1){let _0xf1ddc8=_0x108755[_0x5a94('0x6c')][_0x30b363];var _0x304967=_0x4c6029[_0x5a94('0x57')]();_0x304967[_0x5a94('0x46')]('ut.UserId\x20=\x20?',_0xf1ddc8['id']);_0x16dab8[_0x5a94('0x83')](db['sequelize'][_0x5a94('0x3c')](_0x304967[_0x5a94('0x84')](),{'type':db['sequelize'][_0x5a94('0x85')]['SELECT']})['then'](function(_0x407feb){if(_0x407feb[_0x5a94('0x41')]===0x1){return _0xf1ddc8['id'];}else{var _0x2e8352=_[_0x5a94('0x86')](_[_0x5a94('0x2b')](_0x407feb,'TeamId'),function(_0x42a887){return _[_0x5a94('0x2d')](_0x128089,_0x42a887);});if(_0x2e8352){return _0xf1ddc8['id'];}}}));}}return BPromise[_0x5a94('0x87')](_0x16dab8)[_0x5a94('0x23')](function(_0x4f042b){_0x5309ae=_(_0x5309ae)[_0x5a94('0x88')](_0x4f042b)[_0x5a94('0x89')]()[_0x5a94('0x2c')]();return db['VoiceQueue'][_0x5a94('0x2f')]({'where':{'id':_0x4ec3df[_0x5a94('0x4e')]['id']}})[_0x5a94('0x23')](function(_0x1fc7a9){return db[_0x5a94('0x8a')][_0x5a94('0x70')](function(_0x2bdd53){return _0x1fc7a9[_0x5a94('0x8b')](_0x4ec3df['query'][_0x5a94('0x7b')],{'transaction':_0x2bdd53})[_0x5a94('0x23')](function(){if(!_[_0x5a94('0x8c')](_0x5309ae)){return _0x1fc7a9[_0x5a94('0x8d')](_0x5309ae,{'transaction':_0x2bdd53})[_0x5a94('0x23')](function(){return db[_0x5a94('0x75')][_0x5a94('0x24')]({'where':{'VoiceQueueId':_0x4ec3df[_0x5a94('0x4e')]['id'],'UserId':_0x5309ae},'transaction':_0x2bdd53});});}})[_0x5a94('0x23')](function(){_0x5309ae['forEach'](function(_0x23ebaa){socket[_0x5a94('0x79')](_0x5a94('0x8e'),{'UserId':_0x23ebaa,'VoiceQueueId':_0x1fc7a9['id']});});});});});});})[_0x5a94('0x23')](respondWithStatusCode(_0x2945b3,null))['catch'](handleError(_0x2945b3,null));};exports['addAgents']=function(_0x223942,_0x2c2e76,_0x4787ef){var _0x52bd90,_0x130c48;return db['VoiceQueue'][_0x5a94('0x2f')]({'where':{'id':_0x223942[_0x5a94('0x4e')]['id']}})[_0x5a94('0x23')](handleEntityNotFound(_0x2c2e76,null))[_0x5a94('0x23')](function(_0x55cb0a){if(_0x55cb0a){_0x130c48=_0x55cb0a;return _0x55cb0a[_0x5a94('0x8f')](_0x223942[_0x5a94('0x5b')][_0x5a94('0x7b')],_[_0x5a94('0x58')](_0x223942[_0x5a94('0x5b')],['ids','id'])||{})[_0x5a94('0x90')](function(_0x2c032b){for(var _0x2f9eed=0x0;_0x2f9eed<_0x223942[_0x5a94('0x5b')][_0x5a94('0x7b')]['length'];_0x2f9eed+=0x1){socket['emit'](_0x5a94('0x7a'),{'UserId':Number(_0x223942[_0x5a94('0x5b')][_0x5a94('0x7b')][_0x2f9eed]),'VoiceQueueId':Number(_0x223942['params']['id'])});}return _0x2c032b;});}})[_0x5a94('0x23')](function(_0x50365b){_0x52bd90=_0x50365b||[];if(_0x130c48){return db[_0x5a94('0x6b')]['findAll']({'where':{'id':_0x223942[_0x5a94('0x5b')]['ids']},'attributes':['id',_0x5a94('0x30'),_0x5a94('0x91'),_0x5a94('0x6d'),_0x5a94('0x76')],'raw':!![]});}})[_0x5a94('0x23')](function(_0x1457b1){if(!_[_0x5a94('0x8c')](_0x1457b1)){var _0x528190=[];for(var _0x7f5fbb=0x0;_0x7f5fbb<_0x1457b1[_0x5a94('0x41')];_0x7f5fbb++){if(_0x1457b1[_0x7f5fbb][_0x5a94('0x91')]){_0x528190[_0x5a94('0x83')](db[_0x5a94('0x75')][_0x5a94('0x92')]({'membername':_0x1457b1[_0x7f5fbb][_0x5a94('0x30')],'UserId':_0x1457b1[_0x7f5fbb]['id'],'queue_name':_0x130c48[_0x5a94('0x30')],'VoiceQueueId':_0x130c48['id'],'interface':_[_0x5a94('0x93')](_0x1457b1[_0x7f5fbb]['interface'])?util[_0x5a94('0x77')](_0x5a94('0x78'),_0x1457b1[_0x7f5fbb][_0x5a94('0x30')]):_0x1457b1[_0x7f5fbb][_0x5a94('0x76')],'paused':_0x1457b1[_0x7f5fbb]['voicePause']||![],'penalty':_0x223942[_0x5a94('0x5b')]['penalty']||0x0}));}}return BPromise[_0x5a94('0x87')](_0x528190);}})['then'](function(){return _0x52bd90;})[_0x5a94('0x23')](respondWithResult(_0x2c2e76,null))['catch'](handleError(_0x2c2e76,null));};exports[_0x5a94('0x8d')]=function(_0x54e2c5,_0x21490c,_0x245a1e){return db['VoiceQueue'][_0x5a94('0x2f')]({'where':{'id':_0x54e2c5[_0x5a94('0x4e')]['id']}})[_0x5a94('0x23')](handleEntityNotFound(_0x21490c,null))[_0x5a94('0x23')](function(_0x1d9cad){if(_0x1d9cad){return _0x1d9cad[_0x5a94('0x8d')](_0x54e2c5[_0x5a94('0x3c')][_0x5a94('0x7b')])[_0x5a94('0x23')](function(){if(_[_0x5a94('0x94')](_0x54e2c5['query'][_0x5a94('0x7b')])){for(var _0x5cd6cc=0x0;_0x5cd6cc<_0x54e2c5['query'][_0x5a94('0x7b')][_0x5a94('0x41')];_0x5cd6cc+=0x1){socket[_0x5a94('0x79')](_0x5a94('0x8e'),{'UserId':Number(_0x54e2c5[_0x5a94('0x3c')]['ids'][_0x5cd6cc]),'VoiceQueueId':Number(_0x54e2c5[_0x5a94('0x4e')]['id'])});}}else{socket[_0x5a94('0x79')](_0x5a94('0x8e'),{'UserId':Number(_0x54e2c5[_0x5a94('0x3c')]['ids']),'VoiceQueueId':Number(_0x54e2c5[_0x5a94('0x4e')]['id'])});}});}})[_0x5a94('0x23')](function(_0x13f604){return db[_0x5a94('0x75')][_0x5a94('0x24')]({'where':{'VoiceQueueId':_0x54e2c5[_0x5a94('0x4e')]['id'],'UserId':_0x54e2c5['query'][_0x5a94('0x7b')]}})[_0x5a94('0x23')](function(){return _0x13f604;});})[_0x5a94('0x23')](respondWithStatusCode(_0x21490c,null))[_0x5a94('0x4c')](handleError(_0x21490c,null));};exports[_0x5a94('0x95')]=function(_0x29cc3f,_0x3a9bd7,_0x2739e0){var _0x48a23c={};var _0x4e464b={};var _0x57834d;var _0x42ea6a;return db['VoiceQueue'][_0x5a94('0x5f')]({'where':{'id':_0x29cc3f[_0x5a94('0x4e')]['id']}})[_0x5a94('0x23')](handleEntityNotFound(_0x3a9bd7,null))[_0x5a94('0x23')](function(_0xecdb07){if(_0xecdb07){_0x57834d=_0xecdb07;_0x4e464b[_0x5a94('0x3a')]=_[_0x5a94('0x3b')](db[_0x5a94('0x6b')]['rawAttributes']);_0x4e464b[_0x5a94('0x3c')]=_[_0x5a94('0x3b')](_0x29cc3f[_0x5a94('0x3c')]);_0x4e464b[_0x5a94('0x3d')]=_[_0x5a94('0x3e')](_0x4e464b[_0x5a94('0x3a')],_0x4e464b['query']);_0x48a23c[_0x5a94('0x40')]=_['intersection'](_0x4e464b['model'],qs[_0x5a94('0x3f')](_0x29cc3f[_0x5a94('0x3c')][_0x5a94('0x3f')]));_0x48a23c[_0x5a94('0x40')]=_0x48a23c[_0x5a94('0x40')][_0x5a94('0x41')]?_0x48a23c['attributes']:_0x4e464b[_0x5a94('0x3a')];_0x48a23c['order']=qs[_0x5a94('0x45')](_0x29cc3f['query'][_0x5a94('0x45')]);_0x48a23c[_0x5a94('0x46')]=qs[_0x5a94('0x3d')](_[_0x5a94('0x47')](_0x29cc3f[_0x5a94('0x3c')],_0x4e464b['filters']));if(_0x29cc3f[_0x5a94('0x3c')][_0x5a94('0x29')]){_0x48a23c[_0x5a94('0x46')]=_[_0x5a94('0x48')](_0x48a23c[_0x5a94('0x46')],{'$or':_[_0x5a94('0x2b')](_0x48a23c[_0x5a94('0x40')],function(_0x3d3291){var _0x52a5bb={};_0x52a5bb[_0x3d3291]={'$like':'%'+_0x29cc3f[_0x5a94('0x3c')]['filter']+'%'};return _0x52a5bb;})});}_0x48a23c=_['merge']({},_0x48a23c,_0x29cc3f[_0x5a94('0x50')]);return _0x57834d[_0x5a94('0x95')](_0x48a23c);}})[_0x5a94('0x23')](function(_0x33d513){if(_0x33d513){_0x42ea6a=_0x33d513[_0x5a94('0x41')];if(!_0x29cc3f[_0x5a94('0x3c')][_0x5a94('0x42')](_0x5a94('0x43'))){_0x48a23c['limit']=qs[_0x5a94('0x1d')](_0x29cc3f['query'][_0x5a94('0x1d')]);_0x48a23c[_0x5a94('0x1f')]=qs['offset'](_0x29cc3f[_0x5a94('0x3c')][_0x5a94('0x1f')]);}return _0x57834d['getAgents'](_0x48a23c);}})[_0x5a94('0x23')](function(_0x43805a){if(_0x43805a){return _0x43805a?{'count':_0x42ea6a,'rows':_0x43805a}:null;}})[_0x5a94('0x23')](respondWithResult(_0x3a9bd7,null))[_0x5a94('0x4c')](handleError(_0x3a9bd7,null));};exports[_0x5a94('0x96')]=function(_0x194c7d,_0x5af5d0,_0x2db6cf){var _0x433ddc={};var _0x2e1403={};var _0x83bcf3;var _0x59ba57;return db[_0x5a94('0x36')][_0x5a94('0x5f')]({'where':{'id':_0x194c7d['params']['id']}})[_0x5a94('0x23')](handleEntityNotFound(_0x5af5d0,null))[_0x5a94('0x23')](function(_0x49fad2){if(_0x49fad2){_0x83bcf3=_0x49fad2;_0x2e1403[_0x5a94('0x3a')]=_[_0x5a94('0x3b')](db[_0x5a94('0x75')][_0x5a94('0x37')]);_0x2e1403[_0x5a94('0x3c')]=_[_0x5a94('0x3b')](_0x194c7d[_0x5a94('0x3c')]);_0x2e1403['filters']=_[_0x5a94('0x3e')](_0x2e1403['model'],_0x2e1403[_0x5a94('0x3c')]);_0x433ddc[_0x5a94('0x40')]=_[_0x5a94('0x3e')](_0x2e1403['model'],qs[_0x5a94('0x3f')](_0x194c7d[_0x5a94('0x3c')][_0x5a94('0x3f')]));_0x433ddc[_0x5a94('0x40')]=_0x433ddc[_0x5a94('0x40')]['length']?_0x433ddc[_0x5a94('0x40')]:_0x2e1403[_0x5a94('0x3a')];_0x433ddc[_0x5a94('0x44')]=qs[_0x5a94('0x45')](_0x194c7d[_0x5a94('0x3c')]['sort']);_0x433ddc[_0x5a94('0x46')]=qs[_0x5a94('0x3d')](_['pick'](_0x194c7d[_0x5a94('0x3c')],_0x2e1403[_0x5a94('0x3d')]));if(_0x194c7d[_0x5a94('0x3c')][_0x5a94('0x29')]){_0x433ddc['where']=_[_0x5a94('0x48')](_0x433ddc[_0x5a94('0x46')],{'$or':_[_0x5a94('0x2b')](_0x433ddc[_0x5a94('0x40')],function(_0x64b76e){var _0x373961={};_0x373961[_0x64b76e]={'$like':'%'+_0x194c7d[_0x5a94('0x3c')][_0x5a94('0x29')]+'%'};return _0x373961;})});}_0x433ddc=_[_0x5a94('0x48')]({},_0x433ddc,_0x194c7d[_0x5a94('0x50')]);return _0x83bcf3['getMembers'](_0x433ddc);}})[_0x5a94('0x23')](function(_0x4125e7){if(_0x4125e7){_0x59ba57=_0x4125e7[_0x5a94('0x41')];if(!_0x194c7d['query'][_0x5a94('0x42')]('nolimit')){_0x433ddc[_0x5a94('0x1d')]=qs[_0x5a94('0x1d')](_0x194c7d[_0x5a94('0x3c')]['limit']);_0x433ddc[_0x5a94('0x1f')]=qs[_0x5a94('0x1f')](_0x194c7d[_0x5a94('0x3c')]['offset']);}return _0x83bcf3['getMembers'](_0x433ddc);}})[_0x5a94('0x23')](function(_0x4f8366){return _0x4f8366?{'count':_0x59ba57,'rows':_0x4f8366}:null;})[_0x5a94('0x23')](respondWithResult(_0x5af5d0,null))[_0x5a94('0x4c')](handleError(_0x5af5d0,null));};exports['getLists']=function(_0x3f0d4d,_0x253c80,_0x3eea6b){var _0x51346d={};var _0x1cc076={};var _0x4c673;var _0x2fd1d8;return db[_0x5a94('0x36')][_0x5a94('0x5f')]({'where':{'id':_0x3f0d4d['params']['id']}})[_0x5a94('0x23')](handleEntityNotFound(_0x253c80,null))[_0x5a94('0x23')](function(_0x9c3875){if(_0x9c3875){_0x4c673=_0x9c3875;_0x1cc076['model']=_[_0x5a94('0x3b')](db[_0x5a94('0x97')][_0x5a94('0x37')]);_0x1cc076['query']=_[_0x5a94('0x3b')](_0x3f0d4d[_0x5a94('0x3c')]);_0x1cc076['filters']=_[_0x5a94('0x3e')](_0x1cc076[_0x5a94('0x3a')],_0x1cc076[_0x5a94('0x3c')]);_0x51346d['attributes']=_[_0x5a94('0x3e')](_0x1cc076[_0x5a94('0x3a')],qs[_0x5a94('0x3f')](_0x3f0d4d['query'][_0x5a94('0x3f')]));_0x51346d[_0x5a94('0x40')]=_0x51346d[_0x5a94('0x40')][_0x5a94('0x41')]?_0x51346d[_0x5a94('0x40')]:_0x1cc076[_0x5a94('0x3a')];_0x51346d[_0x5a94('0x44')]=qs[_0x5a94('0x45')](_0x3f0d4d[_0x5a94('0x3c')][_0x5a94('0x45')]);_0x51346d[_0x5a94('0x46')]=qs[_0x5a94('0x3d')](_[_0x5a94('0x47')](_0x3f0d4d[_0x5a94('0x3c')],_0x1cc076[_0x5a94('0x3d')]));if(_0x3f0d4d[_0x5a94('0x3c')][_0x5a94('0x29')]){_0x51346d['where']=_[_0x5a94('0x48')](_0x51346d[_0x5a94('0x46')],{'$or':_[_0x5a94('0x2b')](_0x51346d['attributes'],function(_0x4a5436){var _0x31b20f={};_0x31b20f[_0x4a5436]={'$like':'%'+_0x3f0d4d[_0x5a94('0x3c')]['filter']+'%'};return _0x31b20f;})});}_0x51346d=_[_0x5a94('0x48')]({},_0x51346d,_0x3f0d4d[_0x5a94('0x50')]);return _0x4c673[_0x5a94('0x98')](_0x51346d);}})['then'](function(_0x24693a){if(_0x24693a){_0x2fd1d8=_0x24693a[_0x5a94('0x41')];if(!_0x3f0d4d[_0x5a94('0x3c')][_0x5a94('0x42')](_0x5a94('0x43'))){_0x51346d[_0x5a94('0x1d')]=qs['limit'](_0x3f0d4d[_0x5a94('0x3c')][_0x5a94('0x1d')]);_0x51346d['offset']=qs[_0x5a94('0x1f')](_0x3f0d4d[_0x5a94('0x3c')][_0x5a94('0x1f')]);}return _0x4c673[_0x5a94('0x98')](_0x51346d);}})[_0x5a94('0x23')](function(_0x33ded7){if(_0x33ded7){return _0x33ded7?{'count':_0x2fd1d8,'rows':_0x33ded7}:null;}})[_0x5a94('0x23')](respondWithResult(_0x253c80,null))['catch'](handleError(_0x253c80,null));};exports['addLists']=function(_0x32cb91,_0x35d92d,_0x1c78a1){var _0x54a242,_0x3f6f8b;return db[_0x5a94('0x36')][_0x5a94('0x2f')]({'where':{'id':_0x32cb91[_0x5a94('0x4e')]['id']}})[_0x5a94('0x23')](handleEntityNotFound(_0x35d92d,null))[_0x5a94('0x23')](function(_0x712921){if(_0x712921){_0x3f6f8b=_0x712921;return _0x712921['addLists'](_0x32cb91['body'][_0x5a94('0x7b')],_[_0x5a94('0x58')](_0x32cb91[_0x5a94('0x5b')],['ids','id'])||{});}return null;})[_0x5a94('0x90')](function(_0x19ed8b){var _0x5cbe51;_0x54a242=_0x19ed8b||[];var _0x3ff918=[];if(_0x19ed8b){for(var _0x1234d8=0x0;_0x1234d8<_0x19ed8b['length'];_0x1234d8+=0x1){var _0x117a80=_0x19ed8b[_0x1234d8][_0x5a94('0x53')]({'plain':!![]});_0x3f6f8b[_0x5a94('0x99')]=_0x32cb91[_0x5a94('0x5b')][_0x5a94('0x99')]?_0x32cb91['body'][_0x5a94('0x99')]:_0x3f6f8b[_0x5a94('0x99')];switch(_0x3f6f8b[_0x5a94('0x99')]){case _0x5a94('0x9a'):_0x5cbe51=squel[_0x5a94('0x9b')]()[_0x5a94('0x9c')](_0x5a94('0x9d'))[_0x5a94('0x9e')](['phone',_0x5a94('0x9f'),_0x5a94('0xa0'),_0x5a94('0xa1'),_0x5a94('0x61'),_0x5a94('0x59'),'updatedAt'],squel[_0x5a94('0x7c')]()[_0x5a94('0x7d')]('phone',_0x5a94('0xa2'))[_0x5a94('0x7d')](_0x5a94('0xa3'),_0x5a94('0x9f'))[_0x5a94('0x7d')]('id',_0x5a94('0xa0'))['field'](_0x117a80[_0x5a94('0xa4')][_0x5a94('0x84')](),_0x5a94('0xa1'))[_0x5a94('0x7d')](_0x32cb91[_0x5a94('0x4e')]['id'][_0x5a94('0x84')](),_0x5a94('0x61'))['field'](_0x5a94('0xa3'),_0x5a94('0x59'))[_0x5a94('0x7d')](_0x5a94('0xa3'),_0x5a94('0x5a'))[_0x5a94('0x7f')](_0x5a94('0xa5'))[_0x5a94('0x46')](_0x5a94('0xa6'))[_0x5a94('0x46')]('ListId\x20=\x20?',_0x117a80['CmListId'][_0x5a94('0x84')]())[_0x5a94('0x46')]('phone\x20IS\x20NOT\x20NULL')[_0x5a94('0x46')](_0x5a94('0xa7'),squel[_0x5a94('0x7c')]()[_0x5a94('0x7d')](_0x5a94('0xa8'))['from'](_0x5a94('0xa9'))['where'](_0x5a94('0x82'),_0x32cb91[_0x5a94('0x4e')]['id']['toString']()))[_0x5a94('0x46')](_0x5a94('0xa7'),squel[_0x5a94('0x7c')]()[_0x5a94('0x7d')](_0x5a94('0xaa'))[_0x5a94('0x7f')](_0x5a94('0x9d'))['where']('VoiceQueueId\x20=\x20?',_0x32cb91[_0x5a94('0x4e')]['id'][_0x5a94('0x84')]())))['toString']();break;case'onlyIfOpen':_0x5cbe51=squel[_0x5a94('0x9b')]()[_0x5a94('0x9c')](_0x5a94('0x9d'))[_0x5a94('0x9e')](['phone','scheduledAt',_0x5a94('0xa0'),'ListId','VoiceQueueId',_0x5a94('0x59'),_0x5a94('0x5a')],squel[_0x5a94('0x7c')]()[_0x5a94('0x7d')]('phone',_0x5a94('0xa2'))['field'](_0x5a94('0xa3'),_0x5a94('0x9f'))['field']('id',_0x5a94('0xa0'))[_0x5a94('0x7d')](_0x117a80[_0x5a94('0xa4')][_0x5a94('0x84')](),_0x5a94('0xa1'))['field'](_0x32cb91[_0x5a94('0x4e')]['id'][_0x5a94('0x84')](),_0x5a94('0x61'))['field'](_0x5a94('0xa3'),_0x5a94('0x59'))[_0x5a94('0x7d')]('NOW()','updatedAt')[_0x5a94('0x7f')](_0x5a94('0xa5'))[_0x5a94('0x46')](_0x5a94('0xa6'))[_0x5a94('0x46')](_0x5a94('0xab'),_0x117a80[_0x5a94('0xa4')][_0x5a94('0x84')]())[_0x5a94('0x46')](_0x5a94('0xac'))['where'](_0x5a94('0xa7'),squel[_0x5a94('0x7c')]()[_0x5a94('0x7d')](_0x5a94('0xaa'))['from'](_0x5a94('0x9d'))[_0x5a94('0x46')](_0x5a94('0x82'),_0x32cb91[_0x5a94('0x4e')]['id'][_0x5a94('0x84')]())))[_0x5a94('0x84')]();break;default:_0x5cbe51=squel[_0x5a94('0x9b')]()['into'](_0x5a94('0x9d'))[_0x5a94('0x9e')]([_0x5a94('0xa2'),_0x5a94('0x9f'),_0x5a94('0xa0'),_0x5a94('0xa1'),_0x5a94('0x61'),_0x5a94('0x59'),_0x5a94('0x5a')],squel[_0x5a94('0x7c')]()[_0x5a94('0x7d')](_0x5a94('0xa2'),_0x5a94('0xa2'))[_0x5a94('0x7d')](_0x5a94('0xa3'),_0x5a94('0x9f'))[_0x5a94('0x7d')]('id','ContactId')[_0x5a94('0x7d')](_0x117a80[_0x5a94('0xa4')][_0x5a94('0x84')](),'ListId')[_0x5a94('0x7d')](_0x32cb91[_0x5a94('0x4e')]['id'][_0x5a94('0x84')](),_0x5a94('0x61'))['field'](_0x5a94('0xa3'),'createdAt')[_0x5a94('0x7d')](_0x5a94('0xa3'),_0x5a94('0x5a'))['from'](_0x5a94('0xa5'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x5a94('0xab'),_0x117a80['CmListId'][_0x5a94('0x84')]())['where'](_0x5a94('0xac')))[_0x5a94('0x84')]();}_0x3ff918[_0x5a94('0x83')](db[_0x5a94('0x8a')]['query'](_0x5cbe51));}return BPromise[_0x5a94('0x87')](_0x3ff918);}})[_0x5a94('0x23')](function(){return _0x54a242;})[_0x5a94('0x23')](respondWithResult(_0x35d92d,null))[_0x5a94('0x4c')](handleError(_0x35d92d,null));};exports['removeLists']=function(_0x203f1e,_0x38300d,_0x531d35){return db['VoiceQueue']['find']({'where':{'id':_0x203f1e[_0x5a94('0x4e')]['id']}})[_0x5a94('0x23')](handleEntityNotFound(_0x38300d,null))[_0x5a94('0x23')](function(_0x3952db){if(_0x3952db){return _0x3952db[_0x5a94('0xad')](_0x203f1e['query'][_0x5a94('0x7b')]);}})[_0x5a94('0x23')](function(_0xfbfddf){if(_0xfbfddf){return db['CmHopper'][_0x5a94('0x24')]({'where':{'ListId':_0x203f1e[_0x5a94('0x3c')][_0x5a94('0x7b')],'VoiceQueueId':_0x203f1e[_0x5a94('0x4e')]['id']}})[_0x5a94('0x23')](function(){return _0xfbfddf;});}})[_0x5a94('0x23')](respondWithStatusCode(_0x38300d,null))[_0x5a94('0x4c')](handleError(_0x38300d,null));};exports[_0x5a94('0xae')]=function(_0x123b1d,_0x5e38ed,_0x1998c2){var _0x2f6d56={};var _0x5b2389={};var _0xc606f8;var _0x1d906e;return db['VoiceQueue'][_0x5a94('0x5f')]({'where':{'id':_0x123b1d[_0x5a94('0x4e')]['id']}})[_0x5a94('0x23')](handleEntityNotFound(_0x5e38ed,null))['then'](function(_0x2762e0){if(_0x2762e0){_0xc606f8=_0x2762e0;_0x5b2389['model']=_[_0x5a94('0x3b')](db[_0x5a94('0x97')]['rawAttributes']);_0x5b2389[_0x5a94('0x3c')]=_[_0x5a94('0x3b')](_0x123b1d['query']);_0x5b2389[_0x5a94('0x3d')]=_[_0x5a94('0x3e')](_0x5b2389['model'],_0x5b2389[_0x5a94('0x3c')]);_0x2f6d56[_0x5a94('0x40')]=_[_0x5a94('0x3e')](_0x5b2389[_0x5a94('0x3a')],qs[_0x5a94('0x3f')](_0x123b1d[_0x5a94('0x3c')][_0x5a94('0x3f')]));_0x2f6d56[_0x5a94('0x40')]=_0x2f6d56['attributes']['length']?_0x2f6d56['attributes']:_0x5b2389[_0x5a94('0x3a')];_0x2f6d56[_0x5a94('0x44')]=qs[_0x5a94('0x45')](_0x123b1d[_0x5a94('0x3c')][_0x5a94('0x45')]);_0x2f6d56['where']=qs[_0x5a94('0x3d')](_[_0x5a94('0x47')](_0x123b1d[_0x5a94('0x3c')],_0x5b2389[_0x5a94('0x3d')]));if(_0x123b1d[_0x5a94('0x3c')][_0x5a94('0x29')]){_0x2f6d56['where']=_['merge'](_0x2f6d56['where'],{'$or':_['map'](_0x2f6d56['attributes'],function(_0x3621ba){var _0x18caf6={};_0x18caf6[_0x3621ba]={'$like':'%'+_0x123b1d[_0x5a94('0x3c')]['filter']+'%'};return _0x18caf6;})});}_0x2f6d56=_[_0x5a94('0x48')]({},_0x2f6d56,_0x123b1d[_0x5a94('0x50')]);return _0xc606f8['getBlackLists'](_0x2f6d56);}})[_0x5a94('0x23')](function(_0x148739){if(_0x148739){_0x1d906e=_0x148739[_0x5a94('0x41')];if(!_0x123b1d[_0x5a94('0x3c')][_0x5a94('0x42')](_0x5a94('0x43'))){_0x2f6d56['limit']=qs[_0x5a94('0x1d')](_0x123b1d[_0x5a94('0x3c')][_0x5a94('0x1d')]);_0x2f6d56['offset']=qs['offset'](_0x123b1d[_0x5a94('0x3c')][_0x5a94('0x1f')]);}return _0xc606f8[_0x5a94('0xae')](_0x2f6d56);}})[_0x5a94('0x23')](function(_0x4a8a38){if(_0x4a8a38){return _0x4a8a38?{'count':_0x1d906e,'rows':_0x4a8a38}:null;}})[_0x5a94('0x23')](respondWithResult(_0x5e38ed,null))['catch'](handleError(_0x5e38ed,null));};exports[_0x5a94('0xaf')]=function(_0x174769,_0x84c222,_0x55e927){var _0xfd73d,_0x230d50;return db['VoiceQueue'][_0x5a94('0x2f')]({'where':{'id':_0x174769['params']['id']}})[_0x5a94('0x23')](handleEntityNotFound(_0x84c222,null))[_0x5a94('0x23')](function(_0x1ae408){if(_0x1ae408){_0x230d50=_0x1ae408;return _0x1ae408[_0x5a94('0xaf')](_0x174769[_0x5a94('0x5b')][_0x5a94('0x7b')],_['omit'](_0x174769[_0x5a94('0x5b')],[_0x5a94('0x7b'),'id'])||{});}return null;})[_0x5a94('0x90')](function(_0xedbfa0){var _0x2feba1;_0xfd73d=_0xedbfa0||[];var _0x1a9194=[];if(_0xedbfa0){for(var _0x5313ae=0x0;_0x5313ae<_0xedbfa0[_0x5a94('0x41')];_0x5313ae+=0x1){var _0x1b1e62=_0xedbfa0[_0x5313ae]['get']({'plain':!![]});_0x2feba1=squel[_0x5a94('0x9b')]()[_0x5a94('0x9c')](_0x5a94('0xb0'))['fromQuery'](['phone',_0x5a94('0xa0'),_0x5a94('0xa1'),_0x5a94('0x61'),'createdAt',_0x5a94('0x5a')],squel['select']()[_0x5a94('0x7d')]('phone',_0x5a94('0xa2'))[_0x5a94('0x7d')]('id',_0x5a94('0xa0'))[_0x5a94('0x7d')](_0x1b1e62[_0x5a94('0xa4')]['toString'](),_0x5a94('0xa1'))[_0x5a94('0x7d')](_0x174769[_0x5a94('0x4e')]['id'][_0x5a94('0x84')](),'VoiceQueueId')[_0x5a94('0x7d')](_0x5a94('0xa3'),'createdAt')['field'](_0x5a94('0xa3'),'updatedAt')['from']('cm_contacts')[_0x5a94('0x46')](_0x5a94('0xa6'))[_0x5a94('0x46')](_0x5a94('0xab'),_0x1b1e62[_0x5a94('0xa4')][_0x5a94('0x84')]())[_0x5a94('0x46')]('phone\x20IS\x20NOT\x20NULL'))['toString']();_0x1a9194[_0x5a94('0x83')](db[_0x5a94('0x8a')][_0x5a94('0x3c')](_0x2feba1));}return BPromise['all'](_0x1a9194);}})[_0x5a94('0x23')](function(){return _0xfd73d;})[_0x5a94('0x23')](respondWithResult(_0x84c222,null))[_0x5a94('0x4c')](handleError(_0x84c222,null));};exports[_0x5a94('0xb1')]=function(_0x411c8f,_0xc3a0fc,_0x4db9e8){return db[_0x5a94('0x36')]['find']({'where':{'id':_0x411c8f['params']['id']}})['then'](handleEntityNotFound(_0xc3a0fc,null))[_0x5a94('0x23')](function(_0x1083d5){if(_0x1083d5){return _0x1083d5['removeBlackLists'](_0x411c8f[_0x5a94('0x3c')][_0x5a94('0x7b')]);}})[_0x5a94('0x23')](function(_0x506837){if(_0x506837){return db['CmHopperBlack'][_0x5a94('0x24')]({'where':{'ListId':_0x411c8f[_0x5a94('0x3c')][_0x5a94('0x7b')],'VoiceQueueId':_0x411c8f[_0x5a94('0x4e')]['id']}})[_0x5a94('0x23')](function(){return _0x506837;});}})['then'](respondWithStatusCode(_0xc3a0fc,null))[_0x5a94('0x4c')](handleError(_0xc3a0fc,null));}; \ No newline at end of file +var _0x7212=['json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','stack','send','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','pick','where','merge','VIRTUAL','options','VoiceQueue','includeAll','include','findAll','catch','show','params','rawAttributes','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','body','VoiceQueues','update','getHoppers','findOne','CmHopper','hasOwnProperty','VoiceQueueId','CmHopperHistory','rows','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','upsert','UserVoiceQueue','findOrCreate','each','isNil','format','emit','userVoiceQueue:save','ids','select','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','union','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','isEmpty','SIP/%s','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ListId','NOW()','scheduledAt','ContactId','CmListId','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','cm_contacts','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','./voiceQueue.socket','register','sendStatus','status','end'];(function(_0x185deb,_0x20e36f){var _0x37436e=function(_0x541270){while(--_0x541270){_0x185deb['push'](_0x185deb['shift']());}};_0x37436e(++_0x20e36f);}(_0x7212,0x14d));var _0x2721=function(_0x246300,_0x4026b3){_0x246300=_0x246300-0x0;var _0x3f1472=_0x7212[_0x246300];return _0x3f1472;};'use strict';var emlformat=require(_0x2721('0x0'));var rimraf=require(_0x2721('0x1'));var zipdir=require(_0x2721('0x2'));var jsonpatch=require(_0x2721('0x3'));var rp=require(_0x2721('0x4'));var moment=require('moment');var BPromise=require(_0x2721('0x5'));var Mustache=require(_0x2721('0x6'));var util=require(_0x2721('0x7'));var path=require(_0x2721('0x8'));var sox=require(_0x2721('0x9'));var csv=require(_0x2721('0xa'));var ejs=require(_0x2721('0xb'));var fs=require('fs');var fs_extra=require(_0x2721('0xc'));var _=require(_0x2721('0xd'));var squel=require(_0x2721('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2721('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2721('0x10'));var Papa=require(_0x2721('0x11'));var Redis=require(_0x2721('0x12'));var authService=require(_0x2721('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2721('0x14'));var utils=require(_0x2721('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2721('0x16'));var db=require(_0x2721('0x17'))['db'];config['redis']=_[_0x2721('0x18')](config[_0x2721('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2721('0x19')]));require(_0x2721('0x1a'))[_0x2721('0x1b')](socket);function respondWithStatusCode(_0x2bb709,_0x5ffd75){_0x5ffd75=_0x5ffd75||0xcc;return function(_0x160ff5){if(_0x160ff5){return _0x2bb709[_0x2721('0x1c')](_0x5ffd75);}return _0x2bb709[_0x2721('0x1d')](_0x5ffd75)[_0x2721('0x1e')]();};}function respondWithResult(_0x4a3f71,_0x4911af){_0x4911af=_0x4911af||0xc8;return function(_0x3f7a35){if(_0x3f7a35){return _0x4a3f71['status'](_0x4911af)[_0x2721('0x1f')](_0x3f7a35);}};}function respondWithFilteredResult(_0x17d056,_0x29c3a7){return function(_0x3679f3){if(_0x3679f3){var _0x2611e6=typeof _0x29c3a7['offset']===_0x2721('0x20')&&typeof _0x29c3a7[_0x2721('0x21')]===_0x2721('0x20');var _0xafc6ad=_0x3679f3[_0x2721('0x22')];var _0x32ef68=_0x2611e6?0x0:_0x29c3a7['offset'];var _0x3e603f=_0x2611e6?_0x3679f3['count']:_0x29c3a7[_0x2721('0x23')]+_0x29c3a7[_0x2721('0x21')];var _0x1cf544;if(_0x3e603f>=_0xafc6ad){_0x3e603f=_0xafc6ad;_0x1cf544=0xc8;}else{_0x1cf544=0xce;}_0x17d056[_0x2721('0x1d')](_0x1cf544);return _0x17d056[_0x2721('0x24')](_0x2721('0x25'),_0x32ef68+'-'+_0x3e603f+'/'+_0xafc6ad)[_0x2721('0x1f')](_0x3679f3);}return null;};}function patchUpdates(_0x1ab040){return function(_0x596bd0){try{jsonpatch[_0x2721('0x26')](_0x596bd0,_0x1ab040,!![]);}catch(_0x5cdec1){return BPromise['reject'](_0x5cdec1);}return _0x596bd0[_0x2721('0x27')]();};}function saveUpdates(_0x414aba,_0x19b8ef){return function(_0x567a78){if(_0x567a78){return _0x567a78['update'](_0x414aba)[_0x2721('0x28')](function(_0x50d1db){return _0x50d1db;});}return null;};}function removeEntity(_0x1ea723,_0x4bed94){return function(_0x46b43f){if(_0x46b43f){return _0x46b43f[_0x2721('0x29')]()[_0x2721('0x28')](function(){var _0x5770a3=_0x46b43f['get']({'plain':!![]});var _0x2c47c0=[{'name':'VoiceQueues','value':_0x2721('0x2a'),'ignore':![]},{'name':_0x2721('0x2b'),'value':_0x2721('0x2c'),'ignore':![]}];var _0x45ea76=_(_0x2c47c0)[_0x2721('0x2d')](_0x2721('0x2e'))[_0x2721('0x2f')](_0x2721('0x30'))[_0x2721('0x30')]();if(_[_0x2721('0x31')](_0x45ea76,_0x5770a3[_0x2721('0x32')])){return;}var _0x295734=_[_0x2721('0x33')](_0x2c47c0,[_0x2721('0x30'),_0x5770a3[_0x2721('0x32')]])[_0x2721('0x34')];return db[_0x2721('0x35')][_0x2721('0x29')]({'where':{'type':_0x295734,'resourceId':_0x5770a3['id']}})['then'](function(){return _0x46b43f;});})[_0x2721('0x28')](function(){_0x1ea723['status'](0xcc)[_0x2721('0x1e')]();});}};}function handleEntityNotFound(_0x223f00,_0x5362e4){return function(_0x74f4b8){if(!_0x74f4b8){_0x223f00[_0x2721('0x1c')](0x194);}return _0x74f4b8;};}function handleError(_0x29a655,_0x475efc){_0x475efc=_0x475efc||0x1f4;return function(_0x19f5b0){logger['error'](_0x19f5b0[_0x2721('0x36')]);if(_0x19f5b0['name']){delete _0x19f5b0[_0x2721('0x34')];}_0x29a655['status'](_0x475efc)[_0x2721('0x37')](_0x19f5b0);};}exports['index']=function(_0x5167f4,_0x207857){var _0x1057ab={},_0x35839f={},_0x2f60f6={'count':0x0,'rows':[]};var _0x2b7376=_[_0x2721('0x2f')](db['VoiceQueue']['rawAttributes'],function(_0x57eddf){return{'name':_0x57eddf['fieldName'],'type':_0x57eddf[_0x2721('0x32')]['key']};});_0x35839f[_0x2721('0x38')]=_['map'](_0x2b7376,_0x2721('0x34'));_0x35839f[_0x2721('0x39')]=_[_0x2721('0x3a')](_0x5167f4['query']);_0x35839f[_0x2721('0x3b')]=_['intersection'](_0x35839f[_0x2721('0x38')],_0x35839f[_0x2721('0x39')]);_0x1057ab[_0x2721('0x3c')]=_[_0x2721('0x3d')](_0x35839f[_0x2721('0x38')],qs[_0x2721('0x3e')](_0x5167f4['query'][_0x2721('0x3e')]));_0x1057ab[_0x2721('0x3c')]=_0x1057ab[_0x2721('0x3c')]['length']?_0x1057ab[_0x2721('0x3c')]:_0x35839f[_0x2721('0x38')];if(!_0x5167f4['query']['hasOwnProperty'](_0x2721('0x3f'))){_0x1057ab[_0x2721('0x21')]=qs['limit'](_0x5167f4[_0x2721('0x39')][_0x2721('0x21')]);_0x1057ab[_0x2721('0x23')]=qs[_0x2721('0x23')](_0x5167f4[_0x2721('0x39')][_0x2721('0x23')]);}_0x1057ab[_0x2721('0x40')]=qs[_0x2721('0x41')](_0x5167f4[_0x2721('0x39')][_0x2721('0x41')]);_0x1057ab['where']=qs[_0x2721('0x3b')](_[_0x2721('0x42')](_0x5167f4[_0x2721('0x39')],_0x35839f[_0x2721('0x3b')]),_0x2b7376);if(_0x5167f4[_0x2721('0x39')][_0x2721('0x2d')]){_0x1057ab[_0x2721('0x43')]=_[_0x2721('0x44')](_0x1057ab[_0x2721('0x43')],{'$or':_[_0x2721('0x2f')](_0x2b7376,function(_0x1f69d4){if(_0x1f69d4['type']!==_0x2721('0x45')){var _0x48e508={};_0x48e508[_0x1f69d4[_0x2721('0x34')]]={'$like':'%'+_0x5167f4[_0x2721('0x39')][_0x2721('0x2d')]+'%'};return _0x48e508;}})});}_0x1057ab=_['merge']({},_0x1057ab,_0x5167f4[_0x2721('0x46')]);var _0x4a74e2={'where':_0x1057ab['where']};return db[_0x2721('0x47')][_0x2721('0x22')](_0x4a74e2)[_0x2721('0x28')](function(_0xcf6f47){_0x2f60f6[_0x2721('0x22')]=_0xcf6f47;if(_0x5167f4[_0x2721('0x39')][_0x2721('0x48')]){_0x1057ab[_0x2721('0x49')]=[{'all':!![]}];}return db[_0x2721('0x47')][_0x2721('0x4a')](_0x1057ab);})[_0x2721('0x28')](function(_0x262c9f){_0x2f60f6['rows']=_0x262c9f;return _0x2f60f6;})[_0x2721('0x28')](respondWithFilteredResult(_0x207857,_0x1057ab))[_0x2721('0x4b')](handleError(_0x207857,null));};exports[_0x2721('0x4c')]=function(_0x152291,_0x526803){var _0x1b81b5={'raw':![],'where':{'id':_0x152291[_0x2721('0x4d')]['id']}},_0x16e291={};_0x16e291['model']=_[_0x2721('0x3a')](db['VoiceQueue'][_0x2721('0x4e')]);_0x16e291['query']=_[_0x2721('0x3a')](_0x152291[_0x2721('0x39')]);_0x16e291[_0x2721('0x3b')]=_[_0x2721('0x3d')](_0x16e291[_0x2721('0x38')],_0x16e291[_0x2721('0x39')]);_0x1b81b5['attributes']=_[_0x2721('0x3d')](_0x16e291[_0x2721('0x38')],qs[_0x2721('0x3e')](_0x152291[_0x2721('0x39')][_0x2721('0x3e')]));_0x1b81b5[_0x2721('0x3c')]=_0x1b81b5['attributes'][_0x2721('0x4f')]?_0x1b81b5['attributes']:_0x16e291[_0x2721('0x38')];if(_0x152291[_0x2721('0x39')][_0x2721('0x48')]){_0x1b81b5[_0x2721('0x49')]=[{'all':!![]}];}_0x1b81b5=_[_0x2721('0x44')]({},_0x1b81b5,_0x152291[_0x2721('0x46')]);return db[_0x2721('0x47')][_0x2721('0x33')](_0x1b81b5)['then'](handleEntityNotFound(_0x526803,null))['then'](respondWithResult(_0x526803,null))[_0x2721('0x4b')](handleError(_0x526803,null));};exports[_0x2721('0x50')]=function(_0x124754,_0x28e68e){return db[_0x2721('0x47')][_0x2721('0x50')](_0x124754['body'],{})['then'](function(_0x3f3a43){var _0x52ba82=_0x124754[_0x2721('0x51')]['get']({'plain':!![]});if(!_0x52ba82)throw new Error(_0x2721('0x52'));if(_0x52ba82[_0x2721('0x53')]===_0x2721('0x51')){var _0x123686=_0x3f3a43[_0x2721('0x54')]({'plain':!![]});var _0x5f1212=[{'name':'VoiceQueues','value':'inbound'},{'name':_0x2721('0x2b'),'value':'outbound'}];var _0x2b70b8=_[_0x2721('0x33')](_0x5f1212,[_0x2721('0x30'),_0x123686[_0x2721('0x32')]])[_0x2721('0x34')];return db[_0x2721('0x55')][_0x2721('0x33')]({'where':{'name':_0x2b70b8,'userProfileId':_0x52ba82[_0x2721('0x56')]},'raw':!![]})[_0x2721('0x28')](function(_0x55321d){if(_0x55321d&&_0x55321d['autoAssociation']===0x0){return db[_0x2721('0x35')]['create']({'name':_0x123686[_0x2721('0x34')],'resourceId':_0x123686['id'],'type':_0x55321d[_0x2721('0x34')],'sectionId':_0x55321d['id']},{})[_0x2721('0x28')](function(){return _0x3f3a43;});}else{return _0x3f3a43;}})['catch'](function(_0x4c011e){logger[_0x2721('0x57')](_0x2721('0x58'),_0x4c011e);throw _0x4c011e;});}return _0x3f3a43;})[_0x2721('0x28')](respondWithResult(_0x28e68e,0xc9))[_0x2721('0x4b')](handleError(_0x28e68e,null));};exports['clone']=function(_0x2525e0,_0x128492){var _0xda4269={'where':{'id':_0x2525e0['params']['id']}},_0x2e58b={};_0x2e58b[_0x2721('0x38')]=_[_0x2721('0x3a')](db['VoiceQueue'][_0x2721('0x4e')]);_0xda4269['attributes']=_[_0x2721('0x3d')](_0x2e58b['model'],qs[_0x2721('0x3e')](_0x2525e0[_0x2721('0x39')]['fields']));_0xda4269[_0x2721('0x3c')]=_0xda4269[_0x2721('0x3c')]['length']?_0xda4269[_0x2721('0x3c')]:_0x2e58b[_0x2721('0x38')];if(_0x2525e0[_0x2721('0x39')][_0x2721('0x48')]){_0xda4269[_0x2721('0x49')]=[{'all':!![]}];}_0xda4269=_['merge']({},_0xda4269,_0x2525e0[_0x2721('0x46')]);return db[_0x2721('0x47')][_0x2721('0x33')](_0xda4269)['then'](handleEntityNotFound(_0x128492,null))[_0x2721('0x28')](function(_0xde5916){if(_0xde5916){var _0x33978e=_0xde5916[_0x2721('0x54')]({'plain':!![]});_0x33978e=qs[_0x2721('0x59')](_0x33978e,['id',_0x2721('0x5a'),_0x2721('0x5b')]);_0x2525e0[_0x2721('0x5c')]=_['omit'](_0x2525e0['body'],['id',_0x2721('0x5a'),'updatedAt']);return db[_0x2721('0x47')][_0x2721('0x50')](_[_0x2721('0x44')](_0x33978e,_0x2525e0[_0x2721('0x5c')]),{'include':_0x2525e0['query'][_0x2721('0x48')]?[{'all':!![]}]:undefined})[_0x2721('0x28')](function(_0x466898){var _0x325313=_0x2525e0[_0x2721('0x51')][_0x2721('0x54')]({'plain':!![]});if(!_0x325313)throw new Error(_0x2721('0x52'));if(_0x325313[_0x2721('0x53')]===_0x2721('0x51')){var _0x49482a=_0x466898[_0x2721('0x54')]({'plain':!![]});var _0x83e13b=[{'name':_0x2721('0x5d'),'value':_0x2721('0x2a')},{'name':_0x2721('0x2b'),'value':'outbound'}];var _0x428081=_[_0x2721('0x33')](_0x83e13b,[_0x2721('0x30'),_0x49482a['type']])[_0x2721('0x34')];return db['UserProfileSection'][_0x2721('0x33')]({'where':{'name':_0x428081,'userProfileId':_0x325313[_0x2721('0x56')]},'raw':!![]})[_0x2721('0x28')](function(_0x43186a){if(_0x43186a&&_0x43186a['autoAssociation']===0x0){return db[_0x2721('0x35')][_0x2721('0x50')]({'name':_0x49482a[_0x2721('0x34')],'resourceId':_0x49482a['id'],'type':_0x43186a[_0x2721('0x34')],'sectionId':_0x43186a['id']},{})['then'](function(){return _0x466898;});}else{return _0x466898;}})['catch'](function(_0xcb8ed0){logger[_0x2721('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcb8ed0);throw _0xcb8ed0;});}return _0x466898;});}})[_0x2721('0x28')](respondWithResult(_0x128492,0xc9))[_0x2721('0x4b')](handleError(_0x128492,null));};exports[_0x2721('0x5e')]=function(_0x114be1,_0x32faa0){if(_0x114be1['body']['id']){delete _0x114be1[_0x2721('0x5c')]['id'];}return db[_0x2721('0x47')][_0x2721('0x33')]({'where':{'id':_0x114be1[_0x2721('0x4d')]['id']}})['then'](handleEntityNotFound(_0x32faa0,null))[_0x2721('0x28')](saveUpdates(_0x114be1[_0x2721('0x5c')],null))[_0x2721('0x28')](respondWithResult(_0x32faa0,null))[_0x2721('0x4b')](handleError(_0x32faa0,null));};exports[_0x2721('0x29')]=function(_0x5430fd,_0x1668d6){return db[_0x2721('0x47')][_0x2721('0x33')]({'where':{'id':_0x5430fd[_0x2721('0x4d')]['id']}})[_0x2721('0x28')](handleEntityNotFound(_0x1668d6,null))['then'](removeEntity(_0x1668d6,null))[_0x2721('0x4b')](handleError(_0x1668d6,null));};exports[_0x2721('0x5f')]=function(_0x3744cd,_0x1fabe2,_0x48b1cb){var _0x3a470a={'raw':![],'where':{}};var _0x4d15e9={};var _0x441b47={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2721('0x60')]({'where':{'id':_0x3744cd[_0x2721('0x4d')]['id']}})[_0x2721('0x28')](handleEntityNotFound(_0x1fabe2,null))['then'](function(_0x38b11c){if(_0x38b11c){_0x4d15e9[_0x2721('0x38')]=_[_0x2721('0x3a')](db[_0x2721('0x61')][_0x2721('0x4e')]);_0x4d15e9['query']=_[_0x2721('0x3a')](_0x3744cd[_0x2721('0x39')]);_0x4d15e9[_0x2721('0x3b')]=_['intersection'](_0x4d15e9[_0x2721('0x38')],_0x4d15e9[_0x2721('0x39')]);_0x3a470a[_0x2721('0x3c')]=_['intersection'](_0x4d15e9[_0x2721('0x38')],qs[_0x2721('0x3e')](_0x3744cd['query']['fields']));_0x3a470a[_0x2721('0x3c')]=_0x3a470a['attributes'][_0x2721('0x4f')]?_0x3a470a[_0x2721('0x3c')]:_0x4d15e9[_0x2721('0x38')];if(!_0x3744cd[_0x2721('0x39')][_0x2721('0x62')](_0x2721('0x3f'))){_0x3a470a[_0x2721('0x21')]=qs[_0x2721('0x21')](_0x3744cd[_0x2721('0x39')][_0x2721('0x21')]);_0x3a470a[_0x2721('0x23')]=qs[_0x2721('0x23')](_0x3744cd['query'][_0x2721('0x23')]);}_0x3a470a[_0x2721('0x40')]=qs[_0x2721('0x41')](_0x3744cd['query'][_0x2721('0x41')]);_0x3a470a['where']=qs['filters'](_[_0x2721('0x42')](_0x3744cd['query'],_0x4d15e9[_0x2721('0x3b')]));_0x3a470a[_0x2721('0x43')][_0x2721('0x63')]=_0x38b11c['id'];if(_0x3744cd[_0x2721('0x39')][_0x2721('0x2d')]){_0x3a470a[_0x2721('0x43')]=_['merge'](_0x3a470a[_0x2721('0x43')],{'$or':_[_0x2721('0x2f')](_0x3a470a['attributes'],function(_0x4d81f4){var _0x11e8c4={};_0x11e8c4[_0x4d81f4]={'$like':'%'+_0x3744cd['query']['filter']+'%'};return _0x11e8c4;})});}_0x3a470a=_[_0x2721('0x44')]({},_0x3a470a,_0x3744cd[_0x2721('0x46')]);return db[_0x2721('0x61')][_0x2721('0x22')]({'where':_0x3a470a[_0x2721('0x43')]})[_0x2721('0x28')](function(_0x28e51a){_0x441b47[_0x2721('0x22')]=_0x28e51a;if(_0x3744cd['query'][_0x2721('0x48')]){_0x3a470a[_0x2721('0x49')]=[{'all':!![]}];}return db[_0x2721('0x61')][_0x2721('0x4a')](_0x3a470a);})[_0x2721('0x28')](function(_0x16e1ae){_0x441b47['rows']=_0x16e1ae;return _0x441b47;});}})['then'](respondWithFilteredResult(_0x1fabe2,_0x3a470a))[_0x2721('0x4b')](handleError(_0x1fabe2,null));};exports['getHopperHistories']=function(_0x5e4cbf,_0x56663c,_0x38c730){var _0x3fc372={'raw':!![],'where':{}};var _0x91ea6b={};var _0x4335ac={'count':0x0,'rows':[]};return db[_0x2721('0x47')][_0x2721('0x60')]({'where':{'id':_0x5e4cbf[_0x2721('0x4d')]['id']}})[_0x2721('0x28')](handleEntityNotFound(_0x56663c,null))['then'](function(_0x542e3f){if(_0x542e3f){_0x91ea6b['model']=_['keys'](db[_0x2721('0x64')][_0x2721('0x4e')]);_0x91ea6b[_0x2721('0x39')]=_[_0x2721('0x3a')](_0x5e4cbf['query']);_0x91ea6b[_0x2721('0x3b')]=_[_0x2721('0x3d')](_0x91ea6b['model'],_0x91ea6b[_0x2721('0x39')]);_0x3fc372[_0x2721('0x3c')]=_[_0x2721('0x3d')](_0x91ea6b['model'],qs[_0x2721('0x3e')](_0x5e4cbf[_0x2721('0x39')]['fields']));_0x3fc372[_0x2721('0x3c')]=_0x3fc372[_0x2721('0x3c')]['length']?_0x3fc372[_0x2721('0x3c')]:_0x91ea6b['model'];if(!_0x5e4cbf[_0x2721('0x39')]['hasOwnProperty']('nolimit')){_0x3fc372[_0x2721('0x21')]=qs[_0x2721('0x21')](_0x5e4cbf[_0x2721('0x39')]['limit']);_0x3fc372[_0x2721('0x23')]=qs[_0x2721('0x23')](_0x5e4cbf['query']['offset']);}_0x3fc372['order']=qs[_0x2721('0x41')](_0x5e4cbf[_0x2721('0x39')][_0x2721('0x41')]);_0x3fc372[_0x2721('0x43')]=qs[_0x2721('0x3b')](_[_0x2721('0x42')](_0x5e4cbf[_0x2721('0x39')],_0x91ea6b['filters']));_0x3fc372[_0x2721('0x43')]['VoiceQueueId']=_0x542e3f['id'];if(_0x5e4cbf[_0x2721('0x39')][_0x2721('0x2d')]){_0x3fc372['where']=_[_0x2721('0x44')](_0x3fc372[_0x2721('0x43')],{'$or':_[_0x2721('0x2f')](_0x3fc372[_0x2721('0x3c')],function(_0x4e5a7a){var _0x2b834e={};_0x2b834e[_0x4e5a7a]={'$like':'%'+_0x5e4cbf[_0x2721('0x39')][_0x2721('0x2d')]+'%'};return _0x2b834e;})});}_0x3fc372=_[_0x2721('0x44')]({},_0x3fc372,_0x5e4cbf[_0x2721('0x46')]);return db[_0x2721('0x64')][_0x2721('0x22')]({'where':_0x3fc372[_0x2721('0x43')]})[_0x2721('0x28')](function(_0xdb7d2a){_0x4335ac[_0x2721('0x22')]=_0xdb7d2a;if(_0x5e4cbf[_0x2721('0x39')][_0x2721('0x48')]){_0x3fc372[_0x2721('0x49')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x2721('0x4a')](_0x3fc372);})[_0x2721('0x28')](function(_0x1f5889){_0x4335ac[_0x2721('0x65')]=_0x1f5889;return _0x4335ac;});}})[_0x2721('0x28')](respondWithFilteredResult(_0x56663c,_0x3fc372))[_0x2721('0x4b')](handleError(_0x56663c,null));};exports['getHopperFinals']=function(_0x3ad0ef,_0x5eba80,_0x69762d){var _0xd9eb08={'raw':!![],'where':{}};var _0x43e8f1={};var _0x47536f={'count':0x0,'rows':[]};return db[_0x2721('0x47')][_0x2721('0x60')]({'where':{'id':_0x3ad0ef['params']['id']}})[_0x2721('0x28')](handleEntityNotFound(_0x5eba80,null))[_0x2721('0x28')](function(_0x334ada){if(_0x334ada){_0x43e8f1[_0x2721('0x38')]=_[_0x2721('0x3a')](db[_0x2721('0x66')][_0x2721('0x4e')]);_0x43e8f1[_0x2721('0x39')]=_[_0x2721('0x3a')](_0x3ad0ef[_0x2721('0x39')]);_0x43e8f1['filters']=_['intersection'](_0x43e8f1[_0x2721('0x38')],_0x43e8f1[_0x2721('0x39')]);_0xd9eb08[_0x2721('0x3c')]=_[_0x2721('0x3d')](_0x43e8f1['model'],qs[_0x2721('0x3e')](_0x3ad0ef[_0x2721('0x39')][_0x2721('0x3e')]));_0xd9eb08[_0x2721('0x3c')]=_0xd9eb08[_0x2721('0x3c')]['length']?_0xd9eb08[_0x2721('0x3c')]:_0x43e8f1['model'];if(!_0x3ad0ef[_0x2721('0x39')]['hasOwnProperty'](_0x2721('0x3f'))){_0xd9eb08[_0x2721('0x21')]=qs[_0x2721('0x21')](_0x3ad0ef[_0x2721('0x39')][_0x2721('0x21')]);_0xd9eb08[_0x2721('0x23')]=qs[_0x2721('0x23')](_0x3ad0ef[_0x2721('0x39')]['offset']);}_0xd9eb08['order']=qs[_0x2721('0x41')](_0x3ad0ef[_0x2721('0x39')]['sort']);_0xd9eb08[_0x2721('0x43')]=qs['filters'](_[_0x2721('0x42')](_0x3ad0ef[_0x2721('0x39')],_0x43e8f1[_0x2721('0x3b')]));_0xd9eb08[_0x2721('0x43')][_0x2721('0x63')]=_0x334ada['id'];if(_0x3ad0ef[_0x2721('0x39')][_0x2721('0x2d')]){_0xd9eb08[_0x2721('0x43')]=_[_0x2721('0x44')](_0xd9eb08['where'],{'$or':_[_0x2721('0x2f')](_0xd9eb08[_0x2721('0x3c')],function(_0x1f6faa){var _0x1e7df2={};_0x1e7df2[_0x1f6faa]={'$like':'%'+_0x3ad0ef[_0x2721('0x39')][_0x2721('0x2d')]+'%'};return _0x1e7df2;})});}_0xd9eb08=_[_0x2721('0x44')]({},_0xd9eb08,_0x3ad0ef['options']);return db[_0x2721('0x66')][_0x2721('0x22')]({'where':_0xd9eb08[_0x2721('0x43')]})[_0x2721('0x28')](function(_0x2b1fdc){_0x47536f[_0x2721('0x22')]=_0x2b1fdc;if(_0x3ad0ef[_0x2721('0x39')][_0x2721('0x48')]){_0xd9eb08[_0x2721('0x49')]=[{'all':!![]}];}return db[_0x2721('0x66')][_0x2721('0x4a')](_0xd9eb08);})[_0x2721('0x28')](function(_0x391a22){_0x47536f[_0x2721('0x65')]=_0x391a22;return _0x47536f;});}})['then'](respondWithFilteredResult(_0x5eba80,_0xd9eb08))[_0x2721('0x4b')](handleError(_0x5eba80,null));};exports[_0x2721('0x67')]=function(_0x21eba2,_0x41ff5e,_0x4036a9){var _0x1f1786={'raw':!![],'where':{}};var _0x5e8814={};var _0x4687bd={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2721('0x60')]({'where':{'id':_0x21eba2[_0x2721('0x4d')]['id']}})['then'](handleEntityNotFound(_0x41ff5e,null))[_0x2721('0x28')](function(_0x87abfc){if(_0x87abfc){_0x5e8814['model']=_[_0x2721('0x3a')](db[_0x2721('0x68')][_0x2721('0x4e')]);_0x5e8814[_0x2721('0x39')]=_['keys'](_0x21eba2[_0x2721('0x39')]);_0x5e8814[_0x2721('0x3b')]=_[_0x2721('0x3d')](_0x5e8814[_0x2721('0x38')],_0x5e8814[_0x2721('0x39')]);_0x1f1786[_0x2721('0x3c')]=_[_0x2721('0x3d')](_0x5e8814[_0x2721('0x38')],qs[_0x2721('0x3e')](_0x21eba2['query']['fields']));_0x1f1786['attributes']=_0x1f1786[_0x2721('0x3c')]['length']?_0x1f1786[_0x2721('0x3c')]:_0x5e8814[_0x2721('0x38')];if(!_0x21eba2[_0x2721('0x39')][_0x2721('0x62')]('nolimit')){_0x1f1786['limit']=qs['limit'](_0x21eba2['query'][_0x2721('0x21')]);_0x1f1786[_0x2721('0x23')]=qs[_0x2721('0x23')](_0x21eba2[_0x2721('0x39')][_0x2721('0x23')]);}_0x1f1786['order']=qs[_0x2721('0x41')](_0x21eba2[_0x2721('0x39')][_0x2721('0x41')]);_0x1f1786[_0x2721('0x43')]=qs[_0x2721('0x3b')](_[_0x2721('0x42')](_0x21eba2['query'],_0x5e8814['filters']));_0x1f1786[_0x2721('0x43')][_0x2721('0x63')]=_0x87abfc['id'];if(_0x21eba2[_0x2721('0x39')][_0x2721('0x2d')]){_0x1f1786[_0x2721('0x43')]=_[_0x2721('0x44')](_0x1f1786[_0x2721('0x43')],{'$or':_[_0x2721('0x2f')](_0x1f1786['attributes'],function(_0x3e74d5){var _0x238c96={};_0x238c96[_0x3e74d5]={'$like':'%'+_0x21eba2[_0x2721('0x39')][_0x2721('0x2d')]+'%'};return _0x238c96;})});}_0x1f1786=_['merge']({},_0x1f1786,_0x21eba2[_0x2721('0x46')]);return db[_0x2721('0x68')][_0x2721('0x22')]({'where':_0x1f1786[_0x2721('0x43')]})[_0x2721('0x28')](function(_0x45f5ab){_0x4687bd['count']=_0x45f5ab;if(_0x21eba2[_0x2721('0x39')][_0x2721('0x48')]){_0x1f1786[_0x2721('0x49')]=[{'all':!![]}];}return db[_0x2721('0x68')]['findAll'](_0x1f1786);})[_0x2721('0x28')](function(_0x421097){_0x4687bd[_0x2721('0x65')]=_0x421097;return _0x4687bd;});}})[_0x2721('0x28')](respondWithFilteredResult(_0x41ff5e,_0x1f1786))['catch'](handleError(_0x41ff5e,null));};exports[_0x2721('0x69')]=function(_0x1c0dc7,_0x16a80a,_0x20e919){var _0x4ecc0f={};var _0x58f593={};var _0x2b15fc;var _0x850e28;return db[_0x2721('0x47')][_0x2721('0x60')]({'where':{'id':_0x1c0dc7[_0x2721('0x4d')]['id']}})['then'](handleEntityNotFound(_0x16a80a,null))['then'](function(_0x1dad7e){if(_0x1dad7e){_0x2b15fc=_0x1dad7e;_0x58f593[_0x2721('0x38')]=_[_0x2721('0x3a')](db[_0x2721('0x6a')][_0x2721('0x4e')]);_0x58f593[_0x2721('0x39')]=_['keys'](_0x1c0dc7[_0x2721('0x39')]);_0x58f593['filters']=_['intersection'](_0x58f593[_0x2721('0x38')],_0x58f593[_0x2721('0x39')]);_0x4ecc0f[_0x2721('0x3c')]=_[_0x2721('0x3d')](_0x58f593[_0x2721('0x38')],qs[_0x2721('0x3e')](_0x1c0dc7[_0x2721('0x39')][_0x2721('0x3e')]));_0x4ecc0f[_0x2721('0x3c')]=_0x4ecc0f[_0x2721('0x3c')][_0x2721('0x4f')]?_0x4ecc0f[_0x2721('0x3c')]:_0x58f593[_0x2721('0x38')];_0x4ecc0f['order']=qs['sort'](_0x1c0dc7['query']['sort']);_0x4ecc0f['where']=qs[_0x2721('0x3b')](_[_0x2721('0x42')](_0x1c0dc7[_0x2721('0x39')],_0x58f593[_0x2721('0x3b')]));if(_0x1c0dc7[_0x2721('0x39')]['filter']){_0x4ecc0f[_0x2721('0x43')]=_[_0x2721('0x44')](_0x4ecc0f[_0x2721('0x43')],{'$or':_[_0x2721('0x2f')](_0x4ecc0f[_0x2721('0x3c')],function(_0x328429){var _0x445bfa={};_0x445bfa[_0x328429]={'$like':'%'+_0x1c0dc7[_0x2721('0x39')]['filter']+'%'};return _0x445bfa;})});}_0x4ecc0f=_[_0x2721('0x44')]({},_0x4ecc0f,_0x1c0dc7[_0x2721('0x46')]);return _0x2b15fc[_0x2721('0x69')](_0x4ecc0f);}})[_0x2721('0x28')](function(_0x2fa932){if(_0x2fa932){_0x850e28=_0x2fa932[_0x2721('0x4f')];if(!_0x1c0dc7[_0x2721('0x39')][_0x2721('0x62')](_0x2721('0x3f'))){_0x4ecc0f[_0x2721('0x21')]=qs[_0x2721('0x21')](_0x1c0dc7[_0x2721('0x39')][_0x2721('0x21')]);_0x4ecc0f['offset']=qs[_0x2721('0x23')](_0x1c0dc7[_0x2721('0x39')][_0x2721('0x23')]);}return _0x2b15fc[_0x2721('0x69')](_0x4ecc0f);}})[_0x2721('0x28')](function(_0x26de87){if(_0x26de87){return _0x26de87?{'count':_0x850e28,'rows':_0x26de87}:null;}})['then'](respondWithResult(_0x16a80a,null))[_0x2721('0x4b')](handleError(_0x16a80a,null));};exports[_0x2721('0x6b')]=function(_0x4a69c2,_0x34c4e6,_0x55058c){var _0x1b62ab=_0x4a69c2[_0x2721('0x5c')]['teams'];var _0x5c9a77=_[_0x2721('0x2f')](_0x1b62ab,'id');return db[_0x2721('0x6a')]['findAll']({'where':{'id':_0x5c9a77},'attributes':['id'],'include':[{'model':db[_0x2721('0x6c')],'as':_0x2721('0x6d'),'attributes':['id','name',_0x2721('0x6e'),_0x2721('0x6f'),_0x2721('0x70')],'raw':!![]}]})['then'](function(_0x7234df){if(_0x7234df){var _0x1a4b6c=_[_0x2721('0x71')](_0x7234df,function(_0x47ae11){var _0x17e524=_0x47ae11[_0x2721('0x54')]({'plain':!![]});_0x17e524['Agents'][_0x2721('0x72')](function(_0x46fdf1){_0x46fdf1[_0x2721('0x73')]=_['find'](_0x1b62ab,{'id':_0x17e524['id']})[_0x2721('0x73')];});return _0x17e524['Agents'];});return db[_0x2721('0x47')][_0x2721('0x33')]({'where':{'id':_0x4a69c2[_0x2721('0x4d')]['id']}})[_0x2721('0x28')](function(_0x577086){return db[_0x2721('0x74')][_0x2721('0x75')](function(_0x3517ea){return _0x577086[_0x2721('0x6b')](_0x5c9a77,{'transaction':_0x3517ea})[_0x2721('0x28')](function(){return BPromise['each'](_0x1b62ab,function(_0xcdfec7){return db['TeamVoiceQueue'][_0x2721('0x76')]({'TeamId':_0xcdfec7['id'],'VoiceQueueId':_0x4a69c2['params']['id'],'penalty':_0xcdfec7[_0x2721('0x73')]},{'transaction':_0x3517ea});});})[_0x2721('0x28')](function(){return BPromise['each'](_0x1a4b6c,function(_0x2236e9){return db[_0x2721('0x77')][_0x2721('0x78')]({'where':{'UserId':_0x2236e9['id'],'VoiceQueueId':_0x4a69c2[_0x2721('0x4d')]['id']},'defaults':{'penalty':_0x2236e9['penalty']},'transaction':_0x3517ea});});})[_0x2721('0x28')](function(){return BPromise[_0x2721('0x79')](_[_0x2721('0x2d')](_0x1a4b6c,{'online':!![]}),function(_0x542fcd){return db['UserVoiceQueueRt'][_0x2721('0x76')]({'membername':_0x542fcd[_0x2721('0x34')],'UserId':_0x542fcd['id'],'queue_name':_0x577086['name'],'VoiceQueueId':_0x577086['id'],'interface':_[_0x2721('0x7a')](_0x542fcd[_0x2721('0x70')])?util[_0x2721('0x7b')]('SIP/%s',_0x542fcd[_0x2721('0x34')]):_0x542fcd['interface'],'paused':_0x542fcd['voicePause']||![],'penalty':_0x542fcd[_0x2721('0x73')]},{'transaction':_0x3517ea});});})[_0x2721('0x28')](function(){_0x1a4b6c[_0x2721('0x72')](function(_0x3b0c67){socket[_0x2721('0x7c')](_0x2721('0x7d'),{'UserId':_0x3b0c67['id'],'VoiceQueueId':_0x577086['id']});});});});});}})[_0x2721('0x28')](respondWithStatusCode(_0x34c4e6,null))['catch'](handleError(_0x34c4e6,null));};exports['removeTeams']=function(_0x2e151c,_0x5c12e6,_0x40f1c0){return db['Team'][_0x2721('0x4a')]({'where':{'id':_0x2e151c[_0x2721('0x39')][_0x2721('0x7e')]},'attributes':['id'],'include':[{'model':db[_0x2721('0x6c')],'as':_0x2721('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x2721('0x28')](handleEntityNotFound(_0x5c12e6,null))[_0x2721('0x28')](function(_0x595a77){var _0x3313de=_[_0x2721('0x2f')](_0x595a77,'id');var _0x4b7b04=[];var _0x12506a=[];var _0x414c3b=squel[_0x2721('0x7f')]();_0x414c3b[_0x2721('0x80')]('tq.TeamId')[_0x2721('0x81')](_0x2721('0x82'),'tq')[_0x2721('0x83')](_0x2721('0x84'),'ut',_0x2721('0x85'))[_0x2721('0x43')]('VoiceQueueId\x20=\x20?',_0x2e151c['params']['id']);for(var _0x2a5afd=0x0;_0x2a5afd<_0x595a77[_0x2721('0x4f')];_0x2a5afd+=0x1){let _0x19cf0c=_0x595a77[_0x2a5afd];for(var _0xbfe3ac=0x0;_0xbfe3ac<_0x19cf0c[_0x2721('0x6d')][_0x2721('0x4f')];_0xbfe3ac+=0x1){let _0x148fc6=_0x19cf0c[_0x2721('0x6d')][_0xbfe3ac];var _0x6f46f1=_0x414c3b[_0x2721('0x86')]();_0x6f46f1[_0x2721('0x43')](_0x2721('0x87'),_0x148fc6['id']);_0x12506a[_0x2721('0x88')](db['sequelize'][_0x2721('0x39')](_0x6f46f1['toString'](),{'type':db[_0x2721('0x74')][_0x2721('0x89')][_0x2721('0x8a')]})[_0x2721('0x28')](function(_0x2c2cdf){if(_0x2c2cdf[_0x2721('0x4f')]===0x1){return _0x148fc6['id'];}else{var _0x37b90c=_[_0x2721('0x8b')](_[_0x2721('0x2f')](_0x2c2cdf,_0x2721('0x8c')),function(_0x279441){return _['includes'](_0x3313de,_0x279441);});if(_0x37b90c){return _0x148fc6['id'];}}}));}}return BPromise[_0x2721('0x8d')](_0x12506a)[_0x2721('0x28')](function(_0x502034){_0x4b7b04=_(_0x4b7b04)[_0x2721('0x8e')](_0x502034)['compact']()[_0x2721('0x30')]();return db[_0x2721('0x47')][_0x2721('0x33')]({'where':{'id':_0x2e151c['params']['id']}})['then'](function(_0x5878df){return db[_0x2721('0x74')][_0x2721('0x75')](function(_0xee22e7){return _0x5878df['removeTeams'](_0x2e151c['query'][_0x2721('0x7e')],{'transaction':_0xee22e7})[_0x2721('0x28')](function(){if(!_['isEmpty'](_0x4b7b04)){return _0x5878df[_0x2721('0x8f')](_0x4b7b04,{'transaction':_0xee22e7})[_0x2721('0x28')](function(){return db[_0x2721('0x90')]['destroy']({'where':{'VoiceQueueId':_0x2e151c[_0x2721('0x4d')]['id'],'UserId':_0x4b7b04},'transaction':_0xee22e7});});}})[_0x2721('0x28')](function(){_0x4b7b04[_0x2721('0x72')](function(_0x17e805){socket[_0x2721('0x7c')](_0x2721('0x91'),{'UserId':_0x17e805,'VoiceQueueId':_0x5878df['id']});});});});});});})[_0x2721('0x28')](respondWithStatusCode(_0x5c12e6,null))['catch'](handleError(_0x5c12e6,null));};exports[_0x2721('0x92')]=function(_0x3db711,_0x206548,_0xc15f58){var _0x5e9e02,_0x197b29;return db[_0x2721('0x47')][_0x2721('0x33')]({'where':{'id':_0x3db711[_0x2721('0x4d')]['id']}})['then'](handleEntityNotFound(_0x206548,null))[_0x2721('0x28')](function(_0x57c9b6){if(_0x57c9b6){_0x197b29=_0x57c9b6;return _0x57c9b6[_0x2721('0x92')](_0x3db711[_0x2721('0x5c')][_0x2721('0x7e')],_[_0x2721('0x59')](_0x3db711[_0x2721('0x5c')],[_0x2721('0x7e'),'id'])||{})[_0x2721('0x93')](function(_0x1045af){for(var _0x498931=0x0;_0x498931<_0x3db711[_0x2721('0x5c')][_0x2721('0x7e')][_0x2721('0x4f')];_0x498931+=0x1){socket[_0x2721('0x7c')](_0x2721('0x7d'),{'UserId':Number(_0x3db711[_0x2721('0x5c')]['ids'][_0x498931]),'VoiceQueueId':Number(_0x3db711[_0x2721('0x4d')]['id'])});}return _0x1045af;});}})['then'](function(_0x428ced){_0x5e9e02=_0x428ced||[];if(_0x197b29){return db[_0x2721('0x6c')]['findAll']({'where':{'id':_0x3db711[_0x2721('0x5c')]['ids']},'attributes':['id',_0x2721('0x34'),'online',_0x2721('0x6f'),_0x2721('0x70')],'raw':!![]});}})[_0x2721('0x28')](function(_0xb1dcdc){if(!_[_0x2721('0x94')](_0xb1dcdc)){var _0x3f8a6c=[];for(var _0x283449=0x0;_0x283449<_0xb1dcdc[_0x2721('0x4f')];_0x283449++){if(_0xb1dcdc[_0x283449]['online']){_0x3f8a6c['push'](db[_0x2721('0x90')][_0x2721('0x76')]({'membername':_0xb1dcdc[_0x283449]['name'],'UserId':_0xb1dcdc[_0x283449]['id'],'queue_name':_0x197b29[_0x2721('0x34')],'VoiceQueueId':_0x197b29['id'],'interface':_['isNil'](_0xb1dcdc[_0x283449][_0x2721('0x70')])?util[_0x2721('0x7b')](_0x2721('0x95'),_0xb1dcdc[_0x283449][_0x2721('0x34')]):_0xb1dcdc[_0x283449][_0x2721('0x70')],'paused':_0xb1dcdc[_0x283449]['voicePause']||![],'penalty':_0x3db711[_0x2721('0x5c')][_0x2721('0x73')]||0x0}));}}return BPromise[_0x2721('0x8d')](_0x3f8a6c);}})[_0x2721('0x28')](function(){return _0x5e9e02;})[_0x2721('0x28')](respondWithResult(_0x206548,null))[_0x2721('0x4b')](handleError(_0x206548,null));};exports[_0x2721('0x8f')]=function(_0x52257a,_0x2e2f3b,_0x50377d){return db[_0x2721('0x47')][_0x2721('0x33')]({'where':{'id':_0x52257a[_0x2721('0x4d')]['id']}})[_0x2721('0x28')](handleEntityNotFound(_0x2e2f3b,null))[_0x2721('0x28')](function(_0x43a549){if(_0x43a549){return _0x43a549[_0x2721('0x8f')](_0x52257a[_0x2721('0x39')][_0x2721('0x7e')])[_0x2721('0x28')](function(){if(_[_0x2721('0x96')](_0x52257a[_0x2721('0x39')][_0x2721('0x7e')])){for(var _0x54ca2e=0x0;_0x54ca2e<_0x52257a[_0x2721('0x39')][_0x2721('0x7e')][_0x2721('0x4f')];_0x54ca2e+=0x1){socket[_0x2721('0x7c')](_0x2721('0x91'),{'UserId':Number(_0x52257a[_0x2721('0x39')][_0x2721('0x7e')][_0x54ca2e]),'VoiceQueueId':Number(_0x52257a[_0x2721('0x4d')]['id'])});}}else{socket[_0x2721('0x7c')](_0x2721('0x91'),{'UserId':Number(_0x52257a[_0x2721('0x39')][_0x2721('0x7e')]),'VoiceQueueId':Number(_0x52257a[_0x2721('0x4d')]['id'])});}});}})[_0x2721('0x28')](function(_0x3ebf1a){return db[_0x2721('0x90')]['destroy']({'where':{'VoiceQueueId':_0x52257a['params']['id'],'UserId':_0x52257a[_0x2721('0x39')]['ids']}})[_0x2721('0x28')](function(){return _0x3ebf1a;});})[_0x2721('0x28')](respondWithStatusCode(_0x2e2f3b,null))[_0x2721('0x4b')](handleError(_0x2e2f3b,null));};exports[_0x2721('0x97')]=function(_0x3461ca,_0x55e9bc,_0x286db0){var _0x4cba0e={};var _0x497740={};var _0x43daec;var _0x5864f7;return db[_0x2721('0x47')][_0x2721('0x60')]({'where':{'id':_0x3461ca[_0x2721('0x4d')]['id']}})[_0x2721('0x28')](handleEntityNotFound(_0x55e9bc,null))['then'](function(_0x3fc230){if(_0x3fc230){_0x43daec=_0x3fc230;_0x497740['model']=_['keys'](db[_0x2721('0x6c')][_0x2721('0x4e')]);_0x497740['query']=_['keys'](_0x3461ca[_0x2721('0x39')]);_0x497740['filters']=_[_0x2721('0x3d')](_0x497740[_0x2721('0x38')],_0x497740[_0x2721('0x39')]);_0x4cba0e[_0x2721('0x3c')]=_['intersection'](_0x497740['model'],qs[_0x2721('0x3e')](_0x3461ca[_0x2721('0x39')][_0x2721('0x3e')]));_0x4cba0e[_0x2721('0x3c')]=_0x4cba0e[_0x2721('0x3c')][_0x2721('0x4f')]?_0x4cba0e[_0x2721('0x3c')]:_0x497740['model'];_0x4cba0e[_0x2721('0x40')]=qs[_0x2721('0x41')](_0x3461ca['query'][_0x2721('0x41')]);_0x4cba0e[_0x2721('0x43')]=qs[_0x2721('0x3b')](_['pick'](_0x3461ca[_0x2721('0x39')],_0x497740['filters']));if(_0x3461ca[_0x2721('0x39')][_0x2721('0x2d')]){_0x4cba0e[_0x2721('0x43')]=_[_0x2721('0x44')](_0x4cba0e[_0x2721('0x43')],{'$or':_[_0x2721('0x2f')](_0x4cba0e[_0x2721('0x3c')],function(_0x1311f8){var _0x332f6f={};_0x332f6f[_0x1311f8]={'$like':'%'+_0x3461ca[_0x2721('0x39')][_0x2721('0x2d')]+'%'};return _0x332f6f;})});}_0x4cba0e=_[_0x2721('0x44')]({},_0x4cba0e,_0x3461ca[_0x2721('0x46')]);return _0x43daec[_0x2721('0x97')](_0x4cba0e);}})[_0x2721('0x28')](function(_0x472aff){if(_0x472aff){_0x5864f7=_0x472aff['length'];if(!_0x3461ca[_0x2721('0x39')][_0x2721('0x62')](_0x2721('0x3f'))){_0x4cba0e['limit']=qs[_0x2721('0x21')](_0x3461ca[_0x2721('0x39')][_0x2721('0x21')]);_0x4cba0e[_0x2721('0x23')]=qs[_0x2721('0x23')](_0x3461ca[_0x2721('0x39')][_0x2721('0x23')]);}return _0x43daec[_0x2721('0x97')](_0x4cba0e);}})[_0x2721('0x28')](function(_0x195497){if(_0x195497){return _0x195497?{'count':_0x5864f7,'rows':_0x195497}:null;}})['then'](respondWithResult(_0x55e9bc,null))[_0x2721('0x4b')](handleError(_0x55e9bc,null));};exports[_0x2721('0x98')]=function(_0x571dde,_0x1866c4,_0x28ce8b){var _0x2e2290={};var _0x3f5a7c={};var _0x433880;var _0x5c6d96;return db[_0x2721('0x47')][_0x2721('0x60')]({'where':{'id':_0x571dde[_0x2721('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1866c4,null))[_0x2721('0x28')](function(_0x47c0d0){if(_0x47c0d0){_0x433880=_0x47c0d0;_0x3f5a7c[_0x2721('0x38')]=_[_0x2721('0x3a')](db[_0x2721('0x90')]['rawAttributes']);_0x3f5a7c[_0x2721('0x39')]=_['keys'](_0x571dde[_0x2721('0x39')]);_0x3f5a7c[_0x2721('0x3b')]=_['intersection'](_0x3f5a7c[_0x2721('0x38')],_0x3f5a7c[_0x2721('0x39')]);_0x2e2290['attributes']=_['intersection'](_0x3f5a7c[_0x2721('0x38')],qs[_0x2721('0x3e')](_0x571dde[_0x2721('0x39')][_0x2721('0x3e')]));_0x2e2290['attributes']=_0x2e2290[_0x2721('0x3c')][_0x2721('0x4f')]?_0x2e2290[_0x2721('0x3c')]:_0x3f5a7c['model'];_0x2e2290['order']=qs[_0x2721('0x41')](_0x571dde[_0x2721('0x39')]['sort']);_0x2e2290[_0x2721('0x43')]=qs[_0x2721('0x3b')](_[_0x2721('0x42')](_0x571dde[_0x2721('0x39')],_0x3f5a7c[_0x2721('0x3b')]));if(_0x571dde[_0x2721('0x39')]['filter']){_0x2e2290[_0x2721('0x43')]=_[_0x2721('0x44')](_0x2e2290['where'],{'$or':_[_0x2721('0x2f')](_0x2e2290['attributes'],function(_0x51102b){var _0x1de723={};_0x1de723[_0x51102b]={'$like':'%'+_0x571dde[_0x2721('0x39')][_0x2721('0x2d')]+'%'};return _0x1de723;})});}_0x2e2290=_[_0x2721('0x44')]({},_0x2e2290,_0x571dde[_0x2721('0x46')]);return _0x433880[_0x2721('0x98')](_0x2e2290);}})[_0x2721('0x28')](function(_0x247829){if(_0x247829){_0x5c6d96=_0x247829[_0x2721('0x4f')];if(!_0x571dde[_0x2721('0x39')][_0x2721('0x62')](_0x2721('0x3f'))){_0x2e2290[_0x2721('0x21')]=qs[_0x2721('0x21')](_0x571dde['query'][_0x2721('0x21')]);_0x2e2290['offset']=qs[_0x2721('0x23')](_0x571dde['query'][_0x2721('0x23')]);}return _0x433880['getMembers'](_0x2e2290);}})[_0x2721('0x28')](function(_0x41902f){return _0x41902f?{'count':_0x5c6d96,'rows':_0x41902f}:null;})[_0x2721('0x28')](respondWithResult(_0x1866c4,null))[_0x2721('0x4b')](handleError(_0x1866c4,null));};exports[_0x2721('0x99')]=function(_0x4e6e0e,_0x312abf,_0x52311f){var _0x476040={};var _0x1cddb3={};var _0x49e0bc;var _0x28f6e4;return db[_0x2721('0x47')][_0x2721('0x60')]({'where':{'id':_0x4e6e0e[_0x2721('0x4d')]['id']}})[_0x2721('0x28')](handleEntityNotFound(_0x312abf,null))[_0x2721('0x28')](function(_0x4b23d9){if(_0x4b23d9){_0x49e0bc=_0x4b23d9;_0x1cddb3[_0x2721('0x38')]=_[_0x2721('0x3a')](db[_0x2721('0x9a')]['rawAttributes']);_0x1cddb3['query']=_['keys'](_0x4e6e0e[_0x2721('0x39')]);_0x1cddb3[_0x2721('0x3b')]=_[_0x2721('0x3d')](_0x1cddb3[_0x2721('0x38')],_0x1cddb3[_0x2721('0x39')]);_0x476040['attributes']=_['intersection'](_0x1cddb3[_0x2721('0x38')],qs[_0x2721('0x3e')](_0x4e6e0e['query'][_0x2721('0x3e')]));_0x476040[_0x2721('0x3c')]=_0x476040['attributes']['length']?_0x476040['attributes']:_0x1cddb3['model'];_0x476040[_0x2721('0x40')]=qs['sort'](_0x4e6e0e[_0x2721('0x39')][_0x2721('0x41')]);_0x476040[_0x2721('0x43')]=qs[_0x2721('0x3b')](_[_0x2721('0x42')](_0x4e6e0e[_0x2721('0x39')],_0x1cddb3['filters']));if(_0x4e6e0e[_0x2721('0x39')][_0x2721('0x2d')]){_0x476040[_0x2721('0x43')]=_[_0x2721('0x44')](_0x476040[_0x2721('0x43')],{'$or':_[_0x2721('0x2f')](_0x476040[_0x2721('0x3c')],function(_0xc79b19){var _0x426614={};_0x426614[_0xc79b19]={'$like':'%'+_0x4e6e0e[_0x2721('0x39')]['filter']+'%'};return _0x426614;})});}_0x476040=_[_0x2721('0x44')]({},_0x476040,_0x4e6e0e[_0x2721('0x46')]);return _0x49e0bc['getLists'](_0x476040);}})[_0x2721('0x28')](function(_0x44da7d){if(_0x44da7d){_0x28f6e4=_0x44da7d['length'];if(!_0x4e6e0e[_0x2721('0x39')][_0x2721('0x62')]('nolimit')){_0x476040['limit']=qs['limit'](_0x4e6e0e[_0x2721('0x39')][_0x2721('0x21')]);_0x476040[_0x2721('0x23')]=qs[_0x2721('0x23')](_0x4e6e0e['query'][_0x2721('0x23')]);}return _0x49e0bc['getLists'](_0x476040);}})[_0x2721('0x28')](function(_0x2ea252){if(_0x2ea252){return _0x2ea252?{'count':_0x28f6e4,'rows':_0x2ea252}:null;}})['then'](respondWithResult(_0x312abf,null))['catch'](handleError(_0x312abf,null));};exports[_0x2721('0x9b')]=function(_0xc5f004,_0xcf7dda,_0x523c64){var _0x3092c9,_0x868e85;return db[_0x2721('0x47')][_0x2721('0x33')]({'where':{'id':_0xc5f004['params']['id']}})['then'](handleEntityNotFound(_0xcf7dda,null))[_0x2721('0x28')](function(_0x2d6175){if(_0x2d6175){_0x868e85=_0x2d6175;return _0x2d6175[_0x2721('0x9b')](_0xc5f004['body']['ids'],_[_0x2721('0x59')](_0xc5f004[_0x2721('0x5c')],[_0x2721('0x7e'),'id'])||{});}return null;})['spread'](function(_0x2c754e){var _0x4272bc;_0x3092c9=_0x2c754e||[];var _0x4a73b8=[];if(_0x2c754e){for(var _0x3c3251=0x0;_0x3c3251<_0x2c754e[_0x2721('0x4f')];_0x3c3251+=0x1){var _0x27cbcd=_0x2c754e[_0x3c3251][_0x2721('0x54')]({'plain':!![]});_0x868e85[_0x2721('0x9c')]=_0xc5f004[_0x2721('0x5c')][_0x2721('0x9c')]?_0xc5f004[_0x2721('0x5c')]['dialCheckDuplicateType']:_0x868e85['dialCheckDuplicateType'];switch(_0x868e85[_0x2721('0x9c')]){case _0x2721('0x9d'):_0x4272bc=squel[_0x2721('0x9e')]()[_0x2721('0x9f')](_0x2721('0xa0'))['fromQuery']([_0x2721('0xa1'),'scheduledAt','ContactId',_0x2721('0xa2'),'VoiceQueueId',_0x2721('0x5a'),'updatedAt'],squel['select']()['field'](_0x2721('0xa1'),_0x2721('0xa1'))['field'](_0x2721('0xa3'),_0x2721('0xa4'))['field']('id',_0x2721('0xa5'))[_0x2721('0x80')](_0x27cbcd[_0x2721('0xa6')][_0x2721('0xa7')](),_0x2721('0xa2'))[_0x2721('0x80')](_0xc5f004[_0x2721('0x4d')]['id'][_0x2721('0xa7')](),_0x2721('0x63'))[_0x2721('0x80')]('NOW()',_0x2721('0x5a'))['field'](_0x2721('0xa3'),'updatedAt')['from']('cm_contacts')[_0x2721('0x43')](_0x2721('0xa8'))[_0x2721('0x43')](_0x2721('0xa9'),_0x27cbcd[_0x2721('0xa6')]['toString']())[_0x2721('0x43')](_0x2721('0xaa'))[_0x2721('0x43')](_0x2721('0xab'),squel[_0x2721('0x7f')]()[_0x2721('0x80')](_0x2721('0xac'))[_0x2721('0x81')](_0x2721('0xad'))[_0x2721('0x43')](_0x2721('0xae'),_0xc5f004[_0x2721('0x4d')]['id'][_0x2721('0xa7')]()))['where'](_0x2721('0xab'),squel['select']()[_0x2721('0x80')]('COALESCE(phone,\x27\x27)')[_0x2721('0x81')](_0x2721('0xa0'))[_0x2721('0x43')](_0x2721('0xae'),_0xc5f004[_0x2721('0x4d')]['id'][_0x2721('0xa7')]())))['toString']();break;case'onlyIfOpen':_0x4272bc=squel[_0x2721('0x9e')]()[_0x2721('0x9f')](_0x2721('0xa0'))['fromQuery']([_0x2721('0xa1'),_0x2721('0xa4'),_0x2721('0xa5'),_0x2721('0xa2'),_0x2721('0x63'),'createdAt','updatedAt'],squel[_0x2721('0x7f')]()[_0x2721('0x80')](_0x2721('0xa1'),'phone')['field'](_0x2721('0xa3'),_0x2721('0xa4'))[_0x2721('0x80')]('id',_0x2721('0xa5'))[_0x2721('0x80')](_0x27cbcd[_0x2721('0xa6')][_0x2721('0xa7')](),_0x2721('0xa2'))['field'](_0xc5f004[_0x2721('0x4d')]['id'][_0x2721('0xa7')](),_0x2721('0x63'))[_0x2721('0x80')](_0x2721('0xa3'),'createdAt')[_0x2721('0x80')](_0x2721('0xa3'),_0x2721('0x5b'))[_0x2721('0x81')](_0x2721('0xaf'))[_0x2721('0x43')]('deletedAt\x20IS\x20NULL')[_0x2721('0x43')](_0x2721('0xa9'),_0x27cbcd['CmListId']['toString']())[_0x2721('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0x2721('0x43')](_0x2721('0xab'),squel[_0x2721('0x7f')]()[_0x2721('0x80')](_0x2721('0xb0'))[_0x2721('0x81')](_0x2721('0xa0'))[_0x2721('0x43')]('VoiceQueueId\x20=\x20?',_0xc5f004[_0x2721('0x4d')]['id'][_0x2721('0xa7')]())))[_0x2721('0xa7')]();break;default:_0x4272bc=squel[_0x2721('0x9e')]()[_0x2721('0x9f')](_0x2721('0xa0'))['fromQuery']([_0x2721('0xa1'),_0x2721('0xa4'),_0x2721('0xa5'),_0x2721('0xa2'),'VoiceQueueId','createdAt',_0x2721('0x5b')],squel[_0x2721('0x7f')]()['field'](_0x2721('0xa1'),_0x2721('0xa1'))[_0x2721('0x80')]('NOW()',_0x2721('0xa4'))[_0x2721('0x80')]('id','ContactId')[_0x2721('0x80')](_0x27cbcd[_0x2721('0xa6')][_0x2721('0xa7')](),_0x2721('0xa2'))[_0x2721('0x80')](_0xc5f004[_0x2721('0x4d')]['id'][_0x2721('0xa7')](),_0x2721('0x63'))[_0x2721('0x80')](_0x2721('0xa3'),_0x2721('0x5a'))[_0x2721('0x80')](_0x2721('0xa3'),_0x2721('0x5b'))[_0x2721('0x81')](_0x2721('0xaf'))['where'](_0x2721('0xa8'))[_0x2721('0x43')]('ListId\x20=\x20?',_0x27cbcd[_0x2721('0xa6')][_0x2721('0xa7')]())['where'](_0x2721('0xaa')))['toString']();}_0x4a73b8['push'](db[_0x2721('0x74')][_0x2721('0x39')](_0x4272bc));}return BPromise[_0x2721('0x8d')](_0x4a73b8);}})[_0x2721('0x28')](function(){return _0x3092c9;})[_0x2721('0x28')](respondWithResult(_0xcf7dda,null))[_0x2721('0x4b')](handleError(_0xcf7dda,null));};exports[_0x2721('0xb1')]=function(_0x1e2e73,_0x1daa07,_0x37aae9){return db[_0x2721('0x47')][_0x2721('0x33')]({'where':{'id':_0x1e2e73[_0x2721('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1daa07,null))[_0x2721('0x28')](function(_0x1a64c7){if(_0x1a64c7){return _0x1a64c7['removeLists'](_0x1e2e73[_0x2721('0x39')][_0x2721('0x7e')]);}})['then'](function(_0xfc3bcf){if(_0xfc3bcf){return db[_0x2721('0x61')][_0x2721('0x29')]({'where':{'ListId':_0x1e2e73[_0x2721('0x39')][_0x2721('0x7e')],'VoiceQueueId':_0x1e2e73[_0x2721('0x4d')]['id']}})['then'](function(){return _0xfc3bcf;});}})[_0x2721('0x28')](respondWithStatusCode(_0x1daa07,null))[_0x2721('0x4b')](handleError(_0x1daa07,null));};exports['getBlackLists']=function(_0x15cd95,_0xda35e2,_0x177f06){var _0x404939={};var _0x45cb0c={};var _0x501ba3;var _0x2ce1c9;return db[_0x2721('0x47')][_0x2721('0x60')]({'where':{'id':_0x15cd95[_0x2721('0x4d')]['id']}})['then'](handleEntityNotFound(_0xda35e2,null))[_0x2721('0x28')](function(_0x98978){if(_0x98978){_0x501ba3=_0x98978;_0x45cb0c['model']=_[_0x2721('0x3a')](db[_0x2721('0x9a')][_0x2721('0x4e')]);_0x45cb0c[_0x2721('0x39')]=_[_0x2721('0x3a')](_0x15cd95[_0x2721('0x39')]);_0x45cb0c['filters']=_[_0x2721('0x3d')](_0x45cb0c[_0x2721('0x38')],_0x45cb0c[_0x2721('0x39')]);_0x404939[_0x2721('0x3c')]=_[_0x2721('0x3d')](_0x45cb0c[_0x2721('0x38')],qs[_0x2721('0x3e')](_0x15cd95[_0x2721('0x39')][_0x2721('0x3e')]));_0x404939['attributes']=_0x404939['attributes'][_0x2721('0x4f')]?_0x404939[_0x2721('0x3c')]:_0x45cb0c[_0x2721('0x38')];_0x404939['order']=qs['sort'](_0x15cd95[_0x2721('0x39')][_0x2721('0x41')]);_0x404939['where']=qs['filters'](_['pick'](_0x15cd95[_0x2721('0x39')],_0x45cb0c['filters']));if(_0x15cd95[_0x2721('0x39')]['filter']){_0x404939[_0x2721('0x43')]=_[_0x2721('0x44')](_0x404939[_0x2721('0x43')],{'$or':_[_0x2721('0x2f')](_0x404939[_0x2721('0x3c')],function(_0x4525ff){var _0x4c49da={};_0x4c49da[_0x4525ff]={'$like':'%'+_0x15cd95[_0x2721('0x39')][_0x2721('0x2d')]+'%'};return _0x4c49da;})});}_0x404939=_['merge']({},_0x404939,_0x15cd95[_0x2721('0x46')]);return _0x501ba3['getBlackLists'](_0x404939);}})['then'](function(_0xf47533){if(_0xf47533){_0x2ce1c9=_0xf47533[_0x2721('0x4f')];if(!_0x15cd95[_0x2721('0x39')][_0x2721('0x62')]('nolimit')){_0x404939[_0x2721('0x21')]=qs['limit'](_0x15cd95[_0x2721('0x39')][_0x2721('0x21')]);_0x404939[_0x2721('0x23')]=qs['offset'](_0x15cd95[_0x2721('0x39')][_0x2721('0x23')]);}return _0x501ba3[_0x2721('0xb2')](_0x404939);}})['then'](function(_0x27c2d8){if(_0x27c2d8){return _0x27c2d8?{'count':_0x2ce1c9,'rows':_0x27c2d8}:null;}})[_0x2721('0x28')](respondWithResult(_0xda35e2,null))['catch'](handleError(_0xda35e2,null));};exports[_0x2721('0xb3')]=function(_0x424273,_0x5c80d9,_0x111dff){var _0x28fda3,_0x4dd8ee;return db[_0x2721('0x47')][_0x2721('0x33')]({'where':{'id':_0x424273[_0x2721('0x4d')]['id']}})[_0x2721('0x28')](handleEntityNotFound(_0x5c80d9,null))['then'](function(_0xd9d220){if(_0xd9d220){_0x4dd8ee=_0xd9d220;return _0xd9d220[_0x2721('0xb3')](_0x424273[_0x2721('0x5c')][_0x2721('0x7e')],_[_0x2721('0x59')](_0x424273[_0x2721('0x5c')],[_0x2721('0x7e'),'id'])||{});}return null;})['spread'](function(_0x1a5e7b){var _0x419832;_0x28fda3=_0x1a5e7b||[];var _0x5dc53f=[];if(_0x1a5e7b){for(var _0xf8963b=0x0;_0xf8963b<_0x1a5e7b[_0x2721('0x4f')];_0xf8963b+=0x1){var _0x31cee5=_0x1a5e7b[_0xf8963b][_0x2721('0x54')]({'plain':!![]});_0x419832=squel[_0x2721('0x9e')]()[_0x2721('0x9f')](_0x2721('0xb4'))['fromQuery']([_0x2721('0xa1'),'ContactId','ListId',_0x2721('0x63'),_0x2721('0x5a'),'updatedAt'],squel[_0x2721('0x7f')]()[_0x2721('0x80')](_0x2721('0xa1'),_0x2721('0xa1'))['field']('id',_0x2721('0xa5'))[_0x2721('0x80')](_0x31cee5[_0x2721('0xa6')]['toString'](),_0x2721('0xa2'))['field'](_0x424273[_0x2721('0x4d')]['id'][_0x2721('0xa7')](),_0x2721('0x63'))[_0x2721('0x80')](_0x2721('0xa3'),_0x2721('0x5a'))[_0x2721('0x80')](_0x2721('0xa3'),_0x2721('0x5b'))[_0x2721('0x81')](_0x2721('0xaf'))[_0x2721('0x43')](_0x2721('0xa8'))['where'](_0x2721('0xa9'),_0x31cee5[_0x2721('0xa6')][_0x2721('0xa7')]())[_0x2721('0x43')](_0x2721('0xaa')))[_0x2721('0xa7')]();_0x5dc53f['push'](db[_0x2721('0x74')][_0x2721('0x39')](_0x419832));}return BPromise[_0x2721('0x8d')](_0x5dc53f);}})[_0x2721('0x28')](function(){return _0x28fda3;})[_0x2721('0x28')](respondWithResult(_0x5c80d9,null))[_0x2721('0x4b')](handleError(_0x5c80d9,null));};exports['removeBlackLists']=function(_0x13deaa,_0x30f0d0,_0x5bfaa2){return db[_0x2721('0x47')][_0x2721('0x33')]({'where':{'id':_0x13deaa[_0x2721('0x4d')]['id']}})[_0x2721('0x28')](handleEntityNotFound(_0x30f0d0,null))['then'](function(_0x1a0302){if(_0x1a0302){return _0x1a0302[_0x2721('0xb5')](_0x13deaa['query'][_0x2721('0x7e')]);}})[_0x2721('0x28')](function(_0x5597f7){if(_0x5597f7){return db[_0x2721('0x68')][_0x2721('0x29')]({'where':{'ListId':_0x13deaa['query'][_0x2721('0x7e')],'VoiceQueueId':_0x13deaa[_0x2721('0x4d')]['id']}})[_0x2721('0x28')](function(){return _0x5597f7;});}})['then'](respondWithStatusCode(_0x30f0d0,null))[_0x2721('0x4b')](handleError(_0x30f0d0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 5c737db..23a13dc 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 _0x4012=['exports','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove','emit','hook'];(function(_0x42d35d,_0x33e6fc){var _0x445dbc=function(_0x45fb03){while(--_0x45fb03){_0x42d35d['push'](_0x42d35d['shift']());}};_0x445dbc(++_0x33e6fc);}(_0x4012,0x172));var _0x2401=function(_0x58f74d,_0x372c05){_0x58f74d=_0x58f74d-0x0;var _0x177e87=_0x4012[_0x58f74d];return _0x177e87;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x2401('0x0'))['db'][_0x2401('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x2401('0x2')](0x0);var events={'afterCreate':_0x2401('0x3'),'afterUpdate':_0x2401('0x4'),'afterDestroy':_0x2401('0x5')};function emitEvent(_0xb40449){return function(_0x143dc4,_0x241444,_0x43d17f){VoiceQueueEvents[_0x2401('0x6')](_0xb40449+':'+_0x143dc4['id'],_0x143dc4);VoiceQueueEvents[_0x2401('0x6')](_0xb40449,_0x143dc4);_0x43d17f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x2401('0x7')](e,emitEvent(event));}}module[_0x2401('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x3003=['hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x114ca7,_0x2ce49d){var _0x169af2=function(_0xcfa101){while(--_0xcfa101){_0x114ca7['push'](_0x114ca7['shift']());}};_0x169af2(++_0x2ce49d);}(_0x3003,0xc0));var _0x3300=function(_0x506abb,_0x4d87f9){_0x506abb=_0x506abb-0x0;var _0x5d9e18=_0x3003[_0x506abb];return _0x5d9e18;};'use strict';var EventEmitter=require(_0x3300('0x0'));var VoiceQueue=require(_0x3300('0x1'))['db'][_0x3300('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x3300('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3300('0x4'),'afterDestroy':_0x3300('0x5')};function emitEvent(_0x1a146c){return function(_0x4b0153,_0x372441,_0xd6acc){VoiceQueueEvents['emit'](_0x1a146c+':'+_0x4b0153['id'],_0x4b0153);VoiceQueueEvents[_0x3300('0x6')](_0x1a146c,_0x4b0153);_0xd6acc(null);};}for(var e in events){if(events[_0x3300('0x7')](e)){var event=events[e];VoiceQueue[_0x3300('0x8')](e,emitEvent(event));}}module[_0x3300('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 2c8fed9..739df73 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(_0x5227b0,_0x144a72){var _0x2d9c7e=function(_0x9002d6){while(--_0x9002d6){_0x5227b0['push'](_0x5227b0['shift']());}};_0x2d9c7e(++_0x144a72);}(_0x9c44,0x178));var _0x49c4=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x9c44[_0x24061a];return _0x82054e;};'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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x3a7807,_0x5e2e75){var _0x2b22a8=function(_0x5723f1){while(--_0x5723f1){_0x3a7807['push'](_0x3a7807['shift']());}};_0x2b22a8(++_0x5e2e75);}(_0x34e8,0x12c));var _0x834e=function(_0x596fa2,_0x2f9484){_0x596fa2=_0x596fa2-0x0;var _0x1e6f0f=_0x34e8[_0x596fa2];return _0x1e6f0f;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 3958942..6af9889 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 _0x9eeb=['options','raw','where','attributes','include','map','model','catch','ShowVoiceQueue','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','VoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','GetVoiceQueue'];(function(_0x2c90e8,_0x3b19d0){var _0x127283=function(_0x13b8f1){while(--_0x13b8f1){_0x2c90e8['push'](_0x2c90e8['shift']());}};_0x127283(++_0x3b19d0);}(_0x9eeb,0x9a));var _0xb9ee=function(_0x44bba4,_0x2d2da2){_0x44bba4=_0x44bba4-0x0;var _0x209759=_0x9eeb[_0x44bba4];return _0x209759;};'use strict';var _=require('lodash');var util=require(_0xb9ee('0x0'));var moment=require(_0xb9ee('0x1'));var BPromise=require(_0xb9ee('0x2'));var rs=require(_0xb9ee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9ee('0x4'))['db'];var utils=require(_0xb9ee('0x5'));var logger=require(_0xb9ee('0x6'))('rpc');var config=require(_0xb9ee('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb9ee('0x8')][_0xb9ee('0x9')]({'port':0x232a});config[_0xb9ee('0xa')]=_[_0xb9ee('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb9ee('0xc'))(new Redis(config[_0xb9ee('0xa')]));require('./voiceQueue.socket')[_0xb9ee('0xd')](socket);function respondWithRpcPromise(_0xef8ada,_0x35cc39,_0xb04ee2){return new BPromise(function(_0x42c3ff,_0x5ab48d){return client[_0xb9ee('0xe')](_0xef8ada,_0xb04ee2)[_0xb9ee('0xf')](function(_0x429bf7){logger['info'](_0xb9ee('0x10'),_0x35cc39,'request\x20sent');logger[_0xb9ee('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x35cc39,_0xb9ee('0x12'),JSON[_0xb9ee('0x13')](_0x429bf7));if(_0x429bf7[_0xb9ee('0x14')]){if(_0x429bf7[_0xb9ee('0x14')][_0xb9ee('0x15')]===0x1f4){logger[_0xb9ee('0x14')](_0xb9ee('0x10'),_0x35cc39,_0x429bf7[_0xb9ee('0x14')][_0xb9ee('0x16')]);return _0x5ab48d(_0x429bf7[_0xb9ee('0x14')]['message']);}logger['error'](_0xb9ee('0x10'),_0x35cc39,_0x429bf7[_0xb9ee('0x14')][_0xb9ee('0x16')]);return _0x42c3ff(_0x429bf7['error'][_0xb9ee('0x16')]);}else{logger[_0xb9ee('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x35cc39,'request\x20sent');_0x42c3ff(_0x429bf7[_0xb9ee('0x18')]['message']);}})['catch'](function(_0x58a17f){logger['error'](_0xb9ee('0x10'),_0x35cc39,_0x58a17f);_0x5ab48d(_0x58a17f);});});}exports[_0xb9ee('0x19')]=function(_0x104bc8){var _0x27d1d9=this;return new Promise(function(_0x58d9f6,_0x3bf094){return db['VoiceQueue']['findAll']({'raw':_0x104bc8[_0xb9ee('0x1a')]?_0x104bc8[_0xb9ee('0x1a')][_0xb9ee('0x1b')]===undefined?!![]:![]:!![],'where':_0x104bc8['options']?_0x104bc8[_0xb9ee('0x1a')][_0xb9ee('0x1c')]||null:null,'attributes':_0x104bc8[_0xb9ee('0x1a')]?_0x104bc8[_0xb9ee('0x1a')][_0xb9ee('0x1d')]||null:null,'limit':_0x104bc8[_0xb9ee('0x1a')]?_0x104bc8[_0xb9ee('0x1a')]['limit']||null:null,'include':_0x104bc8[_0xb9ee('0x1a')]?_0x104bc8[_0xb9ee('0x1a')][_0xb9ee('0x1e')]?_[_0xb9ee('0x1f')](_0x104bc8[_0xb9ee('0x1a')][_0xb9ee('0x1e')],function(_0x4ac2f1){return{'model':db[_0x4ac2f1[_0xb9ee('0x20')]],'as':_0x4ac2f1['as'],'attributes':_0x4ac2f1['attributes'],'include':_0x4ac2f1[_0xb9ee('0x1e')]?_[_0xb9ee('0x1f')](_0x4ac2f1[_0xb9ee('0x1e')],function(_0x3376f0){return{'model':db[_0x3376f0[_0xb9ee('0x20')]],'as':_0x3376f0['as'],'attributes':_0x3376f0['attributes'],'include':_0x3376f0[_0xb9ee('0x1e')]?_[_0xb9ee('0x1f')](_0x3376f0['include'],function(_0x4842b4){return{'model':db[_0x4842b4['model']],'as':_0x4842b4['as'],'attributes':_0x4842b4[_0xb9ee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb9ee('0xf')](function(_0x347740){logger[_0xb9ee('0x17')](_0xb9ee('0x19'),_0x104bc8);logger[_0xb9ee('0x11')](_0xb9ee('0x19'),_0x104bc8,JSON['stringify'](_0x347740));_0x58d9f6(_0x347740);})[_0xb9ee('0x21')](function(_0x4daa9b){logger[_0xb9ee('0x14')](_0xb9ee('0x19'),_0x4daa9b[_0xb9ee('0x16')],_0x104bc8);_0x3bf094(_0x27d1d9[_0xb9ee('0x14')](0x1f4,_0x4daa9b['message']));});});};exports[_0xb9ee('0x22')]=function(_0x45d574){var _0x3f5369=this;return new Promise(function(_0xc1c5ff,_0x91e1f4){return db['VoiceQueue'][_0xb9ee('0x23')]({'raw':_0x45d574[_0xb9ee('0x1a')]?_0x45d574[_0xb9ee('0x1a')][_0xb9ee('0x1b')]===undefined?!![]:![]:!![],'where':_0x45d574[_0xb9ee('0x1a')]?_0x45d574[_0xb9ee('0x1a')]['where']||null:null,'attributes':_0x45d574['options']?_0x45d574['options'][_0xb9ee('0x1d')]||null:null,'include':_0x45d574[_0xb9ee('0x1a')]?_0x45d574['options'][_0xb9ee('0x1e')]?_[_0xb9ee('0x1f')](_0x45d574['options'][_0xb9ee('0x1e')],function(_0x43e263){return{'model':db[_0x43e263['model']],'as':_0x43e263['as'],'attributes':_0x43e263[_0xb9ee('0x1d')],'include':_0x43e263[_0xb9ee('0x1e')]?_[_0xb9ee('0x1f')](_0x43e263[_0xb9ee('0x1e')],function(_0x39333d){return{'model':db[_0x39333d[_0xb9ee('0x20')]],'as':_0x39333d['as'],'attributes':_0x39333d[_0xb9ee('0x1d')],'include':_0x39333d['include']?_[_0xb9ee('0x1f')](_0x39333d[_0xb9ee('0x1e')],function(_0xb4e39d){return{'model':db[_0xb4e39d[_0xb9ee('0x20')]],'as':_0xb4e39d['as'],'attributes':_0xb4e39d[_0xb9ee('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb9ee('0xf')](function(_0x10938a){logger[_0xb9ee('0x17')](_0xb9ee('0x22'),_0x45d574);logger[_0xb9ee('0x11')](_0xb9ee('0x22'),_0x45d574,JSON['stringify'](_0x10938a));_0xc1c5ff(_0x10938a);})[_0xb9ee('0x21')](function(_0x1c6a4f){logger[_0xb9ee('0x14')](_0xb9ee('0x22'),_0x1c6a4f[_0xb9ee('0x16')],_0x45d574);_0x91e1f4(_0x3f5369[_0xb9ee('0x14')](0x1f4,_0x1c6a4f[_0xb9ee('0x16')]));});});}; \ No newline at end of file +var _0xe607=['./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','VoiceQueue','options','where','include','map','model','attributes','GetVoiceQueue','debug','stringify','ShowVoiceQueue','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0xe607,0x83));var _0x7e60=function(_0x25427e,_0x38ad19){_0x25427e=_0x25427e-0x0;var _0x27c9e8=_0xe607[_0x25427e];return _0x27c9e8;};'use strict';var _=require('lodash');var util=require(_0x7e60('0x0'));var moment=require(_0x7e60('0x1'));var BPromise=require(_0x7e60('0x2'));var rs=require(_0x7e60('0x3'));var fs=require('fs');var Redis=require(_0x7e60('0x4'));var db=require(_0x7e60('0x5'))['db'];var utils=require(_0x7e60('0x6'));var logger=require(_0x7e60('0x7'))(_0x7e60('0x8'));var config=require(_0x7e60('0x9'));var jayson=require(_0x7e60('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x7e60('0xb')]=_[_0x7e60('0xc')](config[_0x7e60('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7e60('0xb')]));require(_0x7e60('0xd'))[_0x7e60('0xe')](socket);function respondWithRpcPromise(_0x421e17,_0x2fc02a,_0x288e54){return new BPromise(function(_0xaeb69b,_0x388fe6){return client['request'](_0x421e17,_0x288e54)[_0x7e60('0xf')](function(_0x5a598e){logger[_0x7e60('0x10')](_0x7e60('0x11'),_0x2fc02a,'request\x20sent');logger['debug'](_0x7e60('0x12'),_0x2fc02a,_0x7e60('0x13'),JSON['stringify'](_0x5a598e));if(_0x5a598e[_0x7e60('0x14')]){if(_0x5a598e['error'][_0x7e60('0x15')]===0x1f4){logger[_0x7e60('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x2fc02a,_0x5a598e[_0x7e60('0x14')][_0x7e60('0x16')]);return _0x388fe6(_0x5a598e[_0x7e60('0x14')][_0x7e60('0x16')]);}logger[_0x7e60('0x14')](_0x7e60('0x11'),_0x2fc02a,_0x5a598e[_0x7e60('0x14')][_0x7e60('0x16')]);return _0xaeb69b(_0x5a598e['error'][_0x7e60('0x16')]);}else{logger[_0x7e60('0x10')](_0x7e60('0x11'),_0x2fc02a,'request\x20sent');_0xaeb69b(_0x5a598e['result'][_0x7e60('0x16')]);}})[_0x7e60('0x17')](function(_0x14e9aa){logger[_0x7e60('0x14')](_0x7e60('0x11'),_0x2fc02a,_0x14e9aa);_0x388fe6(_0x14e9aa);});});}exports['GetVoiceQueue']=function(_0x530044){var _0x37ac1f=this;return new Promise(function(_0x4be179,_0x33b5b3){return db[_0x7e60('0x18')]['findAll']({'raw':_0x530044[_0x7e60('0x19')]?_0x530044[_0x7e60('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x530044[_0x7e60('0x19')]?_0x530044[_0x7e60('0x19')][_0x7e60('0x1a')]||null:null,'attributes':_0x530044['options']?_0x530044[_0x7e60('0x19')]['attributes']||null:null,'limit':_0x530044[_0x7e60('0x19')]?_0x530044[_0x7e60('0x19')]['limit']||null:null,'include':_0x530044[_0x7e60('0x19')]?_0x530044[_0x7e60('0x19')][_0x7e60('0x1b')]?_[_0x7e60('0x1c')](_0x530044['options'][_0x7e60('0x1b')],function(_0x11fb8e){return{'model':db[_0x11fb8e[_0x7e60('0x1d')]],'as':_0x11fb8e['as'],'attributes':_0x11fb8e[_0x7e60('0x1e')],'include':_0x11fb8e[_0x7e60('0x1b')]?_[_0x7e60('0x1c')](_0x11fb8e[_0x7e60('0x1b')],function(_0x230e85){return{'model':db[_0x230e85[_0x7e60('0x1d')]],'as':_0x230e85['as'],'attributes':_0x230e85[_0x7e60('0x1e')],'include':_0x230e85[_0x7e60('0x1b')]?_['map'](_0x230e85['include'],function(_0x434ef9){return{'model':db[_0x434ef9[_0x7e60('0x1d')]],'as':_0x434ef9['as'],'attributes':_0x434ef9[_0x7e60('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7e60('0xf')](function(_0x303623){logger[_0x7e60('0x10')](_0x7e60('0x1f'),_0x530044);logger[_0x7e60('0x20')](_0x7e60('0x1f'),_0x530044,JSON[_0x7e60('0x21')](_0x303623));_0x4be179(_0x303623);})['catch'](function(_0x38c5ec){logger[_0x7e60('0x14')](_0x7e60('0x1f'),_0x38c5ec[_0x7e60('0x16')],_0x530044);_0x33b5b3(_0x37ac1f[_0x7e60('0x14')](0x1f4,_0x38c5ec['message']));});});};exports[_0x7e60('0x22')]=function(_0x2b3997){var _0x245018=this;return new Promise(function(_0x36c2de,_0x520573){return db[_0x7e60('0x18')]['find']({'raw':_0x2b3997[_0x7e60('0x19')]?_0x2b3997['options'][_0x7e60('0x23')]===undefined?!![]:![]:!![],'where':_0x2b3997['options']?_0x2b3997[_0x7e60('0x19')][_0x7e60('0x1a')]||null:null,'attributes':_0x2b3997[_0x7e60('0x19')]?_0x2b3997[_0x7e60('0x19')][_0x7e60('0x1e')]||null:null,'include':_0x2b3997[_0x7e60('0x19')]?_0x2b3997['options'][_0x7e60('0x1b')]?_[_0x7e60('0x1c')](_0x2b3997[_0x7e60('0x19')][_0x7e60('0x1b')],function(_0x26737e){return{'model':db[_0x26737e['model']],'as':_0x26737e['as'],'attributes':_0x26737e[_0x7e60('0x1e')],'include':_0x26737e[_0x7e60('0x1b')]?_[_0x7e60('0x1c')](_0x26737e['include'],function(_0xd009e4){return{'model':db[_0xd009e4[_0x7e60('0x1d')]],'as':_0xd009e4['as'],'attributes':_0xd009e4[_0x7e60('0x1e')],'include':_0xd009e4[_0x7e60('0x1b')]?_[_0x7e60('0x1c')](_0xd009e4['include'],function(_0x3819d5){return{'model':db[_0x3819d5[_0x7e60('0x1d')]],'as':_0x3819d5['as'],'attributes':_0x3819d5[_0x7e60('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7e60('0xf')](function(_0x9d80){logger[_0x7e60('0x10')]('ShowVoiceQueue',_0x2b3997);logger[_0x7e60('0x20')](_0x7e60('0x22'),_0x2b3997,JSON['stringify'](_0x9d80));_0x36c2de(_0x9d80);})[_0x7e60('0x17')](function(_0x63d4a4){logger['error'](_0x7e60('0x22'),_0x63d4a4[_0x7e60('0x16')],_0x2b3997);_0x520573(_0x245018['error'](0x1f4,_0x63d4a4[_0x7e60('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 3932a35..451b4ec 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 _0xafa7=['remove','update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xafa7,0x11e));var _0x7afa=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xafa7[_0x2e2681];return _0x368a64;};'use strict';var VoiceQueueEvents=require(_0x7afa('0x0'));var events=[_0x7afa('0x1'),_0x7afa('0x2'),_0x7afa('0x3')];function createListener(_0x1723c0,_0x6eaa9b){return function(_0x388a7f){_0x6eaa9b[_0x7afa('0x4')](_0x1723c0,_0x388a7f);};}function removeListener(_0x46742c,_0x2bd93b){return function(){VoiceQueueEvents[_0x7afa('0x5')](_0x46742c,_0x2bd93b);};}exports[_0x7afa('0x6')]=function(_0x2e9569){for(var _0x5308a8=0x0,_0x36cf66=events[_0x7afa('0x7')];_0x5308a8<_0x36cf66;_0x5308a8++){var _0x5e6672=events[_0x5308a8];var _0x2c50f2=createListener(_0x7afa('0x8')+_0x5e6672,_0x2e9569);VoiceQueueEvents['on'](_0x5e6672,_0x2c50f2);}}; \ No newline at end of file +var _0xab3d=['remove','removeListener','length','voiceQueue:','./voiceQueue.events'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xab3d,0x11c));var _0xdab3=function(_0x1a9142,_0x40702b){_0x1a9142=_0x1a9142-0x0;var _0x10d041=_0xab3d[_0x1a9142];return _0x10d041;};'use strict';var VoiceQueueEvents=require(_0xdab3('0x0'));var events=['save',_0xdab3('0x1'),'update'];function createListener(_0xa8b5ab,_0x2940c8){return function(_0x4c1102){_0x2940c8['emit'](_0xa8b5ab,_0x4c1102);};}function removeListener(_0x848f38,_0x19e251){return function(){VoiceQueueEvents[_0xdab3('0x2')](_0x848f38,_0x19e251);};}exports['register']=function(_0x5aee98){for(var _0x3309de=0x0,_0x3f1647=events[_0xdab3('0x3')];_0x3309de<_0x3f1647;_0x3309de++){var _0x113eec=events[_0x3309de];var _0x414cfb=createListener(_0xdab3('0x4')+_0x113eec,_0x5aee98);VoiceQueueEvents['on'](_0x113eec,_0x414cfb);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index a82b0e1..249a0c6 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 _0x433a=['create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post'];(function(_0x46397a,_0x467e50){var _0x488c0b=function(_0x3c0cac){while(--_0x3c0cac){_0x46397a['push'](_0x46397a['shift']());}};_0x488c0b(++_0x467e50);}(_0x433a,0xf6));var _0xa433=function(_0x43d6bd,_0x45c0d9){_0x43d6bd=_0x43d6bd-0x0;var _0x34b116=_0x433a[_0x43d6bd];return _0x34b116;};'use strict';var multer=require(_0xa433('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa433('0x1'));var express=require(_0xa433('0x2'));var router=express[_0xa433('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa433('0x4'));var interaction=require(_0xa433('0x5'));var config=require(_0xa433('0x6'));var controller=require(_0xa433('0x7'));router[_0xa433('0x8')]('/',auth[_0xa433('0x9')](),controller[_0xa433('0xa')]);router[_0xa433('0x8')](_0xa433('0xb'),auth[_0xa433('0x9')](),controller[_0xa433('0xc')]);router[_0xa433('0x8')](_0xa433('0xd'),auth[_0xa433('0x9')](),controller[_0xa433('0xe')]);router[_0xa433('0x8')](_0xa433('0xf'),auth['isAuthenticated'](),controller[_0xa433('0x10')]);router[_0xa433('0x11')]('/',auth[_0xa433('0x9')](),controller[_0xa433('0x12')]);router[_0xa433('0x13')](_0xa433('0xf'),auth[_0xa433('0x9')](),controller[_0xa433('0x14')]);router[_0xa433('0x15')](_0xa433('0xf'),auth[_0xa433('0x9')](),controller[_0xa433('0x16')]);module[_0xa433('0x17')]=router; \ No newline at end of file +var _0x86a0=['get','/describe','describe','getVoiceQueuesReport','/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index'];(function(_0x23dca5,_0x14a402){var _0x14dc71=function(_0x1573ba){while(--_0x1573ba){_0x23dca5['push'](_0x23dca5['shift']());}};_0x14dc71(++_0x14a402);}(_0x86a0,0x136));var _0x086a=function(_0x13ace2,_0x25e2c4){_0x13ace2=_0x13ace2-0x0;var _0x5e5801=_0x86a0[_0x13ace2];return _0x5e5801;};'use strict';var multer=require(_0x086a('0x0'));var util=require(_0x086a('0x1'));var path=require('path');var timeout=require(_0x086a('0x2'));var express=require(_0x086a('0x3'));var router=express[_0x086a('0x4')]();var fs_extra=require(_0x086a('0x5'));var auth=require(_0x086a('0x6'));var interaction=require(_0x086a('0x7'));var config=require(_0x086a('0x8'));var controller=require(_0x086a('0x9'));router['get']('/',auth[_0x086a('0xa')](),controller[_0x086a('0xb')]);router[_0x086a('0xc')](_0x086a('0xd'),auth[_0x086a('0xa')](),controller[_0x086a('0xe')]);router[_0x086a('0xc')]('/index',auth[_0x086a('0xa')](),controller[_0x086a('0xf')]);router[_0x086a('0xc')](_0x086a('0x10'),auth[_0x086a('0xa')](),controller[_0x086a('0x11')]);router[_0x086a('0x12')]('/',auth[_0x086a('0xa')](),controller[_0x086a('0x13')]);router['put'](_0x086a('0x10'),auth[_0x086a('0xa')](),controller[_0x086a('0x14')]);router[_0x086a('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x086a('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 7ef4be0..3279406 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 _0x7e67=['diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2fff83,_0x29d5fe){var _0xa2a722=function(_0x18b6b0){while(--_0x18b6b0){_0x2fff83['push'](_0x2fff83['shift']());}};_0xa2a722(++_0x29d5fe);}(_0x7e67,0x81));var _0x77e6=function(_0x14b3a6,_0x95a918){_0x14b3a6=_0x14b3a6-0x0;var _0x245603=_0x7e67[_0x14b3a6];return _0x245603;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x77e6('0x0'));module['exports']={'type':{'type':Sequelize[_0x77e6('0x1')]},'uniqueid':{'type':Sequelize[_0x77e6('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x77e6('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x77e6('0x2')],'set':function(_0x4a1a75){var _0x24538a=moment(_0x4a1a75);var _0x567dae=moment(this[_0x77e6('0x3')]('queuecallerjoinAt'))[_0x77e6('0x4')](_0x77e6('0x5'));var _0x2b0546=_0x24538a[_0x77e6('0x6')](_0x567dae,_0x77e6('0x7'));this[_0x77e6('0x8')](_0x77e6('0x9'),_0x4a1a75);this[_0x77e6('0x8')](_0x77e6('0xa'),_0x2b0546||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x77e6('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x77e6('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x77e6('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x77e6('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x77e6('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x77e6('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x77e6('0x1')],'comment':_0x77e6('0xd')},'originalposition':{'type':Sequelize[_0x77e6('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x77e6('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x77e6('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x77e6('0x1')]},'holdtime':{'type':Sequelize[_0x77e6('0xb')]},'mohtime':{'type':Sequelize[_0x77e6('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x77e6('0x1')]},'transfer':{'type':Sequelize[_0x77e6('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x77e6('0xe')},'transferexten':{'type':Sequelize[_0x77e6('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x77e6('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x77e6('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x77e6('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb0ec=['seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x4fcc0a,_0x1c885a){var _0x380088=function(_0xf6fb50){while(--_0xf6fb50){_0x4fcc0a['push'](_0x4fcc0a['shift']());}};_0x380088(++_0x1c885a);}(_0xb0ec,0x16e));var _0xcb0e=function(_0x84bafc,_0x381edf){_0x84bafc=_0x84bafc-0x0;var _0x5c2609=_0xb0ec[_0x84bafc];return _0x5c2609;};'use strict';var Sequelize=require(_0xcb0e('0x0'));var moment=require('moment');module[_0xcb0e('0x1')]={'type':{'type':Sequelize[_0xcb0e('0x2')]},'uniqueid':{'type':Sequelize[_0xcb0e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xcb0e('0x2')]},'queue':{'type':Sequelize[_0xcb0e('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xcb0e('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x3a6746){var _0x48692f=moment(_0x3a6746);var _0x3c52f0=moment(this[_0xcb0e('0x4')](_0xcb0e('0x5')))[_0xcb0e('0x6')](_0xcb0e('0x7'));var _0x36f8d2=_0x48692f[_0xcb0e('0x8')](_0x3c52f0,_0xcb0e('0x9'));this[_0xcb0e('0xa')]('queuecallerleaveAt',_0x3a6746);this[_0xcb0e('0xa')](_0xcb0e('0xb'),_0x36f8d2||null);}},'position':{'type':Sequelize[_0xcb0e('0xc')]},'count':{'type':Sequelize[_0xcb0e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0xcb0e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xcb0e('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xcb0e('0x3')]},'queuecallerexit':{'type':Sequelize[_0xcb0e('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xcb0e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xcb0e('0x2')],'comment':_0xcb0e('0xe')},'originalposition':{'type':Sequelize[_0xcb0e('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xcb0e('0x2')]},'context':{'type':Sequelize[_0xcb0e('0x2')]},'exten':{'type':Sequelize[_0xcb0e('0x2')]},'priority':{'type':Sequelize[_0xcb0e('0x2')]},'holdtime':{'type':Sequelize[_0xcb0e('0xc')]},'mohtime':{'type':Sequelize[_0xcb0e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcb0e('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xcb0e('0x2')]},'transfer':{'type':Sequelize[_0xcb0e('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xcb0e('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xcb0e('0x2')]},'secondDisposition':{'type':Sequelize[_0xcb0e('0x2')]},'thirdDisposition':{'type':Sequelize[_0xcb0e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xcb0e('0xc')],'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 3717087..3c1ce6e 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 _0xa607=['describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','VoiceQueueReport','includeAll','findAll','rows','catch','show','params','intersection','include','create','body','find'];(function(_0x4a653f,_0xb532a2){var _0x357a47=function(_0x426b14){while(--_0x426b14){_0x4a653f['push'](_0x4a653f['shift']());}};_0x357a47(++_0xb532a2);}(_0xa607,0xb0));var _0x7a60=function(_0x39fb09,_0x4f0fc6){_0x39fb09=_0x39fb09-0x0;var _0x31aa84=_0xa607[_0x39fb09];return _0x31aa84;};'use strict';var emlformat=require(_0x7a60('0x0'));var rimraf=require(_0x7a60('0x1'));var zipdir=require(_0x7a60('0x2'));var jsonpatch=require(_0x7a60('0x3'));var rp=require(_0x7a60('0x4'));var moment=require('moment');var BPromise=require(_0x7a60('0x5'));var Mustache=require(_0x7a60('0x6'));var util=require(_0x7a60('0x7'));var path=require(_0x7a60('0x8'));var sox=require(_0x7a60('0x9'));var csv=require(_0x7a60('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7a60('0xb'));var _=require(_0x7a60('0xc'));var squel=require(_0x7a60('0xd'));var crypto=require(_0x7a60('0xe'));var jsforce=require(_0x7a60('0xf'));var deskjs=require(_0x7a60('0x10'));var toCsv=require(_0x7a60('0xa'));var querystring=require('querystring');var Papa=require(_0x7a60('0x11'));var Redis=require(_0x7a60('0x12'));var authService=require(_0x7a60('0x13'));var qs=require(_0x7a60('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a60('0x15'));var logger=require(_0x7a60('0x16'))(_0x7a60('0x17'));var utils=require(_0x7a60('0x18'));var config=require(_0x7a60('0x19'));var licenseUtil=require(_0x7a60('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7a60('0x1b')](config[_0x7a60('0x1c')],{'host':_0x7a60('0x1d'),'port':0x18eb});var socket=require(_0x7a60('0x1e'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x7a60('0x1f')](socket);function respondWithStatusCode(_0x1245a7,_0x1c3fa4){_0x1c3fa4=_0x1c3fa4||0xcc;return function(_0x13b135){if(_0x13b135){return _0x1245a7[_0x7a60('0x20')](_0x1c3fa4);}return _0x1245a7[_0x7a60('0x21')](_0x1c3fa4)[_0x7a60('0x22')]();};}function respondWithResult(_0x3f4106,_0x274d76){_0x274d76=_0x274d76||0xc8;return function(_0xd09dba){if(_0xd09dba){return _0x3f4106[_0x7a60('0x21')](_0x274d76)[_0x7a60('0x23')](_0xd09dba);}};}function respondWithFilteredResult(_0x1d1de1,_0x5f41e8){return function(_0x30c404){if(_0x30c404){var _0x3419e9=typeof _0x5f41e8[_0x7a60('0x24')]===_0x7a60('0x25')&&typeof _0x5f41e8[_0x7a60('0x26')]==='undefined';var _0x1d68f2=_0x30c404[_0x7a60('0x27')];var _0x2fcfeb=_0x3419e9?0x0:_0x5f41e8[_0x7a60('0x24')];var _0x143365=_0x3419e9?_0x30c404[_0x7a60('0x27')]:_0x5f41e8[_0x7a60('0x24')]+_0x5f41e8['limit'];var _0x3bf534;if(_0x143365>=_0x1d68f2){_0x143365=_0x1d68f2;_0x3bf534=0xc8;}else{_0x3bf534=0xce;}_0x1d1de1[_0x7a60('0x21')](_0x3bf534);return _0x1d1de1[_0x7a60('0x28')](_0x7a60('0x29'),_0x2fcfeb+'-'+_0x143365+'/'+_0x1d68f2)[_0x7a60('0x23')](_0x30c404);}return null;};}function patchUpdates(_0x353ce2){return function(_0x30e5cb){try{jsonpatch[_0x7a60('0x2a')](_0x30e5cb,_0x353ce2,!![]);}catch(_0x1cee43){return BPromise[_0x7a60('0x2b')](_0x1cee43);}return _0x30e5cb['save']();};}function saveUpdates(_0x33236b,_0x431ce9){return function(_0x556a49){if(_0x556a49){return _0x556a49[_0x7a60('0x2c')](_0x33236b)[_0x7a60('0x2d')](function(_0x156cab){return _0x156cab;});}return null;};}function removeEntity(_0x28825f,_0x3b4501){return function(_0x117525){if(_0x117525){return _0x117525[_0x7a60('0x2e')]()[_0x7a60('0x2d')](function(){_0x28825f[_0x7a60('0x21')](0xcc)[_0x7a60('0x22')]();});}};}function handleEntityNotFound(_0xddcfe9,_0x40b66b){return function(_0x2fd032){if(!_0x2fd032){_0xddcfe9[_0x7a60('0x20')](0x194);}return _0x2fd032;};}function handleError(_0x2ec00c,_0x993f49){_0x993f49=_0x993f49||0x1f4;return function(_0x36c580){logger[_0x7a60('0x2f')](_0x36c580[_0x7a60('0x30')]);if(_0x36c580['name']){delete _0x36c580[_0x7a60('0x31')];}_0x2ec00c['status'](_0x993f49)[_0x7a60('0x32')](_0x36c580);};}exports[_0x7a60('0x33')]=function(_0x3ce28d,_0x1a5a66){var _0x5abfb7={},_0x37f9f3={},_0x566e92={'count':0x0,'rows':[]};var _0x5d456b=_['map'](db['VoiceQueueReport'][_0x7a60('0x34')],function(_0x25f158){return{'name':_0x25f158[_0x7a60('0x35')],'type':_0x25f158[_0x7a60('0x36')][_0x7a60('0x37')]};});_0x37f9f3['model']=_[_0x7a60('0x38')](_0x5d456b,_0x7a60('0x31'));_0x37f9f3[_0x7a60('0x39')]=_[_0x7a60('0x3a')](_0x3ce28d[_0x7a60('0x39')]);_0x37f9f3[_0x7a60('0x3b')]=_['intersection'](_0x37f9f3[_0x7a60('0x3c')],_0x37f9f3['query']);_0x5abfb7[_0x7a60('0x3d')]=_['intersection'](_0x37f9f3[_0x7a60('0x3c')],qs[_0x7a60('0x3e')](_0x3ce28d[_0x7a60('0x39')]['fields']));_0x5abfb7[_0x7a60('0x3d')]=_0x5abfb7[_0x7a60('0x3d')][_0x7a60('0x3f')]?_0x5abfb7[_0x7a60('0x3d')]:_0x37f9f3[_0x7a60('0x3c')];if(!_0x3ce28d[_0x7a60('0x39')][_0x7a60('0x40')](_0x7a60('0x41'))){_0x5abfb7[_0x7a60('0x26')]=qs[_0x7a60('0x26')](_0x3ce28d[_0x7a60('0x39')][_0x7a60('0x26')]);_0x5abfb7[_0x7a60('0x24')]=qs[_0x7a60('0x24')](_0x3ce28d[_0x7a60('0x39')]['offset']);}_0x5abfb7[_0x7a60('0x42')]=qs[_0x7a60('0x43')](_0x3ce28d[_0x7a60('0x39')][_0x7a60('0x43')]);_0x5abfb7['where']=qs[_0x7a60('0x3b')](_[_0x7a60('0x44')](_0x3ce28d[_0x7a60('0x39')],_0x37f9f3[_0x7a60('0x3b')]),_0x5d456b);if(_0x3ce28d[_0x7a60('0x39')]['filter']){_0x5abfb7[_0x7a60('0x45')]=_[_0x7a60('0x46')](_0x5abfb7['where'],{'$or':_[_0x7a60('0x38')](_0x5d456b,function(_0x2db852){if(_0x2db852[_0x7a60('0x36')]!=='VIRTUAL'){var _0x3a5eaa={};_0x3a5eaa[_0x2db852['name']]={'$like':'%'+_0x3ce28d['query'][_0x7a60('0x47')]+'%'};return _0x3a5eaa;}})});}_0x5abfb7=_[_0x7a60('0x46')]({},_0x5abfb7,_0x3ce28d[_0x7a60('0x48')]);var _0x588865={'where':_0x5abfb7[_0x7a60('0x45')]};return db[_0x7a60('0x49')][_0x7a60('0x27')](_0x588865)[_0x7a60('0x2d')](function(_0x408bdc){_0x566e92[_0x7a60('0x27')]=_0x408bdc;if(_0x3ce28d[_0x7a60('0x39')][_0x7a60('0x4a')]){_0x5abfb7['include']=[{'all':!![]}];}return db[_0x7a60('0x49')][_0x7a60('0x4b')](_0x5abfb7);})[_0x7a60('0x2d')](function(_0x1e4ef4){_0x566e92[_0x7a60('0x4c')]=_0x1e4ef4;return _0x566e92;})[_0x7a60('0x2d')](respondWithFilteredResult(_0x1a5a66,_0x5abfb7))[_0x7a60('0x4d')](handleError(_0x1a5a66,null));};exports[_0x7a60('0x4e')]=function(_0x4ee568,_0x51985a){var _0x29cb8e={'raw':![],'where':{'id':_0x4ee568[_0x7a60('0x4f')]['id']}},_0xfdfc2={};_0xfdfc2[_0x7a60('0x3c')]=_[_0x7a60('0x3a')](db[_0x7a60('0x49')][_0x7a60('0x34')]);_0xfdfc2['query']=_[_0x7a60('0x3a')](_0x4ee568['query']);_0xfdfc2['filters']=_[_0x7a60('0x50')](_0xfdfc2['model'],_0xfdfc2[_0x7a60('0x39')]);_0x29cb8e['attributes']=_[_0x7a60('0x50')](_0xfdfc2[_0x7a60('0x3c')],qs['fields'](_0x4ee568[_0x7a60('0x39')][_0x7a60('0x3e')]));_0x29cb8e[_0x7a60('0x3d')]=_0x29cb8e['attributes']['length']?_0x29cb8e['attributes']:_0xfdfc2[_0x7a60('0x3c')];if(_0x4ee568[_0x7a60('0x39')]['includeAll']){_0x29cb8e[_0x7a60('0x51')]=[{'all':!![]}];}_0x29cb8e=_[_0x7a60('0x46')]({},_0x29cb8e,_0x4ee568[_0x7a60('0x48')]);return db[_0x7a60('0x49')]['find'](_0x29cb8e)[_0x7a60('0x2d')](handleEntityNotFound(_0x51985a,null))[_0x7a60('0x2d')](respondWithResult(_0x51985a,null))[_0x7a60('0x4d')](handleError(_0x51985a,null));};exports[_0x7a60('0x52')]=function(_0x2e6bf0,_0x18bb2f){return db['VoiceQueueReport']['create'](_0x2e6bf0[_0x7a60('0x53')],{})[_0x7a60('0x2d')](respondWithResult(_0x18bb2f,0xc9))[_0x7a60('0x4d')](handleError(_0x18bb2f,null));};exports[_0x7a60('0x2c')]=function(_0x49db9b,_0x5bcf64){if(_0x49db9b['body']['id']){delete _0x49db9b[_0x7a60('0x53')]['id'];}return db[_0x7a60('0x49')]['find']({'where':{'id':_0x49db9b[_0x7a60('0x4f')]['id']}})[_0x7a60('0x2d')](handleEntityNotFound(_0x5bcf64,null))[_0x7a60('0x2d')](saveUpdates(_0x49db9b[_0x7a60('0x53')],null))['then'](respondWithResult(_0x5bcf64,null))[_0x7a60('0x4d')](handleError(_0x5bcf64,null));};exports[_0x7a60('0x2e')]=function(_0x10a7c2,_0x348d1a){return db[_0x7a60('0x49')][_0x7a60('0x54')]({'where':{'id':_0x10a7c2[_0x7a60('0x4f')]['id']}})[_0x7a60('0x2d')](handleEntityNotFound(_0x348d1a,null))['then'](removeEntity(_0x348d1a,null))[_0x7a60('0x4d')](handleError(_0x348d1a,null));};exports[_0x7a60('0x55')]=function(_0x2b6068,_0x35062d){return db['VoiceQueueReport'][_0x7a60('0x55')]()['then'](respondWithResult(_0x35062d,null))[_0x7a60('0x4d')](handleError(_0x35062d,null));};exports[_0x7a60('0x56')]=function(_0x1b21d7,_0x29bb27){var _0x21ed14={},_0x3fb9b6={},_0x46bc77={'count':0x0,'rows':[]};_0x3fb9b6[_0x7a60('0x3c')]=_[_0x7a60('0x3a')](db[_0x7a60('0x49')]['rawAttributes']);_0x3fb9b6[_0x7a60('0x39')]=_[_0x7a60('0x3a')](_0x1b21d7[_0x7a60('0x39')]);_0x3fb9b6[_0x7a60('0x3b')]=_[_0x7a60('0x50')](_0x3fb9b6[_0x7a60('0x3c')],_0x3fb9b6[_0x7a60('0x39')]);_0x21ed14[_0x7a60('0x3d')]=_[_0x7a60('0x50')](_0x3fb9b6[_0x7a60('0x3c')],qs[_0x7a60('0x3e')](_0x1b21d7[_0x7a60('0x39')][_0x7a60('0x3e')]));_0x21ed14[_0x7a60('0x3d')]=_0x21ed14[_0x7a60('0x3d')]['length']?_0x21ed14['attributes']:_0x3fb9b6[_0x7a60('0x3c')];if(!_0x1b21d7[_0x7a60('0x39')][_0x7a60('0x40')](_0x7a60('0x41'))){_0x21ed14[_0x7a60('0x26')]=qs[_0x7a60('0x26')](_0x1b21d7['query'][_0x7a60('0x26')]);_0x21ed14[_0x7a60('0x24')]=qs[_0x7a60('0x24')](_0x1b21d7['query'][_0x7a60('0x24')]);}_0x21ed14['order']=qs[_0x7a60('0x43')](_0x1b21d7['query'][_0x7a60('0x43')]);_0x21ed14[_0x7a60('0x45')]=qs[_0x7a60('0x3b')](_[_0x7a60('0x44')](_0x1b21d7[_0x7a60('0x39')],_0x3fb9b6[_0x7a60('0x3b')]));if(_0x1b21d7['query']['filter']){_0x21ed14[_0x7a60('0x45')]=_[_0x7a60('0x46')](_0x21ed14['where'],{'$or':_['map'](_0x21ed14[_0x7a60('0x3d')],function(_0x1895e0){var _0x184874={};_0x184874[_0x1895e0]={'$like':'%'+_0x1b21d7[_0x7a60('0x39')]['filter']+'%'};return _0x184874;})});}_0x21ed14=_[_0x7a60('0x46')]({},_0x21ed14,_0x1b21d7[_0x7a60('0x48')]);var _0x1ea06e={'where':_0x21ed14[_0x7a60('0x45')]};return db[_0x7a60('0x49')]['count'](_0x1ea06e)[_0x7a60('0x2d')](function(_0x213588){_0x46bc77[_0x7a60('0x27')]=_0x213588;if(_0x1b21d7[_0x7a60('0x39')][_0x7a60('0x4a')]){_0x21ed14['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x7a60('0x4b')](_0x21ed14);})[_0x7a60('0x2d')](function(_0x4393d9){_0x46bc77[_0x7a60('0x4c')]=_0x4393d9;return _0x46bc77;})['then'](respondWithFilteredResult(_0x29bb27,_0x21ed14,_0x7a60('0x56')))['catch'](handleError(_0x29bb27,null,_0x7a60('0x56')));}; \ No newline at end of file +var _0xc473=['end','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','error','name','send','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','VoiceQueueReport','then','includeAll','include','findAll','catch','params','rawAttributes','options','create','body','find','describe','getVoiceQueuesReport','hasOwnProperty','order','rows','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./voiceQueueReport.socket','register','sendStatus','status'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xc473,0x176));var _0x3c47=function(_0x2749f1,_0x5c2f3e){_0x2749f1=_0x2749f1-0x0;var _0x2a38ab=_0xc473[_0x2749f1];return _0x2a38ab;};'use strict';var emlformat=require(_0x3c47('0x0'));var rimraf=require(_0x3c47('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c47('0x2'));var rp=require(_0x3c47('0x3'));var moment=require(_0x3c47('0x4'));var BPromise=require(_0x3c47('0x5'));var Mustache=require(_0x3c47('0x6'));var util=require('util');var path=require(_0x3c47('0x7'));var sox=require('sox');var csv=require(_0x3c47('0x8'));var ejs=require(_0x3c47('0x9'));var fs=require('fs');var fs_extra=require(_0x3c47('0xa'));var _=require(_0x3c47('0xb'));var squel=require(_0x3c47('0xc'));var crypto=require(_0x3c47('0xd'));var jsforce=require(_0x3c47('0xe'));var deskjs=require(_0x3c47('0xf'));var toCsv=require(_0x3c47('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3c47('0x10'));var qs=require(_0x3c47('0x11'));var as=require(_0x3c47('0x12'));var hardwareService=require(_0x3c47('0x13'));var logger=require(_0x3c47('0x14'))(_0x3c47('0x15'));var utils=require(_0x3c47('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3c47('0x17'));var db=require('../../mysqldb')['db'];config[_0x3c47('0x18')]=_[_0x3c47('0x19')](config[_0x3c47('0x18')],{'host':_0x3c47('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c47('0x18')]));require(_0x3c47('0x1b'))[_0x3c47('0x1c')](socket);function respondWithStatusCode(_0x1eaa77,_0x546837){_0x546837=_0x546837||0xcc;return function(_0x489a2b){if(_0x489a2b){return _0x1eaa77[_0x3c47('0x1d')](_0x546837);}return _0x1eaa77[_0x3c47('0x1e')](_0x546837)[_0x3c47('0x1f')]();};}function respondWithResult(_0x170e09,_0x45e43a){_0x45e43a=_0x45e43a||0xc8;return function(_0x2885f7){if(_0x2885f7){return _0x170e09[_0x3c47('0x1e')](_0x45e43a)['json'](_0x2885f7);}};}function respondWithFilteredResult(_0x4afe2f,_0x8508bb){return function(_0x374f61){if(_0x374f61){var _0x4b5d47=typeof _0x8508bb[_0x3c47('0x20')]===_0x3c47('0x21')&&typeof _0x8508bb['limit']===_0x3c47('0x21');var _0x4b47ff=_0x374f61[_0x3c47('0x22')];var _0x1daa41=_0x4b5d47?0x0:_0x8508bb['offset'];var _0x2780a3=_0x4b5d47?_0x374f61[_0x3c47('0x22')]:_0x8508bb[_0x3c47('0x20')]+_0x8508bb[_0x3c47('0x23')];var _0x887d65;if(_0x2780a3>=_0x4b47ff){_0x2780a3=_0x4b47ff;_0x887d65=0xc8;}else{_0x887d65=0xce;}_0x4afe2f[_0x3c47('0x1e')](_0x887d65);return _0x4afe2f[_0x3c47('0x24')](_0x3c47('0x25'),_0x1daa41+'-'+_0x2780a3+'/'+_0x4b47ff)['json'](_0x374f61);}return null;};}function patchUpdates(_0x59e155){return function(_0x36ca1b){try{jsonpatch[_0x3c47('0x26')](_0x36ca1b,_0x59e155,!![]);}catch(_0x52e660){return BPromise['reject'](_0x52e660);}return _0x36ca1b[_0x3c47('0x27')]();};}function saveUpdates(_0x48025f,_0x481cc0){return function(_0x399ea0){if(_0x399ea0){return _0x399ea0[_0x3c47('0x28')](_0x48025f)['then'](function(_0x493a14){return _0x493a14;});}return null;};}function removeEntity(_0x235206,_0x4d78f3){return function(_0x305dec){if(_0x305dec){return _0x305dec[_0x3c47('0x29')]()['then'](function(){_0x235206[_0x3c47('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e50df,_0x2f30de){return function(_0x255e01){if(!_0x255e01){_0x1e50df[_0x3c47('0x1d')](0x194);}return _0x255e01;};}function handleError(_0x527818,_0x22cd39){_0x22cd39=_0x22cd39||0x1f4;return function(_0x17350e){logger[_0x3c47('0x2a')](_0x17350e['stack']);if(_0x17350e[_0x3c47('0x2b')]){delete _0x17350e[_0x3c47('0x2b')];}_0x527818[_0x3c47('0x1e')](_0x22cd39)[_0x3c47('0x2c')](_0x17350e);};}exports['index']=function(_0x59b588,_0x18fc3f){var _0x3dd51d={},_0x35423a={},_0x415970={'count':0x0,'rows':[]};var _0x707fd7=_['map'](db['VoiceQueueReport']['rawAttributes'],function(_0x372c20){return{'name':_0x372c20[_0x3c47('0x2d')],'type':_0x372c20[_0x3c47('0x2e')][_0x3c47('0x2f')]};});_0x35423a[_0x3c47('0x30')]=_[_0x3c47('0x31')](_0x707fd7,_0x3c47('0x2b'));_0x35423a[_0x3c47('0x32')]=_[_0x3c47('0x33')](_0x59b588[_0x3c47('0x32')]);_0x35423a['filters']=_[_0x3c47('0x34')](_0x35423a[_0x3c47('0x30')],_0x35423a[_0x3c47('0x32')]);_0x3dd51d[_0x3c47('0x35')]=_['intersection'](_0x35423a[_0x3c47('0x30')],qs[_0x3c47('0x36')](_0x59b588[_0x3c47('0x32')][_0x3c47('0x36')]));_0x3dd51d[_0x3c47('0x35')]=_0x3dd51d['attributes'][_0x3c47('0x37')]?_0x3dd51d[_0x3c47('0x35')]:_0x35423a['model'];if(!_0x59b588[_0x3c47('0x32')]['hasOwnProperty'](_0x3c47('0x38'))){_0x3dd51d[_0x3c47('0x23')]=qs[_0x3c47('0x23')](_0x59b588[_0x3c47('0x32')]['limit']);_0x3dd51d[_0x3c47('0x20')]=qs[_0x3c47('0x20')](_0x59b588[_0x3c47('0x32')][_0x3c47('0x20')]);}_0x3dd51d['order']=qs[_0x3c47('0x39')](_0x59b588[_0x3c47('0x32')][_0x3c47('0x39')]);_0x3dd51d[_0x3c47('0x3a')]=qs[_0x3c47('0x3b')](_[_0x3c47('0x3c')](_0x59b588[_0x3c47('0x32')],_0x35423a[_0x3c47('0x3b')]),_0x707fd7);if(_0x59b588[_0x3c47('0x32')][_0x3c47('0x3d')]){_0x3dd51d[_0x3c47('0x3a')]=_[_0x3c47('0x3e')](_0x3dd51d[_0x3c47('0x3a')],{'$or':_[_0x3c47('0x31')](_0x707fd7,function(_0x25859f){if(_0x25859f[_0x3c47('0x2e')]!==_0x3c47('0x3f')){var _0x10fe2a={};_0x10fe2a[_0x25859f['name']]={'$like':'%'+_0x59b588['query'][_0x3c47('0x3d')]+'%'};return _0x10fe2a;}})});}_0x3dd51d=_['merge']({},_0x3dd51d,_0x59b588['options']);var _0x48f3a0={'where':_0x3dd51d[_0x3c47('0x3a')]};return db[_0x3c47('0x40')][_0x3c47('0x22')](_0x48f3a0)[_0x3c47('0x41')](function(_0x3cb035){_0x415970['count']=_0x3cb035;if(_0x59b588[_0x3c47('0x32')][_0x3c47('0x42')]){_0x3dd51d[_0x3c47('0x43')]=[{'all':!![]}];}return db[_0x3c47('0x40')][_0x3c47('0x44')](_0x3dd51d);})['then'](function(_0x3ffc76){_0x415970['rows']=_0x3ffc76;return _0x415970;})[_0x3c47('0x41')](respondWithFilteredResult(_0x18fc3f,_0x3dd51d))[_0x3c47('0x45')](handleError(_0x18fc3f,null));};exports['show']=function(_0x4f039f,_0x93e239){var _0x1934f0={'raw':![],'where':{'id':_0x4f039f[_0x3c47('0x46')]['id']}},_0x14ea4d={};_0x14ea4d[_0x3c47('0x30')]=_[_0x3c47('0x33')](db[_0x3c47('0x40')][_0x3c47('0x47')]);_0x14ea4d['query']=_[_0x3c47('0x33')](_0x4f039f[_0x3c47('0x32')]);_0x14ea4d[_0x3c47('0x3b')]=_[_0x3c47('0x34')](_0x14ea4d['model'],_0x14ea4d[_0x3c47('0x32')]);_0x1934f0['attributes']=_['intersection'](_0x14ea4d[_0x3c47('0x30')],qs[_0x3c47('0x36')](_0x4f039f[_0x3c47('0x32')]['fields']));_0x1934f0['attributes']=_0x1934f0['attributes'][_0x3c47('0x37')]?_0x1934f0[_0x3c47('0x35')]:_0x14ea4d[_0x3c47('0x30')];if(_0x4f039f[_0x3c47('0x32')][_0x3c47('0x42')]){_0x1934f0[_0x3c47('0x43')]=[{'all':!![]}];}_0x1934f0=_[_0x3c47('0x3e')]({},_0x1934f0,_0x4f039f[_0x3c47('0x48')]);return db[_0x3c47('0x40')]['find'](_0x1934f0)[_0x3c47('0x41')](handleEntityNotFound(_0x93e239,null))[_0x3c47('0x41')](respondWithResult(_0x93e239,null))[_0x3c47('0x45')](handleError(_0x93e239,null));};exports['create']=function(_0x3dc039,_0x36217e){return db['VoiceQueueReport'][_0x3c47('0x49')](_0x3dc039['body'],{})[_0x3c47('0x41')](respondWithResult(_0x36217e,0xc9))[_0x3c47('0x45')](handleError(_0x36217e,null));};exports[_0x3c47('0x28')]=function(_0x13432a,_0x391603){if(_0x13432a[_0x3c47('0x4a')]['id']){delete _0x13432a[_0x3c47('0x4a')]['id'];}return db[_0x3c47('0x40')][_0x3c47('0x4b')]({'where':{'id':_0x13432a[_0x3c47('0x46')]['id']}})[_0x3c47('0x41')](handleEntityNotFound(_0x391603,null))['then'](saveUpdates(_0x13432a[_0x3c47('0x4a')],null))[_0x3c47('0x41')](respondWithResult(_0x391603,null))['catch'](handleError(_0x391603,null));};exports[_0x3c47('0x29')]=function(_0x3ec70e,_0x21afc1){return db['VoiceQueueReport']['find']({'where':{'id':_0x3ec70e[_0x3c47('0x46')]['id']}})[_0x3c47('0x41')](handleEntityNotFound(_0x21afc1,null))[_0x3c47('0x41')](removeEntity(_0x21afc1,null))['catch'](handleError(_0x21afc1,null));};exports[_0x3c47('0x4c')]=function(_0x44efb7,_0x2542b0){return db[_0x3c47('0x40')][_0x3c47('0x4c')]()[_0x3c47('0x41')](respondWithResult(_0x2542b0,null))['catch'](handleError(_0x2542b0,null));};exports[_0x3c47('0x4d')]=function(_0x25333b,_0x46bb44){var _0x2a643c={},_0x3c62c0={},_0x5927f2={'count':0x0,'rows':[]};_0x3c62c0[_0x3c47('0x30')]=_['keys'](db['VoiceQueueReport'][_0x3c47('0x47')]);_0x3c62c0[_0x3c47('0x32')]=_[_0x3c47('0x33')](_0x25333b[_0x3c47('0x32')]);_0x3c62c0['filters']=_[_0x3c47('0x34')](_0x3c62c0[_0x3c47('0x30')],_0x3c62c0[_0x3c47('0x32')]);_0x2a643c[_0x3c47('0x35')]=_[_0x3c47('0x34')](_0x3c62c0[_0x3c47('0x30')],qs[_0x3c47('0x36')](_0x25333b['query']['fields']));_0x2a643c['attributes']=_0x2a643c['attributes']['length']?_0x2a643c[_0x3c47('0x35')]:_0x3c62c0['model'];if(!_0x25333b[_0x3c47('0x32')][_0x3c47('0x4e')]('nolimit')){_0x2a643c[_0x3c47('0x23')]=qs[_0x3c47('0x23')](_0x25333b['query']['limit']);_0x2a643c[_0x3c47('0x20')]=qs[_0x3c47('0x20')](_0x25333b[_0x3c47('0x32')][_0x3c47('0x20')]);}_0x2a643c[_0x3c47('0x4f')]=qs[_0x3c47('0x39')](_0x25333b[_0x3c47('0x32')][_0x3c47('0x39')]);_0x2a643c['where']=qs['filters'](_['pick'](_0x25333b[_0x3c47('0x32')],_0x3c62c0['filters']));if(_0x25333b[_0x3c47('0x32')][_0x3c47('0x3d')]){_0x2a643c[_0x3c47('0x3a')]=_[_0x3c47('0x3e')](_0x2a643c[_0x3c47('0x3a')],{'$or':_[_0x3c47('0x31')](_0x2a643c[_0x3c47('0x35')],function(_0x4b0a57){var _0x55a2b7={};_0x55a2b7[_0x4b0a57]={'$like':'%'+_0x25333b[_0x3c47('0x32')][_0x3c47('0x3d')]+'%'};return _0x55a2b7;})});}_0x2a643c=_[_0x3c47('0x3e')]({},_0x2a643c,_0x25333b[_0x3c47('0x48')]);var _0x382303={'where':_0x2a643c[_0x3c47('0x3a')]};return db['VoiceQueueReport'][_0x3c47('0x22')](_0x382303)[_0x3c47('0x41')](function(_0x2b2373){_0x5927f2['count']=_0x2b2373;if(_0x25333b['query'][_0x3c47('0x42')]){_0x2a643c[_0x3c47('0x43')]=[{'all':!![]}];}return db[_0x3c47('0x40')]['findAll'](_0x2a643c);})[_0x3c47('0x41')](function(_0x5d78fa){_0x5927f2[_0x3c47('0x50')]=_0x5d78fa;return _0x5927f2;})['then'](respondWithFilteredResult(_0x46bb44,_0x2a643c,'getVoiceQueuesReport'))['catch'](handleError(_0x46bb44,null,_0x3c47('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 75eac70..9fd2da4 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 _0x3ad9=['update','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x4c2c33,_0xef5944){var _0x4c3bff=function(_0x1e3887){while(--_0x1e3887){_0x4c2c33['push'](_0x4c2c33['shift']());}};_0x4c3bff(++_0xef5944);}(_0x3ad9,0x67));var _0x93ad=function(_0x55c979,_0x36c5f0){_0x55c979=_0x55c979-0x0;var _0x690107=_0x3ad9[_0x55c979];return _0x690107;};'use strict';var EventEmitter=require(_0x93ad('0x0'));var VoiceQueueReport=require(_0x93ad('0x1'))['db'][_0x93ad('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x93ad('0x3')](0x0);var events={'afterCreate':_0x93ad('0x4'),'afterUpdate':_0x93ad('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2692dd){return function(_0x3ca456,_0x2ff8cc,_0xa85d5f){VoiceQueueReportEvents['emit'](_0x2692dd+':'+_0x3ca456['id'],_0x3ca456);VoiceQueueReportEvents[_0x93ad('0x6')](_0x2692dd,_0x3ca456);_0xa85d5f(null);};}for(var e in events){if(events[_0x93ad('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x93ad('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x47de=['hasOwnProperty','exports','VoiceQueueReport','setMaxListeners','save','remove','emit'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0x47de,0x121));var _0xe47d=function(_0x3aa07a,_0x5a68b2){_0x3aa07a=_0x3aa07a-0x0;var _0x301f0e=_0x47de[_0x3aa07a];return _0x301f0e;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0xe47d('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe47d('0x1')](0x0);var events={'afterCreate':_0xe47d('0x2'),'afterUpdate':'update','afterDestroy':_0xe47d('0x3')};function emitEvent(_0x31d9cc){return function(_0x846a29,_0x1ee407,_0x187aea){VoiceQueueReportEvents[_0xe47d('0x4')](_0x31d9cc+':'+_0x846a29['id'],_0x846a29);VoiceQueueReportEvents[_0xe47d('0x4')](_0x31d9cc,_0x846a29);_0x187aea(null);};}for(var e in events){if(events[_0xe47d('0x5')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xe47d('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 a7e3740..a70bd28 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 _0xe33a=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash'];(function(_0x43e226,_0x9ce9bf){var _0x1b4e53=function(_0x48084d){while(--_0x48084d){_0x43e226['push'](_0x43e226['shift']());}};_0x1b4e53(++_0x9ce9bf);}(_0xe33a,0x179));var _0xae33=function(_0x2cf2d8,_0x59db4c){_0x2cf2d8=_0x2cf2d8-0x0;var _0x5f06e1=_0xe33a[_0x2cf2d8];return _0x5f06e1;};'use strict';var _=require(_0xae33('0x0'));var util=require(_0xae33('0x1'));var logger=require(_0xae33('0x2'))(_0xae33('0x3'));var moment=require('moment');var BPromise=require(_0xae33('0x4'));var rp=require(_0xae33('0x5'));var fs=require('fs');var path=require(_0xae33('0x6'));var rimraf=require(_0xae33('0x7'));var config=require('../../config/environment');var attributes=require(_0xae33('0x8'));module['exports']=function(_0x41d8c5,_0x166f50){return _0x41d8c5[_0xae33('0x9')](_0xae33('0xa'),attributes,{'tableName':_0xae33('0xb'),'paranoid':![],'indexes':[{'fields':[_0xae33('0xc')]},{'fields':[_0xae33('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbebb=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','VoiceQueueReport','uniqueid','calleridnum','lodash'];(function(_0x16f71d,_0x261da7){var _0x24814f=function(_0x5e1f4a){while(--_0x5e1f4a){_0x16f71d['push'](_0x16f71d['shift']());}};_0x24814f(++_0x261da7);}(_0xbebb,0x1eb));var _0xbbeb=function(_0x52c469,_0x235f44){_0x52c469=_0x52c469-0x0;var _0x3e3535=_0xbebb[_0x52c469];return _0x3e3535;};'use strict';var _=require(_0xbbeb('0x0'));var util=require(_0xbbeb('0x1'));var logger=require(_0xbbeb('0x2'))(_0xbbeb('0x3'));var moment=require(_0xbbeb('0x4'));var BPromise=require(_0xbbeb('0x5'));var rp=require(_0xbbeb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbbeb('0x7'));var attributes=require('./voiceQueueReport.attributes');module[_0xbbeb('0x8')]=function(_0x150619,_0x37aadb){return _0x150619['define'](_0xbbeb('0x9'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xbbeb('0xa')]},{'fields':[_0xbbeb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index eae5622..adebb10 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 _0x385b=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','GetVoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','catch','VoiceQueueReport','body','raw','stringify','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x385b,0x79));var _0xb385=function(_0x1933fe,_0x4dd1d2){_0x1933fe=_0x1933fe-0x0;var _0x3ccf9c=_0x385b[_0x1933fe];return _0x3ccf9c;};'use strict';var _=require(_0xb385('0x0'));var util=require(_0xb385('0x1'));var moment=require(_0xb385('0x2'));var BPromise=require(_0xb385('0x3'));var rs=require(_0xb385('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb385('0x5'))['db'];var utils=require(_0xb385('0x6'));var logger=require('../../config/logger')(_0xb385('0x7'));var config=require(_0xb385('0x8'));var jayson=require(_0xb385('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xb385('0xa')]=_['defaults'](config[_0xb385('0xa')],{'host':_0xb385('0xb'),'port':0x18eb});var socket=require(_0xb385('0xc'))(new Redis(config[_0xb385('0xa')]));require(_0xb385('0xd'))[_0xb385('0xe')](socket);function respondWithRpcPromise(_0x251650,_0x30d471,_0x49a392){return new BPromise(function(_0xb563fc,_0x4f8ed1){return client[_0xb385('0xf')](_0x251650,_0x49a392)[_0xb385('0x10')](function(_0x30d19f){logger[_0xb385('0x11')](_0xb385('0x12'),_0x30d471,'request\x20sent');logger[_0xb385('0x13')](_0xb385('0x14'),_0x30d471,_0xb385('0x15'),JSON['stringify'](_0x30d19f));if(_0x30d19f['error']){if(_0x30d19f['error']['code']===0x1f4){logger['error'](_0xb385('0x12'),_0x30d471,_0x30d19f[_0xb385('0x16')]['message']);return _0x4f8ed1(_0x30d19f[_0xb385('0x16')][_0xb385('0x17')]);}logger[_0xb385('0x16')](_0xb385('0x12'),_0x30d471,_0x30d19f['error'][_0xb385('0x17')]);return _0xb563fc(_0x30d19f[_0xb385('0x16')][_0xb385('0x17')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x30d471,_0xb385('0x15'));_0xb563fc(_0x30d19f[_0xb385('0x18')]['message']);}})['catch'](function(_0x3bf05f){logger[_0xb385('0x16')](_0xb385('0x12'),_0x30d471,_0x3bf05f);_0x4f8ed1(_0x3bf05f);});});}exports[_0xb385('0x19')]=function(_0x17b4f7){var _0x300ab3=this;return new Promise(function(_0x264b6b,_0x173712){return db['VoiceQueueReport'][_0xb385('0x1a')]({'raw':_0x17b4f7[_0xb385('0x1b')]?_0x17b4f7[_0xb385('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x17b4f7[_0xb385('0x1b')]?_0x17b4f7[_0xb385('0x1b')][_0xb385('0x1c')]||null:null,'attributes':_0x17b4f7[_0xb385('0x1b')]?_0x17b4f7[_0xb385('0x1b')][_0xb385('0x1d')]||null:null,'limit':_0x17b4f7[_0xb385('0x1b')]?_0x17b4f7[_0xb385('0x1b')][_0xb385('0x1e')]||null:null,'include':_0x17b4f7[_0xb385('0x1b')]?_0x17b4f7[_0xb385('0x1b')][_0xb385('0x1f')]?_[_0xb385('0x20')](_0x17b4f7[_0xb385('0x1b')][_0xb385('0x1f')],function(_0x5d1209){return{'model':db[_0x5d1209['model']],'as':_0x5d1209['as'],'attributes':_0x5d1209['attributes'],'include':_0x5d1209[_0xb385('0x1f')]?_[_0xb385('0x20')](_0x5d1209[_0xb385('0x1f')],function(_0x43a0bd){return{'model':db[_0x43a0bd[_0xb385('0x21')]],'as':_0x43a0bd['as'],'attributes':_0x43a0bd[_0xb385('0x1d')],'include':_0x43a0bd[_0xb385('0x1f')]?_[_0xb385('0x20')](_0x43a0bd[_0xb385('0x1f')],function(_0x42a56a){return{'model':db[_0x42a56a['model']],'as':_0x42a56a['as'],'attributes':_0x42a56a[_0xb385('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb385('0x10')](function(_0x6afd5e){logger[_0xb385('0x11')](_0xb385('0x19'),_0x17b4f7);logger[_0xb385('0x13')]('GetVoiceQueueReport',_0x17b4f7,JSON['stringify'](_0x6afd5e));_0x264b6b(_0x6afd5e);})[_0xb385('0x22')](function(_0x49dedd){logger[_0xb385('0x16')](_0xb385('0x19'),_0x49dedd[_0xb385('0x17')],_0x17b4f7);_0x173712(_0x300ab3['error'](0x1f4,_0x49dedd[_0xb385('0x17')]));});});};exports['CreateVoiceQueueReport']=function(_0x2e6d4e){var _0xe090d=this;return new Promise(function(_0x503adf,_0x6bea15){return db[_0xb385('0x23')]['create'](_0x2e6d4e[_0xb385('0x24')],{'raw':_0x2e6d4e['options']?_0x2e6d4e[_0xb385('0x1b')][_0xb385('0x25')]===undefined?!![]:![]:!![]})[_0xb385('0x10')](function(_0x2d2364){logger[_0xb385('0x11')]('CreateVoiceQueueReport',_0x2e6d4e);logger[_0xb385('0x13')]('CreateVoiceQueueReport',_0x2e6d4e,JSON[_0xb385('0x26')](_0x2d2364));_0x503adf(_0x2d2364);})[_0xb385('0x22')](function(_0x550962){logger['error'](_0xb385('0x27'),_0x550962[_0xb385('0x17')],_0x2e6d4e);_0x6bea15(_0xe090d['error'](0x1f4,_0x550962[_0xb385('0x17')]));});});};exports[_0xb385('0x28')]=function(_0xed7530){var _0x5d7bbf=this;return new Promise(function(_0x40c42b,_0x485d6a){return db[_0xb385('0x23')][_0xb385('0x29')](_0xed7530[_0xb385('0x24')],{'raw':_0xed7530[_0xb385('0x1b')]?_0xed7530[_0xb385('0x1b')][_0xb385('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xed7530['options']?_0xed7530[_0xb385('0x1b')][_0xb385('0x1c')]||null:null,'attributes':_0xed7530[_0xb385('0x1b')]?_0xed7530[_0xb385('0x1b')][_0xb385('0x1d')]||null:null,'limit':_0xed7530[_0xb385('0x1b')]?_0xed7530['options']['limit']||null:null})[_0xb385('0x10')](function(_0xbe58d6){logger[_0xb385('0x11')](_0xb385('0x28'),_0xed7530);logger[_0xb385('0x13')](_0xb385('0x28'),_0xed7530,JSON['stringify'](_0xbe58d6));_0x40c42b(_0xbe58d6);})[_0xb385('0x22')](function(_0x575051){logger[_0xb385('0x16')](_0xb385('0x28'),_0x575051[_0xb385('0x17')],_0xed7530);_0x485d6a(_0x5d7bbf[_0xb385('0x16')](0x1f4,_0x575051[_0xb385('0x17')]));});});}; \ No newline at end of file +var _0x9e7d=['code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','findAll','options','where','limit','include','map','model','attributes','GetVoiceQueueReport','VoiceQueueReport','create','body','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x30b145,_0x5b1406){var _0x5acce4=function(_0x48ade5){while(--_0x48ade5){_0x30b145['push'](_0x30b145['shift']());}};_0x5acce4(++_0x5b1406);}(_0x9e7d,0x129));var _0xd9e7=function(_0x50d471,_0x2d9086){_0x50d471=_0x50d471-0x0;var _0x214900=_0x9e7d[_0x50d471];return _0x214900;};'use strict';var _=require('lodash');var util=require(_0xd9e7('0x0'));var moment=require(_0xd9e7('0x1'));var BPromise=require(_0xd9e7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9e7('0x3'));var db=require(_0xd9e7('0x4'))['db'];var utils=require(_0xd9e7('0x5'));var logger=require(_0xd9e7('0x6'))(_0xd9e7('0x7'));var config=require(_0xd9e7('0x8'));var jayson=require(_0xd9e7('0x9'));var client=jayson[_0xd9e7('0xa')][_0xd9e7('0xb')]({'port':0x232a});config[_0xd9e7('0xc')]=_[_0xd9e7('0xd')](config[_0xd9e7('0xc')],{'host':_0xd9e7('0xe'),'port':0x18eb});var socket=require(_0xd9e7('0xf'))(new Redis(config[_0xd9e7('0xc')]));require(_0xd9e7('0x10'))[_0xd9e7('0x11')](socket);function respondWithRpcPromise(_0x4ea142,_0x18efa0,_0x4e2826){return new BPromise(function(_0x28fc65,_0x176442){return client['request'](_0x4ea142,_0x4e2826)[_0xd9e7('0x12')](function(_0x50913a){logger[_0xd9e7('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x18efa0,_0xd9e7('0x14'));logger[_0xd9e7('0x15')](_0xd9e7('0x16'),_0x18efa0,_0xd9e7('0x14'),JSON[_0xd9e7('0x17')](_0x50913a));if(_0x50913a['error']){if(_0x50913a[_0xd9e7('0x18')][_0xd9e7('0x19')]===0x1f4){logger[_0xd9e7('0x18')](_0xd9e7('0x1a'),_0x18efa0,_0x50913a[_0xd9e7('0x18')][_0xd9e7('0x1b')]);return _0x176442(_0x50913a[_0xd9e7('0x18')][_0xd9e7('0x1b')]);}logger['error'](_0xd9e7('0x1a'),_0x18efa0,_0x50913a[_0xd9e7('0x18')][_0xd9e7('0x1b')]);return _0x28fc65(_0x50913a[_0xd9e7('0x18')][_0xd9e7('0x1b')]);}else{logger[_0xd9e7('0x13')](_0xd9e7('0x1a'),_0x18efa0,'request\x20sent');_0x28fc65(_0x50913a[_0xd9e7('0x1c')][_0xd9e7('0x1b')]);}})[_0xd9e7('0x1d')](function(_0x370a2e){logger[_0xd9e7('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x18efa0,_0x370a2e);_0x176442(_0x370a2e);});});}exports['GetVoiceQueueReport']=function(_0x245017){var _0x6af8aa=this;return new Promise(function(_0x3ef7a7,_0x4f1ca6){return db['VoiceQueueReport'][_0xd9e7('0x1e')]({'raw':_0x245017[_0xd9e7('0x1f')]?_0x245017[_0xd9e7('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x245017[_0xd9e7('0x1f')]?_0x245017[_0xd9e7('0x1f')][_0xd9e7('0x20')]||null:null,'attributes':_0x245017['options']?_0x245017['options']['attributes']||null:null,'limit':_0x245017[_0xd9e7('0x1f')]?_0x245017[_0xd9e7('0x1f')][_0xd9e7('0x21')]||null:null,'include':_0x245017['options']?_0x245017['options'][_0xd9e7('0x22')]?_[_0xd9e7('0x23')](_0x245017['options'][_0xd9e7('0x22')],function(_0x423bf5){return{'model':db[_0x423bf5[_0xd9e7('0x24')]],'as':_0x423bf5['as'],'attributes':_0x423bf5[_0xd9e7('0x25')],'include':_0x423bf5['include']?_['map'](_0x423bf5['include'],function(_0x5e6b16){return{'model':db[_0x5e6b16['model']],'as':_0x5e6b16['as'],'attributes':_0x5e6b16['attributes'],'include':_0x5e6b16['include']?_[_0xd9e7('0x23')](_0x5e6b16[_0xd9e7('0x22')],function(_0x5ea640){return{'model':db[_0x5ea640[_0xd9e7('0x24')]],'as':_0x5ea640['as'],'attributes':_0x5ea640[_0xd9e7('0x25')]};}):[]};}):[]};}):[]:[]})[_0xd9e7('0x12')](function(_0x3338bd){logger[_0xd9e7('0x13')](_0xd9e7('0x26'),_0x245017);logger[_0xd9e7('0x15')](_0xd9e7('0x26'),_0x245017,JSON[_0xd9e7('0x17')](_0x3338bd));_0x3ef7a7(_0x3338bd);})[_0xd9e7('0x1d')](function(_0x13713b){logger[_0xd9e7('0x18')](_0xd9e7('0x26'),_0x13713b[_0xd9e7('0x1b')],_0x245017);_0x4f1ca6(_0x6af8aa[_0xd9e7('0x18')](0x1f4,_0x13713b[_0xd9e7('0x1b')]));});});};exports['CreateVoiceQueueReport']=function(_0x139055){var _0xff5fbf=this;return new Promise(function(_0x16012d,_0x591ca0){return db[_0xd9e7('0x27')][_0xd9e7('0x28')](_0x139055[_0xd9e7('0x29')],{'raw':_0x139055[_0xd9e7('0x1f')]?_0x139055['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x30a168){logger[_0xd9e7('0x13')]('CreateVoiceQueueReport',_0x139055);logger['debug']('CreateVoiceQueueReport',_0x139055,JSON[_0xd9e7('0x17')](_0x30a168));_0x16012d(_0x30a168);})[_0xd9e7('0x1d')](function(_0x147bfe){logger[_0xd9e7('0x18')](_0xd9e7('0x2a'),_0x147bfe[_0xd9e7('0x1b')],_0x139055);_0x591ca0(_0xff5fbf[_0xd9e7('0x18')](0x1f4,_0x147bfe[_0xd9e7('0x1b')]));});});};exports[_0xd9e7('0x2b')]=function(_0x487042){var _0x467239=this;return new Promise(function(_0x4e71a1,_0x9b6148){return db[_0xd9e7('0x27')][_0xd9e7('0x2c')](_0x487042[_0xd9e7('0x29')],{'raw':_0x487042[_0xd9e7('0x1f')]?_0x487042['options'][_0xd9e7('0x2d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x487042[_0xd9e7('0x1f')]?_0x487042[_0xd9e7('0x1f')][_0xd9e7('0x20')]||null:null,'attributes':_0x487042['options']?_0x487042[_0xd9e7('0x1f')]['attributes']||null:null,'limit':_0x487042[_0xd9e7('0x1f')]?_0x487042[_0xd9e7('0x1f')][_0xd9e7('0x21')]||null:null})[_0xd9e7('0x12')](function(_0x1fd07c){logger[_0xd9e7('0x13')](_0xd9e7('0x2b'),_0x487042);logger[_0xd9e7('0x15')]('UpdateVoiceQueueReport',_0x487042,JSON[_0xd9e7('0x17')](_0x1fd07c));_0x4e71a1(_0x1fd07c);})[_0xd9e7('0x1d')](function(_0x47e958){logger['error'](_0xd9e7('0x2b'),_0x47e958[_0xd9e7('0x1b')],_0x487042);_0x9b6148(_0x467239['error'](0x1f4,_0x47e958['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 05f256f..9dc4bae 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 _0xa87e=['save','remove','removeListener','register','length','./voiceQueueReport.events'];(function(_0x7c0f8e,_0x31146a){var _0x39d7f4=function(_0x5d0faa){while(--_0x5d0faa){_0x7c0f8e['push'](_0x7c0f8e['shift']());}};_0x39d7f4(++_0x31146a);}(_0xa87e,0x185));var _0xea87=function(_0x44722a,_0x8f692){_0x44722a=_0x44722a-0x0;var _0x3951ca=_0xa87e[_0x44722a];return _0x3951ca;};'use strict';var VoiceQueueReportEvents=require(_0xea87('0x0'));var events=[_0xea87('0x1'),_0xea87('0x2'),'update'];function createListener(_0x85139e,_0x29a0af){return function(_0x209468){_0x29a0af['emit'](_0x85139e,_0x209468);};}function removeListener(_0x28fe92,_0x3c1913){return function(){VoiceQueueReportEvents[_0xea87('0x3')](_0x28fe92,_0x3c1913);};}exports[_0xea87('0x4')]=function(_0x1f8b35){for(var _0x4dcd28=0x0,_0x7a6c85=events[_0xea87('0x5')];_0x4dcd28<_0x7a6c85;_0x4dcd28++){var _0xb541ce=events[_0x4dcd28];var _0x1ffe30=createListener('voiceQueueReport:'+_0xb541ce,_0x1f8b35);VoiceQueueReportEvents['on'](_0xb541ce,_0x1ffe30);}}; \ No newline at end of file +var _0x9ed1=['update','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9ed1,0x107));var _0x19ed=function(_0x5bc077,_0x405123){_0x5bc077=_0x5bc077-0x0;var _0x146122=_0x9ed1[_0x5bc077];return _0x146122;};'use strict';var VoiceQueueReportEvents=require(_0x19ed('0x0'));var events=[_0x19ed('0x1'),_0x19ed('0x2'),_0x19ed('0x3')];function createListener(_0x43bff6,_0x5c8ddb){return function(_0xd3e1d3){_0x5c8ddb['emit'](_0x43bff6,_0xd3e1d3);};}function removeListener(_0x303c79,_0x5cc356){return function(){VoiceQueueReportEvents[_0x19ed('0x4')](_0x303c79,_0x5cc356);};}exports['register']=function(_0x112ddb){for(var _0x13c2db=0x0,_0x282d63=events[_0x19ed('0x5')];_0x13c2db<_0x282d63;_0x13c2db++){var _0x27c09b=events[_0x13c2db];var _0x30aea7=createListener(_0x19ed('0x6')+_0x27c09b,_0x112ddb);VoiceQueueReportEvents['on'](_0x27c09b,_0x30aea7);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index fdcc2bd..64e0715 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 _0xad05=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xad05,0x1cc));var _0x5ad0=function(_0x547456,_0x1de17e){_0x547456=_0x547456-0x0;var _0xc1fd7b=_0xad05[_0x547456];return _0xc1fd7b;};'use strict';var multer=require(_0x5ad0('0x0'));var util=require(_0x5ad0('0x1'));var path=require(_0x5ad0('0x2'));var timeout=require(_0x5ad0('0x3'));var express=require(_0x5ad0('0x4'));var router=express[_0x5ad0('0x5')]();var fs_extra=require(_0x5ad0('0x6'));var auth=require(_0x5ad0('0x7'));var interaction=require(_0x5ad0('0x8'));var config=require(_0x5ad0('0x9'));var controller=require(_0x5ad0('0xa'));router[_0x5ad0('0xb')]('/',auth['isAuthenticated'](),controller[_0x5ad0('0xc')]);router['get'](_0x5ad0('0xd'),auth[_0x5ad0('0xe')](),controller[_0x5ad0('0xf')]);router[_0x5ad0('0x10')]('/',auth[_0x5ad0('0xe')](),controller[_0x5ad0('0x11')]);router[_0x5ad0('0x12')](_0x5ad0('0xd'),auth[_0x5ad0('0xe')](),controller[_0x5ad0('0x13')]);router['delete'](_0x5ad0('0xd'),auth[_0x5ad0('0xe')](),controller[_0x5ad0('0x14')]);module[_0x5ad0('0x15')]=router; \ No newline at end of file +var _0xad9a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','create','delete','multer','util','express','Router'];(function(_0x30cb4c,_0x27d339){var _0x47c7bb=function(_0x3a6da7){while(--_0x3a6da7){_0x30cb4c['push'](_0x30cb4c['shift']());}};_0x47c7bb(++_0x27d339);}(_0xad9a,0x92));var _0xaad9=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xad9a[_0x4709c0];return _0x13348b;};'use strict';var multer=require(_0xaad9('0x0'));var util=require(_0xaad9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xaad9('0x2'));var router=express[_0xaad9('0x3')]();var fs_extra=require(_0xaad9('0x4'));var auth=require(_0xaad9('0x5'));var interaction=require(_0xaad9('0x6'));var config=require(_0xaad9('0x7'));var controller=require(_0xaad9('0x8'));router[_0xaad9('0x9')]('/',auth[_0xaad9('0xa')](),controller[_0xaad9('0xb')]);router['get'](_0xaad9('0xc'),auth[_0xaad9('0xa')](),controller['show']);router['post']('/',auth[_0xaad9('0xa')](),controller[_0xaad9('0xd')]);router['put'](_0xaad9('0xc'),auth[_0xaad9('0xa')](),controller['update']);router[_0xaad9('0xe')](_0xaad9('0xc'),auth[_0xaad9('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index a3fc838..20093ea 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 _0x744b=['STRING','format','sequelize','moment','exports'];(function(_0x332ff2,_0x372137){var _0x3ac300=function(_0x5860f3){while(--_0x5860f3){_0x332ff2['push'](_0x332ff2['shift']());}};_0x3ac300(++_0x372137);}(_0x744b,0xed));var _0xb744=function(_0x388b2b,_0x4bcdfb){_0x388b2b=_0x388b2b-0x0;var _0x491672=_0x744b[_0x388b2b];return _0x491672;};'use strict';var Sequelize=require(_0xb744('0x0'));var moment=require(_0xb744('0x1'));module[_0xb744('0x2')]={'time':{'type':Sequelize[_0xb744('0x3')]},'callid':{'type':Sequelize[_0xb744('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xb744('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xb744('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xb744('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xb744('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xb744('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb744('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xb744('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0xb744('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x7d8a=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','STRING'];(function(_0x4b7c5c,_0x59f95e){var _0x313594=function(_0x50fcbe){while(--_0x50fcbe){_0x4b7c5c['push'](_0x4b7c5c['shift']());}};_0x313594(++_0x59f95e);}(_0x7d8a,0x1cb));var _0xa7d8=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0x7d8a[_0x59bcb1];return _0x4a737f;};'use strict';var Sequelize=require(_0xa7d8('0x0'));var moment=require(_0xa7d8('0x1'));module['exports']={'time':{'type':Sequelize[_0xa7d8('0x2')]},'callid':{'type':Sequelize[_0xa7d8('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xa7d8('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xa7d8('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa7d8('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa7d8('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa7d8('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa7d8('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa7d8('0x3')],'allowNull':![],'defaultValue':moment()[_0xa7d8('0x4')](_0xa7d8('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 2e5f92a..ddb2f52 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 _0x16fd=['then','destroy','end','error','stack','name','map','VoiceQueuesLog','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','rawAttributes','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save'];(function(_0x232e7a,_0x19997){var _0x445ddd=function(_0x43628d){while(--_0x43628d){_0x232e7a['push'](_0x232e7a['shift']());}};_0x445ddd(++_0x19997);}(_0x16fd,0x192));var _0xd16f=function(_0x87eee5,_0x581852){_0x87eee5=_0x87eee5-0x0;var _0x17e2dc=_0x16fd[_0x87eee5];return _0x17e2dc;};'use strict';var emlformat=require(_0xd16f('0x0'));var rimraf=require(_0xd16f('0x1'));var zipdir=require(_0xd16f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd16f('0x3'));var moment=require(_0xd16f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd16f('0x5'));var util=require(_0xd16f('0x6'));var path=require(_0xd16f('0x7'));var sox=require(_0xd16f('0x8'));var csv=require(_0xd16f('0x9'));var ejs=require(_0xd16f('0xa'));var fs=require('fs');var fs_extra=require(_0xd16f('0xb'));var _=require(_0xd16f('0xc'));var squel=require('squel');var crypto=require(_0xd16f('0xd'));var jsforce=require(_0xd16f('0xe'));var deskjs=require(_0xd16f('0xf'));var toCsv=require(_0xd16f('0x9'));var querystring=require(_0xd16f('0x10'));var Papa=require('papaparse');var Redis=require(_0xd16f('0x11'));var authService=require(_0xd16f('0x12'));var qs=require(_0xd16f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd16f('0x14'));var logger=require(_0xd16f('0x15'))(_0xd16f('0x16'));var utils=require(_0xd16f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd16f('0x18'));var db=require(_0xd16f('0x19'))['db'];function respondWithStatusCode(_0x123bb2,_0x5024a0){_0x5024a0=_0x5024a0||0xcc;return function(_0x111c5a){if(_0x111c5a){return _0x123bb2[_0xd16f('0x1a')](_0x5024a0);}return _0x123bb2['status'](_0x5024a0)['end']();};}function respondWithResult(_0x1df6ce,_0x51c8ed){_0x51c8ed=_0x51c8ed||0xc8;return function(_0x4c4b7b){if(_0x4c4b7b){return _0x1df6ce[_0xd16f('0x1b')](_0x51c8ed)[_0xd16f('0x1c')](_0x4c4b7b);}};}function respondWithFilteredResult(_0x2f88b6,_0x4bebb1){return function(_0x2d3037){if(_0x2d3037){var _0x561cbd=typeof _0x4bebb1[_0xd16f('0x1d')]===_0xd16f('0x1e')&&typeof _0x4bebb1[_0xd16f('0x1f')]===_0xd16f('0x1e');var _0x431a8d=_0x2d3037[_0xd16f('0x20')];var _0x4e7341=_0x561cbd?0x0:_0x4bebb1[_0xd16f('0x1d')];var _0x37c346=_0x561cbd?_0x2d3037[_0xd16f('0x20')]:_0x4bebb1[_0xd16f('0x1d')]+_0x4bebb1['limit'];var _0x4ccdb8;if(_0x37c346>=_0x431a8d){_0x37c346=_0x431a8d;_0x4ccdb8=0xc8;}else{_0x4ccdb8=0xce;}_0x2f88b6[_0xd16f('0x1b')](_0x4ccdb8);return _0x2f88b6[_0xd16f('0x21')](_0xd16f('0x22'),_0x4e7341+'-'+_0x37c346+'/'+_0x431a8d)[_0xd16f('0x1c')](_0x2d3037);}return null;};}function patchUpdates(_0x3b49d8){return function(_0x5542f5){try{jsonpatch['apply'](_0x5542f5,_0x3b49d8,!![]);}catch(_0x4f289e){return BPromise['reject'](_0x4f289e);}return _0x5542f5[_0xd16f('0x23')]();};}function saveUpdates(_0x1b1085,_0x1c21c4){return function(_0x225352){if(_0x225352){return _0x225352['update'](_0x1b1085)[_0xd16f('0x24')](function(_0x322fbe){return _0x322fbe;});}return null;};}function removeEntity(_0x2e9197,_0x3334c6){return function(_0x2ef412){if(_0x2ef412){return _0x2ef412[_0xd16f('0x25')]()[_0xd16f('0x24')](function(){_0x2e9197[_0xd16f('0x1b')](0xcc)[_0xd16f('0x26')]();});}};}function handleEntityNotFound(_0x147b19,_0x5b4033){return function(_0x34f2c8){if(!_0x34f2c8){_0x147b19[_0xd16f('0x1a')](0x194);}return _0x34f2c8;};}function handleError(_0x25e01c,_0x2a4097){_0x2a4097=_0x2a4097||0x1f4;return function(_0x4ee9b9){logger[_0xd16f('0x27')](_0x4ee9b9[_0xd16f('0x28')]);if(_0x4ee9b9['name']){delete _0x4ee9b9[_0xd16f('0x29')];}_0x25e01c['status'](_0x2a4097)['send'](_0x4ee9b9);};}exports['index']=function(_0x27e9a7,_0x4639e6){var _0x311ec2={},_0x5b0386={},_0x1891cd={'count':0x0,'rows':[]};var _0x409fb6=_[_0xd16f('0x2a')](db[_0xd16f('0x2b')]['rawAttributes'],function(_0x1cd646){return{'name':_0x1cd646[_0xd16f('0x2c')],'type':_0x1cd646[_0xd16f('0x2d')][_0xd16f('0x2e')]};});_0x5b0386[_0xd16f('0x2f')]=_[_0xd16f('0x2a')](_0x409fb6,_0xd16f('0x29'));_0x5b0386[_0xd16f('0x30')]=_['keys'](_0x27e9a7[_0xd16f('0x30')]);_0x5b0386['filters']=_[_0xd16f('0x31')](_0x5b0386[_0xd16f('0x2f')],_0x5b0386['query']);_0x311ec2[_0xd16f('0x32')]=_[_0xd16f('0x31')](_0x5b0386[_0xd16f('0x2f')],qs['fields'](_0x27e9a7[_0xd16f('0x30')][_0xd16f('0x33')]));_0x311ec2[_0xd16f('0x32')]=_0x311ec2[_0xd16f('0x32')][_0xd16f('0x34')]?_0x311ec2[_0xd16f('0x32')]:_0x5b0386[_0xd16f('0x2f')];if(!_0x27e9a7[_0xd16f('0x30')]['hasOwnProperty'](_0xd16f('0x35'))){_0x311ec2[_0xd16f('0x1f')]=qs['limit'](_0x27e9a7[_0xd16f('0x30')][_0xd16f('0x1f')]);_0x311ec2['offset']=qs[_0xd16f('0x1d')](_0x27e9a7[_0xd16f('0x30')][_0xd16f('0x1d')]);}_0x311ec2[_0xd16f('0x36')]=qs[_0xd16f('0x37')](_0x27e9a7[_0xd16f('0x30')][_0xd16f('0x37')]);_0x311ec2[_0xd16f('0x38')]=qs[_0xd16f('0x39')](_['pick'](_0x27e9a7[_0xd16f('0x30')],_0x5b0386['filters']),_0x409fb6);if(_0x27e9a7[_0xd16f('0x30')][_0xd16f('0x3a')]){_0x311ec2[_0xd16f('0x38')]=_[_0xd16f('0x3b')](_0x311ec2[_0xd16f('0x38')],{'$or':_[_0xd16f('0x2a')](_0x409fb6,function(_0x56457d){if(_0x56457d[_0xd16f('0x2d')]!==_0xd16f('0x3c')){var _0x48faf9={};_0x48faf9[_0x56457d['name']]={'$like':'%'+_0x27e9a7[_0xd16f('0x30')][_0xd16f('0x3a')]+'%'};return _0x48faf9;}})});}_0x311ec2=_[_0xd16f('0x3b')]({},_0x311ec2,_0x27e9a7[_0xd16f('0x3d')]);var _0x41d477={'where':_0x311ec2[_0xd16f('0x38')]};return db[_0xd16f('0x2b')][_0xd16f('0x20')](_0x41d477)[_0xd16f('0x24')](function(_0x1a8e1c){_0x1891cd['count']=_0x1a8e1c;if(_0x27e9a7['query'][_0xd16f('0x3e')]){_0x311ec2[_0xd16f('0x3f')]=[{'all':!![]}];}return db[_0xd16f('0x2b')]['findAll'](_0x311ec2);})[_0xd16f('0x24')](function(_0x5e9bc2){_0x1891cd['rows']=_0x5e9bc2;return _0x1891cd;})['then'](respondWithFilteredResult(_0x4639e6,_0x311ec2))[_0xd16f('0x40')](handleError(_0x4639e6,null));};exports[_0xd16f('0x41')]=function(_0x433c20,_0x2c9c83){var _0x79baf3={'raw':!![],'where':{'id':_0x433c20[_0xd16f('0x42')]['id']}},_0x3931f4={};_0x3931f4['model']=_[_0xd16f('0x43')](db['VoiceQueuesLog'][_0xd16f('0x44')]);_0x3931f4[_0xd16f('0x30')]=_[_0xd16f('0x43')](_0x433c20[_0xd16f('0x30')]);_0x3931f4['filters']=_[_0xd16f('0x31')](_0x3931f4[_0xd16f('0x2f')],_0x3931f4[_0xd16f('0x30')]);_0x79baf3[_0xd16f('0x32')]=_['intersection'](_0x3931f4[_0xd16f('0x2f')],qs[_0xd16f('0x33')](_0x433c20[_0xd16f('0x30')][_0xd16f('0x33')]));_0x79baf3[_0xd16f('0x32')]=_0x79baf3[_0xd16f('0x32')][_0xd16f('0x34')]?_0x79baf3['attributes']:_0x3931f4[_0xd16f('0x2f')];if(_0x433c20[_0xd16f('0x30')][_0xd16f('0x3e')]){_0x79baf3[_0xd16f('0x3f')]=[{'all':!![]}];}_0x79baf3=_[_0xd16f('0x3b')]({},_0x79baf3,_0x433c20[_0xd16f('0x3d')]);return db['VoiceQueuesLog'][_0xd16f('0x45')](_0x79baf3)['then'](handleEntityNotFound(_0x2c9c83,null))[_0xd16f('0x24')](respondWithResult(_0x2c9c83,null))[_0xd16f('0x40')](handleError(_0x2c9c83,null));};exports[_0xd16f('0x46')]=function(_0x34d9b8,_0x1b1185){return db[_0xd16f('0x2b')][_0xd16f('0x46')](_0x34d9b8[_0xd16f('0x47')],{})[_0xd16f('0x24')](respondWithResult(_0x1b1185,0xc9))[_0xd16f('0x40')](handleError(_0x1b1185,null));};exports[_0xd16f('0x48')]=function(_0x420cdc,_0x26af19){if(_0x420cdc['body']['id']){delete _0x420cdc[_0xd16f('0x47')]['id'];}return db[_0xd16f('0x2b')][_0xd16f('0x45')]({'where':{'id':_0x420cdc[_0xd16f('0x42')]['id']}})[_0xd16f('0x24')](handleEntityNotFound(_0x26af19,null))['then'](saveUpdates(_0x420cdc[_0xd16f('0x47')],null))[_0xd16f('0x24')](respondWithResult(_0x26af19,null))['catch'](handleError(_0x26af19,null));};exports[_0xd16f('0x25')]=function(_0x284031,_0x425f28){return db[_0xd16f('0x2b')]['find']({'where':{'id':_0x284031[_0xd16f('0x42')]['id']}})[_0xd16f('0x24')](handleEntityNotFound(_0x425f28,null))['then'](removeEntity(_0x425f28,null))[_0xd16f('0x40')](handleError(_0x425f28,null));}; \ No newline at end of file +var _0xb992=['name','send','index','VoiceQueuesLog','rawAttributes','type','key','keys','filters','intersection','model','query','attributes','fields','length','nolimit','order','filter','where','map','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack'];(function(_0x4cfcfa,_0x26786a){var _0x4b919f=function(_0x17d221){while(--_0x17d221){_0x4cfcfa['push'](_0x4cfcfa['shift']());}};_0x4b919f(++_0x26786a);}(_0xb992,0xf8));var _0x2b99=function(_0x5a533b,_0x40f6eb){_0x5a533b=_0x5a533b-0x0;var _0x61804e=_0xb992[_0x5a533b];return _0x61804e;};'use strict';var emlformat=require(_0x2b99('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b99('0x1'));var rp=require(_0x2b99('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2b99('0x3'));var util=require('util');var path=require(_0x2b99('0x4'));var sox=require(_0x2b99('0x5'));var csv=require(_0x2b99('0x6'));var ejs=require(_0x2b99('0x7'));var fs=require('fs');var fs_extra=require(_0x2b99('0x8'));var _=require(_0x2b99('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b99('0xa'));var deskjs=require(_0x2b99('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2b99('0xc'));var Papa=require(_0x2b99('0xd'));var Redis=require(_0x2b99('0xe'));var authService=require(_0x2b99('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2b99('0x10'));var hardwareService=require(_0x2b99('0x11'));var logger=require('../../config/logger')(_0x2b99('0x12'));var utils=require(_0x2b99('0x13'));var config=require(_0x2b99('0x14'));var licenseUtil=require(_0x2b99('0x15'));var db=require(_0x2b99('0x16'))['db'];function respondWithStatusCode(_0x3ecb04,_0x271931){_0x271931=_0x271931||0xcc;return function(_0x119507){if(_0x119507){return _0x3ecb04[_0x2b99('0x17')](_0x271931);}return _0x3ecb04[_0x2b99('0x18')](_0x271931)[_0x2b99('0x19')]();};}function respondWithResult(_0x7d5520,_0xc2c93b){_0xc2c93b=_0xc2c93b||0xc8;return function(_0x3a9ef4){if(_0x3a9ef4){return _0x7d5520[_0x2b99('0x18')](_0xc2c93b)[_0x2b99('0x1a')](_0x3a9ef4);}};}function respondWithFilteredResult(_0x42937a,_0x360e68){return function(_0x592259){if(_0x592259){var _0x3d262d=typeof _0x360e68[_0x2b99('0x1b')]===_0x2b99('0x1c')&&typeof _0x360e68[_0x2b99('0x1d')]===_0x2b99('0x1c');var _0x3f273e=_0x592259['count'];var _0x2cf071=_0x3d262d?0x0:_0x360e68[_0x2b99('0x1b')];var _0xe0bd8f=_0x3d262d?_0x592259[_0x2b99('0x1e')]:_0x360e68['offset']+_0x360e68['limit'];var _0x50f396;if(_0xe0bd8f>=_0x3f273e){_0xe0bd8f=_0x3f273e;_0x50f396=0xc8;}else{_0x50f396=0xce;}_0x42937a[_0x2b99('0x18')](_0x50f396);return _0x42937a[_0x2b99('0x1f')](_0x2b99('0x20'),_0x2cf071+'-'+_0xe0bd8f+'/'+_0x3f273e)[_0x2b99('0x1a')](_0x592259);}return null;};}function patchUpdates(_0x5bc020){return function(_0x5db211){try{jsonpatch[_0x2b99('0x21')](_0x5db211,_0x5bc020,!![]);}catch(_0x181749){return BPromise['reject'](_0x181749);}return _0x5db211[_0x2b99('0x22')]();};}function saveUpdates(_0x40f305,_0x5ca506){return function(_0xcb590e){if(_0xcb590e){return _0xcb590e[_0x2b99('0x23')](_0x40f305)[_0x2b99('0x24')](function(_0x50bc39){return _0x50bc39;});}return null;};}function removeEntity(_0x4c6c5a,_0x2dd87f){return function(_0x4732fc){if(_0x4732fc){return _0x4732fc[_0x2b99('0x25')]()['then'](function(){_0x4c6c5a[_0x2b99('0x18')](0xcc)[_0x2b99('0x19')]();});}};}function handleEntityNotFound(_0x29a13b,_0x103e4e){return function(_0x4b8655){if(!_0x4b8655){_0x29a13b[_0x2b99('0x17')](0x194);}return _0x4b8655;};}function handleError(_0x3b96db,_0x5e4c20){_0x5e4c20=_0x5e4c20||0x1f4;return function(_0x3ddac0){logger[_0x2b99('0x26')](_0x3ddac0[_0x2b99('0x27')]);if(_0x3ddac0[_0x2b99('0x28')]){delete _0x3ddac0[_0x2b99('0x28')];}_0x3b96db[_0x2b99('0x18')](_0x5e4c20)[_0x2b99('0x29')](_0x3ddac0);};}exports[_0x2b99('0x2a')]=function(_0x1b6293,_0x3c4f16){var _0x4c4bac={},_0x361184={},_0x1e16db={'count':0x0,'rows':[]};var _0x11bbd1=_['map'](db[_0x2b99('0x2b')][_0x2b99('0x2c')],function(_0x142dea){return{'name':_0x142dea['fieldName'],'type':_0x142dea[_0x2b99('0x2d')][_0x2b99('0x2e')]};});_0x361184['model']=_['map'](_0x11bbd1,_0x2b99('0x28'));_0x361184['query']=_[_0x2b99('0x2f')](_0x1b6293['query']);_0x361184[_0x2b99('0x30')]=_[_0x2b99('0x31')](_0x361184[_0x2b99('0x32')],_0x361184[_0x2b99('0x33')]);_0x4c4bac[_0x2b99('0x34')]=_[_0x2b99('0x31')](_0x361184[_0x2b99('0x32')],qs[_0x2b99('0x35')](_0x1b6293['query'][_0x2b99('0x35')]));_0x4c4bac['attributes']=_0x4c4bac[_0x2b99('0x34')][_0x2b99('0x36')]?_0x4c4bac['attributes']:_0x361184[_0x2b99('0x32')];if(!_0x1b6293[_0x2b99('0x33')]['hasOwnProperty'](_0x2b99('0x37'))){_0x4c4bac[_0x2b99('0x1d')]=qs[_0x2b99('0x1d')](_0x1b6293[_0x2b99('0x33')]['limit']);_0x4c4bac[_0x2b99('0x1b')]=qs[_0x2b99('0x1b')](_0x1b6293[_0x2b99('0x33')]['offset']);}_0x4c4bac[_0x2b99('0x38')]=qs['sort'](_0x1b6293[_0x2b99('0x33')]['sort']);_0x4c4bac['where']=qs[_0x2b99('0x30')](_['pick'](_0x1b6293[_0x2b99('0x33')],_0x361184[_0x2b99('0x30')]),_0x11bbd1);if(_0x1b6293[_0x2b99('0x33')][_0x2b99('0x39')]){_0x4c4bac[_0x2b99('0x3a')]=_['merge'](_0x4c4bac['where'],{'$or':_[_0x2b99('0x3b')](_0x11bbd1,function(_0x294696){if(_0x294696[_0x2b99('0x2d')]!=='VIRTUAL'){var _0x1bfb99={};_0x1bfb99[_0x294696[_0x2b99('0x28')]]={'$like':'%'+_0x1b6293[_0x2b99('0x33')]['filter']+'%'};return _0x1bfb99;}})});}_0x4c4bac=_[_0x2b99('0x3c')]({},_0x4c4bac,_0x1b6293['options']);var _0x3b617b={'where':_0x4c4bac[_0x2b99('0x3a')]};return db[_0x2b99('0x2b')][_0x2b99('0x1e')](_0x3b617b)['then'](function(_0x4222e8){_0x1e16db[_0x2b99('0x1e')]=_0x4222e8;if(_0x1b6293['query'][_0x2b99('0x3d')]){_0x4c4bac[_0x2b99('0x3e')]=[{'all':!![]}];}return db[_0x2b99('0x2b')][_0x2b99('0x3f')](_0x4c4bac);})[_0x2b99('0x24')](function(_0x2a64b9){_0x1e16db[_0x2b99('0x40')]=_0x2a64b9;return _0x1e16db;})[_0x2b99('0x24')](respondWithFilteredResult(_0x3c4f16,_0x4c4bac))[_0x2b99('0x41')](handleError(_0x3c4f16,null));};exports[_0x2b99('0x42')]=function(_0xbe9827,_0x10b89b){var _0x4db761={'raw':!![],'where':{'id':_0xbe9827[_0x2b99('0x43')]['id']}},_0x140046={};_0x140046[_0x2b99('0x32')]=_['keys'](db['VoiceQueuesLog'][_0x2b99('0x2c')]);_0x140046[_0x2b99('0x33')]=_[_0x2b99('0x2f')](_0xbe9827[_0x2b99('0x33')]);_0x140046[_0x2b99('0x30')]=_[_0x2b99('0x31')](_0x140046[_0x2b99('0x32')],_0x140046[_0x2b99('0x33')]);_0x4db761[_0x2b99('0x34')]=_[_0x2b99('0x31')](_0x140046['model'],qs[_0x2b99('0x35')](_0xbe9827[_0x2b99('0x33')][_0x2b99('0x35')]));_0x4db761[_0x2b99('0x34')]=_0x4db761[_0x2b99('0x34')]['length']?_0x4db761['attributes']:_0x140046[_0x2b99('0x32')];if(_0xbe9827['query'][_0x2b99('0x3d')]){_0x4db761[_0x2b99('0x3e')]=[{'all':!![]}];}_0x4db761=_[_0x2b99('0x3c')]({},_0x4db761,_0xbe9827[_0x2b99('0x44')]);return db['VoiceQueuesLog'][_0x2b99('0x45')](_0x4db761)[_0x2b99('0x24')](handleEntityNotFound(_0x10b89b,null))[_0x2b99('0x24')](respondWithResult(_0x10b89b,null))[_0x2b99('0x41')](handleError(_0x10b89b,null));};exports[_0x2b99('0x46')]=function(_0x4da9e1,_0x1b9154){return db[_0x2b99('0x2b')][_0x2b99('0x46')](_0x4da9e1[_0x2b99('0x47')],{})[_0x2b99('0x24')](respondWithResult(_0x1b9154,0xc9))[_0x2b99('0x41')](handleError(_0x1b9154,null));};exports[_0x2b99('0x23')]=function(_0x392956,_0x47930a){if(_0x392956[_0x2b99('0x47')]['id']){delete _0x392956[_0x2b99('0x47')]['id'];}return db[_0x2b99('0x2b')][_0x2b99('0x45')]({'where':{'id':_0x392956[_0x2b99('0x43')]['id']}})['then'](handleEntityNotFound(_0x47930a,null))[_0x2b99('0x24')](saveUpdates(_0x392956[_0x2b99('0x47')],null))[_0x2b99('0x24')](respondWithResult(_0x47930a,null))[_0x2b99('0x41')](handleError(_0x47930a,null));};exports[_0x2b99('0x25')]=function(_0xabeaa,_0x393274){return db['VoiceQueuesLog'][_0x2b99('0x45')]({'where':{'id':_0xabeaa[_0x2b99('0x43')]['id']}})[_0x2b99('0x24')](handleEntityNotFound(_0x393274,null))[_0x2b99('0x24')](removeEntity(_0x393274,null))['catch'](handleError(_0x393274,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 4854b4a..6d2ce24 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 _0xc0f3=['VoiceQueuesLog','voice_queues_log','event_dtm','dtm','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define'];(function(_0x35f6b4,_0x505966){var _0x10f072=function(_0x20e563){while(--_0x20e563){_0x35f6b4['push'](_0x35f6b4['shift']());}};_0x10f072(++_0x505966);}(_0xc0f3,0x1d8));var _0x3c0f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xc0f3[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x3c0f('0x0'));var logger=require(_0x3c0f('0x1'))(_0x3c0f('0x2'));var moment=require('moment');var BPromise=require(_0x3c0f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3c0f('0x4'));var config=require(_0x3c0f('0x5'));var attributes=require(_0x3c0f('0x6'));module[_0x3c0f('0x7')]=function(_0x1512d2,_0x5871c0){return _0x1512d2[_0x3c0f('0x8')](_0x3c0f('0x9'),attributes,{'tableName':_0x3c0f('0xa'),'paranoid':![],'indexes':[{'name':_0x3c0f('0xb'),'fields':['event',_0x3c0f('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3308=['event_dtm','event','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log'];(function(_0x4cab09,_0x51348c){var _0xd58146=function(_0x3b9aa3){while(--_0x3b9aa3){_0x4cab09['push'](_0x4cab09['shift']());}};_0xd58146(++_0x51348c);}(_0x3308,0x12e));var _0x8330=function(_0x214ac7,_0x1479c0){_0x214ac7=_0x214ac7-0x0;var _0x104d69=_0x3308[_0x214ac7];return _0x104d69;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8330('0x0'));var moment=require(_0x8330('0x1'));var BPromise=require(_0x8330('0x2'));var rp=require(_0x8330('0x3'));var fs=require('fs');var path=require(_0x8330('0x4'));var rimraf=require('rimraf');var config=require(_0x8330('0x5'));var attributes=require(_0x8330('0x6'));module[_0x8330('0x7')]=function(_0x131c05,_0x14ac10){return _0x131c05[_0x8330('0x8')]('VoiceQueuesLog',attributes,{'tableName':_0x8330('0x9'),'paranoid':![],'indexes':[{'name':_0x8330('0xa'),'fields':[_0x8330('0xb'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index c718cba..fba8751 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 _0x79e5=['debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent'];(function(_0x51b0dc,_0x5307b7){var _0x13fa89=function(_0x2c880f){while(--_0x2c880f){_0x51b0dc['push'](_0x51b0dc['shift']());}};_0x13fa89(++_0x5307b7);}(_0x79e5,0x79));var _0x579e=function(_0x5eb1e4,_0x505bdf){_0x5eb1e4=_0x5eb1e4-0x0;var _0x3dfea3=_0x79e5[_0x5eb1e4];return _0x3dfea3;};'use strict';var _=require(_0x579e('0x0'));var util=require(_0x579e('0x1'));var moment=require(_0x579e('0x2'));var BPromise=require('bluebird');var rs=require(_0x579e('0x3'));var fs=require('fs');var Redis=require(_0x579e('0x4'));var db=require(_0x579e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x579e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3db32a,_0x358abb,_0x678d0d){return new BPromise(function(_0x32b026,_0x5ec0eb){return client[_0x579e('0x7')](_0x3db32a,_0x678d0d)[_0x579e('0x8')](function(_0x5d12da){logger[_0x579e('0x9')](_0x579e('0xa'),_0x358abb,_0x579e('0xb'));logger[_0x579e('0xc')](_0x579e('0xd'),_0x358abb,_0x579e('0xb'),JSON[_0x579e('0xe')](_0x5d12da));if(_0x5d12da[_0x579e('0xf')]){if(_0x5d12da[_0x579e('0xf')][_0x579e('0x10')]===0x1f4){logger[_0x579e('0xf')](_0x579e('0xa'),_0x358abb,_0x5d12da[_0x579e('0xf')][_0x579e('0x11')]);return _0x5ec0eb(_0x5d12da[_0x579e('0xf')][_0x579e('0x11')]);}logger[_0x579e('0xf')](_0x579e('0xa'),_0x358abb,_0x5d12da[_0x579e('0xf')][_0x579e('0x11')]);return _0x32b026(_0x5d12da[_0x579e('0xf')]['message']);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x358abb,'request\x20sent');_0x32b026(_0x5d12da[_0x579e('0x12')]['message']);}})['catch'](function(_0x26ccee){logger[_0x579e('0xf')](_0x579e('0xa'),_0x358abb,_0x26ccee);_0x5ec0eb(_0x26ccee);});});} \ No newline at end of file +var _0xd8eb=['result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','request\x20sent','debug','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','info'];(function(_0x4c1f45,_0x4168f7){var _0x3ae458=function(_0x356eeb){while(--_0x356eeb){_0x4c1f45['push'](_0x4c1f45['shift']());}};_0x3ae458(++_0x4168f7);}(_0xd8eb,0x66));var _0xbd8e=function(_0x37a79c,_0x2b19f0){_0x37a79c=_0x37a79c-0x0;var _0x561d89=_0xd8eb[_0x37a79c];return _0x561d89;};'use strict';var _=require(_0xbd8e('0x0'));var util=require(_0xbd8e('0x1'));var moment=require('moment');var BPromise=require(_0xbd8e('0x2'));var rs=require(_0xbd8e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd8e('0x4'))['db'];var utils=require(_0xbd8e('0x5'));var logger=require(_0xbd8e('0x6'))(_0xbd8e('0x7'));var config=require(_0xbd8e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbd8e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a24dd,_0xbe29da,_0x7602aa){return new BPromise(function(_0x485c4f,_0x4501b8){return client['request'](_0x4a24dd,_0x7602aa)[_0xbd8e('0xa')](function(_0x469e17){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0xbe29da,_0xbd8e('0xb'));logger[_0xbd8e('0xc')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0xbe29da,_0xbd8e('0xb'),JSON['stringify'](_0x469e17));if(_0x469e17[_0xbd8e('0xd')]){if(_0x469e17[_0xbd8e('0xd')][_0xbd8e('0xe')]===0x1f4){logger['error'](_0xbd8e('0xf'),_0xbe29da,_0x469e17['error']['message']);return _0x4501b8(_0x469e17[_0xbd8e('0xd')][_0xbd8e('0x10')]);}logger[_0xbd8e('0xd')](_0xbd8e('0xf'),_0xbe29da,_0x469e17[_0xbd8e('0xd')][_0xbd8e('0x10')]);return _0x485c4f(_0x469e17[_0xbd8e('0xd')][_0xbd8e('0x10')]);}else{logger[_0xbd8e('0x11')](_0xbd8e('0xf'),_0xbe29da,_0xbd8e('0xb'));_0x485c4f(_0x469e17[_0xbd8e('0x12')][_0xbd8e('0x10')]);}})[_0xbd8e('0x13')](function(_0x4bcae0){logger[_0xbd8e('0xd')](_0xbd8e('0xf'),_0xbe29da,_0x4bcae0);_0x4501b8(_0x4bcae0);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 7305959..4987ccb 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 _0x8fec=['get','isAuthenticated','index','describe','/:id','show','/:id/download','/:id/downloads','downloads','downloadTranscribe','create','post','runTranscribe','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller'];(function(_0x57bc10,_0x360027){var _0x38d66c=function(_0x2d1c39){while(--_0x2d1c39){_0x57bc10['push'](_0x57bc10['shift']());}};_0x38d66c(++_0x360027);}(_0x8fec,0x1b1));var _0xc8fe=function(_0x1d8c2e,_0x460fd9){_0x1d8c2e=_0x1d8c2e-0x0;var _0x2c78c2=_0x8fec[_0x1d8c2e];return _0x2c78c2;};'use strict';var multer=require(_0xc8fe('0x0'));var util=require(_0xc8fe('0x1'));var path=require(_0xc8fe('0x2'));var timeout=require('connect-timeout');var express=require(_0xc8fe('0x3'));var router=express[_0xc8fe('0x4')]();var fs_extra=require(_0xc8fe('0x5'));var auth=require(_0xc8fe('0x6'));var interaction=require(_0xc8fe('0x7'));var config=require('../../config/environment');var controller=require(_0xc8fe('0x8'));router[_0xc8fe('0x9')]('/',auth[_0xc8fe('0xa')](),controller[_0xc8fe('0xb')]);router[_0xc8fe('0x9')]('/describe',auth[_0xc8fe('0xa')](),controller[_0xc8fe('0xc')]);router[_0xc8fe('0x9')](_0xc8fe('0xd'),auth[_0xc8fe('0xa')](),controller[_0xc8fe('0xe')]);router[_0xc8fe('0x9')](_0xc8fe('0xf'),auth['isAuthenticated'](),controller['download']);router['get'](_0xc8fe('0x10'),controller[_0xc8fe('0x11')]);router[_0xc8fe('0x9')]('/:id/transcribe',auth[_0xc8fe('0xa')](),controller[_0xc8fe('0x12')]);router['post']('/',auth[_0xc8fe('0xa')](),controller[_0xc8fe('0x13')]);router[_0xc8fe('0x14')]('/:id/transcribe',auth[_0xc8fe('0xa')](),controller[_0xc8fe('0x15')]);router['put'](_0xc8fe('0xd'),auth[_0xc8fe('0xa')](),controller[_0xc8fe('0x16')]);router[_0xc8fe('0x17')]('/:id',auth[_0xc8fe('0xa')](),controller[_0xc8fe('0x18')]);module[_0xc8fe('0x19')]=router; \ No newline at end of file +var _0x2575=['../../components/auth/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','update','exports','util','connect-timeout','express','fs-extra'];(function(_0xe66bd5,_0x1ce7a2){var _0x5a7fa4=function(_0x177682){while(--_0x177682){_0xe66bd5['push'](_0xe66bd5['shift']());}};_0x5a7fa4(++_0x1ce7a2);}(_0x2575,0xd8));var _0x5257=function(_0x56fc9d,_0x1d8d51){_0x56fc9d=_0x56fc9d-0x0;var _0xae53c0=_0x2575[_0x56fc9d];return _0xae53c0;};'use strict';var multer=require('multer');var util=require(_0x5257('0x0'));var path=require('path');var timeout=require(_0x5257('0x1'));var express=require(_0x5257('0x2'));var router=express['Router']();var fs_extra=require(_0x5257('0x3'));var auth=require(_0x5257('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5257('0x5'));router[_0x5257('0x6')]('/',auth[_0x5257('0x7')](),controller[_0x5257('0x8')]);router[_0x5257('0x6')](_0x5257('0x9'),auth[_0x5257('0x7')](),controller[_0x5257('0xa')]);router['get'](_0x5257('0xb'),auth[_0x5257('0x7')](),controller[_0x5257('0xc')]);router[_0x5257('0x6')](_0x5257('0xd'),auth['isAuthenticated'](),controller[_0x5257('0xe')]);router['get']('/:id/downloads',controller['downloads']);router[_0x5257('0x6')](_0x5257('0xf'),auth[_0x5257('0x7')](),controller[_0x5257('0x10')]);router['post']('/',auth[_0x5257('0x7')](),controller[_0x5257('0x11')]);router[_0x5257('0x12')](_0x5257('0xf'),auth[_0x5257('0x7')](),controller[_0x5257('0x13')]);router['put']('/:id',auth[_0x5257('0x7')](),controller[_0x5257('0x14')]);router['delete']('/:id',auth[_0x5257('0x7')](),controller['destroy']);module[_0x5257('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 7659109..78bd205 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(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 0eb5b18..c56fba9 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 _0x0919=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','keys','find','catch','body','params','describe','download','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','unlink','message','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','decryptFile','ValidationError','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','Location','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus','runTranscribe','Voice\x20Recording\x20not\x20found','findOne','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','differenceBy','format','query','filters','intersection','model','attributes','fields','length'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0919,0x189));var _0x9091=function(_0x1e0de7,_0x28b328){_0x1e0de7=_0x1e0de7-0x0;var _0x212ce6=_0x0919[_0x1e0de7];return _0x212ce6;};'use strict';var emlformat=require(_0x9091('0x0'));var rimraf=require(_0x9091('0x1'));var zipdir=require(_0x9091('0x2'));var jsonpatch=require(_0x9091('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9091('0x4'));var Mustache=require(_0x9091('0x5'));var util=require('util');var path=require(_0x9091('0x6'));var sox=require(_0x9091('0x7'));var csv=require(_0x9091('0x8'));var ejs=require(_0x9091('0x9'));var fs=require('fs');var fs_extra=require(_0x9091('0xa'));var _=require('lodash');var squel=require(_0x9091('0xb'));var crypto=require('crypto');var jsforce=require(_0x9091('0xc'));var deskjs=require(_0x9091('0xd'));var toCsv=require(_0x9091('0x8'));var querystring=require(_0x9091('0xe'));var Papa=require(_0x9091('0xf'));var AWS=require(_0x9091('0x10'));var uuidv4=require(_0x9091('0x11'));var Redis=require('ioredis');var authService=require(_0x9091('0x12'));var qs=require(_0x9091('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9091('0x14'));var logger=require(_0x9091('0x15'))('api');var utils=require(_0x9091('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9091('0x17'));var db=require(_0x9091('0x18'))['db'];function respondWithStatusCode(_0x59527d,_0x1ce5a7){_0x1ce5a7=_0x1ce5a7||0xcc;return function(_0x33498c){if(_0x33498c){return _0x59527d[_0x9091('0x19')](_0x1ce5a7);}return _0x59527d[_0x9091('0x1a')](_0x1ce5a7)[_0x9091('0x1b')]();};}function respondWithResult(_0xe04bc0,_0x596348){_0x596348=_0x596348||0xc8;return function(_0xd4cb86){if(_0xd4cb86){return _0xe04bc0[_0x9091('0x1a')](_0x596348)[_0x9091('0x1c')](_0xd4cb86);}};}function respondWithFilteredResult(_0x162af1,_0x30d9e5){return function(_0x59e0c5){if(_0x59e0c5){var _0x1c4056=typeof _0x30d9e5['offset']==='undefined'&&typeof _0x30d9e5['limit']==='undefined';var _0x2e91d2=_0x59e0c5[_0x9091('0x1d')];var _0x23d682=_0x1c4056?0x0:_0x30d9e5[_0x9091('0x1e')];var _0x2bd7dd=_0x1c4056?_0x59e0c5['count']:_0x30d9e5[_0x9091('0x1e')]+_0x30d9e5[_0x9091('0x1f')];var _0x3b68d1;if(_0x2bd7dd>=_0x2e91d2){_0x2bd7dd=_0x2e91d2;_0x3b68d1=0xc8;}else{_0x3b68d1=0xce;}_0x162af1['status'](_0x3b68d1);return _0x162af1[_0x9091('0x20')](_0x9091('0x21'),_0x23d682+'-'+_0x2bd7dd+'/'+_0x2e91d2)[_0x9091('0x1c')](_0x59e0c5);}return null;};}function patchUpdates(_0x1870e8){return function(_0x1a855f){try{jsonpatch[_0x9091('0x22')](_0x1a855f,_0x1870e8,!![]);}catch(_0x3b0e8d){return BPromise[_0x9091('0x23')](_0x3b0e8d);}return _0x1a855f[_0x9091('0x24')]();};}function saveUpdates(_0xa8227c,_0x57a10d){return function(_0x2f73cc){if(_0x2f73cc){return _0x2f73cc[_0x9091('0x25')](_0xa8227c)[_0x9091('0x26')](function(_0x3a178b){return _0x3a178b;});}return null;};}function removeEntity(_0x2b59d5,_0x1a8272){return function(_0x534c99){if(_0x534c99){return _0x534c99[_0x9091('0x27')]()[_0x9091('0x26')](function(){_0x2b59d5[_0x9091('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16ddf0,_0x5d4f58){return function(_0x885781){if(!_0x885781){_0x16ddf0[_0x9091('0x19')](0x194);}return _0x885781;};}function handleError(_0x2265da,_0x1407ed){_0x1407ed=_0x1407ed||0x1f4;return function(_0x5326b5){logger[_0x9091('0x28')](_0x5326b5[_0x9091('0x29')]);if(_0x5326b5[_0x9091('0x2a')]){delete _0x5326b5[_0x9091('0x2a')];}_0x2265da['status'](_0x1407ed)[_0x9091('0x2b')](_0x5326b5);};}exports[_0x9091('0x2c')]=function(_0x4c938f,_0x757eab){var _0x38b42b={},_0x404d4b={},_0x3ea5a8={'count':0x0,'rows':[]};var _0x4ef593=_[_0x9091('0x2d')](db[_0x9091('0x2e')][_0x9091('0x2f')],function(_0x20d45f){return{'name':_0x20d45f[_0x9091('0x30')],'type':_0x20d45f[_0x9091('0x31')][_0x9091('0x32')]};});_0x404d4b['model']=_[_0x9091('0x33')](_[_0x9091('0x2d')](_0x4ef593,_0x9091('0x2a')),[_0x9091('0x34')]);_0x404d4b[_0x9091('0x35')]=_['keys'](_0x4c938f[_0x9091('0x35')]);_0x404d4b[_0x9091('0x36')]=_[_0x9091('0x37')](_0x404d4b[_0x9091('0x38')],_0x404d4b[_0x9091('0x35')]);_0x38b42b[_0x9091('0x39')]=_[_0x9091('0x37')](_0x404d4b[_0x9091('0x38')],qs[_0x9091('0x3a')](_0x4c938f[_0x9091('0x35')][_0x9091('0x3a')]));_0x38b42b['attributes']=_0x38b42b[_0x9091('0x39')][_0x9091('0x3b')]?_0x38b42b[_0x9091('0x39')]:_0x404d4b[_0x9091('0x38')];if(!_0x4c938f[_0x9091('0x35')][_0x9091('0x3c')](_0x9091('0x3d'))){_0x38b42b[_0x9091('0x1f')]=qs[_0x9091('0x1f')](_0x4c938f[_0x9091('0x35')][_0x9091('0x1f')]);_0x38b42b['offset']=qs[_0x9091('0x1e')](_0x4c938f[_0x9091('0x35')][_0x9091('0x1e')]);}_0x38b42b[_0x9091('0x3e')]=qs[_0x9091('0x3f')](_0x4c938f[_0x9091('0x35')][_0x9091('0x3f')]);_0x38b42b[_0x9091('0x40')]=qs[_0x9091('0x36')](_[_0x9091('0x41')](_0x4c938f[_0x9091('0x35')],_0x404d4b[_0x9091('0x36')]),_0x4ef593);if(_0x4c938f[_0x9091('0x35')][_0x9091('0x42')]){_0x38b42b[_0x9091('0x40')]=_[_0x9091('0x43')](_0x38b42b['where'],{'$or':_[_0x9091('0x2d')](_0x4ef593,function(_0xd16244){if(_0xd16244[_0x9091('0x31')]!=='VIRTUAL'){var _0x522974={};_0x522974[_0xd16244[_0x9091('0x2a')]]={'$like':'%'+_0x4c938f[_0x9091('0x35')][_0x9091('0x42')]+'%'};return _0x522974;}})});}_0x38b42b=_[_0x9091('0x43')]({},_0x38b42b,_0x4c938f[_0x9091('0x44')]);var _0x753ce={'where':_0x38b42b[_0x9091('0x40')]};return db[_0x9091('0x2e')][_0x9091('0x1d')](_0x753ce)['then'](function(_0x31a368){_0x3ea5a8[_0x9091('0x1d')]=_0x31a368;if(_0x4c938f[_0x9091('0x35')][_0x9091('0x45')]){_0x38b42b['include']=[{'all':!![]}];}return db[_0x9091('0x2e')][_0x9091('0x46')](_0x38b42b);})[_0x9091('0x26')](function(_0x102733){_0x3ea5a8[_0x9091('0x47')]=_0x102733;return _0x3ea5a8;})[_0x9091('0x26')](respondWithFilteredResult(_0x757eab,_0x38b42b))['catch'](handleError(_0x757eab,null));};exports[_0x9091('0x48')]=function(_0x3f4a55,_0xa6c27a){var _0x1b36fe={'raw':![],'where':{'id':_0x3f4a55['params']['id']}},_0x33c768={};_0x33c768[_0x9091('0x38')]=_[_0x9091('0x49')](db[_0x9091('0x2e')]['rawAttributes']);_0x33c768[_0x9091('0x35')]=_[_0x9091('0x49')](_0x3f4a55['query']);_0x33c768[_0x9091('0x36')]=_[_0x9091('0x37')](_0x33c768['model'],_0x33c768[_0x9091('0x35')]);_0x1b36fe[_0x9091('0x39')]=_[_0x9091('0x37')](_0x33c768[_0x9091('0x38')],qs[_0x9091('0x3a')](_0x3f4a55[_0x9091('0x35')][_0x9091('0x3a')]));_0x1b36fe[_0x9091('0x39')]=_0x1b36fe[_0x9091('0x39')][_0x9091('0x3b')]?_0x1b36fe[_0x9091('0x39')]:_0x33c768[_0x9091('0x38')];if(_0x3f4a55[_0x9091('0x35')][_0x9091('0x45')]){_0x1b36fe['include']=[{'all':!![]}];}_0x1b36fe=_['merge']({},_0x1b36fe,_0x3f4a55[_0x9091('0x44')]);return db[_0x9091('0x2e')][_0x9091('0x4a')](_0x1b36fe)[_0x9091('0x26')](handleEntityNotFound(_0xa6c27a,null))[_0x9091('0x26')](respondWithResult(_0xa6c27a,null))[_0x9091('0x4b')](handleError(_0xa6c27a,null));};exports['create']=function(_0x2b7ace,_0x33b12c){return db[_0x9091('0x2e')]['create'](_0x2b7ace['body'],{})[_0x9091('0x26')](respondWithResult(_0x33b12c,0xc9))['catch'](handleError(_0x33b12c,null));};exports[_0x9091('0x25')]=function(_0x38bc51,_0xfb1d9a){if(_0x38bc51[_0x9091('0x4c')]['id']){delete _0x38bc51['body']['id'];}return db[_0x9091('0x2e')][_0x9091('0x4a')]({'where':{'id':_0x38bc51[_0x9091('0x4d')]['id']}})[_0x9091('0x26')](handleEntityNotFound(_0xfb1d9a,null))['then'](saveUpdates(_0x38bc51[_0x9091('0x4c')],null))['then'](respondWithResult(_0xfb1d9a,null))[_0x9091('0x4b')](handleError(_0xfb1d9a,null));};exports[_0x9091('0x4e')]=function(_0x5181ef,_0xc5c802){return db['VoiceRecording'][_0x9091('0x4e')]()[_0x9091('0x26')](respondWithResult(_0xc5c802,null))['catch'](handleError(_0xc5c802,null));};exports[_0x9091('0x4f')]=function(_0xe1532,_0x57dce7,_0x2fcb1e){var _0x4d9d2a=require('../../components/encryptor');var _0x52fc77=![];var _0xb41dd6={};if(_0xe1532[_0x9091('0x35')]['type']&&_0xe1532[_0x9091('0x35')][_0x9091('0x31')]===_0x9091('0x50')){_0xb41dd6[_0x9091('0x50')]=_0xe1532[_0x9091('0x4d')]['id'];}else{_0xb41dd6['id']=_0xe1532['params']['id'];}return db[_0x9091('0x2e')][_0x9091('0x4a')]({'where':_0xb41dd6,'attributes':['id',_0x9091('0x51')],'raw':!![]})[_0x9091('0x26')](handleEntityNotFound(_0x57dce7,null))[_0x9091('0x26')](function(_0x122c72){if(_0x122c72){var _0x5c19d1=_0x122c72['value'];var _0x495e54=util['format'](_0x9091('0x52'),_0x5c19d1);if(fs[_0x9091('0x53')](_0x495e54)){_0x52fc77=!![];return _0x4d9d2a['decryptFile'](_0x495e54,_0x5c19d1,config[_0x9091('0x54')][_0x9091('0x55')])[_0x9091('0x26')](function(){return _0x122c72;});}return _0x122c72;}})['then'](function(_0x20c0bc){if(_0x20c0bc){var _0x1e76cc=_0x20c0bc[_0x9091('0x51')];if(!fs[_0x9091('0x53')](_0x1e76cc)){throw new db[(_0x9091('0x56'))]['ValidationError'](_0x9091('0x57'));}if(_0x20c0bc['filename']){return _0x57dce7[_0x9091('0x4f')](_0x1e76cc,_0x20c0bc[_0x9091('0x58')]+path['extname'](_0x1e76cc),function(){if(_0x52fc77){fs[_0x9091('0x59')](_0x1e76cc);}});}else{return _0x57dce7[_0x9091('0x4f')](_0x1e76cc,function(_0x4802a5){if(_0x52fc77){fs[_0x9091('0x59')](_0x1e76cc);}});}}})[_0x9091('0x4b')](function(_0x416e74){if(_0x416e74[_0x9091('0x5a')]==='VoiceRecording\x20not\x20found'){_0x57dce7[_0x9091('0x1a')](0x194)['send']('Not\x20found');}else{return handleError(_0x57dce7,null);}});};exports[_0x9091('0x5b')]=function(_0x52c01a,_0x465b56,_0xf01b4b){var _0x2edd9e=require(_0x9091('0x5c'));var _0x2c2f6f=![];var _0x73d1d={'$and':[db[_0x9091('0x5d')][_0x9091('0x40')](db[_0x9091('0x5d')]['fn'](_0x9091('0x5e'),db[_0x9091('0x5d')][_0x9091('0x5f')](_0x9091('0x50'))),_0x52c01a[_0x9091('0x35')][_0x9091('0x60')])]};if(_0x52c01a[_0x9091('0x35')]['type']&&_0x52c01a[_0x9091('0x35')][_0x9091('0x31')]===_0x9091('0x50')){_0x73d1d[_0x9091('0x61')][_0x9091('0x62')]({'uniqueid':_0x52c01a['params']['id']});}else{_0x73d1d[_0x9091('0x61')][_0x9091('0x62')]({'id':_0x52c01a[_0x9091('0x4d')]['id']});}return db['VoiceRecording'][_0x9091('0x4a')]({'where':_0x73d1d,'attributes':['id',_0x9091('0x51')],'raw':!![]})[_0x9091('0x26')](handleEntityNotFound(_0x465b56,null))[_0x9091('0x26')](function(_0x7a2232){if(_0x7a2232){var _0x17e4ef=util[_0x9091('0x34')]('%s.cypher',_0x7a2232[_0x9091('0x51')]);if(fs[_0x9091('0x53')](_0x17e4ef)){_0x2c2f6f=!![];return _0x2edd9e[_0x9091('0x63')](_0x17e4ef,_0x7a2232[_0x9091('0x51')],config[_0x9091('0x54')][_0x9091('0x55')])[_0x9091('0x26')](function(){return _0x7a2232;});}return _0x7a2232;}})['then'](function(_0x3d11a2){if(_0x3d11a2){if(!fs['existsSync'](_0x3d11a2[_0x9091('0x51')])){throw new db[(_0x9091('0x56'))][(_0x9091('0x64'))](_0x9091('0x57'));}if(_0x3d11a2['filename']){return _0x465b56[_0x9091('0x4f')](_0x3d11a2[_0x9091('0x51')],_0x3d11a2[_0x9091('0x58')]+path['extname'](_0x3d11a2[_0x9091('0x51')]),function(){if(_0x2c2f6f){fs[_0x9091('0x59')](_0x3d11a2['value']);}});}else{return _0x465b56['download'](_0x3d11a2[_0x9091('0x51')],function(_0x526959){if(_0x2c2f6f){fs['unlink'](_0x3d11a2[_0x9091('0x51')]);}});}}})[_0x9091('0x4b')](handleError(_0x465b56,null));};exports[_0x9091('0x27')]=function(_0x7826b5,_0x55a840){return db['VoiceRecording']['find']({'where':{'id':_0x7826b5['params']['id']}})[_0x9091('0x26')](function(_0x426085){if(_[_0x9091('0x65')](_0x426085)){throw new ReferenceError(_0x9091('0x66'));}return _0x426085;})[_0x9091('0x26')](function(_0x59bd0){var _0x45dbbd=_0x59bd0[_0x9091('0x51')];logger[_0x9091('0x67')](_0x9091('0x68'),_0x45dbbd);if(!_[_0x9091('0x65')](_0x59bd0[_0x9091('0x51')])&&fs[_0x9091('0x53')](_0x45dbbd)){logger[_0x9091('0x67')]('File:\x20\x22'+_0x45dbbd+_0x9091('0x69'));fs[_0x9091('0x6a')](_0x45dbbd);}_0x45dbbd=_0x45dbbd+'.cypher';if(!_[_0x9091('0x65')](_0x59bd0[_0x9091('0x51')])&&fs[_0x9091('0x53')](_0x45dbbd)){logger[_0x9091('0x67')](_0x9091('0x6b')+_0x45dbbd+_0x9091('0x69'));fs[_0x9091('0x6a')](_0x45dbbd);}return _0x59bd0;})[_0x9091('0x26')](function(_0x5f2f40){if(!_0x5f2f40)throw new InternalError();return _0x5f2f40[_0x9091('0x27')]();})[_0x9091('0x26')](function(){_0x55a840[_0x9091('0x1a')](0xcc)[_0x9091('0x1b')]();})[_0x9091('0x4b')](handleError(_0x55a840,null));};function getBucketslist(_0x20ddd1,_0x477f3c,_0x5a116f){return new Promise(function(_0x54c6cc,_0x10d206){var _0x50fcfe=new AWS['S3']({'accessKeyId':_0x477f3c,'secretAccessKey':_0x20ddd1,'region':_0x5a116f});_0x50fcfe['listBuckets']({},function(_0x328280,_0x51102e){if(_0x328280){return _0x10d206(_0x328280);}else{return _0x54c6cc(_0x51102e);}});});}function createBucket(_0xa99117,_0x3a2ba6,_0x2d91bd,_0x1d6244){return new Promise(function(_0x43665a,_0x4f2038){var _0x3e0102=new AWS['S3']({'accessKeyId':_0x3a2ba6,'secretAccessKey':_0xa99117,'region':_0x2d91bd});_0x3e0102['createBucket']({'Bucket':_0x1d6244},function(_0x41f9ba,_0x576336){if(_0x41f9ba){return _0x4f2038(_0x41f9ba);}else{return _0x43665a(_0x576336);}});});}function uploadFile(_0x199b87,_0x4e5858,_0x2ad760,_0x2bc5b2,_0x2640dd,_0x5f4269){return new Promise(function(_0x490e62,_0x17eec3){var _0x2d39ea=new AWS['S3']({'accessKeyId':_0x4e5858,'secretAccessKey':_0x199b87,'region':_0x2ad760});_0x2d39ea[_0x9091('0x6c')]({'Bucket':_0x2bc5b2,'Key':_0x2640dd,'Body':_0x5f4269},function(_0x3f84cd,_0x39bec2){if(_0x3f84cd){return _0x17eec3(_0x3f84cd);}else{return _0x490e62(_0x39bec2);}});});}function startTranscribe(_0x397e95,_0x54e10e,_0x2c903b,_0x50c05c,_0x117f83,_0x448f81){return new Promise(function(_0x2d5788,_0x43ff54){var _0x49eff2=new AWS[(_0x9091('0x6d'))]({'accessKeyId':_0x54e10e,'secretAccessKey':_0x397e95,'region':_0x2c903b});_0x49eff2['startTranscriptionJob']({'TranscriptionJobName':_0x50c05c,'LanguageCode':_0x117f83,'Media':{'MediaFileUri':_0x448f81}},function(_0x3c11b0,_0x19d9e9){if(_0x3c11b0){return _0x43ff54(_0x3c11b0);}else{return _0x2d5788(_0x19d9e9);}});});}function transcribe(_0x23d434,_0x8f002f,_0x4523f8,_0x124232,_0x5cd2aa,_0x24d341,_0x5a5950){return new Promise(function(_0x1882e0,_0x1ec3e0){var _0x3b9322={};logger['info'](util[_0x9091('0x34')](_0x9091('0x6e'),_0x23d434,_0x5cd2aa));return uploadFile(_0x8f002f,_0x4523f8,_0x124232,_0x5cd2aa,path[_0x9091('0x6f')](_0x24d341),fs[_0x9091('0x70')](_0x24d341))[_0x9091('0x26')](function(_0x1e759e){logger[_0x9091('0x67')](util[_0x9091('0x34')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x23d434,_0x5cd2aa,_0x1e759e['Location']));_0x3b9322[_0x9091('0x71')]=_0x1e759e['Bucket'];_0x3b9322[_0x9091('0x72')]=_0x1e759e['Location'];logger['info'](util[_0x9091('0x34')](_0x9091('0x73'),_0x23d434));return startTranscribe(_0x8f002f,_0x4523f8,_0x124232,uuidv4(),_0x5a5950,_0x1e759e[_0x9091('0x74')]);})[_0x9091('0x26')](function(_0x24f972){logger[_0x9091('0x67')](util[_0x9091('0x34')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x23d434,_0x24f972[_0x9091('0x75')][_0x9091('0x76')]));_0x3b9322[_0x9091('0x77')]=_0x24f972[_0x9091('0x75')][_0x9091('0x76')];_0x3b9322['transcribeStatus']=_0x24f972['TranscriptionJob'][_0x9091('0x78')];return _0x1882e0(_0x3b9322);})[_0x9091('0x4b')](function(_0x144021){return _0x1ec3e0(_0x144021);});});}exports[_0x9091('0x79')]=function(_0x10760b,_0x44640c,_0x3e9f01){var _0x5d599e;var _0x24fe35;var _0x2c293b;var _0x48d656=require(_0x9091('0x5c'));return db[_0x9091('0x2e')]['findOne']({'where':{'id':_0x10760b[_0x9091('0x4d')]['id']}})[_0x9091('0x26')](function(_0x9e7e06){if(_0x9e7e06){var _0x40f357=util[_0x9091('0x34')](_0x9091('0x52'),_0x9e7e06[_0x9091('0x51')]);if(fs[_0x9091('0x53')](_0x40f357)){cypher=!![];return _0x48d656[_0x9091('0x63')](_0x40f357,_0x9e7e06[_0x9091('0x51')],config[_0x9091('0x54')][_0x9091('0x55')])[_0x9091('0x26')](function(){return _0x9e7e06;});}return _0x9e7e06;}})[_0x9091('0x26')](function(_0x1189d3){if(!_0x1189d3){throw new db[(_0x9091('0x56'))][(_0x9091('0x64'))](_0x9091('0x7a'));}_0x24fe35=_0x1189d3;return db['Setting'][_0x9091('0x7b')]({'where':{'id':0x1}});})[_0x9091('0x26')](handleEntityNotFound(_0x44640c,null))[_0x9091('0x26')](function(_0x48c9c3){if(_0x48c9c3){_0x5d599e=_0x48c9c3;if(!_0x5d599e[_0x9091('0x7c')]||!_0x5d599e[_0x9091('0x7d')]||!_0x5d599e[_0x9091('0x7e')]||!_0x5d599e['language']||!_0x5d599e[_0x9091('0x71')]){throw new db['Sequelize'][(_0x9091('0x64'))](_0x9091('0x7f'));}if(_0x10760b[_0x9091('0x4c')][_0x9091('0x80')]&&(!_0x5d599e['sentiment']||!_0x5d599e[_0x9091('0x81')]||!_0x5d599e[_0x9091('0x82')]||!_0x5d599e[_0x9091('0x83')]||!_0x5d599e['bucket'])){throw new db[(_0x9091('0x56'))][(_0x9091('0x64'))](_0x9091('0x84'));}return db[_0x9091('0x85')][_0x9091('0x7b')]({'where':{'id':_0x5d599e[_0x9091('0x7d')]}});}})['then'](function(_0xec311c){if(!_0xec311c){throw new db[(_0x9091('0x56'))][(_0x9091('0x64'))](_0x9091('0x86'));}if(!_0xec311c[_0x9091('0x87')]||!_0xec311c[_0x9091('0x88')]){throw new db[(_0x9091('0x56'))][(_0x9091('0x64'))]('Cloud\x20Provider\x20not\x20configured');}_0x2c293b=_0xec311c;return getBucketslist(_0x2c293b[_0x9091('0x87')],_0x2c293b[_0x9091('0x88')],_0x5d599e[_0x9091('0x7e')]);})[_0x9091('0x26')](function(_0x16a18b){if(_0x16a18b&&_0x16a18b['Buckets']){var _0x4c6c4e=_[_0x9091('0x4a')](_0x16a18b[_0x9091('0x89')],function(_0x1a7a1a){return _0x1a7a1a[_0x9091('0x8a')]===_0x5d599e[_0x9091('0x71')];});if(!_0x4c6c4e){logger['info'](util[_0x9091('0x34')](_0x9091('0x8b'),_0x10760b[_0x9091('0x4d')]['id'],_0x5d599e[_0x9091('0x71')]));return createBucket(_0x2c293b['data1'],_0x2c293b[_0x9091('0x88')],_0x5d599e[_0x9091('0x7e')],_0x5d599e[_0x9091('0x71')]);}logger['info'](util['format'](_0x9091('0x8c'),_0x10760b[_0x9091('0x4d')]['id'],_0x5d599e[_0x9091('0x71')]));return;}})[_0x9091('0x26')](function(_0x3c3702){if(_0x24fe35[_0x9091('0x8d')]==='NEW'){return transcribe(_0x10760b['params']['id'],_0x2c293b[_0x9091('0x87')],_0x2c293b[_0x9091('0x88')],_0x5d599e[_0x9091('0x7e')],_0x5d599e[_0x9091('0x71')],_0x24fe35[_0x9091('0x51')],_0x5d599e[_0x9091('0x83')]);}else{logger[_0x9091('0x67')](util[_0x9091('0x34')](_0x9091('0x8e'),_0x10760b[_0x9091('0x4d')]['id']));return{'transcribeStatus':_0x9091('0x8f')};}})[_0x9091('0x26')](function(_0x2ecb01){if(_0x2ecb01){_0x2ecb01[_0x9091('0x90')]=_0x10760b[_0x9091('0x4c')]['runSentiment'];return _0x24fe35[_0x9091('0x91')](_0x2ecb01);}})['then'](respondWithResult(_0x44640c,null))[_0x9091('0x4b')](handleError(_0x44640c,null));};function writeFile(_0xd4d4ef,_0x1be3e5){return new Promise(function(_0x3d2f8,_0x21730c){fs[_0x9091('0x92')](_0x1be3e5,_0xd4d4ef,function(_0x135ac3,_0x1b4571){if(_0x135ac3){return _0x21730c(_0x135ac3);}else{return _0x3d2f8(_0x1b4571);}});});}exports['downloadTranscribe']=function(_0x55be24,_0x53b311,_0x22043e){return db[_0x9091('0x2e')][_0x9091('0x7b')]({'where':{'id':_0x55be24['params']['id']}})[_0x9091('0x26')](handleEntityNotFound(_0x53b311))[_0x9091('0x26')](function(_0x45867b){if(_0x45867b&&_0x45867b[_0x9091('0x93')]){var _0x2a322a=_0x45867b[_0x9091('0x93')];var _0x104df4=config[_0x9091('0x94')]+_0x9091('0x95')+_0x45867b['id']+_0x9091('0x96');if(fs[_0x9091('0x53')](_0x104df4)){return _0x104df4;}return writeFile(_0x2a322a,_0x104df4)['then'](function(){return _0x104df4;});}else{throw new db[(_0x9091('0x56'))][(_0x9091('0x64'))]('Transcript\x20not\x20available');}})[_0x9091('0x26')](function(_0x7d5f59){return _0x53b311['download'](_0x7d5f59);})[_0x9091('0x4b')](handleError(_0x53b311));}; \ No newline at end of file +var _0xef29=['data2','Buckets','data1','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','desk.js','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','fieldName','key','model','format','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','type','filter','options','count','include','findAll','catch','params','keys','rawAttributes','merge','find','create','body','describe','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','unlink','message','downloads','sequelize','MD5','col','token','push','$and','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJob','TranscriptionJobStatus','runTranscribe','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xef29,0x1cd));var _0x9ef2=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xef29[_0x27af45];return _0x18df21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ef2('0x0'));var zipdir=require(_0x9ef2('0x1'));var jsonpatch=require(_0x9ef2('0x2'));var rp=require('request-promise');var moment=require(_0x9ef2('0x3'));var BPromise=require(_0x9ef2('0x4'));var Mustache=require(_0x9ef2('0x5'));var util=require(_0x9ef2('0x6'));var path=require(_0x9ef2('0x7'));var sox=require('sox');var csv=require(_0x9ef2('0x8'));var ejs=require(_0x9ef2('0x9'));var fs=require('fs');var fs_extra=require(_0x9ef2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9ef2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9ef2('0xc'));var toCsv=require(_0x9ef2('0x8'));var querystring=require('querystring');var Papa=require(_0x9ef2('0xd'));var AWS=require('aws-sdk');var uuidv4=require(_0x9ef2('0xe'));var Redis=require(_0x9ef2('0xf'));var authService=require(_0x9ef2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9ef2('0x11'));var hardwareService=require(_0x9ef2('0x12'));var logger=require('../../config/logger')(_0x9ef2('0x13'));var utils=require('../../config/utils');var config=require(_0x9ef2('0x14'));var licenseUtil=require(_0x9ef2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d2fdb,_0x569fa1){_0x569fa1=_0x569fa1||0xcc;return function(_0x5b13a6){if(_0x5b13a6){return _0x2d2fdb[_0x9ef2('0x16')](_0x569fa1);}return _0x2d2fdb[_0x9ef2('0x17')](_0x569fa1)[_0x9ef2('0x18')]();};}function respondWithResult(_0x2f9a42,_0x336f83){_0x336f83=_0x336f83||0xc8;return function(_0x51bf95){if(_0x51bf95){return _0x2f9a42['status'](_0x336f83)['json'](_0x51bf95);}};}function respondWithFilteredResult(_0x256054,_0x1ef99d){return function(_0x305fc1){if(_0x305fc1){var _0x1b1f40=typeof _0x1ef99d[_0x9ef2('0x19')]==='undefined'&&typeof _0x1ef99d['limit']===_0x9ef2('0x1a');var _0x3c50bf=_0x305fc1['count'];var _0x3c85fb=_0x1b1f40?0x0:_0x1ef99d['offset'];var _0x51fca2=_0x1b1f40?_0x305fc1['count']:_0x1ef99d[_0x9ef2('0x19')]+_0x1ef99d[_0x9ef2('0x1b')];var _0x15460c;if(_0x51fca2>=_0x3c50bf){_0x51fca2=_0x3c50bf;_0x15460c=0xc8;}else{_0x15460c=0xce;}_0x256054[_0x9ef2('0x17')](_0x15460c);return _0x256054[_0x9ef2('0x1c')](_0x9ef2('0x1d'),_0x3c85fb+'-'+_0x51fca2+'/'+_0x3c50bf)[_0x9ef2('0x1e')](_0x305fc1);}return null;};}function patchUpdates(_0xb5249d){return function(_0x3fbe95){try{jsonpatch[_0x9ef2('0x1f')](_0x3fbe95,_0xb5249d,!![]);}catch(_0x20364a){return BPromise[_0x9ef2('0x20')](_0x20364a);}return _0x3fbe95[_0x9ef2('0x21')]();};}function saveUpdates(_0x1bf13f,_0x517d09){return function(_0x5e7daa){if(_0x5e7daa){return _0x5e7daa[_0x9ef2('0x22')](_0x1bf13f)[_0x9ef2('0x23')](function(_0xd28102){return _0xd28102;});}return null;};}function removeEntity(_0x378c5f,_0x63c143){return function(_0x2a2437){if(_0x2a2437){return _0x2a2437[_0x9ef2('0x24')]()[_0x9ef2('0x23')](function(){_0x378c5f[_0x9ef2('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58e751,_0x2ce5e6){return function(_0x1ecade){if(!_0x1ecade){_0x58e751[_0x9ef2('0x16')](0x194);}return _0x1ecade;};}function handleError(_0x390e8d,_0x4e99f2){_0x4e99f2=_0x4e99f2||0x1f4;return function(_0x14d1d4){logger[_0x9ef2('0x25')](_0x14d1d4[_0x9ef2('0x26')]);if(_0x14d1d4[_0x9ef2('0x27')]){delete _0x14d1d4[_0x9ef2('0x27')];}_0x390e8d[_0x9ef2('0x17')](_0x4e99f2)[_0x9ef2('0x28')](_0x14d1d4);};}exports[_0x9ef2('0x29')]=function(_0x46e33a,_0x38893a){var _0x53c3da={},_0x30b492={},_0x2b659b={'count':0x0,'rows':[]};var _0x3d1a3c=_[_0x9ef2('0x2a')](db[_0x9ef2('0x2b')]['rawAttributes'],function(_0x1fdf07){return{'name':_0x1fdf07[_0x9ef2('0x2c')],'type':_0x1fdf07['type'][_0x9ef2('0x2d')]};});_0x30b492[_0x9ef2('0x2e')]=_['differenceBy'](_[_0x9ef2('0x2a')](_0x3d1a3c,_0x9ef2('0x27')),[_0x9ef2('0x2f')]);_0x30b492[_0x9ef2('0x30')]=_['keys'](_0x46e33a[_0x9ef2('0x30')]);_0x30b492[_0x9ef2('0x31')]=_[_0x9ef2('0x32')](_0x30b492[_0x9ef2('0x2e')],_0x30b492[_0x9ef2('0x30')]);_0x53c3da[_0x9ef2('0x33')]=_[_0x9ef2('0x32')](_0x30b492[_0x9ef2('0x2e')],qs[_0x9ef2('0x34')](_0x46e33a[_0x9ef2('0x30')][_0x9ef2('0x34')]));_0x53c3da[_0x9ef2('0x33')]=_0x53c3da['attributes'][_0x9ef2('0x35')]?_0x53c3da[_0x9ef2('0x33')]:_0x30b492[_0x9ef2('0x2e')];if(!_0x46e33a['query']['hasOwnProperty'](_0x9ef2('0x36'))){_0x53c3da[_0x9ef2('0x1b')]=qs['limit'](_0x46e33a[_0x9ef2('0x30')][_0x9ef2('0x1b')]);_0x53c3da[_0x9ef2('0x19')]=qs[_0x9ef2('0x19')](_0x46e33a[_0x9ef2('0x30')][_0x9ef2('0x19')]);}_0x53c3da[_0x9ef2('0x37')]=qs['sort'](_0x46e33a[_0x9ef2('0x30')][_0x9ef2('0x38')]);_0x53c3da[_0x9ef2('0x39')]=qs['filters'](_[_0x9ef2('0x3a')](_0x46e33a[_0x9ef2('0x30')],_0x30b492[_0x9ef2('0x31')]),_0x3d1a3c);if(_0x46e33a[_0x9ef2('0x30')]['filter']){_0x53c3da[_0x9ef2('0x39')]=_['merge'](_0x53c3da[_0x9ef2('0x39')],{'$or':_[_0x9ef2('0x2a')](_0x3d1a3c,function(_0xf3b3f5){if(_0xf3b3f5[_0x9ef2('0x3b')]!=='VIRTUAL'){var _0x45c25d={};_0x45c25d[_0xf3b3f5[_0x9ef2('0x27')]]={'$like':'%'+_0x46e33a['query'][_0x9ef2('0x3c')]+'%'};return _0x45c25d;}})});}_0x53c3da=_['merge']({},_0x53c3da,_0x46e33a[_0x9ef2('0x3d')]);var _0x3586d0={'where':_0x53c3da[_0x9ef2('0x39')]};return db[_0x9ef2('0x2b')][_0x9ef2('0x3e')](_0x3586d0)[_0x9ef2('0x23')](function(_0x5b1f02){_0x2b659b[_0x9ef2('0x3e')]=_0x5b1f02;if(_0x46e33a[_0x9ef2('0x30')]['includeAll']){_0x53c3da[_0x9ef2('0x3f')]=[{'all':!![]}];}return db[_0x9ef2('0x2b')][_0x9ef2('0x40')](_0x53c3da);})[_0x9ef2('0x23')](function(_0x2b38a5){_0x2b659b['rows']=_0x2b38a5;return _0x2b659b;})[_0x9ef2('0x23')](respondWithFilteredResult(_0x38893a,_0x53c3da))[_0x9ef2('0x41')](handleError(_0x38893a,null));};exports['show']=function(_0x152953,_0x451380){var _0x2a7faa={'raw':![],'where':{'id':_0x152953[_0x9ef2('0x42')]['id']}},_0x280a20={};_0x280a20[_0x9ef2('0x2e')]=_[_0x9ef2('0x43')](db[_0x9ef2('0x2b')][_0x9ef2('0x44')]);_0x280a20['query']=_[_0x9ef2('0x43')](_0x152953[_0x9ef2('0x30')]);_0x280a20['filters']=_[_0x9ef2('0x32')](_0x280a20['model'],_0x280a20[_0x9ef2('0x30')]);_0x2a7faa[_0x9ef2('0x33')]=_[_0x9ef2('0x32')](_0x280a20[_0x9ef2('0x2e')],qs['fields'](_0x152953[_0x9ef2('0x30')][_0x9ef2('0x34')]));_0x2a7faa[_0x9ef2('0x33')]=_0x2a7faa['attributes'][_0x9ef2('0x35')]?_0x2a7faa[_0x9ef2('0x33')]:_0x280a20[_0x9ef2('0x2e')];if(_0x152953[_0x9ef2('0x30')]['includeAll']){_0x2a7faa['include']=[{'all':!![]}];}_0x2a7faa=_[_0x9ef2('0x45')]({},_0x2a7faa,_0x152953[_0x9ef2('0x3d')]);return db['VoiceRecording'][_0x9ef2('0x46')](_0x2a7faa)['then'](handleEntityNotFound(_0x451380,null))[_0x9ef2('0x23')](respondWithResult(_0x451380,null))[_0x9ef2('0x41')](handleError(_0x451380,null));};exports[_0x9ef2('0x47')]=function(_0x3d647d,_0x30b3a2){return db[_0x9ef2('0x2b')]['create'](_0x3d647d['body'],{})[_0x9ef2('0x23')](respondWithResult(_0x30b3a2,0xc9))[_0x9ef2('0x41')](handleError(_0x30b3a2,null));};exports[_0x9ef2('0x22')]=function(_0x4169dc,_0x446088){if(_0x4169dc[_0x9ef2('0x48')]['id']){delete _0x4169dc[_0x9ef2('0x48')]['id'];}return db[_0x9ef2('0x2b')][_0x9ef2('0x46')]({'where':{'id':_0x4169dc[_0x9ef2('0x42')]['id']}})[_0x9ef2('0x23')](handleEntityNotFound(_0x446088,null))[_0x9ef2('0x23')](saveUpdates(_0x4169dc['body'],null))[_0x9ef2('0x23')](respondWithResult(_0x446088,null))['catch'](handleError(_0x446088,null));};exports['describe']=function(_0x1f0fd3,_0x3fcbc0){return db[_0x9ef2('0x2b')][_0x9ef2('0x49')]()['then'](respondWithResult(_0x3fcbc0,null))[_0x9ef2('0x41')](handleError(_0x3fcbc0,null));};exports['download']=function(_0x562830,_0xa6384,_0x3bcb92){var _0x53e25c=require(_0x9ef2('0x4a'));var _0x32f5bd=![];var _0x464537={};if(_0x562830['query'][_0x9ef2('0x3b')]&&_0x562830[_0x9ef2('0x30')]['type']==='uniqueid'){_0x464537[_0x9ef2('0x4b')]=_0x562830[_0x9ef2('0x42')]['id'];}else{_0x464537['id']=_0x562830['params']['id'];}return db[_0x9ef2('0x2b')][_0x9ef2('0x46')]({'where':_0x464537,'attributes':['id',_0x9ef2('0x4c')],'raw':!![]})[_0x9ef2('0x23')](handleEntityNotFound(_0xa6384,null))[_0x9ef2('0x23')](function(_0x106a90){if(_0x106a90){var _0x29bd44=_0x106a90[_0x9ef2('0x4c')];var _0x2ea7bd=util[_0x9ef2('0x2f')](_0x9ef2('0x4d'),_0x29bd44);if(fs['existsSync'](_0x2ea7bd)){_0x32f5bd=!![];return _0x53e25c[_0x9ef2('0x4e')](_0x2ea7bd,_0x29bd44,config[_0x9ef2('0x4f')][_0x9ef2('0x50')])['then'](function(){return _0x106a90;});}return _0x106a90;}})['then'](function(_0x1def03){if(_0x1def03){var _0x20e335=_0x1def03[_0x9ef2('0x4c')];if(!fs[_0x9ef2('0x51')](_0x20e335)){throw new db[(_0x9ef2('0x52'))][(_0x9ef2('0x53'))](_0x9ef2('0x54'));}if(_0x1def03[_0x9ef2('0x55')]){return _0xa6384[_0x9ef2('0x56')](_0x20e335,_0x1def03[_0x9ef2('0x55')]+path['extname'](_0x20e335),function(){if(_0x32f5bd){fs[_0x9ef2('0x57')](_0x20e335);}});}else{return _0xa6384[_0x9ef2('0x56')](_0x20e335,function(_0x3332dd){if(_0x32f5bd){fs[_0x9ef2('0x57')](_0x20e335);}});}}})[_0x9ef2('0x41')](function(_0x1cbf8f){if(_0x1cbf8f[_0x9ef2('0x58')]===_0x9ef2('0x54')){_0xa6384['status'](0x194)[_0x9ef2('0x28')]('Not\x20found');}else{return handleError(_0xa6384,null);}});};exports[_0x9ef2('0x59')]=function(_0xc9c7ef,_0x3d6ff9,_0x19e1d9){var _0x5edd94=require(_0x9ef2('0x4a'));var _0x3b379f=![];var _0x31cb90={'$and':[db[_0x9ef2('0x5a')][_0x9ef2('0x39')](db[_0x9ef2('0x5a')]['fn'](_0x9ef2('0x5b'),db[_0x9ef2('0x5a')][_0x9ef2('0x5c')](_0x9ef2('0x4b'))),_0xc9c7ef[_0x9ef2('0x30')][_0x9ef2('0x5d')])]};if(_0xc9c7ef[_0x9ef2('0x30')][_0x9ef2('0x3b')]&&_0xc9c7ef[_0x9ef2('0x30')][_0x9ef2('0x3b')]==='uniqueid'){_0x31cb90['$and'][_0x9ef2('0x5e')]({'uniqueid':_0xc9c7ef[_0x9ef2('0x42')]['id']});}else{_0x31cb90[_0x9ef2('0x5f')][_0x9ef2('0x5e')]({'id':_0xc9c7ef['params']['id']});}return db[_0x9ef2('0x2b')][_0x9ef2('0x46')]({'where':_0x31cb90,'attributes':['id','value'],'raw':!![]})[_0x9ef2('0x23')](handleEntityNotFound(_0x3d6ff9,null))[_0x9ef2('0x23')](function(_0x259ff5){if(_0x259ff5){var _0x5cac82=util[_0x9ef2('0x2f')](_0x9ef2('0x4d'),_0x259ff5['value']);if(fs[_0x9ef2('0x51')](_0x5cac82)){_0x3b379f=!![];return _0x5edd94['decryptFile'](_0x5cac82,_0x259ff5[_0x9ef2('0x4c')],config[_0x9ef2('0x4f')][_0x9ef2('0x50')])['then'](function(){return _0x259ff5;});}return _0x259ff5;}})[_0x9ef2('0x23')](function(_0x590ef0){if(_0x590ef0){if(!fs[_0x9ef2('0x51')](_0x590ef0[_0x9ef2('0x4c')])){throw new db[(_0x9ef2('0x52'))][(_0x9ef2('0x53'))](_0x9ef2('0x54'));}if(_0x590ef0['filename']){return _0x3d6ff9[_0x9ef2('0x56')](_0x590ef0[_0x9ef2('0x4c')],_0x590ef0['filename']+path[_0x9ef2('0x60')](_0x590ef0['value']),function(){if(_0x3b379f){fs['unlink'](_0x590ef0[_0x9ef2('0x4c')]);}});}else{return _0x3d6ff9[_0x9ef2('0x56')](_0x590ef0['value'],function(_0x132398){if(_0x3b379f){fs[_0x9ef2('0x57')](_0x590ef0[_0x9ef2('0x4c')]);}});}}})[_0x9ef2('0x41')](handleError(_0x3d6ff9,null));};exports[_0x9ef2('0x24')]=function(_0x2c754c,_0x1a3c42){return db[_0x9ef2('0x2b')][_0x9ef2('0x46')]({'where':{'id':_0x2c754c['params']['id']}})['then'](function(_0x3cd099){if(_[_0x9ef2('0x61')](_0x3cd099)){throw new ReferenceError(_0x9ef2('0x62'));}return _0x3cd099;})[_0x9ef2('0x23')](function(_0xd086d4){var _0x4cb7dd=_0xd086d4[_0x9ef2('0x4c')];logger[_0x9ef2('0x63')](_0x9ef2('0x64'),_0x4cb7dd);if(!_[_0x9ef2('0x61')](_0xd086d4[_0x9ef2('0x4c')])&&fs['existsSync'](_0x4cb7dd)){logger[_0x9ef2('0x63')]('File:\x20\x22'+_0x4cb7dd+_0x9ef2('0x65'));fs['unlinkSync'](_0x4cb7dd);}_0x4cb7dd=_0x4cb7dd+_0x9ef2('0x66');if(!_[_0x9ef2('0x61')](_0xd086d4[_0x9ef2('0x4c')])&&fs[_0x9ef2('0x51')](_0x4cb7dd)){logger[_0x9ef2('0x63')]('File:\x20\x22'+_0x4cb7dd+_0x9ef2('0x65'));fs[_0x9ef2('0x67')](_0x4cb7dd);}return _0xd086d4;})[_0x9ef2('0x23')](function(_0x82022f){if(!_0x82022f)throw new InternalError();return _0x82022f[_0x9ef2('0x24')]();})[_0x9ef2('0x23')](function(){_0x1a3c42['status'](0xcc)[_0x9ef2('0x18')]();})[_0x9ef2('0x41')](handleError(_0x1a3c42,null));};function getBucketslist(_0x2115d2,_0x574ea5,_0x1bb634){return new Promise(function(_0x1c4c72,_0x32806a){var _0x5f0f21=new AWS['S3']({'accessKeyId':_0x574ea5,'secretAccessKey':_0x2115d2,'region':_0x1bb634});_0x5f0f21[_0x9ef2('0x68')]({},function(_0x1d3013,_0x41d6e8){if(_0x1d3013){return _0x32806a(_0x1d3013);}else{return _0x1c4c72(_0x41d6e8);}});});}function createBucket(_0x519583,_0x61cc3c,_0x311764,_0x5401ef){return new Promise(function(_0x7ed082,_0x6c1ab){var _0x573d7c=new AWS['S3']({'accessKeyId':_0x61cc3c,'secretAccessKey':_0x519583,'region':_0x311764});_0x573d7c[_0x9ef2('0x69')]({'Bucket':_0x5401ef},function(_0x4f9c30,_0x30c0f8){if(_0x4f9c30){return _0x6c1ab(_0x4f9c30);}else{return _0x7ed082(_0x30c0f8);}});});}function uploadFile(_0x15f58c,_0x2d0aec,_0xa4a81b,_0x50a37c,_0xef49a3,_0x404ce5){return new Promise(function(_0x4d5dc,_0x5af707){var _0x22803a=new AWS['S3']({'accessKeyId':_0x2d0aec,'secretAccessKey':_0x15f58c,'region':_0xa4a81b});_0x22803a[_0x9ef2('0x6a')]({'Bucket':_0x50a37c,'Key':_0xef49a3,'Body':_0x404ce5},function(_0x5d679b,_0x31013b){if(_0x5d679b){return _0x5af707(_0x5d679b);}else{return _0x4d5dc(_0x31013b);}});});}function startTranscribe(_0x26120e,_0x489ddb,_0x2fc96f,_0x43cd54,_0x1b734c,_0x137cac){return new Promise(function(_0x37960a,_0x1471c0){var _0x252b92=new AWS[(_0x9ef2('0x6b'))]({'accessKeyId':_0x489ddb,'secretAccessKey':_0x26120e,'region':_0x2fc96f});_0x252b92[_0x9ef2('0x6c')]({'TranscriptionJobName':_0x43cd54,'LanguageCode':_0x1b734c,'Media':{'MediaFileUri':_0x137cac}},function(_0x6ef33d,_0x556dc1){if(_0x6ef33d){return _0x1471c0(_0x6ef33d);}else{return _0x37960a(_0x556dc1);}});});}function transcribe(_0x57057e,_0x2ea41e,_0x56bf70,_0x36c493,_0x8a5497,_0x2d3105,_0x24be82){return new Promise(function(_0x1a5e43,_0x5051d6){var _0x2a13dd={};logger[_0x9ef2('0x63')](util[_0x9ef2('0x2f')](_0x9ef2('0x6d'),_0x57057e,_0x8a5497));return uploadFile(_0x2ea41e,_0x56bf70,_0x36c493,_0x8a5497,path[_0x9ef2('0x6e')](_0x2d3105),fs['readFileSync'](_0x2d3105))[_0x9ef2('0x23')](function(_0x5d0928){logger[_0x9ef2('0x63')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x57057e,_0x8a5497,_0x5d0928['Location']));_0x2a13dd[_0x9ef2('0x6f')]=_0x5d0928[_0x9ef2('0x70')];_0x2a13dd[_0x9ef2('0x71')]=_0x5d0928[_0x9ef2('0x72')];logger[_0x9ef2('0x63')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x57057e));return startTranscribe(_0x2ea41e,_0x56bf70,_0x36c493,uuidv4(),_0x24be82,_0x5d0928[_0x9ef2('0x72')]);})[_0x9ef2('0x23')](function(_0x49a0f0){logger[_0x9ef2('0x63')](util[_0x9ef2('0x2f')](_0x9ef2('0x73'),_0x57057e,_0x49a0f0['TranscriptionJob'][_0x9ef2('0x74')]));_0x2a13dd[_0x9ef2('0x75')]=_0x49a0f0['TranscriptionJob'][_0x9ef2('0x74')];_0x2a13dd[_0x9ef2('0x76')]=_0x49a0f0[_0x9ef2('0x77')][_0x9ef2('0x78')];return _0x1a5e43(_0x2a13dd);})[_0x9ef2('0x41')](function(_0x7a9691){return _0x5051d6(_0x7a9691);});});}exports[_0x9ef2('0x79')]=function(_0x3b0c67,_0x2c9288,_0x497ade){var _0x183786;var _0x50e193;var _0x1ce8fb;var _0x24e84f=require(_0x9ef2('0x4a'));return db[_0x9ef2('0x2b')][_0x9ef2('0x7a')]({'where':{'id':_0x3b0c67[_0x9ef2('0x42')]['id']}})[_0x9ef2('0x23')](function(_0xa971af){if(_0xa971af){var _0x2771f9=util[_0x9ef2('0x2f')]('%s.cypher',_0xa971af[_0x9ef2('0x4c')]);if(fs[_0x9ef2('0x51')](_0x2771f9)){cypher=!![];return _0x24e84f[_0x9ef2('0x4e')](_0x2771f9,_0xa971af[_0x9ef2('0x4c')],config['secrets'][_0x9ef2('0x50')])['then'](function(){return _0xa971af;});}return _0xa971af;}})['then'](function(_0x2299a1){if(!_0x2299a1){throw new db[(_0x9ef2('0x52'))][(_0x9ef2('0x53'))]('Voice\x20Recording\x20not\x20found');}_0x50e193=_0x2299a1;return db[_0x9ef2('0x7b')][_0x9ef2('0x7a')]({'where':{'id':0x1}});})[_0x9ef2('0x23')](handleEntityNotFound(_0x2c9288,null))[_0x9ef2('0x23')](function(_0x131216){if(_0x131216){_0x183786=_0x131216;if(!_0x183786[_0x9ef2('0x7c')]||!_0x183786[_0x9ef2('0x7d')]||!_0x183786[_0x9ef2('0x7e')]||!_0x183786[_0x9ef2('0x7f')]||!_0x183786['bucket']){throw new db['Sequelize'][(_0x9ef2('0x53'))](_0x9ef2('0x80'));}if(_0x3b0c67[_0x9ef2('0x48')][_0x9ef2('0x81')]&&(!_0x183786[_0x9ef2('0x82')]||!_0x183786['sentimentAccountId']||!_0x183786[_0x9ef2('0x83')]||!_0x183786[_0x9ef2('0x7f')]||!_0x183786[_0x9ef2('0x6f')])){throw new db[(_0x9ef2('0x52'))]['ValidationError'](_0x9ef2('0x84'));}return db[_0x9ef2('0x85')]['findOne']({'where':{'id':_0x183786[_0x9ef2('0x7d')]}});}})[_0x9ef2('0x23')](function(_0x19c4ad){if(!_0x19c4ad){throw new db['Sequelize'][(_0x9ef2('0x53'))](_0x9ef2('0x86'));}if(!_0x19c4ad['data1']||!_0x19c4ad[_0x9ef2('0x87')]){throw new db[(_0x9ef2('0x52'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x1ce8fb=_0x19c4ad;return getBucketslist(_0x1ce8fb['data1'],_0x1ce8fb[_0x9ef2('0x87')],_0x183786[_0x9ef2('0x7e')]);})['then'](function(_0x1fa74e){if(_0x1fa74e&&_0x1fa74e[_0x9ef2('0x88')]){var _0x39e3eb=_[_0x9ef2('0x46')](_0x1fa74e[_0x9ef2('0x88')],function(_0x4d7c84){return _0x4d7c84['Name']===_0x183786['bucket'];});if(!_0x39e3eb){logger[_0x9ef2('0x63')](util[_0x9ef2('0x2f')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x3b0c67[_0x9ef2('0x42')]['id'],_0x183786[_0x9ef2('0x6f')]));return createBucket(_0x1ce8fb[_0x9ef2('0x89')],_0x1ce8fb['data2'],_0x183786['transcribeRegion'],_0x183786['bucket']);}logger['info'](util[_0x9ef2('0x2f')](_0x9ef2('0x8a'),_0x3b0c67[_0x9ef2('0x42')]['id'],_0x183786[_0x9ef2('0x6f')]));return;}})[_0x9ef2('0x23')](function(_0x1ca09f){if(_0x50e193[_0x9ef2('0x76')]==='NEW'){return transcribe(_0x3b0c67[_0x9ef2('0x42')]['id'],_0x1ce8fb['data1'],_0x1ce8fb[_0x9ef2('0x87')],_0x183786[_0x9ef2('0x7e')],_0x183786['bucket'],_0x50e193[_0x9ef2('0x4c')],_0x183786[_0x9ef2('0x7f')]);}else{logger[_0x9ef2('0x63')](util[_0x9ef2('0x2f')](_0x9ef2('0x8b'),_0x3b0c67[_0x9ef2('0x42')]['id']));return{'transcribeStatus':_0x9ef2('0x8c')};}})[_0x9ef2('0x23')](function(_0x3c4ddc){if(_0x3c4ddc){_0x3c4ddc[_0x9ef2('0x8d')]=_0x3b0c67[_0x9ef2('0x48')][_0x9ef2('0x81')];return _0x50e193[_0x9ef2('0x8e')](_0x3c4ddc);}})[_0x9ef2('0x23')](respondWithResult(_0x2c9288,null))['catch'](handleError(_0x2c9288,null));};function writeFile(_0x28be9a,_0xe6c6af){return new Promise(function(_0x2f7013,_0x5d5078){fs[_0x9ef2('0x8f')](_0xe6c6af,_0x28be9a,function(_0x383ee2,_0x2e3cf9){if(_0x383ee2){return _0x5d5078(_0x383ee2);}else{return _0x2f7013(_0x2e3cf9);}});});}exports[_0x9ef2('0x90')]=function(_0x1fbc5a,_0x23ca94,_0x36b59c){return db[_0x9ef2('0x2b')][_0x9ef2('0x7a')]({'where':{'id':_0x1fbc5a[_0x9ef2('0x42')]['id']}})[_0x9ef2('0x23')](handleEntityNotFound(_0x23ca94))[_0x9ef2('0x23')](function(_0x2dee9e){if(_0x2dee9e&&_0x2dee9e['fileText']){var _0x5ef419=_0x2dee9e[_0x9ef2('0x91')];var _0x415c06=config[_0x9ef2('0x92')]+'/server/files/transcribes/transcribe_'+_0x2dee9e['id']+_0x9ef2('0x93');if(fs[_0x9ef2('0x51')](_0x415c06)){return _0x415c06;}return writeFile(_0x5ef419,_0x415c06)[_0x9ef2('0x23')](function(){return _0x415c06;});}else{throw new db[(_0x9ef2('0x52'))][(_0x9ef2('0x53'))](_0x9ef2('0x94'));}})[_0x9ef2('0x23')](function(_0xda8aac){return _0x23ca94['download'](_0xda8aac);})['catch'](handleError(_0x23ca94));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index f74f87a..fb16bcc 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 _0xcb63=['rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x591965,_0xe2bcbf){var _0x21afeb=function(_0xa93a48){while(--_0xa93a48){_0x591965['push'](_0x591965['shift']());}};_0x21afeb(++_0xe2bcbf);}(_0xcb63,0x96));var _0x3cb6=function(_0x6ceb58,_0x5d19f7){_0x6ceb58=_0x6ceb58-0x0;var _0x479a11=_0xcb63[_0x6ceb58];return _0x479a11;};'use strict';var _=require(_0x3cb6('0x0'));var util=require(_0x3cb6('0x1'));var logger=require(_0x3cb6('0x2'))(_0x3cb6('0x3'));var moment=require(_0x3cb6('0x4'));var BPromise=require('bluebird');var rp=require(_0x3cb6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3cb6('0x6'));var config=require(_0x3cb6('0x7'));var attributes=require(_0x3cb6('0x8'));module[_0x3cb6('0x9')]=function(_0x39e9b9,_0x193e94){return _0x39e9b9[_0x3cb6('0xa')](_0x3cb6('0xb'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x3cb6('0xc'),'fields':[_0x3cb6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb9c6=['api','bluebird','request-promise','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','lodash','util','../../config/logger'];(function(_0x46061f,_0x467a6e){var _0x185e53=function(_0x2cc85c){while(--_0x2cc85c){_0x46061f['push'](_0x46061f['shift']());}};_0x185e53(++_0x467a6e);}(_0xb9c6,0x1aa));var _0x6b9c=function(_0xd93cf7,_0xc8445b){_0xd93cf7=_0xd93cf7-0x0;var _0x2791eb=_0xb9c6[_0xd93cf7];return _0x2791eb;};'use strict';var _=require(_0x6b9c('0x0'));var util=require(_0x6b9c('0x1'));var logger=require(_0x6b9c('0x2'))(_0x6b9c('0x3'));var moment=require('moment');var BPromise=require(_0x6b9c('0x4'));var rp=require(_0x6b9c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6b9c('0x6'));module[_0x6b9c('0x7')]=function(_0x2f68ff,_0x48e470){return _0x2f68ff[_0x6b9c('0x8')](_0x6b9c('0x9'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x6b9c('0xa'),'fields':[_0x6b9c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 7885815..b2be745 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(_0x4584ce,_0x487aa7){var _0x2e3b0e=function(_0x37763d){while(--_0x37763d){_0x4584ce['push'](_0x4584ce['shift']());}};_0x2e3b0e(++_0x487aa7);}(_0xc2c7,0x134));var _0x7c2c=function(_0x46bbcc,_0x5f0ecb){_0x46bbcc=_0x46bbcc-0x0;var _0x5bb020=_0xc2c7[_0x46bbcc];return _0x5bb020;};'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 _0x32b6=['jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','info','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','limit','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x32b6,0x1d1));var _0x632b=function(_0x35aaf9,_0x5bbe6f){_0x35aaf9=_0x35aaf9-0x0;var _0xb992fe=_0x32b6[_0x35aaf9];return _0xb992fe;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('VoiceRecording,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});}exports[_0x632b('0x15')]=function(_0x3bb27f){var _0x28c472=this;return new Promise(function(_0x51c894,_0x2f3e88){return db[_0x632b('0x16')][_0x632b('0x17')](_0x3bb27f[_0x632b('0x18')],{'raw':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')][_0x632b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')]['where']||null:null,'attributes':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')]['attributes']||null:null,'limit':_0x3bb27f[_0x632b('0x19')]?_0x3bb27f[_0x632b('0x19')][_0x632b('0x1b')]||null:null})['then'](function(_0x10fc32){logger[_0x632b('0x14')]('UpdateVoiceRecording',_0x3bb27f);logger[_0x632b('0xd')](_0x632b('0x15'),_0x3bb27f,JSON[_0x632b('0xf')](_0x10fc32));_0x51c894(_0x10fc32);})[_0x632b('0x1c')](function(_0x45d017){logger[_0x632b('0x10')]('UpdateVoiceRecording',_0x45d017['message'],_0x3bb27f);_0x2f3e88(_0x28c472[_0x632b('0x10')](0x1f4,_0x45d017['message']));});});};exports[_0x632b('0x1d')]=function(_0x954fa0){var _0x5d6855=this;return new Promise(function(_0x273e89,_0x3f4eab){var _0x29d9aa=require(_0x632b('0x1e'));var _0x4728a8;return db[_0x632b('0x1f')][_0x632b('0x20')]({'attributes':['id',_0x632b('0x21')],'where':{'id':0x1},'raw':!![]})[_0x632b('0xc')](function(_0x4f8410){_0x4728a8=_0x4f8410;return db[_0x632b('0x16')][_0x632b('0x22')](_0x954fa0[_0x632b('0x18')]);})[_0x632b('0xc')](function(_0x17a5ba){if(_0x4728a8[_0x632b('0x21')]&&fs[_0x632b('0x23')](_0x17a5ba[_0x632b('0x24')])){var _0x1ace1b=util[_0x632b('0x25')](_0x632b('0x26'),_0x17a5ba[_0x632b('0x24')]);return _0x29d9aa[_0x632b('0x27')](_0x17a5ba[_0x632b('0x24')],_0x1ace1b,config[_0x632b('0x28')][_0x632b('0x29')])[_0x632b('0xc')](function(){fs[_0x632b('0x2a')](_0x17a5ba[_0x632b('0x24')]);logger[_0x632b('0x14')]('CreateVoiceRecording\x20file\x20encrypted');return _0x17a5ba;});}return _0x17a5ba;})[_0x632b('0xc')](function(_0x4401dc){logger[_0x632b('0x14')](_0x632b('0x1d'),_0x954fa0);logger['debug'](_0x632b('0x1d'),_0x954fa0,JSON['stringify'](_0x4401dc));_0x273e89(_0x4401dc);})[_0x632b('0x1c')](function(_0x15b22d){logger['error'](_0x632b('0x1d'),_0x15b22d[_0x632b('0x13')],_0x954fa0);_0x3f4eab(_0x5d6855[_0x632b('0x10')](0x1f4,_0x15b22d[_0x632b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 3223917..c300d43 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 _0x961d=['index','/describe','describe','get','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated'];(function(_0x351876,_0x317334){var _0x43302b=function(_0x216209){while(--_0x216209){_0x351876['push'](_0x351876['shift']());}};_0x43302b(++_0x317334);}(_0x961d,0x11c));var _0xd961=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x961d[_0x455c6c];return _0x488242;};'use strict';var multer=require(_0xd961('0x0'));var util=require(_0xd961('0x1'));var path=require(_0xd961('0x2'));var timeout=require(_0xd961('0x3'));var express=require('express');var router=express[_0xd961('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd961('0x5'));var interaction=require(_0xd961('0x6'));var config=require(_0xd961('0x7'));var controller=require(_0xd961('0x8'));router['get']('/',auth[_0xd961('0x9')](),controller[_0xd961('0xa')]);router['get'](_0xd961('0xb'),auth[_0xd961('0x9')](),controller[_0xd961('0xc')]);router[_0xd961('0xd')](_0xd961('0xe'),auth[_0xd961('0x9')](),controller['show']);router[_0xd961('0xf')]('/',auth[_0xd961('0x9')](),controller[_0xd961('0x10')]);router[_0xd961('0x11')](_0xd961('0xe'),auth[_0xd961('0x9')](),controller[_0xd961('0x12')]);router[_0xd961('0x13')]('/:id',auth[_0xd961('0x9')](),controller['destroy']);module[_0xd961('0x14')]=router; \ No newline at end of file +var _0xad96=['fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','destroy','exports','util','connect-timeout'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xad96,0x1a7));var _0x6ad9=function(_0x4051e8,_0x5e367f){_0x4051e8=_0x4051e8-0x0;var _0x4d084c=_0xad96[_0x4051e8];return _0x4d084c;};'use strict';var multer=require('multer');var util=require(_0x6ad9('0x0'));var path=require('path');var timeout=require(_0x6ad9('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6ad9('0x2'));var auth=require(_0x6ad9('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6ad9('0x4'));var controller=require(_0x6ad9('0x5'));router[_0x6ad9('0x6')]('/',auth[_0x6ad9('0x7')](),controller[_0x6ad9('0x8')]);router[_0x6ad9('0x6')](_0x6ad9('0x9'),auth[_0x6ad9('0x7')](),controller[_0x6ad9('0xa')]);router[_0x6ad9('0x6')](_0x6ad9('0xb'),auth[_0x6ad9('0x7')](),controller[_0x6ad9('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6ad9('0xd')]('/:id',auth[_0x6ad9('0x7')](),controller[_0x6ad9('0xe')]);router['delete'](_0x6ad9('0xb'),auth[_0x6ad9('0x7')](),controller[_0x6ad9('0xf')]);module[_0x6ad9('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 01cc294..3c647b9 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 _0x795a=['Yes','moment','exports','attended','STRING','ENUM'];(function(_0x316e0d,_0x3e4605){var _0x57b4e2=function(_0x5afef4){while(--_0x5afef4){_0x316e0d['push'](_0x316e0d['shift']());}};_0x57b4e2(++_0x3e4605);}(_0x795a,0xeb));var _0xa795=function(_0x5b81b8,_0x1fec44){_0x5b81b8=_0x5b81b8-0x0;var _0x38620d=_0x795a[_0x5b81b8];return _0x38620d;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa795('0x0'));module[_0xa795('0x1')]={'type':{'type':Sequelize['ENUM']('blind',_0xa795('0x2'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xa795('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xa795('0x3')]},'transferercalleridname':{'type':Sequelize[_0xa795('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xa795('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xa795('0x3')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xa795('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xa795('0x3')]},'transfereechannel':{'type':Sequelize[_0xa795('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0xa795('0x3')]},'transfereecalleridname':{'type':Sequelize[_0xa795('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xa795('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xa795('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xa795('0x3')]},'transfereecontext':{'type':Sequelize[_0xa795('0x3')]},'transfereeexten':{'type':Sequelize[_0xa795('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xa795('0x3')]},'isexternal':{'type':Sequelize[_0xa795('0x4')](_0xa795('0x5'),'No')},'context':{'type':Sequelize[_0xa795('0x3')]},'extension':{'type':Sequelize[_0xa795('0x3')]}}; \ No newline at end of file +var _0x66ff=['exports','ENUM','blind','STRING','Yes','sequelize','moment'];(function(_0x2ae560,_0x265028){var _0x45724d=function(_0x4ef019){while(--_0x4ef019){_0x2ae560['push'](_0x2ae560['shift']());}};_0x45724d(++_0x265028);}(_0x66ff,0xfa));var _0xf66f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x66ff[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf66f('0x0'));var moment=require(_0xf66f('0x1'));module[_0xf66f('0x2')]={'type':{'type':Sequelize[_0xf66f('0x3')](_0xf66f('0x4'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xf66f('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xf66f('0x5')]},'transferercalleridname':{'type':Sequelize[_0xf66f('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xf66f('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0xf66f('0x5')]},'transfereechannel':{'type':Sequelize[_0xf66f('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xf66f('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xf66f('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xf66f('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xf66f('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xf66f('0x5')]},'transfereeexten':{'type':Sequelize[_0xf66f('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xf66f('0x5')]},'isexternal':{'type':Sequelize[_0xf66f('0x3')](_0xf66f('0x6'),'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 27b8f27..7c45319 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 _0xef73=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','squel'];(function(_0x56f1fb,_0x3098b5){var _0x50d105=function(_0x4404cc){while(--_0x4404cc){_0x56f1fb['push'](_0x56f1fb['shift']());}};_0x50d105(++_0x3098b5);}(_0xef73,0x11e));var _0x3ef7=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0xef73[_0x2dea24];return _0x309d58;};'use strict';var emlformat=require(_0x3ef7('0x0'));var rimraf=require(_0x3ef7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ef7('0x2'));var rp=require('request-promise');var moment=require(_0x3ef7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3ef7('0x4'));var path=require(_0x3ef7('0x5'));var sox=require(_0x3ef7('0x6'));var csv=require(_0x3ef7('0x7'));var ejs=require(_0x3ef7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3ef7('0x9'));var crypto=require(_0x3ef7('0xa'));var jsforce=require(_0x3ef7('0xb'));var deskjs=require(_0x3ef7('0xc'));var toCsv=require(_0x3ef7('0x7'));var querystring=require('querystring');var Papa=require(_0x3ef7('0xd'));var Redis=require(_0x3ef7('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3ef7('0xf'));var as=require(_0x3ef7('0x10'));var hardwareService=require(_0x3ef7('0x11'));var logger=require(_0x3ef7('0x12'))(_0x3ef7('0x13'));var utils=require(_0x3ef7('0x14'));var config=require(_0x3ef7('0x15'));var licenseUtil=require(_0x3ef7('0x16'));var db=require(_0x3ef7('0x17'))['db'];function respondWithStatusCode(_0x51e346,_0x1df28e){_0x1df28e=_0x1df28e||0xcc;return function(_0x327fd2){if(_0x327fd2){return _0x51e346['sendStatus'](_0x1df28e);}return _0x51e346[_0x3ef7('0x18')](_0x1df28e)[_0x3ef7('0x19')]();};}function respondWithResult(_0x158aad,_0x51e5a){_0x51e5a=_0x51e5a||0xc8;return function(_0x3ac256){if(_0x3ac256){return _0x158aad[_0x3ef7('0x18')](_0x51e5a)['json'](_0x3ac256);}};}function respondWithFilteredResult(_0x4ce3e4,_0x56ef8b){return function(_0x3dc907){if(_0x3dc907){var _0x1b2f1d=typeof _0x56ef8b[_0x3ef7('0x1a')]===_0x3ef7('0x1b')&&typeof _0x56ef8b[_0x3ef7('0x1c')]==='undefined';var _0x3611f4=_0x3dc907[_0x3ef7('0x1d')];var _0x1e4f58=_0x1b2f1d?0x0:_0x56ef8b[_0x3ef7('0x1a')];var _0x22437e=_0x1b2f1d?_0x3dc907[_0x3ef7('0x1d')]:_0x56ef8b[_0x3ef7('0x1a')]+_0x56ef8b[_0x3ef7('0x1c')];var _0x2770ca;if(_0x22437e>=_0x3611f4){_0x22437e=_0x3611f4;_0x2770ca=0xc8;}else{_0x2770ca=0xce;}_0x4ce3e4[_0x3ef7('0x18')](_0x2770ca);return _0x4ce3e4['set'](_0x3ef7('0x1e'),_0x1e4f58+'-'+_0x22437e+'/'+_0x3611f4)[_0x3ef7('0x1f')](_0x3dc907);}return null;};}function patchUpdates(_0x5da1dd){return function(_0x53005c){try{jsonpatch[_0x3ef7('0x20')](_0x53005c,_0x5da1dd,!![]);}catch(_0x5185b7){return BPromise[_0x3ef7('0x21')](_0x5185b7);}return _0x53005c['save']();};}function saveUpdates(_0xb72f74,_0x117b92){return function(_0xeeea27){if(_0xeeea27){return _0xeeea27[_0x3ef7('0x22')](_0xb72f74)['then'](function(_0x2f6f12){return _0x2f6f12;});}return null;};}function removeEntity(_0x4ab0da,_0x266ba0){return function(_0x58e64b){if(_0x58e64b){return _0x58e64b[_0x3ef7('0x23')]()[_0x3ef7('0x24')](function(){_0x4ab0da[_0x3ef7('0x18')](0xcc)[_0x3ef7('0x19')]();});}};}function handleEntityNotFound(_0xddc59d,_0x3ce570){return function(_0x24d128){if(!_0x24d128){_0xddc59d['sendStatus'](0x194);}return _0x24d128;};}function handleError(_0x45a454,_0x3569d0){_0x3569d0=_0x3569d0||0x1f4;return function(_0x3fc709){logger[_0x3ef7('0x25')](_0x3fc709['stack']);if(_0x3fc709[_0x3ef7('0x26')]){delete _0x3fc709[_0x3ef7('0x26')];}_0x45a454[_0x3ef7('0x18')](_0x3569d0)[_0x3ef7('0x27')](_0x3fc709);};}exports[_0x3ef7('0x28')]=function(_0x2e194d,_0x47c8f7){var _0x5460fd={},_0x150e44={},_0x5d6e7b={'count':0x0,'rows':[]};var _0x590c38=_[_0x3ef7('0x29')](db[_0x3ef7('0x2a')][_0x3ef7('0x2b')],function(_0x2d6d64){return{'name':_0x2d6d64[_0x3ef7('0x2c')],'type':_0x2d6d64[_0x3ef7('0x2d')][_0x3ef7('0x2e')]};});_0x150e44[_0x3ef7('0x2f')]=_[_0x3ef7('0x29')](_0x590c38,_0x3ef7('0x26'));_0x150e44[_0x3ef7('0x30')]=_['keys'](_0x2e194d[_0x3ef7('0x30')]);_0x150e44[_0x3ef7('0x31')]=_[_0x3ef7('0x32')](_0x150e44[_0x3ef7('0x2f')],_0x150e44[_0x3ef7('0x30')]);_0x5460fd[_0x3ef7('0x33')]=_[_0x3ef7('0x32')](_0x150e44[_0x3ef7('0x2f')],qs[_0x3ef7('0x34')](_0x2e194d[_0x3ef7('0x30')][_0x3ef7('0x34')]));_0x5460fd[_0x3ef7('0x33')]=_0x5460fd[_0x3ef7('0x33')][_0x3ef7('0x35')]?_0x5460fd[_0x3ef7('0x33')]:_0x150e44['model'];if(!_0x2e194d[_0x3ef7('0x30')][_0x3ef7('0x36')](_0x3ef7('0x37'))){_0x5460fd[_0x3ef7('0x1c')]=qs[_0x3ef7('0x1c')](_0x2e194d[_0x3ef7('0x30')][_0x3ef7('0x1c')]);_0x5460fd[_0x3ef7('0x1a')]=qs[_0x3ef7('0x1a')](_0x2e194d[_0x3ef7('0x30')]['offset']);}_0x5460fd[_0x3ef7('0x38')]=qs[_0x3ef7('0x39')](_0x2e194d[_0x3ef7('0x30')][_0x3ef7('0x39')]);_0x5460fd['where']=qs[_0x3ef7('0x31')](_[_0x3ef7('0x3a')](_0x2e194d[_0x3ef7('0x30')],_0x150e44[_0x3ef7('0x31')]),_0x590c38);if(_0x2e194d[_0x3ef7('0x30')][_0x3ef7('0x3b')]){_0x5460fd[_0x3ef7('0x3c')]=_[_0x3ef7('0x3d')](_0x5460fd[_0x3ef7('0x3c')],{'$or':_[_0x3ef7('0x29')](_0x590c38,function(_0x3c1f38){if(_0x3c1f38['type']!==_0x3ef7('0x3e')){var _0x1b9681={};_0x1b9681[_0x3c1f38[_0x3ef7('0x26')]]={'$like':'%'+_0x2e194d[_0x3ef7('0x30')][_0x3ef7('0x3b')]+'%'};return _0x1b9681;}})});}_0x5460fd=_[_0x3ef7('0x3d')]({},_0x5460fd,_0x2e194d[_0x3ef7('0x3f')]);var _0x2c6da1={'where':_0x5460fd[_0x3ef7('0x3c')]};return db['VoiceTransferReport'][_0x3ef7('0x1d')](_0x2c6da1)[_0x3ef7('0x24')](function(_0x1dc7f8){_0x5d6e7b['count']=_0x1dc7f8;if(_0x2e194d[_0x3ef7('0x30')][_0x3ef7('0x40')]){_0x5460fd[_0x3ef7('0x41')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x3ef7('0x42')](_0x5460fd);})[_0x3ef7('0x24')](function(_0xae936a){_0x5d6e7b[_0x3ef7('0x43')]=_0xae936a;return _0x5d6e7b;})[_0x3ef7('0x24')](respondWithFilteredResult(_0x47c8f7,_0x5460fd))[_0x3ef7('0x44')](handleError(_0x47c8f7,null));};exports['show']=function(_0xaa94fd,_0x9f9b2d){var _0x590c32={'raw':!![],'where':{'id':_0xaa94fd['params']['id']}},_0x5a69bc={};_0x5a69bc[_0x3ef7('0x2f')]=_['keys'](db[_0x3ef7('0x2a')][_0x3ef7('0x2b')]);_0x5a69bc[_0x3ef7('0x30')]=_['keys'](_0xaa94fd['query']);_0x5a69bc[_0x3ef7('0x31')]=_[_0x3ef7('0x32')](_0x5a69bc[_0x3ef7('0x2f')],_0x5a69bc[_0x3ef7('0x30')]);_0x590c32[_0x3ef7('0x33')]=_[_0x3ef7('0x32')](_0x5a69bc[_0x3ef7('0x2f')],qs[_0x3ef7('0x34')](_0xaa94fd[_0x3ef7('0x30')]['fields']));_0x590c32['attributes']=_0x590c32[_0x3ef7('0x33')][_0x3ef7('0x35')]?_0x590c32[_0x3ef7('0x33')]:_0x5a69bc[_0x3ef7('0x2f')];if(_0xaa94fd[_0x3ef7('0x30')][_0x3ef7('0x40')]){_0x590c32['include']=[{'all':!![]}];}_0x590c32=_[_0x3ef7('0x3d')]({},_0x590c32,_0xaa94fd['options']);return db[_0x3ef7('0x2a')]['find'](_0x590c32)[_0x3ef7('0x24')](handleEntityNotFound(_0x9f9b2d,null))[_0x3ef7('0x24')](respondWithResult(_0x9f9b2d,null))['catch'](handleError(_0x9f9b2d,null));};exports[_0x3ef7('0x45')]=function(_0x46600f,_0x272909){return db[_0x3ef7('0x2a')][_0x3ef7('0x45')](_0x46600f[_0x3ef7('0x46')],{})[_0x3ef7('0x24')](respondWithResult(_0x272909,0xc9))[_0x3ef7('0x44')](handleError(_0x272909,null));};exports[_0x3ef7('0x22')]=function(_0x201cd7,_0x440f30){if(_0x201cd7[_0x3ef7('0x46')]['id']){delete _0x201cd7['body']['id'];}return db[_0x3ef7('0x2a')][_0x3ef7('0x47')]({'where':{'id':_0x201cd7['params']['id']}})['then'](handleEntityNotFound(_0x440f30,null))['then'](saveUpdates(_0x201cd7[_0x3ef7('0x46')],null))[_0x3ef7('0x24')](respondWithResult(_0x440f30,null))[_0x3ef7('0x44')](handleError(_0x440f30,null));};exports[_0x3ef7('0x23')]=function(_0x136a42,_0x633ca3){return db[_0x3ef7('0x2a')][_0x3ef7('0x47')]({'where':{'id':_0x136a42[_0x3ef7('0x48')]['id']}})[_0x3ef7('0x24')](handleEntityNotFound(_0x633ca3,null))[_0x3ef7('0x24')](removeEntity(_0x633ca3,null))[_0x3ef7('0x44')](handleError(_0x633ca3,null));};exports[_0x3ef7('0x49')]=function(_0x46b1d9,_0x5b2e91){return db[_0x3ef7('0x2a')][_0x3ef7('0x49')]()[_0x3ef7('0x24')](respondWithResult(_0x5b2e91,null))['catch'](handleError(_0x5b2e91,null));}; \ No newline at end of file +var _0xf2d5=['moment','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','stack','send','map','rawAttributes','fieldName','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','type','merge','options','VoiceTransferReport','includeAll','catch','show','include','create','body','update','params','find','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2d5,0x164));var _0x5f2d=function(_0x5afb58,_0x23d321){_0x5afb58=_0x5afb58-0x0;var _0x486aa=_0xf2d5[_0x5afb58];return _0x486aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f2d('0x0'));var zipdir=require(_0x5f2d('0x1'));var jsonpatch=require(_0x5f2d('0x2'));var rp=require(_0x5f2d('0x3'));var moment=require(_0x5f2d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5f2d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5f2d('0x6'));var csv=require(_0x5f2d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f2d('0x8'));var _=require('lodash');var squel=require(_0x5f2d('0x9'));var crypto=require(_0x5f2d('0xa'));var jsforce=require(_0x5f2d('0xb'));var deskjs=require(_0x5f2d('0xc'));var toCsv=require(_0x5f2d('0x7'));var querystring=require(_0x5f2d('0xd'));var Papa=require('papaparse');var Redis=require(_0x5f2d('0xe'));var authService=require(_0x5f2d('0xf'));var qs=require(_0x5f2d('0x10'));var as=require(_0x5f2d('0x11'));var hardwareService=require(_0x5f2d('0x12'));var logger=require(_0x5f2d('0x13'))(_0x5f2d('0x14'));var utils=require(_0x5f2d('0x15'));var config=require(_0x5f2d('0x16'));var licenseUtil=require(_0x5f2d('0x17'));var db=require(_0x5f2d('0x18'))['db'];function respondWithStatusCode(_0x368b32,_0x2dbfca){_0x2dbfca=_0x2dbfca||0xcc;return function(_0x330b8b){if(_0x330b8b){return _0x368b32[_0x5f2d('0x19')](_0x2dbfca);}return _0x368b32[_0x5f2d('0x1a')](_0x2dbfca)['end']();};}function respondWithResult(_0xcd0c5e,_0x330147){_0x330147=_0x330147||0xc8;return function(_0x2dc428){if(_0x2dc428){return _0xcd0c5e[_0x5f2d('0x1a')](_0x330147)[_0x5f2d('0x1b')](_0x2dc428);}};}function respondWithFilteredResult(_0x3ed1bd,_0x25c7a0){return function(_0x4cb730){if(_0x4cb730){var _0x470088=typeof _0x25c7a0[_0x5f2d('0x1c')]===_0x5f2d('0x1d')&&typeof _0x25c7a0[_0x5f2d('0x1e')]===_0x5f2d('0x1d');var _0x1b6a5c=_0x4cb730[_0x5f2d('0x1f')];var _0xedbec9=_0x470088?0x0:_0x25c7a0[_0x5f2d('0x1c')];var _0x1db892=_0x470088?_0x4cb730['count']:_0x25c7a0[_0x5f2d('0x1c')]+_0x25c7a0[_0x5f2d('0x1e')];var _0x1aad51;if(_0x1db892>=_0x1b6a5c){_0x1db892=_0x1b6a5c;_0x1aad51=0xc8;}else{_0x1aad51=0xce;}_0x3ed1bd[_0x5f2d('0x1a')](_0x1aad51);return _0x3ed1bd['set'](_0x5f2d('0x20'),_0xedbec9+'-'+_0x1db892+'/'+_0x1b6a5c)[_0x5f2d('0x1b')](_0x4cb730);}return null;};}function patchUpdates(_0x56c31b){return function(_0x58cb10){try{jsonpatch[_0x5f2d('0x21')](_0x58cb10,_0x56c31b,!![]);}catch(_0x498b63){return BPromise[_0x5f2d('0x22')](_0x498b63);}return _0x58cb10['save']();};}function saveUpdates(_0x4adfbb,_0xacd84f){return function(_0x25a153){if(_0x25a153){return _0x25a153['update'](_0x4adfbb)[_0x5f2d('0x23')](function(_0xb062d6){return _0xb062d6;});}return null;};}function removeEntity(_0x4cb431,_0xb38993){return function(_0x28418a){if(_0x28418a){return _0x28418a[_0x5f2d('0x24')]()['then'](function(){_0x4cb431[_0x5f2d('0x1a')](0xcc)[_0x5f2d('0x25')]();});}};}function handleEntityNotFound(_0xbc0a5a,_0x10e656){return function(_0x153fda){if(!_0x153fda){_0xbc0a5a[_0x5f2d('0x19')](0x194);}return _0x153fda;};}function handleError(_0x1a74ac,_0x5c3c03){_0x5c3c03=_0x5c3c03||0x1f4;return function(_0x310d98){logger[_0x5f2d('0x26')](_0x310d98[_0x5f2d('0x27')]);if(_0x310d98['name']){delete _0x310d98['name'];}_0x1a74ac[_0x5f2d('0x1a')](_0x5c3c03)[_0x5f2d('0x28')](_0x310d98);};}exports['index']=function(_0xfd491,_0x26f3ac){var _0x50320c={},_0x38be87={},_0x4c38f7={'count':0x0,'rows':[]};var _0x403c74=_[_0x5f2d('0x29')](db['VoiceTransferReport'][_0x5f2d('0x2a')],function(_0x2e1610){return{'name':_0x2e1610[_0x5f2d('0x2b')],'type':_0x2e1610['type']['key']};});_0x38be87[_0x5f2d('0x2c')]=_[_0x5f2d('0x29')](_0x403c74,_0x5f2d('0x2d'));_0x38be87[_0x5f2d('0x2e')]=_[_0x5f2d('0x2f')](_0xfd491[_0x5f2d('0x2e')]);_0x38be87['filters']=_[_0x5f2d('0x30')](_0x38be87[_0x5f2d('0x2c')],_0x38be87[_0x5f2d('0x2e')]);_0x50320c[_0x5f2d('0x31')]=_[_0x5f2d('0x30')](_0x38be87['model'],qs[_0x5f2d('0x32')](_0xfd491[_0x5f2d('0x2e')][_0x5f2d('0x32')]));_0x50320c[_0x5f2d('0x31')]=_0x50320c['attributes'][_0x5f2d('0x33')]?_0x50320c[_0x5f2d('0x31')]:_0x38be87[_0x5f2d('0x2c')];if(!_0xfd491[_0x5f2d('0x2e')][_0x5f2d('0x34')]('nolimit')){_0x50320c['limit']=qs[_0x5f2d('0x1e')](_0xfd491[_0x5f2d('0x2e')]['limit']);_0x50320c['offset']=qs[_0x5f2d('0x1c')](_0xfd491[_0x5f2d('0x2e')][_0x5f2d('0x1c')]);}_0x50320c['order']=qs[_0x5f2d('0x35')](_0xfd491[_0x5f2d('0x2e')]['sort']);_0x50320c[_0x5f2d('0x36')]=qs[_0x5f2d('0x37')](_[_0x5f2d('0x38')](_0xfd491[_0x5f2d('0x2e')],_0x38be87['filters']),_0x403c74);if(_0xfd491[_0x5f2d('0x2e')][_0x5f2d('0x39')]){_0x50320c['where']=_['merge'](_0x50320c[_0x5f2d('0x36')],{'$or':_['map'](_0x403c74,function(_0x37411c){if(_0x37411c[_0x5f2d('0x3a')]!=='VIRTUAL'){var _0x4eb49b={};_0x4eb49b[_0x37411c[_0x5f2d('0x2d')]]={'$like':'%'+_0xfd491['query']['filter']+'%'};return _0x4eb49b;}})});}_0x50320c=_[_0x5f2d('0x3b')]({},_0x50320c,_0xfd491[_0x5f2d('0x3c')]);var _0xe2f8b4={'where':_0x50320c[_0x5f2d('0x36')]};return db[_0x5f2d('0x3d')]['count'](_0xe2f8b4)[_0x5f2d('0x23')](function(_0x505e41){_0x4c38f7[_0x5f2d('0x1f')]=_0x505e41;if(_0xfd491['query'][_0x5f2d('0x3e')]){_0x50320c['include']=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x50320c);})[_0x5f2d('0x23')](function(_0x421008){_0x4c38f7['rows']=_0x421008;return _0x4c38f7;})[_0x5f2d('0x23')](respondWithFilteredResult(_0x26f3ac,_0x50320c))[_0x5f2d('0x3f')](handleError(_0x26f3ac,null));};exports[_0x5f2d('0x40')]=function(_0x501a4b,_0x438566){var _0x14dfff={'raw':!![],'where':{'id':_0x501a4b['params']['id']}},_0x259ef8={};_0x259ef8[_0x5f2d('0x2c')]=_[_0x5f2d('0x2f')](db[_0x5f2d('0x3d')][_0x5f2d('0x2a')]);_0x259ef8[_0x5f2d('0x2e')]=_[_0x5f2d('0x2f')](_0x501a4b[_0x5f2d('0x2e')]);_0x259ef8[_0x5f2d('0x37')]=_[_0x5f2d('0x30')](_0x259ef8[_0x5f2d('0x2c')],_0x259ef8['query']);_0x14dfff[_0x5f2d('0x31')]=_[_0x5f2d('0x30')](_0x259ef8['model'],qs['fields'](_0x501a4b[_0x5f2d('0x2e')]['fields']));_0x14dfff['attributes']=_0x14dfff[_0x5f2d('0x31')]['length']?_0x14dfff[_0x5f2d('0x31')]:_0x259ef8['model'];if(_0x501a4b['query'][_0x5f2d('0x3e')]){_0x14dfff[_0x5f2d('0x41')]=[{'all':!![]}];}_0x14dfff=_[_0x5f2d('0x3b')]({},_0x14dfff,_0x501a4b[_0x5f2d('0x3c')]);return db[_0x5f2d('0x3d')]['find'](_0x14dfff)[_0x5f2d('0x23')](handleEntityNotFound(_0x438566,null))['then'](respondWithResult(_0x438566,null))[_0x5f2d('0x3f')](handleError(_0x438566,null));};exports[_0x5f2d('0x42')]=function(_0x4fe676,_0x41be8b){return db[_0x5f2d('0x3d')]['create'](_0x4fe676[_0x5f2d('0x43')],{})[_0x5f2d('0x23')](respondWithResult(_0x41be8b,0xc9))[_0x5f2d('0x3f')](handleError(_0x41be8b,null));};exports[_0x5f2d('0x44')]=function(_0x25b4dd,_0x43ecf1){if(_0x25b4dd[_0x5f2d('0x43')]['id']){delete _0x25b4dd[_0x5f2d('0x43')]['id'];}return db[_0x5f2d('0x3d')]['find']({'where':{'id':_0x25b4dd[_0x5f2d('0x45')]['id']}})['then'](handleEntityNotFound(_0x43ecf1,null))[_0x5f2d('0x23')](saveUpdates(_0x25b4dd[_0x5f2d('0x43')],null))[_0x5f2d('0x23')](respondWithResult(_0x43ecf1,null))[_0x5f2d('0x3f')](handleError(_0x43ecf1,null));};exports[_0x5f2d('0x24')]=function(_0x28b9a7,_0x20e30d){return db[_0x5f2d('0x3d')][_0x5f2d('0x46')]({'where':{'id':_0x28b9a7[_0x5f2d('0x45')]['id']}})[_0x5f2d('0x23')](handleEntityNotFound(_0x20e30d,null))['then'](removeEntity(_0x20e30d,null))[_0x5f2d('0x3f')](handleError(_0x20e30d,null));};exports[_0x5f2d('0x47')]=function(_0x3e18c4,_0x20c1fc){return db[_0x5f2d('0x3d')][_0x5f2d('0x47')]()[_0x5f2d('0x23')](respondWithResult(_0x20c1fc,null))[_0x5f2d('0x3f')](handleError(_0x20c1fc,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 58c2c06..31b8716 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 _0xf19f=['util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','report_call_transfer'];(function(_0x3ec2e1,_0x5d8f00){var _0x10ae56=function(_0x200024){while(--_0x200024){_0x3ec2e1['push'](_0x3ec2e1['shift']());}};_0x10ae56(++_0x5d8f00);}(_0xf19f,0xdc));var _0xff19=function(_0x5e238b,_0x17ae49){_0x5e238b=_0x5e238b-0x0;var _0x389bea=_0xf19f[_0x5e238b];return _0x389bea;};'use strict';var _=require('lodash');var util=require(_0xff19('0x0'));var logger=require('../../config/logger')(_0xff19('0x1'));var moment=require(_0xff19('0x2'));var BPromise=require('bluebird');var rp=require(_0xff19('0x3'));var fs=require('fs');var path=require(_0xff19('0x4'));var rimraf=require(_0xff19('0x5'));var config=require(_0xff19('0x6'));var attributes=require('./voiceTransferReport.attributes');module[_0xff19('0x7')]=function(_0x1d620f,_0x5d87a6){return _0x1d620f[_0xff19('0x8')]('VoiceTransferReport',attributes,{'tableName':_0xff19('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66e2=['./voiceTransferReport.attributes','exports','define','util','../../config/logger','api','moment','path','rimraf'];(function(_0x4ebec7,_0x261451){var _0x2b1400=function(_0x316308){while(--_0x316308){_0x4ebec7['push'](_0x4ebec7['shift']());}};_0x2b1400(++_0x261451);}(_0x66e2,0x16b));var _0x266e=function(_0x243d52,_0x2d5634){_0x243d52=_0x243d52-0x0;var _0xbbf923=_0x66e2[_0x243d52];return _0xbbf923;};'use strict';var _=require('lodash');var util=require(_0x266e('0x0'));var logger=require(_0x266e('0x1'))(_0x266e('0x2'));var moment=require(_0x266e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x266e('0x4'));var rimraf=require(_0x266e('0x5'));var config=require('../../config/environment');var attributes=require(_0x266e('0x6'));module[_0x266e('0x7')]=function(_0x23c5d9,_0x258400){return _0x23c5d9[_0x266e('0x8')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 505915f..899ee4b 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 _0xf038=['request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport','create','body','options','raw','catch','lodash','util','ioredis','jayson/promise'];(function(_0x96b81e,_0x553640){var _0x3e295c=function(_0x503989){while(--_0x503989){_0x96b81e['push'](_0x96b81e['shift']());}};_0x3e295c(++_0x553640);}(_0xf038,0x11a));var _0x8f03=function(_0x29771f,_0x1189ae){_0x29771f=_0x29771f-0x0;var _0x279baf=_0xf038[_0x29771f];return _0x279baf;};'use strict';var _=require(_0x8f03('0x0'));var util=require(_0x8f03('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f03('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8f03('0x3'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5084,_0x3f4a0a,_0x19a532){return new BPromise(function(_0x10142a,_0x4e2b3c){return client[_0x8f03('0x4')](_0x5c5084,_0x19a532)[_0x8f03('0x5')](function(_0x22df9a){logger[_0x8f03('0x6')](_0x8f03('0x7'),_0x3f4a0a,_0x8f03('0x8'));logger[_0x8f03('0x9')](_0x8f03('0xa'),_0x3f4a0a,'request\x20sent',JSON[_0x8f03('0xb')](_0x22df9a));if(_0x22df9a[_0x8f03('0xc')]){if(_0x22df9a[_0x8f03('0xc')][_0x8f03('0xd')]===0x1f4){logger[_0x8f03('0xc')](_0x8f03('0x7'),_0x3f4a0a,_0x22df9a['error'][_0x8f03('0xe')]);return _0x4e2b3c(_0x22df9a[_0x8f03('0xc')][_0x8f03('0xe')]);}logger['error'](_0x8f03('0x7'),_0x3f4a0a,_0x22df9a[_0x8f03('0xc')][_0x8f03('0xe')]);return _0x10142a(_0x22df9a[_0x8f03('0xc')][_0x8f03('0xe')]);}else{logger[_0x8f03('0x6')]('VoiceTransferReport,\x20%s,\x20%s',_0x3f4a0a,_0x8f03('0x8'));_0x10142a(_0x22df9a[_0x8f03('0xf')]['message']);}})['catch'](function(_0x1ed566){logger[_0x8f03('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x3f4a0a,_0x1ed566);_0x4e2b3c(_0x1ed566);});});}exports[_0x8f03('0x10')]=function(_0x98e95e){var _0xf7173=this;return new Promise(function(_0x31b2de,_0x42c2f0){return db['VoiceTransferReport'][_0x8f03('0x11')](_0x98e95e[_0x8f03('0x12')],{'raw':_0x98e95e[_0x8f03('0x13')]?_0x98e95e[_0x8f03('0x13')][_0x8f03('0x14')]===undefined?!![]:![]:!![]})[_0x8f03('0x5')](function(_0x2a33c4){logger[_0x8f03('0x6')](_0x8f03('0x10'),_0x98e95e);logger['debug'](_0x8f03('0x10'),_0x98e95e,JSON[_0x8f03('0xb')](_0x2a33c4));_0x31b2de(_0x2a33c4);})[_0x8f03('0x15')](function(_0x2f13af){logger[_0x8f03('0xc')](_0x8f03('0x10'),_0x2f13af['message'],_0x98e95e);_0x42c2f0(_0xf7173['error'](0x1f4,_0x2f13af[_0x8f03('0xe')]));});});}; \ No newline at end of file +var _0xb12c=['stringify','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x500211,_0x1a0367){var _0x48f4e0=function(_0x47a67e){while(--_0x47a67e){_0x500211['push'](_0x500211['shift']());}};_0x48f4e0(++_0x1a0367);}(_0xb12c,0x15c));var _0xcb12=function(_0x44310b,_0x35fcd1){_0x44310b=_0x44310b-0x0;var _0x4db351=_0xb12c[_0x44310b];return _0x4db351;};'use strict';var _=require('lodash');var util=require(_0xcb12('0x0'));var moment=require(_0xcb12('0x1'));var BPromise=require(_0xcb12('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb12('0x3'));var db=require(_0xcb12('0x4'))['db'];var utils=require(_0xcb12('0x5'));var logger=require('../../config/logger')(_0xcb12('0x6'));var config=require('../../config/environment');var jayson=require(_0xcb12('0x7'));var client=jayson[_0xcb12('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c9529,_0xb8febc,_0x18fef2){return new BPromise(function(_0x1ba17a,_0x48ce8c){return client[_0xcb12('0x9')](_0x1c9529,_0x18fef2)[_0xcb12('0xa')](function(_0x4d7919){logger[_0xcb12('0xb')](_0xcb12('0xc'),_0xb8febc,'request\x20sent');logger[_0xcb12('0xd')](_0xcb12('0xe'),_0xb8febc,_0xcb12('0xf'),JSON[_0xcb12('0x10')](_0x4d7919));if(_0x4d7919[_0xcb12('0x11')]){if(_0x4d7919['error']['code']===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0xb8febc,_0x4d7919[_0xcb12('0x11')][_0xcb12('0x12')]);return _0x48ce8c(_0x4d7919['error'][_0xcb12('0x12')]);}logger[_0xcb12('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0xb8febc,_0x4d7919[_0xcb12('0x11')][_0xcb12('0x12')]);return _0x1ba17a(_0x4d7919[_0xcb12('0x11')]['message']);}else{logger[_0xcb12('0xb')](_0xcb12('0xc'),_0xb8febc,'request\x20sent');_0x1ba17a(_0x4d7919[_0xcb12('0x13')][_0xcb12('0x12')]);}})[_0xcb12('0x14')](function(_0x2170a5){logger[_0xcb12('0x11')](_0xcb12('0xc'),_0xb8febc,_0x2170a5);_0x48ce8c(_0x2170a5);});});}exports[_0xcb12('0x15')]=function(_0x1eaa24){var _0x34bff5=this;return new Promise(function(_0x12bd00,_0x3cef9d){return db[_0xcb12('0x16')][_0xcb12('0x17')](_0x1eaa24[_0xcb12('0x18')],{'raw':_0x1eaa24['options']?_0x1eaa24[_0xcb12('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xcb12('0xa')](function(_0x295063){logger['info'](_0xcb12('0x15'),_0x1eaa24);logger[_0xcb12('0xd')](_0xcb12('0x15'),_0x1eaa24,JSON[_0xcb12('0x10')](_0x295063));_0x12bd00(_0x295063);})[_0xcb12('0x14')](function(_0x26e6e4){logger['error'](_0xcb12('0x15'),_0x26e6e4['message'],_0x1eaa24);_0x3cef9d(_0x34bff5[_0xcb12('0x11')](0x1f4,_0x26e6e4[_0xcb12('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index d468a2e..d0c49bc 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 _0x99f3=['/originate','isAuthenticated','canUpdate','originate','/hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','post'];(function(_0x23bd20,_0x4aa9e0){var _0x6ff99d=function(_0x1d52bb){while(--_0x1d52bb){_0x23bd20['push'](_0x23bd20['shift']());}};_0x6ff99d(++_0x4aa9e0);}(_0x99f3,0x100));var _0x399f=function(_0x590114,_0x2ca735){_0x590114=_0x590114-0x0;var _0x149e50=_0x99f3[_0x590114];return _0x149e50;};'use strict';var express=require(_0x399f('0x0'));var router=express[_0x399f('0x1')]();var auth=require(_0x399f('0x2'));var controller=require('./webbar.controller');router[_0x399f('0x3')](_0x399f('0x4'),auth[_0x399f('0x5')](),auth[_0x399f('0x6')](),controller[_0x399f('0x7')]);router[_0x399f('0x3')](_0x399f('0x8'),auth[_0x399f('0x5')](),auth[_0x399f('0x6')](),controller['hangup']);router[_0x399f('0x3')](_0x399f('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x399f('0xa')]);router[_0x399f('0x3')](_0x399f('0xb'),auth[_0x399f('0x5')](),auth[_0x399f('0x6')](),controller[_0x399f('0xc')]);router['post'](_0x399f('0xd'),auth[_0x399f('0x5')](),auth[_0x399f('0x6')](),controller[_0x399f('0xe')]);router[_0x399f('0x3')](_0x399f('0xf'),auth[_0x399f('0x5')](),auth[_0x399f('0x6')](),controller[_0x399f('0x10')]);router[_0x399f('0x3')](_0x399f('0x11'),auth['isAuthenticated'](),auth[_0x399f('0x6')](),controller[_0x399f('0x12')]);module[_0x399f('0x13')]=router; \ No newline at end of file +var _0xc067=['/calls','calls','/transfer','exports','express','../../components/auth/service','post','/originate','isAuthenticated','canUpdate','originate','hangup','/answer','/hold','unhold'];(function(_0x19de9d,_0x1dcb94){var _0x25c253=function(_0x2ac149){while(--_0x2ac149){_0x19de9d['push'](_0x19de9d['shift']());}};_0x25c253(++_0x1dcb94);}(_0xc067,0x6d));var _0x7c06=function(_0x50068c,_0x38a87a){_0x50068c=_0x50068c-0x0;var _0x11826a=_0xc067[_0x50068c];return _0x11826a;};'use strict';var express=require(_0x7c06('0x0'));var router=express['Router']();var auth=require(_0x7c06('0x1'));var controller=require('./webbar.controller');router[_0x7c06('0x2')](_0x7c06('0x3'),auth[_0x7c06('0x4')](),auth[_0x7c06('0x5')](),controller[_0x7c06('0x6')]);router[_0x7c06('0x2')]('/hangup',auth[_0x7c06('0x4')](),auth['canUpdate'](),controller[_0x7c06('0x7')]);router[_0x7c06('0x2')](_0x7c06('0x8'),auth[_0x7c06('0x4')](),auth[_0x7c06('0x5')](),controller['answer']);router[_0x7c06('0x2')](_0x7c06('0x9'),auth['isAuthenticated'](),auth[_0x7c06('0x5')](),controller['hold']);router[_0x7c06('0x2')]('/unhold',auth['isAuthenticated'](),auth[_0x7c06('0x5')](),controller[_0x7c06('0xa')]);router[_0x7c06('0x2')](_0x7c06('0xb'),auth[_0x7c06('0x4')](),auth[_0x7c06('0x5')](),controller[_0x7c06('0xc')]);router[_0x7c06('0x2')](_0x7c06('0xd'),auth[_0x7c06('0x4')](),auth[_0x7c06('0x5')](),controller['transfer']);module[_0x7c06('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index c2a50db..a602074 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 _0x684c=['NotFound','error','code','result','catch','User','agent','then','VoiceChannels','all','filter','rows','UserId','\x20not\x20found!','originate','info','body','json','userId','callNumber','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','sessionId','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','length','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','emit','log','handleError:','stack','name','status','send'];(function(_0x3341a2,_0xc8a6a8){var _0x21cab4=function(_0x1a5359){while(--_0x1a5359){_0x3341a2['push'](_0x3341a2['shift']());}};_0x21cab4(++_0xc8a6a8);}(_0x684c,0x1b3));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0xc684('0x0'));var fs=require('fs');var _=require(_0xc684('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xc684('0x2'));var util=require(_0xc684('0x3'));var BPromise=require(_0xc684('0x4'));var jayson=require(_0xc684('0x5'));var amiClient=jayson[_0xc684('0x6')]['http']({'port':0x232a});var logger=require(_0xc684('0x7'))(_0xc684('0x8'));var Redis=require(_0xc684('0x9'));config[_0xc684('0xa')]=_[_0xc684('0xb')](config[_0xc684('0xa')],{'host':_0xc684('0xc'),'port':0x18eb});var io=require(_0xc684('0xd'))(new Redis(config[_0xc684('0xa')]));var Schema=require(_0xc684('0xe'));var originateValidation=new Schema({'userId':{'type':_0xc684('0xf'),'required':[!![],_0xc684('0x10')]},'callNumber':{'type':_0xc684('0x11'),'required':[!![],_0xc684('0x12')]},'callerId':{'type':_0xc684('0x11')},'callbackUrl':{'type':_0xc684('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0xc684('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xc684('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc684('0xf'),'required':[!![],_0xc684('0x10')]},'sessionId':{'type':_0xc684('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xc684('0xf'),'required':[!![],_0xc684('0x10')]},'sessionId':{'type':'string','required':[!![],_0xc684('0x13')]},'transferNumber':{'type':_0xc684('0x11'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc684('0x10')]},'sessionId':{'type':_0xc684('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xc684('0xf'),'required':[!![],_0xc684('0x10')]},'sessionId':{'type':_0xc684('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xc684('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc684('0x10')]}});function emit(_0x599c93,_0x4f0ef9,_0x51f0a8){logger['info'](_0x599c93,_0x4f0ef9,JSON['stringify'](_0x51f0a8));io['to'](_0x599c93)[_0xc684('0x14')](_0x4f0ef9,_0x51f0a8);}function handleError(_0x33943d){return function(_0x3b6f5e){console[_0xc684('0x15')](_0xc684('0x16'),_0x3b6f5e,_0x3b6f5e instanceof RangeError);logger['error'](_0x3b6f5e[_0xc684('0x17')]);if(_0x3b6f5e instanceof RangeError){if(_0x3b6f5e[_0xc684('0x18')]){delete _0x3b6f5e['name'];}_0x33943d[_0xc684('0x19')](0x194)[_0xc684('0x1a')](_0x3b6f5e);}else{if(_0x3b6f5e[_0xc684('0x18')]){delete _0x3b6f5e['name'];}_0x33943d[_0xc684('0x19')](0x1f4)[_0xc684('0x1a')](_0x3b6f5e);}};}function checkError(){return function(_0x1eddc7){if(!_0x1eddc7){throw new RangeError(_0xc684('0x1b'));}return _0x1eddc7;};}function respondWithRpcPromise(_0x2d1241,_0x4b7769){return new BPromise(function(_0x13d43f,_0x39f39a){var _0x1fb8b0=amiClient;return _0x1fb8b0['request'](_0x2d1241,_0x4b7769)['then'](function(_0x5a7b2e){if(_0x5a7b2e[_0xc684('0x1c')]){if(_0x5a7b2e[_0xc684('0x1c')][_0xc684('0x1d')]===0x1f4){return _0x39f39a(_0x5a7b2e['error']['message']);}return _0x13d43f(_0x5a7b2e['error']['message']);}else{_0x13d43f(_0x5a7b2e[_0xc684('0x1e')]);}})[_0xc684('0x1f')](function(_0x236f02){_0x39f39a(_0x236f02);});});}function getAgent(_0x4edb38){return db[_0xc684('0x20')]['findOne']({'where':{'id':_0x4edb38,'role':_0xc684('0x21')}})[_0xc684('0x22')](checkError());}function getAgentCheckSession(_0x13e09d,_0x49dad1){return new BPromise(function(_0x1f8e85,_0x4d9094){var _0x279998=respondWithRpcPromise(_0xc684('0x23'));var _0x210dcd=getAgent(_0x13e09d);Promise[_0xc684('0x24')]([_0x279998,_0x210dcd])['then'](function(_0xc0f77b){var _0x2710c1=_0xc0f77b[0x0];var _0x28a48a=_0xc0f77b[0x1];var _0x3c8a4d=_[_0xc684('0x25')](_0x2710c1[_0xc684('0x26')],function(_0x10db0d){return _0x10db0d[_0xc684('0x27')]==_0x28a48a['id']&&_0x10db0d['sessionId']==_0x49dad1;});if(_0x3c8a4d['length']==0x1){_0x1f8e85(_0x28a48a);}else{_0x4d9094(new RangeError('sessionId\x20'+_0x49dad1+_0xc684('0x28')));}});});}exports[_0xc684('0x29')]=function(_0x5cd228,_0x4e46c2){logger[_0xc684('0x2a')]('originate\x20fired:',_0x5cd228[_0xc684('0x2b')]);var _0x164da7=originateValidation[_0xc684('0xe')](_0x5cd228['body']);if(_0x164da7['length']>0x0){return _0x4e46c2[_0xc684('0x19')](0x190)[_0xc684('0x2c')](_0x164da7);}var _0x577ebe=_0x5cd228['body'][_0xc684('0x2d')];var _0x413128=_0x5cd228[_0xc684('0x2b')][_0xc684('0x2e')];var _0x35a790=_0x5cd228[_0xc684('0x2b')]['callerId'];var _0x1a0b08=_0x5cd228['body']['callbackUrl'];return getAgent(_0x577ebe)[_0xc684('0x22')](function(_0x46e014){logger['info']('entityFound:',_0x46e014[_0xc684('0x18')]);emit(util[_0xc684('0x2f')](_0xc684('0x30'),_0x46e014[_0xc684('0x18')]),_0xc684('0x31'),{'callNumber':_0x413128,'callerId':_0x35a790,'callbackUrl':_0x1a0b08});return _0x4e46c2['status'](0xc8)[_0xc684('0x2c')]({'error':![],'message':_0xc684('0x32')});})['catch'](handleError(_0x4e46c2));};exports['hangup']=function(_0x1923d7,_0x139972){logger[_0xc684('0x2a')](_0xc684('0x33'),_0x1923d7[_0xc684('0x2b')]);var _0x2ae788=hangupValidation[_0xc684('0xe')](_0x1923d7['body']);if(_0x2ae788['length']>0x0){return _0x139972[_0xc684('0x19')](0x190)[_0xc684('0x2c')](_0x2ae788);}var _0x56404b=_0x1923d7['body']['userId'];var _0x2c4e7c=_0x1923d7[_0xc684('0x2b')][_0xc684('0x34')];return getAgent(_0x56404b)[_0xc684('0x22')](function(_0x2649ee){logger['info'](_0xc684('0x35'),_0x2649ee['name']);emit(util[_0xc684('0x2f')](_0xc684('0x30'),_0x2649ee[_0xc684('0x18')]),_0xc684('0x36'),{'sessionId':_0x2c4e7c});return _0x139972['status'](0xc8)[_0xc684('0x2c')]({'error':![],'message':_0xc684('0x37')});})[_0xc684('0x1f')](handleError(_0x139972));};exports[_0xc684('0x38')]=function(_0x1497c2,_0x2f16b3){logger['info'](_0xc684('0x39'),_0x1497c2['body']);var _0x566c61=answerValidation[_0xc684('0xe')](_0x1497c2[_0xc684('0x2b')]);if(_0x566c61[_0xc684('0x3a')]>0x0){return _0x2f16b3['status'](0x190)['json'](_0x566c61);}var _0x4f288b=_0x1497c2['body']['userId'];var _0x189b26=_0x1497c2[_0xc684('0x2b')][_0xc684('0x34')];return getAgent(_0x4f288b)['then'](function(_0x2cd123){logger['info'](_0xc684('0x35'),_0x2cd123['name']);emit(util[_0xc684('0x2f')](_0xc684('0x30'),_0x2cd123[_0xc684('0x18')]),_0xc684('0x3b'),{'sessionId':_0x189b26});return _0x2f16b3[_0xc684('0x19')](0xc8)['json']({'error':![],'message':_0xc684('0x3c')});})[_0xc684('0x1f')](handleError(_0x2f16b3));};exports[_0xc684('0x3d')]=function(_0x3fd5e9,_0x1fb6ac){logger[_0xc684('0x2a')](_0xc684('0x3e'),_0x3fd5e9[_0xc684('0x2b')]);var _0x1bafa8=holdValidation['validate'](_0x3fd5e9[_0xc684('0x2b')]);if(_0x1bafa8[_0xc684('0x3a')]>0x0){return _0x1fb6ac['status'](0x190)[_0xc684('0x2c')](_0x1bafa8);}var _0x4fb1d5=_0x3fd5e9[_0xc684('0x2b')]['userId'];var _0x182534=_0x3fd5e9[_0xc684('0x2b')][_0xc684('0x34')];return getAgent(_0x4fb1d5)[_0xc684('0x22')](function(_0x1bfd8d){logger[_0xc684('0x2a')](_0xc684('0x35'),_0x1bfd8d[_0xc684('0x18')]);emit(util[_0xc684('0x2f')](_0xc684('0x30'),_0x1bfd8d['name']),_0xc684('0x3f'),{'sessionId':_0x182534});return _0x1fb6ac[_0xc684('0x19')](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x1fb6ac));};exports[_0xc684('0x40')]=function(_0x1304a2,_0x5439ae){logger[_0xc684('0x2a')](_0xc684('0x41'),_0x1304a2[_0xc684('0x2b')]);var _0x5c72c8=unholdValidation[_0xc684('0xe')](_0x1304a2[_0xc684('0x2b')]);if(_0x5c72c8[_0xc684('0x3a')]>0x0){return _0x5439ae[_0xc684('0x19')](0x190)[_0xc684('0x2c')](_0x5c72c8);}var _0x5818b8=_0x1304a2[_0xc684('0x2b')][_0xc684('0x2d')];var _0x4ab2d6=_0x1304a2[_0xc684('0x2b')][_0xc684('0x34')];return getAgent(_0x5818b8)[_0xc684('0x22')](function(_0x28c0fa){logger[_0xc684('0x2a')]('entityFound:',_0x28c0fa[_0xc684('0x18')]);emit(util['format'](_0xc684('0x30'),_0x28c0fa[_0xc684('0x18')]),_0xc684('0x42'),{'sessionId':_0x4ab2d6});return _0x5439ae[_0xc684('0x19')](0xc8)[_0xc684('0x2c')]({'error':![],'message':_0xc684('0x43')});})[_0xc684('0x1f')](handleError(_0x5439ae));};exports[_0xc684('0x44')]=function(_0xcfb03e,_0x554301){logger['info'](_0xc684('0x45'),_0x554301['body']);var _0x2b2d54=callsValidation['validate'](_0xcfb03e['body']);if(_0x2b2d54[_0xc684('0x3a')]>0x0){return _0x554301[_0xc684('0x19')](0x190)[_0xc684('0x2c')](_0x2b2d54);}var _0x147483=_0xcfb03e[_0xc684('0x2b')][_0xc684('0x2d')];var _0x507eff=respondWithRpcPromise(_0xc684('0x23'));var _0x3f1887=getAgent(_0x147483);return Promise[_0xc684('0x24')]([_0x507eff,_0x3f1887])['then'](function(_0xb1ab5b){var _0x50ba27=_0xb1ab5b[0x0];var _0x1e2a08=_0xb1ab5b[0x1];var _0x3eb497=_[_0xc684('0x25')](_0x50ba27['rows'],function(_0x4eddbb){return _0x4eddbb[_0xc684('0x27')]==_0x1e2a08['id'];});return _0x554301['status'](0xc8)[_0xc684('0x2c')]({'count':_0x3eb497['length'],'rows':_0x3eb497});})[_0xc684('0x1f')](handleError(_0x554301));};exports[_0xc684('0x46')]=function(_0x5e0367,_0x1ba002){logger['info'](_0xc684('0x47'),_0x5e0367['body']);var _0x1b5b54=conferenceValidation[_0xc684('0xe')](_0x5e0367[_0xc684('0x2b')]);if(_0x1b5b54[_0xc684('0x3a')]>0x0){return _0x1ba002[_0xc684('0x19')](0x190)['json'](_0x1b5b54);}var _0x2da62d=_0x5e0367[_0xc684('0x2b')][_0xc684('0x2d')];return getAgent(_0x2da62d)[_0xc684('0x22')](function(_0x258693){logger[_0xc684('0x2a')](_0xc684('0x35'),_0x258693[_0xc684('0x18')]);emit(util[_0xc684('0x2f')](_0xc684('0x30'),_0x258693[_0xc684('0x18')]),_0xc684('0x48'));return _0x1ba002[_0xc684('0x19')](0xc8)[_0xc684('0x2c')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x1ba002));};exports['transfer']=function(_0x2a2c30,_0x519006){logger[_0xc684('0x2a')](_0xc684('0x49'),_0x2a2c30[_0xc684('0x2b')]);var _0x342bbf=transferValidation[_0xc684('0xe')](_0x2a2c30['body']);if(_0x342bbf[_0xc684('0x3a')]>0x0){return _0x519006[_0xc684('0x19')](0x190)[_0xc684('0x2c')](_0x342bbf);}var _0x5f4f6b=_0x2a2c30[_0xc684('0x2b')][_0xc684('0x2d')];var _0x2678cb=_0x2a2c30[_0xc684('0x2b')]['sessionId'];var _0x538b3f=_0x2a2c30[_0xc684('0x2b')][_0xc684('0x4a')];return getAgent(_0x5f4f6b)[_0xc684('0x22')](function(_0x1c967d){logger[_0xc684('0x2a')](_0xc684('0x35'),_0x1c967d[_0xc684('0x18')]);emit(util[_0xc684('0x2f')](_0xc684('0x30'),_0x1c967d[_0xc684('0x18')]),_0xc684('0x4b'),{'sessionId':_0x2678cb,'transferNumber':_0x538b3f});return _0x519006[_0xc684('0x19')](0xc8)['json']({'error':![],'message':_0xc684('0x4c')});})['catch'](handleError(_0x519006));}; \ No newline at end of file +var _0xc36d=['all','rows','sessionId','length','sessionId\x20','originate','originate\x20fired:','body','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','hangup','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','filter','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','client','http','webbarapi','ioredis','redis','defaults','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','info','stringify','log','handleError:','error','stack','name','status','NotFound','request','then','code','result','catch','User','findOne','agent','VoiceChannels'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc36d,0x7d));var _0xdc36=function(_0x400766,_0x368660){_0x400766=_0x400766-0x0;var _0x3ae58b=_0xc36d[_0x400766];return _0x3ae58b;};'use strict';var path=require(_0xdc36('0x0'));var fs=require('fs');var _=require(_0xdc36('0x1'));var db=require(_0xdc36('0x2'))['db'];var config=require(_0xdc36('0x3'));var util=require(_0xdc36('0x4'));var BPromise=require(_0xdc36('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xdc36('0x6')][_0xdc36('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xdc36('0x8'));var Redis=require(_0xdc36('0x9'));config[_0xdc36('0xa')]=_[_0xdc36('0xb')](config[_0xdc36('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0xdc36('0xc'))(new Redis(config[_0xdc36('0xa')]));var Schema=require(_0xdc36('0xd'));var originateValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xdc36('0xf'),'required':[!![],_0xdc36('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xdc36('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],_0xdc36('0x11')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],_0xdc36('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xdc36('0x11')]},'sessionId':{'type':_0xdc36('0xf'),'required':[!![],_0xdc36('0x12')]},'transferNumber':{'type':_0xdc36('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],_0xdc36('0x11')]},'sessionId':{'type':_0xdc36('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],_0xdc36('0x11')]},'sessionId':{'type':_0xdc36('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xdc36('0xe'),'required':[!![],_0xdc36('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xdc36('0x11')]}});function emit(_0x526ac8,_0x4baf2e,_0x59c88f){logger[_0xdc36('0x13')](_0x526ac8,_0x4baf2e,JSON[_0xdc36('0x14')](_0x59c88f));io['to'](_0x526ac8)['emit'](_0x4baf2e,_0x59c88f);}function handleError(_0xd38826){return function(_0x219a73){console[_0xdc36('0x15')](_0xdc36('0x16'),_0x219a73,_0x219a73 instanceof RangeError);logger[_0xdc36('0x17')](_0x219a73[_0xdc36('0x18')]);if(_0x219a73 instanceof RangeError){if(_0x219a73['name']){delete _0x219a73[_0xdc36('0x19')];}_0xd38826[_0xdc36('0x1a')](0x194)['send'](_0x219a73);}else{if(_0x219a73[_0xdc36('0x19')]){delete _0x219a73[_0xdc36('0x19')];}_0xd38826[_0xdc36('0x1a')](0x1f4)['send'](_0x219a73);}};}function checkError(){return function(_0x10aafb){if(!_0x10aafb){throw new RangeError(_0xdc36('0x1b'));}return _0x10aafb;};}function respondWithRpcPromise(_0x5b9891,_0x388b1a){return new BPromise(function(_0x480277,_0x5a6e35){var _0x12f9d8=amiClient;return _0x12f9d8[_0xdc36('0x1c')](_0x5b9891,_0x388b1a)[_0xdc36('0x1d')](function(_0xda916b){if(_0xda916b[_0xdc36('0x17')]){if(_0xda916b[_0xdc36('0x17')][_0xdc36('0x1e')]===0x1f4){return _0x5a6e35(_0xda916b[_0xdc36('0x17')]['message']);}return _0x480277(_0xda916b[_0xdc36('0x17')]['message']);}else{_0x480277(_0xda916b[_0xdc36('0x1f')]);}})[_0xdc36('0x20')](function(_0x15e686){_0x5a6e35(_0x15e686);});});}function getAgent(_0x5c785b){return db[_0xdc36('0x21')][_0xdc36('0x22')]({'where':{'id':_0x5c785b,'role':_0xdc36('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x28a005,_0x2f3b6a){return new BPromise(function(_0x2a596d,_0x5f3b20){var _0x3c39e3=respondWithRpcPromise(_0xdc36('0x24'));var _0x4b15b4=getAgent(_0x28a005);Promise[_0xdc36('0x25')]([_0x3c39e3,_0x4b15b4])[_0xdc36('0x1d')](function(_0x4ea2ad){var _0x21151b=_0x4ea2ad[0x0];var _0x5bba0b=_0x4ea2ad[0x1];var _0x49bbf2=_['filter'](_0x21151b[_0xdc36('0x26')],function(_0x2f2bb4){return _0x2f2bb4['UserId']==_0x5bba0b['id']&&_0x2f2bb4[_0xdc36('0x27')]==_0x2f3b6a;});if(_0x49bbf2[_0xdc36('0x28')]==0x1){_0x2a596d(_0x5bba0b);}else{_0x5f3b20(new RangeError(_0xdc36('0x29')+_0x2f3b6a+'\x20not\x20found!'));}});});}exports[_0xdc36('0x2a')]=function(_0xcfff77,_0x1d010c){logger[_0xdc36('0x13')](_0xdc36('0x2b'),_0xcfff77[_0xdc36('0x2c')]);var _0x1aa877=originateValidation['validate'](_0xcfff77[_0xdc36('0x2c')]);if(_0x1aa877[_0xdc36('0x28')]>0x0){return _0x1d010c['status'](0x190)['json'](_0x1aa877);}var _0x359e7c=_0xcfff77[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x58a899=_0xcfff77['body'][_0xdc36('0x2e')];var _0x1a2261=_0xcfff77[_0xdc36('0x2c')][_0xdc36('0x2f')];var _0x302d69=_0xcfff77[_0xdc36('0x2c')][_0xdc36('0x30')];return getAgent(_0x359e7c)[_0xdc36('0x1d')](function(_0x734ad6){logger[_0xdc36('0x13')](_0xdc36('0x31'),_0x734ad6['name']);emit(util[_0xdc36('0x32')](_0xdc36('0x33'),_0x734ad6[_0xdc36('0x19')]),_0xdc36('0x34'),{'callNumber':_0x58a899,'callerId':_0x1a2261,'callbackUrl':_0x302d69});return _0x1d010c['status'](0xc8)[_0xdc36('0x35')]({'error':![],'message':_0xdc36('0x36')});})[_0xdc36('0x20')](handleError(_0x1d010c));};exports[_0xdc36('0x37')]=function(_0x4c4105,_0x3c8bd5){logger['info']('hangup\x20fired:',_0x4c4105[_0xdc36('0x2c')]);var _0x169c1e=hangupValidation[_0xdc36('0xd')](_0x4c4105['body']);if(_0x169c1e[_0xdc36('0x28')]>0x0){return _0x3c8bd5['status'](0x190)[_0xdc36('0x35')](_0x169c1e);}var _0x34f6be=_0x4c4105[_0xdc36('0x2c')]['userId'];var _0x34fe4d=_0x4c4105[_0xdc36('0x2c')][_0xdc36('0x27')];return getAgent(_0x34f6be)[_0xdc36('0x1d')](function(_0x50cf7b){logger[_0xdc36('0x13')](_0xdc36('0x31'),_0x50cf7b[_0xdc36('0x19')]);emit(util['format']('user:%s',_0x50cf7b[_0xdc36('0x19')]),_0xdc36('0x38'),{'sessionId':_0x34fe4d});return _0x3c8bd5['status'](0xc8)['json']({'error':![],'message':_0xdc36('0x39')});})[_0xdc36('0x20')](handleError(_0x3c8bd5));};exports[_0xdc36('0x3a')]=function(_0x1c0a6c,_0x26fb8c){logger[_0xdc36('0x13')](_0xdc36('0x3b'),_0x1c0a6c[_0xdc36('0x2c')]);var _0x2f4c89=answerValidation[_0xdc36('0xd')](_0x1c0a6c[_0xdc36('0x2c')]);if(_0x2f4c89[_0xdc36('0x28')]>0x0){return _0x26fb8c[_0xdc36('0x1a')](0x190)[_0xdc36('0x35')](_0x2f4c89);}var _0x1f2604=_0x1c0a6c[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x16dcb7=_0x1c0a6c[_0xdc36('0x2c')][_0xdc36('0x27')];return getAgent(_0x1f2604)[_0xdc36('0x1d')](function(_0x608220){logger[_0xdc36('0x13')](_0xdc36('0x31'),_0x608220[_0xdc36('0x19')]);emit(util[_0xdc36('0x32')]('user:%s',_0x608220[_0xdc36('0x19')]),_0xdc36('0x3c'),{'sessionId':_0x16dcb7});return _0x26fb8c['status'](0xc8)['json']({'error':![],'message':_0xdc36('0x3d')});})['catch'](handleError(_0x26fb8c));};exports[_0xdc36('0x3e')]=function(_0x51a276,_0x19c7fe){logger[_0xdc36('0x13')](_0xdc36('0x3f'),_0x51a276[_0xdc36('0x2c')]);var _0x34af88=holdValidation[_0xdc36('0xd')](_0x51a276[_0xdc36('0x2c')]);if(_0x34af88[_0xdc36('0x28')]>0x0){return _0x19c7fe[_0xdc36('0x1a')](0x190)[_0xdc36('0x35')](_0x34af88);}var _0x3c27c7=_0x51a276[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x10d865=_0x51a276[_0xdc36('0x2c')][_0xdc36('0x27')];return getAgent(_0x3c27c7)[_0xdc36('0x1d')](function(_0x3399cc){logger['info']('entityFound:',_0x3399cc[_0xdc36('0x19')]);emit(util[_0xdc36('0x32')](_0xdc36('0x33'),_0x3399cc[_0xdc36('0x19')]),_0xdc36('0x40'),{'sessionId':_0x10d865});return _0x19c7fe[_0xdc36('0x1a')](0xc8)['json']({'error':![],'message':_0xdc36('0x41')});})[_0xdc36('0x20')](handleError(_0x19c7fe));};exports[_0xdc36('0x42')]=function(_0x49f456,_0x2c6856){logger[_0xdc36('0x13')](_0xdc36('0x43'),_0x49f456[_0xdc36('0x2c')]);var _0x3bfc00=unholdValidation[_0xdc36('0xd')](_0x49f456['body']);if(_0x3bfc00[_0xdc36('0x28')]>0x0){return _0x2c6856[_0xdc36('0x1a')](0x190)[_0xdc36('0x35')](_0x3bfc00);}var _0x18272a=_0x49f456[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x26775a=_0x49f456[_0xdc36('0x2c')]['sessionId'];return getAgent(_0x18272a)[_0xdc36('0x1d')](function(_0x5bdc6){logger[_0xdc36('0x13')](_0xdc36('0x31'),_0x5bdc6[_0xdc36('0x19')]);emit(util[_0xdc36('0x32')](_0xdc36('0x33'),_0x5bdc6[_0xdc36('0x19')]),'webbar:unhold',{'sessionId':_0x26775a});return _0x2c6856['status'](0xc8)[_0xdc36('0x35')]({'error':![],'message':_0xdc36('0x44')});})['catch'](handleError(_0x2c6856));};exports[_0xdc36('0x45')]=function(_0xd8af57,_0x502033){logger['info'](_0xdc36('0x46'),_0x502033['body']);var _0x4277b4=callsValidation['validate'](_0xd8af57[_0xdc36('0x2c')]);if(_0x4277b4['length']>0x0){return _0x502033['status'](0x190)[_0xdc36('0x35')](_0x4277b4);}var _0x5d139f=_0xd8af57[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x33b3d2=respondWithRpcPromise(_0xdc36('0x24'));var _0x396a6a=getAgent(_0x5d139f);return Promise['all']([_0x33b3d2,_0x396a6a])[_0xdc36('0x1d')](function(_0x379a72){var _0x42d0a6=_0x379a72[0x0];var _0x4e62c2=_0x379a72[0x1];var _0x4f7bf5=_[_0xdc36('0x47')](_0x42d0a6['rows'],function(_0x3c50ea){return _0x3c50ea[_0xdc36('0x48')]==_0x4e62c2['id'];});return _0x502033[_0xdc36('0x1a')](0xc8)[_0xdc36('0x35')]({'count':_0x4f7bf5['length'],'rows':_0x4f7bf5});})['catch'](handleError(_0x502033));};exports[_0xdc36('0x49')]=function(_0x1d4707,_0x3d8c56){logger[_0xdc36('0x13')](_0xdc36('0x4a'),_0x1d4707[_0xdc36('0x2c')]);var _0x2359bd=conferenceValidation[_0xdc36('0xd')](_0x1d4707[_0xdc36('0x2c')]);if(_0x2359bd[_0xdc36('0x28')]>0x0){return _0x3d8c56['status'](0x190)[_0xdc36('0x35')](_0x2359bd);}var _0x4ea344=_0x1d4707[_0xdc36('0x2c')][_0xdc36('0x2d')];return getAgent(_0x4ea344)[_0xdc36('0x1d')](function(_0x35adec){logger[_0xdc36('0x13')](_0xdc36('0x31'),_0x35adec[_0xdc36('0x19')]);emit(util[_0xdc36('0x32')](_0xdc36('0x33'),_0x35adec[_0xdc36('0x19')]),_0xdc36('0x4b'));return _0x3d8c56[_0xdc36('0x1a')](0xc8)[_0xdc36('0x35')]({'error':![],'message':_0xdc36('0x4c')});})[_0xdc36('0x20')](handleError(_0x3d8c56));};exports[_0xdc36('0x4d')]=function(_0x43e23e,_0x1994c6){logger[_0xdc36('0x13')](_0xdc36('0x4e'),_0x43e23e['body']);var _0x327c04=transferValidation[_0xdc36('0xd')](_0x43e23e[_0xdc36('0x2c')]);if(_0x327c04[_0xdc36('0x28')]>0x0){return _0x1994c6[_0xdc36('0x1a')](0x190)[_0xdc36('0x35')](_0x327c04);}var _0x5ae258=_0x43e23e[_0xdc36('0x2c')][_0xdc36('0x2d')];var _0x52e7f7=_0x43e23e['body'][_0xdc36('0x27')];var _0x271004=_0x43e23e[_0xdc36('0x2c')]['transferNumber'];return getAgent(_0x5ae258)['then'](function(_0x6888a8){logger[_0xdc36('0x13')]('entityFound:',_0x6888a8['name']);emit(util[_0xdc36('0x32')](_0xdc36('0x33'),_0x6888a8[_0xdc36('0x19')]),_0xdc36('0x4f'),{'sessionId':_0x52e7f7,'transferNumber':_0x271004});return _0x1994c6[_0xdc36('0x1a')](0xc8)[_0xdc36('0x35')]({'error':![],'message':_0xdc36('0x50')});})[_0xdc36('0x20')](handleError(_0x1994c6));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index b96017f..c1ce3d6 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 _0xd117=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/users','getAgents','getApplications','create','post','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/applications','/:id/notify','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout'];(function(_0xb5fc3e,_0x234703){var _0x2efc3c=function(_0x4e4e44){while(--_0x4e4e44){_0xb5fc3e['push'](_0xb5fc3e['shift']());}};_0x2efc3c(++_0x234703);}(_0xd117,0x182));var _0x7d11=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xd117[_0x32f7d7];return _0x133d09;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0xb')](_0x7d11('0x12'),auth['isAuthenticated'](),controller[_0x7d11('0x13')]);router['get']('/:id/canned_answers',auth[_0x7d11('0xc')](),controller['getAnswers']);router['get'](_0x7d11('0x14'),auth['isAuthenticated'](),controller[_0x7d11('0x15')]);router[_0x7d11('0xb')]('/:id/applications',auth[_0x7d11('0xc')](),controller[_0x7d11('0x16')]);router['post']('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0x17')]);router[_0x7d11('0x18')](_0x7d11('0x12'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x19')]);router[_0x7d11('0x18')](_0x7d11('0x1a'),auth['isAuthenticated'](),controller[_0x7d11('0x1b')]);router[_0x7d11('0x18')](_0x7d11('0x14'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x1c')]);router['post'](_0x7d11('0x1d'),auth[_0x7d11('0xc')](),controller['addApplications']);router['post'](_0x7d11('0x1e'),controller['notify']);router[_0x7d11('0x18')]('/:id/send',auth[_0x7d11('0xc')](),controller[_0x7d11('0x1f')]);router[_0x7d11('0x20')](_0x7d11('0x10'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x21')]);router[_0x7d11('0x22')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x23')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x7d11('0x24')]);router[_0x7d11('0x22')](_0x7d11('0x1a'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x25')]);router[_0x7d11('0x22')](_0x7d11('0x14'),auth[_0x7d11('0xc')](),controller['removeAgents']);module[_0x7d11('0x26')]=router; \ No newline at end of file +var _0xd943=['show','get','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','send','put','/:id','destroy','/:id/dispositions','removeDispositions','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe'];(function(_0x2ffd5d,_0x36e807){var _0x19ffe3=function(_0x3b2db5){while(--_0x3b2db5){_0x2ffd5d['push'](_0x2ffd5d['shift']());}};_0x19ffe3(++_0x36e807);}(_0xd943,0x15d));var _0x3d94=function(_0x45de82,_0x4a944a){_0x45de82=_0x45de82-0x0;var _0x18d0e8=_0xd943[_0x45de82];return _0x18d0e8;};'use strict';var multer=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var path=require(_0x3d94('0x2'));var timeout=require(_0x3d94('0x3'));var express=require('express');var router=express[_0x3d94('0x4')]();var fs_extra=require(_0x3d94('0x5'));var auth=require(_0x3d94('0x6'));var interaction=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0x3d94('0x9')](),controller['index']);router['get']('/describe',auth[_0x3d94('0x9')](),controller[_0x3d94('0xa')]);router['get']('/:id',auth[_0x3d94('0x9')](),controller[_0x3d94('0xb')]);router[_0x3d94('0xc')]('/:id/dispositions',auth[_0x3d94('0x9')](),controller['getDispositions']);router[_0x3d94('0xc')](_0x3d94('0xd'),auth['isAuthenticated'](),controller[_0x3d94('0xe')]);router[_0x3d94('0xc')](_0x3d94('0xf'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x10')]);router['get'](_0x3d94('0x11'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x12')]);router['post']('/',auth[_0x3d94('0x9')](),controller[_0x3d94('0x13')]);router[_0x3d94('0x14')]('/:id/dispositions',auth[_0x3d94('0x9')](),controller[_0x3d94('0x15')]);router[_0x3d94('0x14')](_0x3d94('0xd'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x16')]);router[_0x3d94('0x14')](_0x3d94('0xf'),auth['isAuthenticated'](),controller[_0x3d94('0x17')]);router[_0x3d94('0x14')](_0x3d94('0x11'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x18')]);router[_0x3d94('0x14')](_0x3d94('0x19'),controller['notify']);router[_0x3d94('0x14')]('/:id/send',auth[_0x3d94('0x9')](),controller[_0x3d94('0x1a')]);router[_0x3d94('0x1b')](_0x3d94('0x1c'),auth[_0x3d94('0x9')](),controller['update']);router['delete'](_0x3d94('0x1c'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x1d')]);router['delete'](_0x3d94('0x1e'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x1f')]);router[_0x3d94('0x20')](_0x3d94('0xd'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x21')]);router[_0x3d94('0x20')](_0x3d94('0xf'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x22')]);module[_0x3d94('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 1c73303..a4b3c05 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 _0x2cd9=['mandatoryDisposition','sequelize','randomstring','STRING','generate','twilio','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2cd9,0x1d5));var _0x92cd=function(_0x14f896,_0x1cd6d4){_0x14f896=_0x14f896-0x0;var _0x1607c7=_0x2cd9[_0x14f896];return _0x1607c7;};'use strict';var Sequelize=require(_0x92cd('0x0'));var rs=require(_0x92cd('0x1'));module['exports']={'name':{'type':Sequelize[_0x92cd('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x92cd('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x92cd('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x92cd('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x92cd('0x4'))},'accountSid':{'type':Sequelize[_0x92cd('0x2')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x92cd('0x5')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x92cd('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x92cd('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x92cd('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x92cd('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x92cd('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x92cd('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x92cd('0x7')],'comment':_0x92cd('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x92cd('0x6')],'defaultValue':![],'comment':_0x92cd('0x9'),'set':function(_0x548167){if(!_0x548167){this[_0x92cd('0xa')](_0x92cd('0xb'),null);}this[_0x92cd('0xa')](_0x92cd('0xc'),_0x548167);}},'description':{'type':Sequelize[_0x92cd('0x2')]}}; \ No newline at end of file +var _0x24a0=['twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','STRING'];(function(_0x5b4d9a,_0x13d1d7){var _0x298426=function(_0x3b8738){while(--_0x3b8738){_0x5b4d9a['push'](_0x5b4d9a['shift']());}};_0x298426(++_0x13d1d7);}(_0x24a0,0xf3));var _0x024a=function(_0x49f300,_0x414037){_0x49f300=_0x49f300-0x0;var _0x321d51=_0x24a0[_0x49f300];return _0x321d51;};'use strict';var Sequelize=require(_0x024a('0x0'));var rs=require('randomstring');module[_0x024a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x024a('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x024a('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x024a('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x024a('0x3')]},'type':{'type':Sequelize['ENUM'](_0x024a('0x4'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x024a('0x3')]},'notificationTemplate':{'type':Sequelize[_0x024a('0x5')],'defaultValue':function(){return _0x024a('0x6');}},'notificationSound':{'type':Sequelize[_0x024a('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x024a('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x024a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x024a('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x024a('0x7')],'defaultValue':![],'comment':_0x024a('0x9'),'set':function(_0x12f0e7){if(!_0x12f0e7){this[_0x024a('0xa')](_0x024a('0xb'),null);}this[_0x024a('0xa')](_0x024a('0xc'),_0x12f0e7);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index c63f0a4..3eba224 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 _0xd677=['agent','waitForTheAssignedAgent','Start','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','WhatsappAccounts','UserProfileResource','destroy','end','name','send','index','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','WhatsappAccountId','getDispositions','Disposition','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','omit','spread','userWhatsappAccount:save','removeAgents','emit','userWhatsappAccount:remove','getAgents','addApplications','transaction','WhatsappApplication','bulkCreate','priority','getApplications','whatsapp','Applications','account','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','mobile','from','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','ListId','DESC','list','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','WhatsappMessage','messageId','ContactId','AttachmentId','UserId','User','unshift'];(function(_0x102af9,_0x5426dd){var _0x5c74b9=function(_0x33ba87){while(--_0x33ba87){_0x102af9['push'](_0x102af9['shift']());}};_0x5c74b9(++_0x5426dd);}(_0xd677,0xc1));var _0x7d67=function(_0x3e00a7,_0x15e0e2){_0x3e00a7=_0x3e00a7-0x0;var _0xe16b22=_0xd677[_0x3e00a7];return _0xe16b22;};'use strict';var emlformat=require(_0x7d67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7d67('0x1'));var jsonpatch=require(_0x7d67('0x2'));var rp=require(_0x7d67('0x3'));var moment=require('moment');var BPromise=require(_0x7d67('0x4'));var Mustache=require('mustache');var util=require(_0x7d67('0x5'));var path=require(_0x7d67('0x6'));var sox=require('sox');var csv=require(_0x7d67('0x7'));var ejs=require(_0x7d67('0x8'));var fs=require('fs');var fs_extra=require(_0x7d67('0x9'));var _=require(_0x7d67('0xa'));var squel=require(_0x7d67('0xb'));var crypto=require(_0x7d67('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7d67('0xd'));var toCsv=require(_0x7d67('0x7'));var querystring=require('querystring');var Papa=require(_0x7d67('0xe'));var Redis=require(_0x7d67('0xf'));var authService=require(_0x7d67('0x10'));var qs=require(_0x7d67('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d67('0x12'));var logger=require(_0x7d67('0x13'))(_0x7d67('0x14'));var utils=require('../../config/utils');var config=require(_0x7d67('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7d67('0x16')]=_[_0x7d67('0x17')](config[_0x7d67('0x16')],{'host':_0x7d67('0x18'),'port':0x18eb});var socket=require(_0x7d67('0x19'))(new Redis(config[_0x7d67('0x16')]));require(_0x7d67('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x7d67('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x199727,_0x32d1ce,_0x1daf05,_0x109609){return new BPromise(function(_0x1398c2,_0x197f92){var _0x49104f=_0x109609||client;return _0x49104f[_0x7d67('0x1c')](_0x199727,_0x1daf05)[_0x7d67('0x1d')](function(_0x390fad){logger[_0x7d67('0x1e')]('WhatsappAccount,\x20%s,\x20%s',_0x32d1ce,_0x7d67('0x1f'));logger[_0x7d67('0x20')](_0x7d67('0x21'),_0x32d1ce,_0x7d67('0x1f'),JSON['stringify'](_0x390fad));if(_0x390fad[_0x7d67('0x22')]){if(_0x390fad[_0x7d67('0x22')][_0x7d67('0x23')]===0x1f4){logger[_0x7d67('0x22')](_0x7d67('0x24'),_0x32d1ce,_0x390fad[_0x7d67('0x22')][_0x7d67('0x25')]);return _0x197f92(_0x390fad[_0x7d67('0x22')][_0x7d67('0x25')]);}logger[_0x7d67('0x22')](_0x7d67('0x24'),_0x32d1ce,_0x390fad[_0x7d67('0x22')][_0x7d67('0x25')]);return _0x1398c2(_0x390fad[_0x7d67('0x22')][_0x7d67('0x25')]);}else{logger[_0x7d67('0x1e')](_0x7d67('0x24'),_0x32d1ce,_0x7d67('0x1f'));_0x1398c2(_0x390fad['result'][_0x7d67('0x25')]);}})[_0x7d67('0x26')](function(_0x3954bb){logger[_0x7d67('0x22')](_0x7d67('0x24'),_0x32d1ce,_0x3954bb);_0x197f92(_0x3954bb);});});}function respondWithStatusCode(_0x4709cb,_0x11e342){_0x11e342=_0x11e342||0xcc;return function(_0x609b39){if(_0x609b39){return _0x4709cb[_0x7d67('0x27')](_0x11e342);}return _0x4709cb[_0x7d67('0x28')](_0x11e342)['end']();};}function respondWithResult(_0x2b5b33,_0x2b71d2){_0x2b71d2=_0x2b71d2||0xc8;return function(_0x53ed09){if(_0x53ed09){return _0x2b5b33[_0x7d67('0x28')](_0x2b71d2)[_0x7d67('0x29')](_0x53ed09);}};}function respondWithFilteredResult(_0x2b5046,_0xcfef9b){return function(_0xe8fd26){if(_0xe8fd26){var _0x15789c=typeof _0xcfef9b[_0x7d67('0x2a')]===_0x7d67('0x2b')&&typeof _0xcfef9b[_0x7d67('0x2c')]==='undefined';var _0x1c903e=_0xe8fd26[_0x7d67('0x2d')];var _0x23d2dd=_0x15789c?0x0:_0xcfef9b['offset'];var _0x41039b=_0x15789c?_0xe8fd26['count']:_0xcfef9b[_0x7d67('0x2a')]+_0xcfef9b['limit'];var _0x20a329;if(_0x41039b>=_0x1c903e){_0x41039b=_0x1c903e;_0x20a329=0xc8;}else{_0x20a329=0xce;}_0x2b5046[_0x7d67('0x28')](_0x20a329);return _0x2b5046[_0x7d67('0x2e')](_0x7d67('0x2f'),_0x23d2dd+'-'+_0x41039b+'/'+_0x1c903e)[_0x7d67('0x29')](_0xe8fd26);}return null;};}function patchUpdates(_0x4b3fc6){return function(_0x2a73bb){try{jsonpatch[_0x7d67('0x30')](_0x2a73bb,_0x4b3fc6,!![]);}catch(_0x14e1b8){return BPromise[_0x7d67('0x31')](_0x14e1b8);}return _0x2a73bb[_0x7d67('0x32')]();};}function saveUpdates(_0x3c5085,_0x57af96){return function(_0x20a07a){if(_0x20a07a){return _0x20a07a[_0x7d67('0x33')](_0x3c5085)[_0x7d67('0x1d')](function(_0xb55992){return _0xb55992;});}return null;};}function removeEntity(_0x599d7e,_0x3be40a){return function(_0xc96b8d){if(_0xc96b8d){return _0xc96b8d['destroy']()['then'](function(){var _0x5067a8=_0xc96b8d[_0x7d67('0x34')]({'plain':!![]});var _0x56a724=_0x7d67('0x35');return db[_0x7d67('0x36')][_0x7d67('0x37')]({'where':{'type':_0x56a724,'resourceId':_0x5067a8['id']}})[_0x7d67('0x1d')](function(){return _0xc96b8d;});})[_0x7d67('0x1d')](function(){_0x599d7e[_0x7d67('0x28')](0xcc)[_0x7d67('0x38')]();});}};}function handleEntityNotFound(_0x15337c,_0x4dc815){return function(_0x1200ac){if(!_0x1200ac){_0x15337c['sendStatus'](0x194);}return _0x1200ac;};}function handleError(_0x3c1922,_0x23a579){_0x23a579=_0x23a579||0x1f4;return function(_0x360fd9){logger['error'](_0x360fd9['stack']);if(_0x360fd9[_0x7d67('0x39')]){delete _0x360fd9['name'];}_0x3c1922[_0x7d67('0x28')](_0x23a579)[_0x7d67('0x3a')](_0x360fd9);};}exports[_0x7d67('0x3b')]=function(_0xc3e7b9,_0x330874){var _0x2ddc0b={'include':[{'model':db['Pause'],'as':_0x7d67('0x3c')}]},_0x525df1={},_0x308d4a={'count':0x0,'rows':[]};var _0x18fc68=_['map'](db[_0x7d67('0x3d')][_0x7d67('0x3e')],function(_0x3b2953){return{'name':_0x3b2953[_0x7d67('0x3f')],'type':_0x3b2953[_0x7d67('0x40')][_0x7d67('0x41')]};});_0x525df1[_0x7d67('0x42')]=_[_0x7d67('0x43')](_0x18fc68,_0x7d67('0x39'));_0x525df1[_0x7d67('0x44')]=_[_0x7d67('0x45')](_0xc3e7b9[_0x7d67('0x44')]);_0x525df1[_0x7d67('0x46')]=_[_0x7d67('0x47')](_0x525df1['model'],_0x525df1[_0x7d67('0x44')]);_0x2ddc0b[_0x7d67('0x48')]=_['intersection'](_0x525df1['model'],qs[_0x7d67('0x49')](_0xc3e7b9[_0x7d67('0x44')][_0x7d67('0x49')]));_0x2ddc0b['attributes']=_0x2ddc0b[_0x7d67('0x48')][_0x7d67('0x4a')]?_0x2ddc0b['attributes']:_0x525df1[_0x7d67('0x42')];if(!_0xc3e7b9[_0x7d67('0x44')][_0x7d67('0x4b')](_0x7d67('0x4c'))){_0x2ddc0b[_0x7d67('0x2c')]=qs[_0x7d67('0x2c')](_0xc3e7b9['query'][_0x7d67('0x2c')]);_0x2ddc0b[_0x7d67('0x2a')]=qs[_0x7d67('0x2a')](_0xc3e7b9[_0x7d67('0x44')][_0x7d67('0x2a')]);}_0x2ddc0b[_0x7d67('0x4d')]=qs[_0x7d67('0x4e')](_0xc3e7b9[_0x7d67('0x44')][_0x7d67('0x4e')]);_0x2ddc0b[_0x7d67('0x4f')]=qs[_0x7d67('0x46')](_[_0x7d67('0x50')](_0xc3e7b9[_0x7d67('0x44')],_0x525df1[_0x7d67('0x46')]),_0x18fc68);if(_0xc3e7b9[_0x7d67('0x44')][_0x7d67('0x51')]){_0x2ddc0b[_0x7d67('0x4f')]=_[_0x7d67('0x52')](_0x2ddc0b[_0x7d67('0x4f')],{'$or':_['map'](_0x18fc68,function(_0x4945ac){if(_0x4945ac[_0x7d67('0x40')]!=='VIRTUAL'){var _0x459414={};_0x459414[_0x4945ac['name']]={'$like':'%'+_0xc3e7b9[_0x7d67('0x44')]['filter']+'%'};return _0x459414;}})});}_0x2ddc0b=_[_0x7d67('0x52')]({},_0x2ddc0b,_0xc3e7b9[_0x7d67('0x53')]);var _0x1ed4c0={'where':_0x2ddc0b['where']};return db[_0x7d67('0x3d')][_0x7d67('0x2d')](_0x1ed4c0)[_0x7d67('0x1d')](function(_0x2fcd85){_0x308d4a[_0x7d67('0x2d')]=_0x2fcd85;if(_0xc3e7b9[_0x7d67('0x44')][_0x7d67('0x54')]){_0x2ddc0b['include']=[{'all':!![]}];}return db[_0x7d67('0x3d')][_0x7d67('0x55')](_0x2ddc0b);})[_0x7d67('0x1d')](function(_0x5d5f8b){_0x308d4a['rows']=_0x5d5f8b;return _0x308d4a;})[_0x7d67('0x1d')](respondWithFilteredResult(_0x330874,_0x2ddc0b))['catch'](handleError(_0x330874,null));};exports['show']=function(_0x1818aa,_0x5c0610){var _0x15ca17={'raw':![],'where':{'id':_0x1818aa[_0x7d67('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x7d67('0x3c')}]},_0x5eb2a9={};_0x5eb2a9[_0x7d67('0x42')]=_[_0x7d67('0x45')](db[_0x7d67('0x3d')][_0x7d67('0x3e')]);_0x5eb2a9['query']=_['keys'](_0x1818aa[_0x7d67('0x44')]);_0x5eb2a9[_0x7d67('0x46')]=_[_0x7d67('0x47')](_0x5eb2a9[_0x7d67('0x42')],_0x5eb2a9[_0x7d67('0x44')]);_0x15ca17[_0x7d67('0x48')]=_['intersection'](_0x5eb2a9[_0x7d67('0x42')],qs[_0x7d67('0x49')](_0x1818aa[_0x7d67('0x44')]['fields']));_0x15ca17['attributes']=_0x15ca17[_0x7d67('0x48')][_0x7d67('0x4a')]?_0x15ca17['attributes']:_0x5eb2a9[_0x7d67('0x42')];if(_0x1818aa[_0x7d67('0x44')][_0x7d67('0x54')]){_0x15ca17[_0x7d67('0x57')]=[{'all':!![]}];}_0x15ca17=_['merge']({},_0x15ca17,_0x1818aa['options']);return db['WhatsappAccount'][_0x7d67('0x58')](_0x15ca17)['then'](handleEntityNotFound(_0x5c0610,null))['then'](respondWithResult(_0x5c0610,null))[_0x7d67('0x26')](handleError(_0x5c0610,null));};exports[_0x7d67('0x59')]=function(_0x1070e3,_0x3be18f){return db[_0x7d67('0x3d')][_0x7d67('0x59')](_0x1070e3[_0x7d67('0x5a')],{})[_0x7d67('0x1d')](function(_0x12ee16){var _0x273a31=_0x1070e3[_0x7d67('0x5b')][_0x7d67('0x34')]({'plain':!![]});if(!_0x273a31)throw new Error(_0x7d67('0x5c'));if(_0x273a31[_0x7d67('0x5d')]===_0x7d67('0x5b')){var _0xe679ff=_0x12ee16[_0x7d67('0x34')]({'plain':!![]});var _0x5ec444=_0x7d67('0x35');return db[_0x7d67('0x5e')][_0x7d67('0x58')]({'where':{'name':_0x5ec444,'userProfileId':_0x273a31[_0x7d67('0x5f')]},'raw':!![]})[_0x7d67('0x1d')](function(_0x117a4a){if(_0x117a4a&&_0x117a4a[_0x7d67('0x60')]===0x0){return db[_0x7d67('0x36')][_0x7d67('0x59')]({'name':_0xe679ff[_0x7d67('0x39')],'resourceId':_0xe679ff['id'],'type':_0x117a4a[_0x7d67('0x39')],'sectionId':_0x117a4a['id']},{})[_0x7d67('0x1d')](function(){return _0x12ee16;});}else{return _0x12ee16;}})[_0x7d67('0x26')](function(_0x2ba5c5){logger[_0x7d67('0x22')](_0x7d67('0x61'),_0x2ba5c5);throw _0x2ba5c5;});}return _0x12ee16;})['then'](respondWithResult(_0x3be18f,0xc9))[_0x7d67('0x26')](handleError(_0x3be18f,null));};exports['update']=function(_0x5b3b1e,_0x5e61cb){if(_0x5b3b1e[_0x7d67('0x5a')]['id']){delete _0x5b3b1e[_0x7d67('0x5a')]['id'];}return db[_0x7d67('0x3d')][_0x7d67('0x58')]({'where':{'id':_0x5b3b1e[_0x7d67('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x7d67('0x3c')}]})[_0x7d67('0x1d')](handleEntityNotFound(_0x5e61cb,null))['then'](saveUpdates(_0x5b3b1e['body'],null))['then'](respondWithResult(_0x5e61cb,null))[_0x7d67('0x26')](handleError(_0x5e61cb,null));};exports['destroy']=function(_0xf99cdd,_0x4acc12){return db[_0x7d67('0x3d')][_0x7d67('0x58')]({'where':{'id':_0xf99cdd[_0x7d67('0x56')]['id']}})[_0x7d67('0x1d')](handleEntityNotFound(_0x4acc12,null))[_0x7d67('0x1d')](removeEntity(_0x4acc12,null))[_0x7d67('0x26')](handleError(_0x4acc12,null));};exports[_0x7d67('0x62')]=function(_0x1dd772,_0x1f1916){return db[_0x7d67('0x3d')]['describe']()[_0x7d67('0x1d')](respondWithResult(_0x1f1916,null))[_0x7d67('0x26')](handleError(_0x1f1916,null));};exports['addDisposition']=function(_0x28caa9,_0x54e14a,_0x5bbc37){if(_0x28caa9['body']['id']){delete _0x28caa9[_0x7d67('0x5a')]['id'];}return db['WhatsappAccount'][_0x7d67('0x58')]({'where':{'id':_0x28caa9[_0x7d67('0x56')]['id']}})['then'](handleEntityNotFound(_0x54e14a,null))[_0x7d67('0x1d')](function(_0x24b1fa){if(_0x24b1fa){_0x28caa9[_0x7d67('0x5a')][_0x7d67('0x63')]=_0x24b1fa['id'];return db['Disposition'][_0x7d67('0x59')](_0x28caa9[_0x7d67('0x5a')]);}})['then'](respondWithResult(_0x54e14a,null))[_0x7d67('0x26')](handleError(_0x54e14a,null));};exports[_0x7d67('0x64')]=function(_0x198755,_0x58c9a9,_0x389cfe){var _0x12e57b={'raw':![],'where':{}};var _0x5980da={};var _0xe312d0={'count':0x0,'rows':[]};return db[_0x7d67('0x3d')]['findOne']({'where':{'id':_0x198755[_0x7d67('0x56')]['id']}})[_0x7d67('0x1d')](handleEntityNotFound(_0x58c9a9,null))['then'](function(_0x139cd){if(_0x139cd){_0x5980da[_0x7d67('0x42')]=_[_0x7d67('0x45')](db['Disposition']['rawAttributes']);_0x5980da['query']=_[_0x7d67('0x45')](_0x198755[_0x7d67('0x44')]);_0x5980da[_0x7d67('0x46')]=_[_0x7d67('0x47')](_0x5980da['model'],_0x5980da['query']);_0x12e57b[_0x7d67('0x48')]=_[_0x7d67('0x47')](_0x5980da[_0x7d67('0x42')],qs[_0x7d67('0x49')](_0x198755[_0x7d67('0x44')][_0x7d67('0x49')]));_0x12e57b[_0x7d67('0x48')]=_0x12e57b[_0x7d67('0x48')][_0x7d67('0x4a')]?_0x12e57b[_0x7d67('0x48')]:_0x5980da[_0x7d67('0x42')];if(!_0x198755[_0x7d67('0x44')][_0x7d67('0x4b')](_0x7d67('0x4c'))){_0x12e57b[_0x7d67('0x2c')]=qs[_0x7d67('0x2c')](_0x198755[_0x7d67('0x44')][_0x7d67('0x2c')]);_0x12e57b[_0x7d67('0x2a')]=qs[_0x7d67('0x2a')](_0x198755[_0x7d67('0x44')][_0x7d67('0x2a')]);}_0x12e57b[_0x7d67('0x4d')]=qs[_0x7d67('0x4e')](_0x198755[_0x7d67('0x44')][_0x7d67('0x4e')]);_0x12e57b[_0x7d67('0x4f')]=qs[_0x7d67('0x46')](_[_0x7d67('0x50')](_0x198755['query'],_0x5980da[_0x7d67('0x46')]));_0x12e57b[_0x7d67('0x4f')][_0x7d67('0x63')]=_0x139cd['id'];if(_0x198755[_0x7d67('0x44')]['filter']){_0x12e57b['where']=_[_0x7d67('0x52')](_0x12e57b['where'],{'$or':_[_0x7d67('0x43')](_0x12e57b[_0x7d67('0x48')],function(_0x2749ae){var _0x5c0088={};_0x5c0088[_0x2749ae]={'$like':'%'+_0x198755['query']['filter']+'%'};return _0x5c0088;})});}_0x12e57b=_['merge']({},_0x12e57b,_0x198755['options']);return db[_0x7d67('0x65')][_0x7d67('0x2d')]({'where':_0x12e57b[_0x7d67('0x4f')]})[_0x7d67('0x1d')](function(_0x1343ef){_0xe312d0[_0x7d67('0x2d')]=_0x1343ef;if(_0x198755[_0x7d67('0x44')][_0x7d67('0x54')]){_0x12e57b[_0x7d67('0x57')]=[{'all':!![]}];}return db[_0x7d67('0x65')][_0x7d67('0x55')](_0x12e57b);})['then'](function(_0x2bb7c0){_0xe312d0[_0x7d67('0x66')]=_0x2bb7c0;return _0xe312d0;});}})[_0x7d67('0x1d')](respondWithFilteredResult(_0x58c9a9,_0x12e57b))['catch'](handleError(_0x58c9a9,null));};exports[_0x7d67('0x67')]=function(_0x432338,_0x77cce1,_0x14c459){return db['WhatsappAccount'][_0x7d67('0x58')]({'where':{'id':_0x432338[_0x7d67('0x56')]['id']}})[_0x7d67('0x1d')](handleEntityNotFound(_0x77cce1,null))[_0x7d67('0x1d')](function(_0x27241a){if(_0x27241a){return _0x27241a[_0x7d67('0x67')](_0x432338[_0x7d67('0x44')][_0x7d67('0x68')]);}})[_0x7d67('0x1d')](respondWithStatusCode(_0x77cce1,null))[_0x7d67('0x26')](handleError(_0x77cce1,null));};exports[_0x7d67('0x69')]=function(_0x2c2eda,_0x560ab7,_0x273584){if(_0x2c2eda[_0x7d67('0x5a')]['id']){delete _0x2c2eda[_0x7d67('0x5a')]['id'];}return db[_0x7d67('0x3d')][_0x7d67('0x58')]({'where':{'id':_0x2c2eda[_0x7d67('0x56')]['id']}})[_0x7d67('0x1d')](handleEntityNotFound(_0x560ab7,null))[_0x7d67('0x1d')](function(_0x235510){if(_0x235510){_0x2c2eda[_0x7d67('0x5a')]['WhatsappAccountId']=_0x235510['id'];return db[_0x7d67('0x6a')][_0x7d67('0x59')](_0x2c2eda[_0x7d67('0x5a')]);}})[_0x7d67('0x1d')](respondWithResult(_0x560ab7,null))['catch'](handleError(_0x560ab7,null));};exports[_0x7d67('0x6b')]=function(_0x19ab94,_0x4933b7,_0x3120e7){var _0x3b74be={'raw':![],'where':{}};var _0x2ec97c={};var _0x3a1c2a={'count':0x0,'rows':[]};return db[_0x7d67('0x3d')][_0x7d67('0x6c')]({'where':{'id':_0x19ab94[_0x7d67('0x56')]['id']}})[_0x7d67('0x1d')](handleEntityNotFound(_0x4933b7,null))[_0x7d67('0x1d')](function(_0x5b5f16){if(_0x5b5f16){_0x2ec97c[_0x7d67('0x42')]=_[_0x7d67('0x45')](db[_0x7d67('0x6a')][_0x7d67('0x3e')]);_0x2ec97c['query']=_['keys'](_0x19ab94[_0x7d67('0x44')]);_0x2ec97c[_0x7d67('0x46')]=_[_0x7d67('0x47')](_0x2ec97c[_0x7d67('0x42')],_0x2ec97c[_0x7d67('0x44')]);_0x3b74be[_0x7d67('0x48')]=_[_0x7d67('0x47')](_0x2ec97c[_0x7d67('0x42')],qs[_0x7d67('0x49')](_0x19ab94[_0x7d67('0x44')][_0x7d67('0x49')]));_0x3b74be[_0x7d67('0x48')]=_0x3b74be[_0x7d67('0x48')][_0x7d67('0x4a')]?_0x3b74be[_0x7d67('0x48')]:_0x2ec97c[_0x7d67('0x42')];if(!_0x19ab94['query'][_0x7d67('0x4b')](_0x7d67('0x4c'))){_0x3b74be[_0x7d67('0x2c')]=qs['limit'](_0x19ab94[_0x7d67('0x44')]['limit']);_0x3b74be[_0x7d67('0x2a')]=qs[_0x7d67('0x2a')](_0x19ab94['query'][_0x7d67('0x2a')]);}_0x3b74be[_0x7d67('0x4d')]=qs['sort'](_0x19ab94[_0x7d67('0x44')][_0x7d67('0x4e')]);_0x3b74be['where']=qs[_0x7d67('0x46')](_[_0x7d67('0x50')](_0x19ab94[_0x7d67('0x44')],_0x2ec97c[_0x7d67('0x46')]));_0x3b74be['where'][_0x7d67('0x63')]=_0x5b5f16['id'];if(_0x19ab94[_0x7d67('0x44')][_0x7d67('0x51')]){_0x3b74be[_0x7d67('0x4f')]=_[_0x7d67('0x52')](_0x3b74be['where'],{'$or':_[_0x7d67('0x43')](_0x3b74be[_0x7d67('0x48')],function(_0x72134e){var _0x24b9c7={};_0x24b9c7[_0x72134e]={'$like':'%'+_0x19ab94[_0x7d67('0x44')]['filter']+'%'};return _0x24b9c7;})});}_0x3b74be=_[_0x7d67('0x52')]({},_0x3b74be,_0x19ab94[_0x7d67('0x53')]);return db[_0x7d67('0x6a')]['count']({'where':_0x3b74be[_0x7d67('0x4f')]})[_0x7d67('0x1d')](function(_0x1b358c){_0x3a1c2a[_0x7d67('0x2d')]=_0x1b358c;if(_0x19ab94[_0x7d67('0x44')]['includeAll']){_0x3b74be[_0x7d67('0x57')]=[{'all':!![]}];}return db[_0x7d67('0x6a')][_0x7d67('0x55')](_0x3b74be);})[_0x7d67('0x1d')](function(_0x3cff3f){_0x3a1c2a[_0x7d67('0x66')]=_0x3cff3f;return _0x3a1c2a;});}})[_0x7d67('0x1d')](respondWithFilteredResult(_0x4933b7,_0x3b74be))[_0x7d67('0x26')](handleError(_0x4933b7,null));};exports['removeAnswers']=function(_0x2d68ef,_0x1fd401,_0x575238){return db[_0x7d67('0x3d')][_0x7d67('0x58')]({'where':{'id':_0x2d68ef[_0x7d67('0x56')]['id']}})[_0x7d67('0x1d')](handleEntityNotFound(_0x1fd401,null))[_0x7d67('0x1d')](function(_0x104e19){if(_0x104e19){return _0x104e19[_0x7d67('0x6d')](_0x2d68ef['query'][_0x7d67('0x68')]);}})[_0x7d67('0x1d')](respondWithStatusCode(_0x1fd401,null))[_0x7d67('0x26')](handleError(_0x1fd401,null));};exports['addAgents']=function(_0xea7ee7,_0x2d2562,_0x1cd439){return db[_0x7d67('0x3d')][_0x7d67('0x58')]({'where':{'id':_0xea7ee7['params']['id']}})[_0x7d67('0x1d')](handleEntityNotFound(_0x2d2562,null))[_0x7d67('0x1d')](function(_0x1d530a){if(_0x1d530a){return _0x1d530a['addAgents'](_0xea7ee7[_0x7d67('0x5a')][_0x7d67('0x68')],_[_0x7d67('0x6e')](_0xea7ee7[_0x7d67('0x5a')],[_0x7d67('0x68'),'id'])||{})[_0x7d67('0x6f')](function(_0x1b84ff){for(var _0x538adb=0x0;_0x538adb<_0xea7ee7[_0x7d67('0x5a')][_0x7d67('0x68')][_0x7d67('0x4a')];_0x538adb+=0x1){socket['emit'](_0x7d67('0x70'),{'UserId':Number(_0xea7ee7[_0x7d67('0x5a')][_0x7d67('0x68')][_0x538adb]),'WhatsappAccountId':Number(_0xea7ee7['params']['id'])});}return _0x1b84ff;});}})[_0x7d67('0x1d')](respondWithResult(_0x2d2562,null))['catch'](handleError(_0x2d2562,null));};exports[_0x7d67('0x71')]=function(_0x1776f2,_0x1d6c68,_0x70ebeb){return db['WhatsappAccount'][_0x7d67('0x58')]({'where':{'id':_0x1776f2[_0x7d67('0x56')]['id']}})[_0x7d67('0x1d')](handleEntityNotFound(_0x1d6c68,null))['then'](function(_0x5a8336){if(_0x5a8336){return _0x5a8336[_0x7d67('0x71')](_0x1776f2['query']['ids'])[_0x7d67('0x1d')](function(){if(_['isArray'](_0x1776f2[_0x7d67('0x44')][_0x7d67('0x68')])){for(var _0x32c479=0x0;_0x32c479<_0x1776f2[_0x7d67('0x44')][_0x7d67('0x68')][_0x7d67('0x4a')];_0x32c479+=0x1){socket[_0x7d67('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0x1776f2[_0x7d67('0x44')][_0x7d67('0x68')][_0x32c479]),'WhatsappAccountId':Number(_0x1776f2[_0x7d67('0x56')]['id'])});}}else{socket[_0x7d67('0x72')](_0x7d67('0x73'),{'UserId':Number(_0x1776f2[_0x7d67('0x44')][_0x7d67('0x68')]),'WhatsappAccountId':Number(_0x1776f2[_0x7d67('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x1d6c68,null))[_0x7d67('0x26')](handleError(_0x1d6c68,null));};exports['getAgents']=function(_0x39e24a,_0x2b0014,_0x217f8f){var _0x1a2f83={};var _0x598f74={};var _0x1cfbb5;var _0x38d757;return db[_0x7d67('0x3d')]['findOne']({'where':{'id':_0x39e24a[_0x7d67('0x56')]['id']}})[_0x7d67('0x1d')](handleEntityNotFound(_0x2b0014,null))[_0x7d67('0x1d')](function(_0xdcc100){if(_0xdcc100){_0x1cfbb5=_0xdcc100;_0x598f74[_0x7d67('0x42')]=_[_0x7d67('0x45')](db['User'][_0x7d67('0x3e')]);_0x598f74['query']=_['keys'](_0x39e24a[_0x7d67('0x44')]);_0x598f74[_0x7d67('0x46')]=_[_0x7d67('0x47')](_0x598f74['model'],_0x598f74[_0x7d67('0x44')]);_0x1a2f83[_0x7d67('0x48')]=_['intersection'](_0x598f74[_0x7d67('0x42')],qs['fields'](_0x39e24a[_0x7d67('0x44')]['fields']));_0x1a2f83[_0x7d67('0x48')]=_0x1a2f83[_0x7d67('0x48')][_0x7d67('0x4a')]?_0x1a2f83[_0x7d67('0x48')]:_0x598f74['model'];_0x1a2f83[_0x7d67('0x4d')]=qs['sort'](_0x39e24a[_0x7d67('0x44')][_0x7d67('0x4e')]);_0x1a2f83[_0x7d67('0x4f')]=qs[_0x7d67('0x46')](_[_0x7d67('0x50')](_0x39e24a[_0x7d67('0x44')],_0x598f74['filters']));if(_0x39e24a['query']['filter']){_0x1a2f83[_0x7d67('0x4f')]=_['merge'](_0x1a2f83['where'],{'$or':_['map'](_0x1a2f83[_0x7d67('0x48')],function(_0x579289){var _0x1ed614={};_0x1ed614[_0x579289]={'$like':'%'+_0x39e24a[_0x7d67('0x44')][_0x7d67('0x51')]+'%'};return _0x1ed614;})});}_0x1a2f83=_[_0x7d67('0x52')]({},_0x1a2f83,_0x39e24a['options']);return _0x1cfbb5[_0x7d67('0x74')](_0x1a2f83);}})[_0x7d67('0x1d')](function(_0x348789){if(_0x348789){_0x38d757=_0x348789[_0x7d67('0x4a')];if(!_0x39e24a[_0x7d67('0x44')][_0x7d67('0x4b')](_0x7d67('0x4c'))){_0x1a2f83[_0x7d67('0x2c')]=qs[_0x7d67('0x2c')](_0x39e24a['query'][_0x7d67('0x2c')]);_0x1a2f83[_0x7d67('0x2a')]=qs[_0x7d67('0x2a')](_0x39e24a[_0x7d67('0x44')][_0x7d67('0x2a')]);}return _0x1cfbb5[_0x7d67('0x74')](_0x1a2f83);}})[_0x7d67('0x1d')](function(_0x4026be){if(_0x4026be){return _0x4026be?{'count':_0x38d757,'rows':_0x4026be}:null;}})[_0x7d67('0x1d')](respondWithResult(_0x2b0014,null))[_0x7d67('0x26')](handleError(_0x2b0014,null));};exports[_0x7d67('0x75')]=function(_0x153093,_0x19ca77,_0x24cbbe){return db['WhatsappAccount'][_0x7d67('0x6c')]({'where':{'id':_0x153093['params']['id']}})[_0x7d67('0x1d')](handleEntityNotFound(_0x19ca77,null))[_0x7d67('0x1d')](function(_0x30d42c){if(_0x30d42c){return db['sequelize'][_0x7d67('0x76')](function(_0x4d4224){return db[_0x7d67('0x77')][_0x7d67('0x37')]({'where':{'WhatsappAccountId':_0x153093[_0x7d67('0x56')]['id']},'transaction':_0x4d4224})[_0x7d67('0x1d')](function(_0x2bd43b){var _0x4d154f=_[_0x7d67('0x43')](_0x153093[_0x7d67('0x5a')],function(_0x466972){_0x466972[_0x7d67('0x63')]=_0x153093['params']['id'];return _0x466972;});return db[_0x7d67('0x77')][_0x7d67('0x78')](_0x4d154f,{'transaction':_0x4d4224});});})[_0x7d67('0x1d')](function(){return db[_0x7d67('0x77')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x153093[_0x7d67('0x56')]['id']},'order':_0x7d67('0x79')});});}})[_0x7d67('0x1d')](respondWithResult(_0x19ca77,null))['catch'](handleError(_0x19ca77,null));};exports['getApplications']=function(_0x18472b,_0x27f0c3,_0x499d75){var _0x322376={};var _0x3a24fc={};var _0x1f8f2a;var _0x2ee841;return db[_0x7d67('0x3d')]['findOne']({'where':{'id':_0x18472b[_0x7d67('0x56')]['id']}})[_0x7d67('0x1d')](handleEntityNotFound(_0x27f0c3,null))[_0x7d67('0x1d')](function(_0x480cdc){if(_0x480cdc){_0x1f8f2a=_0x480cdc;_0x3a24fc[_0x7d67('0x42')]=_['keys'](db['WhatsappApplication'][_0x7d67('0x3e')]);_0x3a24fc[_0x7d67('0x44')]=_[_0x7d67('0x45')](_0x18472b[_0x7d67('0x44')]);_0x3a24fc[_0x7d67('0x46')]=_['intersection'](_0x3a24fc[_0x7d67('0x42')],_0x3a24fc['query']);_0x322376[_0x7d67('0x48')]=_[_0x7d67('0x47')](_0x3a24fc[_0x7d67('0x42')],qs[_0x7d67('0x49')](_0x18472b['query'][_0x7d67('0x49')]));_0x322376[_0x7d67('0x48')]=_0x322376[_0x7d67('0x48')][_0x7d67('0x4a')]?_0x322376[_0x7d67('0x48')]:_0x3a24fc['model'];_0x322376['order']=qs[_0x7d67('0x4e')](_0x18472b[_0x7d67('0x44')][_0x7d67('0x4e')]);_0x322376[_0x7d67('0x4f')]=qs['filters'](_[_0x7d67('0x50')](_0x18472b[_0x7d67('0x44')],_0x3a24fc[_0x7d67('0x46')]));if(_0x18472b[_0x7d67('0x44')][_0x7d67('0x51')]){_0x322376['where']=_[_0x7d67('0x52')](_0x322376[_0x7d67('0x4f')],{'$or':_[_0x7d67('0x43')](_0x322376[_0x7d67('0x48')],function(_0x5e7dc9){var _0x4be86d={};_0x4be86d[_0x5e7dc9]={'$like':'%'+_0x18472b['query'][_0x7d67('0x51')]+'%'};return _0x4be86d;})});}_0x322376=_[_0x7d67('0x52')]({},_0x322376,_0x18472b['options']);return _0x1f8f2a[_0x7d67('0x7a')](_0x322376);}})['then'](function(_0x3ab012){if(_0x3ab012){_0x2ee841=_0x3ab012[_0x7d67('0x4a')];if(!_0x18472b[_0x7d67('0x44')][_0x7d67('0x4b')](_0x7d67('0x4c'))){_0x322376[_0x7d67('0x2c')]=qs[_0x7d67('0x2c')](_0x18472b[_0x7d67('0x44')][_0x7d67('0x2c')]);_0x322376[_0x7d67('0x2a')]=qs[_0x7d67('0x2a')](_0x18472b[_0x7d67('0x44')][_0x7d67('0x2a')]);}return _0x1f8f2a[_0x7d67('0x7a')](_0x322376);}})[_0x7d67('0x1d')](function(_0x5c7905){if(_0x5c7905){return _0x5c7905?{'count':_0x2ee841,'rows':_0x5c7905}:null;}})[_0x7d67('0x1d')](respondWithResult(_0x27f0c3,null))['catch'](handleError(_0x27f0c3,null));};exports['notify']=function(_0x544a92,_0x129bb9,_0x2a006e){var _0x3e38a2={'channel':_0x7d67('0x7b')};var _0x2f10f9=[];var _0x45998d=[];var _0x4c1f77={};return db['WhatsappAccount']['find']({'where':{'id':_0x544a92[_0x7d67('0x56')]['id']},'include':[{'model':db[_0x7d67('0x77')],'as':_0x7d67('0x7c')}]})[_0x7d67('0x1d')](handleEntityNotFound(_0x129bb9,null))[_0x7d67('0x1d')](function(_0x2b6880){_0x3e38a2[_0x7d67('0x7d')]=_0x2b6880;_0x3e38a2['applications']=_['orderBy'](_0x2b6880[_0x7d67('0x7c')],[_0x7d67('0x79')],[_0x7d67('0x7e')]);if(_0x3e38a2[_0x7d67('0x7d')][_0x7d67('0x7c')]){delete _0x3e38a2[_0x7d67('0x7d')]['Applications'];}return db[_0x7d67('0x7f')][_0x7d67('0x62')]();})[_0x7d67('0x1d')](function(_0x25fc55){if(!_0x25fc55){throw new db[(_0x7d67('0x80'))][(_0x7d67('0x81'))](_0x7d67('0x82'));}_0x2f10f9=_['difference'](_[_0x7d67('0x45')](_0x25fc55),[_0x7d67('0x83'),_0x7d67('0x84')]);_0x45998d=_[_0x7d67('0x85')](_[_0x7d67('0x45')](_0x25fc55),['createdAt',_0x7d67('0x84'),'CompanyId','ListId']);_0x3e38a2['body']={'mapKey':_0x7d67('0x86')};if(_0x3e38a2[_0x7d67('0x7d')][_0x7d67('0x40')]&&_0x3e38a2['account'][_0x7d67('0x40')]==='twilio'){_0x3e38a2[_0x7d67('0x5a')][_0x7d67('0x87')]=_0x544a92[_0x7d67('0x5a')]['From']['replace']('whatsapp:','');_0x3e38a2[_0x7d67('0x5a')][_0x7d67('0x5a')]=_0x544a92['body']['Body'];_0x3e38a2[_0x7d67('0x5a')]['messageId']=_0x544a92[_0x7d67('0x5a')][_0x7d67('0x88')];}if(_0x3e38a2['body']['id']){delete _0x3e38a2[_0x7d67('0x5a')]['id'];}if(_[_0x7d67('0x89')](_0x3e38a2[_0x7d67('0x5a')][_0x7d67('0x87')])){throw new db[(_0x7d67('0x80'))]['ValidationError'](_0x7d67('0x8a'));}if(_['isNil'](_0x3e38a2[_0x7d67('0x5a')][_0x7d67('0x5a')])||_0x3e38a2[_0x7d67('0x5a')][_0x7d67('0x5a')]===''){throw new db[(_0x7d67('0x80'))]['ValidationError'](_0x7d67('0x8b'));}if(_['isNil'](_0x3e38a2['body'][_0x7d67('0x8c')])){throw new db[(_0x7d67('0x80'))][(_0x7d67('0x81'))](_0x7d67('0x8d')+_0x45998d);}if(!_[_0x7d67('0x8e')](_0x45998d,_0x3e38a2[_0x7d67('0x5a')]['mapKey'])){throw new db[(_0x7d67('0x80'))][(_0x7d67('0x81'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x45998d);}_0x4c1f77[_0x3e38a2[_0x7d67('0x5a')][_0x7d67('0x8c')]]=_0x3e38a2['body'][_0x7d67('0x87')];return db[_0x7d67('0x8f')][_0x7d67('0x58')]({'where':{'id':_0x3e38a2[_0x7d67('0x7d')][_0x7d67('0x90')]},'include':[{'model':db[_0x7d67('0x7f')],'as':'Contacts','where':_0x4c1f77,'limit':0x1,'order':[[_0x7d67('0x84'),_0x7d67('0x91')]]}]});})[_0x7d67('0x1d')](handleEntityNotFound(_0x129bb9,null))[_0x7d67('0x1d')](function(_0x3eb30b){if(_0x3eb30b){_0x3e38a2[_0x7d67('0x92')]=_['omit'](_0x3eb30b,[_0x7d67('0x93')]);if(_0x3eb30b['Contacts'][_0x7d67('0x4a')]){return _0x3eb30b['Contacts'][0x0];}var _0x3b14a3=_['defaults'](_0x3e38a2['body'],{'firstName':_0x3e38a2['body']['from'],'ListId':_0x3eb30b['id']});_0x3b14a3[_0x3e38a2[_0x7d67('0x5a')]['mapKey']]=_0x3e38a2[_0x7d67('0x5a')]['from'];return db[_0x7d67('0x7f')][_0x7d67('0x59')](_0x3b14a3,{'fields':_0x2f10f9,'raw':!![]});}})[_0x7d67('0x1d')](handleEntityNotFound(_0x129bb9,null))[_0x7d67('0x1d')](function(_0x5e5e45){if(_0x5e5e45){_0x3e38a2[_0x7d67('0x94')]=_0x5e5e45;var _0x1c18e8={'ContactId':_0x5e5e45['id'],'phone':_0x3e38a2['body'][_0x7d67('0x87')],'WhatsappAccountId':_0x544a92[_0x7d67('0x56')]['id']};var _0x26954d={'ContactId':_0x5e5e45['id'],'WhatsappAccountId':_0x544a92[_0x7d67('0x56')]['id'],'closed':![]};return db[_0x7d67('0x95')][_0x7d67('0x58')]({'where':_0x26954d})['then'](function(_0x28882a){if(_0x28882a){return[_0x28882a,![]];}return db['WhatsappInteraction'][_0x7d67('0x59')](_0x1c18e8)[_0x7d67('0x1d')](function(_0x1416b1){return[_0x1416b1,!![]];});});}})[_0x7d67('0x6f')](function(_0x58c5a9,_0x55614e){_0x3e38a2[_0x7d67('0x96')]=_0x58c5a9[_0x7d67('0x34')]({'plain':!![]});_0x3e38a2[_0x7d67('0x96')][_0x7d67('0x97')]=![];if(_0x55614e){if(_0x3e38a2[_0x7d67('0x7d')][_0x7d67('0x98')]){_0x3e38a2[_0x7d67('0x99')][_0x7d67('0x9a')]({'id':0x0,'priority':_0x3e38a2[_0x7d67('0x99')][_0x7d67('0x4a')]+0x1,'app':_0x7d67('0x9b'),'appdata':_0x7d67('0x9c'),'interval':_0x7d67('0x9d')});}_0x3e38a2[_0x7d67('0x96')][_0x7d67('0x97')]=!![];}return db[_0x7d67('0x9e')][_0x7d67('0x59')]({'phone':_0x3e38a2[_0x7d67('0x5a')]['from'],'messageId':_0x3e38a2[_0x7d67('0x5a')][_0x7d67('0x9f')],'body':_0x3e38a2[_0x7d67('0x5a')][_0x7d67('0x5a')],'WhatsappAccountId':_0x544a92[_0x7d67('0x56')]['id'],'WhatsappInteractionId':_0x58c5a9['id'],'direction':'in','ContactId':_0x58c5a9[_0x7d67('0xa0')],'AttachmentId':_0x3e38a2['body'][_0x7d67('0xa1')]});})['then'](function(_0x248b88){_0x3e38a2[_0x7d67('0x25')]=_0x248b88;if(_0x3e38a2['interaction'][_0x7d67('0xa2')]){return db[_0x7d67('0xa3')][_0x7d67('0x58')]({'attributes':['id',_0x7d67('0x39')],'where':{'id':_0x3e38a2[_0x7d67('0x96')][_0x7d67('0xa2')]}})[_0x7d67('0x1d')](function(_0x26caa4){if(_0x26caa4){_0x3e38a2[_0x7d67('0x99')][_0x7d67('0xa4')]({'id':0x0,'priority':0x0,'app':_0x7d67('0xa5'),'appdata':_0x26caa4[_0x7d67('0x39')]+','+(_0x3e38a2[_0x7d67('0x7d')][_0x7d67('0xa6')]||0xa),'interval':_0x7d67('0x9d')});}return respondWithRpcPromise(_0x7d67('0xa7'),'startRouting',_0x3e38a2);});}return respondWithRpcPromise(_0x7d67('0xa7'),'startRouting',_0x3e38a2);})[_0x7d67('0x1d')](function(_0x28cf68){if(_0x28cf68){var _0x421e87=0xc8;var _0x48ac11=_0x7d67('0xa8');logger[_0x7d67('0x1e')](_0x7d67('0x21'),_0x48ac11,_0x421e87,_0x7d67('0xa9'));logger[_0x7d67('0x20')](_0x7d67('0xaa'),_0x48ac11,_0x421e87,_0x7d67('0xa9'),JSON[_0x7d67('0xab')](_0x28cf68));if(_0x3e38a2[_0x7d67('0x7d')]['type']==='twilio'){return _0x129bb9[_0x7d67('0x28')](_0x421e87)[_0x7d67('0x2e')](_0x7d67('0xac'),'text/xml')[_0x7d67('0x3a')](_0x7d67('0xad'));}else{return _0x129bb9['status'](_0x421e87)[_0x7d67('0x29')](_0x28cf68);}}})[_0x7d67('0x26')](handleError(_0x129bb9,null));};exports[_0x7d67('0x3a')]=function(_0x419792,_0xa55f62,_0x386968){var _0x5ac27f,_0x448211,_0x2e7c70;if(_['isNil'](_0x419792[_0x7d67('0x5a')][_0x7d67('0x5a')])||_0x419792[_0x7d67('0x5a')]['body']===''){throw new db[(_0x7d67('0x80'))][(_0x7d67('0x81'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7d67('0x89')](_0x419792['body']['to'])){throw new db['Sequelize'][(_0x7d67('0x81'))](_0x7d67('0xae'));}_0x5ac27f=_0x419792[_0x7d67('0x5a')]['to'];return db[_0x7d67('0x3d')][_0x7d67('0x58')]({'where':{'id':_0x419792['params']['id']},'include':[{'model':db[_0x7d67('0x8f')],'as':_0x7d67('0xaf'),'include':[{'model':db[_0x7d67('0x7f')],'as':'Contacts','where':{'mobile':_0x5ac27f},'limit':0x1,'order':[['updatedAt',_0x7d67('0x91')]]}]}]})[_0x7d67('0x1d')](handleEntityNotFound(_0xa55f62,null))['then'](function(_0x5cf533){if(_0x5cf533&&_0x5cf533[_0x7d67('0xaf')]){_0x448211=_0x5cf533[_0x7d67('0x34')]({'plain':!![]});if(_0x448211['List']&&_0x448211[_0x7d67('0xaf')][_0x7d67('0x93')][_0x7d67('0x4a')]){return _0x448211[_0x7d67('0xaf')][_0x7d67('0x93')][0x0];}return db[_0x7d67('0x7f')]['create'](_['defaults'](_0x419792[_0x7d67('0x5a')],{'firstName':_0x5ac27f,'mobile':_0x5ac27f,'phone':_0x5ac27f,'ListId':_0x448211[_0x7d67('0x90')]}));}})[_0x7d67('0x1d')](handleEntityNotFound(_0xa55f62,null))[_0x7d67('0x1d')](function(_0x517dfc){if(_0x517dfc){_0x2e7c70=_0x517dfc;return db[_0x7d67('0x95')][_0x7d67('0x58')]({'where':{'ContactId':_0x2e7c70['id'],'closed':![],'WhatsappAccountId':_0x448211['id']}})[_0x7d67('0x1d')](function(_0x142bcb){if(_0x142bcb){return[_0x142bcb,![]];}return db[_0x7d67('0x95')]['create']({'UserId':_0x419792[_0x7d67('0x5b')]['id'],'ContactId':_0x2e7c70['id'],'WhatsappAccountId':_0x448211['id'],'phone':_0x5ac27f,'firstMsgDirection':_0x7d67('0xb0'),'Messages':[_['merge'](_0x419792[_0x7d67('0x5a')],{'read':![],'body':_0x419792[_0x7d67('0x5a')][_0x7d67('0x5a')],'phone':_0x5ac27f,'WhatsappAccountId':_0x448211['id'],'UserId':_0x419792[_0x7d67('0x5b')]['id'],'ContactId':_0x2e7c70['id']})]},{'include':[{'model':db[_0x7d67('0x9e')],'as':_0x7d67('0xb1')}]})[_0x7d67('0x1d')](function(_0x258a40){return[_0x258a40,!![]];});});}})['spread'](function(_0xda7048,_0x35cd26){if(_0x35cd26){return _0xda7048;}return db[_0x7d67('0x9e')][_0x7d67('0x59')](_['merge'](_0x419792[_0x7d67('0x5a')],{'read':![],'body':_0x419792[_0x7d67('0x5a')][_0x7d67('0x5a')],'phone':_0x5ac27f,'WhatsappAccountId':_0x448211['id'],'WhatsappInteractionId':_0xda7048['id'],'UserId':_0x419792[_0x7d67('0x5b')]['id'],'ContactId':_0x2e7c70['id']}))[_0x7d67('0x1d')](function(_0x2afc1c){_0xda7048[_0x7d67('0xb2')][_0x7d67('0xb1')]=[];_0xda7048['dataValues'][_0x7d67('0xb1')][_0x7d67('0x9a')](_0x2afc1c[_0x7d67('0xb2')]);return _0xda7048;});})[_0x7d67('0x1d')](respondWithResult(_0xa55f62,null))[_0x7d67('0x26')](handleError(_0xa55f62,null));}; \ No newline at end of file +var _0x4c6e=['ids','addAnswer','getAnswers','findOne','CannedAnswer','pick','findAll','removeAnswers','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','emit','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','whatsapp','Applications','account','applications','orderBy','asc','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','replace','whatsapp:','Body','messageId','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','DESC','list','defaults','WhatsappInteraction','interaction','created','WhatsappMessage','ContactId','AttachmentId','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','json','to\x20is\x20mandatory','List','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','update','get','WhatsappAccounts','destroy','name','send','index','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','include','rows','catch','show','params','includeAll','find','create','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','order','WhatsappAccountId','removeDispositions'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x4c6e,0x105));var _0xe4c6=function(_0x3b3997,_0x203518){_0x3b3997=_0x3b3997-0x0;var _0x1c6a65=_0x4c6e[_0x3b3997];return _0x1c6a65;};'use strict';var emlformat=require(_0xe4c6('0x0'));var rimraf=require(_0xe4c6('0x1'));var zipdir=require(_0xe4c6('0x2'));var jsonpatch=require(_0xe4c6('0x3'));var rp=require(_0xe4c6('0x4'));var moment=require('moment');var BPromise=require(_0xe4c6('0x5'));var Mustache=require(_0xe4c6('0x6'));var util=require(_0xe4c6('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe4c6('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c6('0x9'));var _=require(_0xe4c6('0xa'));var squel=require(_0xe4c6('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe4c6('0xc'));var querystring=require('querystring');var Papa=require(_0xe4c6('0xd'));var Redis=require(_0xe4c6('0xe'));var authService=require(_0xe4c6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe4c6('0x10'));var hardwareService=require(_0xe4c6('0x11'));var logger=require(_0xe4c6('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xe4c6('0x13'));var licenseUtil=require(_0xe4c6('0x14'));var db=require(_0xe4c6('0x15'))['db'];config[_0xe4c6('0x16')]=_['defaults'](config[_0xe4c6('0x16')],{'host':_0xe4c6('0x17'),'port':0x18eb});var socket=require(_0xe4c6('0x18'))(new Redis(config['redis']));require(_0xe4c6('0x19'))[_0xe4c6('0x1a')](socket);var jayson=require(_0xe4c6('0x1b'));var client=jayson[_0xe4c6('0x1c')][_0xe4c6('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0xbc4e4a,_0x3c2c9a,_0x4889a3,_0x4adf00){return new BPromise(function(_0x12c15e,_0x358a1e){var _0x563de3=_0x4adf00||client;return _0x563de3['request'](_0xbc4e4a,_0x4889a3)[_0xe4c6('0x1e')](function(_0xbb448c){logger[_0xe4c6('0x1f')](_0xe4c6('0x20'),_0x3c2c9a,_0xe4c6('0x21'));logger[_0xe4c6('0x22')](_0xe4c6('0x23'),_0x3c2c9a,_0xe4c6('0x21'),JSON[_0xe4c6('0x24')](_0xbb448c));if(_0xbb448c[_0xe4c6('0x25')]){if(_0xbb448c[_0xe4c6('0x25')][_0xe4c6('0x26')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3c2c9a,_0xbb448c[_0xe4c6('0x25')][_0xe4c6('0x27')]);return _0x358a1e(_0xbb448c[_0xe4c6('0x25')][_0xe4c6('0x27')]);}logger['error'](_0xe4c6('0x20'),_0x3c2c9a,_0xbb448c[_0xe4c6('0x25')][_0xe4c6('0x27')]);return _0x12c15e(_0xbb448c[_0xe4c6('0x25')][_0xe4c6('0x27')]);}else{logger[_0xe4c6('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x3c2c9a,_0xe4c6('0x21'));_0x12c15e(_0xbb448c[_0xe4c6('0x28')][_0xe4c6('0x27')]);}})['catch'](function(_0x2d7a8a){logger[_0xe4c6('0x25')](_0xe4c6('0x20'),_0x3c2c9a,_0x2d7a8a);_0x358a1e(_0x2d7a8a);});});}function respondWithStatusCode(_0x1d1d3b,_0x2464d5){_0x2464d5=_0x2464d5||0xcc;return function(_0x24d7a2){if(_0x24d7a2){return _0x1d1d3b[_0xe4c6('0x29')](_0x2464d5);}return _0x1d1d3b[_0xe4c6('0x2a')](_0x2464d5)[_0xe4c6('0x2b')]();};}function respondWithResult(_0x46b180,_0x414f52){_0x414f52=_0x414f52||0xc8;return function(_0x59555b){if(_0x59555b){return _0x46b180['status'](_0x414f52)['json'](_0x59555b);}};}function respondWithFilteredResult(_0x1ce1c8,_0x17d842){return function(_0x19cbd5){if(_0x19cbd5){var _0x2a1bb8=typeof _0x17d842[_0xe4c6('0x2c')]===_0xe4c6('0x2d')&&typeof _0x17d842[_0xe4c6('0x2e')]===_0xe4c6('0x2d');var _0x57bf8c=_0x19cbd5[_0xe4c6('0x2f')];var _0x5935b1=_0x2a1bb8?0x0:_0x17d842[_0xe4c6('0x2c')];var _0x4b13da=_0x2a1bb8?_0x19cbd5[_0xe4c6('0x2f')]:_0x17d842[_0xe4c6('0x2c')]+_0x17d842['limit'];var _0x5eb190;if(_0x4b13da>=_0x57bf8c){_0x4b13da=_0x57bf8c;_0x5eb190=0xc8;}else{_0x5eb190=0xce;}_0x1ce1c8[_0xe4c6('0x2a')](_0x5eb190);return _0x1ce1c8['set'](_0xe4c6('0x30'),_0x5935b1+'-'+_0x4b13da+'/'+_0x57bf8c)['json'](_0x19cbd5);}return null;};}function patchUpdates(_0xac7548){return function(_0x295dfa){try{jsonpatch[_0xe4c6('0x31')](_0x295dfa,_0xac7548,!![]);}catch(_0x18db45){return BPromise[_0xe4c6('0x32')](_0x18db45);}return _0x295dfa['save']();};}function saveUpdates(_0x230daf,_0x1d484b){return function(_0x347d33){if(_0x347d33){return _0x347d33[_0xe4c6('0x33')](_0x230daf)[_0xe4c6('0x1e')](function(_0x48e5a6){return _0x48e5a6;});}return null;};}function removeEntity(_0x4a6fef,_0x3e93c8){return function(_0x2dabae){if(_0x2dabae){return _0x2dabae['destroy']()[_0xe4c6('0x1e')](function(){var _0x4061e9=_0x2dabae[_0xe4c6('0x34')]({'plain':!![]});var _0xf6d54=_0xe4c6('0x35');return db['UserProfileResource'][_0xe4c6('0x36')]({'where':{'type':_0xf6d54,'resourceId':_0x4061e9['id']}})[_0xe4c6('0x1e')](function(){return _0x2dabae;});})[_0xe4c6('0x1e')](function(){_0x4a6fef[_0xe4c6('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bb787,_0x20dc13){return function(_0xc59ba9){if(!_0xc59ba9){_0x4bb787[_0xe4c6('0x29')](0x194);}return _0xc59ba9;};}function handleError(_0x1110f8,_0x50f833){_0x50f833=_0x50f833||0x1f4;return function(_0x24db9d){logger[_0xe4c6('0x25')](_0x24db9d['stack']);if(_0x24db9d[_0xe4c6('0x37')]){delete _0x24db9d[_0xe4c6('0x37')];}_0x1110f8['status'](_0x50f833)[_0xe4c6('0x38')](_0x24db9d);};}exports[_0xe4c6('0x39')]=function(_0x163b32,_0x5c868b){var _0x5b4048={'include':[{'model':db[_0xe4c6('0x3a')],'as':_0xe4c6('0x3b')}]},_0x2ed828={},_0x12329d={'count':0x0,'rows':[]};var _0x39891f=_['map'](db[_0xe4c6('0x3c')][_0xe4c6('0x3d')],function(_0x7a6879){return{'name':_0x7a6879[_0xe4c6('0x3e')],'type':_0x7a6879[_0xe4c6('0x3f')][_0xe4c6('0x40')]};});_0x2ed828['model']=_[_0xe4c6('0x41')](_0x39891f,_0xe4c6('0x37'));_0x2ed828[_0xe4c6('0x42')]=_[_0xe4c6('0x43')](_0x163b32[_0xe4c6('0x42')]);_0x2ed828[_0xe4c6('0x44')]=_[_0xe4c6('0x45')](_0x2ed828[_0xe4c6('0x46')],_0x2ed828['query']);_0x5b4048[_0xe4c6('0x47')]=_['intersection'](_0x2ed828[_0xe4c6('0x46')],qs['fields'](_0x163b32[_0xe4c6('0x42')][_0xe4c6('0x48')]));_0x5b4048[_0xe4c6('0x47')]=_0x5b4048[_0xe4c6('0x47')][_0xe4c6('0x49')]?_0x5b4048[_0xe4c6('0x47')]:_0x2ed828[_0xe4c6('0x46')];if(!_0x163b32[_0xe4c6('0x42')][_0xe4c6('0x4a')](_0xe4c6('0x4b'))){_0x5b4048[_0xe4c6('0x2e')]=qs[_0xe4c6('0x2e')](_0x163b32[_0xe4c6('0x42')][_0xe4c6('0x2e')]);_0x5b4048['offset']=qs[_0xe4c6('0x2c')](_0x163b32[_0xe4c6('0x42')][_0xe4c6('0x2c')]);}_0x5b4048['order']=qs[_0xe4c6('0x4c')](_0x163b32[_0xe4c6('0x42')][_0xe4c6('0x4c')]);_0x5b4048[_0xe4c6('0x4d')]=qs[_0xe4c6('0x44')](_['pick'](_0x163b32[_0xe4c6('0x42')],_0x2ed828[_0xe4c6('0x44')]),_0x39891f);if(_0x163b32[_0xe4c6('0x42')][_0xe4c6('0x4e')]){_0x5b4048[_0xe4c6('0x4d')]=_['merge'](_0x5b4048[_0xe4c6('0x4d')],{'$or':_[_0xe4c6('0x41')](_0x39891f,function(_0x5aa683){if(_0x5aa683[_0xe4c6('0x3f')]!==_0xe4c6('0x4f')){var _0x562a08={};_0x562a08[_0x5aa683[_0xe4c6('0x37')]]={'$like':'%'+_0x163b32['query'][_0xe4c6('0x4e')]+'%'};return _0x562a08;}})});}_0x5b4048=_[_0xe4c6('0x50')]({},_0x5b4048,_0x163b32[_0xe4c6('0x51')]);var _0xaf8c58={'where':_0x5b4048['where']};return db['WhatsappAccount'][_0xe4c6('0x2f')](_0xaf8c58)[_0xe4c6('0x1e')](function(_0x47f624){_0x12329d[_0xe4c6('0x2f')]=_0x47f624;if(_0x163b32['query']['includeAll']){_0x5b4048[_0xe4c6('0x52')]=[{'all':!![]}];}return db[_0xe4c6('0x3c')]['findAll'](_0x5b4048);})['then'](function(_0x2ba601){_0x12329d[_0xe4c6('0x53')]=_0x2ba601;return _0x12329d;})['then'](respondWithFilteredResult(_0x5c868b,_0x5b4048))[_0xe4c6('0x54')](handleError(_0x5c868b,null));};exports[_0xe4c6('0x55')]=function(_0x2ab02f,_0x514df6){var _0x189d79={'raw':![],'where':{'id':_0x2ab02f[_0xe4c6('0x56')]['id']},'include':[{'model':db[_0xe4c6('0x3a')],'as':_0xe4c6('0x3b')}]},_0x31b3ec={};_0x31b3ec[_0xe4c6('0x46')]=_[_0xe4c6('0x43')](db[_0xe4c6('0x3c')][_0xe4c6('0x3d')]);_0x31b3ec[_0xe4c6('0x42')]=_['keys'](_0x2ab02f[_0xe4c6('0x42')]);_0x31b3ec[_0xe4c6('0x44')]=_[_0xe4c6('0x45')](_0x31b3ec[_0xe4c6('0x46')],_0x31b3ec[_0xe4c6('0x42')]);_0x189d79['attributes']=_[_0xe4c6('0x45')](_0x31b3ec[_0xe4c6('0x46')],qs[_0xe4c6('0x48')](_0x2ab02f[_0xe4c6('0x42')]['fields']));_0x189d79[_0xe4c6('0x47')]=_0x189d79[_0xe4c6('0x47')][_0xe4c6('0x49')]?_0x189d79[_0xe4c6('0x47')]:_0x31b3ec[_0xe4c6('0x46')];if(_0x2ab02f[_0xe4c6('0x42')][_0xe4c6('0x57')]){_0x189d79[_0xe4c6('0x52')]=[{'all':!![]}];}_0x189d79=_[_0xe4c6('0x50')]({},_0x189d79,_0x2ab02f['options']);return db[_0xe4c6('0x3c')][_0xe4c6('0x58')](_0x189d79)[_0xe4c6('0x1e')](handleEntityNotFound(_0x514df6,null))[_0xe4c6('0x1e')](respondWithResult(_0x514df6,null))[_0xe4c6('0x54')](handleError(_0x514df6,null));};exports[_0xe4c6('0x59')]=function(_0x541161,_0x2e06a1){return db[_0xe4c6('0x3c')][_0xe4c6('0x59')](_0x541161['body'],{})[_0xe4c6('0x1e')](function(_0x3595fa){var _0x4ddec7=_0x541161[_0xe4c6('0x5a')][_0xe4c6('0x34')]({'plain':!![]});if(!_0x4ddec7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ddec7[_0xe4c6('0x5b')]===_0xe4c6('0x5a')){var _0x2967a7=_0x3595fa[_0xe4c6('0x34')]({'plain':!![]});var _0x1a23f5=_0xe4c6('0x35');return db[_0xe4c6('0x5c')][_0xe4c6('0x58')]({'where':{'name':_0x1a23f5,'userProfileId':_0x4ddec7['userProfileId']},'raw':!![]})['then'](function(_0x5c42d6){if(_0x5c42d6&&_0x5c42d6[_0xe4c6('0x5d')]===0x0){return db[_0xe4c6('0x5e')]['create']({'name':_0x2967a7['name'],'resourceId':_0x2967a7['id'],'type':_0x5c42d6[_0xe4c6('0x37')],'sectionId':_0x5c42d6['id']},{})['then'](function(){return _0x3595fa;});}else{return _0x3595fa;}})[_0xe4c6('0x54')](function(_0x396a28){logger[_0xe4c6('0x25')](_0xe4c6('0x5f'),_0x396a28);throw _0x396a28;});}return _0x3595fa;})[_0xe4c6('0x1e')](respondWithResult(_0x2e06a1,0xc9))['catch'](handleError(_0x2e06a1,null));};exports[_0xe4c6('0x33')]=function(_0x31ff8c,_0x1bfdc8){if(_0x31ff8c[_0xe4c6('0x60')]['id']){delete _0x31ff8c[_0xe4c6('0x60')]['id'];}return db[_0xe4c6('0x3c')][_0xe4c6('0x58')]({'where':{'id':_0x31ff8c[_0xe4c6('0x56')]['id']},'include':[{'model':db[_0xe4c6('0x3a')],'as':_0xe4c6('0x3b')}]})[_0xe4c6('0x1e')](handleEntityNotFound(_0x1bfdc8,null))[_0xe4c6('0x1e')](saveUpdates(_0x31ff8c[_0xe4c6('0x60')],null))[_0xe4c6('0x1e')](respondWithResult(_0x1bfdc8,null))['catch'](handleError(_0x1bfdc8,null));};exports[_0xe4c6('0x36')]=function(_0x5f5d27,_0x39abe8){return db[_0xe4c6('0x3c')][_0xe4c6('0x58')]({'where':{'id':_0x5f5d27[_0xe4c6('0x56')]['id']}})[_0xe4c6('0x1e')](handleEntityNotFound(_0x39abe8,null))['then'](removeEntity(_0x39abe8,null))['catch'](handleError(_0x39abe8,null));};exports[_0xe4c6('0x61')]=function(_0x5a2e32,_0x591a66){return db[_0xe4c6('0x3c')][_0xe4c6('0x61')]()[_0xe4c6('0x1e')](respondWithResult(_0x591a66,null))[_0xe4c6('0x54')](handleError(_0x591a66,null));};exports[_0xe4c6('0x62')]=function(_0x1d15db,_0x1bbbb9,_0x5f1c3a){if(_0x1d15db[_0xe4c6('0x60')]['id']){delete _0x1d15db[_0xe4c6('0x60')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x1d15db[_0xe4c6('0x56')]['id']}})['then'](handleEntityNotFound(_0x1bbbb9,null))[_0xe4c6('0x1e')](function(_0x7b2089){if(_0x7b2089){_0x1d15db[_0xe4c6('0x60')]['WhatsappAccountId']=_0x7b2089['id'];return db['Disposition'][_0xe4c6('0x59')](_0x1d15db[_0xe4c6('0x60')]);}})[_0xe4c6('0x1e')](respondWithResult(_0x1bbbb9,null))[_0xe4c6('0x54')](handleError(_0x1bbbb9,null));};exports['getDispositions']=function(_0x2c1af0,_0x51c6d2,_0x129662){var _0x3379f3={'raw':![],'where':{}};var _0x1a4b4f={};var _0x2d5c33={'count':0x0,'rows':[]};return db[_0xe4c6('0x3c')]['findOne']({'where':{'id':_0x2c1af0['params']['id']}})[_0xe4c6('0x1e')](handleEntityNotFound(_0x51c6d2,null))['then'](function(_0x2e1b7b){if(_0x2e1b7b){_0x1a4b4f[_0xe4c6('0x46')]=_[_0xe4c6('0x43')](db[_0xe4c6('0x63')][_0xe4c6('0x3d')]);_0x1a4b4f[_0xe4c6('0x42')]=_[_0xe4c6('0x43')](_0x2c1af0['query']);_0x1a4b4f['filters']=_[_0xe4c6('0x45')](_0x1a4b4f[_0xe4c6('0x46')],_0x1a4b4f[_0xe4c6('0x42')]);_0x3379f3['attributes']=_[_0xe4c6('0x45')](_0x1a4b4f['model'],qs[_0xe4c6('0x48')](_0x2c1af0['query'][_0xe4c6('0x48')]));_0x3379f3[_0xe4c6('0x47')]=_0x3379f3[_0xe4c6('0x47')][_0xe4c6('0x49')]?_0x3379f3[_0xe4c6('0x47')]:_0x1a4b4f[_0xe4c6('0x46')];if(!_0x2c1af0[_0xe4c6('0x42')][_0xe4c6('0x4a')]('nolimit')){_0x3379f3[_0xe4c6('0x2e')]=qs['limit'](_0x2c1af0['query'][_0xe4c6('0x2e')]);_0x3379f3[_0xe4c6('0x2c')]=qs[_0xe4c6('0x2c')](_0x2c1af0[_0xe4c6('0x42')][_0xe4c6('0x2c')]);}_0x3379f3[_0xe4c6('0x64')]=qs[_0xe4c6('0x4c')](_0x2c1af0[_0xe4c6('0x42')][_0xe4c6('0x4c')]);_0x3379f3[_0xe4c6('0x4d')]=qs[_0xe4c6('0x44')](_['pick'](_0x2c1af0['query'],_0x1a4b4f[_0xe4c6('0x44')]));_0x3379f3[_0xe4c6('0x4d')][_0xe4c6('0x65')]=_0x2e1b7b['id'];if(_0x2c1af0[_0xe4c6('0x42')][_0xe4c6('0x4e')]){_0x3379f3['where']=_[_0xe4c6('0x50')](_0x3379f3[_0xe4c6('0x4d')],{'$or':_['map'](_0x3379f3[_0xe4c6('0x47')],function(_0x3cd3f1){var _0x2b1ed3={};_0x2b1ed3[_0x3cd3f1]={'$like':'%'+_0x2c1af0[_0xe4c6('0x42')]['filter']+'%'};return _0x2b1ed3;})});}_0x3379f3=_[_0xe4c6('0x50')]({},_0x3379f3,_0x2c1af0['options']);return db[_0xe4c6('0x63')][_0xe4c6('0x2f')]({'where':_0x3379f3[_0xe4c6('0x4d')]})[_0xe4c6('0x1e')](function(_0x49e724){_0x2d5c33[_0xe4c6('0x2f')]=_0x49e724;if(_0x2c1af0['query']['includeAll']){_0x3379f3[_0xe4c6('0x52')]=[{'all':!![]}];}return db[_0xe4c6('0x63')]['findAll'](_0x3379f3);})[_0xe4c6('0x1e')](function(_0x5848b5){_0x2d5c33[_0xe4c6('0x53')]=_0x5848b5;return _0x2d5c33;});}})[_0xe4c6('0x1e')](respondWithFilteredResult(_0x51c6d2,_0x3379f3))['catch'](handleError(_0x51c6d2,null));};exports['removeDispositions']=function(_0x5bfc80,_0x309f0c,_0x199f69){return db[_0xe4c6('0x3c')]['find']({'where':{'id':_0x5bfc80[_0xe4c6('0x56')]['id']}})['then'](handleEntityNotFound(_0x309f0c,null))['then'](function(_0x297fad){if(_0x297fad){return _0x297fad[_0xe4c6('0x66')](_0x5bfc80['query'][_0xe4c6('0x67')]);}})[_0xe4c6('0x1e')](respondWithStatusCode(_0x309f0c,null))[_0xe4c6('0x54')](handleError(_0x309f0c,null));};exports[_0xe4c6('0x68')]=function(_0x9abec0,_0x3cc037,_0x392329){if(_0x9abec0[_0xe4c6('0x60')]['id']){delete _0x9abec0[_0xe4c6('0x60')]['id'];}return db[_0xe4c6('0x3c')][_0xe4c6('0x58')]({'where':{'id':_0x9abec0['params']['id']}})[_0xe4c6('0x1e')](handleEntityNotFound(_0x3cc037,null))[_0xe4c6('0x1e')](function(_0x405ff0){if(_0x405ff0){_0x9abec0['body'][_0xe4c6('0x65')]=_0x405ff0['id'];return db['CannedAnswer']['create'](_0x9abec0[_0xe4c6('0x60')]);}})['then'](respondWithResult(_0x3cc037,null))[_0xe4c6('0x54')](handleError(_0x3cc037,null));};exports[_0xe4c6('0x69')]=function(_0x3a32dd,_0x4bb600,_0x24b58a){var _0x5c5591={'raw':![],'where':{}};var _0x4d0883={};var _0x4ddd6f={'count':0x0,'rows':[]};return db[_0xe4c6('0x3c')][_0xe4c6('0x6a')]({'where':{'id':_0x3a32dd['params']['id']}})[_0xe4c6('0x1e')](handleEntityNotFound(_0x4bb600,null))[_0xe4c6('0x1e')](function(_0x8ddc2){if(_0x8ddc2){_0x4d0883[_0xe4c6('0x46')]=_['keys'](db[_0xe4c6('0x6b')]['rawAttributes']);_0x4d0883[_0xe4c6('0x42')]=_[_0xe4c6('0x43')](_0x3a32dd['query']);_0x4d0883[_0xe4c6('0x44')]=_['intersection'](_0x4d0883[_0xe4c6('0x46')],_0x4d0883[_0xe4c6('0x42')]);_0x5c5591[_0xe4c6('0x47')]=_['intersection'](_0x4d0883[_0xe4c6('0x46')],qs[_0xe4c6('0x48')](_0x3a32dd[_0xe4c6('0x42')]['fields']));_0x5c5591[_0xe4c6('0x47')]=_0x5c5591['attributes'][_0xe4c6('0x49')]?_0x5c5591[_0xe4c6('0x47')]:_0x4d0883['model'];if(!_0x3a32dd[_0xe4c6('0x42')][_0xe4c6('0x4a')](_0xe4c6('0x4b'))){_0x5c5591[_0xe4c6('0x2e')]=qs[_0xe4c6('0x2e')](_0x3a32dd['query'][_0xe4c6('0x2e')]);_0x5c5591[_0xe4c6('0x2c')]=qs[_0xe4c6('0x2c')](_0x3a32dd['query']['offset']);}_0x5c5591[_0xe4c6('0x64')]=qs['sort'](_0x3a32dd[_0xe4c6('0x42')]['sort']);_0x5c5591[_0xe4c6('0x4d')]=qs[_0xe4c6('0x44')](_[_0xe4c6('0x6c')](_0x3a32dd[_0xe4c6('0x42')],_0x4d0883[_0xe4c6('0x44')]));_0x5c5591['where'][_0xe4c6('0x65')]=_0x8ddc2['id'];if(_0x3a32dd[_0xe4c6('0x42')][_0xe4c6('0x4e')]){_0x5c5591['where']=_[_0xe4c6('0x50')](_0x5c5591['where'],{'$or':_[_0xe4c6('0x41')](_0x5c5591[_0xe4c6('0x47')],function(_0x32ce72){var _0x4c3472={};_0x4c3472[_0x32ce72]={'$like':'%'+_0x3a32dd[_0xe4c6('0x42')][_0xe4c6('0x4e')]+'%'};return _0x4c3472;})});}_0x5c5591=_[_0xe4c6('0x50')]({},_0x5c5591,_0x3a32dd[_0xe4c6('0x51')]);return db['CannedAnswer'][_0xe4c6('0x2f')]({'where':_0x5c5591[_0xe4c6('0x4d')]})['then'](function(_0x14203c){_0x4ddd6f[_0xe4c6('0x2f')]=_0x14203c;if(_0x3a32dd[_0xe4c6('0x42')]['includeAll']){_0x5c5591[_0xe4c6('0x52')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe4c6('0x6d')](_0x5c5591);})['then'](function(_0x3f0e40){_0x4ddd6f[_0xe4c6('0x53')]=_0x3f0e40;return _0x4ddd6f;});}})['then'](respondWithFilteredResult(_0x4bb600,_0x5c5591))['catch'](handleError(_0x4bb600,null));};exports[_0xe4c6('0x6e')]=function(_0x2bbeb0,_0x1abff4,_0x16915e){return db['WhatsappAccount'][_0xe4c6('0x58')]({'where':{'id':_0x2bbeb0['params']['id']}})[_0xe4c6('0x1e')](handleEntityNotFound(_0x1abff4,null))[_0xe4c6('0x1e')](function(_0x4738c0){if(_0x4738c0){return _0x4738c0[_0xe4c6('0x6e')](_0x2bbeb0[_0xe4c6('0x42')][_0xe4c6('0x67')]);}})['then'](respondWithStatusCode(_0x1abff4,null))['catch'](handleError(_0x1abff4,null));};exports[_0xe4c6('0x6f')]=function(_0x10eee9,_0x2814bf,_0x211fdb){return db[_0xe4c6('0x3c')]['find']({'where':{'id':_0x10eee9[_0xe4c6('0x56')]['id']}})['then'](handleEntityNotFound(_0x2814bf,null))[_0xe4c6('0x1e')](function(_0xa20a13){if(_0xa20a13){return _0xa20a13[_0xe4c6('0x6f')](_0x10eee9[_0xe4c6('0x60')][_0xe4c6('0x67')],_[_0xe4c6('0x70')](_0x10eee9[_0xe4c6('0x60')],[_0xe4c6('0x67'),'id'])||{})[_0xe4c6('0x71')](function(_0x14a15b){for(var _0x206fb8=0x0;_0x206fb8<_0x10eee9[_0xe4c6('0x60')][_0xe4c6('0x67')][_0xe4c6('0x49')];_0x206fb8+=0x1){socket['emit'](_0xe4c6('0x72'),{'UserId':Number(_0x10eee9['body'][_0xe4c6('0x67')][_0x206fb8]),'WhatsappAccountId':Number(_0x10eee9[_0xe4c6('0x56')]['id'])});}return _0x14a15b;});}})['then'](respondWithResult(_0x2814bf,null))[_0xe4c6('0x54')](handleError(_0x2814bf,null));};exports[_0xe4c6('0x73')]=function(_0x227189,_0x17ac03,_0x29cc34){return db[_0xe4c6('0x3c')]['find']({'where':{'id':_0x227189[_0xe4c6('0x56')]['id']}})[_0xe4c6('0x1e')](handleEntityNotFound(_0x17ac03,null))['then'](function(_0x8c816c){if(_0x8c816c){return _0x8c816c[_0xe4c6('0x73')](_0x227189[_0xe4c6('0x42')][_0xe4c6('0x67')])[_0xe4c6('0x1e')](function(){if(_['isArray'](_0x227189[_0xe4c6('0x42')][_0xe4c6('0x67')])){for(var _0x347001=0x0;_0x347001<_0x227189[_0xe4c6('0x42')][_0xe4c6('0x67')][_0xe4c6('0x49')];_0x347001+=0x1){socket[_0xe4c6('0x74')]('userWhatsappAccount:remove',{'UserId':Number(_0x227189[_0xe4c6('0x42')][_0xe4c6('0x67')][_0x347001]),'WhatsappAccountId':Number(_0x227189[_0xe4c6('0x56')]['id'])});}}else{socket['emit'](_0xe4c6('0x75'),{'UserId':Number(_0x227189[_0xe4c6('0x42')][_0xe4c6('0x67')]),'WhatsappAccountId':Number(_0x227189['params']['id'])});}});}})['then'](respondWithStatusCode(_0x17ac03,null))[_0xe4c6('0x54')](handleError(_0x17ac03,null));};exports['getAgents']=function(_0x5f3963,_0x581563,_0x3405ec){var _0x42c859={};var _0x358c25={};var _0x4b2af0;var _0xc594b7;return db[_0xe4c6('0x3c')][_0xe4c6('0x6a')]({'where':{'id':_0x5f3963[_0xe4c6('0x56')]['id']}})[_0xe4c6('0x1e')](handleEntityNotFound(_0x581563,null))[_0xe4c6('0x1e')](function(_0x28e7b6){if(_0x28e7b6){_0x4b2af0=_0x28e7b6;_0x358c25[_0xe4c6('0x46')]=_[_0xe4c6('0x43')](db[_0xe4c6('0x76')][_0xe4c6('0x3d')]);_0x358c25[_0xe4c6('0x42')]=_[_0xe4c6('0x43')](_0x5f3963[_0xe4c6('0x42')]);_0x358c25[_0xe4c6('0x44')]=_[_0xe4c6('0x45')](_0x358c25[_0xe4c6('0x46')],_0x358c25[_0xe4c6('0x42')]);_0x42c859[_0xe4c6('0x47')]=_[_0xe4c6('0x45')](_0x358c25[_0xe4c6('0x46')],qs['fields'](_0x5f3963[_0xe4c6('0x42')][_0xe4c6('0x48')]));_0x42c859[_0xe4c6('0x47')]=_0x42c859[_0xe4c6('0x47')][_0xe4c6('0x49')]?_0x42c859[_0xe4c6('0x47')]:_0x358c25[_0xe4c6('0x46')];_0x42c859[_0xe4c6('0x64')]=qs[_0xe4c6('0x4c')](_0x5f3963['query'][_0xe4c6('0x4c')]);_0x42c859[_0xe4c6('0x4d')]=qs[_0xe4c6('0x44')](_['pick'](_0x5f3963['query'],_0x358c25[_0xe4c6('0x44')]));if(_0x5f3963[_0xe4c6('0x42')][_0xe4c6('0x4e')]){_0x42c859[_0xe4c6('0x4d')]=_['merge'](_0x42c859[_0xe4c6('0x4d')],{'$or':_['map'](_0x42c859[_0xe4c6('0x47')],function(_0x4fa58a){var _0x4b41c3={};_0x4b41c3[_0x4fa58a]={'$like':'%'+_0x5f3963[_0xe4c6('0x42')][_0xe4c6('0x4e')]+'%'};return _0x4b41c3;})});}_0x42c859=_[_0xe4c6('0x50')]({},_0x42c859,_0x5f3963[_0xe4c6('0x51')]);return _0x4b2af0['getAgents'](_0x42c859);}})['then'](function(_0x36c54a){if(_0x36c54a){_0xc594b7=_0x36c54a[_0xe4c6('0x49')];if(!_0x5f3963[_0xe4c6('0x42')][_0xe4c6('0x4a')]('nolimit')){_0x42c859['limit']=qs[_0xe4c6('0x2e')](_0x5f3963[_0xe4c6('0x42')][_0xe4c6('0x2e')]);_0x42c859[_0xe4c6('0x2c')]=qs['offset'](_0x5f3963[_0xe4c6('0x42')]['offset']);}return _0x4b2af0[_0xe4c6('0x77')](_0x42c859);}})[_0xe4c6('0x1e')](function(_0x2ecab5){if(_0x2ecab5){return _0x2ecab5?{'count':_0xc594b7,'rows':_0x2ecab5}:null;}})[_0xe4c6('0x1e')](respondWithResult(_0x581563,null))[_0xe4c6('0x54')](handleError(_0x581563,null));};exports[_0xe4c6('0x78')]=function(_0x3dca01,_0x36784c,_0x3fab15){return db[_0xe4c6('0x3c')][_0xe4c6('0x6a')]({'where':{'id':_0x3dca01['params']['id']}})[_0xe4c6('0x1e')](handleEntityNotFound(_0x36784c,null))['then'](function(_0x4afed3){if(_0x4afed3){return db[_0xe4c6('0x79')][_0xe4c6('0x7a')](function(_0x24859d){return db[_0xe4c6('0x7b')][_0xe4c6('0x36')]({'where':{'WhatsappAccountId':_0x3dca01[_0xe4c6('0x56')]['id']},'transaction':_0x24859d})['then'](function(_0x2d1c6c){var _0x173aef=_['map'](_0x3dca01['body'],function(_0x3fb5f2){_0x3fb5f2['WhatsappAccountId']=_0x3dca01[_0xe4c6('0x56')]['id'];return _0x3fb5f2;});return db[_0xe4c6('0x7b')][_0xe4c6('0x7c')](_0x173aef,{'transaction':_0x24859d});});})['then'](function(){return db[_0xe4c6('0x7b')][_0xe4c6('0x7d')]({'where':{'WhatsappAccountId':_0x3dca01['params']['id']},'order':_0xe4c6('0x7e')});});}})['then'](respondWithResult(_0x36784c,null))[_0xe4c6('0x54')](handleError(_0x36784c,null));};exports[_0xe4c6('0x7f')]=function(_0x174513,_0x319ea8,_0x389684){var _0x58bd33={};var _0x4d195d={};var _0x3cdee0;var _0x356a04;return db[_0xe4c6('0x3c')][_0xe4c6('0x6a')]({'where':{'id':_0x174513[_0xe4c6('0x56')]['id']}})[_0xe4c6('0x1e')](handleEntityNotFound(_0x319ea8,null))[_0xe4c6('0x1e')](function(_0x46042f){if(_0x46042f){_0x3cdee0=_0x46042f;_0x4d195d['model']=_[_0xe4c6('0x43')](db[_0xe4c6('0x7b')][_0xe4c6('0x3d')]);_0x4d195d[_0xe4c6('0x42')]=_[_0xe4c6('0x43')](_0x174513[_0xe4c6('0x42')]);_0x4d195d['filters']=_[_0xe4c6('0x45')](_0x4d195d[_0xe4c6('0x46')],_0x4d195d[_0xe4c6('0x42')]);_0x58bd33[_0xe4c6('0x47')]=_['intersection'](_0x4d195d[_0xe4c6('0x46')],qs[_0xe4c6('0x48')](_0x174513['query'][_0xe4c6('0x48')]));_0x58bd33[_0xe4c6('0x47')]=_0x58bd33['attributes'][_0xe4c6('0x49')]?_0x58bd33['attributes']:_0x4d195d[_0xe4c6('0x46')];_0x58bd33[_0xe4c6('0x64')]=qs[_0xe4c6('0x4c')](_0x174513[_0xe4c6('0x42')][_0xe4c6('0x4c')]);_0x58bd33[_0xe4c6('0x4d')]=qs[_0xe4c6('0x44')](_[_0xe4c6('0x6c')](_0x174513['query'],_0x4d195d[_0xe4c6('0x44')]));if(_0x174513[_0xe4c6('0x42')][_0xe4c6('0x4e')]){_0x58bd33[_0xe4c6('0x4d')]=_[_0xe4c6('0x50')](_0x58bd33[_0xe4c6('0x4d')],{'$or':_[_0xe4c6('0x41')](_0x58bd33[_0xe4c6('0x47')],function(_0x20ff0d){var _0x4bbc9e={};_0x4bbc9e[_0x20ff0d]={'$like':'%'+_0x174513[_0xe4c6('0x42')][_0xe4c6('0x4e')]+'%'};return _0x4bbc9e;})});}_0x58bd33=_[_0xe4c6('0x50')]({},_0x58bd33,_0x174513['options']);return _0x3cdee0['getApplications'](_0x58bd33);}})[_0xe4c6('0x1e')](function(_0x21af49){if(_0x21af49){_0x356a04=_0x21af49['length'];if(!_0x174513[_0xe4c6('0x42')][_0xe4c6('0x4a')](_0xe4c6('0x4b'))){_0x58bd33[_0xe4c6('0x2e')]=qs[_0xe4c6('0x2e')](_0x174513[_0xe4c6('0x42')][_0xe4c6('0x2e')]);_0x58bd33[_0xe4c6('0x2c')]=qs[_0xe4c6('0x2c')](_0x174513['query']['offset']);}return _0x3cdee0[_0xe4c6('0x7f')](_0x58bd33);}})[_0xe4c6('0x1e')](function(_0x57e204){if(_0x57e204){return _0x57e204?{'count':_0x356a04,'rows':_0x57e204}:null;}})[_0xe4c6('0x1e')](respondWithResult(_0x319ea8,null))[_0xe4c6('0x54')](handleError(_0x319ea8,null));};exports['notify']=function(_0x2269c1,_0xd59a1,_0x3ca233){var _0xdaf995={'channel':_0xe4c6('0x80')};var _0x5e3868=[];var _0x343fc6=[];var _0x8334fb={};return db[_0xe4c6('0x3c')][_0xe4c6('0x58')]({'where':{'id':_0x2269c1['params']['id']},'include':[{'model':db[_0xe4c6('0x7b')],'as':_0xe4c6('0x81')}]})[_0xe4c6('0x1e')](handleEntityNotFound(_0xd59a1,null))[_0xe4c6('0x1e')](function(_0x1f2af7){_0xdaf995[_0xe4c6('0x82')]=_0x1f2af7;_0xdaf995[_0xe4c6('0x83')]=_[_0xe4c6('0x84')](_0x1f2af7[_0xe4c6('0x81')],[_0xe4c6('0x7e')],[_0xe4c6('0x85')]);if(_0xdaf995[_0xe4c6('0x82')]['Applications']){delete _0xdaf995[_0xe4c6('0x82')][_0xe4c6('0x81')];}return db[_0xe4c6('0x86')][_0xe4c6('0x61')]();})[_0xe4c6('0x1e')](function(_0x5c7ce3){if(!_0x5c7ce3){throw new db['Sequelize'][(_0xe4c6('0x87'))]('no\x20available\x20attributes');}_0x5e3868=_[_0xe4c6('0x88')](_[_0xe4c6('0x43')](_0x5c7ce3),[_0xe4c6('0x89'),_0xe4c6('0x8a')]);_0x343fc6=_['difference'](_[_0xe4c6('0x43')](_0x5c7ce3),['createdAt','updatedAt',_0xe4c6('0x8b'),_0xe4c6('0x8c')]);_0xdaf995[_0xe4c6('0x60')]={'mapKey':_0xe4c6('0x8d')};if(_0xdaf995['account'][_0xe4c6('0x3f')]&&_0xdaf995[_0xe4c6('0x82')][_0xe4c6('0x3f')]===_0xe4c6('0x8e')){_0xdaf995[_0xe4c6('0x60')]['from']=_0x2269c1['body']['From'][_0xe4c6('0x8f')](_0xe4c6('0x90'),'');_0xdaf995[_0xe4c6('0x60')][_0xe4c6('0x60')]=_0x2269c1[_0xe4c6('0x60')][_0xe4c6('0x91')];_0xdaf995[_0xe4c6('0x60')][_0xe4c6('0x92')]=_0x2269c1[_0xe4c6('0x60')]['MessageSid'];}if(_0xdaf995[_0xe4c6('0x60')]['id']){delete _0xdaf995['body']['id'];}if(_[_0xe4c6('0x93')](_0xdaf995[_0xe4c6('0x60')]['from'])){throw new db[(_0xe4c6('0x94'))]['ValidationError'](_0xe4c6('0x95'));}if(_[_0xe4c6('0x93')](_0xdaf995[_0xe4c6('0x60')][_0xe4c6('0x60')])||_0xdaf995[_0xe4c6('0x60')][_0xe4c6('0x60')]===''){throw new db[(_0xe4c6('0x94'))][(_0xe4c6('0x87'))](_0xe4c6('0x96'));}if(_[_0xe4c6('0x93')](_0xdaf995[_0xe4c6('0x60')]['mapKey'])){throw new db[(_0xe4c6('0x94'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x343fc6);}if(!_['includes'](_0x343fc6,_0xdaf995[_0xe4c6('0x60')][_0xe4c6('0x97')])){throw new db['Sequelize'][(_0xe4c6('0x87'))](_0xe4c6('0x98')+_0x343fc6);}_0x8334fb[_0xdaf995[_0xe4c6('0x60')][_0xe4c6('0x97')]]=_0xdaf995[_0xe4c6('0x60')][_0xe4c6('0x99')];return db[_0xe4c6('0x9a')][_0xe4c6('0x58')]({'where':{'id':_0xdaf995[_0xe4c6('0x82')][_0xe4c6('0x8c')]},'include':[{'model':db[_0xe4c6('0x86')],'as':_0xe4c6('0x9b'),'where':_0x8334fb,'limit':0x1,'order':[[_0xe4c6('0x8a'),_0xe4c6('0x9c')]]}]});})[_0xe4c6('0x1e')](handleEntityNotFound(_0xd59a1,null))[_0xe4c6('0x1e')](function(_0xc61820){if(_0xc61820){_0xdaf995[_0xe4c6('0x9d')]=_[_0xe4c6('0x70')](_0xc61820,[_0xe4c6('0x9b')]);if(_0xc61820[_0xe4c6('0x9b')][_0xe4c6('0x49')]){return _0xc61820[_0xe4c6('0x9b')][0x0];}var _0x4f261d=_[_0xe4c6('0x9e')](_0xdaf995[_0xe4c6('0x60')],{'firstName':_0xdaf995[_0xe4c6('0x60')][_0xe4c6('0x99')],'ListId':_0xc61820['id']});_0x4f261d[_0xdaf995['body']['mapKey']]=_0xdaf995[_0xe4c6('0x60')][_0xe4c6('0x99')];return db[_0xe4c6('0x86')][_0xe4c6('0x59')](_0x4f261d,{'fields':_0x5e3868,'raw':!![]});}})[_0xe4c6('0x1e')](handleEntityNotFound(_0xd59a1,null))['then'](function(_0x23ff98){if(_0x23ff98){_0xdaf995['contact']=_0x23ff98;var _0x4fdbcf={'ContactId':_0x23ff98['id'],'phone':_0xdaf995[_0xe4c6('0x60')]['from'],'WhatsappAccountId':_0x2269c1[_0xe4c6('0x56')]['id']};var _0x32a4b9={'ContactId':_0x23ff98['id'],'WhatsappAccountId':_0x2269c1[_0xe4c6('0x56')]['id'],'closed':![]};return db[_0xe4c6('0x9f')][_0xe4c6('0x58')]({'where':_0x32a4b9})[_0xe4c6('0x1e')](function(_0x5057c8){if(_0x5057c8){return[_0x5057c8,![]];}return db[_0xe4c6('0x9f')][_0xe4c6('0x59')](_0x4fdbcf)[_0xe4c6('0x1e')](function(_0x5ab3de){return[_0x5ab3de,!![]];});});}})[_0xe4c6('0x71')](function(_0x15648f,_0x7aed5c){_0xdaf995['interaction']=_0x15648f[_0xe4c6('0x34')]({'plain':!![]});_0xdaf995[_0xe4c6('0xa0')][_0xe4c6('0xa1')]=![];if(_0x7aed5c){if(_0xdaf995['account']['autoclose']){_0xdaf995['applications']['push']({'id':0x0,'priority':_0xdaf995['applications'][_0xe4c6('0x49')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0xdaf995[_0xe4c6('0xa0')][_0xe4c6('0xa1')]=!![];}return db[_0xe4c6('0xa2')][_0xe4c6('0x59')]({'phone':_0xdaf995[_0xe4c6('0x60')][_0xe4c6('0x99')],'messageId':_0xdaf995[_0xe4c6('0x60')][_0xe4c6('0x92')],'body':_0xdaf995[_0xe4c6('0x60')][_0xe4c6('0x60')],'WhatsappAccountId':_0x2269c1[_0xe4c6('0x56')]['id'],'WhatsappInteractionId':_0x15648f['id'],'direction':'in','ContactId':_0x15648f[_0xe4c6('0xa3')],'AttachmentId':_0xdaf995[_0xe4c6('0x60')][_0xe4c6('0xa4')]});})['then'](function(_0x4879bf){_0xdaf995[_0xe4c6('0x27')]=_0x4879bf;if(_0xdaf995[_0xe4c6('0xa0')]['UserId']){return db[_0xe4c6('0x76')][_0xe4c6('0x58')]({'attributes':['id',_0xe4c6('0x37')],'where':{'id':_0xdaf995[_0xe4c6('0xa0')]['UserId']}})[_0xe4c6('0x1e')](function(_0x5213c1){if(_0x5213c1){_0xdaf995[_0xe4c6('0x83')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe4c6('0xa5'),'appdata':_0x5213c1[_0xe4c6('0x37')]+','+(_0xdaf995[_0xe4c6('0x82')][_0xe4c6('0xa6')]||0xa),'interval':_0xe4c6('0xa7')});}return respondWithRpcPromise(_0xe4c6('0xa8'),_0xe4c6('0xa9'),_0xdaf995);});}return respondWithRpcPromise(_0xe4c6('0xa8'),'startRouting',_0xdaf995);})[_0xe4c6('0x1e')](function(_0x3a3515){if(_0x3a3515){var _0x2dfdc3=0xc8;var _0x46aee3=_0xe4c6('0xaa');logger[_0xe4c6('0x1f')](_0xe4c6('0x23'),_0x46aee3,_0x2dfdc3,_0xe4c6('0xab'));logger[_0xe4c6('0x22')](_0xe4c6('0xac'),_0x46aee3,_0x2dfdc3,_0xe4c6('0xab'),JSON[_0xe4c6('0x24')](_0x3a3515));if(_0xdaf995[_0xe4c6('0x82')][_0xe4c6('0x3f')]===_0xe4c6('0x8e')){return _0xd59a1['status'](_0x2dfdc3)[_0xe4c6('0xad')](_0xe4c6('0xae'),'text/xml')['send'](_0xe4c6('0xaf'));}else{return _0xd59a1[_0xe4c6('0x2a')](_0x2dfdc3)[_0xe4c6('0xb0')](_0x3a3515);}}})[_0xe4c6('0x54')](handleError(_0xd59a1,null));};exports[_0xe4c6('0x38')]=function(_0x535e41,_0xc2311e,_0x3928d2){var _0x203972,_0x20fb21,_0x24ac9b;if(_[_0xe4c6('0x93')](_0x535e41[_0xe4c6('0x60')][_0xe4c6('0x60')])||_0x535e41['body']['body']===''){throw new db[(_0xe4c6('0x94'))]['ValidationError'](_0xe4c6('0x96'));}if(_[_0xe4c6('0x93')](_0x535e41[_0xe4c6('0x60')]['to'])){throw new db[(_0xe4c6('0x94'))]['ValidationError'](_0xe4c6('0xb1'));}_0x203972=_0x535e41[_0xe4c6('0x60')]['to'];return db['WhatsappAccount'][_0xe4c6('0x58')]({'where':{'id':_0x535e41['params']['id']},'include':[{'model':db['CmList'],'as':_0xe4c6('0xb2'),'include':[{'model':db[_0xe4c6('0x86')],'as':_0xe4c6('0x9b'),'where':{'mobile':_0x203972},'limit':0x1,'order':[[_0xe4c6('0x8a'),_0xe4c6('0x9c')]]}]}]})[_0xe4c6('0x1e')](handleEntityNotFound(_0xc2311e,null))[_0xe4c6('0x1e')](function(_0x66d5ea){if(_0x66d5ea&&_0x66d5ea[_0xe4c6('0xb2')]){_0x20fb21=_0x66d5ea['get']({'plain':!![]});if(_0x20fb21[_0xe4c6('0xb2')]&&_0x20fb21['List'][_0xe4c6('0x9b')][_0xe4c6('0x49')]){return _0x20fb21[_0xe4c6('0xb2')][_0xe4c6('0x9b')][0x0];}return db[_0xe4c6('0x86')][_0xe4c6('0x59')](_[_0xe4c6('0x9e')](_0x535e41[_0xe4c6('0x60')],{'firstName':_0x203972,'mobile':_0x203972,'phone':_0x203972,'ListId':_0x20fb21['ListId']}));}})[_0xe4c6('0x1e')](handleEntityNotFound(_0xc2311e,null))[_0xe4c6('0x1e')](function(_0x403b20){if(_0x403b20){_0x24ac9b=_0x403b20;return db[_0xe4c6('0x9f')][_0xe4c6('0x58')]({'where':{'ContactId':_0x24ac9b['id'],'closed':![],'WhatsappAccountId':_0x20fb21['id']}})[_0xe4c6('0x1e')](function(_0x125655){if(_0x125655){return[_0x125655,![]];}return db[_0xe4c6('0x9f')][_0xe4c6('0x59')]({'UserId':_0x535e41[_0xe4c6('0x5a')]['id'],'ContactId':_0x24ac9b['id'],'WhatsappAccountId':_0x20fb21['id'],'phone':_0x203972,'firstMsgDirection':'out','Messages':[_[_0xe4c6('0x50')](_0x535e41[_0xe4c6('0x60')],{'read':![],'body':_0x535e41[_0xe4c6('0x60')][_0xe4c6('0x60')],'phone':_0x203972,'WhatsappAccountId':_0x20fb21['id'],'UserId':_0x535e41[_0xe4c6('0x5a')]['id'],'ContactId':_0x24ac9b['id']})]},{'include':[{'model':db[_0xe4c6('0xa2')],'as':_0xe4c6('0xb3')}]})['then'](function(_0x281676){return[_0x281676,!![]];});});}})[_0xe4c6('0x71')](function(_0x477266,_0x10c2c5){if(_0x10c2c5){return _0x477266;}return db[_0xe4c6('0xa2')]['create'](_['merge'](_0x535e41[_0xe4c6('0x60')],{'read':![],'body':_0x535e41[_0xe4c6('0x60')][_0xe4c6('0x60')],'phone':_0x203972,'WhatsappAccountId':_0x20fb21['id'],'WhatsappInteractionId':_0x477266['id'],'UserId':_0x535e41['user']['id'],'ContactId':_0x24ac9b['id']}))[_0xe4c6('0x1e')](function(_0x2067be){_0x477266[_0xe4c6('0xb4')][_0xe4c6('0xb3')]=[];_0x477266['dataValues'][_0xe4c6('0xb3')][_0xe4c6('0xb5')](_0x2067be[_0xe4c6('0xb4')]);return _0x477266;});})[_0xe4c6('0x1e')](respondWithResult(_0xc2311e,null))['catch'](handleError(_0xc2311e,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index d21715b..df915ae 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 _0xa348=['exports','events','../../mysqldb','WhatsappAccount','save','remove','emit','hasOwnProperty','hook'];(function(_0x464d70,_0x3d7743){var _0x502062=function(_0x4dc1f9){while(--_0x4dc1f9){_0x464d70['push'](_0x464d70['shift']());}};_0x502062(++_0x3d7743);}(_0xa348,0x1f0));var _0x8a34=function(_0xe06092,_0x456208){_0xe06092=_0xe06092-0x0;var _0x2b23a6=_0xa348[_0xe06092];return _0x2b23a6;};'use strict';var EventEmitter=require(_0x8a34('0x0'));var WhatsappAccount=require(_0x8a34('0x1'))['db'][_0x8a34('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8a34('0x3'),'afterUpdate':'update','afterDestroy':_0x8a34('0x4')};function emitEvent(_0x44e6f1){return function(_0x68e521,_0x4eef9a,_0x246fea){WhatsappAccountEvents[_0x8a34('0x5')](_0x44e6f1+':'+_0x68e521['id'],_0x68e521);WhatsappAccountEvents['emit'](_0x44e6f1,_0x68e521);_0x246fea(null);};}for(var e in events){if(events[_0x8a34('0x6')](e)){var event=events[e];WhatsappAccount[_0x8a34('0x7')](e,emitEvent(event));}}module[_0x8a34('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xc2c3=['../../mysqldb','WhatsappAccount','setMaxListeners','save','update','hasOwnProperty','hook','exports','events'];(function(_0x243d42,_0x48febc){var _0x5e7729=function(_0x281de9){while(--_0x281de9){_0x243d42['push'](_0x243d42['shift']());}};_0x5e7729(++_0x48febc);}(_0xc2c3,0xf2));var _0x3c2c=function(_0x1bc84f,_0x4e1665){_0x1bc84f=_0x1bc84f-0x0;var _0x2368b4=_0xc2c3[_0x1bc84f];return _0x2368b4;};'use strict';var EventEmitter=require(_0x3c2c('0x0'));var WhatsappAccount=require(_0x3c2c('0x1'))['db'][_0x3c2c('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x3c2c('0x3')](0x0);var events={'afterCreate':_0x3c2c('0x4'),'afterUpdate':_0x3c2c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2cea41){return function(_0x31352c,_0x221f55,_0x48d6b6){WhatsappAccountEvents['emit'](_0x2cea41+':'+_0x31352c['id'],_0x31352c);WhatsappAccountEvents['emit'](_0x2cea41,_0x31352c);_0x48d6b6(null);};}for(var e in events){if(events[_0x3c2c('0x6')](e)){var event=events[e];WhatsappAccount[_0x3c2c('0x7')](e,emitEvent(event));}}module[_0x3c2c('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 ee9688b..20adc81 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 _0x6928=['util','api','path','rimraf','../../config/environment','exports','define'];(function(_0x49a3ed,_0x3963dc){var _0x4b7ae1=function(_0x489b04){while(--_0x489b04){_0x49a3ed['push'](_0x49a3ed['shift']());}};_0x4b7ae1(++_0x3963dc);}(_0x6928,0x93));var _0x8692=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x6928[_0x49ca18];return _0x145d54;};'use strict';var _=require('lodash');var util=require(_0x8692('0x0'));var logger=require('../../config/logger')(_0x8692('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8692('0x2'));var rimraf=require(_0x8692('0x3'));var config=require(_0x8692('0x4'));var attributes=require('./whatsappAccount.attributes');module[_0x8692('0x5')]=function(_0x288e2e,_0x1d6964){return _0x288e2e[_0x8692('0x6')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1762=['../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','path'];(function(_0x31524c,_0x32ea1e){var _0x3beb00=function(_0x28f2c5){while(--_0x28f2c5){_0x31524c['push'](_0x31524c['shift']());}};_0x3beb00(++_0x32ea1e);}(_0x1762,0x102));var _0x2176=function(_0x7872d2,_0x425184){_0x7872d2=_0x7872d2-0x0;var _0xf29e=_0x1762[_0x7872d2];return _0xf29e;};'use strict';var _=require(_0x2176('0x0'));var util=require(_0x2176('0x1'));var logger=require(_0x2176('0x2'))(_0x2176('0x3'));var moment=require(_0x2176('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2176('0x5'));var rimraf=require('rimraf');var config=require(_0x2176('0x6'));var attributes=require(_0x2176('0x7'));module[_0x2176('0x8')]=function(_0x436080,_0x1c6eb6){return _0x436080[_0x2176('0x9')](_0x2176('0xa'),attributes,{'tableName':_0x2176('0xb'),'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 e74daf7..a959aa9 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 _0x9332=['code','message','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x758414,_0x3f26f9){var _0x5a2883=function(_0x4a5296){while(--_0x4a5296){_0x758414['push'](_0x758414['shift']());}};_0x5a2883(++_0x3f26f9);}(_0x9332,0x1c5));var _0x2933=function(_0x3a77ff,_0x32a5da){_0x3a77ff=_0x3a77ff-0x0;var _0x1e94bc=_0x9332[_0x3a77ff];return _0x1e94bc;};'use strict';var _=require(_0x2933('0x0'));var util=require(_0x2933('0x1'));var moment=require(_0x2933('0x2'));var BPromise=require(_0x2933('0x3'));var rs=require(_0x2933('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2933('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2933('0x6'))(_0x2933('0x7'));var config=require(_0x2933('0x8'));var jayson=require(_0x2933('0x9'));var client=jayson[_0x2933('0xa')][_0x2933('0xb')]({'port':0x232a});config[_0x2933('0xc')]=_[_0x2933('0xd')](config[_0x2933('0xc')],{'host':_0x2933('0xe'),'port':0x18eb});var socket=require(_0x2933('0xf'))(new Redis(config['redis']));require(_0x2933('0x10'))[_0x2933('0x11')](socket);function respondWithRpcPromise(_0x52683e,_0x3c41cb,_0x1fc207){return new BPromise(function(_0x2698ca,_0x279a7e){return client[_0x2933('0x12')](_0x52683e,_0x1fc207)[_0x2933('0x13')](function(_0x52ecf3){logger[_0x2933('0x14')](_0x2933('0x15'),_0x3c41cb,_0x2933('0x16'));logger[_0x2933('0x17')](_0x2933('0x18'),_0x3c41cb,'request\x20sent',JSON[_0x2933('0x19')](_0x52ecf3));if(_0x52ecf3[_0x2933('0x1a')]){if(_0x52ecf3[_0x2933('0x1a')][_0x2933('0x1b')]===0x1f4){logger['error'](_0x2933('0x15'),_0x3c41cb,_0x52ecf3[_0x2933('0x1a')]['message']);return _0x279a7e(_0x52ecf3[_0x2933('0x1a')][_0x2933('0x1c')]);}logger['error'](_0x2933('0x15'),_0x3c41cb,_0x52ecf3[_0x2933('0x1a')][_0x2933('0x1c')]);return _0x2698ca(_0x52ecf3[_0x2933('0x1a')][_0x2933('0x1c')]);}else{logger[_0x2933('0x14')](_0x2933('0x15'),_0x3c41cb,_0x2933('0x16'));_0x2698ca(_0x52ecf3['result']['message']);}})['catch'](function(_0x55dbd6){logger[_0x2933('0x1a')](_0x2933('0x15'),_0x3c41cb,_0x55dbd6);_0x279a7e(_0x55dbd6);});});}exports[_0x2933('0x1d')]=function(_0x33c0b9){var _0x50b19e=this;return new Promise(function(_0x39be24,_0x24fd68){return db[_0x2933('0x1e')][_0x2933('0x1f')]({'raw':_0x33c0b9[_0x2933('0x20')]?_0x33c0b9['options'][_0x2933('0x21')]===undefined?!![]:![]:!![],'where':_0x33c0b9[_0x2933('0x20')]?_0x33c0b9[_0x2933('0x20')][_0x2933('0x22')]||null:null,'attributes':_0x33c0b9[_0x2933('0x20')]?_0x33c0b9['options'][_0x2933('0x23')]||null:null,'include':_0x33c0b9[_0x2933('0x20')]?_0x33c0b9[_0x2933('0x20')][_0x2933('0x24')]?_[_0x2933('0x25')](_0x33c0b9[_0x2933('0x20')][_0x2933('0x24')],function(_0x5dc71f){return{'model':db[_0x5dc71f['model']],'as':_0x5dc71f['as'],'attributes':_0x5dc71f[_0x2933('0x23')],'include':_0x5dc71f['include']?_['map'](_0x5dc71f[_0x2933('0x24')],function(_0x17b4b8){return{'model':db[_0x17b4b8[_0x2933('0x26')]],'as':_0x17b4b8['as'],'attributes':_0x17b4b8[_0x2933('0x23')],'include':_0x17b4b8[_0x2933('0x24')]?_[_0x2933('0x25')](_0x17b4b8['include'],function(_0x25f69b){return{'model':db[_0x25f69b['model']],'as':_0x25f69b['as'],'attributes':_0x25f69b[_0x2933('0x23')]};}):[]};}):[]};}):[]:[]})[_0x2933('0x13')](function(_0x4c1c7c){logger[_0x2933('0x14')](_0x2933('0x1d'),_0x33c0b9);logger[_0x2933('0x17')](_0x2933('0x1d'),_0x33c0b9,JSON['stringify'](_0x4c1c7c));_0x39be24(_0x4c1c7c);})[_0x2933('0x27')](function(_0x4da21){logger[_0x2933('0x1a')](_0x2933('0x1d'),_0x4da21[_0x2933('0x1c')],_0x33c0b9);_0x24fd68(_0x50b19e[_0x2933('0x1a')](0x1f4,_0x4da21['message']));});});}; \ No newline at end of file +var _0xcc56=['redis','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowWhatsappAccount','find','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x3aaa2c,_0x3aa6a3){var _0x6a514f=function(_0xdc90){while(--_0xdc90){_0x3aaa2c['push'](_0x3aaa2c['shift']());}};_0x6a514f(++_0x3aa6a3);}(_0xcc56,0x1a5));var _0x6cc5=function(_0x456200,_0x3d4c03){_0x456200=_0x456200-0x0;var _0x551f2e=_0xcc56[_0x456200];return _0x551f2e;};'use strict';var _=require(_0x6cc5('0x0'));var util=require(_0x6cc5('0x1'));var moment=require(_0x6cc5('0x2'));var BPromise=require(_0x6cc5('0x3'));var rs=require(_0x6cc5('0x4'));var fs=require('fs');var Redis=require(_0x6cc5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6cc5('0x6'));var logger=require(_0x6cc5('0x7'))(_0x6cc5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6cc5('0x9')][_0x6cc5('0xa')]({'port':0x232a});config[_0x6cc5('0xb')]=_['defaults'](config[_0x6cc5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6cc5('0xc'))(new Redis(config[_0x6cc5('0xb')]));require(_0x6cc5('0xd'))[_0x6cc5('0xe')](socket);function respondWithRpcPromise(_0x553100,_0x4c44f8,_0x447f4e){return new BPromise(function(_0x1d257b,_0x538a0c){return client[_0x6cc5('0xf')](_0x553100,_0x447f4e)[_0x6cc5('0x10')](function(_0x250cd2){logger[_0x6cc5('0x11')](_0x6cc5('0x12'),_0x4c44f8,'request\x20sent');logger[_0x6cc5('0x13')](_0x6cc5('0x14'),_0x4c44f8,_0x6cc5('0x15'),JSON[_0x6cc5('0x16')](_0x250cd2));if(_0x250cd2[_0x6cc5('0x17')]){if(_0x250cd2[_0x6cc5('0x17')]['code']===0x1f4){logger[_0x6cc5('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x4c44f8,_0x250cd2['error'][_0x6cc5('0x18')]);return _0x538a0c(_0x250cd2[_0x6cc5('0x17')][_0x6cc5('0x18')]);}logger[_0x6cc5('0x17')](_0x6cc5('0x12'),_0x4c44f8,_0x250cd2[_0x6cc5('0x17')][_0x6cc5('0x18')]);return _0x1d257b(_0x250cd2[_0x6cc5('0x17')][_0x6cc5('0x18')]);}else{logger['info'](_0x6cc5('0x12'),_0x4c44f8,_0x6cc5('0x15'));_0x1d257b(_0x250cd2[_0x6cc5('0x19')][_0x6cc5('0x18')]);}})['catch'](function(_0x6add1c){logger[_0x6cc5('0x17')](_0x6cc5('0x12'),_0x4c44f8,_0x6add1c);_0x538a0c(_0x6add1c);});});}exports[_0x6cc5('0x1a')]=function(_0x191472){var _0x4ede24=this;return new Promise(function(_0x262d8b,_0x31ef1d){return db['WhatsappAccount'][_0x6cc5('0x1b')]({'raw':_0x191472[_0x6cc5('0x1c')]?_0x191472[_0x6cc5('0x1c')][_0x6cc5('0x1d')]===undefined?!![]:![]:!![],'where':_0x191472[_0x6cc5('0x1c')]?_0x191472['options'][_0x6cc5('0x1e')]||null:null,'attributes':_0x191472[_0x6cc5('0x1c')]?_0x191472[_0x6cc5('0x1c')][_0x6cc5('0x1f')]||null:null,'include':_0x191472[_0x6cc5('0x1c')]?_0x191472[_0x6cc5('0x1c')][_0x6cc5('0x20')]?_[_0x6cc5('0x21')](_0x191472[_0x6cc5('0x1c')][_0x6cc5('0x20')],function(_0x40fb0b){return{'model':db[_0x40fb0b['model']],'as':_0x40fb0b['as'],'attributes':_0x40fb0b['attributes'],'include':_0x40fb0b[_0x6cc5('0x20')]?_[_0x6cc5('0x21')](_0x40fb0b[_0x6cc5('0x20')],function(_0x596f92){return{'model':db[_0x596f92[_0x6cc5('0x22')]],'as':_0x596f92['as'],'attributes':_0x596f92['attributes'],'include':_0x596f92[_0x6cc5('0x20')]?_[_0x6cc5('0x21')](_0x596f92['include'],function(_0x453741){return{'model':db[_0x453741[_0x6cc5('0x22')]],'as':_0x453741['as'],'attributes':_0x453741['attributes']};}):[]};}):[]};}):[]:[]})[_0x6cc5('0x10')](function(_0x55b757){logger[_0x6cc5('0x11')]('ShowWhatsappAccount',_0x191472);logger[_0x6cc5('0x13')]('ShowWhatsappAccount',_0x191472,JSON[_0x6cc5('0x16')](_0x55b757));_0x262d8b(_0x55b757);})[_0x6cc5('0x23')](function(_0x352951){logger[_0x6cc5('0x17')](_0x6cc5('0x1a'),_0x352951[_0x6cc5('0x18')],_0x191472);_0x31ef1d(_0x4ede24['error'](0x1f4,_0x352951['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index b4bbf88..55c123e 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 _0x7676=['length','whatsappAccount:','./whatsappAccount.events','save','update','register'];(function(_0x30bcde,_0x441c3a){var _0x5d3eec=function(_0x37d763){while(--_0x37d763){_0x30bcde['push'](_0x30bcde['shift']());}};_0x5d3eec(++_0x441c3a);}(_0x7676,0xa4));var _0x6767=function(_0x10a51a,_0x5179b6){_0x10a51a=_0x10a51a-0x0;var _0x437dc6=_0x7676[_0x10a51a];return _0x437dc6;};'use strict';var WhatsappAccountEvents=require(_0x6767('0x0'));var events=[_0x6767('0x1'),'remove',_0x6767('0x2')];function createListener(_0x230f14,_0x288118){return function(_0x17b678){_0x288118['emit'](_0x230f14,_0x17b678);};}function removeListener(_0x4aed24,_0xf0413d){return function(){WhatsappAccountEvents['removeListener'](_0x4aed24,_0xf0413d);};}exports[_0x6767('0x3')]=function(_0x1585f5){for(var _0x12e981=0x0,_0x327f5e=events[_0x6767('0x4')];_0x12e981<_0x327f5e;_0x12e981++){var _0x32b241=events[_0x12e981];var _0x1687c5=createListener(_0x6767('0x5')+_0x32b241,_0x1585f5);WhatsappAccountEvents['on'](_0x32b241,_0x1687c5);}}; \ No newline at end of file +var _0x0266=['./whatsappAccount.events','save','remove','update','emit','removeListener','length','whatsappAccount:'];(function(_0x11824c,_0x2a27b7){var _0x3b9344=function(_0x12b042){while(--_0x12b042){_0x11824c['push'](_0x11824c['shift']());}};_0x3b9344(++_0x2a27b7);}(_0x0266,0x1c0));var _0x6026=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x0266[_0x12fc8d];return _0x3f9d04;};'use strict';var WhatsappAccountEvents=require(_0x6026('0x0'));var events=[_0x6026('0x1'),_0x6026('0x2'),_0x6026('0x3')];function createListener(_0x2842de,_0x4fd507){return function(_0x50dceb){_0x4fd507[_0x6026('0x4')](_0x2842de,_0x50dceb);};}function removeListener(_0x1a3d65,_0x374309){return function(){WhatsappAccountEvents[_0x6026('0x5')](_0x1a3d65,_0x374309);};}exports['register']=function(_0x55eaf4){for(var _0x955b3a=0x0,_0x5362ad=events[_0x6026('0x6')];_0x955b3a<_0x5362ad;_0x955b3a++){var _0x3bcb90=events[_0x955b3a];var _0x345600=createListener(_0x6026('0x7')+_0x3bcb90,_0x55eaf4);WhatsappAccountEvents['on'](_0x3bcb90,_0x345600);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 7ad8ce4..9bc757d 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 _0x4982=['get','isAuthenticated','index','/:id','show','post','create','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller'];(function(_0x9fb06b,_0xf1fa83){var _0x4de9f8=function(_0x4327b4){while(--_0x4327b4){_0x9fb06b['push'](_0x9fb06b['shift']());}};_0x4de9f8(++_0xf1fa83);}(_0x4982,0x172));var _0x2498=function(_0x2eda9b,_0x37aafe){_0x2eda9b=_0x2eda9b-0x0;var _0x18e0f7=_0x4982[_0x2eda9b];return _0x18e0f7;};'use strict';var multer=require(_0x2498('0x0'));var util=require(_0x2498('0x1'));var path=require(_0x2498('0x2'));var timeout=require(_0x2498('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2498('0x4'));var interaction=require(_0x2498('0x5'));var config=require(_0x2498('0x6'));var controller=require(_0x2498('0x7'));router[_0x2498('0x8')]('/',auth[_0x2498('0x9')](),controller[_0x2498('0xa')]);router[_0x2498('0x8')](_0x2498('0xb'),auth[_0x2498('0x9')](),controller[_0x2498('0xc')]);router[_0x2498('0xd')]('/',auth[_0x2498('0x9')](),controller[_0x2498('0xe')]);router['put'](_0x2498('0xb'),auth[_0x2498('0x9')](),controller['update']);router[_0x2498('0xf')](_0x2498('0xb'),auth[_0x2498('0x9')](),controller[_0x2498('0x10')]);module[_0x2498('0x11')]=router; \ No newline at end of file +var _0xd00d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xd00d,0x104));var _0xdd00=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0xd00d[_0x3a1ea5];return _0xfac9b2;};'use strict';var multer=require(_0xdd00('0x0'));var util=require(_0xdd00('0x1'));var path=require(_0xdd00('0x2'));var timeout=require(_0xdd00('0x3'));var express=require(_0xdd00('0x4'));var router=express[_0xdd00('0x5')]();var fs_extra=require(_0xdd00('0x6'));var auth=require(_0xdd00('0x7'));var interaction=require(_0xdd00('0x8'));var config=require(_0xdd00('0x9'));var controller=require(_0xdd00('0xa'));router[_0xdd00('0xb')]('/',auth[_0xdd00('0xc')](),controller['index']);router[_0xdd00('0xb')](_0xdd00('0xd'),auth[_0xdd00('0xc')](),controller[_0xdd00('0xe')]);router[_0xdd00('0xf')]('/',auth[_0xdd00('0xc')](),controller[_0xdd00('0x10')]);router[_0xdd00('0x11')](_0xdd00('0xd'),auth[_0xdd00('0xc')](),controller[_0xdd00('0x12')]);router[_0xdd00('0x13')](_0xdd00('0xd'),auth[_0xdd00('0xc')](),controller[_0xdd00('0x14')]);module[_0xdd00('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index f101eff..26181f3 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 _0xf969=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf969,0x1ca));var _0x9f96=function(_0x815d85,_0x1d8c80){_0x815d85=_0x815d85-0x0;var _0x484c72=_0xf969[_0x815d85];return _0x484c72;};'use strict';var Sequelize=require(_0x9f96('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9f96('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9f96('0x2')],'allowNull':![],'defaultValue':_0x9f96('0x3')},'appdata':{'type':Sequelize[_0x9f96('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9f96('0x2')],'defaultValue':_0x9f96('0x5')}}; \ No newline at end of file +var _0xab53=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x5afc04,_0x186bf3){var _0x1234bb=function(_0x21d9de){while(--_0x21d9de){_0x5afc04['push'](_0x5afc04['shift']());}};_0x1234bb(++_0x186bf3);}(_0xab53,0x14b));var _0x3ab5=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xab53[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require(_0x3ab5('0x0'));module[_0x3ab5('0x1')]={'priority':{'type':Sequelize[_0x3ab5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3ab5('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3ab5('0x4')]()},'description':{'type':Sequelize[_0x3ab5('0x3')]},'interval':{'type':Sequelize[_0x3ab5('0x3')],'defaultValue':_0x3ab5('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 08f4fbc..55ed3a6 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 _0xa848=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','WhatsappApplication','includeAll','include','findAll','rows','catch','params','options','find','create','body','eml-format','rimraf','zip-dir'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa848,0x99));var _0x8a84=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa848[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x8a84('0x0'));var rimraf=require(_0x8a84('0x1'));var zipdir=require(_0x8a84('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a84('0x3'));var moment=require(_0x8a84('0x4'));var BPromise=require(_0x8a84('0x5'));var Mustache=require(_0x8a84('0x6'));var util=require(_0x8a84('0x7'));var path=require(_0x8a84('0x8'));var sox=require(_0x8a84('0x9'));var csv=require(_0x8a84('0xa'));var ejs=require(_0x8a84('0xb'));var fs=require('fs');var fs_extra=require(_0x8a84('0xc'));var _=require(_0x8a84('0xd'));var squel=require(_0x8a84('0xe'));var crypto=require(_0x8a84('0xf'));var jsforce=require(_0x8a84('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x8a84('0xa'));var querystring=require(_0x8a84('0x11'));var Papa=require(_0x8a84('0x12'));var Redis=require('ioredis');var authService=require(_0x8a84('0x13'));var qs=require(_0x8a84('0x14'));var as=require(_0x8a84('0x15'));var hardwareService=require(_0x8a84('0x16'));var logger=require(_0x8a84('0x17'))(_0x8a84('0x18'));var utils=require(_0x8a84('0x19'));var config=require(_0x8a84('0x1a'));var licenseUtil=require(_0x8a84('0x1b'));var db=require(_0x8a84('0x1c'))['db'];function respondWithStatusCode(_0x130d92,_0x372ca3){_0x372ca3=_0x372ca3||0xcc;return function(_0x57576e){if(_0x57576e){return _0x130d92[_0x8a84('0x1d')](_0x372ca3);}return _0x130d92[_0x8a84('0x1e')](_0x372ca3)[_0x8a84('0x1f')]();};}function respondWithResult(_0x5628ba,_0x978e95){_0x978e95=_0x978e95||0xc8;return function(_0x2de032){if(_0x2de032){return _0x5628ba[_0x8a84('0x1e')](_0x978e95)['json'](_0x2de032);}};}function respondWithFilteredResult(_0x2a939e,_0x2558d9){return function(_0x50a338){if(_0x50a338){var _0x44144a=typeof _0x2558d9[_0x8a84('0x20')]===_0x8a84('0x21')&&typeof _0x2558d9[_0x8a84('0x22')]==='undefined';var _0x70847=_0x50a338[_0x8a84('0x23')];var _0x37b243=_0x44144a?0x0:_0x2558d9[_0x8a84('0x20')];var _0x292013=_0x44144a?_0x50a338[_0x8a84('0x23')]:_0x2558d9['offset']+_0x2558d9[_0x8a84('0x22')];var _0x51d369;if(_0x292013>=_0x70847){_0x292013=_0x70847;_0x51d369=0xc8;}else{_0x51d369=0xce;}_0x2a939e[_0x8a84('0x1e')](_0x51d369);return _0x2a939e['set'](_0x8a84('0x24'),_0x37b243+'-'+_0x292013+'/'+_0x70847)[_0x8a84('0x25')](_0x50a338);}return null;};}function patchUpdates(_0x1ddfcb){return function(_0x56cb73){try{jsonpatch[_0x8a84('0x26')](_0x56cb73,_0x1ddfcb,!![]);}catch(_0x3c4a98){return BPromise[_0x8a84('0x27')](_0x3c4a98);}return _0x56cb73[_0x8a84('0x28')]();};}function saveUpdates(_0x21e766,_0x4d245e){return function(_0xdd27df){if(_0xdd27df){return _0xdd27df[_0x8a84('0x29')](_0x21e766)[_0x8a84('0x2a')](function(_0x370454){return _0x370454;});}return null;};}function removeEntity(_0x1f01da,_0x4bef10){return function(_0x176059){if(_0x176059){return _0x176059[_0x8a84('0x2b')]()[_0x8a84('0x2a')](function(){_0x1f01da[_0x8a84('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34b0dd,_0x244126){return function(_0x260f6d){if(!_0x260f6d){_0x34b0dd[_0x8a84('0x1d')](0x194);}return _0x260f6d;};}function handleError(_0x4a9f05,_0x5060f4){_0x5060f4=_0x5060f4||0x1f4;return function(_0x52db42){logger[_0x8a84('0x2c')](_0x52db42[_0x8a84('0x2d')]);if(_0x52db42['name']){delete _0x52db42[_0x8a84('0x2e')];}_0x4a9f05['status'](_0x5060f4)['send'](_0x52db42);};}exports['index']=function(_0x4940af,_0x482067){var _0x141921={},_0x3083c0={},_0x396c46={'count':0x0,'rows':[]};var _0x474e5a=_[_0x8a84('0x2f')](db['WhatsappApplication'][_0x8a84('0x30')],function(_0x29fe41){return{'name':_0x29fe41['fieldName'],'type':_0x29fe41[_0x8a84('0x31')]['key']};});_0x3083c0['model']=_[_0x8a84('0x2f')](_0x474e5a,_0x8a84('0x2e'));_0x3083c0[_0x8a84('0x32')]=_[_0x8a84('0x33')](_0x4940af[_0x8a84('0x32')]);_0x3083c0[_0x8a84('0x34')]=_[_0x8a84('0x35')](_0x3083c0['model'],_0x3083c0['query']);_0x141921[_0x8a84('0x36')]=_['intersection'](_0x3083c0[_0x8a84('0x37')],qs[_0x8a84('0x38')](_0x4940af[_0x8a84('0x32')][_0x8a84('0x38')]));_0x141921['attributes']=_0x141921[_0x8a84('0x36')][_0x8a84('0x39')]?_0x141921[_0x8a84('0x36')]:_0x3083c0['model'];if(!_0x4940af[_0x8a84('0x32')][_0x8a84('0x3a')](_0x8a84('0x3b'))){_0x141921['limit']=qs[_0x8a84('0x22')](_0x4940af[_0x8a84('0x32')][_0x8a84('0x22')]);_0x141921[_0x8a84('0x20')]=qs[_0x8a84('0x20')](_0x4940af[_0x8a84('0x32')][_0x8a84('0x20')]);}_0x141921[_0x8a84('0x3c')]=qs[_0x8a84('0x3d')](_0x4940af[_0x8a84('0x32')][_0x8a84('0x3d')]);_0x141921[_0x8a84('0x3e')]=qs[_0x8a84('0x34')](_[_0x8a84('0x3f')](_0x4940af['query'],_0x3083c0['filters']),_0x474e5a);if(_0x4940af[_0x8a84('0x32')][_0x8a84('0x40')]){_0x141921[_0x8a84('0x3e')]=_[_0x8a84('0x41')](_0x141921[_0x8a84('0x3e')],{'$or':_['map'](_0x474e5a,function(_0x43e8d8){if(_0x43e8d8[_0x8a84('0x31')]!==_0x8a84('0x42')){var _0x4f1691={};_0x4f1691[_0x43e8d8[_0x8a84('0x2e')]]={'$like':'%'+_0x4940af[_0x8a84('0x32')][_0x8a84('0x40')]+'%'};return _0x4f1691;}})});}_0x141921=_[_0x8a84('0x41')]({},_0x141921,_0x4940af['options']);var _0x50cb9f={'where':_0x141921['where']};return db[_0x8a84('0x43')][_0x8a84('0x23')](_0x50cb9f)['then'](function(_0x31817f){_0x396c46[_0x8a84('0x23')]=_0x31817f;if(_0x4940af['query'][_0x8a84('0x44')]){_0x141921[_0x8a84('0x45')]=[{'all':!![]}];}return db[_0x8a84('0x43')][_0x8a84('0x46')](_0x141921);})[_0x8a84('0x2a')](function(_0x1117cc){_0x396c46[_0x8a84('0x47')]=_0x1117cc;return _0x396c46;})['then'](respondWithFilteredResult(_0x482067,_0x141921))[_0x8a84('0x48')](handleError(_0x482067,null));};exports['show']=function(_0x3b9f86,_0x52be84){var _0x511edb={'raw':!![],'where':{'id':_0x3b9f86[_0x8a84('0x49')]['id']}},_0x195361={};_0x195361[_0x8a84('0x37')]=_['keys'](db[_0x8a84('0x43')][_0x8a84('0x30')]);_0x195361[_0x8a84('0x32')]=_[_0x8a84('0x33')](_0x3b9f86['query']);_0x195361[_0x8a84('0x34')]=_[_0x8a84('0x35')](_0x195361[_0x8a84('0x37')],_0x195361[_0x8a84('0x32')]);_0x511edb[_0x8a84('0x36')]=_[_0x8a84('0x35')](_0x195361[_0x8a84('0x37')],qs[_0x8a84('0x38')](_0x3b9f86[_0x8a84('0x32')]['fields']));_0x511edb['attributes']=_0x511edb['attributes'][_0x8a84('0x39')]?_0x511edb[_0x8a84('0x36')]:_0x195361[_0x8a84('0x37')];if(_0x3b9f86['query'][_0x8a84('0x44')]){_0x511edb['include']=[{'all':!![]}];}_0x511edb=_[_0x8a84('0x41')]({},_0x511edb,_0x3b9f86[_0x8a84('0x4a')]);return db['WhatsappApplication'][_0x8a84('0x4b')](_0x511edb)[_0x8a84('0x2a')](handleEntityNotFound(_0x52be84,null))['then'](respondWithResult(_0x52be84,null))[_0x8a84('0x48')](handleError(_0x52be84,null));};exports[_0x8a84('0x4c')]=function(_0x4a951f,_0x426fcd){return db['WhatsappApplication'][_0x8a84('0x4c')](_0x4a951f[_0x8a84('0x4d')],{})[_0x8a84('0x2a')](respondWithResult(_0x426fcd,0xc9))[_0x8a84('0x48')](handleError(_0x426fcd,null));};exports['update']=function(_0x4bea7a,_0x4925af){if(_0x4bea7a['body']['id']){delete _0x4bea7a['body']['id'];}return db[_0x8a84('0x43')][_0x8a84('0x4b')]({'where':{'id':_0x4bea7a[_0x8a84('0x49')]['id']}})[_0x8a84('0x2a')](handleEntityNotFound(_0x4925af,null))[_0x8a84('0x2a')](saveUpdates(_0x4bea7a['body'],null))[_0x8a84('0x2a')](respondWithResult(_0x4925af,null))['catch'](handleError(_0x4925af,null));};exports[_0x8a84('0x2b')]=function(_0x855234,_0x32e577){return db['WhatsappApplication'][_0x8a84('0x4b')]({'where':{'id':_0x855234[_0x8a84('0x49')]['id']}})[_0x8a84('0x2a')](handleEntityNotFound(_0x32e577,null))[_0x8a84('0x2a')](removeEntity(_0x32e577,null))['catch'](handleError(_0x32e577,null));}; \ No newline at end of file +var _0x202a=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','then','destroy','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','update','rimraf','zip-dir','fast-json-patch','moment','path','sox','fs-extra','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util'];(function(_0x6ee51a,_0xc35002){var _0x3b6017=function(_0x3357d5){while(--_0x3357d5){_0x6ee51a['push'](_0x6ee51a['shift']());}};_0x3b6017(++_0xc35002);}(_0x202a,0xc0));var _0xa202=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x202a[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa202('0x0'));var zipdir=require(_0xa202('0x1'));var jsonpatch=require(_0xa202('0x2'));var rp=require('request-promise');var moment=require(_0xa202('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xa202('0x4'));var sox=require(_0xa202('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa202('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa202('0x7'));var deskjs=require(_0xa202('0x8'));var toCsv=require(_0xa202('0x9'));var querystring=require(_0xa202('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa202('0xb'));var qs=require(_0xa202('0xc'));var as=require(_0xa202('0xd'));var hardwareService=require(_0xa202('0xe'));var logger=require('../../config/logger')(_0xa202('0xf'));var utils=require('../../config/utils');var config=require(_0xa202('0x10'));var licenseUtil=require(_0xa202('0x11'));var db=require(_0xa202('0x12'))['db'];function respondWithStatusCode(_0x5bef49,_0x16164b){_0x16164b=_0x16164b||0xcc;return function(_0xdd992){if(_0xdd992){return _0x5bef49[_0xa202('0x13')](_0x16164b);}return _0x5bef49[_0xa202('0x14')](_0x16164b)[_0xa202('0x15')]();};}function respondWithResult(_0x29969e,_0x598d8e){_0x598d8e=_0x598d8e||0xc8;return function(_0x13510c){if(_0x13510c){return _0x29969e[_0xa202('0x14')](_0x598d8e)[_0xa202('0x16')](_0x13510c);}};}function respondWithFilteredResult(_0x28953b,_0x2e1790){return function(_0x5dc065){if(_0x5dc065){var _0x331df8=typeof _0x2e1790[_0xa202('0x17')]===_0xa202('0x18')&&typeof _0x2e1790[_0xa202('0x19')]===_0xa202('0x18');var _0x214a08=_0x5dc065['count'];var _0x44a1b6=_0x331df8?0x0:_0x2e1790['offset'];var _0x130df2=_0x331df8?_0x5dc065['count']:_0x2e1790[_0xa202('0x17')]+_0x2e1790[_0xa202('0x19')];var _0x130c45;if(_0x130df2>=_0x214a08){_0x130df2=_0x214a08;_0x130c45=0xc8;}else{_0x130c45=0xce;}_0x28953b[_0xa202('0x14')](_0x130c45);return _0x28953b[_0xa202('0x1a')]('Content-Range',_0x44a1b6+'-'+_0x130df2+'/'+_0x214a08)[_0xa202('0x16')](_0x5dc065);}return null;};}function patchUpdates(_0x6132f1){return function(_0x353440){try{jsonpatch[_0xa202('0x1b')](_0x353440,_0x6132f1,!![]);}catch(_0x188195){return BPromise['reject'](_0x188195);}return _0x353440[_0xa202('0x1c')]();};}function saveUpdates(_0x7b47e5,_0x46cfa4){return function(_0x44801a){if(_0x44801a){return _0x44801a['update'](_0x7b47e5)[_0xa202('0x1d')](function(_0x192d3c){return _0x192d3c;});}return null;};}function removeEntity(_0x5b764d,_0x565685){return function(_0x7991c7){if(_0x7991c7){return _0x7991c7[_0xa202('0x1e')]()['then'](function(){_0x5b764d[_0xa202('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5373b6,_0x72fe3e){return function(_0x268ee9){if(!_0x268ee9){_0x5373b6[_0xa202('0x13')](0x194);}return _0x268ee9;};}function handleError(_0x2f0779,_0xf13878){_0xf13878=_0xf13878||0x1f4;return function(_0x1d6704){logger['error'](_0x1d6704['stack']);if(_0x1d6704['name']){delete _0x1d6704['name'];}_0x2f0779[_0xa202('0x14')](_0xf13878)[_0xa202('0x1f')](_0x1d6704);};}exports[_0xa202('0x20')]=function(_0x57f049,_0x35ae40){var _0x390633={},_0xf73ab4={},_0x2cc2af={'count':0x0,'rows':[]};var _0x3eed2c=_[_0xa202('0x21')](db[_0xa202('0x22')][_0xa202('0x23')],function(_0x22ba67){return{'name':_0x22ba67[_0xa202('0x24')],'type':_0x22ba67[_0xa202('0x25')][_0xa202('0x26')]};});_0xf73ab4[_0xa202('0x27')]=_[_0xa202('0x21')](_0x3eed2c,_0xa202('0x28'));_0xf73ab4[_0xa202('0x29')]=_['keys'](_0x57f049[_0xa202('0x29')]);_0xf73ab4[_0xa202('0x2a')]=_[_0xa202('0x2b')](_0xf73ab4[_0xa202('0x27')],_0xf73ab4[_0xa202('0x29')]);_0x390633[_0xa202('0x2c')]=_['intersection'](_0xf73ab4[_0xa202('0x27')],qs[_0xa202('0x2d')](_0x57f049['query'][_0xa202('0x2d')]));_0x390633[_0xa202('0x2c')]=_0x390633['attributes']['length']?_0x390633['attributes']:_0xf73ab4[_0xa202('0x27')];if(!_0x57f049[_0xa202('0x29')][_0xa202('0x2e')](_0xa202('0x2f'))){_0x390633[_0xa202('0x19')]=qs['limit'](_0x57f049[_0xa202('0x29')]['limit']);_0x390633[_0xa202('0x17')]=qs[_0xa202('0x17')](_0x57f049[_0xa202('0x29')]['offset']);}_0x390633[_0xa202('0x30')]=qs['sort'](_0x57f049['query'][_0xa202('0x31')]);_0x390633[_0xa202('0x32')]=qs['filters'](_[_0xa202('0x33')](_0x57f049['query'],_0xf73ab4['filters']),_0x3eed2c);if(_0x57f049[_0xa202('0x29')][_0xa202('0x34')]){_0x390633['where']=_[_0xa202('0x35')](_0x390633[_0xa202('0x32')],{'$or':_[_0xa202('0x21')](_0x3eed2c,function(_0x527921){if(_0x527921[_0xa202('0x25')]!==_0xa202('0x36')){var _0x34ba33={};_0x34ba33[_0x527921[_0xa202('0x28')]]={'$like':'%'+_0x57f049[_0xa202('0x29')][_0xa202('0x34')]+'%'};return _0x34ba33;}})});}_0x390633=_[_0xa202('0x35')]({},_0x390633,_0x57f049[_0xa202('0x37')]);var _0x226863={'where':_0x390633[_0xa202('0x32')]};return db[_0xa202('0x22')][_0xa202('0x38')](_0x226863)['then'](function(_0x5bd528){_0x2cc2af[_0xa202('0x38')]=_0x5bd528;if(_0x57f049[_0xa202('0x29')][_0xa202('0x39')]){_0x390633[_0xa202('0x3a')]=[{'all':!![]}];}return db[_0xa202('0x22')][_0xa202('0x3b')](_0x390633);})[_0xa202('0x1d')](function(_0x3bca66){_0x2cc2af[_0xa202('0x3c')]=_0x3bca66;return _0x2cc2af;})[_0xa202('0x1d')](respondWithFilteredResult(_0x35ae40,_0x390633))['catch'](handleError(_0x35ae40,null));};exports[_0xa202('0x3d')]=function(_0x9879fe,_0x51c551){var _0x48a546={'raw':!![],'where':{'id':_0x9879fe[_0xa202('0x3e')]['id']}},_0x4f783c={};_0x4f783c[_0xa202('0x27')]=_[_0xa202('0x3f')](db[_0xa202('0x22')]['rawAttributes']);_0x4f783c[_0xa202('0x29')]=_[_0xa202('0x3f')](_0x9879fe[_0xa202('0x29')]);_0x4f783c[_0xa202('0x2a')]=_['intersection'](_0x4f783c[_0xa202('0x27')],_0x4f783c[_0xa202('0x29')]);_0x48a546[_0xa202('0x2c')]=_['intersection'](_0x4f783c[_0xa202('0x27')],qs[_0xa202('0x2d')](_0x9879fe[_0xa202('0x29')][_0xa202('0x2d')]));_0x48a546[_0xa202('0x2c')]=_0x48a546[_0xa202('0x2c')][_0xa202('0x40')]?_0x48a546[_0xa202('0x2c')]:_0x4f783c[_0xa202('0x27')];if(_0x9879fe[_0xa202('0x29')][_0xa202('0x39')]){_0x48a546[_0xa202('0x3a')]=[{'all':!![]}];}_0x48a546=_['merge']({},_0x48a546,_0x9879fe[_0xa202('0x37')]);return db[_0xa202('0x22')][_0xa202('0x41')](_0x48a546)[_0xa202('0x1d')](handleEntityNotFound(_0x51c551,null))[_0xa202('0x1d')](respondWithResult(_0x51c551,null))[_0xa202('0x42')](handleError(_0x51c551,null));};exports[_0xa202('0x43')]=function(_0x77626c,_0x5979cd){return db[_0xa202('0x22')][_0xa202('0x43')](_0x77626c[_0xa202('0x44')],{})['then'](respondWithResult(_0x5979cd,0xc9))[_0xa202('0x42')](handleError(_0x5979cd,null));};exports[_0xa202('0x45')]=function(_0xc72f62,_0x55cfc5){if(_0xc72f62[_0xa202('0x44')]['id']){delete _0xc72f62[_0xa202('0x44')]['id'];}return db[_0xa202('0x22')][_0xa202('0x41')]({'where':{'id':_0xc72f62[_0xa202('0x3e')]['id']}})[_0xa202('0x1d')](handleEntityNotFound(_0x55cfc5,null))[_0xa202('0x1d')](saveUpdates(_0xc72f62[_0xa202('0x44')],null))[_0xa202('0x1d')](respondWithResult(_0x55cfc5,null))[_0xa202('0x42')](handleError(_0x55cfc5,null));};exports[_0xa202('0x1e')]=function(_0x4cb0a5,_0x38e236){return db[_0xa202('0x22')][_0xa202('0x41')]({'where':{'id':_0x4cb0a5['params']['id']}})['then'](handleEntityNotFound(_0x38e236,null))[_0xa202('0x1d')](removeEntity(_0x38e236,null))[_0xa202('0x42')](handleError(_0x38e236,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index b775c9e..0865cff 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 _0x7a72=['moment','request-promise','rimraf','./whatsappApplication.attributes','whatsapp_applications','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x24875d,_0x4fb24d){var _0x181471=function(_0x4ecd6d){while(--_0x4ecd6d){_0x24875d['push'](_0x24875d['shift']());}};_0x181471(++_0x4fb24d);}(_0x7a72,0x1be));var _0x27a7=function(_0x27b8b3,_0x278a0d){_0x27b8b3=_0x27b8b3-0x0;var _0x426ef3=_0x7a72[_0x27b8b3];return _0x426ef3;};'use strict';var _=require('lodash');var util=require(_0x27a7('0x0'));var logger=require(_0x27a7('0x1'))('api');var moment=require(_0x27a7('0x2'));var BPromise=require('bluebird');var rp=require(_0x27a7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x27a7('0x4'));var config=require('../../config/environment');var attributes=require(_0x27a7('0x5'));module['exports']=function(_0x320fad,_0x372bb8){return _0x320fad['define']('WhatsappApplication',attributes,{'tableName':_0x27a7('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x27a7('0x7')});}; \ No newline at end of file +var _0xe107=['../../config/logger','api','moment','request-promise','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash'];(function(_0x59d4e3,_0x5a55e9){var _0x7b839d=function(_0x53676b){while(--_0x53676b){_0x59d4e3['push'](_0x59d4e3['shift']());}};_0x7b839d(++_0x5a55e9);}(_0xe107,0xb3));var _0x7e10=function(_0x53a919,_0x41782c){_0x53a919=_0x53a919-0x0;var _0x468f01=_0xe107[_0x53a919];return _0x468f01;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var logger=require(_0x7e10('0x1'))(_0x7e10('0x2'));var moment=require(_0x7e10('0x3'));var BPromise=require('bluebird');var rp=require(_0x7e10('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7e10('0x5'));var attributes=require(_0x7e10('0x6'));module[_0x7e10('0x7')]=function(_0x5be19f,_0x5f1edf){return _0x5be19f[_0x7e10('0x8')](_0x7e10('0x9'),attributes,{'tableName':_0x7e10('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7e10('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 138de53..0adb466 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 _0xeec6=['then','info','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2d9535,_0x4bc592){var _0xb4e710=function(_0x50b9a9){while(--_0x50b9a9){_0x2d9535['push'](_0x2d9535['shift']());}};_0xb4e710(++_0x4bc592);}(_0xeec6,0x1c2));var _0x6eec=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0xeec6[_0x11dc39];return _0x457277;};'use strict';var _=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var moment=require(_0x6eec('0x2'));var BPromise=require(_0x6eec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6eec('0x4'));var db=require(_0x6eec('0x5'))['db'];var utils=require(_0x6eec('0x6'));var logger=require(_0x6eec('0x7'))(_0x6eec('0x8'));var config=require(_0x6eec('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6eec('0xa')][_0x6eec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48064a,_0x5a5e47,_0x1c810e){return new BPromise(function(_0x3443c2,_0x834c2){return client['request'](_0x48064a,_0x1c810e)[_0x6eec('0xc')](function(_0x3aca38){logger[_0x6eec('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x5a5e47,'request\x20sent');logger['debug'](_0x6eec('0xe'),_0x5a5e47,_0x6eec('0xf'),JSON['stringify'](_0x3aca38));if(_0x3aca38['error']){if(_0x3aca38[_0x6eec('0x10')]['code']===0x1f4){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x834c2(_0x3aca38[_0x6eec('0x10')]['message']);}logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);return _0x3443c2(_0x3aca38[_0x6eec('0x10')][_0x6eec('0x12')]);}else{logger[_0x6eec('0xd')](_0x6eec('0x11'),_0x5a5e47,_0x6eec('0xf'));_0x3443c2(_0x3aca38[_0x6eec('0x13')]['message']);}})[_0x6eec('0x14')](function(_0x5f1f33){logger[_0x6eec('0x10')](_0x6eec('0x11'),_0x5a5e47,_0x5f1f33);_0x834c2(_0x5f1f33);});});} \ No newline at end of file +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(_0x384c06,_0x20d767){var _0x36931f=function(_0x5f2855){while(--_0x5f2855){_0x384c06['push'](_0x384c06['shift']());}};_0x36931f(++_0x20d767);}(_0x81bd,0x7c));var _0xd81b=function(_0x4cce3e,_0x4a1349){_0x4cce3e=_0x4cce3e-0x0;var _0x391e08=_0x81bd[_0x4cce3e];return _0x391e08;};'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 diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 5b4e447..6394975 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 _0x4975=['removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','tracked','whatsapp','addTags','whatsappinteraction:update','update','delete','whatsappinteraction:destroy'];(function(_0x2fb87c,_0x2dee49){var _0x43038b=function(_0x7e5396){while(--_0x7e5396){_0x2fb87c['push'](_0x2fb87c['shift']());}};_0x43038b(++_0x2dee49);}(_0x4975,0x86));var _0x5497=function(_0x138a8b,_0x1e87e8){_0x138a8b=_0x138a8b-0x0;var _0x1f8e7c=_0x4975[_0x138a8b];return _0x1f8e7c;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0xa')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0xa')](_0x5497('0x13'),auth[_0x5497('0xd')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x5497('0x14')]);router[_0x5497('0x15')](_0x5497('0x11'),auth[_0x5497('0xd')](),controller[_0x5497('0x16')]);router[_0x5497('0x15')](_0x5497('0x17'),auth[_0x5497('0xd')](),interaction[_0x5497('0x18')](_0x5497('0x19'),'whatsappinteraction:addtags'),controller[_0x5497('0x1a')]);router['put'](_0x5497('0xf'),auth[_0x5497('0xd')](),interaction[_0x5497('0x18')](_0x5497('0x19'),_0x5497('0x1b')),controller[_0x5497('0x1c')]);router[_0x5497('0x1d')]('/:id',auth['isAuthenticated'](),interaction[_0x5497('0x18')](_0x5497('0x19'),_0x5497('0x1e')),controller['destroy']);router[_0x5497('0x1d')](_0x5497('0x17'),auth[_0x5497('0xd')](),controller[_0x5497('0x1f')]);module[_0x5497('0x20')]=router; \ No newline at end of file +var _0xb138=['/:id/download','download','post','create','/:id/tags','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','delete','tracked','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','get'];(function(_0x86b325,_0x59600c){var _0xaace5c=function(_0xc5d8f0){while(--_0xc5d8f0){_0x86b325['push'](_0x86b325['shift']());}};_0xaace5c(++_0x59600c);}(_0xb138,0x1dd));var _0x8b13=function(_0x5b0032,_0x4b0677){_0x5b0032=_0x5b0032-0x0;var _0x557315=_0xb138[_0x5b0032];return _0x557315;};'use strict';var multer=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var path=require(_0x8b13('0x2'));var timeout=require(_0x8b13('0x3'));var express=require(_0x8b13('0x4'));var router=express[_0x8b13('0x5')]();var fs_extra=require(_0x8b13('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var controller=require(_0x8b13('0x9'));router['get']('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0xb')]);router['get'](_0x8b13('0xc'),auth[_0x8b13('0xa')](),controller[_0x8b13('0xd')]);router['get'](_0x8b13('0xe'),auth[_0x8b13('0xa')](),controller['show']);router['get'](_0x8b13('0xf'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x10')]);router[_0x8b13('0x11')](_0x8b13('0x12'),auth['isAuthenticated'](),controller[_0x8b13('0x13')]);router[_0x8b13('0x14')]('/',auth[_0x8b13('0xa')](),controller[_0x8b13('0x15')]);router[_0x8b13('0x14')](_0x8b13('0xf'),auth['isAuthenticated'](),controller['addMessage']);router[_0x8b13('0x14')](_0x8b13('0x16'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0x8b13('0x17')),controller[_0x8b13('0x18')]);router[_0x8b13('0x19')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),interaction['tracked'](_0x8b13('0x1a'),_0x8b13('0x1b')),controller[_0x8b13('0x1c')]);router[_0x8b13('0x1d')](_0x8b13('0xe'),auth[_0x8b13('0xa')](),interaction[_0x8b13('0x1e')](_0x8b13('0x1a'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x8b13('0x1d')](_0x8b13('0x16'),auth[_0x8b13('0xa')](),controller[_0x8b13('0x1f')]);module[_0x8b13('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 40473b7..639ce26 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 _0x2171=['out','moment','exports','BOOLEAN','STRING','DATE','ENUM'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0x2171,0x143));var _0x1217=function(_0x1341a6,_0x23816a){_0x1341a6=_0x1341a6-0x0;var _0x37658e=_0x2171[_0x1341a6];return _0x37658e;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x1217('0x0'));module[_0x1217('0x1')]={'closed':{'type':Sequelize[_0x1217('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1217('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1217('0x3')]},'phone':{'type':Sequelize[_0x1217('0x3')]},'read1stAt':{'type':Sequelize[_0x1217('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x1217('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1217('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1217('0x5')]('in',_0x1217('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x535f=['STRING','ENUM','out','moment','exports','DATE'];(function(_0x201211,_0x2e2788){var _0x3641da=function(_0xfb58b4){while(--_0xfb58b4){_0x201211['push'](_0x201211['shift']());}};_0x3641da(++_0x2e2788);}(_0x535f,0x111));var _0xf535=function(_0x1626bd,_0x40a7a9){_0x1626bd=_0x1626bd-0x0;var _0x16c735=_0x535f[_0x1626bd];return _0x16c735;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf535('0x0'));module[_0xf535('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf535('0x2')]},'disposition':{'type':Sequelize[_0xf535('0x3')]},'secondDisposition':{'type':Sequelize[_0xf535('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf535('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xf535('0x3')]},'read1stAt':{'type':Sequelize[_0xf535('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xf535('0x4')]('in',_0xf535('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf535('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xf535('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 1187c66..bcc95de 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 _0xcdd0=['../../components/export/pdf','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','./whatsappInteraction.socket','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','select','color','from','tools_tags','field','u.id','u.fullname','ui.WhatsappInteractionId','left_join','u.id\x20=\x20ui.UserId','whatsapp_interactions','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','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','length','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','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?','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','contactName','DESC','t.id\x20IN\x20?','resolve','user','role','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','include','options','create','body','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','pick','WhatsappInteractionId','$gte','format','includeAll','findAll','setTags','whatsappInteractionTags:save','removeTags','unix','join','root','tmp','server','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','WhatsappAccount','get','mkdirSync','Whatsapp','Account','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','Messages','Attachment','existsSync','createReadStream','pipe','createWriteStream','basename','direction','out','secret','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','unlinkSync','sendStatus','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xcdd0,0xd9));var _0x0cdd=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xcdd0[_0x5416db];return _0x243e35;};'use strict';var emlformat=require(_0x0cdd('0x0'));var rimraf=require(_0x0cdd('0x1'));var zipdir=require(_0x0cdd('0x2'));var jsonpatch=require(_0x0cdd('0x3'));var rp=require('request-promise');var moment=require(_0x0cdd('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0cdd('0x5'));var path=require('path');var sox=require(_0x0cdd('0x6'));var csv=require(_0x0cdd('0x7'));var ejs=require(_0x0cdd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0cdd('0x9'));var squel=require(_0x0cdd('0xa'));var crypto=require(_0x0cdd('0xb'));var jsforce=require(_0x0cdd('0xc'));var deskjs=require(_0x0cdd('0xd'));var toCsv=require(_0x0cdd('0x7'));var querystring=require(_0x0cdd('0xe'));var Papa=require(_0x0cdd('0xf'));var Redis=require(_0x0cdd('0x10'));var authService=require(_0x0cdd('0x11'));var qs=require(_0x0cdd('0x12'));var as=require(_0x0cdd('0x13'));var pdf=require(_0x0cdd('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0cdd('0x15'))(_0x0cdd('0x16'));var utils=require('../../config/utils');var config=require(_0x0cdd('0x17'));var licenseUtil=require(_0x0cdd('0x18'));var db=require('../../mysqldb')['db'];config[_0x0cdd('0x19')]=_['defaults'](config[_0x0cdd('0x19')],{'host':_0x0cdd('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0cdd('0x1b'))['register'](socket);function respondWithStatusCode(_0x511a9b,_0x59d36e){_0x59d36e=_0x59d36e||0xcc;return function(_0x263521){if(_0x263521){return _0x511a9b['sendStatus'](_0x59d36e);}return _0x511a9b[_0x0cdd('0x1c')](_0x59d36e)[_0x0cdd('0x1d')]();};}function respondWithResult(_0x2c6a33,_0x5accea){_0x5accea=_0x5accea||0xc8;return function(_0x7bba6a){if(_0x7bba6a){return _0x2c6a33['status'](_0x5accea)[_0x0cdd('0x1e')](_0x7bba6a);}};}function respondWithFilteredResult(_0x1b758a,_0x2b3e27){return function(_0x492484){if(_0x492484){var _0x5aeb1a=typeof _0x2b3e27[_0x0cdd('0x1f')]==='undefined'&&typeof _0x2b3e27[_0x0cdd('0x20')]===_0x0cdd('0x21');var _0x595f7b=_0x492484[_0x0cdd('0x22')];var _0x25511c=_0x5aeb1a?0x0:_0x2b3e27[_0x0cdd('0x1f')];var _0x426fb9=_0x5aeb1a?_0x492484[_0x0cdd('0x22')]:_0x2b3e27[_0x0cdd('0x1f')]+_0x2b3e27[_0x0cdd('0x20')];var _0x3b4c48;if(_0x426fb9>=_0x595f7b){_0x426fb9=_0x595f7b;_0x3b4c48=0xc8;}else{_0x3b4c48=0xce;}_0x1b758a[_0x0cdd('0x1c')](_0x3b4c48);return _0x1b758a[_0x0cdd('0x23')](_0x0cdd('0x24'),_0x25511c+'-'+_0x426fb9+'/'+_0x595f7b)['json'](_0x492484);}return null;};}function patchUpdates(_0x135a0f){return function(_0x3a2d5b){try{jsonpatch[_0x0cdd('0x25')](_0x3a2d5b,_0x135a0f,!![]);}catch(_0x29015b){return BPromise['reject'](_0x29015b);}return _0x3a2d5b[_0x0cdd('0x26')]();};}function saveUpdates(_0x3e700f,_0x6fe21d){return function(_0x28570b){if(_0x28570b){return _0x28570b[_0x0cdd('0x27')](_0x3e700f)[_0x0cdd('0x28')](function(_0x3d5731){return _0x3d5731;});}return null;};}function removeEntity(_0x1d1637,_0x3dcee0){return function(_0x289116){if(_0x289116){return _0x289116[_0x0cdd('0x29')]()[_0x0cdd('0x28')](function(){_0x1d1637[_0x0cdd('0x1c')](0xcc)[_0x0cdd('0x1d')]();});}};}function handleEntityNotFound(_0x5dda0c,_0x1bd4db){return function(_0x645b4){if(!_0x645b4){_0x5dda0c['sendStatus'](0x194);}return _0x645b4;};}function handleError(_0x5c5500,_0x3e0c2b){_0x3e0c2b=_0x3e0c2b||0x1f4;return function(_0x56bc7c){logger[_0x0cdd('0x2a')](_0x56bc7c[_0x0cdd('0x2b')]);if(_0x56bc7c[_0x0cdd('0x2c')]){delete _0x56bc7c[_0x0cdd('0x2c')];}_0x5c5500[_0x0cdd('0x1c')](_0x3e0c2b)[_0x0cdd('0x2d')](_0x56bc7c);};}function getInteractionUsers(_0x29212f,_0xeec79e){return new BPromise(function(_0x3123fa,_0x4d6107){try{if(_0xeec79e[_0x29212f['id']]){_0x29212f[_0x0cdd('0x2e')]=_[_0x0cdd('0x2f')](_0xeec79e[_0x29212f['id']],function(_0x4793eb){return{'id':_0x4793eb['id'],'fullname':_0x4793eb[_0x0cdd('0x30')]};});}}catch(_0x16afbc){_0x4d6107(_0x16afbc);}_0x3123fa(_0x29212f);});}function getInteractionTags(_0x74604d,_0x38ffcb){return new BPromise(function(_0x2ad6ea,_0x20ebac){try{if(_0x74604d[_0x0cdd('0x31')]){_0x74604d['Tags']=[];_0x74604d[_0x0cdd('0x31')][_0x0cdd('0x32')](',')[_0x0cdd('0x33')](function(_0x3f1a57){_0x74604d[_0x0cdd('0x34')][_0x0cdd('0x35')](_0x38ffcb[_0x3f1a57]);});}delete _0x74604d['TagIds'];}catch(_0x44c8fc){_0x20ebac(_0x44c8fc);}_0x2ad6ea(_0x74604d);});}function updateWhatsappInteraction(_0x122e70,_0x134d76,_0x47f4b8){return new BPromise(function(_0x451122,_0x4c3300){return getInteractionUsers(_0x122e70,_0x47f4b8)[_0x0cdd('0x28')](function(_0x4fa8a8){return getInteractionTags(_0x4fa8a8,_0x134d76);})[_0x0cdd('0x28')](function(_0x58f51c){_0x451122(_0x58f51c);})[_0x0cdd('0x36')](function(_0x497881){_0x4c3300(_0x497881);});});}exports[_0x0cdd('0x37')]=function(_0x2ed023,_0x471bab){var _0x56ba1e={},_0x396038={},_0x2141b2={'count':0x0,'rows':[]};var _0x17b050=_[_0x0cdd('0x2f')](db[_0x0cdd('0x38')][_0x0cdd('0x39')],function(_0x445415){return{'name':_0x445415[_0x0cdd('0x3a')],'type':_0x445415[_0x0cdd('0x3b')]['key']};});_0x396038[_0x0cdd('0x3c')]=_[_0x0cdd('0x2f')](_0x17b050,_0x0cdd('0x2c'));_0x396038[_0x0cdd('0x3d')]=_[_0x0cdd('0x3e')](_0x2ed023[_0x0cdd('0x3d')]);_0x396038[_0x0cdd('0x3f')]=_[_0x0cdd('0x40')](_0x396038[_0x0cdd('0x3c')],_0x396038['query']);_0x56ba1e['attributes']=_[_0x0cdd('0x40')](_0x396038['model'],qs[_0x0cdd('0x41')](_0x2ed023['query'][_0x0cdd('0x41')]));_0x56ba1e[_0x0cdd('0x42')]=_0x56ba1e['attributes']['length']?_0x56ba1e[_0x0cdd('0x42')]:_0x396038[_0x0cdd('0x3c')];if(!_0x2ed023[_0x0cdd('0x3d')]['hasOwnProperty'](_0x0cdd('0x43'))){_0x56ba1e[_0x0cdd('0x20')]=qs[_0x0cdd('0x20')](_0x2ed023[_0x0cdd('0x3d')]['limit']);_0x56ba1e[_0x0cdd('0x1f')]=qs[_0x0cdd('0x1f')](_0x2ed023[_0x0cdd('0x3d')][_0x0cdd('0x1f')]);}_0x56ba1e['order']=qs['sort'](_0x2ed023[_0x0cdd('0x3d')][_0x0cdd('0x44')]);_0x56ba1e[_0x0cdd('0x45')]=qs[_0x0cdd('0x3f')](_['pick'](_0x2ed023[_0x0cdd('0x3d')],_0x396038['filters']),_0x17b050);var _0x1ef222=[];var _0x210af9=squel[_0x0cdd('0x46')]()['field']('id')['field'](_0x0cdd('0x2c'))['field'](_0x0cdd('0x47'))[_0x0cdd('0x48')](_0x0cdd('0x49'));var _0x2a9d11=squel[_0x0cdd('0x46')]()[_0x0cdd('0x4a')](_0x0cdd('0x4b'))['field'](_0x0cdd('0x4c'))['field'](_0x0cdd('0x4d'))[_0x0cdd('0x48')]('user_has_whatsapp_interactions','ui')[_0x0cdd('0x4e')]('users','u',_0x0cdd('0x4f'));var _0x2eec74=squel[_0x0cdd('0x46')]()[_0x0cdd('0x48')](_0x0cdd('0x50'),'i')[_0x0cdd('0x4e')](_0x0cdd('0x51'),'c',_0x0cdd('0x52'))['left_join'](_0x0cdd('0x53'),'o',_0x0cdd('0x54'))[_0x0cdd('0x4e')](_0x0cdd('0x55'),'a',_0x0cdd('0x56'))[_0x0cdd('0x4e')](_0x0cdd('0x57'),'me','me.WhatsappInteractionId\x20=\x20i.id')['left_join'](_0x0cdd('0x58'),'it',_0x0cdd('0x59'))[_0x0cdd('0x4e')](_0x0cdd('0x49'),'t',_0x0cdd('0x5a'));var _0x4ab96c=squel[_0x0cdd('0x5b')]();var _0x457e79=[];var _0x11b991=squel[_0x0cdd('0x5b')]();var _0x8868b1;if(_0x2ed023[_0x0cdd('0x3d')][_0x0cdd('0x5c')]){_0x8868b1=as[_0x0cdd('0x5d')](_0x2ed023[_0x0cdd('0x3d')][_0x0cdd('0x5c')]);var _0x5d7487=_0x8868b1['sqlOperator'];for(var _0xc0fb8a=0x0;_0xc0fb8a<_0x8868b1['conditions'][_0x0cdd('0x5e')];_0xc0fb8a++){var _0x51b93=_0x8868b1[_0x0cdd('0x5f')][_0xc0fb8a];var _0x2da255='i';var _0x25ba60=_[_0x0cdd('0x60')](_0x17b050,[_0x0cdd('0x2c'),_0x51b93[_0x0cdd('0x4a')]]);if(!_0x25ba60){switch(_0x51b93['field']){case _0x0cdd('0x61'):if(_0x51b93[_0x0cdd('0x62')]==0x1){_0x2eec74[_0x0cdd('0x63')]('`'+_0x51b93['field']+_0x0cdd('0x64'));}else{_0x2eec74['having']('`'+_0x51b93['field']+_0x0cdd('0x65'));}break;case _0x0cdd('0x66'):if(_0x51b93[_0x0cdd('0x67')]===_0x0cdd('0x68')){if(_0x51b93[_0x0cdd('0x62')][_0x0cdd('0x32')]('\x20')[_0x0cdd('0x5e')]>0x1){_0x4ab96c[_0x5d7487]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x51b93[_0x0cdd('0x62')]),null);}else{var _0x106c6a='%'+_0x51b93[_0x0cdd('0x62')]+'%';_0x4ab96c[_0x5d7487]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x106c6a,_0x106c6a,_0x106c6a);}}else{_0x25ba60=_[_0x0cdd('0x60')](_0x17b050,['name',_0x0cdd('0x69')]);_0x51b93[_0x0cdd('0x4a')]=_0x0cdd('0x69');_0x365aa3=as[_0x0cdd('0x6a')](_0x2da255,_0x25ba60[_0x0cdd('0x3b')],_0x51b93);_0x4ab96c[_0x5d7487](_0x365aa3[_0x0cdd('0x6b')],_0x365aa3[_0x0cdd('0x62')][_0x0cdd('0x6c')],_0x365aa3['value']['end']);}break;case _0x0cdd('0x6d'):var _0x1be542=_0x51b93['value']['split'](',')[_0x0cdd('0x2f')](function(_0x2e479b){return Number(_0x2e479b);});_0x1be542['forEach'](function(_0x39e77f){_0x11b991['or'](_0x0cdd('0x6e'),'%,'+_0x39e77f+',%');});_0x457e79=_[_0x0cdd('0x6f')](_0x457e79,_0x1be542);break;case _0x0cdd('0x70'):if(_0x51b93['operator']===_0x0cdd('0x68')){_0x4ab96c[_0x5d7487](_0x0cdd('0x71'),'%'+_0x51b93['value']+'%',null);}else{_0x25ba60=_['find'](_0x17b050,[_0x0cdd('0x2c'),'UserId']);_0x51b93['field']='UserId';_0x365aa3=as['buildExpression'](_0x2da255,_0x25ba60[_0x0cdd('0x3b')],_0x51b93);_0x4ab96c[_0x5d7487](_0x365aa3[_0x0cdd('0x6b')],_0x365aa3['value'][_0x0cdd('0x6c')],_0x365aa3[_0x0cdd('0x62')][_0x0cdd('0x1d')]);}break;case'body':_0x365aa3=as[_0x0cdd('0x6a')]('me',null,_0x51b93);_0x4ab96c[_0x5d7487](_0x365aa3[_0x0cdd('0x6b')],_0x365aa3['value'][_0x0cdd('0x6c')],_0x365aa3[_0x0cdd('0x62')][_0x0cdd('0x1d')]);break;}}else{var _0x365aa3=as[_0x0cdd('0x6a')](_0x2da255,_0x25ba60[_0x0cdd('0x3b')],_0x51b93);_0x4ab96c[_0x5d7487](_0x365aa3[_0x0cdd('0x6b')],_0x365aa3[_0x0cdd('0x62')][_0x0cdd('0x6c')],_0x365aa3['value'][_0x0cdd('0x1d')]);}}}else{var _0x1ebd57=_(_0x2ed023['query'])[_0x0cdd('0x3e')]()[_0x0cdd('0x2f')](function(_0x583780){return _[_0x0cdd('0x72')](_0x17b050,[_0x0cdd('0x2c'),_0x583780])?_0x583780:undefined;})[_0x0cdd('0x73')]()[_0x0cdd('0x62')]();if(!_[_0x0cdd('0x74')](_0x1ebd57)){_0x1ebd57[_0x0cdd('0x33')](function(_0x46f88d){if(_0x46f88d===_0x0cdd('0x75')){_0x2eec74[_0x0cdd('0x45')](_0x0cdd('0x76'),[][_0x0cdd('0x77')](_0x2ed023[_0x0cdd('0x3d')][_0x46f88d]));}else if(_0x46f88d===_0x0cdd('0x78')){var _0x10ea4c=JSON[_0x0cdd('0x79')](_0x2ed023[_0x0cdd('0x3d')][_0x46f88d])['$gte'];var _0x46e2fa=JSON['parse'](_0x2ed023[_0x0cdd('0x3d')][_0x46f88d])[_0x0cdd('0x7a')];_0x2eec74[_0x0cdd('0x45')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x10ea4c,_0x46e2fa);}else{if(_0x2ed023['query'][_0x46f88d]===_0x0cdd('0x7b')){_0x2eec74[_0x0cdd('0x45')]('i.'+_0x46f88d+_0x0cdd('0x7c'));}else{_0x2eec74[_0x0cdd('0x45')]('i.'+_0x46f88d+_0x0cdd('0x7d'),_0x2ed023['query'][_0x46f88d]);}}});}if(_0x2ed023[_0x0cdd('0x3d')][_0x0cdd('0x7e')]){if(_0x2ed023['query'][_0x0cdd('0x7e')]==0x1){_0x2eec74[_0x0cdd('0x63')](_0x0cdd('0x7f'));}else{_0x2eec74[_0x0cdd('0x63')](_0x0cdd('0x80'));}}if(_0x2ed023[_0x0cdd('0x3d')][_0x0cdd('0x81')]){_0x457e79=_['isArray'](_0x2ed023[_0x0cdd('0x3d')]['tag'])?_0x2ed023[_0x0cdd('0x3d')][_0x0cdd('0x81')]:new Array(_0x2ed023[_0x0cdd('0x3d')][_0x0cdd('0x81')]);_0x457e79[_0x0cdd('0x33')](function(_0xf9d07e){_0x11b991['or'](_0x0cdd('0x6e'),'%,'+_0xf9d07e+',%');});}if(_0x2ed023[_0x0cdd('0x3d')]['filter']){var _0x2c34e1=_0x2ed023['query'][_0x0cdd('0x82')][_0x0cdd('0x83')]('\x5c','\x5c\x5c')[_0x0cdd('0x83')](/'/g,'\x27\x27');if(qs[_0x0cdd('0x84')](_0x2c34e1)){_0x4ab96c['or'](_0x0cdd('0x85'),_0x2c34e1+'%')['or'](_0x0cdd('0x86'),_0x2c34e1+'%');}else{_0x4ab96c['or'](_0x0cdd('0x87'),qs[_0x0cdd('0x88')](_0x2c34e1))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2c34e1+'%');}}}_0x2eec74['where'](_0x4ab96c);_0x2eec74[_0x0cdd('0x89')](_0x0cdd('0x8a'));var _0x3af3c1={'type':db[_0x0cdd('0x8b')][_0x0cdd('0x8c')][_0x0cdd('0x8d')],'raw':!![]};var _0x327109=_0x2eec74[_0x0cdd('0x8e')]();_0x327109[_0x0cdd('0x4a')](_0x0cdd('0x8a'));_0x327109[_0x0cdd('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0cdd('0x61'));if(_0x56ba1e[_0x0cdd('0x8f')]){_0x56ba1e[_0x0cdd('0x8f')][_0x0cdd('0x33')](function(_0x369f8b){var _0x2f5565=_0x369f8b[0x0]===_0x0cdd('0x90')?_0x369f8b[0x0]:'i.'+_0x369f8b[0x0];_0x2eec74[_0x0cdd('0x8f')](_0x2f5565,_0x369f8b[0x1]===_0x0cdd('0x91')?![]:!![]);});}if(!_[_0x0cdd('0x74')](_0x457e79)){_0x2eec74[_0x0cdd('0x63')](_0x11b991);_0x327109[_0x0cdd('0x45')](_0x0cdd('0x92'),_0x457e79);}BPromise[_0x0cdd('0x93')]()[_0x0cdd('0x28')](function(){if(!_0x8868b1){if(_0x2ed023[_0x0cdd('0x3d')]['WhatsappAccountId'])return;_0x327109['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x2eec74[_0x0cdd('0x45')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2ed023[_0x0cdd('0x94')][_0x0cdd('0x95')]!=='agent')return;return _0x2ed023[_0x0cdd('0x94')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x0cdd('0x28')](function(_0x54b504){if(_[_0x0cdd('0x74')](_0x54b504)){_0x327109[_0x0cdd('0x45')](_0x0cdd('0x96'));_0x2eec74['where']('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x327109['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x0cdd('0x2f')](_0x54b504,'id'));_0x2eec74['where'](_0x0cdd('0x76'),_['map'](_0x54b504,'id'));}});})[_0x0cdd('0x28')](function(){if(_0x2ed023[_0x0cdd('0x94')]['role']==='agent'&&!_0x8868b1&&!_0x2ed023[_0x0cdd('0x3d')][_0x0cdd('0x75')])return[];return db[_0x0cdd('0x97')]['query'](_0x327109[_0x0cdd('0x98')](),_0x3af3c1);})[_0x0cdd('0x28')](function(_0x646797){_0x2141b2[_0x0cdd('0x22')]=_0x646797['length'];if(_0x2141b2[_0x0cdd('0x22')]===0x0)return[];return db['sequelize'][_0x0cdd('0x3d')](_0x210af9[_0x0cdd('0x98')](),_0x3af3c1)['then'](function(_0x2b637a){_0x1ef222=_['keyBy'](_0x2b637a,'id');_0x3af3c1=_[_0x0cdd('0x99')](_0x3af3c1,{'model':db[_0x0cdd('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ed023[_0x0cdd('0x3d')][_0x0cdd('0x41')]){_0x56ba1e[_0x0cdd('0x42')][_0x0cdd('0x33')](function(_0x94181){_0x2eec74[_0x0cdd('0x4a')]('i.'+_0x94181);});}else{_0x2eec74[_0x0cdd('0x4a')](_0x0cdd('0x9a'),_0x0cdd('0x61'));_0x2eec74[_0x0cdd('0x4a')](_0x0cdd('0x9b'),_0x0cdd('0x9c'));_0x2eec74[_0x0cdd('0x4a')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x2eec74[_0x0cdd('0x4a')](_0x0cdd('0x9d'),'contactName');_0x2eec74[_0x0cdd('0x4a')](_0x0cdd('0x9e'));_0x2eec74[_0x0cdd('0x4a')](_0x0cdd('0x9f'),_0x0cdd('0xa0'));_0x2eec74[_0x0cdd('0x4a')]('c.lastName',_0x0cdd('0xa1'));_0x2eec74[_0x0cdd('0x4a')](_0x0cdd('0xa2'),_0x0cdd('0xa3'));_0x2eec74[_0x0cdd('0x4a')](_0x0cdd('0xa4'),_0x0cdd('0xa5'));_0x2eec74[_0x0cdd('0x4a')](_0x0cdd('0xa6'),_0x0cdd('0xa7'));_0x2eec74[_0x0cdd('0x4a')]('c.fax',_0x0cdd('0xa8'));_0x2eec74[_0x0cdd('0x4a')](_0x0cdd('0xa9'),'Owner.fullname');_0x2eec74[_0x0cdd('0x4a')](_0x0cdd('0xaa'),'Owner.internal');_0x2eec74[_0x0cdd('0x4a')](_0x0cdd('0xab'),_0x0cdd('0x31'));}if(_0x56ba1e['limit'])_0x2eec74[_0x0cdd('0x20')](_0x56ba1e[_0x0cdd('0x20')]);if(_0x56ba1e[_0x0cdd('0x1f')])_0x2eec74['offset'](_0x56ba1e[_0x0cdd('0x1f')]);return db['sequelize'][_0x0cdd('0x3d')](_0x2eec74[_0x0cdd('0x98')](),_0x3af3c1);})['then'](function(_0x7c4ab7){if(_0x7c4ab7[_0x0cdd('0x5e')]>0x0)_0x2a9d11[_0x0cdd('0x45')](_0x0cdd('0xac'),_[_0x0cdd('0x2f')](_0x7c4ab7,'id'));return db[_0x0cdd('0x97')]['query'](_0x2a9d11['toString'](),_0x3af3c1)[_0x0cdd('0x28')](function(_0x12c530){var _0x531f99=_[_0x0cdd('0xad')](_0x12c530,'WhatsappInteractionId');var _0x3dd4aa=[];_0x7c4ab7[_0x0cdd('0x33')](function(_0x50e7de){_0x3dd4aa['push'](updateWhatsappInteraction(_0x50e7de,_0x1ef222,_0x531f99));});return BPromise[_0x0cdd('0xae')](_0x3dd4aa);});});})[_0x0cdd('0x28')](function(_0x2a1698){_0x2141b2[_0x0cdd('0xaf')]=_0x2a1698;return _0x2141b2;})['then'](respondWithFilteredResult(_0x471bab,_0x56ba1e))[_0x0cdd('0x36')](handleError(_0x471bab,null));};exports[_0x0cdd('0xb0')]=function(_0x5583b6,_0x50e6e9){var _0x1b3a81={'raw':![],'where':{'id':_0x5583b6['params']['id']}},_0x339c74={};_0x339c74[_0x0cdd('0x3c')]=_[_0x0cdd('0x3e')](db[_0x0cdd('0x38')][_0x0cdd('0x39')]);_0x339c74[_0x0cdd('0x3d')]=_['keys'](_0x5583b6[_0x0cdd('0x3d')]);_0x339c74[_0x0cdd('0x3f')]=_[_0x0cdd('0x40')](_0x339c74[_0x0cdd('0x3c')],_0x339c74[_0x0cdd('0x3d')]);_0x1b3a81[_0x0cdd('0x42')]=_[_0x0cdd('0x40')](_0x339c74['model'],qs[_0x0cdd('0x41')](_0x5583b6[_0x0cdd('0x3d')][_0x0cdd('0x41')]));_0x1b3a81[_0x0cdd('0x42')]=_0x1b3a81[_0x0cdd('0x42')][_0x0cdd('0x5e')]?_0x1b3a81[_0x0cdd('0x42')]:_0x339c74[_0x0cdd('0x3c')];if(_0x5583b6[_0x0cdd('0x3d')]['includeAll']){_0x1b3a81[_0x0cdd('0xb1')]=[{'all':!![]}];}_0x1b3a81=_[_0x0cdd('0x99')]({},_0x1b3a81,_0x5583b6[_0x0cdd('0xb2')]);return db[_0x0cdd('0x38')][_0x0cdd('0x60')](_0x1b3a81)[_0x0cdd('0x28')](handleEntityNotFound(_0x50e6e9,null))[_0x0cdd('0x28')](respondWithResult(_0x50e6e9,null))[_0x0cdd('0x36')](handleError(_0x50e6e9,null));};exports[_0x0cdd('0xb3')]=function(_0x4aac86,_0x13dc02){return db[_0x0cdd('0x38')][_0x0cdd('0xb3')](_0x4aac86[_0x0cdd('0xb4')],{})[_0x0cdd('0x28')](respondWithResult(_0x13dc02,0xc9))[_0x0cdd('0x36')](handleError(_0x13dc02,null));};exports['update']=function(_0xaa22ec,_0x3cd5f4){if(_0xaa22ec[_0x0cdd('0xb4')]['id']){delete _0xaa22ec[_0x0cdd('0xb4')]['id'];}return db['WhatsappInteraction'][_0x0cdd('0x60')]({'where':{'id':_0xaa22ec['params']['id']}})[_0x0cdd('0x28')](handleEntityNotFound(_0x3cd5f4,null))['then'](saveUpdates(_0xaa22ec['body'],null))['then'](respondWithResult(_0x3cd5f4,null))[_0x0cdd('0x36')](handleError(_0x3cd5f4,null));};exports[_0x0cdd('0x29')]=function(_0x1dff4e,_0x3bb4ee){return db[_0x0cdd('0x38')][_0x0cdd('0x60')]({'where':{'id':_0x1dff4e[_0x0cdd('0xb5')]['id']}})[_0x0cdd('0x28')](handleEntityNotFound(_0x3bb4ee,null))[_0x0cdd('0x28')](removeEntity(_0x3bb4ee,null))[_0x0cdd('0x36')](handleError(_0x3bb4ee,null));};exports[_0x0cdd('0xb6')]=function(_0x1aedd0,_0x3632e6){return db[_0x0cdd('0x38')][_0x0cdd('0xb6')]()['then'](respondWithResult(_0x3632e6,null))[_0x0cdd('0x36')](handleError(_0x3632e6,null));};exports[_0x0cdd('0xb7')]=function(_0x435039,_0x1b8051,_0x20f5ae){return db[_0x0cdd('0xb8')]['find']({'where':{'id':_0x435039[_0x0cdd('0xb5')]['id']}})['then'](handleEntityNotFound(_0x1b8051,null))[_0x0cdd('0x28')](function(_0xff87eb){if(_0xff87eb){return _0xff87eb['addMessage'](_0x435039['body'][_0x0cdd('0xb9')],_[_0x0cdd('0xba')](_0x435039['body'],[_0x0cdd('0xb9'),'id'])||{});}})[_0x0cdd('0x28')](respondWithResult(_0x1b8051,null))['catch'](handleError(_0x1b8051,null));};exports[_0x0cdd('0xbb')]=function(_0x3487e5,_0xd351ef,_0x561f0a){var _0x2e09c9={'raw':![],'where':{}};var _0x56d42c={};var _0x18e156={'count':0x0,'rows':[]};return db[_0x0cdd('0x38')][_0x0cdd('0xbc')]({'where':{'id':_0x3487e5['params']['id']}})[_0x0cdd('0x28')](handleEntityNotFound(_0xd351ef,null))[_0x0cdd('0x28')](function(_0x3cb080){if(_0x3cb080){_0x56d42c[_0x0cdd('0x3c')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x56d42c[_0x0cdd('0x3d')]=_[_0x0cdd('0x3e')](_0x3487e5[_0x0cdd('0x3d')]);_0x56d42c[_0x0cdd('0x3f')]=_['intersection'](_0x56d42c[_0x0cdd('0x3c')],_0x56d42c[_0x0cdd('0x3d')]);_0x2e09c9[_0x0cdd('0x42')]=_[_0x0cdd('0x40')](_0x56d42c[_0x0cdd('0x3c')],qs[_0x0cdd('0x41')](_0x3487e5[_0x0cdd('0x3d')][_0x0cdd('0x41')]));_0x2e09c9[_0x0cdd('0x42')]=_0x2e09c9[_0x0cdd('0x42')]['length']?_0x2e09c9[_0x0cdd('0x42')]:_0x56d42c['model'];if(!_0x3487e5[_0x0cdd('0x3d')][_0x0cdd('0xbd')]('nolimit')){_0x2e09c9[_0x0cdd('0x20')]=qs[_0x0cdd('0x20')](_0x3487e5[_0x0cdd('0x3d')][_0x0cdd('0x20')]);_0x2e09c9[_0x0cdd('0x1f')]=qs[_0x0cdd('0x1f')](_0x3487e5['query'][_0x0cdd('0x1f')]);}_0x2e09c9[_0x0cdd('0x8f')]=qs[_0x0cdd('0x44')](_0x3487e5[_0x0cdd('0x3d')][_0x0cdd('0x44')]);_0x2e09c9[_0x0cdd('0x45')]=qs[_0x0cdd('0x3f')](_[_0x0cdd('0xbe')](_0x3487e5[_0x0cdd('0x3d')],_0x56d42c['filters']));_0x2e09c9['where'][_0x0cdd('0xbf')]=_0x3cb080['id'];if(_0x3487e5[_0x0cdd('0x3d')][_0x0cdd('0x82')]){_0x2e09c9[_0x0cdd('0x45')]=_[_0x0cdd('0x99')](_0x2e09c9['where'],{'$or':_[_0x0cdd('0x2f')](_0x2e09c9[_0x0cdd('0x42')],function(_0x5ca59a){var _0x3c0197={};_0x3c0197[_0x5ca59a]={'$like':'%'+_0x3487e5[_0x0cdd('0x3d')][_0x0cdd('0x82')]+'%'};return _0x3c0197;})});}if(_0x3487e5[_0x0cdd('0x3d')][_0x0cdd('0xc0')]){var _0x1ddef2=_0x3487e5['query'][_0x0cdd('0xc0')]['split'](',');var _0xa54e2c={};_0xa54e2c[_0x1ddef2[0x0]]={'$gte':moment(_0x1ddef2[0x1])[_0x0cdd('0xc1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2e09c9[_0x0cdd('0x45')]=_['merge'](_0x2e09c9[_0x0cdd('0x45')],_0xa54e2c);}_0x2e09c9=_[_0x0cdd('0x99')]({},_0x2e09c9,_0x3487e5[_0x0cdd('0xb2')]);return db[_0x0cdd('0xb8')]['count']({'where':_0x2e09c9['where']})[_0x0cdd('0x28')](function(_0x2b328c){_0x18e156[_0x0cdd('0x22')]=_0x2b328c;if(_0x3487e5[_0x0cdd('0x3d')][_0x0cdd('0xc2')]){_0x2e09c9[_0x0cdd('0xb1')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x0cdd('0xc3')](_0x2e09c9);})[_0x0cdd('0x28')](function(_0x4f116b){_0x18e156['rows']=_0x4f116b;return _0x18e156;});}})[_0x0cdd('0x28')](respondWithFilteredResult(_0xd351ef,_0x2e09c9))[_0x0cdd('0x36')](handleError(_0xd351ef,null));};exports['addTags']=function(_0x310478,_0x42be8b,_0xbdb58){return db[_0x0cdd('0x38')][_0x0cdd('0x60')]({'where':{'id':_0x310478[_0x0cdd('0xb5')]['id']}})['then'](handleEntityNotFound(_0x42be8b,null))[_0x0cdd('0x28')](function(_0x1807d8){if(_0x1807d8){return _0x1807d8[_0x0cdd('0xc4')](_0x310478[_0x0cdd('0xb4')][_0x0cdd('0xb9')],_[_0x0cdd('0xba')](_0x310478[_0x0cdd('0xb4')],['ids','id'])||{})['spread'](function(){return db[_0x0cdd('0x6d')][_0x0cdd('0xc3')]({'attributes':['id',_0x0cdd('0x2c'),_0x0cdd('0x47')],'where':{'id':_0x310478[_0x0cdd('0xb4')]['ids']}});})[_0x0cdd('0x28')](function(_0x3dfae3){socket['emit'](_0x0cdd('0xc5'),{'id':Number(_0x310478[_0x0cdd('0xb5')]['id']),'tags':_0x3dfae3||[]});return{'id':Number(_0x310478[_0x0cdd('0xb5')]['id']),'tags':_0x3dfae3||[]};});}})[_0x0cdd('0x28')](respondWithResult(_0x42be8b,null))['catch'](handleError(_0x42be8b,null));};exports['removeTags']=function(_0x47e342,_0x140659,_0x523e59){return db[_0x0cdd('0x38')][_0x0cdd('0x60')]({'where':{'id':_0x47e342[_0x0cdd('0xb5')]['id']}})[_0x0cdd('0x28')](handleEntityNotFound(_0x140659,null))[_0x0cdd('0x28')](function(_0x1f7ef8){if(_0x1f7ef8){return _0x1f7ef8[_0x0cdd('0xc6')](_0x47e342[_0x0cdd('0x3d')][_0x0cdd('0xb9')]);}})['then'](respondWithStatusCode(_0x140659,null))['catch'](handleError(_0x140659,null));};exports['download']=function(_0x4645a6,_0x29df0c){var _0x21bb0c=moment()[_0x0cdd('0xc7')]()[_0x0cdd('0x98')]();var _0x56e75c=path[_0x0cdd('0xc8')](config[_0x0cdd('0xc9')],'server','files',_0x0cdd('0xca'));var _0x26a291=path[_0x0cdd('0xc8')](config[_0x0cdd('0xc9')],_0x0cdd('0xcb'),_0x0cdd('0xcc'),_0x0cdd('0xcd'));var _0x1ce72d=path[_0x0cdd('0xc8')](_0x56e75c,_0x21bb0c);var _0x5bc8aa=util[_0x0cdd('0xc1')](_0x0cdd('0xce'),_0x4645a6[_0x0cdd('0xb5')]['id'],_0x21bb0c);var _0x542ae1=path[_0x0cdd('0xc8')](_0x56e75c,_0x5bc8aa);var _0x3ce9b3=[];_0x3ce9b3[_0x0cdd('0x35')]({'model':db[_0x0cdd('0x70')],'as':_0x0cdd('0x70'),'attributes':['id',_0x0cdd('0x30')],'raw':!![]});_0x3ce9b3[_0x0cdd('0x35')]({'model':db[_0x0cdd('0xcf')],'as':_0x0cdd('0x66'),'attributes':['id',_0x0cdd('0xd0'),_0x0cdd('0xd1')],'raw':!![]});if(_0x4645a6[_0x0cdd('0x3d')]['attachments']){_0x3ce9b3[_0x0cdd('0x35')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x234f19=[{'model':db[_0x0cdd('0xb8')],'as':'Messages','attributes':['id','body',_0x0cdd('0x78'),'direction','secret',_0x0cdd('0x7e')],'include':_0x3ce9b3}];_0x234f19[_0x0cdd('0x35')]({'model':db[_0x0cdd('0xd2')],'as':'Account','attributes':['id','name']});_0x234f19[_0x0cdd('0x35')]({'model':db[_0x0cdd('0x70')],'as':'Owner','attributes':['id',_0x0cdd('0x30')]});return db['WhatsappInteraction'][_0x0cdd('0x60')]({'where':{'id':_0x4645a6[_0x0cdd('0xb5')]['id']},'include':_0x234f19})[_0x0cdd('0x28')](handleEntityNotFound(_0x29df0c,null))[_0x0cdd('0x28')](function(_0x549f53){if(_0x549f53){var _0x5789d1=_0x549f53[_0x0cdd('0xd3')]({'plain':!![]});fs[_0x0cdd('0xd4')](_0x1ce72d);var _0x432413={'channel':_0x0cdd('0xd5'),'account':_0x5789d1[_0x0cdd('0xd6')][_0x0cdd('0x2c')],'agent':_0x5789d1[_0x0cdd('0xd7')]?_0x5789d1[_0x0cdd('0xd7')][_0x0cdd('0x30')]:_0x0cdd('0xd8'),'createdAt':moment(_0x5789d1['createdAt'])[_0x0cdd('0xc1')](_0x0cdd('0xd9'))[_0x0cdd('0x98')](),'closedAt':_0x5789d1[_0x0cdd('0xda')]?moment(_0x5789d1['closedAt'])[_0x0cdd('0xc1')](_0x0cdd('0xd9'))[_0x0cdd('0x98')]():'','disposition':_0x5789d1['disposition'],'messages':_(_0x5789d1[_0x0cdd('0xdb')])[_0x0cdd('0x82')]({'secret':![]})['map'](function(_0x2b9789){if(_0x2b9789[_0x0cdd('0xdc')]){var _0x520697=path['join'](_0x26a291,_0x2b9789[_0x0cdd('0xdc')]['basename']);if(fs[_0x0cdd('0xdd')](_0x520697)){fs[_0x0cdd('0xde')](_0x520697)[_0x0cdd('0xdf')](fs[_0x0cdd('0xe0')](path[_0x0cdd('0xc8')](_0x1ce72d,_0x2b9789[_0x0cdd('0xdc')][_0x0cdd('0xe1')])));}}return{'date':moment(_0x2b9789[_0x0cdd('0x78')])[_0x0cdd('0xc1')](_0x0cdd('0xd9'))[_0x0cdd('0x98')](),'sender':_0x2b9789[_0x0cdd('0xe2')]===_0x0cdd('0xe3')?_0x2b9789[_0x0cdd('0x70')]?_0x2b9789[_0x0cdd('0x70')][_0x0cdd('0x30')]:'System':_0x2b9789[_0x0cdd('0x66')][_0x0cdd('0xd0')]+(_0x2b9789[_0x0cdd('0x66')][_0x0cdd('0xd1')]?'\x20'+_0x2b9789['Contact'][_0x0cdd('0xd1')]:''),'body':_0x2b9789[_0x0cdd('0xdc')]?_0x2b9789[_0x0cdd('0xdc')]['basename']:_0x2b9789['body'],'direction':_0x2b9789[_0x0cdd('0xe2')]===_0x0cdd('0xe3')?'A':'C','secret':_0x2b9789[_0x0cdd('0xe4')],'read':_0x2b9789[_0x0cdd('0x7e')],'attachment':_0x2b9789[_0x0cdd('0xdc')]};})[_0x0cdd('0x62')]()};return ejs[_0x0cdd('0xe5')](path[_0x0cdd('0xc8')](config['root'],'server',_0x0cdd('0xe6'),_0x0cdd('0xe7')),{'interaction':_0x432413})[_0x0cdd('0x28')](function(_0x1d6eed){var _0x2554ea=path[_0x0cdd('0xc8')](_0x1ce72d,'transcript-'+_0x5789d1['id']+'-'+_0x21bb0c+_0x0cdd('0xe8'));var _0x6902a1={'path':_0x2554ea,'channel':_0x0cdd('0xd5'),'interactionId':_0x5789d1['id']};return pdf[_0x0cdd('0xe9')](_0x1d6eed,_0x6902a1);})['then'](function(){return new BPromise(function(_0x284bc4,_0x406938){zipdir(_0x1ce72d,{'saveTo':_0x542ae1},function(_0x4d72c4,_0x57070f){if(_0x4d72c4)return _0x406938(_0x4d72c4);return _0x284bc4(_0x57070f);});})[_0x0cdd('0x28')](function(){return new BPromise(function(_0x479016,_0x50bbbc){rimraf(_0x1ce72d,function(_0x11009a){if(_0x11009a)_0x50bbbc(_0x11009a);return _0x479016();});});})[_0x0cdd('0x28')](function(){return _0x29df0c['download'](_0x542ae1,_0x5bc8aa,function(_0x596ba9){if(_0x596ba9){console[_0x0cdd('0xea')]('err',_0x596ba9);}else{fs[_0x0cdd('0xeb')](_0x542ae1);}});});});}else{return _0x29df0c[_0x0cdd('0xec')](0xc8);}})[_0x0cdd('0x36')](handleError(_0x29df0c,null));}; \ No newline at end of file +var _0xb6b1=['color','from','tools_tags','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','compact','isEmpty','i.WhatsappAccountId\x20IN\x20?','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','having','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','show','params','includeAll','include','options','create','body','update','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','WhatsappInteractionId','findAll','addTags','setTags','omit','spread','emit','whatsappInteractionTags:save','removeTags','unix','join','server','tmp','root','files','format','CmContact','firstName','lastName','Attachment','secret','Account','Owner','get','mkdirSync','Whatsapp','YYYY-MM-DD\x20HH:mm:ss','disposition','Messages','basename','existsSync','createReadStream','pipe','direction','System','renderFile','views','downloadInteraction.ejs','createPdfFromHTML','download','err','unlinkSync','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','./whatsappInteraction.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','then','destroy','stack','name','map','fullname','TagIds','Tags','split','forEach','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','keys','filters','intersection','model','attributes','query','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field'];(function(_0x42805f,_0xc5d314){var _0x1135b5=function(_0x444718){while(--_0x444718){_0x42805f['push'](_0x42805f['shift']());}};_0x1135b5(++_0xc5d314);}(_0xb6b1,0x17b));var _0x1b6b=function(_0x277af0,_0x1f0361){_0x277af0=_0x277af0-0x0;var _0x43bd7c=_0xb6b1[_0x277af0];return _0x43bd7c;};'use strict';var emlformat=require(_0x1b6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1b6b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b6b('0x2'));var moment=require(_0x1b6b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1b6b('0x4'));var util=require('util');var path=require(_0x1b6b('0x5'));var sox=require(_0x1b6b('0x6'));var csv=require(_0x1b6b('0x7'));var ejs=require(_0x1b6b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1b6b('0x9'));var squel=require('squel');var crypto=require(_0x1b6b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1b6b('0xb'));var toCsv=require(_0x1b6b('0x7'));var querystring=require(_0x1b6b('0xc'));var Papa=require(_0x1b6b('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1b6b('0xe'));var as=require(_0x1b6b('0xf'));var pdf=require(_0x1b6b('0x10'));var hardwareService=require(_0x1b6b('0x11'));var logger=require(_0x1b6b('0x12'))(_0x1b6b('0x13'));var utils=require(_0x1b6b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1b6b('0x15'));var db=require(_0x1b6b('0x16'))['db'];config[_0x1b6b('0x17')]=_['defaults'](config[_0x1b6b('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b6b('0x17')]));require(_0x1b6b('0x18'))[_0x1b6b('0x19')](socket);function respondWithStatusCode(_0x10eea4,_0x1b9cc4){_0x1b9cc4=_0x1b9cc4||0xcc;return function(_0x268fe9){if(_0x268fe9){return _0x10eea4[_0x1b6b('0x1a')](_0x1b9cc4);}return _0x10eea4['status'](_0x1b9cc4)[_0x1b6b('0x1b')]();};}function respondWithResult(_0x251821,_0x10af08){_0x10af08=_0x10af08||0xc8;return function(_0x33dc7e){if(_0x33dc7e){return _0x251821['status'](_0x10af08)[_0x1b6b('0x1c')](_0x33dc7e);}};}function respondWithFilteredResult(_0x3dd677,_0x2e608b){return function(_0x59e671){if(_0x59e671){var _0x923711=typeof _0x2e608b[_0x1b6b('0x1d')]===_0x1b6b('0x1e')&&typeof _0x2e608b[_0x1b6b('0x1f')]===_0x1b6b('0x1e');var _0xe720e7=_0x59e671[_0x1b6b('0x20')];var _0x1622b3=_0x923711?0x0:_0x2e608b[_0x1b6b('0x1d')];var _0x20a5a3=_0x923711?_0x59e671['count']:_0x2e608b[_0x1b6b('0x1d')]+_0x2e608b[_0x1b6b('0x1f')];var _0x3b427d;if(_0x20a5a3>=_0xe720e7){_0x20a5a3=_0xe720e7;_0x3b427d=0xc8;}else{_0x3b427d=0xce;}_0x3dd677[_0x1b6b('0x21')](_0x3b427d);return _0x3dd677[_0x1b6b('0x22')](_0x1b6b('0x23'),_0x1622b3+'-'+_0x20a5a3+'/'+_0xe720e7)[_0x1b6b('0x1c')](_0x59e671);}return null;};}function patchUpdates(_0xa12ff8){return function(_0x22f0b7){try{jsonpatch['apply'](_0x22f0b7,_0xa12ff8,!![]);}catch(_0x1b2cdf){return BPromise['reject'](_0x1b2cdf);}return _0x22f0b7['save']();};}function saveUpdates(_0x4cb089,_0x11449b){return function(_0xc9554d){if(_0xc9554d){return _0xc9554d['update'](_0x4cb089)[_0x1b6b('0x24')](function(_0x47c318){return _0x47c318;});}return null;};}function removeEntity(_0x15dfc7,_0x440658){return function(_0x466c0c){if(_0x466c0c){return _0x466c0c[_0x1b6b('0x25')]()[_0x1b6b('0x24')](function(){_0x15dfc7[_0x1b6b('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8b7b5,_0x1bb7f3){return function(_0x173961){if(!_0x173961){_0xe8b7b5[_0x1b6b('0x1a')](0x194);}return _0x173961;};}function handleError(_0x4bd5b8,_0x23dac4){_0x23dac4=_0x23dac4||0x1f4;return function(_0x5a46bd){logger['error'](_0x5a46bd[_0x1b6b('0x26')]);if(_0x5a46bd['name']){delete _0x5a46bd[_0x1b6b('0x27')];}_0x4bd5b8[_0x1b6b('0x21')](_0x23dac4)['send'](_0x5a46bd);};}function getInteractionUsers(_0x4c42a9,_0x36878c){return new BPromise(function(_0x1f8925,_0x53d5ec){try{if(_0x36878c[_0x4c42a9['id']]){_0x4c42a9['Users']=_[_0x1b6b('0x28')](_0x36878c[_0x4c42a9['id']],function(_0x1b407f){return{'id':_0x1b407f['id'],'fullname':_0x1b407f[_0x1b6b('0x29')]};});}}catch(_0x1bf52c){_0x53d5ec(_0x1bf52c);}_0x1f8925(_0x4c42a9);});}function getInteractionTags(_0x56f31b,_0x20bbd7){return new BPromise(function(_0x1f4c1f,_0x340249){try{if(_0x56f31b[_0x1b6b('0x2a')]){_0x56f31b[_0x1b6b('0x2b')]=[];_0x56f31b[_0x1b6b('0x2a')][_0x1b6b('0x2c')](',')[_0x1b6b('0x2d')](function(_0x2e991b){_0x56f31b['Tags'][_0x1b6b('0x2e')](_0x20bbd7[_0x2e991b]);});}delete _0x56f31b[_0x1b6b('0x2a')];}catch(_0x3d6e4d){_0x340249(_0x3d6e4d);}_0x1f4c1f(_0x56f31b);});}function updateWhatsappInteraction(_0x1ab173,_0x4d51d0,_0x281350){return new BPromise(function(_0x487ce5,_0x261b22){return getInteractionUsers(_0x1ab173,_0x281350)['then'](function(_0x5dbf02){return getInteractionTags(_0x5dbf02,_0x4d51d0);})[_0x1b6b('0x24')](function(_0x3a3f35){_0x487ce5(_0x3a3f35);})[_0x1b6b('0x2f')](function(_0x4c7d74){_0x261b22(_0x4c7d74);});});}exports[_0x1b6b('0x30')]=function(_0x17e0e1,_0x3c7e65){var _0x276bf9={},_0x26b864={},_0x204e0d={'count':0x0,'rows':[]};var _0x100f66=_[_0x1b6b('0x28')](db[_0x1b6b('0x31')][_0x1b6b('0x32')],function(_0x120e13){return{'name':_0x120e13[_0x1b6b('0x33')],'type':_0x120e13[_0x1b6b('0x34')][_0x1b6b('0x35')]};});_0x26b864['model']=_[_0x1b6b('0x28')](_0x100f66,_0x1b6b('0x27'));_0x26b864['query']=_[_0x1b6b('0x36')](_0x17e0e1['query']);_0x26b864[_0x1b6b('0x37')]=_[_0x1b6b('0x38')](_0x26b864[_0x1b6b('0x39')],_0x26b864['query']);_0x276bf9[_0x1b6b('0x3a')]=_[_0x1b6b('0x38')](_0x26b864[_0x1b6b('0x39')],qs['fields'](_0x17e0e1[_0x1b6b('0x3b')][_0x1b6b('0x3c')]));_0x276bf9[_0x1b6b('0x3a')]=_0x276bf9['attributes']['length']?_0x276bf9['attributes']:_0x26b864[_0x1b6b('0x39')];if(!_0x17e0e1[_0x1b6b('0x3b')][_0x1b6b('0x3d')](_0x1b6b('0x3e'))){_0x276bf9[_0x1b6b('0x1f')]=qs[_0x1b6b('0x1f')](_0x17e0e1[_0x1b6b('0x3b')]['limit']);_0x276bf9[_0x1b6b('0x1d')]=qs[_0x1b6b('0x1d')](_0x17e0e1[_0x1b6b('0x3b')][_0x1b6b('0x1d')]);}_0x276bf9[_0x1b6b('0x3f')]=qs[_0x1b6b('0x40')](_0x17e0e1['query'][_0x1b6b('0x40')]);_0x276bf9[_0x1b6b('0x41')]=qs[_0x1b6b('0x37')](_[_0x1b6b('0x42')](_0x17e0e1[_0x1b6b('0x3b')],_0x26b864[_0x1b6b('0x37')]),_0x100f66);var _0x1c86ce=[];var _0x393a56=squel[_0x1b6b('0x43')]()[_0x1b6b('0x44')]('id')[_0x1b6b('0x44')](_0x1b6b('0x27'))['field'](_0x1b6b('0x45'))[_0x1b6b('0x46')](_0x1b6b('0x47'));var _0xf901db=squel[_0x1b6b('0x43')]()[_0x1b6b('0x44')]('u.id')['field'](_0x1b6b('0x48'))['field'](_0x1b6b('0x49'))['from'](_0x1b6b('0x4a'),'ui')[_0x1b6b('0x4b')](_0x1b6b('0x4c'),'u',_0x1b6b('0x4d'));var _0x53cb3d=squel[_0x1b6b('0x43')]()['from']('whatsapp_interactions','i')[_0x1b6b('0x4b')](_0x1b6b('0x4e'),'c',_0x1b6b('0x4f'))[_0x1b6b('0x4b')]('users','o',_0x1b6b('0x50'))['left_join'](_0x1b6b('0x51'),'a',_0x1b6b('0x52'))[_0x1b6b('0x4b')]('whatsapp_messages','me',_0x1b6b('0x53'))['left_join'](_0x1b6b('0x54'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x1b6b('0x4b')](_0x1b6b('0x47'),'t',_0x1b6b('0x55'));var _0x21e798=squel[_0x1b6b('0x56')]();var _0x2b46a4=[];var _0x5d55a5=squel['expr']();var _0x2be336;if(_0x17e0e1[_0x1b6b('0x3b')]['search']){_0x2be336=as[_0x1b6b('0x57')](_0x17e0e1[_0x1b6b('0x3b')][_0x1b6b('0x58')]);var _0x6cab33=_0x2be336[_0x1b6b('0x59')];for(var _0x587c88=0x0;_0x587c88<_0x2be336[_0x1b6b('0x5a')]['length'];_0x587c88++){var _0x2cb484=_0x2be336[_0x1b6b('0x5a')][_0x587c88];var _0x295002='i';var _0x23475a=_[_0x1b6b('0x5b')](_0x100f66,[_0x1b6b('0x27'),_0x2cb484[_0x1b6b('0x44')]]);if(!_0x23475a){switch(_0x2cb484[_0x1b6b('0x44')]){case _0x1b6b('0x5c'):if(_0x2cb484['value']==0x1){_0x53cb3d['having']('`'+_0x2cb484['field']+_0x1b6b('0x5d'));}else{_0x53cb3d['having']('`'+_0x2cb484['field']+_0x1b6b('0x5e'));}break;case _0x1b6b('0x5f'):if(_0x2cb484[_0x1b6b('0x60')]===_0x1b6b('0x61')){if(_0x2cb484['value'][_0x1b6b('0x2c')]('\x20')[_0x1b6b('0x62')]>0x1){_0x21e798[_0x6cab33](_0x1b6b('0x63'),qs['getFullTextValue'](_0x2cb484['value']),null);}else{var _0xfc3746='%'+_0x2cb484[_0x1b6b('0x64')]+'%';_0x21e798[_0x6cab33](_0x1b6b('0x65'),_0xfc3746,_0xfc3746,_0xfc3746);}}else{_0x23475a=_['find'](_0x100f66,['name','ContactId']);_0x2cb484['field']=_0x1b6b('0x66');_0x1b6eb7=as[_0x1b6b('0x67')](_0x295002,_0x23475a[_0x1b6b('0x34')],_0x2cb484);_0x21e798[_0x6cab33](_0x1b6eb7[_0x1b6b('0x68')],_0x1b6eb7[_0x1b6b('0x64')][_0x1b6b('0x69')],_0x1b6eb7['value'][_0x1b6b('0x1b')]);}break;case _0x1b6b('0x6a'):var _0x1d87d6=_0x2cb484[_0x1b6b('0x64')][_0x1b6b('0x2c')](',')[_0x1b6b('0x28')](function(_0x57c2c6){return Number(_0x57c2c6);});_0x1d87d6[_0x1b6b('0x2d')](function(_0x4e0cb9){_0x5d55a5['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4e0cb9+',%');});_0x2b46a4=_['union'](_0x2b46a4,_0x1d87d6);break;case _0x1b6b('0x6b'):if(_0x2cb484['operator']==='$substring'){_0x21e798[_0x6cab33](_0x1b6b('0x6c'),'%'+_0x2cb484[_0x1b6b('0x64')]+'%',null);}else{_0x23475a=_[_0x1b6b('0x5b')](_0x100f66,[_0x1b6b('0x27'),_0x1b6b('0x6d')]);_0x2cb484[_0x1b6b('0x44')]=_0x1b6b('0x6d');_0x1b6eb7=as['buildExpression'](_0x295002,_0x23475a[_0x1b6b('0x34')],_0x2cb484);_0x21e798[_0x6cab33](_0x1b6eb7['text'],_0x1b6eb7[_0x1b6b('0x64')][_0x1b6b('0x69')],_0x1b6eb7[_0x1b6b('0x64')]['end']);}break;case'body':_0x1b6eb7=as[_0x1b6b('0x67')]('me',null,_0x2cb484);_0x21e798[_0x6cab33](_0x1b6eb7[_0x1b6b('0x68')],_0x1b6eb7[_0x1b6b('0x64')][_0x1b6b('0x69')],_0x1b6eb7[_0x1b6b('0x64')][_0x1b6b('0x1b')]);break;}}else{var _0x1b6eb7=as[_0x1b6b('0x67')](_0x295002,_0x23475a['type'],_0x2cb484);_0x21e798[_0x6cab33](_0x1b6eb7['text'],_0x1b6eb7[_0x1b6b('0x64')][_0x1b6b('0x69')],_0x1b6eb7[_0x1b6b('0x64')][_0x1b6b('0x1b')]);}}}else{var _0x507775=_(_0x17e0e1[_0x1b6b('0x3b')])['keys']()[_0x1b6b('0x28')](function(_0x25a0c4){return _['some'](_0x100f66,[_0x1b6b('0x27'),_0x25a0c4])?_0x25a0c4:undefined;})[_0x1b6b('0x6e')]()[_0x1b6b('0x64')]();if(!_[_0x1b6b('0x6f')](_0x507775)){_0x507775[_0x1b6b('0x2d')](function(_0x10bd40){if(_0x10bd40==='WhatsappAccountId'){_0x53cb3d[_0x1b6b('0x41')](_0x1b6b('0x70'),[]['concat'](_0x17e0e1[_0x1b6b('0x3b')][_0x10bd40]));}else if(_0x10bd40===_0x1b6b('0x71')){var _0x2a816b=JSON[_0x1b6b('0x72')](_0x17e0e1[_0x1b6b('0x3b')][_0x10bd40])[_0x1b6b('0x73')];var _0x388b26=JSON[_0x1b6b('0x72')](_0x17e0e1['query'][_0x10bd40])['$lte'];_0x53cb3d['where'](_0x1b6b('0x74'),_0x2a816b,_0x388b26);}else{if(_0x17e0e1[_0x1b6b('0x3b')][_0x10bd40]===_0x1b6b('0x75')){_0x53cb3d[_0x1b6b('0x41')]('i.'+_0x10bd40+_0x1b6b('0x76'));}else{_0x53cb3d[_0x1b6b('0x41')]('i.'+_0x10bd40+'\x20=\x20?',_0x17e0e1['query'][_0x10bd40]);}}});}if(_0x17e0e1[_0x1b6b('0x3b')]['read']){if(_0x17e0e1[_0x1b6b('0x3b')][_0x1b6b('0x77')]==0x1){_0x53cb3d[_0x1b6b('0x78')]('`unreadMessages`\x20=\x200');}else{_0x53cb3d[_0x1b6b('0x78')]('`unreadMessages`\x20>\x200');}}if(_0x17e0e1[_0x1b6b('0x3b')][_0x1b6b('0x79')]){_0x2b46a4=_['isArray'](_0x17e0e1[_0x1b6b('0x3b')]['tag'])?_0x17e0e1[_0x1b6b('0x3b')][_0x1b6b('0x79')]:new Array(_0x17e0e1['query'][_0x1b6b('0x79')]);_0x2b46a4[_0x1b6b('0x2d')](function(_0x295fa6){_0x5d55a5['or'](_0x1b6b('0x7a'),'%,'+_0x295fa6+',%');});}if(_0x17e0e1[_0x1b6b('0x3b')][_0x1b6b('0x7b')]){var _0x58bc30=_0x17e0e1['query'][_0x1b6b('0x7b')]['replace']('\x5c','\x5c\x5c')[_0x1b6b('0x7c')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x58bc30)){_0x21e798['or'](_0x1b6b('0x7d'),_0x58bc30+'%')['or'](_0x1b6b('0x7e'),_0x58bc30+'%');}else{_0x21e798['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1b6b('0x7f')](_0x58bc30))['or'](_0x1b6b('0x80'),_0x58bc30+'%');}}}_0x53cb3d[_0x1b6b('0x41')](_0x21e798);_0x53cb3d['group']('i.id');var _0x69072d={'type':db[_0x1b6b('0x81')][_0x1b6b('0x82')]['SELECT'],'raw':!![]};var _0x26caa6=_0x53cb3d[_0x1b6b('0x83')]();_0x26caa6[_0x1b6b('0x44')](_0x1b6b('0x84'));_0x26caa6[_0x1b6b('0x44')](_0x1b6b('0x85'),_0x1b6b('0x5c'));if(_0x276bf9[_0x1b6b('0x3f')]){_0x276bf9[_0x1b6b('0x3f')][_0x1b6b('0x2d')](function(_0x41e282){var _0x393137=_0x41e282[0x0]===_0x1b6b('0x86')?_0x41e282[0x0]:'i.'+_0x41e282[0x0];_0x53cb3d[_0x1b6b('0x3f')](_0x393137,_0x41e282[0x1]===_0x1b6b('0x87')?![]:!![]);});}if(!_['isEmpty'](_0x2b46a4)){_0x53cb3d['having'](_0x5d55a5);_0x26caa6[_0x1b6b('0x41')]('t.id\x20IN\x20?',_0x2b46a4);}BPromise[_0x1b6b('0x88')]()[_0x1b6b('0x24')](function(){if(!_0x2be336){if(_0x17e0e1[_0x1b6b('0x3b')][_0x1b6b('0x89')])return;_0x26caa6[_0x1b6b('0x41')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x53cb3d[_0x1b6b('0x41')](_0x1b6b('0x8a'));return;}if(_0x17e0e1[_0x1b6b('0x8b')][_0x1b6b('0x8c')]!=='agent')return;return _0x17e0e1[_0x1b6b('0x8b')][_0x1b6b('0x8d')]({'attributes':['id'],'raw':!![]})[_0x1b6b('0x24')](function(_0x106239){if(_[_0x1b6b('0x6f')](_0x106239)){_0x26caa6[_0x1b6b('0x41')](_0x1b6b('0x8e'));_0x53cb3d[_0x1b6b('0x41')](_0x1b6b('0x8e'));}else{_0x26caa6['where'](_0x1b6b('0x70'),_[_0x1b6b('0x28')](_0x106239,'id'));_0x53cb3d[_0x1b6b('0x41')](_0x1b6b('0x70'),_[_0x1b6b('0x28')](_0x106239,'id'));}});})[_0x1b6b('0x24')](function(){if(_0x17e0e1[_0x1b6b('0x8b')][_0x1b6b('0x8c')]===_0x1b6b('0x8f')&&!_0x2be336&&!_0x17e0e1[_0x1b6b('0x3b')]['WhatsappAccountId'])return[];return db[_0x1b6b('0x90')][_0x1b6b('0x3b')](_0x26caa6[_0x1b6b('0x91')](),_0x69072d);})['then'](function(_0x4c343e){_0x204e0d[_0x1b6b('0x20')]=_0x4c343e[_0x1b6b('0x62')];if(_0x204e0d['count']===0x0)return[];return db[_0x1b6b('0x90')][_0x1b6b('0x3b')](_0x393a56[_0x1b6b('0x91')](),_0x69072d)[_0x1b6b('0x24')](function(_0x2066ec){_0x1c86ce=_[_0x1b6b('0x92')](_0x2066ec,'id');_0x69072d=_[_0x1b6b('0x93')](_0x69072d,{'model':db[_0x1b6b('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x17e0e1['query'][_0x1b6b('0x3c')]){_0x276bf9[_0x1b6b('0x3a')][_0x1b6b('0x2d')](function(_0x59be1c){_0x53cb3d[_0x1b6b('0x44')]('i.'+_0x59be1c);});}else{_0x53cb3d[_0x1b6b('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1b6b('0x5c'));_0x53cb3d[_0x1b6b('0x44')](_0x1b6b('0x94'),'Account.key');_0x53cb3d[_0x1b6b('0x44')](_0x1b6b('0x95'),_0x1b6b('0x96'));_0x53cb3d['field'](_0x1b6b('0x97'),'contactName');_0x53cb3d['field'](_0x1b6b('0x98'));_0x53cb3d[_0x1b6b('0x44')]('c.firstName','Contact.firstName');_0x53cb3d[_0x1b6b('0x44')](_0x1b6b('0x99'),'Contact.lastName');_0x53cb3d['field'](_0x1b6b('0x9a'),'Contact.email');_0x53cb3d[_0x1b6b('0x44')](_0x1b6b('0x9b'),_0x1b6b('0x9c'));_0x53cb3d[_0x1b6b('0x44')](_0x1b6b('0x9d'),_0x1b6b('0x9e'));_0x53cb3d[_0x1b6b('0x44')](_0x1b6b('0x9f'),'Contact.fax');_0x53cb3d[_0x1b6b('0x44')](_0x1b6b('0xa0'),_0x1b6b('0xa1'));_0x53cb3d['field'](_0x1b6b('0xa2'),_0x1b6b('0xa3'));_0x53cb3d['field'](_0x1b6b('0xa4'),_0x1b6b('0x2a'));}if(_0x276bf9[_0x1b6b('0x1f')])_0x53cb3d[_0x1b6b('0x1f')](_0x276bf9[_0x1b6b('0x1f')]);if(_0x276bf9['offset'])_0x53cb3d['offset'](_0x276bf9[_0x1b6b('0x1d')]);return db['sequelize']['query'](_0x53cb3d[_0x1b6b('0x91')](),_0x69072d);})[_0x1b6b('0x24')](function(_0x4ec999){if(_0x4ec999['length']>0x0)_0xf901db[_0x1b6b('0x41')]('ui.WhatsappInteractionId\x20IN\x20?',_[_0x1b6b('0x28')](_0x4ec999,'id'));return db['sequelize']['query'](_0xf901db[_0x1b6b('0x91')](),_0x69072d)['then'](function(_0x426426){var _0x5e5196=_[_0x1b6b('0xa5')](_0x426426,'WhatsappInteractionId');var _0x523254=[];_0x4ec999['forEach'](function(_0x7323aa){_0x523254['push'](updateWhatsappInteraction(_0x7323aa,_0x1c86ce,_0x5e5196));});return BPromise[_0x1b6b('0xa6')](_0x523254);});});})['then'](function(_0x3fa66a){_0x204e0d[_0x1b6b('0xa7')]=_0x3fa66a;return _0x204e0d;})[_0x1b6b('0x24')](respondWithFilteredResult(_0x3c7e65,_0x276bf9))['catch'](handleError(_0x3c7e65,null));};exports[_0x1b6b('0xa8')]=function(_0x29459a,_0x5a12a6){var _0x478dc4={'raw':![],'where':{'id':_0x29459a[_0x1b6b('0xa9')]['id']}},_0x1c4952={};_0x1c4952[_0x1b6b('0x39')]=_[_0x1b6b('0x36')](db[_0x1b6b('0x31')][_0x1b6b('0x32')]);_0x1c4952['query']=_[_0x1b6b('0x36')](_0x29459a['query']);_0x1c4952[_0x1b6b('0x37')]=_[_0x1b6b('0x38')](_0x1c4952[_0x1b6b('0x39')],_0x1c4952['query']);_0x478dc4['attributes']=_['intersection'](_0x1c4952[_0x1b6b('0x39')],qs['fields'](_0x29459a[_0x1b6b('0x3b')][_0x1b6b('0x3c')]));_0x478dc4[_0x1b6b('0x3a')]=_0x478dc4[_0x1b6b('0x3a')]['length']?_0x478dc4[_0x1b6b('0x3a')]:_0x1c4952[_0x1b6b('0x39')];if(_0x29459a['query'][_0x1b6b('0xaa')]){_0x478dc4[_0x1b6b('0xab')]=[{'all':!![]}];}_0x478dc4=_[_0x1b6b('0x93')]({},_0x478dc4,_0x29459a[_0x1b6b('0xac')]);return db[_0x1b6b('0x31')][_0x1b6b('0x5b')](_0x478dc4)[_0x1b6b('0x24')](handleEntityNotFound(_0x5a12a6,null))[_0x1b6b('0x24')](respondWithResult(_0x5a12a6,null))[_0x1b6b('0x2f')](handleError(_0x5a12a6,null));};exports[_0x1b6b('0xad')]=function(_0x1ab239,_0x1a5b25){return db[_0x1b6b('0x31')]['create'](_0x1ab239[_0x1b6b('0xae')],{})[_0x1b6b('0x24')](respondWithResult(_0x1a5b25,0xc9))[_0x1b6b('0x2f')](handleError(_0x1a5b25,null));};exports[_0x1b6b('0xaf')]=function(_0x3d90f2,_0x57ab5a){if(_0x3d90f2[_0x1b6b('0xae')]['id']){delete _0x3d90f2['body']['id'];}return db[_0x1b6b('0x31')]['find']({'where':{'id':_0x3d90f2[_0x1b6b('0xa9')]['id']}})[_0x1b6b('0x24')](handleEntityNotFound(_0x57ab5a,null))[_0x1b6b('0x24')](saveUpdates(_0x3d90f2[_0x1b6b('0xae')],null))[_0x1b6b('0x24')](respondWithResult(_0x57ab5a,null))[_0x1b6b('0x2f')](handleError(_0x57ab5a,null));};exports[_0x1b6b('0x25')]=function(_0x4b3e4a,_0x10e742){return db['WhatsappInteraction'][_0x1b6b('0x5b')]({'where':{'id':_0x4b3e4a[_0x1b6b('0xa9')]['id']}})[_0x1b6b('0x24')](handleEntityNotFound(_0x10e742,null))[_0x1b6b('0x24')](removeEntity(_0x10e742,null))[_0x1b6b('0x2f')](handleError(_0x10e742,null));};exports[_0x1b6b('0xb0')]=function(_0x222644,_0x4c897a){return db[_0x1b6b('0x31')][_0x1b6b('0xb0')]()[_0x1b6b('0x24')](respondWithResult(_0x4c897a,null))[_0x1b6b('0x2f')](handleError(_0x4c897a,null));};exports[_0x1b6b('0xb1')]=function(_0x4679c5,_0x10cbfa,_0x35420a){return db['WhatsappMessage'][_0x1b6b('0x5b')]({'where':{'id':_0x4679c5[_0x1b6b('0xa9')]['id']}})[_0x1b6b('0x24')](handleEntityNotFound(_0x10cbfa,null))['then'](function(_0x593451){if(_0x593451){return _0x593451[_0x1b6b('0xb1')](_0x4679c5[_0x1b6b('0xae')][_0x1b6b('0xb2')],_['omit'](_0x4679c5[_0x1b6b('0xae')],[_0x1b6b('0xb2'),'id'])||{});}})[_0x1b6b('0x24')](respondWithResult(_0x10cbfa,null))['catch'](handleError(_0x10cbfa,null));};exports[_0x1b6b('0xb3')]=function(_0x54b1bd,_0x290b44,_0xb991bb){var _0x55ac90={'raw':![],'where':{}};var _0x2e14b8={};var _0x2928b4={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x1b6b('0xb4')]({'where':{'id':_0x54b1bd['params']['id']}})[_0x1b6b('0x24')](handleEntityNotFound(_0x290b44,null))[_0x1b6b('0x24')](function(_0xa6393e){if(_0xa6393e){_0x2e14b8[_0x1b6b('0x39')]=_[_0x1b6b('0x36')](db[_0x1b6b('0xb5')][_0x1b6b('0x32')]);_0x2e14b8[_0x1b6b('0x3b')]=_['keys'](_0x54b1bd[_0x1b6b('0x3b')]);_0x2e14b8[_0x1b6b('0x37')]=_[_0x1b6b('0x38')](_0x2e14b8[_0x1b6b('0x39')],_0x2e14b8[_0x1b6b('0x3b')]);_0x55ac90['attributes']=_[_0x1b6b('0x38')](_0x2e14b8[_0x1b6b('0x39')],qs['fields'](_0x54b1bd[_0x1b6b('0x3b')][_0x1b6b('0x3c')]));_0x55ac90[_0x1b6b('0x3a')]=_0x55ac90[_0x1b6b('0x3a')][_0x1b6b('0x62')]?_0x55ac90[_0x1b6b('0x3a')]:_0x2e14b8['model'];if(!_0x54b1bd['query']['hasOwnProperty'](_0x1b6b('0x3e'))){_0x55ac90[_0x1b6b('0x1f')]=qs[_0x1b6b('0x1f')](_0x54b1bd[_0x1b6b('0x3b')][_0x1b6b('0x1f')]);_0x55ac90[_0x1b6b('0x1d')]=qs['offset'](_0x54b1bd[_0x1b6b('0x3b')][_0x1b6b('0x1d')]);}_0x55ac90[_0x1b6b('0x3f')]=qs[_0x1b6b('0x40')](_0x54b1bd[_0x1b6b('0x3b')]['sort']);_0x55ac90[_0x1b6b('0x41')]=qs['filters'](_[_0x1b6b('0x42')](_0x54b1bd['query'],_0x2e14b8[_0x1b6b('0x37')]));_0x55ac90['where'][_0x1b6b('0xb6')]=_0xa6393e['id'];if(_0x54b1bd[_0x1b6b('0x3b')][_0x1b6b('0x7b')]){_0x55ac90[_0x1b6b('0x41')]=_[_0x1b6b('0x93')](_0x55ac90['where'],{'$or':_[_0x1b6b('0x28')](_0x55ac90[_0x1b6b('0x3a')],function(_0x11c4de){var _0x28546d={};_0x28546d[_0x11c4de]={'$like':'%'+_0x54b1bd[_0x1b6b('0x3b')][_0x1b6b('0x7b')]+'%'};return _0x28546d;})});}if(_0x54b1bd[_0x1b6b('0x3b')][_0x1b6b('0x73')]){var _0x2fd25a=_0x54b1bd[_0x1b6b('0x3b')][_0x1b6b('0x73')][_0x1b6b('0x2c')](',');var _0x1312c8={};_0x1312c8[_0x2fd25a[0x0]]={'$gte':moment(_0x2fd25a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x55ac90['where']=_[_0x1b6b('0x93')](_0x55ac90['where'],_0x1312c8);}_0x55ac90=_[_0x1b6b('0x93')]({},_0x55ac90,_0x54b1bd['options']);return db[_0x1b6b('0xb5')][_0x1b6b('0x20')]({'where':_0x55ac90[_0x1b6b('0x41')]})[_0x1b6b('0x24')](function(_0x18fd86){_0x2928b4[_0x1b6b('0x20')]=_0x18fd86;if(_0x54b1bd[_0x1b6b('0x3b')][_0x1b6b('0xaa')]){_0x55ac90[_0x1b6b('0xab')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x1b6b('0xb7')](_0x55ac90);})[_0x1b6b('0x24')](function(_0x4eb0a7){_0x2928b4[_0x1b6b('0xa7')]=_0x4eb0a7;return _0x2928b4;});}})['then'](respondWithFilteredResult(_0x290b44,_0x55ac90))[_0x1b6b('0x2f')](handleError(_0x290b44,null));};exports[_0x1b6b('0xb8')]=function(_0x4d224e,_0x2f1ebf,_0x48178d){return db[_0x1b6b('0x31')]['find']({'where':{'id':_0x4d224e[_0x1b6b('0xa9')]['id']}})[_0x1b6b('0x24')](handleEntityNotFound(_0x2f1ebf,null))[_0x1b6b('0x24')](function(_0x4e6930){if(_0x4e6930){return _0x4e6930[_0x1b6b('0xb9')](_0x4d224e[_0x1b6b('0xae')][_0x1b6b('0xb2')],_[_0x1b6b('0xba')](_0x4d224e[_0x1b6b('0xae')],[_0x1b6b('0xb2'),'id'])||{})[_0x1b6b('0xbb')](function(){return db[_0x1b6b('0x6a')][_0x1b6b('0xb7')]({'attributes':['id',_0x1b6b('0x27'),_0x1b6b('0x45')],'where':{'id':_0x4d224e['body']['ids']}});})[_0x1b6b('0x24')](function(_0x10dacb){socket[_0x1b6b('0xbc')](_0x1b6b('0xbd'),{'id':Number(_0x4d224e[_0x1b6b('0xa9')]['id']),'tags':_0x10dacb||[]});return{'id':Number(_0x4d224e[_0x1b6b('0xa9')]['id']),'tags':_0x10dacb||[]};});}})[_0x1b6b('0x24')](respondWithResult(_0x2f1ebf,null))[_0x1b6b('0x2f')](handleError(_0x2f1ebf,null));};exports[_0x1b6b('0xbe')]=function(_0x4313fd,_0x3dd5e3,_0xa59021){return db[_0x1b6b('0x31')][_0x1b6b('0x5b')]({'where':{'id':_0x4313fd['params']['id']}})[_0x1b6b('0x24')](handleEntityNotFound(_0x3dd5e3,null))[_0x1b6b('0x24')](function(_0x5d60e4){if(_0x5d60e4){return _0x5d60e4[_0x1b6b('0xbe')](_0x4313fd[_0x1b6b('0x3b')][_0x1b6b('0xb2')]);}})[_0x1b6b('0x24')](respondWithStatusCode(_0x3dd5e3,null))['catch'](handleError(_0x3dd5e3,null));};exports['download']=function(_0x507b30,_0xd73e9e){var _0x31ca18=moment()[_0x1b6b('0xbf')]()['toString']();var _0x5e738c=path[_0x1b6b('0xc0')](config['root'],_0x1b6b('0xc1'),'files',_0x1b6b('0xc2'));var _0x1345e0=path[_0x1b6b('0xc0')](config[_0x1b6b('0xc3')],_0x1b6b('0xc1'),_0x1b6b('0xc4'),'attachments');var _0x288477=path['join'](_0x5e738c,_0x31ca18);var _0x4acf55=util[_0x1b6b('0xc5')]('transcript-%d-%s.zip',_0x507b30[_0x1b6b('0xa9')]['id'],_0x31ca18);var _0x307c3d=path[_0x1b6b('0xc0')](_0x5e738c,_0x4acf55);var _0x18e5ff=[];_0x18e5ff[_0x1b6b('0x2e')]({'model':db[_0x1b6b('0x6b')],'as':_0x1b6b('0x6b'),'attributes':['id','fullname'],'raw':!![]});_0x18e5ff['push']({'model':db[_0x1b6b('0xc6')],'as':'Contact','attributes':['id',_0x1b6b('0xc7'),_0x1b6b('0xc8')],'raw':!![]});if(_0x507b30['query']['attachments']){_0x18e5ff['push']({'model':db[_0x1b6b('0xc9')],'as':_0x1b6b('0xc9'),'raw':!![]});}var _0x4d56ed=[{'model':db[_0x1b6b('0xb5')],'as':'Messages','attributes':['id','body','createdAt','direction',_0x1b6b('0xca'),'read'],'include':_0x18e5ff}];_0x4d56ed[_0x1b6b('0x2e')]({'model':db['WhatsappAccount'],'as':_0x1b6b('0xcb'),'attributes':['id','name']});_0x4d56ed[_0x1b6b('0x2e')]({'model':db[_0x1b6b('0x6b')],'as':_0x1b6b('0xcc'),'attributes':['id',_0x1b6b('0x29')]});return db[_0x1b6b('0x31')]['find']({'where':{'id':_0x507b30[_0x1b6b('0xa9')]['id']},'include':_0x4d56ed})[_0x1b6b('0x24')](handleEntityNotFound(_0xd73e9e,null))['then'](function(_0x3eacf1){if(_0x3eacf1){var _0x3a0391=_0x3eacf1[_0x1b6b('0xcd')]({'plain':!![]});fs[_0x1b6b('0xce')](_0x288477);var _0x3965db={'channel':_0x1b6b('0xcf'),'account':_0x3a0391['Account'][_0x1b6b('0x27')],'agent':_0x3a0391[_0x1b6b('0xcc')]?_0x3a0391[_0x1b6b('0xcc')][_0x1b6b('0x29')]:'N.A.','createdAt':moment(_0x3a0391[_0x1b6b('0x71')])[_0x1b6b('0xc5')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1b6b('0x91')](),'closedAt':_0x3a0391['closed']?moment(_0x3a0391['closedAt'])[_0x1b6b('0xc5')](_0x1b6b('0xd0'))['toString']():'','disposition':_0x3a0391[_0x1b6b('0xd1')],'messages':_(_0x3a0391[_0x1b6b('0xd2')])[_0x1b6b('0x7b')]({'secret':![]})[_0x1b6b('0x28')](function(_0x456969){if(_0x456969[_0x1b6b('0xc9')]){var _0x25e0de=path[_0x1b6b('0xc0')](_0x1345e0,_0x456969[_0x1b6b('0xc9')][_0x1b6b('0xd3')]);if(fs[_0x1b6b('0xd4')](_0x25e0de)){fs[_0x1b6b('0xd5')](_0x25e0de)[_0x1b6b('0xd6')](fs['createWriteStream'](path[_0x1b6b('0xc0')](_0x288477,_0x456969['Attachment']['basename'])));}}return{'date':moment(_0x456969['createdAt'])['format'](_0x1b6b('0xd0'))[_0x1b6b('0x91')](),'sender':_0x456969[_0x1b6b('0xd7')]==='out'?_0x456969['User']?_0x456969[_0x1b6b('0x6b')]['fullname']:_0x1b6b('0xd8'):_0x456969[_0x1b6b('0x5f')]['firstName']+(_0x456969['Contact'][_0x1b6b('0xc8')]?'\x20'+_0x456969[_0x1b6b('0x5f')][_0x1b6b('0xc8')]:''),'body':_0x456969['Attachment']?_0x456969[_0x1b6b('0xc9')][_0x1b6b('0xd3')]:_0x456969[_0x1b6b('0xae')],'direction':_0x456969[_0x1b6b('0xd7')]==='out'?'A':'C','secret':_0x456969['secret'],'read':_0x456969[_0x1b6b('0x77')],'attachment':_0x456969[_0x1b6b('0xc9')]};})[_0x1b6b('0x64')]()};return ejs[_0x1b6b('0xd9')](path['join'](config[_0x1b6b('0xc3')],_0x1b6b('0xc1'),_0x1b6b('0xda'),_0x1b6b('0xdb')),{'interaction':_0x3965db})[_0x1b6b('0x24')](function(_0x2a5d37){var _0xb28c10=path[_0x1b6b('0xc0')](_0x288477,'transcript-'+_0x3a0391['id']+'-'+_0x31ca18+'.pdf');var _0x560e00={'path':_0xb28c10,'channel':_0x1b6b('0xcf'),'interactionId':_0x3a0391['id']};return pdf[_0x1b6b('0xdc')](_0x2a5d37,_0x560e00);})[_0x1b6b('0x24')](function(){return new BPromise(function(_0x55f980,_0x1ae4ec){zipdir(_0x288477,{'saveTo':_0x307c3d},function(_0x2d0e84,_0x161fb5){if(_0x2d0e84)return _0x1ae4ec(_0x2d0e84);return _0x55f980(_0x161fb5);});})[_0x1b6b('0x24')](function(){return new BPromise(function(_0x254fb1,_0x46b5ce){rimraf(_0x288477,function(_0x56ee43){if(_0x56ee43)_0x46b5ce(_0x56ee43);return _0x254fb1();});});})['then'](function(){return _0xd73e9e[_0x1b6b('0xdd')](_0x307c3d,_0x4acf55,function(_0x4ec7bf){if(_0x4ec7bf){console['log'](_0x1b6b('0xde'),_0x4ec7bf);}else{fs[_0x1b6b('0xdf')](_0x307c3d);}});});});}else{return _0xd73e9e[_0x1b6b('0x1a')](0xc8);}})['catch'](handleError(_0xd73e9e,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 26e44b0..833799d 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 _0x876b=['WhatsappInteraction','../../mysqldb','save','update','getUsers','then','setDataValue','Users','map','unreadMessages','catch','hook','exports'];(function(_0x4cb66e,_0x5c44ab){var _0xb9e849=function(_0x4c32ef){while(--_0x4c32ef){_0x4cb66e['push'](_0x4cb66e['shift']());}};_0xb9e849(++_0x5c44ab);}(_0x876b,0x1ba));var _0xb876=function(_0x4ed6a3,_0x5f593b){_0x4ed6a3=_0x4ed6a3-0x0;var _0x391353=_0x876b[_0x4ed6a3];return _0x391353;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db'][_0xb876('0x0')];var WhatsappMessage=require(_0xb876('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb876('0x2'),'afterUpdate':_0xb876('0x3'),'afterDestroy':'remove'};function emitEvent(_0x23429e){return function(_0x2bb096,_0x19baec,_0x5e1da8){_0x2bb096[_0xb876('0x4')]({'attributes':['id'],'raw':!![]})[_0xb876('0x5')](function(_0x4b2634){_0x2bb096[_0xb876('0x6')](_0xb876('0x7'),_0x4b2634[_0xb876('0x8')](function(_0x2e5760){return{'id':_0x2e5760['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2bb096['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb876('0x5')](function(_0x488dc4){_0x2bb096[_0xb876('0x6')](_0xb876('0x9'),_0x488dc4['length']);WhatsappInteractionEvents['emit'](_0x23429e+':'+_0x2bb096['id'],_0x2bb096);WhatsappInteractionEvents['emit'](_0x23429e,_0x2bb096);_0x5e1da8(null);})[_0xb876('0xa')](_0x5e1da8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xb876('0xb')](e,emitEvent(event));}}module[_0xb876('0xc')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xeea4=['update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save'];(function(_0x449d38,_0x80d693){var _0x228937=function(_0x1a3a11){while(--_0x1a3a11){_0x449d38['push'](_0x449d38['shift']());}};_0x228937(++_0x80d693);}(_0xeea4,0x19e));var _0x4eea=function(_0x4b1ece,_0x1eadad){_0x4b1ece=_0x4b1ece-0x0;var _0x3463b3=_0xeea4[_0x4b1ece];return _0x3463b3;};'use strict';var EventEmitter=require(_0x4eea('0x0'));var WhatsappInteraction=require(_0x4eea('0x1'))['db'][_0x4eea('0x2')];var WhatsappMessage=require(_0x4eea('0x1'))['db'][_0x4eea('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4eea('0x4')](0x0);var events={'afterCreate':_0x4eea('0x5'),'afterUpdate':_0x4eea('0x6'),'afterDestroy':_0x4eea('0x7')};function emitEvent(_0x5c02db){return function(_0x399e8b,_0x54136a,_0x2df4ae){_0x399e8b[_0x4eea('0x8')]({'attributes':['id'],'raw':!![]})[_0x4eea('0x9')](function(_0x48538e){_0x399e8b[_0x4eea('0xa')](_0x4eea('0xb'),_0x48538e['map'](function(_0x9ccc45){return{'id':_0x9ccc45['id']};}));return WhatsappMessage[_0x4eea('0xc')]({'where':{'WhatsappInteractionId':_0x399e8b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4eea('0x9')](function(_0x411654){_0x399e8b['setDataValue'](_0x4eea('0xd'),_0x411654[_0x4eea('0xe')]);WhatsappInteractionEvents[_0x4eea('0xf')](_0x5c02db+':'+_0x399e8b['id'],_0x399e8b);WhatsappInteractionEvents[_0x4eea('0xf')](_0x5c02db,_0x399e8b);_0x2df4ae(null);})[_0x4eea('0x10')](_0x2df4ae(null));};}for(var e in events){if(events[_0x4eea('0x11')](e)){var event=events[e];WhatsappInteraction[_0x4eea('0x12')](e,emitEvent(event));}}module[_0x4eea('0x13')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 2adc4d5..3770cfa 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 _0x554c=['closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x554c,0x17c));var _0xc554=function(_0x451ccb,_0x4213d1){_0x451ccb=_0x451ccb-0x0;var _0x2136d5=_0x554c[_0x451ccb];return _0x2136d5;};'use strict';var _=require(_0xc554('0x0'));var util=require(_0xc554('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc554('0x2'));var fs=require('fs');var path=require(_0xc554('0x3'));var rimraf=require('rimraf');var config=require(_0xc554('0x4'));var attributes=require(_0xc554('0x5'));module[_0xc554('0x6')]=function(_0x18751f,_0x3f2441){return _0x18751f[_0xc554('0x7')](_0xc554('0x8'),attributes,{'tableName':_0xc554('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4aa898,_0x56dd93,_0x47e022){if(_0x4aa898[_0xc554('0xa')](_0xc554('0xb'))){_0x4aa898[_0xc554('0xc')]=moment()['format'](_0xc554('0xd'));}_0x47e022(null,_0x4aa898);}}});}; \ No newline at end of file +var _0x6e7d=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','whatsapp_interactions','changed','closedAt'];(function(_0x2e1998,_0x37d101){var _0x7acfe7=function(_0x1ffa27){while(--_0x1ffa27){_0x2e1998['push'](_0x2e1998['shift']());}};_0x7acfe7(++_0x37d101);}(_0x6e7d,0x1a0));var _0xd6e7=function(_0x3727df,_0x2b293e){_0x3727df=_0x3727df-0x0;var _0xe4b493=_0x6e7d[_0x3727df];return _0xe4b493;};'use strict';var _=require(_0xd6e7('0x0'));var util=require(_0xd6e7('0x1'));var logger=require(_0xd6e7('0x2'))(_0xd6e7('0x3'));var moment=require(_0xd6e7('0x4'));var BPromise=require(_0xd6e7('0x5'));var rp=require(_0xd6e7('0x6'));var fs=require('fs');var path=require(_0xd6e7('0x7'));var rimraf=require(_0xd6e7('0x8'));var config=require(_0xd6e7('0x9'));var attributes=require(_0xd6e7('0xa'));module[_0xd6e7('0xb')]=function(_0x3f64eb,_0x39503e){return _0x3f64eb[_0xd6e7('0xc')]('WhatsappInteraction',attributes,{'tableName':_0xd6e7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e5004,_0x21460e,_0x1f7640){if(_0x2e5004[_0xd6e7('0xe')]('closed')){_0x2e5004[_0xd6e7('0xf')]=moment()[_0xd6e7('0x10')](_0xd6e7('0x11'));}_0x1f7640(null,_0x2e5004);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 937828e..df4b11f 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 _0x4aec=['UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappInteraction','update','body','options','raw','where','attributes'];(function(_0x3079d5,_0x3be3f5){var _0x295adf=function(_0x5b5970){while(--_0x5b5970){_0x3079d5['push'](_0x3079d5['shift']());}};_0x295adf(++_0x3be3f5);}(_0x4aec,0x110));var _0xc4ae=function(_0x29590a,_0x3f8d88){_0x29590a=_0x29590a-0x0;var _0x40ea14=_0x4aec[_0x29590a];return _0x40ea14;};'use strict';var _=require(_0xc4ae('0x0'));var util=require(_0xc4ae('0x1'));var moment=require(_0xc4ae('0x2'));var BPromise=require('bluebird');var rs=require(_0xc4ae('0x3'));var fs=require('fs');var Redis=require(_0xc4ae('0x4'));var db=require(_0xc4ae('0x5'))['db'];var utils=require(_0xc4ae('0x6'));var logger=require(_0xc4ae('0x7'))('rpc');var config=require(_0xc4ae('0x8'));var jayson=require(_0xc4ae('0x9'));var client=jayson[_0xc4ae('0xa')][_0xc4ae('0xb')]({'port':0x232a});config[_0xc4ae('0xc')]=_[_0xc4ae('0xd')](config['redis'],{'host':_0xc4ae('0xe'),'port':0x18eb});var socket=require(_0xc4ae('0xf'))(new Redis(config[_0xc4ae('0xc')]));require('./whatsappInteraction.socket')[_0xc4ae('0x10')](socket);function respondWithRpcPromise(_0x3cee73,_0x40a351,_0x5bc5f0){return new BPromise(function(_0x51d611,_0x3c406f){return client['request'](_0x3cee73,_0x5bc5f0)[_0xc4ae('0x11')](function(_0x10048f){logger[_0xc4ae('0x12')](_0xc4ae('0x13'),_0x40a351,_0xc4ae('0x14'));logger[_0xc4ae('0x15')](_0xc4ae('0x16'),_0x40a351,_0xc4ae('0x14'),JSON[_0xc4ae('0x17')](_0x10048f));if(_0x10048f[_0xc4ae('0x18')]){if(_0x10048f[_0xc4ae('0x18')][_0xc4ae('0x19')]===0x1f4){logger[_0xc4ae('0x18')](_0xc4ae('0x13'),_0x40a351,_0x10048f[_0xc4ae('0x18')]['message']);return _0x3c406f(_0x10048f['error']['message']);}logger[_0xc4ae('0x18')](_0xc4ae('0x13'),_0x40a351,_0x10048f[_0xc4ae('0x18')][_0xc4ae('0x1a')]);return _0x51d611(_0x10048f[_0xc4ae('0x18')]['message']);}else{logger[_0xc4ae('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x40a351,_0xc4ae('0x14'));_0x51d611(_0x10048f[_0xc4ae('0x1b')][_0xc4ae('0x1a')]);}})[_0xc4ae('0x1c')](function(_0x39fe1a){logger[_0xc4ae('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x40a351,_0x39fe1a);_0x3c406f(_0x39fe1a);});});}exports['UpdateWhatsappInteraction']=function(_0x4869dc){var _0x350596=this;return new Promise(function(_0x40808d,_0x37e289){return db[_0xc4ae('0x1d')][_0xc4ae('0x1e')](_0x4869dc[_0xc4ae('0x1f')],{'raw':_0x4869dc[_0xc4ae('0x20')]?_0x4869dc[_0xc4ae('0x20')][_0xc4ae('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4869dc[_0xc4ae('0x20')]?_0x4869dc[_0xc4ae('0x20')][_0xc4ae('0x22')]||null:null,'attributes':_0x4869dc[_0xc4ae('0x20')]?_0x4869dc[_0xc4ae('0x20')][_0xc4ae('0x23')]||null:null,'limit':_0x4869dc['options']?_0x4869dc[_0xc4ae('0x20')]['limit']||null:null})[_0xc4ae('0x11')](function(_0xbf99d6){logger['info'](_0xc4ae('0x24'),_0x4869dc);logger['debug']('UpdateWhatsappInteraction',_0x4869dc,JSON[_0xc4ae('0x17')](_0xbf99d6));_0x40808d(_0xbf99d6);})['catch'](function(_0x3a092f){logger[_0xc4ae('0x18')](_0xc4ae('0x24'),_0x3a092f[_0xc4ae('0x1a')],_0x4869dc);_0x37e289(_0x350596[_0xc4ae('0x18')](0x1f4,_0x3a092f[_0xc4ae('0x1a')]));});});};exports[_0xc4ae('0x25')]=function(_0x4d9b96){return new Promise(function(_0x1ef494,_0x6d6c00){return db[_0xc4ae('0x1d')][_0xc4ae('0x26')]({'where':_0x4d9b96['options']?_0x4d9b96[_0xc4ae('0x20')][_0xc4ae('0x22')]||null:null})['then'](function(_0x1c3219){if(_0x1c3219){return _0x1c3219[_0xc4ae('0x27')](_0x4d9b96[_0xc4ae('0x1f')][_0xc4ae('0x28')],_[_0xc4ae('0x29')](_0x4d9b96[_0xc4ae('0x1f')],[_0xc4ae('0x28'),'id'])||{});}})[_0xc4ae('0x2a')](function(_0xa9a2ea){logger[_0xc4ae('0x12')](_0xc4ae('0x2b'),_0x4d9b96);logger[_0xc4ae('0x15')](_0xc4ae('0x2b'),_0x4d9b96,JSON[_0xc4ae('0x17')](_0xa9a2ea));_0x1ef494(_0xa9a2ea);})['catch'](function(_0x5c1af9){logger['error'](_0xc4ae('0x2b'),_0x5c1af9[_0xc4ae('0x1a')],_0x4d9b96);_0x6d6c00(_this[_0xc4ae('0x18')](0x1f4,_0x5c1af9[_0xc4ae('0x1a')]));});});}; \ No newline at end of file +var _0x73d8=['info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToWhatsappInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then'];(function(_0x44c415,_0x58b697){var _0x566ecd=function(_0x1c5312){while(--_0x1c5312){_0x44c415['push'](_0x44c415['shift']());}};_0x566ecd(++_0x58b697);}(_0x73d8,0x1bf));var _0x873d=function(_0x10dda0,_0x202ac1){_0x10dda0=_0x10dda0-0x0;var _0x574054=_0x73d8[_0x10dda0];return _0x574054;};'use strict';var _=require(_0x873d('0x0'));var util=require(_0x873d('0x1'));var moment=require(_0x873d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x873d('0x3'))['db'];var utils=require(_0x873d('0x4'));var logger=require(_0x873d('0x5'))('rpc');var config=require(_0x873d('0x6'));var jayson=require(_0x873d('0x7'));var client=jayson[_0x873d('0x8')][_0x873d('0x9')]({'port':0x232a});config[_0x873d('0xa')]=_[_0x873d('0xb')](config[_0x873d('0xa')],{'host':_0x873d('0xc'),'port':0x18eb});var socket=require(_0x873d('0xd'))(new Redis(config[_0x873d('0xa')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x2efe27,_0xde5e59,_0x488cd8){return new BPromise(function(_0x5f31de,_0x2a5f38){return client['request'](_0x2efe27,_0x488cd8)[_0x873d('0xe')](function(_0xc57333){logger[_0x873d('0xf')](_0x873d('0x10'),_0xde5e59,_0x873d('0x11'));logger['debug'](_0x873d('0x12'),_0xde5e59,'request\x20sent',JSON[_0x873d('0x13')](_0xc57333));if(_0xc57333['error']){if(_0xc57333[_0x873d('0x14')][_0x873d('0x15')]===0x1f4){logger[_0x873d('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0xde5e59,_0xc57333[_0x873d('0x14')][_0x873d('0x16')]);return _0x2a5f38(_0xc57333[_0x873d('0x14')]['message']);}logger[_0x873d('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0xde5e59,_0xc57333[_0x873d('0x14')]['message']);return _0x5f31de(_0xc57333['error'][_0x873d('0x16')]);}else{logger[_0x873d('0xf')](_0x873d('0x10'),_0xde5e59,_0x873d('0x11'));_0x5f31de(_0xc57333[_0x873d('0x17')][_0x873d('0x16')]);}})[_0x873d('0x18')](function(_0x1ec43a){logger[_0x873d('0x14')]('WhatsappInteraction,\x20%s,\x20%s',_0xde5e59,_0x1ec43a);_0x2a5f38(_0x1ec43a);});});}exports[_0x873d('0x19')]=function(_0x47a7df){var _0x75c6fa=this;return new Promise(function(_0x6f7afb,_0x1eda48){return db[_0x873d('0x1a')][_0x873d('0x1b')](_0x47a7df[_0x873d('0x1c')],{'raw':_0x47a7df[_0x873d('0x1d')]?_0x47a7df[_0x873d('0x1d')][_0x873d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47a7df[_0x873d('0x1d')]?_0x47a7df['options'][_0x873d('0x1f')]||null:null,'attributes':_0x47a7df['options']?_0x47a7df['options'][_0x873d('0x20')]||null:null,'limit':_0x47a7df[_0x873d('0x1d')]?_0x47a7df[_0x873d('0x1d')][_0x873d('0x21')]||null:null})[_0x873d('0xe')](function(_0x2809b){logger[_0x873d('0xf')](_0x873d('0x19'),_0x47a7df);logger[_0x873d('0x22')](_0x873d('0x19'),_0x47a7df,JSON['stringify'](_0x2809b));_0x6f7afb(_0x2809b);})[_0x873d('0x18')](function(_0x8d76f1){logger['error'](_0x873d('0x19'),_0x8d76f1['message'],_0x47a7df);_0x1eda48(_0x75c6fa[_0x873d('0x14')](0x1f4,_0x8d76f1[_0x873d('0x16')]));});});};exports[_0x873d('0x23')]=function(_0x22f0b5){return new Promise(function(_0x4b74f9,_0x77f7e9){return db[_0x873d('0x1a')][_0x873d('0x24')]({'where':_0x22f0b5['options']?_0x22f0b5[_0x873d('0x1d')]['where']||null:null})['then'](function(_0x1d3230){if(_0x1d3230){return _0x1d3230[_0x873d('0x25')](_0x22f0b5[_0x873d('0x1c')]['ids'],_[_0x873d('0x26')](_0x22f0b5[_0x873d('0x1c')],[_0x873d('0x27'),'id'])||{});}})[_0x873d('0x28')](function(_0x3c84d4){logger[_0x873d('0xf')]('AddTags',_0x22f0b5);logger[_0x873d('0x22')](_0x873d('0x29'),_0x22f0b5,JSON[_0x873d('0x13')](_0x3c84d4));_0x4b74f9(_0x3c84d4);})[_0x873d('0x18')](function(_0x5ed94b){logger['error'](_0x873d('0x29'),_0x5ed94b['message'],_0x22f0b5);_0x77f7e9(_this['error'](0x1f4,_0x5ed94b[_0x873d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 5347938..6d9535f 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 _0xa888=['emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save','remove'];(function(_0xada3e,_0x2cb55d){var _0x2db779=function(_0x281c1a){while(--_0x281c1a){_0xada3e['push'](_0xada3e['shift']());}};_0x2db779(++_0x2cb55d);}(_0xa888,0x89));var _0x8a88=function(_0x810a78,_0x1e3706){_0x810a78=_0x810a78-0x0;var _0x24a295=_0xa888[_0x810a78];return _0x24a295;};'use strict';var WhatsappInteractionEvents=require(_0x8a88('0x0'));var events=[_0x8a88('0x1'),_0x8a88('0x2'),'update'];function createListener(_0x584a22,_0x490261){return function(_0x574518){_0x490261[_0x8a88('0x3')](_0x584a22,_0x574518);};}function removeListener(_0x520a90,_0x283bbf){return function(){WhatsappInteractionEvents[_0x8a88('0x4')](_0x520a90,_0x283bbf);};}exports['register']=function(_0x210078){for(var _0x18c1c1=0x0,_0x21d3d0=events[_0x8a88('0x5')];_0x18c1c1<_0x21d3d0;_0x18c1c1++){var _0x384047=events[_0x18c1c1];var _0x139391=createListener(_0x8a88('0x6')+_0x384047,_0x210078);WhatsappInteractionEvents['on'](_0x384047,_0x139391);}}; \ No newline at end of file +var _0xff9e=['whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x361d21,_0xc785bb){var _0x379d11=function(_0x340c09){while(--_0x340c09){_0x361d21['push'](_0x361d21['shift']());}};_0x379d11(++_0xc785bb);}(_0xff9e,0x145));var _0xeff9=function(_0x211aab,_0x4356da){_0x211aab=_0x211aab-0x0;var _0x37fb1b=_0xff9e[_0x211aab];return _0x37fb1b;};'use strict';var WhatsappInteractionEvents=require(_0xeff9('0x0'));var events=[_0xeff9('0x1'),_0xeff9('0x2'),_0xeff9('0x3')];function createListener(_0x34231d,_0x45a5eb){return function(_0x543918){_0x45a5eb[_0xeff9('0x4')](_0x34231d,_0x543918);};}function removeListener(_0x271dab,_0xa658ac){return function(){WhatsappInteractionEvents[_0xeff9('0x5')](_0x271dab,_0xa658ac);};}exports[_0xeff9('0x6')]=function(_0x245a9b){for(var _0x4c0259=0x0,_0x59f346=events[_0xeff9('0x7')];_0x4c0259<_0x59f346;_0x4c0259++){var _0x5d3a8a=events[_0x4c0259];var _0xcb3493=createListener(_0xeff9('0x8')+_0x5d3a8a,_0x245a9b);WhatsappInteractionEvents['on'](_0x5d3a8a,_0xcb3493);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 0a613b3..c4fde46 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 _0xf821=['/describe','describe','/:id','show','post','tracked','whatsapp','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index'];(function(_0x1f352c,_0x17063f){var _0x178f77=function(_0x46785a){while(--_0x46785a){_0x1f352c['push'](_0x1f352c['shift']());}};_0x178f77(++_0x17063f);}(_0xf821,0x13d));var _0x1f82=function(_0x4e9311,_0x62b91d){_0x4e9311=_0x4e9311-0x0;var _0x323e54=_0xf821[_0x4e9311];return _0x323e54;};'use strict';var multer=require(_0x1f82('0x0'));var util=require(_0x1f82('0x1'));var path=require(_0x1f82('0x2'));var timeout=require(_0x1f82('0x3'));var express=require(_0x1f82('0x4'));var router=express[_0x1f82('0x5')]();var fs_extra=require(_0x1f82('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1f82('0x7'));var config=require(_0x1f82('0x8'));var controller=require(_0x1f82('0x9'));router[_0x1f82('0xa')]('/',auth[_0x1f82('0xb')](),controller[_0x1f82('0xc')]);router['get'](_0x1f82('0xd'),auth[_0x1f82('0xb')](),controller[_0x1f82('0xe')]);router[_0x1f82('0xa')](_0x1f82('0xf'),auth[_0x1f82('0xb')](),controller[_0x1f82('0x10')]);router[_0x1f82('0x11')]('/',auth[_0x1f82('0xb')](),interaction[_0x1f82('0x12')](_0x1f82('0x13'),'whatsappmessage:create'),controller[_0x1f82('0x14')]);router['post'](_0x1f82('0x15'),controller[_0x1f82('0x16')]);router[_0x1f82('0x17')](_0x1f82('0xf'),auth[_0x1f82('0xb')](),controller[_0x1f82('0x18')]);router[_0x1f82('0x17')](_0x1f82('0x19'),auth[_0x1f82('0xb')](),controller[_0x1f82('0x1a')]);router[_0x1f82('0x17')](_0x1f82('0x1b'),auth[_0x1f82('0xb')](),controller[_0x1f82('0x1c')]);router['delete'](_0x1f82('0xf'),auth[_0x1f82('0xb')](),controller['destroy']);module[_0x1f82('0x1d')]=router; \ No newline at end of file +var _0x7a87=['update','accept','/:id/reject','reject','exports','path','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','index','get','/describe','describe','isAuthenticated','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7a87,0xbb));var _0x77a8=function(_0x475514,_0x494060){_0x475514=_0x475514-0x0;var _0x4085cd=_0x7a87[_0x475514];return _0x4085cd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x77a8('0x0'));var timeout=require('connect-timeout');var express=require(_0x77a8('0x1'));var router=express['Router']();var fs_extra=require(_0x77a8('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x77a8('0x3'));var config=require(_0x77a8('0x4'));var controller=require(_0x77a8('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x77a8('0x6')]);router[_0x77a8('0x7')](_0x77a8('0x8'),auth['isAuthenticated'](),controller[_0x77a8('0x9')]);router[_0x77a8('0x7')]('/:id',auth[_0x77a8('0xa')](),controller[_0x77a8('0xb')]);router[_0x77a8('0xc')]('/',auth['isAuthenticated'](),interaction[_0x77a8('0xd')](_0x77a8('0xe'),_0x77a8('0xf')),controller[_0x77a8('0x10')]);router['post'](_0x77a8('0x11'),controller[_0x77a8('0x12')]);router[_0x77a8('0x13')](_0x77a8('0x14'),auth[_0x77a8('0xa')](),controller[_0x77a8('0x15')]);router[_0x77a8('0x13')]('/:id/accept',auth[_0x77a8('0xa')](),controller[_0x77a8('0x16')]);router[_0x77a8('0x13')](_0x77a8('0x17'),auth[_0x77a8('0xa')](),controller[_0x77a8('0x18')]);router['delete'](_0x77a8('0x14'),auth[_0x77a8('0xa')](),controller['destroy']);module[_0x77a8('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 181cfb9..54bd8db 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 _0x7d53=['sequelize','exports','TEXT','ENUM','out','STRING','BOOLEAN'];(function(_0x2e4c38,_0x4c53fa){var _0xf13a6b=function(_0x424be4){while(--_0x424be4){_0x2e4c38['push'](_0x2e4c38['shift']());}};_0xf13a6b(++_0x4c53fa);}(_0x7d53,0x1b9));var _0x37d5=function(_0x1ccae6,_0x3245c8){_0x1ccae6=_0x1ccae6-0x0;var _0x245b77=_0x7d53[_0x1ccae6];return _0x245b77;};'use strict';var Sequelize=require(_0x37d5('0x0'));module[_0x37d5('0x1')]={'body':{'type':Sequelize[_0x37d5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x37d5('0x3')]('in',_0x37d5('0x4')),'defaultValue':_0x37d5('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x37d5('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x37d5('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xbacb=['medium','BOOLEAN','ENUM','out','STRING','TEXT','sequelize','exports'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xbacb,0x1a6));var _0xbbac=function(_0x2112f7,_0x2992bb){_0x2112f7=_0x2112f7-0x0;var _0x2d6d4a=_0xbacb[_0x2112f7];return _0x2d6d4a;};'use strict';var Sequelize=require(_0xbbac('0x0'));module[_0xbbac('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbbac('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbbac('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbbac('0x4')]('in',_0xbbac('0x5')),'defaultValue':_0xbbac('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xbbac('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xbbac('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xbbac('0x6')]},'providerResponse':{'type':Sequelize[_0xbbac('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 7acd11a..6f2982f 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 _0x0811=['SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','RejectMessage','rejectMessage','sequelize','contact','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','messageId','MessageStatus','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','name','send','index','map','WhatsappMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','create','find','describe','../../config/logger','whatsapp-interactions','accept','body','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteractionId','isNil','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','acceptMessage'];(function(_0x14ec03,_0x1608ad){var _0x1f4ade=function(_0x144be7){while(--_0x144be7){_0x14ec03['push'](_0x14ec03['shift']());}};_0x1f4ade(++_0x1608ad);}(_0x0811,0xb3));var _0x1081=function(_0x416a38,_0x5004e0){_0x416a38=_0x416a38-0x0;var _0xec6c28=_0x0811[_0x416a38];return _0xec6c28;};'use strict';var emlformat=require(_0x1081('0x0'));var rimraf=require(_0x1081('0x1'));var zipdir=require(_0x1081('0x2'));var jsonpatch=require(_0x1081('0x3'));var rp=require(_0x1081('0x4'));var moment=require(_0x1081('0x5'));var BPromise=require(_0x1081('0x6'));var Mustache=require(_0x1081('0x7'));var util=require('util');var path=require('path');var sox=require(_0x1081('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1081('0x9'));var _=require(_0x1081('0xa'));var squel=require(_0x1081('0xb'));var crypto=require(_0x1081('0xc'));var jsforce=require(_0x1081('0xd'));var deskjs=require(_0x1081('0xe'));var toCsv=require(_0x1081('0xf'));var querystring=require(_0x1081('0x10'));var Papa=require(_0x1081('0x11'));var Redis=require(_0x1081('0x12'));var authService=require(_0x1081('0x13'));var qs=require(_0x1081('0x14'));var as=require(_0x1081('0x15'));var hardwareService=require(_0x1081('0x16'));var logger=require('../../config/logger')(_0x1081('0x17'));var utils=require(_0x1081('0x18'));var config=require(_0x1081('0x19'));var licenseUtil=require(_0x1081('0x1a'));var db=require(_0x1081('0x1b'))['db'];config[_0x1081('0x1c')]=_['defaults'](config[_0x1081('0x1c')],{'host':_0x1081('0x1d'),'port':0x18eb});var socket=require(_0x1081('0x1e'))(new Redis(config['redis']));require(_0x1081('0x1f'))['register'](socket);var jayson=require(_0x1081('0x20'));var client=jayson[_0x1081('0x21')]['http']({'port':0x232c});var client9002=jayson['client'][_0x1081('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x260e42,_0x554edb,_0x2c4cbd,_0x535366){return new BPromise(function(_0x21667f,_0x535da9){var _0x3aedea=_0x535366||client;return _0x3aedea[_0x1081('0x23')](_0x260e42,_0x2c4cbd)[_0x1081('0x24')](function(_0x5a45fa){logger[_0x1081('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x554edb,_0x1081('0x26'));logger[_0x1081('0x27')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x554edb,_0x1081('0x26'),JSON['stringify'](_0x5a45fa));if(_0x5a45fa['error']){if(_0x5a45fa['error']['code']===0x1f4){logger['error'](_0x1081('0x28'),_0x554edb,_0x5a45fa['error']['message']);return _0x535da9(_0x5a45fa[_0x1081('0x29')]['message']);}logger[_0x1081('0x29')](_0x1081('0x28'),_0x554edb,_0x5a45fa[_0x1081('0x29')][_0x1081('0x2a')]);return _0x21667f(_0x5a45fa[_0x1081('0x29')][_0x1081('0x2a')]);}else{logger[_0x1081('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x554edb,_0x1081('0x26'));_0x21667f(_0x5a45fa[_0x1081('0x2b')][_0x1081('0x2a')]);}})[_0x1081('0x2c')](function(_0x4f31df){logger[_0x1081('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x554edb,_0x4f31df);_0x535da9(_0x4f31df);});});}function respondWithStatusCode(_0x1f2f44,_0x502fb4){_0x502fb4=_0x502fb4||0xcc;return function(_0x46f603){if(_0x46f603){return _0x1f2f44[_0x1081('0x2d')](_0x502fb4);}return _0x1f2f44[_0x1081('0x2e')](_0x502fb4)[_0x1081('0x2f')]();};}function respondWithResult(_0x78e1d6,_0x10a637){_0x10a637=_0x10a637||0xc8;return function(_0x395f72){if(_0x395f72){return _0x78e1d6[_0x1081('0x2e')](_0x10a637)['json'](_0x395f72);}};}function respondWithFilteredResult(_0x3f3dc0,_0x16445e){return function(_0x217fd9){if(_0x217fd9){var _0x3f0e16=typeof _0x16445e[_0x1081('0x30')]==='undefined'&&typeof _0x16445e[_0x1081('0x31')]===_0x1081('0x32');var _0x4a6998=_0x217fd9[_0x1081('0x33')];var _0x18db87=_0x3f0e16?0x0:_0x16445e[_0x1081('0x30')];var _0x4d3cb9=_0x3f0e16?_0x217fd9[_0x1081('0x33')]:_0x16445e['offset']+_0x16445e[_0x1081('0x31')];var _0x48563b;if(_0x4d3cb9>=_0x4a6998){_0x4d3cb9=_0x4a6998;_0x48563b=0xc8;}else{_0x48563b=0xce;}_0x3f3dc0[_0x1081('0x2e')](_0x48563b);return _0x3f3dc0['set'](_0x1081('0x34'),_0x18db87+'-'+_0x4d3cb9+'/'+_0x4a6998)['json'](_0x217fd9);}return null;};}function patchUpdates(_0x38f3d2){return function(_0x3782fb){try{jsonpatch[_0x1081('0x35')](_0x3782fb,_0x38f3d2,!![]);}catch(_0x5368c0){return BPromise[_0x1081('0x36')](_0x5368c0);}return _0x3782fb[_0x1081('0x37')]();};}function saveUpdates(_0x5318c3,_0x45bdfa){return function(_0x4bbb30){if(_0x4bbb30){return _0x4bbb30[_0x1081('0x38')](_0x5318c3)[_0x1081('0x24')](function(_0x35f0df){return _0x35f0df;});}return null;};}function removeEntity(_0x6b78e6,_0x2c9cc6){return function(_0x374525){if(_0x374525){return _0x374525[_0x1081('0x39')]()['then'](function(){_0x6b78e6[_0x1081('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e33f5,_0x5b6ead){return function(_0xb8cb45){if(!_0xb8cb45){_0x4e33f5[_0x1081('0x2d')](0x194);}return _0xb8cb45;};}function handleError(_0x498493,_0x2ece0e){_0x2ece0e=_0x2ece0e||0x1f4;return function(_0x144e61){logger[_0x1081('0x29')](_0x144e61['stack']);if(_0x144e61[_0x1081('0x3a')]){delete _0x144e61['name'];}_0x498493[_0x1081('0x2e')](_0x2ece0e)[_0x1081('0x3b')](_0x144e61);};}exports[_0x1081('0x3c')]=function(_0x5d1507,_0x314883){var _0x1ee9f6={},_0x11e048={},_0xa79b0c={'count':0x0,'rows':[]};var _0x334d40=_[_0x1081('0x3d')](db[_0x1081('0x3e')][_0x1081('0x3f')],function(_0x30292f){return{'name':_0x30292f['fieldName'],'type':_0x30292f[_0x1081('0x40')]['key']};});_0x11e048[_0x1081('0x41')]=_[_0x1081('0x3d')](_0x334d40,'name');_0x11e048[_0x1081('0x42')]=_[_0x1081('0x43')](_0x5d1507['query']);_0x11e048[_0x1081('0x44')]=_[_0x1081('0x45')](_0x11e048[_0x1081('0x41')],_0x11e048['query']);_0x1ee9f6[_0x1081('0x46')]=_[_0x1081('0x45')](_0x11e048[_0x1081('0x41')],qs[_0x1081('0x47')](_0x5d1507[_0x1081('0x42')][_0x1081('0x47')]));_0x1ee9f6[_0x1081('0x46')]=_0x1ee9f6[_0x1081('0x46')]['length']?_0x1ee9f6[_0x1081('0x46')]:_0x11e048[_0x1081('0x41')];if(!_0x5d1507[_0x1081('0x42')]['hasOwnProperty'](_0x1081('0x48'))){_0x1ee9f6[_0x1081('0x31')]=qs[_0x1081('0x31')](_0x5d1507['query'][_0x1081('0x31')]);_0x1ee9f6[_0x1081('0x30')]=qs[_0x1081('0x30')](_0x5d1507[_0x1081('0x42')][_0x1081('0x30')]);}_0x1ee9f6[_0x1081('0x49')]=qs[_0x1081('0x4a')](_0x5d1507[_0x1081('0x42')][_0x1081('0x4a')]);_0x1ee9f6[_0x1081('0x4b')]=qs['filters'](_[_0x1081('0x4c')](_0x5d1507[_0x1081('0x42')],_0x11e048[_0x1081('0x44')]),_0x334d40);if(_0x5d1507[_0x1081('0x42')][_0x1081('0x4d')]){_0x1ee9f6[_0x1081('0x4b')]=_[_0x1081('0x4e')](_0x1ee9f6['where'],{'$or':_[_0x1081('0x3d')](_0x334d40,function(_0x371280){if(_0x371280[_0x1081('0x40')]!==_0x1081('0x4f')){var _0x30b664={};_0x30b664[_0x371280[_0x1081('0x3a')]]={'$like':'%'+_0x5d1507['query'][_0x1081('0x4d')]+'%'};return _0x30b664;}})});}_0x1ee9f6=_[_0x1081('0x4e')]({},_0x1ee9f6,_0x5d1507[_0x1081('0x50')]);var _0x2ce7df={'where':_0x1ee9f6['where']};return db[_0x1081('0x3e')][_0x1081('0x33')](_0x2ce7df)['then'](function(_0x3c15ab){_0xa79b0c[_0x1081('0x33')]=_0x3c15ab;if(_0x5d1507[_0x1081('0x42')][_0x1081('0x51')]){_0x1ee9f6[_0x1081('0x52')]=[{'all':!![]}];}return db[_0x1081('0x3e')][_0x1081('0x53')](_0x1ee9f6);})[_0x1081('0x24')](function(_0xf50d2c){_0xa79b0c[_0x1081('0x54')]=_0xf50d2c;return _0xa79b0c;})[_0x1081('0x24')](respondWithFilteredResult(_0x314883,_0x1ee9f6))['catch'](handleError(_0x314883,null));};exports[_0x1081('0x55')]=function(_0x128fa0,_0x309875){var _0x23870d={'raw':!![],'where':{'id':_0x128fa0[_0x1081('0x56')]['id']}},_0x3f00b8={};_0x3f00b8[_0x1081('0x41')]=_[_0x1081('0x43')](db[_0x1081('0x3e')][_0x1081('0x3f')]);_0x3f00b8[_0x1081('0x42')]=_[_0x1081('0x43')](_0x128fa0['query']);_0x3f00b8[_0x1081('0x44')]=_['intersection'](_0x3f00b8[_0x1081('0x41')],_0x3f00b8[_0x1081('0x42')]);_0x23870d[_0x1081('0x46')]=_[_0x1081('0x45')](_0x3f00b8['model'],qs[_0x1081('0x47')](_0x128fa0[_0x1081('0x42')][_0x1081('0x47')]));_0x23870d[_0x1081('0x46')]=_0x23870d[_0x1081('0x46')][_0x1081('0x57')]?_0x23870d['attributes']:_0x3f00b8[_0x1081('0x41')];if(_0x128fa0['query'][_0x1081('0x51')]){_0x23870d['include']=[{'all':!![]}];}_0x23870d=_['merge']({},_0x23870d,_0x128fa0[_0x1081('0x50')]);return db[_0x1081('0x3e')]['find'](_0x23870d)[_0x1081('0x24')](handleEntityNotFound(_0x309875,null))[_0x1081('0x24')](respondWithResult(_0x309875,null))[_0x1081('0x2c')](handleError(_0x309875,null));};exports['create']=function(_0x635490,_0x591922){return db[_0x1081('0x3e')][_0x1081('0x58')](_0x635490['body'],{})[_0x1081('0x24')](respondWithResult(_0x591922,0xc9))[_0x1081('0x2c')](handleError(_0x591922,null));};exports[_0x1081('0x38')]=function(_0x4e7ea0,_0x4353e9){if(_0x4e7ea0['body']['id']){delete _0x4e7ea0['body']['id'];}return db['WhatsappMessage'][_0x1081('0x59')]({'where':{'id':_0x4e7ea0[_0x1081('0x56')]['id']}})['then'](handleEntityNotFound(_0x4353e9,null))['then'](saveUpdates(_0x4e7ea0['body'],null))[_0x1081('0x24')](respondWithResult(_0x4353e9,null))[_0x1081('0x2c')](handleError(_0x4353e9,null));};exports[_0x1081('0x39')]=function(_0x52218d,_0x5e090f){return db[_0x1081('0x3e')][_0x1081('0x59')]({'where':{'id':_0x52218d[_0x1081('0x56')]['id']}})[_0x1081('0x24')](handleEntityNotFound(_0x5e090f,null))['then'](removeEntity(_0x5e090f,null))[_0x1081('0x2c')](handleError(_0x5e090f,null));};exports[_0x1081('0x5a')]=function(_0x2c67b3,_0x4a1183){return db[_0x1081('0x3e')][_0x1081('0x5a')]()[_0x1081('0x24')](respondWithResult(_0x4a1183,null))[_0x1081('0x2c')](handleError(_0x4a1183,null));};var interaction_log=require(_0x1081('0x5b'))(_0x1081('0x5c'));exports[_0x1081('0x5d')]=function(_0x51994e,_0x3955ae,_0x1f86c1){var _0x37a370={'agent':{},'channel':'whatsapp'};if(_0x51994e[_0x1081('0x5e')]['id']){delete _0x51994e[_0x1081('0x5e')]['id'];}_0x51994e['body'][_0x1081('0x5f')]=!![];_0x51994e[_0x1081('0x5e')][_0x1081('0x60')]=moment()[_0x1081('0x61')](_0x1081('0x62'));_0x51994e[_0x1081('0x5e')][_0x1081('0x63')]=_0x51994e[_0x1081('0x5e')][_0x1081('0x63')]||_0x51994e[_0x1081('0x64')]['id'];_0x37a370['agent']['id']=_0x51994e['body'][_0x1081('0x63')];return db['WhatsappMessage'][_0x1081('0x59')]({'where':{'id':_0x51994e['params']['id'],'UserId':null}})[_0x1081('0x24')](handleEntityNotFound(_0x3955ae,null))['then'](saveUpdates(_0x51994e[_0x1081('0x5e')],null))['then'](function(_0x45be30){if(_0x45be30){_0x37a370['message']=_0x45be30[_0x1081('0x65')]({'plain':!![]});return db['WhatsappInteraction'][_0x1081('0x59')]({'where':{'id':_0x45be30[_0x1081('0x66')]}});}return null;})[_0x1081('0x24')](handleEntityNotFound(_0x3955ae,null))[_0x1081('0x24')](function(_0x300534){if(_0x300534){return _0x300534[_0x1081('0x38')]({'UserId':_0x51994e[_0x1081('0x5e')]['UserId'],'read1stAt':_[_0x1081('0x67')](_0x300534['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x1081('0x24')](function(_0x5484cc){if(_0x5484cc){_0x37a370['interaction']=_0x5484cc[_0x1081('0x65')]({'plain':!![]});interaction_log['info'](_0x1081('0x68'),_0x51994e[_0x1081('0x64')]['id'],_0x51994e[_0x1081('0x64')][_0x1081('0x3a')],_0x51994e[_0x1081('0x64')][_0x1081('0x69')],_0x37a370[_0x1081('0x6a')]['id'],_0x51994e['body']?JSON['stringify'](_0x51994e[_0x1081('0x5e')]):'null');return respondWithRpcPromise(_0x1081('0x6b'),_0x1081('0x6c'),_0x37a370);}return null;})[_0x1081('0x24')](function(_0x3fa94a){var _0x35c47d=_0x1081('0x6d')+_0x3fa94a[_0x1081('0x2a')][_0x1081('0x6e')];return db['sequelize'][_0x1081('0x42')](_0x35c47d,{'type':db[_0x1081('0x6f')][_0x1081('0x70')][_0x1081('0x71')],'raw':!![]})[_0x1081('0x24')](function(_0x20351e){return _0x20351e;});})['then'](function(_0x32da8d){if(_0x32da8d){_0x37a370[_0x1081('0x2a')]['contact']=_0x32da8d[0x0];if(!_0x51994e[_0x1081('0x5e')][_0x1081('0x63')])return;return db[_0x1081('0x72')]['find']({'where':{'id':_0x51994e[_0x1081('0x5e')][_0x1081('0x63')],'role':_0x1081('0x73')},'attributes':['id',_0x1081('0x3a'),_0x1081('0x74'),_0x1081('0x75'),_0x1081('0x76')],'raw':!![]});}return null;})['then'](function(_0x4a953f){if(!_0x4a953f)return null;_0x37a370[_0x1081('0x2a')][_0x1081('0x73')]=_0x4a953f;return _0x37a370;})[_0x1081('0x24')](function(_0x5bb4d0){if(_0x5bb4d0){if(_0x51994e[_0x1081('0x5e')][_0x1081('0x77')]){_0x37a370['message'][_0x1081('0x78')]=util[_0x1081('0x61')](_0x1081('0x79'),_0x51994e[_0x1081('0x64')]['name']);_0x37a370[_0x1081('0x2a')][_0x1081('0x7a')]=_0x37a370[_0x1081('0x7a')];_0x37a370['message'][_0x1081('0x7b')]=_0x37a370[_0x1081('0x7a')];_0x37a370[_0x1081('0x2a')][_0x1081('0x7c')]='accept';return respondWithRpcPromise(_0x1081('0x7d'),_0x1081('0x7d'),{'event':_0x1081('0x7e'),'message':_0x37a370[_0x1081('0x2a')]},client9002)[_0x1081('0x24')](function(){return _0x37a370;});}return _0x37a370;}return null;})[_0x1081('0x24')](respondWithResult(_0x3955ae,null))[_0x1081('0x2c')](handleError(_0x3955ae,null));};var interaction_log=require(_0x1081('0x5b'))(_0x1081('0x5c'));exports[_0x1081('0x36')]=function(_0x33af4a,_0x4abf71,_0x3655b5){var _0x216f05={'agent':{},'channel':_0x1081('0x7f')};if(_0x33af4a[_0x1081('0x5e')]['id']){delete _0x33af4a['body']['id'];}_0x33af4a[_0x1081('0x5e')]['UserId']=_0x33af4a['body']['UserId']||_0x33af4a[_0x1081('0x64')]['id'];_0x216f05['agent']['id']=_0x33af4a[_0x1081('0x5e')][_0x1081('0x63')];return db[_0x1081('0x3e')][_0x1081('0x59')]({'where':{'id':_0x33af4a[_0x1081('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4abf71,null))[_0x1081('0x24')](function(_0x18818a){if(_0x18818a){_0x216f05[_0x1081('0x2a')]=_0x18818a[_0x1081('0x65')]({'plain':!![]});return db['WhatsappInteraction'][_0x1081('0x59')]({'where':{'id':_0x18818a[_0x1081('0x66')]}});}return null;})[_0x1081('0x24')](handleEntityNotFound(_0x4abf71,null))[_0x1081('0x24')](function(_0x11d6e9){if(_0x11d6e9){_0x216f05['interaction']=_0x11d6e9[_0x1081('0x65')]({'plain':!![]});interaction_log[_0x1081('0x25')](_0x1081('0x80'),_0x33af4a[_0x1081('0x64')]['id'],_0x33af4a[_0x1081('0x64')][_0x1081('0x3a')],_0x33af4a[_0x1081('0x64')][_0x1081('0x69')],_0x216f05[_0x1081('0x6a')]['id'],_0x33af4a[_0x1081('0x5e')]?JSON[_0x1081('0x81')](_0x33af4a[_0x1081('0x5e')]):_0x1081('0x82'));return respondWithRpcPromise(_0x1081('0x83'),_0x1081('0x84'),_0x216f05);}return null;})[_0x1081('0x24')](function(_0x205d98){var _0x122269=_0x1081('0x6d')+_0x205d98[_0x1081('0x2a')][_0x1081('0x6e')];return db[_0x1081('0x85')][_0x1081('0x42')](_0x122269,{'type':db[_0x1081('0x6f')][_0x1081('0x70')]['SELECT'],'raw':!![]})[_0x1081('0x24')](function(_0x154421){return _0x154421;});})['then'](function(_0x46de78){if(_0x46de78){_0x216f05[_0x1081('0x2a')][_0x1081('0x86')]=_0x46de78[0x0];if(!_0x33af4a[_0x1081('0x5e')][_0x1081('0x63')])return;return db[_0x1081('0x72')][_0x1081('0x59')]({'where':{'id':_0x33af4a['body'][_0x1081('0x63')],'role':_0x1081('0x73')},'attributes':['id',_0x1081('0x3a'),_0x1081('0x74'),_0x1081('0x75'),_0x1081('0x76')],'raw':!![]});}return null;})['then'](function(_0x3419e4){if(!_0x3419e4)return null;_0x216f05['message']['agent']=_0x3419e4;return _0x216f05;})['then'](function(_0x4c78cd){if(_0x4c78cd){_0x4c78cd[_0x1081('0x2a')][_0x1081('0x78')]=util[_0x1081('0x61')](_0x1081('0x79'),_0x33af4a[_0x1081('0x64')][_0x1081('0x3a')]);_0x4c78cd[_0x1081('0x2a')][_0x1081('0x7a')]=_0x216f05[_0x1081('0x7a')];_0x4c78cd[_0x1081('0x2a')]['motionChannel']=_0x216f05['channel'];_0x4c78cd[_0x1081('0x2a')][_0x1081('0x7c')]=_0x1081('0x36');respondWithRpcPromise(_0x1081('0x7d'),_0x1081('0x7d'),{'event':_0x1081('0x87'),'message':_0x4c78cd[_0x1081('0x2a')]},client9002);return _0x216f05;}return null;})[_0x1081('0x24')](respondWithResult(_0x4abf71,null))[_0x1081('0x2c')](handleError(_0x4abf71,null));};exports[_0x1081('0x2e')]=function(_0x29d68a,_0x111a59,_0x4ea7ab){if(_0x29d68a[_0x1081('0x5e')]['id']){delete _0x29d68a[_0x1081('0x5e')]['id'];}var _0x28a9e4;return db['WhatsappMessage'][_0x1081('0x59')]({'where':{'id':_0x29d68a['params']['id']}})['then'](handleEntityNotFound(_0x111a59,null))[_0x1081('0x24')](function(_0x77d0cc){if(_0x77d0cc){_0x28a9e4=_0x77d0cc;return db[_0x1081('0x88')]['find']({'where':{'id':_0x77d0cc[_0x1081('0x89')]}});}})[_0x1081('0x24')](handleEntityNotFound(_0x111a59,null))['then'](function(_0x13bd8c){if(_0x13bd8c){logger[_0x1081('0x27')](_0x1081('0x8a'),_0x1081('0x2e'),_0x1081('0x8b'),_0x13bd8c['type'],util[_0x1081('0x8c')](_0x29d68a['body'],{'showHidden':![],'depth':null}));switch(_0x13bd8c[_0x1081('0x40')]){case _0x1081('0x8d'):if(_0x29d68a[_0x1081('0x5e')]['MessageSid']&&_0x29d68a[_0x1081('0x5e')]['MessageSid']===_0x28a9e4[_0x1081('0x8e')]&&_0x29d68a[_0x1081('0x5e')][_0x1081('0x8f')]&&_0x29d68a[_0x1081('0x5e')][_0x1081('0x8f')]==='read'){return _0x28a9e4[_0x1081('0x38')]({'read':!![]});}else{logger[_0x1081('0x29')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x1081('0x8d'),util['inspect'](_0x29d68a[_0x1081('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x28a9e4;}})['then'](respondWithResult(_0x111a59,null))[_0x1081('0x2c')](handleError(_0x111a59,null));}; \ No newline at end of file +var _0x2bc6=['./whatsappMessage.socket','register','client','http','request','then','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','WhatsappMessage,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','create','body','update','describe','whatsapp-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','role','interaction','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','channel','motionChannel','EventManager','whatsapp','RejectMessage','rejectMessage','email','SIP/%s','event','rejectmessage','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost'];(function(_0x4fa369,_0x2a765c){var _0x53b342=function(_0x3a9a3f){while(--_0x3a9a3f){_0x4fa369['push'](_0x4fa369['shift']());}};_0x53b342(++_0x2a765c);}(_0x2bc6,0xf6));var _0x62bc=function(_0x3e2d88,_0x1ade62){_0x3e2d88=_0x3e2d88-0x0;var _0x5fa153=_0x2bc6[_0x3e2d88];return _0x5fa153;};'use strict';var emlformat=require(_0x62bc('0x0'));var rimraf=require(_0x62bc('0x1'));var zipdir=require(_0x62bc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x62bc('0x3'));var moment=require(_0x62bc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x62bc('0x5'));var util=require(_0x62bc('0x6'));var path=require(_0x62bc('0x7'));var sox=require(_0x62bc('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x62bc('0x9'));var _=require(_0x62bc('0xa'));var squel=require(_0x62bc('0xb'));var crypto=require('crypto');var jsforce=require(_0x62bc('0xc'));var deskjs=require(_0x62bc('0xd'));var toCsv=require(_0x62bc('0xe'));var querystring=require('querystring');var Papa=require(_0x62bc('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x62bc('0x10'));var logger=require(_0x62bc('0x11'))(_0x62bc('0x12'));var utils=require('../../config/utils');var config=require(_0x62bc('0x13'));var licenseUtil=require(_0x62bc('0x14'));var db=require('../../mysqldb')['db'];config[_0x62bc('0x15')]=_[_0x62bc('0x16')](config[_0x62bc('0x15')],{'host':_0x62bc('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62bc('0x15')]));require(_0x62bc('0x18'))[_0x62bc('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x62bc('0x1a')][_0x62bc('0x1b')]({'port':0x232c});var client9002=jayson[_0x62bc('0x1a')][_0x62bc('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x340f7a,_0x1978a5,_0x5a4f8a,_0xb58522){return new BPromise(function(_0x3ebf53,_0x275728){var _0x8bbc60=_0xb58522||client;return _0x8bbc60[_0x62bc('0x1c')](_0x340f7a,_0x5a4f8a)[_0x62bc('0x1d')](function(_0x3bcd23){logger[_0x62bc('0x1e')]('WhatsappMessage,\x20%s,\x20%s',_0x1978a5,_0x62bc('0x1f'));logger['debug'](_0x62bc('0x20'),_0x1978a5,'request\x20sent',JSON['stringify'](_0x3bcd23));if(_0x3bcd23['error']){if(_0x3bcd23['error']['code']===0x1f4){logger[_0x62bc('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x1978a5,_0x3bcd23[_0x62bc('0x21')]['message']);return _0x275728(_0x3bcd23[_0x62bc('0x21')][_0x62bc('0x22')]);}logger[_0x62bc('0x21')](_0x62bc('0x23'),_0x1978a5,_0x3bcd23['error'][_0x62bc('0x22')]);return _0x3ebf53(_0x3bcd23['error'][_0x62bc('0x22')]);}else{logger[_0x62bc('0x1e')](_0x62bc('0x23'),_0x1978a5,'request\x20sent');_0x3ebf53(_0x3bcd23[_0x62bc('0x24')]['message']);}})[_0x62bc('0x25')](function(_0x30d61d){logger[_0x62bc('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x1978a5,_0x30d61d);_0x275728(_0x30d61d);});});}function respondWithStatusCode(_0x3eaa77,_0x5a697b){_0x5a697b=_0x5a697b||0xcc;return function(_0x3f4a9b){if(_0x3f4a9b){return _0x3eaa77[_0x62bc('0x26')](_0x5a697b);}return _0x3eaa77[_0x62bc('0x27')](_0x5a697b)[_0x62bc('0x28')]();};}function respondWithResult(_0x380148,_0x2e76e2){_0x2e76e2=_0x2e76e2||0xc8;return function(_0x496d91){if(_0x496d91){return _0x380148[_0x62bc('0x27')](_0x2e76e2)[_0x62bc('0x29')](_0x496d91);}};}function respondWithFilteredResult(_0x54516d,_0x22cac3){return function(_0x3cb4ef){if(_0x3cb4ef){var _0x423ee5=typeof _0x22cac3[_0x62bc('0x2a')]===_0x62bc('0x2b')&&typeof _0x22cac3[_0x62bc('0x2c')]===_0x62bc('0x2b');var _0x4135dc=_0x3cb4ef[_0x62bc('0x2d')];var _0x4aefa1=_0x423ee5?0x0:_0x22cac3['offset'];var _0x2e77d8=_0x423ee5?_0x3cb4ef[_0x62bc('0x2d')]:_0x22cac3[_0x62bc('0x2a')]+_0x22cac3[_0x62bc('0x2c')];var _0x4928d6;if(_0x2e77d8>=_0x4135dc){_0x2e77d8=_0x4135dc;_0x4928d6=0xc8;}else{_0x4928d6=0xce;}_0x54516d['status'](_0x4928d6);return _0x54516d[_0x62bc('0x2e')](_0x62bc('0x2f'),_0x4aefa1+'-'+_0x2e77d8+'/'+_0x4135dc)[_0x62bc('0x29')](_0x3cb4ef);}return null;};}function patchUpdates(_0x55b62){return function(_0x4de4a7){try{jsonpatch[_0x62bc('0x30')](_0x4de4a7,_0x55b62,!![]);}catch(_0x37edf6){return BPromise[_0x62bc('0x31')](_0x37edf6);}return _0x4de4a7[_0x62bc('0x32')]();};}function saveUpdates(_0x57cbf9,_0x7293c){return function(_0x3a32d9){if(_0x3a32d9){return _0x3a32d9['update'](_0x57cbf9)[_0x62bc('0x1d')](function(_0x44cecb){return _0x44cecb;});}return null;};}function removeEntity(_0x165d95,_0x307283){return function(_0x33ae12){if(_0x33ae12){return _0x33ae12[_0x62bc('0x33')]()['then'](function(){_0x165d95[_0x62bc('0x27')](0xcc)[_0x62bc('0x28')]();});}};}function handleEntityNotFound(_0x244a3e,_0x42980c){return function(_0x3ecac1){if(!_0x3ecac1){_0x244a3e[_0x62bc('0x26')](0x194);}return _0x3ecac1;};}function handleError(_0x337c21,_0xeb4d24){_0xeb4d24=_0xeb4d24||0x1f4;return function(_0x318735){logger[_0x62bc('0x21')](_0x318735[_0x62bc('0x34')]);if(_0x318735[_0x62bc('0x35')]){delete _0x318735[_0x62bc('0x35')];}_0x337c21[_0x62bc('0x27')](_0xeb4d24)[_0x62bc('0x36')](_0x318735);};}exports[_0x62bc('0x37')]=function(_0xe4738e,_0x577ef3){var _0x392a1d={},_0x3a8540={},_0x5d8c88={'count':0x0,'rows':[]};var _0x5711a0=_[_0x62bc('0x38')](db[_0x62bc('0x39')][_0x62bc('0x3a')],function(_0x77e41c){return{'name':_0x77e41c[_0x62bc('0x3b')],'type':_0x77e41c[_0x62bc('0x3c')]['key']};});_0x3a8540[_0x62bc('0x3d')]=_[_0x62bc('0x38')](_0x5711a0,_0x62bc('0x35'));_0x3a8540['query']=_[_0x62bc('0x3e')](_0xe4738e[_0x62bc('0x3f')]);_0x3a8540[_0x62bc('0x40')]=_[_0x62bc('0x41')](_0x3a8540[_0x62bc('0x3d')],_0x3a8540[_0x62bc('0x3f')]);_0x392a1d[_0x62bc('0x42')]=_['intersection'](_0x3a8540[_0x62bc('0x3d')],qs[_0x62bc('0x43')](_0xe4738e[_0x62bc('0x3f')][_0x62bc('0x43')]));_0x392a1d['attributes']=_0x392a1d[_0x62bc('0x42')]['length']?_0x392a1d[_0x62bc('0x42')]:_0x3a8540['model'];if(!_0xe4738e[_0x62bc('0x3f')][_0x62bc('0x44')](_0x62bc('0x45'))){_0x392a1d['limit']=qs['limit'](_0xe4738e[_0x62bc('0x3f')][_0x62bc('0x2c')]);_0x392a1d[_0x62bc('0x2a')]=qs[_0x62bc('0x2a')](_0xe4738e[_0x62bc('0x3f')][_0x62bc('0x2a')]);}_0x392a1d[_0x62bc('0x46')]=qs[_0x62bc('0x47')](_0xe4738e[_0x62bc('0x3f')][_0x62bc('0x47')]);_0x392a1d[_0x62bc('0x48')]=qs['filters'](_[_0x62bc('0x49')](_0xe4738e[_0x62bc('0x3f')],_0x3a8540[_0x62bc('0x40')]),_0x5711a0);if(_0xe4738e[_0x62bc('0x3f')][_0x62bc('0x4a')]){_0x392a1d[_0x62bc('0x48')]=_[_0x62bc('0x4b')](_0x392a1d[_0x62bc('0x48')],{'$or':_[_0x62bc('0x38')](_0x5711a0,function(_0x2ef4c6){if(_0x2ef4c6[_0x62bc('0x3c')]!==_0x62bc('0x4c')){var _0x481dc8={};_0x481dc8[_0x2ef4c6[_0x62bc('0x35')]]={'$like':'%'+_0xe4738e[_0x62bc('0x3f')][_0x62bc('0x4a')]+'%'};return _0x481dc8;}})});}_0x392a1d=_[_0x62bc('0x4b')]({},_0x392a1d,_0xe4738e['options']);var _0x3bc591={'where':_0x392a1d[_0x62bc('0x48')]};return db[_0x62bc('0x39')][_0x62bc('0x2d')](_0x3bc591)['then'](function(_0x4c2a7d){_0x5d8c88[_0x62bc('0x2d')]=_0x4c2a7d;if(_0xe4738e[_0x62bc('0x3f')]['includeAll']){_0x392a1d[_0x62bc('0x4d')]=[{'all':!![]}];}return db[_0x62bc('0x39')][_0x62bc('0x4e')](_0x392a1d);})[_0x62bc('0x1d')](function(_0x11b45d){_0x5d8c88['rows']=_0x11b45d;return _0x5d8c88;})[_0x62bc('0x1d')](respondWithFilteredResult(_0x577ef3,_0x392a1d))[_0x62bc('0x25')](handleError(_0x577ef3,null));};exports[_0x62bc('0x4f')]=function(_0x51ff62,_0x2bc05d){var _0x5c7afb={'raw':!![],'where':{'id':_0x51ff62[_0x62bc('0x50')]['id']}},_0x31f358={};_0x31f358[_0x62bc('0x3d')]=_[_0x62bc('0x3e')](db[_0x62bc('0x39')][_0x62bc('0x3a')]);_0x31f358['query']=_[_0x62bc('0x3e')](_0x51ff62[_0x62bc('0x3f')]);_0x31f358['filters']=_[_0x62bc('0x41')](_0x31f358[_0x62bc('0x3d')],_0x31f358[_0x62bc('0x3f')]);_0x5c7afb[_0x62bc('0x42')]=_[_0x62bc('0x41')](_0x31f358[_0x62bc('0x3d')],qs[_0x62bc('0x43')](_0x51ff62[_0x62bc('0x3f')]['fields']));_0x5c7afb[_0x62bc('0x42')]=_0x5c7afb[_0x62bc('0x42')]['length']?_0x5c7afb[_0x62bc('0x42')]:_0x31f358[_0x62bc('0x3d')];if(_0x51ff62[_0x62bc('0x3f')][_0x62bc('0x51')]){_0x5c7afb['include']=[{'all':!![]}];}_0x5c7afb=_[_0x62bc('0x4b')]({},_0x5c7afb,_0x51ff62[_0x62bc('0x52')]);return db[_0x62bc('0x39')][_0x62bc('0x53')](_0x5c7afb)['then'](handleEntityNotFound(_0x2bc05d,null))[_0x62bc('0x1d')](respondWithResult(_0x2bc05d,null))[_0x62bc('0x25')](handleError(_0x2bc05d,null));};exports[_0x62bc('0x54')]=function(_0x1ec495,_0x3bafa2){return db[_0x62bc('0x39')]['create'](_0x1ec495[_0x62bc('0x55')],{})[_0x62bc('0x1d')](respondWithResult(_0x3bafa2,0xc9))[_0x62bc('0x25')](handleError(_0x3bafa2,null));};exports[_0x62bc('0x56')]=function(_0xac0d95,_0x3d9bee){if(_0xac0d95['body']['id']){delete _0xac0d95['body']['id'];}return db['WhatsappMessage'][_0x62bc('0x53')]({'where':{'id':_0xac0d95[_0x62bc('0x50')]['id']}})[_0x62bc('0x1d')](handleEntityNotFound(_0x3d9bee,null))['then'](saveUpdates(_0xac0d95[_0x62bc('0x55')],null))['then'](respondWithResult(_0x3d9bee,null))[_0x62bc('0x25')](handleError(_0x3d9bee,null));};exports[_0x62bc('0x33')]=function(_0x4046d1,_0x107ce1){return db[_0x62bc('0x39')][_0x62bc('0x53')]({'where':{'id':_0x4046d1[_0x62bc('0x50')]['id']}})[_0x62bc('0x1d')](handleEntityNotFound(_0x107ce1,null))[_0x62bc('0x1d')](removeEntity(_0x107ce1,null))[_0x62bc('0x25')](handleError(_0x107ce1,null));};exports[_0x62bc('0x57')]=function(_0x1afa39,_0x5de1aa){return db[_0x62bc('0x39')]['describe']()['then'](respondWithResult(_0x5de1aa,null))[_0x62bc('0x25')](handleError(_0x5de1aa,null));};var interaction_log=require('../../config/logger')(_0x62bc('0x58'));exports[_0x62bc('0x59')]=function(_0x185158,_0x1fa666,_0x330036){var _0x70ed0d={'agent':{},'channel':'whatsapp'};if(_0x185158[_0x62bc('0x55')]['id']){delete _0x185158['body']['id'];}_0x185158[_0x62bc('0x55')][_0x62bc('0x5a')]=!![];_0x185158[_0x62bc('0x55')][_0x62bc('0x5b')]=moment()[_0x62bc('0x5c')](_0x62bc('0x5d'));_0x185158[_0x62bc('0x55')][_0x62bc('0x5e')]=_0x185158[_0x62bc('0x55')]['UserId']||_0x185158[_0x62bc('0x5f')]['id'];_0x70ed0d[_0x62bc('0x60')]['id']=_0x185158[_0x62bc('0x55')][_0x62bc('0x5e')];return db['WhatsappMessage'][_0x62bc('0x53')]({'where':{'id':_0x185158['params']['id'],'UserId':null}})[_0x62bc('0x1d')](handleEntityNotFound(_0x1fa666,null))['then'](saveUpdates(_0x185158[_0x62bc('0x55')],null))[_0x62bc('0x1d')](function(_0x2354b4){if(_0x2354b4){_0x70ed0d['message']=_0x2354b4[_0x62bc('0x61')]({'plain':!![]});return db[_0x62bc('0x62')][_0x62bc('0x53')]({'where':{'id':_0x2354b4[_0x62bc('0x63')]}});}return null;})[_0x62bc('0x1d')](handleEntityNotFound(_0x1fa666,null))['then'](function(_0xe0c761){if(_0xe0c761){return _0xe0c761['update']({'UserId':_0x185158[_0x62bc('0x55')][_0x62bc('0x5e')],'read1stAt':_['isNil'](_0xe0c761[_0x62bc('0x64')])?moment()[_0x62bc('0x5c')](_0x62bc('0x5d')):undefined});}return null;})[_0x62bc('0x1d')](function(_0x209b32){if(_0x209b32){_0x70ed0d['interaction']=_0x209b32[_0x62bc('0x61')]({'plain':!![]});interaction_log[_0x62bc('0x1e')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x185158['user']['id'],_0x185158['user'][_0x62bc('0x35')],_0x185158['user'][_0x62bc('0x65')],_0x70ed0d[_0x62bc('0x66')]['id'],_0x185158[_0x62bc('0x55')]?JSON[_0x62bc('0x67')](_0x185158[_0x62bc('0x55')]):'null');return respondWithRpcPromise('AcceptMessage',_0x62bc('0x68'),_0x70ed0d);}return null;})[_0x62bc('0x1d')](function(_0x2591f7){var _0x2ae6a9=_0x62bc('0x69')+_0x2591f7[_0x62bc('0x22')][_0x62bc('0x6a')];return db[_0x62bc('0x6b')][_0x62bc('0x3f')](_0x2ae6a9,{'type':db[_0x62bc('0x6c')][_0x62bc('0x6d')][_0x62bc('0x6e')],'raw':!![]})[_0x62bc('0x1d')](function(_0x1d9b23){return _0x1d9b23;});})[_0x62bc('0x1d')](function(_0x456d7){if(_0x456d7){_0x70ed0d[_0x62bc('0x22')][_0x62bc('0x6f')]=_0x456d7[0x0];if(!_0x185158[_0x62bc('0x55')][_0x62bc('0x5e')])return;return db[_0x62bc('0x70')][_0x62bc('0x53')]({'where':{'id':_0x185158['body'][_0x62bc('0x5e')],'role':_0x62bc('0x60')},'attributes':['id',_0x62bc('0x35'),_0x62bc('0x71'),'email',_0x62bc('0x72')],'raw':!![]});}return null;})['then'](function(_0x5add91){if(!_0x5add91)return null;_0x70ed0d[_0x62bc('0x22')]['agent']=_0x5add91;return _0x70ed0d;})[_0x62bc('0x1d')](function(_0x535410){if(_0x535410){if(_0x185158[_0x62bc('0x55')][_0x62bc('0x73')]){_0x70ed0d['message'][_0x62bc('0x74')]=util[_0x62bc('0x5c')]('SIP/%s',_0x185158[_0x62bc('0x5f')][_0x62bc('0x35')]);_0x70ed0d[_0x62bc('0x22')][_0x62bc('0x75')]=_0x70ed0d['channel'];_0x70ed0d[_0x62bc('0x22')][_0x62bc('0x76')]=_0x70ed0d[_0x62bc('0x75')];_0x70ed0d['message']['event']=_0x62bc('0x59');return respondWithRpcPromise(_0x62bc('0x77'),_0x62bc('0x77'),{'event':'acceptmessage','message':_0x70ed0d[_0x62bc('0x22')]},client9002)[_0x62bc('0x1d')](function(){return _0x70ed0d;});}return _0x70ed0d;}return null;})['then'](respondWithResult(_0x1fa666,null))[_0x62bc('0x25')](handleError(_0x1fa666,null));};var interaction_log=require(_0x62bc('0x11'))(_0x62bc('0x58'));exports[_0x62bc('0x31')]=function(_0x4b65f5,_0x5d41e0,_0xb99a00){var _0x5495ea={'agent':{},'channel':_0x62bc('0x78')};if(_0x4b65f5[_0x62bc('0x55')]['id']){delete _0x4b65f5['body']['id'];}_0x4b65f5[_0x62bc('0x55')][_0x62bc('0x5e')]=_0x4b65f5['body'][_0x62bc('0x5e')]||_0x4b65f5[_0x62bc('0x5f')]['id'];_0x5495ea[_0x62bc('0x60')]['id']=_0x4b65f5['body'][_0x62bc('0x5e')];return db[_0x62bc('0x39')][_0x62bc('0x53')]({'where':{'id':_0x4b65f5[_0x62bc('0x50')]['id'],'UserId':null}})[_0x62bc('0x1d')](handleEntityNotFound(_0x5d41e0,null))[_0x62bc('0x1d')](function(_0x392772){if(_0x392772){_0x5495ea['message']=_0x392772[_0x62bc('0x61')]({'plain':!![]});return db[_0x62bc('0x62')][_0x62bc('0x53')]({'where':{'id':_0x392772[_0x62bc('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x5d41e0,null))['then'](function(_0x5a2bd6){if(_0x5a2bd6){_0x5495ea[_0x62bc('0x66')]=_0x5a2bd6[_0x62bc('0x61')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4b65f5[_0x62bc('0x5f')]['id'],_0x4b65f5[_0x62bc('0x5f')][_0x62bc('0x35')],_0x4b65f5[_0x62bc('0x5f')][_0x62bc('0x65')],_0x5495ea['interaction']['id'],_0x4b65f5['body']?JSON[_0x62bc('0x67')](_0x4b65f5[_0x62bc('0x55')]):'null');return respondWithRpcPromise(_0x62bc('0x79'),_0x62bc('0x7a'),_0x5495ea);}return null;})['then'](function(_0x2c6290){var _0x249da1=_0x62bc('0x69')+_0x2c6290[_0x62bc('0x22')][_0x62bc('0x6a')];return db[_0x62bc('0x6b')][_0x62bc('0x3f')](_0x249da1,{'type':db[_0x62bc('0x6c')][_0x62bc('0x6d')][_0x62bc('0x6e')],'raw':!![]})[_0x62bc('0x1d')](function(_0x4b59fc){return _0x4b59fc;});})[_0x62bc('0x1d')](function(_0x143e77){if(_0x143e77){_0x5495ea[_0x62bc('0x22')][_0x62bc('0x6f')]=_0x143e77[0x0];if(!_0x4b65f5[_0x62bc('0x55')][_0x62bc('0x5e')])return;return db['User'][_0x62bc('0x53')]({'where':{'id':_0x4b65f5[_0x62bc('0x55')][_0x62bc('0x5e')],'role':_0x62bc('0x60')},'attributes':['id','name',_0x62bc('0x71'),_0x62bc('0x7b'),'internal'],'raw':!![]});}return null;})[_0x62bc('0x1d')](function(_0x4ee35e){if(!_0x4ee35e)return null;_0x5495ea[_0x62bc('0x22')][_0x62bc('0x60')]=_0x4ee35e;return _0x5495ea;})[_0x62bc('0x1d')](function(_0x51d946){if(_0x51d946){_0x51d946['message']['interface']=util[_0x62bc('0x5c')](_0x62bc('0x7c'),_0x4b65f5['user']['name']);_0x51d946['message'][_0x62bc('0x75')]=_0x5495ea['channel'];_0x51d946['message']['motionChannel']=_0x5495ea['channel'];_0x51d946[_0x62bc('0x22')][_0x62bc('0x7d')]=_0x62bc('0x31');respondWithRpcPromise(_0x62bc('0x77'),_0x62bc('0x77'),{'event':_0x62bc('0x7e'),'message':_0x51d946['message']},client9002);return _0x5495ea;}return null;})[_0x62bc('0x1d')](respondWithResult(_0x5d41e0,null))[_0x62bc('0x25')](handleError(_0x5d41e0,null));};exports[_0x62bc('0x27')]=function(_0x18c33d,_0x1ce6cf,_0xc6c405){if(_0x18c33d[_0x62bc('0x55')]['id']){delete _0x18c33d['body']['id'];}var _0x43ec65;return db[_0x62bc('0x39')][_0x62bc('0x53')]({'where':{'id':_0x18c33d[_0x62bc('0x50')]['id']}})[_0x62bc('0x1d')](handleEntityNotFound(_0x1ce6cf,null))['then'](function(_0x147b9c){if(_0x147b9c){_0x43ec65=_0x147b9c;return db['WhatsappAccount'][_0x62bc('0x53')]({'where':{'id':_0x147b9c['WhatsappAccountId']}});}})[_0x62bc('0x1d')](handleEntityNotFound(_0x1ce6cf,null))[_0x62bc('0x1d')](function(_0x20e607){if(_0x20e607){logger[_0x62bc('0x7f')](_0x62bc('0x80'),'status','received\x20delivery\x20report\x20from',_0x20e607['type'],util[_0x62bc('0x81')](_0x18c33d[_0x62bc('0x55')],{'showHidden':![],'depth':null}));switch(_0x20e607['type']){case _0x62bc('0x82'):if(_0x18c33d[_0x62bc('0x55')][_0x62bc('0x83')]&&_0x18c33d[_0x62bc('0x55')][_0x62bc('0x83')]===_0x43ec65[_0x62bc('0x84')]&&_0x18c33d[_0x62bc('0x55')][_0x62bc('0x85')]&&_0x18c33d[_0x62bc('0x55')]['MessageStatus']===_0x62bc('0x5a')){return _0x43ec65[_0x62bc('0x56')]({'read':!![]});}else{logger['error'](_0x62bc('0x86'),_0x62bc('0x27'),_0x62bc('0x82'),util[_0x62bc('0x81')](_0x18c33d[_0x62bc('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x43ec65;}})[_0x62bc('0x1d')](respondWithResult(_0x1ce6cf,null))[_0x62bc('0x25')](handleError(_0x1ce6cf,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 97f0302..d2e34ba 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 _0x065e=['emit','hasOwnProperty','hook','events','save','update','remove'];(function(_0x317cd6,_0x32efb1){var _0x764385=function(_0x3beeb2){while(--_0x3beeb2){_0x317cd6['push'](_0x317cd6['shift']());}};_0x764385(++_0x32efb1);}(_0x065e,0x1a7));var _0xe065=function(_0x4afc65,_0x1f23f3){_0x4afc65=_0x4afc65-0x0;var _0xca056=_0x065e[_0x4afc65];return _0xca056;};'use strict';var EventEmitter=require(_0xe065('0x0'));var WhatsappMessage=require('../../mysqldb')['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe065('0x1'),'afterUpdate':_0xe065('0x2'),'afterDestroy':_0xe065('0x3')};function emitEvent(_0x4d35bf){return function(_0x4964fa,_0x4610a3,_0x2f90aa){WhatsappMessageEvents['emit'](_0x4d35bf+':'+_0x4964fa['id'],_0x4964fa);WhatsappMessageEvents[_0xe065('0x4')](_0x4d35bf,_0x4964fa);_0x2f90aa(null);};}for(var e in events){if(events[_0xe065('0x5')](e)){var event=events[e];WhatsappMessage[_0xe065('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x9354=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','save'];(function(_0x339be6,_0x4b0dd1){var _0x559a0b=function(_0x256263){while(--_0x256263){_0x339be6['push'](_0x339be6['shift']());}};_0x559a0b(++_0x4b0dd1);}(_0x9354,0x96));var _0x4935=function(_0x553502,_0x4d2c0c){_0x553502=_0x553502-0x0;var _0x246c37=_0x9354[_0x553502];return _0x246c37;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x4935('0x0'))['db'][_0x4935('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4935('0x2'),'afterUpdate':_0x4935('0x3'),'afterDestroy':_0x4935('0x4')};function emitEvent(_0x280bbc){return function(_0x5327fc,_0x46c7f9,_0x2d509b){WhatsappMessageEvents[_0x4935('0x5')](_0x280bbc+':'+_0x5327fc['id'],_0x5327fc);WhatsappMessageEvents[_0x4935('0x5')](_0x280bbc,_0x5327fc);_0x2d509b(null);};}for(var e in events){if(events[_0x4935('0x6')](e)){var event=events[e];WhatsappMessage[_0x4935('0x7')](e,emitEvent(event));}}module[_0x4935('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 15c0f3e..6590fc2 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 _0xd25f=['./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','FULLTEXT','get','toLowerCase','direction','out','secret','isNil','UserId','findOne','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','then','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','token','sid','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4_unicode_ci','lodash','util','api','request-promise','rimraf','../../config/environment'];(function(_0x45b6ea,_0x27172f){var _0x41ae23=function(_0x40acf0){while(--_0x40acf0){_0x45b6ea['push'](_0x45b6ea['shift']());}};_0x41ae23(++_0x27172f);}(_0xd25f,0x84));var _0xfd25=function(_0x20fb02,_0x96c029){_0x20fb02=_0x20fb02-0x0;var _0x24a33e=_0xd25f[_0x20fb02];return _0x24a33e;};'use strict';var _=require(_0xfd25('0x0'));var util=require(_0xfd25('0x1'));var logger=require('../../config/logger')(_0xfd25('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfd25('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd25('0x4'));var config=require(_0xfd25('0x5'));var attributes=require(_0xfd25('0x6'));module[_0xfd25('0x7')]=function(_0x2d80c5,_0x4bd3d7){return _0x2d80c5[_0xfd25('0x8')]('WhatsappMessage',attributes,{'tableName':_0xfd25('0x9'),'paranoid':![],'indexes':[{'name':_0xfd25('0xa'),'fields':[_0xfd25('0xa')]},{'name':'fti_whatsapp_messages','fields':['body'],'type':_0xfd25('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x26cd9d,_0x4bfd94,_0x3b1c95){var _0x27ef0b=_0x2d80c5['models'];var _0x4885ac=_0x26cd9d[_0xfd25('0xc')]({'plain':!![]});if(_0x4885ac['direction'][_0xfd25('0xd')]()==='in'||_0x4885ac[_0xfd25('0xe')]['toLowerCase']()===_0xfd25('0xf')&&!_0x4885ac[_0xfd25('0x10')]&&!_[_0xfd25('0x11')](_0x4885ac[_0xfd25('0x12')])){_0x27ef0b['WhatsappInteraction'][_0xfd25('0x13')]({'where':{'id':_0x4885ac['WhatsappInteractionId']}})['then'](function(_0x12be26){if(_0x12be26){_0x12be26[_0xfd25('0x14')]({'lastMsgAt':_0x4885ac[_0xfd25('0x15')],'lastMsgDirection':_0x4885ac['direction']['toLowerCase']()});}})[_0xfd25('0x16')](function(_0x487400){console[_0xfd25('0x17')](_0x487400);});}if(_0x4885ac[_0xfd25('0xe')]===_0xfd25('0xf')&&!_0x4885ac[_0xfd25('0x10')]){var _0x4c483e;_0x27ef0b[_0xfd25('0x18')][_0xfd25('0x19')]({'where':{'id':_0x4885ac[_0xfd25('0x1a')]},'raw':!![]})[_0xfd25('0x1b')](function(_0xe921f4){_0x4c483e=_0xe921f4;if(_0x4c483e&&_0x4c483e['type']){switch(_0x4c483e['type']){case _0xfd25('0x1c'):var _0x468b9a=require(_0xfd25('0x1c'));if(_0x4c483e[_0xfd25('0x1d')]&&_0x4c483e[_0xfd25('0x1e')]&&_0x4c483e[_0xfd25('0x1f')]){var _0x304c53=new _0x468b9a(_0x4c483e['accountSid'],_0x4c483e[_0xfd25('0x1e')]);_0x304c53[_0xfd25('0x20')][_0xfd25('0x21')]({'body':_0x4885ac[_0xfd25('0x22')],'to':_0xfd25('0x23')+_0x4885ac[_0xfd25('0x1f')],'from':'whatsapp:'+_0x4c483e[_0xfd25('0x1f')],'statusCallback':_0x4c483e[_0xfd25('0x24')]+_0xfd25('0x25')+_0x4885ac['id']+'/status?token='+_0x4c483e[_0xfd25('0x26')]})[_0xfd25('0x1b')](function(_0x2fd767){if(_0x2fd767['sid']){return _0x26cd9d['update']({'messageId':_0x2fd767[_0xfd25('0x27')]});}})[_0xfd25('0x16')](function(_0x28463e){logger[_0xfd25('0x17')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xfd25('0x28'),_0xfd25('0x1c'),util[_0xfd25('0x29')](_0x28463e,{'showHidden':![],'depth':null}));});}else{logger[_0xfd25('0x17')](_0xfd25('0x2a'),'afterCreate',_0xfd25('0x1c'),_0xfd25('0x2b'));}break;}}})[_0xfd25('0x2c')](function(){_0x3b1c95();});}else{_0x3b1c95();}}},'charset':'utf8mb4','collate':_0xfd25('0x2d')});}; \ No newline at end of file +var _0x4ee2=['/status?token=','sid','error','inspect','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','WhatsappInteractionId','then','update','createdAt','catch','WhatsappAccount','WhatsappAccountId','type','twilio','phone','accountSid','messages','create','whatsapp:','remote'];(function(_0x4a5635,_0x443b90){var _0x18d602=function(_0x1ddd38){while(--_0x1ddd38){_0x4a5635['push'](_0x4a5635['shift']());}};_0x18d602(++_0x443b90);}(_0x4ee2,0x140));var _0x24ee=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4ee2[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x24ee('0x0'));var util=require(_0x24ee('0x1'));var logger=require(_0x24ee('0x2'))(_0x24ee('0x3'));var moment=require(_0x24ee('0x4'));var BPromise=require(_0x24ee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24ee('0x6'));var rimraf=require(_0x24ee('0x7'));var config=require(_0x24ee('0x8'));var attributes=require(_0x24ee('0x9'));module[_0x24ee('0xa')]=function(_0x5ba1ed,_0x419249){return _0x5ba1ed['define']('WhatsappMessage',attributes,{'tableName':_0x24ee('0xb'),'paranoid':![],'indexes':[{'name':_0x24ee('0xc'),'fields':[_0x24ee('0xc')]},{'name':_0x24ee('0xd'),'fields':[_0x24ee('0xe')],'type':_0x24ee('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x198231,_0x3e5359,_0x2f130b){var _0x3a26b0=_0x5ba1ed[_0x24ee('0x10')];var _0x1caffd=_0x198231[_0x24ee('0x11')]({'plain':!![]});if(_0x1caffd[_0x24ee('0x12')]['toLowerCase']()==='in'||_0x1caffd[_0x24ee('0x12')][_0x24ee('0x13')]()===_0x24ee('0x14')&&!_0x1caffd[_0x24ee('0x15')]&&!_[_0x24ee('0x16')](_0x1caffd[_0x24ee('0x17')])){_0x3a26b0['WhatsappInteraction'][_0x24ee('0x18')]({'where':{'id':_0x1caffd[_0x24ee('0x19')]}})[_0x24ee('0x1a')](function(_0x52a58){if(_0x52a58){_0x52a58[_0x24ee('0x1b')]({'lastMsgAt':_0x1caffd[_0x24ee('0x1c')],'lastMsgDirection':_0x1caffd[_0x24ee('0x12')]['toLowerCase']()});}})[_0x24ee('0x1d')](function(_0x28784d){console['error'](_0x28784d);});}if(_0x1caffd[_0x24ee('0x12')]===_0x24ee('0x14')&&!_0x1caffd[_0x24ee('0x15')]){var _0xf8097e;_0x3a26b0[_0x24ee('0x1e')]['find']({'where':{'id':_0x1caffd[_0x24ee('0x1f')]},'raw':!![]})['then'](function(_0x41fa43){_0xf8097e=_0x41fa43;if(_0xf8097e&&_0xf8097e[_0x24ee('0x20')]){switch(_0xf8097e['type']){case _0x24ee('0x21'):var _0x32adf7=require('twilio');if(_0xf8097e['accountSid']&&_0xf8097e['authToken']&&_0xf8097e[_0x24ee('0x22')]){var _0x58381b=new _0x32adf7(_0xf8097e[_0x24ee('0x23')],_0xf8097e['authToken']);_0x58381b[_0x24ee('0x24')][_0x24ee('0x25')]({'body':_0x1caffd[_0x24ee('0xe')],'to':_0x24ee('0x26')+_0x1caffd[_0x24ee('0x22')],'from':_0x24ee('0x26')+_0xf8097e['phone'],'statusCallback':_0xf8097e[_0x24ee('0x27')]+'/api/whatsapp/messages/'+_0x1caffd['id']+_0x24ee('0x28')+_0xf8097e['token']})[_0x24ee('0x1a')](function(_0xf3a3f4){if(_0xf3a3f4[_0x24ee('0x29')]){return _0x198231[_0x24ee('0x1b')]({'messageId':_0xf3a3f4['sid']});}})[_0x24ee('0x1d')](function(_0x508d50){logger[_0x24ee('0x2a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',util[_0x24ee('0x2b')](_0x508d50,{'showHidden':![],'depth':null}));});}else{logger[_0x24ee('0x2a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x24ee('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})['finally'](function(){_0x2f130b();});}else{_0x2f130b();}}},'charset':'utf8mb4','collate':_0x24ee('0x2c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index ec8cba1..b3993e4 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 _0xe912=['request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','body','options','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register'];(function(_0x1369a2,_0x414875){var _0x5aef68=function(_0xebd9e8){while(--_0xebd9e8){_0x1369a2['push'](_0x1369a2['shift']());}};_0x5aef68(++_0x414875);}(_0xe912,0x90));var _0x2e91=function(_0x2c1ae2,_0x357042){_0x2c1ae2=_0x2c1ae2-0x0;var _0x5b1dcf=_0xe912[_0x2c1ae2];return _0x5b1dcf;};'use strict';var _=require(_0x2e91('0x0'));var util=require(_0x2e91('0x1'));var moment=require('moment');var BPromise=require(_0x2e91('0x2'));var rs=require(_0x2e91('0x3'));var fs=require('fs');var Redis=require(_0x2e91('0x4'));var db=require(_0x2e91('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2e91('0x6'));var config=require(_0x2e91('0x7'));var jayson=require(_0x2e91('0x8'));var client=jayson[_0x2e91('0x9')][_0x2e91('0xa')]({'port':0x232a});config[_0x2e91('0xb')]=_[_0x2e91('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2e91('0xd'))(new Redis(config[_0x2e91('0xb')]));require(_0x2e91('0xe'))[_0x2e91('0xf')](socket);function respondWithRpcPromise(_0x4ef2ac,_0x2438b0,_0x21fcfe){return new BPromise(function(_0x4270f9,_0x4897b6){return client[_0x2e91('0x10')](_0x4ef2ac,_0x21fcfe)['then'](function(_0x5a2acc){logger[_0x2e91('0x11')](_0x2e91('0x12'),_0x2438b0,_0x2e91('0x13'));logger[_0x2e91('0x14')](_0x2e91('0x15'),_0x2438b0,_0x2e91('0x13'),JSON[_0x2e91('0x16')](_0x5a2acc));if(_0x5a2acc[_0x2e91('0x17')]){if(_0x5a2acc['error']['code']===0x1f4){logger[_0x2e91('0x17')](_0x2e91('0x12'),_0x2438b0,_0x5a2acc[_0x2e91('0x17')][_0x2e91('0x18')]);return _0x4897b6(_0x5a2acc[_0x2e91('0x17')]['message']);}logger[_0x2e91('0x17')](_0x2e91('0x12'),_0x2438b0,_0x5a2acc['error']['message']);return _0x4270f9(_0x5a2acc[_0x2e91('0x17')][_0x2e91('0x18')]);}else{logger[_0x2e91('0x11')](_0x2e91('0x12'),_0x2438b0,_0x2e91('0x13'));_0x4270f9(_0x5a2acc[_0x2e91('0x19')][_0x2e91('0x18')]);}})[_0x2e91('0x1a')](function(_0x32a32d){logger[_0x2e91('0x17')](_0x2e91('0x12'),_0x2438b0,_0x32a32d);_0x4897b6(_0x32a32d);});});}exports[_0x2e91('0x1b')]=function(_0x52c2a9){var _0x535cdb=this;return new Promise(function(_0x5694e3,_0x468dbc){return db[_0x2e91('0x1c')]['create'](_0x52c2a9[_0x2e91('0x1d')],{'raw':_0x52c2a9[_0x2e91('0x1e')]?_0x52c2a9[_0x2e91('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x2e91('0x1f')](function(_0x27e56d){logger[_0x2e91('0x11')](_0x2e91('0x1b'),_0x52c2a9);logger[_0x2e91('0x14')](_0x2e91('0x1b'),_0x52c2a9,JSON[_0x2e91('0x16')](_0x27e56d));_0x5694e3(_0x27e56d);})[_0x2e91('0x1a')](function(_0x3ebeb3){logger[_0x2e91('0x17')](_0x2e91('0x1b'),_0x3ebeb3[_0x2e91('0x18')],_0x52c2a9);_0x468dbc(_0x535cdb[_0x2e91('0x17')](0x1f4,_0x3ebeb3[_0x2e91('0x18')]));});});}; \ No newline at end of file +var _0x7eb1=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','CreateWhatsappMessage','WhatsappMessage','create','options','raw','catch','lodash'];(function(_0x5195c5,_0x4f423e){var _0x30adc8=function(_0x17d8d9){while(--_0x17d8d9){_0x5195c5['push'](_0x5195c5['shift']());}};_0x30adc8(++_0x4f423e);}(_0x7eb1,0x7b));var _0x17eb=function(_0x1aa6c4,_0x1ecfc7){_0x1aa6c4=_0x1aa6c4-0x0;var _0x3a522d=_0x7eb1[_0x1aa6c4];return _0x3a522d;};'use strict';var _=require(_0x17eb('0x0'));var util=require(_0x17eb('0x1'));var moment=require(_0x17eb('0x2'));var BPromise=require(_0x17eb('0x3'));var rs=require(_0x17eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x17eb('0x5'))['db'];var utils=require(_0x17eb('0x6'));var logger=require(_0x17eb('0x7'))(_0x17eb('0x8'));var config=require(_0x17eb('0x9'));var jayson=require(_0x17eb('0xa'));var client=jayson[_0x17eb('0xb')][_0x17eb('0xc')]({'port':0x232a});config[_0x17eb('0xd')]=_[_0x17eb('0xe')](config[_0x17eb('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x17eb('0xf'))(new Redis(config[_0x17eb('0xd')]));require('./whatsappMessage.socket')[_0x17eb('0x10')](socket);function respondWithRpcPromise(_0x3dfe01,_0x253472,_0x4a0a73){return new BPromise(function(_0x35aec5,_0xe1caa2){return client[_0x17eb('0x11')](_0x3dfe01,_0x4a0a73)['then'](function(_0xeb8d30){logger[_0x17eb('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x253472,_0x17eb('0x13'));logger['debug'](_0x17eb('0x14'),_0x253472,_0x17eb('0x13'),JSON[_0x17eb('0x15')](_0xeb8d30));if(_0xeb8d30[_0x17eb('0x16')]){if(_0xeb8d30[_0x17eb('0x16')]['code']===0x1f4){logger['error'](_0x17eb('0x17'),_0x253472,_0xeb8d30[_0x17eb('0x16')][_0x17eb('0x18')]);return _0xe1caa2(_0xeb8d30[_0x17eb('0x16')][_0x17eb('0x18')]);}logger[_0x17eb('0x16')](_0x17eb('0x17'),_0x253472,_0xeb8d30['error'][_0x17eb('0x18')]);return _0x35aec5(_0xeb8d30[_0x17eb('0x16')]['message']);}else{logger[_0x17eb('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x253472,_0x17eb('0x13'));_0x35aec5(_0xeb8d30['result'][_0x17eb('0x18')]);}})['catch'](function(_0x1ee95d){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x253472,_0x1ee95d);_0xe1caa2(_0x1ee95d);});});}exports[_0x17eb('0x19')]=function(_0x310240){var _0xa79af9=this;return new Promise(function(_0x4e44d2,_0x439ce9){return db[_0x17eb('0x1a')][_0x17eb('0x1b')](_0x310240['body'],{'raw':_0x310240[_0x17eb('0x1c')]?_0x310240[_0x17eb('0x1c')][_0x17eb('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x1b1ab6){logger[_0x17eb('0x12')](_0x17eb('0x19'),_0x310240);logger['debug'](_0x17eb('0x19'),_0x310240,JSON[_0x17eb('0x15')](_0x1b1ab6));_0x4e44d2(_0x1b1ab6);})[_0x17eb('0x1e')](function(_0xb47f47){logger['error'](_0x17eb('0x19'),_0xb47f47[_0x17eb('0x18')],_0x310240);_0x439ce9(_0xa79af9['error'](0x1f4,_0xb47f47[_0x17eb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 50461f6..6979978 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 _0x67d0=['./whatsappMessage.events','save','update','emit','register','length','whatsappMessage:'];(function(_0x2cab98,_0x4cbe99){var _0x3d95ae=function(_0x2f2e69){while(--_0x2f2e69){_0x2cab98['push'](_0x2cab98['shift']());}};_0x3d95ae(++_0x4cbe99);}(_0x67d0,0xaf));var _0x067d=function(_0x59fd7c,_0x585dd7){_0x59fd7c=_0x59fd7c-0x0;var _0x36b195=_0x67d0[_0x59fd7c];return _0x36b195;};'use strict';var WhatsappMessageEvents=require(_0x067d('0x0'));var events=[_0x067d('0x1'),'remove',_0x067d('0x2')];function createListener(_0x1b5ff4,_0x63d57c){return function(_0x274ad7){_0x63d57c[_0x067d('0x3')](_0x1b5ff4,_0x274ad7);};}function removeListener(_0x1a7d49,_0x59a988){return function(){WhatsappMessageEvents['removeListener'](_0x1a7d49,_0x59a988);};}exports[_0x067d('0x4')]=function(_0x2c0721){for(var _0x403949=0x0,_0x3b3091=events[_0x067d('0x5')];_0x403949<_0x3b3091;_0x403949++){var _0x4935d5=events[_0x403949];var _0x3765e8=createListener(_0x067d('0x6')+_0x4935d5,_0x2c0721);WhatsappMessageEvents['on'](_0x4935d5,_0x3765e8);}}; \ No newline at end of file +var _0xd1da=['update','emit','register','length','whatsappMessage:','save','remove'];(function(_0x5d284f,_0x262e81){var _0x5bdf48=function(_0x5d3cdb){while(--_0x5d3cdb){_0x5d284f['push'](_0x5d284f['shift']());}};_0x5bdf48(++_0x262e81);}(_0xd1da,0x19b));var _0xad1d=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0xd1da[_0x25a42a];return _0x1129b1;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xad1d('0x0'),_0xad1d('0x1'),_0xad1d('0x2')];function createListener(_0x2f35ea,_0x1a9e08){return function(_0x2645a2){_0x1a9e08[_0xad1d('0x3')](_0x2f35ea,_0x2645a2);};}function removeListener(_0x5a2351,_0x5c8690){return function(){WhatsappMessageEvents['removeListener'](_0x5a2351,_0x5c8690);};}exports[_0xad1d('0x4')]=function(_0x48a9a9){for(var _0x913caf=0x0,_0x153573=events[_0xad1d('0x5')];_0x913caf<_0x153573;_0x913caf++){var _0x4ab035=events[_0x913caf];var _0x79370f=createListener(_0xad1d('0x6')+_0x4ab035,_0x48a9a9);WhatsappMessageEvents['on'](_0x4ab035,_0x79370f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 744284d..de8eb88 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 _0x90ed=['../../components/interaction/service','../../config/environment','./whatsappQueue.controller','index','get','/describe','describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','/:id','destroy','removeTeams','delete','removeAgents','multer','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x90ed,0x95));var _0xd90e=function(_0x38637a,_0x2e5372){_0x38637a=_0x38637a-0x0;var _0x410db=_0x90ed[_0x38637a];return _0x410db;};'use strict';var multer=require(_0xd90e('0x0'));var util=require('util');var path=require(_0xd90e('0x1'));var timeout=require('connect-timeout');var express=require(_0xd90e('0x2'));var router=express[_0xd90e('0x3')]();var fs_extra=require(_0xd90e('0x4'));var auth=require(_0xd90e('0x5'));var interaction=require(_0xd90e('0x6'));var config=require(_0xd90e('0x7'));var controller=require(_0xd90e('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xd90e('0x9')]);router[_0xd90e('0xa')](_0xd90e('0xb'),auth['isAuthenticated'](),controller[_0xd90e('0xc')]);router[_0xd90e('0xa')]('/:id',auth[_0xd90e('0xd')](),controller[_0xd90e('0xe')]);router[_0xd90e('0xa')](_0xd90e('0xf'),auth['isAuthenticated'](),controller[_0xd90e('0x10')]);router[_0xd90e('0xa')](_0xd90e('0x11'),auth[_0xd90e('0xd')](),controller[_0xd90e('0x12')]);router[_0xd90e('0xa')](_0xd90e('0x13'),auth[_0xd90e('0xd')](),controller[_0xd90e('0x14')]);router[_0xd90e('0x15')]('/',auth[_0xd90e('0xd')](),controller['create']);router[_0xd90e('0x15')]('/:id/teams',auth[_0xd90e('0xd')](),controller[_0xd90e('0x16')]);router[_0xd90e('0x15')](_0xd90e('0x13'),auth[_0xd90e('0xd')](),controller[_0xd90e('0x17')]);router[_0xd90e('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xd90e('0x19')]);router['delete'](_0xd90e('0x1a'),auth[_0xd90e('0xd')](),controller[_0xd90e('0x1b')]);router['delete'](_0xd90e('0x11'),auth[_0xd90e('0xd')](),controller[_0xd90e('0x1c')]);router[_0xd90e('0x1d')](_0xd90e('0x13'),auth[_0xd90e('0xd')](),controller[_0xd90e('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x6c5b=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','post','create','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x56c37a,_0x561e5a){var _0x4300cf=function(_0x46980a){while(--_0x46980a){_0x56c37a['push'](_0x56c37a['shift']());}};_0x4300cf(++_0x561e5a);}(_0x6c5b,0x1c4));var _0xb6c5=function(_0x379c16,_0x3cbd32){_0x379c16=_0x379c16-0x0;var _0x54310e=_0x6c5b[_0x379c16];return _0x54310e;};'use strict';var multer=require(_0xb6c5('0x0'));var util=require(_0xb6c5('0x1'));var path=require(_0xb6c5('0x2'));var timeout=require(_0xb6c5('0x3'));var express=require(_0xb6c5('0x4'));var router=express['Router']();var fs_extra=require(_0xb6c5('0x5'));var auth=require(_0xb6c5('0x6'));var interaction=require(_0xb6c5('0x7'));var config=require(_0xb6c5('0x8'));var controller=require('./whatsappQueue.controller');router[_0xb6c5('0x9')]('/',auth[_0xb6c5('0xa')](),controller[_0xb6c5('0xb')]);router[_0xb6c5('0x9')]('/describe',auth[_0xb6c5('0xa')](),controller[_0xb6c5('0xc')]);router['get'](_0xb6c5('0xd'),auth['isAuthenticated'](),controller[_0xb6c5('0xe')]);router[_0xb6c5('0x9')](_0xb6c5('0xf'),auth[_0xb6c5('0xa')](),controller['getMembers']);router[_0xb6c5('0x9')](_0xb6c5('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0xb6c5('0x9')](_0xb6c5('0x11'),auth[_0xb6c5('0xa')](),controller[_0xb6c5('0x12')]);router[_0xb6c5('0x13')]('/',auth[_0xb6c5('0xa')](),controller[_0xb6c5('0x14')]);router[_0xb6c5('0x13')](_0xb6c5('0x10'),auth[_0xb6c5('0xa')](),controller['addTeams']);router['post'](_0xb6c5('0x11'),auth[_0xb6c5('0xa')](),controller['addAgents']);router[_0xb6c5('0x15')](_0xb6c5('0xd'),auth['isAuthenticated'](),controller[_0xb6c5('0x16')]);router[_0xb6c5('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xb6c5('0x17')](_0xb6c5('0x10'),auth[_0xb6c5('0xa')](),controller[_0xb6c5('0x18')]);router[_0xb6c5('0x17')](_0xb6c5('0x11'),auth[_0xb6c5('0xa')](),controller[_0xb6c5('0x19')]);module[_0xb6c5('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 69c3b21..3e0546f 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 _0x876b=['rrmemory','beepall','STRING','name'];(function(_0xfa663f,_0x144496){var _0x47c484=function(_0x4633ab){while(--_0x4633ab){_0xfa663f['push'](_0xfa663f['shift']());}};_0x47c484(++_0x144496);}(_0x876b,0x1ba));var _0xb876=function(_0x257d51,_0x37a63f){_0x257d51=_0x257d51-0x0;var _0x388f15=_0x876b[_0x257d51];return _0x388f15;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb876('0x0')],'unique':_0xb876('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb876('0x2'),_0xb876('0x3'),'roundrobin')},'description':{'type':Sequelize[_0xb876('0x0')]}}; \ No newline at end of file +var _0xa1e8=['STRING','name','INTEGER','rrmemory','roundrobin','sequelize'];(function(_0x265a68,_0x5374d2){var _0x2bdd92=function(_0x55bec2){while(--_0x55bec2){_0x265a68['push'](_0x265a68['shift']());}};_0x2bdd92(++_0x5374d2);}(_0xa1e8,0x1af));var _0x8a1e=function(_0x204237,_0xb101b9){_0x204237=_0x204237-0x0;var _0x26dde7=_0xa1e8[_0x204237];return _0x26dde7;};'use strict';var Sequelize=require(_0x8a1e('0x0'));module['exports']={'name':{'type':Sequelize[_0x8a1e('0x1')],'unique':_0x8a1e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x8a1e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x8a1e('0x4'),'beepall',_0x8a1e('0x5'))},'description':{'type':Sequelize[_0x8a1e('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 272c59f..87d7898 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 _0xabc1=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','filter','hasOwnProperty','addTeams','ids','User','Agents','online','sequelize','transaction','each','emit','userWhatsappQueue:save','select','from','team_has_whatsapp_queues','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','json','undefined','count','offset','limit','reject','destroy','then','get','UserProfileResource','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','catch','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','create','error'];(function(_0x415cdc,_0x7d0cc5){var _0x432878=function(_0x136d00){while(--_0x136d00){_0x415cdc['push'](_0x415cdc['shift']());}};_0x432878(++_0x7d0cc5);}(_0xabc1,0xc0));var _0x1abc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xabc1[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x1abc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1abc('0x1'));var jsonpatch=require(_0x1abc('0x2'));var rp=require(_0x1abc('0x3'));var moment=require(_0x1abc('0x4'));var BPromise=require(_0x1abc('0x5'));var Mustache=require(_0x1abc('0x6'));var util=require(_0x1abc('0x7'));var path=require(_0x1abc('0x8'));var sox=require(_0x1abc('0x9'));var csv=require(_0x1abc('0xa'));var ejs=require(_0x1abc('0xb'));var fs=require('fs');var fs_extra=require(_0x1abc('0xc'));var _=require(_0x1abc('0xd'));var squel=require(_0x1abc('0xe'));var crypto=require(_0x1abc('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x1abc('0x10'));var toCsv=require(_0x1abc('0xa'));var querystring=require(_0x1abc('0x11'));var Papa=require('papaparse');var Redis=require(_0x1abc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1abc('0x13'));var as=require(_0x1abc('0x14'));var hardwareService=require(_0x1abc('0x15'));var logger=require(_0x1abc('0x16'))(_0x1abc('0x17'));var utils=require(_0x1abc('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1abc('0x19'))['db'];config[_0x1abc('0x1a')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1abc('0x1b'))(new Redis(config[_0x1abc('0x1a')]));require(_0x1abc('0x1c'))[_0x1abc('0x1d')](socket);function respondWithStatusCode(_0xed6850,_0x2c76ca){_0x2c76ca=_0x2c76ca||0xcc;return function(_0xa985bb){if(_0xa985bb){return _0xed6850[_0x1abc('0x1e')](_0x2c76ca);}return _0xed6850['status'](_0x2c76ca)[_0x1abc('0x1f')]();};}function respondWithResult(_0x17ad79,_0x59befe){_0x59befe=_0x59befe||0xc8;return function(_0x13f881){if(_0x13f881){return _0x17ad79[_0x1abc('0x20')](_0x59befe)[_0x1abc('0x21')](_0x13f881);}};}function respondWithFilteredResult(_0x38c08f,_0xa711a){return function(_0x2bbe55){if(_0x2bbe55){var _0x45c4dc=typeof _0xa711a['offset']==='undefined'&&typeof _0xa711a['limit']===_0x1abc('0x22');var _0x50894b=_0x2bbe55[_0x1abc('0x23')];var _0x1588b2=_0x45c4dc?0x0:_0xa711a[_0x1abc('0x24')];var _0x37a420=_0x45c4dc?_0x2bbe55['count']:_0xa711a[_0x1abc('0x24')]+_0xa711a[_0x1abc('0x25')];var _0x40c1d6;if(_0x37a420>=_0x50894b){_0x37a420=_0x50894b;_0x40c1d6=0xc8;}else{_0x40c1d6=0xce;}_0x38c08f[_0x1abc('0x20')](_0x40c1d6);return _0x38c08f['set']('Content-Range',_0x1588b2+'-'+_0x37a420+'/'+_0x50894b)['json'](_0x2bbe55);}return null;};}function patchUpdates(_0x3a1b20){return function(_0x4009d1){try{jsonpatch['apply'](_0x4009d1,_0x3a1b20,!![]);}catch(_0x5a5cea){return BPromise[_0x1abc('0x26')](_0x5a5cea);}return _0x4009d1['save']();};}function saveUpdates(_0x3f78ea,_0x5f1518){return function(_0x1cb5b2){if(_0x1cb5b2){return _0x1cb5b2['update'](_0x3f78ea)['then'](function(_0x2146e1){return _0x2146e1;});}return null;};}function removeEntity(_0x51dfd6,_0x1c9965){return function(_0x3c994f){if(_0x3c994f){return _0x3c994f[_0x1abc('0x27')]()[_0x1abc('0x28')](function(){var _0xb52ac1=_0x3c994f[_0x1abc('0x29')]({'plain':!![]});var _0x266d17='WhatsappQueues';return db[_0x1abc('0x2a')][_0x1abc('0x27')]({'where':{'type':_0x266d17,'resourceId':_0xb52ac1['id']}})[_0x1abc('0x28')](function(){return _0x3c994f;});})[_0x1abc('0x28')](function(){_0x51dfd6[_0x1abc('0x20')](0xcc)[_0x1abc('0x1f')]();});}};}function handleEntityNotFound(_0x374fa1,_0x4f4804){return function(_0x46493b){if(!_0x46493b){_0x374fa1[_0x1abc('0x1e')](0x194);}return _0x46493b;};}function handleError(_0x4910b8,_0x79ec9b){_0x79ec9b=_0x79ec9b||0x1f4;return function(_0x444526){logger['error'](_0x444526[_0x1abc('0x2b')]);if(_0x444526['name']){delete _0x444526[_0x1abc('0x2c')];}_0x4910b8[_0x1abc('0x20')](_0x79ec9b)['send'](_0x444526);};}exports[_0x1abc('0x2d')]=function(_0x35b87f,_0x32afbf){var _0x712010={},_0x488f35={},_0xa49963={'count':0x0,'rows':[]};var _0x19cda2=_[_0x1abc('0x2e')](db[_0x1abc('0x2f')][_0x1abc('0x30')],function(_0x48c4e0){return{'name':_0x48c4e0[_0x1abc('0x31')],'type':_0x48c4e0[_0x1abc('0x32')][_0x1abc('0x33')]};});_0x488f35[_0x1abc('0x34')]=_[_0x1abc('0x2e')](_0x19cda2,_0x1abc('0x2c'));_0x488f35['query']=_[_0x1abc('0x35')](_0x35b87f[_0x1abc('0x36')]);_0x488f35[_0x1abc('0x37')]=_[_0x1abc('0x38')](_0x488f35[_0x1abc('0x34')],_0x488f35['query']);_0x712010[_0x1abc('0x39')]=_[_0x1abc('0x38')](_0x488f35[_0x1abc('0x34')],qs['fields'](_0x35b87f[_0x1abc('0x36')][_0x1abc('0x3a')]));_0x712010[_0x1abc('0x39')]=_0x712010[_0x1abc('0x39')][_0x1abc('0x3b')]?_0x712010[_0x1abc('0x39')]:_0x488f35['model'];if(!_0x35b87f[_0x1abc('0x36')]['hasOwnProperty'](_0x1abc('0x3c'))){_0x712010[_0x1abc('0x25')]=qs[_0x1abc('0x25')](_0x35b87f[_0x1abc('0x36')][_0x1abc('0x25')]);_0x712010[_0x1abc('0x24')]=qs[_0x1abc('0x24')](_0x35b87f[_0x1abc('0x36')][_0x1abc('0x24')]);}_0x712010[_0x1abc('0x3d')]=qs[_0x1abc('0x3e')](_0x35b87f[_0x1abc('0x36')][_0x1abc('0x3e')]);_0x712010[_0x1abc('0x3f')]=qs['filters'](_[_0x1abc('0x40')](_0x35b87f[_0x1abc('0x36')],_0x488f35[_0x1abc('0x37')]),_0x19cda2);if(_0x35b87f[_0x1abc('0x36')]['filter']){_0x712010[_0x1abc('0x3f')]=_[_0x1abc('0x41')](_0x712010['where'],{'$or':_[_0x1abc('0x2e')](_0x19cda2,function(_0x22be6b){if(_0x22be6b[_0x1abc('0x32')]!==_0x1abc('0x42')){var _0x365455={};_0x365455[_0x22be6b['name']]={'$like':'%'+_0x35b87f[_0x1abc('0x36')]['filter']+'%'};return _0x365455;}})});}_0x712010=_[_0x1abc('0x41')]({},_0x712010,_0x35b87f[_0x1abc('0x43')]);var _0x4fe675={'where':_0x712010[_0x1abc('0x3f')]};return db[_0x1abc('0x2f')]['count'](_0x4fe675)[_0x1abc('0x28')](function(_0x4b2a8d){_0xa49963['count']=_0x4b2a8d;if(_0x35b87f['query'][_0x1abc('0x44')]){_0x712010['include']=[{'all':!![]}];}return db[_0x1abc('0x2f')][_0x1abc('0x45')](_0x712010);})['then'](function(_0x552df6){_0xa49963['rows']=_0x552df6;return _0xa49963;})[_0x1abc('0x28')](respondWithFilteredResult(_0x32afbf,_0x712010))[_0x1abc('0x46')](handleError(_0x32afbf,null));};exports['show']=function(_0x5caaef,_0x3fe420){var _0x21cab1={'raw':!![],'where':{'id':_0x5caaef[_0x1abc('0x47')]['id']}},_0x4f303d={};_0x4f303d[_0x1abc('0x34')]=_[_0x1abc('0x35')](db['WhatsappQueue'][_0x1abc('0x30')]);_0x4f303d[_0x1abc('0x36')]=_[_0x1abc('0x35')](_0x5caaef[_0x1abc('0x36')]);_0x4f303d[_0x1abc('0x37')]=_[_0x1abc('0x38')](_0x4f303d[_0x1abc('0x34')],_0x4f303d[_0x1abc('0x36')]);_0x21cab1[_0x1abc('0x39')]=_['intersection'](_0x4f303d[_0x1abc('0x34')],qs[_0x1abc('0x3a')](_0x5caaef[_0x1abc('0x36')][_0x1abc('0x3a')]));_0x21cab1['attributes']=_0x21cab1[_0x1abc('0x39')]['length']?_0x21cab1[_0x1abc('0x39')]:_0x4f303d[_0x1abc('0x34')];if(_0x5caaef[_0x1abc('0x36')]['includeAll']){_0x21cab1['include']=[{'all':!![]}];}_0x21cab1=_['merge']({},_0x21cab1,_0x5caaef[_0x1abc('0x43')]);return db[_0x1abc('0x2f')][_0x1abc('0x48')](_0x21cab1)[_0x1abc('0x28')](handleEntityNotFound(_0x3fe420,null))[_0x1abc('0x28')](respondWithResult(_0x3fe420,null))['catch'](handleError(_0x3fe420,null));};exports['create']=function(_0x11c6ca,_0x469cd0){return db[_0x1abc('0x2f')]['create'](_0x11c6ca[_0x1abc('0x49')],{})[_0x1abc('0x28')](function(_0x54bf14){var _0x39ea9e=_0x11c6ca[_0x1abc('0x4a')][_0x1abc('0x29')]({'plain':!![]});if(!_0x39ea9e)throw new Error(_0x1abc('0x4b'));if(_0x39ea9e['role']==='user'){var _0x37068f=_0x54bf14['get']({'plain':!![]});var _0x30d699=_0x1abc('0x4c');return db[_0x1abc('0x4d')][_0x1abc('0x48')]({'where':{'name':_0x30d699,'userProfileId':_0x39ea9e[_0x1abc('0x4e')]},'raw':!![]})['then'](function(_0x270004){if(_0x270004&&_0x270004[_0x1abc('0x4f')]===0x0){return db[_0x1abc('0x2a')][_0x1abc('0x50')]({'name':_0x37068f[_0x1abc('0x2c')],'resourceId':_0x37068f['id'],'type':_0x270004[_0x1abc('0x2c')],'sectionId':_0x270004['id']},{})[_0x1abc('0x28')](function(){return _0x54bf14;});}else{return _0x54bf14;}})[_0x1abc('0x46')](function(_0x56f86d){logger[_0x1abc('0x51')](_0x1abc('0x52'),_0x56f86d);throw _0x56f86d;});}return _0x54bf14;})[_0x1abc('0x28')](respondWithResult(_0x469cd0,0xc9))[_0x1abc('0x46')](handleError(_0x469cd0,null));};exports[_0x1abc('0x53')]=function(_0x561ad1,_0x2dcb85){if(_0x561ad1[_0x1abc('0x49')]['id']){delete _0x561ad1[_0x1abc('0x49')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x561ad1[_0x1abc('0x47')]['id']}})[_0x1abc('0x28')](handleEntityNotFound(_0x2dcb85,null))[_0x1abc('0x28')](saveUpdates(_0x561ad1[_0x1abc('0x49')],null))['then'](respondWithResult(_0x2dcb85,null))[_0x1abc('0x46')](handleError(_0x2dcb85,null));};exports[_0x1abc('0x27')]=function(_0x291aff,_0x52df6c){return db[_0x1abc('0x2f')][_0x1abc('0x48')]({'where':{'id':_0x291aff['params']['id']}})['then'](handleEntityNotFound(_0x52df6c,null))[_0x1abc('0x28')](removeEntity(_0x52df6c,null))[_0x1abc('0x46')](handleError(_0x52df6c,null));};exports[_0x1abc('0x54')]=function(_0x2bb3a4,_0x486edf){return db[_0x1abc('0x2f')][_0x1abc('0x54')]()['then'](respondWithResult(_0x486edf,null))[_0x1abc('0x46')](handleError(_0x486edf,null));};exports[_0x1abc('0x55')]=function(_0xc54015,_0x5076f0,_0x448118){var _0x3c5c8f={'raw':!![],'where':{}},_0x300766={},_0x23e0e8;return db[_0x1abc('0x2f')][_0x1abc('0x56')]({'where':{'id':_0xc54015[_0x1abc('0x47')]['id']}})[_0x1abc('0x28')](handleEntityNotFound(_0x5076f0,null))['then'](function(_0x37907c){if(_0x37907c){_0x23e0e8=_0x37907c[_0x1abc('0x29')]({'plain':!![]});_0x300766['model']=_['keys'](db[_0x1abc('0x57')]['rawAttributes']);_0x300766[_0x1abc('0x36')]=_[_0x1abc('0x35')](_0xc54015[_0x1abc('0x36')]);_0x300766['filters']=_[_0x1abc('0x38')](_0x300766[_0x1abc('0x34')],_0x300766['query']);_0x3c5c8f[_0x1abc('0x39')]=_[_0x1abc('0x38')](_0x300766['model'],qs[_0x1abc('0x3a')](_0xc54015[_0x1abc('0x36')][_0x1abc('0x3a')]));_0x3c5c8f[_0x1abc('0x39')]=_0x3c5c8f['attributes'][_0x1abc('0x3b')]?_0x3c5c8f['attributes']:_0x300766[_0x1abc('0x34')];if(!_0xc54015[_0x1abc('0x36')]['hasOwnProperty'](_0x1abc('0x3c'))){_0x3c5c8f['limit']=qs['limit'](_0xc54015[_0x1abc('0x36')][_0x1abc('0x25')]);_0x3c5c8f[_0x1abc('0x24')]=qs[_0x1abc('0x24')](_0xc54015[_0x1abc('0x36')]['offset']);}_0x3c5c8f['order']=qs[_0x1abc('0x3e')](_0xc54015[_0x1abc('0x36')][_0x1abc('0x3e')]);_0x3c5c8f[_0x1abc('0x3f')]=qs[_0x1abc('0x37')](_['pick'](_0xc54015[_0x1abc('0x36')],_0x300766[_0x1abc('0x37')]));_0x3c5c8f['where'][_0x1abc('0x58')]=_0x37907c['id'];if(_0xc54015[_0x1abc('0x36')]['filter']){_0x3c5c8f[_0x1abc('0x3f')]=_[_0x1abc('0x41')](_0x3c5c8f[_0x1abc('0x3f')],{'$or':_[_0x1abc('0x2e')](_0x3c5c8f[_0x1abc('0x39')],function(_0x9ec012){var _0x4623f5={};_0x4623f5[_0x9ec012]={'$like':'%'+_0xc54015[_0x1abc('0x36')]['filter']+'%'};return _0x4623f5;})});}_0x3c5c8f=_[_0x1abc('0x41')]({},_0x3c5c8f,_0xc54015['options']);return db['UserWhatsappQueue'][_0x1abc('0x45')](_0x3c5c8f);}})['then'](function(_0x373a2d){if(_0x373a2d){return db['User'][_0x1abc('0x59')]({'where':{'id':_[_0x1abc('0x2e')](_0x373a2d,_0x1abc('0x5a')),'role':_0x1abc('0x5b')},'attributes':['id',_0x1abc('0x2c'),_0x1abc('0x5c'),_0x1abc('0x5d'),_0x1abc('0x5e')]});}})[_0x1abc('0x28')](function(_0x333433){if(_0x333433){return{'count':_0x333433[_0x1abc('0x23')],'rows':_[_0x1abc('0x2e')](_0x333433[_0x1abc('0x5f')],function(_0x166deb){return{'membername':_0x166deb['name'],'UserId':_0x166deb['id'],'queue_name':_0x23e0e8[_0x1abc('0x2c')],'WhatsappQueueId':_0x23e0e8['id'],'interface':util[_0x1abc('0x60')](_0x1abc('0x61'),_0x1abc('0x62'),_0x166deb[_0x1abc('0x2c')]),'penalty':0x0,'paused':_0x166deb[_0x1abc('0x5c')],'createdAt':_0x166deb['createdAt'],'updatedAt':_0x166deb['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x1abc('0x28')](respondWithFilteredResult(_0x5076f0,_0x3c5c8f))['catch'](handleError(_0x5076f0,null));};exports[_0x1abc('0x63')]=function(_0x3deeba,_0x2b665c,_0x48500d){var _0x18400d={};var _0x4cc5e4={};var _0x4d5384;var _0x37318c;return db[_0x1abc('0x2f')][_0x1abc('0x56')]({'where':{'id':_0x3deeba[_0x1abc('0x47')]['id']}})[_0x1abc('0x28')](handleEntityNotFound(_0x2b665c,null))[_0x1abc('0x28')](function(_0x422e6a){if(_0x422e6a){_0x4d5384=_0x422e6a;_0x4cc5e4[_0x1abc('0x34')]=_[_0x1abc('0x35')](db[_0x1abc('0x64')][_0x1abc('0x30')]);_0x4cc5e4[_0x1abc('0x36')]=_[_0x1abc('0x35')](_0x3deeba[_0x1abc('0x36')]);_0x4cc5e4[_0x1abc('0x37')]=_[_0x1abc('0x38')](_0x4cc5e4['model'],_0x4cc5e4[_0x1abc('0x36')]);_0x18400d[_0x1abc('0x39')]=_['intersection'](_0x4cc5e4['model'],qs['fields'](_0x3deeba[_0x1abc('0x36')][_0x1abc('0x3a')]));_0x18400d[_0x1abc('0x39')]=_0x18400d['attributes']['length']?_0x18400d[_0x1abc('0x39')]:_0x4cc5e4[_0x1abc('0x34')];_0x18400d[_0x1abc('0x3d')]=qs['sort'](_0x3deeba[_0x1abc('0x36')][_0x1abc('0x3e')]);_0x18400d[_0x1abc('0x3f')]=qs[_0x1abc('0x37')](_[_0x1abc('0x40')](_0x3deeba[_0x1abc('0x36')],_0x4cc5e4['filters']));if(_0x3deeba[_0x1abc('0x36')][_0x1abc('0x65')]){_0x18400d[_0x1abc('0x3f')]=_[_0x1abc('0x41')](_0x18400d['where'],{'$or':_[_0x1abc('0x2e')](_0x18400d[_0x1abc('0x39')],function(_0x559cd9){var _0x5c15f0={};_0x5c15f0[_0x559cd9]={'$like':'%'+_0x3deeba['query'][_0x1abc('0x65')]+'%'};return _0x5c15f0;})});}_0x18400d=_[_0x1abc('0x41')]({},_0x18400d,_0x3deeba[_0x1abc('0x43')]);return _0x4d5384['getTeams'](_0x18400d);}})[_0x1abc('0x28')](function(_0x2356cd){if(_0x2356cd){_0x37318c=_0x2356cd['length'];if(!_0x3deeba[_0x1abc('0x36')][_0x1abc('0x66')](_0x1abc('0x3c'))){_0x18400d['limit']=qs['limit'](_0x3deeba[_0x1abc('0x36')][_0x1abc('0x25')]);_0x18400d['offset']=qs[_0x1abc('0x24')](_0x3deeba[_0x1abc('0x36')][_0x1abc('0x24')]);}return _0x4d5384[_0x1abc('0x63')](_0x18400d);}})[_0x1abc('0x28')](function(_0x9db57e){if(_0x9db57e){return _0x9db57e?{'count':_0x37318c,'rows':_0x9db57e}:null;}})[_0x1abc('0x28')](respondWithResult(_0x2b665c,null))[_0x1abc('0x46')](handleError(_0x2b665c,null));};exports[_0x1abc('0x67')]=function(_0x341df9,_0x2455bd,_0x1c1fe7){var _0x36fe87=_0x341df9[_0x1abc('0x49')][_0x1abc('0x68')];return db[_0x1abc('0x64')][_0x1abc('0x45')]({'where':{'id':_0x36fe87},'attributes':['id'],'include':[{'model':db[_0x1abc('0x69')],'as':_0x1abc('0x6a'),'attributes':['id',_0x1abc('0x2c'),_0x1abc('0x6b'),'voicePause','interface'],'raw':!![]}]})[_0x1abc('0x28')](function(_0x496d8c){if(_0x496d8c){var _0x4b84fb=_['flatMap'](_0x496d8c,function(_0x5b8abf){var _0x2cd8be=_0x5b8abf['get']({'plain':!![]});return _0x2cd8be[_0x1abc('0x6a')];});return db[_0x1abc('0x2f')][_0x1abc('0x48')]({'where':{'id':_0x341df9[_0x1abc('0x47')]['id']}})['then'](function(_0xb19ed6){return db[_0x1abc('0x6c')][_0x1abc('0x6d')](function(_0xd6c49a){return _0xb19ed6[_0x1abc('0x67')](_0x36fe87,{'transaction':_0xd6c49a})[_0x1abc('0x28')](function(){return BPromise[_0x1abc('0x6e')](_0x4b84fb,function(_0xc43644){return db[_0x1abc('0x57')]['findOrCreate']({'where':{'UserId':_0xc43644['id'],'WhatsappQueueId':_0x341df9[_0x1abc('0x47')]['id']},'transaction':_0xd6c49a});});})[_0x1abc('0x28')](function(){_0x4b84fb['forEach'](function(_0x18263d){socket[_0x1abc('0x6f')](_0x1abc('0x70'),{'UserId':_0x18263d['id'],'WhatsappQueueId':_0xb19ed6['id']});});});});});}})[_0x1abc('0x28')](respondWithStatusCode(_0x2455bd,null))[_0x1abc('0x46')](handleError(_0x2455bd,null));};exports['removeTeams']=function(_0x11aa7e,_0x2fe8c9,_0x15e470){return db['Team']['findAll']({'where':{'id':_0x11aa7e['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x1abc('0x69')],'as':_0x1abc('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x1abc('0x28')](handleEntityNotFound(_0x2fe8c9,null))[_0x1abc('0x28')](function(_0x1ce2f3){var _0x49ba04=_[_0x1abc('0x2e')](_0x1ce2f3,'id');var _0x3a7c24=[];var _0xc69d01=[];var _0x5989c2=squel[_0x1abc('0x71')]();_0x5989c2['field']('tq.TeamId')[_0x1abc('0x72')](_0x1abc('0x73'),'tq')['join'](_0x1abc('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x1abc('0x3f')](_0x1abc('0x75'),_0x11aa7e[_0x1abc('0x47')]['id']);for(var _0x546119=0x0;_0x546119<_0x1ce2f3[_0x1abc('0x3b')];_0x546119+=0x1){let _0x6c246e=_0x1ce2f3[_0x546119];for(var _0x5d34a5=0x0;_0x5d34a5<_0x6c246e[_0x1abc('0x6a')][_0x1abc('0x3b')];_0x5d34a5+=0x1){let _0x16e02a=_0x6c246e[_0x1abc('0x6a')][_0x5d34a5];var _0x29068b=_0x5989c2[_0x1abc('0x76')]();_0x29068b[_0x1abc('0x3f')](_0x1abc('0x77'),_0x16e02a['id']);_0xc69d01[_0x1abc('0x78')](db['sequelize'][_0x1abc('0x36')](_0x29068b[_0x1abc('0x79')](),{'type':db[_0x1abc('0x6c')][_0x1abc('0x7a')][_0x1abc('0x7b')]})[_0x1abc('0x28')](function(_0x1caaa3){if(_0x1caaa3[_0x1abc('0x3b')]===0x1){return _0x16e02a['id'];}else{var _0x5df491=_[_0x1abc('0x7c')](_[_0x1abc('0x2e')](_0x1caaa3,_0x1abc('0x7d')),function(_0x1ab50b){return _[_0x1abc('0x7e')](_0x49ba04,_0x1ab50b);});if(_0x5df491){return _0x16e02a['id'];}}}));}}return BPromise['all'](_0xc69d01)[_0x1abc('0x28')](function(_0xc2b9d2){_0x3a7c24=_(_0x3a7c24)['union'](_0xc2b9d2)[_0x1abc('0x7f')]()[_0x1abc('0x80')]();return db[_0x1abc('0x2f')][_0x1abc('0x48')]({'where':{'id':_0x11aa7e[_0x1abc('0x47')]['id']}})[_0x1abc('0x28')](function(_0x4a3a18){return db[_0x1abc('0x6c')]['transaction'](function(_0x234555){return _0x4a3a18['removeTeams'](_0x11aa7e[_0x1abc('0x36')][_0x1abc('0x68')],{'transaction':_0x234555})['then'](function(){if(!_[_0x1abc('0x81')](_0x3a7c24)){return _0x4a3a18[_0x1abc('0x82')](_0x3a7c24,{'transaction':_0x234555});}})[_0x1abc('0x28')](function(){_0x3a7c24['forEach'](function(_0x1c8d25){socket['emit'](_0x1abc('0x83'),{'UserId':_0x1c8d25,'WhatsappQueueId':_0x4a3a18['id']});});});});});});})[_0x1abc('0x28')](respondWithStatusCode(_0x2fe8c9,null))[_0x1abc('0x46')](handleError(_0x2fe8c9,null));};exports[_0x1abc('0x84')]=function(_0x2f01d9,_0x4f29b0,_0x3bd0c6){return db[_0x1abc('0x2f')][_0x1abc('0x48')]({'where':{'id':_0x2f01d9[_0x1abc('0x47')]['id']}})[_0x1abc('0x28')](handleEntityNotFound(_0x4f29b0,null))[_0x1abc('0x28')](function(_0xa12293){if(_0xa12293){return _0xa12293[_0x1abc('0x84')](_0x2f01d9[_0x1abc('0x49')][_0x1abc('0x68')],_[_0x1abc('0x85')](_0x2f01d9[_0x1abc('0x49')],['ids','id'])||{})[_0x1abc('0x86')](function(_0x2d48ed){for(var _0x441932=0x0;_0x441932<_0x2f01d9[_0x1abc('0x49')][_0x1abc('0x68')][_0x1abc('0x3b')];_0x441932+=0x1){socket['emit'](_0x1abc('0x70'),{'UserId':Number(_0x2f01d9[_0x1abc('0x49')]['ids'][_0x441932]),'WhatsappQueueId':Number(_0x2f01d9[_0x1abc('0x47')]['id'])});}return _0x2d48ed;});}})[_0x1abc('0x28')](respondWithResult(_0x4f29b0,null))[_0x1abc('0x46')](handleError(_0x4f29b0,null));};exports[_0x1abc('0x82')]=function(_0x1b17d4,_0x1cfcee,_0xbeb20a){return db[_0x1abc('0x2f')]['find']({'where':{'id':_0x1b17d4['params']['id']}})[_0x1abc('0x28')](handleEntityNotFound(_0x1cfcee,null))[_0x1abc('0x28')](function(_0xf80262){if(_0xf80262){return _0xf80262[_0x1abc('0x82')](_0x1b17d4['query'][_0x1abc('0x68')])['then'](function(){if(_[_0x1abc('0x87')](_0x1b17d4['query'][_0x1abc('0x68')])){for(var _0x429dda=0x0;_0x429dda<_0x1b17d4['query'][_0x1abc('0x68')][_0x1abc('0x3b')];_0x429dda+=0x1){socket[_0x1abc('0x6f')](_0x1abc('0x83'),{'UserId':Number(_0x1b17d4[_0x1abc('0x36')][_0x1abc('0x68')][_0x429dda]),'WhatsappQueueId':Number(_0x1b17d4[_0x1abc('0x47')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x1b17d4[_0x1abc('0x36')]['ids']),'WhatsappQueueId':Number(_0x1b17d4[_0x1abc('0x47')]['id'])});}});}})[_0x1abc('0x28')](respondWithStatusCode(_0x1cfcee,null))[_0x1abc('0x46')](handleError(_0x1cfcee,null));};exports[_0x1abc('0x88')]=function(_0x121ff2,_0x425004,_0x33411e){var _0x23c90f={};var _0x4c59b4={};var _0x1e6822;var _0xf04b9a;return db[_0x1abc('0x2f')][_0x1abc('0x56')]({'where':{'id':_0x121ff2[_0x1abc('0x47')]['id']}})[_0x1abc('0x28')](handleEntityNotFound(_0x425004,null))['then'](function(_0x58decb){if(_0x58decb){_0x1e6822=_0x58decb;_0x4c59b4['model']=_[_0x1abc('0x35')](db[_0x1abc('0x69')]['rawAttributes']);_0x4c59b4[_0x1abc('0x36')]=_[_0x1abc('0x35')](_0x121ff2[_0x1abc('0x36')]);_0x4c59b4[_0x1abc('0x37')]=_[_0x1abc('0x38')](_0x4c59b4[_0x1abc('0x34')],_0x4c59b4[_0x1abc('0x36')]);_0x23c90f[_0x1abc('0x39')]=_[_0x1abc('0x38')](_0x4c59b4['model'],qs[_0x1abc('0x3a')](_0x121ff2[_0x1abc('0x36')]['fields']));_0x23c90f[_0x1abc('0x39')]=_0x23c90f['attributes'][_0x1abc('0x3b')]?_0x23c90f[_0x1abc('0x39')]:_0x4c59b4[_0x1abc('0x34')];_0x23c90f['order']=qs[_0x1abc('0x3e')](_0x121ff2[_0x1abc('0x36')][_0x1abc('0x3e')]);_0x23c90f[_0x1abc('0x3f')]=qs[_0x1abc('0x37')](_['pick'](_0x121ff2[_0x1abc('0x36')],_0x4c59b4[_0x1abc('0x37')]));if(_0x121ff2[_0x1abc('0x36')][_0x1abc('0x65')]){_0x23c90f[_0x1abc('0x3f')]=_[_0x1abc('0x41')](_0x23c90f['where'],{'$or':_[_0x1abc('0x2e')](_0x23c90f['attributes'],function(_0x2ba321){var _0xc832d3={};_0xc832d3[_0x2ba321]={'$like':'%'+_0x121ff2[_0x1abc('0x36')][_0x1abc('0x65')]+'%'};return _0xc832d3;})});}_0x23c90f=_[_0x1abc('0x41')]({},_0x23c90f,_0x121ff2[_0x1abc('0x43')]);return _0x1e6822[_0x1abc('0x88')](_0x23c90f);}})[_0x1abc('0x28')](function(_0x463525){if(_0x463525){_0xf04b9a=_0x463525[_0x1abc('0x3b')];if(!_0x121ff2[_0x1abc('0x36')]['hasOwnProperty']('nolimit')){_0x23c90f['limit']=qs[_0x1abc('0x25')](_0x121ff2[_0x1abc('0x36')][_0x1abc('0x25')]);_0x23c90f[_0x1abc('0x24')]=qs[_0x1abc('0x24')](_0x121ff2[_0x1abc('0x36')]['offset']);}return _0x1e6822[_0x1abc('0x88')](_0x23c90f);}})[_0x1abc('0x28')](function(_0x13b2ee){if(_0x13b2ee){return _0x13b2ee?{'count':_0xf04b9a,'rows':_0x13b2ee}:null;}})['then'](respondWithResult(_0x425004,null))[_0x1abc('0x46')](handleError(_0x425004,null));}; \ No newline at end of file +var _0xe3e2=['filter','type','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserWhatsappQueue','options','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause','getTeams','Team','addTeams','ids','voicePause','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','includes','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','get','WhatsappQueues','UserProfileResource','destroy','stack','name','WhatsappQueue','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick'];(function(_0x3462dd,_0x2753e3){var _0x41fb08=function(_0x10505d){while(--_0x10505d){_0x3462dd['push'](_0x3462dd['shift']());}};_0x41fb08(++_0x2753e3);}(_0xe3e2,0x1d9));var _0x2e3e=function(_0x2e5253,_0xbe2801){_0x2e5253=_0x2e5253-0x0;var _0x46ad7d=_0xe3e2[_0x2e5253];return _0x46ad7d;};'use strict';var emlformat=require(_0x2e3e('0x0'));var rimraf=require(_0x2e3e('0x1'));var zipdir=require(_0x2e3e('0x2'));var jsonpatch=require(_0x2e3e('0x3'));var rp=require(_0x2e3e('0x4'));var moment=require(_0x2e3e('0x5'));var BPromise=require(_0x2e3e('0x6'));var Mustache=require('mustache');var util=require(_0x2e3e('0x7'));var path=require(_0x2e3e('0x8'));var sox=require(_0x2e3e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2e3e('0xa'));var _=require('lodash');var squel=require(_0x2e3e('0xb'));var crypto=require('crypto');var jsforce=require(_0x2e3e('0xc'));var deskjs=require(_0x2e3e('0xd'));var toCsv=require(_0x2e3e('0xe'));var querystring=require(_0x2e3e('0xf'));var Papa=require(_0x2e3e('0x10'));var Redis=require(_0x2e3e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2e3e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2e3e('0x13'));var logger=require(_0x2e3e('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2e3e('0x15'));var db=require(_0x2e3e('0x16'))['db'];config[_0x2e3e('0x17')]=_[_0x2e3e('0x18')](config[_0x2e3e('0x17')],{'host':_0x2e3e('0x19'),'port':0x18eb});var socket=require(_0x2e3e('0x1a'))(new Redis(config['redis']));require(_0x2e3e('0x1b'))['register'](socket);function respondWithStatusCode(_0x525e95,_0x70cef4){_0x70cef4=_0x70cef4||0xcc;return function(_0x180e74){if(_0x180e74){return _0x525e95[_0x2e3e('0x1c')](_0x70cef4);}return _0x525e95[_0x2e3e('0x1d')](_0x70cef4)[_0x2e3e('0x1e')]();};}function respondWithResult(_0x5301f7,_0x44a63f){_0x44a63f=_0x44a63f||0xc8;return function(_0x47c094){if(_0x47c094){return _0x5301f7[_0x2e3e('0x1d')](_0x44a63f)['json'](_0x47c094);}};}function respondWithFilteredResult(_0x5d8b0a,_0x30661f){return function(_0x311dff){if(_0x311dff){var _0x2a154a=typeof _0x30661f[_0x2e3e('0x1f')]===_0x2e3e('0x20')&&typeof _0x30661f[_0x2e3e('0x21')]===_0x2e3e('0x20');var _0xd1ee08=_0x311dff[_0x2e3e('0x22')];var _0x55688a=_0x2a154a?0x0:_0x30661f[_0x2e3e('0x1f')];var _0x42e921=_0x2a154a?_0x311dff[_0x2e3e('0x22')]:_0x30661f[_0x2e3e('0x1f')]+_0x30661f[_0x2e3e('0x21')];var _0x44bcdb;if(_0x42e921>=_0xd1ee08){_0x42e921=_0xd1ee08;_0x44bcdb=0xc8;}else{_0x44bcdb=0xce;}_0x5d8b0a[_0x2e3e('0x1d')](_0x44bcdb);return _0x5d8b0a[_0x2e3e('0x23')](_0x2e3e('0x24'),_0x55688a+'-'+_0x42e921+'/'+_0xd1ee08)[_0x2e3e('0x25')](_0x311dff);}return null;};}function patchUpdates(_0x572f3e){return function(_0x5eec93){try{jsonpatch['apply'](_0x5eec93,_0x572f3e,!![]);}catch(_0x29cf2f){return BPromise[_0x2e3e('0x26')](_0x29cf2f);}return _0x5eec93[_0x2e3e('0x27')]();};}function saveUpdates(_0x5c5b3b,_0x3c11d0){return function(_0x118ceb){if(_0x118ceb){return _0x118ceb['update'](_0x5c5b3b)[_0x2e3e('0x28')](function(_0xea8286){return _0xea8286;});}return null;};}function removeEntity(_0x4ea338,_0xccd69c){return function(_0x28829a){if(_0x28829a){return _0x28829a['destroy']()[_0x2e3e('0x28')](function(){var _0x3fb08a=_0x28829a[_0x2e3e('0x29')]({'plain':!![]});var _0x11fc3a=_0x2e3e('0x2a');return db[_0x2e3e('0x2b')][_0x2e3e('0x2c')]({'where':{'type':_0x11fc3a,'resourceId':_0x3fb08a['id']}})['then'](function(){return _0x28829a;});})[_0x2e3e('0x28')](function(){_0x4ea338[_0x2e3e('0x1d')](0xcc)[_0x2e3e('0x1e')]();});}};}function handleEntityNotFound(_0x3c8beb,_0x3bca92){return function(_0x2344b9){if(!_0x2344b9){_0x3c8beb[_0x2e3e('0x1c')](0x194);}return _0x2344b9;};}function handleError(_0x4c9a2f,_0x2486b5){_0x2486b5=_0x2486b5||0x1f4;return function(_0x78c0a2){logger['error'](_0x78c0a2[_0x2e3e('0x2d')]);if(_0x78c0a2[_0x2e3e('0x2e')]){delete _0x78c0a2[_0x2e3e('0x2e')];}_0x4c9a2f[_0x2e3e('0x1d')](_0x2486b5)['send'](_0x78c0a2);};}exports['index']=function(_0x3a9cf0,_0xfebd00){var _0x311c02={},_0x140f00={},_0x1879a5={'count':0x0,'rows':[]};var _0x30c45b=_['map'](db[_0x2e3e('0x2f')][_0x2e3e('0x30')],function(_0x34ff6c){return{'name':_0x34ff6c['fieldName'],'type':_0x34ff6c['type']['key']};});_0x140f00[_0x2e3e('0x31')]=_[_0x2e3e('0x32')](_0x30c45b,_0x2e3e('0x2e'));_0x140f00[_0x2e3e('0x33')]=_[_0x2e3e('0x34')](_0x3a9cf0[_0x2e3e('0x33')]);_0x140f00[_0x2e3e('0x35')]=_[_0x2e3e('0x36')](_0x140f00['model'],_0x140f00[_0x2e3e('0x33')]);_0x311c02[_0x2e3e('0x37')]=_[_0x2e3e('0x36')](_0x140f00[_0x2e3e('0x31')],qs[_0x2e3e('0x38')](_0x3a9cf0[_0x2e3e('0x33')]['fields']));_0x311c02[_0x2e3e('0x37')]=_0x311c02[_0x2e3e('0x37')][_0x2e3e('0x39')]?_0x311c02[_0x2e3e('0x37')]:_0x140f00[_0x2e3e('0x31')];if(!_0x3a9cf0['query']['hasOwnProperty'](_0x2e3e('0x3a'))){_0x311c02[_0x2e3e('0x21')]=qs[_0x2e3e('0x21')](_0x3a9cf0[_0x2e3e('0x33')][_0x2e3e('0x21')]);_0x311c02[_0x2e3e('0x1f')]=qs[_0x2e3e('0x1f')](_0x3a9cf0[_0x2e3e('0x33')][_0x2e3e('0x1f')]);}_0x311c02[_0x2e3e('0x3b')]=qs[_0x2e3e('0x3c')](_0x3a9cf0[_0x2e3e('0x33')]['sort']);_0x311c02[_0x2e3e('0x3d')]=qs[_0x2e3e('0x35')](_[_0x2e3e('0x3e')](_0x3a9cf0[_0x2e3e('0x33')],_0x140f00[_0x2e3e('0x35')]),_0x30c45b);if(_0x3a9cf0[_0x2e3e('0x33')][_0x2e3e('0x3f')]){_0x311c02[_0x2e3e('0x3d')]=_['merge'](_0x311c02[_0x2e3e('0x3d')],{'$or':_[_0x2e3e('0x32')](_0x30c45b,function(_0x47cde7){if(_0x47cde7[_0x2e3e('0x40')]!=='VIRTUAL'){var _0x2821bc={};_0x2821bc[_0x47cde7['name']]={'$like':'%'+_0x3a9cf0[_0x2e3e('0x33')][_0x2e3e('0x3f')]+'%'};return _0x2821bc;}})});}_0x311c02=_[_0x2e3e('0x41')]({},_0x311c02,_0x3a9cf0['options']);var _0x21dfae={'where':_0x311c02[_0x2e3e('0x3d')]};return db[_0x2e3e('0x2f')][_0x2e3e('0x22')](_0x21dfae)[_0x2e3e('0x28')](function(_0x4e1622){_0x1879a5['count']=_0x4e1622;if(_0x3a9cf0[_0x2e3e('0x33')][_0x2e3e('0x42')]){_0x311c02[_0x2e3e('0x43')]=[{'all':!![]}];}return db[_0x2e3e('0x2f')][_0x2e3e('0x44')](_0x311c02);})[_0x2e3e('0x28')](function(_0x4a4898){_0x1879a5[_0x2e3e('0x45')]=_0x4a4898;return _0x1879a5;})[_0x2e3e('0x28')](respondWithFilteredResult(_0xfebd00,_0x311c02))[_0x2e3e('0x46')](handleError(_0xfebd00,null));};exports[_0x2e3e('0x47')]=function(_0x48c84f,_0xbb859f){var _0x378ec2={'raw':!![],'where':{'id':_0x48c84f[_0x2e3e('0x48')]['id']}},_0x5bb623={};_0x5bb623['model']=_[_0x2e3e('0x34')](db[_0x2e3e('0x2f')][_0x2e3e('0x30')]);_0x5bb623['query']=_[_0x2e3e('0x34')](_0x48c84f[_0x2e3e('0x33')]);_0x5bb623[_0x2e3e('0x35')]=_[_0x2e3e('0x36')](_0x5bb623[_0x2e3e('0x31')],_0x5bb623[_0x2e3e('0x33')]);_0x378ec2[_0x2e3e('0x37')]=_[_0x2e3e('0x36')](_0x5bb623['model'],qs[_0x2e3e('0x38')](_0x48c84f[_0x2e3e('0x33')][_0x2e3e('0x38')]));_0x378ec2[_0x2e3e('0x37')]=_0x378ec2['attributes'][_0x2e3e('0x39')]?_0x378ec2['attributes']:_0x5bb623['model'];if(_0x48c84f[_0x2e3e('0x33')]['includeAll']){_0x378ec2[_0x2e3e('0x43')]=[{'all':!![]}];}_0x378ec2=_['merge']({},_0x378ec2,_0x48c84f['options']);return db[_0x2e3e('0x2f')][_0x2e3e('0x49')](_0x378ec2)[_0x2e3e('0x28')](handleEntityNotFound(_0xbb859f,null))[_0x2e3e('0x28')](respondWithResult(_0xbb859f,null))[_0x2e3e('0x46')](handleError(_0xbb859f,null));};exports[_0x2e3e('0x4a')]=function(_0x10b4d1,_0x1254d3){return db[_0x2e3e('0x2f')][_0x2e3e('0x4a')](_0x10b4d1[_0x2e3e('0x4b')],{})[_0x2e3e('0x28')](function(_0x47e322){var _0x413ab3=_0x10b4d1[_0x2e3e('0x4c')][_0x2e3e('0x29')]({'plain':!![]});if(!_0x413ab3)throw new Error(_0x2e3e('0x4d'));if(_0x413ab3['role']===_0x2e3e('0x4c')){var _0x1cd58b=_0x47e322[_0x2e3e('0x29')]({'plain':!![]});var _0x77598f=_0x2e3e('0x2a');return db[_0x2e3e('0x4e')][_0x2e3e('0x49')]({'where':{'name':_0x77598f,'userProfileId':_0x413ab3['userProfileId']},'raw':!![]})[_0x2e3e('0x28')](function(_0x3744bf){if(_0x3744bf&&_0x3744bf['autoAssociation']===0x0){return db[_0x2e3e('0x2b')][_0x2e3e('0x4a')]({'name':_0x1cd58b[_0x2e3e('0x2e')],'resourceId':_0x1cd58b['id'],'type':_0x3744bf[_0x2e3e('0x2e')],'sectionId':_0x3744bf['id']},{})['then'](function(){return _0x47e322;});}else{return _0x47e322;}})[_0x2e3e('0x46')](function(_0x232264){logger[_0x2e3e('0x4f')](_0x2e3e('0x50'),_0x232264);throw _0x232264;});}return _0x47e322;})[_0x2e3e('0x28')](respondWithResult(_0x1254d3,0xc9))[_0x2e3e('0x46')](handleError(_0x1254d3,null));};exports[_0x2e3e('0x51')]=function(_0x3ad4b2,_0x5f5d5c){if(_0x3ad4b2[_0x2e3e('0x4b')]['id']){delete _0x3ad4b2[_0x2e3e('0x4b')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x3ad4b2[_0x2e3e('0x48')]['id']}})['then'](handleEntityNotFound(_0x5f5d5c,null))[_0x2e3e('0x28')](saveUpdates(_0x3ad4b2[_0x2e3e('0x4b')],null))['then'](respondWithResult(_0x5f5d5c,null))[_0x2e3e('0x46')](handleError(_0x5f5d5c,null));};exports['destroy']=function(_0x262acf,_0x59eefb){return db['WhatsappQueue'][_0x2e3e('0x49')]({'where':{'id':_0x262acf[_0x2e3e('0x48')]['id']}})[_0x2e3e('0x28')](handleEntityNotFound(_0x59eefb,null))[_0x2e3e('0x28')](removeEntity(_0x59eefb,null))[_0x2e3e('0x46')](handleError(_0x59eefb,null));};exports['describe']=function(_0x460ef5,_0x46ebfa){return db[_0x2e3e('0x2f')][_0x2e3e('0x52')]()[_0x2e3e('0x28')](respondWithResult(_0x46ebfa,null))['catch'](handleError(_0x46ebfa,null));};exports[_0x2e3e('0x53')]=function(_0x39cbb1,_0x46b8e0,_0x5e270b){var _0x549bf1={'raw':!![],'where':{}},_0x5cfbfa={},_0x504177;return db[_0x2e3e('0x2f')][_0x2e3e('0x54')]({'where':{'id':_0x39cbb1[_0x2e3e('0x48')]['id']}})[_0x2e3e('0x28')](handleEntityNotFound(_0x46b8e0,null))[_0x2e3e('0x28')](function(_0x5afe8a){if(_0x5afe8a){_0x504177=_0x5afe8a[_0x2e3e('0x29')]({'plain':!![]});_0x5cfbfa['model']=_[_0x2e3e('0x34')](db[_0x2e3e('0x55')][_0x2e3e('0x30')]);_0x5cfbfa['query']=_['keys'](_0x39cbb1['query']);_0x5cfbfa['filters']=_[_0x2e3e('0x36')](_0x5cfbfa[_0x2e3e('0x31')],_0x5cfbfa['query']);_0x549bf1[_0x2e3e('0x37')]=_[_0x2e3e('0x36')](_0x5cfbfa[_0x2e3e('0x31')],qs['fields'](_0x39cbb1[_0x2e3e('0x33')][_0x2e3e('0x38')]));_0x549bf1[_0x2e3e('0x37')]=_0x549bf1['attributes'][_0x2e3e('0x39')]?_0x549bf1[_0x2e3e('0x37')]:_0x5cfbfa['model'];if(!_0x39cbb1[_0x2e3e('0x33')]['hasOwnProperty'](_0x2e3e('0x3a'))){_0x549bf1[_0x2e3e('0x21')]=qs[_0x2e3e('0x21')](_0x39cbb1['query']['limit']);_0x549bf1[_0x2e3e('0x1f')]=qs[_0x2e3e('0x1f')](_0x39cbb1[_0x2e3e('0x33')][_0x2e3e('0x1f')]);}_0x549bf1[_0x2e3e('0x3b')]=qs[_0x2e3e('0x3c')](_0x39cbb1[_0x2e3e('0x33')][_0x2e3e('0x3c')]);_0x549bf1[_0x2e3e('0x3d')]=qs[_0x2e3e('0x35')](_[_0x2e3e('0x3e')](_0x39cbb1[_0x2e3e('0x33')],_0x5cfbfa[_0x2e3e('0x35')]));_0x549bf1[_0x2e3e('0x3d')]['WhatsappQueueId']=_0x5afe8a['id'];if(_0x39cbb1[_0x2e3e('0x33')][_0x2e3e('0x3f')]){_0x549bf1[_0x2e3e('0x3d')]=_[_0x2e3e('0x41')](_0x549bf1[_0x2e3e('0x3d')],{'$or':_[_0x2e3e('0x32')](_0x549bf1[_0x2e3e('0x37')],function(_0x265354){var _0x2ac7e1={};_0x2ac7e1[_0x265354]={'$like':'%'+_0x39cbb1[_0x2e3e('0x33')]['filter']+'%'};return _0x2ac7e1;})});}_0x549bf1=_[_0x2e3e('0x41')]({},_0x549bf1,_0x39cbb1[_0x2e3e('0x56')]);return db[_0x2e3e('0x55')][_0x2e3e('0x44')](_0x549bf1);}})[_0x2e3e('0x28')](function(_0x52d13e){if(_0x52d13e){return db[_0x2e3e('0x57')][_0x2e3e('0x58')]({'where':{'id':_[_0x2e3e('0x32')](_0x52d13e,_0x2e3e('0x59')),'role':'agent'},'attributes':['id',_0x2e3e('0x2e'),'whatsappPause',_0x2e3e('0x5a'),_0x2e3e('0x5b')]});}})[_0x2e3e('0x28')](function(_0x5d4e17){if(_0x5d4e17){return{'count':_0x5d4e17[_0x2e3e('0x22')],'rows':_['map'](_0x5d4e17[_0x2e3e('0x45')],function(_0x20857e){return{'membername':_0x20857e[_0x2e3e('0x2e')],'UserId':_0x20857e['id'],'queue_name':_0x504177[_0x2e3e('0x2e')],'WhatsappQueueId':_0x504177['id'],'interface':util[_0x2e3e('0x5c')](_0x2e3e('0x5d'),_0x2e3e('0x5e'),_0x20857e[_0x2e3e('0x2e')]),'penalty':0x0,'paused':_0x20857e[_0x2e3e('0x5f')],'createdAt':_0x20857e[_0x2e3e('0x5b')],'updatedAt':_0x20857e[_0x2e3e('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x46b8e0,_0x549bf1))['catch'](handleError(_0x46b8e0,null));};exports[_0x2e3e('0x60')]=function(_0xb44a9b,_0x3f65ed,_0x3288ab){var _0x29ef00={};var _0x48515={};var _0x3953e7;var _0x56233d;return db[_0x2e3e('0x2f')][_0x2e3e('0x54')]({'where':{'id':_0xb44a9b['params']['id']}})['then'](handleEntityNotFound(_0x3f65ed,null))[_0x2e3e('0x28')](function(_0x4c0a71){if(_0x4c0a71){_0x3953e7=_0x4c0a71;_0x48515[_0x2e3e('0x31')]=_[_0x2e3e('0x34')](db[_0x2e3e('0x61')][_0x2e3e('0x30')]);_0x48515[_0x2e3e('0x33')]=_['keys'](_0xb44a9b[_0x2e3e('0x33')]);_0x48515['filters']=_[_0x2e3e('0x36')](_0x48515[_0x2e3e('0x31')],_0x48515[_0x2e3e('0x33')]);_0x29ef00[_0x2e3e('0x37')]=_['intersection'](_0x48515[_0x2e3e('0x31')],qs[_0x2e3e('0x38')](_0xb44a9b[_0x2e3e('0x33')][_0x2e3e('0x38')]));_0x29ef00[_0x2e3e('0x37')]=_0x29ef00[_0x2e3e('0x37')][_0x2e3e('0x39')]?_0x29ef00[_0x2e3e('0x37')]:_0x48515['model'];_0x29ef00['order']=qs[_0x2e3e('0x3c')](_0xb44a9b['query'][_0x2e3e('0x3c')]);_0x29ef00[_0x2e3e('0x3d')]=qs[_0x2e3e('0x35')](_['pick'](_0xb44a9b[_0x2e3e('0x33')],_0x48515[_0x2e3e('0x35')]));if(_0xb44a9b[_0x2e3e('0x33')]['filter']){_0x29ef00[_0x2e3e('0x3d')]=_[_0x2e3e('0x41')](_0x29ef00[_0x2e3e('0x3d')],{'$or':_[_0x2e3e('0x32')](_0x29ef00['attributes'],function(_0x2c3834){var _0x521ae0={};_0x521ae0[_0x2c3834]={'$like':'%'+_0xb44a9b[_0x2e3e('0x33')][_0x2e3e('0x3f')]+'%'};return _0x521ae0;})});}_0x29ef00=_['merge']({},_0x29ef00,_0xb44a9b[_0x2e3e('0x56')]);return _0x3953e7[_0x2e3e('0x60')](_0x29ef00);}})[_0x2e3e('0x28')](function(_0x42139d){if(_0x42139d){_0x56233d=_0x42139d[_0x2e3e('0x39')];if(!_0xb44a9b['query']['hasOwnProperty'](_0x2e3e('0x3a'))){_0x29ef00[_0x2e3e('0x21')]=qs[_0x2e3e('0x21')](_0xb44a9b[_0x2e3e('0x33')][_0x2e3e('0x21')]);_0x29ef00['offset']=qs[_0x2e3e('0x1f')](_0xb44a9b[_0x2e3e('0x33')][_0x2e3e('0x1f')]);}return _0x3953e7[_0x2e3e('0x60')](_0x29ef00);}})[_0x2e3e('0x28')](function(_0x666416){if(_0x666416){return _0x666416?{'count':_0x56233d,'rows':_0x666416}:null;}})['then'](respondWithResult(_0x3f65ed,null))[_0x2e3e('0x46')](handleError(_0x3f65ed,null));};exports[_0x2e3e('0x62')]=function(_0x4bebbd,_0x765584,_0x5069b4){var _0x24e5a0=_0x4bebbd['body'][_0x2e3e('0x63')];return db[_0x2e3e('0x61')][_0x2e3e('0x44')]({'where':{'id':_0x24e5a0},'attributes':['id'],'include':[{'model':db[_0x2e3e('0x57')],'as':'Agents','attributes':['id',_0x2e3e('0x2e'),'online',_0x2e3e('0x64'),_0x2e3e('0x65')],'raw':!![]}]})['then'](function(_0x23f0b3){if(_0x23f0b3){var _0x2f715b=_[_0x2e3e('0x66')](_0x23f0b3,function(_0x381f31){var _0x44b134=_0x381f31[_0x2e3e('0x29')]({'plain':!![]});return _0x44b134[_0x2e3e('0x67')];});return db[_0x2e3e('0x2f')][_0x2e3e('0x49')]({'where':{'id':_0x4bebbd[_0x2e3e('0x48')]['id']}})[_0x2e3e('0x28')](function(_0x596f00){return db[_0x2e3e('0x68')][_0x2e3e('0x69')](function(_0x159765){return _0x596f00[_0x2e3e('0x62')](_0x24e5a0,{'transaction':_0x159765})[_0x2e3e('0x28')](function(){return BPromise['each'](_0x2f715b,function(_0x120d26){return db[_0x2e3e('0x55')][_0x2e3e('0x6a')]({'where':{'UserId':_0x120d26['id'],'WhatsappQueueId':_0x4bebbd['params']['id']},'transaction':_0x159765});});})['then'](function(){_0x2f715b[_0x2e3e('0x6b')](function(_0x638f9a){socket[_0x2e3e('0x6c')](_0x2e3e('0x6d'),{'UserId':_0x638f9a['id'],'WhatsappQueueId':_0x596f00['id']});});});});});}})[_0x2e3e('0x28')](respondWithStatusCode(_0x765584,null))[_0x2e3e('0x46')](handleError(_0x765584,null));};exports[_0x2e3e('0x6e')]=function(_0x241a94,_0x478a5d,_0x22aedc){return db[_0x2e3e('0x61')][_0x2e3e('0x44')]({'where':{'id':_0x241a94[_0x2e3e('0x33')][_0x2e3e('0x63')]},'attributes':['id'],'include':[{'model':db[_0x2e3e('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2e3e('0x28')](handleEntityNotFound(_0x478a5d,null))[_0x2e3e('0x28')](function(_0x482a20){var _0x5d9bfb=_[_0x2e3e('0x32')](_0x482a20,'id');var _0x288a2e=[];var _0x23f670=[];var _0x1eee13=squel[_0x2e3e('0x6f')]();_0x1eee13[_0x2e3e('0x70')](_0x2e3e('0x71'))[_0x2e3e('0x72')](_0x2e3e('0x73'),'tq')[_0x2e3e('0x74')]('user_has_teams','ut',_0x2e3e('0x75'))[_0x2e3e('0x3d')](_0x2e3e('0x76'),_0x241a94[_0x2e3e('0x48')]['id']);for(var _0x44716e=0x0;_0x44716e<_0x482a20['length'];_0x44716e+=0x1){let _0x2957ab=_0x482a20[_0x44716e];for(var _0x4f3ede=0x0;_0x4f3ede<_0x2957ab[_0x2e3e('0x67')][_0x2e3e('0x39')];_0x4f3ede+=0x1){let _0xd46651=_0x2957ab[_0x2e3e('0x67')][_0x4f3ede];var _0x4b4358=_0x1eee13[_0x2e3e('0x77')]();_0x4b4358[_0x2e3e('0x3d')]('ut.UserId\x20=\x20?',_0xd46651['id']);_0x23f670[_0x2e3e('0x78')](db[_0x2e3e('0x68')][_0x2e3e('0x33')](_0x4b4358[_0x2e3e('0x79')](),{'type':db[_0x2e3e('0x68')][_0x2e3e('0x7a')]['SELECT']})[_0x2e3e('0x28')](function(_0x40d4fe){if(_0x40d4fe['length']===0x1){return _0xd46651['id'];}else{var _0x5b74d7=_['every'](_[_0x2e3e('0x32')](_0x40d4fe,'TeamId'),function(_0x3326c3){return _[_0x2e3e('0x7b')](_0x5d9bfb,_0x3326c3);});if(_0x5b74d7){return _0xd46651['id'];}}}));}}return BPromise['all'](_0x23f670)[_0x2e3e('0x28')](function(_0x34574b){_0x288a2e=_(_0x288a2e)[_0x2e3e('0x7c')](_0x34574b)[_0x2e3e('0x7d')]()['value']();return db['WhatsappQueue'][_0x2e3e('0x49')]({'where':{'id':_0x241a94[_0x2e3e('0x48')]['id']}})[_0x2e3e('0x28')](function(_0x44ccaf){return db[_0x2e3e('0x68')][_0x2e3e('0x69')](function(_0x545e9e){return _0x44ccaf['removeTeams'](_0x241a94[_0x2e3e('0x33')][_0x2e3e('0x63')],{'transaction':_0x545e9e})['then'](function(){if(!_[_0x2e3e('0x7e')](_0x288a2e)){return _0x44ccaf[_0x2e3e('0x7f')](_0x288a2e,{'transaction':_0x545e9e});}})['then'](function(){_0x288a2e[_0x2e3e('0x6b')](function(_0x2bf1f8){socket[_0x2e3e('0x6c')](_0x2e3e('0x80'),{'UserId':_0x2bf1f8,'WhatsappQueueId':_0x44ccaf['id']});});});});});});})[_0x2e3e('0x28')](respondWithStatusCode(_0x478a5d,null))['catch'](handleError(_0x478a5d,null));};exports[_0x2e3e('0x81')]=function(_0x5ea9d7,_0x11bc2c,_0x1b3465){return db['WhatsappQueue']['find']({'where':{'id':_0x5ea9d7[_0x2e3e('0x48')]['id']}})[_0x2e3e('0x28')](handleEntityNotFound(_0x11bc2c,null))[_0x2e3e('0x28')](function(_0x4daaf8){if(_0x4daaf8){return _0x4daaf8[_0x2e3e('0x81')](_0x5ea9d7[_0x2e3e('0x4b')][_0x2e3e('0x63')],_[_0x2e3e('0x82')](_0x5ea9d7['body'],[_0x2e3e('0x63'),'id'])||{})['spread'](function(_0x5a01c4){for(var _0x163eb0=0x0;_0x163eb0<_0x5ea9d7[_0x2e3e('0x4b')][_0x2e3e('0x63')][_0x2e3e('0x39')];_0x163eb0+=0x1){socket[_0x2e3e('0x6c')](_0x2e3e('0x6d'),{'UserId':Number(_0x5ea9d7[_0x2e3e('0x4b')]['ids'][_0x163eb0]),'WhatsappQueueId':Number(_0x5ea9d7['params']['id'])});}return _0x5a01c4;});}})['then'](respondWithResult(_0x11bc2c,null))[_0x2e3e('0x46')](handleError(_0x11bc2c,null));};exports['removeAgents']=function(_0x2365ef,_0xa5df09,_0x5144ec){return db[_0x2e3e('0x2f')][_0x2e3e('0x49')]({'where':{'id':_0x2365ef[_0x2e3e('0x48')]['id']}})[_0x2e3e('0x28')](handleEntityNotFound(_0xa5df09,null))['then'](function(_0x3264f6){if(_0x3264f6){return _0x3264f6[_0x2e3e('0x7f')](_0x2365ef[_0x2e3e('0x33')][_0x2e3e('0x63')])[_0x2e3e('0x28')](function(){if(_[_0x2e3e('0x83')](_0x2365ef[_0x2e3e('0x33')]['ids'])){for(var _0x4cd39f=0x0;_0x4cd39f<_0x2365ef[_0x2e3e('0x33')][_0x2e3e('0x63')][_0x2e3e('0x39')];_0x4cd39f+=0x1){socket[_0x2e3e('0x6c')](_0x2e3e('0x80'),{'UserId':Number(_0x2365ef[_0x2e3e('0x33')][_0x2e3e('0x63')][_0x4cd39f]),'WhatsappQueueId':Number(_0x2365ef[_0x2e3e('0x48')]['id'])});}}else{socket[_0x2e3e('0x6c')](_0x2e3e('0x80'),{'UserId':Number(_0x2365ef[_0x2e3e('0x33')][_0x2e3e('0x63')]),'WhatsappQueueId':Number(_0x2365ef['params']['id'])});}});}})[_0x2e3e('0x28')](respondWithStatusCode(_0xa5df09,null))[_0x2e3e('0x46')](handleError(_0xa5df09,null));};exports[_0x2e3e('0x84')]=function(_0x473436,_0x55f956,_0x2dd7ee){var _0x5d0a24={};var _0x2caacc={};var _0x38f67c;var _0x4bfa6c;return db[_0x2e3e('0x2f')]['findOne']({'where':{'id':_0x473436[_0x2e3e('0x48')]['id']}})[_0x2e3e('0x28')](handleEntityNotFound(_0x55f956,null))[_0x2e3e('0x28')](function(_0x320a40){if(_0x320a40){_0x38f67c=_0x320a40;_0x2caacc[_0x2e3e('0x31')]=_[_0x2e3e('0x34')](db[_0x2e3e('0x57')][_0x2e3e('0x30')]);_0x2caacc[_0x2e3e('0x33')]=_[_0x2e3e('0x34')](_0x473436[_0x2e3e('0x33')]);_0x2caacc['filters']=_[_0x2e3e('0x36')](_0x2caacc['model'],_0x2caacc[_0x2e3e('0x33')]);_0x5d0a24[_0x2e3e('0x37')]=_['intersection'](_0x2caacc['model'],qs[_0x2e3e('0x38')](_0x473436['query'][_0x2e3e('0x38')]));_0x5d0a24[_0x2e3e('0x37')]=_0x5d0a24[_0x2e3e('0x37')][_0x2e3e('0x39')]?_0x5d0a24[_0x2e3e('0x37')]:_0x2caacc['model'];_0x5d0a24[_0x2e3e('0x3b')]=qs['sort'](_0x473436[_0x2e3e('0x33')][_0x2e3e('0x3c')]);_0x5d0a24[_0x2e3e('0x3d')]=qs['filters'](_[_0x2e3e('0x3e')](_0x473436[_0x2e3e('0x33')],_0x2caacc['filters']));if(_0x473436['query'][_0x2e3e('0x3f')]){_0x5d0a24[_0x2e3e('0x3d')]=_[_0x2e3e('0x41')](_0x5d0a24[_0x2e3e('0x3d')],{'$or':_['map'](_0x5d0a24[_0x2e3e('0x37')],function(_0xd66b12){var _0x9738ab={};_0x9738ab[_0xd66b12]={'$like':'%'+_0x473436['query'][_0x2e3e('0x3f')]+'%'};return _0x9738ab;})});}_0x5d0a24=_[_0x2e3e('0x41')]({},_0x5d0a24,_0x473436[_0x2e3e('0x56')]);return _0x38f67c[_0x2e3e('0x84')](_0x5d0a24);}})[_0x2e3e('0x28')](function(_0x6ebc56){if(_0x6ebc56){_0x4bfa6c=_0x6ebc56['length'];if(!_0x473436[_0x2e3e('0x33')][_0x2e3e('0x85')](_0x2e3e('0x3a'))){_0x5d0a24['limit']=qs['limit'](_0x473436[_0x2e3e('0x33')][_0x2e3e('0x21')]);_0x5d0a24[_0x2e3e('0x1f')]=qs['offset'](_0x473436[_0x2e3e('0x33')][_0x2e3e('0x1f')]);}return _0x38f67c['getAgents'](_0x5d0a24);}})[_0x2e3e('0x28')](function(_0x58e351){if(_0x58e351){return _0x58e351?{'count':_0x4bfa6c,'rows':_0x58e351}:null;}})['then'](respondWithResult(_0x55f956,null))[_0x2e3e('0x46')](handleError(_0x55f956,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 0be107d..b3d3624 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 _0x77ab=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','WhatsappQueue'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0x77ab,0x1ae));var _0xb77a=function(_0x4b97c9,_0x1e55da){_0x4b97c9=_0x4b97c9-0x0;var _0x1ae507=_0x77ab[_0x4b97c9];return _0x1ae507;};'use strict';var EventEmitter=require(_0xb77a('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xb77a('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb77a('0x2')](0x0);var events={'afterCreate':_0xb77a('0x3'),'afterUpdate':'update','afterDestroy':_0xb77a('0x4')};function emitEvent(_0x1298d2){return function(_0x56bc01,_0x40895b,_0x329a66){WhatsappQueueEvents[_0xb77a('0x5')](_0x1298d2+':'+_0x56bc01['id'],_0x56bc01);WhatsappQueueEvents[_0xb77a('0x5')](_0x1298d2,_0x56bc01);_0x329a66(null);};}for(var e in events){if(events[_0xb77a('0x6')](e)){var event=events[e];WhatsappQueue[_0xb77a('0x7')](e,emitEvent(event));}}module[_0xb77a('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x96fd=['emit','setMaxListeners','remove'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0x96fd,0xaf));var _0xd96f=function(_0x12902b,_0xf94700){_0x12902b=_0x12902b-0x0;var _0x21fb0f=_0x96fd[_0x12902b];return _0x21fb0f;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd96f('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd96f('0x1')};function emitEvent(_0x553da1){return function(_0x597725,_0x1b9079,_0x5c29b0){WhatsappQueueEvents['emit'](_0x553da1+':'+_0x597725['id'],_0x597725);WhatsappQueueEvents[_0xd96f('0x2')](_0x553da1,_0x597725);_0x5c29b0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 8c3af6a..d474b83 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 _0xdc38=['WhatsappQueue','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define'];(function(_0x24a591,_0x55c6a0){var _0x35cc83=function(_0x35ed52){while(--_0x35ed52){_0x24a591['push'](_0x24a591['shift']());}};_0x35cc83(++_0x55c6a0);}(_0xdc38,0x181));var _0x8dc3=function(_0x249d1e,_0x151221){_0x249d1e=_0x249d1e-0x0;var _0x4bd85a=_0xdc38[_0x249d1e];return _0x4bd85a;};'use strict';var _=require(_0x8dc3('0x0'));var util=require(_0x8dc3('0x1'));var logger=require('../../config/logger')(_0x8dc3('0x2'));var moment=require(_0x8dc3('0x3'));var BPromise=require(_0x8dc3('0x4'));var rp=require(_0x8dc3('0x5'));var fs=require('fs');var path=require(_0x8dc3('0x6'));var rimraf=require(_0x8dc3('0x7'));var config=require('../../config/environment');var attributes=require(_0x8dc3('0x8'));module[_0x8dc3('0x9')]=function(_0x5f2bc9,_0x162283){return _0x5f2bc9[_0x8dc3('0xa')](_0x8dc3('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8847=['moment','bluebird','request-promise','path','../../config/environment','define','WhatsappQueue','whatsapp_queues','api'];(function(_0x3e9d0f,_0x291760){var _0x215d13=function(_0x2ae831){while(--_0x2ae831){_0x3e9d0f['push'](_0x3e9d0f['shift']());}};_0x215d13(++_0x291760);}(_0x8847,0x14c));var _0x7884=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x8847[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7884('0x0'));var moment=require(_0x7884('0x1'));var BPromise=require(_0x7884('0x2'));var rp=require(_0x7884('0x3'));var fs=require('fs');var path=require(_0x7884('0x4'));var rimraf=require('rimraf');var config=require(_0x7884('0x5'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x266f2f,_0x4bc1b6){return _0x266f2f[_0x7884('0x6')](_0x7884('0x7'),attributes,{'tableName':_0x7884('0x8'),'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 1d78382..c97ea4d 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 _0x40c0=['redis','localhost','./whatsappQueue.socket','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetWhatsappQueue','WhatsappQueue','findAll','options','where','attributes','limit','include','map','model','catch','find','raw','debug','ShowWhatsappQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0x40c0,0x17a));var _0x040c=function(_0x2af732,_0x852a76){_0x2af732=_0x2af732-0x0;var _0x2f0a55=_0x40c0[_0x2af732];return _0x2f0a55;};'use strict';var _=require(_0x040c('0x0'));var util=require(_0x040c('0x1'));var moment=require(_0x040c('0x2'));var BPromise=require(_0x040c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x040c('0x4'));var db=require(_0x040c('0x5'))['db'];var utils=require(_0x040c('0x6'));var logger=require(_0x040c('0x7'))(_0x040c('0x8'));var config=require(_0x040c('0x9'));var jayson=require(_0x040c('0xa'));var client=jayson['client'][_0x040c('0xb')]({'port':0x232a});config[_0x040c('0xc')]=_['defaults'](config[_0x040c('0xc')],{'host':_0x040c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x040c('0xc')]));require(_0x040c('0xe'))['register'](socket);function respondWithRpcPromise(_0xca7a21,_0x1e3b4d,_0x5f0703){return new BPromise(function(_0x1abecb,_0x2f9262){return client['request'](_0xca7a21,_0x5f0703)[_0x040c('0xf')](function(_0x50fcf4){logger['info'](_0x040c('0x10'),_0x1e3b4d,_0x040c('0x11'));logger['debug'](_0x040c('0x12'),_0x1e3b4d,'request\x20sent',JSON[_0x040c('0x13')](_0x50fcf4));if(_0x50fcf4[_0x040c('0x14')]){if(_0x50fcf4[_0x040c('0x14')][_0x040c('0x15')]===0x1f4){logger[_0x040c('0x14')]('WhatsappQueue,\x20%s,\x20%s',_0x1e3b4d,_0x50fcf4['error'][_0x040c('0x16')]);return _0x2f9262(_0x50fcf4['error'][_0x040c('0x16')]);}logger[_0x040c('0x14')](_0x040c('0x10'),_0x1e3b4d,_0x50fcf4['error'][_0x040c('0x16')]);return _0x1abecb(_0x50fcf4[_0x040c('0x14')]['message']);}else{logger[_0x040c('0x17')](_0x040c('0x10'),_0x1e3b4d,'request\x20sent');_0x1abecb(_0x50fcf4['result']['message']);}})['catch'](function(_0x4681f1){logger[_0x040c('0x14')](_0x040c('0x10'),_0x1e3b4d,_0x4681f1);_0x2f9262(_0x4681f1);});});}exports[_0x040c('0x18')]=function(_0x545999){var _0x5385f2=this;return new Promise(function(_0x300957,_0x22b03b){return db[_0x040c('0x19')][_0x040c('0x1a')]({'raw':_0x545999[_0x040c('0x1b')]?_0x545999[_0x040c('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x545999['options']?_0x545999[_0x040c('0x1b')][_0x040c('0x1c')]||null:null,'attributes':_0x545999['options']?_0x545999[_0x040c('0x1b')][_0x040c('0x1d')]||null:null,'limit':_0x545999['options']?_0x545999['options'][_0x040c('0x1e')]||null:null,'include':_0x545999['options']?_0x545999[_0x040c('0x1b')][_0x040c('0x1f')]?_[_0x040c('0x20')](_0x545999[_0x040c('0x1b')]['include'],function(_0x2781f0){return{'model':db[_0x2781f0['model']],'as':_0x2781f0['as'],'attributes':_0x2781f0['attributes'],'include':_0x2781f0[_0x040c('0x1f')]?_[_0x040c('0x20')](_0x2781f0[_0x040c('0x1f')],function(_0x2713fb){return{'model':db[_0x2713fb[_0x040c('0x21')]],'as':_0x2713fb['as'],'attributes':_0x2713fb['attributes'],'include':_0x2713fb[_0x040c('0x1f')]?_[_0x040c('0x20')](_0x2713fb[_0x040c('0x1f')],function(_0x283ef7){return{'model':db[_0x283ef7[_0x040c('0x21')]],'as':_0x283ef7['as'],'attributes':_0x283ef7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xdff33d){logger[_0x040c('0x17')](_0x040c('0x18'),_0x545999);logger['debug'](_0x040c('0x18'),_0x545999,JSON[_0x040c('0x13')](_0xdff33d));_0x300957(_0xdff33d);})[_0x040c('0x22')](function(_0x7e5687){logger[_0x040c('0x14')](_0x040c('0x18'),_0x7e5687[_0x040c('0x16')],_0x545999);_0x22b03b(_0x5385f2[_0x040c('0x14')](0x1f4,_0x7e5687[_0x040c('0x16')]));});});};exports['ShowWhatsappQueue']=function(_0x5bb253){var _0x591b6f=this;return new Promise(function(_0x585b89,_0x2e2ba6){return db[_0x040c('0x19')][_0x040c('0x23')]({'raw':_0x5bb253['options']?_0x5bb253[_0x040c('0x1b')][_0x040c('0x24')]===undefined?!![]:![]:!![],'where':_0x5bb253['options']?_0x5bb253['options']['where']||null:null,'attributes':_0x5bb253[_0x040c('0x1b')]?_0x5bb253[_0x040c('0x1b')][_0x040c('0x1d')]||null:null,'include':_0x5bb253[_0x040c('0x1b')]?_0x5bb253[_0x040c('0x1b')]['include']?_[_0x040c('0x20')](_0x5bb253[_0x040c('0x1b')][_0x040c('0x1f')],function(_0x40e2f6){return{'model':db[_0x40e2f6['model']],'as':_0x40e2f6['as'],'attributes':_0x40e2f6[_0x040c('0x1d')],'include':_0x40e2f6['include']?_[_0x040c('0x20')](_0x40e2f6[_0x040c('0x1f')],function(_0x2308fa){return{'model':db[_0x2308fa[_0x040c('0x21')]],'as':_0x2308fa['as'],'attributes':_0x2308fa[_0x040c('0x1d')],'include':_0x2308fa[_0x040c('0x1f')]?_[_0x040c('0x20')](_0x2308fa[_0x040c('0x1f')],function(_0x24a2bf){return{'model':db[_0x24a2bf['model']],'as':_0x24a2bf['as'],'attributes':_0x24a2bf[_0x040c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x040c('0xf')](function(_0x5ca33b){logger['info']('ShowWhatsappQueue',_0x5bb253);logger[_0x040c('0x25')](_0x040c('0x26'),_0x5bb253,JSON['stringify'](_0x5ca33b));_0x585b89(_0x5ca33b);})[_0x040c('0x22')](function(_0x4d9734){logger['error'](_0x040c('0x26'),_0x4d9734['message'],_0x5bb253);_0x2e2ba6(_0x591b6f[_0x040c('0x14')](0x1f4,_0x4d9734[_0x040c('0x16')]));});});}; \ No newline at end of file +var _0xed54=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter','./whatsappQueue.socket','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','WhatsappQueue','findAll','options','raw','attributes','limit','include','model','map','then','GetWhatsappQueue','find','ShowWhatsappQueue','lodash'];(function(_0x12ce9c,_0x2cba3d){var _0x13be73=function(_0x2041f6){while(--_0x2041f6){_0x12ce9c['push'](_0x12ce9c['shift']());}};_0x13be73(++_0x2cba3d);}(_0xed54,0xe3));var _0x4ed5=function(_0x451c99,_0x4e9e4d){_0x451c99=_0x451c99-0x0;var _0x51304c=_0xed54[_0x451c99];return _0x51304c;};'use strict';var _=require(_0x4ed5('0x0'));var util=require(_0x4ed5('0x1'));var moment=require(_0x4ed5('0x2'));var BPromise=require(_0x4ed5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ed5('0x4'));var db=require(_0x4ed5('0x5'))['db'];var utils=require(_0x4ed5('0x6'));var logger=require(_0x4ed5('0x7'))(_0x4ed5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4ed5('0x9')][_0x4ed5('0xa')]({'port':0x232a});config[_0x4ed5('0xb')]=_['defaults'](config[_0x4ed5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ed5('0xc'))(new Redis(config[_0x4ed5('0xb')]));require(_0x4ed5('0xd'))['register'](socket);function respondWithRpcPromise(_0x216617,_0x1e9dca,_0x5bf3a6){return new BPromise(function(_0x368042,_0x45fa5a){return client['request'](_0x216617,_0x5bf3a6)['then'](function(_0x2443dc){logger[_0x4ed5('0xe')](_0x4ed5('0xf'),_0x1e9dca,'request\x20sent');logger[_0x4ed5('0x10')](_0x4ed5('0x11'),_0x1e9dca,'request\x20sent',JSON[_0x4ed5('0x12')](_0x2443dc));if(_0x2443dc['error']){if(_0x2443dc[_0x4ed5('0x13')][_0x4ed5('0x14')]===0x1f4){logger[_0x4ed5('0x13')](_0x4ed5('0xf'),_0x1e9dca,_0x2443dc[_0x4ed5('0x13')]['message']);return _0x45fa5a(_0x2443dc[_0x4ed5('0x13')][_0x4ed5('0x15')]);}logger[_0x4ed5('0x13')]('WhatsappQueue,\x20%s,\x20%s',_0x1e9dca,_0x2443dc[_0x4ed5('0x13')]['message']);return _0x368042(_0x2443dc[_0x4ed5('0x13')]['message']);}else{logger[_0x4ed5('0xe')]('WhatsappQueue,\x20%s,\x20%s',_0x1e9dca,_0x4ed5('0x16'));_0x368042(_0x2443dc[_0x4ed5('0x17')][_0x4ed5('0x15')]);}})[_0x4ed5('0x18')](function(_0x3d913f){logger[_0x4ed5('0x13')](_0x4ed5('0xf'),_0x1e9dca,_0x3d913f);_0x45fa5a(_0x3d913f);});});}exports['GetWhatsappQueue']=function(_0x20b5c7){var _0xb19ed2=this;return new Promise(function(_0x54de37,_0x773ac){return db[_0x4ed5('0x19')][_0x4ed5('0x1a')]({'raw':_0x20b5c7[_0x4ed5('0x1b')]?_0x20b5c7[_0x4ed5('0x1b')][_0x4ed5('0x1c')]===undefined?!![]:![]:!![],'where':_0x20b5c7[_0x4ed5('0x1b')]?_0x20b5c7[_0x4ed5('0x1b')]['where']||null:null,'attributes':_0x20b5c7[_0x4ed5('0x1b')]?_0x20b5c7['options'][_0x4ed5('0x1d')]||null:null,'limit':_0x20b5c7[_0x4ed5('0x1b')]?_0x20b5c7[_0x4ed5('0x1b')][_0x4ed5('0x1e')]||null:null,'include':_0x20b5c7['options']?_0x20b5c7[_0x4ed5('0x1b')][_0x4ed5('0x1f')]?_['map'](_0x20b5c7['options'][_0x4ed5('0x1f')],function(_0x2e220d){return{'model':db[_0x2e220d[_0x4ed5('0x20')]],'as':_0x2e220d['as'],'attributes':_0x2e220d[_0x4ed5('0x1d')],'include':_0x2e220d[_0x4ed5('0x1f')]?_[_0x4ed5('0x21')](_0x2e220d[_0x4ed5('0x1f')],function(_0x44d5df){return{'model':db[_0x44d5df['model']],'as':_0x44d5df['as'],'attributes':_0x44d5df[_0x4ed5('0x1d')],'include':_0x44d5df['include']?_[_0x4ed5('0x21')](_0x44d5df['include'],function(_0x1ca566){return{'model':db[_0x1ca566[_0x4ed5('0x20')]],'as':_0x1ca566['as'],'attributes':_0x1ca566[_0x4ed5('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4ed5('0x22')](function(_0x24cce4){logger[_0x4ed5('0xe')](_0x4ed5('0x23'),_0x20b5c7);logger[_0x4ed5('0x10')]('GetWhatsappQueue',_0x20b5c7,JSON[_0x4ed5('0x12')](_0x24cce4));_0x54de37(_0x24cce4);})[_0x4ed5('0x18')](function(_0x4f6b48){logger[_0x4ed5('0x13')](_0x4ed5('0x23'),_0x4f6b48[_0x4ed5('0x15')],_0x20b5c7);_0x773ac(_0xb19ed2[_0x4ed5('0x13')](0x1f4,_0x4f6b48[_0x4ed5('0x15')]));});});};exports['ShowWhatsappQueue']=function(_0x42136a){var _0x28b0a2=this;return new Promise(function(_0x37c779,_0x5c6322){return db[_0x4ed5('0x19')][_0x4ed5('0x24')]({'raw':_0x42136a[_0x4ed5('0x1b')]?_0x42136a['options'][_0x4ed5('0x1c')]===undefined?!![]:![]:!![],'where':_0x42136a[_0x4ed5('0x1b')]?_0x42136a[_0x4ed5('0x1b')]['where']||null:null,'attributes':_0x42136a[_0x4ed5('0x1b')]?_0x42136a[_0x4ed5('0x1b')]['attributes']||null:null,'include':_0x42136a[_0x4ed5('0x1b')]?_0x42136a['options'][_0x4ed5('0x1f')]?_['map'](_0x42136a[_0x4ed5('0x1b')]['include'],function(_0x5570de){return{'model':db[_0x5570de[_0x4ed5('0x20')]],'as':_0x5570de['as'],'attributes':_0x5570de[_0x4ed5('0x1d')],'include':_0x5570de[_0x4ed5('0x1f')]?_[_0x4ed5('0x21')](_0x5570de[_0x4ed5('0x1f')],function(_0x40edf8){return{'model':db[_0x40edf8[_0x4ed5('0x20')]],'as':_0x40edf8['as'],'attributes':_0x40edf8['attributes'],'include':_0x40edf8[_0x4ed5('0x1f')]?_[_0x4ed5('0x21')](_0x40edf8[_0x4ed5('0x1f')],function(_0x202a13){return{'model':db[_0x202a13[_0x4ed5('0x20')]],'as':_0x202a13['as'],'attributes':_0x202a13[_0x4ed5('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c0ef6){logger['info'](_0x4ed5('0x25'),_0x42136a);logger[_0x4ed5('0x10')](_0x4ed5('0x25'),_0x42136a,JSON['stringify'](_0x5c0ef6));_0x37c779(_0x5c0ef6);})[_0x4ed5('0x18')](function(_0x5a6882){logger[_0x4ed5('0x13')](_0x4ed5('0x25'),_0x5a6882[_0x4ed5('0x15')],_0x42136a);_0x5c6322(_0x28b0a2['error'](0x1f4,_0x5a6882[_0x4ed5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index f010d38..ff95fb6 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 _0xd50d=['./whatsappQueue.events','save','remove','update','emit','length'];(function(_0x388f73,_0x3415e5){var _0x494c06=function(_0x58b0c7){while(--_0x58b0c7){_0x388f73['push'](_0x388f73['shift']());}};_0x494c06(++_0x3415e5);}(_0xd50d,0x12c));var _0xdd50=function(_0x294a05,_0x2c38d1){_0x294a05=_0x294a05-0x0;var _0x327597=_0xd50d[_0x294a05];return _0x327597;};'use strict';var WhatsappQueueEvents=require(_0xdd50('0x0'));var events=[_0xdd50('0x1'),_0xdd50('0x2'),_0xdd50('0x3')];function createListener(_0x4efedb,_0x5021e5){return function(_0x4fc050){_0x5021e5[_0xdd50('0x4')](_0x4efedb,_0x4fc050);};}function removeListener(_0x244c54,_0x5e6518){return function(){WhatsappQueueEvents['removeListener'](_0x244c54,_0x5e6518);};}exports['register']=function(_0x2dd898){for(var _0x1f331b=0x0,_0x5ec7c9=events[_0xdd50('0x5')];_0x1f331b<_0x5ec7c9;_0x1f331b++){var _0x5ae68c=events[_0x1f331b];var _0x29d450=createListener('whatsappQueue:'+_0x5ae68c,_0x2dd898);WhatsappQueueEvents['on'](_0x5ae68c,_0x29d450);}}; \ No newline at end of file +var _0x6b6d=['whatsappQueue:','save','update','emit','removeListener','register','length'];(function(_0x435f59,_0x504031){var _0xf723bd=function(_0xca7ede){while(--_0xca7ede){_0x435f59['push'](_0x435f59['shift']());}};_0xf723bd(++_0x504031);}(_0x6b6d,0x78));var _0xd6b6=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x6b6d[_0x11a220];return _0x20d8fe;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xd6b6('0x0'),'remove',_0xd6b6('0x1')];function createListener(_0x5810e6,_0x5d54e9){return function(_0x418589){_0x5d54e9[_0xd6b6('0x2')](_0x5810e6,_0x418589);};}function removeListener(_0x1edfd8,_0x5aa115){return function(){WhatsappQueueEvents[_0xd6b6('0x3')](_0x1edfd8,_0x5aa115);};}exports[_0xd6b6('0x4')]=function(_0xc37899){for(var _0x5e9070=0x0,_0x1acc19=events[_0xd6b6('0x5')];_0x5e9070<_0x1acc19;_0x5e9070++){var _0xf93b38=events[_0x5e9070];var _0x165450=createListener(_0xd6b6('0x6')+_0xf93b38,_0xc37899);WhatsappQueueEvents['on'](_0xf93b38,_0x165450);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 7178e4e..e552033 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 _0xd306=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xc0be9,_0xcb992f){var _0x4f624c=function(_0x2d5136){while(--_0x2d5136){_0xc0be9['push'](_0xc0be9['shift']());}};_0x4f624c(++_0xcb992f);}(_0xd306,0x161));var _0x6d30=function(_0x199673,_0x12cfee){_0x199673=_0x199673-0x0;var _0x3fd53e=_0xd306[_0x199673];return _0x3fd53e;};'use strict';var multer=require(_0x6d30('0x0'));var util=require(_0x6d30('0x1'));var path=require(_0x6d30('0x2'));var timeout=require('connect-timeout');var express=require(_0x6d30('0x3'));var router=express[_0x6d30('0x4')]();var fs_extra=require(_0x6d30('0x5'));var auth=require(_0x6d30('0x6'));var interaction=require(_0x6d30('0x7'));var config=require(_0x6d30('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0x6d30('0x9')]('/',auth[_0x6d30('0xa')](),controller[_0x6d30('0xb')]);router['get'](_0x6d30('0xc'),auth[_0x6d30('0xa')](),controller[_0x6d30('0xd')]);router[_0x6d30('0x9')](_0x6d30('0xe'),auth[_0x6d30('0xa')](),controller[_0x6d30('0xf')]);router['post']('/',auth[_0x6d30('0xa')](),controller[_0x6d30('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6d30('0x11')]);router['delete']('/:id',auth[_0x6d30('0xa')](),controller[_0x6d30('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa1bf=['post','create','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x263f9d,_0x3d854e){var _0x4c4efa=function(_0x48d506){while(--_0x48d506){_0x263f9d['push'](_0x263f9d['shift']());}};_0x4c4efa(++_0x3d854e);}(_0xa1bf,0x78));var _0xfa1b=function(_0x56b288,_0x1ed5ac){_0x56b288=_0x56b288-0x0;var _0x355ae0=_0xa1bf[_0x56b288];return _0x355ae0;};'use strict';var multer=require(_0xfa1b('0x0'));var util=require(_0xfa1b('0x1'));var path=require(_0xfa1b('0x2'));var timeout=require(_0xfa1b('0x3'));var express=require(_0xfa1b('0x4'));var router=express[_0xfa1b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfa1b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfa1b('0x7'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0xfa1b('0x8')](),controller[_0xfa1b('0x9')]);router[_0xfa1b('0xa')](_0xfa1b('0xb'),auth[_0xfa1b('0x8')](),controller[_0xfa1b('0xc')]);router[_0xfa1b('0xa')]('/:id',auth[_0xfa1b('0x8')](),controller['show']);router[_0xfa1b('0xd')]('/',auth[_0xfa1b('0x8')](),controller[_0xfa1b('0xe')]);router['put'](_0xfa1b('0xf'),auth[_0xfa1b('0x8')](),controller[_0xfa1b('0x10')]);router['delete'](_0xfa1b('0xf'),auth[_0xfa1b('0x8')](),controller[_0xfa1b('0x11')]);module[_0xfa1b('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 6d5b138..ef2db4c 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(_0x20712f,_0xd50ff0){var _0x3c0180=function(_0xcdfccc){while(--_0xcdfccc){_0x20712f['push'](_0x20712f['shift']());}};_0x3c0180(++_0xd50ff0);}(_0x7a54,0x106));var _0x47a5=function(_0x4db88c,_0x2890cc){_0x4db88c=_0x4db88c-0x0;var _0x2d9bfe=_0x7a54[_0x4db88c];return _0x2d9bfe;};'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(_0x504e76,_0x3d4ddd){var _0x1bd8ea=function(_0x3f01d6){while(--_0x3f01d6){_0x504e76['push'](_0x504e76['shift']());}};_0x1bd8ea(++_0x3d4ddd);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 b443735..e517d56 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 _0x373d=['order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','show','rawAttributes','includeAll','options','catch','create','body','find','params','describe','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','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappQueueReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x4ededc,_0x58fae6){var _0x4b4035=function(_0xa047d7){while(--_0xa047d7){_0x4ededc['push'](_0x4ededc['shift']());}};_0x4b4035(++_0x58fae6);}(_0x373d,0x1e2));var _0xd373=function(_0x217ce7,_0x592574){_0x217ce7=_0x217ce7-0x0;var _0x4d3f53=_0x373d[_0x217ce7];return _0x4d3f53;};'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'];function respondWithStatusCode(_0x4c7f91,_0x5ab89c){_0x5ab89c=_0x5ab89c||0xcc;return function(_0xcd9b8c){if(_0xcd9b8c){return _0x4c7f91[_0xd373('0x15')](_0x5ab89c);}return _0x4c7f91['status'](_0x5ab89c)[_0xd373('0x16')]();};}function respondWithResult(_0x129475,_0x27c161){_0x27c161=_0x27c161||0xc8;return function(_0x23ed86){if(_0x23ed86){return _0x129475[_0xd373('0x17')](_0x27c161)[_0xd373('0x18')](_0x23ed86);}};}function respondWithFilteredResult(_0x20aca5,_0x2eacb1){return function(_0x5a286a){if(_0x5a286a){var _0x2c5854=typeof _0x2eacb1[_0xd373('0x19')]===_0xd373('0x1a')&&typeof _0x2eacb1[_0xd373('0x1b')]==='undefined';var _0x1e26cf=_0x5a286a['count'];var _0x460259=_0x2c5854?0x0:_0x2eacb1[_0xd373('0x19')];var _0x55c5c7=_0x2c5854?_0x5a286a[_0xd373('0x1c')]:_0x2eacb1['offset']+_0x2eacb1['limit'];var _0x23fada;if(_0x55c5c7>=_0x1e26cf){_0x55c5c7=_0x1e26cf;_0x23fada=0xc8;}else{_0x23fada=0xce;}_0x20aca5[_0xd373('0x17')](_0x23fada);return _0x20aca5[_0xd373('0x1d')](_0xd373('0x1e'),_0x460259+'-'+_0x55c5c7+'/'+_0x1e26cf)[_0xd373('0x18')](_0x5a286a);}return null;};}function patchUpdates(_0x181eb2){return function(_0x4ba510){try{jsonpatch[_0xd373('0x1f')](_0x4ba510,_0x181eb2,!![]);}catch(_0xd808f8){return BPromise[_0xd373('0x20')](_0xd808f8);}return _0x4ba510[_0xd373('0x21')]();};}function saveUpdates(_0x165e21,_0x3aa1c5){return function(_0x4f64bd){if(_0x4f64bd){return _0x4f64bd[_0xd373('0x22')](_0x165e21)[_0xd373('0x23')](function(_0x157f81){return _0x157f81;});}return null;};}function removeEntity(_0x209ca7,_0x217ee7){return function(_0x238ffd){if(_0x238ffd){return _0x238ffd[_0xd373('0x24')]()[_0xd373('0x23')](function(){_0x209ca7[_0xd373('0x17')](0xcc)[_0xd373('0x16')]();});}};}function handleEntityNotFound(_0x437110,_0x34f05a){return function(_0x388182){if(!_0x388182){_0x437110[_0xd373('0x15')](0x194);}return _0x388182;};}function handleError(_0x18d7ab,_0x38ba50){_0x38ba50=_0x38ba50||0x1f4;return function(_0x50b987){logger[_0xd373('0x25')](_0x50b987[_0xd373('0x26')]);if(_0x50b987[_0xd373('0x27')]){delete _0x50b987[_0xd373('0x27')];}_0x18d7ab[_0xd373('0x17')](_0x38ba50)[_0xd373('0x28')](_0x50b987);};}exports[_0xd373('0x29')]=function(_0xf85ca8,_0x2869e5){var _0x158825={},_0xbc420b={},_0x2ee37c={'count':0x0,'rows':[]};var _0x7dad3e=_['map'](db[_0xd373('0x2a')]['rawAttributes'],function(_0x498aaa){return{'name':_0x498aaa[_0xd373('0x2b')],'type':_0x498aaa[_0xd373('0x2c')][_0xd373('0x2d')]};});_0xbc420b[_0xd373('0x2e')]=_[_0xd373('0x2f')](_0x7dad3e,'name');_0xbc420b[_0xd373('0x30')]=_[_0xd373('0x31')](_0xf85ca8['query']);_0xbc420b[_0xd373('0x32')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],_0xbc420b[_0xd373('0x30')]);_0x158825[_0xd373('0x34')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],qs[_0xd373('0x35')](_0xf85ca8[_0xd373('0x30')]['fields']));_0x158825[_0xd373('0x34')]=_0x158825[_0xd373('0x34')][_0xd373('0x36')]?_0x158825[_0xd373('0x34')]:_0xbc420b[_0xd373('0x2e')];if(!_0xf85ca8[_0xd373('0x30')][_0xd373('0x37')](_0xd373('0x38'))){_0x158825[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x1b')]);_0x158825[_0xd373('0x19')]=qs[_0xd373('0x19')](_0xf85ca8[_0xd373('0x30')]['offset']);}_0x158825[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x3a')]);_0x158825['where']=qs[_0xd373('0x32')](_[_0xd373('0x3b')](_0xf85ca8[_0xd373('0x30')],_0xbc420b[_0xd373('0x32')]),_0x7dad3e);if(_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]){_0x158825['where']=_['merge'](_0x158825[_0xd373('0x3d')],{'$or':_['map'](_0x7dad3e,function(_0x37c97e){if(_0x37c97e[_0xd373('0x2c')]!==_0xd373('0x3e')){var _0x51ba69={};_0x51ba69[_0x37c97e[_0xd373('0x27')]]={'$like':'%'+_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]+'%'};return _0x51ba69;}})});}_0x158825=_[_0xd373('0x3f')]({},_0x158825,_0xf85ca8['options']);var _0x513038={'where':_0x158825['where']};return db[_0xd373('0x2a')]['count'](_0x513038)[_0xd373('0x23')](function(_0x2fa6c4){_0x2ee37c['count']=_0x2fa6c4;if(_0xf85ca8['query']['includeAll']){_0x158825[_0xd373('0x40')]=[{'all':!![]}];}return db[_0xd373('0x2a')][_0xd373('0x41')](_0x158825);})['then'](function(_0x5c3b22){_0x2ee37c[_0xd373('0x42')]=_0x5c3b22;return _0x2ee37c;})[_0xd373('0x23')](respondWithFilteredResult(_0x2869e5,_0x158825))['catch'](handleError(_0x2869e5,null));};exports[_0xd373('0x43')]=function(_0x2ee75f,_0x1e3de1){var _0x9989e4={'raw':!![],'where':{'id':_0x2ee75f['params']['id']}},_0x2d8c7d={};_0x2d8c7d['model']=_[_0xd373('0x31')](db[_0xd373('0x2a')][_0xd373('0x44')]);_0x2d8c7d[_0xd373('0x30')]=_['keys'](_0x2ee75f[_0xd373('0x30')]);_0x2d8c7d['filters']=_[_0xd373('0x33')](_0x2d8c7d[_0xd373('0x2e')],_0x2d8c7d[_0xd373('0x30')]);_0x9989e4[_0xd373('0x34')]=_[_0xd373('0x33')](_0x2d8c7d['model'],qs[_0xd373('0x35')](_0x2ee75f[_0xd373('0x30')]['fields']));_0x9989e4[_0xd373('0x34')]=_0x9989e4[_0xd373('0x34')][_0xd373('0x36')]?_0x9989e4[_0xd373('0x34')]:_0x2d8c7d[_0xd373('0x2e')];if(_0x2ee75f[_0xd373('0x30')][_0xd373('0x45')]){_0x9989e4[_0xd373('0x40')]=[{'all':!![]}];}_0x9989e4=_[_0xd373('0x3f')]({},_0x9989e4,_0x2ee75f[_0xd373('0x46')]);return db['WhatsappQueueReport']['find'](_0x9989e4)[_0xd373('0x23')](handleEntityNotFound(_0x1e3de1,null))['then'](respondWithResult(_0x1e3de1,null))[_0xd373('0x47')](handleError(_0x1e3de1,null));};exports['create']=function(_0x5e5279,_0x5cbc16){return db[_0xd373('0x2a')][_0xd373('0x48')](_0x5e5279[_0xd373('0x49')],{})[_0xd373('0x23')](respondWithResult(_0x5cbc16,0xc9))[_0xd373('0x47')](handleError(_0x5cbc16,null));};exports[_0xd373('0x22')]=function(_0x1855aa,_0x4d1088){if(_0x1855aa[_0xd373('0x49')]['id']){delete _0x1855aa['body']['id'];}return db[_0xd373('0x2a')][_0xd373('0x4a')]({'where':{'id':_0x1855aa['params']['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4d1088,null))['then'](saveUpdates(_0x1855aa[_0xd373('0x49')],null))[_0xd373('0x23')](respondWithResult(_0x4d1088,null))[_0xd373('0x47')](handleError(_0x4d1088,null));};exports[_0xd373('0x24')]=function(_0xe22cbd,_0x4bc631){return db['WhatsappQueueReport']['find']({'where':{'id':_0xe22cbd[_0xd373('0x4b')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4bc631,null))['then'](removeEntity(_0x4bc631,null))[_0xd373('0x47')](handleError(_0x4bc631,null));};exports[_0xd373('0x4c')]=function(_0x4d7020,_0xae7067){return db[_0xd373('0x2a')][_0xd373('0x4c')]()[_0xd373('0x23')](respondWithResult(_0xae7067,null))[_0xd373('0x47')](handleError(_0xae7067,null));}; \ No newline at end of file +var _0x282b=['intersection','attributes','model','fields','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','show','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','map','rawAttributes','fieldName','type','key','query','keys'];(function(_0x58374a,_0x3006af){var _0x2b8656=function(_0x29cbd6){while(--_0x29cbd6){_0x58374a['push'](_0x58374a['shift']());}};_0x2b8656(++_0x3006af);}(_0x282b,0xec));var _0xb282=function(_0x2a9fd9,_0x5e9feb){_0x2a9fd9=_0x2a9fd9-0x0;var _0x254f26=_0x282b[_0x2a9fd9];return _0x254f26;};'use strict';var emlformat=require(_0xb282('0x0'));var rimraf=require(_0xb282('0x1'));var zipdir=require(_0xb282('0x2'));var jsonpatch=require(_0xb282('0x3'));var rp=require(_0xb282('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb282('0x5'));var util=require('util');var path=require(_0xb282('0x6'));var sox=require(_0xb282('0x7'));var csv=require(_0xb282('0x8'));var ejs=require(_0xb282('0x9'));var fs=require('fs');var fs_extra=require(_0xb282('0xa'));var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x338bdb,_0xc08746){_0xc08746=_0xc08746||0xcc;return function(_0x40d7b8){if(_0x40d7b8){return _0x338bdb[_0xb282('0x17')](_0xc08746);}return _0x338bdb[_0xb282('0x18')](_0xc08746)['end']();};}function respondWithResult(_0x34c595,_0x5adf7f){_0x5adf7f=_0x5adf7f||0xc8;return function(_0xe1d53){if(_0xe1d53){return _0x34c595[_0xb282('0x18')](_0x5adf7f)['json'](_0xe1d53);}};}function respondWithFilteredResult(_0x525cfa,_0x5bc7c3){return function(_0x13cea1){if(_0x13cea1){var _0x350676=typeof _0x5bc7c3[_0xb282('0x19')]===_0xb282('0x1a')&&typeof _0x5bc7c3[_0xb282('0x1b')]==='undefined';var _0x191a31=_0x13cea1[_0xb282('0x1c')];var _0xca5f12=_0x350676?0x0:_0x5bc7c3[_0xb282('0x19')];var _0x3f8a3f=_0x350676?_0x13cea1['count']:_0x5bc7c3['offset']+_0x5bc7c3[_0xb282('0x1b')];var _0x2cdeb1;if(_0x3f8a3f>=_0x191a31){_0x3f8a3f=_0x191a31;_0x2cdeb1=0xc8;}else{_0x2cdeb1=0xce;}_0x525cfa['status'](_0x2cdeb1);return _0x525cfa[_0xb282('0x1d')](_0xb282('0x1e'),_0xca5f12+'-'+_0x3f8a3f+'/'+_0x191a31)[_0xb282('0x1f')](_0x13cea1);}return null;};}function patchUpdates(_0x438dbe){return function(_0x1c3084){try{jsonpatch['apply'](_0x1c3084,_0x438dbe,!![]);}catch(_0x1de407){return BPromise[_0xb282('0x20')](_0x1de407);}return _0x1c3084[_0xb282('0x21')]();};}function saveUpdates(_0x4b79d7,_0x437d66){return function(_0x2a7ef8){if(_0x2a7ef8){return _0x2a7ef8[_0xb282('0x22')](_0x4b79d7)[_0xb282('0x23')](function(_0x680095){return _0x680095;});}return null;};}function removeEntity(_0x56645f,_0x4d624f){return function(_0x360f15){if(_0x360f15){return _0x360f15[_0xb282('0x24')]()['then'](function(){_0x56645f['status'](0xcc)[_0xb282('0x25')]();});}};}function handleEntityNotFound(_0x114f77,_0x3451e5){return function(_0x3c4018){if(!_0x3c4018){_0x114f77[_0xb282('0x17')](0x194);}return _0x3c4018;};}function handleError(_0x2b1303,_0x5b1d3d){_0x5b1d3d=_0x5b1d3d||0x1f4;return function(_0xa0d7fb){logger[_0xb282('0x26')](_0xa0d7fb['stack']);if(_0xa0d7fb[_0xb282('0x27')]){delete _0xa0d7fb[_0xb282('0x27')];}_0x2b1303[_0xb282('0x18')](_0x5b1d3d)[_0xb282('0x28')](_0xa0d7fb);};}exports['index']=function(_0x1520b1,_0x1fb89f){var _0xe337b8={},_0x433ad5={},_0x4cee93={'count':0x0,'rows':[]};var _0xfddd2e=_[_0xb282('0x29')](db['WhatsappQueueReport'][_0xb282('0x2a')],function(_0x1e2861){return{'name':_0x1e2861[_0xb282('0x2b')],'type':_0x1e2861[_0xb282('0x2c')][_0xb282('0x2d')]};});_0x433ad5['model']=_[_0xb282('0x29')](_0xfddd2e,'name');_0x433ad5[_0xb282('0x2e')]=_[_0xb282('0x2f')](_0x1520b1[_0xb282('0x2e')]);_0x433ad5['filters']=_[_0xb282('0x30')](_0x433ad5['model'],_0x433ad5[_0xb282('0x2e')]);_0xe337b8[_0xb282('0x31')]=_[_0xb282('0x30')](_0x433ad5[_0xb282('0x32')],qs[_0xb282('0x33')](_0x1520b1[_0xb282('0x2e')]['fields']));_0xe337b8[_0xb282('0x31')]=_0xe337b8[_0xb282('0x31')]['length']?_0xe337b8['attributes']:_0x433ad5[_0xb282('0x32')];if(!_0x1520b1[_0xb282('0x2e')][_0xb282('0x34')]('nolimit')){_0xe337b8['limit']=qs['limit'](_0x1520b1[_0xb282('0x2e')][_0xb282('0x1b')]);_0xe337b8[_0xb282('0x19')]=qs[_0xb282('0x19')](_0x1520b1[_0xb282('0x2e')][_0xb282('0x19')]);}_0xe337b8[_0xb282('0x35')]=qs['sort'](_0x1520b1[_0xb282('0x2e')]['sort']);_0xe337b8[_0xb282('0x36')]=qs[_0xb282('0x37')](_[_0xb282('0x38')](_0x1520b1['query'],_0x433ad5[_0xb282('0x37')]),_0xfddd2e);if(_0x1520b1['query'][_0xb282('0x39')]){_0xe337b8[_0xb282('0x36')]=_[_0xb282('0x3a')](_0xe337b8[_0xb282('0x36')],{'$or':_['map'](_0xfddd2e,function(_0x5c86bb){if(_0x5c86bb[_0xb282('0x2c')]!==_0xb282('0x3b')){var _0x3791fd={};_0x3791fd[_0x5c86bb[_0xb282('0x27')]]={'$like':'%'+_0x1520b1['query'][_0xb282('0x39')]+'%'};return _0x3791fd;}})});}_0xe337b8=_['merge']({},_0xe337b8,_0x1520b1[_0xb282('0x3c')]);var _0x1a1b50={'where':_0xe337b8['where']};return db[_0xb282('0x3d')][_0xb282('0x1c')](_0x1a1b50)[_0xb282('0x23')](function(_0x2c988a){_0x4cee93[_0xb282('0x1c')]=_0x2c988a;if(_0x1520b1[_0xb282('0x2e')][_0xb282('0x3e')]){_0xe337b8[_0xb282('0x3f')]=[{'all':!![]}];}return db[_0xb282('0x3d')][_0xb282('0x40')](_0xe337b8);})[_0xb282('0x23')](function(_0x91fe43){_0x4cee93[_0xb282('0x41')]=_0x91fe43;return _0x4cee93;})[_0xb282('0x23')](respondWithFilteredResult(_0x1fb89f,_0xe337b8))[_0xb282('0x42')](handleError(_0x1fb89f,null));};exports[_0xb282('0x43')]=function(_0x2416a4,_0x7332d2){var _0x573da7={'raw':!![],'where':{'id':_0x2416a4['params']['id']}},_0x310ad1={};_0x310ad1[_0xb282('0x32')]=_[_0xb282('0x2f')](db[_0xb282('0x3d')][_0xb282('0x2a')]);_0x310ad1[_0xb282('0x2e')]=_[_0xb282('0x2f')](_0x2416a4['query']);_0x310ad1['filters']=_[_0xb282('0x30')](_0x310ad1['model'],_0x310ad1[_0xb282('0x2e')]);_0x573da7[_0xb282('0x31')]=_['intersection'](_0x310ad1[_0xb282('0x32')],qs[_0xb282('0x33')](_0x2416a4[_0xb282('0x2e')]['fields']));_0x573da7['attributes']=_0x573da7[_0xb282('0x31')]['length']?_0x573da7[_0xb282('0x31')]:_0x310ad1[_0xb282('0x32')];if(_0x2416a4[_0xb282('0x2e')][_0xb282('0x3e')]){_0x573da7[_0xb282('0x3f')]=[{'all':!![]}];}_0x573da7=_[_0xb282('0x3a')]({},_0x573da7,_0x2416a4['options']);return db[_0xb282('0x3d')][_0xb282('0x44')](_0x573da7)[_0xb282('0x23')](handleEntityNotFound(_0x7332d2,null))['then'](respondWithResult(_0x7332d2,null))[_0xb282('0x42')](handleError(_0x7332d2,null));};exports['create']=function(_0x32fc1d,_0x4b0822){return db[_0xb282('0x3d')]['create'](_0x32fc1d['body'],{})['then'](respondWithResult(_0x4b0822,0xc9))[_0xb282('0x42')](handleError(_0x4b0822,null));};exports[_0xb282('0x22')]=function(_0x42d99f,_0x7a5aa4){if(_0x42d99f['body']['id']){delete _0x42d99f['body']['id'];}return db['WhatsappQueueReport'][_0xb282('0x44')]({'where':{'id':_0x42d99f[_0xb282('0x45')]['id']}})[_0xb282('0x23')](handleEntityNotFound(_0x7a5aa4,null))[_0xb282('0x23')](saveUpdates(_0x42d99f['body'],null))[_0xb282('0x23')](respondWithResult(_0x7a5aa4,null))[_0xb282('0x42')](handleError(_0x7a5aa4,null));};exports['destroy']=function(_0x33bded,_0x9f4d79){return db[_0xb282('0x3d')][_0xb282('0x44')]({'where':{'id':_0x33bded[_0xb282('0x45')]['id']}})['then'](handleEntityNotFound(_0x9f4d79,null))[_0xb282('0x23')](removeEntity(_0x9f4d79,null))[_0xb282('0x42')](handleError(_0x9f4d79,null));};exports[_0xb282('0x46')]=function(_0x22d129,_0x308aa8){return db[_0xb282('0x3d')]['describe']()[_0xb282('0x23')](respondWithResult(_0x308aa8,null))['catch'](handleError(_0x308aa8,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 23c30d8..0ccbf7c 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 _0x4d94=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','report_whatsapp_queue','uniqueid','lodash','util','api'];(function(_0x217e48,_0x2e4ae2){var _0x47f9c4=function(_0x4dc60c){while(--_0x4dc60c){_0x217e48['push'](_0x217e48['shift']());}};_0x47f9c4(++_0x2e4ae2);}(_0x4d94,0xf4));var _0x44d9=function(_0x4ca1b8,_0x9faad5){_0x4ca1b8=_0x4ca1b8-0x0;var _0x49b9e4=_0x4d94[_0x4ca1b8];return _0x49b9e4;};'use strict';var _=require(_0x44d9('0x0'));var util=require(_0x44d9('0x1'));var logger=require('../../config/logger')(_0x44d9('0x2'));var moment=require(_0x44d9('0x3'));var BPromise=require(_0x44d9('0x4'));var rp=require(_0x44d9('0x5'));var fs=require('fs');var path=require(_0x44d9('0x6'));var rimraf=require(_0x44d9('0x7'));var config=require(_0x44d9('0x8'));var attributes=require(_0x44d9('0x9'));module[_0x44d9('0xa')]=function(_0x34a2a6,_0x3fd772){return _0x34a2a6['define']('WhatsappQueueReport',attributes,{'tableName':_0x44d9('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x44d9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x573c=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x573c,0xcd));var _0xc573=function(_0x43a62d,_0x2a2834){_0x43a62d=_0x43a62d-0x0;var _0x5873f2=_0x573c[_0x43a62d];return _0x5873f2;};'use strict';var _=require(_0xc573('0x0'));var util=require(_0xc573('0x1'));var logger=require(_0xc573('0x2'))(_0xc573('0x3'));var moment=require(_0xc573('0x4'));var BPromise=require('bluebird');var rp=require(_0xc573('0x5'));var fs=require('fs');var path=require(_0xc573('0x6'));var rimraf=require(_0xc573('0x7'));var config=require(_0xc573('0x8'));var attributes=require(_0xc573('0x9'));module[_0xc573('0xa')]=function(_0x1d919b,_0x4e3b96){return _0x1d919b[_0xc573('0xb')]('WhatsappQueueReport',attributes,{'tableName':_0xc573('0xc'),'paranoid':![],'indexes':[{'name':_0xc573('0xd'),'fields':[_0xc573('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 22e015d..b8702f3 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 _0x10a7=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','catch','UpdateWhatsappQueueReport','update','raw','where','attributes','lodash','util','moment'];(function(_0x364cba,_0x19c43b){var _0x1e6de2=function(_0x11731b){while(--_0x11731b){_0x364cba['push'](_0x364cba['shift']());}};_0x1e6de2(++_0x19c43b);}(_0x10a7,0xf2));var _0x710a=function(_0x16cafe,_0x47cbcf){_0x16cafe=_0x16cafe-0x0;var _0x2f4d13=_0x10a7[_0x16cafe];return _0x2f4d13;};'use strict';var _=require(_0x710a('0x0'));var util=require(_0x710a('0x1'));var moment=require(_0x710a('0x2'));var BPromise=require('bluebird');var rs=require(_0x710a('0x3'));var fs=require('fs');var Redis=require(_0x710a('0x4'));var db=require(_0x710a('0x5'))['db'];var utils=require(_0x710a('0x6'));var logger=require('../../config/logger')(_0x710a('0x7'));var config=require(_0x710a('0x8'));var jayson=require(_0x710a('0x9'));var client=jayson[_0x710a('0xa')][_0x710a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x459aec,_0x2c2fc3,_0x16d09e){return new BPromise(function(_0x14ff74,_0x4001d0){return client[_0x710a('0xc')](_0x459aec,_0x16d09e)[_0x710a('0xd')](function(_0x1279ca){logger[_0x710a('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2c2fc3,_0x710a('0xf'));logger[_0x710a('0x10')](_0x710a('0x11'),_0x2c2fc3,_0x710a('0xf'),JSON[_0x710a('0x12')](_0x1279ca));if(_0x1279ca[_0x710a('0x13')]){if(_0x1279ca[_0x710a('0x13')][_0x710a('0x14')]===0x1f4){logger[_0x710a('0x13')](_0x710a('0x15'),_0x2c2fc3,_0x1279ca[_0x710a('0x13')]['message']);return _0x4001d0(_0x1279ca[_0x710a('0x13')][_0x710a('0x16')]);}logger[_0x710a('0x13')](_0x710a('0x15'),_0x2c2fc3,_0x1279ca['error'][_0x710a('0x16')]);return _0x14ff74(_0x1279ca['error'][_0x710a('0x16')]);}else{logger[_0x710a('0xe')](_0x710a('0x15'),_0x2c2fc3,_0x710a('0xf'));_0x14ff74(_0x1279ca[_0x710a('0x17')]['message']);}})['catch'](function(_0x36e7af){logger[_0x710a('0x13')](_0x710a('0x15'),_0x2c2fc3,_0x36e7af);_0x4001d0(_0x36e7af);});});}exports[_0x710a('0x18')]=function(_0x3699ee){var _0xa4ca63=this;return new Promise(function(_0x1d214b,_0x1c5356){return db[_0x710a('0x19')][_0x710a('0x1a')](_0x3699ee[_0x710a('0x1b')],{'raw':_0x3699ee['options']?_0x3699ee[_0x710a('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x710a('0xd')](function(_0x242713){logger['info']('CreateWhatsappQueueReport',_0x3699ee);logger[_0x710a('0x10')](_0x710a('0x18'),_0x3699ee,JSON[_0x710a('0x12')](_0x242713));_0x1d214b(_0x242713);})[_0x710a('0x1d')](function(_0x5e5386){logger[_0x710a('0x13')](_0x710a('0x18'),_0x5e5386[_0x710a('0x16')],_0x3699ee);_0x1c5356(_0xa4ca63[_0x710a('0x13')](0x1f4,_0x5e5386[_0x710a('0x16')]));});});};exports[_0x710a('0x1e')]=function(_0x216d43){var _0x4126bf=this;return new Promise(function(_0x3d1630,_0x1b5eb8){return db['WhatsappQueueReport'][_0x710a('0x1f')](_0x216d43['body'],{'raw':_0x216d43[_0x710a('0x1c')]?_0x216d43[_0x710a('0x1c')][_0x710a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x216d43[_0x710a('0x1c')]?_0x216d43[_0x710a('0x1c')][_0x710a('0x21')]||null:null,'attributes':_0x216d43['options']?_0x216d43['options'][_0x710a('0x22')]||null:null,'limit':_0x216d43[_0x710a('0x1c')]?_0x216d43[_0x710a('0x1c')]['limit']||null:null})[_0x710a('0xd')](function(_0x6baa92){logger['info'](_0x710a('0x1e'),_0x216d43);logger[_0x710a('0x10')]('UpdateWhatsappQueueReport',_0x216d43,JSON[_0x710a('0x12')](_0x6baa92));_0x3d1630(_0x6baa92);})[_0x710a('0x1d')](function(_0x408b5e){logger[_0x710a('0x13')]('UpdateWhatsappQueueReport',_0x408b5e[_0x710a('0x16')],_0x216d43);_0x1b5eb8(_0x4126bf[_0x710a('0x13')](0x1f4,_0x408b5e['message']));});});}; \ No newline at end of file +var _0x74d7=['update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','WhatsappQueueReport','options','raw','CreateWhatsappQueueReport','UpdateWhatsappQueueReport'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x74d7,0xc4));var _0x774d=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x74d7[_0x541ea6];return _0x3c3e84;};'use strict';var _=require(_0x774d('0x0'));var util=require(_0x774d('0x1'));var moment=require('moment');var BPromise=require(_0x774d('0x2'));var rs=require(_0x774d('0x3'));var fs=require('fs');var Redis=require(_0x774d('0x4'));var db=require(_0x774d('0x5'))['db'];var utils=require(_0x774d('0x6'));var logger=require(_0x774d('0x7'))(_0x774d('0x8'));var config=require(_0x774d('0x9'));var jayson=require(_0x774d('0xa'));var client=jayson['client'][_0x774d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2344e4,_0x20e3fb,_0x4a3d2f){return new BPromise(function(_0x3378f2,_0x5a2efd){return client[_0x774d('0xc')](_0x2344e4,_0x4a3d2f)[_0x774d('0xd')](function(_0x2a496f){logger[_0x774d('0xe')](_0x774d('0xf'),_0x20e3fb,_0x774d('0x10'));logger[_0x774d('0x11')](_0x774d('0x12'),_0x20e3fb,_0x774d('0x10'),JSON['stringify'](_0x2a496f));if(_0x2a496f['error']){if(_0x2a496f[_0x774d('0x13')][_0x774d('0x14')]===0x1f4){logger[_0x774d('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x20e3fb,_0x2a496f[_0x774d('0x13')]['message']);return _0x5a2efd(_0x2a496f['error'][_0x774d('0x15')]);}logger[_0x774d('0x13')](_0x774d('0xf'),_0x20e3fb,_0x2a496f[_0x774d('0x13')]['message']);return _0x3378f2(_0x2a496f['error']['message']);}else{logger[_0x774d('0xe')](_0x774d('0xf'),_0x20e3fb,_0x774d('0x10'));_0x3378f2(_0x2a496f['result'][_0x774d('0x15')]);}})[_0x774d('0x16')](function(_0x57d843){logger[_0x774d('0x13')]('WhatsappQueueReport,\x20%s,\x20%s',_0x20e3fb,_0x57d843);_0x5a2efd(_0x57d843);});});}exports['CreateWhatsappQueueReport']=function(_0x59b4fb){var _0x266883=this;return new Promise(function(_0x3dd58e,_0x5882cf){return db[_0x774d('0x17')]['create'](_0x59b4fb['body'],{'raw':_0x59b4fb[_0x774d('0x18')]?_0x59b4fb['options'][_0x774d('0x19')]===undefined?!![]:![]:!![]})[_0x774d('0xd')](function(_0x48291c){logger[_0x774d('0xe')](_0x774d('0x1a'),_0x59b4fb);logger[_0x774d('0x11')](_0x774d('0x1a'),_0x59b4fb,JSON['stringify'](_0x48291c));_0x3dd58e(_0x48291c);})[_0x774d('0x16')](function(_0x19770e){logger[_0x774d('0x13')](_0x774d('0x1a'),_0x19770e[_0x774d('0x15')],_0x59b4fb);_0x5882cf(_0x266883['error'](0x1f4,_0x19770e[_0x774d('0x15')]));});});};exports[_0x774d('0x1b')]=function(_0x5a7d00){var _0x5a7235=this;return new Promise(function(_0x522006,_0x74d6ce){return db[_0x774d('0x17')][_0x774d('0x1c')](_0x5a7d00['body'],{'raw':_0x5a7d00[_0x774d('0x18')]?_0x5a7d00[_0x774d('0x18')][_0x774d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a7d00[_0x774d('0x18')]?_0x5a7d00[_0x774d('0x18')][_0x774d('0x1d')]||null:null,'attributes':_0x5a7d00[_0x774d('0x18')]?_0x5a7d00[_0x774d('0x18')][_0x774d('0x1e')]||null:null,'limit':_0x5a7d00['options']?_0x5a7d00[_0x774d('0x18')][_0x774d('0x1f')]||null:null})[_0x774d('0xd')](function(_0x1fe0f7){logger[_0x774d('0xe')]('UpdateWhatsappQueueReport',_0x5a7d00);logger[_0x774d('0x11')](_0x774d('0x1b'),_0x5a7d00,JSON['stringify'](_0x1fe0f7));_0x522006(_0x1fe0f7);})[_0x774d('0x16')](function(_0x55da29){logger['error']('UpdateWhatsappQueueReport',_0x55da29[_0x774d('0x15')],_0x5a7d00);_0x74d6ce(_0x5a7235[_0x774d('0x13')](0x1f4,_0x55da29[_0x774d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 67ad842..936d647 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 _0x9f24=['post','create','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','get','/:id'];(function(_0x400d3e,_0x210191){var _0x3b86a3=function(_0x43e029){while(--_0x43e029){_0x400d3e['push'](_0x400d3e['shift']());}};_0x3b86a3(++_0x210191);}(_0x9f24,0x154));var _0x49f2=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0x9f24[_0x1b3564];return _0x504069;};'use strict';var multer=require('multer');var util=require(_0x49f2('0x0'));var path=require('path');var timeout=require(_0x49f2('0x1'));var express=require('express');var router=express[_0x49f2('0x2')]();var fs_extra=require(_0x49f2('0x3'));var auth=require(_0x49f2('0x4'));var interaction=require(_0x49f2('0x5'));var config=require(_0x49f2('0x6'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0x49f2('0x7')](),controller[_0x49f2('0x8')]);router['get'](_0x49f2('0x9'),auth[_0x49f2('0x7')](),controller['describe']);router[_0x49f2('0xa')](_0x49f2('0xb'),auth[_0x49f2('0x7')](),controller['show']);router[_0x49f2('0xc')]('/',auth[_0x49f2('0x7')](),controller[_0x49f2('0xd')]);router['put'](_0x49f2('0xb'),auth[_0x49f2('0x7')](),controller['update']);router[_0x49f2('0xe')](_0x49f2('0xb'),auth[_0x49f2('0x7')](),controller[_0x49f2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0610=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','destroy'];(function(_0x1fd9e7,_0x24cdbe){var _0x1781f2=function(_0x2bd0a3){while(--_0x2bd0a3){_0x1fd9e7['push'](_0x1fd9e7['shift']());}};_0x1781f2(++_0x24cdbe);}(_0x0610,0x1b9));var _0x0061=function(_0x32a538,_0x474093){_0x32a538=_0x32a538-0x0;var _0xd647ee=_0x0610[_0x32a538];return _0xd647ee;};'use strict';var multer=require(_0x0061('0x0'));var util=require(_0x0061('0x1'));var path=require('path');var timeout=require(_0x0061('0x2'));var express=require(_0x0061('0x3'));var router=express[_0x0061('0x4')]();var fs_extra=require(_0x0061('0x5'));var auth=require(_0x0061('0x6'));var interaction=require(_0x0061('0x7'));var config=require(_0x0061('0x8'));var controller=require(_0x0061('0x9'));router[_0x0061('0xa')]('/',auth[_0x0061('0xb')](),controller['index']);router[_0x0061('0xa')](_0x0061('0xc'),auth[_0x0061('0xb')](),controller[_0x0061('0xd')]);router[_0x0061('0xa')]('/:id',auth[_0x0061('0xb')](),controller[_0x0061('0xe')]);router[_0x0061('0xf')]('/',auth[_0x0061('0xb')](),controller[_0x0061('0x10')]);router[_0x0061('0x11')](_0x0061('0x12'),auth[_0x0061('0xb')](),controller[_0x0061('0x13')]);router['delete'](_0x0061('0x12'),auth[_0x0061('0xb')](),controller[_0x0061('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index e4596a6..d47ce39 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 _0x4227=['queue','DATE','sequelize','ENUM','agent'];(function(_0x3aa0ac,_0x5f5da6){var _0x568a11=function(_0x26f47e){while(--_0x26f47e){_0x3aa0ac['push'](_0x3aa0ac['shift']());}};_0x568a11(++_0x5f5da6);}(_0x4227,0x89));var _0x7422=function(_0x186fde,_0x5bb777){_0x186fde=_0x186fde-0x0;var _0x4cdac9=_0x4227[_0x186fde];return _0x4cdac9;};'use strict';var Sequelize=require(_0x7422('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x7422('0x1')]('account',_0x7422('0x2'),_0x7422('0x3')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7422('0x4')]}}; \ No newline at end of file +var _0xceef=['agent','DATE','STRING','ENUM'];(function(_0x43f255,_0xd9d592){var _0x23350b=function(_0x44e3b1){while(--_0x44e3b1){_0x43f255['push'](_0x43f255['shift']());}};_0x23350b(++_0xd9d592);}(_0xceef,0xf6));var _0xfcee=function(_0x35561d,_0x59a5cf){_0x35561d=_0x35561d-0x0;var _0x2ccc5b=_0xceef[_0x35561d];return _0x2ccc5b;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xfcee('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xfcee('0x1')]('account',_0xfcee('0x2'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xfcee('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 160007c..86f7002 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 _0x236c=['model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','WhatsappTransferReport','fieldName','key','query','filters','intersection'];(function(_0x565098,_0xb79a6b){var _0x36ef37=function(_0x161398){while(--_0x161398){_0x565098['push'](_0x565098['shift']());}};_0x36ef37(++_0xb79a6b);}(_0x236c,0x155));var _0xc236=function(_0x490c06,_0x59d446){_0x490c06=_0x490c06-0x0;var _0x5ced97=_0x236c[_0x490c06];return _0x5ced97;};'use strict';var emlformat=require(_0xc236('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc236('0x1'));var jsonpatch=require(_0xc236('0x2'));var rp=require(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var BPromise=require(_0xc236('0x5'));var Mustache=require('mustache');var util=require(_0xc236('0x6'));var path=require(_0xc236('0x7'));var sox=require(_0xc236('0x8'));var csv=require(_0xc236('0x9'));var ejs=require(_0xc236('0xa'));var fs=require('fs');var fs_extra=require(_0xc236('0xb'));var _=require('lodash');var squel=require(_0xc236('0xc'));var crypto=require(_0xc236('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc236('0xe'));var Papa=require('papaparse');var Redis=require(_0xc236('0xf'));var authService=require(_0xc236('0x10'));var qs=require(_0xc236('0x11'));var as=require(_0xc236('0x12'));var hardwareService=require(_0xc236('0x13'));var logger=require('../../config/logger')(_0xc236('0x14'));var utils=require(_0xc236('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc236('0x16'));var db=require(_0xc236('0x17'))['db'];function respondWithStatusCode(_0x5ee3a5,_0x5b9638){_0x5b9638=_0x5b9638||0xcc;return function(_0x5bce83){if(_0x5bce83){return _0x5ee3a5['sendStatus'](_0x5b9638);}return _0x5ee3a5[_0xc236('0x18')](_0x5b9638)[_0xc236('0x19')]();};}function respondWithResult(_0x2184c9,_0x71bce2){_0x71bce2=_0x71bce2||0xc8;return function(_0x5052db){if(_0x5052db){return _0x2184c9[_0xc236('0x18')](_0x71bce2)['json'](_0x5052db);}};}function respondWithFilteredResult(_0x5221bf,_0x9a65e8){return function(_0x32f2fd){if(_0x32f2fd){var _0x443a46=typeof _0x9a65e8[_0xc236('0x1a')]===_0xc236('0x1b')&&typeof _0x9a65e8['limit']==='undefined';var _0x57355b=_0x32f2fd[_0xc236('0x1c')];var _0x76f45=_0x443a46?0x0:_0x9a65e8[_0xc236('0x1a')];var _0x541a20=_0x443a46?_0x32f2fd[_0xc236('0x1c')]:_0x9a65e8['offset']+_0x9a65e8['limit'];var _0x1eafba;if(_0x541a20>=_0x57355b){_0x541a20=_0x57355b;_0x1eafba=0xc8;}else{_0x1eafba=0xce;}_0x5221bf[_0xc236('0x18')](_0x1eafba);return _0x5221bf[_0xc236('0x1d')](_0xc236('0x1e'),_0x76f45+'-'+_0x541a20+'/'+_0x57355b)[_0xc236('0x1f')](_0x32f2fd);}return null;};}function patchUpdates(_0x27c6ab){return function(_0x3f0e2f){try{jsonpatch[_0xc236('0x20')](_0x3f0e2f,_0x27c6ab,!![]);}catch(_0x54ffac){return BPromise[_0xc236('0x21')](_0x54ffac);}return _0x3f0e2f[_0xc236('0x22')]();};}function saveUpdates(_0x4a9006,_0x208c3f){return function(_0x34d73a){if(_0x34d73a){return _0x34d73a[_0xc236('0x23')](_0x4a9006)[_0xc236('0x24')](function(_0x27afba){return _0x27afba;});}return null;};}function removeEntity(_0x21fab8,_0x3a315b){return function(_0xf921e6){if(_0xf921e6){return _0xf921e6[_0xc236('0x25')]()[_0xc236('0x24')](function(){_0x21fab8[_0xc236('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x308cd6,_0x21d78f){return function(_0x356042){if(!_0x356042){_0x308cd6[_0xc236('0x26')](0x194);}return _0x356042;};}function handleError(_0x561da1,_0x42f248){_0x42f248=_0x42f248||0x1f4;return function(_0x5da4b2){logger['error'](_0x5da4b2[_0xc236('0x27')]);if(_0x5da4b2['name']){delete _0x5da4b2[_0xc236('0x28')];}_0x561da1['status'](_0x42f248)[_0xc236('0x29')](_0x5da4b2);};}exports['index']=function(_0x423842,_0x1d144b){var _0x4f5175={},_0x5a61b5={},_0x265c8d={'count':0x0,'rows':[]};var _0x1fd31d=_[_0xc236('0x2a')](db[_0xc236('0x2b')]['rawAttributes'],function(_0x4e3262){return{'name':_0x4e3262[_0xc236('0x2c')],'type':_0x4e3262['type'][_0xc236('0x2d')]};});_0x5a61b5['model']=_[_0xc236('0x2a')](_0x1fd31d,_0xc236('0x28'));_0x5a61b5['query']=_['keys'](_0x423842[_0xc236('0x2e')]);_0x5a61b5[_0xc236('0x2f')]=_[_0xc236('0x30')](_0x5a61b5[_0xc236('0x31')],_0x5a61b5[_0xc236('0x2e')]);_0x4f5175[_0xc236('0x32')]=_[_0xc236('0x30')](_0x5a61b5[_0xc236('0x31')],qs[_0xc236('0x33')](_0x423842['query']['fields']));_0x4f5175['attributes']=_0x4f5175[_0xc236('0x32')][_0xc236('0x34')]?_0x4f5175[_0xc236('0x32')]:_0x5a61b5[_0xc236('0x31')];if(!_0x423842[_0xc236('0x2e')][_0xc236('0x35')](_0xc236('0x36'))){_0x4f5175['limit']=qs[_0xc236('0x37')](_0x423842[_0xc236('0x2e')][_0xc236('0x37')]);_0x4f5175['offset']=qs[_0xc236('0x1a')](_0x423842[_0xc236('0x2e')][_0xc236('0x1a')]);}_0x4f5175[_0xc236('0x38')]=qs['sort'](_0x423842[_0xc236('0x2e')][_0xc236('0x39')]);_0x4f5175[_0xc236('0x3a')]=qs[_0xc236('0x2f')](_[_0xc236('0x3b')](_0x423842[_0xc236('0x2e')],_0x5a61b5[_0xc236('0x2f')]),_0x1fd31d);if(_0x423842[_0xc236('0x2e')][_0xc236('0x3c')]){_0x4f5175[_0xc236('0x3a')]=_[_0xc236('0x3d')](_0x4f5175[_0xc236('0x3a')],{'$or':_[_0xc236('0x2a')](_0x1fd31d,function(_0x237193){if(_0x237193[_0xc236('0x3e')]!==_0xc236('0x3f')){var _0x46db5a={};_0x46db5a[_0x237193['name']]={'$like':'%'+_0x423842['query']['filter']+'%'};return _0x46db5a;}})});}_0x4f5175=_['merge']({},_0x4f5175,_0x423842[_0xc236('0x40')]);var _0x5c4739={'where':_0x4f5175[_0xc236('0x3a')]};return db[_0xc236('0x2b')][_0xc236('0x1c')](_0x5c4739)[_0xc236('0x24')](function(_0xdf7897){_0x265c8d[_0xc236('0x1c')]=_0xdf7897;if(_0x423842[_0xc236('0x2e')][_0xc236('0x41')]){_0x4f5175[_0xc236('0x42')]=[{'all':!![]}];}return db[_0xc236('0x2b')][_0xc236('0x43')](_0x4f5175);})[_0xc236('0x24')](function(_0x3b2f2f){_0x265c8d[_0xc236('0x44')]=_0x3b2f2f;return _0x265c8d;})[_0xc236('0x24')](respondWithFilteredResult(_0x1d144b,_0x4f5175))['catch'](handleError(_0x1d144b,null));};exports[_0xc236('0x45')]=function(_0x24b851,_0x506ba0){var _0xb90a83={'raw':!![],'where':{'id':_0x24b851[_0xc236('0x46')]['id']}},_0x5b0bc5={};_0x5b0bc5['model']=_[_0xc236('0x47')](db[_0xc236('0x2b')][_0xc236('0x48')]);_0x5b0bc5['query']=_[_0xc236('0x47')](_0x24b851[_0xc236('0x2e')]);_0x5b0bc5[_0xc236('0x2f')]=_['intersection'](_0x5b0bc5[_0xc236('0x31')],_0x5b0bc5[_0xc236('0x2e')]);_0xb90a83[_0xc236('0x32')]=_[_0xc236('0x30')](_0x5b0bc5[_0xc236('0x31')],qs[_0xc236('0x33')](_0x24b851['query'][_0xc236('0x33')]));_0xb90a83['attributes']=_0xb90a83[_0xc236('0x32')][_0xc236('0x34')]?_0xb90a83[_0xc236('0x32')]:_0x5b0bc5[_0xc236('0x31')];if(_0x24b851[_0xc236('0x2e')][_0xc236('0x41')]){_0xb90a83[_0xc236('0x42')]=[{'all':!![]}];}_0xb90a83=_['merge']({},_0xb90a83,_0x24b851[_0xc236('0x40')]);return db['WhatsappTransferReport'][_0xc236('0x49')](_0xb90a83)[_0xc236('0x24')](handleEntityNotFound(_0x506ba0,null))['then'](respondWithResult(_0x506ba0,null))[_0xc236('0x4a')](handleError(_0x506ba0,null));};exports[_0xc236('0x4b')]=function(_0x3c1c5c,_0x161890){return db[_0xc236('0x2b')][_0xc236('0x4b')](_0x3c1c5c[_0xc236('0x4c')],{})['then'](respondWithResult(_0x161890,0xc9))['catch'](handleError(_0x161890,null));};exports[_0xc236('0x23')]=function(_0x2afed2,_0x510f7f){if(_0x2afed2[_0xc236('0x4c')]['id']){delete _0x2afed2[_0xc236('0x4c')]['id'];}return db[_0xc236('0x2b')][_0xc236('0x49')]({'where':{'id':_0x2afed2[_0xc236('0x46')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x510f7f,null))[_0xc236('0x24')](saveUpdates(_0x2afed2[_0xc236('0x4c')],null))[_0xc236('0x24')](respondWithResult(_0x510f7f,null))['catch'](handleError(_0x510f7f,null));};exports[_0xc236('0x25')]=function(_0x307663,_0x41b7d5){return db[_0xc236('0x2b')][_0xc236('0x49')]({'where':{'id':_0x307663[_0xc236('0x46')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x41b7d5,null))['then'](removeEntity(_0x41b7d5,null))[_0xc236('0x4a')](handleError(_0x41b7d5,null));};exports[_0xc236('0x4d')]=function(_0x17c86b,_0x16ff63){return db['WhatsappTransferReport'][_0xc236('0x4d')]()[_0xc236('0x24')](respondWithResult(_0x16ff63,null))[_0xc236('0x4a')](handleError(_0x16ff63,null));}; \ No newline at end of file +var _0xc13c=['../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','Content-Range','reject','update','then','destroy','error','name','index','map','WhatsappTransferReport','rawAttributes','key','model','query','intersection','attributes','fields','nolimit','sort','where','filters','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x5181f1,_0x2c3ab8){var _0x5c00e0=function(_0x40f63e){while(--_0x40f63e){_0x5181f1['push'](_0x5181f1['shift']());}};_0x5c00e0(++_0x2c3ab8);}(_0xc13c,0x155));var _0xcc13=function(_0x1414b6,_0x145a09){_0x1414b6=_0x1414b6-0x0;var _0x4fc3ea=_0xc13c[_0x1414b6];return _0x4fc3ea;};'use strict';var emlformat=require(_0xcc13('0x0'));var rimraf=require(_0xcc13('0x1'));var zipdir=require(_0xcc13('0x2'));var jsonpatch=require(_0xcc13('0x3'));var rp=require(_0xcc13('0x4'));var moment=require('moment');var BPromise=require(_0xcc13('0x5'));var Mustache=require('mustache');var util=require(_0xcc13('0x6'));var path=require(_0xcc13('0x7'));var sox=require(_0xcc13('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc13('0x9'));var _=require('lodash');var squel=require(_0xcc13('0xa'));var crypto=require(_0xcc13('0xb'));var jsforce=require(_0xcc13('0xc'));var deskjs=require(_0xcc13('0xd'));var toCsv=require(_0xcc13('0xe'));var querystring=require(_0xcc13('0xf'));var Papa=require(_0xcc13('0x10'));var Redis=require(_0xcc13('0x11'));var authService=require(_0xcc13('0x12'));var qs=require(_0xcc13('0x13'));var as=require(_0xcc13('0x14'));var hardwareService=require(_0xcc13('0x15'));var logger=require('../../config/logger')(_0xcc13('0x16'));var utils=require(_0xcc13('0x17'));var config=require(_0xcc13('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc13('0x19'))['db'];function respondWithStatusCode(_0x7f1c61,_0x5eada5){_0x5eada5=_0x5eada5||0xcc;return function(_0x1c534a){if(_0x1c534a){return _0x7f1c61[_0xcc13('0x1a')](_0x5eada5);}return _0x7f1c61['status'](_0x5eada5)['end']();};}function respondWithResult(_0x158df4,_0x2536be){_0x2536be=_0x2536be||0xc8;return function(_0x469dc4){if(_0x469dc4){return _0x158df4['status'](_0x2536be)[_0xcc13('0x1b')](_0x469dc4);}};}function respondWithFilteredResult(_0x3bc039,_0x2beaaa){return function(_0x2ea14a){if(_0x2ea14a){var _0x4d5370=typeof _0x2beaaa[_0xcc13('0x1c')]===_0xcc13('0x1d')&&typeof _0x2beaaa['limit']==='undefined';var _0xcfa81c=_0x2ea14a[_0xcc13('0x1e')];var _0x4681cd=_0x4d5370?0x0:_0x2beaaa['offset'];var _0x2cfa38=_0x4d5370?_0x2ea14a[_0xcc13('0x1e')]:_0x2beaaa['offset']+_0x2beaaa[_0xcc13('0x1f')];var _0x912ba2;if(_0x2cfa38>=_0xcfa81c){_0x2cfa38=_0xcfa81c;_0x912ba2=0xc8;}else{_0x912ba2=0xce;}_0x3bc039[_0xcc13('0x20')](_0x912ba2);return _0x3bc039[_0xcc13('0x21')](_0xcc13('0x22'),_0x4681cd+'-'+_0x2cfa38+'/'+_0xcfa81c)['json'](_0x2ea14a);}return null;};}function patchUpdates(_0x1fea91){return function(_0x35984c){try{jsonpatch['apply'](_0x35984c,_0x1fea91,!![]);}catch(_0x1ee85d){return BPromise[_0xcc13('0x23')](_0x1ee85d);}return _0x35984c['save']();};}function saveUpdates(_0x13535d,_0x73a3b5){return function(_0x2c8749){if(_0x2c8749){return _0x2c8749[_0xcc13('0x24')](_0x13535d)[_0xcc13('0x25')](function(_0x21020e){return _0x21020e;});}return null;};}function removeEntity(_0x28776c,_0x4d858c){return function(_0x5eeb7f){if(_0x5eeb7f){return _0x5eeb7f[_0xcc13('0x26')]()[_0xcc13('0x25')](function(){_0x28776c[_0xcc13('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b296,_0x4ca458){return function(_0x2b6dc1){if(!_0x2b6dc1){_0x52b296[_0xcc13('0x1a')](0x194);}return _0x2b6dc1;};}function handleError(_0x5c1e13,_0x5d9eac){_0x5d9eac=_0x5d9eac||0x1f4;return function(_0x2bc82b){logger[_0xcc13('0x27')](_0x2bc82b['stack']);if(_0x2bc82b[_0xcc13('0x28')]){delete _0x2bc82b['name'];}_0x5c1e13[_0xcc13('0x20')](_0x5d9eac)['send'](_0x2bc82b);};}exports[_0xcc13('0x29')]=function(_0x354d0a,_0x525b32){var _0xb65055={},_0x15877b={},_0x503082={'count':0x0,'rows':[]};var _0x4d614b=_[_0xcc13('0x2a')](db[_0xcc13('0x2b')][_0xcc13('0x2c')],function(_0x10a896){return{'name':_0x10a896['fieldName'],'type':_0x10a896['type'][_0xcc13('0x2d')]};});_0x15877b[_0xcc13('0x2e')]=_['map'](_0x4d614b,_0xcc13('0x28'));_0x15877b[_0xcc13('0x2f')]=_['keys'](_0x354d0a[_0xcc13('0x2f')]);_0x15877b['filters']=_[_0xcc13('0x30')](_0x15877b['model'],_0x15877b['query']);_0xb65055[_0xcc13('0x31')]=_[_0xcc13('0x30')](_0x15877b['model'],qs['fields'](_0x354d0a[_0xcc13('0x2f')][_0xcc13('0x32')]));_0xb65055[_0xcc13('0x31')]=_0xb65055[_0xcc13('0x31')]['length']?_0xb65055[_0xcc13('0x31')]:_0x15877b['model'];if(!_0x354d0a['query']['hasOwnProperty'](_0xcc13('0x33'))){_0xb65055['limit']=qs[_0xcc13('0x1f')](_0x354d0a[_0xcc13('0x2f')][_0xcc13('0x1f')]);_0xb65055[_0xcc13('0x1c')]=qs[_0xcc13('0x1c')](_0x354d0a[_0xcc13('0x2f')][_0xcc13('0x1c')]);}_0xb65055['order']=qs[_0xcc13('0x34')](_0x354d0a['query'][_0xcc13('0x34')]);_0xb65055[_0xcc13('0x35')]=qs[_0xcc13('0x36')](_['pick'](_0x354d0a[_0xcc13('0x2f')],_0x15877b[_0xcc13('0x36')]),_0x4d614b);if(_0x354d0a[_0xcc13('0x2f')]['filter']){_0xb65055['where']=_['merge'](_0xb65055[_0xcc13('0x35')],{'$or':_[_0xcc13('0x2a')](_0x4d614b,function(_0x581159){if(_0x581159[_0xcc13('0x37')]!==_0xcc13('0x38')){var _0x470e84={};_0x470e84[_0x581159[_0xcc13('0x28')]]={'$like':'%'+_0x354d0a[_0xcc13('0x2f')][_0xcc13('0x39')]+'%'};return _0x470e84;}})});}_0xb65055=_[_0xcc13('0x3a')]({},_0xb65055,_0x354d0a[_0xcc13('0x3b')]);var _0x137e21={'where':_0xb65055[_0xcc13('0x35')]};return db[_0xcc13('0x2b')][_0xcc13('0x1e')](_0x137e21)[_0xcc13('0x25')](function(_0x40f5dc){_0x503082[_0xcc13('0x1e')]=_0x40f5dc;if(_0x354d0a[_0xcc13('0x2f')][_0xcc13('0x3c')]){_0xb65055[_0xcc13('0x3d')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xcc13('0x3e')](_0xb65055);})[_0xcc13('0x25')](function(_0x292953){_0x503082[_0xcc13('0x3f')]=_0x292953;return _0x503082;})[_0xcc13('0x25')](respondWithFilteredResult(_0x525b32,_0xb65055))[_0xcc13('0x40')](handleError(_0x525b32,null));};exports[_0xcc13('0x41')]=function(_0x378463,_0xd84f49){var _0x167abc={'raw':!![],'where':{'id':_0x378463[_0xcc13('0x42')]['id']}},_0x57fadd={};_0x57fadd[_0xcc13('0x2e')]=_[_0xcc13('0x43')](db[_0xcc13('0x2b')]['rawAttributes']);_0x57fadd[_0xcc13('0x2f')]=_[_0xcc13('0x43')](_0x378463[_0xcc13('0x2f')]);_0x57fadd['filters']=_[_0xcc13('0x30')](_0x57fadd[_0xcc13('0x2e')],_0x57fadd[_0xcc13('0x2f')]);_0x167abc['attributes']=_['intersection'](_0x57fadd[_0xcc13('0x2e')],qs['fields'](_0x378463[_0xcc13('0x2f')]['fields']));_0x167abc[_0xcc13('0x31')]=_0x167abc['attributes'][_0xcc13('0x44')]?_0x167abc[_0xcc13('0x31')]:_0x57fadd[_0xcc13('0x2e')];if(_0x378463[_0xcc13('0x2f')][_0xcc13('0x3c')]){_0x167abc['include']=[{'all':!![]}];}_0x167abc=_['merge']({},_0x167abc,_0x378463['options']);return db[_0xcc13('0x2b')][_0xcc13('0x45')](_0x167abc)[_0xcc13('0x25')](handleEntityNotFound(_0xd84f49,null))[_0xcc13('0x25')](respondWithResult(_0xd84f49,null))['catch'](handleError(_0xd84f49,null));};exports['create']=function(_0x388a76,_0x5d0ea9){return db[_0xcc13('0x2b')][_0xcc13('0x46')](_0x388a76[_0xcc13('0x47')],{})[_0xcc13('0x25')](respondWithResult(_0x5d0ea9,0xc9))['catch'](handleError(_0x5d0ea9,null));};exports[_0xcc13('0x24')]=function(_0x4746f6,_0x2bfeee){if(_0x4746f6[_0xcc13('0x47')]['id']){delete _0x4746f6[_0xcc13('0x47')]['id'];}return db[_0xcc13('0x2b')][_0xcc13('0x45')]({'where':{'id':_0x4746f6[_0xcc13('0x42')]['id']}})[_0xcc13('0x25')](handleEntityNotFound(_0x2bfeee,null))[_0xcc13('0x25')](saveUpdates(_0x4746f6['body'],null))[_0xcc13('0x25')](respondWithResult(_0x2bfeee,null))[_0xcc13('0x40')](handleError(_0x2bfeee,null));};exports[_0xcc13('0x26')]=function(_0x260ccc,_0x5154c9){return db[_0xcc13('0x2b')][_0xcc13('0x45')]({'where':{'id':_0x260ccc[_0xcc13('0x42')]['id']}})[_0xcc13('0x25')](handleEntityNotFound(_0x5154c9,null))[_0xcc13('0x25')](removeEntity(_0x5154c9,null))[_0xcc13('0x40')](handleError(_0x5154c9,null));};exports[_0xcc13('0x48')]=function(_0xc585bd,_0x3f152e){return db[_0xcc13('0x2b')][_0xcc13('0x48')]()['then'](respondWithResult(_0x3f152e,null))[_0xcc13('0x40')](handleError(_0x3f152e,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index b811f59..a8182e3 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 _0x8426=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x369b27,_0x34ed8c){var _0x756fae=function(_0x5bdaab){while(--_0x5bdaab){_0x369b27['push'](_0x369b27['shift']());}};_0x756fae(++_0x34ed8c);}(_0x8426,0x64));var _0x6842=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x8426[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x6842('0x0'));var util=require(_0x6842('0x1'));var logger=require(_0x6842('0x2'))(_0x6842('0x3'));var moment=require(_0x6842('0x4'));var BPromise=require(_0x6842('0x5'));var rp=require(_0x6842('0x6'));var fs=require('fs');var path=require(_0x6842('0x7'));var rimraf=require(_0x6842('0x8'));var config=require(_0x6842('0x9'));var attributes=require('./whatsappTransferReport.attributes');module[_0x6842('0xa')]=function(_0x257ca5,_0x466d2a){return _0x257ca5['define']('WhatsappTransferReport',attributes,{'tableName':_0x6842('0xb'),'paranoid':![],'indexes':[{'name':_0x6842('0xc'),'fields':[_0x6842('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x846d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid'];(function(_0x2a64cc,_0x3814bc){var _0x17bf9d=function(_0x3a2653){while(--_0x3a2653){_0x2a64cc['push'](_0x2a64cc['shift']());}};_0x17bf9d(++_0x3814bc);}(_0x846d,0x9a));var _0xd846=function(_0xdb01a,_0x54a83a){_0xdb01a=_0xdb01a-0x0;var _0x107ede=_0x846d[_0xdb01a];return _0x107ede;};'use strict';var _=require(_0xd846('0x0'));var util=require(_0xd846('0x1'));var logger=require(_0xd846('0x2'))(_0xd846('0x3'));var moment=require(_0xd846('0x4'));var BPromise=require(_0xd846('0x5'));var rp=require(_0xd846('0x6'));var fs=require('fs');var path=require(_0xd846('0x7'));var rimraf=require(_0xd846('0x8'));var config=require(_0xd846('0x9'));var attributes=require('./whatsappTransferReport.attributes');module[_0xd846('0xa')]=function(_0x14564a,_0x26df0d){return _0x14564a['define'](_0xd846('0xb'),attributes,{'tableName':_0xd846('0xc'),'paranoid':![],'indexes':[{'name':_0xd846('0xd'),'fields':[_0xd846('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index fd6a32e..8f976b2 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 _0x026c=['request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http'];(function(_0x4e5c5b,_0x366e6f){var _0x1daadc=function(_0x439543){while(--_0x439543){_0x4e5c5b['push'](_0x4e5c5b['shift']());}};_0x1daadc(++_0x366e6f);}(_0x026c,0x74));var _0xc026=function(_0x2142c8,_0x3001eb){_0x2142c8=_0x2142c8-0x0;var _0x4286e9=_0x026c[_0x2142c8];return _0x4286e9;};'use strict';var _=require(_0xc026('0x0'));var util=require(_0xc026('0x1'));var moment=require(_0xc026('0x2'));var BPromise=require('bluebird');var rs=require(_0xc026('0x3'));var fs=require('fs');var Redis=require(_0xc026('0x4'));var db=require(_0xc026('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc026('0x6'))('rpc');var config=require(_0xc026('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc026('0x8')][_0xc026('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f41c3,_0x372c6f,_0x39dbe1){return new BPromise(function(_0xcd78a9,_0x472dae){return client[_0xc026('0xa')](_0x5f41c3,_0x39dbe1)[_0xc026('0xb')](function(_0x5bf1a8){logger[_0xc026('0xc')](_0xc026('0xd'),_0x372c6f,_0xc026('0xe'));logger[_0xc026('0xf')](_0xc026('0x10'),_0x372c6f,_0xc026('0xe'),JSON[_0xc026('0x11')](_0x5bf1a8));if(_0x5bf1a8[_0xc026('0x12')]){if(_0x5bf1a8[_0xc026('0x12')][_0xc026('0x13')]===0x1f4){logger['error'](_0xc026('0xd'),_0x372c6f,_0x5bf1a8['error'][_0xc026('0x14')]);return _0x472dae(_0x5bf1a8[_0xc026('0x12')]['message']);}logger[_0xc026('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x372c6f,_0x5bf1a8[_0xc026('0x12')]['message']);return _0xcd78a9(_0x5bf1a8[_0xc026('0x12')]['message']);}else{logger['info'](_0xc026('0xd'),_0x372c6f,_0xc026('0xe'));_0xcd78a9(_0x5bf1a8['result'][_0xc026('0x14')]);}})['catch'](function(_0x38dfce){logger['error'](_0xc026('0xd'),_0x372c6f,_0x38dfce);_0x472dae(_0x38dfce);});});} \ No newline at end of file +var _0x191a=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x2e0060,_0x3a54cf){var _0x707749=function(_0xa15113){while(--_0xa15113){_0x2e0060['push'](_0x2e0060['shift']());}};_0x707749(++_0x3a54cf);}(_0x191a,0x175));var _0xa191=function(_0x3bd4eb,_0x1f7014){_0x3bd4eb=_0x3bd4eb-0x0;var _0x4714f9=_0x191a[_0x3bd4eb];return _0x4714f9;};'use strict';var _=require(_0xa191('0x0'));var util=require(_0xa191('0x1'));var moment=require(_0xa191('0x2'));var BPromise=require('bluebird');var rs=require(_0xa191('0x3'));var fs=require('fs');var Redis=require(_0xa191('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa191('0x5'));var logger=require(_0xa191('0x6'))(_0xa191('0x7'));var config=require(_0xa191('0x8'));var jayson=require(_0xa191('0x9'));var client=jayson[_0xa191('0xa')][_0xa191('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xeddb08,_0x152518,_0x4365ff){return new BPromise(function(_0x398a19,_0x317ac2){return client[_0xa191('0xc')](_0xeddb08,_0x4365ff)[_0xa191('0xd')](function(_0x13dba1){logger['info'](_0xa191('0xe'),_0x152518,_0xa191('0xf'));logger[_0xa191('0x10')](_0xa191('0x11'),_0x152518,_0xa191('0xf'),JSON[_0xa191('0x12')](_0x13dba1));if(_0x13dba1[_0xa191('0x13')]){if(_0x13dba1[_0xa191('0x13')][_0xa191('0x14')]===0x1f4){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x152518,_0x13dba1['error']['message']);return _0x317ac2(_0x13dba1[_0xa191('0x13')][_0xa191('0x15')]);}logger[_0xa191('0x13')](_0xa191('0xe'),_0x152518,_0x13dba1[_0xa191('0x13')][_0xa191('0x15')]);return _0x398a19(_0x13dba1[_0xa191('0x13')][_0xa191('0x15')]);}else{logger[_0xa191('0x16')](_0xa191('0xe'),_0x152518,'request\x20sent');_0x398a19(_0x13dba1[_0xa191('0x17')]['message']);}})[_0xa191('0x18')](function(_0x4e9934){logger[_0xa191('0x13')](_0xa191('0xe'),_0x152518,_0x4e9934);_0x317ac2(_0x4e9934);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 414cd9e..c741e82 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf8ff=['status','seedDB','./config/seedDB','default','./config/license','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','sync','listen','then','info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:'];(function(_0x376d9f,_0x1966c6){var _0x1b8a53=function(_0x336454){while(--_0x336454){_0x376d9f['push'](_0x376d9f['shift']());}};_0x1b8a53(++_0x1966c6);}(_0xf8ff,0x19e));var _0xff8f=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xf8ff[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0xff8f('0x0'));var mysqldb=require(_0xff8f('0x1'));var rpc=require('./rpc');var config=require(_0xff8f('0x2'));var logger=require(_0xff8f('0x3'))(_0xff8f('0x4'));var pm2=require(_0xff8f('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xff8f('0x6'));var chat=require(_0xff8f('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xff8f('0x8'));function main(){return mysqldb['db']['sequelize'][_0xff8f('0x9')]()['then'](function(){return rpc[_0xff8f('0xa')]();})[_0xff8f('0xb')](function(_0x53f70f){logger[_0xff8f('0xc')](_0x53f70f);return chat['start']();})['then'](function(){return whatsapp[_0xff8f('0xd')]();})[_0xff8f('0xb')](function(){return schedule['start']();})[_0xff8f('0xb')](function(){return transcribe['start']();})[_0xff8f('0xb')](function(_0x35294d){logger['info'](_0x35294d);return pm2[_0xff8f('0xd')](pm2Config);})[_0xff8f('0xb')](function(_0x5e2e27){logger[_0xff8f('0xc')](_0xff8f('0xe'),_[_0xff8f('0xf')](_[_0xff8f('0x10')](_0x5e2e27,{'status':_0xff8f('0x11')}),_0xff8f('0x12'))[_0xff8f('0x13')]());logger[_0xff8f('0xc')](_0xff8f('0x14'),_[_0xff8f('0xf')](_['filter'](_0x5e2e27,function(_0x804ea0){return _0x804ea0[_0xff8f('0x15')]!==_0xff8f('0x11');}),_0xff8f('0x12'))['join']()||'None');config[_0xff8f('0x16')]&&require(_0xff8f('0x17'))[_0xff8f('0x18')]();require(_0xff8f('0x19'))[_0xff8f('0x18')]();})['catch'](function(_0x1b8a7a){logger[_0xff8f('0x1a')](_0xff8f('0x1b'),_0x1b8a7a);process[_0xff8f('0x1c')](0x1);});}main(); \ No newline at end of file +var _0x6750=['./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','then','start','info','Online\x20apps:','online','join','filter','status','name','None','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb'];(function(_0x1a7c7d,_0x59e6cc){var _0x4f2eac=function(_0x58e5eb){while(--_0x58e5eb){_0x1a7c7d['push'](_0x1a7c7d['shift']());}};_0x4f2eac(++_0x59e6cc);}(_0x6750,0x1da));var _0x0675=function(_0x39cd49,_0x34b372){_0x39cd49=_0x39cd49-0x0;var _0x1f2e03=_0x6750[_0x39cd49];return _0x1f2e03;};'use strict';var _=require('lodash');var mysqldb=require(_0x0675('0x0'));var rpc=require(_0x0675('0x1'));var config=require('./config/environment');var logger=require(_0x0675('0x2'))(_0x0675('0x3'));var pm2=require(_0x0675('0x4'));var pm2Config=require(_0x0675('0x5'));var schedule=require(_0x0675('0x6'));var chat=require(_0x0675('0x7'));var whatsapp=require(_0x0675('0x8'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0x0675('0x9')][_0x0675('0xa')]()[_0x0675('0xb')](function(){return rpc['listen']();})[_0x0675('0xb')](function(_0x36fad2){logger['info'](_0x36fad2);return chat[_0x0675('0xc')]();})['then'](function(){return whatsapp[_0x0675('0xc')]();})[_0x0675('0xb')](function(){return schedule[_0x0675('0xc')]();})['then'](function(){return transcribe['start']();})['then'](function(_0x57559d){logger[_0x0675('0xd')](_0x57559d);return pm2['start'](pm2Config);})[_0x0675('0xb')](function(_0x461f0d){logger[_0x0675('0xd')](_0x0675('0xe'),_['map'](_['filter'](_0x461f0d,{'status':_0x0675('0xf')}),'name')[_0x0675('0x10')]());logger[_0x0675('0xd')]('Offline\x20apps:',_['map'](_[_0x0675('0x11')](_0x461f0d,function(_0x52b88f){return _0x52b88f[_0x0675('0x12')]!==_0x0675('0xf');}),_0x0675('0x13'))['join']()||_0x0675('0x14'));config['seedDB']&&require('./config/seedDB')[_0x0675('0x15')]();require('./config/license')[_0x0675('0x15')]();})[_0x0675('0x16')](function(_0x256ff7){logger[_0x0675('0x17')](_0x0675('0x18'),_0x256ff7);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 8ec0711..bb08a87 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 _0x6189=['express-jwt','composable-middleware','crypto','bluebird','util','moment','session','fullname','name','internal','userpic','permissions','md5secret','voicePause','chatPause','mailPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','findOne','params','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','catch','use','startsWith','Basic','find','authenticate','pass','Wrong\x20credentials.','headers','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','Forbidden','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','encryptString','join','promisify','sign','secrets','payload','options','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/util','lodash','jsonwebtoken'];(function(_0x42c567,_0xa8de9e){var _0x2e0337=function(_0x5cd121){while(--_0x5cd121){_0x42c567['push'](_0x42c567['shift']());}};_0x2e0337(++_0xa8de9e);}(_0x6189,0x1e7));var _0x9618=function(_0x4fba24,_0x1ee538){_0x4fba24=_0x4fba24-0x0;var _0x1055aa=_0x6189[_0x4fba24];return _0x1055aa;};'use strict';var db=require(_0x9618('0x0'))['db'];var config=require(_0x9618('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x9618('0x2'));var encryptor=require('../encryptor');var _=require(_0x9618('0x3'));var jwt=require(_0x9618('0x4'));var expressJwt=require(_0x9618('0x5'));var compose=require(_0x9618('0x6'));var basicAuth=require('basic-auth');var crypto=require(_0x9618('0x7'));var BPromise=require(_0x9618('0x8'));var util=require(_0x9618('0x9'));var moment=require(_0x9618('0xa'));var validateJwt=expressJwt({'secret':config['secrets'][_0x9618('0xb')]});var userAttributes=['id','role',_0x9618('0xc'),_0x9618('0xd'),_0x9618('0xe'),'email',_0x9618('0xf'),_0x9618('0x10'),_0x9618('0x11'),_0x9618('0x12'),_0x9618('0x13'),_0x9618('0x14'),'faxPause','smsPause',_0x9618('0x15'),_0x9618('0x16'),'showWebBar',_0x9618('0x17'),_0x9618('0x18'),_0x9618('0x19'),_0x9618('0x1a'),_0x9618('0x1b'),_0x9618('0x1c'),_0x9618('0x1d'),_0x9618('0x1e'),_0x9618('0x1f'),'phoneBarEnableRecording',_0x9618('0x20'),_0x9618('0x21'),_0x9618('0x22'),_0x9618('0x23'),_0x9618('0x24'),_0x9618('0x25'),_0x9618('0x26'),'interface','userProfileId',_0x9618('0x27'),_0x9618('0x28'),_0x9618('0x29'),'downloadVoiceRecordings',_0x9618('0x2a'),'downloadAttachments'];exports[_0x9618('0x2b')]=function(){return this[_0x9618('0x2c')](!![])['use'](function(_0x1625f3,_0x1586b2,_0x3472b0){if(_0x1625f3[_0x9618('0x2d')]){_0x3472b0();}else{return db[_0x9618('0x2e')][_0x9618('0x2f')]({'where':{'id':_0x1625f3[_0x9618('0x30')]['id']},'attributes':['id','closed',_0x9618('0x31')],'raw':!![]})[_0x9618('0x32')](function(_0x40ffe4){if(_0x40ffe4&&_0x40ffe4['closed']){return _0x1586b2[_0x9618('0x33')](_0x40ffe4[_0x9618('0x31')]===_0x9618('0x34')?0x195:0x193)[_0x9618('0x35')]({'message':_0x40ffe4[_0x9618('0x31')]==='unmanaged'?_0x9618('0x36'):_0x9618('0x37')});}else{_0x3472b0();}})[_0x9618('0x38')](function(_0xd65fb8){_0x3472b0(_0xd65fb8);});}});};exports['isAuthenticated']=function isAuthenticated(_0x339727){return compose()[_0x9618('0x39')](function(_0x3c5633,_0x4e7ffa,_0xbd1bd6){var _0x4357eb;if(_0x3c5633['headers']['authorization']){if(_[_0x9618('0x3a')](_0x3c5633['headers']['authorization'],_0x9618('0x3b'))){var _0x35bd47=basicAuth(_0x3c5633);db['User'][_0x9618('0x3c')]({'where':{'name':_0x35bd47[_0x9618('0xd')]}})[_0x9618('0x32')](function(_0x451805){if(!_0x451805||!_0x451805[_0x9618('0x3d')](_0x35bd47[_0x9618('0x3e')])){return _0x4e7ffa[_0x9618('0x33')](0x191)['json']({'message':_0x9618('0x3f')});}_0x3c5633[_0x9618('0x2d')]={'id':_0x451805['id']};_0xbd1bd6();})[_0x9618('0x38')](function(_0x5c3188){_0xbd1bd6(_0x5c3188);});}else if(_['startsWith'](_0x3c5633[_0x9618('0x40')]['authorization'],_0x9618('0x41'))){validateJwt(_0x3c5633,_0x4e7ffa,_0xbd1bd6);}else{if(_0x339727){_0xbd1bd6();}else{return _0x4e7ffa[_0x9618('0x33')](0x193)['json']({'message':_0x9618('0x42')});}}}else if(_0x3c5633[_0x9618('0x43')][_0x9618('0x44')]){try{var _0x3cef10={'audience':hardwareConf[_0x9618('0x45')](),'issuer':hardwareConf[_0x9618('0x45')]()};verifyJwt(_0x3c5633[_0x9618('0x43')]['apikey'],_0x3cef10)[_0x9618('0x32')](function(_0x1359d8){return db[_0x9618('0x46')][_0x9618('0x3c')]({'where':{'id':_0x1359d8[_0x9618('0x47')]}})[_0x9618('0x32')](function(_0xe18a4e){_0x4357eb=_0xe18a4e;return db[_0x9618('0x48')][_0x9618('0x2f')]({'where':{'id':0x1},'attributes':[_0x9618('0x49'),_0x9618('0x4a')],'raw':!![]});})[_0x9618('0x32')](function(_0x161481){if(!_0x4357eb||!_[_0x9618('0x4b')](_0x4357eb['apiKeyNonce'],_0x1359d8[_0x9618('0x4c')])){return _0x4e7ffa[_0x9618('0x33')](0x191)['json']({'message':_0x9618('0x4d')});}if(_0x4357eb[_0x9618('0x4e')]){return _0x4e7ffa[_0x9618('0x33')](0x191)['json']({'message':_0x9618('0x4f')});}if(_0x4357eb['blocked']){if(_0x161481[_0x9618('0x4a')]>0x0){if(moment(_0x4357eb[_0x9618('0x50')])[_0x9618('0x51')](_0x161481[_0x9618('0x4a')],_0x9618('0x52'))>moment()){return _0x4e7ffa['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x4e7ffa[_0x9618('0x33')](0x191)['json']({'message':_0x9618('0x4f')});}}_0x3c5633['user']={'id':_0x4357eb['id']};_0xbd1bd6();});})[_0x9618('0x38')](function(){return _0x4e7ffa[_0x9618('0x33')](0x191)[_0x9618('0x35')]({'message':_0x9618('0x4f')});});}catch(_0x1e1d31){_0xbd1bd6(_0x1e1d31);}}else if(_0x339727){_0xbd1bd6();}else{return _0x4e7ffa['status'](0x193)[_0x9618('0x35')]({'message':_0x9618('0x42')});}})[_0x9618('0x39')](function(_0x5215f3,_0xd1639f,_0x434e65){if(_0x5215f3['user']){db[_0x9618('0x46')][_0x9618('0x3c')]({'where':{'id':_0x5215f3[_0x9618('0x2d')]['id']},'attributes':userAttributes})[_0x9618('0x32')](function(_0x2cb6c1){if(!_0x2cb6c1){return _0xd1639f[_0x9618('0x33')](0x194)[_0x9618('0x35')]({'message':_0x9618('0x53')});}_0x5215f3[_0x9618('0x2d')]=_0x2cb6c1;_0x434e65();})[_0x9618('0x38')](function(_0x1848ee){_0x434e65(_0x1848ee);});}else if(_0x339727){_0x434e65();}else{return _0xd1639f[_0x9618('0x33')](0x194)[_0x9618('0x35')]({'message':_0x9618('0x54')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x2a9431,_0x2e8d1a,_0x3e633a){return licenseUtil[_0x9618('0x55')]()[_0x9618('0x32')](function(_0x23c4e6){if(_0x23c4e6['update']){_0x3e633a();}else{return _0x2e8d1a[_0x9618('0x33')](0x193)[_0x9618('0x35')]({'message':_0x9618('0x56')});}})['catch'](function(_0x3bc6db){_0x3e633a(_0x3bc6db);});});};exports['isMiddleware']=function(_0x1e702e,_0x54be2c,_0x28855f){_0x1e702e['isMiddleware']=!![];return _0x28855f();};exports['signToken']=function signToken(_0x395738){return signJwt(_0x395738);};exports[_0x9618('0x57')]=function(_0x456454,_0x4dad70){if(!_0x456454[_0x9618('0x2d')]){return _0x4dad70['status'](0x194)[_0x9618('0x35')]({'message':_0x9618('0x58')});}var _0x37a469={'payload':{'id':_0x456454['user']['id'],'role':_0x456454[_0x9618('0x2d')][_0x9618('0x59')]},'options':{'expiresIn':0x15180}};return signJwt(_0x37a469)['then'](function(_0xc431ae){_0x4dad70[_0x9618('0x5a')](_0x9618('0x5b'),_0xc431ae);_0x4dad70['redirect']('/dashboards/general');})[_0x9618('0x38')](function(_0xed28a8){return _0x4dad70[_0x9618('0x33')](0x1f4)[_0x9618('0x5c')](_0xed28a8);});};exports[_0x9618('0x5d')]=function(_0x9eab38){if(_[_0x9618('0x5e')](_0x9eab38['apiKeyNonce'])||_['isNil'](_0x9eab38[_0x9618('0x5f')])){return null;}else{return createJwt(_0x9eab38);}};exports[_0x9618('0x60')]=function(_0xee21b4){_0xee21b4[_0x9618('0x61')]=generateNonce();_0xee21b4['apiKeyIat']=generateIssuedAt();return createJwt(_0xee21b4);};exports[_0x9618('0x62')]=function(_0x19ff66,_0x18d20e){var _0x1364e4=_0x19ff66[_0x9618('0x43')][_0x9618('0x44')];if(_0x1364e4){var _0x5c11eb={'nonce':_0x18d20e[_0x9618('0x61')],'iat':_0x18d20e[_0x9618('0x5f')],'audience':hardwareConf[_0x9618('0x45')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x1364e4,_0x5c11eb)['then'](function(){return generateApiKey(_0x18d20e);});}else{throw{'message':_0x9618('0x63')};}};exports[_0x9618('0x64')]=function(_0x485248){var _0x4ed865=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4ed865['test'](_0x485248))throw new db[(_0x9618('0x65'))]['ValidationError'](_0x9618('0x66'));return;};exports[_0x9618('0x67')]=function(_0x2d537,_0x35ce88,_0x5dd4d8){var _0x57a2e4=encryptor[_0x9618('0x68')](_0x35ce88)[_0x9618('0x69')](',');for(var _0x53fadd=0x0;_0x53fadd<_0x5dd4d8;_0x53fadd++){if(!_0x57a2e4[_0x53fadd])break;if(_0x2d537[_0x9618('0x6a')]()===_0x57a2e4[_0x53fadd][_0x9618('0x6a')]()){var _0x1577fe=util[_0x9618('0x6b')](_0x9618('0x6c'),_0x5dd4d8);if(_0x5dd4d8===0x1){_0x1577fe=_0x9618('0x6d');}throw new db['Sequelize']['ValidationError'](_0x1577fe);}}return;};exports[_0x9618('0x6e')]=function(_0x144979,_0x5e408b){var _0x3a8400=_0x5e408b?encryptor['decryptString'](_0x5e408b)[_0x9618('0x69')](','):[];if(_0x3a8400[_0x9618('0x6f')]===0x5){_0x3a8400[_0x9618('0x70')](-0x1,0x1);}_0x3a8400['unshift'](_0x144979);return encryptor[_0x9618('0x71')](_0x3a8400[_0x9618('0x72')](','));};function signJwt(_0x22d699){var _0x407560=BPromise[_0x9618('0x73')](jwt[_0x9618('0x74')],{'context':jwt});var _0x4e9225=_0x22d699['secret']||config[_0x9618('0x75')][_0x9618('0xb')];return new BPromise(function(_0x3e7c72,_0x3590ff){_0x407560(_0x22d699[_0x9618('0x76')],_0x4e9225,_0x22d699[_0x9618('0x77')])[_0x9618('0x32')](function(_0x36eaff){_0x3e7c72(_0x36eaff);})[_0x9618('0x38')](function(_0xf2e34d){_0x3590ff(_0xf2e34d);});});}function verifyJwt(_0x4b2188,_0x5e86f8,_0x3c7229){var _0x456a61=BPromise['promisify'](jwt['verify'],{'context':jwt});var _0x4d2994=_0x3c7229||config[_0x9618('0x75')][_0x9618('0xb')];return new BPromise(function(_0x39362a,_0x2f460c){_0x456a61(_0x4b2188,_0x4d2994,_0x5e86f8)[_0x9618('0x32')](function(_0x1dcc23){_0x39362a(_0x1dcc23);})[_0x9618('0x38')](function(_0x52ee90){_0x2f460c(_0x52ee90);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString']('hex');}function generateIssuedAt(){return Math['floor'](Date[_0x9618('0x78')]()/0x3e8)[_0x9618('0x79')]();}function createJwt(_0x4b5a06){var _0x1e945f={'payload':{'iat':_0x4b5a06[_0x9618('0x5f')],'nonce':_0x4b5a06[_0x9618('0x61')]},'options':{'algorithm':_0x9618('0x7a'),'subject':_0x4b5a06['id'][_0x9618('0x79')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x9618('0x45')]()}};return signJwt(_0x1e945f)[_0x9618('0x32')](function(_0x526203){return{'iat':_0x4b5a06[_0x9618('0x5f')],'nonce':_0x4b5a06[_0x9618('0x61')],'token':_0x526203};});} \ No newline at end of file +var _0xbd62=['smsPause','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','use','user','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','catch','startsWith','headers','authorization','Basic','User','find','name','authenticate','pass','status','Bearer','query','getUuid','apikey','Setting','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','getLicense','update','Forbidden','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','payload','options','verify','toString','hex','floor','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','role','fullname','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause'];(function(_0x419de8,_0x3c21a4){var _0x3fd763=function(_0x537429){while(--_0x537429){_0x419de8['push'](_0x419de8['shift']());}};_0x3fd763(++_0x3c21a4);}(_0xbd62,0x1c5));var _0x2bd6=function(_0x5f4add,_0x4280ae){_0x5f4add=_0x5f4add-0x0;var _0x3f1414=_0xbd62[_0x5f4add];return _0x3f1414;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x2bd6('0x0'));var hardwareConf=require(_0x2bd6('0x1'));var licenseUtil=require(_0x2bd6('0x2'));var encryptor=require(_0x2bd6('0x3'));var _=require(_0x2bd6('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x2bd6('0x5'));var compose=require(_0x2bd6('0x6'));var basicAuth=require(_0x2bd6('0x7'));var crypto=require('crypto');var BPromise=require(_0x2bd6('0x8'));var util=require(_0x2bd6('0x9'));var moment=require(_0x2bd6('0xa'));var validateJwt=expressJwt({'secret':config[_0x2bd6('0xb')][_0x2bd6('0xc')]});var userAttributes=['id',_0x2bd6('0xd'),_0x2bd6('0xe'),'name',_0x2bd6('0xf'),_0x2bd6('0x10'),'userpic',_0x2bd6('0x11'),_0x2bd6('0x12'),_0x2bd6('0x13'),_0x2bd6('0x14'),_0x2bd6('0x15'),_0x2bd6('0x16'),_0x2bd6('0x17'),'openchannelPause','pauseType',_0x2bd6('0x18'),_0x2bd6('0x19'),_0x2bd6('0x1a'),'crudPermissions',_0x2bd6('0x1b'),_0x2bd6('0x1c'),'alias','phoneBarAutoAnswer',_0x2bd6('0x1d'),_0x2bd6('0x1e'),_0x2bd6('0x1f'),_0x2bd6('0x20'),_0x2bd6('0x21'),_0x2bd6('0x22'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk',_0x2bd6('0x23'),_0x2bd6('0x24'),_0x2bd6('0x25'),_0x2bd6('0x26'),_0x2bd6('0x27'),_0x2bd6('0x28'),_0x2bd6('0x29'),_0x2bd6('0x2a')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x2bd6('0x2b')](function(_0x548cdf,_0x2f6648,_0x1f372b){if(_0x548cdf[_0x2bd6('0x2c')]){_0x1f372b();}else{return db[_0x2bd6('0x2d')][_0x2bd6('0x2e')]({'where':{'id':_0x548cdf[_0x2bd6('0x2f')]['id']},'attributes':['id',_0x2bd6('0x30'),_0x2bd6('0x31')],'raw':!![]})[_0x2bd6('0x32')](function(_0xa3505a){if(_0xa3505a&&_0xa3505a['closed']){return _0x2f6648['status'](_0xa3505a[_0x2bd6('0x31')]===_0x2bd6('0x33')?0x195:0x193)[_0x2bd6('0x34')]({'message':_0xa3505a[_0x2bd6('0x31')]==='unmanaged'?_0x2bd6('0x35'):'Forbidden.'});}else{_0x1f372b();}})[_0x2bd6('0x36')](function(_0x435198){_0x1f372b(_0x435198);});}});};exports['isAuthenticated']=function isAuthenticated(_0x5f1e32){return compose()[_0x2bd6('0x2b')](function(_0x3bd479,_0x345d17,_0x4ba3e6){var _0x4e3f0b;if(_0x3bd479['headers']['authorization']){if(_[_0x2bd6('0x37')](_0x3bd479[_0x2bd6('0x38')][_0x2bd6('0x39')],_0x2bd6('0x3a'))){var _0x27c00a=basicAuth(_0x3bd479);db[_0x2bd6('0x3b')][_0x2bd6('0x3c')]({'where':{'name':_0x27c00a[_0x2bd6('0x3d')]}})['then'](function(_0x339c3b){if(!_0x339c3b||!_0x339c3b[_0x2bd6('0x3e')](_0x27c00a[_0x2bd6('0x3f')])){return _0x345d17[_0x2bd6('0x40')](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x3bd479['user']={'id':_0x339c3b['id']};_0x4ba3e6();})[_0x2bd6('0x36')](function(_0x445133){_0x4ba3e6(_0x445133);});}else if(_['startsWith'](_0x3bd479['headers'][_0x2bd6('0x39')],_0x2bd6('0x41'))){validateJwt(_0x3bd479,_0x345d17,_0x4ba3e6);}else{if(_0x5f1e32){_0x4ba3e6();}else{return _0x345d17[_0x2bd6('0x40')](0x193)[_0x2bd6('0x34')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x3bd479[_0x2bd6('0x42')]['apikey']){try{var _0x32b9ac={'audience':hardwareConf[_0x2bd6('0x43')](),'issuer':hardwareConf[_0x2bd6('0x43')]()};verifyJwt(_0x3bd479[_0x2bd6('0x42')][_0x2bd6('0x44')],_0x32b9ac)[_0x2bd6('0x32')](function(_0x1829f6){return db['User'][_0x2bd6('0x3c')]({'where':{'id':_0x1829f6['sub']}})[_0x2bd6('0x32')](function(_0x54d4c1){_0x4e3f0b=_0x54d4c1;return db[_0x2bd6('0x45')][_0x2bd6('0x2e')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x2bd6('0x46')],'raw':!![]});})['then'](function(_0x5b29ac){if(!_0x4e3f0b||!_[_0x2bd6('0x47')](_0x4e3f0b['apiKeyNonce'],_0x1829f6[_0x2bd6('0x48')])){return _0x345d17[_0x2bd6('0x40')](0x191)['json']({'message':_0x2bd6('0x49')});}if(_0x4e3f0b[_0x2bd6('0x4a')]){return _0x345d17['status'](0x191)[_0x2bd6('0x34')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x4e3f0b[_0x2bd6('0x4b')]){if(_0x5b29ac[_0x2bd6('0x46')]>0x0){if(moment(_0x4e3f0b[_0x2bd6('0x4c')])[_0x2bd6('0x4d')](_0x5b29ac[_0x2bd6('0x46')],_0x2bd6('0x4e'))>moment()){return _0x345d17['status'](0x191)[_0x2bd6('0x34')]({'message':_0x2bd6('0x4f')});}}else{return _0x345d17['status'](0x191)[_0x2bd6('0x34')]({'message':_0x2bd6('0x4f')});}}_0x3bd479['user']={'id':_0x4e3f0b['id']};_0x4ba3e6();});})[_0x2bd6('0x36')](function(){return _0x345d17[_0x2bd6('0x40')](0x191)[_0x2bd6('0x34')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x5bc6b9){_0x4ba3e6(_0x5bc6b9);}}else if(_0x5f1e32){_0x4ba3e6();}else{return _0x345d17[_0x2bd6('0x40')](0x193)[_0x2bd6('0x34')]({'message':'Unknown\x20authorization\x20format'});}})[_0x2bd6('0x2b')](function(_0x467856,_0x4c1299,_0x31d2b6){if(_0x467856[_0x2bd6('0x2c')]){db[_0x2bd6('0x3b')][_0x2bd6('0x3c')]({'where':{'id':_0x467856[_0x2bd6('0x2c')]['id']},'attributes':userAttributes})[_0x2bd6('0x32')](function(_0x56eede){if(!_0x56eede){return _0x4c1299[_0x2bd6('0x40')](0x194)['json']({'message':_0x2bd6('0x50')});}_0x467856['user']=_0x56eede;_0x31d2b6();})[_0x2bd6('0x36')](function(_0x13d13b){_0x31d2b6(_0x13d13b);});}else if(_0x5f1e32){_0x31d2b6();}else{return _0x4c1299[_0x2bd6('0x40')](0x194)[_0x2bd6('0x34')]({'message':'User\x20object\x20not\x20found.'});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x360a89,_0x3bc31d,_0xde50d8){return licenseUtil[_0x2bd6('0x51')]()[_0x2bd6('0x32')](function(_0x46560a){if(_0x46560a[_0x2bd6('0x52')]){_0xde50d8();}else{return _0x3bc31d[_0x2bd6('0x40')](0x193)['json']({'message':_0x2bd6('0x53')});}})[_0x2bd6('0x36')](function(_0x4a08cd){_0xde50d8(_0x4a08cd);});});};exports['isMiddleware']=function(_0x2f7cdb,_0x2248c1,_0xdf9c09){_0x2f7cdb['isMiddleware']=!![];return _0xdf9c09();};exports[_0x2bd6('0x54')]=function signToken(_0x5d5f12){return signJwt(_0x5d5f12);};exports[_0x2bd6('0x55')]=function(_0x36a865,_0x3090e4){if(!_0x36a865[_0x2bd6('0x2c')]){return _0x3090e4[_0x2bd6('0x40')](0x194)['json']({'message':_0x2bd6('0x56')});}var _0x2ea094={'payload':{'id':_0x36a865[_0x2bd6('0x2c')]['id'],'role':_0x36a865[_0x2bd6('0x2c')][_0x2bd6('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2ea094)[_0x2bd6('0x32')](function(_0x3e5252){_0x3090e4[_0x2bd6('0x57')](_0x2bd6('0x58'),_0x3e5252);_0x3090e4[_0x2bd6('0x59')](_0x2bd6('0x5a'));})['catch'](function(_0x2c7938){return _0x3090e4[_0x2bd6('0x40')](0x1f4)[_0x2bd6('0x5b')](_0x2c7938);});};exports[_0x2bd6('0x5c')]=function(_0x40dfc3){if(_[_0x2bd6('0x5d')](_0x40dfc3[_0x2bd6('0x5e')])||_[_0x2bd6('0x5d')](_0x40dfc3['apiKeyIat'])){return null;}else{return createJwt(_0x40dfc3);}};exports['generateApiKey']=function(_0x11bc4e){_0x11bc4e[_0x2bd6('0x5e')]=generateNonce();_0x11bc4e[_0x2bd6('0x5f')]=generateIssuedAt();return createJwt(_0x11bc4e);};exports['regenerateApiKey']=function(_0x2a6d94,_0x437575){var _0x185e13=_0x2a6d94[_0x2bd6('0x42')][_0x2bd6('0x44')];if(_0x185e13){var _0x11ec67={'nonce':_0x437575[_0x2bd6('0x5e')],'iat':_0x437575[_0x2bd6('0x5f')],'audience':hardwareConf[_0x2bd6('0x43')](),'issuer':hardwareConf[_0x2bd6('0x43')]()};return verifyJwt(_0x185e13,_0x11ec67)[_0x2bd6('0x32')](function(){return generateApiKey(_0x437575);});}else{throw{'message':_0x2bd6('0x60')};}};exports['validatePasswordPattern']=function(_0x116a44){var _0x5bd798=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5bd798[_0x2bd6('0x61')](_0x116a44))throw new db[(_0x2bd6('0x62'))][(_0x2bd6('0x63'))](_0x2bd6('0x64'));return;};exports[_0x2bd6('0x65')]=function(_0x1c092e,_0x4309e2,_0x3f587e){var _0x353252=encryptor['decryptString'](_0x4309e2)[_0x2bd6('0x66')](',');for(var _0x313a68=0x0;_0x313a68<_0x3f587e;_0x313a68++){if(!_0x353252[_0x313a68])break;if(_0x1c092e[_0x2bd6('0x67')]()===_0x353252[_0x313a68][_0x2bd6('0x67')]()){var _0x3c5e12=util['format'](_0x2bd6('0x68'),_0x3f587e);if(_0x3f587e===0x1){_0x3c5e12='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x2bd6('0x62'))][(_0x2bd6('0x63'))](_0x3c5e12);}}return;};exports[_0x2bd6('0x69')]=function(_0x3f1252,_0x10a513){var _0x235637=_0x10a513?encryptor['decryptString'](_0x10a513)['split'](','):[];if(_0x235637[_0x2bd6('0x6a')]===0x5){_0x235637[_0x2bd6('0x6b')](-0x1,0x1);}_0x235637[_0x2bd6('0x6c')](_0x3f1252);return encryptor[_0x2bd6('0x6d')](_0x235637[_0x2bd6('0x6e')](','));};function signJwt(_0x550d58){var _0x539a5a=BPromise[_0x2bd6('0x6f')](jwt['sign'],{'context':jwt});var _0x32ce1b=_0x550d58['secret']||config[_0x2bd6('0xb')][_0x2bd6('0xc')];return new BPromise(function(_0xb3ee91,_0x58984d){_0x539a5a(_0x550d58[_0x2bd6('0x70')],_0x32ce1b,_0x550d58[_0x2bd6('0x71')])[_0x2bd6('0x32')](function(_0x3a9c4b){_0xb3ee91(_0x3a9c4b);})[_0x2bd6('0x36')](function(_0x3fb096){_0x58984d(_0x3fb096);});});}function verifyJwt(_0x42ffe5,_0x828b41,_0x20521e){var _0x59269a=BPromise['promisify'](jwt[_0x2bd6('0x72')],{'context':jwt});var _0x9c0569=_0x20521e||config[_0x2bd6('0xb')][_0x2bd6('0xc')];return new BPromise(function(_0x138619,_0xd16d7f){_0x59269a(_0x42ffe5,_0x9c0569,_0x828b41)['then'](function(_0x487621){_0x138619(_0x487621);})[_0x2bd6('0x36')](function(_0x19583d){_0xd16d7f(_0x19583d);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x2bd6('0x73')](_0x2bd6('0x74'));}function generateIssuedAt(){return Math[_0x2bd6('0x75')](Date['now']()/0x3e8)[_0x2bd6('0x73')]();}function createJwt(_0xebfaf6){var _0x21320f={'payload':{'iat':_0xebfaf6[_0x2bd6('0x5f')],'nonce':_0xebfaf6[_0x2bd6('0x5e')]},'options':{'algorithm':_0x2bd6('0x76'),'subject':_0xebfaf6['id'][_0x2bd6('0x73')](),'issuer':hardwareConf[_0x2bd6('0x43')](),'audience':hardwareConf[_0x2bd6('0x43')]()}};return signJwt(_0x21320f)['then'](function(_0x5649e9){return{'iat':_0xebfaf6['apiKeyIat'],'nonce':_0xebfaf6[_0x2bd6('0x5e')],'token':_0x5649e9};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 60727f7..0306fde 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 _0xe1c0=['aes-256-ctr','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','filter','indexOf','hasOwnProperty','encryptFile','createWriteStream','createCipher','data','update','binary','write','end','final','close','unlink','decryptFile','createReadStream','secret','utf8','base64','createDecipher','crypto','lodash','../../config/logger','app','secrets','session'];(function(_0x90fc20,_0x29a0cf){var _0x5ac2b8=function(_0xf21063){while(--_0xf21063){_0x90fc20['push'](_0x90fc20['shift']());}};_0x5ac2b8(++_0x29a0cf);}(_0xe1c0,0x14f));var _0x0e1c=function(_0x100e0b,_0x305b0b){_0x100e0b=_0x100e0b-0x0;var _0x5d57ba=_0xe1c0[_0x100e0b];return _0x5d57ba;};'use strict';var crypto=require(_0x0e1c('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x0e1c('0x1'));var config=require('../../config/environment');var logger=require(_0x0e1c('0x2'))(_0x0e1c('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0e1c('0x4')][_0x0e1c('0x5')],'algorithm':_0x0e1c('0x6')};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config[_0x0e1c('0x7')][_0x0e1c('0x8')]){var isSupported=isAlgorithmSupported(config[_0x0e1c('0x7')][_0x0e1c('0x8')]);if(isSupported){fileOptions['algorithm']=config[_0x0e1c('0x7')][_0x0e1c('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x0e1c('0x9')](config[_0x0e1c('0x7')][_0x0e1c('0x8')],_0x0e1c('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x4ea77d){return AES_SUPPORTED_RX['test'](_0x4ea77d);}function getSupportedCiphers(){return crypto['getCiphers']()[_0x0e1c('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x22bb5d){return getSupportedCiphers()[_0x0e1c('0xc')](_0x22bb5d)>-0x1;}function combineOptions(_0x1395a2){var _0x1c92fe={};for(var _0x3decee in fileOptions){if(fileOptions[_0x0e1c('0xd')](_0x3decee)){_0x1c92fe[_0x3decee]=fileOptions[_0x3decee];}}if(_0x1395a2){for(var _0x3509fd in _0x1395a2){if(_0x1395a2[_0x0e1c('0xd')](_0x3509fd)){_0x1c92fe[_0x3509fd]=_0x1395a2[_0x3509fd];}}}return _0x1c92fe;}exports[_0x0e1c('0xe')]=function(_0x1ed1e5,_0x158ffe,_0x3caa57,_0x3f0205){return new BPromise(function(_0x104480,_0x43cbf0){_0x3f0205=combineOptions(_0x3f0205);var _0x467f1=new Buffer(_0x3caa57);var _0x31a2fa=fs['createReadStream'](_0x1ed1e5);var _0x4e0826=fs[_0x0e1c('0xf')](_0x158ffe);var _0x3ce3fa=crypto[_0x0e1c('0x10')](_0x3f0205[_0x0e1c('0x8')],_0x467f1);_0x31a2fa['on'](_0x0e1c('0x11'),function(_0x460f56){var _0x4f28f4=new Buffer(_0x3ce3fa[_0x0e1c('0x12')](_0x460f56),_0x0e1c('0x13'));_0x4e0826[_0x0e1c('0x14')](_0x4f28f4);});_0x31a2fa['on'](_0x0e1c('0x15'),function(){try{var _0x282e99=new Buffer(_0x3ce3fa[_0x0e1c('0x16')](_0x0e1c('0x13')),_0x0e1c('0x13'));_0x4e0826[_0x0e1c('0x14')](_0x282e99);_0x4e0826[_0x0e1c('0x15')]();_0x4e0826['on'](_0x0e1c('0x17'),function(){return _0x104480(_0x158ffe);});}catch(_0x2a1b8a){fs[_0x0e1c('0x18')](_0x158ffe);return _0x43cbf0(_0x2a1b8a);}});});};exports[_0x0e1c('0x19')]=function(_0x2e60c5,_0x6b8f2f,_0xddaa1b,_0x1fb85b){return new BPromise(function(_0xe8e992,_0x134877){_0x1fb85b=combineOptions(_0x1fb85b);var _0x48672b=new Buffer(_0xddaa1b);var _0x3d1097=fs[_0x0e1c('0x1a')](_0x2e60c5);var _0x3a2c48=fs['createWriteStream'](_0x6b8f2f);var _0x1cb509=crypto['createDecipher'](_0x1fb85b['algorithm'],_0x48672b);_0x3d1097['on']('data',function(_0x5992a7){var _0x158111=new Buffer(_0x1cb509[_0x0e1c('0x12')](_0x5992a7),_0x0e1c('0x13'));_0x3a2c48[_0x0e1c('0x14')](_0x158111);});_0x3d1097['on'](_0x0e1c('0x15'),function(){try{var _0x234f62=new Buffer(_0x1cb509[_0x0e1c('0x16')](_0x0e1c('0x13')),_0x0e1c('0x13'));_0x3a2c48['write'](_0x234f62);_0x3a2c48[_0x0e1c('0x15')]();_0x3a2c48['on'](_0x0e1c('0x17'),function(){return _0xe8e992(_0x6b8f2f);});}catch(_0x39eae8){fs[_0x0e1c('0x18')](_0x6b8f2f);return _0x134877(_0x39eae8);}});});};exports['encryptString']=function(_0x598a65,_0x2ac949,_0x11f197){var _0x41f06d=_0x11f197||stringOptions[_0x0e1c('0x8')];var _0xb120c0=_0x2ac949||stringOptions[_0x0e1c('0x1b')];var _0x1542f0=crypto['createCipher'](_0x41f06d,_0xb120c0);var _0x25d3b8=_0x1542f0[_0x0e1c('0x12')](_0x598a65,_0x0e1c('0x1c'),'base64');_0x25d3b8+=_0x1542f0['final'](_0x0e1c('0x1d'));return _0x25d3b8;};exports['decryptString']=function(_0x578250,_0x508c5c,_0x24b5d6){var _0x532dc7=_0x24b5d6||stringOptions[_0x0e1c('0x8')];var _0x2f4fd0=_0x508c5c||stringOptions['secret'];var _0x2d3ff9=crypto[_0x0e1c('0x1e')](_0x532dc7,_0x2f4fd0);var _0x1e7329=_0x2d3ff9[_0x0e1c('0x12')](_0x578250,_0x0e1c('0x1d'),_0x0e1c('0x1c'));_0x1e7329+=_0x2d3ff9[_0x0e1c('0x16')](_0x0e1c('0x1c'));return _0x1e7329;}; \ No newline at end of file +var _0x7717=['bluebird','../../config/logger','app','secrets','aes-256-ctr','encrypt','algorithm','join','error','getCiphers','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','close','unlink','decryptFile','createDecipher','final','encryptString','base64','secret','utf8'];(function(_0x195eb3,_0x5ebe6f){var _0xf64476=function(_0x3bacae){while(--_0x3bacae){_0x195eb3['push'](_0x195eb3['shift']());}};_0xf64476(++_0x5ebe6f);}(_0x7717,0x105));var _0x7771=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7717[_0x5b644e];return _0x49c6bf;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x7771('0x0'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x7771('0x1'))(_0x7771('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x7771('0x3')]['session'],'algorithm':_0x7771('0x4')};const fileOptions={'algorithm':'aes192'};if(config[_0x7771('0x5')]&&config['encrypt'][_0x7771('0x6')]){var isSupported=isAlgorithmSupported(config[_0x7771('0x5')][_0x7771('0x6')]);if(isSupported){fileOptions['algorithm']=config[_0x7771('0x5')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x7771('0x7')](',\x20');logger[_0x7771('0x8')](config[_0x7771('0x5')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x1817c6){return AES_SUPPORTED_RX['test'](_0x1817c6);}function getSupportedCiphers(){return crypto[_0x7771('0x9')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x1feed5){return getSupportedCiphers()['indexOf'](_0x1feed5)>-0x1;}function combineOptions(_0x5c9a49){var _0xe66058={};for(var _0x2d8503 in fileOptions){if(fileOptions['hasOwnProperty'](_0x2d8503)){_0xe66058[_0x2d8503]=fileOptions[_0x2d8503];}}if(_0x5c9a49){for(var _0x5cdb3b in _0x5c9a49){if(_0x5c9a49[_0x7771('0xa')](_0x5cdb3b)){_0xe66058[_0x5cdb3b]=_0x5c9a49[_0x5cdb3b];}}}return _0xe66058;}exports[_0x7771('0xb')]=function(_0x532adf,_0x1d0264,_0xfef654,_0x2345de){return new BPromise(function(_0x5bde58,_0x197310){_0x2345de=combineOptions(_0x2345de);var _0x1a8f7f=new Buffer(_0xfef654);var _0x13fd9f=fs[_0x7771('0xc')](_0x532adf);var _0x1dcc17=fs[_0x7771('0xd')](_0x1d0264);var _0x298840=crypto[_0x7771('0xe')](_0x2345de[_0x7771('0x6')],_0x1a8f7f);_0x13fd9f['on'](_0x7771('0xf'),function(_0x131071){var _0x51abb1=new Buffer(_0x298840[_0x7771('0x10')](_0x131071),_0x7771('0x11'));_0x1dcc17[_0x7771('0x12')](_0x51abb1);});_0x13fd9f['on'](_0x7771('0x13'),function(){try{var _0x8bb81=new Buffer(_0x298840['final'](_0x7771('0x11')),_0x7771('0x11'));_0x1dcc17[_0x7771('0x12')](_0x8bb81);_0x1dcc17[_0x7771('0x13')]();_0x1dcc17['on'](_0x7771('0x14'),function(){return _0x5bde58(_0x1d0264);});}catch(_0x4c4a9c){fs[_0x7771('0x15')](_0x1d0264);return _0x197310(_0x4c4a9c);}});});};exports[_0x7771('0x16')]=function(_0x380f57,_0x54c291,_0x57fd2b,_0x258cca){return new BPromise(function(_0x4e33a7,_0x43c44b){_0x258cca=combineOptions(_0x258cca);var _0x30e91d=new Buffer(_0x57fd2b);var _0xe2d03b=fs[_0x7771('0xc')](_0x380f57);var _0x4b39c1=fs['createWriteStream'](_0x54c291);var _0x247ee6=crypto[_0x7771('0x17')](_0x258cca[_0x7771('0x6')],_0x30e91d);_0xe2d03b['on'](_0x7771('0xf'),function(_0x4f451f){var _0x41f86a=new Buffer(_0x247ee6[_0x7771('0x10')](_0x4f451f),'binary');_0x4b39c1['write'](_0x41f86a);});_0xe2d03b['on'](_0x7771('0x13'),function(){try{var _0xac934d=new Buffer(_0x247ee6[_0x7771('0x18')]('binary'),_0x7771('0x11'));_0x4b39c1[_0x7771('0x12')](_0xac934d);_0x4b39c1[_0x7771('0x13')]();_0x4b39c1['on'](_0x7771('0x14'),function(){return _0x4e33a7(_0x54c291);});}catch(_0x5f1e0c){fs[_0x7771('0x15')](_0x54c291);return _0x43c44b(_0x5f1e0c);}});});};exports[_0x7771('0x19')]=function(_0x744f7e,_0x2de94f,_0x523502){var _0x3cb668=_0x523502||stringOptions[_0x7771('0x6')];var _0x15e16f=_0x2de94f||stringOptions['secret'];var _0x18eec5=crypto[_0x7771('0xe')](_0x3cb668,_0x15e16f);var _0x119292=_0x18eec5[_0x7771('0x10')](_0x744f7e,'utf8',_0x7771('0x1a'));_0x119292+=_0x18eec5[_0x7771('0x18')](_0x7771('0x1a'));return _0x119292;};exports['decryptString']=function(_0x50eafc,_0xa6df34,_0x5c769d){var _0x5c9a19=_0x5c769d||stringOptions[_0x7771('0x6')];var _0xa67488=_0xa6df34||stringOptions[_0x7771('0x1b')];var _0xc9c326=crypto[_0x7771('0x17')](_0x5c9a19,_0xa67488);var _0x330beb=_0xc9c326[_0x7771('0x10')](_0x50eafc,'base64','utf8');_0x330beb+=_0xc9c326[_0x7771('0x18')](_0x7771('0x1c'));return _0x330beb;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 3af1cef..58c7927 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 _0x5a82=['CSV','Setting','find','then','splitSizeCsv','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','split','existsSync','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Failed','finally','exit','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0x5a82,0xb4));var _0x25a8=function(_0x1ae032,_0xf611ea){_0x1ae032=_0x1ae032-0x0;var _0x318a37=_0x5a82[_0x1ae032];return _0x318a37;};'use strict';var util=require('util');var path=require(_0x25a8('0x0'));var _=require(_0x25a8('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x25a8('0x2'));var zipdir=require(_0x25a8('0x3'));var rimraf=require(_0x25a8('0x4'));var db=require(_0x25a8('0x5'))['db'];var dbH=require('../../mysqldb')[_0x25a8('0x6')];var logger=require('../../config/logger')(_0x25a8('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x25a8('0x8')][0x3];var PATH=process[_0x25a8('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x90dcf4,_0x10b50c){var _0x43b332={'status':_0x90dcf4};var _0x43cb85={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x10b50c){_0x43b332['savename']=_0x10b50c;}return db['AnalyticExtractedReport'][_0x25a8('0x9')](_0x43b332,_0x43cb85);}function main(){var _0x4ae057=0x1388;var _0x51f540;logger[_0x25a8('0xa')](util['format'](_0x25a8('0xb'),EXTRACTED_REPORT_ID,_0x25a8('0xc')));return db[_0x25a8('0xd')][_0x25a8('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x25a8('0xf')](function(_0x3955f3){if(_0x3955f3){_0x51f540=_0x3955f3;_0x4ae057=_0x51f540[_0x25a8('0x10')]||0x1388;}})[_0x25a8('0xf')](function(){return dbH[_0x25a8('0x11')][_0x25a8('0x12')](util[_0x25a8('0x13')](_0x25a8('0x14'),QUERY),{'type':dbH[_0x25a8('0x11')][_0x25a8('0x15')][_0x25a8('0x16')]});})[_0x25a8('0xf')](function(_0x184e92){if(!_0x184e92[0x0][_0x25a8('0x17')]){return analyticExtractedReport('Empty');}var _0xb4358d=[];var _0x5bd190=0x0;if(_0x51f540['split']){if(_0x184e92&&_0x184e92[_0x25a8('0x18')]){var _0x1ebe78=_[_0x25a8('0x19')](_0x184e92[0x0][_0x25a8('0x17')]/_0x4ae057);var _0x532e33=Number['isInteger'](_0x184e92[0x0][_0x25a8('0x17')]/_0x4ae057)?_0x184e92[0x0]['num']%_0x4ae057:0x0;_0x1ebe78['forEach'](function(_0x3d4408){if(_0x3d4408>0x0){_0x5bd190+=_0x4ae057;}_0xb4358d['push'](dbH[_0x25a8('0x11')][_0x25a8('0x12')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4ae057,_0x5bd190),{'type':dbH[_0x25a8('0x11')][_0x25a8('0x15')][_0x25a8('0x16')]}));});if(_0x532e33>0x0){_0x5bd190+=_0x4ae057;_0xb4358d[_0x25a8('0x1a')](dbH[_0x25a8('0x11')][_0x25a8('0x12')](util[_0x25a8('0x13')](_0x25a8('0x1b'),QUERY,_0x532e33,_0x5bd190),{'type':dbH['sequelize'][_0x25a8('0x15')]['SELECT']}));}}}else{_0xb4358d[_0x25a8('0x1a')](dbH[_0x25a8('0x11')][_0x25a8('0x12')](QUERY,{'type':dbH[_0x25a8('0x11')][_0x25a8('0x15')][_0x25a8('0x16')]}));}var _0x305c4b=path[_0x25a8('0x1c')](PATH);var _0x5b8fcf=path[_0x25a8('0x1d')](PATH,_0x25a8('0x1e'));var _0x348634=_0x51f540[_0x25a8('0x1f')]&&_0xb4358d[_0x25a8('0x18')]>0x1;var _0x467be8=[];if(!fs[_0x25a8('0x20')](path[_0x25a8('0x21')](_0x305c4b,_0x5b8fcf))&&_0x348634){fs[_0x25a8('0x22')](path[_0x25a8('0x21')](_0x305c4b,_0x5b8fcf));}return BPromise[_0x25a8('0x23')](_0xb4358d,function(_0x257d42){_0x467be8['push'](_0x257d42);})[_0x25a8('0xf')](function(){for(var _0x4940ae=0x0;_0x4940ae<_0x467be8[_0x25a8('0x18')];_0x4940ae+=0x1){var _0x37c37f;var _0x4867af=_0x467be8[_0x4940ae];if(_0x348634){_0x37c37f=path[_0x25a8('0x21')](_0x305c4b,_0x5b8fcf,util[_0x25a8('0x13')](_0x25a8('0x24'),_0x5b8fcf,_0x4940ae,_0x25a8('0x25')));}else{_0x37c37f=path[_0x25a8('0x21')](_0x305c4b,util['format']('%s.%s',_0x5b8fcf,'csv'));}fs[_0x25a8('0x26')](_0x37c37f,csv(_0x4867af));}})[_0x25a8('0xf')](function(){if(_0x348634){return new Promise(function(_0x51f45e){zipdir(path[_0x25a8('0x21')](_0x305c4b,_0x5b8fcf),{'saveTo':path['join'](_0x305c4b,util[_0x25a8('0x13')](_0x25a8('0x27'),_0x5b8fcf,_0x25a8('0x28')))},function(_0x965b78,_0x12e415){rimraf(path[_0x25a8('0x21')](_0x305c4b,_0x5b8fcf),function(){});_0x51f45e(_0x25a8('0x29'));});});}})[_0x25a8('0xf')](function(){logger[_0x25a8('0xa')](util['format'](_0x25a8('0x2a'),EXTRACTED_REPORT_ID,_0x25a8('0xc')));return analyticExtractedReport(_0x25a8('0x2b'),_0x348634?util[_0x25a8('0x13')](_0x25a8('0x27'),_0x5b8fcf,_0x348634?_0x25a8('0x28'):_0x25a8('0x25')):null);});})[_0x25a8('0x2c')](function(_0x71a53f){logger[_0x25a8('0xa')](util[_0x25a8('0x13')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x71a53f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x25a8('0x2d'));})[_0x25a8('0x2e')](function(){process[_0x25a8('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2019=['argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Completed','inspect','Failed','finally','exit','path','to-csv','bluebird','zip-dir','../../mysqldb','../../config/logger','analytics'];(function(_0x597eb6,_0x4fbdea){var _0x58c0fb=function(_0x357767){while(--_0x357767){_0x597eb6['push'](_0x597eb6['shift']());}};_0x58c0fb(++_0x4fbdea);}(_0x2019,0x86));var _0x9201=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x2019[_0x1d24eb];return _0x1dc576;};'use strict';var util=require('util');var path=require(_0x9201('0x0'));var _=require('lodash');var csv=require(_0x9201('0x1'));var fs=require('fs');var BPromise=require(_0x9201('0x2'));var zipdir=require(_0x9201('0x3'));var rimraf=require('rimraf');var db=require(_0x9201('0x4'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x9201('0x5'))(_0x9201('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x9201('0x7')][0x3];var PATH=process[_0x9201('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4ad67c,_0x206d43){var _0x46040c={'status':_0x4ad67c};var _0x594ba2={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x206d43){_0x46040c[_0x9201('0x8')]=_0x206d43;}return db[_0x9201('0x9')][_0x9201('0xa')](_0x46040c,_0x594ba2);}function main(){var _0xd9822c=0x1388;var _0x1d12a0;logger[_0x9201('0xb')](util[_0x9201('0xc')](_0x9201('0xd'),EXTRACTED_REPORT_ID,_0x9201('0xe')));return db['Setting'][_0x9201('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9201('0x10'),_0x9201('0x11')]})[_0x9201('0x12')](function(_0x31ca10){if(_0x31ca10){_0x1d12a0=_0x31ca10;_0xd9822c=_0x1d12a0['splitSizeCsv']||0x1388;}})[_0x9201('0x12')](function(){return dbH[_0x9201('0x13')][_0x9201('0x14')](util[_0x9201('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x9201('0x15')][_0x9201('0x16')]});})['then'](function(_0x2ae376){if(!_0x2ae376[0x0][_0x9201('0x17')]){return analyticExtractedReport(_0x9201('0x18'));}var _0x259024=[];var _0x84d66a=0x0;if(_0x1d12a0[_0x9201('0x10')]){if(_0x2ae376&&_0x2ae376[_0x9201('0x19')]){var _0x525d57=_[_0x9201('0x1a')](_0x2ae376[0x0][_0x9201('0x17')]/_0xd9822c);var _0x2f1120=Number[_0x9201('0x1b')](_0x2ae376[0x0][_0x9201('0x17')]/_0xd9822c)?_0x2ae376[0x0][_0x9201('0x17')]%_0xd9822c:0x0;_0x525d57[_0x9201('0x1c')](function(_0x27fb8d){if(_0x27fb8d>0x0){_0x84d66a+=_0xd9822c;}_0x259024[_0x9201('0x1d')](dbH['sequelize']['query'](util[_0x9201('0xc')](_0x9201('0x1e'),QUERY,_0xd9822c,_0x84d66a),{'type':dbH[_0x9201('0x13')][_0x9201('0x15')][_0x9201('0x16')]}));});if(_0x2f1120>0x0){_0x84d66a+=_0xd9822c;_0x259024[_0x9201('0x1d')](dbH[_0x9201('0x13')][_0x9201('0x14')](util[_0x9201('0xc')](_0x9201('0x1e'),QUERY,_0x2f1120,_0x84d66a),{'type':dbH[_0x9201('0x13')][_0x9201('0x15')]['SELECT']}));}}}else{_0x259024[_0x9201('0x1d')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0x9201('0x15')]['SELECT']}));}var _0x5a5cfa=path['dirname'](PATH);var _0x1ed4f0=path[_0x9201('0x1f')](PATH,'.csv');var _0xf4ea54=_0x1d12a0[_0x9201('0x10')]&&_0x259024[_0x9201('0x19')]>0x1;var _0x219f3a=[];if(!fs[_0x9201('0x20')](path[_0x9201('0x21')](_0x5a5cfa,_0x1ed4f0))&&_0xf4ea54){fs[_0x9201('0x22')](path['join'](_0x5a5cfa,_0x1ed4f0));}return BPromise[_0x9201('0x23')](_0x259024,function(_0x16cf7e){_0x219f3a['push'](_0x16cf7e);})[_0x9201('0x12')](function(){for(var _0x4aefd4=0x0;_0x4aefd4<_0x219f3a['length'];_0x4aefd4+=0x1){var _0x3ed811;var _0x25de6d=_0x219f3a[_0x4aefd4];if(_0xf4ea54){_0x3ed811=path[_0x9201('0x21')](_0x5a5cfa,_0x1ed4f0,util[_0x9201('0xc')](_0x9201('0x24'),_0x1ed4f0,_0x4aefd4,_0x9201('0x25')));}else{_0x3ed811=path[_0x9201('0x21')](_0x5a5cfa,util[_0x9201('0xc')](_0x9201('0x26'),_0x1ed4f0,_0x9201('0x25')));}fs[_0x9201('0x27')](_0x3ed811,csv(_0x25de6d));}})['then'](function(){if(_0xf4ea54){return new Promise(function(_0x4e9af1){zipdir(path[_0x9201('0x21')](_0x5a5cfa,_0x1ed4f0),{'saveTo':path['join'](_0x5a5cfa,util[_0x9201('0xc')]('%s.%s',_0x1ed4f0,_0x9201('0x28')))},function(_0x1e3a16,_0x357e2a){rimraf(path[_0x9201('0x21')](_0x5a5cfa,_0x1ed4f0),function(){});_0x4e9af1(_0x9201('0x29'));});});}})[_0x9201('0x12')](function(){logger[_0x9201('0xb')](util[_0x9201('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x9201('0xe')));return analyticExtractedReport(_0x9201('0x2a'),_0xf4ea54?util[_0x9201('0xc')](_0x9201('0x26'),_0x1ed4f0,_0xf4ea54?_0x9201('0x28'):'csv'):null);});})['catch'](function(_0x5be0e6){logger[_0x9201('0xb')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x9201('0xe')),util[_0x9201('0x2b')](_0x5be0e6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9201('0x2c'));})[_0x9201('0x2d')](function(){process[_0x9201('0x2e')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 63a0278..2ffcc6e 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 _0x7f67=['catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.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','pipe','finish','end','createPdfFromHTML','createPdfKitDocument','path','lodash','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','toString','value','fill','length','body','push','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','right','num','Empty','Setting','find','splitSizePdf','then','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','split','existsSync','join','mkdirSync','each','flatten','pdf','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x401669,_0x508d89){var _0x50d7d0=function(_0x49f0f0){while(--_0x49f0f0){_0x401669['push'](_0x401669['shift']());}};_0x50d7d0(++_0x508d89);}(_0x7f67,0x124));var _0x77f6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7f67[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x77f6('0x0'));var fs=require('fs');var util=require('util');var path=require('path');var moment=require(_0x77f6('0x1'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x77f6('0x2'));var zipdir=require(_0x77f6('0x3'));var rimraf=require(_0x77f6('0x4'));var JSDOM=require(_0x77f6('0x5'))[_0x77f6('0x6')];var window=new JSDOM('')[_0x77f6('0x7')];var BPromise=require(_0x77f6('0x8'));var db=require('../../mysqldb')['db'];var dbH=require(_0x77f6('0x9'))[_0x77f6('0xa')];var logger=require('../../config/logger')(_0x77f6('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x77f6('0xc')][0x2]);var QUERY=process[_0x77f6('0xc')][0x3];var PATH=process[_0x77f6('0xc')][0x4];var NAME=process[_0x77f6('0xc')][0x5];var FORMAT=_0x77f6('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2838d9,_0x451e5c){var _0x92736f={'status':_0x2838d9};var _0x12efed={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x451e5c){_0x92736f[_0x77f6('0xe')]=_0x451e5c;}return db[_0x77f6('0xf')][_0x77f6('0x10')](_0x92736f,_0x12efed);}function getHeaders(_0x122049){return _[_0x77f6('0x11')](_0x122049,function(_0x4dd395){return{'text':_0x4dd395,'style':'tableHeader'};});}function getRows(_0xe81013,_0x1f38f1){return _['map'](_0x1f38f1,function(_0xbe7ed4){return _(_0xbe7ed4)[_0x77f6('0x12')](_0xe81013)[_0x77f6('0x11')](function(_0xec54f8){return _0xec54f8?_[_0x77f6('0x13')](_0xec54f8):'';})[_0x77f6('0x14')]();});}function createTable(_0x257d26,_0x555c16){var _0x3ece07={'widths':_[_0x77f6('0x15')](Array(_0x257d26[_0x77f6('0x16')]),0x91),'heights':function(_0x4db442){return _0x4db442===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x26b0af=getHeaders(_0x257d26);_0x3ece07[_0x77f6('0x17')][_0x77f6('0x18')](_0x26b0af);var _0x3e28a2=getRows(_0x257d26,_0x555c16);_0x3ece07[_0x77f6('0x17')]=_0x3ece07[_0x77f6('0x17')]['concat'](_0x3e28a2);return _0x3ece07;}function createTables(_0x56aebd){var _0x294f82=[];var _0x473944=_[_0x77f6('0x19')](Object[_0x77f6('0x1a')](_0x56aebd[0x0]),0x5);_0x473944[_0x77f6('0x1b')](function(_0x36b1bf){_0x294f82[_0x77f6('0x18')](createTable(_0x36b1bf,_0x56aebd));});return _0x294f82;}function getPDFDocDefinition(_0x12d998){var _0x14734a=util[_0x77f6('0x1c')](_0x77f6('0x1d'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x77f6('0x1e')])[_0x77f6('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x77f6('0x1f')])[_0x77f6('0x1c')](FORMAT));var _0x16313f=[];for(var _0x22d5cd=0x0;_0x22d5cd<_0x12d998['length'];_0x22d5cd++){var _0x1d140b=[];if(_0x22d5cd===0x0){_0x1d140b[_0x77f6('0x18')]({'text':_0x14734a,'style':_0x77f6('0x20')});}var _0x3819d8={'table':_0x12d998[_0x22d5cd]};if(_0x22d5cd>0x0){_0x3819d8[_0x77f6('0x21')]=_0x77f6('0x22');_0x3819d8[_0x77f6('0x23')]=[0x0,0x46,0x0,0x0];}_0x1d140b['push'](_0x3819d8);_0x16313f['push'](_0x1d140b);}return{'pageSize':'A4','pageOrientation':_0x77f6('0x24'),'content':_0x16313f,'footer':function(_0x4c9884,_0xd8d47f){return{'text':_0x4c9884[_0x77f6('0x13')]()+_0x77f6('0x25')+_0xd8d47f,'style':_0x77f6('0x26')};},'defaultStyle':{'font':_0x77f6('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x77f6('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3c8513){var _0x313654=0x1388;var _0x393ded;if(!_0x3c8513[0x0][_0x77f6('0x29')]){return analyticExtractedReport(_0x77f6('0x2a'));}return db[_0x77f6('0x2b')][_0x77f6('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x77f6('0x2d')]})['then'](function(_0x447431){if(_0x447431){_0x393ded=_0x447431;_0x313654=_0x393ded[_0x77f6('0x2d')]||0x3e8;}})[_0x77f6('0x2e')](function(){var _0x1318e0=[];var _0x1a1838=0x0;if(_0x393ded['split']){if(_0x3c8513&&_0x3c8513['length']){var _0x1455fd=_['range'](_0x3c8513[0x0]['num']/_0x313654);var _0x14c96f=Number[_0x77f6('0x2f')](_0x3c8513[0x0][_0x77f6('0x29')]/_0x313654)?_0x3c8513[0x0][_0x77f6('0x29')]%_0x313654:0x0;_0x1455fd[_0x77f6('0x1b')](function(_0x131a6f){if(_0x131a6f>0x0){_0x1a1838+=_0x313654;}_0x1318e0['push'](dbH[_0x77f6('0x30')][_0x77f6('0x31')](util[_0x77f6('0x1c')](_0x77f6('0x32'),QUERY,_0x313654,_0x1a1838),{'type':dbH[_0x77f6('0x30')][_0x77f6('0x33')][_0x77f6('0x34')]}));});if(_0x14c96f>0x0){_0x1a1838+=_0x313654;_0x1318e0[_0x77f6('0x18')](dbH[_0x77f6('0x30')]['query'](util[_0x77f6('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14c96f,_0x1a1838),{'type':dbH[_0x77f6('0x30')][_0x77f6('0x33')][_0x77f6('0x34')]}));}}}else{_0x1318e0[_0x77f6('0x18')](dbH[_0x77f6('0x30')]['query'](QUERY,{'type':dbH[_0x77f6('0x30')]['QueryTypes'][_0x77f6('0x34')]}));}var _0x34bf34=path[_0x77f6('0x35')](PATH);var _0x4b86f0=path[_0x77f6('0x36')](PATH,_0x77f6('0x37'));var _0x29c401=_0x393ded[_0x77f6('0x38')]&&_0x1318e0['length']>0x1;var _0x1cfc8f=[];if(!fs[_0x77f6('0x39')](path[_0x77f6('0x3a')](_0x34bf34,_0x4b86f0))&&_0x29c401){fs[_0x77f6('0x3b')](path[_0x77f6('0x3a')](_0x34bf34,_0x4b86f0));}return BPromise[_0x77f6('0x3c')](_0x1318e0,function(_0x5bcebe){_0x1cfc8f[_0x77f6('0x18')](_0x5bcebe);})[_0x77f6('0x2e')](function(){var _0x12179c=[];for(var _0x16f32f=0x0;_0x16f32f<_0x1cfc8f[_0x77f6('0x16')];_0x16f32f+=0x1){var _0x294f68=_0x1cfc8f[_0x16f32f];var _0xcfc0fe=createTables(_[_0x77f6('0x3d')](_0x294f68));var _0x53b387;var _0x1b4c33=getPDFDocDefinition(_0xcfc0fe);var _0xe7e3af=getPDFPrinter();var _0x393862=_0xe7e3af['createPdfKitDocument'](_0x1b4c33);if(_0x29c401){_0x53b387=path['join'](_0x34bf34,_0x4b86f0,util[_0x77f6('0x1c')]('%s%d.%s',_0x4b86f0,_0x16f32f,_0x77f6('0x3e')));}else{_0x53b387=path['join'](_0x34bf34,util[_0x77f6('0x1c')](_0x77f6('0x3f'),_0x4b86f0,_0x77f6('0x3e')));}_0x12179c['push'](writePDFDocument(_0x393862,_0x53b387));}return Promise['all'](_0x12179c);})[_0x77f6('0x2e')](function(){if(_0x29c401){return new Promise(function(_0x81f1d6){zipdir(path['join'](_0x34bf34,_0x4b86f0),{'saveTo':path[_0x77f6('0x3a')](_0x34bf34,util[_0x77f6('0x1c')](_0x77f6('0x3f'),_0x4b86f0,_0x77f6('0x40')))},function(){rimraf(path[_0x77f6('0x3a')](_0x34bf34,_0x4b86f0),function(){});_0x81f1d6(_0x77f6('0x41'));});});}})[_0x77f6('0x2e')](function(){if(!_0x29c401)return;rimraf(path['join'](_0x34bf34,_0x4b86f0),function(){});})['then'](function(){logger[_0x77f6('0x42')](util[_0x77f6('0x1c')](_0x77f6('0x43'),EXTRACTED_REPORT_ID,_0x77f6('0x44')));return analyticExtractedReport(_0x77f6('0x45'),_0x29c401?util['format'](_0x77f6('0x3f'),_0x4b86f0,_0x29c401?_0x77f6('0x40'):_0x77f6('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x77f6('0x42')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x77f6('0x44')));return db[_0x77f6('0xf')][_0x77f6('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x5647c6){EXTRACTED_REPORT=_0x5647c6;return dbH[_0x77f6('0x30')][_0x77f6('0x31')](util[_0x77f6('0x1c')](_0x77f6('0x47'),QUERY),{'type':dbH['sequelize'][_0x77f6('0x33')][_0x77f6('0x34')]});})[_0x77f6('0x2e')](extractReport)[_0x77f6('0x48')](function(_0x282758){logger[_0x77f6('0x42')](util[_0x77f6('0x1c')](_0x77f6('0x49'),EXTRACTED_REPORT_ID,_0x77f6('0x44')),util['inspect'](_0x282758,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x77f6('0x4a'));})[_0x77f6('0x4b')](function(){process[_0x77f6('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x567b9a=new PdfPrinter({'Arial':{'normal':__dirname+_0x77f6('0x4d'),'bold':__dirname+_0x77f6('0x4e'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x77f6('0x4f')}});return _0x567b9a;}function getPDFDocDefinitionFromHTML(_0x1c7d12,_0x5dbf03){var _0x42d487=util[_0x77f6('0x1c')](_0x77f6('0x50'),_0x5dbf03['channel'],_0x5dbf03[_0x77f6('0x51')]);var _0x4175ac=moment()[_0x77f6('0x1c')](_0x77f6('0x52'))['toString']();var _0x2055ac=htmlToPdfmake(_0x1c7d12,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2055ac],'defaultStyle':{'font':_0x77f6('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x77f6('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x77f6('0x53')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x77f6('0x20')}];},'footer':function(_0x519519,_0x543c86){return[{'text':util['format'](_0x77f6('0x54'),_0x42d487,_0x519519,_0x543c86,_0x4175ac),'style':_0x77f6('0x26')}];}};}function writePDFDocument(_0x5685a2,_0x55b8c3){return new Promise(function(_0x1f7cc6,_0x2275cf){var _0x45f824=_0x5685a2[_0x77f6('0x55')](fs['createWriteStream'](_0x55b8c3));_0x45f824['on'](_0x77f6('0x56'),function(){_0x1f7cc6(_0x77f6('0x56'));});_0x45f824['on']('error',function(_0x5a98a4){_0x2275cf(_0x5a98a4);});_0x5685a2[_0x77f6('0x57')]();});}exports[_0x77f6('0x58')]=function(_0x35592b,_0x173b51){var _0x558d2c=getPDFPrinter();var _0x57183b=getPDFDocDefinitionFromHTML(_0x35592b,_0x173b51);var _0x52d652=_0x558d2c[_0x77f6('0x59')](_0x57183b);return writePDFDocument(_0x52d652,_0x173b51[_0x77f6('0x5a')])[_0x77f6('0x48')](function(_0x581b98){throw _0x581b98;});}; \ No newline at end of file +var _0x4a88=['info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','util','path','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value','fill','length','body','push','concat','chunk','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','format','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','splitSizePdf','then','split','isInteger','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.pdf','existsSync','mkdirSync','each','flatten','join','pdf','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF'];(function(_0x47a768,_0x3357cc){var _0x5d756d=function(_0x3d89b4){while(--_0x3d89b4){_0x47a768['push'](_0x47a768['shift']());}};_0x5d756d(++_0x3357cc);}(_0x4a88,0x124));var _0x84a8=function(_0x5d64f4,_0xee9469){_0x5d64f4=_0x5d64f4-0x0;var _0x39390e=_0x4a88[_0x5d64f4];return _0x39390e;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x84a8('0x0'));var path=require(_0x84a8('0x1'));var moment=require('moment');var htmlToPdfmake=require(_0x84a8('0x2'));var PdfPrinter=require(_0x84a8('0x3'));var zipdir=require(_0x84a8('0x4'));var rimraf=require(_0x84a8('0x5'));var JSDOM=require(_0x84a8('0x6'))[_0x84a8('0x7')];var window=new JSDOM('')[_0x84a8('0x8')];var BPromise=require(_0x84a8('0x9'));var db=require('../../mysqldb')['db'];var dbH=require(_0x84a8('0xa'))[_0x84a8('0xb')];var logger=require(_0x84a8('0xc'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x84a8('0xd')][0x2]);var QUERY=process[_0x84a8('0xd')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x84a8('0xd')][0x5];var FORMAT=_0x84a8('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2ff62c,_0x2f9602){var _0x4d482b={'status':_0x2ff62c};var _0x2297b8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2f9602){_0x4d482b[_0x84a8('0xf')]=_0x2f9602;}return db[_0x84a8('0x10')][_0x84a8('0x11')](_0x4d482b,_0x2297b8);}function getHeaders(_0x5bc67e){return _[_0x84a8('0x12')](_0x5bc67e,function(_0x2cdd1f){return{'text':_0x2cdd1f,'style':_0x84a8('0x13')};});}function getRows(_0x4df546,_0x1ce934){return _['map'](_0x1ce934,function(_0x484602){return _(_0x484602)['pick'](_0x4df546)[_0x84a8('0x12')](function(_0x187036){return _0x187036?_[_0x84a8('0x14')](_0x187036):'';})[_0x84a8('0x15')]();});}function createTable(_0x4b8d40,_0x1f23b7){var _0x4a0633={'widths':_[_0x84a8('0x16')](Array(_0x4b8d40[_0x84a8('0x17')]),0x91),'heights':function(_0x3393d6){return _0x3393d6===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1633c6=getHeaders(_0x4b8d40);_0x4a0633[_0x84a8('0x18')][_0x84a8('0x19')](_0x1633c6);var _0x298363=getRows(_0x4b8d40,_0x1f23b7);_0x4a0633['body']=_0x4a0633[_0x84a8('0x18')][_0x84a8('0x1a')](_0x298363);return _0x4a0633;}function createTables(_0x6cde72){var _0x33d8e=[];var _0x3a68b4=_[_0x84a8('0x1b')](Object['keys'](_0x6cde72[0x0]),0x5);_0x3a68b4[_0x84a8('0x1c')](function(_0x247606){_0x33d8e[_0x84a8('0x19')](createTable(_0x247606,_0x6cde72));});return _0x33d8e;}function getPDFDocDefinition(_0x15b1a8){var _0xcef35d=util['format'](_0x84a8('0x1d'),NAME,EXTRACTED_REPORT[_0x84a8('0x1e')],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x84a8('0x1f')](FORMAT));var _0x5d1de0=[];for(var _0x51e33c=0x0;_0x51e33c<_0x15b1a8['length'];_0x51e33c++){var _0x25a623=[];if(_0x51e33c===0x0){_0x25a623['push']({'text':_0xcef35d,'style':_0x84a8('0x20')});}var _0x35028d={'table':_0x15b1a8[_0x51e33c]};if(_0x51e33c>0x0){_0x35028d[_0x84a8('0x21')]=_0x84a8('0x22');_0x35028d[_0x84a8('0x23')]=[0x0,0x46,0x0,0x0];}_0x25a623[_0x84a8('0x19')](_0x35028d);_0x5d1de0[_0x84a8('0x19')](_0x25a623);}return{'pageSize':'A4','pageOrientation':_0x84a8('0x24'),'content':_0x5d1de0,'footer':function(_0x43910e,_0x114094){return{'text':_0x43910e[_0x84a8('0x14')]()+_0x84a8('0x25')+_0x114094,'style':_0x84a8('0x26')};},'defaultStyle':{'font':_0x84a8('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x84a8('0x28')},'footer':{'alignment':_0x84a8('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x30abff){var _0x36880c=0x1388;var _0x287ba9;if(!_0x30abff[0x0][_0x84a8('0x2a')]){return analyticExtractedReport(_0x84a8('0x2b'));}return db[_0x84a8('0x2c')][_0x84a8('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x84a8('0x2e')]})['then'](function(_0x424cd8){if(_0x424cd8){_0x287ba9=_0x424cd8;_0x36880c=_0x287ba9[_0x84a8('0x2e')]||0x3e8;}})[_0x84a8('0x2f')](function(){var _0x24a4a2=[];var _0x3a5026=0x0;if(_0x287ba9[_0x84a8('0x30')]){if(_0x30abff&&_0x30abff[_0x84a8('0x17')]){var _0xb2995=_['range'](_0x30abff[0x0][_0x84a8('0x2a')]/_0x36880c);var _0x1f7e7d=Number[_0x84a8('0x31')](_0x30abff[0x0][_0x84a8('0x2a')]/_0x36880c)?_0x30abff[0x0][_0x84a8('0x2a')]%_0x36880c:0x0;_0xb2995['forEach'](function(_0x356180){if(_0x356180>0x0){_0x3a5026+=_0x36880c;}_0x24a4a2[_0x84a8('0x19')](dbH[_0x84a8('0x32')][_0x84a8('0x33')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x36880c,_0x3a5026),{'type':dbH[_0x84a8('0x32')][_0x84a8('0x34')][_0x84a8('0x35')]}));});if(_0x1f7e7d>0x0){_0x3a5026+=_0x36880c;_0x24a4a2['push'](dbH['sequelize'][_0x84a8('0x33')](util[_0x84a8('0x1f')](_0x84a8('0x36'),QUERY,_0x1f7e7d,_0x3a5026),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x24a4a2['push'](dbH[_0x84a8('0x32')][_0x84a8('0x33')](QUERY,{'type':dbH[_0x84a8('0x32')]['QueryTypes'][_0x84a8('0x35')]}));}var _0x3ec9e7=path[_0x84a8('0x37')](PATH);var _0x51a225=path['basename'](PATH,_0x84a8('0x38'));var _0x48dadb=_0x287ba9[_0x84a8('0x30')]&&_0x24a4a2['length']>0x1;var _0x151aa4=[];if(!fs[_0x84a8('0x39')](path['join'](_0x3ec9e7,_0x51a225))&&_0x48dadb){fs[_0x84a8('0x3a')](path['join'](_0x3ec9e7,_0x51a225));}return BPromise[_0x84a8('0x3b')](_0x24a4a2,function(_0x35db1c){_0x151aa4['push'](_0x35db1c);})[_0x84a8('0x2f')](function(){var _0x472b0e=[];for(var _0x2ddc50=0x0;_0x2ddc50<_0x151aa4[_0x84a8('0x17')];_0x2ddc50+=0x1){var _0xcbaef7=_0x151aa4[_0x2ddc50];var _0x3f0d98=createTables(_[_0x84a8('0x3c')](_0xcbaef7));var _0x6f6cfb;var _0x37c309=getPDFDocDefinition(_0x3f0d98);var _0x45a4a7=getPDFPrinter();var _0x439f6a=_0x45a4a7['createPdfKitDocument'](_0x37c309);if(_0x48dadb){_0x6f6cfb=path[_0x84a8('0x3d')](_0x3ec9e7,_0x51a225,util['format']('%s%d.%s',_0x51a225,_0x2ddc50,_0x84a8('0x3e')));}else{_0x6f6cfb=path[_0x84a8('0x3d')](_0x3ec9e7,util[_0x84a8('0x1f')](_0x84a8('0x3f'),_0x51a225,_0x84a8('0x3e')));}_0x472b0e[_0x84a8('0x19')](writePDFDocument(_0x439f6a,_0x6f6cfb));}return Promise['all'](_0x472b0e);})[_0x84a8('0x2f')](function(){if(_0x48dadb){return new Promise(function(_0x20ef7f){zipdir(path[_0x84a8('0x3d')](_0x3ec9e7,_0x51a225),{'saveTo':path[_0x84a8('0x3d')](_0x3ec9e7,util[_0x84a8('0x1f')]('%s.%s',_0x51a225,_0x84a8('0x40')))},function(){rimraf(path['join'](_0x3ec9e7,_0x51a225),function(){});_0x20ef7f(_0x84a8('0x41'));});});}})[_0x84a8('0x2f')](function(){if(!_0x48dadb)return;rimraf(path[_0x84a8('0x3d')](_0x3ec9e7,_0x51a225),function(){});})[_0x84a8('0x2f')](function(){logger['info'](util[_0x84a8('0x1f')](_0x84a8('0x42'),EXTRACTED_REPORT_ID,_0x84a8('0x43')));return analyticExtractedReport('Completed',_0x48dadb?util[_0x84a8('0x1f')](_0x84a8('0x3f'),_0x51a225,_0x48dadb?_0x84a8('0x40'):_0x84a8('0x3e')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x84a8('0x44')](util['format'](_0x84a8('0x45'),EXTRACTED_REPORT_ID,_0x84a8('0x43')));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x84a8('0x2f')](function(_0xfef58b){EXTRACTED_REPORT=_0xfef58b;return dbH[_0x84a8('0x32')][_0x84a8('0x33')](util[_0x84a8('0x1f')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x84a8('0x32')][_0x84a8('0x34')]['SELECT']});})[_0x84a8('0x2f')](extractReport)['catch'](function(_0x16bca2){logger[_0x84a8('0x44')](util['format'](_0x84a8('0x46'),EXTRACTED_REPORT_ID,_0x84a8('0x43')),util['inspect'](_0x16bca2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x84a8('0x47'));})['finally'](function(){process[_0x84a8('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3c7ffc=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x84a8('0x49'),'italics':__dirname+_0x84a8('0x4a'),'bolditalics':__dirname+_0x84a8('0x4b')}});return _0x3c7ffc;}function getPDFDocDefinitionFromHTML(_0x5c5c06,_0x5297cb){var _0x5a3d99=util[_0x84a8('0x1f')](_0x84a8('0x4c'),_0x5297cb[_0x84a8('0x4d')],_0x5297cb[_0x84a8('0x4e')]);var _0x72091a=moment()[_0x84a8('0x1f')](_0x84a8('0x4f'))[_0x84a8('0x14')]();var _0x21b33d=htmlToPdfmake(_0x5c5c06,{'window':window,'tableAutoSize':!![]});return{'content':[_0x21b33d],'defaultStyle':{'font':_0x84a8('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x84a8('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x84a8('0x50')}},'header':function(){return[{'text':_0x84a8('0x51'),'style':_0x84a8('0x20')}];},'footer':function(_0x5b3bf6,_0x195a77){return[{'text':util['format'](_0x84a8('0x52'),_0x5a3d99,_0x5b3bf6,_0x195a77,_0x72091a),'style':_0x84a8('0x26')}];}};}function writePDFDocument(_0x2b02fa,_0x14f339){return new Promise(function(_0x498f94,_0x12ae2d){var _0x1043af=_0x2b02fa[_0x84a8('0x53')](fs[_0x84a8('0x54')](_0x14f339));_0x1043af['on'](_0x84a8('0x55'),function(){_0x498f94(_0x84a8('0x55'));});_0x1043af['on'](_0x84a8('0x56'),function(_0x1caee2){_0x12ae2d(_0x1caee2);});_0x2b02fa[_0x84a8('0x57')]();});}exports[_0x84a8('0x58')]=function(_0x566769,_0x1cfa34){var _0x1b3f66=getPDFPrinter();var _0x47d80d=getPDFDocDefinitionFromHTML(_0x566769,_0x1cfa34);var _0x421603=_0x1b3f66[_0x84a8('0x59')](_0x47d80d);return writePDFDocument(_0x421603,_0x1cfa34[_0x84a8('0x1')])['catch'](function(_0x564292){throw _0x564292;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 512bc4b..3f4f029 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 _0xadce=['info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','util','lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','savename','AnalyticExtractedReport','format','XLSX','Setting','find','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','then','num','Empty','split','range','isInteger','forEach','SELECT','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','mkdirSync','length','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip'];(function(_0x5ef6e8,_0x4097eb){var _0x1fbef6=function(_0x36692f){while(--_0x36692f){_0x5ef6e8['push'](_0x5ef6e8['shift']());}};_0x1fbef6(++_0x4097eb);}(_0xadce,0x1dc));var _0xeadc=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xadce[_0x46698a];return _0x356db0;};'use strict';var util=require(_0xeadc('0x0'));var path=require('path');var _=require(_0xeadc('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xeadc('0x2'));var zipdir=require(_0xeadc('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xeadc('0x4'))[_0xeadc('0x5')];var logger=require(_0xeadc('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2ab456,_0x368a9a){var _0x4860de={'status':_0x2ab456};var _0x1f7465={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x368a9a){_0x4860de[_0xeadc('0x7')]=_0x368a9a;}return db[_0xeadc('0x8')]['update'](_0x4860de,_0x1f7465);}function main(){var _0xcd3de7=0x1388;var _0x4faccb;logger['info'](util[_0xeadc('0x9')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xeadc('0xa')));return db[_0xeadc('0xb')][_0xeadc('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xeadc('0xd')]})['then'](function(_0x53139b){if(_0x53139b){_0x4faccb=_0x53139b;_0xcd3de7=_0x4faccb[_0xeadc('0xd')]||0x1388;}})['then'](function(){return dbH[_0xeadc('0xe')][_0xeadc('0xf')](util['format'](_0xeadc('0x10'),QUERY),{'type':dbH[_0xeadc('0xe')][_0xeadc('0x11')]['SELECT']});})[_0xeadc('0x12')](function(_0x39abd5){if(!_0x39abd5[0x0][_0xeadc('0x13')]){return analyticExtractedReport(_0xeadc('0x14'));}var _0xb65a94=[];var _0x5367fe=0x0;if(_0x4faccb[_0xeadc('0x15')]){if(_0x39abd5&&_0x39abd5['length']){var _0x33191a=_[_0xeadc('0x16')](_0x39abd5[0x0][_0xeadc('0x13')]/_0xcd3de7);var _0x3020c1=Number[_0xeadc('0x17')](_0x39abd5[0x0]['num']/_0xcd3de7)?_0x39abd5[0x0][_0xeadc('0x13')]%_0xcd3de7:0x0;_0x33191a[_0xeadc('0x18')](function(_0x13eeab){if(_0x13eeab>0x0){_0x5367fe+=_0xcd3de7;}_0xb65a94['push'](dbH[_0xeadc('0xe')]['query'](util[_0xeadc('0x9')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xcd3de7,_0x5367fe),{'type':dbH[_0xeadc('0xe')][_0xeadc('0x11')][_0xeadc('0x19')]}));});if(_0x3020c1>0x0){_0x5367fe+=_0xcd3de7;_0xb65a94[_0xeadc('0x1a')](dbH[_0xeadc('0xe')][_0xeadc('0xf')](util[_0xeadc('0x9')](_0xeadc('0x1b'),QUERY,_0x3020c1,_0x5367fe),{'type':dbH[_0xeadc('0xe')][_0xeadc('0x11')][_0xeadc('0x19')]}));}}}else{_0xb65a94[_0xeadc('0x1a')](dbH[_0xeadc('0xe')][_0xeadc('0xf')](QUERY,{'type':dbH[_0xeadc('0xe')]['QueryTypes'][_0xeadc('0x19')]}));}var _0x284149=path[_0xeadc('0x1c')](PATH);var _0x108acf=path[_0xeadc('0x1d')](PATH,_0xeadc('0x1e'));var _0x22190e=_0x4faccb[_0xeadc('0x15')]&&_0xb65a94['length']>0x1;var _0x5b140d=[];if(!fs[_0xeadc('0x1f')](path[_0xeadc('0x20')](_0x284149,_0x108acf))&&_0x22190e){fs[_0xeadc('0x21')](path[_0xeadc('0x20')](_0x284149,_0x108acf));}return BPromise['each'](_0xb65a94,function(_0x4f0c76){_0x5b140d['push'](_0x4f0c76);})[_0xeadc('0x12')](function(){for(var _0x4208ae=0x0;_0x4208ae<_0x5b140d[_0xeadc('0x22')];_0x4208ae+=0x1){var _0x4233bc;var _0x54bb88=_0x5b140d[_0x4208ae];if(_0x22190e){_0x4233bc=path[_0xeadc('0x20')](_0x284149,_0x108acf,util[_0xeadc('0x9')](_0xeadc('0x23'),_0x108acf,_0x4208ae,_0xeadc('0x24')));}else{_0x4233bc=path[_0xeadc('0x20')](_0x284149,util[_0xeadc('0x9')](_0xeadc('0x25'),_0x108acf,_0xeadc('0x24')));}fs[_0xeadc('0x26')](_0x4233bc,json2xls(_0x54bb88),_0xeadc('0x27'));}})[_0xeadc('0x12')](function(){if(_0x22190e){return new Promise(function(_0x2b6e6d){zipdir(path[_0xeadc('0x20')](_0x284149,_0x108acf),{'saveTo':path[_0xeadc('0x20')](_0x284149,util['format'](_0xeadc('0x25'),_0x108acf,_0xeadc('0x28')))},function(_0x374ff0,_0x35e4ec){rimraf(path[_0xeadc('0x20')](_0x284149,_0x108acf),function(){});_0x2b6e6d('zip\x20finished');});});}})[_0xeadc('0x12')](function(){logger[_0xeadc('0x29')](util[_0xeadc('0x9')](_0xeadc('0x2a'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xeadc('0x2b'),_0x22190e?util[_0xeadc('0x9')]('%s.%s',_0x108acf,_0x22190e?_0xeadc('0x28'):'xlsx'):null);});})['catch'](function(_0x1893c4){logger[_0xeadc('0x29')](util[_0xeadc('0x9')](_0xeadc('0x2c'),EXTRACTED_REPORT_ID,_0xeadc('0xa')),util[_0xeadc('0x2d')](_0x1893c4,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xeadc('0x2e')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x52ed=['find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting'];(function(_0x245d6c,_0x473291){var _0x549464=function(_0x30f003){while(--_0x30f003){_0x245d6c['push'](_0x245d6c['shift']());}};_0x549464(++_0x473291);}(_0x52ed,0x132));var _0xd52e=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0x52ed[_0x879e31];return _0x3467e8;};'use strict';var util=require(_0xd52e('0x0'));var path=require(_0xd52e('0x1'));var _=require(_0xd52e('0x2'));var fs=require('fs');var json2xls=require(_0xd52e('0x3'));var BPromise=require(_0xd52e('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xd52e('0x5'));var db=require(_0xd52e('0x6'))['db'];var dbH=require(_0xd52e('0x6'))[_0xd52e('0x7')];var logger=require(_0xd52e('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd52e('0x9')][0x2]);var QUERY=process[_0xd52e('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5207fd,_0x321f8d){var _0x5ae178={'status':_0x5207fd};var _0x4d124c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x321f8d){_0x5ae178[_0xd52e('0xa')]=_0x321f8d;}return db[_0xd52e('0xb')][_0xd52e('0xc')](_0x5ae178,_0x4d124c);}function main(){var _0x1d00a9=0x1388;var _0x3d857a;logger[_0xd52e('0xd')](util[_0xd52e('0xe')](_0xd52e('0xf'),EXTRACTED_REPORT_ID,_0xd52e('0x10')));return db[_0xd52e('0x11')][_0xd52e('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd52e('0x13'),_0xd52e('0x14')]})[_0xd52e('0x15')](function(_0x43a5ba){if(_0x43a5ba){_0x3d857a=_0x43a5ba;_0x1d00a9=_0x3d857a['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0xd52e('0x16')][_0xd52e('0x17')](util[_0xd52e('0xe')](_0xd52e('0x18'),QUERY),{'type':dbH[_0xd52e('0x16')]['QueryTypes']['SELECT']});})[_0xd52e('0x15')](function(_0x466516){if(!_0x466516[0x0][_0xd52e('0x19')]){return analyticExtractedReport(_0xd52e('0x1a'));}var _0x33230a=[];var _0x58dab2=0x0;if(_0x3d857a[_0xd52e('0x13')]){if(_0x466516&&_0x466516[_0xd52e('0x1b')]){var _0x7eeb4f=_[_0xd52e('0x1c')](_0x466516[0x0][_0xd52e('0x19')]/_0x1d00a9);var _0xdab253=Number[_0xd52e('0x1d')](_0x466516[0x0]['num']/_0x1d00a9)?_0x466516[0x0]['num']%_0x1d00a9:0x0;_0x7eeb4f['forEach'](function(_0x163b1b){if(_0x163b1b>0x0){_0x58dab2+=_0x1d00a9;}_0x33230a[_0xd52e('0x1e')](dbH['sequelize'][_0xd52e('0x17')](util[_0xd52e('0xe')](_0xd52e('0x1f'),QUERY,_0x1d00a9,_0x58dab2),{'type':dbH[_0xd52e('0x16')][_0xd52e('0x20')][_0xd52e('0x21')]}));});if(_0xdab253>0x0){_0x58dab2+=_0x1d00a9;_0x33230a[_0xd52e('0x1e')](dbH[_0xd52e('0x16')][_0xd52e('0x17')](util[_0xd52e('0xe')](_0xd52e('0x1f'),QUERY,_0xdab253,_0x58dab2),{'type':dbH[_0xd52e('0x16')][_0xd52e('0x20')][_0xd52e('0x21')]}));}}}else{_0x33230a[_0xd52e('0x1e')](dbH[_0xd52e('0x16')][_0xd52e('0x17')](QUERY,{'type':dbH[_0xd52e('0x16')][_0xd52e('0x20')]['SELECT']}));}var _0x3c3599=path[_0xd52e('0x22')](PATH);var _0x3a4142=path[_0xd52e('0x23')](PATH,'.xlsx');var _0x140fa0=_0x3d857a[_0xd52e('0x13')]&&_0x33230a['length']>0x1;var _0x5dd8b0=[];if(!fs[_0xd52e('0x24')](path[_0xd52e('0x25')](_0x3c3599,_0x3a4142))&&_0x140fa0){fs[_0xd52e('0x26')](path['join'](_0x3c3599,_0x3a4142));}return BPromise[_0xd52e('0x27')](_0x33230a,function(_0x4b27bc){_0x5dd8b0[_0xd52e('0x1e')](_0x4b27bc);})[_0xd52e('0x15')](function(){for(var _0x505614=0x0;_0x505614<_0x5dd8b0[_0xd52e('0x1b')];_0x505614+=0x1){var _0x2329e4;var _0x5a8ab0=_0x5dd8b0[_0x505614];if(_0x140fa0){_0x2329e4=path['join'](_0x3c3599,_0x3a4142,util[_0xd52e('0xe')](_0xd52e('0x28'),_0x3a4142,_0x505614,'xlsx'));}else{_0x2329e4=path[_0xd52e('0x25')](_0x3c3599,util[_0xd52e('0xe')](_0xd52e('0x29'),_0x3a4142,_0xd52e('0x2a')));}fs[_0xd52e('0x2b')](_0x2329e4,json2xls(_0x5a8ab0),_0xd52e('0x2c'));}})[_0xd52e('0x15')](function(){if(_0x140fa0){return new Promise(function(_0x3b0f46){zipdir(path[_0xd52e('0x25')](_0x3c3599,_0x3a4142),{'saveTo':path[_0xd52e('0x25')](_0x3c3599,util[_0xd52e('0xe')](_0xd52e('0x29'),_0x3a4142,_0xd52e('0x2d')))},function(_0xaf7210,_0x515dc7){rimraf(path[_0xd52e('0x25')](_0x3c3599,_0x3a4142),function(){});_0x3b0f46(_0xd52e('0x2e'));});});}})['then'](function(){logger[_0xd52e('0xd')](util[_0xd52e('0xe')](_0xd52e('0x2f'),EXTRACTED_REPORT_ID,_0xd52e('0x10')));return analyticExtractedReport(_0xd52e('0x30'),_0x140fa0?util[_0xd52e('0xe')](_0xd52e('0x29'),_0x3a4142,_0x140fa0?_0xd52e('0x2d'):_0xd52e('0x2a')):null);});})[_0xd52e('0x31')](function(_0x2181ba){logger[_0xd52e('0xd')](util[_0xd52e('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0xd52e('0x32')](_0x2181ba,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd52e('0x33'));})[_0xd52e('0x34')](function(){process[_0xd52e('0x35')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index d8faf6b..af1ea83 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 _0xe29f=[',${EXTEN},','last','concat','transaction','bulkCreate','error','lodash','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','uniq','exten','filter','groupBy','queue','priority','find','extensions','push','type','Set','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','app','appType','custom','XCALLY-MOTION-PROGRESS=1','GotoIfTime'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xe29f,0x174));var _0xfe29=function(_0x5a2b18,_0x524d6f){_0x5a2b18=_0x5a2b18-0x0;var _0x33e4a0=_0xe29f[_0x5a2b18];return _0x33e4a0;};'use strict';var _=require(_0xfe29('0x0'));var util=require('util');function rewrite(_0x3d9311,_0x2b0927){var _0x3548e2=this;return _0x3d9311[_0xfe29('0x1')][_0xfe29('0x2')][_0xfe29('0x3')]({'raw':!![]})[_0xfe29('0x4')](function(_0xb14880){_0x3548e2[_0xfe29('0x5')]=_0xb14880;return _0x3d9311[_0xfe29('0x1')]['VoiceExtension'][_0xfe29('0x3')]({'where':{'IntervalId':_0x2b0927[_0xfe29('0x6')]},'raw':!![]});})[_0xfe29('0x4')](function(_0x7afc53){return _0x3d9311[_0xfe29('0x1')][_0xfe29('0x7')][_0xfe29('0x3')]({'where':{'exten':{'$in':_[_0xfe29('0x8')](_['map'](_0x7afc53,_0xfe29('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xfe29('0x4')](function(_0x421144){var _0x4e9a5c=_[_0xfe29('0xa')](_0x421144,{'priority':'1'});var _0x113b14=_[_0xfe29('0xa')](_0x421144,{'isApp':0x1});var _0x38e2cc=_[_0xfe29('0xb')](_0x113b14,_0xfe29('0x9'));var _0xe08b57=[_0xfe29('0xc'),'playback'];var _0x268a28=[];var _0x2e7640=[];for(var _0xa95569 in _0x38e2cc){if(_0x38e2cc['hasOwnProperty'](_0xa95569)){_0x3548e2[_0xfe29('0xd')]=0x2;_0x3548e2['extensions']=[];_0x3548e2['extension']=_[_0xfe29('0xe')](_0x4e9a5c,{'exten':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x9')]});_0x3548e2[_0xfe29('0xf')][_0xfe29('0x10')]({'type':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x11')],'app':_0xfe29('0x12'),'appdata':util['format'](_0xfe29('0x13'),_0x38e2cc[_0xa95569][0x0][_0xfe29('0x11')]),'context':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x14')],'exten':_0x38e2cc[_0xa95569][0x0]['exten'],'priority':_0x3548e2['priority']++,'VoiceExtensionId':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x15')]});if(_0x38e2cc[_0xa95569][0x0][_0xfe29('0x11')]===_0xfe29('0x16')){_0x3548e2[_0xfe29('0xf')][_0xfe29('0x10')]({'type':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x11')],'app':_0xfe29('0x12'),'appdata':_0xfe29('0x17')+_0x38e2cc[_0xa95569][0x0][_0xfe29('0x15')],'context':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x14')],'exten':_0x38e2cc[_0xa95569][0x0]['exten'],'priority':_0x3548e2['priority']++,'VoiceExtensionId':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x15')]});}else if(_0x38e2cc[_0xa95569][0x0][_0xfe29('0x11')]===_0xfe29('0x18')){if(_0x3548e2[_0xfe29('0x19')]){_0x3548e2[_0xfe29('0xf')]['push']({'type':_0x38e2cc[_0xa95569][0x0]['type'],'app':_0xfe29('0x12'),'appdata':_0xfe29('0x1a')+(_0x3548e2[_0xfe29('0x19')][_0xfe29('0x1b')]?_0xfe29('0x1c')+_0x3548e2[_0xfe29('0x19')][_0xfe29('0x1b')]+'}':_0xfe29('0x1d')),'context':_0x38e2cc[_0xa95569][0x0]['context'],'exten':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x9')],'priority':_0x3548e2[_0xfe29('0xd')]++,'VoiceExtensionId':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x15')]});}_0x3548e2[_0xfe29('0xf')][_0xfe29('0x10')]({'type':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x11')],'app':_0xfe29('0x12'),'appdata':_0xfe29('0x17')+_0x38e2cc[_0xa95569][0x0][_0xfe29('0x15')],'context':_0x38e2cc[_0xa95569][0x0]['context'],'exten':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x9')],'priority':_0x3548e2[_0xfe29('0xd')]++,'VoiceExtensionId':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x15')]});var _0x3338eb=_0x3548e2[_0xfe29('0xd')]++;_0x3548e2['extensions'][_0xfe29('0x10')]({'type':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x11')],'app':_0xfe29('0x1e'),'appdata':_0xfe29('0x1f')+(_0x3338eb+0x2)+_0xfe29('0x20')+(_0x3338eb+0x1)+')','context':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x14')],'exten':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x9')],'priority':_0x3338eb,'VoiceExtensionId':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x15')]});if(_0x3548e2['extension']){_0x3548e2[_0xfe29('0xf')]['push']({'type':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x11')],'app':'Set','appdata':_0x3548e2['extension'][_0xfe29('0x1b')]?_0xfe29('0x21')+_0x3548e2[_0xfe29('0x19')]['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x14')],'exten':_0x38e2cc[_0xa95569][0x0]['exten'],'priority':_0x3548e2[_0xfe29('0xd')]++,'VoiceExtensionId':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x15')]});}_0x3548e2[_0xfe29('0xf')][_0xfe29('0x10')]({'type':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x11')],'app':_0xfe29('0x12'),'appdata':'outboundrouteid='+_0x38e2cc[_0xa95569][0x0]['VoiceExtensionId'],'context':_0x38e2cc[_0xa95569][0x0]['context'],'exten':_0x38e2cc[_0xa95569][0x0]['exten'],'priority':_0x3548e2[_0xfe29('0xd')]++,'VoiceExtensionId':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x15')]});if(_0x3548e2[_0xfe29('0x19')]&&_0x3548e2[_0xfe29('0x19')][_0xfe29('0x22')](_0xfe29('0x23'))&&_0x3548e2[_0xfe29('0x19')][_0xfe29('0x23')]!==_0xfe29('0x24')){_0x3548e2[_0xfe29('0xf')][_0xfe29('0x10')]({'type':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x11')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x14')],'exten':_0x38e2cc[_0xa95569][0x0]['exten'],'priority':_0x3548e2[_0xfe29('0xd')]++,'VoiceExtensionId':_0x38e2cc[_0xa95569][0x0]['VoiceExtensionId']});_0x3548e2['extensions'][_0xfe29('0x10')]({'type':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x11')],'app':_0xfe29('0x12'),'appdata':_0xfe29('0x25')+_0x3548e2[_0xfe29('0x19')]['recordingFormat']||_0xfe29('0x26'),'context':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x14')],'exten':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x9')],'priority':_0x3548e2['priority']++,'VoiceExtensionId':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x15')]});}}_0x3548e2['extensions'][_0xfe29('0x10')]({'type':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x11')],'app':_0xfe29('0x12'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x14')],'exten':_0x38e2cc[_0xa95569][0x0]['exten'],'priority':_0x3548e2['priority']++,'VoiceExtensionId':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x15')]});_0x3548e2['extensions'][_0xfe29('0x10')]({'type':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x11')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x14')],'exten':_0x38e2cc[_0xa95569][0x0]['exten'],'priority':_0x3548e2[_0xfe29('0xd')]++,'VoiceExtensionId':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x15')]});_0x3548e2[_0xfe29('0xf')][_0xfe29('0x10')]({'type':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x11')],'app':_0xfe29('0x12'),'appdata':_0xfe29('0x27'),'context':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x14')],'exten':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x9')],'priority':_0x3548e2['priority']++,'VoiceExtensionId':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x15')]});for(var _0x3c486c=0x0,_0x4a6251=0x0;_0x3c486c<_0x38e2cc[_0xa95569][_0xfe29('0x28')];_0x3c486c+=0x1,_0x4a6251=0x0){var _0x3b1d59=_0x38e2cc[_0xa95569][_0x3c486c];if(_0x3b1d59[_0xfe29('0x11')]){_0x3b1d59[_0xfe29('0x11')]=_0x3b1d59[_0xfe29('0x11')][_0xfe29('0x29')]();}var _0x46f210=[];var _0x476534=[];delete _0x3b1d59['id'];delete _0x3b1d59['createdAt'];delete _0x3b1d59[_0xfe29('0x2a')];var _0x1a024f=_0x3b1d59[_0xfe29('0x2b')]!==_0xfe29('0x2c')?[_0x3b1d59[_0xfe29('0x2b')]]:_0x3b1d59['IntervalId']?_['map'](_['filter'](_0x3548e2[_0xfe29('0x5')],{'IntervalId':_0x3b1d59[_0xfe29('0x6')]}),_0xfe29('0x2b')):[];if(_0x3b1d59[_0xfe29('0x22')]('tag')){if(_0x3b1d59[_0xfe29('0x2d')]&&_0x3b1d59[_0xfe29('0x2d')]!=='--'){_0x46f210[_0xfe29('0x10')]({'type':_0x3b1d59[_0xfe29('0x11')],'app':_0xfe29('0x12'),'appdata':_0xfe29('0x2e')+_0x3b1d59[_0xfe29('0x2d')],'context':_0x3b1d59[_0xfe29('0x14')],'exten':_0x3b1d59['exten'],'priority':_0x1a024f[_0xfe29('0x28')]+_0x3548e2[_0xfe29('0xd')]+_0x4a6251++,'VoiceExtensionId':_0x3b1d59[_0xfe29('0x15')]});}}if(_0x3b1d59[_0xfe29('0x11')]===_0xfe29('0x18')&&_0x3b1d59[_0xfe29('0x22')](_0xfe29('0x2f'))){if(_0x3b1d59[_0xfe29('0x2f')]){_0x46f210[_0xfe29('0x10')]({'type':_0x3b1d59[_0xfe29('0x11')],'app':_0xfe29('0x1e'),'appdata':_0xfe29('0x30')+_0x3b1d59[_0xfe29('0x2f')]+')','context':_0x3b1d59[_0xfe29('0x14')],'exten':_0x3b1d59[_0xfe29('0x9')],'priority':_0x1a024f[_0xfe29('0x28')]+_0x3548e2[_0xfe29('0xd')]+_0x4a6251++,'VoiceExtensionId':_0x3b1d59['VoiceExtensionId']});}else{_0x46f210['push']({'type':_0x3b1d59[_0xfe29('0x11')],'app':_0xfe29('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x3b1d59[_0xfe29('0x14')],'exten':_0x3b1d59[_0xfe29('0x9')],'priority':_0x1a024f[_0xfe29('0x28')]+_0x3548e2[_0xfe29('0xd')]+_0x4a6251++,'VoiceExtensionId':_0x3b1d59[_0xfe29('0x15')]});}}if(_0x3b1d59['hasOwnProperty'](_0xfe29('0x31'))){if(_0xe08b57['indexOf'](_0x3b1d59[_0xfe29('0x32')][_0xfe29('0x29')]())>=0x0&&_0x3b1d59[_0xfe29('0x33')]!==_0xfe29('0x34')){if(_0x3b1d59['answer']){_0x46f210[_0xfe29('0x10')]({'type':_0x3b1d59[_0xfe29('0x11')],'app':_0xfe29('0x1e'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x3b1d59[_0xfe29('0x14')],'exten':_0x3b1d59[_0xfe29('0x9')],'priority':_0x1a024f[_0xfe29('0x28')]+_0x3548e2[_0xfe29('0xd')]+_0x4a6251++,'VoiceExtensionId':_0x3b1d59[_0xfe29('0x15')]});_0x46f210[_0xfe29('0x10')]({'type':_0x3b1d59[_0xfe29('0x11')],'app':_0xfe29('0x12'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3b1d59['context'],'exten':_0x3b1d59[_0xfe29('0x9')],'priority':_0x1a024f['length']+_0x3548e2[_0xfe29('0xd')]+_0x4a6251++,'VoiceExtensionId':_0x3b1d59['VoiceExtensionId']});}else{_0x46f210['push']({'type':_0x3b1d59[_0xfe29('0x11')],'app':_0xfe29('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x3b1d59[_0xfe29('0x14')],'exten':_0x3b1d59['exten'],'priority':_0x1a024f[_0xfe29('0x28')]+_0x3548e2[_0xfe29('0xd')]+_0x4a6251++,'VoiceExtensionId':_0x3b1d59[_0xfe29('0x15')]});_0x46f210[_0xfe29('0x10')]({'type':_0x3b1d59[_0xfe29('0x11')],'app':_0xfe29('0x12'),'appdata':_0xfe29('0x35'),'context':_0x3b1d59[_0xfe29('0x14')],'exten':_0x3b1d59['exten'],'priority':_0x1a024f['length']+_0x3548e2['priority']+_0x4a6251++,'VoiceExtensionId':_0x3b1d59[_0xfe29('0x15')]});}}}for(var _0x546c23=0x0;_0x546c23<_0x1a024f[_0xfe29('0x28')];_0x546c23+=0x1){var _0x43a9d2=_0x3548e2['priority']+_0x1a024f[_0xfe29('0x28')];var _0x26c876=_0x546c23===_0x1a024f[_0xfe29('0x28')]-0x1?_0x3548e2['priority']+_0x46f210[_0xfe29('0x28')]+_0x476534['length']+0x2:_0x3548e2[_0xfe29('0xd')]+_0x546c23+0x1;_0x46f210['splice'](_0x546c23,0x0,{'type':_0x3b1d59[_0xfe29('0x11')],'app':_0xfe29('0x36'),'appdata':_0x1a024f[_0x546c23]+'?'+_0x3b1d59[_0xfe29('0x14')]+_0xfe29('0x37')+_0x43a9d2+':'+_0x3b1d59[_0xfe29('0x14')]+_0xfe29('0x37')+_0x26c876,'exten':_0x3b1d59[_0xfe29('0x9')],'context':_0x3b1d59[_0xfe29('0x14')],'priority':_0x3548e2['priority']+_0x546c23,'VoiceExtensionId':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x15')]});}_0x3b1d59[_0xfe29('0xd')]=_0x46f210[_0xfe29('0x28')]?_[_0xfe29('0x38')](_0x46f210)[_0xfe29('0xd')]+0x1:_0x3548e2[_0xfe29('0xd')];_0x3548e2[_0xfe29('0xd')]=(_0x476534[_0xfe29('0x28')]?_[_0xfe29('0x38')](_0x476534)['priority']:_0x3b1d59['priority'])+0x1;_0x3548e2['extensions']=_[_0xfe29('0x39')](_0x3548e2[_0xfe29('0xf')],_0x46f210,[_0x3b1d59],_0x476534);}_0x3548e2[_0xfe29('0xf')][_0xfe29('0x10')]({'type':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x11')],'app':'Hangup','exten':_0x38e2cc[_0xa95569][0x0]['exten'],'context':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x14')],'priority':_0x3548e2['priority'],'VoiceExtensionId':_0x38e2cc[_0xa95569][0x0][_0xfe29('0x15')]});_0x268a28[_0xfe29('0x10')](_0x38e2cc[_0xa95569][0x0][_0xfe29('0x15')]);_0x2e7640=_[_0xfe29('0x39')](_0x2e7640,_0x3548e2[_0xfe29('0xf')]);}}return _0x3d9311[_0xfe29('0x3a')](function(_0x59329d){return _0x3d9311[_0xfe29('0x1')][_0xfe29('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x268a28}},'transaction':_0x59329d})[_0xfe29('0x4')](function(_0x2bc1ea){return _0x3d9311[_0xfe29('0x1')]['VoiceExtension'][_0xfe29('0x3b')](_['sortBy'](_0x2e7640,_0xfe29('0xd')),{'transaction':_0x59329d});});});})['catch'](function(_0x2ca162){console[_0xfe29('0x3c')](_0x2ca162);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xf141=['tag','CDR(tag)=','length','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','filter','groupBy','exten','queue','playback','priority','extensions','find','type','context','VoiceExtensionId','inbound','Set','CDR(routeid)=','outbound','extension','push','cutdigits','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','*,*,*,*','interval','hasOwnProperty'];(function(_0x3aefa3,_0x33086a){var _0x4990c1=function(_0x53f2b3){while(--_0x53f2b3){_0x3aefa3['push'](_0x3aefa3['shift']());}};_0x4990c1(++_0x33086a);}(_0xf141,0x9d));var _0x1f14=function(_0x506b77,_0x1a3716){_0x506b77=_0x506b77-0x0;var _0x143a01=_0xf141[_0x506b77];return _0x143a01;};'use strict';var _=require('lodash');var util=require(_0x1f14('0x0'));function rewrite(_0x19559b,_0x186269){var _0x3f2392=this;return _0x19559b[_0x1f14('0x1')][_0x1f14('0x2')][_0x1f14('0x3')]({'raw':!![]})[_0x1f14('0x4')](function(_0x1bece3){_0x3f2392[_0x1f14('0x5')]=_0x1bece3;return _0x19559b[_0x1f14('0x1')][_0x1f14('0x6')][_0x1f14('0x3')]({'where':{'IntervalId':_0x186269[_0x1f14('0x7')]},'raw':!![]});})[_0x1f14('0x4')](function(_0x461622){return _0x19559b[_0x1f14('0x1')]['VoiceExtension'][_0x1f14('0x3')]({'where':{'exten':{'$in':_[_0x1f14('0x8')](_[_0x1f14('0x9')](_0x461622,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x21e3ac){var _0x1dfbae=_[_0x1f14('0xa')](_0x21e3ac,{'priority':'1'});var _0x302e1b=_[_0x1f14('0xa')](_0x21e3ac,{'isApp':0x1});var _0x3a5291=_[_0x1f14('0xb')](_0x302e1b,_0x1f14('0xc'));var _0x25f41e=[_0x1f14('0xd'),_0x1f14('0xe')];var _0x1e0c77=[];var _0x123f5e=[];for(var _0x5da0c0 in _0x3a5291){if(_0x3a5291['hasOwnProperty'](_0x5da0c0)){_0x3f2392[_0x1f14('0xf')]=0x2;_0x3f2392[_0x1f14('0x10')]=[];_0x3f2392['extension']=_[_0x1f14('0x11')](_0x1dfbae,{'exten':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0xc')]});_0x3f2392['extensions']['push']({'type':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x12')],'app':'Set','appdata':util['format']('CDR(type)=%s',_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x12')]),'context':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x13')],'exten':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0xc')],'priority':_0x3f2392['priority']++,'VoiceExtensionId':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x14')]});if(_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x12')]===_0x1f14('0x15')){_0x3f2392['extensions']['push']({'type':_0x3a5291[_0x5da0c0][0x0]['type'],'app':_0x1f14('0x16'),'appdata':_0x1f14('0x17')+_0x3a5291[_0x5da0c0][0x0]['VoiceExtensionId'],'context':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x13')],'exten':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0xc')],'priority':_0x3f2392[_0x1f14('0xf')]++,'VoiceExtensionId':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x14')]});}else if(_0x3a5291[_0x5da0c0][0x0]['type']===_0x1f14('0x18')){if(_0x3f2392[_0x1f14('0x19')]){_0x3f2392[_0x1f14('0x10')][_0x1f14('0x1a')]({'type':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x12')],'app':'Set','appdata':'CDR(destination)='+(_0x3f2392[_0x1f14('0x19')][_0x1f14('0x1b')]?'${EXTEN:'+_0x3f2392['extension'][_0x1f14('0x1b')]+'}':_0x1f14('0x1c')),'context':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x13')],'exten':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0xc')],'priority':_0x3f2392['priority']++,'VoiceExtensionId':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x14')]});}_0x3f2392['extensions'][_0x1f14('0x1a')]({'type':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x12')],'app':'Set','appdata':'CDR(routeid)='+_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x14')],'context':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x13')],'exten':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0xc')],'priority':_0x3f2392[_0x1f14('0xf')]++,'VoiceExtensionId':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x14')]});var _0x2fdf43=_0x3f2392[_0x1f14('0xf')]++;_0x3f2392['extensions'][_0x1f14('0x1a')]({'type':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x12')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2fdf43+0x2)+_0x1f14('0x1d')+(_0x2fdf43+0x1)+')','context':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x13')],'exten':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0xc')],'priority':_0x2fdf43,'VoiceExtensionId':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x14')]});if(_0x3f2392['extension']){_0x3f2392[_0x1f14('0x10')][_0x1f14('0x1a')]({'type':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x12')],'app':_0x1f14('0x16'),'appdata':_0x3f2392['extension'][_0x1f14('0x1b')]?_0x1f14('0x1e')+_0x3f2392[_0x1f14('0x19')][_0x1f14('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x13')],'exten':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0xc')],'priority':_0x3f2392['priority']++,'VoiceExtensionId':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x14')]});}_0x3f2392[_0x1f14('0x10')][_0x1f14('0x1a')]({'type':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x12')],'app':_0x1f14('0x16'),'appdata':'outboundrouteid='+_0x3a5291[_0x5da0c0][0x0]['VoiceExtensionId'],'context':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x13')],'exten':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0xc')],'priority':_0x3f2392[_0x1f14('0xf')]++,'VoiceExtensionId':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x14')]});if(_0x3f2392[_0x1f14('0x19')]&&_0x3f2392[_0x1f14('0x19')]['hasOwnProperty']('recordingFormat')&&_0x3f2392[_0x1f14('0x19')][_0x1f14('0x1f')]!=='none'){_0x3f2392[_0x1f14('0x10')][_0x1f14('0x1a')]({'type':_0x3a5291[_0x5da0c0][0x0]['type'],'app':_0x1f14('0x16'),'appdata':_0x1f14('0x20'),'context':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x13')],'exten':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0xc')],'priority':_0x3f2392[_0x1f14('0xf')]++,'VoiceExtensionId':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x14')]});_0x3f2392[_0x1f14('0x10')][_0x1f14('0x1a')]({'type':_0x3a5291[_0x5da0c0][0x0]['type'],'app':_0x1f14('0x16'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x3f2392[_0x1f14('0x19')]['recordingFormat']||_0x1f14('0x21'),'context':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x13')],'exten':_0x3a5291[_0x5da0c0][0x0]['exten'],'priority':_0x3f2392['priority']++,'VoiceExtensionId':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x14')]});}}_0x3f2392['extensions'][_0x1f14('0x1a')]({'type':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x12')],'app':_0x1f14('0x16'),'appdata':_0x1f14('0x22'),'context':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x13')],'exten':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0xc')],'priority':_0x3f2392['priority']++,'VoiceExtensionId':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x14')]});_0x3f2392[_0x1f14('0x10')][_0x1f14('0x1a')]({'type':_0x3a5291[_0x5da0c0][0x0]['type'],'app':_0x1f14('0x16'),'appdata':_0x1f14('0x23'),'context':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x13')],'exten':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0xc')],'priority':_0x3f2392[_0x1f14('0xf')]++,'VoiceExtensionId':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x14')]});_0x3f2392['extensions']['push']({'type':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x12')],'app':_0x1f14('0x16'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x13')],'exten':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0xc')],'priority':_0x3f2392[_0x1f14('0xf')]++,'VoiceExtensionId':_0x3a5291[_0x5da0c0][0x0]['VoiceExtensionId']});for(var _0x4e48ce=0x0,_0x5bb14b=0x0;_0x4e48ce<_0x3a5291[_0x5da0c0]['length'];_0x4e48ce+=0x1,_0x5bb14b=0x0){var _0x45db55=_0x3a5291[_0x5da0c0][_0x4e48ce];if(_0x45db55[_0x1f14('0x12')]){_0x45db55[_0x1f14('0x12')]=_0x45db55[_0x1f14('0x12')][_0x1f14('0x24')]();}var _0x2ad5ab=[];var _0x808653=[];delete _0x45db55['id'];delete _0x45db55[_0x1f14('0x25')];delete _0x45db55['updatedAt'];var _0x321e6a=_0x45db55['interval']!==_0x1f14('0x26')?[_0x45db55['interval']]:_0x45db55['IntervalId']?_[_0x1f14('0x9')](_['filter'](_0x3f2392[_0x1f14('0x5')],{'IntervalId':_0x45db55[_0x1f14('0x7')]}),_0x1f14('0x27')):[];if(_0x45db55[_0x1f14('0x28')](_0x1f14('0x29'))){if(_0x45db55[_0x1f14('0x29')]&&_0x45db55[_0x1f14('0x29')]!=='--'){_0x2ad5ab[_0x1f14('0x1a')]({'type':_0x45db55[_0x1f14('0x12')],'app':_0x1f14('0x16'),'appdata':_0x1f14('0x2a')+_0x45db55[_0x1f14('0x29')],'context':_0x45db55['context'],'exten':_0x45db55[_0x1f14('0xc')],'priority':_0x321e6a[_0x1f14('0x2b')]+_0x3f2392['priority']+_0x5bb14b++,'VoiceExtensionId':_0x45db55[_0x1f14('0x14')]});}}if(_0x45db55['type']===_0x1f14('0x18')&&_0x45db55[_0x1f14('0x28')]('callerID')){if(_0x45db55[_0x1f14('0x2c')]){_0x2ad5ab[_0x1f14('0x1a')]({'type':_0x45db55[_0x1f14('0x12')],'app':_0x1f14('0x2d'),'appdata':_0x1f14('0x2e')+_0x45db55['callerID']+')','context':_0x45db55['context'],'exten':_0x45db55[_0x1f14('0xc')],'priority':_0x321e6a[_0x1f14('0x2b')]+_0x3f2392['priority']+_0x5bb14b++,'VoiceExtensionId':_0x45db55[_0x1f14('0x14')]});}else{_0x2ad5ab['push']({'type':_0x45db55[_0x1f14('0x12')],'app':_0x1f14('0x2d'),'appdata':_0x1f14('0x2f'),'context':_0x45db55[_0x1f14('0x13')],'exten':_0x45db55[_0x1f14('0xc')],'priority':_0x321e6a[_0x1f14('0x2b')]+_0x3f2392[_0x1f14('0xf')]+_0x5bb14b++,'VoiceExtensionId':_0x45db55[_0x1f14('0x14')]});}}if(_0x45db55['hasOwnProperty'](_0x1f14('0x30'))){if(_0x25f41e[_0x1f14('0x31')](_0x45db55[_0x1f14('0x32')]['toLowerCase']())>=0x0&&_0x45db55[_0x1f14('0x33')]!=='custom'){if(_0x45db55['answer']){_0x2ad5ab[_0x1f14('0x1a')]({'type':_0x45db55[_0x1f14('0x12')],'app':_0x1f14('0x2d'),'appdata':_0x1f14('0x34'),'context':_0x45db55[_0x1f14('0x13')],'exten':_0x45db55[_0x1f14('0xc')],'priority':_0x321e6a[_0x1f14('0x2b')]+_0x3f2392[_0x1f14('0xf')]+_0x5bb14b++,'VoiceExtensionId':_0x45db55['VoiceExtensionId']});_0x2ad5ab[_0x1f14('0x1a')]({'type':_0x45db55[_0x1f14('0x12')],'app':'Set','appdata':_0x1f14('0x35'),'context':_0x45db55[_0x1f14('0x13')],'exten':_0x45db55[_0x1f14('0xc')],'priority':_0x321e6a[_0x1f14('0x2b')]+_0x3f2392[_0x1f14('0xf')]+_0x5bb14b++,'VoiceExtensionId':_0x45db55[_0x1f14('0x14')]});}else{_0x2ad5ab[_0x1f14('0x1a')]({'type':_0x45db55['type'],'app':_0x1f14('0x2d'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x45db55['context'],'exten':_0x45db55['exten'],'priority':_0x321e6a[_0x1f14('0x2b')]+_0x3f2392['priority']+_0x5bb14b++,'VoiceExtensionId':_0x45db55[_0x1f14('0x14')]});_0x2ad5ab[_0x1f14('0x1a')]({'type':_0x45db55['type'],'app':_0x1f14('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x45db55[_0x1f14('0x13')],'exten':_0x45db55[_0x1f14('0xc')],'priority':_0x321e6a[_0x1f14('0x2b')]+_0x3f2392['priority']+_0x5bb14b++,'VoiceExtensionId':_0x45db55[_0x1f14('0x14')]});}}}for(var _0x29b8e4=0x0;_0x29b8e4<_0x321e6a[_0x1f14('0x2b')];_0x29b8e4+=0x1){var _0x955139=_0x3f2392[_0x1f14('0xf')]+_0x321e6a[_0x1f14('0x2b')];var _0x4a2eb9=_0x29b8e4===_0x321e6a[_0x1f14('0x2b')]-0x1?_0x3f2392[_0x1f14('0xf')]+_0x2ad5ab[_0x1f14('0x2b')]+_0x808653['length']+0x2:_0x3f2392[_0x1f14('0xf')]+_0x29b8e4+0x1;_0x2ad5ab[_0x1f14('0x36')](_0x29b8e4,0x0,{'type':_0x45db55[_0x1f14('0x12')],'app':_0x1f14('0x37'),'appdata':_0x321e6a[_0x29b8e4]+'?'+_0x45db55[_0x1f14('0x13')]+_0x1f14('0x38')+_0x955139+':'+_0x45db55[_0x1f14('0x13')]+_0x1f14('0x38')+_0x4a2eb9,'exten':_0x45db55[_0x1f14('0xc')],'context':_0x45db55[_0x1f14('0x13')],'priority':_0x3f2392[_0x1f14('0xf')]+_0x29b8e4,'VoiceExtensionId':_0x3a5291[_0x5da0c0][0x0]['VoiceExtensionId']});}_0x45db55[_0x1f14('0xf')]=_0x2ad5ab[_0x1f14('0x2b')]?_[_0x1f14('0x39')](_0x2ad5ab)[_0x1f14('0xf')]+0x1:_0x3f2392[_0x1f14('0xf')];_0x3f2392[_0x1f14('0xf')]=(_0x808653[_0x1f14('0x2b')]?_[_0x1f14('0x39')](_0x808653)[_0x1f14('0xf')]:_0x45db55[_0x1f14('0xf')])+0x1;_0x3f2392[_0x1f14('0x10')]=_[_0x1f14('0x3a')](_0x3f2392[_0x1f14('0x10')],_0x2ad5ab,[_0x45db55],_0x808653);}_0x3f2392[_0x1f14('0x10')][_0x1f14('0x1a')]({'type':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x12')],'app':_0x1f14('0x3b'),'exten':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0xc')],'context':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x13')],'priority':_0x3f2392[_0x1f14('0xf')],'VoiceExtensionId':_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x14')]});_0x1e0c77[_0x1f14('0x1a')](_0x3a5291[_0x5da0c0][0x0][_0x1f14('0x14')]);_0x123f5e=_[_0x1f14('0x3a')](_0x123f5e,_0x3f2392[_0x1f14('0x10')]);}}return _0x19559b['transaction'](function(_0x275102){return _0x19559b[_0x1f14('0x1')][_0x1f14('0x6')][_0x1f14('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x1e0c77}},'transaction':_0x275102})[_0x1f14('0x4')](function(_0x4b0d36){return _0x19559b[_0x1f14('0x1')][_0x1f14('0x6')][_0x1f14('0x3d')](_[_0x1f14('0x3e')](_0x123f5e,'priority'),{'transaction':_0x275102});});});})[_0x1f14('0x3f')](function(_0x154c98){console[_0x1f14('0x40')](_0x154c98);});}exports[_0x1f14('0x41')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 1462529..b3d3d51 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 _0x5bb7=['CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','index','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','map','errors','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','then','push','pick','stringify','cmContact','checkHopper','inspect','insert','into','fromQuery','scheduledAt','createdAt','updatedAt','select','NOW()','field','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL','calleridnum','\x20=\x20?','ContactId','str','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','query','catch','onlyIfOpen','VoiceQueueId','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5bb7,0x155));var _0x75bb=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x5bb7[_0x3c4737];return _0x2bb926;};'use strict';var BPromise=require(_0x75bb('0x0'));var util=require('util');var _=require(_0x75bb('0x1'));var fs=require('fs');var squel=require(_0x75bb('0x2'));var Papa=require(_0x75bb('0x3'));var Redis=require(_0x75bb('0x4'));var db=require(_0x75bb('0x5'))['db'];var config=require(_0x75bb('0x6'));var logger=require(_0x75bb('0x7'))('api');config[_0x75bb('0x8')]=_[_0x75bb('0x9')](config[_0x75bb('0x8')],{'host':_0x75bb('0xa'),'port':0x18eb});var socket=require(_0x75bb('0xb'))(new Redis(config[_0x75bb('0x8')]));require(_0x75bb('0xc'))[_0x75bb('0xd')](socket);try{if(!process[_0x75bb('0xe')][0x2]||process[_0x75bb('0xe')][0x2]===_0x75bb('0xf')||process[_0x75bb('0xe')][0x2]===_0x75bb('0x10')){throw new Error(_0x75bb('0x11'));}var FILEPATH=process[_0x75bb('0xe')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0x75bb('0xf')||process[_0x75bb('0xe')][0x3]==='null'||!process[_0x75bb('0xe')][0x4]||process[_0x75bb('0xe')][0x4]===_0x75bb('0xf')||process[_0x75bb('0xe')][0x4]==='null'){throw new Error(_0x75bb('0x12'));}var FIELDS=_[_0x75bb('0x13')](process[_0x75bb('0xe')][0x3]['split'](','),process[_0x75bb('0xe')][0x4][_0x75bb('0x14')](','));if(!process[_0x75bb('0xe')][0x5]||process[_0x75bb('0xe')][0x5]===_0x75bb('0xf')||process[_0x75bb('0xe')][0x5]===_0x75bb('0x10')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x75bb('0xe')][0x5];var COMPANYID=process[_0x75bb('0xe')][0x6]&&process[_0x75bb('0xe')][0x6]!==_0x75bb('0xf')&&process[_0x75bb('0xe')][0x6]!=='null'?process[_0x75bb('0xe')][0x6]:null;var DUPLICATES=process[_0x75bb('0xe')][0x7]&&process['argv'][0x7]!==_0x75bb('0xf')&&process[_0x75bb('0xe')][0x7]!==_0x75bb('0x10')?process[_0x75bb('0xe')][0x7]:null;if(!process['argv'][0x8]||process[_0x75bb('0xe')][0x8]==='undefined'||process[_0x75bb('0xe')][0x8]===_0x75bb('0x10')){throw new Error(_0x75bb('0x15'));}var SOCKET_TIMESTAMP=process[_0x75bb('0xe')][0x8];}catch(_0x1636b5){logger[_0x75bb('0x16')](_0x1636b5);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(_0x56fee9,_0x3e7231,_0x3ca7ce,_0x2fd970){var _0xc90822={'message':_0x3e7231};_0xc90822[_0x56fee9]=!![];if(_0x3ca7ce){_0xc90822['contact']=_0x3ca7ce;}if(_0x2fd970){_0xc90822[_0x75bb('0x17')]=_0x2fd970;}return _0xc90822;}function isEmail(_0x34bb4c){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'](_0x34bb4c);}function checkRow(_0x2dc7cb,_0x5c3bb7,_0x140598){return new BPromise(function(_0xbeda20,_0x59a191){if(_['isNil'](_0x2dc7cb)){return _0x59a191(handleCheckRowError(_0x75bb('0x16'),_0x75bb('0x18'),null,_0x140598));}if(_0x2dc7cb['errors']&&_0x2dc7cb['errors'][_0x75bb('0x19')]){var _0x327e92=_[_0x75bb('0x1a')](_0x2dc7cb[_0x75bb('0x1b')],_0x75bb('0x1c'))[_0x75bb('0x1d')](';');return _0x59a191(handleCheckRowError(_0x75bb('0x16'),_0x327e92,null,_0x140598));}var _0x20e68c={};for(var _0x1d01e5 in FIELDS){if(FIELDS[_0x75bb('0x1e')](_0x1d01e5)&&FIELDS[_0x1d01e5]){_0x20e68c[_0x1d01e5]=_0x2dc7cb[_0x75bb('0x1f')][0x0][FIELDS[_0x1d01e5]]||_0x2dc7cb['data'][0x0]['\ufeff'+FIELDS[_0x1d01e5]];}}if(!_0x20e68c[_0x75bb('0x20')]){return _0x59a191(handleCheckRowError(_0x75bb('0x16'),_0x75bb('0x21'),null,_0x140598));}if(!_0x20e68c[_0x75bb('0x22')]){return _0x59a191(handleCheckRowError(_0x75bb('0x16'),'phone\x20not\x20specified!',null,_0x140598));}if(_0x20e68c['birthDate']){var _0x40cffe=moment(_0x20e68c[_0x75bb('0x23')],_0x75bb('0x24'));if(!_0x40cffe[_0x75bb('0x25')]()){return _0x59a191(handleCheckRowError('error',_0x75bb('0x26'),null,_0x140598));}}if(_0x20e68c['email']){if(!isEmail(_0x20e68c[_0x75bb('0x27')])){return _0x59a191(handleCheckRowError('error',_0x75bb('0x28'),null,_0x140598));}}_0x20e68c[_0x75bb('0x29')]=LISTID;_0x20e68c[_0x75bb('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x75bb('0x19')]&&_0x5c3bb7){var _0x2f40a6={};for(var _0x1730cc=0x0,_0x5cf21c=DUPLICATES[_0x75bb('0x19')];_0x1730cc<_0x5cf21c;_0x1730cc+=0x1){_0x2f40a6[DUPLICATES[_0x1730cc]]=_0x20e68c[DUPLICATES[_0x1730cc]];}var _0x1de0c8=_[_0x75bb('0x2b')](_0x5c3bb7,_0x2f40a6);if(_0x1de0c8){return _0x59a191(handleCheckRowError(_0x75bb('0x2c'),'Duplicate\x20Contact',_0x1de0c8,_0x140598));}}return db['CmContact']['create'](_0x20e68c,{'raw':!![],'hooks':![],'fields':_['keys'](_0x20e68c)})[_0x75bb('0x2d')](function(_0xac329d){if(DUPLICATES&&DUPLICATES[_0x75bb('0x19')]&&_0x5c3bb7){_0x5c3bb7[_0x75bb('0x2e')](_[_0x75bb('0x2f')](_0x20e68c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xac329d['id'];return _0xbeda20();})['catch'](function(_0x34d668){return _0x59a191(handleCheckRowError(_0x75bb('0x16'),'Error\x20while\x20creating\x20contact:\x20'+(_0x34d668[_0x75bb('0x1c')]||JSON[_0x75bb('0x30')](_0x34d668)),null,_0x140598));});});}function checkHopper(){function _0x4584f2(){return function(_0x55ebdf){logger[_0x75bb('0x16')](_0x75bb('0x31'),_0x75bb('0x32'),util[_0x75bb('0x33')](_0x55ebdf,{'showHidden':![],'depth':null}));};}var _0x286d72=function(_0x568f7b,_0x58f6f1){var _0x76f78d=squel[_0x75bb('0x34')]()[_0x75bb('0x35')]('cm_hopper')[_0x75bb('0x36')]([_0x75bb('0x22'),_0x75bb('0x37'),'ContactId',_0x75bb('0x29'),_0x58f6f1,_0x75bb('0x38'),_0x75bb('0x39')],squel[_0x75bb('0x3a')]()['field'](_0x75bb('0x22'),'phone')['field'](_0x75bb('0x3b'),_0x75bb('0x37'))[_0x75bb('0x3c')]('id','ContactId')[_0x75bb('0x3c')](LISTID[_0x75bb('0x3d')](),_0x75bb('0x29'))[_0x75bb('0x3c')](_0x568f7b['id'][_0x75bb('0x3d')](),_0x58f6f1)[_0x75bb('0x3c')](_0x75bb('0x3b'),_0x75bb('0x38'))['field'](_0x75bb('0x3b'),_0x75bb('0x39'))[_0x75bb('0x3e')](_0x75bb('0x3f'))[_0x75bb('0x40')](_0x75bb('0x41'))['where'](_0x75bb('0x42'),LISTID[_0x75bb('0x3d')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x75bb('0x40')](_0x75bb('0x43'),squel[_0x75bb('0x3a')]()[_0x75bb('0x3c')]('phone')[_0x75bb('0x3e')](_0x75bb('0x44'))[_0x75bb('0x40')](_0x58f6f1+'\x20=\x20?',_0x568f7b['id'][_0x75bb('0x3d')]())))[_0x75bb('0x3d')]();return _0x76f78d;};var _0x47bd99=function(_0x587dc4,_0x2fd491){var _0x5698e3=squel[_0x75bb('0x34')]()[_0x75bb('0x35')](_0x75bb('0x44'))[_0x75bb('0x36')]([_0x75bb('0x22'),_0x75bb('0x37'),'ContactId',_0x75bb('0x29'),_0x2fd491,_0x75bb('0x38'),_0x75bb('0x39')],squel['select']()[_0x75bb('0x3c')](_0x75bb('0x22'),_0x75bb('0x22'))['field']('NOW()',_0x75bb('0x37'))['field']('id','ContactId')[_0x75bb('0x3c')](LISTID[_0x75bb('0x3d')](),'ListId')[_0x75bb('0x3c')](_0x587dc4['id'][_0x75bb('0x3d')](),_0x2fd491)['field']('NOW()',_0x75bb('0x38'))[_0x75bb('0x3c')](_0x75bb('0x3b'),_0x75bb('0x39'))[_0x75bb('0x3e')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x75bb('0x40')](_0x75bb('0x42'),LISTID[_0x75bb('0x3d')]())['where'](_0x75bb('0x45'),squel['str'](hopperContacts))[_0x75bb('0x40')](_0x75bb('0x46'))[_0x75bb('0x40')](_0x75bb('0x43'),squel[_0x75bb('0x3a')]()['field'](_0x75bb('0x47'))['from']('cm_hopper_final')[_0x75bb('0x40')](_0x2fd491+_0x75bb('0x48'),_0x587dc4['id'][_0x75bb('0x3d')]()))[_0x75bb('0x40')](_0x75bb('0x43'),squel[_0x75bb('0x3a')]()['field'](_0x75bb('0x22'))[_0x75bb('0x3e')](_0x75bb('0x44'))[_0x75bb('0x40')](_0x2fd491+_0x75bb('0x48'),_0x587dc4['id'][_0x75bb('0x3d')]())))[_0x75bb('0x3d')]();return _0x5698e3;};function _0x242a65(_0x1aa675,_0x124d33){var _0x429529=squel['insert']()[_0x75bb('0x35')]('cm_hopper')[_0x75bb('0x36')]([_0x75bb('0x22'),'scheduledAt',_0x75bb('0x49'),_0x75bb('0x29'),_0x124d33,'createdAt',_0x75bb('0x39')],squel[_0x75bb('0x3a')]()['field'](_0x75bb('0x22'),_0x75bb('0x22'))[_0x75bb('0x3c')](_0x75bb('0x3b'),_0x75bb('0x37'))['field']('id','ContactId')[_0x75bb('0x3c')](LISTID[_0x75bb('0x3d')](),_0x75bb('0x29'))['field'](_0x1aa675['id'][_0x75bb('0x3d')](),_0x124d33)[_0x75bb('0x3c')](_0x75bb('0x3b'),_0x75bb('0x38'))[_0x75bb('0x3c')](_0x75bb('0x3b'),_0x75bb('0x39'))[_0x75bb('0x3e')](_0x75bb('0x3f'))[_0x75bb('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x75bb('0x3d')]())[_0x75bb('0x40')](_0x75bb('0x45'),squel[_0x75bb('0x4a')](hopperContacts))[_0x75bb('0x40')]('phone\x20IS\x20NOT\x20NULL'))[_0x75bb('0x3d')]();return _0x429529;}function _0x36183a(_0x54530c,_0x2a2b23){var _0x54dd34=squel['insert']()[_0x75bb('0x35')](_0x75bb('0x4b'))[_0x75bb('0x36')]([_0x75bb('0x22'),'ContactId',_0x75bb('0x29'),_0x2a2b23,_0x75bb('0x38'),_0x75bb('0x39')],squel[_0x75bb('0x3a')]()['field'](_0x75bb('0x22'),'phone')['field']('id','ContactId')[_0x75bb('0x3c')](LISTID['toString'](),_0x75bb('0x29'))['field'](_0x54530c['id'][_0x75bb('0x3d')](),_0x2a2b23)['field'](_0x75bb('0x3b'),_0x75bb('0x38'))[_0x75bb('0x3c')](_0x75bb('0x3b'),_0x75bb('0x39'))[_0x75bb('0x3e')](_0x75bb('0x3f'))['where'](_0x75bb('0x41'))[_0x75bb('0x40')]('ListId\x20=\x20?',LISTID[_0x75bb('0x3d')]())['where'](_0x75bb('0x45'),squel[_0x75bb('0x4a')](hopperContacts))[_0x75bb('0x40')](_0x75bb('0x46')))['toString']();return _0x54dd34;}return db['VoiceQueue'][_0x75bb('0x4c')]({'where':{'type':_0x75bb('0x4d')},'attributes':['id',_0x75bb('0x4e')],'include':[{'model':db[_0x75bb('0x4f')],'as':_0x75bb('0x50'),'where':{'id':LISTID}}]})['then'](function(_0x1233f0){var _0x1094bd=[];if(_0x1233f0){var _0x379e55;for(var _0x1dc782=0x0,_0x36e396;_0x1dc782<_0x1233f0[_0x75bb('0x19')];_0x1dc782+=0x1){_0x36e396=_0x1233f0[_0x1dc782][_0x75bb('0x51')]({'plain':!![]});switch(_0x36e396[_0x75bb('0x4e')]){case _0x75bb('0x52'):_0x1094bd['push'](db[_0x75bb('0x53')][_0x75bb('0x54')](_0x47bd99(_0x36e396,'VoiceQueueId'))[_0x75bb('0x2d')](function(){})[_0x75bb('0x55')](_0x4584f2()));break;case _0x75bb('0x56'):_0x1094bd['push'](db[_0x75bb('0x53')]['query'](_0x286d72(_0x36e396,'VoiceQueueId'))[_0x75bb('0x2d')](function(){})[_0x75bb('0x55')](_0x4584f2()));break;default:_0x1094bd[_0x75bb('0x2e')](db[_0x75bb('0x53')][_0x75bb('0x54')](_0x242a65(_0x36e396,_0x75bb('0x57')))[_0x75bb('0x2d')](function(){})[_0x75bb('0x55')](_0x4584f2()));}}}return _0x1094bd;})[_0x75bb('0x58')]()[_0x75bb('0x2d')](function(){return db['VoiceQueue'][_0x75bb('0x4c')]({'where':{'type':_0x75bb('0x4d')},'attributes':['id'],'include':[{'model':db[_0x75bb('0x4f')],'as':_0x75bb('0x59'),'where':{'id':LISTID}}]})[_0x75bb('0x2d')](function(_0x351a26){var _0x15ca00=[];if(_0x351a26){var _0x19e16a;for(var _0x535b8c=0x0,_0x3317a0;_0x535b8c<_0x351a26[_0x75bb('0x19')];_0x535b8c+=0x1){_0x3317a0=_0x351a26[_0x535b8c][_0x75bb('0x51')]({'plain':!![]});_0x15ca00[_0x75bb('0x2e')](db[_0x75bb('0x53')]['query'](_0x36183a(_0x3317a0,_0x75bb('0x57')))[_0x75bb('0x2d')](function(){})['catch'](_0x4584f2()));}}return _0x15ca00;})['all']();})['then'](function(){return db[_0x75bb('0x5a')][_0x75bb('0x4c')]({'attributes':['id',_0x75bb('0x4e')],'include':[{'model':db[_0x75bb('0x4f')],'as':_0x75bb('0x50'),'where':{'id':LISTID}}]})[_0x75bb('0x2d')](function(_0x58728e){var _0x2ffcfb=[];if(_0x58728e){for(var _0x2c4ea9=0x0,_0x6b0236;_0x2c4ea9<_0x58728e[_0x75bb('0x19')];_0x2c4ea9+=0x1){_0x6b0236=_0x58728e[_0x2c4ea9][_0x75bb('0x51')]({'plain':!![]});switch(_0x6b0236[_0x75bb('0x4e')]){case _0x75bb('0x52'):_0x2ffcfb[_0x75bb('0x2e')](db[_0x75bb('0x53')][_0x75bb('0x54')](_0x47bd99(_0x6b0236,'CampaignId'))[_0x75bb('0x2d')](function(){})['catch'](_0x4584f2()));break;case _0x75bb('0x56'):_0x2ffcfb[_0x75bb('0x2e')](db[_0x75bb('0x53')][_0x75bb('0x54')](_0x286d72(_0x6b0236,_0x75bb('0x5b')))[_0x75bb('0x2d')](function(){})[_0x75bb('0x55')](_0x4584f2()));break;default:_0x2ffcfb[_0x75bb('0x2e')](db[_0x75bb('0x53')][_0x75bb('0x54')](_0x242a65(_0x6b0236,_0x75bb('0x5b')))[_0x75bb('0x2d')](function(){})[_0x75bb('0x55')](_0x4584f2()));}}}return _0x2ffcfb;})[_0x75bb('0x58')]();})[_0x75bb('0x2d')](function(){return db[_0x75bb('0x5a')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x75bb('0x4f')],'as':_0x75bb('0x59'),'where':{'id':LISTID}}]})[_0x75bb('0x2d')](function(_0x2681bd){var _0x59bd97=[];if(_0x2681bd){for(var _0x3c0bf8=0x0,_0x46ca47;_0x3c0bf8<_0x2681bd[_0x75bb('0x19')];_0x3c0bf8+=0x1){_0x46ca47=_0x2681bd[_0x3c0bf8][_0x75bb('0x51')]({'plain':!![]});_0x59bd97[_0x75bb('0x2e')](db['sequelize'][_0x75bb('0x54')](_0x36183a(_0x46ca47,'CampaignId'))[_0x75bb('0x2d')](function(){})[_0x75bb('0x55')](_0x4584f2()));}}return _0x59bd97;})[_0x75bb('0x58')]();})[_0x75bb('0x55')](function(_0xa4144c){logger[_0x75bb('0x16')](_0x75bb('0x5c'),_0x75bb('0x5d'),_0xa4144c[_0x75bb('0x1c')]);});}var processPromises=function(_0x4621e2){return BPromise[_0x75bb('0x58')](promises)[_0x75bb('0x2d')](function(_0x23622d){})[_0x75bb('0x55')](function(_0x24729b){logger[_0x75bb('0x16')](_0x75bb('0x5e'),JSON[_0x75bb('0x30')](_0x24729b));})[_0x75bb('0x5f')](function(){socket[_0x75bb('0x60')](_0x75bb('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4621e2){return _0x4621e2[_0x75bb('0x62')]();}});};var endCsv=function(){return BPromise[_0x75bb('0x63')]()[_0x75bb('0x2d')](function(){if(hopperContacts){return checkHopper();}})[_0x75bb('0x2d')](function(){socket[_0x75bb('0x60')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x75bb('0x64')](FILEPATH);}catch(_0x32626f){logger[_0x75bb('0x16')](_0x75bb('0x65'),JSON[_0x75bb('0x30')](_0x32626f));}finally{process['exit'](0x0);}});};process['on'](_0x75bb('0x66'),function(){logger['info'](_0x75bb('0x67'));endCsv();});function main(){return BPromise[_0x75bb('0x63')]()[_0x75bb('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x75bb('0x68')][_0x75bb('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x75bb('0x2d')](function(_0x52491b){var _0x5d1c97=fs[_0x75bb('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x75bb('0x6a')](_0x5d1c97,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3126b0,_0x2e49be){total+=0x1;var _0x2420c4=total;promises['push'](checkRow(_0x3126b0,_0x52491b,_0x2420c4)['then'](function(){success+=0x1;})[_0x75bb('0x55')](function(_0x2e67f7){if(_0x2e67f7[_0x75bb('0x16')]){errors+=0x1;delete _0x2e67f7['error'];}else if(_0x2e67f7[_0x75bb('0x2c')]){duplicates+=0x1;delete _0x2e67f7[_0x75bb('0x2c')];}rows[_0x75bb('0x2e')](_0x2e67f7);}));if(total%0xc8===0x0){_0x2e49be[_0x75bb('0x6b')]();return processPromises(_0x2e49be);}},'complete':function(){return processPromises()[_0x75bb('0x2d')](function(){logger[_0x75bb('0x6c')](_0x75bb('0x6d'));endCsv();});},'error':function(_0x24b416,_0x39962a){logger[_0x75bb('0x6c')](_0x75bb('0x6e'),JSON[_0x75bb('0x30')](_0x24b416));endCsv();}});})[_0x75bb('0x55')](function(_0x2699fb){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x75bb('0x30')](_0x2699fb));});}main(); \ No newline at end of file +var _0xdb61=['../../../config/environment','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20socket_timestamp\x20parameter!','error','contact','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','push','pick','catch','stringify','checkHopper','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','ContactId','ListId\x20=\x20?','id\x20IN\x20?','calleridnum','cm_hopper_final','str','VoiceQueue','outbound','CmList','then','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','findAll','Campaign','Lists','CampaignId','BlackLists','generalCheckHopper','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xdb61,0x65));var _0x1db6=function(_0x2ef80a,_0x4cedd7){_0x2ef80a=_0x2ef80a-0x0;var _0x5cd570=_0xdb61[_0x2ef80a];return _0x5cd570;};'use strict';var BPromise=require(_0x1db6('0x0'));var util=require(_0x1db6('0x1'));var _=require(_0x1db6('0x2'));var fs=require('fs');var squel=require(_0x1db6('0x3'));var Papa=require(_0x1db6('0x4'));var Redis=require(_0x1db6('0x5'));var db=require(_0x1db6('0x6'))['db'];var config=require(_0x1db6('0x7'));var logger=require('../../../config/logger')(_0x1db6('0x8'));config[_0x1db6('0x9')]=_[_0x1db6('0xa')](config[_0x1db6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x1db6('0xb'))(new Redis(config[_0x1db6('0x9')]));require(_0x1db6('0xc'))[_0x1db6('0xd')](socket);try{if(!process[_0x1db6('0xe')][0x2]||process[_0x1db6('0xe')][0x2]===_0x1db6('0xf')||process[_0x1db6('0xe')][0x2]===_0x1db6('0x10')){throw new Error(_0x1db6('0x11'));}var FILEPATH=process[_0x1db6('0xe')][0x2];if(!process['argv'][0x3]||process[_0x1db6('0xe')][0x3]==='undefined'||process[_0x1db6('0xe')][0x3]==='null'||!process[_0x1db6('0xe')][0x4]||process[_0x1db6('0xe')][0x4]===_0x1db6('0xf')||process['argv'][0x4]===_0x1db6('0x10')){throw new Error(_0x1db6('0x12'));}var FIELDS=_['zipObject'](process[_0x1db6('0xe')][0x3][_0x1db6('0x13')](','),process['argv'][0x4]['split'](','));if(!process[_0x1db6('0xe')][0x5]||process[_0x1db6('0xe')][0x5]===_0x1db6('0xf')||process['argv'][0x5]===_0x1db6('0x10')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1db6('0xe')][0x6]&&process[_0x1db6('0xe')][0x6]!==_0x1db6('0xf')&&process[_0x1db6('0xe')][0x6]!==_0x1db6('0x10')?process[_0x1db6('0xe')][0x6]:null;var DUPLICATES=process[_0x1db6('0xe')][0x7]&&process[_0x1db6('0xe')][0x7]!==_0x1db6('0xf')&&process['argv'][0x7]!==_0x1db6('0x10')?process[_0x1db6('0xe')][0x7]:null;if(!process[_0x1db6('0xe')][0x8]||process[_0x1db6('0xe')][0x8]===_0x1db6('0xf')||process[_0x1db6('0xe')][0x8]===_0x1db6('0x10')){throw new Error(_0x1db6('0x14'));}var SOCKET_TIMESTAMP=process[_0x1db6('0xe')][0x8];}catch(_0xf87562){logger[_0x1db6('0x15')](_0xf87562);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(_0x444378,_0x266cfb,_0xa145c3,_0x524256){var _0x5269df={'message':_0x266cfb};_0x5269df[_0x444378]=!![];if(_0xa145c3){_0x5269df[_0x1db6('0x16')]=_0xa145c3;}if(_0x524256){_0x5269df['index']=_0x524256;}return _0x5269df;}function isEmail(_0x3478c1){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))*$/[_0x1db6('0x17')](_0x3478c1);}function checkRow(_0x202d8d,_0x564756,_0x13f0bb){return new BPromise(function(_0x4760e6,_0x52295e){if(_['isNil'](_0x202d8d)){return _0x52295e(handleCheckRowError(_0x1db6('0x15'),_0x1db6('0x18'),null,_0x13f0bb));}if(_0x202d8d['errors']&&_0x202d8d[_0x1db6('0x19')][_0x1db6('0x1a')]){var _0x2d9a84=_['map'](_0x202d8d[_0x1db6('0x19')],_0x1db6('0x1b'))[_0x1db6('0x1c')](';');return _0x52295e(handleCheckRowError(_0x1db6('0x15'),_0x2d9a84,null,_0x13f0bb));}var _0x504719={};for(var _0x5b7ab0 in FIELDS){if(FIELDS['hasOwnProperty'](_0x5b7ab0)&&FIELDS[_0x5b7ab0]){_0x504719[_0x5b7ab0]=_0x202d8d[_0x1db6('0x1d')][0x0][FIELDS[_0x5b7ab0]]||_0x202d8d[_0x1db6('0x1d')][0x0]['\ufeff'+FIELDS[_0x5b7ab0]];}}if(!_0x504719['firstName']){return _0x52295e(handleCheckRowError(_0x1db6('0x15'),_0x1db6('0x1e'),null,_0x13f0bb));}if(!_0x504719[_0x1db6('0x1f')]){return _0x52295e(handleCheckRowError('error',_0x1db6('0x20'),null,_0x13f0bb));}if(_0x504719[_0x1db6('0x21')]){var _0x522490=moment(_0x504719[_0x1db6('0x21')],_0x1db6('0x22'));if(!_0x522490['isValid']()){return _0x52295e(handleCheckRowError(_0x1db6('0x15'),_0x1db6('0x23'),null,_0x13f0bb));}}if(_0x504719[_0x1db6('0x24')]){if(!isEmail(_0x504719['email'])){return _0x52295e(handleCheckRowError(_0x1db6('0x15'),_0x1db6('0x25'),null,_0x13f0bb));}}_0x504719[_0x1db6('0x26')]=LISTID;_0x504719['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1db6('0x1a')]&&_0x564756){var _0x384561={};for(var _0x3a79b3=0x0,_0x3b1012=DUPLICATES['length'];_0x3a79b3<_0x3b1012;_0x3a79b3+=0x1){_0x384561[DUPLICATES[_0x3a79b3]]=_0x504719[DUPLICATES[_0x3a79b3]];}var _0x46ccd5=_[_0x1db6('0x27')](_0x564756,_0x384561);if(_0x46ccd5){return _0x52295e(handleCheckRowError(_0x1db6('0x28'),_0x1db6('0x29'),_0x46ccd5,_0x13f0bb));}}return db[_0x1db6('0x2a')][_0x1db6('0x2b')](_0x504719,{'raw':!![],'hooks':![],'fields':_[_0x1db6('0x2c')](_0x504719)})['then'](function(_0x1f9726){if(DUPLICATES&&DUPLICATES[_0x1db6('0x1a')]&&_0x564756){_0x564756[_0x1db6('0x2d')](_[_0x1db6('0x2e')](_0x504719,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1f9726['id'];return _0x4760e6();})[_0x1db6('0x2f')](function(_0x10becd){return _0x52295e(handleCheckRowError(_0x1db6('0x15'),'Error\x20while\x20creating\x20contact:\x20'+(_0x10becd[_0x1db6('0x1b')]||JSON[_0x1db6('0x30')](_0x10becd)),null,_0x13f0bb));});});}function checkHopper(){function _0x5798ef(){return function(_0x283a69){logger[_0x1db6('0x15')]('cmContact',_0x1db6('0x31'),util['inspect'](_0x283a69,{'showHidden':![],'depth':null}));};}var _0x82e870=function(_0x5d7350,_0x3b7da7){var _0x3130b4=squel['insert']()[_0x1db6('0x32')](_0x1db6('0x33'))[_0x1db6('0x34')]([_0x1db6('0x1f'),_0x1db6('0x35'),'ContactId',_0x1db6('0x26'),_0x3b7da7,_0x1db6('0x36'),_0x1db6('0x37')],squel[_0x1db6('0x38')]()['field'](_0x1db6('0x1f'),_0x1db6('0x1f'))[_0x1db6('0x39')]('NOW()',_0x1db6('0x35'))[_0x1db6('0x39')]('id','ContactId')[_0x1db6('0x39')](LISTID[_0x1db6('0x3a')](),_0x1db6('0x26'))[_0x1db6('0x39')](_0x5d7350['id']['toString'](),_0x3b7da7)['field'](_0x1db6('0x3b'),_0x1db6('0x36'))[_0x1db6('0x39')]('NOW()',_0x1db6('0x37'))[_0x1db6('0x3c')](_0x1db6('0x3d'))[_0x1db6('0x3e')](_0x1db6('0x3f'))['where']('ListId\x20=\x20?',LISTID[_0x1db6('0x3a')]())[_0x1db6('0x3e')](_0x1db6('0x40'))['where'](_0x1db6('0x41'),squel[_0x1db6('0x38')]()[_0x1db6('0x39')](_0x1db6('0x1f'))[_0x1db6('0x3c')]('cm_hopper')['where'](_0x3b7da7+_0x1db6('0x42'),_0x5d7350['id'][_0x1db6('0x3a')]())))['toString']();return _0x3130b4;};var _0x3cb91b=function(_0x1750bd,_0x536152){var _0x3a6c56=squel[_0x1db6('0x43')]()['into'](_0x1db6('0x33'))['fromQuery']([_0x1db6('0x1f'),_0x1db6('0x35'),'ContactId',_0x1db6('0x26'),_0x536152,_0x1db6('0x36'),'updatedAt'],squel[_0x1db6('0x38')]()['field'](_0x1db6('0x1f'),_0x1db6('0x1f'))[_0x1db6('0x39')](_0x1db6('0x3b'),_0x1db6('0x35'))['field']('id',_0x1db6('0x44'))[_0x1db6('0x39')](LISTID[_0x1db6('0x3a')](),_0x1db6('0x26'))[_0x1db6('0x39')](_0x1750bd['id']['toString'](),_0x536152)[_0x1db6('0x39')](_0x1db6('0x3b'),_0x1db6('0x36'))[_0x1db6('0x39')](_0x1db6('0x3b'),_0x1db6('0x37'))['from']('cm_contacts')[_0x1db6('0x3e')](_0x1db6('0x3f'))[_0x1db6('0x3e')](_0x1db6('0x45'),LISTID['toString']())[_0x1db6('0x3e')](_0x1db6('0x46'),squel['str'](hopperContacts))[_0x1db6('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x1db6('0x3e')](_0x1db6('0x41'),squel[_0x1db6('0x38')]()[_0x1db6('0x39')](_0x1db6('0x47'))['from'](_0x1db6('0x48'))['where'](_0x536152+'\x20=\x20?',_0x1750bd['id']['toString']()))['where'](_0x1db6('0x41'),squel[_0x1db6('0x38')]()['field'](_0x1db6('0x1f'))[_0x1db6('0x3c')](_0x1db6('0x33'))[_0x1db6('0x3e')](_0x536152+_0x1db6('0x42'),_0x1750bd['id'][_0x1db6('0x3a')]())))[_0x1db6('0x3a')]();return _0x3a6c56;};function _0x14e033(_0x384264,_0x40944d){var _0x217c96=squel[_0x1db6('0x43')]()['into'](_0x1db6('0x33'))[_0x1db6('0x34')]([_0x1db6('0x1f'),_0x1db6('0x35'),'ContactId',_0x1db6('0x26'),_0x40944d,_0x1db6('0x36'),_0x1db6('0x37')],squel['select']()['field'](_0x1db6('0x1f'),_0x1db6('0x1f'))[_0x1db6('0x39')](_0x1db6('0x3b'),'scheduledAt')['field']('id',_0x1db6('0x44'))['field'](LISTID[_0x1db6('0x3a')](),_0x1db6('0x26'))[_0x1db6('0x39')](_0x384264['id'][_0x1db6('0x3a')](),_0x40944d)[_0x1db6('0x39')](_0x1db6('0x3b'),_0x1db6('0x36'))[_0x1db6('0x39')](_0x1db6('0x3b'),_0x1db6('0x37'))[_0x1db6('0x3c')]('cm_contacts')['where'](_0x1db6('0x3f'))[_0x1db6('0x3e')](_0x1db6('0x45'),LISTID[_0x1db6('0x3a')]())[_0x1db6('0x3e')]('id\x20IN\x20?',squel[_0x1db6('0x49')](hopperContacts))['where'](_0x1db6('0x40')))['toString']();return _0x217c96;}function _0x30abcb(_0x58b8ac,_0xba7472){var _0x3a93d2=squel[_0x1db6('0x43')]()[_0x1db6('0x32')]('cm_hopper_black')[_0x1db6('0x34')](['phone',_0x1db6('0x44'),_0x1db6('0x26'),_0xba7472,_0x1db6('0x36'),'updatedAt'],squel[_0x1db6('0x38')]()[_0x1db6('0x39')](_0x1db6('0x1f'),_0x1db6('0x1f'))[_0x1db6('0x39')]('id',_0x1db6('0x44'))[_0x1db6('0x39')](LISTID[_0x1db6('0x3a')](),_0x1db6('0x26'))[_0x1db6('0x39')](_0x58b8ac['id'][_0x1db6('0x3a')](),_0xba7472)[_0x1db6('0x39')]('NOW()','createdAt')[_0x1db6('0x39')]('NOW()','updatedAt')[_0x1db6('0x3c')]('cm_contacts')[_0x1db6('0x3e')]('deletedAt\x20IS\x20NULL')[_0x1db6('0x3e')](_0x1db6('0x45'),LISTID[_0x1db6('0x3a')]())['where'](_0x1db6('0x46'),squel['str'](hopperContacts))['where'](_0x1db6('0x40')))['toString']();return _0x3a93d2;}return db[_0x1db6('0x4a')]['findAll']({'where':{'type':_0x1db6('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x1db6('0x4c')],'as':'Lists','where':{'id':LISTID}}]})[_0x1db6('0x4d')](function(_0x57d569){var _0x253a4c=[];if(_0x57d569){var _0x5df80f;for(var _0x55672f=0x0,_0x253d95;_0x55672f<_0x57d569['length'];_0x55672f+=0x1){_0x253d95=_0x57d569[_0x55672f][_0x1db6('0x4e')]({'plain':!![]});switch(_0x253d95[_0x1db6('0x4f')]){case _0x1db6('0x50'):_0x253a4c[_0x1db6('0x2d')](db[_0x1db6('0x51')]['query'](_0x3cb91b(_0x253d95,_0x1db6('0x52')))[_0x1db6('0x4d')](function(){})[_0x1db6('0x2f')](_0x5798ef()));break;case _0x1db6('0x53'):_0x253a4c['push'](db[_0x1db6('0x51')]['query'](_0x82e870(_0x253d95,_0x1db6('0x52')))[_0x1db6('0x4d')](function(){})[_0x1db6('0x2f')](_0x5798ef()));break;default:_0x253a4c[_0x1db6('0x2d')](db[_0x1db6('0x51')][_0x1db6('0x54')](_0x14e033(_0x253d95,_0x1db6('0x52')))[_0x1db6('0x4d')](function(){})['catch'](_0x5798ef()));}}}return _0x253a4c;})[_0x1db6('0x55')]()[_0x1db6('0x4d')](function(){return db['VoiceQueue'][_0x1db6('0x56')]({'where':{'type':_0x1db6('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1db6('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x1db6('0x4d')](function(_0x37f0f7){var _0xab53f0=[];if(_0x37f0f7){var _0x5893e6;for(var _0x436ebf=0x0,_0x3d9950;_0x436ebf<_0x37f0f7[_0x1db6('0x1a')];_0x436ebf+=0x1){_0x3d9950=_0x37f0f7[_0x436ebf][_0x1db6('0x4e')]({'plain':!![]});_0xab53f0['push'](db[_0x1db6('0x51')][_0x1db6('0x54')](_0x30abcb(_0x3d9950,_0x1db6('0x52')))[_0x1db6('0x4d')](function(){})[_0x1db6('0x2f')](_0x5798ef()));}}return _0xab53f0;})['all']();})[_0x1db6('0x4d')](function(){return db[_0x1db6('0x57')]['findAll']({'attributes':['id',_0x1db6('0x4f')],'include':[{'model':db[_0x1db6('0x4c')],'as':_0x1db6('0x58'),'where':{'id':LISTID}}]})[_0x1db6('0x4d')](function(_0x1ab807){var _0x3986f7=[];if(_0x1ab807){for(var _0x128e55=0x0,_0xa33ae0;_0x128e55<_0x1ab807[_0x1db6('0x1a')];_0x128e55+=0x1){_0xa33ae0=_0x1ab807[_0x128e55][_0x1db6('0x4e')]({'plain':!![]});switch(_0xa33ae0[_0x1db6('0x4f')]){case _0x1db6('0x50'):_0x3986f7[_0x1db6('0x2d')](db[_0x1db6('0x51')][_0x1db6('0x54')](_0x3cb91b(_0xa33ae0,_0x1db6('0x59')))[_0x1db6('0x4d')](function(){})['catch'](_0x5798ef()));break;case _0x1db6('0x53'):_0x3986f7[_0x1db6('0x2d')](db['sequelize'][_0x1db6('0x54')](_0x82e870(_0xa33ae0,_0x1db6('0x59')))[_0x1db6('0x4d')](function(){})[_0x1db6('0x2f')](_0x5798ef()));break;default:_0x3986f7[_0x1db6('0x2d')](db[_0x1db6('0x51')]['query'](_0x14e033(_0xa33ae0,'CampaignId'))[_0x1db6('0x4d')](function(){})[_0x1db6('0x2f')](_0x5798ef()));}}}return _0x3986f7;})[_0x1db6('0x55')]();})[_0x1db6('0x4d')](function(){return db['Campaign']['findAll']({'attributes':['id'],'include':[{'model':db[_0x1db6('0x4c')],'as':_0x1db6('0x5a'),'where':{'id':LISTID}}]})[_0x1db6('0x4d')](function(_0x7300fa){var _0x55c54c=[];if(_0x7300fa){for(var _0x18dbe8=0x0,_0x322036;_0x18dbe8<_0x7300fa[_0x1db6('0x1a')];_0x18dbe8+=0x1){_0x322036=_0x7300fa[_0x18dbe8]['get']({'plain':!![]});_0x55c54c[_0x1db6('0x2d')](db['sequelize'][_0x1db6('0x54')](_0x30abcb(_0x322036,_0x1db6('0x59')))['then'](function(){})[_0x1db6('0x2f')](_0x5798ef()));}}return _0x55c54c;})[_0x1db6('0x55')]();})[_0x1db6('0x2f')](function(_0x2fedf8){logger[_0x1db6('0x15')]('cmContact,\x20%s,\x20%s',_0x1db6('0x5b'),_0x2fedf8[_0x1db6('0x1b')]);});}var processPromises=function(_0x48b2e9){return BPromise[_0x1db6('0x55')](promises)['then'](function(_0x53154e){})[_0x1db6('0x2f')](function(_0x12c004){logger[_0x1db6('0x15')]('Error\x20processing\x20rows\x20block:',JSON[_0x1db6('0x30')](_0x12c004));})[_0x1db6('0x5c')](function(){socket[_0x1db6('0x5d')](_0x1db6('0x5e')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x48b2e9){return _0x48b2e9[_0x1db6('0x5f')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x1db6('0x4d')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x1db6('0x5d')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1db6('0x60')](FILEPATH);}catch(_0x24a20b){logger[_0x1db6('0x15')](_0x1db6('0x61'),JSON[_0x1db6('0x30')](_0x24a20b));}finally{process[_0x1db6('0x62')](0x0);}});};process['on'](_0x1db6('0x63'),function(){logger[_0x1db6('0x64')](_0x1db6('0x65'));endCsv();});function main(){return BPromise[_0x1db6('0x66')]()[_0x1db6('0x4d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x1db6('0x2a')][_0x1db6('0x56')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1db6('0x4d')](function(_0x23b68){var _0x3f5b75=fs[_0x1db6('0x67')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x1db6('0x68')](_0x3f5b75,{'header':!![],'skipEmptyLines':!![],'step':function(_0x371fa2,_0x253673){total+=0x1;var _0x181e39=total;promises[_0x1db6('0x2d')](checkRow(_0x371fa2,_0x23b68,_0x181e39)[_0x1db6('0x4d')](function(){success+=0x1;})['catch'](function(_0x455f21){if(_0x455f21['error']){errors+=0x1;delete _0x455f21[_0x1db6('0x15')];}else if(_0x455f21[_0x1db6('0x28')]){duplicates+=0x1;delete _0x455f21[_0x1db6('0x28')];}rows['push'](_0x455f21);}));if(total%0xc8===0x0){_0x253673[_0x1db6('0x69')]();return processPromises(_0x253673);}},'complete':function(){return processPromises()[_0x1db6('0x4d')](function(){logger[_0x1db6('0x64')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x5e30b0,_0xac8330){logger[_0x1db6('0x64')](_0x1db6('0x6a'),JSON[_0x1db6('0x30')](_0x5e30b0));endCsv();}});})[_0x1db6('0x2f')](function(_0x5c8d93){logger[_0x1db6('0x15')](_0x1db6('0x6b'),JSON[_0x1db6('0x30')](_0x5c8d93));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 15a1404..43ffdbb 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 _0x9d46=['ContactId','ListId','createdAt','updatedAt','priority','UserId','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.phone','cm_contacts.createdAt','select','from','cm_hopper_black','ListId\x20=\x20?','toString','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','push','catch','main','stringify','send','start','socket_timestamp','root','server/files/tmp','.csv','writeFileSync','parse','createReadStream','data','length','rows','errors','hasOwnProperty','trim','replace','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','appendFileSync','emit','contact:import:','Abort\x20parser','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','test','field','phone','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x9d46,0xef));var _0x69d4=function(_0x23e30d,_0x58e65f){_0x23e30d=_0x23e30d-0x0;var _0x37ab78=_0x9d46[_0x23e30d];return _0x37ab78;};'use strict';var fs=require('fs');var path=require(_0x69d4('0x0'));var _=require(_0x69d4('0x1'));var Papa=require('papaparse');var util=require(_0x69d4('0x2'));var BPromise=require(_0x69d4('0x3'));var moment=require('moment');var squel=require(_0x69d4('0x4'));var Redis=require(_0x69d4('0x5'));var db=require(_0x69d4('0x6'))['db'];var config=require(_0x69d4('0x7'));var logger=require(_0x69d4('0x8'))(_0x69d4('0x9'));config['redis']=_[_0x69d4('0xa')](config[_0x69d4('0xb')],{'host':_0x69d4('0xc'),'port':0x18eb});var socket=require(_0x69d4('0xd'))(new Redis(config[_0x69d4('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x69d4('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x5e6f56){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))*$/[_0x69d4('0xf')](_0x5e6f56);}function selectNotIn(_0x59d5d1,_0x30b243,_0x574d78,_0x24be11,_0x17c1b7){return squel['select']()[_0x69d4('0x10')](_0x69d4('0x11'))['from'](_0x24be11)[_0x69d4('0x12')](_0x30b243,null,_0x30b243+_0x69d4('0x13')+_0x24be11+'.'+_0x574d78)[_0x69d4('0x14')](_0x24be11+'.'+_0x574d78+'\x20=\x20'+_0x59d5d1+'.'+_0x574d78)[_0x69d4('0x14')](_0x30b243+_0x69d4('0x15')+_0x17c1b7['join']()+')');}function insertCmHopper(_0x4caa01,_0x12354e,_0x30e324,_0x21618b,_0x22c286){var _0x30eda9=['cm_contacts.phone','cm_contacts.scheduledat',_0x69d4('0x16'),_0x69d4('0x17'),_0x12354e+'.'+_0x21618b,'cm_contacts.createdAt',_0x69d4('0x18'),_0x69d4('0x19'),_0x69d4('0x1a'),'\x22'+_0x22c286+'\x22'];return squel[_0x69d4('0x1b')]()[_0x69d4('0x1c')](_0x69d4('0x1d'))[_0x69d4('0x1e')]([_0x69d4('0x11'),'scheduledat',_0x69d4('0x1f'),_0x69d4('0x20'),_0x21618b,_0x69d4('0x21'),_0x69d4('0x22'),_0x69d4('0x23'),_0x69d4('0x24'),'recallme'],squel['select']()[_0x69d4('0x25')](_0x30eda9)['from'](_0x12354e)[_0x69d4('0x12')](_0x69d4('0x26'),null,_0x69d4('0x27')+_0x12354e+_0x69d4('0x28'))[_0x69d4('0x12')](_0x30e324,null,_0x30e324+'.id\x20=\x20'+_0x12354e+'.'+_0x21618b)[_0x69d4('0x14')](_0x12354e+_0x69d4('0x29'),_0x4caa01)[_0x69d4('0x14')](_0x69d4('0x2a'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x12354e,_0x30e324,_0x21618b,_0x69d4('0x1d'),[_0x69d4('0x2b'),_0x69d4('0x2c')]))[_0x69d4('0x14')](_0x69d4('0x2d'),selectNotIn(_0x12354e,_0x30e324,_0x21618b,_0x69d4('0x1d'),[_0x69d4('0x2b')])))['toString']();}function insertCmHopperBlack(_0x5de17d,_0x17c3ab,_0x162746,_0x32e6cf){var _0x1ba7bc=[_0x69d4('0x2e'),_0x69d4('0x16'),_0x69d4('0x17'),_0x17c3ab+'.'+_0x32e6cf,_0x69d4('0x2f'),_0x69d4('0x18')];return squel[_0x69d4('0x1b')]()[_0x69d4('0x1c')]('cm_hopper_black')[_0x69d4('0x1e')]([_0x69d4('0x11'),_0x69d4('0x1f'),'ListId',_0x32e6cf,_0x69d4('0x21'),_0x69d4('0x22')],squel[_0x69d4('0x30')]()['fields'](_0x1ba7bc)[_0x69d4('0x31')](_0x17c3ab)['join']('cm_contacts',null,_0x69d4('0x27')+_0x17c3ab+'.CmListId')['join'](_0x162746,null,_0x162746+_0x69d4('0x13')+_0x17c3ab+'.'+_0x32e6cf)['where'](_0x17c3ab+'.CmListId\x20=\x20?',_0x5de17d)[_0x69d4('0x14')](_0x69d4('0x2a'),NOW)[_0x69d4('0x14')](_0x69d4('0x2d'),squel['select']()[_0x69d4('0x10')](_0x69d4('0x11'))[_0x69d4('0x31')](_0x69d4('0x32'))[_0x69d4('0x14')](_0x69d4('0x33'),_0x5de17d)['where'](_0x32e6cf+'\x20=\x20?',_0x17c3ab+'.'+_0x32e6cf)))[_0x69d4('0x34')]();}function insertCmContact(_0x108dac,_0xaae356,_0xbdd984,_0x1e8f72){var _0x431966=_[_0x69d4('0x35')](_[_0x69d4('0x36')](_0x1e8f72),[_0x69d4('0x20'),'CompanyId',_0x69d4('0x21'),_0x69d4('0x22')]);return squel[_0x69d4('0x1b')]()['into']('cm_contacts')[_0x69d4('0x1e')](_0x431966,squel[_0x69d4('0x30')]()[_0x69d4('0x25')](_0x431966)[_0x69d4('0x31')](_0xaae356)['where']('('+_0xbdd984['join'](',')+_0x69d4('0x37'),squel[_0x69d4('0x30')]()[_0x69d4('0x25')](_0xbdd984)[_0x69d4('0x31')](_0x69d4('0x26'))[_0x69d4('0x14')](_0x69d4('0x33'),_0x108dac)[_0x69d4('0x14')](_0x69d4('0x38')))['where']('id\x20IN\x20?',squel[_0x69d4('0x30')]()['field'](_0x69d4('0x39'),_0x69d4('0x3a'))[_0x69d4('0x31')](_0xaae356)[_0x69d4('0x3b')](_0xbdd984[_0x69d4('0x12')](','))))['toString']();}function handleStop(){logger[_0x69d4('0x3c')](_0x69d4('0x3d'));stopped=!![];}function handleUncaughtException(_0x146cfd){logger[_0x69d4('0x3e')](_0x146cfd[_0x69d4('0x3f')]);process['exit'](0x1);}function handleError(_0x3c4d96,_0x2ec3c7){stats['errors']['push']({'name':_0x2ec3c7['code'],'message':_0x2ec3c7[_0x69d4('0x3f')],'row':_0x3c4d96});}function handleQuery(_0x16a6a5){logger[_0x69d4('0x3c')](_0x16a6a5);return db['sequelize']['query'](_0x16a6a5)['spread'](function(_0x268e0b){results[_0x69d4('0x40')](_0x268e0b);})[_0x69d4('0x41')](function(_0x5c9f6b){logger['error'](_0x5c9f6b[_0x69d4('0x3f')]);});}function main(_0x5c082a,_0x279653,_0x591db9,_0xfb3b4e){logger['info'](_0x69d4('0x42'),_0x5c082a,JSON[_0x69d4('0x43')](_0x279653));process[_0x69d4('0x44')](_0x69d4('0x45'));var _0xee2170=_0x279653['binding'];var _0x1ac6d9=_0x279653[_0x69d4('0x46')];var _0x51c391=path[_0x69d4('0x12')](config[_0x69d4('0x47')],_0x69d4('0x48'),_0x1ac6d9+_0x69d4('0x49'));var _0x420e66=_[_0x69d4('0x36')](_0xee2170)[_0x69d4('0x12')]();logger[_0x69d4('0x3c')]('header',_0x420e66);fs[_0x69d4('0x4a')](_0x51c391,_0x420e66+'\x0a');Papa[_0x69d4('0x4b')](fs[_0x69d4('0x4c')](_0x5c082a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x167da5,_0x4f19e5){try{for(var _0x246edf=0x0,_0x4912fa=[];_0x246edf<_0x167da5[_0x69d4('0x4d')][_0x69d4('0x4e')];_0x246edf++){stats[_0x69d4('0x4f')]+=0x1;if(_0x167da5[_0x69d4('0x50')][_0x246edf]){handleError(_0x167da5[_0x69d4('0x4d')][_0x246edf],_0x167da5['errors'][_0x246edf]);}else{var _0x16fb2e=[];for(var _0x218ed9 in _0xee2170){if(_0xee2170[_0x69d4('0x51')](_0x218ed9)){if(_0x167da5[_0x69d4('0x4d')][_0x246edf][_0xee2170[_0x218ed9]]){var _0x1b1913=_[_0x69d4('0x52')](_0x167da5[_0x69d4('0x4d')][_0x246edf][_0xee2170[_0x218ed9]][_0x69d4('0x53')](/"/g,'\x27'));switch(_0x218ed9){case _0x69d4('0x54'):var _0x316f76=moment(_0x1b1913,_0x69d4('0x55'),!![]);if(_0x316f76[_0x69d4('0x56')]()){_0x4912fa[_0x69d4('0x40')]('\x22'+_0x1b1913+'\x22');}else{_0x16fb2e[_0x69d4('0x40')](_0x69d4('0x57'));}break;case _0x69d4('0x23'):var _0x14f8e1=parseInt(_0x1b1913);_0x1b1913=_['isNaN'](_0x14f8e1)||_0x14f8e1<0x0||_0x14f8e1>0x4?_0xfb3b4e?0x3:0x2:_0x14f8e1;_0x4912fa[_0x69d4('0x40')]('\x22'+_0x1b1913+'\x22');break;case _0x69d4('0x24'):var _0x5445df=parseInt(_0x1b1913);if(_[_0x69d4('0x58')](_0x5445df)&&_[_0x69d4('0x59')](_0x591db9,_0x5445df)){_0x4912fa[_0x69d4('0x40')]('\x22'+_0x5445df+'\x22');}else{_0x16fb2e[_0x69d4('0x40')](_0x69d4('0x5a'));}break;case _0x69d4('0x5b'):if(isEmail(_0x1b1913)){_0x4912fa['push']('\x22'+_0x1b1913+'\x22');}else{_0x16fb2e[_0x69d4('0x40')](_0x69d4('0x5c'));}break;case'dateOfBirth':var _0x20f283=moment(_0x1b1913,_0x69d4('0x5d'),!![]);if(_0x20f283[_0x69d4('0x56')]()){_0x4912fa[_0x69d4('0x40')]('\x22'+_0x1b1913+'\x22');}else{_0x16fb2e[_0x69d4('0x40')](_0x69d4('0x5e'));}break;default:_0x4912fa[_0x69d4('0x40')]('\x22'+_0x1b1913+'\x22');}}else{switch(_0x218ed9){case _0x69d4('0x5f'):case _0x69d4('0x11'):_0x16fb2e[_0x69d4('0x40')](_0x218ed9+_0x69d4('0x60'));break;default:_0x4912fa[_0x69d4('0x40')]('\x22\x22');}}}}if(_0x16fb2e[_0x69d4('0x4e')]){handleError(_0x167da5[_0x69d4('0x4d')][_0x246edf],{'code':'SystemRow','message':_0x16fb2e[_0x69d4('0x12')]()});}else{fs[_0x69d4('0x61')](_0x51c391,_0x4912fa['join']()+'\x0a');}_0x4912fa=[];}if(!(stats[_0x69d4('0x4f')]%0xc8)){socket[_0x69d4('0x62')](_0x69d4('0x63')+_0x1ac6d9,stats);stats['errors']=[];}}if(stopped){logger[_0x69d4('0x3c')](_0x69d4('0x64'));_0x4f19e5['abort']();}}catch(_0x429046){handleError(_0x167da5[_0x69d4('0x4d')][_0x246edf],{'code':'SystemError','message':_0x429046[_0x69d4('0x3f')]});logger[_0x69d4('0x3e')](_0x69d4('0x65'),_0x429046[_0x69d4('0x3f')]);}},'complete':function(){try{var _0x5e0510=[];var _0x1d43ee=_0x69d4('0x26');if(_0x279653[_0x69d4('0x66')]&&_0x279653[_0x69d4('0x66')][_0x69d4('0x4e')]){_0x1d43ee=_0x69d4('0x67')+_0x1ac6d9;_0x5e0510[_0x69d4('0x40')](_0x69d4('0x68')+_0x1d43ee+_0x69d4('0x69'));}var _0x3da081=util[_0x69d4('0xe')](_0x69d4('0x6a'),_0x51c391,_0x1d43ee,_0x420e66,_0x279653[_0x69d4('0x20')],_0x279653['CompanyId']||null,NOW,NOW);if(_[_0x69d4('0x6b')](_0xee2170['scheduledat'])){_0x3da081+=_0x69d4('0x6c');}_0x5e0510['push'](_0x3da081);if(_0x279653['duplicates']&&_0x279653['duplicates']['length']){_0x5e0510[_0x69d4('0x40')](insertCmContact(_0x279653['ListId'],_0x1d43ee,_0x279653[_0x69d4('0x66')],_0xee2170));_0x5e0510[_0x69d4('0x40')](_0x69d4('0x6d')+_0x1d43ee+';');}_0x5e0510[_0x69d4('0x40')](insertCmHopper(_0x279653['ListId'],'voice_queues_has_cm_lists',_0x69d4('0x6e'),_0x69d4('0x6f'),_0xfb3b4e));_0x5e0510[_0x69d4('0x40')](insertCmHopperBlack(_0x279653[_0x69d4('0x20')],_0x69d4('0x70'),_0x69d4('0x6e'),_0x69d4('0x6f')));_0x5e0510[_0x69d4('0x40')](insertCmHopper(_0x279653[_0x69d4('0x20')],'campaigns_has_cm_lists',_0x69d4('0x71'),_0x69d4('0x72'),_0xfb3b4e));_0x5e0510[_0x69d4('0x40')](insertCmHopperBlack(_0x279653[_0x69d4('0x20')],_0x69d4('0x73'),_0x69d4('0x71'),_0x69d4('0x72')));BPromise[_0x69d4('0x74')](_0x5e0510,handleQuery)[_0x69d4('0x75')](function(_0x5019be){stats[_0x69d4('0x76')]=!![];stats['affectedRows']=_0x279653[_0x69d4('0x66')]&&_0x279653[_0x69d4('0x66')][_0x69d4('0x4e')]?results[0x2][_0x69d4('0x77')]:results[0x0][_0x69d4('0x77')];socket[_0x69d4('0x62')](_0x69d4('0x63')+_0x1ac6d9,stats);fs[_0x69d4('0x78')](_0x5c082a);fs['unlink'](_0x51c391);process[_0x69d4('0x79')](0x0);})[_0x69d4('0x41')](function(_0x239fb3){logger[_0x69d4('0x3e')](_0x239fb3['message']);process[_0x69d4('0x79')](0x1);});}catch(_0xe2cb43){logger[_0x69d4('0x3e')](_0x69d4('0x7a'),_0xe2cb43[_0x69d4('0x3f')]);process[_0x69d4('0x79')](0x1);}},'error':function(_0x501d7a,_0x4c4906,_0x5bd1e8,_0x540836){throw new Error(_0x540836);}});}function validate(){if(process[_0x69d4('0x7b')]&&process[_0x69d4('0x7b')][_0x69d4('0x4e')]<0x4){throw new Error(_0x69d4('0x7c'));}var _0x1ac04b=path[_0x69d4('0x12')](config[_0x69d4('0x47')],_0x69d4('0x48'),process[_0x69d4('0x7b')][0x2]);if(!fs[_0x69d4('0x7d')](_0x1ac04b)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x53cc83={};try{_0x53cc83=JSON[_0x69d4('0x4b')](process[_0x69d4('0x7b')][0x3]);if(!_0x53cc83[_0x69d4('0x7e')]){throw new Error(_0x69d4('0x7f'));}if(!_0x53cc83['binding'][_0x69d4('0x11')]){throw new Error(_0x69d4('0x80'));}if(!_0x53cc83[_0x69d4('0x7e')]['firstName']){throw new Error(_0x69d4('0x81'));}var _0x1e1faa=0x0;if(_0x53cc83[_0x69d4('0x7e')][_0x69d4('0x24')]){_0x1e1faa=0x1;}if(!_0x53cc83[_0x69d4('0x20')]){throw new Error(_0x69d4('0x82'));}}catch(_0x4640d9){throw new Error('body\x20id\x20mandatory');}var _0x285968=[];try{_0x285968=_[_0x69d4('0x83')](JSON[_0x69d4('0x4b')](process[_0x69d4('0x7b')][0x4]),'id');}catch(_0x49ea8c){logger[_0x69d4('0x3c')](_0x69d4('0x84'));}main(_0x1ac04b,_0x53cc83,_0x285968,_0x1e1faa);}validate();process['on'](_0x69d4('0x85'),handleStop);process['on'](_0x69d4('0x86'),handleUncaughtException); \ No newline at end of file +var _0x898a=['\x20=\x20?','keys','CompanyId','updatedAt','fields',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','group','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','push','catch','send','start','socket_timestamp','root','.csv','info','header','writeFileSync','parse','createReadStream','data','rows','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','length','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_contacts.phone','cm_hopper_black','phone','ListId\x20=\x20?'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x898a,0xe5));var _0xa898=function(_0x5c5443,_0x2cefda){_0x5c5443=_0x5c5443-0x0;var _0x1d54c9=_0x898a[_0x5c5443];return _0x1d54c9;};'use strict';var fs=require('fs');var path=require(_0xa898('0x0'));var _=require(_0xa898('0x1'));var Papa=require(_0xa898('0x2'));var util=require(_0xa898('0x3'));var BPromise=require('bluebird');var moment=require(_0xa898('0x4'));var squel=require(_0xa898('0x5'));var Redis=require(_0xa898('0x6'));var db=require(_0xa898('0x7'))['db'];var config=require(_0xa898('0x8'));var logger=require(_0xa898('0x9'))(_0xa898('0xa'));config['redis']=_[_0xa898('0xb')](config[_0xa898('0xc')],{'host':_0xa898('0xd'),'port':0x18eb});var socket=require(_0xa898('0xe'))(new Redis(config[_0xa898('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xa898('0xf')](_0xa898('0x10'));function isEmail(_0x5c6ac7){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))*$/[_0xa898('0x11')](_0x5c6ac7);}function selectNotIn(_0x542a2e,_0x53d821,_0x1c9bc3,_0x2f722a,_0x3ba99c){return squel[_0xa898('0x12')]()[_0xa898('0x13')]('phone')[_0xa898('0x14')](_0x2f722a)['join'](_0x53d821,null,_0x53d821+_0xa898('0x15')+_0x2f722a+'.'+_0x1c9bc3)['where'](_0x2f722a+'.'+_0x1c9bc3+'\x20=\x20'+_0x542a2e+'.'+_0x1c9bc3)[_0xa898('0x16')](_0x53d821+_0xa898('0x17')+_0x3ba99c[_0xa898('0x18')]()+')');}function insertCmHopper(_0x25d7a3,_0x2e7dd7,_0x206baf,_0x5be316,_0x42eaf9){var _0x1a3f3b=['cm_contacts.phone',_0xa898('0x19'),_0xa898('0x1a'),_0xa898('0x1b'),_0x2e7dd7+'.'+_0x5be316,_0xa898('0x1c'),_0xa898('0x1d'),'cm_contacts.priority',_0xa898('0x1e'),'\x22'+_0x42eaf9+'\x22'];return squel[_0xa898('0x1f')]()[_0xa898('0x20')](_0xa898('0x21'))[_0xa898('0x22')](['phone',_0xa898('0x23'),_0xa898('0x24'),_0xa898('0x25'),_0x5be316,_0xa898('0x26'),'updatedAt',_0xa898('0x27'),_0xa898('0x28'),'recallme'],squel[_0xa898('0x12')]()['fields'](_0x1a3f3b)[_0xa898('0x14')](_0x2e7dd7)[_0xa898('0x18')](_0xa898('0x29'),null,_0xa898('0x2a')+_0x2e7dd7+_0xa898('0x2b'))[_0xa898('0x18')](_0x206baf,null,_0x206baf+_0xa898('0x15')+_0x2e7dd7+'.'+_0x5be316)[_0xa898('0x16')](_0x2e7dd7+_0xa898('0x2c'),_0x25d7a3)[_0xa898('0x16')](_0xa898('0x2d'),NOW)[_0xa898('0x16')](_0xa898('0x2e'),selectNotIn(_0x2e7dd7,_0x206baf,_0x5be316,'cm_hopper',['\x22always\x22',_0xa898('0x2f')]))['where'](_0xa898('0x2e'),selectNotIn(_0x2e7dd7,_0x206baf,_0x5be316,'cm_hopper',['\x22always\x22'])))[_0xa898('0x30')]();}function insertCmHopperBlack(_0x187251,_0x27aacc,_0x40fdfe,_0x481692){var _0x44c5e7=[_0xa898('0x31'),'cm_contacts.id','cm_contacts.ListId',_0x27aacc+'.'+_0x481692,_0xa898('0x1c'),_0xa898('0x1d')];return squel['insert']()[_0xa898('0x20')](_0xa898('0x32'))[_0xa898('0x22')]([_0xa898('0x33'),'ContactId','ListId',_0x481692,_0xa898('0x26'),'updatedAt'],squel[_0xa898('0x12')]()['fields'](_0x44c5e7)['from'](_0x27aacc)[_0xa898('0x18')](_0xa898('0x29'),null,_0xa898('0x2a')+_0x27aacc+_0xa898('0x2b'))['join'](_0x40fdfe,null,_0x40fdfe+'.id\x20=\x20'+_0x27aacc+'.'+_0x481692)[_0xa898('0x16')](_0x27aacc+_0xa898('0x2c'),_0x187251)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xa898('0x16')](_0xa898('0x2e'),squel['select']()['field']('phone')[_0xa898('0x14')](_0xa898('0x32'))[_0xa898('0x16')](_0xa898('0x34'),_0x187251)[_0xa898('0x16')](_0x481692+_0xa898('0x35'),_0x27aacc+'.'+_0x481692)))[_0xa898('0x30')]();}function insertCmContact(_0x31d9ec,_0x410f5c,_0x4c52fb,_0x325495){var _0x5b5bb2=_['concat'](_[_0xa898('0x36')](_0x325495),[_0xa898('0x25'),_0xa898('0x37'),'createdAt',_0xa898('0x38')]);return squel[_0xa898('0x1f')]()['into'](_0xa898('0x29'))[_0xa898('0x22')](_0x5b5bb2,squel[_0xa898('0x12')]()[_0xa898('0x39')](_0x5b5bb2)[_0xa898('0x14')](_0x410f5c)['where']('('+_0x4c52fb[_0xa898('0x18')](',')+_0xa898('0x3a'),squel[_0xa898('0x12')]()[_0xa898('0x39')](_0x4c52fb)['from'](_0xa898('0x29'))['where'](_0xa898('0x34'),_0x31d9ec)['where'](_0xa898('0x3b')))['where']('id\x20IN\x20?',squel[_0xa898('0x12')]()[_0xa898('0x13')](_0xa898('0x3c'),_0xa898('0x3d'))['from'](_0x410f5c)[_0xa898('0x3e')](_0x4c52fb[_0xa898('0x18')](','))))[_0xa898('0x30')]();}function handleStop(){logger['info'](_0xa898('0x3f'));stopped=!![];}function handleUncaughtException(_0x2517c8){logger[_0xa898('0x40')](_0x2517c8[_0xa898('0x41')]);process[_0xa898('0x42')](0x1);}function handleError(_0x2bb34d,_0x51ba5f){stats[_0xa898('0x43')]['push']({'name':_0x51ba5f[_0xa898('0x44')],'message':_0x51ba5f['message'],'row':_0x2bb34d});}function handleQuery(_0x1f1194){logger['info'](_0x1f1194);return db[_0xa898('0x45')][_0xa898('0x46')](_0x1f1194)[_0xa898('0x47')](function(_0x11290f){results[_0xa898('0x48')](_0x11290f);})[_0xa898('0x49')](function(_0x2467dc){logger['error'](_0x2467dc[_0xa898('0x41')]);});}function main(_0xe14c32,_0x4a99d4,_0x15e8c3,_0x54fff5){logger['info']('main',_0xe14c32,JSON['stringify'](_0x4a99d4));process[_0xa898('0x4a')](_0xa898('0x4b'));var _0x20a650=_0x4a99d4['binding'];var _0x53b111=_0x4a99d4[_0xa898('0x4c')];var _0x2ffce5=path[_0xa898('0x18')](config[_0xa898('0x4d')],'server/files/tmp',_0x53b111+_0xa898('0x4e'));var _0x186204=_['keys'](_0x20a650)[_0xa898('0x18')]();logger[_0xa898('0x4f')](_0xa898('0x50'),_0x186204);fs[_0xa898('0x51')](_0x2ffce5,_0x186204+'\x0a');Papa[_0xa898('0x52')](fs[_0xa898('0x53')](_0xe14c32),{'header':!![],'skipEmptyLines':!![],'step':function(_0x429003,_0x6cae81){try{for(var _0x1ddd1e=0x0,_0x144ad0=[];_0x1ddd1e<_0x429003[_0xa898('0x54')]['length'];_0x1ddd1e++){stats[_0xa898('0x55')]+=0x1;if(_0x429003['errors'][_0x1ddd1e]){handleError(_0x429003[_0xa898('0x54')][_0x1ddd1e],_0x429003['errors'][_0x1ddd1e]);}else{var _0x5df9da=[];for(var _0x24d1b5 in _0x20a650){if(_0x20a650[_0xa898('0x56')](_0x24d1b5)){if(_0x429003['data'][_0x1ddd1e][_0x20a650[_0x24d1b5]]){var _0x2af6b0=_[_0xa898('0x57')](_0x429003[_0xa898('0x54')][_0x1ddd1e][_0x20a650[_0x24d1b5]][_0xa898('0x58')](/"/g,'\x27'));switch(_0x24d1b5){case _0xa898('0x23'):var _0xfbd190=moment(_0x2af6b0,_0xa898('0x10'),!![]);if(_0xfbd190[_0xa898('0x59')]()){_0x144ad0[_0xa898('0x48')]('\x22'+_0x2af6b0+'\x22');}else{_0x5df9da[_0xa898('0x48')](_0xa898('0x5a'));}break;case _0xa898('0x27'):var _0x60ac04=parseInt(_0x2af6b0);_0x2af6b0=_[_0xa898('0x5b')](_0x60ac04)||_0x60ac04<0x0||_0x60ac04>0x4?_0x54fff5?0x3:0x2:_0x60ac04;_0x144ad0[_0xa898('0x48')]('\x22'+_0x2af6b0+'\x22');break;case _0xa898('0x28'):var _0x5de8de=parseInt(_0x2af6b0);if(_[_0xa898('0x5c')](_0x5de8de)&&_['includes'](_0x15e8c3,_0x5de8de)){_0x144ad0[_0xa898('0x48')]('\x22'+_0x5de8de+'\x22');}else{_0x5df9da[_0xa898('0x48')]('agent\x20not\x20exists');}break;case _0xa898('0x5d'):if(isEmail(_0x2af6b0)){_0x144ad0[_0xa898('0x48')]('\x22'+_0x2af6b0+'\x22');}else{_0x5df9da['push'](_0xa898('0x5e'));}break;case'dateOfBirth':var _0x3f26e1=moment(_0x2af6b0,_0xa898('0x5f'),!![]);if(_0x3f26e1[_0xa898('0x59')]()){_0x144ad0['push']('\x22'+_0x2af6b0+'\x22');}else{_0x5df9da[_0xa898('0x48')](_0xa898('0x60'));}break;default:_0x144ad0[_0xa898('0x48')]('\x22'+_0x2af6b0+'\x22');}}else{switch(_0x24d1b5){case _0xa898('0x61'):case _0xa898('0x33'):_0x5df9da[_0xa898('0x48')](_0x24d1b5+_0xa898('0x62'));break;default:_0x144ad0[_0xa898('0x48')]('\x22\x22');}}}}if(_0x5df9da[_0xa898('0x63')]){handleError(_0x429003['data'][_0x1ddd1e],{'code':_0xa898('0x64'),'message':_0x5df9da['join']()});}else{fs[_0xa898('0x65')](_0x2ffce5,_0x144ad0[_0xa898('0x18')]()+'\x0a');}_0x144ad0=[];}if(!(stats[_0xa898('0x55')]%0xc8)){socket[_0xa898('0x66')](_0xa898('0x67')+_0x53b111,stats);stats['errors']=[];}}if(stopped){logger[_0xa898('0x4f')](_0xa898('0x68'));_0x6cae81[_0xa898('0x69')]();}}catch(_0x5eb6c6){handleError(_0x429003['data'][_0x1ddd1e],{'code':_0xa898('0x6a'),'message':_0x5eb6c6[_0xa898('0x41')]});logger[_0xa898('0x40')](_0xa898('0x6b'),_0x5eb6c6['message']);}},'complete':function(){try{var _0x596312=[];var _0x45a9fe='cm_contacts';if(_0x4a99d4[_0xa898('0x6c')]&&_0x4a99d4[_0xa898('0x6c')][_0xa898('0x63')]){_0x45a9fe='cm_contacts_'+_0x53b111;_0x596312[_0xa898('0x48')](_0xa898('0x6d')+_0x45a9fe+_0xa898('0x6e'));}var _0x2a36d4=util[_0xa898('0xf')](_0xa898('0x6f'),_0x2ffce5,_0x45a9fe,_0x186204,_0x4a99d4[_0xa898('0x25')],_0x4a99d4['CompanyId']||null,NOW,NOW);if(_[_0xa898('0x70')](_0x20a650[_0xa898('0x23')])){_0x2a36d4+=_0xa898('0x71');}_0x596312[_0xa898('0x48')](_0x2a36d4);if(_0x4a99d4[_0xa898('0x6c')]&&_0x4a99d4['duplicates'][_0xa898('0x63')]){_0x596312[_0xa898('0x48')](insertCmContact(_0x4a99d4[_0xa898('0x25')],_0x45a9fe,_0x4a99d4[_0xa898('0x6c')],_0x20a650));_0x596312[_0xa898('0x48')](_0xa898('0x72')+_0x45a9fe+';');}_0x596312[_0xa898('0x48')](insertCmHopper(_0x4a99d4[_0xa898('0x25')],_0xa898('0x73'),_0xa898('0x74'),_0xa898('0x75'),_0x54fff5));_0x596312['push'](insertCmHopperBlack(_0x4a99d4[_0xa898('0x25')],_0xa898('0x76'),_0xa898('0x74'),'VoiceQueueId'));_0x596312[_0xa898('0x48')](insertCmHopper(_0x4a99d4[_0xa898('0x25')],_0xa898('0x77'),_0xa898('0x78'),_0xa898('0x79'),_0x54fff5));_0x596312[_0xa898('0x48')](insertCmHopperBlack(_0x4a99d4[_0xa898('0x25')],_0xa898('0x7a'),'campaigns','CampaignId'));BPromise['each'](_0x596312,handleQuery)[_0xa898('0x7b')](function(_0x45a1ba){stats[_0xa898('0x7c')]=!![];stats['affectedRows']=_0x4a99d4[_0xa898('0x6c')]&&_0x4a99d4['duplicates'][_0xa898('0x63')]?results[0x2][_0xa898('0x7d')]:results[0x0][_0xa898('0x7d')];socket[_0xa898('0x66')]('contact:import:'+_0x53b111,stats);fs[_0xa898('0x7e')](_0xe14c32);fs[_0xa898('0x7e')](_0x2ffce5);process[_0xa898('0x42')](0x0);})[_0xa898('0x49')](function(_0x1c7a73){logger[_0xa898('0x40')](_0x1c7a73['message']);process[_0xa898('0x42')](0x1);});}catch(_0x171cdd){logger[_0xa898('0x40')](_0xa898('0x7f'),_0x171cdd[_0xa898('0x41')]);process[_0xa898('0x42')](0x1);}},'error':function(_0x35294a,_0x1df77f,_0x46d53f,_0x16d505){throw new Error(_0x16d505);}});}function validate(){if(process['argv']&&process[_0xa898('0x80')]['length']<0x4){throw new Error(_0xa898('0x81'));}var _0x245a8b=path[_0xa898('0x18')](config[_0xa898('0x4d')],_0xa898('0x82'),process[_0xa898('0x80')][0x2]);if(!fs[_0xa898('0x83')](_0x245a8b)){throw new Error(_0xa898('0x84'));}var _0x3b26a1={};try{_0x3b26a1=JSON[_0xa898('0x52')](process[_0xa898('0x80')][0x3]);if(!_0x3b26a1[_0xa898('0x85')]){throw new Error(_0xa898('0x86'));}if(!_0x3b26a1[_0xa898('0x85')][_0xa898('0x33')]){throw new Error(_0xa898('0x87'));}if(!_0x3b26a1[_0xa898('0x85')][_0xa898('0x61')]){throw new Error(_0xa898('0x88'));}var _0x3d0533=0x0;if(_0x3b26a1['binding'][_0xa898('0x28')]){_0x3d0533=0x1;}if(!_0x3b26a1[_0xa898('0x25')]){throw new Error(_0xa898('0x89'));}}catch(_0x349315){throw new Error(_0xa898('0x8a'));}var _0x435f20=[];try{_0x435f20=_['map'](JSON[_0xa898('0x52')](process[_0xa898('0x80')][0x4]),'id');}catch(_0x149b24){logger[_0xa898('0x4f')](_0xa898('0x8b'));}main(_0x245a8b,_0x3b26a1,_0x435f20,_0x3d0533);}validate();process['on'](_0xa898('0x8c'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 2933734..cd12c09 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 _0x6a50=['Talk\x20Time','talktime','Called\x20Number','Member\x20Name','membername','uniqueid','starttime','Answer\x20Time','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','[xCALLY\x20Ticket]','toLowerCase','inbound','variable','calleridnum','outbound','push','string','Outbound\x20Call','destcalleridnum','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','destexten','Queue','queue','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x6a50,0x150));var _0x06a5=function(_0x1fc512,_0x1996db){_0x1fc512=_0x1fc512-0x0;var _0xae94b9=_0x6a50[_0x1fc512];return _0xae94b9;};'use strict';exports[_0x06a5('0x0')]=function(_0x27801d,_0x5c3719){var _0x4e9e2e=[{'type':'string','content':_0x06a5('0x1'),'variableName':null}];switch(_0x27801d[_0x06a5('0x2')]()){case'voice':switch(_0x5c3719[_0x06a5('0x2')]()){case _0x06a5('0x3'):_0x4e9e2e['push']({'type':_0x06a5('0x4'),'content':'','variableName':'queue'});_0x4e9e2e['push']({'type':_0x06a5('0x4'),'content':'','variableName':_0x06a5('0x5')});break;case _0x06a5('0x6'):_0x4e9e2e[_0x06a5('0x7')]({'type':_0x06a5('0x8'),'content':_0x06a5('0x9'),'variableName':null});_0x4e9e2e[_0x06a5('0x7')]({'type':_0x06a5('0x4'),'content':'','variableName':_0x06a5('0xa')});break;}}return _0x4e9e2e;};exports['getDescriptions']=function(_0xf94081,_0x69f584){var _0x4cafa9=[];switch(_0xf94081[_0x06a5('0x2')]()){case _0x06a5('0xb'):switch(_0x69f584[_0x06a5('0x2')]()){case'inbound':_0x4cafa9=[{'type':_0x06a5('0x8'),'content':_0x06a5('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x06a5('0xd'),'content':'','key':_0x06a5('0xe'),'keyType':_0x06a5('0x4'),'variableName':_0x06a5('0x5')},{'type':_0x06a5('0xd'),'content':'','key':'Caller\x20Name','keyType':_0x06a5('0x4'),'variableName':'calleridname'},{'type':_0x06a5('0xd'),'content':'','key':'Call\x20To','keyType':_0x06a5('0x4'),'variableName':_0x06a5('0xf')},{'type':_0x06a5('0xd'),'content':'','key':_0x06a5('0x10'),'keyType':_0x06a5('0x4'),'variableName':_0x06a5('0x11')},{'type':_0x06a5('0xd'),'content':'','key':_0x06a5('0x12'),'keyType':_0x06a5('0x4'),'variableName':'uniqueid'},{'type':_0x06a5('0xd'),'content':'','key':_0x06a5('0x13'),'keyType':_0x06a5('0x4'),'variableName':_0x06a5('0x14')},{'type':'string','content':_0x06a5('0x15'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x06a5('0x16'),'keyType':_0x06a5('0x4'),'variableName':_0x06a5('0x17')},{'type':_0x06a5('0xd'),'content':'','key':'Agent\x20Number','keyType':_0x06a5('0x4'),'variableName':'destcalleridnum'},{'type':_0x06a5('0x8'),'content':_0x06a5('0x18'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x06a5('0x19'),'keyType':_0x06a5('0x4'),'variableName':_0x06a5('0x14')},{'type':_0x06a5('0xd'),'content':'','key':_0x06a5('0x1a'),'keyType':_0x06a5('0x4'),'variableName':_0x06a5('0x1b')},{'type':'keyValue','content':'','key':_0x06a5('0x1c'),'keyType':_0x06a5('0x4'),'variableName':_0x06a5('0x1d')},{'type':_0x06a5('0xd'),'content':'','key':_0x06a5('0x1e'),'keyType':_0x06a5('0x4'),'variableName':_0x06a5('0x1f')},{'type':_0x06a5('0xd'),'content':'','key':_0x06a5('0x20'),'keyType':_0x06a5('0x4'),'variableName':_0x06a5('0x21')}];break;case'outbound':_0x4cafa9=[{'type':_0x06a5('0x8'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x06a5('0xd'),'content':'','key':_0x06a5('0x22'),'keyType':'variable','keyContent':'','variableName':_0x06a5('0xa')},{'type':_0x06a5('0xd'),'content':'','key':_0x06a5('0x23'),'keyType':'variable','keyContent':'','variableName':_0x06a5('0x24')},{'type':_0x06a5('0xd'),'content':'','key':_0x06a5('0x12'),'keyType':_0x06a5('0x4'),'keyContent':'','variableName':_0x06a5('0x25')},{'type':_0x06a5('0xd'),'content':'','key':_0x06a5('0x13'),'keyType':'variable','keyContent':'','variableName':_0x06a5('0x26')},{'type':_0x06a5('0x8'),'content':_0x06a5('0x18')},{'type':_0x06a5('0xd'),'content':'','key':_0x06a5('0x27'),'keyType':_0x06a5('0x4'),'keyContent':'','variableName':'answertime'},{'type':_0x06a5('0xd'),'content':'','key':_0x06a5('0x28'),'keyType':'variable','keyContent':'','variableName':_0x06a5('0x29')},{'type':_0x06a5('0xd'),'content':'','key':_0x06a5('0x2a'),'keyType':'variable','keyContent':'','variableName':_0x06a5('0x2b')},{'type':_0x06a5('0xd'),'content':'','key':_0x06a5('0x2c'),'keyType':'variable','keyContent':'','variableName':_0x06a5('0x2d')}];break;}}return _0x4cafa9;}; \ No newline at end of file +var _0xbe2c=['inbound','push','variable','calleridnum','Outbound\x20Call','destcalleridnum','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','outbound','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','toLowerCase'];(function(_0x39f442,_0x5ba22e){var _0x5248e9=function(_0x42cf2a){while(--_0x42cf2a){_0x39f442['push'](_0x39f442['shift']());}};_0x5248e9(++_0x5ba22e);}(_0xbe2c,0x131));var _0xcbe2=function(_0x178245,_0x2d6c20){_0x178245=_0x178245-0x0;var _0x5f3d0e=_0xbe2c[_0x178245];return _0x5f3d0e;};'use strict';exports['getSubjects']=function(_0x25cd72,_0x5aefac){var _0x3f829=[{'type':_0xcbe2('0x0'),'content':_0xcbe2('0x1'),'variableName':null}];switch(_0x25cd72[_0xcbe2('0x2')]()){case'voice':switch(_0x5aefac[_0xcbe2('0x2')]()){case _0xcbe2('0x3'):_0x3f829[_0xcbe2('0x4')]({'type':_0xcbe2('0x5'),'content':'','variableName':'queue'});_0x3f829[_0xcbe2('0x4')]({'type':_0xcbe2('0x5'),'content':'','variableName':_0xcbe2('0x6')});break;case'outbound':_0x3f829['push']({'type':'string','content':_0xcbe2('0x7'),'variableName':null});_0x3f829['push']({'type':'variable','content':'','variableName':_0xcbe2('0x8')});break;}}return _0x3f829;};exports['getDescriptions']=function(_0x25c876,_0x2aa034){var _0x1ec66c=[];switch(_0x25c876[_0xcbe2('0x2')]()){case _0xcbe2('0x9'):switch(_0x2aa034['toLowerCase']()){case'inbound':_0x1ec66c=[{'type':_0xcbe2('0x0'),'content':_0xcbe2('0xa'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':_0xcbe2('0x5'),'variableName':_0xcbe2('0x6')},{'type':_0xcbe2('0xb'),'content':'','key':_0xcbe2('0xc'),'keyType':_0xcbe2('0x5'),'variableName':_0xcbe2('0xd')},{'type':_0xcbe2('0xb'),'content':'','key':_0xcbe2('0xe'),'keyType':_0xcbe2('0x5'),'variableName':_0xcbe2('0xf')},{'type':'keyValue','content':'','key':'Queue','keyType':_0xcbe2('0x5'),'variableName':_0xcbe2('0x10')},{'type':_0xcbe2('0xb'),'content':'','key':_0xcbe2('0x11'),'keyType':_0xcbe2('0x5'),'variableName':_0xcbe2('0x12')},{'type':'keyValue','content':'','key':_0xcbe2('0x13'),'keyType':_0xcbe2('0x5'),'variableName':_0xcbe2('0x14')},{'type':'string','content':_0xcbe2('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xcbe2('0xb'),'content':'','key':_0xcbe2('0x16'),'keyType':_0xcbe2('0x5'),'variableName':_0xcbe2('0x17')},{'type':_0xcbe2('0xb'),'content':'','key':_0xcbe2('0x18'),'keyType':_0xcbe2('0x5'),'variableName':'destcalleridnum'},{'type':_0xcbe2('0x0'),'content':_0xcbe2('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xcbe2('0x1a'),'keyType':_0xcbe2('0x5'),'variableName':'agentcalledAt'},{'type':'keyValue','content':'','key':_0xcbe2('0x1b'),'keyType':_0xcbe2('0x5'),'variableName':_0xcbe2('0x1c')},{'type':_0xcbe2('0xb'),'content':'','key':_0xcbe2('0x1d'),'keyType':_0xcbe2('0x5'),'variableName':_0xcbe2('0x1e')},{'type':'keyValue','content':'','key':_0xcbe2('0x1f'),'keyType':_0xcbe2('0x5'),'variableName':'holdtime'},{'type':'keyValue','content':'','key':_0xcbe2('0x20'),'keyType':_0xcbe2('0x5'),'variableName':_0xcbe2('0x21')}];break;case _0xcbe2('0x22'):_0x1ec66c=[{'type':_0xcbe2('0x0'),'content':_0xcbe2('0xa'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':_0xcbe2('0x8')},{'type':_0xcbe2('0xb'),'content':'','key':'Member\x20Name','keyType':_0xcbe2('0x5'),'keyContent':'','variableName':'membername'},{'type':_0xcbe2('0xb'),'content':'','key':_0xcbe2('0x11'),'keyType':_0xcbe2('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0xcbe2('0x13'),'keyType':_0xcbe2('0x5'),'keyContent':'','variableName':_0xcbe2('0x23')},{'type':_0xcbe2('0x0'),'content':_0xcbe2('0x19')},{'type':'keyValue','content':'','key':_0xcbe2('0x24'),'keyType':'variable','keyContent':'','variableName':_0xcbe2('0x25')},{'type':'keyValue','content':'','key':_0xcbe2('0x26'),'keyType':_0xcbe2('0x5'),'keyContent':'','variableName':_0xcbe2('0x27')},{'type':_0xcbe2('0xb'),'content':'','key':_0xcbe2('0x28'),'keyType':_0xcbe2('0x5'),'keyContent':'','variableName':_0xcbe2('0x29')},{'type':_0xcbe2('0xb'),'content':'','key':_0xcbe2('0x2a'),'keyType':_0xcbe2('0x5'),'keyContent':'','variableName':_0xcbe2('0x2b')}];break;}}return _0x1ec66c;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index a57b0f6..b1813df 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 _0x2535=['toLowerCase','toUpperCase','name','role','stringify','null','then','update','info','catch','error','user','query','clone','body','omit','html','fax','mobile','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','InteractionId','upperFirst','unknown'];(function(_0x57b3df,_0x445081){var _0x206656=function(_0x16aeb3){while(--_0x16aeb3){_0x57b3df['push'](_0x57b3df['shift']());}};_0x206656(++_0x445081);}(_0x2535,0x1d3));var _0x5253=function(_0x408cd5,_0x380b30){_0x408cd5=_0x408cd5-0x0;var _0x48074c=_0x2535[_0x408cd5];return _0x48074c;};'use strict';var _=require(_0x5253('0x0'));var db=require(_0x5253('0x1'))['db'];var loggers={'openchannel':require(_0x5253('0x2'))('openchannel-interactions'),'mail':require(_0x5253('0x2'))(_0x5253('0x3')),'fax':require(_0x5253('0x2'))(_0x5253('0x4')),'sms':require('../../config/logger')(_0x5253('0x5')),'chat':require(_0x5253('0x2'))('chat-interactions'),'whatsapp':require('../../config/logger')('whatsapp-interactions')};function getInteractionId(_0x1a9b52,_0x211411,_0x44153b){if(_0x1a9b52&&_0x1a9b52[_['upperFirst'](_0x44153b)+_0x5253('0x6')]){return _0x1a9b52[_[_0x5253('0x7')](_0x44153b)+'InteractionId'];}else if(_0x1a9b52&&_0x1a9b52['id']){return _0x1a9b52['id'];}else if(_0x211411&&_0x211411['id']){return _0x211411['id'];}else{return _0x5253('0x8');}}function log(_0x19464f,_0x4724f4,_0x5a4814,_0x2424eb,_0x96b2b,_0x45967a){loggers[_0x96b2b[_0x5253('0x9')]()][_0x19464f]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x45967a[_0x5253('0xa')](),_0x4724f4?_0x4724f4['id']:null,_0x4724f4?_0x4724f4[_0x5253('0xb')]:null,_0x4724f4?_0x4724f4[_0x5253('0xc')]:null,getInteractionId(_0x5a4814,_0x2424eb,_0x96b2b),_0x5a4814?JSON[_0x5253('0xd')](_0x5a4814):_0x5253('0xe'));}function updateUser(_0x21b00a,_0x2ba3b6,_0x183767,_0x2cb645,_0x19e033){db[_[_0x5253('0x7')](_0x2cb645)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x2ba3b6,_0x183767,_0x2cb645)}})[_0x5253('0xf')](function(_0x1713bf){if(_0x1713bf){return _0x1713bf[_0x5253('0x10')]({'UserId':_0x21b00a?_0x21b00a['id']:null});}})[_0x5253('0xf')](function(_0x126b5a){if(_0x126b5a){log(_0x5253('0x11'),_0x21b00a,_0x2ba3b6,_0x183767,_0x2cb645,_0x19e033);}})[_0x5253('0x12')](function(){log(_0x5253('0x13'),_0x21b00a,_0x2ba3b6,_0x183767,_0x2cb645,_0x19e033);});}exports['tracked']=function(_0x3e2f0b,_0x1dcd98){return function(_0x29bfe6,_0x29b3b7,_0x1ffa2a){var _0xeabb20=_0x29bfe6[_0x5253('0x14')];var _0x469aa6={};var _0x74aa49=_0x29bfe6[_0x5253('0x15')];if(_0x469aa6){_0x469aa6=_[_0x5253('0x16')](_0x29bfe6[_0x5253('0x17')]);_0x469aa6=_[_0x5253('0x18')](_0x469aa6,[_0x5253('0x17'),_0x5253('0x19'),'phone',_0x5253('0x1a'),_0x5253('0x1b')]);}updateUser(_0xeabb20,_0x469aa6,_0x74aa49,_0x3e2f0b,_0x1dcd98);_0x1ffa2a(null);};}; \ No newline at end of file +var _0xa96f=['query','clone','omit','body','html','mobile','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','error','tracked','user'];(function(_0x14d3cc,_0x567831){var _0x1f822b=function(_0x1eeeb9){while(--_0x1eeeb9){_0x14d3cc['push'](_0x14d3cc['shift']());}};_0x1f822b(++_0x567831);}(_0xa96f,0x10a));var _0xfa96=function(_0x216428,_0x5d20ea){_0x216428=_0x216428-0x0;var _0x313dd4=_0xa96f[_0x216428];return _0x313dd4;};'use strict';var _=require('lodash');var db=require(_0xfa96('0x0'))['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0xfa96('0x1'))(_0xfa96('0x2')),'fax':require(_0xfa96('0x1'))(_0xfa96('0x3')),'sms':require('../../config/logger')('sms-interactions'),'chat':require('../../config/logger')('chat-interactions'),'whatsapp':require('../../config/logger')(_0xfa96('0x4'))};function getInteractionId(_0xee11c0,_0x1d039c,_0x28f3ab){if(_0xee11c0&&_0xee11c0[_[_0xfa96('0x5')](_0x28f3ab)+_0xfa96('0x6')]){return _0xee11c0[_[_0xfa96('0x5')](_0x28f3ab)+'InteractionId'];}else if(_0xee11c0&&_0xee11c0['id']){return _0xee11c0['id'];}else if(_0x1d039c&&_0x1d039c['id']){return _0x1d039c['id'];}else{return'unknown';}}function log(_0x216489,_0x480d9b,_0x25a3cf,_0xa88a32,_0x4a9f71,_0x531f67){loggers[_0x4a9f71[_0xfa96('0x7')]()][_0x216489](_0xfa96('0x8'),_0x531f67[_0xfa96('0x9')](),_0x480d9b?_0x480d9b['id']:null,_0x480d9b?_0x480d9b[_0xfa96('0xa')]:null,_0x480d9b?_0x480d9b[_0xfa96('0xb')]:null,getInteractionId(_0x25a3cf,_0xa88a32,_0x4a9f71),_0x25a3cf?JSON[_0xfa96('0xc')](_0x25a3cf):_0xfa96('0xd'));}function updateUser(_0x1bb0e1,_0x4a4ecf,_0x2d32f7,_0xb8fb2f,_0xa304c9){db[_[_0xfa96('0x5')](_0xb8fb2f)+_0xfa96('0xe')][_0xfa96('0xf')]({'where':{'id':getInteractionId(_0x4a4ecf,_0x2d32f7,_0xb8fb2f)}})[_0xfa96('0x10')](function(_0x2b7bfb){if(_0x2b7bfb){return _0x2b7bfb['update']({'UserId':_0x1bb0e1?_0x1bb0e1['id']:null});}})[_0xfa96('0x10')](function(_0x1b6eb7){if(_0x1b6eb7){log('info',_0x1bb0e1,_0x4a4ecf,_0x2d32f7,_0xb8fb2f,_0xa304c9);}})['catch'](function(){log(_0xfa96('0x11'),_0x1bb0e1,_0x4a4ecf,_0x2d32f7,_0xb8fb2f,_0xa304c9);});}exports[_0xfa96('0x12')]=function(_0x1b244b,_0xd6e3ea){return function(_0xb4ac9b,_0xb7aec4,_0x2743a2){var _0x4122e4=_0xb4ac9b[_0xfa96('0x13')];var _0x11f9b4={};var _0x5e7a3e=_0xb4ac9b[_0xfa96('0x14')];if(_0x11f9b4){_0x11f9b4=_[_0xfa96('0x15')](_0xb4ac9b['body']);_0x11f9b4=_[_0xfa96('0x16')](_0x11f9b4,[_0xfa96('0x17'),_0xfa96('0x18'),'phone','fax',_0xfa96('0x19')]);}updateUser(_0x4122e4,_0x11f9b4,_0x5e7a3e,_0x1b244b,_0xd6e3ea);_0x2743a2(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 1b6403d..5c09c7a 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 _0xd360=['base64','utf8','parse','use','License','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','format','update'];(function(_0x115d67,_0x2d59c8){var _0x3a8089=function(_0x4cc82f){while(--_0x4cc82f){_0x115d67['push'](_0x115d67['shift']());}};_0x3a8089(++_0x2d59c8);}(_0xd360,0x18a));var _0x0d36=function(_0x118178,_0x12cf90){_0x118178=_0x118178-0x0;var _0x43fb92=_0xd360[_0x118178];return _0x43fb92;};'use strict';var crypto=require(_0x0d36('0x0'));var util=require(_0x0d36('0x1'));var compose=require(_0x0d36('0x2'));var db=require(_0x0d36('0x3'))['db'];var config=require(_0x0d36('0x4'));function getValueFromLicense(_0x381c19,_0x140bdd){if(_0x381c19&&_0x140bdd){if(_0x140bdd[_0x0d36('0x5')]&&_0x140bdd['license']){var _0x587be7=_0x140bdd['data1'];var _0x1948b6=_0x140bdd[_0x0d36('0x6')];var _0x359ae6=_0x587be7[_0x0d36('0x7')]('-')[0x4];var _0x599544=_0x587be7[_0x0d36('0x7')]('-')[0x0];var _0x4a5ba5=crypto[_0x0d36('0x8')]('aes-256-ctr',util[_0x0d36('0x9')]('%s:%s:%s',_0x359ae6,_0x587be7,_0x599544));var _0x3912ae=_0x4a5ba5[_0x0d36('0xa')](_0x1948b6,_0x0d36('0xb'),_0x0d36('0xc'));_0x3912ae+=_0x4a5ba5['final'](_0x0d36('0xc'));var _0x5ab5c=JSON[_0x0d36('0xd')](_0x3912ae);return _0x5ab5c['hasOwnProperty'](_0x381c19)?_0x5ab5c[_0x381c19]:null;}}return null;}function isLimit(_0x173f9d,_0x45cc3c,_0x5ab03f,_0x5225ae){var _0x4fd112=_0x45cc3c;return compose()[_0x0d36('0xe')](function(_0x511819,_0xa7ca3b,_0x7129a7){return db[_0x0d36('0xf')][_0x0d36('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x0d36('0x11')](function(_0x4d0355){var _0x2c6116=getValueFromLicense(_0x173f9d,_0x4d0355);return _0x2c6116?_0x2c6116:_0x4fd112;})[_0x0d36('0x11')](function(_0x1b21bc){_0x4fd112=_0x1b21bc;return _0x5ab03f['count'](_0x5225ae);})['then'](function(_0x42584a){if(_0x42584a>=_0x4fd112){return _0xa7ca3b[_0x0d36('0x12')](0x193)[_0x0d36('0x13')]({'message':util[_0x0d36('0x9')](_0x0d36('0x14'),_0x173f9d)});}_0x7129a7();})[_0x0d36('0x15')](function(_0x126ca7){_0x7129a7(_0x126ca7);});});}function isUserLimit(){return isLimit(_0x0d36('0x16'),0x1,db[_0x0d36('0x17')],{'where':{'$or':[{'role':_0x0d36('0x18')},{'role':_0x0d36('0x19')}]}});}exports[_0x0d36('0x1a')]=isUserLimit; \ No newline at end of file +var _0x47c2=['utf8','parse','hasOwnProperty','use','findOne','then','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','crypto','util','composable-middleware','../../mysqldb','../../config/environment','license','split','%s:%s:%s','update','base64'];(function(_0x4030d4,_0x336ab2){var _0x342e02=function(_0x3a61b7){while(--_0x3a61b7){_0x4030d4['push'](_0x4030d4['shift']());}};_0x342e02(++_0x336ab2);}(_0x47c2,0xf3));var _0x247c=function(_0x111c5c,_0x124a16){_0x111c5c=_0x111c5c-0x0;var _0x20a69f=_0x47c2[_0x111c5c];return _0x20a69f;};'use strict';var crypto=require(_0x247c('0x0'));var util=require(_0x247c('0x1'));var compose=require(_0x247c('0x2'));var db=require(_0x247c('0x3'))['db'];var config=require(_0x247c('0x4'));function getValueFromLicense(_0x2d469d,_0x2387f9){if(_0x2d469d&&_0x2387f9){if(_0x2387f9['data1']&&_0x2387f9['license']){var _0x4fcf2a=_0x2387f9['data1'];var _0x1b26c9=_0x2387f9[_0x247c('0x5')];var _0x5093c7=_0x4fcf2a['split']('-')[0x4];var _0x4aa749=_0x4fcf2a[_0x247c('0x6')]('-')[0x0];var _0x58b73c=crypto['createDecipher']('aes-256-ctr',util['format'](_0x247c('0x7'),_0x5093c7,_0x4fcf2a,_0x4aa749));var _0x1102eb=_0x58b73c[_0x247c('0x8')](_0x1b26c9,_0x247c('0x9'),_0x247c('0xa'));_0x1102eb+=_0x58b73c['final'](_0x247c('0xa'));var _0x45d757=JSON[_0x247c('0xb')](_0x1102eb);return _0x45d757[_0x247c('0xc')](_0x2d469d)?_0x45d757[_0x2d469d]:null;}}return null;}function isLimit(_0xd41953,_0x592fea,_0x548ff9,_0x46938f){var _0xd3afac=_0x592fea;return compose()[_0x247c('0xd')](function(_0x231216,_0x1eeac8,_0x345f44){return db['License'][_0x247c('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x247c('0xf')](function(_0x2bd194){var _0x3750d5=getValueFromLicense(_0xd41953,_0x2bd194);return _0x3750d5?_0x3750d5:_0xd3afac;})[_0x247c('0xf')](function(_0x30a517){_0xd3afac=_0x30a517;return _0x548ff9['count'](_0x46938f);})[_0x247c('0xf')](function(_0x266e3a){if(_0x266e3a>=_0xd3afac){return _0x1eeac8['status'](0x193)[_0x247c('0x10')]({'message':util[_0x247c('0x11')](_0x247c('0x12'),_0xd41953)});}_0x345f44();})[_0x247c('0x13')](function(_0x29cd7b){_0x345f44(_0x29cd7b);});});}function isUserLimit(){return isLimit(_0x247c('0x14'),0x1,db[_0x247c('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0x247c('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 4945b3a..9ef72ef 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 _0xc8e8=['shift','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','format','castTo','text','CAST(','field','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','hours','add','minutes','seconds','lodash','parseSearch','startsWith','[$or]','and','replace','split','length','slice','forEach'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc8e8,0x162));var _0x8c8e=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xc8e8[_0x1d87fc];return _0x492b56;};'use strict';var _=require(_0x8c8e('0x0'));var moment=require('moment');exports[_0x8c8e('0x1')]=function(_0x3976f5){var _0x1bb934={'conditions':[]};_0x1bb934['sqlOperator']=_[_0x8c8e('0x2')](_0x3976f5,_0x8c8e('0x3'))?'or':_0x8c8e('0x4');var _0x413c79=_0x3976f5[_0x8c8e('0x5')]('[$and]','')[_0x8c8e('0x5')](_0x8c8e('0x3'),'')[_0x8c8e('0x6')]('||');for(var _0x48ca89=0x0;_0x48ca89<_0x413c79[_0x8c8e('0x7')];_0x48ca89++){var _0x2947fd=_0x413c79[_0x48ca89][_0x8c8e('0x6')](':=');var _0x3d6e26=_0x2947fd[0x0];var _0x2c2fe4=_0x2947fd[_0x8c8e('0x8')](0x1);_0x2c2fe4[_0x8c8e('0x9')](function(_0x1c74e3){var _0xb835fd=_0x1c74e3[_0x8c8e('0x6')]('[')[_0x8c8e('0xa')]();var _0x5dd54c=_0x1c74e3['match'](/\[(.*?)\]/g);_0x5dd54c[_0x8c8e('0x9')](function(_0x284c19){var _0x49297b=_0x284c19[_0x8c8e('0x6')]('[')['filter'](function(_0x3d374f){return _0x3d374f['indexOf'](']')>-0x1;})[_0x8c8e('0xb')](function(_0x3a2e4f){return _0x3a2e4f[_0x8c8e('0x6')](']')[0x0];})[0x0];_0x1bb934[_0x8c8e('0xc')][_0x8c8e('0xd')]({'field':_0x3d6e26,'operator':_0xb835fd,'value':_0x49297b});});});}return _0x1bb934;};exports[_0x8c8e('0xe')]=function(_0x54ca28,_0x1776b9,_0x16c887){var _0x1e5b41={};if(_0x1776b9===_0x8c8e('0xf')){if(_0x16c887[_0x8c8e('0x10')]===_0x8c8e('0x11')){_0x16c887[_0x8c8e('0x10')]=_0x8c8e('0x12');_0x16c887[_0x8c8e('0x13')]+=','+_0x16c887['value'];}else if(_['includes']([_0x8c8e('0x14'),_0x8c8e('0x15')],_0x16c887[_0x8c8e('0x10')])){_0x16c887[_0x8c8e('0x13')]=moment(_0x16c887[_0x8c8e('0x13')])['add'](0x1,'days')[_0x8c8e('0x16')]('YYYY-MM-DD');}}if(_0x16c887[_0x8c8e('0x17')]){_0x1776b9=_0x16c887[_0x8c8e('0x17')];_0x1e5b41[_0x8c8e('0x18')]=_0x8c8e('0x19')+_0x54ca28+'.'+_0x16c887['field']+'\x20AS\x20'+_0x16c887[_0x8c8e('0x17')]+')\x20'+parseOperator(_0x16c887[_0x8c8e('0x10')]);}else{_0x1e5b41[_0x8c8e('0x18')]=_0x54ca28+'.'+_0x16c887[_0x8c8e('0x1a')]+'\x20'+parseOperator(_0x16c887['operator']);}if(_[_0x8c8e('0x1b')]([_0x8c8e('0x1c'),_0x8c8e('0x1d')],_0x16c887[_0x8c8e('0x10')]))_0x1e5b41[_0x8c8e('0x18')]='('+_0x1e5b41['text']+_0x8c8e('0x1e')+_0x54ca28+'.'+_0x16c887['field']+_0x8c8e('0x1f');_0x1e5b41['value']=parseValue(_0x1776b9,_0x16c887['operator'],_0x16c887[_0x8c8e('0x13')]);return _0x1e5b41;};function parseOperator(_0x54fcbd){var _0x285a41;switch(_0x54fcbd){case _0x8c8e('0x20'):_0x285a41=_0x8c8e('0x21');break;case _0x8c8e('0x1d'):_0x285a41=_0x8c8e('0x22');break;case'$eq':_0x285a41=_0x8c8e('0x23');break;case _0x8c8e('0x1c'):_0x285a41=_0x8c8e('0x24');break;case _0x8c8e('0x25'):case _0x8c8e('0x26'):case _0x8c8e('0x27'):_0x285a41=_0x8c8e('0x28');break;case _0x8c8e('0x29'):_0x285a41=_0x8c8e('0x2a');break;case _0x8c8e('0x14'):_0x285a41=_0x8c8e('0x2b');break;case'$lte':_0x285a41=_0x8c8e('0x2c');break;case'$gte':_0x285a41='>=\x20?';break;case _0x8c8e('0x12'):_0x285a41=_0x8c8e('0x2d');break;}return _0x285a41;}function parseValue(_0x256b01,_0x5beabf,_0x234620){var _0x10a173={'start':undefined,'end':undefined};switch(_0x5beabf){case'$in':case _0x8c8e('0x1d'):_0x10a173[_0x8c8e('0x2e')]=_0x234620[_0x8c8e('0x6')](',');break;case _0x8c8e('0x25'):_0x10a173[_0x8c8e('0x2e')]='%'+_0x234620+'%';break;case _0x8c8e('0x26'):_0x10a173['start']=_0x234620+'%';break;case _0x8c8e('0x27'):_0x10a173[_0x8c8e('0x2e')]='%'+_0x234620;break;case _0x8c8e('0x12'):var _0x17f403=_0x234620[_0x8c8e('0x6')](',');var _0x234620=_0x17f403['shift']();var _0xa2bc05=_0x17f403['pop']();if(_0x256b01==='DATE'){_0x234620=moment(_0x234620)['utcOffset'](0x0,!![])[_0x8c8e('0x16')]();_0xa2bc05=moment(_0xa2bc05)[_0x8c8e('0x2f')](0x0,!![])['add'](0x17,_0x8c8e('0x30'))[_0x8c8e('0x31')](0x3b,_0x8c8e('0x32'))['add'](0x3b,_0x8c8e('0x33'))[_0x8c8e('0x16')]();}_0x10a173={'start':_0x234620,'end':_0xa2bc05};break;default:_0x10a173[_0x8c8e('0x2e')]=_0x234620;break;}return _0x10a173;} \ No newline at end of file +var _0x4554=['<\x20?','>\x20?','$gte','$between','BETWEEN\x20?\x20AND\x20?','start','utcOffset','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith','and','replace','[$or]','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','buildExpression','DATE','operator','value','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','field','includes','$notIn','$eq','=\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','$lt'];(function(_0x27ad07,_0x2d3d47){var _0x3148b4=function(_0x3e8f75){while(--_0x3e8f75){_0x27ad07['push'](_0x27ad07['shift']());}};_0x3148b4(++_0x2d3d47);}(_0x4554,0xc9));var _0x4455=function(_0x2a0a1e,_0x2a1002){_0x2a0a1e=_0x2a0a1e-0x0;var _0x2c8970=_0x4554[_0x2a0a1e];return _0x2c8970;};'use strict';var _=require(_0x4455('0x0'));var moment=require('moment');exports[_0x4455('0x1')]=function(_0x4ef30c){var _0x1b784e={'conditions':[]};_0x1b784e[_0x4455('0x2')]=_[_0x4455('0x3')](_0x4ef30c,'[$or]')?'or':_0x4455('0x4');var _0x5cc3b1=_0x4ef30c[_0x4455('0x5')]('[$and]','')[_0x4455('0x5')](_0x4455('0x6'),'')[_0x4455('0x7')]('||');for(var _0x55f8af=0x0;_0x55f8af<_0x5cc3b1[_0x4455('0x8')];_0x55f8af++){var _0x4cc942=_0x5cc3b1[_0x55f8af][_0x4455('0x7')](':=');var _0x206c08=_0x4cc942[0x0];var _0x33e6ec=_0x4cc942[_0x4455('0x9')](0x1);_0x33e6ec[_0x4455('0xa')](function(_0x2c6fdc){var _0x373c96=_0x2c6fdc[_0x4455('0x7')]('[')[_0x4455('0xb')]();var _0x27120c=_0x2c6fdc[_0x4455('0xc')](/\[(.*?)\]/g);_0x27120c[_0x4455('0xa')](function(_0x41d043){var _0x39246e=_0x41d043['split']('[')[_0x4455('0xd')](function(_0x25f9a3){return _0x25f9a3[_0x4455('0xe')](']')>-0x1;})[_0x4455('0xf')](function(_0x384c9a){return _0x384c9a[_0x4455('0x7')](']')[0x0];})[0x0];_0x1b784e[_0x4455('0x10')]['push']({'field':_0x206c08,'operator':_0x373c96,'value':_0x39246e});});});}return _0x1b784e;};exports[_0x4455('0x11')]=function(_0x5c66b0,_0x16ef7d,_0x128a4b){var _0x5eeca4={};if(_0x16ef7d===_0x4455('0x12')){if(_0x128a4b['operator']==='$eq'){_0x128a4b[_0x4455('0x13')]='$between';_0x128a4b[_0x4455('0x14')]+=','+_0x128a4b[_0x4455('0x14')];}else if(_['includes']([_0x4455('0x15'),_0x4455('0x16')],_0x128a4b['operator'])){_0x128a4b[_0x4455('0x14')]=moment(_0x128a4b[_0x4455('0x14')])[_0x4455('0x17')](0x1,'days')[_0x4455('0x18')](_0x4455('0x19'));}}if(_0x128a4b[_0x4455('0x1a')]){_0x16ef7d=_0x128a4b[_0x4455('0x1a')];_0x5eeca4[_0x4455('0x1b')]='CAST('+_0x5c66b0+'.'+_0x128a4b['field']+'\x20AS\x20'+_0x128a4b[_0x4455('0x1a')]+')\x20'+parseOperator(_0x128a4b[_0x4455('0x13')]);}else{_0x5eeca4[_0x4455('0x1b')]=_0x5c66b0+'.'+_0x128a4b[_0x4455('0x1c')]+'\x20'+parseOperator(_0x128a4b[_0x4455('0x13')]);}if(_[_0x4455('0x1d')](['$ne',_0x4455('0x1e')],_0x128a4b['operator']))_0x5eeca4[_0x4455('0x1b')]='('+_0x5eeca4['text']+'\x20OR\x20'+_0x5c66b0+'.'+_0x128a4b[_0x4455('0x1c')]+'\x20IS\x20NULL)';_0x5eeca4[_0x4455('0x14')]=parseValue(_0x16ef7d,_0x128a4b['operator'],_0x128a4b[_0x4455('0x14')]);return _0x5eeca4;};function parseOperator(_0x13b156){var _0x474dd2;switch(_0x13b156){case'$in':_0x474dd2='IN\x20?';break;case _0x4455('0x1e'):_0x474dd2='NOT\x20IN\x20?';break;case _0x4455('0x1f'):_0x474dd2=_0x4455('0x20');break;case _0x4455('0x21'):_0x474dd2=_0x4455('0x22');break;case _0x4455('0x23'):case _0x4455('0x24'):case _0x4455('0x25'):_0x474dd2='LIKE\x20?';break;case _0x4455('0x26'):_0x474dd2=_0x4455('0x27');break;case _0x4455('0x15'):_0x474dd2=_0x4455('0x28');break;case _0x4455('0x16'):_0x474dd2='<=\x20?';break;case _0x4455('0x29'):_0x474dd2='>=\x20?';break;case _0x4455('0x2a'):_0x474dd2=_0x4455('0x2b');break;}return _0x474dd2;}function parseValue(_0x5e2acd,_0x4dbfa1,_0x549c69){var _0x54caeb={'start':undefined,'end':undefined};switch(_0x4dbfa1){case'$in':case _0x4455('0x1e'):_0x54caeb[_0x4455('0x2c')]=_0x549c69[_0x4455('0x7')](',');break;case _0x4455('0x23'):_0x54caeb[_0x4455('0x2c')]='%'+_0x549c69+'%';break;case _0x4455('0x24'):_0x54caeb[_0x4455('0x2c')]=_0x549c69+'%';break;case _0x4455('0x25'):_0x54caeb[_0x4455('0x2c')]='%'+_0x549c69;break;case _0x4455('0x2a'):var _0x18619a=_0x549c69[_0x4455('0x7')](',');var _0x549c69=_0x18619a['shift']();var _0x526ee4=_0x18619a['pop']();if(_0x5e2acd===_0x4455('0x12')){_0x549c69=moment(_0x549c69)[_0x4455('0x2d')](0x0,!![])['format']();_0x526ee4=moment(_0x526ee4)[_0x4455('0x2d')](0x0,!![])[_0x4455('0x17')](0x17,'hours')[_0x4455('0x17')](0x3b,_0x4455('0x2e'))['add'](0x3b,_0x4455('0x2f'))['format']();}_0x54caeb={'start':_0x549c69,'end':_0x526ee4};break;default:_0x54caeb[_0x4455('0x2c')]=_0x549c69;break;}return _0x54caeb;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 0638979..ccd97c1 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 _0xf9c3=['col','ASC','omit','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','forEach','push','join','$id','query','model','map','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','fields','split','filters','isEmpty','forOwn','find','DATE','$gte','format','utc','YYYY-MM-DD','subtract','name','uniqueid','isArray','limit','indexOf','priority','cast','unsigned','substr','DESC'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xf9c3,0xd5));var _0x3f9c=function(_0x193be1,_0x3e1726){_0x193be1=_0x193be1-0x0;var _0x4dda07=_0xf9c3[_0x193be1];return _0x4dda07;};'use strict';var _=require(_0x3f9c('0x0'));var sequelize=require(_0x3f9c('0x1'));var moment=require(_0x3f9c('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x65871d){var _0x4880e3=['ne'];try{var _0x3055ef=JSON[_0x3f9c('0x3')](_0x65871d);var _0x976936=Object[_0x3f9c('0x4')](_0x3055ef)[0x0];return _0x4880e3['includes'](_0x976936);}catch(_0x16fede){return![];}}function getOperatorValue(_0x3676e5){var _0x4ce5df=JSON['parse'](_0x3676e5);var _0x2e0251=Object[_0x3f9c('0x4')](_0x4ce5df)[0x0];var _0x10b436=_0x4ce5df[_0x2e0251];return{['$'+_0x2e0251]:_0x10b436};}exports[_0x3f9c('0x5')]=function(_0x18896b){var _0x49e12a=null;if(_0x18896b){_0x49e12a=_0x18896b[_0x3f9c('0x6')](',');}return _0x49e12a;};exports[_0x3f9c('0x7')]=function(_0x4239d3,_0xc97907){var _0x38e42={};if(!_[_0x3f9c('0x8')](_0x4239d3)){_[_0x3f9c('0x9')](_0x4239d3,function(_0x905196,_0x5073dd){try{if(_0xc97907){var _0x2f1009=_[_0x3f9c('0xa')](_0xc97907,{'name':_0x5073dd})||{};if(hasSequelizeOperator(_0x905196)){_0x38e42[_0x5073dd]=getOperatorValue(_0x905196);}else if(_0x2f1009['type']===_0x3f9c('0xb')&&_['isPlainObject'](_0x905196)){var _0x2c460c=JSON[_0x3f9c('0x3')](_0x905196);var _0x4a779a={'$gte':moment(moment(_0x2c460c[_0x3f9c('0xc')])[_0x3f9c('0xd')]('YYYY-MM-DD'))[_0x3f9c('0xe')]()[_0x3f9c('0xd')](),'$lte':moment(moment(_0x2c460c['$lte'])[_0x3f9c('0xd')](_0x3f9c('0xf')))[_0x3f9c('0xe')]()[_0x3f9c('0x10')](0x1,'s')['format']()};_0x38e42[_0x5073dd]=_0x4a779a;}else if(_0x2f1009[_0x3f9c('0x11')]===_0x3f9c('0x12')){_0x38e42[_0x5073dd]=_0x905196;}else{_0x38e42[_0x5073dd]=_['isArray'](_0x905196)?_0x905196:JSON['parse'](_0x905196);}}else{_0x38e42[_0x5073dd]=_[_0x3f9c('0x13')](_0x905196)?_0x905196:JSON['parse'](_0x905196);}}catch(_0x5d8363){_0x38e42[_0x5073dd]=_0x905196[_0x3f9c('0x6')](',');}});}return _0x38e42;};exports[_0x3f9c('0x14')]=function(_0x3e5532){_0x3e5532=parseInt(_0x3e5532,0xa);if(!_0x3e5532||_0x3e5532<0x0){_0x3e5532=LIMIT_VALUE;}return _0x3e5532;};exports['offset']=function(_0x561ce1){_0x561ce1=parseInt(_0x561ce1,0xa);if(!_0x561ce1||_0x561ce1<0x0){_0x561ce1=0x0;}return _0x561ce1;};exports['sort']=function(_0xe1c125){var _0x7385fd,_0x20f298=null;if(_0xe1c125){_0x7385fd=_0xe1c125['split'](',');_0x20f298=_['map'](_0x7385fd,function(_0xff853c){if(_0xff853c[_0x3f9c('0x15')]('-')===0x0){return[_0xff853c===_0x3f9c('0x16')?sequelize[_0x3f9c('0x17')](sequelize['col'](_0x3f9c('0x16')),_0x3f9c('0x18')):_0xff853c[_0x3f9c('0x19')](0x1),_0x3f9c('0x1a')];}else{return[_0xff853c===_0x3f9c('0x16')?sequelize[_0x3f9c('0x17')](sequelize[_0x3f9c('0x1b')](_0x3f9c('0x16')),_0x3f9c('0x18')):_0xff853c,_0x3f9c('0x1c')];}});}return _0x20f298;};exports[_0x3f9c('0x1d')]=function(_0x32c886,_0x37206d){if(_[_0x3f9c('0x8')](_0x32c886)){return _0x32c886;}if(_[_0x3f9c('0x13')](_0x32c886)){for(var _0x36168c=0x0;_0x36168c<_0x32c886['length'];_0x36168c+=0x1){_0x32c886[_0x36168c]=this[_0x3f9c('0x1d')](_0x32c886[_0x36168c],_0x37206d);}return _0x32c886;}if(!_[_0x3f9c('0x1e')](_0x32c886)){return _0x32c886;}if(_[_0x3f9c('0x1f')](_0x37206d)){_0x37206d=[_0x37206d];}if(!_[_0x3f9c('0x13')](_0x37206d)){return _0x32c886;}for(var _0x2518b5=0x0;_0x2518b5<_0x37206d['length'];_0x2518b5+=0x1){_[_0x3f9c('0x20')](_0x32c886,_0x37206d[_0x2518b5]);}for(var _0x291df9 in _0x32c886){if(_0x32c886['hasOwnProperty'](_0x291df9)){_0x32c886[_0x291df9]=this[_0x3f9c('0x1d')](_0x32c886[_0x291df9],_0x37206d);}}return _0x32c886;};exports[_0x3f9c('0x21')]=function(_0x1f9612){return _0x1f9612[_0x3f9c('0x22')](RegExp(_0x3f9c('0x23')))?!![]:![];};exports['isEmail']=function(_0x1260ac){return _0x1260ac[_0x3f9c('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x3f9c('0x24')]=function(_0x3d9a5b){var _0x2e7f05=[];_0x3d9a5b[_0x3f9c('0x6')](/[ ,]+/)[_0x3f9c('0x25')](function(_0x11e0a8){_0x11e0a8=_0x11e0a8['replace'](/([^:]")"+/g,'$1');_0x11e0a8='+'+_0x11e0a8+'*';if(_0x11e0a8['includes']('@'))_0x11e0a8='\x22'+_0x11e0a8+'\x22';_0x2e7f05[_0x3f9c('0x26')](_0x11e0a8);});return _0x2e7f05[_0x3f9c('0x27')]('\x20');};exports['getOptions']=function(_0x267f2c,_0x3be5d8,_0x5cf44a){var _0x22798a={},_0x36d053={};if(_0x3be5d8['query'][_0x3f9c('0x28')]){_0x3be5d8['query']['id']=_0x3be5d8[_0x3f9c('0x29')][_0x3f9c('0x28')];delete _0x3be5d8['query'][_0x3f9c('0x28')];}_0x22798a[_0x3f9c('0x2a')]=_[_0x3f9c('0x2b')](_0x267f2c,_0x3f9c('0x11'));_0x22798a[_0x3f9c('0x29')]=_[_0x3f9c('0x4')](_0x3be5d8[_0x3f9c('0x29')]);_0x22798a[_0x3f9c('0x7')]=_[_0x3f9c('0x2c')](_0x22798a['model'],_0x22798a[_0x3f9c('0x29')]);_0x36d053[_0x3f9c('0x2d')]=_[_0x3f9c('0x2c')](_0x22798a[_0x3f9c('0x2a')],this[_0x3f9c('0x5')](_0x3be5d8[_0x3f9c('0x29')][_0x3f9c('0x5')]));_0x36d053[_0x3f9c('0x2d')]=_0x36d053[_0x3f9c('0x2d')][_0x3f9c('0x2e')]?_0x36d053[_0x3f9c('0x2d')]:_0x22798a[_0x3f9c('0x2a')];if(!_0x3be5d8['query'][_0x3f9c('0x2f')](_0x3f9c('0x30'))){_0x36d053[_0x3f9c('0x14')]=this[_0x3f9c('0x14')](_0x3be5d8[_0x3f9c('0x29')]['limit']);_0x36d053[_0x3f9c('0x31')]=this[_0x3f9c('0x31')](_0x3be5d8[_0x3f9c('0x29')][_0x3f9c('0x31')]);}_0x36d053[_0x3f9c('0x32')]=this['sort'](_0x3be5d8[_0x3f9c('0x29')][_0x3f9c('0x33')]);_0x36d053[_0x3f9c('0x34')]=this[_0x3f9c('0x7')](_[_0x3f9c('0x35')](_0x3be5d8[_0x3f9c('0x29')],_0x22798a[_0x3f9c('0x7')]),_0x267f2c);if(_0x3be5d8['query'][_0x3f9c('0x36')]){_0x36d053[_0x3f9c('0x34')]=_[_0x3f9c('0x37')](_0x36d053[_0x3f9c('0x34')],{'$or':_[_0x3f9c('0x2b')](_0x267f2c,function(_0x1adfef){if(_0x1adfef[_0x3f9c('0x38')]!==_0x3f9c('0x39')){if(_0x5cf44a){return sequelize[_0x3f9c('0x34')](sequelize['fn'](_0x3f9c('0x3a'),sequelize[_0x3f9c('0x1b')](_0x1adfef[_0x3f9c('0x11')])),{'$like':sequelize['fn'](_0x3f9c('0x3a'),'%'+_0x3be5d8[_0x3f9c('0x29')][_0x3f9c('0x36')]+'%')});}else{var _0x5da012={};_0x5da012[_0x1adfef['name']]={'$like':'%'+_0x3be5d8[_0x3f9c('0x29')][_0x3f9c('0x36')]+'%'};return _0x5da012;}}})});}_0x36d053=_[_0x3f9c('0x37')]({},_0x36d053,_0x3be5d8[_0x3f9c('0x3b')]);return _0x36d053;}; \ No newline at end of file +var _0x978c=['DATE','isPlainObject','parse','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','offset','sort','map','indexOf','cast','unsigned','substr','DESC','priority','col','ASC','omit','length','isObject','isString','hasOwnProperty','isNumeric','match','isEmail','getFullTextValue','forEach','replace','join','getOptions','query','$id','model','intersection','attributes','fields','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','lower','options','lodash','moment','keys','includes','split','filters','isEmpty','forOwn','find','type'];(function(_0x7b3f64,_0x208c07){var _0x521802=function(_0x57de87){while(--_0x57de87){_0x7b3f64['push'](_0x7b3f64['shift']());}};_0x521802(++_0x208c07);}(_0x978c,0x127));var _0xc978=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x978c[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0xc978('0x0'));var sequelize=require('sequelize');var moment=require(_0xc978('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x439502){var _0x1ec437=['ne'];try{var _0x4e458e=JSON['parse'](_0x439502);var _0x3f36df=Object[_0xc978('0x2')](_0x4e458e)[0x0];return _0x1ec437[_0xc978('0x3')](_0x3f36df);}catch(_0x3722a6){return![];}}function getOperatorValue(_0x10151f){var _0x330867=JSON['parse'](_0x10151f);var _0x11797c=Object['keys'](_0x330867)[0x0];var _0x4146f1=_0x330867[_0x11797c];return{['$'+_0x11797c]:_0x4146f1};}exports['fields']=function(_0xd27a30){var _0x4fecf1=null;if(_0xd27a30){_0x4fecf1=_0xd27a30[_0xc978('0x4')](',');}return _0x4fecf1;};exports[_0xc978('0x5')]=function(_0x2af7a5,_0x2faa44){var _0x3fc40d={};if(!_[_0xc978('0x6')](_0x2af7a5)){_[_0xc978('0x7')](_0x2af7a5,function(_0x3633e8,_0x4ab78d){try{if(_0x2faa44){var _0x149ced=_[_0xc978('0x8')](_0x2faa44,{'name':_0x4ab78d})||{};if(hasSequelizeOperator(_0x3633e8)){_0x3fc40d[_0x4ab78d]=getOperatorValue(_0x3633e8);}else if(_0x149ced[_0xc978('0x9')]===_0xc978('0xa')&&_[_0xc978('0xb')](_0x3633e8)){var _0x39f704=JSON[_0xc978('0xc')](_0x3633e8);var _0x3942ef={'$gte':moment(moment(_0x39f704['$gte'])[_0xc978('0xd')](_0xc978('0xe')))[_0xc978('0xf')]()[_0xc978('0xd')](),'$lte':moment(moment(_0x39f704[_0xc978('0x10')])['format'](_0xc978('0xe')))[_0xc978('0xf')]()[_0xc978('0x11')](0x1,'s')[_0xc978('0xd')]()};_0x3fc40d[_0x4ab78d]=_0x3942ef;}else if(_0x149ced[_0xc978('0x12')]===_0xc978('0x13')){_0x3fc40d[_0x4ab78d]=_0x3633e8;}else{_0x3fc40d[_0x4ab78d]=_['isArray'](_0x3633e8)?_0x3633e8:JSON[_0xc978('0xc')](_0x3633e8);}}else{_0x3fc40d[_0x4ab78d]=_[_0xc978('0x14')](_0x3633e8)?_0x3633e8:JSON[_0xc978('0xc')](_0x3633e8);}}catch(_0x8cec16){_0x3fc40d[_0x4ab78d]=_0x3633e8[_0xc978('0x4')](',');}});}return _0x3fc40d;};exports['limit']=function(_0x519b38){_0x519b38=parseInt(_0x519b38,0xa);if(!_0x519b38||_0x519b38<0x0){_0x519b38=LIMIT_VALUE;}return _0x519b38;};exports[_0xc978('0x15')]=function(_0x55a9ee){_0x55a9ee=parseInt(_0x55a9ee,0xa);if(!_0x55a9ee||_0x55a9ee<0x0){_0x55a9ee=0x0;}return _0x55a9ee;};exports[_0xc978('0x16')]=function(_0x40d00b){var _0x129826,_0x4f4cf6=null;if(_0x40d00b){_0x129826=_0x40d00b[_0xc978('0x4')](',');_0x4f4cf6=_[_0xc978('0x17')](_0x129826,function(_0x5ec236){if(_0x5ec236[_0xc978('0x18')]('-')===0x0){return[_0x5ec236==='priority'?sequelize[_0xc978('0x19')](sequelize['col']('priority'),_0xc978('0x1a')):_0x5ec236[_0xc978('0x1b')](0x1),_0xc978('0x1c')];}else{return[_0x5ec236===_0xc978('0x1d')?sequelize[_0xc978('0x19')](sequelize[_0xc978('0x1e')](_0xc978('0x1d')),_0xc978('0x1a')):_0x5ec236,_0xc978('0x1f')];}});}return _0x4f4cf6;};exports[_0xc978('0x20')]=function(_0x3f1eb5,_0x5815c8){if(_['isEmpty'](_0x3f1eb5)){return _0x3f1eb5;}if(_['isArray'](_0x3f1eb5)){for(var _0x3d8486=0x0;_0x3d8486<_0x3f1eb5[_0xc978('0x21')];_0x3d8486+=0x1){_0x3f1eb5[_0x3d8486]=this[_0xc978('0x20')](_0x3f1eb5[_0x3d8486],_0x5815c8);}return _0x3f1eb5;}if(!_[_0xc978('0x22')](_0x3f1eb5)){return _0x3f1eb5;}if(_[_0xc978('0x23')](_0x5815c8)){_0x5815c8=[_0x5815c8];}if(!_[_0xc978('0x14')](_0x5815c8)){return _0x3f1eb5;}for(var _0x59bf36=0x0;_0x59bf36<_0x5815c8['length'];_0x59bf36+=0x1){_['unset'](_0x3f1eb5,_0x5815c8[_0x59bf36]);}for(var _0x2498e3 in _0x3f1eb5){if(_0x3f1eb5[_0xc978('0x24')](_0x2498e3)){_0x3f1eb5[_0x2498e3]=this['omit'](_0x3f1eb5[_0x2498e3],_0x5815c8);}}return _0x3f1eb5;};exports[_0xc978('0x25')]=function(_0x3c5944){return _0x3c5944[_0xc978('0x26')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0xc978('0x27')]=function(_0x128bd5){return _0x128bd5[_0xc978('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0xc978('0x28')]=function(_0x4df889){var _0x38c1c1=[];_0x4df889[_0xc978('0x4')](/[ ,]+/)[_0xc978('0x29')](function(_0x3292ab){_0x3292ab=_0x3292ab[_0xc978('0x2a')](/([^:]")"+/g,'$1');_0x3292ab='+'+_0x3292ab+'*';if(_0x3292ab[_0xc978('0x3')]('@'))_0x3292ab='\x22'+_0x3292ab+'\x22';_0x38c1c1['push'](_0x3292ab);});return _0x38c1c1[_0xc978('0x2b')]('\x20');};exports[_0xc978('0x2c')]=function(_0xf91869,_0x5bf373,_0x472407){var _0x2e6534={},_0x1d45b2={};if(_0x5bf373[_0xc978('0x2d')][_0xc978('0x2e')]){_0x5bf373[_0xc978('0x2d')]['id']=_0x5bf373[_0xc978('0x2d')][_0xc978('0x2e')];delete _0x5bf373[_0xc978('0x2d')][_0xc978('0x2e')];}_0x2e6534[_0xc978('0x2f')]=_[_0xc978('0x17')](_0xf91869,_0xc978('0x12'));_0x2e6534[_0xc978('0x2d')]=_['keys'](_0x5bf373[_0xc978('0x2d')]);_0x2e6534[_0xc978('0x5')]=_[_0xc978('0x30')](_0x2e6534[_0xc978('0x2f')],_0x2e6534[_0xc978('0x2d')]);_0x1d45b2[_0xc978('0x31')]=_[_0xc978('0x30')](_0x2e6534[_0xc978('0x2f')],this[_0xc978('0x32')](_0x5bf373[_0xc978('0x2d')][_0xc978('0x32')]));_0x1d45b2['attributes']=_0x1d45b2[_0xc978('0x31')][_0xc978('0x21')]?_0x1d45b2[_0xc978('0x31')]:_0x2e6534['model'];if(!_0x5bf373['query'][_0xc978('0x24')](_0xc978('0x33'))){_0x1d45b2['limit']=this[_0xc978('0x34')](_0x5bf373[_0xc978('0x2d')][_0xc978('0x34')]);_0x1d45b2[_0xc978('0x15')]=this[_0xc978('0x15')](_0x5bf373[_0xc978('0x2d')][_0xc978('0x15')]);}_0x1d45b2[_0xc978('0x35')]=this[_0xc978('0x16')](_0x5bf373[_0xc978('0x2d')]['sort']);_0x1d45b2[_0xc978('0x36')]=this[_0xc978('0x5')](_[_0xc978('0x37')](_0x5bf373[_0xc978('0x2d')],_0x2e6534[_0xc978('0x5')]),_0xf91869);if(_0x5bf373[_0xc978('0x2d')][_0xc978('0x38')]){_0x1d45b2[_0xc978('0x36')]=_[_0xc978('0x39')](_0x1d45b2[_0xc978('0x36')],{'$or':_[_0xc978('0x17')](_0xf91869,function(_0x3f9ade){if(_0x3f9ade[_0xc978('0x9')]!==_0xc978('0x3a')){if(_0x472407){return sequelize[_0xc978('0x36')](sequelize['fn']('lower',sequelize[_0xc978('0x1e')](_0x3f9ade['name'])),{'$like':sequelize['fn'](_0xc978('0x3b'),'%'+_0x5bf373[_0xc978('0x2d')][_0xc978('0x38')]+'%')});}else{var _0x15fefb={};_0x15fefb[_0x3f9ade[_0xc978('0x12')]]={'$like':'%'+_0x5bf373[_0xc978('0x2d')]['filter']+'%'};return _0x15fefb;}}})});}_0x1d45b2=_[_0xc978('0x39')]({},_0x1d45b2,_0x5bf373[_0xc978('0x3c')]);return _0x1d45b2;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 28ea974..4a24d83 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7dab=['urlencoded','50mb','express','serve-favicon','body-parser','method-override','errorhandler','path','passport','cors','./environment','../mysqldb','default','env','production','set','appPath','join','root','development','test','client','use','json\x20replacer','toISOString','split','static','get','views','/server/views','engine','html','ejs','renderFile'];(function(_0x21ccfc,_0x48834e){var _0x279454=function(_0x12b780){while(--_0x12b780){_0x21ccfc['push'](_0x21ccfc['shift']());}};_0x279454(++_0x48834e);}(_0x7dab,0x1bc));var _0xb7da=function(_0x5896c6,_0x47437f){_0x5896c6=_0x5896c6-0x0;var _0x3338b0=_0x7dab[_0x5896c6];return _0x3338b0;};'use strict';var express=require(_0xb7da('0x0'));var favicon=require(_0xb7da('0x1'));var bodyParser=require(_0xb7da('0x2'));var methodOverride=require(_0xb7da('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xb7da('0x4'));var path=require(_0xb7da('0x5'));var passport=require(_0xb7da('0x6'));var cors=require(_0xb7da('0x7'));var moment=require('moment');var config=require(_0xb7da('0x8'));var db=require(_0xb7da('0x9'))['db'];exports[_0xb7da('0xa')]=function(_0x402782){var _0x436e70=_0x402782['get'](_0xb7da('0xb'));if(_0x436e70===_0xb7da('0xc')){_0x402782[_0xb7da('0xd')](_0xb7da('0xe'),path[_0xb7da('0xf')](config[_0xb7da('0x10')],'public'));}if(_0x436e70===_0xb7da('0x11')||_0x436e70===_0xb7da('0x12')){_0x402782[_0xb7da('0xd')](_0xb7da('0xe'),path[_0xb7da('0xf')](config[_0xb7da('0x10')],_0xb7da('0x13')));_0x402782[_0xb7da('0x14')](errorHandler());}_0x402782[_0xb7da('0xd')](_0xb7da('0x15'),function(_0x2bcc5b,_0x44a873){if(this[_0x2bcc5b]instanceof Date){_0x44a873=this[_0x2bcc5b][_0xb7da('0x16')]()[_0xb7da('0x17')]('.')[0x0]+'Z';}return _0x44a873;});_0x402782[_0xb7da('0x14')](express[_0xb7da('0x18')](_0x402782[_0xb7da('0x19')](_0xb7da('0xe'))));_0x402782[_0xb7da('0xd')](_0xb7da('0x1a'),config[_0xb7da('0x10')]+_0xb7da('0x1b'));_0x402782[_0xb7da('0x1c')](_0xb7da('0x1d'),require(_0xb7da('0x1e'))[_0xb7da('0x1f')]);_0x402782[_0xb7da('0xd')]('view\x20engine','html');_0x402782[_0xb7da('0x14')](bodyParser[_0xb7da('0x20')]({'limit':_0xb7da('0x21'),'extended':!![]}));_0x402782[_0xb7da('0x14')](bodyParser['json']({'limit':_0xb7da('0x21')}));_0x402782[_0xb7da('0x14')](cors());_0x402782[_0xb7da('0x14')](methodOverride());_0x402782[_0xb7da('0x14')](cookieParser());_0x402782[_0xb7da('0x14')](passport['initialize']());}; \ No newline at end of file +var _0x8318=['public','development','test','join','use','json\x20replacer','toISOString','views','/server/views','engine','html','ejs','view\x20engine','urlencoded','50mb','json','express','serve-favicon','body-parser','cookie-parser','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','production','set','appPath','root'];(function(_0x5f5854,_0x5c7013){var _0x2261d0=function(_0x3e5913){while(--_0x3e5913){_0x5f5854['push'](_0x5f5854['shift']());}};_0x2261d0(++_0x5c7013);}(_0x8318,0x19c));var _0x8831=function(_0x4f04e8,_0x2623e2){_0x4f04e8=_0x4f04e8-0x0;var _0x58ea04=_0x8318[_0x4f04e8];return _0x58ea04;};'use strict';var express=require(_0x8831('0x0'));var favicon=require(_0x8831('0x1'));var bodyParser=require(_0x8831('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x8831('0x3'));var errorHandler=require(_0x8831('0x4'));var path=require(_0x8831('0x5'));var passport=require(_0x8831('0x6'));var cors=require(_0x8831('0x7'));var moment=require(_0x8831('0x8'));var config=require(_0x8831('0x9'));var db=require(_0x8831('0xa'))['db'];exports[_0x8831('0xb')]=function(_0x10b329){var _0x235a5b=_0x10b329[_0x8831('0xc')]('env');if(_0x235a5b===_0x8831('0xd')){_0x10b329[_0x8831('0xe')](_0x8831('0xf'),path['join'](config[_0x8831('0x10')],_0x8831('0x11')));}if(_0x235a5b===_0x8831('0x12')||_0x235a5b===_0x8831('0x13')){_0x10b329[_0x8831('0xe')](_0x8831('0xf'),path[_0x8831('0x14')](config[_0x8831('0x10')],'client'));_0x10b329[_0x8831('0x15')](errorHandler());}_0x10b329['set'](_0x8831('0x16'),function(_0x5efdf3,_0x76ddd3){if(this[_0x5efdf3]instanceof Date){_0x76ddd3=this[_0x5efdf3][_0x8831('0x17')]()['split']('.')[0x0]+'Z';}return _0x76ddd3;});_0x10b329[_0x8831('0x15')](express['static'](_0x10b329[_0x8831('0xc')](_0x8831('0xf'))));_0x10b329[_0x8831('0xe')](_0x8831('0x18'),config[_0x8831('0x10')]+_0x8831('0x19'));_0x10b329[_0x8831('0x1a')](_0x8831('0x1b'),require(_0x8831('0x1c'))['renderFile']);_0x10b329[_0x8831('0xe')](_0x8831('0x1d'),'html');_0x10b329['use'](bodyParser[_0x8831('0x1e')]({'limit':_0x8831('0x1f'),'extended':!![]}));_0x10b329[_0x8831('0x15')](bodyParser[_0x8831('0x20')]({'limit':_0x8831('0x1f')}));_0x10b329['use'](cors());_0x10b329[_0x8831('0x15')](methodOverride());_0x10b329[_0x8831('0x15')](cookieParser());_0x10b329[_0x8831('0x15')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index b0100c7..278e3f7 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 _0x1f1f=['map','model','join','createHash','digest','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','md5','substring','lodash','crypto','bimedia-machine-uuid','../environment','keys','length','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus'];(function(_0x567534,_0x19334c){var _0x538292=function(_0x1d69a3){while(--_0x1d69a3){_0x567534['push'](_0x567534['shift']());}};_0x538292(++_0x19334c);}(_0x1f1f,0x1de));var _0xf1f1=function(_0x1c9c24,_0x2a517b){_0x1c9c24=_0x1c9c24-0x0;var _0x349c69=_0x1f1f[_0x1c9c24];return _0x349c69;};'use strict';var _=require(_0xf1f1('0x0'));var os=require('os');var crypto=require(_0xf1f1('0x1'));var machine=require(_0xf1f1('0x2'));var exec=require('child_process')['execSync'];var config=require(_0xf1f1('0x3'));function getInterfaces(){var _0x3bc0d7=[];var _0x9d76c=os['networkInterfaces']();var _0x194cd6=_['orderBy'](_[_0xf1f1('0x4')](_0x9d76c));for(var _0x3c0dd2=0x0;_0x3c0dd2<_0x194cd6[_0xf1f1('0x5')];_0x3c0dd2++){var _0x3eac29=_0x9d76c[_0x194cd6[_0x3c0dd2]][_0xf1f1('0x6')](function(_0x2a6808){return _0x2a6808['family']===_0xf1f1('0x7')&&_0x2a6808[_0xf1f1('0x8')]===![];});_0x3bc0d7=_0x3bc0d7[_0xf1f1('0x9')](_0x3eac29);}return _0x3bc0d7;}function getFirstInterface(){var _0x3afbe6=_[_0xf1f1('0xa')](getInterfaces());return{'macAddress':_0x3afbe6&&_0x3afbe6[_0xf1f1('0xb')]?_0x3afbe6['mac']:_0xf1f1('0xc'),'ipAddress':_0x3afbe6&&_0x3afbe6[_0xf1f1('0xd')]?_0x3afbe6[_0xf1f1('0xd')]:_0xf1f1('0xe')};}exports[_0xf1f1('0xf')]=getFirstInterface;function getCPUhash(){var _0x3a883b=_['orderBy'](os[_0xf1f1('0x10')]()[_0xf1f1('0x11')](function(_0x1edd68){return _0x1edd68[_0xf1f1('0x12')];}))[_0xf1f1('0x13')](':');return crypto[_0xf1f1('0x14')]('md5')['update'](_0x3a883b)[_0xf1f1('0x15')]('hex');}exports['getUuid']=function(){var _0x1e25f4=os[_0xf1f1('0x16')]();var _0x1a7ee0=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x1a7ee0[_0xf1f1('0x17')](config[_0xf1f1('0x18')])){return config[_0xf1f1('0x18')];}else if(_0x1e25f4===_0xf1f1('0x19')){return exec(_0xf1f1('0x1a'),{'encoding':'utf8'})[_0xf1f1('0x1b')]('\x0d\x0a','');}else{var _0x1defe3=getFirstInterface();var _0x91d13e=getCPUhash();var _0x3b4eaa=_0x91d13e+'|'+os[_0xf1f1('0x1c')]()+'|'+_0x1defe3[_0xf1f1('0x1d')]+'|'+_0x1defe3[_0xf1f1('0x1e')];var _0x2ca608=crypto[_0xf1f1('0x14')](_0xf1f1('0x1f'))['update'](_0x3b4eaa)[_0xf1f1('0x15')]('hex');return _0x2ca608['substring'](0x0,0x8)+'-'+_0x2ca608[_0xf1f1('0x20')](0x8,0xc)+'-'+_0x2ca608[_0xf1f1('0x20')](0xc,0x10)+'-'+_0x2ca608['substring'](0x10,0x14)+'-'+_0x2ca608[_0xf1f1('0x20')](0x14);}}; \ No newline at end of file +var _0xb20c=['map','model','createHash','md5','update','digest','getUuid','licenseToken','dmidecode\x20--string\x20system-uuid','replace','hostname','macAddress','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xb20c,0x1bf));var _0xcb20=function(_0x127819,_0x30bd5b){_0x127819=_0x127819-0x0;var _0x229769=_0xb20c[_0x127819];return _0x229769;};'use strict';var _=require(_0xcb20('0x0'));var os=require('os');var crypto=require(_0xcb20('0x1'));var machine=require(_0xcb20('0x2'));var exec=require(_0xcb20('0x3'))[_0xcb20('0x4')];var config=require(_0xcb20('0x5'));function getInterfaces(){var _0x5e073d=[];var _0x2dd3e8=os[_0xcb20('0x6')]();var _0x5d13fa=_[_0xcb20('0x7')](_['keys'](_0x2dd3e8));for(var _0x1f8d21=0x0;_0x1f8d21<_0x5d13fa[_0xcb20('0x8')];_0x1f8d21++){var _0x7f876e=_0x2dd3e8[_0x5d13fa[_0x1f8d21]][_0xcb20('0x9')](function(_0x571b6d){return _0x571b6d[_0xcb20('0xa')]===_0xcb20('0xb')&&_0x571b6d[_0xcb20('0xc')]===![];});_0x5e073d=_0x5e073d[_0xcb20('0xd')](_0x7f876e);}return _0x5e073d;}function getFirstInterface(){var _0x44e824=_[_0xcb20('0xe')](getInterfaces());return{'macAddress':_0x44e824&&_0x44e824['mac']?_0x44e824[_0xcb20('0xf')]:_0xcb20('0x10'),'ipAddress':_0x44e824&&_0x44e824[_0xcb20('0x11')]?_0x44e824[_0xcb20('0x11')]:_0xcb20('0x12')};}exports[_0xcb20('0x13')]=getFirstInterface;function getCPUhash(){var _0x226231=_['orderBy'](os[_0xcb20('0x14')]()[_0xcb20('0x15')](function(_0x486c4a){return _0x486c4a[_0xcb20('0x16')];}))['join'](':');return crypto[_0xcb20('0x17')](_0xcb20('0x18'))[_0xcb20('0x19')](_0x226231)[_0xcb20('0x1a')]('hex');}exports[_0xcb20('0x1b')]=function(){var _0x570119=os['platform']();var _0x3c1bb0=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x3c1bb0['test'](config[_0xcb20('0x1c')])){return config[_0xcb20('0x1c')];}else if(_0x570119==='win32'){return exec(_0xcb20('0x1d'),{'encoding':'utf8'})[_0xcb20('0x1e')]('\x0d\x0a','');}else{var _0x31e05b=getFirstInterface();var _0x352c53=getCPUhash();var _0x3d2266=_0x352c53+'|'+os[_0xcb20('0x1f')]()+'|'+_0x31e05b[_0xcb20('0x20')]+'|'+_0x31e05b[_0xcb20('0x21')];var _0x183f15=crypto['createHash']('md5')[_0xcb20('0x19')](_0x3d2266)[_0xcb20('0x1a')](_0xcb20('0x22'));return _0x183f15[_0xcb20('0x23')](0x0,0x8)+'-'+_0x183f15[_0xcb20('0x23')](0x8,0xc)+'-'+_0x183f15[_0xcb20('0x23')](0xc,0x10)+'-'+_0x183f15[_0xcb20('0x23')](0x10,0x14)+'-'+_0x183f15[_0xcb20('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index a542f5b..051f59a 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 _0x8bd4=['decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','request-promise','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','license','format','exports','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm'];(function(_0x30270c,_0x54e186){var _0x17cc89=function(_0x2d31d5){while(--_0x2d31d5){_0x30270c['push'](_0x30270c['shift']());}};_0x17cc89(++_0x54e186);}(_0x8bd4,0xfc));var _0x48bd=function(_0x2aa76f,_0x28b25b){_0x2aa76f=_0x2aa76f-0x0;var _0x44c4f7=_0x8bd4[_0x2aa76f];return _0x44c4f7;};'use strict';var util=require(_0x48bd('0x0'));var moment=require('moment');var rp=require(_0x48bd('0x1'));var BPromise=require(_0x48bd('0x2'));var pkginfo=require(_0x48bd('0x3'))(module,_0x48bd('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0x48bd('0x5'));var hardware=require(_0x48bd('0x6'));var logger=require(_0x48bd('0x7'))(_0x48bd('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x219798){return new BPromise(function(_0x27d89c,_0x278b85){var _0x43a65a=util[_0x48bd('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x219798,module['exports'][_0x48bd('0x4')]);if(oldToken){_0x43a65a=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x219798,module[_0x48bd('0xa')][_0x48bd('0x4')],oldToken);}var _0x1643bd={'uri':_0x43a65a,'method':_0x48bd('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x1643bd)[_0x48bd('0xc')](function(_0x48cb24){_0x27d89c(_0x48cb24);})[_0x48bd('0xd')](function(_0x116022){_0x278b85(_0x116022);});});}function manageLicense(_0x540278,_0x2c1991){var _0x22d892=_0x2c1991[_0x48bd('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x22d892[_0x48bd('0xf')]!==_0x540278&&!_0x22d892[_0x48bd('0x10')]){oldToken=_0x22d892[_0x48bd('0xf')];}httpRequest(_0x540278)[_0x48bd('0xc')](function(_0x1f9b16){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1f9b16[_0x48bd('0x11')]){isOldTokenSent=![];if(!_0x22d892[_0x48bd('0x8')]&&_0x22d892['license']!=_0x1f9b16[_0x48bd('0x8')]||_0x22d892[_0x48bd('0x8')]&&_0x22d892[_0x48bd('0x10')]){logger[_0x48bd('0x12')](_0x48bd('0x13'));}if(_0x22d892['license']&&!_0x22d892['data2']&&_0x22d892[_0x48bd('0x8')]!=_0x1f9b16['license']){logger[_0x48bd('0x12')](_0x48bd('0x14'));}if(_0x22d892[_0x48bd('0x8')]&&!_0x22d892[_0x48bd('0x10')]&&_0x22d892[_0x48bd('0x8')]==_0x1f9b16['license']){return _0x2c1991;}return _0x2c1991[_0x48bd('0x15')]({'data1':_0x540278,'data2':null,'license':_0x1f9b16['license']});}else{if(_0x1f9b16['license']||_0x22d892[_0x48bd('0x8')]){if(!_0x22d892[_0x48bd('0x10')]){if(_0x22d892['data1']==_0x540278){GRAY_PERIOD_REASON='Disabled';logger[_0x48bd('0x12')](_0x48bd('0x16'));}else{GRAY_PERIOD_REASON=_0x48bd('0x17');logger[_0x48bd('0x12')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x22d892['data1'],_0x540278);}logger[_0x48bd('0x12')](_0x48bd('0x18'),GRAY_PERIOD_REASON[_0x48bd('0x19')](),moment()[_0x48bd('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x2c1991[_0x48bd('0x15')]({'data2':encryptor[_0x48bd('0x1a')](moment()[_0x48bd('0x9')](_0x48bd('0x1b')))});}else{if(moment()['diff'](encryptor[_0x48bd('0x1c')](_0x22d892[_0x48bd('0x10')]),_0x48bd('0x1d'))>DAYS){logger[_0x48bd('0x12')](_0x48bd('0x1e'),moment()[_0x48bd('0x9')](_0x48bd('0x1b')));isOldTokenSent=![];return _0x2c1991[_0x48bd('0x15')]({'data1':_0x540278,'data2':null,'license':null});}}}else{if(_0x22d892[_0x48bd('0xf')]!=_0x540278){logger[_0x48bd('0x12')](_0x48bd('0x1f'),_0x22d892['data1'],_0x540278);return _0x2c1991[_0x48bd('0x15')]({'data1':_0x540278,'data2':null,'license':null});}}}return _0x2c1991;})[_0x48bd('0xc')](function(_0x257a2f){_0x2c1991=_0x257a2f;})[_0x48bd('0xd')](function(_0x5c0667){logger[_0x48bd('0x20')](_0x5c0667[_0x48bd('0x21')]);})[_0x48bd('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0x48bd('0x23')](),_0x2c1991);},TIME);});}function defaultLicense(){var _0x584320=hardware[_0x48bd('0x23')]();if(_0x584320){return db[_0x48bd('0x24')][_0x48bd('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x584320}})['spread'](function(_0x481077,_0xcb0a01){logger['info'](_0x48bd('0x26'),_0x584320);manageLicense(_0x584320,_0x481077);})[_0x48bd('0xd')](function(_0x1a56b2){logger['error'](_0x1a56b2[_0x48bd('0x21')]);});}}exports[_0x48bd('0x27')]=defaultLicense; \ No newline at end of file +var _0x679b=['message','default','moment','request-promise','bluebird','pkginfo','../../mysqldb','./hardware','license','format','exports','version','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','License','SERVICE\x20LICENSE\x20STARTED\x20%s'];(function(_0x249311,_0x1dc5f1){var _0x2d7974=function(_0x351a7b){while(--_0x351a7b){_0x249311['push'](_0x249311['shift']());}};_0x2d7974(++_0x1dc5f1);}(_0x679b,0x16a));var _0xb679=function(_0x2a43fd,_0x21c10b){_0x2a43fd=_0x2a43fd-0x0;var _0x501195=_0x679b[_0x2a43fd];return _0x501195;};'use strict';var util=require('util');var moment=require(_0xb679('0x0'));var rp=require(_0xb679('0x1'));var BPromise=require(_0xb679('0x2'));var pkginfo=require(_0xb679('0x3'))(module,'version');var db=require(_0xb679('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xb679('0x5'));var logger=require('../logger')(_0xb679('0x6'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x8c8e46){return new BPromise(function(_0x13637c,_0x4d75a8){var _0x341662=util[_0xb679('0x7')]('%s/api/servers/%s/check?version=%s',HOST,_0x8c8e46,module[_0xb679('0x8')][_0xb679('0x9')]);if(oldToken){_0x341662=util[_0xb679('0x7')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x8c8e46,module[_0xb679('0x8')][_0xb679('0x9')],oldToken);}var _0x4f19f8={'uri':_0x341662,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x4f19f8)[_0xb679('0xa')](function(_0x25e073){_0x13637c(_0x25e073);})[_0xb679('0xb')](function(_0x40f2ae){_0x4d75a8(_0x40f2ae);});});}function manageLicense(_0x1cfc59,_0x10ab31){var _0xc219df=_0x10ab31[_0xb679('0xc')]({'plain':!![]});if(!isOldTokenSent&&_0xc219df[_0xb679('0xd')]!==_0x1cfc59&&!_0xc219df[_0xb679('0xe')]){oldToken=_0xc219df['data1'];}httpRequest(_0x1cfc59)['then'](function(_0x30231d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x30231d[_0xb679('0xf')]){isOldTokenSent=![];if(!_0xc219df['license']&&_0xc219df['license']!=_0x30231d[_0xb679('0x6')]||_0xc219df[_0xb679('0x6')]&&_0xc219df['data2']){logger[_0xb679('0x10')](_0xb679('0x11'));}if(_0xc219df[_0xb679('0x6')]&&!_0xc219df[_0xb679('0xe')]&&_0xc219df[_0xb679('0x6')]!=_0x30231d[_0xb679('0x6')]){logger[_0xb679('0x10')](_0xb679('0x12'));}if(_0xc219df['license']&&!_0xc219df[_0xb679('0xe')]&&_0xc219df[_0xb679('0x6')]==_0x30231d['license']){return _0x10ab31;}return _0x10ab31['update']({'data1':_0x1cfc59,'data2':null,'license':_0x30231d['license']});}else{if(_0x30231d['license']||_0xc219df['license']){if(!_0xc219df['data2']){if(_0xc219df[_0xb679('0xd')]==_0x1cfc59){GRAY_PERIOD_REASON='Disabled';logger[_0xb679('0x10')](_0xb679('0x13'));}else{GRAY_PERIOD_REASON=_0xb679('0x14');logger[_0xb679('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xc219df[_0xb679('0xd')],_0x1cfc59);}logger[_0xb679('0x10')](_0xb679('0x15'),GRAY_PERIOD_REASON[_0xb679('0x16')](),moment()[_0xb679('0x7')]('YYYY-MM-DD\x20HH:mm'));return _0x10ab31[_0xb679('0x17')]({'data2':encryptor[_0xb679('0x18')](moment()[_0xb679('0x7')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xb679('0x19')](encryptor[_0xb679('0x1a')](_0xc219df[_0xb679('0xe')]),_0xb679('0x1b'))>DAYS){logger[_0xb679('0x10')](_0xb679('0x1c'),moment()[_0xb679('0x7')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x10ab31[_0xb679('0x17')]({'data1':_0x1cfc59,'data2':null,'license':null});}}}else{if(_0xc219df[_0xb679('0xd')]!=_0x1cfc59){logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xc219df[_0xb679('0xd')],_0x1cfc59);return _0x10ab31[_0xb679('0x17')]({'data1':_0x1cfc59,'data2':null,'license':null});}}}return _0x10ab31;})[_0xb679('0xa')](function(_0x5e3da1){_0x10ab31=_0x5e3da1;})[_0xb679('0xb')](function(_0x4afcbb){logger[_0xb679('0x1d')](_0x4afcbb['message']);})[_0xb679('0x1e')](function(){setTimeout(function(){manageLicense(hardware[_0xb679('0x1f')](),_0x10ab31);},TIME);});}function defaultLicense(){var _0x493a2d=hardware[_0xb679('0x1f')]();if(_0x493a2d){return db[_0xb679('0x20')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x493a2d}})['spread'](function(_0x645d82,_0x2bfca8){logger[_0xb679('0x10')](_0xb679('0x21'),_0x493a2d);manageLicense(_0x493a2d,_0x645d82);})[_0xb679('0xb')](function(_0x40cc){logger['error'](_0x40cc[_0xb679('0x22')]);});}}exports[_0xb679('0x23')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 9a804b7..6bc8ee6 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 _0x4157=['Demo\x20license','getUuid','Breaking\x20license','find','defaults','then','catch','uuid','data1','license','data2','split','decryptString','%s:%s:%s','parse','demo','machineUuid','gray','deadline','grayReason','changed','message','User','findAll','role','sequelize','COUNT','col','count','admin','telephone','users','forEach','user','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z'];(function(_0x22ccc0,_0x914457){var _0xe2af6a=function(_0x55aa01){while(--_0x55aa01){_0x22ccc0['push'](_0x22ccc0['shift']());}};_0xe2af6a(++_0x914457);}(_0x4157,0xcb));var _0x7415=function(_0x50c1e3,_0x531184){_0x50c1e3=_0x50c1e3-0x0;var _0x5bf70c=_0x4157[_0x50c1e3];return _0x5bf70c;};'use strict';var util=require(_0x7415('0x0'));var _=require(_0x7415('0x1'));var moment=require(_0x7415('0x2'));var BPromise=require('bluebird');var hardware=require(_0x7415('0x3'));var encryptor=require(_0x7415('0x4'));var db=require(_0x7415('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7415('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x7415('0x7'),'machineUuid':hardware[_0x7415('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7415('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x7415('0x9'),'machineUuid':hardware[_0x7415('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x15a72b){return new BPromise(function(_0x1007b8,_0x359cfe){return db['License'][_0x7415('0xa')](_[_0x7415('0xb')](_0x15a72b,{'raw':!![],'where':{'id':0x1}}))[_0x7415('0xc')](function(_0x46fb47){return checkLicense(_0x46fb47,null);})['then'](function(_0x4409fc){_0x1007b8(_0x4409fc);return;})[_0x7415('0xd')](function(_0x38e678){_0x359cfe(_0x38e678);});});}function checkLicense(_0x902615,_0x151ffd){if(!_0x902615){demoLicense[_0x7415('0xe')]=_0x902615[_0x7415('0xf')];return demoLicense;}try{var _0x1346eb=_0x151ffd||_0x902615[_0x7415('0x10')];if(_['isEmpty'](_0x1346eb)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x3246ad=_0x902615['data1'];var _0x1e52f4=_0x902615[_0x7415('0x11')];var _0x46619d=_0x3246ad[_0x7415('0x12')]('-')[0x4];var _0x53d6f7=_0x3246ad[_0x7415('0x12')]('-')[0x0];var _0x144713=encryptor[_0x7415('0x13')](_0x1346eb,util['format'](_0x7415('0x14'),_0x46619d,_0x3246ad,_0x53d6f7));var _0x1354d3=JSON[_0x7415('0x15')](_0x144713);_0x1354d3[_0x7415('0x16')]=![];_0x1354d3[_0x7415('0xe')]=_0x3246ad;_0x1354d3[_0x7415('0x17')]=hardware[_0x7415('0x8')]();if(_0x1e52f4){var _0x189ff1=encryptor[_0x7415('0x13')](_0x1e52f4);_0x1354d3[_0x7415('0x18')]=_0x189ff1;_0x1354d3[_0x7415('0x19')]=moment(_0x189ff1)['add'](0x7,'days')['format']();_0x1354d3[_0x7415('0x1a')]=_0x1354d3[_0x7415('0xe')]!=_0x1354d3[_0x7415('0x17')]?_0x7415('0x1b'):'disabled';}return _0x1354d3;}catch(_0x10e09d){breakingLicense[_0x7415('0xe')]=_0x902615['data1'];breakingLicense['message']=_0x10e09d[_0x7415('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1432f9,_0x281022){getLicense()[_0x7415('0xc')](function(_0x10b39c){return db[_0x7415('0x1d')][_0x7415('0x1e')]({'attributes':[_0x7415('0x1f'),[db[_0x7415('0x20')]['fn'](_0x7415('0x21'),db[_0x7415('0x20')][_0x7415('0x22')](_0x7415('0x1f'))),_0x7415('0x23')]],'group':_0x7415('0x1f'),'where':{'role':{'$or':[_0x7415('0x24'),'user',_0x7415('0x25')]}},'raw':!![]})[_0x7415('0xc')](function(_0xcf10dc){var _0x3636bf={'user':_0x10b39c[_0x7415('0x26')]||0x0,'telephone':_0x10b39c['telephones']||0x0};_0xcf10dc[_0x7415('0x27')](function(_0x55c1ad){var _0x3a325d=_0x55c1ad['role']===_0x7415('0x24')?'user':_0x55c1ad[_0x7415('0x1f')];_0x3636bf[_0x3a325d]-=_0x55c1ad['count'];if(_0x3636bf[_0x3a325d]<0x0)_0x3636bf[_0x3a325d]=0x0;});_0x1432f9(_0x3636bf);return;});})[_0x7415('0xd')](function(_0x49f7f8){_0x281022(_0x49f7f8);});});}function checkUserLimits(_0x3863e8){return new BPromise(function(_0x4940fc,_0x470c8a){getLimits()['then'](function(_0x14c9c3){var _0x340790=_['pick'](_['countBy'](_0x3863e8,_0x7415('0x1f')),[_0x7415('0x24'),'user','telephone']);var _0x296a41=(_0x340790[_0x7415('0x24')]||0x0)+(_0x340790['user']||0x0);var _0x58d8fa=_0x340790[_0x7415('0x25')]||0x0;if(_0x296a41>_0x14c9c3[_0x7415('0x28')])return _0x470c8a('License\x20limit\x20reached\x20for\x20users');if(_0x58d8fa>_0x14c9c3[_0x7415('0x25')])return _0x470c8a('License\x20limit\x20reached\x20for\x20telephones');return _0x4940fc();})[_0x7415('0xd')](function(_0x489045){_0x470c8a(_0x489045);});});}module[_0x7415('0x29')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x02be=['License\x20key\x20value\x20not\x20found','split','decryptString','format','%s:%s:%s','parse','demo','gray','deadline','add','days','grayReason','changed','message','User','role','sequelize','COUNT','col','admin','user','telephone','users','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','util','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','isEmpty'];(function(_0x12f5d3,_0x20c880){var _0x1ad28c=function(_0x2dd1b1){while(--_0x2dd1b1){_0x12f5d3['push'](_0x12f5d3['shift']());}};_0x1ad28c(++_0x20c880);}(_0x02be,0x14f));var _0xe02b=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x02be[_0x599e60];return _0x468e19;};'use strict';var util=require(_0xe02b('0x0'));var _=require('lodash');var moment=require(_0xe02b('0x1'));var BPromise=require(_0xe02b('0x2'));var hardware=require('./hardware');var encryptor=require(_0xe02b('0x3'));var db=require(_0xe02b('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe02b('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xe02b('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe02b('0x7'),'machineUuid':hardware[_0xe02b('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x12e25b){return new BPromise(function(_0x14d0c9,_0x56f594){return db[_0xe02b('0x8')][_0xe02b('0x9')](_[_0xe02b('0xa')](_0x12e25b,{'raw':!![],'where':{'id':0x1}}))[_0xe02b('0xb')](function(_0x5bff65){return checkLicense(_0x5bff65,null);})['then'](function(_0xdaaabf){_0x14d0c9(_0xdaaabf);return;})[_0xe02b('0xc')](function(_0xbfcbde){_0x56f594(_0xbfcbde);});});}function checkLicense(_0x42147a,_0x589111){if(!_0x42147a){demoLicense[_0xe02b('0xd')]=_0x42147a[_0xe02b('0xe')];return demoLicense;}try{var _0x431a71=_0x589111||_0x42147a[_0xe02b('0xf')];if(_[_0xe02b('0x10')](_0x431a71)){throw new Error(_0xe02b('0x11'));}var _0x4e1002=_0x42147a[_0xe02b('0xe')];var _0x7ba54c=_0x42147a['data2'];var _0x3cdf30=_0x4e1002[_0xe02b('0x12')]('-')[0x4];var _0x29bfcc=_0x4e1002[_0xe02b('0x12')]('-')[0x0];var _0x40c913=encryptor[_0xe02b('0x13')](_0x431a71,util[_0xe02b('0x14')](_0xe02b('0x15'),_0x3cdf30,_0x4e1002,_0x29bfcc));var _0x46fc38=JSON[_0xe02b('0x16')](_0x40c913);_0x46fc38[_0xe02b('0x17')]=![];_0x46fc38[_0xe02b('0xd')]=_0x4e1002;_0x46fc38['machineUuid']=hardware['getUuid']();if(_0x7ba54c){var _0x37be8a=encryptor[_0xe02b('0x13')](_0x7ba54c);_0x46fc38[_0xe02b('0x18')]=_0x37be8a;_0x46fc38[_0xe02b('0x19')]=moment(_0x37be8a)[_0xe02b('0x1a')](0x7,_0xe02b('0x1b'))[_0xe02b('0x14')]();_0x46fc38[_0xe02b('0x1c')]=_0x46fc38['uuid']!=_0x46fc38['machineUuid']?_0xe02b('0x1d'):'disabled';}return _0x46fc38;}catch(_0x2918bb){breakingLicense[_0xe02b('0xd')]=_0x42147a[_0xe02b('0xe')];breakingLicense[_0xe02b('0x1e')]=_0x2918bb['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5cc3b9,_0x21d581){getLicense()[_0xe02b('0xb')](function(_0x315aeb){return db[_0xe02b('0x1f')]['findAll']({'attributes':[_0xe02b('0x20'),[db[_0xe02b('0x21')]['fn'](_0xe02b('0x22'),db['sequelize'][_0xe02b('0x23')]('role')),'count']],'group':_0xe02b('0x20'),'where':{'role':{'$or':[_0xe02b('0x24'),_0xe02b('0x25'),_0xe02b('0x26')]}},'raw':!![]})[_0xe02b('0xb')](function(_0x326566){var _0x12a556={'user':_0x315aeb[_0xe02b('0x27')]||0x0,'telephone':_0x315aeb['telephones']||0x0};_0x326566[_0xe02b('0x28')](function(_0x145a92){var _0x14dd28=_0x145a92['role']===_0xe02b('0x24')?'user':_0x145a92['role'];_0x12a556[_0x14dd28]-=_0x145a92['count'];if(_0x12a556[_0x14dd28]<0x0)_0x12a556[_0x14dd28]=0x0;});_0x5cc3b9(_0x12a556);return;});})['catch'](function(_0x57803f){_0x21d581(_0x57803f);});});}function checkUserLimits(_0x272d0d){return new BPromise(function(_0x1230f3,_0x5a021){getLimits()[_0xe02b('0xb')](function(_0x4ac3e0){var _0x53fc4a=_[_0xe02b('0x29')](_[_0xe02b('0x2a')](_0x272d0d,_0xe02b('0x20')),['admin',_0xe02b('0x25'),'telephone']);var _0x511110=(_0x53fc4a[_0xe02b('0x24')]||0x0)+(_0x53fc4a[_0xe02b('0x25')]||0x0);var _0x2e0866=_0x53fc4a[_0xe02b('0x26')]||0x0;if(_0x511110>_0x4ac3e0[_0xe02b('0x25')])return _0x5a021(_0xe02b('0x2b'));if(_0x2e0866>_0x4ac3e0[_0xe02b('0x26')])return _0x5a021('License\x20limit\x20reached\x20for\x20telephones');return _0x1230f3();})['catch'](function(_0x51d044){_0x5a021(_0x51d044);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 85e72c8..77ed6af 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 _0xf2e3=['myappanuglar-secret','app-id','secret','exports'];(function(_0x55bf0c,_0x1f1ee9){var _0x47ae52=function(_0x59abea){while(--_0x59abea){_0x55bf0c['push'](_0x55bf0c['shift']());}};_0x47ae52(++_0x1f1ee9);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0xf2e3[_0x556927];return _0x5f1235;};'use strict';module[_0x3f2e('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x3f2e('0x1'),'GOOGLE_ID':_0x3f2e('0x2'),'GOOGLE_SECRET':_0x3f2e('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x77e6=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x1fa80f,_0x2e60df){var _0x3341dc=function(_0x3af1f0){while(--_0x3af1f0){_0x1fa80f['push'](_0x1fa80f['shift']());}};_0x3341dc(++_0x2e60df);}(_0x77e6,0x1a6));var _0x677e=function(_0x556cad,_0x244bac){_0x556cad=_0x556cad-0x0;var _0xb15298=_0x77e6[_0x556cad];return _0xb15298;};'use strict';module[_0x677e('0x0')]={'DOMAIN':_0x677e('0x1'),'SESSION_SECRET':_0x677e('0x2'),'GOOGLE_ID':_0x677e('0x3'),'GOOGLE_SECRET':_0x677e('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 30b6b54..f484a66 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd197=['Console','env','debugLevel','moment','winston','util','path','INFO','/var','log','xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','File','%s-%s','error','info'];(function(_0x1742c1,_0x312dd5){var _0x2dd97a=function(_0x12c58f){while(--_0x12c58f){_0x1742c1['push'](_0x1742c1['shift']());}};_0x2dd97a(++_0x312dd5);}(_0xd197,0x18b));var _0x7d19=function(_0x41e1e7,_0x203f99){_0x41e1e7=_0x41e1e7-0x0;var _0x45b1bf=_0xd197[_0x41e1e7];return _0x45b1bf;};'use strict';var moment=require(_0x7d19('0x0'));var winston=require(_0x7d19('0x1'));var util=require(_0x7d19('0x2'));var path=require(_0x7d19('0x3'));var debugLevel=_0x7d19('0x4');function filename(_0x1941aa,_0x40e6ae){return path['join'](_0x7d19('0x5'),_0x7d19('0x6'),_0x7d19('0x7'),util[_0x7d19('0x8')](_0x7d19('0x9'),_0x1941aa,_0x40e6ae));}function formatter(_0xdaba93,_0x353b72){_0x353b72['message']=_0x353b72[_0x7d19('0xa')][_0x7d19('0xb')](/@@{/g,_0x7d19('0xc'))[_0x7d19('0xb')](/}@@/g,_0x7d19('0xd'))['replace'](/@{/g,'{{')[_0x7d19('0xb')](/}@/g,'}}');return util[_0x7d19('0x8')](_0x7d19('0xe'),moment()[_0x7d19('0x8')](_0x7d19('0xf')),_0x353b72[_0x7d19('0x10')][_0x7d19('0x11')](),_0xdaba93,_0x353b72[_0x7d19('0xa')]);}module[_0x7d19('0x12')]=function(_0x12a5e5){return new winston[(_0x7d19('0x13'))]({'transports':[new winston[(_0x7d19('0x14'))][(_0x7d19('0x15'))]({'name':util['format'](_0x7d19('0x16'),_0x12a5e5,'error'),'filename':filename(_0x12a5e5,_0x7d19('0x17')),'level':_0x7d19('0x17'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xe82434){return formatter(_0x12a5e5,_0xe82434);}}),new winston[(_0x7d19('0x14'))][(_0x7d19('0x15'))]({'name':util['format'](_0x7d19('0x16'),_0x12a5e5,_0x7d19('0x18')),'filename':filename(_0x12a5e5,'info'),'level':_0x7d19('0x18'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xc38963){return formatter(_0x12a5e5,_0xc38963);}}),new winston['transports'][(_0x7d19('0x19'))]({'level':process[_0x7d19('0x1a')][_0x7d19('0x1b')]||debugLevel,'json':![],'formatter':function(_0x2d8251){return formatter(_0x12a5e5,_0x2d8251);}})]});}; \ No newline at end of file +var _0xf7f4=['format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','exports','%s-%s','error','transports','File','info','Console','env','debugLevel','moment','winston','util','path','INFO','/var','log','xcally'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0xf7f4,0x94));var _0x4f7f=function(_0x423a4e,_0x54fb95){_0x423a4e=_0x423a4e-0x0;var _0x8dcce4=_0xf7f4[_0x423a4e];return _0x8dcce4;};'use strict';var moment=require(_0x4f7f('0x0'));var winston=require(_0x4f7f('0x1'));var util=require(_0x4f7f('0x2'));var path=require(_0x4f7f('0x3'));var debugLevel=_0x4f7f('0x4');function filename(_0x4d6291,_0x5ade57){return path['join'](_0x4f7f('0x5'),_0x4f7f('0x6'),_0x4f7f('0x7'),util[_0x4f7f('0x8')](_0x4f7f('0x9'),_0x4d6291,_0x5ade57));}function formatter(_0x16a0b0,_0x4548c7){_0x4548c7['message']=_0x4548c7[_0x4f7f('0xa')][_0x4f7f('0xb')](/@@{/g,_0x4f7f('0xc'))['replace'](/}@@/g,_0x4f7f('0xd'))[_0x4f7f('0xb')](/@{/g,'{{')[_0x4f7f('0xb')](/}@/g,'}}');return util[_0x4f7f('0x8')](_0x4f7f('0xe'),moment()[_0x4f7f('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),_0x4548c7[_0x4f7f('0xf')][_0x4f7f('0x10')](),_0x16a0b0,_0x4548c7[_0x4f7f('0xa')]);}module[_0x4f7f('0x11')]=function(_0x48543a){return new winston['Logger']({'transports':[new winston['transports']['File']({'name':util[_0x4f7f('0x8')](_0x4f7f('0x12'),_0x48543a,_0x4f7f('0x13')),'filename':filename(_0x48543a,'error'),'level':_0x4f7f('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x37532e){return formatter(_0x48543a,_0x37532e);}}),new winston[(_0x4f7f('0x14'))][(_0x4f7f('0x15'))]({'name':util[_0x4f7f('0x8')](_0x4f7f('0x12'),_0x48543a,_0x4f7f('0x16')),'filename':filename(_0x48543a,_0x4f7f('0x16')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xca85a5){return formatter(_0x48543a,_0xca85a5);}}),new winston[(_0x4f7f('0x14'))][(_0x4f7f('0x17'))]({'level':process[_0x4f7f('0x18')][_0x4f7f('0x19')]||debugLevel,'json':![],'formatter':function(_0x422c5a){return formatter(_0x48543a,_0x422c5a);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 08acf2a..81502f3 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 _0xa794=['routing','xdr','exports','path','join','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email'];(function(_0x3f14aa,_0xab1c70){var _0x9da866=function(_0x47359b){while(--_0x47359b){_0x3f14aa['push'](_0x3f14aa['shift']());}};_0x9da866(++_0xab1c70);}(_0xa794,0x8f));var _0x4a79=function(_0x3a9f36,_0x1a9a8d){_0x3a9f36=_0x3a9f36-0x0;var _0x5eb6ba=_0xa794[_0x3a9f36];return _0x5eb6ba;};'use strict';var path=require(_0x4a79('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x4a79('0x1')](__dirname,'../../services/express/index.js')},{'name':_0x4a79('0x2'),'script':path[_0x4a79('0x1')](__dirname,_0x4a79('0x3'))},{'name':_0x4a79('0x4'),'script':path[_0x4a79('0x1')](__dirname,_0x4a79('0x5'))},{'name':_0x4a79('0x6'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0x4a79('0x7'),'script':path[_0x4a79('0x1')](__dirname,'../../services/routing/index.js')},{'name':_0x4a79('0x8'),'script':path[_0x4a79('0x1')](__dirname,'../../services/xdr/index.js')}]};module[_0x4a79('0x9')]=config; \ No newline at end of file +var _0x295e=['ami','agi','join','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','express'];(function(_0x170781,_0x47eea0){var _0x391f28=function(_0x59586a){while(--_0x59586a){_0x170781['push'](_0x170781['shift']());}};_0x391f28(++_0x47eea0);}(_0x295e,0xf1));var _0xe295=function(_0x22c9a5,_0x58c7ce){_0x22c9a5=_0x22c9a5-0x0;var _0x3d6bdf=_0x295e[_0x22c9a5];return _0x3d6bdf;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xe295('0x0'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0xe295('0x1'),'script':path['join'](__dirname,'../../services/ami/index.js')},{'name':_0xe295('0x2'),'script':path[_0xe295('0x3')](__dirname,_0xe295('0x4'))},{'name':'email','script':path[_0xe295('0x3')](__dirname,_0xe295('0x5'))},{'name':_0xe295('0x6'),'script':path[_0xe295('0x3')](__dirname,_0xe295('0x7'))},{'name':_0xe295('0x8'),'script':path[_0xe295('0x3')](__dirname,_0xe295('0x9'))}]};module[_0xe295('0xa')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 5fddb14..5323057 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 _0x0f9f=['bluebird','./config','connect','connected','start','then','stop','restart','disconnect','list','describe','delete','dump','saved','pm2'];(function(_0x5e010a,_0x5724d1){var _0xf22b2e=function(_0x27af4e){while(--_0x27af4e){_0x5e010a['push'](_0x5e010a['shift']());}};_0xf22b2e(++_0x5724d1);}(_0x0f9f,0x167));var _0xf0f9=function(_0x46f098,_0x5f5063){_0x46f098=_0x46f098-0x0;var _0x1eef1d=_0x0f9f[_0x46f098];return _0x1eef1d;};'use strict';var pm2=require(_0xf0f9('0x0'));var BPromise=require(_0xf0f9('0x1'));var config=require(_0xf0f9('0x2'));function connect(){return new BPromise(function(_0x4f4d2f,_0x4d29e0){return pm2[_0xf0f9('0x3')](function(_0x56806f){if(_0x56806f){return _0x4d29e0(_0x56806f);}return _0x4f4d2f(_0xf0f9('0x4'));});});};exports[_0xf0f9('0x5')]=function(_0x10a0d1){return connect()[_0xf0f9('0x6')](function(){return new BPromise(function(_0x3a259a,_0xe001a4){return pm2['start'](_0x10a0d1,function(_0x46678f,_0x420945){if(_0x46678f){return _0xe001a4(_0x46678f);}pm2['disconnect']();return _0x3a259a(_0x420945);});});});};exports[_0xf0f9('0x7')]=function(_0x4f4c2e){return connect()['then'](function(){return new BPromise(function(_0x1444e0,_0x218d48){return pm2['stop'](_0x4f4c2e,function(_0x3a57f8,_0x4953bc){if(_0x3a57f8){return _0x218d48(_0x3a57f8);}pm2['disconnect']();return _0x1444e0(_0x4953bc);});});});};exports['restart']=function(_0x13a4df){return connect()[_0xf0f9('0x6')](function(){return new BPromise(function(_0x2aeb7a,_0x42c5c6){return pm2[_0xf0f9('0x8')](_0x13a4df,function(_0x1883ca,_0x606f91){if(_0x1883ca){return _0x42c5c6(_0x1883ca);}pm2[_0xf0f9('0x9')]();return _0x2aeb7a(_0x606f91);});});});};exports[_0xf0f9('0xa')]=function(){return connect()[_0xf0f9('0x6')](function(){return new BPromise(function(_0x593837,_0x5c786a){return pm2['list'](function(_0x14db88,_0x138033){if(_0x14db88){return _0x5c786a(_0x14db88);}pm2[_0xf0f9('0x9')]();return _0x593837(_0x138033);});});});};exports[_0xf0f9('0xb')]=function(_0x496cd7){return connect()[_0xf0f9('0x6')](function(){return new BPromise(function(_0x26bbec,_0x493d0b){return pm2[_0xf0f9('0xb')](_0x496cd7,function(_0x3de51a,_0x3ff4ac){if(_0x3de51a){return _0x493d0b(_0x3de51a);}pm2[_0xf0f9('0x9')]();return _0x26bbec(_0x3ff4ac);});});});};exports[_0xf0f9('0xc')]=function(_0x555b14){return connect()['then'](function(){return new BPromise(function(_0xf0857f,_0x14604f){return pm2['delete'](_0x555b14,function(_0x3ebb35,_0x43e36f){if(_0x3ebb35){return _0x14604f(_0x3ebb35);}pm2[_0xf0f9('0x9')]();return _0xf0857f(_0x43e36f);});});});};exports[_0xf0f9('0xd')]=function(){return connect()['then'](function(){return new BPromise(function(_0x58e0e9,_0x144481){return pm2[_0xf0f9('0xd')](function(_0xa4024c){if(_0xa4024c){return _0x144481(_0xa4024c);}return _0x58e0e9(_0xf0f9('0xe'));});});});}; \ No newline at end of file +var _0xbf48=['stop','then','disconnect','restart','list','delete','dump','saved','bluebird','connect','connected','start'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xbf48,0x1d0));var _0x8bf4=function(_0x326998,_0x32c7e3){_0x326998=_0x326998-0x0;var _0x42e242=_0xbf48[_0x326998];return _0x42e242;};'use strict';var pm2=require('pm2');var BPromise=require(_0x8bf4('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x6b372d,_0x13ad58){return pm2[_0x8bf4('0x1')](function(_0xed04d0){if(_0xed04d0){return _0x13ad58(_0xed04d0);}return _0x6b372d(_0x8bf4('0x2'));});});};exports[_0x8bf4('0x3')]=function(_0x3242fc){return connect()['then'](function(){return new BPromise(function(_0x48ab42,_0x38d168){return pm2['start'](_0x3242fc,function(_0x2941bc,_0x1dfcf9){if(_0x2941bc){return _0x38d168(_0x2941bc);}pm2['disconnect']();return _0x48ab42(_0x1dfcf9);});});});};exports[_0x8bf4('0x4')]=function(_0x48cf8e){return connect()[_0x8bf4('0x5')](function(){return new BPromise(function(_0x3e0e54,_0x19f099){return pm2[_0x8bf4('0x4')](_0x48cf8e,function(_0x3fc3d0,_0x203b7b){if(_0x3fc3d0){return _0x19f099(_0x3fc3d0);}pm2[_0x8bf4('0x6')]();return _0x3e0e54(_0x203b7b);});});});};exports['restart']=function(_0x9f97bf){return connect()[_0x8bf4('0x5')](function(){return new BPromise(function(_0x5499bc,_0x32180a){return pm2[_0x8bf4('0x7')](_0x9f97bf,function(_0x1aa105,_0x46722c){if(_0x1aa105){return _0x32180a(_0x1aa105);}pm2[_0x8bf4('0x6')]();return _0x5499bc(_0x46722c);});});});};exports['list']=function(){return connect()[_0x8bf4('0x5')](function(){return new BPromise(function(_0x44b3f,_0x365968){return pm2[_0x8bf4('0x8')](function(_0x442286,_0x4447d9){if(_0x442286){return _0x365968(_0x442286);}pm2['disconnect']();return _0x44b3f(_0x4447d9);});});});};exports['describe']=function(_0x18b3fe){return connect()[_0x8bf4('0x5')](function(){return new BPromise(function(_0x12b93f,_0x2b7184){return pm2['describe'](_0x18b3fe,function(_0xe1558b,_0x12f1e0){if(_0xe1558b){return _0x2b7184(_0xe1558b);}pm2['disconnect']();return _0x12b93f(_0x12f1e0);});});});};exports[_0x8bf4('0x9')]=function(_0x524d38){return connect()[_0x8bf4('0x5')](function(){return new BPromise(function(_0xe87883,_0x593b77){return pm2['delete'](_0x524d38,function(_0x29e3c8,_0x272bc5){if(_0x29e3c8){return _0x593b77(_0x29e3c8);}pm2[_0x8bf4('0x6')]();return _0xe87883(_0x272bc5);});});});};exports[_0x8bf4('0xa')]=function(){return connect()[_0x8bf4('0x5')](function(){return new BPromise(function(_0x39aa74,_0x5d4535){return pm2[_0x8bf4('0xa')](function(_0x39efdf){if(_0x39efdf){return _0x5d4535(_0x39efdf);}return _0x39aa74(_0x8bf4('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 429cb88..ceda16b 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 _0x7d30=['ChatInteraction','lastMsgAt','subtract','minutes','length','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','Setting','find','then','chatTimeout'];(function(_0x5c864c,_0x552f20){var _0x3fe3fd=function(_0x3f3cf7){while(--_0x3f3cf7){_0x5c864c['push'](_0x5c864c['shift']());}};_0x3fe3fd(++_0x552f20);}(_0x7d30,0xb9));var _0x07d3=function(_0x3d5726,_0x3bc5ec){_0x3d5726=_0x3d5726-0x0;var _0x129975=_0x7d30[_0x3d5726];return _0x129975;};'use strict';var _=require('lodash');var moment=require(_0x07d3('0x0'));var Redis=require(_0x07d3('0x1'));var util=require(_0x07d3('0x2'));var config=require(_0x07d3('0x3'));var db=require(_0x07d3('0x4'))['db'];var logger=require(_0x07d3('0x5'))(_0x07d3('0x6'));config[_0x07d3('0x7')]=_['defaults'](config[_0x07d3('0x7')],{'host':_0x07d3('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x5590bc=0x0;var _0x522bd9=[];return db[_0x07d3('0x9')][_0x07d3('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x07d3('0xb')](function(_0x1a80e5){_0x5590bc=_0x1a80e5[_0x07d3('0xc')];if(_0x5590bc){return db[_0x07d3('0xd')]['findAll']({'raw':!![],'attributes':['id',_0x07d3('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x07d3('0xf')](_0x1a80e5[_0x07d3('0xc')],_0x07d3('0x10'))}}});}else{return[];}})['then'](function(_0x4dffe2){if(_0x4dffe2&&_0x4dffe2[_0x07d3('0x11')]){_0x522bd9=_[_0x07d3('0x12')](_0x4dffe2||[],'id');logger[_0x07d3('0x13')]('[CHAT]\x20Interactions\x20to\x20close:',_0x522bd9[_0x07d3('0x14')]());return db[_0x07d3('0xd')][_0x07d3('0x15')]({'closeReason':_0x07d3('0x16'),'disposition':_0x07d3('0x17'),'closed':!![],'closedAt':moment()[_0x07d3('0x18')](_0x07d3('0x19'))},{'where':{'id':_0x522bd9}});}})['then'](function(){if(_0x522bd9&&_0x522bd9['length']){logger[_0x07d3('0x13')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x522bd9[_0x07d3('0x14')]());for(var _0x551a42=0x0;_0x551a42<_0x522bd9[_0x07d3('0x11')];_0x551a42++){io[_0x07d3('0x1a')](_0x07d3('0x1b'),{'id':_0x522bd9[_0x551a42],'closed':!![]});}}})[_0x07d3('0x1c')](function(_0x9f91){logger[_0x07d3('0x1d')](_0x07d3('0x1e'),_0x9f91?util[_0x07d3('0x1f')](_0x9f91,{'showHidden':![],'depth':null}):'');});}exports[_0x07d3('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xef40=['inspect','start','lodash','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','info','[CHAT]\x20Interactions\x20to\x20close:','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','length','emit','catch','error'];(function(_0x81f727,_0x281765){var _0x1aff90=function(_0x1a8c2d){while(--_0x1a8c2d){_0x81f727['push'](_0x81f727['shift']());}};_0x1aff90(++_0x281765);}(_0xef40,0x14c));var _0x0ef4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xef40[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x0ef4('0x0'));var moment=require('moment');var Redis=require(_0x0ef4('0x1'));var util=require('util');var config=require(_0x0ef4('0x2'));var db=require(_0x0ef4('0x3'))['db'];var logger=require(_0x0ef4('0x4'))(_0x0ef4('0x5'));config[_0x0ef4('0x6')]=_[_0x0ef4('0x7')](config[_0x0ef4('0x6')],{'host':_0x0ef4('0x8'),'port':0x18eb});var io=require(_0x0ef4('0x9'))(new Redis(config[_0x0ef4('0x6')]));function closeInteractions(){var _0x491382=0x0;var _0x10b1ac=[];return db[_0x0ef4('0xa')][_0x0ef4('0xb')]({'raw':!![],'attributes':['id',_0x0ef4('0xc')],'where':{'id':0x1}})[_0x0ef4('0xd')](function(_0x1d8ea8){_0x491382=_0x1d8ea8[_0x0ef4('0xc')];if(_0x491382){return db[_0x0ef4('0xe')][_0x0ef4('0xf')]({'raw':!![],'attributes':['id',_0x0ef4('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x0ef4('0x11')](_0x1d8ea8[_0x0ef4('0xc')],_0x0ef4('0x12'))}}});}else{return[];}})['then'](function(_0x477210){if(_0x477210&&_0x477210['length']){_0x10b1ac=_['map'](_0x477210||[],'id');logger[_0x0ef4('0x13')](_0x0ef4('0x14'),_0x10b1ac[_0x0ef4('0x15')]());return db['ChatInteraction']['update']({'closeReason':_0x0ef4('0x16'),'disposition':_0x0ef4('0x17'),'closed':!![],'closedAt':moment()[_0x0ef4('0x18')](_0x0ef4('0x19'))},{'where':{'id':_0x10b1ac}});}})[_0x0ef4('0xd')](function(){if(_0x10b1ac&&_0x10b1ac['length']){logger[_0x0ef4('0x13')](_0x0ef4('0x1a'),_0x10b1ac[_0x0ef4('0x15')]());for(var _0x1b2d19=0x0;_0x1b2d19<_0x10b1ac[_0x0ef4('0x1b')];_0x1b2d19++){io[_0x0ef4('0x1c')]('chatInteraction:update',{'id':_0x10b1ac[_0x1b2d19],'closed':!![]});}}})[_0x0ef4('0x1d')](function(_0x242609){logger[_0x0ef4('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x242609?util[_0x0ef4('0x1f')](_0x242609,{'showHidden':![],'depth':null}):'');});}exports[_0x0ef4('0x20')]=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 a16e4b9..7b71518 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 _0x8825=['intersection','length','stop','deleteJob','delete\x20cron','toRun','my\x20id','isBetween','add','start','add\x20cron','cron','exists','stop\x20cron','active','startAt','update\x20cron','catch','run','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','user','pass','format','\x22%s\x22\x20<%s>','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','savename','extname','zip','existsSync','status','Sent','message','attachments','text','stringify','sendIfEmpty','request','SendMail','email\x20sent','error\x20mail','error','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','then','keys','jobs','toString','keyBy','difference'];(function(_0x45ef62,_0x43654b){var _0x57232d=function(_0x58dc14){while(--_0x58dc14){_0x45ef62['push'](_0x45ef62['shift']());}};_0x57232d(++_0x43654b);}(_0x8825,0x11e));var _0x5882=function(_0x17d3d7,_0x4d341f){_0x17d3d7=_0x17d3d7-0x0;var _0x25d70e=_0x8825[_0x17d3d7];return _0x25d70e;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x5882('0x0'));var moment=require(_0x5882('0x1'));var CronJobManager=require(_0x5882('0x2'));var jayson=require(_0x5882('0x3'));var BPromise=require(_0x5882('0x4'));var logger=require(_0x5882('0x5'))(_0x5882('0x6'));var db=require(_0x5882('0x7'))['db'];var analyticCustomReportController=require(_0x5882('0x8'));var analyticDefaultReportController=require(_0x5882('0x9'));var client=jayson[_0x5882('0xa')][_0x5882('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2aa890,_0x6d74d1){return function(){logger[_0x5882('0xc')](_0x5882('0xd'),_0x2aa890['email']);var _0x46f16b=!![];var _0x127659={'tls':{'rejectUnauthorized':![]}};if(_0x2aa890[_0x5882('0xe')][_0x5882('0xf')]['service']){_0x127659[_0x5882('0x10')]=_0x2aa890[_0x5882('0xe')]['Smtp'][_0x5882('0x10')];}else{_0x127659[_0x5882('0x11')]=_0x2aa890['MailAccount'][_0x5882('0xf')][_0x5882('0x11')];_0x127659[_0x5882('0x12')]=_0x2aa890[_0x5882('0xe')][_0x5882('0xf')][_0x5882('0x12')];_0x127659[_0x5882('0x13')]=_0x2aa890['MailAccount'][_0x5882('0xf')][_0x5882('0x13')];}if(_0x2aa890[_0x5882('0xe')][_0x5882('0xf')]['authentication']){_0x127659['auth']={'user':_0x2aa890[_0x5882('0xe')]['Smtp'][_0x5882('0x14')],'pass':_0x2aa890['MailAccount']['Smtp'][_0x5882('0x15')]};}var _0x19db39={'account':_0x127659,'message':{'from':util[_0x5882('0x16')](_0x5882('0x17'),_0x2aa890[_0x5882('0xe')][_0x5882('0x18')],_0x2aa890[_0x5882('0xe')][_0x5882('0x19')]||_0x2aa890['MailAccount'][_0x5882('0xf')][_0x5882('0x14')]),'to':_0x2aa890[_0x5882('0x19')],'cc':_0x2aa890['cc'],'bcc':_0x2aa890[_0x5882('0x1a')],'subject':util[_0x5882('0x16')](_0x5882('0x1b'),_0x6d74d1['name'],_0x2aa890[_0x5882('0x1c')],_0x2aa890[_0x5882('0x1d')])}};var _0x4dd6a4=path[_0x5882('0x1e')](__dirname,_0x5882('0x1f'));var _0x1efbd8=_0x6d74d1['savename'];var _0x2aa517=util['format'](_0x5882('0x20'),path['basename'](_0x6d74d1[_0x5882('0x21')],path[_0x5882('0x22')](_0x6d74d1[_0x5882('0x21')])),_0x5882('0x23'));var _0x5c2ae5=path[_0x5882('0x1e')](_0x4dd6a4,_0x1efbd8);var _0x1777f1=path[_0x5882('0x1e')](_0x4dd6a4,_0x2aa517);if(fs[_0x5882('0x24')](_0x5c2ae5)){_0x6d74d1[_0x5882('0x25')]=_0x5882('0x26');_0x19db39[_0x5882('0x27')][_0x5882('0x28')]=[{'filename':_0x1efbd8,'path':_0x5c2ae5}];_0x19db39[_0x5882('0x27')][_0x5882('0x29')]=util[_0x5882('0x16')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x5882('0x2a')](_0x6d74d1,null,0x2));}else if(fs['existsSync'](_0x1777f1)){_0x6d74d1[_0x5882('0x25')]=_0x5882('0x26');_0x19db39[_0x5882('0x27')]['attachments']=[{'filename':_0x2aa517,'path':_0x1777f1}];}else{_0x19db39[_0x5882('0x27')][_0x5882('0x29')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x2aa890[_0x5882('0x2b')]){_0x46f16b=![];logger[_0x5882('0xc')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x46f16b){return client[_0x5882('0x2c')](_0x5882('0x2d'),_0x19db39)['then'](function(_0x5794b9){if(_0x5794b9['error']){return logger['error']('error\x20mail',JSON[_0x5882('0x2a')](_0x5794b9));}return logger['info'](_0x5882('0x2e'));})['catch'](function(_0x315639){return logger['error'](_0x5882('0x2f'),JSON[_0x5882('0x2a')](_0x315639));});}};}function handleError(){return function(_0xa9ed0c){return logger[_0x5882('0x30')](JSON[_0x5882('0x2a')](_0xa9ed0c));};}function handleResult(_0x5b20d1){return function(_0x294b1b){logger['info'](_0x5882('0x31'),JSON[_0x5882('0x2a')](_0x294b1b));if(_0x5b20d1[_0x5882('0xe')]&&_0x5b20d1[_0x5882('0xe')]['Smtp']&&!_['isNil'](_0x5b20d1[_0x5882('0x19')])){setTimeout(handleSendEmail(_0x5b20d1,_0x294b1b),0x3c*0x3e8);}};}function handleJob(_0x3a2d2b){return function(){try{if(_[_0x5882('0x32')](_0x3a2d2b['subtractNumber'])){return logger[_0x5882('0xc')](_0x5882('0x33'));}if(_['isNil'](_0x3a2d2b[_0x5882('0x1d')])){return logger[_0x5882('0xc')](_0x5882('0x34'));}var _0x2f3269={'startDate':moment()[_0x5882('0x35')](_0x3a2d2b['subtractNumber'],_0x3a2d2b[_0x5882('0x1d')])[_0x5882('0x16')](_0x5882('0x36')),'endDate':moment()[_0x5882('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x3a2d2b[_0x5882('0x37')],'name':_0x3a2d2b['name']};if(!_[_0x5882('0x32')](_0x3a2d2b[_0x5882('0x38')])){logger[_0x5882('0xc')]('exec\x20defaul\x20report\x20id:%s',_0x3a2d2b[_0x5882('0x38')]);return analyticDefaultReportController[_0x5882('0x39')]({'id':_0x3a2d2b[_0x5882('0x38')]},_0x2f3269)['then'](handleResult(_0x3a2d2b))['catch'](handleError());}if(!_[_0x5882('0x32')](_0x3a2d2b[_0x5882('0x3a')])){logger[_0x5882('0xc')](_0x5882('0x3b'),_0x3a2d2b[_0x5882('0x3a')]);return analyticCustomReportController['runReport']({'id':_0x3a2d2b[_0x5882('0x3a')]},_0x2f3269)['then'](handleResult(_0x3a2d2b))['catch'](handleError());}}catch(_0x2edd78){logger['error'](JSON[_0x5882('0x2a')](_0x2edd78));}return logger[_0x5882('0xc')](_0x5882('0x3c'));};}function getJobs(_0x58130b){var _0x2351d7={};if(_0x58130b){_0x2351d7['id']=_0x58130b;}return db[_0x5882('0x3d')][_0x5882('0x3e')]({'where':_0x2351d7,'include':[{'model':db[_0x5882('0xe')],'attributes':['id','name','email'],'include':[{'model':db[_0x5882('0x3f')],'as':_0x5882('0xf')}]}]})[_0x5882('0x40')](function(_0x520677){var _0x5c7768=_[_0x5882('0x41')](manager[_0x5882('0x42')]);var _0x11516d=_['map'](_0x520677,function(_0x102398){return _0x102398['id'][_0x5882('0x43')]();});var _0x596a80=_[_0x5882('0x44')](_0x520677,function(_0x547ad3){return _0x547ad3['id']['toString']();});var _0x5c4683=_0x58130b?_0x11516d:_[_0x5882('0x45')](_0x11516d,_0x5c7768);var _0x3bbf5c=_[_0x5882('0x46')](_0x11516d,_0x5c7768);var _0x5073d6=_[_0x5882('0x45')](_0x5c7768,_0x11516d);var _0x15ca9e;var _0x3a7e43;for(_0x15ca9e=0x0;_0x15ca9e<_0x5073d6[_0x5882('0x47')]&&!_0x58130b;_0x15ca9e+=0x1){_0x3a7e43=_0x5073d6[_0x15ca9e][_0x5882('0x43')]();if(manager['exists'](_0x3a7e43)){manager[_0x5882('0x48')](_0x3a7e43);manager[_0x5882('0x49')](_0x3a7e43);logger['info'](_0x5882('0x4a'),_0x3a7e43);}}logger['info'](_0x5882('0x4b'),JSON[_0x5882('0x2a')](_0x5c4683));for(_0x15ca9e=0x0;_0x15ca9e<_0x5c4683[_0x5882('0x47')];_0x15ca9e+=0x1){_0x3a7e43=_0x5c4683[_0x15ca9e]['toString']();logger['info']('index',_0x3a7e43);if(_0x58130b){logger[_0x5882('0xc')](_0x5882('0x4c'),_0x58130b);logger[_0x5882('0xc')](JSON[_0x5882('0x2a')](_0x596a80[_0x3a7e43]));BPromise['resolve']()[_0x5882('0x40')](handleJob(_0x596a80[_0x3a7e43]));logger[_0x5882('0xc')]('run\x20job',_0x596a80[_0x3a7e43][_0x5882('0x18')],_0x596a80[_0x3a7e43]['cron']);}else if(_0x596a80[_0x3a7e43]['cron']&&_0x596a80[_0x3a7e43]['active']&&moment()[_0x5882('0x4d')](_0x596a80[_0x3a7e43]['startAt'],_0x596a80[_0x3a7e43]['endAt'])){manager[_0x5882('0x4e')](_0x3a7e43,_0x596a80[_0x3a7e43]['cron'],handleJob(_0x596a80[_0x3a7e43]));manager[_0x5882('0x4f')](_0x3a7e43);logger['info'](_0x5882('0x50'),_0x596a80[_0x3a7e43][_0x5882('0x18')],_0x596a80[_0x3a7e43][_0x5882('0x51')]);}else if(manager[_0x5882('0x52')](_0x3a7e43)){manager[_0x5882('0x48')](_0x3a7e43);manager[_0x5882('0x49')](_0x3a7e43);logger[_0x5882('0xc')](_0x5882('0x53'),_0x596a80[_0x3a7e43]['name'],_0x596a80[_0x3a7e43][_0x5882('0x51')]);}}for(_0x15ca9e=0x0,_0x3a7e43;_0x15ca9e<_0x3bbf5c[_0x5882('0x47')]&&!_0x58130b;_0x15ca9e+=0x1){_0x3a7e43=_0x3bbf5c[_0x15ca9e][_0x5882('0x43')]();if(manager[_0x5882('0x52')](_0x3a7e43)){if(_0x596a80[_0x3a7e43]['cron']&&_0x596a80[_0x3a7e43][_0x5882('0x54')]&&moment()[_0x5882('0x4d')](_0x596a80[_0x3a7e43][_0x5882('0x55')],_0x596a80[_0x3a7e43]['endAt'])){manager['update'](_0x3a7e43,_0x596a80[_0x3a7e43][_0x5882('0x51')],handleJob(_0x596a80[_0x3a7e43]));logger[_0x5882('0xc')](_0x5882('0x56'),_0x596a80[_0x3a7e43][_0x5882('0x18')],_0x596a80[_0x3a7e43][_0x5882('0x51')]);}else{manager[_0x5882('0x48')](_0x3a7e43);manager[_0x5882('0x49')](_0x3a7e43);logger[_0x5882('0xc')]('stop\x20cron',_0x596a80[_0x3a7e43][_0x5882('0x18')],_0x596a80[_0x3a7e43]['cron']);}}}})[_0x5882('0x57')](function(_0x4ce46){logger['error'](JSON['stringify'](_0x4ce46));});}exports[_0x5882('0x58')]=function(_0x3b0120){return getJobs(_0x3b0120);};exports[_0x5882('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x391e=['subtractUnit','join','../../files/reports','savename','basename','extname','zip','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','email\x20sent','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','catch','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','toString','keyBy','difference','intersection','length','exists','stop','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','deleteJob','stop\x20cron','update','run','path','lodash','moment','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port','secure','auth','user','\x22%s\x22\x20<%s>','name','bcc','format','subtractNumber'];(function(_0x18c45a,_0x3a4808){var _0x146194=function(_0x16ab6b){while(--_0x16ab6b){_0x18c45a['push'](_0x18c45a['shift']());}};_0x146194(++_0x3a4808);}(_0x391e,0xfb));var _0xe391=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x391e[_0x45d55e];return _0x29812a;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xe391('0x0'));var _=require(_0xe391('0x1'));var moment=require(_0xe391('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xe391('0x3'));var BPromise=require(_0xe391('0x4'));var logger=require('../logger')(_0xe391('0x5'));var db=require(_0xe391('0x6'))['db'];var analyticCustomReportController=require(_0xe391('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xe391('0x8')][_0xe391('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x3ab9d5,_0x107a61){return function(){logger['info'](_0xe391('0xa'),_0x3ab9d5[_0xe391('0xb')]);var _0x15cfd7=!![];var _0x3422a6={'tls':{'rejectUnauthorized':![]}};if(_0x3ab9d5[_0xe391('0xc')]['Smtp']['service']){_0x3422a6[_0xe391('0xd')]=_0x3ab9d5['MailAccount'][_0xe391('0xe')][_0xe391('0xd')];}else{_0x3422a6[_0xe391('0xf')]=_0x3ab9d5[_0xe391('0xc')][_0xe391('0xe')]['host'];_0x3422a6[_0xe391('0x10')]=_0x3ab9d5[_0xe391('0xc')]['Smtp'][_0xe391('0x10')];_0x3422a6['secure']=_0x3ab9d5[_0xe391('0xc')]['Smtp'][_0xe391('0x11')];}if(_0x3ab9d5[_0xe391('0xc')][_0xe391('0xe')]['authentication']){_0x3422a6[_0xe391('0x12')]={'user':_0x3ab9d5[_0xe391('0xc')][_0xe391('0xe')][_0xe391('0x13')],'pass':_0x3ab9d5[_0xe391('0xc')][_0xe391('0xe')]['pass']};}var _0x146a0f={'account':_0x3422a6,'message':{'from':util['format'](_0xe391('0x14'),_0x3ab9d5[_0xe391('0xc')][_0xe391('0x15')],_0x3ab9d5[_0xe391('0xc')][_0xe391('0xb')]||_0x3ab9d5[_0xe391('0xc')]['Smtp'][_0xe391('0x13')]),'to':_0x3ab9d5[_0xe391('0xb')],'cc':_0x3ab9d5['cc'],'bcc':_0x3ab9d5[_0xe391('0x16')],'subject':util[_0xe391('0x17')]('Report\x20%s\x20last\x20%s\x20%s',_0x107a61[_0xe391('0x15')],_0x3ab9d5[_0xe391('0x18')],_0x3ab9d5[_0xe391('0x19')])}};var _0x361dcd=path[_0xe391('0x1a')](__dirname,_0xe391('0x1b'));var _0x50f69e=_0x107a61[_0xe391('0x1c')];var _0x3984db=util[_0xe391('0x17')]('%s.%s',path[_0xe391('0x1d')](_0x107a61[_0xe391('0x1c')],path[_0xe391('0x1e')](_0x107a61[_0xe391('0x1c')])),_0xe391('0x1f'));var _0x431d4d=path[_0xe391('0x1a')](_0x361dcd,_0x50f69e);var _0x522b57=path[_0xe391('0x1a')](_0x361dcd,_0x3984db);if(fs[_0xe391('0x20')](_0x431d4d)){_0x107a61[_0xe391('0x21')]=_0xe391('0x22');_0x146a0f['message'][_0xe391('0x23')]=[{'filename':_0x50f69e,'path':_0x431d4d}];_0x146a0f[_0xe391('0x24')][_0xe391('0x25')]=util[_0xe391('0x17')](_0xe391('0x26'),JSON[_0xe391('0x27')](_0x107a61,null,0x2));}else if(fs[_0xe391('0x20')](_0x522b57)){_0x107a61['status']=_0xe391('0x22');_0x146a0f[_0xe391('0x24')][_0xe391('0x23')]=[{'filename':_0x3984db,'path':_0x522b57}];}else{_0x146a0f['message'][_0xe391('0x25')]=_0xe391('0x28');if(!_0x3ab9d5[_0xe391('0x29')]){_0x15cfd7=![];logger[_0xe391('0x2a')](_0xe391('0x2b'));}}if(_0x15cfd7){return client['request'](_0xe391('0x2c'),_0x146a0f)[_0xe391('0x2d')](function(_0xe614a7){if(_0xe614a7[_0xe391('0x2e')]){return logger[_0xe391('0x2e')](_0xe391('0x2f'),JSON[_0xe391('0x27')](_0xe614a7));}return logger[_0xe391('0x2a')](_0xe391('0x30'));})['catch'](function(_0x4ee2bf){return logger[_0xe391('0x2e')](_0xe391('0x2f'),JSON[_0xe391('0x27')](_0x4ee2bf));});}};}function handleError(){return function(_0x31e57d){return logger[_0xe391('0x2e')](JSON[_0xe391('0x27')](_0x31e57d));};}function handleResult(_0x1c649e){return function(_0x3d0ee6){logger[_0xe391('0x2a')]('data',JSON[_0xe391('0x27')](_0x3d0ee6));if(_0x1c649e[_0xe391('0xc')]&&_0x1c649e['MailAccount'][_0xe391('0xe')]&&!_[_0xe391('0x31')](_0x1c649e[_0xe391('0xb')])){setTimeout(handleSendEmail(_0x1c649e,_0x3d0ee6),0x3c*0x3e8);}};}function handleJob(_0x1dc052){return function(){try{if(_[_0xe391('0x31')](_0x1dc052[_0xe391('0x18')])){return logger['info'](_0xe391('0x32'));}if(_[_0xe391('0x31')](_0x1dc052[_0xe391('0x19')])){return logger[_0xe391('0x2a')](_0xe391('0x33'));}var _0x45ad73={'startDate':moment()[_0xe391('0x34')](_0x1dc052[_0xe391('0x18')],_0x1dc052[_0xe391('0x19')])[_0xe391('0x17')](_0xe391('0x35')),'endDate':moment()['format'](_0xe391('0x35')),'type':_0xe391('0x36'),'output':_0x1dc052[_0xe391('0x37')],'name':_0x1dc052[_0xe391('0x15')]};if(!_[_0xe391('0x31')](_0x1dc052[_0xe391('0x38')])){logger[_0xe391('0x2a')](_0xe391('0x39'),_0x1dc052['DefaultReportId']);return analyticDefaultReportController[_0xe391('0x3a')]({'id':_0x1dc052[_0xe391('0x38')]},_0x45ad73)[_0xe391('0x2d')](handleResult(_0x1dc052))['catch'](handleError());}if(!_['isNil'](_0x1dc052[_0xe391('0x3b')])){logger[_0xe391('0x2a')](_0xe391('0x3c'),_0x1dc052['CustomReportId']);return analyticCustomReportController[_0xe391('0x3a')]({'id':_0x1dc052[_0xe391('0x3b')]},_0x45ad73)['then'](handleResult(_0x1dc052))[_0xe391('0x3d')](handleError());}}catch(_0x5bb704){logger['error'](JSON['stringify'](_0x5bb704));}return logger[_0xe391('0x2a')](_0xe391('0x3e'));};}function getJobs(_0x437ad5){var _0x4130c3={};if(_0x437ad5){_0x4130c3['id']=_0x437ad5;}return db[_0xe391('0x3f')][_0xe391('0x40')]({'where':_0x4130c3,'include':[{'model':db[_0xe391('0xc')],'attributes':['id','name',_0xe391('0xb')],'include':[{'model':db[_0xe391('0x41')],'as':'Smtp'}]}]})[_0xe391('0x2d')](function(_0x3e659c){var _0x43f39d=_['keys'](manager[_0xe391('0x42')]);var _0xaf7b98=_['map'](_0x3e659c,function(_0x3a0c6b){return _0x3a0c6b['id'][_0xe391('0x43')]();});var _0xc0f5cd=_[_0xe391('0x44')](_0x3e659c,function(_0xb3690d){return _0xb3690d['id'][_0xe391('0x43')]();});var _0x2f86ea=_0x437ad5?_0xaf7b98:_[_0xe391('0x45')](_0xaf7b98,_0x43f39d);var _0x42b96f=_[_0xe391('0x46')](_0xaf7b98,_0x43f39d);var _0x58b4be=_['difference'](_0x43f39d,_0xaf7b98);var _0x4d3291;var _0x2cec38;for(_0x4d3291=0x0;_0x4d3291<_0x58b4be[_0xe391('0x47')]&&!_0x437ad5;_0x4d3291+=0x1){_0x2cec38=_0x58b4be[_0x4d3291]['toString']();if(manager[_0xe391('0x48')](_0x2cec38)){manager[_0xe391('0x49')](_0x2cec38);manager['deleteJob'](_0x2cec38);logger[_0xe391('0x2a')](_0xe391('0x4a'),_0x2cec38);}}logger[_0xe391('0x2a')](_0xe391('0x4b'),JSON[_0xe391('0x27')](_0x2f86ea));for(_0x4d3291=0x0;_0x4d3291<_0x2f86ea[_0xe391('0x47')];_0x4d3291+=0x1){_0x2cec38=_0x2f86ea[_0x4d3291][_0xe391('0x43')]();logger[_0xe391('0x2a')](_0xe391('0x4c'),_0x2cec38);if(_0x437ad5){logger[_0xe391('0x2a')](_0xe391('0x4d'),_0x437ad5);logger[_0xe391('0x2a')](JSON['stringify'](_0xc0f5cd[_0x2cec38]));BPromise[_0xe391('0x4e')]()['then'](handleJob(_0xc0f5cd[_0x2cec38]));logger[_0xe391('0x2a')](_0xe391('0x4f'),_0xc0f5cd[_0x2cec38][_0xe391('0x15')],_0xc0f5cd[_0x2cec38][_0xe391('0x50')]);}else if(_0xc0f5cd[_0x2cec38][_0xe391('0x50')]&&_0xc0f5cd[_0x2cec38][_0xe391('0x51')]&&moment()[_0xe391('0x52')](_0xc0f5cd[_0x2cec38][_0xe391('0x53')],_0xc0f5cd[_0x2cec38][_0xe391('0x54')])){manager[_0xe391('0x55')](_0x2cec38,_0xc0f5cd[_0x2cec38]['cron'],handleJob(_0xc0f5cd[_0x2cec38]));manager[_0xe391('0x56')](_0x2cec38);logger[_0xe391('0x2a')](_0xe391('0x57'),_0xc0f5cd[_0x2cec38][_0xe391('0x15')],_0xc0f5cd[_0x2cec38]['cron']);}else if(manager[_0xe391('0x48')](_0x2cec38)){manager['stop'](_0x2cec38);manager[_0xe391('0x58')](_0x2cec38);logger[_0xe391('0x2a')](_0xe391('0x59'),_0xc0f5cd[_0x2cec38]['name'],_0xc0f5cd[_0x2cec38][_0xe391('0x50')]);}}for(_0x4d3291=0x0,_0x2cec38;_0x4d3291<_0x42b96f[_0xe391('0x47')]&&!_0x437ad5;_0x4d3291+=0x1){_0x2cec38=_0x42b96f[_0x4d3291][_0xe391('0x43')]();if(manager['exists'](_0x2cec38)){if(_0xc0f5cd[_0x2cec38][_0xe391('0x50')]&&_0xc0f5cd[_0x2cec38]['active']&&moment()[_0xe391('0x52')](_0xc0f5cd[_0x2cec38]['startAt'],_0xc0f5cd[_0x2cec38][_0xe391('0x54')])){manager[_0xe391('0x5a')](_0x2cec38,_0xc0f5cd[_0x2cec38][_0xe391('0x50')],handleJob(_0xc0f5cd[_0x2cec38]));logger[_0xe391('0x2a')]('update\x20cron',_0xc0f5cd[_0x2cec38]['name'],_0xc0f5cd[_0x2cec38][_0xe391('0x50')]);}else{manager[_0xe391('0x49')](_0x2cec38);manager[_0xe391('0x58')](_0x2cec38);logger['info']('stop\x20cron',_0xc0f5cd[_0x2cec38][_0xe391('0x15')],_0xc0f5cd[_0x2cec38][_0xe391('0x50')]);}}}})[_0xe391('0x3d')](function(_0x213dbd){logger['error'](JSON[_0xe391('0x27')](_0x213dbd));});}exports[_0xe391('0x5b')]=function(_0x2fec18){return getJobs(_0x2fec18);};exports[_0xe391('0x56')]=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 dc52028..9afd1c9 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 _0x88c3=['Cloud\x20Provider\x20not\x20available','forEach','push','all','lodash','request-promise','../../mysqldb','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','results','transcripts','length','fileText','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Sentiment','SentimentScore','Positive','Negative','Mixed','FAILED','update','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Neutral','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','transcribeRegion'];(function(_0x138ae5,_0x42cc7f){var _0x532562=function(_0x636ad){while(--_0x636ad){_0x138ae5['push'](_0x138ae5['shift']());}};_0x532562(++_0x42cc7f);}(_0x88c3,0x1ee));var _0x388c=function(_0x54bebf,_0x43d0a3){_0x54bebf=_0x54bebf-0x0;var _0x421bd4=_0x88c3[_0x54bebf];return _0x421bd4;};var _=require(_0x388c('0x0'));var AWS=require('aws-sdk');var rp=require(_0x388c('0x1'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x388c('0x2'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x41e92c,_0xab6dbb,_0x2baa68,_0x33c1dc){return new Promise(function(_0x28ed4d,_0x23199c){var _0x5a1c0d=new AWS[(_0x388c('0x3'))]({'accessKeyId':_0xab6dbb,'secretAccessKey':_0x41e92c,'region':_0x2baa68});_0x5a1c0d[_0x388c('0x4')]({'TranscriptionJobName':_0x33c1dc},function(_0x26be80,_0xc157a){if(_0x26be80){return _0x23199c(_0x26be80);}else{return _0x28ed4d(_0xc157a);}});});}function sentiment(_0x105e93,_0x17dbf8,_0x2debe9,_0x31963c,_0x4f1639){return new Promise(function(_0x39604c,_0x4f0a81){var _0x58659e=new AWS[(_0x388c('0x5'))]({'accessKeyId':_0x17dbf8,'secretAccessKey':_0x105e93,'region':_0x2debe9});_0x58659e[_0x388c('0x6')]({'Text':_0x31963c,'LanguageCode':_0x4f1639[_0x388c('0x7')](0x0,0x2)},function(_0x14a335,_0x3ea92c){if(_0x14a335){return _0x4f0a81(_0x14a335);}else{return _0x39604c(_0x3ea92c);}});});}function checkTranscribeJob(_0x302ea5,_0x462e13,_0x45a3fe){var _0x262ed1;return new BPromise(function(_0x5e82b1,_0x59f5f8){logger['info'](util[_0x388c('0x8')](_0x388c('0x9'),_0x302ea5['id'],_0x302ea5['transcribeName']));return getTranscriptionJob(_0x45a3fe[_0x388c('0xa')],_0x45a3fe[_0x388c('0xb')],_0x462e13['transcribeRegion'],_0x302ea5['transcribeName'])[_0x388c('0xc')](function(_0x3c5444){logger[_0x388c('0xd')](util['format'](_0x388c('0xe'),_0x302ea5['id'],_0x302ea5['transcribeName'],_0x3c5444[_0x388c('0xf')][_0x388c('0x10')]));if(!_0x302ea5['fileText']){switch(_0x3c5444['TranscriptionJob'][_0x388c('0x10')]){case _0x388c('0x11'):var _0x671bb5={'transcribeStatus':_0x3c5444['TranscriptionJob'][_0x388c('0x10')],'fileUri':_0x3c5444['TranscriptionJob'][_0x388c('0x12')][_0x388c('0x13')]};logger[_0x388c('0xd')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x302ea5['id']));return rp({'uri':_0x3c5444['TranscriptionJob']['Transcript'][_0x388c('0x13')],'json':!![]})['then'](function(_0xfff1f5){logger['info'](util[_0x388c('0x8')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x302ea5['id']));if(_0xfff1f5&&_0xfff1f5[_0x388c('0x14')]&&_0xfff1f5['results'][_0x388c('0x15')]&&_0xfff1f5[_0x388c('0x14')][_0x388c('0x15')][_0x388c('0x16')]){_0x671bb5[_0x388c('0x17')]='';for(var _0x2ce6cc=0x0;_0x2ce6cc<_0xfff1f5[_0x388c('0x14')][_0x388c('0x15')][_0x388c('0x16')];_0x2ce6cc++){_0x671bb5['fileText']+=_0xfff1f5['results'][_0x388c('0x15')][_0x2ce6cc]['transcript']+'';}}return _0x302ea5['update'](_0x671bb5);})['then'](function(){logger[_0x388c('0xd')](util[_0x388c('0x8')](_0x388c('0x18'),_0x302ea5['id']));if(!_0x302ea5[_0x388c('0x19')]){throw new db[(_0x388c('0x1a'))][(_0x388c('0x1b'))](_0x388c('0x1c'));}if(!_0x462e13[_0x388c('0x1d')]||!_0x462e13[_0x388c('0x1e')]||!_0x462e13[_0x388c('0x1f')]||!_0x462e13[_0x388c('0x20')]||!_0x462e13[_0x388c('0x21')]){throw new db['Sequelize']['ValidationError'](_0x388c('0x22'));}if(!_0x671bb5[_0x388c('0x17')]){throw new Error(_0x388c('0x23'));}if(_0x462e13['sentimentAccountId']===_0x45a3fe['id']){return _0x45a3fe;}else{return db[_0x388c('0x24')][_0x388c('0x25')]({'where':{'id':_settings[_0x388c('0x1e')]}});}})['then'](function(_0x201004){if(!_0x201004){throw new db[(_0x388c('0x1a'))][(_0x388c('0x1b'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x201004['data1']||!_0x201004['data2']){throw new db[(_0x388c('0x1a'))][(_0x388c('0x1b'))]('Cloud\x20Provider\x20not\x20configured');}_0x262ed1=_0x201004;logger[_0x388c('0xd')](util[_0x388c('0x8')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x302ea5['id']));return sentiment(_0x262ed1[_0x388c('0xa')],_0x262ed1[_0x388c('0xb')],_0x462e13[_0x388c('0x1f')],_0x671bb5[_0x388c('0x17')],_0x462e13[_0x388c('0x20')]);})[_0x388c('0xc')](function(_0x5c0a2d){logger[_0x388c('0xd')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x302ea5['id']));return _0x302ea5['update']({'sentiment':_0x5c0a2d[_0x388c('0x26')],'sPositive':_0x5c0a2d[_0x388c('0x27')][_0x388c('0x28')],'sNegative':_0x5c0a2d[_0x388c('0x27')][_0x388c('0x29')],'sMixed':_0x5c0a2d[_0x388c('0x27')][_0x388c('0x2a')],'sNeutral':_0x5c0a2d['SentimentScore']['Neutral']});})[_0x388c('0xc')](function(){logger[_0x388c('0xd')](util[_0x388c('0x8')](_0x388c('0x18'),_0x302ea5['id']));_0x5e82b1();});case _0x388c('0x2b'):return _0x302ea5[_0x388c('0x2c')]({'transcribeStatus':_0x388c('0x2b'),'failureReason':_0x3c5444[_0x388c('0xf')][_0x388c('0x2d')]})[_0x388c('0xc')](function(){logger[_0x388c('0xd')](util['format'](_0x388c('0x18'),_0x302ea5['id']));_0x5e82b1();});default:logger[_0x388c('0xd')](util['format'](_0x388c('0x2e'),_0x302ea5['id']));break;}}else{return BPromise['resolve']()[_0x388c('0xc')](function(){if(!_0x302ea5[_0x388c('0x19')]){throw new db[(_0x388c('0x1a'))]['ValidationError'](_0x388c('0x1c'));}if(!_0x462e13[_0x388c('0x1d')]||!_0x462e13['sentimentAccountId']||!_0x462e13[_0x388c('0x1f')]||!_0x462e13[_0x388c('0x20')]||!_0x462e13['bucket']){throw new db[(_0x388c('0x1a'))][(_0x388c('0x1b'))](_0x388c('0x22'));}if(!_0x302ea5[_0x388c('0x17')]){throw new Error(_0x388c('0x23'));}if(_0x462e13[_0x388c('0x1e')]===_0x45a3fe['id']){return _0x45a3fe;}else{return db[_0x388c('0x24')][_0x388c('0x25')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x551b12){if(!_0x551b12){throw new db[(_0x388c('0x1a'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x551b12[_0x388c('0xa')]||!_0x551b12[_0x388c('0xb')]){throw new db[(_0x388c('0x1a'))]['ValidationError'](_0x388c('0x2f'));}_0x262ed1=_0x551b12;logger[_0x388c('0xd')](util['format'](_0x388c('0x30'),_0x302ea5['id']));return sentiment(_0x262ed1[_0x388c('0xa')],_0x262ed1['data2'],_0x462e13[_0x388c('0x1f')],_0x302ea5['fileText'],_0x462e13[_0x388c('0x20')]);})['then'](function(_0x1192f3){logger[_0x388c('0xd')](util[_0x388c('0x8')](_0x388c('0x31'),_0x302ea5['id']));return _0x302ea5[_0x388c('0x2c')]({'sentiment':_0x1192f3[_0x388c('0x26')],'sPositive':_0x1192f3[_0x388c('0x27')]['Positive'],'sNegative':_0x1192f3[_0x388c('0x27')][_0x388c('0x29')],'sMixed':_0x1192f3['SentimentScore'][_0x388c('0x2a')],'sNeutral':_0x1192f3[_0x388c('0x27')][_0x388c('0x32')],'transcribeStatus':_0x388c('0x11')});})['then'](function(){logger['info'](util['format'](_0x388c('0x18'),_0x302ea5['id']));_0x5e82b1();});}})[_0x388c('0x33')](function(_0x26050a){if(_0x26050a){if(!_0x26050a[_0x388c('0x34')]||_0x26050a['name']!==_0x388c('0x35')){logger[_0x388c('0x36')](util[_0x388c('0x8')](_0x388c('0x37'),_0x302ea5['id']),util[_0x388c('0x38')](_0x26050a,{'showHidden':![],'depth':null}));}}_0x5e82b1();});});}function checkTranscribe(){var _0x313b57;var _0x160ab5;var _0x57beb1;return db[_0x388c('0x39')][_0x388c('0x3a')]({'where':{'transcribeStatus':_0x388c('0x3b')}})[_0x388c('0xc')](function(_0x2144f4){if(!_0x2144f4||!_0x2144f4[_0x388c('0x16')]){throw new db['Sequelize'][(_0x388c('0x1b'))](_0x388c('0x3c'));}_0x313b57=_0x2144f4;return db[_0x388c('0x3d')][_0x388c('0x25')]({'where':{'id':0x1}});})[_0x388c('0xc')](function(_0x1dea5b){if(!_0x1dea5b){throw new db[(_0x388c('0x1a'))][(_0x388c('0x1b'))](_0x388c('0x3e'));}_0x160ab5=_0x1dea5b;if(!_0x160ab5[_0x388c('0x3f')]||!_0x160ab5[_0x388c('0x40')]||!_0x160ab5[_0x388c('0x41')]||!_0x160ab5[_0x388c('0x20')]||!_0x160ab5[_0x388c('0x21')]){throw new db[(_0x388c('0x1a'))][(_0x388c('0x1b'))]('Transcribe\x20not\x20configured');}return db[_0x388c('0x24')][_0x388c('0x25')]({'where':{'id':_0x160ab5[_0x388c('0x40')]}});})[_0x388c('0xc')](function(_0x59f557){if(!_0x59f557){throw new db[(_0x388c('0x1a'))]['ValidationError'](_0x388c('0x42'));}if(!_0x59f557[_0x388c('0xa')]||!_0x59f557['data2']){throw new db['Sequelize']['ValidationError'](_0x388c('0x2f'));}_0x57beb1=_0x59f557;var _0x5cf86e=[];_0x313b57[_0x388c('0x43')](function(_0x448b62){_0x5cf86e[_0x388c('0x44')](checkTranscribeJob(_0x448b62,_0x160ab5,_0x57beb1));});return BPromise[_0x388c('0x45')](_0x5cf86e);})[_0x388c('0x33')](function(_0x3b2dfc){if(_0x3b2dfc){if(!_0x3b2dfc[_0x388c('0x34')]||_0x3b2dfc[_0x388c('0x34')]!=='SequelizeValidationError'){logger[_0x388c('0x36')](util[_0x388c('0x38')](_0x3b2dfc,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x6324=['resolve','CloudProvider','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Negative','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','push','all','lodash','aws-sdk','request-promise','util','../../mysqldb','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','SentimentScore','Positive','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed'];(function(_0x24f326,_0x616a7){var _0x488e2d=function(_0x293d9a){while(--_0x293d9a){_0x24f326['push'](_0x24f326['shift']());}};_0x488e2d(++_0x616a7);}(_0x6324,0x142));var _0x4632=function(_0x27c1ab,_0x3734be){_0x27c1ab=_0x27c1ab-0x0;var _0x5087a3=_0x6324[_0x27c1ab];return _0x5087a3;};var _=require(_0x4632('0x0'));var AWS=require(_0x4632('0x1'));var rp=require(_0x4632('0x2'));var util=require(_0x4632('0x3'));var BPromise=require('bluebird');var db=require(_0x4632('0x4'))['db'];var logger=require('../../config/logger')(_0x4632('0x5'));function getTranscriptionJob(_0x54c200,_0x13b218,_0x592e39,_0x140bc7){return new Promise(function(_0x24aba6,_0x1f3077){var _0x126e9a=new AWS['TranscribeService']({'accessKeyId':_0x13b218,'secretAccessKey':_0x54c200,'region':_0x592e39});_0x126e9a[_0x4632('0x6')]({'TranscriptionJobName':_0x140bc7},function(_0x44dd6d,_0x390a46){if(_0x44dd6d){return _0x1f3077(_0x44dd6d);}else{return _0x24aba6(_0x390a46);}});});}function sentiment(_0x5a523b,_0xc3bc9e,_0x47824c,_0x47a518,_0x556bbc){return new Promise(function(_0xcdefa2,_0x21999d){var _0x30a7cf=new AWS[(_0x4632('0x7'))]({'accessKeyId':_0xc3bc9e,'secretAccessKey':_0x5a523b,'region':_0x47824c});_0x30a7cf[_0x4632('0x8')]({'Text':_0x47a518,'LanguageCode':_0x556bbc[_0x4632('0x9')](0x0,0x2)},function(_0x1b2729,_0x17f9d1){if(_0x1b2729){return _0x21999d(_0x1b2729);}else{return _0xcdefa2(_0x17f9d1);}});});}function checkTranscribeJob(_0x4a4cdd,_0x2b3f0f,_0x499d88){var _0x4719f7;return new BPromise(function(_0x299073,_0x3ef228){logger[_0x4632('0xa')](util['format'](_0x4632('0xb'),_0x4a4cdd['id'],_0x4a4cdd[_0x4632('0xc')]));return getTranscriptionJob(_0x499d88[_0x4632('0xd')],_0x499d88[_0x4632('0xe')],_0x2b3f0f[_0x4632('0xf')],_0x4a4cdd['transcribeName'])['then'](function(_0x2fd7ae){logger[_0x4632('0xa')](util[_0x4632('0x10')](_0x4632('0x11'),_0x4a4cdd['id'],_0x4a4cdd['transcribeName'],_0x2fd7ae[_0x4632('0x12')][_0x4632('0x13')]));if(!_0x4a4cdd[_0x4632('0x14')]){switch(_0x2fd7ae['TranscriptionJob'][_0x4632('0x13')]){case _0x4632('0x15'):var _0x58e193={'transcribeStatus':_0x2fd7ae['TranscriptionJob'][_0x4632('0x13')],'fileUri':_0x2fd7ae[_0x4632('0x12')][_0x4632('0x16')][_0x4632('0x17')]};logger[_0x4632('0xa')](util[_0x4632('0x10')](_0x4632('0x18'),_0x4a4cdd['id']));return rp({'uri':_0x2fd7ae[_0x4632('0x12')][_0x4632('0x16')][_0x4632('0x17')],'json':!![]})[_0x4632('0x19')](function(_0x2d656a){logger[_0x4632('0xa')](util[_0x4632('0x10')](_0x4632('0x1a'),_0x4a4cdd['id']));if(_0x2d656a&&_0x2d656a[_0x4632('0x1b')]&&_0x2d656a[_0x4632('0x1b')][_0x4632('0x1c')]&&_0x2d656a[_0x4632('0x1b')][_0x4632('0x1c')][_0x4632('0x1d')]){_0x58e193[_0x4632('0x14')]='';for(var _0x3b0823=0x0;_0x3b0823<_0x2d656a[_0x4632('0x1b')][_0x4632('0x1c')][_0x4632('0x1d')];_0x3b0823++){_0x58e193[_0x4632('0x14')]+=_0x2d656a[_0x4632('0x1b')][_0x4632('0x1c')][_0x3b0823][_0x4632('0x1e')]+'';}}return _0x4a4cdd[_0x4632('0x1f')](_0x58e193);})[_0x4632('0x19')](function(){logger[_0x4632('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4a4cdd['id']));if(!_0x4a4cdd[_0x4632('0x20')]){throw new db[(_0x4632('0x21'))][(_0x4632('0x22'))](_0x4632('0x23'));}if(!_0x2b3f0f[_0x4632('0x24')]||!_0x2b3f0f[_0x4632('0x25')]||!_0x2b3f0f[_0x4632('0x26')]||!_0x2b3f0f['language']||!_0x2b3f0f[_0x4632('0x27')]){throw new db[(_0x4632('0x21'))]['ValidationError'](_0x4632('0x28'));}if(!_0x58e193['fileText']){throw new Error(_0x4632('0x29'));}if(_0x2b3f0f['sentimentAccountId']===_0x499d88['id']){return _0x499d88;}else{return db['CloudProvider'][_0x4632('0x2a')]({'where':{'id':_settings[_0x4632('0x25')]}});}})[_0x4632('0x19')](function(_0x4ebf94){if(!_0x4ebf94){throw new db['Sequelize'][(_0x4632('0x22'))](_0x4632('0x2b'));}if(!_0x4ebf94['data1']||!_0x4ebf94['data2']){throw new db[(_0x4632('0x21'))][(_0x4632('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x4719f7=_0x4ebf94;logger[_0x4632('0xa')](util[_0x4632('0x10')](_0x4632('0x2c'),_0x4a4cdd['id']));return sentiment(_0x4719f7[_0x4632('0xd')],_0x4719f7[_0x4632('0xe')],_0x2b3f0f['sentimentRegion'],_0x58e193[_0x4632('0x14')],_0x2b3f0f[_0x4632('0x2d')]);})['then'](function(_0x5f4f24){logger[_0x4632('0xa')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4a4cdd['id']));return _0x4a4cdd[_0x4632('0x1f')]({'sentiment':_0x5f4f24['Sentiment'],'sPositive':_0x5f4f24[_0x4632('0x2e')][_0x4632('0x2f')],'sNegative':_0x5f4f24[_0x4632('0x2e')]['Negative'],'sMixed':_0x5f4f24[_0x4632('0x2e')][_0x4632('0x30')],'sNeutral':_0x5f4f24[_0x4632('0x2e')][_0x4632('0x31')]});})[_0x4632('0x19')](function(){logger['info'](util['format'](_0x4632('0x32'),_0x4a4cdd['id']));_0x299073();});case _0x4632('0x33'):return _0x4a4cdd[_0x4632('0x1f')]({'transcribeStatus':'FAILED','failureReason':_0x2fd7ae['TranscriptionJob']['FailureReason']})[_0x4632('0x19')](function(){logger[_0x4632('0xa')](util['format'](_0x4632('0x32'),_0x4a4cdd['id']));_0x299073();});default:logger[_0x4632('0xa')](util[_0x4632('0x10')](_0x4632('0x34'),_0x4a4cdd['id']));break;}}else{return BPromise[_0x4632('0x35')]()[_0x4632('0x19')](function(){if(!_0x4a4cdd[_0x4632('0x20')]){throw new db[(_0x4632('0x21'))][(_0x4632('0x22'))](_0x4632('0x23'));}if(!_0x2b3f0f[_0x4632('0x24')]||!_0x2b3f0f[_0x4632('0x25')]||!_0x2b3f0f['sentimentRegion']||!_0x2b3f0f[_0x4632('0x2d')]||!_0x2b3f0f[_0x4632('0x27')]){throw new db['Sequelize'][(_0x4632('0x22'))](_0x4632('0x28'));}if(!_0x4a4cdd['fileText']){throw new Error(_0x4632('0x29'));}if(_0x2b3f0f['sentimentAccountId']===_0x499d88['id']){return _0x499d88;}else{return db[_0x4632('0x36')][_0x4632('0x2a')]({'where':{'id':_settings[_0x4632('0x25')]}});}})[_0x4632('0x19')](function(_0x5b630a){if(!_0x5b630a){throw new db[(_0x4632('0x21'))][(_0x4632('0x22'))](_0x4632('0x2b'));}if(!_0x5b630a[_0x4632('0xd')]||!_0x5b630a['data2']){throw new db['Sequelize'][(_0x4632('0x22'))](_0x4632('0x37'));}_0x4719f7=_0x5b630a;logger[_0x4632('0xa')](util['format'](_0x4632('0x2c'),_0x4a4cdd['id']));return sentiment(_0x4719f7[_0x4632('0xd')],_0x4719f7[_0x4632('0xe')],_0x2b3f0f[_0x4632('0x26')],_0x4a4cdd[_0x4632('0x14')],_0x2b3f0f[_0x4632('0x2d')]);})[_0x4632('0x19')](function(_0x4ecbad){logger[_0x4632('0xa')](util[_0x4632('0x10')](_0x4632('0x38'),_0x4a4cdd['id']));return _0x4a4cdd[_0x4632('0x1f')]({'sentiment':_0x4ecbad[_0x4632('0x39')],'sPositive':_0x4ecbad['SentimentScore']['Positive'],'sNegative':_0x4ecbad[_0x4632('0x2e')][_0x4632('0x3a')],'sMixed':_0x4ecbad[_0x4632('0x2e')][_0x4632('0x30')],'sNeutral':_0x4ecbad['SentimentScore'][_0x4632('0x31')],'transcribeStatus':_0x4632('0x15')});})[_0x4632('0x19')](function(){logger[_0x4632('0xa')](util[_0x4632('0x10')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4a4cdd['id']));_0x299073();});}})[_0x4632('0x3b')](function(_0x20b44e){if(_0x20b44e){if(!_0x20b44e[_0x4632('0x3c')]||_0x20b44e[_0x4632('0x3c')]!==_0x4632('0x3d')){logger[_0x4632('0x3e')](util[_0x4632('0x10')](_0x4632('0x3f'),_0x4a4cdd['id']),util[_0x4632('0x40')](_0x20b44e,{'showHidden':![],'depth':null}));}}_0x299073();});});}function checkTranscribe(){var _0x225bd2;var _0x127db3;var _0x517584;return db[_0x4632('0x41')][_0x4632('0x42')]({'where':{'transcribeStatus':_0x4632('0x43')}})['then'](function(_0x7ec070){if(!_0x7ec070||!_0x7ec070[_0x4632('0x1d')]){throw new db[(_0x4632('0x21'))][(_0x4632('0x22'))](_0x4632('0x44'));}_0x225bd2=_0x7ec070;return db[_0x4632('0x45')][_0x4632('0x2a')]({'where':{'id':0x1}});})[_0x4632('0x19')](function(_0x1f43b6){if(!_0x1f43b6){throw new db[(_0x4632('0x21'))]['ValidationError'](_0x4632('0x46'));}_0x127db3=_0x1f43b6;if(!_0x127db3[_0x4632('0x5')]||!_0x127db3['transcribeAccountId']||!_0x127db3[_0x4632('0xf')]||!_0x127db3[_0x4632('0x2d')]||!_0x127db3[_0x4632('0x27')]){throw new db[(_0x4632('0x21'))][(_0x4632('0x22'))](_0x4632('0x47'));}return db[_0x4632('0x36')][_0x4632('0x2a')]({'where':{'id':_0x127db3[_0x4632('0x48')]}});})[_0x4632('0x19')](function(_0x3e66d8){if(!_0x3e66d8){throw new db[(_0x4632('0x21'))][(_0x4632('0x22'))](_0x4632('0x2b'));}if(!_0x3e66d8[_0x4632('0xd')]||!_0x3e66d8[_0x4632('0xe')]){throw new db[(_0x4632('0x21'))][(_0x4632('0x22'))](_0x4632('0x37'));}_0x517584=_0x3e66d8;var _0x36c824=[];_0x225bd2['forEach'](function(_0x3bd8ee){_0x36c824[_0x4632('0x49')](checkTranscribeJob(_0x3bd8ee,_0x127db3,_0x517584));});return BPromise[_0x4632('0x4a')](_0x36c824);})[_0x4632('0x3b')](function(_0x2e2353){if(_0x2e2353){if(!_0x2e2353[_0x4632('0x3c')]||_0x2e2353['name']!==_0x4632('0x3d')){logger[_0x4632('0x3e')](util[_0x4632('0x40')](_0x2e2353,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 78126b6..e08326b 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 _0x67da=['whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','../logger','schedule','redis','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit'];(function(_0x3e25b5,_0x25ff09){var _0x1eb053=function(_0x301029){while(--_0x301029){_0x3e25b5['push'](_0x3e25b5['shift']());}};_0x1eb053(++_0x25ff09);}(_0x67da,0x198));var _0xa67d=function(_0x463cbd,_0x2dda5a){_0x463cbd=_0x463cbd-0x0;var _0x3fe838=_0x67da[_0x463cbd];return _0x3fe838;};'use strict';var _=require(_0xa67d('0x0'));var moment=require(_0xa67d('0x1'));var Redis=require(_0xa67d('0x2'));var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xa67d('0x3'))(_0xa67d('0x4'));config[_0xa67d('0x5')]=_[_0xa67d('0x6')](config['redis'],{'host':_0xa67d('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa67d('0x5')]));function closeInteractions(){var _0x11fd6b=[];return db[_0xa67d('0x8')][_0xa67d('0x9')]({'raw':!![],'attributes':['id',_0xa67d('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xa67d('0xb')](0x18,_0xa67d('0xc'))}}})[_0xa67d('0xd')](function(_0x274a4e){if(_0x274a4e&&_0x274a4e[_0xa67d('0xe')]){_0x11fd6b=_[_0xa67d('0xf')](_0x274a4e||[],'id');logger[_0xa67d('0x10')](_0xa67d('0x11'),_0x11fd6b[_0xa67d('0x12')]());return db[_0xa67d('0x8')][_0xa67d('0x13')]({'closeReason':_0xa67d('0x14'),'disposition':_0xa67d('0x15'),'closed':!![],'closedAt':moment()[_0xa67d('0x16')](_0xa67d('0x17'))},{'where':{'id':_0x11fd6b}});}})[_0xa67d('0xd')](function(){if(_0x11fd6b&&_0x11fd6b[_0xa67d('0xe')]){logger[_0xa67d('0x10')](_0xa67d('0x18'),_0x11fd6b[_0xa67d('0x12')]());for(var _0x575549=0x0;_0x575549<_0x11fd6b[_0xa67d('0xe')];_0x575549++){io[_0xa67d('0x19')](_0xa67d('0x1a'),{'id':_0x11fd6b[_0x575549],'closed':!![]});}}})[_0xa67d('0x1b')](function(_0x1feba6){logger[_0xa67d('0x1c')](_0xa67d('0x1d'),_0x1feba6?util['inspect'](_0x1feba6,{'showHidden':![],'depth':null}):'');});}exports[_0xa67d('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe9e4=['findAll','lastMsgAt','subtract','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','defaults','redis','localhost','socket.io-emitter','WhatsappInteraction'];(function(_0x350396,_0x391ad2){var _0xf306b1=function(_0x3f2d38){while(--_0x3f2d38){_0x350396['push'](_0x350396['shift']());}};_0xf306b1(++_0x391ad2);}(_0xe9e4,0x1e2));var _0x4e9e=function(_0x42619c,_0x44facf){_0x42619c=_0x42619c-0x0;var _0x5efa82=_0xe9e4[_0x42619c];return _0x5efa82;};'use strict';var _=require('lodash');var moment=require(_0x4e9e('0x0'));var Redis=require(_0x4e9e('0x1'));var util=require(_0x4e9e('0x2'));var config=require(_0x4e9e('0x3'));var db=require(_0x4e9e('0x4'))['db'];var logger=require('../logger')(_0x4e9e('0x5'));config['redis']=_[_0x4e9e('0x6')](config[_0x4e9e('0x7')],{'host':_0x4e9e('0x8'),'port':0x18eb});var io=require(_0x4e9e('0x9'))(new Redis(config[_0x4e9e('0x7')]));function closeInteractions(){var _0x21d651=[];return db[_0x4e9e('0xa')][_0x4e9e('0xb')]({'raw':!![],'attributes':['id',_0x4e9e('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4e9e('0xd')](0x18,'hours')}}})[_0x4e9e('0xe')](function(_0x526372){if(_0x526372&&_0x526372[_0x4e9e('0xf')]){_0x21d651=_[_0x4e9e('0x10')](_0x526372||[],'id');logger['info'](_0x4e9e('0x11'),_0x21d651[_0x4e9e('0x12')]());return db[_0x4e9e('0xa')]['update']({'closeReason':'system','disposition':_0x4e9e('0x13'),'closed':!![],'closedAt':moment()[_0x4e9e('0x14')](_0x4e9e('0x15'))},{'where':{'id':_0x21d651}});}})[_0x4e9e('0xe')](function(){if(_0x21d651&&_0x21d651[_0x4e9e('0xf')]){logger[_0x4e9e('0x16')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x21d651[_0x4e9e('0x12')]());for(var _0x84a15e=0x0;_0x84a15e<_0x21d651['length'];_0x84a15e++){io[_0x4e9e('0x17')](_0x4e9e('0x18'),{'id':_0x21d651[_0x84a15e],'closed':!![]});}}})[_0x4e9e('0x19')](function(_0x2cae41){logger[_0x4e9e('0x1a')](_0x4e9e('0x1b'),_0x2cae41?util['inspect'](_0x2cae41,{'showHidden':![],'depth':null}):'');});}exports[_0x4e9e('0x1c')]=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 a5772ba..10ab0b9 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x10b2=['hopper1','contacts2','hopper2','catch','util','../mysqldb','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','destroy','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x10b2,0x9c));var _0x210b=function(_0x27cf10,_0x5bbc46){_0x27cf10=_0x27cf10-0x0;var _0x289412=_0x10b2[_0x27cf10];return _0x289412;};'use strict';var util=require(_0x210b('0x0'));var db=require(_0x210b('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x210b('0x2')+i,'phone':0xf879fb460+i,'email':_0x210b('0x3')+i+_0x210b('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x210b('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x210b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x210b('0x6')](),'updatedAt':Date[_0x210b('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x210b('0x5')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x210b('0x2')+i,'phone':0xf879fb460+i,'email':_0x210b('0x3')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x210b('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x210b('0x6')](),'updatedAt':Date[_0x210b('0x6')]()});}db[_0x210b('0x7')][_0x210b('0x8')]({'where':{}})['then'](function(){return db['CmContact'][_0x210b('0x9')](contacts);})[_0x210b('0xa')](function(){console[_0x210b('0xb')](_0x210b('0xc'),_0x210b('0xd'));return db[_0x210b('0xe')][_0x210b('0x8')]({'where':{}});})[_0x210b('0xa')](function(){return db[_0x210b('0xe')]['bulkCreate'](hopper);})[_0x210b('0xa')](function(){console[_0x210b('0xb')](_0x210b('0xc'),_0x210b('0xf'));return db[_0x210b('0x7')][_0x210b('0x9')](contacts2);})[_0x210b('0xa')](function(){console[_0x210b('0xb')](_0x210b('0xc'),_0x210b('0x10'));return db[_0x210b('0xe')]['bulkCreate'](hopper2);})['then'](function(){console['log'](_0x210b('0xc'),_0x210b('0x11'));})[_0x210b('0x12')](function(_0x44f0ce){console['log'](_0x44f0ce);}); \ No newline at end of file +var _0x7f62=['CmContact','destroy','bulkCreate','log','finished\x20populating','contacts1','CmHopper','then','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now'];(function(_0x44486b,_0x20ca23){var _0x105312=function(_0x410d58){while(--_0x410d58){_0x44486b['push'](_0x44486b['shift']());}};_0x105312(++_0x20ca23);}(_0x7f62,0xac));var _0x27f6=function(_0x2d2258,_0x2ce510){_0x2d2258=_0x2d2258-0x0;var _0x18e155=_0x7f62[_0x2d2258];return _0x18e155;};'use strict';var util=require(_0x27f6('0x0'));var db=require(_0x27f6('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x27f6('0x2')]({'id':i,'firstName':_0x27f6('0x3')+i,'lastName':_0x27f6('0x4')+i,'phone':0xf879fb460+i,'email':_0x27f6('0x5')+i+_0x27f6('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x27f6('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x27f6('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x27f6('0x7')](),'updatedAt':Date[_0x27f6('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x27f6('0x2')]({'id':i,'firstName':_0x27f6('0x3')+i,'lastName':_0x27f6('0x4')+i,'phone':0xf879fb460+i,'email':_0x27f6('0x5')+i+_0x27f6('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x27f6('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x27f6('0x7')]()});}db[_0x27f6('0x8')][_0x27f6('0x9')]({'where':{}})['then'](function(){return db[_0x27f6('0x8')][_0x27f6('0xa')](contacts);})['then'](function(){console[_0x27f6('0xb')](_0x27f6('0xc'),_0x27f6('0xd'));return db[_0x27f6('0xe')][_0x27f6('0x9')]({'where':{}});})[_0x27f6('0xf')](function(){return db[_0x27f6('0xe')]['bulkCreate'](hopper);})[_0x27f6('0xf')](function(){console[_0x27f6('0xb')](_0x27f6('0xc'),_0x27f6('0x10'));return db['CmContact'][_0x27f6('0xa')](contacts2);})[_0x27f6('0xf')](function(){console[_0x27f6('0xb')](_0x27f6('0xc'),_0x27f6('0x11'));return db[_0x27f6('0xe')][_0x27f6('0xa')](hopper2);})[_0x27f6('0xf')](function(){console[_0x27f6('0xb')](_0x27f6('0xc'),_0x27f6('0x12'));})[_0x27f6('0x13')](function(_0x5ec5a8){console['log'](_0x5ec5a8);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 416f37d..8a2ef84 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac69=['friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','add\x20user','catch','log','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password'];(function(_0x19d581,_0x3b0a34){var _0x2d0a23=function(_0x23eee8){while(--_0x23eee8){_0x19d581['push'](_0x19d581['shift']());}};_0x2d0a23(++_0x3b0a34);}(_0xac69,0x76));var _0x9ac6=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xac69[_0x18cd5b];return _0x5eaa52;};'use strict';var util=require(_0x9ac6('0x0'));var db=require(_0x9ac6('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x9ac6('0x2')]({'name':util[_0x9ac6('0x3')](_0x9ac6('0x4'),_0x9ac6('0x5'),i),'fullname':util[_0x9ac6('0x3')]('%s%s',_0x9ac6('0x5'),i),'email':util[_0x9ac6('0x3')](_0x9ac6('0x6'),_0x9ac6('0x5'),i),'role':_0x9ac6('0x5'),'password':_0x9ac6('0x7'),'internal':0xfa0+i,'type':_0x9ac6('0x8'),'transport':[_0x9ac6('0x9'),'ws',_0x9ac6('0xa')],'disallow':['all'],'allow':[_0x9ac6('0xb')],'defaultuser':util['format'](_0x9ac6('0x4'),_0x9ac6('0x5'),i),'encryption':'yes','avpf':_0x9ac6('0xc'),'force_avp':_0x9ac6('0xc'),'icesupport':'yes','dtlsenable':_0x9ac6('0xc'),'dtlsverify':'no','dtlscertfile':_0x9ac6('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x9ac6('0xe'),'callerid':util[_0x9ac6('0x3')](_0x9ac6('0xf'),util[_0x9ac6('0x3')]('%s%s',_0x9ac6('0x5'),i),0xfa0+i)});}db[_0x9ac6('0x10')][_0x9ac6('0x11')](users)['then'](function(){console['log'](_0x9ac6('0x12'));})[_0x9ac6('0x13')](function(_0x878ea5){console[_0x9ac6('0x14')](_0x878ea5);}); \ No newline at end of file +var _0x5910=['ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','then','add\x20user','log','../mysqldb','push','agent','format','%s%s','%s%s@xcally.com','password','friend','udp','wss','all'];(function(_0x9d1e6b,_0x3bdc22){var _0x2b3070=function(_0x4c4ced){while(--_0x4c4ced){_0x9d1e6b['push'](_0x9d1e6b['shift']());}};_0x2b3070(++_0x3bdc22);}(_0x5910,0x73));var _0x0591=function(_0x443865,_0x395e48){_0x443865=_0x443865-0x0;var _0x139846=_0x5910[_0x443865];return _0x139846;};'use strict';var util=require('util');var db=require(_0x0591('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x0591('0x1')]({'name':util['format']('%s%s',_0x0591('0x2'),i),'fullname':util[_0x0591('0x3')](_0x0591('0x4'),'agent',i),'email':util[_0x0591('0x3')](_0x0591('0x5'),'agent',i),'role':_0x0591('0x2'),'password':_0x0591('0x6'),'internal':0xfa0+i,'type':_0x0591('0x7'),'transport':[_0x0591('0x8'),'ws',_0x0591('0x9')],'disallow':[_0x0591('0xa')],'allow':[_0x0591('0xb')],'defaultuser':util[_0x0591('0x3')](_0x0591('0x4'),_0x0591('0x2'),i),'encryption':'yes','avpf':_0x0591('0xc'),'force_avp':'yes','icesupport':_0x0591('0xc'),'dtlsenable':_0x0591('0xc'),'dtlsverify':'no','dtlscertfile':_0x0591('0xd'),'dtlsprivatekey':_0x0591('0xe'),'dtlssetup':'actpass','callerid':util[_0x0591('0x3')]('\x22%s\x22\x20<%s>',util[_0x0591('0x3')](_0x0591('0x4'),_0x0591('0x2'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0x0591('0xf')](function(){console['log'](_0x0591('0x10'));})['catch'](function(_0x4ccb9f){console[_0x0591('0x11')](_0x4ccb9f);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index a6e644a..04c9e24 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9906=['removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','leave','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_whatsapp_interactions:remove','catch','connection','setMaxListeners','address','remoteAddress','request','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','./environment','name','User','role','telephone','agent','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','resourceId','map','Campaign','where','type','%s:queue:%s','Agents','length','format','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','WhatsappQueue','voice:inbound','SmsQueue','OpenchannelQueue','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','sms','mail','openchannel','whatsapp'];(function(_0x5a25f6,_0x3db5cb){var _0x5a524d=function(_0x11f0fd){while(--_0x11f0fd){_0x5a25f6['push'](_0x5a25f6['shift']());}};_0x5a524d(++_0x3db5cb);}(_0x9906,0x1f1));var _0x6990=function(_0x1340d3,_0x34522e){_0x1340d3=_0x1340d3-0x0;var _0x4524a9=_0x9906[_0x1340d3];return _0x4524a9;};'use strict';var _=require(_0x6990('0x0'));var util=require(_0x6990('0x1'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0x6990('0x2'));var queryQueues={'attributes':['id',_0x6990('0x3')],'include':[{'as':'Agents','model':db[_0x6990('0x4')],'attributes':['id',_0x6990('0x3'),_0x6990('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6990('0x3')],'where':{'role':_0x6990('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x6990('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x6990('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6990('0x3'),'type'],'where':{'type':_0x6990('0x8')}};function getAssociatedResources(_0x298dc8,_0x83f81c,_0x58583a){return db[_0x6990('0x9')]['findOne']({'where':{'name':_0x298dc8,'userProfileId':_0x83f81c},'raw':!![]})[_0x6990('0xa')](function(_0x5afdfe){if(_0x5afdfe){if(_0x5afdfe[_0x6990('0xb')]){switch(_0x298dc8){case _0x6990('0xc'):case _0x6990('0xd'):case _0x6990('0xe'):case _0x6990('0xf'):case _0x6990('0x10'):case _0x6990('0x11'):case _0x6990('0x12'):return db[_0x58583a][_0x6990('0x13')](queryQueues);case _0x6990('0x14'):return db[_0x58583a][_0x6990('0x13')](queryTelephones);case'Trunks':return db[_0x58583a][_0x6990('0x13')](queryTrunks);case _0x6990('0x15'):return db[_0x58583a][_0x6990('0x13')](queryCampaigns);}}else{return db['UserProfileResource'][_0x6990('0x13')]({'attributes':[_0x6990('0x16')],'where':{'sectionId':_0x5afdfe['id']},'raw':!![]})[_0x6990('0xa')](function(_0xc29df2){if(_0xc29df2){var _0xfd415b={'where':{'id':_[_0x6990('0x17')](_0xc29df2,_0x6990('0x16'))},'raw':!![]};switch(_0x58583a){case'User':_0xfd415b['where'][_0x6990('0x5')]=_0x6990('0x6');break;case _0x6990('0x18'):_0xfd415b[_0x6990('0x19')][_0x6990('0x1a')]=_0x6990('0x8');break;}return db[_0x58583a][_0x6990('0x13')](_0xfd415b);}else{return[];}});}}else{return[];}})[_0x6990('0xa')](function(_0xf6aa9b){return _0xf6aa9b;});}function joinOrLeaveQueues(_0x4e39af,_0x410c90,_0x20dff8,_0x57c9ad){_0x4e39af[_0x410c90](util['format'](_0x6990('0x1b'),_0x20dff8,_0x57c9ad[_0x6990('0x3')]));if(_0x57c9ad['Agents']){for(var _0x2c7266=0x0;_0x2c7266<_0x57c9ad[_0x6990('0x1c')][_0x6990('0x1d')];_0x2c7266+=0x1){_0x4e39af[_0x410c90](util[_0x6990('0x1e')]('user:%s',_0x57c9ad[_0x6990('0x1c')][_0x2c7266][_0x6990('0x3')]));}}}function joinOrLeave(_0xc86509,_0x37f2a2,_0xac87a6){var _0x575e22;if(_0xc86509['handshake'][_0x6990('0x1f')]['id']){db['User'][_0x6990('0x20')]({'attributes':['id',_0x6990('0x3'),'role',_0x6990('0x21')],'where':{'id':_0xc86509[_0x6990('0x22')][_0x6990('0x1f')]['id']},'include':[{'model':db[_0x6990('0x23')],'as':_0x6990('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x6990('0x25')],'as':_0x6990('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x6990('0x27')],'as':_0x6990('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x6990('0x29')],'as':_0x6990('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x6990('0x2b')],'as':_0x6990('0x2c'),'attributes':['id'],'raw':!![]},{'model':db[_0x6990('0x2d')],'as':_0x6990('0x2e'),'attributes':['id'],'raw':!![]}]})[_0x6990('0xa')](function(_0x42b755){if(_0x42b755){_0x575e22=_0x42b755;_0xc86509[_0x37f2a2](util[_0x6990('0x1e')](_0x6990('0x2f'),_0x42b755[_0x6990('0x3')]));var _0x57e073=[];switch(_0x42b755[_0x6990('0x5')]){case'admin':_0xc86509[_0x37f2a2]('voice:inbound');_0xc86509[_0x37f2a2](_0x6990('0x30'));if(queryQueues[_0x6990('0x31')](_0x6990('0x32'))){delete queryQueues[_0x6990('0x32')];}_0x57e073[_0x6990('0x33')](db[_0x6990('0x34')][_0x6990('0x13')](queryQueues));_0x57e073[_0x6990('0x33')](db[_0x6990('0x35')][_0x6990('0x13')](queryQueues));_0x57e073[_0x6990('0x33')](db[_0x6990('0x36')]['findAll'](queryQueues));_0x57e073['push'](db['SmsQueue']['findAll'](queryQueues));_0x57e073[_0x6990('0x33')](db[_0x6990('0x37')]['findAll'](queryQueues));_0x57e073[_0x6990('0x33')](db['OpenchannelQueue'][_0x6990('0x13')](queryQueues));_0x57e073['push'](db[_0x6990('0x38')][_0x6990('0x13')](queryQueues));_0x57e073[_0x6990('0x33')](db[_0x6990('0x4')][_0x6990('0x13')](queryTelephones));_0x57e073['push'](db['Trunk'][_0x6990('0x13')](queryTrunks));_0x57e073[_0x6990('0x33')](db[_0x6990('0x18')]['findAll'](queryCampaigns));_0x57e073['push'](db['User'][_0x6990('0x13')](queryAgents));break;case'user':_0xc86509[_0x37f2a2](_0x6990('0x39'));_0xc86509[_0x37f2a2](_0x6990('0x30'));_0x57e073['push'](getAssociatedResources(_0x6990('0xc'),_0x42b755[_0x6990('0x21')],_0x6990('0x34')));_0x57e073[_0x6990('0x33')](getAssociatedResources(_0x6990('0xd'),_0x42b755[_0x6990('0x21')],_0x6990('0x35')));_0x57e073[_0x6990('0x33')](getAssociatedResources('FaxQueues',_0x42b755['userProfileId'],_0x6990('0x36')));_0x57e073[_0x6990('0x33')](getAssociatedResources(_0x6990('0xf'),_0x42b755[_0x6990('0x21')],_0x6990('0x3a')));_0x57e073[_0x6990('0x33')](getAssociatedResources(_0x6990('0x10'),_0x42b755[_0x6990('0x21')],_0x6990('0x37')));_0x57e073['push'](getAssociatedResources(_0x6990('0x11'),_0x42b755[_0x6990('0x21')],_0x6990('0x3b')));_0x57e073[_0x6990('0x33')](getAssociatedResources('WhatsappQueues',_0x42b755['userProfileId'],_0x6990('0x38')));_0x57e073['push'](getAssociatedResources('Telephones',_0x42b755[_0x6990('0x21')],_0x6990('0x4')));_0x57e073['push'](getAssociatedResources(_0x6990('0x3c'),_0x42b755[_0x6990('0x21')],'Trunk'));_0x57e073[_0x6990('0x33')](getAssociatedResources(_0x6990('0x15'),_0x42b755[_0x6990('0x21')],_0x6990('0x18')));_0x57e073[_0x6990('0x33')](db[_0x6990('0x4')][_0x6990('0x13')](queryAgents));break;case _0x6990('0x7'):_0xc86509[_0x37f2a2](_0x6990('0x39'));_0xc86509[_0x37f2a2](_0x6990('0x30'));_0x57e073[_0x6990('0x33')](_0x42b755[_0x6990('0x3d')]({'attributes':['id',_0x6990('0x3')]}));_0x57e073['push'](_0x42b755[_0x6990('0x3e')]({'attributes':['id',_0x6990('0x3')]}));_0x57e073['push'](_0x42b755[_0x6990('0x3f')]({'attributes':['id',_0x6990('0x3')]}));_0x57e073['push'](_0x42b755[_0x6990('0x40')]({'attributes':['id',_0x6990('0x3')]}));_0x57e073[_0x6990('0x33')](_0x42b755[_0x6990('0x41')]({'attributes':['id',_0x6990('0x3')]}));_0x57e073[_0x6990('0x33')](_0x42b755[_0x6990('0x42')]({'attributes':['id',_0x6990('0x3')]}));_0x57e073[_0x6990('0x33')](_0x42b755[_0x6990('0x43')]({'attributes':['id',_0x6990('0x3')]}));break;}return BPromise['all'](_0x57e073);}})['then'](function(_0x174871){if(_0x174871&&_0x174871[_0x6990('0x1d')]){for(var _0x5730c6=0x0;_0x5730c6<_0x174871[_0x6990('0x1d')];_0x5730c6+=0x1){for(var _0x31ad3b=0x0;_0x31ad3b<_0x174871[_0x5730c6][_0x6990('0x1d')];_0x31ad3b+=0x1){switch(_0x5730c6){case 0x0:joinOrLeaveQueues(_0xc86509,_0x37f2a2,_0x6990('0x44'),_0x174871[_0x5730c6][_0x31ad3b]);break;case 0x1:joinOrLeaveQueues(_0xc86509,_0x37f2a2,'chat',_0x174871[_0x5730c6][_0x31ad3b]);break;case 0x2:joinOrLeaveQueues(_0xc86509,_0x37f2a2,'fax',_0x174871[_0x5730c6][_0x31ad3b]);break;case 0x3:joinOrLeaveQueues(_0xc86509,_0x37f2a2,_0x6990('0x45'),_0x174871[_0x5730c6][_0x31ad3b]);break;case 0x4:joinOrLeaveQueues(_0xc86509,_0x37f2a2,_0x6990('0x46'),_0x174871[_0x5730c6][_0x31ad3b]);break;case 0x5:joinOrLeaveQueues(_0xc86509,_0x37f2a2,_0x6990('0x47'),_0x174871[_0x5730c6][_0x31ad3b]);break;case 0x6:joinOrLeaveQueues(_0xc86509,_0x37f2a2,_0x6990('0x48'),_0x174871[_0x5730c6][_0x31ad3b]);break;case 0x7:if(_0x575e22[_0x6990('0x5')]!=='agent')_0xc86509[_0x37f2a2](util[_0x6990('0x1e')]('telephone:%s',_0x174871[_0x5730c6][_0x31ad3b][_0x6990('0x3')]));break;case 0x8:if(_0x575e22['role']!==_0x6990('0x7'))_0xc86509[_0x37f2a2](util[_0x6990('0x1e')]('trunk:%s',_0x174871[_0x5730c6][_0x31ad3b]['name']));break;case 0x9:if(_0x575e22[_0x6990('0x5')]!=='agent')_0xc86509[_0x37f2a2](util[_0x6990('0x1e')]('campaign:%s:%s',_0x174871[_0x5730c6][_0x31ad3b][_0x6990('0x1a')],_0x174871[_0x5730c6][_0x31ad3b][_0x6990('0x3')]));break;case 0xa:_0xc86509[_0x37f2a2](util[_0x6990('0x1e')](_0x6990('0x2f'),_0x174871[_0x5730c6][_0x31ad3b][_0x6990('0x3')]));break;}}}}})[_0x6990('0xa')](function(){if(_0x37f2a2==='leave'){var _0x25a178=_['map'](_0x575e22[_0x6990('0x24')],'id');return _0x575e22[_0x6990('0x49')](_0x25a178)['then'](function(){for(var _0x558569=0x0;_0x558569<_0x25a178[_0x6990('0x1d')];_0x558569+=0x1){_0xac87a6[_0x6990('0x4a')](_0x6990('0x4b'),{'ChatInteractionId':Number(_0x25a178[_0x558569]),'UserId':Number(_0x575e22['id'])});}});}})['then'](function(){if(_0x37f2a2==='leave'){var _0xd45798=_[_0x6990('0x17')](_0x575e22['MailInteractions'],'id');return _0x575e22[_0x6990('0x4c')](_0xd45798)[_0x6990('0xa')](function(){for(var _0x182116=0x0;_0x182116<_0xd45798[_0x6990('0x1d')];_0x182116+=0x1){_0xac87a6[_0x6990('0x4a')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0xd45798[_0x182116]),'UserId':Number(_0x575e22['id'])});}});}})[_0x6990('0xa')](function(){if(_0x37f2a2===_0x6990('0x4d')){var _0x4d9ce1=_['map'](_0x575e22[_0x6990('0x28')],'id');return _0x575e22[_0x6990('0x4e')](_0x4d9ce1)[_0x6990('0xa')](function(){for(var _0x1fc421=0x0;_0x1fc421<_0x4d9ce1['length'];_0x1fc421+=0x1){_0xac87a6[_0x6990('0x4a')](_0x6990('0x4f'),{'FaxInteractionId':Number(_0x4d9ce1[_0x1fc421]),'UserId':Number(_0x575e22['id'])});}});}})[_0x6990('0xa')](function(){if(_0x37f2a2===_0x6990('0x4d')){var _0x411137=_['map'](_0x575e22[_0x6990('0x2a')],'id');return _0x575e22[_0x6990('0x50')](_0x411137)['then'](function(){for(var _0x1dd41d=0x0;_0x1dd41d<_0x411137[_0x6990('0x1d')];_0x1dd41d+=0x1){_0xac87a6[_0x6990('0x4a')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x411137[_0x1dd41d]),'UserId':Number(_0x575e22['id'])});}});}})['then'](function(){if(_0x37f2a2===_0x6990('0x4d')){var _0x122c90=_[_0x6990('0x17')](_0x575e22['OpenchannelInteractions'],'id');return _0x575e22[_0x6990('0x51')](_0x122c90)[_0x6990('0xa')](function(){for(var _0x3cb363=0x0;_0x3cb363<_0x122c90['length'];_0x3cb363+=0x1){_0xac87a6['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x122c90[_0x3cb363]),'UserId':Number(_0x575e22['id'])});}});}})[_0x6990('0xa')](function(){if(_0x37f2a2===_0x6990('0x4d')){var _0xaa3f44=_[_0x6990('0x17')](_0x575e22[_0x6990('0x2e')],'id');return _0x575e22['removeWhatsappInteractions'](_0xaa3f44)['then'](function(){for(var _0x459a9f=0x0;_0x459a9f<_0xaa3f44[_0x6990('0x1d')];_0x459a9f+=0x1){_0xac87a6['emit'](_0x6990('0x52'),{'WhatsappInteractionId':Number(_0xaa3f44[_0x459a9f]),'UserId':Number(_0x575e22['id'])});}});}})[_0x6990('0x53')](function(_0x36ce04){_0xc86509['log'](_0x36ce04);});}}function onDisconnect(_0x4b9560,_0x596d71){joinOrLeave(_0x4b9560,_0x6990('0x4d'),_0x596d71);}function onConnect(_0x169623){joinOrLeave(_0x169623,'join');}exports['default']=function(_0x3a4c07){_0x3a4c07['on'](_0x6990('0x54'),function(_0x173655){_0x173655[_0x6990('0x55')](0x0);_0x173655[_0x6990('0x56')]=_0x173655['request'][_0x6990('0x54')][_0x6990('0x57')]+':'+_0x173655[_0x6990('0x58')][_0x6990('0x54')]['remotePort'];_0x173655[_0x6990('0x59')]=new Date();_0x173655[_0x6990('0x5a')]=function(_0x58e5f5){console['log'](_0x6990('0x5b')+_0x173655[_0x6990('0x5c')]['name']+'['+_0x173655[_0x6990('0x56')]+']',_0x58e5f5);};_0x173655['on'](_0x6990('0x5d'),function(){onDisconnect(_0x173655,_0x3a4c07);_0x173655[_0x6990('0x5a')](_0x6990('0x5e'));});onConnect(_0x173655);_0x173655['log']('CONNECTED');});}; \ No newline at end of file +var _0x71af=['findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','role','Campaign','where','%s:queue:%s','length','user:%s','query','find','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','format','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','userProfileId','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','telephone','agent','type','ivr','UserProfileSection'];(function(_0x54f856,_0x495b0c){var _0x5bb94e=function(_0x552109){while(--_0x552109){_0x54f856['push'](_0x54f856['shift']());}};_0x5bb94e(++_0x495b0c);}(_0x71af,0x194));var _0xf71a=function(_0x597193,_0x5057b3){_0x597193=_0x597193-0x0;var _0x58cefc=_0x71af[_0x597193];return _0x58cefc;};'use strict';var _=require(_0xf71a('0x0'));var util=require(_0xf71a('0x1'));var BPromise=require('bluebird');var db=require(_0xf71a('0x2'))['db'];var config=require(_0xf71a('0x3'));var queryQueues={'attributes':['id',_0xf71a('0x4')],'include':[{'as':_0xf71a('0x5'),'model':db[_0xf71a('0x6')],'attributes':['id',_0xf71a('0x4'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xf71a('0x4')],'where':{'role':_0xf71a('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xf71a('0x4')]};var queryAgents={'raw':!![],'attributes':['id',_0xf71a('0x4')],'where':{'role':_0xf71a('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xf71a('0x4'),_0xf71a('0x9')],'where':{'type':_0xf71a('0xa')}};function getAssociatedResources(_0x64f252,_0x22cb0b,_0x4c5760){return db[_0xf71a('0xb')][_0xf71a('0xc')]({'where':{'name':_0x64f252,'userProfileId':_0x22cb0b},'raw':!![]})['then'](function(_0x331793){if(_0x331793){if(_0x331793[_0xf71a('0xd')]){switch(_0x64f252){case _0xf71a('0xe'):case _0xf71a('0xf'):case _0xf71a('0x10'):case'SmsQueues':case _0xf71a('0x11'):case _0xf71a('0x12'):case _0xf71a('0x13'):return db[_0x4c5760][_0xf71a('0x14')](queryQueues);case _0xf71a('0x15'):return db[_0x4c5760][_0xf71a('0x14')](queryTelephones);case _0xf71a('0x16'):return db[_0x4c5760][_0xf71a('0x14')](queryTrunks);case _0xf71a('0x17'):return db[_0x4c5760]['findAll'](queryCampaigns);}}else{return db[_0xf71a('0x18')][_0xf71a('0x14')]({'attributes':[_0xf71a('0x19')],'where':{'sectionId':_0x331793['id']},'raw':!![]})[_0xf71a('0x1a')](function(_0x49fd2a){if(_0x49fd2a){var _0x3c7ab2={'where':{'id':_[_0xf71a('0x1b')](_0x49fd2a,_0xf71a('0x19'))},'raw':!![]};switch(_0x4c5760){case _0xf71a('0x6'):_0x3c7ab2['where'][_0xf71a('0x1c')]=_0xf71a('0x7');break;case _0xf71a('0x1d'):_0x3c7ab2[_0xf71a('0x1e')]['type']=_0xf71a('0xa');break;}return db[_0x4c5760][_0xf71a('0x14')](_0x3c7ab2);}else{return[];}});}}else{return[];}})[_0xf71a('0x1a')](function(_0x1e35f3){return _0x1e35f3;});}function joinOrLeaveQueues(_0xb0da6c,_0x50271a,_0x189e22,_0x566b6d){_0xb0da6c[_0x50271a](util['format'](_0xf71a('0x1f'),_0x189e22,_0x566b6d[_0xf71a('0x4')]));if(_0x566b6d[_0xf71a('0x5')]){for(var _0x2b3a3e=0x0;_0x2b3a3e<_0x566b6d[_0xf71a('0x5')][_0xf71a('0x20')];_0x2b3a3e+=0x1){_0xb0da6c[_0x50271a](util['format'](_0xf71a('0x21'),_0x566b6d[_0xf71a('0x5')][_0x2b3a3e][_0xf71a('0x4')]));}}}function joinOrLeave(_0x46ca5b,_0x5c07e8,_0x22f274){var _0x55fce9;if(_0x46ca5b['handshake'][_0xf71a('0x22')]['id']){db[_0xf71a('0x6')][_0xf71a('0x23')]({'attributes':['id',_0xf71a('0x4'),_0xf71a('0x1c'),'userProfileId'],'where':{'id':_0x46ca5b['handshake'][_0xf71a('0x22')]['id']},'include':[{'model':db[_0xf71a('0x24')],'as':_0xf71a('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xf71a('0x26')],'as':_0xf71a('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xf71a('0x28')],'as':_0xf71a('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xf71a('0x2a')],'as':_0xf71a('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0xf71a('0x2c')],'as':_0xf71a('0x2d'),'attributes':['id'],'raw':!![]},{'model':db[_0xf71a('0x2e')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xf71a('0x1a')](function(_0x25fc63){if(_0x25fc63){_0x55fce9=_0x25fc63;_0x46ca5b[_0x5c07e8](util[_0xf71a('0x2f')](_0xf71a('0x21'),_0x25fc63['name']));var _0x53963c=[];switch(_0x25fc63['role']){case'admin':_0x46ca5b[_0x5c07e8](_0xf71a('0x30'));_0x46ca5b[_0x5c07e8](_0xf71a('0x31'));if(queryQueues[_0xf71a('0x32')](_0xf71a('0x33'))){delete queryQueues[_0xf71a('0x33')];}_0x53963c[_0xf71a('0x34')](db[_0xf71a('0x35')][_0xf71a('0x14')](queryQueues));_0x53963c['push'](db[_0xf71a('0x36')][_0xf71a('0x14')](queryQueues));_0x53963c[_0xf71a('0x34')](db[_0xf71a('0x37')][_0xf71a('0x14')](queryQueues));_0x53963c['push'](db[_0xf71a('0x38')][_0xf71a('0x14')](queryQueues));_0x53963c['push'](db[_0xf71a('0x39')][_0xf71a('0x14')](queryQueues));_0x53963c['push'](db[_0xf71a('0x3a')][_0xf71a('0x14')](queryQueues));_0x53963c['push'](db[_0xf71a('0x3b')][_0xf71a('0x14')](queryQueues));_0x53963c[_0xf71a('0x34')](db[_0xf71a('0x6')][_0xf71a('0x14')](queryTelephones));_0x53963c[_0xf71a('0x34')](db['Trunk']['findAll'](queryTrunks));_0x53963c[_0xf71a('0x34')](db[_0xf71a('0x1d')][_0xf71a('0x14')](queryCampaigns));_0x53963c['push'](db[_0xf71a('0x6')]['findAll'](queryAgents));break;case _0xf71a('0x3c'):_0x46ca5b[_0x5c07e8](_0xf71a('0x30'));_0x46ca5b[_0x5c07e8](_0xf71a('0x31'));_0x53963c[_0xf71a('0x34')](getAssociatedResources('VoiceQueues',_0x25fc63[_0xf71a('0x3d')],_0xf71a('0x35')));_0x53963c['push'](getAssociatedResources(_0xf71a('0xf'),_0x25fc63['userProfileId'],_0xf71a('0x36')));_0x53963c[_0xf71a('0x34')](getAssociatedResources(_0xf71a('0x10'),_0x25fc63[_0xf71a('0x3d')],_0xf71a('0x37')));_0x53963c[_0xf71a('0x34')](getAssociatedResources('SmsQueues',_0x25fc63[_0xf71a('0x3d')],_0xf71a('0x38')));_0x53963c['push'](getAssociatedResources(_0xf71a('0x11'),_0x25fc63[_0xf71a('0x3d')],_0xf71a('0x39')));_0x53963c[_0xf71a('0x34')](getAssociatedResources(_0xf71a('0x12'),_0x25fc63[_0xf71a('0x3d')],'OpenchannelQueue'));_0x53963c[_0xf71a('0x34')](getAssociatedResources(_0xf71a('0x13'),_0x25fc63[_0xf71a('0x3d')],'WhatsappQueue'));_0x53963c[_0xf71a('0x34')](getAssociatedResources(_0xf71a('0x15'),_0x25fc63['userProfileId'],_0xf71a('0x6')));_0x53963c[_0xf71a('0x34')](getAssociatedResources(_0xf71a('0x16'),_0x25fc63[_0xf71a('0x3d')],_0xf71a('0x3e')));_0x53963c[_0xf71a('0x34')](getAssociatedResources(_0xf71a('0x17'),_0x25fc63[_0xf71a('0x3d')],_0xf71a('0x1d')));_0x53963c[_0xf71a('0x34')](db[_0xf71a('0x6')][_0xf71a('0x14')](queryAgents));break;case _0xf71a('0x8'):_0x46ca5b[_0x5c07e8](_0xf71a('0x30'));_0x46ca5b[_0x5c07e8]('voice:outbound');_0x53963c[_0xf71a('0x34')](_0x25fc63[_0xf71a('0x3f')]({'attributes':['id',_0xf71a('0x4')]}));_0x53963c[_0xf71a('0x34')](_0x25fc63[_0xf71a('0x40')]({'attributes':['id',_0xf71a('0x4')]}));_0x53963c[_0xf71a('0x34')](_0x25fc63[_0xf71a('0x41')]({'attributes':['id',_0xf71a('0x4')]}));_0x53963c['push'](_0x25fc63[_0xf71a('0x42')]({'attributes':['id','name']}));_0x53963c['push'](_0x25fc63['getMailQueues']({'attributes':['id',_0xf71a('0x4')]}));_0x53963c['push'](_0x25fc63[_0xf71a('0x43')]({'attributes':['id',_0xf71a('0x4')]}));_0x53963c['push'](_0x25fc63[_0xf71a('0x44')]({'attributes':['id','name']}));break;}return BPromise[_0xf71a('0x45')](_0x53963c);}})[_0xf71a('0x1a')](function(_0x518ed0){if(_0x518ed0&&_0x518ed0[_0xf71a('0x20')]){for(var _0x36cf16=0x0;_0x36cf16<_0x518ed0[_0xf71a('0x20')];_0x36cf16+=0x1){for(var _0x212846=0x0;_0x212846<_0x518ed0[_0x36cf16][_0xf71a('0x20')];_0x212846+=0x1){switch(_0x36cf16){case 0x0:joinOrLeaveQueues(_0x46ca5b,_0x5c07e8,_0xf71a('0x46'),_0x518ed0[_0x36cf16][_0x212846]);break;case 0x1:joinOrLeaveQueues(_0x46ca5b,_0x5c07e8,'chat',_0x518ed0[_0x36cf16][_0x212846]);break;case 0x2:joinOrLeaveQueues(_0x46ca5b,_0x5c07e8,_0xf71a('0x47'),_0x518ed0[_0x36cf16][_0x212846]);break;case 0x3:joinOrLeaveQueues(_0x46ca5b,_0x5c07e8,_0xf71a('0x48'),_0x518ed0[_0x36cf16][_0x212846]);break;case 0x4:joinOrLeaveQueues(_0x46ca5b,_0x5c07e8,_0xf71a('0x49'),_0x518ed0[_0x36cf16][_0x212846]);break;case 0x5:joinOrLeaveQueues(_0x46ca5b,_0x5c07e8,_0xf71a('0x4a'),_0x518ed0[_0x36cf16][_0x212846]);break;case 0x6:joinOrLeaveQueues(_0x46ca5b,_0x5c07e8,_0xf71a('0x4b'),_0x518ed0[_0x36cf16][_0x212846]);break;case 0x7:if(_0x55fce9[_0xf71a('0x1c')]!==_0xf71a('0x8'))_0x46ca5b[_0x5c07e8](util[_0xf71a('0x2f')](_0xf71a('0x4c'),_0x518ed0[_0x36cf16][_0x212846][_0xf71a('0x4')]));break;case 0x8:if(_0x55fce9['role']!==_0xf71a('0x8'))_0x46ca5b[_0x5c07e8](util['format'](_0xf71a('0x4d'),_0x518ed0[_0x36cf16][_0x212846][_0xf71a('0x4')]));break;case 0x9:if(_0x55fce9[_0xf71a('0x1c')]!==_0xf71a('0x8'))_0x46ca5b[_0x5c07e8](util[_0xf71a('0x2f')](_0xf71a('0x4e'),_0x518ed0[_0x36cf16][_0x212846][_0xf71a('0x9')],_0x518ed0[_0x36cf16][_0x212846][_0xf71a('0x4')]));break;case 0xa:_0x46ca5b[_0x5c07e8](util[_0xf71a('0x2f')](_0xf71a('0x21'),_0x518ed0[_0x36cf16][_0x212846][_0xf71a('0x4')]));break;}}}}})[_0xf71a('0x1a')](function(){if(_0x5c07e8===_0xf71a('0x4f')){var _0x3ac4df=_[_0xf71a('0x1b')](_0x55fce9[_0xf71a('0x25')],'id');return _0x55fce9[_0xf71a('0x50')](_0x3ac4df)[_0xf71a('0x1a')](function(){for(var _0x237c81=0x0;_0x237c81<_0x3ac4df[_0xf71a('0x20')];_0x237c81+=0x1){_0x22f274[_0xf71a('0x51')](_0xf71a('0x52'),{'ChatInteractionId':Number(_0x3ac4df[_0x237c81]),'UserId':Number(_0x55fce9['id'])});}});}})[_0xf71a('0x1a')](function(){if(_0x5c07e8===_0xf71a('0x4f')){var _0x204f54=_[_0xf71a('0x1b')](_0x55fce9[_0xf71a('0x27')],'id');return _0x55fce9['removeMailInteractions'](_0x204f54)[_0xf71a('0x1a')](function(){for(var _0xfd2fea=0x0;_0xfd2fea<_0x204f54[_0xf71a('0x20')];_0xfd2fea+=0x1){_0x22f274[_0xf71a('0x51')](_0xf71a('0x53'),{'MailInteractionId':Number(_0x204f54[_0xfd2fea]),'UserId':Number(_0x55fce9['id'])});}});}})['then'](function(){if(_0x5c07e8==='leave'){var _0x398fdc=_[_0xf71a('0x1b')](_0x55fce9[_0xf71a('0x29')],'id');return _0x55fce9[_0xf71a('0x54')](_0x398fdc)[_0xf71a('0x1a')](function(){for(var _0x245dd0=0x0;_0x245dd0<_0x398fdc[_0xf71a('0x20')];_0x245dd0+=0x1){_0x22f274[_0xf71a('0x51')](_0xf71a('0x55'),{'FaxInteractionId':Number(_0x398fdc[_0x245dd0]),'UserId':Number(_0x55fce9['id'])});}});}})['then'](function(){if(_0x5c07e8===_0xf71a('0x4f')){var _0x4baf2f=_['map'](_0x55fce9[_0xf71a('0x2b')],'id');return _0x55fce9[_0xf71a('0x56')](_0x4baf2f)[_0xf71a('0x1a')](function(){for(var _0x44e2fc=0x0;_0x44e2fc<_0x4baf2f[_0xf71a('0x20')];_0x44e2fc+=0x1){_0x22f274[_0xf71a('0x51')](_0xf71a('0x57'),{'SmsInteractionId':Number(_0x4baf2f[_0x44e2fc]),'UserId':Number(_0x55fce9['id'])});}});}})[_0xf71a('0x1a')](function(){if(_0x5c07e8===_0xf71a('0x4f')){var _0x4fa4c6=_[_0xf71a('0x1b')](_0x55fce9['OpenchannelInteractions'],'id');return _0x55fce9['removeOpenchannelInteractions'](_0x4fa4c6)['then'](function(){for(var _0x32970e=0x0;_0x32970e<_0x4fa4c6[_0xf71a('0x20')];_0x32970e+=0x1){_0x22f274[_0xf71a('0x51')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x4fa4c6[_0x32970e]),'UserId':Number(_0x55fce9['id'])});}});}})[_0xf71a('0x1a')](function(){if(_0x5c07e8===_0xf71a('0x4f')){var _0x306577=_[_0xf71a('0x1b')](_0x55fce9[_0xf71a('0x58')],'id');return _0x55fce9[_0xf71a('0x59')](_0x306577)['then'](function(){for(var _0x1d2b01=0x0;_0x1d2b01<_0x306577[_0xf71a('0x20')];_0x1d2b01+=0x1){_0x22f274['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x306577[_0x1d2b01]),'UserId':Number(_0x55fce9['id'])});}});}})[_0xf71a('0x5a')](function(_0x4ecf87){_0x46ca5b[_0xf71a('0x5b')](_0x4ecf87);});}}function onDisconnect(_0x2de939,_0x59a548){joinOrLeave(_0x2de939,_0xf71a('0x4f'),_0x59a548);}function onConnect(_0x6b008){joinOrLeave(_0x6b008,_0xf71a('0x5c'));}exports[_0xf71a('0x5d')]=function(_0x1bc178){_0x1bc178['on'](_0xf71a('0x5e'),function(_0x55a0b4){_0x55a0b4[_0xf71a('0x5f')](0x0);_0x55a0b4[_0xf71a('0x60')]=_0x55a0b4[_0xf71a('0x61')][_0xf71a('0x5e')][_0xf71a('0x62')]+':'+_0x55a0b4[_0xf71a('0x61')]['connection'][_0xf71a('0x63')];_0x55a0b4['connectedAt']=new Date();_0x55a0b4[_0xf71a('0x5b')]=function(_0x26a0b7){console[_0xf71a('0x5b')](_0xf71a('0x64')+_0x55a0b4[_0xf71a('0x65')][_0xf71a('0x4')]+'['+_0x55a0b4['address']+']',_0x26a0b7);};_0x55a0b4['on']('disconnect',function(){onDisconnect(_0x55a0b4,_0x1bc178);_0x55a0b4[_0xf71a('0x5b')](_0xf71a('0x66'));});onConnect(_0x55a0b4);_0x55a0b4[_0xf71a('0x5b')](_0xf71a('0x67'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 28d6b87..1ee231e 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 _0x49b3=['SELECT','User','fullname','email','internal','interface','name','agent','incomingmessage','outgoingmessage','sequelize','contact','changed','closed','UserId','find','format','SIP/%s','default','length','model','callback','toLowerCase','../../mysqldb','../logger','triggers','lodash','client','afterCreate','newinteraction','Chat','ChatInteraction','afterUpdate','closedinteraction','newmessage','Sms','SmsInteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','motionChannel','event','direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','query','Sequelize','QueryTypes'];(function(_0x46f8f0,_0x31f2fc){var _0x319f23=function(_0x286c17){while(--_0x286c17){_0x46f8f0['push'](_0x46f8f0['shift']());}};_0x319f23(++_0x31f2fc);}(_0x49b3,0x123));var _0x349b=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0x49b3[_0x53cf8e];return _0x459197;};'use strict';var util=require('util');var db=require(_0x349b('0x0'))['db'];var jayson=require('jayson/promise');var logger=require(_0x349b('0x1'))(_0x349b('0x2'));var _=require(_0x349b('0x3'));var client=jayson[_0x349b('0x4')]['http']({'port':0x232a});var triggers=[{'channel':'Chat','model':'ChatInteraction','event':_0x349b('0x5'),'condition':_0x349b('0x6'),'callback':afterCreate},{'channel':_0x349b('0x7'),'model':_0x349b('0x8'),'event':_0x349b('0x9'),'condition':_0x349b('0xa'),'callback':afterUpdate},{'channel':_0x349b('0x7'),'model':'ChatMessage','event':_0x349b('0x5'),'condition':_0x349b('0xb'),'callback':afterCreateMessage},{'channel':_0x349b('0xc'),'model':'SmsInteraction','event':'afterCreate','condition':_0x349b('0x6'),'callback':afterCreate},{'channel':_0x349b('0xc'),'model':_0x349b('0xd'),'event':_0x349b('0x9'),'condition':_0x349b('0xa'),'callback':afterUpdate},{'channel':_0x349b('0xc'),'model':'SmsMessage','event':'afterCreate','condition':_0x349b('0xb'),'callback':afterCreateMessage},{'channel':_0x349b('0xe'),'model':_0x349b('0xf'),'event':_0x349b('0x5'),'condition':_0x349b('0x6'),'callback':afterCreate},{'channel':_0x349b('0xe'),'model':_0x349b('0xf'),'event':_0x349b('0x9'),'condition':_0x349b('0xa'),'callback':afterUpdate},{'channel':_0x349b('0xe'),'model':_0x349b('0x10'),'event':'afterCreate','condition':_0x349b('0xb'),'callback':afterCreateMessage},{'channel':_0x349b('0x11'),'model':_0x349b('0x12'),'event':_0x349b('0x5'),'condition':_0x349b('0x6'),'callback':afterCreate},{'channel':_0x349b('0x11'),'model':'FaxInteraction','event':_0x349b('0x9'),'condition':_0x349b('0xa'),'callback':afterUpdate},{'channel':'Fax','model':_0x349b('0x13'),'event':_0x349b('0x5'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x349b('0x14'),'model':'MailInteraction','event':_0x349b('0x5'),'condition':_0x349b('0x6'),'callback':afterCreate},{'channel':'Mail','model':_0x349b('0x15'),'event':_0x349b('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x349b('0x14'),'model':_0x349b('0x16'),'event':_0x349b('0x5'),'condition':_0x349b('0xb'),'callback':afterCreateMessage},{'channel':_0x349b('0x17'),'model':_0x349b('0x18'),'event':_0x349b('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x349b('0x17'),'model':'OpenchannelInteraction','event':'afterUpdate','condition':_0x349b('0xa'),'callback':afterUpdate},{'channel':_0x349b('0x17'),'model':_0x349b('0x19'),'event':_0x349b('0x5'),'condition':_0x349b('0xb'),'callback':afterCreateMessage}];function request(_0x3b79eb){return client[_0x349b('0x1a')](_0x349b('0x1b'),_0x3b79eb)[_0x349b('0x1c')](function(_0x1a60c8){logger[_0x349b('0x1d')](_0x349b('0x1e'),'EventManager',_0x1a60c8);if(_0x1a60c8[_0x349b('0x1f')]){if(_0x1a60c8[_0x349b('0x1f')][_0x349b('0x20')]===0x1f4){logger[_0x349b('0x1f')](_0x349b('0x1e'),_0x349b('0x1b'),_0x1a60c8[_0x349b('0x1f')]);}}})[_0x349b('0x21')](function(_0x2ab6f6){logger[_0x349b('0x1f')](_0x349b('0x1e'),_0x349b('0x1b'),_0x2ab6f6);});}function afterCreateMessage(_0x32432c,_0x564676){return function(_0x1e0701,_0x19a86d){_0x1e0701=_0x1e0701[_0x349b('0x22')]({'plain':!![]});_0x1e0701[_0x349b('0x23')]=_0x32432c;_0x1e0701[_0x349b('0x24')]=_0x32432c;_0x1e0701[_0x349b('0x25')]=_0x1e0701[_0x349b('0x26')];var _0x35b673=_0x349b('0x27')+_0x1e0701[_0x349b('0x28')];return db['sequelize'][_0x349b('0x29')](_0x35b673,{'type':db[_0x349b('0x2a')][_0x349b('0x2b')][_0x349b('0x2c')],'raw':!![]})['then'](function(_0x46111d){return _0x46111d;})[_0x349b('0x1c')](function(_0x6ec808){if(_0x6ec808){_0x1e0701['contact']=_0x6ec808[0x0];}if(_0x1e0701['UserId']){return db[_0x349b('0x2d')]['find']({'where':{'id':_0x1e0701['UserId']},'attributes':['id','name',_0x349b('0x2e'),_0x349b('0x2f'),_0x349b('0x30')],'raw':!![]})[_0x349b('0x1c')](function(_0x45927c){_0x1e0701[_0x349b('0x31')]=util['format']('SIP/%s',_0x45927c[_0x349b('0x32')]);_0x1e0701[_0x349b('0x23')]=_0x32432c;_0x1e0701[_0x349b('0x33')]=_0x45927c;return request({'event':_0x349b('0x34'),'message':_0x1e0701});})[_0x349b('0x21')](function(_0x49742b){console['error'](_0x49742b);});}else{return request({'event':_0x349b('0x35'),'message':_0x1e0701});}});};}function afterCreate(_0x581d72,_0x37463b){return function(_0x28a875,_0x15b761){_0x28a875=_0x28a875['get']({'plain':!![]});_0x28a875[_0x349b('0x23')]=_0x581d72;_0x28a875[_0x349b('0x24')]=_0x581d72;_0x28a875[_0x349b('0x25')]='opened';var _0x1a9fda=_0x349b('0x27')+_0x28a875[_0x349b('0x28')];return db[_0x349b('0x36')][_0x349b('0x29')](_0x1a9fda,{'type':db[_0x349b('0x2a')][_0x349b('0x2b')][_0x349b('0x2c')],'raw':!![]})[_0x349b('0x1c')](function(_0x26eddb){return _0x26eddb;})[_0x349b('0x1c')](function(_0x51d58b){if(_0x51d58b){_0x28a875[_0x349b('0x37')]=_0x51d58b[0x0];}return request({'event':_0x37463b,'message':_0x28a875});});};}function afterUpdate(_0x127d10,_0xe94d6){return function(_0x122fe3,_0x4b7d75){if(_0x122fe3[_0x349b('0x38')](_0x349b('0x39'))&&_0x122fe3[_0x349b('0x39')]){_0x122fe3=_0x122fe3[_0x349b('0x22')]({'plain':!![]});_0x122fe3[_0x349b('0x23')]=_0x127d10;_0x122fe3['motionChannel']=_0x127d10;_0x122fe3[_0x349b('0x25')]=_0x349b('0x39');var _0x53cae4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x122fe3['ContactId'];return db['sequelize']['query'](_0x53cae4,{'type':db[_0x349b('0x2a')][_0x349b('0x2b')][_0x349b('0x2c')],'raw':!![]})[_0x349b('0x1c')](function(_0x1dbe9c){return _0x1dbe9c;})[_0x349b('0x1c')](function(_0x4f1a59){if(_0x4f1a59){_0x122fe3[_0x349b('0x37')]=_0x4f1a59[0x0];}if(_0x122fe3[_0x349b('0x3a')]){return db[_0x349b('0x2d')][_0x349b('0x3b')]({'where':{'id':_0x122fe3[_0x349b('0x3a')]},'attributes':['id',_0x349b('0x32'),_0x349b('0x2e'),_0x349b('0x2f'),_0x349b('0x30')],'raw':!![]})[_0x349b('0x1c')](function(_0xbaf09a){_0x122fe3[_0x349b('0x31')]=util[_0x349b('0x3c')](_0x349b('0x3d'),_0xbaf09a[_0x349b('0x32')]);_0x122fe3['agent']=_0xbaf09a;return request({'event':_0xe94d6,'message':_0x122fe3});})[_0x349b('0x21')](function(_0x179e83){console[_0x349b('0x1f')](_0x179e83);});}else{return request({'event':_0xe94d6,'message':_0x122fe3});}});}};}exports[_0x349b('0x3e')]=function(){for(var _0x4c6bf6=0x0;_0x4c6bf6=_0x573e59['agents']){throw Error(_0x220c('0x16'));}_0x505589(_0x4c6560);})['catch'](function(_0x3606b6){_0x19af3e(_0x3606b6);});});}; \ No newline at end of file +var _0x39f0=['openchannel','blockedAt','agent','User','count','then','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','./license/util','chat','fax','sms','whatsapp'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x39f0,0x19c));var _0x039f=function(_0x3fc761,_0x1a8210){_0x3fc761=_0x3fc761-0x0;var _0x5b3f46=_0x39f0[_0x3fc761];return _0x5b3f46;};'use strict';var _=require(_0x039f('0x0'));var BPromise=require(_0x039f('0x1'));var db=require(_0x039f('0x2'))['db'];var util=require(_0x039f('0x3'));var channels=['voice','mail',_0x039f('0x4'),_0x039f('0x5'),_0x039f('0x6'),_0x039f('0x7'),_0x039f('0x8')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0x5b09f7){_0x5b09f7=_0x5b09f7['toLowerCase']();return _['includes'](channels,_0x5b09f7);};exports['clearBlockUser']=function(_0x443d11,_0x346474,_0x30b9d1,_0x53e594){var _0x5f9365={'loginAttempts':_0x346474,'blocked':_0x30b9d1};if(!_['isUndefined'](_0x53e594)){_0x5f9365[_0x039f('0x9')]=_0x53e594;}return _0x443d11['updateAttributes'](_0x5f9365);};exports['getLicense']=function(_0x40f35a){return new BPromise(function(_0x2b9af5,_0x3b802e){var _0x296599=0x0;if(_0x40f35a['role']!==_0x039f('0xa')){_0x2b9af5(_0x40f35a);}db[_0x039f('0xb')][_0x039f('0xc')]({'where':{'role':_0x039f('0xa'),'online':!![],'id':{'$ne':_0x40f35a['id']}}})[_0x039f('0xd')](function(_0x3c2bb9){_0x296599=_0x3c2bb9;return util['getLicense']();})['then'](function(_0x43baa6){if(_0x43baa6&&_0x43baa6['agents']&&_0x296599>=_0x43baa6['agents']){throw Error(_0x039f('0xe'));}_0x2b9af5(_0x40f35a);})['catch'](function(_0x49a7d3){_0x3b802e(_0x49a7d3);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index a61b1aa..4a31166 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x787a=['render','json','exports','404','status'];(function(_0x52e35a,_0x58577d){var _0x2b0161=function(_0x226a98){while(--_0x226a98){_0x52e35a['push'](_0x52e35a['shift']());}};_0x2b0161(++_0x58577d);}(_0x787a,0x1ce));var _0xa787=function(_0x50ca4d,_0x1cc866){_0x50ca4d=_0x50ca4d-0x0;var _0x51f764=_0x787a[_0x50ca4d];return _0x51f764;};'use strict';module[_0xa787('0x0')][0x194]=function pageNotFound(_0x5b2600,_0x2ed7eb){var _0x5eed00=_0xa787('0x1');var _0x3fbb7c=0x194;var _0x424b5={'status':_0x3fbb7c};_0x2ed7eb['status'](_0x424b5[_0xa787('0x2')]);_0x2ed7eb[_0xa787('0x3')](_0x5eed00,{},function(_0x4d16d1,_0x4e87df){if(_0x4d16d1){return _0x2ed7eb[_0xa787('0x2')](_0x424b5[_0xa787('0x2')])[_0xa787('0x4')](_0x424b5);}_0x2ed7eb['send'](_0x4e87df);});}; \ No newline at end of file +var _0xd2be=['status','render','json','send','404'];(function(_0x3b9d5f,_0x2e9039){var _0x39924e=function(_0x5752ee){while(--_0x5752ee){_0x3b9d5f['push'](_0x3b9d5f['shift']());}};_0x39924e(++_0x2e9039);}(_0xd2be,0x86));var _0xed2b=function(_0x7a2ae4,_0x3dc896){_0x7a2ae4=_0x7a2ae4-0x0;var _0x1dd367=_0xd2be[_0x7a2ae4];return _0x1dd367;};'use strict';module['exports'][0x194]=function pageNotFound(_0x53c693,_0x1ef8b2){var _0x31a91d=_0xed2b('0x0');var _0x5643b8=0x194;var _0x591914={'status':_0x5643b8};_0x1ef8b2[_0xed2b('0x1')](_0x591914[_0xed2b('0x1')]);_0x1ef8b2[_0xed2b('0x2')](_0x31a91d,{},function(_0x1dccae,_0x5b5ec9){if(_0x1dccae){return _0x1ef8b2[_0xed2b('0x1')](_0x591914[_0xed2b('0x1')])[_0xed2b('0x3')](_0x591914);}_0x1ef8b2[_0xed2b('0x4')](_0x5b5ec9);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 5cdf0cb..fbee883 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6909=['../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/interval/interval.model','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','AnalyticCustomReport','AnalyticDefaultReport','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','../api/analyticFieldReport/analyticFieldReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','DeskConfiguration','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','cascade','hasMany','VoiceRecording','Recordings','UserId','VoiceQueuesRt','HopperFinals','HopperHistory','ReportAgentPreview','OpenchannelInteractions','ChatInteractions','FaxInteractions','MailInteractions','UserNotification','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','cm_user_has_contacts','Lists','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteraction','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueue','MailQueues','ChatQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','Applications','Sounds','moh_has_sounds','Members','CmHopper','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkBackupId','Interval','IntervalId','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','MailServerIn','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','List','ListId','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','team_has_mail_queues','Teams','MailInteractionId','Account','Contact','ContactId','Owner','mail_interaction_has_tags','Tags','Users','Attachments','Interaction','ChatWebsite','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','Items','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','ThroughTags','SmsAccount','SmsAccountId','SmsInteractionId','SmsMessage','SmsQueueId','OpenchannelAccountId','OpenchannelQueue','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','ProactiveActions','ChatQueue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatInternalMessage','Contacts','CompanyId','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','SmsApplications','Schedule','CustomReportId','Mohs','sms_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','DefaultReportId','Fields','MetricId','SalesforceAccount','Configurations','AccountId','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Variable','Subjects','Field','VariableId','DeskField','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerField','ServicenowField','FromId','JscriptyQuestionReport','SessionId','SmsQueueReport','JscriptyProject','ProjectId','user_has_teams','team_has_chat_queues','team_has_fax_queues','FaxQueues','team_has_sms_queues','team_has_openchannel_queues','TrunkId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','voice_queues_has_cm_lists','UserProfileSection','UserProfileSections','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappQueue','WhatsappInteractionId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','lodash','jstz','determine','defaultsDeep','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','mysql','name','utf8_general_ci','sequelizeHistory','utf8mb4','utf8','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue'];(function(_0xef049b,_0x5a7819){var _0x4cec9a=function(_0x306b82){while(--_0x306b82){_0xef049b['push'](_0xef049b['shift']());}};_0x4cec9a(++_0x5a7819);}(_0x6909,0x1c8));var _0x9690=function(_0x157f80,_0x105ced){_0x157f80=_0x157f80-0x0;var _0x12c361=_0x6909[_0x157f80];return _0x12c361;};'use strict';var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0x9690('0x0'));var jstz=require(_0x9690('0x1'));var timezone=jstz[_0x9690('0x2')]();config['sequelize']=_[_0x9690('0x3')](config[_0x9690('0x4')],{'database':_0x9690('0x5'),'username':_0x9690('0x6'),'password':_0x9690('0x7'),'options':{'host':_0x9690('0x8'),'port':0xcea,'dialect':_0x9690('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x9690('0xa')](),'define':{'charset':'utf8','collate':_0x9690('0xb')}}});config[_0x9690('0xc')]=_[_0x9690('0x3')](config[_0x9690('0xc')],{'database':_0x9690('0x5'),'username':_0x9690('0x6'),'password':_0x9690('0x7'),'options':{'host':_0x9690('0x8'),'port':0xcea,'dialect':_0x9690('0x9'),'dialectOptions':{'charset':_0x9690('0xd')},'logging':![],'timezone':timezone[_0x9690('0xa')](),'define':{'charset':_0x9690('0xe'),'collate':_0x9690('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9690('0x4')]['database'],config['sequelize'][_0x9690('0xf')],config['sequelize'][_0x9690('0x10')],config['sequelize'][_0x9690('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9690('0xc')]['database'],config[_0x9690('0xc')][_0x9690('0xf')],config[_0x9690('0xc')][_0x9690('0x10')],config[_0x9690('0xc')][_0x9690('0x11')])};db[_0x9690('0x12')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x14'));db[_0x9690('0x15')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x16'));db[_0x9690('0x17')]=db['sequelize']['import'](_0x9690('0x18'));db[_0x9690('0x19')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x1a'));db[_0x9690('0x1b')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x9690('0x1c')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db[_0x9690('0x4')]['import'](_0x9690('0x1d'));db[_0x9690('0x1e')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x1f'));db[_0x9690('0x20')]=db[_0x9690('0x4')]['import'](_0x9690('0x21'));db[_0x9690('0x22')]=db['sequelize'][_0x9690('0x13')](_0x9690('0x23'));db[_0x9690('0x24')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x25'));db['VoiceDialReport']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x26'));db[_0x9690('0x27')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x28'));db[_0x9690('0x29')]=db['sequelize'][_0x9690('0x13')](_0x9690('0x2a'));db[_0x9690('0x2b')]=db[_0x9690('0x4')]['import'](_0x9690('0x2c'));db[_0x9690('0x2d')]=db['sequelize'][_0x9690('0x13')](_0x9690('0x2e'));db[_0x9690('0x2f')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x30'));db[_0x9690('0x31')]=db[_0x9690('0x4')]['import'](_0x9690('0x32'));db[_0x9690('0x33')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0x9690('0x34')]=db[_0x9690('0x4')]['import'](_0x9690('0x35'));db['UserFaxQueue']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x36'));db['UserSmsQueue']=db['sequelize'][_0x9690('0x13')](_0x9690('0x37'));db[_0x9690('0x38')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x39'));db[_0x9690('0x3a')]=db[_0x9690('0x4')]['import'](_0x9690('0x3b'));db['MailServerIn']=db['sequelize']['import'](_0x9690('0x3c'));db[_0x9690('0x3d')]=db[_0x9690('0x4')]['import'](_0x9690('0x3e'));db[_0x9690('0x3f')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/mailAccount/mailAccount.model');db['MailQueue']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x40'));db[_0x9690('0x41')]=db[_0x9690('0x4')]['import'](_0x9690('0x42'));db[_0x9690('0x43')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x44'));db[_0x9690('0x45')]=db[_0x9690('0x4')]['import'](_0x9690('0x46'));db[_0x9690('0x47')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x48'));db[_0x9690('0x49')]=db['sequelize'][_0x9690('0x13')](_0x9690('0x4a'));db[_0x9690('0x4b')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x4c'));db[_0x9690('0x4d')]=db[_0x9690('0x4')]['import'](_0x9690('0x4e'));db[_0x9690('0x4f')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x50'));db[_0x9690('0x51')]=db[_0x9690('0x4')]['import'](_0x9690('0x52'));db[_0x9690('0x53')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0x9690('0x54')]=db[_0x9690('0x4')]['import']('../api/faxMessage/faxMessage.model');db[_0x9690('0x55')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x56'));db[_0x9690('0x57')]=db[_0x9690('0x4')]['import'](_0x9690('0x58'));db['SmsAccount']=db['sequelize']['import']('../api/smsAccount/smsAccount.model');db[_0x9690('0x59')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/smsApplication/smsApplication.model');db[_0x9690('0x5a')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x5b'));db['SmsMessage']=db['sequelize'][_0x9690('0x13')](_0x9690('0x5c'));db[_0x9690('0x5d')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x5e'));db[_0x9690('0x5f')]=db[_0x9690('0x4')]['import'](_0x9690('0x60'));db[_0x9690('0x61')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/openchannelApplication/openchannelApplication.model');db[_0x9690('0x62')]=db['sequelize']['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0x9690('0x63')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x64'));db['OpenchannelQueue']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x65'));db['ChatWebsite']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x66'));db[_0x9690('0x67')]=db['sequelize'][_0x9690('0x13')](_0x9690('0x68'));db[_0x9690('0x69')]=db['sequelize'][_0x9690('0x13')](_0x9690('0x6a'));db[_0x9690('0x6b')]=db['sequelize'][_0x9690('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0x9690('0x6c')]=db['sequelize'][_0x9690('0x13')]('../api/chatMessage/chatMessage.model');db[_0x9690('0x6d')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x6e'));db['ChatQueue']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x6f'));db[_0x9690('0x70')]=db[_0x9690('0x4')]['import'](_0x9690('0x71'));db[_0x9690('0x72')]=db[_0x9690('0x4')]['import']('../api/chatProactiveAction/chatProactiveAction.model');db[_0x9690('0x73')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x74'));db[_0x9690('0x75')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x76'));db['CmHopper']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x77'));db[_0x9690('0x78')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x79'));db[_0x9690('0x7a')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x7b'));db[_0x9690('0x7c')]=db[_0x9690('0x4')]['import'](_0x9690('0x7d'));db['ReportAgentPreview']=db['sequelize'][_0x9690('0x13')](_0x9690('0x7e'));db[_0x9690('0x7f')]=db['sequelize']['import']('../api/cmCustomField/cmCustomField.model');db[_0x9690('0x80')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x81'));db[_0x9690('0x82')]=db['sequelize'][_0x9690('0x13')](_0x9690('0x83'));db[_0x9690('0x84')]=db['sequelize'][_0x9690('0x13')](_0x9690('0x85'));db[_0x9690('0x86')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/disposition/disposition.model');db[_0x9690('0x87')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/condition/condition.model');db['Interval']=db[_0x9690('0x4')]['import'](_0x9690('0x88'));db[_0x9690('0x89')]=db[_0x9690('0x4')]['import']('../api/pause/pause.model');db[_0x9690('0x8a')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x8b'));db[_0x9690('0x8c')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x8d'));db['Schedule']=db[_0x9690('0x4')][_0x9690('0x13')]('../api/schedule/schedule.model');db[_0x9690('0x8e')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x8f'));db[_0x9690('0x90')]=db[_0x9690('0x4')]['import'](_0x9690('0x91'));db[_0x9690('0x92')]=db[_0x9690('0x4')]['import'](_0x9690('0x93'));db[_0x9690('0x94')]=db['sequelize'][_0x9690('0x13')](_0x9690('0x95'));db['Variable']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x96'));db['Integration']=db['sequelize']['import']('../api/integration/integration.model');db['IntegrationReport']=db[_0x9690('0x4')][_0x9690('0x13')]('../api/integrationReport/integrationReport.model');db[_0x9690('0x97')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x9690('0x98')]=db[_0x9690('0x4')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x9690('0x99')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x9690('0x9a')]=db['sequelize'][_0x9690('0x13')](_0x9690('0x9b'));db['AnalyticFieldReport']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x9c'));db['AnalyticTreeReport']=db[_0x9690('0x4')][_0x9690('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db['sequelize'][_0x9690('0x13')](_0x9690('0x9d'));db[_0x9690('0x9e')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x9f'));db[_0x9690('0xa0')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xa1'));db[_0x9690('0xa2')]=db['sequelize'][_0x9690('0x13')](_0x9690('0xa3'));db[_0x9690('0xa4')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xa5'));db[_0x9690('0xa6')]=db[_0x9690('0x4')]['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0x9690('0xa7')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/intDeskAccount/intDeskAccount.model');db[_0x9690('0xa8')]=db['sequelize'][_0x9690('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0x9690('0x4')][_0x9690('0x13')]('../api/intDeskField/intDeskField.model');db[_0x9690('0xa9')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xaa'));db[_0x9690('0xab')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xac'));db[_0x9690('0xad')]=db[_0x9690('0x4')]['import']('../api/intZohoField/intZohoField.model');db[_0x9690('0xae')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xaf'));db[_0x9690('0xb0')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xb1'));db[_0x9690('0xb2')]=db['sequelize']['import']('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x9690('0x4')]['import'](_0x9690('0xb3'));db[_0x9690('0xb4')]=db['sequelize']['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x9690('0xb5')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xb6'));db[_0x9690('0xb7')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xb8'));db[_0x9690('0xb9')]=db['sequelize']['import'](_0x9690('0xba'));db['VtigerField']=db[_0x9690('0x4')]['import'](_0x9690('0xbb'));db[_0x9690('0xbc')]=db[_0x9690('0x4')]['import'](_0x9690('0xbd'));db[_0x9690('0xbe')]=db['sequelize'][_0x9690('0x13')](_0x9690('0xbf'));db['ServicenowField']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xc0'));db[_0x9690('0xc1')]=db[_0x9690('0x4')]['import'](_0x9690('0xc2'));db[_0x9690('0xc3')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x9690('0xc4')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x9690('0xc5')]=db['sequelize']['import']('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x9690('0xc6')]=db[_0x9690('0x4')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x9690('0xc7')]=db['sequelize']['import'](_0x9690('0xc8'));db[_0x9690('0xc9')]=db[_0x9690('0x4')]['import'](_0x9690('0xca'));db[_0x9690('0xcb')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xcc'));db[_0x9690('0xcd')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xce'));db['ChatInternalMessage']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xcf'));db[_0x9690('0xd0')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db[_0x9690('0x4')]['import'](_0x9690('0xd1'));db[_0x9690('0xd2')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xd3'));db['SmsQueueReport']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xd4'));db[_0x9690('0xd5')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xd6'));db[_0x9690('0xd7')]=db['sequelize'][_0x9690('0x13')](_0x9690('0xd8'));db['JscriptyProject']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xd9'));db[_0x9690('0xda')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xdb'));db[_0x9690('0xdc')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xdd'));db['SquareProject']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xde'));db['SquareRecording']=db[_0x9690('0x4')]['import']('../api/squareRecording/squareRecording.model');db[_0x9690('0xdf')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xe0'));db[_0x9690('0xe1')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xe2'));db[_0x9690('0xe3')]=db['sequelize'][_0x9690('0x13')](_0x9690('0xe4'));db[_0x9690('0xe5')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xe6'));db[_0x9690('0xe7')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xe8'));db[_0x9690('0xe9')]=db['sequelize'][_0x9690('0x13')](_0x9690('0xea'));db[_0x9690('0xeb')]=db['sequelize']['import'](_0x9690('0xec'));db[_0x9690('0xed')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xee'));db[_0x9690('0xef')]=db['sequelize'][_0x9690('0x13')](_0x9690('0xf0'));db[_0x9690('0xf1')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0x9690('0xf2')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xf3'));db['SmsTransferReport']=db['sequelize']['import']('../api/smsTransferReport/smsTransferReport.model');db[_0x9690('0xf4')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xf5'));db[_0x9690('0xf6')]=db['sequelize'][_0x9690('0x13')](_0x9690('0xf7'));db[_0x9690('0xf8')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xf9'));db['UserProfileSection']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xfa'));db[_0x9690('0xfb')]=db[_0x9690('0x4')]['import'](_0x9690('0xfc'));db['UserNotification']=db[_0x9690('0x4')]['import'](_0x9690('0xfd'));db[_0x9690('0xfe')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0xff'));db[_0x9690('0x100')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x101'));db['WhatsappInteraction']=db[_0x9690('0x4')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0x9690('0x102')]=db['sequelize'][_0x9690('0x13')](_0x9690('0x103'));db[_0x9690('0x104')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x105'));db[_0x9690('0x106')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x107'));db[_0x9690('0x108')]=db[_0x9690('0x4')][_0x9690('0x13')](_0x9690('0x109'));db[_0x9690('0x10a')]=db[_0x9690('0x4')]['import'](_0x9690('0x10b'));db[_0x9690('0x10c')]=db[_0x9690('0x4')][_0x9690('0x13')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x9690('0x10d')]=db[_0x9690('0x4')]['import'](_0x9690('0x10e'));db[_0x9690('0x12')][_0x9690('0x10f')](db['VoiceMail'],{'as':_0x9690('0x20'),'onDelete':_0x9690('0x110'),'foreignKey':'UserId'});db['User'][_0x9690('0x111')](db[_0x9690('0x112')],{'as':_0x9690('0x113'),'foreignKey':_0x9690('0x114')});db[_0x9690('0x12')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x9690('0x115'),'foreignKey':_0x9690('0x114')});db[_0x9690('0x12')]['hasMany'](db[_0x9690('0x19')],{'as':'Extensions','onDelete':_0x9690('0x110'),'hooks':!![]});db[_0x9690('0x12')]['hasMany'](db['CmHopperFinal'],{'as':_0x9690('0x116'),'foreignKey':_0x9690('0x114')});db['User'][_0x9690('0x111')](db[_0x9690('0x7c')],{'as':_0x9690('0x117'),'foreignKey':_0x9690('0x114')});db[_0x9690('0x12')]['hasMany'](db[_0x9690('0x118')],{'as':_0x9690('0x118'),'foreignKey':_0x9690('0x114')});db[_0x9690('0x12')][_0x9690('0x111')](db[_0x9690('0x62')],{'as':_0x9690('0x119'),'foreignKey':'UserId'});db[_0x9690('0x12')]['hasMany'](db[_0x9690('0x6b')],{'as':_0x9690('0x11a'),'foreignKey':'UserId'});db[_0x9690('0x12')][_0x9690('0x111')](db[_0x9690('0x5a')],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0x9690('0x12')]['hasMany'](db['FaxInteraction'],{'as':_0x9690('0x11b'),'foreignKey':_0x9690('0x114')});db['User'][_0x9690('0x111')](db['MailInteraction'],{'as':_0x9690('0x11c'),'foreignKey':_0x9690('0x114')});db[_0x9690('0x12')][_0x9690('0x111')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0x9690('0x114')});db[_0x9690('0x12')][_0x9690('0x111')](db[_0x9690('0x11d')],{'as':_0x9690('0x11e'),'foreignKey':_0x9690('0x11f')});db['User'][_0x9690('0x120')](db[_0x9690('0xf8')],{'as':'UserProfile','foreignKey':_0x9690('0x121')});db[_0x9690('0x12')][_0x9690('0x122')](db[_0x9690('0x70')],{'as':'Groups','through':'chat_group_has_users'});db[_0x9690('0x12')][_0x9690('0x122')](db['CmContact'],{'as':'Contacts','through':_0x9690('0x123')});db[_0x9690('0x12')]['belongsToMany'](db[_0x9690('0xf4')],{'as':_0x9690('0x124'),'through':'cm_user_has_lists'});db['User'][_0x9690('0x122')](db[_0x9690('0xe1')],{'through':'user_has_teams'});db[_0x9690('0x12')]['belongsToMany'](db['MailInteraction'],{'as':_0x9690('0x11c'),'through':_0x9690('0x125')});db[_0x9690('0x12')][_0x9690('0x122')](db[_0x9690('0x6b')],{'as':'ChatInteractions','through':_0x9690('0x126')});db[_0x9690('0x12')][_0x9690('0x122')](db[_0x9690('0x53')],{'as':_0x9690('0x11b'),'through':_0x9690('0x127')});db[_0x9690('0x12')]['belongsToMany'](db[_0x9690('0x5a')],{'as':_0x9690('0x128'),'through':_0x9690('0x129')});db[_0x9690('0x12')][_0x9690('0x122')](db[_0x9690('0x62')],{'as':_0x9690('0x119'),'through':_0x9690('0x12a')});db[_0x9690('0x12')][_0x9690('0x122')](db[_0x9690('0x12b')],{'as':_0x9690('0x12c'),'through':_0x9690('0x12d')});db[_0x9690('0x12')][_0x9690('0x122')](db[_0x9690('0x1c')],{'as':_0x9690('0x12e'),'through':'UserVoiceQueue','required':![]});db[_0x9690('0x12')][_0x9690('0x122')](db[_0x9690('0xf6')],{'as':_0x9690('0x12f'),'through':'UserVoicePrefix','required':![]});db[_0x9690('0x12')]['belongsToMany'](db[_0x9690('0x130')],{'as':_0x9690('0x131'),'through':_0x9690('0x34'),'required':![]});db['User'][_0x9690('0x122')](db['ChatQueue'],{'as':_0x9690('0x132'),'through':_0x9690('0x33'),'required':![],'hooks':!![]});db[_0x9690('0x12')][_0x9690('0x122')](db[_0x9690('0x55')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db['User'][_0x9690('0x122')](db[_0x9690('0x5d')],{'as':_0x9690('0x133'),'through':_0x9690('0x134'),'required':![]});db[_0x9690('0x12')][_0x9690('0x122')](db['OpenchannelQueue'],{'as':_0x9690('0x135'),'through':_0x9690('0x38'),'required':![]});db[_0x9690('0x12')][_0x9690('0x122')](db['WhatsappQueue'],{'as':_0x9690('0x136'),'through':_0x9690('0x3a'),'required':![]});db[_0x9690('0x12')][_0x9690('0x122')](db[_0x9690('0xf4')],{'through':'cm_user_has_lists'});db[_0x9690('0x12')][_0x9690('0x122')](db[_0x9690('0xf6')],{'as':_0x9690('0x12f'),'through':_0x9690('0x137'),'required':![]});db[_0x9690('0x12')][_0x9690('0x122')](db['ChatWebsite'],{'as':_0x9690('0x138'),'through':_0x9690('0x139')});db[_0x9690('0x12')][_0x9690('0x122')](db[_0x9690('0x4f')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db['User'][_0x9690('0x122')](db[_0x9690('0x3f')],{'as':'MailAccounts','through':_0x9690('0x13a')});db[_0x9690('0x12')][_0x9690('0x122')](db[_0x9690('0x5f')],{'as':_0x9690('0x13b'),'through':_0x9690('0x13c')});db[_0x9690('0x12')][_0x9690('0x122')](db['SmsAccount'],{'as':'SmsAccounts','through':_0x9690('0x13d')});db['User'][_0x9690('0x122')](db[_0x9690('0xfe')],{'as':_0x9690('0x13e'),'through':'user_has_whatsapp_accounts'});db['User'][_0x9690('0x122')](db[_0x9690('0x13f')],{'as':_0x9690('0x140'),'through':_0x9690('0x141')});db[_0x9690('0x15')][_0x9690('0x111')](db[_0x9690('0x19')],{'as':_0x9690('0x142'),'onDelete':_0x9690('0x110'),'foreignKey':'ChanSpyId'});db[_0x9690('0x17')][_0x9690('0x111')](db[_0x9690('0x19')],{'onDelete':'cascade'});db['VoiceExtension'][_0x9690('0x111')](db[_0x9690('0x19')],{'as':_0x9690('0x143'),'onDelete':_0x9690('0x110')});db['VoiceMusicOnHold'][_0x9690('0x122')](db[_0x9690('0x8e')],{'as':_0x9690('0x144'),'through':_0x9690('0x145')});db[_0x9690('0x1c')][_0x9690('0x111')](db['UserVoiceQueueRt'],{'as':_0x9690('0x146'),'foreignKey':'VoiceQueueId'});db[_0x9690('0x1c')][_0x9690('0x111')](db[_0x9690('0x147')],{'as':_0x9690('0x148'),'foreignKey':'VoiceQueueId'});db[_0x9690('0x1c')][_0x9690('0x111')](db['CmHopperFinal'],{'as':_0x9690('0x116'),'foreignKey':_0x9690('0x149')});db[_0x9690('0x1c')][_0x9690('0x111')](db[_0x9690('0x7c')],{'as':_0x9690('0x14a'),'foreignKey':'VoiceQueueId'});db[_0x9690('0x1c')][_0x9690('0x111')](db[_0x9690('0x118')],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0x9690('0x1c')][_0x9690('0x111')](db['CmHopperBlack'],{'as':_0x9690('0x14b'),'foreignKey':_0x9690('0x149')});db[_0x9690('0x1c')]['hasMany'](db[_0x9690('0xd2')],{'as':_0x9690('0x14c'),'foreignKey':_0x9690('0x149')});db[_0x9690('0x1c')][_0x9690('0x120')](db[_0x9690('0x2d')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0x9690('0x1c')]['belongsTo'](db[_0x9690('0x2d')],{'as':'TrunkBackup','foreignKey':_0x9690('0x14d')});db[_0x9690('0x1c')]['belongsTo'](db['Interval'],{'as':_0x9690('0x14e'),'foreignKey':_0x9690('0x14f')});db[_0x9690('0x1c')][_0x9690('0x120')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x9690('0x1c')][_0x9690('0x122')](db['CmList'],{'as':_0x9690('0x124'),'through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0x9690('0x122')](db[_0x9690('0x12')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x9690('0x1c')][_0x9690('0x122')](db[_0x9690('0xe1')],{'as':'Teams','through':_0x9690('0x10a')});db[_0x9690('0x1c')][_0x9690('0x122')](db[_0x9690('0xf4')],{'as':_0x9690('0x150'),'through':_0x9690('0x151')});db[_0x9690('0x112')]['belongsTo'](db[_0x9690('0x12')],{'as':'User','foreignKey':_0x9690('0x114')});db['ScreenRecording'][_0x9690('0x120')](db['User'],{'as':_0x9690('0x12'),'foreignKey':_0x9690('0x114')});db[_0x9690('0x20')]['hasMany'](db['VoiceMailMessage'],{'as':_0x9690('0x152'),'onDelete':'cascade','foreignKey':_0x9690('0x153'),'sourceKey':_0x9690('0x154')});db[_0x9690('0x22')][_0x9690('0x120')](db['VoiceMail'],{'foreignKey':_0x9690('0x153'),'targetKey':_0x9690('0x154')});db[_0x9690('0x24')][_0x9690('0x111')](db[_0x9690('0x29')],{'as':_0x9690('0x155'),'foreignKey':_0x9690('0x156'),'constraints':![]});db[_0x9690('0x24')][_0x9690('0x111')](db[_0x9690('0x27')],{'as':_0x9690('0x157'),'foreignKey':_0x9690('0x156'),'constraints':![]});db['VoiceCallReport'][_0x9690('0x120')](db['User'],{'as':_0x9690('0x12'),'foreignKey':_0x9690('0x114')});db[_0x9690('0x24')][_0x9690('0x120')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x9690('0x158')][_0x9690('0x120')](db[_0x9690('0x3f')],{'as':_0x9690('0x3f'),'foreignKey':_0x9690('0x159')});db[_0x9690('0x3d')][_0x9690('0x120')](db[_0x9690('0x3f')],{'as':_0x9690('0x3f'),'foreignKey':'MailAccountId'});db[_0x9690('0x3f')][_0x9690('0x10f')](db[_0x9690('0x158')],{'as':_0x9690('0x15a'),'onDelete':_0x9690('0x110')});db[_0x9690('0x3f')]['hasOne'](db[_0x9690('0x3d')],{'as':_0x9690('0x15b'),'onDelete':_0x9690('0x110')});db[_0x9690('0x3f')][_0x9690('0x111')](db[_0x9690('0x86')],{'as':_0x9690('0x15c'),'foreignKey':'MailAccountId','onDelete':_0x9690('0x110')});db[_0x9690('0x3f')][_0x9690('0x111')](db[_0x9690('0x84')],{'as':_0x9690('0x15d'),'foreignKey':'MailAccountId'});db[_0x9690('0x3f')][_0x9690('0x111')](db[_0x9690('0x45')],{'as':_0x9690('0x152'),'foreignKey':_0x9690('0x159')});db[_0x9690('0x3f')][_0x9690('0x111')](db['MailInteraction'],{'as':_0x9690('0x15e')});db[_0x9690('0x3f')]['hasMany'](db[_0x9690('0x47')],{'as':_0x9690('0x143')});db[_0x9690('0x3f')][_0x9690('0x120')](db['CmList'],{'as':_0x9690('0x15f'),'foreignKey':_0x9690('0x160')});db['MailAccount'][_0x9690('0x120')](db[_0x9690('0x92')],{'as':_0x9690('0x92'),'foreignKey':_0x9690('0x161')});db[_0x9690('0x3f')]['belongsTo'](db[_0x9690('0x89')],{'as':_0x9690('0x162'),'foreignKey':_0x9690('0x163')});db[_0x9690('0x3f')]['belongsToMany'](db[_0x9690('0x12')],{'as':'Agents','through':_0x9690('0x13a')});db[_0x9690('0x130')]['belongsToMany'](db[_0x9690('0x12')],{'as':_0x9690('0x164'),'through':_0x9690('0x34')});db['MailQueue']['belongsToMany'](db['Team'],{'through':_0x9690('0x165'),'as':_0x9690('0x166')});db['MailInteraction'][_0x9690('0x111')](db[_0x9690('0x45')],{'as':'Messages','onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x167')});db[_0x9690('0x43')][_0x9690('0x120')](db[_0x9690('0x3f')],{'as':_0x9690('0x168'),'foreignKey':_0x9690('0x159')});db[_0x9690('0x43')][_0x9690('0x120')](db['CmContact'],{'as':_0x9690('0x169'),'foreignKey':_0x9690('0x16a')});db['MailInteraction']['belongsTo'](db[_0x9690('0x12')],{'as':_0x9690('0x16b'),'foreignKey':_0x9690('0x114')});db[_0x9690('0x43')][_0x9690('0x122')](db['Tag'],{'through':_0x9690('0x16c'),'as':_0x9690('0x16d')});db[_0x9690('0x43')][_0x9690('0x122')](db['Tag'],{'through':_0x9690('0x16c'),'as':'ThroughTags'});db['MailInteraction'][_0x9690('0x122')](db['User'],{'as':_0x9690('0x16e'),'through':_0x9690('0x125'),'foreignKey':_0x9690('0x167')});db['MailMessage'][_0x9690('0x111')](db['Attachment'],{'as':_0x9690('0x16f'),'onDelete':_0x9690('0x110')});db[_0x9690('0x45')][_0x9690('0x120')](db[_0x9690('0x12')],{'as':'User'});db[_0x9690('0x45')][_0x9690('0x120')](db[_0x9690('0x75')],{'onDelete':'cascade','as':_0x9690('0x169')});db[_0x9690('0x45')]['belongsTo'](db[_0x9690('0x43')],{'as':_0x9690('0x170'),'foreignKey':_0x9690('0x167')});db[_0x9690('0x45')]['belongsTo'](db[_0x9690('0x3f')],{'as':_0x9690('0x168'),'foreignKey':_0x9690('0x159')});db[_0x9690('0x45')][_0x9690('0x120')](db[_0x9690('0x171')],{'as':'ChatWebsite','foreignKey':_0x9690('0x172')});db[_0x9690('0x45')][_0x9690('0x120')](db['ChatOfflineMessage'],{'as':_0x9690('0x6d'),'foreignKey':_0x9690('0x173')});db[_0x9690('0x47')][_0x9690('0x120')](db[_0x9690('0x12')],{'onDelete':_0x9690('0x174')});db[_0x9690('0x47')][_0x9690('0x120')](db['MailQueue'],{'onDelete':_0x9690('0x174')});db['MailApplication'][_0x9690('0x120')](db[_0x9690('0x3f')],{'onDelete':_0x9690('0x174')});db[_0x9690('0x47')][_0x9690('0x120')](db[_0x9690('0x14e')],{'onDelete':'restrict','foreignKey':_0x9690('0x14f')});db['MailApplication'][_0x9690('0x120')](db[_0x9690('0x90')],{'onDelete':_0x9690('0x174'),'foreignKey':_0x9690('0x175')});db[_0x9690('0x49')][_0x9690('0x120')](db[_0x9690('0x3f')],{});db['MailQueueReport'][_0x9690('0x120')](db['CmList'],{'as':'List','foreignKey':_0x9690('0x160')});db[_0x9690('0x49')][_0x9690('0x120')](db[_0x9690('0x75')],{'as':'Contact','foreignKey':_0x9690('0x16a')});db[_0x9690('0x49')]['belongsTo'](db[_0x9690('0x43')],{});db['MailQueueReport'][_0x9690('0x120')](db[_0x9690('0x45')],{});db[_0x9690('0x49')][_0x9690('0x120')](db[_0x9690('0x12')],{});db['MailQueueReport'][_0x9690('0x120')](db['MailQueue'],{});db[_0x9690('0x4b')][_0x9690('0x111')](db['DashboardItem'],{'as':_0x9690('0x176'),'onDelete':_0x9690('0x110')});db[_0x9690('0x4f')][_0x9690('0x111')](db['Disposition'],{'as':_0x9690('0x15c'),'foreignKey':_0x9690('0x177'),'onDelete':'cascade'});db['FaxAccount'][_0x9690('0x111')](db[_0x9690('0x84')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x9690('0x4f')][_0x9690('0x111')](db[_0x9690('0x53')],{'as':_0x9690('0x15e')});db[_0x9690('0x4f')]['hasMany'](db[_0x9690('0x51')],{'as':_0x9690('0x143')});db[_0x9690('0x4f')][_0x9690('0x111')](db[_0x9690('0x19')],{'as':_0x9690('0x178'),'onDelete':_0x9690('0x110')});db[_0x9690('0x4f')]['hasMany'](db[_0x9690('0x54')],{'as':_0x9690('0x152')});db[_0x9690('0x4f')][_0x9690('0x120')](db[_0x9690('0x2d')],{'as':_0x9690('0x2d')});db[_0x9690('0x4f')]['belongsTo'](db['CmList'],{'as':_0x9690('0x15f'),'foreignKey':_0x9690('0x160')});db['FaxAccount'][_0x9690('0x120')](db[_0x9690('0x89')],{'as':_0x9690('0x162'),'foreignKey':_0x9690('0x163')});db['FaxAccount']['belongsToMany'](db[_0x9690('0x12')],{'as':'Agents','through':_0x9690('0x179')});db[_0x9690('0x51')][_0x9690('0x120')](db['User'],{'onDelete':'restrict'});db[_0x9690('0x51')][_0x9690('0x120')](db[_0x9690('0x55')],{'onDelete':_0x9690('0x174')});db['FaxApplication']['belongsTo'](db[_0x9690('0x4f')],{'onDelete':_0x9690('0x174')});db[_0x9690('0x51')][_0x9690('0x120')](db[_0x9690('0x90')],{'onDelete':_0x9690('0x174'),'foreignKey':'TagId'});db[_0x9690('0x53')]['hasMany'](db[_0x9690('0x54')],{'as':'Messages','onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x17a')});db[_0x9690('0x53')][_0x9690('0x120')](db[_0x9690('0x4f')],{'as':_0x9690('0x168'),'foreignKey':_0x9690('0x177')});db[_0x9690('0x53')][_0x9690('0x120')](db['CmContact'],{'as':_0x9690('0x169'),'foreignKey':_0x9690('0x16a')});db[_0x9690('0x53')][_0x9690('0x120')](db[_0x9690('0x12')],{'as':_0x9690('0x16b'),'foreignKey':'UserId'});db[_0x9690('0x53')][_0x9690('0x122')](db['Tag'],{'through':'fax_interaction_has_tags','as':_0x9690('0x16d')});db[_0x9690('0x53')][_0x9690('0x122')](db['Tag'],{'through':_0x9690('0x17b'),'as':_0x9690('0x17c')});db[_0x9690('0x53')]['belongsToMany'](db[_0x9690('0x12')],{'as':_0x9690('0x16e'),'through':_0x9690('0x127'),'foreignKey':_0x9690('0x17a')});db[_0x9690('0x54')][_0x9690('0x120')](db['User'],{'onDelete':_0x9690('0x110'),'as':_0x9690('0x12')});db[_0x9690('0x54')]['belongsTo'](db[_0x9690('0x53')],{'as':_0x9690('0x170'),'foreignKey':'FaxInteractionId'});db[_0x9690('0x54')][_0x9690('0x120')](db[_0x9690('0x75')],{'onDelete':_0x9690('0x110'),'as':_0x9690('0x169')});db['FaxMessage'][_0x9690('0x120')](db[_0x9690('0xe9')],{'as':_0x9690('0xe9'),'foreignKey':'AttachmentId'});db[_0x9690('0x54')][_0x9690('0x120')](db[_0x9690('0x4f')],{'as':'Account','foreignKey':_0x9690('0x177')});db['FaxQueue']['belongsToMany'](db[_0x9690('0x12')],{'as':'Agents','through':'UserFaxQueue'});db[_0x9690('0x55')]['belongsToMany'](db['Team'],{'through':'team_has_fax_queues','as':_0x9690('0x166')});db[_0x9690('0x57')]['belongsTo'](db[_0x9690('0x4f')],{});db[_0x9690('0x57')][_0x9690('0x120')](db[_0x9690('0xf4')],{'as':'List','foreignKey':_0x9690('0x160')});db[_0x9690('0x57')][_0x9690('0x120')](db['CmContact'],{'as':_0x9690('0x169'),'foreignKey':'ContactId'});db[_0x9690('0x57')]['belongsTo'](db[_0x9690('0x53')],{});db[_0x9690('0x57')][_0x9690('0x120')](db[_0x9690('0x54')],{});db[_0x9690('0x57')][_0x9690('0x120')](db[_0x9690('0x12')],{});db['FaxQueueReport'][_0x9690('0x120')](db[_0x9690('0x55')],{});db[_0x9690('0x17d')]['hasMany'](db['Disposition'],{'as':_0x9690('0x15c'),'foreignKey':_0x9690('0x17e'),'onDelete':'cascade'});db[_0x9690('0x17d')][_0x9690('0x111')](db[_0x9690('0x84')],{'as':_0x9690('0x15d'),'foreignKey':_0x9690('0x17e')});db['SmsAccount'][_0x9690('0x111')](db['SmsMessage'],{'as':'Messages','foreignKey':_0x9690('0x17e')});db[_0x9690('0x17d')][_0x9690('0x111')](db['SmsInteraction'],{'as':_0x9690('0x15e')});db[_0x9690('0x17d')][_0x9690('0x111')](db[_0x9690('0x59')],{'as':_0x9690('0x143')});db['SmsAccount']['belongsTo'](db[_0x9690('0xf4')],{'as':_0x9690('0x15f'),'foreignKey':_0x9690('0x160')});db[_0x9690('0x17d')]['belongsTo'](db[_0x9690('0x89')],{'as':_0x9690('0x162'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x9690('0x17d')][_0x9690('0x122')](db[_0x9690('0x12')],{'as':_0x9690('0x164'),'through':_0x9690('0x13d')});db[_0x9690('0x59')][_0x9690('0x120')](db[_0x9690('0x12')],{'onDelete':_0x9690('0x174')});db[_0x9690('0x59')][_0x9690('0x120')](db[_0x9690('0x5d')],{'onDelete':_0x9690('0x174')});db[_0x9690('0x59')][_0x9690('0x120')](db[_0x9690('0x17d')],{'onDelete':_0x9690('0x174')});db[_0x9690('0x59')][_0x9690('0x120')](db[_0x9690('0x14e')],{'onDelete':'restrict','foreignKey':_0x9690('0x14f')});db[_0x9690('0x59')]['belongsTo'](db['Tag'],{'onDelete':_0x9690('0x174'),'foreignKey':_0x9690('0x175')});db['SmsInteraction'][_0x9690('0x111')](db['SmsMessage'],{'as':_0x9690('0x152'),'onDelete':'cascade','foreignKey':_0x9690('0x17f')});db[_0x9690('0x5a')][_0x9690('0x120')](db['SmsAccount'],{'as':'Account','foreignKey':_0x9690('0x17e')});db[_0x9690('0x5a')][_0x9690('0x120')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x9690('0x5a')][_0x9690('0x120')](db['User'],{'as':'Owner','foreignKey':_0x9690('0x114')});db[_0x9690('0x5a')][_0x9690('0x122')](db[_0x9690('0x90')],{'through':'sms_interaction_has_tags','as':_0x9690('0x16d')});db[_0x9690('0x5a')][_0x9690('0x122')](db['Tag'],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0x9690('0x5a')][_0x9690('0x122')](db[_0x9690('0x12')],{'as':_0x9690('0x16e'),'through':'user_has_sms_interactions','foreignKey':_0x9690('0x17f')});db[_0x9690('0x180')][_0x9690('0x120')](db[_0x9690('0x12')],{'as':_0x9690('0x12')});db[_0x9690('0x180')][_0x9690('0x120')](db['CmContact'],{'onDelete':_0x9690('0x110'),'as':_0x9690('0x169')});db[_0x9690('0x180')][_0x9690('0x120')](db[_0x9690('0x5a')],{'onDelete':'cascade','as':_0x9690('0x170'),'foreignKey':'SmsInteractionId'});db[_0x9690('0x180')][_0x9690('0x120')](db['SmsAccount'],{'as':_0x9690('0x168'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0x9690('0x122')](db['User'],{'as':_0x9690('0x164'),'through':'UserSmsQueue','foreignKey':_0x9690('0x181')});db[_0x9690('0x5d')][_0x9690('0x122')](db[_0x9690('0xe1')],{'through':'team_has_sms_queues','as':_0x9690('0x166')});db[_0x9690('0x5f')]['hasMany'](db[_0x9690('0x86')],{'as':_0x9690('0x15c'),'foreignKey':_0x9690('0x182'),'onDelete':_0x9690('0x110')});db[_0x9690('0x5f')]['hasMany'](db[_0x9690('0x84')],{'as':_0x9690('0x15d'),'foreignKey':_0x9690('0x182')});db[_0x9690('0x5f')]['hasMany'](db['OpenchannelInteraction'],{'as':_0x9690('0x15e'),'foreignKey':_0x9690('0x182')});db['OpenchannelAccount']['hasMany'](db[_0x9690('0x63')],{'as':_0x9690('0x152'),'foreignKey':_0x9690('0x182')});db[_0x9690('0x5f')][_0x9690('0x111')](db[_0x9690('0x61')],{'as':'Applications','foreignKey':_0x9690('0x182')});db[_0x9690('0x5f')][_0x9690('0x120')](db[_0x9690('0xf4')],{'as':'List','foreignKey':'ListId'});db['OpenchannelAccount'][_0x9690('0x120')](db['Pause'],{'as':_0x9690('0x162'),'foreignKey':_0x9690('0x163')});db[_0x9690('0x5f')][_0x9690('0x122')](db[_0x9690('0x12')],{'as':'Agents','through':_0x9690('0x13c')});db[_0x9690('0x61')]['belongsTo'](db['User'],{'onDelete':'restrict'});db[_0x9690('0x61')][_0x9690('0x120')](db[_0x9690('0x183')],{'onDelete':_0x9690('0x174'),'foreignKey':_0x9690('0x184')});db[_0x9690('0x61')]['belongsTo'](db[_0x9690('0x5f')],{'onDelete':_0x9690('0x174'),'foreignKey':'OpenchannelAccountId'});db[_0x9690('0x61')][_0x9690('0x120')](db[_0x9690('0x14e')],{'onDelete':'restrict','foreignKey':_0x9690('0x14f')});db['OpenchannelApplication'][_0x9690('0x120')](db[_0x9690('0x90')],{'onDelete':'restrict','foreignKey':_0x9690('0x175')});db['OpenchannelInteraction'][_0x9690('0x111')](db[_0x9690('0x63')],{'as':_0x9690('0x152'),'onDelete':'cascade','foreignKey':_0x9690('0x185')});db[_0x9690('0x62')]['belongsTo'](db[_0x9690('0x5f')],{'as':_0x9690('0x168'),'foreignKey':_0x9690('0x182')});db['OpenchannelInteraction'][_0x9690('0x120')](db['CmContact'],{'as':_0x9690('0x169'),'foreignKey':_0x9690('0x16a')});db[_0x9690('0x62')][_0x9690('0x120')](db[_0x9690('0x12')],{'as':_0x9690('0x16b'),'foreignKey':_0x9690('0x114')});db[_0x9690('0x62')][_0x9690('0x122')](db[_0x9690('0x90')],{'through':'openchannel_interaction_has_tags','as':'Tags'});db[_0x9690('0x62')][_0x9690('0x122')](db[_0x9690('0x90')],{'through':_0x9690('0x186'),'as':_0x9690('0x17c')});db['OpenchannelInteraction']['belongsToMany'](db[_0x9690('0x12')],{'as':_0x9690('0x16e'),'through':_0x9690('0x12a'),'foreignKey':_0x9690('0x185')});db['OpenchannelMessage'][_0x9690('0x120')](db['User'],{'onDelete':'cascade','as':_0x9690('0x12')});db[_0x9690('0x63')]['belongsTo'](db[_0x9690('0x75')],{'onDelete':'cascade','as':'Contact'});db['OpenchannelMessage']['belongsTo'](db[_0x9690('0x62')],{'onDelete':'cascade','as':_0x9690('0x170'),'foreignKey':_0x9690('0x185')});db[_0x9690('0x63')][_0x9690('0x120')](db[_0x9690('0xe9')],{'as':_0x9690('0xe9'),'foreignKey':_0x9690('0x187')});db[_0x9690('0x63')][_0x9690('0x120')](db[_0x9690('0x5f')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x9690('0x183')][_0x9690('0x122')](db['User'],{'as':_0x9690('0x164'),'through':_0x9690('0x38'),'foreignKey':'OpenchannelQueueId'});db[_0x9690('0x183')][_0x9690('0x122')](db[_0x9690('0xe1')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0x9690('0x171')][_0x9690('0x111')](db[_0x9690('0x86')],{'as':'Dispositions','foreignKey':_0x9690('0x172'),'onDelete':'cascade'});db[_0x9690('0x171')][_0x9690('0x111')](db['CannedAnswer'],{'as':_0x9690('0x15d'),'foreignKey':_0x9690('0x172')});db[_0x9690('0x171')]['hasMany'](db[_0x9690('0x72')],{'as':_0x9690('0x188')});db[_0x9690('0x171')][_0x9690('0x111')](db[_0x9690('0x6b')],{'as':_0x9690('0x15e')});db[_0x9690('0x171')]['hasMany'](db[_0x9690('0x69')],{'as':'Applications'});db[_0x9690('0x171')][_0x9690('0x111')](db[_0x9690('0x6c')],{'as':_0x9690('0x152')});db[_0x9690('0x171')]['belongsTo'](db[_0x9690('0xf4')],{'as':_0x9690('0x15f'),'foreignKey':_0x9690('0x160')});db[_0x9690('0x171')][_0x9690('0x120')](db[_0x9690('0x14e')],{'as':'Interval','foreignKey':_0x9690('0x14f')});db[_0x9690('0x171')][_0x9690('0x120')](db[_0x9690('0x3f')],{'as':_0x9690('0x3f'),'foreignKey':_0x9690('0x159')});db[_0x9690('0x171')][_0x9690('0x120')](db[_0x9690('0x89')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x9690('0x171')][_0x9690('0x122')](db['User'],{'as':_0x9690('0x164'),'through':_0x9690('0x139')});db[_0x9690('0x67')]['belongsTo'](db['OpenchannelAccount'],{});db['OpenchannelQueueReport'][_0x9690('0x120')](db[_0x9690('0xf4')],{'as':_0x9690('0x15f'),'foreignKey':'ListId'});db['OpenchannelQueueReport'][_0x9690('0x120')](db[_0x9690('0x75')],{'as':_0x9690('0x169'),'foreignKey':_0x9690('0x16a')});db[_0x9690('0x67')][_0x9690('0x120')](db[_0x9690('0x62')],{});db[_0x9690('0x67')][_0x9690('0x120')](db[_0x9690('0x63')],{});db[_0x9690('0x67')][_0x9690('0x120')](db[_0x9690('0x12')],{});db[_0x9690('0x67')][_0x9690('0x120')](db[_0x9690('0x183')],{});db[_0x9690('0x69')][_0x9690('0x120')](db[_0x9690('0x12')],{'as':'Agent','foreignKey':_0x9690('0x114'),'onDelete':'restrict'});db['ChatApplication'][_0x9690('0x120')](db[_0x9690('0x189')],{'as':'Queue','foreignKey':_0x9690('0x18a'),'onDelete':_0x9690('0x174')});db['ChatApplication'][_0x9690('0x120')](db[_0x9690('0x171')],{'as':_0x9690('0x18b'),'foreignKey':_0x9690('0x172'),'onDelete':'restrict'});db[_0x9690('0x69')]['belongsTo'](db[_0x9690('0x90')],{'onDelete':_0x9690('0x174'),'foreignKey':_0x9690('0x175')});db['ChatInteraction'][_0x9690('0x111')](db['ChatMessage'],{'as':_0x9690('0x152'),'onDelete':_0x9690('0x110'),'foreignKey':'ChatInteractionId'});db[_0x9690('0x6b')][_0x9690('0x120')](db[_0x9690('0x171')],{'as':_0x9690('0x168'),'foreignKey':_0x9690('0x172')});db[_0x9690('0x6b')][_0x9690('0x120')](db[_0x9690('0x75')],{'as':_0x9690('0x169'),'foreignKey':_0x9690('0x16a')});db[_0x9690('0x6b')][_0x9690('0x120')](db[_0x9690('0x12')],{'as':'Owner','foreignKey':_0x9690('0x114')});db[_0x9690('0x6b')][_0x9690('0x122')](db['Tag'],{'through':_0x9690('0x18c'),'as':_0x9690('0x16d')});db[_0x9690('0x6b')][_0x9690('0x122')](db[_0x9690('0x90')],{'through':_0x9690('0x18c'),'as':'ThroughTags'});db[_0x9690('0x6b')][_0x9690('0x122')](db[_0x9690('0x12')],{'as':'Users','through':_0x9690('0x126'),'foreignKey':'ChatInteractionId'});db[_0x9690('0x6c')][_0x9690('0x120')](db['User'],{'onDelete':_0x9690('0x110'),'as':'User'});db[_0x9690('0x6c')]['belongsTo'](db['CmContact'],{'onDelete':_0x9690('0x110'),'as':'Contact','foreignKey':'ContactId'});db[_0x9690('0x6c')]['belongsTo'](db[_0x9690('0x6b')],{'onDelete':'cascade','as':_0x9690('0x170'),'foreignKey':_0x9690('0x18d')});db[_0x9690('0x6c')][_0x9690('0x120')](db[_0x9690('0xe9')],{'as':_0x9690('0xe9'),'foreignKey':_0x9690('0x187')});db[_0x9690('0x6c')][_0x9690('0x120')](db[_0x9690('0x171')],{'as':_0x9690('0x168'),'foreignKey':'ChatWebsiteId'});db[_0x9690('0x6d')][_0x9690('0x111')](db[_0x9690('0xe9')],{'as':'Attachments','foreignKey':_0x9690('0x173'),'onDelete':_0x9690('0x110'),'hooks':!![]});db[_0x9690('0x6d')]['belongsTo'](db['CmContact'],{'onDelete':_0x9690('0x110'),'as':_0x9690('0x169'),'foreignKey':_0x9690('0x16a')});db[_0x9690('0x6d')]['belongsTo'](db['ChatWebsite'],{'as':_0x9690('0x168'),'foreignKey':'ChatWebsiteId'});db[_0x9690('0x189')]['belongsToMany'](db['User'],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0x9690('0x189')][_0x9690('0x122')](db[_0x9690('0xe1')],{'through':'team_has_chat_queues','as':_0x9690('0x166')});db[_0x9690('0x70')][_0x9690('0x111')](db[_0x9690('0x18e')],{'as':_0x9690('0x152'),'foreignKey':'ChatGroupId','onDelete':_0x9690('0x110')});db[_0x9690('0x70')][_0x9690('0x122')](db['User'],{'as':'Members','through':'chat_group_has_users'});db[_0x9690('0x72')][_0x9690('0x120')](db[_0x9690('0x171')],{'as':_0x9690('0x18b'),'foreignKey':'ChatWebsiteId'});db[_0x9690('0x73')][_0x9690('0x111')](db[_0x9690('0x75')],{'as':_0x9690('0x18f'),'foreignKey':_0x9690('0x190')});db[_0x9690('0x75')][_0x9690('0x111')](db[_0x9690('0x147')],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x9690('0x75')][_0x9690('0x111')](db[_0x9690('0x7a')],{'as':_0x9690('0x116'),'foreignKey':_0x9690('0x16a')});db[_0x9690('0x75')][_0x9690('0x111')](db[_0x9690('0x7c')],{'as':_0x9690('0x14a'),'foreignKey':_0x9690('0x16a')});db['CmContact'][_0x9690('0x111')](db['ReportAgentPreview'],{'as':_0x9690('0x118'),'foreignKey':_0x9690('0x16a')});db[_0x9690('0x75')][_0x9690('0x111')](db[_0x9690('0xd2')],{'as':'JscriptySessions','foreignKey':_0x9690('0x16a')});db[_0x9690('0x75')][_0x9690('0x111')](db[_0x9690('0x62')],{'as':_0x9690('0x119'),'foreignKey':_0x9690('0x16a'),'onDelete':_0x9690('0x174')});db[_0x9690('0x75')]['hasMany'](db[_0x9690('0x6b')],{'as':'ChatInteractions','foreignKey':_0x9690('0x16a'),'onDelete':_0x9690('0x174')});db['CmContact'][_0x9690('0x111')](db[_0x9690('0x5a')],{'as':_0x9690('0x128'),'foreignKey':'ContactId','onDelete':_0x9690('0x174')});db[_0x9690('0x75')][_0x9690('0x111')](db[_0x9690('0x53')],{'as':_0x9690('0x11b'),'foreignKey':_0x9690('0x16a'),'onDelete':_0x9690('0x174')});db['CmContact'][_0x9690('0x111')](db[_0x9690('0x43')],{'as':_0x9690('0x11c'),'foreignKey':_0x9690('0x16a'),'onDelete':_0x9690('0x174')});db['CmContact'][_0x9690('0x120')](db[_0x9690('0x73')],{'as':_0x9690('0x191'),'foreignKey':_0x9690('0x190')});db[_0x9690('0x75')]['belongsTo'](db[_0x9690('0xf4')],{'as':_0x9690('0x15f'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x9690('0x75')][_0x9690('0x122')](db[_0x9690('0x12')],{'as':_0x9690('0x16e'),'through':_0x9690('0x123')});db[_0x9690('0x75')][_0x9690('0x122')](db[_0x9690('0x90')],{'as':'Tags','through':_0x9690('0x192')});db['CmContact'][_0x9690('0x122')](db[_0x9690('0x90')],{'through':_0x9690('0x192'),'as':_0x9690('0x17c')});db[_0x9690('0x147')][_0x9690('0x120')](db['CmContact'],{'as':_0x9690('0x169'),'foreignKey':_0x9690('0x16a'),'onDelete':_0x9690('0x110')});db['CmHopper'][_0x9690('0x120')](db[_0x9690('0xf4')],{'as':_0x9690('0x15f'),'foreignKey':'ListId','onDelete':_0x9690('0x110')});db[_0x9690('0x147')]['belongsTo'](db[_0x9690('0x12')],{'as':'Agent','foreignKey':'UserId'});db[_0x9690('0x147')][_0x9690('0x120')](db[_0x9690('0x1c')],{'as':_0x9690('0x193'),'foreignKey':_0x9690('0x149'),'onDelete':_0x9690('0x110')});db[_0x9690('0x147')][_0x9690('0x120')](db[_0x9690('0xe5')],{'as':_0x9690('0xe5'),'foreignKey':_0x9690('0x194'),'onDelete':_0x9690('0x110')});db[_0x9690('0x147')][_0x9690('0x120')](db['User'],{'as':_0x9690('0x16b'),'foreignKey':_0x9690('0x195')});db[_0x9690('0x78')][_0x9690('0x120')](db[_0x9690('0x75')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x9690('0x110')});db[_0x9690('0x78')][_0x9690('0x120')](db[_0x9690('0xf4')],{'as':_0x9690('0x15f'),'foreignKey':'ListId','onDelete':_0x9690('0x110')});db['CmHopperBlack'][_0x9690('0x120')](db[_0x9690('0x1c')],{'as':_0x9690('0x193'),'foreignKey':_0x9690('0x149'),'onDelete':_0x9690('0x110')});db[_0x9690('0x78')]['belongsTo'](db[_0x9690('0xe5')],{'as':'Campaign','foreignKey':_0x9690('0x194'),'onDelete':_0x9690('0x110')});db[_0x9690('0x82')][_0x9690('0x111')](db[_0x9690('0x87')],{'as':{'plural':_0x9690('0x196'),'singular':_0x9690('0x197')},'foreignKey':_0x9690('0x198'),'onDelete':'cascade','hooks':!![]});db[_0x9690('0x82')]['hasMany'](db[_0x9690('0x87')],{'as':{'plural':'Any','singular':_0x9690('0x199')},'foreignKey':_0x9690('0x19a'),'onDelete':_0x9690('0x110'),'hooks':!![]});db[_0x9690('0x82')][_0x9690('0x111')](db[_0x9690('0x80')],{'as':_0x9690('0x19b'),'foreignKey':_0x9690('0x19c'),'onDelete':_0x9690('0x110'),'hooks':!![]});db[_0x9690('0x86')]['hasMany'](db[_0x9690('0x86')],{'as':_0x9690('0x15c'),'foreignKey':_0x9690('0x19d'),'onDelete':_0x9690('0x110')});db[_0x9690('0x14e')][_0x9690('0x111')](db[_0x9690('0x14e')],{'as':_0x9690('0x19e'),'foreignKey':_0x9690('0x14f'),'onDelete':_0x9690('0x110'),'hooks':!![],'required':![]});db['Interval'][_0x9690('0x111')](db['VoiceExtension'],{'as':_0x9690('0x19f'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0x9690('0x14e')][_0x9690('0x111')](db[_0x9690('0x47')],{'as':_0x9690('0x1a0'),'foreignKey':_0x9690('0x14f')});db[_0x9690('0x14e')][_0x9690('0x111')](db[_0x9690('0x69')],{'as':_0x9690('0x1a1'),'foreignKey':'IntervalId'});db['Interval'][_0x9690('0x111')](db[_0x9690('0x51')],{'as':_0x9690('0x1a2'),'foreignKey':'IntervalId'});db['Interval'][_0x9690('0x111')](db['SmsApplication'],{'as':_0x9690('0x1a3'),'foreignKey':_0x9690('0x14f')});db[_0x9690('0x1a4')][_0x9690('0x120')](db[_0x9690('0x3f')],{});db[_0x9690('0x1a4')][_0x9690('0x120')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db['Schedule'][_0x9690('0x120')](db['AnalyticCustomReport'],{'foreignKey':_0x9690('0x1a5')});db[_0x9690('0x8e')]['belongsToMany'](db[_0x9690('0x1b')],{'as':_0x9690('0x1a6'),'through':'moh_has_sounds','onDelete':_0x9690('0x174')});db[_0x9690('0x90')][_0x9690('0x122')](db[_0x9690('0x75')],{'through':_0x9690('0x192')});db[_0x9690('0x90')][_0x9690('0x122')](db[_0x9690('0x6b')],{'through':_0x9690('0x18c')});db[_0x9690('0x90')][_0x9690('0x122')](db['MailInteraction'],{'through':_0x9690('0x16c')});db['Tag'][_0x9690('0x122')](db[_0x9690('0x5a')],{'through':_0x9690('0x1a7')});db[_0x9690('0x90')][_0x9690('0x122')](db[_0x9690('0x53')],{'through':_0x9690('0x17b')});db[_0x9690('0x90')][_0x9690('0x122')](db[_0x9690('0x62')],{'through':_0x9690('0x186')});db[_0x9690('0x90')][_0x9690('0x122')](db[_0x9690('0x12b')],{'through':_0x9690('0x1a8')});db[_0x9690('0x94')]['hasMany'](db[_0x9690('0x87')],{'as':{'plural':_0x9690('0x1a9'),'singular':_0x9690('0x1aa')},'foreignKey':_0x9690('0x1ab'),'onDelete':_0x9690('0x110'),'hooks':!![]});db[_0x9690('0x94')][_0x9690('0x111')](db['Condition'],{'as':{'plural':_0x9690('0x1ac'),'singular':_0x9690('0x1ad')},'foreignKey':_0x9690('0x1ae'),'onDelete':_0x9690('0x110'),'hooks':!![]});db['Trigger'][_0x9690('0x111')](db[_0x9690('0x80')],{'as':_0x9690('0x19b'),'foreignKey':_0x9690('0x1af'),'onDelete':_0x9690('0x110'),'hooks':!![]});db[_0x9690('0x97')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x9690('0x1a5'),'hooks':!![]});db[_0x9690('0x98')][_0x9690('0x111')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1b0')});db[_0x9690('0x9a')][_0x9690('0x111')](db['AnalyticFieldReport'],{'as':_0x9690('0x1b1'),'onDelete':'cascade','foreignKey':_0x9690('0x1b2')});db['AnalyticFieldReport'][_0x9690('0x120')](db['AnalyticMetric'],{'foreignKey':_0x9690('0x1b2')});db[_0x9690('0x1b3')][_0x9690('0x111')](db[_0x9690('0x9e')],{'as':_0x9690('0x1b4'),'onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1b5')});db[_0x9690('0x9e')]['hasMany'](db[_0x9690('0xa0')],{'as':'Subjects','onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1b6')});db[_0x9690('0x9e')][_0x9690('0x111')](db[_0x9690('0xa0')],{'as':_0x9690('0x1b7'),'onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1b8')});db[_0x9690('0x9e')][_0x9690('0x111')](db[_0x9690('0xa0')],{'as':_0x9690('0x1b1'),'onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1b9')});db[_0x9690('0x9e')]['belongsTo'](db['SalesforceAccount'],{'as':_0x9690('0x168'),'foreignKey':_0x9690('0x1b5')});db[_0x9690('0xa0')][_0x9690('0x111')](db[_0x9690('0xa0')],{'as':_0x9690('0x1ba'),'foreignKey':_0x9690('0x1b6')});db[_0x9690('0xa0')][_0x9690('0x111')](db[_0x9690('0xa0')],{'as':_0x9690('0x1bb'),'foreignKey':'DescriptionId'});db[_0x9690('0xa0')][_0x9690('0x111')](db['SalesforceField'],{'as':'Field','foreignKey':_0x9690('0x1b9')});db[_0x9690('0xa0')][_0x9690('0x120')](db[_0x9690('0x1bc')],{'as':_0x9690('0x1bc'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x9690('0x111')](db['SugarcrmConfiguration'],{'as':_0x9690('0x1b4'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x9690('0xa4')][_0x9690('0x111')](db[_0x9690('0xa6')],{'as':_0x9690('0x1bd'),'onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1b6')});db['SugarcrmConfiguration'][_0x9690('0x111')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0x9690('0x110'),'foreignKey':'DescriptionId'});db[_0x9690('0xa4')]['hasMany'](db[_0x9690('0xa6')],{'as':_0x9690('0x1b1'),'onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1b9')});db['SugarcrmConfiguration']['belongsTo'](db[_0x9690('0xa2')],{'as':_0x9690('0x168'),'foreignKey':_0x9690('0x1b5')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x9690('0x1ba'),'foreignKey':_0x9690('0x1b6')});db['SugarcrmField'][_0x9690('0x111')](db[_0x9690('0xa6')],{'as':_0x9690('0x1bb'),'foreignKey':_0x9690('0x1b8')});db['SugarcrmField']['hasMany'](db[_0x9690('0xa6')],{'as':_0x9690('0x1be'),'foreignKey':'FieldId'});db[_0x9690('0xa6')]['belongsTo'](db['Variable'],{'as':_0x9690('0x1bc'),'foreignKey':_0x9690('0x1bf')});db['DeskAccount']['hasMany'](db[_0x9690('0xa8')],{'as':_0x9690('0x1b4'),'onDelete':_0x9690('0x110'),'foreignKey':'AccountId'});db[_0x9690('0xa8')][_0x9690('0x111')](db['DeskField'],{'as':_0x9690('0x1bd'),'onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1b6')});db[_0x9690('0xa8')][_0x9690('0x111')](db[_0x9690('0x1c0')],{'as':_0x9690('0x1b7'),'onDelete':_0x9690('0x110'),'foreignKey':'DescriptionId'});db[_0x9690('0xa8')][_0x9690('0x111')](db['DeskField'],{'as':_0x9690('0x1b1'),'onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1b9')});db['DeskConfiguration'][_0x9690('0x120')](db[_0x9690('0xa7')],{'as':_0x9690('0x168'),'foreignKey':_0x9690('0x1b5')});db[_0x9690('0xa8')][_0x9690('0x122')](db[_0x9690('0x90')],{'through':_0x9690('0x1c1')});db[_0x9690('0x1c0')][_0x9690('0x111')](db[_0x9690('0x1c0')],{'as':_0x9690('0x1ba'),'foreignKey':_0x9690('0x1b6')});db[_0x9690('0x1c0')][_0x9690('0x111')](db[_0x9690('0x1c0')],{'as':_0x9690('0x1bb'),'foreignKey':'DescriptionId'});db['DeskField'][_0x9690('0x111')](db[_0x9690('0x1c0')],{'as':_0x9690('0x1be'),'foreignKey':_0x9690('0x1b9')});db[_0x9690('0x1c0')][_0x9690('0x120')](db[_0x9690('0x1bc')],{'as':_0x9690('0x1bc'),'foreignKey':'VariableId'});db[_0x9690('0xa9')][_0x9690('0x111')](db['ZohoConfiguration'],{'as':_0x9690('0x1b4'),'onDelete':'cascade','foreignKey':_0x9690('0x1b5')});db[_0x9690('0xab')][_0x9690('0x111')](db[_0x9690('0xad')],{'as':_0x9690('0x1bd'),'onDelete':_0x9690('0x110'),'foreignKey':'SubjectId'});db[_0x9690('0xab')]['hasMany'](db[_0x9690('0xad')],{'as':'Descriptions','onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1b8')});db[_0x9690('0xab')][_0x9690('0x111')](db[_0x9690('0xad')],{'as':_0x9690('0x1b1'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x9690('0xab')]['belongsTo'](db[_0x9690('0xa9')],{'as':'Account','foreignKey':_0x9690('0x1b5')});db[_0x9690('0xad')][_0x9690('0x111')](db['ZohoField'],{'as':_0x9690('0x1ba'),'foreignKey':_0x9690('0x1b6')});db[_0x9690('0xad')]['hasMany'](db[_0x9690('0xad')],{'as':_0x9690('0x1bb'),'foreignKey':'DescriptionId'});db['ZohoField']['hasMany'](db[_0x9690('0xad')],{'as':_0x9690('0x1be'),'foreignKey':_0x9690('0x1b9')});db[_0x9690('0xad')][_0x9690('0x120')](db[_0x9690('0x1bc')],{'as':_0x9690('0x1bc'),'foreignKey':_0x9690('0x1bf')});db[_0x9690('0xae')]['hasMany'](db[_0x9690('0xb0')],{'as':_0x9690('0x1b4'),'onDelete':'cascade','foreignKey':_0x9690('0x1b5')});db[_0x9690('0xb0')][_0x9690('0x111')](db[_0x9690('0xb2')],{'as':_0x9690('0x1bd'),'foreignKey':_0x9690('0x1b6')});db[_0x9690('0xb0')][_0x9690('0x111')](db['ZendeskField'],{'as':_0x9690('0x1b7'),'foreignKey':'DescriptionId'});db[_0x9690('0xb0')][_0x9690('0x111')](db[_0x9690('0xb2')],{'as':_0x9690('0x1b1'),'foreignKey':_0x9690('0x1b9')});db[_0x9690('0xb0')][_0x9690('0x120')](db['ZendeskAccount'],{'as':'Account','foreignKey':_0x9690('0x1b5')});db[_0x9690('0xb0')][_0x9690('0x122')](db[_0x9690('0x90')],{'through':_0x9690('0x1c2')});db[_0x9690('0xb2')][_0x9690('0x111')](db[_0x9690('0xb2')],{'as':_0x9690('0x1ba'),'foreignKey':_0x9690('0x1b6')});db['ZendeskField']['hasMany'](db['ZendeskField'],{'as':_0x9690('0x1bb'),'foreignKey':'DescriptionId'});db[_0x9690('0xb2')][_0x9690('0x111')](db[_0x9690('0xb2')],{'as':'Field','foreignKey':'FieldId'});db[_0x9690('0xb2')][_0x9690('0x120')](db[_0x9690('0x1bc')],{'as':_0x9690('0x1bc'),'foreignKey':'VariableId'});db[_0x9690('0x1c3')][_0x9690('0x111')](db['FreshdeskConfiguration'],{'as':_0x9690('0x1b4'),'onDelete':'cascade','foreignKey':_0x9690('0x1b5')});db['FreshdeskConfiguration']['hasMany'](db[_0x9690('0xb5')],{'as':_0x9690('0x1bd'),'onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1b6')});db['FreshdeskConfiguration'][_0x9690('0x111')](db['FreshdeskField'],{'as':_0x9690('0x1b7'),'onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1b8')});db[_0x9690('0xb4')]['hasMany'](db[_0x9690('0xb5')],{'as':_0x9690('0x1b1'),'onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1b9')});db[_0x9690('0xb4')][_0x9690('0x120')](db[_0x9690('0x1c3')],{'as':_0x9690('0x168'),'foreignKey':_0x9690('0x1b5')});db[_0x9690('0xb4')][_0x9690('0x122')](db[_0x9690('0x90')],{'through':_0x9690('0x1c4')});db['FreshdeskField'][_0x9690('0x111')](db[_0x9690('0xb5')],{'as':_0x9690('0x1ba'),'foreignKey':_0x9690('0x1b6')});db[_0x9690('0xb5')][_0x9690('0x111')](db['FreshdeskField'],{'as':_0x9690('0x1bb'),'foreignKey':_0x9690('0x1b8')});db[_0x9690('0xb5')]['hasMany'](db['FreshdeskField'],{'as':_0x9690('0x1be'),'foreignKey':'FieldId'});db['FreshdeskField'][_0x9690('0x120')](db[_0x9690('0x1bc')],{'as':_0x9690('0x1bc'),'foreignKey':_0x9690('0x1bf')});db[_0x9690('0xb7')][_0x9690('0x111')](db[_0x9690('0xb9')],{'as':_0x9690('0x1b4'),'onDelete':_0x9690('0x110'),'foreignKey':'AccountId'});db['VtigerConfiguration']['hasMany'](db[_0x9690('0x1c5')],{'as':_0x9690('0x1bd'),'foreignKey':_0x9690('0x1b6')});db[_0x9690('0xb9')][_0x9690('0x111')](db[_0x9690('0x1c5')],{'as':_0x9690('0x1b7'),'foreignKey':'DescriptionId'});db[_0x9690('0xb9')]['hasMany'](db['VtigerField'],{'as':_0x9690('0x1b1'),'foreignKey':_0x9690('0x1b9')});db[_0x9690('0xb9')]['belongsTo'](db[_0x9690('0xb7')],{'as':_0x9690('0x168'),'foreignKey':_0x9690('0x1b5')});db[_0x9690('0x1c5')][_0x9690('0x111')](db[_0x9690('0x1c5')],{'as':_0x9690('0x1ba'),'foreignKey':'SubjectId'});db[_0x9690('0x1c5')][_0x9690('0x111')](db['VtigerField'],{'as':_0x9690('0x1bb'),'foreignKey':'DescriptionId'});db['VtigerField'][_0x9690('0x111')](db[_0x9690('0x1c5')],{'as':_0x9690('0x1be'),'foreignKey':_0x9690('0x1b9')});db['VtigerField'][_0x9690('0x120')](db[_0x9690('0x1bc')],{'as':_0x9690('0x1bc'),'foreignKey':_0x9690('0x1bf')});db[_0x9690('0xbc')][_0x9690('0x111')](db[_0x9690('0xbe')],{'as':'Configurations','onDelete':_0x9690('0x110'),'foreignKey':'AccountId'});db[_0x9690('0xbe')]['hasMany'](db[_0x9690('0x1c6')],{'as':_0x9690('0x1bd'),'foreignKey':_0x9690('0x1b6')});db[_0x9690('0xbe')][_0x9690('0x111')](db[_0x9690('0x1c6')],{'as':'Descriptions','foreignKey':_0x9690('0x1b8')});db[_0x9690('0xbe')][_0x9690('0x111')](db['ServicenowField'],{'as':_0x9690('0x1b1'),'foreignKey':_0x9690('0x1b9')});db[_0x9690('0xbe')][_0x9690('0x120')](db[_0x9690('0xbc')],{'as':'Account','foreignKey':_0x9690('0x1b5')});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':_0x9690('0x1ba'),'foreignKey':_0x9690('0x1b6')});db['ServicenowField'][_0x9690('0x111')](db[_0x9690('0x1c6')],{'as':_0x9690('0x1bb'),'foreignKey':_0x9690('0x1b8')});db[_0x9690('0x1c6')][_0x9690('0x111')](db[_0x9690('0x1c6')],{'as':_0x9690('0x1be'),'foreignKey':_0x9690('0x1b9')});db[_0x9690('0x1c6')][_0x9690('0x120')](db[_0x9690('0x1bc')],{'as':_0x9690('0x1bc'),'foreignKey':_0x9690('0x1bf')});db[_0x9690('0xc1')][_0x9690('0x111')](db[_0x9690('0xc3')],{'as':_0x9690('0x1b4'),'onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1b5')});db[_0x9690('0xc3')]['hasMany'](db['Dynamics365Field'],{'as':'Subjects','onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1b6')});db[_0x9690('0xc3')]['hasMany'](db[_0x9690('0xc4')],{'as':_0x9690('0x1b7'),'onDelete':_0x9690('0x110'),'foreignKey':'DescriptionId'});db[_0x9690('0xc3')][_0x9690('0x111')](db[_0x9690('0xc4')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x9690('0x1b9')});db[_0x9690('0xc3')][_0x9690('0x120')](db[_0x9690('0xc1')],{'as':_0x9690('0x168'),'foreignKey':_0x9690('0x1b5')});db[_0x9690('0xc4')][_0x9690('0x111')](db[_0x9690('0xc4')],{'as':_0x9690('0x1ba'),'foreignKey':_0x9690('0x1b6')});db[_0x9690('0xc4')]['hasMany'](db[_0x9690('0xc4')],{'as':_0x9690('0x1bb'),'foreignKey':_0x9690('0x1b8')});db[_0x9690('0xc4')][_0x9690('0x111')](db[_0x9690('0xc4')],{'as':'Field','foreignKey':'FieldId'});db[_0x9690('0xc4')][_0x9690('0x120')](db[_0x9690('0x1bc')],{'as':'Variable','foreignKey':_0x9690('0x1bf')});db[_0x9690('0xc5')][_0x9690('0x111')](db[_0x9690('0xc6')],{'as':'Configurations','onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1b5')});db[_0x9690('0xc6')][_0x9690('0x111')](db[_0x9690('0xc7')],{'as':_0x9690('0x1bd'),'foreignKey':_0x9690('0x1b6')});db[_0x9690('0xc6')][_0x9690('0x111')](db[_0x9690('0xc7')],{'as':_0x9690('0x1b7'),'foreignKey':_0x9690('0x1b8')});db[_0x9690('0xc6')][_0x9690('0x111')](db[_0x9690('0xc7')],{'as':'Fields','foreignKey':_0x9690('0x1b9')});db['FreshsalesConfiguration']['belongsTo'](db[_0x9690('0xc5')],{'as':_0x9690('0x168'),'foreignKey':_0x9690('0x1b5')});db[_0x9690('0xc7')][_0x9690('0x111')](db['FreshsalesField'],{'as':_0x9690('0x1ba'),'foreignKey':_0x9690('0x1b6')});db[_0x9690('0xc7')][_0x9690('0x111')](db[_0x9690('0xc7')],{'as':_0x9690('0x1bb'),'foreignKey':_0x9690('0x1b8')});db[_0x9690('0xc7')][_0x9690('0x111')](db[_0x9690('0xc7')],{'as':_0x9690('0x1be'),'foreignKey':_0x9690('0x1b9')});db[_0x9690('0xc7')]['belongsTo'](db[_0x9690('0x1bc')],{'as':_0x9690('0x1bc'),'foreignKey':_0x9690('0x1bf')});db['ChatQueueReport'][_0x9690('0x120')](db[_0x9690('0x171')],{});db[_0x9690('0xcd')][_0x9690('0x120')](db['CmList'],{'as':_0x9690('0x15f'),'foreignKey':_0x9690('0x160')});db[_0x9690('0xcd')][_0x9690('0x120')](db[_0x9690('0x75')],{'as':_0x9690('0x169'),'foreignKey':_0x9690('0x16a')});db[_0x9690('0xcd')]['belongsTo'](db[_0x9690('0x6b')],{});db[_0x9690('0xcd')][_0x9690('0x120')](db['ChatMessage'],{});db[_0x9690('0xcd')][_0x9690('0x120')](db[_0x9690('0x12')],{});db['ChatQueueReport'][_0x9690('0x120')](db[_0x9690('0x189')],{});db[_0x9690('0x18e')][_0x9690('0x120')](db[_0x9690('0x12')],{'onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1c7')});db[_0x9690('0x18e')][_0x9690('0x120')](db[_0x9690('0x12')],{'onDelete':'cascade','foreignKey':'ToId'});db[_0x9690('0xd2')][_0x9690('0x111')](db[_0x9690('0x1c8')],{'foreignKey':_0x9690('0x1c9'),'onDelete':'cascade'});db[_0x9690('0xd2')][_0x9690('0x111')](db['JscriptyAnswerReport'],{'foreignKey':_0x9690('0x1c9'),'onDelete':_0x9690('0x110')});db[_0x9690('0x1ca')][_0x9690('0x120')](db[_0x9690('0x17d')],{});db[_0x9690('0x1ca')][_0x9690('0x120')](db[_0x9690('0xf4')],{'as':_0x9690('0x15f'),'foreignKey':_0x9690('0x160')});db[_0x9690('0x1ca')][_0x9690('0x120')](db[_0x9690('0x75')],{'as':'Contact','foreignKey':_0x9690('0x16a')});db[_0x9690('0x1ca')]['belongsTo'](db[_0x9690('0x5a')],{});db[_0x9690('0x1ca')]['belongsTo'](db[_0x9690('0x180')],{});db['SmsQueueReport']['belongsTo'](db[_0x9690('0x12')],{});db['SmsQueueReport'][_0x9690('0x120')](db[_0x9690('0x5d')],{});db[_0x9690('0x1cb')][_0x9690('0x111')](db[_0x9690('0xd2')],{'foreignKey':'ProjectId'});db[_0x9690('0x1cb')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x9690('0x1cc')});db['JscriptyProject'][_0x9690('0x111')](db[_0x9690('0xd0')],{'foreignKey':_0x9690('0x1cc')});db[_0x9690('0x13f')][_0x9690('0x122')](db[_0x9690('0x12')],{'as':_0x9690('0x16e'),'through':'user_has_square_projects'});db[_0x9690('0xe1')][_0x9690('0x122')](db[_0x9690('0x12')],{'as':_0x9690('0x164'),'through':_0x9690('0x1cd')});db[_0x9690('0xe1')]['belongsToMany'](db[_0x9690('0x1c')],{'through':_0x9690('0x10a'),'as':'VoiceQueues'});db['Team'][_0x9690('0x122')](db[_0x9690('0x130')],{'through':'team_has_mail_queues','as':_0x9690('0x131')});db[_0x9690('0xe1')][_0x9690('0x122')](db[_0x9690('0x189')],{'through':_0x9690('0x1ce'),'as':_0x9690('0x132')});db[_0x9690('0xe1')]['belongsToMany'](db['FaxQueue'],{'through':_0x9690('0x1cf'),'as':_0x9690('0x1d0')});db[_0x9690('0xe1')]['belongsToMany'](db[_0x9690('0x5d')],{'through':_0x9690('0x1d1'),'as':'SmsQueues'});db['Team'][_0x9690('0x122')](db[_0x9690('0x183')],{'through':_0x9690('0x1d2'),'as':_0x9690('0x135')});db['Team'][_0x9690('0x122')](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':_0x9690('0x136')});db[_0x9690('0xe1')][_0x9690('0x122')](db[_0x9690('0xf6')],{'through':_0x9690('0x10c'),'as':_0x9690('0x12f')});db[_0x9690('0xe5')][_0x9690('0x111')](db[_0x9690('0x147')],{'as':'Hoppers','foreignKey':_0x9690('0x194')});db[_0x9690('0xe5')][_0x9690('0x111')](db[_0x9690('0x7a')],{'as':_0x9690('0x116'),'foreignKey':_0x9690('0x194')});db[_0x9690('0xe5')][_0x9690('0x111')](db[_0x9690('0x7c')],{'as':'HopperHistories','foreignKey':'CampaignId'});db[_0x9690('0xe5')][_0x9690('0x111')](db[_0x9690('0x78')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x9690('0xe5')][_0x9690('0x120')](db['Trunk'],{'as':_0x9690('0x2d'),'foreignKey':_0x9690('0x1d3')});db['Campaign'][_0x9690('0x120')](db[_0x9690('0x2d')],{'as':'TrunkBackup','foreignKey':_0x9690('0x14d')});db[_0x9690('0xe5')][_0x9690('0x120')](db[_0x9690('0x14e')],{'as':_0x9690('0x14e'),'foreignKey':_0x9690('0x14f')});db[_0x9690('0xe5')]['belongsTo'](db[_0x9690('0x13f')],{'as':_0x9690('0x13f'),'foreignKey':_0x9690('0x1d4')});db[_0x9690('0xe5')][_0x9690('0x122')](db[_0x9690('0xf4')],{'as':_0x9690('0x124'),'through':_0x9690('0x1d5')});db[_0x9690('0xe5')]['belongsToMany'](db[_0x9690('0xf4')],{'as':'BlackLists','through':_0x9690('0x1d6')});db['Attachment'][_0x9690('0x120')](db[_0x9690('0x6d')],{'as':_0x9690('0x6d'),'foreignKey':_0x9690('0x173')});db['MailTransferReport']['belongsTo'](db[_0x9690('0x45')],{});db['MailTransferReport'][_0x9690('0x120')](db[_0x9690('0x43')],{});db[_0x9690('0xed')][_0x9690('0x120')](db[_0x9690('0x3f')],{'foreignKey':_0x9690('0x1d7'),'as':_0x9690('0x1d8')});db[_0x9690('0xed')][_0x9690('0x120')](db[_0x9690('0x12')],{'foreignKey':_0x9690('0x1d9'),'as':_0x9690('0x1da')});db[_0x9690('0xed')]['belongsTo'](db[_0x9690('0x12')],{'foreignKey':'ToUserId','as':_0x9690('0x1db')});db[_0x9690('0xed')][_0x9690('0x120')](db['MailQueue'],{'foreignKey':_0x9690('0x1dc'),'as':_0x9690('0x1dd')});db['MailTransferReport'][_0x9690('0x120')](db['MailAccount'],{'foreignKey':_0x9690('0x1de'),'as':_0x9690('0x1df')});db[_0x9690('0xef')][_0x9690('0x120')](db[_0x9690('0x6c')],{});db[_0x9690('0xef')][_0x9690('0x120')](db[_0x9690('0x6b')],{});db[_0x9690('0xef')][_0x9690('0x120')](db['ChatWebsite'],{'foreignKey':_0x9690('0x1e0'),'as':'FromAccount'});db[_0x9690('0xef')][_0x9690('0x120')](db[_0x9690('0x12')],{'foreignKey':_0x9690('0x1d9'),'as':_0x9690('0x1da')});db['ChatTransferReport'][_0x9690('0x120')](db['User'],{'foreignKey':_0x9690('0x1e1'),'as':_0x9690('0x1db')});db[_0x9690('0xef')][_0x9690('0x120')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0x9690('0x1dd')});db[_0x9690('0xef')][_0x9690('0x120')](db[_0x9690('0x171')],{'foreignKey':_0x9690('0x1e2'),'as':_0x9690('0x1df')});db[_0x9690('0xf1')][_0x9690('0x120')](db[_0x9690('0x54')],{});db[_0x9690('0xf1')]['belongsTo'](db['FaxInteraction'],{});db[_0x9690('0xf1')][_0x9690('0x120')](db[_0x9690('0x4f')],{'foreignKey':_0x9690('0x1e3'),'as':_0x9690('0x1d8')});db[_0x9690('0xf1')][_0x9690('0x120')](db[_0x9690('0x12')],{'foreignKey':_0x9690('0x1d9'),'as':'FromAgent'});db[_0x9690('0xf1')]['belongsTo'](db['User'],{'foreignKey':_0x9690('0x1e1'),'as':_0x9690('0x1db')});db['FaxTransferReport'][_0x9690('0x120')](db['FaxQueue'],{'foreignKey':_0x9690('0x1e4'),'as':_0x9690('0x1dd')});db[_0x9690('0xf1')][_0x9690('0x120')](db['FaxAccount'],{'foreignKey':_0x9690('0x1e5'),'as':'ToAccount'});db[_0x9690('0xf2')][_0x9690('0x120')](db['OpenchannelMessage'],{});db[_0x9690('0xf2')][_0x9690('0x120')](db[_0x9690('0x62')],{});db[_0x9690('0xf2')][_0x9690('0x120')](db[_0x9690('0x5f')],{'foreignKey':_0x9690('0x1e6'),'as':_0x9690('0x1d8')});db[_0x9690('0xf2')]['belongsTo'](db[_0x9690('0x12')],{'foreignKey':_0x9690('0x1d9'),'as':_0x9690('0x1da')});db[_0x9690('0xf2')][_0x9690('0x120')](db['User'],{'foreignKey':_0x9690('0x1e1'),'as':'ToAgent'});db[_0x9690('0xf2')][_0x9690('0x120')](db[_0x9690('0x183')],{'foreignKey':_0x9690('0x1e7'),'as':_0x9690('0x1dd')});db['OpenchannelTransferReport'][_0x9690('0x120')](db[_0x9690('0x5f')],{'foreignKey':_0x9690('0x1e8'),'as':'ToAccount'});db['SmsTransferReport'][_0x9690('0x120')](db['SmsMessage'],{});db[_0x9690('0x1e9')][_0x9690('0x120')](db[_0x9690('0x5a')],{});db[_0x9690('0x1e9')][_0x9690('0x120')](db[_0x9690('0x17d')],{'foreignKey':_0x9690('0x1ea'),'as':_0x9690('0x1d8')});db[_0x9690('0x1e9')]['belongsTo'](db[_0x9690('0x12')],{'foreignKey':'FromUserId','as':_0x9690('0x1da')});db[_0x9690('0x1e9')]['belongsTo'](db[_0x9690('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x9690('0x1e9')][_0x9690('0x120')](db[_0x9690('0x5d')],{'foreignKey':_0x9690('0x1eb'),'as':_0x9690('0x1dd')});db[_0x9690('0x1e9')][_0x9690('0x120')](db[_0x9690('0x17d')],{'foreignKey':_0x9690('0x1ec'),'as':_0x9690('0x1df')});db[_0x9690('0xf4')][_0x9690('0x111')](db[_0x9690('0x86')],{'as':_0x9690('0x15c'),'foreignKey':_0x9690('0x160'),'onDelete':_0x9690('0x110')});db['CmList']['hasMany'](db['CmCustomField'],{'as':_0x9690('0x1ed'),'foreignKey':_0x9690('0x160')});db[_0x9690('0xf4')][_0x9690('0x111')](db[_0x9690('0x75')],{'as':_0x9690('0x18f'),'onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x160')});db[_0x9690('0xf4')][_0x9690('0x111')](db['CmHopperFinal'],{'as':_0x9690('0x116'),'foreignKey':_0x9690('0x160')});db[_0x9690('0xf4')]['hasMany'](db[_0x9690('0x7c')],{'as':'HopperHistory','foreignKey':_0x9690('0x160')});db[_0x9690('0xf4')][_0x9690('0x111')](db[_0x9690('0x118')],{'as':'ReportAgentPreview','foreignKey':_0x9690('0x160')});db[_0x9690('0xf4')][_0x9690('0x122')](db[_0x9690('0x1c')],{'as':'Queues','through':_0x9690('0x1ee')});db['CmList'][_0x9690('0x122')](db[_0x9690('0x12')],{'as':'Agents','through':'cm_user_has_lists'});db[_0x9690('0xf6')][_0x9690('0x111')](db[_0x9690('0x19')],{'as':_0x9690('0x19f'),'onDelete':_0x9690('0x110')});db[_0x9690('0xf6')]['belongsToMany'](db[_0x9690('0x12')],{'as':_0x9690('0x164'),'through':_0x9690('0x10d')});db['VoicePrefix']['belongsToMany'](db['Team'],{'through':_0x9690('0x10c'),'as':_0x9690('0x166')});db[_0x9690('0xf8')][_0x9690('0x111')](db[_0x9690('0x12')],{'as':'Users','foreignKey':_0x9690('0x121')});db[_0x9690('0xf8')][_0x9690('0x111')](db[_0x9690('0x1ef')],{'as':_0x9690('0x1f0'),'foreignKey':_0x9690('0x121'),'onDelete':_0x9690('0x110')});db[_0x9690('0x1ef')][_0x9690('0x111')](db['UserProfileResource'],{'as':'Resources','foreignKey':_0x9690('0x1f1'),'onDelete':_0x9690('0x110')});db[_0x9690('0xfe')][_0x9690('0x111')](db['Disposition'],{'as':_0x9690('0x15c'),'foreignKey':_0x9690('0x1f2'),'onDelete':'cascade'});db['WhatsappAccount'][_0x9690('0x111')](db[_0x9690('0x84')],{'as':_0x9690('0x15d'),'foreignKey':_0x9690('0x1f2')});db['WhatsappAccount'][_0x9690('0x111')](db[_0x9690('0x102')],{'as':_0x9690('0x152'),'foreignKey':_0x9690('0x1f2')});db[_0x9690('0xfe')][_0x9690('0x111')](db[_0x9690('0x12b')],{'as':_0x9690('0x15e')});db['WhatsappAccount'][_0x9690('0x111')](db[_0x9690('0x100')],{'as':_0x9690('0x143')});db[_0x9690('0xfe')]['belongsTo'](db[_0x9690('0xf4')],{'as':_0x9690('0x15f'),'foreignKey':_0x9690('0x160')});db['WhatsappAccount'][_0x9690('0x120')](db[_0x9690('0x89')],{'as':'mandatoryDispositionPause','foreignKey':_0x9690('0x163')});db['WhatsappAccount'][_0x9690('0x122')](db[_0x9690('0x12')],{'as':'Agents','through':_0x9690('0x1f3')});db[_0x9690('0x100')]['belongsTo'](db['User'],{'onDelete':_0x9690('0x174')});db[_0x9690('0x100')][_0x9690('0x120')](db[_0x9690('0x1f4')],{'onDelete':_0x9690('0x174')});db['WhatsappApplication'][_0x9690('0x120')](db[_0x9690('0xfe')],{'onDelete':_0x9690('0x174')});db[_0x9690('0x100')][_0x9690('0x120')](db['Interval'],{'onDelete':_0x9690('0x174'),'foreignKey':_0x9690('0x14f')});db[_0x9690('0x100')][_0x9690('0x120')](db[_0x9690('0x90')],{'onDelete':_0x9690('0x174'),'foreignKey':'TagId'});db['WhatsappInteraction'][_0x9690('0x111')](db[_0x9690('0x102')],{'as':_0x9690('0x152'),'onDelete':_0x9690('0x110'),'foreignKey':_0x9690('0x1f5')});db[_0x9690('0x12b')][_0x9690('0x120')](db[_0x9690('0xfe')],{'as':_0x9690('0x168'),'foreignKey':_0x9690('0x1f2')});db[_0x9690('0x12b')]['belongsTo'](db['CmContact'],{'as':_0x9690('0x169'),'foreignKey':_0x9690('0x16a')});db[_0x9690('0x12b')][_0x9690('0x120')](db[_0x9690('0x12')],{'as':_0x9690('0x16b'),'foreignKey':_0x9690('0x114')});db['WhatsappInteraction'][_0x9690('0x122')](db[_0x9690('0x90')],{'through':_0x9690('0x1a8'),'as':_0x9690('0x16d')});db[_0x9690('0x12b')][_0x9690('0x122')](db[_0x9690('0x90')],{'through':_0x9690('0x1a8'),'as':_0x9690('0x17c')});db[_0x9690('0x12b')][_0x9690('0x122')](db[_0x9690('0x12')],{'as':'Users','through':_0x9690('0x12d'),'foreignKey':_0x9690('0x1f5')});db['WhatsappMessage']['belongsTo'](db['User'],{'as':_0x9690('0x12')});db[_0x9690('0x102')][_0x9690('0x120')](db['CmContact'],{'onDelete':_0x9690('0x110'),'as':'Contact'});db[_0x9690('0x102')][_0x9690('0x120')](db[_0x9690('0x12b')],{'onDelete':'cascade','as':'Interaction','foreignKey':'WhatsappInteractionId'});db['WhatsappMessage'][_0x9690('0x120')](db[_0x9690('0xfe')],{'as':_0x9690('0x168'),'foreignKey':_0x9690('0x1f2')});db[_0x9690('0x104')][_0x9690('0x120')](db[_0x9690('0xfe')],{});db[_0x9690('0x104')][_0x9690('0x120')](db['CmList'],{'as':_0x9690('0x15f'),'foreignKey':_0x9690('0x160')});db[_0x9690('0x104')][_0x9690('0x120')](db[_0x9690('0x75')],{'as':_0x9690('0x169'),'foreignKey':_0x9690('0x16a')});db[_0x9690('0x104')]['belongsTo'](db[_0x9690('0x12b')],{});db[_0x9690('0x104')][_0x9690('0x120')](db[_0x9690('0x1f4')],{});db['WhatsappQueueReport'][_0x9690('0x120')](db[_0x9690('0x102')],{});db[_0x9690('0x104')]['belongsTo'](db['User'],{});db[_0x9690('0x106')][_0x9690('0x120')](db[_0x9690('0x102')],{});db['WhatsappTransferReport'][_0x9690('0x120')](db['WhatsappInteraction'],{});db[_0x9690('0x106')][_0x9690('0x120')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0x9690('0x1d8')});db[_0x9690('0x106')]['belongsTo'](db[_0x9690('0xfe')],{'foreignKey':_0x9690('0x1f6'),'as':'ToAccount'});db[_0x9690('0x106')]['belongsTo'](db[_0x9690('0x1f4')],{'foreignKey':_0x9690('0x1f7'),'as':_0x9690('0x1dd')});db[_0x9690('0x106')][_0x9690('0x120')](db[_0x9690('0x12')],{'foreignKey':_0x9690('0x1d9'),'as':_0x9690('0x1da')});db[_0x9690('0x106')][_0x9690('0x120')](db[_0x9690('0x12')],{'foreignKey':'ToUserId','as':_0x9690('0x1db')});db['WhatsappQueue'][_0x9690('0x122')](db[_0x9690('0x12')],{'as':_0x9690('0x164'),'through':_0x9690('0x3a'),'foreignKey':_0x9690('0x1f8')});db[_0x9690('0x1f4')][_0x9690('0x122')](db[_0x9690('0xe1')],{'through':_0x9690('0x1f9'),'as':'Teams'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x907a=['../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../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','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.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','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Interval','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','../api/tag/tag.model','Template','Trigger','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','VoiceMail','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperHistory','OpenchannelInteractions','ChatInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','WhatsappInteraction','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueue','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','HopperBlacks','JscriptySessions','TrunkBackup','TrunkBackupId','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailServerIn','MailAccountId','hasOne','Imap','Smtp','Messages','Interactions','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Account','Tag','Tags','mail_interaction_has_tags','ThroughTags','Interaction','ChatWebsite','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','MailQueueReport','List','Dashboard','Dispositions','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','Owner','fax_interaction_has_tags','Users','Attachment','SmsAccountId','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelApplication','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','AttachmentId','OpenchannelQueueId','team_has_openchannel_queues','Answers','ChatMessage','OpenchannelQueueReport','Agent','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','Attachments','team_has_chat_queues','ChatGroupId','SmsInteractions','CompanyId','cm_contact_has_tags','Queue','CampaignId','CmHopperBlack','Condition','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','sms_interaction_has_tags','whatsapp_interaction_has_tags','AllConditions','TriggerAllId','AnyConditions','AnyCondition','TriggerId','AnalyticFieldReport','Fields','AnalyticMetric','MetricId','SalesforceAccount','Configurations','Subjects','SubjectId','Subject','Description','DescriptionId','Field','Variable','VariableId','Descriptions','FieldId','AccountId','DeskConfiguration','DeskAccount','ZohoField','ZendeskAccount','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerField','ServicenowConfiguration','Dynamics365Account','FreshsalesConfiguration','SessionId','SmsQueueReport','JscriptyProject','ProjectId','team_has_fax_queues','team_has_sms_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAgent','ToAgent','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','UserProfileSections','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','username','password','database','options','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailSubstatus'];(function(_0x407de4,_0x100335){var _0x455d69=function(_0x20528b){while(--_0x20528b){_0x407de4['push'](_0x407de4['shift']());}};_0x455d69(++_0x100335);}(_0x907a,0x1af));var _0xa907=function(_0x32a04b,_0x84f0af){_0x32a04b=_0x32a04b-0x0;var _0x5b1791=_0x907a[_0x32a04b];return _0x5b1791;};'use strict';var config=require(_0xa907('0x0'));var Sequelize=require(_0xa907('0x1'));var _=require(_0xa907('0x2'));var jstz=require(_0xa907('0x3'));var timezone=jstz[_0xa907('0x4')]();config[_0xa907('0x1')]=_[_0xa907('0x5')](config[_0xa907('0x1')],{'database':_0xa907('0x6'),'username':'xcall','password':_0xa907('0x7'),'options':{'host':_0xa907('0x8'),'port':0xcea,'dialect':_0xa907('0x9'),'dialectOptions':{'charset':_0xa907('0xa')},'logging':![],'timezone':timezone[_0xa907('0xb')](),'define':{'charset':_0xa907('0xc'),'collate':_0xa907('0xd')}}});config[_0xa907('0xe')]=_[_0xa907('0x5')](config[_0xa907('0xe')],{'database':'motion2','username':'xcall','password':_0xa907('0x7'),'options':{'host':_0xa907('0x8'),'port':0xcea,'dialect':_0xa907('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xa907('0xc'),'collate':_0xa907('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa907('0x1')]['database'],config[_0xa907('0x1')][_0xa907('0xf')],config[_0xa907('0x1')][_0xa907('0x10')],config[_0xa907('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa907('0xe')][_0xa907('0x11')],config['sequelizeHistory'][_0xa907('0xf')],config[_0xa907('0xe')][_0xa907('0x10')],config['sequelizeHistory'][_0xa907('0x12')])};db[_0xa907('0x13')]=db[_0xa907('0x1')]['import']('../api/user/user.model');db[_0xa907('0x14')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x16'));db[_0xa907('0x17')]=db['sequelize'][_0xa907('0x15')](_0xa907('0x18'));db[_0xa907('0x19')]=db[_0xa907('0x1')][_0xa907('0x15')]('../api/voiceExtension/voiceExtension.model');db[_0xa907('0x1a')]=db['sequelize']['import'](_0xa907('0x1b'));db[_0xa907('0x1c')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x1d'));db[_0xa907('0x1e')]=db[_0xa907('0x1')]['import'](_0xa907('0x1f'));db[_0xa907('0x20')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x21'));db['VoiceMail']=db[_0xa907('0x1')][_0xa907('0x15')]('../api/voiceMail/voiceMail.model');db[_0xa907('0x22')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x23'));db[_0xa907('0x24')]=db['sequelize'][_0xa907('0x15')](_0xa907('0x25'));db[_0xa907('0x26')]=db[_0xa907('0x1')]['import'](_0xa907('0x27'));db['VoiceAgentReport']=db[_0xa907('0x1')][_0xa907('0x15')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0xa907('0x28')]=db['sequelize']['import'](_0xa907('0x29'));db['MemberReport']=db[_0xa907('0x1')][_0xa907('0x15')]('../api/memberReport/memberReport.model');db[_0xa907('0x2a')]=db['sequelize'][_0xa907('0x15')](_0xa907('0x2b'));db[_0xa907('0x2c')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x2d'));db[_0xa907('0x2e')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x2f'));db[_0xa907('0x30')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x31'));db['UserChatQueue']=db[_0xa907('0x1')][_0xa907('0x15')]('../api/userChatQueue/userChatQueue.model');db[_0xa907('0x32')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x33'));db[_0xa907('0x34')]=db[_0xa907('0x1')]['import'](_0xa907('0x35'));db[_0xa907('0x36')]=db[_0xa907('0x1')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0xa907('0x37')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x38'));db[_0xa907('0x39')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x3a'));db['MailServerIn']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x3b'));db[_0xa907('0x3c')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x3d'));db[_0xa907('0x3e')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x3f'));db['MailQueue']=db[_0xa907('0x1')]['import']('../api/mailQueue/mailQueue.model');db[_0xa907('0x40')]=db['sequelize'][_0xa907('0x15')](_0xa907('0x41'));db[_0xa907('0x42')]=db['sequelize']['import'](_0xa907('0x43'));db[_0xa907('0x44')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x45'));db[_0xa907('0x46')]=db[_0xa907('0x1')][_0xa907('0x15')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x47'));db['Dashboard']=db['sequelize']['import'](_0xa907('0x48'));db[_0xa907('0x49')]=db[_0xa907('0x1')]['import']('../api/dashboardItem/dashboardItem.model');db[_0xa907('0x4a')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x4b'));db[_0xa907('0x4c')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x4d'));db[_0xa907('0x4e')]=db[_0xa907('0x1')]['import'](_0xa907('0x4f'));db[_0xa907('0x50')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x51'));db[_0xa907('0x52')]=db['sequelize']['import'](_0xa907('0x53'));db[_0xa907('0x54')]=db[_0xa907('0x1')][_0xa907('0x15')]('../api/faxQueueReport/faxQueueReport.model');db[_0xa907('0x55')]=db[_0xa907('0x1')]['import'](_0xa907('0x56'));db[_0xa907('0x57')]=db[_0xa907('0x1')][_0xa907('0x15')]('../api/smsApplication/smsApplication.model');db[_0xa907('0x58')]=db['sequelize']['import'](_0xa907('0x59'));db[_0xa907('0x5a')]=db[_0xa907('0x1')]['import']('../api/smsMessage/smsMessage.model');db[_0xa907('0x5b')]=db['sequelize'][_0xa907('0x15')](_0xa907('0x5c'));db[_0xa907('0x5d')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x5e'));db['OpenchannelApplication']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x5f'));db[_0xa907('0x60')]=db['sequelize'][_0xa907('0x15')](_0xa907('0x61'));db[_0xa907('0x62')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x63'));db['OpenchannelQueue']=db['sequelize'][_0xa907('0x15')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x64'));db['OpenchannelQueueReport']=db['sequelize']['import'](_0xa907('0x65'));db[_0xa907('0x66')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x67'));db[_0xa907('0x68')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x69'));db['ChatMessage']=db['sequelize'][_0xa907('0x15')](_0xa907('0x6a'));db[_0xa907('0x6b')]=db[_0xa907('0x1')][_0xa907('0x15')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0xa907('0x6c')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x6d'));db[_0xa907('0x6e')]=db[_0xa907('0x1')]['import']('../api/chatGroup/chatGroup.model');db[_0xa907('0x6f')]=db[_0xa907('0x1')]['import'](_0xa907('0x70'));db[_0xa907('0x71')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x72'));db[_0xa907('0x73')]=db['sequelize'][_0xa907('0x15')](_0xa907('0x74'));db[_0xa907('0x75')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x76'));db['CmHopperBlack']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x77'));db[_0xa907('0x78')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x79'));db[_0xa907('0x7a')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x7b'));db[_0xa907('0x7c')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x7d'));db[_0xa907('0x7e')]=db[_0xa907('0x1')]['import']('../api/cmCustomField/cmCustomField.model');db[_0xa907('0x7f')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x80'));db[_0xa907('0x81')]=db[_0xa907('0x1')][_0xa907('0x15')]('../api/automation/automation.model');db[_0xa907('0x82')]=db['sequelize']['import'](_0xa907('0x83'));db[_0xa907('0x84')]=db[_0xa907('0x1')]['import']('../api/disposition/disposition.model');db['Condition']=db[_0xa907('0x1')][_0xa907('0x15')]('../api/condition/condition.model');db[_0xa907('0x85')]=db[_0xa907('0x1')][_0xa907('0x15')]('../api/interval/interval.model');db['Pause']=db['sequelize'][_0xa907('0x15')](_0xa907('0x86'));db[_0xa907('0x87')]=db[_0xa907('0x1')]['import'](_0xa907('0x88'));db[_0xa907('0x89')]=db['sequelize']['import'](_0xa907('0x8a'));db[_0xa907('0x8b')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x8c'));db['Sound']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x8d'));db['Tag']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x8e'));db[_0xa907('0x8f')]=db[_0xa907('0x1')][_0xa907('0x15')]('../api/template/template.model');db[_0xa907('0x90')]=db[_0xa907('0x1')][_0xa907('0x15')]('../api/trigger/trigger.model');db['Variable']=db[_0xa907('0x1')]['import'](_0xa907('0x91'));db[_0xa907('0x92')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x93'));db['IntegrationReport']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x94'));db[_0xa907('0x95')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x96'));db[_0xa907('0x97')]=db[_0xa907('0x1')][_0xa907('0x15')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x98'));db['AnalyticMetric']=db['sequelize'][_0xa907('0x15')](_0xa907('0x99'));db['AnalyticFieldReport']=db[_0xa907('0x1')][_0xa907('0x15')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x9a'));db['SalesforceAccount']=db[_0xa907('0x1')]['import'](_0xa907('0x9b'));db[_0xa907('0x9c')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x9d'));db[_0xa907('0x9e')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x9f'));db['SugarcrmAccount']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xa0'));db[_0xa907('0xa1')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xa2'));db[_0xa907('0xa3')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xa4'));db['DeskAccount']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xa5'));db['DeskConfiguration']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xa6'));db[_0xa907('0xa7')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xa8'));db[_0xa907('0xa9')]=db[_0xa907('0x1')][_0xa907('0x15')]('../api/intZohoAccount/intZohoAccount.model');db[_0xa907('0xaa')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xab'));db['ZohoField']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xac'));db['ZendeskAccount']=db['sequelize'][_0xa907('0x15')](_0xa907('0xad'));db[_0xa907('0xae')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xaf'));db['ZendeskField']=db['sequelize'][_0xa907('0x15')](_0xa907('0xb0'));db[_0xa907('0xb1')]=db[_0xa907('0x1')][_0xa907('0x15')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xa907('0xb2')]=db['sequelize'][_0xa907('0x15')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xa907('0xb3')]=db['sequelize'][_0xa907('0x15')](_0xa907('0xb4'));db[_0xa907('0xb5')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xb6'));db[_0xa907('0xb7')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xb8'));db['VtigerField']=db[_0xa907('0x1')]['import'](_0xa907('0xb9'));db[_0xa907('0xba')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xbb'));db['ServicenowConfiguration']=db[_0xa907('0x1')]['import'](_0xa907('0xbc'));db[_0xa907('0xbd')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xbe'));db['Dynamics365Account']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xbf'));db[_0xa907('0xc0')]=db['sequelize'][_0xa907('0x15')](_0xa907('0xc1'));db[_0xa907('0xc2')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xc3'));db[_0xa907('0xc4')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xc5'));db['FreshsalesConfiguration']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xc6'));db[_0xa907('0xc7')]=db['sequelize']['import'](_0xa907('0xc8'));db['Integration']=db[_0xa907('0x1')]['import'](_0xa907('0x93'));db['Network']=db[_0xa907('0x1')]['import'](_0xa907('0xc9'));db[_0xa907('0xca')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xcb'));db[_0xa907('0xcc')]=db['sequelize'][_0xa907('0x15')](_0xa907('0xcd'));db[_0xa907('0xce')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xcf'));db[_0xa907('0xd0')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xd1'));db[_0xa907('0xd2')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xd3'));db['SmsQueueReport']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xd4'));db['SquareReport']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xd5'));db[_0xa907('0xd6')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xd7'));db['JscriptyProject']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xd8'));db[_0xa907('0xd9')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xda'));db[_0xa907('0xdb')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xdc'));db[_0xa907('0xdd')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xde'));db[_0xa907('0xdf')]=db[_0xa907('0x1')][_0xa907('0x15')]('../api/squareRecording/squareRecording.model');db[_0xa907('0xe0')]=db['sequelize']['import']('../api/squareMessage/squareMessage.model');db[_0xa907('0xe1')]=db[_0xa907('0x1')][_0xa907('0x15')]('../api/team/team.model');db[_0xa907('0xe2')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xe3'));db[_0xa907('0xe4')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xe5'));db['Migration']=db[_0xa907('0x1')][_0xa907('0x15')]('../api/migration/migration.model');db['Attachment']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xe6'));db[_0xa907('0xe7')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xe8'));db[_0xa907('0xe9')]=db[_0xa907('0x1')]['import'](_0xa907('0xea'));db[_0xa907('0xeb')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xec'));db['FaxTransferReport']=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xed'));db[_0xa907('0xee')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xef'));db[_0xa907('0xf0')]=db[_0xa907('0x1')][_0xa907('0x15')]('../api/smsTransferReport/smsTransferReport.model');db[_0xa907('0xf1')]=db[_0xa907('0x1')]['import']('../api/cmList/cmList.model');db[_0xa907('0xf2')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xf3'));db[_0xa907('0xf4')]=db[_0xa907('0x1')][_0xa907('0x15')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0xa907('0x1')]['import'](_0xa907('0xf5'));db[_0xa907('0xf6')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xf7'));db[_0xa907('0xf8')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0xf9'));db[_0xa907('0xfa')]=db[_0xa907('0x1')]['import'](_0xa907('0xfb'));db[_0xa907('0xfc')]=db[_0xa907('0x1')]['import'](_0xa907('0xfd'));db['WhatsappInteraction']=db[_0xa907('0x1')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0xa907('0xfe')]=db[_0xa907('0x1')]['import'](_0xa907('0xff'));db[_0xa907('0x100')]=db[_0xa907('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xa907('0x101')]=db[_0xa907('0x1')]['import'](_0xa907('0x102'));db['WhatsappQueue']=db['sequelize'][_0xa907('0x15')](_0xa907('0x103'));db[_0xa907('0x104')]=db['sequelize']['import']('../api/cloudProvider/cloudProvider.model');db[_0xa907('0x105')]=db[_0xa907('0x1')]['import'](_0xa907('0x106'));db[_0xa907('0x107')]=db[_0xa907('0x1')][_0xa907('0x15')](_0xa907('0x108'));db[_0xa907('0x109')]=db['sequelize'][_0xa907('0x15')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0xa907('0x13')]['hasOne'](db['VoiceMail'],{'as':_0xa907('0x10a'),'onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x10c')});db['User'][_0xa907('0x10d')](db[_0xa907('0x1e')],{'as':_0xa907('0x10e'),'foreignKey':'UserId'});db[_0xa907('0x13')][_0xa907('0x10d')](db[_0xa907('0x2e')],{'as':_0xa907('0x10f'),'foreignKey':_0xa907('0x10c')});db[_0xa907('0x13')][_0xa907('0x10d')](db[_0xa907('0x19')],{'as':_0xa907('0x110'),'onDelete':_0xa907('0x10b'),'hooks':!![]});db[_0xa907('0x13')][_0xa907('0x10d')](db[_0xa907('0x78')],{'as':'HopperFinals','foreignKey':_0xa907('0x10c')});db[_0xa907('0x13')][_0xa907('0x10d')](db[_0xa907('0x7a')],{'as':_0xa907('0x111'),'foreignKey':_0xa907('0x10c')});db['User']['hasMany'](db[_0xa907('0x7c')],{'as':'ReportAgentPreview','foreignKey':_0xa907('0x10c')});db[_0xa907('0x13')][_0xa907('0x10d')](db[_0xa907('0x60')],{'as':_0xa907('0x112'),'foreignKey':_0xa907('0x10c')});db[_0xa907('0x13')][_0xa907('0x10d')](db[_0xa907('0x68')],{'as':_0xa907('0x113'),'foreignKey':_0xa907('0x10c')});db[_0xa907('0x13')][_0xa907('0x10d')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':'UserId'});db['User'][_0xa907('0x10d')](db[_0xa907('0x4e')],{'as':'FaxInteractions','foreignKey':_0xa907('0x10c')});db[_0xa907('0x13')]['hasMany'](db['MailInteraction'],{'as':_0xa907('0x114'),'foreignKey':_0xa907('0x10c')});db[_0xa907('0x13')][_0xa907('0x10d')](db['WhatsappInteraction'],{'as':_0xa907('0x115'),'foreignKey':_0xa907('0x10c')});db[_0xa907('0x13')][_0xa907('0x10d')](db[_0xa907('0xf8')],{'as':_0xa907('0x116'),'foreignKey':_0xa907('0x117')});db[_0xa907('0x13')][_0xa907('0x118')](db[_0xa907('0xf4')],{'as':_0xa907('0xf4'),'foreignKey':_0xa907('0x119')});db[_0xa907('0x13')][_0xa907('0x11a')](db[_0xa907('0x6e')],{'as':_0xa907('0x11b'),'through':_0xa907('0x11c')});db[_0xa907('0x13')]['belongsToMany'](db[_0xa907('0x73')],{'as':_0xa907('0x11d'),'through':_0xa907('0x11e')});db[_0xa907('0x13')][_0xa907('0x11a')](db[_0xa907('0xf1')],{'as':_0xa907('0x11f'),'through':_0xa907('0x120')});db[_0xa907('0x13')][_0xa907('0x11a')](db[_0xa907('0xe1')],{'through':_0xa907('0x121')});db['User'][_0xa907('0x11a')](db[_0xa907('0x42')],{'as':_0xa907('0x114'),'through':_0xa907('0x122')});db[_0xa907('0x13')]['belongsToMany'](db[_0xa907('0x68')],{'as':_0xa907('0x113'),'through':'user_has_chat_interactions'});db[_0xa907('0x13')][_0xa907('0x11a')](db[_0xa907('0x4e')],{'as':_0xa907('0x123'),'through':_0xa907('0x124')});db[_0xa907('0x13')][_0xa907('0x11a')](db[_0xa907('0x58')],{'as':'SmsInteractions','through':_0xa907('0x125')});db['User'][_0xa907('0x11a')](db[_0xa907('0x60')],{'as':_0xa907('0x112'),'through':'user_has_openchannel_interactions'});db['User']['belongsToMany'](db[_0xa907('0x126')],{'as':_0xa907('0x115'),'through':_0xa907('0x127')});db[_0xa907('0x13')][_0xa907('0x11a')](db[_0xa907('0x1c')],{'as':_0xa907('0x128'),'through':'UserVoiceQueue','required':![]});db[_0xa907('0x13')][_0xa907('0x11a')](db[_0xa907('0xf2')],{'as':_0xa907('0x129'),'through':_0xa907('0x109'),'required':![]});db['User'][_0xa907('0x11a')](db[_0xa907('0x12a')],{'as':_0xa907('0x12b'),'through':_0xa907('0x32'),'required':![]});db['User']['belongsToMany'](db[_0xa907('0x6c')],{'as':_0xa907('0x12c'),'through':_0xa907('0x12d'),'required':![],'hooks':!![]});db['User'][_0xa907('0x11a')](db['FaxQueue'],{'as':_0xa907('0x12e'),'through':_0xa907('0x34'),'required':![]});db[_0xa907('0x13')]['belongsToMany'](db[_0xa907('0x5b')],{'as':_0xa907('0x12f'),'through':'UserSmsQueue','required':![]});db[_0xa907('0x13')][_0xa907('0x11a')](db[_0xa907('0x130')],{'as':_0xa907('0x131'),'through':_0xa907('0x37'),'required':![]});db[_0xa907('0x13')][_0xa907('0x11a')](db[_0xa907('0x132')],{'as':_0xa907('0x133'),'through':_0xa907('0x39'),'required':![]});db[_0xa907('0x13')][_0xa907('0x11a')](db[_0xa907('0xf1')],{'through':'cm_user_has_lists'});db['User'][_0xa907('0x11a')](db[_0xa907('0xf2')],{'as':_0xa907('0x129'),'through':'user_has_voice_prefixes','required':![]});db[_0xa907('0x13')][_0xa907('0x11a')](db['ChatWebsite'],{'as':_0xa907('0x134'),'through':_0xa907('0x135')});db['User']['belongsToMany'](db[_0xa907('0x4a')],{'as':_0xa907('0x136'),'through':'user_has_fax_accounts'});db['User'][_0xa907('0x11a')](db['MailAccount'],{'as':_0xa907('0x137'),'through':_0xa907('0x138')});db['User'][_0xa907('0x11a')](db['OpenchannelAccount'],{'as':_0xa907('0x139'),'through':_0xa907('0x13a')});db[_0xa907('0x13')][_0xa907('0x11a')](db[_0xa907('0x55')],{'as':_0xa907('0x13b'),'through':_0xa907('0x13c')});db['User'][_0xa907('0x11a')](db[_0xa907('0xfa')],{'as':_0xa907('0x13d'),'through':'user_has_whatsapp_accounts'});db[_0xa907('0x13')][_0xa907('0x11a')](db[_0xa907('0xdd')],{'as':'SquareProjects','through':_0xa907('0x13e')});db['VoiceChanSpy']['hasMany'](db[_0xa907('0x19')],{'as':_0xa907('0x13f'),'onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x140')});db[_0xa907('0x17')][_0xa907('0x10d')](db['VoiceExtension'],{'onDelete':'cascade'});db[_0xa907('0x19')][_0xa907('0x10d')](db[_0xa907('0x19')],{'as':_0xa907('0x141'),'onDelete':_0xa907('0x10b')});db['VoiceMusicOnHold'][_0xa907('0x11a')](db[_0xa907('0x142')],{'as':_0xa907('0x143'),'through':_0xa907('0x144')});db['VoiceQueue'][_0xa907('0x10d')](db['UserVoiceQueueRt'],{'as':_0xa907('0x145'),'foreignKey':_0xa907('0x146')});db['VoiceQueue'][_0xa907('0x10d')](db[_0xa907('0x75')],{'as':_0xa907('0x147'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0xa907('0x78')],{'as':_0xa907('0x148'),'foreignKey':_0xa907('0x146')});db[_0xa907('0x1c')]['hasMany'](db[_0xa907('0x7a')],{'as':_0xa907('0x149'),'foreignKey':_0xa907('0x146')});db[_0xa907('0x1c')][_0xa907('0x10d')](db[_0xa907('0x7c')],{'as':'ReportAgentPreview','foreignKey':_0xa907('0x146')});db['VoiceQueue'][_0xa907('0x10d')](db['CmHopperBlack'],{'as':_0xa907('0x14a'),'foreignKey':_0xa907('0x146')});db['VoiceQueue'][_0xa907('0x10d')](db[_0xa907('0xd2')],{'as':_0xa907('0x14b'),'foreignKey':_0xa907('0x146')});db[_0xa907('0x1c')][_0xa907('0x118')](db[_0xa907('0x2a')],{'as':_0xa907('0x2a'),'foreignKey':'TrunkId'});db[_0xa907('0x1c')][_0xa907('0x118')](db[_0xa907('0x2a')],{'as':_0xa907('0x14c'),'foreignKey':_0xa907('0x14d')});db[_0xa907('0x1c')]['belongsTo'](db['Interval'],{'as':_0xa907('0x85'),'foreignKey':_0xa907('0x14e')});db[_0xa907('0x1c')]['belongsTo'](db[_0xa907('0x14f')],{'as':_0xa907('0x150'),'foreignKey':_0xa907('0x151')});db[_0xa907('0x1c')]['belongsToMany'](db['CmList'],{'as':'Lists','through':_0xa907('0x152')});db[_0xa907('0x1c')]['belongsToMany'](db[_0xa907('0x13')],{'as':_0xa907('0x153'),'through':_0xa907('0x30')});db[_0xa907('0x1c')]['belongsToMany'](db['Team'],{'as':_0xa907('0x154'),'through':_0xa907('0x105')});db[_0xa907('0x1c')]['belongsToMany'](db[_0xa907('0xf1')],{'as':_0xa907('0x155'),'through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0xa907('0x118')](db[_0xa907('0x13')],{'as':_0xa907('0x13'),'foreignKey':_0xa907('0x10c')});db[_0xa907('0x20')][_0xa907('0x118')](db[_0xa907('0x13')],{'as':'User','foreignKey':_0xa907('0x10c')});db[_0xa907('0x10a')]['hasMany'](db[_0xa907('0x22')],{'as':'Messages','onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x156'),'sourceKey':_0xa907('0x157')});db[_0xa907('0x22')][_0xa907('0x118')](db['VoiceMail'],{'foreignKey':_0xa907('0x156'),'targetKey':'mailbox'});db['VoiceCallReport']['hasMany'](db['VoiceQueueReport'],{'as':_0xa907('0x158'),'foreignKey':_0xa907('0x159'),'constraints':![]});db[_0xa907('0x24')][_0xa907('0x10d')](db[_0xa907('0x15a')],{'as':_0xa907('0x15b'),'foreignKey':_0xa907('0x159'),'constraints':![]});db['VoiceCallReport'][_0xa907('0x118')](db['User'],{'as':'User','foreignKey':_0xa907('0x10c')});db['VoiceCallReport'][_0xa907('0x118')](db[_0xa907('0x73')],{'as':_0xa907('0x15c'),'foreignKey':_0xa907('0x15d')});db[_0xa907('0x15e')][_0xa907('0x118')](db[_0xa907('0x3e')],{'as':'MailAccount','foreignKey':_0xa907('0x15f')});db[_0xa907('0x3c')][_0xa907('0x118')](db[_0xa907('0x3e')],{'as':_0xa907('0x3e'),'foreignKey':_0xa907('0x15f')});db[_0xa907('0x3e')][_0xa907('0x160')](db[_0xa907('0x15e')],{'as':_0xa907('0x161'),'onDelete':'cascade'});db[_0xa907('0x3e')][_0xa907('0x160')](db[_0xa907('0x3c')],{'as':_0xa907('0x162'),'onDelete':'cascade'});db[_0xa907('0x3e')][_0xa907('0x10d')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xa907('0x15f'),'onDelete':_0xa907('0x10b')});db[_0xa907('0x3e')][_0xa907('0x10d')](db[_0xa907('0x82')],{'as':'Answers','foreignKey':_0xa907('0x15f')});db['MailAccount']['hasMany'](db['MailMessage'],{'as':_0xa907('0x163'),'foreignKey':'MailAccountId'});db[_0xa907('0x3e')][_0xa907('0x10d')](db[_0xa907('0x42')],{'as':_0xa907('0x164')});db[_0xa907('0x3e')][_0xa907('0x10d')](db['MailApplication'],{'as':'Applications'});db[_0xa907('0x3e')][_0xa907('0x118')](db[_0xa907('0xf1')],{'as':'List','foreignKey':_0xa907('0x165')});db[_0xa907('0x3e')][_0xa907('0x118')](db['Template'],{'as':'Template','foreignKey':_0xa907('0x166')});db['MailAccount'][_0xa907('0x118')](db[_0xa907('0x14f')],{'as':_0xa907('0x150'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xa907('0x3e')][_0xa907('0x11a')](db[_0xa907('0x13')],{'as':_0xa907('0x153'),'through':_0xa907('0x138')});db[_0xa907('0x12a')][_0xa907('0x11a')](db['User'],{'as':_0xa907('0x153'),'through':_0xa907('0x32')});db[_0xa907('0x12a')][_0xa907('0x11a')](db[_0xa907('0xe1')],{'through':_0xa907('0x167'),'as':'Teams'});db[_0xa907('0x42')][_0xa907('0x10d')](db[_0xa907('0x44')],{'as':_0xa907('0x163'),'onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x168')});db[_0xa907('0x42')]['belongsTo'](db[_0xa907('0x3e')],{'as':_0xa907('0x169'),'foreignKey':'MailAccountId'});db[_0xa907('0x42')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xa907('0x15d')});db[_0xa907('0x42')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xa907('0x10c')});db['MailInteraction']['belongsToMany'](db[_0xa907('0x16a')],{'through':'mail_interaction_has_tags','as':_0xa907('0x16b')});db[_0xa907('0x42')][_0xa907('0x11a')](db[_0xa907('0x16a')],{'through':_0xa907('0x16c'),'as':_0xa907('0x16d')});db[_0xa907('0x42')]['belongsToMany'](db['User'],{'as':'Users','through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0xa907('0x44')]['hasMany'](db['Attachment'],{'as':'Attachments','onDelete':_0xa907('0x10b')});db[_0xa907('0x44')]['belongsTo'](db[_0xa907('0x13')],{'as':_0xa907('0x13')});db[_0xa907('0x44')][_0xa907('0x118')](db[_0xa907('0x73')],{'onDelete':'cascade','as':'Contact'});db['MailMessage'][_0xa907('0x118')](db['MailInteraction'],{'as':_0xa907('0x16e'),'foreignKey':_0xa907('0x168')});db[_0xa907('0x44')][_0xa907('0x118')](db[_0xa907('0x3e')],{'as':_0xa907('0x169'),'foreignKey':'MailAccountId'});db['MailMessage'][_0xa907('0x118')](db[_0xa907('0x16f')],{'as':_0xa907('0x16f'),'foreignKey':_0xa907('0x170')});db[_0xa907('0x44')][_0xa907('0x118')](db[_0xa907('0x6b')],{'as':_0xa907('0x6b'),'foreignKey':_0xa907('0x171')});db['MailApplication'][_0xa907('0x118')](db[_0xa907('0x13')],{'onDelete':_0xa907('0x172')});db['MailApplication'][_0xa907('0x118')](db[_0xa907('0x12a')],{'onDelete':'restrict'});db[_0xa907('0x46')][_0xa907('0x118')](db[_0xa907('0x3e')],{'onDelete':_0xa907('0x172')});db['MailApplication']['belongsTo'](db['Interval'],{'onDelete':_0xa907('0x172'),'foreignKey':'IntervalId'});db[_0xa907('0x46')][_0xa907('0x118')](db[_0xa907('0x16a')],{'onDelete':_0xa907('0x172'),'foreignKey':_0xa907('0x173')});db['MailQueueReport'][_0xa907('0x118')](db[_0xa907('0x3e')],{});db[_0xa907('0x174')][_0xa907('0x118')](db[_0xa907('0xf1')],{'as':_0xa907('0x175'),'foreignKey':_0xa907('0x165')});db[_0xa907('0x174')][_0xa907('0x118')](db[_0xa907('0x73')],{'as':_0xa907('0x15c'),'foreignKey':'ContactId'});db[_0xa907('0x174')][_0xa907('0x118')](db[_0xa907('0x42')],{});db[_0xa907('0x174')][_0xa907('0x118')](db[_0xa907('0x44')],{});db[_0xa907('0x174')][_0xa907('0x118')](db[_0xa907('0x13')],{});db[_0xa907('0x174')][_0xa907('0x118')](db['MailQueue'],{});db[_0xa907('0x176')][_0xa907('0x10d')](db[_0xa907('0x49')],{'as':'Items','onDelete':_0xa907('0x10b')});db[_0xa907('0x4a')]['hasMany'](db[_0xa907('0x84')],{'as':_0xa907('0x177'),'foreignKey':_0xa907('0x178'),'onDelete':_0xa907('0x10b')});db[_0xa907('0x4a')][_0xa907('0x10d')](db[_0xa907('0x82')],{'as':'Answers','foreignKey':_0xa907('0x178')});db[_0xa907('0x4a')]['hasMany'](db[_0xa907('0x4e')],{'as':_0xa907('0x164')});db[_0xa907('0x4a')]['hasMany'](db[_0xa907('0x4c')],{'as':'Applications'});db[_0xa907('0x4a')][_0xa907('0x10d')](db[_0xa907('0x19')],{'as':_0xa907('0x179'),'onDelete':_0xa907('0x10b')});db[_0xa907('0x4a')]['hasMany'](db[_0xa907('0x50')],{'as':'Messages'});db[_0xa907('0x4a')][_0xa907('0x118')](db['Trunk'],{'as':_0xa907('0x2a')});db[_0xa907('0x4a')][_0xa907('0x118')](db[_0xa907('0xf1')],{'as':'List','foreignKey':'ListId'});db[_0xa907('0x4a')]['belongsTo'](db['Pause'],{'as':_0xa907('0x150'),'foreignKey':_0xa907('0x151')});db['FaxAccount']['belongsToMany'](db[_0xa907('0x13')],{'as':'Agents','through':_0xa907('0x17a')});db[_0xa907('0x4c')][_0xa907('0x118')](db['User'],{'onDelete':'restrict'});db[_0xa907('0x4c')][_0xa907('0x118')](db['FaxQueue'],{'onDelete':_0xa907('0x172')});db[_0xa907('0x4c')][_0xa907('0x118')](db[_0xa907('0x4a')],{'onDelete':_0xa907('0x172')});db[_0xa907('0x4c')][_0xa907('0x118')](db[_0xa907('0x16a')],{'onDelete':_0xa907('0x172'),'foreignKey':_0xa907('0x173')});db['FaxInteraction'][_0xa907('0x10d')](db[_0xa907('0x50')],{'as':_0xa907('0x163'),'onDelete':'cascade','foreignKey':_0xa907('0x17b')});db[_0xa907('0x4e')]['belongsTo'](db['FaxAccount'],{'as':_0xa907('0x169'),'foreignKey':_0xa907('0x178')});db[_0xa907('0x4e')]['belongsTo'](db['CmContact'],{'as':_0xa907('0x15c'),'foreignKey':_0xa907('0x15d')});db[_0xa907('0x4e')][_0xa907('0x118')](db[_0xa907('0x13')],{'as':_0xa907('0x17c'),'foreignKey':_0xa907('0x10c')});db['FaxInteraction'][_0xa907('0x11a')](db[_0xa907('0x16a')],{'through':_0xa907('0x17d'),'as':_0xa907('0x16b')});db[_0xa907('0x4e')][_0xa907('0x11a')](db[_0xa907('0x16a')],{'through':_0xa907('0x17d'),'as':_0xa907('0x16d')});db[_0xa907('0x4e')][_0xa907('0x11a')](db[_0xa907('0x13')],{'as':_0xa907('0x17e'),'through':'user_has_fax_interactions','foreignKey':_0xa907('0x17b')});db[_0xa907('0x50')][_0xa907('0x118')](db[_0xa907('0x13')],{'onDelete':_0xa907('0x10b'),'as':_0xa907('0x13')});db[_0xa907('0x50')]['belongsTo'](db[_0xa907('0x4e')],{'as':_0xa907('0x16e'),'foreignKey':_0xa907('0x17b')});db[_0xa907('0x50')][_0xa907('0x118')](db['CmContact'],{'onDelete':_0xa907('0x10b'),'as':_0xa907('0x15c')});db[_0xa907('0x50')]['belongsTo'](db[_0xa907('0x17f')],{'as':_0xa907('0x17f'),'foreignKey':'AttachmentId'});db[_0xa907('0x50')][_0xa907('0x118')](db[_0xa907('0x4a')],{'as':_0xa907('0x169'),'foreignKey':_0xa907('0x178')});db['FaxQueue'][_0xa907('0x11a')](db[_0xa907('0x13')],{'as':_0xa907('0x153'),'through':_0xa907('0x34')});db['FaxQueue'][_0xa907('0x11a')](db[_0xa907('0xe1')],{'through':'team_has_fax_queues','as':_0xa907('0x154')});db['FaxQueueReport']['belongsTo'](db[_0xa907('0x4a')],{});db[_0xa907('0x54')][_0xa907('0x118')](db[_0xa907('0xf1')],{'as':_0xa907('0x175'),'foreignKey':_0xa907('0x165')});db[_0xa907('0x54')][_0xa907('0x118')](db[_0xa907('0x73')],{'as':'Contact','foreignKey':'ContactId'});db[_0xa907('0x54')][_0xa907('0x118')](db['FaxInteraction'],{});db[_0xa907('0x54')][_0xa907('0x118')](db[_0xa907('0x50')],{});db[_0xa907('0x54')][_0xa907('0x118')](db[_0xa907('0x13')],{});db[_0xa907('0x54')][_0xa907('0x118')](db[_0xa907('0x52')],{});db['SmsAccount'][_0xa907('0x10d')](db[_0xa907('0x84')],{'as':'Dispositions','foreignKey':_0xa907('0x180'),'onDelete':_0xa907('0x10b')});db[_0xa907('0x55')]['hasMany'](db[_0xa907('0x82')],{'as':'Answers','foreignKey':_0xa907('0x180')});db[_0xa907('0x55')]['hasMany'](db[_0xa907('0x5a')],{'as':_0xa907('0x163'),'foreignKey':'SmsAccountId'});db[_0xa907('0x55')]['hasMany'](db[_0xa907('0x58')],{'as':_0xa907('0x164')});db[_0xa907('0x55')][_0xa907('0x10d')](db['SmsApplication'],{'as':_0xa907('0x141')});db['SmsAccount']['belongsTo'](db[_0xa907('0xf1')],{'as':'List','foreignKey':_0xa907('0x165')});db[_0xa907('0x55')]['belongsTo'](db[_0xa907('0x14f')],{'as':_0xa907('0x150'),'foreignKey':_0xa907('0x151')});db[_0xa907('0x55')]['belongsToMany'](db[_0xa907('0x13')],{'as':_0xa907('0x153'),'through':'user_has_sms_accounts'});db[_0xa907('0x57')]['belongsTo'](db[_0xa907('0x13')],{'onDelete':_0xa907('0x172')});db[_0xa907('0x57')][_0xa907('0x118')](db[_0xa907('0x5b')],{'onDelete':'restrict'});db[_0xa907('0x57')][_0xa907('0x118')](db[_0xa907('0x55')],{'onDelete':_0xa907('0x172')});db[_0xa907('0x57')][_0xa907('0x118')](db[_0xa907('0x85')],{'onDelete':'restrict','foreignKey':_0xa907('0x14e')});db[_0xa907('0x57')][_0xa907('0x118')](db['Tag'],{'onDelete':_0xa907('0x172'),'foreignKey':'TagId'});db[_0xa907('0x58')][_0xa907('0x10d')](db[_0xa907('0x5a')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xa907('0x181')});db['SmsInteraction'][_0xa907('0x118')](db[_0xa907('0x55')],{'as':_0xa907('0x169'),'foreignKey':'SmsAccountId'});db[_0xa907('0x58')]['belongsTo'](db['CmContact'],{'as':_0xa907('0x15c'),'foreignKey':_0xa907('0x15d')});db['SmsInteraction'][_0xa907('0x118')](db[_0xa907('0x13')],{'as':_0xa907('0x17c'),'foreignKey':_0xa907('0x10c')});db['SmsInteraction'][_0xa907('0x11a')](db[_0xa907('0x16a')],{'through':'sms_interaction_has_tags','as':'Tags'});db['SmsInteraction']['belongsToMany'](db[_0xa907('0x16a')],{'through':'sms_interaction_has_tags','as':_0xa907('0x16d')});db[_0xa907('0x58')][_0xa907('0x11a')](db[_0xa907('0x13')],{'as':_0xa907('0x17e'),'through':_0xa907('0x125'),'foreignKey':_0xa907('0x181')});db['SmsMessage']['belongsTo'](db[_0xa907('0x13')],{'as':_0xa907('0x13')});db[_0xa907('0x5a')]['belongsTo'](db['CmContact'],{'onDelete':_0xa907('0x10b'),'as':_0xa907('0x15c')});db[_0xa907('0x5a')][_0xa907('0x118')](db[_0xa907('0x58')],{'onDelete':_0xa907('0x10b'),'as':'Interaction','foreignKey':_0xa907('0x181')});db[_0xa907('0x5a')][_0xa907('0x118')](db[_0xa907('0x55')],{'as':_0xa907('0x169'),'foreignKey':_0xa907('0x180')});db[_0xa907('0x5b')][_0xa907('0x11a')](db['User'],{'as':'Agents','through':_0xa907('0x36'),'foreignKey':_0xa907('0x182')});db['SmsQueue'][_0xa907('0x11a')](db[_0xa907('0xe1')],{'through':'team_has_sms_queues','as':_0xa907('0x154')});db[_0xa907('0x5d')][_0xa907('0x10d')](db[_0xa907('0x84')],{'as':'Dispositions','foreignKey':_0xa907('0x183'),'onDelete':'cascade'});db['OpenchannelAccount'][_0xa907('0x10d')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xa907('0x183')});db[_0xa907('0x5d')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xa907('0x164'),'foreignKey':_0xa907('0x183')});db[_0xa907('0x5d')][_0xa907('0x10d')](db[_0xa907('0x62')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xa907('0x10d')](db['OpenchannelApplication'],{'as':_0xa907('0x141'),'foreignKey':_0xa907('0x183')});db[_0xa907('0x5d')][_0xa907('0x118')](db[_0xa907('0xf1')],{'as':'List','foreignKey':_0xa907('0x165')});db[_0xa907('0x5d')][_0xa907('0x118')](db['Pause'],{'as':_0xa907('0x150'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xa907('0x5d')][_0xa907('0x11a')](db['User'],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0xa907('0x184')][_0xa907('0x118')](db['User'],{'onDelete':_0xa907('0x172')});db[_0xa907('0x184')][_0xa907('0x118')](db[_0xa907('0x130')],{'onDelete':_0xa907('0x172'),'foreignKey':'OpenchannelQueueId'});db[_0xa907('0x184')][_0xa907('0x118')](db[_0xa907('0x5d')],{'onDelete':_0xa907('0x172'),'foreignKey':_0xa907('0x183')});db[_0xa907('0x184')]['belongsTo'](db['Interval'],{'onDelete':_0xa907('0x172'),'foreignKey':_0xa907('0x14e')});db[_0xa907('0x184')][_0xa907('0x118')](db[_0xa907('0x16a')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xa907('0x60')][_0xa907('0x10d')](db[_0xa907('0x62')],{'as':'Messages','onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x185')});db[_0xa907('0x60')][_0xa907('0x118')](db[_0xa907('0x5d')],{'as':_0xa907('0x169'),'foreignKey':_0xa907('0x183')});db[_0xa907('0x60')][_0xa907('0x118')](db['CmContact'],{'as':_0xa907('0x15c'),'foreignKey':'ContactId'});db[_0xa907('0x60')][_0xa907('0x118')](db[_0xa907('0x13')],{'as':_0xa907('0x17c'),'foreignKey':_0xa907('0x10c')});db['OpenchannelInteraction']['belongsToMany'](db[_0xa907('0x16a')],{'through':_0xa907('0x186'),'as':'Tags'});db[_0xa907('0x60')][_0xa907('0x11a')](db[_0xa907('0x16a')],{'through':_0xa907('0x186'),'as':'ThroughTags'});db['OpenchannelInteraction'][_0xa907('0x11a')](db[_0xa907('0x13')],{'as':_0xa907('0x17e'),'through':_0xa907('0x187'),'foreignKey':_0xa907('0x185')});db[_0xa907('0x62')][_0xa907('0x118')](db['User'],{'onDelete':_0xa907('0x10b'),'as':_0xa907('0x13')});db[_0xa907('0x62')]['belongsTo'](db['CmContact'],{'onDelete':_0xa907('0x10b'),'as':_0xa907('0x15c')});db[_0xa907('0x62')]['belongsTo'](db[_0xa907('0x60')],{'onDelete':_0xa907('0x10b'),'as':_0xa907('0x16e'),'foreignKey':_0xa907('0x185')});db[_0xa907('0x62')][_0xa907('0x118')](db[_0xa907('0x17f')],{'as':_0xa907('0x17f'),'foreignKey':_0xa907('0x188')});db['OpenchannelMessage'][_0xa907('0x118')](db[_0xa907('0x5d')],{'as':_0xa907('0x169'),'foreignKey':_0xa907('0x183')});db[_0xa907('0x130')][_0xa907('0x11a')](db[_0xa907('0x13')],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0xa907('0x189')});db['OpenchannelQueue'][_0xa907('0x11a')](db[_0xa907('0xe1')],{'through':_0xa907('0x18a'),'as':_0xa907('0x154')});db['ChatWebsite'][_0xa907('0x10d')](db[_0xa907('0x84')],{'as':_0xa907('0x177'),'foreignKey':_0xa907('0x170'),'onDelete':_0xa907('0x10b')});db[_0xa907('0x16f')][_0xa907('0x10d')](db[_0xa907('0x82')],{'as':_0xa907('0x18b'),'foreignKey':_0xa907('0x170')});db['ChatWebsite'][_0xa907('0x10d')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0xa907('0x16f')]['hasMany'](db['ChatInteraction'],{'as':_0xa907('0x164')});db[_0xa907('0x16f')][_0xa907('0x10d')](db[_0xa907('0x66')],{'as':_0xa907('0x141')});db[_0xa907('0x16f')][_0xa907('0x10d')](db[_0xa907('0x18c')],{'as':_0xa907('0x163')});db[_0xa907('0x16f')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xa907('0x165')});db['ChatWebsite'][_0xa907('0x118')](db[_0xa907('0x85')],{'as':_0xa907('0x85'),'foreignKey':_0xa907('0x14e')});db[_0xa907('0x16f')]['belongsTo'](db[_0xa907('0x3e')],{'as':_0xa907('0x3e'),'foreignKey':'MailAccountId'});db['ChatWebsite'][_0xa907('0x118')](db['Pause'],{'as':_0xa907('0x150'),'foreignKey':_0xa907('0x151')});db['ChatWebsite'][_0xa907('0x11a')](db[_0xa907('0x13')],{'as':_0xa907('0x153'),'through':_0xa907('0x135')});db[_0xa907('0x18d')][_0xa907('0x118')](db['OpenchannelAccount'],{});db[_0xa907('0x18d')][_0xa907('0x118')](db[_0xa907('0xf1')],{'as':'List','foreignKey':_0xa907('0x165')});db[_0xa907('0x18d')][_0xa907('0x118')](db[_0xa907('0x73')],{'as':_0xa907('0x15c'),'foreignKey':'ContactId'});db[_0xa907('0x18d')]['belongsTo'](db[_0xa907('0x60')],{});db['OpenchannelQueueReport'][_0xa907('0x118')](db[_0xa907('0x62')],{});db[_0xa907('0x18d')]['belongsTo'](db[_0xa907('0x13')],{});db[_0xa907('0x18d')][_0xa907('0x118')](db[_0xa907('0x130')],{});db[_0xa907('0x66')][_0xa907('0x118')](db[_0xa907('0x13')],{'as':_0xa907('0x18e'),'foreignKey':_0xa907('0x10c'),'onDelete':_0xa907('0x172')});db['ChatApplication']['belongsTo'](db[_0xa907('0x6c')],{'as':'Queue','foreignKey':_0xa907('0x18f'),'onDelete':_0xa907('0x172')});db[_0xa907('0x66')][_0xa907('0x118')](db[_0xa907('0x16f')],{'as':_0xa907('0x190'),'foreignKey':_0xa907('0x170'),'onDelete':'restrict'});db['ChatApplication'][_0xa907('0x118')](db[_0xa907('0x16a')],{'onDelete':_0xa907('0x172'),'foreignKey':'TagId'});db['ChatInteraction'][_0xa907('0x10d')](db[_0xa907('0x18c')],{'as':_0xa907('0x163'),'onDelete':_0xa907('0x10b'),'foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0xa907('0x118')](db[_0xa907('0x16f')],{'as':_0xa907('0x169'),'foreignKey':_0xa907('0x170')});db[_0xa907('0x68')]['belongsTo'](db[_0xa907('0x73')],{'as':'Contact','foreignKey':_0xa907('0x15d')});db[_0xa907('0x68')]['belongsTo'](db[_0xa907('0x13')],{'as':_0xa907('0x17c'),'foreignKey':_0xa907('0x10c')});db[_0xa907('0x68')][_0xa907('0x11a')](db[_0xa907('0x16a')],{'through':_0xa907('0x191'),'as':_0xa907('0x16b')});db[_0xa907('0x68')][_0xa907('0x11a')](db['Tag'],{'through':_0xa907('0x191'),'as':_0xa907('0x16d')});db[_0xa907('0x68')][_0xa907('0x11a')](db['User'],{'as':_0xa907('0x17e'),'through':'user_has_chat_interactions','foreignKey':_0xa907('0x192')});db['ChatMessage'][_0xa907('0x118')](db[_0xa907('0x13')],{'onDelete':_0xa907('0x10b'),'as':_0xa907('0x13')});db[_0xa907('0x18c')][_0xa907('0x118')](db[_0xa907('0x73')],{'onDelete':_0xa907('0x10b'),'as':_0xa907('0x15c'),'foreignKey':_0xa907('0x15d')});db[_0xa907('0x18c')][_0xa907('0x118')](db[_0xa907('0x68')],{'onDelete':'cascade','as':_0xa907('0x16e'),'foreignKey':_0xa907('0x192')});db[_0xa907('0x18c')][_0xa907('0x118')](db['Attachment'],{'as':'Attachment','foreignKey':_0xa907('0x188')});db[_0xa907('0x18c')][_0xa907('0x118')](db[_0xa907('0x16f')],{'as':'Account','foreignKey':_0xa907('0x170')});db[_0xa907('0x6b')]['hasMany'](db[_0xa907('0x17f')],{'as':_0xa907('0x193'),'foreignKey':_0xa907('0x171'),'onDelete':_0xa907('0x10b'),'hooks':!![]});db[_0xa907('0x6b')]['belongsTo'](db[_0xa907('0x73')],{'onDelete':_0xa907('0x10b'),'as':_0xa907('0x15c'),'foreignKey':_0xa907('0x15d')});db['ChatOfflineMessage'][_0xa907('0x118')](db[_0xa907('0x16f')],{'as':_0xa907('0x169'),'foreignKey':_0xa907('0x170')});db[_0xa907('0x6c')]['belongsToMany'](db[_0xa907('0x13')],{'as':'Agents','through':_0xa907('0x12d'),'hooks':!![]});db[_0xa907('0x6c')][_0xa907('0x11a')](db[_0xa907('0xe1')],{'through':_0xa907('0x194'),'as':_0xa907('0x154')});db[_0xa907('0x6e')][_0xa907('0x10d')](db[_0xa907('0xcc')],{'as':'Messages','foreignKey':_0xa907('0x195'),'onDelete':'cascade'});db[_0xa907('0x6e')]['belongsToMany'](db[_0xa907('0x13')],{'as':'Members','through':'chat_group_has_users'});db[_0xa907('0x6f')][_0xa907('0x118')](db[_0xa907('0x16f')],{'as':'Website','foreignKey':_0xa907('0x170')});db[_0xa907('0x71')]['hasMany'](db[_0xa907('0x73')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact'][_0xa907('0x10d')](db[_0xa907('0x75')],{'as':_0xa907('0x147'),'foreignKey':'ContactId'});db[_0xa907('0x73')]['hasMany'](db[_0xa907('0x78')],{'as':_0xa907('0x148'),'foreignKey':_0xa907('0x15d')});db[_0xa907('0x73')][_0xa907('0x10d')](db[_0xa907('0x7a')],{'as':_0xa907('0x149'),'foreignKey':_0xa907('0x15d')});db[_0xa907('0x73')][_0xa907('0x10d')](db[_0xa907('0x7c')],{'as':_0xa907('0x7c'),'foreignKey':_0xa907('0x15d')});db[_0xa907('0x73')][_0xa907('0x10d')](db[_0xa907('0xd2')],{'as':_0xa907('0x14b'),'foreignKey':_0xa907('0x15d')});db[_0xa907('0x73')]['hasMany'](db[_0xa907('0x60')],{'as':_0xa907('0x112'),'foreignKey':_0xa907('0x15d'),'onDelete':_0xa907('0x172')});db[_0xa907('0x73')]['hasMany'](db[_0xa907('0x68')],{'as':_0xa907('0x113'),'foreignKey':_0xa907('0x15d'),'onDelete':_0xa907('0x172')});db['CmContact'][_0xa907('0x10d')](db[_0xa907('0x58')],{'as':_0xa907('0x196'),'foreignKey':'ContactId','onDelete':_0xa907('0x172')});db[_0xa907('0x73')][_0xa907('0x10d')](db[_0xa907('0x4e')],{'as':'FaxInteractions','foreignKey':_0xa907('0x15d'),'onDelete':_0xa907('0x172')});db[_0xa907('0x73')]['hasMany'](db[_0xa907('0x42')],{'as':'MailInteractions','foreignKey':_0xa907('0x15d'),'onDelete':_0xa907('0x172')});db[_0xa907('0x73')]['belongsTo'](db[_0xa907('0x71')],{'as':'Company','foreignKey':_0xa907('0x197')});db[_0xa907('0x73')][_0xa907('0x118')](db[_0xa907('0xf1')],{'as':_0xa907('0x175'),'foreignKey':_0xa907('0x165'),'onDelete':_0xa907('0x10b')});db[_0xa907('0x73')][_0xa907('0x11a')](db[_0xa907('0x13')],{'as':'Users','through':'cm_user_has_contacts'});db['CmContact']['belongsToMany'](db['Tag'],{'as':_0xa907('0x16b'),'through':'cm_contact_has_tags'});db['CmContact'][_0xa907('0x11a')](db['Tag'],{'through':_0xa907('0x198'),'as':_0xa907('0x16d')});db[_0xa907('0x75')]['belongsTo'](db[_0xa907('0x73')],{'as':_0xa907('0x15c'),'foreignKey':_0xa907('0x15d'),'onDelete':'cascade'});db[_0xa907('0x75')][_0xa907('0x118')](db[_0xa907('0xf1')],{'as':'List','foreignKey':_0xa907('0x165'),'onDelete':'cascade'});db[_0xa907('0x75')]['belongsTo'](db[_0xa907('0x13')],{'as':'Agent','foreignKey':'UserId'});db[_0xa907('0x75')][_0xa907('0x118')](db[_0xa907('0x1c')],{'as':_0xa907('0x199'),'foreignKey':_0xa907('0x146'),'onDelete':'cascade'});db[_0xa907('0x75')]['belongsTo'](db[_0xa907('0xe4')],{'as':_0xa907('0xe4'),'foreignKey':_0xa907('0x19a'),'onDelete':'cascade'});db['CmHopper'][_0xa907('0x118')](db[_0xa907('0x13')],{'as':'Owner','foreignKey':'OwnerId'});db[_0xa907('0x19b')]['belongsTo'](db[_0xa907('0x73')],{'as':_0xa907('0x15c'),'foreignKey':_0xa907('0x15d'),'onDelete':_0xa907('0x10b')});db[_0xa907('0x19b')][_0xa907('0x118')](db[_0xa907('0xf1')],{'as':_0xa907('0x175'),'foreignKey':_0xa907('0x165'),'onDelete':_0xa907('0x10b')});db[_0xa907('0x19b')]['belongsTo'](db[_0xa907('0x1c')],{'as':'Queue','foreignKey':_0xa907('0x146'),'onDelete':_0xa907('0x10b')});db[_0xa907('0x19b')][_0xa907('0x118')](db[_0xa907('0xe4')],{'as':_0xa907('0xe4'),'foreignKey':_0xa907('0x19a'),'onDelete':_0xa907('0x10b')});db[_0xa907('0x81')][_0xa907('0x10d')](db[_0xa907('0x19c')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0xa907('0x19d'),'onDelete':'cascade','hooks':!![]});db[_0xa907('0x81')][_0xa907('0x10d')](db[_0xa907('0x19c')],{'as':{'plural':_0xa907('0x19e'),'singular':_0xa907('0x19f')},'foreignKey':_0xa907('0x1a0'),'onDelete':_0xa907('0x10b'),'hooks':!![]});db[_0xa907('0x81')][_0xa907('0x10d')](db[_0xa907('0x7f')],{'as':_0xa907('0x1a1'),'foreignKey':_0xa907('0x1a2'),'onDelete':_0xa907('0x10b'),'hooks':!![]});db[_0xa907('0x84')][_0xa907('0x10d')](db[_0xa907('0x84')],{'as':_0xa907('0x177'),'foreignKey':_0xa907('0x1a3'),'onDelete':_0xa907('0x10b')});db[_0xa907('0x85')][_0xa907('0x10d')](db[_0xa907('0x85')],{'as':_0xa907('0x1a4'),'foreignKey':_0xa907('0x14e'),'onDelete':_0xa907('0x10b'),'hooks':!![],'required':![]});db[_0xa907('0x85')][_0xa907('0x10d')](db[_0xa907('0x19')],{'as':'Extensions','foreignKey':_0xa907('0x14e'),'onDelete':_0xa907('0x172')});db['Interval'][_0xa907('0x10d')](db['MailApplication'],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0xa907('0x85')][_0xa907('0x10d')](db['ChatApplication'],{'as':_0xa907('0x1a5'),'foreignKey':_0xa907('0x14e')});db['Interval'][_0xa907('0x10d')](db[_0xa907('0x4c')],{'as':'FaxApplications','foreignKey':_0xa907('0x14e')});db[_0xa907('0x85')][_0xa907('0x10d')](db[_0xa907('0x57')],{'as':_0xa907('0x1a6'),'foreignKey':_0xa907('0x14e')});db[_0xa907('0x8b')]['belongsTo'](db['MailAccount'],{});db[_0xa907('0x8b')][_0xa907('0x118')](db[_0xa907('0x97')],{'foreignKey':_0xa907('0x1a7')});db[_0xa907('0x8b')]['belongsTo'](db[_0xa907('0x95')],{'foreignKey':_0xa907('0x1a8')});db[_0xa907('0x142')][_0xa907('0x11a')](db[_0xa907('0x1a')],{'as':_0xa907('0x1a9'),'through':_0xa907('0x144'),'onDelete':_0xa907('0x172')});db[_0xa907('0x16a')]['belongsToMany'](db['CmContact'],{'through':_0xa907('0x198')});db[_0xa907('0x16a')]['belongsToMany'](db[_0xa907('0x68')],{'through':_0xa907('0x191')});db[_0xa907('0x16a')][_0xa907('0x11a')](db[_0xa907('0x42')],{'through':_0xa907('0x16c')});db['Tag'][_0xa907('0x11a')](db[_0xa907('0x58')],{'through':_0xa907('0x1aa')});db[_0xa907('0x16a')][_0xa907('0x11a')](db[_0xa907('0x4e')],{'through':_0xa907('0x17d')});db[_0xa907('0x16a')][_0xa907('0x11a')](db[_0xa907('0x60')],{'through':_0xa907('0x186')});db[_0xa907('0x16a')][_0xa907('0x11a')](db[_0xa907('0x126')],{'through':_0xa907('0x1ab')});db[_0xa907('0x90')]['hasMany'](db['Condition'],{'as':{'plural':_0xa907('0x1ac'),'singular':'AllCondition'},'foreignKey':_0xa907('0x1ad'),'onDelete':_0xa907('0x10b'),'hooks':!![]});db[_0xa907('0x90')][_0xa907('0x10d')](db['Condition'],{'as':{'plural':_0xa907('0x1ae'),'singular':_0xa907('0x1af')},'foreignKey':'TriggerAnyId','onDelete':_0xa907('0x10b'),'hooks':!![]});db[_0xa907('0x90')][_0xa907('0x10d')](db[_0xa907('0x7f')],{'as':_0xa907('0x1a1'),'foreignKey':_0xa907('0x1b0'),'onDelete':_0xa907('0x10b'),'hooks':!![]});db[_0xa907('0x95')][_0xa907('0x10d')](db[_0xa907('0x1b1')],{'as':'Fields','onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x1a8'),'hooks':!![]});db[_0xa907('0x97')][_0xa907('0x10d')](db[_0xa907('0x1b1')],{'as':_0xa907('0x1b2'),'onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x1a7')});db[_0xa907('0x1b3')]['hasMany'](db[_0xa907('0x1b1')],{'as':'Fields','onDelete':'cascade','foreignKey':'MetricId'});db[_0xa907('0x1b1')]['belongsTo'](db[_0xa907('0x1b3')],{'foreignKey':_0xa907('0x1b4')});db[_0xa907('0x1b5')][_0xa907('0x10d')](db[_0xa907('0x9c')],{'as':_0xa907('0x1b6'),'onDelete':_0xa907('0x10b'),'foreignKey':'AccountId'});db[_0xa907('0x9c')][_0xa907('0x10d')](db[_0xa907('0x9e')],{'as':_0xa907('0x1b7'),'onDelete':'cascade','foreignKey':_0xa907('0x1b8')});db[_0xa907('0x9c')][_0xa907('0x10d')](db[_0xa907('0x9e')],{'as':'Descriptions','onDelete':_0xa907('0x10b'),'foreignKey':'DescriptionId'});db[_0xa907('0x9c')][_0xa907('0x10d')](db['SalesforceField'],{'as':_0xa907('0x1b2'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xa907('0x9c')][_0xa907('0x118')](db['SalesforceAccount'],{'as':_0xa907('0x169'),'foreignKey':'AccountId'});db[_0xa907('0x9e')][_0xa907('0x10d')](db['SalesforceField'],{'as':_0xa907('0x1b9'),'foreignKey':_0xa907('0x1b8')});db['SalesforceField'][_0xa907('0x10d')](db[_0xa907('0x9e')],{'as':_0xa907('0x1ba'),'foreignKey':_0xa907('0x1bb')});db[_0xa907('0x9e')]['hasMany'](db[_0xa907('0x9e')],{'as':_0xa907('0x1bc'),'foreignKey':'FieldId'});db['SalesforceField'][_0xa907('0x118')](db['Variable'],{'as':_0xa907('0x1bd'),'foreignKey':_0xa907('0x1be')});db['SugarcrmAccount'][_0xa907('0x10d')](db[_0xa907('0xa1')],{'as':'Configurations','onDelete':_0xa907('0x10b'),'foreignKey':'AccountId'});db[_0xa907('0xa1')][_0xa907('0x10d')](db[_0xa907('0xa3')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xa907('0x1b8')});db['SugarcrmConfiguration']['hasMany'](db[_0xa907('0xa3')],{'as':_0xa907('0x1bf'),'onDelete':'cascade','foreignKey':_0xa907('0x1bb')});db[_0xa907('0xa1')][_0xa907('0x10d')](db[_0xa907('0xa3')],{'as':_0xa907('0x1b2'),'onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x1c0')});db[_0xa907('0xa1')][_0xa907('0x118')](db['SugarcrmAccount'],{'as':_0xa907('0x169'),'foreignKey':_0xa907('0x1c1')});db[_0xa907('0xa3')][_0xa907('0x10d')](db[_0xa907('0xa3')],{'as':_0xa907('0x1b9'),'foreignKey':_0xa907('0x1b8')});db[_0xa907('0xa3')]['hasMany'](db[_0xa907('0xa3')],{'as':'Description','foreignKey':_0xa907('0x1bb')});db['SugarcrmField'][_0xa907('0x10d')](db['SugarcrmField'],{'as':_0xa907('0x1bc'),'foreignKey':'FieldId'});db[_0xa907('0xa3')][_0xa907('0x118')](db[_0xa907('0x1bd')],{'as':_0xa907('0x1bd'),'foreignKey':_0xa907('0x1be')});db['DeskAccount']['hasMany'](db[_0xa907('0x1c2')],{'as':_0xa907('0x1b6'),'onDelete':'cascade','foreignKey':_0xa907('0x1c1')});db[_0xa907('0x1c2')][_0xa907('0x10d')](db['DeskField'],{'as':_0xa907('0x1b7'),'onDelete':'cascade','foreignKey':_0xa907('0x1b8')});db[_0xa907('0x1c2')][_0xa907('0x10d')](db[_0xa907('0xa7')],{'as':_0xa907('0x1bf'),'onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x1bb')});db['DeskConfiguration']['hasMany'](db[_0xa907('0xa7')],{'as':_0xa907('0x1b2'),'onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x1c0')});db['DeskConfiguration'][_0xa907('0x118')](db[_0xa907('0x1c3')],{'as':_0xa907('0x169'),'foreignKey':_0xa907('0x1c1')});db[_0xa907('0x1c2')][_0xa907('0x11a')](db[_0xa907('0x16a')],{'through':'int_desk_configuration_has_tags'});db[_0xa907('0xa7')][_0xa907('0x10d')](db[_0xa907('0xa7')],{'as':'Subject','foreignKey':'SubjectId'});db['DeskField'][_0xa907('0x10d')](db['DeskField'],{'as':_0xa907('0x1ba'),'foreignKey':'DescriptionId'});db[_0xa907('0xa7')]['hasMany'](db['DeskField'],{'as':_0xa907('0x1bc'),'foreignKey':'FieldId'});db[_0xa907('0xa7')][_0xa907('0x118')](db['Variable'],{'as':_0xa907('0x1bd'),'foreignKey':'VariableId'});db[_0xa907('0xa9')][_0xa907('0x10d')](db['ZohoConfiguration'],{'as':_0xa907('0x1b6'),'onDelete':_0xa907('0x10b'),'foreignKey':'AccountId'});db[_0xa907('0xaa')]['hasMany'](db[_0xa907('0x1c4')],{'as':_0xa907('0x1b7'),'onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x1b8')});db[_0xa907('0xaa')][_0xa907('0x10d')](db['ZohoField'],{'as':_0xa907('0x1bf'),'onDelete':'cascade','foreignKey':_0xa907('0x1bb')});db[_0xa907('0xaa')][_0xa907('0x10d')](db[_0xa907('0x1c4')],{'as':_0xa907('0x1b2'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0xa907('0xaa')]['belongsTo'](db[_0xa907('0xa9')],{'as':_0xa907('0x169'),'foreignKey':_0xa907('0x1c1')});db[_0xa907('0x1c4')][_0xa907('0x10d')](db[_0xa907('0x1c4')],{'as':_0xa907('0x1b9'),'foreignKey':_0xa907('0x1b8')});db['ZohoField'][_0xa907('0x10d')](db[_0xa907('0x1c4')],{'as':'Description','foreignKey':_0xa907('0x1bb')});db['ZohoField'][_0xa907('0x10d')](db[_0xa907('0x1c4')],{'as':_0xa907('0x1bc'),'foreignKey':_0xa907('0x1c0')});db[_0xa907('0x1c4')][_0xa907('0x118')](db[_0xa907('0x1bd')],{'as':'Variable','foreignKey':_0xa907('0x1be')});db[_0xa907('0x1c5')]['hasMany'](db[_0xa907('0xae')],{'as':_0xa907('0x1b6'),'onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x1c1')});db[_0xa907('0xae')][_0xa907('0x10d')](db['ZendeskField'],{'as':_0xa907('0x1b7'),'foreignKey':_0xa907('0x1b8')});db[_0xa907('0xae')][_0xa907('0x10d')](db[_0xa907('0x1c6')],{'as':_0xa907('0x1bf'),'foreignKey':_0xa907('0x1bb')});db[_0xa907('0xae')][_0xa907('0x10d')](db[_0xa907('0x1c6')],{'as':_0xa907('0x1b2'),'foreignKey':_0xa907('0x1c0')});db[_0xa907('0xae')][_0xa907('0x118')](db[_0xa907('0x1c5')],{'as':_0xa907('0x169'),'foreignKey':_0xa907('0x1c1')});db[_0xa907('0xae')][_0xa907('0x11a')](db['Tag'],{'through':_0xa907('0x1c7')});db[_0xa907('0x1c6')]['hasMany'](db[_0xa907('0x1c6')],{'as':_0xa907('0x1b9'),'foreignKey':_0xa907('0x1b8')});db[_0xa907('0x1c6')][_0xa907('0x10d')](db['ZendeskField'],{'as':_0xa907('0x1ba'),'foreignKey':'DescriptionId'});db[_0xa907('0x1c6')][_0xa907('0x10d')](db['ZendeskField'],{'as':_0xa907('0x1bc'),'foreignKey':_0xa907('0x1c0')});db['ZendeskField'][_0xa907('0x118')](db[_0xa907('0x1bd')],{'as':_0xa907('0x1bd'),'foreignKey':_0xa907('0x1be')});db[_0xa907('0xb1')][_0xa907('0x10d')](db[_0xa907('0xb2')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xa907('0x1c1')});db[_0xa907('0xb2')][_0xa907('0x10d')](db[_0xa907('0xb3')],{'as':_0xa907('0x1b7'),'onDelete':_0xa907('0x10b'),'foreignKey':'SubjectId'});db[_0xa907('0xb2')][_0xa907('0x10d')](db[_0xa907('0xb3')],{'as':_0xa907('0x1bf'),'onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x1bb')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0xa907('0x1b2'),'onDelete':'cascade','foreignKey':_0xa907('0x1c0')});db[_0xa907('0xb2')][_0xa907('0x118')](db['FreshdeskAccount'],{'as':_0xa907('0x169'),'foreignKey':_0xa907('0x1c1')});db['FreshdeskConfiguration'][_0xa907('0x11a')](db[_0xa907('0x16a')],{'through':_0xa907('0x1c8')});db[_0xa907('0xb3')][_0xa907('0x10d')](db[_0xa907('0xb3')],{'as':'Subject','foreignKey':_0xa907('0x1b8')});db[_0xa907('0xb3')]['hasMany'](db[_0xa907('0xb3')],{'as':_0xa907('0x1ba'),'foreignKey':'DescriptionId'});db[_0xa907('0xb3')][_0xa907('0x10d')](db[_0xa907('0xb3')],{'as':'Field','foreignKey':'FieldId'});db[_0xa907('0xb3')][_0xa907('0x118')](db[_0xa907('0x1bd')],{'as':_0xa907('0x1bd'),'foreignKey':_0xa907('0x1be')});db[_0xa907('0xb5')][_0xa907('0x10d')](db[_0xa907('0xb7')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xa907('0xb7')][_0xa907('0x10d')](db[_0xa907('0x1c9')],{'as':_0xa907('0x1b7'),'foreignKey':_0xa907('0x1b8')});db['VtigerConfiguration'][_0xa907('0x10d')](db[_0xa907('0x1c9')],{'as':_0xa907('0x1bf'),'foreignKey':_0xa907('0x1bb')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':_0xa907('0x1b2'),'foreignKey':'FieldId'});db['VtigerConfiguration'][_0xa907('0x118')](db[_0xa907('0xb5')],{'as':_0xa907('0x169'),'foreignKey':_0xa907('0x1c1')});db[_0xa907('0x1c9')][_0xa907('0x10d')](db[_0xa907('0x1c9')],{'as':_0xa907('0x1b9'),'foreignKey':'SubjectId'});db[_0xa907('0x1c9')][_0xa907('0x10d')](db['VtigerField'],{'as':'Description','foreignKey':_0xa907('0x1bb')});db['VtigerField']['hasMany'](db[_0xa907('0x1c9')],{'as':_0xa907('0x1bc'),'foreignKey':_0xa907('0x1c0')});db[_0xa907('0x1c9')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xa907('0x1be')});db[_0xa907('0xba')][_0xa907('0x10d')](db[_0xa907('0x1ca')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xa907('0x1c1')});db[_0xa907('0x1ca')]['hasMany'](db[_0xa907('0xbd')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xa907('0x1ca')]['hasMany'](db[_0xa907('0xbd')],{'as':_0xa907('0x1bf'),'foreignKey':_0xa907('0x1bb')});db['ServicenowConfiguration'][_0xa907('0x10d')](db[_0xa907('0xbd')],{'as':_0xa907('0x1b2'),'foreignKey':_0xa907('0x1c0')});db[_0xa907('0x1ca')][_0xa907('0x118')](db[_0xa907('0xba')],{'as':_0xa907('0x169'),'foreignKey':'AccountId'});db[_0xa907('0xbd')][_0xa907('0x10d')](db[_0xa907('0xbd')],{'as':_0xa907('0x1b9'),'foreignKey':_0xa907('0x1b8')});db[_0xa907('0xbd')][_0xa907('0x10d')](db[_0xa907('0xbd')],{'as':_0xa907('0x1ba'),'foreignKey':_0xa907('0x1bb')});db['ServicenowField']['hasMany'](db[_0xa907('0xbd')],{'as':_0xa907('0x1bc'),'foreignKey':_0xa907('0x1c0')});db['ServicenowField']['belongsTo'](db[_0xa907('0x1bd')],{'as':_0xa907('0x1bd'),'foreignKey':_0xa907('0x1be')});db[_0xa907('0x1cb')][_0xa907('0x10d')](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x1c1')});db[_0xa907('0xc0')]['hasMany'](db[_0xa907('0xc2')],{'as':_0xa907('0x1b7'),'onDelete':_0xa907('0x10b'),'foreignKey':'SubjectId'});db[_0xa907('0xc0')][_0xa907('0x10d')](db[_0xa907('0xc2')],{'as':_0xa907('0x1bf'),'onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x1bb')});db[_0xa907('0xc0')][_0xa907('0x10d')](db[_0xa907('0xc2')],{'as':_0xa907('0x1b2'),'onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x1c0')});db[_0xa907('0xc0')][_0xa907('0x118')](db['Dynamics365Account'],{'as':_0xa907('0x169'),'foreignKey':_0xa907('0x1c1')});db[_0xa907('0xc2')][_0xa907('0x10d')](db['Dynamics365Field'],{'as':_0xa907('0x1b9'),'foreignKey':'SubjectId'});db[_0xa907('0xc2')][_0xa907('0x10d')](db[_0xa907('0xc2')],{'as':_0xa907('0x1ba'),'foreignKey':_0xa907('0x1bb')});db[_0xa907('0xc2')][_0xa907('0x10d')](db[_0xa907('0xc2')],{'as':'Field','foreignKey':_0xa907('0x1c0')});db['Dynamics365Field'][_0xa907('0x118')](db['Variable'],{'as':_0xa907('0x1bd'),'foreignKey':'VariableId'});db[_0xa907('0xc4')][_0xa907('0x10d')](db[_0xa907('0x1cc')],{'as':_0xa907('0x1b6'),'onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x1c1')});db['FreshsalesConfiguration'][_0xa907('0x10d')](db[_0xa907('0xc7')],{'as':_0xa907('0x1b7'),'foreignKey':_0xa907('0x1b8')});db[_0xa907('0x1cc')]['hasMany'](db['FreshsalesField'],{'as':_0xa907('0x1bf'),'foreignKey':_0xa907('0x1bb')});db[_0xa907('0x1cc')]['hasMany'](db[_0xa907('0xc7')],{'as':_0xa907('0x1b2'),'foreignKey':_0xa907('0x1c0')});db[_0xa907('0x1cc')][_0xa907('0x118')](db[_0xa907('0xc4')],{'as':_0xa907('0x169'),'foreignKey':_0xa907('0x1c1')});db[_0xa907('0xc7')][_0xa907('0x10d')](db[_0xa907('0xc7')],{'as':'Subject','foreignKey':_0xa907('0x1b8')});db[_0xa907('0xc7')][_0xa907('0x10d')](db[_0xa907('0xc7')],{'as':_0xa907('0x1ba'),'foreignKey':_0xa907('0x1bb')});db[_0xa907('0xc7')][_0xa907('0x10d')](db[_0xa907('0xc7')],{'as':_0xa907('0x1bc'),'foreignKey':_0xa907('0x1c0')});db['FreshsalesField'][_0xa907('0x118')](db[_0xa907('0x1bd')],{'as':_0xa907('0x1bd'),'foreignKey':_0xa907('0x1be')});db['ChatQueueReport'][_0xa907('0x118')](db[_0xa907('0x16f')],{});db[_0xa907('0xca')][_0xa907('0x118')](db[_0xa907('0xf1')],{'as':_0xa907('0x175'),'foreignKey':_0xa907('0x165')});db[_0xa907('0xca')][_0xa907('0x118')](db[_0xa907('0x73')],{'as':_0xa907('0x15c'),'foreignKey':'ContactId'});db[_0xa907('0xca')][_0xa907('0x118')](db['ChatInteraction'],{});db[_0xa907('0xca')]['belongsTo'](db[_0xa907('0x18c')],{});db[_0xa907('0xca')]['belongsTo'](db['User'],{});db['ChatQueueReport'][_0xa907('0x118')](db[_0xa907('0x6c')],{});db[_0xa907('0xcc')]['belongsTo'](db[_0xa907('0x13')],{'onDelete':_0xa907('0x10b'),'foreignKey':'FromId'});db[_0xa907('0xcc')][_0xa907('0x118')](db[_0xa907('0x13')],{'onDelete':'cascade','foreignKey':'ToId'});db['JscriptySessionReport'][_0xa907('0x10d')](db[_0xa907('0xd0')],{'foreignKey':_0xa907('0x1cd'),'onDelete':_0xa907('0x10b')});db['JscriptySessionReport'][_0xa907('0x10d')](db[_0xa907('0xce')],{'foreignKey':_0xa907('0x1cd'),'onDelete':_0xa907('0x10b')});db[_0xa907('0x1ce')][_0xa907('0x118')](db[_0xa907('0x55')],{});db[_0xa907('0x1ce')][_0xa907('0x118')](db[_0xa907('0xf1')],{'as':'List','foreignKey':_0xa907('0x165')});db['SmsQueueReport'][_0xa907('0x118')](db[_0xa907('0x73')],{'as':'Contact','foreignKey':'ContactId'});db['SmsQueueReport'][_0xa907('0x118')](db[_0xa907('0x58')],{});db[_0xa907('0x1ce')][_0xa907('0x118')](db['SmsMessage'],{});db[_0xa907('0x1ce')][_0xa907('0x118')](db[_0xa907('0x13')],{});db[_0xa907('0x1ce')][_0xa907('0x118')](db[_0xa907('0x5b')],{});db[_0xa907('0x1cf')][_0xa907('0x10d')](db[_0xa907('0xd2')],{'foreignKey':_0xa907('0x1d0')});db[_0xa907('0x1cf')][_0xa907('0x10d')](db[_0xa907('0xd0')],{'foreignKey':_0xa907('0x1d0')});db[_0xa907('0x1cf')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0xa907('0x1d0')});db['SquareProject'][_0xa907('0x11a')](db[_0xa907('0x13')],{'as':_0xa907('0x17e'),'through':_0xa907('0x13e')});db[_0xa907('0xe1')][_0xa907('0x11a')](db[_0xa907('0x13')],{'as':_0xa907('0x153'),'through':_0xa907('0x121')});db[_0xa907('0xe1')][_0xa907('0x11a')](db[_0xa907('0x1c')],{'through':_0xa907('0x105'),'as':_0xa907('0x128')});db['Team'][_0xa907('0x11a')](db[_0xa907('0x12a')],{'through':_0xa907('0x167'),'as':_0xa907('0x12b')});db[_0xa907('0xe1')]['belongsToMany'](db[_0xa907('0x6c')],{'through':_0xa907('0x194'),'as':_0xa907('0x12c')});db[_0xa907('0xe1')][_0xa907('0x11a')](db[_0xa907('0x52')],{'through':_0xa907('0x1d1'),'as':_0xa907('0x12e')});db[_0xa907('0xe1')][_0xa907('0x11a')](db[_0xa907('0x5b')],{'through':_0xa907('0x1d2'),'as':_0xa907('0x12f')});db[_0xa907('0xe1')][_0xa907('0x11a')](db[_0xa907('0x130')],{'through':'team_has_openchannel_queues','as':_0xa907('0x131')});db[_0xa907('0xe1')][_0xa907('0x11a')](db[_0xa907('0x132')],{'through':'team_has_whatsapp_queues','as':_0xa907('0x133')});db[_0xa907('0xe1')][_0xa907('0x11a')](db[_0xa907('0xf2')],{'through':'TeamVoicePrefix','as':_0xa907('0x129')});db[_0xa907('0xe4')][_0xa907('0x10d')](db['CmHopper'],{'as':'Hoppers','foreignKey':'CampaignId'});db['Campaign'][_0xa907('0x10d')](db[_0xa907('0x78')],{'as':_0xa907('0x148'),'foreignKey':_0xa907('0x19a')});db[_0xa907('0xe4')]['hasMany'](db[_0xa907('0x7a')],{'as':_0xa907('0x149'),'foreignKey':'CampaignId'});db[_0xa907('0xe4')][_0xa907('0x10d')](db['CmHopperBlack'],{'as':_0xa907('0x14a'),'foreignKey':'CampaignId'});db['Campaign'][_0xa907('0x118')](db[_0xa907('0x2a')],{'as':_0xa907('0x2a'),'foreignKey':'TrunkId'});db['Campaign']['belongsTo'](db['Trunk'],{'as':_0xa907('0x14c'),'foreignKey':_0xa907('0x14d')});db[_0xa907('0xe4')][_0xa907('0x118')](db[_0xa907('0x85')],{'as':_0xa907('0x85'),'foreignKey':_0xa907('0x14e')});db['Campaign'][_0xa907('0x118')](db['SquareProject'],{'as':_0xa907('0xdd'),'foreignKey':_0xa907('0x1d3')});db[_0xa907('0xe4')][_0xa907('0x11a')](db[_0xa907('0xf1')],{'as':_0xa907('0x11f'),'through':_0xa907('0x1d4')});db[_0xa907('0xe4')][_0xa907('0x11a')](db['CmList'],{'as':'BlackLists','through':_0xa907('0x1d5')});db[_0xa907('0x17f')]['belongsTo'](db[_0xa907('0x6b')],{'as':_0xa907('0x6b'),'foreignKey':_0xa907('0x171')});db[_0xa907('0xe9')][_0xa907('0x118')](db[_0xa907('0x44')],{});db[_0xa907('0xe9')][_0xa907('0x118')](db['MailInteraction'],{});db[_0xa907('0xe9')][_0xa907('0x118')](db[_0xa907('0x3e')],{'foreignKey':_0xa907('0x1d6'),'as':_0xa907('0x1d7')});db[_0xa907('0xe9')][_0xa907('0x118')](db[_0xa907('0x13')],{'foreignKey':_0xa907('0x1d8'),'as':'FromAgent'});db[_0xa907('0xe9')][_0xa907('0x118')](db[_0xa907('0x13')],{'foreignKey':_0xa907('0x1d9'),'as':'ToAgent'});db[_0xa907('0xe9')]['belongsTo'](db[_0xa907('0x12a')],{'foreignKey':_0xa907('0x1da'),'as':_0xa907('0x1db')});db[_0xa907('0xe9')][_0xa907('0x118')](db[_0xa907('0x3e')],{'foreignKey':_0xa907('0x1dc'),'as':_0xa907('0x1dd')});db['ChatTransferReport']['belongsTo'](db[_0xa907('0x18c')],{});db[_0xa907('0xeb')][_0xa907('0x118')](db['ChatInteraction'],{});db[_0xa907('0xeb')][_0xa907('0x118')](db[_0xa907('0x16f')],{'foreignKey':_0xa907('0x1de'),'as':_0xa907('0x1d7')});db['ChatTransferReport'][_0xa907('0x118')](db[_0xa907('0x13')],{'foreignKey':'FromUserId','as':_0xa907('0x1df')});db[_0xa907('0xeb')][_0xa907('0x118')](db['User'],{'foreignKey':_0xa907('0x1d9'),'as':_0xa907('0x1e0')});db[_0xa907('0xeb')][_0xa907('0x118')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0xa907('0x1db')});db[_0xa907('0xeb')][_0xa907('0x118')](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0xa907('0x1e1')]['belongsTo'](db[_0xa907('0x50')],{});db[_0xa907('0x1e1')][_0xa907('0x118')](db['FaxInteraction'],{});db[_0xa907('0x1e1')][_0xa907('0x118')](db[_0xa907('0x4a')],{'foreignKey':_0xa907('0x1e2'),'as':_0xa907('0x1d7')});db[_0xa907('0x1e1')]['belongsTo'](db[_0xa907('0x13')],{'foreignKey':_0xa907('0x1d8'),'as':'FromAgent'});db[_0xa907('0x1e1')]['belongsTo'](db[_0xa907('0x13')],{'foreignKey':'ToUserId','as':_0xa907('0x1e0')});db[_0xa907('0x1e1')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0xa907('0x1e3'),'as':'ToQueue'});db[_0xa907('0x1e1')][_0xa907('0x118')](db[_0xa907('0x4a')],{'foreignKey':'ToFaxAccountId','as':_0xa907('0x1dd')});db[_0xa907('0xee')]['belongsTo'](db[_0xa907('0x62')],{});db[_0xa907('0xee')][_0xa907('0x118')](db[_0xa907('0x60')],{});db[_0xa907('0xee')]['belongsTo'](db[_0xa907('0x5d')],{'foreignKey':'FromOpenchannelAccountId','as':_0xa907('0x1d7')});db[_0xa907('0xee')][_0xa907('0x118')](db[_0xa907('0x13')],{'foreignKey':_0xa907('0x1d8'),'as':_0xa907('0x1df')});db[_0xa907('0xee')][_0xa907('0x118')](db[_0xa907('0x13')],{'foreignKey':_0xa907('0x1d9'),'as':_0xa907('0x1e0')});db[_0xa907('0xee')][_0xa907('0x118')](db[_0xa907('0x130')],{'foreignKey':'ToOpenchannelQueueId','as':_0xa907('0x1db')});db[_0xa907('0xee')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0xa907('0x1e4'),'as':'ToAccount'});db[_0xa907('0xf0')]['belongsTo'](db[_0xa907('0x5a')],{});db[_0xa907('0xf0')][_0xa907('0x118')](db[_0xa907('0x58')],{});db[_0xa907('0xf0')]['belongsTo'](db[_0xa907('0x55')],{'foreignKey':_0xa907('0x1e5'),'as':'FromAccount'});db['SmsTransferReport'][_0xa907('0x118')](db[_0xa907('0x13')],{'foreignKey':_0xa907('0x1d8'),'as':_0xa907('0x1df')});db[_0xa907('0xf0')][_0xa907('0x118')](db['User'],{'foreignKey':_0xa907('0x1d9'),'as':_0xa907('0x1e0')});db[_0xa907('0xf0')][_0xa907('0x118')](db[_0xa907('0x5b')],{'foreignKey':_0xa907('0x1e6'),'as':_0xa907('0x1db')});db[_0xa907('0xf0')][_0xa907('0x118')](db['SmsAccount'],{'foreignKey':'ToSmsAccountId','as':_0xa907('0x1dd')});db[_0xa907('0xf1')][_0xa907('0x10d')](db['Disposition'],{'as':_0xa907('0x177'),'foreignKey':_0xa907('0x165'),'onDelete':_0xa907('0x10b')});db[_0xa907('0xf1')][_0xa907('0x10d')](db['CmCustomField'],{'as':_0xa907('0x1e7'),'foreignKey':'ListId'});db[_0xa907('0xf1')][_0xa907('0x10d')](db[_0xa907('0x73')],{'as':_0xa907('0x11d'),'onDelete':_0xa907('0x10b'),'foreignKey':_0xa907('0x165')});db[_0xa907('0xf1')]['hasMany'](db[_0xa907('0x78')],{'as':'HopperFinals','foreignKey':'ListId'});db['CmList']['hasMany'](db['CmHopperHistory'],{'as':_0xa907('0x111'),'foreignKey':_0xa907('0x165')});db['CmList']['hasMany'](db[_0xa907('0x7c')],{'as':'ReportAgentPreview','foreignKey':_0xa907('0x165')});db[_0xa907('0xf1')][_0xa907('0x11a')](db[_0xa907('0x1c')],{'as':'Queues','through':_0xa907('0x152')});db[_0xa907('0xf1')][_0xa907('0x11a')](db[_0xa907('0x13')],{'as':_0xa907('0x153'),'through':'cm_user_has_lists'});db[_0xa907('0xf2')][_0xa907('0x10d')](db['VoiceExtension'],{'as':_0xa907('0x110'),'onDelete':_0xa907('0x10b')});db[_0xa907('0xf2')][_0xa907('0x11a')](db[_0xa907('0x13')],{'as':_0xa907('0x153'),'through':_0xa907('0x109')});db[_0xa907('0xf2')][_0xa907('0x11a')](db[_0xa907('0xe1')],{'through':'TeamVoicePrefix','as':'Teams'});db['UserProfile'][_0xa907('0x10d')](db[_0xa907('0x13')],{'as':_0xa907('0x17e'),'foreignKey':_0xa907('0x119')});db['UserProfile'][_0xa907('0x10d')](db['UserProfileSection'],{'as':_0xa907('0x1e8'),'foreignKey':_0xa907('0x119'),'onDelete':_0xa907('0x10b')});db['UserProfileSection'][_0xa907('0x10d')](db[_0xa907('0xf6')],{'as':'Resources','foreignKey':_0xa907('0x1e9'),'onDelete':_0xa907('0x10b')});db['WhatsappAccount'][_0xa907('0x10d')](db['Disposition'],{'as':_0xa907('0x177'),'foreignKey':_0xa907('0x1ea'),'onDelete':_0xa907('0x10b')});db[_0xa907('0xfa')][_0xa907('0x10d')](db[_0xa907('0x82')],{'as':'Answers','foreignKey':_0xa907('0x1ea')});db[_0xa907('0xfa')][_0xa907('0x10d')](db[_0xa907('0xfe')],{'as':_0xa907('0x163'),'foreignKey':_0xa907('0x1ea')});db[_0xa907('0xfa')][_0xa907('0x10d')](db[_0xa907('0x126')],{'as':_0xa907('0x164')});db['WhatsappAccount']['hasMany'](db['WhatsappApplication'],{'as':_0xa907('0x141')});db[_0xa907('0xfa')][_0xa907('0x118')](db['CmList'],{'as':_0xa907('0x175'),'foreignKey':'ListId'});db[_0xa907('0xfa')][_0xa907('0x118')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xa907('0x151')});db[_0xa907('0xfa')][_0xa907('0x11a')](db[_0xa907('0x13')],{'as':'Agents','through':_0xa907('0x1eb')});db[_0xa907('0xfc')]['belongsTo'](db[_0xa907('0x13')],{'onDelete':_0xa907('0x172')});db['WhatsappApplication']['belongsTo'](db[_0xa907('0x132')],{'onDelete':_0xa907('0x172')});db[_0xa907('0xfc')][_0xa907('0x118')](db[_0xa907('0xfa')],{'onDelete':_0xa907('0x172')});db[_0xa907('0xfc')][_0xa907('0x118')](db[_0xa907('0x85')],{'onDelete':'restrict','foreignKey':_0xa907('0x14e')});db[_0xa907('0xfc')][_0xa907('0x118')](db[_0xa907('0x16a')],{'onDelete':_0xa907('0x172'),'foreignKey':_0xa907('0x173')});db[_0xa907('0x126')][_0xa907('0x10d')](db['WhatsappMessage'],{'as':_0xa907('0x163'),'onDelete':_0xa907('0x10b'),'foreignKey':'WhatsappInteractionId'});db[_0xa907('0x126')][_0xa907('0x118')](db[_0xa907('0xfa')],{'as':'Account','foreignKey':_0xa907('0x1ea')});db[_0xa907('0x126')]['belongsTo'](db[_0xa907('0x73')],{'as':_0xa907('0x15c'),'foreignKey':_0xa907('0x15d')});db[_0xa907('0x126')][_0xa907('0x118')](db[_0xa907('0x13')],{'as':_0xa907('0x17c'),'foreignKey':_0xa907('0x10c')});db['WhatsappInteraction'][_0xa907('0x11a')](db[_0xa907('0x16a')],{'through':'whatsapp_interaction_has_tags','as':_0xa907('0x16b')});db[_0xa907('0x126')]['belongsToMany'](db[_0xa907('0x16a')],{'through':_0xa907('0x1ab'),'as':'ThroughTags'});db['WhatsappInteraction'][_0xa907('0x11a')](db[_0xa907('0x13')],{'as':_0xa907('0x17e'),'through':'user_has_whatsapp_interactions','foreignKey':'WhatsappInteractionId'});db[_0xa907('0xfe')]['belongsTo'](db[_0xa907('0x13')],{'as':'User'});db[_0xa907('0xfe')]['belongsTo'](db[_0xa907('0x73')],{'onDelete':_0xa907('0x10b'),'as':_0xa907('0x15c')});db[_0xa907('0xfe')]['belongsTo'](db[_0xa907('0x126')],{'onDelete':_0xa907('0x10b'),'as':_0xa907('0x16e'),'foreignKey':_0xa907('0x1ec')});db[_0xa907('0xfe')][_0xa907('0x118')](db['WhatsappAccount'],{'as':_0xa907('0x169'),'foreignKey':'WhatsappAccountId'});db[_0xa907('0x100')][_0xa907('0x118')](db[_0xa907('0xfa')],{});db[_0xa907('0x100')][_0xa907('0x118')](db[_0xa907('0xf1')],{'as':_0xa907('0x175'),'foreignKey':_0xa907('0x165')});db[_0xa907('0x100')][_0xa907('0x118')](db[_0xa907('0x73')],{'as':_0xa907('0x15c'),'foreignKey':'ContactId'});db[_0xa907('0x100')][_0xa907('0x118')](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0xa907('0x118')](db[_0xa907('0x132')],{});db[_0xa907('0x100')][_0xa907('0x118')](db[_0xa907('0xfe')],{});db['WhatsappQueueReport']['belongsTo'](db['User'],{});db['WhatsappTransferReport'][_0xa907('0x118')](db[_0xa907('0xfe')],{});db['WhatsappTransferReport'][_0xa907('0x118')](db[_0xa907('0x126')],{});db[_0xa907('0x101')][_0xa907('0x118')](db[_0xa907('0xfa')],{'foreignKey':_0xa907('0x1ed'),'as':_0xa907('0x1d7')});db['WhatsappTransferReport']['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0xa907('0x1ee'),'as':'ToAccount'});db[_0xa907('0x101')][_0xa907('0x118')](db['WhatsappQueue'],{'foreignKey':_0xa907('0x1ef'),'as':_0xa907('0x1db')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0xa907('0x1d8'),'as':_0xa907('0x1df')});db[_0xa907('0x101')][_0xa907('0x118')](db[_0xa907('0x13')],{'foreignKey':_0xa907('0x1d9'),'as':_0xa907('0x1e0')});db['WhatsappQueue'][_0xa907('0x11a')](db[_0xa907('0x13')],{'as':'Agents','through':_0xa907('0x39'),'foreignKey':'WhatsappQueueId'});db[_0xa907('0x132')]['belongsToMany'](db[_0xa907('0xe1')],{'through':'team_has_whatsapp_queues','as':'Teams'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index f51abc4..1efef15 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1eb=['./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/realtime','./api/realtime','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','/api/version','/api/system','./api/system','/api/pm2','/api/webbar','static','root','/apidoc','/www','join','/demo','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','username','street','mobile','fax','email','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridnum','exten','vidaooApiKey','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','lodash','path','express','util','./errors','./config/environment','./config/logger','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','format','method','headers','x-forwarded-for','remoteAddress','url','statusCode','user','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','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)','connection','responseTime','name','role','agent_name','test','/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/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/accounts','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','./api/userProfileResource','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue'];(function(_0x4148de,_0x4c1a10){var _0x4d17a9=function(_0x572bab){while(--_0x572bab){_0x4148de['push'](_0x4148de['shift']());}};_0x4d17a9(++_0x4c1a10);}(_0xc1eb,0x18f));var _0xbc1e=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xc1eb[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0xbc1e('0x0'));var path=require(_0xbc1e('0x1'));var express=require(_0xbc1e('0x2'));var ewinston=require('express-winston');var util=require(_0xbc1e('0x3'));var errors=require(_0xbc1e('0x4'));var config=require(_0xbc1e('0x5'));var logger=require(_0xbc1e('0x6'))('api');var authLogger=require(_0xbc1e('0x6'))('auth');exports[_0xbc1e('0x7')]=function(_0x43c1c1){_0x43c1c1[_0xbc1e('0x8')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x43547a,_0x4e5fed){var _0x249fb1=_0xbc1e('0x9');if(!_[_0xbc1e('0xa')](_0x43547a['body'])){_0x249fb1+=_0xbc1e('0xb');var _0x18b538=_0x43547a['body'];maskSensitiveData(_0x18b538);}return util[_0xbc1e('0xc')](_0x249fb1,_0x43547a[_0xbc1e('0xd')],_0x43547a[_0xbc1e('0xe')]['x-forwarded-for']?_0x43547a[_0xbc1e('0xe')][_0xbc1e('0xf')]:_0x43547a['connection'][_0xbc1e('0x10')]||_0x43547a['ip'],_0x43547a[_0xbc1e('0x11')],_0x4e5fed[_0xbc1e('0x12')],_0x4e5fed['responseTime'],_0x43547a['user']?_0x43547a['user']['id']:null,_0x43547a['user']?_0x43547a['user']['name']:null,_0x43547a[_0xbc1e('0x13')]?_0x43547a[_0xbc1e('0x13')]['role']:null,_0x18b538?util[_0xbc1e('0x14')](_0x18b538,![],null):'');}}));_0x43c1c1[_0xbc1e('0x8')](ewinston[_0xbc1e('0x15')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x21d725,_0x4536ab){var _0x2ba118=_0xbc1e('0x16');if(_0x21d725[_0xbc1e('0x17')]&&_0x21d725[_0xbc1e('0x17')][_0xbc1e('0x18')]&&_0x21d725['body'][_0xbc1e('0x19')]){_0x2ba118=_0xbc1e('0x1a');}return util[_0xbc1e('0xc')](_0x2ba118,_0x21d725['method'],_0x21d725[_0xbc1e('0xe')]['x-forwarded-for']?_0x21d725[_0xbc1e('0xe')][_0xbc1e('0xf')]:_0x21d725[_0xbc1e('0x1b')]['remoteAddress']||_0x21d725['ip'],_0x21d725[_0xbc1e('0x11')],_0x4536ab[_0xbc1e('0x12')],_0x4536ab[_0xbc1e('0x1c')],_0x21d725[_0xbc1e('0x13')]?_0x21d725[_0xbc1e('0x13')]['id']:null,_0x21d725[_0xbc1e('0x13')]?_0x21d725[_0xbc1e('0x13')][_0xbc1e('0x1d')]:null,_0x21d725[_0xbc1e('0x13')]?_0x21d725['user'][_0xbc1e('0x1e')]:null,_0x21d725[_0xbc1e('0x17')]&&_0x21d725[_0xbc1e('0x17')]['device']?_0x21d725['body'][_0xbc1e('0x18')]:'other',_0x21d725['body']&&_0x21d725[_0xbc1e('0x17')][_0xbc1e('0x19')]?_0x21d725['body']['agent_id']:'',_0x21d725[_0xbc1e('0x17')]&&_0x21d725[_0xbc1e('0x17')][_0xbc1e('0x1f')]?_0x21d725[_0xbc1e('0x17')][_0xbc1e('0x1f')]:'');},'ignoreRoute':function(_0x12a9af){var _0xcc4029=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xcc4029[_0xbc1e('0x20')](_0x12a9af['url']);}}));_0x43c1c1['use'](_0xbc1e('0x21'),require(_0xbc1e('0x22')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x23'),require(_0xbc1e('0x24')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x25'),require(_0xbc1e('0x26')));_0x43c1c1['use'](_0xbc1e('0x27'),require(_0xbc1e('0x28')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x29'),require('./api/voiceMusicOnHold'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x2a'),require(_0xbc1e('0x2b')));_0x43c1c1['use'](_0xbc1e('0x2c'),require(_0xbc1e('0x2d')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x2e'),require('./api/screenRecording'));_0x43c1c1[_0xbc1e('0x8')]('/api/voice/mails',require(_0xbc1e('0x2f')));_0x43c1c1[_0xbc1e('0x8')]('/api/voice/mails/messages',require(_0xbc1e('0x30')));_0x43c1c1['use'](_0xbc1e('0x31'),require(_0xbc1e('0x32')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x33'),require(_0xbc1e('0x34')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x35'),require(_0xbc1e('0x36')));_0x43c1c1[_0xbc1e('0x8')]('/api/voice/queues/reports',require(_0xbc1e('0x37')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x38'),require(_0xbc1e('0x39')));_0x43c1c1['use']('/api/trunks',require(_0xbc1e('0x3a')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x3b'),require(_0xbc1e('0x3c')));_0x43c1c1[_0xbc1e('0x8')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x43c1c1['use'](_0xbc1e('0x3d'),require(_0xbc1e('0x3e')));_0x43c1c1[_0xbc1e('0x8')]('/api/mail/queues',require(_0xbc1e('0x3f')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x40'),require('./api/mailSubstatus'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x41'),require(_0xbc1e('0x42')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x43'),require(_0xbc1e('0x44')));_0x43c1c1['use'](_0xbc1e('0x45'),require(_0xbc1e('0x46')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x47'),require(_0xbc1e('0x48')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x49'),require('./api/dashboard'));_0x43c1c1[_0xbc1e('0x8')]('/api/dashboards/items',require(_0xbc1e('0x4a')));_0x43c1c1['use'](_0xbc1e('0x4b'),require(_0xbc1e('0x4c')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x4d'),require(_0xbc1e('0x4e')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x4f'),require(_0xbc1e('0x50')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x51'),require('./api/faxMessage'));_0x43c1c1['use']('/api/fax/queues',require(_0xbc1e('0x52')));_0x43c1c1['use'](_0xbc1e('0x53'),require('./api/faxQueueReport'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x54'),require(_0xbc1e('0x55')));_0x43c1c1['use']('/api/sms/applications',require(_0xbc1e('0x56')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x57'),require(_0xbc1e('0x58')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x59'),require(_0xbc1e('0x5a')));_0x43c1c1['use'](_0xbc1e('0x5b'),require(_0xbc1e('0x5c')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x5d'),require('./api/openchannelAccount'));_0x43c1c1['use']('/api/openchannel/applications',require(_0xbc1e('0x5e')));_0x43c1c1['use'](_0xbc1e('0x5f'),require(_0xbc1e('0x60')));_0x43c1c1[_0xbc1e('0x8')]('/api/openchannel/messages',require(_0xbc1e('0x61')));_0x43c1c1['use'](_0xbc1e('0x62'),require(_0xbc1e('0x63')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x64'),require(_0xbc1e('0x65')));_0x43c1c1[_0xbc1e('0x8')]('/api/openchannel/reports/queue',require(_0xbc1e('0x66')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x67'),require(_0xbc1e('0x68')));_0x43c1c1[_0xbc1e('0x8')]('/api/chat/interactions',require(_0xbc1e('0x69')));_0x43c1c1['use'](_0xbc1e('0x6a'),require(_0xbc1e('0x6b')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x6c'),require(_0xbc1e('0x6d')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x6e'),require('./api/chatQueue'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x6f'),require(_0xbc1e('0x70')));_0x43c1c1['use'](_0xbc1e('0x71'),require(_0xbc1e('0x72')));_0x43c1c1[_0xbc1e('0x8')]('/api/cm/companies',require(_0xbc1e('0x73')));_0x43c1c1[_0xbc1e('0x8')]('/api/cm/contacts',require('./api/cmContact'));_0x43c1c1[_0xbc1e('0x8')]('/api/cm/hopper',require(_0xbc1e('0x74')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x75'),require(_0xbc1e('0x76')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x77'),require(_0xbc1e('0x78')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x79'),require(_0xbc1e('0x7a')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x7b'),require(_0xbc1e('0x7c')));_0x43c1c1[_0xbc1e('0x8')]('/api/actions',require(_0xbc1e('0x7d')));_0x43c1c1['use'](_0xbc1e('0x7e'),require(_0xbc1e('0x7f')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x80'),require(_0xbc1e('0x81')));_0x43c1c1[_0xbc1e('0x8')]('/api/dispositions',require(_0xbc1e('0x82')));_0x43c1c1['use'](_0xbc1e('0x83'),require(_0xbc1e('0x84')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x85'),require('./api/interval'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x86'),require(_0xbc1e('0x87')));_0x43c1c1[_0xbc1e('0x8')]('/api/cdr',require('./api/cdr'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x88'),require(_0xbc1e('0x89')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x8a'),require(_0xbc1e('0x8b')));_0x43c1c1['use'](_0xbc1e('0x8c'),require(_0xbc1e('0x8d')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x8e'),require(_0xbc1e('0x8f')));_0x43c1c1[_0xbc1e('0x8')]('/api/templates',require(_0xbc1e('0x90')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x91'),require(_0xbc1e('0x92')));_0x43c1c1['use'](_0xbc1e('0x93'),require(_0xbc1e('0x94')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x95'),require(_0xbc1e('0x96')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x97'),require(_0xbc1e('0x98')));_0x43c1c1['use'](_0xbc1e('0x99'),require(_0xbc1e('0x9a')));_0x43c1c1['use'](_0xbc1e('0x9b'),require(_0xbc1e('0x9c')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x9d'),require(_0xbc1e('0x9e')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x9f'),require(_0xbc1e('0xa0')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xa1'),require(_0xbc1e('0xa2')));_0x43c1c1['use'](_0xbc1e('0xa3'),require('./api/analyticTreeReport'));_0x43c1c1['use'](_0xbc1e('0xa4'),require(_0xbc1e('0xa5')));_0x43c1c1['use'](_0xbc1e('0xa6'),require('./api/intSalesforceConfiguration'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xa7'),require(_0xbc1e('0xa8')));_0x43c1c1['use'](_0xbc1e('0xa9'),require(_0xbc1e('0xaa')));_0x43c1c1['use']('/api/integrations/sugarcrm/configurations',require(_0xbc1e('0xab')));_0x43c1c1[_0xbc1e('0x8')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xac'),require(_0xbc1e('0xad')));_0x43c1c1['use'](_0xbc1e('0xae'),require(_0xbc1e('0xaf')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xb0'),require(_0xbc1e('0xb1')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xb2'),require(_0xbc1e('0xb3')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xb4'),require('./api/intZohoConfiguration'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xb5'),require(_0xbc1e('0xb6')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xb7'),require(_0xbc1e('0xb8')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xb9'),require(_0xbc1e('0xba')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xbb'),require(_0xbc1e('0xbc')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xbd'),require(_0xbc1e('0xbe')));_0x43c1c1[_0xbc1e('0x8')]('/api/integrations/freshdesk/configurations',require(_0xbc1e('0xbf')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xc0'),require(_0xbc1e('0xc1')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xc2'),require('./api/intVtigerAccount'));_0x43c1c1['use'](_0xbc1e('0xc3'),require(_0xbc1e('0xc4')));_0x43c1c1['use']('/api/integrations/vtiger/fields',require(_0xbc1e('0xc5')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xc6'),require(_0xbc1e('0xc7')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xc8'),require('./api/intServicenowConfiguration'));_0x43c1c1[_0xbc1e('0x8')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x43c1c1['use'](_0xbc1e('0xc9'),require(_0xbc1e('0xca')));_0x43c1c1['use'](_0xbc1e('0xcb'),require(_0xbc1e('0xcc')));_0x43c1c1['use'](_0xbc1e('0xcd'),require(_0xbc1e('0xce')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xcf'),require(_0xbc1e('0xd0')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xd1'),require(_0xbc1e('0xd2')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xd3'),require(_0xbc1e('0xd4')));_0x43c1c1['use']('/api/networks',require(_0xbc1e('0xd5')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xd6'),require('./api/chatQueueReport'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xd7'),require(_0xbc1e('0xd8')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xd9'),require('./api/jscriptyAnswerReport'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xda'),require(_0xbc1e('0xdb')));_0x43c1c1[_0xbc1e('0x8')]('/api/jscripty/sessions/reports',require(_0xbc1e('0xdc')));_0x43c1c1['use'](_0xbc1e('0xdd'),require(_0xbc1e('0xde')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xdf'),require(_0xbc1e('0xe0')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xe1'),require(_0xbc1e('0xe2')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xe3'),require('./api/jscriptyProject'));_0x43c1c1[_0xbc1e('0x8')]('/api/settings',require(_0xbc1e('0xe4')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xe5'),require(_0xbc1e('0xe6')));_0x43c1c1[_0xbc1e('0x8')]('/api/square/projects',require('./api/squareProject'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xe7'),require(_0xbc1e('0xe8')));_0x43c1c1[_0xbc1e('0x8')]('/api/square/messages',require(_0xbc1e('0xe9')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xea'),require(_0xbc1e('0xeb')));_0x43c1c1['use'](_0xbc1e('0xec'),require(_0xbc1e('0xed')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xee'),require(_0xbc1e('0xef')));_0x43c1c1['use']('/api/migrations',require(_0xbc1e('0xf0')));_0x43c1c1[_0xbc1e('0x8')]('/api/attachments',require('./api/attachment'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xf1'),require('./api/plugin'));_0x43c1c1['use'](_0xbc1e('0xf2'),require(_0xbc1e('0xf3')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xf4'),require('./api/chatTransferReport'));_0x43c1c1[_0xbc1e('0x8')]('/api/fax/reports/transfer',require(_0xbc1e('0xf5')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xf6'),require('./api/openchannelTransferReport'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xf7'),require(_0xbc1e('0xf8')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xf9'),require('./api/cmList'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0xfa'),require(_0xbc1e('0xfb')));_0x43c1c1['use'](_0xbc1e('0xfc'),require(_0xbc1e('0xfd')));_0x43c1c1[_0xbc1e('0x8')]('/api/userProfile/sections',require(_0xbc1e('0xfe')));_0x43c1c1['use']('/api/userProfile/resources',require(_0xbc1e('0xff')));_0x43c1c1[_0xbc1e('0x8')]('/api/userNotifications',require(_0xbc1e('0x100')));_0x43c1c1[_0xbc1e('0x8')]('/api/whatsapp/accounts',require(_0xbc1e('0x101')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x102'),require(_0xbc1e('0x103')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x104'),require(_0xbc1e('0x105')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x106'),require(_0xbc1e('0x107')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x108'),require('./api/whatsappQueueReport'));_0x43c1c1['use']('/api/whatsapp/reports/transfer',require(_0xbc1e('0x109')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x10a'),require(_0xbc1e('0x10b')));_0x43c1c1[_0xbc1e('0x8')]('/api/cloudProviders',require('./api/cloudProvider'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x10c'),require(_0xbc1e('0x10d')));_0x43c1c1[_0xbc1e('0x8')]('/api/auth/local',require(_0xbc1e('0x10e')));_0x43c1c1['use'](_0xbc1e('0x10f'),require('./api/authGoogle'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x110'),require(_0xbc1e('0x111')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x112'),require('./api/rpc'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x113'),require('./api/version'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x114'),require(_0xbc1e('0x115')));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x116'),require('./api/pm2'));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x117'),require('./api/webbar'));_0x43c1c1[_0xbc1e('0x8')]('/apidoc',express[_0xbc1e('0x118')](path['join'](config[_0xbc1e('0x119')],_0xbc1e('0x11a'))));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x11b'),express['static'](path[_0xbc1e('0x11c')](config[_0xbc1e('0x119')],'/www')));_0x43c1c1[_0xbc1e('0x8')]('/demo',express[_0xbc1e('0x118')](path['join'](config[_0xbc1e('0x119')],_0xbc1e('0x11d'))));_0x43c1c1[_0xbc1e('0x8')]('/snippet',express[_0xbc1e('0x118')](path['join'](config['root'],_0xbc1e('0x11e'),_0xbc1e('0x11f'))));_0x43c1c1[_0xbc1e('0x8')](_0xbc1e('0x120'),express[_0xbc1e('0x118')](path[_0xbc1e('0x11c')](config[_0xbc1e('0x119')],_0xbc1e('0x121'))));_0x43c1c1[_0xbc1e('0x122')](_0xbc1e('0x123'))[_0xbc1e('0x124')](errors[0x194]);_0x43c1c1[_0xbc1e('0x122')]('/*')[_0xbc1e('0x124')](function(_0x35d8de,_0x46e397){_0x46e397['sendFile'](path['resolve'](_0x43c1c1[_0xbc1e('0x124')](_0xbc1e('0x125'))+'/index.html'));});};var sensitiveFields=[_0xbc1e('0x126'),'password','newPassword','apiKey','firstName','lastName',_0xbc1e('0x127'),'phone',_0xbc1e('0x128'),_0xbc1e('0x129'),_0xbc1e('0x12a'),'clientId',_0xbc1e('0x12b'),_0xbc1e('0x12c'),_0xbc1e('0x12d'),_0xbc1e('0x12e'),_0xbc1e('0x12f'),_0xbc1e('0x130'),'channelSecret',_0xbc1e('0x131'),_0xbc1e('0x132'),_0xbc1e('0x133'),_0xbc1e('0x134'),_0xbc1e('0x135'),_0xbc1e('0x136'),'calleridname',_0xbc1e('0x137'),_0xbc1e('0x138'),_0xbc1e('0x139'),'clientEmail',_0xbc1e('0x13a'),_0xbc1e('0x13b'),_0xbc1e('0x13c'),_0xbc1e('0x13d'),_0xbc1e('0x13'),_0xbc1e('0x13e'),_0xbc1e('0x13f'),_0xbc1e('0x140'),_0xbc1e('0x141'),_0xbc1e('0x142'),'registry',_0xbc1e('0x143')];function maskSensitiveData(_0xc57b82){var _0x551e15=/(?!^)[\s\S](?!$)/g;if(!_[_0xbc1e('0x144')](_0xc57b82))return;for(var _0x2a669c in _0xc57b82){if(_[_0xbc1e('0x145')](_0xc57b82[_0x2a669c])){for(var _0x21d81d=0x0;_0x21d81d<_0xc57b82[_0x2a669c][_0xbc1e('0x146')];_0x21d81d++){maskSensitiveData(_0xc57b82[_0x2a669c][_0x21d81d]);}}else if(_['isPlainObject'](_0xc57b82[_0x2a669c])){maskSensitiveData(_0xc57b82[_0x2a669c]);}else if(_[_0xbc1e('0x147')](_0xc57b82[_0x2a669c])){_0xc57b82[_0x2a669c]=_0xc57b82[_0x2a669c][_0xbc1e('0x148')](/{{{/g,_0xbc1e('0x149'))[_0xbc1e('0x148')](/}}}/g,_0xbc1e('0x14a'))[_0xbc1e('0x148')](/{{/g,'@{')[_0xbc1e('0x148')](/}}/g,'}@');if(_[_0xbc1e('0x14b')](sensitiveFields,_0x2a669c)){_0xc57b82[_0x2a669c]=_0xc57b82[_0x2a669c][_0xbc1e('0x148')](_0x551e15,'*');}}}} \ No newline at end of file +var _0x521e=['/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','join','root','/www','static','/demo','snippet','3.0.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','password','newPassword','firstName','lastName','street','phone','email','clientId','securityToken','code','token','accessToken','accessTokenSecret','consumerSecret','membername','calleridname','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','replace','}@@','includes','path','express','./errors','./config/environment','./config/logger','api','auth','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','user','role','inspect','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','statusCode','name','device','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','/api/mail/out_servers','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','/api/fax/queues','./api/faxQueue','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','./api/cannedAnswer','./api/disposition','/api/conditions','/api/intervals','./api/interval','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./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/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license'];(function(_0x2574bf,_0x2be7e3){var _0x46e782=function(_0x39034f){while(--_0x39034f){_0x2574bf['push'](_0x2574bf['shift']());}};_0x46e782(++_0x2be7e3);}(_0x521e,0x68));var _0xe521=function(_0x51beb0,_0x4eb998){_0x51beb0=_0x51beb0-0x0;var _0x830db0=_0x521e[_0x51beb0];return _0x830db0;};'use strict';var _=require('lodash');var path=require(_0xe521('0x0'));var express=require(_0xe521('0x1'));var ewinston=require('express-winston');var util=require('util');var errors=require(_0xe521('0x2'));var config=require(_0xe521('0x3'));var logger=require(_0xe521('0x4'))(_0xe521('0x5'));var authLogger=require(_0xe521('0x4'))(_0xe521('0x6'));exports[_0xe521('0x7')]=function(_0x2e23f5){_0x2e23f5[_0xe521('0x8')](ewinston[_0xe521('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5bc239,_0x252ab2){var _0x30dd03=_0xe521('0xa');if(!_[_0xe521('0xb')](_0x5bc239['body'])){_0x30dd03+=_0xe521('0xc');var _0xdbe315=_0x5bc239[_0xe521('0xd')];maskSensitiveData(_0xdbe315);}return util[_0xe521('0xe')](_0x30dd03,_0x5bc239[_0xe521('0xf')],_0x5bc239[_0xe521('0x10')]['x-forwarded-for']?_0x5bc239[_0xe521('0x10')][_0xe521('0x11')]:_0x5bc239[_0xe521('0x12')][_0xe521('0x13')]||_0x5bc239['ip'],_0x5bc239[_0xe521('0x14')],_0x252ab2['statusCode'],_0x252ab2[_0xe521('0x15')],_0x5bc239['user']?_0x5bc239[_0xe521('0x16')]['id']:null,_0x5bc239['user']?_0x5bc239[_0xe521('0x16')]['name']:null,_0x5bc239[_0xe521('0x16')]?_0x5bc239['user'][_0xe521('0x17')]:null,_0xdbe315?util[_0xe521('0x18')](_0xdbe315,![],null):'');}}));_0x2e23f5[_0xe521('0x8')](ewinston[_0xe521('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x519315,_0x29a7d0){var _0x1c7861='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x519315[_0xe521('0xd')]&&_0x519315[_0xe521('0xd')]['device']&&_0x519315[_0xe521('0xd')][_0xe521('0x19')]){_0x1c7861=_0xe521('0x1a');}return util[_0xe521('0xe')](_0x1c7861,_0x519315['method'],_0x519315[_0xe521('0x10')][_0xe521('0x11')]?_0x519315[_0xe521('0x10')][_0xe521('0x11')]:_0x519315[_0xe521('0x12')][_0xe521('0x13')]||_0x519315['ip'],_0x519315['url'],_0x29a7d0[_0xe521('0x1b')],_0x29a7d0[_0xe521('0x15')],_0x519315[_0xe521('0x16')]?_0x519315[_0xe521('0x16')]['id']:null,_0x519315[_0xe521('0x16')]?_0x519315[_0xe521('0x16')][_0xe521('0x1c')]:null,_0x519315[_0xe521('0x16')]?_0x519315[_0xe521('0x16')][_0xe521('0x17')]:null,_0x519315[_0xe521('0xd')]&&_0x519315['body']['device']?_0x519315[_0xe521('0xd')][_0xe521('0x1d')]:_0xe521('0x1e'),_0x519315[_0xe521('0xd')]&&_0x519315['body'][_0xe521('0x19')]?_0x519315[_0xe521('0xd')][_0xe521('0x19')]:'',_0x519315[_0xe521('0xd')]&&_0x519315['body'][_0xe521('0x1f')]?_0x519315[_0xe521('0xd')][_0xe521('0x1f')]:'');},'ignoreRoute':function(_0x30e6cf){var _0x51dabc=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x51dabc[_0xe521('0x20')](_0x30e6cf['url']);}}));_0x2e23f5[_0xe521('0x8')](_0xe521('0x21'),require(_0xe521('0x22')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x23'),require(_0xe521('0x24')));_0x2e23f5[_0xe521('0x8')]('/api/voice/contexts',require(_0xe521('0x25')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x26'),require(_0xe521('0x27')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x28'),require(_0xe521('0x29')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x2a'),require('./api/voiceQueue'));_0x2e23f5['use']('/api/voice/recordings',require(_0xe521('0x2b')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x2c'),require('./api/screenRecording'));_0x2e23f5[_0xe521('0x8')](_0xe521('0x2d'),require(_0xe521('0x2e')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x2f'),require(_0xe521('0x30')));_0x2e23f5[_0xe521('0x8')]('/api/voice/calls/reports',require(_0xe521('0x31')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x32'),require(_0xe521('0x33')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x34'),require(_0xe521('0x35')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x36'),require(_0xe521('0x37')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x38'),require('./api/memberReport'));_0x2e23f5[_0xe521('0x8')](_0xe521('0x39'),require('./api/trunk'));_0x2e23f5[_0xe521('0x8')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x2e23f5[_0xe521('0x8')](_0xe521('0x3a'),require('./api/mailServerOut'));_0x2e23f5['use']('/api/mail/accounts',require(_0xe521('0x3b')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x3c'),require('./api/mailQueue'));_0x2e23f5[_0xe521('0x8')](_0xe521('0x3d'),require(_0xe521('0x3e')));_0x2e23f5[_0xe521('0x8')]('/api/mail/interactions',require(_0xe521('0x3f')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x40'),require(_0xe521('0x41')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x42'),require(_0xe521('0x43')));_0x2e23f5['use'](_0xe521('0x44'),require(_0xe521('0x45')));_0x2e23f5['use'](_0xe521('0x46'),require(_0xe521('0x47')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x48'),require('./api/dashboardItem'));_0x2e23f5[_0xe521('0x8')](_0xe521('0x49'),require(_0xe521('0x4a')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x4b'),require(_0xe521('0x4c')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x4d'),require('./api/faxInteraction'));_0x2e23f5[_0xe521('0x8')](_0xe521('0x4e'),require('./api/faxMessage'));_0x2e23f5[_0xe521('0x8')](_0xe521('0x4f'),require(_0xe521('0x50')));_0x2e23f5[_0xe521('0x8')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x2e23f5[_0xe521('0x8')]('/api/sms/accounts',require(_0xe521('0x51')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x52'),require(_0xe521('0x53')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x54'),require(_0xe521('0x55')));_0x2e23f5['use'](_0xe521('0x56'),require(_0xe521('0x57')));_0x2e23f5['use'](_0xe521('0x58'),require('./api/smsQueue'));_0x2e23f5[_0xe521('0x8')](_0xe521('0x59'),require(_0xe521('0x5a')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x5b'),require(_0xe521('0x5c')));_0x2e23f5['use']('/api/openchannel/interactions',require(_0xe521('0x5d')));_0x2e23f5['use']('/api/openchannel/messages',require(_0xe521('0x5e')));_0x2e23f5['use'](_0xe521('0x5f'),require(_0xe521('0x60')));_0x2e23f5['use']('/api/chat/websites',require(_0xe521('0x61')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x62'),require(_0xe521('0x63')));_0x2e23f5[_0xe521('0x8')]('/api/chat/applications',require(_0xe521('0x64')));_0x2e23f5[_0xe521('0x8')]('/api/chat/interactions',require('./api/chatInteraction'));_0x2e23f5['use'](_0xe521('0x65'),require('./api/chatMessage'));_0x2e23f5[_0xe521('0x8')](_0xe521('0x66'),require(_0xe521('0x67')));_0x2e23f5['use'](_0xe521('0x68'),require(_0xe521('0x69')));_0x2e23f5['use'](_0xe521('0x6a'),require(_0xe521('0x6b')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x6c'),require(_0xe521('0x6d')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x6e'),require(_0xe521('0x6f')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x70'),require('./api/cmContact'));_0x2e23f5[_0xe521('0x8')](_0xe521('0x71'),require(_0xe521('0x72')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x73'),require(_0xe521('0x74')));_0x2e23f5['use'](_0xe521('0x75'),require(_0xe521('0x76')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x77'),require(_0xe521('0x78')));_0x2e23f5['use'](_0xe521('0x79'),require(_0xe521('0x7a')));_0x2e23f5[_0xe521('0x8')]('/api/actions',require(_0xe521('0x7b')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x7c'),require(_0xe521('0x7d')));_0x2e23f5[_0xe521('0x8')]('/api/canned_answers',require(_0xe521('0x7e')));_0x2e23f5['use']('/api/dispositions',require(_0xe521('0x7f')));_0x2e23f5['use'](_0xe521('0x80'),require('./api/condition'));_0x2e23f5[_0xe521('0x8')](_0xe521('0x81'),require(_0xe521('0x82')));_0x2e23f5[_0xe521('0x8')]('/api/pauses',require(_0xe521('0x83')));_0x2e23f5['use']('/api/cdr',require(_0xe521('0x84')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x85'),require(_0xe521('0x86')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x87'),require(_0xe521('0x88')));_0x2e23f5['use']('/api/sounds',require(_0xe521('0x89')));_0x2e23f5['use'](_0xe521('0x8a'),require('./api/tag'));_0x2e23f5['use']('/api/templates',require(_0xe521('0x8b')));_0x2e23f5['use'](_0xe521('0x8c'),require(_0xe521('0x8d')));_0x2e23f5['use'](_0xe521('0x8e'),require(_0xe521('0x8f')));_0x2e23f5['use'](_0xe521('0x90'),require('./api/integration'));_0x2e23f5[_0xe521('0x8')](_0xe521('0x91'),require('./api/integrationReport'));_0x2e23f5[_0xe521('0x8')](_0xe521('0x92'),require(_0xe521('0x93')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x94'),require(_0xe521('0x95')));_0x2e23f5[_0xe521('0x8')]('/api/analytics/extracted_reports',require(_0xe521('0x96')));_0x2e23f5[_0xe521('0x8')]('/api/analytics/metrics',require(_0xe521('0x97')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x98'),require(_0xe521('0x99')));_0x2e23f5[_0xe521('0x8')]('/api/analytics/tree_reports',require(_0xe521('0x9a')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x9b'),require(_0xe521('0x9c')));_0x2e23f5['use'](_0xe521('0x9d'),require(_0xe521('0x9e')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x9f'),require(_0xe521('0xa0')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xa1'),require(_0xe521('0xa2')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xa3'),require(_0xe521('0xa4')));_0x2e23f5['use'](_0xe521('0xa5'),require('./api/intSugarcrmField'));_0x2e23f5[_0xe521('0x8')](_0xe521('0xa6'),require(_0xe521('0xa7')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xa8'),require(_0xe521('0xa9')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xaa'),require('./api/intDeskField'));_0x2e23f5[_0xe521('0x8')](_0xe521('0xab'),require(_0xe521('0xac')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xad'),require(_0xe521('0xae')));_0x2e23f5['use'](_0xe521('0xaf'),require(_0xe521('0xb0')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xb1'),require('./api/intZendeskAccount'));_0x2e23f5[_0xe521('0x8')](_0xe521('0xb2'),require(_0xe521('0xb3')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xb4'),require(_0xe521('0xb5')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xb6'),require(_0xe521('0xb7')));_0x2e23f5['use']('/api/integrations/freshdesk/configurations',require(_0xe521('0xb8')));_0x2e23f5[_0xe521('0x8')]('/api/integrations/freshdesk/fields',require(_0xe521('0xb9')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xba'),require(_0xe521('0xbb')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xbc'),require(_0xe521('0xbd')));_0x2e23f5['use']('/api/integrations/vtiger/fields',require(_0xe521('0xbe')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xbf'),require('./api/intServicenowAccount'));_0x2e23f5[_0xe521('0x8')](_0xe521('0xc0'),require(_0xe521('0xc1')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xc2'),require(_0xe521('0xc3')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xc4'),require(_0xe521('0xc5')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xc6'),require(_0xe521('0xc7')));_0x2e23f5[_0xe521('0x8')]('/api/integrations/dynamics365/fields',require(_0xe521('0xc8')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xc9'),require('./api/intFreshsalesAccount'));_0x2e23f5[_0xe521('0x8')](_0xe521('0xca'),require(_0xe521('0xcb')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xcc'),require(_0xe521('0xcd')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xce'),require(_0xe521('0xcf')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xd0'),require(_0xe521('0xd1')));_0x2e23f5['use']('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x2e23f5[_0xe521('0x8')](_0xe521('0xd2'),require(_0xe521('0xd3')));_0x2e23f5[_0xe521('0x8')]('/api/jscripty/questions/reports',require(_0xe521('0xd4')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xd5'),require('./api/jscriptySessionReport'));_0x2e23f5['use'](_0xe521('0xd6'),require(_0xe521('0xd7')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xd8'),require('./api/squareReport'));_0x2e23f5['use'](_0xe521('0xd9'),require(_0xe521('0xda')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xdb'),require(_0xe521('0xdc')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xdd'),require(_0xe521('0xde')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xdf'),require(_0xe521('0xe0')));_0x2e23f5[_0xe521('0x8')]('/api/square/projects',require(_0xe521('0xe1')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xe2'),require('./api/squareRecording'));_0x2e23f5['use'](_0xe521('0xe3'),require(_0xe521('0xe4')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xe5'),require(_0xe521('0xe6')));_0x2e23f5[_0xe521('0x8')]('/api/license',require(_0xe521('0xe7')));_0x2e23f5['use']('/api/campaigns',require('./api/campaign'));_0x2e23f5[_0xe521('0x8')](_0xe521('0xe8'),require(_0xe521('0xe9')));_0x2e23f5['use'](_0xe521('0xea'),require(_0xe521('0xeb')));_0x2e23f5['use'](_0xe521('0xec'),require(_0xe521('0xed')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xee'),require('./api/mailTransferReport'));_0x2e23f5[_0xe521('0x8')](_0xe521('0xef'),require(_0xe521('0xf0')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xf1'),require(_0xe521('0xf2')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xf3'),require('./api/openchannelTransferReport'));_0x2e23f5['use']('/api/sms/reports/transfer',require(_0xe521('0xf4')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xf5'),require(_0xe521('0xf6')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xf7'),require(_0xe521('0xf8')));_0x2e23f5[_0xe521('0x8')]('/api/userProfiles',require('./api/userProfile'));_0x2e23f5[_0xe521('0x8')]('/api/userProfile/sections',require(_0xe521('0xf9')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xfa'),require(_0xe521('0xfb')));_0x2e23f5['use'](_0xe521('0xfc'),require(_0xe521('0xfd')));_0x2e23f5[_0xe521('0x8')](_0xe521('0xfe'),require(_0xe521('0xff')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x100'),require(_0xe521('0x101')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x102'),require(_0xe521('0x103')));_0x2e23f5['use'](_0xe521('0x104'),require(_0xe521('0x105')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x106'),require(_0xe521('0x107')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x108'),require(_0xe521('0x109')));_0x2e23f5['use'](_0xe521('0x10a'),require('./api/whatsappQueue'));_0x2e23f5[_0xe521('0x8')](_0xe521('0x10b'),require('./api/cloudProvider'));_0x2e23f5[_0xe521('0x8')](_0xe521('0x10c'),require(_0xe521('0x10d')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x10e'),require(_0xe521('0x10f')));_0x2e23f5['use'](_0xe521('0x110'),require('./api/authGoogle'));_0x2e23f5[_0xe521('0x8')](_0xe521('0x111'),require(_0xe521('0x112')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x113'),require(_0xe521('0x114')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x115'),require(_0xe521('0x116')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x117'),require(_0xe521('0x118')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x119'),require(_0xe521('0x11a')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x11b'),require(_0xe521('0x11c')));_0x2e23f5[_0xe521('0x8')](_0xe521('0x11d'),express['static'](path[_0xe521('0x11e')](config[_0xe521('0x11f')],_0xe521('0x11d'))));_0x2e23f5[_0xe521('0x8')](_0xe521('0x120'),express[_0xe521('0x121')](path['join'](config[_0xe521('0x11f')],_0xe521('0x120'))));_0x2e23f5['use'](_0xe521('0x122'),express[_0xe521('0x121')](path[_0xe521('0x11e')](config[_0xe521('0x11f')],_0xe521('0x122'))));_0x2e23f5[_0xe521('0x8')]('/snippet',express[_0xe521('0x121')](path[_0xe521('0x11e')](config[_0xe521('0x11f')],_0xe521('0x123'),_0xe521('0x124'))));_0x2e23f5[_0xe521('0x8')](_0xe521('0x125'),express[_0xe521('0x121')](path['join'](config['root'],_0xe521('0x126'))));_0x2e23f5[_0xe521('0x127')](_0xe521('0x128'))[_0xe521('0x129')](errors[0x194]);_0x2e23f5[_0xe521('0x127')]('/*')[_0xe521('0x129')](function(_0x27448a,_0x172c59){_0x172c59[_0xe521('0x12a')](path[_0xe521('0x12b')](_0x2e23f5[_0xe521('0x129')](_0xe521('0x12c'))+_0xe521('0x12d')));});};var sensitiveFields=['username',_0xe521('0x12e'),_0xe521('0x12f'),'apiKey',_0xe521('0x130'),_0xe521('0x131'),_0xe521('0x132'),_0xe521('0x133'),'mobile','fax',_0xe521('0x134'),_0xe521('0x135'),'clientSecret',_0xe521('0x136'),_0xe521('0x137'),'accessKey','tenantId',_0xe521('0x138'),'channelSecret',_0xe521('0x139'),_0xe521('0x13a'),'authToken','consumerKey',_0xe521('0x13b'),_0xe521('0x13c'),_0xe521('0x13d'),'calleridnum',_0xe521('0x13e'),'vidaooApiKey',_0xe521('0x13f'),_0xe521('0x140'),_0xe521('0x141'),_0xe521('0x142'),_0xe521('0x143'),_0xe521('0x16'),_0xe521('0x144'),'accountSid','localstationid',_0xe521('0x145'),_0xe521('0x146'),_0xe521('0x147'),_0xe521('0x148')];function maskSensitiveData(_0xa0e143){var _0x3b9bb4=/(?!^)[\s\S](?!$)/g;if(!_[_0xe521('0x149')](_0xa0e143))return;for(var _0xe5b4ab in _0xa0e143){if(_[_0xe521('0x14a')](_0xa0e143[_0xe5b4ab])){for(var _0x3549ca=0x0;_0x3549ca<_0xa0e143[_0xe5b4ab][_0xe521('0x14b')];_0x3549ca++){maskSensitiveData(_0xa0e143[_0xe5b4ab][_0x3549ca]);}}else if(_[_0xe521('0x149')](_0xa0e143[_0xe5b4ab])){maskSensitiveData(_0xa0e143[_0xe5b4ab]);}else if(_[_0xe521('0x14c')](_0xa0e143[_0xe5b4ab])){_0xa0e143[_0xe5b4ab]=_0xa0e143[_0xe5b4ab][_0xe521('0x14d')](/{{{/g,'@@{')[_0xe521('0x14d')](/}}}/g,_0xe521('0x14e'))[_0xe521('0x14d')](/{{/g,'@{')[_0xe521('0x14d')](/}}/g,'}@');if(_[_0xe521('0x14f')](sensitiveFields,_0xe5b4ab)){_0xa0e143[_0xe5b4ab]=_0xa0e143[_0xe5b4ab][_0xe521('0x14d')](_0x3b9bb4,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 80a6eea..8c46d4b 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x73c3=['../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/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/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.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/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/variable/variable.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.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','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc'];(function(_0x44a518,_0x413a2d){var _0x4a3cdf=function(_0x268625){while(--_0x268625){_0x44a518['push'](_0x44a518['shift']());}};_0x4a3cdf(++_0x413a2d);}(_0x73c3,0x1e7));var _0x373c=function(_0xf54a80,_0x4f0c6a){_0xf54a80=_0xf54a80-0x0;var _0x208e95=_0x73c3[_0xf54a80];return _0x208e95;};'use strict';var jayson=require(_0x373c('0x0'));var BPromise=require(_0x373c('0x1'));var _=require('lodash');var config=require('../config/environment');exports['listen']=function(){return new BPromise(function(_0x3fa859,_0x39dff7){var _0x294789={};_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x3')));_0x294789=_['merge'](_0x294789,require(_0x373c('0x4')));_0x294789=_[_0x373c('0x2')](_0x294789,require('../api/voiceQueue/voiceQueue.rpc'));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x5')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x6')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x7')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x8')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x9')));_0x294789=_[_0x373c('0x2')](_0x294789,require('../api/memberReport/memberReport.rpc'));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0xa')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0xb')));_0x294789=_['merge'](_0x294789,require(_0x373c('0xc')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0xd')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0xe')));_0x294789=_[_0x373c('0x2')](_0x294789,require('../api/mailQueue/mailQueue.rpc'));_0x294789=_['merge'](_0x294789,require(_0x373c('0xf')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x10')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x11')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x12')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x13')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x14')));_0x294789=_[_0x373c('0x2')](_0x294789,require('../api/faxInteraction/faxInteraction.rpc'));_0x294789=_[_0x373c('0x2')](_0x294789,require('../api/faxMessage/faxMessage.rpc'));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x15')));_0x294789=_[_0x373c('0x2')](_0x294789,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x294789=_[_0x373c('0x2')](_0x294789,require('../api/smsAccount/smsAccount.rpc'));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x16')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x17')));_0x294789=_['merge'](_0x294789,require(_0x373c('0x18')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x19')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x1a')));_0x294789=_[_0x373c('0x2')](_0x294789,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x1b')));_0x294789=_['merge'](_0x294789,require(_0x373c('0x1c')));_0x294789=_[_0x373c('0x2')](_0x294789,require('../api/chatInteraction/chatInteraction.rpc'));_0x294789=_['merge'](_0x294789,require('../api/chatMessage/chatMessage.rpc'));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x1d')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x1e')));_0x294789=_['merge'](_0x294789,require(_0x373c('0x1f')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x20')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x21')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x22')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x23')));_0x294789=_['merge'](_0x294789,require('../api/interval/interval.rpc'));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x24')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x25')));_0x294789=_[_0x373c('0x2')](_0x294789,require('../api/template/template.rpc'));_0x294789=_['merge'](_0x294789,require('../api/trigger/trigger.rpc'));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x26')));_0x294789=_['merge'](_0x294789,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x294789=_[_0x373c('0x2')](_0x294789,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x294789=_['merge'](_0x294789,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x27')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x28')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x29')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x2a')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x2b')));_0x294789=_['merge'](_0x294789,require(_0x373c('0x2c')));_0x294789=_[_0x373c('0x2')](_0x294789,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x294789=_['merge'](_0x294789,require(_0x373c('0x2d')));_0x294789=_[_0x373c('0x2')](_0x294789,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x2e')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x2f')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x30')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x31')));_0x294789=_['merge'](_0x294789,require('../api/squareProject/squareProject.rpc'));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x32')));_0x294789=_['merge'](_0x294789,require('../api/squareMessage/squareMessage.rpc'));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x33')));_0x294789=_[_0x373c('0x2')](_0x294789,require('../api/attachment/attachment.rpc'));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x34')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x35')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x36')));_0x294789=_['merge'](_0x294789,require(_0x373c('0x37')));_0x294789=_[_0x373c('0x2')](_0x294789,require(_0x373c('0x38')));_0x294789=_['merge'](_0x294789,require(_0x373c('0x39')));var _0x3b2f25=jayson[_0x373c('0x3a')](_0x294789)['http']();var _0x23b444=config[_0x373c('0x3b')][_0x373c('0x3c')]||config[_0x373c('0x3c')]+0x1;var _0x2d825f=config[_0x373c('0x3b')]['ip']||_0x373c('0x3d');_0x3b2f25['on'](_0x373c('0x3e'),function(_0x1c173f){return _0x39dff7(_0x1c173f);});_0x3b2f25['listen'](_0x23b444,_0x2d825f,function(){console[_0x373c('0x3f')](_0x373c('0x40'),_0x2d825f,_0x23b444);require(_0x373c('0x41'))[_0x373c('0x42')]();return _0x3fa859(_0x373c('0x43')+_0x2d825f+':'+_0x23b444);});});}; \ No newline at end of file +var _0xdde9=['log','../config/triggers','bluebird','../config/environment','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.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/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','listen'];(function(_0x5daae2,_0x50727b){var _0xfcffb3=function(_0x193434){while(--_0x193434){_0x5daae2['push'](_0x5daae2['shift']());}};_0xfcffb3(++_0x50727b);}(_0xdde9,0xfa));var _0x9dde=function(_0x49d068,_0x23c631){_0x49d068=_0x49d068-0x0;var _0x541ce6=_0xdde9[_0x49d068];return _0x541ce6;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x9dde('0x0'));var _=require('lodash');var config=require(_0x9dde('0x1'));exports['listen']=function(){return new BPromise(function(_0x3aef1f,_0x577fd1){var _0x271f3c={};_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x3')));_0x271f3c=_['merge'](_0x271f3c,require('../api/voiceExtension/voiceExtension.rpc'));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x4')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x5')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x6')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x271f3c=_['merge'](_0x271f3c,require(_0x9dde('0x7')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x8')));_0x271f3c=_['merge'](_0x271f3c,require(_0x9dde('0x9')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x271f3c=_['merge'](_0x271f3c,require('../api/mailServerIn/mailServerIn.rpc'));_0x271f3c=_['merge'](_0x271f3c,require(_0x9dde('0xa')));_0x271f3c=_['merge'](_0x271f3c,require(_0x9dde('0xb')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0xc')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0xd')));_0x271f3c=_['merge'](_0x271f3c,require('../api/mailApplication/mailApplication.rpc'));_0x271f3c=_['merge'](_0x271f3c,require(_0x9dde('0xe')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0xf')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require('../api/faxApplication/faxApplication.rpc'));_0x271f3c=_['merge'](_0x271f3c,require('../api/faxInteraction/faxInteraction.rpc'));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x10')));_0x271f3c=_['merge'](_0x271f3c,require(_0x9dde('0x11')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x12')));_0x271f3c=_['merge'](_0x271f3c,require('../api/smsAccount/smsAccount.rpc'));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require('../api/smsInteraction/smsInteraction.rpc'));_0x271f3c=_['merge'](_0x271f3c,require(_0x9dde('0x13')));_0x271f3c=_['merge'](_0x271f3c,require('../api/smsQueue/smsQueue.rpc'));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x14')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x15')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x16')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x17')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x18')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x19')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require('../api/cmContact/cmContact.rpc'));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x1a')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x1b')));_0x271f3c=_['merge'](_0x271f3c,require(_0x9dde('0x1c')));_0x271f3c=_['merge'](_0x271f3c,require(_0x9dde('0x1d')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x1e')));_0x271f3c=_['merge'](_0x271f3c,require(_0x9dde('0x1f')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require('../api/pause/pause.rpc'));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x20')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x21')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x22')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x23')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x24')));_0x271f3c=_['merge'](_0x271f3c,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x271f3c=_['merge'](_0x271f3c,require(_0x9dde('0x25')));_0x271f3c=_['merge'](_0x271f3c,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x26')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x27')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x28')));_0x271f3c=_['merge'](_0x271f3c,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x271f3c=_['merge'](_0x271f3c,require(_0x9dde('0x29')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x2a')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x2b')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x2c')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x2d')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x2e')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require('../api/squareProject/squareProject.rpc'));_0x271f3c=_['merge'](_0x271f3c,require(_0x9dde('0x2f')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x30')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x31')));_0x271f3c=_['merge'](_0x271f3c,require('../api/attachment/attachment.rpc'));_0x271f3c=_['merge'](_0x271f3c,require('../api/plugin/plugin.rpc'));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x32')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x33')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x34')));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x271f3c=_[_0x9dde('0x2')](_0x271f3c,require(_0x9dde('0x35')));var _0x3d087e=jayson[_0x9dde('0x36')](_0x271f3c)[_0x9dde('0x37')]();var _0x1bb2f5=config[_0x9dde('0x38')][_0x9dde('0x39')]||config[_0x9dde('0x39')]+0x1;var _0x5c78ad=config[_0x9dde('0x38')]['ip']||_0x9dde('0x3a');_0x3d087e['on']('error',function(_0x4281bc){return _0x577fd1(_0x4281bc);});_0x3d087e[_0x9dde('0x3b')](_0x1bb2f5,_0x5c78ad,function(){console[_0x9dde('0x3c')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x5c78ad,_0x1bb2f5);require(_0x9dde('0x3d'))['default']();return _0x3aef1f('RPC\x20listening\x20on\x20'+_0x5c78ad+':'+_0x1bb2f5);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index f4ba6a9..543d51a 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 _0xb2b4=['EventEmitter','./reply','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','replace','result=','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','function','inherits','prototype','sendRequest','command','answer','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','format','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events'];(function(_0x59dd83,_0x573f1b){var _0x5dd0de=function(_0x1c805d){while(--_0x1c805d){_0x59dd83['push'](_0x59dd83['shift']());}};_0x5dd0de(++_0x573f1b);}(_0xb2b4,0x141));var _0x4b2b=function(_0x3df1e9,_0x3cd30e){_0x3df1e9=_0x3df1e9-0x0;var _0xd6b371=_0xb2b4[_0x3df1e9];return _0xd6b371;};'use strict';var util=require(_0x4b2b('0x0'));var _=require(_0x4b2b('0x1'));var EventEmitter=require(_0x4b2b('0x2'))[_0x4b2b('0x3')];var AGIReply=require(_0x4b2b('0x4'));var AGIError=require('./error');function AGIChannel(_0x2ef324){var _0x357fe6=this,_0x545768=new AGIReply(),_0xb0d4f9=![],_0x99b3a9={};EventEmitter[_0x4b2b('0x5')](_0x357fe6);_0x2ef324[_0x4b2b('0x6')](_0x4b2b('0x7'));_0x2ef324[_0x4b2b('0x8')](0x8*0x3c*0x3c*0x3e8);_0x545768[_0x4b2b('0x6')]('utf8');_0x545768['on'](_0x4b2b('0x9'),function(_0x1c370e){for(var _0x4694b5 in _0x1c370e){_0x357fe6[_0x4694b5]=_0x1c370e[_0x4694b5];}_0x357fe6['emit'](_0x4b2b('0xa'));});_0x545768['on'](_0x4b2b('0xb'),function(_0x330ece){if(_0x330ece[_0x4b2b('0xc')]()==_0x4b2b('0xd')){_0x357fe6[_0x4b2b('0xe')]('hangup');return;}if(_0x330ece[_0x4b2b('0xf')](0x0,0xb)==_0x4b2b('0x10')){_0xb0d4f9=!![];}if(_0xb0d4f9){_0x99b3a9['rx']+=_0x330ece+'\x0a';if(_0x330ece[_0x4b2b('0x11')](_0x4b2b('0x12'))!=-0x1){_0xb0d4f9=![];}}else{_0x99b3a9['rx']=_0x330ece;}if(_0xb0d4f9){return;}if(typeof _0x99b3a9['cb']=='function'){var _0x13f26c=_0x99b3a9['rx']['substring'](0x0,0x3),_0xb9919b=null,_0x3ec3a7=null;_0x13f26c=parseInt(_0x13f26c);if(isNaN(_0x13f26c)){_0x99b3a9['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4b2b('0x13')});return;}if(_0x13f26c!=0xc8){_0x99b3a9['cb'](null,{'code':_0x13f26c,'result':-0x1,'extra':'KO'});return;}_0xb9919b=_0x99b3a9['rx']['substring'](0x4)[_0x4b2b('0x14')](_0x4b2b('0x15'),'');if(_0xb9919b[_0x4b2b('0x16')]('\x20')!=-0x1){_0xb9919b=_0xb9919b[_0x4b2b('0x17')](0x0,_0xb9919b[_0x4b2b('0x16')]('\x20'));}if(_[_0x4b2b('0x18')](_0xb9919b,'-1')){_0xb9919b=parseInt(_0xb9919b);}_0x3ec3a7=_0x99b3a9['rx']['split']('\x20');if(_0x3ec3a7[_0x4b2b('0x19')]==0x3){_0x3ec3a7=_0x3ec3a7[0x2][_0x4b2b('0xf')](0x1,_0x3ec3a7[0x2][_0x4b2b('0x19')]-0x1);}else if(_0x3ec3a7[_0x4b2b('0x19')]>0x3){var _0x1876b0=/\((.+)\)/;var _0x18611d=_0x99b3a9['rx']['match'](_0x1876b0);if(_0x18611d){_0x3ec3a7=_0x18611d[0x1];}else{_0x3ec3a7=null;}}else{_0x3ec3a7=null;}_0x99b3a9['cb'](null,{'code':_0x13f26c,'result':_0xb9919b,'extra':_0x3ec3a7});}});_0x2ef324['on'](_0x4b2b('0x1a'),function(_0x42e656){_0x357fe6[_0x4b2b('0xe')](_0x4b2b('0x1a'),new AGIError(_0x4b2b('0x1b'),_0x42e656[_0x4b2b('0x1c')]));});_0x2ef324['on'](_0x4b2b('0x1d'),function(){_0x357fe6[_0x4b2b('0xe')](_0x4b2b('0x1d'),new AGIError(_0x4b2b('0x1e')));});_0x2ef324['on']('timeout',function(){_0x357fe6[_0x4b2b('0xe')]('timeout',new AGIError(_0x4b2b('0x1f')));_0x2ef324[_0x4b2b('0x20')]();});_0x2ef324[_0x4b2b('0x21')](_0x545768);this['command']=function(_0xd06fd2,_0x585850){var _0xd06fd2=_0xd06fd2||'',_0x585850=typeof _0x585850==_0x4b2b('0x22')?_0x585850:new Function();_0x99b3a9={'tx':_0xd06fd2,'rx':'','cb':_0x585850};_0x2ef324['write'](_0xd06fd2+'\x0a');},this[_0x4b2b('0x1d')]=function(){_0x2ef324[_0x4b2b('0x20')]();};}util[_0x4b2b('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x4b2b('0x24')][_0x4b2b('0x25')]=function(_0x2e1720){return this[_0x4b2b('0x26')]['sync'](this,_0x2e1720);};AGIChannel[_0x4b2b('0x24')][_0x4b2b('0x27')]=function(){return this[_0x4b2b('0x25')]('ANSWER');};AGIChannel[_0x4b2b('0x24')][_0x4b2b('0x28')]=function(_0x2d2485,_0x2a77fa,_0x53be4e){_0x2d2485=_0x2d2485===undefined?_0x4b2b('0x29'):_0x2d2485;_0x2a77fa=_0x2a77fa===undefined?'5':_0x2a77fa;_0x53be4e=_0x53be4e===undefined?'1':_0x53be4e;return this['sendRequest'](util['format'](_0x4b2b('0x2a'),_0x2d2485,_0x2a77fa*0x3e8,_0x53be4e));};AGIChannel[_0x4b2b('0x24')]['noop']=function(_0x1fba36){_0x1fba36=_0x1fba36||_0x4b2b('0x2b');return this[_0x4b2b('0x25')](util[_0x4b2b('0x2c')](_0x4b2b('0x2d'),_0x1fba36));};AGIChannel['prototype'][_0x4b2b('0x2e')]=function(_0x6d4654,_0x3eed02){if(_[_0x4b2b('0x2f')](_0x3eed02)){return this[_0x4b2b('0x25')](util[_0x4b2b('0x2c')]('EXEC\x20%s\x20%s',_0x6d4654,_0x3eed02[_0x4b2b('0x30')](',')));}return this[_0x4b2b('0x25')](util[_0x4b2b('0x2c')](_0x4b2b('0x31'),_0x6d4654,_0x3eed02));};AGIChannel[_0x4b2b('0x24')][_0x4b2b('0x32')]=function(_0x4cd550){return this[_0x4b2b('0x25')](util[_0x4b2b('0x2c')](_0x4b2b('0x33'),_0x4cd550));};AGIChannel[_0x4b2b('0x24')][_0x4b2b('0x34')]=function(_0x1327be){return this[_0x4b2b('0x25')](util['format'](_0x4b2b('0x35'),_0x1327be));};AGIChannel[_0x4b2b('0x24')][_0x4b2b('0x36')]=function(_0x3a68ca){return this[_0x4b2b('0x25')](util['format'](_0x4b2b('0x37'),_0x3a68ca));};AGIChannel[_0x4b2b('0x24')][_0x4b2b('0xd')]=function(){return this[_0x4b2b('0x25')](_0x4b2b('0x38'));};AGIChannel[_0x4b2b('0x24')]['setVariable']=function(_0x58c77e,_0x43f540){var _0x13ab40=_['isBoolean'](_0x43f540)||_[_0x4b2b('0x39')](_0x43f540)?_0x43f540['toString']():_0x43f540;return this[_0x4b2b('0x25')](util[_0x4b2b('0x2c')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x58c77e,_0x13ab40?_0x13ab40[_0x4b2b('0x3a')]()[_0x4b2b('0x14')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4b2b('0x24')][_0x4b2b('0x3b')]=function(_0x4d9e7c,_0x590c60){return this[_0x4b2b('0x25')](util[_0x4b2b('0x2c')](_0x4b2b('0x3c'),_0x4d9e7c,_0x590c60));};AGIChannel['prototype'][_0x4b2b('0x3d')]=function(_0x361910,_0x3e1b50){return this[_0x4b2b('0x25')](util['format'](_0x4b2b('0x3e'),_0x361910,_0x3e1b50));};AGIChannel[_0x4b2b('0x24')][_0x4b2b('0x3f')]=function(_0x5aa464,_0x572c7f){return this['sendRequest'](util[_0x4b2b('0x2c')](_0x4b2b('0x40'),_0x5aa464,_0x572c7f));};AGIChannel[_0x4b2b('0x24')]['continueAt']=function(_0x3a8aad,_0x48279e,_0xbfcdec){_0x48279e=_0x48279e||this[_0x4b2b('0x41')];_0xbfcdec=_0xbfcdec||0x1;this[_0x4b2b('0x32')](_0x3a8aad);this['setExtension'](_0x48279e);this['setPriority'](_0xbfcdec);return this[_0x4b2b('0x42')](util[_0x4b2b('0x2c')](_0x4b2b('0x43'),_0x3a8aad,_0x48279e,_0xbfcdec));};AGIChannel[_0x4b2b('0x24')][_0x4b2b('0x44')]=function(_0x2d8d99){return this[_0x4b2b('0x25')](util['format'](_0x4b2b('0x45'),_0x2d8d99));};AGIChannel[_0x4b2b('0x24')][_0x4b2b('0x46')]=function(_0x422cec,_0x591b97,_0x2a5a42,_0x54dc3f,_0x157fab,_0x44a08c){_0x591b97=_0x591b97||'wav';_0x2a5a42=_0x2a5a42||'';_0x54dc3f=_0x54dc3f===undefined?-0x1:_0x54dc3f==='-1'?-0x1:_0x54dc3f*0x3e8;_0x157fab=_0x157fab===undefined?'':'s='+_0x157fab;_0x44a08c=_0x44a08c?_0x4b2b('0x47'):'';return this[_0x4b2b('0x25')](util['format'](_0x4b2b('0x48'),_0x422cec,_0x591b97,_0x2a5a42,_0x54dc3f,_0x44a08c,_0x157fab));};AGIChannel[_0x4b2b('0x24')][_0x4b2b('0x49')]=function(_0x3ea395,_0x30c06c){_0x30c06c=_0x30c06c||'';return this[_0x4b2b('0x25')](util['format'](_0x4b2b('0x4a'),_0x3ea395,_0x30c06c));};AGIChannel['prototype'][_0x4b2b('0x4b')]=function(_0x4f7699){return this[_0x4b2b('0x2e')](_0x4b2b('0x4c'),_0x4f7699);};AGIChannel[_0x4b2b('0x24')]['wait']=function(_0x2ec953){return this['exec'](_0x4b2b('0x4d'),_0x2ec953);};AGIChannel[_0x4b2b('0x24')][_0x4b2b('0x1a')]=function(_0x5934e3,_0x3df0d7){this[_0x4b2b('0x42')](util['format'](_0x4b2b('0x4e'),_0x5934e3['id'],_0x5934e3[_0x4b2b('0x4f')],_0x3df0d7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4b2b('0x50')]=AGIChannel; \ No newline at end of file +var _0x9cb3=['isNumber','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','label','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','result=','split','length','error','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','function','write','close','prototype','sendRequest','answer','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','isArray','format','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean'];(function(_0x235356,_0x523789){var _0x1ecede=function(_0x14ad63){while(--_0x14ad63){_0x235356['push'](_0x235356['shift']());}};_0x1ecede(++_0x523789);}(_0x9cb3,0x13f));var _0x39cb=function(_0xf7224d,_0x2b8c21){_0xf7224d=_0xf7224d-0x0;var _0x525740=_0x9cb3[_0xf7224d];return _0x525740;};'use strict';var util=require('util');var _=require(_0x39cb('0x0'));var EventEmitter=require(_0x39cb('0x1'))[_0x39cb('0x2')];var AGIReply=require(_0x39cb('0x3'));var AGIError=require(_0x39cb('0x4'));function AGIChannel(_0x1de8f6){var _0x51a1c6=this,_0x4bc90c=new AGIReply(),_0x1c6d00=![],_0xef9f69={};EventEmitter[_0x39cb('0x5')](_0x51a1c6);_0x1de8f6[_0x39cb('0x6')](_0x39cb('0x7'));_0x1de8f6[_0x39cb('0x8')](0x8*0x3c*0x3c*0x3e8);_0x4bc90c[_0x39cb('0x6')](_0x39cb('0x7'));_0x4bc90c['on'](_0x39cb('0x9'),function(_0x195e81){for(var _0x22ab8c in _0x195e81){_0x51a1c6[_0x22ab8c]=_0x195e81[_0x22ab8c];}_0x51a1c6[_0x39cb('0xa')](_0x39cb('0xb'));});_0x4bc90c['on'](_0x39cb('0xc'),function(_0x8439b9){if(_0x8439b9['toLowerCase']()==_0x39cb('0xd')){_0x51a1c6['emit']('hangup');return;}if(_0x8439b9[_0x39cb('0xe')](0x0,0xb)==_0x39cb('0xf')){_0x1c6d00=!![];}if(_0x1c6d00){_0xef9f69['rx']+=_0x8439b9+'\x0a';if(_0x8439b9[_0x39cb('0x10')](_0x39cb('0x11'))!=-0x1){_0x1c6d00=![];}}else{_0xef9f69['rx']=_0x8439b9;}if(_0x1c6d00){return;}if(typeof _0xef9f69['cb']=='function'){var _0x136581=_0xef9f69['rx']['substring'](0x0,0x3),_0x3515c0=null,_0x5efce2=null;_0x136581=parseInt(_0x136581);if(isNaN(_0x136581)){_0xef9f69['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x39cb('0x12')});return;}if(_0x136581!=0xc8){_0xef9f69['cb'](null,{'code':_0x136581,'result':-0x1,'extra':'KO'});return;}_0x3515c0=_0xef9f69['rx'][_0x39cb('0xe')](0x4)['replace'](_0x39cb('0x13'),'');if(_0x3515c0['indexOf']('\x20')!=-0x1){_0x3515c0=_0x3515c0['substr'](0x0,_0x3515c0['indexOf']('\x20'));}if(_['startsWith'](_0x3515c0,'-1')){_0x3515c0=parseInt(_0x3515c0);}_0x5efce2=_0xef9f69['rx'][_0x39cb('0x14')]('\x20');if(_0x5efce2[_0x39cb('0x15')]==0x3){_0x5efce2=_0x5efce2[0x2][_0x39cb('0xe')](0x1,_0x5efce2[0x2][_0x39cb('0x15')]-0x1);}else if(_0x5efce2['length']>0x3){var _0x23c0f2=/\((.+)\)/;var _0x27dbd9=_0xef9f69['rx']['match'](_0x23c0f2);if(_0x27dbd9){_0x5efce2=_0x27dbd9[0x1];}else{_0x5efce2=null;}}else{_0x5efce2=null;}_0xef9f69['cb'](null,{'code':_0x136581,'result':_0x3515c0,'extra':_0x5efce2});}});_0x1de8f6['on'](_0x39cb('0x16'),function(_0x5aaf16){_0x51a1c6[_0x39cb('0xa')](_0x39cb('0x16'),new AGIError('E_AGI_SOCKET_ERROR',_0x5aaf16['code']));});_0x1de8f6['on']('close',function(){_0x51a1c6[_0x39cb('0xa')]('close',new AGIError(_0x39cb('0x17')));});_0x1de8f6['on'](_0x39cb('0x18'),function(){_0x51a1c6['emit']('timeout',new AGIError(_0x39cb('0x19')));_0x1de8f6[_0x39cb('0x1a')]();});_0x1de8f6['pipe'](_0x4bc90c);this[_0x39cb('0x1b')]=function(_0x140d5c,_0x49d241){var _0x140d5c=_0x140d5c||'',_0x49d241=typeof _0x49d241==_0x39cb('0x1c')?_0x49d241:new Function();_0xef9f69={'tx':_0x140d5c,'rx':'','cb':_0x49d241};_0x1de8f6[_0x39cb('0x1d')](_0x140d5c+'\x0a');},this[_0x39cb('0x1e')]=function(){_0x1de8f6[_0x39cb('0x1a')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0x39cb('0x1f')][_0x39cb('0x20')]=function(_0x2c0c55){return this['command']['sync'](this,_0x2c0c55);};AGIChannel[_0x39cb('0x1f')][_0x39cb('0x21')]=function(){return this['sendRequest'](_0x39cb('0x22'));};AGIChannel[_0x39cb('0x1f')][_0x39cb('0x23')]=function(_0x56ffeb,_0x4ed78f,_0x2ced17){_0x56ffeb=_0x56ffeb===undefined?'beep':_0x56ffeb;_0x4ed78f=_0x4ed78f===undefined?'5':_0x4ed78f;_0x2ced17=_0x2ced17===undefined?'1':_0x2ced17;return this[_0x39cb('0x20')](util['format'](_0x39cb('0x24'),_0x56ffeb,_0x4ed78f*0x3e8,_0x2ced17));};AGIChannel[_0x39cb('0x1f')][_0x39cb('0x25')]=function(_0x2c11d0){_0x2c11d0=_0x2c11d0||'NO\x20MESSAGE';return this[_0x39cb('0x20')](util['format']('VERBOSE\x20\x22%s\x22',_0x2c11d0));};AGIChannel[_0x39cb('0x1f')]['exec']=function(_0x357fee,_0x50f6ed){if(_[_0x39cb('0x26')](_0x50f6ed)){return this['sendRequest'](util[_0x39cb('0x27')](_0x39cb('0x28'),_0x357fee,_0x50f6ed[_0x39cb('0x29')](',')));}return this[_0x39cb('0x20')](util[_0x39cb('0x27')](_0x39cb('0x28'),_0x357fee,_0x50f6ed));};AGIChannel[_0x39cb('0x1f')][_0x39cb('0x2a')]=function(_0x4661d5){return this[_0x39cb('0x20')](util[_0x39cb('0x27')](_0x39cb('0x2b'),_0x4661d5));};AGIChannel['prototype'][_0x39cb('0x2c')]=function(_0x5599c2){return this['sendRequest'](util[_0x39cb('0x27')](_0x39cb('0x2d'),_0x5599c2));};AGIChannel[_0x39cb('0x1f')][_0x39cb('0x2e')]=function(_0x49fb97){return this[_0x39cb('0x20')](util[_0x39cb('0x27')](_0x39cb('0x2f'),_0x49fb97));};AGIChannel[_0x39cb('0x1f')]['hangup']=function(){return this['sendRequest'](_0x39cb('0x30'));};AGIChannel[_0x39cb('0x1f')][_0x39cb('0x31')]=function(_0x4a6922,_0x1af734){var _0x4cfdd6=_[_0x39cb('0x32')](_0x1af734)||_[_0x39cb('0x33')](_0x1af734)?_0x1af734[_0x39cb('0x34')]():_0x1af734;return this[_0x39cb('0x20')](util[_0x39cb('0x27')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x4a6922,_0x4cfdd6?_0x4cfdd6['toString']()[_0x39cb('0x35')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x39cb('0x1f')][_0x39cb('0x36')]=function(_0x3608ae,_0x4fdf40){return this['sendRequest'](util[_0x39cb('0x27')](_0x39cb('0x37'),_0x3608ae,_0x4fdf40));};AGIChannel[_0x39cb('0x1f')]['sayDigits']=function(_0x37127a,_0x5b6b7e){return this[_0x39cb('0x20')](util[_0x39cb('0x27')](_0x39cb('0x38'),_0x37127a,_0x5b6b7e));};AGIChannel[_0x39cb('0x1f')][_0x39cb('0x39')]=function(_0x23e13f,_0xc07d6e){return this[_0x39cb('0x20')](util[_0x39cb('0x27')](_0x39cb('0x3a'),_0x23e13f,_0xc07d6e));};AGIChannel[_0x39cb('0x1f')][_0x39cb('0x3b')]=function(_0x5a7478,_0xc1eca,_0x5449bb){_0xc1eca=_0xc1eca||this['extension'];_0x5449bb=_0x5449bb||0x1;this[_0x39cb('0x2a')](_0x5a7478);this[_0x39cb('0x2c')](_0xc1eca);this['setPriority'](_0x5449bb);return this[_0x39cb('0x25')](util[_0x39cb('0x27')]('GOTO\x20%s\x20%s\x20%s',_0x5a7478,_0xc1eca,_0x5449bb));};AGIChannel[_0x39cb('0x1f')][_0x39cb('0x3c')]=function(_0x363a90){return this['sendRequest'](util[_0x39cb('0x27')](_0x39cb('0x3d'),_0x363a90));};AGIChannel[_0x39cb('0x1f')][_0x39cb('0x3e')]=function(_0x4a51f6,_0x32ddb6,_0x511e35,_0x53f02f,_0x11efc7,_0x2b7fad){_0x32ddb6=_0x32ddb6||_0x39cb('0x3f');_0x511e35=_0x511e35||'';_0x53f02f=_0x53f02f===undefined?-0x1:_0x53f02f==='-1'?-0x1:_0x53f02f*0x3e8;_0x11efc7=_0x11efc7===undefined?'':'s='+_0x11efc7;_0x2b7fad=_0x2b7fad?'BEEP':'';return this[_0x39cb('0x20')](util['format'](_0x39cb('0x40'),_0x4a51f6,_0x32ddb6,_0x511e35,_0x53f02f,_0x2b7fad,_0x11efc7));};AGIChannel[_0x39cb('0x1f')][_0x39cb('0x41')]=function(_0x288fd1,_0x49209b){_0x49209b=_0x49209b||'';return this[_0x39cb('0x20')](util[_0x39cb('0x27')](_0x39cb('0x42'),_0x288fd1,_0x49209b));};AGIChannel[_0x39cb('0x1f')][_0x39cb('0x43')]=function(_0x129d64){return this[_0x39cb('0x44')](_0x39cb('0x45'),_0x129d64);};AGIChannel[_0x39cb('0x1f')][_0x39cb('0x46')]=function(_0x2a857d){return this[_0x39cb('0x44')](_0x39cb('0x47'),_0x2a857d);};AGIChannel['prototype'][_0x39cb('0x16')]=function(_0x37dc61,_0x3e9523){this[_0x39cb('0x25')](util['format']('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x37dc61['id'],_0x37dc61[_0x39cb('0x48')],_0x3e9523));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x39cb('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 443474a..9080ba4 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 _0xa4a5=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','exports','util'];(function(_0x2ad50c,_0x43e2b7){var _0x2644e3=function(_0x4791e6){while(--_0x4791e6){_0x2ad50c['push'](_0x2ad50c['shift']());}};_0x2644e3(++_0x43e2b7);}(_0xa4a5,0x6f));var _0x5a4a=function(_0x24380e,_0x41a149){_0x24380e=_0x24380e-0x0;var _0x3ec87c=_0xa4a5[_0x24380e];return _0x3ec87c;};'use strict';var util=require(_0x5a4a('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x5a4a('0x1'),'E_AGI_SERVER_ERROR':_0x5a4a('0x2'),'E_AGI_SERVER_CLOSE':_0x5a4a('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x5a4a('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x5a4a('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x5a4a('0x6'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x5a4a('0x7')};function AGIError(_0xc5355a){var _0xc5355a=_0xc5355a||null,_0x1cb494=_0x1cb494||[],_0x55dcad=0x1,_0x3cd00e='';if(!error[_0xc5355a]){_0xc5355a=_0x5a4a('0x8');}_0x1cb494['push'](error[_0xc5355a]);while(arguments[_0x55dcad]){_0x1cb494[_0x5a4a('0x9')](arguments[_0x55dcad]);_0x55dcad++;}_0x3cd00e=util[_0x5a4a('0xa')]['apply'](util,_0x1cb494);this[_0x5a4a('0xb')]=_0x3cd00e;this[_0x5a4a('0xc')]=_0xc5355a;}module[_0x5a4a('0xd')]=AGIError; \ No newline at end of file +var _0x3040=['Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x4e26dd,_0x35c47c){var _0x56cab2=function(_0x34f563){while(--_0x34f563){_0x4e26dd['push'](_0x4e26dd['shift']());}};_0x56cab2(++_0x35c47c);}(_0x3040,0x1e3));var _0x0304=function(_0x17132b,_0xfb8fce){_0x17132b=_0x17132b-0x0;var _0x51b29d=_0x3040[_0x17132b];return _0x51b29d;};'use strict';var util=require(_0x0304('0x0'));var error={'E_AGI_UNDEFINED':_0x0304('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x0304('0x2'),'E_AGI_SERVER_CLOSE':_0x0304('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x0304('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x0304('0x5'),'E_AGI_SOCKET_ERROR':_0x0304('0x6'),'E_AGI_SOCKET_CLOSE':_0x0304('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x0304('0x8'),'E_AGI_COMMAND_EMPTY':_0x0304('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x0304('0xa')};function AGIError(_0x440f95){var _0x440f95=_0x440f95||null,_0x333d1d=_0x333d1d||[],_0x196642=0x1,_0x3e5313='';if(!error[_0x440f95]){_0x440f95='E_AGI_UNDEFINED';}_0x333d1d[_0x0304('0xb')](error[_0x440f95]);while(arguments[_0x196642]){_0x333d1d['push'](arguments[_0x196642]);_0x196642++;}_0x3e5313=util[_0x0304('0xc')][_0x0304('0xd')](util,_0x333d1d);this[_0x0304('0xe')]=_0x3e5313;this[_0x0304('0xf')]=_0x440f95;}module[_0x0304('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index f3e6dd3..c2395b4 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 _0x35a0=['addVertex','addEdge','size','relations','numberOfEdges','getVertex','traverseBFS','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','default','target','menu','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','agi','getsecretdigits','vertices','edges','prototype'];(function(_0x2682cf,_0x220516){var _0x42648b=function(_0x2e2da3){while(--_0x2e2da3){_0x2682cf['push'](_0x2682cf['shift']());}};_0x42648b(++_0x220516);}(_0x35a0,0xff));var _0x035a=function(_0x15d30e,_0x25af60){_0x15d30e=_0x15d30e-0x0;var _0x30c105=_0x35a0[_0x15d30e];return _0x30c105;};'use strict';var _=require(_0x035a('0x0'));var logger=require('../../../config/logger')(_0x035a('0x1'));var verticesWithRetry=['menu','getdigits',_0x035a('0x2')];var Graph=function(){this[_0x035a('0x3')]={};this[_0x035a('0x4')]={};this['numberOfEdges']=0x0;};Graph[_0x035a('0x5')][_0x035a('0x6')]=function(_0x4a59b9){this[_0x035a('0x3')][_0x4a59b9['id']]=_0x4a59b9;this['edges'][_0x4a59b9['id']]=[];};Graph['prototype'][_0x035a('0x7')]=function(_0x4146a5,_0x45a505,_0x29ee7b){this[_0x035a('0x4')][_0x4146a5]['push']({'target':_0x45a505,'condition':_0x29ee7b});this['numberOfEdges']+=0x1;};Graph['prototype'][_0x035a('0x8')]=function(){return _[_0x035a('0x8')](this[_0x035a('0x3')]);};Graph['prototype'][_0x035a('0x9')]=function(){return this[_0x035a('0xa')];};Graph[_0x035a('0x5')][_0x035a('0xb')]=function(_0x3d34dc){return this['vertices'][_0x3d34dc];};Graph['prototype'][_0x035a('0xc')]=function(_0x19833c,_0x6ac4d4){if(!this[_0x035a('0x3')][_0x19833c]){return logger[_0x035a('0xd')]('no\x20vertex\x20found');}var _0x5bb44a=_0x6ac4d4(this['vertices'][_0x19833c]);if(!_0x5bb44a){return logger[_0x035a('0xd')](_0x035a('0xe'));}if(this['edges'][_0x19833c][_0x035a('0xf')]===0x0){return logger['info'](_0x035a('0x10'));}for(var _0x425701=0x0,_0x4e3fe4=[],_0x57e1d6=![];_0x425701\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','evtHangup','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry','retry','addVertex','isArray','length','source','target','addEdge','catch','createSquareReport','then','indexOf','agi_','substring','inspect','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','sync','production','start','debug','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','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','isUndefined','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','extension','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','xml2json','lodash','util','moment','../../config/environment','../../config/logger','agi'];(function(_0x3ee05f,_0x534055){var _0x5b8098=function(_0x5e848b){while(--_0x5e848b){_0x3ee05f['push'](_0x3ee05f['shift']());}};_0x5b8098(++_0x534055);}(_0x2d41,0x169));var _0x12d4=function(_0x38da64,_0xb03f80){_0x38da64=_0x38da64-0x0;var _0x5e4636=_0x2d41[_0x38da64];return _0x5e4636;};'use strict';var parser=require(_0x12d4('0x0'));var _=require(_0x12d4('0x1'));var syncho=require('syncho');var util=require(_0x12d4('0x2'));var moment=require(_0x12d4('0x3'));var config=require(_0x12d4('0x4'));var logger=require(_0x12d4('0x5'))(_0x12d4('0x6'));var utilLicense=require(_0x12d4('0x7'));var rpc=require(_0x12d4('0x8'));var mailRpc=require(_0x12d4('0x9'));var Graph=require(_0x12d4('0xa'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x12d4('0x6')]=_['defaults'](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x5921a9){process[_0x12d4('0xb')](function(){syncho(function(){try{setChannelVariables(_0x5921a9);agiHandler(_0x5921a9);}catch(_0x350366){logger['error'](_0x350366[_0x12d4('0xc')]);}});});}function listeningHandler(){console[_0x12d4('0xd')](_0x12d4('0xe'),config[_0x12d4('0x6')][_0x12d4('0xf')]);logger['info'](util[_0x12d4('0x10')](_0x12d4('0x11'),config['agi']['ip'],config[_0x12d4('0x6')][_0x12d4('0xf')]));}function errorHandler(_0x22041f){if(_0x22041f&&_0x22041f[_0x12d4('0x12')]&&_0x22041f[_0x12d4('0x13')]){logger[_0x12d4('0x14')](util['format'](_0x12d4('0x15'),_0x22041f[_0x12d4('0x12')],_0x22041f[_0x12d4('0x13')]));}else{logger[_0x12d4('0x14')](util['format'](_0x12d4('0x16'),_0x22041f[_0x12d4('0xc')]));}}function closeHandler(){logger[_0x12d4('0x17')](util[_0x12d4('0x10')](_0x12d4('0x18'),this['arg_1'],this['calleridname'],this[_0x12d4('0x19')],this[_0x12d4('0x1a')],this[_0x12d4('0x1b')]));try{createSquareReport(this);}catch(_0xe1f4f8){logger[_0x12d4('0x14')](_0xe1f4f8[_0x12d4('0xc')]);}}function timeoutHandler(){logger[_0x12d4('0x17')](util[_0x12d4('0x10')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0x12d4('0x1c')],this['callerid'],this[_0x12d4('0x1a')],this[_0x12d4('0x1b')]));}function hangupHandler(){logger['info'](util[_0x12d4('0x10')](_0x12d4('0x1d'),this[_0x12d4('0x1e')],this[_0x12d4('0x1c')],this['callerid'],this[_0x12d4('0x1a')],this[_0x12d4('0x1b')]));this[_0x12d4('0x1f')]=!![];}function getRoot(_0x3a595d){return parser['toJson'](_0x3a595d,{'object':!![]})[_0x12d4('0x20')][_0x12d4('0x21')];}function addVertex(_0x380913,_0x5715d1,_0x21c1aa){_0x5715d1[_0x12d4('0x22')]=_0x21c1aa;if(_0x5715d1[_0x12d4('0x23')]('retry')){_0x5715d1[_0x12d4('0x24')]=parseInt(_0x5715d1[_0x12d4('0x25')],0xa);}_0x380913[_0x12d4('0x26')](_['omit'](_0x5715d1,'mxCell'));}function initGraph(_0x375f69,_0x4cc95a){var _0x1ae6b5=new Graph();for(var _0x34a39d in _0x375f69){if(_0x375f69[_0x12d4('0x23')](_0x34a39d)){if(_[_0x12d4('0x27')](_0x375f69[_0x34a39d])){for(var _0x1f9984=0x0;_0x1f9984<_0x375f69[_0x34a39d][_0x12d4('0x28')];_0x1f9984+=0x1){addVertex(_0x1ae6b5,_0x375f69[_0x34a39d][_0x1f9984],_0x34a39d);}}else{addVertex(_0x1ae6b5,_0x375f69[_0x34a39d],_0x34a39d);}}}for(var _0x3d9ee2=0x0;_0x3d9ee2<_0x4cc95a[_0x12d4('0x28')];_0x3d9ee2+=0x1){if(_0x4cc95a[_0x3d9ee2][_0x12d4('0x29')]&&_0x4cc95a[_0x3d9ee2][_0x12d4('0x2a')]){_0x1ae6b5[_0x12d4('0x2b')](_0x4cc95a[_0x3d9ee2][_0x12d4('0x29')],_0x4cc95a[_0x3d9ee2][_0x12d4('0x2a')],_0x4cc95a[_0x3d9ee2]['value']);}}return _0x1ae6b5;}function getSquareProject(_0x561cdd,_0x437b00){rpc['getSquareProject'](_0x561cdd)['then'](function(_0x52332c){_0x437b00(null,_0x52332c);})[_0x12d4('0x2c')](function(_0x549b26){_0x437b00(null,_0x549b26);});}function createSquareReport(_0xc54168,_0x47a5d8){rpc[_0x12d4('0x2d')](_0xc54168)[_0x12d4('0x2e')](function(_0xa04dd5){if(_0x47a5d8){_0x47a5d8(null,_0xa04dd5);}})['catch'](function(_0x5e0669){if(_0x47a5d8){_0x47a5d8(null,_0x5e0669);}});}function setChannelVariables(_0x43aaf9){for(var _0x477723 in _0x43aaf9){if(_0x43aaf9[_0x12d4('0x23')](_0x477723)){if(_0x477723[_0x12d4('0x2f')](_0x12d4('0x30'))===0x0){_0x43aaf9[_0x477723[_0x12d4('0x31')](0x4)]=_0x43aaf9[_0x477723];delete _0x43aaf9[_0x477723];}}}}function getLogFromObject(_0x51df21){return util[_0x12d4('0x32')](_0x51df21,{'showHidden':![],'depth':null});}function agiHandler(_0x22457e){var _0xdd2fff,_0x22665c,_0x309ce4,_0x431bff,_0x4aa4ec;logger['debug'](_0x12d4('0x33'),JSON[_0x12d4('0x34')](_0x22457e,null,0x2));logger['info'](util[_0x12d4('0x10')](_0x12d4('0x35'),_0x22457e['arg_1'],_0x22457e['calleridname'],_0x22457e[_0x12d4('0x19')],_0x22457e[_0x12d4('0x1a')],_0x22457e['uniqueid']));_0x22457e['on'](_0x12d4('0x14'),errorHandler);_0x22457e['on'](_0x12d4('0x36'),closeHandler);_0x22457e['on'](_0x12d4('0x37'),timeoutHandler);_0x22457e[_0x12d4('0x1f')]=![];_0x22457e['on'](_0x12d4('0x38'),hangupHandler);var _0x55c762=getSquareProject[_0x12d4('0x39')](null,_0x22457e[_0x12d4('0x1e')]);if(_0x55c762){if(_0x55c762[_0x12d4('0x3a')]){_0xdd2fff=getRoot(_0x55c762[_0x12d4('0x3a')]);if(_0xdd2fff&&_0xdd2fff[_0x12d4('0x3b')]){logger[_0x12d4('0x3c')](_0x12d4('0x21'),JSON[_0x12d4('0x34')](_0xdd2fff,null,0x2));_0x22457e['joinAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x22665c=initGraph(_['omit'](_0xdd2fff,_0x12d4('0x3d')),_0xdd2fff[_0x12d4('0x3d')]);_0x309ce4=new Vertices(_0x22457e,rpc,mailRpc);logger[_0x12d4('0x17')](util[_0x12d4('0x10')](_0x12d4('0x3e'),_0x22457e[_0x12d4('0x1e')],_0x22457e['calleridname'],_0x22457e[_0x12d4('0x19')],_0x22457e[_0x12d4('0x1a')],_0x22457e[_0x12d4('0x1b')]));_0x22665c[_0x12d4('0x3f')](_0xdd2fff['start']['id'],function(_0x1d89e9){try{_0x1d89e9=_0x309ce4[_0x12d4('0x40')](_0x1d89e9);logger[_0x12d4('0x3c')](_0x12d4('0x41'),JSON[_0x12d4('0x34')](_0x1d89e9,null,0x2));if(_0x1d89e9[_0x12d4('0x22')]===_0x12d4('0x42')){logger['info'](_0x12d4('0x43'));_0x22457e[_0x12d4('0x44')]=_0x1d89e9[_0x12d4('0x44')]||_0x22457e[_0x12d4('0x44')];_0x22457e['extension']=_0x1d89e9['extension'];_0x22457e[_0x12d4('0x45')]=_0x1d89e9[_0x12d4('0x45')]?_0x1d89e9['priority']-0x1:0x1;return null;}else if(_0x1d89e9&&_0x309ce4[_0x1d89e9[_0x12d4('0x22')]]){_0x4aa4ec=_0x309ce4[_0x1d89e9[_0x12d4('0x22')]](_0x1d89e9);logger[_0x12d4('0x17')](_0x12d4('0x46'),JSON[_0x12d4('0x34')](_0x4aa4ec,null,0x2));if(_0x4aa4ec&&_0x4aa4ec[_0x12d4('0x47')]===AGI_CODE_SUCCESS&&_0x4aa4ec[_0x12d4('0x48')]!==AGI_RESULT_ERROR&&!_0x22457e[_0x12d4('0x1f')]){logger[_0x12d4('0x3c')]('response',getLogFromObject(_0x4aa4ec));return _['isUndefined'](_0x4aa4ec[_0x12d4('0x48')])?null:_0x4aa4ec['result'][_0x12d4('0x49')]();}else{logger[_0x12d4('0x14')](_0x12d4('0x46'),getLogFromObject(_0x4aa4ec));return null;}}else{logger[_0x12d4('0x14')](_0x12d4('0x4a'));return null;}}catch(_0x1fa88d){logger['error'](_0x1fa88d['stack']);return null;}});if(_0xdd2fff[_0x12d4('0x4b')]){logger[_0x12d4('0x17')](util['format'](_0x12d4('0x4c'),_0x22457e[_0x12d4('0x1e')],_0x22457e[_0x12d4('0x1c')],_0x22457e['callerid'],_0x22457e[_0x12d4('0x1a')],_0x22457e[_0x12d4('0x1b')]));_0x22665c['traverseBFS'](_0xdd2fff[_0x12d4('0x4b')]['id'],function(_0x4e5dd8){try{_0x4e5dd8=_0x309ce4[_0x12d4('0x40')](_0x4e5dd8);logger[_0x12d4('0x3c')]('vertex',JSON[_0x12d4('0x34')](_0x4e5dd8,null,0x2));if(_0x4e5dd8&&_0x309ce4[_0x4e5dd8[_0x12d4('0x22')]]){_0x4aa4ec=_0x309ce4[_0x4e5dd8['agicommand']](_0x4e5dd8);if(_0x4aa4ec){logger[_0x12d4('0x3c')](_0x12d4('0x46'),getLogFromObject(_0x4aa4ec));return _[_0x12d4('0x4d')](_0x4aa4ec[_0x12d4('0x48')])?null:_0x4aa4ec[_0x12d4('0x48')][_0x12d4('0x49')]();}else{logger[_0x12d4('0x14')](_0x12d4('0x46'),getLogFromObject(_0x4aa4ec));return null;}}else{logger[_0x12d4('0x14')]('agicommand\x20not\x20found');return null;}}catch(_0x348be7){logger[_0x12d4('0x14')](_0x348be7[_0x12d4('0xc')]);return null;}});}logger[_0x12d4('0x17')](util[_0x12d4('0x10')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x22457e[_0x12d4('0x1e')],_0x22457e[_0x12d4('0x1c')],_0x22457e[_0x12d4('0x19')],_0x22457e[_0x12d4('0x1a')],_0x22457e['uniqueid']));logger[_0x12d4('0x17')](util[_0x12d4('0x10')](_0x12d4('0x4e'),_0x22457e[_0x12d4('0x44')],_0x22457e[_0x12d4('0x4f')],parseInt(_0x22457e['priority'],0xa)+0x1));_0x22457e[_0x12d4('0x50')](_0x22457e[_0x12d4('0x44')],_0x22457e[_0x12d4('0x4f')],parseInt(_0x22457e['priority'],0xa)+0x1);_0x22457e[_0x12d4('0x36')]();}}else{logger[_0x12d4('0x14')](util[_0x12d4('0x10')](_0x12d4('0x51'),_0x22457e[_0x12d4('0x1e')]));_0x22457e[_0x12d4('0x50')](_0x22457e[_0x12d4('0x44')],_0x22457e[_0x12d4('0x4f')],parseInt(_0x22457e[_0x12d4('0x45')],0xa)+0x1);_0x22457e[_0x12d4('0x36')]();}}else{logger[_0x12d4('0x14')](util['format'](_0x12d4('0x52'),_0x22457e[_0x12d4('0x1e')]));_0x22457e[_0x12d4('0x50')](_0x22457e[_0x12d4('0x44')],_0x22457e['extension'],parseInt(_0x22457e[_0x12d4('0x45')],0xa)+0x1);_0x22457e[_0x12d4('0x36')]();}}function main(){var _0x1529a9;return utilLicense[_0x12d4('0x53')]()['then'](function(_0xc3e201){if(_0xc3e201){if(_0xc3e201[_0x12d4('0x54')]){if(_0xc3e201[_0x12d4('0x55')]&&_0xc3e201['callysquare']>0x0){logger[_0x12d4('0x17')](util[_0x12d4('0x10')](_0x12d4('0x56'),_0xc3e201[_0x12d4('0x55')]));_0x1529a9=_0xc3e201[_0x12d4('0x55')];}else{logger[_0x12d4('0x17')](_0x12d4('0x57'));}}else{logger[_0x12d4('0x17')](_0x12d4('0x58'));_0x1529a9=-0x1;}}})['catch'](function(_0x561698){logger[_0x12d4('0x14')](_0x12d4('0x59'),_0x561698[_0x12d4('0xc')]);})[_0x12d4('0x4b')](function(){var _0x38b8f8=require('./server')(config[_0x12d4('0x6')][_0x12d4('0xf')],config[_0x12d4('0x6')]['ip'],_0x1529a9);_0x38b8f8['on'](_0x12d4('0x14'),errorHandler);_0x38b8f8['on'](_0x12d4('0x5a'),listeningHandler);_0x38b8f8['on'](_0x12d4('0x5b'),connectionHandler);_0x38b8f8['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xb941=['retry','omit','mxCell','isArray','source','target','addEdge','getSquareProject','then','catch','createSquareReport','substring','inspect','variables','stringify','timeout','hangup','sync','production','start','debug','root','joinAt','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','continueAt','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','defaults','127.0.0.1','nextTick','error','stack','log','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[%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','calleridname','callerid','dnid','uniqueid','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','maxRetry'];(function(_0x32ded9,_0x214e92){var _0x234eb4=function(_0x13520e){while(--_0x13520e){_0x32ded9['push'](_0x32ded9['shift']());}};_0x234eb4(++_0x214e92);}(_0xb941,0x133));var _0x1b94=function(_0x39b8d0,_0x17f9a3){_0x39b8d0=_0x39b8d0-0x0;var _0x2cecce=_0xb941[_0x39b8d0];return _0x2cecce;};'use strict';var parser=require('xml2json');var _=require(_0x1b94('0x0'));var syncho=require(_0x1b94('0x1'));var util=require(_0x1b94('0x2'));var moment=require(_0x1b94('0x3'));var config=require(_0x1b94('0x4'));var logger=require(_0x1b94('0x5'))(_0x1b94('0x6'));var utilLicense=require(_0x1b94('0x7'));var rpc=require(_0x1b94('0x8'));var mailRpc=require(_0x1b94('0x9'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x1b94('0x6')]=_[_0x1b94('0xa')](config[_0x1b94('0x6')],{'ip':_0x1b94('0xb'),'port':0x11dd});function connectionHandler(_0x539051){process[_0x1b94('0xc')](function(){syncho(function(){try{setChannelVariables(_0x539051);agiHandler(_0x539051);}catch(_0x3f283c){logger[_0x1b94('0xd')](_0x3f283c[_0x1b94('0xe')]);}});});}function listeningHandler(){console[_0x1b94('0xf')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x1b94('0x6')][_0x1b94('0x10')]);logger[_0x1b94('0x11')](util['format'](_0x1b94('0x12'),config['agi']['ip'],config[_0x1b94('0x6')][_0x1b94('0x10')]));}function errorHandler(_0x1840e5){if(_0x1840e5&&_0x1840e5[_0x1b94('0x13')]&&_0x1840e5[_0x1b94('0x14')]){logger[_0x1b94('0xd')](util[_0x1b94('0x15')](_0x1b94('0x16'),_0x1840e5[_0x1b94('0x13')],_0x1840e5['message']));}else{logger['error'](util['format'](_0x1b94('0x17'),_0x1840e5[_0x1b94('0xe')]));}}function closeHandler(){logger[_0x1b94('0x11')](util[_0x1b94('0x15')](_0x1b94('0x18'),this['arg_1'],this[_0x1b94('0x19')],this[_0x1b94('0x1a')],this[_0x1b94('0x1b')],this[_0x1b94('0x1c')]));try{createSquareReport(this);}catch(_0x5d3497){logger[_0x1b94('0xd')](_0x5d3497['stack']);}}function timeoutHandler(){logger[_0x1b94('0x11')](util[_0x1b94('0x15')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x1b94('0x1d')],this[_0x1b94('0x19')],this['callerid'],this[_0x1b94('0x1b')],this[_0x1b94('0x1c')]));}function hangupHandler(){logger[_0x1b94('0x11')](util[_0x1b94('0x15')](_0x1b94('0x1e'),this[_0x1b94('0x1d')],this['calleridname'],this[_0x1b94('0x1a')],this[_0x1b94('0x1b')],this[_0x1b94('0x1c')]));this[_0x1b94('0x1f')]=!![];}function getRoot(_0x4eb950){return parser[_0x1b94('0x20')](_0x4eb950,{'object':!![]})[_0x1b94('0x21')]['root'];}function addVertex(_0x38c32a,_0x418a82,_0x3f20be){_0x418a82[_0x1b94('0x22')]=_0x3f20be;if(_0x418a82[_0x1b94('0x23')]('retry')){_0x418a82[_0x1b94('0x24')]=parseInt(_0x418a82[_0x1b94('0x25')],0xa);}_0x38c32a['addVertex'](_[_0x1b94('0x26')](_0x418a82,_0x1b94('0x27')));}function initGraph(_0x44c69e,_0x36f17b){var _0x42916c=new Graph();for(var _0x37ac72 in _0x44c69e){if(_0x44c69e[_0x1b94('0x23')](_0x37ac72)){if(_[_0x1b94('0x28')](_0x44c69e[_0x37ac72])){for(var _0x41b7c4=0x0;_0x41b7c4<_0x44c69e[_0x37ac72]['length'];_0x41b7c4+=0x1){addVertex(_0x42916c,_0x44c69e[_0x37ac72][_0x41b7c4],_0x37ac72);}}else{addVertex(_0x42916c,_0x44c69e[_0x37ac72],_0x37ac72);}}}for(var _0x55ad23=0x0;_0x55ad23<_0x36f17b['length'];_0x55ad23+=0x1){if(_0x36f17b[_0x55ad23][_0x1b94('0x29')]&&_0x36f17b[_0x55ad23][_0x1b94('0x2a')]){_0x42916c[_0x1b94('0x2b')](_0x36f17b[_0x55ad23][_0x1b94('0x29')],_0x36f17b[_0x55ad23][_0x1b94('0x2a')],_0x36f17b[_0x55ad23]['value']);}}return _0x42916c;}function getSquareProject(_0x526353,_0x2acf46){rpc[_0x1b94('0x2c')](_0x526353)[_0x1b94('0x2d')](function(_0x3b544d){_0x2acf46(null,_0x3b544d);})[_0x1b94('0x2e')](function(_0x4624c2){_0x2acf46(null,_0x4624c2);});}function createSquareReport(_0x15b7fa,_0x5073cc){rpc[_0x1b94('0x2f')](_0x15b7fa)[_0x1b94('0x2d')](function(_0x54ccec){if(_0x5073cc){_0x5073cc(null,_0x54ccec);}})[_0x1b94('0x2e')](function(_0x1e3dcf){if(_0x5073cc){_0x5073cc(null,_0x1e3dcf);}});}function setChannelVariables(_0xa0d6be){for(var _0x5f0f2d in _0xa0d6be){if(_0xa0d6be[_0x1b94('0x23')](_0x5f0f2d)){if(_0x5f0f2d['indexOf']('agi_')===0x0){_0xa0d6be[_0x5f0f2d[_0x1b94('0x30')](0x4)]=_0xa0d6be[_0x5f0f2d];delete _0xa0d6be[_0x5f0f2d];}}}}function getLogFromObject(_0x57ca07){return util[_0x1b94('0x31')](_0x57ca07,{'showHidden':![],'depth':null});}function agiHandler(_0xbe5850){var _0x118f01,_0x26852d,_0x2036d5,_0x1a0d3b,_0x4e13d0;logger['debug'](_0x1b94('0x32'),JSON[_0x1b94('0x33')](_0xbe5850,null,0x2));logger[_0x1b94('0x11')](util[_0x1b94('0x15')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xbe5850[_0x1b94('0x1d')],_0xbe5850[_0x1b94('0x19')],_0xbe5850[_0x1b94('0x1a')],_0xbe5850[_0x1b94('0x1b')],_0xbe5850[_0x1b94('0x1c')]));_0xbe5850['on'](_0x1b94('0xd'),errorHandler);_0xbe5850['on']('close',closeHandler);_0xbe5850['on'](_0x1b94('0x34'),timeoutHandler);_0xbe5850['evtHangup']=![];_0xbe5850['on'](_0x1b94('0x35'),hangupHandler);var _0x34145a=getSquareProject[_0x1b94('0x36')](null,_0xbe5850[_0x1b94('0x1d')]);if(_0x34145a){if(_0x34145a[_0x1b94('0x37')]){_0x118f01=getRoot(_0x34145a['production']);if(_0x118f01&&_0x118f01[_0x1b94('0x38')]){logger[_0x1b94('0x39')](_0x1b94('0x3a'),JSON[_0x1b94('0x33')](_0x118f01,null,0x2));_0xbe5850[_0x1b94('0x3b')]=moment()[_0x1b94('0x15')](_0x1b94('0x3c'));_0x26852d=initGraph(_['omit'](_0x118f01,_0x1b94('0x27')),_0x118f01['mxCell']);_0x2036d5=new Vertices(_0xbe5850,rpc,mailRpc);logger[_0x1b94('0x11')](util[_0x1b94('0x15')](_0x1b94('0x3d'),_0xbe5850[_0x1b94('0x1d')],_0xbe5850[_0x1b94('0x19')],_0xbe5850[_0x1b94('0x1a')],_0xbe5850['dnid'],_0xbe5850['uniqueid']));_0x26852d[_0x1b94('0x3e')](_0x118f01[_0x1b94('0x38')]['id'],function(_0x32f1b3){try{_0x32f1b3=_0x2036d5[_0x1b94('0x3f')](_0x32f1b3);logger['debug'](_0x1b94('0x40'),JSON['stringify'](_0x32f1b3,null,0x2));if(_0x32f1b3['agicommand']==='gotoc'){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0xbe5850[_0x1b94('0x41')]=_0x32f1b3[_0x1b94('0x41')]||_0xbe5850[_0x1b94('0x41')];_0xbe5850['extension']=_0x32f1b3[_0x1b94('0x42')];_0xbe5850['priority']=_0x32f1b3['priority']?_0x32f1b3[_0x1b94('0x43')]-0x1:0x1;return null;}else if(_0x32f1b3&&_0x2036d5[_0x32f1b3['agicommand']]){_0x4e13d0=_0x2036d5[_0x32f1b3['agicommand']](_0x32f1b3);logger[_0x1b94('0x11')](_0x1b94('0x44'),JSON[_0x1b94('0x33')](_0x4e13d0,null,0x2));if(_0x4e13d0&&_0x4e13d0[_0x1b94('0x45')]===AGI_CODE_SUCCESS&&_0x4e13d0[_0x1b94('0x46')]!==AGI_RESULT_ERROR&&!_0xbe5850[_0x1b94('0x1f')]){logger[_0x1b94('0x39')]('response',getLogFromObject(_0x4e13d0));return _['isUndefined'](_0x4e13d0[_0x1b94('0x46')])?null:_0x4e13d0[_0x1b94('0x46')][_0x1b94('0x47')]();}else{logger[_0x1b94('0xd')]('response',getLogFromObject(_0x4e13d0));return null;}}else{logger[_0x1b94('0xd')](_0x1b94('0x48'));return null;}}catch(_0x38a0cb){logger[_0x1b94('0xd')](_0x38a0cb['stack']);return null;}});if(_0x118f01['finally']){logger['info'](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0xbe5850['arg_1'],_0xbe5850[_0x1b94('0x19')],_0xbe5850['callerid'],_0xbe5850[_0x1b94('0x1b')],_0xbe5850[_0x1b94('0x1c')]));_0x26852d[_0x1b94('0x3e')](_0x118f01[_0x1b94('0x49')]['id'],function(_0x56ace1){try{_0x56ace1=_0x2036d5[_0x1b94('0x3f')](_0x56ace1);logger[_0x1b94('0x39')](_0x1b94('0x40'),JSON[_0x1b94('0x33')](_0x56ace1,null,0x2));if(_0x56ace1&&_0x2036d5[_0x56ace1[_0x1b94('0x22')]]){_0x4e13d0=_0x2036d5[_0x56ace1[_0x1b94('0x22')]](_0x56ace1);if(_0x4e13d0){logger[_0x1b94('0x39')]('response',getLogFromObject(_0x4e13d0));return _['isUndefined'](_0x4e13d0[_0x1b94('0x46')])?null:_0x4e13d0[_0x1b94('0x46')][_0x1b94('0x47')]();}else{logger[_0x1b94('0xd')](_0x1b94('0x44'),getLogFromObject(_0x4e13d0));return null;}}else{logger['error'](_0x1b94('0x48'));return null;}}catch(_0x2a69c0){logger[_0x1b94('0xd')](_0x2a69c0[_0x1b94('0xe')]);return null;}});}logger['info'](util[_0x1b94('0x15')](_0x1b94('0x4a'),_0xbe5850['arg_1'],_0xbe5850[_0x1b94('0x19')],_0xbe5850['callerid'],_0xbe5850['dnid'],_0xbe5850[_0x1b94('0x1c')]));logger['info'](util[_0x1b94('0x15')](_0x1b94('0x4b'),_0xbe5850[_0x1b94('0x41')],_0xbe5850[_0x1b94('0x42')],parseInt(_0xbe5850[_0x1b94('0x43')],0xa)+0x1));_0xbe5850['continueAt'](_0xbe5850[_0x1b94('0x41')],_0xbe5850['extension'],parseInt(_0xbe5850[_0x1b94('0x43')],0xa)+0x1);_0xbe5850[_0x1b94('0x4c')]();}}else{logger[_0x1b94('0xd')](util['format']('Project\x20%s\x20not\x20published',_0xbe5850[_0x1b94('0x1d')]));_0xbe5850['continueAt'](_0xbe5850[_0x1b94('0x41')],_0xbe5850[_0x1b94('0x42')],parseInt(_0xbe5850['priority'],0xa)+0x1);_0xbe5850['close']();}}else{logger[_0x1b94('0xd')](util[_0x1b94('0x15')](_0x1b94('0x4d'),_0xbe5850[_0x1b94('0x1d')]));_0xbe5850[_0x1b94('0x4e')](_0xbe5850[_0x1b94('0x41')],_0xbe5850[_0x1b94('0x42')],parseInt(_0xbe5850['priority'],0xa)+0x1);_0xbe5850[_0x1b94('0x4c')]();}}function main(){var _0x247c1e;return utilLicense[_0x1b94('0x4f')]()[_0x1b94('0x2d')](function(_0x359846){if(_0x359846){if(_0x359846['voice']){if(_0x359846[_0x1b94('0x50')]&&_0x359846[_0x1b94('0x50')]>0x0){logger[_0x1b94('0x11')](util[_0x1b94('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x359846[_0x1b94('0x50')]));_0x247c1e=_0x359846[_0x1b94('0x50')];}else{logger[_0x1b94('0x11')](_0x1b94('0x51'));}}else{logger[_0x1b94('0x11')](_0x1b94('0x52'));_0x247c1e=-0x1;}}})[_0x1b94('0x2e')](function(_0x3bfcf7){logger[_0x1b94('0xd')](_0x1b94('0x53'),_0x3bfcf7[_0x1b94('0xe')]);})['finally'](function(){var _0x50d568=require('./server')(config[_0x1b94('0x6')][_0x1b94('0x10')],config['agi']['ip'],_0x247c1e);_0x50d568['on'](_0x1b94('0xd'),errorHandler);_0x50d568['on'](_0x1b94('0x54'),listeningHandler);_0x50d568['on'](_0x1b94('0x55'),connectionHandler);_0x50d568['on'](_0x1b94('0x4c'),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 c321f8c..51b1cf1 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 _0x6187=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','request','then','error','message'];(function(_0x520484,_0x574c92){var _0x238671=function(_0x5691c0){while(--_0x5691c0){_0x520484['push'](_0x520484['shift']());}};_0x238671(++_0x574c92);}(_0x6187,0x185));var _0x7618=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x6187[_0x5d4607];return _0x5e4a86;};'use strict';var BPromise=require(_0x7618('0x0'));var jayson=require(_0x7618('0x1'));var client=jayson[_0x7618('0x2')]['http']({'port':0x232b});function request(_0x3ab9b0,_0x107905){return new BPromise(function(_0x226140,_0x17825b){return client[_0x7618('0x3')](_0x3ab9b0,_0x107905)[_0x7618('0x4')](function(_0x5b78ef){if(_0x5b78ef[_0x7618('0x5')]){return _0x17825b(_0x5b78ef[_0x7618('0x5')][_0x7618('0x6')]);}else{return _0x226140(_0x5b78ef[_0x7618('0x7')]);}})[_0x7618('0x8')](function(_0x34ec6c){return _0x17825b(_0x34ec6c);});});}exports[_0x7618('0x9')]=function(_0x4e4e9f,_0x3166e4){return request(_0x7618('0xa'),{'account':_0x4e4e9f,'message':_0x3166e4});}; \ No newline at end of file +var _0x0759=['bluebird','jayson/promise','client','http','request','error','message','result','catch','sendMailMessage','SendMail'];(function(_0xc8a598,_0x8ffd7c){var _0x2a6225=function(_0x5f2d46){while(--_0x5f2d46){_0xc8a598['push'](_0xc8a598['shift']());}};_0x2a6225(++_0x8ffd7c);}(_0x0759,0x176));var _0x9075=function(_0x54a8b0,_0x331aaf){_0x54a8b0=_0x54a8b0-0x0;var _0x87240c=_0x0759[_0x54a8b0];return _0x87240c;};'use strict';var BPromise=require(_0x9075('0x0'));var jayson=require(_0x9075('0x1'));var client=jayson[_0x9075('0x2')][_0x9075('0x3')]({'port':0x232b});function request(_0x49201f,_0x708d52){return new BPromise(function(_0x48fa4e,_0x48a40f){return client[_0x9075('0x4')](_0x49201f,_0x708d52)['then'](function(_0x1d7b83){if(_0x1d7b83[_0x9075('0x5')]){return _0x48a40f(_0x1d7b83[_0x9075('0x5')][_0x9075('0x6')]);}else{return _0x48fa4e(_0x1d7b83[_0x9075('0x7')]);}})[_0x9075('0x8')](function(_0x552850){return _0x48a40f(_0x552850);});});}exports[_0x9075('0x9')]=function(_0x2c07e9,_0x1b4455){return request(_0x9075('0xa'),{'account':_0x2c07e9,'message':_0x1b4455});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 61d89ca..5fb936f 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 _0xd7ed=['emit','line','exports','util','Transform','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim'];(function(_0x26f94b,_0x15aa6d){var _0x3b89e0=function(_0x24229d){while(--_0x24229d){_0x26f94b['push'](_0x26f94b['shift']());}};_0x3b89e0(++_0x15aa6d);}(_0xd7ed,0x1a1));var _0xdd7e=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0xd7ed[_0x4ae829];return _0x256b31;};'use strict';var util=require(_0xdd7e('0x0'));var Transform=require('stream')[_0xdd7e('0x1')];function AGIReply(_0x2a953f){Transform['call'](this,_0x2a953f);this[_0xdd7e('0x2')]='';this[_0xdd7e('0x3')]=![];}util[_0xdd7e('0x4')](AGIReply,Transform);AGIReply[_0xdd7e('0x5')][_0xdd7e('0x6')]=function(_0x3cb6e3,_0x45fd23,_0x3baff0){var _0x46e7df='\x0a',_0x227759=['\x0a\x0a',_0xdd7e('0x7')],_0x5a0efc=-0x1,_0x552d6e=-0x1,_0x24990f='',_0x1869f2=0x0,_0x57da52='',_0xcaf872='';this[_0xdd7e('0x2')]+=_0x3cb6e3[_0xdd7e('0x8')]();_0x57da52=this[_0xdd7e('0x2')];if(!this[_0xdd7e('0x3')]){_0x1869f2=0x0;while(_0x227759[_0x1869f2]){while((_0x552d6e=_0x57da52[_0xdd7e('0x9')](_0x227759[_0x1869f2]))!=-0x1){_0x24990f=_0x227759[_0x1869f2];_0xcaf872=_0x57da52[_0xdd7e('0xa')](0x0,_0x552d6e);_0x57da52=_0x57da52[_0xdd7e('0xa')](_0x552d6e+_0x24990f[_0xdd7e('0xb')]);var _0x55e0ee=_0xcaf872[_0xdd7e('0xc')](_0x46e7df),_0x4c6a55=0x0,_0x5b78ba={},_0x161f55='',_0x1a5efe='',_0x4a18d1=-0x1;while(_0x55e0ee[_0x4c6a55]){_0x4a18d1=_0x55e0ee[_0x4c6a55]['indexOf'](':');if(_0x4a18d1!=-0x1){_0x161f55=_0x55e0ee[_0x4c6a55][_0xdd7e('0xd')](0x0,_0x4a18d1)[_0xdd7e('0xe')]();_0x1a5efe=_0x55e0ee[_0x4c6a55][_0xdd7e('0xd')](_0x4a18d1+0x1)[_0xdd7e('0xe')]();if(_0x161f55['length']>0x0){_0x5b78ba[_0x161f55]=_0x1a5efe;}}else{}_0x4c6a55++;}this[_0xdd7e('0xf')]('headers',_0x5b78ba);this['_inBody']=!![];}_0x1869f2++;}this[_0xdd7e('0x2')]=_0x57da52;}else{while((_0x5a0efc=_0x57da52[_0xdd7e('0x9')](_0x46e7df))!=-0x1){_0xcaf872=_0x57da52[_0xdd7e('0xa')](0x0,_0x5a0efc);this[_0xdd7e('0xf')](_0xdd7e('0x10'),_0xcaf872);_0x57da52=_0x57da52[_0xdd7e('0xa')](_0x5a0efc+_0x46e7df[_0xdd7e('0xb')]);}this[_0xdd7e('0x2')]=_0x57da52;}_0x3baff0();};module[_0xdd7e('0x11')]=AGIReply; \ No newline at end of file +var _0xffbc=['toString','indexOf','substring','length','split','slice','trim','emit','line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform'];(function(_0x21bfab,_0x2fee48){var _0x4db318=function(_0x10396d){while(--_0x10396d){_0x21bfab['push'](_0x21bfab['shift']());}};_0x4db318(++_0x2fee48);}(_0xffbc,0x14d));var _0xcffb=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xffbc[_0x4fc9e6];return _0x551d28;};'use strict';var util=require(_0xcffb('0x0'));var Transform=require(_0xcffb('0x1'))[_0xcffb('0x2')];function AGIReply(_0x30e7d2){Transform[_0xcffb('0x3')](this,_0x30e7d2);this[_0xcffb('0x4')]='';this[_0xcffb('0x5')]=![];}util[_0xcffb('0x6')](AGIReply,Transform);AGIReply[_0xcffb('0x7')][_0xcffb('0x8')]=function(_0x4709e8,_0x337a1d,_0x434d95){var _0x483ca3='\x0a',_0x55bfb7=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x306aa3=-0x1,_0x41d32d=-0x1,_0x50a5f9='',_0x5d3a91=0x0,_0x200115='',_0x3e086e='';this[_0xcffb('0x4')]+=_0x4709e8[_0xcffb('0x9')]();_0x200115=this[_0xcffb('0x4')];if(!this[_0xcffb('0x5')]){_0x5d3a91=0x0;while(_0x55bfb7[_0x5d3a91]){while((_0x41d32d=_0x200115[_0xcffb('0xa')](_0x55bfb7[_0x5d3a91]))!=-0x1){_0x50a5f9=_0x55bfb7[_0x5d3a91];_0x3e086e=_0x200115[_0xcffb('0xb')](0x0,_0x41d32d);_0x200115=_0x200115[_0xcffb('0xb')](_0x41d32d+_0x50a5f9[_0xcffb('0xc')]);var _0xdcf80d=_0x3e086e[_0xcffb('0xd')](_0x483ca3),_0x15d3ea=0x0,_0x334b94={},_0xc67e33='',_0xccada8='',_0x367e06=-0x1;while(_0xdcf80d[_0x15d3ea]){_0x367e06=_0xdcf80d[_0x15d3ea]['indexOf'](':');if(_0x367e06!=-0x1){_0xc67e33=_0xdcf80d[_0x15d3ea][_0xcffb('0xe')](0x0,_0x367e06)[_0xcffb('0xf')]();_0xccada8=_0xdcf80d[_0x15d3ea][_0xcffb('0xe')](_0x367e06+0x1)[_0xcffb('0xf')]();if(_0xc67e33[_0xcffb('0xc')]>0x0){_0x334b94[_0xc67e33]=_0xccada8;}}else{}_0x15d3ea++;}this[_0xcffb('0x10')]('headers',_0x334b94);this[_0xcffb('0x5')]=!![];}_0x5d3a91++;}this[_0xcffb('0x4')]=_0x200115;}else{while((_0x306aa3=_0x200115[_0xcffb('0xa')](_0x483ca3))!=-0x1){_0x3e086e=_0x200115['substring'](0x0,_0x306aa3);this[_0xcffb('0x10')](_0xcffb('0x11'),_0x3e086e);_0x200115=_0x200115[_0xcffb('0xb')](_0x306aa3+_0x483ca3[_0xcffb('0xc')]);}this[_0xcffb('0x4')]=_0x200115;}_0x434d95();};module[_0xcffb('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index e5614d6..da6456e 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 _0x55f4=['getVoiceQueueById','ShowVoiceQueue','ShowVariable','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','bluebird','moment','lodash','util','jayson/promise','http','then','error','result','catch','ShowSquareProject','production','getMailAccountById','Smtp','name','getSquareProjectById'];(function(_0x3a6c02,_0x2171f5){var _0x390e21=function(_0x56ee3a){while(--_0x56ee3a){_0x3a6c02['push'](_0x3a6c02['shift']());}};_0x390e21(++_0x2171f5);}(_0x55f4,0x103));var _0x455f=function(_0x5ba3aa,_0x31cbdb){_0x5ba3aa=_0x5ba3aa-0x0;var _0x47c24a=_0x55f4[_0x5ba3aa];return _0x47c24a;};'use strict';var BPromise=require(_0x455f('0x0'));var moment=require(_0x455f('0x1'));var _=require(_0x455f('0x2'));var util=require(_0x455f('0x3'));var jayson=require(_0x455f('0x4'));var client=jayson['client'][_0x455f('0x5')]({'port':0x2329});function request(_0x43d789,_0x383f8f){return new BPromise(function(_0x1f44f8,_0x409104){return client['request'](_0x43d789,_0x383f8f)[_0x455f('0x6')](function(_0x52be9b){if(_0x52be9b[_0x455f('0x7')]){return _0x409104(_0x52be9b[_0x455f('0x7')]['message']);}else{return _0x1f44f8(_0x52be9b[_0x455f('0x8')]);}})[_0x455f('0x9')](function(_0x59e692){return _0x409104(_0x59e692);});});}exports['getSquareProject']=function(_0x1646ee){return request(_0x455f('0xa'),{'options':{'raw':![],'where':{'name':_0x1646ee},'attributes':[_0x455f('0xb')]}});};exports[_0x455f('0xc')]=function(_0x1de9f8){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x1de9f8},'include':[{'model':'MailServerOut','as':_0x455f('0xd')}],'attributes':['id',_0x455f('0xe'),'email']}});};exports[_0x455f('0xf')]=function(_0x35f96d){return request('ShowSquareProject',{'options':{'where':{'id':_0x35f96d},'attributes':['name']}});};exports[_0x455f('0x10')]=function(_0x447d6c){return request(_0x455f('0x11'),{'options':{'where':{'id':_0x447d6c},'attributes':[_0x455f('0xe')]}});};exports['getVariableById']=function(_0x3f338b){return request(_0x455f('0x12'),{'options':{'where':{'id':_0x3f338b},'attributes':[_0x455f('0xe')]}});};exports['getSquareOdbcById']=function(_0x1f9f09){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x1f9f09},'attributes':[_0x455f('0x13')]}});};exports[_0x455f('0x14')]=function(_0x46cb13){return request(_0x455f('0x15'),{'options':{'where':{'id':_0x46cb13},'attributes':[_0x455f('0xe')]}});};exports[_0x455f('0x16')]=function(_0x65d19c){return request(_0x455f('0x17'),{'options':{'where':{'id':_0x65d19c},'attributes':[_0x455f('0xe')]}});};exports[_0x455f('0x18')]=function(_0x299098){return request(_0x455f('0x19'),{'options':{'where':{'id':_0x299098},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x12d588){return request(_0x455f('0x1a'),{'options':{'raw':![],'where':{'id':_0x12d588},'include':[{'model':_0x455f('0x1b'),'as':_0x455f('0x1c')}]}});};exports[_0x455f('0x1d')]=function(_0x107a4e){return request(_0x455f('0x1e'),{'options':{'where':{'id':_0x107a4e},'attributes':['id',_0x455f('0xe')]}});};exports[_0x455f('0x1f')]=function(_0x1a0237){return request(_0x455f('0x20'),{'body':_0x1a0237});};exports[_0x455f('0x21')]=function(_0x49b7c4){return request('CreateSquareDetailsReport',{'body':_0x49b7c4});};exports[_0x455f('0x22')]=function(_0x2be753){return request(_0x455f('0x23'),{'body':_[_0x455f('0x24')](_0x2be753,{'project_name':_0x2be753['arg_1'],'prev_project_name':_0x2be753[_0x455f('0x25')]||'','is_subproject':_0x2be753[_0x455f('0x25')]?!![]:![],'leaveAt':moment()[_0x455f('0x26')](_0x455f('0x27'))})});};exports[_0x455f('0x28')]=function(_0x132ace){return request(_0x455f('0x29'),{'body':_0x132ace});};exports['createSquareMessage']=function(_0x38a458){return request(_0x455f('0x2a'),{'body':_0x38a458});};exports[_0x455f('0x2b')]=function(_0x192134){return request(_0x455f('0x2c'),{'options':{'raw':![],'where':{'phone':_0x192134['phone'],'ListId':_0x192134[_0x455f('0x2d')]}}})['then'](function(_0xa0c16e){if(_0xa0c16e){return _0xa0c16e;}return request(_0x455f('0x2e'),{'body':_0x192134});});};exports[_0x455f('0x2f')]=function(_0x4adf00){return request(_0x455f('0x30'),{'options':{'where':{'id':_0x4adf00},'attributes':[_0x455f('0xe')]}});};exports[_0x455f('0x31')]=function(_0x155d67,_0x39c5a7){return request(_0x455f('0x32'),{'body':{'interface':_0x39c5a7},'options':{'where':_0x155d67}});};exports[_0x455f('0x33')]=function(_0x1f2e77,_0x3eb009,_0x514660){return request('PauseUser',{'body':{'type':_0x3eb009,'uniqueid':_0x514660},'options':{'where':_0x1f2e77}});};exports[_0x455f('0x34')]=function(_0x157f0f){return request(_0x455f('0x35'),{'body':{},'options':{'where':_0x157f0f}});};exports[_0x455f('0x36')]=function(_0x49a5fc){return request('LogoutUser',{'body':{},'options':{'where':_0x49a5fc}});}; \ No newline at end of file +var _0x9e4b=['getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','createCmContact','ShowCmHopper','phone','ListId','then','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','util','jayson/promise','client','http','request','error','message','result','catch','production','getMailAccountById','ShowMailAccount','MailServerOut','name','email','ShowSquareProject','ShowVoiceQueue','ShowVariable'];(function(_0x142776,_0x29eb16){var _0x1e14cf=function(_0x519482){while(--_0x519482){_0x142776['push'](_0x142776['shift']());}};_0x1e14cf(++_0x29eb16);}(_0x9e4b,0x17c));var _0xb9e4=function(_0x1b83ed,_0x611b7){_0x1b83ed=_0x1b83ed-0x0;var _0x1d6200=_0x9e4b[_0x1b83ed];return _0x1d6200;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0xb9e4('0x0'));var util=require(_0xb9e4('0x1'));var jayson=require(_0xb9e4('0x2'));var client=jayson[_0xb9e4('0x3')][_0xb9e4('0x4')]({'port':0x2329});function request(_0x159080,_0x46f179){return new BPromise(function(_0x3d0a59,_0x47e407){return client[_0xb9e4('0x5')](_0x159080,_0x46f179)['then'](function(_0x1b2855){if(_0x1b2855[_0xb9e4('0x6')]){return _0x47e407(_0x1b2855[_0xb9e4('0x6')][_0xb9e4('0x7')]);}else{return _0x3d0a59(_0x1b2855[_0xb9e4('0x8')]);}})[_0xb9e4('0x9')](function(_0x16f0da){return _0x47e407(_0x16f0da);});});}exports['getSquareProject']=function(_0x35911a){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x35911a},'attributes':[_0xb9e4('0xa')]}});};exports[_0xb9e4('0xb')]=function(_0x234da5){return request(_0xb9e4('0xc'),{'options':{'raw':![],'where':{'id':_0x234da5},'include':[{'model':_0xb9e4('0xd'),'as':'Smtp'}],'attributes':['id',_0xb9e4('0xe'),_0xb9e4('0xf')]}});};exports['getSquareProjectById']=function(_0x341fa7){return request(_0xb9e4('0x10'),{'options':{'where':{'id':_0x341fa7},'attributes':[_0xb9e4('0xe')]}});};exports['getVoiceQueueById']=function(_0x3dee43){return request(_0xb9e4('0x11'),{'options':{'where':{'id':_0x3dee43},'attributes':[_0xb9e4('0xe')]}});};exports['getVariableById']=function(_0x146442){return request(_0xb9e4('0x12'),{'options':{'where':{'id':_0x146442},'attributes':[_0xb9e4('0xe')]}});};exports[_0xb9e4('0x13')]=function(_0x3a5cdf){return request(_0xb9e4('0x14'),{'options':{'where':{'id':_0x3a5cdf},'attributes':[_0xb9e4('0x15')]}});};exports[_0xb9e4('0x16')]=function(_0x34acbc){return request(_0xb9e4('0x17'),{'options':{'where':{'id':_0x34acbc},'attributes':[_0xb9e4('0xe')]}});};exports[_0xb9e4('0x18')]=function(_0xb137c9){return request(_0xb9e4('0x19'),{'options':{'where':{'id':_0xb137c9},'attributes':[_0xb9e4('0xe')]}});};exports[_0xb9e4('0x1a')]=function(_0x3a845f){return request(_0xb9e4('0x1b'),{'options':{'where':{'id':_0x3a845f},'attributes':[_0xb9e4('0x1c')]}});};exports[_0xb9e4('0x1d')]=function(_0x3438f5){return request(_0xb9e4('0x1e'),{'options':{'raw':![],'where':{'id':_0x3438f5},'include':[{'model':'Interval','as':_0xb9e4('0x1f')}]}});};exports[_0xb9e4('0x20')]=function(_0x589985){return request('ShowSmsAccount',{'options':{'where':{'id':_0x589985},'attributes':['id',_0xb9e4('0xe')]}});};exports[_0xb9e4('0x21')]=function(_0x56edb4){return request(_0xb9e4('0x22'),{'body':_0x56edb4});};exports[_0xb9e4('0x23')]=function(_0x3bd675){return request('CreateSquareDetailsReport',{'body':_0x3bd675});};exports[_0xb9e4('0x24')]=function(_0x3efac6){return request('CreateSquareReport',{'body':_[_0xb9e4('0x25')](_0x3efac6,{'project_name':_0x3efac6[_0xb9e4('0x26')],'prev_project_name':_0x3efac6[_0xb9e4('0x27')]||'','is_subproject':_0x3efac6[_0xb9e4('0x27')]?!![]:![],'leaveAt':moment()[_0xb9e4('0x28')](_0xb9e4('0x29'))})});};exports['createSquareRecording']=function(_0x135331){return request('CreateSquareRecording',{'body':_0x135331});};exports[_0xb9e4('0x2a')]=function(_0x423ed2){return request('CreateSquareMessage',{'body':_0x423ed2});};exports[_0xb9e4('0x2b')]=function(_0x1d5ebe){return request(_0xb9e4('0x2c'),{'options':{'raw':![],'where':{'phone':_0x1d5ebe[_0xb9e4('0x2d')],'ListId':_0x1d5ebe[_0xb9e4('0x2e')]}}})[_0xb9e4('0x2f')](function(_0x5d4d89){if(_0x5d4d89){return _0x5d4d89;}return request(_0xb9e4('0x30'),{'body':_0x1d5ebe});});};exports[_0xb9e4('0x31')]=function(_0x3a0493){return request(_0xb9e4('0x32'),{'options':{'where':{'id':_0x3a0493},'attributes':[_0xb9e4('0xe')]}});};exports[_0xb9e4('0x33')]=function(_0x4ceb79,_0x32dc41){return request(_0xb9e4('0x34'),{'body':{'interface':_0x32dc41},'options':{'where':_0x4ceb79}});};exports['agentPause']=function(_0x3854b3,_0xbea681,_0x2d75cc){return request('PauseUser',{'body':{'type':_0xbea681,'uniqueid':_0x2d75cc},'options':{'where':_0x3854b3}});};exports[_0xb9e4('0x35')]=function(_0x497507){return request(_0xb9e4('0x36'),{'body':{},'options':{'where':_0x497507}});};exports[_0xb9e4('0x37')]=function(_0xca928){return request(_0xb9e4('0x38'),{'body':{},'options':{'where':_0xca928}});}; \ 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 9c1b600..6046ce5 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 _0xba34=['./lex','exports','./polly'];(function(_0x3cb988,_0x379b24){var _0x2628f0=function(_0x3d4230){while(--_0x3d4230){_0x3cb988['push'](_0x3cb988['shift']());}};_0x2628f0(++_0x379b24);}(_0xba34,0x119));var _0x4ba3=function(_0x5afd77,_0x3640fa){_0x5afd77=_0x5afd77-0x0;var _0x16d387=_0xba34[_0x5afd77];return _0x16d387;};var polly=require(_0x4ba3('0x0'));var lex=require(_0x4ba3('0x1'));module[_0x4ba3('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x004c=['exports','./polly','./lex'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x004c,0x85));var _0xc004=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x004c[_0x5f309e];return _0x487b5e;};var polly=require(_0xc004('0x0'));var lex=require(_0xc004('0x1'));module[_0xc004('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 301877f..c42fb3a 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 _0x5ff3=['exports'];(function(_0x467546,_0x5b712c){var _0x1ca8dd=function(_0x11e5e6){while(--_0x11e5e6){_0x467546['push'](_0x467546['shift']());}};_0x1ca8dd(++_0x5b712c);}(_0x5ff3,0x17d));var _0x35ff=function(_0x491da1,_0x11e7f7){_0x491da1=_0x491da1-0x0;var _0x39d869=_0x5ff3[_0x491da1];return _0x39d869;};'use strict';var lex=require('./lib/api');module[_0x35ff('0x0')]=function(_0x48cbf7,_0x1763a,_0x47c98d,_0x380f54,_0x1bb200,_0x3bd66a){return lex(_0x48cbf7,_0x1763a,_0x47c98d,_0x380f54,_0x1bb200,_0x3bd66a);}; \ No newline at end of file +var _0x5ff3=['exports'];(function(_0xf94324,_0x381624){var _0x555900=function(_0x1e9b57){while(--_0x1e9b57){_0xf94324['push'](_0xf94324['shift']());}};_0x555900(++_0x381624);}(_0x5ff3,0x17d));var _0x35ff=function(_0x1e621d,_0x508539){_0x1e621d=_0x1e621d-0x0;var _0x272451=_0x5ff3[_0x1e621d];return _0x272451;};'use strict';var lex=require('./lib/api');module[_0x35ff('0x0')]=function(_0x48cbf7,_0x1763a,_0x47c98d,_0x380f54,_0x1bb200,_0x3bd66a){return lex(_0x48cbf7,_0x1763a,_0x47c98d,_0x380f54,_0x1bb200,_0x3bd66a);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 5d29faf..1a2a119 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(_0x3e9b5a,_0x5a118c){var _0x4dad64=function(_0x435acb){while(--_0x435acb){_0x3e9b5a['push'](_0x3e9b5a['shift']());}};_0x4dad64(++_0x5a118c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x50bd87,_0x38c037){var _0x473540=function(_0x4bc701){while(--_0x4bc701){_0x50bd87['push'](_0x50bd87['shift']());}};_0x473540(++_0x38c037);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 1dc6bac..696e63c 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 _0x0778=['./lib/api','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0778,0x194));var _0x8077=function(_0x5e2be0,_0x51090e){_0x5e2be0=_0x5e2be0-0x0;var _0x23d711=_0x0778[_0x5e2be0];return _0x23d711;};'use strict';var polly=require(_0x8077('0x0'));module[_0x8077('0x1')]=function(_0x34ebeb,_0x5d99a4,_0x1b1bb7,_0x2873a2,_0x3ea424,_0x42d28,_0x22c1b5){return polly(_0x34ebeb,_0x5d99a4,_0x1b1bb7,_0x2873a2,_0x3ea424,_0x42d28,_0x22c1b5);}; \ No newline at end of file +var _0x5b24=['./lib/api','exports'];(function(_0x3868e7,_0x5a3869){var _0x3d823e=function(_0x453eef){while(--_0x453eef){_0x3868e7['push'](_0x3868e7['shift']());}};_0x3d823e(++_0x5a3869);}(_0x5b24,0xa6));var _0x45b2=function(_0x570294,_0x139ae4){_0x570294=_0x570294-0x0;var _0x41b542=_0x5b24[_0x570294];return _0x41b542;};'use strict';var polly=require(_0x45b2('0x0'));module[_0x45b2('0x1')]=function(_0x35f264,_0x252c86,_0x57fd24,_0x1500cb,_0x59f84e,_0x2558d7,_0x4bf04d){return polly(_0x35f264,_0x252c86,_0x57fd24,_0x1500cb,_0x59f84e,_0x2558d7,_0x4bf04d);}; \ 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 e8dd264..bbeda58 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 _0x7ce5=['AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','bluebird','randomstring','aws-sdk','synthesizeSpeech'];(function(_0x4c9940,_0x9e11eb){var _0x27a2a1=function(_0x495843){while(--_0x495843){_0x4c9940['push'](_0x4c9940['shift']());}};_0x27a2a1(++_0x9e11eb);}(_0x7ce5,0x178));var _0x57ce=function(_0x33e007,_0x248f15){_0x33e007=_0x33e007-0x0;var _0x52797e=_0x7ce5[_0x33e007];return _0x52797e;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x57ce('0x0'));var rs=require(_0x57ce('0x1'));var AWS=require(_0x57ce('0x2'));function pollyResult(_0x15ef2a,_0x2c6592,_0x35ec9a){return new BPromise(function(_0x18b19d,_0x3f1532){_0x15ef2a[_0x57ce('0x3')](_0x2c6592,function(_0x337b8f,_0x1c6777){if(_0x337b8f){_0x3f1532(_0x337b8f);}else if(_0x1c6777){if(_0x1c6777[_0x57ce('0x4')]instanceof Buffer){fs['writeFile'](_0x35ec9a,_0x1c6777[_0x57ce('0x4')],function(_0x1de0f0){if(_0x1de0f0){_0x3f1532(_0x1de0f0);}else{_0x18b19d();}});}else{_0x3f1532(new Error(_0x57ce('0x5')));}}else{_0x3f1532(new Error(_0x57ce('0x6')));}});});}module[_0x57ce('0x7')]=function(_0xea072e,_0x3cc475,_0x93773c,_0x4c22a0,_0x27055d,_0x4f5667,_0x1d977a){var _0x3d08ed=new AWS[(_0x57ce('0x8'))]({'accessKeyId':_0xea072e,'secretAccessKey':_0x3cc475,'region':_0x93773c});var _0x37b845={'Text':_0x27055d,'TextType':_0x4f5667||_0x57ce('0x9'),'OutputFormat':'mp3','VoiceId':_0x4c22a0};return pollyResult(_0x3d08ed,_0x37b845,_0x1d977a);}; \ No newline at end of file +var _0x70c6=['path','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3'];(function(_0x2d8bd6,_0x4c66af){var _0x142abb=function(_0x224e5d){while(--_0x224e5d){_0x2d8bd6['push'](_0x2d8bd6['shift']());}};_0x142abb(++_0x4c66af);}(_0x70c6,0xea));var _0x670c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x70c6[_0x59ee6f];return _0x4c0979;};'use strict';var fs=require('fs');var path=require(_0x670c('0x0'));var BPromise=require(_0x670c('0x1'));var rs=require(_0x670c('0x2'));var AWS=require(_0x670c('0x3'));function pollyResult(_0x218109,_0x1bac56,_0x433202){return new BPromise(function(_0x41f68f,_0x348419){_0x218109[_0x670c('0x4')](_0x1bac56,function(_0x14a657,_0x5ebcbd){if(_0x14a657){_0x348419(_0x14a657);}else if(_0x5ebcbd){if(_0x5ebcbd['AudioStream']instanceof Buffer){fs[_0x670c('0x5')](_0x433202,_0x5ebcbd[_0x670c('0x6')],function(_0x1ba209){if(_0x1ba209){_0x348419(_0x1ba209);}else{_0x41f68f();}});}else{_0x348419(new Error(_0x670c('0x7')));}}else{_0x348419(new Error(_0x670c('0x8')));}});});}module[_0x670c('0x9')]=function(_0x503fe5,_0x171b3b,_0x31a363,_0x4763bd,_0x2e853f,_0xc8b9,_0x504b25){var _0x2edb12=new AWS[(_0x670c('0xa'))]({'accessKeyId':_0x503fe5,'secretAccessKey':_0x171b3b,'region':_0x31a363});var _0x162c92={'Text':_0x2e853f,'TextType':_0xc8b9||_0x670c('0xb'),'OutputFormat':_0x670c('0xc'),'VoiceId':_0x4763bd};return pollyResult(_0x2edb12,_0x162c92,_0x504b25);}; \ 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 8bb7c27..e2649a3 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 _0xabf7=['exports'];(function(_0x1a89ca,_0x27394b){var _0x29cbb2=function(_0x31e1f4){while(--_0x31e1f4){_0x1a89ca['push'](_0x1a89ca['shift']());}};_0x29cbb2(++_0x27394b);}(_0xabf7,0xf9));var _0x7abf=function(_0x11c69f,_0x116175){_0x11c69f=_0x11c69f-0x0;var _0xba70ab=_0xabf7[_0x11c69f];return _0xba70ab;};'use strict';var asr=require('./lib/api');module[_0x7abf('0x0')]=function(_0x5a232f,_0x4b704d,_0x307bf7,_0x222a13){return asr(_0x5a232f,_0x4b704d,_0x307bf7);}; \ No newline at end of file +var _0x1ca0=['exports'];(function(_0x58cfdf,_0x2109de){var _0x478001=function(_0x1ccb1f){while(--_0x1ccb1f){_0x58cfdf['push'](_0x58cfdf['shift']());}};_0x478001(++_0x2109de);}(_0x1ca0,0x141));var _0x01ca=function(_0x45e7e7,_0x10e163){_0x45e7e7=_0x45e7e7-0x0;var _0x5ed7e6=_0x1ca0[_0x45e7e7];return _0x5ed7e6;};'use strict';var asr=require('./lib/api');module[_0x01ca('0x0')]=function(_0x26407b,_0x363849,_0x517d28,_0x483456){return asr(_0x26407b,_0x363849,_0x517d28);}; \ 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 32fa8e5..7ca7ac3 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 _0x34e8=['string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports'];(function(_0x6e30a8,_0x56721a){var _0x96f014=function(_0x529a8f){while(--_0x529a8f){_0x6e30a8['push'](_0x6e30a8['shift']());}};_0x96f014(++_0x56721a);}(_0x34e8,0x12c));var _0x834e=function(_0xa48dfd,_0x1acd8a){_0xa48dfd=_0xa48dfd-0x0;var _0x310bfd=_0x34e8[_0xa48dfd];return _0x310bfd;};'use strict';var url=require(_0x834e('0x0'));var BPromise=require(_0x834e('0x1'));var fs=require('fs');var host=_0x834e('0x2');module[_0x834e('0x3')]=function(_0x530939,_0x832422,_0x21e2e0){return new BPromise(function(_0x472111,_0x31bf20){var _0x289ef2;if(typeof _0x530939!==_0x834e('0x4')||_0x530939[_0x834e('0x5')]===0x0){return _0x31bf20('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x832422!==_0x834e('0x4')||_0x832422['length']===0x0){return _0x31bf20(_0x834e('0x6'));}if(typeof _0x21e2e0!==_0x834e('0x7')&&(typeof _0x21e2e0!==_0x834e('0x4')||_0x21e2e0[_0x834e('0x5')]===0x0)){return _0x31bf20(_0x834e('0x8'));}try{_0x289ef2=fs[_0x834e('0x9')](_0x530939)[_0x834e('0xa')](_0x834e('0xb'));}catch(_0x3bdda9){return _0x31bf20(_0x3bdda9);}return _0x472111({'method':_0x834e('0xc'),'uri':host+_0x834e('0xd')+_0x832422,'body':{'config':{'encoding':_0x834e('0xe'),'sampleRateHertz':_0x834e('0xf'),'languageCode':_0x21e2e0},'audio':{'content':_0x289ef2}},'json':!![]});});}; \ No newline at end of file +var _0x644a=['8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16'];(function(_0x154130,_0x249201){var _0x50fc4c=function(_0x500ae4){while(--_0x500ae4){_0x154130['push'](_0x154130['shift']());}};_0x50fc4c(++_0x249201);}(_0x644a,0xfd));var _0xa644=function(_0x3fb5f9,_0xa4c2d9){_0x3fb5f9=_0x3fb5f9-0x0;var _0x541745=_0x644a[_0x3fb5f9];return _0x541745;};'use strict';var url=require(_0xa644('0x0'));var BPromise=require(_0xa644('0x1'));var fs=require('fs');var host=_0xa644('0x2');module[_0xa644('0x3')]=function(_0x3a3218,_0x48801b,_0x1423b7){return new BPromise(function(_0x704008,_0x526de6){var _0x4f6ed9;if(typeof _0x3a3218!==_0xa644('0x4')||_0x3a3218[_0xa644('0x5')]===0x0){return _0x526de6(_0xa644('0x6'));}if(typeof _0x48801b!=='string'||_0x48801b[_0xa644('0x5')]===0x0){return _0x526de6(_0xa644('0x7'));}if(typeof _0x1423b7!=='undefined'&&(typeof _0x1423b7!==_0xa644('0x4')||_0x1423b7[_0xa644('0x5')]===0x0)){return _0x526de6('lang\x20should\x20be\x20a\x20string');}try{_0x4f6ed9=fs['readFileSync'](_0x3a3218)[_0xa644('0x8')](_0xa644('0x9'));}catch(_0x55415d){return _0x526de6(_0x55415d);}return _0x704008({'method':_0xa644('0xa'),'uri':host+_0xa644('0xb')+_0x48801b,'body':{'config':{'encoding':_0xa644('0xc'),'sampleRateHertz':_0xa644('0xd'),'languageCode':_0x1423b7},'audio':{'content':_0x4f6ed9}},'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 5c25b98..13a73e0 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 _0x3ddb=['exports','./asr'];(function(_0x27c79a,_0x2482dc){var _0x38b578=function(_0x3f7cfc){while(--_0x3f7cfc){_0x27c79a['push'](_0x27c79a['shift']());}};_0x38b578(++_0x2482dc);}(_0x3ddb,0xbb));var _0xb3dd=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3ddb[_0x4cf98e];return _0x1623ac;};var asr=require(_0xb3dd('0x0'));module[_0xb3dd('0x1')]={'asr':asr}; \ No newline at end of file +var _0x4649=['./asr','exports'];(function(_0x45577f,_0x24889f){var _0x2c0140=function(_0x336012){while(--_0x336012){_0x45577f['push'](_0x45577f['shift']());}};_0x2c0140(++_0x24889f);}(_0x4649,0x122));var _0x9464=function(_0x44867c,_0x188e32){_0x44867c=_0x44867c-0x0;var _0x5ad8e2=_0x4649[_0x44867c];return _0x5ad8e2;};var asr=require(_0x9464('0x0'));module[_0x9464('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 8fe9512..f0fa6bd 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 _0xdd9d=['actionIncomplete','status','code','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','http','https','path','querystring','request-promise','randomstring','google-tts-api','url','util','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','finish\x20download\x20file','unlink','pipe','end','transcode','wav','error\x20convert','info','finish\x20to\x20convert','resolve','generate','.wav','base64','then','chmodSync','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','text:synthesize','POST','tmp','from','audioContent','writeFile','googleCloudTTS\x20path','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','generic','slice','parse\x20response\x20failed:\x0a','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','writeFileSync','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','name','message','googleDialogflow','result','resolvedQuery','action'];(function(_0x460fd7,_0x2012db){var _0x44d1c2=function(_0x545e11){while(--_0x545e11){_0x460fd7['push'](_0x460fd7['shift']());}};_0x44d1c2(++_0x2012db);}(_0xdd9d,0xb1));var _0xddd9=function(_0x407eb4,_0x3b410b){_0x407eb4=_0x407eb4-0x0;var _0x3eefd4=_0xdd9d[_0x407eb4];return _0x3eefd4;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xddd9('0x0'));var dialogflow=require(_0xddd9('0x1'));var fs=require('fs');var http=require(_0xddd9('0x2'));var https=require(_0xddd9('0x3'));var md5=require('md5');var path=require(_0xddd9('0x4'));var querystring=require(_0xddd9('0x5'));var rp=require(_0xddd9('0x6'));var rs=require(_0xddd9('0x7'));var sox=require('sox');var tts=require(_0xddd9('0x8'));var urlParse=require(_0xddd9('0x9'))['parse'];var util=require(_0xddd9('0xa'));var aws=require('./aws');var google=require(_0xddd9('0xb'));var sestek=require('./sestek');var tilde=require(_0xddd9('0xc'));var logger=require(_0xddd9('0xd'))(_0xddd9('0xe'));var ISPEECH_API=_0xddd9('0xf');function downloadFile(_0x24b456,_0x1cb00a){return new BPromise(function(_0x5778bb,_0x37dce2){var _0x4525fd=urlParse(_0x24b456);var _0x370d32=_0x4525fd[_0xddd9('0x10')]===_0xddd9('0x11')?https:http;var _0x14c821={'host':_0x4525fd[_0xddd9('0x12')],'path':_0x4525fd['path'],'headers':{'user-agent':_0xddd9('0x13')}};_0x370d32[_0xddd9('0x14')](_0x14c821,function(_0x9c4215){if(_0x9c4215[_0xddd9('0x15')]!==0xc8){logger[_0xddd9('0x16')]('request\x20to\x20'+_0x24b456+_0xddd9('0x17')+_0x9c4215[_0xddd9('0x15')]+'\x20('+_0x9c4215[_0xddd9('0x18')]+')');_0x37dce2(new Error(_0xddd9('0x19')+_0x24b456+_0xddd9('0x17')+_0x9c4215[_0xddd9('0x15')]+'\x20('+_0x9c4215[_0xddd9('0x18')]+')'));return;}var _0x5ad620=fs[_0xddd9('0x1a')](_0x1cb00a);_0x5ad620['on'](_0xddd9('0x1b'),function(){logger['info'](_0xddd9('0x1c'));_0x5ad620['close'](_0x5778bb);});_0x5ad620['on']('error',function(_0x3377af){fs[_0xddd9('0x1d')](_0x1cb00a);logger[_0xddd9('0x16')]('download\x20error',_0x3377af);_0x37dce2(_0x3377af);});_0x9c4215[_0xddd9('0x1e')](_0x5ad620);})['on'](_0xddd9('0x16'),function(_0x189cf4){logger[_0xddd9('0x16')](_0x189cf4);_0x37dce2(_0x189cf4);})[_0xddd9('0x1f')]();});}function uploadFile(_0x57b476){return new BPromise(function(_0x55cb7c,_0x177dd9){var _0x138600=urlParse(_0x57b476);var _0x586b81=_0x138600[_0xddd9('0x10')]===_0xddd9('0x11')?https:http;var _0x243626={'host':_0x138600[_0xddd9('0x12')],'path':_0x138600[_0xddd9('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x586b81['get'](_0x243626,function(_0x4bf342){if(_0x4bf342['statusCode']!==0xc8){_0x177dd9(new Error('request\x20to\x20'+_0x57b476+'\x20failed,\x20status\x20code\x20=\x20'+_0x4bf342[_0xddd9('0x15')]+'\x20('+_0x4bf342['statusMessage']+')'));return;}var _0x284cb3='';_0x4bf342['on']('data',function(_0x36634f){_0x284cb3+=_0x36634f;});_0x4bf342['on'](_0xddd9('0x1f'),function(){_0x55cb7c(_0x284cb3);});})['on'](_0xddd9('0x16'),function(_0x184a5b){_0x177dd9(_0x184a5b);})[_0xddd9('0x1f')]();});}function convertFile(_0x441d9a,_0x47cb58){return new BPromise(function(_0xeba108,_0x49b897){var _0x27ccdb=sox[_0xddd9('0x20')](_0x441d9a,_0x47cb58,{'sampleRate':0x1f40,'format':_0xddd9('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x27ccdb['on'](_0xddd9('0x16'),function(_0x4b5ef3){logger[_0xddd9('0x16')](_0xddd9('0x22'),_0x4b5ef3);_0x49b897(_0x4b5ef3);});_0x27ccdb['on']('end',function(){logger[_0xddd9('0x23')](_0xddd9('0x24'));_0xeba108();});_0x27ccdb['start']();});}function base64Decode(_0x380dbf,_0x40c82c){var _0x41b161=path[_0xddd9('0x25')](__dirname,'tmp',rs[_0xddd9('0x26')](0x4)+_0xddd9('0x27'));fs['writeFileSync'](_0x41b161,_0x380dbf,_0xddd9('0x28'));return convertFile(_0x41b161,_0x40c82c)[_0xddd9('0x29')](function(){try{fs['unlink'](_0x41b161);fs[_0xddd9('0x2a')](_0x40c82c,_0xddd9('0x2b'));}catch(_0x250a06){logger['error'](_0x250a06);}return _0x40c82c['split']('.')[0x0];});}function base64Encode(_0x4f0dd5){var _0x34fa61=fs[_0xddd9('0x2c')](_0x4f0dd5);return new Buffer(_0x34fa61)[_0xddd9('0x2d')](_0xddd9('0x28'));}exports[_0xddd9('0x2e')]=function(_0x4e21f4,_0x354ccb,_0x3806d5,_0x2256bc,_0x4e4033,_0x5d0a68){var _0x14874c,_0x293a0e;var _0x264a0c=_0xddd9('0x2f');var _0x382eac=_0xddd9('0x30')+_0x4e21f4;var _0xa83dc0={};if(_0x354ccb===_0xddd9('0x31')){_0xa83dc0['input']={'ssml':_0x3806d5};}else{_0xa83dc0[_0xddd9('0x32')]={'text':_0x3806d5};};_0xa83dc0[_0xddd9('0x33')]={'languageCode':_0x2256bc,'ssmlGender':_0x4e4033};_0xa83dc0['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x12f3ca={'url':_0x264a0c+_0xddd9('0x34')+_0x382eac,'method':_0xddd9('0x35'),'json':!![],'body':_0xa83dc0};return rp(_0x12f3ca)['then'](function(_0x389220){return new BPromise(function(_0x577d2e,_0x111eeb){_0x14874c=path[_0xddd9('0x25')](__dirname,_0xddd9('0x36'),rs[_0xddd9('0x26')](0x4)+'.mp3');var _0x32bd89=Buffer[_0xddd9('0x37')](_0x389220[_0xddd9('0x38')],_0xddd9('0x28'));return fs[_0xddd9('0x39')](_0x14874c,_0x32bd89,function(_0x1895bd){_0x111eeb(_0x1895bd);},function(_0x397f28){fs[_0xddd9('0x2a')](_0x14874c,_0xddd9('0x2b'));_0x577d2e(_0x397f28);});});})[_0xddd9('0x29')](function(_0x5bc3de){_0x293a0e=path[_0xddd9('0x25')](__dirname,_0xddd9('0x36'),rs[_0xddd9('0x26')](0x4)+_0xddd9('0x27'));return convertFile(_0x14874c,_0x293a0e);})[_0xddd9('0x29')](function(){try{fs['unlink'](_0x14874c);fs[_0xddd9('0x2a')](_0x293a0e,_0xddd9('0x2b'));}catch(_0x123df4){logger[_0xddd9('0x16')](_0x123df4);}logger[_0xddd9('0x23')](_0xddd9('0x3a'),_0x293a0e[_0xddd9('0x3b')]('.')[0x0]);return _0x293a0e[_0xddd9('0x3b')]('.')[0x0];});};exports['googleTTS']=function(_0xbc827e,_0x4a6093){var _0x1d57b5=_0xddd9('0x3c');var _0x1afe9d,_0x5614bd;var _0x31b93d;var _0x2e8b53={'encoding':_0xddd9('0x3d'),'method':_0xddd9('0x35'),'timeout':0x2710,'url':_0x1d57b5,'headers':{'Content-Type':_0xddd9('0x3e')},'body':_0xddd9('0x3f')+encodeURIComponent(JSON[_0xddd9('0x40')]([[[_0xddd9('0x41'),JSON[_0xddd9('0x40')]([_0xbc827e,_0x4a6093||'en',![],'null']),null,_0xddd9('0x42')]]]))};return rp(_0x2e8b53)[_0xddd9('0x29')](function(_0x3eecc3){try{_0x31b93d=eval(_0x3eecc3[_0xddd9('0x43')](0x5))[0x0][0x2];}catch(_0x88c1e){throw new Error(_0xddd9('0x44')+_0x3eecc3[_0xddd9('0x45')]);}if(!_0x31b93d){if(_0xbc827e[_0xddd9('0x46')]>0xc8){throw new Error(_0xddd9('0x47'));}else{throw new Error(_0xddd9('0x48')+_0x4a6093+_0xddd9('0x49'));}}try{_0x31b93d=eval(_0x31b93d)[0x0];}catch(_0x3887e7){throw new Error(_0xddd9('0x44')+res[_0xddd9('0x45')]);}const _0x2f3f80=_0x31b93d;_0x1afe9d=path['resolve'](__dirname,_0xddd9('0x36'),rs['generate'](0x4)+_0xddd9('0x4a'));fs[_0xddd9('0x4b')](_0x1afe9d,_0x31b93d,{'encoding':'base64'});_0x5614bd=path[_0xddd9('0x25')](__dirname,_0xddd9('0x36'),rs[_0xddd9('0x26')](0x4)+_0xddd9('0x27'));return convertFile(_0x1afe9d,_0x5614bd);})[_0xddd9('0x29')](function(){try{fs[_0xddd9('0x1d')](_0x1afe9d);fs[_0xddd9('0x2a')](_0x5614bd,_0xddd9('0x2b'));}catch(_0x10d5cd){logger[_0xddd9('0x16')](_0x10d5cd);}logger[_0xddd9('0x23')](_0xddd9('0x4c'),_0x5614bd[_0xddd9('0x3b')]('.')[0x0]);return _0x5614bd['split']('.')[0x0];});};exports[_0xddd9('0x4d')]=function(_0x302764,_0xe5c41,_0x4b4ac8){return google[_0xddd9('0x4e')](_0x302764,_0xe5c41,_0x4b4ac8)[_0xddd9('0x29')](function(_0x19723c){logger['info'](_0x19723c['uri']);return rp(_0x19723c);})[_0xddd9('0x29')](function(_0x1ef2ef){var _0x2ebcb4='';var _0x4bfed9=0x0;try{fs['unlink'](_0x302764);}catch(_0x177a85){logger[_0xddd9('0x16')](_0x177a85);}if(_0x1ef2ef&&_0x1ef2ef[_0xddd9('0x4f')]){_0x2ebcb4=_0x1ef2ef[_0xddd9('0x4f')][_0xddd9('0x50')](function(_0x5114ad){return _0x5114ad&&_0x5114ad[_0xddd9('0x51')][0x0]&&_0x5114ad['alternatives'][0x0]['transcript']?_0x5114ad[_0xddd9('0x51')][0x0][_0xddd9('0x52')]:'';})[_0xddd9('0x53')]('\x0a');_0x4bfed9=_0x1ef2ef['results'][_0xddd9('0x50')](function(_0x181033){return _0x181033&&_0x181033['alternatives'][0x0]&&_0x181033[_0xddd9('0x51')][0x0][_0xddd9('0x54')]?_0x181033[_0xddd9('0x51')][0x0][_0xddd9('0x54')]:0x0;})[_0xddd9('0x53')]('\x0a');}logger[_0xddd9('0x23')]('googleASR\x20transcription',_0x2ebcb4);logger[_0xddd9('0x23')](_0xddd9('0x55'),_0x4bfed9);return{'transcript':_0x2ebcb4,'confidence':_0x4bfed9};})[_0xddd9('0x56')](function(_0x1c89b0){logger['error']('[%s]\x20%s:%s',_0x1c89b0[_0xddd9('0x15')],_0x1c89b0[_0xddd9('0x57')],_0x1c89b0[_0xddd9('0x58')]);});};exports[_0xddd9('0x59')]=function(_0x1591a0,_0x53ba91,_0x349a1d,_0xbca39b){var _0x555949=apiai(_0x53ba91,{'language':_0xbca39b||'en'});return _0x555949['textRequest'](_0x349a1d,{'sessionId':md5(_0x1591a0)})[_0xddd9('0x29')](function(_0x793c3f){logger[_0xddd9('0x23')](JSON[_0xddd9('0x40')](_0x793c3f));return{'source':_0x793c3f[_0xddd9('0x5a')]['source'],'resolvedQuery':_0x793c3f['result'][_0xddd9('0x5b')],'action':_0x793c3f[_0xddd9('0x5a')][_0xddd9('0x5c')],'actionIncomplete':_0x793c3f[_0xddd9('0x5a')][_0xddd9('0x5d')],'speech':_0x793c3f[_0xddd9('0x5a')]['fulfillment']['speech'],'score':_0x793c3f[_0xddd9('0x5a')]['score'],'statusCode':_0x793c3f[_0xddd9('0x5e')][_0xddd9('0x5f')],'endConversation':_0x793c3f['result']['metadata']['endConversation']||![],'isFallbackIntent':_0x793c3f[_0xddd9('0x5a')]['metadata'][_0xddd9('0x60')]};});};exports[_0xddd9('0x61')]=function(_0x2f3123,_0x31087f,_0x3398bf,_0x389ba7,_0x2cc5f8,_0x2f37a1){var _0x4146b5=_0x389ba7[_0xddd9('0x62')](/\\n/g,'\x0a');var _0x188c11={'credentials':{'private_key':_0x4146b5,'client_email':_0x3398bf}};var _0x219929=new dialogflow['SessionsClient'](_0x188c11);var _0xca71f9=_0x219929[_0xddd9('0x63')](_0x31087f,md5(_0x2f3123));var _0x13acaf={'session':_0xca71f9,'queryInput':{'text':{'text':_0x2cc5f8,'languageCode':_0x2f37a1}}};return _0x219929[_0xddd9('0x64')](_0x13acaf)[_0xddd9('0x29')](function(_0x2f998e){if(_0x2f998e&&_0x2f998e[_0xddd9('0x46')]){logger[_0xddd9('0x23')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x2f998e));var _0x3f11dd=_0x2f998e[0x0];if(_0x3f11dd){var _0x368243={'action':_0x3f11dd['queryResult']['action'],'allRequiredParamsPresent':_0x3f11dd[_0xddd9('0x65')][_0xddd9('0x66')],'endConversation':_0x3f11dd[_0xddd9('0x65')][_0xddd9('0x67')]&&_0x3f11dd[_0xddd9('0x65')][_0xddd9('0x67')][_0xddd9('0x68')]?_0x3f11dd[_0xddd9('0x65')][_0xddd9('0x67')][_0xddd9('0x68')][_0xddd9('0x69')][_0xddd9('0x6a')]:![],'fulfillmentText':_0x3f11dd[_0xddd9('0x65')][_0xddd9('0x6b')],'intentName':_0x3f11dd['queryResult'][_0xddd9('0x6c')][_0xddd9('0x57')],'intentDisplayName':_0x3f11dd[_0xddd9('0x65')][_0xddd9('0x6c')][_0xddd9('0x6d')],'isFallbackIntent':_0x3f11dd[_0xddd9('0x65')]['intent'][_0xddd9('0x6e')],'languageCode':_0x3f11dd[_0xddd9('0x65')]['languageCode'],'queryText':_0x3f11dd[_0xddd9('0x65')][_0xddd9('0x6f')],'responseId':_0x3f11dd[_0xddd9('0x70')],'score':_0x3f11dd[_0xddd9('0x65')][_0xddd9('0x71')],'speech':_0x3f11dd[_0xddd9('0x65')][_0xddd9('0x6b')],'providerResponse':JSON[_0xddd9('0x40')](_0x2f998e)};return _0x368243;}}});};exports['tildeASR']=function(_0x10c2e6,_0x1e77f4,_0x4d1ecf,_0x3dcfe6){return tilde['asr'](_0x10c2e6,_0x1e77f4,_0x4d1ecf,_0x3dcfe6)[_0xddd9('0x29')](function(_0x2c95f3){try{fs['unlink'](_0x10c2e6);}catch(_0x11082e){logger[_0xddd9('0x16')](_0x11082e);}logger[_0xddd9('0x23')](_0xddd9('0x72'),_0x2c95f3['transcript']);logger[_0xddd9('0x23')](_0xddd9('0x73'),_0x2c95f3[_0xddd9('0x54')]);return _0x2c95f3;});};exports['awsPolly']=function(_0x5474c0,_0x2ec520,_0x3f97ec,_0x566b86,_0x5e53a8,_0xfef781){var _0x5ce297=path['resolve'](__dirname,_0xddd9('0x36'),rs['generate'](0x4)+_0xddd9('0x4a'));var _0xc906a2;return aws[_0xddd9('0x74')](_0x5474c0,_0x2ec520,_0x3f97ec,_0x566b86,_0x5e53a8,_0xfef781,_0x5ce297)[_0xddd9('0x29')](function(){_0xc906a2=path[_0xddd9('0x25')](__dirname,_0xddd9('0x36'),rs[_0xddd9('0x26')](0x4)+'.wav');return convertFile(_0x5ce297,_0xc906a2);})['then'](function(){try{fs[_0xddd9('0x1d')](_0x5ce297);fs[_0xddd9('0x2a')](_0xc906a2,'777');}catch(_0x1b59b8){logger[_0xddd9('0x16')](_0x1b59b8);}return _0xc906a2[_0xddd9('0x3b')]('.')[0x0];});};exports[_0xddd9('0x75')]=function(_0x4bd35d,_0x531044,_0x4ee7fe,_0x278208,_0x4b6e00,_0x2bb27f){return aws[_0xddd9('0x76')](_0x4bd35d,_0x531044,_0x4ee7fe,_0x278208,_0x4b6e00,_0x2bb27f)['then'](function(_0x5dee60){logger['info'](JSON['stringify'](_0x5dee60));return _0x5dee60;});};exports[_0xddd9('0x77')]=function(_0x1df2a6,_0x586ff2,_0x2ff009,_0x2fa424){var _0x43f83c=util['format'](_0xddd9('0x78'),ISPEECH_API,_0x1df2a6,encodeURIComponent(_0x586ff2),_0x2ff009,_0x2fa424);var _0x11c8e3=path[_0xddd9('0x25')](__dirname,_0xddd9('0x36'),rs[_0xddd9('0x26')](0x4)+_0xddd9('0x4a'));var _0x4f95a6;return downloadFile(_0x43f83c,_0x11c8e3)[_0xddd9('0x29')](function(){_0x4f95a6=path[_0xddd9('0x25')](__dirname,_0xddd9('0x36'),rs[_0xddd9('0x26')](0x4)+_0xddd9('0x27'));return convertFile(_0x11c8e3,_0x4f95a6);})[_0xddd9('0x29')](function(){try{fs[_0xddd9('0x1d')](_0x11c8e3);fs[_0xddd9('0x2a')](_0x4f95a6,'777');}catch(_0x44ec91){logger[_0xddd9('0x16')](_0x44ec91);}return _0x4f95a6[_0xddd9('0x3b')]('.')[0x0];});};exports[_0xddd9('0x79')]=function(_0x523d25,_0x46a84d,_0x3146ff,_0x537e04){var _0x23df12=util[_0xddd9('0x7a')](_0xddd9('0x7b'),ISPEECH_API,_0x46a84d,_0x3146ff,base64Encode(_0x523d25),_0x537e04?util[_0xddd9('0x7a')]('model=%s',encodeURIComponent(_0x537e04)):_0xddd9('0x7c'));return uploadFile(_0x23df12)[_0xddd9('0x29')](function(_0x35989a){return querystring[_0xddd9('0x7d')](_0x35989a);});};exports[_0xddd9('0x7e')]=function(_0x23eee0,_0x50f12d){return sestek[_0xddd9('0x7f')](_0x23eee0,_0x50f12d)[_0xddd9('0x29')](function(_0x3e5c90){logger[_0xddd9('0x23')](JSON[_0xddd9('0x40')](_0x3e5c90));var _0x1b46c1={'speech':_0x3e5c90[_0xddd9('0x80')],'action':_0x3e5c90['channelData']?_0x3e5c90[_0xddd9('0x81')]['CustomAction']:undefined,'actiondata':_0x3e5c90[_0xddd9('0x81')]?_0x3e5c90[_0xddd9('0x81')][_0xddd9('0x82')]:undefined};if(_0x3e5c90['channelData']&&_0x3e5c90[_0xddd9('0x81')]['AudioFromTts']){return base64Decode(_0x3e5c90[_0xddd9('0x81')][_0xddd9('0x83')][_0xddd9('0x84')],path[_0xddd9('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0xddd9('0x27')))[_0xddd9('0x29')](function(_0x1531e7){_0x1b46c1[_0xddd9('0x85')]=_0x1531e7;return _0x1b46c1;});}return _0x1b46c1;});};exports[_0xddd9('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0x84a2=['sestekNDA','nda','channelData','CustomAction','CustomActionData','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','md5','path','querystring','google-tts-api','url','parse','util','./aws','./google','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','finish','close','unlink','download\x20error','pipe','get','data','end','wav','error\x20convert','info','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','.mp3','from','writeFile','chmodSync','777','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','uri','results','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','replace','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','ispeechASR','model=%s','freeform=3'];(function(_0x1eb112,_0x29f162){var _0x1e8cb6=function(_0x4336f9){while(--_0x4336f9){_0x1eb112['push'](_0x1eb112['shift']());}};_0x1e8cb6(++_0x29f162);}(_0x84a2,0x10e));var _0x284a=function(_0x4dcac4,_0x10e48a){_0x4dcac4=_0x4dcac4-0x0;var _0x2a238d=_0x84a2[_0x4dcac4];return _0x2a238d;};'use strict';var apiai=require(_0x284a('0x0'));var BPromise=require(_0x284a('0x1'));var dialogflow=require(_0x284a('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x284a('0x3'));var path=require(_0x284a('0x4'));var querystring=require(_0x284a('0x5'));var rp=require('request-promise');var rs=require('randomstring');var sox=require('sox');var tts=require(_0x284a('0x6'));var urlParse=require(_0x284a('0x7'))[_0x284a('0x8')];var util=require(_0x284a('0x9'));var aws=require(_0x284a('0xa'));var google=require(_0x284a('0xb'));var sestek=require('./sestek');var tilde=require('./tilde');var logger=require(_0x284a('0xc'))(_0x284a('0xd'));var ISPEECH_API=_0x284a('0xe');function downloadFile(_0x3d6710,_0x1e261b){return new BPromise(function(_0x5c6901,_0xfc21c9){var _0xca28f7=urlParse(_0x3d6710);var _0x10ec89=_0xca28f7[_0x284a('0xf')]===_0x284a('0x10')?https:http;var _0x2606a5={'host':_0xca28f7[_0x284a('0x11')],'path':_0xca28f7['path'],'headers':{'user-agent':_0x284a('0x12')}};_0x10ec89['get'](_0x2606a5,function(_0x2f0b21){if(_0x2f0b21[_0x284a('0x13')]!==0xc8){logger[_0x284a('0x14')]('request\x20to\x20'+_0x3d6710+_0x284a('0x15')+_0x2f0b21[_0x284a('0x13')]+'\x20('+_0x2f0b21[_0x284a('0x16')]+')');_0xfc21c9(new Error(_0x284a('0x17')+_0x3d6710+_0x284a('0x15')+_0x2f0b21[_0x284a('0x13')]+'\x20('+_0x2f0b21[_0x284a('0x16')]+')'));return;}var _0x301a46=fs['createWriteStream'](_0x1e261b);_0x301a46['on'](_0x284a('0x18'),function(){logger['info']('finish\x20download\x20file');_0x301a46[_0x284a('0x19')](_0x5c6901);});_0x301a46['on'](_0x284a('0x14'),function(_0x2ca524){fs[_0x284a('0x1a')](_0x1e261b);logger[_0x284a('0x14')](_0x284a('0x1b'),_0x2ca524);_0xfc21c9(_0x2ca524);});_0x2f0b21[_0x284a('0x1c')](_0x301a46);})['on'](_0x284a('0x14'),function(_0x5edce1){logger[_0x284a('0x14')](_0x5edce1);_0xfc21c9(_0x5edce1);})['end']();});}function uploadFile(_0x3efe7f){return new BPromise(function(_0x325d33,_0x579441){var _0x2fb37a=urlParse(_0x3efe7f);var _0x3ad572=_0x2fb37a[_0x284a('0xf')]===_0x284a('0x10')?https:http;var _0x3a6737={'host':_0x2fb37a[_0x284a('0x11')],'path':_0x2fb37a[_0x284a('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x3ad572[_0x284a('0x1d')](_0x3a6737,function(_0xebdcd4){if(_0xebdcd4[_0x284a('0x13')]!==0xc8){_0x579441(new Error(_0x284a('0x17')+_0x3efe7f+_0x284a('0x15')+_0xebdcd4[_0x284a('0x13')]+'\x20('+_0xebdcd4[_0x284a('0x16')]+')'));return;}var _0x1453ca='';_0xebdcd4['on'](_0x284a('0x1e'),function(_0x4a8397){_0x1453ca+=_0x4a8397;});_0xebdcd4['on'](_0x284a('0x1f'),function(){_0x325d33(_0x1453ca);});})['on'](_0x284a('0x14'),function(_0x1f6cbd){_0x579441(_0x1f6cbd);})['end']();});}function convertFile(_0xe5b47e,_0x2ae5c6){return new BPromise(function(_0x523412,_0x7c04c9){var _0x206038=sox['transcode'](_0xe5b47e,_0x2ae5c6,{'sampleRate':0x1f40,'format':_0x284a('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x206038['on'](_0x284a('0x14'),function(_0x41022b){logger[_0x284a('0x14')](_0x284a('0x21'),_0x41022b);_0x7c04c9(_0x41022b);});_0x206038['on'](_0x284a('0x1f'),function(){logger[_0x284a('0x22')](_0x284a('0x23'));_0x523412();});_0x206038['start']();});}function base64Decode(_0x4da378,_0x5776b1){var _0x4e6864=path[_0x284a('0x24')](__dirname,_0x284a('0x25'),rs[_0x284a('0x26')](0x4)+_0x284a('0x27'));fs[_0x284a('0x28')](_0x4e6864,_0x4da378,_0x284a('0x29'));return convertFile(_0x4e6864,_0x5776b1)[_0x284a('0x2a')](function(){try{fs[_0x284a('0x1a')](_0x4e6864);fs['chmodSync'](_0x5776b1,'777');}catch(_0x17ebdc){logger[_0x284a('0x14')](_0x17ebdc);}return _0x5776b1[_0x284a('0x2b')]('.')[0x0];});}function base64Encode(_0xbffc44){var _0x497554=fs[_0x284a('0x2c')](_0xbffc44);return new Buffer(_0x497554)[_0x284a('0x2d')](_0x284a('0x29'));}exports['googleCloudTTS']=function(_0x185cf5,_0x394a12,_0x420073,_0x3b93cb,_0x5c7410,_0x55c46a){var _0x321227,_0x51ca34;var _0x48d869=_0x284a('0x2e');var _0x5bc253=_0x284a('0x2f')+_0x185cf5;var _0x1ce755={};if(_0x394a12===_0x284a('0x30')){_0x1ce755[_0x284a('0x31')]={'ssml':_0x420073};}else{_0x1ce755['input']={'text':_0x420073};};_0x1ce755[_0x284a('0x32')]={'languageCode':_0x3b93cb,'ssmlGender':_0x5c7410};_0x1ce755[_0x284a('0x33')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x4f1a9a={'url':_0x48d869+_0x284a('0x34')+_0x5bc253,'method':'POST','json':!![],'body':_0x1ce755};return rp(_0x4f1a9a)[_0x284a('0x2a')](function(_0x5e9770){return new BPromise(function(_0x27cbf6,_0x23282f){_0x321227=path['resolve'](__dirname,_0x284a('0x25'),rs[_0x284a('0x26')](0x4)+_0x284a('0x35'));var _0x7ca45e=Buffer[_0x284a('0x36')](_0x5e9770['audioContent'],_0x284a('0x29'));return fs[_0x284a('0x37')](_0x321227,_0x7ca45e,function(_0x22d321){_0x23282f(_0x22d321);},function(_0x2fb638){fs[_0x284a('0x38')](_0x321227,_0x284a('0x39'));_0x27cbf6(_0x2fb638);});});})[_0x284a('0x2a')](function(_0x34051b){_0x51ca34=path['resolve'](__dirname,'tmp',rs[_0x284a('0x26')](0x4)+_0x284a('0x27'));return convertFile(_0x321227,_0x51ca34);})['then'](function(){try{fs[_0x284a('0x1a')](_0x321227);fs[_0x284a('0x38')](_0x51ca34,'777');}catch(_0x1a19a3){logger[_0x284a('0x14')](_0x1a19a3);}logger[_0x284a('0x22')](_0x284a('0x3a'),_0x51ca34[_0x284a('0x2b')]('.')[0x0]);return _0x51ca34[_0x284a('0x2b')]('.')[0x0];});};exports[_0x284a('0x3b')]=function(_0x56c55d,_0x981bbb){var _0x4375be='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x200b83,_0x4917cf;var _0x175f61;var _0x5a0dd9={'encoding':_0x284a('0x3c'),'method':'POST','timeout':0x2710,'url':_0x4375be,'headers':{'Content-Type':_0x284a('0x3d')},'body':'f.req='+encodeURIComponent(JSON[_0x284a('0x3e')]([[[_0x284a('0x3f'),JSON[_0x284a('0x3e')]([_0x56c55d,_0x981bbb||'en',![],_0x284a('0x40')]),null,_0x284a('0x41')]]]))};return rp(_0x5a0dd9)[_0x284a('0x2a')](function(_0x32ce01){try{_0x175f61=eval(_0x32ce01[_0x284a('0x42')](0x5))[0x0][0x2];}catch(_0xa7b0de){throw new Error('parse\x20response\x20failed:\x0a'+_0x32ce01[_0x284a('0x1e')]);}if(!_0x175f61){if(_0x56c55d[_0x284a('0x43')]>0xc8){throw new Error(_0x284a('0x44'));}else{throw new Error(_0x284a('0x45')+_0x981bbb+_0x284a('0x46'));}}try{_0x175f61=eval(_0x175f61)[0x0];}catch(_0x42575f){throw new Error(_0x284a('0x47')+res[_0x284a('0x1e')]);}const _0x5f5c8e=_0x175f61;_0x200b83=path[_0x284a('0x24')](__dirname,_0x284a('0x25'),rs[_0x284a('0x26')](0x4)+'.mp3');fs[_0x284a('0x28')](_0x200b83,_0x175f61,{'encoding':_0x284a('0x29')});_0x4917cf=path[_0x284a('0x24')](__dirname,_0x284a('0x25'),rs['generate'](0x4)+'.wav');return convertFile(_0x200b83,_0x4917cf);})[_0x284a('0x2a')](function(){try{fs[_0x284a('0x1a')](_0x200b83);fs['chmodSync'](_0x4917cf,_0x284a('0x39'));}catch(_0x30364e){logger[_0x284a('0x14')](_0x30364e);}logger['info'](_0x284a('0x48'),_0x4917cf[_0x284a('0x2b')]('.')[0x0]);return _0x4917cf['split']('.')[0x0];});};exports[_0x284a('0x49')]=function(_0x36c1a5,_0x1a6435,_0x27b571){return google['asr'](_0x36c1a5,_0x1a6435,_0x27b571)[_0x284a('0x2a')](function(_0x476d40){logger[_0x284a('0x22')](_0x476d40[_0x284a('0x4a')]);return rp(_0x476d40);})[_0x284a('0x2a')](function(_0x16d80d){var _0x46ed01='';var _0x585889=0x0;try{fs[_0x284a('0x1a')](_0x36c1a5);}catch(_0xf79dbe){logger['error'](_0xf79dbe);}if(_0x16d80d&&_0x16d80d[_0x284a('0x4b')]){_0x46ed01=_0x16d80d['results']['map'](function(_0x3d36c7){return _0x3d36c7&&_0x3d36c7[_0x284a('0x4c')][0x0]&&_0x3d36c7[_0x284a('0x4c')][0x0][_0x284a('0x4d')]?_0x3d36c7[_0x284a('0x4c')][0x0][_0x284a('0x4d')]:'';})['join']('\x0a');_0x585889=_0x16d80d['results']['map'](function(_0x4a0dda){return _0x4a0dda&&_0x4a0dda[_0x284a('0x4c')][0x0]&&_0x4a0dda[_0x284a('0x4c')][0x0][_0x284a('0x4e')]?_0x4a0dda['alternatives'][0x0][_0x284a('0x4e')]:0x0;})[_0x284a('0x4f')]('\x0a');}logger[_0x284a('0x22')](_0x284a('0x50'),_0x46ed01);logger[_0x284a('0x22')](_0x284a('0x51'),_0x585889);return{'transcript':_0x46ed01,'confidence':_0x585889};})['catch'](function(_0x2f42b5){logger[_0x284a('0x14')](_0x284a('0x52'),_0x2f42b5[_0x284a('0x13')],_0x2f42b5[_0x284a('0x53')],_0x2f42b5['message']);});};exports[_0x284a('0x54')]=function(_0x27a743,_0x48c0ef,_0x4e9de3,_0x21dd0b){var _0x2f037b=apiai(_0x48c0ef,{'language':_0x21dd0b||'en'});return _0x2f037b[_0x284a('0x55')](_0x4e9de3,{'sessionId':md5(_0x27a743)})[_0x284a('0x2a')](function(_0x4288f8){logger[_0x284a('0x22')](JSON[_0x284a('0x3e')](_0x4288f8));return{'source':_0x4288f8[_0x284a('0x56')]['source'],'resolvedQuery':_0x4288f8[_0x284a('0x56')]['resolvedQuery'],'action':_0x4288f8[_0x284a('0x56')][_0x284a('0x57')],'actionIncomplete':_0x4288f8[_0x284a('0x56')][_0x284a('0x58')],'speech':_0x4288f8[_0x284a('0x56')][_0x284a('0x59')][_0x284a('0x5a')],'score':_0x4288f8[_0x284a('0x56')][_0x284a('0x5b')],'statusCode':_0x4288f8[_0x284a('0x5c')][_0x284a('0x5d')],'endConversation':_0x4288f8[_0x284a('0x56')][_0x284a('0x5e')][_0x284a('0x5f')]||![],'isFallbackIntent':_0x4288f8[_0x284a('0x56')][_0x284a('0x5e')]['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x18689a,_0x7254c5,_0x3bae29,_0x5745ff,_0xce648a,_0x4dd96b){var _0x4e144c=_0x5745ff[_0x284a('0x60')](/\\n/g,'\x0a');var _0x558a95={'credentials':{'private_key':_0x4e144c,'client_email':_0x3bae29}};var _0x4a61d5=new dialogflow['SessionsClient'](_0x558a95);var _0x47129d=_0x4a61d5['sessionPath'](_0x7254c5,md5(_0x18689a));var _0x49a7ed={'session':_0x47129d,'queryInput':{'text':{'text':_0xce648a,'languageCode':_0x4dd96b}}};return _0x4a61d5[_0x284a('0x61')](_0x49a7ed)[_0x284a('0x2a')](function(_0x5d7550){if(_0x5d7550&&_0x5d7550[_0x284a('0x43')]){logger[_0x284a('0x22')](_0x284a('0x62'),JSON['stringify'](_0x5d7550));var _0x388d66=_0x5d7550[0x0];if(_0x388d66){var _0x5bf44f={'action':_0x388d66[_0x284a('0x63')]['action'],'allRequiredParamsPresent':_0x388d66[_0x284a('0x63')][_0x284a('0x64')],'endConversation':_0x388d66[_0x284a('0x63')][_0x284a('0x65')]&&_0x388d66[_0x284a('0x63')][_0x284a('0x65')]['fields']?_0x388d66[_0x284a('0x63')][_0x284a('0x65')][_0x284a('0x66')][_0x284a('0x67')]['boolValue']:![],'fulfillmentText':_0x388d66[_0x284a('0x63')][_0x284a('0x68')],'intentName':_0x388d66[_0x284a('0x63')][_0x284a('0x69')][_0x284a('0x53')],'intentDisplayName':_0x388d66['queryResult'][_0x284a('0x69')][_0x284a('0x6a')],'isFallbackIntent':_0x388d66[_0x284a('0x63')]['intent'][_0x284a('0x6b')],'languageCode':_0x388d66['queryResult'][_0x284a('0x6c')],'queryText':_0x388d66[_0x284a('0x63')]['queryText'],'responseId':_0x388d66[_0x284a('0x6d')],'score':_0x388d66['queryResult'][_0x284a('0x6e')],'speech':_0x388d66['queryResult'][_0x284a('0x68')],'providerResponse':JSON[_0x284a('0x3e')](_0x5d7550)};return _0x5bf44f;}}});};exports['tildeASR']=function(_0x41d5a4,_0x464c9c,_0x55d94c,_0x5f069d){return tilde[_0x284a('0x6f')](_0x41d5a4,_0x464c9c,_0x55d94c,_0x5f069d)[_0x284a('0x2a')](function(_0x30204a){try{fs[_0x284a('0x1a')](_0x41d5a4);}catch(_0x1276d7){logger[_0x284a('0x14')](_0x1276d7);}logger['info'](_0x284a('0x70'),_0x30204a[_0x284a('0x4d')]);logger[_0x284a('0x22')](_0x284a('0x71'),_0x30204a['confidence']);return _0x30204a;});};exports[_0x284a('0x72')]=function(_0x53d6ce,_0x54de0c,_0x3ce6b5,_0x5a0887,_0x562257,_0x13bd7b){var _0x48a6bc=path[_0x284a('0x24')](__dirname,_0x284a('0x25'),rs[_0x284a('0x26')](0x4)+_0x284a('0x35'));var _0x3652c9;return aws[_0x284a('0x73')](_0x53d6ce,_0x54de0c,_0x3ce6b5,_0x5a0887,_0x562257,_0x13bd7b,_0x48a6bc)[_0x284a('0x2a')](function(){_0x3652c9=path['resolve'](__dirname,'tmp',rs[_0x284a('0x26')](0x4)+_0x284a('0x27'));return convertFile(_0x48a6bc,_0x3652c9);})['then'](function(){try{fs['unlink'](_0x48a6bc);fs[_0x284a('0x38')](_0x3652c9,_0x284a('0x39'));}catch(_0x4dafe5){logger[_0x284a('0x14')](_0x4dafe5);}return _0x3652c9['split']('.')[0x0];});};exports[_0x284a('0x74')]=function(_0x569b3c,_0x367479,_0x6c65d9,_0x172db8,_0x2abafd,_0x497bfd){return aws[_0x284a('0x75')](_0x569b3c,_0x367479,_0x6c65d9,_0x172db8,_0x2abafd,_0x497bfd)[_0x284a('0x2a')](function(_0x40c492){logger['info'](JSON[_0x284a('0x3e')](_0x40c492));return _0x40c492;});};exports[_0x284a('0x76')]=function(_0x586411,_0x44e99e,_0x488baf,_0x42de70){var _0x504fa7=util[_0x284a('0x77')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x586411,encodeURIComponent(_0x44e99e),_0x488baf,_0x42de70);var _0x28cce5=path[_0x284a('0x24')](__dirname,_0x284a('0x25'),rs[_0x284a('0x26')](0x4)+_0x284a('0x35'));var _0x32c958;return downloadFile(_0x504fa7,_0x28cce5)[_0x284a('0x2a')](function(){_0x32c958=path[_0x284a('0x24')](__dirname,_0x284a('0x25'),rs[_0x284a('0x26')](0x4)+_0x284a('0x27'));return convertFile(_0x28cce5,_0x32c958);})[_0x284a('0x2a')](function(){try{fs[_0x284a('0x1a')](_0x28cce5);fs[_0x284a('0x38')](_0x32c958,_0x284a('0x39'));}catch(_0x58a2b7){logger[_0x284a('0x14')](_0x58a2b7);}return _0x32c958['split']('.')[0x0];});};exports[_0x284a('0x78')]=function(_0x49cb05,_0x2a158e,_0x4f8669,_0x53fd5c){var _0x2f0520=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x2a158e,_0x4f8669,base64Encode(_0x49cb05),_0x53fd5c?util[_0x284a('0x77')](_0x284a('0x79'),encodeURIComponent(_0x53fd5c)):_0x284a('0x7a'));return uploadFile(_0x2f0520)[_0x284a('0x2a')](function(_0x336fa8){return querystring[_0x284a('0x8')](_0x336fa8);});};exports[_0x284a('0x7b')]=function(_0xcee71f,_0x1cb645){return sestek[_0x284a('0x7c')](_0xcee71f,_0x1cb645)[_0x284a('0x2a')](function(_0x192e7b){logger[_0x284a('0x22')](JSON[_0x284a('0x3e')](_0x192e7b));var _0x319add={'speech':_0x192e7b['text'],'action':_0x192e7b[_0x284a('0x7d')]?_0x192e7b[_0x284a('0x7d')][_0x284a('0x7e')]:undefined,'actiondata':_0x192e7b[_0x284a('0x7d')]?_0x192e7b['channelData'][_0x284a('0x7f')]:undefined};if(_0x192e7b[_0x284a('0x7d')]&&_0x192e7b[_0x284a('0x7d')]['AudioFromTts']){return base64Decode(_0x192e7b['channelData']['AudioFromTts'][_0x284a('0x80')],path[_0x284a('0x24')](__dirname,_0x284a('0x25'),rs[_0x284a('0x26')](0x4)+_0x284a('0x27')))[_0x284a('0x2a')](function(_0x430869){_0x319add[_0x284a('0x81')]=_0x430869;return _0x319add;});}return _0x319add;});};exports[_0x284a('0x82')]=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 c6bd69c..57217d4 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 _0xdd90=['./nda','exports'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0xdd90,0x14c));var _0x0dd9=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xdd90[_0x1cc8fe];return _0x230054;};var nda=require(_0x0dd9('0x0'));module[_0x0dd9('0x1')]={'nda':nda}; \ No newline at end of file +var _0xaf19=['exports','./nda'];(function(_0x233cb1,_0x8ca9a2){var _0x29ee7e=function(_0x20e277){while(--_0x20e277){_0x233cb1['push'](_0x233cb1['shift']());}};_0x29ee7e(++_0x8ca9a2);}(_0xaf19,0xb3));var _0x9af1=function(_0x5e320d,_0x3df3f9){_0x5e320d=_0x5e320d-0x0;var _0x186d1d=_0xaf19[_0x5e320d];return _0x186d1d;};var nda=require(_0x9af1('0x0'));module[_0x9af1('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 47ec6bd..7aac525 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 _0x8b29=['project','body','channelData','ndagenerate_audio','CustomAction','CustomActionData','custom_action_data','info','request-promise','../../../../../config/logger','agi','resolve','/token','password','username','then','POST','ndassistant_url','message','Nda','uniqueid','callerid','calleridname','dnid','text','Bearer\x20'];(function(_0x2b549d,_0x514391){var _0xe449f=function(_0x3e5aa2){while(--_0x3e5aa2){_0x2b549d['push'](_0x2b549d['shift']());}};_0xe449f(++_0x514391);}(_0x8b29,0xbe));var _0x98b2=function(_0x12906f,_0x1c0701){_0x12906f=_0x12906f-0x0;var _0x435998=_0x8b29[_0x12906f];return _0x435998;};'use strict';var rp=require(_0x98b2('0x0'));var url=require('url');var logger=require(_0x98b2('0x1'))(_0x98b2('0x2'));module['exports']=function(_0x51b66a,_0x2363fe){var _0x20afa9={'method':'POST','uri':url[_0x98b2('0x3')](_0x2363fe['ndauth_url'],_0x98b2('0x4')),'form':{'grant_type':_0x98b2('0x5'),'username':_0x2363fe[_0x98b2('0x6')],'password':_0x2363fe[_0x98b2('0x5')]},'json':!![]};return rp(_0x20afa9)[_0x98b2('0x7')](function(_0x2cd0cb){var _0x417ca6={'method':_0x98b2('0x8'),'uri':url[_0x98b2('0x3')](_0x2363fe[_0x98b2('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x2363fe['ndaactivity_type']||_0x98b2('0xa'),'channelId':_0x98b2('0xb'),'conversation':{'id':_0x51b66a[_0x98b2('0xc')]},'from':{'id':_0x51b66a[_0x98b2('0xd')],'name':_0x51b66a[_0x98b2('0xe')]},'recipient':{'id':_0x51b66a[_0x98b2('0xf')],'name':_0x51b66a['extension']},'text':_0x2363fe[_0x98b2('0x10')],'channelData':{}},'headers':{'Authorization':_0x98b2('0x11')+_0x2cd0cb['access_token']},'json':!![]};if(_0x2363fe[_0x98b2('0x12')]){_0x417ca6[_0x98b2('0x13')][_0x98b2('0x14')]['ProjectName']=_0x2363fe['project'];}if(_0x2363fe[_0x98b2('0x15')]=='1'){_0x417ca6['body'][_0x98b2('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x2363fe['custom_action']){_0x417ca6[_0x98b2('0x13')][_0x98b2('0x14')][_0x98b2('0x16')]=_0x2363fe['custom_action'];if(_0x2363fe['custom_action_data']){_0x417ca6['body'][_0x98b2('0x14')][_0x98b2('0x17')]=_0x2363fe[_0x98b2('0x18')];}}logger[_0x98b2('0x19')](JSON['stringify'](_0x417ca6));return rp(_0x417ca6);});}; \ No newline at end of file +var _0xed8a=['uniqueid','callerid','calleridname','dnid','Bearer\x20','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','POST','resolve','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda'];(function(_0x35f7df,_0x568a64){var _0x1b9369=function(_0x4b5a05){while(--_0x4b5a05){_0x35f7df['push'](_0x35f7df['shift']());}};_0x1b9369(++_0x568a64);}(_0xed8a,0xc5));var _0xaed8=function(_0x2f9ef2,_0x186868){_0x2f9ef2=_0x2f9ef2-0x0;var _0x2dc192=_0xed8a[_0x2f9ef2];return _0x2dc192;};'use strict';var rp=require(_0xaed8('0x0'));var url=require(_0xaed8('0x1'));var logger=require(_0xaed8('0x2'))(_0xaed8('0x3'));module['exports']=function(_0x395bb7,_0x3888ee){var _0x4b9c23={'method':_0xaed8('0x4'),'uri':url[_0xaed8('0x5')](_0x3888ee['ndauth_url'],'/token'),'form':{'grant_type':_0xaed8('0x6'),'username':_0x3888ee[_0xaed8('0x7')],'password':_0x3888ee[_0xaed8('0x6')]},'json':!![]};return rp(_0x4b9c23)[_0xaed8('0x8')](function(_0x291304){var _0x42bc11={'method':_0xaed8('0x4'),'uri':url['resolve'](_0x3888ee[_0xaed8('0x9')],_0xaed8('0xa')),'body':{'type':_0x3888ee[_0xaed8('0xb')]||'message','channelId':_0xaed8('0xc'),'conversation':{'id':_0x395bb7[_0xaed8('0xd')]},'from':{'id':_0x395bb7[_0xaed8('0xe')],'name':_0x395bb7[_0xaed8('0xf')]},'recipient':{'id':_0x395bb7[_0xaed8('0x10')],'name':_0x395bb7['extension']},'text':_0x3888ee['text'],'channelData':{}},'headers':{'Authorization':_0xaed8('0x11')+_0x291304['access_token']},'json':!![]};if(_0x3888ee[_0xaed8('0x12')]){_0x42bc11[_0xaed8('0x13')][_0xaed8('0x14')][_0xaed8('0x15')]=_0x3888ee['project'];}if(_0x3888ee[_0xaed8('0x16')]=='1'){_0x42bc11[_0xaed8('0x13')][_0xaed8('0x14')][_0xaed8('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xaed8('0x18')};}if(_0x3888ee[_0xaed8('0x19')]){_0x42bc11['body'][_0xaed8('0x14')]['CustomAction']=_0x3888ee[_0xaed8('0x19')];if(_0x3888ee[_0xaed8('0x1a')]){_0x42bc11['body'][_0xaed8('0x14')][_0xaed8('0x1b')]=_0x3888ee[_0xaed8('0x1a')];}}logger[_0xaed8('0x1c')](JSON[_0xaed8('0x1d')](_0x42bc11));return rp(_0x42bc11);});}; \ 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 7da8593..21ab076 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 _0xfe33=['./lib/api','exports'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0xfe33,0x13e));var _0x3fe3=function(_0x4a3acd,_0x4bf641){_0x4a3acd=_0x4a3acd-0x0;var _0x3efdaa=_0xfe33[_0x4a3acd];return _0x3efdaa;};'use strict';var asr=require(_0x3fe3('0x0'));module[_0x3fe3('0x1')]=function(_0x484b00,_0x8b3571,_0xe1d693,_0x103df6){return asr(_0x484b00,_0x8b3571,_0xe1d693,_0x103df6);}; \ No newline at end of file +var _0xef68=['./lib/api','exports'];(function(_0x323d87,_0x4ef3f9){var _0x5e8f74=function(_0x185735){while(--_0x185735){_0x323d87['push'](_0x323d87['shift']());}};_0x5e8f74(++_0x4ef3f9);}(_0xef68,0xce));var _0x8ef6=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xef68[_0x199572];return _0x13cfa3;};'use strict';var asr=require(_0x8ef6('0x0'));module[_0x8ef6('0x1')]=function(_0x5cfdbe,_0x2810bf,_0x11300f,_0x231337){return asr(_0x5cfdbe,_0x2810bf,_0x11300f,_0x231337);}; \ 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 76272ce..d7dd4ae 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 _0x651c=['open','message','lodash','crypto','../../../../../../config/logger','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','close','EOS','error','status','result','final','hypotheses','transcript','likelihood','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject'];(function(_0x39bc80,_0x18f609){var _0x350050=function(_0x318e71){while(--_0x318e71){_0x39bc80['push'](_0x39bc80['shift']());}};_0x350050(++_0x18f609);}(_0x651c,0xbb));var _0xc651=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0x651c[_0x265aa2];return _0x447a3a;};'use strict';var BPromise=require('bluebird');var _=require(_0xc651('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xc651('0x1'));var logger=require(_0xc651('0x2'))('agi');module[_0xc651('0x3')]=function(_0x2620e0,_0x3800e8,_0x226b87,_0x56946c){return new BPromise(function(_0x14affe,_0x10245c){logger['info'](_0xc651('0x4'),_0x56946c||_0xc651('0x5'));var _0x5b44c5=new WebSocket(_0x56946c||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x30b522='';var _0x27b4d7='0';var _0x6300a3='1';var _0xb5e74b=_0xc651('0x6');function _0x552b5a(_0x2cc927){var _0x5af62d=crypto[_0xc651('0x7')](_0xc651('0x8'));_0x5af62d[_0xc651('0x9')](_0x2cc927);return _0x5af62d[_0xc651('0xa')]('hex');}function _0x9e7002(){try{logger[_0xc651('0xb')](_0xc651('0xc'));var _0x2771f4=moment()[_0xc651('0xd')]();var _0x1db327=_0x552b5a(_0x2771f4+_0x3800e8+_0x226b87);_0x5b44c5[_0xc651('0xe')](JSON[_0xc651('0xf')]({'appID':_0x3800e8,'timestamp':_0x2771f4,'appKey':_0x1db327}));var _0x1f5190=fs[_0xc651('0x10')](_0x2620e0);_0x1f5190['on']('data',function(_0x454beb){_0x5b44c5[_0xc651('0xe')](_0x454beb);});_0x1f5190['on'](_0xc651('0x11'),function(){_0x5b44c5[_0xc651('0xe')](_0xc651('0x12'));});}catch(_0x29e1c5){logger[_0xc651('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0xc651('0xf')](_0x29e1c5));_0x5b44c5['terminate']();}}function _0x3c6083(_0x41fd8c){try{if(_0x41fd8c){var _0x2ccb11=JSON['parse'](_0x41fd8c);switch(_0x2ccb11[_0xc651('0x14')]){case 0x0:if(_0x2ccb11['result']){if(_0x2ccb11[_0xc651('0x15')][_0xc651('0x16')]){logger[_0xc651('0xb')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x2ccb11[_0xc651('0x15')][_0xc651('0x17')]));_0x30b522=_0x2ccb11[_0xc651('0x15')][_0xc651('0x17')][0x0][_0xc651('0x18')];_0x27b4d7=_0x2ccb11['result']['hypotheses'][0x0][_0xc651('0x19')];_0x6300a3='0';_0xb5e74b=_0xc651('0x1a');_0x5b44c5[_0xc651('0x1b')]();}}break;case 0x1:logger[_0xc651('0xb')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x6300a3='1';_0xb5e74b='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xc651('0xb')](_0xc651('0x1c'));_0x6300a3='2';_0xb5e74b='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x6300a3='9';_0xb5e74b='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0xc651('0xb')]('Authentication\x20failed.');_0x6300a3='10';_0xb5e74b=_0xc651('0x1d');break;case 0xb:logger[_0xc651('0xb')](_0xc651('0x1e'));_0x6300a3='11';_0xb5e74b=_0xc651('0x1e');}}}catch(_0x543aed){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x543aed));_0x5b44c5[_0xc651('0x1b')]();}}function _0x3afa19(){logger['info'](_0xc651('0x1f'));_0x14affe({'transcript':_0x30b522,'confidence':_0x27b4d7,'status':_0x6300a3,'status_message':_0xb5e74b});}function _0x29966e(_0x1dccb0){logger[_0xc651('0x13')](_0xc651('0x20'));if(!_[_0xc651('0x21')](_0x1dccb0)){logger[_0xc651('0x13')](_[_0xc651('0x22')](_0x1dccb0)?JSON['stringify'](_0x1dccb0):_0x1dccb0);}}_0x5b44c5['on'](_0xc651('0x23'),_0x9e7002);_0x5b44c5['on'](_0xc651('0x24'),_0x3c6083);_0x5b44c5['on'](_0xc651('0x11'),_0x3afa19);_0x5b44c5['on'](_0xc651('0x13'),_0x29966e);});}; \ No newline at end of file +var _0xb18f=['sha1','update','digest','hex','info','unix','send','stringify','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','likelihood','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','agi','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash'];(function(_0x4888d1,_0xfb47c2){var _0x54a74d=function(_0x4128c6){while(--_0x4128c6){_0x4888d1['push'](_0x4888d1['shift']());}};_0x54a74d(++_0xfb47c2);}(_0xb18f,0x6c));var _0xfb18=function(_0x2cd162,_0x4667ec){_0x2cd162=_0x2cd162-0x0;var _0x48e957=_0xb18f[_0x2cd162];return _0x48e957;};'use strict';var BPromise=require(_0xfb18('0x0'));var _=require(_0xfb18('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xfb18('0x2'));var crypto=require(_0xfb18('0x3'));var logger=require('../../../../../../config/logger')(_0xfb18('0x4'));module['exports']=function(_0x570a9f,_0x50e43d,_0x188838,_0x113280){return new BPromise(function(_0x5371d4,_0x5f4407){logger['info'](_0xfb18('0x5'),_0x113280||_0xfb18('0x6'));var _0x31e7a9=new WebSocket(_0x113280||_0xfb18('0x6'),{'perMessageDeflate':![]});var _0x26c2d0='';var _0x4c7a1b='0';var _0x276d18='1';var _0x119e1d=_0xfb18('0x7');function _0x3c161a(_0x2acab2){var _0x2a1136=crypto[_0xfb18('0x8')](_0xfb18('0x9'));_0x2a1136[_0xfb18('0xa')](_0x2acab2);return _0x2a1136[_0xfb18('0xb')](_0xfb18('0xc'));}function _0x37fc20(){try{logger[_0xfb18('0xd')]('Open\x20Tilde\x20ASR\x20socket');var _0x3f2693=moment()[_0xfb18('0xe')]();var _0x5cb993=_0x3c161a(_0x3f2693+_0x50e43d+_0x188838);_0x31e7a9[_0xfb18('0xf')](JSON[_0xfb18('0x10')]({'appID':_0x50e43d,'timestamp':_0x3f2693,'appKey':_0x5cb993}));var _0x52e991=fs['createReadStream'](_0x570a9f);_0x52e991['on'](_0xfb18('0x11'),function(_0x242a11){_0x31e7a9[_0xfb18('0xf')](_0x242a11);});_0x52e991['on'](_0xfb18('0x12'),function(){_0x31e7a9['send'](_0xfb18('0x13'));});}catch(_0xb4d88d){logger['error'](_0xfb18('0x14'),JSON[_0xfb18('0x10')](_0xb4d88d));_0x31e7a9[_0xfb18('0x15')]();}}function _0x3d9430(_0x2f3824){try{if(_0x2f3824){var _0x5b38de=JSON[_0xfb18('0x16')](_0x2f3824);switch(_0x5b38de[_0xfb18('0x17')]){case 0x0:if(_0x5b38de['result']){if(_0x5b38de['result'][_0xfb18('0x18')]){logger[_0xfb18('0xd')](_0xfb18('0x19'),JSON[_0xfb18('0x10')](_0x5b38de[_0xfb18('0x1a')]['hypotheses']));_0x26c2d0=_0x5b38de[_0xfb18('0x1a')][_0xfb18('0x1b')][0x0]['transcript'];_0x4c7a1b=_0x5b38de['result'][_0xfb18('0x1b')][0x0][_0xfb18('0x1c')];_0x276d18='0';_0x119e1d='Success.';_0x31e7a9[_0xfb18('0x15')]();}}break;case 0x1:logger['info']('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x276d18='1';_0x119e1d=_0xfb18('0x7');break;case 0x2:logger[_0xfb18('0xd')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x276d18='2';_0x119e1d='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xfb18('0xd')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x276d18='9';_0x119e1d=_0xfb18('0x1d');break;case 0xa:logger[_0xfb18('0xd')](_0xfb18('0x1e'));_0x276d18='10';_0x119e1d=_0xfb18('0x1e');break;case 0xb:logger['info'](_0xfb18('0x1f'));_0x276d18='11';_0x119e1d=_0xfb18('0x1f');}}}catch(_0x556a78){logger[_0xfb18('0x20')](_0xfb18('0x21'),JSON[_0xfb18('0x10')](_0x556a78));_0x31e7a9['terminate']();}}function _0x76e686(){logger[_0xfb18('0xd')](_0xfb18('0x22'));_0x5371d4({'transcript':_0x26c2d0,'confidence':_0x4c7a1b,'status':_0x276d18,'status_message':_0x119e1d});}function _0x466900(_0x281aa9){logger[_0xfb18('0x20')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xfb18('0x23')](_0x281aa9)){logger[_0xfb18('0x20')](_[_0xfb18('0x24')](_0x281aa9)?JSON[_0xfb18('0x10')](_0x281aa9):_0x281aa9);}}_0x31e7a9['on'](_0xfb18('0x25'),_0x37fc20);_0x31e7a9['on'](_0xfb18('0x26'),_0x3d9430);_0x31e7a9['on']('close',_0x76e686);_0x31e7a9['on'](_0xfb18('0x20'),_0x466900);});}; \ 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 395faee..b418aee 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 _0x12de=['exports'];(function(_0x3c6ae1,_0x33aefe){var _0x42d4ed=function(_0x5bc7e0){while(--_0x5bc7e0){_0x3c6ae1['push'](_0x3c6ae1['shift']());}};_0x42d4ed(++_0x33aefe);}(_0x12de,0x1b5));var _0xe12d=function(_0x12022c,_0x2693e0){_0x12022c=_0x12022c-0x0;var _0x1fe716=_0x12de[_0x12022c];return _0x1fe716;};var asr=require('./asr');module[_0xe12d('0x0')]={'asr':asr}; \ No newline at end of file +var _0xf0cb=['exports'];(function(_0x2197bb,_0x2d7033){var _0x255158=function(_0x45dcbb){while(--_0x45dcbb){_0x2197bb['push'](_0x2197bb['shift']());}};_0x255158(++_0x2d7033);}(_0xf0cb,0x15f));var _0xbf0c=function(_0x24243b,_0x55c567){_0x24243b=_0x24243b-0x0;var _0x1a85ce=_0xf0cb[_0x24243b];return _0x1a85ce;};var asr=require('./asr');module[_0xbf0c('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 2343d65..28e6e99 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 _0xe228=['events','./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','connection','code','close','inherits','util','net'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xe228,0x1b7));var _0x8e22=function(_0x145906,_0x4f50aa){_0x145906=_0x145906-0x0;var _0x5c1b6e=_0xe228[_0x145906];return _0x5c1b6e;};'use strict';var util=require(_0x8e22('0x0'));var net=require(_0x8e22('0x1'));var EventEmitter=require(_0x8e22('0x2'))['EventEmitter'];var AGIError=require(_0x8e22('0x3'));var AGIChannel=require(_0x8e22('0x4'));var AGIServer=function(_0x111209,_0x6c70f9,_0x43b13e){var _0x22a39c=this,_0x111209=_0x111209||0x11dd,_0x6c70f9=_0x6c70f9||_0x8e22('0x5'),_0x2bbedd=null,_0x532bf5=0x0;EventEmitter[_0x8e22('0x6')](_0x22a39c);function _0x1dd457(){if(!_0x111209){_0x22a39c[_0x8e22('0x7')](_0x8e22('0x8'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x2bbedd=net[_0x8e22('0x9')]();_0x2bbedd[_0x8e22('0xa')](_0x111209,_0x6c70f9);_0x2bbedd['on']('listening',function(){_0x22a39c[_0x8e22('0x7')](_0x8e22('0xb'));});_0x2bbedd['on']('connection',function(_0x591a8b){_0x2bbedd[_0x8e22('0xc')](function(_0x55d4d1,_0x5b56de){if(_0x55d4d1){_0x22a39c[_0x8e22('0x7')](_0x8e22('0x8'),new AGIError(_0x8e22('0xd'),_0x55d4d1));}else if(_0x43b13e&&_0x43b13e<0x0){_0x22a39c['emit'](_0x8e22('0x8'),new AGIError(_0x8e22('0xe')));_0x591a8b[_0x8e22('0xf')]();}else if(_0x43b13e&&_0x43b13e>0x0&&_0x43b13e<_0x5b56de){_0x532bf5+=0x1;_0x22a39c[_0x8e22('0x7')](_0x8e22('0x8'),new AGIError(_0x8e22('0x10'),_0x532bf5));_0x591a8b['destroy']();}else{var _0x3682a7=new AGIChannel(_0x591a8b);_0x3682a7['on']('ready',function(){_0x22a39c['emit'](_0x8e22('0x11'),_0x3682a7);});}});});_0x2bbedd['on'](_0x8e22('0x8'),function(_0x35f8fe){_0x22a39c[_0x8e22('0x7')](_0x8e22('0x8'),new AGIError(_0x8e22('0xd'),_0x35f8fe[_0x8e22('0x12')]));});_0x2bbedd['on'](_0x8e22('0x13'),function(){_0x22a39c[_0x8e22('0x7')](_0x8e22('0x13'),new AGIError('E_AGI_SERVER_CLOSE'));});}process['nextTick'](function(){_0x1dd457();});};util[_0x8e22('0x14')](AGIServer,EventEmitter);module['exports']=function(_0x377b44,_0x530de0,_0x239842){return new AGIServer(_0x377b44,_0x530de0,_0x239842);}; \ No newline at end of file +var _0xe6e9=['ready','connection','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','util','net','events','./error','./channel','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_MAXCONNECTION','destroy'];(function(_0x43b112,_0x3954bb){var _0x5ed94a=function(_0x523d31){while(--_0x523d31){_0x43b112['push'](_0x43b112['shift']());}};_0x5ed94a(++_0x3954bb);}(_0xe6e9,0x149));var _0x9e6e=function(_0x387dff,_0x5bcccc){_0x387dff=_0x387dff-0x0;var _0x25de92=_0xe6e9[_0x387dff];return _0x25de92;};'use strict';var util=require(_0x9e6e('0x0'));var net=require(_0x9e6e('0x1'));var EventEmitter=require(_0x9e6e('0x2'))['EventEmitter'];var AGIError=require(_0x9e6e('0x3'));var AGIChannel=require(_0x9e6e('0x4'));var AGIServer=function(_0x1bdc7b,_0x27d078,_0xf77fc5){var _0x7e06e7=this,_0x1bdc7b=_0x1bdc7b||0x11dd,_0x27d078=_0x27d078||'127.0.0.1',_0x21db93=null,_0xcbd0e5=0x0;EventEmitter[_0x9e6e('0x5')](_0x7e06e7);function _0x28e213(){if(!_0x1bdc7b){_0x7e06e7[_0x9e6e('0x6')](_0x9e6e('0x7'),new AGIError(_0x9e6e('0x8')));return![];}_0x21db93=net[_0x9e6e('0x9')]();_0x21db93[_0x9e6e('0xa')](_0x1bdc7b,_0x27d078);_0x21db93['on']('listening',function(){_0x7e06e7['emit'](_0x9e6e('0xb'));});_0x21db93['on']('connection',function(_0x1eca3b){_0x21db93[_0x9e6e('0xc')](function(_0x5bf897,_0x5845cb){if(_0x5bf897){_0x7e06e7[_0x9e6e('0x6')](_0x9e6e('0x7'),new AGIError(_0x9e6e('0xd'),_0x5bf897));}else if(_0xf77fc5&&_0xf77fc5<0x0){_0x7e06e7[_0x9e6e('0x6')](_0x9e6e('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x1eca3b['destroy']();}else if(_0xf77fc5&&_0xf77fc5>0x0&&_0xf77fc5<_0x5845cb){_0xcbd0e5+=0x1;_0x7e06e7[_0x9e6e('0x6')](_0x9e6e('0x7'),new AGIError(_0x9e6e('0xe'),_0xcbd0e5));_0x1eca3b[_0x9e6e('0xf')]();}else{var _0x42d7fa=new AGIChannel(_0x1eca3b);_0x42d7fa['on'](_0x9e6e('0x10'),function(){_0x7e06e7[_0x9e6e('0x6')](_0x9e6e('0x11'),_0x42d7fa);});}});});_0x21db93['on'](_0x9e6e('0x7'),function(_0x17082e){_0x7e06e7[_0x9e6e('0x6')]('error',new AGIError(_0x9e6e('0xd'),_0x17082e[_0x9e6e('0x12')]));});_0x21db93['on']('close',function(){_0x7e06e7[_0x9e6e('0x6')](_0x9e6e('0x13'),new AGIError(_0x9e6e('0x14')));});}process[_0x9e6e('0x15')](function(){_0x28e213();});};util[_0x9e6e('0x16')](AGIServer,EventEmitter);module['exports']=function(_0x4951e7,_0xc163ea,_0x1ae1fa){return new AGIServer(_0x4951e7,_0xc163ea,_0x1ae1fa);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 1cdd561..95458e2 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 _0xea28=['aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','length','isString','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','replaceAll','extra','getVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','getAndSetVariable','RECOG_CONFIDENCE()','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_TRANSCRIPT','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','no\x20user\x20found','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','message','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','wav','recordFile','TildeASR\x20Result\x20%s','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','streamFile','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','math','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','pause_id','playback','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','statusMessage','variable\x20%s\x20set','sayDigits','digits','escape_digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','host','port','secure','authentication','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','split','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','then','name','catch','getVoiceQueue','getVoiceQueueById','prototype','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','getMailAccountById','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','lastName','phone','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','getPause','getPauseById','agentPause','isNil','error','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','headers','parse','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region'];(function(_0x55c947,_0x5e20a8){var _0x2556b3=function(_0x239288){while(--_0x239288){_0x55c947['push'](_0x55c947['shift']());}};_0x2556b3(++_0x5e20a8);}(_0xea28,0x13a));var _0x8ea2=function(_0x421342,_0x1222f4){_0x421342=_0x421342-0x0;var _0x572263=_0xea28[_0x421342];return _0x572263;};'use strict';var fs=require('fs');var path=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var _=require(_0x8ea2('0x2'));var sh=require(_0x8ea2('0x3'));var odbc=require(_0x8ea2('0x4'))();var rs=require(_0x8ea2('0x5'));var moment=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var rp=require('request-promise');var logger=require(_0x8ea2('0x8'))(_0x8ea2('0x9'));var config=require(_0x8ea2('0xa'));var scripts=require('./scripts');var FILES_PATH=_0x8ea2('0xb');var recursiveMapAttributes=[_0x8ea2('0xc'),_0x8ea2('0xd')];var verticesWithRetry=[_0x8ea2('0xe'),_0x8ea2('0xf'),_0x8ea2('0x10')];var AGIVertices=function(_0x19bd6c,_0x320750,_0x3de4a1){this[_0x8ea2('0x11')]=_0x19bd6c;this[_0x8ea2('0x12')]=_0x320750;this[_0x8ea2('0x13')]=_0x3de4a1;};AGIVertices['prototype']['getVariable']=function(_0x4722f3,_0x2ac9be){this[_0x8ea2('0x12')]['getVariableById'](_0x4722f3)[_0x8ea2('0x14')](function(_0x101a15){_0x2ac9be(null,_0x101a15?_0x101a15[_0x8ea2('0x15')]:![]);})[_0x8ea2('0x16')](function(_0xe47c0e){_0x2ac9be(_0xe47c0e);});};AGIVertices['prototype'][_0x8ea2('0x17')]=function(_0x553154,_0x4b2192){this[_0x8ea2('0x12')][_0x8ea2('0x18')](_0x553154)[_0x8ea2('0x14')](function(_0x78669a){_0x4b2192(null,_0x78669a?_0x78669a[_0x8ea2('0x15')]:![]);})[_0x8ea2('0x16')](function(_0x3cff96){_0x4b2192(_0x3cff96);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x1a')]=function(_0x396aab,_0x2dfa7c){this[_0x8ea2('0x12')][_0x8ea2('0x1b')](_0x396aab)[_0x8ea2('0x14')](function(_0x1b64cf){_0x2dfa7c(null,_0x1b64cf?_0x1b64cf[_0x8ea2('0x15')]:![]);})[_0x8ea2('0x16')](function(_0x2a0329){_0x2dfa7c(_0x2a0329);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x1c')]=function(_0x134cbe,_0x287597){this['rpc']['getSquareOdbcById'](_0x134cbe)[_0x8ea2('0x14')](function(_0x248c18){_0x287597(null,_0x248c18?_0x248c18[_0x8ea2('0x1d')]:![]);})['catch'](function(_0x46f4fe){_0x287597(_0x46f4fe);});};AGIVertices[_0x8ea2('0x19')]['getUser']=function(_0x3d593b,_0x283f00){this[_0x8ea2('0x12')][_0x8ea2('0x1e')](_0x3d593b)[_0x8ea2('0x14')](function(_0xe5c943){_0x283f00(null,_0xe5c943?_0xe5c943[_0x8ea2('0x15')]:![]);})[_0x8ea2('0x16')](function(_0x18ec34){_0x283f00(_0x18ec34);});};AGIVertices['prototype'][_0x8ea2('0x1f')]=function(_0x4f48bd,_0x2660cc){this[_0x8ea2('0x12')][_0x8ea2('0x20')](_0x4f48bd)['then'](function(_0x53ed43){_0x2660cc(null,_0x53ed43?_0x53ed43[_0x8ea2('0x15')]:![]);})['catch'](function(_0x200a49){_0x2660cc(_0x200a49);});};AGIVertices['prototype'][_0x8ea2('0x21')]=function(_0x12fa37,_0x21c526){var _0x266db8=this;this['rpc']['getSoundById'](_0x12fa37)[_0x8ea2('0x14')](function(_0x4da5b3){_0x21c526(null,_0x4da5b3?_0x266db8[_0x8ea2('0x22')](_0x4da5b3[_0x8ea2('0x23')]):![]);})[_0x8ea2('0x16')](function(_0x41f482){_0x21c526(_0x41f482);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x24')]=function(_0x32e225,_0x316707){this[_0x8ea2('0x12')][_0x8ea2('0x25')](_0x32e225)['then'](function(_0x5b7ff9){_0x316707(null,_0x5b7ff9?_0x5b7ff9:![]);})[_0x8ea2('0x16')](function(_0x188553){_0x316707(_0x188553);});};AGIVertices['prototype']['sendMailMessage']=function(_0x1ee7b2,_0x4e273e,_0x64475b){this[_0x8ea2('0x13')]['sendMailMessage'](_0x1ee7b2,_0x4e273e)[_0x8ea2('0x14')](function(){_0x64475b(null);})[_0x8ea2('0x16')](function(_0x33abc8){_0x64475b(_0x33abc8);});};AGIVertices['prototype']['getIntervals']=function(_0x49a252,_0x3880c3){this[_0x8ea2('0x12')][_0x8ea2('0x26')](_0x49a252)['then'](function(_0x456487){if(_0x456487){if(_0x456487[_0x8ea2('0x27')]){_0x3880c3(null,[_0x456487[_0x8ea2('0x28')]]);}else{_0x3880c3(null,_[_0x8ea2('0x29')](_0x456487[_0x8ea2('0x2a')],_0x8ea2('0x28')));}}else{_0x3880c3(null,![]);}})[_0x8ea2('0x16')](function(_0x1fc76a){_0x3880c3(_0x1fc76a);});};AGIVertices['prototype'][_0x8ea2('0x22')]=function(_0x29e3f5){return util[_0x8ea2('0x2b')](_0x8ea2('0x2c'),FILES_PATH,_0x29e3f5);};AGIVertices['prototype'][_0x8ea2('0x2d')]=function(_0x5355aa,_0x1e03f2,_0x103d5a){odbc[_0x8ea2('0x2e')](_0x5355aa,function(_0x1496ae){if(_0x1496ae){logger['error'](_0x8ea2('0x2f'),_0x1496ae);_0x103d5a(_0x1496ae);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0x8ea2('0x30')](_0x1e03f2,function(_0x5f23a3,_0x61fb42){if(_0x5f23a3){logger[_0x8ea2('0x31')](_0x8ea2('0x32'),_0x1e03f2);_0x103d5a(_0x5f23a3);}else{logger[_0x8ea2('0x31')](_0x8ea2('0x33'),_0x1e03f2);odbc['close'](function(_0x84685d){if(_0x84685d){logger['error'](_0x8ea2('0x34'),_0x84685d);}_0x103d5a(null,_0x61fb42);});}});}});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x35')]=function(_0x3995ff,_0x4f9a8c){this[_0x8ea2('0x12')]['getSmsAccountById'](_0x3995ff)[_0x8ea2('0x14')](function(_0x5ba351){_0x4f9a8c(null,_0x5ba351?_0x5ba351:![]);})[_0x8ea2('0x16')](function(_0x450e8f){_0x4f9a8c(_0x450e8f);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x36')]=function(_0x373a70,_0x251a10){this[_0x8ea2('0x12')]['createSmsMessage'](_0x373a70)['then'](function(_0x1d7496){_0x251a10(null,_0x1d7496);})['catch'](function(_0x4b03fa){_0x251a10(_0x4b03fa);});};AGIVertices['prototype'][_0x8ea2('0x37')]=function(_0x5d9ba0,_0x40a532,_0x1b8028){this[_0x8ea2('0x12')][_0x8ea2('0x37')]({'uniqueid':this[_0x8ea2('0x11')][_0x8ea2('0x38')],'node':_0x5d9ba0[_0x8ea2('0x39')],'application':_0x5d9ba0[_0x8ea2('0x3a')],'data':_0x40a532||null,'project_name':this['channel'][_0x8ea2('0x3b')],'callerid':this[_0x8ea2('0x11')][_0x8ea2('0x3c')]})['then'](function(_0x2d6bbb){if(_0x1b8028){_0x1b8028(null,_0x2d6bbb);}})[_0x8ea2('0x16')](function(_0x8005f9){if(_0x1b8028){_0x1b8028(_0x8005f9);}});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x3d')]=function(_0x56efc5,_0x3e6541,_0x42ef0b,_0x23e527){this['rpc'][_0x8ea2('0x3d')]({'uniqueid':this[_0x8ea2('0x11')][_0x8ea2('0x38')],'callerid':this[_0x8ea2('0x11')][_0x8ea2('0x3c')],'calleridname':this[_0x8ea2('0x11')][_0x8ea2('0x3e')],'context':this[_0x8ea2('0x11')][_0x8ea2('0x3f')],'extension':this[_0x8ea2('0x11')][_0x8ea2('0x40')],'priority':this[_0x8ea2('0x11')][_0x8ea2('0x41')],'accountcode':this[_0x8ea2('0x11')]['accountcode'],'dnid':this[_0x8ea2('0x11')][_0x8ea2('0x42')],'projectName':this[_0x8ea2('0x11')][_0x8ea2('0x3b')],'saveName':_0x3e6541,'filename':_0x56efc5[_0x8ea2('0x43')]||_0x3e6541,'savePath':_0x42ef0b})[_0x8ea2('0x14')](function(_0x11b3ef){_0x23e527(null,_0x11b3ef);})[_0x8ea2('0x16')](function(_0x52df67){_0x23e527(_0x52df67);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x44')]=function(_0x24dddb,_0x5380fa,_0x4fcc19,_0x7cd361,_0x2d9d2a){this[_0x8ea2('0x12')]['createSquareMessage']({'uniqueid':this[_0x8ea2('0x11')][_0x8ea2('0x38')],'body':_0x24dddb,'direction':_0x5380fa,'providerName':_0x4fcc19,'providerResponse':_0x7cd361})[_0x8ea2('0x14')](function(_0x11d7ea){if(_0x2d9d2a){_0x2d9d2a(null,_0x11d7ea);}})[_0x8ea2('0x16')](function(_0x51b33e){if(_0x2d9d2a){_0x2d9d2a(_0x51b33e);}});};AGIVertices['prototype'][_0x8ea2('0x45')]=function(_0x4148c1,_0x1b8c4b){this['rpc'][_0x8ea2('0x45')]({'firstName':_[_0x8ea2('0x46')](_0x4148c1[_0x8ea2('0x15')])||_['isNil'](_0x4148c1['name'])?'callback_'+Math['random']():_0x4148c1['name'],'lastName':_[_0x8ea2('0x46')](_0x4148c1[_0x8ea2('0x47')])||_['isNil'](_0x4148c1['lastName'])?null:_0x4148c1[_0x8ea2('0x47')],'phone':_0x4148c1[_0x8ea2('0x48')],'ListId':_0x4148c1[_0x8ea2('0x49')],'scheduledat':_0x4148c1['scheduledAt'],'callbackUniqueid':this[_0x8ea2('0x11')][_0x8ea2('0x38')],'tags':'callback','description':_0x8ea2('0x4a')+_0x4148c1[_0x8ea2('0x4b')][_0x8ea2('0x4c')](),'priority':_0x4148c1[_0x8ea2('0x4d')]})[_0x8ea2('0x14')](function(_0x58674d){_0x1b8c4b(null,_0x58674d);})['catch'](function(_0x577049){_0x1b8c4b(_0x577049);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x4e')]=function(_0x2b95b0,_0x74520e){this[_0x8ea2('0x12')][_0x8ea2('0x4f')](_0x2b95b0)[_0x8ea2('0x14')](function(_0x5265e7){_0x74520e(null,_0x5265e7?_0x5265e7['name']:![]);})['catch'](function(_0x3d6fd6){_0x74520e(_0x3d6fd6);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x50')]=function(_0x2bbec0,_0x57720d,_0x11824e){var _0x2b8662={'role':'agent'};_0x2b8662[_0x2bbec0]=this[_0x8ea2('0x11')][_0x8ea2('0x3c')];this[_0x8ea2('0x12')][_0x8ea2('0x50')](_0x2b8662,_0x57720d,this[_0x8ea2('0x11')]['uniqueid'])['then'](function(_0x4e87fe){_0x11824e(null,_[_0x8ea2('0x51')](_0x4e87fe)?![]:!![]);})[_0x8ea2('0x16')](function(_0x2fd365){logger[_0x8ea2('0x52')](_0x2fd365);_0x11824e(null,![]);});};AGIVertices[_0x8ea2('0x19')]['agentUnpause']=function(_0x461d32,_0x3b3eab){var _0x1d9d22={'role':_0x8ea2('0x53')};_0x1d9d22[_0x461d32]=this['channel'][_0x8ea2('0x3c')];this['rpc'][_0x8ea2('0x54')](_0x1d9d22)['then'](function(_0x361bb3){_0x3b3eab(null,_[_0x8ea2('0x51')](_0x361bb3)?![]:!![]);})['catch'](function(_0x549c71){logger[_0x8ea2('0x52')](_0x549c71);_0x3b3eab(null,![]);});};AGIVertices['prototype'][_0x8ea2('0x55')]=function(_0x31a56f,_0x1c5489){var _0x23185e={'role':'agent'};_0x23185e[_0x31a56f]=this[_0x8ea2('0x11')][_0x8ea2('0x3c')];this[_0x8ea2('0x12')][_0x8ea2('0x55')](_0x23185e)[_0x8ea2('0x14')](function(_0x212c16){_0x1c5489(null,_[_0x8ea2('0x51')](_0x212c16)?![]:!![]);})[_0x8ea2('0x16')](function(_0x253a6e){logger[_0x8ea2('0x52')](_0x253a6e);_0x1c5489(null,![]);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x56')]=function(_0x533cea,_0x23fce4){var _0x2d130a={'role':_0x8ea2('0x53')};_0x2d130a[_0x533cea]=this[_0x8ea2('0x11')][_0x8ea2('0x3c')];var _0x219f78=_0x533cea!=_0x8ea2('0x57')?util[_0x8ea2('0x2b')](_0x8ea2('0x58'),_0x8ea2('0x59'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')]):undefined;this['rpc'][_0x8ea2('0x56')](_0x2d130a,_0x219f78)[_0x8ea2('0x14')](function(_0xb55bc6){_0x23fce4(null,_[_0x8ea2('0x51')](_0xb55bc6)?![]:!![]);})[_0x8ea2('0x16')](function(_0x4c04a0){logger['error'](_0x4c04a0);_0x23fce4(null,![]);});};AGIVertices['prototype'][_0x8ea2('0x5a')]=function(_0xe8b3ed,_0x380066){sh[_0x8ea2('0x5b')](_[_0x8ea2('0x5c')](_0xe8b3ed),function(_0x8b694f,_0x57db65){var _0x428106=_0x57db65[_0x8ea2('0x5d')](/(\r\n|\n|\r)/gm,'');_0x380066(null,_0x428106);});};AGIVertices['prototype']['googleCloudTTS']=function(_0x2a7ccc,_0x145a88){scripts[_0x8ea2('0x5e')](_0x2a7ccc[_0x8ea2('0x5f')],_0x2a7ccc[_0x8ea2('0x60')]||_0x8ea2('0x61'),_0x2a7ccc[_0x8ea2('0x61')],_0x2a7ccc['languageCode']||_0x8ea2('0x62'),_0x2a7ccc[_0x8ea2('0x63')]||_0x8ea2('0x64'),_0x2a7ccc[_0x8ea2('0x65')]||'MP3')[_0x8ea2('0x14')](function(_0x356099){_0x145a88(null,_0x356099);})[_0x8ea2('0x16')](function(_0x5ae776){_0x145a88(_0x5ae776);});};AGIVertices[_0x8ea2('0x19')]['googleTTS']=function(_0x505c80,_0x188809){scripts[_0x8ea2('0x66')](_0x505c80['text'],_0x505c80['google_tts_language']||'en',0x1)['then'](function(_0x167f15){_0x188809(null,_0x167f15);})['catch'](function(_0x555608){_0x188809(_0x555608);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x67')]=function(_0xa08c2,_0x2dfd8f){var _0x1681d8={'uri':_0xa08c2[_0x8ea2('0x68')],'method':_0xa08c2[_0x8ea2('0x69')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xa08c2[_0x8ea2('0x6a')])===_0x8ea2('0x6b')&&parseInt(_0xa08c2[_0x8ea2('0x6a')])>=0x1?parseInt(_0xa08c2[_0x8ea2('0x6a')])*0x3e8:0x5*0x3e8};if(_[_0x8ea2('0x6c')]([_0x8ea2('0x6d'),_0x8ea2('0x6e')],_0x1681d8['method'][_0x8ea2('0x6f')]())){try{_0x1681d8[_0x8ea2('0x70')]=_0xa08c2[_0x8ea2('0xd')]?JSON['parse'](_0xa08c2[_0x8ea2('0xd')]):{};}catch(_0x486ae8){logger[_0x8ea2('0x52')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x486ae8);}}try{_0x1681d8[_0x8ea2('0x71')]=_0xa08c2['rawHeaders']?JSON[_0x8ea2('0x72')](_0xa08c2[_0x8ea2('0xc')]):{};}catch(_0x4cdc8d){logger[_0x8ea2('0x52')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4cdc8d);}if(_0xa08c2[_0x8ea2('0x73')]){try{var _0x2c3a18=require(_0xa08c2[_0x8ea2('0x73')])[_0x8ea2('0x74')](this,_0x1681d8);_0x1681d8[_0x8ea2('0x75')]=Mustache['render'](_0xa08c2['url'],_0x2c3a18,{},['$$','$$']);if(_0x1681d8[_0x8ea2('0x71')]){_0x1681d8['headers']=JSON[_0x8ea2('0x72')](Mustache[_0x8ea2('0x76')](JSON[_0x8ea2('0x77')](_0x1681d8[_0x8ea2('0x71')]),_0x2c3a18,{},['$$','$$']));}if(_0x1681d8[_0x8ea2('0x70')]){_0x1681d8[_0x8ea2('0x70')]=JSON['parse'](Mustache['render'](JSON['stringify'](_0x1681d8[_0x8ea2('0x70')]),_0x2c3a18,{},['$$','$$']));}}catch(_0x576075){logger[_0x8ea2('0x52')](_0x8ea2('0x78'),_0x576075);}}rp(_0x1681d8)[_0x8ea2('0x14')](function(_0x30a59a){var _0x244c30={'statusCode':_0x30a59a[_0x8ea2('0x79')]||0xc8,'statusMessage':_0x30a59a['statusMessage']||'OK','headers':_0x30a59a[_0x8ea2('0x71')]||{},'body':_0x30a59a[_0x8ea2('0x70')]||{}};_0x2dfd8f(null,_0x244c30);})[_0x8ea2('0x16')](function(_0x335a96){var _0x2329fa={'statusCode':_0x335a96['statusCode']||0x1f4,'statusMessage':_0x335a96['message']||_0x8ea2('0x7a'),'headers':_0x335a96[_0x8ea2('0x7b')][_0x8ea2('0x71')]||{},'body':_0x335a96[_0x8ea2('0x7b')][_0x8ea2('0x70')]||{}};_0x2dfd8f(null,_0x2329fa);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x7c')]=function(_0x9c4960,_0x27edbd){scripts[_0x8ea2('0x7c')](this[_0x8ea2('0x11')][_0x8ea2('0x38')],_0x9c4960[_0x8ea2('0x7d')],_0x9c4960[_0x8ea2('0x61')],_0x9c4960[_0x8ea2('0x7e')]||'en')[_0x8ea2('0x14')](function(_0x2121d5){_0x27edbd(null,_0x2121d5);})['catch'](function(_0x549b70){_0x27edbd(_0x549b70);});};AGIVertices[_0x8ea2('0x19')]['googleDialogflowV2']=function(_0x1cd355,_0x321416){scripts['googleDialogflowV2'](this[_0x8ea2('0x11')]['uniqueid'],_0x1cd355[_0x8ea2('0x7f')],_0x1cd355[_0x8ea2('0x80')],_0x1cd355['private_key'],_0x1cd355[_0x8ea2('0x61')],_0x1cd355[_0x8ea2('0x81')]||'en')[_0x8ea2('0x14')](function(_0x3b5eab){_0x321416(null,_0x3b5eab);})[_0x8ea2('0x16')](function(_0x28e80a){_0x321416(_0x28e80a);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x82')]=function(_0x46a49c,_0x371d0){scripts['sestekNDA'](this[_0x8ea2('0x11')],_0x46a49c)[_0x8ea2('0x14')](function(_0x57d246){_0x371d0(null,_0x57d246);})[_0x8ea2('0x16')](function(_0x5a69e6){_0x371d0(_0x5a69e6);});};AGIVertices['prototype']['ispeechTTS']=function(_0xffbdc7,_0x47d4ca){scripts[_0x8ea2('0x83')](_0xffbdc7[_0x8ea2('0x7d')],_0xffbdc7[_0x8ea2('0x61')],_0xffbdc7[_0x8ea2('0x84')]||_0x8ea2('0x62'),_0xffbdc7[_0x8ea2('0x85')])['then'](function(_0x2f4f45){_0x47d4ca(null,_0x2f4f45);})['catch'](function(_0x1e6c5e){_0x47d4ca(_0x1e6c5e);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x86')]=function(_0x3fb18e,_0x44178d,_0x4d940b){scripts[_0x8ea2('0x86')](_0x44178d,_0x3fb18e[_0x8ea2('0x7d')],_0x3fb18e[_0x8ea2('0x87')]||_0x8ea2('0x62'),this[_0x8ea2('0x88')](_0x3fb18e[_0x8ea2('0x89')])?_0x3fb18e[_0x8ea2('0x89')]:undefined)[_0x8ea2('0x14')](function(_0x2e3551){_0x4d940b(null,_0x2e3551);})[_0x8ea2('0x16')](function(_0x16fefb){_0x4d940b(_0x16fefb);});};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x8a')]=function(_0xf2f97f,_0x17649b){scripts[_0x8ea2('0x8a')](_0xf2f97f[_0x8ea2('0x8b')],_0xf2f97f['aws_secret_access_key'],_0xf2f97f[_0x8ea2('0x8c')],_0xf2f97f['aws_polly_voice']||'Amy',_0xf2f97f[_0x8ea2('0x61')],_0xf2f97f[_0x8ea2('0x8d')]||'text')[_0x8ea2('0x14')](function(_0x5cb85b){_0x17649b(null,_0x5cb85b);})['catch'](function(_0x3bc0ae){_0x17649b(_0x3bc0ae);});};AGIVertices[_0x8ea2('0x19')]['awsLex']=function(_0x40e96a,_0x156a23){scripts[_0x8ea2('0x8e')](this[_0x8ea2('0x11')][_0x8ea2('0x38')],_0x40e96a['aws_access_key_id'],_0x40e96a[_0x8ea2('0x8f')],_0x40e96a[_0x8ea2('0x90')],_0x40e96a[_0x8ea2('0x61')],_0x40e96a[_0x8ea2('0x91')])[_0x8ea2('0x14')](function(_0x44d521){_0x156a23(null,_0x44d521);})[_0x8ea2('0x16')](function(_0x36116d){_0x156a23(_0x36116d);});};AGIVertices[_0x8ea2('0x19')]['googleASR']=function(_0x4183cb,_0x51276b,_0x10cd1e){scripts[_0x8ea2('0x92')](_0x51276b,_0x4183cb[_0x8ea2('0x7d')],_0x4183cb[_0x8ea2('0x93')]||_0x8ea2('0x62'))['then'](function(_0x315652){_0x10cd1e(null,_0x315652);})[_0x8ea2('0x16')](function(_0x4fdd16){_0x10cd1e(_0x4fdd16);});};AGIVertices['prototype'][_0x8ea2('0x94')]=function(_0x1fa813,_0x5f4cbd,_0x47a70d){scripts[_0x8ea2('0x94')](_0x5f4cbd,_0x1fa813[_0x8ea2('0x95')],_0x1fa813['appsecret'],_0x1fa813[_0x8ea2('0x75')])[_0x8ea2('0x14')](function(_0x306247){_0x47a70d(null,_0x306247);})[_0x8ea2('0x16')](function(_0xdf4de9){_0x47a70d(_0xdf4de9);});};AGIVertices['prototype'][_0x8ea2('0x96')]=function(_0x1ab0b1){var _0x3f8c1c=_[_0x8ea2('0x6c')](verticesWithRetry,_0x1ab0b1[_0x8ea2('0x3a')])?_0x1ab0b1:_['clone'](_0x1ab0b1);for(var _0x1da1e7 in _0x3f8c1c){if(_0x3f8c1c['hasOwnProperty'](_0x1da1e7)){if(_0x3f8c1c[_0x1da1e7]&&_['isString'](_0x3f8c1c[_0x1da1e7])){if(_[_0x8ea2('0x6c')](recursiveMapAttributes,_0x1da1e7)){_0x3f8c1c[_0x1da1e7]=this[_0x8ea2('0x97')](_0x3f8c1c[_0x1da1e7]);}else{_0x3f8c1c[_0x1da1e7]=this['replaceAllVariables'](_0x3f8c1c[_0x1da1e7]);}}}}return _0x3f8c1c;};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x98')]=function(_0x27e1a9){for(var _0x888634 in _0x27e1a9){if(_0x27e1a9[_0x8ea2('0x99')](_0x888634)){if(_[_0x8ea2('0x9a')](_0x27e1a9[_0x888634])){this['recursiveNodeIndex'](_0x27e1a9[_0x888634]);}else if(_[_0x8ea2('0x9b')](_0x27e1a9[_0x888634])){for(var _0x4c3838=0x0;_0x4c3838<_0x27e1a9[_0x888634][_0x8ea2('0x9c')];_0x4c3838++){this['recursiveNodeIndex'](_0x27e1a9[_0x888634][_0x4c3838]);}}else if(_[_0x8ea2('0x9d')](_0x27e1a9[_0x888634])){_0x27e1a9[_0x888634]=this[_0x8ea2('0x9e')](_0x27e1a9[_0x888634]);}}}};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x9f')]=function(_0x470099,_0x49d292){for(var _0x16e3fb in _0x470099){if(_0x470099[_0x8ea2('0x99')](_0x16e3fb)){if(_[_0x8ea2('0x9a')](_0x470099[_0x16e3fb])){if(!_[_0x8ea2('0x46')](_0x470099[_0x16e3fb])){this['saveRestApiResult'](_0x470099[_0x16e3fb],util['format'](_0x8ea2('0xa0'),_0x49d292,_0x16e3fb));}}else if(_['isArray'](_0x470099[_0x16e3fb])){for(var _0x177c54=0x0;_0x177c54<_0x470099[_0x16e3fb]['length'];_0x177c54++){this[_0x8ea2('0x9f')](_0x470099[_0x16e3fb][_0x177c54],util[_0x8ea2('0x2b')](_0x8ea2('0xa0'),_0x49d292,_0x16e3fb+'['+_0x177c54+']'));}}else{if(!_[_0x8ea2('0x51')](_0x470099[_0x16e3fb])){this[_0x8ea2('0x11')][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')]('%s.%s',_0x49d292,_0x16e3fb),_0x470099[_0x16e3fb]);}}}}};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x97')]=function(_0x5eda07){try{var _0x87e93f=JSON[_0x8ea2('0x72')](_0x5eda07);this[_0x8ea2('0x98')](_0x87e93f);return JSON['stringify'](_0x87e93f);}catch(_0xc33ccd){return this[_0x8ea2('0x9e')](_0x5eda07);}};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x9e')]=function(_0x54eed1){var _0x4971dc=_0x54eed1['split']('{');for(var _0x437461=0x1;_0x437461<_0x4971dc[_0x8ea2('0x9c')];_0x437461+=0x1){var _0x175305=_0x4971dc[_0x437461]['split']('}');if(_0x175305[_0x8ea2('0x9c')]>0x1){_0x54eed1=_0x54eed1[_0x8ea2('0xa2')]('{'+_0x175305[0x0]+'}',this[_0x8ea2('0x11')]['getVariable'](_0x175305[0x0])[_0x8ea2('0xa3')]||_0x175305[0x0]);}}if(_0x4971dc[_0x8ea2('0x9c')]===0x1){return _0x54eed1['toString']();}return this[_0x8ea2('0x9e')](_0x54eed1);};AGIVertices['prototype']['getAndSetVariable']=function(_0x2294c3,_0xfff26b){var _0x405020=this['channel'][_0x8ea2('0xa4')](_0x2294c3);if(_0x405020[_0x8ea2('0xa5')]===-0x1){return _0x405020;}logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xa6'),_0xfff26b,_0x405020[_0x8ea2('0xa3')]));return this[_0x8ea2('0x11')]['setVariable'](_0xfff26b,_0x405020[_0x8ea2('0xa3')]);};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x88')]=function(_0x384500){return _0x384500&&_0x384500!=='0'&&_0x384500!=='-1'&&_0x384500!=='';};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xa7')]=function(_0x85158c){this['createSquareDetailsReport'][_0x8ea2('0x74')](this,_0x85158c,'-');_0x85158c[_0x8ea2('0xa8')]=_0x85158c[_0x8ea2('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xa9')]=function(_0x55971a){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xaa'),_0x55971a[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x55971a[_0x8ea2('0x61')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xac'));}var _0x4d3706='\x22'+_0x55971a['text']+'\x22';if(this['isConfigured'](_0x55971a[_0x8ea2('0x7b')])){_0x4d3706+=','+_0x55971a['options'];}var _0x458c7f=this[_0x8ea2('0x11')][_0x8ea2('0x5b')](_0x8ea2('0xad'),_0x4d3706);if(_0x458c7f[_0x8ea2('0xa5')]===-0x1){return _0x458c7f;}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0xae'),_0x4d3706));};AGIVertices[_0x8ea2('0x19')]['mrcprecog']=function(_0x410199){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xaf'),_0x410199[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x410199[_0x8ea2('0xb0')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xb1'));}var _0x1a64d1=_0x410199[_0x8ea2('0xb0')];if(this[_0x8ea2('0x88')](_0x410199[_0x8ea2('0x7b')])){_0x1a64d1+=','+_0x410199[_0x8ea2('0x7b')];}var _0x1dd4f2=this[_0x8ea2('0x11')]['exec']('MRCPRecog',_0x1a64d1);if(_0x1dd4f2['result']===-0x1){return _0x1dd4f2;}var _0x4b2c0f=this[_0x8ea2('0xb2')](_0x8ea2('0xb3'),'MRCP_RECOG_CONFIDENCE');if(_0x4b2c0f[_0x8ea2('0xa5')]===-0x1){return _0x4b2c0f;}var _0xbd1141=this[_0x8ea2('0xb2')](_0x8ea2('0xb4'),'MRCP_RECOG_TRANSCRIPT');if(_0xbd1141[_0x8ea2('0xa5')]===-0x1){return _0xbd1141;}var _0x564180=this[_0x8ea2('0xb2')](_0x8ea2('0xb5'),_0x8ea2('0xb6'));if(_0x564180[_0x8ea2('0xa5')]===-0x1){return _0x564180;}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x1a64d1));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x9')]=function(_0x53ff43){logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0xb7'),_0x53ff43[_0x8ea2('0x39')]));return this[_0x8ea2('0x11')][_0x8ea2('0x9')]([_0x53ff43[_0x8ea2('0xb8')],_0x53ff43[_0x8ea2('0xb9')]]);};AGIVertices[_0x8ea2('0x19')]['answer']=function(_0x3f3822){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xba'),_0x3f3822[_0x8ea2('0x39')]));if(this[_0x8ea2('0x88')](_0x3f3822[_0x8ea2('0x6a')])){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x3f3822[_0x8ea2('0x6a')]));var _0x2bbf85=this[_0x8ea2('0x11')]['wait'](_0x3f3822[_0x8ea2('0x6a')]);if(_0x2bbf85[_0x8ea2('0xa5')]===-0x1){return _0x2bbf85;}}return this[_0x8ea2('0x11')][_0x8ea2('0xbb')]();};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xbc')]=function(_0x590e53){logger['info'](util[_0x8ea2('0x2b')](_0x8ea2('0xbd'),_0x590e53[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x590e53[_0x8ea2('0x49')])){return this['channel'][_0x8ea2('0x52')](_0x590e53,'no\x20list\x20selected');}_0x590e53[_0x8ea2('0x4b')]=moment();if(this[_0x8ea2('0x88')](_0x590e53['delay'])){_0x590e53[_0x8ea2('0x4b')]=moment()[_0x8ea2('0xbe')](_0x590e53[_0x8ea2('0xbf')],_0x8ea2('0xc0'));}if(!this[_0x8ea2('0x88')](_0x590e53[_0x8ea2('0x4d')])){_0x590e53[_0x8ea2('0x4d')]=0x2;}this[_0x8ea2('0x45')][_0x8ea2('0x74')](this,_0x590e53);return this[_0x8ea2('0x11')]['noop'](util[_0x8ea2('0x2b')](_0x8ea2('0xc1'),_0x590e53[_0x8ea2('0x48')],_0x590e53['list_id'],_0x590e53[_0x8ea2('0x4b')]));};AGIVertices['prototype'][_0x8ea2('0xc2')]=function(_0x34e6dd){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xc3'),_0x34e6dd[_0x8ea2('0x39')]));var _0x7a45a8=this[_0x8ea2('0x11')][_0x8ea2('0x5b')](_0x34e6dd['application'],_0x34e6dd[_0x8ea2('0x7b')]);if(_0x7a45a8[_0x8ea2('0xa5')]===-0x1){return _0x7a45a8;}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0xc4'),_0x34e6dd[_0x8ea2('0xc5')],_0x34e6dd[_0x8ea2('0x7b')]));};AGIVertices[_0x8ea2('0x19')]['lumenvoxtts']=function(_0xf2a59a){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xc6'),_0xf2a59a[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0xf2a59a[_0x8ea2('0x61')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xac'));}var _0x4478c2='\x22'+_0xf2a59a['text']+'\x22';if(this[_0x8ea2('0x88')](_0xf2a59a['options'])){_0x4478c2+=','+_0xf2a59a[_0x8ea2('0x7b')];}var _0x21b282=this[_0x8ea2('0x11')]['exec'](_0x8ea2('0xad'),_0x4478c2);if(_0x21b282['result']===-0x1){return _0x21b282;}return this['channel']['noop'](util[_0x8ea2('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4478c2));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xc7')]=function(_0x46e467){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xc8'),_0x46e467[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x46e467['text'])){return this['channel'][_0x8ea2('0xab')](_0x8ea2('0xac'));}var _0x1572f2='\x22'+_0x46e467['text']+'\x22';if(this['isConfigured'](_0x46e467['options'])){_0x1572f2+=','+_0x46e467[_0x8ea2('0x7b')];}var _0x4d0495=this['channel'][_0x8ea2('0x5b')](_0x8ea2('0xad'),_0x1572f2);if(_0x4d0495['result']===-0x1){return _0x4d0495;}return this['channel'][_0x8ea2('0xab')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x1572f2));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xc9')]=function(_0x384cef){logger['info'](util[_0x8ea2('0x2b')](_0x8ea2('0xca'),_0x384cef[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x384cef[_0x8ea2('0xb0')])){return this['channel'][_0x8ea2('0xab')]('no\x20grammar\x20configured');}var _0x481fd0=_0x384cef['grammar'];if(this[_0x8ea2('0x88')](_0x384cef['options'])){_0x481fd0+=','+_0x384cef['options'];}var _0x2f8154=this[_0x8ea2('0x11')][_0x8ea2('0x5b')](_0x8ea2('0xcb'),_0x481fd0);if(_0x2f8154[_0x8ea2('0xa5')]===-0x1){return _0x2f8154;}var _0x168f0e=this[_0x8ea2('0xb2')](_0x8ea2('0xb3'),'LUMENVOX_ASR_CONFIDENCE');if(_0x168f0e[_0x8ea2('0xa5')]===-0x1){return _0x168f0e;}var _0x1e216b=this[_0x8ea2('0xb2')](_0x8ea2('0xb4'),_0x8ea2('0xcc'));if(_0x1e216b['result']===-0x1){return _0x1e216b;}var _0x261e47=this['getAndSetVariable'](_0x8ea2('0xb5'),'LUMENVOX_ASR_INSTANCE');if(_0x261e47[_0x8ea2('0xa5')]===-0x1){return _0x261e47;}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x481fd0));};AGIVertices['prototype']['sestekasr']=function(_0x37347a){logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0xcd'),_0x37347a[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x37347a[_0x8ea2('0xb0')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xb1'));}var _0x17b2c0=_0x37347a[_0x8ea2('0xb0')];if(this[_0x8ea2('0x88')](_0x37347a[_0x8ea2('0x7b')])){_0x17b2c0+=','+_0x37347a[_0x8ea2('0x7b')];}var _0x70b34f=this['channel'][_0x8ea2('0x5b')]('MRCPRecog',_0x17b2c0);if(_0x70b34f['result']===-0x1){return _0x70b34f;}var _0x41ee31=this['getAndSetVariable'](_0x8ea2('0xb3'),_0x8ea2('0xce'));if(_0x41ee31[_0x8ea2('0xa5')]===-0x1){return _0x41ee31;}var _0x1a441c=this[_0x8ea2('0xb2')]('RECOG_INPUT()',_0x8ea2('0xcf'));if(_0x1a441c[_0x8ea2('0xa5')]===-0x1){return _0x1a441c;}var _0x39add3=this['getAndSetVariable']('RECOG_INSTANCE()',_0x8ea2('0xd0'));if(_0x39add3[_0x8ea2('0xa5')]===-0x1){return _0x39add3;}return this['channel'][_0x8ea2('0xab')](util['format'](_0x8ea2('0xd1'),_0x17b2c0));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xd2')]=function(_0x280ed0){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xd3'),_0x280ed0[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x280ed0['odbc_id'])){return this['channel'][_0x8ea2('0x52')](_0x280ed0,'no\x20database\x20selected');}var _0xc218e0=this[_0x8ea2('0x1c')][_0x8ea2('0x74')](this,_0x280ed0[_0x8ea2('0xd4')]);if(!_0xc218e0){return this['channel'][_0x8ea2('0x52')](_0x280ed0,_0x8ea2('0xd5'));}if(!this['isConfigured'](_0x280ed0[_0x8ea2('0x30')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x280ed0,'no\x20query\x20configured');}var _0x58d7a0=_0x280ed0['query'][_0x8ea2('0x5d')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x8ea2('0xab')](util['format'](_0x8ea2('0xd6'),_0x58d7a0));var _0x2bd2e6=this[_0x8ea2('0x2d')][_0x8ea2('0x74')](this,_0xc218e0,_0x58d7a0);this['createSquareDetailsReport'][_0x8ea2('0x74')](this,_0x280ed0,_0x58d7a0);if(!this['isConfigured'](_0x280ed0['variable_id'])){return this['channel'][_0x8ea2('0xab')](_0x8ea2('0xd7'));}var _0x40d91f=this['getVariable'][_0x8ea2('0x74')](this,_0x280ed0[_0x8ea2('0xd8')]);if(!_0x40d91f){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x280ed0,_0x8ea2('0xd9'));}var _0x18e3ca=this;_0x2bd2e6[_0x8ea2('0xda')](function(_0x3ffb58,_0x28fe8c){Object[_0x8ea2('0xdb')](_0x3ffb58)[_0x8ea2('0xda')](function(_0xc35654){_0x18e3ca[_0x8ea2('0x11')][_0x8ea2('0xa1')](util['format']('%s[%s][%s]',_0x40d91f,_0x28fe8c,_0xc35654),_0x3ffb58[_0xc35654]);});});this[_0x8ea2('0x11')]['setVariable'](util[_0x8ea2('0x2b')](_0x8ea2('0xdc'),_0x40d91f),_0x2bd2e6[_0x8ea2('0x9c')]);return this['channel'][_0x8ea2('0xab')](util['format']('variable\x20%s\x20set',_0x40d91f));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xdd')]=function(_0x6f4bf9){logger[_0x8ea2('0xde')](util[_0x8ea2('0x2b')](_0x8ea2('0xdf'),_0x6f4bf9[_0x8ea2('0x39')]));if(!this['isConfigured'](_0x6f4bf9[_0x8ea2('0xe0')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x6f4bf9,'no\x20user\x20selected');}var _0x5c0d83=this[_0x8ea2('0xe1')][_0x8ea2('0x74')](this,_0x6f4bf9['sip_id']);if(!_0x5c0d83){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x6f4bf9,_0x8ea2('0xe2'));}var _0x588c74=this['channel'][_0x8ea2('0x5b')]('DIAL',[util[_0x8ea2('0x2b')]('SIP/%s',_0x5c0d83),_0x6f4bf9[_0x8ea2('0x6a')],_0x6f4bf9[_0x8ea2('0xe3')],_0x6f4bf9[_0x8ea2('0x68')]]);if(_0x588c74[_0x8ea2('0xa5')]===-0x1){return _0x588c74;}return this[_0x8ea2('0x11')]['noop'](util[_0x8ea2('0x2b')](_0x8ea2('0xe4'),_0x8ea2('0xe5')));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xe6')]=function(_0x1949b1){logger['info'](util['format'](_0x8ea2('0xe7'),_0x1949b1[_0x8ea2('0x39')]));if(!this['isConfigured'](_0x1949b1[_0x8ea2('0x7d')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xe8'));}if(!this['isConfigured'](_0x1949b1[_0x8ea2('0x61')])){return this[_0x8ea2('0x11')]['noop'](_0x8ea2('0xac'));}this['channel'][_0x8ea2('0xe9')]=!![];this['createSquareDetailsReport'](_0x1949b1);this['createSquareMessage'](_0x1949b1[_0x8ea2('0x61')],'in','','');this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('Trying\x20Dialogflow:\x20%s',_0x1949b1[_0x8ea2('0x61')]));var _0x262b2c=this[_0x8ea2('0x7c')]['sync'](this,_0x1949b1);if(_0x262b2c){for(var _0x1dd401 in _0x262b2c){if(_0x262b2c[_0x8ea2('0x99')](_0x1dd401)){this[_0x8ea2('0x11')][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')](_0x8ea2('0xea'),_0x1dd401[_0x8ea2('0x6f')]()),_0x262b2c[_0x1dd401]);}}this['createSquareMessage'](_0x262b2c[_0x8ea2('0xeb')],_0x8ea2('0xec'),_0x8ea2('0xe6'),'');return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0xed'),_0x262b2c[_0x8ea2('0xeb')]));}return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x1949b1,_0x8ea2('0xee'));};AGIVertices[_0x8ea2('0x19')]['dialogflowV2']=function(_0x58a0e5){logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0xef'),_0x58a0e5[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x58a0e5[_0x8ea2('0x7f')])){return this[_0x8ea2('0x11')]['noop'](_0x8ea2('0xf0'));}if(!this[_0x8ea2('0x88')](_0x58a0e5['client_email'])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xf1'));}if(!this[_0x8ea2('0x88')](_0x58a0e5['private_key'])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xf2'));}if(!this[_0x8ea2('0x88')](_0x58a0e5['dialogflowV2_language'])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xf3'));}if(!this['isConfigured'](_0x58a0e5[_0x8ea2('0x61')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')]('no\x20text\x20configured');}this['channel'][_0x8ea2('0xe9')]=!![];this['createSquareDetailsReport'](_0x58a0e5);this[_0x8ea2('0x44')](_0x58a0e5[_0x8ea2('0x61')],'in','','');this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0xf4'),_0x58a0e5['text']));var _0x55dcf0=this['googleDialogflowV2']['sync'](this,_0x58a0e5);if(_0x55dcf0){for(var _0x1f8044 in _0x55dcf0){if(_0x55dcf0[_0x8ea2('0x99')](_0x1f8044)){if(_0x1f8044!==_0x8ea2('0xf5')){this[_0x8ea2('0x11')][_0x8ea2('0xa1')](util['format']('DIALOGFLOW_%s',_0x1f8044[_0x8ea2('0x6f')]()),_0x55dcf0[_0x1f8044]);}}}this['createSquareMessage'](_0x55dcf0['speech'],_0x8ea2('0xec'),_0x8ea2('0xf6'),_0x55dcf0[_0x8ea2('0xf5')]);return this['channel'][_0x8ea2('0xab')](util['format'](_0x8ea2('0xf7'),_0x55dcf0[_0x8ea2('0xeb')]));}return this['channel'][_0x8ea2('0x52')](_0x58a0e5,_0x8ea2('0xf8'));};AGIVertices['prototype'][_0x8ea2('0xf9')]=function(_0x186b44){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0xfa'),_0x186b44[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x186b44[_0x8ea2('0xfb')])){return this[_0x8ea2('0x11')]['noop'](_0x8ea2('0xfc'));}if(!this['isConfigured'](_0x186b44[_0x8ea2('0xfd')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xfe'));}if(!this[_0x8ea2('0x88')](_0x186b44[_0x8ea2('0xff')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')]('no\x20password\x20configured');}if(!this['isConfigured'](_0x186b44[_0x8ea2('0x100')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xac'));}this[_0x8ea2('0x11')]['bot']=!![];this[_0x8ea2('0x37')](_0x186b44);this[_0x8ea2('0x44')](_0x186b44['text'],'in','','');this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('Trying\x20SestekNDA:\x20%s',_0x186b44['text']));var _0x166a8e=this['sestekNDA'][_0x8ea2('0x74')](this,_0x186b44);if(_0x166a8e){for(var _0x38a6ff in _0x166a8e){if(_0x166a8e[_0x8ea2('0x99')](_0x38a6ff)){this[_0x8ea2('0x11')][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')](_0x8ea2('0x101'),_0x38a6ff[_0x8ea2('0x6f')]()),_0x166a8e[_0x38a6ff]);}}this[_0x8ea2('0x44')](_0x166a8e[_0x8ea2('0xeb')],_0x8ea2('0xec'),_0x8ea2('0xf9'),'');if(_0x166a8e[_0x8ea2('0x102')]){this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x103'),_0x166a8e[_0x8ea2('0x102')]));var _0x416bc5=this['channel']['streamFile'](_0x166a8e['audiofile']);try{fs[_0x8ea2('0x104')](_0x166a8e[_0x8ea2('0x102')]+_0x8ea2('0x105'));}catch(_0x9410dd){logger['error'](_0x9410dd);}return _0x416bc5;}else{return this['channel'][_0x8ea2('0xab')](util['format'](_0x8ea2('0x106'),_0x166a8e[_0x8ea2('0xeb')]));}}return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x186b44,_0x8ea2('0x107'));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x108')]=function(_0x57a7ac){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x109'),_0x57a7ac[_0x8ea2('0x39')]));return this['channel']['noop'](_0x8ea2('0x108'));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x10a')]=function(_0x571f23){logger['info'](util[_0x8ea2('0x2b')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x571f23[_0x8ea2('0x39')]));var _0x38e038='';if(_0x571f23[_0x8ea2('0x10b')]){if(!this['isConfigured'](_0x571f23[_0x8ea2('0x10b')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x571f23,_0x8ea2('0x10c'));}else{var _0x515049=parseInt(_0x571f23['trunk_id'],0xa);if(isNaN(_0x515049)){_0x38e038=_0x571f23[_0x8ea2('0x10b')];}else{_0x38e038=this[_0x8ea2('0x1f')][_0x8ea2('0x74')](this,_0x571f23['trunk_id']);if(!_0x38e038){return this[_0x8ea2('0x11')]['error'](_0x571f23,_0x8ea2('0x10d'));}}}}else if(_0x571f23['trunk_name']){_0x38e038=_0x571f23[_0x8ea2('0x10e')];}else{return this['channel'][_0x8ea2('0x52')](_0x571f23,_0x8ea2('0x10c'));}var _0x3cc3af=this[_0x8ea2('0x11')]['exec'](_0x8ea2('0xe5'),[util[_0x8ea2('0x2b')](_0x8ea2('0x10f'),_0x38e038,_0x571f23[_0x8ea2('0x48')]),_0x571f23['timeout'],_0x571f23[_0x8ea2('0xe3')],_0x571f23[_0x8ea2('0x68')]]);if(_0x3cc3af[_0x8ea2('0xa5')]===-0x1){return _0x3cc3af;}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0xe4'),_0x8ea2('0xe5')));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x110')]=function(_0x5478f4){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x5478f4['label']));return this['channel'][_0x8ea2('0xab')](_0x8ea2('0x110'));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xf')]=function(_0x3c9013){logger[_0x8ea2('0x31')](util['format']('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x3c9013[_0x8ea2('0x39')]));if(_0x3c9013[_0x8ea2('0xa8')]===0x0){return this[_0x8ea2('0xa7')](_0x3c9013);}_0x3c9013['retry']-=0x1;if(!this['isConfigured'](_0x3c9013[_0x8ea2('0x111')])){return this[_0x8ea2('0x11')]['error'](_0x3c9013,_0x8ea2('0x112'));}var _0x4e4120=this[_0x8ea2('0x21')][_0x8ea2('0x74')](this,_0x3c9013[_0x8ea2('0x111')]);if(!_0x4e4120){return this['channel'][_0x8ea2('0x52')](_0x3c9013,_0x8ea2('0x113'));}if(!this['isConfigured'](_0x3c9013[_0x8ea2('0xd8')])){return this[_0x8ea2('0x11')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x17e2ea=this[_0x8ea2('0x11')][_0x8ea2('0x114')](_0x4e4120,_0x3c9013['response'],_0x3c9013[_0x8ea2('0x115')]);var _0x116fc6=_0x17e2ea[_0x8ea2('0xa5')]?_0x17e2ea[_0x8ea2('0xa5')][_0x8ea2('0x4c')]():'';logger['info'](_0x8ea2('0x116'),JSON['stringify'](_0x17e2ea));if(_0x17e2ea[_0x8ea2('0xa5')]===-0x1){this['createSquareDetailsReport'][_0x8ea2('0x74')](this,_0x3c9013,_0x116fc6);return _0x17e2ea;}else if(_0x17e2ea[_0x8ea2('0xa3')]===_0x8ea2('0x6a')){_0x17e2ea[_0x8ea2('0xa5')]=_0x116fc6['length']>=parseInt(_0x3c9013[_0x8ea2('0x117')])?'x':'i';}else{_0x17e2ea[_0x8ea2('0xa5')]=_0x116fc6[_0x8ea2('0x9c')]>=parseInt(_0x3c9013[_0x8ea2('0x117')])&&_0x116fc6[_0x8ea2('0x9c')]<=parseInt(_0x3c9013[_0x8ea2('0x115')])?'x':'i';}var _0xbae953=this[_0x8ea2('0xa4')][_0x8ea2('0x74')](this,_0x3c9013[_0x8ea2('0xd8')]);if(!_0xbae953){return this[_0x8ea2('0x11')]['error'](_0x3c9013,_0x8ea2('0xd9'));}this[_0x8ea2('0x11')][_0x8ea2('0xa1')](_0xbae953,_0x116fc6);if(this['isConfigured'](_0x3c9013[_0x8ea2('0x118')])){var _0x2f7b18=parseInt(_0x3c9013[_0x8ea2('0x118')],0xa);var _0x14dd7b=rs[_0x8ea2('0x119')]({'charset':'*','length':_0x2f7b18});var _0x423a23=_0x116fc6[_0x8ea2('0x9c')];if(_0x423a23>0x0){if(_0x423a23>_0x2f7b18){this[_0x8ea2('0x37')][_0x8ea2('0x74')](this,_0x3c9013,_0x3c9013[_0x8ea2('0x11a')]==='first'?_0x14dd7b+_0x116fc6[_0x8ea2('0x11b')](_0x2f7b18):_0x116fc6[_0x8ea2('0x11b')](0x0,_0x423a23-_0x2f7b18)+_0x14dd7b);}else{this[_0x8ea2('0x37')][_0x8ea2('0x74')](this,_0x3c9013,rs['generate']({'charset':'*','length':_0x423a23}));}}else{this[_0x8ea2('0x37')][_0x8ea2('0x74')](this,_0x3c9013,'');}}else{this[_0x8ea2('0x37')][_0x8ea2('0x74')](this,_0x3c9013,_0x116fc6);}return _0x17e2ea;};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x10')]=function(_0x109785){logger['info'](util[_0x8ea2('0x2b')](_0x8ea2('0x11c'),_0x109785['label']));return this[_0x8ea2('0xf')](_0x109785);};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x11d')]=function(_0x50ebcd){logger['info'](util[_0x8ea2('0x2b')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x50ebcd['label']));this[_0x8ea2('0x37')][_0x8ea2('0x74')](this,_0x50ebcd,_0x50ebcd['goalname']);return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0x11e'),_0x50ebcd['goalname']));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x11f')]=function(_0x45a633){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x120'),_0x45a633[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x45a633[_0x8ea2('0x8b')])||!this[_0x8ea2('0x88')](_0x45a633[_0x8ea2('0x8f')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0x121'));}if(!this[_0x8ea2('0x88')](_0x45a633[_0x8ea2('0x61')])){return this['channel'][_0x8ea2('0xab')](_0x8ea2('0xac'));}this['channel']['noop'](util[_0x8ea2('0x2b')]('Trying\x20aws\x20Polly\x20%s',_0x45a633['text']));var _0x1e1761=this[_0x8ea2('0x8a')][_0x8ea2('0x74')](this,_0x45a633);if(_0x1e1761){this['channel'][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x122'),_0x1e1761));var _0x4e2fd7=this[_0x8ea2('0x11')]['streamFile'](_0x1e1761);try{fs[_0x8ea2('0x104')](_0x1e1761+'.wav');}catch(_0x5f13ed){logger[_0x8ea2('0x52')](_0x5f13ed);}return _0x4e2fd7;}return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x45a633,_0x8ea2('0x123'));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x124')]=function(_0x1d7bbe){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x125'),_0x1d7bbe[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x1d7bbe['aws_access_key_id'])||!this['isConfigured'](_0x1d7bbe['aws_secret_access_key'])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x1d7bbe[_0x8ea2('0x91')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0x126'));}if(!this[_0x8ea2('0x88')](_0x1d7bbe['text'])){return this[_0x8ea2('0x11')]['noop'](_0x8ea2('0xac'));}this['channel'][_0x8ea2('0xe9')]=!![];this['createSquareDetailsReport'](_0x1d7bbe);this[_0x8ea2('0x44')](_0x1d7bbe[_0x8ea2('0x61')],'in','','');this['channel']['noop'](util[_0x8ea2('0x2b')](_0x8ea2('0x127'),_0x1d7bbe[_0x8ea2('0x61')]));var _0x26b05c=this[_0x8ea2('0x8e')][_0x8ea2('0x74')](this,_0x1d7bbe);if(_0x26b05c){for(var _0x1a3537 in _0x26b05c){if(_0x26b05c[_0x8ea2('0x99')](_0x1a3537)&&_[_0x8ea2('0x9d')](_0x26b05c[_0x1a3537])){this['channel'][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')](_0x8ea2('0x128'),_0x1a3537[_0x8ea2('0x6f')]()),_0x26b05c[_0x1a3537]);}}if(_[_0x8ea2('0x51')](_0x26b05c['message'])){return this['channel'][_0x8ea2('0xab')](_0x8ea2('0x129'));}else{this[_0x8ea2('0x44')](_0x26b05c[_0x8ea2('0x12a')],_0x8ea2('0xec'),_0x8ea2('0x12b'),'');return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('Amazon\x20Lex\x20Result\x20%s',_0x26b05c[_0x8ea2('0x12a')]));}}return this['channel']['error'](_0x1d7bbe,_0x8ea2('0x12c'));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x12d')]=function(_0x1cbf58){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x12e'),_0x1cbf58[_0x8ea2('0x39')],_0x1cbf58['timeout']));if(!this[_0x8ea2('0x88')](_0x1cbf58[_0x8ea2('0x7d')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xe8'));}var _0x5bf555='wav';var _0x1323c7=util[_0x8ea2('0x2b')](_0x8ea2('0x12f'),FILES_PATH,rs[_0x8ea2('0x119')](0x4));var _0xfc671c=util[_0x8ea2('0x2b')](_0x8ea2('0xa0'),_0x1323c7,_0x5bf555);var _0x5a8d46=!![];if(_0x1cbf58[_0x8ea2('0x130')]===_0x8ea2('0x131')){_0x5a8d46=![];}var _0x4c19af=this[_0x8ea2('0x11')]['recordFile'](_0x1323c7,_0x5bf555,_0x1cbf58[_0x8ea2('0x132')],_0x1cbf58[_0x8ea2('0x6a')],undefined,_0x5a8d46);if(_0x4c19af[_0x8ea2('0xa5')]!==-0x1){this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0x133'),_0xfc671c));var _0x5dee71=this[_0x8ea2('0x92')][_0x8ea2('0x74')](this,_0x1cbf58,_0xfc671c);if(_0x5dee71){for(var _0x172838 in _0x5dee71){if(_0x5dee71['hasOwnProperty'](_0x172838)){this['channel'][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')](_0x8ea2('0x134'),_0x172838[_0x8ea2('0x6f')]()),_0x5dee71[_0x172838]);}}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('GoogleASR\x20Result\x20%s',JSON[_0x8ea2('0x77')](_0x5dee71)));}}return _0x4c19af;};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x135')]=function(_0x5ffc77){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x136'),_0x5ffc77[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x5ffc77[_0x8ea2('0x95')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0x137'));}if(!this[_0x8ea2('0x88')](_0x5ffc77[_0x8ea2('0x138')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')]('no\x20appsecret\x20configured');}var _0x5cb797=_0x8ea2('0x139');var _0x1d6974=util[_0x8ea2('0x2b')](_0x8ea2('0x12f'),FILES_PATH,rs[_0x8ea2('0x119')](0x4));var _0x1110cd=util['format'](_0x8ea2('0xa0'),_0x1d6974,_0x5cb797);var _0x5371a6=!![];if(_0x5ffc77[_0x8ea2('0x130')]===_0x8ea2('0x131')){_0x5371a6=![];}var _0x4f731e=this[_0x8ea2('0x11')][_0x8ea2('0x13a')](_0x1d6974,_0x5cb797,_0x5ffc77['intKey'],_0x5ffc77[_0x8ea2('0x6a')],undefined,_0x5371a6);if(_0x4f731e[_0x8ea2('0xa5')]!==-0x1){this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('tilde\x20%s\x20file\x20created',_0x1110cd));var _0x56003d=this['tildeASR'][_0x8ea2('0x74')](this,_0x5ffc77,_0x1110cd);if(_0x56003d){for(var _0x199d37 in _0x56003d){if(_0x56003d[_0x8ea2('0x99')](_0x199d37)){this[_0x8ea2('0x11')][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')]('TILDE_ASR_%s',_0x199d37[_0x8ea2('0x6f')]()),_0x56003d[_0x199d37]);}}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0x13b'),JSON[_0x8ea2('0x77')](_0x56003d)));}}return _0x4f731e;};AGIVertices[_0x8ea2('0x19')]['gotoc']=function(_0x55bee4){logger['info'](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x55bee4[_0x8ea2('0x39')]));return this[_0x8ea2('0x11')]['continueAt'](_0x55bee4[_0x8ea2('0x3f')],_0x55bee4['extension'],_0x55bee4[_0x8ea2('0x41')]);};AGIVertices[_0x8ea2('0x19')]['gotoif']=function(_0x2a27bd){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x2a27bd[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x2a27bd[_0x8ea2('0x13c')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x2a27bd,_0x8ea2('0x13d'));}try{var _0x3cb557=eval(_0x2a27bd['condition'])?_0x8ea2('0x13e'):_0x8ea2('0x13f');this[_0x8ea2('0x11')]['noop'](util[_0x8ea2('0x2b')](_0x8ea2('0x140'),_0x2a27bd['condition'],_0x3cb557));return{'code':0xc8,'result':_0x3cb557};}catch(_0x3c9353){return{'code':0xc8,'result':_0x8ea2('0x13f')};}};AGIVertices['prototype'][_0x8ea2('0x141')]=function(_0x41543a){logger['info'](util['format'](_0x8ea2('0x142'),_0x41543a[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x41543a[_0x8ea2('0x143')])){return this['channel'][_0x8ea2('0x52')](_0x41543a,_0x8ea2('0x144'));}var _0x134d2b=this[_0x8ea2('0x145')][_0x8ea2('0x74')](this,_0x41543a[_0x8ea2('0x143')]);if(!_0x134d2b){return this[_0x8ea2('0x11')]['error'](_0x41543a,_0x8ea2('0x146'));}for(var _0xe52391=0x0;_0xe52391<_0x134d2b[_0x8ea2('0x9c')];_0xe52391+=0x1){var _0x374f30=this[_0x8ea2('0x11')][_0x8ea2('0xa4')](util['format']('IFTIME(%s?true:false)',_0x134d2b[_0xe52391]));if(_0x374f30[_0x8ea2('0xa5')]===-0x1){return _0x374f30;}logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('IFTIME\x20%s\x20%s',_0x134d2b[_0xe52391],_0x374f30[_0x8ea2('0xa3')]));if(_0x374f30[_0x8ea2('0xa3')]==='true'){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x147'),_0x134d2b[_0xe52391],_0x8ea2('0x13e')));this['channel'][_0x8ea2('0xab')](util['format'](_0x8ea2('0x147'),_0x134d2b[_0xe52391],'true'));return{'code':0xc8,'result':_0x8ea2('0x13e')};}else{logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('IFTIME\x20%s\x20%s',_0x134d2b[_0xe52391],_0x8ea2('0x13f')));this[_0x8ea2('0x11')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x134d2b[_0xe52391],_0x8ea2('0x13f')));}}return{'code':0xc8,'result':_0x8ea2('0x13f')};};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x148')]=function(_0x53fea5){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x149'),_0x53fea5['label']));return this['channel']['hangup']();};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x14a')]=function(_0x3bbd66){logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0x14b'),_0x3bbd66[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x3bbd66[_0x8ea2('0x7d')])){return this['channel'][_0x8ea2('0xab')](_0x8ea2('0xe8'));}var _0x3c8192='wav';var _0x5821de=util[_0x8ea2('0x2b')](_0x8ea2('0x12f'),FILES_PATH,rs[_0x8ea2('0x119')](0x4));var _0x403f79=util[_0x8ea2('0x2b')]('%s.%s',_0x5821de,_0x3c8192);var _0x319705=!![];if(_0x3bbd66['beep']==='NOBEEP'){_0x319705=![];}var _0x45c06f=this[_0x8ea2('0x11')][_0x8ea2('0x13a')](_0x5821de,_0x3c8192,_0x3bbd66['intKey'],_0x3bbd66['timeout'],undefined,_0x319705);if(_0x45c06f[_0x8ea2('0xa5')]!==-0x1){this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x14c'),_0x403f79));var _0x1daf8a=this[_0x8ea2('0x86')][_0x8ea2('0x74')](this,_0x3bbd66,_0x403f79);if(_0x1daf8a){for(var _0xbc07de in _0x1daf8a){if(_0x1daf8a['hasOwnProperty'](_0xbc07de)){this['channel'][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')]('ISPEECH_ASR_%s',_0xbc07de[_0x8ea2('0x6f')]()),_0x1daf8a[_0xbc07de]);}}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0x14d'),JSON[_0x8ea2('0x77')](_0x1daf8a)));}}return _0x45c06f;};AGIVertices[_0x8ea2('0x19')]['ispeechtts']=function(_0x403729){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x14e'),_0x403729[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x403729[_0x8ea2('0x7d')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xe8'));}if(!this[_0x8ea2('0x88')](_0x403729[_0x8ea2('0x61')])){return this['channel'][_0x8ea2('0xab')](_0x8ea2('0xac'));}this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x14f'),_0x403729['text']));var _0x56c7d5=this[_0x8ea2('0x83')][_0x8ea2('0x74')](this,_0x403729);if(_0x56c7d5){this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x14c'),_0x56c7d5));var _0x4a277d=this[_0x8ea2('0x11')][_0x8ea2('0x150')](_0x56c7d5,_0x403729[_0x8ea2('0x132')]);try{fs['unlink'](_0x56c7d5+_0x8ea2('0x105'));}catch(_0x2a4e5b){logger[_0x8ea2('0x52')](_0x2a4e5b);}return _0x4a277d;}return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x403729,_0x8ea2('0x151'));};AGIVertices['prototype'][_0x8ea2('0x152')]=function(_0x365f33){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x365f33[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x365f33[_0x8ea2('0x153')])){return this['channel']['error'](_0x365f33,_0x8ea2('0x154'));}logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x8ea2('0x3c')],_0x365f33[_0x8ea2('0x153')]));var _0x15ec0d=this[_0x8ea2('0x56')]['sync'](this,_0x365f33['findBy']);if(_0x15ec0d){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x365f33['findBy']));this['channel'][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x365f33[_0x8ea2('0x153')]));return{'code':0xc8,'result':_0x8ea2('0x155')};}else{logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x156'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x365f33[_0x8ea2('0x153')]));this[_0x8ea2('0x11')]['noop'](util['format'](_0x8ea2('0x156'),this['channel'][_0x8ea2('0x3c')],_0x365f33[_0x8ea2('0x153')]));return{'code':0xc8,'result':_0x8ea2('0x157')};}};AGIVertices['prototype'][_0x8ea2('0x158')]=function(_0x44cb49){logger[_0x8ea2('0x31')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x44cb49['label']));if(!this['isConfigured'](_0x44cb49[_0x8ea2('0x153')])){return this['channel']['error'](_0x44cb49,_0x8ea2('0x154'));}logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0x159'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x44cb49[_0x8ea2('0x153')]));var _0x12a2c5=this['agentLogout'][_0x8ea2('0x74')](this,_0x44cb49['findBy']);if(_0x12a2c5){logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0x15a'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x44cb49[_0x8ea2('0x153')]));this[_0x8ea2('0x11')]['noop'](util[_0x8ea2('0x2b')](_0x8ea2('0x15a'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x44cb49['findBy']));return{'code':0xc8,'result':_0x8ea2('0x155')};}else{logger['info'](util[_0x8ea2('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x44cb49[_0x8ea2('0x153')]));this[_0x8ea2('0x11')]['noop'](util[_0x8ea2('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x44cb49['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x15b')]=function(_0x2b882e){logger['info'](util[_0x8ea2('0x2b')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x2b882e[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x2b882e[_0x8ea2('0x15c')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x2b882e,_0x8ea2('0x15d'));}this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x15e'),_0x2b882e[_0x8ea2('0x15c')]));var _0x449156=eval(_0x2b882e[_0x8ea2('0x15c')]);if(!this[_0x8ea2('0x88')](_0x2b882e[_0x8ea2('0xd8')])){return this['channel'][_0x8ea2('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x357316=this[_0x8ea2('0xa4')]['sync'](this,_0x2b882e['variable_id']);if(!_0x357316){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x2b882e,_0x8ea2('0xd9'));}if(_['isArray'](_0x449156)){var _0x322f93=this;_0x449156[_0x8ea2('0xda')](function(_0x3d81f2,_0x387eed){_0x322f93[_0x8ea2('0x11')][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')](_0x8ea2('0x15f'),_0x357316,_0x387eed),_0x3d81f2);});return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0x160'),_0x357316));}else{return this[_0x8ea2('0x11')][_0x8ea2('0xa1')](_0x357316,_0x449156);}};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xe')]=function(_0x3ca197){logger['info'](util[_0x8ea2('0x2b')](_0x8ea2('0x161'),_0x3ca197[_0x8ea2('0x39')]));if(_0x3ca197[_0x8ea2('0xa8')]===0x0){return this[_0x8ea2('0xa7')](_0x3ca197);}_0x3ca197[_0x8ea2('0xa8')]-=0x1;if(!this[_0x8ea2('0x88')](_0x3ca197['file_id'])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x3ca197,_0x8ea2('0x112'));}var _0x390385=this[_0x8ea2('0x21')]['sync'](this,_0x3ca197['file_id']);if(!_0x390385){return this[_0x8ea2('0x11')]['error'](_0x3ca197,_0x8ea2('0x113'));}var _0x5dde8a=this['channel'][_0x8ea2('0x114')](_0x390385,_0x3ca197['response'],_0x3ca197[_0x8ea2('0x162')]);var _0x49e76d=_0x5dde8a[_0x8ea2('0xa5')];if(_0x5dde8a[_0x8ea2('0xa5')]===-0x1){this[_0x8ea2('0x37')]['sync'](this,_0x3ca197,'-1');return _0x5dde8a;}else if(_0x5dde8a[_0x8ea2('0xa3')]===_0x8ea2('0x6a')){_0x5dde8a[_0x8ea2('0xa5')]=_0x5dde8a[_0x8ea2('0xa5')][_0x8ea2('0x9c')]>0x0?_0x5dde8a[_0x8ea2('0xa5')]:'t';}else if(_['isEmpty'](_0x5dde8a[_0x8ea2('0xa5')])){_0x5dde8a[_0x8ea2('0xa5')]='#';_0x49e76d='#';}if(!this[_0x8ea2('0x88')](_0x3ca197[_0x8ea2('0xd8')])){this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xd7'));}else{var _0x5ddadc=this[_0x8ea2('0xa4')][_0x8ea2('0x74')](this,_0x3ca197[_0x8ea2('0xd8')]);if(!_0x5ddadc){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x3ca197,'no\x20variable\x20found');}this[_0x8ea2('0x11')][_0x8ea2('0xa1')](_0x5ddadc,_0x49e76d);}this[_0x8ea2('0x37')]['sync'](this,_0x3ca197,_0x49e76d);return _0x5dde8a;};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0xab')]=function(_0x35b4ee){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x163'),_0x35b4ee[_0x8ea2('0x39')]));return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x35b4ee[_0x8ea2('0x164')]||_0x35b4ee['label']);};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x165')]=function(_0x2c5cc7){logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0x166'),_0x2c5cc7[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x2c5cc7['findBy'])){return this[_0x8ea2('0x11')]['error'](_0x2c5cc7,_0x8ea2('0x154'));}logger['info'](util[_0x8ea2('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x2c5cc7['findBy']));var _0x51eba4=this[_0x8ea2('0x4e')]['sync'](this,_0x2c5cc7[_0x8ea2('0x167')]);var _0x1b674e=this[_0x8ea2('0x50')][_0x8ea2('0x74')](this,_0x2c5cc7[_0x8ea2('0x153')],_0x51eba4);if(_0x1b674e){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x15a'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x2c5cc7[_0x8ea2('0x153')]));this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x15a'),this['channel'][_0x8ea2('0x3c')],_0x2c5cc7[_0x8ea2('0x153')]));return{'code':0xc8,'result':_0x8ea2('0x155')};}else{logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0x156'),this[_0x8ea2('0x11')]['callerid'],_0x2c5cc7[_0x8ea2('0x153')]));this[_0x8ea2('0x11')]['noop'](util['format'](_0x8ea2('0x15a'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x2c5cc7['findBy']));return{'code':0xc8,'result':_0x8ea2('0x157')};}};AGIVertices['prototype'][_0x8ea2('0x168')]=function(_0x5e7f9f){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x5e7f9f[_0x8ea2('0x39')]));if(!this['isConfigured'](_0x5e7f9f[_0x8ea2('0x111')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x5e7f9f,_0x8ea2('0x112'));}var _0x41a9cd=this['getSound'][_0x8ea2('0x74')](this,_0x5e7f9f[_0x8ea2('0x111')]);if(!_0x41a9cd){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x5e7f9f,_0x8ea2('0x113'));}var _0x28c0e8=this['channel'][_0x8ea2('0x5b')]('PLAYBACK',[_0x41a9cd,_0x5e7f9f['opts']]);if(_0x28c0e8[_0x8ea2('0xa5')]===-0x1){return _0x28c0e8;}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0xc4'),_0x8ea2('0x169'),_0x41a9cd));};AGIVertices['prototype']['queue']=function(_0x54d67b){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x16a'),_0x54d67b[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x54d67b[_0x8ea2('0x16b')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x54d67b,_0x8ea2('0x16c'));}var _0x23bc05='';var _0x49bc7b=parseInt(_0x54d67b['queue_id'],0xa);if(isNaN(_0x49bc7b)){_0x23bc05=_0x54d67b[_0x8ea2('0x16b')];}else{_0x23bc05=this['getVoiceQueue'][_0x8ea2('0x74')](this,_0x54d67b[_0x8ea2('0x16b')]);if(!_0x23bc05){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x54d67b,_0x8ea2('0x16d'));}}var _0x1237d8='';if(this[_0x8ea2('0x88')](_0x54d67b[_0x8ea2('0x111')])){var _0x5c670a=this[_0x8ea2('0x21')]['sync'](this,_0x54d67b[_0x8ea2('0x111')]);if(_0x5c670a){_0x1237d8=_0x5c670a;}}this[_0x8ea2('0x37')]['sync'](this,_0x54d67b,_0x23bc05);if(_0x54d67b[_0x8ea2('0xe3')][_0x8ea2('0x16e')]('x')<0x0){_0x54d67b[_0x8ea2('0xe3')]+='x';}if(_0x54d67b['opts'][_0x8ea2('0x16e')]('X')<0x0){_0x54d67b[_0x8ea2('0xe3')]+='X';}this[_0x8ea2('0x11')][_0x8ea2('0xa1')](_0x8ea2('0x16f'),_0x23bc05?_0x23bc05[_0x8ea2('0x170')]():'');var _0x1638a9=this[_0x8ea2('0x11')]['exec'](_0x8ea2('0x171'),[_0x23bc05,_0x54d67b[_0x8ea2('0xe3')],_0x54d67b[_0x8ea2('0x68')],_0x1237d8,_0x54d67b[_0x8ea2('0x6a')],_0x54d67b[_0x8ea2('0x9')],_0x54d67b[_0x8ea2('0x172')],_0x54d67b[_0x8ea2('0x173')],'',_0x54d67b['position']]);if(_0x1638a9[_0x8ea2('0xa5')]===-0x1){return _0x1638a9;}return this[_0x8ea2('0x11')]['noop'](util[_0x8ea2('0x2b')](_0x8ea2('0xc4'),_0x8ea2('0x171'),_0x23bc05));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x174')]=function(_0x5eb353){logger['info'](util[_0x8ea2('0x2b')](_0x8ea2('0x175'),_0x5eb353[_0x8ea2('0x39')]));var _0x54ad36=_0x5eb353['recordingFormat']||_0x8ea2('0x139');var _0x33bdea=util[_0x8ea2('0x2b')](_0x8ea2('0x176'),this[_0x8ea2('0x11')]['uniqueid'],rs[_0x8ea2('0x119')](0x5));var _0x38116f=util[_0x8ea2('0x2b')](_0x8ea2('0x177'),FILES_PATH,_0x33bdea,_0x54ad36);var _0x3c8abc=util[_0x8ea2('0x2b')](_0x8ea2('0x12f'),FILES_PATH,_0x33bdea);this[_0x8ea2('0x3d')]['sync'](this,_0x5eb353,_0x33bdea,_0x38116f);this[_0x8ea2('0x11')][_0x8ea2('0xa1')](_0x8ea2('0x178'),_0x33bdea);logger[_0x8ea2('0x31')](_0x8ea2('0x179'),_0x3c8abc,_0x54ad36,_0x5eb353['escape_digits'],_0x5eb353['timeout']);return this[_0x8ea2('0x11')][_0x8ea2('0x13a')](_0x3c8abc,_0x54ad36,_0x5eb353['escape_digits'],_0x5eb353['timeout'],undefined,!![]);};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x17a')]=function(_0x146882){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x17b'),_0x146882[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x146882[_0x8ea2('0x68')])){return this['channel'][_0x8ea2('0xab')]('no\x20url\x20configured');}var _0xbf18da=this['restAPI'][_0x8ea2('0x74')](this,_0x146882);logger['info'](util[_0x8ea2('0x2b')](_0x8ea2('0x17c'),util['inspect'](_0xbf18da,{'showHidden':![],'depth':null})));if(!this[_0x8ea2('0x88')](_0x146882[_0x8ea2('0xd8')])){return this[_0x8ea2('0x11')]['noop'](_0x8ea2('0x17d'));}var _0x4fc16e=this[_0x8ea2('0xa4')]['sync'](this,_0x146882[_0x8ea2('0xd8')]);if(!_0x4fc16e){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x146882,_0x8ea2('0xd9'));}this['channel'][_0x8ea2('0xa1')](util[_0x8ea2('0x2b')](_0x8ea2('0x17e'),_0x4fc16e),_0xbf18da['statusCode']?_0xbf18da[_0x8ea2('0x79')]:'200');this[_0x8ea2('0x11')]['setVariable'](util['format'](_0x8ea2('0x17f'),_0x4fc16e),_0xbf18da[_0x8ea2('0x180')]?_0xbf18da[_0x8ea2('0x180')]:'OK');if(_0xbf18da[_0x8ea2('0x70')]){try{this[_0x8ea2('0x9f')](_0xbf18da[_0x8ea2('0x70')],_0x4fc16e);}catch(_0x2d6ce8){logger[_0x8ea2('0x52')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x4fc16e));}}return this[_0x8ea2('0x11')]['noop'](util['format'](_0x8ea2('0x181'),_0x4fc16e));};AGIVertices[_0x8ea2('0x19')]['saydigits']=function(_0x39d012){logger['info'](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x39d012[_0x8ea2('0x39')]));return this['channel'][_0x8ea2('0x182')](_0x39d012[_0x8ea2('0x183')][_0x8ea2('0x5d')](/\s+/g,''),_0x39d012[_0x8ea2('0x184')]);};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x185')]=function(_0x1c8baf){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x186'),_0x1c8baf[_0x8ea2('0x39')]));return this[_0x8ea2('0x11')][_0x8ea2('0x187')](_0x1c8baf[_0x8ea2('0x6b')][_0x8ea2('0x5d')](/\s+/g,''),_0x1c8baf[_0x8ea2('0x184')]);};AGIVertices['prototype'][_0x8ea2('0x188')]=function(_0xa8fa4a){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x189'),_0xa8fa4a[_0x8ea2('0x39')]));return this['channel'][_0x8ea2('0x18a')](_0xa8fa4a[_0x8ea2('0x61')],_0xa8fa4a[_0x8ea2('0x184')]);};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x18b')]=function(_0x2cd193){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x2cd193[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x2cd193['account_id'])){return this[_0x8ea2('0x11')]['noop'](_0x8ea2('0x18c'));}var _0x1db332=this[_0x8ea2('0x24')][_0x8ea2('0x74')](this,_0x2cd193[_0x8ea2('0x18d')]);if(!_0x1db332||!_0x1db332[_0x8ea2('0x18e')]){return this[_0x8ea2('0x11')]['error'](_0x2cd193,_0x8ea2('0x18f'));}var _0x599814={'from':util[_0x8ea2('0x2b')](_0x8ea2('0x190'),_0x1db332['name'],_0x1db332['email']||_0x1db332[_0x8ea2('0x18e')][_0x8ea2('0x191')]),'to':_0x2cd193['to']||'','cc':_0x2cd193['cc']||'','bcc':_0x2cd193[_0x8ea2('0x192')]||'','subject':_0x2cd193[_0x8ea2('0x193')],'html':_0x2cd193[_0x8ea2('0x61')],'text':_0x2cd193[_0x8ea2('0x61')]};var _0x2c542a={'tls':{'rejectUnauthorized':![]}};if(_0x1db332[_0x8ea2('0x18e')]['service']){_0x2c542a['service']=_0x1db332[_0x8ea2('0x18e')]['service'];}else{_0x2c542a[_0x8ea2('0x194')]=_0x1db332[_0x8ea2('0x18e')][_0x8ea2('0x194')];_0x2c542a[_0x8ea2('0x195')]=_0x1db332[_0x8ea2('0x18e')][_0x8ea2('0x195')];_0x2c542a[_0x8ea2('0x196')]=_0x1db332[_0x8ea2('0x18e')][_0x8ea2('0x196')];}if(_0x1db332[_0x8ea2('0x18e')][_0x8ea2('0x197')]){_0x2c542a['auth']={'user':_0x1db332[_0x8ea2('0x18e')][_0x8ea2('0x191')],'pass':_0x1db332[_0x8ea2('0x18e')]['pass']};}if(this['isConfigured'](_0x2cd193[_0x8ea2('0x198')])){}logger[_0x8ea2('0xde')](_0x8ea2('0x199'),JSON['stringify'](_0x599814));this['createSquareDetailsReport'][_0x8ea2('0x74')](this,_0x2cd193,_0x2cd193['account_id']);this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x19a'),_0x1db332[_0x8ea2('0x15')]));this[_0x8ea2('0x19b')][_0x8ea2('0x74')](this,_0x2c542a,_0x599814);return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0x19c'));};AGIVertices['prototype'][_0x8ea2('0x19d')]=function(_0x6cfdfb){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x19e'),_0x6cfdfb['label']));return this[_0x8ea2('0x11')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x19f')]=function(_0xa3261f){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x1a0'),_0xa3261f[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0xa3261f['sms_account_id'])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0x1a1'));}var _0x44e9d0=this['getSmsAccount'][_0x8ea2('0x74')](this,_0xa3261f[_0x8ea2('0x1a2')]);if(!_0x44e9d0){return this[_0x8ea2('0x11')]['error'](_0xa3261f,'no\x20sms\x20account\x20found');}var _0x4badf2={'body':_0xa3261f[_0x8ea2('0x1a3')],'phone':_0xa3261f['to']||'','SmsAccountId':_0x44e9d0['id']};logger['debug'](_0x8ea2('0x1a4'),JSON['stringify'](_0x4badf2));this[_0x8ea2('0x37')]['sync'](this,_0xa3261f,_0xa3261f[_0x8ea2('0x1a2')]);this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x44e9d0[_0x8ea2('0x15')]));this[_0x8ea2('0x36')]['sync'](this,_0x4badf2);return this['channel']['noop'](_0x8ea2('0x1a5'));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x1a6')]=function(_0x3f3859){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x1a7'),_0x3f3859[_0x8ea2('0x39')]));if(!this[_0x8ea2('0x88')](_0x3f3859[_0x8ea2('0xd8')])){return this['channel'][_0x8ea2('0x52')](_0x3f3859,_0x8ea2('0x1a8'));}var _0x55d2d5=this[_0x8ea2('0xa4')][_0x8ea2('0x74')](this,_0x3f3859[_0x8ea2('0xd8')]);if(!_0x55d2d5){return this[_0x8ea2('0x11')]['error'](_0x3f3859,_0x8ea2('0xd9'));}return this['channel'][_0x8ea2('0xa1')](_0x55d2d5,_0x3f3859[_0x8ea2('0x1a9')]);};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x1aa')]=function(_0x13fb43){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x1ab'),_0x13fb43[_0x8ea2('0x39')]));this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0x1ac'));if(_0x13fb43['answer']===_0x8ea2('0x1ad')){this[_0x8ea2('0x11')]['noop'](_0x8ea2('0x1ae'));return this[_0x8ea2('0x11')][_0x8ea2('0xbb')]();}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0x1af'));};AGIVertices[_0x8ea2('0x19')]['subproject']=function(_0x462e0e){logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0x1b0'),_0x462e0e[_0x8ea2('0x39')]));if(!this['isConfigured'](_0x462e0e[_0x8ea2('0x1b1')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x462e0e,'no\x20subproject\x20selected');}var _0x4f97d3=this[_0x8ea2('0x1a')]['sync'](this,_0x462e0e[_0x8ea2('0x1b1')]);if(!this[_0x8ea2('0x88')](_0x4f97d3)){return this[_0x8ea2('0x11')]['error'](_0x462e0e,util[_0x8ea2('0x2b')](_0x8ea2('0x1b2'),_0x462e0e[_0x8ea2('0x1b1')]));}if(_0x4f97d3===this[_0x8ea2('0x11')][_0x8ea2('0x3b')]){return this['channel'][_0x8ea2('0x52')](_0x462e0e,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x8ea2('0x37')]['sync'](this,_0x462e0e,_0x4f97d3);var _0xfa8f7b=this['channel']['exec'](_0x8ea2('0x1b3'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x8ea2('0x194')]||'127.0.0.1',_0x4f97d3,this['channel'][_0x8ea2('0x3b')]));if(_0xfa8f7b[_0x8ea2('0xa5')]===-0x1){return _0xfa8f7b;}return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0xc4'),_0x8ea2('0x1b3'),_0x4f97d3));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x1b4')]=function(_0x2d82d1){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x2d82d1[_0x8ea2('0x39')]));var _0x2a700e=this[_0x8ea2('0x5a')][_0x8ea2('0x74')](this,_0x2d82d1[_0x8ea2('0xb8')]);this['createSquareDetailsReport'][_0x8ea2('0x74')](this,_0x2d82d1,_0x2d82d1[_0x8ea2('0xb8')]);if(this[_0x8ea2('0x88')](_0x2d82d1[_0x8ea2('0xd8')])){var _0x12c7ce=this[_0x8ea2('0xa4')][_0x8ea2('0x74')](this,_0x2d82d1[_0x8ea2('0xd8')]);if(_0x12c7ce){this[_0x8ea2('0x11')][_0x8ea2('0xa1')](_0x12c7ce,_0x2a700e);return this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x1b5'),_0x2d82d1[_0x8ea2('0xb8')],_0x12c7ce));}}return this['channel'][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x1b6'),_0x2d82d1[_0x8ea2('0xb8')]));};AGIVertices[_0x8ea2('0x19')]['google_cloud_tts']=function(_0x332b30){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x1b7'),_0x332b30[_0x8ea2('0x39')]));_0x332b30[_0x8ea2('0x61')]=_0x332b30[_0x8ea2('0x61')][_0x8ea2('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8ea2('0x88')](_0x332b30[_0x8ea2('0x5f')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0x1b8'));}if(!this['isConfigured'](_0x332b30[_0x8ea2('0x61')])){return this['channel'][_0x8ea2('0xab')](_0x8ea2('0xac'));}this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x332b30[_0x8ea2('0x61')]));var _0x283eb5=this[_0x8ea2('0x5e')][_0x8ea2('0x74')](this,_0x332b30);if(_0x283eb5){this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x1b9'),_0x283eb5));var _0x47b79b=this[_0x8ea2('0x11')][_0x8ea2('0x150')](_0x283eb5);try{fs[_0x8ea2('0x104')](_0x283eb5+'.wav');}catch(_0x3ab3e6){logger[_0x8ea2('0x52')](_0x3ab3e6);}return _0x47b79b;}return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x332b30,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['tts']=function(_0x45e8fc){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x1ba'),_0x45e8fc[_0x8ea2('0x39')]));_0x45e8fc[_0x8ea2('0x61')]=_0x45e8fc[_0x8ea2('0x61')][_0x8ea2('0x5d')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8ea2('0x88')](_0x45e8fc[_0x8ea2('0x61')])){return this[_0x8ea2('0x11')][_0x8ea2('0xab')](_0x8ea2('0xac'));}this[_0x8ea2('0x11')][_0x8ea2('0xab')](util['format'](_0x8ea2('0x1bb'),_0x45e8fc[_0x8ea2('0x61')]));var _0x5b22e5=this[_0x8ea2('0x66')]['sync'](this,_0x45e8fc);if(_0x5b22e5){this[_0x8ea2('0x11')]['noop'](util[_0x8ea2('0x2b')]('Google\x20TTS\x20%s\x20file\x20created',_0x5b22e5));var _0x3fe5eb=this[_0x8ea2('0x11')][_0x8ea2('0x150')](_0x5b22e5);try{fs[_0x8ea2('0x104')](_0x5b22e5+_0x8ea2('0x105'));}catch(_0x561544){logger['error'](_0x561544);}return _0x3fe5eb;}return this['channel'][_0x8ea2('0x52')](_0x45e8fc,_0x8ea2('0x1bc'));};AGIVertices[_0x8ea2('0x19')][_0x8ea2('0x1bd')]=function(_0x2773a2){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x1be'),_0x2773a2['label']));if(!this[_0x8ea2('0x88')](_0x2773a2[_0x8ea2('0x153')])){return this[_0x8ea2('0x11')][_0x8ea2('0x52')](_0x2773a2,_0x8ea2('0x154'));}logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x159'),this['channel'][_0x8ea2('0x3c')],_0x2773a2[_0x8ea2('0x153')]));var _0x1cfd9f=this[_0x8ea2('0x54')][_0x8ea2('0x74')](this,_0x2773a2['findBy']);if(_0x1cfd9f){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x2773a2[_0x8ea2('0x153')]));this[_0x8ea2('0x11')][_0x8ea2('0xab')](util[_0x8ea2('0x2b')](_0x8ea2('0x15a'),this[_0x8ea2('0x11')][_0x8ea2('0x3c')],_0x2773a2[_0x8ea2('0x153')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x8ea2('0x156'),this['channel'][_0x8ea2('0x3c')],_0x2773a2['findBy']));this['channel'][_0x8ea2('0xab')](util[_0x8ea2('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x2773a2[_0x8ea2('0x153')]));return{'code':0xc8,'result':_0x8ea2('0x157')};}};AGIVertices['prototype'][_0x8ea2('0x1bf')]=function(_0x4a7236){logger[_0x8ea2('0x31')](util['format'](_0x8ea2('0x1c0'),_0x4a7236[_0x8ea2('0x39')]));var _0x4b07bd=this['channel'][_0x8ea2('0x5b')](_0x8ea2('0x1c1'),[_0x4a7236[_0x8ea2('0x1c2')],_0x4a7236['options']]);if(_0x4b07bd[_0x8ea2('0xa5')]===-0x1){return _0x4b07bd;}return this['channel'][_0x8ea2('0xab')](util['format'](_0x8ea2('0xc4'),_0x8ea2('0x1c1'),_0x4a7236['mailbox']));};AGIVertices['prototype'][_0x8ea2('0x1c3')]=function(_0x3e4635){logger[_0x8ea2('0x31')](util[_0x8ea2('0x2b')](_0x8ea2('0x1c4'),_0x3e4635[_0x8ea2('0x39')]));if(!this['isConfigured'](_0x3e4635['variable_id'])){return this['channel'][_0x8ea2('0x52')](_0x3e4635,_0x8ea2('0x1a8'));}var _0x4b7fa8=this[_0x8ea2('0xa4')][_0x8ea2('0x74')](this,_0x3e4635[_0x8ea2('0xd8')]);if(!_0x4b7fa8){return this[_0x8ea2('0x11')]['error'](_0x3e4635,_0x8ea2('0xd9'));}var _0x51c474=this[_0x8ea2('0x11')][_0x8ea2('0xa4')](_0x4b7fa8);return{'code':0xc8,'result':_0x51c474[_0x8ea2('0xa3')]?_0x51c474[_0x8ea2('0xa3')]:'-'};};String[_0x8ea2('0x19')][_0x8ea2('0xa2')]=function(_0x15bc92,_0x4c0dc7){return this[_0x8ea2('0x1c5')](_0x15bc92)['join'](_0x4c0dc7);};module[_0x8ea2('0x1c6')]=AGIVertices; \ No newline at end of file +var _0x8b38=['dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','googleASR','google_asr_language','tildeASR','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','isPlainObject','%s.%s','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','no\x20list\x20selected','scheduledAt','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','DIAL','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20selected','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','message','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','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','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','gosub','position','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','service','host','port','secure','auth','pass','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','subproject','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','Executed\x20command\x20%s\x20%s','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','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','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','no\x20variable\x20selected','join','exports','path','util','lodash','shelljs','odbc','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','rpc','mailRpc','getVariable','catch','prototype','getVoiceQueue','getVoiceQueueById','then','getSquareProject','name','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','list_id','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','ssmlGender','MALE','MP3','googleTTS','url','timeout','number','method','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','statusCode','options','googleDialogflow','key'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x8b38,0x159));var _0x88b3=function(_0x8afdd0,_0x548ad1){_0x8afdd0=_0x8afdd0-0x0;var _0x3de7ac=_0x8b38[_0x8afdd0];return _0x3de7ac;};'use strict';var fs=require('fs');var path=require(_0x88b3('0x0'));var util=require(_0x88b3('0x1'));var _=require(_0x88b3('0x2'));var sh=require(_0x88b3('0x3'));var odbc=require(_0x88b3('0x4'))();var rs=require('randomstring');var moment=require(_0x88b3('0x5'));var Mustache=require(_0x88b3('0x6'));var rp=require('request-promise');var logger=require(_0x88b3('0x7'))(_0x88b3('0x8'));var config=require(_0x88b3('0x9'));var scripts=require(_0x88b3('0xa'));var FILES_PATH=_0x88b3('0xb');var recursiveMapAttributes=[_0x88b3('0xc'),_0x88b3('0xd')];var verticesWithRetry=[_0x88b3('0xe'),_0x88b3('0xf'),'getsecretdigits'];var AGIVertices=function(_0x6c0155,_0x38d429,_0xbd6813){this[_0x88b3('0x10')]=_0x6c0155;this[_0x88b3('0x11')]=_0x38d429;this[_0x88b3('0x12')]=_0xbd6813;};AGIVertices['prototype'][_0x88b3('0x13')]=function(_0x478c4e,_0x36bc71){this[_0x88b3('0x11')]['getVariableById'](_0x478c4e)['then'](function(_0x1cd43a){_0x36bc71(null,_0x1cd43a?_0x1cd43a['name']:![]);})[_0x88b3('0x14')](function(_0x5f4c5c){_0x36bc71(_0x5f4c5c);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x16')]=function(_0x5150f7,_0x56cc65){this['rpc'][_0x88b3('0x17')](_0x5150f7)[_0x88b3('0x18')](function(_0x53ed76){_0x56cc65(null,_0x53ed76?_0x53ed76['name']:![]);})[_0x88b3('0x14')](function(_0x1396c3){_0x56cc65(_0x1396c3);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x19')]=function(_0x2b3811,_0x95577a){this[_0x88b3('0x11')]['getSquareProjectById'](_0x2b3811)[_0x88b3('0x18')](function(_0x463100){_0x95577a(null,_0x463100?_0x463100[_0x88b3('0x1a')]:![]);})[_0x88b3('0x14')](function(_0x5c04dd){_0x95577a(_0x5c04dd);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x1b')]=function(_0x5855f6,_0x31c951){this[_0x88b3('0x11')][_0x88b3('0x1c')](_0x5855f6)[_0x88b3('0x18')](function(_0x2c09e6){_0x31c951(null,_0x2c09e6?_0x2c09e6['dsn']:![]);})[_0x88b3('0x14')](function(_0x280ed2){_0x31c951(_0x280ed2);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x1d')]=function(_0x36129,_0x4f5ad6){this[_0x88b3('0x11')][_0x88b3('0x1e')](_0x36129)['then'](function(_0x4bd8b8){_0x4f5ad6(null,_0x4bd8b8?_0x4bd8b8['name']:![]);})[_0x88b3('0x14')](function(_0x13b6cc){_0x4f5ad6(_0x13b6cc);});};AGIVertices[_0x88b3('0x15')]['getTrunk']=function(_0xd412fd,_0x33fa01){this['rpc'][_0x88b3('0x1f')](_0xd412fd)[_0x88b3('0x18')](function(_0x23650e){_0x33fa01(null,_0x23650e?_0x23650e[_0x88b3('0x1a')]:![]);})[_0x88b3('0x14')](function(_0x23a33d){_0x33fa01(_0x23a33d);});};AGIVertices['prototype'][_0x88b3('0x20')]=function(_0x1d7d26,_0x1e356b){var _0x2fb1b6=this;this[_0x88b3('0x11')][_0x88b3('0x21')](_0x1d7d26)[_0x88b3('0x18')](function(_0x3775c6){_0x1e356b(null,_0x3775c6?_0x2fb1b6[_0x88b3('0x22')](_0x3775c6['save_name']):![]);})[_0x88b3('0x14')](function(_0x22e841){_0x1e356b(_0x22e841);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x23')]=function(_0x450a8f,_0x131e0f){this['rpc'][_0x88b3('0x24')](_0x450a8f)[_0x88b3('0x18')](function(_0x2ab502){_0x131e0f(null,_0x2ab502?_0x2ab502:![]);})['catch'](function(_0x3ec398){_0x131e0f(_0x3ec398);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x25')]=function(_0x3e51f4,_0x3e0ba7,_0x11a3ac){this['mailRpc'][_0x88b3('0x25')](_0x3e51f4,_0x3e0ba7)[_0x88b3('0x18')](function(){_0x11a3ac(null);})[_0x88b3('0x14')](function(_0x126aac){_0x11a3ac(_0x126aac);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x26')]=function(_0x155b7d,_0x1fb222){this[_0x88b3('0x11')][_0x88b3('0x27')](_0x155b7d)[_0x88b3('0x18')](function(_0x577f93){if(_0x577f93){if(_0x577f93[_0x88b3('0x28')]){_0x1fb222(null,[_0x577f93[_0x88b3('0x29')]]);}else{_0x1fb222(null,_['map'](_0x577f93[_0x88b3('0x2a')],_0x88b3('0x29')));}}else{_0x1fb222(null,![]);}})[_0x88b3('0x14')](function(_0x30676a){_0x1fb222(_0x30676a);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x22')]=function(_0x41f513){return util[_0x88b3('0x2b')](_0x88b3('0x2c'),FILES_PATH,_0x41f513);};AGIVertices[_0x88b3('0x15')][_0x88b3('0x2d')]=function(_0x456ac4,_0x533a70,_0x24d238){odbc[_0x88b3('0x2e')](_0x456ac4,function(_0x2af54a){if(_0x2af54a){logger[_0x88b3('0x2f')](_0x88b3('0x30'),_0x2af54a);_0x24d238(_0x2af54a);}else{logger[_0x88b3('0x31')](_0x88b3('0x32'));odbc[_0x88b3('0x33')](_0x533a70,function(_0x15d963,_0x36d287){if(_0x15d963){logger[_0x88b3('0x31')](_0x88b3('0x34'),_0x533a70);_0x24d238(_0x15d963);}else{logger[_0x88b3('0x31')]('Query\x20executed\x20correctly\x20%s',_0x533a70);odbc['close'](function(_0x3f4bd7){if(_0x3f4bd7){logger[_0x88b3('0x2f')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x3f4bd7);}_0x24d238(null,_0x36d287);});}});}});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x35')]=function(_0x5c2708,_0x32c88c){this['rpc']['getSmsAccountById'](_0x5c2708)[_0x88b3('0x18')](function(_0x2b8cb4){_0x32c88c(null,_0x2b8cb4?_0x2b8cb4:![]);})[_0x88b3('0x14')](function(_0x4cd656){_0x32c88c(_0x4cd656);});};AGIVertices['prototype'][_0x88b3('0x36')]=function(_0x279f0f,_0x516642){this['rpc'][_0x88b3('0x36')](_0x279f0f)[_0x88b3('0x18')](function(_0x2c9c63){_0x516642(null,_0x2c9c63);})['catch'](function(_0x5a535d){_0x516642(_0x5a535d);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x37')]=function(_0x1899e4,_0x3044cc,_0x3fdf43){this[_0x88b3('0x11')][_0x88b3('0x37')]({'uniqueid':this['channel'][_0x88b3('0x38')],'node':_0x1899e4[_0x88b3('0x39')],'application':_0x1899e4[_0x88b3('0x3a')],'data':_0x3044cc||null,'project_name':this['channel'][_0x88b3('0x3b')],'callerid':this['channel'][_0x88b3('0x3c')]})[_0x88b3('0x18')](function(_0x10973){if(_0x3fdf43){_0x3fdf43(null,_0x10973);}})[_0x88b3('0x14')](function(_0x2f2296){if(_0x3fdf43){_0x3fdf43(_0x2f2296);}});};AGIVertices['prototype'][_0x88b3('0x3d')]=function(_0x5792f8,_0x23465b,_0x40b6b7,_0x36921a){this[_0x88b3('0x11')]['createSquareRecording']({'uniqueid':this['channel'][_0x88b3('0x38')],'callerid':this[_0x88b3('0x10')][_0x88b3('0x3c')],'calleridname':this[_0x88b3('0x10')]['calleridname'],'context':this[_0x88b3('0x10')][_0x88b3('0x3e')],'extension':this[_0x88b3('0x10')]['extension'],'priority':this[_0x88b3('0x10')][_0x88b3('0x3f')],'accountcode':this[_0x88b3('0x10')]['accountcode'],'dnid':this['channel'][_0x88b3('0x40')],'projectName':this['channel'][_0x88b3('0x3b')],'saveName':_0x23465b,'filename':_0x5792f8[_0x88b3('0x41')]||_0x23465b,'savePath':_0x40b6b7})[_0x88b3('0x18')](function(_0x2d15e5){_0x36921a(null,_0x2d15e5);})[_0x88b3('0x14')](function(_0x26ec95){_0x36921a(_0x26ec95);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x42')]=function(_0x1aeaec,_0x2c3d37,_0x44b9ab,_0xb3ff69,_0x515e78){this[_0x88b3('0x11')][_0x88b3('0x42')]({'uniqueid':this[_0x88b3('0x10')][_0x88b3('0x38')],'body':_0x1aeaec,'direction':_0x2c3d37,'providerName':_0x44b9ab,'providerResponse':_0xb3ff69})['then'](function(_0x1d3d74){if(_0x515e78){_0x515e78(null,_0x1d3d74);}})['catch'](function(_0x5e7e63){if(_0x515e78){_0x515e78(_0x5e7e63);}});};AGIVertices['prototype'][_0x88b3('0x43')]=function(_0x21e73e,_0x5ba228){this[_0x88b3('0x11')][_0x88b3('0x43')]({'firstName':_[_0x88b3('0x44')](_0x21e73e[_0x88b3('0x1a')])||_[_0x88b3('0x45')](_0x21e73e['name'])?'callback_'+Math[_0x88b3('0x46')]():_0x21e73e['name'],'lastName':_[_0x88b3('0x44')](_0x21e73e[_0x88b3('0x47')])||_[_0x88b3('0x45')](_0x21e73e[_0x88b3('0x47')])?null:_0x21e73e['lastName'],'phone':_0x21e73e['phone'],'ListId':_0x21e73e[_0x88b3('0x48')],'scheduledat':_0x21e73e['scheduledAt'],'callbackUniqueid':this['channel'][_0x88b3('0x38')],'tags':_0x88b3('0x49'),'description':_0x88b3('0x4a')+_0x21e73e['scheduledAt'][_0x88b3('0x4b')](),'priority':_0x21e73e[_0x88b3('0x4c')]})[_0x88b3('0x18')](function(_0x24043e){_0x5ba228(null,_0x24043e);})[_0x88b3('0x14')](function(_0x46de13){_0x5ba228(_0x46de13);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x4d')]=function(_0x5092fd,_0x532d75){this[_0x88b3('0x11')][_0x88b3('0x4e')](_0x5092fd)[_0x88b3('0x18')](function(_0x365b0f){_0x532d75(null,_0x365b0f?_0x365b0f[_0x88b3('0x1a')]:![]);})[_0x88b3('0x14')](function(_0x560789){_0x532d75(_0x560789);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x4f')]=function(_0x572d21,_0x3cdff6,_0x1796bb){var _0x268fde={'role':_0x88b3('0x50')};_0x268fde[_0x572d21]=this[_0x88b3('0x10')][_0x88b3('0x3c')];this['rpc'][_0x88b3('0x4f')](_0x268fde,_0x3cdff6,this[_0x88b3('0x10')][_0x88b3('0x38')])[_0x88b3('0x18')](function(_0x149833){_0x1796bb(null,_['isNil'](_0x149833)?![]:!![]);})[_0x88b3('0x14')](function(_0x547c84){logger[_0x88b3('0x2f')](_0x547c84);_0x1796bb(null,![]);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x51')]=function(_0x2f08ae,_0x1a3b7b){var _0x454751={'role':'agent'};_0x454751[_0x2f08ae]=this[_0x88b3('0x10')]['callerid'];this[_0x88b3('0x11')][_0x88b3('0x51')](_0x454751)['then'](function(_0x508ea1){_0x1a3b7b(null,_[_0x88b3('0x45')](_0x508ea1)?![]:!![]);})[_0x88b3('0x14')](function(_0x26115b){logger[_0x88b3('0x2f')](_0x26115b);_0x1a3b7b(null,![]);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x52')]=function(_0x5d405b,_0x4e2142){var _0x265821={'role':'agent'};_0x265821[_0x5d405b]=this['channel']['callerid'];this['rpc'][_0x88b3('0x52')](_0x265821)['then'](function(_0x5921df){_0x4e2142(null,_['isNil'](_0x5921df)?![]:!![]);})[_0x88b3('0x14')](function(_0x214da4){logger[_0x88b3('0x2f')](_0x214da4);_0x4e2142(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x177857,_0x4ae410){var _0x1313bb={'role':_0x88b3('0x50')};_0x1313bb[_0x177857]=this[_0x88b3('0x10')][_0x88b3('0x3c')];var _0x1a7496=_0x177857!=_0x88b3('0x53')?util['format'](_0x88b3('0x54'),_0x88b3('0x55'),this['channel'][_0x88b3('0x3c')]):undefined;this[_0x88b3('0x11')][_0x88b3('0x56')](_0x1313bb,_0x1a7496)[_0x88b3('0x18')](function(_0x1fe8ac){_0x4ae410(null,_[_0x88b3('0x45')](_0x1fe8ac)?![]:!![]);})[_0x88b3('0x14')](function(_0xd18d54){logger['error'](_0xd18d54);_0x4ae410(null,![]);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x57')]=function(_0x24ac01,_0x23dc67){sh[_0x88b3('0x58')](_[_0x88b3('0x59')](_0x24ac01),function(_0x50cb0d,_0x489509){var _0x45ea3e=_0x489509[_0x88b3('0x5a')](/(\r\n|\n|\r)/gm,'');_0x23dc67(null,_0x45ea3e);});};AGIVertices['prototype'][_0x88b3('0x5b')]=function(_0x255044,_0x3f1f02){scripts[_0x88b3('0x5b')](_0x255044[_0x88b3('0x5c')],_0x255044['google_cloud_tts_text_type']||_0x88b3('0x5d'),_0x255044[_0x88b3('0x5d')],_0x255044[_0x88b3('0x5e')]||'en-US',_0x255044[_0x88b3('0x5f')]||_0x88b3('0x60'),_0x255044['audioEncoding']||_0x88b3('0x61'))['then'](function(_0x53a46f){_0x3f1f02(null,_0x53a46f);})[_0x88b3('0x14')](function(_0x1f4162){_0x3f1f02(_0x1f4162);});};AGIVertices[_0x88b3('0x15')]['googleTTS']=function(_0x1d245c,_0x1b1771){scripts[_0x88b3('0x62')](_0x1d245c['text'],_0x1d245c['google_tts_language']||'en',0x1)[_0x88b3('0x18')](function(_0x221886){_0x1b1771(null,_0x221886);})[_0x88b3('0x14')](function(_0x4949a5){_0x1b1771(_0x4949a5);});};AGIVertices[_0x88b3('0x15')]['restAPI']=function(_0x8a8e5c,_0x2a2c30){var _0x331973={'uri':_0x8a8e5c[_0x88b3('0x63')],'method':_0x8a8e5c['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x8a8e5c[_0x88b3('0x64')])===_0x88b3('0x65')&&parseInt(_0x8a8e5c[_0x88b3('0x64')])>=0x1?parseInt(_0x8a8e5c[_0x88b3('0x64')])*0x3e8:0x5*0x3e8};if(_['includes'](['POST','PUT'],_0x331973[_0x88b3('0x66')][_0x88b3('0x67')]())){try{_0x331973['body']=_0x8a8e5c[_0x88b3('0xd')]?JSON[_0x88b3('0x68')](_0x8a8e5c[_0x88b3('0xd')]):{};}catch(_0x5b5b27){logger[_0x88b3('0x2f')](_0x88b3('0x69'),_0x5b5b27);}}try{_0x331973[_0x88b3('0x6a')]=_0x8a8e5c['rawHeaders']?JSON[_0x88b3('0x68')](_0x8a8e5c[_0x88b3('0xc')]):{};}catch(_0x22c8c2){logger[_0x88b3('0x2f')](_0x88b3('0x6b'),_0x22c8c2);}if(_0x8a8e5c[_0x88b3('0x6c')]){try{var _0x460217=require(_0x8a8e5c[_0x88b3('0x6c')])[_0x88b3('0x6d')](this,_0x331973);_0x331973[_0x88b3('0x6e')]=Mustache[_0x88b3('0x6f')](_0x8a8e5c['url'],_0x460217,{},['$$','$$']);if(_0x331973['headers']){_0x331973[_0x88b3('0x6a')]=JSON[_0x88b3('0x68')](Mustache[_0x88b3('0x6f')](JSON[_0x88b3('0x70')](_0x331973[_0x88b3('0x6a')]),_0x460217,{},['$$','$$']));}if(_0x331973[_0x88b3('0x71')]){_0x331973[_0x88b3('0x71')]=JSON['parse'](Mustache[_0x88b3('0x6f')](JSON[_0x88b3('0x70')](_0x331973[_0x88b3('0x71')]),_0x460217,{},['$$','$$']));}}catch(_0x4069c8){logger[_0x88b3('0x2f')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x4069c8);}}rp(_0x331973)[_0x88b3('0x18')](function(_0x21cb9f){var _0x189e28={'statusCode':_0x21cb9f[_0x88b3('0x72')]||0xc8,'statusMessage':_0x21cb9f['statusMessage']||'OK','headers':_0x21cb9f['headers']||{},'body':_0x21cb9f[_0x88b3('0x71')]||{}};_0x2a2c30(null,_0x189e28);})['catch'](function(_0x48d307){var _0x416e95={'statusCode':_0x48d307[_0x88b3('0x72')]||0x1f4,'statusMessage':_0x48d307['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x48d307['options'][_0x88b3('0x6a')]||{},'body':_0x48d307[_0x88b3('0x73')][_0x88b3('0x71')]||{}};_0x2a2c30(null,_0x416e95);});};AGIVertices[_0x88b3('0x15')]['googleDialogflow']=function(_0x54ac85,_0x486a4d){scripts[_0x88b3('0x74')](this[_0x88b3('0x10')][_0x88b3('0x38')],_0x54ac85[_0x88b3('0x75')],_0x54ac85[_0x88b3('0x5d')],_0x54ac85[_0x88b3('0x76')]||'en')[_0x88b3('0x18')](function(_0x1ae635){_0x486a4d(null,_0x1ae635);})['catch'](function(_0x5ee69a){_0x486a4d(_0x5ee69a);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x77')]=function(_0x56e9b8,_0x4ada1b){scripts[_0x88b3('0x77')](this[_0x88b3('0x10')][_0x88b3('0x38')],_0x56e9b8[_0x88b3('0x78')],_0x56e9b8[_0x88b3('0x79')],_0x56e9b8[_0x88b3('0x7a')],_0x56e9b8[_0x88b3('0x5d')],_0x56e9b8['dialogflowV2_language']||'en')[_0x88b3('0x18')](function(_0x1924e5){_0x4ada1b(null,_0x1924e5);})[_0x88b3('0x14')](function(_0xa2ace7){_0x4ada1b(_0xa2ace7);});};AGIVertices['prototype'][_0x88b3('0x7b')]=function(_0x164c09,_0x50a770){scripts[_0x88b3('0x7b')](this[_0x88b3('0x10')],_0x164c09)[_0x88b3('0x18')](function(_0x437056){_0x50a770(null,_0x437056);})['catch'](function(_0x3d70ad){_0x50a770(_0x3d70ad);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x7c')]=function(_0x1f3ae1,_0x395306){scripts['ispeechTTS'](_0x1f3ae1[_0x88b3('0x75')],_0x1f3ae1['text'],_0x1f3ae1['ispeech_tts_language']||'en-US',_0x1f3ae1[_0x88b3('0x7d')])[_0x88b3('0x18')](function(_0x31ebd1){_0x395306(null,_0x31ebd1);})[_0x88b3('0x14')](function(_0x46e0f9){_0x395306(_0x46e0f9);});};AGIVertices[_0x88b3('0x15')]['ispeechASR']=function(_0x2da3e7,_0x47870b,_0x3c838f){scripts[_0x88b3('0x7e')](_0x47870b,_0x2da3e7[_0x88b3('0x75')],_0x2da3e7[_0x88b3('0x7f')]||_0x88b3('0x80'),this[_0x88b3('0x81')](_0x2da3e7[_0x88b3('0x82')])?_0x2da3e7[_0x88b3('0x82')]:undefined)[_0x88b3('0x18')](function(_0x42f855){_0x3c838f(null,_0x42f855);})[_0x88b3('0x14')](function(_0x2ea744){_0x3c838f(_0x2ea744);});};AGIVertices[_0x88b3('0x15')]['awsPolly']=function(_0x359ddc,_0x4152e6){scripts[_0x88b3('0x83')](_0x359ddc['aws_access_key_id'],_0x359ddc[_0x88b3('0x84')],_0x359ddc[_0x88b3('0x85')],_0x359ddc[_0x88b3('0x86')]||_0x88b3('0x87'),_0x359ddc[_0x88b3('0x5d')],_0x359ddc[_0x88b3('0x88')]||_0x88b3('0x5d'))[_0x88b3('0x18')](function(_0x3df7d5){_0x4152e6(null,_0x3df7d5);})[_0x88b3('0x14')](function(_0x560925){_0x4152e6(_0x560925);});};AGIVertices[_0x88b3('0x15')]['awsLex']=function(_0x4b9c86,_0x236b49){scripts['awsLex'](this['channel'][_0x88b3('0x38')],_0x4b9c86['aws_access_key_id'],_0x4b9c86[_0x88b3('0x84')],_0x4b9c86['aws_lex_region'],_0x4b9c86[_0x88b3('0x5d')],_0x4b9c86['aws_bot_name'])[_0x88b3('0x18')](function(_0x1cbcc5){_0x236b49(null,_0x1cbcc5);})[_0x88b3('0x14')](function(_0x538053){_0x236b49(_0x538053);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x89')]=function(_0x173742,_0x5777e4,_0x52a12a){scripts['googleASR'](_0x5777e4,_0x173742[_0x88b3('0x75')],_0x173742[_0x88b3('0x8a')]||'en-US')[_0x88b3('0x18')](function(_0x48b209){_0x52a12a(null,_0x48b209);})['catch'](function(_0x173cc5){_0x52a12a(_0x173cc5);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x8b')]=function(_0x32b541,_0x2aa43f,_0x3c2d7a){scripts['tildeASR'](_0x2aa43f,_0x32b541['appid'],_0x32b541['appsecret'],_0x32b541[_0x88b3('0x6e')])[_0x88b3('0x18')](function(_0x3c5d2c){_0x3c2d7a(null,_0x3c5d2c);})[_0x88b3('0x14')](function(_0x3283d3){_0x3c2d7a(_0x3283d3);});};AGIVertices[_0x88b3('0x15')][_0x88b3('0x8c')]=function(_0x5e4efa){var _0x743d2c=_[_0x88b3('0x8d')](verticesWithRetry,_0x5e4efa[_0x88b3('0x3a')])?_0x5e4efa:_[_0x88b3('0x8e')](_0x5e4efa);for(var _0x5b1666 in _0x743d2c){if(_0x743d2c[_0x88b3('0x8f')](_0x5b1666)){if(_0x743d2c[_0x5b1666]&&_[_0x88b3('0x90')](_0x743d2c[_0x5b1666])){if(_[_0x88b3('0x8d')](recursiveMapAttributes,_0x5b1666)){_0x743d2c[_0x5b1666]=this[_0x88b3('0x91')](_0x743d2c[_0x5b1666]);}else{_0x743d2c[_0x5b1666]=this[_0x88b3('0x92')](_0x743d2c[_0x5b1666]);}}}}return _0x743d2c;};AGIVertices[_0x88b3('0x15')]['recursiveNodeIndex']=function(_0x58b303){for(var _0x16ef3c in _0x58b303){if(_0x58b303[_0x88b3('0x8f')](_0x16ef3c)){if(_['isPlainObject'](_0x58b303[_0x16ef3c])){this[_0x88b3('0x93')](_0x58b303[_0x16ef3c]);}else if(_[_0x88b3('0x94')](_0x58b303[_0x16ef3c])){for(var _0x2ed501=0x0;_0x2ed501<_0x58b303[_0x16ef3c][_0x88b3('0x95')];_0x2ed501++){this[_0x88b3('0x93')](_0x58b303[_0x16ef3c][_0x2ed501]);}}else if(_[_0x88b3('0x90')](_0x58b303[_0x16ef3c])){_0x58b303[_0x16ef3c]=this[_0x88b3('0x92')](_0x58b303[_0x16ef3c]);}}}};AGIVertices[_0x88b3('0x15')][_0x88b3('0x96')]=function(_0x304b6f,_0x728394){for(var _0x17a824 in _0x304b6f){if(_0x304b6f[_0x88b3('0x8f')](_0x17a824)){if(_[_0x88b3('0x97')](_0x304b6f[_0x17a824])){if(!_['isEmpty'](_0x304b6f[_0x17a824])){this[_0x88b3('0x96')](_0x304b6f[_0x17a824],util[_0x88b3('0x2b')](_0x88b3('0x98'),_0x728394,_0x17a824));}}else if(_[_0x88b3('0x94')](_0x304b6f[_0x17a824])){for(var _0x53e46c=0x0;_0x53e46c<_0x304b6f[_0x17a824][_0x88b3('0x95')];_0x53e46c++){this[_0x88b3('0x96')](_0x304b6f[_0x17a824][_0x53e46c],util[_0x88b3('0x2b')](_0x88b3('0x98'),_0x728394,_0x17a824+'['+_0x53e46c+']'));}}else{if(!_['isNil'](_0x304b6f[_0x17a824])){this['channel']['setVariable'](util[_0x88b3('0x2b')](_0x88b3('0x98'),_0x728394,_0x17a824),_0x304b6f[_0x17a824]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x554f20){try{var _0x225df3=JSON[_0x88b3('0x68')](_0x554f20);this[_0x88b3('0x93')](_0x225df3);return JSON[_0x88b3('0x70')](_0x225df3);}catch(_0x6820e8){return this[_0x88b3('0x92')](_0x554f20);}};AGIVertices['prototype'][_0x88b3('0x92')]=function(_0x3c3cd1){var _0x358ff7=_0x3c3cd1['split']('{');for(var _0x38b35e=0x1;_0x38b35e<_0x358ff7[_0x88b3('0x95')];_0x38b35e+=0x1){var _0x7f42d1=_0x358ff7[_0x38b35e][_0x88b3('0x99')]('}');if(_0x7f42d1['length']>0x1){_0x3c3cd1=_0x3c3cd1[_0x88b3('0x9a')]('{'+_0x7f42d1[0x0]+'}',this[_0x88b3('0x10')][_0x88b3('0x13')](_0x7f42d1[0x0])[_0x88b3('0x9b')]||_0x7f42d1[0x0]);}}if(_0x358ff7['length']===0x1){return _0x3c3cd1[_0x88b3('0x4b')]();}return this['replaceAllVariables'](_0x3c3cd1);};AGIVertices[_0x88b3('0x15')][_0x88b3('0x9c')]=function(_0x59c6ae,_0x3b6140){var _0xb33922=this[_0x88b3('0x10')]['getVariable'](_0x59c6ae);if(_0xb33922[_0x88b3('0x9d')]===-0x1){return _0xb33922;}logger[_0x88b3('0x31')](util['format'](_0x88b3('0x9e'),_0x3b6140,_0xb33922[_0x88b3('0x9b')]));return this[_0x88b3('0x10')][_0x88b3('0x9f')](_0x3b6140,_0xb33922[_0x88b3('0x9b')]);};AGIVertices['prototype']['isConfigured']=function(_0x1ec839){return _0x1ec839&&_0x1ec839!=='0'&&_0x1ec839!=='-1'&&_0x1ec839!=='';};AGIVertices[_0x88b3('0x15')]['maxRetry']=function(_0x24a876){this[_0x88b3('0x37')][_0x88b3('0x6d')](this,_0x24a876,'-');_0x24a876['retry']=_0x24a876[_0x88b3('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x88b3('0x15')]['mrcpsynth']=function(_0x390f1f){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0xa1'),_0x390f1f['label']));if(!this[_0x88b3('0x81')](_0x390f1f[_0x88b3('0x5d')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')]('no\x20text\x20configured');}var _0x563584='\x22'+_0x390f1f['text']+'\x22';if(this[_0x88b3('0x81')](_0x390f1f[_0x88b3('0x73')])){_0x563584+=','+_0x390f1f[_0x88b3('0x73')];}var _0x173d16=this['channel'][_0x88b3('0x58')]('MRCPSynth',_0x563584);if(_0x173d16[_0x88b3('0x9d')]===-0x1){return _0x173d16;}return this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0xa3'),_0x563584));};AGIVertices['prototype'][_0x88b3('0xa4')]=function(_0xc5bd61){logger['info'](util[_0x88b3('0x2b')](_0x88b3('0xa5'),_0xc5bd61[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0xc5bd61[_0x88b3('0xa6')])){return this[_0x88b3('0x10')]['noop'](_0x88b3('0xa7'));}var _0x2987cb=_0xc5bd61[_0x88b3('0xa6')];if(this[_0x88b3('0x81')](_0xc5bd61[_0x88b3('0x73')])){_0x2987cb+=','+_0xc5bd61[_0x88b3('0x73')];}var _0x585a23=this[_0x88b3('0x10')]['exec'](_0x88b3('0xa8'),_0x2987cb);if(_0x585a23[_0x88b3('0x9d')]===-0x1){return _0x585a23;}var _0x330910=this[_0x88b3('0x9c')](_0x88b3('0xa9'),'MRCP_RECOG_CONFIDENCE');if(_0x330910[_0x88b3('0x9d')]===-0x1){return _0x330910;}var _0x4f6379=this[_0x88b3('0x9c')]('RECOG_INPUT()',_0x88b3('0xaa'));if(_0x4f6379[_0x88b3('0x9d')]===-0x1){return _0x4f6379;}var _0x3ecf4d=this['getAndSetVariable'](_0x88b3('0xab'),_0x88b3('0xac'));if(_0x3ecf4d[_0x88b3('0x9d')]===-0x1){return _0x3ecf4d;}return this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0xad'),_0x2987cb));};AGIVertices['prototype']['agi']=function(_0x99b486){logger[_0x88b3('0x31')](util['format'](_0x88b3('0xae'),_0x99b486[_0x88b3('0x39')]));return this[_0x88b3('0x10')][_0x88b3('0x8')]([_0x99b486[_0x88b3('0xaf')],_0x99b486[_0x88b3('0xb0')]]);};AGIVertices['prototype']['answer']=function(_0x3e328d){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0xb1'),_0x3e328d[_0x88b3('0x39')]));if(this['isConfigured'](_0x3e328d[_0x88b3('0x64')])){logger[_0x88b3('0x31')](util['format'](_0x88b3('0xb2'),_0x3e328d[_0x88b3('0x64')]));var _0x47c3c1=this[_0x88b3('0x10')][_0x88b3('0xb3')](_0x3e328d[_0x88b3('0x64')]);if(_0x47c3c1[_0x88b3('0x9d')]===-0x1){return _0x47c3c1;}}return this['channel'][_0x88b3('0xb4')]();};AGIVertices[_0x88b3('0x15')][_0x88b3('0x49')]=function(_0x46217c){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x46217c[_0x88b3('0x39')]));if(!this['isConfigured'](_0x46217c[_0x88b3('0x48')])){return this['channel'][_0x88b3('0x2f')](_0x46217c,_0x88b3('0xb5'));}_0x46217c[_0x88b3('0xb6')]=moment();if(this['isConfigured'](_0x46217c[_0x88b3('0xb7')])){_0x46217c['scheduledAt']=moment()[_0x88b3('0xb8')](_0x46217c[_0x88b3('0xb7')],_0x88b3('0xb9'));}if(!this['isConfigured'](_0x46217c[_0x88b3('0x4c')])){_0x46217c[_0x88b3('0x4c')]=0x2;}this[_0x88b3('0x43')]['sync'](this,_0x46217c);return this['channel'][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0xba'),_0x46217c[_0x88b3('0xbb')],_0x46217c['list_id'],_0x46217c['scheduledAt']));};AGIVertices[_0x88b3('0x15')][_0x88b3('0xbc')]=function(_0x3656f9){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0xbd'),_0x3656f9[_0x88b3('0x39')]));var _0xc5b2ee=this[_0x88b3('0x10')]['exec'](_0x3656f9[_0x88b3('0xbe')],_0x3656f9[_0x88b3('0x73')]);if(_0xc5b2ee[_0x88b3('0x9d')]===-0x1){return _0xc5b2ee;}return this[_0x88b3('0x10')][_0x88b3('0xa2')](util['format']('Executed\x20command\x20%s\x20%s',_0x3656f9[_0x88b3('0xbe')],_0x3656f9[_0x88b3('0x73')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x4f12e2){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0xbf'),_0x4f12e2[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0x4f12e2[_0x88b3('0x5d')])){return this['channel'][_0x88b3('0xa2')](_0x88b3('0xc0'));}var _0x26bb89='\x22'+_0x4f12e2[_0x88b3('0x5d')]+'\x22';if(this[_0x88b3('0x81')](_0x4f12e2[_0x88b3('0x73')])){_0x26bb89+=','+_0x4f12e2[_0x88b3('0x73')];}var _0xed2be0=this[_0x88b3('0x10')][_0x88b3('0x58')]('MRCPSynth',_0x26bb89);if(_0xed2be0[_0x88b3('0x9d')]===-0x1){return _0xed2be0;}return this[_0x88b3('0x10')]['noop'](util[_0x88b3('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x26bb89));};AGIVertices['prototype']['sestektts']=function(_0x5850af){logger['info'](util[_0x88b3('0x2b')](_0x88b3('0xc1'),_0x5850af[_0x88b3('0x39')]));if(!this['isConfigured'](_0x5850af[_0x88b3('0x5d')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')](_0x88b3('0xc0'));}var _0x38bd8d='\x22'+_0x5850af['text']+'\x22';if(this[_0x88b3('0x81')](_0x5850af['options'])){_0x38bd8d+=','+_0x5850af[_0x88b3('0x73')];}var _0x65993a=this[_0x88b3('0x10')][_0x88b3('0x58')]('MRCPSynth',_0x38bd8d);if(_0x65993a['result']===-0x1){return _0x65993a;}return this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0xa3'),_0x38bd8d));};AGIVertices['prototype']['lumenvoxasr']=function(_0x7e0a3f){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x7e0a3f[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0x7e0a3f[_0x88b3('0xa6')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')](_0x88b3('0xa7'));}var _0x3f824d=_0x7e0a3f[_0x88b3('0xa6')];if(this[_0x88b3('0x81')](_0x7e0a3f[_0x88b3('0x73')])){_0x3f824d+=','+_0x7e0a3f[_0x88b3('0x73')];}var _0x56418f=this['channel']['exec']('MRCPRecog',_0x3f824d);if(_0x56418f[_0x88b3('0x9d')]===-0x1){return _0x56418f;}var _0x24d7db=this[_0x88b3('0x9c')](_0x88b3('0xa9'),_0x88b3('0xc2'));if(_0x24d7db[_0x88b3('0x9d')]===-0x1){return _0x24d7db;}var _0x16fa51=this['getAndSetVariable']('RECOG_INPUT()',_0x88b3('0xc3'));if(_0x16fa51['result']===-0x1){return _0x16fa51;}var _0x2a8728=this[_0x88b3('0x9c')](_0x88b3('0xab'),_0x88b3('0xc4'));if(_0x2a8728[_0x88b3('0x9d')]===-0x1){return _0x2a8728;}return this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0xad'),_0x3f824d));};AGIVertices['prototype'][_0x88b3('0xc5')]=function(_0x36e1aa){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x36e1aa[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0x36e1aa[_0x88b3('0xa6')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')]('no\x20grammar\x20configured');}var _0x441f17=_0x36e1aa[_0x88b3('0xa6')];if(this['isConfigured'](_0x36e1aa[_0x88b3('0x73')])){_0x441f17+=','+_0x36e1aa[_0x88b3('0x73')];}var _0xae034e=this[_0x88b3('0x10')]['exec'](_0x88b3('0xa8'),_0x441f17);if(_0xae034e[_0x88b3('0x9d')]===-0x1){return _0xae034e;}var _0x325994=this[_0x88b3('0x9c')]('RECOG_CONFIDENCE()',_0x88b3('0xc6'));if(_0x325994[_0x88b3('0x9d')]===-0x1){return _0x325994;}var _0x19fdbe=this[_0x88b3('0x9c')](_0x88b3('0xc7'),_0x88b3('0xc8'));if(_0x19fdbe[_0x88b3('0x9d')]===-0x1){return _0x19fdbe;}var _0x11c176=this['getAndSetVariable'](_0x88b3('0xab'),'SESTEK_ASR_INSTANCE');if(_0x11c176[_0x88b3('0x9d')]===-0x1){return _0x11c176;}return this[_0x88b3('0x10')]['noop'](util[_0x88b3('0x2b')](_0x88b3('0xad'),_0x441f17));};AGIVertices[_0x88b3('0x15')][_0x88b3('0xc9')]=function(_0x36fc7d){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0xca'),_0x36fc7d[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0x36fc7d[_0x88b3('0xcb')])){return this['channel'][_0x88b3('0x2f')](_0x36fc7d,_0x88b3('0xcc'));}var _0x5659eb=this['getSquareOdbc']['sync'](this,_0x36fc7d['odbc_id']);if(!_0x5659eb){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x36fc7d,_0x88b3('0xcd'));}if(!this['isConfigured'](_0x36fc7d['query'])){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x36fc7d,_0x88b3('0xce'));}var _0x21fa0c=_0x36fc7d['query'][_0x88b3('0x5a')](/(\r\n|\n|\r)/gm,'\x20');this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0xcf'),_0x21fa0c));var _0x1d010a=this[_0x88b3('0x2d')]['sync'](this,_0x5659eb,_0x21fa0c);this[_0x88b3('0x37')][_0x88b3('0x6d')](this,_0x36fc7d,_0x21fa0c);if(!this[_0x88b3('0x81')](_0x36fc7d[_0x88b3('0xd0')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')](_0x88b3('0xd1'));}var _0x329958=this[_0x88b3('0x13')]['sync'](this,_0x36fc7d[_0x88b3('0xd0')]);if(!_0x329958){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x36fc7d,_0x88b3('0xd2'));}var _0x4c5b19=this;_0x1d010a[_0x88b3('0xd3')](function(_0x4b38d5,_0x263be2){Object[_0x88b3('0xd4')](_0x4b38d5)[_0x88b3('0xd3')](function(_0xc98b94){_0x4c5b19[_0x88b3('0x10')][_0x88b3('0x9f')](util[_0x88b3('0x2b')](_0x88b3('0xd5'),_0x329958,_0x263be2,_0xc98b94),_0x4b38d5[_0xc98b94]);});});this[_0x88b3('0x10')][_0x88b3('0x9f')](util[_0x88b3('0x2b')]('%s_ROWS_COUNT',_0x329958),_0x1d010a[_0x88b3('0x95')]);return this['channel'][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0xd6'),_0x329958));};AGIVertices[_0x88b3('0x15')]['dial']=function(_0x282657){logger[_0x88b3('0xd7')](util[_0x88b3('0x2b')](_0x88b3('0xd8'),_0x282657[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0x282657['sip_id'])){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x282657,_0x88b3('0xd9'));}var _0x243bac=this[_0x88b3('0x1d')]['sync'](this,_0x282657[_0x88b3('0xda')]);if(!_0x243bac){return this[_0x88b3('0x10')]['error'](_0x282657,'no\x20user\x20found');}var _0x9606b7=this[_0x88b3('0x10')][_0x88b3('0x58')](_0x88b3('0xdb'),[util[_0x88b3('0x2b')]('SIP/%s',_0x243bac),_0x282657['timeout'],_0x282657['opts'],_0x282657['url']]);if(_0x9606b7[_0x88b3('0x9d')]===-0x1){return _0x9606b7;}return this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0xdc'),_0x88b3('0xdb')));};AGIVertices[_0x88b3('0x15')][_0x88b3('0xdd')]=function(_0x5772d5){logger['info'](util[_0x88b3('0x2b')](_0x88b3('0xde'),_0x5772d5[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0x5772d5[_0x88b3('0x75')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')](_0x88b3('0xdf'));}if(!this[_0x88b3('0x81')](_0x5772d5['text'])){return this[_0x88b3('0x10')][_0x88b3('0xa2')](_0x88b3('0xc0'));}this['channel'][_0x88b3('0xe0')]=!![];this[_0x88b3('0x37')](_0x5772d5);this['createSquareMessage'](_0x5772d5[_0x88b3('0x5d')],'in','','');this[_0x88b3('0x10')][_0x88b3('0xa2')](util['format'](_0x88b3('0xe1'),_0x5772d5['text']));var _0x1562f0=this[_0x88b3('0x74')][_0x88b3('0x6d')](this,_0x5772d5);if(_0x1562f0){for(var _0x55c22a in _0x1562f0){if(_0x1562f0[_0x88b3('0x8f')](_0x55c22a)){this[_0x88b3('0x10')][_0x88b3('0x9f')](util[_0x88b3('0x2b')](_0x88b3('0xe2'),_0x55c22a['toUpperCase']()),_0x1562f0[_0x55c22a]);}}this['createSquareMessage'](_0x1562f0[_0x88b3('0xe3')],_0x88b3('0xe4'),'dialogflow','');return this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0xe5'),_0x1562f0[_0x88b3('0xe3')]));}return this['channel'][_0x88b3('0x2f')](_0x5772d5,_0x88b3('0xe6'));};AGIVertices['prototype'][_0x88b3('0xe7')]=function(_0x304c87){logger['info'](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x304c87['label']));if(!this['isConfigured'](_0x304c87[_0x88b3('0x78')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')]('no\x20project_id\x20configured');}if(!this[_0x88b3('0x81')](_0x304c87[_0x88b3('0x79')])){return this['channel'][_0x88b3('0xa2')](_0x88b3('0xe8'));}if(!this[_0x88b3('0x81')](_0x304c87[_0x88b3('0x7a')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')](_0x88b3('0xe9'));}if(!this[_0x88b3('0x81')](_0x304c87[_0x88b3('0xea')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')](_0x88b3('0xeb'));}if(!this['isConfigured'](_0x304c87[_0x88b3('0x5d')])){return this['channel'][_0x88b3('0xa2')](_0x88b3('0xc0'));}this[_0x88b3('0x10')][_0x88b3('0xe0')]=!![];this['createSquareDetailsReport'](_0x304c87);this[_0x88b3('0x42')](_0x304c87['text'],'in','','');this[_0x88b3('0x10')]['noop'](util[_0x88b3('0x2b')](_0x88b3('0xec'),_0x304c87[_0x88b3('0x5d')]));var _0x990de3=this[_0x88b3('0x77')]['sync'](this,_0x304c87);if(_0x990de3){for(var _0x443d25 in _0x990de3){if(_0x990de3['hasOwnProperty'](_0x443d25)){if(_0x443d25!==_0x88b3('0xed')){this[_0x88b3('0x10')][_0x88b3('0x9f')](util['format'](_0x88b3('0xe2'),_0x443d25[_0x88b3('0x67')]()),_0x990de3[_0x443d25]);}}}this[_0x88b3('0x42')](_0x990de3[_0x88b3('0xe3')],_0x88b3('0xe4'),_0x88b3('0xe7'),_0x990de3['providerResponse']);return this['channel'][_0x88b3('0xa2')](util[_0x88b3('0x2b')]('DialogflowV2\x20Result\x20%s',_0x990de3[_0x88b3('0xe3')]));}return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x304c87,_0x88b3('0xee'));};AGIVertices[_0x88b3('0x15')][_0x88b3('0xef')]=function(_0x3cb189){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0xf0'),_0x3cb189[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0x3cb189[_0x88b3('0xf1')])){return this['channel']['noop'](_0x88b3('0xf2'));}if(!this['isConfigured'](_0x3cb189[_0x88b3('0xf3')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')](_0x88b3('0xf4'));}if(!this[_0x88b3('0x81')](_0x3cb189[_0x88b3('0xf5')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')](_0x88b3('0xf6'));}if(!this[_0x88b3('0x81')](_0x3cb189[_0x88b3('0xf7')])){return this[_0x88b3('0x10')]['noop'](_0x88b3('0xc0'));}this[_0x88b3('0x10')][_0x88b3('0xe0')]=!![];this[_0x88b3('0x37')](_0x3cb189);this[_0x88b3('0x42')](_0x3cb189['text'],'in','','');this['channel'][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0xf8'),_0x3cb189[_0x88b3('0x5d')]));var _0x33a03f=this[_0x88b3('0x7b')][_0x88b3('0x6d')](this,_0x3cb189);if(_0x33a03f){for(var _0x2292d6 in _0x33a03f){if(_0x33a03f['hasOwnProperty'](_0x2292d6)){this[_0x88b3('0x10')][_0x88b3('0x9f')](util[_0x88b3('0x2b')]('SESTEK_NDA_%s',_0x2292d6[_0x88b3('0x67')]()),_0x33a03f[_0x2292d6]);}}this[_0x88b3('0x42')](_0x33a03f[_0x88b3('0xe3')],'out','sesteknda','');if(_0x33a03f[_0x88b3('0xf9')]){this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x33a03f[_0x88b3('0xf9')]));var _0x296d07=this[_0x88b3('0x10')][_0x88b3('0xfa')](_0x33a03f[_0x88b3('0xf9')]);try{fs[_0x88b3('0xfb')](_0x33a03f[_0x88b3('0xf9')]+_0x88b3('0xfc'));}catch(_0x406e17){logger['error'](_0x406e17);}return _0x296d07;}else{return this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')]('SestekNDA\x20Result\x20%s',_0x33a03f[_0x88b3('0xe3')]));}}return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x3cb189,_0x88b3('0xfd'));};AGIVertices[_0x88b3('0x15')][_0x88b3('0xfe')]=function(_0x29cb7d){logger['info'](util[_0x88b3('0x2b')](_0x88b3('0xff'),_0x29cb7d['label']));return this[_0x88b3('0x10')]['noop'](_0x88b3('0xfe'));};AGIVertices[_0x88b3('0x15')][_0x88b3('0x100')]=function(_0x3f4d7c){logger['info'](util['format'](_0x88b3('0x101'),_0x3f4d7c[_0x88b3('0x39')]));var _0x4d68df='';if(_0x3f4d7c[_0x88b3('0x102')]){if(!this[_0x88b3('0x81')](_0x3f4d7c['trunk_id'])){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x3f4d7c,_0x88b3('0x103'));}else{var _0x12848e=parseInt(_0x3f4d7c['trunk_id'],0xa);if(isNaN(_0x12848e)){_0x4d68df=_0x3f4d7c[_0x88b3('0x102')];}else{_0x4d68df=this[_0x88b3('0x104')][_0x88b3('0x6d')](this,_0x3f4d7c[_0x88b3('0x102')]);if(!_0x4d68df){return this['channel'][_0x88b3('0x2f')](_0x3f4d7c,_0x88b3('0x105'));}}}}else if(_0x3f4d7c[_0x88b3('0x106')]){_0x4d68df=_0x3f4d7c[_0x88b3('0x106')];}else{return this[_0x88b3('0x10')]['error'](_0x3f4d7c,_0x88b3('0x103'));}var _0x361a65=this['channel'][_0x88b3('0x58')](_0x88b3('0xdb'),[util[_0x88b3('0x2b')](_0x88b3('0x107'),_0x4d68df,_0x3f4d7c[_0x88b3('0xbb')]),_0x3f4d7c[_0x88b3('0x64')],_0x3f4d7c[_0x88b3('0x108')],_0x3f4d7c[_0x88b3('0x63')]]);if(_0x361a65[_0x88b3('0x9d')]===-0x1){return _0x361a65;}return this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')]('Executed\x20command\x20%s',_0x88b3('0xdb')));};AGIVertices[_0x88b3('0x15')][_0x88b3('0x109')]=function(_0x15ddf5){logger['info'](util[_0x88b3('0x2b')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x15ddf5['label']));return this['channel']['noop'](_0x88b3('0x109'));};AGIVertices[_0x88b3('0x15')][_0x88b3('0xf')]=function(_0x5a74da){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x10a'),_0x5a74da['label']));if(_0x5a74da[_0x88b3('0x10b')]===0x0){return this[_0x88b3('0xa0')](_0x5a74da);}_0x5a74da[_0x88b3('0x10b')]-=0x1;if(!this[_0x88b3('0x81')](_0x5a74da[_0x88b3('0x10c')])){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x5a74da,_0x88b3('0x10d'));}var _0x8258db=this[_0x88b3('0x20')][_0x88b3('0x6d')](this,_0x5a74da['file_id']);if(!_0x8258db){return this['channel'][_0x88b3('0x2f')](_0x5a74da,'no\x20file\x20audio\x20found');}if(!this[_0x88b3('0x81')](_0x5a74da[_0x88b3('0xd0')])){return this[_0x88b3('0x10')]['error'](_0x88b3('0xd1'));}var _0x497840=this[_0x88b3('0x10')][_0x88b3('0x10e')](_0x8258db,_0x5a74da[_0x88b3('0x10f')],_0x5a74da[_0x88b3('0x110')]);var _0x10e144=_0x497840[_0x88b3('0x9d')]?_0x497840['result'][_0x88b3('0x4b')]():'';logger['info'](_0x88b3('0x111'),JSON[_0x88b3('0x70')](_0x497840));if(_0x497840['result']===-0x1){this[_0x88b3('0x37')][_0x88b3('0x6d')](this,_0x5a74da,_0x10e144);return _0x497840;}else if(_0x497840[_0x88b3('0x9b')]===_0x88b3('0x64')){_0x497840[_0x88b3('0x9d')]=_0x10e144[_0x88b3('0x95')]>=parseInt(_0x5a74da[_0x88b3('0x112')])?'x':'i';}else{_0x497840['result']=_0x10e144['length']>=parseInt(_0x5a74da['mindigit'])&&_0x10e144['length']<=parseInt(_0x5a74da[_0x88b3('0x110')])?'x':'i';}var _0x5721d=this[_0x88b3('0x13')][_0x88b3('0x6d')](this,_0x5a74da['variable_id']);if(!_0x5721d){return this[_0x88b3('0x10')]['error'](_0x5a74da,_0x88b3('0xd2'));}this[_0x88b3('0x10')]['setVariable'](_0x5721d,_0x10e144);if(this[_0x88b3('0x81')](_0x5a74da['hiddendigitsnum'])){var _0x1b7142=parseInt(_0x5a74da[_0x88b3('0x113')],0xa);var _0x4260ef=rs[_0x88b3('0x114')]({'charset':'*','length':_0x1b7142});var _0x8bb57d=_0x10e144[_0x88b3('0x95')];if(_0x8bb57d>0x0){if(_0x8bb57d>_0x1b7142){this[_0x88b3('0x37')]['sync'](this,_0x5a74da,_0x5a74da[_0x88b3('0x115')]===_0x88b3('0x116')?_0x4260ef+_0x10e144['substr'](_0x1b7142):_0x10e144[_0x88b3('0x117')](0x0,_0x8bb57d-_0x1b7142)+_0x4260ef);}else{this[_0x88b3('0x37')]['sync'](this,_0x5a74da,rs[_0x88b3('0x114')]({'charset':'*','length':_0x8bb57d}));}}else{this[_0x88b3('0x37')][_0x88b3('0x6d')](this,_0x5a74da,'');}}else{this['createSquareDetailsReport'][_0x88b3('0x6d')](this,_0x5a74da,_0x10e144);}return _0x497840;};AGIVertices[_0x88b3('0x15')]['getsecretdigits']=function(_0x3b049c){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x3b049c[_0x88b3('0x39')]));return this['getdigits'](_0x3b049c);};AGIVertices[_0x88b3('0x15')][_0x88b3('0x118')]=function(_0x5ce645){logger['info'](util[_0x88b3('0x2b')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x5ce645[_0x88b3('0x39')]));this[_0x88b3('0x37')][_0x88b3('0x6d')](this,_0x5ce645,_0x5ce645[_0x88b3('0x119')]);return this[_0x88b3('0x10')][_0x88b3('0xa2')](util['format'](_0x88b3('0x11a'),_0x5ce645[_0x88b3('0x119')]));};AGIVertices[_0x88b3('0x15')]['awspolly']=function(_0x3f99f5){logger[_0x88b3('0x31')](util['format'](_0x88b3('0x11b'),_0x3f99f5[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0x3f99f5[_0x88b3('0x11c')])||!this['isConfigured'](_0x3f99f5[_0x88b3('0x84')])){return this['channel'][_0x88b3('0xa2')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x88b3('0x81')](_0x3f99f5[_0x88b3('0x5d')])){return this['channel']['noop'](_0x88b3('0xc0'));}this[_0x88b3('0x10')]['noop'](util[_0x88b3('0x2b')]('Trying\x20aws\x20Polly\x20%s',_0x3f99f5[_0x88b3('0x5d')]));var _0x341a7d=this[_0x88b3('0x83')]['sync'](this,_0x3f99f5);if(_0x341a7d){this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0x11d'),_0x341a7d));var _0x38868a=this[_0x88b3('0x10')][_0x88b3('0xfa')](_0x341a7d);try{fs[_0x88b3('0xfb')](_0x341a7d+_0x88b3('0xfc'));}catch(_0x5657f2){logger[_0x88b3('0x2f')](_0x5657f2);}return _0x38868a;}return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x3f99f5,_0x88b3('0x11e'));};AGIVertices[_0x88b3('0x15')][_0x88b3('0x11f')]=function(_0x204ee3){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x120'),_0x204ee3[_0x88b3('0x39')]));if(!this['isConfigured'](_0x204ee3[_0x88b3('0x11c')])||!this[_0x88b3('0x81')](_0x204ee3[_0x88b3('0x84')])){return this[_0x88b3('0x10')]['noop'](_0x88b3('0x121'));}if(!this['isConfigured'](_0x204ee3[_0x88b3('0x122')])){return this['channel'][_0x88b3('0xa2')](_0x88b3('0x123'));}if(!this['isConfigured'](_0x204ee3[_0x88b3('0x5d')])){return this[_0x88b3('0x10')]['noop']('no\x20text\x20configured');}this['channel'][_0x88b3('0xe0')]=!![];this[_0x88b3('0x37')](_0x204ee3);this[_0x88b3('0x42')](_0x204ee3[_0x88b3('0x5d')],'in','','');this[_0x88b3('0x10')]['noop'](util['format'](_0x88b3('0x124'),_0x204ee3[_0x88b3('0x5d')]));var _0x10f6a8=this[_0x88b3('0x125')][_0x88b3('0x6d')](this,_0x204ee3);if(_0x10f6a8){for(var _0x4dc516 in _0x10f6a8){if(_0x10f6a8[_0x88b3('0x8f')](_0x4dc516)&&_[_0x88b3('0x90')](_0x10f6a8[_0x4dc516])){this[_0x88b3('0x10')][_0x88b3('0x9f')](util[_0x88b3('0x2b')](_0x88b3('0x126'),_0x4dc516[_0x88b3('0x67')]()),_0x10f6a8[_0x4dc516]);}}if(_[_0x88b3('0x45')](_0x10f6a8[_0x88b3('0x127')])){return this['channel']['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x88b3('0x42')](_0x10f6a8[_0x88b3('0x127')],'out',_0x88b3('0x128'),'');return this[_0x88b3('0x10')]['noop'](util['format'](_0x88b3('0x129'),_0x10f6a8[_0x88b3('0x127')]));}}return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x204ee3,_0x88b3('0x12a'));};AGIVertices[_0x88b3('0x15')][_0x88b3('0x12b')]=function(_0x36d384){logger['info'](util[_0x88b3('0x2b')](_0x88b3('0x12c'),_0x36d384[_0x88b3('0x39')],_0x36d384[_0x88b3('0x64')]));if(!this['isConfigured'](_0x36d384[_0x88b3('0x75')])){return this['channel'][_0x88b3('0xa2')]('no\x20key\x20configured');}var _0x122020=_0x88b3('0x12d');var _0x344ef1=util[_0x88b3('0x2b')](_0x88b3('0x12e'),FILES_PATH,rs[_0x88b3('0x114')](0x4));var _0x361cad=util[_0x88b3('0x2b')]('%s.%s',_0x344ef1,_0x122020);var _0x2fd65c=!![];if(_0x36d384['beep']===_0x88b3('0x12f')){_0x2fd65c=![];}var _0x54897e=this[_0x88b3('0x10')][_0x88b3('0x130')](_0x344ef1,_0x122020,_0x36d384[_0x88b3('0x131')],_0x36d384['timeout'],undefined,_0x2fd65c);if(_0x54897e[_0x88b3('0x9d')]!==-0x1){this['channel'][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0x132'),_0x361cad));var _0x5ab22a=this[_0x88b3('0x89')][_0x88b3('0x6d')](this,_0x36d384,_0x361cad);if(_0x5ab22a){for(var _0x3400a6 in _0x5ab22a){if(_0x5ab22a[_0x88b3('0x8f')](_0x3400a6)){this[_0x88b3('0x10')][_0x88b3('0x9f')](util[_0x88b3('0x2b')]('GOOGLE_ASR_%s',_0x3400a6[_0x88b3('0x67')]()),_0x5ab22a[_0x3400a6]);}}return this[_0x88b3('0x10')][_0x88b3('0xa2')](util['format'](_0x88b3('0x133'),JSON[_0x88b3('0x70')](_0x5ab22a)));}}return _0x54897e;};AGIVertices['prototype']['tildeasr']=function(_0x2f2dd8){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x134'),_0x2f2dd8[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0x2f2dd8[_0x88b3('0x135')])){return this['channel'][_0x88b3('0xa2')](_0x88b3('0x136'));}if(!this['isConfigured'](_0x2f2dd8['appsecret'])){return this[_0x88b3('0x10')][_0x88b3('0xa2')](_0x88b3('0x137'));}var _0xb1cbb4=_0x88b3('0x12d');var _0x3e2cda=util[_0x88b3('0x2b')](_0x88b3('0x12e'),FILES_PATH,rs['generate'](0x4));var _0x3bba19=util[_0x88b3('0x2b')](_0x88b3('0x98'),_0x3e2cda,_0xb1cbb4);var _0x93784b=!![];if(_0x2f2dd8[_0x88b3('0x138')]===_0x88b3('0x12f')){_0x93784b=![];}var _0x3f68c3=this[_0x88b3('0x10')][_0x88b3('0x130')](_0x3e2cda,_0xb1cbb4,_0x2f2dd8[_0x88b3('0x131')],_0x2f2dd8[_0x88b3('0x64')],undefined,_0x93784b);if(_0x3f68c3[_0x88b3('0x9d')]!==-0x1){this[_0x88b3('0x10')][_0x88b3('0xa2')](util['format'](_0x88b3('0x139'),_0x3bba19));var _0x4bb71f=this[_0x88b3('0x8b')]['sync'](this,_0x2f2dd8,_0x3bba19);if(_0x4bb71f){for(var _0x2a79e1 in _0x4bb71f){if(_0x4bb71f['hasOwnProperty'](_0x2a79e1)){this[_0x88b3('0x10')][_0x88b3('0x9f')](util[_0x88b3('0x2b')](_0x88b3('0x13a'),_0x2a79e1[_0x88b3('0x67')]()),_0x4bb71f[_0x2a79e1]);}}return this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0x13b'),JSON[_0x88b3('0x70')](_0x4bb71f)));}}return _0x3f68c3;};AGIVertices['prototype'][_0x88b3('0x13c')]=function(_0x14a3ab){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x13d'),_0x14a3ab[_0x88b3('0x39')]));return this[_0x88b3('0x10')]['continueAt'](_0x14a3ab[_0x88b3('0x3e')],_0x14a3ab[_0x88b3('0x13e')],_0x14a3ab[_0x88b3('0x3f')]);};AGIVertices['prototype'][_0x88b3('0x13f')]=function(_0x5017ad){logger[_0x88b3('0x31')](util['format'](_0x88b3('0x140'),_0x5017ad[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0x5017ad['condition'])){return this['channel']['error'](_0x5017ad,_0x88b3('0x141'));}try{var _0x440618=eval(_0x5017ad['condition'])?_0x88b3('0x142'):_0x88b3('0x143');this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0x144'),_0x5017ad[_0x88b3('0x145')],_0x440618));return{'code':0xc8,'result':_0x440618};}catch(_0x4dbfdf){return{'code':0xc8,'result':_0x88b3('0x143')};}};AGIVertices[_0x88b3('0x15')][_0x88b3('0x146')]=function(_0x43b8b6){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x147'),_0x43b8b6[_0x88b3('0x39')]));if(!this['isConfigured'](_0x43b8b6[_0x88b3('0x148')])){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x43b8b6,'no\x20interval\x20configured');}var _0x1cccc0=this[_0x88b3('0x26')][_0x88b3('0x6d')](this,_0x43b8b6[_0x88b3('0x148')]);if(!_0x1cccc0){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x43b8b6,_0x88b3('0x149'));}for(var _0x541a0e=0x0;_0x541a0e<_0x1cccc0[_0x88b3('0x95')];_0x541a0e+=0x1){var _0x20fcda=this[_0x88b3('0x10')][_0x88b3('0x13')](util[_0x88b3('0x2b')](_0x88b3('0x14a'),_0x1cccc0[_0x541a0e]));if(_0x20fcda[_0x88b3('0x9d')]===-0x1){return _0x20fcda;}logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x14b'),_0x1cccc0[_0x541a0e],_0x20fcda[_0x88b3('0x9b')]));if(_0x20fcda[_0x88b3('0x9b')]===_0x88b3('0x142')){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x14b'),_0x1cccc0[_0x541a0e],_0x88b3('0x142')));this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')]('IFTIME\x20%s\x20%s',_0x1cccc0[_0x541a0e],'true'));return{'code':0xc8,'result':_0x88b3('0x142')};}else{logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x14b'),_0x1cccc0[_0x541a0e],_0x88b3('0x143')));this[_0x88b3('0x10')]['noop'](util[_0x88b3('0x2b')](_0x88b3('0x14b'),_0x1cccc0[_0x541a0e],_0x88b3('0x143')));}}return{'code':0xc8,'result':_0x88b3('0x143')};};AGIVertices[_0x88b3('0x15')][_0x88b3('0x14c')]=function(_0x21e23b){logger['info'](util['format'](_0x88b3('0x14d'),_0x21e23b[_0x88b3('0x39')]));return this[_0x88b3('0x10')][_0x88b3('0x14c')]();};AGIVertices[_0x88b3('0x15')][_0x88b3('0x14e')]=function(_0x2b1954){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x14f'),_0x2b1954[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0x2b1954[_0x88b3('0x75')])){return this['channel'][_0x88b3('0xa2')]('no\x20key\x20configured');}var _0x58807e=_0x88b3('0x12d');var _0x45b872=util[_0x88b3('0x2b')](_0x88b3('0x12e'),FILES_PATH,rs['generate'](0x4));var _0x233a23=util[_0x88b3('0x2b')](_0x88b3('0x98'),_0x45b872,_0x58807e);var _0x13fe15=!![];if(_0x2b1954['beep']===_0x88b3('0x12f')){_0x13fe15=![];}var _0x3558df=this[_0x88b3('0x10')][_0x88b3('0x130')](_0x45b872,_0x58807e,_0x2b1954[_0x88b3('0x131')],_0x2b1954[_0x88b3('0x64')],undefined,_0x13fe15);if(_0x3558df[_0x88b3('0x9d')]!==-0x1){this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0x150'),_0x233a23));var _0x305378=this['ispeechASR'][_0x88b3('0x6d')](this,_0x2b1954,_0x233a23);if(_0x305378){for(var _0x2464da in _0x305378){if(_0x305378[_0x88b3('0x8f')](_0x2464da)){this[_0x88b3('0x10')][_0x88b3('0x9f')](util[_0x88b3('0x2b')](_0x88b3('0x151'),_0x2464da[_0x88b3('0x67')]()),_0x305378[_0x2464da]);}}return this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')]('IspeechASR\x20Result\x20%s',JSON[_0x88b3('0x70')](_0x305378)));}}return _0x3558df;};AGIVertices[_0x88b3('0x15')][_0x88b3('0x152')]=function(_0xd520e4){logger['info'](util[_0x88b3('0x2b')](_0x88b3('0x153'),_0xd520e4[_0x88b3('0x39')]));if(!this['isConfigured'](_0xd520e4[_0x88b3('0x75')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')]('no\x20key\x20configured');}if(!this[_0x88b3('0x81')](_0xd520e4[_0x88b3('0x5d')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')](_0x88b3('0xc0'));}this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0x154'),_0xd520e4[_0x88b3('0x5d')]));var _0x7ee92a=this[_0x88b3('0x7c')][_0x88b3('0x6d')](this,_0xd520e4);if(_0x7ee92a){this[_0x88b3('0x10')][_0x88b3('0xa2')](util['format'](_0x88b3('0x150'),_0x7ee92a));var _0x164149=this['channel'][_0x88b3('0xfa')](_0x7ee92a,_0xd520e4[_0x88b3('0x131')]);try{fs[_0x88b3('0xfb')](_0x7ee92a+_0x88b3('0xfc'));}catch(_0x28effe){logger[_0x88b3('0x2f')](_0x28effe);}return _0x164149;}return this[_0x88b3('0x10')]['error'](_0xd520e4,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['login']=function(_0x2c1b09){logger['info'](util[_0x88b3('0x2b')](_0x88b3('0x155'),_0x2c1b09[_0x88b3('0x39')]));if(!this['isConfigured'](_0x2c1b09[_0x88b3('0x156')])){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x2c1b09,_0x88b3('0x157'));}logger['info'](util[_0x88b3('0x2b')](_0x88b3('0x158'),this[_0x88b3('0x10')]['callerid'],_0x2c1b09[_0x88b3('0x156')]));var _0x49dac2=this[_0x88b3('0x56')]['sync'](this,_0x2c1b09[_0x88b3('0x156')]);if(_0x49dac2){logger[_0x88b3('0x31')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x88b3('0x10')][_0x88b3('0x3c')],_0x2c1b09['findBy']));this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0x159'),this[_0x88b3('0x10')][_0x88b3('0x3c')],_0x2c1b09[_0x88b3('0x156')]));return{'code':0xc8,'result':_0x88b3('0x15a')};}else{logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x15b'),this['channel'][_0x88b3('0x3c')],_0x2c1b09[_0x88b3('0x156')]));this[_0x88b3('0x10')]['noop'](util['format'](_0x88b3('0x15b'),this['channel'][_0x88b3('0x3c')],_0x2c1b09[_0x88b3('0x156')]));return{'code':0xc8,'result':_0x88b3('0x15c')};}};AGIVertices[_0x88b3('0x15')][_0x88b3('0x15d')]=function(_0x515f8f){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x515f8f[_0x88b3('0x39')]));if(!this['isConfigured'](_0x515f8f['findBy'])){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x515f8f,_0x88b3('0x157'));}logger['info'](util[_0x88b3('0x2b')](_0x88b3('0x158'),this[_0x88b3('0x10')]['callerid'],_0x515f8f[_0x88b3('0x156')]));var _0x3ea978=this[_0x88b3('0x52')]['sync'](this,_0x515f8f['findBy']);if(_0x3ea978){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x159'),this[_0x88b3('0x10')][_0x88b3('0x3c')],_0x515f8f[_0x88b3('0x156')]));this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0x159'),this[_0x88b3('0x10')][_0x88b3('0x3c')],_0x515f8f[_0x88b3('0x156')]));return{'code':0xc8,'result':_0x88b3('0x15a')};}else{logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x15b'),this[_0x88b3('0x10')][_0x88b3('0x3c')],_0x515f8f[_0x88b3('0x156')]));this[_0x88b3('0x10')][_0x88b3('0xa2')](util['format'](_0x88b3('0x15b'),this['channel'][_0x88b3('0x3c')],_0x515f8f[_0x88b3('0x156')]));return{'code':0xc8,'result':_0x88b3('0x15c')};}};AGIVertices[_0x88b3('0x15')][_0x88b3('0x15e')]=function(_0x1d4992){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x15f'),_0x1d4992[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0x1d4992[_0x88b3('0x160')])){return this[_0x88b3('0x10')]['error'](_0x1d4992,_0x88b3('0x161'));}this[_0x88b3('0x10')][_0x88b3('0xa2')](util['format'](_0x88b3('0x162'),_0x1d4992['operation']));var _0x292ed9=eval(_0x1d4992['operation']);if(!this[_0x88b3('0x81')](_0x1d4992['variable_id'])){return this[_0x88b3('0x10')][_0x88b3('0xa2')](_0x88b3('0xd1'));}var _0x2a9993=this[_0x88b3('0x13')][_0x88b3('0x6d')](this,_0x1d4992['variable_id']);if(!_0x2a9993){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x1d4992,_0x88b3('0xd2'));}if(_['isArray'](_0x292ed9)){var _0x1e5785=this;_0x292ed9[_0x88b3('0xd3')](function(_0x34b42e,_0x54a064){_0x1e5785[_0x88b3('0x10')][_0x88b3('0x9f')](util['format'](_0x88b3('0x163'),_0x2a9993,_0x54a064),_0x34b42e);});return this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0x164'),_0x2a9993));}else{return this[_0x88b3('0x10')]['setVariable'](_0x2a9993,_0x292ed9);}};AGIVertices['prototype'][_0x88b3('0xe')]=function(_0x1ec99a){logger[_0x88b3('0x31')](util['format'](_0x88b3('0x165'),_0x1ec99a[_0x88b3('0x39')]));if(_0x1ec99a['retry']===0x0){return this[_0x88b3('0xa0')](_0x1ec99a);}_0x1ec99a['retry']-=0x1;if(!this[_0x88b3('0x81')](_0x1ec99a[_0x88b3('0x10c')])){return this[_0x88b3('0x10')]['error'](_0x1ec99a,'no\x20file\x20audio\x20selected');}var _0x4a24e9=this[_0x88b3('0x20')]['sync'](this,_0x1ec99a[_0x88b3('0x10c')]);if(!_0x4a24e9){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x1ec99a,_0x88b3('0x166'));}var _0x171b6c=this[_0x88b3('0x10')][_0x88b3('0x10e')](_0x4a24e9,_0x1ec99a[_0x88b3('0x10f')],_0x1ec99a[_0x88b3('0x167')]);var _0x3c1e7b=_0x171b6c[_0x88b3('0x9d')];if(_0x171b6c[_0x88b3('0x9d')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x1ec99a,'-1');return _0x171b6c;}else if(_0x171b6c['extra']==='timeout'){_0x171b6c['result']=_0x171b6c[_0x88b3('0x9d')]['length']>0x0?_0x171b6c['result']:'t';}else if(_[_0x88b3('0x44')](_0x171b6c[_0x88b3('0x9d')])){_0x171b6c[_0x88b3('0x9d')]='#';_0x3c1e7b='#';}if(!this[_0x88b3('0x81')](_0x1ec99a['variable_id'])){this[_0x88b3('0x10')]['noop'](_0x88b3('0xd1'));}else{var _0x42ca37=this[_0x88b3('0x13')][_0x88b3('0x6d')](this,_0x1ec99a[_0x88b3('0xd0')]);if(!_0x42ca37){return this['channel'][_0x88b3('0x2f')](_0x1ec99a,_0x88b3('0xd2'));}this['channel']['setVariable'](_0x42ca37,_0x3c1e7b);}this[_0x88b3('0x37')][_0x88b3('0x6d')](this,_0x1ec99a,_0x3c1e7b);return _0x171b6c;};AGIVertices[_0x88b3('0x15')][_0x88b3('0xa2')]=function(_0x432127){logger[_0x88b3('0x31')](util['format'](_0x88b3('0x168'),_0x432127['label']));return this[_0x88b3('0x10')][_0x88b3('0xa2')](_0x432127['output']||_0x432127['label']);};AGIVertices['prototype'][_0x88b3('0x169')]=function(_0x18a9c9){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x16a'),_0x18a9c9[_0x88b3('0x39')]));if(!this['isConfigured'](_0x18a9c9[_0x88b3('0x156')])){return this['channel'][_0x88b3('0x2f')](_0x18a9c9,_0x88b3('0x157'));}logger['info'](util[_0x88b3('0x2b')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x88b3('0x10')][_0x88b3('0x3c')],_0x18a9c9['findBy']));var _0x2dac08=this[_0x88b3('0x4d')][_0x88b3('0x6d')](this,_0x18a9c9[_0x88b3('0x16b')]);var _0x519ac4=this[_0x88b3('0x4f')][_0x88b3('0x6d')](this,_0x18a9c9[_0x88b3('0x156')],_0x2dac08);if(_0x519ac4){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x159'),this[_0x88b3('0x10')]['callerid'],_0x18a9c9[_0x88b3('0x156')]));this[_0x88b3('0x10')]['noop'](util[_0x88b3('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x88b3('0x10')][_0x88b3('0x3c')],_0x18a9c9[_0x88b3('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x15b'),this[_0x88b3('0x10')][_0x88b3('0x3c')],_0x18a9c9[_0x88b3('0x156')]));this[_0x88b3('0x10')]['noop'](util[_0x88b3('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x88b3('0x10')][_0x88b3('0x3c')],_0x18a9c9[_0x88b3('0x156')]));return{'code':0xc8,'result':_0x88b3('0x15c')};}};AGIVertices['prototype']['playback']=function(_0x4cd835){logger[_0x88b3('0x31')](util['format'](_0x88b3('0x16c'),_0x4cd835['label']));if(!this['isConfigured'](_0x4cd835[_0x88b3('0x10c')])){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x4cd835,_0x88b3('0x10d'));}var _0x5dc334=this[_0x88b3('0x20')][_0x88b3('0x6d')](this,_0x4cd835[_0x88b3('0x10c')]);if(!_0x5dc334){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x4cd835,_0x88b3('0x166'));}var _0x395b83=this[_0x88b3('0x10')][_0x88b3('0x58')]('PLAYBACK',[_0x5dc334,_0x4cd835['opts']]);if(_0x395b83['result']===-0x1){return _0x395b83;}return this[_0x88b3('0x10')][_0x88b3('0xa2')](util['format']('Executed\x20command\x20%s\x20%s',_0x88b3('0x16d'),_0x5dc334));};AGIVertices['prototype'][_0x88b3('0x16e')]=function(_0x451142){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x16f'),_0x451142['label']));if(!this['isConfigured'](_0x451142[_0x88b3('0x170')])){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x451142,'no\x20queue\x20selected');}var _0x49af98='';var _0x289aeb=parseInt(_0x451142['queue_id'],0xa);if(isNaN(_0x289aeb)){_0x49af98=_0x451142[_0x88b3('0x170')];}else{_0x49af98=this['getVoiceQueue'][_0x88b3('0x6d')](this,_0x451142['queue_id']);if(!_0x49af98){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x451142,_0x88b3('0x171'));}}var _0x333b10='';if(this[_0x88b3('0x81')](_0x451142[_0x88b3('0x10c')])){var _0x13d2c7=this['getSound'][_0x88b3('0x6d')](this,_0x451142[_0x88b3('0x10c')]);if(_0x13d2c7){_0x333b10=_0x13d2c7;}}this[_0x88b3('0x37')][_0x88b3('0x6d')](this,_0x451142,_0x49af98);if(_0x451142[_0x88b3('0x108')][_0x88b3('0x172')]('x')<0x0){_0x451142[_0x88b3('0x108')]+='x';}if(_0x451142[_0x88b3('0x108')]['indexOf']('X')<0x0){_0x451142['opts']+='X';}this[_0x88b3('0x10')][_0x88b3('0x9f')]('XMCS-QUEUE',_0x49af98?_0x49af98[_0x88b3('0x173')]():'');var _0x3f30c3=this[_0x88b3('0x10')][_0x88b3('0x58')](_0x88b3('0x174'),[_0x49af98,_0x451142['opts'],_0x451142[_0x88b3('0x63')],_0x333b10,_0x451142[_0x88b3('0x64')],_0x451142[_0x88b3('0x8')],_0x451142['macro'],_0x451142[_0x88b3('0x175')],'',_0x451142[_0x88b3('0x176')]]);if(_0x3f30c3[_0x88b3('0x9d')]===-0x1){return _0x3f30c3;}return this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')]('Executed\x20command\x20%s\x20%s',_0x88b3('0x174'),_0x49af98));};AGIVertices[_0x88b3('0x15')]['record']=function(_0x4ef8c7){logger[_0x88b3('0x31')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x4ef8c7[_0x88b3('0x39')]));var _0x1c03d3=_0x4ef8c7[_0x88b3('0x177')]||'wav';var _0x1f64be=util[_0x88b3('0x2b')](_0x88b3('0x178'),this[_0x88b3('0x10')][_0x88b3('0x38')],rs[_0x88b3('0x114')](0x5));var _0x17fd44=util[_0x88b3('0x2b')]('%s/recordings/%s.%s',FILES_PATH,_0x1f64be,_0x1c03d3);var _0x1c01b6=util[_0x88b3('0x2b')](_0x88b3('0x12e'),FILES_PATH,_0x1f64be);this[_0x88b3('0x3d')][_0x88b3('0x6d')](this,_0x4ef8c7,_0x1f64be,_0x17fd44);this[_0x88b3('0x10')][_0x88b3('0x9f')](_0x88b3('0x179'),_0x1f64be);logger[_0x88b3('0x31')](_0x88b3('0x17a'),_0x1c01b6,_0x1c03d3,_0x4ef8c7[_0x88b3('0x17b')],_0x4ef8c7[_0x88b3('0x64')]);return this[_0x88b3('0x10')]['recordFile'](_0x1c01b6,_0x1c03d3,_0x4ef8c7[_0x88b3('0x17b')],_0x4ef8c7['timeout'],undefined,!![]);};AGIVertices[_0x88b3('0x15')]['restapi']=function(_0x24602d){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x17c'),_0x24602d[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0x24602d[_0x88b3('0x63')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')](_0x88b3('0x17d'));}var _0x3b0900=this[_0x88b3('0x17e')][_0x88b3('0x6d')](this,_0x24602d);logger[_0x88b3('0x31')](util['format'](_0x88b3('0x17f'),util[_0x88b3('0x180')](_0x3b0900,{'showHidden':![],'depth':null})));if(!this[_0x88b3('0x81')](_0x24602d[_0x88b3('0xd0')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')](_0x88b3('0x181'));}var _0x4bff8a=this['getVariable'][_0x88b3('0x6d')](this,_0x24602d[_0x88b3('0xd0')]);if(!_0x4bff8a){return this[_0x88b3('0x10')]['error'](_0x24602d,'no\x20variable\x20found');}this[_0x88b3('0x10')][_0x88b3('0x9f')](util[_0x88b3('0x2b')](_0x88b3('0x182'),_0x4bff8a),_0x3b0900['statusCode']?_0x3b0900['statusCode']:'200');this[_0x88b3('0x10')][_0x88b3('0x9f')](util['format'](_0x88b3('0x183'),_0x4bff8a),_0x3b0900[_0x88b3('0x184')]?_0x3b0900['statusMessage']:'OK');if(_0x3b0900[_0x88b3('0x71')]){try{this[_0x88b3('0x96')](_0x3b0900[_0x88b3('0x71')],_0x4bff8a);}catch(_0x1eb94c){logger[_0x88b3('0x2f')](util[_0x88b3('0x2b')](_0x88b3('0x185'),_0x4bff8a));}}return this[_0x88b3('0x10')]['noop'](util[_0x88b3('0x2b')]('variable\x20%s\x20set',_0x4bff8a));};AGIVertices[_0x88b3('0x15')][_0x88b3('0x186')]=function(_0x158832){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x187'),_0x158832[_0x88b3('0x39')]));return this[_0x88b3('0x10')]['sayDigits'](_0x158832[_0x88b3('0x188')][_0x88b3('0x5a')](/\s+/g,''),_0x158832[_0x88b3('0x17b')]);};AGIVertices[_0x88b3('0x15')][_0x88b3('0x189')]=function(_0x28d854){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x18a'),_0x28d854['label']));return this[_0x88b3('0x10')][_0x88b3('0x18b')](_0x28d854[_0x88b3('0x65')]['replace'](/\s+/g,''),_0x28d854['escape_digits']);};AGIVertices[_0x88b3('0x15')][_0x88b3('0x18c')]=function(_0x392174){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x18d'),_0x392174[_0x88b3('0x39')]));return this['channel'][_0x88b3('0x18e')](_0x392174[_0x88b3('0x5d')],_0x392174['escape_digits']);};AGIVertices[_0x88b3('0x15')][_0x88b3('0x18f')]=function(_0xbf7b90){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x190'),_0xbf7b90[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0xbf7b90[_0x88b3('0x191')])){return this[_0x88b3('0x10')]['noop'](_0x88b3('0x192'));}var _0x4048cd=this['getMailAccount'][_0x88b3('0x6d')](this,_0xbf7b90[_0x88b3('0x191')]);if(!_0x4048cd||!_0x4048cd[_0x88b3('0x193')]){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0xbf7b90,_0x88b3('0x194'));}var _0x51359f={'from':util[_0x88b3('0x2b')](_0x88b3('0x195'),_0x4048cd[_0x88b3('0x1a')],_0x4048cd[_0x88b3('0x196')]||_0x4048cd[_0x88b3('0x193')][_0x88b3('0x197')]),'to':_0xbf7b90['to']||'','cc':_0xbf7b90['cc']||'','bcc':_0xbf7b90['bcc']||'','subject':_0xbf7b90['subject'],'html':_0xbf7b90[_0x88b3('0x5d')],'text':_0xbf7b90[_0x88b3('0x5d')]};var _0x4778d7={'tls':{'rejectUnauthorized':![]}};if(_0x4048cd[_0x88b3('0x193')][_0x88b3('0x198')]){_0x4778d7['service']=_0x4048cd['Smtp'][_0x88b3('0x198')];}else{_0x4778d7[_0x88b3('0x199')]=_0x4048cd[_0x88b3('0x193')][_0x88b3('0x199')];_0x4778d7['port']=_0x4048cd[_0x88b3('0x193')][_0x88b3('0x19a')];_0x4778d7[_0x88b3('0x19b')]=_0x4048cd[_0x88b3('0x193')][_0x88b3('0x19b')];}if(_0x4048cd[_0x88b3('0x193')]['authentication']){_0x4778d7[_0x88b3('0x19c')]={'user':_0x4048cd[_0x88b3('0x193')]['user'],'pass':_0x4048cd['Smtp'][_0x88b3('0x19d')]};}if(this[_0x88b3('0x81')](_0xbf7b90[_0x88b3('0x19e')])){}logger[_0x88b3('0xd7')](_0x88b3('0x19f'),JSON[_0x88b3('0x70')](_0x51359f));this[_0x88b3('0x37')][_0x88b3('0x6d')](this,_0xbf7b90,_0xbf7b90[_0x88b3('0x191')]);this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x4048cd[_0x88b3('0x1a')]));this[_0x88b3('0x25')][_0x88b3('0x6d')](this,_0x4778d7,_0x51359f);return this['channel'][_0x88b3('0xa2')](_0x88b3('0x1a0'));};AGIVertices[_0x88b3('0x15')]['sendFax']=function(_0x5c1747){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x1a1'),_0x5c1747[_0x88b3('0x39')]));return this[_0x88b3('0x10')]['noop'](_0x88b3('0x1a2'));};AGIVertices[_0x88b3('0x15')][_0x88b3('0x1a3')]=function(_0x18b913){logger['info'](util[_0x88b3('0x2b')](_0x88b3('0x1a4'),_0x18b913['label']));if(!this[_0x88b3('0x81')](_0x18b913[_0x88b3('0x1a5')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')](_0x88b3('0x1a6'));}var _0x114ba1=this['getSmsAccount'][_0x88b3('0x6d')](this,_0x18b913[_0x88b3('0x1a5')]);if(!_0x114ba1){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x18b913,'no\x20sms\x20account\x20found');}var _0x461a21={'body':_0x18b913[_0x88b3('0x1a7')],'phone':_0x18b913['to']||'','SmsAccountId':_0x114ba1['id']};logger[_0x88b3('0xd7')](_0x88b3('0x1a8'),JSON[_0x88b3('0x70')](_0x461a21));this[_0x88b3('0x37')][_0x88b3('0x6d')](this,_0x18b913,_0x18b913[_0x88b3('0x1a5')]);this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0x1a9'),_0x114ba1[_0x88b3('0x1a')]));this['createSmsMessage'][_0x88b3('0x6d')](this,_0x461a21);return this[_0x88b3('0x10')]['noop'](_0x88b3('0x1aa'));};AGIVertices[_0x88b3('0x15')][_0x88b3('0x1ab')]=function(_0x5cf347){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x1ac'),_0x5cf347[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0x5cf347[_0x88b3('0xd0')])){return this[_0x88b3('0x10')]['error'](_0x5cf347,'no\x20variable\x20selected');}var _0x1699c4=this[_0x88b3('0x13')]['sync'](this,_0x5cf347[_0x88b3('0xd0')]);if(!_0x1699c4){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x5cf347,_0x88b3('0xd2'));}return this['channel'][_0x88b3('0x9f')](_0x1699c4,_0x5cf347[_0x88b3('0x1ad')]);};AGIVertices[_0x88b3('0x15')][_0x88b3('0x1ae')]=function(_0x2d240c){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x1af'),_0x2d240c[_0x88b3('0x39')]));this[_0x88b3('0x10')][_0x88b3('0xa2')]('START\x20CALLY\x20SQUARE');if(_0x2d240c[_0x88b3('0xb4')]===_0x88b3('0x1b0')){this['channel'][_0x88b3('0xa2')](_0x88b3('0x1b1'));return this['channel'][_0x88b3('0xb4')]();}return this[_0x88b3('0x10')]['noop']('Skipped\x20Answer');};AGIVertices[_0x88b3('0x15')][_0x88b3('0x1b2')]=function(_0x5b12ac){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x5b12ac[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0x5b12ac[_0x88b3('0x1b3')])){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x5b12ac,_0x88b3('0x1b4'));}var _0x5c092a=this[_0x88b3('0x19')]['sync'](this,_0x5b12ac['project_id']);if(!this['isConfigured'](_0x5c092a)){return this['channel'][_0x88b3('0x2f')](_0x5b12ac,util[_0x88b3('0x2b')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x5b12ac[_0x88b3('0x1b3')]));}if(_0x5c092a===this[_0x88b3('0x10')][_0x88b3('0x3b')]){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x5b12ac,_0x88b3('0x1b5'));}this[_0x88b3('0x37')][_0x88b3('0x6d')](this,_0x5b12ac,_0x5c092a);var _0x4035cc=this[_0x88b3('0x10')][_0x88b3('0x58')](_0x88b3('0x1b6'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x88b3('0x8')][_0x88b3('0x199')]||_0x88b3('0x1b7'),_0x5c092a,this[_0x88b3('0x10')][_0x88b3('0x3b')]));if(_0x4035cc[_0x88b3('0x9d')]===-0x1){return _0x4035cc;}return this['channel'][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0x1b8'),_0x88b3('0x1b6'),_0x5c092a));};AGIVertices[_0x88b3('0x15')][_0x88b3('0x1b9')]=function(_0x28a545){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x1ba'),_0x28a545['label']));var _0x20be84=this[_0x88b3('0x57')][_0x88b3('0x6d')](this,_0x28a545[_0x88b3('0xaf')]);this[_0x88b3('0x37')][_0x88b3('0x6d')](this,_0x28a545,_0x28a545[_0x88b3('0xaf')]);if(this[_0x88b3('0x81')](_0x28a545[_0x88b3('0xd0')])){var _0x2299b0=this[_0x88b3('0x13')][_0x88b3('0x6d')](this,_0x28a545[_0x88b3('0xd0')]);if(_0x2299b0){this['channel'][_0x88b3('0x9f')](_0x2299b0,_0x20be84);return this['channel']['noop'](util[_0x88b3('0x2b')](_0x88b3('0x1bb'),_0x28a545[_0x88b3('0xaf')],_0x2299b0));}}return this[_0x88b3('0x10')][_0x88b3('0xa2')](util['format'](_0x88b3('0x1bc'),_0x28a545[_0x88b3('0xaf')]));};AGIVertices[_0x88b3('0x15')][_0x88b3('0x1bd')]=function(_0x36ba70){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x1be'),_0x36ba70[_0x88b3('0x39')]));_0x36ba70[_0x88b3('0x5d')]=_0x36ba70[_0x88b3('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x88b3('0x81')](_0x36ba70[_0x88b3('0x5c')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')]('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x36ba70[_0x88b3('0x5d')])){return this[_0x88b3('0x10')][_0x88b3('0xa2')]('no\x20text\x20configured');}this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0x1bf'),_0x36ba70[_0x88b3('0x5d')]));var _0xcddc2a=this['googleCloudTTS'][_0x88b3('0x6d')](this,_0x36ba70);if(_0xcddc2a){this[_0x88b3('0x10')]['noop'](util[_0x88b3('0x2b')](_0x88b3('0x1c0'),_0xcddc2a));var _0x15ad6c=this[_0x88b3('0x10')]['streamFile'](_0xcddc2a);try{fs[_0x88b3('0xfb')](_0xcddc2a+_0x88b3('0xfc'));}catch(_0x3a183d){logger[_0x88b3('0x2f')](_0x3a183d);}return _0x15ad6c;}return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x36ba70,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x88b3('0x15')][_0x88b3('0x1c1')]=function(_0x283076){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x1c2'),_0x283076[_0x88b3('0x39')]));_0x283076[_0x88b3('0x5d')]=_0x283076[_0x88b3('0x5d')][_0x88b3('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x283076[_0x88b3('0x5d')])){return this[_0x88b3('0x10')]['noop'](_0x88b3('0xc0'));}this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0x1c3'),_0x283076[_0x88b3('0x5d')]));var _0x51b6df=this['googleTTS'][_0x88b3('0x6d')](this,_0x283076);if(_0x51b6df){this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0x1c4'),_0x51b6df));var _0x107901=this[_0x88b3('0x10')][_0x88b3('0xfa')](_0x51b6df);try{fs[_0x88b3('0xfb')](_0x51b6df+'.wav');}catch(_0x9e8145){logger[_0x88b3('0x2f')](_0x9e8145);}return _0x107901;}return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x283076,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x88b3('0x15')][_0x88b3('0x1c5')]=function(_0x5cc120){logger['info'](util[_0x88b3('0x2b')](_0x88b3('0x1c6'),_0x5cc120['label']));if(!this[_0x88b3('0x81')](_0x5cc120[_0x88b3('0x156')])){return this[_0x88b3('0x10')]['error'](_0x5cc120,'no\x20find\x20by\x20configured');}logger['info'](util[_0x88b3('0x2b')](_0x88b3('0x158'),this[_0x88b3('0x10')]['callerid'],_0x5cc120[_0x88b3('0x156')]));var _0x4b4cbf=this['agentUnpause'][_0x88b3('0x6d')](this,_0x5cc120[_0x88b3('0x156')]);if(_0x4b4cbf){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x88b3('0x10')][_0x88b3('0x3c')],_0x5cc120['findBy']));this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x88b3('0x10')][_0x88b3('0x3c')],_0x5cc120[_0x88b3('0x156')]));return{'code':0xc8,'result':_0x88b3('0x15a')};}else{logger[_0x88b3('0x31')](util[_0x88b3('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x88b3('0x10')][_0x88b3('0x3c')],_0x5cc120[_0x88b3('0x156')]));this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x88b3('0x10')][_0x88b3('0x3c')],_0x5cc120[_0x88b3('0x156')]));return{'code':0xc8,'result':_0x88b3('0x15c')};}};AGIVertices[_0x88b3('0x15')][_0x88b3('0x1c7')]=function(_0x20432a){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')](_0x88b3('0x1c8'),_0x20432a['label']));var _0x227f7a=this[_0x88b3('0x10')][_0x88b3('0x58')](_0x88b3('0x1c9'),[_0x20432a['mailbox'],_0x20432a['options']]);if(_0x227f7a['result']===-0x1){return _0x227f7a;}return this[_0x88b3('0x10')][_0x88b3('0xa2')](util[_0x88b3('0x2b')](_0x88b3('0x1b8'),_0x88b3('0x1c9'),_0x20432a[_0x88b3('0x1ca')]));};AGIVertices[_0x88b3('0x15')][_0x88b3('0x1cb')]=function(_0x28c1ad){logger[_0x88b3('0x31')](util[_0x88b3('0x2b')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x28c1ad[_0x88b3('0x39')]));if(!this[_0x88b3('0x81')](_0x28c1ad[_0x88b3('0xd0')])){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x28c1ad,_0x88b3('0x1cc'));}var _0x5c4b11=this[_0x88b3('0x13')]['sync'](this,_0x28c1ad[_0x88b3('0xd0')]);if(!_0x5c4b11){return this[_0x88b3('0x10')][_0x88b3('0x2f')](_0x28c1ad,_0x88b3('0xd2'));}var _0x3fab67=this['channel'][_0x88b3('0x13')](_0x5c4b11);return{'code':0xc8,'result':_0x3fab67[_0x88b3('0x9b')]?_0x3fab67['extra']:'-'};};String['prototype']['replaceAll']=function(_0x578dd5,_0x49c4f9){return this[_0x88b3('0x99')](_0x578dd5)[_0x88b3('0x1cd')](_0x49c4f9);};module[_0x88b3('0x1ce')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 9a66de0..dde8d7d 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 _0x06f1=['isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangup','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','lastPauseAt','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','error','finally','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','prototype','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest'];(function(_0x507b3b,_0x30c190){var _0xe1e48e=function(_0x1865ed){while(--_0x1865ed){_0x507b3b['push'](_0x507b3b['shift']());}};_0xe1e48e(++_0x30c190);}(_0x06f1,0x1ce));var _0x106f=function(_0x3b987a,_0x2accb6){_0x3b987a=_0x3b987a-0x0;var _0x1325b9=_0x06f1[_0x3b987a];return _0x1325b9;};'use strict';var util=require(_0x106f('0x0'));var _=require(_0x106f('0x1'));var moment=require(_0x106f('0x2'));var ami=require(_0x106f('0x3'));var logger=require(_0x106f('0x4'))(_0x106f('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x4218b6){this['voiceQueues']=_0x4218b6[_0x106f('0x6')];this['agents']=_0x4218b6[_0x106f('0x7')];this[_0x106f('0x8')]=_0x4218b6['timers'];this[_0x106f('0x9')]={};ami['on'](_0x106f('0xa'),this[_0x106f('0xb')][_0x106f('0xc')](this));ami['on'](_0x106f('0xd'),this['syncHangupRequest'][_0x106f('0xc')](this));ami['on']('hangup',this[_0x106f('0xe')][_0x106f('0xc')](this));ami['on']('agentringnoanswer',this[_0x106f('0xf')][_0x106f('0xc')](this));ami['on'](_0x106f('0x10'),this['syncAttendedTransfer'][_0x106f('0xc')](this));ami['on'](_0x106f('0x11'),this[_0x106f('0x12')][_0x106f('0xc')](this));ami['on'](_0x106f('0x13'),this[_0x106f('0x14')]['bind'](this));}function getDiff(_0x33d692){var _0x150aaa=moment()[_0x106f('0x15')](0x0);var _0x23f67c=moment(_0x33d692)[_0x106f('0x15')](0x0);return _0x150aaa['diff'](_0x23f67c,_0x106f('0x16'));}Acw['prototype'][_0x106f('0x17')]=function(_0x2a452f){try{var _0x1b00e6=this;var _0xaa0ec4=this[_0x106f('0x9')][_0x2a452f][_0x106f('0x18')];var _0x3a85b8=this['channels'][_0x2a452f][_0x106f('0x19')];var _0xa1d13b=this['voiceQueues'][_0x3a85b8];var _0x1da4f2=![];var _0x3f86e8=_0x106f('0x1a');if(_0xa1d13b[_0x106f('0x1b')]){if(_0xa1d13b[_0x106f('0x1c')][_0x106f('0x1d')]){_0x1da4f2=!![];_0x3f86e8=_0xa1d13b[_0x106f('0x1c')][_0x106f('0x1d')];}}ami[_0x106f('0x1e')]({'action':_0x106f('0x1f'),'interface':_0xaa0ec4,'paused':!![],'reason':_0x3f86e8})[_0x106f('0x20')](function(_0x48a021){if(_0x1b00e6['agents'][_0xaa0ec4]){return RpcUser[_0x106f('0x21')](_0x1b00e6[_0x106f('0x7')][_0xaa0ec4]['id'])['then'](function(_0x3a5749){if(_0x3a5749&&!_0x3a5749[_0x106f('0x22')]){logger['info'](_0x106f('0x23'),_0x2a452f,_0xaa0ec4,_0x3a85b8);var _0x375dc2=_0x1b00e6[_0x106f('0x9')][_0x2a452f][_0x106f('0x24')]&&_0x1b00e6[_0x106f('0x9')][_0x2a452f][_0x106f('0x25')]?_0x1b00e6['channels'][_0x2a452f][_0x106f('0x25')]:_0x2a452f;return RpcUser[_0x106f('0x26')](_0x1b00e6[_0x106f('0x7')][_0xaa0ec4],_0x3f86e8,_0x375dc2)[_0x106f('0x20')](function(_0x41f118){if(!_0x1da4f2){_0x1b00e6[_0x106f('0x8')][_0xaa0ec4]={};logger[_0x106f('0x27')](_0x106f('0x28'),_0x2a452f,_0x1b00e6[_0x106f('0x6')][_0x3a85b8][_0x106f('0x29')],_0xaa0ec4,_0x3a85b8);_0x1b00e6[_0x106f('0x8')][_0xaa0ec4][_0x106f('0x2a')]=setTimeout(_0x1b00e6['stopAcw'][_0x106f('0xc')](_0x1b00e6,_0xaa0ec4),_0x1b00e6['voiceQueues'][_0x3a85b8]['acwTimeout']*0x3e8);_0x1b00e6[_0x106f('0x8')][_0xaa0ec4]['lastPauseAt']=moment()['format'](_0x106f('0x2b'));_0x1b00e6[_0x106f('0x8')][_0xaa0ec4][_0x106f('0x2c')]=_0x2a452f;_0x1b00e6[_0x106f('0x8')][_0xaa0ec4]['queue']=_0x3a85b8;_0x1b00e6[_0x106f('0x8')][_0xaa0ec4][_0x106f('0x2d')]=function(){var _0x250074=getDiff(_0x1b00e6[_0x106f('0x8')][_0xaa0ec4][_0x106f('0x2e')]);clearTimeout(_0x1b00e6['timers'][_0xaa0ec4]['timer']);_0x1b00e6[_0x106f('0x8')][_0xaa0ec4]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x250074},_0x1b00e6['timers'][_0xaa0ec4][_0x106f('0x2c')],_0xaa0ec4)[_0x106f('0x20')](function(_0x5eafe5){logger['info'](_0x106f('0x2f'),_0x2a452f,_0x250074,_0x5eafe5);})['catch'](function(_0x2767ab){logger['error'](_0x106f('0x30'),_0x2a452f,_0x2767ab);});delete _0x1b00e6[_0x106f('0x8')][_0xaa0ec4];};}});}else{logger['info'](_0x106f('0x31'),_0x2a452f,_0xaa0ec4,_0x3a85b8);}});}})[_0x106f('0x32')](function(_0xbdd2b2){logger[_0x106f('0x33')](_0x106f('0x28'),_0x2a452f,_0x1b00e6[_0x106f('0x6')][_0x3a85b8][_0x106f('0x29')],_0xaa0ec4,_0x3a85b8);})[_0x106f('0x34')](function(){delete _0x1b00e6[_0x106f('0x9')][_0x2a452f];});}catch(_0x3dcdf8){logger[_0x106f('0x33')]('[ACW][START]\x20%s',_0x3dcdf8['message']);}};Acw['prototype'][_0x106f('0x35')]=function(_0x3bae6d){try{var _0x4a7c17=this;if(_0x4a7c17['timers'][_0x3bae6d]){_0x4a7c17[_0x106f('0x8')][_0x3bae6d][_0x106f('0x2a')]=![];var _0x46b057=_0x4a7c17[_0x106f('0x8')][_0x3bae6d]['uniqueid'];var _0x5f3c62=_0x4a7c17['timers'][_0x3bae6d][_0x106f('0x19')];var _0x476048=_0x4a7c17['voiceQueues'][_0x5f3c62][_0x106f('0x29')];logger['info'](_0x106f('0x36'),_0x46b057,_0x3bae6d);RpcUser[_0x106f('0x37')](this[_0x106f('0x7')][_0x3bae6d]);RpcVoiceAgentReport[_0x106f('0x38')]({'acwtime':_0x476048,'agentacw':!![]},_0x46b057,_0x3bae6d)[_0x106f('0x20')](function(_0x5e0542){logger['info'](_0x106f('0x2f'),_0x46b057,_0x476048,_0x5e0542);})[_0x106f('0x32')](function(_0x13673a){logger[_0x106f('0x33')](_0x106f('0x30'),_0x46b057,_0x13673a);});}else{logger[_0x106f('0x33')](_0x106f('0x39'),_0x3bae6d);if(_0x4a7c17[_0x106f('0x8')]){logger[_0x106f('0x27')](_0x106f('0x3a'),JSON[_0x106f('0x3b')](_0x4a7c17[_0x106f('0x8')]));}}}catch(_0x1f15ac){logger['error'](_0x106f('0x3c'),_0x1f15ac[_0x106f('0x3d')]);}};Acw['prototype']['syncAgentConnect']=function(_0x267803){try{if(this['voiceQueues'][_0x267803[_0x106f('0x19')]]&&(this[_0x106f('0x6')][_0x267803['queue']][_0x106f('0x5')]||this[_0x106f('0x6')][_0x267803['queue']][_0x106f('0x1b')])){if(this['agents'][_0x267803[_0x106f('0x18')]]){this[_0x106f('0x9')][_0x267803[_0x106f('0x2c')]]={'queue':_0x267803[_0x106f('0x19')],'interface':_0x267803['interface'],'destlinkedid':_0x267803[_0x106f('0x25')]};}}}catch(_0x4da729){logger[_0x106f('0x33')](_0x106f('0x3e'),_0x4da729['message']);}};Acw[_0x106f('0x3f')][_0x106f('0x14')]=function(_0x4718aa){try{if(this[_0x106f('0x6')][_0x4718aa[_0x106f('0x19')]]&&(this['voiceQueues'][_0x4718aa[_0x106f('0x19')]][_0x106f('0x5')]||this[_0x106f('0x6')][_0x4718aa[_0x106f('0x19')]][_0x106f('0x1b')])){if(this[_0x106f('0x7')][_0x4718aa['interface']]){this[_0x106f('0x9')][_0x4718aa[_0x106f('0x2c')]]={'queue':_0x4718aa[_0x106f('0x19')],'interface':_0x4718aa['interface']};}}}catch(_0x511292){logger['error'](_0x106f('0x40'),_0x511292[_0x106f('0x3d')]);}};Acw[_0x106f('0x3f')][_0x106f('0x41')]=function(_0x3f0571){try{if(this[_0x106f('0x9')][_0x3f0571[_0x106f('0x2c')]]&&_[_0x106f('0x42')](this[_0x106f('0x9')][_0x3f0571[_0x106f('0x2c')]]['attended'])){logger[_0x106f('0x27')](_0x106f('0x43'),_0x3f0571[_0x106f('0x2c')]);this['startAcw'](_0x3f0571[_0x106f('0x2c')]);}else if(this[_0x106f('0x9')][_0x3f0571[_0x106f('0x44')]]&&_[_0x106f('0x42')](this[_0x106f('0x9')][_0x3f0571[_0x106f('0x44')]]['attended'])){logger[_0x106f('0x27')]('[%s][HANGUP:LINKEDID]',_0x3f0571[_0x106f('0x44')]);this[_0x106f('0x17')](_0x3f0571[_0x106f('0x44')]);}}catch(_0x1bb1e7){logger[_0x106f('0x33')]('[ACW][syncHangupRequest]\x20%s',_0x1bb1e7[_0x106f('0x3d')]);}};Acw[_0x106f('0x3f')]['syncHangup']=function(_0x39f7cf){try{if(this[_0x106f('0x9')][_0x39f7cf[_0x106f('0x2c')]]&&this[_0x106f('0x9')][_0x39f7cf['uniqueid']][_0x106f('0x24')]){logger[_0x106f('0x27')](_0x106f('0x45'),_0x39f7cf[_0x106f('0x2c')]);this[_0x106f('0x17')](_0x39f7cf[_0x106f('0x2c')]);}else if(this[_0x106f('0x9')][_0x39f7cf[_0x106f('0x44')]]&&this[_0x106f('0x9')][_0x39f7cf['linkedid']][_0x106f('0x24')]){logger[_0x106f('0x27')](_0x106f('0x46'),_0x39f7cf[_0x106f('0x44')]);this[_0x106f('0x17')](_0x39f7cf['linkedid']);}}catch(_0x585f50){logger[_0x106f('0x33')]('[ACW][syncHangup]\x20%s',_0x585f50['message']);}};Acw[_0x106f('0x3f')]['syncAttendedTransfer']=function(_0x2ffa1e){try{if(!_[_0x106f('0x47')](this[_0x106f('0x9')][_0x2ffa1e['transfereeuniqueid']])){this[_0x106f('0x17')](_0x2ffa1e['transfereeuniqueid']);if(this[_0x106f('0x9')][_0x2ffa1e[_0x106f('0x48')]]){this['channels'][_0x2ffa1e[_0x106f('0x48')]]['attended']=!![];this[_0x106f('0x9')][_0x2ffa1e[_0x106f('0x49')]]=this[_0x106f('0x9')][_0x2ffa1e['secondtransfereruniqueid']];delete this[_0x106f('0x9')][_0x2ffa1e[_0x106f('0x48')]];}}else if(!_['isNil'](this[_0x106f('0x9')][_0x2ffa1e[_0x106f('0x49')]])){this['startAcw'](_0x2ffa1e[_0x106f('0x49')]);if(this[_0x106f('0x9')][_0x2ffa1e[_0x106f('0x4a')]]){this[_0x106f('0x9')][_0x2ffa1e[_0x106f('0x4a')]]['attended']=!![];this[_0x106f('0x9')][_0x2ffa1e[_0x106f('0x4b')]]=this['channels'][_0x2ffa1e[_0x106f('0x4a')]];delete this[_0x106f('0x9')][_0x2ffa1e[_0x106f('0x4a')]];}}}catch(_0x156cef){logger[_0x106f('0x33')](_0x106f('0x4c'),_0x156cef[_0x106f('0x3d')]);}};Acw[_0x106f('0x3f')]['syncBlindTransfer']=function(_0x4e61cd){try{if(this['channels'][_0x4e61cd['transfereruniqueid']]){logger[_0x106f('0x27')](_0x106f('0x4d'),JSON[_0x106f('0x3b')](_0x4e61cd[_0x106f('0x4e')]));this[_0x106f('0x17')](_0x4e61cd[_0x106f('0x4e')]);}else if(this[_0x106f('0x9')][_0x4e61cd[_0x106f('0x4f')]]){logger[_0x106f('0x27')](_0x106f('0x50'),JSON[_0x106f('0x3b')](_0x4e61cd['transfererlinkedid']));this['startAcw'](_0x4e61cd['transfererlinkedid']);}}catch(_0x56ce9e){logger[_0x106f('0x33')](_0x106f('0x51'),_0x56ce9e[_0x106f('0x3d')]);}};Acw[_0x106f('0x3f')][_0x106f('0xf')]=function(_0x52cbd0){try{if(this[_0x106f('0x6')][_0x52cbd0[_0x106f('0x19')]]&&this[_0x106f('0x6')][_0x52cbd0[_0x106f('0x19')]][_0x106f('0x52')]===_0x106f('0x53')){if(this[_0x106f('0x7')][_0x52cbd0[_0x106f('0x18')]]){logger[_0x106f('0x27')](_0x106f('0x54'),_0x52cbd0[_0x106f('0x2c')],_0x52cbd0[_0x106f('0x18')],_0x52cbd0[_0x106f('0x19')]);return RpcUser[_0x106f('0x26')](this[_0x106f('0x7')][_0x52cbd0[_0x106f('0x18')]],_0x106f('0x55'),_0x52cbd0[_0x106f('0x2c')]);}}}catch(_0x388fe2){logger[_0x106f('0x33')](_0x106f('0x56'),_0x388fe2[_0x106f('0x3d')]);}};module[_0x106f('0x57')]=Acw; \ No newline at end of file +var _0xe2e3=['linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','bind','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','catch','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined'];(function(_0x33e776,_0x90f1fd){var _0xc32c2a=function(_0x59943d){while(--_0x59943d){_0x33e776['push'](_0x33e776['shift']());}};_0xc32c2a(++_0x90f1fd);}(_0xe2e3,0xad));var _0x3e2e=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xe2e3[_0x34843e];return _0x598f7f;};'use strict';var util=require(_0x3e2e('0x0'));var _=require('lodash');var moment=require(_0x3e2e('0x1'));var ami=require('../ami');var logger=require(_0x3e2e('0x2'))('acw');var RpcUser=require(_0x3e2e('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x35cdc7){this['voiceQueues']=_0x35cdc7[_0x3e2e('0x4')];this[_0x3e2e('0x5')]=_0x35cdc7[_0x3e2e('0x5')];this[_0x3e2e('0x6')]=_0x35cdc7['timers'];this[_0x3e2e('0x7')]={};ami['on'](_0x3e2e('0x8'),this['syncAgentConnect']['bind'](this));ami['on'](_0x3e2e('0x9'),this['syncHangupRequest']['bind'](this));ami['on'](_0x3e2e('0xa'),this[_0x3e2e('0xb')]['bind'](this));ami['on'](_0x3e2e('0xc'),this[_0x3e2e('0xd')]['bind'](this));ami['on'](_0x3e2e('0xe'),this['syncAttendedTransfer'][_0x3e2e('0xf')](this));ami['on'](_0x3e2e('0x10'),this[_0x3e2e('0x11')][_0x3e2e('0xf')](this));ami['on']('custom:agentConnectPreview',this[_0x3e2e('0x12')][_0x3e2e('0xf')](this));}function getDiff(_0x49f128){var _0x25d220=moment()[_0x3e2e('0x13')](0x0);var _0x486d8c=moment(_0x49f128)[_0x3e2e('0x13')](0x0);return _0x25d220['diff'](_0x486d8c,_0x3e2e('0x14'));}Acw[_0x3e2e('0x15')][_0x3e2e('0x16')]=function(_0x769efd){try{var _0x43b0a2=this;var _0x4a1b14=this['channels'][_0x769efd][_0x3e2e('0x17')];var _0x31debc=this[_0x3e2e('0x7')][_0x769efd][_0x3e2e('0x18')];var _0x51b1a5=this[_0x3e2e('0x4')][_0x31debc];var _0x26efcf=![];var _0x3e47c2='ACW';if(_0x51b1a5[_0x3e2e('0x19')]){if(_0x51b1a5[_0x3e2e('0x1a')][_0x3e2e('0x1b')]){_0x26efcf=!![];_0x3e47c2=_0x51b1a5['mandatoryDispositionPause'][_0x3e2e('0x1b')];}}ami['Action']({'action':'QueuePause','interface':_0x4a1b14,'paused':!![],'reason':_0x3e47c2})[_0x3e2e('0x1c')](function(_0x106b19){if(_0x43b0a2[_0x3e2e('0x5')][_0x4a1b14]){return RpcUser[_0x3e2e('0x1d')](_0x43b0a2['agents'][_0x4a1b14]['id'])[_0x3e2e('0x1c')](function(_0x3bd33e){if(_0x3bd33e&&!_0x3bd33e[_0x3e2e('0x1e')]){logger[_0x3e2e('0x1f')](_0x3e2e('0x20'),_0x769efd,_0x4a1b14,_0x31debc);var _0x20ef94=_0x43b0a2[_0x3e2e('0x7')][_0x769efd][_0x3e2e('0x21')]&&_0x43b0a2['channels'][_0x769efd][_0x3e2e('0x22')]?_0x43b0a2[_0x3e2e('0x7')][_0x769efd]['destlinkedid']:_0x769efd;return RpcUser[_0x3e2e('0x23')](_0x43b0a2[_0x3e2e('0x5')][_0x4a1b14],_0x3e47c2,_0x20ef94)[_0x3e2e('0x1c')](function(_0x38b1fe){if(!_0x26efcf){_0x43b0a2[_0x3e2e('0x6')][_0x4a1b14]={};logger['info'](_0x3e2e('0x24'),_0x769efd,_0x43b0a2[_0x3e2e('0x4')][_0x31debc][_0x3e2e('0x25')],_0x4a1b14,_0x31debc);_0x43b0a2[_0x3e2e('0x6')][_0x4a1b14][_0x3e2e('0x26')]=setTimeout(_0x43b0a2[_0x3e2e('0x27')][_0x3e2e('0xf')](_0x43b0a2,_0x4a1b14),_0x43b0a2[_0x3e2e('0x4')][_0x31debc][_0x3e2e('0x25')]*0x3e8);_0x43b0a2[_0x3e2e('0x6')][_0x4a1b14]['lastPauseAt']=moment()[_0x3e2e('0x28')](_0x3e2e('0x29'));_0x43b0a2['timers'][_0x4a1b14][_0x3e2e('0x2a')]=_0x769efd;_0x43b0a2[_0x3e2e('0x6')][_0x4a1b14][_0x3e2e('0x18')]=_0x31debc;_0x43b0a2[_0x3e2e('0x6')][_0x4a1b14][_0x3e2e('0x2b')]=function(){var _0x3b9a89=getDiff(_0x43b0a2['timers'][_0x4a1b14]['lastPauseAt']);clearTimeout(_0x43b0a2[_0x3e2e('0x6')][_0x4a1b14][_0x3e2e('0x26')]);_0x43b0a2[_0x3e2e('0x6')][_0x4a1b14]['timer']=![];RpcVoiceAgentReport[_0x3e2e('0x2c')]({'acwtime':_0x3b9a89},_0x43b0a2[_0x3e2e('0x6')][_0x4a1b14]['uniqueid'],_0x4a1b14)[_0x3e2e('0x1c')](function(_0x5946df){logger['info'](_0x3e2e('0x2d'),_0x769efd,_0x3b9a89,_0x5946df);})['catch'](function(_0x55d6e3){logger[_0x3e2e('0x2e')](_0x3e2e('0x2f'),_0x769efd,_0x55d6e3);});delete _0x43b0a2[_0x3e2e('0x6')][_0x4a1b14];};}});}else{logger[_0x3e2e('0x1f')](_0x3e2e('0x30'),_0x769efd,_0x4a1b14,_0x31debc);}});}})[_0x3e2e('0x31')](function(_0x41dd63){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x769efd,_0x43b0a2[_0x3e2e('0x4')][_0x31debc][_0x3e2e('0x25')],_0x4a1b14,_0x31debc);})[_0x3e2e('0x32')](function(){delete _0x43b0a2['channels'][_0x769efd];});}catch(_0x59b319){logger[_0x3e2e('0x2e')](_0x3e2e('0x33'),_0x59b319[_0x3e2e('0x34')]);}};Acw['prototype'][_0x3e2e('0x27')]=function(_0x84efa5){try{var _0x4016be=this;if(_0x4016be[_0x3e2e('0x6')][_0x84efa5]){_0x4016be['timers'][_0x84efa5][_0x3e2e('0x26')]=![];var _0x3dcb50=_0x4016be[_0x3e2e('0x6')][_0x84efa5][_0x3e2e('0x2a')];var _0x3b00da=_0x4016be[_0x3e2e('0x6')][_0x84efa5][_0x3e2e('0x18')];var _0x3b8eec=_0x4016be['voiceQueues'][_0x3b00da][_0x3e2e('0x25')];logger[_0x3e2e('0x1f')](_0x3e2e('0x35'),_0x3dcb50,_0x84efa5);RpcUser['saveUnpause'](this[_0x3e2e('0x5')][_0x84efa5]);RpcVoiceAgentReport['update']({'acwtime':_0x3b8eec,'agentacw':!![]},_0x3dcb50,_0x84efa5)['then'](function(_0x20c1fe){logger[_0x3e2e('0x1f')](_0x3e2e('0x2d'),_0x3dcb50,_0x3b8eec,_0x20c1fe);})['catch'](function(_0x1efeb3){logger[_0x3e2e('0x2e')](_0x3e2e('0x2f'),_0x3dcb50,_0x1efeb3);});}else{logger['error'](_0x3e2e('0x36'),_0x84efa5);if(_0x4016be['timers']){logger[_0x3e2e('0x1f')](_0x3e2e('0x37'),JSON['stringify'](_0x4016be[_0x3e2e('0x6')]));}}}catch(_0x1bdd3c){logger[_0x3e2e('0x2e')](_0x3e2e('0x38'),_0x1bdd3c[_0x3e2e('0x34')]);}};Acw[_0x3e2e('0x15')]['syncAgentConnect']=function(_0x296156){try{if(this[_0x3e2e('0x4')][_0x296156[_0x3e2e('0x18')]]&&(this[_0x3e2e('0x4')][_0x296156['queue']][_0x3e2e('0x39')]||this[_0x3e2e('0x4')][_0x296156['queue']][_0x3e2e('0x19')])){if(this[_0x3e2e('0x5')][_0x296156[_0x3e2e('0x17')]]){this[_0x3e2e('0x7')][_0x296156['uniqueid']]={'queue':_0x296156[_0x3e2e('0x18')],'interface':_0x296156['interface'],'destlinkedid':_0x296156[_0x3e2e('0x22')]};}}}catch(_0x4f2ebf){logger[_0x3e2e('0x2e')](_0x3e2e('0x3a'),_0x4f2ebf[_0x3e2e('0x34')]);}};Acw[_0x3e2e('0x15')][_0x3e2e('0x12')]=function(_0xc122){try{if(this['voiceQueues'][_0xc122[_0x3e2e('0x18')]]&&(this[_0x3e2e('0x4')][_0xc122['queue']][_0x3e2e('0x39')]||this['voiceQueues'][_0xc122[_0x3e2e('0x18')]][_0x3e2e('0x19')])){if(this['agents'][_0xc122[_0x3e2e('0x17')]]){this[_0x3e2e('0x7')][_0xc122[_0x3e2e('0x2a')]]={'queue':_0xc122['queue'],'interface':_0xc122[_0x3e2e('0x17')]};}}}catch(_0x12dd76){logger[_0x3e2e('0x2e')](_0x3e2e('0x3b'),_0x12dd76[_0x3e2e('0x34')]);}};Acw[_0x3e2e('0x15')]['syncHangupRequest']=function(_0x5bc0a5){try{if(this['channels'][_0x5bc0a5[_0x3e2e('0x2a')]]&&_[_0x3e2e('0x3c')](this[_0x3e2e('0x7')][_0x5bc0a5[_0x3e2e('0x2a')]][_0x3e2e('0x21')])){logger[_0x3e2e('0x1f')]('[%s][HANGUP:UNIQUEID]',_0x5bc0a5[_0x3e2e('0x2a')]);this[_0x3e2e('0x16')](_0x5bc0a5['uniqueid']);}else if(this[_0x3e2e('0x7')][_0x5bc0a5[_0x3e2e('0x3d')]]&&_['isUndefined'](this[_0x3e2e('0x7')][_0x5bc0a5[_0x3e2e('0x3d')]][_0x3e2e('0x21')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x5bc0a5[_0x3e2e('0x3d')]);this['startAcw'](_0x5bc0a5[_0x3e2e('0x3d')]);}}catch(_0x450e88){logger[_0x3e2e('0x2e')]('[ACW][syncHangupRequest]\x20%s',_0x450e88[_0x3e2e('0x34')]);}};Acw['prototype'][_0x3e2e('0xb')]=function(_0x3310e2){try{if(this[_0x3e2e('0x7')][_0x3310e2['uniqueid']]&&this[_0x3e2e('0x7')][_0x3310e2[_0x3e2e('0x2a')]]['attended']){logger[_0x3e2e('0x1f')](_0x3e2e('0x3e'),_0x3310e2['uniqueid']);this[_0x3e2e('0x16')](_0x3310e2['uniqueid']);}else if(this[_0x3e2e('0x7')][_0x3310e2[_0x3e2e('0x3d')]]&&this[_0x3e2e('0x7')][_0x3310e2['linkedid']][_0x3e2e('0x21')]){logger[_0x3e2e('0x1f')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x3310e2[_0x3e2e('0x3d')]);this[_0x3e2e('0x16')](_0x3310e2[_0x3e2e('0x3d')]);}}catch(_0x3371c4){logger[_0x3e2e('0x2e')](_0x3e2e('0x3f'),_0x3371c4[_0x3e2e('0x34')]);}};Acw['prototype']['syncAttendedTransfer']=function(_0x32c44e){try{if(!_['isNil'](this[_0x3e2e('0x7')][_0x32c44e[_0x3e2e('0x40')]])){this['startAcw'](_0x32c44e[_0x3e2e('0x40')]);if(this[_0x3e2e('0x7')][_0x32c44e['secondtransfereruniqueid']]){this[_0x3e2e('0x7')][_0x32c44e[_0x3e2e('0x41')]][_0x3e2e('0x21')]=!![];this['channels'][_0x32c44e[_0x3e2e('0x42')]]=this[_0x3e2e('0x7')][_0x32c44e[_0x3e2e('0x41')]];delete this[_0x3e2e('0x7')][_0x32c44e[_0x3e2e('0x41')]];}}else if(!_['isNil'](this[_0x3e2e('0x7')][_0x32c44e[_0x3e2e('0x42')]])){this[_0x3e2e('0x16')](_0x32c44e[_0x3e2e('0x42')]);if(this['channels'][_0x32c44e['origtransfereruniqueid']]){this[_0x3e2e('0x7')][_0x32c44e[_0x3e2e('0x43')]][_0x3e2e('0x21')]=!![];this[_0x3e2e('0x7')][_0x32c44e[_0x3e2e('0x40')]]=this['channels'][_0x32c44e['origtransfereruniqueid']];delete this[_0x3e2e('0x7')][_0x32c44e[_0x3e2e('0x43')]];}}}catch(_0x571671){logger[_0x3e2e('0x2e')](_0x3e2e('0x44'),_0x571671[_0x3e2e('0x34')]);}};Acw[_0x3e2e('0x15')][_0x3e2e('0x11')]=function(_0x25ca9c){try{if(this[_0x3e2e('0x7')][_0x25ca9c[_0x3e2e('0x45')]]){logger[_0x3e2e('0x1f')](_0x3e2e('0x46'),JSON['stringify'](_0x25ca9c['transfereruniqueid']));this['startAcw'](_0x25ca9c['transfereruniqueid']);}else if(this[_0x3e2e('0x7')][_0x25ca9c[_0x3e2e('0x47')]]){logger[_0x3e2e('0x1f')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x25ca9c['transfererlinkedid']));this[_0x3e2e('0x16')](_0x25ca9c['transfererlinkedid']);}}catch(_0x5822e7){logger['error'](_0x3e2e('0x48'),_0x5822e7['message']);}};Acw['prototype'][_0x3e2e('0xd')]=function(_0x5cd35d){try{if(this[_0x3e2e('0x4')][_0x5cd35d[_0x3e2e('0x18')]]&&this[_0x3e2e('0x4')][_0x5cd35d['queue']][_0x3e2e('0x49')]===_0x3e2e('0x4a')){if(this[_0x3e2e('0x5')][_0x5cd35d['interface']]){logger[_0x3e2e('0x1f')](_0x3e2e('0x4b'),_0x5cd35d[_0x3e2e('0x2a')],_0x5cd35d['interface'],_0x5cd35d['queue']);return RpcUser[_0x3e2e('0x23')](this['agents'][_0x5cd35d[_0x3e2e('0x17')]],'Auto-Pause',_0x5cd35d['uniqueid']);}}}catch(_0x9f0ebd){logger[_0x3e2e('0x2e')](_0x3e2e('0x4c'),_0x9f0ebd['message']);}};module[_0x3e2e('0x4d')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 3629af4..41bfc8c 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 _0x7e25=['port','username','keepConnected','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','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\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','exports','bluebird','util','../../config/logger','ami','asterisk'];(function(_0x3d99b5,_0x75a498){var _0x5c14e2=function(_0x3b3a9a){while(--_0x3b3a9a){_0x3d99b5['push'](_0x3d99b5['shift']());}};_0x5c14e2(++_0x75a498);}(_0x7e25,0x1e5));var _0x57e2=function(_0x273f77,_0xe5b0cb){_0x273f77=_0x273f77-0x0;var _0x71e147=_0x7e25[_0x273f77];return _0x71e147;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x57e2('0x0'));var moment=require('moment');var util=require(_0x57e2('0x1'));var _=require('lodash');var logger=require(_0x57e2('0x2'))(_0x57e2('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0x57e2('0x4')][_0x57e2('0x5')],config[_0x57e2('0x4')]['ip'],config[_0x57e2('0x4')][_0x57e2('0x6')],config[_0x57e2('0x4')]['password'],!![]);ami[_0x57e2('0x7')]();ami[_0x57e2('0x8')]=BPromise[_0x57e2('0x9')](ami['action']);function error(_0x430ec7){logger[_0x57e2('0xa')](util[_0x57e2('0xb')](_0x57e2('0xc'),config['asterisk']['username'],config[_0x57e2('0x4')]['ip'],config[_0x57e2('0x4')]['port'],util[_0x57e2('0xd')](_0x430ec7,![],null)));}function close(){logger[_0x57e2('0xa')](util[_0x57e2('0xb')](_0x57e2('0xe'),config['asterisk'][_0x57e2('0x6')],config[_0x57e2('0x4')]['ip'],config[_0x57e2('0x4')][_0x57e2('0x5')]));}ami[_0x57e2('0xf')]=function(){return function(){return ami[_0x57e2('0x8')]({'action':_0x57e2('0x10')});};};ami[_0x57e2('0x11')]=function(){return function(){return ami[_0x57e2('0x8')]({'action':_0x57e2('0x12')});};};ami[_0x57e2('0x13')]=function(){return function(){return ami[_0x57e2('0x8')]({'action':_0x57e2('0x14')});};};ami[_0x57e2('0x15')]=function(){return function(){return ami[_0x57e2('0x8')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x57e2('0x8')]({'action':_0x57e2('0x16')});};};function connect(_0x5181ce){logger[_0x57e2('0x17')](util['format'](_0x57e2('0x18'),config[_0x57e2('0x4')][_0x57e2('0x6')],config['asterisk']['ip'],config['asterisk'][_0x57e2('0x5')]));ami[_0x57e2('0x19')](_0x57e2('0xa'),error);ami[_0x57e2('0x19')](_0x57e2('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0x57e2('0x1b'),function(_0x26be5b){logger[_0x57e2('0x17')](util[_0x57e2('0xb')](_0x57e2('0x1c'),config[_0x57e2('0x4')][_0x57e2('0x6')],config[_0x57e2('0x4')]['ip'],config[_0x57e2('0x4')][_0x57e2('0x5')],util['inspect'](_0x26be5b,![],null)));});ami['on']('fullybooted',function(_0xf8ea7e){logger[_0x57e2('0x17')](util[_0x57e2('0xb')](_0x57e2('0x1d'),config['asterisk'][_0x57e2('0x6')],config['asterisk']['ip'],config[_0x57e2('0x4')][_0x57e2('0x5')]));return BPromise[_0x57e2('0x1e')]()[_0x57e2('0x1f')](ami[_0x57e2('0xf')]())[_0x57e2('0x1f')](ami[_0x57e2('0x11')]())[_0x57e2('0x1f')](ami[_0x57e2('0x13')]())[_0x57e2('0x1f')](ami[_0x57e2('0x15')]())[_0x57e2('0x1f')](ami['actionCoreShowChannels']())[_0x57e2('0x20')](function(_0x238376){console[_0x57e2('0x21')](_0x238376);});});ami[_0x57e2('0x19')](_0x57e2('0xa'),error);ami[_0x57e2('0x19')]('close',close);module[_0x57e2('0x22')]=ami; \ No newline at end of file +var _0x214d=['error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','exports','asterisk-manager','bluebird','moment','util','lodash','ami','../../config/environment','asterisk','username','keepConnected','promisify','action'];(function(_0x50cd37,_0x5c992f){var _0x41fd21=function(_0x4401b5){while(--_0x4401b5){_0x50cd37['push'](_0x50cd37['shift']());}};_0x41fd21(++_0x5c992f);}(_0x214d,0x13c));var _0xd214=function(_0x4f49a9,_0xccd899){_0x4f49a9=_0x4f49a9-0x0;var _0xca697d=_0x214d[_0x4f49a9];return _0xca697d;};'use strict';var Manager=require(_0xd214('0x0'));var BPromise=require(_0xd214('0x1'));var moment=require(_0xd214('0x2'));var util=require(_0xd214('0x3'));var _=require(_0xd214('0x4'));var logger=require('../../config/logger')(_0xd214('0x5'));var config=require(_0xd214('0x6'));var ami=new Manager(config[_0xd214('0x7')]['port'],config['asterisk']['ip'],config[_0xd214('0x7')][_0xd214('0x8')],config[_0xd214('0x7')]['password'],!![]);ami[_0xd214('0x9')]();ami['Action']=BPromise[_0xd214('0xa')](ami[_0xd214('0xb')]);function error(_0x3e9eae){logger[_0xd214('0xc')](util[_0xd214('0xd')](_0xd214('0xe'),config[_0xd214('0x7')][_0xd214('0x8')],config[_0xd214('0x7')]['ip'],config['asterisk'][_0xd214('0xf')],util[_0xd214('0x10')](_0x3e9eae,![],null)));}function close(){logger[_0xd214('0xc')](util[_0xd214('0xd')](_0xd214('0x11'),config[_0xd214('0x7')]['username'],config[_0xd214('0x7')]['ip'],config['asterisk'][_0xd214('0xf')]));}ami[_0xd214('0x12')]=function(){return function(){return ami[_0xd214('0x13')]({'action':_0xd214('0x14')});};};ami[_0xd214('0x15')]=function(){return function(){return ami['Action']({'action':_0xd214('0x16')});};};ami[_0xd214('0x17')]=function(){return function(){return ami[_0xd214('0x13')]({'action':_0xd214('0x18')});};};ami[_0xd214('0x19')]=function(){return function(){return ami[_0xd214('0x13')]({'action':_0xd214('0x1a')});};};ami[_0xd214('0x1b')]=function(){return function(){return ami[_0xd214('0x13')]({'action':'coreshowchannels'});};};function connect(_0x2c024e){logger[_0xd214('0x1c')](util[_0xd214('0xd')](_0xd214('0x1d'),config['asterisk'][_0xd214('0x8')],config[_0xd214('0x7')]['ip'],config[_0xd214('0x7')][_0xd214('0xf')]));ami[_0xd214('0x1e')](_0xd214('0xc'),error);ami[_0xd214('0x1e')](_0xd214('0x1f'),close);}ami['on'](_0xd214('0x20'),connect);ami['on'](_0xd214('0x21'),function(_0x3b721e){logger[_0xd214('0x1c')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0xd214('0x7')][_0xd214('0x8')],config['asterisk']['ip'],config[_0xd214('0x7')][_0xd214('0xf')],util[_0xd214('0x10')](_0x3b721e,![],null)));});ami['on'](_0xd214('0x22'),function(_0xe9e66c){logger[_0xd214('0x1c')](util['format'](_0xd214('0x23'),config['asterisk']['username'],config[_0xd214('0x7')]['ip'],config[_0xd214('0x7')][_0xd214('0xf')]));return BPromise[_0xd214('0x24')]()[_0xd214('0x25')](ami['actionSipShowRegistry']())[_0xd214('0x25')](ami[_0xd214('0x15')]())[_0xd214('0x25')](ami[_0xd214('0x17')]())[_0xd214('0x25')](ami[_0xd214('0x19')]())['then'](ami[_0xd214('0x1b')]())[_0xd214('0x26')](function(_0x3cc835){console[_0xd214('0x27')](_0x3cc835);});});ami[_0xd214('0x1e')](_0xd214('0xc'),error);ami['once']('close',close);module[_0xd214('0x28')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 5c0a79a..ea39e5c 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 _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x58d888,_0x212264){var _0x264db3=function(_0x3f9125){while(--_0x3f9125){_0x58d888['push'](_0x58d888['shift']());}};_0x264db3(++_0x212264);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x59b9d3,_0x384472){_0x59b9d3=_0x59b9d3-0x0;var _0x171163=_0xbdb7[_0x59b9d3];return _0x171163;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x2cc8bb,_0x5f2607){var _0x140e40=function(_0x80d96d){while(--_0x80d96d){_0x2cc8bb['push'](_0x2cc8bb['shift']());}};_0x140e40(++_0x5f2607);}(_0xb7e7,0x121));var _0x7b7e=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xb7e7[_0x710815];return _0x5b3b89;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index acbf567..7b3a9b1 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 _0x741a=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','getQueue','util','lodash','moment','isNil','string','voiceQueue','uniqueid','Contact','phone','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x3fc939,_0x29d541){var _0x11c689=function(_0x3afd52){while(--_0x3afd52){_0x3fc939['push'](_0x3fc939['shift']());}};_0x11c689(++_0x29d541);}(_0x741a,0x78));var _0xa741=function(_0x2dc024,_0x97f547){_0x2dc024=_0x2dc024-0x0;var _0x44b423=_0x741a[_0x2dc024];return _0x44b423;};'use strict';var util=require(_0xa741('0x0'));var _=require(_0xa741('0x1'));var moment=require(_0xa741('0x2'));function checkNameSurname(_0x3fb9b2,_0x330342,_0x4e59b7){var _0x341678='';if(!_[_0xa741('0x3')](_0x330342)&&_0xa741('0x4')===typeof _0x330342){_0x341678+=_0x330342;}if(!_['isNil'](_0x4e59b7)&&_0xa741('0x4')===typeof _0x4e59b7){_0x341678+='\x20'+_0x4e59b7;}if(_0x341678!==''){return _0x341678;}return _0x3fb9b2;}function Action(_0x4a69c0,_0x45e1bd,_0x2dd088){this[_0xa741('0x5')]=_0x4a69c0;this[_0xa741('0x6')]=_0x2dd088||undefined;this['name']=checkNameSurname(_0x45e1bd[_0xa741('0x7')][_0xa741('0x8')],_0x45e1bd[_0xa741('0x7')][_0xa741('0x9')],_0x45e1bd[_0xa741('0x7')][_0xa741('0xa')]);this[_0xa741('0xb')]=_0x45e1bd['Contact'][_0xa741('0x8')];this[_0xa741('0xc')]=_0x4a69c0[_0xa741('0xd')];this[_0xa741('0xe')]=_0x45e1bd[_0xa741('0xe')]||![];this[_0xa741('0xf')]=_0x4a69c0['type'];this[_0xa741('0x10')]=_0x4a69c0['dialQueueTimeout']||0x3;this['scheduledat']=_0x45e1bd[_0xa741('0x11')];this['countbusyretry']=_0x45e1bd[_0xa741('0x12')];this[_0xa741('0x13')]=_0x45e1bd[_0xa741('0x13')];this[_0xa741('0x14')]=_0x45e1bd[_0xa741('0x14')];this[_0xa741('0x15')]=_0x45e1bd['countnosuchnumberretry'];this[_0xa741('0x16')]=_0x45e1bd[_0xa741('0x16')];this[_0xa741('0x17')]=_0x45e1bd['countabandonedretry'];this[_0xa741('0x18')]=_0x45e1bd[_0xa741('0x18')];this[_0xa741('0x19')]=_0x45e1bd[_0xa741('0x19')];this[_0xa741('0x1a')]=_0x45e1bd['ContactId'];this[_0xa741('0x1b')]=_0x45e1bd[_0xa741('0x1b')];this[_0xa741('0x1c')]=_0x45e1bd[_0xa741('0x1c')];this['VoiceQueueId']=_0x45e1bd[_0xa741('0x1d')];this[_0xa741('0x1e')]=_0x45e1bd['CampaignId'];this[_0xa741('0x1f')]=_0x45e1bd['id'];this[_0xa741('0x20')]=_0x45e1bd[_0xa741('0x7')]['firstName']||'';this[_0xa741('0x21')]=moment()[_0xa741('0x22')](_0xa741('0x23'));this[_0xa741('0x24')]=_0x45e1bd[_0xa741('0x24')];this[_0xa741('0x25')]=_0x45e1bd['callbackuniqueid'];this[_0xa741('0x26')]=_0x45e1bd[_0xa741('0x26')];this[_0xa741('0x27')]=_0x45e1bd[_0xa741('0x27')];this[_0xa741('0x28')]='';this[_0xa741('0x29')]='';}Action[_0xa741('0x2a')][_0xa741('0x2b')]=function(){return util[_0xa741('0x22')](_0xa741('0x2c'),this[_0xa741('0xd')],this[_0xa741('0x5')]['dialCutDigit']>0x0?this[_0xa741('0xb')][_0xa741('0x2d')](this[_0xa741('0x5')]['dialCutDigit']):this[_0xa741('0xb')]);};Action[_0xa741('0x2a')][_0xa741('0x2e')]=function(){return this[_0xa741('0xc')];};module['exports']=Action; \ No newline at end of file +var _0xc06d=['lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','voiceQueue','getQueue','queue','exports','util','moment','isNil','string','uniqueid','name','Contact','phone'];(function(_0x26faa0,_0x122eba){var _0x2867b1=function(_0x290888){while(--_0x290888){_0x26faa0['push'](_0x26faa0['shift']());}};_0x2867b1(++_0x122eba);}(_0xc06d,0x1dc));var _0xdc06=function(_0xb8ee7c,_0x2e9fdc){_0xb8ee7c=_0xb8ee7c-0x0;var _0x168d95=_0xc06d[_0xb8ee7c];return _0x168d95;};'use strict';var util=require(_0xdc06('0x0'));var _=require('lodash');var moment=require(_0xdc06('0x1'));function checkNameSurname(_0x55d73b,_0x148121,_0x50c3fb){var _0x18c8f6='';if(!_[_0xdc06('0x2')](_0x148121)&&'string'===typeof _0x148121){_0x18c8f6+=_0x148121;}if(!_[_0xdc06('0x2')](_0x50c3fb)&&_0xdc06('0x3')===typeof _0x50c3fb){_0x18c8f6+='\x20'+_0x50c3fb;}if(_0x18c8f6!==''){return _0x18c8f6;}return _0x55d73b;}function Action(_0x2d78f0,_0x597a69,_0x31247d){this['voiceQueue']=_0x2d78f0;this[_0xdc06('0x4')]=_0x31247d||undefined;this[_0xdc06('0x5')]=checkNameSurname(_0x597a69[_0xdc06('0x6')][_0xdc06('0x7')],_0x597a69[_0xdc06('0x6')]['firstName'],_0x597a69[_0xdc06('0x6')][_0xdc06('0x8')]);this[_0xdc06('0x9')]=_0x597a69[_0xdc06('0x6')][_0xdc06('0x7')];this['queue']=_0x2d78f0[_0xdc06('0x5')];this[_0xdc06('0xa')]=_0x597a69[_0xdc06('0xa')]||![];this[_0xdc06('0xb')]=_0x2d78f0['type'];this[_0xdc06('0xc')]=_0x2d78f0[_0xdc06('0xc')]||0x3;this[_0xdc06('0xd')]=_0x597a69[_0xdc06('0xd')];this[_0xdc06('0xe')]=_0x597a69['countbusyretry'];this[_0xdc06('0xf')]=_0x597a69[_0xdc06('0xf')];this[_0xdc06('0x10')]=_0x597a69[_0xdc06('0x10')];this[_0xdc06('0x11')]=_0x597a69['countnosuchnumberretry'];this[_0xdc06('0x12')]=_0x597a69[_0xdc06('0x12')];this[_0xdc06('0x13')]=_0x597a69[_0xdc06('0x13')];this[_0xdc06('0x14')]=_0x597a69[_0xdc06('0x14')];this['countagentrejectretry']=_0x597a69[_0xdc06('0x15')];this['ContactId']=_0x597a69['ContactId'];this[_0xdc06('0x16')]=_0x597a69[_0xdc06('0x16')];this[_0xdc06('0x17')]=_0x597a69[_0xdc06('0x17')];this[_0xdc06('0x18')]=_0x597a69[_0xdc06('0x18')];this['CampaignId']=_0x597a69[_0xdc06('0x19')];this[_0xdc06('0x1a')]=_0x597a69['id'];this[_0xdc06('0x1b')]=_0x597a69[_0xdc06('0x6')][_0xdc06('0x1c')]||'';this[_0xdc06('0x1d')]=moment()[_0xdc06('0x1e')](_0xdc06('0x1f'));this['callback']=_0x597a69['callback'];this[_0xdc06('0x20')]=_0x597a69[_0xdc06('0x20')];this[_0xdc06('0x21')]=_0x597a69[_0xdc06('0x21')];this[_0xdc06('0x22')]=_0x597a69[_0xdc06('0x22')];this[_0xdc06('0x23')]='';this[_0xdc06('0x24')]='';}Action[_0xdc06('0x25')][_0xdc06('0x26')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0xdc06('0x5')],this['voiceQueue'][_0xdc06('0x27')]>0x0?this[_0xdc06('0x9')]['substring'](this[_0xdc06('0x28')]['dialCutDigit']):this[_0xdc06('0x9')]);};Action[_0xdc06('0x25')][_0xdc06('0x29')]=function(){return this[_0xdc06('0x2a')];};module[_0xdc06('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 8fcadf8..f7d168a 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 _0xc2c8=['milliseconds','diff','seconds','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countglobal','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash'];(function(_0x545e64,_0x356844){var _0x13dbef=function(_0x516ff6){while(--_0x516ff6){_0x545e64['push'](_0x545e64['shift']());}};_0x13dbef(++_0x356844);}(_0xc2c8,0xda));var _0x8c2c=function(_0x54a426,_0x5f428f){_0x54a426=_0x54a426-0x0;var _0x543f9d=_0xc2c8[_0x54a426];return _0x543f9d;};'use strict';var util=require(_0x8c2c('0x0'));var _=require(_0x8c2c('0x1'));var moment=require('moment');function getSeconds(_0x505100,_0x1aaad9){var _0x4729bb=moment(_0x505100)[_0x8c2c('0x2')](0x0);var _0x1ad0b6=moment(_0x1aaad9)[_0x8c2c('0x2')](0x0);return _0x4729bb[_0x8c2c('0x3')](_0x1ad0b6,_0x8c2c('0x4'));}function AgentComplete(_0x4380e1,_0x3fd070){this['state']=0x4;this['statedesc']=_0x8c2c('0x5');this['scheduledat']=_0x4380e1[_0x8c2c('0x6')];this[_0x8c2c('0x7')]=_0x4380e1[_0x8c2c('0x7')];this['campaigntype']=_0x4380e1[_0x8c2c('0x7')]===_0x8c2c('0x8')?_0x8c2c('0x9'):_0x4380e1['type'];this['countbusyretry']=_0x4380e1[_0x8c2c('0xa')];this[_0x8c2c('0xb')]=_0x4380e1[_0x8c2c('0xb')];this['countnoanswerretry']=_0x4380e1['countnoanswerretry'];this[_0x8c2c('0xc')]=_0x4380e1[_0x8c2c('0xa')]+_0x4380e1[_0x8c2c('0xb')]+_0x4380e1['countnoanswerretry']+_0x4380e1['countnosuchnumberretry']+_0x4380e1['countdropretry']+_0x4380e1[_0x8c2c('0xd')]+_0x4380e1[_0x8c2c('0xe')]+_0x4380e1['countagentrejectretry'];this[_0x8c2c('0xf')]=_0x4380e1[_0x8c2c('0xf')];this['countdropretry']=_0x4380e1[_0x8c2c('0x10')];this['countabandonedretry']=_0x4380e1[_0x8c2c('0xd')];this[_0x8c2c('0xe')]=_0x4380e1[_0x8c2c('0xe')];this[_0x8c2c('0x11')]=_0x4380e1[_0x8c2c('0x11')];this['uniqueid']=_0x3fd070[_0x8c2c('0x12')];this['calleridname']=_0x4380e1[_0x8c2c('0x13')];this[_0x8c2c('0x14')]=_0x4380e1[_0x8c2c('0x15')];this[_0x8c2c('0x16')]=_0x4380e1[_0x8c2c('0x16')];this['responsetime']=_0x4380e1[_0x8c2c('0x17')];this[_0x8c2c('0x18')]=_0x4380e1['answertime'];this['endtime']=moment()[_0x8c2c('0x19')](_0x8c2c('0x1a'));this[_0x8c2c('0x1b')]=getSeconds(_0x4380e1['responsetime'],_0x4380e1['starttime']);this[_0x8c2c('0x1c')]=getSeconds(_0x4380e1[_0x8c2c('0x18')],_0x4380e1[_0x8c2c('0x17')]);this[_0x8c2c('0x1d')]=getSeconds(this[_0x8c2c('0x1e')],_0x4380e1['answertime']);this['queue']=_0x3fd070['queue'];this[_0x8c2c('0x1f')]=_0x3fd070['membername'];this[_0x8c2c('0x20')]=_0x3fd070[_0x8c2c('0x20')];this[_0x8c2c('0x21')]=_0x4380e1[_0x8c2c('0x21')];this[_0x8c2c('0x22')]=_0x4380e1[_0x8c2c('0x22')];this['callbackat']=_0x4380e1[_0x8c2c('0x23')];this[_0x8c2c('0x24')]=_0x4380e1[_0x8c2c('0x24')];this['ContactId']=_0x4380e1['ContactId'];this[_0x8c2c('0x25')]=_0x4380e1['ListId'];this[_0x8c2c('0x26')]=_0x4380e1['UserId'];this[_0x8c2c('0x27')]=_0x4380e1[_0x8c2c('0x27')];this['CampaignId']=_0x4380e1[_0x8c2c('0x28')];this[_0x8c2c('0x29')]=_0x4380e1['originatecalleridnum']||'';this[_0x8c2c('0x2a')]=_0x4380e1['originatecalleridname']||'';}module[_0x8c2c('0x2b')]=AgentComplete; \ No newline at end of file +var _0xe52c=['starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number'];(function(_0x4b73a2,_0x40b5fe){var _0x383c66=function(_0x3917ae){while(--_0x3917ae){_0x4b73a2['push'](_0x4b73a2['shift']());}};_0x383c66(++_0x40b5fe);}(_0xe52c,0xa3));var _0xce52=function(_0x533cf7,_0x385d34){_0x533cf7=_0x533cf7-0x0;var _0x16df8b=_0xe52c[_0x533cf7];return _0x16df8b;};'use strict';var util=require(_0xce52('0x0'));var _=require(_0xce52('0x1'));var moment=require('moment');function getSeconds(_0x58af4a,_0x23713f){var _0x5f2078=moment(_0x58af4a)[_0xce52('0x2')](0x0);var _0x277ca7=moment(_0x23713f)[_0xce52('0x2')](0x0);return _0x5f2078[_0xce52('0x3')](_0x277ca7,'seconds');}function AgentComplete(_0x2d78bc,_0x57a924){this['state']=0x4;this[_0xce52('0x4')]=_0xce52('0x5');this[_0xce52('0x6')]=_0x2d78bc[_0xce52('0x6')];this[_0xce52('0x7')]=_0x2d78bc[_0xce52('0x7')];this[_0xce52('0x8')]=_0x2d78bc['type']===_0xce52('0x9')?_0xce52('0xa'):_0x2d78bc[_0xce52('0x7')];this[_0xce52('0xb')]=_0x2d78bc[_0xce52('0xb')];this[_0xce52('0xc')]=_0x2d78bc[_0xce52('0xc')];this[_0xce52('0xd')]=_0x2d78bc[_0xce52('0xd')];this[_0xce52('0xe')]=_0x2d78bc['countbusyretry']+_0x2d78bc[_0xce52('0xc')]+_0x2d78bc[_0xce52('0xd')]+_0x2d78bc['countnosuchnumberretry']+_0x2d78bc[_0xce52('0xf')]+_0x2d78bc['countabandonedretry']+_0x2d78bc[_0xce52('0x10')]+_0x2d78bc[_0xce52('0x11')];this['countnosuchnumberretry']=_0x2d78bc[_0xce52('0x12')];this[_0xce52('0xf')]=_0x2d78bc[_0xce52('0xf')];this[_0xce52('0x13')]=_0x2d78bc[_0xce52('0x13')];this[_0xce52('0x10')]=_0x2d78bc[_0xce52('0x10')];this[_0xce52('0x11')]=_0x2d78bc[_0xce52('0x11')];this[_0xce52('0x14')]=_0x57a924['uniqueid'];this[_0xce52('0x15')]=_0x2d78bc[_0xce52('0x16')];this[_0xce52('0x17')]=_0x2d78bc[_0xce52('0x18')];this[_0xce52('0x19')]=_0x2d78bc[_0xce52('0x19')];this[_0xce52('0x1a')]=_0x2d78bc['responsetime'];this[_0xce52('0x1b')]=_0x2d78bc[_0xce52('0x1b')];this[_0xce52('0x1c')]=moment()[_0xce52('0x1d')](_0xce52('0x1e'));this[_0xce52('0x1f')]=getSeconds(_0x2d78bc['responsetime'],_0x2d78bc[_0xce52('0x19')]);this[_0xce52('0x20')]=getSeconds(_0x2d78bc['answertime'],_0x2d78bc['responsetime']);this[_0xce52('0x21')]=getSeconds(this['endtime'],_0x2d78bc[_0xce52('0x1b')]);this[_0xce52('0xa')]=_0x57a924['queue'];this[_0xce52('0x22')]=_0x57a924['membername'];this[_0xce52('0x23')]=_0x57a924['reason'];this[_0xce52('0x24')]=_0x2d78bc[_0xce52('0x24')];this['callbackuniqueid']=_0x2d78bc[_0xce52('0x25')];this[_0xce52('0x26')]=_0x2d78bc[_0xce52('0x26')];this[_0xce52('0x27')]=_0x2d78bc[_0xce52('0x27')];this['ContactId']=_0x2d78bc['ContactId'];this[_0xce52('0x28')]=_0x2d78bc['ListId'];this[_0xce52('0x29')]=_0x2d78bc[_0xce52('0x29')];this['VoiceQueueId']=_0x2d78bc[_0xce52('0x2a')];this[_0xce52('0x2b')]=_0x2d78bc[_0xce52('0x2b')];this['originatecalleridnum']=_0x2d78bc[_0xce52('0x2c')]||'';this[_0xce52('0x2d')]=_0x2d78bc[_0xce52('0x2d')]||'';}module[_0xce52('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 152f013..8a81e13 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 _0xb138=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','queue','calleridname','calleridnum','starttime','endtime','responsetime','ringtime','holdtime','talktime','callback','callbackat'];(function(_0xc58c93,_0x2c8539){var _0x2ee085=function(_0x5dcac6){while(--_0x5dcac6){_0xc58c93['push'](_0xc58c93['shift']());}};_0x2ee085(++_0x2c8539);}(_0xb138,0x1dd));var _0x8b13=function(_0x58affd,_0x3293b1){_0x58affd=_0x58affd-0x0;var _0x1cdc48=_0xb138[_0x58affd];return _0x1cdc48;};'use strict';var util=require(_0x8b13('0x0'));var _=require(_0x8b13('0x1'));var moment=require(_0x8b13('0x2'));function getSeconds(_0x33f214,_0xadad70){var _0x185752=moment(_0x33f214)[_0x8b13('0x3')](0x0);var _0x5369d4=moment(_0xadad70)[_0x8b13('0x3')](0x0);return _0x185752[_0x8b13('0x4')](_0x5369d4,_0x8b13('0x5'));}function Final(_0x5ae5b2){this[_0x8b13('0x6')]=_0x5ae5b2[_0x8b13('0x6')];this['scheduledat']=_0x5ae5b2[_0x8b13('0x7')];this[_0x8b13('0x8')]=_0x5ae5b2[_0x8b13('0x8')];this['campaigntype']=_0x5ae5b2[_0x8b13('0x8')]===_0x8b13('0x9')?'queue':_0x5ae5b2['type'];this[_0x8b13('0xa')]=_0x5ae5b2[_0x8b13('0xa')];this[_0x8b13('0xb')]=_0x5ae5b2[_0x8b13('0xb')];this[_0x8b13('0xc')]=_0x5ae5b2['countnoanswerretry'];this[_0x8b13('0xd')]=_0x5ae5b2[_0x8b13('0xa')]+_0x5ae5b2[_0x8b13('0xb')]+_0x5ae5b2[_0x8b13('0xc')]+_0x5ae5b2[_0x8b13('0xe')]+_0x5ae5b2[_0x8b13('0xf')]+_0x5ae5b2['countabandonedretry']+_0x5ae5b2['countmachineretry']+_0x5ae5b2[_0x8b13('0x10')];this[_0x8b13('0xe')]=_0x5ae5b2['countnosuchnumberretry'];this['countdropretry']=_0x5ae5b2['countdropretry'];this[_0x8b13('0x11')]=_0x5ae5b2[_0x8b13('0x11')];this[_0x8b13('0x12')]=_0x5ae5b2[_0x8b13('0x12')];this[_0x8b13('0x10')]=_0x5ae5b2['countagentrejectretry'];this[_0x8b13('0x13')]=_0x5ae5b2[_0x8b13('0x13')];this[_0x8b13('0x14')]=_0x5ae5b2[_0x8b13('0x14')];this[_0x8b13('0x15')]=_0x5ae5b2[_0x8b13('0x15')];this[_0x8b13('0x16')]=_0x5ae5b2[_0x8b13('0x16')];this['responsetime']=_0x5ae5b2['responsetime'];this[_0x8b13('0x17')]=_0x5ae5b2[_0x8b13('0x18')];this[_0x8b13('0x19')]=_0x5ae5b2[_0x8b13('0x19')]||0x0;this[_0x8b13('0x1a')]=_0x5ae5b2[_0x8b13('0x1a')]||0x0;this['talktime']=_0x5ae5b2[_0x8b13('0x1b')]||0x0;this[_0x8b13('0x1c')]=_0x5ae5b2[_0x8b13('0x1c')];this['callbackuniqueid']=_0x5ae5b2['callbackuniqueid'];this[_0x8b13('0x1d')]=_0x5ae5b2[_0x8b13('0x1d')];this['recallme']=_0x5ae5b2[_0x8b13('0x1e')];this[_0x8b13('0x1f')]=_0x5ae5b2[_0x8b13('0x1f')];this[_0x8b13('0x20')]=_0x5ae5b2[_0x8b13('0x20')];this['UserId']=_0x5ae5b2[_0x8b13('0x21')];this[_0x8b13('0x22')]=_0x5ae5b2['VoiceQueueId'];this[_0x8b13('0x23')]=_0x5ae5b2['CampaignId'];this[_0x8b13('0x24')]=_0x5ae5b2[_0x8b13('0x24')]||'';this['originatecalleridname']=_0x5ae5b2[_0x8b13('0x25')]||'';}module[_0x8b13('0x26')]=Final; \ No newline at end of file +var _0x1b20=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x60b84b,_0x2203ec){var _0x1ef3ff=function(_0x2ceec6){while(--_0x2ceec6){_0x60b84b['push'](_0x60b84b['shift']());}};_0x1ef3ff(++_0x2203ec);}(_0x1b20,0x66));var _0x01b2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1b20[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require('util');var _=require(_0x01b2('0x0'));var moment=require(_0x01b2('0x1'));function getSeconds(_0x4a27f9,_0x54eccf){var _0x27a406=moment(_0x4a27f9)[_0x01b2('0x2')](0x0);var _0x2d6e99=moment(_0x54eccf)[_0x01b2('0x2')](0x0);return _0x27a406[_0x01b2('0x3')](_0x2d6e99,_0x01b2('0x4'));}function Final(_0x419c17){this[_0x01b2('0x5')]=_0x419c17[_0x01b2('0x5')];this[_0x01b2('0x6')]=_0x419c17[_0x01b2('0x6')];this[_0x01b2('0x7')]=_0x419c17['type'];this[_0x01b2('0x8')]=_0x419c17['type']===_0x01b2('0x9')?_0x01b2('0xa'):_0x419c17[_0x01b2('0x7')];this[_0x01b2('0xb')]=_0x419c17[_0x01b2('0xb')];this[_0x01b2('0xc')]=_0x419c17[_0x01b2('0xc')];this[_0x01b2('0xd')]=_0x419c17['countnoanswerretry'];this[_0x01b2('0xe')]=_0x419c17['countbusyretry']+_0x419c17[_0x01b2('0xc')]+_0x419c17['countnoanswerretry']+_0x419c17[_0x01b2('0xf')]+_0x419c17[_0x01b2('0x10')]+_0x419c17[_0x01b2('0x11')]+_0x419c17[_0x01b2('0x12')]+_0x419c17['countagentrejectretry'];this[_0x01b2('0xf')]=_0x419c17[_0x01b2('0xf')];this[_0x01b2('0x10')]=_0x419c17[_0x01b2('0x10')];this[_0x01b2('0x11')]=_0x419c17['countabandonedretry'];this[_0x01b2('0x12')]=_0x419c17[_0x01b2('0x12')];this[_0x01b2('0x13')]=_0x419c17[_0x01b2('0x13')];this['queue']=_0x419c17['queue'];this[_0x01b2('0x14')]=_0x419c17[_0x01b2('0x14')];this['calleridnum']=_0x419c17[_0x01b2('0x15')];this[_0x01b2('0x16')]=_0x419c17[_0x01b2('0x16')];this['responsetime']=_0x419c17[_0x01b2('0x17')];this[_0x01b2('0x18')]=_0x419c17[_0x01b2('0x17')];this[_0x01b2('0x19')]=_0x419c17[_0x01b2('0x19')]||0x0;this['holdtime']=_0x419c17[_0x01b2('0x1a')]||0x0;this['talktime']=_0x419c17[_0x01b2('0x1b')]||0x0;this['callback']=_0x419c17[_0x01b2('0x1c')];this[_0x01b2('0x1d')]=_0x419c17[_0x01b2('0x1d')];this['callbackat']=_0x419c17[_0x01b2('0x1e')];this[_0x01b2('0x1f')]=_0x419c17[_0x01b2('0x1f')];this[_0x01b2('0x20')]=_0x419c17[_0x01b2('0x20')];this['ListId']=_0x419c17[_0x01b2('0x21')];this['UserId']=_0x419c17['UserId'];this[_0x01b2('0x22')]=_0x419c17[_0x01b2('0x22')];this[_0x01b2('0x23')]=_0x419c17[_0x01b2('0x23')];this[_0x01b2('0x24')]=_0x419c17[_0x01b2('0x24')]||'';this['originatecalleridname']=_0x419c17[_0x01b2('0x25')]||'';}module[_0x01b2('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 83afada..59d5ca1 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 _0xf15b=['ContactId','UserId','VoiceQueueId','CampaignId','util','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','calleridnum','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme'];(function(_0x425d38,_0x544e34){var _0x17d048=function(_0x34141b){while(--_0x34141b){_0x425d38['push'](_0x425d38['shift']());}};_0x17d048(++_0x544e34);}(_0xf15b,0x12a));var _0xbf15=function(_0x389b7b,_0x48cc3f){_0x389b7b=_0x389b7b-0x0;var _0x2aa03c=_0xf15b[_0x389b7b];return _0x2aa03c;};'use strict';var util=require(_0xbf15('0x0'));var _=require('lodash');var moment=require(_0xbf15('0x1'));function getSeconds(_0x4f1433,_0x5b3ae9){var _0x505d54=moment(_0x4f1433)['milliseconds'](0x0);var _0x485ea0=moment(_0x5b3ae9)[_0xbf15('0x2')](0x0);return _0x505d54[_0xbf15('0x3')](_0x485ea0,_0xbf15('0x4'));}function Hangup(_0x2ce3b0,_0x394da3){this[_0xbf15('0x5')]=0x4;this[_0xbf15('0x6')]=_0xbf15('0x7');this[_0xbf15('0x8')]=_0x2ce3b0[_0xbf15('0x8')];this[_0xbf15('0x9')]=_0x2ce3b0[_0xbf15('0x9')];this[_0xbf15('0xa')]=_0x2ce3b0[_0xbf15('0x9')]===_0xbf15('0xb')?_0xbf15('0xc'):_0x2ce3b0[_0xbf15('0x9')];this[_0xbf15('0xd')]=_0x2ce3b0[_0xbf15('0xd')];this['countcongestionretry']=_0x2ce3b0[_0xbf15('0xe')];this[_0xbf15('0xf')]=_0x2ce3b0['countnoanswerretry'];this['countglobal']=_0x2ce3b0[_0xbf15('0xd')]+_0x2ce3b0[_0xbf15('0xe')]+_0x2ce3b0[_0xbf15('0xf')]+_0x2ce3b0['countnosuchnumberretry']+_0x2ce3b0[_0xbf15('0x10')]+_0x2ce3b0[_0xbf15('0x11')]+_0x2ce3b0[_0xbf15('0x12')]+_0x2ce3b0[_0xbf15('0x13')];this[_0xbf15('0x14')]=_0x2ce3b0[_0xbf15('0x14')];this['countdropretry']=_0x2ce3b0[_0xbf15('0x10')];this[_0xbf15('0x11')]=_0x2ce3b0[_0xbf15('0x11')];this['countmachineretry']=_0x2ce3b0['countmachineretry'];this['countagentrejectretry']=_0x2ce3b0[_0xbf15('0x13')];this['uniqueid']=_0x394da3[_0xbf15('0x15')];this[_0xbf15('0x16')]=_0x2ce3b0['name'];this[_0xbf15('0x17')]=_0x2ce3b0['number'];this[_0xbf15('0x18')]=_0x2ce3b0[_0xbf15('0x18')];this[_0xbf15('0x19')]=_0x2ce3b0[_0xbf15('0x19')];this[_0xbf15('0x1a')]=moment()[_0xbf15('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbf15('0x1c')]=getSeconds(_0x2ce3b0['responsetime'],_0x2ce3b0['starttime']);this[_0xbf15('0x1d')]=0x0;this[_0xbf15('0x1e')]=getSeconds(this[_0xbf15('0x1a')],_0x2ce3b0[_0xbf15('0x19')]);this['queue']=_0x2ce3b0[_0xbf15('0xc')];this[_0xbf15('0x1f')]='IVR';this[_0xbf15('0x20')]=_0x394da3[_0xbf15('0x21')];this['callback']=_0x2ce3b0[_0xbf15('0x22')];this[_0xbf15('0x23')]=_0x2ce3b0[_0xbf15('0x23')];this[_0xbf15('0x24')]=_0x2ce3b0['callbackat'];this[_0xbf15('0x25')]=_0x2ce3b0[_0xbf15('0x25')];this[_0xbf15('0x26')]=_0x2ce3b0[_0xbf15('0x26')];this['ListId']=_0x2ce3b0['ListId'];this[_0xbf15('0x27')]=_0x2ce3b0[_0xbf15('0x27')];this[_0xbf15('0x28')]=_0x2ce3b0[_0xbf15('0x28')];this[_0xbf15('0x29')]=_0x2ce3b0[_0xbf15('0x29')];}module['exports']=Hangup; \ No newline at end of file +var _0xaeaa=['responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','queue','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','util','moment','milliseconds','seconds','state','statedesc','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime'];(function(_0x45d92f,_0x5c836d){var _0x5dc483=function(_0x2c544f){while(--_0x2c544f){_0x45d92f['push'](_0x45d92f['shift']());}};_0x5dc483(++_0x5c836d);}(_0xaeaa,0xad));var _0xaaea=function(_0x5ac5a7,_0x1aec90){_0x5ac5a7=_0x5ac5a7-0x0;var _0x5abde8=_0xaeaa[_0x5ac5a7];return _0x5abde8;};'use strict';var util=require(_0xaaea('0x0'));var _=require('lodash');var moment=require(_0xaaea('0x1'));function getSeconds(_0x224b34,_0x4e8a36){var _0x43c597=moment(_0x224b34)[_0xaaea('0x2')](0x0);var _0x5a9ec8=moment(_0x4e8a36)[_0xaaea('0x2')](0x0);return _0x43c597['diff'](_0x5a9ec8,_0xaaea('0x3'));}function Hangup(_0x1fe583,_0x490304){this[_0xaaea('0x4')]=0x4;this[_0xaaea('0x5')]='Answer';this[_0xaaea('0x6')]=_0x1fe583[_0xaaea('0x6')];this['type']=_0x1fe583[_0xaaea('0x7')];this[_0xaaea('0x8')]=_0x1fe583[_0xaaea('0x7')]==='outbound'?'queue':_0x1fe583[_0xaaea('0x7')];this['countbusyretry']=_0x1fe583[_0xaaea('0x9')];this[_0xaaea('0xa')]=_0x1fe583[_0xaaea('0xa')];this['countnoanswerretry']=_0x1fe583[_0xaaea('0xb')];this['countglobal']=_0x1fe583[_0xaaea('0x9')]+_0x1fe583['countcongestionretry']+_0x1fe583[_0xaaea('0xb')]+_0x1fe583[_0xaaea('0xc')]+_0x1fe583[_0xaaea('0xd')]+_0x1fe583['countabandonedretry']+_0x1fe583['countmachineretry']+_0x1fe583['countagentrejectretry'];this[_0xaaea('0xc')]=_0x1fe583['countnosuchnumberretry'];this[_0xaaea('0xd')]=_0x1fe583[_0xaaea('0xd')];this['countabandonedretry']=_0x1fe583[_0xaaea('0xe')];this['countmachineretry']=_0x1fe583[_0xaaea('0xf')];this[_0xaaea('0x10')]=_0x1fe583['countagentrejectretry'];this[_0xaaea('0x11')]=_0x490304[_0xaaea('0x11')];this['calleridname']=_0x1fe583[_0xaaea('0x12')];this[_0xaaea('0x13')]=_0x1fe583[_0xaaea('0x14')];this[_0xaaea('0x15')]=_0x1fe583[_0xaaea('0x15')];this[_0xaaea('0x16')]=_0x1fe583[_0xaaea('0x16')];this[_0xaaea('0x17')]=moment()['format'](_0xaaea('0x18'));this[_0xaaea('0x19')]=getSeconds(_0x1fe583[_0xaaea('0x16')],_0x1fe583['starttime']);this['holdtime']=0x0;this['talktime']=getSeconds(this[_0xaaea('0x17')],_0x1fe583[_0xaaea('0x16')]);this['queue']=_0x1fe583[_0xaaea('0x1a')];this[_0xaaea('0x1b')]=_0xaaea('0x1c');this['reason']=_0x490304[_0xaaea('0x1d')];this[_0xaaea('0x1e')]=_0x1fe583[_0xaaea('0x1e')];this[_0xaaea('0x1f')]=_0x1fe583[_0xaaea('0x1f')];this[_0xaaea('0x20')]=_0x1fe583['callbackat'];this[_0xaaea('0x21')]=_0x1fe583[_0xaaea('0x21')];this[_0xaaea('0x22')]=_0x1fe583['ContactId'];this[_0xaaea('0x23')]=_0x1fe583[_0xaaea('0x23')];this['UserId']=_0x1fe583['UserId'];this['VoiceQueueId']=_0x1fe583[_0xaaea('0x24')];this[_0xaaea('0x25')]=_0x1fe583[_0xaaea('0x25')];}module[_0xaaea('0x26')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 0fd03d6..0a78968 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 _0x337e=['countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','name','calleridnum','number','starttime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry'];(function(_0x163dd4,_0x1021c5){var _0x19cadd=function(_0x8d62a2){while(--_0x8d62a2){_0x163dd4['push'](_0x163dd4['shift']());}};_0x19cadd(++_0x1021c5);}(_0x337e,0x167));var _0xe337=function(_0x3b2035,_0x375ce8){_0x3b2035=_0x3b2035-0x0;var _0x161ca3=_0x337e[_0x3b2035];return _0x161ca3;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x5c659b,_0x163043){var _0x27e08d=moment(_0x5c659b)[_0xe337('0x0')](0x0);var _0x51285a=moment(_0x163043)[_0xe337('0x0')](0x0);return _0x27e08d['diff'](_0x51285a,_0xe337('0x1'));}function History(_0x1f1540){this[_0xe337('0x2')]=_0x1f1540['uniqueid'];this['scheduledat']=_0x1f1540[_0xe337('0x3')]||undefined;this[_0xe337('0x4')]=_0x1f1540[_0xe337('0x4')];this[_0xe337('0x5')]=_0x1f1540[_0xe337('0x4')]===_0xe337('0x6')?'queue':_0x1f1540['type'];this[_0xe337('0x7')]=_0x1f1540[_0xe337('0x7')];this['countcongestionretry']=_0x1f1540['countcongestionretry'];this[_0xe337('0x8')]=_0x1f1540[_0xe337('0x8')];this[_0xe337('0x9')]=_0x1f1540['countbusyretry']+_0x1f1540[_0xe337('0xa')]+_0x1f1540[_0xe337('0x8')]+_0x1f1540[_0xe337('0xb')]+_0x1f1540[_0xe337('0xc')]+_0x1f1540['countabandonedretry']+_0x1f1540[_0xe337('0xd')]+_0x1f1540[_0xe337('0xe')];this['countnosuchnumberretry']=_0x1f1540[_0xe337('0xb')];this[_0xe337('0xc')]=_0x1f1540['countdropretry'];this[_0xe337('0xf')]=_0x1f1540['countabandonedretry'];this['countmachineretry']=_0x1f1540[_0xe337('0xd')];this[_0xe337('0xe')]=_0x1f1540[_0xe337('0xe')];this[_0xe337('0x10')]=_0x1f1540[_0xe337('0x10')];this[_0xe337('0x11')]=_0x1f1540[_0xe337('0x12')];this[_0xe337('0x13')]=_0x1f1540[_0xe337('0x14')];this['starttime']=_0x1f1540[_0xe337('0x15')];this['responsetime']=_0x1f1540['responsetime'];this[_0xe337('0x16')]=_0x1f1540['responsetime'];this[_0xe337('0x17')]=getSeconds(_0x1f1540['responsetime'],_0x1f1540['starttime']);this[_0xe337('0x18')]=0x0;this[_0xe337('0x19')]=0x0;this[_0xe337('0x1a')]=_0x1f1540[_0xe337('0x1a')];this['callbackuniqueid']=_0x1f1540[_0xe337('0x1b')];this[_0xe337('0x1c')]=_0x1f1540[_0xe337('0x1c')];this[_0xe337('0x1d')]=_0x1f1540[_0xe337('0x1d')];this['ContactId']=_0x1f1540[_0xe337('0x1e')];this[_0xe337('0x1f')]=_0x1f1540[_0xe337('0x1f')];this[_0xe337('0x20')]=_0x1f1540[_0xe337('0x20')];this[_0xe337('0x21')]=_0x1f1540[_0xe337('0x21')];this[_0xe337('0x22')]=_0x1f1540['CampaignId'];this[_0xe337('0x23')]=_0x1f1540['originatecalleridnum']||'';this['originatecalleridname']=_0x1f1540[_0xe337('0x24')]||'';}module['exports']=History; \ No newline at end of file +var _0xb22a=['util','lodash','milliseconds','diff','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','name','calleridnum','number','responsetime','endtime','ringtime','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb22a,0x111));var _0xab22=function(_0x54defc,_0x627178){_0x54defc=_0x54defc-0x0;var _0x1955d3=_0xb22a[_0x54defc];return _0x1955d3;};'use strict';var util=require(_0xab22('0x0'));var _=require(_0xab22('0x1'));var moment=require('moment');function getSeconds(_0xd3c3b4,_0x5a0ecf){var _0x19c831=moment(_0xd3c3b4)[_0xab22('0x2')](0x0);var _0x9c5887=moment(_0x5a0ecf)[_0xab22('0x2')](0x0);return _0x19c831[_0xab22('0x3')](_0x9c5887,'seconds');}function History(_0xb7aeb5){this['uniqueid']=_0xb7aeb5[_0xab22('0x4')];this['scheduledat']=_0xb7aeb5['scheduledat']||undefined;this[_0xab22('0x5')]=_0xb7aeb5[_0xab22('0x5')];this[_0xab22('0x6')]=_0xb7aeb5['type']===_0xab22('0x7')?_0xab22('0x8'):_0xb7aeb5[_0xab22('0x5')];this[_0xab22('0x9')]=_0xb7aeb5[_0xab22('0x9')];this[_0xab22('0xa')]=_0xb7aeb5[_0xab22('0xa')];this[_0xab22('0xb')]=_0xb7aeb5[_0xab22('0xb')];this[_0xab22('0xc')]=_0xb7aeb5[_0xab22('0x9')]+_0xb7aeb5['countcongestionretry']+_0xb7aeb5[_0xab22('0xb')]+_0xb7aeb5['countnosuchnumberretry']+_0xb7aeb5['countdropretry']+_0xb7aeb5[_0xab22('0xd')]+_0xb7aeb5[_0xab22('0xe')]+_0xb7aeb5[_0xab22('0xf')];this[_0xab22('0x10')]=_0xb7aeb5[_0xab22('0x10')];this[_0xab22('0x11')]=_0xb7aeb5['countdropretry'];this['countabandonedretry']=_0xb7aeb5[_0xab22('0xd')];this[_0xab22('0xe')]=_0xb7aeb5[_0xab22('0xe')];this[_0xab22('0xf')]=_0xb7aeb5['countagentrejectretry'];this[_0xab22('0x8')]=_0xb7aeb5[_0xab22('0x8')];this[_0xab22('0x12')]=_0xb7aeb5[_0xab22('0x13')];this[_0xab22('0x14')]=_0xb7aeb5[_0xab22('0x15')];this['starttime']=_0xb7aeb5['starttime'];this['responsetime']=_0xb7aeb5[_0xab22('0x16')];this[_0xab22('0x17')]=_0xb7aeb5[_0xab22('0x16')];this[_0xab22('0x18')]=getSeconds(_0xb7aeb5[_0xab22('0x16')],_0xb7aeb5[_0xab22('0x19')]);this[_0xab22('0x1a')]=0x0;this[_0xab22('0x1b')]=0x0;this['callback']=_0xb7aeb5[_0xab22('0x1c')];this[_0xab22('0x1d')]=_0xb7aeb5[_0xab22('0x1d')];this[_0xab22('0x1e')]=_0xb7aeb5[_0xab22('0x1e')];this[_0xab22('0x1f')]=_0xb7aeb5[_0xab22('0x1f')];this[_0xab22('0x20')]=_0xb7aeb5[_0xab22('0x20')];this[_0xab22('0x21')]=_0xb7aeb5[_0xab22('0x21')];this['UserId']=_0xb7aeb5[_0xab22('0x22')];this['VoiceQueueId']=_0xb7aeb5[_0xab22('0x23')];this[_0xab22('0x24')]=_0xb7aeb5[_0xab22('0x24')];this['originatecalleridnum']=_0xb7aeb5[_0xab22('0x25')]||'';this['originatecalleridname']=_0xb7aeb5['originatecalleridname']||'';}module[_0xab22('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index e97d352..0e7dfd8 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 _0xcc73=['Error','stringify','milliseconds','seconds','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Hold\x20Time\x20is\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','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','diff','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','length','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','isNil','status','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','catch','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','temp','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','merge','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','Success','SIP/%s','reachable','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HangupInAMD','emit','custom:amd','buildObj','amd','MACHINE','statedesc','Machine','membername','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','stateGlobal','reason19\x20machine....','reason\x2019\x20machine....','dialMachineRetryFrequency','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HANGUP','AMD','[syncHangupInAMDIvr][createHistory]','countglobal','countabandonedretry','dialGlobalMaxRetry','createStateFinal','add','minutes','ivrAnswerCallsDay','[syncHangupIvr]','AnswerAGI','[syncHangupIvr][createHistory]','dialQueueProject','cause-txt','Unknow','reason','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','dropreason','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','interval','content','true','all','some','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','trim','dialCutDigit','substring','SIP/%s/%s%s','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','countcongestionretry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','Busy','custom:agentbusy','busy','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','Predictive\x20after\x20first\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','Contact.phone','checkContactBlack','[getContactDialer2]','tryOriginatePredictive','[countReScheduled]\x20','[actionOriginatePredictive]\x20','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','[busyFactor]','Umin\x20=\x20','exports','lodash','bluebird','md5','../preview/util/util','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','uniqueId','optionPredictive','startPredictive','queueBooked','queueBookedRR','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]'];(function(_0x4ef833,_0x86fcd){var _0x1a8e56=function(_0x2ebd28){while(--_0x2ebd28){_0x4ef833['push'](_0x4ef833['shift']());}};_0x1a8e56(++_0x86fcd);}(_0xcc73,0x1cb));var _0x3cc7=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xcc73[_0xbca1b1];return _0x4e1686;};'use strict';var util=require('util');var _=require(_0x3cc7('0x0'));var BPromise=require(_0x3cc7('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0x3cc7('0x2'));var Redis=require('ioredis');var ut=require(_0x3cc7('0x3'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0x3cc7('0x4'));var loggerBooked=require(_0x3cc7('0x5'))(_0x3cc7('0x6'));var loggerPredictive=require(_0x3cc7('0x5'))(_0x3cc7('0x7'));var loggerPredictiveCalls=require('../../../config/logger')(_0x3cc7('0x8'));var loggerSyncQueueSummary=require(_0x3cc7('0x5'))(_0x3cc7('0x9'));var ami=require(_0x3cc7('0xa'));config['redis']=_[_0x3cc7('0xb')](config[_0x3cc7('0xc')],{'host':_0x3cc7('0xd'),'port':0x18eb});var io=require(_0x3cc7('0xe'))(new Redis(config[_0x3cc7('0xc')]));var cmHopper=require(_0x3cc7('0xf'));var cmHopperHistory=require(_0x3cc7('0x10'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0x3cc7('0x11'));var History=require('./history');var Final=require(_0x3cc7('0x12'));var AgentComplete=require(_0x3cc7('0x13'));var QueueCallerAbandon=require(_0x3cc7('0x14'));var Hangup=require(_0x3cc7('0x15'));var ipAgi=process[_0x3cc7('0x16')][_0x3cc7('0x17')]||_0x3cc7('0x18');var strategy={'rrmemory':_0x3cc7('0x19'),'roundrobin':_0x3cc7('0x1a')};var Sequence=function(){};Sequence[_0x3cc7('0x1b')][_0x3cc7('0x1c')]=function(_0x129d5b){this[_0x3cc7('0x1d')]=this[_0x3cc7('0x1d')]?this[_0x3cc7('0x1d')][_0x3cc7('0x1e')](_0x129d5b):_0x129d5b();};function Dialer(_0x2c4688,_0x1320a8){this[_0x3cc7('0x1f')]=new Sequence();this[_0x3cc7('0x20')]=_0x1320a8;this[_0x3cc7('0x21')]=_0x2c4688[_0x3cc7('0x21')];this[_0x3cc7('0x22')]=_0x2c4688[_0x3cc7('0x22')];this[_0x3cc7('0x23')]=_0x2c4688[_0x3cc7('0x23')];this[_0x3cc7('0x24')]=_0x2c4688[_0x3cc7('0x24')];this[_0x3cc7('0x25')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x3cc7('0x26')]={};this['contactsId']={};this[_0x3cc7('0x27')]={};this[_0x3cc7('0x28')]={};this[_0x3cc7('0x29')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0x3cc7('0x2a')]={};this[_0x3cc7('0x2b')]={};ami['on']('agentconnect',this[_0x3cc7('0x2c')][_0x3cc7('0x2d')](this));ami['on']('queuecallerabandon',this[_0x3cc7('0x2e')]['bind'](this));ami['on'](_0x3cc7('0x2f'),this['syncOriginateResponse'][_0x3cc7('0x2d')](this));ami['on'](_0x3cc7('0x30'),this[_0x3cc7('0x31')][_0x3cc7('0x2d')](this));ami['on'](_0x3cc7('0x32'),this[_0x3cc7('0x9')]['bind'](this));ami['on'](_0x3cc7('0x33'),this[_0x3cc7('0x34')][_0x3cc7('0x2d')](this));ami['on']('newexten',this[_0x3cc7('0x35')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0x3cc7('0x2d')](this));ami['on'](_0x3cc7('0x36'),this['syncQueueMember'][_0x3cc7('0x2d')](this));ami['on'](_0x3cc7('0x37'),this[_0x3cc7('0x38')][_0x3cc7('0x2d')](this));this[_0x3cc7('0x39')]();this[_0x3cc7('0x3a')]();}function isNotNull(_0x3af533){return _0x3af533!==null&&!_[_0x3cc7('0x3b')](_0x3af533);}function checkIsLoggedIn(_0x3a5d5b,_0x30ccb6){return function(){if(_0x30ccb6<=0x0){_0x3a5d5b[_0x3cc7('0x3c')]=_0x3cc7('0x3d');throw _0x3a5d5b[_0x3cc7('0x3e')]+_0x3cc7('0x3f');}};}function isActive(_0x160474){return _0x160474;}function checkIsActive(_0x4fb94d,_0xbd633e){return function(){if(!isActive(_0xbd633e)){_0x4fb94d['message']='NOT_ACTIVE';throw _0x4fb94d['name']+_0x3cc7('0x40');}};}function checkInterval(_0x71cfb7){return function(){if(!isNotNull(_0x71cfb7[_0x3cc7('0x41')])){_0x71cfb7[_0x3cc7('0x3c')]=_0x3cc7('0x42');throw _0x71cfb7[_0x3cc7('0x3e')]+_0x3cc7('0x43');}if(!isNotNull(_0x71cfb7[_0x3cc7('0x41')][_0x3cc7('0x44')])){_0x71cfb7[_0x3cc7('0x3c')]=_0x3cc7('0x42');throw _0x71cfb7['name']+_0x3cc7('0x43');}if(!isNotNull(_[_0x3cc7('0x45')](_0x71cfb7[_0x3cc7('0x41')]['Intervals']))){_0x71cfb7['message']=_0x3cc7('0x42');throw _0x71cfb7[_0x3cc7('0x3e')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x3d0230,_0x4b89af,_0x297c19){return{'action':_0x3d0230,'response':_0x4b89af,'message':_0x297c19,'stack':_0x297c19};}function myreject(_0x202cc8){return function(_0x51fdc3){return _0x202cc8(msgResponse(_0x3cc7('0x46'),_0x3cc7('0x47'),JSON[_0x3cc7('0x48')](_0x51fdc3)));};}function getSeconds(_0x17576b,_0x428ad2){var _0x1638c7=moment(_0x17576b)['milliseconds'](0x0);var _0x265c25=moment(_0x428ad2)[_0x3cc7('0x49')](0x0);return _0x1638c7['diff'](_0x265c25,_0x3cc7('0x4a'));}function emit(_0x1b0a1f,_0x538cfe,_0x3abeda){io['to'](_0x1b0a1f)['emit'](_0x538cfe,_0x3abeda);}function emitVoiceQueueSummary(_0x16e66a){if(_0x16e66a[_0x3cc7('0x4b')]===_0x3cc7('0x4c')){var _0x2745de={'id':_0x16e66a['id'],'name':_0x16e66a[_0x3cc7('0x3e')],'strategy':_0x16e66a[_0x3cc7('0x4d')],'answered':_0x16e66a[_0x3cc7('0x4e')],'available':_0x16e66a[_0x3cc7('0x4f')],'loggedIn':_0x16e66a[_0x3cc7('0x50')],'pTalking':_0x16e66a[_0x3cc7('0x51')],'sumBillable':_0x16e66a[_0x3cc7('0x52')],'sumDuration':_0x16e66a[_0x3cc7('0x53')],'sumHoldTime':_0x16e66a['sumHoldTime']||0x0,'talking':_0x16e66a[_0x3cc7('0x54')],'total':_0x16e66a[_0x3cc7('0x55')],'type':_0x16e66a[_0x3cc7('0x4b')],'unmanaged':_0x16e66a[_0x3cc7('0x56')],'abandoned':_0x16e66a[_0x3cc7('0x57')],'waiting':_0x16e66a[_0x3cc7('0x58')],'loggedInDb':_0x16e66a[_0x3cc7('0x59')],'dialActive':_0x16e66a[_0x3cc7('0x5a')],'dialMethod':_0x16e66a[_0x3cc7('0x5b')],'dialOriginateCallerIdName':_0x16e66a[_0x3cc7('0x5c')],'dialOriginateCallerIdNumber':_0x16e66a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x16e66a[_0x3cc7('0x5d')],'dialPrefix':_0x16e66a[_0x3cc7('0x5e')],'outboundAnswerAgiCallsDay':_0x16e66a[_0x3cc7('0x5f')],'outboundAnswerCallsDay':_0x16e66a[_0x3cc7('0x60')],'outboundBlacklistCallsDay':_0x16e66a[_0x3cc7('0x61')],'outboundBusyCallsDay':_0x16e66a[_0x3cc7('0x62')],'outboundCongestionCallsDay':_0x16e66a[_0x3cc7('0x63')],'outboundDropCallsDayACS':_0x16e66a['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x16e66a[_0x3cc7('0x64')],'outboundDropCallsDayTimeout':_0x16e66a[_0x3cc7('0x65')],'outboundNoAnswerCallsDay':_0x16e66a[_0x3cc7('0x66')],'outboundNoSuchCallsDay':_0x16e66a[_0x3cc7('0x67')],'outboundOriginateFailureCallsDay':_0x16e66a[_0x3cc7('0x68')],'outboundReCallsDay':_0x16e66a[_0x3cc7('0x69')],'outboundRejectCallsDay':_0x16e66a[_0x3cc7('0x6a')],'outboundUnknownCallsDay':_0x16e66a[_0x3cc7('0x6b')],'predictiveIntervalAnsweredCalls':_0x16e66a['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x16e66a[_0x3cc7('0x6c')],'predictiveIntervalAvgTalktime':_0x16e66a[_0x3cc7('0x6d')],'predictiveIntervalDroppedCallsCallersExit':_0x16e66a['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x16e66a[_0x3cc7('0x6e')],'predictiveIntervalErlangCalls':_0x16e66a[_0x3cc7('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x16e66a[_0x3cc7('0x70')],'predictiveIntervalHitRate':_0x16e66a[_0x3cc7('0x71')],'predictiveIntervalMultiplicativeFactor':_0x16e66a[_0x3cc7('0x72')],'predictiveIntervalPauses':_0x16e66a[_0x3cc7('0x73')],'predictiveIntervalAvailable':_0x16e66a[_0x3cc7('0x74')],'predictiveIntervalTotalCalls':_0x16e66a[_0x3cc7('0x75')],'message':_0x16e66a[_0x3cc7('0x3c')],'originated':_0x16e66a[_0x3cc7('0x76')],'erlangCalls':_0x16e66a[_0x3cc7('0x77')],'erlangCallToSecond':_0x16e66a[_0x3cc7('0x78')],'erlangAbandonmentRate':_0x16e66a[_0x3cc7('0x79')],'erlangBusyFactor':_0x16e66a[_0x3cc7('0x7a')],'startPredictive':_0x16e66a[_0x3cc7('0x29')],'startProgressive':_0x16e66a[_0x3cc7('0x7b')]};if(_0x16e66a['Trunk']){_0x2745de[_0x3cc7('0x7c')]={'id':_0x16e66a[_0x3cc7('0x7c')]['id'],'name':_0x16e66a[_0x3cc7('0x7c')][_0x3cc7('0x3e')],'active':_0x16e66a['Trunk'][_0x3cc7('0x7d')],'callerid':_0x16e66a[_0x3cc7('0x7c')]['callerid']};}if(_0x16e66a[_0x3cc7('0x41')]){_0x2745de[_0x3cc7('0x41')]={'id':_0x16e66a[_0x3cc7('0x41')]['id'],'name':_0x16e66a[_0x3cc7('0x41')][_0x3cc7('0x3e')]};}var _0x51e747=md5(JSON[_0x3cc7('0x48')](_0x2745de));if(_0x16e66a['md5']!==_0x51e747){_0x16e66a[_0x3cc7('0x2')]=_0x51e747;emit(util[_0x3cc7('0x7e')](_0x3cc7('0x7f'),_0x2745de[_0x3cc7('0x3e')]),_0x3cc7('0x80'),_0x2745de);}}}function emitCampaignSummary(_0x5ca9d7){if(_0x5ca9d7[_0x3cc7('0x4b')]===_0x3cc7('0x81')){emit(util[_0x3cc7('0x7e')](_0x3cc7('0x82'),_0x5ca9d7[_0x3cc7('0x3e')]),'campaign:save',_0x5ca9d7);}}function checkGetDataPredictive(_0x1d6c73){if(isNotNull(_0x1d6c73)&&!_[_0x3cc7('0x45')](_0x1d6c73)){loggerPredictive[_0x3cc7('0x83')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x3cc7('0x83')](_0x3cc7('0x84'),_0x1d6c73[_0x3cc7('0x75')]);loggerPredictive[_0x3cc7('0x83')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1d6c73[_0x3cc7('0x85')]);loggerPredictive[_0x3cc7('0x83')](_0x3cc7('0x86'),_0x1d6c73[_0x3cc7('0x6e')]);loggerPredictive[_0x3cc7('0x83')](_0x3cc7('0x87'),_0x1d6c73[_0x3cc7('0x88')]);loggerPredictive[_0x3cc7('0x83')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1d6c73['predictiveIntervalAvgHoldtime']);loggerPredictive['info'](_0x3cc7('0x89'),_0x1d6c73['predictiveIntervalAvgTalktime']);loggerPredictive[_0x3cc7('0x83')](_0x3cc7('0x8a'));if(_0x1d6c73[_0x3cc7('0x75')]>0x0){if(!_[_0x3cc7('0x3b')](_0x1d6c73[_0x3cc7('0x6d')])&&_0x1d6c73[_0x3cc7('0x6d')]>0x0){return!![];}loggerPredictive[_0x3cc7('0x83')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x3cc7('0x3b')](_0x1d6c73['predictiveIntervalAvgHoldtime'])&&_0x1d6c73['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x3cc7('0x83')](_0x3cc7('0x8b'));}else{loggerPredictive[_0x3cc7('0x83')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x3cc7('0x83')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x59fcc4){return function(_0xa1fed6){loggerPredictive[_0x3cc7('0x83')](_0x3cc7('0x8c'));loggerPredictive[_0x3cc7('0x83')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xa1fed6[_0x3cc7('0x77')]);loggerPredictive[_0x3cc7('0x83')](_0x3cc7('0x8d'),_0xa1fed6[_0x3cc7('0x78')]);loggerPredictive['info'](_0x3cc7('0x8e'),_0xa1fed6[_0x3cc7('0x79')]);loggerPredictive[_0x3cc7('0x83')](_0x3cc7('0x8f'),_0xa1fed6[_0x3cc7('0x7a')]);loggerPredictive[_0x3cc7('0x83')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xa1fed6['erlangAbandonmentRate']);loggerPredictive[_0x3cc7('0x83')]('---------------------------');_['merge'](_0x59fcc4,_0xa1fed6);};}function getDiff(_0xcafdb5){var _0x30c69f=moment()[_0x3cc7('0x49')](0x0);var _0x43ed96=moment(_0xcafdb5)[_0x3cc7('0x49')](0x0);return _0x30c69f[_0x3cc7('0x90')](_0x43ed96,_0x3cc7('0x4a'));}function ifInterval(_0x17eea9,_0x1a5b93){if(_['isUndefined'](_0x1a5b93)){return![];}return getDiff(_0x1a5b93)<_0x17eea9*0x3c;}function freeVariablesPredictive(_0x6e0b1f){if(isNotNull(_0x6e0b1f)){if(!_[_0x3cc7('0x3b')](_0x6e0b1f[_0x3cc7('0x7b')])){_0x6e0b1f[_0x3cc7('0x7b')]=undefined;loggerPredictive['info'](_0x6e0b1f[_0x3cc7('0x3e')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0x3cc7('0x3b')](_0x6e0b1f['startPredictive'])){_0x6e0b1f[_0x3cc7('0x29')]=undefined;loggerPredictive[_0x3cc7('0x83')](_0x6e0b1f[_0x3cc7('0x3e')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x3cc7('0x3b')](_0x6e0b1f[_0x3cc7('0x91')])){clearInterval(_0x6e0b1f['handlePredictive']);_0x6e0b1f[_0x3cc7('0x91')]=undefined;loggerPredictive[_0x3cc7('0x83')](_0x6e0b1f[_0x3cc7('0x3e')],_0x3cc7('0x92'));}}}function erlangb(_0x4bdf87,_0x565917){if(_0x565917===0x0){return 0x0;}var _0x550220=0x1;for(var _0x3e930e=0x1;_0x3e930e<=_0x565917;_0x3e930e+=0x1){_0x550220=0x1+_0x550220*_0x3e930e/_0x4bdf87;}return 0x1/_0x550220;}function isVoiceQueueOutbound(_0x2fb030){return _0x2fb030===_0x3cc7('0x4c');}function isNotPreview(_0x205a8a){return _0x205a8a!==_0x3cc7('0x20');}function isCampaignIvr(_0x367940){return _0x367940===_0x3cc7('0x81');}function getCallerId(_0x220dfc,_0x5dff51,_0x1be864){if(!_[_0x3cc7('0x3b')](_0x1be864)&&typeof _0x1be864===_0x3cc7('0x93')&&!_[_0x3cc7('0x45')](_0x1be864)){if(!_[_0x3cc7('0x3b')](_0x5dff51)&&typeof _0x5dff51===_0x3cc7('0x93')&&!_[_0x3cc7('0x45')](_0x5dff51)){return util['format'](_0x3cc7('0x94'),_0x5dff51,_0x1be864);}return util[_0x3cc7('0x7e')]('\x22%s\x22\x20<%s>',_0x1be864,_0x1be864);}if(!_[_0x3cc7('0x3b')](_0x220dfc)&&typeof _0x220dfc==='string'&&!_[_0x3cc7('0x45')](_0x220dfc)){return _0x220dfc;}return _0x3cc7('0x95');}function loggerCatchQueueSummary(_0x440584,_0x536a65){return function(_0x16865b){freeVariablesPredictive(_0x536a65);emitVoiceQueueSummary(_0x536a65);emitCampaignSummary(_0x536a65);loggerSyncQueueSummary['error'](_0x440584,util[_0x3cc7('0x96')](_0x16865b,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2c7b4d,_0x5c388c){return function(_0x44e908){loggerPredictive[_0x3cc7('0x97')](_0x5c388c[_0x3cc7('0x3e')],_0x2c7b4d);loggerPredictive['error'](_0x44e908['stack']);freeVariablesPredictive(_0x5c388c);};}function loggerCatch(_0xabdab7){return function(_0x3c39ee){logger['error'](_0xabdab7,util[_0x3cc7('0x96')](_0x3c39ee,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x50d2a3){return _0x50d2a3&&!_[_0x3cc7('0x3b')](_0x50d2a3)&&_0x50d2a3[_0x3cc7('0x98')]>0x0;}function decremetOriginate(_0x53f623){if(!_[_0x3cc7('0x3b')](_0x53f623)&&_0x53f623!==null){if(typeof _0x53f623['originated']!==_0x3cc7('0x99')){if(_0x53f623[_0x3cc7('0x76')]>0x0){_0x53f623[_0x3cc7('0x76')]-=0x1;}else{logger[_0x3cc7('0x97')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x3cc7('0x97')](_0x3cc7('0x9a'));}}function checkContactLowerLimitOriginate(_0x3462c0,_0x1b4fc0,_0x2ccfbd){if(_0x1b4fc0>_0x2ccfbd){for(var _0x24b29d=0x0;_0x24b29d<_0x1b4fc0-_0x2ccfbd;_0x24b29d+=0x1){decremetOriginate(_0x3462c0);}}}function loggerGetContactDialer(_0x132b84,_0x41e69d,_0x2a0565){return function(_0x1fcdca){checkContactLowerLimitOriginate(_0x41e69d,_0x2a0565,0x0);logger['error'](_0x132b84,util[_0x3cc7('0x96')](_0x1fcdca,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x272292){return function(_0x200d86){if(isNotNull(_0x200d86)&&isNotNull(_0x200d86[0x0])){if(_0x200d86[0x0][_0x3cc7('0x9b')]>0x0){_0x272292[_0x3cc7('0x3c')]=_0x3cc7('0x9c');logger[_0x3cc7('0x83')]('[getContactDialer2][ReScheduled]'+_0x272292[_0x3cc7('0x3e')],_0x200d86[0x0][_0x3cc7('0x9b')],_0x3cc7('0x9d'));}else{_0x272292[_0x3cc7('0x3c')]=_0x3cc7('0x9e');logger[_0x3cc7('0x83')](_0x3cc7('0x9f')+_0x272292[_0x3cc7('0x3e')]);}}};}function notSendMessagesQueue(_0x59a17e){if(_0x59a17e['sendMessageOneNotActive']){freeVariablesPredictive(_0x59a17e);if(_0x59a17e['originated']===0x0&&_0x59a17e['talking']===0x0&&_0x59a17e['waiting']===0x0&&(_0x59a17e[_0x3cc7('0x51')]||0x0)===0x0){_0x59a17e[_0x3cc7('0xa0')]=![];_0x59a17e[_0x3cc7('0x4f')]=0x0;_0x59a17e[_0x3cc7('0x3c')]=_0x3cc7('0xa1');loggerSyncQueueSummary[_0x3cc7('0x97')](_0x3cc7('0xa2'),_0x59a17e['name'],_0x3cc7('0xa3'));}else{_0x59a17e[_0x3cc7('0x3c')]=_0x3cc7('0xa4');loggerSyncQueueSummary[_0x3cc7('0x97')](_0x3cc7('0xa2'),_0x59a17e[_0x3cc7('0x3e')],'is\x20disactive');}emitVoiceQueueSummary(_0x59a17e);}}function notSendMessagesCampaign(_0x37c815){if(_0x37c815[_0x3cc7('0xa0')]){if(_0x37c815[_0x3cc7('0x76')]===0x0){_0x37c815[_0x3cc7('0xa0')]=![];_0x37c815['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x3cc7('0x97')](_0x3cc7('0xa5'),_0x37c815[_0x3cc7('0x3e')],'is\x20not\x20active');}else{_0x37c815[_0x3cc7('0x3c')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x3cc7('0x97')](_0x3cc7('0xa5'),_0x37c815['name'],_0x3cc7('0xa6'));}emitCampaignSummary(_0x37c815);}}function createObjHistory(_0x33009b,_0xd70442,_0x3bb79f,_0x16d91a,_0x6810f1){_0x33009b[_0x3cc7('0x3c')]=_0x3bb79f;var _0x1529b9=new Action(_0x33009b,_0xd70442);var _0x587a5c=new History(_0x1529b9);_0x587a5c[_0x3cc7('0xa7')]=_0x16d91a;_0x587a5c['statedesc']=_0x6810f1;_0x587a5c[_0x3cc7('0xa8')]=_0x1529b9[_0x3cc7('0xa9')];return _0x587a5c;}Dialer[_0x3cc7('0x1b')][_0x3cc7('0x3a')]=function(){var _0xb50e05=this;setInterval(function(){_0xb50e05[_0x3cc7('0xaa')](_0xb50e05['uniqueId'],_0x3cc7('0xab'));_0xb50e05[_0x3cc7('0xaa')](_0xb50e05[_0x3cc7('0x26')],_0x3cc7('0xac'));},0x32c8);};Dialer['prototype'][_0x3cc7('0xaa')]=function(_0x2ec8ca,_0x43c8a7){var _0x3d981d=this;for(var _0x506098 in _0x2ec8ca){if(typeof _0x2ec8ca[_0x506098]!==_0x3cc7('0x99')){this[_0x3cc7('0x1f')]['enqueue'](function(){if(!_[_0x3cc7('0xad')](_0x2ec8ca[_0x506098])){return ami['Action']({'action':_0x3cc7('0xae'),'channel':_0x2ec8ca[_0x506098][_0x3cc7('0xaf')]})['catch'](function(_0x5a43dd){if(_0x5a43dd[_0x3cc7('0x3c')]===_0x3cc7('0xb0')){setTimeout(function(){if(_0x2ec8ca[_0x506098]&&_0x2ec8ca[_0x506098][_0x3cc7('0x4b')]!=='ivr'){_0x3d981d[_0x3cc7('0xb1')](_0x3d981d[_0x3cc7('0x21')][_0x2ec8ca[_0x506098]['queue']]);logger[_0x3cc7('0x97')]('[Dialer][checkChannel]',_0x43c8a7,_0x506098,_0x2ec8ca[_0x506098][_0x3cc7('0xb2')]);delete _0x2ec8ca[_0x506098];}if(_0x2ec8ca[_0x506098]&&_0x2ec8ca[_0x506098]['type']==='ivr'){_0x3d981d['updateOriginated'](_0x3d981d['campaigns'][_0x2ec8ca[_0x506098]['queue']]);logger[_0x3cc7('0x97')](_0x3cc7('0xb3'),_0x43c8a7,_0x506098,_0x2ec8ca[_0x506098][_0x3cc7('0xb2')]);delete _0x2ec8ca[_0x506098];}},0x2328);}});}});}}};Dialer[_0x3cc7('0x1b')][_0x3cc7('0xb4')]=function(_0xaa287c){return BPromise[_0x3cc7('0xb5')]()[_0x3cc7('0xb6')](cmHopper[_0x3cc7('0xb4')](_0xaa287c))[_0x3cc7('0xb7')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0x3cc7('0x1b')]['checkIsBlackList']=function(_0x14aa0e){return BPromise['resolve']()['then'](cmHopperBlack[_0x3cc7('0xb8')](_0x14aa0e))['catch'](loggerCatch(_0x3cc7('0xb9')));};Dialer[_0x3cc7('0x1b')][_0x3cc7('0xba')]=function(_0x32c044){return BPromise[_0x3cc7('0xb5')]()[_0x3cc7('0xb6')](cmHopperBlack[_0x3cc7('0xba')](_0x32c044))['catch'](loggerCatch(_0x3cc7('0xbb')));};Dialer[_0x3cc7('0x1b')][_0x3cc7('0xbc')]=function(_0x7fabd5){return BPromise[_0x3cc7('0xb5')]()[_0x3cc7('0xb6')](cmHopperHistory['avgHandleTime'](_0x7fabd5))['catch'](loggerCatch(_0x3cc7('0xbd')));};Dialer[_0x3cc7('0x1b')][_0x3cc7('0xbe')]=function(_0xabd8f){return BPromise[_0x3cc7('0xb5')]()[_0x3cc7('0xb6')](cmHopper[_0x3cc7('0xbe')](_0xabd8f))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype'][_0x3cc7('0xbf')]=function(_0x350f79,_0x189e9f,_0x44cb05){return BPromise[_0x3cc7('0xb5')]()['then'](cmHopper[_0x3cc7('0xbf')](_0x350f79,_0x189e9f,_0x44cb05))['catch'](loggerCatch(_0x3cc7('0xc0')));};Dialer[_0x3cc7('0x1b')][_0x3cc7('0xc1')]=function(_0x30e1fd,_0x46973a,_0x1b06d4,_0x54bf8d,_0x19ff9b){return BPromise[_0x3cc7('0xb5')]()[_0x3cc7('0xb6')](cmHopper[_0x3cc7('0xc1')](_0x30e1fd,_0x46973a,_0x1b06d4,_0x54bf8d))[_0x3cc7('0xb7')](function(_0x90e21e){_0x19ff9b[_0x3cc7('0xc2')]-=_0x1b06d4;_0x19ff9b['temp']=_0x19ff9b[_0x3cc7('0xc2')]>0x0?_0x19ff9b['temp']:0x0;loggerCatch('[getContactDialer]\x20')(_0x90e21e);});};Dialer[_0x3cc7('0x1b')][_0x3cc7('0xc3')]=function(_0xa65138,_0x3ab25b,_0x115e84,_0x33f7b6){return BPromise[_0x3cc7('0xb5')]()[_0x3cc7('0xb6')](cmHopper[_0x3cc7('0xc3')](_0xa65138,_0x3ab25b,_0x115e84))[_0x3cc7('0xb7')](function(_0x8d531f){_0x33f7b6[_0x3cc7('0xc2')]-=_0x3ab25b;_0x33f7b6[_0x3cc7('0xc2')]=_0x33f7b6['temp']>0x0?_0x33f7b6[_0x3cc7('0xc2')]:0x0;loggerCatch(_0x3cc7('0xc4'))(_0x8d531f);});};Dialer['prototype'][_0x3cc7('0xc5')]=function(_0x592b2a){return BPromise['resolve']()[_0x3cc7('0xb6')](voiceQueueRt[_0x3cc7('0xc5')](_0x592b2a))[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0xc6')));};Dialer['prototype'][_0x3cc7('0xc7')]=function(_0x5d97a1){return BPromise['resolve']()['then'](cmHopper['moveContactManagedDialer'](_0x5d97a1))[_0x3cc7('0xb7')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0x3cc7('0x1b')]['createHistory']=function(_0x2c9a7f){return BPromise['resolve']()['then'](cmHopperHistory[_0x3cc7('0xc8')](_0x2c9a7f))[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0xc9')));};Dialer[_0x3cc7('0x1b')][_0x3cc7('0xb1')]=function(_0xee1f0d){if(!_[_0x3cc7('0x3b')](_0xee1f0d)&&_0xee1f0d!==null){if(typeof _0xee1f0d['originated']!==_0x3cc7('0x99')){if(_0xee1f0d['originated']>0x0){_0xee1f0d[_0x3cc7('0x76')]-=0x1;}else{logger[_0x3cc7('0x97')](_0x3cc7('0xca'));}}}else{logger[_0x3cc7('0x97')](_0x3cc7('0xcb'));}};Dialer[_0x3cc7('0x1b')][_0x3cc7('0xcc')]=function(_0x3075ce,_0x22fbc6){var _0x4d7d09=this;return function(_0xe2b44f){_0x4d7d09['updateOriginated'](_0x22fbc6);logger[_0x3cc7('0x97')](_0x3075ce,util[_0x3cc7('0x96')](_0xe2b44f,{'showHidden':![],'depth':null}));};};Dialer[_0x3cc7('0x1b')][_0x3cc7('0xcd')]=function(_0x3bc4e2,_0x5024e0,_0x2d76d7){var _0x1ddd1a={'state':0x19,'statedesc':'notFound'};this[_0x3cc7('0xb1')](_0x5024e0);this[_0x3cc7('0xce')](_[_0x3cc7('0xcf')](_0x1ddd1a,_['pick'](_0x2d76d7,[_0x3cc7('0xd0'),_0x3cc7('0xd1'),_0x3cc7('0xd2'),_0x3cc7('0xd3'),_0x3cc7('0xd4')])),_0x3cc7('0xd5'),'[emptyContact]');logger['error'](_0x3bc4e2);};Dialer[_0x3cc7('0x1b')]['isSuccess']=function(_0x5b8064){return _0x5b8064===_0x3cc7('0xd6');};Dialer[_0x3cc7('0x1b')]['isTrunkReachable']=function(_0x8b7117){return!_[_0x3cc7('0x3b')](_0x8b7117)&&_0x8b7117&&!_[_0x3cc7('0x3b')](_0x8b7117[_0x3cc7('0x3e')])&&!_[_0x3cc7('0x3b')](_0x8b7117[_0x3cc7('0x7d')])&&_0x8b7117['active']&&(this[_0x3cc7('0x24')][util['format'](_0x3cc7('0xd7'),_0x8b7117[_0x3cc7('0x3e')])][_0x3cc7('0xae')]===_0x3cc7('0xd8')||this['trunks'][util[_0x3cc7('0x7e')](_0x3cc7('0xd7'),_0x8b7117[_0x3cc7('0x3e')])]['status']==='unmonitored');};Dialer['prototype'][_0x3cc7('0xce')]=function(_0x3ee376,_0x5380e9,_0x1f2a4f){this['createHistory'](_0x3ee376)[_0x3cc7('0xb7')](loggerCatch(_0x5380e9));this['moveContactManagedDialer'](_0x3ee376)[_0x3cc7('0xb7')](loggerCatch(_0x1f2a4f));};Dialer[_0x3cc7('0x1b')][_0x3cc7('0xd9')]=function(_0x75ac33){var _0x4e0ce5=this[_0x3cc7('0x27')][_0x75ac33[_0x3cc7('0xda')]];var _0x56b0c2;if(!_[_0x3cc7('0xad')](_0x75ac33)&&!_['isNil'](_0x75ac33[_0x3cc7('0xdb')])&&!_[_0x3cc7('0xad')](_0x75ac33[_0x3cc7('0xdb')][_0x3cc7('0xdc')])&&_0x75ac33[_0x3cc7('0xdd')]===_0x3cc7('0xde')&&_0x4e0ce5){if(_0x4e0ce5[_0x3cc7('0x4b')]!==_0x3cc7('0x81')&&this[_0x3cc7('0x21')][_0x4e0ce5[_0x3cc7('0xb2')]][_0x3cc7('0xdf')]&&_0x75ac33[_0x3cc7('0xe0')]==='HANGUP'){delete this[_0x3cc7('0x27')][_0x75ac33[_0x3cc7('0xda')]];this[_0x3cc7('0xb1')](this[_0x3cc7('0x21')][_0x4e0ce5[_0x3cc7('0xb2')]]);this['voiceQueues'][_0x4e0ce5[_0x3cc7('0xb2')]][_0x3cc7('0x60')]+=0x1;this['voiceQueues'][_0x4e0ce5[_0x3cc7('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;_0x56b0c2=new Hangup(_0x4e0ce5,_0x75ac33);_0x56b0c2['state']=0x12;_0x56b0c2['statedesc']=_0x3cc7('0xe1');_0x56b0c2['membername']='AMD';ami[_0x3cc7('0xe2')](_0x3cc7('0xe3'),ut[_0x3cc7('0xe4')](_0x56b0c2,_0x3cc7('0xe5')));this[_0x3cc7('0xce')](_0x56b0c2,'[syncHangupInAMD][createHistory]','[syncHangupInAMD]');}if(_0x4e0ce5['type']!==_0x3cc7('0x81')&&this[_0x3cc7('0x21')][_0x4e0ce5['queue']][_0x3cc7('0xdf')]&&_0x75ac33[_0x3cc7('0xe0')]===_0x3cc7('0xe6')){var _0x43109b=this;return new BPromise(function(_0x4afb6e,_0x379dfc){delete _0x43109b[_0x3cc7('0x27')][_0x75ac33[_0x3cc7('0xda')]];_0x43109b[_0x3cc7('0xb1')](_0x43109b['voiceQueues'][_0x4e0ce5[_0x3cc7('0xb2')]]);_0x43109b[_0x3cc7('0x21')][_0x4e0ce5[_0x3cc7('0xb2')]][_0x3cc7('0x60')]+=0x1;_0x43109b[_0x3cc7('0x21')][_0x4e0ce5[_0x3cc7('0xb2')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x225c8c=_0x43109b[_0x3cc7('0x21')][_0x4e0ce5[_0x3cc7('0xb2')]];var _0x29a358=new Hangup(_0x4e0ce5,_0x75ac33);_0x29a358[_0x3cc7('0xa7')]=0x13;_0x29a358[_0x3cc7('0xe7')]=_0x3cc7('0xe8');_0x29a358[_0x3cc7('0xe9')]='AMD';_0x29a358[_0x3cc7('0xea')]+=0x1;_0x29a358['countglobal']+=0x1;_0x29a358[_0x3cc7('0xe5')]=!![];ami[_0x3cc7('0xe2')]('custom:amd',ut[_0x3cc7('0xe4')](_0x29a358,'amd'));_0x43109b[_0x3cc7('0xc8')](_0x29a358)[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0xeb')));if(_0x29a358[_0x3cc7('0xec')]+_0x29a358['countcongestionretry']+_0x29a358[_0x3cc7('0xed')]+_0x29a358[_0x3cc7('0xee')]+_0x29a358[_0x3cc7('0xef')]+_0x29a358['countabandonedretry']+_0x29a358[_0x3cc7('0xea')]+_0x29a358[_0x3cc7('0xf0')]>=_0x225c8c['dialGlobalMaxRetry']){_0x43109b[_0x3cc7('0xf1')](_0x29a358,_0x4afb6e,_0x379dfc,_0x3cc7('0xf2'));}else{if(_0x29a358[_0x3cc7('0xea')]>=_0x225c8c['dialMachineMaxRetry']){_0x43109b['createStateFinal'](_0x29a358,_0x4afb6e,_0x379dfc,_0x3cc7('0xf3'));}else{_0x43109b[_0x3cc7('0xbe')]({'active':![],'countmachineretry':_0x29a358[_0x3cc7('0xea')],'scheduledat':moment()['add'](_0x225c8c[_0x3cc7('0xf4')],'minutes')[_0x3cc7('0x7e')](_0x3cc7('0xf5')),'ContactId':_0x29a358[_0x3cc7('0xd0')],'ListId':_0x29a358[_0x3cc7('0xd1')],'VoiceQueueId':_0x29a358[_0x3cc7('0xd3')]||undefined,'CampaignId':_0x29a358[_0x3cc7('0xd4')]||undefined})[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0xf6')));_0x4afb6e({'reschedule':0x1});}}});}if(_0x4e0ce5['type']==='ivr'&&this['campaigns'][_0x4e0ce5[_0x3cc7('0xb2')]]['dialAMDActive']&&_0x75ac33[_0x3cc7('0xe0')]===_0x3cc7('0xf7')){delete this[_0x3cc7('0x27')][_0x75ac33['uniqueid']];this[_0x3cc7('0xb1')](this[_0x3cc7('0x22')][_0x4e0ce5[_0x3cc7('0xb2')]]);_0x56b0c2=new Hangup(_0x4e0ce5,_0x75ac33);_0x56b0c2[_0x3cc7('0xa7')]=0x12;_0x56b0c2[_0x3cc7('0xe7')]='HangupInAMD';_0x56b0c2[_0x3cc7('0xe9')]=_0x3cc7('0xf8');ami[_0x3cc7('0xe2')](_0x3cc7('0xe3'),ut['buildObj'](_0x56b0c2,_0x3cc7('0xe5')));this[_0x3cc7('0xce')](_0x56b0c2,_0x3cc7('0xf9'),'[syncHangupInAMDIvr]');}if(_0x4e0ce5['type']===_0x3cc7('0x81')&&this[_0x3cc7('0x22')][_0x4e0ce5[_0x3cc7('0xb2')]]['dialAMDActive']&&_0x75ac33[_0x3cc7('0xe0')]==='MACHINE'){var _0x43109b=this;return new BPromise(function(_0x5b91cb,_0x3f2780){delete _0x43109b['uniqueId'][_0x75ac33['uniqueid']];_0x43109b[_0x3cc7('0xb1')](_0x43109b[_0x3cc7('0x22')][_0x4e0ce5['queue']]);_0x43109b['campaigns'][_0x4e0ce5[_0x3cc7('0xb2')]][_0x3cc7('0x60')]+=0x1;_0x43109b[_0x3cc7('0x22')][_0x4e0ce5[_0x3cc7('0xb2')]][_0x3cc7('0x5f')]+=0x1;var _0x4d517a=_0x43109b[_0x3cc7('0x22')][_0x4e0ce5[_0x3cc7('0xb2')]];var _0x597622=new Hangup(_0x4e0ce5,_0x75ac33);_0x597622['state']=0x13;_0x597622[_0x3cc7('0xe7')]=_0x3cc7('0xe8');_0x597622['membername']=_0x3cc7('0xf8');_0x597622[_0x3cc7('0xea')]+=0x1;_0x597622[_0x3cc7('0xfa')]+=0x1;_0x597622[_0x3cc7('0xe5')]=!![];ami[_0x3cc7('0xe2')](_0x3cc7('0xe3'),ut[_0x3cc7('0xe4')](_0x597622,'amd'));_0x43109b[_0x3cc7('0xc8')](_0x597622)['catch'](loggerCatch(_0x3cc7('0xeb')));if(_0x597622[_0x3cc7('0xec')]+_0x597622['countcongestionretry']+_0x597622['countnoanswerretry']+_0x597622[_0x3cc7('0xee')]+_0x597622[_0x3cc7('0xef')]+_0x597622[_0x3cc7('0xfb')]+_0x597622[_0x3cc7('0xea')]+_0x597622['countagentrejectretry']>=_0x4d517a[_0x3cc7('0xfc')]){_0x43109b['stateGlobal'](_0x597622,_0x5b91cb,_0x3f2780,_0x3cc7('0xf2'));}else{if(_0x597622[_0x3cc7('0xea')]>=_0x4d517a['dialMachineMaxRetry']){_0x43109b[_0x3cc7('0xfd')](_0x597622,_0x5b91cb,_0x3f2780,_0x3cc7('0xf3'));}else{_0x43109b[_0x3cc7('0xbe')]({'active':![],'countmachineretry':_0x597622[_0x3cc7('0xea')],'scheduledat':moment()[_0x3cc7('0xfe')](_0x4d517a[_0x3cc7('0xf4')],_0x3cc7('0xff'))[_0x3cc7('0x7e')](_0x3cc7('0xf5')),'ContactId':_0x597622[_0x3cc7('0xd0')],'ListId':_0x597622[_0x3cc7('0xd1')],'VoiceQueueId':_0x597622[_0x3cc7('0xd3')]||undefined,'CampaignId':_0x597622['CampaignId']||undefined})[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0xf6')));_0x5b91cb({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x3cc7('0x34')]=function(_0x367193){var _0x5debe7=this[_0x3cc7('0x27')][_0x367193['uniqueid']];var _0x2dfe6d=this;var _0x5cc42c;if(_0x5debe7&&_0x5debe7[_0x3cc7('0x4b')]==='ivr'){delete this[_0x3cc7('0x27')][_0x367193[_0x3cc7('0xda')]];this['updateOriginated'](this[_0x3cc7('0x22')][_0x5debe7[_0x3cc7('0xb2')]]);this[_0x3cc7('0x22')][_0x5debe7[_0x3cc7('0xb2')]][_0x3cc7('0x100')]+=0x1;_0x5cc42c=new Hangup(_0x5debe7,_0x367193);this[_0x3cc7('0xc8')](_0x5cc42c)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3cc7('0xc7')](_0x5cc42c)[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x101')));}if(_0x5debe7&&_0x5debe7['type']!==_0x3cc7('0x81')&&isNotNull(this[_0x3cc7('0x21')][_0x5debe7[_0x3cc7('0xb2')]]['dialQueueProject'])){delete this[_0x3cc7('0x27')][_0x367193[_0x3cc7('0xda')]];this[_0x3cc7('0xb1')](this[_0x3cc7('0x21')][_0x5debe7[_0x3cc7('0xb2')]]);this[_0x3cc7('0x21')][_0x5debe7[_0x3cc7('0xb2')]]['outboundAnswerCallsDay']+=0x1;this[_0x3cc7('0x21')][_0x5debe7[_0x3cc7('0xb2')]][_0x3cc7('0x5f')]+=0x1;_0x5cc42c=new Hangup(_0x5debe7,_0x367193);_0x5cc42c['state']=0x10;_0x5cc42c[_0x3cc7('0xe7')]=_0x3cc7('0x102');_0x5cc42c[_0x3cc7('0xe9')]='AGI';this[_0x3cc7('0xc8')](_0x5cc42c)['catch'](loggerCatch(_0x3cc7('0x103')));this[_0x3cc7('0xc7')](_0x5cc42c)[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x101')));}if(_0x5debe7&&_0x5debe7[_0x3cc7('0x4b')]!==_0x3cc7('0x81')&&!isNotNull(this[_0x3cc7('0x21')][_0x5debe7[_0x3cc7('0xb2')]][_0x3cc7('0x104')])){delete this[_0x3cc7('0x27')][_0x367193['uniqueid']];this[_0x3cc7('0xb1')](this[_0x3cc7('0x21')][_0x5debe7[_0x3cc7('0xb2')]]);this[_0x3cc7('0x21')][_0x5debe7[_0x3cc7('0xb2')]][_0x3cc7('0x6b')]+=0x1;_0x5cc42c=new Hangup(_0x5debe7,_0x367193);_0x5cc42c['state']=0xc;_0x5cc42c[_0x3cc7('0xe7')]=_0x367193[_0x3cc7('0x105')];_0x5cc42c[_0x3cc7('0xe9')]=_0x3cc7('0x106');this[_0x3cc7('0xc8')](_0x5cc42c)['catch'](loggerCatch(_0x3cc7('0x103')));this[_0x3cc7('0xc7')](_0x5cc42c)['catch'](loggerCatch(_0x3cc7('0x101')));}};Dialer[_0x3cc7('0x1b')][_0x3cc7('0x31')]=function(_0x469c50){var _0x24ff9d=this[_0x3cc7('0x27')][_0x469c50[_0x3cc7('0xda')]];var _0x3228f9=this;if(this[_0x3cc7('0x21')][_0x469c50[_0x3cc7('0xb2')]]){if(_0x24ff9d&&_0x24ff9d[_0x3cc7('0x4b')]!=='ivr'){delete this['uniqueId'][_0x469c50[_0x3cc7('0xda')]];this[_0x3cc7('0x21')][_0x469c50['queue']][_0x3cc7('0x60')]+=0x1;var _0x349e6c=new AgentComplete(_0x24ff9d,_0x469c50);if(_0x469c50[_0x3cc7('0x107')]===_0x3cc7('0x108')){_0x349e6c[_0x3cc7('0x109')]=this['voiceQueues'][_0x469c50[_0x3cc7('0xb2')]]['dialQueueProject2']&&this[_0x3cc7('0x21')][_0x469c50[_0x3cc7('0xb2')]][_0x3cc7('0x10a')]?moment()[_0x3cc7('0x7e')](_0x3cc7('0xf5')):undefined;}this['createHistory'](_0x349e6c)[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x10b')));this[_0x3cc7('0xc7')](_0x349e6c)[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x10c')));}}};Dialer['prototype'][_0x3cc7('0x2c')]=function(_0x1cce59){if(this[_0x3cc7('0x21')][_0x1cce59['queue']]){if(this['uniqueId'][_0x1cce59[_0x3cc7('0xda')]]&&this['uniqueId'][_0x1cce59[_0x3cc7('0xda')]][_0x3cc7('0x4b')]!==_0x3cc7('0x81')){this[_0x3cc7('0xb1')](this[_0x3cc7('0x21')][_0x1cce59['queue']]);this[_0x3cc7('0x27')][_0x1cce59['uniqueid']]['answertime']=moment()['format'](_0x3cc7('0xf5'));}}};Dialer[_0x3cc7('0x1b')][_0x3cc7('0x10d')]=function(_0x52da67){this[_0x3cc7('0xc8')](_0x52da67)[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x10b')));this[_0x3cc7('0xc7')](_0x52da67)[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x10e')));};Dialer[_0x3cc7('0x1b')][_0x3cc7('0x2e')]=function(_0x38679f){var _0x1563e8=this[_0x3cc7('0x27')][_0x38679f[_0x3cc7('0xda')]];var _0x33023d=this;if(this[_0x3cc7('0x21')][_0x38679f[_0x3cc7('0xb2')]]){if(_0x1563e8&&_0x1563e8[_0x3cc7('0x4b')]!==_0x3cc7('0x81')){delete this['uniqueId'][_0x38679f[_0x3cc7('0xda')]];this[_0x3cc7('0xb1')](this[_0x3cc7('0x21')][_0x38679f[_0x3cc7('0xb2')]]);_0x1563e8['droptime']=moment()[_0x3cc7('0x7e')](_0x3cc7('0xf5'));var _0x39be03=new QueueCallerAbandon(_0x1563e8,_0x38679f);if(getSeconds(_0x1563e8[_0x3cc7('0x10f')],_0x1563e8[_0x3cc7('0x110')])>=_0x1563e8[_0x3cc7('0x111')]){this[_0x3cc7('0x21')][_0x38679f[_0x3cc7('0xb2')]][_0x3cc7('0x6e')]+=0x1;this[_0x3cc7('0x21')][_0x38679f[_0x3cc7('0xb2')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x3cc7('0x21')][_0x38679f[_0x3cc7('0xb2')]][_0x3cc7('0x70')]+=0x1;_0x39be03[_0x3cc7('0xa7')]=0xa;_0x39be03[_0x3cc7('0xe7')]='Drop';_0x39be03[_0x3cc7('0x112')]='TIMEOUT';_0x39be03[_0x3cc7('0x109')]=this[_0x3cc7('0x21')][_0x38679f[_0x3cc7('0xb2')]][_0x3cc7('0x113')]?moment()[_0x3cc7('0x7e')](_0x3cc7('0xf5')):undefined;_0x39be03[_0x3cc7('0xef')]+=0x1;_0x39be03[_0x3cc7('0xfa')]+=0x1;if(_0x39be03[_0x3cc7('0xef')]>=this[_0x3cc7('0x21')][_0x38679f['queue']][_0x3cc7('0x114')]){this['queueCallerAbandonCreateState'](_0x39be03);}else{this[_0x3cc7('0xbe')]({'active':![],'countdropretry':_0x39be03[_0x3cc7('0xef')],'scheduledat':moment()[_0x3cc7('0xfe')](this[_0x3cc7('0x21')][_0x38679f['queue']][_0x3cc7('0x115')],'minutes')[_0x3cc7('0x7e')](_0x3cc7('0xf5')),'ContactId':_0x1563e8[_0x3cc7('0xd0')],'ListId':_0x1563e8[_0x3cc7('0xd1')],'VoiceQueueId':_0x1563e8[_0x3cc7('0xd3')]||undefined,'CampaignId':_0x1563e8[_0x3cc7('0xd4')]||undefined})[_0x3cc7('0xb7')](loggerCatch('[rescheduleContact][Drop]'));var _0x981a62=new History(_0x39be03);_0x981a62[_0x3cc7('0xa7')]=0xa;_0x981a62[_0x3cc7('0xe7')]=_0x3cc7('0x116');_0x981a62['starttime']=moment()[_0x3cc7('0x7e')](_0x3cc7('0xf5'));_0x981a62[_0x3cc7('0xa8')]=_0x981a62['starttime'];_0x981a62[_0x3cc7('0x117')]=_0x39be03[_0x3cc7('0x117')];_0x981a62[_0x3cc7('0x118')]=_0x39be03['calleridnum'];this[_0x3cc7('0xc8')](_0x981a62)[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x119')));}}else{this['voiceQueues'][_0x38679f[_0x3cc7('0xb2')]][_0x3cc7('0x88')]+=0x1;this[_0x3cc7('0x21')][_0x38679f['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x39be03['state']=0xb;_0x39be03[_0x3cc7('0xe7')]=_0x3cc7('0x11a');_0x39be03[_0x3cc7('0x112')]=_0x3cc7('0x11b');_0x39be03[_0x3cc7('0xfb')]+=0x1;_0x39be03[_0x3cc7('0xfa')]+=0x1;if(_0x39be03['countabandonedretry']>=this[_0x3cc7('0x21')][_0x38679f[_0x3cc7('0xb2')]][_0x3cc7('0x11c')]){this['queueCallerAbandonCreateState'](_0x39be03);}else{this[_0x3cc7('0xbe')]({'active':![],'countabandonedretry':_0x39be03['countabandonedretry'],'scheduledat':moment()[_0x3cc7('0xfe')](this['voiceQueues'][_0x38679f[_0x3cc7('0xb2')]][_0x3cc7('0x11d')],_0x3cc7('0xff'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1563e8[_0x3cc7('0xd0')],'ListId':_0x1563e8['ListId'],'VoiceQueueId':_0x1563e8[_0x3cc7('0xd3')]||undefined,'CampaignId':_0x1563e8[_0x3cc7('0xd4')]||undefined})[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x11e')));var _0x981a62=new History(_0x39be03);_0x981a62[_0x3cc7('0xa7')]=0xb;_0x981a62[_0x3cc7('0xe7')]=_0x3cc7('0x11a');_0x981a62[_0x3cc7('0xa9')]=moment()[_0x3cc7('0x7e')](_0x3cc7('0xf5'));_0x981a62[_0x3cc7('0xa8')]=_0x981a62[_0x3cc7('0xa9')];_0x981a62[_0x3cc7('0x117')]=_0x39be03[_0x3cc7('0x117')];_0x981a62[_0x3cc7('0x118')]=_0x39be03[_0x3cc7('0x118')];this['createHistory'](_0x981a62)[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x11f')));}}}}};Dialer[_0x3cc7('0x1b')][_0x3cc7('0x35')]=function(_0x5d215c){if(this['actions'][_0x5d215c[_0x3cc7('0xda')]]){this[_0x3cc7('0x26')][_0x5d215c[_0x3cc7('0xda')]][_0x3cc7('0xaf')]=_0x5d215c[_0x3cc7('0xaf')];}if(this[_0x3cc7('0x27')][_0x5d215c[_0x3cc7('0xda')]]){this['uniqueId'][_0x5d215c['uniqueid']]['channel']=_0x5d215c[_0x3cc7('0xaf')];}};Dialer[_0x3cc7('0x1b')]['syncQueueMember']=function(_0x52b9ed){if(strategy[this[_0x3cc7('0x21')][this['actions'][_0x52b9ed[_0x3cc7('0x120')]][_0x3cc7('0xb2')]][_0x3cc7('0x4d')]]===_0x3cc7('0x1a')){if(this[_0x3cc7('0x26')][_0x52b9ed['actionid']]&&_[_0x3cc7('0xad')](this[_0x3cc7('0x26')][_0x52b9ed['actionid']][_0x3cc7('0x121')])&&_0x52b9ed[_0x3cc7('0xae')]==='1'&&_0x52b9ed[_0x3cc7('0x122')]==='0'){if(this[_0x3cc7('0x23')][_0x52b9ed[_0x3cc7('0x123')]]){if(!this[_0x3cc7('0x23')][_0x52b9ed['stateinterface']][_0x3cc7('0x121')]){this[_0x3cc7('0x23')][_0x52b9ed[_0x3cc7('0x123')]][_0x3cc7('0x121')]=!![];this[_0x3cc7('0x26')][_0x52b9ed['actionid']][_0x3cc7('0x121')]=!![];this[_0x3cc7('0x26')][_0x52b9ed[_0x3cc7('0x120')]]['stateinterface']=_0x52b9ed[_0x3cc7('0x123')];}}}}else if((strategy[this['voiceQueues'][this[_0x3cc7('0x26')][_0x52b9ed['actionid']][_0x3cc7('0xb2')]][_0x3cc7('0x4d')]]||'rrmemory')===_0x3cc7('0x19')){if(this['actions'][_0x52b9ed['actionid']]){if(this['agents'][_0x52b9ed['stateinterface']]){this[_0x3cc7('0x26')][_0x52b9ed[_0x3cc7('0x120')]][_0x3cc7('0x123')]=_0x52b9ed[_0x3cc7('0x123')];if(_[_0x3cc7('0xad')](this[_0x3cc7('0x2a')][this[_0x3cc7('0x26')][_0x52b9ed[_0x3cc7('0x120')]]['queue']])){this[_0x3cc7('0x2a')][this[_0x3cc7('0x26')][_0x52b9ed['actionid']][_0x3cc7('0xb2')]]=[];}this[_0x3cc7('0x2a')][this['actions'][_0x52b9ed['actionid']][_0x3cc7('0xb2')]][_0x3cc7('0x124')](_[_0x3cc7('0xcf')](_['pick'](this[_0x3cc7('0x26')][_0x52b9ed[_0x3cc7('0x120')]],[_0x3cc7('0x125'),_0x3cc7('0x123')]),{'status':_0x52b9ed[_0x3cc7('0xae')],'paused':_0x52b9ed['paused']}));}}}};function unlockQueueStatus(_0x2714f3,_0x2bf14a){setTimeout(function(){if(_[_0x3cc7('0x3b')](_0x2714f3[_0x3cc7('0x126')])){loggerBooked[_0x3cc7('0x97')](_0x3cc7('0x127'),_0x2bf14a);}_0x2714f3[_0x3cc7('0x126')]=!![];loggerBooked[_0x3cc7('0x83')](_0x3cc7('0x128'),_0x2bf14a,JSON[_0x3cc7('0x48')](_[_0x3cc7('0x129')](_0x2714f3,[_0x3cc7('0x3e'),'queueStatusComplete'])));},0x1f3);}Dialer[_0x3cc7('0x1b')][_0x3cc7('0x38')]=function(_0x7cd407){var _0x493753=this;var _0xd8c65c=_0x493753['voiceQueues'][_0x493753[_0x3cc7('0x26')][_0x7cd407[_0x3cc7('0x120')]][_0x3cc7('0xb2')]];if(strategy[this[_0x3cc7('0x21')][this['actions'][_0x7cd407[_0x3cc7('0x120')]][_0x3cc7('0xb2')]][_0x3cc7('0x4d')]]===_0x3cc7('0x1a')){if(this[_0x3cc7('0x26')][_0x7cd407[_0x3cc7('0x120')]]&&this[_0x3cc7('0x26')][_0x7cd407['actionid']][_0x3cc7('0x123')]){this['preview']['run'](this[_0x3cc7('0x26')][_0x7cd407[_0x3cc7('0x120')]][_0x3cc7('0x125')],this[_0x3cc7('0x26')][_0x7cd407['actionid']]['stateinterface'])[_0x3cc7('0xb7')](function(_0x5bc4aa){logger[_0x3cc7('0x97')](_0x3cc7('0x12a'),util[_0x3cc7('0x96')](_0x5bc4aa,{'showHidden':![],'depth':null}));})['finally'](function(){_0x493753[_0x3cc7('0xb1')](_0x493753[_0x3cc7('0x21')][_0x493753['actions'][_0x7cd407['actionid']][_0x3cc7('0xb2')]]);_0x493753[_0x3cc7('0x23')][_0x493753[_0x3cc7('0x26')][_0x7cd407[_0x3cc7('0x120')]][_0x3cc7('0x123')]][_0x3cc7('0x121')]=![];delete _0x493753[_0x3cc7('0x26')][_0x7cd407['actionid']];unlockQueueStatus(_0xd8c65c);});}else{this[_0x3cc7('0xb1')](this[_0x3cc7('0x21')][this[_0x3cc7('0x26')][_0x7cd407[_0x3cc7('0x120')]][_0x3cc7('0xb2')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x3cc7('0x26')][_0x7cd407[_0x3cc7('0x120')]][_0x3cc7('0xd0')],'ListId':this[_0x3cc7('0x26')][_0x7cd407['actionid']]['ListId'],'VoiceQueueId':this[_0x3cc7('0x26')][_0x7cd407[_0x3cc7('0x120')]][_0x3cc7('0xd3')]||undefined,'CampaignId':this[_0x3cc7('0x26')][_0x7cd407['actionid']][_0x3cc7('0xd4')]||undefined})[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x12b')));delete this[_0x3cc7('0x26')][_0x7cd407[_0x3cc7('0x120')]];unlockQueueStatus(_0xd8c65c);}}else if((strategy[this[_0x3cc7('0x21')][this[_0x3cc7('0x26')][_0x7cd407['actionid']][_0x3cc7('0xb2')]][_0x3cc7('0x4d')]]||_0x3cc7('0x19'))===_0x3cc7('0x19')){var _0x2e4f65;if(this[_0x3cc7('0x26')][_0x7cd407['actionid']]&&!_[_0x3cc7('0x45')](this[_0x3cc7('0x2a')][this['actions'][_0x7cd407['actionid']][_0x3cc7('0xb2')]])){if(this[_0x3cc7('0x2b')][_0x493753['actions'][_0x7cd407[_0x3cc7('0x120')]][_0x3cc7('0xb2')]]){this[_0x3cc7('0x2b')][_0x493753[_0x3cc7('0x26')][_0x7cd407['actionid']][_0x3cc7('0xb2')]]=this[_0x3cc7('0x2b')][this[_0x3cc7('0x26')][_0x7cd407[_0x3cc7('0x120')]]['queue']]?this[_0x3cc7('0x2b')][this['actions'][_0x7cd407[_0x3cc7('0x120')]][_0x3cc7('0xb2')]]:this[_0x3cc7('0x2a')][this['actions'][_0x7cd407[_0x3cc7('0x120')]][_0x3cc7('0xb2')]]?this['queueBooked'][this[_0x3cc7('0x26')][_0x7cd407[_0x3cc7('0x120')]][_0x3cc7('0xb2')]]['_rr']||0x0:0x0;}this[_0x3cc7('0x2a')][this['actions'][_0x7cd407['actionid']][_0x3cc7('0xb2')]][_0x3cc7('0x12c')]=this[_0x3cc7('0x2b')][this[_0x3cc7('0x26')][_0x7cd407['actionid']][_0x3cc7('0xb2')]];for(var _0x5e9900=0x0;_0x5e9900=0x0;})[_0x3cc7('0xb7')](myreject(_0x5c1f86)));}}else{_0x234cf1[_0x3cc7('0x124')](ami[_0x3cc7('0x144')]({'action':_0x3cc7('0x145'),'command':util[_0x3cc7('0x7e')](_0x3cc7('0x146'),_0x1bba12,!_[_0x3cc7('0x3b')](config[_0x3cc7('0x140')][_0x27061c])?_0x27061c:'')})[_0x3cc7('0xb6')](function(_0x3b8da6){return _0x3b8da6[_0x3cc7('0x148')]['indexOf']('true')>=0x0;})[_0x3cc7('0xb7')](myreject(_0x5c1f86)));}BPromise[_0x3cc7('0x14a')](_0x234cf1)[_0x3cc7('0xb6')](function(_0x4fbdb0){var _0x8d79a6=_[_0x3cc7('0x14b')](_0x4fbdb0);if(_0x8d79a6){return _0xa1b55(_0x8d79a6);}else{_0x16aeb4[_0x3cc7('0x3c')]=_0x20714a?'GLOBAL_INTERVAL_IS_OVERTIME':_0x3cc7('0x14c');return _0x5c1f86(msgResponse(_0x3cc7('0x14d'),_0x3cc7('0x13d'),_0x3cc7('0x14e')+_0x20714a+'\x20'+_0x539645+_0x3cc7('0x14f')+util[_0x3cc7('0x96')](_0x1bba12,{'showHidden':![],'depth':null})+_0x3cc7('0x150')+_0x27061c));}})['catch'](function(_0x2da09b){return _0x5c1f86(msgResponse(_0x3cc7('0x13b'),_0x3cc7('0x13d'),JSON[_0x3cc7('0x48')](_0x2da09b)));});});};Dialer['prototype'][_0x3cc7('0x151')]=function(_0x2a68f2){var _0x1c919b=this;return function(){switch(_0x2a68f2[_0x3cc7('0x5b')]){case _0x3cc7('0x152'):freeVariablesPredictive(_0x2a68f2);_0x1c919b[_0x3cc7('0x153')](_0x2a68f2,0x1);break;case _0x3cc7('0x154'):freeVariablesPredictive(_0x2a68f2);_0x1c919b['handlePower'](_0x2a68f2,_0x2a68f2['dialPowerLevel']);break;case _0x3cc7('0x7'):_0x1c919b[_0x3cc7('0x7')](_0x2a68f2);break;case'booked':freeVariablesPredictive(_0x2a68f2);_0x1c919b[_0x3cc7('0x153')](_0x2a68f2,0x1);break;default:freeVariablesPredictive(_0x2a68f2);logger[_0x3cc7('0x97')](_0x3cc7('0x155'),_0x2a68f2[_0x3cc7('0x3e')],_0x3cc7('0x156'));}};};Dialer[_0x3cc7('0x1b')]['launchHandleIvr']=function(_0x401ce8){var _0x217603=this;return function(){_0x217603[_0x3cc7('0x157')](_0x401ce8);};};Dialer[_0x3cc7('0x1b')][_0x3cc7('0x9')]=function(_0x56a8fc){var _0x14b412=this;if(isNotPreview(_0x56a8fc[_0x3cc7('0x5b')])){if(isVoiceQueueOutbound(_0x56a8fc[_0x3cc7('0x4b')])&&isActive(_0x56a8fc[_0x3cc7('0x5a')])){_0x56a8fc[_0x3cc7('0xa0')]=!![];BPromise[_0x3cc7('0xb5')]()[_0x3cc7('0xb6')](checkIsLoggedIn(_0x56a8fc,_0x56a8fc[_0x3cc7('0x50')]))[_0x3cc7('0xb6')](checkIsActive(_0x56a8fc,_0x56a8fc[_0x3cc7('0x5a')]))[_0x3cc7('0xb6')](checkInterval(_0x56a8fc))[_0x3cc7('0xb6')](_0x14b412[_0x3cc7('0x135')](_0x56a8fc))[_0x3cc7('0xb6')](_0x14b412[_0x3cc7('0x13a')](_0x56a8fc[_0x3cc7('0x158')],_0x56a8fc[_0x3cc7('0x159')],_0x56a8fc[_0x3cc7('0x3e')],_0x56a8fc))[_0x3cc7('0xb6')](_0x14b412[_0x3cc7('0x13c')](_0x56a8fc[_0x3cc7('0x41')],_0x56a8fc[_0x3cc7('0x159')],_0x56a8fc[_0x3cc7('0x3e')],_0x56a8fc))[_0x3cc7('0xb6')](_0x14b412[_0x3cc7('0x151')](_0x56a8fc))[_0x3cc7('0xb7')](loggerCatchQueueSummary(_0x3cc7('0x15a'),_0x56a8fc));}else{notSendMessagesQueue(_0x56a8fc);}}else{freeVariablesPredictive(_0x56a8fc);}};Dialer[_0x3cc7('0x1b')][_0x3cc7('0x15b')]=function(){var _0x2f8d4a=this;var _0x379c99;for(var _0x3b5fe4 in this[_0x3cc7('0x22')]){if(typeof this[_0x3cc7('0x22')][_0x3b5fe4]!=='undefined'){_0x379c99=this[_0x3cc7('0x22')][_0x3b5fe4];if(isCampaignIvr(_0x379c99['type'])&&isActive(_0x379c99[_0x3cc7('0x7d')])){_0x379c99['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0x3cc7('0xb6')](checkIsActive(_0x379c99,_0x379c99[_0x3cc7('0x7d')]))[_0x3cc7('0xb6')](checkInterval(_0x379c99))[_0x3cc7('0xb6')](_0x2f8d4a[_0x3cc7('0x135')](_0x379c99))[_0x3cc7('0xb6')](_0x2f8d4a[_0x3cc7('0x13a')](_0x379c99[_0x3cc7('0x158')],_0x379c99['dialTimezone'],_0x379c99['name'],_0x379c99))['then'](_0x2f8d4a[_0x3cc7('0x13c')](_0x379c99[_0x3cc7('0x41')],_0x379c99['dialTimezone'],_0x379c99['name'],_0x379c99))[_0x3cc7('0xb6')](_0x2f8d4a['launchHandleIvr'](_0x379c99))[_0x3cc7('0xb7')](loggerCatchQueueSummary(_0x3cc7('0x15c'),_0x379c99));}else{notSendMessagesCampaign(_0x379c99);}}}};function getCallerIdRandom(_0x257faa,_0x4e65e4){var _0x5913da;var _0x9eb67;var _0x2cdb57;if(_0x4e65e4<=0x0){_0x4e65e4=0x1;}_0x5913da=new RegExp(_0x3cc7('0x15d')+_0x4e65e4+'}$');_0x9eb67=Math[_0x3cc7('0x15e')](0xa,_0x4e65e4-0x1);_0x2cdb57=Math[_0x3cc7('0x15e')](0xa,_0x4e65e4)-0x1;return util[_0x3cc7('0x7e')]('%s',_[_0x3cc7('0x15f')](_0x257faa,_0x5913da,_['random'](_0x9eb67,_0x2cdb57)));}function extractCalleridName(_0x490fac){var _0x10b78c=_0x490fac[_0x3cc7('0x160')](/"(.*?)"/);return _0x10b78c?_0x10b78c[0x1]:_0x490fac;}function extractCalleridNumber(_0x5c643c){var _0x27bcb5=_0x5c643c['match'](/<(.*?)>/);return _0x27bcb5?_0x27bcb5[0x1]:_0x5c643c;}Dialer[_0x3cc7('0x1b')][_0x3cc7('0x161')]=function(_0xbb37f8,_0x5a1da5){var _0x778341=this;var _0x230341=uuid['v4']();this[_0x3cc7('0x26')][_0x230341]=new Action(_0xbb37f8,_0x5a1da5,_0x230341);return new BPromise(function(_0x269137,_0x6232b7){if(_['isUndefined'](_0xbb37f8)&&typeof _0xbb37f8!==_0x3cc7('0x162')){return _0x6232b7(msgResponse(_0x3cc7('0x163'),_0x3cc7('0x13d'),_0x3cc7('0x164')));}if(_[_0x3cc7('0x3b')](_0x5a1da5[_0x3cc7('0x165')]['phone'])||_0x5a1da5['Contact'][_0x3cc7('0x166')]===null){return _0x6232b7(msgResponse(_0x3cc7('0x163'),_0x3cc7('0x13d'),_0x3cc7('0x167')));}var _0xa237c3={'XMD-CALLERID':_0x778341['actions'][_0x230341][_0x3cc7('0x168')](),'XMD-AGI':_0xbb37f8['dialQueueProject']?util[_0x3cc7('0x7e')](_0x3cc7('0x169'),ipAgi,_0xbb37f8[_0x3cc7('0x104')]):_0x3cc7('0x16a'),'XMD-AGIAFTER':_0xbb37f8['dialQueueProject2']?util['format'](_0x3cc7('0x169'),ipAgi,_0xbb37f8[_0x3cc7('0x113')]):_0x3cc7('0x16a'),'XMD-QUEUE':_0xbb37f8[_0x3cc7('0x4b')]===_0x3cc7('0x4c')?util['format'](_0x3cc7('0x16b'),_0xbb37f8['name'],_0xbb37f8[_0x3cc7('0x16c')]||'',_0xbb37f8[_0x3cc7('0x10a')]?'c':'',_0xbb37f8[_0x3cc7('0x111')]||0x3):'NONE','XMD-CONTACTID':_0x5a1da5['ContactId'],'XMD-CDRTYPE':_0x3cc7('0x4'),'CALLERID(all)':_0x778341[_0x3cc7('0x26')][_0x230341][_0x3cc7('0x168')](),'XMD-AMD':_0xbb37f8[_0x3cc7('0xdf')]?_0x3cc7('0x16d'):'NONE','XMD-DESTINATION':_0x3cc7('0xde')};if(_0xbb37f8[_0x3cc7('0xdf')]){_0xa237c3['XMD-AMDINITIALSILENCE']=_0xbb37f8[_0x3cc7('0x16e')]||0x9c4;_0xa237c3[_0x3cc7('0x16f')]=_0xbb37f8[_0x3cc7('0x170')]||0x5dc;_0xa237c3[_0x3cc7('0x171')]=_0xbb37f8[_0x3cc7('0x172')]||0x320;_0xa237c3[_0x3cc7('0x173')]=_0xbb37f8[_0x3cc7('0x174')]||0x1388;_0xa237c3[_0x3cc7('0x175')]=_0xbb37f8['dialAMDMinWordLength']||0x64;_0xa237c3[_0x3cc7('0x176')]=_0xbb37f8[_0x3cc7('0x177')]||0x32;_0xa237c3[_0x3cc7('0x178')]=_0xbb37f8[_0x3cc7('0x179')]||0x3;_0xa237c3[_0x3cc7('0x17a')]=_0xbb37f8[_0x3cc7('0x17b')]||0x100;_0xa237c3[_0x3cc7('0x17c')]=_0xbb37f8['dialAMDMaximumWordLength']||0x1388;}if(_0xbb37f8[_0x3cc7('0x4b')]===_0x3cc7('0x4c')){_0xa237c3[_0x3cc7('0x17d')]=_0x5a1da5[_0x3cc7('0xd3')];}else{_0xa237c3['XMD-CAMPAIGNID']=_0x5a1da5['CampaignId'];}for(var _0xe29230 in _0x5a1da5['Contact']){if(typeof _0x5a1da5[_0x3cc7('0x165')][_0xe29230]!==_0x3cc7('0x99')){if(isNotNull(_0x5a1da5['Contact'][_0xe29230])&&_0xe29230!=='id'&&_0xe29230!==_0x3cc7('0x17e')&&_0xe29230!==_0x3cc7('0x17f')&&_0xe29230!==_0x3cc7('0x180')){_0xa237c3[util[_0x3cc7('0x7e')](_0x3cc7('0x181'),_0x3cc7('0x182'),_[_0x3cc7('0x183')](_0xe29230))]=_0x5a1da5[_0x3cc7('0x165')][_0xe29230];}}}var _0x14f9b7=_0x778341['isTrunkReachable'](_0xbb37f8[_0x3cc7('0x7c')])?getCallerId(_0xbb37f8[_0x3cc7('0x7c')][_0x3cc7('0x184')],_0xbb37f8[_0x3cc7('0x5c')],_0xbb37f8[_0x3cc7('0x185')]>0x0?getCallerIdRandom(_0xbb37f8[_0x3cc7('0x186')],_0xbb37f8[_0x3cc7('0x185')]):_0xbb37f8[_0x3cc7('0x186')]):getCallerId(_[_0x3cc7('0xad')](_0xbb37f8['TrunkBackup'])?_0xbb37f8[_0x3cc7('0x7c')][_0x3cc7('0x184')]:_0xbb37f8[_0x3cc7('0x137')][_0x3cc7('0x184')],_0xbb37f8[_0x3cc7('0x5c')],_0xbb37f8[_0x3cc7('0x185')]>0x0?getCallerIdRandom(_0xbb37f8[_0x3cc7('0x186')],_0xbb37f8[_0x3cc7('0x185')]):_0xbb37f8[_0x3cc7('0x186')]);if(_0x14f9b7){_0xa237c3['XMD-ORIGINATECALLERIDNAME']=_0x778341[_0x3cc7('0x26')][_0x230341]['originatecalleridname']=extractCalleridName(_0x14f9b7);_0xa237c3[_0x3cc7('0x187')]=_0x778341[_0x3cc7('0x26')][_0x230341][_0x3cc7('0x188')]=extractCalleridNumber(_0x14f9b7);}return ami[_0x3cc7('0x144')]({'actionid':_0x230341,'action':_0x3cc7('0x163'),'channel':_0x778341[_0x3cc7('0x136')](_0xbb37f8[_0x3cc7('0x7c')])?util[_0x3cc7('0x7e')]('SIP/%s/%s%s',_0xbb37f8[_0x3cc7('0x7c')]['name'],isNotNull(_0xbb37f8[_0x3cc7('0x5e')])?_0xbb37f8[_0x3cc7('0x5e')][_0x3cc7('0x189')]()||'':'',_0xbb37f8[_0x3cc7('0x18a')]>0x0?_0x5a1da5[_0x3cc7('0x165')]['phone'][_0x3cc7('0x18b')](_0xbb37f8[_0x3cc7('0x18a')]):_0x5a1da5[_0x3cc7('0x165')][_0x3cc7('0x166')]):util['format'](_0x3cc7('0x18c'),_['isNil'](_0xbb37f8['TrunkBackup'])?_0xbb37f8[_0x3cc7('0x7c')][_0x3cc7('0x3e')]:_0xbb37f8[_0x3cc7('0x137')]['name'],isNotNull(_0xbb37f8[_0x3cc7('0x5e')])?_0xbb37f8['dialPrefix']['trim']()||'':'',_0xbb37f8[_0x3cc7('0x18a')]>0x0?_0x5a1da5['Contact'][_0x3cc7('0x166')][_0x3cc7('0x18b')](_0xbb37f8[_0x3cc7('0x18a')]):_0x5a1da5[_0x3cc7('0x165')][_0x3cc7('0x166')]),'callerid':_0x14f9b7,'Exten':_0x3cc7('0xde'),'Context':'from-sip','Priority':'1','variable':_0xa237c3,'timeout':(_0xbb37f8['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x230341})['then'](function(_0x3b33bf){return _0x269137(_0x3b33bf);})[_0x3cc7('0xb7')](function(_0x2495f9){_0xbb37f8[_0x3cc7('0x68')]+=0x1;var _0xde5c21=new History(_0x778341[_0x3cc7('0x26')][_0x230341]);logger[_0x3cc7('0x97')](util[_0x3cc7('0x7e')](_0x3cc7('0x18d'),JSON[_0x3cc7('0x48')](_0x2495f9)));_0xde5c21[_0x3cc7('0xa7')]=0xe;_0xde5c21[_0x3cc7('0xe7')]=_0x3cc7('0x18e');_0xde5c21[_0x3cc7('0xa9')]=moment()[_0x3cc7('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');_0xde5c21[_0x3cc7('0xa8')]=_0xde5c21[_0x3cc7('0xa9')];_0x778341[_0x3cc7('0xc8')](_0xde5c21)[_0x3cc7('0xb7')](loggerCatch('[originate][error]'));_0x778341[_0x3cc7('0xc7')](_0xde5c21)[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x18f')))[_0x3cc7('0x1e')](function(){delete _0x778341[_0x3cc7('0x26')][_0x230341];return _0x6232b7(msgResponse('originate',_0x3cc7('0x47'),_0x3cc7('0x190')));});});});};Dialer['prototype'][_0x3cc7('0x191')]=function(_0x42bce4){var _0x2f7881=this[_0x3cc7('0x26')][_0x42bce4[_0x3cc7('0x120')]];if(_0x2f7881){delete this[_0x3cc7('0x26')][_0x42bce4[_0x3cc7('0x120')]];_0x2f7881[_0x3cc7('0x110')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0xb80aed=_0x2f7881[_0x3cc7('0x4b')]===_0x3cc7('0x81')?this['campaigns'][_0x2f7881[_0x3cc7('0xb2')]]:this[_0x3cc7('0x21')][_0x2f7881['getQueue']()];if(!this[_0x3cc7('0x192')](_0x42bce4[_0x3cc7('0x193')])){this[_0x3cc7('0xb1')](_0xb80aed);return this[_0x3cc7('0x194')](_0x2f7881,_0xb80aed,_0x42bce4)[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x195')));}this['uniqueId'][_0x42bce4['uniqueid']]=_0x2f7881;}};Dialer['prototype'][_0x3cc7('0x196')]=function(_0x213631,_0x4bac08,_0x120be6){var _0x28bdeb=new History(_0x4bac08);if(_0x28bdeb[_0x3cc7('0xec')]+_0x28bdeb['countcongestionretry']+_0x28bdeb['countnoanswerretry']+_0x28bdeb[_0x3cc7('0xee')]+_0x28bdeb[_0x3cc7('0xef')]+_0x28bdeb[_0x3cc7('0xfb')]+_0x28bdeb['countmachineretry']+_0x28bdeb['countagentrejectretry']>=_0x120be6[_0x3cc7('0xfc')]-0x1){return!![];}switch(_0x213631){case 0x3:if(_0x28bdeb['countnoanswerretry']>=_0x120be6[_0x3cc7('0x197')]-0x1){return!![];}this[_0x3cc7('0xbe')]({'active':![],'countnoanswerretry':_0x28bdeb[_0x3cc7('0xed')]+=0x1,'scheduledat':moment()[_0x3cc7('0xfe')](_0x120be6[_0x3cc7('0x198')],_0x3cc7('0xff'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x28bdeb[_0x3cc7('0xd0')],'ListId':_0x28bdeb[_0x3cc7('0xd1')],'VoiceQueueId':_0x28bdeb[_0x3cc7('0xd3')]||undefined,'CampaignId':_0x28bdeb[_0x3cc7('0xd4')]||undefined})[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x199')));break;case 0x5:if(_0x28bdeb['countbusyretry']>=_0x120be6['dialBusyMaxRetry']-0x1){return!![];}this[_0x3cc7('0xbe')]({'active':![],'countbusyretry':_0x28bdeb[_0x3cc7('0xec')]+=0x1,'scheduledat':moment()['add'](_0x120be6[_0x3cc7('0x19a')],_0x3cc7('0xff'))['format'](_0x3cc7('0xf5')),'ContactId':_0x28bdeb[_0x3cc7('0xd0')],'ListId':_0x28bdeb['ListId'],'VoiceQueueId':_0x28bdeb[_0x3cc7('0xd3')]||undefined,'CampaignId':_0x28bdeb['CampaignId']||undefined})[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x19b')));break;case 0x8:if(_0x28bdeb['countcongestionretry']>=_0x120be6[_0x3cc7('0x19c')]-0x1){return!![];}this[_0x3cc7('0xbe')]({'active':![],'countcongestionretry':_0x28bdeb[_0x3cc7('0x19d')]+=0x1,'scheduledat':moment()[_0x3cc7('0xfe')](_0x120be6[_0x3cc7('0x19e')],_0x3cc7('0xff'))[_0x3cc7('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x28bdeb['ContactId'],'ListId':_0x28bdeb[_0x3cc7('0xd1')],'VoiceQueueId':_0x28bdeb[_0x3cc7('0xd3')]||undefined,'CampaignId':_0x28bdeb[_0x3cc7('0xd4')]||undefined})[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x19f')));break;case 0x0:if(_0x28bdeb[_0x3cc7('0xee')]>=_0x120be6['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0x3cc7('0xbe')]({'active':![],'countnosuchnumberretry':_0x28bdeb[_0x3cc7('0xee')]+=0x1,'scheduledat':moment()['add'](_0x120be6[_0x3cc7('0x1a0')],_0x3cc7('0xff'))[_0x3cc7('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x28bdeb[_0x3cc7('0xd0')],'ListId':_0x28bdeb['ListId'],'VoiceQueueId':_0x28bdeb[_0x3cc7('0xd3')]||undefined,'CampaignId':_0x28bdeb[_0x3cc7('0xd4')]||undefined})[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x1a1')));}break;case 0xa:if(_0x28bdeb[_0x3cc7('0xef')]>=_0x120be6[_0x3cc7('0x114')]-0x1){return!![];}this[_0x3cc7('0xbe')]({'active':![],'countdropretry':_0x28bdeb[_0x3cc7('0xef')]+=0x1,'scheduledat':moment()[_0x3cc7('0xfe')](_0x120be6[_0x3cc7('0x115')],'minutes')[_0x3cc7('0x7e')](_0x3cc7('0xf5')),'ContactId':_0x28bdeb['ContactId'],'ListId':_0x28bdeb['ListId'],'VoiceQueueId':_0x28bdeb['VoiceQueueId']||undefined,'CampaignId':_0x28bdeb[_0x3cc7('0xd4')]||undefined})[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x1a2')));break;case 0xb:if(_0x28bdeb[_0x3cc7('0xfb')]>=_0x120be6[_0x3cc7('0x11c')]-0x1){return!![];}this[_0x3cc7('0xbe')]({'active':![],'countabandonedretry':_0x28bdeb[_0x3cc7('0xfb')]+=0x1,'scheduledat':moment()[_0x3cc7('0xfe')](_0x120be6[_0x3cc7('0x11d')],'minutes')[_0x3cc7('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x28bdeb['ContactId'],'ListId':_0x28bdeb[_0x3cc7('0xd1')],'VoiceQueueId':_0x28bdeb['VoiceQueueId']||undefined,'CampaignId':_0x28bdeb[_0x3cc7('0xd4')]||undefined})[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x11e')));break;case 0x13:if(_0x28bdeb['countmachineretry']>=_0x120be6['dialMachineMaxRetry']-0x1){return!![];}this[_0x3cc7('0xbe')]({'active':![],'countmachineretry':_0x28bdeb[_0x3cc7('0xea')]+=0x1,'scheduledat':moment()[_0x3cc7('0xfe')](_0x120be6[_0x3cc7('0xf4')],_0x3cc7('0xff'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x28bdeb[_0x3cc7('0xd0')],'ListId':_0x28bdeb[_0x3cc7('0xd1')],'VoiceQueueId':_0x28bdeb['VoiceQueueId']||undefined,'CampaignId':_0x28bdeb[_0x3cc7('0xd4')]||undefined})[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0xf6')));break;case 0x14:if(_0x28bdeb['countagentrejectretry']>=_0x120be6[_0x3cc7('0x1a3')]-0x1){return!![];}this[_0x3cc7('0xbe')]({'active':![],'countagentrejectretry':_0x28bdeb[_0x3cc7('0xf0')]+=0x1,'scheduledat':moment()['add'](_0x120be6['dialAgentRejectRetryFrequency'],_0x3cc7('0xff'))[_0x3cc7('0x7e')](_0x3cc7('0xf5')),'ContactId':_0x28bdeb[_0x3cc7('0xd0')],'ListId':_0x28bdeb['ListId'],'VoiceQueueId':_0x28bdeb['VoiceQueueId']||undefined,'CampaignId':_0x28bdeb['CampaignId']||undefined})[_0x3cc7('0xb7')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x3cc7('0x1b')]['callProgressDetecting']=function(_0x2b0051,_0x4e2071,_0x2e7b05){var _0x2b6805=this;var _0x2ebe90=new History(_0x2b0051);return new BPromise(function(_0x1b26ec,_0x81aff1){if(_[_0x3cc7('0x3b')](_0x4e2071)&&typeof _0x4e2071!==_0x3cc7('0x162')){return _0x81aff1(msgResponse('[callProgressDetecting]',_0x3cc7('0x13d'),_0x3cc7('0x1a4')));}if(_[_0x3cc7('0x3b')](_0x2e7b05)&&typeof _0x2e7b05!=='object'){return _0x81aff1(msgResponse(_0x3cc7('0x1a5'),_0x3cc7('0x13d'),_0x3cc7('0x1a6')));}switch(_0x2e7b05['reason']){case'0':_0x4e2071[_0x3cc7('0x67')]+=0x1;_0x2ebe90['state']=0x0;_0x2ebe90[_0x3cc7('0xe7')]='NoSuchNumber';_0x2ebe90[_0x3cc7('0xee')]+=0x1;_0x2ebe90[_0x3cc7('0xfa')]+=0x1;ami[_0x3cc7('0xe2')](_0x3cc7('0x1a7'),ut[_0x3cc7('0xe4')](_0x2b0051,_0x3cc7('0x1a8')));_0x2b6805['createHistory'](_0x2ebe90)[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0xeb')));if(_0x2b6805[_0x3cc7('0x196')](0x0,_0x2b0051,_0x4e2071)){if(_0x2ebe90[_0x3cc7('0xee')]>=_0x4e2071[_0x3cc7('0x1a9')]){_0x2b6805[_0x3cc7('0xfd')](_0x2ebe90,_0x1b26ec,_0x81aff1,_0x3cc7('0x1aa'));}else{_0x2b6805[_0x3cc7('0xf1')](_0x2ebe90,_0x1b26ec,_0x81aff1,_0x3cc7('0x1aa'));}}break;case'3':_0x4e2071['outboundNoAnswerCallsDay']+=0x1;_0x2ebe90[_0x3cc7('0xa7')]=0x3;_0x2ebe90[_0x3cc7('0xe7')]='NoAnswer';_0x2ebe90[_0x3cc7('0xed')]+=0x1;_0x2ebe90[_0x3cc7('0xfa')]+=0x1;ami[_0x3cc7('0xe2')](_0x3cc7('0x1ab'),ut[_0x3cc7('0xe4')](_0x2b0051,'noanswer'));_0x2b6805['createHistory'](_0x2ebe90)[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x1ac')));if(_0x2b6805[_0x3cc7('0x196')](0x3,_0x2b0051,_0x4e2071)){if(_0x2ebe90[_0x3cc7('0xed')]>=_0x4e2071[_0x3cc7('0x197')]){_0x2b6805[_0x3cc7('0xfd')](_0x2ebe90,_0x1b26ec,_0x81aff1,'reason\x203\x20ringing\x20no\x20answer');}else{_0x2b6805[_0x3cc7('0xf1')](_0x2ebe90,_0x1b26ec,_0x81aff1,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x4e2071['outboundBusyCallsDay']+=0x1;_0x2ebe90[_0x3cc7('0xa7')]=0x5;_0x2ebe90[_0x3cc7('0xe7')]=_0x3cc7('0x1ad');_0x2ebe90['countbusyretry']+=0x1;_0x2ebe90[_0x3cc7('0xfa')]+=0x1;ami[_0x3cc7('0xe2')](_0x3cc7('0x1ae'),ut['buildObj'](_0x2b0051,_0x3cc7('0x1af')));_0x2b6805[_0x3cc7('0xc8')](_0x2ebe90)[_0x3cc7('0xb7')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2b6805['checkRetriveMax'](0x5,_0x2b0051,_0x4e2071)){if(_0x2ebe90[_0x3cc7('0xec')]>=_0x4e2071['dialBusyMaxRetry']){_0x2b6805[_0x3cc7('0xfd')](_0x2ebe90,_0x1b26ec,_0x81aff1,_0x3cc7('0x1b0'));}else{_0x2b6805[_0x3cc7('0xf1')](_0x2ebe90,_0x1b26ec,_0x81aff1,_0x3cc7('0x1b0'));}}break;case'8':_0x4e2071[_0x3cc7('0x63')]+=0x1;_0x2ebe90['state']=0x8;_0x2ebe90[_0x3cc7('0xe7')]=_0x3cc7('0x1b1');_0x2ebe90[_0x3cc7('0x19d')]+=0x1;_0x2ebe90[_0x3cc7('0xfa')]+=0x1;ami[_0x3cc7('0xe2')](_0x3cc7('0x1b2'),ut[_0x3cc7('0xe4')](_0x2b0051,_0x3cc7('0x1b3')));_0x2b6805['createHistory'](_0x2ebe90)[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x1b4')));if(_0x2b6805[_0x3cc7('0x196')](0x8,_0x2b0051,_0x4e2071)){if(_0x2ebe90[_0x3cc7('0x19d')]>=_0x4e2071[_0x3cc7('0x19c')]){_0x2b6805['createStateFinal'](_0x2ebe90,_0x1b26ec,_0x81aff1,_0x3cc7('0x1b5'));}else{_0x2b6805['stateGlobal'](_0x2ebe90,_0x1b26ec,_0x81aff1,_0x3cc7('0x1b5'));}}break;case'11':_0x4e2071[_0x3cc7('0x1b6')]+=0x1;_0x2ebe90['state']=0xb;_0x2ebe90['statedesc']='Abandoned';_0x2ebe90['countabandonedretry']+=0x1;_0x2ebe90[_0x3cc7('0xfa')]+=0x1;_0x2b6805[_0x3cc7('0xc8')](_0x2ebe90)[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x11f')));if(_0x2b6805[_0x3cc7('0x196')](0xb,_0x2b0051,_0x4e2071)){if(_0x2ebe90['countabandonedretry']>=_0x4e2071[_0x3cc7('0x11c')]){_0x2b6805['createStateFinal'](_0x2ebe90,_0x1b26ec,_0x81aff1,_0x3cc7('0x1b7'));}else{_0x2b6805[_0x3cc7('0xf1')](_0x2ebe90,_0x1b26ec,_0x81aff1,_0x3cc7('0x1b7'));}}break;case'20':_0x4e2071[_0x3cc7('0x6a')]+=0x1;_0x2ebe90[_0x3cc7('0xa7')]=0x14;_0x2ebe90[_0x3cc7('0xe7')]='AgentReject';_0x2ebe90[_0x3cc7('0xf0')]+=0x1;_0x2ebe90['countglobal']+=0x1;ami[_0x3cc7('0xe2')]('custom:agentreject',ut['buildObj'](_0x2b0051,_0x3cc7('0x1b8')));_0x2b6805[_0x3cc7('0xc8')](_0x2ebe90)['catch'](loggerCatch(_0x3cc7('0x1b9')));if(_0x2b6805[_0x3cc7('0x196')](0x14,_0x2b0051,_0x4e2071)){if(_0x2ebe90[_0x3cc7('0xf0')]>=_0x4e2071[_0x3cc7('0x1a3')]){_0x2b6805[_0x3cc7('0xfd')](_0x2ebe90,_0x1b26ec,_0x81aff1,_0x3cc7('0x1ba'));}else{_0x2b6805[_0x3cc7('0xf1')](_0x2ebe90,_0x1b26ec,_0x81aff1,_0x3cc7('0x1ba'));}}break;default:_0x4e2071[_0x3cc7('0x6b')]+=0x1;_0x2ebe90[_0x3cc7('0xa7')]=0xc;_0x2ebe90['statedesc']=_0x2e7b05[_0x3cc7('0x107')];_0x2b6805[_0x3cc7('0xc8')](_0x2ebe90)[_0x3cc7('0xb7')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x2b6805[_0x3cc7('0x196')](_0x2e7b05[_0x3cc7('0x107')],_0x2b0051,_0x4e2071)){if(_0x2ebe90[_0x3cc7('0xec')]+_0x2ebe90['countcongestionretry']+_0x2ebe90[_0x3cc7('0xed')]+_0x2ebe90[_0x3cc7('0xee')]+_0x2ebe90[_0x3cc7('0xef')]+_0x2ebe90[_0x3cc7('0xfb')]+_0x2ebe90[_0x3cc7('0xea')]+_0x2ebe90[_0x3cc7('0xf0')]>=_0x4e2071[_0x3cc7('0xfc')]){_0x2b6805['stateGlobal'](_0x2ebe90,_0x1b26ec,_0x81aff1,_0x2e7b05[_0x3cc7('0x107')]);}else{_0x2b6805['createStateFinal'](_0x2ebe90,_0x1b26ec,_0x81aff1,_0x2e7b05[_0x3cc7('0x107')]);}}}});};Dialer[_0x3cc7('0x1b')][_0x3cc7('0xf1')]=function(_0x22d7ae,_0x2a6538,_0x326d05,_0x34f45a){var _0x25899d=new Final(_0x22d7ae);_0x25899d[_0x3cc7('0xa7')]=0xf;_0x25899d[_0x3cc7('0xe7')]=_0x3cc7('0x1bb');this[_0x3cc7('0xfd')](_0x25899d,_0x2a6538,_0x326d05,_0x34f45a);};Dialer[_0x3cc7('0x1b')][_0x3cc7('0xfd')]=function(_0x1ebe51,_0x59ffbf,_0x17fd98,_0x2cf06c){this[_0x3cc7('0xc7')](_0x1ebe51)[_0x3cc7('0xb6')](function(){return _0x59ffbf(msgResponse(_0x3cc7('0x1a5'),_0x3cc7('0xd6'),_0x2cf06c));})[_0x3cc7('0xb7')](function(){return _0x17fd98(msgResponse(_0x3cc7('0x1bc'),_0x3cc7('0x13d'),_0x3cc7('0x1bd')));});};Dialer['prototype'][_0x3cc7('0x7')]=function(_0xad8bf0){var _0x17f98d=_0xad8bf0[_0x3cc7('0x1be')]/0x64;var _0x349285=_0xad8bf0[_0x3cc7('0x65')]/(_0xad8bf0['outboundDropCallsDayTimeout']+_0xad8bf0['outboundAnswerCallsDay']);var _0x2fcb71=Math[_0x3cc7('0x1bf')](_0xad8bf0[_0x3cc7('0x74')]*(_0xad8bf0[_0x3cc7('0x1c0')]/0x64));var _0x1e0dab=Math['round'](_0xad8bf0[_0x3cc7('0x74')]*(_0xad8bf0[_0x3cc7('0x1c1')]/0x64));var _0x256d64=_0xad8bf0['available']+_0xad8bf0[_0x3cc7('0x54')];var _0x58da12=Math[_0x3cc7('0x1c2')](_0xad8bf0[_0x3cc7('0x77')]*_0xad8bf0[_0x3cc7('0x79')]*_0xad8bf0[_0x3cc7('0x71')]*_0xad8bf0[_0x3cc7('0x72')]);if(_[_0x3cc7('0x3b')](_0xad8bf0[_0x3cc7('0x7b')])){if(!_['isUndefined'](_0xad8bf0[_0x3cc7('0x29')])){_0xad8bf0[_0x3cc7('0x29')]=undefined;loggerPredictive[_0x3cc7('0x97')](_0x3cc7('0x1c3'),_0x3cc7('0x1c4'));}if(!_[_0x3cc7('0x3b')](_0xad8bf0[_0x3cc7('0x91')])){loggerPredictive['error'](_0x3cc7('0x1c3'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0xad8bf0[_0x3cc7('0x91')]);_0xad8bf0['handlePredictive']=undefined;}_0xad8bf0[_0x3cc7('0x7b')]=moment()[_0x3cc7('0x7e')](_0x3cc7('0xf5'));loggerPredictive[_0x3cc7('0x83')](_0xad8bf0[_0x3cc7('0x3e')],'collection\x20data\x20in\x20progressive\x20at',_0xad8bf0[_0x3cc7('0x7b')]);this['handlePower'](_0xad8bf0,0x1);}else if(ifInterval(_0xad8bf0['dialPredictiveInterval'],_0xad8bf0[_0x3cc7('0x7b')])){this[_0x3cc7('0x153')](_0xad8bf0,0x1);loggerPredictiveCalls['info'](_0x3cc7('0x1c5'),_0xad8bf0[_0x3cc7('0x7b')],_0xad8bf0[_0x3cc7('0x3e')]);_0xad8bf0[_0x3cc7('0x77')]=0x0;_0xad8bf0[_0x3cc7('0x70')]=0x0;}else if(_0x17f98d<_0x349285&&_0xad8bf0[_0x3cc7('0x1c6')]===_0x3cc7('0x1c7')){freeVariablesPredictive(_0xad8bf0);loggerPredictive['info'](_0x3cc7('0x1c8'),_0x3cc7('0x1c9'),_0x349285,_0x3cc7('0x7b'),_0xad8bf0[_0x3cc7('0x3e')]);}else if(_0x58da12<_0xad8bf0[_0x3cc7('0x70')]&&_0xad8bf0[_0x3cc7('0x1c6')]===_0x3cc7('0x1c7')){freeVariablesPredictive(_0xad8bf0);loggerPredictive['info'](_0x3cc7('0x1ca'),_0x3cc7('0x1cb'),_0x58da12,_0x3cc7('0x1cc'),_0xad8bf0[_0x3cc7('0x70')],_0x3cc7('0x7b'),_0xad8bf0[_0x3cc7('0x3e')]);}else if(!ifInterval(_0xad8bf0[_0x3cc7('0x1cd')],_0xad8bf0[_0x3cc7('0x7b')])&&_[_0x3cc7('0x3b')](_0xad8bf0[_0x3cc7('0x29')])&&!_[_0x3cc7('0x3b')](_0xad8bf0[_0x3cc7('0x7b')])){_0xad8bf0[_0x3cc7('0x29')]=moment()['format'](_0x3cc7('0xf5'));loggerPredictive['info'](_0xad8bf0[_0x3cc7('0x3e')],_0x3cc7('0x1ce'),_0xad8bf0[_0x3cc7('0x29')]);this[_0x3cc7('0xbc')](_0xad8bf0['dialPredictiveInterval'])[_0x3cc7('0xb6')](this['getDataPredictive'](_0xad8bf0))[_0x3cc7('0xb6')](mergeDataErlangB(_0xad8bf0))[_0x3cc7('0xb6')](this['startMethodPredictive'](_0xad8bf0))[_0x3cc7('0xb7')](loggerCatchPredictive(_0x3cc7('0x1cf'),_0xad8bf0));}else if(!ifInterval(_0xad8bf0[_0x3cc7('0x1cd')],_0xad8bf0[_0x3cc7('0x29')])){_0xad8bf0[_0x3cc7('0x70')]=0x0;_0xad8bf0[_0x3cc7('0x29')]=moment()[_0x3cc7('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0xad8bf0[_0x3cc7('0x3e')],'recalculate\x20predictive\x20at',_0xad8bf0['startPredictive']);clearInterval(_0xad8bf0[_0x3cc7('0x91')]);_0xad8bf0[_0x3cc7('0x91')]=undefined;this[_0x3cc7('0xbc')](_0xad8bf0[_0x3cc7('0x1cd')])[_0x3cc7('0xb6')](this[_0x3cc7('0x1d0')](_0xad8bf0))[_0x3cc7('0xb6')](mergeDataErlangB(_0xad8bf0))[_0x3cc7('0xb6')](this[_0x3cc7('0x1d1')](_0xad8bf0))[_0x3cc7('0xb7')](loggerCatchPredictive(_0x3cc7('0x1d2'),_0xad8bf0));}else if(_0xad8bf0[_0x3cc7('0x74')]&&_0x256d64<_0xad8bf0['predictiveIntervalAvailable']-_0x1e0dab){freeVariablesPredictive(_0xad8bf0);loggerPredictive['info'](_0xad8bf0['name'],_0x3cc7('0x1d3'),_0x256d64,_0x3cc7('0x1d4'),_0xad8bf0[_0x3cc7('0x74')],'-',_0x1e0dab,'=',_0xad8bf0[_0x3cc7('0x74')]-_0x1e0dab,')');}else if(_0xad8bf0['predictiveIntervalAvailable']&&_0x256d64>_0xad8bf0[_0x3cc7('0x74')]+_0x2fcb71){freeVariablesPredictive(_0xad8bf0);loggerPredictive['info'](_0xad8bf0[_0x3cc7('0x3e')],_0x3cc7('0x1d3'),_0x256d64,_0x3cc7('0x1d5'),_0xad8bf0['predictiveIntervalAvailable'],'+',_0x2fcb71,'=',_0xad8bf0[_0x3cc7('0x74')]+_0x2fcb71,')');}};Dialer['prototype'][_0x3cc7('0x1d0')]=function(_0x277e1b){var _0x149e44=this;return function(_0x56ea60){return new BPromise(function(_0x1b8806,_0x1b9616){_['merge'](_0x277e1b,_0x56ea60[0x0]);if(checkGetDataPredictive(_0x56ea60[0x0])){var _0xc6ec97=_0x277e1b[_0x3cc7('0x74')]=_0x277e1b[_0x3cc7('0x54')]+_0x277e1b['available'];var _0x81f926=_0x277e1b[_0x3cc7('0x1cd')]*0x3c;var _0x44fe0c=_0x56ea60[0x0][_0x3cc7('0x6d')]+_0x56ea60[0x0]['predictiveIntervalAvgHoldtime'];var _0x492e11=(_0x56ea60[0x0][_0x3cc7('0x85')]+_0x56ea60[0x0][_0x3cc7('0x6e')]+_0x56ea60[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x56ea60[0x0][_0x3cc7('0x75')];_0x277e1b['predictiveIntervalHitRate']=_0x492e11>0x0?_0x492e11:0x1;switch(_0x277e1b[_0x3cc7('0x1c6')]){case _0x3cc7('0x1c7'):var _0x32263d=_0x277e1b[_0x3cc7('0x1be')]/0x64;return _0x149e44[_0x3cc7('0x1d6')](_0xc6ec97,_0x81f926,_0x44fe0c,_0x492e11,_0x32263d)[_0x3cc7('0xb6')](function(_0x3adae8){return _0x1b8806(_0x3adae8);});case'agentBusyFactor':var _0x179743=_0x277e1b[_0x3cc7('0x1be')]/0x64;return _0x149e44[_0x3cc7('0x1d7')](_0xc6ec97,_0x81f926,_0x44fe0c,_0x492e11,_0x179743)['then'](function(_0x513718){return _0x1b8806(_0x513718);});default:return _0x1b9616(msgResponse(_0x3cc7('0x1d8'),_0x3cc7('0x13d'),'Unknown\x20Predictive'));}}else{return _0x1b9616(msgResponse(_0x3cc7('0x1d8'),_0x3cc7('0x13d'),_0x3cc7('0x1d9')));}});};};Dialer[_0x3cc7('0x1b')][_0x3cc7('0x1da')]=function(_0x594b7e){var _0x38debe=this;return function(_0x55a840){return new BPromise(function(_0x172c13,_0x15b41d){_['merge'](_0x594b7e,_0x55a840[0x0]);if(checkGetDataPredictive(_0x55a840[0x0])){loggerPredictive['info'](JSON[_0x3cc7('0x48')](_0x55a840[0x0]));if(_0x594b7e[_0x3cc7('0x1c6')]===_0x3cc7('0x1c7')){return _0x38debe[_0x3cc7('0xc5')](_0x594b7e['id'])[_0x3cc7('0xb6')](function(_0x53c4c2){var _0x27bb4d=_0x594b7e['loggedIn']-_0x53c4c2[0x0][_0x3cc7('0x1db')];var _0x3832fe=_0x594b7e[_0x3cc7('0x1cd')]*0x3c;var _0x50476c=_0x55a840[0x0]['predictiveIntervalAvgTalktime']+_0x55a840[0x0]['predictiveIntervalAvgHoldtime'];var _0x359ac3=(_0x55a840[0x0]['predictiveIntervalAnsweredCalls']+_0x55a840[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x55a840[0x0][_0x3cc7('0x88')])/_0x55a840[0x0][_0x3cc7('0x75')];var _0x495157=_0x594b7e[_0x3cc7('0x1be')]/0x64;_0x594b7e[_0x3cc7('0x73')]=_0x53c4c2[0x0][_0x3cc7('0x1db')]||0x0;_0x594b7e[_0x3cc7('0x71')]=_0x359ac3>0x0?_0x359ac3:0x1;return _0x38debe[_0x3cc7('0x1d6')](_0x27bb4d,_0x3832fe,_0x50476c,_0x359ac3,_0x495157);})[_0x3cc7('0xb6')](function(_0x2b33be){return _0x172c13(_0x2b33be);})[_0x3cc7('0xb7')](function(_0xca3099){return _0x15b41d(msgResponse(_0x3cc7('0x1dc'),_0x3cc7('0x13d'),JSON['stringify'](_0xca3099)));});}if(_0x594b7e[_0x3cc7('0x1c6')]===_0x3cc7('0x1dd')){return _0x38debe[_0x3cc7('0xc5')](_0x594b7e['id'])[_0x3cc7('0xb6')](function(_0x14b3cf){var _0x1fdd55=_0x594b7e[_0x3cc7('0x50')]-_0x14b3cf[0x0][_0x3cc7('0x1db')];var _0x17a882=_0x594b7e[_0x3cc7('0x1cd')]*0x3c;var _0x37f40d=_0x55a840[0x0][_0x3cc7('0x6d')]+_0x55a840[0x0][_0x3cc7('0x6c')];var _0x2d8fcf=(_0x55a840[0x0]['predictiveIntervalAnsweredCalls']+_0x55a840[0x0][_0x3cc7('0x6e')]+_0x55a840[0x0][_0x3cc7('0x88')])/_0x55a840[0x0][_0x3cc7('0x75')];var _0x3a2452=_0x594b7e[_0x3cc7('0x1be')]/0x64;_0x594b7e[_0x3cc7('0x73')]=_0x14b3cf[0x0]['outboundQueuePauses']||0x0;_0x594b7e[_0x3cc7('0x71')]=_0x2d8fcf>0x0?_0x2d8fcf:0x1;return _0x38debe[_0x3cc7('0x1d7')](_0x1fdd55,_0x17a882,_0x37f40d,_0x2d8fcf,_0x3a2452);})['then'](function(_0x4fc644){return _0x172c13(_0x4fc644);})[_0x3cc7('0xb7')](function(_0x43b025){return _0x15b41d(msgResponse(_0x3cc7('0x1dc'),_0x3cc7('0x13d'),JSON[_0x3cc7('0x48')](_0x43b025)));});}}else{return _0x15b41d(msgResponse('[getDataPredictive]',_0x3cc7('0x13d'),_0x3cc7('0x1d9')));}});};};Dialer[_0x3cc7('0x1b')][_0x3cc7('0x1d1')]=function(_0x241395){var _0x2fda6f=this;return function(){var _0x5d3339=0x0;var _0x15b69f=Math[_0x3cc7('0x1c2')](_0x241395[_0x3cc7('0x78')]*0x3e8);if(_0x15b69f>0x0){_0x15b69f=_0x15b69f<0x64?0x64:_0x15b69f;loggerPredictive[_0x3cc7('0x83')](_0x241395[_0x3cc7('0x3e')],_0x3cc7('0x1de'),_0x15b69f,_0x3cc7('0x49'));_0x241395[_0x3cc7('0x91')]=setInterval(function(){_0x2fda6f[_0x3cc7('0x91')](_0x241395);loggerPredictiveCalls[_0x3cc7('0x83')](_0x3cc7('0x1df'),_0x5d3339+=0x1);},_0x15b69f);}else{loggerPredictive['info'](_0x241395[_0x3cc7('0x3e')],_0x3cc7('0x1e0'));}};};Dialer[_0x3cc7('0x1b')]['checkContactBlack']=function(_0x22bb9b,_0x164b37){var _0x1dfe01=this;return function(_0x1227bc){if(_[_0x3cc7('0x45')](_0x1227bc)){if(_[_0x3cc7('0xad')](_0x164b37[_0x3cc7('0xd2')])||!_0x164b37[_0x3cc7('0x1e1')]){if(_0x22bb9b[_0x3cc7('0x5b')]===_0x3cc7('0x6')){_0x22bb9b[_0x3cc7('0x126')]=_[_0x3cc7('0x3b')](_0x22bb9b[_0x3cc7('0x126')])?!![]:_0x22bb9b[_0x3cc7('0x126')];var _0x4e704d=uuid['v4']();_0x1dfe01['actions'][_0x4e704d]=new Action(_0x22bb9b,_0x164b37,_0x4e704d);loggerBooked[_0x3cc7('0x83')]('[booked][checkContactBlack]',_0x4e704d,_0x3cc7('0x1e2'),JSON[_0x3cc7('0x48')](_0x22bb9b[_0x3cc7('0x126')]),_0x3cc7('0x1e3'),_0x22bb9b['name']);if(_0x22bb9b['queueStatusComplete']){_0x22bb9b[_0x3cc7('0x126')]=![];_0x1dfe01['queueBooked'][_0x1dfe01['actions'][_0x4e704d][_0x3cc7('0xb2')]]=[];ami[_0x3cc7('0x144')]({'actionid':_0x4e704d,'action':'queuestatus','queue':_0x22bb9b[_0x3cc7('0x3e')]})[_0x3cc7('0xb7')](function(){_0x1dfe01[_0x3cc7('0xb1')](_0x22bb9b);_0x1dfe01[_0x3cc7('0xbe')]({'active':![],'ContactId':_0x1dfe01[_0x3cc7('0x26')][_0x4e704d][_0x3cc7('0xd0')],'ListId':_0x1dfe01[_0x3cc7('0x26')][_0x4e704d][_0x3cc7('0xd1')],'VoiceQueueId':_0x1dfe01[_0x3cc7('0x26')][_0x4e704d]['VoiceQueueId']||undefined,'CampaignId':_0x1dfe01[_0x3cc7('0x26')][_0x4e704d][_0x3cc7('0xd4')]||undefined})['catch'](loggerCatch(_0x3cc7('0x1e4')));delete _0x1dfe01[_0x3cc7('0x26')][_0x4e704d];});}else{loggerBooked[_0x3cc7('0x83')]('[booked][checkContactBlack][else]',JSON[_0x3cc7('0x48')](_0x22bb9b[_0x3cc7('0x126')]),_0x3cc7('0x1e3'),_0x22bb9b[_0x3cc7('0x3e')]);_0x1dfe01[_0x3cc7('0xb1')](_0x22bb9b);_0x1dfe01['rescheduleContact']({'active':![],'ContactId':_0x1dfe01[_0x3cc7('0x26')][_0x4e704d][_0x3cc7('0xd0')],'ListId':_0x1dfe01[_0x3cc7('0x26')][_0x4e704d]['ListId'],'VoiceQueueId':_0x1dfe01[_0x3cc7('0x26')][_0x4e704d][_0x3cc7('0xd3')]||undefined,'CampaignId':_0x1dfe01[_0x3cc7('0x26')][_0x4e704d][_0x3cc7('0xd4')]||undefined})[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x1e4')));delete _0x1dfe01[_0x3cc7('0x26')][_0x4e704d];}}else{return _0x1dfe01[_0x3cc7('0x161')](_0x22bb9b,_0x164b37);}}else{if(getDiff(_0x164b37[_0x3cc7('0x1e5')])<_0x22bb9b['dialRecallMeTimeout']*0x3c){if(_0x164b37['Agent']&&!_0x164b37[_0x3cc7('0x1e6')][_0x3cc7('0x1e7')]){_0x1dfe01[_0x3cc7('0x20')][_0x3cc7('0x130')](_0x164b37['id'])[_0x3cc7('0x1e')](function(){_0x1dfe01[_0x3cc7('0xb1')](_0x22bb9b);});}else{_0x1dfe01[_0x3cc7('0xbf')]({'active':![]},_0x164b37['id'],0x1)[_0x3cc7('0x1e')](function(){_0x1dfe01[_0x3cc7('0xb1')](_0x22bb9b);});}}else{_0x22bb9b[_0x3cc7('0x69')]+=0x1;_0x1dfe01['updateOriginated'](_0x22bb9b);if(_0x22bb9b[_0x3cc7('0x1e8')]){_0x1dfe01['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x164b37['ContactId'],'ListId':_0x164b37['ListId'],'VoiceQueueId':_0x164b37[_0x3cc7('0xd3')]||undefined,'CampaignId':_0x164b37[_0x3cc7('0xd4')]||undefined})['catch'](loggerCatch(_0x3cc7('0x1e9')));_0x1dfe01['createHistory'](createObjHistory(_0x22bb9b,_0x164b37,_0x3cc7('0x1ea'),0x17,_0x3cc7('0x1eb')))['catch'](loggerCatch(_0x3cc7('0x1ec')));}else{_0x1dfe01[_0x3cc7('0xce')](createObjHistory(_0x22bb9b,_0x164b37,_0x3cc7('0x1ed'),0x16,_0x3cc7('0x1ee')),_0x3cc7('0x1ef'),_0x3cc7('0x1f0'));}}}}else{_0x22bb9b[_0x3cc7('0x61')]+=0x1;_0x1dfe01[_0x3cc7('0xce')](createObjHistory(_0x22bb9b,_0x164b37,_0x3cc7('0x1f1'),0xd,_0x3cc7('0x1f2')),_0x3cc7('0x1f3'),_0x3cc7('0x1f4'));throw _0x3cc7('0x1f5');}};};Dialer[_0x3cc7('0x1b')][_0x3cc7('0x157')]=function(_0x5c1c63){var _0x4b1877=this;var _0xdff9ea=_0x5c1c63[_0x3cc7('0x1f6')]-_0x5c1c63[_0x3cc7('0x76')]-_0x5c1c63[_0x3cc7('0xc2')];emitCampaignSummary(_0x5c1c63);if(_0xdff9ea>0x0){if(_0xdff9ea>this[_0x3cc7('0x25')]){_0xdff9ea=this[_0x3cc7('0x25')];}_0x5c1c63[_0x3cc7('0xc2')]+=_0xdff9ea;this[_0x3cc7('0xc3')](_0x5c1c63['id'],_0xdff9ea,_0x5c1c63[_0x3cc7('0x1f7')],_0x5c1c63)[_0x3cc7('0xb6')](function(_0x2e4028){_0x5c1c63[_0x3cc7('0xc2')]-=_0xdff9ea;_0x5c1c63[_0x3cc7('0xc2')]=_0x5c1c63['temp']>0x0?_0x5c1c63[_0x3cc7('0xc2')]:0x0;if(!checkContactEmpty(_0x2e4028)){_0x5c1c63[_0x3cc7('0x3c')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x3cc7('0x83')]('[getContactCampaign2][Empty]'+_0x5c1c63[_0x3cc7('0x3e')]);}else{_0x5c1c63[_0x3cc7('0x76')]+=_0x2e4028[_0x3cc7('0x98')];_0x5c1c63['message']=_0x3cc7('0x1f8');for(var _0xb37482=0x0;_0xb37482<_0x2e4028['length'];_0xb37482+=0x1){_0x5c1c63[_0x3cc7('0x1f9')]+=0x1;if(_[_0x3cc7('0xad')](_0x2e4028[_0xb37482])||_['isNil'](_0x2e4028[_0xb37482][_0x3cc7('0x165')])||_['isNil'](_0x2e4028[_0xb37482][_0x3cc7('0x165')][_0x3cc7('0x166')])){_0x4b1877[_0x3cc7('0xcd')](_0x3cc7('0x1fa'),_0x5c1c63,_0x2e4028[_0xb37482]);}else{_0x4b1877[_0x3cc7('0xba')](_[_0x3cc7('0x129')](_0x2e4028[_0xb37482],[_0x3cc7('0xd4'),'Contact.phone']))[_0x3cc7('0xb6')](_0x4b1877['checkContactBlack'](_0x5c1c63,_0x2e4028[_0xb37482]))[_0x3cc7('0xb7')](_0x4b1877[_0x3cc7('0xcc')](_0x3cc7('0x1fb'),_0x5c1c63));}}}})[_0x3cc7('0xb7')](loggerGetContactDialer('[getContactCampaign2]',_0x5c1c63,_0xdff9ea));}};Dialer[_0x3cc7('0x1b')][_0x3cc7('0x153')]=function(_0x3a3d3f,_0x5b6483){var _0x419f20=this;var _0x5dc0b4=[];var _0x464ca0=_0x5b6483>=0x1?_0x5b6483:0x1;if(_0x3a3d3f[_0x3cc7('0x5b')]==='booked'){_0x464ca0=0x1;}var _0x1d7027=Math[_0x3cc7('0x1c2')](_0x3a3d3f[_0x3cc7('0x4f')]*_0x464ca0)-_0x3a3d3f['originated']-_0x3a3d3f[_0x3cc7('0xc2')];emitVoiceQueueSummary(_0x3a3d3f);if(_0x3a3d3f[_0x3cc7('0x1fc')]>0x0){var _0xef46a5=_0x3a3d3f[_0x3cc7('0x1fc')]-_0x3a3d3f[_0x3cc7('0x76')]-_0x3a3d3f['talking']-_0x3a3d3f[_0x3cc7('0xc2')]-_0x3a3d3f[_0x3cc7('0x51')];if(_0x1d7027>_0xef46a5){_0x1d7027=_0xef46a5;}}if(_0x1d7027>0x0){if(_0x3a3d3f[_0x3cc7('0x5b')]==='booked'){_0x1d7027=0x1;}if(_0x1d7027>this[_0x3cc7('0x25')]){_0x1d7027=this[_0x3cc7('0x25')];}_0x3a3d3f[_0x3cc7('0xc2')]+=_0x1d7027;for(var _0x3bfbc6 in this[_0x3cc7('0x23')]){if(typeof this[_0x3cc7('0x23')][_0x3bfbc6]!==_0x3cc7('0x99')){if(this[_0x3cc7('0x23')][_0x3bfbc6][_0x3cc7('0xa7')]===_0x3cc7('0x1fd')&&this[_0x3cc7('0x23')][_0x3bfbc6][_0x3cc7('0xae')]===_0x3cc7('0xd8')){_0x5dc0b4['push'](this[_0x3cc7('0x23')][_0x3bfbc6]['id']);}}}this[_0x3cc7('0xc1')](_0x3a3d3f['id'],_0x5dc0b4,_0x1d7027,_0x3a3d3f['dialOrderByScheduledAt'],_0x3a3d3f)[_0x3cc7('0xb6')](function(_0x27e8cc){_0x3a3d3f[_0x3cc7('0xc2')]-=_0x1d7027;_0x3a3d3f[_0x3cc7('0xc2')]=_0x3a3d3f[_0x3cc7('0xc2')]>0x0?_0x3a3d3f['temp']:0x0;if(!checkContactEmpty(_0x27e8cc)){_0x419f20[_0x3cc7('0xb4')](_0x3a3d3f)[_0x3cc7('0xb6')](sendMessageReschedule(_0x3a3d3f))[_0x3cc7('0xb7')](loggerCatch('[countReScheduled]\x20'));}else{_0x3a3d3f['originated']+=_0x27e8cc['length'];_0x3a3d3f[_0x3cc7('0x3c')]=_0x3a3d3f['dialMethod']==='booked'?_0x3cc7('0x16d'):_0x3cc7('0x1f8');for(var _0x5bad2e=0x0;_0x5bad2e<_0x27e8cc[_0x3cc7('0x98')];_0x5bad2e+=0x1){if(_[_0x3cc7('0xad')](_0x27e8cc[_0x5bad2e])||_[_0x3cc7('0xad')](_0x27e8cc[_0x5bad2e][_0x3cc7('0x165')])||_[_0x3cc7('0xad')](_0x27e8cc[_0x5bad2e][_0x3cc7('0x165')][_0x3cc7('0x166')])){_0x419f20[_0x3cc7('0xcd')](_0x3cc7('0x1fa'),_0x3a3d3f,_0x27e8cc[_0x5bad2e]);}else{_0x419f20[_0x3cc7('0xb8')](_[_0x3cc7('0x129')](_0x27e8cc[_0x5bad2e],[_0x3cc7('0xd3'),_0x3cc7('0x1fe')]))[_0x3cc7('0xb6')](_0x419f20[_0x3cc7('0x1ff')](_0x3a3d3f,_0x27e8cc[_0x5bad2e]))[_0x3cc7('0xb7')](_0x419f20['loggerHandler'](_0x3cc7('0x1fa'),_0x3a3d3f));}}}})[_0x3cc7('0xb7')](loggerGetContactDialer(_0x3cc7('0x200'),_0x3a3d3f,_0x1d7027));}};Dialer[_0x3cc7('0x1b')][_0x3cc7('0x91')]=function(_0x1630ba){if(_0x1630ba[_0x3cc7('0x1fc')]>0x0){var _0x4ab8bc=_0x1630ba[_0x3cc7('0x1fc')]-_0x1630ba[_0x3cc7('0x76')]-_0x1630ba[_0x3cc7('0x54')];if(_0x4ab8bc>0x0){this[_0x3cc7('0x201')](_0x1630ba);}else{loggerPredictiveCalls[_0x3cc7('0x83')]('[handlePredictive][limitChannel]');}}else{this[_0x3cc7('0x201')](_0x1630ba);}};Dialer['prototype'][_0x3cc7('0x201')]=function(_0x3cb0c7){var _0x5067d9=this;var _0x17c29f=[];_0x3cb0c7[_0x3cc7('0x76')]+=0x1;for(var _0x3c4501 in this[_0x3cc7('0x23')]){if(typeof this[_0x3cc7('0x23')][_0x3c4501]!==_0x3cc7('0x99')){if(this[_0x3cc7('0x23')][_0x3c4501]['state']===_0x3cc7('0x1fd')&&this[_0x3cc7('0x23')][_0x3c4501][_0x3cc7('0xae')]===_0x3cc7('0xd8')){_0x17c29f[_0x3cc7('0x124')](this[_0x3cc7('0x23')][_0x3c4501]['id']);}}}this[_0x3cc7('0xc1')](_0x3cb0c7['id'],_0x17c29f,0x1,_0x3cb0c7[_0x3cc7('0x1f7')],_0x3cb0c7)[_0x3cc7('0xb6')](function(_0x1fd258){if(!checkContactEmpty(_0x1fd258)){checkContactLowerLimitOriginate(_0x3cb0c7,0x1,0x0);_0x5067d9[_0x3cc7('0xb4')](_0x3cb0c7)[_0x3cc7('0xb6')](sendMessageReschedule(_0x3cb0c7))[_0x3cc7('0xb7')](loggerCatch(_0x3cc7('0x202')));}else{_0x3cb0c7[_0x3cc7('0x3c')]=_0x3cc7('0x1f8');if(_[_0x3cc7('0xad')](_0x1fd258[0x0])||_['isNil'](_0x1fd258[0x0][_0x3cc7('0x165')])||_[_0x3cc7('0xad')](_0x1fd258[0x0]['Contact'][_0x3cc7('0x166')])){_0x5067d9[_0x3cc7('0xcd')](_0x3cc7('0x1fa'),_0x3cb0c7,_0x1fd258[0x0]);}else{_0x5067d9[_0x3cc7('0xb8')](_[_0x3cc7('0x129')](_0x1fd258[0x0],[_0x3cc7('0xd3'),_0x3cc7('0x1fe')]))[_0x3cc7('0xb6')](_0x5067d9[_0x3cc7('0x1ff')](_0x3cb0c7,_0x1fd258[0x0]))[_0x3cc7('0xb7')](_0x5067d9[_0x3cc7('0xcc')](_0x3cc7('0x203'),_0x3cb0c7));}}})[_0x3cc7('0xb7')](loggerGetContactDialer('[getContactDialerPredictive]',_0x3cb0c7,0x1));emitVoiceQueueSummary(_0x3cb0c7);};Dialer[_0x3cc7('0x1b')]['abandonmentRate']=function(_0x393241,_0x587578,_0x434746,_0x416aa8,_0x1d3987,_0x4a7730){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x3cc7('0x83')](_0x3cc7('0x204'),_0x393241);loggerPredictive[_0x3cc7('0x83')](_0x3cc7('0x205'),_0x587578);loggerPredictive['info']('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',_0x434746);loggerPredictive['info'](_0x3cc7('0x206'),_0x416aa8);loggerPredictive[_0x3cc7('0x83')](_0x3cc7('0x207'),_0x1d3987);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x5cb14a,_0x3e1133){if(_0x393241<=0x0||isNaN(_0x393241)){return _0x3e1133(msgResponse('[abandonmentRate]',_0x3cc7('0x47'),_0x3cc7('0x208')+_0x393241));}if(_0x434746<=0x0||isNaN(_0x434746)){return _0x3e1133(msgResponse(_0x3cc7('0x209'),_0x3cc7('0x47'),_0x3cc7('0x20a')+_0x434746));}if(_0x416aa8<=0x0||isNaN(_0x416aa8)){return _0x3e1133(msgResponse(_0x3cc7('0x209'),_0x3cc7('0x47'),_0x3cc7('0x20b')+_0x416aa8));}if(_0x587578<=0x0||isNaN(_0x587578)){return _0x3e1133(msgResponse(_0x3cc7('0x209'),_0x3cc7('0x47'),_0x3cc7('0x20c')+_0x587578));}if(_0x1d3987<=0x0||isNaN(_0x1d3987)){return _0x3e1133(msgResponse(_0x3cc7('0x209'),_0x3cc7('0x47'),'Amax\x20=\x20'+_0x1d3987));}_0x4a7730=_0x4a7730||0x0;var _0x1151a4=0x1/_0x434746;var _0x5ba3c4=0x0;var _0x566252=0x0;var _0x28b430=0x0;var _0xba6719=0x0;for(var _0x31cd4e=0x0;_0x28b430<_0x1d3987;_0x31cd4e+=0x1){_0x566252=_0x31cd4e/_0x587578;_0x5ba3c4=(_0x416aa8*_0x566252+_0x4a7730)/_0x1151a4;_0x28b430=erlangb(_0x5ba3c4,_0x393241);_0xba6719=_0x5ba3c4/_0x393241*(0x1-erlangb(_0x5ba3c4,_0x393241));}return _0x5cb14a({'erlangCalls':_0x31cd4e,'erlangCallToSecond':_0x587578/_0x31cd4e,'erlangAbandonmentRate':_0x28b430,'erlangBusyFactor':_0xba6719});});};Dialer[_0x3cc7('0x1b')][_0x3cc7('0x1d7')]=function(_0xa16ab8,_0x3e3e48,_0x53789c,_0x18b5b2,_0x561653,_0x33aa25){loggerPredictive['info'](_0x3cc7('0x20d'));loggerPredictive[_0x3cc7('0x83')](_0x3cc7('0x204'),_0xa16ab8);loggerPredictive[_0x3cc7('0x83')](_0x3cc7('0x205'),_0x3e3e48);loggerPredictive['info'](_0x3cc7('0x20e'),_0x53789c);loggerPredictive[_0x3cc7('0x83')]('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',_0x18b5b2);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x561653);loggerPredictive[_0x3cc7('0x83')](_0x3cc7('0x8a'));return new BPromise(function(_0x3a567b,_0x34fac5){if(_0xa16ab8<=0x0||isNaN(_0xa16ab8)){return _0x34fac5(msgResponse(_0x3cc7('0x20f'),'Error',_0x3cc7('0x208')+_0xa16ab8));}if(_0x53789c<=0x0||isNaN(_0x53789c)){return _0x34fac5(msgResponse(_0x3cc7('0x20f'),_0x3cc7('0x47'),_0x3cc7('0x20a')+_0x53789c));}if(_0x18b5b2<=0x0||isNaN(_0x18b5b2)){return _0x34fac5(msgResponse(_0x3cc7('0x20f'),_0x3cc7('0x47'),_0x3cc7('0x20b')+_0x18b5b2));}if(_0x3e3e48<=0x0||isNaN(_0x3e3e48)){return _0x34fac5(msgResponse(_0x3cc7('0x20f'),_0x3cc7('0x47'),_0x3cc7('0x20c')+_0x3e3e48));}if(_0x561653<=0x0||isNaN(_0x561653)){return _0x34fac5(msgResponse('[busyFactor]','Error',_0x3cc7('0x210')+_0x561653));}_0x33aa25=_0x33aa25||0x0;var _0x2af5a7=0x1/_0x53789c;var _0x18955c=0x0;var _0x535661=0x0;var _0x135f29=0x0;var _0x503b41=0x0;for(var _0x4fa5af=0x0;_0x503b41<_0x561653;_0x4fa5af+=0x1){_0x535661=_0x4fa5af/_0x3e3e48;_0x18955c=(_0x18b5b2*_0x535661+_0x33aa25)/_0x2af5a7;_0x135f29=erlangb(_0x18955c,_0xa16ab8);_0x503b41=_0x18955c/_0xa16ab8*(0x1-erlangb(_0x18955c,_0xa16ab8));}return _0x3a567b({'erlangCalls':_0x4fa5af,'erlangCallToSecond':_0x3e3e48/_0x4fa5af,'erlangAbandonmentRate':_0x135f29,'erlangBusyFactor':_0x503b41});});};module[_0x3cc7('0x211')]=Dialer; \ No newline at end of file +var _0x928c=['RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','pTalking','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','[uniqueid]','clearZombieChannels','[actions]','Action','status','channel','catch','No\x20such\x20channel','ivr','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','then','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','merge','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','SIP/%s','unmonitored','saveInDb','syncVarSet','uniqueid','isNil','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','state','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','CampaignId','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countabandonedretry','dialGlobalMaxRetry','reason19\x20machine....','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','droptime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','countdropretry','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','rrmemory','push','pick','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','isArray','interval','timezones','content','true','command','iftime\x20%s,%s','all','GLOBAL_INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','dialMethod','progressive','handlePower','dialPowerLevel','predictive','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','checkIfTime','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','checkDialMethod','[syncQueueSummary]','pow','replace','match','actionOriginate','object','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','stateGlobal','NoAnswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','dialPredictiveOptimizationPercentage','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][MoveBlacklist]','inBlackList','limitCalls','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','Contact.phone','tryOriginatePredictive','dialOrderByScheduledAt','[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','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','Error','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','./action','./final','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startProgressive','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','campaign:ivr:%s','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled'];(function(_0x246f0c,_0x39f734){var _0x30fe50=function(_0x9a975c){while(--_0x9a975c){_0x246f0c['push'](_0x246f0c['shift']());}};_0x30fe50(++_0x39f734);}(_0x928c,0x17f));var _0xc928=function(_0x474e48,_0x10ff74){_0x474e48=_0x474e48-0x0;var _0x7c0fe4=_0x928c[_0x474e48];return _0x7c0fe4;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xc928('0x0'));var uuid=require(_0xc928('0x1'));var moment=require('moment');var rr=require('rr');var md5=require(_0xc928('0x2'));var Redis=require(_0xc928('0x3'));var ut=require(_0xc928('0x4'));var config=require(_0xc928('0x5'));var logger=require(_0xc928('0x6'))('dialer');var loggerBooked=require(_0xc928('0x6'))(_0xc928('0x7'));var loggerPredictive=require(_0xc928('0x6'))('predictive');var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0xc928('0x6'))(_0xc928('0x8'));var ami=require(_0xc928('0x9'));config[_0xc928('0xa')]=_[_0xc928('0xb')](config[_0xc928('0xa')],{'host':_0xc928('0xc'),'port':0x18eb});var io=require(_0xc928('0xd'))(new Redis(config['redis']));var cmHopper=require(_0xc928('0xe'));var cmHopperHistory=require(_0xc928('0xf'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0xc928('0x10'));var History=require('./history');var Final=require(_0xc928('0x11'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xc928('0x12'));var Hangup=require(_0xc928('0x13'));var ipAgi=process['env'][_0xc928('0x14')]||_0xc928('0x15');var strategy={'rrmemory':'rrmemory','roundrobin':_0xc928('0x16')};var Sequence=function(){};Sequence[_0xc928('0x17')][_0xc928('0x18')]=function(_0x1845ab){this[_0xc928('0x19')]=this[_0xc928('0x19')]?this['tail'][_0xc928('0x1a')](_0x1845ab):_0x1845ab();};function Dialer(_0x331e02,_0x301ef9){this[_0xc928('0x1b')]=new Sequence();this[_0xc928('0x1c')]=_0x301ef9;this[_0xc928('0x1d')]=_0x331e02[_0xc928('0x1d')];this[_0xc928('0x1e')]=_0x331e02[_0xc928('0x1e')];this[_0xc928('0x1f')]=_0x331e02[_0xc928('0x1f')];this[_0xc928('0x20')]=_0x331e02['trunks'];this[_0xc928('0x21')]=config[_0xc928('0x21')]||0x2;this[_0xc928('0x22')]={};this[_0xc928('0x23')]={};this['contactsId']={};this[_0xc928('0x24')]={};this[_0xc928('0x25')]={};this[_0xc928('0x26')]={};this['startProgressive']={};this['ivrOriginated']={};this[_0xc928('0x27')]={};this[_0xc928('0x28')]={};ami['on'](_0xc928('0x29'),this[_0xc928('0x2a')]['bind'](this));ami['on']('queuecallerabandon',this[_0xc928('0x2b')][_0xc928('0x2c')](this));ami['on'](_0xc928('0x2d'),this[_0xc928('0x2e')][_0xc928('0x2c')](this));ami['on']('agentcomplete',this[_0xc928('0x2f')][_0xc928('0x2c')](this));ami['on'](_0xc928('0x30'),this['syncQueueSummary']['bind'](this));ami['on'](_0xc928('0x31'),this[_0xc928('0x32')]['bind'](this));ami['on'](_0xc928('0x33'),this[_0xc928('0x34')][_0xc928('0x2c')](this));ami['on'](_0xc928('0x35'),this['syncVarSet'][_0xc928('0x2c')](this));ami['on'](_0xc928('0x36'),this[_0xc928('0x37')][_0xc928('0x2c')](this));ami['on'](_0xc928('0x38'),this[_0xc928('0x39')][_0xc928('0x2c')](this));this[_0xc928('0x3a')]();this[_0xc928('0x3b')]();}function isNotNull(_0x2f0cc9){return _0x2f0cc9!==null&&!_[_0xc928('0x3c')](_0x2f0cc9);}function checkIsLoggedIn(_0x2aeada,_0x295335){return function(){if(_0x295335<=0x0){_0x2aeada[_0xc928('0x3d')]=_0xc928('0x3e');throw _0x2aeada[_0xc928('0x3f')]+_0xc928('0x40');}};}function isActive(_0x93fbb2){return _0x93fbb2;}function checkIsActive(_0x525976,_0x20527b){return function(){if(!isActive(_0x20527b)){_0x525976[_0xc928('0x3d')]=_0xc928('0x41');throw _0x525976['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x247cfe){return function(){if(!isNotNull(_0x247cfe[_0xc928('0x42')])){_0x247cfe[_0xc928('0x3d')]=_0xc928('0x43');throw _0x247cfe[_0xc928('0x3f')]+_0xc928('0x44');}if(!isNotNull(_0x247cfe[_0xc928('0x42')][_0xc928('0x45')])){_0x247cfe[_0xc928('0x3d')]=_0xc928('0x43');throw _0x247cfe[_0xc928('0x3f')]+_0xc928('0x44');}if(!isNotNull(_[_0xc928('0x46')](_0x247cfe['Interval'][_0xc928('0x45')]))){_0x247cfe[_0xc928('0x3d')]='INTERVAL_IS_NULL';throw _0x247cfe[_0xc928('0x3f')]+_0xc928('0x44');}};}function msgResponse(_0x295e1a,_0x479a82,_0x1d7bd4){return{'action':_0x295e1a,'response':_0x479a82,'message':_0x1d7bd4,'stack':_0x1d7bd4};}function myreject(_0x7d1879){return function(_0x2f062a){return _0x7d1879(msgResponse(_0xc928('0x47'),'Error',JSON['stringify'](_0x2f062a)));};}function getSeconds(_0x3d606d,_0x48c7c4){var _0x3b1024=moment(_0x3d606d)[_0xc928('0x48')](0x0);var _0x41c85b=moment(_0x48c7c4)[_0xc928('0x48')](0x0);return _0x3b1024[_0xc928('0x49')](_0x41c85b,_0xc928('0x4a'));}function emit(_0x5bbb84,_0x116286,_0x2d04d5){io['to'](_0x5bbb84)[_0xc928('0x4b')](_0x116286,_0x2d04d5);}function emitVoiceQueueSummary(_0x5e7934){if(_0x5e7934[_0xc928('0x4c')]===_0xc928('0x4d')){var _0x1925fe={'id':_0x5e7934['id'],'name':_0x5e7934[_0xc928('0x3f')],'strategy':_0x5e7934[_0xc928('0x4e')],'answered':_0x5e7934[_0xc928('0x4f')],'available':_0x5e7934['available'],'loggedIn':_0x5e7934[_0xc928('0x50')],'pTalking':_0x5e7934['pTalking'],'sumBillable':_0x5e7934[_0xc928('0x51')],'sumDuration':_0x5e7934[_0xc928('0x52')],'sumHoldTime':_0x5e7934[_0xc928('0x53')]||0x0,'talking':_0x5e7934[_0xc928('0x54')],'total':_0x5e7934[_0xc928('0x55')],'type':_0x5e7934['type'],'unmanaged':_0x5e7934[_0xc928('0x56')],'abandoned':_0x5e7934[_0xc928('0x57')],'waiting':_0x5e7934['waiting'],'loggedInDb':_0x5e7934['loggedInDb'],'dialActive':_0x5e7934['dialActive'],'dialMethod':_0x5e7934['dialMethod'],'dialOriginateCallerIdName':_0x5e7934[_0xc928('0x58')],'dialOriginateCallerIdNumber':_0x5e7934[_0xc928('0x59')],'dialOriginateTimeout':_0x5e7934[_0xc928('0x5a')],'dialPrefix':_0x5e7934[_0xc928('0x5b')],'outboundAnswerAgiCallsDay':_0x5e7934[_0xc928('0x5c')],'outboundAnswerCallsDay':_0x5e7934[_0xc928('0x5d')],'outboundBlacklistCallsDay':_0x5e7934[_0xc928('0x5e')],'outboundBusyCallsDay':_0x5e7934['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x5e7934[_0xc928('0x5f')],'outboundDropCallsDayACS':_0x5e7934[_0xc928('0x60')],'outboundDropCallsDayCallersExit':_0x5e7934['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x5e7934['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5e7934[_0xc928('0x61')],'outboundNoSuchCallsDay':_0x5e7934[_0xc928('0x62')],'outboundOriginateFailureCallsDay':_0x5e7934[_0xc928('0x63')],'outboundReCallsDay':_0x5e7934[_0xc928('0x64')],'outboundRejectCallsDay':_0x5e7934[_0xc928('0x65')],'outboundUnknownCallsDay':_0x5e7934[_0xc928('0x66')],'predictiveIntervalAnsweredCalls':_0x5e7934['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x5e7934[_0xc928('0x67')],'predictiveIntervalAvgTalktime':_0x5e7934['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x5e7934[_0xc928('0x68')],'predictiveIntervalDroppedCallsTimeout':_0x5e7934[_0xc928('0x69')],'predictiveIntervalErlangCalls':_0x5e7934[_0xc928('0x6a')],'predictiveIntervalErlangCallsDroppedCalls':_0x5e7934[_0xc928('0x6b')],'predictiveIntervalHitRate':_0x5e7934[_0xc928('0x6c')],'predictiveIntervalMultiplicativeFactor':_0x5e7934['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x5e7934['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x5e7934[_0xc928('0x6d')],'predictiveIntervalTotalCalls':_0x5e7934[_0xc928('0x6e')],'message':_0x5e7934['message'],'originated':_0x5e7934[_0xc928('0x6f')],'erlangCalls':_0x5e7934[_0xc928('0x70')],'erlangCallToSecond':_0x5e7934[_0xc928('0x71')],'erlangAbandonmentRate':_0x5e7934['erlangAbandonmentRate'],'erlangBusyFactor':_0x5e7934[_0xc928('0x72')],'startPredictive':_0x5e7934[_0xc928('0x26')],'startProgressive':_0x5e7934[_0xc928('0x73')]};if(_0x5e7934[_0xc928('0x74')]){_0x1925fe['Trunk']={'id':_0x5e7934[_0xc928('0x74')]['id'],'name':_0x5e7934[_0xc928('0x74')]['name'],'active':_0x5e7934[_0xc928('0x74')][_0xc928('0x75')],'callerid':_0x5e7934[_0xc928('0x74')][_0xc928('0x76')]};}if(_0x5e7934[_0xc928('0x42')]){_0x1925fe[_0xc928('0x42')]={'id':_0x5e7934['Interval']['id'],'name':_0x5e7934[_0xc928('0x42')][_0xc928('0x3f')]};}var _0x528786=md5(JSON['stringify'](_0x1925fe));if(_0x5e7934[_0xc928('0x2')]!==_0x528786){_0x5e7934[_0xc928('0x2')]=_0x528786;emit(util[_0xc928('0x77')](_0xc928('0x78'),_0x1925fe[_0xc928('0x3f')]),_0xc928('0x79'),_0x1925fe);}}}function emitCampaignSummary(_0x7f0fe8){if(_0x7f0fe8['type']==='ivr'){emit(util[_0xc928('0x77')](_0xc928('0x7a'),_0x7f0fe8[_0xc928('0x3f')]),'campaign:save',_0x7f0fe8);}}function checkGetDataPredictive(_0x8064a7){if(isNotNull(_0x8064a7)&&!_[_0xc928('0x46')](_0x8064a7)){loggerPredictive['info'](_0xc928('0x7b'));loggerPredictive[_0xc928('0x7c')](_0xc928('0x7d'),_0x8064a7[_0xc928('0x6e')]);loggerPredictive[_0xc928('0x7c')](_0xc928('0x7e'),_0x8064a7[_0xc928('0x7f')]);loggerPredictive[_0xc928('0x7c')](_0xc928('0x80'),_0x8064a7[_0xc928('0x69')]);loggerPredictive[_0xc928('0x7c')](_0xc928('0x81'),_0x8064a7[_0xc928('0x68')]);loggerPredictive[_0xc928('0x7c')](_0xc928('0x82'),_0x8064a7[_0xc928('0x67')]);loggerPredictive[_0xc928('0x7c')](_0xc928('0x83'),_0x8064a7[_0xc928('0x84')]);loggerPredictive['info'](_0xc928('0x85'));if(_0x8064a7[_0xc928('0x6e')]>0x0){if(!_[_0xc928('0x3c')](_0x8064a7[_0xc928('0x84')])&&_0x8064a7[_0xc928('0x84')]>0x0){return!![];}loggerPredictive[_0xc928('0x7c')](_0xc928('0x86'));if(!_[_0xc928('0x3c')](_0x8064a7[_0xc928('0x67')])&&_0x8064a7[_0xc928('0x67')]>0x0){return!![];}loggerPredictive[_0xc928('0x7c')](_0xc928('0x87'));}else{loggerPredictive[_0xc928('0x7c')](_0xc928('0x88'));}}else{loggerPredictive[_0xc928('0x7c')](_0xc928('0x89'));}return![];}function mergeDataErlangB(_0x3e17c8){return function(_0x1fd515){loggerPredictive[_0xc928('0x7c')](_0xc928('0x8a'));loggerPredictive[_0xc928('0x7c')](_0xc928('0x8b'),_0x1fd515[_0xc928('0x70')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1fd515[_0xc928('0x71')]);loggerPredictive['info'](_0xc928('0x8c'),_0x1fd515[_0xc928('0x8d')]);loggerPredictive[_0xc928('0x7c')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1fd515[_0xc928('0x72')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1fd515['erlangAbandonmentRate']);loggerPredictive[_0xc928('0x7c')]('---------------------------');_['merge'](_0x3e17c8,_0x1fd515);};}function getDiff(_0x30c224){var _0x4d1c69=moment()[_0xc928('0x48')](0x0);var _0x1adeb4=moment(_0x30c224)[_0xc928('0x48')](0x0);return _0x4d1c69[_0xc928('0x49')](_0x1adeb4,_0xc928('0x4a'));}function ifInterval(_0x513352,_0x5c1de1){if(_[_0xc928('0x3c')](_0x5c1de1)){return![];}return getDiff(_0x5c1de1)<_0x513352*0x3c;}function freeVariablesPredictive(_0x440495){if(isNotNull(_0x440495)){if(!_[_0xc928('0x3c')](_0x440495[_0xc928('0x73')])){_0x440495[_0xc928('0x73')]=undefined;loggerPredictive[_0xc928('0x7c')](_0x440495['name'],_0xc928('0x8e'));}if(!_[_0xc928('0x3c')](_0x440495[_0xc928('0x26')])){_0x440495[_0xc928('0x26')]=undefined;loggerPredictive[_0xc928('0x7c')](_0x440495[_0xc928('0x3f')],_0xc928('0x8f'));}if(!_[_0xc928('0x3c')](_0x440495[_0xc928('0x90')])){clearInterval(_0x440495[_0xc928('0x90')]);_0x440495[_0xc928('0x90')]=undefined;loggerPredictive[_0xc928('0x7c')](_0x440495['name'],_0xc928('0x91'));}}}function erlangb(_0x350a19,_0x3ee3c7){if(_0x3ee3c7===0x0){return 0x0;}var _0xa6c66c=0x1;for(var _0x1094a1=0x1;_0x1094a1<=_0x3ee3c7;_0x1094a1+=0x1){_0xa6c66c=0x1+_0xa6c66c*_0x1094a1/_0x350a19;}return 0x1/_0xa6c66c;}function isVoiceQueueOutbound(_0x134a3b){return _0x134a3b===_0xc928('0x4d');}function isNotPreview(_0x77c715){return _0x77c715!=='preview';}function isCampaignIvr(_0x12abaf){return _0x12abaf==='ivr';}function getCallerId(_0x4e5440,_0x101f0b,_0x159af1){if(!_['isUndefined'](_0x159af1)&&typeof _0x159af1===_0xc928('0x92')&&!_[_0xc928('0x46')](_0x159af1)){if(!_['isUndefined'](_0x101f0b)&&typeof _0x101f0b===_0xc928('0x92')&&!_['isEmpty'](_0x101f0b)){return util[_0xc928('0x77')](_0xc928('0x93'),_0x101f0b,_0x159af1);}return util[_0xc928('0x77')](_0xc928('0x93'),_0x159af1,_0x159af1);}if(!_['isUndefined'](_0x4e5440)&&typeof _0x4e5440===_0xc928('0x92')&&!_[_0xc928('0x46')](_0x4e5440)){return _0x4e5440;}return _0xc928('0x94');}function loggerCatchQueueSummary(_0x41a3f0,_0xe49a77){return function(_0x51f9e0){freeVariablesPredictive(_0xe49a77);emitVoiceQueueSummary(_0xe49a77);emitCampaignSummary(_0xe49a77);loggerSyncQueueSummary[_0xc928('0x95')](_0x41a3f0,util['inspect'](_0x51f9e0,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2bdad7,_0x15fa85){return function(_0x2084e9){loggerPredictive[_0xc928('0x95')](_0x15fa85['name'],_0x2bdad7);loggerPredictive[_0xc928('0x95')](_0x2084e9[_0xc928('0x96')]);freeVariablesPredictive(_0x15fa85);};}function loggerCatch(_0x1b8996){return function(_0x13cd2a){logger[_0xc928('0x95')](_0x1b8996,util[_0xc928('0x97')](_0x13cd2a,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0xf287f3){return _0xf287f3&&!_[_0xc928('0x3c')](_0xf287f3)&&_0xf287f3[_0xc928('0x98')]>0x0;}function decremetOriginate(_0x59b664){if(!_['isUndefined'](_0x59b664)&&_0x59b664!==null){if(typeof _0x59b664[_0xc928('0x6f')]!==_0xc928('0x99')){if(_0x59b664[_0xc928('0x6f')]>0x0){_0x59b664['originated']-=0x1;}else{logger[_0xc928('0x95')](_0xc928('0x9a'));}}}else{logger[_0xc928('0x95')](_0xc928('0x9b'));}}function checkContactLowerLimitOriginate(_0x16f306,_0x55b10a,_0x4f4793){if(_0x55b10a>_0x4f4793){for(var _0x1cc319=0x0;_0x1cc319<_0x55b10a-_0x4f4793;_0x1cc319+=0x1){decremetOriginate(_0x16f306);}}}function loggerGetContactDialer(_0x25c07d,_0x339925,_0x52a7fc){return function(_0x244730){checkContactLowerLimitOriginate(_0x339925,_0x52a7fc,0x0);logger[_0xc928('0x95')](_0x25c07d,util['inspect'](_0x244730,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3ca8e5){return function(_0x286e74){if(isNotNull(_0x286e74)&&isNotNull(_0x286e74[0x0])){if(_0x286e74[0x0][_0xc928('0x9c')]>0x0){_0x3ca8e5['message']=_0xc928('0x9d');logger['info'](_0xc928('0x9e')+_0x3ca8e5[_0xc928('0x3f')],_0x286e74[0x0][_0xc928('0x9c')],'contacts');}else{_0x3ca8e5['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xc928('0x7c')](_0xc928('0x9f')+_0x3ca8e5[_0xc928('0x3f')]);}}};}function notSendMessagesQueue(_0x36f035){if(_0x36f035[_0xc928('0xa0')]){freeVariablesPredictive(_0x36f035);if(_0x36f035[_0xc928('0x6f')]===0x0&&_0x36f035[_0xc928('0x54')]===0x0&&_0x36f035[_0xc928('0xa1')]===0x0&&(_0x36f035[_0xc928('0xa2')]||0x0)===0x0){_0x36f035['sendMessageOneNotActive']=![];_0x36f035[_0xc928('0xa3')]=0x0;_0x36f035['message']='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0xc928('0xa4'),_0x36f035[_0xc928('0x3f')],_0xc928('0xa5'));}else{_0x36f035[_0xc928('0x3d')]=_0xc928('0xa6');loggerSyncQueueSummary['error'](_0xc928('0xa4'),_0x36f035[_0xc928('0x3f')],_0xc928('0xa7'));}emitVoiceQueueSummary(_0x36f035);}}function notSendMessagesCampaign(_0x5cac5f){if(_0x5cac5f[_0xc928('0xa0')]){if(_0x5cac5f[_0xc928('0x6f')]===0x0){_0x5cac5f[_0xc928('0xa0')]=![];_0x5cac5f[_0xc928('0x3d')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xc928('0x95')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5cac5f['name'],_0xc928('0xa5'));}else{_0x5cac5f['message']=_0xc928('0xa6');loggerSyncQueueSummary[_0xc928('0x95')](_0xc928('0xa8'),_0x5cac5f[_0xc928('0x3f')],_0xc928('0xa7'));}emitCampaignSummary(_0x5cac5f);}}function createObjHistory(_0x511bd7,_0x49cf57,_0x1fe65b,_0xf2f23a,_0x2979ea){_0x511bd7[_0xc928('0x3d')]=_0x1fe65b;var _0x352fff=new Action(_0x511bd7,_0x49cf57);var _0x2280a5=new History(_0x352fff);_0x2280a5['state']=_0xf2f23a;_0x2280a5[_0xc928('0xa9')]=_0x2979ea;_0x2280a5[_0xc928('0xaa')]=_0x352fff[_0xc928('0xab')];return _0x2280a5;}Dialer[_0xc928('0x17')][_0xc928('0x3b')]=function(){var _0x481863=this;setInterval(function(){_0x481863['clearZombieChannels'](_0x481863[_0xc928('0x24')],_0xc928('0xac'));_0x481863[_0xc928('0xad')](_0x481863[_0xc928('0x23')],_0xc928('0xae'));},0x32c8);};Dialer[_0xc928('0x17')][_0xc928('0xad')]=function(_0x2c6181,_0x537dfa){var _0x595315=this;for(var _0x1b9ad3 in _0x2c6181){if(typeof _0x2c6181[_0x1b9ad3]!==_0xc928('0x99')){this[_0xc928('0x1b')]['enqueue'](function(){if(!_['isNil'](_0x2c6181[_0x1b9ad3])){return ami[_0xc928('0xaf')]({'action':_0xc928('0xb0'),'channel':_0x2c6181[_0x1b9ad3][_0xc928('0xb1')]})[_0xc928('0xb2')](function(_0x59c667){if(_0x59c667[_0xc928('0x3d')]===_0xc928('0xb3')){setTimeout(function(){if(_0x2c6181[_0x1b9ad3]&&_0x2c6181[_0x1b9ad3][_0xc928('0x4c')]!==_0xc928('0xb4')){_0x595315[_0xc928('0xb5')](_0x595315[_0xc928('0x1d')][_0x2c6181[_0x1b9ad3][_0xc928('0xb6')]]);logger[_0xc928('0x95')]('[Dialer][checkChannel]',_0x537dfa,_0x1b9ad3,_0x2c6181[_0x1b9ad3][_0xc928('0xb6')]);delete _0x2c6181[_0x1b9ad3];}if(_0x2c6181[_0x1b9ad3]&&_0x2c6181[_0x1b9ad3][_0xc928('0x4c')]==='ivr'){_0x595315[_0xc928('0xb5')](_0x595315[_0xc928('0x1e')][_0x2c6181[_0x1b9ad3][_0xc928('0xb6')]]);logger[_0xc928('0x95')](_0xc928('0xb7'),_0x537dfa,_0x1b9ad3,_0x2c6181[_0x1b9ad3][_0xc928('0xb6')]);delete _0x2c6181[_0x1b9ad3];}},0x2328);}});}});}}};Dialer[_0xc928('0x17')][_0xc928('0xb8')]=function(_0x334d22){return BPromise['resolve']()[_0xc928('0xb9')](cmHopper[_0xc928('0xb8')](_0x334d22))[_0xc928('0xb2')](loggerCatch(_0xc928('0xba')));};Dialer[_0xc928('0x17')][_0xc928('0xbb')]=function(_0x50555e){return BPromise[_0xc928('0xbc')]()['then'](cmHopperBlack[_0xc928('0xbb')](_0x50555e))[_0xc928('0xb2')](loggerCatch(_0xc928('0xbd')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x5485e7){return BPromise[_0xc928('0xbc')]()[_0xc928('0xb9')](cmHopperBlack[_0xc928('0xbe')](_0x5485e7))['catch'](loggerCatch(_0xc928('0xbf')));};Dialer[_0xc928('0x17')][_0xc928('0xc0')]=function(_0x45bc7e){return BPromise['resolve']()[_0xc928('0xb9')](cmHopperHistory[_0xc928('0xc1')](_0x45bc7e))[_0xc928('0xb2')](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xc928('0x17')]['rescheduleContact']=function(_0x427c4e){return BPromise[_0xc928('0xbc')]()['then'](cmHopper[_0xc928('0xc2')](_0x427c4e))[_0xc928('0xb2')](loggerCatch(_0xc928('0xc3')));};Dialer[_0xc928('0x17')][_0xc928('0xc4')]=function(_0x55a409,_0x2b6c95,_0x50a26c){return BPromise[_0xc928('0xbc')]()[_0xc928('0xb9')](cmHopper[_0xc928('0xc4')](_0x55a409,_0x2b6c95,_0x50a26c))[_0xc928('0xb2')](loggerCatch(_0xc928('0xc5')));};Dialer[_0xc928('0x17')][_0xc928('0xc6')]=function(_0x34f5b2,_0x1a755a,_0x266507,_0x4f9ba4,_0x3a41eb){return BPromise[_0xc928('0xbc')]()[_0xc928('0xb9')](cmHopper[_0xc928('0xc6')](_0x34f5b2,_0x1a755a,_0x266507,_0x4f9ba4))[_0xc928('0xb2')](function(_0x55ae5b){_0x3a41eb['temp']-=_0x266507;_0x3a41eb[_0xc928('0xc7')]=_0x3a41eb[_0xc928('0xc7')]>0x0?_0x3a41eb[_0xc928('0xc7')]:0x0;loggerCatch(_0xc928('0xc8'))(_0x55ae5b);});};Dialer[_0xc928('0x17')][_0xc928('0xc9')]=function(_0x5ba3fd,_0x2b3c30,_0x46785f,_0x13b49e){return BPromise[_0xc928('0xbc')]()[_0xc928('0xb9')](cmHopper['getContactDialerIvr'](_0x5ba3fd,_0x2b3c30,_0x46785f))[_0xc928('0xb2')](function(_0x5798f2){_0x13b49e[_0xc928('0xc7')]-=_0x2b3c30;_0x13b49e[_0xc928('0xc7')]=_0x13b49e['temp']>0x0?_0x13b49e['temp']:0x0;loggerCatch(_0xc928('0xca'))(_0x5798f2);});};Dialer[_0xc928('0x17')][_0xc928('0xcb')]=function(_0x5607ea){return BPromise[_0xc928('0xbc')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x5607ea))[_0xc928('0xb2')](loggerCatch(_0xc928('0xcc')));};Dialer[_0xc928('0x17')][_0xc928('0xcd')]=function(_0x36dbb4){return BPromise[_0xc928('0xbc')]()['then'](cmHopper[_0xc928('0xcd')](_0x36dbb4))[_0xc928('0xb2')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0xc928('0xce')]=function(_0x151afd){return BPromise[_0xc928('0xbc')]()[_0xc928('0xb9')](cmHopperHistory[_0xc928('0xce')](_0x151afd))[_0xc928('0xb2')](loggerCatch(_0xc928('0xcf')));};Dialer[_0xc928('0x17')][_0xc928('0xb5')]=function(_0x8f5928){if(!_[_0xc928('0x3c')](_0x8f5928)&&_0x8f5928!==null){if(typeof _0x8f5928[_0xc928('0x6f')]!==_0xc928('0x99')){if(_0x8f5928[_0xc928('0x6f')]>0x0){_0x8f5928[_0xc928('0x6f')]-=0x1;}else{logger['error'](_0xc928('0xd0'));}}}else{logger[_0xc928('0x95')](_0xc928('0xd1'));}};Dialer['prototype'][_0xc928('0xd2')]=function(_0x1d8f9d,_0x5a3960){var _0x2cdb74=this;return function(_0x3ff879){_0x2cdb74[_0xc928('0xb5')](_0x5a3960);logger[_0xc928('0x95')](_0x1d8f9d,util['inspect'](_0x3ff879,{'showHidden':![],'depth':null}));};};Dialer[_0xc928('0x17')][_0xc928('0xd3')]=function(_0x2aec81,_0x7f1f1a,_0x1fd1ac){var _0x5442fb={'state':0x19,'statedesc':_0xc928('0xd4')};this[_0xc928('0xb5')](_0x7f1f1a);this['saveInDb'](_[_0xc928('0xd5')](_0x5442fb,_['pick'](_0x1fd1ac,['ContactId',_0xc928('0xd6'),_0xc928('0xd7'),_0xc928('0xd8'),'CampaignId'])),_0xc928('0xd9'),_0xc928('0xda'));logger[_0xc928('0x95')](_0x2aec81);};Dialer[_0xc928('0x17')][_0xc928('0xdb')]=function(_0x46d636){return _0x46d636===_0xc928('0xdc');};Dialer[_0xc928('0x17')]['isTrunkReachable']=function(_0x3b417b){return!_[_0xc928('0x3c')](_0x3b417b)&&_0x3b417b&&!_[_0xc928('0x3c')](_0x3b417b[_0xc928('0x3f')])&&!_[_0xc928('0x3c')](_0x3b417b[_0xc928('0x75')])&&_0x3b417b['active']&&(this[_0xc928('0x20')][util[_0xc928('0x77')](_0xc928('0xdd'),_0x3b417b[_0xc928('0x3f')])][_0xc928('0xb0')]==='reachable'||this[_0xc928('0x20')][util[_0xc928('0x77')](_0xc928('0xdd'),_0x3b417b[_0xc928('0x3f')])]['status']===_0xc928('0xde'));};Dialer[_0xc928('0x17')][_0xc928('0xdf')]=function(_0x4cf5b0,_0x1a4790,_0x2e3abe){this['createHistory'](_0x4cf5b0)[_0xc928('0xb2')](loggerCatch(_0x1a4790));this['moveContactManagedDialer'](_0x4cf5b0)[_0xc928('0xb2')](loggerCatch(_0x2e3abe));};Dialer['prototype'][_0xc928('0xe0')]=function(_0x19b1d7){var _0x32bed0=this[_0xc928('0x24')][_0x19b1d7[_0xc928('0xe1')]];var _0x975729;if(!_[_0xc928('0xe2')](_0x19b1d7)&&!_['isNil'](_0x19b1d7[_0xc928('0xe3')])&&!_[_0xc928('0xe2')](_0x19b1d7[_0xc928('0xe3')][_0xc928('0xe4')])&&_0x19b1d7[_0xc928('0xe5')]===_0xc928('0xe6')&&_0x32bed0){if(_0x32bed0[_0xc928('0x4c')]!==_0xc928('0xb4')&&this[_0xc928('0x1d')][_0x32bed0[_0xc928('0xb6')]][_0xc928('0xe7')]&&_0x19b1d7[_0xc928('0xe8')]==='HANGUP'){delete this[_0xc928('0x24')][_0x19b1d7[_0xc928('0xe1')]];this[_0xc928('0xb5')](this[_0xc928('0x1d')][_0x32bed0['queue']]);this['voiceQueues'][_0x32bed0[_0xc928('0xb6')]]['outboundAnswerCallsDay']+=0x1;this[_0xc928('0x1d')][_0x32bed0[_0xc928('0xb6')]][_0xc928('0x5c')]+=0x1;_0x975729=new Hangup(_0x32bed0,_0x19b1d7);_0x975729[_0xc928('0xe9')]=0x12;_0x975729[_0xc928('0xa9')]=_0xc928('0xea');_0x975729[_0xc928('0xeb')]=_0xc928('0xec');ami[_0xc928('0x4b')](_0xc928('0xed'),ut[_0xc928('0xee')](_0x975729,_0xc928('0xef')));this[_0xc928('0xdf')](_0x975729,_0xc928('0xf0'),_0xc928('0xf1'));}if(_0x32bed0[_0xc928('0x4c')]!=='ivr'&&this[_0xc928('0x1d')][_0x32bed0[_0xc928('0xb6')]][_0xc928('0xe7')]&&_0x19b1d7[_0xc928('0xe8')]===_0xc928('0xf2')){var _0x4fb4a1=this;return new BPromise(function(_0x48859d,_0x2bbf4b){delete _0x4fb4a1[_0xc928('0x24')][_0x19b1d7[_0xc928('0xe1')]];_0x4fb4a1[_0xc928('0xb5')](_0x4fb4a1[_0xc928('0x1d')][_0x32bed0['queue']]);_0x4fb4a1[_0xc928('0x1d')][_0x32bed0[_0xc928('0xb6')]]['outboundAnswerCallsDay']+=0x1;_0x4fb4a1[_0xc928('0x1d')][_0x32bed0['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x24f3b3=_0x4fb4a1[_0xc928('0x1d')][_0x32bed0[_0xc928('0xb6')]];var _0x118bf8=new Hangup(_0x32bed0,_0x19b1d7);_0x118bf8[_0xc928('0xe9')]=0x13;_0x118bf8[_0xc928('0xa9')]=_0xc928('0xf3');_0x118bf8['membername']='AMD';_0x118bf8[_0xc928('0xf4')]+=0x1;_0x118bf8[_0xc928('0xf5')]+=0x1;_0x118bf8[_0xc928('0xef')]=!![];ami[_0xc928('0x4b')]('custom:amd',ut[_0xc928('0xee')](_0x118bf8,_0xc928('0xef')));_0x4fb4a1[_0xc928('0xce')](_0x118bf8)['catch'](loggerCatch(_0xc928('0xf6')));if(_0x118bf8[_0xc928('0xf7')]+_0x118bf8[_0xc928('0xf8')]+_0x118bf8[_0xc928('0xf9')]+_0x118bf8[_0xc928('0xfa')]+_0x118bf8['countdropretry']+_0x118bf8['countabandonedretry']+_0x118bf8['countmachineretry']+_0x118bf8[_0xc928('0xfb')]>=_0x24f3b3['dialGlobalMaxRetry']){_0x4fb4a1['stateGlobal'](_0x118bf8,_0x48859d,_0x2bbf4b,'reason19\x20machine....');}else{if(_0x118bf8[_0xc928('0xf4')]>=_0x24f3b3[_0xc928('0xfc')]){_0x4fb4a1[_0xc928('0xfd')](_0x118bf8,_0x48859d,_0x2bbf4b,_0xc928('0xfe'));}else{_0x4fb4a1[_0xc928('0xc2')]({'active':![],'countmachineretry':_0x118bf8[_0xc928('0xf4')],'scheduledat':moment()[_0xc928('0xff')](_0x24f3b3[_0xc928('0x100')],_0xc928('0x101'))[_0xc928('0x77')](_0xc928('0x102')),'ContactId':_0x118bf8[_0xc928('0x103')],'ListId':_0x118bf8[_0xc928('0xd6')],'VoiceQueueId':_0x118bf8['VoiceQueueId']||undefined,'CampaignId':_0x118bf8[_0xc928('0x104')]||undefined})['catch'](loggerCatch(_0xc928('0x105')));_0x48859d({'reschedule':0x1});}}});}if(_0x32bed0['type']==='ivr'&&this[_0xc928('0x1e')][_0x32bed0[_0xc928('0xb6')]][_0xc928('0xe7')]&&_0x19b1d7[_0xc928('0xe8')]===_0xc928('0x106')){delete this['uniqueId'][_0x19b1d7[_0xc928('0xe1')]];this[_0xc928('0xb5')](this['campaigns'][_0x32bed0[_0xc928('0xb6')]]);_0x975729=new Hangup(_0x32bed0,_0x19b1d7);_0x975729[_0xc928('0xe9')]=0x12;_0x975729[_0xc928('0xa9')]=_0xc928('0xea');_0x975729[_0xc928('0xeb')]='AMD';ami[_0xc928('0x4b')](_0xc928('0xed'),ut[_0xc928('0xee')](_0x975729,_0xc928('0xef')));this[_0xc928('0xdf')](_0x975729,_0xc928('0x107'),_0xc928('0x108'));}if(_0x32bed0[_0xc928('0x4c')]===_0xc928('0xb4')&&this[_0xc928('0x1e')][_0x32bed0[_0xc928('0xb6')]]['dialAMDActive']&&_0x19b1d7[_0xc928('0xe8')]===_0xc928('0xf2')){var _0x4fb4a1=this;return new BPromise(function(_0x43d5c4,_0x2fbda2){delete _0x4fb4a1['uniqueId'][_0x19b1d7[_0xc928('0xe1')]];_0x4fb4a1['updateOriginated'](_0x4fb4a1['campaigns'][_0x32bed0['queue']]);_0x4fb4a1['campaigns'][_0x32bed0[_0xc928('0xb6')]]['outboundAnswerCallsDay']+=0x1;_0x4fb4a1[_0xc928('0x1e')][_0x32bed0[_0xc928('0xb6')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x5824d8=_0x4fb4a1['campaigns'][_0x32bed0[_0xc928('0xb6')]];var _0x3abc79=new Hangup(_0x32bed0,_0x19b1d7);_0x3abc79[_0xc928('0xe9')]=0x13;_0x3abc79['statedesc']=_0xc928('0xf3');_0x3abc79[_0xc928('0xeb')]=_0xc928('0xec');_0x3abc79['countmachineretry']+=0x1;_0x3abc79['countglobal']+=0x1;_0x3abc79[_0xc928('0xef')]=!![];ami['emit']('custom:amd',ut[_0xc928('0xee')](_0x3abc79,_0xc928('0xef')));_0x4fb4a1['createHistory'](_0x3abc79)['catch'](loggerCatch(_0xc928('0xf6')));if(_0x3abc79[_0xc928('0xf7')]+_0x3abc79[_0xc928('0xf8')]+_0x3abc79[_0xc928('0xf9')]+_0x3abc79['countnosuchnumberretry']+_0x3abc79['countdropretry']+_0x3abc79[_0xc928('0x109')]+_0x3abc79[_0xc928('0xf4')]+_0x3abc79[_0xc928('0xfb')]>=_0x5824d8[_0xc928('0x10a')]){_0x4fb4a1['stateGlobal'](_0x3abc79,_0x43d5c4,_0x2fbda2,_0xc928('0x10b'));}else{if(_0x3abc79[_0xc928('0xf4')]>=_0x5824d8[_0xc928('0xfc')]){_0x4fb4a1[_0xc928('0xfd')](_0x3abc79,_0x43d5c4,_0x2fbda2,_0xc928('0xfe'));}else{_0x4fb4a1[_0xc928('0xc2')]({'active':![],'countmachineretry':_0x3abc79[_0xc928('0xf4')],'scheduledat':moment()[_0xc928('0xff')](_0x5824d8['dialMachineRetryFrequency'],'minutes')[_0xc928('0x77')](_0xc928('0x102')),'ContactId':_0x3abc79[_0xc928('0x103')],'ListId':_0x3abc79[_0xc928('0xd6')],'VoiceQueueId':_0x3abc79[_0xc928('0xd8')]||undefined,'CampaignId':_0x3abc79[_0xc928('0x104')]||undefined})[_0xc928('0xb2')](loggerCatch('[rescheduleContact][Machine]'));_0x43d5c4({'reschedule':0x1});}}});}}};Dialer[_0xc928('0x17')][_0xc928('0x32')]=function(_0x5120e9){var _0x1f28de=this[_0xc928('0x24')][_0x5120e9[_0xc928('0xe1')]];var _0x357837=this;var _0x5b170f;if(_0x1f28de&&_0x1f28de[_0xc928('0x4c')]===_0xc928('0xb4')){delete this['uniqueId'][_0x5120e9['uniqueid']];this['updateOriginated'](this[_0xc928('0x1e')][_0x1f28de[_0xc928('0xb6')]]);this['campaigns'][_0x1f28de[_0xc928('0xb6')]][_0xc928('0x10c')]+=0x1;_0x5b170f=new Hangup(_0x1f28de,_0x5120e9);this[_0xc928('0xce')](_0x5b170f)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x5b170f)['catch'](loggerCatch(_0xc928('0x10d')));}if(_0x1f28de&&_0x1f28de[_0xc928('0x4c')]!=='ivr'&&isNotNull(this[_0xc928('0x1d')][_0x1f28de[_0xc928('0xb6')]][_0xc928('0x10e')])){delete this[_0xc928('0x24')][_0x5120e9[_0xc928('0xe1')]];this['updateOriginated'](this[_0xc928('0x1d')][_0x1f28de[_0xc928('0xb6')]]);this[_0xc928('0x1d')][_0x1f28de[_0xc928('0xb6')]]['outboundAnswerCallsDay']+=0x1;this[_0xc928('0x1d')][_0x1f28de[_0xc928('0xb6')]][_0xc928('0x5c')]+=0x1;_0x5b170f=new Hangup(_0x1f28de,_0x5120e9);_0x5b170f[_0xc928('0xe9')]=0x10;_0x5b170f[_0xc928('0xa9')]=_0xc928('0x10f');_0x5b170f[_0xc928('0xeb')]=_0xc928('0x110');this[_0xc928('0xce')](_0x5b170f)[_0xc928('0xb2')](loggerCatch(_0xc928('0x111')));this[_0xc928('0xcd')](_0x5b170f)[_0xc928('0xb2')](loggerCatch('[syncHangupIvr]'));}if(_0x1f28de&&_0x1f28de['type']!==_0xc928('0xb4')&&!isNotNull(this[_0xc928('0x1d')][_0x1f28de[_0xc928('0xb6')]][_0xc928('0x10e')])){delete this[_0xc928('0x24')][_0x5120e9[_0xc928('0xe1')]];this[_0xc928('0xb5')](this['voiceQueues'][_0x1f28de[_0xc928('0xb6')]]);this['voiceQueues'][_0x1f28de[_0xc928('0xb6')]][_0xc928('0x66')]+=0x1;_0x5b170f=new Hangup(_0x1f28de,_0x5120e9);_0x5b170f[_0xc928('0xe9')]=0xc;_0x5b170f[_0xc928('0xa9')]=_0x5120e9[_0xc928('0x112')];_0x5b170f[_0xc928('0xeb')]=_0xc928('0x113');this[_0xc928('0xce')](_0x5b170f)[_0xc928('0xb2')](loggerCatch(_0xc928('0x111')));this[_0xc928('0xcd')](_0x5b170f)[_0xc928('0xb2')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xc928('0x17')]['syncAgentComplete']=function(_0x43f176){var _0x579681=this[_0xc928('0x24')][_0x43f176[_0xc928('0xe1')]];var _0x2ca1d4=this;if(this[_0xc928('0x1d')][_0x43f176[_0xc928('0xb6')]]){if(_0x579681&&_0x579681[_0xc928('0x4c')]!==_0xc928('0xb4')){delete this[_0xc928('0x24')][_0x43f176['uniqueid']];this[_0xc928('0x1d')][_0x43f176[_0xc928('0xb6')]]['outboundAnswerCallsDay']+=0x1;var _0x2f35ec=new AgentComplete(_0x579681,_0x43f176);if(_0x43f176[_0xc928('0x114')]===_0xc928('0x115')){_0x2f35ec[_0xc928('0x116')]=this['voiceQueues'][_0x43f176[_0xc928('0xb6')]][_0xc928('0x117')]&&this['voiceQueues'][_0x43f176[_0xc928('0xb6')]][_0xc928('0x118')]?moment()[_0xc928('0x77')](_0xc928('0x102')):undefined;}this[_0xc928('0xce')](_0x2f35ec)[_0xc928('0xb2')](loggerCatch(_0xc928('0x119')));this[_0xc928('0xcd')](_0x2f35ec)[_0xc928('0xb2')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xc928('0x17')][_0xc928('0x2a')]=function(_0x587b35){if(this[_0xc928('0x1d')][_0x587b35[_0xc928('0xb6')]]){if(this['uniqueId'][_0x587b35[_0xc928('0xe1')]]&&this['uniqueId'][_0x587b35[_0xc928('0xe1')]][_0xc928('0x4c')]!==_0xc928('0xb4')){this[_0xc928('0xb5')](this['voiceQueues'][_0x587b35[_0xc928('0xb6')]]);this[_0xc928('0x24')][_0x587b35['uniqueid']][_0xc928('0x11a')]=moment()[_0xc928('0x77')](_0xc928('0x102'));}}};Dialer['prototype'][_0xc928('0x11b')]=function(_0x1df782){this[_0xc928('0xce')](_0x1df782)[_0xc928('0xb2')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x1df782)[_0xc928('0xb2')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xc928('0x17')][_0xc928('0x2b')]=function(_0x5a7ce9){var _0x4b07be=this[_0xc928('0x24')][_0x5a7ce9['uniqueid']];var _0x156b09=this;if(this['voiceQueues'][_0x5a7ce9[_0xc928('0xb6')]]){if(_0x4b07be&&_0x4b07be[_0xc928('0x4c')]!==_0xc928('0xb4')){delete this['uniqueId'][_0x5a7ce9['uniqueid']];this[_0xc928('0xb5')](this[_0xc928('0x1d')][_0x5a7ce9[_0xc928('0xb6')]]);_0x4b07be['droptime']=moment()[_0xc928('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2edfc1=new QueueCallerAbandon(_0x4b07be,_0x5a7ce9);if(getSeconds(_0x4b07be[_0xc928('0x11c')],_0x4b07be['responsetime'])>=_0x4b07be[_0xc928('0x11d')]){this['voiceQueues'][_0x5a7ce9['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xc928('0x1d')][_0x5a7ce9[_0xc928('0xb6')]][_0xc928('0x11e')]+=0x1;this[_0xc928('0x1d')][_0x5a7ce9[_0xc928('0xb6')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x2edfc1['state']=0xa;_0x2edfc1[_0xc928('0xa9')]=_0xc928('0x11f');_0x2edfc1['dropreason']='TIMEOUT';_0x2edfc1[_0xc928('0x116')]=this['voiceQueues'][_0x5a7ce9[_0xc928('0xb6')]][_0xc928('0x117')]?moment()[_0xc928('0x77')](_0xc928('0x102')):undefined;_0x2edfc1[_0xc928('0x120')]+=0x1;_0x2edfc1[_0xc928('0xf5')]+=0x1;if(_0x2edfc1['countdropretry']>=this[_0xc928('0x1d')][_0x5a7ce9[_0xc928('0xb6')]][_0xc928('0x121')]){this[_0xc928('0x11b')](_0x2edfc1);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x2edfc1['countdropretry'],'scheduledat':moment()['add'](this[_0xc928('0x1d')][_0x5a7ce9['queue']][_0xc928('0x122')],_0xc928('0x101'))[_0xc928('0x77')](_0xc928('0x102')),'ContactId':_0x4b07be[_0xc928('0x103')],'ListId':_0x4b07be[_0xc928('0xd6')],'VoiceQueueId':_0x4b07be[_0xc928('0xd8')]||undefined,'CampaignId':_0x4b07be[_0xc928('0x104')]||undefined})[_0xc928('0xb2')](loggerCatch(_0xc928('0x123')));var _0x33c0bc=new History(_0x2edfc1);_0x33c0bc[_0xc928('0xe9')]=0xa;_0x33c0bc[_0xc928('0xa9')]=_0xc928('0x11f');_0x33c0bc[_0xc928('0xab')]=moment()[_0xc928('0x77')](_0xc928('0x102'));_0x33c0bc[_0xc928('0xaa')]=_0x33c0bc['starttime'];_0x33c0bc[_0xc928('0x124')]=_0x2edfc1[_0xc928('0x124')];_0x33c0bc[_0xc928('0x125')]=_0x2edfc1[_0xc928('0x125')];this['createHistory'](_0x33c0bc)[_0xc928('0xb2')](loggerCatch(_0xc928('0x126')));}}else{this[_0xc928('0x1d')][_0x5a7ce9['queue']][_0xc928('0x68')]+=0x1;this['voiceQueues'][_0x5a7ce9[_0xc928('0xb6')]]['outboundDropCallsDayCallersExit']+=0x1;_0x2edfc1[_0xc928('0xe9')]=0xb;_0x2edfc1['statedesc']=_0xc928('0x127');_0x2edfc1[_0xc928('0x128')]=_0xc928('0x129');_0x2edfc1['countabandonedretry']+=0x1;_0x2edfc1[_0xc928('0xf5')]+=0x1;if(_0x2edfc1['countabandonedretry']>=this['voiceQueues'][_0x5a7ce9[_0xc928('0xb6')]]['dialAbandonedMaxRetry']){this[_0xc928('0x11b')](_0x2edfc1);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x2edfc1[_0xc928('0x109')],'scheduledat':moment()[_0xc928('0xff')](this[_0xc928('0x1d')][_0x5a7ce9[_0xc928('0xb6')]][_0xc928('0x12a')],'minutes')['format'](_0xc928('0x102')),'ContactId':_0x4b07be[_0xc928('0x103')],'ListId':_0x4b07be['ListId'],'VoiceQueueId':_0x4b07be[_0xc928('0xd8')]||undefined,'CampaignId':_0x4b07be[_0xc928('0x104')]||undefined})[_0xc928('0xb2')](loggerCatch(_0xc928('0x12b')));var _0x33c0bc=new History(_0x2edfc1);_0x33c0bc[_0xc928('0xe9')]=0xb;_0x33c0bc[_0xc928('0xa9')]='Abandoned';_0x33c0bc[_0xc928('0xab')]=moment()[_0xc928('0x77')](_0xc928('0x102'));_0x33c0bc['endtime']=_0x33c0bc[_0xc928('0xab')];_0x33c0bc[_0xc928('0x124')]=_0x2edfc1[_0xc928('0x124')];_0x33c0bc['calleridnum']=_0x2edfc1[_0xc928('0x125')];this['createHistory'](_0x33c0bc)[_0xc928('0xb2')](loggerCatch(_0xc928('0x12c')));}}}}};Dialer[_0xc928('0x17')][_0xc928('0x34')]=function(_0x4c4c7d){if(this['actions'][_0x4c4c7d[_0xc928('0xe1')]]){this['actions'][_0x4c4c7d['uniqueid']][_0xc928('0xb1')]=_0x4c4c7d['channel'];}if(this['uniqueId'][_0x4c4c7d['uniqueid']]){this[_0xc928('0x24')][_0x4c4c7d[_0xc928('0xe1')]]['channel']=_0x4c4c7d['channel'];}};Dialer[_0xc928('0x17')][_0xc928('0x37')]=function(_0x2cba27){if(strategy[this[_0xc928('0x1d')][this[_0xc928('0x23')][_0x2cba27[_0xc928('0x12d')]]['queue']][_0xc928('0x4e')]]===_0xc928('0x16')){if(this[_0xc928('0x23')][_0x2cba27['actionid']]&&_[_0xc928('0xe2')](this[_0xc928('0x23')][_0x2cba27[_0xc928('0x12d')]][_0xc928('0x12e')])&&_0x2cba27[_0xc928('0xb0')]==='1'&&_0x2cba27[_0xc928('0x12f')]==='0'){if(this['agents'][_0x2cba27[_0xc928('0x130')]]){if(!this[_0xc928('0x1f')][_0x2cba27[_0xc928('0x130')]]['locked']){this[_0xc928('0x1f')][_0x2cba27[_0xc928('0x130')]][_0xc928('0x12e')]=!![];this[_0xc928('0x23')][_0x2cba27[_0xc928('0x12d')]][_0xc928('0x12e')]=!![];this[_0xc928('0x23')][_0x2cba27[_0xc928('0x12d')]]['stateinterface']=_0x2cba27[_0xc928('0x130')];}}}}else if((strategy[this[_0xc928('0x1d')][this[_0xc928('0x23')][_0x2cba27[_0xc928('0x12d')]][_0xc928('0xb6')]][_0xc928('0x4e')]]||_0xc928('0x131'))===_0xc928('0x131')){if(this[_0xc928('0x23')][_0x2cba27['actionid']]){if(this[_0xc928('0x1f')][_0x2cba27[_0xc928('0x130')]]){this['actions'][_0x2cba27['actionid']][_0xc928('0x130')]=_0x2cba27['stateinterface'];if(_[_0xc928('0xe2')](this[_0xc928('0x27')][this[_0xc928('0x23')][_0x2cba27[_0xc928('0x12d')]][_0xc928('0xb6')]])){this[_0xc928('0x27')][this['actions'][_0x2cba27[_0xc928('0x12d')]]['queue']]=[];}this['queueBooked'][this[_0xc928('0x23')][_0x2cba27['actionid']][_0xc928('0xb6')]][_0xc928('0x132')](_[_0xc928('0xd5')](_[_0xc928('0x133')](this[_0xc928('0x23')][_0x2cba27[_0xc928('0x12d')]],[_0xc928('0x134'),_0xc928('0x130')]),{'status':_0x2cba27[_0xc928('0xb0')],'paused':_0x2cba27['paused']}));}}}};function unlockQueueStatus(_0x39811a,_0x18329c){setTimeout(function(){if(_[_0xc928('0x3c')](_0x39811a[_0xc928('0x135')])){loggerBooked['error'](_0xc928('0x136'),_0x18329c);}_0x39811a[_0xc928('0x135')]=!![];loggerBooked[_0xc928('0x7c')]('[booked][unlockQueueStatus]',_0x18329c,JSON[_0xc928('0x137')](_['pick'](_0x39811a,['name',_0xc928('0x135')])));},0x1f3);}Dialer[_0xc928('0x17')][_0xc928('0x39')]=function(_0x39a361){var _0x287fe2=this;var _0x361eea=_0x287fe2[_0xc928('0x1d')][_0x287fe2[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]]['queue']];if(strategy[this[_0xc928('0x1d')][this[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]]['queue']]['strategy']]===_0xc928('0x16')){if(this[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]]&&this[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]][_0xc928('0x130')]){this[_0xc928('0x1c')]['run'](this[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]][_0xc928('0x134')],this[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]][_0xc928('0x130')])['catch'](function(_0x33e7df){logger[_0xc928('0x95')](_0xc928('0x138'),util[_0xc928('0x97')](_0x33e7df,{'showHidden':![],'depth':null}));})[_0xc928('0x1a')](function(){_0x287fe2[_0xc928('0xb5')](_0x287fe2[_0xc928('0x1d')][_0x287fe2[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]]['queue']]);_0x287fe2[_0xc928('0x1f')][_0x287fe2['actions'][_0x39a361[_0xc928('0x12d')]][_0xc928('0x130')]][_0xc928('0x12e')]=![];delete _0x287fe2['actions'][_0x39a361[_0xc928('0x12d')]];unlockQueueStatus(_0x361eea);});}else{this[_0xc928('0xb5')](this['voiceQueues'][this[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]][_0xc928('0xb6')]]);this[_0xc928('0xc2')]({'active':![],'ContactId':this[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]][_0xc928('0x103')],'ListId':this[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]][_0xc928('0xd6')],'VoiceQueueId':this['actions'][_0x39a361[_0xc928('0x12d')]][_0xc928('0xd8')]||undefined,'CampaignId':this[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]][_0xc928('0x104')]||undefined})[_0xc928('0xb2')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xc928('0x23')][_0x39a361['actionid']];unlockQueueStatus(_0x361eea);}}else if((strategy[this['voiceQueues'][this['actions'][_0x39a361[_0xc928('0x12d')]][_0xc928('0xb6')]][_0xc928('0x4e')]]||_0xc928('0x131'))===_0xc928('0x131')){var _0x507ca1;if(this[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]]&&!_[_0xc928('0x46')](this[_0xc928('0x27')][this[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]][_0xc928('0xb6')]])){if(this[_0xc928('0x28')][_0x287fe2['actions'][_0x39a361[_0xc928('0x12d')]][_0xc928('0xb6')]]){this['queueBookedRR'][_0x287fe2[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]][_0xc928('0xb6')]]=this[_0xc928('0x28')][this[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]][_0xc928('0xb6')]]?this[_0xc928('0x28')][this['actions'][_0x39a361[_0xc928('0x12d')]]['queue']]:this[_0xc928('0x27')][this[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]][_0xc928('0xb6')]]?this[_0xc928('0x27')][this[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]]['queue']][_0xc928('0x139')]||0x0:0x0;}this[_0xc928('0x27')][this[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]]['queue']][_0xc928('0x139')]=this[_0xc928('0x28')][this[_0xc928('0x23')][_0x39a361[_0xc928('0x12d')]][_0xc928('0xb6')]];for(var _0xbe4ab3=0x0;_0xbe4ab3=0x0;})[_0xc928('0xb2')](myreject(_0x132e51)));}}else{_0x220c38[_0xc928('0x132')](ami[_0xc928('0xaf')]({'action':_0xc928('0x154'),'command':util[_0xc928('0x77')](_0xc928('0x155'),_0x598800,!_[_0xc928('0x3c')](config[_0xc928('0x151')][_0x1c080f])?_0x1c080f:'')})['then'](function(_0x3c41c4){return _0x3c41c4['content']['indexOf'](_0xc928('0x153'))>=0x0;})['catch'](myreject(_0x132e51)));}BPromise[_0xc928('0x156')](_0x220c38)[_0xc928('0xb9')](function(_0x2afe0c){var _0x4a52d1=_['some'](_0x2afe0c);if(_0x4a52d1){return _0x17c961(_0x4a52d1);}else{_0x271a2b[_0xc928('0x3d')]=_0x2f3672?_0xc928('0x157'):'INTERVAL_IS_OVERTIME';return _0x132e51(msgResponse('[ifTime][promiseAll]',_0xc928('0x14c'),_0xc928('0x158')+_0x2f3672+'\x20'+_0x366bb1+_0xc928('0x159')+util['inspect'](_0x598800,{'showHidden':![],'depth':null})+_0xc928('0x15a')+_0x1c080f));}})[_0xc928('0xb2')](function(_0x30564f){return _0x132e51(msgResponse(_0xc928('0x149'),_0xc928('0x14c'),JSON[_0xc928('0x137')](_0x30564f)));});});};Dialer[_0xc928('0x17')]['checkDialMethod']=function(_0x5f4645){var _0x1980d6=this;return function(){switch(_0x5f4645[_0xc928('0x15b')]){case _0xc928('0x15c'):freeVariablesPredictive(_0x5f4645);_0x1980d6['handlePower'](_0x5f4645,0x1);break;case'power':freeVariablesPredictive(_0x5f4645);_0x1980d6[_0xc928('0x15d')](_0x5f4645,_0x5f4645[_0xc928('0x15e')]);break;case _0xc928('0x15f'):_0x1980d6[_0xc928('0x15f')](_0x5f4645);break;case _0xc928('0x7'):freeVariablesPredictive(_0x5f4645);_0x1980d6[_0xc928('0x15d')](_0x5f4645,0x1);break;default:freeVariablesPredictive(_0x5f4645);logger[_0xc928('0x95')]('Queue',_0x5f4645[_0xc928('0x3f')],_0xc928('0x160'));}};};Dialer[_0xc928('0x17')][_0xc928('0x161')]=function(_0x245bdd){var _0x3c16d9=this;return function(){_0x3c16d9[_0xc928('0x162')](_0x245bdd);};};Dialer[_0xc928('0x17')][_0xc928('0x8')]=function(_0x42b1b4){var _0x2e82f8=this;if(isNotPreview(_0x42b1b4['dialMethod'])){if(isVoiceQueueOutbound(_0x42b1b4[_0xc928('0x4c')])&&isActive(_0x42b1b4[_0xc928('0x163')])){_0x42b1b4[_0xc928('0xa0')]=!![];BPromise[_0xc928('0xbc')]()[_0xc928('0xb9')](checkIsLoggedIn(_0x42b1b4,_0x42b1b4[_0xc928('0x50')]))[_0xc928('0xb9')](checkIsActive(_0x42b1b4,_0x42b1b4[_0xc928('0x163')]))['then'](checkInterval(_0x42b1b4))[_0xc928('0xb9')](_0x2e82f8[_0xc928('0x145')](_0x42b1b4))[_0xc928('0xb9')](_0x2e82f8[_0xc928('0x164')](_0x42b1b4[_0xc928('0x165')],_0x42b1b4[_0xc928('0x166')],_0x42b1b4[_0xc928('0x3f')],_0x42b1b4))[_0xc928('0xb9')](_0x2e82f8[_0xc928('0x167')](_0x42b1b4[_0xc928('0x42')],_0x42b1b4[_0xc928('0x166')],_0x42b1b4['name'],_0x42b1b4))[_0xc928('0xb9')](_0x2e82f8[_0xc928('0x168')](_0x42b1b4))['catch'](loggerCatchQueueSummary(_0xc928('0x169'),_0x42b1b4));}else{notSendMessagesQueue(_0x42b1b4);}}else{freeVariablesPredictive(_0x42b1b4);}};Dialer[_0xc928('0x17')][_0xc928('0x144')]=function(){var _0x5152fe=this;var _0x4f30c5;for(var _0x108548 in this[_0xc928('0x1e')]){if(typeof this[_0xc928('0x1e')][_0x108548]!=='undefined'){_0x4f30c5=this[_0xc928('0x1e')][_0x108548];if(isCampaignIvr(_0x4f30c5[_0xc928('0x4c')])&&isActive(_0x4f30c5['active'])){_0x4f30c5['sendMessageOneNotActive']=!![];BPromise[_0xc928('0xbc')]()[_0xc928('0xb9')](checkIsActive(_0x4f30c5,_0x4f30c5[_0xc928('0x75')]))['then'](checkInterval(_0x4f30c5))[_0xc928('0xb9')](_0x5152fe[_0xc928('0x145')](_0x4f30c5))[_0xc928('0xb9')](_0x5152fe[_0xc928('0x164')](_0x4f30c5['dialGlobalInterval'],_0x4f30c5[_0xc928('0x166')],_0x4f30c5['name'],_0x4f30c5))['then'](_0x5152fe[_0xc928('0x167')](_0x4f30c5['Interval'],_0x4f30c5[_0xc928('0x166')],_0x4f30c5['name'],_0x4f30c5))[_0xc928('0xb9')](_0x5152fe[_0xc928('0x161')](_0x4f30c5))[_0xc928('0xb2')](loggerCatchQueueSummary('[syncCampaigns]',_0x4f30c5));}else{notSendMessagesCampaign(_0x4f30c5);}}}};function getCallerIdRandom(_0x1ed8f1,_0x1d6190){var _0x2df021;var _0x50e884;var _0x37c91f;if(_0x1d6190<=0x0){_0x1d6190=0x1;}_0x2df021=new RegExp('\x5cw{0,'+_0x1d6190+'}$');_0x50e884=Math[_0xc928('0x16a')](0xa,_0x1d6190-0x1);_0x37c91f=Math[_0xc928('0x16a')](0xa,_0x1d6190)-0x1;return util[_0xc928('0x77')]('%s',_[_0xc928('0x16b')](_0x1ed8f1,_0x2df021,_['random'](_0x50e884,_0x37c91f)));}function extractCalleridName(_0x1aaae6){var _0x6505ed=_0x1aaae6[_0xc928('0x16c')](/"(.*?)"/);return _0x6505ed?_0x6505ed[0x1]:_0x1aaae6;}function extractCalleridNumber(_0x27306b){var _0x474da1=_0x27306b['match'](/<(.*?)>/);return _0x474da1?_0x474da1[0x1]:_0x27306b;}Dialer[_0xc928('0x17')][_0xc928('0x16d')]=function(_0x28337d,_0x4ba6d9){var _0x333ae1=this;var _0x2ab472=uuid['v4']();this[_0xc928('0x23')][_0x2ab472]=new Action(_0x28337d,_0x4ba6d9,_0x2ab472);return new BPromise(function(_0x123aec,_0x116c30){if(_['isUndefined'](_0x28337d)&&typeof _0x28337d!==_0xc928('0x16e')){return _0x116c30(msgResponse('originate','Failure','voiceQueue\x20is\x20undefine'));}if(_[_0xc928('0x3c')](_0x4ba6d9[_0xc928('0x16f')][_0xc928('0x170')])||_0x4ba6d9['Contact']['phone']===null){return _0x116c30(msgResponse(_0xc928('0x171'),_0xc928('0x14c'),_0xc928('0x172')));}var _0x5c552b={'XMD-CALLERID':_0x333ae1[_0xc928('0x23')][_0x2ab472][_0xc928('0x173')](),'XMD-AGI':_0x28337d[_0xc928('0x10e')]?util[_0xc928('0x77')](_0xc928('0x174'),ipAgi,_0x28337d[_0xc928('0x10e')]):_0xc928('0x175'),'XMD-AGIAFTER':_0x28337d[_0xc928('0x117')]?util['format'](_0xc928('0x174'),ipAgi,_0x28337d[_0xc928('0x117')]):_0xc928('0x175'),'XMD-QUEUE':_0x28337d[_0xc928('0x4c')]===_0xc928('0x4d')?util['format']('\x22%s,%s%s,,,%s\x22',_0x28337d[_0xc928('0x3f')],_0x28337d['dialQueueOptions']||'',_0x28337d['dialAgiAfterHangupAgent']?'c':'',_0x28337d[_0xc928('0x11d')]||0x3):'NONE','XMD-CONTACTID':_0x4ba6d9[_0xc928('0x103')],'XMD-CDRTYPE':_0xc928('0x176'),'CALLERID(all)':_0x333ae1['actions'][_0x2ab472]['getCaller'](),'XMD-AMD':_0x28337d['dialAMDActive']?_0xc928('0x177'):'NONE','XMD-DESTINATION':_0xc928('0xe6')};if(_0x28337d[_0xc928('0xe7')]){_0x5c552b[_0xc928('0x178')]=_0x28337d[_0xc928('0x179')]||0x9c4;_0x5c552b[_0xc928('0x17a')]=_0x28337d[_0xc928('0x17b')]||0x5dc;_0x5c552b[_0xc928('0x17c')]=_0x28337d[_0xc928('0x17d')]||0x320;_0x5c552b['XMD-AMDTOTALANALYSISTIME']=_0x28337d[_0xc928('0x17e')]||0x1388;_0x5c552b[_0xc928('0x17f')]=_0x28337d['dialAMDMinWordLength']||0x64;_0x5c552b['XMD-AMDBETWEENWORDSSILENCE']=_0x28337d['dialAMDBetweenWordsSilence']||0x32;_0x5c552b['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x28337d['dialAMDMaximumNumberOfWords']||0x3;_0x5c552b[_0xc928('0x180')]=_0x28337d['dialAMDSilenceThreshold']||0x100;_0x5c552b[_0xc928('0x181')]=_0x28337d[_0xc928('0x182')]||0x1388;}if(_0x28337d[_0xc928('0x4c')]===_0xc928('0x4d')){_0x5c552b['XMD-VOICEQUEUEID']=_0x4ba6d9[_0xc928('0xd8')];}else{_0x5c552b[_0xc928('0x183')]=_0x4ba6d9[_0xc928('0x104')];}for(var _0x39a9ea in _0x4ba6d9[_0xc928('0x16f')]){if(typeof _0x4ba6d9[_0xc928('0x16f')][_0x39a9ea]!==_0xc928('0x99')){if(isNotNull(_0x4ba6d9[_0xc928('0x16f')][_0x39a9ea])&&_0x39a9ea!=='id'&&_0x39a9ea!==_0xc928('0x184')&&_0x39a9ea!==_0xc928('0x185')&&_0x39a9ea!==_0xc928('0x186')){_0x5c552b[util[_0xc928('0x77')](_0xc928('0x187'),_0xc928('0x188'),_[_0xc928('0x189')](_0x39a9ea))]=_0x4ba6d9[_0xc928('0x16f')][_0x39a9ea];}}}var _0x3b6f4a=_0x333ae1[_0xc928('0x146')](_0x28337d[_0xc928('0x74')])?getCallerId(_0x28337d[_0xc928('0x74')][_0xc928('0x76')],_0x28337d[_0xc928('0x58')],_0x28337d['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x28337d[_0xc928('0x59')],_0x28337d[_0xc928('0x18a')]):_0x28337d[_0xc928('0x59')]):getCallerId(_['isNil'](_0x28337d[_0xc928('0x147')])?_0x28337d[_0xc928('0x74')][_0xc928('0x76')]:_0x28337d[_0xc928('0x147')][_0xc928('0x76')],_0x28337d['dialOriginateCallerIdName'],_0x28337d[_0xc928('0x18a')]>0x0?getCallerIdRandom(_0x28337d[_0xc928('0x59')],_0x28337d[_0xc928('0x18a')]):_0x28337d[_0xc928('0x59')]);if(_0x3b6f4a){_0x5c552b[_0xc928('0x18b')]=_0x333ae1[_0xc928('0x23')][_0x2ab472][_0xc928('0x18c')]=extractCalleridName(_0x3b6f4a);_0x5c552b[_0xc928('0x18d')]=_0x333ae1[_0xc928('0x23')][_0x2ab472]['originatecalleridnum']=extractCalleridNumber(_0x3b6f4a);}return ami['Action']({'actionid':_0x2ab472,'action':'originate','channel':_0x333ae1['isTrunkReachable'](_0x28337d[_0xc928('0x74')])?util['format'](_0xc928('0x18e'),_0x28337d['Trunk']['name'],isNotNull(_0x28337d[_0xc928('0x5b')])?_0x28337d[_0xc928('0x5b')][_0xc928('0x18f')]()||'':'',_0x28337d[_0xc928('0x190')]>0x0?_0x4ba6d9[_0xc928('0x16f')][_0xc928('0x170')][_0xc928('0x191')](_0x28337d[_0xc928('0x190')]):_0x4ba6d9[_0xc928('0x16f')]['phone']):util[_0xc928('0x77')](_0xc928('0x18e'),_[_0xc928('0xe2')](_0x28337d[_0xc928('0x147')])?_0x28337d[_0xc928('0x74')][_0xc928('0x3f')]:_0x28337d[_0xc928('0x147')][_0xc928('0x3f')],isNotNull(_0x28337d[_0xc928('0x5b')])?_0x28337d[_0xc928('0x5b')][_0xc928('0x18f')]()||'':'',_0x28337d[_0xc928('0x190')]>0x0?_0x4ba6d9[_0xc928('0x16f')][_0xc928('0x170')][_0xc928('0x191')](_0x28337d['dialCutDigit']):_0x4ba6d9[_0xc928('0x16f')][_0xc928('0x170')]),'callerid':_0x3b6f4a,'Exten':'xcally-motion-dialer','Context':_0xc928('0x192'),'Priority':'1','variable':_0x5c552b,'timeout':(_0x28337d[_0xc928('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2ab472})['then'](function(_0x4ac82b){return _0x123aec(_0x4ac82b);})[_0xc928('0xb2')](function(_0x3ea9a8){_0x28337d[_0xc928('0x63')]+=0x1;var _0x5b6aff=new History(_0x333ae1[_0xc928('0x23')][_0x2ab472]);logger['error'](util[_0xc928('0x77')](_0xc928('0x193'),JSON[_0xc928('0x137')](_0x3ea9a8)));_0x5b6aff[_0xc928('0xe9')]=0xe;_0x5b6aff['statedesc']=_0xc928('0x194');_0x5b6aff[_0xc928('0xab')]=moment()[_0xc928('0x77')](_0xc928('0x102'));_0x5b6aff[_0xc928('0xaa')]=_0x5b6aff[_0xc928('0xab')];_0x333ae1[_0xc928('0xce')](_0x5b6aff)['catch'](loggerCatch(_0xc928('0x195')));_0x333ae1[_0xc928('0xcd')](_0x5b6aff)[_0xc928('0xb2')](loggerCatch(_0xc928('0x195')))[_0xc928('0x1a')](function(){delete _0x333ae1[_0xc928('0x23')][_0x2ab472];return _0x116c30(msgResponse(_0xc928('0x171'),'Error',_0xc928('0x196')));});});});};Dialer[_0xc928('0x17')]['syncOriginateResponse']=function(_0x15b7a4){var _0x5cf0f2=this[_0xc928('0x23')][_0x15b7a4[_0xc928('0x12d')]];if(_0x5cf0f2){delete this['actions'][_0x15b7a4[_0xc928('0x12d')]];_0x5cf0f2['responsetime']=moment()[_0xc928('0x77')]('YYYY-MM-DD\x20HH:mm:ss');var _0x58db8d=_0x5cf0f2[_0xc928('0x4c')]===_0xc928('0xb4')?this[_0xc928('0x1e')][_0x5cf0f2[_0xc928('0xb6')]]:this[_0xc928('0x1d')][_0x5cf0f2[_0xc928('0x197')]()];if(!this[_0xc928('0xdb')](_0x15b7a4[_0xc928('0x198')])){this['updateOriginated'](_0x58db8d);return this[_0xc928('0x199')](_0x5cf0f2,_0x58db8d,_0x15b7a4)['catch'](loggerCatch('[callProgressDetecting]\x20'));}this[_0xc928('0x24')][_0x15b7a4['uniqueid']]=_0x5cf0f2;}};Dialer[_0xc928('0x17')][_0xc928('0x19a')]=function(_0x3ee977,_0x1a521f,_0x13b12c){var _0x10a6e8=new History(_0x1a521f);if(_0x10a6e8[_0xc928('0xf7')]+_0x10a6e8[_0xc928('0xf8')]+_0x10a6e8[_0xc928('0xf9')]+_0x10a6e8[_0xc928('0xfa')]+_0x10a6e8['countdropretry']+_0x10a6e8[_0xc928('0x109')]+_0x10a6e8[_0xc928('0xf4')]+_0x10a6e8['countagentrejectretry']>=_0x13b12c[_0xc928('0x10a')]-0x1){return!![];}switch(_0x3ee977){case 0x3:if(_0x10a6e8['countnoanswerretry']>=_0x13b12c['dialNoAnswerMaxRetry']-0x1){return!![];}this[_0xc928('0xc2')]({'active':![],'countnoanswerretry':_0x10a6e8['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xc928('0xff')](_0x13b12c[_0xc928('0x19b')],_0xc928('0x101'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x10a6e8['ContactId'],'ListId':_0x10a6e8[_0xc928('0xd6')],'VoiceQueueId':_0x10a6e8[_0xc928('0xd8')]||undefined,'CampaignId':_0x10a6e8[_0xc928('0x104')]||undefined})['catch'](loggerCatch(_0xc928('0x19c')));break;case 0x5:if(_0x10a6e8[_0xc928('0xf7')]>=_0x13b12c['dialBusyMaxRetry']-0x1){return!![];}this[_0xc928('0xc2')]({'active':![],'countbusyretry':_0x10a6e8['countbusyretry']+=0x1,'scheduledat':moment()[_0xc928('0xff')](_0x13b12c[_0xc928('0x19d')],_0xc928('0x101'))['format'](_0xc928('0x102')),'ContactId':_0x10a6e8[_0xc928('0x103')],'ListId':_0x10a6e8[_0xc928('0xd6')],'VoiceQueueId':_0x10a6e8[_0xc928('0xd8')]||undefined,'CampaignId':_0x10a6e8[_0xc928('0x104')]||undefined})[_0xc928('0xb2')](loggerCatch(_0xc928('0x19e')));break;case 0x8:if(_0x10a6e8[_0xc928('0xf8')]>=_0x13b12c[_0xc928('0x19f')]-0x1){return!![];}this[_0xc928('0xc2')]({'active':![],'countcongestionretry':_0x10a6e8['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x13b12c['dialCongestionRetryFrequency'],_0xc928('0x101'))[_0xc928('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x10a6e8[_0xc928('0x103')],'ListId':_0x10a6e8['ListId'],'VoiceQueueId':_0x10a6e8[_0xc928('0xd8')]||undefined,'CampaignId':_0x10a6e8[_0xc928('0x104')]||undefined})[_0xc928('0xb2')](loggerCatch(_0xc928('0x1a0')));break;case 0x0:if(_0x10a6e8[_0xc928('0xfa')]>=_0x13b12c[_0xc928('0x1a1')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x10a6e8[_0xc928('0xfa')]+=0x1,'scheduledat':moment()[_0xc928('0xff')](_0x13b12c[_0xc928('0x1a2')],_0xc928('0x101'))[_0xc928('0x77')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x10a6e8[_0xc928('0x103')],'ListId':_0x10a6e8['ListId'],'VoiceQueueId':_0x10a6e8[_0xc928('0xd8')]||undefined,'CampaignId':_0x10a6e8[_0xc928('0x104')]||undefined})[_0xc928('0xb2')](loggerCatch(_0xc928('0x1a3')));}break;case 0xa:if(_0x10a6e8[_0xc928('0x120')]>=_0x13b12c['dialDropMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x10a6e8['countdropretry']+=0x1,'scheduledat':moment()[_0xc928('0xff')](_0x13b12c[_0xc928('0x122')],_0xc928('0x101'))[_0xc928('0x77')](_0xc928('0x102')),'ContactId':_0x10a6e8[_0xc928('0x103')],'ListId':_0x10a6e8[_0xc928('0xd6')],'VoiceQueueId':_0x10a6e8['VoiceQueueId']||undefined,'CampaignId':_0x10a6e8[_0xc928('0x104')]||undefined})[_0xc928('0xb2')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x10a6e8[_0xc928('0x109')]>=_0x13b12c[_0xc928('0x1a4')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x10a6e8[_0xc928('0x109')]+=0x1,'scheduledat':moment()[_0xc928('0xff')](_0x13b12c[_0xc928('0x12a')],_0xc928('0x101'))[_0xc928('0x77')](_0xc928('0x102')),'ContactId':_0x10a6e8[_0xc928('0x103')],'ListId':_0x10a6e8['ListId'],'VoiceQueueId':_0x10a6e8[_0xc928('0xd8')]||undefined,'CampaignId':_0x10a6e8[_0xc928('0x104')]||undefined})['catch'](loggerCatch(_0xc928('0x12b')));break;case 0x13:if(_0x10a6e8[_0xc928('0xf4')]>=_0x13b12c[_0xc928('0xfc')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x10a6e8[_0xc928('0xf4')]+=0x1,'scheduledat':moment()[_0xc928('0xff')](_0x13b12c[_0xc928('0x100')],_0xc928('0x101'))[_0xc928('0x77')](_0xc928('0x102')),'ContactId':_0x10a6e8[_0xc928('0x103')],'ListId':_0x10a6e8[_0xc928('0xd6')],'VoiceQueueId':_0x10a6e8['VoiceQueueId']||undefined,'CampaignId':_0x10a6e8[_0xc928('0x104')]||undefined})['catch'](loggerCatch(_0xc928('0x105')));break;case 0x14:if(_0x10a6e8[_0xc928('0xfb')]>=_0x13b12c[_0xc928('0x1a5')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x10a6e8[_0xc928('0xfb')]+=0x1,'scheduledat':moment()[_0xc928('0xff')](_0x13b12c['dialAgentRejectRetryFrequency'],_0xc928('0x101'))['format'](_0xc928('0x102')),'ContactId':_0x10a6e8[_0xc928('0x103')],'ListId':_0x10a6e8[_0xc928('0xd6')],'VoiceQueueId':_0x10a6e8['VoiceQueueId']||undefined,'CampaignId':_0x10a6e8[_0xc928('0x104')]||undefined})[_0xc928('0xb2')](loggerCatch(_0xc928('0x1a6')));break;default:return!![];}};Dialer[_0xc928('0x17')][_0xc928('0x199')]=function(_0x328181,_0x3fd78a,_0x462c50){var _0x136de0=this;var _0x4377ad=new History(_0x328181);return new BPromise(function(_0xcd8513,_0xbd4fad){if(_['isUndefined'](_0x3fd78a)&&typeof _0x3fd78a!==_0xc928('0x16e')){return _0xbd4fad(msgResponse('[callProgressDetecting]',_0xc928('0x14c'),_0xc928('0x1a7')));}if(_['isUndefined'](_0x462c50)&&typeof _0x462c50!==_0xc928('0x16e')){return _0xbd4fad(msgResponse(_0xc928('0x1a8'),'Failure',_0xc928('0x1a9')));}switch(_0x462c50['reason']){case'0':_0x3fd78a['outboundNoSuchCallsDay']+=0x1;_0x4377ad[_0xc928('0xe9')]=0x0;_0x4377ad[_0xc928('0xa9')]='NoSuchNumber';_0x4377ad['countnosuchnumberretry']+=0x1;_0x4377ad[_0xc928('0xf5')]+=0x1;ami['emit'](_0xc928('0x1aa'),ut[_0xc928('0xee')](_0x328181,_0xc928('0x1ab')));_0x136de0[_0xc928('0xce')](_0x4377ad)['catch'](loggerCatch(_0xc928('0xf6')));if(_0x136de0[_0xc928('0x19a')](0x0,_0x328181,_0x3fd78a)){if(_0x4377ad[_0xc928('0xfa')]>=_0x3fd78a['dialNoSuchNumberMaxRetry']){_0x136de0[_0xc928('0xfd')](_0x4377ad,_0xcd8513,_0xbd4fad,_0xc928('0x1ac'));}else{_0x136de0[_0xc928('0x1ad')](_0x4377ad,_0xcd8513,_0xbd4fad,_0xc928('0x1ac'));}}break;case'3':_0x3fd78a[_0xc928('0x61')]+=0x1;_0x4377ad[_0xc928('0xe9')]=0x3;_0x4377ad[_0xc928('0xa9')]=_0xc928('0x1ae');_0x4377ad[_0xc928('0xf9')]+=0x1;_0x4377ad[_0xc928('0xf5')]+=0x1;ami['emit']('custom:agentnoanswer',ut[_0xc928('0xee')](_0x328181,_0xc928('0x1af')));_0x136de0[_0xc928('0xce')](_0x4377ad)[_0xc928('0xb2')](loggerCatch(_0xc928('0x1b0')));if(_0x136de0['checkRetriveMax'](0x3,_0x328181,_0x3fd78a)){if(_0x4377ad[_0xc928('0xf9')]>=_0x3fd78a[_0xc928('0x1b1')]){_0x136de0[_0xc928('0xfd')](_0x4377ad,_0xcd8513,_0xbd4fad,_0xc928('0x1b2'));}else{_0x136de0['stateGlobal'](_0x4377ad,_0xcd8513,_0xbd4fad,_0xc928('0x1b2'));}}break;case'5':_0x3fd78a[_0xc928('0x1b3')]+=0x1;_0x4377ad[_0xc928('0xe9')]=0x5;_0x4377ad[_0xc928('0xa9')]=_0xc928('0x1b4');_0x4377ad[_0xc928('0xf7')]+=0x1;_0x4377ad[_0xc928('0xf5')]+=0x1;ami[_0xc928('0x4b')](_0xc928('0x1b5'),ut[_0xc928('0xee')](_0x328181,_0xc928('0x1b6')));_0x136de0[_0xc928('0xce')](_0x4377ad)[_0xc928('0xb2')](loggerCatch(_0xc928('0x1b7')));if(_0x136de0[_0xc928('0x19a')](0x5,_0x328181,_0x3fd78a)){if(_0x4377ad[_0xc928('0xf7')]>=_0x3fd78a['dialBusyMaxRetry']){_0x136de0[_0xc928('0xfd')](_0x4377ad,_0xcd8513,_0xbd4fad,_0xc928('0x1b8'));}else{_0x136de0['stateGlobal'](_0x4377ad,_0xcd8513,_0xbd4fad,'reason\x205\x20busy');}}break;case'8':_0x3fd78a[_0xc928('0x5f')]+=0x1;_0x4377ad[_0xc928('0xe9')]=0x8;_0x4377ad[_0xc928('0xa9')]=_0xc928('0x1b9');_0x4377ad[_0xc928('0xf8')]+=0x1;_0x4377ad['countglobal']+=0x1;ami[_0xc928('0x4b')](_0xc928('0x1ba'),ut[_0xc928('0xee')](_0x328181,_0xc928('0x1bb')));_0x136de0[_0xc928('0xce')](_0x4377ad)[_0xc928('0xb2')](loggerCatch(_0xc928('0x1bc')));if(_0x136de0[_0xc928('0x19a')](0x8,_0x328181,_0x3fd78a)){if(_0x4377ad[_0xc928('0xf8')]>=_0x3fd78a[_0xc928('0x19f')]){_0x136de0[_0xc928('0xfd')](_0x4377ad,_0xcd8513,_0xbd4fad,_0xc928('0x1bd'));}else{_0x136de0['stateGlobal'](_0x4377ad,_0xcd8513,_0xbd4fad,_0xc928('0x1bd'));}}break;case'11':_0x3fd78a[_0xc928('0x1be')]+=0x1;_0x4377ad[_0xc928('0xe9')]=0xb;_0x4377ad['statedesc']=_0xc928('0x127');_0x4377ad['countabandonedretry']+=0x1;_0x4377ad[_0xc928('0xf5')]+=0x1;_0x136de0[_0xc928('0xce')](_0x4377ad)[_0xc928('0xb2')](loggerCatch(_0xc928('0x12c')));if(_0x136de0[_0xc928('0x19a')](0xb,_0x328181,_0x3fd78a)){if(_0x4377ad['countabandonedretry']>=_0x3fd78a['dialAbandonedMaxRetry']){_0x136de0[_0xc928('0xfd')](_0x4377ad,_0xcd8513,_0xbd4fad,_0xc928('0x1bf'));}else{_0x136de0[_0xc928('0x1ad')](_0x4377ad,_0xcd8513,_0xbd4fad,'reason\x2011\x20abandoned');}}break;case'20':_0x3fd78a[_0xc928('0x65')]+=0x1;_0x4377ad[_0xc928('0xe9')]=0x14;_0x4377ad[_0xc928('0xa9')]=_0xc928('0x1c0');_0x4377ad[_0xc928('0xfb')]+=0x1;_0x4377ad[_0xc928('0xf5')]+=0x1;ami['emit'](_0xc928('0x1c1'),ut[_0xc928('0xee')](_0x328181,_0xc928('0x1c2')));_0x136de0[_0xc928('0xce')](_0x4377ad)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x136de0['checkRetriveMax'](0x14,_0x328181,_0x3fd78a)){if(_0x4377ad['countagentrejectretry']>=_0x3fd78a[_0xc928('0x1a5')]){_0x136de0[_0xc928('0xfd')](_0x4377ad,_0xcd8513,_0xbd4fad,_0xc928('0x1c3'));}else{_0x136de0[_0xc928('0x1ad')](_0x4377ad,_0xcd8513,_0xbd4fad,_0xc928('0x1c3'));}}break;default:_0x3fd78a[_0xc928('0x66')]+=0x1;_0x4377ad[_0xc928('0xe9')]=0xc;_0x4377ad[_0xc928('0xa9')]=_0x462c50[_0xc928('0x114')];_0x136de0['createHistory'](_0x4377ad)[_0xc928('0xb2')](loggerCatch(_0xc928('0x1c4')));if(_0x136de0[_0xc928('0x19a')](_0x462c50[_0xc928('0x114')],_0x328181,_0x3fd78a)){if(_0x4377ad[_0xc928('0xf7')]+_0x4377ad['countcongestionretry']+_0x4377ad['countnoanswerretry']+_0x4377ad['countnosuchnumberretry']+_0x4377ad[_0xc928('0x120')]+_0x4377ad[_0xc928('0x109')]+_0x4377ad[_0xc928('0xf4')]+_0x4377ad[_0xc928('0xfb')]>=_0x3fd78a['dialGlobalMaxRetry']){_0x136de0[_0xc928('0x1ad')](_0x4377ad,_0xcd8513,_0xbd4fad,_0x462c50[_0xc928('0x114')]);}else{_0x136de0[_0xc928('0xfd')](_0x4377ad,_0xcd8513,_0xbd4fad,_0x462c50['reason']);}}}});};Dialer['prototype']['stateGlobal']=function(_0x133bcb,_0x1edc4d,_0x28fe17,_0x415e57){var _0x1c0ba6=new Final(_0x133bcb);_0x1c0ba6[_0xc928('0xe9')]=0xf;_0x1c0ba6['statedesc']=_0xc928('0x1c5');this[_0xc928('0xfd')](_0x1c0ba6,_0x1edc4d,_0x28fe17,_0x415e57);};Dialer['prototype'][_0xc928('0xfd')]=function(_0x225cbc,_0x141d75,_0x1fb89b,_0x43effb){this[_0xc928('0xcd')](_0x225cbc)['then'](function(){return _0x141d75(msgResponse(_0xc928('0x1a8'),_0xc928('0xdc'),_0x43effb));})[_0xc928('0xb2')](function(){return _0x1fb89b(msgResponse(_0xc928('0x1c6'),'Failure',_0xc928('0x1c7')));});};Dialer[_0xc928('0x17')][_0xc928('0x15f')]=function(_0x1d2425){var _0x14020b=_0x1d2425['dialPredictiveOptimizationPercentage']/0x64;var _0x57790c=_0x1d2425[_0xc928('0x11e')]/(_0x1d2425['outboundDropCallsDayTimeout']+_0x1d2425[_0xc928('0x5d')]);var _0x1fb318=Math['round'](_0x1d2425[_0xc928('0x6d')]*(_0x1d2425[_0xc928('0x1c8')]/0x64));var _0x5e7f45=Math[_0xc928('0x1c9')](_0x1d2425['predictiveIntervalAvailable']*(_0x1d2425[_0xc928('0x1ca')]/0x64));var _0x3d6382=_0x1d2425['available']+_0x1d2425[_0xc928('0x54')];var _0xda6693=Math[_0xc928('0x1cb')](_0x1d2425[_0xc928('0x70')]*_0x1d2425[_0xc928('0x8d')]*_0x1d2425[_0xc928('0x6c')]*_0x1d2425[_0xc928('0x1cc')]);if(_[_0xc928('0x3c')](_0x1d2425['startProgressive'])){if(!_[_0xc928('0x3c')](_0x1d2425[_0xc928('0x26')])){_0x1d2425['startPredictive']=undefined;loggerPredictive[_0xc928('0x95')](_0xc928('0x1cd'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xc928('0x3c')](_0x1d2425[_0xc928('0x90')])){loggerPredictive['error'](_0xc928('0x1cd'),_0xc928('0x1ce'));clearInterval(_0x1d2425['handlePredictive']);_0x1d2425[_0xc928('0x90')]=undefined;}_0x1d2425[_0xc928('0x73')]=moment()[_0xc928('0x77')](_0xc928('0x102'));loggerPredictive[_0xc928('0x7c')](_0x1d2425[_0xc928('0x3f')],_0xc928('0x1cf'),_0x1d2425[_0xc928('0x73')]);this['handlePower'](_0x1d2425,0x1);}else if(ifInterval(_0x1d2425[_0xc928('0x1d0')],_0x1d2425[_0xc928('0x73')])){this['handlePower'](_0x1d2425,0x1);loggerPredictiveCalls['info'](_0xc928('0x1d1'),_0x1d2425['startProgressive'],_0x1d2425[_0xc928('0x3f')]);_0x1d2425[_0xc928('0x70')]=0x0;_0x1d2425['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x14020b<_0x57790c&&_0x1d2425[_0xc928('0x1d2')]==='dropRate'){freeVariablesPredictive(_0x1d2425);loggerPredictive[_0xc928('0x7c')](_0xc928('0x1d3'),_0xc928('0x1d4'),_0x57790c,_0xc928('0x73'),_0x1d2425['name']);}else if(_0xda6693<_0x1d2425[_0xc928('0x6b')]&&_0x1d2425['dialPredictiveOptimization']===_0xc928('0x1d5')){freeVariablesPredictive(_0x1d2425);loggerPredictive[_0xc928('0x7c')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xc928('0x1d6'),_0xda6693,_0xc928('0x1d7'),_0x1d2425['predictiveIntervalErlangCallsDroppedCalls'],_0xc928('0x73'),_0x1d2425[_0xc928('0x3f')]);}else if(!ifInterval(_0x1d2425[_0xc928('0x1d0')],_0x1d2425[_0xc928('0x73')])&&_['isUndefined'](_0x1d2425[_0xc928('0x26')])&&!_[_0xc928('0x3c')](_0x1d2425['startProgressive'])){_0x1d2425[_0xc928('0x26')]=moment()[_0xc928('0x77')](_0xc928('0x102'));loggerPredictive[_0xc928('0x7c')](_0x1d2425[_0xc928('0x3f')],_0xc928('0x1d8'),_0x1d2425[_0xc928('0x26')]);this[_0xc928('0xc0')](_0x1d2425[_0xc928('0x1d0')])[_0xc928('0xb9')](this[_0xc928('0x1d9')](_0x1d2425))[_0xc928('0xb9')](mergeDataErlangB(_0x1d2425))[_0xc928('0xb9')](this[_0xc928('0x1da')](_0x1d2425))[_0xc928('0xb2')](loggerCatchPredictive(_0xc928('0x1db'),_0x1d2425));}else if(!ifInterval(_0x1d2425[_0xc928('0x1d0')],_0x1d2425[_0xc928('0x26')])){_0x1d2425['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x1d2425[_0xc928('0x26')]=moment()['format'](_0xc928('0x102'));loggerPredictive['info'](_0x1d2425[_0xc928('0x3f')],_0xc928('0x1dc'),_0x1d2425['startPredictive']);clearInterval(_0x1d2425[_0xc928('0x90')]);_0x1d2425[_0xc928('0x90')]=undefined;this[_0xc928('0xc0')](_0x1d2425[_0xc928('0x1d0')])[_0xc928('0xb9')](this['getDataPredictive'](_0x1d2425))[_0xc928('0xb9')](mergeDataErlangB(_0x1d2425))[_0xc928('0xb9')](this[_0xc928('0x1da')](_0x1d2425))[_0xc928('0xb2')](loggerCatchPredictive(_0xc928('0x1dd'),_0x1d2425));}else if(_0x1d2425[_0xc928('0x6d')]&&_0x3d6382<_0x1d2425['predictiveIntervalAvailable']-_0x5e7f45){freeVariablesPredictive(_0x1d2425);loggerPredictive[_0xc928('0x7c')](_0x1d2425[_0xc928('0x3f')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3d6382,')\x20are\x20less\x20than\x20threshold\x20(',_0x1d2425[_0xc928('0x6d')],'-',_0x5e7f45,'=',_0x1d2425[_0xc928('0x6d')]-_0x5e7f45,')');}else if(_0x1d2425[_0xc928('0x6d')]&&_0x3d6382>_0x1d2425['predictiveIntervalAvailable']+_0x1fb318){freeVariablesPredictive(_0x1d2425);loggerPredictive[_0xc928('0x7c')](_0x1d2425[_0xc928('0x3f')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x3d6382,')\x20are\x20more\x20than\x20threshold\x20(',_0x1d2425[_0xc928('0x6d')],'+',_0x1fb318,'=',_0x1d2425[_0xc928('0x6d')]+_0x1fb318,')');}};Dialer[_0xc928('0x17')][_0xc928('0x1d9')]=function(_0x189bd0){var _0x54eeb1=this;return function(_0x5afbbc){return new BPromise(function(_0x308bb4,_0x1f64ac){_[_0xc928('0xd5')](_0x189bd0,_0x5afbbc[0x0]);if(checkGetDataPredictive(_0x5afbbc[0x0])){var _0x151b41=_0x189bd0[_0xc928('0x6d')]=_0x189bd0['talking']+_0x189bd0[_0xc928('0xa3')];var _0x4fab97=_0x189bd0[_0xc928('0x1d0')]*0x3c;var _0x49e5b9=_0x5afbbc[0x0][_0xc928('0x84')]+_0x5afbbc[0x0][_0xc928('0x67')];var _0x26575d=(_0x5afbbc[0x0][_0xc928('0x7f')]+_0x5afbbc[0x0][_0xc928('0x69')]+_0x5afbbc[0x0][_0xc928('0x68')])/_0x5afbbc[0x0][_0xc928('0x6e')];_0x189bd0[_0xc928('0x6c')]=_0x26575d>0x0?_0x26575d:0x1;switch(_0x189bd0[_0xc928('0x1d2')]){case _0xc928('0x1d5'):var _0x1b4731=_0x189bd0[_0xc928('0x1de')]/0x64;return _0x54eeb1[_0xc928('0x1df')](_0x151b41,_0x4fab97,_0x49e5b9,_0x26575d,_0x1b4731)[_0xc928('0xb9')](function(_0x1622b3){return _0x308bb4(_0x1622b3);});case'agentBusyFactor':var _0x5edb75=_0x189bd0[_0xc928('0x1de')]/0x64;return _0x54eeb1[_0xc928('0x1e0')](_0x151b41,_0x4fab97,_0x49e5b9,_0x26575d,_0x5edb75)[_0xc928('0xb9')](function(_0x33ac96){return _0x308bb4(_0x33ac96);});default:return _0x1f64ac(msgResponse(_0xc928('0x1e1'),_0xc928('0x14c'),_0xc928('0x1e2')));}}else{return _0x1f64ac(msgResponse(_0xc928('0x1e1'),_0xc928('0x14c'),_0xc928('0x1e3')));}});};};Dialer[_0xc928('0x17')]['getDataPredictiveOld']=function(_0x4ed10c){var _0x3ca389=this;return function(_0x212235){return new BPromise(function(_0x2cfe04,_0x33c800){_['merge'](_0x4ed10c,_0x212235[0x0]);if(checkGetDataPredictive(_0x212235[0x0])){loggerPredictive[_0xc928('0x7c')](JSON['stringify'](_0x212235[0x0]));if(_0x4ed10c[_0xc928('0x1d2')]===_0xc928('0x1d5')){return _0x3ca389[_0xc928('0xcb')](_0x4ed10c['id'])[_0xc928('0xb9')](function(_0x4fca87){var _0x1a10a4=_0x4ed10c[_0xc928('0x50')]-_0x4fca87[0x0][_0xc928('0x1e4')];var _0x244193=_0x4ed10c[_0xc928('0x1d0')]*0x3c;var _0x388aa1=_0x212235[0x0][_0xc928('0x84')]+_0x212235[0x0]['predictiveIntervalAvgHoldtime'];var _0x5c4e08=(_0x212235[0x0][_0xc928('0x7f')]+_0x212235[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x212235[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x212235[0x0][_0xc928('0x6e')];var _0x27950f=_0x4ed10c['dialPredictiveOptimizationPercentage']/0x64;_0x4ed10c['predictiveIntervalPauses']=_0x4fca87[0x0][_0xc928('0x1e4')]||0x0;_0x4ed10c[_0xc928('0x6c')]=_0x5c4e08>0x0?_0x5c4e08:0x1;return _0x3ca389[_0xc928('0x1df')](_0x1a10a4,_0x244193,_0x388aa1,_0x5c4e08,_0x27950f);})[_0xc928('0xb9')](function(_0x4207fd){return _0x2cfe04(_0x4207fd);})['catch'](function(_0x9702ea){return _0x33c800(msgResponse(_0xc928('0x1e5'),_0xc928('0x14c'),JSON['stringify'](_0x9702ea)));});}if(_0x4ed10c[_0xc928('0x1d2')]===_0xc928('0x1e6')){return _0x3ca389[_0xc928('0xcb')](_0x4ed10c['id'])[_0xc928('0xb9')](function(_0x1ffba1){var _0x5f595f=_0x4ed10c[_0xc928('0x50')]-_0x1ffba1[0x0][_0xc928('0x1e4')];var _0x25286e=_0x4ed10c[_0xc928('0x1d0')]*0x3c;var _0x225957=_0x212235[0x0][_0xc928('0x84')]+_0x212235[0x0][_0xc928('0x67')];var _0xca7e50=(_0x212235[0x0]['predictiveIntervalAnsweredCalls']+_0x212235[0x0][_0xc928('0x69')]+_0x212235[0x0][_0xc928('0x68')])/_0x212235[0x0]['predictiveIntervalTotalCalls'];var _0x5cea90=_0x4ed10c[_0xc928('0x1de')]/0x64;_0x4ed10c['predictiveIntervalPauses']=_0x1ffba1[0x0]['outboundQueuePauses']||0x0;_0x4ed10c[_0xc928('0x6c')]=_0xca7e50>0x0?_0xca7e50:0x1;return _0x3ca389[_0xc928('0x1e0')](_0x5f595f,_0x25286e,_0x225957,_0xca7e50,_0x5cea90);})[_0xc928('0xb9')](function(_0x21356d){return _0x2cfe04(_0x21356d);})['catch'](function(_0x53e4c7){return _0x33c800(msgResponse(_0xc928('0x1e5'),_0xc928('0x14c'),JSON[_0xc928('0x137')](_0x53e4c7)));});}}else{return _0x33c800(msgResponse(_0xc928('0x1e1'),_0xc928('0x14c'),_0xc928('0x1e3')));}});};};Dialer[_0xc928('0x17')]['startMethodPredictive']=function(_0x496732){var _0x4fbafb=this;return function(){var _0x5339e3=0x0;var _0x17bb6e=Math['floor'](_0x496732[_0xc928('0x71')]*0x3e8);if(_0x17bb6e>0x0){_0x17bb6e=_0x17bb6e<0x64?0x64:_0x17bb6e;loggerPredictive[_0xc928('0x7c')](_0x496732[_0xc928('0x3f')],_0xc928('0x1e7'),_0x17bb6e,_0xc928('0x48'));_0x496732[_0xc928('0x90')]=setInterval(function(){_0x4fbafb['handlePredictive'](_0x496732);loggerPredictiveCalls[_0xc928('0x7c')](_0xc928('0x1e8'),_0x5339e3+=0x1);},_0x17bb6e);}else{loggerPredictive['info'](_0x496732[_0xc928('0x3f')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xc928('0x17')][_0xc928('0x1e9')]=function(_0x1c4557,_0x259b87){var _0x371daa=this;return function(_0x4cc5d0){if(_[_0xc928('0x46')](_0x4cc5d0)){if(_['isNil'](_0x259b87[_0xc928('0xd7')])||!_0x259b87[_0xc928('0x1ea')]){if(_0x1c4557[_0xc928('0x15b')]===_0xc928('0x7')){_0x1c4557[_0xc928('0x135')]=_['isUndefined'](_0x1c4557[_0xc928('0x135')])?!![]:_0x1c4557[_0xc928('0x135')];var _0x4bd4bd=uuid['v4']();_0x371daa[_0xc928('0x23')][_0x4bd4bd]=new Action(_0x1c4557,_0x259b87,_0x4bd4bd);loggerBooked[_0xc928('0x7c')](_0xc928('0x1eb'),_0x4bd4bd,_0xc928('0x1ec'),JSON[_0xc928('0x137')](_0x1c4557['queueStatusComplete']),'Queue:\x20',_0x1c4557[_0xc928('0x3f')]);if(_0x1c4557[_0xc928('0x135')]){_0x1c4557['queueStatusComplete']=![];_0x371daa[_0xc928('0x27')][_0x371daa[_0xc928('0x23')][_0x4bd4bd][_0xc928('0xb6')]]=[];ami[_0xc928('0xaf')]({'actionid':_0x4bd4bd,'action':'queuestatus','queue':_0x1c4557[_0xc928('0x3f')]})[_0xc928('0xb2')](function(){_0x371daa['updateOriginated'](_0x1c4557);_0x371daa['rescheduleContact']({'active':![],'ContactId':_0x371daa['actions'][_0x4bd4bd][_0xc928('0x103')],'ListId':_0x371daa[_0xc928('0x23')][_0x4bd4bd]['ListId'],'VoiceQueueId':_0x371daa[_0xc928('0x23')][_0x4bd4bd]['VoiceQueueId']||undefined,'CampaignId':_0x371daa['actions'][_0x4bd4bd][_0xc928('0x104')]||undefined})[_0xc928('0xb2')](loggerCatch(_0xc928('0x1ed')));delete _0x371daa[_0xc928('0x23')][_0x4bd4bd];});}else{loggerBooked[_0xc928('0x7c')]('[booked][checkContactBlack][else]',JSON[_0xc928('0x137')](_0x1c4557['queueStatusComplete']),_0xc928('0x1ee'),_0x1c4557['name']);_0x371daa[_0xc928('0xb5')](_0x1c4557);_0x371daa[_0xc928('0xc2')]({'active':![],'ContactId':_0x371daa['actions'][_0x4bd4bd][_0xc928('0x103')],'ListId':_0x371daa[_0xc928('0x23')][_0x4bd4bd][_0xc928('0xd6')],'VoiceQueueId':_0x371daa[_0xc928('0x23')][_0x4bd4bd]['VoiceQueueId']||undefined,'CampaignId':_0x371daa[_0xc928('0x23')][_0x4bd4bd][_0xc928('0x104')]||undefined})[_0xc928('0xb2')](loggerCatch(_0xc928('0x1ed')));delete _0x371daa[_0xc928('0x23')][_0x4bd4bd];}}else{return _0x371daa[_0xc928('0x16d')](_0x1c4557,_0x259b87);}}else{if(getDiff(_0x259b87['scheduledat'])<_0x1c4557['dialRecallMeTimeout']*0x3c){if(_0x259b87[_0xc928('0x1ef')]&&!_0x259b87['Agent'][_0xc928('0x1f0')]){_0x371daa[_0xc928('0x1c')][_0xc928('0x13e')](_0x259b87['id'])['finally'](function(){_0x371daa[_0xc928('0xb5')](_0x1c4557);});}else{_0x371daa[_0xc928('0xc4')]({'active':![]},_0x259b87['id'],0x1)[_0xc928('0x1a')](function(){_0x371daa[_0xc928('0xb5')](_0x1c4557);});}}else{_0x1c4557[_0xc928('0x64')]+=0x1;_0x371daa[_0xc928('0xb5')](_0x1c4557);if(_0x1c4557[_0xc928('0x1f1')]){_0x371daa[_0xc928('0xc2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x259b87[_0xc928('0x103')],'ListId':_0x259b87['ListId'],'VoiceQueueId':_0x259b87[_0xc928('0xd8')]||undefined,'CampaignId':_0x259b87[_0xc928('0x104')]||undefined})['catch'](loggerCatch(_0xc928('0x1f2')));_0x371daa[_0xc928('0xce')](createObjHistory(_0x1c4557,_0x259b87,_0xc928('0x1f3'),0x17,_0xc928('0x1f4')))[_0xc928('0xb2')](loggerCatch(_0xc928('0x1f5')));}else{_0x371daa[_0xc928('0xdf')](createObjHistory(_0x1c4557,_0x259b87,'RECALLFAILEDTIMEOUT',0x16,_0xc928('0x1f6')),'[Originate][HistoryRecallClose][historyCatch]',_0xc928('0x1f7'));}}}}else{_0x1c4557['outboundBlacklistCallsDay']+=0x1;_0x371daa[_0xc928('0xdf')](createObjHistory(_0x1c4557,_0x259b87,_0xc928('0x1f8'),0xd,'Blacklist'),'[Originate][historyBlacklist]',_0xc928('0x1f9'));throw _0xc928('0x1fa');}};};Dialer[_0xc928('0x17')][_0xc928('0x162')]=function(_0x4bbfb9){var _0x26fee6=this;var _0x169406=_0x4bbfb9[_0xc928('0x1fb')]-_0x4bbfb9['originated']-_0x4bbfb9[_0xc928('0xc7')];emitCampaignSummary(_0x4bbfb9);if(_0x169406>0x0){if(_0x169406>this[_0xc928('0x21')]){_0x169406=this['maxNumberOriginate'];}_0x4bbfb9['temp']+=_0x169406;this[_0xc928('0xc9')](_0x4bbfb9['id'],_0x169406,_0x4bbfb9['dialOrderByScheduledAt'],_0x4bbfb9)[_0xc928('0xb9')](function(_0xd99082){_0x4bbfb9[_0xc928('0xc7')]-=_0x169406;_0x4bbfb9[_0xc928('0xc7')]=_0x4bbfb9['temp']>0x0?_0x4bbfb9['temp']:0x0;if(!checkContactEmpty(_0xd99082)){_0x4bbfb9[_0xc928('0x3d')]=_0xc928('0x1fc');logger['info'](_0xc928('0x1fd')+_0x4bbfb9[_0xc928('0x3f')]);}else{_0x4bbfb9[_0xc928('0x6f')]+=_0xd99082['length'];_0x4bbfb9[_0xc928('0x3d')]=_0xc928('0x1fe');for(var _0x4521cb=0x0;_0x4521cb<_0xd99082[_0xc928('0x98')];_0x4521cb+=0x1){_0x4bbfb9[_0xc928('0x1ff')]+=0x1;if(_[_0xc928('0xe2')](_0xd99082[_0x4521cb])||_[_0xc928('0xe2')](_0xd99082[_0x4521cb][_0xc928('0x16f')])||_['isNil'](_0xd99082[_0x4521cb][_0xc928('0x16f')][_0xc928('0x170')])){_0x26fee6[_0xc928('0xd3')](_0xc928('0x200'),_0x4bbfb9,_0xd99082[_0x4521cb]);}else{_0x26fee6[_0xc928('0xbe')](_[_0xc928('0x133')](_0xd99082[_0x4521cb],[_0xc928('0x104'),'Contact.phone']))[_0xc928('0xb9')](_0x26fee6[_0xc928('0x1e9')](_0x4bbfb9,_0xd99082[_0x4521cb]))[_0xc928('0xb2')](_0x26fee6[_0xc928('0xd2')](_0xc928('0x201'),_0x4bbfb9));}}}})[_0xc928('0xb2')](loggerGetContactDialer(_0xc928('0x202'),_0x4bbfb9,_0x169406));}};Dialer['prototype']['handlePower']=function(_0x394703,_0x53e919){var _0x54162c=this;var _0x11922e=[];var _0xb62200=_0x53e919>=0x1?_0x53e919:0x1;if(_0x394703[_0xc928('0x15b')]===_0xc928('0x7')){_0xb62200=0x1;}var _0x45a6cd=Math[_0xc928('0x1cb')](_0x394703['available']*_0xb62200)-_0x394703['originated']-_0x394703[_0xc928('0xc7')];emitVoiceQueueSummary(_0x394703);if(_0x394703[_0xc928('0x203')]>0x0){var _0x3e60a8=_0x394703[_0xc928('0x203')]-_0x394703[_0xc928('0x6f')]-_0x394703[_0xc928('0x54')]-_0x394703[_0xc928('0xc7')]-_0x394703['pTalking'];if(_0x45a6cd>_0x3e60a8){_0x45a6cd=_0x3e60a8;}}if(_0x45a6cd>0x0){if(_0x394703['dialMethod']===_0xc928('0x7')){_0x45a6cd=0x1;}if(_0x45a6cd>this[_0xc928('0x21')]){_0x45a6cd=this[_0xc928('0x21')];}_0x394703[_0xc928('0xc7')]+=_0x45a6cd;for(var _0x36facd in this[_0xc928('0x1f')]){if(typeof this[_0xc928('0x1f')][_0x36facd]!==_0xc928('0x99')){if(this[_0xc928('0x1f')][_0x36facd][_0xc928('0xe9')]===_0xc928('0x204')&&this[_0xc928('0x1f')][_0x36facd][_0xc928('0xb0')]===_0xc928('0x205')){_0x11922e[_0xc928('0x132')](this[_0xc928('0x1f')][_0x36facd]['id']);}}}this['getContactDialer'](_0x394703['id'],_0x11922e,_0x45a6cd,_0x394703['dialOrderByScheduledAt'],_0x394703)[_0xc928('0xb9')](function(_0x3d5b23){_0x394703['temp']-=_0x45a6cd;_0x394703[_0xc928('0xc7')]=_0x394703[_0xc928('0xc7')]>0x0?_0x394703[_0xc928('0xc7')]:0x0;if(!checkContactEmpty(_0x3d5b23)){_0x54162c[_0xc928('0xb8')](_0x394703)['then'](sendMessageReschedule(_0x394703))[_0xc928('0xb2')](loggerCatch(_0xc928('0xba')));}else{_0x394703[_0xc928('0x6f')]+=_0x3d5b23['length'];_0x394703['message']=_0x394703[_0xc928('0x15b')]==='booked'?_0xc928('0x177'):'RUNNING';for(var _0x231bfe=0x0;_0x231bfe<_0x3d5b23[_0xc928('0x98')];_0x231bfe+=0x1){if(_[_0xc928('0xe2')](_0x3d5b23[_0x231bfe])||_[_0xc928('0xe2')](_0x3d5b23[_0x231bfe][_0xc928('0x16f')])||_[_0xc928('0xe2')](_0x3d5b23[_0x231bfe][_0xc928('0x16f')][_0xc928('0x170')])){_0x54162c[_0xc928('0xd3')](_0xc928('0x200'),_0x394703,_0x3d5b23[_0x231bfe]);}else{_0x54162c[_0xc928('0xbb')](_['pick'](_0x3d5b23[_0x231bfe],['VoiceQueueId',_0xc928('0x206')]))[_0xc928('0xb9')](_0x54162c[_0xc928('0x1e9')](_0x394703,_0x3d5b23[_0x231bfe]))[_0xc928('0xb2')](_0x54162c[_0xc928('0xd2')](_0xc928('0x200'),_0x394703));}}}})[_0xc928('0xb2')](loggerGetContactDialer('[getContactDialer2]',_0x394703,_0x45a6cd));}};Dialer[_0xc928('0x17')][_0xc928('0x90')]=function(_0x3c2689){if(_0x3c2689[_0xc928('0x203')]>0x0){var _0x43c488=_0x3c2689[_0xc928('0x203')]-_0x3c2689['originated']-_0x3c2689[_0xc928('0x54')];if(_0x43c488>0x0){this[_0xc928('0x207')](_0x3c2689);}else{loggerPredictiveCalls[_0xc928('0x7c')]('[handlePredictive][limitChannel]');}}else{this[_0xc928('0x207')](_0x3c2689);}};Dialer[_0xc928('0x17')]['tryOriginatePredictive']=function(_0x3f10c5){var _0x384faf=this;var _0x2d1d2d=[];_0x3f10c5[_0xc928('0x6f')]+=0x1;for(var _0x101965 in this[_0xc928('0x1f')]){if(typeof this['agents'][_0x101965]!=='undefined'){if(this['agents'][_0x101965][_0xc928('0xe9')]===_0xc928('0x204')&&this[_0xc928('0x1f')][_0x101965]['status']===_0xc928('0x205')){_0x2d1d2d[_0xc928('0x132')](this[_0xc928('0x1f')][_0x101965]['id']);}}}this[_0xc928('0xc6')](_0x3f10c5['id'],_0x2d1d2d,0x1,_0x3f10c5[_0xc928('0x208')],_0x3f10c5)['then'](function(_0x40410c){if(!checkContactEmpty(_0x40410c)){checkContactLowerLimitOriginate(_0x3f10c5,0x1,0x0);_0x384faf[_0xc928('0xb8')](_0x3f10c5)[_0xc928('0xb9')](sendMessageReschedule(_0x3f10c5))[_0xc928('0xb2')](loggerCatch(_0xc928('0xba')));}else{_0x3f10c5[_0xc928('0x3d')]='RUNNING';if(_['isNil'](_0x40410c[0x0])||_[_0xc928('0xe2')](_0x40410c[0x0][_0xc928('0x16f')])||_[_0xc928('0xe2')](_0x40410c[0x0]['Contact'][_0xc928('0x170')])){_0x384faf[_0xc928('0xd3')](_0xc928('0x200'),_0x3f10c5,_0x40410c[0x0]);}else{_0x384faf[_0xc928('0xbb')](_['pick'](_0x40410c[0x0],[_0xc928('0xd8'),_0xc928('0x206')]))[_0xc928('0xb9')](_0x384faf[_0xc928('0x1e9')](_0x3f10c5,_0x40410c[0x0]))['catch'](_0x384faf['loggerHandler'](_0xc928('0x209'),_0x3f10c5));}}})['catch'](loggerGetContactDialer(_0xc928('0x20a'),_0x3f10c5,0x1));emitVoiceQueueSummary(_0x3f10c5);};Dialer[_0xc928('0x17')][_0xc928('0x1df')]=function(_0x2cbbb9,_0x41b483,_0x5199f6,_0xbfce0b,_0x2803bb,_0x15099c){loggerPredictive[_0xc928('0x7c')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0xc928('0x7c')](_0xc928('0x20b'),_0x2cbbb9);loggerPredictive[_0xc928('0x7c')](_0xc928('0x20c'),_0x41b483);loggerPredictive[_0xc928('0x7c')]('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',_0x5199f6);loggerPredictive[_0xc928('0x7c')](_0xc928('0x20d'),_0xbfce0b);loggerPredictive[_0xc928('0x7c')](_0xc928('0x20e'),_0x2803bb);loggerPredictive['info'](_0xc928('0x85'));return new BPromise(function(_0x504041,_0x15be25){if(_0x2cbbb9<=0x0||isNaN(_0x2cbbb9)){return _0x15be25(msgResponse(_0xc928('0x20f'),'Error',_0xc928('0x210')+_0x2cbbb9));}if(_0x5199f6<=0x0||isNaN(_0x5199f6)){return _0x15be25(msgResponse('[abandonmentRate]','Error',_0xc928('0x211')+_0x5199f6));}if(_0xbfce0b<=0x0||isNaN(_0xbfce0b)){return _0x15be25(msgResponse(_0xc928('0x20f'),_0xc928('0x212'),_0xc928('0x213')+_0xbfce0b));}if(_0x41b483<=0x0||isNaN(_0x41b483)){return _0x15be25(msgResponse(_0xc928('0x20f'),_0xc928('0x212'),_0xc928('0x214')+_0x41b483));}if(_0x2803bb<=0x0||isNaN(_0x2803bb)){return _0x15be25(msgResponse('[abandonmentRate]',_0xc928('0x212'),_0xc928('0x215')+_0x2803bb));}_0x15099c=_0x15099c||0x0;var _0x234a9c=0x1/_0x5199f6;var _0x252115=0x0;var _0x1f65c5=0x0;var _0x517ee9=0x0;var _0x1e8b05=0x0;for(var _0x49dc41=0x0;_0x517ee9<_0x2803bb;_0x49dc41+=0x1){_0x1f65c5=_0x49dc41/_0x41b483;_0x252115=(_0xbfce0b*_0x1f65c5+_0x15099c)/_0x234a9c;_0x517ee9=erlangb(_0x252115,_0x2cbbb9);_0x1e8b05=_0x252115/_0x2cbbb9*(0x1-erlangb(_0x252115,_0x2cbbb9));}return _0x504041({'erlangCalls':_0x49dc41,'erlangCallToSecond':_0x41b483/_0x49dc41,'erlangAbandonmentRate':_0x517ee9,'erlangBusyFactor':_0x1e8b05});});};Dialer[_0xc928('0x17')][_0xc928('0x1e0')]=function(_0x20aedc,_0x2cc317,_0xe3b191,_0x366a84,_0x2934de,_0x5d3373){loggerPredictive['info'](_0xc928('0x216'));loggerPredictive[_0xc928('0x7c')]('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',_0x20aedc);loggerPredictive['info'](_0xc928('0x20c'),_0x2cc317);loggerPredictive['info'](_0xc928('0x217'),_0xe3b191);loggerPredictive['info'](_0xc928('0x20d'),_0x366a84);loggerPredictive['info'](_0xc928('0x218'),_0x2934de);loggerPredictive[_0xc928('0x7c')](_0xc928('0x85'));return new BPromise(function(_0x15279a,_0x240525){if(_0x20aedc<=0x0||isNaN(_0x20aedc)){return _0x240525(msgResponse(_0xc928('0x219'),'Error','m\x20=\x20'+_0x20aedc));}if(_0xe3b191<=0x0||isNaN(_0xe3b191)){return _0x240525(msgResponse(_0xc928('0x219'),'Error',_0xc928('0x211')+_0xe3b191));}if(_0x366a84<=0x0||isNaN(_0x366a84)){return _0x240525(msgResponse(_0xc928('0x219'),_0xc928('0x212'),_0xc928('0x213')+_0x366a84));}if(_0x2cc317<=0x0||isNaN(_0x2cc317)){return _0x240525(msgResponse(_0xc928('0x219'),'Error','interval\x20=\x20'+_0x2cc317));}if(_0x2934de<=0x0||isNaN(_0x2934de)){return _0x240525(msgResponse(_0xc928('0x219'),'Error',_0xc928('0x21a')+_0x2934de));}_0x5d3373=_0x5d3373||0x0;var _0x2d8167=0x1/_0xe3b191;var _0x3dd0d3=0x0;var _0x4d274f=0x0;var _0x51efdc=0x0;var _0x21ffa7=0x0;for(var _0x39e01f=0x0;_0x21ffa7<_0x2934de;_0x39e01f+=0x1){_0x4d274f=_0x39e01f/_0x2cc317;_0x3dd0d3=(_0x366a84*_0x4d274f+_0x5d3373)/_0x2d8167;_0x51efdc=erlangb(_0x3dd0d3,_0x20aedc);_0x21ffa7=_0x3dd0d3/_0x20aedc*(0x1-erlangb(_0x3dd0d3,_0x20aedc));}return _0x15279a({'erlangCalls':_0x39e01f,'erlangCallToSecond':_0x2cc317/_0x39e01f,'erlangAbandonmentRate':_0x51efdc,'erlangBusyFactor':_0x21ffa7});});};module[_0xc928('0x21b')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 81ae69b..9c6af65 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 _0x6d03=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId'];(function(_0xa40219,_0x21027e){var _0x391974=function(_0x14e4de){while(--_0x14e4de){_0xa40219['push'](_0xa40219['shift']());}};_0x391974(++_0x21027e);}(_0x6d03,0x1df));var _0x36d0=function(_0x5edcde,_0xda8e0f){_0x5edcde=_0x5edcde-0x0;var _0x111992=_0x6d03[_0x5edcde];return _0x111992;};'use strict';var util=require(_0x36d0('0x0'));var _=require(_0x36d0('0x1'));var moment=require(_0x36d0('0x2'));function getSeconds(_0x2e500c,_0x229aad){var _0x249ae4=moment(_0x2e500c)['milliseconds'](0x0);var _0x1d4914=moment(_0x229aad)[_0x36d0('0x3')](0x0);return _0x249ae4[_0x36d0('0x4')](_0x1d4914,_0x36d0('0x5'));}function QueueCallerAbandon(_0x403a01,_0x1213e4){this[_0x36d0('0x6')]=_0x403a01[_0x36d0('0x6')];this[_0x36d0('0x7')]=_0x403a01['type'];this[_0x36d0('0x8')]=_0x403a01[_0x36d0('0x7')]===_0x36d0('0x9')?_0x36d0('0xa'):_0x403a01[_0x36d0('0x7')];this['countbusyretry']=_0x403a01['countbusyretry'];this[_0x36d0('0xb')]=_0x403a01['countcongestionretry'];this['countnoanswerretry']=_0x403a01['countnoanswerretry'];this['countglobal']=_0x403a01['countbusyretry']+_0x403a01[_0x36d0('0xb')]+_0x403a01[_0x36d0('0xc')]+_0x403a01[_0x36d0('0xd')]+_0x403a01[_0x36d0('0xe')]+_0x403a01[_0x36d0('0xf')]+_0x403a01[_0x36d0('0x10')]+_0x403a01['countagentrejectretry'];this['countnosuchnumberretry']=_0x403a01['countnosuchnumberretry'];this[_0x36d0('0xe')]=_0x403a01[_0x36d0('0xe')];this['countabandonedretry']=_0x403a01[_0x36d0('0xf')];this[_0x36d0('0x10')]=_0x403a01['countmachineretry'];this[_0x36d0('0x11')]=_0x403a01[_0x36d0('0x11')];this[_0x36d0('0x12')]=_0x1213e4[_0x36d0('0x12')];this[_0x36d0('0x13')]=_0x403a01[_0x36d0('0x14')];this[_0x36d0('0x15')]=_0x403a01[_0x36d0('0x16')];this[_0x36d0('0x17')]=_0x403a01[_0x36d0('0x17')];this[_0x36d0('0x18')]=_0x403a01[_0x36d0('0x18')];this[_0x36d0('0x19')]=_0x403a01[_0x36d0('0x19')];this[_0x36d0('0x1a')]=this[_0x36d0('0x19')];this[_0x36d0('0x1b')]=getSeconds(_0x403a01[_0x36d0('0x18')],_0x403a01[_0x36d0('0x17')]);this[_0x36d0('0x1c')]=getSeconds(this[_0x36d0('0x19')],_0x403a01[_0x36d0('0x18')]);this[_0x36d0('0x1d')]=0x0;this[_0x36d0('0xa')]=_0x1213e4[_0x36d0('0xa')];this['membername']=_0x1213e4[_0x36d0('0x1e')];this[_0x36d0('0x1f')]=_0x1213e4[_0x36d0('0x1f')];this[_0x36d0('0x20')]=_0x403a01[_0x36d0('0x20')];this[_0x36d0('0x21')]=_0x403a01[_0x36d0('0x21')];this['callbackat']=_0x403a01[_0x36d0('0x22')];this[_0x36d0('0x23')]=_0x403a01[_0x36d0('0x23')];this['ContactId']=_0x403a01['ContactId'];this['ListId']=_0x403a01[_0x36d0('0x24')];this['UserId']=_0x403a01[_0x36d0('0x25')];this[_0x36d0('0x26')]=_0x403a01[_0x36d0('0x26')];this['CampaignId']=_0x403a01[_0x36d0('0x27')];this[_0x36d0('0x28')]=_0x403a01[_0x36d0('0x28')]||'';this[_0x36d0('0x29')]=_0x403a01[_0x36d0('0x29')]||'';}module[_0x36d0('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0x10fa=['VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','name','calleridnum','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','queue','connectedlinename','reason','callbackuniqueid','recallme','ContactId','ListId','UserId'];(function(_0x23abb7,_0x2dd3ec){var _0x50c304=function(_0x67cd53){while(--_0x67cd53){_0x23abb7['push'](_0x23abb7['shift']());}};_0x50c304(++_0x2dd3ec);}(_0x10fa,0x144));var _0xa10f=function(_0x172a25,_0x5137df){_0x172a25=_0x172a25-0x0;var _0x540c21=_0x10fa[_0x172a25];return _0x540c21;};'use strict';var util=require(_0xa10f('0x0'));var _=require(_0xa10f('0x1'));var moment=require(_0xa10f('0x2'));function getSeconds(_0x235a60,_0x512f1b){var _0x401697=moment(_0x235a60)[_0xa10f('0x3')](0x0);var _0x2df607=moment(_0x512f1b)['milliseconds'](0x0);return _0x401697[_0xa10f('0x4')](_0x2df607,_0xa10f('0x5'));}function QueueCallerAbandon(_0x2a3bbf,_0x127957){this[_0xa10f('0x6')]=_0x2a3bbf['scheduledat'];this[_0xa10f('0x7')]=_0x2a3bbf['type'];this['campaigntype']=_0x2a3bbf[_0xa10f('0x7')]===_0xa10f('0x8')?'queue':_0x2a3bbf[_0xa10f('0x7')];this[_0xa10f('0x9')]=_0x2a3bbf[_0xa10f('0x9')];this[_0xa10f('0xa')]=_0x2a3bbf[_0xa10f('0xa')];this['countnoanswerretry']=_0x2a3bbf[_0xa10f('0xb')];this[_0xa10f('0xc')]=_0x2a3bbf[_0xa10f('0x9')]+_0x2a3bbf[_0xa10f('0xa')]+_0x2a3bbf[_0xa10f('0xb')]+_0x2a3bbf[_0xa10f('0xd')]+_0x2a3bbf[_0xa10f('0xe')]+_0x2a3bbf['countabandonedretry']+_0x2a3bbf['countmachineretry']+_0x2a3bbf[_0xa10f('0xf')];this[_0xa10f('0xd')]=_0x2a3bbf['countnosuchnumberretry'];this[_0xa10f('0xe')]=_0x2a3bbf[_0xa10f('0xe')];this[_0xa10f('0x10')]=_0x2a3bbf['countabandonedretry'];this[_0xa10f('0x11')]=_0x2a3bbf['countmachineretry'];this['countagentrejectretry']=_0x2a3bbf[_0xa10f('0xf')];this['uniqueid']=_0x127957['uniqueid'];this[_0xa10f('0x12')]=_0x2a3bbf[_0xa10f('0x13')];this[_0xa10f('0x14')]=_0x2a3bbf['number'];this[_0xa10f('0x15')]=_0x2a3bbf[_0xa10f('0x15')];this[_0xa10f('0x16')]=_0x2a3bbf[_0xa10f('0x16')];this[_0xa10f('0x17')]=_0x2a3bbf['droptime'];this[_0xa10f('0x18')]=this[_0xa10f('0x17')];this[_0xa10f('0x19')]=getSeconds(_0x2a3bbf[_0xa10f('0x16')],_0x2a3bbf[_0xa10f('0x15')]);this[_0xa10f('0x1a')]=getSeconds(this[_0xa10f('0x17')],_0x2a3bbf[_0xa10f('0x16')]);this[_0xa10f('0x1b')]=0x0;this['queue']=_0x127957[_0xa10f('0x1c')];this['membername']=_0x127957[_0xa10f('0x1d')];this['reason']=_0x127957[_0xa10f('0x1e')];this['callback']=_0x2a3bbf['callback'];this[_0xa10f('0x1f')]=_0x2a3bbf[_0xa10f('0x1f')];this['callbackat']=_0x2a3bbf['callbackat'];this[_0xa10f('0x20')]=_0x2a3bbf[_0xa10f('0x20')];this[_0xa10f('0x21')]=_0x2a3bbf['ContactId'];this[_0xa10f('0x22')]=_0x2a3bbf[_0xa10f('0x22')];this[_0xa10f('0x23')]=_0x2a3bbf[_0xa10f('0x23')];this[_0xa10f('0x24')]=_0x2a3bbf['VoiceQueueId'];this['CampaignId']=_0x2a3bbf['CampaignId'];this['originatecalleridnum']=_0x2a3bbf[_0xa10f('0x25')]||'';this['originatecalleridname']=_0x2a3bbf[_0xa10f('0x26')]||'';}module[_0xa10f('0x27')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 829e9dd..89a1bf5 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(_0x1b01f6,_0x57d583){var _0x1f67af=function(_0x1838e2){while(--_0x1838e2){_0x1b01f6['push'](_0x1b01f6['shift']());}};_0x1f67af(++_0x57d583);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0xd99754,_0x40553c){var _0x4d8e58=function(_0x2198a8){while(--_0x2198a8){_0xd99754['push'](_0xd99754['shift']());}};_0x4d8e58(++_0x40553c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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 c54dbfd..a068767 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 _0x2d7e=['unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','bluebird','tiff2pdf','./util/gs','../../../config/logger','./rpcDb','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','originateresponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','syncOriginateResponse','pick','response','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20faxRiceive\x20','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','format','path','execute','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isTrunkReachable','isNil','active','SIP/%s','reachable'];(function(_0x22f5ea,_0x3a6a30){var _0xe5955=function(_0x139704){while(--_0x139704){_0x22f5ea['push'](_0x22f5ea['shift']());}};_0xe5955(++_0x3a6a30);}(_0x2d7e,0x78));var _0xe2d7=function(_0x365e54,_0x44be74){_0x365e54=_0x365e54-0x0;var _0x13317a=_0x2d7e[_0x365e54];return _0x13317a;};'use strict';var util=require(_0xe2d7('0x0'));var _=require('lodash');var BPromise=require(_0xe2d7('0x1'));var uuid=require('uuid');var moment=require('moment');var path=require('path');var tiff2pdf=require(_0xe2d7('0x2'));var gs=require(_0xe2d7('0x3'));var logger=require(_0xe2d7('0x4'))('fax');var ami=require('../ami');var rpcDb=require(_0xe2d7('0x5'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0xe2d7('0x6'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xe2d7('0x7'));var faxMessage=require(_0xe2d7('0x8'));function Fax(_0x23cdab){this[_0xe2d7('0x9')]={};this['faxAccounts']=_0x23cdab[_0xe2d7('0xa')];this[_0xe2d7('0xb')]=_0x23cdab[_0xe2d7('0xb')];this[_0xe2d7('0xc')]={};ami['on'](_0xe2d7('0xd'),this[_0xe2d7('0xe')][_0xe2d7('0xf')](this));ami['on'](_0xe2d7('0x10'),this[_0xe2d7('0x11')][_0xe2d7('0xf')](this));ami['on'](_0xe2d7('0x12'),this[_0xe2d7('0x13')][_0xe2d7('0xf')](this));ami['on']('newexten',this[_0xe2d7('0x14')]['bind'](this));ami['on'](_0xe2d7('0x15'),this[_0xe2d7('0x16')][_0xe2d7('0xf')](this));ami['on']('receivefax',this[_0xe2d7('0x17')][_0xe2d7('0xf')](this));ami['on'](_0xe2d7('0x18'),this['syncHangup'][_0xe2d7('0xf')](this));ami['on'](_0xe2d7('0x19'),this['syncOriginateResponse'][_0xe2d7('0xf')](this));}Fax[_0xe2d7('0x1a')][_0xe2d7('0xe')]=function(_0x33b5c2){if(_0x33b5c2['context']===_0xe2d7('0x1b')){for(var _0x218e05 in this[_0xe2d7('0xa')]){if(this[_0xe2d7('0xa')][_0xe2d7('0x1c')](_0x218e05)){if(_0x33b5c2[_0xe2d7('0x1d')]===this[_0xe2d7('0xa')][_0x218e05][_0xe2d7('0x1e')]){this[_0xe2d7('0x9')][_0x33b5c2[_0xe2d7('0x1f')]]={};this[_0xe2d7('0x9')][_0x33b5c2['uniqueid']][_0xe2d7('0x20')]=_0x33b5c2[_0xe2d7('0x20')];this['channels'][_0x33b5c2[_0xe2d7('0x1f')]]['id']=this[_0xe2d7('0xa')][_0x218e05]['id'];this[_0xe2d7('0x9')][_0x33b5c2[_0xe2d7('0x1f')]][_0xe2d7('0x21')]=this[_0xe2d7('0xa')][_0x218e05][_0xe2d7('0x21')];logger[_0xe2d7('0x22')](_0x33b5c2[_0xe2d7('0x1f')],'\x20syncNewchannel\x20');}}}}if(this[_0xe2d7('0xc')][_0x33b5c2[_0xe2d7('0x1f')]]){this[_0xe2d7('0x9')][_0x33b5c2[_0xe2d7('0x1f')]]={};this[_0xe2d7('0x9')][_0x33b5c2[_0xe2d7('0x1f')]]['channel']=_0x33b5c2['channel'];logger['info'](_0x33b5c2[_0xe2d7('0x1f')],'\x20syncNewchannel\x20');}};Fax[_0xe2d7('0x1a')][_0xe2d7('0x11')]=function(_0x3abdd8){if(this[_0xe2d7('0x9')][_0x3abdd8[_0xe2d7('0x1f')]]){for(var _0x32d54d in _0x3abdd8['variable']){if(_0x3abdd8[_0xe2d7('0x23')][_0xe2d7('0x1c')](_0x32d54d)){this[_0xe2d7('0x9')][_0x3abdd8[_0xe2d7('0x1f')]][_0x32d54d]=_0x3abdd8[_0xe2d7('0x24')];}}}};Fax[_0xe2d7('0x1a')][_0xe2d7('0x13')]=function(_0x3a89be){if(this[_0xe2d7('0x9')][_0x3a89be[_0xe2d7('0x1f')]]){this[_0xe2d7('0x9')][_0x3a89be['uniqueid']][_0xe2d7('0x25')]=_0x3a89be[_0xe2d7('0x25')];this[_0xe2d7('0x9')][_0x3a89be[_0xe2d7('0x1f')]][_0xe2d7('0x26')]=_0x3a89be[_0xe2d7('0x26')];}};Fax[_0xe2d7('0x1a')][_0xe2d7('0x14')]=function(_0x5846aa){if(this[_0xe2d7('0x9')][_0x5846aa[_0xe2d7('0x1f')]]){for(var _0x29c1c8 in _0x5846aa['variable']){if(_0x5846aa[_0xe2d7('0x23')][_0xe2d7('0x1c')](_0x29c1c8)){this['channels'][_0x5846aa[_0xe2d7('0x1f')]][_0x29c1c8]=_0x5846aa[_0xe2d7('0x24')];}}}};Fax[_0xe2d7('0x1a')][_0xe2d7('0x16')]=function(_0x208d47){if(this['channels'][_0x208d47[_0xe2d7('0x1f')]]){this[_0xe2d7('0x9')][_0x208d47[_0xe2d7('0x1f')]][_0xe2d7('0x27')]=_0x208d47[_0xe2d7('0x27')];this['channels'][_0x208d47[_0xe2d7('0x1f')]][_0xe2d7('0x28')]=_0x208d47['status'];this[_0xe2d7('0x9')][_0x208d47['uniqueid']][_0xe2d7('0x1e')]=_0x208d47[_0xe2d7('0x1e')];this['channels'][_0x208d47[_0xe2d7('0x1f')]][_0xe2d7('0x29')]=_0x208d47[_0xe2d7('0x29')];logger[_0xe2d7('0x22')](_0x208d47['uniqueid'],_0xe2d7('0x2a'));}};Fax['prototype']['syncReceiveFax']=function(_0x2050a3){var _0x8af42c=this;if(this[_0xe2d7('0x9')][_0x2050a3['uniqueid']]){var _0x43ccdf=this['channels'][_0x2050a3[_0xe2d7('0x1f')]]['id'];this[_0xe2d7('0x9')][_0x2050a3[_0xe2d7('0x1f')]][_0xe2d7('0x2b')]=_0x2050a3[_0xe2d7('0x2b')];this[_0xe2d7('0x9')][_0x2050a3[_0xe2d7('0x1f')]][_0xe2d7('0x2c')]=_0x2050a3['pagestransferred'];this[_0xe2d7('0x9')][_0x2050a3[_0xe2d7('0x1f')]]['localstationid']=_0x2050a3[_0xe2d7('0x1e')];this[_0xe2d7('0x9')][_0x2050a3[_0xe2d7('0x1f')]][_0xe2d7('0x2d')]=_0x2050a3[_0xe2d7('0x2d')];this[_0xe2d7('0x9')][_0x2050a3['uniqueid']][_0xe2d7('0x2e')]=_0x2050a3['transferrate'];this[_0xe2d7('0x9')][_0x2050a3['uniqueid']]['filename']=_0x2050a3[_0xe2d7('0x29')];this[_0xe2d7('0x9')][_0x2050a3[_0xe2d7('0x1f')]][_0xe2d7('0x2f')]=_0x2050a3[_0xe2d7('0x2f')];if(this['channels'][_0x2050a3[_0xe2d7('0x1f')]][_0xe2d7('0x2c')]>0x0){tiff2pdf(_0x2050a3['filename'],_0xe2d7('0x30'),function(_0x464bfd){logger[_0xe2d7('0x22')](_0x2050a3['uniqueid'],_0xe2d7('0x31'),_0x464bfd[_0xe2d7('0x32')]);attachment[_0xe2d7('0x33')]({'name':path[_0xe2d7('0x34')](_0x2050a3['filename'])['name'],'basename':path['parse'](_0x2050a3[_0xe2d7('0x29')])['name']+_0xe2d7('0x35'),'type':_0xe2d7('0x36')})[_0xe2d7('0x37')](function(_0x2b0e6b){faxAccount[_0xe2d7('0x38')](_0x43ccdf,{'from':_0x2050a3[_0xe2d7('0x2f')],'mapKey':'fax','body':path['parse'](_0x2050a3['filename'])[_0xe2d7('0x21')]+_0xe2d7('0x35'),'AttachmentId':_0x2b0e6b['id']})[_0xe2d7('0x39')](function(_0x41db17){logger['error'](_0x2050a3[_0xe2d7('0x1f')],_0xe2d7('0x3a'),JSON[_0xe2d7('0x3b')](_0x41db17));});})[_0xe2d7('0x39')](function(_0x2bf60e){logger[_0xe2d7('0x3c')](_0x2050a3['uniqueid'],_0xe2d7('0x3d'),JSON[_0xe2d7('0x3b')](_0x2bf60e));});});}logger['info'](_0x2050a3[_0xe2d7('0x1f')],'\x20receiveFax\x20');}};Fax[_0xe2d7('0x1a')][_0xe2d7('0x3e')]=function(_0x1c7c7f){if(this[_0xe2d7('0xc')][_0x1c7c7f[_0xe2d7('0x1f')]]){_['merge'](this[_0xe2d7('0x9')][_0x1c7c7f['uniqueid']],_[_0xe2d7('0x3f')](_0x1c7c7f,[_0xe2d7('0x40'),'reason']));}};function updateStatus(_0x1fb209){if(_0x1fb209['AttachmentId']){faxMessage[_0xe2d7('0x41')](_0x1fb209[_0xe2d7('0x42')],{'failMessage':_0xe2d7('0x43')})['then'](function(_0x4a4914){ut[_0xe2d7('0x44')]('[Fax][Message][Error][Updated]',_0x4a4914);})[_0xe2d7('0x39')](function(_0x9bf3a0){ut[_0xe2d7('0x44')](_0xe2d7('0x45'),_0x9bf3a0);});}else{ut[_0xe2d7('0x44')](_0xe2d7('0x46'));}}Fax['prototype']['updateStatus']=function(_0x3375a2,_0x4cefad,_0x4b9dca){var _0x56ba03=this;var _0x15000f={};if(_0x4cefad){_0x15000f={'read':_0x4cefad};}else{_0x15000f={'failMessage':_0x4b9dca};}if(this[_0xe2d7('0xc')][_0x3375a2][_0xe2d7('0x42')]){faxMessage[_0xe2d7('0x41')](this[_0xe2d7('0xc')][_0x3375a2][_0xe2d7('0x42')],_0x15000f)[_0xe2d7('0x37')](function(_0x20de06){ut['logger'](_0xe2d7('0x47'),_0x20de06);})[_0xe2d7('0x39')](function(_0xcc8ceb){ut['logger'](_0xe2d7('0x48'),_0xcc8ceb);})[_0xe2d7('0x49')](function(){delete _0x56ba03['channels'][_0x3375a2];delete _0x56ba03[_0xe2d7('0xc')][_0x3375a2];});}else{ut['logger'](_0xe2d7('0x4a'));delete this[_0xe2d7('0x9')][_0x3375a2];delete this['actions'][_0x3375a2];}};Fax['prototype'][_0xe2d7('0x4b')]=function(_0x2140ce){var _0x1ac5d1=this;if(this[_0xe2d7('0x9')][_0x2140ce['uniqueid']]){if(this[_0xe2d7('0xc')][_0x2140ce[_0xe2d7('0x1f')]]){this[_0xe2d7('0x9')][_0x2140ce[_0xe2d7('0x1f')]]['id']=this[_0xe2d7('0xc')][_0x2140ce[_0xe2d7('0x1f')]]['id'];this[_0xe2d7('0x9')][_0x2140ce[_0xe2d7('0x1f')]][_0xe2d7('0x21')]=this[_0xe2d7('0xc')][_0x2140ce[_0xe2d7('0x1f')]][_0xe2d7('0x21')];}logger[_0xe2d7('0x22')](_0x2140ce[_0xe2d7('0x1f')],this[_0xe2d7('0xc')][_0x2140ce[_0xe2d7('0x1f')]]?'\x20hangup\x20sendFile\x20':_0xe2d7('0x4c'),JSON[_0xe2d7('0x3b')](this[_0xe2d7('0x9')][_0x2140ce[_0xe2d7('0x1f')]]));if(this[_0xe2d7('0xc')][_0x2140ce[_0xe2d7('0x1f')]]){if(this['channels'][_0x2140ce['uniqueid']]['faxpages']>0x0&&this[_0xe2d7('0x9')][_0x2140ce[_0xe2d7('0x1f')]][_0xe2d7('0x15')]==='SUCCESS'){this[_0xe2d7('0x4d')](_0x2140ce['uniqueid'],!![]);}else{this[_0xe2d7('0x4d')](_0x2140ce[_0xe2d7('0x1f')],![],this[_0xe2d7('0x9')][_0x2140ce['uniqueid']][_0xe2d7('0x4e')]?_0xe2d7('0x4f')+this[_0xe2d7('0x9')][_0x2140ce[_0xe2d7('0x1f')]]['faxstatusstring']:_0xe2d7('0x50'));}}}};Fax[_0xe2d7('0x1a')][_0xe2d7('0x51')]=function(_0xb764a5){var _0x543ad0=this;return new BPromise(function(_0x2a2efc,_0x11783a){_0x543ad0[_0xe2d7('0x52')](_0xb764a5,_0x543ad0['faxAccounts'][_0xb764a5['FaxAccountId']])[_0xe2d7('0x37')](function(_0x4b0f45){ut[_0xe2d7('0x44')](_0xe2d7('0x53'),_0x4b0f45);_0x2a2efc(ut[_0xe2d7('0x32')](_0xe2d7('0x54')));})[_0xe2d7('0x39')](function(_0x1a0676){ut[_0xe2d7('0x44')](_0xe2d7('0x55'),_0x1a0676);updateStatus(_0xb764a5);_0x11783a(ut[_0xe2d7('0x32')](_0xe2d7('0x56')));});});};Fax[_0xe2d7('0x1a')][_0xe2d7('0x57')]=function(_0x14b2b1){var _0x1d80c6=this;return new BPromise(function(_0x1dd9e5,_0x2f25c1){var _0x5f311d=_0x1d80c6[_0xe2d7('0x58')](_0x1d80c6[_0xe2d7('0xa')][_0x14b2b1[_0xe2d7('0x59')]][_0xe2d7('0x5a')],_0x14b2b1);if(_0x5f311d[_0xe2d7('0x5b')]){_0x1dd9e5(ut['message']('Trunk\x20Reachable'));}else{_0x2f25c1(ut['message'](_0x5f311d[_0xe2d7('0x32')]));}});};function originate(_0x3039ec,_0x472484,_0x5a73c0){return new BPromise(function(_0x273fa2,_0x5e7403){if(_0x5a73c0){var _0x2c08c4=util[_0xe2d7('0x5c')]('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[_0xe2d7('0x34')](_0x3039ec[_0xe2d7('0x5d')])[_0xe2d7('0x21')],_0x3039ec['path']);gs[_0xe2d7('0x5e')](_0x2c08c4)['then'](function(){_0x3039ec[_0xe2d7('0x5d')]=util[_0xe2d7('0x5c')](_0xe2d7('0x5f'),path[_0xe2d7('0x34')](_0x3039ec[_0xe2d7('0x5d')])['dir'],path['parse'](_0x3039ec[_0xe2d7('0x5d')])[_0xe2d7('0x21')]);_0x472484['XMF-PATH']=_0x3039ec['path'];ut[_0xe2d7('0x44')](_0xe2d7('0x60'),'');ami[_0xe2d7('0x61')](ut['variablesAction'](_0x3039ec,_0x472484))['then'](function(_0x286647){_0x273fa2(_0x286647);})[_0xe2d7('0x39')](function(_0x20025d){_0x5e7403(_0x20025d);});})[_0xe2d7('0x39')](function(_0xc6d884){_0x5e7403(_0xc6d884);});}else{ami[_0xe2d7('0x61')](ut[_0xe2d7('0x62')](_0x3039ec,_0x472484))['then'](function(_0x550d3d){_0x273fa2(_0x550d3d);})[_0xe2d7('0x39')](function(_0x23ebf7){_0x5e7403(_0x23ebf7);});}});}Fax[_0xe2d7('0x1a')][_0xe2d7('0x52')]=function(_0x482fb7,_0x530fd0){var _0x48c6e9=this;return new BPromise(function(_0x1e1da9,_0x5cc105){var _0x48f044=uuid['v4']();var _0x15e7e3=ut['addVariables'](_0x482fb7,_0x530fd0);_0x48c6e9[_0xe2d7('0xc')][_0x48f044]=new Action(_0x48f044,_0x530fd0,_0x482fb7);var _0x422307=_0x48c6e9[_0xe2d7('0xc')][_0x48f044];if(path[_0xe2d7('0x34')](_0x482fb7[_0xe2d7('0x5d')])['ext']===_0xe2d7('0x35')){originate(_0x422307,_0x15e7e3,!![])[_0xe2d7('0x37')](function(_0x3908fe){_0x1e1da9(_0x3908fe);})[_0xe2d7('0x39')](function(_0x48a0ba){_0x5cc105(_0x48a0ba);});}else{originate(_0x422307,_0x15e7e3,![])[_0xe2d7('0x37')](function(_0x4849f8){_0x1e1da9(_0x4849f8);})[_0xe2d7('0x39')](function(_0x158048){_0x5cc105(_0x158048);});}});};Fax[_0xe2d7('0x1a')][_0xe2d7('0x63')]=function(_0x64736f){return!_['isNil'](_0x64736f)&&!_[_0xe2d7('0x64')](_0x64736f[_0xe2d7('0x21')])&&!_[_0xe2d7('0x64')](_0x64736f['active'])&&_0x64736f[_0xe2d7('0x65')]&&!_[_0xe2d7('0x64')](this[_0xe2d7('0xb')][util[_0xe2d7('0x5c')]('SIP/%s',_0x64736f[_0xe2d7('0x21')])])&&!_[_0xe2d7('0x64')](this['trunks'][util[_0xe2d7('0x5c')]('SIP/%s',_0x64736f[_0xe2d7('0x21')])]['status'])&&(this[_0xe2d7('0xb')][util['format'](_0xe2d7('0x66'),_0x64736f[_0xe2d7('0x21')])]['status']===_0xe2d7('0x67')||this[_0xe2d7('0xb')][util[_0xe2d7('0x5c')]('SIP/%s',_0x64736f[_0xe2d7('0x21')])][_0xe2d7('0x28')]===_0xe2d7('0x68'));};Fax[_0xe2d7('0x1a')]['checkTrunk']=function(_0x5a4ac2,_0xb11ae1){if(!this[_0xe2d7('0x63')](_0x5a4ac2)){ut[_0xe2d7('0x44')](_0xe2d7('0x69'),_['isNil'](_0x5a4ac2)?'':_0x5a4ac2['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xe2d7('0x6a')};}if(_['isNil'](_0xb11ae1['fax'])){ut[_0xe2d7('0x44')](_0xe2d7('0x6b'),JSON['stringify'](_0xb11ae1));return{'isValid':![],'message':_0xe2d7('0x6c')};}if(_[_0xe2d7('0x64')](_0xb11ae1[_0xe2d7('0x5d')])){ut[_0xe2d7('0x44')](_0xe2d7('0x6d'),JSON['stringify'](_0xb11ae1));return{'isValid':![],'message':_0xe2d7('0x6e')};}return{'isValid':!![],'message':_0xe2d7('0x6f')};};module['exports']=Fax; \ No newline at end of file +var _0x6ff0=['./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','syncNewchannel','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','context','exten','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','hasOwnProperty','value','channelstate','channelstatedesc','operation','status','localstationid','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','.pdf','application/pdf','then','notify','parse','error','stringify','catch','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','fax','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','bluebird','uuid','path','tiff2pdf','../../../config/logger','../ami','./rpcDb'];(function(_0x28285a,_0x21e4b){var _0x4ddaa3=function(_0x46f429){while(--_0x46f429){_0x28285a['push'](_0x28285a['shift']());}};_0x4ddaa3(++_0x21e4b);}(_0x6ff0,0x1c7));var _0x06ff=function(_0x3104ae,_0x2ba4bf){_0x3104ae=_0x3104ae-0x0;var _0x306c53=_0x6ff0[_0x3104ae];return _0x306c53;};'use strict';var util=require(_0x06ff('0x0'));var _=require(_0x06ff('0x1'));var BPromise=require(_0x06ff('0x2'));var uuid=require(_0x06ff('0x3'));var moment=require('moment');var path=require(_0x06ff('0x4'));var tiff2pdf=require(_0x06ff('0x5'));var gs=require('./util/gs');var logger=require(_0x06ff('0x6'))('fax');var ami=require(_0x06ff('0x7'));var rpcDb=require(_0x06ff('0x8'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0x06ff('0x9'));var faxAccount=require(_0x06ff('0xa'));var attachment=require(_0x06ff('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x412e96){this[_0x06ff('0xc')]={};this[_0x06ff('0xd')]=_0x412e96['faxAccounts'];this[_0x06ff('0xe')]=_0x412e96[_0x06ff('0xe')];this[_0x06ff('0xf')]={};ami['on']('newchannel',this[_0x06ff('0x10')][_0x06ff('0x11')](this));ami['on']('varset',this[_0x06ff('0x12')]['bind'](this));ami['on'](_0x06ff('0x13'),this[_0x06ff('0x14')][_0x06ff('0x11')](this));ami['on'](_0x06ff('0x15'),this[_0x06ff('0x16')][_0x06ff('0x11')](this));ami['on'](_0x06ff('0x17'),this[_0x06ff('0x18')][_0x06ff('0x11')](this));ami['on'](_0x06ff('0x19'),this[_0x06ff('0x1a')][_0x06ff('0x11')](this));ami['on'](_0x06ff('0x1b'),this['syncHangup'][_0x06ff('0x11')](this));ami['on'](_0x06ff('0x1c'),this[_0x06ff('0x1d')][_0x06ff('0x11')](this));}Fax[_0x06ff('0x1e')]['syncNewchannel']=function(_0x88e9ea){if(_0x88e9ea[_0x06ff('0x1f')]==='from-voip-provider'){for(var _0x2e9f6f in this[_0x06ff('0xd')]){if(this[_0x06ff('0xd')]['hasOwnProperty'](_0x2e9f6f)){if(_0x88e9ea[_0x06ff('0x20')]===this[_0x06ff('0xd')][_0x2e9f6f]['localstationid']){this['channels'][_0x88e9ea['uniqueid']]={};this['channels'][_0x88e9ea[_0x06ff('0x21')]][_0x06ff('0x22')]=_0x88e9ea[_0x06ff('0x22')];this[_0x06ff('0xc')][_0x88e9ea[_0x06ff('0x21')]]['id']=this[_0x06ff('0xd')][_0x2e9f6f]['id'];this[_0x06ff('0xc')][_0x88e9ea['uniqueid']][_0x06ff('0x23')]=this[_0x06ff('0xd')][_0x2e9f6f]['name'];logger['info'](_0x88e9ea[_0x06ff('0x21')],_0x06ff('0x24'));}}}}if(this[_0x06ff('0xf')][_0x88e9ea[_0x06ff('0x21')]]){this[_0x06ff('0xc')][_0x88e9ea[_0x06ff('0x21')]]={};this[_0x06ff('0xc')][_0x88e9ea[_0x06ff('0x21')]][_0x06ff('0x22')]=_0x88e9ea[_0x06ff('0x22')];logger[_0x06ff('0x25')](_0x88e9ea[_0x06ff('0x21')],_0x06ff('0x24'));}};Fax[_0x06ff('0x1e')]['syncVarSet']=function(_0x3072d8){if(this[_0x06ff('0xc')][_0x3072d8[_0x06ff('0x21')]]){for(var _0x5a95e7 in _0x3072d8[_0x06ff('0x26')]){if(_0x3072d8[_0x06ff('0x26')][_0x06ff('0x27')](_0x5a95e7)){this[_0x06ff('0xc')][_0x3072d8['uniqueid']][_0x5a95e7]=_0x3072d8[_0x06ff('0x28')];}}}};Fax[_0x06ff('0x1e')][_0x06ff('0x14')]=function(_0xf57f77){if(this[_0x06ff('0xc')][_0xf57f77[_0x06ff('0x21')]]){this[_0x06ff('0xc')][_0xf57f77[_0x06ff('0x21')]][_0x06ff('0x29')]=_0xf57f77[_0x06ff('0x29')];this[_0x06ff('0xc')][_0xf57f77['uniqueid']][_0x06ff('0x2a')]=_0xf57f77[_0x06ff('0x2a')];}};Fax['prototype'][_0x06ff('0x16')]=function(_0x475e20){if(this[_0x06ff('0xc')][_0x475e20['uniqueid']]){for(var _0x1b2933 in _0x475e20['variable']){if(_0x475e20['variable'][_0x06ff('0x27')](_0x1b2933)){this[_0x06ff('0xc')][_0x475e20['uniqueid']][_0x1b2933]=_0x475e20[_0x06ff('0x28')];}}}};Fax['prototype'][_0x06ff('0x18')]=function(_0x377bd1){if(this['channels'][_0x377bd1['uniqueid']]){this[_0x06ff('0xc')][_0x377bd1['uniqueid']][_0x06ff('0x2b')]=_0x377bd1[_0x06ff('0x2b')];this[_0x06ff('0xc')][_0x377bd1[_0x06ff('0x21')]][_0x06ff('0x2c')]=_0x377bd1['status'];this[_0x06ff('0xc')][_0x377bd1[_0x06ff('0x21')]][_0x06ff('0x2d')]=_0x377bd1[_0x06ff('0x2d')];this[_0x06ff('0xc')][_0x377bd1[_0x06ff('0x21')]][_0x06ff('0x2e')]=_0x377bd1[_0x06ff('0x2e')];logger['info'](_0x377bd1['uniqueid'],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x06ff('0x1a')]=function(_0x2da973){var _0x51e83b=this;if(this[_0x06ff('0xc')][_0x2da973[_0x06ff('0x21')]]){var _0x3a31f1=this[_0x06ff('0xc')][_0x2da973[_0x06ff('0x21')]]['id'];this['channels'][_0x2da973[_0x06ff('0x21')]][_0x06ff('0x2f')]=_0x2da973['remotestationid'];this['channels'][_0x2da973['uniqueid']]['pagestransferred']=_0x2da973[_0x06ff('0x30')];this[_0x06ff('0xc')][_0x2da973['uniqueid']][_0x06ff('0x2d')]=_0x2da973['localstationid'];this[_0x06ff('0xc')][_0x2da973['uniqueid']][_0x06ff('0x31')]=_0x2da973['resolution'];this[_0x06ff('0xc')][_0x2da973['uniqueid']][_0x06ff('0x32')]=_0x2da973[_0x06ff('0x32')];this[_0x06ff('0xc')][_0x2da973[_0x06ff('0x21')]][_0x06ff('0x2e')]=_0x2da973['filename'];this[_0x06ff('0xc')][_0x2da973[_0x06ff('0x21')]][_0x06ff('0x33')]=_0x2da973[_0x06ff('0x33')];if(this[_0x06ff('0xc')][_0x2da973[_0x06ff('0x21')]]['pagestransferred']>0x0){tiff2pdf(_0x2da973['filename'],_0x06ff('0x34'),function(_0x7f9f47){logger[_0x06ff('0x25')](_0x2da973[_0x06ff('0x21')],_0x06ff('0x35'),_0x7f9f47[_0x06ff('0x36')]);attachment[_0x06ff('0x37')]({'name':path['parse'](_0x2da973[_0x06ff('0x2e')])[_0x06ff('0x23')],'basename':path['parse'](_0x2da973['filename'])[_0x06ff('0x23')]+_0x06ff('0x38'),'type':_0x06ff('0x39')})[_0x06ff('0x3a')](function(_0x392142){faxAccount[_0x06ff('0x3b')](_0x3a31f1,{'from':_0x2da973[_0x06ff('0x33')],'mapKey':'fax','body':path[_0x06ff('0x3c')](_0x2da973[_0x06ff('0x2e')])[_0x06ff('0x23')]+_0x06ff('0x38'),'AttachmentId':_0x392142['id']})['catch'](function(_0x4fa94b){logger[_0x06ff('0x3d')](_0x2da973['uniqueid'],'\x20notify\x20',JSON[_0x06ff('0x3e')](_0x4fa94b));});})[_0x06ff('0x3f')](function(_0x38165a){logger[_0x06ff('0x3d')](_0x2da973['uniqueid'],_0x06ff('0x40'),JSON['stringify'](_0x38165a));});});}logger[_0x06ff('0x25')](_0x2da973['uniqueid'],_0x06ff('0x40'));}};Fax[_0x06ff('0x1e')][_0x06ff('0x1d')]=function(_0x4b295a){if(this[_0x06ff('0xf')][_0x4b295a[_0x06ff('0x21')]]){_[_0x06ff('0x41')](this[_0x06ff('0xc')][_0x4b295a[_0x06ff('0x21')]],_[_0x06ff('0x42')](_0x4b295a,[_0x06ff('0x43'),_0x06ff('0x44')]));}};function updateStatus(_0x1b69d8){if(_0x1b69d8[_0x06ff('0x45')]){faxMessage['update'](_0x1b69d8[_0x06ff('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x7a982a){ut[_0x06ff('0x46')]('[Fax][Message][Error][Updated]',_0x7a982a);})[_0x06ff('0x3f')](function(_0x3fcdca){ut[_0x06ff('0x46')](_0x06ff('0x47'),_0x3fcdca);});}else{ut[_0x06ff('0x46')](_0x06ff('0x48'));}}Fax[_0x06ff('0x1e')][_0x06ff('0x49')]=function(_0x253b20,_0x591005,_0x4f8477){var _0x398afa=this;var _0x476bac={};if(_0x591005){_0x476bac={'read':_0x591005};}else{_0x476bac={'failMessage':_0x4f8477};}if(this[_0x06ff('0xf')][_0x253b20][_0x06ff('0x45')]){faxMessage['update'](this[_0x06ff('0xf')][_0x253b20][_0x06ff('0x45')],_0x476bac)['then'](function(_0x260446){ut['logger']('[Fax][Message][Updated]',_0x260446);})['catch'](function(_0x5404e9){ut[_0x06ff('0x46')](_0x06ff('0x4a'),_0x5404e9);})[_0x06ff('0x4b')](function(){delete _0x398afa[_0x06ff('0xc')][_0x253b20];delete _0x398afa[_0x06ff('0xf')][_0x253b20];});}else{ut[_0x06ff('0x46')](_0x06ff('0x4c'));delete this[_0x06ff('0xc')][_0x253b20];delete this[_0x06ff('0xf')][_0x253b20];}};Fax[_0x06ff('0x1e')][_0x06ff('0x4d')]=function(_0x4e4cd4){var _0x95945c=this;if(this[_0x06ff('0xc')][_0x4e4cd4[_0x06ff('0x21')]]){if(this[_0x06ff('0xf')][_0x4e4cd4[_0x06ff('0x21')]]){this[_0x06ff('0xc')][_0x4e4cd4[_0x06ff('0x21')]]['id']=this[_0x06ff('0xf')][_0x4e4cd4['uniqueid']]['id'];this[_0x06ff('0xc')][_0x4e4cd4['uniqueid']][_0x06ff('0x23')]=this[_0x06ff('0xf')][_0x4e4cd4['uniqueid']][_0x06ff('0x23')];}logger[_0x06ff('0x25')](_0x4e4cd4[_0x06ff('0x21')],this[_0x06ff('0xf')][_0x4e4cd4[_0x06ff('0x21')]]?_0x06ff('0x4e'):'\x20hangup\x20faxRiceive\x20',JSON[_0x06ff('0x3e')](this['channels'][_0x4e4cd4[_0x06ff('0x21')]]));if(this[_0x06ff('0xf')][_0x4e4cd4[_0x06ff('0x21')]]){if(this[_0x06ff('0xc')][_0x4e4cd4[_0x06ff('0x21')]][_0x06ff('0x4f')]>0x0&&this[_0x06ff('0xc')][_0x4e4cd4[_0x06ff('0x21')]]['faxstatus']===_0x06ff('0x50')){this['updateStatus'](_0x4e4cd4[_0x06ff('0x21')],!![]);}else{this[_0x06ff('0x49')](_0x4e4cd4[_0x06ff('0x21')],![],this[_0x06ff('0xc')][_0x4e4cd4[_0x06ff('0x21')]][_0x06ff('0x51')]?'SENDING\x20FAILED:\x20'+this[_0x06ff('0xc')][_0x4e4cd4[_0x06ff('0x21')]][_0x06ff('0x51')]:_0x06ff('0x52'));}}}};Fax[_0x06ff('0x1e')][_0x06ff('0x53')]=function(_0x4933ea){var _0x57875a=this;return new BPromise(function(_0x3d2f71,_0x4501a6){_0x57875a[_0x06ff('0x54')](_0x4933ea,_0x57875a[_0x06ff('0xd')][_0x4933ea[_0x06ff('0x55')]])[_0x06ff('0x3a')](function(_0x16a314){ut[_0x06ff('0x46')](_0x06ff('0x56'),_0x16a314);_0x3d2f71(ut[_0x06ff('0x36')](_0x06ff('0x57')));})[_0x06ff('0x3f')](function(_0xc564dd){ut[_0x06ff('0x46')](_0x06ff('0x58'),_0xc564dd);updateStatus(_0x4933ea);_0x4501a6(ut[_0x06ff('0x36')]('Fax\x20failed'));});});};Fax[_0x06ff('0x1e')]['checkAfterSend']=function(_0x315177){var _0x977f49=this;return new BPromise(function(_0x3306f2,_0x111c17){var _0x553c4a=_0x977f49['checkTrunk'](_0x977f49[_0x06ff('0xd')][_0x315177[_0x06ff('0x55')]][_0x06ff('0x59')],_0x315177);if(_0x553c4a[_0x06ff('0x5a')]){_0x3306f2(ut[_0x06ff('0x36')]('Trunk\x20Reachable'));}else{_0x111c17(ut['message'](_0x553c4a[_0x06ff('0x36')]));}});};function originate(_0x48023a,_0x18e5b7,_0x442355){return new BPromise(function(_0x24f961,_0x1a0b19){if(_0x442355){var _0x177bcc=util[_0x06ff('0x5b')](_0x06ff('0x5c'),path[_0x06ff('0x3c')](_0x48023a[_0x06ff('0x4')])[_0x06ff('0x23')],_0x48023a[_0x06ff('0x4')]);gs[_0x06ff('0x5d')](_0x177bcc)[_0x06ff('0x3a')](function(){_0x48023a[_0x06ff('0x4')]=util[_0x06ff('0x5b')](_0x06ff('0x5e'),path[_0x06ff('0x3c')](_0x48023a[_0x06ff('0x4')])[_0x06ff('0x5f')],path[_0x06ff('0x3c')](_0x48023a['path'])['name']);_0x18e5b7[_0x06ff('0x60')]=_0x48023a[_0x06ff('0x4')];ut[_0x06ff('0x46')](_0x06ff('0x61'),'');ami[_0x06ff('0x62')](ut[_0x06ff('0x63')](_0x48023a,_0x18e5b7))[_0x06ff('0x3a')](function(_0x1ba6e1){_0x24f961(_0x1ba6e1);})[_0x06ff('0x3f')](function(_0x1efc10){_0x1a0b19(_0x1efc10);});})[_0x06ff('0x3f')](function(_0x48e464){_0x1a0b19(_0x48e464);});}else{ami['Action'](ut['variablesAction'](_0x48023a,_0x18e5b7))[_0x06ff('0x3a')](function(_0x3cc7d0){_0x24f961(_0x3cc7d0);})[_0x06ff('0x3f')](function(_0x3f7e95){_0x1a0b19(_0x3f7e95);});}});}Fax['prototype'][_0x06ff('0x54')]=function(_0x15de7c,_0x5a5c95){var _0xe23904=this;return new BPromise(function(_0x43efdc,_0x5261f2){var _0x1cda9b=uuid['v4']();var _0x3514da=ut[_0x06ff('0x64')](_0x15de7c,_0x5a5c95);_0xe23904[_0x06ff('0xf')][_0x1cda9b]=new Action(_0x1cda9b,_0x5a5c95,_0x15de7c);var _0x3c8c36=_0xe23904[_0x06ff('0xf')][_0x1cda9b];if(path['parse'](_0x15de7c['path'])[_0x06ff('0x65')]==='.pdf'){originate(_0x3c8c36,_0x3514da,!![])[_0x06ff('0x3a')](function(_0x147537){_0x43efdc(_0x147537);})['catch'](function(_0x54428c){_0x5261f2(_0x54428c);});}else{originate(_0x3c8c36,_0x3514da,![])[_0x06ff('0x3a')](function(_0xeba0ac){_0x43efdc(_0xeba0ac);})['catch'](function(_0x500eac){_0x5261f2(_0x500eac);});}});};Fax[_0x06ff('0x1e')][_0x06ff('0x66')]=function(_0x764686){return!_[_0x06ff('0x67')](_0x764686)&&!_[_0x06ff('0x67')](_0x764686[_0x06ff('0x23')])&&!_[_0x06ff('0x67')](_0x764686['active'])&&_0x764686[_0x06ff('0x68')]&&!_[_0x06ff('0x67')](this[_0x06ff('0xe')][util[_0x06ff('0x5b')](_0x06ff('0x69'),_0x764686[_0x06ff('0x23')])])&&!_[_0x06ff('0x67')](this[_0x06ff('0xe')][util[_0x06ff('0x5b')]('SIP/%s',_0x764686[_0x06ff('0x23')])][_0x06ff('0x2c')])&&(this[_0x06ff('0xe')][util[_0x06ff('0x5b')](_0x06ff('0x69'),_0x764686[_0x06ff('0x23')])][_0x06ff('0x2c')]===_0x06ff('0x6a')||this[_0x06ff('0xe')][util[_0x06ff('0x5b')]('SIP/%s',_0x764686[_0x06ff('0x23')])][_0x06ff('0x2c')]===_0x06ff('0x6b'));};Fax[_0x06ff('0x1e')][_0x06ff('0x6c')]=function(_0x4fdb09,_0x4514a4){if(!this[_0x06ff('0x66')](_0x4fdb09)){ut[_0x06ff('0x46')](_0x06ff('0x6d'),_['isNil'](_0x4fdb09)?'':_0x4fdb09[_0x06ff('0x23')]+_0x06ff('0x6e'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x06ff('0x67')](_0x4514a4[_0x06ff('0x6f')])){ut['logger'](_0x06ff('0x70'),JSON[_0x06ff('0x3e')](_0x4514a4));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x06ff('0x67')](_0x4514a4[_0x06ff('0x4')])){ut[_0x06ff('0x46')](_0x06ff('0x71'),JSON[_0x06ff('0x3e')](_0x4514a4));return{'isValid':![],'message':_0x06ff('0x72')};}return{'isValid':!![],'message':_0x06ff('0x73')};};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 f11bf66..bb8eb58 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 _0xfd6f=['../rpc/faxAccount','error','inspect','notify','resolve','catch','[Notify]\x20','bluebird','preview','lodash'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0xfd6f,0x1bf));var _0xffd6=function(_0x3c82fe,_0x39b7e5){_0x3c82fe=_0x3c82fe-0x0;var _0x487c97=_0xfd6f[_0x3c82fe];return _0x487c97;};'use strict';var util=require('util');var BPromise=require(_0xffd6('0x0'));var logger=require('../../../config/logger')(_0xffd6('0x1'));var _=require(_0xffd6('0x2'));var faxAccount=require(_0xffd6('0x3'));function loggerCatch(_0x5ac764){return function(_0x32490e){logger[_0xffd6('0x4')](_0x5ac764,util[_0xffd6('0x5')](_0x32490e,{'showHidden':![],'depth':null}));};}exports[_0xffd6('0x6')]=function(_0x1ae53a,_0x2d97ba){return BPromise[_0xffd6('0x7')]()['then'](faxAccount[_0xffd6('0x6')](_0x1ae53a,_0x2d97ba))[_0xffd6('0x8')](loggerCatch(_0xffd6('0x9')));}; \ No newline at end of file +var _0x3226=['catch','bluebird','../../../config/logger','preview','lodash','error','inspect','notify','then'];(function(_0x40ef76,_0x175aae){var _0x529ea8=function(_0xc34ded){while(--_0xc34ded){_0x40ef76['push'](_0x40ef76['shift']());}};_0x529ea8(++_0x175aae);}(_0x3226,0x64));var _0x6322=function(_0x2b7a2a,_0x20758a){_0x2b7a2a=_0x2b7a2a-0x0;var _0x4fa23f=_0x3226[_0x2b7a2a];return _0x4fa23f;};'use strict';var util=require('util');var BPromise=require(_0x6322('0x0'));var logger=require(_0x6322('0x1'))(_0x6322('0x2'));var _=require(_0x6322('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x484846){return function(_0x25a05f){logger[_0x6322('0x4')](_0x484846,util[_0x6322('0x5')](_0x25a05f,{'showHidden':![],'depth':null}));};}exports[_0x6322('0x6')]=function(_0x53ab75,_0x464b6c){return BPromise['resolve']()[_0x6322('0x7')](faxAccount['notify'](_0x53ab75,_0x464b6c))[_0x6322('0x8')](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 542ee8f..981c187 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 _0x7dca=['execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','bluebird','child_process'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x7dca,0x1c7));var _0xa7dc=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x7dca[_0x39e283];return _0x7de89f;};'use strict';var util=require(_0xa7dc('0x0'));var logger=require(_0xa7dc('0x1'))('fax');var BPromise=require(_0xa7dc('0x2'));var exec=require(_0xa7dc('0x3'))['exec'];exports[_0xa7dc('0x4')]=function(_0x31d305){return new BPromise(function(_0x16124d,_0x5adcf0){exec(_0x31d305,function(_0x5ce2ee,_0x4cd29b,_0x3c064d){logger[_0xa7dc('0x5')](_0xa7dc('0x6'),_0x4cd29b);if(_0x5ce2ee){logger[_0xa7dc('0x5')](_0xa7dc('0x6'),_0xa7dc('0x7'),util[_0xa7dc('0x8')](_0x5ce2ee,{'showHidden':![],'depth':null}),_0x4cd29b,_0x3c064d);_0x5adcf0(_0x5ce2ee);}_0x16124d(_0x4cd29b);});});}; \ No newline at end of file +var _0xe55d=['../../../../config/logger','fax','bluebird','child_process','exec','Exec\x20gs','inspect','util'];(function(_0x17615e,_0x483a49){var _0xa4c97e=function(_0x24ecf7){while(--_0x24ecf7){_0x17615e['push'](_0x17615e['shift']());}};_0xa4c97e(++_0x483a49);}(_0xe55d,0x14f));var _0xde55=function(_0x33d4f5,_0xe03194){_0x33d4f5=_0x33d4f5-0x0;var _0x1b3d93=_0xe55d[_0x33d4f5];return _0x1b3d93;};'use strict';var util=require(_0xde55('0x0'));var logger=require(_0xde55('0x1'))(_0xde55('0x2'));var BPromise=require(_0xde55('0x3'));var exec=require(_0xde55('0x4'))[_0xde55('0x5')];exports['execute']=function(_0x21a200){return new BPromise(function(_0x43638f,_0x489efc){exec(_0x21a200,function(_0x59eccb,_0x41fa62,_0x58c330){logger['info'](_0xde55('0x6'),_0x41fa62);if(_0x59eccb){logger['info'](_0xde55('0x6'),'\x20Error\x20:',util[_0xde55('0x7')](_0x59eccb,{'showHidden':![],'depth':null}),_0x41fa62,_0x58c330);_0x489efc(_0x59eccb);}_0x43638f(_0x41fa62);});});}; \ 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 2383e66..3536251 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 _0x0aa2=['../../../../config/logger','message','logger','inspect','addVariables','ecm','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','uniqueid','channel','from-sip','format','localstationid','util','moment'];(function(_0xfcba76,_0x2c7c58){var _0x5a73fe=function(_0x36e73f){while(--_0x36e73f){_0xfcba76['push'](_0xfcba76['shift']());}};_0x5a73fe(++_0x2c7c58);}(_0x0aa2,0x1de));var _0x20aa=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0aa2[_0x2c91e9];return _0x13f0ff;};'use strict';var util=require(_0x20aa('0x0'));var _=require('lodash');var moment=require(_0x20aa('0x1'));var logger=require(_0x20aa('0x2'))('fax');exports[_0x20aa('0x3')]=function(_0x3f9e79){return{'message':_0x3f9e79};};exports[_0x20aa('0x4')]=function(_0x4c56c2,_0x17169c){logger['info'](_0x4c56c2,util[_0x20aa('0x5')](_0x17169c,{'showHidden':![],'depth':null}));};exports[_0x20aa('0x6')]=function(_0x17665d,_0x131f10){var _0x121bae={'XMF-ECM':_0x131f10[_0x20aa('0x7')],'XMF-HEADERINFO':_0x131f10['headerinfo'],'XMF-MINRATE':_0x131f10[_0x20aa('0x8')],'XMF-MAXRATE':_0x131f10[_0x20aa('0x9')],'XMF-MODEM':util['format'](_0x20aa('0xa'),_0x131f10[_0x20aa('0xb')]),'XMF-GATEWAY':_0x131f10[_0x20aa('0xc')],'XMF-FAXDETECT':_0x131f10[_0x20aa('0xd')],'XMF-T38TIMEOUT':_0x131f10[_0x20aa('0xe')],'XMF-LOCALSTATIONID':_0x131f10['localstationid'],'XMF-PATH':_0x17665d['path']};return _0x121bae;};exports['variablesAction']=function(_0x51f732,_0x4f45e4){return{'actionid':_0x51f732[_0x20aa('0xf')],'action':'originate','channel':_0x51f732[_0x20aa('0x10')],'Exten':'xcally-motion-fax','Context':_0x20aa('0x11'),'Priority':'1','callerid':util[_0x20aa('0x12')]('\x22%s\x22\x20<%s>',_0x51f732['headerinfo']?_0x51f732['headerinfo']:'',_0x51f732[_0x20aa('0x13')]),'variable':_0x4f45e4,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x51f732[_0x20aa('0xf')]};}; \ No newline at end of file +var _0x5aa1=['lodash','../../../../config/logger','logger','info','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','faxdetect','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','localstationid','util'];(function(_0x3f1a8a,_0x5e6b68){var _0x3e34da=function(_0x514f46){while(--_0x514f46){_0x3f1a8a['push'](_0x3f1a8a['shift']());}};_0x3e34da(++_0x5e6b68);}(_0x5aa1,0x12a));var _0x15aa=function(_0x5eb227,_0x1fcd8f){_0x5eb227=_0x5eb227-0x0;var _0x453370=_0x5aa1[_0x5eb227];return _0x453370;};'use strict';var util=require(_0x15aa('0x0'));var _=require(_0x15aa('0x1'));var moment=require('moment');var logger=require(_0x15aa('0x2'))('fax');exports['message']=function(_0x1bb68c){return{'message':_0x1bb68c};};exports[_0x15aa('0x3')]=function(_0x10be1d,_0x3abed9){logger[_0x15aa('0x4')](_0x10be1d,util[_0x15aa('0x5')](_0x3abed9,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x353c21,_0x5a45f8){var _0x2e4b18={'XMF-ECM':_0x5a45f8[_0x15aa('0x6')],'XMF-HEADERINFO':_0x5a45f8[_0x15aa('0x7')],'XMF-MINRATE':_0x5a45f8[_0x15aa('0x8')],'XMF-MAXRATE':_0x5a45f8[_0x15aa('0x9')],'XMF-MODEM':util[_0x15aa('0xa')](_0x15aa('0xb'),_0x5a45f8['modem']),'XMF-GATEWAY':_0x5a45f8['gateway'],'XMF-FAXDETECT':_0x5a45f8[_0x15aa('0xc')],'XMF-T38TIMEOUT':_0x5a45f8[_0x15aa('0xd')],'XMF-LOCALSTATIONID':_0x5a45f8['localstationid'],'XMF-PATH':_0x353c21[_0x15aa('0xe')]};return _0x2e4b18;};exports[_0x15aa('0xf')]=function(_0x1b9046,_0xb79523){return{'actionid':_0x1b9046[_0x15aa('0x10')],'action':_0x15aa('0x11'),'channel':_0x1b9046[_0x15aa('0x12')],'Exten':_0x15aa('0x13'),'Context':_0x15aa('0x14'),'Priority':'1','callerid':util['format'](_0x15aa('0x15'),_0x1b9046['headerinfo']?_0x1b9046[_0x15aa('0x7')]:'',_0x1b9046[_0x15aa('0x16')]),'variable':_0xb79523,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1b9046[_0x15aa('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 811c6fe..8e30381 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 _0x66a8=['./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','catch','log','listen','sync','bluebird','./server','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk'];(function(_0x221671,_0x430447){var _0x57c49f=function(_0x536f93){while(--_0x536f93){_0x221671['push'](_0x221671['shift']());}};_0x57c49f(++_0x430447);}(_0x66a8,0x1ef));var _0x866a=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x66a8[_0xe73080];return _0x12cbc4;};'use strict';var BPromise=require(_0x866a('0x0'));var util=require('util');var moment=require('moment');var server=require(_0x866a('0x1'));var Realtime=require(_0x866a('0x2'));var Report=require(_0x866a('0x3'));var Acw=require(_0x866a('0x4'));var Trigger=require(_0x866a('0x5'));var Dialer=require(_0x866a('0x6'));var Preview=require('./preview');var Fax=require(_0x866a('0x7'));var user=require(_0x866a('0x8'));var voiceQueue=require(_0x866a('0x9'));var voiceQueueReport=require(_0x866a('0xa'));var voiceCallReport=require(_0x866a('0xb'));var trunk=require(_0x866a('0xc'));var trigger=require(_0x866a('0xd'));var template=require(_0x866a('0xe'));var cmHopperHistory=require(_0x866a('0xf'));var campaign=require(_0x866a('0x10'));var voiceExtension=require(_0x866a('0x11'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x866a('0x12'));var salesforce=require(_0x866a('0x13'));var sugarcrm=require(_0x866a('0x14'));var freshdesk=require(_0x866a('0x15'));var desk=require(_0x866a('0x16'));var zoho=require(_0x866a('0x17'));var vtiger=require(_0x866a('0x18'));var freshsales=require(_0x866a('0x19'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x866a('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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x866a('0x1b')](_0x866a('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x866a('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x866a('0x1d')]()[_0x866a('0x1e')](user[_0x866a('0x1f')]())[_0x866a('0x1e')](realtime[_0x866a('0x20')]())[_0x866a('0x1e')](user[_0x866a('0x21')]())[_0x866a('0x1e')](realtime['initTelephones']())[_0x866a('0x1e')](trunk[_0x866a('0x22')]())[_0x866a('0x1e')](realtime[_0x866a('0x23')]())[_0x866a('0x1e')](voiceQueue[_0x866a('0x24')]())[_0x866a('0x1e')](realtime[_0x866a('0x25')]())['then'](trigger[_0x866a('0x26')]())['then'](realtime[_0x866a('0x27')]())[_0x866a('0x1e')](template[_0x866a('0x28')]())[_0x866a('0x1e')](realtime[_0x866a('0x29')]())['then'](zendesk[_0x866a('0x2a')]())[_0x866a('0x1e')](realtime['initZendeskAccounts']())[_0x866a('0x1e')](salesforce['getSalesforceAccounts']())['then'](realtime[_0x866a('0x2b')]())[_0x866a('0x1e')](sugarcrm[_0x866a('0x2c')]())[_0x866a('0x1e')](realtime[_0x866a('0x2d')]())[_0x866a('0x1e')](freshdesk[_0x866a('0x2e')]())[_0x866a('0x1e')](realtime[_0x866a('0x2f')]())[_0x866a('0x1e')](desk[_0x866a('0x30')]())[_0x866a('0x1e')](realtime[_0x866a('0x31')]())[_0x866a('0x1e')](zoho[_0x866a('0x32')]())[_0x866a('0x1e')](realtime[_0x866a('0x33')]())['then'](vtiger[_0x866a('0x34')]())['then'](realtime[_0x866a('0x35')]())[_0x866a('0x1e')](freshsales[_0x866a('0x36')]())[_0x866a('0x1e')](realtime[_0x866a('0x37')]())[_0x866a('0x1e')](servicenow[_0x866a('0x38')]())[_0x866a('0x1e')](realtime[_0x866a('0x39')]())[_0x866a('0x1e')](dynamics365[_0x866a('0x3a')]())[_0x866a('0x1e')](realtime[_0x866a('0x3b')]())['then'](campaign[_0x866a('0x3c')]())['then'](realtime[_0x866a('0x3d')]())[_0x866a('0x1e')](voiceExtension[_0x866a('0x3e')]())[_0x866a('0x1e')](realtime[_0x866a('0x3f')]())[_0x866a('0x1e')](faxAccount['getFaxAccounts']())['then'](realtime[_0x866a('0x40')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x866a('0x1d')]()[_0x866a('0x1e')](voiceQueueReport[_0x866a('0x41')]())[_0x866a('0x1e')](realtime[_0x866a('0x42')]())[_0x866a('0x1e')](cmHopperHistory['getVoiceQueueHopperHistory']())['then'](realtime['initVoiceQueueHopperHistory']())[_0x866a('0x1e')](cmHopperHistory[_0x866a('0x43')]())[_0x866a('0x1e')](realtime[_0x866a('0x44')]())[_0x866a('0x1e')](voiceCallReport[_0x866a('0x45')]())['then'](realtime['initVoiceCallReports']())[_0x866a('0x1e')](function(_0x34bd2a){})[_0x866a('0x46')](function(_0x234be3){console[_0x866a('0x47')](_0x234be3);});}function main(){return server[_0x866a('0x48')](realtime,preview,fax)[_0x866a('0x1e')](function(_0xf26366){return initRealtime();})['then'](function(){return initParams();})[_0x866a('0x1e')](function(){report[_0x866a('0x49')]();setInterval(initRealtime,0x1388);})[_0x866a('0x46')](function(_0x2816e5){console[_0x866a('0x47')](_0x2816e5);});}main(); \ No newline at end of file +var _0x1893=['./fax','./rpc/user','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger'];(function(_0x2cb9ba,_0x4dd3c7){var _0x4d87f7=function(_0x5e9168){while(--_0x5e9168){_0x2cb9ba['push'](_0x2cb9ba['shift']());}};_0x4d87f7(++_0x4dd3c7);}(_0x1893,0x108));var _0x3189=function(_0x4bfff5,_0xbd2a67){_0x4bfff5=_0x4bfff5-0x0;var _0x2383bc=_0x1893[_0x4bfff5];return _0x2383bc;};'use strict';var BPromise=require(_0x3189('0x0'));var util=require(_0x3189('0x1'));var moment=require(_0x3189('0x2'));var server=require(_0x3189('0x3'));var Realtime=require(_0x3189('0x4'));var Report=require(_0x3189('0x5'));var Acw=require(_0x3189('0x6'));var Trigger=require(_0x3189('0x7'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0x3189('0x8'));var user=require(_0x3189('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x3189('0xa'));var trunk=require(_0x3189('0xb'));var trigger=require('./rpc/trigger');var template=require(_0x3189('0xc'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x3189('0xd'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x3189('0xe'));var zendesk=require(_0x3189('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x3189('0x10'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x3189('0x11'));var zoho=require(_0x3189('0x12'));var vtiger=require(_0x3189('0x13'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x3189('0x14'));var dynamics365=require(_0x3189('0x15'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x3189('0x16')](_0x3189('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x3189('0x16')](_0x3189('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x3189('0x18')]()[_0x3189('0x19')](user[_0x3189('0x1a')]())['then'](realtime['initAgents']())[_0x3189('0x19')](user[_0x3189('0x1b')]())['then'](realtime[_0x3189('0x1c')]())[_0x3189('0x19')](trunk['getTrunks']())[_0x3189('0x19')](realtime[_0x3189('0x1d')]())[_0x3189('0x19')](voiceQueue[_0x3189('0x1e')]())['then'](realtime[_0x3189('0x1f')]())[_0x3189('0x19')](trigger[_0x3189('0x20')]())[_0x3189('0x19')](realtime[_0x3189('0x21')]())['then'](template[_0x3189('0x22')]())['then'](realtime['initTemplates']())[_0x3189('0x19')](zendesk[_0x3189('0x23')]())[_0x3189('0x19')](realtime[_0x3189('0x24')]())[_0x3189('0x19')](salesforce[_0x3189('0x25')]())[_0x3189('0x19')](realtime[_0x3189('0x26')]())['then'](sugarcrm[_0x3189('0x27')]())['then'](realtime[_0x3189('0x28')]())[_0x3189('0x19')](freshdesk[_0x3189('0x29')]())[_0x3189('0x19')](realtime[_0x3189('0x2a')]())['then'](desk[_0x3189('0x2b')]())['then'](realtime[_0x3189('0x2c')]())['then'](zoho[_0x3189('0x2d')]())[_0x3189('0x19')](realtime['initZohoAccounts']())['then'](vtiger[_0x3189('0x2e')]())[_0x3189('0x19')](realtime[_0x3189('0x2f')]())[_0x3189('0x19')](freshsales[_0x3189('0x30')]())[_0x3189('0x19')](realtime[_0x3189('0x31')]())['then'](servicenow[_0x3189('0x32')]())['then'](realtime['initServicenowAccounts']())[_0x3189('0x19')](dynamics365[_0x3189('0x33')]())[_0x3189('0x19')](realtime[_0x3189('0x34')]())[_0x3189('0x19')](campaign[_0x3189('0x35')]())['then'](realtime[_0x3189('0x36')]())[_0x3189('0x19')](voiceExtension['getVoiceExtensions']())[_0x3189('0x19')](realtime[_0x3189('0x37')]())[_0x3189('0x19')](faxAccount[_0x3189('0x38')]())[_0x3189('0x19')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return BPromise[_0x3189('0x18')]()[_0x3189('0x19')](voiceQueueReport[_0x3189('0x39')]())['then'](realtime[_0x3189('0x3a')]())['then'](cmHopperHistory[_0x3189('0x3b')]())['then'](realtime[_0x3189('0x3c')]())[_0x3189('0x19')](cmHopperHistory[_0x3189('0x3d')]())[_0x3189('0x19')](realtime[_0x3189('0x3e')]())['then'](voiceCallReport['getVoiceCallReports']())[_0x3189('0x19')](realtime[_0x3189('0x3f')]())[_0x3189('0x19')](function(_0x2e36ce){})[_0x3189('0x40')](function(_0x32145d){console[_0x3189('0x41')](_0x32145d);});}function main(){return server[_0x3189('0x42')](realtime,preview,fax)[_0x3189('0x19')](function(_0x36ff9c){return initRealtime();})[_0x3189('0x19')](function(){return initParams();})[_0x3189('0x19')](function(){report[_0x3189('0x43')]();setInterval(initRealtime,0x1388);})[_0x3189('0x40')](function(_0x232368){console[_0x3189('0x41')](_0x232368);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 93408af..1348058 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 _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x31ce94,_0x246777){var _0x16ca31=function(_0x1af663){while(--_0x1af663){_0x31ce94['push'](_0x31ce94['shift']());}};_0x16ca31(++_0x246777);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file +var _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x4b888c,_0x541ef2){var _0x1f69c8=function(_0x3a4caf){while(--_0x3a4caf){_0x4b888c['push'](_0x4b888c['shift']());}};_0x1f69c8(++_0x541ef2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0xcb91[_0x593564];return _0x211a89;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 88cd3a5..0839d65 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 _0x4735=['exports','name','type','originated','temp','message','active','limitCalls','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','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength'];(function(_0x383494,_0x2070d2){var _0x2485e5=function(_0x37c52e){while(--_0x37c52e){_0x383494['push'](_0x383494['shift']());}};_0x2485e5(++_0x2070d2);}(_0x4735,0x189));var _0x5473=function(_0x1541c3,_0x2c6f07){_0x1541c3=_0x1541c3-0x0;var _0x3f9028=_0x4735[_0x1541c3];return _0x3f9028;};'use strict';function Campaign(_0x54993f){this['id']=_0x54993f['id']||0x0;this[_0x5473('0x0')]=_0x54993f['name']||'';this['type']=_0x54993f[_0x5473('0x1')]||'campaign';this[_0x5473('0x2')]=0x0;this[_0x5473('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x5473('0x4')]='';this['sendMessageOneNotActive']=!![];this[_0x5473('0x5')]=_0x54993f[_0x5473('0x5')];this[_0x5473('0x6')]=_0x54993f[_0x5473('0x6')];this[_0x5473('0x7')]=_0x54993f[_0x5473('0x7')]||null;this['dialGlobalInterval']=_0x54993f['dialGlobalInterval']?_0x54993f[_0x5473('0x8')]:null;this[_0x5473('0x9')]=_0x54993f[_0x5473('0x9')];this[_0x5473('0xa')]=_0x54993f[_0x5473('0xa')];this[_0x5473('0xb')]=_0x54993f[_0x5473('0xb')]||0x1e;this[_0x5473('0xc')]=_0x54993f[_0x5473('0xc')];this[_0x5473('0xd')]=_0x54993f[_0x5473('0xd')];this[_0x5473('0xe')]=_0x54993f[_0x5473('0xe')];this[_0x5473('0xf')]=_0x54993f['dialBusyRetryFrequency'];this[_0x5473('0x10')]=_0x54993f[_0x5473('0x10')];this[_0x5473('0x11')]=_0x54993f['dialNoAnswerRetryFrequency'];this[_0x5473('0x12')]=_0x54993f[_0x5473('0x12')];this[_0x5473('0x13')]=_0x54993f[_0x5473('0x13')]||0x3;this[_0x5473('0x14')]=_0x54993f[_0x5473('0x14')]||0x96;this[_0x5473('0x15')]=_0x54993f[_0x5473('0x15')]||0x3;this[_0x5473('0x16')]=_0x54993f[_0x5473('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x54993f[_0x5473('0x17')]||0x3;this[_0x5473('0x18')]=_0x54993f[_0x5473('0x18')]||0x96;this[_0x5473('0x19')]=_0x54993f['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x54993f[_0x5473('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x54993f[_0x5473('0x1b')]||0x3;this['dialAgentRejectRetryFrequency']=_0x54993f[_0x5473('0x1c')]||0x96;this[_0x5473('0x1d')]=_0x54993f[_0x5473('0x1d')]||_0x5473('0x1e');this[_0x5473('0x1f')]=_0x54993f[_0x5473('0x1f')]||undefined;this[_0x5473('0x20')]=_0x54993f[_0x5473('0x20')]||undefined;this[_0x5473('0x21')]=_0x54993f[_0x5473('0x21')]||undefined;this[_0x5473('0x22')]=_0x54993f[_0x5473('0x22')]?_0x54993f[_0x5473('0x22')]:undefined;this[_0x5473('0x23')]=_0x54993f[_0x5473('0x23')]?_0x54993f[_0x5473('0x23')]:undefined;this[_0x5473('0x24')]=_0x54993f[_0x5473('0x24')]?_0x54993f[_0x5473('0x24')]:undefined;this['SquareProject']=_0x54993f[_0x5473('0x25')]?_0x54993f[_0x5473('0x25')]:undefined;this['dialQueueProject']=_0x54993f['SquareProject']?_0x54993f['SquareProject'][_0x5473('0x0')]:undefined;this[_0x5473('0x26')]=_0x54993f[_0x5473('0x26')]||![];this[_0x5473('0x27')]=_0x54993f[_0x5473('0x27')];this[_0x5473('0x28')]=_0x54993f[_0x5473('0x28')];this[_0x5473('0x29')]=_0x54993f[_0x5473('0x29')];this['dialAMDTotalAnalysisTime']=_0x54993f[_0x5473('0x2a')];this[_0x5473('0x2b')]=_0x54993f[_0x5473('0x2b')];this[_0x5473('0x2c')]=_0x54993f[_0x5473('0x2c')];this[_0x5473('0x2d')]=_0x54993f[_0x5473('0x2d')];this[_0x5473('0x2e')]=_0x54993f[_0x5473('0x2e')];this[_0x5473('0x2f')]=_0x54993f[_0x5473('0x2f')];}module[_0x5473('0x30')]=Campaign; \ No newline at end of file +var _0x9c83=['sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','message'];(function(_0x4165f4,_0x45da2b){var _0x123d71=function(_0x3ade80){while(--_0x3ade80){_0x4165f4['push'](_0x4165f4['shift']());}};_0x123d71(++_0x45da2b);}(_0x9c83,0xc1));var _0x39c8=function(_0x5a37af,_0x186592){_0x5a37af=_0x5a37af-0x0;var _0x2d76a7=_0x9c83[_0x5a37af];return _0x2d76a7;};'use strict';function Campaign(_0xef3c72){this['id']=_0xef3c72['id']||0x0;this[_0x39c8('0x0')]=_0xef3c72[_0x39c8('0x0')]||'';this[_0x39c8('0x1')]=_0xef3c72['type']||_0x39c8('0x2');this[_0x39c8('0x3')]=0x0;this[_0x39c8('0x4')]=0x0;this[_0x39c8('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x39c8('0x6')]='';this[_0x39c8('0x7')]=!![];this['active']=_0xef3c72[_0x39c8('0x8')];this[_0x39c8('0x9')]=_0xef3c72[_0x39c8('0x9')];this[_0x39c8('0xa')]=_0xef3c72['dialTimezone']||null;this[_0x39c8('0xb')]=_0xef3c72['dialGlobalInterval']?_0xef3c72[_0x39c8('0xb')]:null;this[_0x39c8('0xc')]=_0xef3c72['dialOriginateCallerIdName'];this[_0x39c8('0xd')]=_0xef3c72[_0x39c8('0xd')];this[_0x39c8('0xe')]=_0xef3c72[_0x39c8('0xe')]||0x1e;this[_0x39c8('0xf')]=_0xef3c72[_0x39c8('0xf')];this[_0x39c8('0x10')]=_0xef3c72[_0x39c8('0x10')];this[_0x39c8('0x11')]=_0xef3c72['dialBusyMaxRetry'];this[_0x39c8('0x12')]=_0xef3c72['dialBusyRetryFrequency'];this[_0x39c8('0x13')]=_0xef3c72[_0x39c8('0x13')];this[_0x39c8('0x14')]=_0xef3c72[_0x39c8('0x14')];this[_0x39c8('0x15')]=_0xef3c72['dialGlobalMaxRetry'];this[_0x39c8('0x16')]=_0xef3c72[_0x39c8('0x16')]||0x3;this[_0x39c8('0x17')]=_0xef3c72['dialNoSuchNumberRetryFrequency']||0x96;this[_0x39c8('0x18')]=_0xef3c72[_0x39c8('0x18')]||0x3;this['dialDropRetryFrequency']=_0xef3c72[_0x39c8('0x19')]||0x96;this[_0x39c8('0x1a')]=_0xef3c72[_0x39c8('0x1a')]||0x3;this['dialAbandonedRetryFrequency']=_0xef3c72[_0x39c8('0x1b')]||0x96;this[_0x39c8('0x1c')]=_0xef3c72[_0x39c8('0x1c')]||0x3;this['dialMachineRetryFrequency']=_0xef3c72[_0x39c8('0x1d')]||0x96;this[_0x39c8('0x1e')]=_0xef3c72[_0x39c8('0x1e')]||0x3;this['dialAgentRejectRetryFrequency']=_0xef3c72[_0x39c8('0x1f')]||0x96;this[_0x39c8('0x20')]=_0xef3c72['dialOrderByScheduledAt']||'DESC';this[_0x39c8('0x21')]=_0xef3c72[_0x39c8('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0xef3c72['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x39c8('0x22')]=_0xef3c72[_0x39c8('0x22')]||undefined;this[_0x39c8('0x23')]=_0xef3c72[_0x39c8('0x23')]?_0xef3c72[_0x39c8('0x23')]:undefined;this[_0x39c8('0x24')]=_0xef3c72[_0x39c8('0x24')]?_0xef3c72['Trunk']:undefined;this[_0x39c8('0x25')]=_0xef3c72[_0x39c8('0x25')]?_0xef3c72['Interval']:undefined;this[_0x39c8('0x26')]=_0xef3c72[_0x39c8('0x26')]?_0xef3c72[_0x39c8('0x26')]:undefined;this[_0x39c8('0x27')]=_0xef3c72[_0x39c8('0x26')]?_0xef3c72[_0x39c8('0x26')][_0x39c8('0x0')]:undefined;this[_0x39c8('0x28')]=_0xef3c72[_0x39c8('0x28')]||![];this[_0x39c8('0x29')]=_0xef3c72[_0x39c8('0x29')];this[_0x39c8('0x2a')]=_0xef3c72[_0x39c8('0x2a')];this[_0x39c8('0x2b')]=_0xef3c72[_0x39c8('0x2b')];this['dialAMDTotalAnalysisTime']=_0xef3c72[_0x39c8('0x2c')];this[_0x39c8('0x2d')]=_0xef3c72[_0x39c8('0x2d')];this['dialAMDBetweenWordsSilence']=_0xef3c72[_0x39c8('0x2e')];this[_0x39c8('0x2f')]=_0xef3c72[_0x39c8('0x2f')];this[_0x39c8('0x30')]=_0xef3c72[_0x39c8('0x30')];this[_0x39c8('0x31')]=_0xef3c72['dialAMDMaximumWordLength'];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index e1d3ce5..3223af3 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 _0x7096=['connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','billableseconds','holdtime','type','tag','disposition','monitor','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','channel','calleridnum'];(function(_0x2c9f5b,_0x4b03e1){var _0xeb79f1=function(_0x5fb721){while(--_0x5fb721){_0x2c9f5b['push'](_0x2c9f5b['shift']());}};_0xeb79f1(++_0x4b03e1);}(_0x7096,0x10c));var _0x6709=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x7096[_0x433a86];return _0x23000c;};'use strict';function Channel(){this['starttime']=null;this[_0x6709('0x0')]='';this['destinationchannel']='';this[_0x6709('0x1')]=0x0;this['calleridname']='';this[_0x6709('0x2')]=undefined;this[_0x6709('0x3')]=undefined;this[_0x6709('0x4')]=0x0;this[_0x6709('0x5')]='';this[_0x6709('0x6')]=0x0;this[_0x6709('0x7')]=0x0;this[_0x6709('0x8')]=0x0;this[_0x6709('0x9')]=![];this[_0x6709('0xa')]=null;this[_0x6709('0xb')]=null;this[_0x6709('0xc')]=![];this[_0x6709('0xd')]=![];this[_0x6709('0xe')]='';this['lastdata']='';this['duration']=0x0;this[_0x6709('0xf')]=0x0;this[_0x6709('0x10')]=0x0;this[_0x6709('0x11')]=null;this[_0x6709('0x12')]=null;this[_0x6709('0x13')]=null;this[_0x6709('0x14')]=![];this['monitorFilename']=null;this['queue']=null;this[_0x6709('0x15')]=[];this[_0x6709('0x16')]=undefined;this[_0x6709('0x17')]=undefined;this[_0x6709('0x18')]=undefined;this[_0x6709('0x19')]=0x0;}module[_0x6709('0x1a')]=Channel; \ No newline at end of file +var _0x4f3d=['queue','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitorFilename'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4f3d,0x171));var _0xd4f3=function(_0x4643ae,_0x588d99){_0x4643ae=_0x4643ae-0x0;var _0x59ccef=_0x4f3d[_0x4643ae];return _0x59ccef;};'use strict';function Channel(){this[_0xd4f3('0x0')]=null;this['channel']='';this[_0xd4f3('0x1')]='';this[_0xd4f3('0x2')]=0x0;this[_0xd4f3('0x3')]='';this[_0xd4f3('0x4')]=undefined;this[_0xd4f3('0x5')]=undefined;this['accountcode']=0x0;this[_0xd4f3('0x6')]='';this[_0xd4f3('0x7')]=0x0;this[_0xd4f3('0x8')]=0x0;this[_0xd4f3('0x9')]=0x0;this[_0xd4f3('0xa')]=![];this[_0xd4f3('0xb')]=null;this[_0xd4f3('0xc')]=null;this[_0xd4f3('0xd')]=![];this['abandoned']=![];this[_0xd4f3('0xe')]='';this[_0xd4f3('0xf')]='';this[_0xd4f3('0x10')]=0x0;this[_0xd4f3('0x11')]=0x0;this[_0xd4f3('0x12')]=0x0;this[_0xd4f3('0x13')]=null;this[_0xd4f3('0x14')]=null;this[_0xd4f3('0x15')]=null;this['monitor']=![];this[_0xd4f3('0x16')]=null;this[_0xd4f3('0x17')]=null;this['monitors']=[];this[_0xd4f3('0x18')]=undefined;this[_0xd4f3('0x19')]=undefined;this['transferType']=undefined;this[_0xd4f3('0x1a')]=0x0;}module[_0xd4f3('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index a74bdc6..410a68f 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 _0x99fa=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x4b2014,_0x181657){var _0x32862a=function(_0x53c0e9){while(--_0x53c0e9){_0x4b2014['push'](_0x4b2014['shift']());}};_0x32862a(++_0x181657);}(_0x99fa,0x14f));var _0xa99f=function(_0x2388be,_0x43ebae){_0x2388be=_0x2388be-0x0;var _0x13ac52=_0x99fa[_0x2388be];return _0x13ac52;};'use strict';function DeskAccount(_0xec6003){this['id']=_0xec6003['id']||0x0;this[_0xa99f('0x0')]=_0xec6003[_0xa99f('0x0')]||'';this[_0xa99f('0x1')]=_0xec6003['username']||'';this['remoteUri']=_0xec6003[_0xa99f('0x2')]||'';this[_0xa99f('0x3')]=_0xec6003[_0xa99f('0x3')]||'';this[_0xa99f('0x4')]=_0xec6003['password']||'';this[_0xa99f('0x5')]=_0xec6003[_0xa99f('0x5')]||'';this[_0xa99f('0x6')]=_0xec6003[_0xa99f('0x6')]||'';this[_0xa99f('0x7')]=_0xec6003['token']||'';this[_0xa99f('0x8')]=_0xec6003['tokenSecret']||'';this[_0xa99f('0x9')]=_0xec6003[_0xa99f('0x9')]||'';this[_0xa99f('0xa')]=_0xec6003[_0xa99f('0xa')]||'';this[_0xa99f('0xb')]=_0xec6003['Configurations']||{};}module[_0xa99f('0xc')]=DeskAccount; \ No newline at end of file +var _0xcc8b=['Configurations','exports','name','username','remoteUri','authType','password','consumerSecret','tokenSecret','type','serverUrl'];(function(_0x222cff,_0x493c92){var _0x5c931b=function(_0x30f854){while(--_0x30f854){_0x222cff['push'](_0x222cff['shift']());}};_0x5c931b(++_0x493c92);}(_0xcc8b,0x14c));var _0xbcc8=function(_0x586352,_0x4327c4){_0x586352=_0x586352-0x0;var _0xa3d122=_0xcc8b[_0x586352];return _0xa3d122;};'use strict';function DeskAccount(_0x2b4a70){this['id']=_0x2b4a70['id']||0x0;this[_0xbcc8('0x0')]=_0x2b4a70[_0xbcc8('0x0')]||'';this[_0xbcc8('0x1')]=_0x2b4a70[_0xbcc8('0x1')]||'';this['remoteUri']=_0x2b4a70[_0xbcc8('0x2')]||'';this[_0xbcc8('0x3')]=_0x2b4a70['authType']||'';this[_0xbcc8('0x4')]=_0x2b4a70[_0xbcc8('0x4')]||'';this['consumerKey']=_0x2b4a70['consumerKey']||'';this[_0xbcc8('0x5')]=_0x2b4a70['consumerSecret']||'';this['token']=_0x2b4a70['token']||'';this[_0xbcc8('0x6')]=_0x2b4a70['tokenSecret']||'';this[_0xbcc8('0x7')]=_0x2b4a70[_0xbcc8('0x7')]||'';this[_0xbcc8('0x8')]=_0x2b4a70[_0xbcc8('0x8')]||'';this[_0xbcc8('0x9')]=_0x2b4a70['Configurations']||{};}module[_0xbcc8('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 750a0a1..62e5090 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 _0x2750=['clientId','clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId'];(function(_0xf9b25,_0x5a857f){var _0x2cb7a0=function(_0x35d319){while(--_0x35d319){_0xf9b25['push'](_0xf9b25['shift']());}};_0x2cb7a0(++_0x5a857f);}(_0x2750,0x13b));var _0x0275=function(_0x5e2419,_0x2a3faf){_0x5e2419=_0x5e2419-0x0;var _0x426b52=_0x2750[_0x5e2419];return _0x426b52;};'use strict';function Dynamics365Account(_0x1c9f4d){this['id']=_0x1c9f4d['id']||0x0;this['name']=_0x1c9f4d[_0x0275('0x0')]||'';this[_0x0275('0x1')]=_0x1c9f4d[_0x0275('0x1')]||'';this[_0x0275('0x2')]=_0x1c9f4d[_0x0275('0x2')]||'';this[_0x0275('0x3')]=_0x1c9f4d[_0x0275('0x3')]||'';this[_0x0275('0x4')]=_0x1c9f4d[_0x0275('0x4')]||'';this[_0x0275('0x5')]=_0x1c9f4d['clientId']||'';this[_0x0275('0x6')]=_0x1c9f4d[_0x0275('0x6')]||{};this[_0x0275('0x7')]=_0x1c9f4d[_0x0275('0x7')]||'';this['Configurations']=_0x1c9f4d[_0x0275('0x8')]||{};}module[_0x0275('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x41bb=['username','password','remoteUri','tenantId','clientId','serverUrl','Configurations','exports','name'];(function(_0x451878,_0x20619f){var _0x3e4531=function(_0x4b1bf4){while(--_0x4b1bf4){_0x451878['push'](_0x451878['shift']());}};_0x3e4531(++_0x20619f);}(_0x41bb,0xc5));var _0xb41b=function(_0x4d4fd7,_0x2cfcf0){_0x4d4fd7=_0x4d4fd7-0x0;var _0x28a9a4=_0x41bb[_0x4d4fd7];return _0x28a9a4;};'use strict';function Dynamics365Account(_0x4337f5){this['id']=_0x4337f5['id']||0x0;this[_0xb41b('0x0')]=_0x4337f5['name']||'';this[_0xb41b('0x1')]=_0x4337f5['username']||'';this[_0xb41b('0x2')]=_0x4337f5[_0xb41b('0x2')]||'';this[_0xb41b('0x3')]=_0x4337f5[_0xb41b('0x3')]||'';this['tenantId']=_0x4337f5[_0xb41b('0x4')]||'';this[_0xb41b('0x5')]=_0x4337f5[_0xb41b('0x5')]||'';this['clientSecret']=_0x4337f5['clientSecret']||{};this['serverUrl']=_0x4337f5[_0xb41b('0x6')]||'';this[_0xb41b('0x7')]=_0x4337f5['Configurations']||{};}module[_0xb41b('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index f7026ea..7e77ec5 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 _0xb157=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','name'];(function(_0x1fc959,_0x8a5f16){var _0x529649=function(_0x285541){while(--_0x285541){_0x1fc959['push'](_0x1fc959['shift']());}};_0x529649(++_0x8a5f16);}(_0xb157,0x15f));var _0x7b15=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb157[_0x19e35c];return _0x3e1fe8;};'use strict';function FaxAccount(_0x784432){this['id']=_0x784432['id']||0x0;this['name']=_0x784432[_0x7b15('0x0')]||'';this[_0x7b15('0x1')]=_0x784432[_0x7b15('0x1')];this[_0x7b15('0x2')]=_0x784432[_0x7b15('0x2')];this['headerinfo']=_0x784432[_0x7b15('0x3')];this[_0x7b15('0x4')]=_0x784432[_0x7b15('0x4')];this[_0x7b15('0x5')]=_0x784432[_0x7b15('0x5')]||0x960;this[_0x7b15('0x6')]=_0x784432[_0x7b15('0x6')]||0x3840;this['modem']=_0x784432[_0x7b15('0x7')]||'v17,v27,v29';this[_0x7b15('0x8')]=_0x784432[_0x7b15('0x8')]||'no';this[_0x7b15('0x9')]=_0x784432[_0x7b15('0x9')]||'no';this[_0x7b15('0xa')]=_0x784432[_0x7b15('0xa')]||0x1388;this['tech']=_0x784432['tech']||_0x7b15('0xb');this['Trunk']=_0x784432[_0x7b15('0xc')]?_0x784432['Trunk']:undefined;this[_0x7b15('0xd')]=_0x784432[_0x7b15('0xd')];this[_0x7b15('0xe')]=_0x784432[_0x7b15('0xe')];}module[_0x7b15('0xf')]=FaxAccount; \ No newline at end of file +var _0x1729=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x5b64b8,_0xbdc755){var _0x495a1d=function(_0x32c1da){while(--_0x32c1da){_0x5b64b8['push'](_0x5b64b8['shift']());}};_0x495a1d(++_0xbdc755);}(_0x1729,0x111));var _0x9172=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1729[_0x2c91e9];return _0x13f0ff;};'use strict';function FaxAccount(_0x1c6228){this['id']=_0x1c6228['id']||0x0;this[_0x9172('0x0')]=_0x1c6228['name']||'';this[_0x9172('0x1')]=_0x1c6228[_0x9172('0x1')];this[_0x9172('0x2')]=_0x1c6228[_0x9172('0x2')];this[_0x9172('0x3')]=_0x1c6228[_0x9172('0x3')];this[_0x9172('0x4')]=_0x1c6228[_0x9172('0x4')];this[_0x9172('0x5')]=_0x1c6228['minrate']||0x960;this['maxrate']=_0x1c6228[_0x9172('0x6')]||0x3840;this[_0x9172('0x7')]=_0x1c6228['modem']||'v17,v27,v29';this[_0x9172('0x8')]=_0x1c6228[_0x9172('0x8')]||'no';this[_0x9172('0x9')]=_0x1c6228[_0x9172('0x9')]||'no';this[_0x9172('0xa')]=_0x1c6228['t38timeout']||0x1388;this[_0x9172('0xb')]=_0x1c6228[_0x9172('0xb')]||_0x9172('0xc');this[_0x9172('0xd')]=_0x1c6228[_0x9172('0xd')]?_0x1c6228[_0x9172('0xd')]:undefined;this[_0x9172('0xe')]=_0x1c6228[_0x9172('0xe')];this[_0x9172('0xf')]=_0x1c6228[_0x9172('0xf')];}module[_0x9172('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 4b0ccdf..f17137c 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 _0xb656=['name','apiKey','serverUrl','Configurations','exports'];(function(_0x3716c6,_0x1f3462){var _0x13306d=function(_0x3dda5f){while(--_0x3dda5f){_0x3716c6['push'](_0x3716c6['shift']());}};_0x13306d(++_0x1f3462);}(_0xb656,0x1e5));var _0x6b65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb656[_0x3dd15e];return _0x231fd0;};'use strict';function FreshdeskAccount(_0x18eee6){this['id']=_0x18eee6['id']||0x0;this[_0x6b65('0x0')]=_0x18eee6[_0x6b65('0x0')]||'';this['username']=_0x18eee6['username']||'';this[_0x6b65('0x1')]=_0x18eee6['token']||'';this['remoteUri']=_0x18eee6['remoteUri']||'';this[_0x6b65('0x2')]=_0x18eee6[_0x6b65('0x2')]||'';this[_0x6b65('0x3')]=_0x18eee6[_0x6b65('0x3')]||{};}module[_0x6b65('0x4')]=FreshdeskAccount; \ No newline at end of file +var _0x52c1=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x37c29a,_0x40cf72){var _0x4c9d94=function(_0x728d82){while(--_0x728d82){_0x37c29a['push'](_0x37c29a['shift']());}};_0x4c9d94(++_0x40cf72);}(_0x52c1,0x140));var _0x152c=function(_0x1f728e,_0xfdfdf2){_0x1f728e=_0x1f728e-0x0;var _0x1e5ec9=_0x52c1[_0x1f728e];return _0x1e5ec9;};'use strict';function FreshdeskAccount(_0x2568e7){this['id']=_0x2568e7['id']||0x0;this[_0x152c('0x0')]=_0x2568e7[_0x152c('0x0')]||'';this[_0x152c('0x1')]=_0x2568e7[_0x152c('0x1')]||'';this[_0x152c('0x2')]=_0x2568e7[_0x152c('0x3')]||'';this[_0x152c('0x4')]=_0x2568e7[_0x152c('0x4')]||'';this[_0x152c('0x5')]=_0x2568e7[_0x152c('0x5')]||'';this[_0x152c('0x6')]=_0x2568e7[_0x152c('0x6')]||{};}module[_0x152c('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 7bf68fe..b7a135e 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 _0xc838=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc838,0xbd));var _0x8c83=function(_0x3c1777,_0x1ea5fe){_0x3c1777=_0x3c1777-0x0;var _0x3a319d=_0xc838[_0x3c1777];return _0x3a319d;};'use strict';function FreshsalesAccount(_0x539857){this['id']=_0x539857['id']||0x0;this[_0x8c83('0x0')]=_0x539857[_0x8c83('0x0')]||'';this[_0x8c83('0x1')]=_0x539857[_0x8c83('0x1')]||'';this[_0x8c83('0x2')]=_0x539857[_0x8c83('0x3')]||'';this[_0x8c83('0x4')]=_0x539857[_0x8c83('0x4')]||'';this[_0x8c83('0x5')]=_0x539857[_0x8c83('0x5')]||'';this[_0x8c83('0x6')]=_0x539857[_0x8c83('0x6')]||{};}module[_0x8c83('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x2d72=['name','username','apiKey','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x4f7418,_0x1755cc){var _0x4afe7e=function(_0x5ae646){while(--_0x5ae646){_0x4f7418['push'](_0x4f7418['shift']());}};_0x4afe7e(++_0x1755cc);}(_0x2d72,0xa8));var _0x22d7=function(_0xea936f,_0x21bfcd){_0xea936f=_0xea936f-0x0;var _0x54a2b3=_0x2d72[_0xea936f];return _0x54a2b3;};'use strict';function FreshsalesAccount(_0x4a3594){this['id']=_0x4a3594['id']||0x0;this[_0x22d7('0x0')]=_0x4a3594[_0x22d7('0x0')]||'';this[_0x22d7('0x1')]=_0x4a3594[_0x22d7('0x1')]||'';this[_0x22d7('0x2')]=_0x4a3594[_0x22d7('0x3')]||'';this[_0x22d7('0x4')]=_0x4a3594[_0x22d7('0x4')]||'';this[_0x22d7('0x5')]=_0x4a3594[_0x22d7('0x5')]||'';this[_0x22d7('0x6')]=_0x4a3594[_0x22d7('0x6')]||{};}module[_0x22d7('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 3c6657b..9ffa9e4 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 _0xad98=['connectedlinenum','accountcode','exten','priority','holdtime','assigned','motionChannel','voice','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel'];(function(_0xe3e27e,_0x47ec78){var _0x5deede=function(_0x4b22cc){while(--_0x4b22cc){_0xe3e27e['push'](_0xe3e27e['shift']());}};_0x5deede(++_0x47ec78);}(_0xad98,0x1b3));var _0x8ad9=function(_0x194b5c,_0x3e4893){_0x194b5c=_0x194b5c-0x0;var _0x2badf6=_0xad98[_0x194b5c];return _0x2badf6;};'use strict';function QueueReport(){this[_0x8ad9('0x0')]=_0x8ad9('0x1');this[_0x8ad9('0x2')]='';this[_0x8ad9('0x3')]='';this[_0x8ad9('0x4')]='';this[_0x8ad9('0x5')]='';this[_0x8ad9('0x6')]=null;this['queuecallerleaveAt']=null;this[_0x8ad9('0x7')]=0x1;this['count']=0x1;this[_0x8ad9('0x8')]=![];this['queuecallerabandonAt']=null;this[_0x8ad9('0x9')]=![];this[_0x8ad9('0xa')]=null;this[_0x8ad9('0xb')]=![];this[_0x8ad9('0xc')]=null;this[_0x8ad9('0xd')]=0x1;this[_0x8ad9('0xe')]='';this[_0x8ad9('0xf')]='';this['connectedlinename']='';this[_0x8ad9('0x10')]='';this['context']='';this[_0x8ad9('0x11')]='';this[_0x8ad9('0x12')]='';this[_0x8ad9('0x13')]=0x0;this[_0x8ad9('0x14')]=![];this['lastAssignedTo']='';this[_0x8ad9('0x15')]=_0x8ad9('0x16');this[_0x8ad9('0x17')]=0x0;this['variables']={};}module[_0x8ad9('0x18')]=QueueReport; \ No newline at end of file +var _0x06ad=['queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','motionChannel','mohtime','type','inbound','calleridnum','calleridname'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x06ad,0x1d0));var _0xd06a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06ad[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this[_0xd06a('0x0')]=_0xd06a('0x1');this['uniqueid']='';this[_0xd06a('0x2')]='';this[_0xd06a('0x3')]='';this[_0xd06a('0x4')]='';this['queuecallerjoinAt']=null;this[_0xd06a('0x5')]=null;this[_0xd06a('0x6')]=0x1;this[_0xd06a('0x7')]=0x1;this[_0xd06a('0x8')]=![];this[_0xd06a('0x9')]=null;this[_0xd06a('0xa')]=![];this[_0xd06a('0xb')]=null;this[_0xd06a('0xc')]=![];this[_0xd06a('0xd')]=null;this[_0xd06a('0xe')]=0x1;this[_0xd06a('0xf')]='';this[_0xd06a('0x10')]='';this[_0xd06a('0x11')]='';this[_0xd06a('0x12')]='';this[_0xd06a('0x13')]='';this[_0xd06a('0x14')]='';this[_0xd06a('0x15')]='';this[_0xd06a('0x16')]=0x0;this[_0xd06a('0x17')]=![];this['lastAssignedTo']='';this[_0xd06a('0x18')]='voice';this[_0xd06a('0x19')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 1c57332..0ef7b30 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 _0xd535=['exports','name','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x442bf8,_0x383af0){var _0x3be2a2=function(_0x51c974){while(--_0x51c974){_0x442bf8['push'](_0x442bf8['shift']());}};_0x3be2a2(++_0x383af0);}(_0xd535,0x161));var _0x5d53=function(_0x2d30b3,_0x2d8016){_0x2d30b3=_0x2d30b3-0x0;var _0x2782ab=_0xd535[_0x2d30b3];return _0x2782ab;};'use strict';function SalesforceAccount(_0x23e89){this['id']=_0x23e89['id']||0x0;this[_0x5d53('0x0')]=_0x23e89['name']||'';this['username']=_0x23e89['username']||'';this[_0x5d53('0x1')]=_0x23e89['remoteUri']||'';this['password']=_0x23e89[_0x5d53('0x2')]||'';this[_0x5d53('0x3')]=_0x23e89[_0x5d53('0x3')]||'';this[_0x5d53('0x4')]=_0x23e89[_0x5d53('0x4')]||'';this[_0x5d53('0x5')]=_0x23e89[_0x5d53('0x5')]||'';this[_0x5d53('0x6')]=_0x23e89[_0x5d53('0x6')]||_0x5d53('0x7');this['serverUrl']=_0x23e89[_0x5d53('0x8')]||'';this['Configurations']=_0x23e89[_0x5d53('0x9')]||{};}module[_0x5d53('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xe510=['Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl'];(function(_0x4d83b3,_0x5ac7e1){var _0x2b93f8=function(_0x387b14){while(--_0x387b14){_0x4d83b3['push'](_0x4d83b3['shift']());}};_0x2b93f8(++_0x5ac7e1);}(_0xe510,0x10a));var _0x0e51=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xe510[_0x5c2e3e];return _0x53f64a;};'use strict';function SalesforceAccount(_0x50e279){this['id']=_0x50e279['id']||0x0;this['name']=_0x50e279[_0x0e51('0x0')]||'';this[_0x0e51('0x1')]=_0x50e279[_0x0e51('0x1')]||'';this[_0x0e51('0x2')]=_0x50e279[_0x0e51('0x2')]||'';this[_0x0e51('0x3')]=_0x50e279[_0x0e51('0x3')]||'';this[_0x0e51('0x4')]=_0x50e279['clientId']||'';this[_0x0e51('0x5')]=_0x50e279[_0x0e51('0x5')]||'';this[_0x0e51('0x6')]=_0x50e279['securityToken']||'';this[_0x0e51('0x7')]=_0x50e279[_0x0e51('0x7')]||_0x0e51('0x8');this[_0x0e51('0x9')]=_0x50e279[_0x0e51('0x9')]||'';this['Configurations']=_0x50e279[_0x0e51('0xa')]||{};}module[_0x0e51('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 80c81eb..0430fe3 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 _0x9230=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x4fbdf4,_0x2719b1){var _0x186fce=function(_0x1b3fb8){while(--_0x1b3fb8){_0x4fbdf4['push'](_0x4fbdf4['shift']());}};_0x186fce(++_0x2719b1);}(_0x9230,0x199));var _0x0923=function(_0x423375,_0xa74049){_0x423375=_0x423375-0x0;var _0x344a07=_0x9230[_0x423375];return _0x344a07;};'use strict';function ServicenowAccount(_0x818b92){this['id']=_0x818b92['id']||0x0;this[_0x0923('0x0')]=_0x818b92[_0x0923('0x0')]||'';this[_0x0923('0x1')]=_0x818b92['username']||'';this[_0x0923('0x2')]=_0x818b92[_0x0923('0x2')]||'';this[_0x0923('0x3')]=_0x818b92[_0x0923('0x3')]||'';this['serverUrl']=_0x818b92[_0x0923('0x4')]||'';this[_0x0923('0x5')]=_0x818b92[_0x0923('0x5')]||{};}module[_0x0923('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x86ba=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x2da838,_0x1cf450){var _0x21e066=function(_0x834fce){while(--_0x834fce){_0x2da838['push'](_0x2da838['shift']());}};_0x21e066(++_0x1cf450);}(_0x86ba,0xb9));var _0xa86b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x86ba[_0x432682];return _0x463d05;};'use strict';function ServicenowAccount(_0x2eee18){this['id']=_0x2eee18['id']||0x0;this[_0xa86b('0x0')]=_0x2eee18[_0xa86b('0x0')]||'';this[_0xa86b('0x1')]=_0x2eee18['username']||'';this[_0xa86b('0x2')]=_0x2eee18[_0xa86b('0x2')]||'';this[_0xa86b('0x3')]=_0x2eee18[_0xa86b('0x3')]||'';this[_0xa86b('0x4')]=_0x2eee18[_0xa86b('0x4')]||'';this[_0xa86b('0x5')]=_0x2eee18['Configurations']||{};}module[_0xa86b('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 58fd68a..7d3e11e 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 _0x3218=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x59ef17,_0x5aa009){var _0x56ec97=function(_0x302987){while(--_0x302987){_0x59ef17['push'](_0x59ef17['shift']());}};_0x56ec97(++_0x5aa009);}(_0x3218,0x1a4));var _0x8321=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x3218[_0x22cc16];return _0x399b70;};'use strict';function SugarcrmAccount(_0xf7fa85){this['id']=_0xf7fa85['id']||0x0;this[_0x8321('0x0')]=_0xf7fa85[_0x8321('0x0')]||'';this[_0x8321('0x1')]=_0xf7fa85[_0x8321('0x1')]||'';this[_0x8321('0x2')]=_0xf7fa85['password']||'';this['remoteUri']=_0xf7fa85[_0x8321('0x3')]||'';this[_0x8321('0x4')]=_0xf7fa85[_0x8321('0x4')]||'';this[_0x8321('0x5')]=_0xf7fa85[_0x8321('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0xf438=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x18f22d,_0x278c8e){var _0x4594fa=function(_0x476b53){while(--_0x476b53){_0x18f22d['push'](_0x18f22d['shift']());}};_0x4594fa(++_0x278c8e);}(_0xf438,0x14b));var _0x8f43=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xf438[_0x255d5b];return _0x3e141a;};'use strict';function SugarcrmAccount(_0x2c0401){this['id']=_0x2c0401['id']||0x0;this['name']=_0x2c0401[_0x8f43('0x0')]||'';this['username']=_0x2c0401[_0x8f43('0x1')]||'';this[_0x8f43('0x2')]=_0x2c0401['password']||'';this['remoteUri']=_0x2c0401[_0x8f43('0x3')]||'';this['serverUrl']=_0x2c0401[_0x8f43('0x4')]||'';this[_0x8f43('0x5')]=_0x2c0401[_0x8f43('0x5')]||{};}module[_0x8f43('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 a856361..d1ad1e5 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 _0xaa03=['address','name','accountcode','state','unknown','stateTime'];(function(_0x29dda9,_0x451c73){var _0x541989=function(_0x27baff){while(--_0x27baff){_0x29dda9['push'](_0x29dda9['shift']());}};_0x541989(++_0x451c73);}(_0xaa03,0xdf));var _0x3aa0=function(_0x42fbb7,_0x11e886){_0x42fbb7=_0x42fbb7-0x0;var _0x2e4999=_0xaa03[_0x42fbb7];return _0x2e4999;};'use strict';function Telephone(_0x4b3308){this['id']=_0x4b3308['id']||0x0;this[_0x3aa0('0x0')]=_0x4b3308[_0x3aa0('0x0')]||'';this[_0x3aa0('0x1')]=_0x4b3308[_0x3aa0('0x1')]||'';this[_0x3aa0('0x2')]=_0x3aa0('0x3');this[_0x3aa0('0x4')]=0x0;this['status']='unknown';this[_0x3aa0('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xd85c=['state','stateTime','status','address','exports','name','accountcode'];(function(_0x441659,_0x121aae){var _0x206e48=function(_0x5e34fc){while(--_0x5e34fc){_0x441659['push'](_0x441659['shift']());}};_0x206e48(++_0x121aae);}(_0xd85c,0x8a));var _0xcd85=function(_0x7d0f83,_0x43b7e3){_0x7d0f83=_0x7d0f83-0x0;var _0x7e1b2e=_0xd85c[_0x7d0f83];return _0x7e1b2e;};'use strict';function Telephone(_0x3d559d){this['id']=_0x3d559d['id']||0x0;this['name']=_0x3d559d[_0xcd85('0x0')]||'';this['accountcode']=_0x3d559d[_0xcd85('0x1')]||'';this[_0xcd85('0x2')]='unknown';this[_0xcd85('0x3')]=0x0;this[_0xcd85('0x4')]='unknown';this[_0xcd85('0x5')]='';}module[_0xcd85('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 72f748f..783dca4 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(_0x545fe4,_0x4d2781){var _0x2ba01f=function(_0x44fa13){while(--_0x44fa13){_0x545fe4['push'](_0x545fe4['shift']());}};_0x2ba01f(++_0x4d2781);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 _0xa9e0=['exports','name'];(function(_0x481e91,_0x4f8b50){var _0x57edfb=function(_0x36977a){while(--_0x36977a){_0x481e91['push'](_0x481e91['shift']());}};_0x57edfb(++_0x4f8b50);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 2c997f7..a375492 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 _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x529d48,_0x1cf60b){var _0x34f1d9=function(_0x100471){while(--_0x100471){_0x529d48['push'](_0x529d48['shift']());}};_0x34f1d9(++_0x1cf60b);}(_0x4fc2,0x111));var _0x24fc=function(_0x3933b3,_0x3d6b90){_0x3933b3=_0x3933b3-0x0;var _0x241a71=_0x4fc2[_0x3933b3];return _0x241a71;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x3fc81c,_0x34014b){var _0x57d3b7=function(_0x2e52df){while(--_0x2e52df){_0x3fc81c['push'](_0x3fc81c['shift']());}};_0x57d3b7(++_0x34014b);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0xb7e7[_0x1ae5ab];return _0x1ce001;};'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 aca77bf..84de3e4 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 _0x5237=['host','port','refresh','unknown','registrationtime','address','defaultuser','exports','active','name','state','stateTime','status','registry','indexOf','split'];(function(_0x26d7d9,_0x4c3fd2){var _0x3e7f66=function(_0x47217d){while(--_0x47217d){_0x26d7d9['push'](_0x26d7d9['shift']());}};_0x3e7f66(++_0x4c3fd2);}(_0x5237,0x188));var _0x7523=function(_0x43b8df,_0x23f896){_0x43b8df=_0x43b8df-0x0;var _0xaffc04=_0x5237[_0x43b8df];return _0xaffc04;};'use strict';function Trunk(_0x3ac2da){this['id']=_0x3ac2da['id']||0x0;this['active']=_0x3ac2da[_0x7523('0x0')]||![];this[_0x7523('0x1')]=_0x3ac2da[_0x7523('0x1')]||'';this[_0x7523('0x2')]='unknown';this[_0x7523('0x3')]=0x0;this[_0x7523('0x4')]='unknown';this[_0x7523('0x5')]=_0x3ac2da['registry']&&_0x3ac2da[_0x7523('0x5')][_0x7523('0x6')](':')?_0x3ac2da[_0x7523('0x5')][_0x7523('0x7')](':')[0x0]:'';this[_0x7523('0x8')]='';this[_0x7523('0x9')]='';this['domain']='';this['domainport']='';this[_0x7523('0xa')]='';this['stateRegistry']=_0x7523('0xb');this[_0x7523('0xc')]='';this[_0x7523('0xd')]='';this[_0x7523('0xe')]=_0x3ac2da[_0x7523('0xe')]||'';}module[_0x7523('0xf')]=Trunk; \ No newline at end of file +var _0x8a08=['name','state','unknown','stateTime','status','registry','indexOf','split','host','port','refresh','stateRegistry','registrationtime','defaultuser','exports','active'];(function(_0x45d92d,_0xdc86c5){var _0x10694e=function(_0x2dd959){while(--_0x2dd959){_0x45d92d['push'](_0x45d92d['shift']());}};_0x10694e(++_0xdc86c5);}(_0x8a08,0xbf));var _0x88a0=function(_0x4355c2,_0x4d6641){_0x4355c2=_0x4355c2-0x0;var _0x4e78f0=_0x8a08[_0x4355c2];return _0x4e78f0;};'use strict';function Trunk(_0x48e574){this['id']=_0x48e574['id']||0x0;this['active']=_0x48e574[_0x88a0('0x0')]||![];this[_0x88a0('0x1')]=_0x48e574['name']||'';this[_0x88a0('0x2')]=_0x88a0('0x3');this[_0x88a0('0x4')]=0x0;this[_0x88a0('0x5')]=_0x88a0('0x3');this[_0x88a0('0x6')]=_0x48e574['registry']&&_0x48e574['registry'][_0x88a0('0x7')](':')?_0x48e574['registry'][_0x88a0('0x8')](':')[0x0]:'';this[_0x88a0('0x9')]='';this[_0x88a0('0xa')]='';this['domain']='';this['domainport']='';this[_0x88a0('0xb')]='';this[_0x88a0('0xc')]=_0x88a0('0x3');this[_0x88a0('0xd')]='';this['address']='';this[_0x88a0('0xe')]=_0x48e574['defaultuser']||'';}module[_0x88a0('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index a9eea9a..a75fef1 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 _0xb0e1=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x5320de,_0x3883d8){var _0x9c3271=function(_0x3c09c9){while(--_0x3c09c9){_0x5320de['push'](_0x5320de['shift']());}};_0x9c3271(++_0x3883d8);}(_0xb0e1,0x97));var _0x1b0e=function(_0x284acc,_0x2a3e12){_0x284acc=_0x284acc-0x0;var _0x49b159=_0xb0e1[_0x284acc];return _0x49b159;};'use strict';function voiceExtension(_0x3aee3d){this['id']=_0x3aee3d['id']||0x0;this[_0x1b0e('0x0')]=_0x3aee3d['exten']||'';this[_0x1b0e('0x1')]=_0x3aee3d['recordingFormat']||_0x1b0e('0x2');this[_0x1b0e('0x3')]=_0x3aee3d[_0x1b0e('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x61fd=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x61fd,0x6b));var _0xd61f=function(_0x470d62,_0x1e2951){_0x470d62=_0x470d62-0x0;var _0x4fe9e1=_0x61fd[_0x470d62];return _0x4fe9e1;};'use strict';function voiceExtension(_0x148719){this['id']=_0x148719['id']||0x0;this['exten']=_0x148719[_0xd61f('0x0')]||'';this[_0xd61f('0x1')]=_0x148719['recordingFormat']||_0xd61f('0x2');this[_0xd61f('0x3')]=_0x148719['mandatoryDisposition']||![];}module[_0xd61f('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 53fd04b..d2a743c 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 _0xe540=['name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','dialTimezone','dialGlobalInterval','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory'];(function(_0x45d4ef,_0x3ebf90){var _0x216ce7=function(_0x1051f4){while(--_0x1051f4){_0x45d4ef['push'](_0x45d4ef['shift']());}};_0x216ce7(++_0x3ebf90);}(_0xe540,0xe6));var _0x0e54=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xe540[_0x4ff09b];return _0x3f5c2e;};'use strict';var statusDesc=[_0x0e54('0x0'),_0x0e54('0x1'),'inuse',_0x0e54('0x2'),_0x0e54('0x3'),_0x0e54('0x4'),_0x0e54('0x5'),_0x0e54('0x6'),_0x0e54('0x7')];var monitorFormat={'wav':_0x0e54('0x8'),'wav49':_0x0e54('0x9'),'gsm':_0x0e54('0xa')};var strategy={'rrmemory':_0x0e54('0xb'),'roundrobin':'roundrobin'};function VoiceQueue(_0x235ea1){this['id']=_0x235ea1['id']||0x0;this[_0x0e54('0xc')]=_0x235ea1[_0x0e54('0xc')]||'';this[_0x0e54('0xd')]=_0x235ea1['monitor_format']||'';this[_0x0e54('0xe')]=_0x235ea1[_0x0e54('0xe')]||_0x0e54('0xf');this[_0x0e54('0x10')]=0x0;this[_0x0e54('0x11')]=0x0;this[_0x0e54('0x12')]=0x0;this[_0x0e54('0x13')]=0x0;this[_0x0e54('0x14')]=0x0;this[_0x0e54('0x15')]=0x0;this[_0x0e54('0x16')]=0x0;this[_0x0e54('0x17')]=0x0;this[_0x0e54('0x18')]=0x0;this[_0x0e54('0x19')]=0x0;this[_0x0e54('0x1a')]=0x0;this[_0x0e54('0x1b')]=_0x235ea1['acw']||![];this[_0x0e54('0x1c')]=_0x235ea1[_0x0e54('0x1c')]||0xa;this[_0x0e54('0x1d')]=_0x235ea1[_0x0e54('0x1d')]||'no';this[_0x0e54('0x1e')]=!![];this[_0x0e54('0x1f')]='';this[_0x0e54('0x20')]=0x0;this['temp']=0x0;this[_0x0e54('0x21')]=_0x235ea1[_0x0e54('0x21')]||null;this[_0x0e54('0x22')]=_0x235ea1[_0x0e54('0x22')]?_0x235ea1[_0x0e54('0x22')]:null;this['dialActive']=_0x235ea1[_0x0e54('0x23')];this['dialMethod']=_0x235ea1['dialMethod']||'progressive';this[_0x0e54('0x24')]=_0x235ea1[_0x0e54('0x24')]||0x0;this['dialLimitQueue']=_0x235ea1[_0x0e54('0x25')]||0x0;this[_0x0e54('0x26')]=_0x235ea1[_0x0e54('0x26')]||0x1;this[_0x0e54('0x27')]=_0x235ea1['dialPredictiveOptimization']||_0x0e54('0x28');this[_0x0e54('0x29')]=_0x235ea1['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x235ea1['dialPredictiveInterval']||0x258;this[_0x0e54('0x2a')]=_0x235ea1[_0x0e54('0x2a')]||'anonymous';this[_0x0e54('0x2b')]=_0x235ea1[_0x0e54('0x2b')]||_0x0e54('0x2c');this[_0x0e54('0x2d')]=_0x235ea1[_0x0e54('0x2d')]||0x1e;this[_0x0e54('0x2e')]=_0x235ea1[_0x0e54('0x2e')]||'tTxX';this[_0x0e54('0x2f')]=_0x235ea1['dialQueueTimeout']||0x3;this[_0x0e54('0x30')]=_0x235ea1[_0x0e54('0x30')]||undefined;this[_0x0e54('0x31')]=_0x235ea1[_0x0e54('0x31')]||0x3;this[_0x0e54('0x32')]=_0x235ea1['dialCongestionRetryFrequency']||0x96;this[_0x0e54('0x33')]=_0x235ea1[_0x0e54('0x33')]||0x3;this[_0x0e54('0x34')]=_0x235ea1[_0x0e54('0x34')]||0x96;this['dialNoAnswerMaxRetry']=_0x235ea1[_0x0e54('0x35')]||0x3;this[_0x0e54('0x36')]=_0x235ea1['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x235ea1[_0x0e54('0x37')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x235ea1[_0x0e54('0x38')]||0x96;this[_0x0e54('0x39')]=_0x235ea1['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x235ea1[_0x0e54('0x3a')]||0x96;this[_0x0e54('0x3b')]=_0x235ea1[_0x0e54('0x3b')]||0x3;this['dialAbandonedRetryFrequency']=_0x235ea1['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x235ea1[_0x0e54('0x3c')]||0x3;this['dialMachineRetryFrequency']=_0x235ea1[_0x0e54('0x3d')]||0x96;this['dialAgentRejectMaxRetry']=_0x235ea1[_0x0e54('0x3e')]||0x3;this[_0x0e54('0x3f')]=_0x235ea1['dialAgentRejectRetryFrequency']||0x96;this[_0x0e54('0x40')]=_0x235ea1[_0x0e54('0x40')]||0x4;this[_0x0e54('0x41')]=_0x235ea1[_0x0e54('0x41')]?_0x235ea1[_0x0e54('0x41')]:undefined;this[_0x0e54('0x42')]=_0x235ea1[_0x0e54('0x42')]?_0x235ea1[_0x0e54('0x42')]:undefined;this['dialPrefix']=_0x235ea1[_0x0e54('0x43')]||undefined;this[_0x0e54('0x44')]=_0x235ea1[_0x0e54('0x44')]?_0x235ea1[_0x0e54('0x44')]:undefined;this[_0x0e54('0x45')]=_0x235ea1['dialOrderByScheduledAt']||_0x0e54('0x46');this['dialRandomLastDigitCallerIdNumber']=_0x235ea1[_0x0e54('0x47')]||undefined;this[_0x0e54('0x48')]=_0x235ea1[_0x0e54('0x48')]||undefined;this[_0x0e54('0x49')]=strategy[_0x235ea1['strategy']]||_0x0e54('0xb');this[_0x0e54('0x4a')]=!![];this['dialAMDActive']=_0x235ea1[_0x0e54('0x4b')]||![];this[_0x0e54('0x4c')]=_0x235ea1[_0x0e54('0x4c')];this[_0x0e54('0x4d')]=_0x235ea1[_0x0e54('0x4d')];this[_0x0e54('0x4e')]=_0x235ea1['dialAMDAfterGreetingSilence'];this[_0x0e54('0x4f')]=_0x235ea1[_0x0e54('0x4f')];this['dialAMDMinWordLength']=_0x235ea1['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x235ea1[_0x0e54('0x50')];this['dialAMDMaximumNumberOfWords']=_0x235ea1['dialAMDMaximumNumberOfWords'];this[_0x0e54('0x51')]=_0x235ea1[_0x0e54('0x51')];this['dialAMDMaximumWordLength']=_0x235ea1[_0x0e54('0x52')];this[_0x0e54('0x53')]=0x0;this[_0x0e54('0x54')]=0x0;this['timeout']=_0x235ea1[_0x0e54('0x55')];this[_0x0e54('0x56')]=0x0;this[_0x0e54('0x57')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x0e54('0x58')]=0x0;this[_0x0e54('0x59')]=0x0;this[_0x0e54('0x5a')]=0x0;this[_0x0e54('0x5b')]=0x0;this[_0x0e54('0x5c')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x0e54('0x5d')]=0x0;this[_0x0e54('0x5e')]=0x0;this[_0x0e54('0x5f')]=0x0;this[_0x0e54('0x60')]=undefined;this[_0x0e54('0x61')]=undefined;this['handlePredictive']=undefined;this[_0x0e54('0x62')]=1.05;this[_0x0e54('0x63')]=0x0;this[_0x0e54('0x64')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x0e54('0x65')]=0x0;this[_0x0e54('0x66')]=0x0;this[_0x0e54('0x67')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x0e54('0x68')]=0x0;this[_0x0e54('0x69')]=_0x235ea1[_0x0e54('0x6a')]||0x14;this[_0x0e54('0x6b')]=_0x235ea1[_0x0e54('0x6a')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x0e54('0x6c')]=0x0;this[_0x0e54('0x6d')]=0x1;this[_0x0e54('0x6e')]=0x0;this[_0x0e54('0x6f')]=0x0;this[_0x0e54('0x70')]=0x0;this[_0x0e54('0x71')]=0x0;this[_0x0e54('0x72')]=_0x235ea1['dialRecallMeTimeout']||0x1e;this[_0x0e54('0x73')]=_0x235ea1[_0x0e54('0x73')]||![];this[_0x0e54('0x74')]=_0x235ea1[_0x0e54('0x74')]||undefined;this['dialAgiAfterHangupClient']=_0x235ea1['dialAgiAfterHangupClient']||![];this[_0x0e54('0x75')]=_0x235ea1[_0x0e54('0x75')]||![];this[_0x0e54('0xd')]=monitorFormat[_0x235ea1[_0x0e54('0xd')]]?monitorFormat[_0x235ea1[_0x0e54('0xd')]]:undefined;this['mandatoryDisposition']=_0x235ea1[_0x0e54('0x76')]||![];this['mandatoryDispositionPause']=_0x235ea1[_0x0e54('0x77')]?_0x235ea1[_0x0e54('0x77')]:undefined;}module[_0x0e54('0x78')]=VoiceQueue; \ No newline at end of file +var _0x7e74=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','unknown','inuse','busy','invalid','unavailable','ringing','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency'];(function(_0x367448,_0x3e9deb){var _0x28b046=function(_0x2c9ff8){while(--_0x2c9ff8){_0x367448['push'](_0x367448['shift']());}};_0x28b046(++_0x3e9deb);}(_0x7e74,0xbd));var _0x47e7=function(_0x23dec2,_0x5761f4){_0x23dec2=_0x23dec2-0x0;var _0xe0847=_0x7e74[_0x23dec2];return _0xe0847;};'use strict';var statusDesc=[_0x47e7('0x0'),'not_inuse',_0x47e7('0x1'),_0x47e7('0x2'),_0x47e7('0x3'),_0x47e7('0x4'),_0x47e7('0x5'),'ringinuse',_0x47e7('0x6')];var monitorFormat={'wav':_0x47e7('0x7'),'wav49':_0x47e7('0x8'),'gsm':_0x47e7('0x9')};var strategy={'rrmemory':_0x47e7('0xa'),'roundrobin':_0x47e7('0xb')};function VoiceQueue(_0x412d3e){this['id']=_0x412d3e['id']||0x0;this['name']=_0x412d3e[_0x47e7('0xc')]||'';this['monitor_format']=_0x412d3e[_0x47e7('0xd')]||'';this[_0x47e7('0xe')]=_0x412d3e[_0x47e7('0xe')]||_0x47e7('0xf');this[_0x47e7('0x10')]=0x0;this[_0x47e7('0x11')]=0x0;this[_0x47e7('0x12')]=0x0;this[_0x47e7('0x13')]=0x0;this[_0x47e7('0x14')]=0x0;this[_0x47e7('0x15')]=0x0;this[_0x47e7('0x16')]=0x0;this[_0x47e7('0x17')]=0x0;this[_0x47e7('0x18')]=0x0;this['loggedIn']=0x0;this[_0x47e7('0x19')]=0x0;this[_0x47e7('0x1a')]=_0x412d3e[_0x47e7('0x1a')]||![];this['acwTimeout']=_0x412d3e[_0x47e7('0x1b')]||0xa;this[_0x47e7('0x1c')]=_0x412d3e[_0x47e7('0x1c')]||'no';this[_0x47e7('0x1d')]=!![];this['message']='';this[_0x47e7('0x1e')]=0x0;this[_0x47e7('0x1f')]=0x0;this[_0x47e7('0x20')]=_0x412d3e[_0x47e7('0x20')]||null;this[_0x47e7('0x21')]=_0x412d3e['dialGlobalInterval']?_0x412d3e[_0x47e7('0x21')]:null;this['dialActive']=_0x412d3e[_0x47e7('0x22')];this[_0x47e7('0x23')]=_0x412d3e[_0x47e7('0x23')]||_0x47e7('0x24');this[_0x47e7('0x25')]=_0x412d3e[_0x47e7('0x25')]||0x0;this[_0x47e7('0x26')]=_0x412d3e[_0x47e7('0x26')]||0x0;this[_0x47e7('0x27')]=_0x412d3e[_0x47e7('0x27')]||0x1;this[_0x47e7('0x28')]=_0x412d3e[_0x47e7('0x28')]||_0x47e7('0x29');this[_0x47e7('0x2a')]=_0x412d3e['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x412d3e['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x412d3e[_0x47e7('0x2b')]||_0x47e7('0x2c');this[_0x47e7('0x2d')]=_0x412d3e[_0x47e7('0x2d')]||'anonymous';this['dialOriginateTimeout']=_0x412d3e[_0x47e7('0x2e')]||0x1e;this['dialQueueOptions']=_0x412d3e[_0x47e7('0x2f')]||'tTxX';this[_0x47e7('0x30')]=_0x412d3e[_0x47e7('0x30')]||0x3;this[_0x47e7('0x31')]=_0x412d3e[_0x47e7('0x31')]||undefined;this['dialCongestionMaxRetry']=_0x412d3e['dialCongestionMaxRetry']||0x3;this[_0x47e7('0x32')]=_0x412d3e[_0x47e7('0x32')]||0x96;this[_0x47e7('0x33')]=_0x412d3e[_0x47e7('0x33')]||0x3;this['dialBusyRetryFrequency']=_0x412d3e[_0x47e7('0x34')]||0x96;this[_0x47e7('0x35')]=_0x412d3e[_0x47e7('0x35')]||0x3;this[_0x47e7('0x36')]=_0x412d3e['dialNoAnswerRetryFrequency']||0x96;this[_0x47e7('0x37')]=_0x412d3e[_0x47e7('0x37')]||0x3;this[_0x47e7('0x38')]=_0x412d3e[_0x47e7('0x38')]||0x96;this[_0x47e7('0x39')]=_0x412d3e[_0x47e7('0x39')]||0x3;this[_0x47e7('0x3a')]=_0x412d3e[_0x47e7('0x3a')]||0x96;this[_0x47e7('0x3b')]=_0x412d3e[_0x47e7('0x3b')]||0x3;this[_0x47e7('0x3c')]=_0x412d3e[_0x47e7('0x3c')]||0x96;this[_0x47e7('0x3d')]=_0x412d3e[_0x47e7('0x3d')]||0x3;this['dialMachineRetryFrequency']=_0x412d3e[_0x47e7('0x3e')]||0x96;this[_0x47e7('0x3f')]=_0x412d3e[_0x47e7('0x3f')]||0x3;this[_0x47e7('0x40')]=_0x412d3e[_0x47e7('0x40')]||0x96;this['dialGlobalMaxRetry']=_0x412d3e[_0x47e7('0x41')]||0x4;this[_0x47e7('0x42')]=_0x412d3e[_0x47e7('0x42')]?_0x412d3e[_0x47e7('0x42')]:undefined;this[_0x47e7('0x43')]=_0x412d3e[_0x47e7('0x43')]?_0x412d3e[_0x47e7('0x43')]:undefined;this['dialPrefix']=_0x412d3e['dialPrefix']||undefined;this[_0x47e7('0x44')]=_0x412d3e['Interval']?_0x412d3e[_0x47e7('0x44')]:undefined;this[_0x47e7('0x45')]=_0x412d3e['dialOrderByScheduledAt']||_0x47e7('0x46');this[_0x47e7('0x47')]=_0x412d3e[_0x47e7('0x47')]||undefined;this['dialCutDigit']=_0x412d3e['dialCutDigit']||undefined;this[_0x47e7('0x48')]=strategy[_0x412d3e[_0x47e7('0x48')]]||'rrmemory';this[_0x47e7('0x49')]=!![];this[_0x47e7('0x4a')]=_0x412d3e[_0x47e7('0x4a')]||![];this['dialAMDInitialSilence']=_0x412d3e[_0x47e7('0x4b')];this['dialAMDGreeting']=_0x412d3e[_0x47e7('0x4c')];this[_0x47e7('0x4d')]=_0x412d3e[_0x47e7('0x4d')];this['dialAMDTotalAnalysisTime']=_0x412d3e[_0x47e7('0x4e')];this[_0x47e7('0x4f')]=_0x412d3e[_0x47e7('0x4f')];this[_0x47e7('0x50')]=_0x412d3e[_0x47e7('0x50')];this[_0x47e7('0x51')]=_0x412d3e['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x412d3e[_0x47e7('0x52')];this['dialAMDMaximumWordLength']=_0x412d3e[_0x47e7('0x53')];this[_0x47e7('0x54')]=0x0;this[_0x47e7('0x55')]=0x0;this[_0x47e7('0x56')]=_0x412d3e[_0x47e7('0x56')];this[_0x47e7('0x57')]=0x0;this[_0x47e7('0x58')]=0x0;this[_0x47e7('0x59')]=0x0;this[_0x47e7('0x5a')]=0x0;this[_0x47e7('0x5b')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x47e7('0x5c')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x47e7('0x5d')]=0x0;this[_0x47e7('0x5e')]=0x0;this['outboundReCallsDay']=0x0;this[_0x47e7('0x5f')]=0x0;this[_0x47e7('0x60')]=undefined;this[_0x47e7('0x61')]=undefined;this[_0x47e7('0x62')]=undefined;this[_0x47e7('0x63')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x47e7('0x64')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x47e7('0x65')]=0x0;this[_0x47e7('0x66')]=0x0;this[_0x47e7('0x67')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x47e7('0x68')]=0x0;this[_0x47e7('0x69')]=_0x412d3e['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x412d3e[_0x47e7('0x6a')]||0xa;this[_0x47e7('0x6b')]=0x0;this[_0x47e7('0x6c')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x47e7('0x6d')]=0x0;this[_0x47e7('0x6e')]=0x0;this[_0x47e7('0x6f')]=0x0;this[_0x47e7('0x70')]=0x0;this[_0x47e7('0x71')]=_0x412d3e[_0x47e7('0x71')]||0x1e;this[_0x47e7('0x72')]=_0x412d3e[_0x47e7('0x72')]||![];this[_0x47e7('0x73')]=_0x412d3e[_0x47e7('0x73')]||undefined;this[_0x47e7('0x74')]=_0x412d3e['dialAgiAfterHangupClient']||![];this[_0x47e7('0x75')]=_0x412d3e['dialAgiAfterHangupAgent']||![];this[_0x47e7('0xd')]=monitorFormat[_0x412d3e['monitor_format']]?monitorFormat[_0x412d3e[_0x47e7('0xd')]]:undefined;this['mandatoryDisposition']=_0x412d3e['mandatoryDisposition']||![];this[_0x47e7('0x76')]=_0x412d3e[_0x47e7('0x76')]?_0x412d3e['mandatoryDispositionPause']:undefined;}module[_0x47e7('0x77')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 11ff8d6..0c726dd 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 _0x0c52=['Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x10448d,_0x57a5cd){var _0x4066fc=function(_0x2ac496){while(--_0x2ac496){_0x10448d['push'](_0x10448d['shift']());}};_0x4066fc(++_0x57a5cd);}(_0x0c52,0x170));var _0x20c5=function(_0x655b3a,_0x467bf6){_0x655b3a=_0x655b3a-0x0;var _0x21e95b=_0x0c52[_0x655b3a];return _0x21e95b;};'use strict';function VtigerAccount(_0x1df99e){this['id']=_0x1df99e['id']||0x0;this[_0x20c5('0x0')]=_0x1df99e[_0x20c5('0x0')]||'';this[_0x20c5('0x1')]=_0x1df99e[_0x20c5('0x1')]||'';this[_0x20c5('0x2')]=_0x1df99e[_0x20c5('0x2')]||'';this[_0x20c5('0x3')]=_0x1df99e[_0x20c5('0x3')]||'';this['serverUrl']=_0x1df99e['serverUrl']||'';this[_0x20c5('0x4')]=_0x1df99e[_0x20c5('0x4')]||{};}module[_0x20c5('0x5')]=VtigerAccount; \ No newline at end of file +var _0xaeb7=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x12fefa,_0x572741){var _0x2a4431=function(_0x1c9bae){while(--_0x1c9bae){_0x12fefa['push'](_0x12fefa['shift']());}};_0x2a4431(++_0x572741);}(_0xaeb7,0xd2));var _0x7aeb=function(_0x5499c8,_0x263218){_0x5499c8=_0x5499c8-0x0;var _0xc72ce2=_0xaeb7[_0x5499c8];return _0xc72ce2;};'use strict';function VtigerAccount(_0x4e5fa6){this['id']=_0x4e5fa6['id']||0x0;this['name']=_0x4e5fa6[_0x7aeb('0x0')]||'';this[_0x7aeb('0x1')]=_0x4e5fa6['username']||'';this[_0x7aeb('0x2')]=_0x4e5fa6['accessKey']||'';this[_0x7aeb('0x3')]=_0x4e5fa6[_0x7aeb('0x3')]||'';this[_0x7aeb('0x4')]=_0x4e5fa6[_0x7aeb('0x4')]||'';this['Configurations']=_0x4e5fa6[_0x7aeb('0x5')]||{};}module[_0x7aeb('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index c2e9070..b6b1637 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 _0x6bed=['authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri'];(function(_0x311dac,_0x4d1cee){var _0x375a9a=function(_0x3a64ab){while(--_0x3a64ab){_0x311dac['push'](_0x311dac['shift']());}};_0x375a9a(++_0x4d1cee);}(_0x6bed,0x7f));var _0xd6be=function(_0x5cb351,_0x42f40f){_0x5cb351=_0x5cb351-0x0;var _0x46bd71=_0x6bed[_0x5cb351];return _0x46bd71;};'use strict';function ZendeskAccount(_0x4b882e){this['id']=_0x4b882e['id']||0x0;this['name']=_0x4b882e[_0xd6be('0x0')]||'';this[_0xd6be('0x1')]=_0x4b882e[_0xd6be('0x1')]||'';this[_0xd6be('0x2')]=_0x4b882e['password']||'';this[_0xd6be('0x3')]=_0x4b882e[_0xd6be('0x3')]||'';this[_0xd6be('0x4')]=_0x4b882e['remoteUri']||'';this['authType']=_0x4b882e[_0xd6be('0x5')]||'';this[_0xd6be('0x6')]=_0x4b882e[_0xd6be('0x6')]||_0xd6be('0x7');this[_0xd6be('0x8')]=_0x4b882e[_0xd6be('0x8')]||'';this['Configurations']=_0x4b882e[_0xd6be('0x9')]||{};}module[_0xd6be('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x4df2=['serverUrl','Configurations','exports','name','password','token','remoteUri','authType','type','integrationTab'];(function(_0x1a4463,_0x12bae9){var _0x50c78b=function(_0x4a3937){while(--_0x4a3937){_0x1a4463['push'](_0x1a4463['shift']());}};_0x50c78b(++_0x12bae9);}(_0x4df2,0x1cf));var _0x24df=function(_0x4a6e7d,_0x3c29cc){_0x4a6e7d=_0x4a6e7d-0x0;var _0x4869af=_0x4df2[_0x4a6e7d];return _0x4869af;};'use strict';function ZendeskAccount(_0x244d33){this['id']=_0x244d33['id']||0x0;this['name']=_0x244d33[_0x24df('0x0')]||'';this['username']=_0x244d33['username']||'';this[_0x24df('0x1')]=_0x244d33[_0x24df('0x1')]||'';this[_0x24df('0x2')]=_0x244d33[_0x24df('0x2')]||'';this[_0x24df('0x3')]=_0x244d33[_0x24df('0x3')]||'';this[_0x24df('0x4')]=_0x244d33[_0x24df('0x4')]||'';this[_0x24df('0x5')]=_0x244d33[_0x24df('0x5')]||_0x24df('0x6');this[_0x24df('0x7')]=_0x244d33[_0x24df('0x7')]||'';this[_0x24df('0x8')]=_0x244d33[_0x24df('0x8')]||{};}module[_0x24df('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 3aea18d..a0b9890 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 _0xf6ed=['Configurations','exports','name','host','zone','clientId','clientSecret','serverUrl','code'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xf6ed,0x110));var _0xdf6e=function(_0x42b8ce,_0x56b21c){_0x42b8ce=_0x42b8ce-0x0;var _0xb20a16=_0xf6ed[_0x42b8ce];return _0xb20a16;};'use strict';function ZohoAccount(_0x56208d){this['id']=_0x56208d['id']||0x0;this[_0xdf6e('0x0')]=_0x56208d[_0xdf6e('0x0')]||'';this['description']=_0x56208d['description']||'';this[_0xdf6e('0x1')]=_0x56208d[_0xdf6e('0x1')]||'';this[_0xdf6e('0x2')]=_0x56208d[_0xdf6e('0x2')]||'';this[_0xdf6e('0x3')]=_0x56208d['clientId']||'';this[_0xdf6e('0x4')]=_0x56208d[_0xdf6e('0x4')]||'';this[_0xdf6e('0x5')]=_0x56208d[_0xdf6e('0x5')]||'';this[_0xdf6e('0x6')]=_0x56208d[_0xdf6e('0x6')]||'';this['refreshToken']=_0x56208d['refreshToken']||'';this[_0xdf6e('0x7')]=_0x56208d[_0xdf6e('0x7')]||{};}module[_0xdf6e('0x8')]=ZohoAccount; \ No newline at end of file +var _0xd437=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x49c5c3,_0x7a0a18){var _0x5a3cf8=function(_0x22befa){while(--_0x22befa){_0x49c5c3['push'](_0x49c5c3['shift']());}};_0x5a3cf8(++_0x7a0a18);}(_0xd437,0x1e9));var _0x7d43=function(_0x3bd52b,_0xbbc735){_0x3bd52b=_0x3bd52b-0x0;var _0x1e5b89=_0xd437[_0x3bd52b];return _0x1e5b89;};'use strict';function ZohoAccount(_0x445cc9){this['id']=_0x445cc9['id']||0x0;this[_0x7d43('0x0')]=_0x445cc9['name']||'';this[_0x7d43('0x1')]=_0x445cc9[_0x7d43('0x1')]||'';this[_0x7d43('0x2')]=_0x445cc9[_0x7d43('0x2')]||'';this[_0x7d43('0x3')]=_0x445cc9['zone']||'';this[_0x7d43('0x4')]=_0x445cc9[_0x7d43('0x4')]||'';this[_0x7d43('0x5')]=_0x445cc9[_0x7d43('0x5')]||'';this[_0x7d43('0x6')]=_0x445cc9[_0x7d43('0x6')]||'';this[_0x7d43('0x7')]=_0x445cc9['code']||'';this[_0x7d43('0x8')]=_0x445cc9[_0x7d43('0x8')]||'';this[_0x7d43('0x9')]=_0x445cc9[_0x7d43('0x9')]||{};}module[_0x7d43('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 db3ebe9..70ea2e6 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 _0x5a2e=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','lodash','isNil','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback'];(function(_0x2b1ebf,_0x2228fb){var _0x164be8=function(_0x27c6e5){while(--_0x27c6e5){_0x2b1ebf['push'](_0x2b1ebf['shift']());}};_0x164be8(++_0x2228fb);}(_0x5a2e,0x187));var _0xe5a2=function(_0x4a4070,_0x418df4){_0x4a4070=_0x4a4070-0x0;var _0x1be377=_0x5a2e[_0x4a4070];return _0x1be377;};'use strict';var util=require('util');var _=require(_0xe5a2('0x0'));var moment=require('moment');function checkNameSurname(_0xae8e11,_0x535bcb,_0x219cee){var _0x1a23a9='';if(!_['isNil'](_0x535bcb)&&'string'===typeof _0x535bcb){_0x1a23a9+=_0x535bcb;}if(!_[_0xe5a2('0x1')](_0x219cee)&&'string'===typeof _0x219cee){_0x1a23a9+='\x20'+_0x219cee;}if(_0x1a23a9!==''){return _0x1a23a9;}return _0xae8e11;}function Action(_0x361159,_0x1c01e7,_0x47a4d6,_0x2b3f51,_0x4f695e){this['uniqueid']=_0x47a4d6||undefined;this[_0xe5a2('0x2')]=_0x361159['id'];this[_0xe5a2('0x3')]=_0x1c01e7[_0xe5a2('0x4')];this[_0xe5a2('0x5')]=_0x1c01e7[_0xe5a2('0x5')];this[_0xe5a2('0x6')]=_0xe5a2('0x3');this[_0xe5a2('0x7')]=![];this[_0xe5a2('0x8')]=_[_0xe5a2('0x1')](_0x361159[_0xe5a2('0x9')])?undefined:_0x361159['Agent'][_0xe5a2('0x4')];this[_0xe5a2('0xa')]=this['membername']?util[_0xe5a2('0xb')](_0xe5a2('0xc'),this[_0xe5a2('0x8')]):_0x2b3f51||undefined;this[_0xe5a2('0xd')]=checkNameSurname(_0x361159[_0xe5a2('0xe')]['phone'],_0x361159['Contact']['firstName'],_0x361159['Contact'][_0xe5a2('0xf')]);this[_0xe5a2('0x10')]=_0x361159[_0xe5a2('0x10')]||![];this[_0xe5a2('0x11')]=_0x361159[_0xe5a2('0xe')][_0xe5a2('0x12')];this[_0xe5a2('0x13')]=_0x361159[_0xe5a2('0x13')];this[_0xe5a2('0x14')]=_0x361159[_0xe5a2('0x14')]||0x0;this[_0xe5a2('0x15')]=_0x361159[_0xe5a2('0x15')]||0x0;this[_0xe5a2('0x16')]=_0x361159[_0xe5a2('0x16')]||0x0;this['countglobal']=(_0x361159[_0xe5a2('0x14')]||0x0)+(_0x361159[_0xe5a2('0x15')]||0x0)+(_0x361159[_0xe5a2('0x16')]||0x0)+(_0x361159['countnosuchnumberretry']||0x0)+(_0x361159[_0xe5a2('0x17')]||0x0)+(_0x361159[_0xe5a2('0x18')]||0x0)+(_0x361159[_0xe5a2('0x19')]||0x0)+(_0x361159[_0xe5a2('0x1a')]||0x0);this['countnosuchnumberretry']=_0x361159[_0xe5a2('0x1b')]||0x0;this[_0xe5a2('0x17')]=_0x361159[_0xe5a2('0x17')]||0x0;this[_0xe5a2('0x18')]=_0x361159[_0xe5a2('0x18')]||0x0;this[_0xe5a2('0x19')]=_0x361159['countmachineretry']||0x0;this[_0xe5a2('0x1a')]=_0x361159[_0xe5a2('0x1a')]||0x0;this[_0xe5a2('0x1c')]=_0x361159[_0xe5a2('0x1c')];this[_0xe5a2('0x1d')]=_0x361159[_0xe5a2('0x1d')];this[_0xe5a2('0x1e')]=_0x361159[_0xe5a2('0x1e')];this['recallme']=_0x361159[_0xe5a2('0x1f')];this['ContactId']=_0x361159[_0xe5a2('0x20')];this[_0xe5a2('0x21')]=_0x361159[_0xe5a2('0x21')];this[_0xe5a2('0x22')]=_['isNil'](_0x361159[_0xe5a2('0x9')])?_0x361159[_0xe5a2('0x22')]:_0x361159[_0xe5a2('0x9')]['id'];this[_0xe5a2('0x23')]=_0x361159[_0xe5a2('0x23')];this[_0xe5a2('0x24')]='';this[_0xe5a2('0x25')]='';}Action[_0xe5a2('0x26')][_0xe5a2('0x27')]=function(){return util[_0xe5a2('0xb')](_0xe5a2('0x28'),this[_0xe5a2('0xd')],this['number']);};module[_0xe5a2('0x29')]=Action; \ No newline at end of file +var _0xa11f=['countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','Agent','VoiceQueueId','getCaller','\x22%s\x22\x20<%s>','number','util','lodash','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','name','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','active','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x90604a,_0x478069){var _0x5b517b=function(_0x475f05){while(--_0x475f05){_0x90604a['push'](_0x90604a['shift']());}};_0x5b517b(++_0x478069);}(_0xa11f,0x8d));var _0xfa11=function(_0x3adb8e,_0x247ca2){_0x3adb8e=_0x3adb8e-0x0;var _0x3eacdb=_0xa11f[_0x3adb8e];return _0x3eacdb;};'use strict';var util=require(_0xfa11('0x0'));var _=require(_0xfa11('0x1'));var moment=require('moment');function checkNameSurname(_0x3c87db,_0xf5802,_0x269758){var _0x11f298='';if(!_[_0xfa11('0x2')](_0xf5802)&&_0xfa11('0x3')===typeof _0xf5802){_0x11f298+=_0xf5802;}if(!_[_0xfa11('0x2')](_0x269758)&&'string'===typeof _0x269758){_0x11f298+='\x20'+_0x269758;}if(_0x11f298!==''){return _0x11f298;}return _0x3c87db;}function Action(_0x27c731,_0x11174b,_0x302fbb,_0x334123,_0x16dfbf){this[_0xfa11('0x4')]=_0x302fbb||undefined;this[_0xfa11('0x5')]=_0x27c731['id'];this[_0xfa11('0x6')]=_0x11174b['name'];this[_0xfa11('0x7')]=_0x11174b['type'];this[_0xfa11('0x8')]=_0xfa11('0x6');this[_0xfa11('0x9')]=![];this[_0xfa11('0xa')]=_[_0xfa11('0x2')](_0x27c731['Agent'])?undefined:_0x27c731['Agent'][_0xfa11('0xb')];this[_0xfa11('0xc')]=this[_0xfa11('0xa')]?util[_0xfa11('0xd')](_0xfa11('0xe'),this[_0xfa11('0xa')]):_0x334123||undefined;this[_0xfa11('0xf')]=checkNameSurname(_0x27c731[_0xfa11('0x10')][_0xfa11('0x11')],_0x27c731[_0xfa11('0x10')][_0xfa11('0x12')],_0x27c731[_0xfa11('0x10')]['lastName']);this[_0xfa11('0x13')]=_0x27c731[_0xfa11('0x13')]||![];this[_0xfa11('0x14')]=_0x27c731[_0xfa11('0x10')][_0xfa11('0x11')];this['scheduledat']=_0x27c731['scheduledat'];this[_0xfa11('0x15')]=_0x27c731['countbusyretry']||0x0;this[_0xfa11('0x16')]=_0x27c731[_0xfa11('0x16')]||0x0;this['countnoanswerretry']=_0x27c731[_0xfa11('0x17')]||0x0;this[_0xfa11('0x18')]=(_0x27c731['countbusyretry']||0x0)+(_0x27c731[_0xfa11('0x16')]||0x0)+(_0x27c731['countnoanswerretry']||0x0)+(_0x27c731[_0xfa11('0x19')]||0x0)+(_0x27c731[_0xfa11('0x1a')]||0x0)+(_0x27c731[_0xfa11('0x1b')]||0x0)+(_0x27c731[_0xfa11('0x1c')]||0x0)+(_0x27c731[_0xfa11('0x1d')]||0x0);this['countnosuchnumberretry']=_0x27c731[_0xfa11('0x19')]||0x0;this['countdropretry']=_0x27c731['countdropretry']||0x0;this[_0xfa11('0x1b')]=_0x27c731[_0xfa11('0x1b')]||0x0;this[_0xfa11('0x1c')]=_0x27c731[_0xfa11('0x1c')]||0x0;this[_0xfa11('0x1d')]=_0x27c731['countagentrejectretry']||0x0;this[_0xfa11('0x1e')]=_0x27c731[_0xfa11('0x1e')];this[_0xfa11('0x1f')]=_0x27c731['callbackuniqueid'];this[_0xfa11('0x20')]=_0x27c731[_0xfa11('0x20')];this[_0xfa11('0x21')]=_0x27c731[_0xfa11('0x21')];this[_0xfa11('0x22')]=_0x27c731[_0xfa11('0x22')];this[_0xfa11('0x23')]=_0x27c731[_0xfa11('0x23')];this[_0xfa11('0x24')]=_['isNil'](_0x27c731[_0xfa11('0x25')])?_0x27c731[_0xfa11('0x24')]:_0x27c731['Agent']['id'];this[_0xfa11('0x26')]=_0x27c731['VoiceQueueId'];this['originatecalleridnum']='';this['originatecalleridname']='';}Action['prototype'][_0xfa11('0x27')]=function(){return util[_0xfa11('0xd')](_0xfa11('0x28'),this[_0xfa11('0xf')],this[_0xfa11('0x29')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index f5bfc3e..0dd4852 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 _0x1f72=['callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Queue','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','TrunkBackup','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','extractCalleridNumber','merge','toLowerVariables','channelAgent','destconnectedlinenum','calleridnum','user:%s','user:agentconnect','accountcode','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','logLookAgent','clone','isFailure','response','rejected','starttime','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','variables','addVariable','keys','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','transfererlinkedid','exports','util','lodash','bluebird','uuid','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','./action','redis','localhost','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','outbound','name','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','md5','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','booked','clearZombieChannels','hasOwnProperty','preview','clearZombieChannel','pTalking:\x20','queue','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','channel','catch','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','recallMe','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','outboundReCallsDay','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','answered','Answer','[callProgressDetectingCustomer][logAnswer]','createCustomerFinal','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','\x20Queue','BUSY','countbusyretry','Busy','custom:agentbusy','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','rescheduleContact','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','scheduledAt','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','uniqueid','originated:\x20'];(function(_0x36c38c,_0x15e6c2){var _0x1dc6ae=function(_0x4a91e6){while(--_0x4a91e6){_0x36c38c['push'](_0x36c38c['shift']());}};_0x1dc6ae(++_0x15e6c2);}(_0x1f72,0x1c1));var _0x21f7=function(_0x506c6d,_0x464e39){_0x506c6d=_0x506c6d-0x0;var _0x1e3f01=_0x1f72[_0x506c6d];return _0x1e3f01;};'use strict';var util=require(_0x21f7('0x0'));var _=require(_0x21f7('0x1'));var BPromise=require(_0x21f7('0x2'));var uuid=require(_0x21f7('0x3'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x21f7('0x4'));var config=require(_0x21f7('0x5'));var logger=require(_0x21f7('0x6'))('preview');var loggerAction=require(_0x21f7('0x6'))(_0x21f7('0x7'));var ami=require(_0x21f7('0x8'));var rpcDb=require(_0x21f7('0x9'));var Action=require(_0x21f7('0xa'));var ut=require('./util/util');config[_0x21f7('0xb')]=_['defaults'](config[_0x21f7('0xb')],{'host':_0x21f7('0xc'),'port':0x18eb});var io=require(_0x21f7('0xd'))(new Redis(config[_0x21f7('0xb')]));var Sequence=function(){};Sequence[_0x21f7('0xe')]['enqueue']=function(_0x5278bf){this[_0x21f7('0xf')]=this['tail']?this['tail'][_0x21f7('0x10')](_0x5278bf):_0x5278bf();};function Preview(_0x89efcc){this[_0x21f7('0x11')]=new Sequence();this[_0x21f7('0x12')]=_0x89efcc['voiceQueues'];this[_0x21f7('0x13')]=_0x89efcc['trunks'];this[_0x21f7('0x14')]={};this[_0x21f7('0x15')]=_0x89efcc['agents'];this[_0x21f7('0x16')]=0x0;ami['on'](_0x21f7('0x17'),this[_0x21f7('0x18')][_0x21f7('0x19')](this));ami['on']('hangup',this[_0x21f7('0x1a')][_0x21f7('0x19')](this));ami['on'](_0x21f7('0x1b'),this[_0x21f7('0x1c')][_0x21f7('0x19')](this));ami['on'](_0x21f7('0x1d'),this[_0x21f7('0x1e')][_0x21f7('0x19')](this));ami['on'](_0x21f7('0x1f'),this['syncNewExten'][_0x21f7('0x19')](this));ami['on']('varset',this[_0x21f7('0x20')][_0x21f7('0x19')](this));ami['on'](_0x21f7('0x21'),this[_0x21f7('0x22')][_0x21f7('0x19')](this));ami['on'](_0x21f7('0x23'),this[_0x21f7('0x24')][_0x21f7('0x19')](this));this[_0x21f7('0x25')](this['campaignsPreview']);}function emit(_0x46ecc1,_0xa8f3a1,_0x27c620){io['to'](_0x46ecc1)[_0x21f7('0x26')](_0xa8f3a1,_0x27c620);}function emitCampaignPreview(_0x3f56be){if(_0x3f56be['type']===_0x21f7('0x27')){var _0x24167a={'id':_0x3f56be['id'],'name':_0x3f56be[_0x21f7('0x28')],'strategy':_0x3f56be['strategy'],'answered':_0x3f56be['answered'],'available':_0x3f56be[_0x21f7('0x29')],'loggedIn':_0x3f56be[_0x21f7('0x2a')],'pTalking':_0x3f56be[_0x21f7('0x2b')],'sumBillable':_0x3f56be[_0x21f7('0x2c')],'sumDuration':_0x3f56be[_0x21f7('0x2d')],'sumHoldTime':_0x3f56be['sumHoldTime']||0x0,'talking':_0x3f56be[_0x21f7('0x2e')],'total':_0x3f56be[_0x21f7('0x2f')],'type':_0x3f56be[_0x21f7('0x30')],'unmanaged':_0x3f56be[_0x21f7('0x31')],'abandoned':_0x3f56be['abandoned'],'waiting':_0x3f56be[_0x21f7('0x32')],'loggedInDb':_0x3f56be[_0x21f7('0x33')],'dialActive':_0x3f56be[_0x21f7('0x34')],'dialMethod':_0x3f56be[_0x21f7('0x35')],'dialOriginateCallerIdName':_0x3f56be[_0x21f7('0x36')],'dialOriginateCallerIdNumber':_0x3f56be[_0x21f7('0x37')],'dialOriginateTimeout':_0x3f56be[_0x21f7('0x38')],'dialPrefix':_0x3f56be[_0x21f7('0x39')],'outboundAnswerAgiCallsDay':_0x3f56be[_0x21f7('0x3a')],'outboundAnswerCallsDay':_0x3f56be[_0x21f7('0x3b')],'outboundBlacklistCallsDay':_0x3f56be[_0x21f7('0x3c')],'outboundBusyCallsDay':_0x3f56be[_0x21f7('0x3d')],'outboundCongestionCallsDay':_0x3f56be[_0x21f7('0x3e')],'outboundDropCallsDayACS':_0x3f56be[_0x21f7('0x3f')],'outboundDropCallsDayCallersExit':_0x3f56be[_0x21f7('0x40')],'outboundDropCallsDayTimeout':_0x3f56be[_0x21f7('0x41')],'outboundNoAnswerCallsDay':_0x3f56be[_0x21f7('0x42')],'outboundNoSuchCallsDay':_0x3f56be[_0x21f7('0x43')],'outboundOriginateFailureCallsDay':_0x3f56be[_0x21f7('0x44')],'outboundReCallsDay':_0x3f56be['outboundReCallsDay'],'outboundRejectCallsDay':_0x3f56be['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x3f56be[_0x21f7('0x45')],'outboundAbandonedCallsDay':_0x3f56be[_0x21f7('0x46')],'predictiveIntervalAnsweredCalls':_0x3f56be[_0x21f7('0x47')],'predictiveIntervalAvgHoldtime':_0x3f56be['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3f56be[_0x21f7('0x48')],'predictiveIntervalDroppedCallsCallersExit':_0x3f56be[_0x21f7('0x49')],'predictiveIntervalDroppedCallsTimeout':_0x3f56be[_0x21f7('0x4a')],'predictiveIntervalErlangCalls':_0x3f56be[_0x21f7('0x4b')],'predictiveIntervalErlangCallsDroppedCalls':_0x3f56be['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x3f56be['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x3f56be['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x3f56be[_0x21f7('0x4c')],'predictiveIntervalAvailable':_0x3f56be['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x3f56be[_0x21f7('0x4d')],'message':_0x3f56be[_0x21f7('0x4e')],'originated':_0x3f56be[_0x21f7('0x4f')],'erlangCalls':_0x3f56be[_0x21f7('0x50')],'erlangCallToSecond':_0x3f56be[_0x21f7('0x51')],'erlangAbandonmentRate':_0x3f56be['erlangAbandonmentRate'],'erlangBusyFactor':_0x3f56be[_0x21f7('0x52')],'startPredictive':_0x3f56be[_0x21f7('0x53')],'startProgressive':_0x3f56be[_0x21f7('0x54')]};if(_0x3f56be[_0x21f7('0x55')]){_0x24167a[_0x21f7('0x55')]={'id':_0x3f56be[_0x21f7('0x55')]['id'],'name':_0x3f56be[_0x21f7('0x55')][_0x21f7('0x28')],'active':_0x3f56be[_0x21f7('0x55')][_0x21f7('0x56')],'callerid':_0x3f56be[_0x21f7('0x55')][_0x21f7('0x57')]};}if(_0x3f56be[_0x21f7('0x58')]){_0x24167a['Interval']={'id':_0x3f56be[_0x21f7('0x58')]['id'],'name':_0x3f56be[_0x21f7('0x58')]['name']};}var _0x13eead=md5(JSON[_0x21f7('0x59')](_0x24167a));if(_0x3f56be[_0x21f7('0x5a')]!==_0x13eead){_0x3f56be[_0x21f7('0x5a')]=_0x13eead;emit(util[_0x21f7('0x5b')]('voice:queue:%s',_0x24167a[_0x21f7('0x28')]),_0x21f7('0x5c'),_0x24167a);}}}function emitVoiceQueueChannelRemove(_0x58e0f6){logger[_0x21f7('0x5d')](_0x21f7('0x5e'),JSON['stringify'](_0x58e0f6));emit(util['format'](_0x21f7('0x5f'),_0x58e0f6[_0x21f7('0x28')]),_0x21f7('0x60'),_0x58e0f6);io[_0x21f7('0x26')](_0x21f7('0x61'),_0x58e0f6);}function notSendMessagesQueue(_0x4352b5){if(_0x4352b5[_0x21f7('0x62')]){if(_0x4352b5[_0x21f7('0x4f')]===0x0&&_0x4352b5[_0x21f7('0x2b')]===0x0){_0x4352b5[_0x21f7('0x62')]=![];_0x4352b5[_0x21f7('0x29')]=0x0;_0x4352b5[_0x21f7('0x63')]=0x0;_0x4352b5[_0x21f7('0x4e')]=_0x21f7('0x64');ut[_0x21f7('0x65')](_0x21f7('0x66'),_0x4352b5[_0x21f7('0x28')]+_0x21f7('0x67'));}else{_0x4352b5[_0x21f7('0x4e')]='IS_DISACTIVED';ut[_0x21f7('0x65')](_0x21f7('0x66'),_0x4352b5['name']+_0x21f7('0x68'));}emitCampaignPreview(_0x4352b5);}}Preview[_0x21f7('0xe')]['loopCampaigns']=function(){var _0xf4c566=this;setInterval(function(){_0xf4c566[_0x21f7('0x69')]();},0x7cf);};Preview[_0x21f7('0xe')]['syncCampaigns']=function(){var _0x20e3d6=this['campaignsPreview'];this[_0x21f7('0x16')]+=0x1;for(var _0x290a83 in _0x20e3d6){if(_0x20e3d6['hasOwnProperty'](_0x290a83)&&(_0x20e3d6[_0x290a83][_0x21f7('0x35')]==='preview'||_0x20e3d6[_0x290a83][_0x21f7('0x35')]===_0x21f7('0x6a'))&&_0x20e3d6[_0x290a83][_0x21f7('0x30')]===_0x21f7('0x27')){if(this[_0x21f7('0x16')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x21f7('0x6b')]();}}if(_0x20e3d6[_0x21f7('0x6c')](_0x290a83)&&_0x20e3d6[_0x290a83][_0x21f7('0x35')]===_0x21f7('0x6d')&&_0x20e3d6[_0x290a83][_0x21f7('0x30')]===_0x21f7('0x27')){if(_0x20e3d6[_0x290a83]['dialActive']){this['setMessage'](_0x20e3d6[_0x290a83]);this['recallMe'](_0x20e3d6[_0x290a83]);}else{notSendMessagesQueue(_0x20e3d6[_0x290a83]);}}}};Preview[_0x21f7('0xe')][_0x21f7('0x6e')]=function(_0x42c0d6){var _0x4c964d=this;this['sequence']['enqueue'](function(){if(!_['isNil'](_0x4c964d[_0x21f7('0x14')][_0x42c0d6])){loggerAction[_0x21f7('0x5d')]('[clearZombieChannels][talking]',_0x42c0d6,'Queue',_0x4c964d[_0x21f7('0x14')][_0x42c0d6]['queue'],'originated:\x20',JSON[_0x21f7('0x59')](_0x4c964d[_0x21f7('0x12')][_0x4c964d[_0x21f7('0x14')][_0x42c0d6]['queue']]['originated']),_0x21f7('0x6f'),JSON[_0x21f7('0x59')](_0x4c964d[_0x21f7('0x12')][_0x4c964d['actions'][_0x42c0d6][_0x21f7('0x70')]]['pTalking']),JSON['stringify'](_0x4c964d[_0x21f7('0x14')][_0x42c0d6][_0x21f7('0x71')]),JSON['stringify'](_[_0x21f7('0x72')](_0x4c964d['actions'][_0x42c0d6],['contactId',_0x21f7('0x73'),_0x21f7('0x74'),_0x21f7('0x75')])));return ami[_0x21f7('0x76')]({'action':'status','channel':_0x4c964d[_0x21f7('0x14')][_0x42c0d6][_0x21f7('0x77')]})[_0x21f7('0x78')](function(_0x351f39){if(_0x351f39[_0x21f7('0x4e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4c964d[_0x21f7('0x14')][_0x42c0d6]){ut['updateOriginated'](_0x4c964d[_0x21f7('0x12')][_0x4c964d[_0x21f7('0x14')][_0x42c0d6][_0x21f7('0x70')]],'[clearZombieChannel]');if(_0x4c964d[_0x21f7('0x14')][_0x42c0d6][_0x21f7('0x71')]===!![]){ut[_0x21f7('0x79')](_0x4c964d[_0x21f7('0x12')][_0x4c964d['actions'][_0x42c0d6][_0x21f7('0x70')]],'[clearZombieChannel]');ut['loggerError'](_0x21f7('0x7a')+_0x42c0d6,_0x4c964d[_0x21f7('0x14')][_0x42c0d6][_0x21f7('0x70')]);}ut[_0x21f7('0x7b')](_0x21f7('0x7c')+_0x42c0d6,_0x4c964d['actions'][_0x42c0d6][_0x21f7('0x70')]);delete _0x4c964d[_0x21f7('0x14')][_0x42c0d6];}},0x2328);}});}});};Preview[_0x21f7('0xe')][_0x21f7('0x6b')]=function(){var _0x5db48a=this;loggerAction['info'](_0x21f7('0x7d'),_['size'](this[_0x21f7('0x14')]));for(var _0x317888 in this['actions']){if(_0x5db48a[_0x21f7('0x14')][_0x21f7('0x6c')](_0x317888)){_0x5db48a[_0x21f7('0x6e')](_0x317888);}}};Preview[_0x21f7('0xe')][_0x21f7('0x7e')]=function(_0x2a0e95){var _0x45abdd=this;rpcDb[_0x21f7('0x7f')](_0x2a0e95['id'],ut[_0x21f7('0x80')](this[_0x21f7('0x15')]))[_0x21f7('0x81')](function(_0x326ae0){if(!_[_0x21f7('0x82')](_0x326ae0)){for(var _0x261163=0x0;_0x261163<_0x326ae0[_0x21f7('0x83')];_0x261163+=0x1){if(ut[_0x21f7('0x84')](_0x326ae0[_0x261163][_0x21f7('0x85')])<_0x2a0e95[_0x21f7('0x86')]*0x3c){if(_0x326ae0[_0x261163][_0x21f7('0x87')]&&!_0x326ae0[_0x261163]['Agent'][_0x21f7('0x88')]){_0x45abdd[_0x21f7('0x89')](_0x326ae0[_0x261163]['id'])['then'](ut[_0x21f7('0x8a')](_0x21f7('0x8b')))[_0x21f7('0x78')](ut[_0x21f7('0x8a')]('[RecallMe]'));}else{rpcDb[_0x21f7('0x8c')](_0x326ae0[_0x261163]['id']);}}else{var _0x2073de=new Action(_0x326ae0[_0x261163],_0x2a0e95);_0x2073de['starttime']=moment()[_0x21f7('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a0e95[_0x21f7('0x8d')]+=0x1;ut['logCustomer'](_0x2073de,0x17,'RecallInQueue');if(_0x2a0e95[_0x21f7('0x8e')]){rpcDb[_0x21f7('0x8f')](ut[_0x21f7('0x90')](_0x326ae0[_0x261163]));rpcDb[_0x21f7('0x91')](_0x2073de,_0x21f7('0x92'));}else{ut[_0x21f7('0x93')](_0x2073de,0x16,_0x21f7('0x94'));rpcDb[_0x21f7('0x91')](_0x2073de,_0x21f7('0x95'));rpcDb['createCustomerFinal'](_0x2073de,_0x21f7('0x95'));}}}}})['catch'](ut[_0x21f7('0x8a')](_0x21f7('0x96')));};Preview['prototype'][_0x21f7('0x97')]=function(_0x553891){_0x553891['sendMessageOneNotActive']=!![];if(ut[_0x21f7('0x98')](_0x553891[_0x21f7('0x2a')])){_0x553891[_0x21f7('0x4e')]=_0x21f7('0x99');}else if(!ut['isActive'](_0x553891[_0x21f7('0x34')])){_0x553891['message']=_0x21f7('0x64');}else if(!this[_0x21f7('0x9a')](_0x553891['Trunk'])){if(!this[_0x21f7('0x9a')](_0x553891['TrunkBackup'])){_0x553891[_0x21f7('0x4e')]=_0x21f7('0x9b');}else{_0x553891[_0x21f7('0x4e')]=_0x21f7('0x9c');}}else{_0x553891[_0x21f7('0x4e')]=_0x21f7('0x9c');}emitCampaignPreview(_0x553891);};Preview[_0x21f7('0xe')][_0x21f7('0x9d')]=function(_0x2f6d43,_0x44b36a,_0x16c5e5){var _0x39b5cb=this;var _0x217e52=this[_0x21f7('0x14')][_0x44b36a];var _0x339b94=this[_0x21f7('0x12')][_0x217e52[_0x21f7('0x70')]];var _0x23644a;if(_0x339b94){switch(_0x16c5e5){case'1':_0x339b94[_0x21f7('0x43')]+=0x1;_0x217e52['countnosuchnumberretry']+=0x1;_0x217e52[_0x21f7('0x9e')]=ut[_0x21f7('0x9f')](_0x217e52);ut[_0x21f7('0x93')](_0x217e52,0x0,_0x21f7('0xa0'));ami[_0x21f7('0x26')]('custom:agentnosuchnumber',ut[_0x21f7('0xa1')](_0x217e52,_0x21f7('0xa2')));rpcDb[_0x21f7('0x91')](_0x217e52,_0x21f7('0xa3'));if(ut[_0x21f7('0x9f')](_0x217e52)>=_0x339b94[_0x21f7('0xa4')]){_0x23644a=ut[_0x21f7('0xa5')](_0x217e52,0xf,'Global');rpcDb['createCustomerFinal'](_0x23644a,_0x21f7('0xa6'));}else{if(_0x217e52[_0x21f7('0xa7')]>=_0x339b94[_0x21f7('0xa8')]){rpcDb['createCustomerFinal'](_0x217e52,_0x21f7('0xa6'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x217e52,'countnosuchnumberretry',_0x339b94[_0x21f7('0xa9')]),_0x217e52[_0x21f7('0xaa')],_0x217e52[_0x21f7('0xab')]);}}delete this[_0x21f7('0x14')][_0x2f6d43[_0x21f7('0xac')]];break;case _0x21f7('0xad'):var _0x3ca4c3=moment()['format'](_0x21f7('0xae'));_0x217e52[_0x21f7('0xaf')]=_0x3ca4c3;_0x217e52[_0x21f7('0xb0')]=_0x3ca4c3;_0x217e52[_0x21f7('0x71')]=!![];_0x339b94['pTalking']+=0x1;logger[_0x21f7('0x5d')]('[syncHangup][talking][increment]',_0x217e52['uniqueid'],'\x20Queue',_0x339b94[_0x21f7('0x28')],_0x21f7('0x6f'),_0x339b94['pTalking']);ami[_0x21f7('0x26')](_0x21f7('0xb1'),ut[_0x21f7('0xa1')](_0x217e52,_0x21f7('0xb2'),this[_0x21f7('0x12')][_0x217e52[_0x21f7('0x70')]]));if(_0x339b94[_0x21f7('0xb3')]){ami[_0x21f7('0x26')](_0x21f7('0xb4'),ut[_0x21f7('0xb5')](_0x217e52));}break;case'16':ami[_0x21f7('0x26')](_0x21f7('0xb6'),ut[_0x21f7('0xa1')](_0x217e52,_0x21f7('0xb7'),this[_0x21f7('0x12')][_0x217e52['queue']]));emitVoiceQueueChannelRemove(ut[_0x21f7('0xa1')](_0x217e52,'complete'));_0x339b94['outboundAnswerCallsDay']+=0x1;_0x339b94[_0x21f7('0x2f')]+=0x1;_0x339b94[_0x21f7('0xb8')]+=0x1;ut['decrementTalkink'](_0x339b94,'[16]');_0x217e52[_0x21f7('0x9e')]=ut['totalGlobal'](_0x217e52);ut[_0x21f7('0x93')](_0x217e52,0x4,_0x21f7('0xb9'));rpcDb[_0x21f7('0x91')](_0x217e52,_0x21f7('0xba'));rpcDb[_0x21f7('0xbb')](_0x217e52,_0x21f7('0xbc'));rpcDb[_0x21f7('0xbd')](_0x217e52);_0x339b94['sumDuration']+=_0x217e52[_0x21f7('0xbe')];_0x339b94[_0x21f7('0x2c')]+=_0x217e52[_0x21f7('0xbe')];logger[_0x21f7('0x5d')]('[syncHangup][talking][decrement]',_0x217e52['uniqueid'],_0x21f7('0xbf'),_0x339b94[_0x21f7('0x28')],_0x21f7('0x6f'),_0x339b94[_0x21f7('0x2b')]);delete this['actions'][_0x2f6d43[_0x21f7('0xac')]];break;case _0x21f7('0xc0'):_0x339b94[_0x21f7('0x3d')]+=0x1;_0x217e52[_0x21f7('0xc1')]+=0x1;_0x217e52[_0x21f7('0x9e')]=ut[_0x21f7('0x9f')](_0x217e52);ut[_0x21f7('0x93')](_0x217e52,0x5,_0x21f7('0xc2'));ami[_0x21f7('0x26')](_0x21f7('0xc3'),ut['buildObj'](_0x217e52,'busy'));rpcDb[_0x21f7('0x91')](_0x217e52,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x21f7('0x9f')](_0x217e52)>=_0x339b94[_0x21f7('0xa4')]){_0x23644a=ut[_0x21f7('0xa5')](_0x217e52,0xf,_0x21f7('0xc4'));rpcDb[_0x21f7('0xbb')](_0x23644a,_0x21f7('0xc5'));}else{if(_0x217e52[_0x21f7('0xc1')]>=_0x339b94[_0x21f7('0xc6')]){rpcDb[_0x21f7('0xbb')](_0x217e52,_0x21f7('0xc7'));}else{rpcDb[_0x21f7('0xc8')](ut['scheduledAt'](_0x217e52,_0x21f7('0xc1'),_0x339b94[_0x21f7('0xc9')]),_0x217e52['unlockAgent'],_0x217e52[_0x21f7('0xab')]);}}break;case _0x21f7('0xca'):_0x339b94[_0x21f7('0x42')]+=0x1;_0x217e52[_0x21f7('0xcb')]+=0x1;_0x217e52['countglobal']=ut[_0x21f7('0x9f')](_0x217e52);ut[_0x21f7('0x93')](_0x217e52,0x3,_0x21f7('0xcc'));ami['emit']('custom:agentnoanswer',ut[_0x21f7('0xa1')](_0x217e52,_0x21f7('0xcd')));rpcDb['createCustomerHistory'](_0x217e52,_0x21f7('0xce'));if(ut[_0x21f7('0x9f')](_0x217e52)>=_0x339b94[_0x21f7('0xa4')]){_0x23644a=ut['cloneAction'](_0x217e52,0xf,_0x21f7('0xc4'));rpcDb['createCustomerFinal'](_0x23644a,_0x21f7('0xcf'));}else{if(_0x217e52['countnoanswerretry']>=_0x339b94['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x217e52,_0x21f7('0xce'));}else{rpcDb[_0x21f7('0xc8')](ut[_0x21f7('0xd0')](_0x217e52,'countnoanswerretry',_0x339b94['dialNoAnswerRetryFrequency']),_0x217e52['unlockAgent'],_0x217e52['activeContact']);}}break;case _0x21f7('0xd1'):_0x339b94['outboundCongestionCallsDay']+=0x1;_0x217e52[_0x21f7('0xd2')]+=0x1;_0x217e52[_0x21f7('0x9e')]=ut[_0x21f7('0x9f')](_0x217e52);ut[_0x21f7('0x93')](_0x217e52,0x8,_0x21f7('0xd3'));ami[_0x21f7('0x26')](_0x21f7('0xd4'),ut[_0x21f7('0xa1')](_0x217e52,'congestion'));rpcDb[_0x21f7('0x91')](_0x217e52,_0x21f7('0xd5'));if(ut['totalGlobal'](_0x217e52)>=_0x339b94['dialGlobalMaxRetry']){_0x23644a=ut['cloneAction'](_0x217e52,0xf,'Global');rpcDb['createCustomerFinal'](_0x23644a,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x217e52[_0x21f7('0xd2')]>=_0x339b94['dialCongestionMaxRetry']){rpcDb[_0x21f7('0xbb')](_0x217e52,_0x21f7('0xd5'));}else{rpcDb[_0x21f7('0xc8')](ut[_0x21f7('0xd0')](_0x217e52,_0x21f7('0xd2'),_0x339b94[_0x21f7('0xc9')]),_0x217e52[_0x21f7('0xaa')],_0x217e52['activeContact']);}}break;case _0x21f7('0xd6'):_0x339b94['outboundRejectCallsDay']+=0x1;_0x217e52[_0x21f7('0xd7')]+=0x1;_0x217e52[_0x21f7('0x9e')]=ut['totalGlobal'](_0x217e52);ut[_0x21f7('0x93')](_0x217e52,0x14,'AgentReject');ami[_0x21f7('0x26')](_0x21f7('0xd8'),ut[_0x21f7('0xa1')](_0x217e52,_0x21f7('0xd9')));rpcDb[_0x21f7('0x91')](_0x217e52,_0x21f7('0xda'));if(ut[_0x21f7('0x9f')](_0x217e52)>=_0x339b94[_0x21f7('0xa4')]){_0x23644a=ut[_0x21f7('0xa5')](_0x217e52,0x14,_0x21f7('0xdb'));rpcDb[_0x21f7('0xbb')](_0x23644a,_0x21f7('0xdc'));}else{if(_0x217e52[_0x21f7('0xd7')]>=_0x339b94['dialAgentRejectMaxRetry']){rpcDb[_0x21f7('0xbb')](_0x217e52,_0x21f7('0xdc'));}else{rpcDb[_0x21f7('0xc8')](ut[_0x21f7('0xd0')](_0x217e52,_0x21f7('0xd7'),_0x339b94['dialAgentRejectRetryFrequency']),_0x217e52[_0x21f7('0xaa')],_0x217e52[_0x21f7('0xab')]);}}break;case _0x21f7('0xdd'):_0x339b94[_0x21f7('0x46')]+=0x1;_0x217e52[_0x21f7('0xde')]+=0x1;_0x217e52['countglobal']=ut[_0x21f7('0x9f')](_0x217e52);ut[_0x21f7('0x93')](_0x217e52,0xb,_0x21f7('0xdf'));rpcDb[_0x21f7('0x91')](_0x217e52,_0x21f7('0xe0'));if(ut[_0x21f7('0x9f')](_0x217e52)>=_0x339b94[_0x21f7('0xa4')]){_0x23644a=ut[_0x21f7('0xa5')](_0x217e52,0xf,_0x21f7('0xc4'));rpcDb['createCustomerFinal'](_0x23644a,_0x21f7('0xe0'));}else{if(_0x217e52[_0x21f7('0xe1')]>=_0x339b94[_0x21f7('0xe2')]){rpcDb[_0x21f7('0xbb')](_0x217e52,_0x21f7('0xe0'));}else{rpcDb[_0x21f7('0xc8')](ut[_0x21f7('0xd0')](_0x217e52,_0x21f7('0xde'),_0x339b94[_0x21f7('0xe3')]),_0x217e52[_0x21f7('0xaa')],_0x217e52[_0x21f7('0xab')]);}}break;case'18':_0x339b94[_0x21f7('0x45')]+=0x1;_0x217e52[_0x21f7('0xe4')]+=0x1;_0x217e52[_0x21f7('0x9e')]=ut[_0x21f7('0x9f')](_0x217e52);ut[_0x21f7('0x93')](_0x217e52,0x12,_0x2f6d43[_0x21f7('0xe5')]||_0x2f6d43['dialstatus']);ami[_0x21f7('0x26')](_0x21f7('0xe6'),ut[_0x21f7('0xa1')](_0x217e52,_0x21f7('0xe7')));rpcDb[_0x21f7('0x91')](_0x217e52,_0x21f7('0xe8'));if(ut['totalGlobal'](_0x217e52)>=_0x339b94[_0x21f7('0xa4')]){_0x23644a=ut[_0x21f7('0xa5')](_0x217e52,0xf,'Global');rpcDb[_0x21f7('0xbb')](_0x23644a,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x217e52,_0x21f7('0xe8'));}delete this[_0x21f7('0x14')][_0x2f6d43[_0x21f7('0xac')]];break;case'19':_0x339b94[_0x21f7('0x45')]+=0x1;_0x217e52['countglobal']=ut['totalGlobal'](_0x217e52);ut['logCustomer'](_0x217e52,0x13,_0x2f6d43['cause-txt']||_0x2f6d43[_0x21f7('0xe9')]);ami[_0x21f7('0x26')](_0x21f7('0xe6'),ut[_0x21f7('0xa1')](_0x217e52,_0x21f7('0xe7')));rpcDb[_0x21f7('0x91')](_0x217e52,'[callProgressDetectingCustomer][machine]');if(ut[_0x21f7('0x9f')](_0x217e52)>=_0x339b94['dialGlobalMaxRetry']){_0x23644a=ut['cloneAction'](_0x217e52,0xf,_0x21f7('0xc4'));rpcDb[_0x21f7('0xbb')](_0x23644a,_0x21f7('0xea'));}else{rpcDb[_0x21f7('0xbb')](_0x217e52,_0x21f7('0xea'));}delete this[_0x21f7('0x14')][_0x2f6d43[_0x21f7('0xac')]];break;default:if(_0x217e52[_0x21f7('0x71')]){ut[_0x21f7('0x79')](_0x339b94,_0x21f7('0xeb'));ut[_0x21f7('0x7b')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x339b94[_0x21f7('0x28')],_0x2f6d43);}_0x339b94[_0x21f7('0x45')]+=0x1;_0x217e52[_0x21f7('0x9e')]=ut[_0x21f7('0x9f')](_0x217e52);ut[_0x21f7('0x93')](_0x217e52,0xc,_0x2f6d43[_0x21f7('0xe5')]||_0x2f6d43[_0x21f7('0xe9')]);rpcDb[_0x21f7('0x91')](_0x217e52,_0x21f7('0xec'));if(ut[_0x21f7('0x9f')](_0x217e52)>=_0x339b94['dialGlobalMaxRetry']){_0x23644a=ut[_0x21f7('0xa5')](_0x217e52,0xf,_0x21f7('0xc4'));rpcDb[_0x21f7('0xbb')](_0x23644a,_0x21f7('0xed'));}else{rpcDb[_0x21f7('0xbb')](_0x217e52,_0x21f7('0xed'));}delete this[_0x21f7('0x14')][_0x2f6d43['linkedid']];}if(!(_0x217e52[_0x21f7('0x71')]&&_0x16c5e5==='16')){ut[_0x21f7('0xee')](_0x339b94,_0x21f7('0xef'));logger[_0x21f7('0x5d')](_0x21f7('0xf0'),_0x217e52[_0x21f7('0xf1')],_0x21f7('0xbf'),_0x339b94['name'],_0x21f7('0xf2'),_0x339b94[_0x21f7('0x4f')]);}if(_0x16c5e5!==_0x21f7('0xad')){delete this[_0x21f7('0x14')][_0x2f6d43['linkedid']];delete this[_0x21f7('0x14')][_0x2f6d43['destlinkedid']];}}};Preview['prototype'][_0x21f7('0xf3')]=function(_0x49f7b0,_0x3c2601,_0x10b6c3){if(_[_0x21f7('0xf4')](_0x3c2601)&&_0x21f7('0xf5')!==typeof _0x3c2601){return;}if(_[_0x21f7('0xf4')](_0x10b6c3)&&'object'!==typeof _0x10b6c3){return;}switch(_0x10b6c3[_0x21f7('0xf6')]){case'0':ut[_0x21f7('0xf7')](_0x49f7b0,0x0,_0x21f7('0xa0'));rpcDb['createAgentHistory'](_0x49f7b0,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x21f7('0xf7')](_0x49f7b0,0x3,_0x21f7('0xcc'));rpcDb[_0x21f7('0xf8')](_0x49f7b0,_0x21f7('0xf9'));break;case'5':ut[_0x21f7('0xf7')](_0x49f7b0,0x5,_0x21f7('0xc2'));rpcDb[_0x21f7('0xf8')](_0x49f7b0,_0x21f7('0xfa'));break;case'8':ut[_0x21f7('0xf7')](_0x49f7b0,0x8,'Congestion');rpcDb[_0x21f7('0xf8')](_0x49f7b0,_0x21f7('0xfb'));break;case'22':ut[_0x21f7('0xf7')](_0x49f7b0,0x16,_0x21f7('0xfc'));rpcDb[_0x21f7('0xf8')](_0x49f7b0,_0x21f7('0xfd'));break;default:ut[_0x21f7('0xf7')](_0x49f7b0,0xc,_0x10b6c3[_0x21f7('0xf6')]);rpcDb['createAgentHistory'](_0x49f7b0,'[callProgressDetectingAgent][logCongestion]');}ut[_0x21f7('0xee')](_0x3c2601,_0x21f7('0xfe'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x49f7b0[_0x21f7('0xf1')],_0x21f7('0xbf'),_0x3c2601[_0x21f7('0x28')],_0x21f7('0xf2'),_0x3c2601[_0x21f7('0x4f')]);delete this[_0x21f7('0x14')][_0x49f7b0[_0x21f7('0xf1')]];};Preview[_0x21f7('0xe')][_0x21f7('0xff')]=function(_0x126076,_0x5be953,_0x193a27,_0xc14456,_0x1ef6df){var _0x966250=this;return new BPromise(function(_0x384be0,_0x49d66c){if(_[_0x21f7('0x82')](_0x5be953)||_[_0x21f7('0x82')](_0x5be953[_0x21f7('0x100')])||_[_0x21f7('0x82')](_0x5be953['Contact'][_0x21f7('0x101')])||_['isNil'](_0x5be953[_0x21f7('0x74')])){_0x49d66c(ut[_0x21f7('0x4e')](_0x21f7('0x102'),_0xc14456,_0x1ef6df));return;}var _0x386c00=uuid['v4']();var _0x5585e3=_0x966250[_0x21f7('0x12')][_0x5be953['Queue'][_0x21f7('0x28')]];var _0x3bca08=_0x193a27?_0x966250['agents'][_0x193a27]['id']:undefined;_0x966250[_0x21f7('0x14')][_0x386c00]=new Action(_0x5be953,_0x5585e3,_0x386c00,_0x193a27,_0x3bca08);var _0x2cd26d=_0x966250[_0x21f7('0x14')][_0x386c00];_0x2cd26d[_0x21f7('0xaa')]=_0xc14456;_0x2cd26d[_0x21f7('0xab')]=_0x1ef6df;_0x2cd26d[_0x21f7('0x103')]=_0x193a27;if(_[_0x21f7('0x104')](_0x126076)){_0x966250[_0x21f7('0x105')](_0x2cd26d,_0x5585e3,_0x5be953,_0x193a27)[_0x21f7('0x81')](function(_0x5138ef){logger[_0x21f7('0x5d')](_0x21f7('0x106'),_0x21f7('0x107')+_0x2cd26d['queue']+_0x21f7('0x108')+_0x2cd26d[_0x21f7('0x109')],JSON[_0x21f7('0x59')](_0x5138ef));ami['emit'](_0x21f7('0x10a'),ut[_0x21f7('0xa1')](_0x2cd26d,'called',_0x966250[_0x21f7('0x12')][_0x2cd26d[_0x21f7('0x70')]]));_0x384be0(ut['message'](_0x21f7('0x10b')));})[_0x21f7('0x78')](function(_0x459a72){ut[_0x21f7('0x65')](_0x21f7('0x10c'),_0x459a72);_0x49d66c(ut[_0x21f7('0x4e')](_0x21f7('0x10d'),_0xc14456,_0x1ef6df));});}else{_0x5585e3[_0x21f7('0x3c')]+=0x1;ut[_0x21f7('0x10e')](_0x2cd26d);rpcDb[_0x21f7('0x10f')](_0x2cd26d,'[Blacklist][error]');delete _0x966250[_0x21f7('0x14')][_0x386c00];_0x49d66c(ut[_0x21f7('0x4e')](_0x21f7('0x110'),_0xc14456,_0x1ef6df));}});};Preview[_0x21f7('0xe')][_0x21f7('0x9a')]=function(_0x4e8fbd){return!_['isNil'](_0x4e8fbd)&&!_[_0x21f7('0x82')](_0x4e8fbd[_0x21f7('0x28')])&&!_[_0x21f7('0x82')](_0x4e8fbd[_0x21f7('0x56')])&&_0x4e8fbd[_0x21f7('0x56')]&&!_['isNil'](this['trunks'][util['format'](_0x21f7('0x111'),_0x4e8fbd['name'])])&&!_[_0x21f7('0x82')](this['trunks'][util[_0x21f7('0x5b')]('SIP/%s',_0x4e8fbd[_0x21f7('0x28')])]['status'])&&(this[_0x21f7('0x13')][util[_0x21f7('0x5b')](_0x21f7('0x111'),_0x4e8fbd[_0x21f7('0x28')])][_0x21f7('0x112')]===_0x21f7('0x113')||this['trunks'][util[_0x21f7('0x5b')](_0x21f7('0x111'),_0x4e8fbd[_0x21f7('0x28')])][_0x21f7('0x112')]===_0x21f7('0x114'));};Preview[_0x21f7('0xe')][_0x21f7('0x89')]=function(_0x5845fe,_0x30d451){var _0x1456f4=this;return new BPromise(function(_0x46402d,_0x323a8f){_0x1456f4[_0x21f7('0x115')](_0x5845fe,_0x30d451)[_0x21f7('0x81')](function(_0x11356f){_0x46402d(_[_0x21f7('0x72')](_0x11356f,[_0x21f7('0x4e')]));})[_0x21f7('0x78')](function(_0x49b9f8){if(_0x49b9f8[_0x21f7('0x116')]){rpcDb[_0x21f7('0x117')](_0x5845fe);}if(_0x49b9f8[_0x21f7('0x56')]){rpcDb[_0x21f7('0x8c')](_0x5845fe);}_0x323a8f(_[_0x21f7('0x72')](_0x49b9f8,[_0x21f7('0x4e')]));});});};Preview[_0x21f7('0xe')]['execRun']=function(_0x125d5e,_0x262a31){var _0x1fdc2e=this;return new BPromise(function(_0x505990,_0x537487){var _0x50ca3b,_0x20b70e;rpcDb[_0x21f7('0x118')](_0x125d5e)[_0x21f7('0x81')](function(_0x53992){if(!_['isNil'](_0x53992[0x0])){_0x20b70e=_0x53992[0x0][_0x21f7('0x119')]?![]:!![];_0x50ca3b=_0x53992[0x0]['recallme']?!![]:![];_0x50ca3b=_0x262a31?!![]:_0x50ca3b;}var _0x1574c2=_0x1fdc2e['validateContact'](_0x53992);if(_0x1574c2[_0x21f7('0x11a')]){rpcDb[_0x21f7('0x11b')](_['pick'](_0x53992[0x0],[_0x21f7('0x74'),'Contact.phone']))[_0x21f7('0x81')](function(_0x5cc754){_0x1fdc2e[_0x21f7('0xff')](_0x5cc754,_0x53992[0x0],_0x262a31,_0x20b70e,_0x50ca3b)[_0x21f7('0x81')](function(_0x1a8db0){_0x505990(_0x1a8db0);})[_0x21f7('0x78')](function(_0x17a9bf){_0x537487(_0x17a9bf);});})[_0x21f7('0x78')](function(_0x5eb132){ut[_0x21f7('0x65')](_0x21f7('0x11c'),_0x5eb132);_0x537487(ut['message']('Call\x20unsuccessful',_0x20b70e,_0x50ca3b));});}else{_0x537487(ut[_0x21f7('0x4e')](_0x1574c2[_0x21f7('0x4e')],_0x20b70e,_0x50ca3b));}})[_0x21f7('0x78')](function(_0xd1d332){ut[_0x21f7('0x65')](_0x21f7('0x11d'),_0xd1d332);_0x537487(ut['message']('Call\x20unsuccessful',![],!![]));});});};Preview[_0x21f7('0xe')][_0x21f7('0x11e')]=function(_0x21f8e6){if(_['isNil'](_0x21f8e6)||_[_0x21f7('0x104')](_0x21f8e6)||!_[_0x21f7('0x82')](_0x21f8e6[0x0][_0x21f7('0x87')])&&_['isNil'](_0x21f8e6[0x0][_0x21f7('0x87')][_0x21f7('0x28')])){ut[_0x21f7('0x65')](_0x21f7('0x11f'),_0x21f8e6);return{'isValid':![],'message':_0x21f7('0x120')};}var _0x1644e6=this[_0x21f7('0x12')][_0x21f8e6[0x0][_0x21f7('0x121')][_0x21f7('0x28')]];_0x1644e6[_0x21f7('0x4e')]=_0x21f7('0x9c');if(_[_0x21f7('0x82')](_0x1644e6)){ut[_0x21f7('0x65')](_0x21f7('0x122'),_0x1644e6);return{'isValid':![],'message':_0x21f7('0x123')};}if(!this[_0x21f7('0x9a')](_0x1644e6[_0x21f7('0x55')])){ut[_0x21f7('0x65')](_0x21f7('0x124'),_0x21f7('0x125')+_0x1644e6[_0x21f7('0x28')]+_0x21f7('0x126'));if(!this['isTrunkReachable'](_0x1644e6['TrunkBackup'])){ut[_0x21f7('0x65')](_0x21f7('0x124'),_0x1644e6['name']+_0x21f7('0x127'));return{'isValid':![],'message':_0x21f7('0x128')};}}if(!ut['isActive'](_0x1644e6[_0x21f7('0x34')])){ut['logger'](_0x21f7('0x129'),_0x1644e6['name']+'\x20Not\x20Active');return{'isValid':![],'message':_0x21f7('0x125')+_0x1644e6[_0x21f7('0x28')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x21f7('0x12a')};};Preview['prototype'][_0x21f7('0x105')]=function(_0x36756e,_0x1060e3,_0x3173ce,_0xcd490c){var _0x5b449a=this;return new BPromise(function(_0x404232,_0xc62636){var _0x4a721d=_0x36756e['uniqueid'];var _0x1163f2=_0x5b449a[_0x21f7('0x9a')](_0x1060e3['Trunk'])?util[_0x21f7('0x5b')](_0x21f7('0x12b'),_0x1060e3['Trunk']['name'],_[_0x21f7('0x82')](_0x1060e3['dialPrefix'])?'':_0x1060e3[_0x21f7('0x39')][_0x21f7('0x12c')]()||'',_0x1060e3[_0x21f7('0x12d')]>0x0?_0x3173ce['Contact'][_0x21f7('0x101')][_0x21f7('0x12e')](_0x1060e3['dialCutDigit']):_0x3173ce['Contact'][_0x21f7('0x101')]):util['format'](_0x21f7('0x12b'),_['isNil'](_0x1060e3[_0x21f7('0x12f')])?_0x1060e3['Trunk']['name']:_0x1060e3['TrunkBackup'][_0x21f7('0x28')],_[_0x21f7('0x82')](_0x1060e3['dialPrefix'])?'':_0x1060e3['dialPrefix'][_0x21f7('0x12c')]()||'',_0x1060e3[_0x21f7('0x12d')]>0x0?_0x3173ce['Contact'][_0x21f7('0x101')][_0x21f7('0x12e')](_0x1060e3[_0x21f7('0x12d')]):_0x3173ce[_0x21f7('0x100')]['phone']);var _0x489fa1=_0x5b449a[_0x21f7('0x9a')](_0x1060e3[_0x21f7('0x55')])?ut[_0x21f7('0x130')](_0x1060e3['Trunk'][_0x21f7('0x57')],_0x1060e3[_0x21f7('0x36')],_0x1060e3['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x1060e3[_0x21f7('0x37')],_0x1060e3['dialRandomLastDigitCallerIdNumber']):_0x1060e3[_0x21f7('0x37')]):ut[_0x21f7('0x130')](_[_0x21f7('0x82')](_0x1060e3[_0x21f7('0x12f')])?_0x1060e3['Trunk'][_0x21f7('0x57')]:_0x1060e3[_0x21f7('0x12f')][_0x21f7('0x57')],_0x1060e3[_0x21f7('0x36')],_0x1060e3[_0x21f7('0x131')]>0x0?ut[_0x21f7('0x132')](_0x1060e3[_0x21f7('0x37')],_0x1060e3[_0x21f7('0x131')]):_0x1060e3[_0x21f7('0x37')]);if(_0x489fa1){_0x36756e[_0x21f7('0x133')]=ut[_0x21f7('0x134')](_0x489fa1);_0x36756e['originatecalleridnum']=ut[_0x21f7('0x135')](_0x489fa1);}var _0x535c57=ut['addVariables'](_0x1060e3,_0x3173ce,_0x1163f2,_0x489fa1,_0x4a721d,_0x36756e);_[_0x21f7('0x136')](_0x36756e,ut[_0x21f7('0x137')](_0x535c57));_0x36756e['starttime']=moment()[_0x21f7('0x5b')](_0x21f7('0xae'));ami[_0x21f7('0x76')](ut['variablesAction'](_0x36756e,_0x1060e3,_0x535c57,_0x36756e[_0x21f7('0xab')],_0xcd490c))[_0x21f7('0x81')](function(_0x3c2800){var _0x104a9f=_0x36756e[_0x21f7('0x138')];if(!_['isNil'](_0x104a9f)){if(!_[_0x21f7('0x82')](_0x5b449a[_0x21f7('0x15')][_0x104a9f])){_0x5b449a[_0x21f7('0x15')][_0x104a9f][_0x21f7('0x139')]=_0x36756e[_0x21f7('0x13a')];emit(util[_0x21f7('0x5b')](_0x21f7('0x13b'),_0x5b449a['agents'][_0x104a9f][_0x21f7('0x28')]),_0x21f7('0x13c'),{'destaccountcode':_0x5b449a[_0x21f7('0x15')][_0x104a9f][_0x21f7('0x13d')],'destconnectedlinenum':_0x36756e[_0x21f7('0x13a')]});}}_0x1060e3[_0x21f7('0x4f')]+=0x1;logger[_0x21f7('0x5d')]('[originated][increment]',_0x4a721d,'\x20Queue',_0x1060e3[_0x21f7('0x28')],'originated:\x20',_0x1060e3[_0x21f7('0x4f')]);_0x404232(_0x3c2800);})[_0x21f7('0x78')](function(_0x3a0747){ut[_0x21f7('0xf7')](_0x36756e,0xe,_0x21f7('0x13e'));rpcDb[_0x21f7('0xf8')](_0x36756e,_0x21f7('0x13f'));_0xc62636(_0x3a0747);});});};Preview[_0x21f7('0xe')][_0x21f7('0x140')]=function(_0x1f1f2d){if(this[_0x21f7('0x14')][_0x1f1f2d[_0x21f7('0xac')]]){this[_0x21f7('0x14')][_0x1f1f2d['linkedid']][_0x21f7('0x77')]=_0x1f1f2d[_0x21f7('0x77')];}};Preview[_0x21f7('0xe')][_0x21f7('0x18')]=function(_0x4553fe){var _0x7ea62c=this;var _0xe4f8ef=this[_0x21f7('0x14')][_0x4553fe['actionid']];if(_0xe4f8ef){if(_0xe4f8ef['lookAgent']&&this[_0x21f7('0x15')][_0xe4f8ef[_0x21f7('0x103')]]){ut[_0x21f7('0x141')](_0xe4f8ef,this[_0x21f7('0x15')][_0xe4f8ef['lookAgent']][_0x21f7('0x28')],this[_0x21f7('0x15')][_0xe4f8ef[_0x21f7('0x103')]]['id']);}var _0x150f39=_[_0x21f7('0x142')](_0xe4f8ef);_0x150f39['responsetime']=moment()[_0x21f7('0x5b')](_0x21f7('0xae'));var _0x2e0ee8=_0x7ea62c[_0x21f7('0x12')][_0xe4f8ef[_0x21f7('0x70')]];if(ut[_0x21f7('0x143')](_0x4553fe[_0x21f7('0x144')])){if(_0xe4f8ef[_0x21f7('0xaa')]){rpcDb[_0x21f7('0x117')](_0xe4f8ef[_0x21f7('0x109')]);}if(_0xe4f8ef[_0x21f7('0xab')]){rpcDb[_0x21f7('0x8c')](_0xe4f8ef[_0x21f7('0x109')]);}ami[_0x21f7('0x26')]('custom:agentringnoanswer',ut[_0x21f7('0xa1')](_0xe4f8ef,_0x21f7('0x145'),this['campaignsPreview'][_0xe4f8ef[_0x21f7('0x70')]]));this[_0x21f7('0xf3')](_0x150f39,_0x2e0ee8,_0x4553fe);}else{_0xe4f8ef[_0x21f7('0x146')]=moment()[_0x21f7('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x21f7('0xf7')](_0x150f39,0x4,'Answer');rpcDb[_0x21f7('0xf8')](_0x150f39,'[callProgressDetectingAgent][logAnswer]');}}};Preview['prototype']['syncHangup']=function(_0x3a6267){var _0xd6e07e=this;var _0xfa2401=this[_0x21f7('0x14')][_0x3a6267[_0x21f7('0xac')]];var _0x5a5896;if(_0xfa2401){_0x5a5896=this[_0x21f7('0x12')][_0xfa2401['queue']];logger[_0x21f7('0x5d')](_0x21f7('0x147'),_0x3a6267[_0x21f7('0xac')],_0x21f7('0xbf'),_0x5a5896[_0x21f7('0x28')],_0x21f7('0x6f'),_0x5a5896['pTalking']);}if(this[_0x21f7('0x14')][_0x3a6267['linkedid']]&&_0x3a6267[_0x21f7('0xac')]!==_0x3a6267['uniqueid']){if(_0x3a6267['cause']==='16'&&this[_0x21f7('0x14')][_0x3a6267['linkedid']][_0x21f7('0x71')]){this['callProgressDetectingCustomer'](_0x3a6267,_0x3a6267[_0x21f7('0xac')],_0x3a6267[_0x21f7('0x148')]);}else if(this[_0x21f7('0x14')][_0x3a6267['linkedid']][_0x21f7('0x71')]){logger[_0x21f7('0x5d')](_0x21f7('0x149'),_0x3a6267[_0x21f7('0xac')],_0x3a6267[_0x21f7('0x148')],'\x20Queue',_0x5a5896[_0x21f7('0x28')],_0x21f7('0x6f'),_0x5a5896[_0x21f7('0x2b')]);this['callProgressDetectingCustomer'](_0x3a6267,_0x3a6267[_0x21f7('0xac')],_0x3a6267[_0x21f7('0x148')]);}}else if(_0xfa2401&&_[_0x21f7('0x82')](_0xfa2401[_0x21f7('0x14a')])&&_0x5a5896[_0x21f7('0x14b')]&&_0x3a6267['linkedid']===_0x3a6267[_0x21f7('0xf1')]&&_[_0x21f7('0x82')](_0x3a6267['reason'])&&_0x3a6267[_0x21f7('0x148')]==='16'&&_0x3a6267[_0x21f7('0x14c')]==='6'&&_[_0x21f7('0xf4')](_0xfa2401['transfer'])){if(_0xfa2401[_0x21f7('0xaa')]){rpcDb[_0x21f7('0x117')](_0xfa2401[_0x21f7('0x109')]);}if(_0xfa2401[_0x21f7('0xab')]){rpcDb['disableContact'](_0xfa2401['idContact']);}_0x3a6267[_0x21f7('0xf6')]='22';this['callProgressDetectingAgent'](_0xfa2401,_0x5a5896,_0x3a6267);}else if(_0xfa2401&&_0xfa2401['transfer']){if(_0x3a6267['cause']==='16'&&this[_0x21f7('0x14')][_0x3a6267[_0x21f7('0xac')]]['dialAnswer']){logger['info'](_0x21f7('0x14d'),_0x3a6267[_0x21f7('0xac')],_0x3a6267[_0x21f7('0x148')],_0x21f7('0xbf'),_0x5a5896['name'],'pTalking:\x20',_0x5a5896[_0x21f7('0x2b')]);this['callProgressDetectingCustomer'](_0x3a6267,_0x3a6267[_0x21f7('0xac')],_0x3a6267[_0x21f7('0x148')]);}else if(this[_0x21f7('0x14')][_0x3a6267[_0x21f7('0xac')]][_0x21f7('0x71')]){logger['info'](_0x21f7('0x149'),_0x3a6267[_0x21f7('0xac')],_0x3a6267[_0x21f7('0x148')],_0x21f7('0xbf'),_0x5a5896[_0x21f7('0x28')],'pTalking:\x20',_0x5a5896[_0x21f7('0x2b')]);this[_0x21f7('0x9d')](_0x3a6267,_0x3a6267[_0x21f7('0xac')],_0x3a6267[_0x21f7('0x148')]);}}};Preview[_0x21f7('0xe')]['syncDialEnd']=function(_0x573296){if(this[_0x21f7('0x14')][_0x573296[_0x21f7('0x14e')]]&&_0x573296[_0x21f7('0x14e')]!==_0x573296[_0x21f7('0x14f')]){this[_0x21f7('0x9d')](_0x573296,_0x573296['destlinkedid'],_0x573296[_0x21f7('0xe9')]);}};Preview[_0x21f7('0xe')][_0x21f7('0x1c')]=function(_0x25e54f){if(this[_0x21f7('0x14')][_0x25e54f[_0x21f7('0xac')]]&&_0x25e54f[_0x21f7('0xac')]!==_0x25e54f[_0x21f7('0xf1')]&&!this[_0x21f7('0x14')][_0x25e54f[_0x21f7('0xac')]]['dialAnswer']){if(_0x25e54f[_0x21f7('0x148')]==='1'){this[_0x21f7('0x9d')](_0x25e54f,_0x25e54f[_0x21f7('0xac')],_0x25e54f[_0x21f7('0x148')]);}}};Preview[_0x21f7('0xe')]['addVariable']=function(_0x46ed47,_0x5d280b,_0x25f915){if(this[_0x21f7('0x14')][_0x46ed47]){if(_[_0x21f7('0x82')](this[_0x21f7('0x14')][_0x46ed47][_0x21f7('0x150')])){this[_0x21f7('0x14')][_0x46ed47][_0x21f7('0x150')]={};}this[_0x21f7('0x14')][_0x46ed47]['variables'][_0x5d280b]=_0x25f915;}};Preview[_0x21f7('0xe')][_0x21f7('0x20')]=function(_0x37f0ff){try{if(!_['isNil'](_0x37f0ff)){if(ut['filterKey'](_['keys'](_0x37f0ff['variable'])[0x0])){this[_0x21f7('0x151')](_0x37f0ff[_0x21f7('0xf1')],_[_0x21f7('0x152')](_0x37f0ff['variable'])[0x0],_0x37f0ff[_0x21f7('0x153')]);}}}catch(_0x45b58c){logger['error'](_0x21f7('0x154'),util[_0x21f7('0x155')](_0x45b58c,{'showHidden':![],'depth':null}));}};Preview[_0x21f7('0xe')][_0x21f7('0x22')]=function(_0x4c7bbf){if(_0x4c7bbf){if(this[_0x21f7('0x14')][_0x4c7bbf['transfertargetlinkedid']]){this[_0x21f7('0x14')][_0x4c7bbf[_0x21f7('0x156')]][_0x21f7('0x157')]=!![];}}};Preview[_0x21f7('0xe')][_0x21f7('0x24')]=function(_0x1f9252){if(_0x1f9252){if(this[_0x21f7('0x14')][_0x1f9252['transfererlinkedid']]){this['actions'][_0x1f9252[_0x21f7('0x158')]]['transfer']=!![];}}};module[_0x21f7('0x159')]=Preview; \ No newline at end of file +var _0xef03=['idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','createHistory','[Blacklist][error]','trunks','SIP/%s','status','reachable','unmonitored','execRun','unlockContact','disableContact','getContactPreview','recallme','Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Queue','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','\x20Not\x20Active','campaign\x20Name:\x20','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','trim','getCallerId','callerid','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','channelAgent','destconnectedlinenum','calleridnum','user:agentconnect','accountcode','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','variables','filterKey','variable','keys','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','abandoned','loggedInDb','dialMethod','dialOriginateCallerIdName','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','clearZombieChannels','dialActive','recallMe','clearZombieChannel','isNil','actions','info','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','pick','UserId','ListId','Action','catch','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','totalGlobal','NoSuchNumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','buildObj','complete','[16]','logCustomer','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','sumBillable','\x20Queue','countbusyretry','countglobal','Busy','custom:agentbusy','busy','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','custom:agentcongestion','congestion','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','Contact','phone','VoiceQueueId','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20'];(function(_0x286658,_0x4c08f8){var _0xf6a915=function(_0x1a55b6){while(--_0x1a55b6){_0x286658['push'](_0x286658['shift']());}};_0xf6a915(++_0x4c08f8);}(_0xef03,0x1b0));var _0x3ef0=function(_0x5e6507,_0x3c3c89){_0x5e6507=_0x5e6507-0x0;var _0x3f4e88=_0xef03[_0x5e6507];return _0x3f4e88;};'use strict';var util=require(_0x3ef0('0x0'));var _=require(_0x3ef0('0x1'));var BPromise=require(_0x3ef0('0x2'));var uuid=require(_0x3ef0('0x3'));var moment=require(_0x3ef0('0x4'));var md5=require(_0x3ef0('0x5'));var Redis=require(_0x3ef0('0x6'));var config=require(_0x3ef0('0x7'));var logger=require(_0x3ef0('0x8'))(_0x3ef0('0x9'));var loggerAction=require(_0x3ef0('0x8'))(_0x3ef0('0xa'));var ami=require(_0x3ef0('0xb'));var rpcDb=require(_0x3ef0('0xc'));var Action=require('./action');var ut=require(_0x3ef0('0xd'));config[_0x3ef0('0xe')]=_[_0x3ef0('0xf')](config['redis'],{'host':_0x3ef0('0x10'),'port':0x18eb});var io=require(_0x3ef0('0x11'))(new Redis(config[_0x3ef0('0xe')]));var Sequence=function(){};Sequence[_0x3ef0('0x12')][_0x3ef0('0x13')]=function(_0x387318){this[_0x3ef0('0x14')]=this[_0x3ef0('0x14')]?this[_0x3ef0('0x14')][_0x3ef0('0x15')](_0x387318):_0x387318();};function Preview(_0x1fc4ac){this[_0x3ef0('0x16')]=new Sequence();this[_0x3ef0('0x17')]=_0x1fc4ac[_0x3ef0('0x18')];this['trunks']=_0x1fc4ac['trunks'];this['actions']={};this[_0x3ef0('0x19')]=_0x1fc4ac[_0x3ef0('0x19')];this[_0x3ef0('0x1a')]=0x0;ami['on'](_0x3ef0('0x1b'),this['syncOriginateResponse'][_0x3ef0('0x1c')](this));ami['on'](_0x3ef0('0x1d'),this[_0x3ef0('0x1e')][_0x3ef0('0x1c')](this));ami['on'](_0x3ef0('0x1f'),this[_0x3ef0('0x20')][_0x3ef0('0x1c')](this));ami['on'](_0x3ef0('0x21'),this[_0x3ef0('0x22')][_0x3ef0('0x1c')](this));ami['on'](_0x3ef0('0x23'),this['syncNewExten'][_0x3ef0('0x1c')](this));ami['on'](_0x3ef0('0x24'),this['syncVarSet'][_0x3ef0('0x1c')](this));ami['on'](_0x3ef0('0x25'),this[_0x3ef0('0x26')][_0x3ef0('0x1c')](this));ami['on'](_0x3ef0('0x27'),this[_0x3ef0('0x28')][_0x3ef0('0x1c')](this));this[_0x3ef0('0x29')](this[_0x3ef0('0x17')]);}function emit(_0x5a37c8,_0x47c8e5,_0x42939d){io['to'](_0x5a37c8)[_0x3ef0('0x2a')](_0x47c8e5,_0x42939d);}function emitCampaignPreview(_0x332670){if(_0x332670[_0x3ef0('0x2b')]===_0x3ef0('0x2c')){var _0x476309={'id':_0x332670['id'],'name':_0x332670[_0x3ef0('0x2d')],'strategy':_0x332670[_0x3ef0('0x2e')],'answered':_0x332670[_0x3ef0('0x2f')],'available':_0x332670[_0x3ef0('0x30')],'loggedIn':_0x332670[_0x3ef0('0x31')],'pTalking':_0x332670[_0x3ef0('0x32')],'sumBillable':_0x332670['sumBillable'],'sumDuration':_0x332670[_0x3ef0('0x33')],'sumHoldTime':_0x332670[_0x3ef0('0x34')]||0x0,'talking':_0x332670[_0x3ef0('0x35')],'total':_0x332670[_0x3ef0('0x36')],'type':_0x332670[_0x3ef0('0x2b')],'unmanaged':_0x332670['unmanaged'],'abandoned':_0x332670[_0x3ef0('0x37')],'waiting':_0x332670['waiting'],'loggedInDb':_0x332670[_0x3ef0('0x38')],'dialActive':_0x332670['dialActive'],'dialMethod':_0x332670[_0x3ef0('0x39')],'dialOriginateCallerIdName':_0x332670[_0x3ef0('0x3a')],'dialOriginateCallerIdNumber':_0x332670['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x332670['dialOriginateTimeout'],'dialPrefix':_0x332670['dialPrefix'],'outboundAnswerAgiCallsDay':_0x332670[_0x3ef0('0x3b')],'outboundAnswerCallsDay':_0x332670[_0x3ef0('0x3c')],'outboundBlacklistCallsDay':_0x332670[_0x3ef0('0x3d')],'outboundBusyCallsDay':_0x332670[_0x3ef0('0x3e')],'outboundCongestionCallsDay':_0x332670['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x332670[_0x3ef0('0x3f')],'outboundDropCallsDayCallersExit':_0x332670['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x332670[_0x3ef0('0x40')],'outboundNoAnswerCallsDay':_0x332670[_0x3ef0('0x41')],'outboundNoSuchCallsDay':_0x332670[_0x3ef0('0x42')],'outboundOriginateFailureCallsDay':_0x332670[_0x3ef0('0x43')],'outboundReCallsDay':_0x332670[_0x3ef0('0x44')],'outboundRejectCallsDay':_0x332670[_0x3ef0('0x45')],'outboundUnknownCallsDay':_0x332670[_0x3ef0('0x46')],'outboundAbandonedCallsDay':_0x332670['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x332670[_0x3ef0('0x47')],'predictiveIntervalAvgHoldtime':_0x332670['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x332670['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x332670['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x332670[_0x3ef0('0x48')],'predictiveIntervalErlangCalls':_0x332670[_0x3ef0('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0x332670[_0x3ef0('0x4a')],'predictiveIntervalHitRate':_0x332670[_0x3ef0('0x4b')],'predictiveIntervalMultiplicativeFactor':_0x332670['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x332670[_0x3ef0('0x4c')],'predictiveIntervalAvailable':_0x332670[_0x3ef0('0x4d')],'predictiveIntervalTotalCalls':_0x332670[_0x3ef0('0x4e')],'message':_0x332670[_0x3ef0('0x4f')],'originated':_0x332670[_0x3ef0('0x50')],'erlangCalls':_0x332670[_0x3ef0('0x51')],'erlangCallToSecond':_0x332670[_0x3ef0('0x52')],'erlangAbandonmentRate':_0x332670[_0x3ef0('0x53')],'erlangBusyFactor':_0x332670[_0x3ef0('0x54')],'startPredictive':_0x332670['startPredictive'],'startProgressive':_0x332670['startProgressive']};if(_0x332670[_0x3ef0('0x55')]){_0x476309[_0x3ef0('0x55')]={'id':_0x332670[_0x3ef0('0x55')]['id'],'name':_0x332670['Trunk'][_0x3ef0('0x2d')],'active':_0x332670['Trunk'][_0x3ef0('0x56')],'callerid':_0x332670['Trunk']['callerid']};}if(_0x332670[_0x3ef0('0x57')]){_0x476309[_0x3ef0('0x57')]={'id':_0x332670[_0x3ef0('0x57')]['id'],'name':_0x332670['Interval'][_0x3ef0('0x2d')]};}var _0x353f89=md5(JSON[_0x3ef0('0x58')](_0x476309));if(_0x332670[_0x3ef0('0x5')]!==_0x353f89){_0x332670[_0x3ef0('0x5')]=_0x353f89;emit(util[_0x3ef0('0x59')](_0x3ef0('0x5a'),_0x476309[_0x3ef0('0x2d')]),_0x3ef0('0x5b'),_0x476309);}}}function emitVoiceQueueChannelRemove(_0x1e0b81){logger['info'](_0x3ef0('0x5c'),JSON[_0x3ef0('0x58')](_0x1e0b81));emit(util[_0x3ef0('0x59')](_0x3ef0('0x5a'),_0x1e0b81['name']),_0x3ef0('0x5d'),_0x1e0b81);io['emit'](_0x3ef0('0x5e'),_0x1e0b81);}function notSendMessagesQueue(_0x1e61ff){if(_0x1e61ff[_0x3ef0('0x5f')]){if(_0x1e61ff[_0x3ef0('0x50')]===0x0&&_0x1e61ff[_0x3ef0('0x32')]===0x0){_0x1e61ff[_0x3ef0('0x5f')]=![];_0x1e61ff['available']=0x0;_0x1e61ff['paused']=0x0;_0x1e61ff[_0x3ef0('0x4f')]=_0x3ef0('0x60');ut[_0x3ef0('0x61')](_0x3ef0('0x62'),_0x1e61ff[_0x3ef0('0x2d')]+_0x3ef0('0x63'));}else{_0x1e61ff['message']=_0x3ef0('0x64');ut[_0x3ef0('0x61')](_0x3ef0('0x62'),_0x1e61ff[_0x3ef0('0x2d')]+_0x3ef0('0x65'));}emitCampaignPreview(_0x1e61ff);}}Preview[_0x3ef0('0x12')][_0x3ef0('0x29')]=function(){var _0x3a4de3=this;setInterval(function(){_0x3a4de3['syncCampaigns']();},0x7cf);};Preview['prototype'][_0x3ef0('0x66')]=function(){var _0x50bc00=this['campaignsPreview'];this[_0x3ef0('0x1a')]+=0x1;for(var _0x500fb9 in _0x50bc00){if(_0x50bc00[_0x3ef0('0x67')](_0x500fb9)&&(_0x50bc00[_0x500fb9][_0x3ef0('0x39')]===_0x3ef0('0x9')||_0x50bc00[_0x500fb9][_0x3ef0('0x39')]==='booked')&&_0x50bc00[_0x500fb9]['type']===_0x3ef0('0x2c')){if(this[_0x3ef0('0x1a')]>0x7){this[_0x3ef0('0x1a')]=0x0;this[_0x3ef0('0x68')]();}}if(_0x50bc00[_0x3ef0('0x67')](_0x500fb9)&&_0x50bc00[_0x500fb9]['dialMethod']===_0x3ef0('0x9')&&_0x50bc00[_0x500fb9]['type']===_0x3ef0('0x2c')){if(_0x50bc00[_0x500fb9][_0x3ef0('0x69')]){this['setMessage'](_0x50bc00[_0x500fb9]);this[_0x3ef0('0x6a')](_0x50bc00[_0x500fb9]);}else{notSendMessagesQueue(_0x50bc00[_0x500fb9]);}}}};Preview['prototype'][_0x3ef0('0x6b')]=function(_0x25f317){var _0x36a469=this;this[_0x3ef0('0x16')][_0x3ef0('0x13')](function(){if(!_[_0x3ef0('0x6c')](_0x36a469[_0x3ef0('0x6d')][_0x25f317])){loggerAction[_0x3ef0('0x6e')](_0x3ef0('0x6f'),_0x25f317,'Queue',_0x36a469[_0x3ef0('0x6d')][_0x25f317][_0x3ef0('0x70')],_0x3ef0('0x71'),JSON[_0x3ef0('0x58')](_0x36a469[_0x3ef0('0x17')][_0x36a469[_0x3ef0('0x6d')][_0x25f317][_0x3ef0('0x70')]][_0x3ef0('0x50')]),_0x3ef0('0x72'),JSON[_0x3ef0('0x58')](_0x36a469[_0x3ef0('0x17')][_0x36a469[_0x3ef0('0x6d')][_0x25f317][_0x3ef0('0x70')]][_0x3ef0('0x32')]),JSON[_0x3ef0('0x58')](_0x36a469['actions'][_0x25f317]['dialAnswer']),JSON[_0x3ef0('0x58')](_[_0x3ef0('0x73')](_0x36a469['actions'][_0x25f317],['contactId',_0x3ef0('0x74'),'VoiceQueueId',_0x3ef0('0x75')])));return ami[_0x3ef0('0x76')]({'action':'status','channel':_0x36a469[_0x3ef0('0x6d')][_0x25f317]['channel']})[_0x3ef0('0x77')](function(_0x1eb395){if(_0x1eb395[_0x3ef0('0x4f')]===_0x3ef0('0x78')){setTimeout(function(){if(_0x36a469['actions'][_0x25f317]){ut['updateOriginated'](_0x36a469[_0x3ef0('0x17')][_0x36a469[_0x3ef0('0x6d')][_0x25f317][_0x3ef0('0x70')]],'[clearZombieChannel]');if(_0x36a469[_0x3ef0('0x6d')][_0x25f317][_0x3ef0('0x79')]===!![]){ut[_0x3ef0('0x7a')](_0x36a469[_0x3ef0('0x17')][_0x36a469[_0x3ef0('0x6d')][_0x25f317][_0x3ef0('0x70')]],_0x3ef0('0x7b'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x25f317,_0x36a469[_0x3ef0('0x6d')][_0x25f317][_0x3ef0('0x70')]);}ut['loggerError'](_0x3ef0('0x7c')+_0x25f317,_0x36a469[_0x3ef0('0x6d')][_0x25f317][_0x3ef0('0x70')]);delete _0x36a469['actions'][_0x25f317];}},0x2328);}});}});};Preview[_0x3ef0('0x12')][_0x3ef0('0x68')]=function(){var _0x12d820=this;loggerAction[_0x3ef0('0x6e')](_0x3ef0('0x7d'),_[_0x3ef0('0x7e')](this[_0x3ef0('0x6d')]));for(var _0x25e3a3 in this[_0x3ef0('0x6d')]){if(_0x12d820[_0x3ef0('0x6d')][_0x3ef0('0x67')](_0x25e3a3)){_0x12d820[_0x3ef0('0x6b')](_0x25e3a3);}}};Preview[_0x3ef0('0x12')]['recallMe']=function(_0x5cc16b){var _0x3e8fc7=this;rpcDb[_0x3ef0('0x7f')](_0x5cc16b['id'],ut[_0x3ef0('0x80')](this[_0x3ef0('0x19')]))[_0x3ef0('0x81')](function(_0x23269d){if(!_[_0x3ef0('0x6c')](_0x23269d)){for(var _0x3a4cf7=0x0;_0x3a4cf7<_0x23269d[_0x3ef0('0x82')];_0x3a4cf7+=0x1){if(ut['getDiff'](_0x23269d[_0x3a4cf7][_0x3ef0('0x83')])<_0x5cc16b['dialRecallMeTimeout']*0x3c){if(_0x23269d[_0x3a4cf7]['Agent']&&!_0x23269d[_0x3a4cf7][_0x3ef0('0x84')][_0x3ef0('0x85')]){_0x3e8fc7[_0x3ef0('0x86')](_0x23269d[_0x3a4cf7]['id'])[_0x3ef0('0x81')](ut[_0x3ef0('0x87')](_0x3ef0('0x88')))[_0x3ef0('0x77')](ut[_0x3ef0('0x87')]('[RecallMe]'));}else{rpcDb['disableContact'](_0x23269d[_0x3a4cf7]['id']);}}else{var _0x4c7914=new Action(_0x23269d[_0x3a4cf7],_0x5cc16b);_0x4c7914[_0x3ef0('0x89')]=moment()[_0x3ef0('0x59')](_0x3ef0('0x8a'));_0x5cc16b['outboundReCallsDay']+=0x1;ut['logCustomer'](_0x4c7914,0x17,_0x3ef0('0x8b'));if(_0x5cc16b[_0x3ef0('0x8c')]){rpcDb[_0x3ef0('0x8d')](ut[_0x3ef0('0x8e')](_0x23269d[_0x3a4cf7]));rpcDb[_0x3ef0('0x8f')](_0x4c7914,_0x3ef0('0x90'));}else{ut['logCustomer'](_0x4c7914,0x16,_0x3ef0('0x91'));rpcDb[_0x3ef0('0x8f')](_0x4c7914,_0x3ef0('0x92'));rpcDb[_0x3ef0('0x93')](_0x4c7914,'[HistoryRecallClose]');}}}}})[_0x3ef0('0x77')](ut[_0x3ef0('0x87')](_0x3ef0('0x94')));};Preview[_0x3ef0('0x12')][_0x3ef0('0x95')]=function(_0x44b9a7){_0x44b9a7[_0x3ef0('0x5f')]=!![];if(ut[_0x3ef0('0x96')](_0x44b9a7[_0x3ef0('0x31')])){_0x44b9a7[_0x3ef0('0x4f')]=_0x3ef0('0x97');}else if(!ut['isActive'](_0x44b9a7[_0x3ef0('0x69')])){_0x44b9a7[_0x3ef0('0x4f')]=_0x3ef0('0x60');}else if(!this[_0x3ef0('0x98')](_0x44b9a7[_0x3ef0('0x55')])){if(!this['isTrunkReachable'](_0x44b9a7[_0x3ef0('0x99')])){_0x44b9a7[_0x3ef0('0x4f')]='TRUNK_IS_NOT_REACHABLE';}else{_0x44b9a7['message']=_0x3ef0('0x9a');}}else{_0x44b9a7[_0x3ef0('0x4f')]=_0x3ef0('0x9a');}emitCampaignPreview(_0x44b9a7);};Preview[_0x3ef0('0x12')]['callProgressDetectingCustomer']=function(_0x2eccb8,_0x110aef,_0x513cd6){var _0x597a5e=this;var _0x52edaf=this[_0x3ef0('0x6d')][_0x110aef];var _0x5678a2=this[_0x3ef0('0x17')][_0x52edaf[_0x3ef0('0x70')]];var _0x11d127;if(_0x5678a2){switch(_0x513cd6){case'1':_0x5678a2[_0x3ef0('0x42')]+=0x1;_0x52edaf[_0x3ef0('0x9b')]+=0x1;_0x52edaf['countglobal']=ut[_0x3ef0('0x9c')](_0x52edaf);ut['logCustomer'](_0x52edaf,0x0,_0x3ef0('0x9d'));ami[_0x3ef0('0x2a')]('custom:agentnosuchnumber',ut['buildObj'](_0x52edaf,_0x3ef0('0x9e')));rpcDb['createCustomerHistory'](_0x52edaf,_0x3ef0('0x9f'));if(ut['totalGlobal'](_0x52edaf)>=_0x5678a2['dialGlobalMaxRetry']){_0x11d127=ut[_0x3ef0('0xa0')](_0x52edaf,0xf,_0x3ef0('0xa1'));rpcDb['createCustomerFinal'](_0x11d127,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x52edaf[_0x3ef0('0x9b')]>=_0x5678a2['dialNoSuchNumberMaxRetry']){rpcDb[_0x3ef0('0x93')](_0x52edaf,_0x3ef0('0xa2'));}else{rpcDb[_0x3ef0('0xa3')](ut[_0x3ef0('0xa4')](_0x52edaf,'countnosuchnumberretry',_0x5678a2['dialNoSuchNumberRetryFrequency']),_0x52edaf[_0x3ef0('0xa5')],_0x52edaf[_0x3ef0('0xa6')]);}}delete this[_0x3ef0('0x6d')][_0x2eccb8[_0x3ef0('0xa7')]];break;case _0x3ef0('0xa8'):var _0x436391=moment()[_0x3ef0('0x59')](_0x3ef0('0x8a'));_0x52edaf[_0x3ef0('0xa9')]=_0x436391;_0x52edaf[_0x3ef0('0xaa')]=_0x436391;_0x52edaf[_0x3ef0('0x79')]=!![];_0x5678a2[_0x3ef0('0x32')]+=0x1;logger[_0x3ef0('0x6e')](_0x3ef0('0xab'),_0x52edaf[_0x3ef0('0xac')],'\x20Queue',_0x5678a2[_0x3ef0('0x2d')],_0x3ef0('0x72'),_0x5678a2[_0x3ef0('0x32')]);ami['emit'](_0x3ef0('0xad'),ut['buildObj'](_0x52edaf,_0x3ef0('0xae'),this[_0x3ef0('0x17')][_0x52edaf[_0x3ef0('0x70')]]));if(_0x5678a2['acw']){ami[_0x3ef0('0x2a')](_0x3ef0('0xaf'),ut[_0x3ef0('0xb0')](_0x52edaf));}break;case'16':ami['emit'](_0x3ef0('0xb1'),ut[_0x3ef0('0xb2')](_0x52edaf,_0x3ef0('0xb3'),this[_0x3ef0('0x17')][_0x52edaf[_0x3ef0('0x70')]]));emitVoiceQueueChannelRemove(ut[_0x3ef0('0xb2')](_0x52edaf,'complete'));_0x5678a2[_0x3ef0('0x3c')]+=0x1;_0x5678a2['total']+=0x1;_0x5678a2['answered']+=0x1;ut[_0x3ef0('0x7a')](_0x5678a2,_0x3ef0('0xb4'));_0x52edaf['countglobal']=ut[_0x3ef0('0x9c')](_0x52edaf);ut[_0x3ef0('0xb5')](_0x52edaf,0x4,_0x3ef0('0xb6'));rpcDb[_0x3ef0('0x8f')](_0x52edaf,_0x3ef0('0xb7'));rpcDb['createCustomerFinal'](_0x52edaf,_0x3ef0('0xb8'));rpcDb[_0x3ef0('0xb9')](_0x52edaf);_0x5678a2[_0x3ef0('0x33')]+=_0x52edaf[_0x3ef0('0xba')];_0x5678a2[_0x3ef0('0xbb')]+=_0x52edaf['talktime'];logger[_0x3ef0('0x6e')]('[syncHangup][talking][decrement]',_0x52edaf['uniqueid'],_0x3ef0('0xbc'),_0x5678a2['name'],_0x3ef0('0x72'),_0x5678a2[_0x3ef0('0x32')]);delete this[_0x3ef0('0x6d')][_0x2eccb8[_0x3ef0('0xa7')]];break;case'BUSY':_0x5678a2['outboundBusyCallsDay']+=0x1;_0x52edaf[_0x3ef0('0xbd')]+=0x1;_0x52edaf[_0x3ef0('0xbe')]=ut['totalGlobal'](_0x52edaf);ut[_0x3ef0('0xb5')](_0x52edaf,0x5,_0x3ef0('0xbf'));ami[_0x3ef0('0x2a')](_0x3ef0('0xc0'),ut[_0x3ef0('0xb2')](_0x52edaf,_0x3ef0('0xc1')));rpcDb[_0x3ef0('0x8f')](_0x52edaf,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x3ef0('0x9c')](_0x52edaf)>=_0x5678a2[_0x3ef0('0xc2')]){_0x11d127=ut['cloneAction'](_0x52edaf,0xf,_0x3ef0('0xa1'));rpcDb['createCustomerFinal'](_0x11d127,_0x3ef0('0xc3'));}else{if(_0x52edaf[_0x3ef0('0xbd')]>=_0x5678a2[_0x3ef0('0xc4')]){rpcDb[_0x3ef0('0x93')](_0x52edaf,_0x3ef0('0xc5'));}else{rpcDb[_0x3ef0('0xa3')](ut[_0x3ef0('0xa4')](_0x52edaf,_0x3ef0('0xbd'),_0x5678a2[_0x3ef0('0xc6')]),_0x52edaf[_0x3ef0('0xa5')],_0x52edaf[_0x3ef0('0xa6')]);}}break;case _0x3ef0('0xc7'):_0x5678a2[_0x3ef0('0x41')]+=0x1;_0x52edaf[_0x3ef0('0xc8')]+=0x1;_0x52edaf[_0x3ef0('0xbe')]=ut['totalGlobal'](_0x52edaf);ut[_0x3ef0('0xb5')](_0x52edaf,0x3,_0x3ef0('0xc9'));ami[_0x3ef0('0x2a')](_0x3ef0('0xca'),ut[_0x3ef0('0xb2')](_0x52edaf,'noanswer'));rpcDb['createCustomerHistory'](_0x52edaf,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x3ef0('0x9c')](_0x52edaf)>=_0x5678a2[_0x3ef0('0xc2')]){_0x11d127=ut[_0x3ef0('0xa0')](_0x52edaf,0xf,_0x3ef0('0xa1'));rpcDb[_0x3ef0('0x93')](_0x11d127,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x52edaf[_0x3ef0('0xc8')]>=_0x5678a2['dialNoAnswerMaxRetry']){rpcDb[_0x3ef0('0x93')](_0x52edaf,_0x3ef0('0xcb'));}else{rpcDb[_0x3ef0('0xa3')](ut[_0x3ef0('0xa4')](_0x52edaf,_0x3ef0('0xc8'),_0x5678a2[_0x3ef0('0xcc')]),_0x52edaf[_0x3ef0('0xa5')],_0x52edaf[_0x3ef0('0xa6')]);}}break;case _0x3ef0('0xcd'):_0x5678a2['outboundCongestionCallsDay']+=0x1;_0x52edaf[_0x3ef0('0xce')]+=0x1;_0x52edaf['countglobal']=ut[_0x3ef0('0x9c')](_0x52edaf);ut[_0x3ef0('0xb5')](_0x52edaf,0x8,'Congestion');ami[_0x3ef0('0x2a')](_0x3ef0('0xcf'),ut['buildObj'](_0x52edaf,_0x3ef0('0xd0')));rpcDb['createCustomerHistory'](_0x52edaf,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0x3ef0('0x9c')](_0x52edaf)>=_0x5678a2[_0x3ef0('0xc2')]){_0x11d127=ut['cloneAction'](_0x52edaf,0xf,_0x3ef0('0xa1'));rpcDb['createCustomerFinal'](_0x11d127,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x52edaf[_0x3ef0('0xce')]>=_0x5678a2[_0x3ef0('0xd1')]){rpcDb[_0x3ef0('0x93')](_0x52edaf,_0x3ef0('0xd2'));}else{rpcDb[_0x3ef0('0xa3')](ut[_0x3ef0('0xa4')](_0x52edaf,_0x3ef0('0xce'),_0x5678a2[_0x3ef0('0xc6')]),_0x52edaf[_0x3ef0('0xa5')],_0x52edaf['activeContact']);}}break;case _0x3ef0('0xd3'):_0x5678a2['outboundRejectCallsDay']+=0x1;_0x52edaf[_0x3ef0('0xd4')]+=0x1;_0x52edaf[_0x3ef0('0xbe')]=ut[_0x3ef0('0x9c')](_0x52edaf);ut[_0x3ef0('0xb5')](_0x52edaf,0x14,_0x3ef0('0xd5'));ami['emit'](_0x3ef0('0xd6'),ut['buildObj'](_0x52edaf,_0x3ef0('0xd7')));rpcDb[_0x3ef0('0x8f')](_0x52edaf,'[syncHangupRequest][logAgentReject]');if(ut[_0x3ef0('0x9c')](_0x52edaf)>=_0x5678a2['dialGlobalMaxRetry']){_0x11d127=ut['cloneAction'](_0x52edaf,0x14,_0x3ef0('0xd5'));rpcDb[_0x3ef0('0x93')](_0x11d127,_0x3ef0('0xd8'));}else{if(_0x52edaf[_0x3ef0('0xd4')]>=_0x5678a2[_0x3ef0('0xd9')]){rpcDb[_0x3ef0('0x93')](_0x52edaf,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x3ef0('0xa3')](ut['scheduledAt'](_0x52edaf,_0x3ef0('0xd4'),_0x5678a2[_0x3ef0('0xda')]),_0x52edaf[_0x3ef0('0xa5')],_0x52edaf['activeContact']);}}break;case _0x3ef0('0xdb'):_0x5678a2['outboundAbandonedCallsDay']+=0x1;_0x52edaf[_0x3ef0('0xdc')]+=0x1;_0x52edaf[_0x3ef0('0xbe')]=ut[_0x3ef0('0x9c')](_0x52edaf);ut[_0x3ef0('0xb5')](_0x52edaf,0xb,_0x3ef0('0xdd'));rpcDb['createCustomerHistory'](_0x52edaf,_0x3ef0('0xde'));if(ut['totalGlobal'](_0x52edaf)>=_0x5678a2['dialGlobalMaxRetry']){_0x11d127=ut[_0x3ef0('0xa0')](_0x52edaf,0xf,_0x3ef0('0xa1'));rpcDb[_0x3ef0('0x93')](_0x11d127,_0x3ef0('0xde'));}else{if(_0x52edaf[_0x3ef0('0xdf')]>=_0x5678a2[_0x3ef0('0xe0')]){rpcDb[_0x3ef0('0x93')](_0x52edaf,_0x3ef0('0xde'));}else{rpcDb['rescheduleContact'](ut[_0x3ef0('0xa4')](_0x52edaf,'countabandonedretry',_0x5678a2[_0x3ef0('0xe1')]),_0x52edaf[_0x3ef0('0xa5')],_0x52edaf[_0x3ef0('0xa6')]);}}break;case'18':_0x5678a2['outboundUnknownCallsDay']+=0x1;_0x52edaf[_0x3ef0('0xe2')]+=0x1;_0x52edaf[_0x3ef0('0xbe')]=ut[_0x3ef0('0x9c')](_0x52edaf);ut['logCustomer'](_0x52edaf,0x12,_0x2eccb8[_0x3ef0('0xe3')]||_0x2eccb8[_0x3ef0('0xe4')]);ami['emit'](_0x3ef0('0xe5'),ut[_0x3ef0('0xb2')](_0x52edaf,_0x3ef0('0xe6')));rpcDb['createCustomerHistory'](_0x52edaf,_0x3ef0('0xe7'));if(ut[_0x3ef0('0x9c')](_0x52edaf)>=_0x5678a2[_0x3ef0('0xc2')]){_0x11d127=ut[_0x3ef0('0xa0')](_0x52edaf,0xf,_0x3ef0('0xa1'));rpcDb[_0x3ef0('0x93')](_0x11d127,_0x3ef0('0xe7'));}else{rpcDb[_0x3ef0('0x93')](_0x52edaf,_0x3ef0('0xe7'));}delete this[_0x3ef0('0x6d')][_0x2eccb8[_0x3ef0('0xa7')]];break;case'19':_0x5678a2[_0x3ef0('0x46')]+=0x1;_0x52edaf[_0x3ef0('0xbe')]=ut['totalGlobal'](_0x52edaf);ut[_0x3ef0('0xb5')](_0x52edaf,0x13,_0x2eccb8[_0x3ef0('0xe3')]||_0x2eccb8['dialstatus']);ami[_0x3ef0('0x2a')](_0x3ef0('0xe5'),ut[_0x3ef0('0xb2')](_0x52edaf,'amd'));rpcDb[_0x3ef0('0x8f')](_0x52edaf,_0x3ef0('0xe8'));if(ut[_0x3ef0('0x9c')](_0x52edaf)>=_0x5678a2[_0x3ef0('0xc2')]){_0x11d127=ut[_0x3ef0('0xa0')](_0x52edaf,0xf,_0x3ef0('0xa1'));rpcDb[_0x3ef0('0x93')](_0x11d127,_0x3ef0('0xe8'));}else{rpcDb[_0x3ef0('0x93')](_0x52edaf,_0x3ef0('0xe8'));}delete this[_0x3ef0('0x6d')][_0x2eccb8['linkedid']];break;default:if(_0x52edaf[_0x3ef0('0x79')]){ut[_0x3ef0('0x7a')](_0x5678a2,_0x3ef0('0xe9'));ut['loggerError'](_0x3ef0('0xea')+_0x5678a2[_0x3ef0('0x2d')],_0x2eccb8);}_0x5678a2[_0x3ef0('0x46')]+=0x1;_0x52edaf[_0x3ef0('0xbe')]=ut[_0x3ef0('0x9c')](_0x52edaf);ut[_0x3ef0('0xb5')](_0x52edaf,0xc,_0x2eccb8['cause-txt']||_0x2eccb8['dialstatus']);rpcDb[_0x3ef0('0x8f')](_0x52edaf,_0x3ef0('0xeb'));if(ut[_0x3ef0('0x9c')](_0x52edaf)>=_0x5678a2['dialGlobalMaxRetry']){_0x11d127=ut[_0x3ef0('0xa0')](_0x52edaf,0xf,'Global');rpcDb['createCustomerFinal'](_0x11d127,_0x3ef0('0xec'));}else{rpcDb[_0x3ef0('0x93')](_0x52edaf,_0x3ef0('0xec'));}delete this[_0x3ef0('0x6d')][_0x2eccb8[_0x3ef0('0xa7')]];}if(!(_0x52edaf['dialAnswer']&&_0x513cd6==='16')){ut[_0x3ef0('0xed')](_0x5678a2,_0x3ef0('0xee'));logger[_0x3ef0('0x6e')](_0x3ef0('0xef'),_0x52edaf[_0x3ef0('0xac')],'\x20Queue',_0x5678a2[_0x3ef0('0x2d')],_0x3ef0('0x71'),_0x5678a2[_0x3ef0('0x50')]);}if(_0x513cd6!==_0x3ef0('0xa8')){delete this['actions'][_0x2eccb8[_0x3ef0('0xa7')]];delete this['actions'][_0x2eccb8[_0x3ef0('0xf0')]];}}};Preview[_0x3ef0('0x12')][_0x3ef0('0xf1')]=function(_0x47e0e6,_0x43a6d2,_0x3817ff){if(_[_0x3ef0('0xf2')](_0x43a6d2)&&_0x3ef0('0xf3')!==typeof _0x43a6d2){return;}if(_[_0x3ef0('0xf2')](_0x3817ff)&&'object'!==typeof _0x3817ff){return;}switch(_0x3817ff['reason']){case'0':ut['logAgent'](_0x47e0e6,0x0,'NoSuchNumber');rpcDb[_0x3ef0('0xf4')](_0x47e0e6,_0x3ef0('0xf5'));break;case'3':ut[_0x3ef0('0xf6')](_0x47e0e6,0x3,_0x3ef0('0xc9'));rpcDb[_0x3ef0('0xf4')](_0x47e0e6,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x3ef0('0xf6')](_0x47e0e6,0x5,'Busy');rpcDb[_0x3ef0('0xf4')](_0x47e0e6,_0x3ef0('0xf7'));break;case'8':ut[_0x3ef0('0xf6')](_0x47e0e6,0x8,_0x3ef0('0xf8'));rpcDb['createAgentHistory'](_0x47e0e6,_0x3ef0('0xf9'));break;case'22':ut[_0x3ef0('0xf6')](_0x47e0e6,0x16,_0x3ef0('0xfa'));rpcDb['createAgentHistory'](_0x47e0e6,_0x3ef0('0xfb'));break;default:ut[_0x3ef0('0xf6')](_0x47e0e6,0xc,_0x3817ff[_0x3ef0('0xfc')]);rpcDb['createAgentHistory'](_0x47e0e6,_0x3ef0('0xf9'));}ut['updateOriginated'](_0x43a6d2,_0x3ef0('0xfd'));logger[_0x3ef0('0x6e')]('[originated][decrement][callProgressDetectingAgent]',_0x47e0e6[_0x3ef0('0xac')],'\x20Queue',_0x43a6d2['name'],_0x3ef0('0x71'),_0x43a6d2['originated']);delete this[_0x3ef0('0x6d')][_0x47e0e6[_0x3ef0('0xac')]];};Preview[_0x3ef0('0x12')]['checkInBlack']=function(_0x405ad3,_0xa49a8a,_0x587b4b,_0x3db894,_0x5ac583){var _0x332f87=this;return new BPromise(function(_0x155050,_0x11924d){if(_['isNil'](_0xa49a8a)||_[_0x3ef0('0x6c')](_0xa49a8a[_0x3ef0('0xfe')])||_[_0x3ef0('0x6c')](_0xa49a8a[_0x3ef0('0xfe')][_0x3ef0('0xff')])||_[_0x3ef0('0x6c')](_0xa49a8a[_0x3ef0('0x100')])){_0x11924d(ut[_0x3ef0('0x4f')]('Contact\x20is\x20undefined',_0x3db894,_0x5ac583));return;}var _0x9f8749=uuid['v4']();var _0x4f4157=_0x332f87['campaignsPreview'][_0xa49a8a['Queue']['name']];var _0x1f3e83=_0x587b4b?_0x332f87[_0x3ef0('0x19')][_0x587b4b]['id']:undefined;_0x332f87[_0x3ef0('0x6d')][_0x9f8749]=new Action(_0xa49a8a,_0x4f4157,_0x9f8749,_0x587b4b,_0x1f3e83);var _0x2536ac=_0x332f87[_0x3ef0('0x6d')][_0x9f8749];_0x2536ac[_0x3ef0('0xa5')]=_0x3db894;_0x2536ac['activeContact']=_0x5ac583;_0x2536ac[_0x3ef0('0x101')]=_0x587b4b;if(_[_0x3ef0('0x102')](_0x405ad3)){_0x332f87[_0x3ef0('0x103')](_0x2536ac,_0x4f4157,_0xa49a8a,_0x587b4b)[_0x3ef0('0x81')](function(_0x317549){logger[_0x3ef0('0x6e')](_0x3ef0('0x104'),_0x3ef0('0x105')+_0x2536ac[_0x3ef0('0x70')]+'\x20IdHopper:\x20'+_0x2536ac[_0x3ef0('0x106')],JSON[_0x3ef0('0x58')](_0x317549));ami[_0x3ef0('0x2a')](_0x3ef0('0x107'),ut['buildObj'](_0x2536ac,_0x3ef0('0x108'),_0x332f87[_0x3ef0('0x17')][_0x2536ac[_0x3ef0('0x70')]]));_0x155050(ut[_0x3ef0('0x4f')](_0x3ef0('0x109')));})[_0x3ef0('0x77')](function(_0xceeff8){ut[_0x3ef0('0x61')](_0x3ef0('0x10a'),_0xceeff8);_0x11924d(ut[_0x3ef0('0x4f')]('Call\x20failed',_0x3db894,_0x5ac583));});}else{_0x4f4157[_0x3ef0('0x3d')]+=0x1;ut['logBlacklist'](_0x2536ac);rpcDb[_0x3ef0('0x10b')](_0x2536ac,_0x3ef0('0x10c'));delete _0x332f87[_0x3ef0('0x6d')][_0x9f8749];_0x11924d(ut[_0x3ef0('0x4f')]('Contact\x20in\x20black\x20List',_0x3db894,_0x5ac583));}});};Preview[_0x3ef0('0x12')][_0x3ef0('0x98')]=function(_0x30a978){return!_[_0x3ef0('0x6c')](_0x30a978)&&!_['isNil'](_0x30a978[_0x3ef0('0x2d')])&&!_[_0x3ef0('0x6c')](_0x30a978[_0x3ef0('0x56')])&&_0x30a978[_0x3ef0('0x56')]&&!_[_0x3ef0('0x6c')](this[_0x3ef0('0x10d')][util[_0x3ef0('0x59')](_0x3ef0('0x10e'),_0x30a978[_0x3ef0('0x2d')])])&&!_[_0x3ef0('0x6c')](this['trunks'][util[_0x3ef0('0x59')]('SIP/%s',_0x30a978['name'])][_0x3ef0('0x10f')])&&(this[_0x3ef0('0x10d')][util[_0x3ef0('0x59')](_0x3ef0('0x10e'),_0x30a978[_0x3ef0('0x2d')])][_0x3ef0('0x10f')]===_0x3ef0('0x110')||this['trunks'][util[_0x3ef0('0x59')](_0x3ef0('0x10e'),_0x30a978[_0x3ef0('0x2d')])][_0x3ef0('0x10f')]===_0x3ef0('0x111'));};Preview['prototype'][_0x3ef0('0x86')]=function(_0x1339a7,_0x578fdd){var _0x42bd41=this;return new BPromise(function(_0x743b7,_0x170244){_0x42bd41[_0x3ef0('0x112')](_0x1339a7,_0x578fdd)[_0x3ef0('0x81')](function(_0x4dfbfd){_0x743b7(_[_0x3ef0('0x73')](_0x4dfbfd,[_0x3ef0('0x4f')]));})[_0x3ef0('0x77')](function(_0x10b352){if(_0x10b352['unlock']){rpcDb[_0x3ef0('0x113')](_0x1339a7);}if(_0x10b352['active']){rpcDb[_0x3ef0('0x114')](_0x1339a7);}_0x170244(_[_0x3ef0('0x73')](_0x10b352,[_0x3ef0('0x4f')]));});});};Preview[_0x3ef0('0x12')]['execRun']=function(_0x424ed7,_0x253d1){var _0x1d2640=this;return new BPromise(function(_0x71f7fc,_0x28f508){var _0x525b0c,_0x3ceea9;rpcDb[_0x3ef0('0x115')](_0x424ed7)['then'](function(_0x1801fc){if(!_[_0x3ef0('0x6c')](_0x1801fc[0x0])){_0x3ceea9=_0x1801fc[0x0][_0x3ef0('0x116')]?![]:!![];_0x525b0c=_0x1801fc[0x0][_0x3ef0('0x116')]?!![]:![];_0x525b0c=_0x253d1?!![]:_0x525b0c;}var _0x1ab694=_0x1d2640['validateContact'](_0x1801fc);if(_0x1ab694['isValid']){rpcDb['checkIsBlackList'](_[_0x3ef0('0x73')](_0x1801fc[0x0],[_0x3ef0('0x100'),_0x3ef0('0x117')]))['then'](function(_0x19398a){_0x1d2640[_0x3ef0('0x118')](_0x19398a,_0x1801fc[0x0],_0x253d1,_0x3ceea9,_0x525b0c)[_0x3ef0('0x81')](function(_0x313aeb){_0x71f7fc(_0x313aeb);})['catch'](function(_0x4a277c){_0x28f508(_0x4a277c);});})['catch'](function(_0x329cf0){ut[_0x3ef0('0x61')](_0x3ef0('0x119'),_0x329cf0);_0x28f508(ut[_0x3ef0('0x4f')](_0x3ef0('0x11a'),_0x3ceea9,_0x525b0c));});}else{_0x28f508(ut[_0x3ef0('0x4f')](_0x1ab694['message'],_0x3ceea9,_0x525b0c));}})['catch'](function(_0x511b95){ut[_0x3ef0('0x61')]('[Preview][getContactPreview]',_0x511b95);_0x28f508(ut[_0x3ef0('0x4f')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x3ef0('0x12')][_0x3ef0('0x11b')]=function(_0x78ce7b){if(_[_0x3ef0('0x6c')](_0x78ce7b)||_[_0x3ef0('0x102')](_0x78ce7b)||!_['isNil'](_0x78ce7b[0x0][_0x3ef0('0x84')])&&_[_0x3ef0('0x6c')](_0x78ce7b[0x0][_0x3ef0('0x84')][_0x3ef0('0x2d')])){ut[_0x3ef0('0x61')](_0x3ef0('0x11c'),_0x78ce7b);return{'isValid':![],'message':_0x3ef0('0x11d')};}var _0xbb3851=this[_0x3ef0('0x17')][_0x78ce7b[0x0][_0x3ef0('0x11e')]['name']];_0xbb3851[_0x3ef0('0x4f')]='ACTIVE';if(_['isNil'](_0xbb3851)){ut[_0x3ef0('0x61')](_0x3ef0('0x11f'),_0xbb3851);return{'isValid':![],'message':_0x3ef0('0x120')};}if(!this[_0x3ef0('0x98')](_0xbb3851['Trunk'])){ut[_0x3ef0('0x61')]('[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20'+_0xbb3851[_0x3ef0('0x2d')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x3ef0('0x98')](_0xbb3851['TrunkBackup'])){ut[_0x3ef0('0x61')](_0x3ef0('0x121'),_0xbb3851[_0x3ef0('0x2d')]+_0x3ef0('0x122'));return{'isValid':![],'message':_0x3ef0('0x123')};}}if(!ut[_0x3ef0('0x124')](_0xbb3851[_0x3ef0('0x69')])){ut[_0x3ef0('0x61')]('[Preview][validateContact][Campaign\x20Active]',_0xbb3851['name']+_0x3ef0('0x125'));return{'isValid':![],'message':_0x3ef0('0x126')+_0xbb3851[_0x3ef0('0x2d')]+_0x3ef0('0x125')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x3ef0('0x12')][_0x3ef0('0x103')]=function(_0x4d861f,_0x3dbcd0,_0xda251e,_0x2d46c0){var _0x382250=this;return new BPromise(function(_0x440ed2,_0x56d9e8){var _0x4ff297=_0x4d861f['uniqueid'];var _0x489318=_0x382250[_0x3ef0('0x98')](_0x3dbcd0[_0x3ef0('0x55')])?util[_0x3ef0('0x59')]('SIP/%s/%s%s',_0x3dbcd0[_0x3ef0('0x55')]['name'],_['isNil'](_0x3dbcd0[_0x3ef0('0x127')])?'':_0x3dbcd0[_0x3ef0('0x127')]['trim']()||'',_0x3dbcd0[_0x3ef0('0x128')]>0x0?_0xda251e[_0x3ef0('0xfe')][_0x3ef0('0xff')][_0x3ef0('0x129')](_0x3dbcd0[_0x3ef0('0x128')]):_0xda251e[_0x3ef0('0xfe')][_0x3ef0('0xff')]):util[_0x3ef0('0x59')](_0x3ef0('0x12a'),_[_0x3ef0('0x6c')](_0x3dbcd0[_0x3ef0('0x99')])?_0x3dbcd0[_0x3ef0('0x55')][_0x3ef0('0x2d')]:_0x3dbcd0[_0x3ef0('0x99')][_0x3ef0('0x2d')],_[_0x3ef0('0x6c')](_0x3dbcd0['dialPrefix'])?'':_0x3dbcd0[_0x3ef0('0x127')][_0x3ef0('0x12b')]()||'',_0x3dbcd0[_0x3ef0('0x128')]>0x0?_0xda251e[_0x3ef0('0xfe')][_0x3ef0('0xff')]['substring'](_0x3dbcd0[_0x3ef0('0x128')]):_0xda251e[_0x3ef0('0xfe')]['phone']);var _0x305218=_0x382250['isTrunkReachable'](_0x3dbcd0[_0x3ef0('0x55')])?ut[_0x3ef0('0x12c')](_0x3dbcd0[_0x3ef0('0x55')][_0x3ef0('0x12d')],_0x3dbcd0['dialOriginateCallerIdName'],_0x3dbcd0['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x3ef0('0x12e')](_0x3dbcd0[_0x3ef0('0x12f')],_0x3dbcd0[_0x3ef0('0x130')]):_0x3dbcd0['dialOriginateCallerIdNumber']):ut[_0x3ef0('0x12c')](_[_0x3ef0('0x6c')](_0x3dbcd0[_0x3ef0('0x99')])?_0x3dbcd0[_0x3ef0('0x55')][_0x3ef0('0x12d')]:_0x3dbcd0[_0x3ef0('0x99')]['callerid'],_0x3dbcd0[_0x3ef0('0x3a')],_0x3dbcd0['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x3ef0('0x12e')](_0x3dbcd0['dialOriginateCallerIdNumber'],_0x3dbcd0['dialRandomLastDigitCallerIdNumber']):_0x3dbcd0[_0x3ef0('0x12f')]);if(_0x305218){_0x4d861f[_0x3ef0('0x131')]=ut[_0x3ef0('0x132')](_0x305218);_0x4d861f[_0x3ef0('0x133')]=ut['extractCalleridNumber'](_0x305218);}var _0x5e753b=ut[_0x3ef0('0x134')](_0x3dbcd0,_0xda251e,_0x489318,_0x305218,_0x4ff297,_0x4d861f);_[_0x3ef0('0x135')](_0x4d861f,ut[_0x3ef0('0x136')](_0x5e753b));_0x4d861f[_0x3ef0('0x89')]=moment()[_0x3ef0('0x59')](_0x3ef0('0x8a'));ami[_0x3ef0('0x76')](ut[_0x3ef0('0x137')](_0x4d861f,_0x3dbcd0,_0x5e753b,_0x4d861f['activeContact'],_0x2d46c0))[_0x3ef0('0x81')](function(_0x1585e9){var _0x2c84c4=_0x4d861f[_0x3ef0('0x138')];if(!_[_0x3ef0('0x6c')](_0x2c84c4)){if(!_[_0x3ef0('0x6c')](_0x382250[_0x3ef0('0x19')][_0x2c84c4])){_0x382250['agents'][_0x2c84c4][_0x3ef0('0x139')]=_0x4d861f[_0x3ef0('0x13a')];emit(util[_0x3ef0('0x59')]('user:%s',_0x382250[_0x3ef0('0x19')][_0x2c84c4]['name']),_0x3ef0('0x13b'),{'destaccountcode':_0x382250[_0x3ef0('0x19')][_0x2c84c4][_0x3ef0('0x13c')],'destconnectedlinenum':_0x4d861f[_0x3ef0('0x13a')]});}}_0x3dbcd0[_0x3ef0('0x50')]+=0x1;logger['info']('[originated][increment]',_0x4ff297,'\x20Queue',_0x3dbcd0['name'],_0x3ef0('0x71'),_0x3dbcd0[_0x3ef0('0x50')]);_0x440ed2(_0x1585e9);})[_0x3ef0('0x77')](function(_0x136184){ut[_0x3ef0('0xf6')](_0x4d861f,0xe,_0x3ef0('0x13d'));rpcDb[_0x3ef0('0xf4')](_0x4d861f,_0x3ef0('0x13e'));_0x56d9e8(_0x136184);});});};Preview['prototype'][_0x3ef0('0x13f')]=function(_0x5368b9){if(this[_0x3ef0('0x6d')][_0x5368b9[_0x3ef0('0xa7')]]){this['actions'][_0x5368b9['linkedid']][_0x3ef0('0x140')]=_0x5368b9[_0x3ef0('0x140')];}};Preview['prototype']['syncOriginateResponse']=function(_0x16c5d0){var _0x21c655=this;var _0x39d99d=this[_0x3ef0('0x6d')][_0x16c5d0[_0x3ef0('0x141')]];if(_0x39d99d){if(_0x39d99d['lookAgent']&&this[_0x3ef0('0x19')][_0x39d99d[_0x3ef0('0x101')]]){ut[_0x3ef0('0x142')](_0x39d99d,this[_0x3ef0('0x19')][_0x39d99d['lookAgent']][_0x3ef0('0x2d')],this[_0x3ef0('0x19')][_0x39d99d[_0x3ef0('0x101')]]['id']);}var _0x273a2c=_[_0x3ef0('0x143')](_0x39d99d);_0x273a2c[_0x3ef0('0xa9')]=moment()[_0x3ef0('0x59')](_0x3ef0('0x8a'));var _0x559218=_0x21c655[_0x3ef0('0x17')][_0x39d99d[_0x3ef0('0x70')]];if(ut[_0x3ef0('0x144')](_0x16c5d0[_0x3ef0('0x145')])){if(_0x39d99d[_0x3ef0('0xa5')]){rpcDb[_0x3ef0('0x113')](_0x39d99d[_0x3ef0('0x106')]);}if(_0x39d99d[_0x3ef0('0xa6')]){rpcDb[_0x3ef0('0x114')](_0x39d99d[_0x3ef0('0x106')]);}ami[_0x3ef0('0x2a')](_0x3ef0('0x146'),ut[_0x3ef0('0xb2')](_0x39d99d,_0x3ef0('0x147'),this[_0x3ef0('0x17')][_0x39d99d[_0x3ef0('0x70')]]));this[_0x3ef0('0xf1')](_0x273a2c,_0x559218,_0x16c5d0);}else{_0x39d99d[_0x3ef0('0x89')]=moment()[_0x3ef0('0x59')](_0x3ef0('0x8a'));ut[_0x3ef0('0xf6')](_0x273a2c,0x4,_0x3ef0('0xb6'));rpcDb[_0x3ef0('0xf4')](_0x273a2c,_0x3ef0('0x148'));}}};Preview[_0x3ef0('0x12')][_0x3ef0('0x1e')]=function(_0x294add){var _0xe6984d=this;var _0x551200=this['actions'][_0x294add['linkedid']];var _0xbe1bd0;if(_0x551200){_0xbe1bd0=this[_0x3ef0('0x17')][_0x551200['queue']];logger[_0x3ef0('0x6e')](_0x3ef0('0x149'),_0x294add[_0x3ef0('0xa7')],_0x3ef0('0xbc'),_0xbe1bd0['name'],'pTalking:\x20',_0xbe1bd0[_0x3ef0('0x32')]);}if(this[_0x3ef0('0x6d')][_0x294add[_0x3ef0('0xa7')]]&&_0x294add[_0x3ef0('0xa7')]!==_0x294add[_0x3ef0('0xac')]){if(_0x294add[_0x3ef0('0x14a')]==='16'&&this[_0x3ef0('0x6d')][_0x294add['linkedid']][_0x3ef0('0x79')]){this[_0x3ef0('0x14b')](_0x294add,_0x294add[_0x3ef0('0xa7')],_0x294add[_0x3ef0('0x14a')]);}else if(this[_0x3ef0('0x6d')][_0x294add[_0x3ef0('0xa7')]][_0x3ef0('0x79')]){logger[_0x3ef0('0x6e')](_0x3ef0('0x14c'),_0x294add[_0x3ef0('0xa7')],_0x294add['cause'],_0x3ef0('0xbc'),_0xbe1bd0[_0x3ef0('0x2d')],'pTalking:\x20',_0xbe1bd0[_0x3ef0('0x32')]);this[_0x3ef0('0x14b')](_0x294add,_0x294add[_0x3ef0('0xa7')],_0x294add[_0x3ef0('0x14a')]);}}else if(_0x551200&&_[_0x3ef0('0x6c')](_0x551200['statedesc'])&&_0xbe1bd0[_0x3ef0('0x14d')]&&_0x294add[_0x3ef0('0xa7')]===_0x294add[_0x3ef0('0xac')]&&_[_0x3ef0('0x6c')](_0x294add[_0x3ef0('0xfc')])&&_0x294add['cause']==='16'&&_0x294add[_0x3ef0('0x14e')]==='6'&&_['isUndefined'](_0x551200[_0x3ef0('0x14f')])){if(_0x551200[_0x3ef0('0xa5')]){rpcDb['unlockContact'](_0x551200[_0x3ef0('0x106')]);}if(_0x551200[_0x3ef0('0xa6')]){rpcDb[_0x3ef0('0x114')](_0x551200['idContact']);}_0x294add[_0x3ef0('0xfc')]='22';this['callProgressDetectingAgent'](_0x551200,_0xbe1bd0,_0x294add);}else if(_0x551200&&_0x551200['transfer']){if(_0x294add[_0x3ef0('0x14a')]==='16'&&this[_0x3ef0('0x6d')][_0x294add[_0x3ef0('0xa7')]][_0x3ef0('0x79')]){logger[_0x3ef0('0x6e')](_0x3ef0('0x150'),_0x294add[_0x3ef0('0xa7')],_0x294add[_0x3ef0('0x14a')],_0x3ef0('0xbc'),_0xbe1bd0[_0x3ef0('0x2d')],_0x3ef0('0x72'),_0xbe1bd0[_0x3ef0('0x32')]);this['callProgressDetectingCustomer'](_0x294add,_0x294add[_0x3ef0('0xa7')],_0x294add[_0x3ef0('0x14a')]);}else if(this[_0x3ef0('0x6d')][_0x294add['linkedid']]['dialAnswer']){logger['info'](_0x3ef0('0x14c'),_0x294add[_0x3ef0('0xa7')],_0x294add[_0x3ef0('0x14a')],_0x3ef0('0xbc'),_0xbe1bd0[_0x3ef0('0x2d')],_0x3ef0('0x72'),_0xbe1bd0[_0x3ef0('0x32')]);this[_0x3ef0('0x14b')](_0x294add,_0x294add[_0x3ef0('0xa7')],_0x294add[_0x3ef0('0x14a')]);}}};Preview[_0x3ef0('0x12')][_0x3ef0('0x22')]=function(_0x4b7ec2){if(this[_0x3ef0('0x6d')][_0x4b7ec2['destlinkedid']]&&_0x4b7ec2[_0x3ef0('0xf0')]!==_0x4b7ec2['destuniqueid']){this[_0x3ef0('0x14b')](_0x4b7ec2,_0x4b7ec2[_0x3ef0('0xf0')],_0x4b7ec2[_0x3ef0('0xe4')]);}};Preview[_0x3ef0('0x12')][_0x3ef0('0x20')]=function(_0x538172){if(this[_0x3ef0('0x6d')][_0x538172[_0x3ef0('0xa7')]]&&_0x538172[_0x3ef0('0xa7')]!==_0x538172['uniqueid']&&!this[_0x3ef0('0x6d')][_0x538172['linkedid']][_0x3ef0('0x79')]){if(_0x538172[_0x3ef0('0x14a')]==='1'){this[_0x3ef0('0x14b')](_0x538172,_0x538172[_0x3ef0('0xa7')],_0x538172['cause']);}}};Preview[_0x3ef0('0x12')]['addVariable']=function(_0x1782b4,_0x94fa5a,_0x4c572c){if(this[_0x3ef0('0x6d')][_0x1782b4]){if(_[_0x3ef0('0x6c')](this[_0x3ef0('0x6d')][_0x1782b4][_0x3ef0('0x151')])){this[_0x3ef0('0x6d')][_0x1782b4][_0x3ef0('0x151')]={};}this['actions'][_0x1782b4]['variables'][_0x94fa5a]=_0x4c572c;}};Preview[_0x3ef0('0x12')]['syncVarSet']=function(_0x52b2ce){try{if(!_['isNil'](_0x52b2ce)){if(ut[_0x3ef0('0x152')](_['keys'](_0x52b2ce[_0x3ef0('0x153')])[0x0])){this['addVariable'](_0x52b2ce[_0x3ef0('0xac')],_[_0x3ef0('0x154')](_0x52b2ce[_0x3ef0('0x153')])[0x0],_0x52b2ce[_0x3ef0('0x155')]);}}}catch(_0x33fd44){logger[_0x3ef0('0x156')](_0x3ef0('0x157'),util['inspect'](_0x33fd44,{'showHidden':![],'depth':null}));}};Preview[_0x3ef0('0x12')][_0x3ef0('0x26')]=function(_0x270612){if(_0x270612){if(this[_0x3ef0('0x6d')][_0x270612[_0x3ef0('0x158')]]){this[_0x3ef0('0x6d')][_0x270612[_0x3ef0('0x158')]][_0x3ef0('0x14f')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x4e2f8d){if(_0x4e2f8d){if(this[_0x3ef0('0x6d')][_0x4e2f8d[_0x3ef0('0x159')]]){this[_0x3ef0('0x6d')][_0x4e2f8d[_0x3ef0('0x159')]][_0x3ef0('0x14f')]=!![];}}};module[_0x3ef0('0x15a')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 786d3e6..09801b9 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 _0x30f1=['connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','getContactRecallMe','[GetContactRecallMe]\x20','util','bluebird','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','error','inspect','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x30f1,0xf0));var _0x130f=function(_0x589b99,_0x1f56f5){_0x589b99=_0x589b99-0x0;var _0x57094d=_0x30f1[_0x589b99];return _0x57094d;};'use strict';var util=require(_0x130f('0x0'));var BPromise=require(_0x130f('0x1'));var logger=require('../../../config/logger')(_0x130f('0x2'));var _=require(_0x130f('0x3'));var cmHopper=require(_0x130f('0x4'));var cmHopperFinal=require(_0x130f('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x5093ed){return function(_0x5533a8){logger[_0x130f('0x6')](_0x5093ed,util[_0x130f('0x7')](_0x5533a8,{'showHidden':![],'depth':null}));};}function create(_0x242ac2){return BPromise['resolve']()[_0x130f('0x8')](cmHopperHistory[_0x130f('0x9')](_0x242ac2))[_0x130f('0xa')](loggerCatch(_0x130f('0xb')));}function createAgent(_0x8210d9){return BPromise[_0x130f('0xc')]()[_0x130f('0x8')](agentReportPreview[_0x130f('0x9')](_0x8210d9))[_0x130f('0xa')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x1b803a){return BPromise[_0x130f('0xc')]()[_0x130f('0x8')](cmHopper[_0x130f('0xd')](_0x1b803a,!![]))[_0x130f('0xa')](loggerCatch(_0x130f('0xe')));}exports[_0x130f('0xf')]=function(_0x5a8fa0){return BPromise[_0x130f('0xc')]()[_0x130f('0x8')](cmHopperBlack[_0x130f('0xf')](_0x5a8fa0))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x130f('0x10')]=function(_0x28506){return BPromise['resolve']()[_0x130f('0x8')](cmHopper[_0x130f('0x10')](_0x28506))[_0x130f('0xa')](loggerCatch(_0x130f('0x11')));};exports[_0x130f('0x9')]=function(_0x3fb86c,_0x383f75){create(_0x3fb86c)[_0x130f('0xa')](loggerCatch(_0x383f75));moveContact(_0x3fb86c)[_0x130f('0xa')](loggerCatch(_0x383f75));};exports[_0x130f('0x12')]=function(_0x290f4f,_0x28c415){createAgent(_0x290f4f)[_0x130f('0xa')](loggerCatch(_0x28c415));};exports[_0x130f('0x13')]=function(_0x36afc6,_0x247ffc){create(_0x36afc6)[_0x130f('0xa')](loggerCatch(_0x247ffc));};exports[_0x130f('0x14')]=function(_0x20c404,_0x360237){moveContact(_0x20c404)[_0x130f('0xa')](loggerCatch(_0x360237));};exports[_0x130f('0x15')]=function(_0xb1cb16,_0x5cef20,_0x33a86e){if(_0x5cef20){_0xb1cb16[_0x130f('0x16')]=null;}if(_0x33a86e){_0xb1cb16[_0x130f('0x17')]=![];}return BPromise[_0x130f('0xc')]()[_0x130f('0x8')](cmHopper[_0x130f('0x15')](_0xb1cb16))[_0x130f('0xa')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0xe377e9){return BPromise[_0x130f('0xc')]()[_0x130f('0x8')](cmHopper[_0x130f('0x18')](_0xe377e9))[_0x130f('0xa')](loggerCatch('[countReScheduled]\x20'));};exports[_0x130f('0x19')]=function(_0x59deb7){return BPromise['resolve']()['then'](cmHopper['unlockContact']({'UserId':null},_0x59deb7,0x1))[_0x130f('0xa')](loggerCatch('[unlockContact]\x20'));};exports[_0x130f('0x1a')]=function(_0x5c1791){return BPromise[_0x130f('0xc')]()[_0x130f('0x8')](cmHopper[_0x130f('0x19')]({'active':![]},_0x5c1791,0x1))['catch'](loggerCatch(_0x130f('0x1b')));};exports[_0x130f('0x1c')]=function(_0x15bd34){var _0x165e8d={};_0x165e8d[_0x130f('0x1d')]=_0x15bd34[_0x130f('0x1d')];_0x165e8d[_0x130f('0x1e')]=_0x15bd34[_0x130f('0x1e')];_0x165e8d[_0x130f('0x1f')]=_0x15bd34[_0x130f('0x1f')];_0x165e8d[_0x130f('0x20')]=_0x15bd34[_0x130f('0x20')];_0x165e8d[_0x130f('0x21')]=_0x15bd34[_0x130f('0x21')];_0x165e8d['queuecallerjoinAt']=_0x15bd34[_0x130f('0x22')];_0x165e8d['queuecallerleaveAt']=_0x15bd34['answertime'];_0x165e8d[_0x130f('0x23')]=0x1;_0x165e8d['queuecallercompleteAt']=_0x15bd34['endtime'];_0x165e8d[_0x130f('0x24')]=_0x15bd34[_0x130f('0x25')];_0x165e8d['context']=_0x130f('0x26');_0x165e8d[_0x130f('0x27')]=_0x130f('0x28');_0x165e8d[_0x130f('0x29')]=0x0;_0x165e8d['assigned']=0x1;_0x165e8d[_0x130f('0x2a')]=_0x15bd34['membername'];_0x165e8d[_0x130f('0x2b')]='COMPLETED';return BPromise[_0x130f('0xc')]()[_0x130f('0x8')](voiceQueueReport['create'](_0x165e8d))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x130f('0x2c')]=function(_0x8a0b67,_0x32e831){return BPromise[_0x130f('0xc')]()['then'](cmHopper[_0x130f('0x2c')](_0x8a0b67,_0x32e831))['catch'](loggerCatch(_0x130f('0x2d')));};exports['rescheduleContactInQueue']=function(_0x17ac87){return BPromise[_0x130f('0xc')]()[_0x130f('0x8')](cmHopper[_0x130f('0x15')](_0x17ac87,!![],!![]))['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xb1fa=['exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context'];(function(_0x855caa,_0x5624fa){var _0x25488a=function(_0x4407bd){while(--_0x4407bd){_0x855caa['push'](_0x855caa['shift']());}};_0x25488a(++_0x5624fa);}(_0xb1fa,0x122));var _0xab1f=function(_0x39aa4f,_0x506344){_0x39aa4f=_0x39aa4f-0x0;var _0x5d0449=_0xb1fa[_0x39aa4f];return _0x5d0449;};'use strict';var util=require(_0xab1f('0x0'));var BPromise=require(_0xab1f('0x1'));var logger=require(_0xab1f('0x2'))(_0xab1f('0x3'));var _=require(_0xab1f('0x4'));var cmHopper=require(_0xab1f('0x5'));var cmHopperFinal=require(_0xab1f('0x6'));var cmHopperHistory=require(_0xab1f('0x7'));var cmHopperBlack=require(_0xab1f('0x8'));var voiceQueueRt=require(_0xab1f('0x9'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xab1f('0xa'));function loggerCatch(_0x684d13){return function(_0x5f43d2){logger[_0xab1f('0xb')](_0x684d13,util[_0xab1f('0xc')](_0x5f43d2,{'showHidden':![],'depth':null}));};}function create(_0x412197){return BPromise['resolve']()[_0xab1f('0xd')](cmHopperHistory[_0xab1f('0xe')](_0x412197))[_0xab1f('0xf')](loggerCatch(_0xab1f('0x10')));}function createAgent(_0x36f41d){return BPromise[_0xab1f('0x11')]()[_0xab1f('0xd')](agentReportPreview['createHistory'](_0x36f41d))[_0xab1f('0xf')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x826f9a){return BPromise['resolve']()['then'](cmHopper[_0xab1f('0x12')](_0x826f9a,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x179c19){return BPromise[_0xab1f('0x11')]()[_0xab1f('0xd')](cmHopperBlack[_0xab1f('0x13')](_0x179c19))[_0xab1f('0xf')](loggerCatch(_0xab1f('0x14')));};exports['getContactPreview']=function(_0xe44149){return BPromise[_0xab1f('0x11')]()[_0xab1f('0xd')](cmHopper[_0xab1f('0x15')](_0xe44149))[_0xab1f('0xf')](loggerCatch(_0xab1f('0x16')));};exports[_0xab1f('0xe')]=function(_0x1b27ac,_0x534a8f){create(_0x1b27ac)[_0xab1f('0xf')](loggerCatch(_0x534a8f));moveContact(_0x1b27ac)[_0xab1f('0xf')](loggerCatch(_0x534a8f));};exports[_0xab1f('0x17')]=function(_0x1f3462,_0x367f62){createAgent(_0x1f3462)[_0xab1f('0xf')](loggerCatch(_0x367f62));};exports[_0xab1f('0x18')]=function(_0x5ae944,_0x34562b){create(_0x5ae944)[_0xab1f('0xf')](loggerCatch(_0x34562b));};exports['createCustomerFinal']=function(_0x176044,_0x10bdbf){moveContact(_0x176044)['catch'](loggerCatch(_0x10bdbf));};exports[_0xab1f('0x19')]=function(_0x2ec6c2,_0x141f46,_0x57a252){if(_0x141f46){_0x2ec6c2['UserId']=null;}if(_0x57a252){_0x2ec6c2['active']=![];}return BPromise[_0xab1f('0x11')]()['then'](cmHopper[_0xab1f('0x19')](_0x2ec6c2))[_0xab1f('0xf')](loggerCatch(_0xab1f('0x1a')));};exports['countReScheduled']=function(_0x333053){return BPromise['resolve']()[_0xab1f('0xd')](cmHopper[_0xab1f('0x1b')](_0x333053))[_0xab1f('0xf')](loggerCatch(_0xab1f('0x1c')));};exports[_0xab1f('0x1d')]=function(_0x183ab1){return BPromise['resolve']()['then'](cmHopper[_0xab1f('0x1d')]({'UserId':null},_0x183ab1,0x1))[_0xab1f('0xf')](loggerCatch(_0xab1f('0x1e')));};exports['disableContact']=function(_0x51f2d3){return BPromise[_0xab1f('0x11')]()[_0xab1f('0xd')](cmHopper[_0xab1f('0x1d')]({'active':![]},_0x51f2d3,0x1))[_0xab1f('0xf')](loggerCatch('[activeContact]\x20'));};exports[_0xab1f('0x1f')]=function(_0xbd083d){var _0x1ec424={};_0x1ec424[_0xab1f('0x20')]=_0xbd083d[_0xab1f('0x20')];_0x1ec424['uniqueid']=_0xbd083d[_0xab1f('0x21')];_0x1ec424[_0xab1f('0x22')]=_0xbd083d[_0xab1f('0x22')];_0x1ec424[_0xab1f('0x23')]=_0xbd083d[_0xab1f('0x23')];_0x1ec424[_0xab1f('0x24')]=_0xbd083d['queue'];_0x1ec424[_0xab1f('0x25')]=_0xbd083d[_0xab1f('0x26')];_0x1ec424[_0xab1f('0x27')]=_0xbd083d[_0xab1f('0x26')];_0x1ec424[_0xab1f('0x28')]=0x1;_0x1ec424[_0xab1f('0x29')]=_0xbd083d[_0xab1f('0x2a')];_0x1ec424[_0xab1f('0x2b')]=_0xbd083d[_0xab1f('0x2c')];_0x1ec424[_0xab1f('0x2d')]='from-sip';_0x1ec424[_0xab1f('0x2e')]=_0xab1f('0x2f');_0x1ec424[_0xab1f('0x30')]=0x0;_0x1ec424[_0xab1f('0x31')]=0x1;_0x1ec424[_0xab1f('0x32')]=_0xbd083d[_0xab1f('0x2c')];_0x1ec424['queuecallerexitreason']='COMPLETED';return BPromise['resolve']()[_0xab1f('0xd')](voiceQueueReport[_0xab1f('0x33')](_0x1ec424))[_0xab1f('0xf')](loggerCatch(_0xab1f('0x34')));};exports[_0xab1f('0x35')]=function(_0x2873dc,_0x1df9e1){return BPromise[_0xab1f('0x11')]()['then'](cmHopper['getContactRecallMe'](_0x2873dc,_0x1df9e1))[_0xab1f('0xf')](loggerCatch(_0xab1f('0x36')));};exports[_0xab1f('0x37')]=function(_0x5d3ff4){return BPromise[_0xab1f('0x11')]()[_0xab1f('0xd')](cmHopper[_0xab1f('0x19')](_0x5d3ff4,!![],!![]))[_0xab1f('0xf')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index ee087f9..6e52fcb 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 _0x027c=['xmd-agi','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','replace','random','extractCalleridName','extractCalleridNumber','match','util','lodash','preview','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','inspect','logger','info','logger2','message','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','state','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','RECALL','BOOKED','uniqueid','originate','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','scheduledAt','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','name','queue','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildAcw','not_inuse','status','push','getDiff','CampaignId','filterKey','idContact','type','dialAnswer','countglobal','callback','callbackat','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid'];(function(_0x3cab81,_0x99a65){var _0x4dc9de=function(_0x2bbdf8){while(--_0x2bbdf8){_0x3cab81['push'](_0x3cab81['shift']());}};_0x4dc9de(++_0x99a65);}(_0x027c,0x121));var _0xc027=function(_0x156c04,_0x593707){_0x156c04=_0x156c04-0x0;var _0x7efc58=_0x027c[_0x156c04];return _0x7efc58;};'use strict';var util=require(_0xc027('0x0'));var _=require(_0xc027('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xc027('0x2'));var ipAgi=process[_0xc027('0x3')]['XCALLY_IP_AGI']||_0xc027('0x4');function getSeconds(_0x227761,_0x206410){var _0x585db6=moment(_0x227761)[_0xc027('0x5')](0x0);var _0x58d08f=moment(_0x206410)[_0xc027('0x5')](0x0);return _0x585db6[_0xc027('0x6')](_0x58d08f,_0xc027('0x7'));}exports[_0xc027('0x8')]=function(_0x407431){return function(_0x8a263c){logger[_0xc027('0x9')](_0x407431,util[_0xc027('0xa')](_0x8a263c,{'showHidden':![],'depth':null}));};};exports[_0xc027('0xb')]=function(_0x5b1753,_0x474832){logger[_0xc027('0xc')](_0x5b1753,util[_0xc027('0xa')](_0x474832,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x308541,_0x1a7095){logger[_0xc027('0x9')](_0x308541,util[_0xc027('0xa')](_0x1a7095,{'showHidden':![],'depth':null}));};exports[_0xc027('0xd')]=function(_0x276007){return function(_0x2b21a2){logger['info'](_0x276007,util[_0xc027('0xa')](_0x2b21a2,{'showHidden':![],'depth':null}));};};exports[_0xc027('0xe')]=function(_0x5e36fb,_0x3e8aab,_0x138800){return{'message':_0x5e36fb,'unlock':_0x3e8aab,'active':_0x138800};};exports[_0xc027('0xf')]=function(_0x89eb11,_0x3edd3b,_0x5db013){if(!_['isUndefined'](_0x5db013)&&_0xc027('0x10')===typeof _0x5db013&&!_[_0xc027('0x11')](_0x5db013)){if(!_['isUndefined'](_0x3edd3b)&&'string'===typeof _0x3edd3b&&!_[_0xc027('0x11')](_0x3edd3b)){return util[_0xc027('0x12')](_0xc027('0x13'),_0x3edd3b,_0x5db013);}return util[_0xc027('0x12')](_0xc027('0x13'),_0x5db013,_0x5db013);}if(!_[_0xc027('0x14')](_0x89eb11)&&_0xc027('0x10')===typeof _0x89eb11&&!_[_0xc027('0x11')](_0x89eb11)){return _0x89eb11;}return _0xc027('0x15');};exports['isActive']=function(_0x33622b){if(_[_0xc027('0x16')](_0x33622b)){return![];}return _0x33622b;};exports[_0xc027('0x17')]=function(_0x4dbc17,_0x15af87,_0x3c7844,_0x47aae7,_0x2f0c80,_0x448405){var _0xcc2223={'XMD-QUEUE':_0x15af87['Queue']?_0x15af87[_0xc027('0x18')]['name']:'','XMD-CALLERID':_0x47aae7,'XMD-CALLERID-PREVIEW':_0x448405?util['format'](_0xc027('0x13'),_0x448405[_0xc027('0x19')],_0x448405[_0xc027('0x1a')]):_0x47aae7,'XMD-DIALID':_0x2f0c80,'XMD-CONTACTID':_0x15af87[_0xc027('0x1b')],'XMD-CDRTYPE':_0xc027('0x1c'),'CALLERID(all)':_0x47aae7,'XMD-VOICEQUEUEID':_0x15af87[_0xc027('0x1d')],'XMD-DIALCHANNEL':_0x3c7844,'XMD-DIALTIMEOUT':_0x4dbc17[_0xc027('0x1e')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xc027('0x1f'),_0x4dbc17['dialQueueProject2']?'g':'',_[_0xc027('0x11')](_0x4dbc17[_0xc027('0x20')])?'':_0xc027('0x21')),'XMD-DIALURL':_0x4dbc17[_0xc027('0x22')]||'','XMD-AGI':_0x4dbc17[_0xc027('0x23')]?util[_0xc027('0x12')](_0xc027('0x24'),ipAgi,_0x4dbc17[_0xc027('0x23')]):_0xc027('0x25'),'XMD-AGIAFTER':_0x4dbc17[_0xc027('0x26')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x4dbc17[_0xc027('0x26')]):_0xc027('0x25'),'XMD-ORIGINATECALLERIDNUM':_0x448405?_0x448405[_0xc027('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x448405?_0x448405[_0xc027('0x28')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0xc027('0x11')](_0x4dbc17[_0xc027('0x20')])){_0xcc2223[util[_0xc027('0x12')]('%s',_0xc027('0x29'))]=_0x4dbc17[_0xc027('0x20')];_0xcc2223[util[_0xc027('0x12')]('%s',_0xc027('0x2a'))]=_0x2f0c80;}if(_0x15af87&&_0x15af87[_0xc027('0x2b')]){for(var _0x25a0f0 in _0x15af87[_0xc027('0x2b')]){if(_0x15af87['Contact'][_0xc027('0x2c')](_0x25a0f0)){if(!_[_0xc027('0x16')](_0x15af87['Contact'][_0x25a0f0])&&_0x25a0f0!=='id'&&_0x25a0f0!==_0xc027('0x2d')&&_0x25a0f0!==_0xc027('0x2e')&&_0x25a0f0!==_0xc027('0x2f')){_0xcc2223[util['format'](_0xc027('0x30'),_0xc027('0x31'),_[_0xc027('0x32')](_0x25a0f0))]=_0x15af87['Contact'][_0x25a0f0];}}}}return _0xcc2223;};exports['toLowerVariables']=function(_0x5dc47f){var _0x5adbe0={};for(var _0x32d3d2 in _0x5dc47f){if(_0x5dc47f['hasOwnProperty'](_0x32d3d2)){_0x5adbe0[util[_0xc027('0x12')]('%s',_['toLower'](_0x32d3d2))]=_0x5dc47f[_0x32d3d2];}}return{'variables':_0x5adbe0};};exports[_0xc027('0x33')]=function(_0x188088,_0x1a9038){if(!_[_0xc027('0x16')](_0x188088)){if(_0x188088[_0xc027('0x2c')](_0xc027('0x34'))){if(_0x188088[_0xc027('0x34')]>0x0){_0x188088[_0xc027('0x34')]-=0x1;}else{logger[_0xc027('0x9')](_0xc027('0x35'),_0x1a9038);}}}else{logger['error'](_0xc027('0x36'),_0x1a9038);}};exports[_0xc027('0x37')]=function(_0x7f2c36){var _0x369a45=moment()['format'](_0xc027('0x38'));_0x7f2c36['state']=0xd;_0x7f2c36[_0xc027('0x39')]=_0xc027('0x3a');_0x7f2c36[_0xc027('0x3b')]=_0x369a45;_0x7f2c36[_0xc027('0x3c')]=_0x369a45;_0x7f2c36[_0xc027('0x3d')]=_0x369a45;};exports[_0xc027('0x3e')]=function(_0x3b7ed8,_0x528065,_0x48c62a){var _0x3b1d32=moment()[_0xc027('0x12')](_0xc027('0x38'));_0x3b7ed8[_0xc027('0x3f')]=_0x528065;_0x3b7ed8[_0xc027('0x39')]=_0x48c62a;_0x3b7ed8[_0xc027('0x3c')]=_0x3b1d32;_0x3b7ed8[_0xc027('0x40')]=getSeconds(_0x3b7ed8[_0xc027('0x3c')],_0x3b7ed8[_0xc027('0x3b')]);};exports[_0xc027('0x41')]=function(_0x422fe7,_0xd05ee3,_0x3ec85f){_0x422fe7[_0xc027('0x42')]=_0xd05ee3;_0x422fe7[_0xc027('0x43')]=_0x3ec85f;};exports[_0xc027('0x44')]=function(_0x1e50f3,_0x50466c,_0x1a7821){var _0x5b98a6=moment()[_0xc027('0x12')](_0xc027('0x38'));_0x1e50f3[_0xc027('0x3f')]=_0x50466c;_0x1e50f3[_0xc027('0x39')]=_0x1a7821;_0x1e50f3[_0xc027('0x3c')]=_0x1e50f3[_0xc027('0x3c')]?_0x1e50f3[_0xc027('0x3c')]:_0x5b98a6;_0x1e50f3[_0xc027('0x3d')]=_0x1e50f3['endtime']?_0x1e50f3[_0xc027('0x3d')]:_0x5b98a6;_0x1e50f3[_0xc027('0x40')]=getSeconds(_0x1e50f3[_0xc027('0x3c')]||0x0,_0x1e50f3['starttime']||0x0);_0x1e50f3[_0xc027('0x45')]=_0x1e50f3[_0xc027('0x46')]?getSeconds(_0x1e50f3['endtime'],_0x1e50f3['answertime']):0x0;};exports['isFailure']=function(_0x35385a){return _0x35385a==='Failure';};exports['variablesAction']=function(_0x2d86fa,_0x57aae6,_0x50edb3,_0x3a924a,_0x2e5075){var _0x412805=_0x3a924a?_0xc027('0x47'):_0x2d86fa[_0xc027('0x19')];_0x412805=_0x2e5075?_0xc027('0x48'):_0x412805;return{'actionid':_0x2d86fa[_0xc027('0x49')],'action':_0xc027('0x4a'),'channel':_0x2d86fa['channelAgent'],'callerid':util['format'](_0xc027('0x13'),_0x412805,_0x2d86fa['calleridnum']),'Exten':_0xc027('0x4b'),'Context':_0xc027('0x4c'),'Priority':'1','variable':_0x50edb3,'timeout':(_0x57aae6[_0xc027('0x4d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2d86fa[_0xc027('0x49')]};};exports[_0xc027('0x4e')]=function(_0x3aad77){return _0x3aad77[_0xc027('0x4f')]+_0x3aad77[_0xc027('0x50')]+_0x3aad77[_0xc027('0x51')]+_0x3aad77['countagentrejectretry']+_0x3aad77[_0xc027('0x52')];};exports['cloneAction']=function(_0x4aa363){var _0x5c1c0e=_['clone'](_0x4aa363);_0x5c1c0e[_0xc027('0x3f')]=0xf;_0x5c1c0e['statedesc']='Global';return _0x5c1c0e;};exports[_0xc027('0x53')]=function(_0x1e18b0,_0x37fb9a,_0xab74be){var _0x595377={};_0x595377[_0x37fb9a]=_0x1e18b0[_0x37fb9a];_0x595377[_0xc027('0x54')]=![];_0x595377[_0xc027('0x55')]=moment()[_0xc027('0x56')](_0xab74be,_0xc027('0x57'))['format'](_0xc027('0x38'));_0x595377[_0xc027('0x1b')]=_0x1e18b0['ContactId'];_0x595377[_0xc027('0x58')]=_0x1e18b0[_0xc027('0x58')];_0x595377['VoiceQueueId']=_0x1e18b0['VoiceQueueId']||undefined;return _0x595377;};exports['decrementTalkink']=function(_0x1f4b37,_0xd4c4e0){if(!_[_0xc027('0x16')](_0x1f4b37)){if(_0x1f4b37[_0xc027('0x59')]>0x0){_0x1f4b37['pTalking']-=0x1;}else{logger[_0xc027('0x9')](_0xd4c4e0,_0xc027('0x5a'));}}else{logger[_0xc027('0x9')](_0xd4c4e0,_0xc027('0x5b'));}};exports[_0xc027('0x5c')]=function(_0x2846b9){if(_0x2846b9<=0x0){return!![];}return![];};exports[_0xc027('0x5d')]=function(_0x2ce542,_0x4032b8,_0x467367){_0x2ce542['lastevent']=_0x4032b8;_0x2ce542[_0xc027('0x5e')]=_0x2ce542[_0xc027('0x5f')];_0x2ce542[_0xc027('0x60')]=_0x2ce542[_0xc027('0x61')];_0x2ce542[_0xc027('0x62')]=_0xc027('0x63');if(_0x467367){_0x2ce542[_0xc027('0x64')]=_0x467367['mandatoryDisposition'];}return _0x2ce542;};exports[_0xc027('0x65')]=function(_0x20ac88){var _0x117906={};_0x117906[_0xc027('0x5f')]=_0x20ac88[_0xc027('0x5f')];_0x117906[_0xc027('0x60')]=_0x20ac88['channelAgent'];_0x117906[_0xc027('0x49')]=_0x20ac88['uniqueid'];return _0x117906;};exports['agentReadyId']=function(_0x53ab1c){var _0x22c64c=[];for(var _0x142177 in _0x53ab1c){if(_0x53ab1c['hasOwnProperty'](_0x142177)){if(!_[_0xc027('0x16')](_0x53ab1c[_0x142177])&&_0x53ab1c[_0x142177]['state']===_0xc027('0x66')&&_0x53ab1c[_0x142177][_0xc027('0x67')]==='reachable'){_0x22c64c[_0xc027('0x68')](_0x53ab1c[_0x142177]['id']);}}}return _0x22c64c;};exports[_0xc027('0x69')]=function(_0x272b8c){var _0x38c03e=moment()[_0xc027('0x5')](0x0);var _0x4dd4c6=moment(_0x272b8c)[_0xc027('0x5')](0x0);return _0x38c03e[_0xc027('0x6')](_0x4dd4c6,'seconds');};exports['createBody']=function(_0x26e7e0){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x26e7e0[_0xc027('0x1b')],'ListId':_0x26e7e0[_0xc027('0x58')],'VoiceQueueId':_0x26e7e0[_0xc027('0x1d')]||undefined,'CampaignId':_0x26e7e0[_0xc027('0x6a')]||undefined};};exports[_0xc027('0x6b')]=function(_0x50a7f9){if(_0x50a7f9==='uniqueid'||_0x50a7f9===_0xc027('0x6c')||_0x50a7f9===_0xc027('0x5f')||_0x50a7f9===_0xc027('0x6d')||_0x50a7f9==='campaigntype'||_0x50a7f9===_0xc027('0x6e')||_0x50a7f9===_0xc027('0x42')||_0x50a7f9==='channelAgent'||_0x50a7f9===_0xc027('0x19')||_0x50a7f9===_0xc027('0x54')||_0x50a7f9===_0xc027('0x1a')||_0x50a7f9===_0xc027('0x55')||_0x50a7f9===_0xc027('0x4f')||_0x50a7f9===_0xc027('0x50')||_0x50a7f9===_0xc027('0x51')||_0x50a7f9===_0xc027('0x6f')||_0x50a7f9===_0xc027('0x70')||_0x50a7f9==='callbackuniqueid'||_0x50a7f9===_0xc027('0x71')||_0x50a7f9==='recallme'||_0x50a7f9==='ContactId'||_0x50a7f9==='ListId'||_0x50a7f9===_0xc027('0x43')||_0x50a7f9===_0xc027('0x1d')||_0x50a7f9===_0xc027('0x72')||_0x50a7f9===_0xc027('0x73')||_0x50a7f9==='xmd-queue'||_0x50a7f9===_0xc027('0x74')||_0x50a7f9===_0xc027('0x75')||_0x50a7f9===_0xc027('0x76')||_0x50a7f9===_0xc027('0x77')||_0x50a7f9===_0xc027('0x78')||_0x50a7f9===_0xc027('0x79')||_0x50a7f9==='xmd-dialchannel'||_0x50a7f9===_0xc027('0x7a')||_0x50a7f9===_0xc027('0x7b')||_0x50a7f9===_0xc027('0x7c')||_0x50a7f9==='xmd-agiafter'||_0x50a7f9===_0xc027('0x7d')||_0x50a7f9===_0xc027('0x7e')||_0x50a7f9==='rtpaudioqosbridged'||_0x50a7f9==='rtpaudioqosjitter'||_0x50a7f9===_0xc027('0x7f')||_0x50a7f9===_0xc027('0x80')||_0x50a7f9===_0xc027('0x81')||_0x50a7f9==='rtpaudioqosrtt'||_0x50a7f9===_0xc027('0x82')||_0x50a7f9===_0xc027('0x7e')||_0x50a7f9==='rtpaudioqosbridged'||_0x50a7f9===_0xc027('0x83')||_0x50a7f9===_0xc027('0x7f')||_0x50a7f9===_0xc027('0x80')||_0x50a7f9===_0xc027('0x81')||_0x50a7f9==='rtpaudioqosrtt'||_0x50a7f9===_0xc027('0x82')||_0x50a7f9===_0xc027('0x84')||_0x50a7f9==='bridgepvtcallid'||_0x50a7f9===_0xc027('0x3f')||_0x50a7f9==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x26765b,_0x313abb){var _0x3fec0f,_0x53bbaf,_0x155af2;if(_0x313abb<=0x0){_0x313abb=0x1;}_0x3fec0f=new RegExp('\x5cw{0,'+_0x313abb+'}$');_0x53bbaf=Math['pow'](0xa,_0x313abb-0x1);_0x155af2=Math['pow'](0xa,_0x313abb)-0x1;return util[_0xc027('0x12')]('%s',_[_0xc027('0x85')](_0x26765b,_0x3fec0f,_[_0xc027('0x86')](_0x53bbaf,_0x155af2)));};exports[_0xc027('0x87')]=function(_0x39e2b0){var _0x40ba34=_0x39e2b0['match'](/"(.*?)"/);return _0x40ba34?_0x40ba34[0x1]:_0x39e2b0;};exports[_0xc027('0x88')]=function(_0x31ca0c){var _0x1aed53=_0x31ca0c[_0xc027('0x89')](/<(.*?)>/);return _0x1aed53?_0x1aed53[0x1]:_0x31ca0c;}; \ No newline at end of file +var _0xde0c=['Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','%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','state','statedesc','Blacklist','starttime','responsetime','logAgent','ringtime','membername','UserId','endtime','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','interface','channelAgent','motionChannel','voice','mandatoryDisposition','queue','agentReadyId','not_inuse','reachable','push','getDiff','seconds','filterKey','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-cdrtype','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','util','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','inspect','logger','info','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isNil','addVariables'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0xde0c,0x18e));var _0xcde0=function(_0x4f2408,_0x18bd3f){_0x4f2408=_0x4f2408-0x0;var _0xd3580f=_0xde0c[_0x4f2408];return _0xd3580f;};'use strict';var util=require(_0xcde0('0x0'));var _=require('lodash');var moment=require(_0xcde0('0x1'));var logger=require(_0xcde0('0x2'))('preview');var ipAgi=process[_0xcde0('0x3')][_0xcde0('0x4')]||_0xcde0('0x5');function getSeconds(_0x114ef3,_0x586507){var _0x1f5848=moment(_0x114ef3)[_0xcde0('0x6')](0x0);var _0x400202=moment(_0x586507)[_0xcde0('0x6')](0x0);return _0x1f5848[_0xcde0('0x7')](_0x400202,'seconds');}exports[_0xcde0('0x8')]=function(_0x49bcd7){return function(_0x307184){logger[_0xcde0('0x9')](_0x49bcd7,util[_0xcde0('0xa')](_0x307184,{'showHidden':![],'depth':null}));};};exports[_0xcde0('0xb')]=function(_0x4a87d0,_0xf948dc){logger[_0xcde0('0xc')](_0x4a87d0,util['inspect'](_0xf948dc,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x458558,_0x4b0e9a){logger[_0xcde0('0x9')](_0x458558,util['inspect'](_0x4b0e9a,{'showHidden':![],'depth':null}));};exports[_0xcde0('0xd')]=function(_0x25a81b){return function(_0x1a8f94){logger[_0xcde0('0xc')](_0x25a81b,util['inspect'](_0x1a8f94,{'showHidden':![],'depth':null}));};};exports[_0xcde0('0xe')]=function(_0x243a65,_0x469ca7,_0x5e0501){return{'message':_0x243a65,'unlock':_0x469ca7,'active':_0x5e0501};};exports['getCallerId']=function(_0x2f8dd0,_0x12fd11,_0x3ea658){if(!_[_0xcde0('0xf')](_0x3ea658)&&_0xcde0('0x10')===typeof _0x3ea658&&!_['isEmpty'](_0x3ea658)){if(!_['isUndefined'](_0x12fd11)&&_0xcde0('0x10')===typeof _0x12fd11&&!_[_0xcde0('0x11')](_0x12fd11)){return util[_0xcde0('0x12')]('\x22%s\x22\x20<%s>',_0x12fd11,_0x3ea658);}return util['format'](_0xcde0('0x13'),_0x3ea658,_0x3ea658);}if(!_[_0xcde0('0xf')](_0x2f8dd0)&&_0xcde0('0x10')===typeof _0x2f8dd0&&!_[_0xcde0('0x11')](_0x2f8dd0)){return _0x2f8dd0;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x2d05d4){if(_[_0xcde0('0x14')](_0x2d05d4)){return![];}return _0x2d05d4;};exports[_0xcde0('0x15')]=function(_0xda1cba,_0x2014b6,_0xac063b,_0xd3c79b,_0x221182,_0x26fc8d){var _0x1467c5={'XMD-QUEUE':_0x2014b6[_0xcde0('0x16')]?_0x2014b6[_0xcde0('0x16')][_0xcde0('0x17')]:'','XMD-CALLERID':_0xd3c79b,'XMD-CALLERID-PREVIEW':_0x26fc8d?util['format'](_0xcde0('0x13'),_0x26fc8d[_0xcde0('0x18')],_0x26fc8d[_0xcde0('0x19')]):_0xd3c79b,'XMD-DIALID':_0x221182,'XMD-CONTACTID':_0x2014b6[_0xcde0('0x1a')],'XMD-CDRTYPE':_0xcde0('0x1b'),'CALLERID(all)':_0xd3c79b,'XMD-VOICEQUEUEID':_0x2014b6['VoiceQueueId'],'XMD-DIALCHANNEL':_0xac063b,'XMD-DIALTIMEOUT':_0xda1cba[_0xcde0('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xcde0('0x12')](_0xcde0('0x1d'),_0xda1cba['dialQueueProject2']?'g':'',_[_0xcde0('0x11')](_0xda1cba['monitor_format'])?'':_0xcde0('0x1e')),'XMD-DIALURL':_0xda1cba[_0xcde0('0x1f')]||'','XMD-AGI':_0xda1cba[_0xcde0('0x20')]?util[_0xcde0('0x12')](_0xcde0('0x21'),ipAgi,_0xda1cba['dialQueueProject']):_0xcde0('0x22'),'XMD-AGIAFTER':_0xda1cba[_0xcde0('0x23')]?util[_0xcde0('0x12')](_0xcde0('0x21'),ipAgi,_0xda1cba['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x26fc8d?_0x26fc8d[_0xcde0('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x26fc8d?_0x26fc8d[_0xcde0('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_['isEmpty'](_0xda1cba['monitor_format'])){_0x1467c5[util[_0xcde0('0x12')]('%s',_0xcde0('0x26'))]=_0xda1cba['monitor_format'];_0x1467c5[util[_0xcde0('0x12')]('%s',_0xcde0('0x27'))]=_0x221182;}if(_0x2014b6&&_0x2014b6[_0xcde0('0x28')]){for(var _0x20fddb in _0x2014b6[_0xcde0('0x28')]){if(_0x2014b6['Contact'][_0xcde0('0x29')](_0x20fddb)){if(!_[_0xcde0('0x14')](_0x2014b6[_0xcde0('0x28')][_0x20fddb])&&_0x20fddb!=='id'&&_0x20fddb!==_0xcde0('0x2a')&&_0x20fddb!=='createdAt'&&_0x20fddb!=='updatedAt'){_0x1467c5[util[_0xcde0('0x12')](_0xcde0('0x2b'),_0xcde0('0x2c'),_[_0xcde0('0x2d')](_0x20fddb))]=_0x2014b6[_0xcde0('0x28')][_0x20fddb];}}}}return _0x1467c5;};exports[_0xcde0('0x2e')]=function(_0x378b25){var _0x4fab22={};for(var _0x9f093f in _0x378b25){if(_0x378b25[_0xcde0('0x29')](_0x9f093f)){_0x4fab22[util['format']('%s',_[_0xcde0('0x2f')](_0x9f093f))]=_0x378b25[_0x9f093f];}}return{'variables':_0x4fab22};};exports[_0xcde0('0x30')]=function(_0x975268,_0x5ea525){if(!_[_0xcde0('0x14')](_0x975268)){if(_0x975268[_0xcde0('0x29')](_0xcde0('0x31'))){if(_0x975268['originated']>0x0){_0x975268[_0xcde0('0x31')]-=0x1;}else{logger[_0xcde0('0x9')](_0xcde0('0x32'),_0x5ea525);}}}else{logger['error'](_0xcde0('0x33'),_0x5ea525);}};exports[_0xcde0('0x34')]=function(_0x490d13){var _0x49c5d6=moment()['format'](_0xcde0('0x35'));_0x490d13[_0xcde0('0x36')]=0xd;_0x490d13[_0xcde0('0x37')]=_0xcde0('0x38');_0x490d13[_0xcde0('0x39')]=_0x49c5d6;_0x490d13[_0xcde0('0x3a')]=_0x49c5d6;_0x490d13['endtime']=_0x49c5d6;};exports[_0xcde0('0x3b')]=function(_0xdcc188,_0xf8aa84,_0x2cdb05){var _0x3065f0=moment()[_0xcde0('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0xdcc188['state']=_0xf8aa84;_0xdcc188[_0xcde0('0x37')]=_0x2cdb05;_0xdcc188[_0xcde0('0x3a')]=_0x3065f0;_0xdcc188[_0xcde0('0x3c')]=getSeconds(_0xdcc188[_0xcde0('0x3a')],_0xdcc188[_0xcde0('0x39')]);};exports['logLookAgent']=function(_0xcc77d2,_0x412ba5,_0x12b66d){_0xcc77d2[_0xcde0('0x3d')]=_0x412ba5;_0xcc77d2[_0xcde0('0x3e')]=_0x12b66d;};exports['logCustomer']=function(_0x47ef6,_0x4a12a3,_0x5463e3){var _0x4bb0f0=moment()[_0xcde0('0x12')](_0xcde0('0x35'));_0x47ef6[_0xcde0('0x36')]=_0x4a12a3;_0x47ef6['statedesc']=_0x5463e3;_0x47ef6[_0xcde0('0x3a')]=_0x47ef6[_0xcde0('0x3a')]?_0x47ef6[_0xcde0('0x3a')]:_0x4bb0f0;_0x47ef6['endtime']=_0x47ef6[_0xcde0('0x3f')]?_0x47ef6[_0xcde0('0x3f')]:_0x4bb0f0;_0x47ef6[_0xcde0('0x3c')]=getSeconds(_0x47ef6[_0xcde0('0x3a')]||0x0,_0x47ef6[_0xcde0('0x39')]||0x0);_0x47ef6[_0xcde0('0x40')]=_0x47ef6[_0xcde0('0x41')]?getSeconds(_0x47ef6[_0xcde0('0x3f')],_0x47ef6['answertime']):0x0;};exports[_0xcde0('0x42')]=function(_0x1551b8){return _0x1551b8===_0xcde0('0x43');};exports[_0xcde0('0x44')]=function(_0x43b76c,_0x1efe81,_0x1b16b7,_0x415026,_0x44a355){var _0x31c370=_0x415026?'RECALL':_0x43b76c[_0xcde0('0x18')];_0x31c370=_0x44a355?_0xcde0('0x45'):_0x31c370;return{'actionid':_0x43b76c[_0xcde0('0x46')],'action':'originate','channel':_0x43b76c['channelAgent'],'callerid':util[_0xcde0('0x12')](_0xcde0('0x13'),_0x31c370,_0x43b76c[_0xcde0('0x19')]),'Exten':_0xcde0('0x47'),'Context':_0xcde0('0x48'),'Priority':'1','variable':_0x1b16b7,'timeout':(_0x1efe81[_0xcde0('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x43b76c[_0xcde0('0x46')]};};exports[_0xcde0('0x4a')]=function(_0x422fec){return _0x422fec[_0xcde0('0x4b')]+_0x422fec[_0xcde0('0x4c')]+_0x422fec[_0xcde0('0x4d')]+_0x422fec[_0xcde0('0x4e')]+_0x422fec['countnosuchnumberretry'];};exports[_0xcde0('0x4f')]=function(_0x2f3782){var _0x1b92df=_[_0xcde0('0x50')](_0x2f3782);_0x1b92df['state']=0xf;_0x1b92df['statedesc']='Global';return _0x1b92df;};exports[_0xcde0('0x51')]=function(_0x2de3a9,_0x1bf1e1,_0x1475f8){var _0x20b2f8={};_0x20b2f8[_0x1bf1e1]=_0x2de3a9[_0x1bf1e1];_0x20b2f8[_0xcde0('0x52')]=![];_0x20b2f8[_0xcde0('0x53')]=moment()[_0xcde0('0x54')](_0x1475f8,_0xcde0('0x55'))[_0xcde0('0x12')](_0xcde0('0x35'));_0x20b2f8[_0xcde0('0x1a')]=_0x2de3a9[_0xcde0('0x1a')];_0x20b2f8[_0xcde0('0x56')]=_0x2de3a9[_0xcde0('0x56')];_0x20b2f8[_0xcde0('0x57')]=_0x2de3a9[_0xcde0('0x57')]||undefined;return _0x20b2f8;};exports[_0xcde0('0x58')]=function(_0x5483cb,_0x31fc56){if(!_['isNil'](_0x5483cb)){if(_0x5483cb['pTalking']>0x0){_0x5483cb[_0xcde0('0x59')]-=0x1;}else{logger[_0xcde0('0x9')](_0x31fc56,_0xcde0('0x5a'));}}else{logger[_0xcde0('0x9')](_0x31fc56,_0xcde0('0x5b'));}};exports[_0xcde0('0x5c')]=function(_0x33b5aa){if(_0x33b5aa<=0x0){return!![];}return![];};exports[_0xcde0('0x5d')]=function(_0x7adb04,_0x755580,_0x2da0f2){_0x7adb04[_0xcde0('0x5e')]=_0x755580;_0x7adb04['name']=_0x7adb04['queue'];_0x7adb04[_0xcde0('0x5f')]=_0x7adb04[_0xcde0('0x60')];_0x7adb04[_0xcde0('0x61')]=_0xcde0('0x62');if(_0x2da0f2){_0x7adb04[_0xcde0('0x63')]=_0x2da0f2[_0xcde0('0x63')];}return _0x7adb04;};exports['buildAcw']=function(_0xd89378){var _0x3a873c={};_0x3a873c[_0xcde0('0x64')]=_0xd89378[_0xcde0('0x64')];_0x3a873c['interface']=_0xd89378[_0xcde0('0x60')];_0x3a873c[_0xcde0('0x46')]=_0xd89378['uniqueid'];return _0x3a873c;};exports[_0xcde0('0x65')]=function(_0x5bebfb){var _0x5cc4f3=[];for(var _0x3a267b in _0x5bebfb){if(_0x5bebfb[_0xcde0('0x29')](_0x3a267b)){if(!_[_0xcde0('0x14')](_0x5bebfb[_0x3a267b])&&_0x5bebfb[_0x3a267b][_0xcde0('0x36')]===_0xcde0('0x66')&&_0x5bebfb[_0x3a267b]['status']===_0xcde0('0x67')){_0x5cc4f3[_0xcde0('0x68')](_0x5bebfb[_0x3a267b]['id']);}}}return _0x5cc4f3;};exports[_0xcde0('0x69')]=function(_0x32db2b){var _0x488ca4=moment()[_0xcde0('0x6')](0x0);var _0x5118b7=moment(_0x32db2b)[_0xcde0('0x6')](0x0);return _0x488ca4['diff'](_0x5118b7,_0xcde0('0x6a'));};exports['createBody']=function(_0xb88728){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xb88728[_0xcde0('0x1a')],'ListId':_0xb88728['ListId'],'VoiceQueueId':_0xb88728['VoiceQueueId']||undefined,'CampaignId':_0xb88728['CampaignId']||undefined};};exports[_0xcde0('0x6b')]=function(_0x39a550){if(_0x39a550===_0xcde0('0x46')||_0x39a550==='idContact'||_0x39a550===_0xcde0('0x64')||_0x39a550===_0xcde0('0x6c')||_0x39a550===_0xcde0('0x6d')||_0x39a550===_0xcde0('0x6e')||_0x39a550===_0xcde0('0x3d')||_0x39a550===_0xcde0('0x60')||_0x39a550===_0xcde0('0x18')||_0x39a550===_0xcde0('0x52')||_0x39a550==='calleridnum'||_0x39a550===_0xcde0('0x53')||_0x39a550===_0xcde0('0x4b')||_0x39a550==='countcongestionretry'||_0x39a550===_0xcde0('0x4d')||_0x39a550===_0xcde0('0x6f')||_0x39a550===_0xcde0('0x70')||_0x39a550===_0xcde0('0x71')||_0x39a550===_0xcde0('0x72')||_0x39a550===_0xcde0('0x73')||_0x39a550===_0xcde0('0x1a')||_0x39a550==='ListId'||_0x39a550===_0xcde0('0x3e')||_0x39a550===_0xcde0('0x57')||_0x39a550===_0xcde0('0x74')||_0x39a550===_0xcde0('0x75')||_0x39a550==='xmd-queue'||_0x39a550===_0xcde0('0x76')||_0x39a550===_0xcde0('0x77')||_0x39a550===_0xcde0('0x78')||_0x39a550==='xmd-dialtimeout'||_0x39a550===_0xcde0('0x79')||_0x39a550==='xmd-dialid'||_0x39a550==='xmd-dialchannel'||_0x39a550==='xmd-contactid'||_0x39a550===_0xcde0('0x7a')||_0x39a550==='xmd-callerid'||_0x39a550==='xmd-agiafter'||_0x39a550==='xmd-agi'||_0x39a550===_0xcde0('0x7b')||_0x39a550==='rtpaudioqosbridged'||_0x39a550===_0xcde0('0x7c')||_0x39a550===_0xcde0('0x7d')||_0x39a550===_0xcde0('0x7e')||_0x39a550===_0xcde0('0x7f')||_0x39a550===_0xcde0('0x80')||_0x39a550===_0xcde0('0x81')||_0x39a550===_0xcde0('0x7b')||_0x39a550===_0xcde0('0x82')||_0x39a550===_0xcde0('0x7c')||_0x39a550===_0xcde0('0x7d')||_0x39a550===_0xcde0('0x7e')||_0x39a550===_0xcde0('0x7f')||_0x39a550===_0xcde0('0x80')||_0x39a550==='rtpaudioqosrttbridged'||_0x39a550==='bridgepeer'||_0x39a550===_0xcde0('0x83')||_0x39a550===_0xcde0('0x36')||_0x39a550===_0xcde0('0x37')){return![];}return!![];};exports[_0xcde0('0x84')]=function(_0x32c3f8,_0x329fc5){var _0xfd517a,_0x5731b1,_0x535f1b;if(_0x329fc5<=0x0){_0x329fc5=0x1;}_0xfd517a=new RegExp(_0xcde0('0x85')+_0x329fc5+'}$');_0x5731b1=Math[_0xcde0('0x86')](0xa,_0x329fc5-0x1);_0x535f1b=Math[_0xcde0('0x86')](0xa,_0x329fc5)-0x1;return util[_0xcde0('0x12')]('%s',_[_0xcde0('0x87')](_0x32c3f8,_0xfd517a,_[_0xcde0('0x88')](_0x5731b1,_0x535f1b)));};exports[_0xcde0('0x89')]=function(_0xf41b64){var _0x50a248=_0xf41b64['match'](/"(.*?)"/);return _0x50a248?_0x50a248[0x1]:_0xf41b64;};exports[_0xcde0('0x8a')]=function(_0x120d81){var _0x3ce736=_0x120d81[_0xcde0('0x8b')](/<(.*?)>/);return _0x3ce736?_0x3ce736[0x1]:_0x120d81;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 4e9edd0..e380d08 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 _0x38bc=['string','boolean','queueremove','queuepause','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0x4ff31e,_0x3a597a){var _0x345c45=function(_0x12b185){while(--_0x12b185){_0x4ff31e['push'](_0x4ff31e['shift']());}};_0x345c45(++_0x3a597a);}(_0x38bc,0x130));var _0xc38b=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x38bc[_0x2e4e19];return _0x9ba20b;};'use strict';exports['queueadd']={'queue':{'type':_0xc38b('0x0'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xc38b('0x0'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xc38b('0x1'),'required':![]}};exports[_0xc38b('0x2')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xc38b('0x0'),'required':!![]}};exports[_0xc38b('0x3')]={'interface':{'type':_0xc38b('0x0'),'required':!![]},'paused':{'type':_0xc38b('0x1')},'reason':{'type':_0xc38b('0x0'),'required':![]}};exports['reload']={'module':{'type':'string','required':![]}};exports[_0xc38b('0x4')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xc38b('0x5')]={'uniqueid':{'type':_0xc38b('0x0'),'required':!![]},'filename':{'type':_0xc38b('0x0')},'format':{'type':_0xc38b('0x0')},'mixmonitorid':{'type':_0xc38b('0x0')}};exports[_0xc38b('0x6')]={'uniqueid':{'type':_0xc38b('0x0'),'required':!![]}};exports[_0xc38b('0x7')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xc38b('0x0'),'required':!![]},'context':{'type':_0xc38b('0x0')}}; \ No newline at end of file +var _0x7818=['voicequeuechannel','voicechannel','voicequeuechannelredirect','queueadd','string','number','queueremove','queuepause','boolean','reload'];(function(_0x14eba0,_0x1bdf02){var _0x1edb31=function(_0x558c1d){while(--_0x558c1d){_0x14eba0['push'](_0x14eba0['shift']());}};_0x1edb31(++_0x1bdf02);}(_0x7818,0x111));var _0x8781=function(_0xade6a3,_0xd9d9a7){_0xade6a3=_0xade6a3-0x0;var _0x1c413c=_0x7818[_0xade6a3];return _0x1c413c;};'use strict';exports[_0x8781('0x0')]={'queue':{'type':_0x8781('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x8781('0x1'),'required':!![]},'penalty':{'type':_0x8781('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x8781('0x3')]={'queue':{'type':_0x8781('0x1'),'required':!![]},'interface':{'type':_0x8781('0x1'),'required':!![]}};exports[_0x8781('0x4')]={'interface':{'type':_0x8781('0x1'),'required':!![]},'paused':{'type':_0x8781('0x5')},'reason':{'type':_0x8781('0x1'),'required':![]}};exports[_0x8781('0x6')]={'module':{'type':'string','required':![]}};exports[_0x8781('0x7')]={'uniqueid':{'type':_0x8781('0x1'),'required':!![]}};exports[_0x8781('0x8')]={'uniqueid':{'type':_0x8781('0x1'),'required':!![]},'filename':{'type':_0x8781('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x8781('0x1'),'required':!![]}};exports[_0x8781('0x9')]={'uniqueid':{'type':_0x8781('0x1'),'required':!![]},'exten':{'type':_0x8781('0x1'),'required':!![]},'context':{'type':_0x8781('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 14e38c0..fd0f6dc 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 _0x276e=['sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','SIP/%s','name','hasOwnProperty','isNil','interface','total','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','format','telephones','isUndefined','initTrunks','initVoiceQueues','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initCampaignHopperHistory','initFaxAccounts','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','trunks','voiceQueues','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','settings','salesforceAccounts'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0x276e,0x1aa));var _0xe276=function(_0x508685,_0x9f94af){_0x508685=_0x508685-0x0;var _0x976a76=_0x276e[_0x508685];return _0x976a76;};'use strict';var BPromise=require('bluebird');var util=require(_0xe276('0x0'));var _=require(_0xe276('0x1'));var moment=require(_0xe276('0x2'));var Agent=require(_0xe276('0x3'));var Telephone=require(_0xe276('0x4'));var Trunk=require(_0xe276('0x5'));var VoiceQueue=require(_0xe276('0x6'));var Trigger=require(_0xe276('0x7'));var Template=require(_0xe276('0x8'));var Campaign=require(_0xe276('0x9'));var VoiceExtension=require(_0xe276('0xa'));var ZendeskAccount=require(_0xe276('0xb'));var SalesforceAccount=require(_0xe276('0xc'));var FreshdeskAccount=require(_0xe276('0xd'));var SugarcrmAccount=require(_0xe276('0xe'));var ZohoAccount=require(_0xe276('0xf'));var DeskAccount=require(_0xe276('0x10'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xe276('0x11'));var FreshsalesAccount=require(_0xe276('0x12'));var FaxAccount=require(_0xe276('0x13'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0xe276('0x14')]={};this[_0xe276('0x15')]={};this['triggers']={};this[_0xe276('0x16')]={};this['templates']={};this[_0xe276('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe276('0x18')]={};this[_0xe276('0x19')]={};this[_0xe276('0x1a')]={};this[_0xe276('0x1b')]={};this['timers']={};this[_0xe276('0x1c')]={};this['zendeskAccounts']={};this[_0xe276('0x1d')]={};this[_0xe276('0x1e')]={};this['freshdeskAccounts']={};this[_0xe276('0x1f')]={};this[_0xe276('0x20')]={};this[_0xe276('0x21')]={};this[_0xe276('0x22')]={};this[_0xe276('0x23')]={};this[_0xe276('0x24')]={};this[_0xe276('0x25')]={};};function freeIsNotKey(_0x52783e,_0x34e08f,_0x4de094){var _0x25c6f5=_[_0xe276('0x26')](_0x52783e,function(_0xf470b3,_0x437604){return _0xf470b3[_0x4de094];});for(var _0x15f079 in _0x34e08f){if(_0x34e08f['hasOwnProperty'](_0x15f079)){if(!_0x25c6f5[_0x15f079]){delete _0x34e08f[_0x15f079];}}}}function freeIsNotKeySip(_0x1a2cbf,_0x46b5b0){var _0x2a72e4=_[_0xe276('0x26')](_0x1a2cbf,function(_0x2620b6,_0x1f5e77){return util['format'](_0xe276('0x27'),_0x2620b6[_0xe276('0x28')]);});for(var _0x4014fe in _0x46b5b0){if(_0x46b5b0[_0xe276('0x29')](_0x4014fe)){if(!_0x2a72e4[_0x4014fe]){delete _0x46b5b0[_0x4014fe];}}}}function freeIsNotKeyAgent(_0x15dec7,_0x18e64c){var _0x52642b=_['mapKeys'](_0x15dec7,function(_0x5c776e,_0x4ab4bc){var _0x1eae61=_[_0xe276('0x2a')](_0x5c776e['interface'])?util['format'](_0xe276('0x27'),_0x5c776e['name']):_0x5c776e[_0xe276('0x2b')];return _0x1eae61;});for(var _0x31086a in _0x18e64c){if(_0x18e64c[_0xe276('0x29')](_0x31086a)){if(!_0x52642b[_0x31086a]){delete _0x18e64c[_0x31086a];}}}}function clearVoiceCallReports(_0x5cff94){_0x5cff94[_0xe276('0x2c')]=0x0;_0x5cff94['answered']=0x0;_0x5cff94[_0xe276('0x2d')]=0x0;_0x5cff94[_0xe276('0x2e')]=0x0;_0x5cff94[_0xe276('0x2f')]=0x0;}function clearCampaigns(_0x4f076b){if(!_[_0xe276('0x30')](_0x4f076b)){for(var _0x5dc296 in _0x4f076b){if(_0x4f076b['hasOwnProperty'](_0x5dc296)){_0x4f076b[_0x5dc296][_0xe276('0x31')]=0x0;_0x4f076b[_0x5dc296][_0xe276('0x32')]=0x0;}}}}function clearVoiceQueues(_0x546c76){if(!_[_0xe276('0x30')](_0x546c76)){for(var _0x2cdcd0 in _0x546c76){if(_0x546c76['hasOwnProperty'](_0x2cdcd0)){_0x546c76[_0x2cdcd0][_0xe276('0x2c')]=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x33')]=0x0;_0x546c76[_0x2cdcd0]['unmanaged']=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x34')]=0x0;_0x546c76[_0x2cdcd0]['sumHoldTime']=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x2e')]=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x2f')]=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x35')]=0x0;_0x546c76[_0x2cdcd0]['outboundNoAnswerCallsDay']=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x36')]=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x37')]=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x38')]=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x39')]=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x3a')]=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x3b')]=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x3c')]=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x3d')]=0x0;_0x546c76[_0x2cdcd0]['outboundRejectCallsDay']=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x3e')]=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x35')]=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x3f')]=0x0;_0x546c76[_0x2cdcd0][_0xe276('0x40')]=!![];}}}}Realtime[_0xe276('0x41')][_0xe276('0x42')]=function(_0x312f09,_0x518dd6){for(var _0x141a69 in _0x518dd6){if(_0x312f09[_0xe276('0x29')](_0x141a69)){_0x312f09[_0x141a69]=_0x518dd6[_0x141a69];}}};Realtime[_0xe276('0x41')][_0xe276('0x43')]=function(){var _0x375afb=this;return function(_0x506063){if(_0x506063){freeIsNotKeyAgent(_0x506063,_0x375afb[_0xe276('0x44')]);for(var _0x39dbde=0x0,_0x40d3d4={},_0x28a9bc={};_0x39dbde<_0x506063[_0xe276('0x45')];_0x39dbde+=0x1){_0x40d3d4=_0x506063[_0x39dbde];var _0x585b48=_[_0xe276('0x2a')](_0x40d3d4[_0xe276('0x2b')])?util[_0xe276('0x46')](_0xe276('0x27'),_0x40d3d4[_0xe276('0x28')]):_0x40d3d4['interface'];if(_['isUndefined'](_0x375afb['agents'][_0x585b48])){_0x375afb[_0xe276('0x44')][_0x585b48]=new Agent(_0x40d3d4);}else{_0x375afb[_0xe276('0x42')](_0x375afb[_0xe276('0x44')][_0x585b48],_0x40d3d4);}}}return _0x375afb[_0xe276('0x44')];};};Realtime['prototype']['initTelephones']=function(){var _0x5c8afa=this;return function(_0x5e3466){if(_0x5e3466){freeIsNotKeySip(_0x5e3466,_0x5c8afa[_0xe276('0x47')]);for(var _0x4b8134=0x0,_0x5f5d04={},_0x23f5e9={};_0x4b8134<_0x5e3466[_0xe276('0x45')];_0x4b8134+=0x1){_0x5f5d04=_0x5e3466[_0x4b8134];if(_[_0xe276('0x48')](_0x5c8afa[_0xe276('0x47')][util['format']('SIP/%s',_0x5f5d04[_0xe276('0x28')])])){_0x5c8afa['telephones'][util['format']('SIP/%s',_0x5f5d04[_0xe276('0x28')])]=new Telephone(_0x5f5d04);}else{_0x5c8afa[_0xe276('0x42')](_0x5c8afa[_0xe276('0x47')][util[_0xe276('0x46')]('SIP/%s',_0x5f5d04[_0xe276('0x28')])],_0x5f5d04);}}}return _0x5c8afa['telephones'];};};Realtime[_0xe276('0x41')][_0xe276('0x49')]=function(){var _0x2fe3fb=this;return function(_0x455066){if(_0x455066){freeIsNotKeySip(_0x455066,_0x2fe3fb[_0xe276('0x14')]);for(var _0x18d2f9=0x0,_0x2df078={},_0x998372={};_0x18d2f9<_0x455066[_0xe276('0x45')];_0x18d2f9+=0x1){_0x2df078=_0x455066[_0x18d2f9];if(_['isUndefined'](_0x2fe3fb[_0xe276('0x14')][util[_0xe276('0x46')](_0xe276('0x27'),_0x2df078[_0xe276('0x28')])])){_0x2fe3fb[_0xe276('0x14')][util['format']('SIP/%s',_0x2df078[_0xe276('0x28')])]=new Trunk(_0x2df078);}else{_0x2fe3fb[_0xe276('0x42')](_0x2fe3fb[_0xe276('0x14')][util[_0xe276('0x46')](_0xe276('0x27'),_0x2df078[_0xe276('0x28')])],_0x2df078);}}}return _0x2fe3fb[_0xe276('0x14')];};};Realtime[_0xe276('0x41')][_0xe276('0x4a')]=function(){var _0x32f637=this;return function(_0x240585){if(_0x240585){freeIsNotKey(_0x240585,_0x32f637[_0xe276('0x15')],_0xe276('0x28'));for(var _0x39cca6=0x0,_0x2ae50a={},_0x2689ef={};_0x39cca6<_0x240585[_0xe276('0x45')];_0x39cca6+=0x1){_0x2ae50a=_0x240585[_0x39cca6];if(_['isUndefined'](_0x32f637[_0xe276('0x15')][_0x2ae50a[_0xe276('0x28')]])){_0x32f637[_0xe276('0x15')][_0x2ae50a[_0xe276('0x28')]]=new VoiceQueue(_0x2ae50a);}else{_0x32f637[_0xe276('0x42')](_0x32f637['voiceQueues'][_0x2ae50a['name']],_0x2ae50a);}}}return _0x32f637['voiceQueues'];};};Realtime[_0xe276('0x41')][_0xe276('0x4b')]=function(){var _0x46fd92=this;return function(_0x3ce63b){if(_0x3ce63b){freeIsNotKey(_0x3ce63b,_0x46fd92[_0xe276('0x4c')],'id');for(var _0x4c8758=0x0,_0x3ced4a={},_0x2ab2e3={};_0x4c8758<_0x3ce63b[_0xe276('0x45')];_0x4c8758+=0x1){_0x3ced4a=_0x3ce63b[_0x4c8758];if(_[_0xe276('0x48')](_0x46fd92[_0xe276('0x4c')][_0x3ced4a['id']])){_0x46fd92[_0xe276('0x4c')][_0x3ced4a['id']]=new Trigger(_0x3ced4a);}else{_0x46fd92[_0xe276('0x42')](_0x46fd92['triggers'][_0x3ced4a['id']],_0x3ced4a);}}}return _0x46fd92[_0xe276('0x4c')];};};Realtime[_0xe276('0x41')][_0xe276('0x4d')]=function(){var _0x370a35=this;return function(_0x52022e){if(_0x52022e){freeIsNotKey(_0x52022e,_0x370a35[_0xe276('0x4e')],'id');for(var _0x1c042f=0x0,_0x453105={},_0x8a0f1e={};_0x1c042f<_0x52022e[_0xe276('0x45')];_0x1c042f+=0x1){_0x453105=_0x52022e[_0x1c042f];if(_['isUndefined'](_0x370a35[_0xe276('0x4e')][_0x453105['id']])){_0x370a35[_0xe276('0x4e')][_0x453105['id']]=new Template(_0x453105);}else{_0x370a35[_0xe276('0x42')](_0x370a35[_0xe276('0x4e')][_0x453105['id']],_0x453105);}}}return _0x370a35[_0xe276('0x4e')];};};Realtime[_0xe276('0x41')][_0xe276('0x4f')]=function(){var _0x230034=this;return function(_0x41703f){if(_0x41703f){freeIsNotKey(_0x41703f,_0x230034[_0xe276('0x50')],'id');for(var _0x3a5196=0x0,_0x5b5543={},_0x201075={};_0x3a5196<_0x41703f[_0xe276('0x45')];_0x3a5196+=0x1){_0x5b5543=_0x41703f[_0x3a5196];if(_[_0xe276('0x48')](_0x230034[_0xe276('0x50')][_0x5b5543['id']])){_0x230034[_0xe276('0x50')][_0x5b5543['id']]=new ZendeskAccount(_0x5b5543);}else{_0x230034[_0xe276('0x42')](_0x230034[_0xe276('0x50')][_0x5b5543['id']],_0x5b5543);}}}return _0x230034[_0xe276('0x50')];};};Realtime[_0xe276('0x41')][_0xe276('0x51')]=function(){var _0x41b861=this;return function(_0x4b217e){if(_0x4b217e){freeIsNotKey(_0x4b217e,_0x41b861[_0xe276('0x1d')],'id');for(var _0x18a720=0x0,_0x222b9c={},_0x3f07b9={};_0x18a720<_0x4b217e[_0xe276('0x45')];_0x18a720+=0x1){_0x222b9c=_0x4b217e[_0x18a720];if(_[_0xe276('0x48')](_0x41b861[_0xe276('0x1d')][_0x222b9c['id']])){_0x41b861[_0xe276('0x1d')][_0x222b9c['id']]=new SalesforceAccount(_0x222b9c);}else{_0x41b861[_0xe276('0x42')](_0x41b861[_0xe276('0x1d')][_0x222b9c['id']],_0x222b9c);}}}return _0x41b861['salesforceAccounts'];};};Realtime['prototype'][_0xe276('0x52')]=function(){var _0x2997c7=this;return function(_0x3996e0){if(_0x3996e0){freeIsNotKey(_0x3996e0,_0x2997c7[_0xe276('0x53')],'id');for(var _0x1db4fe=0x0,_0x5478d0={},_0x5c806a={};_0x1db4fe<_0x3996e0[_0xe276('0x45')];_0x1db4fe+=0x1){_0x5478d0=_0x3996e0[_0x1db4fe];if(_[_0xe276('0x48')](_0x2997c7[_0xe276('0x53')][_0x5478d0['id']])){_0x2997c7[_0xe276('0x53')][_0x5478d0['id']]=new FreshdeskAccount(_0x5478d0);}else{_0x2997c7[_0xe276('0x42')](_0x2997c7[_0xe276('0x53')][_0x5478d0['id']],_0x5478d0);}}}return _0x2997c7['freshdeskAccounts'];};};Realtime['prototype'][_0xe276('0x54')]=function(){var _0x19624d=this;return function(_0x1fde9c){if(_0x1fde9c){freeIsNotKey(_0x1fde9c,_0x19624d['zohoAccounts'],'id');for(var _0x5bee8a=0x0,_0x3a6d6c={},_0x45c20a={};_0x5bee8a<_0x1fde9c['length'];_0x5bee8a+=0x1){_0x3a6d6c=_0x1fde9c[_0x5bee8a];if(_[_0xe276('0x48')](_0x19624d['zohoAccounts'][_0x3a6d6c['id']])){_0x19624d['zohoAccounts'][_0x3a6d6c['id']]=new ZohoAccount(_0x3a6d6c);}else{_0x19624d[_0xe276('0x42')](_0x19624d[_0xe276('0x1f')][_0x3a6d6c['id']],_0x3a6d6c);}}}return _0x19624d['zohoAccounts'];};};Realtime[_0xe276('0x41')][_0xe276('0x55')]=function(){var _0x593fb2=this;return function(_0x3e2112){if(_0x3e2112){freeIsNotKey(_0x3e2112,_0x593fb2['deskAccounts'],'id');for(var _0x139994=0x0,_0x385ad7={},_0x371746={};_0x139994<_0x3e2112[_0xe276('0x45')];_0x139994+=0x1){_0x385ad7=_0x3e2112[_0x139994];if(_[_0xe276('0x48')](_0x593fb2['deskAccounts'][_0x385ad7['id']])){_0x593fb2[_0xe276('0x20')][_0x385ad7['id']]=new DeskAccount(_0x385ad7);}else{_0x593fb2['mergeFromDatabase'](_0x593fb2[_0xe276('0x20')][_0x385ad7['id']],_0x385ad7);}}}return _0x593fb2[_0xe276('0x20')];};};Realtime['prototype'][_0xe276('0x56')]=function(){var _0x3411a4=this;return function(_0x539169){if(_0x539169){freeIsNotKey(_0x539169,_0x3411a4['sugarcrmAccounts'],'id');for(var _0x17e427=0x0,_0x1f1504={},_0x434e88={};_0x17e427<_0x539169[_0xe276('0x45')];_0x17e427+=0x1){_0x1f1504=_0x539169[_0x17e427];if(_[_0xe276('0x48')](_0x3411a4[_0xe276('0x1e')][_0x1f1504['id']])){_0x3411a4['sugarcrmAccounts'][_0x1f1504['id']]=new SugarcrmAccount(_0x1f1504);}else{_0x3411a4[_0xe276('0x42')](_0x3411a4['sugarcrmAccounts'][_0x1f1504['id']],_0x1f1504);}}}return _0x3411a4[_0xe276('0x1e')];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x60e069=this;return function(_0x51bdfd){if(_0x51bdfd){freeIsNotKey(_0x51bdfd,_0x60e069['vtigerAccounts'],'id');for(var _0xa9d460=0x0,_0x56a755={},_0x4bc889={};_0xa9d460<_0x51bdfd[_0xe276('0x45')];_0xa9d460+=0x1){_0x56a755=_0x51bdfd[_0xa9d460];if(_[_0xe276('0x48')](_0x60e069['vtigerAccounts'][_0x56a755['id']])){_0x60e069[_0xe276('0x21')][_0x56a755['id']]=new VtigerAccount(_0x56a755);}else{_0x60e069[_0xe276('0x42')](_0x60e069[_0xe276('0x21')][_0x56a755['id']],_0x56a755);}}}return _0x60e069[_0xe276('0x21')];};};Realtime[_0xe276('0x41')][_0xe276('0x57')]=function(){var _0x301aa0=this;return function(_0x11a453){if(_0x11a453){freeIsNotKey(_0x11a453,_0x301aa0['servicenowAccounts'],'id');for(var _0xafc7d1=0x0,_0x2215d6={},_0x378c2a={};_0xafc7d1<_0x11a453[_0xe276('0x45')];_0xafc7d1+=0x1){_0x2215d6=_0x11a453[_0xafc7d1];if(_[_0xe276('0x48')](_0x301aa0[_0xe276('0x22')][_0x2215d6['id']])){_0x301aa0[_0xe276('0x22')][_0x2215d6['id']]=new ServicenowAccount(_0x2215d6);}else{_0x301aa0['mergeFromDatabase'](_0x301aa0[_0xe276('0x22')][_0x2215d6['id']],_0x2215d6);}}}return _0x301aa0[_0xe276('0x22')];};};Realtime[_0xe276('0x41')][_0xe276('0x58')]=function(){var _0x1dc183=this;return function(_0x4002fb){if(_0x4002fb){freeIsNotKey(_0x4002fb,_0x1dc183[_0xe276('0x23')],'id');for(var _0x33f741=0x0,_0x4183b3={},_0x2fd102={};_0x33f741<_0x4002fb[_0xe276('0x45')];_0x33f741+=0x1){_0x4183b3=_0x4002fb[_0x33f741];if(_['isUndefined'](_0x1dc183[_0xe276('0x23')][_0x4183b3['id']])){_0x1dc183[_0xe276('0x23')][_0x4183b3['id']]=new Dynamics365Account(_0x4183b3);}else{_0x1dc183[_0xe276('0x42')](_0x1dc183[_0xe276('0x23')][_0x4183b3['id']],_0x4183b3);}}}return _0x1dc183[_0xe276('0x23')];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0xea1b71=this;return function(_0x3afee2){if(_0x3afee2){freeIsNotKey(_0x3afee2,_0xea1b71[_0xe276('0x24')],'id');for(var _0x142899=0x0,_0x4352e9={},_0x14f3db={};_0x142899<_0x3afee2[_0xe276('0x45')];_0x142899+=0x1){_0x4352e9=_0x3afee2[_0x142899];if(_[_0xe276('0x48')](_0xea1b71[_0xe276('0x24')][_0x4352e9['id']])){_0xea1b71['freshsalesAccounts'][_0x4352e9['id']]=new FreshsalesAccount(_0x4352e9);}else{_0xea1b71[_0xe276('0x42')](_0xea1b71[_0xe276('0x24')][_0x4352e9['id']],_0x4352e9);}}}return _0xea1b71['freshsalesAccounts'];};};Realtime['prototype'][_0xe276('0x59')]=function(){var _0x84407=this;return function(_0x9def73){for(var _0xb649f=0x0;_0xb649f<_0x9def73['length'];_0xb649f+=0x1){_[_0xe276('0x5a')](_0x84407[_0xe276('0x15')][_0x9def73[_0xb649f][_0xe276('0x28')]],_0x9def73[_0xb649f]);}return _0x84407[_0xe276('0x15')];};};Realtime['prototype'][_0xe276('0x5b')]=function(){var _0x55afb8=this;return function(_0x492abc){clearVoiceQueues(_0x55afb8[_0xe276('0x15')]);if(_0x492abc){_0x492abc=_[_0xe276('0x5c')](_0x492abc,_0xe276('0x5d'));for(var _0x240cb7 in _0x492abc){if(_0x492abc[_0xe276('0x29')](_0x240cb7)){var _0x3072d6={};for(var _0x390f44=0x0;_0x390f44<_0x492abc[_0x240cb7]['length'];_0x390f44+=0x1){var _0x53c13c=_0x492abc[_0x240cb7][_0x390f44][_0xe276('0x5e')];if(_0x55afb8[_0xe276('0x15')][_0x53c13c]){if(_0x492abc[_0x240cb7][_0x390f44][_0xe276('0x5f')]){_0x55afb8[_0xe276('0x15')][_0x53c13c][_0xe276('0x60')]+=0x1;}if(_0x492abc[_0x240cb7][_0x390f44][_0xe276('0x61')]){_0x55afb8[_0xe276('0x15')][_0x53c13c][_0xe276('0x34')]+=0x1;}_0x55afb8['voiceQueues'][_0x53c13c][_0xe276('0x2d')]+=moment(_0x492abc[_0x240cb7][_0x390f44][_0xe276('0x62')])['diff'](moment(_0x492abc[_0x240cb7][_0x390f44][_0xe276('0x63')]),_0xe276('0x64'))||0x0;if(_0x390f44===_0x492abc[_0x240cb7][_0xe276('0x45')]-0x1){_0x55afb8[_0xe276('0x15')][_0x53c13c][_0xe276('0x2e')]+=moment(_0x492abc[_0x240cb7][_0x390f44][_0xe276('0x65')]||_0x492abc[_0x240cb7][_0x390f44][_0xe276('0x66')]||_0x492abc[_0x240cb7][_0x390f44][_0xe276('0x67')])['diff'](moment(_0x492abc[_0x240cb7][_0x390f44]['queuecallerjoinAt']),_0xe276('0x64'))||0x0;_0x55afb8[_0xe276('0x15')][_0x53c13c][_0xe276('0x2c')]+=0x1;if(_0x492abc[_0x240cb7][_0x390f44]['queuecallercomplete']){_0x55afb8[_0xe276('0x15')][_0x53c13c][_0xe276('0x33')]+=0x1;_0x55afb8[_0xe276('0x15')][_0x53c13c][_0xe276('0x2f')]+=moment(_0x492abc[_0x240cb7][_0x390f44]['queuecallercompleteAt'])[_0xe276('0x68')](moment(_0x492abc[_0x240cb7][_0x390f44][_0xe276('0x62')]),'seconds')||0x0;}}else{_0x55afb8['voiceQueues'][_0x53c13c][_0xe276('0x2e')]+=_0x55afb8[_0xe276('0x15')][_0x53c13c][_0xe276('0x2d')]||0x0;}}}}}}return _0x55afb8['voiceQueues'];};};Realtime[_0xe276('0x41')][_0xe276('0x69')]=function(){var _0x4b8889=this;return function(_0x34155d){clearVoiceCallReports(_0x4b8889['outbound']);if(_0x34155d){for(var _0x59f73e=0x0;_0x59f73e<_0x34155d[_0xe276('0x45')];_0x59f73e+=0x1){_0x4b8889['outbound']['total']+=0x1;_0x4b8889[_0xe276('0x17')][_0xe276('0x2e')]+=_0x34155d[_0x59f73e][_0xe276('0x6a')];if(_0x34155d[_0x59f73e]['disposition']===_0xe276('0x6b')){_0x4b8889[_0xe276('0x17')][_0xe276('0x33')]+=0x1;_0x4b8889[_0xe276('0x17')][_0xe276('0x2d')]+=_0x34155d[_0x59f73e]['duration']-_0x34155d[_0x59f73e][_0xe276('0x6c')]||0x0;_0x4b8889[_0xe276('0x17')]['sumBillable']+=_0x34155d[_0x59f73e][_0xe276('0x6c')];}}}return _0x4b8889[_0xe276('0x17')];};};Realtime[_0xe276('0x41')][_0xe276('0x6d')]=function(){var _0x434dd0=this;return function(_0x3a8ccc){if(_0x3a8ccc){freeIsNotKey(_0x3a8ccc,_0x434dd0[_0xe276('0x16')],_0xe276('0x28'));for(var _0x248e27=0x0,_0x3c221e={};_0x248e27<_0x3a8ccc[_0xe276('0x45')];_0x248e27+=0x1){_0x3c221e=_0x3a8ccc[_0x248e27];if(_['isUndefined'](_0x434dd0[_0xe276('0x16')][_0x3c221e[_0xe276('0x28')]])){_0x434dd0['campaigns'][_0x3c221e[_0xe276('0x28')]]=new Campaign(_0x3c221e);}else{_0x434dd0[_0xe276('0x42')](_0x434dd0[_0xe276('0x16')][_0x3c221e[_0xe276('0x28')]],_0x3c221e);_0x434dd0[_0xe276('0x16')][_0x3c221e[_0xe276('0x28')]][_0xe276('0x6e')]=_0x3c221e[_0xe276('0x6f')]?_0x3c221e[_0xe276('0x6f')][_0xe276('0x28')]:undefined;}}}return _0x434dd0[_0xe276('0x16')];};};Realtime[_0xe276('0x41')]['initVoiceExtensions']=function(){var _0xc436c3=this;return function(_0x37b9ef){if(_0x37b9ef){freeIsNotKey(_0x37b9ef,_0xc436c3[_0xe276('0x18')],'id');for(var _0x134dad=0x0,_0x5db91b={};_0x134dad<_0x37b9ef[_0xe276('0x45')];_0x134dad+=0x1){_0x5db91b=_0x37b9ef[_0x134dad];if(_[_0xe276('0x48')](_0xc436c3['voiceExtensions'][_0x5db91b['id']])){_0xc436c3[_0xe276('0x18')][_0x5db91b['id']]=new VoiceExtension(_0x5db91b);}else{_0xc436c3[_0xe276('0x42')](_0xc436c3['voiceExtensions'][_0x5db91b['id']],_0x5db91b);}}}return _0xc436c3[_0xe276('0x18')];};};Realtime[_0xe276('0x41')][_0xe276('0x70')]=function(){var _0x1341ba=this;return function(_0x558a1e){clearCampaigns(_0x1341ba[_0xe276('0x16')]);for(var _0x19e205=0x0;_0x19e205<_0x558a1e[_0xe276('0x45')];_0x19e205+=0x1){_['merge'](_0x1341ba[_0xe276('0x16')][_0x558a1e[_0x19e205][_0xe276('0x28')]],_0x558a1e[_0x19e205]);}return _0x1341ba[_0xe276('0x16')];};};Realtime[_0xe276('0x41')][_0xe276('0x71')]=function(){var _0x3a6ebc=this;return function(_0x155052){if(_0x155052){freeIsNotKey(_0x155052,_0x3a6ebc[_0xe276('0x25')],'id');for(var _0x537dd7=0x0,_0x1933e8={},_0x5a4630={};_0x537dd7<_0x155052['length'];_0x537dd7+=0x1){_0x1933e8=_0x155052[_0x537dd7];if(_[_0xe276('0x48')](_0x3a6ebc[_0xe276('0x25')][_0x1933e8['id']])){_0x3a6ebc[_0xe276('0x25')][_0x1933e8['id']]=new FaxAccount(_0x1933e8);}else{_0x3a6ebc['mergeFromDatabase'](_0x3a6ebc[_0xe276('0x25')][_0x1933e8['id']],_0x1933e8);}}}return _0x3a6ebc['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0x7838=['ANSWERED','billableseconds','initCampaigns','campaigns','SquareProject','initVoiceExtensions','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','moment','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','trunks','triggers','templates','voiceExtensions','channels','queueChannels','timers','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','hasOwnProperty','SIP/%s','interface','name','total','answered','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','unmanaged','abandoned','sumHoldTime','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','agents','length','isNil','format','isUndefined','initTelephones','telephones','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerleaveAt','diff','queuecallerjoinAt','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','seconds','sumBillable','outbound','duration','disposition'];(function(_0x58736a,_0x5d0121){var _0x4518e2=function(_0x2d9433){while(--_0x2d9433){_0x58736a['push'](_0x58736a['shift']());}};_0x4518e2(++_0x5d0121);}(_0x7838,0x74));var _0x8783=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x7838[_0x3a6efd];return _0x487b9a;};'use strict';var BPromise=require(_0x8783('0x0'));var util=require(_0x8783('0x1'));var _=require(_0x8783('0x2'));var moment=require(_0x8783('0x3'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0x8783('0x4'));var VoiceQueue=require(_0x8783('0x5'));var Trigger=require(_0x8783('0x6'));var Template=require(_0x8783('0x7'));var Campaign=require(_0x8783('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8783('0x9'));var SalesforceAccount=require(_0x8783('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x8783('0xb'));var VtigerAccount=require(_0x8783('0xc'));var ServicenowAccount=require(_0x8783('0xd'));var Dynamics365Account=require(_0x8783('0xe'));var FreshsalesAccount=require(_0x8783('0xf'));var FaxAccount=require(_0x8783('0x10'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0x8783('0x11')]={};this['voiceQueues']={};this[_0x8783('0x12')]={};this['campaigns']={};this[_0x8783('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8783('0x14')]={};this[_0x8783('0x15')]={};this[_0x8783('0x16')]={};this['outboundChannels']={};this[_0x8783('0x17')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8783('0x18')]={};this['sugarcrmAccounts']={};this[_0x8783('0x19')]={};this[_0x8783('0x1a')]={};this[_0x8783('0x1b')]={};this[_0x8783('0x1c')]={};this[_0x8783('0x1d')]={};this['dynamics365Accounts']={};this[_0x8783('0x1e')]={};this['faxAccounts']={};};function freeIsNotKey(_0x4e2dfa,_0x576413,_0x5cf0d4){var _0x865fe8=_[_0x8783('0x1f')](_0x4e2dfa,function(_0x30119e,_0x519d44){return _0x30119e[_0x5cf0d4];});for(var _0x30ef52 in _0x576413){if(_0x576413[_0x8783('0x20')](_0x30ef52)){if(!_0x865fe8[_0x30ef52]){delete _0x576413[_0x30ef52];}}}}function freeIsNotKeySip(_0xe72c94,_0x2b6383){var _0x2a2be4=_[_0x8783('0x1f')](_0xe72c94,function(_0x224218,_0x4928e8){return util['format'](_0x8783('0x21'),_0x224218['name']);});for(var _0x59f429 in _0x2b6383){if(_0x2b6383[_0x8783('0x20')](_0x59f429)){if(!_0x2a2be4[_0x59f429]){delete _0x2b6383[_0x59f429];}}}}function freeIsNotKeyAgent(_0x228a65,_0x3a290f){var _0x17d6fb=_[_0x8783('0x1f')](_0x228a65,function(_0x3bf9d3,_0x289a57){var _0x1ca15f=_['isNil'](_0x3bf9d3[_0x8783('0x22')])?util['format'](_0x8783('0x21'),_0x3bf9d3[_0x8783('0x23')]):_0x3bf9d3['interface'];return _0x1ca15f;});for(var _0x24affb in _0x3a290f){if(_0x3a290f[_0x8783('0x20')](_0x24affb)){if(!_0x17d6fb[_0x24affb]){delete _0x3a290f[_0x24affb];}}}}function clearVoiceCallReports(_0x811ecd){_0x811ecd[_0x8783('0x24')]=0x0;_0x811ecd[_0x8783('0x25')]=0x0;_0x811ecd['sumHoldTime']=0x0;_0x811ecd['sumDuration']=0x0;_0x811ecd['sumBillable']=0x0;}function clearCampaigns(_0x5674e7){if(!_['isEmpty'](_0x5674e7)){for(var _0x45ef1b in _0x5674e7){if(_0x5674e7[_0x8783('0x20')](_0x45ef1b)){_0x5674e7[_0x45ef1b][_0x8783('0x26')]=0x0;_0x5674e7[_0x45ef1b][_0x8783('0x27')]=0x0;}}}}function clearVoiceQueues(_0xf7e4d8){if(!_[_0x8783('0x28')](_0xf7e4d8)){for(var _0x53b07a in _0xf7e4d8){if(_0xf7e4d8[_0x8783('0x20')](_0x53b07a)){_0xf7e4d8[_0x53b07a][_0x8783('0x24')]=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x25')]=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x29')]=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x2a')]=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x2b')]=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x2c')]=0x0;_0xf7e4d8[_0x53b07a]['sumBillable']=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x2d')]=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x2e')]=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x2f')]=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x30')]=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x31')]=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x32')]=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x33')]=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x34')]=0x0;_0xf7e4d8[_0x53b07a]['outboundBlacklistCallsDay']=0x0;_0xf7e4d8[_0x53b07a]['outboundOriginateFailureCallsDay']=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x35')]=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x36')]=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x2d')]=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x37')]=0x0;_0xf7e4d8[_0x53b07a][_0x8783('0x38')]=!![];}}}}Realtime[_0x8783('0x39')][_0x8783('0x3a')]=function(_0x620746,_0x2c2385){for(var _0x5829b0 in _0x2c2385){if(_0x620746[_0x8783('0x20')](_0x5829b0)){_0x620746[_0x5829b0]=_0x2c2385[_0x5829b0];}}};Realtime['prototype']['initAgents']=function(){var _0x4ac16c=this;return function(_0x4404ea){if(_0x4404ea){freeIsNotKeyAgent(_0x4404ea,_0x4ac16c[_0x8783('0x3b')]);for(var _0x300753=0x0,_0xfc31c8={},_0x78ff10={};_0x300753<_0x4404ea[_0x8783('0x3c')];_0x300753+=0x1){_0xfc31c8=_0x4404ea[_0x300753];var _0xccda83=_[_0x8783('0x3d')](_0xfc31c8[_0x8783('0x22')])?util[_0x8783('0x3e')]('SIP/%s',_0xfc31c8['name']):_0xfc31c8['interface'];if(_[_0x8783('0x3f')](_0x4ac16c[_0x8783('0x3b')][_0xccda83])){_0x4ac16c[_0x8783('0x3b')][_0xccda83]=new Agent(_0xfc31c8);}else{_0x4ac16c[_0x8783('0x3a')](_0x4ac16c[_0x8783('0x3b')][_0xccda83],_0xfc31c8);}}}return _0x4ac16c[_0x8783('0x3b')];};};Realtime['prototype'][_0x8783('0x40')]=function(){var _0x1c4fee=this;return function(_0x20fc1a){if(_0x20fc1a){freeIsNotKeySip(_0x20fc1a,_0x1c4fee[_0x8783('0x41')]);for(var _0x251437=0x0,_0x1138e3={},_0x3d3225={};_0x251437<_0x20fc1a[_0x8783('0x3c')];_0x251437+=0x1){_0x1138e3=_0x20fc1a[_0x251437];if(_[_0x8783('0x3f')](_0x1c4fee[_0x8783('0x41')][util['format'](_0x8783('0x21'),_0x1138e3[_0x8783('0x23')])])){_0x1c4fee[_0x8783('0x41')][util['format'](_0x8783('0x21'),_0x1138e3[_0x8783('0x23')])]=new Telephone(_0x1138e3);}else{_0x1c4fee['mergeFromDatabase'](_0x1c4fee['telephones'][util['format'](_0x8783('0x21'),_0x1138e3[_0x8783('0x23')])],_0x1138e3);}}}return _0x1c4fee['telephones'];};};Realtime[_0x8783('0x39')][_0x8783('0x42')]=function(){var _0x4fff97=this;return function(_0x5041ac){if(_0x5041ac){freeIsNotKeySip(_0x5041ac,_0x4fff97[_0x8783('0x11')]);for(var _0x4d3be6=0x0,_0x5d1b3a={},_0x10ff2f={};_0x4d3be6<_0x5041ac[_0x8783('0x3c')];_0x4d3be6+=0x1){_0x5d1b3a=_0x5041ac[_0x4d3be6];if(_['isUndefined'](_0x4fff97[_0x8783('0x11')][util['format'](_0x8783('0x21'),_0x5d1b3a[_0x8783('0x23')])])){_0x4fff97[_0x8783('0x11')][util['format'](_0x8783('0x21'),_0x5d1b3a[_0x8783('0x23')])]=new Trunk(_0x5d1b3a);}else{_0x4fff97['mergeFromDatabase'](_0x4fff97[_0x8783('0x11')][util['format'](_0x8783('0x21'),_0x5d1b3a[_0x8783('0x23')])],_0x5d1b3a);}}}return _0x4fff97[_0x8783('0x11')];};};Realtime[_0x8783('0x39')][_0x8783('0x43')]=function(){var _0x29b6b2=this;return function(_0x1dd888){if(_0x1dd888){freeIsNotKey(_0x1dd888,_0x29b6b2[_0x8783('0x44')],_0x8783('0x23'));for(var _0x4d3964=0x0,_0xcc6e85={},_0x53653d={};_0x4d3964<_0x1dd888['length'];_0x4d3964+=0x1){_0xcc6e85=_0x1dd888[_0x4d3964];if(_['isUndefined'](_0x29b6b2[_0x8783('0x44')][_0xcc6e85[_0x8783('0x23')]])){_0x29b6b2[_0x8783('0x44')][_0xcc6e85[_0x8783('0x23')]]=new VoiceQueue(_0xcc6e85);}else{_0x29b6b2[_0x8783('0x3a')](_0x29b6b2['voiceQueues'][_0xcc6e85[_0x8783('0x23')]],_0xcc6e85);}}}return _0x29b6b2[_0x8783('0x44')];};};Realtime['prototype'][_0x8783('0x45')]=function(){var _0x3acf53=this;return function(_0x8730ee){if(_0x8730ee){freeIsNotKey(_0x8730ee,_0x3acf53[_0x8783('0x12')],'id');for(var _0x699eea=0x0,_0x2c26c8={},_0x341d17={};_0x699eea<_0x8730ee[_0x8783('0x3c')];_0x699eea+=0x1){_0x2c26c8=_0x8730ee[_0x699eea];if(_[_0x8783('0x3f')](_0x3acf53[_0x8783('0x12')][_0x2c26c8['id']])){_0x3acf53[_0x8783('0x12')][_0x2c26c8['id']]=new Trigger(_0x2c26c8);}else{_0x3acf53[_0x8783('0x3a')](_0x3acf53[_0x8783('0x12')][_0x2c26c8['id']],_0x2c26c8);}}}return _0x3acf53[_0x8783('0x12')];};};Realtime[_0x8783('0x39')][_0x8783('0x46')]=function(){var _0x5036f9=this;return function(_0x3ebad8){if(_0x3ebad8){freeIsNotKey(_0x3ebad8,_0x5036f9[_0x8783('0x13')],'id');for(var _0x229131=0x0,_0x5e0127={},_0x33317a={};_0x229131<_0x3ebad8[_0x8783('0x3c')];_0x229131+=0x1){_0x5e0127=_0x3ebad8[_0x229131];if(_[_0x8783('0x3f')](_0x5036f9[_0x8783('0x13')][_0x5e0127['id']])){_0x5036f9['templates'][_0x5e0127['id']]=new Template(_0x5e0127);}else{_0x5036f9['mergeFromDatabase'](_0x5036f9[_0x8783('0x13')][_0x5e0127['id']],_0x5e0127);}}}return _0x5036f9['templates'];};};Realtime[_0x8783('0x39')][_0x8783('0x47')]=function(){var _0x29bbfb=this;return function(_0x392894){if(_0x392894){freeIsNotKey(_0x392894,_0x29bbfb[_0x8783('0x48')],'id');for(var _0x3f41f0=0x0,_0x4dcf03={},_0x5e3305={};_0x3f41f0<_0x392894['length'];_0x3f41f0+=0x1){_0x4dcf03=_0x392894[_0x3f41f0];if(_[_0x8783('0x3f')](_0x29bbfb[_0x8783('0x48')][_0x4dcf03['id']])){_0x29bbfb[_0x8783('0x48')][_0x4dcf03['id']]=new ZendeskAccount(_0x4dcf03);}else{_0x29bbfb[_0x8783('0x3a')](_0x29bbfb[_0x8783('0x48')][_0x4dcf03['id']],_0x4dcf03);}}}return _0x29bbfb[_0x8783('0x48')];};};Realtime[_0x8783('0x39')][_0x8783('0x49')]=function(){var _0x4d315b=this;return function(_0x43087c){if(_0x43087c){freeIsNotKey(_0x43087c,_0x4d315b[_0x8783('0x18')],'id');for(var _0x52d0e0=0x0,_0x73db3d={},_0x4acbbe={};_0x52d0e0<_0x43087c['length'];_0x52d0e0+=0x1){_0x73db3d=_0x43087c[_0x52d0e0];if(_[_0x8783('0x3f')](_0x4d315b[_0x8783('0x18')][_0x73db3d['id']])){_0x4d315b['salesforceAccounts'][_0x73db3d['id']]=new SalesforceAccount(_0x73db3d);}else{_0x4d315b[_0x8783('0x3a')](_0x4d315b['salesforceAccounts'][_0x73db3d['id']],_0x73db3d);}}}return _0x4d315b[_0x8783('0x18')];};};Realtime[_0x8783('0x39')][_0x8783('0x4a')]=function(){var _0x2056c1=this;return function(_0x53c45b){if(_0x53c45b){freeIsNotKey(_0x53c45b,_0x2056c1[_0x8783('0x19')],'id');for(var _0x1d3eb4=0x0,_0x54b31a={},_0x24ca47={};_0x1d3eb4<_0x53c45b[_0x8783('0x3c')];_0x1d3eb4+=0x1){_0x54b31a=_0x53c45b[_0x1d3eb4];if(_['isUndefined'](_0x2056c1[_0x8783('0x19')][_0x54b31a['id']])){_0x2056c1['freshdeskAccounts'][_0x54b31a['id']]=new FreshdeskAccount(_0x54b31a);}else{_0x2056c1[_0x8783('0x3a')](_0x2056c1['freshdeskAccounts'][_0x54b31a['id']],_0x54b31a);}}}return _0x2056c1['freshdeskAccounts'];};};Realtime[_0x8783('0x39')]['initZohoAccounts']=function(){var _0x10cfd3=this;return function(_0x10bf3e){if(_0x10bf3e){freeIsNotKey(_0x10bf3e,_0x10cfd3['zohoAccounts'],'id');for(var _0x3d273c=0x0,_0x36a696={},_0x1720cf={};_0x3d273c<_0x10bf3e[_0x8783('0x3c')];_0x3d273c+=0x1){_0x36a696=_0x10bf3e[_0x3d273c];if(_['isUndefined'](_0x10cfd3[_0x8783('0x1a')][_0x36a696['id']])){_0x10cfd3[_0x8783('0x1a')][_0x36a696['id']]=new ZohoAccount(_0x36a696);}else{_0x10cfd3[_0x8783('0x3a')](_0x10cfd3[_0x8783('0x1a')][_0x36a696['id']],_0x36a696);}}}return _0x10cfd3['zohoAccounts'];};};Realtime['prototype']['initDeskAccounts']=function(){var _0x29acce=this;return function(_0x1df837){if(_0x1df837){freeIsNotKey(_0x1df837,_0x29acce['deskAccounts'],'id');for(var _0x3d8fc9=0x0,_0x182d36={},_0x5ab82b={};_0x3d8fc9<_0x1df837[_0x8783('0x3c')];_0x3d8fc9+=0x1){_0x182d36=_0x1df837[_0x3d8fc9];if(_[_0x8783('0x3f')](_0x29acce[_0x8783('0x1b')][_0x182d36['id']])){_0x29acce[_0x8783('0x1b')][_0x182d36['id']]=new DeskAccount(_0x182d36);}else{_0x29acce[_0x8783('0x3a')](_0x29acce[_0x8783('0x1b')][_0x182d36['id']],_0x182d36);}}}return _0x29acce['deskAccounts'];};};Realtime[_0x8783('0x39')][_0x8783('0x4b')]=function(){var _0x48b5a2=this;return function(_0x345c3f){if(_0x345c3f){freeIsNotKey(_0x345c3f,_0x48b5a2[_0x8783('0x4c')],'id');for(var _0x4b330b=0x0,_0x92762e={},_0x1cfa80={};_0x4b330b<_0x345c3f[_0x8783('0x3c')];_0x4b330b+=0x1){_0x92762e=_0x345c3f[_0x4b330b];if(_[_0x8783('0x3f')](_0x48b5a2[_0x8783('0x4c')][_0x92762e['id']])){_0x48b5a2[_0x8783('0x4c')][_0x92762e['id']]=new SugarcrmAccount(_0x92762e);}else{_0x48b5a2[_0x8783('0x3a')](_0x48b5a2[_0x8783('0x4c')][_0x92762e['id']],_0x92762e);}}}return _0x48b5a2[_0x8783('0x4c')];};};Realtime[_0x8783('0x39')][_0x8783('0x4d')]=function(){var _0x114913=this;return function(_0x4eee2b){if(_0x4eee2b){freeIsNotKey(_0x4eee2b,_0x114913[_0x8783('0x1c')],'id');for(var _0x827293=0x0,_0x56ec90={},_0x522ec7={};_0x827293<_0x4eee2b[_0x8783('0x3c')];_0x827293+=0x1){_0x56ec90=_0x4eee2b[_0x827293];if(_['isUndefined'](_0x114913[_0x8783('0x1c')][_0x56ec90['id']])){_0x114913[_0x8783('0x1c')][_0x56ec90['id']]=new VtigerAccount(_0x56ec90);}else{_0x114913[_0x8783('0x3a')](_0x114913[_0x8783('0x1c')][_0x56ec90['id']],_0x56ec90);}}}return _0x114913[_0x8783('0x1c')];};};Realtime[_0x8783('0x39')]['initServicenowAccounts']=function(){var _0x37bab2=this;return function(_0x444a52){if(_0x444a52){freeIsNotKey(_0x444a52,_0x37bab2[_0x8783('0x1d')],'id');for(var _0x2731b4=0x0,_0x286ca2={},_0x425227={};_0x2731b4<_0x444a52['length'];_0x2731b4+=0x1){_0x286ca2=_0x444a52[_0x2731b4];if(_['isUndefined'](_0x37bab2['servicenowAccounts'][_0x286ca2['id']])){_0x37bab2[_0x8783('0x1d')][_0x286ca2['id']]=new ServicenowAccount(_0x286ca2);}else{_0x37bab2[_0x8783('0x3a')](_0x37bab2[_0x8783('0x1d')][_0x286ca2['id']],_0x286ca2);}}}return _0x37bab2[_0x8783('0x1d')];};};Realtime[_0x8783('0x39')][_0x8783('0x4e')]=function(){var _0x3901b5=this;return function(_0x3b5b1a){if(_0x3b5b1a){freeIsNotKey(_0x3b5b1a,_0x3901b5[_0x8783('0x4f')],'id');for(var _0x37eceb=0x0,_0x1e9b32={},_0x4d0e5a={};_0x37eceb<_0x3b5b1a[_0x8783('0x3c')];_0x37eceb+=0x1){_0x1e9b32=_0x3b5b1a[_0x37eceb];if(_[_0x8783('0x3f')](_0x3901b5[_0x8783('0x4f')][_0x1e9b32['id']])){_0x3901b5[_0x8783('0x4f')][_0x1e9b32['id']]=new Dynamics365Account(_0x1e9b32);}else{_0x3901b5['mergeFromDatabase'](_0x3901b5[_0x8783('0x4f')][_0x1e9b32['id']],_0x1e9b32);}}}return _0x3901b5[_0x8783('0x4f')];};};Realtime[_0x8783('0x39')][_0x8783('0x50')]=function(){var _0x2b2566=this;return function(_0x52a54a){if(_0x52a54a){freeIsNotKey(_0x52a54a,_0x2b2566[_0x8783('0x1e')],'id');for(var _0x53dd02=0x0,_0x4deee4={},_0x1bb1f0={};_0x53dd02<_0x52a54a[_0x8783('0x3c')];_0x53dd02+=0x1){_0x4deee4=_0x52a54a[_0x53dd02];if(_[_0x8783('0x3f')](_0x2b2566[_0x8783('0x1e')][_0x4deee4['id']])){_0x2b2566[_0x8783('0x1e')][_0x4deee4['id']]=new FreshsalesAccount(_0x4deee4);}else{_0x2b2566[_0x8783('0x3a')](_0x2b2566[_0x8783('0x1e')][_0x4deee4['id']],_0x4deee4);}}}return _0x2b2566[_0x8783('0x1e')];};};Realtime[_0x8783('0x39')][_0x8783('0x51')]=function(){var _0xead3f1=this;return function(_0x10d698){for(var _0x11df17=0x0;_0x11df17<_0x10d698['length'];_0x11df17+=0x1){_[_0x8783('0x52')](_0xead3f1['voiceQueues'][_0x10d698[_0x11df17]['name']],_0x10d698[_0x11df17]);}return _0xead3f1[_0x8783('0x44')];};};Realtime[_0x8783('0x39')][_0x8783('0x53')]=function(){var _0xffb273=this;return function(_0x53990c){clearVoiceQueues(_0xffb273[_0x8783('0x44')]);if(_0x53990c){_0x53990c=_[_0x8783('0x54')](_0x53990c,_0x8783('0x55'));for(var _0x4fe5e3 in _0x53990c){if(_0x53990c[_0x8783('0x20')](_0x4fe5e3)){var _0x14e2a4={};for(var _0x40034c=0x0;_0x40034c<_0x53990c[_0x4fe5e3][_0x8783('0x3c')];_0x40034c+=0x1){var _0x59cc90=_0x53990c[_0x4fe5e3][_0x40034c][_0x8783('0x56')];if(_0xffb273['voiceQueues'][_0x59cc90]){if(_0x53990c[_0x4fe5e3][_0x40034c]['queuecallerexit']){_0xffb273[_0x8783('0x44')][_0x59cc90][_0x8783('0x29')]+=0x1;}if(_0x53990c[_0x4fe5e3][_0x40034c]['queuecallerabandon']){_0xffb273[_0x8783('0x44')][_0x59cc90]['abandoned']+=0x1;}_0xffb273['voiceQueues'][_0x59cc90][_0x8783('0x2b')]+=moment(_0x53990c[_0x4fe5e3][_0x40034c][_0x8783('0x57')])[_0x8783('0x58')](moment(_0x53990c[_0x4fe5e3][_0x40034c][_0x8783('0x59')]),'seconds')||0x0;if(_0x40034c===_0x53990c[_0x4fe5e3][_0x8783('0x3c')]-0x1){_0xffb273[_0x8783('0x44')][_0x59cc90]['sumDuration']+=moment(_0x53990c[_0x4fe5e3][_0x40034c][_0x8783('0x5a')]||_0x53990c[_0x4fe5e3][_0x40034c][_0x8783('0x5b')]||_0x53990c[_0x4fe5e3][_0x40034c][_0x8783('0x5c')])[_0x8783('0x58')](moment(_0x53990c[_0x4fe5e3][_0x40034c]['queuecallerjoinAt']),_0x8783('0x5d'))||0x0;_0xffb273['voiceQueues'][_0x59cc90][_0x8783('0x24')]+=0x1;if(_0x53990c[_0x4fe5e3][_0x40034c]['queuecallercomplete']){_0xffb273[_0x8783('0x44')][_0x59cc90][_0x8783('0x25')]+=0x1;_0xffb273[_0x8783('0x44')][_0x59cc90][_0x8783('0x5e')]+=moment(_0x53990c[_0x4fe5e3][_0x40034c][_0x8783('0x5a')])[_0x8783('0x58')](moment(_0x53990c[_0x4fe5e3][_0x40034c][_0x8783('0x57')]),_0x8783('0x5d'))||0x0;}}else{_0xffb273[_0x8783('0x44')][_0x59cc90][_0x8783('0x2c')]+=_0xffb273['voiceQueues'][_0x59cc90][_0x8783('0x2b')]||0x0;}}}}}}return _0xffb273[_0x8783('0x44')];};};Realtime[_0x8783('0x39')]['initVoiceCallReports']=function(){var _0x402d25=this;return function(_0x3b021d){clearVoiceCallReports(_0x402d25['outbound']);if(_0x3b021d){for(var _0x5da199=0x0;_0x5da199<_0x3b021d[_0x8783('0x3c')];_0x5da199+=0x1){_0x402d25[_0x8783('0x5f')][_0x8783('0x24')]+=0x1;_0x402d25[_0x8783('0x5f')][_0x8783('0x2c')]+=_0x3b021d[_0x5da199][_0x8783('0x60')];if(_0x3b021d[_0x5da199][_0x8783('0x61')]===_0x8783('0x62')){_0x402d25['outbound'][_0x8783('0x25')]+=0x1;_0x402d25['outbound'][_0x8783('0x2b')]+=_0x3b021d[_0x5da199]['duration']-_0x3b021d[_0x5da199]['billableseconds']||0x0;_0x402d25[_0x8783('0x5f')][_0x8783('0x5e')]+=_0x3b021d[_0x5da199][_0x8783('0x63')];}}}return _0x402d25[_0x8783('0x5f')];};};Realtime['prototype'][_0x8783('0x64')]=function(){var _0x43aeff=this;return function(_0x348065){if(_0x348065){freeIsNotKey(_0x348065,_0x43aeff['campaigns'],'name');for(var _0x311084=0x0,_0x5541df={};_0x311084<_0x348065[_0x8783('0x3c')];_0x311084+=0x1){_0x5541df=_0x348065[_0x311084];if(_[_0x8783('0x3f')](_0x43aeff[_0x8783('0x65')][_0x5541df[_0x8783('0x23')]])){_0x43aeff[_0x8783('0x65')][_0x5541df[_0x8783('0x23')]]=new Campaign(_0x5541df);}else{_0x43aeff[_0x8783('0x3a')](_0x43aeff[_0x8783('0x65')][_0x5541df[_0x8783('0x23')]],_0x5541df);_0x43aeff[_0x8783('0x65')][_0x5541df[_0x8783('0x23')]]['dialQueueProject']=_0x5541df['SquareProject']?_0x5541df[_0x8783('0x66')]['name']:undefined;}}}return _0x43aeff['campaigns'];};};Realtime[_0x8783('0x39')][_0x8783('0x67')]=function(){var _0x5fd7c1=this;return function(_0x13dbef){if(_0x13dbef){freeIsNotKey(_0x13dbef,_0x5fd7c1[_0x8783('0x14')],'id');for(var _0x3bffa9=0x0,_0x1a04e6={};_0x3bffa9<_0x13dbef[_0x8783('0x3c')];_0x3bffa9+=0x1){_0x1a04e6=_0x13dbef[_0x3bffa9];if(_['isUndefined'](_0x5fd7c1[_0x8783('0x14')][_0x1a04e6['id']])){_0x5fd7c1[_0x8783('0x14')][_0x1a04e6['id']]=new VoiceExtension(_0x1a04e6);}else{_0x5fd7c1[_0x8783('0x3a')](_0x5fd7c1[_0x8783('0x14')][_0x1a04e6['id']],_0x1a04e6);}}}return _0x5fd7c1[_0x8783('0x14')];};};Realtime[_0x8783('0x39')]['initCampaignHopperHistory']=function(){var _0x5ee7c0=this;return function(_0x5b7992){clearCampaigns(_0x5ee7c0['campaigns']);for(var _0x501842=0x0;_0x501842<_0x5b7992[_0x8783('0x3c')];_0x501842+=0x1){_[_0x8783('0x52')](_0x5ee7c0[_0x8783('0x65')][_0x5b7992[_0x501842]['name']],_0x5b7992[_0x501842]);}return _0x5ee7c0[_0x8783('0x65')];};};Realtime[_0x8783('0x39')][_0x8783('0x68')]=function(){var _0x367081=this;return function(_0x1c21ee){if(_0x1c21ee){freeIsNotKey(_0x1c21ee,_0x367081[_0x8783('0x69')],'id');for(var _0x5d2ece=0x0,_0x21d559={},_0x2dc27e={};_0x5d2ece<_0x1c21ee[_0x8783('0x3c')];_0x5d2ece+=0x1){_0x21d559=_0x1c21ee[_0x5d2ece];if(_['isUndefined'](_0x367081['faxAccounts'][_0x21d559['id']])){_0x367081[_0x8783('0x69')][_0x21d559['id']]=new FaxAccount(_0x21d559);}else{_0x367081[_0x8783('0x3a')](_0x367081[_0x8783('0x69')][_0x21d559['id']],_0x21d559);}}}return _0x367081[_0x8783('0x69')];};};module[_0x8783('0x6a')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index b367182..c5ec14f 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 _0x8135=['SIP/%s','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','destination','exten','type','lastapplication','lastdata','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','originatecalleridnum','channel','destinationchannel','calleridpreview','calleridnum','calleridname','transfers','linkedid','transfereelinkedid','monitorFilename','filename','monitors','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','create','startsWith','Local','substring','indexOf','mobile','phone','transfererlinkedid','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','interface','format'];(function(_0x473d1e,_0x4df799){var _0x503be9=function(_0x4bcfff){while(--_0x4bcfff){_0x473d1e['push'](_0x473d1e['shift']());}};_0x503be9(++_0x4df799);}(_0x8135,0x171));var _0x5813=function(_0x254b7a,_0x3100cc){_0x254b7a=_0x254b7a-0x0;var _0x2dbc69=_0x8135[_0x254b7a];return _0x2dbc69;};'use strict';var _=require(_0x5813('0x0'));var moment=require(_0x5813('0x1'));var util=require('util');var config=require(_0x5813('0x2'));var ami=require(_0x5813('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x5813('0x4'));var RpcMemberReport=require(_0x5813('0x5'));var RpcVoiceQueueReport=require(_0x5813('0x6'));var RpcVoiceRecording=require(_0x5813('0x7'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x5813('0x8'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0x5813('0x9'));function Report(_0x32f39e){this[_0x5813('0xa')]=_0x32f39e;this[_0x5813('0xb')]=_0x32f39e[_0x5813('0xb')];this['telephones']=_0x32f39e[_0x5813('0xc')];}Report[_0x5813('0xd')][_0x5813('0xe')]=function(_0x50bb05){var _0x15c235=new VoiceQueueReport(this[_0x5813('0xa')]);var _0x531ada=new VoiceAgentReport(this[_0x5813('0xa')]);var _0x2b2f38=new VoiceDialReport(this[_0x5813('0xa')]);var _0x5595ae=new VoiceCallReport(this[_0x5813('0xa')]);var _0x3d4a39=new UserReport(this['realtime']);if(config[_0x5813('0xf')]&&config['xdr'][_0x5813('0x10')]){ami['on'](_0x5813('0x11'),this[_0x5813('0x12')]['bind'](this));ami['on'](_0x5813('0x13'),this[_0x5813('0x14')][_0x5813('0x15')](this));ami['on'](_0x5813('0x16'),this[_0x5813('0x17')][_0x5813('0x15')](this));ami['on']('custom:voiceDialReport',this[_0x5813('0x18')][_0x5813('0x15')](this));ami['on'](_0x5813('0x19'),this[_0x5813('0x1a')]['bind'](this));ami['on'](_0x5813('0x1b'),this[_0x5813('0x1c')][_0x5813('0x15')](this));}};Report[_0x5813('0xd')][_0x5813('0x1d')]=function(_0x2020aa){var _0x18d910;_0x18d910=_['find'](this[_0x5813('0xb')],function(_0x2dd15e){return _0x2dd15e[_0x5813('0x1e')]==_0x2020aa||_0x2dd15e[_0x5813('0x1f')]==_0x2020aa;});if(_[_0x5813('0x20')](_0x18d910)){var _0xb6a8be=_[_0x5813('0x21')](this[_0x5813('0xc')],function(_0x44c09b){return _0x44c09b[_0x5813('0x1e')]==_0x2020aa||_0x44c09b[_0x5813('0x1f')]==_0x2020aa;});if(_0xb6a8be){_0x18d910=_['find'](this[_0x5813('0xb')],function(_0x4ed439){return _0x4ed439[_0x5813('0x22')]==util[_0x5813('0x23')](_0x5813('0x24'),_0xb6a8be[_0x5813('0x1f')]);});}}return _0x18d910;};Report[_0x5813('0xd')][_0x5813('0x12')]=function(_0x50ff8a){for(var _0x3a9006=0x0;_0x3a9006<_0x50ff8a['length'];_0x3a9006+=0x1){var _0x44af32=this[_0x5813('0x1d')](_0x50ff8a[_0x3a9006][_0x5813('0x25')]);if(_0x44af32){_0x50ff8a[_0x3a9006][_0x5813('0x1e')]=_0x44af32[_0x5813('0x1e')];_0x50ff8a[_0x3a9006][_0x5813('0x26')]=!![];_0x50ff8a[_0x3a9006][_0x5813('0x27')]=_0x44af32[_0x5813('0x1f')];_0x50ff8a[_0x3a9006][_0x5813('0x22')]=_[_0x5813('0x20')](_0x44af32['interface'])?util[_0x5813('0x23')](_0x5813('0x24'),_0x44af32[_0x5813('0x1f')]):_0x44af32[_0x5813('0x22')];if(_0x50ff8a[_0x3a9006][_0x5813('0x28')]){_0x50ff8a[_0x3a9006]['queuecallercompleteAt']=moment()[_0x5813('0x23')](_0x5813('0x29'));}if(_0x50ff8a[_0x3a9006][_0x5813('0x2a')]){_0x50ff8a[_0x3a9006]['queuecallerexitAt']=moment()[_0x5813('0x23')](_0x5813('0x29'));}RpcMemberReport[_0x5813('0x12')](_0x50ff8a[_0x3a9006]);}RpcVoiceQueueReport['create'](_0x50ff8a[_0x3a9006]);}};function extractCalleridNumber(_0x18016c){var _0x5273e0=_0x18016c['match'](/<(.*?)>/);return _0x5273e0?_0x5273e0[0x1]:_0x18016c;}Report['prototype']['voiceCallReport']=function(_0x305899){_0x305899[_0x5813('0x2b')]=_0x305899[_0x5813('0x2b')]||_0x305899[_0x5813('0x2c')];if(_0x305899[_0x5813('0x2d')]=='dialer'){_0x305899[_0x5813('0x2e')]='queue';_0x305899[_0x5813('0x2f')]=_0x305899[_0x5813('0x30')];if(_0x305899[_0x5813('0x31')]==_0x5813('0x32')){_0x305899[_0x5813('0x1e')]='';_0x305899[_0x5813('0x2b')]=extractCalleridNumber(_0x305899[_0x5813('0x33')]);}else if(_0x305899[_0x5813('0x31')]==_0x5813('0x34')){if(_0x305899[_0x5813('0x2b')]==_0x5813('0x35')){_0x305899[_0x5813('0x2b')]=extractCalleridNumber(_0x305899['calleridpreview']);_0x305899['calleridnum']=_0x305899[_0x5813('0x36')];_0x305899['destinationchannel']=[_0x305899['channel'],_0x305899[_0x5813('0x37')]=_0x305899[_0x5813('0x38')]][0x0];_0x305899[_0x5813('0x33')]=_0x305899[_0x5813('0x39')];}else{_0x305899[_0x5813('0x2b')]=_0x305899['calleridnum'];_0x305899[_0x5813('0x3a')]=_0x305899[_0x5813('0x36')];if(_0x305899['disposition']=='ANSWERED'){_0x305899[_0x5813('0x1e')]=_0x305899['connectedlinenum'];}else{_0x305899[_0x5813('0x1e')]='';}}}}else{_0x305899[_0x5813('0x33')]=util[_0x5813('0x23')]('\x22%s\x22\x20<%s>',_0x305899[_0x5813('0x3b')],_0x305899['calleridnum']);}if(RpcVoiceTransferReport[_0x5813('0x3c')][_0x305899[_0x5813('0x3d')]]){var _0x2ee26b=RpcVoiceTransferReport[_0x5813('0x3c')][_0x305899[_0x5813('0x3d')]];_0x2ee26b[_0x5813('0x3e')]=_0x305899['uniqueid'];RpcVoiceTransferReport[_0x5813('0x1a')](_0x2ee26b);delete RpcVoiceTransferReport[_0x5813('0x3c')][_0x305899[_0x5813('0x3d')]];}RpcVoiceCallReport['create'](_0x305899);if(_0x305899['monitor']){for(var _0x1c7195=0x0;_0x1c7195<_0x305899['monitors']['length'];_0x1c7195+=0x1){_0x305899[_0x5813('0x3f')]=_0x305899['monitors'][_0x1c7195][_0x5813('0x40')];_0x305899['createdAt']=_0x305899[_0x5813('0x41')][_0x1c7195][_0x5813('0x42')];if(_0x305899['exten']==_0x5813('0x35')){_0x305899['calleridnum']=_0x305899[_0x5813('0x25')];_0x305899[_0x5813('0x3b')]=_0x305899['connectedlinename'];_0x305899[_0x5813('0x25')]=_0x305899[_0x5813('0x1e')];_0x305899[_0x5813('0x43')]=_0x305899[_0x5813('0x44')];_0x305899[_0x5813('0x2c')]=_0x305899['originatecalleridnum'];}else if(_0x305899[_0x5813('0x2c')]==_0x5813('0x45')){_0x305899[_0x5813('0x3a')]=_0x305899[_0x5813('0x2b')];_0x305899[_0x5813('0x2c')]=_0x305899[_0x5813('0x36')];}RpcVoiceRecording['create'](_0x305899);}}};Report[_0x5813('0xd')]['voiceAgentReport']=function(_0xd1fd73){if(_[_0x5813('0x46')](_0xd1fd73)){_0xd1fd73[_0x5813('0x47')](function(_0x5b1a1e){RpcVoiceAgentReport[_0x5813('0x48')](_0x5b1a1e);});}else{RpcVoiceAgentReport[_0x5813('0x48')](_0xd1fd73);}};Report[_0x5813('0xd')][_0x5813('0x18')]=function(_0x14beb2){RpcVoiceDialReport[_0x5813('0x48')](_0x14beb2);var _0x5d3cf6;var _0x25a782;var _0x29dad1=_0x14beb2[_0x5813('0x37')];if(_[_0x5813('0x49')](_0x29dad1,_0x5813('0x4a'))){_0x25a782=_0x29dad1[_0x5813('0x4b')](_0x29dad1[_0x5813('0x4c')]('/')+0x1,_0x29dad1[_0x5813('0x4c')]('@'));_0x5d3cf6=_['find'](this[_0x5813('0xb')],function(_0x465b28){return _0x465b28[_0x5813('0x4d')]==_0x25a782||_0x465b28[_0x5813('0x4e')]==_0x25a782||_0x465b28[_0x5813('0x1e')]==_0x25a782;});}else{_0x25a782=_0x29dad1['substring'](_0x29dad1[_0x5813('0x4c')]('/')+0x1,_0x29dad1['lastIndexOf']('-'));_0x5d3cf6=this[_0x5813('0x1d')](_0x25a782);}if(_0x5d3cf6){_0x14beb2['interface']=_[_0x5813('0x20')](_0x5d3cf6[_0x5813('0x22')])?util[_0x5813('0x23')](_0x5813('0x24'),_0x5d3cf6[_0x5813('0x1f')]):_0x5d3cf6['interface'];_0x14beb2[_0x5813('0x44')]=_0x5d3cf6[_0x5813('0x1f')];_0x14beb2[_0x5813('0x1e')]=_0x5d3cf6[_0x5813('0x1e')];RpcMemberReport[_0x5813('0x18')](_0x14beb2);}};Report[_0x5813('0xd')][_0x5813('0x1a')]=function(_0x5ba27f){RpcVoiceTransferReport[_0x5813('0x3c')][_0x5ba27f[_0x5813('0x4f')]]=_0x5ba27f;};Report['prototype'][_0x5813('0x1c')]=function(_0x221628){RpcVoiceTransferReport[_0x5813('0x1c')](_0x221628);};module[_0x5813('0x50')]=Report; \ No newline at end of file +var _0x2070=['calleridnum','originatecalleridnum','channel','disposition','ANSWERED','connectedlinenum','callerid','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','monitor','monitorFilename','filename','createdAt','monitors','connectedlinename','membername','xcally-motion-dialer','create','voiceAgentReport','isArray','forEach','startsWith','Local','indexOf','mobile','phone','exports','lodash','util','../../../config/environment','../rpc/voiceDialReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','isNil','name','interface','format','voiceQueueReport','length','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','match','destination','exten','dialer','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview'];(function(_0x5dba88,_0xd64ba1){var _0x1e6cef=function(_0x55e7c9){while(--_0x55e7c9){_0x5dba88['push'](_0x5dba88['shift']());}};_0x1e6cef(++_0xd64ba1);}(_0x2070,0x117));var _0x0207=function(_0xc3cb71,_0x3d3f0f){_0xc3cb71=_0xc3cb71-0x0;var _0x2fcff8=_0x2070[_0xc3cb71];return _0x2fcff8;};'use strict';var _=require(_0x0207('0x0'));var moment=require('moment');var util=require(_0x0207('0x1'));var config=require(_0x0207('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x0207('0x3'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x0207('0x4'));var RpcVoiceTransferReport=require(_0x0207('0x5'));var VoiceQueueReport=require(_0x0207('0x6'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0x0207('0x7'));var VoiceDialReport=require(_0x0207('0x8'));var UserReport=require(_0x0207('0x9'));function Report(_0x524f3f){this[_0x0207('0xa')]=_0x524f3f;this[_0x0207('0xb')]=_0x524f3f[_0x0207('0xb')];this[_0x0207('0xc')]=_0x524f3f[_0x0207('0xc')];}Report[_0x0207('0xd')][_0x0207('0xe')]=function(_0x32e4f8){var _0x8ee676=new VoiceQueueReport(this[_0x0207('0xa')]);var _0x58052f=new VoiceAgentReport(this[_0x0207('0xa')]);var _0xb2bbda=new VoiceDialReport(this[_0x0207('0xa')]);var _0xb1f687=new VoiceCallReport(this['realtime']);var _0xdbec8=new UserReport(this[_0x0207('0xa')]);if(config['xdr']&&config[_0x0207('0xf')][_0x0207('0x10')]){ami['on'](_0x0207('0x11'),this['voiceQueueReport'][_0x0207('0x12')](this));ami['on'](_0x0207('0x13'),this[_0x0207('0x14')][_0x0207('0x12')](this));ami['on']('custom:voiceAgentReport',this['voiceAgentReport'][_0x0207('0x12')](this));ami['on']('custom:voiceDialReport',this[_0x0207('0x15')]['bind'](this));ami['on'](_0x0207('0x16'),this[_0x0207('0x17')][_0x0207('0x12')](this));ami['on'](_0x0207('0x18'),this[_0x0207('0x19')]['bind'](this));}};Report[_0x0207('0xd')][_0x0207('0x1a')]=function(_0x515a85){var _0x2d067d;_0x2d067d=_[_0x0207('0x1b')](this[_0x0207('0xb')],function(_0x263383){return _0x263383[_0x0207('0x1c')]==_0x515a85||_0x263383['name']==_0x515a85;});if(_[_0x0207('0x1d')](_0x2d067d)){var _0x53bdb4=_[_0x0207('0x1b')](this['telephones'],function(_0x5d7fb8){return _0x5d7fb8['accountcode']==_0x515a85||_0x5d7fb8[_0x0207('0x1e')]==_0x515a85;});if(_0x53bdb4){_0x2d067d=_[_0x0207('0x1b')](this[_0x0207('0xb')],function(_0x33155e){return _0x33155e[_0x0207('0x1f')]==util[_0x0207('0x20')]('SIP/%s',_0x53bdb4['name']);});}}return _0x2d067d;};Report[_0x0207('0xd')][_0x0207('0x21')]=function(_0x330802){for(var _0x702842=0x0;_0x702842<_0x330802[_0x0207('0x22')];_0x702842+=0x1){var _0x3585e3=this[_0x0207('0x1a')](_0x330802[_0x702842]['connectedlinenum']);if(_0x3585e3){_0x330802[_0x702842]['accountcode']=_0x3585e3['accountcode'];_0x330802[_0x702842][_0x0207('0x23')]=!![];_0x330802[_0x702842][_0x0207('0x24')]=_0x3585e3[_0x0207('0x1e')];_0x330802[_0x702842]['interface']=_[_0x0207('0x1d')](_0x3585e3[_0x0207('0x1f')])?util[_0x0207('0x20')](_0x0207('0x25'),_0x3585e3[_0x0207('0x1e')]):_0x3585e3['interface'];if(_0x330802[_0x702842][_0x0207('0x26')]){_0x330802[_0x702842][_0x0207('0x27')]=moment()[_0x0207('0x20')](_0x0207('0x28'));}if(_0x330802[_0x702842]['queuecallerexit']){_0x330802[_0x702842][_0x0207('0x29')]=moment()[_0x0207('0x20')](_0x0207('0x28'));}RpcMemberReport[_0x0207('0x21')](_0x330802[_0x702842]);}RpcVoiceQueueReport['create'](_0x330802[_0x702842]);}};function extractCalleridNumber(_0x310d1b){var _0x4e4765=_0x310d1b[_0x0207('0x2a')](/<(.*?)>/);return _0x4e4765?_0x4e4765[0x1]:_0x310d1b;}Report[_0x0207('0xd')][_0x0207('0x14')]=function(_0x5eb6c1){_0x5eb6c1[_0x0207('0x2b')]=_0x5eb6c1[_0x0207('0x2b')]||_0x5eb6c1[_0x0207('0x2c')];if(_0x5eb6c1['type']==_0x0207('0x2d')){_0x5eb6c1['lastapplication']=_0x0207('0x2e');_0x5eb6c1[_0x0207('0x2f')]=_0x5eb6c1[_0x0207('0x2e')];if(_0x5eb6c1[_0x0207('0x30')]==_0x0207('0x31')){_0x5eb6c1[_0x0207('0x1c')]='';_0x5eb6c1['destination']=extractCalleridNumber(_0x5eb6c1['callerid']);}else if(_0x5eb6c1[_0x0207('0x30')]==_0x0207('0x32')){if(_0x5eb6c1[_0x0207('0x2b')]==_0x0207('0x33')){_0x5eb6c1[_0x0207('0x2b')]=extractCalleridNumber(_0x5eb6c1[_0x0207('0x34')]);_0x5eb6c1[_0x0207('0x35')]=_0x5eb6c1[_0x0207('0x36')];_0x5eb6c1['destinationchannel']=[_0x5eb6c1[_0x0207('0x37')],_0x5eb6c1[_0x0207('0x37')]=_0x5eb6c1['destinationchannel']][0x0];_0x5eb6c1['callerid']=_0x5eb6c1['calleridpreview'];}else{_0x5eb6c1[_0x0207('0x2b')]=_0x5eb6c1['calleridnum'];_0x5eb6c1[_0x0207('0x35')]=_0x5eb6c1[_0x0207('0x36')];if(_0x5eb6c1[_0x0207('0x38')]==_0x0207('0x39')){_0x5eb6c1[_0x0207('0x1c')]=_0x5eb6c1[_0x0207('0x3a')];}else{_0x5eb6c1[_0x0207('0x1c')]='';}}}}else{_0x5eb6c1[_0x0207('0x3b')]=util[_0x0207('0x20')](_0x0207('0x3c'),_0x5eb6c1[_0x0207('0x3d')],_0x5eb6c1[_0x0207('0x35')]);}if(RpcVoiceTransferReport[_0x0207('0x3e')][_0x5eb6c1[_0x0207('0x3f')]]){var _0xce2015=RpcVoiceTransferReport['transfers'][_0x5eb6c1[_0x0207('0x3f')]];_0xce2015['transfereelinkedid']=_0x5eb6c1[_0x0207('0x40')];RpcVoiceTransferReport[_0x0207('0x17')](_0xce2015);delete RpcVoiceTransferReport['transfers'][_0x5eb6c1[_0x0207('0x3f')]];}RpcVoiceCallReport['create'](_0x5eb6c1);if(_0x5eb6c1[_0x0207('0x41')]){for(var _0x16cf3e=0x0;_0x16cf3e<_0x5eb6c1['monitors']['length'];_0x16cf3e+=0x1){_0x5eb6c1[_0x0207('0x42')]=_0x5eb6c1['monitors'][_0x16cf3e][_0x0207('0x43')];_0x5eb6c1[_0x0207('0x44')]=_0x5eb6c1[_0x0207('0x45')][_0x16cf3e][_0x0207('0x44')];if(_0x5eb6c1['exten']=='xcally-motion-preview'){_0x5eb6c1['calleridnum']=_0x5eb6c1['connectedlinenum'];_0x5eb6c1['calleridname']=_0x5eb6c1[_0x0207('0x46')];_0x5eb6c1['connectedlinenum']=_0x5eb6c1[_0x0207('0x1c')];_0x5eb6c1[_0x0207('0x46')]=_0x5eb6c1[_0x0207('0x47')];_0x5eb6c1[_0x0207('0x2c')]=_0x5eb6c1[_0x0207('0x36')];}else if(_0x5eb6c1[_0x0207('0x2c')]==_0x0207('0x48')){_0x5eb6c1[_0x0207('0x35')]=_0x5eb6c1['destination'];_0x5eb6c1[_0x0207('0x2c')]=_0x5eb6c1['originatecalleridnum'];}RpcVoiceRecording[_0x0207('0x49')](_0x5eb6c1);}}};Report['prototype'][_0x0207('0x4a')]=function(_0x2e2766){if(_[_0x0207('0x4b')](_0x2e2766)){_0x2e2766[_0x0207('0x4c')](function(_0x1696fe){RpcVoiceAgentReport['create'](_0x1696fe);});}else{RpcVoiceAgentReport[_0x0207('0x49')](_0x2e2766);}};Report[_0x0207('0xd')][_0x0207('0x15')]=function(_0x4c7209){RpcVoiceDialReport[_0x0207('0x49')](_0x4c7209);var _0x15f58a;var _0x2cc556;var _0x5949fc=_0x4c7209[_0x0207('0x37')];if(_[_0x0207('0x4d')](_0x5949fc,_0x0207('0x4e'))){_0x2cc556=_0x5949fc['substring'](_0x5949fc[_0x0207('0x4f')]('/')+0x1,_0x5949fc['indexOf']('@'));_0x15f58a=_['find'](this[_0x0207('0xb')],function(_0x4bf637){return _0x4bf637[_0x0207('0x50')]==_0x2cc556||_0x4bf637[_0x0207('0x51')]==_0x2cc556||_0x4bf637[_0x0207('0x1c')]==_0x2cc556;});}else{_0x2cc556=_0x5949fc['substring'](_0x5949fc['indexOf']('/')+0x1,_0x5949fc['lastIndexOf']('-'));_0x15f58a=this[_0x0207('0x1a')](_0x2cc556);}if(_0x15f58a){_0x4c7209[_0x0207('0x1f')]=_[_0x0207('0x1d')](_0x15f58a['interface'])?util[_0x0207('0x20')](_0x0207('0x25'),_0x15f58a[_0x0207('0x1e')]):_0x15f58a[_0x0207('0x1f')];_0x4c7209['membername']=_0x15f58a[_0x0207('0x1e')];_0x4c7209['accountcode']=_0x15f58a['accountcode'];RpcMemberReport['voiceDialReport'](_0x4c7209);}};Report['prototype']['blindTransfer']=function(_0x4ca49e){RpcVoiceTransferReport[_0x0207('0x3e')][_0x4ca49e['transfererlinkedid']]=_0x4ca49e;};Report[_0x0207('0xd')]['attendedTransfer']=function(_0x55c0f1){RpcVoiceTransferReport[_0x0207('0x19')](_0x55c0f1);};module[_0x0207('0x52')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 37903bd..cf2b6cf 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 _0x22fb=['resolve','then','actionSipShowRegistry','catch','error','inspect','[userReport][devicestatelist]','[userReport][sippeerstatus]','prototype','isNotNull','emit','[userReport][registry]\x20registry:%s\x20state:%s','username','debug','[userReport][registry]','find','stateRegistry','state','merge','omit','event','actionid','format','trunk:%s','name','trunk:save','syncDeviceState','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','mobile','phone','address','[userReport][peerstatus]','peer','registered','status','exports','util','bluebird','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','peerstatus'];(function(_0x5136d6,_0x5c7e94){var _0xc588f3=function(_0x2a7d70){while(--_0x2a7d70){_0x5136d6['push'](_0x5136d6['shift']());}};_0xc588f3(++_0x5c7e94);}(_0x22fb,0x192));var _0xb22f=function(_0x3453eb,_0x440edb){_0x3453eb=_0x3453eb-0x0;var _0x26808d=_0x22fb[_0x3453eb];return _0x26808d;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xb22f('0x0'));var Redis=require('ioredis');var BPromise=require(_0xb22f('0x1'));var config=require(_0xb22f('0x2'));var logger=require(_0xb22f('0x3'))(_0xb22f('0x4'));var ami=require(_0xb22f('0x5'));config['redis']=_[_0xb22f('0x6')](config[_0xb22f('0x7')],{'host':_0xb22f('0x8'),'port':0x18eb});var io=require(_0xb22f('0x9'))(new Redis(config[_0xb22f('0x7')]));function UserReport(_0x367d4b){this['trunks']=_0x367d4b[_0xb22f('0xa')];this[_0xb22f('0xb')]=_0x367d4b[_0xb22f('0xb')];this[_0xb22f('0xc')]=_0x367d4b[_0xb22f('0xc')];ami['on'](_0xb22f('0xd'),this[_0xb22f('0xe')][_0xb22f('0xf')](this));ami['on'](_0xb22f('0x10'),this[_0xb22f('0xe')][_0xb22f('0xf')](this));ami['on']('devicestatechange',this['syncDeviceState']['bind'](this));ami['on'](_0xb22f('0x11'),this['syncPeerStatus']['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0xb22f('0x12')]()[_0xb22f('0x13')](ami[_0xb22f('0x14')]())[_0xb22f('0x15')](function(_0x390c53){logger[_0xb22f('0x16')]('[userReport][sipshowregistry]',util[_0xb22f('0x17')](_0x390c53,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xb22f('0x13')](ami['actionDeviceStateList']())[_0xb22f('0x15')](function(_0x514a8f){logger[_0xb22f('0x16')](_0xb22f('0x18'),util[_0xb22f('0x17')](_0x514a8f,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0xb22f('0x13')](ami['actionSipPeerStatus']())[_0xb22f('0x15')](function(_0x35caec){logger[_0xb22f('0x16')](_0xb22f('0x19'),util[_0xb22f('0x17')](_0x35caec,{'showHidden':![],'depth':null}));});}UserReport[_0xb22f('0x1a')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xb22f('0x12')]()['then'](showSipRegistrations())[_0xb22f('0x13')](listDeviceStates())[_0xb22f('0x13')](showPeersStatus());},0x32c8);};UserReport[_0xb22f('0x1a')][_0xb22f('0x1b')]=function(_0x493a63){return _0x493a63!==null&&!_['isUndefined'](_0x493a63);};UserReport['prototype'][_0xb22f('0x1c')]=function(_0x19e480,_0xf34e0d,_0x16e465){io['to'](_0x19e480)[_0xb22f('0x1c')](_0xf34e0d,_0x16e465);};UserReport[_0xb22f('0x1a')][_0xb22f('0xe')]=function(_0x286465){try{if(this['isNotNull'](_0x286465)){logger['info'](_0xb22f('0x1d'),_0x286465[_0xb22f('0x1e')],_0x286465['state']);logger[_0xb22f('0x1f')](_0xb22f('0x20'),util['inspect'](_0x286465,{'showHidden':![],'depth':null}));var _0x4687f2=_[_0xb22f('0x21')](this['trunks'],{'defaultuser':_0x286465[_0xb22f('0x1e')]});if(_0x4687f2){_0x286465[_0xb22f('0x22')]=_0x286465[_0xb22f('0x23')];_[_0xb22f('0x24')](_0x4687f2,_[_0xb22f('0x25')](_0x286465,[_0xb22f('0x26'),_0xb22f('0x27'),_0xb22f('0x1e'),'state']));logger['debug']('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xb22f('0x17')](_0x4687f2,{'showHidden':![],'depth':null}));this['emit'](util[_0xb22f('0x28')](_0xb22f('0x29'),_0x4687f2[_0xb22f('0x2a')]),_0xb22f('0x2b'),_0x4687f2);}}}catch(_0x3bf636){logger['error']('[userReport][registry]',util[_0xb22f('0x17')](_0x3bf636,{'showHidden':![],'depth':null}));}};UserReport[_0xb22f('0x1a')][_0xb22f('0x2c')]=function(_0xe9bb83){try{if(this['isNotNull'](_0xe9bb83)){logger[_0xb22f('0x2d')](_0xb22f('0x2e'),_0xe9bb83['device'],_0xe9bb83[_0xb22f('0x23')]);logger[_0xb22f('0x1f')](_0xb22f('0x2f'),util[_0xb22f('0x17')](_0xe9bb83,{'showHidden':![],'depth':null}));if(this[_0xb22f('0xb')][_0xe9bb83['device']]){if(!this['agents'][_0xe9bb83[_0xb22f('0x30')]][_0xb22f('0x31')]||_0xe9bb83[_0xb22f('0x23')][_0xb22f('0x32')]()==_0xb22f('0x33')){this[_0xb22f('0xb')][_0xe9bb83[_0xb22f('0x30')]][_0xb22f('0x31')]=![];if(this[_0xb22f('0xb')][_0xe9bb83['device']][_0xb22f('0x23')]!==_0xe9bb83['state']['toLowerCase']()){this[_0xb22f('0xb')][_0xe9bb83[_0xb22f('0x30')]][_0xb22f('0x34')]=_[_0xb22f('0x35')](moment()[_0xb22f('0x28')]('x'));}this[_0xb22f('0xb')][_0xe9bb83[_0xb22f('0x30')]][_0xb22f('0x23')]=_0xe9bb83[_0xb22f('0x23')][_0xb22f('0x32')]();this[_0xb22f('0xb')][_0xe9bb83[_0xb22f('0x30')]][_0xb22f('0x36')](_0xe9bb83);}}else if(this['telephones'][_0xe9bb83['device']]){if(this[_0xb22f('0xc')][_0xe9bb83[_0xb22f('0x30')]][_0xb22f('0x23')]!==_0xe9bb83['state'][_0xb22f('0x32')]()){this[_0xb22f('0xc')][_0xe9bb83['device']]['stateTime']=_[_0xb22f('0x35')](moment()['format']('x'));}this[_0xb22f('0xc')][_0xe9bb83['device']][_0xb22f('0x23')]=_0xe9bb83[_0xb22f('0x23')][_0xb22f('0x32')]();logger['debug'](_0xb22f('0x37'),util[_0xb22f('0x17')](this[_0xb22f('0xc')][_0xe9bb83['device']],{'showHidden':![],'depth':null}));this[_0xb22f('0x1c')](util[_0xb22f('0x28')](_0xb22f('0x38'),this[_0xb22f('0xc')][_0xe9bb83[_0xb22f('0x30')]][_0xb22f('0x2a')]),_0xb22f('0x39'),this[_0xb22f('0xc')][_0xe9bb83[_0xb22f('0x30')]]);}else if(this[_0xb22f('0xa')][_0xe9bb83['device']]){if(this[_0xb22f('0xa')][_0xe9bb83[_0xb22f('0x30')]]['state']!==_0xe9bb83[_0xb22f('0x23')]['toLowerCase']()){this['trunks'][_0xe9bb83[_0xb22f('0x30')]][_0xb22f('0x34')]=_[_0xb22f('0x35')](moment()[_0xb22f('0x28')]('x'));}this['trunks'][_0xe9bb83[_0xb22f('0x30')]]['state']=_0xe9bb83[_0xb22f('0x23')][_0xb22f('0x32')]();logger[_0xb22f('0x1f')](_0xb22f('0x3a'),util[_0xb22f('0x17')](this[_0xb22f('0xa')][_0xe9bb83['device']],{'showHidden':![],'depth':null}));this[_0xb22f('0x1c')](util['format'](_0xb22f('0x29'),this[_0xb22f('0xa')][_0xe9bb83['device']][_0xb22f('0x2a')]),_0xb22f('0x2b'),this['trunks'][_0xe9bb83['device']]);}else if(_[_0xb22f('0x3b')](_0xe9bb83['device'],_0xb22f('0x3c'))){var _0x4e8735=_0xe9bb83[_0xb22f('0x30')];var _0x1bb648=_0x4e8735['substring'](_0x4e8735[_0xb22f('0x3d')]('/')+0x1,_0x4e8735[_0xb22f('0x3d')]('@'));var _0x4afd2a=_[_0xb22f('0x21')](this[_0xb22f('0xb')],function(_0x411723){return _0x411723[_0xb22f('0x3e')]==_0x1bb648||_0x411723[_0xb22f('0x3f')]==_0x1bb648||_0x411723['accountcode']==_0x1bb648;});if(_0x4afd2a){if(_0x4afd2a[_0xb22f('0x23')]!==_0xe9bb83['state']['toLowerCase']()){_0x4afd2a[_0xb22f('0x34')]=_[_0xb22f('0x35')](moment()[_0xb22f('0x28')]('x'));}_0x4afd2a[_0xb22f('0x23')]=_0xe9bb83[_0xb22f('0x23')]['toLowerCase']();_0x4afd2a[_0xb22f('0x31')]=!![];_0x4afd2a['updateStatusRealtime'](_0xe9bb83);}}}}catch(_0x2d9683){logger['error'](_0xb22f('0x2f'),util[_0xb22f('0x17')](_0x2d9683,{'showHidden':![],'depth':null}));}};UserReport[_0xb22f('0x1a')]['syncPeerStatus']=function(_0x299156){try{if(this[_0xb22f('0x1b')](_0x299156)&&this['isNotNull'](_0x299156[_0xb22f('0x11')])){logger[_0xb22f('0x2d')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x299156['peer'],_0x299156[_0xb22f('0x40')],_0x299156[_0xb22f('0x11')]);logger['debug'](_0xb22f('0x41'),util[_0xb22f('0x17')](_0x299156,{'showHidden':![],'depth':null}));if(this['agents'][_0x299156['peer']]){if(!this[_0xb22f('0xb')][_0x299156[_0xb22f('0x42')]]['local']||_0x299156[_0xb22f('0x11')][_0xb22f('0x32')]()==_0xb22f('0x43')){this[_0xb22f('0xb')][_0x299156['peer']][_0xb22f('0x31')]=![];this[_0xb22f('0xb')][_0x299156['peer']]['status']=_0x299156[_0xb22f('0x11')][_0xb22f('0x32')]();this[_0xb22f('0xb')][_0x299156[_0xb22f('0x42')]]['address']=_0x299156[_0xb22f('0x40')];this[_0xb22f('0xb')][_0x299156['peer']][_0xb22f('0x36')](_0x299156);}}else if(this[_0xb22f('0xc')][_0x299156[_0xb22f('0x42')]]){this[_0xb22f('0xc')][_0x299156[_0xb22f('0x42')]][_0xb22f('0x44')]=_0x299156[_0xb22f('0x11')]['toLowerCase']();this[_0xb22f('0xc')][_0x299156[_0xb22f('0x42')]][_0xb22f('0x40')]=_0x299156[_0xb22f('0x40')];logger[_0xb22f('0x1f')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0xb22f('0xc')][_0x299156[_0xb22f('0x42')]],{'showHidden':![],'depth':null}));this[_0xb22f('0x1c')](util['format'](_0xb22f('0x38'),this[_0xb22f('0xc')][_0x299156[_0xb22f('0x42')]][_0xb22f('0x2a')]),_0xb22f('0x39'),this[_0xb22f('0xc')][_0x299156[_0xb22f('0x42')]]);}else if(this[_0xb22f('0xa')][_0x299156['peer']]){this['trunks'][_0x299156[_0xb22f('0x42')]][_0xb22f('0x44')]=_0x299156['peerstatus']['toLowerCase']();this[_0xb22f('0xa')][_0x299156[_0xb22f('0x42')]]['address']=_0x299156['address'];logger[_0xb22f('0x1f')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xb22f('0x17')](this[_0xb22f('0xa')][_0x299156[_0xb22f('0x42')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xb22f('0x29'),this['trunks'][_0x299156[_0xb22f('0x42')]][_0xb22f('0x2a')]),_0xb22f('0x2b'),this['trunks'][_0x299156['peer']]);}}}catch(_0x2988a2){logger['error'](_0xb22f('0x41'),util[_0xb22f('0x17')](_0x2988a2,{'showHidden':![],'depth':null}));}};module[_0xb22f('0x45')]=UserReport; \ No newline at end of file +var _0xf0fe=['format','trunk:%s','name','trunk:save','device','local','toLowerCase','inuse','toNumber','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','phone','accountcode','updateStatusRealtime','[userReport][devicestatechange]','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','[userReport][peerstatus]','registered','status','address','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','util','ioredis','bluebird','../../../config/environment','ami','../ami','redis','defaults','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','resolve','actionDeviceStateList','error','[userReport][devicestatelist]','then','actionSipPeerStatus','[userReport][sippeerstatus]','syncRealtimeShow','prototype','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','[userReport][registry]\x20sending\x20trunk:save\x20event:'];(function(_0x5d4f12,_0x11e67c){var _0x4eb577=function(_0x4d7a2d){while(--_0x4d7a2d){_0x5d4f12['push'](_0x5d4f12['shift']());}};_0x4eb577(++_0x11e67c);}(_0xf0fe,0x70));var _0xef0f=function(_0x3f1f79,_0x331b2b){_0x3f1f79=_0x3f1f79-0x0;var _0x4cc979=_0xf0fe[_0x3f1f79];return _0x4cc979;};'use strict';var _=require('lodash');var moment=require(_0xef0f('0x0'));var util=require(_0xef0f('0x1'));var Redis=require(_0xef0f('0x2'));var BPromise=require(_0xef0f('0x3'));var config=require(_0xef0f('0x4'));var logger=require('../../../config/logger')(_0xef0f('0x5'));var ami=require(_0xef0f('0x6'));config[_0xef0f('0x7')]=_[_0xef0f('0x8')](config[_0xef0f('0x7')],{'host':_0xef0f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function UserReport(_0xde2227){this['trunks']=_0xde2227[_0xef0f('0xa')];this[_0xef0f('0xb')]=_0xde2227[_0xef0f('0xb')];this['telephones']=_0xde2227[_0xef0f('0xc')];ami['on'](_0xef0f('0xd'),this[_0xef0f('0xe')][_0xef0f('0xf')](this));ami['on'](_0xef0f('0x10'),this[_0xef0f('0xe')][_0xef0f('0xf')](this));ami['on'](_0xef0f('0x11'),this[_0xef0f('0x12')][_0xef0f('0xf')](this));ami['on'](_0xef0f('0x13'),this[_0xef0f('0x14')]['bind'](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise['resolve']()['then'](ami[_0xef0f('0x15')]())[_0xef0f('0x16')](function(_0x2b749b){logger['error'](_0xef0f('0x17'),util[_0xef0f('0x18')](_0x2b749b,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xef0f('0x19')]()['then'](ami[_0xef0f('0x1a')]())[_0xef0f('0x16')](function(_0x5da35d){logger[_0xef0f('0x1b')](_0xef0f('0x1c'),util[_0xef0f('0x18')](_0x5da35d,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0xef0f('0x1d')](ami[_0xef0f('0x1e')]())[_0xef0f('0x16')](function(_0x38a972){logger[_0xef0f('0x1b')](_0xef0f('0x1f'),util[_0xef0f('0x18')](_0x38a972,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0xef0f('0x20')]=function(){setInterval(function(){BPromise[_0xef0f('0x19')]()['then'](showSipRegistrations())[_0xef0f('0x1d')](listDeviceStates())[_0xef0f('0x1d')](showPeersStatus());},0x32c8);};UserReport[_0xef0f('0x21')]['isNotNull']=function(_0x559067){return _0x559067!==null&&!_[_0xef0f('0x22')](_0x559067);};UserReport[_0xef0f('0x21')][_0xef0f('0x23')]=function(_0x277e33,_0x2e339e,_0x5b80c5){io['to'](_0x277e33)[_0xef0f('0x23')](_0x2e339e,_0x5b80c5);};UserReport['prototype'][_0xef0f('0xe')]=function(_0x495891){try{if(this[_0xef0f('0x24')](_0x495891)){logger[_0xef0f('0x25')](_0xef0f('0x26'),_0x495891[_0xef0f('0x27')],_0x495891[_0xef0f('0x28')]);logger[_0xef0f('0x29')](_0xef0f('0x2a'),util[_0xef0f('0x18')](_0x495891,{'showHidden':![],'depth':null}));var _0x43ccc8=_[_0xef0f('0x2b')](this[_0xef0f('0xa')],{'defaultuser':_0x495891['username']});if(_0x43ccc8){_0x495891[_0xef0f('0x2c')]=_0x495891[_0xef0f('0x28')];_[_0xef0f('0x2d')](_0x43ccc8,_[_0xef0f('0x2e')](_0x495891,['event','actionid',_0xef0f('0x27'),'state']));logger['debug'](_0xef0f('0x2f'),util['inspect'](_0x43ccc8,{'showHidden':![],'depth':null}));this[_0xef0f('0x23')](util[_0xef0f('0x30')](_0xef0f('0x31'),_0x43ccc8[_0xef0f('0x32')]),_0xef0f('0x33'),_0x43ccc8);}}}catch(_0xe6cd7f){logger[_0xef0f('0x1b')](_0xef0f('0x2a'),util['inspect'](_0xe6cd7f,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncDeviceState']=function(_0x2dba9f){try{if(this[_0xef0f('0x24')](_0x2dba9f)){logger[_0xef0f('0x25')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x2dba9f[_0xef0f('0x34')],_0x2dba9f[_0xef0f('0x28')]);logger['debug']('[userReport][devicestatechange]',util[_0xef0f('0x18')](_0x2dba9f,{'showHidden':![],'depth':null}));if(this[_0xef0f('0xb')][_0x2dba9f[_0xef0f('0x34')]]){if(!this[_0xef0f('0xb')][_0x2dba9f[_0xef0f('0x34')]][_0xef0f('0x35')]||_0x2dba9f[_0xef0f('0x28')][_0xef0f('0x36')]()==_0xef0f('0x37')){this['agents'][_0x2dba9f[_0xef0f('0x34')]][_0xef0f('0x35')]=![];if(this[_0xef0f('0xb')][_0x2dba9f[_0xef0f('0x34')]][_0xef0f('0x28')]!==_0x2dba9f[_0xef0f('0x28')][_0xef0f('0x36')]()){this['agents'][_0x2dba9f[_0xef0f('0x34')]]['stateTime']=_[_0xef0f('0x38')](moment()[_0xef0f('0x30')]('x'));}this['agents'][_0x2dba9f[_0xef0f('0x34')]][_0xef0f('0x28')]=_0x2dba9f[_0xef0f('0x28')][_0xef0f('0x36')]();this[_0xef0f('0xb')][_0x2dba9f[_0xef0f('0x34')]]['updateStatusRealtime'](_0x2dba9f);}}else if(this['telephones'][_0x2dba9f['device']]){if(this[_0xef0f('0xc')][_0x2dba9f[_0xef0f('0x34')]][_0xef0f('0x28')]!==_0x2dba9f['state']['toLowerCase']()){this[_0xef0f('0xc')][_0x2dba9f[_0xef0f('0x34')]][_0xef0f('0x39')]=_[_0xef0f('0x38')](moment()['format']('x'));}this[_0xef0f('0xc')][_0x2dba9f['device']][_0xef0f('0x28')]=_0x2dba9f[_0xef0f('0x28')][_0xef0f('0x36')]();logger['debug'](_0xef0f('0x3a'),util[_0xef0f('0x18')](this[_0xef0f('0xc')][_0x2dba9f[_0xef0f('0x34')]],{'showHidden':![],'depth':null}));this[_0xef0f('0x23')](util['format']('telephone:%s',this['telephones'][_0x2dba9f[_0xef0f('0x34')]][_0xef0f('0x32')]),_0xef0f('0x3b'),this[_0xef0f('0xc')][_0x2dba9f[_0xef0f('0x34')]]);}else if(this[_0xef0f('0xa')][_0x2dba9f['device']]){if(this['trunks'][_0x2dba9f['device']]['state']!==_0x2dba9f[_0xef0f('0x28')][_0xef0f('0x36')]()){this[_0xef0f('0xa')][_0x2dba9f['device']]['stateTime']=_[_0xef0f('0x38')](moment()[_0xef0f('0x30')]('x'));}this[_0xef0f('0xa')][_0x2dba9f[_0xef0f('0x34')]][_0xef0f('0x28')]=_0x2dba9f[_0xef0f('0x28')][_0xef0f('0x36')]();logger[_0xef0f('0x29')](_0xef0f('0x3c'),util[_0xef0f('0x18')](this[_0xef0f('0xa')][_0x2dba9f[_0xef0f('0x34')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xef0f('0x30')](_0xef0f('0x31'),this['trunks'][_0x2dba9f[_0xef0f('0x34')]][_0xef0f('0x32')]),_0xef0f('0x33'),this['trunks'][_0x2dba9f[_0xef0f('0x34')]]);}else if(_[_0xef0f('0x3d')](_0x2dba9f[_0xef0f('0x34')],_0xef0f('0x3e'))){var _0x33a5fa=_0x2dba9f['device'];var _0x5a7857=_0x33a5fa[_0xef0f('0x3f')](_0x33a5fa[_0xef0f('0x40')]('/')+0x1,_0x33a5fa[_0xef0f('0x40')]('@'));var _0x561438=_['find'](this['agents'],function(_0x5e8385){return _0x5e8385[_0xef0f('0x41')]==_0x5a7857||_0x5e8385[_0xef0f('0x42')]==_0x5a7857||_0x5e8385[_0xef0f('0x43')]==_0x5a7857;});if(_0x561438){if(_0x561438[_0xef0f('0x28')]!==_0x2dba9f['state'][_0xef0f('0x36')]()){_0x561438[_0xef0f('0x39')]=_[_0xef0f('0x38')](moment()['format']('x'));}_0x561438[_0xef0f('0x28')]=_0x2dba9f[_0xef0f('0x28')]['toLowerCase']();_0x561438[_0xef0f('0x35')]=!![];_0x561438[_0xef0f('0x44')](_0x2dba9f);}}}}catch(_0x56e6e0){logger[_0xef0f('0x1b')](_0xef0f('0x45'),util[_0xef0f('0x18')](_0x56e6e0,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xef0f('0x14')]=function(_0x11101f){try{if(this[_0xef0f('0x24')](_0x11101f)&&this[_0xef0f('0x24')](_0x11101f[_0xef0f('0x13')])){logger[_0xef0f('0x25')](_0xef0f('0x46'),_0x11101f[_0xef0f('0x47')],_0x11101f['address'],_0x11101f[_0xef0f('0x13')]);logger['debug'](_0xef0f('0x48'),util[_0xef0f('0x18')](_0x11101f,{'showHidden':![],'depth':null}));if(this[_0xef0f('0xb')][_0x11101f['peer']]){if(!this[_0xef0f('0xb')][_0x11101f[_0xef0f('0x47')]][_0xef0f('0x35')]||_0x11101f['peerstatus'][_0xef0f('0x36')]()==_0xef0f('0x49')){this[_0xef0f('0xb')][_0x11101f[_0xef0f('0x47')]]['local']=![];this[_0xef0f('0xb')][_0x11101f[_0xef0f('0x47')]][_0xef0f('0x4a')]=_0x11101f[_0xef0f('0x13')][_0xef0f('0x36')]();this[_0xef0f('0xb')][_0x11101f[_0xef0f('0x47')]]['address']=_0x11101f[_0xef0f('0x4b')];this[_0xef0f('0xb')][_0x11101f[_0xef0f('0x47')]][_0xef0f('0x44')](_0x11101f);}}else if(this[_0xef0f('0xc')][_0x11101f[_0xef0f('0x47')]]){this['telephones'][_0x11101f['peer']][_0xef0f('0x4a')]=_0x11101f['peerstatus'][_0xef0f('0x36')]();this[_0xef0f('0xc')][_0x11101f[_0xef0f('0x47')]]['address']=_0x11101f[_0xef0f('0x4b')];logger[_0xef0f('0x29')](_0xef0f('0x4c'),util[_0xef0f('0x18')](this[_0xef0f('0xc')][_0x11101f[_0xef0f('0x47')]],{'showHidden':![],'depth':null}));this[_0xef0f('0x23')](util['format'](_0xef0f('0x4d'),this[_0xef0f('0xc')][_0x11101f['peer']]['name']),_0xef0f('0x3b'),this[_0xef0f('0xc')][_0x11101f[_0xef0f('0x47')]]);}else if(this['trunks'][_0x11101f['peer']]){this[_0xef0f('0xa')][_0x11101f['peer']][_0xef0f('0x4a')]=_0x11101f['peerstatus'][_0xef0f('0x36')]();this[_0xef0f('0xa')][_0x11101f[_0xef0f('0x47')]][_0xef0f('0x4b')]=_0x11101f[_0xef0f('0x4b')];logger[_0xef0f('0x29')](_0xef0f('0x4e'),util[_0xef0f('0x18')](this['trunks'][_0x11101f['peer']],{'showHidden':![],'depth':null}));this[_0xef0f('0x23')](util[_0xef0f('0x30')](_0xef0f('0x31'),this[_0xef0f('0xa')][_0x11101f[_0xef0f('0x47')]][_0xef0f('0x32')]),'trunk:save',this[_0xef0f('0xa')][_0x11101f[_0xef0f('0x47')]]);}}}catch(_0x1f9c62){logger[_0xef0f('0x1b')](_0xef0f('0x48'),util[_0xef0f('0x18')](_0x1f9c62,{'showHidden':![],'depth':null}));}};module[_0xef0f('0x4f')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 4b63b4c..1a3b437 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 _0xb7f0=['[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','channels','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','voice','merge','omit','event','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','voiceChannels','routealias','interface','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','membername','user:agentconnect','agentringnoanswer','agentcomplete','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','agentcompleteAt','complete','agent','talktime','acw','acwtime','agentacw','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','transfer','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]'];(function(_0x4664db,_0x1de672){var _0x5615b4=function(_0x54fb5a){while(--_0x54fb5a){_0x4664db['push'](_0x4664db['shift']());}};_0x5615b4(++_0x1de672);}(_0xb7f0,0x1c7));var _0x0b7f=function(_0x3f87ce,_0x4abd6c){_0x3f87ce=_0x3f87ce-0x0;var _0x8d7035=_0xb7f0[_0x3f87ce];return _0x8d7035;};'use strict';var _=require(_0x0b7f('0x0'));var moment=require(_0x0b7f('0x1'));var util=require(_0x0b7f('0x2'));var Redis=require(_0x0b7f('0x3'));var config=require(_0x0b7f('0x4'));var logger=require('../../../config/logger')(_0x0b7f('0x5'));var ami=require(_0x0b7f('0x6'));config[_0x0b7f('0x7')]=_[_0x0b7f('0x8')](config[_0x0b7f('0x7')],{'host':_0x0b7f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceAgentReport(_0x40ca13){this['channels']={};this['voiceChannels']=_0x40ca13['channels'];this[_0x0b7f('0xa')]=_0x40ca13[_0x0b7f('0xa')];this[_0x0b7f('0xb')]=_0x40ca13[_0x0b7f('0xb')];this[_0x0b7f('0xc')]={};ami['on'](_0x0b7f('0xd'),this[_0x0b7f('0xe')][_0x0b7f('0xf')](this));ami['on'](_0x0b7f('0x10'),this[_0x0b7f('0x11')][_0x0b7f('0xf')](this));ami['on']('agentringnoanswer',this[_0x0b7f('0x12')][_0x0b7f('0xf')](this));ami['on'](_0x0b7f('0x13'),this[_0x0b7f('0x14')][_0x0b7f('0xf')](this));ami['on']('agentcomplete',this[_0x0b7f('0x15')][_0x0b7f('0xf')](this));ami['on'](_0x0b7f('0x16'),this['syncVarSet']['bind'](this));ami['on'](_0x0b7f('0x17'),this[_0x0b7f('0x18')]['bind'](this));ami['on'](_0x0b7f('0x19'),this[_0x0b7f('0x1a')][_0x0b7f('0xf')](this));ami['on'](_0x0b7f('0x1b'),this[_0x0b7f('0x1c')]['bind'](this));ami['on']('attendedtransfer',this[_0x0b7f('0x1d')][_0x0b7f('0xf')](this));ami['on']('blindtransfer',this[_0x0b7f('0x1e')][_0x0b7f('0xf')](this));}VoiceAgentReport[_0x0b7f('0x1f')][_0x0b7f('0x20')]=function(_0x27d66f,_0x573c78,_0x256984){io['to'](_0x27d66f)[_0x0b7f('0x20')](_0x573c78,_0x256984);};VoiceAgentReport[_0x0b7f('0x1f')][_0x0b7f('0x21')]=function(_0x2d5365){return _0x2d5365!==null&&!_[_0x0b7f('0x22')](_0x2d5365);};VoiceAgentReport[_0x0b7f('0x1f')]['syncAgentCalled']=function(_0x5d0e30){try{if(this[_0x0b7f('0x21')](_0x5d0e30)){logger[_0x0b7f('0x23')](_0x0b7f('0x24'),_0x5d0e30[_0x0b7f('0x25')],_0x5d0e30['membername'],_0x5d0e30[_0x0b7f('0x26')]);logger[_0x0b7f('0x27')](_0x0b7f('0x28'),_0x5d0e30[_0x0b7f('0x25')],util[_0x0b7f('0x29')](_0x5d0e30,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0x5d0e30['uniqueid']])){this[_0x0b7f('0x2a')][_0x5d0e30[_0x0b7f('0x25')]]={};}if(_[_0x0b7f('0x22')](this['channels'][_0x5d0e30[_0x0b7f('0x25')]][_0x5d0e30[_0x0b7f('0x26')]])){this[_0x0b7f('0x2a')][_0x5d0e30[_0x0b7f('0x25')]][_0x5d0e30['destuniqueid']]={'agentcalledAt':moment()['format'](_0x0b7f('0x2b')),'lastevent':_0x0b7f('0x2c'),'mandatoryDisposition':this[_0x0b7f('0xa')][_0x5d0e30[_0x0b7f('0x2d')]]?this[_0x0b7f('0xa')][_0x5d0e30[_0x0b7f('0x2d')]]['mandatoryDisposition']||![]:![],'type':this['voiceQueues'][_0x5d0e30[_0x0b7f('0x2d')]]?this[_0x0b7f('0xa')][_0x5d0e30[_0x0b7f('0x2d')]][_0x0b7f('0x2e')]||_0x0b7f('0x2f'):'inbound','variables':this[_0x0b7f('0xc')][_0x5d0e30[_0x0b7f('0x25')]],'motionChannel':_0x0b7f('0x30')};}_[_0x0b7f('0x31')](this[_0x0b7f('0x2a')][_0x5d0e30[_0x0b7f('0x25')]][_0x5d0e30[_0x0b7f('0x26')]],_[_0x0b7f('0x32')](_0x5d0e30,[_0x0b7f('0x33'),'privilege']));logger[_0x0b7f('0x27')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x5d0e30['uniqueid'],util[_0x0b7f('0x29')](this[_0x0b7f('0x2a')][_0x5d0e30[_0x0b7f('0x25')]][_0x5d0e30['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x0b7f('0x34'),this['channels'][_0x5d0e30['uniqueid']][_0x5d0e30['destuniqueid']]);logger[_0x0b7f('0x27')](_0x0b7f('0x35'),_0x5d0e30[_0x0b7f('0x25')],util[_0x0b7f('0x29')](this['channels'][_0x5d0e30[_0x0b7f('0x25')]][_0x5d0e30[_0x0b7f('0x26')]],{'showHidden':![],'depth':null}));this[_0x0b7f('0x20')](util[_0x0b7f('0x36')](_0x0b7f('0x37'),_0x5d0e30['membername']),_0x0b7f('0x38'),this['channels'][_0x5d0e30[_0x0b7f('0x25')]][_0x5d0e30[_0x0b7f('0x26')]]);}}catch(_0x43b5c4){logger[_0x0b7f('0x39')](_0x0b7f('0x3a'),_0x5d0e30[_0x0b7f('0x25')],util[_0x0b7f('0x29')](_0x43b5c4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0b7f('0x1f')]['syncAgentConnect']=function(_0x40530d){try{if(this['isNotNull'](_0x40530d)){if(this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]]){logger['debug'](_0x0b7f('0x3b'),_0x40530d[_0x0b7f('0x25')],util[_0x0b7f('0x29')](_0x40530d,{'showHidden':![],'depth':null}));for(var _0x23deab in this[_0x0b7f('0x2a')][_0x40530d['uniqueid']]){if(this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x0b7f('0x3c')](_0x23deab)){if(_0x40530d[_0x0b7f('0x26')]===_0x23deab){logger[_0x0b7f('0x23')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x40530d[_0x0b7f('0x25')],_0x40530d['membername'],_0x40530d['destuniqueid']);this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x23deab][_0x0b7f('0x3d')]=moment()[_0x0b7f('0x36')](_0x0b7f('0x2b'));this[_0x0b7f('0x2a')][_0x40530d['uniqueid']][_0x23deab][_0x0b7f('0x3e')]=_0x40530d[_0x0b7f('0x3e')];this['channels'][_0x40530d[_0x0b7f('0x25')]][_0x23deab][_0x0b7f('0x3f')]=_0x40530d[_0x0b7f('0x3f')];this[_0x0b7f('0x2a')][_0x40530d['uniqueid']][_0x23deab][_0x0b7f('0x40')]=_0x40530d[_0x0b7f('0x40')];this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x23deab][_0x0b7f('0x41')]=_0x40530d[_0x0b7f('0x41')];this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x23deab][_0x0b7f('0x42')]=_0x40530d['holdtime'];this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x23deab][_0x0b7f('0x43')]=_0x0b7f('0x44');if(this[_0x0b7f('0x45')][this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x23deab][_0x0b7f('0x25')]]){var _0x144c6f=this['voiceChannels'][this[_0x0b7f('0x2a')][_0x40530d['uniqueid']][_0x23deab][_0x0b7f('0x25')]][_0x0b7f('0x46')];this[_0x0b7f('0x2a')][_0x40530d['uniqueid']][_0x23deab]['routealias']=_0x144c6f;_0x40530d[_0x0b7f('0x46')]=_0x144c6f;}_[_0x0b7f('0x31')](this[_0x0b7f('0xb')][_0x40530d[_0x0b7f('0x47')]],_['pick'](_0x40530d,[_0x0b7f('0x2d'),'destconnectedlinenum',_0x0b7f('0x46')]));logger['debug'](_0x0b7f('0x48'),_0x40530d[_0x0b7f('0x25')],util[_0x0b7f('0x29')](this[_0x0b7f('0x2a')][_0x40530d['uniqueid']][_0x40530d[_0x0b7f('0x26')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentconnect',this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x40530d['destuniqueid']]);logger[_0x0b7f('0x27')](_0x0b7f('0x49'),_0x40530d['uniqueid'],util['inspect'](this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x40530d[_0x0b7f('0x26')]],{'showHidden':![],'depth':null}));this[_0x0b7f('0x20')](util[_0x0b7f('0x36')](_0x0b7f('0x37'),_0x40530d[_0x0b7f('0x4a')]),_0x0b7f('0x4b'),this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x40530d[_0x0b7f('0x26')]]);}else if(!this[_0x0b7f('0x2a')][_0x40530d['uniqueid']][_0x23deab][_0x0b7f('0x4c')]&&!this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x23deab][_0x0b7f('0x4d')]){logger['info'](_0x0b7f('0x4e'),_0x40530d['uniqueid'],this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x23deab][_0x0b7f('0x4a')],_0x23deab);this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x23deab][_0x0b7f('0x4c')]=!![];this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x23deab][_0x0b7f('0x4f')]=moment()[_0x0b7f('0x36')](_0x0b7f('0x2b'));this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x23deab]['answeredelsewheredestinationuniqueid']=_0x40530d[_0x0b7f('0x26')];this['channels'][_0x40530d['uniqueid']][_0x23deab][_0x0b7f('0x50')]=_0x40530d['membername'];this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x23deab][_0x0b7f('0x43')]=_0x0b7f('0x51');this['channels'][_0x40530d['uniqueid']][_0x23deab]['reason']='answered_elsewhere';logger[_0x0b7f('0x27')](_0x0b7f('0x52'),_0x40530d[_0x0b7f('0x25')],util[_0x0b7f('0x29')](this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x23deab],{'showHidden':![],'depth':null}));ami['emit']('custom:agentansweredelsewhere',this[_0x0b7f('0x2a')][_0x40530d[_0x0b7f('0x25')]][_0x23deab]);}}}}}}catch(_0x427d13){logger[_0x0b7f('0x39')]('[%s][voiceAgentReport][agentconnect]',_0x40530d[_0x0b7f('0x25')],util[_0x0b7f('0x29')](_0x427d13,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0b7f('0x1f')]['syncAgentRingNoAnswer']=function(_0x43369f){try{if(this[_0x0b7f('0x21')](_0x43369f)){logger['debug'](_0x0b7f('0x53'),_0x43369f[_0x0b7f('0x25')],util[_0x0b7f('0x29')](_0x43369f,{'showHidden':![],'depth':null}));if(this[_0x0b7f('0x2a')][_0x43369f[_0x0b7f('0x25')]]&&this[_0x0b7f('0x2a')][_0x43369f[_0x0b7f('0x25')]][_0x43369f[_0x0b7f('0x26')]]){logger[_0x0b7f('0x23')](_0x0b7f('0x54'),_0x43369f[_0x0b7f('0x25')],_0x43369f[_0x0b7f('0x4a')],_0x43369f[_0x0b7f('0x26')]);this[_0x0b7f('0x2a')][_0x43369f[_0x0b7f('0x25')]][_0x43369f[_0x0b7f('0x26')]]['agentringnoanswer']=!![];this[_0x0b7f('0x2a')][_0x43369f[_0x0b7f('0x25')]][_0x43369f['destuniqueid']][_0x0b7f('0x4f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0b7f('0x2a')][_0x43369f[_0x0b7f('0x25')]][_0x43369f[_0x0b7f('0x26')]]['lastevent']=_0x0b7f('0x55');this[_0x0b7f('0x2a')][_0x43369f[_0x0b7f('0x25')]][_0x43369f['destuniqueid']]['reason']=_0x0b7f('0x55');logger[_0x0b7f('0x27')](_0x0b7f('0x56'),_0x43369f['uniqueid'],util[_0x0b7f('0x29')](this[_0x0b7f('0x2a')][_0x43369f[_0x0b7f('0x25')]][_0x43369f[_0x0b7f('0x26')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0b7f('0x57'),this[_0x0b7f('0x2a')][_0x43369f[_0x0b7f('0x25')]][_0x43369f[_0x0b7f('0x26')]]);}}}catch(_0x215de3){logger[_0x0b7f('0x39')](_0x0b7f('0x58'),_0x43369f[_0x0b7f('0x25')],util[_0x0b7f('0x29')](_0x215de3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0b7f('0x1f')]['syncQueueCallerAbandon']=function(_0x215ba9){try{if(this['isNotNull'](_0x215ba9)){logger['debug'](_0x0b7f('0x59'),_0x215ba9['uniqueid'],util[_0x0b7f('0x29')](_0x215ba9,{'showHidden':![],'depth':null}));if(this[_0x0b7f('0x2a')][_0x215ba9[_0x0b7f('0x25')]]){for(var _0x2673a5 in this['channels'][_0x215ba9[_0x0b7f('0x25')]]){if(this[_0x0b7f('0x2a')][_0x215ba9[_0x0b7f('0x25')]]['hasOwnProperty'](_0x2673a5)&&!this[_0x0b7f('0x2a')][_0x215ba9['uniqueid']][_0x2673a5]['agentringnoanswer']&&!this[_0x0b7f('0x2a')][_0x215ba9[_0x0b7f('0x25')]][_0x2673a5][_0x0b7f('0x4d')]){logger[_0x0b7f('0x23')](_0x0b7f('0x5a'),_0x215ba9[_0x0b7f('0x25')],this[_0x0b7f('0x2a')][_0x215ba9[_0x0b7f('0x25')]][_0x2673a5][_0x0b7f('0x4a')],_0x2673a5);this[_0x0b7f('0x2a')][_0x215ba9[_0x0b7f('0x25')]][_0x2673a5][_0x0b7f('0x4c')]=!![];this['channels'][_0x215ba9[_0x0b7f('0x25')]][_0x2673a5][_0x0b7f('0x4f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0b7f('0x2a')][_0x215ba9['uniqueid']][_0x2673a5]['lastevent']='abandoned';this[_0x0b7f('0x2a')][_0x215ba9[_0x0b7f('0x25')]][_0x2673a5][_0x0b7f('0x5b')]=_0x0b7f('0x5c');logger[_0x0b7f('0x27')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x215ba9[_0x0b7f('0x25')],util[_0x0b7f('0x29')](this[_0x0b7f('0x2a')][_0x215ba9[_0x0b7f('0x25')]][_0x2673a5],{'showHidden':![],'depth':null}));ami['emit'](_0x0b7f('0x5d'),this[_0x0b7f('0x2a')][_0x215ba9[_0x0b7f('0x25')]][_0x2673a5]);}}}}}catch(_0x321357){logger[_0x0b7f('0x39')](_0x0b7f('0x5e'),_0x215ba9[_0x0b7f('0x25')],util[_0x0b7f('0x29')](_0x321357,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0b7f('0x15')]=function(_0x92e0a1){try{if(this[_0x0b7f('0x21')](_0x92e0a1)){logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x92e0a1[_0x0b7f('0x25')],util['inspect'](_0x92e0a1,{'showHidden':![],'depth':null}));if(this[_0x0b7f('0x2a')][_0x92e0a1['uniqueid']]){for(var _0x3bb40f in this['channels'][_0x92e0a1[_0x0b7f('0x25')]]){if(this[_0x0b7f('0x2a')][_0x92e0a1[_0x0b7f('0x25')]][_0x0b7f('0x3c')](_0x3bb40f)){if(this[_0x0b7f('0x2a')][_0x92e0a1[_0x0b7f('0x25')]][_0x3bb40f][_0x0b7f('0x3d')]&&!this['channels'][_0x92e0a1[_0x0b7f('0x25')]][_0x3bb40f][_0x0b7f('0x4d')]){logger['info']('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x92e0a1[_0x0b7f('0x25')],this[_0x0b7f('0x2a')][_0x92e0a1[_0x0b7f('0x25')]][_0x3bb40f]['membername'],_0x3bb40f);this['channels'][_0x92e0a1[_0x0b7f('0x25')]][_0x3bb40f][_0x0b7f('0x4d')]=!![];this[_0x0b7f('0x2a')][_0x92e0a1[_0x0b7f('0x25')]][_0x3bb40f][_0x0b7f('0x5f')]=moment()[_0x0b7f('0x36')](_0x0b7f('0x2b'));this[_0x0b7f('0x2a')][_0x92e0a1[_0x0b7f('0x25')]][_0x3bb40f]['lastevent']=_0x0b7f('0x60');this[_0x0b7f('0x2a')][_0x92e0a1[_0x0b7f('0x25')]][_0x3bb40f]['reason']=_0x92e0a1[_0x0b7f('0x5b')]=='transfer'?_0x0b7f('0x61'):_0x92e0a1['reason'];this[_0x0b7f('0x2a')][_0x92e0a1[_0x0b7f('0x25')]][_0x3bb40f][_0x0b7f('0x62')]=_0x92e0a1['talktime'];if(this[_0x0b7f('0xa')][_0x92e0a1[_0x0b7f('0x2d')]]&&this[_0x0b7f('0xa')][_0x92e0a1['queue']][_0x0b7f('0x63')]){this[_0x0b7f('0x2a')][_0x92e0a1[_0x0b7f('0x25')]][_0x3bb40f][_0x0b7f('0x64')]=this[_0x0b7f('0xa')][_0x92e0a1[_0x0b7f('0x2d')]]['acwTimeout'];this[_0x0b7f('0x2a')][_0x92e0a1[_0x0b7f('0x25')]][_0x3bb40f][_0x0b7f('0x65')]=!![];}this[_0x0b7f('0xb')][_0x92e0a1[_0x0b7f('0x47')]]=_[_0x0b7f('0x32')](this[_0x0b7f('0xb')][_0x92e0a1[_0x0b7f('0x47')]],[_0x0b7f('0x2d'),_0x0b7f('0x66')]);logger['debug'](_0x0b7f('0x67'),_0x92e0a1[_0x0b7f('0x25')],util[_0x0b7f('0x29')](this['channels'][_0x92e0a1['uniqueid']][_0x3bb40f],{'showHidden':![],'depth':null}));ami[_0x0b7f('0x20')](_0x0b7f('0x68'),this[_0x0b7f('0x2a')][_0x92e0a1[_0x0b7f('0x25')]][_0x3bb40f]);logger['debug'](_0x0b7f('0x69'),_0x92e0a1[_0x0b7f('0x25')],util[_0x0b7f('0x29')](this[_0x0b7f('0x2a')][_0x92e0a1[_0x0b7f('0x25')]][_0x3bb40f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0b7f('0x36')](_0x0b7f('0x37'),_0x92e0a1['membername']),_0x0b7f('0x6a'),this[_0x0b7f('0x2a')][_0x92e0a1['uniqueid']][_0x3bb40f]);}}}}}}catch(_0x3b6980){logger[_0x0b7f('0x39')]('[%s][voiceAgentReport][agentcomplete]',_0x92e0a1[_0x0b7f('0x25')],util['inspect'](_0x3b6980,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x2fd263){try{if(this[_0x0b7f('0x21')](_0x2fd263)){logger[_0x0b7f('0x27')](_0x0b7f('0x6b'),_0x2fd263[_0x0b7f('0x25')],util['inspect'](_0x2fd263,{'showHidden':![],'depth':null}));this['addVariable'](_0x2fd263[_0x0b7f('0x25')],_[_0x0b7f('0x6c')](_0x2fd263[_0x0b7f('0x6d')])[0x0],_0x2fd263['value']);if(this[_0x0b7f('0x2a')][_0x2fd263['uniqueid']]){for(var _0x144bd6 in this[_0x0b7f('0x2a')][_0x2fd263[_0x0b7f('0x25')]]){if(this[_0x0b7f('0x2a')][_0x2fd263[_0x0b7f('0x25')]][_0x0b7f('0x3c')](_0x144bd6)){logger[_0x0b7f('0x23')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x2fd263['uniqueid'],_0x144bd6,_[_0x0b7f('0x6c')](_0x2fd263[_0x0b7f('0x6d')])[0x0],_0x2fd263[_0x0b7f('0x6e')]);if(_[_0x0b7f('0x22')](this[_0x0b7f('0x2a')][_0x2fd263[_0x0b7f('0x25')]][_0x144bd6][_0x0b7f('0xc')])){this[_0x0b7f('0x2a')][_0x2fd263[_0x0b7f('0x25')]][_0x144bd6][_0x0b7f('0xc')]={};}this[_0x0b7f('0x2a')][_0x2fd263[_0x0b7f('0x25')]][_0x144bd6][_0x0b7f('0xc')]=this[_0x0b7f('0xc')][_0x2fd263[_0x0b7f('0x25')]];}}}}}catch(_0x292bae){logger['error']('[%s][voiceAgentReport][varset]',_0x2fd263[_0x0b7f('0x25')],util[_0x0b7f('0x29')](_0x292bae,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0b7f('0x1f')]['addVariable']=function(_0x35205c,_0x13484b,_0xa0c216){var _0x3653ee=[_0x0b7f('0x6f'),_0x0b7f('0x70'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x0b7f('0x71'),_0x0b7f('0x72'),_0x0b7f('0x73'),'rtpaudioqosrttbridged',_0x0b7f('0x74'),'sipuri',_0x0b7f('0x75'),_0x0b7f('0x76'),_0x0b7f('0x77'),'memberdynamic',_0x0b7f('0x78'),_0x0b7f('0x79'),_0x0b7f('0x4a'),_0x0b7f('0x7a'),_0x0b7f('0x7b')];if(!_[_0x0b7f('0x7c')](_0x13484b)&&!_[_0x0b7f('0x7d')](_0x3653ee,_0x13484b)){if(_[_0x0b7f('0x22')](this[_0x0b7f('0xc')][_0x35205c])){this[_0x0b7f('0xc')][_0x35205c]={};}this['variables'][_0x35205c][_0x13484b]=_0xa0c216;}};VoiceAgentReport[_0x0b7f('0x1f')][_0x0b7f('0x18')]=function(_0x3c870a){try{if(this[_0x0b7f('0x21')](_0x3c870a)){logger[_0x0b7f('0x27')](_0x0b7f('0x7e'),_0x3c870a['uniqueid'],util[_0x0b7f('0x29')](_0x3c870a,{'showHidden':![],'depth':null}));if(this[_0x0b7f('0x2a')][_0x3c870a['uniqueid']]){for(var _0x64f177 in this['channels'][_0x3c870a[_0x0b7f('0x25')]]){if(this['channels'][_0x3c870a[_0x0b7f('0x25')]][_0x0b7f('0x3c')](_0x64f177)){if(this[_0x0b7f('0x2a')][_0x3c870a[_0x0b7f('0x25')]][_0x64f177]['reason']=='transfer'&&this[_0x0b7f('0x2a')][_0x3c870a['uniqueid']][_0x64f177]['agentcomplete']){logger[_0x0b7f('0x23')](_0x0b7f('0x7f'),_0x3c870a[_0x0b7f('0x25')],_0x64f177);this[_0x0b7f('0x2a')][_0x3c870a[_0x0b7f('0x25')]][_0x64f177][_0x0b7f('0x5f')]=moment()[_0x0b7f('0x36')](_0x0b7f('0x2b'));}}}logger[_0x0b7f('0x27')](_0x0b7f('0x80'),_0x3c870a[_0x0b7f('0x25')],util[_0x0b7f('0x29')](_['values'](this['channels'][_0x3c870a['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x0b7f('0x20')](_0x0b7f('0x81'),_[_0x0b7f('0x82')](this['channels'][_0x3c870a[_0x0b7f('0x25')]]));delete this[_0x0b7f('0x2a')][_0x3c870a[_0x0b7f('0x25')]];}if(this['variables'][_0x3c870a[_0x0b7f('0x25')]]){delete this[_0x0b7f('0xc')][_0x3c870a[_0x0b7f('0x25')]];}}}catch(_0x23b9a0){logger[_0x0b7f('0x39')](_0x0b7f('0x83'),_0x3c870a[_0x0b7f('0x25')],util[_0x0b7f('0x29')](_0x23b9a0,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAttendedTransfer']=function(_0x751d25){try{if(this['isNotNull'](_0x751d25)){logger[_0x0b7f('0x27')](_0x0b7f('0x84'),_0x751d25[_0x0b7f('0x25')],util[_0x0b7f('0x29')](_0x751d25,{'showHidden':![],'depth':null}));if(this[_0x0b7f('0x2a')][_0x751d25[_0x0b7f('0x85')]]){for(var _0x37fc8d in this['channels'][_0x751d25[_0x0b7f('0x85')]]){if(this['channels'][_0x751d25[_0x0b7f('0x85')]]['hasOwnProperty'](_0x37fc8d)){if(_0x751d25['origtransfereruniqueid']===_0x37fc8d){logger[_0x0b7f('0x23')](_0x0b7f('0x86'),_0x751d25[_0x0b7f('0x25')],this[_0x0b7f('0x2a')][_0x751d25['transfereeuniqueid']][_0x37fc8d]['membername'],_0x37fc8d);var _0x352e2a=moment();this[_0x0b7f('0x2a')][_0x751d25[_0x0b7f('0x85')]][_0x37fc8d][_0x0b7f('0x4d')]=!![];this['channels'][_0x751d25[_0x0b7f('0x85')]][_0x37fc8d][_0x0b7f('0x5f')]=moment()[_0x0b7f('0x36')](_0x0b7f('0x2b'));this[_0x0b7f('0x2a')][_0x751d25[_0x0b7f('0x85')]][_0x37fc8d]['lastevent']=_0x0b7f('0x60');this[_0x0b7f('0x2a')][_0x751d25[_0x0b7f('0x85')]][_0x37fc8d][_0x0b7f('0x5b')]=_0x0b7f('0x87');this['channels'][_0x751d25[_0x0b7f('0x85')]][_0x37fc8d]['talktime']=_0x352e2a['diff'](this['channels'][_0x751d25['transfereeuniqueid']][_0x37fc8d][_0x0b7f('0x3d')],_0x0b7f('0x88'));}}}}if(this['channels'][_0x751d25['secondtransfereruniqueid']]){var _0x323eb3=this[_0x0b7f('0x2a')][_0x751d25[_0x0b7f('0x89')]];this['channels'][_0x751d25[_0x0b7f('0x89')]]=this[_0x0b7f('0x2a')][_0x751d25['transfereeuniqueid']];this[_0x0b7f('0x2a')][_0x751d25[_0x0b7f('0x85')]]=_0x323eb3;}}}catch(_0x1abf49){logger[_0x0b7f('0x39')]('[%s][voiceAgentReport][attendedtransfer]',_0x751d25[_0x0b7f('0x25')],util['inspect'](_0x1abf49,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0b7f('0x1f')][_0x0b7f('0x1e')]=function(_0x4770ac){try{if(this[_0x0b7f('0x21')](_0x4770ac)){logger[_0x0b7f('0x27')](_0x0b7f('0x8a'),_0x4770ac['uniqueid'],util[_0x0b7f('0x29')](_0x4770ac,{'showHidden':![],'depth':null}));if(this[_0x0b7f('0x2a')][_0x4770ac[_0x0b7f('0x85')]]){for(var _0x4b6c3d in this[_0x0b7f('0x2a')][_0x4770ac[_0x0b7f('0x85')]]){if(this[_0x0b7f('0x2a')][_0x4770ac[_0x0b7f('0x85')]][_0x0b7f('0x3c')](_0x4b6c3d)){if(_0x4770ac[_0x0b7f('0x8b')]===_0x4b6c3d){logger[_0x0b7f('0x23')](_0x0b7f('0x8c'),_0x4770ac[_0x0b7f('0x25')],this[_0x0b7f('0x2a')][_0x4770ac[_0x0b7f('0x85')]][_0x4b6c3d][_0x0b7f('0x4a')],_0x4b6c3d);var _0x447f7e=moment();this[_0x0b7f('0x2a')][_0x4770ac[_0x0b7f('0x85')]][_0x4b6c3d][_0x0b7f('0x4d')]=!![];this['channels'][_0x4770ac[_0x0b7f('0x85')]][_0x4b6c3d][_0x0b7f('0x5f')]=_0x447f7e;this[_0x0b7f('0x2a')][_0x4770ac[_0x0b7f('0x85')]][_0x4b6c3d][_0x0b7f('0x43')]='complete';this[_0x0b7f('0x2a')][_0x4770ac[_0x0b7f('0x85')]][_0x4b6c3d]['reason']=_0x0b7f('0x87');this[_0x0b7f('0x2a')][_0x4770ac[_0x0b7f('0x85')]][_0x4b6c3d][_0x0b7f('0x62')]=_0x447f7e['diff'](this[_0x0b7f('0x2a')][_0x4770ac[_0x0b7f('0x85')]][_0x4b6c3d][_0x0b7f('0x3d')],_0x0b7f('0x88'));}}}}}}catch(_0x264340){logger[_0x0b7f('0x39')](_0x0b7f('0x8d'),_0x4770ac['uniqueid'],util[_0x0b7f('0x29')](_0x264340,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0b7f('0x1f')][_0x0b7f('0x1a')]=function(_0x42152f){var _0x18b249='';try{if(this[_0x0b7f('0x21')](_0x42152f)){logger['debug'](_0x0b7f('0x8e'),_0x42152f[_0x0b7f('0x25')],util['inspect'](_0x42152f,{'showHidden':![],'depth':null}));if(_0x42152f[_0x0b7f('0x8f')]){_0x18b249=_0x42152f['channel'][_0x0b7f('0x90')](0x0,_0x42152f[_0x0b7f('0x8f')][_0x0b7f('0x91')]('-'));if(this['agents'][_0x18b249]){logger['info'](_0x0b7f('0x92'),_0x42152f['uniqueid'],_0x18b249);this['agents'][_0x18b249][_0x0b7f('0x93')]=!![];}}}}catch(_0x390625){logger[_0x0b7f('0x39')](_0x0b7f('0x94'),_0x42152f[_0x0b7f('0x25')],util['inspect'](_0x390625,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0b7f('0x1f')][_0x0b7f('0x1c')]=function(_0x5c128e){var _0x16ae44='';try{if(this[_0x0b7f('0x21')](_0x5c128e)){logger[_0x0b7f('0x27')](_0x0b7f('0x95'),_0x5c128e[_0x0b7f('0x25')],util[_0x0b7f('0x29')](_0x5c128e,{'showHidden':![],'depth':null}));if(_0x5c128e[_0x0b7f('0x8f')]){_0x16ae44=_0x5c128e[_0x0b7f('0x8f')]['substring'](0x0,_0x5c128e[_0x0b7f('0x8f')][_0x0b7f('0x91')]('-'));if(this[_0x0b7f('0xb')][_0x16ae44]){logger['info'](_0x0b7f('0x96'),_0x5c128e['uniqueid'],_0x16ae44);this[_0x0b7f('0xb')][_0x16ae44][_0x0b7f('0x93')]=![];}}}}catch(_0x19638d){logger[_0x0b7f('0x39')]('[%s][voiceAgentReport][musiconholdstop]',_0x5c128e[_0x0b7f('0x25')],util['inspect'](_0x19638d,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x720b=['isNil','syncHangup','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','transfereruniqueid','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','onhold','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','debug','uniqueid','inspect','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','membername','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','rejected','reason','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%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:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','memberinterface','memberlastcall','memberrealtime'];(function(_0x4d5a33,_0x1aee7f){var _0x1f5e52=function(_0x519d7b){while(--_0x519d7b){_0x4d5a33['push'](_0x4d5a33['shift']());}};_0x1f5e52(++_0x1aee7f);}(_0x720b,0x1d8));var _0xb720=function(_0x3e829d,_0x5135b6){_0x3e829d=_0x3e829d-0x0;var _0x3cef72=_0x720b[_0x3e829d];return _0x3cef72;};'use strict';var _=require(_0xb720('0x0'));var moment=require(_0xb720('0x1'));var util=require(_0xb720('0x2'));var Redis=require('ioredis');var config=require(_0xb720('0x3'));var logger=require(_0xb720('0x4'))('ami');var ami=require(_0xb720('0x5'));config[_0xb720('0x6')]=_[_0xb720('0x7')](config['redis'],{'host':_0xb720('0x8'),'port':0x18eb});var io=require(_0xb720('0x9'))(new Redis(config[_0xb720('0x6')]));function VoiceAgentReport(_0x19d0ba){this[_0xb720('0xa')]={};this['voiceChannels']=_0x19d0ba['channels'];this[_0xb720('0xb')]=_0x19d0ba[_0xb720('0xb')];this[_0xb720('0xc')]=_0x19d0ba[_0xb720('0xc')];this[_0xb720('0xd')]={};ami['on'](_0xb720('0xe'),this[_0xb720('0xf')][_0xb720('0x10')](this));ami['on']('agentconnect',this[_0xb720('0x11')][_0xb720('0x10')](this));ami['on']('agentringnoanswer',this[_0xb720('0x12')]['bind'](this));ami['on'](_0xb720('0x13'),this['syncQueueCallerAbandon'][_0xb720('0x10')](this));ami['on'](_0xb720('0x14'),this[_0xb720('0x15')][_0xb720('0x10')](this));ami['on'](_0xb720('0x16'),this[_0xb720('0x17')][_0xb720('0x10')](this));ami['on'](_0xb720('0x18'),this['syncHangup'][_0xb720('0x10')](this));ami['on'](_0xb720('0x19'),this[_0xb720('0x1a')]['bind'](this));ami['on']('musiconholdstop',this[_0xb720('0x1b')][_0xb720('0x10')](this));ami['on'](_0xb720('0x1c'),this['syncAttendedTransfer'][_0xb720('0x10')](this));ami['on'](_0xb720('0x1d'),this[_0xb720('0x1e')][_0xb720('0x10')](this));}VoiceAgentReport[_0xb720('0x1f')][_0xb720('0x20')]=function(_0x4203ce,_0x3206d3,_0x3d8fa4){io['to'](_0x4203ce)[_0xb720('0x20')](_0x3206d3,_0x3d8fa4);};VoiceAgentReport[_0xb720('0x1f')][_0xb720('0x21')]=function(_0xd3ec7a){return _0xd3ec7a!==null&&!_[_0xb720('0x22')](_0xd3ec7a);};VoiceAgentReport[_0xb720('0x1f')][_0xb720('0xf')]=function(_0x25acb4){try{if(this[_0xb720('0x21')](_0x25acb4)){logger[_0xb720('0x23')](_0xb720('0x24'),_0x25acb4['uniqueid'],_0x25acb4['membername'],_0x25acb4['destuniqueid']);logger[_0xb720('0x25')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x25acb4[_0xb720('0x26')],util[_0xb720('0x27')](_0x25acb4,{'showHidden':![],'depth':null}));if(_[_0xb720('0x22')](this[_0xb720('0xa')][_0x25acb4[_0xb720('0x26')]])){this[_0xb720('0xa')][_0x25acb4['uniqueid']]={};}if(_['isUndefined'](this['channels'][_0x25acb4[_0xb720('0x26')]][_0x25acb4[_0xb720('0x28')]])){this['channels'][_0x25acb4['uniqueid']][_0x25acb4[_0xb720('0x28')]]={'agentcalledAt':moment()['format'](_0xb720('0x29')),'lastevent':'called','mandatoryDisposition':this['voiceQueues'][_0x25acb4[_0xb720('0x2a')]]?this[_0xb720('0xb')][_0x25acb4[_0xb720('0x2a')]][_0xb720('0x2b')]||![]:![],'type':this[_0xb720('0xb')][_0x25acb4[_0xb720('0x2a')]]?this[_0xb720('0xb')][_0x25acb4[_0xb720('0x2a')]]['type']||'inbound':'inbound','variables':this[_0xb720('0xd')][_0x25acb4[_0xb720('0x26')]],'motionChannel':'voice'};}_[_0xb720('0x2c')](this['channels'][_0x25acb4[_0xb720('0x26')]][_0x25acb4[_0xb720('0x28')]],_[_0xb720('0x2d')](_0x25acb4,[_0xb720('0x2e'),_0xb720('0x2f')]));logger[_0xb720('0x25')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x25acb4[_0xb720('0x26')],util[_0xb720('0x27')](this[_0xb720('0xa')][_0x25acb4['uniqueid']][_0x25acb4[_0xb720('0x28')]],{'showHidden':![],'depth':null}));ami[_0xb720('0x20')]('custom:agentcalled',this['channels'][_0x25acb4[_0xb720('0x26')]][_0x25acb4['destuniqueid']]);logger[_0xb720('0x25')](_0xb720('0x30'),_0x25acb4[_0xb720('0x26')],util[_0xb720('0x27')](this['channels'][_0x25acb4['uniqueid']][_0x25acb4[_0xb720('0x28')]],{'showHidden':![],'depth':null}));this[_0xb720('0x20')](util[_0xb720('0x31')](_0xb720('0x32'),_0x25acb4[_0xb720('0x33')]),'user:called',this['channels'][_0x25acb4[_0xb720('0x26')]][_0x25acb4[_0xb720('0x28')]]);}}catch(_0x44f2ed){logger[_0xb720('0x34')](_0xb720('0x35'),_0x25acb4[_0xb720('0x26')],util[_0xb720('0x27')](_0x44f2ed,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb720('0x1f')][_0xb720('0x11')]=function(_0x4f25b1){try{if(this['isNotNull'](_0x4f25b1)){if(this[_0xb720('0xa')][_0x4f25b1[_0xb720('0x26')]]){logger[_0xb720('0x25')](_0xb720('0x36'),_0x4f25b1[_0xb720('0x26')],util[_0xb720('0x27')](_0x4f25b1,{'showHidden':![],'depth':null}));for(var _0x1e8bc2 in this[_0xb720('0xa')][_0x4f25b1[_0xb720('0x26')]]){if(this[_0xb720('0xa')][_0x4f25b1[_0xb720('0x26')]][_0xb720('0x37')](_0x1e8bc2)){if(_0x4f25b1[_0xb720('0x28')]===_0x1e8bc2){logger[_0xb720('0x23')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4f25b1[_0xb720('0x26')],_0x4f25b1[_0xb720('0x33')],_0x4f25b1[_0xb720('0x28')]);this[_0xb720('0xa')][_0x4f25b1[_0xb720('0x26')]][_0x1e8bc2][_0xb720('0x38')]=moment()[_0xb720('0x31')](_0xb720('0x29'));this[_0xb720('0xa')][_0x4f25b1[_0xb720('0x26')]][_0x1e8bc2][_0xb720('0x39')]=_0x4f25b1[_0xb720('0x39')];this[_0xb720('0xa')][_0x4f25b1['uniqueid']][_0x1e8bc2][_0xb720('0x3a')]=_0x4f25b1[_0xb720('0x3a')];this[_0xb720('0xa')][_0x4f25b1['uniqueid']][_0x1e8bc2][_0xb720('0x3b')]=_0x4f25b1['destchannelstate'];this['channels'][_0x4f25b1[_0xb720('0x26')]][_0x1e8bc2][_0xb720('0x3c')]=_0x4f25b1[_0xb720('0x3c')];this[_0xb720('0xa')][_0x4f25b1['uniqueid']][_0x1e8bc2][_0xb720('0x3d')]=_0x4f25b1[_0xb720('0x3d')];this['channels'][_0x4f25b1[_0xb720('0x26')]][_0x1e8bc2][_0xb720('0x3e')]=_0xb720('0x3f');if(this[_0xb720('0x40')][this[_0xb720('0xa')][_0x4f25b1[_0xb720('0x26')]][_0x1e8bc2][_0xb720('0x26')]]){var _0x45416d=this['voiceChannels'][this[_0xb720('0xa')][_0x4f25b1[_0xb720('0x26')]][_0x1e8bc2]['uniqueid']][_0xb720('0x41')];this['channels'][_0x4f25b1[_0xb720('0x26')]][_0x1e8bc2][_0xb720('0x41')]=_0x45416d;_0x4f25b1[_0xb720('0x41')]=_0x45416d;}_[_0xb720('0x2c')](this[_0xb720('0xc')][_0x4f25b1[_0xb720('0x42')]],_[_0xb720('0x43')](_0x4f25b1,['queue',_0xb720('0x44'),'routealias']));logger[_0xb720('0x25')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x4f25b1[_0xb720('0x26')],util[_0xb720('0x27')](this[_0xb720('0xa')][_0x4f25b1[_0xb720('0x26')]][_0x4f25b1[_0xb720('0x28')]],{'showHidden':![],'depth':null}));ami[_0xb720('0x20')](_0xb720('0x45'),this[_0xb720('0xa')][_0x4f25b1[_0xb720('0x26')]][_0x4f25b1['destuniqueid']]);logger['debug'](_0xb720('0x46'),_0x4f25b1[_0xb720('0x26')],util[_0xb720('0x27')](this[_0xb720('0xa')][_0x4f25b1['uniqueid']][_0x4f25b1[_0xb720('0x28')]],{'showHidden':![],'depth':null}));this[_0xb720('0x20')](util['format'](_0xb720('0x32'),_0x4f25b1[_0xb720('0x33')]),'user:agentconnect',this[_0xb720('0xa')][_0x4f25b1['uniqueid']][_0x4f25b1['destuniqueid']]);}else if(!this[_0xb720('0xa')][_0x4f25b1[_0xb720('0x26')]][_0x1e8bc2][_0xb720('0x47')]&&!this[_0xb720('0xa')][_0x4f25b1[_0xb720('0x26')]][_0x1e8bc2][_0xb720('0x14')]){logger[_0xb720('0x23')](_0xb720('0x48'),_0x4f25b1[_0xb720('0x26')],this[_0xb720('0xa')][_0x4f25b1[_0xb720('0x26')]][_0x1e8bc2][_0xb720('0x33')],_0x1e8bc2);this['channels'][_0x4f25b1[_0xb720('0x26')]][_0x1e8bc2][_0xb720('0x47')]=!![];this[_0xb720('0xa')][_0x4f25b1['uniqueid']][_0x1e8bc2]['agentringnoanswerAt']=moment()[_0xb720('0x31')](_0xb720('0x29'));this[_0xb720('0xa')][_0x4f25b1[_0xb720('0x26')]][_0x1e8bc2][_0xb720('0x49')]=_0x4f25b1['destuniqueid'];this['channels'][_0x4f25b1['uniqueid']][_0x1e8bc2][_0xb720('0x4a')]=_0x4f25b1['membername'];this[_0xb720('0xa')][_0x4f25b1['uniqueid']][_0x1e8bc2][_0xb720('0x3e')]=_0xb720('0x4b');this[_0xb720('0xa')][_0x4f25b1[_0xb720('0x26')]][_0x1e8bc2]['reason']=_0xb720('0x4b');logger[_0xb720('0x25')](_0xb720('0x4c'),_0x4f25b1[_0xb720('0x26')],util['inspect'](this['channels'][_0x4f25b1[_0xb720('0x26')]][_0x1e8bc2],{'showHidden':![],'depth':null}));ami[_0xb720('0x20')](_0xb720('0x4d'),this[_0xb720('0xa')][_0x4f25b1[_0xb720('0x26')]][_0x1e8bc2]);}}}}}}catch(_0x32eb55){logger[_0xb720('0x34')]('[%s][voiceAgentReport][agentconnect]',_0x4f25b1[_0xb720('0x26')],util[_0xb720('0x27')](_0x32eb55,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb720('0x1f')][_0xb720('0x12')]=function(_0x186b7c){try{if(this[_0xb720('0x21')](_0x186b7c)){logger[_0xb720('0x25')](_0xb720('0x4e'),_0x186b7c['uniqueid'],util[_0xb720('0x27')](_0x186b7c,{'showHidden':![],'depth':null}));if(this[_0xb720('0xa')][_0x186b7c[_0xb720('0x26')]]&&this[_0xb720('0xa')][_0x186b7c[_0xb720('0x26')]][_0x186b7c[_0xb720('0x28')]]){logger[_0xb720('0x23')](_0xb720('0x4f'),_0x186b7c[_0xb720('0x26')],_0x186b7c[_0xb720('0x33')],_0x186b7c['destuniqueid']);this['channels'][_0x186b7c[_0xb720('0x26')]][_0x186b7c['destuniqueid']][_0xb720('0x47')]=!![];this['channels'][_0x186b7c[_0xb720('0x26')]][_0x186b7c[_0xb720('0x28')]][_0xb720('0x50')]=moment()[_0xb720('0x31')](_0xb720('0x29'));this[_0xb720('0xa')][_0x186b7c['uniqueid']][_0x186b7c[_0xb720('0x28')]][_0xb720('0x3e')]=_0xb720('0x51');this[_0xb720('0xa')][_0x186b7c['uniqueid']][_0x186b7c[_0xb720('0x28')]][_0xb720('0x52')]='rejected';logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x186b7c['uniqueid'],util[_0xb720('0x27')](this['channels'][_0x186b7c[_0xb720('0x26')]][_0x186b7c[_0xb720('0x28')]],{'showHidden':![],'depth':null}));ami['emit'](_0xb720('0x53'),this[_0xb720('0xa')][_0x186b7c['uniqueid']][_0x186b7c['destuniqueid']]);}}}catch(_0x5c5c8a){logger[_0xb720('0x34')](_0xb720('0x54'),_0x186b7c[_0xb720('0x26')],util[_0xb720('0x27')](_0x5c5c8a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb720('0x1f')][_0xb720('0x55')]=function(_0x57c5a9){try{if(this[_0xb720('0x21')](_0x57c5a9)){logger[_0xb720('0x25')](_0xb720('0x56'),_0x57c5a9['uniqueid'],util[_0xb720('0x27')](_0x57c5a9,{'showHidden':![],'depth':null}));if(this[_0xb720('0xa')][_0x57c5a9[_0xb720('0x26')]]){for(var _0xad00f in this[_0xb720('0xa')][_0x57c5a9[_0xb720('0x26')]]){if(this[_0xb720('0xa')][_0x57c5a9[_0xb720('0x26')]]['hasOwnProperty'](_0xad00f)&&!this[_0xb720('0xa')][_0x57c5a9['uniqueid']][_0xad00f][_0xb720('0x47')]&&!this[_0xb720('0xa')][_0x57c5a9[_0xb720('0x26')]][_0xad00f]['agentcomplete']){logger['info'](_0xb720('0x57'),_0x57c5a9[_0xb720('0x26')],this[_0xb720('0xa')][_0x57c5a9[_0xb720('0x26')]][_0xad00f][_0xb720('0x33')],_0xad00f);this['channels'][_0x57c5a9[_0xb720('0x26')]][_0xad00f][_0xb720('0x47')]=!![];this[_0xb720('0xa')][_0x57c5a9[_0xb720('0x26')]][_0xad00f][_0xb720('0x50')]=moment()['format'](_0xb720('0x29'));this[_0xb720('0xa')][_0x57c5a9[_0xb720('0x26')]][_0xad00f]['lastevent']='abandoned';this[_0xb720('0xa')][_0x57c5a9['uniqueid']][_0xad00f][_0xb720('0x52')]=_0xb720('0x58');logger[_0xb720('0x25')](_0xb720('0x59'),_0x57c5a9[_0xb720('0x26')],util[_0xb720('0x27')](this[_0xb720('0xa')][_0x57c5a9[_0xb720('0x26')]][_0xad00f],{'showHidden':![],'depth':null}));ami[_0xb720('0x20')](_0xb720('0x5a'),this[_0xb720('0xa')][_0x57c5a9[_0xb720('0x26')]][_0xad00f]);}}}}}catch(_0x4a77ae){logger['error'](_0xb720('0x5b'),_0x57c5a9[_0xb720('0x26')],util[_0xb720('0x27')](_0x4a77ae,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb720('0x15')]=function(_0x395bc3){try{if(this[_0xb720('0x21')](_0x395bc3)){logger[_0xb720('0x25')](_0xb720('0x5c'),_0x395bc3[_0xb720('0x26')],util[_0xb720('0x27')](_0x395bc3,{'showHidden':![],'depth':null}));if(this['channels'][_0x395bc3['uniqueid']]){for(var _0x12ce63 in this[_0xb720('0xa')][_0x395bc3[_0xb720('0x26')]]){if(this['channels'][_0x395bc3['uniqueid']][_0xb720('0x37')](_0x12ce63)){if(this['channels'][_0x395bc3[_0xb720('0x26')]][_0x12ce63][_0xb720('0x38')]&&!this[_0xb720('0xa')][_0x395bc3[_0xb720('0x26')]][_0x12ce63][_0xb720('0x14')]){logger[_0xb720('0x23')](_0xb720('0x5d'),_0x395bc3[_0xb720('0x26')],this['channels'][_0x395bc3[_0xb720('0x26')]][_0x12ce63][_0xb720('0x33')],_0x12ce63);this['channels'][_0x395bc3[_0xb720('0x26')]][_0x12ce63]['agentcomplete']=!![];this['channels'][_0x395bc3['uniqueid']][_0x12ce63][_0xb720('0x5e')]=moment()[_0xb720('0x31')](_0xb720('0x29'));this[_0xb720('0xa')][_0x395bc3['uniqueid']][_0x12ce63][_0xb720('0x3e')]=_0xb720('0x5f');this['channels'][_0x395bc3['uniqueid']][_0x12ce63][_0xb720('0x52')]=_0x395bc3['reason']==_0xb720('0x60')?_0xb720('0x61'):_0x395bc3[_0xb720('0x52')];this[_0xb720('0xa')][_0x395bc3[_0xb720('0x26')]][_0x12ce63][_0xb720('0x62')]=_0x395bc3[_0xb720('0x62')];if(this[_0xb720('0xb')][_0x395bc3['queue']]&&this[_0xb720('0xb')][_0x395bc3[_0xb720('0x2a')]][_0xb720('0x63')]){this[_0xb720('0xa')][_0x395bc3[_0xb720('0x26')]][_0x12ce63][_0xb720('0x64')]=this[_0xb720('0xb')][_0x395bc3[_0xb720('0x2a')]]['acwTimeout'];this[_0xb720('0xa')][_0x395bc3[_0xb720('0x26')]][_0x12ce63][_0xb720('0x65')]=!![];}this[_0xb720('0xc')][_0x395bc3[_0xb720('0x42')]]=_[_0xb720('0x2d')](this[_0xb720('0xc')][_0x395bc3[_0xb720('0x42')]],[_0xb720('0x2a'),'destconnectedlinenum']);logger[_0xb720('0x25')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x395bc3[_0xb720('0x26')],util[_0xb720('0x27')](this['channels'][_0x395bc3['uniqueid']][_0x12ce63],{'showHidden':![],'depth':null}));ami[_0xb720('0x20')](_0xb720('0x66'),this[_0xb720('0xa')][_0x395bc3[_0xb720('0x26')]][_0x12ce63]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x395bc3[_0xb720('0x26')],util[_0xb720('0x27')](this[_0xb720('0xa')][_0x395bc3[_0xb720('0x26')]][_0x12ce63],{'showHidden':![],'depth':null}));this[_0xb720('0x20')](util[_0xb720('0x31')]('user:%s',_0x395bc3[_0xb720('0x33')]),'user:agentcomplete',this['channels'][_0x395bc3[_0xb720('0x26')]][_0x12ce63]);}}}}}}catch(_0x4df3a9){logger['error'](_0xb720('0x67'),_0x395bc3['uniqueid'],util['inspect'](_0x4df3a9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb720('0x1f')][_0xb720('0x17')]=function(_0x719d77){try{if(this['isNotNull'](_0x719d77)){logger['debug'](_0xb720('0x68'),_0x719d77[_0xb720('0x26')],util[_0xb720('0x27')](_0x719d77,{'showHidden':![],'depth':null}));this[_0xb720('0x69')](_0x719d77[_0xb720('0x26')],_[_0xb720('0x6a')](_0x719d77[_0xb720('0x6b')])[0x0],_0x719d77['value']);if(this[_0xb720('0xa')][_0x719d77[_0xb720('0x26')]]){for(var _0x511672 in this[_0xb720('0xa')][_0x719d77['uniqueid']]){if(this[_0xb720('0xa')][_0x719d77['uniqueid']]['hasOwnProperty'](_0x511672)){logger[_0xb720('0x23')](_0xb720('0x6c'),_0x719d77[_0xb720('0x26')],_0x511672,_[_0xb720('0x6a')](_0x719d77[_0xb720('0x6b')])[0x0],_0x719d77[_0xb720('0x6d')]);if(_[_0xb720('0x22')](this[_0xb720('0xa')][_0x719d77[_0xb720('0x26')]][_0x511672][_0xb720('0xd')])){this[_0xb720('0xa')][_0x719d77['uniqueid']][_0x511672][_0xb720('0xd')]={};}this['channels'][_0x719d77['uniqueid']][_0x511672]['variables']=this[_0xb720('0xd')][_0x719d77[_0xb720('0x26')]];}}}}}catch(_0x3320ac){logger['error'](_0xb720('0x6e'),_0x719d77['uniqueid'],util[_0xb720('0x27')](_0x3320ac,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb720('0x1f')][_0xb720('0x69')]=function(_0x394ea1,_0x3af899,_0x308f34){var _0x1af5c0=[_0xb720('0x6f'),_0xb720('0x70'),_0xb720('0x71'),_0xb720('0x72'),_0xb720('0x73'),_0xb720('0x74'),_0xb720('0x75'),_0xb720('0x76'),_0xb720('0x77'),_0xb720('0x78'),'bridgepeer','bridgepvtcallid','membercalls','memberdynamic',_0xb720('0x79'),_0xb720('0x7a'),_0xb720('0x33'),'memberpenalty',_0xb720('0x7b')];if(!_[_0xb720('0x7c')](_0x3af899)&&!_['includes'](_0x1af5c0,_0x3af899)){if(_['isUndefined'](this[_0xb720('0xd')][_0x394ea1])){this[_0xb720('0xd')][_0x394ea1]={};}this['variables'][_0x394ea1][_0x3af899]=_0x308f34;}};VoiceAgentReport[_0xb720('0x1f')][_0xb720('0x7d')]=function(_0x227d92){try{if(this[_0xb720('0x21')](_0x227d92)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x227d92[_0xb720('0x26')],util['inspect'](_0x227d92,{'showHidden':![],'depth':null}));if(this[_0xb720('0xa')][_0x227d92[_0xb720('0x26')]]){for(var _0x561d1d in this[_0xb720('0xa')][_0x227d92[_0xb720('0x26')]]){if(this[_0xb720('0xa')][_0x227d92[_0xb720('0x26')]]['hasOwnProperty'](_0x561d1d)){if(this['channels'][_0x227d92['uniqueid']][_0x561d1d]['reason']==_0xb720('0x60')&&this[_0xb720('0xa')][_0x227d92[_0xb720('0x26')]][_0x561d1d][_0xb720('0x14')]){logger['info'](_0xb720('0x7e'),_0x227d92[_0xb720('0x26')],_0x561d1d);this['channels'][_0x227d92[_0xb720('0x26')]][_0x561d1d][_0xb720('0x5e')]=moment()[_0xb720('0x31')](_0xb720('0x29'));}}}logger[_0xb720('0x25')](_0xb720('0x7f'),_0x227d92[_0xb720('0x26')],util[_0xb720('0x27')](_[_0xb720('0x80')](this[_0xb720('0xa')][_0x227d92[_0xb720('0x26')]]),{'showHidden':![],'depth':null}));ami[_0xb720('0x20')](_0xb720('0x81'),_[_0xb720('0x80')](this[_0xb720('0xa')][_0x227d92['uniqueid']]));delete this['channels'][_0x227d92['uniqueid']];}if(this[_0xb720('0xd')][_0x227d92[_0xb720('0x26')]]){delete this[_0xb720('0xd')][_0x227d92[_0xb720('0x26')]];}}}catch(_0x1f0c2e){logger[_0xb720('0x34')](_0xb720('0x82'),_0x227d92['uniqueid'],util[_0xb720('0x27')](_0x1f0c2e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb720('0x1f')][_0xb720('0x83')]=function(_0x3b72a){try{if(this[_0xb720('0x21')](_0x3b72a)){logger[_0xb720('0x25')](_0xb720('0x84'),_0x3b72a['uniqueid'],util['inspect'](_0x3b72a,{'showHidden':![],'depth':null}));if(this[_0xb720('0xa')][_0x3b72a[_0xb720('0x85')]]){for(var _0x5a1d7a in this[_0xb720('0xa')][_0x3b72a[_0xb720('0x85')]]){if(this[_0xb720('0xa')][_0x3b72a['transfereeuniqueid']][_0xb720('0x37')](_0x5a1d7a)){if(_0x3b72a['origtransfereruniqueid']===_0x5a1d7a){logger[_0xb720('0x23')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3b72a[_0xb720('0x26')],this[_0xb720('0xa')][_0x3b72a[_0xb720('0x85')]][_0x5a1d7a][_0xb720('0x33')],_0x5a1d7a);var _0x1956aa=moment();this[_0xb720('0xa')][_0x3b72a['transfereeuniqueid']][_0x5a1d7a][_0xb720('0x14')]=!![];this['channels'][_0x3b72a['transfereeuniqueid']][_0x5a1d7a][_0xb720('0x5e')]=moment()[_0xb720('0x31')](_0xb720('0x29'));this[_0xb720('0xa')][_0x3b72a['transfereeuniqueid']][_0x5a1d7a][_0xb720('0x3e')]=_0xb720('0x5f');this['channels'][_0x3b72a['transfereeuniqueid']][_0x5a1d7a]['reason']=_0xb720('0x60');this[_0xb720('0xa')][_0x3b72a[_0xb720('0x85')]][_0x5a1d7a]['talktime']=_0x1956aa[_0xb720('0x86')](this[_0xb720('0xa')][_0x3b72a[_0xb720('0x85')]][_0x5a1d7a][_0xb720('0x38')],_0xb720('0x87'));}}}}if(this[_0xb720('0xa')][_0x3b72a[_0xb720('0x88')]]){var _0x418375=this[_0xb720('0xa')][_0x3b72a[_0xb720('0x88')]];this[_0xb720('0xa')][_0x3b72a[_0xb720('0x88')]]=this[_0xb720('0xa')][_0x3b72a[_0xb720('0x85')]];this[_0xb720('0xa')][_0x3b72a['transfereeuniqueid']]=_0x418375;}}}catch(_0x33ef73){logger['error'](_0xb720('0x89'),_0x3b72a[_0xb720('0x26')],util[_0xb720('0x27')](_0x33ef73,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb720('0x1f')][_0xb720('0x1e')]=function(_0x1209de){try{if(this[_0xb720('0x21')](_0x1209de)){logger[_0xb720('0x25')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x1209de[_0xb720('0x26')],util[_0xb720('0x27')](_0x1209de,{'showHidden':![],'depth':null}));if(this['channels'][_0x1209de['transfereeuniqueid']]){for(var _0x4a6505 in this[_0xb720('0xa')][_0x1209de[_0xb720('0x85')]]){if(this['channels'][_0x1209de[_0xb720('0x85')]][_0xb720('0x37')](_0x4a6505)){if(_0x1209de[_0xb720('0x8a')]===_0x4a6505){logger[_0xb720('0x23')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x1209de[_0xb720('0x26')],this['channels'][_0x1209de['transfereeuniqueid']][_0x4a6505]['membername'],_0x4a6505);var _0x35ccfd=moment();this[_0xb720('0xa')][_0x1209de[_0xb720('0x85')]][_0x4a6505][_0xb720('0x14')]=!![];this[_0xb720('0xa')][_0x1209de[_0xb720('0x85')]][_0x4a6505][_0xb720('0x5e')]=_0x35ccfd;this[_0xb720('0xa')][_0x1209de['transfereeuniqueid']][_0x4a6505]['lastevent']=_0xb720('0x5f');this['channels'][_0x1209de[_0xb720('0x85')]][_0x4a6505][_0xb720('0x52')]=_0xb720('0x60');this[_0xb720('0xa')][_0x1209de[_0xb720('0x85')]][_0x4a6505][_0xb720('0x62')]=_0x35ccfd[_0xb720('0x86')](this[_0xb720('0xa')][_0x1209de[_0xb720('0x85')]][_0x4a6505][_0xb720('0x38')],_0xb720('0x87'));}}}}}}catch(_0xda2587){logger[_0xb720('0x34')]('[%s][voiceAgentReport][blindtransfer]',_0x1209de[_0xb720('0x26')],util[_0xb720('0x27')](_0xda2587,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb720('0x1f')]['syncMusicOnHoldStart']=function(_0x10ccbc){var _0x2e1732='';try{if(this[_0xb720('0x21')](_0x10ccbc)){logger[_0xb720('0x25')](_0xb720('0x8b'),_0x10ccbc[_0xb720('0x26')],util[_0xb720('0x27')](_0x10ccbc,{'showHidden':![],'depth':null}));if(_0x10ccbc['channel']){_0x2e1732=_0x10ccbc[_0xb720('0x8c')][_0xb720('0x8d')](0x0,_0x10ccbc['channel'][_0xb720('0x8e')]('-'));if(this[_0xb720('0xc')][_0x2e1732]){logger['info'](_0xb720('0x8f'),_0x10ccbc[_0xb720('0x26')],_0x2e1732);this[_0xb720('0xc')][_0x2e1732]['onhold']=!![];}}}}catch(_0x2f1475){logger[_0xb720('0x34')](_0xb720('0x90'),_0x10ccbc[_0xb720('0x26')],util[_0xb720('0x27')](_0x2f1475,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb720('0x1b')]=function(_0x30d580){var _0x510783='';try{if(this['isNotNull'](_0x30d580)){logger[_0xb720('0x25')](_0xb720('0x91'),_0x30d580[_0xb720('0x26')],util['inspect'](_0x30d580,{'showHidden':![],'depth':null}));if(_0x30d580[_0xb720('0x8c')]){_0x510783=_0x30d580['channel'][_0xb720('0x8d')](0x0,_0x30d580[_0xb720('0x8c')]['lastIndexOf']('-'));if(this[_0xb720('0xc')][_0x510783]){logger['info']('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x30d580['uniqueid'],_0x510783);this['agents'][_0x510783][_0xb720('0x92')]=![];}}}}catch(_0x44fbfb){logger[_0xb720('0x34')](_0xb720('0x93'),_0x30d580['uniqueid'],util[_0xb720('0x27')](_0x44fbfb,{'showHidden':![],'depth':null}));}};module[_0xb720('0x94')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index dc09307..9e063c4 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 _0xfd30=['destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','endtime','billableseconds','answertime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','undefined','isEmpty','monitors','getSettings','stopRecordingOnTransfer','Action','catch','StopMixMonitor','finally','event','BlindTransfer','blindTransfers','outbound','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','routeid','ATTENDED','origtransfererlinkedid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND','transfererchannel','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','isNil','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','moment','util','path','../../../config/environment','ami','../ami','../rpc/setting','unknown','invalid','unavailable','ringinuse','onhold','queue','agi','dial','playback','NO\x20ANSWER','FAILED','BUSY','defaults','redis','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','[voiceCallReport][coreshowchannels]','inspect','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','from-sip','channel','split','exten','destconnectedlinenum','format','name','connectedlinenum','prototype','debug','[%s][voiceCallReport][newchannel]\x20event:','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','disposition','toNumber','channelstate','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','[%s][voiceCallReport][newexten]\x20event:','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','lastapplication','set','startsWith','match','error','[%s][voiceCallReport][newexten]','calleridname','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','diff','starttime','calleridnum','destinationchannel','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','.wav49','replace','find','push','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s'];(function(_0x53f0db,_0x35c67c){var _0xae0a5c=function(_0x4bd6fb){while(--_0x4bd6fb){_0x53f0db['push'](_0x53f0db['shift']());}};_0xae0a5c(++_0x35c67c);}(_0xfd30,0xff));var _0x0fd3=function(_0x460f4f,_0x5d6395){_0x460f4f=_0x460f4f-0x0;var _0x25360e=_0xfd30[_0x460f4f];return _0x25360e;};'use strict';var BPromise=require(_0x0fd3('0x0'));var _=require('lodash');var moment=require(_0x0fd3('0x1'));var util=require(_0x0fd3('0x2'));var path=require(_0x0fd3('0x3'));var Redis=require('ioredis');var config=require(_0x0fd3('0x4'));var logger=require('../../../config/logger')(_0x0fd3('0x5'));var ami=require(_0x0fd3('0x6'));var Channel=require('../model/channel');var RpcSetting=require(_0x0fd3('0x7'));var statusDesc=[_0x0fd3('0x8'),'not_inuse','inuse','busy',_0x0fd3('0x9'),_0x0fd3('0xa'),'ringing',_0x0fd3('0xb'),_0x0fd3('0xc')];var applications=['set',_0x0fd3('0xd'),_0x0fd3('0xe'),_0x0fd3('0xf'),_0x0fd3('0x10'),'voicemail'];var dispositions=[_0x0fd3('0x11'),_0x0fd3('0x12'),'FAILED',_0x0fd3('0x11'),_0x0fd3('0x11'),'NO\x20ANSWER','ANSWERED',_0x0fd3('0x13'),_0x0fd3('0x12'),_0x0fd3('0x12'),'FAILED'];var actions={};config['redis']=_[_0x0fd3('0x14')](config[_0x0fd3('0x15')],{'host':'localhost','port':0x18eb});var io=require(_0x0fd3('0x16'))(new Redis(config[_0x0fd3('0x15')]));function VoiceCallReport(_0x1d162a){this[_0x0fd3('0x17')]=_0x1d162a['channels'];this[_0x0fd3('0x18')]=_0x1d162a['agents'];this['blindTransfers']={};ami['on'](_0x0fd3('0x19'),this[_0x0fd3('0x1a')][_0x0fd3('0x1b')](this));ami['on'](_0x0fd3('0x1c'),this[_0x0fd3('0x1a')]['bind'](this));ami['on'](_0x0fd3('0x1d'),this[_0x0fd3('0x1e')][_0x0fd3('0x1b')](this));ami['on'](_0x0fd3('0x1f'),this[_0x0fd3('0x20')][_0x0fd3('0x1b')](this));ami['on'](_0x0fd3('0x21'),this[_0x0fd3('0x22')][_0x0fd3('0x1b')](this));ami['on']('hangup',this[_0x0fd3('0x23')][_0x0fd3('0x1b')](this));ami['on'](_0x0fd3('0x24'),this[_0x0fd3('0x25')][_0x0fd3('0x1b')](this));ami['on'](_0x0fd3('0x26'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this[_0x0fd3('0x27')]['bind'](this));ami['on'](_0x0fd3('0x28'),this[_0x0fd3('0x29')][_0x0fd3('0x1b')](this));ami['on'](_0x0fd3('0x2a'),this[_0x0fd3('0x2b')][_0x0fd3('0x1b')](this));try{logger[_0x0fd3('0x2c')](_0x0fd3('0x2d'));ami['actionCoreShowChannels']();}catch(_0x5d971a){logger['error'](_0x0fd3('0x2e'),util[_0x0fd3('0x2f')](_0x5d971a,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x1e7932){return _0x1e7932!==null&&!_[_0x0fd3('0x30')](_0x1e7932);};VoiceCallReport['prototype'][_0x0fd3('0x31')]=function(_0x387d55,_0x536bb6,_0x349d8f){io['to'](_0x387d55)[_0x0fd3('0x31')](_0x536bb6,_0x349d8f);};VoiceCallReport['prototype'][_0x0fd3('0x25')]=function(_0x2edf67){try{if(this[_0x0fd3('0x32')](_0x2edf67)){logger[_0x0fd3('0x2c')](_0x0fd3('0x33'),_0x2edf67[_0x0fd3('0x34')],_0x2edf67['calleridname'],_0x2edf67['calleridnum']);logger['debug'](_0x0fd3('0x35'),_0x2edf67['uniqueid'],util['inspect'](_0x2edf67,{'showHidden':![],'depth':null}));if(_0x2edf67['uniqueid']===_0x2edf67[_0x0fd3('0x36')]){if(!_[_0x0fd3('0x30')](this[_0x0fd3('0x17')][_0x2edf67[_0x0fd3('0x34')]])){_[_0x0fd3('0x37')](this[_0x0fd3('0x17')][_0x2edf67[_0x0fd3('0x34')]],_[_0x0fd3('0x38')](_0x2edf67,_[_0x0fd3('0x39')](this['channels'][_0x2edf67['uniqueid']])));}}if(_0x2edf67['context']===_0x0fd3('0x3a')){if(this[_0x0fd3('0x18')][_0x2edf67[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]]){if(_0x2edf67[_0x0fd3('0x3d')]=='xcally-motion-preview'){this[_0x0fd3('0x18')][_0x2edf67[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]][_0x0fd3('0x3e')]=_0x2edf67['connectedlinenum'];this[_0x0fd3('0x31')](util[_0x0fd3('0x3f')]('user:%s',this[_0x0fd3('0x18')][_0x2edf67[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]][_0x0fd3('0x40')]),'user:agentconnect',{'destaccountcode':this[_0x0fd3('0x18')][_0x2edf67['channel']['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2edf67[_0x0fd3('0x41')]});}}}}}catch(_0x3946c6){logger['error']('[%s][voiceCallReport][newcallerid]',_0x2edf67['uniqueid'],util['inspect'](_0x3946c6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0fd3('0x42')][_0x0fd3('0x1e')]=function(_0xee61ba){try{if(this[_0x0fd3('0x32')](_0xee61ba)){logger[_0x0fd3('0x43')](_0x0fd3('0x44'),_0xee61ba['uniqueid'],util[_0x0fd3('0x2f')](_0xee61ba,{'showHidden':![],'depth':null}));if(_0xee61ba[_0x0fd3('0x34')]===_0xee61ba[_0x0fd3('0x36')]&&_0xee61ba[_0x0fd3('0x3b')]!='OutgoingSpoolFailed'){if(_['isUndefined'](this[_0x0fd3('0x17')][_0xee61ba['uniqueid']])){logger['info'](_0x0fd3('0x45'),_0xee61ba[_0x0fd3('0x34')],_0xee61ba[_0x0fd3('0x46')],_0xee61ba[_0x0fd3('0x3d')]);this[_0x0fd3('0x17')][_0xee61ba[_0x0fd3('0x34')]]=new Channel();this[_0x0fd3('0x17')][_0xee61ba[_0x0fd3('0x34')]]['starttime']=moment()[_0x0fd3('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xee61ba[_0x0fd3('0x34')]][_0x0fd3('0x47')]=dispositions[_[_0x0fd3('0x48')](_0xee61ba[_0x0fd3('0x49')])];_[_0x0fd3('0x37')](this[_0x0fd3('0x17')][_0xee61ba['uniqueid']],_[_0x0fd3('0x38')](_0xee61ba,_[_0x0fd3('0x39')](this[_0x0fd3('0x17')][_0xee61ba['uniqueid']])));if(_0xee61ba[_0x0fd3('0x46')]===_0x0fd3('0x3a')){if(this[_0x0fd3('0x18')][_0xee61ba[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]]){if(_[_0x0fd3('0x30')](this[_0x0fd3('0x18')][_0xee61ba[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]][_0x0fd3('0x3e')])){this[_0x0fd3('0x18')][_0xee61ba[_0x0fd3('0x3b')]['split']('-')[0x0]][_0x0fd3('0x3e')]=_0xee61ba['exten'];logger[_0x0fd3('0x43')](_0x0fd3('0x4a'),_0xee61ba[_0x0fd3('0x34')],util[_0x0fd3('0x2f')]({'destaccountcode':this[_0x0fd3('0x18')][_0xee61ba[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]][_0x0fd3('0x4b')],'destconnectedlinenum':_0xee61ba[_0x0fd3('0x3d')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x0fd3('0x3f')](_0x0fd3('0x4c'),this[_0x0fd3('0x18')][_0xee61ba[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]][_0x0fd3('0x40')]),'user:agentconnect',{'destaccountcode':this['agents'][_0xee61ba['channel'][_0x0fd3('0x3c')]('-')[0x0]][_0x0fd3('0x4b')],'destconnectedlinenum':_0xee61ba[_0x0fd3('0x3d')]});}}}}}}}catch(_0xa49499){logger['error']('[%s][voiceCallReport][newchannel]',_0xee61ba['uniqueid'],util[_0x0fd3('0x2f')](_0xa49499,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0fd3('0x42')][_0x0fd3('0x1a')]=function(_0x208b68){try{if(this[_0x0fd3('0x32')](_0x208b68)){logger[_0x0fd3('0x43')](_0x0fd3('0x4d'),_0x208b68[_0x0fd3('0x34')],util[_0x0fd3('0x2f')](_0x208b68,{'showHidden':![],'depth':null}));if(_0x208b68['uniqueid']===_0x208b68['linkedid']&&_0x208b68[_0x0fd3('0x3d')]!='h'&&_0x208b68[_0x0fd3('0x3b')]!=_0x0fd3('0x4e')){_0x208b68[_0x0fd3('0x4f')]=_0x208b68[_0x0fd3('0x4f')][_0x0fd3('0x50')]();_0x208b68[_0x0fd3('0x51')]=_0x208b68[_0x0fd3('0x52')]&&_0x208b68[_0x0fd3('0x52')]['startsWith'](_0x0fd3('0x53'))?_0x208b68['appdata']:(_0x208b68[_0x0fd3('0x52')]||_0x208b68[_0x0fd3('0x51')])[_0x0fd3('0x50')]();logger[_0x0fd3('0x2c')](_0x0fd3('0x54'),_0x208b68[_0x0fd3('0x34')],_0x208b68[_0x0fd3('0x4f')],_0x208b68[_0x0fd3('0x51')]);if(_['isUndefined'](this[_0x0fd3('0x17')][_0x208b68[_0x0fd3('0x34')]])){this[_0x0fd3('0x17')][_0x208b68[_0x0fd3('0x34')]]=new Channel();this[_0x0fd3('0x17')][_0x208b68[_0x0fd3('0x34')]]['starttime']=_0x208b68['duration']?moment()[_0x0fd3('0x55')](moment[_0x0fd3('0x56')](_0x208b68[_0x0fd3('0x56')])[_0x0fd3('0x57')](),_0x0fd3('0x57'))['format'](_0x0fd3('0x58')):moment()[_0x0fd3('0x3f')](_0x0fd3('0x58'));this[_0x0fd3('0x17')][_0x208b68[_0x0fd3('0x34')]][_0x0fd3('0x47')]='NO\x20ANSWER';}_[_0x0fd3('0x37')](this[_0x0fd3('0x17')][_0x208b68[_0x0fd3('0x34')]],_['pick'](_0x208b68,_[_0x0fd3('0x39')](this[_0x0fd3('0x17')][_0x208b68[_0x0fd3('0x34')]])));if(_['includes'](applications,_0x208b68[_0x0fd3('0x4f')])){this[_0x0fd3('0x17')][_0x208b68[_0x0fd3('0x34')]][_0x0fd3('0x59')]=_0x208b68[_0x0fd3('0x4f')];this['channels'][_0x208b68[_0x0fd3('0x34')]]['lastdata']=_0x208b68[_0x0fd3('0x51')];if(_0x208b68[_0x0fd3('0x4f')]===_0x0fd3('0x5a')&&_[_0x0fd3('0x5b')](_0x208b68['applicationdata'][_0x0fd3('0x50')](),'cdr(')){var _0x5a4728=_0x208b68[_0x0fd3('0x51')]['split']('=');var _0x3c073f=_0x5a4728[0x0][_0x0fd3('0x50')]()[_0x0fd3('0x5c')](/cdr\((.*)\)/);if(_0x3c073f){this[_0x0fd3('0x17')][_0x208b68[_0x0fd3('0x34')]][_0x3c073f[0x1]]=_0x5a4728[0x1];}}else if(_0x208b68['application']===_0x0fd3('0xd')){this[_0x0fd3('0x17')][_0x208b68[_0x0fd3('0x34')]][_0x0fd3('0xd')]=_0x208b68[_0x0fd3('0x51')]['split'](',')[0x0];}}}}}catch(_0x2e2d7c){logger[_0x0fd3('0x5d')](_0x0fd3('0x5e'),_0x208b68['uniqueid'],util[_0x0fd3('0x2f')](_0x2e2d7c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0fd3('0x42')][_0x0fd3('0x20')]=function(_0x33a78b){try{if(this[_0x0fd3('0x32')](_0x33a78b)){logger[_0x0fd3('0x2c')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x33a78b[_0x0fd3('0x34')],_0x33a78b[_0x0fd3('0x36')],_0x33a78b[_0x0fd3('0x5f')],_0x33a78b['calleridnum']);logger['debug'](_0x0fd3('0x60'),_0x33a78b[_0x0fd3('0x34')],util[_0x0fd3('0x2f')](_0x33a78b,{'showHidden':![],'depth':null}));if(_0x33a78b[_0x0fd3('0x34')]!==_0x33a78b[_0x0fd3('0x36')]){if(this[_0x0fd3('0x17')][_0x33a78b[_0x0fd3('0x36')]]){if(_0x33a78b['channelstate']==='6'){if(!this[_0x0fd3('0x17')][_0x33a78b['linkedid']][_0x0fd3('0x61')]){var _0x7625de=moment();this[_0x0fd3('0x17')][_0x33a78b['linkedid']][_0x0fd3('0x61')]=!![];this[_0x0fd3('0x17')][_0x33a78b[_0x0fd3('0x36')]]['answertime']=_0x7625de[_0x0fd3('0x3f')](_0x0fd3('0x58'));if(this[_0x0fd3('0x17')][_0x33a78b[_0x0fd3('0x36')]]['starttime']){this[_0x0fd3('0x17')][_0x33a78b['linkedid']][_0x0fd3('0x62')]=_0x7625de[_0x0fd3('0x63')](this['channels'][_0x33a78b[_0x0fd3('0x36')]][_0x0fd3('0x64')],'seconds');}}this[_0x0fd3('0x17')][_0x33a78b[_0x0fd3('0x36')]]['linkedid']=_0x33a78b[_0x0fd3('0x34')];if(_0x33a78b['calleridnum']!=='xcally-motion-preview'){this[_0x0fd3('0x17')][_0x33a78b[_0x0fd3('0x36')]][_0x0fd3('0x41')]=_0x33a78b[_0x0fd3('0x65')];}this['channels'][_0x33a78b[_0x0fd3('0x36')]]['connectedlinename']=_0x33a78b[_0x0fd3('0x5f')];this['channels'][_0x33a78b[_0x0fd3('0x36')]][_0x0fd3('0x66')]=_0x33a78b[_0x0fd3('0x3b')];this[_0x0fd3('0x17')][_0x33a78b['linkedid']][_0x0fd3('0x47')]=dispositions[_[_0x0fd3('0x48')](_0x33a78b[_0x0fd3('0x49')])];if(this[_0x0fd3('0x18')][_0x33a78b[_0x0fd3('0x3b')]['split']('-')[0x0]]){this[_0x0fd3('0x17')][_0x33a78b[_0x0fd3('0x36')]][_0x0fd3('0x67')]=this[_0x0fd3('0x18')][_0x33a78b[_0x0fd3('0x3b')]['split']('-')[0x0]]['id'];this[_0x0fd3('0x17')][_0x33a78b['linkedid']]['membername']=this[_0x0fd3('0x18')][_0x33a78b[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]][_0x0fd3('0x40')];}}}}else{if(this[_0x0fd3('0x17')][_0x33a78b['uniqueid']]){if(_0x33a78b[_0x0fd3('0x49')]==='6'){if(this[_0x0fd3('0x18')][_0x33a78b[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]]){this[_0x0fd3('0x17')][_0x33a78b['uniqueid']][_0x0fd3('0x67')]=this[_0x0fd3('0x18')][_0x33a78b[_0x0fd3('0x3b')]['split']('-')[0x0]]['id'];this[_0x0fd3('0x17')][_0x33a78b[_0x0fd3('0x34')]][_0x0fd3('0x68')]=this[_0x0fd3('0x18')][_0x33a78b['channel'][_0x0fd3('0x3c')]('-')[0x0]]['name'];}}}}if(_0x33a78b[_0x0fd3('0x49')]==='6'&&_0x33a78b[_0x0fd3('0x46')]===_0x0fd3('0x3a')){if(this[_0x0fd3('0x18')][_0x33a78b[_0x0fd3('0x3b')]['split']('-')[0x0]]){this[_0x0fd3('0x18')][_0x33a78b[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]][_0x0fd3('0x3e')]=_0x33a78b[_0x0fd3('0x3d')];var _0x37e63d;if(this[_0x0fd3('0x17')][_0x33a78b[_0x0fd3('0x34')]])_0x37e63d=this[_0x0fd3('0x17')][_0x33a78b[_0x0fd3('0x34')]][_0x0fd3('0x69')];else if(this[_0x0fd3('0x17')][_0x33a78b[_0x0fd3('0x36')]])_0x37e63d=this[_0x0fd3('0x17')][_0x33a78b['linkedid']][_0x0fd3('0x69')];logger[_0x0fd3('0x43')](_0x0fd3('0x6a'),_0x33a78b[_0x0fd3('0x34')],util[_0x0fd3('0x2f')]({'destaccountcode':this[_0x0fd3('0x18')][_0x33a78b[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]][_0x0fd3('0x4b')],'destconnectedlinenum':_0x33a78b[_0x0fd3('0x3d')],'routealias':_0x37e63d},{'showHidden':![],'depth':null}));this[_0x0fd3('0x31')](util[_0x0fd3('0x3f')](_0x0fd3('0x4c'),this[_0x0fd3('0x18')][_0x33a78b[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]][_0x0fd3('0x40')]),_0x0fd3('0x6b'),{'destaccountcode':this[_0x0fd3('0x18')][_0x33a78b[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]][_0x0fd3('0x4b')],'destconnectedlinenum':_0x33a78b[_0x0fd3('0x3d')],'routealias':_0x37e63d});}}}}catch(_0x37d34f){logger['error'](_0x0fd3('0x6c'),_0x33a78b[_0x0fd3('0x34')],util[_0x0fd3('0x2f')](_0x37d34f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0fd3('0x42')][_0x0fd3('0x6d')]=function(_0x2dcaf7,_0x584d18){try{if(this[_0x0fd3('0x17')][_0x2dcaf7]){logger[_0x0fd3('0x2c')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x2dcaf7,_0x584d18);this[_0x0fd3('0x17')][_0x2dcaf7]['monitor']=!![];if(_['endsWith'](_0x584d18,_0x0fd3('0x6e'))){_0x584d18=_0x584d18[_0x0fd3('0x6f')](_0x0fd3('0x6e'),'.WAV');}this[_0x0fd3('0x17')][_0x2dcaf7]['monitorFilename']=_0x584d18;var _0x58c180=_[_0x0fd3('0x70')](this[_0x0fd3('0x17')][_0x2dcaf7]['monitors'],{'filename':_0x584d18});if(_['isNil'](_0x58c180)){this[_0x0fd3('0x17')][_0x2dcaf7]['monitors'][_0x0fd3('0x71')]({'filename':_0x584d18,'createdAt':moment()[_0x0fd3('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}}catch(_0x5f3258){logger[_0x0fd3('0x5d')]('[%s][voiceCallReport][mixMonitorFilename]',_0x2dcaf7,util['inspect'](_0x5f3258,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0fd3('0x42')]['syncVarSet']=function(_0xd0dec2){try{if(this[_0x0fd3('0x32')](_0xd0dec2)){logger[_0x0fd3('0x43')](_0x0fd3('0x72'),_0xd0dec2[_0x0fd3('0x34')],util[_0x0fd3('0x2f')](_0xd0dec2,{'showHidden':![],'depth':null}));if(this[_0x0fd3('0x17')][_0xd0dec2[_0x0fd3('0x34')]]&&_0xd0dec2['channel']!='OutgoingSpoolFailed'){if(this['isNotNull'](_0xd0dec2[_0x0fd3('0x73')])){if(this[_0x0fd3('0x32')](_0xd0dec2[_0x0fd3('0x73')][_0x0fd3('0x74')])){logger['info'](_0x0fd3('0x75'),_0xd0dec2[_0x0fd3('0x34')],_0xd0dec2[_0x0fd3('0x76')]);this[_0x0fd3('0x6d')](_0xd0dec2[_0x0fd3('0x34')],_0xd0dec2[_0x0fd3('0x76')]);}else if(this[_0x0fd3('0x32')](_0xd0dec2['variable']['xmd-phone'])){logger['info'](_0x0fd3('0x77'),_0xd0dec2[_0x0fd3('0x34')],_0xd0dec2[_0x0fd3('0x76')]);this[_0x0fd3('0x17')][_0xd0dec2[_0x0fd3('0x34')]][_0x0fd3('0x65')]=_0xd0dec2['value'];}else if(this[_0x0fd3('0x32')](_0xd0dec2[_0x0fd3('0x73')][_0x0fd3('0x78')])){logger[_0x0fd3('0x2c')](_0x0fd3('0x79'),_0xd0dec2[_0x0fd3('0x34')],_0xd0dec2['value']);this[_0x0fd3('0x17')][_0xd0dec2['uniqueid']][_0x0fd3('0x7a')]=_0xd0dec2[_0x0fd3('0x76')];}else if(this[_0x0fd3('0x32')](_0xd0dec2[_0x0fd3('0x73')]['xmd-cdrtype'])){logger[_0x0fd3('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0xd0dec2[_0x0fd3('0x34')],_0xd0dec2[_0x0fd3('0x76')]);this[_0x0fd3('0x17')][_0xd0dec2[_0x0fd3('0x34')]][_0x0fd3('0x7b')]=_0xd0dec2['value'];}else if(this[_0x0fd3('0x32')](_0xd0dec2['variable'][_0x0fd3('0x7c')])){logger[_0x0fd3('0x2c')](_0x0fd3('0x7d'),_0xd0dec2[_0x0fd3('0x34')],_0xd0dec2[_0x0fd3('0x76')][_0x0fd3('0x3c')](',')[0x0]);this[_0x0fd3('0x17')][_0xd0dec2['uniqueid']][_0x0fd3('0xd')]=_0xd0dec2[_0x0fd3('0x76')][_0x0fd3('0x3c')](',')[0x0];}else if(this[_0x0fd3('0x32')](_0xd0dec2[_0x0fd3('0x73')]['xmd-originatecalleridnum'])){logger[_0x0fd3('0x2c')](_0x0fd3('0x7e'),_0xd0dec2[_0x0fd3('0x34')],_0xd0dec2['value']);this['channels'][_0xd0dec2[_0x0fd3('0x34')]][_0x0fd3('0x7f')]=_0xd0dec2[_0x0fd3('0x76')];}else if(this[_0x0fd3('0x32')](_0xd0dec2[_0x0fd3('0x73')]['xmd-destination'])){logger[_0x0fd3('0x2c')](_0x0fd3('0x80'),_0xd0dec2[_0x0fd3('0x34')],_0xd0dec2[_0x0fd3('0x76')]);this[_0x0fd3('0x17')][_0xd0dec2[_0x0fd3('0x34')]][_0x0fd3('0x81')]=_0xd0dec2[_0x0fd3('0x76')];}else if(this[_0x0fd3('0x32')](_0xd0dec2[_0x0fd3('0x73')][_0x0fd3('0x82')])){logger[_0x0fd3('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0xd0dec2[_0x0fd3('0x34')],_0xd0dec2['value']);this[_0x0fd3('0x17')][_0xd0dec2[_0x0fd3('0x34')]][_0x0fd3('0x83')]=_0xd0dec2['value'];}else if(this['isNotNull'](_0xd0dec2[_0x0fd3('0x73')][_0x0fd3('0x84')])){logger[_0x0fd3('0x2c')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0xd0dec2[_0x0fd3('0x34')],_0xd0dec2['value']);this['channels'][_0xd0dec2[_0x0fd3('0x34')]][_0x0fd3('0xd')]=_0xd0dec2[_0x0fd3('0x76')];}else if(this['isNotNull'](_0xd0dec2[_0x0fd3('0x73')][_0x0fd3('0x85')])){logger[_0x0fd3('0x2c')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0xd0dec2[_0x0fd3('0x34')],_0xd0dec2[_0x0fd3('0x76')]);this[_0x0fd3('0x17')][_0xd0dec2['uniqueid']][_0x0fd3('0x86')]=_0xd0dec2[_0x0fd3('0x76')];}}}else if(this['isNotNull'](_0xd0dec2['variable'][_0x0fd3('0x74')])){if(_0xd0dec2[_0x0fd3('0x76')]){var _0x41533a=path['parse'](_0xd0dec2[_0x0fd3('0x76')])[_0x0fd3('0x40')];logger[_0x0fd3('0x2c')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x41533a,_0xd0dec2['value']);this[_0x0fd3('0x6d')](_0x41533a,_0xd0dec2[_0x0fd3('0x76')]);}}else if(this['channels'][_0xd0dec2[_0x0fd3('0x36')]]){if(this[_0x0fd3('0x32')](_0xd0dec2[_0x0fd3('0x73')])){if(this[_0x0fd3('0x32')](_0xd0dec2['variable'][_0x0fd3('0x85')])){logger[_0x0fd3('0x2c')](_0x0fd3('0x87'),_0xd0dec2[_0x0fd3('0x36')],_0xd0dec2[_0x0fd3('0x76')]);this['channels'][_0xd0dec2[_0x0fd3('0x36')]]['sipcalllinkedid']=_0xd0dec2[_0x0fd3('0x76')];}}}}}catch(_0x3463c6){logger['error'](_0x0fd3('0x88'),_0xd0dec2['uniqueid'],util[_0x0fd3('0x2f')](_0x3463c6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0fd3('0x42')][_0x0fd3('0x23')]=function(_0x528334){try{if(this['isNotNull'](_0x528334)){logger['debug'](_0x0fd3('0x89'),_0x528334[_0x0fd3('0x34')],util[_0x0fd3('0x2f')](_0x528334,{'showHidden':![],'depth':null}));if(this['channels'][_0x528334[_0x0fd3('0x34')]]){logger[_0x0fd3('0x2c')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x528334[_0x0fd3('0x34')],_0x528334['cause-txt']);var _0x10d95c=moment();this['channels'][_0x528334[_0x0fd3('0x34')]][_0x0fd3('0x8a')]=_0x10d95c[_0x0fd3('0x3f')](_0x0fd3('0x58'));this[_0x0fd3('0x17')][_0x528334[_0x0fd3('0x34')]][_0x0fd3('0x56')]=_0x10d95c['diff'](this['channels'][_0x528334[_0x0fd3('0x34')]][_0x0fd3('0x64')],'seconds');if(this[_0x0fd3('0x17')][_0x528334[_0x0fd3('0x34')]][_0x0fd3('0x61')]){this[_0x0fd3('0x17')][_0x528334[_0x0fd3('0x34')]][_0x0fd3('0x8b')]=_0x10d95c[_0x0fd3('0x63')](this[_0x0fd3('0x17')][_0x528334[_0x0fd3('0x34')]][_0x0fd3('0x8c')],_0x0fd3('0x57'));this['channels'][_0x528334['uniqueid']][_0x0fd3('0x62')]=this[_0x0fd3('0x17')][_0x528334[_0x0fd3('0x34')]][_0x0fd3('0x56')]-this[_0x0fd3('0x17')][_0x528334[_0x0fd3('0x34')]][_0x0fd3('0x8b')];}if(_0x528334[_0x0fd3('0x46')]===_0x0fd3('0x3a')){if(this[_0x0fd3('0x18')][_0x528334['channel'][_0x0fd3('0x3c')]('-')[0x0]]){this['agents'][_0x528334[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]]=_[_0x0fd3('0x8d')](this['agents'][_0x528334[_0x0fd3('0x3b')]['split']('-')[0x0]],[_0x0fd3('0x3e')]);logger[_0x0fd3('0x43')](_0x0fd3('0x8e'),_0x528334[_0x0fd3('0x34')],util[_0x0fd3('0x2f')]({'id':this[_0x0fd3('0x18')][_0x528334[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0x0fd3('0x18')][_0x528334[_0x0fd3('0x3b')]['split']('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x0fd3('0x31')](util['format'](_0x0fd3('0x4c'),this[_0x0fd3('0x18')][_0x528334[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]]['name']),_0x0fd3('0x8f'),{'id':this[_0x0fd3('0x18')][_0x528334[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]]['id'],'destaccountcode':this[_0x0fd3('0x18')][_0x528334[_0x0fd3('0x3b')][_0x0fd3('0x3c')]('-')[0x0]]['accountcode']});}}var _0x6496c=this;Promise[_0x0fd3('0x90')]()[_0x0fd3('0x91')](function(){var _0x3f98b2=_0x6496c[_0x0fd3('0x17')][_0x528334[_0x0fd3('0x34')]];if(typeof _0x3f98b2[_0x0fd3('0x92')]===_0x0fd3('0x93'))return;if(_[_0x0fd3('0x94')](_0x3f98b2[_0x0fd3('0x95')]))return;return RpcSetting[_0x0fd3('0x96')]()['then'](function(_0x5ef2e9){if(!_0x5ef2e9[_0x0fd3('0x97')])return;return Promise[_0x0fd3('0x90')]()[_0x0fd3('0x91')](function(){return ami[_0x0fd3('0x98')]({'action':'StopMixMonitor','channel':_0x3f98b2[_0x0fd3('0x3b')]})[_0x0fd3('0x99')](function(){});})[_0x0fd3('0x91')](function(){return ami['Action']({'action':_0x0fd3('0x9a'),'channel':_0x3f98b2[_0x0fd3('0x66')]})[_0x0fd3('0x99')](function(){})[_0x0fd3('0x9b')](function(){var _0x37e522=_0x6496c[_0x0fd3('0x18')][_0x3f98b2[_0x0fd3('0x66')][_0x0fd3('0x3c')]('-')[0x0]];if(!_0x37e522)return;io[_0x0fd3('0x31')]('webbar:stopmonitors',{'agentId':_0x37e522['id'],'uniqueid':_0x3f98b2[_0x0fd3('0x34')]});});});});})[_0x0fd3('0x91')](function(){if(_0x528334[_0x0fd3('0x9c')]===_0x0fd3('0x9d')){_0x6496c[_0x0fd3('0x9e')][_0x528334[_0x0fd3('0x34')]]=_0x6496c[_0x0fd3('0x17')][_0x528334[_0x0fd3('0x34')]];}else{if(_0x6496c[_0x0fd3('0x17')][_0x528334[_0x0fd3('0x34')]][_0x0fd3('0x7b')]===_0x0fd3('0x9f')&&_0x6496c['blindTransfers'][_0x528334[_0x0fd3('0x34')]]){_0x6496c['channels'][_0x528334[_0x0fd3('0x34')]][_0x0fd3('0x34')]=[_0x6496c[_0x0fd3('0x17')][_0x528334[_0x0fd3('0x34')]]['linkedid'],_0x6496c[_0x0fd3('0x17')][_0x528334[_0x0fd3('0x34')]][_0x0fd3('0x36')]=_0x6496c[_0x0fd3('0x17')][_0x528334['uniqueid']]['uniqueid']][0x0];delete _0x6496c[_0x0fd3('0x9e')][_0x528334[_0x0fd3('0x34')]];}}logger[_0x0fd3('0x43')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x528334[_0x0fd3('0x34')],util[_0x0fd3('0x2f')](_0x6496c[_0x0fd3('0x17')][_0x528334[_0x0fd3('0x34')]],{'showHidden':![],'depth':null}));ami[_0x0fd3('0x31')](_0x0fd3('0xa0'),_0x6496c[_0x0fd3('0x17')][_0x528334[_0x0fd3('0x34')]]);delete _0x6496c[_0x0fd3('0x17')][_0x528334[_0x0fd3('0x34')]];});}}}catch(_0x27b04b){logger['error'](_0x0fd3('0xa1'),_0x528334[_0x0fd3('0x34')],util[_0x0fd3('0x2f')](_0x27b04b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0fd3('0xa2')]=function(_0x2136e8){try{if(this['isNotNull'](_0x2136e8)){logger[_0x0fd3('0x2c')](_0x0fd3('0xa3'),_0x2136e8[_0x0fd3('0x34')],_0x2136e8[_0x0fd3('0xa4')],_0x2136e8[_0x0fd3('0xa5')]);logger[_0x0fd3('0x43')](_0x0fd3('0xa6'),_0x2136e8[_0x0fd3('0x34')],util[_0x0fd3('0x2f')](_0x2136e8,{'showHidden':![],'depth':null}));if(this[_0x0fd3('0x17')][_0x2136e8[_0x0fd3('0xa7')]]){this[_0x0fd3('0x17')][_0x2136e8['transfereeuniqueid']][_0x0fd3('0xa8')]=_0x2136e8[_0x0fd3('0xa4')];this[_0x0fd3('0x17')][_0x2136e8[_0x0fd3('0xa7')]][_0x0fd3('0xa9')]=_0x2136e8[_0x0fd3('0xa5')];if(this[_0x0fd3('0x17')][_0x2136e8[_0x0fd3('0xaa')]]){var _0x5bf2ee=this[_0x0fd3('0x17')][_0x2136e8[_0x0fd3('0xaa')]];this['channels'][_0x2136e8[_0x0fd3('0xaa')]]=this['channels'][_0x2136e8[_0x0fd3('0xa7')]];this[_0x0fd3('0x17')][_0x2136e8[_0x0fd3('0xa7')]]=_0x5bf2ee;}}else if(this[_0x0fd3('0x17')][_0x2136e8[_0x0fd3('0xab')]]){this[_0x0fd3('0x17')][_0x2136e8['transfertargetuniqueid']][_0x0fd3('0xa8')]=_0x2136e8[_0x0fd3('0xa4')];this[_0x0fd3('0x17')][_0x2136e8[_0x0fd3('0xab')]][_0x0fd3('0xa9')]=_0x2136e8[_0x0fd3('0xa5')];if(this[_0x0fd3('0x17')][_0x2136e8[_0x0fd3('0xac')]]){var _0x5bf2ee=this[_0x0fd3('0x17')][_0x2136e8[_0x0fd3('0xac')]];this[_0x0fd3('0x17')][_0x2136e8[_0x0fd3('0xac')]]=this[_0x0fd3('0x17')][_0x2136e8[_0x0fd3('0xab')]];this[_0x0fd3('0x17')][_0x2136e8['transfertargetuniqueid']]=_0x5bf2ee;}}if((this[_0x0fd3('0x17')][_0x2136e8[_0x0fd3('0xac')]]||this[_0x0fd3('0x17')][_0x2136e8['origtransfererlinkedid']])&&this['channels'][_0x2136e8[_0x0fd3('0xaa')]]){var _0x33b31d=_['some']([this[_0x0fd3('0x17')][_0x2136e8[_0x0fd3('0xac')]],this[_0x0fd3('0x17')][_0x2136e8['origtransfererlinkedid']],this[_0x0fd3('0x17')][_0x2136e8[_0x0fd3('0xaa')]]],function(_0x4bd89c){return _0x4bd89c&&_0x4bd89c[_0x0fd3('0x7b')]===_0x0fd3('0x9f')&&_0x4bd89c[_0x0fd3('0xad')];});if(_0x33b31d){if(this[_0x0fd3('0x17')][_0x2136e8[_0x0fd3('0xac')]])this[_0x0fd3('0x17')][_0x2136e8['origtransfereruniqueid']][_0x0fd3('0x92')]=_0x0fd3('0xae');if(this[_0x0fd3('0x17')][_0x2136e8[_0x0fd3('0xaf')]])this['channels'][_0x2136e8['origtransfererlinkedid']][_0x0fd3('0x92')]=_0x0fd3('0xae');this['channels'][_0x2136e8[_0x0fd3('0xaa')]][_0x0fd3('0x92')]=_0x0fd3('0xae');}}}}catch(_0x3b6d2b){logger[_0x0fd3('0x5d')]('[%s][voiceCallReport][attendedtransfer]',_0x2136e8[_0x0fd3('0x34')],util['inspect'](_0x3b6d2b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0fd3('0x27')]=function(_0x2fc0a5){try{if(this['isNotNull'](_0x2fc0a5)){logger[_0x0fd3('0x2c')](_0x0fd3('0xb0'),_0x2fc0a5[_0x0fd3('0x34')],_0x2fc0a5[_0x0fd3('0xb1')],_0x2fc0a5['extension']);logger[_0x0fd3('0x43')](_0x0fd3('0xb2'),_0x2fc0a5[_0x0fd3('0x34')],util[_0x0fd3('0x2f')](_0x2fc0a5,{'showHidden':![],'depth':null}));if(this[_0x0fd3('0x17')][_0x2fc0a5[_0x0fd3('0xa7')]]){this[_0x0fd3('0x17')][_0x2fc0a5['transfereeuniqueid']][_0x0fd3('0xa8')]=_0x2fc0a5[_0x0fd3('0xb1')];this['channels'][_0x2fc0a5[_0x0fd3('0xa7')]][_0x0fd3('0xa9')]=_0x2fc0a5[_0x0fd3('0xb3')];this[_0x0fd3('0x17')][_0x2fc0a5['transfereeuniqueid']][_0x0fd3('0x92')]=_0x0fd3('0xb4');this[_0x0fd3('0x23')]({'event':'BlindTransfer','uniqueid':_0x2fc0a5[_0x0fd3('0xa7')],'context':_0x2fc0a5[_0x0fd3('0x46')],'channel':_0x2fc0a5[_0x0fd3('0xb5')]});}else{this['channels'][_0x2fc0a5['transfereruniqueid']]['transferType']='BLIND';}}}catch(_0x429642){logger[_0x0fd3('0x5d')]('[%s][voiceCallReport][blindtransfer]',_0x2fc0a5['uniqueid'],util['inspect'](_0x429642,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0fd3('0x42')]['syncMusicOnHoldStart']=function(_0x4ac89d){try{if(this[_0x0fd3('0x32')](_0x4ac89d)){logger[_0x0fd3('0x43')](_0x0fd3('0xb6'),_0x4ac89d[_0x0fd3('0x34')],util['inspect'](_0x4ac89d,{'showHidden':![],'depth':null}));if(this[_0x0fd3('0x17')][_0x4ac89d[_0x0fd3('0x34')]]){if(!_['isNil'](this[_0x0fd3('0x17')][_0x4ac89d[_0x0fd3('0x34')]][_0x0fd3('0x8c')])){this['channels'][_0x4ac89d['uniqueid']][_0x0fd3('0xb7')]=moment()[_0x0fd3('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');logger['info'](_0x0fd3('0xb8'),_0x4ac89d[_0x0fd3('0x34')],this[_0x0fd3('0x17')][_0x4ac89d[_0x0fd3('0x34')]][_0x0fd3('0xb7')]);}}}}catch(_0x59ca16){logger[_0x0fd3('0x5d')]('[%s][voiceCallReport][musiconholdstart]',_0x4ac89d[_0x0fd3('0x34')],util['inspect'](_0x59ca16,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0fd3('0x42')][_0x0fd3('0x2b')]=function(_0x26f85e){try{if(this['isNotNull'](_0x26f85e)){logger[_0x0fd3('0x43')](_0x0fd3('0xb9'),_0x26f85e['uniqueid'],util[_0x0fd3('0x2f')](_0x26f85e,{'showHidden':![],'depth':null}));if(this[_0x0fd3('0x17')][_0x26f85e[_0x0fd3('0x34')]]){if(!_[_0x0fd3('0xba')](this[_0x0fd3('0x17')][_0x26f85e[_0x0fd3('0x34')]][_0x0fd3('0xb7')])){this['channels'][_0x26f85e['uniqueid']]['mohtime']+=moment()[_0x0fd3('0xbb')](0x0)[_0x0fd3('0x63')](this[_0x0fd3('0x17')][_0x26f85e['uniqueid']][_0x0fd3('0xb7')],_0x0fd3('0x57'));logger[_0x0fd3('0x2c')](_0x0fd3('0xbc'),_0x26f85e['uniqueid'],this[_0x0fd3('0x17')][_0x26f85e['uniqueid']][_0x0fd3('0xbd')]);delete this['channels'][_0x26f85e[_0x0fd3('0x34')]]['mohstarttime'];}}}}catch(_0x123545){logger['error'](_0x0fd3('0xbe'),_0x26f85e[_0x0fd3('0x34')],util[_0x0fd3('0x2f')](_0x123545,{'showHidden':![],'depth':null}));}};module[_0x0fd3('0xbf')]=VoiceCallReport; \ No newline at end of file +var _0xbe5a=['exten','xcally-motion-preview','connectedlinenum','format','user:%s','name','user:agentconnect','split','accountcode','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','pick','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','debug','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','appdata','startsWith','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','keys','includes','lastapplication','lastdata','cdr(','match','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','toNumber','channelstate','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcalluniqueid','parse','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','undefined','isEmpty','getSettings','stopRecordingOnTransfer','StopMixMonitor','catch','Action','destinationchannel','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','routeid','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','bluebird','lodash','util','path','../../../config/environment','../../../config/logger','ami','../model/channel','../rpc/setting','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','onhold','set','agi','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','socket.io-emitter','channels','agents','blindTransfers','newexten','syncNewExten','bind','newstate','varset','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','isUndefined','emit','prototype','syncNewCallerId','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','[%s][voiceCallReport][newcallerid]\x20event:','inspect','linkedid','merge','from-sip','channel'];(function(_0x2fca90,_0x51568e){var _0x43c703=function(_0x5f5a1f){while(--_0x5f5a1f){_0x2fca90['push'](_0x2fca90['shift']());}};_0x43c703(++_0x51568e);}(_0xbe5a,0x90));var _0xabe5=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xbe5a[_0x1f36bb];return _0xaf97fa;};'use strict';var BPromise=require(_0xabe5('0x0'));var _=require(_0xabe5('0x1'));var moment=require('moment');var util=require(_0xabe5('0x2'));var path=require(_0xabe5('0x3'));var Redis=require('ioredis');var config=require(_0xabe5('0x4'));var logger=require(_0xabe5('0x5'))(_0xabe5('0x6'));var ami=require('../ami');var Channel=require(_0xabe5('0x7'));var RpcSetting=require(_0xabe5('0x8'));var statusDesc=[_0xabe5('0x9'),_0xabe5('0xa'),_0xabe5('0xb'),_0xabe5('0xc'),_0xabe5('0xd'),_0xabe5('0xe'),_0xabe5('0xf'),'ringinuse',_0xabe5('0x10')];var applications=[_0xabe5('0x11'),'queue',_0xabe5('0x12'),'dial','playback',_0xabe5('0x13')];var dispositions=[_0xabe5('0x14'),_0xabe5('0x15'),'FAILED',_0xabe5('0x14'),_0xabe5('0x14'),_0xabe5('0x14'),_0xabe5('0x16'),_0xabe5('0x17'),_0xabe5('0x15'),_0xabe5('0x15'),_0xabe5('0x15')];var actions={};config[_0xabe5('0x18')]=_[_0xabe5('0x19')](config[_0xabe5('0x18')],{'host':'localhost','port':0x18eb});var io=require(_0xabe5('0x1a'))(new Redis(config[_0xabe5('0x18')]));function VoiceCallReport(_0x27755a){this['channels']=_0x27755a[_0xabe5('0x1b')];this[_0xabe5('0x1c')]=_0x27755a[_0xabe5('0x1c')];this[_0xabe5('0x1d')]={};ami['on']('coreshowchannel',this['syncNewExten']['bind'](this));ami['on'](_0xabe5('0x1e'),this[_0xabe5('0x1f')]['bind'](this));ami['on']('newchannel',this['syncNewChannel'][_0xabe5('0x20')](this));ami['on'](_0xabe5('0x21'),this['syncNewState'][_0xabe5('0x20')](this));ami['on'](_0xabe5('0x22'),this['syncVarSet'][_0xabe5('0x20')](this));ami['on'](_0xabe5('0x23'),this[_0xabe5('0x24')][_0xabe5('0x20')](this));ami['on'](_0xabe5('0x25'),this['syncNewCallerId'][_0xabe5('0x20')](this));ami['on'](_0xabe5('0x26'),this[_0xabe5('0x27')][_0xabe5('0x20')](this));ami['on'](_0xabe5('0x28'),this['syncBlindTransfer'][_0xabe5('0x20')](this));ami['on'](_0xabe5('0x29'),this[_0xabe5('0x2a')][_0xabe5('0x20')](this));ami['on'](_0xabe5('0x2b'),this[_0xabe5('0x2c')][_0xabe5('0x20')](this));try{logger[_0xabe5('0x2d')](_0xabe5('0x2e'));ami[_0xabe5('0x2f')]();}catch(_0x444b0d){logger['error'](_0xabe5('0x30'),util['inspect'](_0x444b0d,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x1c1d8a){return _0x1c1d8a!==null&&!_[_0xabe5('0x31')](_0x1c1d8a);};VoiceCallReport['prototype'][_0xabe5('0x32')]=function(_0x298f8f,_0x9fa59d,_0x554f69){io['to'](_0x298f8f)['emit'](_0x9fa59d,_0x554f69);};VoiceCallReport[_0xabe5('0x33')][_0xabe5('0x34')]=function(_0x299d61){try{if(this[_0xabe5('0x35')](_0x299d61)){logger[_0xabe5('0x2d')](_0xabe5('0x36'),_0x299d61[_0xabe5('0x37')],_0x299d61[_0xabe5('0x38')],_0x299d61[_0xabe5('0x39')]);logger['debug'](_0xabe5('0x3a'),_0x299d61['uniqueid'],util[_0xabe5('0x3b')](_0x299d61,{'showHidden':![],'depth':null}));if(_0x299d61[_0xabe5('0x37')]===_0x299d61[_0xabe5('0x3c')]){if(!_[_0xabe5('0x31')](this[_0xabe5('0x1b')][_0x299d61['uniqueid']])){_[_0xabe5('0x3d')](this['channels'][_0x299d61[_0xabe5('0x37')]],_['pick'](_0x299d61,_['keys'](this[_0xabe5('0x1b')][_0x299d61[_0xabe5('0x37')]])));}}if(_0x299d61['context']===_0xabe5('0x3e')){if(this[_0xabe5('0x1c')][_0x299d61[_0xabe5('0x3f')]['split']('-')[0x0]]){if(_0x299d61[_0xabe5('0x40')]==_0xabe5('0x41')){this[_0xabe5('0x1c')][_0x299d61[_0xabe5('0x3f')]['split']('-')[0x0]]['destconnectedlinenum']=_0x299d61[_0xabe5('0x42')];this[_0xabe5('0x32')](util[_0xabe5('0x43')](_0xabe5('0x44'),this['agents'][_0x299d61['channel']['split']('-')[0x0]][_0xabe5('0x45')]),_0xabe5('0x46'),{'destaccountcode':this[_0xabe5('0x1c')][_0x299d61['channel'][_0xabe5('0x47')]('-')[0x0]][_0xabe5('0x48')],'destconnectedlinenum':_0x299d61[_0xabe5('0x42')]});}}}}}catch(_0x17d534){logger[_0xabe5('0x49')](_0xabe5('0x4a'),_0x299d61[_0xabe5('0x37')],util[_0xabe5('0x3b')](_0x17d534,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabe5('0x33')]['syncNewChannel']=function(_0x2f94e3){try{if(this[_0xabe5('0x35')](_0x2f94e3)){logger['debug'](_0xabe5('0x4b'),_0x2f94e3[_0xabe5('0x37')],util[_0xabe5('0x3b')](_0x2f94e3,{'showHidden':![],'depth':null}));if(_0x2f94e3[_0xabe5('0x37')]===_0x2f94e3['linkedid']&&_0x2f94e3[_0xabe5('0x3f')]!=_0xabe5('0x4c')){if(_[_0xabe5('0x31')](this[_0xabe5('0x1b')][_0x2f94e3[_0xabe5('0x37')]])){logger[_0xabe5('0x2d')](_0xabe5('0x4d'),_0x2f94e3['uniqueid'],_0x2f94e3[_0xabe5('0x4e')],_0x2f94e3['exten']);this['channels'][_0x2f94e3[_0xabe5('0x37')]]=new Channel();this[_0xabe5('0x1b')][_0x2f94e3[_0xabe5('0x37')]][_0xabe5('0x4f')]=moment()['format'](_0xabe5('0x50'));this['channels'][_0x2f94e3['uniqueid']][_0xabe5('0x51')]=dispositions[_['toNumber'](_0x2f94e3['channelstate'])];_[_0xabe5('0x3d')](this['channels'][_0x2f94e3[_0xabe5('0x37')]],_[_0xabe5('0x52')](_0x2f94e3,_['keys'](this['channels'][_0x2f94e3[_0xabe5('0x37')]])));if(_0x2f94e3[_0xabe5('0x4e')]===_0xabe5('0x3e')){if(this[_0xabe5('0x1c')][_0x2f94e3[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]]){if(_[_0xabe5('0x31')](this[_0xabe5('0x1c')][_0x2f94e3[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]][_0xabe5('0x53')])){this[_0xabe5('0x1c')][_0x2f94e3[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]][_0xabe5('0x53')]=_0x2f94e3[_0xabe5('0x40')];logger['debug'](_0xabe5('0x54'),_0x2f94e3['uniqueid'],util[_0xabe5('0x3b')]({'destaccountcode':this['agents'][_0x2f94e3[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2f94e3['exten']},{'showHidden':![],'depth':null}));this[_0xabe5('0x32')](util[_0xabe5('0x43')](_0xabe5('0x44'),this[_0xabe5('0x1c')][_0x2f94e3[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]][_0xabe5('0x45')]),_0xabe5('0x46'),{'destaccountcode':this[_0xabe5('0x1c')][_0x2f94e3[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2f94e3[_0xabe5('0x40')]});}}}}}}}catch(_0x469227){logger[_0xabe5('0x49')](_0xabe5('0x55'),_0x2f94e3[_0xabe5('0x37')],util[_0xabe5('0x3b')](_0x469227,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabe5('0x33')][_0xabe5('0x1f')]=function(_0x22d557){try{if(this['isNotNull'](_0x22d557)){logger[_0xabe5('0x56')](_0xabe5('0x57'),_0x22d557['uniqueid'],util[_0xabe5('0x3b')](_0x22d557,{'showHidden':![],'depth':null}));if(_0x22d557[_0xabe5('0x37')]===_0x22d557[_0xabe5('0x3c')]&&_0x22d557[_0xabe5('0x40')]!='h'&&_0x22d557['channel']!=_0xabe5('0x4c')){_0x22d557[_0xabe5('0x58')]=_0x22d557[_0xabe5('0x58')][_0xabe5('0x59')]();_0x22d557['applicationdata']=_0x22d557[_0xabe5('0x5a')]&&_0x22d557[_0xabe5('0x5a')][_0xabe5('0x5b')]('CDR(routeAlias)')?_0x22d557[_0xabe5('0x5a')]:(_0x22d557['appdata']||_0x22d557[_0xabe5('0x5c')])['toLowerCase']();logger[_0xabe5('0x2d')](_0xabe5('0x5d'),_0x22d557[_0xabe5('0x37')],_0x22d557[_0xabe5('0x58')],_0x22d557[_0xabe5('0x5c')]);if(_['isUndefined'](this[_0xabe5('0x1b')][_0x22d557[_0xabe5('0x37')]])){this[_0xabe5('0x1b')][_0x22d557[_0xabe5('0x37')]]=new Channel();this['channels'][_0x22d557[_0xabe5('0x37')]][_0xabe5('0x4f')]=_0x22d557[_0xabe5('0x5e')]?moment()['subtract'](moment[_0xabe5('0x5e')](_0x22d557[_0xabe5('0x5e')])[_0xabe5('0x5f')](),_0xabe5('0x5f'))[_0xabe5('0x43')](_0xabe5('0x50')):moment()[_0xabe5('0x43')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xabe5('0x1b')][_0x22d557[_0xabe5('0x37')]][_0xabe5('0x51')]=_0xabe5('0x14');}_[_0xabe5('0x3d')](this[_0xabe5('0x1b')][_0x22d557['uniqueid']],_['pick'](_0x22d557,_[_0xabe5('0x60')](this['channels'][_0x22d557['uniqueid']])));if(_[_0xabe5('0x61')](applications,_0x22d557[_0xabe5('0x58')])){this[_0xabe5('0x1b')][_0x22d557[_0xabe5('0x37')]][_0xabe5('0x62')]=_0x22d557[_0xabe5('0x58')];this[_0xabe5('0x1b')][_0x22d557[_0xabe5('0x37')]][_0xabe5('0x63')]=_0x22d557[_0xabe5('0x5c')];if(_0x22d557[_0xabe5('0x58')]===_0xabe5('0x11')&&_['startsWith'](_0x22d557[_0xabe5('0x5c')]['toLowerCase'](),_0xabe5('0x64'))){var _0x371172=_0x22d557[_0xabe5('0x5c')][_0xabe5('0x47')]('=');var _0x30f05e=_0x371172[0x0][_0xabe5('0x59')]()[_0xabe5('0x65')](/cdr\((.*)\)/);if(_0x30f05e){this[_0xabe5('0x1b')][_0x22d557[_0xabe5('0x37')]][_0x30f05e[0x1]]=_0x371172[0x1];}}else if(_0x22d557[_0xabe5('0x58')]===_0xabe5('0x66')){this['channels'][_0x22d557[_0xabe5('0x37')]][_0xabe5('0x66')]=_0x22d557['applicationdata'][_0xabe5('0x47')](',')[0x0];}}}}}catch(_0xeb065){logger['error'](_0xabe5('0x67'),_0x22d557['uniqueid'],util[_0xabe5('0x3b')](_0xeb065,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabe5('0x33')]['syncNewState']=function(_0x208ecf){try{if(this[_0xabe5('0x35')](_0x208ecf)){logger[_0xabe5('0x2d')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x208ecf[_0xabe5('0x37')],_0x208ecf[_0xabe5('0x3c')],_0x208ecf[_0xabe5('0x38')],_0x208ecf[_0xabe5('0x39')]);logger[_0xabe5('0x56')](_0xabe5('0x68'),_0x208ecf[_0xabe5('0x37')],util[_0xabe5('0x3b')](_0x208ecf,{'showHidden':![],'depth':null}));if(_0x208ecf['uniqueid']!==_0x208ecf[_0xabe5('0x3c')]){if(this[_0xabe5('0x1b')][_0x208ecf[_0xabe5('0x3c')]]){if(_0x208ecf['channelstate']==='6'){if(!this[_0xabe5('0x1b')][_0x208ecf[_0xabe5('0x3c')]][_0xabe5('0x69')]){var _0x49007f=moment();this[_0xabe5('0x1b')][_0x208ecf[_0xabe5('0x3c')]][_0xabe5('0x69')]=!![];this['channels'][_0x208ecf[_0xabe5('0x3c')]][_0xabe5('0x6a')]=_0x49007f[_0xabe5('0x43')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0xabe5('0x1b')][_0x208ecf['linkedid']][_0xabe5('0x4f')]){this['channels'][_0x208ecf[_0xabe5('0x3c')]][_0xabe5('0x6b')]=_0x49007f[_0xabe5('0x6c')](this[_0xabe5('0x1b')][_0x208ecf[_0xabe5('0x3c')]][_0xabe5('0x4f')],_0xabe5('0x5f'));}}this['channels'][_0x208ecf[_0xabe5('0x3c')]]['linkedid']=_0x208ecf[_0xabe5('0x37')];if(_0x208ecf[_0xabe5('0x39')]!==_0xabe5('0x41')){this['channels'][_0x208ecf[_0xabe5('0x3c')]][_0xabe5('0x42')]=_0x208ecf[_0xabe5('0x39')];}this['channels'][_0x208ecf['linkedid']]['connectedlinename']=_0x208ecf['calleridname'];this[_0xabe5('0x1b')][_0x208ecf[_0xabe5('0x3c')]]['destinationchannel']=_0x208ecf['channel'];this[_0xabe5('0x1b')][_0x208ecf[_0xabe5('0x3c')]][_0xabe5('0x51')]=dispositions[_[_0xabe5('0x6d')](_0x208ecf[_0xabe5('0x6e')])];if(this[_0xabe5('0x1c')][_0x208ecf[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]]){this[_0xabe5('0x1b')][_0x208ecf[_0xabe5('0x3c')]][_0xabe5('0x6f')]=this[_0xabe5('0x1c')][_0x208ecf[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]]['id'];this[_0xabe5('0x1b')][_0x208ecf['linkedid']][_0xabe5('0x70')]=this[_0xabe5('0x1c')][_0x208ecf[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]][_0xabe5('0x45')];}}}}else{if(this[_0xabe5('0x1b')][_0x208ecf['uniqueid']]){if(_0x208ecf[_0xabe5('0x6e')]==='6'){if(this[_0xabe5('0x1c')][_0x208ecf[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]]){this[_0xabe5('0x1b')][_0x208ecf['uniqueid']][_0xabe5('0x6f')]=this[_0xabe5('0x1c')][_0x208ecf[_0xabe5('0x3f')]['split']('-')[0x0]]['id'];this[_0xabe5('0x1b')][_0x208ecf[_0xabe5('0x37')]][_0xabe5('0x70')]=this[_0xabe5('0x1c')][_0x208ecf['channel'][_0xabe5('0x47')]('-')[0x0]][_0xabe5('0x45')];}}}}if(_0x208ecf[_0xabe5('0x6e')]==='6'&&_0x208ecf['context']===_0xabe5('0x3e')){if(this[_0xabe5('0x1c')][_0x208ecf[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]]){this[_0xabe5('0x1c')][_0x208ecf[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]][_0xabe5('0x53')]=_0x208ecf[_0xabe5('0x40')];var _0x32eeb5;if(this['channels'][_0x208ecf[_0xabe5('0x37')]])_0x32eeb5=this[_0xabe5('0x1b')][_0x208ecf[_0xabe5('0x37')]]['routealias'];else if(this[_0xabe5('0x1b')][_0x208ecf[_0xabe5('0x3c')]])_0x32eeb5=this['channels'][_0x208ecf[_0xabe5('0x3c')]][_0xabe5('0x71')];logger[_0xabe5('0x56')](_0xabe5('0x72'),_0x208ecf[_0xabe5('0x37')],util[_0xabe5('0x3b')]({'destaccountcode':this['agents'][_0x208ecf[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x208ecf[_0xabe5('0x40')],'routealias':_0x32eeb5},{'showHidden':![],'depth':null}));this['emit'](util[_0xabe5('0x43')](_0xabe5('0x44'),this[_0xabe5('0x1c')][_0x208ecf[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]][_0xabe5('0x45')]),_0xabe5('0x46'),{'destaccountcode':this[_0xabe5('0x1c')][_0x208ecf['channel'][_0xabe5('0x47')]('-')[0x0]][_0xabe5('0x48')],'destconnectedlinenum':_0x208ecf[_0xabe5('0x40')],'routealias':_0x32eeb5});}}}}catch(_0x45c89c){logger[_0xabe5('0x49')](_0xabe5('0x73'),_0x208ecf[_0xabe5('0x37')],util[_0xabe5('0x3b')](_0x45c89c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xabe5('0x74')]=function(_0xfb978b,_0x5c5ec4){try{if(this[_0xabe5('0x1b')][_0xfb978b]){logger[_0xabe5('0x2d')](_0xabe5('0x75'),_0xfb978b,_0x5c5ec4);this[_0xabe5('0x1b')][_0xfb978b][_0xabe5('0x76')]=!![];if(_['endsWith'](_0x5c5ec4,_0xabe5('0x77'))){_0x5c5ec4=_0x5c5ec4[_0xabe5('0x78')](_0xabe5('0x77'),_0xabe5('0x79'));}this['channels'][_0xfb978b][_0xabe5('0x7a')]=_0x5c5ec4;var _0x5f4d1c=_[_0xabe5('0x7b')](this['channels'][_0xfb978b][_0xabe5('0x7c')],{'filename':_0x5c5ec4});if(_[_0xabe5('0x7d')](_0x5f4d1c)){this[_0xabe5('0x1b')][_0xfb978b][_0xabe5('0x7c')][_0xabe5('0x7e')]({'filename':_0x5c5ec4,'createdAt':moment()[_0xabe5('0x43')](_0xabe5('0x50')),'mixmonitorid':'','status':_0xabe5('0x7f')});}}}catch(_0x5efea3){logger['error'](_0xabe5('0x80'),_0xfb978b,util[_0xabe5('0x3b')](_0x5efea3,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xabe5('0x81')]=function(_0x226c4b){try{if(this['isNotNull'](_0x226c4b)){logger['debug'](_0xabe5('0x82'),_0x226c4b['uniqueid'],util[_0xabe5('0x3b')](_0x226c4b,{'showHidden':![],'depth':null}));if(this[_0xabe5('0x1b')][_0x226c4b[_0xabe5('0x37')]]&&_0x226c4b[_0xabe5('0x3f')]!=_0xabe5('0x4c')){if(this[_0xabe5('0x35')](_0x226c4b[_0xabe5('0x83')])){if(this['isNotNull'](_0x226c4b['variable'][_0xabe5('0x84')])){logger[_0xabe5('0x2d')](_0xabe5('0x85'),_0x226c4b[_0xabe5('0x37')],_0x226c4b[_0xabe5('0x86')]);this['syncMixMonitorFilename'](_0x226c4b[_0xabe5('0x37')],_0x226c4b['value']);}else if(this['isNotNull'](_0x226c4b['variable'][_0xabe5('0x87')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x226c4b[_0xabe5('0x37')],_0x226c4b[_0xabe5('0x86')]);this['channels'][_0x226c4b[_0xabe5('0x37')]]['calleridnum']=_0x226c4b[_0xabe5('0x86')];}else if(this[_0xabe5('0x35')](_0x226c4b[_0xabe5('0x83')][_0xabe5('0x88')])){logger['info'](_0xabe5('0x89'),_0x226c4b[_0xabe5('0x37')],_0x226c4b['value']);this[_0xabe5('0x1b')][_0x226c4b[_0xabe5('0x37')]][_0xabe5('0x8a')]=_0x226c4b[_0xabe5('0x86')];}else if(this[_0xabe5('0x35')](_0x226c4b[_0xabe5('0x83')][_0xabe5('0x8b')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x226c4b[_0xabe5('0x37')],_0x226c4b[_0xabe5('0x86')]);this[_0xabe5('0x1b')][_0x226c4b[_0xabe5('0x37')]][_0xabe5('0x8c')]=_0x226c4b['value'];}else if(this['isNotNull'](_0x226c4b[_0xabe5('0x83')][_0xabe5('0x8d')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x226c4b[_0xabe5('0x37')],_0x226c4b['value'][_0xabe5('0x47')](',')[0x0]);this[_0xabe5('0x1b')][_0x226c4b[_0xabe5('0x37')]][_0xabe5('0x66')]=_0x226c4b['value']['split'](',')[0x0];}else if(this[_0xabe5('0x35')](_0x226c4b[_0xabe5('0x83')][_0xabe5('0x8e')])){logger[_0xabe5('0x2d')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x226c4b[_0xabe5('0x37')],_0x226c4b['value']);this[_0xabe5('0x1b')][_0x226c4b[_0xabe5('0x37')]][_0xabe5('0x8f')]=_0x226c4b[_0xabe5('0x86')];}else if(this['isNotNull'](_0x226c4b['variable'][_0xabe5('0x90')])){logger[_0xabe5('0x2d')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x226c4b[_0xabe5('0x37')],_0x226c4b[_0xabe5('0x86')]);this[_0xabe5('0x1b')][_0x226c4b[_0xabe5('0x37')]][_0xabe5('0x91')]=_0x226c4b['value'];}else if(this[_0xabe5('0x35')](_0x226c4b[_0xabe5('0x83')][_0xabe5('0x92')])){logger[_0xabe5('0x2d')](_0xabe5('0x93'),_0x226c4b[_0xabe5('0x37')],_0x226c4b[_0xabe5('0x86')]);this[_0xabe5('0x1b')][_0x226c4b[_0xabe5('0x37')]]['calleridpreview']=_0x226c4b['value'];}else if(this['isNotNull'](_0x226c4b[_0xabe5('0x83')][_0xabe5('0x94')])){logger[_0xabe5('0x2d')](_0xabe5('0x95'),_0x226c4b[_0xabe5('0x37')],_0x226c4b[_0xabe5('0x86')]);this[_0xabe5('0x1b')][_0x226c4b[_0xabe5('0x37')]][_0xabe5('0x66')]=_0x226c4b[_0xabe5('0x86')];}else if(this[_0xabe5('0x35')](_0x226c4b[_0xabe5('0x83')]['sipcallid'])){logger[_0xabe5('0x2d')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x226c4b[_0xabe5('0x37')],_0x226c4b[_0xabe5('0x86')]);this[_0xabe5('0x1b')][_0x226c4b[_0xabe5('0x37')]][_0xabe5('0x96')]=_0x226c4b['value'];}}}else if(this[_0xabe5('0x35')](_0x226c4b[_0xabe5('0x83')][_0xabe5('0x84')])){if(_0x226c4b[_0xabe5('0x86')]){var _0x3f682e=path[_0xabe5('0x97')](_0x226c4b[_0xabe5('0x86')])[_0xabe5('0x45')];logger[_0xabe5('0x2d')](_0xabe5('0x85'),_0x3f682e,_0x226c4b[_0xabe5('0x86')]);this['syncMixMonitorFilename'](_0x3f682e,_0x226c4b[_0xabe5('0x86')]);}}else if(this[_0xabe5('0x1b')][_0x226c4b[_0xabe5('0x3c')]]){if(this[_0xabe5('0x35')](_0x226c4b[_0xabe5('0x83')])){if(this['isNotNull'](_0x226c4b['variable'][_0xabe5('0x98')])){logger[_0xabe5('0x2d')](_0xabe5('0x99'),_0x226c4b[_0xabe5('0x3c')],_0x226c4b[_0xabe5('0x86')]);this[_0xabe5('0x1b')][_0x226c4b[_0xabe5('0x3c')]][_0xabe5('0x9a')]=_0x226c4b[_0xabe5('0x86')];}}}}}catch(_0x45b85b){logger[_0xabe5('0x49')](_0xabe5('0x9b'),_0x226c4b[_0xabe5('0x37')],util[_0xabe5('0x3b')](_0x45b85b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabe5('0x33')][_0xabe5('0x24')]=function(_0x432d8e){try{if(this[_0xabe5('0x35')](_0x432d8e)){logger[_0xabe5('0x56')](_0xabe5('0x9c'),_0x432d8e['uniqueid'],util['inspect'](_0x432d8e,{'showHidden':![],'depth':null}));if(this[_0xabe5('0x1b')][_0x432d8e[_0xabe5('0x37')]]){logger['info'](_0xabe5('0x9d'),_0x432d8e[_0xabe5('0x37')],_0x432d8e[_0xabe5('0x9e')]);var _0x385773=moment();this['channels'][_0x432d8e[_0xabe5('0x37')]][_0xabe5('0x9f')]=_0x385773[_0xabe5('0x43')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x432d8e[_0xabe5('0x37')]][_0xabe5('0x5e')]=_0x385773[_0xabe5('0x6c')](this[_0xabe5('0x1b')][_0x432d8e[_0xabe5('0x37')]][_0xabe5('0x4f')],_0xabe5('0x5f'));if(this[_0xabe5('0x1b')][_0x432d8e[_0xabe5('0x37')]][_0xabe5('0x69')]){this['channels'][_0x432d8e[_0xabe5('0x37')]][_0xabe5('0xa0')]=_0x385773[_0xabe5('0x6c')](this[_0xabe5('0x1b')][_0x432d8e['uniqueid']]['answertime'],_0xabe5('0x5f'));this[_0xabe5('0x1b')][_0x432d8e[_0xabe5('0x37')]][_0xabe5('0x6b')]=this[_0xabe5('0x1b')][_0x432d8e[_0xabe5('0x37')]][_0xabe5('0x5e')]-this['channels'][_0x432d8e[_0xabe5('0x37')]][_0xabe5('0xa0')];}if(_0x432d8e['context']===_0xabe5('0x3e')){if(this[_0xabe5('0x1c')][_0x432d8e[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]]){this['agents'][_0x432d8e['channel']['split']('-')[0x0]]=_[_0xabe5('0xa1')](this[_0xabe5('0x1c')][_0x432d8e[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]],[_0xabe5('0x53')]);logger['debug'](_0xabe5('0xa2'),_0x432d8e[_0xabe5('0x37')],util['inspect']({'id':this[_0xabe5('0x1c')][_0x432d8e['channel'][_0xabe5('0x47')]('-')[0x0]]['id'],'destaccountcode':this[_0xabe5('0x1c')][_0x432d8e[_0xabe5('0x3f')]['split']('-')[0x0]][_0xabe5('0x48')]},{'showHidden':![],'depth':null}));this[_0xabe5('0x32')](util['format'](_0xabe5('0x44'),this[_0xabe5('0x1c')][_0x432d8e[_0xabe5('0x3f')]['split']('-')[0x0]]['name']),_0xabe5('0xa3'),{'id':this[_0xabe5('0x1c')][_0x432d8e[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x432d8e[_0xabe5('0x3f')][_0xabe5('0x47')]('-')[0x0]][_0xabe5('0x48')]});}}var _0x35bfe1=this;Promise[_0xabe5('0xa4')]()[_0xabe5('0xa5')](function(){var _0x13456b=_0x35bfe1[_0xabe5('0x1b')][_0x432d8e[_0xabe5('0x37')]];if(typeof _0x13456b[_0xabe5('0xa6')]===_0xabe5('0xa7'))return;if(_[_0xabe5('0xa8')](_0x13456b[_0xabe5('0x7c')]))return;return RpcSetting[_0xabe5('0xa9')]()[_0xabe5('0xa5')](function(_0x9a17d0){if(!_0x9a17d0[_0xabe5('0xaa')])return;return Promise['resolve']()[_0xabe5('0xa5')](function(){return ami['Action']({'action':_0xabe5('0xab'),'channel':_0x13456b[_0xabe5('0x3f')]})[_0xabe5('0xac')](function(){});})[_0xabe5('0xa5')](function(){return ami[_0xabe5('0xad')]({'action':'StopMixMonitor','channel':_0x13456b[_0xabe5('0xae')]})[_0xabe5('0xac')](function(){})[_0xabe5('0xaf')](function(){var _0xaa2db0=_0x35bfe1[_0xabe5('0x1c')][_0x13456b[_0xabe5('0xae')]['split']('-')[0x0]];if(!_0xaa2db0)return;io[_0xabe5('0x32')](_0xabe5('0xb0'),{'agentId':_0xaa2db0['id'],'uniqueid':_0x13456b[_0xabe5('0x37')]});});});});})[_0xabe5('0xa5')](function(){if(_0x432d8e[_0xabe5('0xb1')]===_0xabe5('0xb2')){_0x35bfe1[_0xabe5('0x1d')][_0x432d8e[_0xabe5('0x37')]]=_0x35bfe1[_0xabe5('0x1b')][_0x432d8e['uniqueid']];}else{if(_0x35bfe1[_0xabe5('0x1b')][_0x432d8e[_0xabe5('0x37')]][_0xabe5('0x8c')]===_0xabe5('0xb3')&&_0x35bfe1[_0xabe5('0x1d')][_0x432d8e['uniqueid']]){_0x35bfe1[_0xabe5('0x1b')][_0x432d8e['uniqueid']]['uniqueid']=[_0x35bfe1[_0xabe5('0x1b')][_0x432d8e[_0xabe5('0x37')]]['linkedid'],_0x35bfe1[_0xabe5('0x1b')][_0x432d8e[_0xabe5('0x37')]][_0xabe5('0x3c')]=_0x35bfe1[_0xabe5('0x1b')][_0x432d8e[_0xabe5('0x37')]]['uniqueid']][0x0];delete _0x35bfe1[_0xabe5('0x1d')][_0x432d8e['uniqueid']];}}logger['debug'](_0xabe5('0xb4'),_0x432d8e[_0xabe5('0x37')],util[_0xabe5('0x3b')](_0x35bfe1[_0xabe5('0x1b')][_0x432d8e[_0xabe5('0x37')]],{'showHidden':![],'depth':null}));ami[_0xabe5('0x32')]('custom:voiceCallReport',_0x35bfe1['channels'][_0x432d8e[_0xabe5('0x37')]]);delete _0x35bfe1[_0xabe5('0x1b')][_0x432d8e[_0xabe5('0x37')]];});}}}catch(_0x482745){logger['error'](_0xabe5('0xb5'),_0x432d8e[_0xabe5('0x37')],util[_0xabe5('0x3b')](_0x482745,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabe5('0x33')]['syncAttendedTransfer']=function(_0xdc325e){try{if(this['isNotNull'](_0xdc325e)){logger[_0xabe5('0x2d')](_0xabe5('0xb6'),_0xdc325e[_0xabe5('0x37')],_0xdc325e[_0xabe5('0xb7')],_0xdc325e[_0xabe5('0xb8')]);logger[_0xabe5('0x56')](_0xabe5('0xb9'),_0xdc325e[_0xabe5('0x37')],util['inspect'](_0xdc325e,{'showHidden':![],'depth':null}));if(this['channels'][_0xdc325e[_0xabe5('0xba')]]){this['channels'][_0xdc325e[_0xabe5('0xba')]][_0xabe5('0xbb')]=_0xdc325e[_0xabe5('0xb7')];this[_0xabe5('0x1b')][_0xdc325e[_0xabe5('0xba')]][_0xabe5('0xbc')]=_0xdc325e['transfertargetcalleridnum'];if(this[_0xabe5('0x1b')][_0xdc325e[_0xabe5('0xbd')]]){var _0x55ddd1=this[_0xabe5('0x1b')][_0xdc325e[_0xabe5('0xbd')]];this[_0xabe5('0x1b')][_0xdc325e[_0xabe5('0xbd')]]=this[_0xabe5('0x1b')][_0xdc325e['transfereeuniqueid']];this[_0xabe5('0x1b')][_0xdc325e[_0xabe5('0xba')]]=_0x55ddd1;}}else if(this[_0xabe5('0x1b')][_0xdc325e[_0xabe5('0xbe')]]){this[_0xabe5('0x1b')][_0xdc325e[_0xabe5('0xbe')]][_0xabe5('0xbb')]=_0xdc325e['origtransferercalleridnum'];this[_0xabe5('0x1b')][_0xdc325e[_0xabe5('0xbe')]][_0xabe5('0xbc')]=_0xdc325e[_0xabe5('0xb8')];if(this['channels'][_0xdc325e[_0xabe5('0xbf')]]){var _0x55ddd1=this[_0xabe5('0x1b')][_0xdc325e[_0xabe5('0xbf')]];this[_0xabe5('0x1b')][_0xdc325e[_0xabe5('0xbf')]]=this[_0xabe5('0x1b')][_0xdc325e['transfertargetuniqueid']];this[_0xabe5('0x1b')][_0xdc325e[_0xabe5('0xbe')]]=_0x55ddd1;}}if((this['channels'][_0xdc325e[_0xabe5('0xbf')]]||this['channels'][_0xdc325e['origtransfererlinkedid']])&&this[_0xabe5('0x1b')][_0xdc325e[_0xabe5('0xbd')]]){var _0xa399a8=_['some']([this[_0xabe5('0x1b')][_0xdc325e[_0xabe5('0xbf')]],this['channels'][_0xdc325e['origtransfererlinkedid']],this[_0xabe5('0x1b')][_0xdc325e[_0xabe5('0xbd')]]],function(_0x1cc09e){return _0x1cc09e&&_0x1cc09e[_0xabe5('0x8c')]===_0xabe5('0xb3')&&_0x1cc09e[_0xabe5('0xc0')];});if(_0xa399a8){if(this[_0xabe5('0x1b')][_0xdc325e[_0xabe5('0xbf')]])this['channels'][_0xdc325e[_0xabe5('0xbf')]][_0xabe5('0xa6')]='ATTENDED';if(this['channels'][_0xdc325e[_0xabe5('0xc1')]])this['channels'][_0xdc325e['origtransfererlinkedid']][_0xabe5('0xa6')]='ATTENDED';this['channels'][_0xdc325e['secondtransfereruniqueid']][_0xabe5('0xa6')]='ATTENDED';}}}}catch(_0x3f00b9){logger[_0xabe5('0x49')](_0xabe5('0xc2'),_0xdc325e['uniqueid'],util[_0xabe5('0x3b')](_0x3f00b9,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xabe5('0xc3')]=function(_0x343a0d){try{if(this['isNotNull'](_0x343a0d)){logger[_0xabe5('0x2d')]('[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x343a0d[_0xabe5('0x37')],_0x343a0d[_0xabe5('0xc4')],_0x343a0d[_0xabe5('0xc5')]);logger[_0xabe5('0x56')](_0xabe5('0xc6'),_0x343a0d[_0xabe5('0x37')],util['inspect'](_0x343a0d,{'showHidden':![],'depth':null}));if(this[_0xabe5('0x1b')][_0x343a0d[_0xabe5('0xba')]]){this[_0xabe5('0x1b')][_0x343a0d[_0xabe5('0xba')]][_0xabe5('0xbb')]=_0x343a0d['transfereecalleridnum'];this[_0xabe5('0x1b')][_0x343a0d[_0xabe5('0xba')]][_0xabe5('0xbc')]=_0x343a0d['extension'];this[_0xabe5('0x1b')][_0x343a0d['transfereeuniqueid']]['transferType']='BLIND';this[_0xabe5('0x24')]({'event':'BlindTransfer','uniqueid':_0x343a0d[_0xabe5('0xba')],'context':_0x343a0d[_0xabe5('0x4e')],'channel':_0x343a0d['transfererchannel']});}else{this['channels'][_0x343a0d['transfereruniqueid']][_0xabe5('0xa6')]=_0xabe5('0xc7');}}}catch(_0xcdcb1a){logger[_0xabe5('0x49')](_0xabe5('0xc8'),_0x343a0d[_0xabe5('0x37')],util[_0xabe5('0x3b')](_0xcdcb1a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabe5('0x33')][_0xabe5('0x2a')]=function(_0xdfd02d){try{if(this['isNotNull'](_0xdfd02d)){logger[_0xabe5('0x56')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0xdfd02d[_0xabe5('0x37')],util[_0xabe5('0x3b')](_0xdfd02d,{'showHidden':![],'depth':null}));if(this['channels'][_0xdfd02d[_0xabe5('0x37')]]){if(!_[_0xabe5('0x7d')](this[_0xabe5('0x1b')][_0xdfd02d[_0xabe5('0x37')]][_0xabe5('0x6a')])){this[_0xabe5('0x1b')][_0xdfd02d['uniqueid']][_0xabe5('0xc9')]=moment()['format'](_0xabe5('0x50'));logger[_0xabe5('0x2d')](_0xabe5('0xca'),_0xdfd02d[_0xabe5('0x37')],this[_0xabe5('0x1b')][_0xdfd02d[_0xabe5('0x37')]][_0xabe5('0xc9')]);}}}}catch(_0x40f14b){logger[_0xabe5('0x49')](_0xabe5('0xcb'),_0xdfd02d['uniqueid'],util[_0xabe5('0x3b')](_0x40f14b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xabe5('0x33')][_0xabe5('0x2c')]=function(_0x246b5b){try{if(this[_0xabe5('0x35')](_0x246b5b)){logger[_0xabe5('0x56')](_0xabe5('0xcc'),_0x246b5b[_0xabe5('0x37')],util[_0xabe5('0x3b')](_0x246b5b,{'showHidden':![],'depth':null}));if(this['channels'][_0x246b5b[_0xabe5('0x37')]]){if(!_[_0xabe5('0x7d')](this['channels'][_0x246b5b[_0xabe5('0x37')]][_0xabe5('0xc9')])){this[_0xabe5('0x1b')][_0x246b5b[_0xabe5('0x37')]][_0xabe5('0xcd')]+=moment()[_0xabe5('0xce')](0x0)[_0xabe5('0x6c')](this[_0xabe5('0x1b')][_0x246b5b[_0xabe5('0x37')]][_0xabe5('0xc9')],'seconds');logger[_0xabe5('0x2d')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x246b5b['uniqueid'],this['channels'][_0x246b5b['uniqueid']][_0xabe5('0xcd')]);delete this[_0xabe5('0x1b')][_0x246b5b[_0xabe5('0x37')]][_0xabe5('0xc9')];}}}}catch(_0x73e40b){logger[_0xabe5('0x49')](_0xabe5('0xcf'),_0x246b5b['uniqueid'],util[_0xabe5('0x3b')](_0x73e40b,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 5c4676e..7d26242 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1356=['rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberrealtime','isNil','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','holdtime','sumHoldTime','sumBillable','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','appdata','cdr(','applicationdata','split','match','[%s][voiceDialReport][newexten]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','syncDialBegin','bind','dialend','syncDialEnd','varset','newexten','syncNewExten','syncHangup','prototype','emit','isNotNull','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','isUndefined','voice','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:'];(function(_0x1743d8,_0x51da5c){var _0x54cd47=function(_0x8adc58){while(--_0x8adc58){_0x1743d8['push'](_0x1743d8['shift']());}};_0x54cd47(++_0x51da5c);}(_0x1356,0xa1));var _0x6135=function(_0xf06637,_0x2a7d0c){_0xf06637=_0xf06637-0x0;var _0x45991f=_0x1356[_0xf06637];return _0x45991f;};'use strict';var _=require('lodash');var moment=require(_0x6135('0x0'));var util=require(_0x6135('0x1'));var Redis=require(_0x6135('0x2'));var config=require(_0x6135('0x3'));var logger=require(_0x6135('0x4'))(_0x6135('0x5'));var ami=require(_0x6135('0x6'));config[_0x6135('0x7')]=_[_0x6135('0x8')](config[_0x6135('0x7')],{'host':_0x6135('0x9'),'port':0x18eb});var io=require(_0x6135('0xa'))(new Redis(config[_0x6135('0x7')]));function VoiceDialReport(_0x5616be){this[_0x6135('0xb')]=_0x5616be[_0x6135('0xc')];this['outbound']=_0x5616be[_0x6135('0xd')];this[_0x6135('0xe')]={};this[_0x6135('0xf')]={};ami['on']('dialbegin',this[_0x6135('0x10')][_0x6135('0x11')](this));ami['on'](_0x6135('0x12'),this[_0x6135('0x13')][_0x6135('0x11')](this));ami['on'](_0x6135('0x14'),this['syncVarSet'][_0x6135('0x11')](this));ami['on'](_0x6135('0x15'),this[_0x6135('0x16')]['bind'](this));ami['on']('hangup',this[_0x6135('0x17')][_0x6135('0x11')](this));}VoiceDialReport[_0x6135('0x18')]['isNotNull']=function(_0x314dd8){return _0x314dd8!==null&&!_['isUndefined'](_0x314dd8);};VoiceDialReport['prototype'][_0x6135('0x19')]=function(_0x414560,_0x57836c,_0x26ee46){io['to'](_0x414560)[_0x6135('0x19')](_0x57836c,_0x26ee46);};VoiceDialReport[_0x6135('0x18')][_0x6135('0x10')]=function(_0x5a6017){try{if(this[_0x6135('0x1a')](_0x5a6017)){logger[_0x6135('0x1b')](_0x6135('0x1c'),_0x5a6017[_0x6135('0x1d')],util[_0x6135('0x1e')](_0x5a6017,{'showHidden':![],'depth':null}));if(this['channels'][_0x5a6017[_0x6135('0x1d')]]){_[_0x6135('0x1f')](this[_0x6135('0xb')][_0x5a6017[_0x6135('0x1d')]],{'starttime':moment()[_0x6135('0x20')](_0x6135('0x21')),'lastevent':_0x6135('0x22'),'interface':_0x5a6017[_0x6135('0x23')][_0x6135('0x24')](0x0,_0x5a6017[_0x6135('0x23')][_0x6135('0x25')]('-')),'membername':_0x5a6017[_0x6135('0x23')][_0x6135('0x24')](_0x5a6017[_0x6135('0x23')]['lastIndexOf']('/')+0x1,_0x5a6017[_0x6135('0x23')][_0x6135('0x25')]('-'))},_[_0x6135('0x26')](_0x5a6017,[_0x6135('0x27'),_0x6135('0x28')]));logger[_0x6135('0x29')](_0x6135('0x2a'),_0x5a6017[_0x6135('0x1d')],this[_0x6135('0xb')][_0x5a6017[_0x6135('0x1d')]][_0x6135('0x2b')],this[_0x6135('0xb')][_0x5a6017[_0x6135('0x1d')]][_0x6135('0x2c')]);logger['debug'](_0x6135('0x2d'),_0x5a6017[_0x6135('0x1d')],util[_0x6135('0x1e')](this['channels'][_0x5a6017['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0x6135('0xe')][_0x5a6017['uniqueid']])_[_0x6135('0x1f')](this[_0x6135('0xb')][_0x5a6017['uniqueid']],this[_0x6135('0xe')][_0x5a6017['uniqueid']]);this['emit'](_0x6135('0x2e'),_0x6135('0x2f'),this[_0x6135('0xb')][_0x5a6017[_0x6135('0x1d')]]);logger[_0x6135('0x1b')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x5a6017[_0x6135('0x1d')],util[_0x6135('0x1e')](this[_0x6135('0xb')][_0x5a6017[_0x6135('0x1d')]],{'showHidden':![],'depth':null}));ami['emit'](_0x6135('0x30'),this['channels'][_0x5a6017[_0x6135('0x1d')]]);}}}catch(_0x1b01b7){logger[_0x6135('0x31')](_0x6135('0x32'),_0x5a6017[_0x6135('0x1d')],util[_0x6135('0x1e')](_0x1b01b7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6135('0x18')][_0x6135('0x13')]=function(_0x1fdfea){try{if(this[_0x6135('0x1a')](_0x1fdfea)){logger[_0x6135('0x1b')]('[%s][voiceDialReport][dialend]\x20event:',_0x1fdfea[_0x6135('0x1d')],util[_0x6135('0x1e')](_0x1fdfea,{'showHidden':![],'depth':null}));if(this[_0x6135('0xb')][_0x1fdfea[_0x6135('0x1d')]]){this[_0x6135('0xb')][_0x1fdfea[_0x6135('0x1d')]]['dialstatus']=_0x1fdfea['dialstatus'];if(_0x1fdfea[_0x6135('0x33')]===_0x6135('0x34')){this[_0x6135('0xb')][_0x1fdfea['uniqueid']]['connectedlinenum']=_0x1fdfea[_0x6135('0x35')];this['channels'][_0x1fdfea['uniqueid']][_0x6135('0x36')]=_0x1fdfea[_0x6135('0x36')];this[_0x6135('0xb')][_0x1fdfea['uniqueid']][_0x6135('0x37')]=moment()[_0x6135('0x20')](_0x6135('0x21'));this[_0x6135('0xb')][_0x1fdfea[_0x6135('0x1d')]][_0x6135('0x38')]=_0x6135('0x39');logger[_0x6135('0x29')](_0x6135('0x3a'),_0x1fdfea[_0x6135('0x1d')],_0x1fdfea[_0x6135('0x23')][_0x6135('0x24')](_0x1fdfea['channel']['lastIndexOf']('/')+0x1,_0x1fdfea[_0x6135('0x23')][_0x6135('0x25')]('-')));logger[_0x6135('0x1b')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x1fdfea['uniqueid'],util['inspect'](this[_0x6135('0xb')][_0x1fdfea[_0x6135('0x1d')]],{'showHidden':![],'depth':null}));ami[_0x6135('0x19')](_0x6135('0x3b'),this['channels'][_0x1fdfea[_0x6135('0x1d')]]);}logger[_0x6135('0x1b')](_0x6135('0x3c'),_0x1fdfea['uniqueid'],util['inspect'](this[_0x6135('0xb')][_0x1fdfea[_0x6135('0x1d')]],{'showHidden':![],'depth':null}));this[_0x6135('0x19')](_0x6135('0x2e'),_0x6135('0x2f'),this[_0x6135('0xb')][_0x1fdfea[_0x6135('0x1d')]]);}}}catch(_0x52019a){logger[_0x6135('0x31')](_0x6135('0x3d'),_0x1fdfea[_0x6135('0x1d')],util[_0x6135('0x1e')](_0x52019a,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x54b071){try{if(this[_0x6135('0x1a')](_0x54b071)){logger[_0x6135('0x1b')](_0x6135('0x3e'),_0x54b071['uniqueid'],util[_0x6135('0x1e')](_0x54b071,{'showHidden':![],'depth':null}));this[_0x6135('0x3f')](_0x54b071[_0x6135('0x1d')],_[_0x6135('0x40')](_0x54b071[_0x6135('0x41')])[0x0],_0x54b071[_0x6135('0x42')]);if(this[_0x6135('0x1a')](_0x54b071[_0x6135('0x41')])&&this[_0x6135('0x1a')](_0x54b071[_0x6135('0x41')][_0x6135('0x43')])){if(_[_0x6135('0x44')](this[_0x6135('0xb')][_0x54b071[_0x6135('0x1d')]])){this[_0x6135('0xb')][_0x54b071[_0x6135('0x1d')]]={'routeId':_0x54b071[_0x6135('0x42')],'variables':this['variables'][_0x54b071['uniqueid']],'motionChannel':_0x6135('0x45')};logger[_0x6135('0x29')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x54b071['uniqueid'],_0x54b071[_0x6135('0x41')]['outboundrouteid'],_[_0x6135('0x40')](_0x54b071[_0x6135('0x41')])[0x0],_0x54b071[_0x6135('0x42')]);logger['debug'](_0x6135('0x46'),_0x54b071[_0x6135('0x1d')],util[_0x6135('0x1e')](this[_0x6135('0xb')][_0x54b071[_0x6135('0x1d')]],{'showHidden':![],'depth':null}));this[_0x6135('0x19')]('voice:outbound',_0x6135('0x2f'),this[_0x6135('0xb')][_0x54b071[_0x6135('0x1d')]]);}}}}catch(_0x3b003e){logger['error']('[%s][voiceDialReport][varset]',_0x54b071[_0x6135('0x1d')],util[_0x6135('0x1e')](_0x3b003e,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x6135('0x3f')]=function(_0xe5c182,_0x3175da,_0x398010){var _0x4d3a5b=[_0x6135('0x47'),_0x6135('0x48'),'rtpaudioqosjitter',_0x6135('0x49'),_0x6135('0x4a'),'rtpaudioqoslossbridged',_0x6135('0x4b'),'rtpaudioqosrttbridged','sipcallid',_0x6135('0x4c'),_0x6135('0x4d'),_0x6135('0x4e'),'membercalls',_0x6135('0x4f'),_0x6135('0x50'),'memberlastcall',_0x6135('0x2b'),'memberpenalty',_0x6135('0x51')];if(!_[_0x6135('0x52')](_0x3175da)&&!_['includes'](_0x4d3a5b,_0x3175da)){if(_[_0x6135('0x44')](this['variables'][_0xe5c182])){this[_0x6135('0xf')][_0xe5c182]={};}this[_0x6135('0xf')][_0xe5c182][_0x3175da]=_0x398010;}};VoiceDialReport[_0x6135('0x18')][_0x6135('0x17')]=function(_0x26e137){try{if(this[_0x6135('0x1a')](_0x26e137)){logger[_0x6135('0x1b')]('[%s][voiceDialReport][hangup]\x20event:',_0x26e137[_0x6135('0x1d')],util[_0x6135('0x1e')](_0x26e137,{'showHidden':![],'depth':null}));if(this[_0x6135('0xb')][_0x26e137[_0x6135('0x1d')]]){logger['info']('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x26e137['uniqueid'],_0x26e137[_0x6135('0x53')]);this[_0x6135('0xb')][_0x26e137['uniqueid']][_0x6135('0x54')]=moment()[_0x6135('0x20')](_0x6135('0x21'));this[_0x6135('0xb')][_0x26e137[_0x6135('0x1d')]][_0x6135('0x55')]=moment(this[_0x6135('0xb')][_0x26e137[_0x6135('0x1d')]]['endtime'])[_0x6135('0x56')](this[_0x6135('0xb')][_0x26e137[_0x6135('0x1d')]][_0x6135('0x57')],_0x6135('0x58'));this[_0x6135('0xb')][_0x26e137[_0x6135('0x1d')]][_0x6135('0x38')]=_0x6135('0x59');this[_0x6135('0xd')][_0x6135('0x5a')]+=0x1;if(this[_0x6135('0xb')][_0x26e137[_0x6135('0x1d')]][_0x6135('0x37')]){this[_0x6135('0xd')]['answered']+=0x1;this['channels'][_0x26e137['uniqueid']][_0x6135('0x5b')]=moment(this['channels'][_0x26e137[_0x6135('0x1d')]][_0x6135('0x37')])[_0x6135('0x56')](this['channels'][_0x26e137[_0x6135('0x1d')]][_0x6135('0x57')],_0x6135('0x58'));this[_0x6135('0xb')][_0x26e137[_0x6135('0x1d')]]['billableseconds']=moment(this[_0x6135('0xb')][_0x26e137[_0x6135('0x1d')]]['endtime'])[_0x6135('0x56')](this['channels'][_0x26e137[_0x6135('0x1d')]]['answertime'],_0x6135('0x58'));this[_0x6135('0xd')][_0x6135('0x5c')]+=this[_0x6135('0xb')][_0x26e137[_0x6135('0x1d')]]['holdtime']||0x0;this[_0x6135('0xd')][_0x6135('0x5d')]+=this['channels'][_0x26e137[_0x6135('0x1d')]][_0x6135('0x5e')];}this['outbound'][_0x6135('0x5f')]+=this['channels'][_0x26e137[_0x6135('0x1d')]][_0x6135('0x55')];logger[_0x6135('0x1b')](_0x6135('0x60'),_0x26e137[_0x6135('0x1d')],util[_0x6135('0x1e')](this['channels'][_0x26e137[_0x6135('0x1d')]],{'showHidden':![],'depth':null}));ami[_0x6135('0x19')](_0x6135('0x61'),this[_0x6135('0xb')][_0x26e137['uniqueid']]);logger[_0x6135('0x1b')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x26e137[_0x6135('0x1d')],util[_0x6135('0x1e')](this['channels'][_0x26e137[_0x6135('0x1d')]],{'showHidden':![],'depth':null}));ami[_0x6135('0x19')]('custom:dialend',this[_0x6135('0xb')][_0x26e137[_0x6135('0x1d')]]);logger[_0x6135('0x1b')](_0x6135('0x62'),_0x26e137[_0x6135('0x1d')],util[_0x6135('0x1e')](this[_0x6135('0xb')][_0x26e137['uniqueid']],{'showHidden':![],'depth':null}));this[_0x6135('0x19')](_0x6135('0x2e'),'voice_outbound:save',this[_0x6135('0xd')]);logger[_0x6135('0x29')](_0x6135('0x63'),JSON[_0x6135('0x64')](this[_0x6135('0xb')][_0x26e137[_0x6135('0x1d')]]));logger[_0x6135('0x1b')](_0x6135('0x65'),_0x26e137[_0x6135('0x1d')],util[_0x6135('0x1e')](this[_0x6135('0xb')][_0x26e137[_0x6135('0x1d')]],{'showHidden':![],'depth':null}));this[_0x6135('0x19')]('voice:outbound',_0x6135('0x66'),this['channels'][_0x26e137[_0x6135('0x1d')]]);delete this[_0x6135('0xb')][_0x26e137[_0x6135('0x1d')]];}else if(this[_0x6135('0xb')][_0x26e137['linkedid']]){this[_0x6135('0xb')][_0x26e137[_0x6135('0x67')]][_0x6135('0x1d')]=this[_0x6135('0xb')][_0x26e137[_0x6135('0x67')]][_0x6135('0x68')];}if(this['variables'][_0x26e137[_0x6135('0x1d')]]){delete this['variables'][_0x26e137['uniqueid']];}}}catch(_0x8ec957){logger[_0x6135('0x31')]('[%s][voiceDialReport][hangup]',_0x26e137['uniqueid'],util[_0x6135('0x1e')](_0x8ec957,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6135('0x18')][_0x6135('0x16')]=function(_0x27d2fb){try{if(this[_0x6135('0x1a')](_0x27d2fb)){logger[_0x6135('0x1b')](_0x6135('0x69'),_0x27d2fb[_0x6135('0x1d')],util['inspect'](_0x27d2fb,{'showHidden':![],'depth':null}));if(_0x27d2fb[_0x6135('0x6a')][_0x6135('0x6b')]()===_0x6135('0x6c')){_0x27d2fb['applicationdata']=(_0x27d2fb[_0x6135('0x6d')]||_0x27d2fb['applicationdata'])['toLowerCase']();if(_['startsWith'](_0x27d2fb['applicationdata'],_0x6135('0x6e'))){if(_[_0x6135('0x44')](this[_0x6135('0xe')][_0x27d2fb[_0x6135('0x1d')]]))this['applications'][_0x27d2fb[_0x6135('0x1d')]]={};logger[_0x6135('0x29')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x27d2fb[_0x6135('0x1d')],_0x27d2fb[_0x6135('0x6a')],_0x27d2fb[_0x6135('0x6f')]);var _0x3af5b9=_0x27d2fb[_0x6135('0x6f')][_0x6135('0x70')]('=');var _0x22a5e7=_0x3af5b9[0x0][_0x6135('0x71')](/cdr\((.*)\)/);if(_0x22a5e7)this['applications'][_0x27d2fb['uniqueid']][_0x22a5e7[0x1]]=_0x3af5b9[0x1];}}}}catch(_0x2551fc){logger[_0x6135('0x31')](_0x6135('0x72'),_0x27d2fb[_0x6135('0x1d')],util[_0x6135('0x1e')](_0x2551fc,{'showHidden':![],'depth':null}));}};module[_0x6135('0x73')]=VoiceDialReport; \ No newline at end of file +var _0xfefa=['../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','channels','outbound','applications','variables','dialbegin','syncDialBegin','dialend','syncDialEnd','bind','varset','syncVarSet','newexten','syncNewExten','hangup','prototype','isNotNull','emit','debug','uniqueid','inspect','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','merge','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','error','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','voice','outboundrouteid','value','[%s][voiceDialReport][varset]','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','duration','diff','starttime','seconds','complete','answertime','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','cdr(','isUndefined','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','exports','lodash','moment','util','ioredis'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xfefa,0x158));var _0xafef=function(_0x2fe691,_0x1a85ed){_0x2fe691=_0x2fe691-0x0;var _0x49cb1d=_0xfefa[_0x2fe691];return _0x49cb1d;};'use strict';var _=require(_0xafef('0x0'));var moment=require(_0xafef('0x1'));var util=require(_0xafef('0x2'));var Redis=require(_0xafef('0x3'));var config=require(_0xafef('0x4'));var logger=require(_0xafef('0x5'))(_0xafef('0x6'));var ami=require(_0xafef('0x7'));config[_0xafef('0x8')]=_['defaults'](config[_0xafef('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xafef('0x9'))(new Redis(config[_0xafef('0x8')]));function VoiceDialReport(_0x2a9705){this[_0xafef('0xa')]=_0x2a9705['outboundChannels'];this[_0xafef('0xb')]=_0x2a9705[_0xafef('0xb')];this[_0xafef('0xc')]={};this[_0xafef('0xd')]={};ami['on'](_0xafef('0xe'),this[_0xafef('0xf')]['bind'](this));ami['on'](_0xafef('0x10'),this[_0xafef('0x11')][_0xafef('0x12')](this));ami['on'](_0xafef('0x13'),this[_0xafef('0x14')]['bind'](this));ami['on'](_0xafef('0x15'),this[_0xafef('0x16')][_0xafef('0x12')](this));ami['on'](_0xafef('0x17'),this['syncHangup'][_0xafef('0x12')](this));}VoiceDialReport[_0xafef('0x18')][_0xafef('0x19')]=function(_0x477177){return _0x477177!==null&&!_['isUndefined'](_0x477177);};VoiceDialReport[_0xafef('0x18')][_0xafef('0x1a')]=function(_0x58b43d,_0x293d3f,_0x233f7e){io['to'](_0x58b43d)[_0xafef('0x1a')](_0x293d3f,_0x233f7e);};VoiceDialReport[_0xafef('0x18')][_0xafef('0xf')]=function(_0x45ec02){try{if(this['isNotNull'](_0x45ec02)){logger[_0xafef('0x1b')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x45ec02[_0xafef('0x1c')],util[_0xafef('0x1d')](_0x45ec02,{'showHidden':![],'depth':null}));if(this['channels'][_0x45ec02['uniqueid']]){_['merge'](this[_0xafef('0xa')][_0x45ec02[_0xafef('0x1c')]],{'starttime':moment()[_0xafef('0x1e')](_0xafef('0x1f')),'lastevent':'called','interface':_0x45ec02[_0xafef('0x20')][_0xafef('0x21')](0x0,_0x45ec02[_0xafef('0x20')][_0xafef('0x22')]('-')),'membername':_0x45ec02['channel'][_0xafef('0x21')](_0x45ec02['channel']['lastIndexOf']('/')+0x1,_0x45ec02[_0xafef('0x20')][_0xafef('0x22')]('-'))},_[_0xafef('0x23')](_0x45ec02,['event',_0xafef('0x24')]));logger[_0xafef('0x25')](_0xafef('0x26'),_0x45ec02[_0xafef('0x1c')],this[_0xafef('0xa')][_0x45ec02[_0xafef('0x1c')]][_0xafef('0x27')],this['channels'][_0x45ec02['uniqueid']][_0xafef('0x28')]);logger[_0xafef('0x1b')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x45ec02[_0xafef('0x1c')],util[_0xafef('0x1d')](this[_0xafef('0xa')][_0x45ec02['uniqueid']],{'showHidden':![],'depth':null}));if(this[_0xafef('0xc')][_0x45ec02[_0xafef('0x1c')]])_[_0xafef('0x29')](this[_0xafef('0xa')][_0x45ec02[_0xafef('0x1c')]],this[_0xafef('0xc')][_0x45ec02[_0xafef('0x1c')]]);this[_0xafef('0x1a')](_0xafef('0x2a'),_0xafef('0x2b'),this[_0xafef('0xa')][_0x45ec02[_0xafef('0x1c')]]);logger[_0xafef('0x1b')](_0xafef('0x2c'),_0x45ec02['uniqueid'],util[_0xafef('0x1d')](this['channels'][_0x45ec02['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xafef('0x1a')](_0xafef('0x2d'),this[_0xafef('0xa')][_0x45ec02[_0xafef('0x1c')]]);}}}catch(_0x3d6fbc){logger['error']('[%s][voiceDialReport][dialbegin]',_0x45ec02[_0xafef('0x1c')],util['inspect'](_0x3d6fbc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xafef('0x18')][_0xafef('0x11')]=function(_0x1849a0){try{if(this[_0xafef('0x19')](_0x1849a0)){logger[_0xafef('0x1b')](_0xafef('0x2e'),_0x1849a0['uniqueid'],util['inspect'](_0x1849a0,{'showHidden':![],'depth':null}));if(this[_0xafef('0xa')][_0x1849a0[_0xafef('0x1c')]]){this[_0xafef('0xa')][_0x1849a0[_0xafef('0x1c')]][_0xafef('0x2f')]=_0x1849a0[_0xafef('0x2f')];if(_0x1849a0[_0xafef('0x2f')]===_0xafef('0x30')){this[_0xafef('0xa')][_0x1849a0[_0xafef('0x1c')]][_0xafef('0x31')]=_0x1849a0[_0xafef('0x31')];this[_0xafef('0xa')][_0x1849a0['uniqueid']][_0xafef('0x32')]=_0x1849a0[_0xafef('0x32')];this[_0xafef('0xa')][_0x1849a0['uniqueid']]['answertime']=moment()['format'](_0xafef('0x1f'));this[_0xafef('0xa')][_0x1849a0[_0xafef('0x1c')]][_0xafef('0x33')]=_0xafef('0x34');logger[_0xafef('0x25')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x1849a0[_0xafef('0x1c')],_0x1849a0[_0xafef('0x20')][_0xafef('0x21')](_0x1849a0['channel']['lastIndexOf']('/')+0x1,_0x1849a0[_0xafef('0x20')][_0xafef('0x22')]('-')));logger[_0xafef('0x1b')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x1849a0[_0xafef('0x1c')],util['inspect'](this[_0xafef('0xa')][_0x1849a0[_0xafef('0x1c')]],{'showHidden':![],'depth':null}));ami[_0xafef('0x1a')](_0xafef('0x35'),this['channels'][_0x1849a0[_0xafef('0x1c')]]);}logger[_0xafef('0x1b')](_0xafef('0x36'),_0x1849a0[_0xafef('0x1c')],util[_0xafef('0x1d')](this['channels'][_0x1849a0[_0xafef('0x1c')]],{'showHidden':![],'depth':null}));this[_0xafef('0x1a')](_0xafef('0x2a'),_0xafef('0x2b'),this['channels'][_0x1849a0['uniqueid']]);}}}catch(_0x1832ac){logger[_0xafef('0x37')](_0xafef('0x38'),_0x1849a0[_0xafef('0x1c')],util[_0xafef('0x1d')](_0x1832ac,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xafef('0x18')]['syncVarSet']=function(_0x368fdc){try{if(this[_0xafef('0x19')](_0x368fdc)){logger[_0xafef('0x1b')](_0xafef('0x39'),_0x368fdc[_0xafef('0x1c')],util[_0xafef('0x1d')](_0x368fdc,{'showHidden':![],'depth':null}));this[_0xafef('0x3a')](_0x368fdc[_0xafef('0x1c')],_[_0xafef('0x3b')](_0x368fdc[_0xafef('0x3c')])[0x0],_0x368fdc['value']);if(this[_0xafef('0x19')](_0x368fdc[_0xafef('0x3c')])&&this[_0xafef('0x19')](_0x368fdc['variable']['outboundrouteid'])){if(_['isUndefined'](this[_0xafef('0xa')][_0x368fdc['uniqueid']])){this[_0xafef('0xa')][_0x368fdc[_0xafef('0x1c')]]={'routeId':_0x368fdc['value'],'variables':this['variables'][_0x368fdc[_0xafef('0x1c')]],'motionChannel':_0xafef('0x3d')};logger[_0xafef('0x25')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x368fdc[_0xafef('0x1c')],_0x368fdc['variable'][_0xafef('0x3e')],_[_0xafef('0x3b')](_0x368fdc[_0xafef('0x3c')])[0x0],_0x368fdc[_0xafef('0x3f')]);logger[_0xafef('0x1b')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x368fdc[_0xafef('0x1c')],util[_0xafef('0x1d')](this[_0xafef('0xa')][_0x368fdc['uniqueid']],{'showHidden':![],'depth':null}));this[_0xafef('0x1a')](_0xafef('0x2a'),'voice_outbound_channel:save',this[_0xafef('0xa')][_0x368fdc[_0xafef('0x1c')]]);}}}}catch(_0x158e94){logger[_0xafef('0x37')](_0xafef('0x40'),_0x368fdc[_0xafef('0x1c')],util[_0xafef('0x1d')](_0x158e94,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xafef('0x18')]['addVariable']=function(_0x3f3013,_0x27a52c,_0x323fa8){var _0x5f14dd=['rtpaudioqos',_0xafef('0x41'),'rtpaudioqosjitter',_0xafef('0x42'),'rtpaudioqosloss',_0xafef('0x43'),'rtpaudioqosrtt',_0xafef('0x44'),_0xafef('0x45'),_0xafef('0x46'),'bridgepeer',_0xafef('0x47'),_0xafef('0x48'),_0xafef('0x49'),_0xafef('0x4a'),_0xafef('0x4b'),_0xafef('0x27'),'memberpenalty',_0xafef('0x4c')];if(!_[_0xafef('0x4d')](_0x27a52c)&&!_[_0xafef('0x4e')](_0x5f14dd,_0x27a52c)){if(_['isUndefined'](this[_0xafef('0xd')][_0x3f3013])){this[_0xafef('0xd')][_0x3f3013]={};}this['variables'][_0x3f3013][_0x27a52c]=_0x323fa8;}};VoiceDialReport['prototype'][_0xafef('0x4f')]=function(_0x5f3d83){try{if(this[_0xafef('0x19')](_0x5f3d83)){logger['debug'](_0xafef('0x50'),_0x5f3d83[_0xafef('0x1c')],util[_0xafef('0x1d')](_0x5f3d83,{'showHidden':![],'depth':null}));if(this[_0xafef('0xa')][_0x5f3d83[_0xafef('0x1c')]]){logger['info']('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x5f3d83['uniqueid'],_0x5f3d83[_0xafef('0x51')]);this[_0xafef('0xa')][_0x5f3d83[_0xafef('0x1c')]][_0xafef('0x52')]=moment()[_0xafef('0x1e')](_0xafef('0x1f'));this['channels'][_0x5f3d83[_0xafef('0x1c')]][_0xafef('0x53')]=moment(this[_0xafef('0xa')][_0x5f3d83[_0xafef('0x1c')]][_0xafef('0x52')])[_0xafef('0x54')](this[_0xafef('0xa')][_0x5f3d83[_0xafef('0x1c')]][_0xafef('0x55')],_0xafef('0x56'));this[_0xafef('0xa')][_0x5f3d83[_0xafef('0x1c')]][_0xafef('0x33')]=_0xafef('0x57');this[_0xafef('0xb')]['total']+=0x1;if(this[_0xafef('0xa')][_0x5f3d83[_0xafef('0x1c')]][_0xafef('0x58')]){this[_0xafef('0xb')][_0xafef('0x59')]+=0x1;this[_0xafef('0xa')][_0x5f3d83['uniqueid']][_0xafef('0x5a')]=moment(this['channels'][_0x5f3d83[_0xafef('0x1c')]]['answertime'])['diff'](this['channels'][_0x5f3d83['uniqueid']][_0xafef('0x55')],_0xafef('0x56'));this['channels'][_0x5f3d83[_0xafef('0x1c')]][_0xafef('0x5b')]=moment(this[_0xafef('0xa')][_0x5f3d83['uniqueid']][_0xafef('0x52')])['diff'](this['channels'][_0x5f3d83['uniqueid']][_0xafef('0x58')],_0xafef('0x56'));this['outbound'][_0xafef('0x5c')]+=this[_0xafef('0xa')][_0x5f3d83['uniqueid']][_0xafef('0x5a')]||0x0;this['outbound'][_0xafef('0x5d')]+=this[_0xafef('0xa')][_0x5f3d83[_0xafef('0x1c')]]['billableseconds'];}this['outbound'][_0xafef('0x5e')]+=this[_0xafef('0xa')][_0x5f3d83['uniqueid']][_0xafef('0x53')];logger['debug'](_0xafef('0x5f'),_0x5f3d83[_0xafef('0x1c')],util['inspect'](this[_0xafef('0xa')][_0x5f3d83[_0xafef('0x1c')]],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceDialReport',this[_0xafef('0xa')][_0x5f3d83[_0xafef('0x1c')]]);logger[_0xafef('0x1b')](_0xafef('0x60'),_0x5f3d83[_0xafef('0x1c')],util[_0xafef('0x1d')](this[_0xafef('0xa')][_0x5f3d83['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xafef('0x61'),this[_0xafef('0xa')][_0x5f3d83[_0xafef('0x1c')]]);logger[_0xafef('0x1b')](_0xafef('0x62'),_0x5f3d83[_0xafef('0x1c')],util[_0xafef('0x1d')](this[_0xafef('0xa')][_0x5f3d83[_0xafef('0x1c')]],{'showHidden':![],'depth':null}));this[_0xafef('0x1a')](_0xafef('0x2a'),_0xafef('0x63'),this[_0xafef('0xb')]);logger[_0xafef('0x25')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0xafef('0x64')](this[_0xafef('0xa')][_0x5f3d83[_0xafef('0x1c')]]));logger[_0xafef('0x1b')](_0xafef('0x65'),_0x5f3d83[_0xafef('0x1c')],util['inspect'](this[_0xafef('0xa')][_0x5f3d83[_0xafef('0x1c')]],{'showHidden':![],'depth':null}));this[_0xafef('0x1a')](_0xafef('0x2a'),_0xafef('0x66'),this[_0xafef('0xa')][_0x5f3d83[_0xafef('0x1c')]]);delete this[_0xafef('0xa')][_0x5f3d83['uniqueid']];}else if(this['channels'][_0x5f3d83[_0xafef('0x67')]]){this[_0xafef('0xa')][_0x5f3d83['linkedid']][_0xafef('0x1c')]=this['channels'][_0x5f3d83[_0xafef('0x67')]][_0xafef('0x68')];}if(this[_0xafef('0xd')][_0x5f3d83[_0xafef('0x1c')]]){delete this['variables'][_0x5f3d83['uniqueid']];}}}catch(_0x19c15f){logger[_0xafef('0x37')]('[%s][voiceDialReport][hangup]',_0x5f3d83[_0xafef('0x1c')],util['inspect'](_0x19c15f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xafef('0x18')][_0xafef('0x16')]=function(_0x4d91b3){try{if(this['isNotNull'](_0x4d91b3)){logger[_0xafef('0x1b')](_0xafef('0x69'),_0x4d91b3[_0xafef('0x1c')],util[_0xafef('0x1d')](_0x4d91b3,{'showHidden':![],'depth':null}));if(_0x4d91b3[_0xafef('0x6a')][_0xafef('0x6b')]()==='set'){_0x4d91b3[_0xafef('0x6c')]=(_0x4d91b3[_0xafef('0x6d')]||_0x4d91b3[_0xafef('0x6c')])[_0xafef('0x6b')]();if(_['startsWith'](_0x4d91b3[_0xafef('0x6c')],_0xafef('0x6e'))){if(_[_0xafef('0x6f')](this['applications'][_0x4d91b3[_0xafef('0x1c')]]))this['applications'][_0x4d91b3['uniqueid']]={};logger[_0xafef('0x25')](_0xafef('0x70'),_0x4d91b3[_0xafef('0x1c')],_0x4d91b3[_0xafef('0x6a')],_0x4d91b3[_0xafef('0x6c')]);var _0x403c32=_0x4d91b3['applicationdata'][_0xafef('0x71')]('=');var _0x48caf9=_0x403c32[0x0][_0xafef('0x72')](/cdr\((.*)\)/);if(_0x48caf9)this['applications'][_0x4d91b3[_0xafef('0x1c')]][_0x48caf9[0x1]]=_0x403c32[0x1];}}}}catch(_0x5f257e){logger[_0xafef('0x37')]('[%s][voiceDialReport][newexten]',_0x4d91b3[_0xafef('0x1c')],util[_0xafef('0x1d')](_0x5f257e,{'showHidden':![],'depth':null}));}};module[_0xafef('0x73')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 48fc603..03320a3 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4ea3=['queuecallercompleteAt','holdtime','originalposition','queuecallerexitreason','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','syncAgentComplete','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','assigned','membername','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','addVariable','variable','value','queuestatus','TIMEOUT','timeout','custom:timeout','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceQueueReport][hangup]','length','diff','milliseconds','total','custom:queuecallerunmanaged','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','ATTENDED','origtransfereruniqueid','BLIND','extension','syncHangup','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][newexten]\x20event:','application','set','applicationdata','appdata','CDR(routeAlias)','match','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','md5','../../../config/environment','ami','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','agents','channels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','waiting','queueStatusComplete','sequence','isNil','Action','channel','message','error','[%s][voiceQueueReport][checkChannel]','[%s][voiceQueueReport][checkQueueReport]','inspect','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','queueReports','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','name','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','clearZombieChannels','catch','then','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','talking','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','push','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete'];(function(_0x136215,_0x4ec1d1){var _0x58eef6=function(_0x48e50d){while(--_0x48e50d){_0x136215['push'](_0x136215['shift']());}};_0x58eef6(++_0x4ec1d1);}(_0x4ea3,0x70));var _0x34ea=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x4ea3[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x34ea('0x0'));var moment=require(_0x34ea('0x1'));var util=require(_0x34ea('0x2'));var md5=require(_0x34ea('0x3'));var Redis=require('ioredis');var config=require(_0x34ea('0x4'));var logger=require('../../../config/logger')(_0x34ea('0x5'));var ami=require('../ami');var QueueReport=require('../model/queueReport');config[_0x34ea('0x6')]=_[_0x34ea('0x7')](config[_0x34ea('0x6')],{'host':_0x34ea('0x8'),'port':0x18eb});var io=require(_0x34ea('0x9'))(new Redis(config[_0x34ea('0x6')]));var Sequence=function(){};Sequence[_0x34ea('0xa')]['enqueue']=function(_0x341727){this[_0x34ea('0xb')]=this[_0x34ea('0xb')]?this['tail'][_0x34ea('0xc')](_0x341727):_0x341727();};function VoiceQueueReport(_0xea1be2){this['sequence']=new Sequence();this['queueReports']={};this[_0x34ea('0xd')]=_0xea1be2[_0x34ea('0xd')];this[_0x34ea('0xe')]=_0xea1be2['queueChannels'];this[_0x34ea('0xf')]=_0xea1be2[_0x34ea('0xf')];this[_0x34ea('0x10')]=!![];this[_0x34ea('0x11')]=_0xea1be2[_0x34ea('0x11')];this[_0x34ea('0x12')]={};ami['on'](_0x34ea('0x13'),this[_0x34ea('0x14')][_0x34ea('0x15')](this));ami['on'](_0x34ea('0x16'),this[_0x34ea('0x17')]['bind'](this));ami['on'](_0x34ea('0x18'),this[_0x34ea('0x19')][_0x34ea('0x15')](this));ami['on'](_0x34ea('0x1a'),this[_0x34ea('0x1b')]['bind'](this));ami['on'](_0x34ea('0x1c'),this[_0x34ea('0x1d')][_0x34ea('0x15')](this));ami['on'](_0x34ea('0x1e'),this['syncAgentComplete'][_0x34ea('0x15')](this));ami['on'](_0x34ea('0x1f'),this[_0x34ea('0x20')]['bind'](this));ami['on'](_0x34ea('0x21'),this[_0x34ea('0x22')][_0x34ea('0x15')](this));ami['on'](_0x34ea('0x23'),this['syncHangup'][_0x34ea('0x15')](this));ami['on'](_0x34ea('0x24'),this[_0x34ea('0x25')][_0x34ea('0x15')](this));ami['on']('newexten',this['syncNewExten'][_0x34ea('0x15')](this));ami['on'](_0x34ea('0x26'),this[_0x34ea('0x27')]['bind'](this));ami['on']('musiconholdstop',this[_0x34ea('0x28')][_0x34ea('0x15')](this));ami['on'](_0x34ea('0x29'),this[_0x34ea('0x2a')][_0x34ea('0x15')](this));ami['on'](_0x34ea('0x2b'),this['syncBlindTransfer'][_0x34ea('0x15')](this));this[_0x34ea('0x2c')]();this[_0x34ea('0x2d')]();}function clearChannels(_0x332f75){if(!_['isEmpty'](_0x332f75)){for(var _0x56f320 in _0x332f75){if(_0x332f75['hasOwnProperty'](_0x56f320)){delete _0x332f75[_0x56f320];}}}}function clearCampaigns(_0x142709){if(!_[_0x34ea('0x2e')](_0x142709)){for(var _0x37c214 in _0x142709){if(_0x142709[_0x34ea('0x2f')](_0x37c214)){_0x142709[_0x37c214]['originated']=0x0;}}}}function clearVoiceQueues(_0x26c80b){if(!_[_0x34ea('0x2e')](_0x26c80b)){for(var _0x27c6f7 in _0x26c80b){if(_0x26c80b['hasOwnProperty'](_0x27c6f7)){_0x26c80b[_0x27c6f7]['originated']=0x0;_0x26c80b[_0x27c6f7]['talking']=0x0;_0x26c80b[_0x27c6f7]['pTalking']=0x0;_0x26c80b[_0x27c6f7][_0x34ea('0x30')]=0x0;_0x26c80b[_0x27c6f7][_0x34ea('0x31')]=!![];}}}}function clearAgentBooked(_0x859b7e){if(!_[_0x34ea('0x2e')](_0x859b7e)){for(var _0x56c9dd in _0x859b7e){if(_0x859b7e[_0x34ea('0x2f')](_0x56c9dd)){_0x859b7e[_0x56c9dd]['unlockRR']=!![];}}}}VoiceQueueReport[_0x34ea('0xa')]['clearZombieChannels']=function(){var _0x3272f9=this;for(var _0x14e018 in this[_0x34ea('0xe')]){if(this['channels'][_0x34ea('0x2f')](_0x14e018)&&!this[_0x34ea('0xe')][_0x14e018]['switch']){this[_0x34ea('0x32')]['enqueue'](function(){if(!_[_0x34ea('0x33')](_0x3272f9[_0x34ea('0xe')][_0x14e018])){return ami[_0x34ea('0x34')]({'action':'status','channel':_0x3272f9['channels'][_0x14e018][_0x34ea('0x35')]})['catch'](function(_0x151fac){if(_0x151fac[_0x34ea('0x36')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x3272f9[_0x34ea('0xe')][_0x14e018]){delete _0x3272f9[_0x34ea('0xe')][_0x14e018];logger[_0x34ea('0x37')](_0x34ea('0x38'),_0x14e018,util['inspect'](_0x151fac,{'showHidden':![],'depth':null}));}if(_0x3272f9['queueReports'][_0x14e018]){delete _0x3272f9['queueReports'][_0x14e018];logger[_0x34ea('0x37')](_0x34ea('0x39'),_0x14e018,util[_0x34ea('0x3a')](_0x151fac,{'showHidden':![],'depth':null}));}if(_0x3272f9['variables'][_0x14e018]){delete _0x3272f9['variables'][_0x14e018];logger['error'](_0x34ea('0x3b'),_0x14e018,util[_0x34ea('0x3a')](_0x151fac,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x34ea('0x25')]=function(){logger[_0x34ea('0x37')](_0x34ea('0x3c'));clearChannels(this[_0x34ea('0xe')]);this[_0x34ea('0x3d')](this[_0x34ea('0x3e')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x34ea('0xf')]);clearCampaigns(this[_0x34ea('0x11')]);};VoiceQueueReport[_0x34ea('0xa')][_0x34ea('0x3d')]=function(_0x4f05fc){var _0x5c44ab=this;if(!_[_0x34ea('0x2e')](_0x4f05fc)){for(var _0x2327bc in _0x4f05fc){if(_0x4f05fc[_0x34ea('0x2f')](_0x2327bc)){_0x5c44ab[_0x34ea('0x3f')](_0x4f05fc[_0x2327bc],_0x34ea('0x40'));delete _0x4f05fc[_0x2327bc];}}}};VoiceQueueReport['prototype'][_0x34ea('0x41')]=function(_0xb19a03,_0x475313,_0x3a6a90){io['to'](_0xb19a03)[_0x34ea('0x41')](_0x475313,_0x3a6a90);};VoiceQueueReport[_0x34ea('0xa')][_0x34ea('0x42')]=function(_0xa1ff39,_0x38d3b0){logger[_0x34ea('0x43')](_0x34ea('0x44')+_0x38d3b0+_0x34ea('0x45'),_0xa1ff39[_0x34ea('0x46')],util[_0x34ea('0x3a')](_0xa1ff39,{'showHidden':![],'depth':null}));this[_0x34ea('0x41')](util[_0x34ea('0x47')]('voice:queue:%s',_0xa1ff39[_0x34ea('0x48')]),'voice_queue_channel:save',_0xa1ff39);io[_0x34ea('0x41')](_0x34ea('0x49'),_0xa1ff39);};VoiceQueueReport[_0x34ea('0xa')][_0x34ea('0x3f')]=function(_0x2a57b5,_0x1b785b){logger[_0x34ea('0x43')](_0x34ea('0x44')+_0x1b785b+_0x34ea('0x4a'),_0x2a57b5['uniqueid'],util[_0x34ea('0x3a')](_0x2a57b5,{'showHidden':![],'depth':null}));this['emit'](util[_0x34ea('0x47')](_0x34ea('0x4b'),_0x2a57b5[_0x34ea('0x48')]),_0x34ea('0x4c'),_0x2a57b5);io[_0x34ea('0x41')](_0x34ea('0x4d'),_0x2a57b5);};VoiceQueueReport['prototype'][_0x34ea('0x4e')]=function(_0x5b5536,_0x53ef44){if(_0x5b5536[_0x34ea('0x4f')]===_0x34ea('0x50')){var _0x324928={'id':_0x5b5536['id'],'name':_0x5b5536[_0x34ea('0x48')],'strategy':_0x5b5536[_0x34ea('0x51')],'answered':_0x5b5536['answered'],'available':_0x5b5536[_0x34ea('0x52')],'loggedIn':_0x5b5536[_0x34ea('0x53')],'pTalking':_0x5b5536[_0x34ea('0x54')],'sumBillable':_0x5b5536[_0x34ea('0x55')],'sumDuration':_0x5b5536[_0x34ea('0x56')],'sumHoldTime':_0x5b5536[_0x34ea('0x57')]||0x0,'talking':_0x5b5536['talking'],'total':_0x5b5536['total'],'type':_0x5b5536[_0x34ea('0x4f')],'unmanaged':_0x5b5536[_0x34ea('0x58')],'abandoned':_0x5b5536[_0x34ea('0x59')],'waiting':_0x5b5536['waiting']};if(_0x5b5536[_0x34ea('0x5a')]){_0x324928['Trunk']={'id':_0x5b5536[_0x34ea('0x5a')]['id'],'name':_0x5b5536['Trunk'][_0x34ea('0x48')],'active':_0x5b5536[_0x34ea('0x5a')][_0x34ea('0x5b')],'callerid':_0x5b5536['Trunk'][_0x34ea('0x5c')]};}if(_0x5b5536['Interval']){_0x324928[_0x34ea('0x5d')]={'id':_0x5b5536[_0x34ea('0x5d')]['id'],'name':_0x5b5536[_0x34ea('0x5d')][_0x34ea('0x48')]};}var _0x5c9f80=md5(JSON[_0x34ea('0x5e')](_0x324928));if(_0x5b5536[_0x34ea('0x3')]!==_0x5c9f80){_0x5b5536[_0x34ea('0x3')]=_0x5c9f80;logger[_0x34ea('0x43')](_0x34ea('0x5f')+_0x53ef44+_0x34ea('0x60'),util[_0x34ea('0x3a')](_0x324928,{'showHidden':![],'depth':null}));this['emit'](util[_0x34ea('0x47')](_0x34ea('0x4b'),_0x324928[_0x34ea('0x48')]),_0x34ea('0x61'),_0x324928);}}};VoiceQueueReport[_0x34ea('0xa')][_0x34ea('0x62')]=function(_0x241b71){return _0x241b71!==null&&!_[_0x34ea('0x63')](_0x241b71);};VoiceQueueReport[_0x34ea('0xa')][_0x34ea('0x2d')]=function(){var _0x2b8990=this;setInterval(function(){_0x2b8990[_0x34ea('0x64')]();ami[_0x34ea('0x34')]({'action':'queues'})[_0x34ea('0x65')](function(_0x3bf855){logger[_0x34ea('0x37')]('[voiceQueueReport][queues]',util[_0x34ea('0x3a')](_0x3bf855,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x34ea('0x2c')]=function(){var _0x1b0629=this;setInterval(function(){if(_0x1b0629['flagQueueSummary']){return ami[_0x34ea('0x34')]({'action':_0x34ea('0x13')})[_0x34ea('0x66')](function(_0x542640){_0x1b0629['flagQueueSummary']=![];})[_0x34ea('0x65')](function(_0x481054){logger['error'](_0x34ea('0x67'),util['inspect'](_0x481054,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x34ea('0xa')][_0x34ea('0x14')]=function(_0x3918c5){try{if(this[_0x34ea('0x62')](_0x3918c5)&&this[_0x34ea('0x62')](_0x3918c5[_0x34ea('0x68')])){logger[_0x34ea('0x43')](_0x34ea('0x69'),util[_0x34ea('0x3a')](_0x3918c5,{'showHidden':![],'depth':null}));if(this[_0x34ea('0xf')][_0x3918c5[_0x34ea('0x68')]]){logger[_0x34ea('0x6a')](_0x34ea('0x6b'),_0x3918c5[_0x34ea('0x68')]);var _0x2fa11f=_[_0x34ea('0x6c')](this['channels'],_0x34ea('0x68'))[_0x3918c5['queue']]||0x0;var _0x1ec07f=_0x2fa11f-_0x3918c5[_0x34ea('0x6d')];if(this[_0x34ea('0xf')][_0x3918c5[_0x34ea('0x68')]][_0x34ea('0x30')]!==_[_0x34ea('0x6e')](_0x3918c5['callers'])||this[_0x34ea('0xf')][_0x3918c5[_0x34ea('0x68')]][_0x34ea('0x53')]!==_[_0x34ea('0x6e')](_0x3918c5[_0x34ea('0x6f')])||this['voiceQueues'][_0x3918c5[_0x34ea('0x68')]]['available']!==_['toNumber'](_0x3918c5['available'])||this[_0x34ea('0xf')][_0x3918c5['queue']][_0x34ea('0x70')]!==_0x1ec07f){this['voiceQueues'][_0x3918c5[_0x34ea('0x68')]]['waiting']=_[_0x34ea('0x6e')](_0x3918c5['callers']);this[_0x34ea('0xf')][_0x3918c5[_0x34ea('0x68')]][_0x34ea('0x53')]=_[_0x34ea('0x6e')](_0x3918c5[_0x34ea('0x6f')]);this['voiceQueues'][_0x3918c5['queue']][_0x34ea('0x52')]=_[_0x34ea('0x6e')](_0x3918c5[_0x34ea('0x52')]);this[_0x34ea('0xf')][_0x3918c5[_0x34ea('0x68')]][_0x34ea('0x70')]=_0x1ec07f>0x0?_0x1ec07f:0x0;this[_0x34ea('0xf')][_0x3918c5[_0x34ea('0x68')]][_0x34ea('0x70')]=this['voiceQueues'][_0x3918c5[_0x34ea('0x68')]][_0x34ea('0x70')]>_[_0x34ea('0x6e')](_0x3918c5['loggedin'])?_['toNumber'](_0x3918c5[_0x34ea('0x6f')]):this[_0x34ea('0xf')][_0x3918c5[_0x34ea('0x68')]]['talking'];this[_0x34ea('0x4e')](this[_0x34ea('0xf')][_0x3918c5[_0x34ea('0x68')]],'queuesummary');}logger[_0x34ea('0x43')](_0x34ea('0x71'),util['inspect'](this[_0x34ea('0xf')][_0x3918c5[_0x34ea('0x68')]],{'showHidden':![],'depth':null}));ami[_0x34ea('0x41')]('custom:queuesummary',this[_0x34ea('0xf')][_0x3918c5['queue']]);}}}catch(_0x2ec42b){logger[_0x34ea('0x37')](_0x34ea('0x67'),util[_0x34ea('0x3a')](_0x2ec42b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x34ea('0x17')]=function(_0x70051b){logger['debug'](_0x34ea('0x72'),util['inspect'](_0x70051b,{'showHidden':![],'depth':null}));this[_0x34ea('0x10')]=!![];};VoiceQueueReport[_0x34ea('0xa')][_0x34ea('0x19')]=function(_0x5bcfa9){try{if(this[_0x34ea('0x62')](_0x5bcfa9)){logger[_0x34ea('0x43')](_0x34ea('0x73'),_0x5bcfa9[_0x34ea('0x46')],util['inspect'](_0x5bcfa9,{'showHidden':![],'depth':null}));if(_[_0x34ea('0x63')](this[_0x34ea('0x3e')][_0x5bcfa9[_0x34ea('0x46')]]))this[_0x34ea('0x3e')][_0x5bcfa9['uniqueid']]=[];if(_['isUndefined'](this[_0x34ea('0xe')][_0x5bcfa9[_0x34ea('0x46')]]))this['channels'][_0x5bcfa9[_0x34ea('0x46')]]={};var _0x1e400f=new QueueReport();_0x1e400f[_0x34ea('0x48')]=_0x5bcfa9['queue'];_0x1e400f['type']=this['voiceQueues'][_0x1e400f[_0x34ea('0x48')]]&&this['voiceQueues'][_0x1e400f[_0x34ea('0x48')]]['type']?this['voiceQueues'][_0x1e400f['name']][_0x34ea('0x4f')]||_0x34ea('0x50'):_0x34ea('0x50');_0x1e400f[_0x34ea('0x68')]=_0x5bcfa9[_0x34ea('0x68')];_0x1e400f[_0x34ea('0x74')]=moment()[_0x34ea('0x47')](_0x34ea('0x75'));_0x1e400f[_0x34ea('0x76')]=_0x5bcfa9['position'];_0x1e400f[_0x34ea('0x77')]=_0x5bcfa9['count'];_0x1e400f['uniqueid']=_0x5bcfa9[_0x34ea('0x46')];_0x1e400f['routealias']=this[_0x34ea('0xe')][_0x5bcfa9[_0x34ea('0x46')]][_0x34ea('0x78')];logger['info'](_0x34ea('0x79'),_0x1e400f['name'],_0x1e400f[_0x34ea('0x4f')]);_[_0x34ea('0x7a')](_0x1e400f,_[_0x34ea('0x7b')](_0x5bcfa9,_[_0x34ea('0x7c')](_0x1e400f)));this[_0x34ea('0x3e')][_0x5bcfa9[_0x34ea('0x46')]][_0x34ea('0x7d')](_0x1e400f);this[_0x34ea('0xe')][_0x5bcfa9['uniqueid']]=_0x1e400f;this[_0x34ea('0x42')](_0x1e400f,_0x34ea('0x18'));}}catch(_0x3ae67f){logger[_0x34ea('0x37')](_0x34ea('0x73'),_0x5bcfa9['uniqueid'],util[_0x34ea('0x3a')](_0x3ae67f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x34ea('0x1b')]=function(_0x5bfe6c){try{if(this['isNotNull'](_0x5bfe6c)){logger['debug'](_0x34ea('0x7e'),_0x5bfe6c[_0x34ea('0x46')],util[_0x34ea('0x3a')](_0x5bfe6c,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5bfe6c[_0x34ea('0x46')]]){var _0x544df8=_[_0x34ea('0x7f')](this['queueReports'][_0x5bfe6c['uniqueid']]);_0x544df8[_0x34ea('0x80')]=![];_0x544df8[_0x34ea('0x81')]=null;_0x544df8[_0x34ea('0x82')]=_0x5bfe6c[_0x34ea('0x82')];_0x544df8[_0x34ea('0x83')]=_0x5bfe6c['originalposition'];_0x544df8[_0x34ea('0x1a')]=!![];_0x544df8['queuecallerabandonAt']=moment()['format'](_0x34ea('0x75'));_0x544df8[_0x34ea('0x84')]=_0x34ea('0x85');_0x544df8[_0x34ea('0x86')]=null;logger['info'](_0x34ea('0x87'),_0x544df8[_0x34ea('0x48')],_0x544df8[_0x34ea('0x4f')]);this[_0x34ea('0xe')][_0x5bfe6c[_0x34ea('0x46')]]=_0x544df8;this[_0x34ea('0x3f')](_0x544df8,_0x34ea('0x1a'));}}}catch(_0x129609){logger[_0x34ea('0x37')](_0x34ea('0x7e'),_0x5bfe6c[_0x34ea('0x46')],util[_0x34ea('0x3a')](_0x129609,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x34ea('0xa')][_0x34ea('0x1d')]=function(_0xd317cd){try{if(this['isNotNull'](_0xd317cd)){logger[_0x34ea('0x43')](_0x34ea('0x88'),_0xd317cd[_0x34ea('0x46')],util['inspect'](_0xd317cd,{'showHidden':![],'depth':null}));if(this[_0x34ea('0x3e')][_0xd317cd['uniqueid']]){var _0x3541cd=_[_0x34ea('0x7f')](this[_0x34ea('0x3e')][_0xd317cd[_0x34ea('0x46')]]);_0x3541cd[_0x34ea('0x89')]=moment()[_0x34ea('0x47')](_0x34ea('0x75'));_0x3541cd[_0x34ea('0x8a')]=_0xd317cd[_0x34ea('0x8a')];_0x3541cd['connectedlinename']=_0xd317cd[_0x34ea('0x8b')];logger['info'](_0x34ea('0x8c'),_0x3541cd[_0x34ea('0x48')],_0x3541cd[_0x34ea('0x4f')],_0xd317cd[_0x34ea('0x8a')],_0xd317cd[_0x34ea('0x8b')]);this['channels'][_0xd317cd[_0x34ea('0x46')]]=_0x3541cd;this['emitVoiceQueueChannelSave'](_0x3541cd,'queuecallerleave');}}}catch(_0x58d4d2){logger[_0x34ea('0x37')](_0x34ea('0x88'),_0xd317cd[_0x34ea('0x46')],util[_0x34ea('0x3a')](_0x58d4d2,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x34ea('0x20')]=function(_0x43a474){try{if(this[_0x34ea('0x62')](_0x43a474)){logger[_0x34ea('0x43')](_0x34ea('0x8d'),_0x43a474['uniqueid'],util[_0x34ea('0x3a')](_0x43a474,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x43a474[_0x34ea('0x46')]]){var _0xb3738a=_[_0x34ea('0x7f')](this[_0x34ea('0x3e')][_0x43a474[_0x34ea('0x46')]]);_0xb3738a[_0x34ea('0x80')]=!![];_0xb3738a['queuecallerexitreason']=_0x34ea('0x8e');logger[_0x34ea('0x6a')](_0x34ea('0x8f'),_0xb3738a[_0x34ea('0x48')],_0xb3738a['type']);}}}catch(_0x20f7ce){logger[_0x34ea('0x37')]('[%s][voiceQueueReport][agentconnect]',_0x43a474[_0x34ea('0x46')],util[_0x34ea('0x3a')](_0x20f7ce,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x34ea('0xa')][_0x34ea('0x90')]=function(_0x1f0698){try{if(this[_0x34ea('0x62')](_0x1f0698)){logger['debug'](_0x34ea('0x91'),_0x1f0698[_0x34ea('0x46')],util[_0x34ea('0x3a')](_0x1f0698,{'showHidden':![],'depth':null}));if(this[_0x34ea('0x3e')][_0x1f0698[_0x34ea('0x46')]]){var _0x16c363=_[_0x34ea('0x7f')](this['queueReports'][_0x1f0698[_0x34ea('0x46')]]);_0x16c363[_0x34ea('0x1a')]=![];_0x16c363[_0x34ea('0x92')]=null;_0x16c363[_0x34ea('0x93')]=!![];_0x16c363['lastAssignedTo']=_0x1f0698[_0x34ea('0x94')];_0x16c363[_0x34ea('0x82')]=_0x1f0698[_0x34ea('0x82')];_0x16c363[_0x34ea('0x80')]=!![];_0x16c363[_0x34ea('0x95')]=![];_0x16c363[_0x34ea('0x96')]=null;if(!_0x16c363[_0x34ea('0x97')]){if(_0x1f0698[_0x34ea('0x98')]==_0x34ea('0x97')){_0x16c363[_0x34ea('0x84')]=_0x34ea('0x99');logger['info'](_0x34ea('0x9a'),_0x16c363[_0x34ea('0x48')],_0x16c363[_0x34ea('0x4f')]);}else{if(_[_0x34ea('0x9b')](_0x1f0698['channel'][_0x34ea('0x9c')](),_0x34ea('0x9d'))){if(this[_0x34ea('0x3e')][_0x1f0698[_0x34ea('0x9e')]]){var _0x581841=_[_0x34ea('0x7f')](this['queueReports'][_0x1f0698['linkedid']]);_0x581841[_0x34ea('0x80')]=![];_0x581841[_0x34ea('0x95')]=!![];_0x581841[_0x34ea('0x96')]=moment(_0x16c363['queuecallerjoinAt'])[_0x34ea('0x9f')](_0x1f0698[_0x34ea('0x82')],_0x34ea('0xa0'))[_0x34ea('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x581841[_0x34ea('0x84')]=_0x34ea('0xa1');_0x581841[_0x34ea('0x97')]=!![];_0x581841[_0x34ea('0xa2')]=_0x34ea('0xa3');_0x581841[_0x34ea('0xa4')]=_0x1f0698[_0x34ea('0xa5')];_0x581841[_0x34ea('0xa6')]=_0x1f0698[_0x34ea('0x46')];logger[_0x34ea('0x6a')](_0x34ea('0xa7'),_0x581841['name'],_0x581841[_0x34ea('0x4f')]);var _0x347acd=this['queueReports'][_0x1f0698[_0x34ea('0x9e')]];this[_0x34ea('0x3e')][_0x1f0698[_0x34ea('0x9e')]]=this['queueReports'][_0x1f0698[_0x34ea('0x46')]];this['queueReports'][_0x1f0698[_0x34ea('0x46')]]=_0x347acd;}}else{_0x16c363[_0x34ea('0x84')]='COMPLETEDBY'+_0x1f0698[_0x34ea('0x98')]['toUpperCase']();logger[_0x34ea('0x6a')](_0x34ea('0xa8'),_0x16c363[_0x34ea('0x48')],_0x16c363[_0x34ea('0x4f')],_0x16c363['queuecallerexitreason']);}}}this[_0x34ea('0xe')][_0x1f0698[_0x34ea('0x46')]]=_0x16c363;this['emitVoiceQueueChannelRemove'](_0x16c363,_0x34ea('0x1e'));}}}catch(_0x281c5b){logger[_0x34ea('0x37')](_0x34ea('0x91'),_0x1f0698['uniqueid'],util[_0x34ea('0x3a')](_0x281c5b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x34ea('0x22')]=function(_0x2e5263){try{if(this[_0x34ea('0x62')](_0x2e5263)){logger[_0x34ea('0x43')]('[%s][voiceQueueReport][varset]',_0x2e5263['uniqueid'],util[_0x34ea('0x3a')](_0x2e5263,{'showHidden':![],'depth':null}));this[_0x34ea('0xa9')](_0x2e5263[_0x34ea('0x46')],_[_0x34ea('0x7c')](_0x2e5263[_0x34ea('0xaa')])[0x0],_0x2e5263[_0x34ea('0xab')]);if(this['queueReports'][_0x2e5263[_0x34ea('0x46')]]){var _0x4516ad=_[_0x34ea('0x7f')](this[_0x34ea('0x3e')][_0x2e5263[_0x34ea('0x46')]]);if(_0x4516ad){if(this[_0x34ea('0x62')](_0x2e5263[_0x34ea('0xaa')])&&this[_0x34ea('0x62')](_0x2e5263['variable'][_0x34ea('0xac')])){switch(_0x2e5263[_0x34ea('0xab')]){case'CONTINUE':_0x4516ad['queuecallerexit']=![];_0x4516ad[_0x34ea('0x96')]=null;break;case _0x34ea('0xad'):_0x4516ad['lastevent']=_0x34ea('0xae');_0x4516ad[_0x34ea('0x95')]=!![];_0x4516ad[_0x34ea('0x96')]=moment()[_0x34ea('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x4516ad['queuecallerleaveAt']=moment()['format'](_0x34ea('0x75'));logger[_0x34ea('0x43')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x2e5263['uniqueid'],util['inspect'](_0x4516ad,{'showHidden':![],'depth':null}));ami[_0x34ea('0x41')](_0x34ea('0xaf'),_0x4516ad);break;default:_0x4516ad[_0x34ea('0x95')]=!![];_0x4516ad[_0x34ea('0x96')]=moment()[_0x34ea('0x47')](_0x34ea('0x75'));_0x4516ad['queuecallerleaveAt']=moment()[_0x34ea('0x47')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4516ad[_0x34ea('0x1a')]=![];_0x4516ad[_0x34ea('0x92')]=null;_0x4516ad[_0x34ea('0x84')]=_0x2e5263[_0x34ea('0xab')];this['channels'][_0x2e5263[_0x34ea('0x46')]]=_0x4516ad;this[_0x34ea('0x3f')](_0x4516ad,_0x34ea('0x21'));}else if(this[_0x34ea('0x62')](_0x2e5263[_0x34ea('0xaa')])&&this[_0x34ea('0x62')](_0x2e5263[_0x34ea('0xaa')][_0x34ea('0xb0')])){if(!_0x4516ad['queuecallerabandon']){_0x4516ad['queuecallerexit']=!![];_0x4516ad[_0x34ea('0x96')]=moment()[_0x34ea('0x47')](_0x34ea('0x75'));_0x4516ad['queuecallerexitreason']='EXITWITHKEY';_0x4516ad['queuecallerleaveAt']=moment()[_0x34ea('0x47')](_0x34ea('0x75'));this[_0x34ea('0xe')][_0x2e5263[_0x34ea('0x46')]]=_0x4516ad;}}logger[_0x34ea('0x6a')](_0x34ea('0xb1'),_0x2e5263[_0x34ea('0x46')],_0x4516ad[_0x34ea('0x48')],_0x4516ad[_0x34ea('0x4f')],_['keys'](_0x2e5263[_0x34ea('0xaa')])[0x0],_0x2e5263[_0x34ea('0xab')]);_0x4516ad['variables']=this[_0x34ea('0x12')][_0x2e5263[_0x34ea('0x46')]];}}}}catch(_0x327d2f){logger['error'](_0x34ea('0xb2'),_0x2e5263[_0x34ea('0x46')],util[_0x34ea('0x3a')](_0x327d2f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x34ea('0xa')][_0x34ea('0xa9')]=function(_0x34de53,_0x4a0d01,_0x8af249){var _0x11bf87=[_0x34ea('0xb3'),_0x34ea('0xb4'),_0x34ea('0xb5'),_0x34ea('0xb6'),_0x34ea('0xb7'),_0x34ea('0xb8'),_0x34ea('0xb9'),_0x34ea('0xba'),'sipcallid',_0x34ea('0xbb'),_0x34ea('0xbc'),_0x34ea('0xbd'),_0x34ea('0xbe'),_0x34ea('0xbf'),_0x34ea('0xc0'),_0x34ea('0xc1'),'membername',_0x34ea('0xc2'),_0x34ea('0xc3')];if(!_['isNil'](_0x4a0d01)&&!_[_0x34ea('0xc4')](_0x11bf87,_0x4a0d01)){if(_[_0x34ea('0x63')](this['variables'][_0x34de53])){this[_0x34ea('0x12')][_0x34de53]={};}this[_0x34ea('0x12')][_0x34de53][_0x4a0d01]=_0x8af249;}};VoiceQueueReport[_0x34ea('0xa')]['syncHangup']=function(_0x121b08){try{if(this[_0x34ea('0x62')](_0x121b08)){logger[_0x34ea('0x43')](_0x34ea('0xc5'),_0x121b08[_0x34ea('0x46')],util['inspect'](_0x121b08,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x121b08[_0x34ea('0x46')]]){for(var _0x130e93=0x0,_0x4b4491={};_0x130e930x0?_0x45d0cb:0x0;this[_0xb2ce('0x15')][_0x314d43[_0xb2ce('0x6d')]]['talking']=this[_0xb2ce('0x15')][_0x314d43[_0xb2ce('0x6d')]][_0xb2ce('0x35')]>_[_0xb2ce('0x72')](_0x314d43[_0xb2ce('0x73')])?_[_0xb2ce('0x72')](_0x314d43[_0xb2ce('0x73')]):this[_0xb2ce('0x15')][_0x314d43[_0xb2ce('0x6d')]][_0xb2ce('0x35')];this[_0xb2ce('0x56')](this[_0xb2ce('0x15')][_0x314d43[_0xb2ce('0x6d')]],'queuesummary');}logger[_0xb2ce('0x52')](_0xb2ce('0x74'),util[_0xb2ce('0x45')](this[_0xb2ce('0x15')][_0x314d43['queue']],{'showHidden':![],'depth':null}));ami[_0xb2ce('0x4a')]('custom:queuesummary',this['voiceQueues'][_0x314d43[_0xb2ce('0x6d')]]);}}}catch(_0x46fdeb){logger[_0xb2ce('0x43')]('[voiceQueueReport][queuesummary]',util[_0xb2ce('0x45')](_0x46fdeb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb2ce('0xc')][_0xb2ce('0x1b')]=function(_0x5684ac){logger[_0xb2ce('0x52')](_0xb2ce('0x75'),util[_0xb2ce('0x45')](_0x5684ac,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0xb2ce('0xc')]['syncQueueCallerJoin']=function(_0x42ab1f){try{if(this[_0xb2ce('0x66')](_0x42ab1f)){logger['debug'](_0xb2ce('0x76'),_0x42ab1f[_0xb2ce('0x4e')],util['inspect'](_0x42ab1f,{'showHidden':![],'depth':null}));if(_[_0xb2ce('0x77')](this[_0xb2ce('0x11')][_0x42ab1f[_0xb2ce('0x4e')]]))this['queueReports'][_0x42ab1f['uniqueid']]=[];if(_[_0xb2ce('0x77')](this[_0xb2ce('0x13')][_0x42ab1f['uniqueid']]))this['channels'][_0x42ab1f[_0xb2ce('0x4e')]]={};var _0x4cad04=new QueueReport();_0x4cad04[_0xb2ce('0x54')]=_0x42ab1f[_0xb2ce('0x6d')];_0x4cad04[_0xb2ce('0x57')]=this[_0xb2ce('0x15')][_0x4cad04[_0xb2ce('0x54')]]&&this[_0xb2ce('0x15')][_0x4cad04[_0xb2ce('0x54')]][_0xb2ce('0x57')]?this[_0xb2ce('0x15')][_0x4cad04[_0xb2ce('0x54')]][_0xb2ce('0x57')]||'inbound':'inbound';_0x4cad04[_0xb2ce('0x6d')]=_0x42ab1f[_0xb2ce('0x6d')];_0x4cad04['queuecallerjoinAt']=moment()[_0xb2ce('0x4f')](_0xb2ce('0x78'));_0x4cad04[_0xb2ce('0x79')]=_0x42ab1f[_0xb2ce('0x79')];_0x4cad04[_0xb2ce('0x7a')]=_0x42ab1f['count'];_0x4cad04[_0xb2ce('0x4e')]=_0x42ab1f[_0xb2ce('0x4e')];_0x4cad04[_0xb2ce('0x7b')]=this['channels'][_0x42ab1f[_0xb2ce('0x4e')]][_0xb2ce('0x7b')];logger[_0xb2ce('0x7c')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x4cad04['name'],_0x4cad04[_0xb2ce('0x57')]);_[_0xb2ce('0x7d')](_0x4cad04,_[_0xb2ce('0x7e')](_0x42ab1f,_['keys'](_0x4cad04)));this[_0xb2ce('0x11')][_0x42ab1f[_0xb2ce('0x4e')]][_0xb2ce('0x7f')](_0x4cad04);this[_0xb2ce('0x13')][_0x42ab1f[_0xb2ce('0x4e')]]=_0x4cad04;this[_0xb2ce('0x4b')](_0x4cad04,_0xb2ce('0x1c'));}}catch(_0x383095){logger[_0xb2ce('0x43')]('[%s][voiceQueueReport][queuecallerjoin]',_0x42ab1f[_0xb2ce('0x4e')],util[_0xb2ce('0x45')](_0x383095,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb2ce('0xc')][_0xb2ce('0x1f')]=function(_0x51f2dc){try{if(this[_0xb2ce('0x66')](_0x51f2dc)){logger[_0xb2ce('0x52')](_0xb2ce('0x80'),_0x51f2dc['uniqueid'],util[_0xb2ce('0x45')](_0x51f2dc,{'showHidden':![],'depth':null}));if(this[_0xb2ce('0x11')][_0x51f2dc['uniqueid']]){var _0x567baa=_['last'](this[_0xb2ce('0x11')][_0x51f2dc[_0xb2ce('0x4e')]]);_0x567baa[_0xb2ce('0x81')]=![];_0x567baa[_0xb2ce('0x82')]=null;_0x567baa[_0xb2ce('0x83')]=_0x51f2dc[_0xb2ce('0x83')];_0x567baa['originalposition']=_0x51f2dc[_0xb2ce('0x84')];_0x567baa['queuecallerabandon']=!![];_0x567baa[_0xb2ce('0x85')]=moment()[_0xb2ce('0x4f')](_0xb2ce('0x78'));_0x567baa[_0xb2ce('0x86')]=_0xb2ce('0x87');_0x567baa['lastAssignedTo']=null;logger[_0xb2ce('0x7c')](_0xb2ce('0x88'),_0x567baa['name'],_0x567baa[_0xb2ce('0x57')]);this[_0xb2ce('0x13')][_0x51f2dc[_0xb2ce('0x4e')]]=_0x567baa;this[_0xb2ce('0x49')](_0x567baa,_0xb2ce('0x1e'));}}}catch(_0x461249){logger[_0xb2ce('0x43')](_0xb2ce('0x80'),_0x51f2dc[_0xb2ce('0x4e')],util[_0xb2ce('0x45')](_0x461249,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb2ce('0xc')][_0xb2ce('0x21')]=function(_0x5943ce){try{if(this[_0xb2ce('0x66')](_0x5943ce)){logger[_0xb2ce('0x52')](_0xb2ce('0x89'),_0x5943ce[_0xb2ce('0x4e')],util[_0xb2ce('0x45')](_0x5943ce,{'showHidden':![],'depth':null}));if(this[_0xb2ce('0x11')][_0x5943ce['uniqueid']]){var _0x3b463b=_[_0xb2ce('0x8a')](this[_0xb2ce('0x11')][_0x5943ce[_0xb2ce('0x4e')]]);_0x3b463b['queuecallerleaveAt']=moment()[_0xb2ce('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b463b['connectedlinenum']=_0x5943ce[_0xb2ce('0x8b')];_0x3b463b[_0xb2ce('0x8c')]=_0x5943ce[_0xb2ce('0x8c')];logger[_0xb2ce('0x7c')](_0xb2ce('0x8d'),_0x3b463b[_0xb2ce('0x54')],_0x3b463b[_0xb2ce('0x57')],_0x5943ce['connectedlinenum'],_0x5943ce['connectedlinename']);this[_0xb2ce('0x13')][_0x5943ce[_0xb2ce('0x4e')]]=_0x3b463b;this['emitVoiceQueueChannelSave'](_0x3b463b,_0xb2ce('0x20'));}}}catch(_0x457721){logger[_0xb2ce('0x43')](_0xb2ce('0x89'),_0x5943ce[_0xb2ce('0x4e')],util['inspect'](_0x457721,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentConnect']=function(_0x48d78b){try{if(this['isNotNull'](_0x48d78b)){logger[_0xb2ce('0x52')]('[%s][voiceQueueReport][agentconnect]',_0x48d78b[_0xb2ce('0x4e')],util['inspect'](_0x48d78b,{'showHidden':![],'depth':null}));if(this[_0xb2ce('0x11')][_0x48d78b[_0xb2ce('0x4e')]]){var _0x387a71=_[_0xb2ce('0x8a')](this[_0xb2ce('0x11')][_0x48d78b[_0xb2ce('0x4e')]]);_0x387a71['queuecallercomplete']=!![];_0x387a71[_0xb2ce('0x86')]='COMPLETEDBYAGENT';logger['info'](_0xb2ce('0x8e'),_0x387a71['name'],_0x387a71['type']);}}}catch(_0x18e6df){logger[_0xb2ce('0x43')](_0xb2ce('0x8f'),_0x48d78b[_0xb2ce('0x4e')],util[_0xb2ce('0x45')](_0x18e6df,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb2ce('0xc')][_0xb2ce('0x23')]=function(_0x2c2e86){try{if(this[_0xb2ce('0x66')](_0x2c2e86)){logger[_0xb2ce('0x52')](_0xb2ce('0x90'),_0x2c2e86[_0xb2ce('0x4e')],util[_0xb2ce('0x45')](_0x2c2e86,{'showHidden':![],'depth':null}));if(this[_0xb2ce('0x11')][_0x2c2e86['uniqueid']]){var _0xbf6cdd=_[_0xb2ce('0x8a')](this['queueReports'][_0x2c2e86[_0xb2ce('0x4e')]]);_0xbf6cdd[_0xb2ce('0x1e')]=![];_0xbf6cdd['queuecallerabandonAt']=null;_0xbf6cdd['assigned']=!![];_0xbf6cdd[_0xb2ce('0x91')]=_0x2c2e86[_0xb2ce('0x92')];_0xbf6cdd[_0xb2ce('0x83')]=_0x2c2e86[_0xb2ce('0x83')];_0xbf6cdd[_0xb2ce('0x81')]=!![];_0xbf6cdd['queuecallerexit']=![];_0xbf6cdd[_0xb2ce('0x93')]=null;if(!_0xbf6cdd[_0xb2ce('0x94')]){if(_0x2c2e86[_0xb2ce('0x95')]==_0xb2ce('0x94')){_0xbf6cdd[_0xb2ce('0x86')]=_0xb2ce('0x96');logger[_0xb2ce('0x7c')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0xbf6cdd[_0xb2ce('0x54')],_0xbf6cdd[_0xb2ce('0x57')]);}else{if(_[_0xb2ce('0x97')](_0x2c2e86[_0xb2ce('0x3f')][_0xb2ce('0x98')](),_0xb2ce('0x99'))){if(this['queueReports'][_0x2c2e86['linkedid']]){var _0x5859ea=_[_0xb2ce('0x8a')](this['queueReports'][_0x2c2e86[_0xb2ce('0x9a')]]);_0x5859ea[_0xb2ce('0x81')]=![];_0x5859ea['queuecallerexit']=!![];_0x5859ea[_0xb2ce('0x93')]=moment(_0xbf6cdd[_0xb2ce('0x9b')])[_0xb2ce('0x9c')](_0x2c2e86['holdtime'],_0xb2ce('0x9d'))['format'](_0xb2ce('0x78'));_0x5859ea[_0xb2ce('0x86')]=_0xb2ce('0x9e');_0x5859ea[_0xb2ce('0x94')]=!![];_0x5859ea['transfertype']=_0xb2ce('0x9f');_0x5859ea['transferexten']=_0x2c2e86[_0xb2ce('0xa0')];_0x5859ea['transferuniqueid']=_0x2c2e86['uniqueid'];logger[_0xb2ce('0x7c')](_0xb2ce('0xa1'),_0x5859ea[_0xb2ce('0x54')],_0x5859ea['type']);var _0x4aad62=this[_0xb2ce('0x11')][_0x2c2e86['linkedid']];this['queueReports'][_0x2c2e86[_0xb2ce('0x9a')]]=this[_0xb2ce('0x11')][_0x2c2e86[_0xb2ce('0x4e')]];this[_0xb2ce('0x11')][_0x2c2e86['uniqueid']]=_0x4aad62;}}else{_0xbf6cdd[_0xb2ce('0x86')]=_0xb2ce('0xa2')+_0x2c2e86[_0xb2ce('0x95')][_0xb2ce('0xa3')]();logger[_0xb2ce('0x7c')](_0xb2ce('0xa4'),_0xbf6cdd[_0xb2ce('0x54')],_0xbf6cdd[_0xb2ce('0x57')],_0xbf6cdd['queuecallerexitreason']);}}}this['channels'][_0x2c2e86[_0xb2ce('0x4e')]]=_0xbf6cdd;this['emitVoiceQueueChannelRemove'](_0xbf6cdd,'agentcomplete');}}}catch(_0x186e21){logger[_0xb2ce('0x43')]('[%s][voiceQueueReport][agentcomplete]',_0x2c2e86[_0xb2ce('0x4e')],util[_0xb2ce('0x45')](_0x186e21,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb2ce('0xc')][_0xb2ce('0x27')]=function(_0xf1b74e){try{if(this[_0xb2ce('0x66')](_0xf1b74e)){logger['debug'](_0xb2ce('0xa5'),_0xf1b74e[_0xb2ce('0x4e')],util[_0xb2ce('0x45')](_0xf1b74e,{'showHidden':![],'depth':null}));this['addVariable'](_0xf1b74e['uniqueid'],_['keys'](_0xf1b74e['variable'])[0x0],_0xf1b74e[_0xb2ce('0xa6')]);if(this[_0xb2ce('0x11')][_0xf1b74e[_0xb2ce('0x4e')]]){var _0x57d2e2=_[_0xb2ce('0x8a')](this['queueReports'][_0xf1b74e['uniqueid']]);if(_0x57d2e2){if(this[_0xb2ce('0x66')](_0xf1b74e[_0xb2ce('0xa7')])&&this[_0xb2ce('0x66')](_0xf1b74e[_0xb2ce('0xa7')]['queuestatus'])){switch(_0xf1b74e[_0xb2ce('0xa6')]){case _0xb2ce('0xa8'):_0x57d2e2[_0xb2ce('0xa9')]=![];_0x57d2e2[_0xb2ce('0x93')]=null;break;case _0xb2ce('0xaa'):_0x57d2e2[_0xb2ce('0xab')]=_0xb2ce('0xac');_0x57d2e2[_0xb2ce('0xa9')]=!![];_0x57d2e2[_0xb2ce('0x93')]=moment()[_0xb2ce('0x4f')](_0xb2ce('0x78'));_0x57d2e2['queuecallerleaveAt']=moment()['format'](_0xb2ce('0x78'));logger[_0xb2ce('0x52')](_0xb2ce('0xad'),_0xf1b74e[_0xb2ce('0x4e')],util['inspect'](_0x57d2e2,{'showHidden':![],'depth':null}));ami[_0xb2ce('0x4a')](_0xb2ce('0xae'),_0x57d2e2);break;default:_0x57d2e2[_0xb2ce('0xa9')]=!![];_0x57d2e2[_0xb2ce('0x93')]=moment()[_0xb2ce('0x4f')](_0xb2ce('0x78'));_0x57d2e2['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x57d2e2['queuecallerabandon']=![];_0x57d2e2[_0xb2ce('0x85')]=null;_0x57d2e2['queuecallerexitreason']=_0xf1b74e[_0xb2ce('0xa6')];this[_0xb2ce('0x13')][_0xf1b74e[_0xb2ce('0x4e')]]=_0x57d2e2;this['emitVoiceQueueChannelRemove'](_0x57d2e2,_0xb2ce('0x26'));}else if(this[_0xb2ce('0x66')](_0xf1b74e[_0xb2ce('0xa7')])&&this[_0xb2ce('0x66')](_0xf1b74e['variable']['queueposition'])){if(!_0x57d2e2[_0xb2ce('0x1e')]){_0x57d2e2[_0xb2ce('0xa9')]=!![];_0x57d2e2[_0xb2ce('0x93')]=moment()['format'](_0xb2ce('0x78'));_0x57d2e2[_0xb2ce('0x86')]=_0xb2ce('0xaf');_0x57d2e2['queuecallerleaveAt']=moment()['format'](_0xb2ce('0x78'));this[_0xb2ce('0x13')][_0xf1b74e[_0xb2ce('0x4e')]]=_0x57d2e2;}}logger[_0xb2ce('0x7c')](_0xb2ce('0xb0'),_0xf1b74e[_0xb2ce('0x4e')],_0x57d2e2[_0xb2ce('0x54')],_0x57d2e2['type'],_[_0xb2ce('0xb1')](_0xf1b74e[_0xb2ce('0xa7')])[0x0],_0xf1b74e[_0xb2ce('0xa6')]);_0x57d2e2['variables']=this['variables'][_0xf1b74e['uniqueid']];}}}}catch(_0x19ea92){logger[_0xb2ce('0x43')](_0xb2ce('0xa5'),_0xf1b74e['uniqueid'],util[_0xb2ce('0x45')](_0x19ea92,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xb2ce('0xc')][_0xb2ce('0xb2')]=function(_0x53a2ce,_0x246221,_0x110bfd){var _0x43d1ca=[_0xb2ce('0xb3'),_0xb2ce('0xb4'),_0xb2ce('0xb5'),_0xb2ce('0xb6'),_0xb2ce('0xb7'),_0xb2ce('0xb8'),_0xb2ce('0xb9'),_0xb2ce('0xba'),_0xb2ce('0xbb'),_0xb2ce('0xbc'),_0xb2ce('0xbd'),_0xb2ce('0xbe'),_0xb2ce('0xbf'),'memberdynamic',_0xb2ce('0xc0'),'memberlastcall',_0xb2ce('0x92'),'memberpenalty','memberrealtime'];if(!_['isNil'](_0x246221)&&!_[_0xb2ce('0xc1')](_0x43d1ca,_0x246221)){if(_[_0xb2ce('0x77')](this[_0xb2ce('0x18')][_0x53a2ce])){this['variables'][_0x53a2ce]={};}this['variables'][_0x53a2ce][_0x246221]=_0x110bfd;}};VoiceQueueReport['prototype'][_0xb2ce('0x29')]=function(_0x1dba87){try{if(this[_0xb2ce('0x66')](_0x1dba87)){logger[_0xb2ce('0x52')](_0xb2ce('0xc2'),_0x1dba87[_0xb2ce('0x4e')],util[_0xb2ce('0x45')](_0x1dba87,{'showHidden':![],'depth':null}));if(this[_0xb2ce('0x11')][_0x1dba87[_0xb2ce('0x4e')]]){for(var _0x7e35ee=0x0,_0x1c6c1a={};_0x7e35ee=0x0?moment(_0x47d7a4[_0x716c('0x17')])[_0x716c('0xe')](_0x47d7a4[_0x716c('0x16')],_0x716c('0xf')):null,'data1':_0x716c('0x18'),'data2':_0x47d7a4[_0x716c('0x13')],'data3':_0x47d7a4['exten'],'data4':_0x47d7a4[_0x716c('0x19')]||null,'role':_0x716c('0x1a'),'internal':_0x47d7a4['accountcode']?_['toNumber'](_0x47d7a4[_0x716c('0x13')]):undefined,'uniqueid':_0x47d7a4[_0x716c('0x14')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x7def=['endtime','accountcode','exten','dialstring','toNumber','lodash','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','interface','format','SIP/%s','lastAssignedTo','queuecallerleaveAt','diff','seconds','inbound','calleridnum','queue','agent','uniqueid','voiceDialReport','membername','TALKING','starttime'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x7def,0x17e));var _0xf7de=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x7def[_0x266618];return _0x54dbf5;};'use strict';var moment=require('moment');var _=require(_0xf7de('0x0'));var util=require('util');var client=require(_0xf7de('0x1'));exports[_0xf7de('0x2')]=function(_0x427974){var _0x4ffa5b=_0x427974[_0xf7de('0x3')]||_0x427974[_0xf7de('0x4')];return client[_0xf7de('0x5')](_0xf7de('0x6'),{'body':{'channel':_0xf7de('0x7'),'membername':_0x427974['lastAssignedTo'],'interface':_['isNil'](_0x427974[_0xf7de('0x8')])?util[_0xf7de('0x9')](_0xf7de('0xa'),_0x427974[_0xf7de('0xb')]):_0x427974['interface'],'type':'TALKING','enterAt':_0x427974[_0xf7de('0xc')],'exitAt':_0x4ffa5b,'duration':moment(_0x4ffa5b)[_0xf7de('0xd')](_0x427974['queuecallerleaveAt'],_0xf7de('0xe')),'data1':_0xf7de('0xf'),'data2':_0x427974[_0xf7de('0x10')],'data3':_0x427974['exten'],'data4':null,'data5':_0x427974[_0xf7de('0x11')],'role':_0xf7de('0x12'),'internal':_0x427974['accountcode']?_['toNumber'](_0x427974['accountcode']):undefined,'uniqueid':_0x427974[_0xf7de('0x13')]},'log':_0xf7de('0x6')});};exports[_0xf7de('0x14')]=function(_0x6b0654){return client[_0xf7de('0x5')](_0xf7de('0x6'),{'body':{'channel':_0xf7de('0x7'),'membername':_0x6b0654[_0xf7de('0x15')],'interface':_0x6b0654[_0xf7de('0x8')],'type':_0xf7de('0x16'),'enterAt':_0x6b0654[_0xf7de('0x17')],'exitAt':_0x6b0654[_0xf7de('0x18')],'duration':moment(_0x6b0654[_0xf7de('0x18')])[_0xf7de('0xd')](_0x6b0654[_0xf7de('0x17')],'seconds')>=0x0?moment(_0x6b0654[_0xf7de('0x18')])[_0xf7de('0xd')](_0x6b0654[_0xf7de('0x17')],_0xf7de('0xe')):null,'data1':'outbound','data2':_0x6b0654[_0xf7de('0x19')],'data3':_0x6b0654[_0xf7de('0x1a')],'data4':_0x6b0654[_0xf7de('0x1b')]||null,'role':_0xf7de('0x12'),'internal':_0x6b0654[_0xf7de('0x19')]?_[_0xf7de('0x1c')](_0x6b0654[_0xf7de('0x19')]):undefined,'uniqueid':_0x6b0654[_0xf7de('0x13')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index ff4b1ad..e641323 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 _0x71d3=['Request','stopRecordingOnTransfer','GetSettings','../client','getSettings'];(function(_0x218cac,_0x25289e){var _0x34a488=function(_0x57dd52){while(--_0x57dd52){_0x218cac['push'](_0x218cac['shift']());}};_0x34a488(++_0x25289e);}(_0x71d3,0x67));var _0x371d=function(_0x49c524,_0x2f91e8){_0x49c524=_0x49c524-0x0;var _0xf98507=_0x71d3[_0x49c524];return _0xf98507;};'use strict';var client=require(_0x371d('0x0'));exports[_0x371d('0x1')]=function(){return client[_0x371d('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x371d('0x3')]},'log':_0x371d('0x4')});}; \ No newline at end of file +var _0x8b2b=['Request','stopRecordingOnTransfer','GetSettings','../client','getSettings'];(function(_0x151dbf,_0x3f5a97){var _0x22155c=function(_0x51f15e){while(--_0x51f15e){_0x151dbf['push'](_0x151dbf['shift']());}};_0x22155c(++_0x3f5a97);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x15b06d,_0x4825b0){_0x15b06d=_0x15b06d-0x0;var _0x445b45=_0x8b2b[_0x15b06d];return _0x445b45;};'use strict';var client=require(_0xb8b2('0x0'));exports[_0xb8b2('0x1')]=function(){return client[_0xb8b2('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb8b2('0x3')]},'log':_0xb8b2('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 0aad152..2f3848c 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 _0x608a=['getTemplates','Request','GetTemplate','name','html'];(function(_0x4828b1,_0x5c8cf3){var _0x1fec1b=function(_0x3f2e5a){while(--_0x3f2e5a){_0x4828b1['push'](_0x4828b1['shift']());}};_0x1fec1b(++_0x5c8cf3);}(_0x608a,0xff));var _0xa608=function(_0x4dc2ec,_0x841e34){_0x4dc2ec=_0x4dc2ec-0x0;var _0x285b46=_0x608a[_0x4dc2ec];return _0x285b46;};'use strict';var client=require('../client');exports[_0xa608('0x0')]=function(_0x20d299){return function(_0x4c6d5b){return client[_0xa608('0x1')](_0xa608('0x2'),{'options':{'raw':!![],'attributes':['id',_0xa608('0x3'),_0xa608('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x9ccf=['GetTemplate','../client','Request','name','html'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9ccf,0x10f));var _0xf9cc=function(_0x4fe17c,_0x3de842){_0x4fe17c=_0x4fe17c-0x0;var _0x14f304=_0x9ccf[_0x4fe17c];return _0x14f304;};'use strict';var client=require(_0xf9cc('0x0'));exports['getTemplates']=function(_0x201071){return function(_0x245d09){return client[_0xf9cc('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xf9cc('0x2'),_0xf9cc('0x3')]},'log':_0xf9cc('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index e41427b..c836ca3 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 _0x60c0=['data1','data2','data3','data4','data5','data6','GetTrigger','../client','getTriggers','Request','status','Condition','AllConditions','field','operator','value','AnyConditions','Actions'];(function(_0xf0c56a,_0x5a0beb){var _0x23b4ac=function(_0x27a33f){while(--_0x27a33f){_0xf0c56a['push'](_0xf0c56a['shift']());}};_0x23b4ac(++_0x5a0beb);}(_0x60c0,0x1db));var _0x060c=function(_0x4fb993,_0x4fd8ef){_0x4fb993=_0x4fb993-0x0;var _0x348c09=_0x60c0[_0x4fb993];return _0x348c09;};'use strict';var client=require(_0x060c('0x0'));exports[_0x060c('0x1')]=function(_0x3fc805){return function(_0x539c46){return client[_0x060c('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name','channel',_0x060c('0x3')],'include':[{'model':_0x060c('0x4'),'as':_0x060c('0x5'),'attributes':['id',_0x060c('0x6'),_0x060c('0x7'),_0x060c('0x8')]},{'model':_0x060c('0x4'),'as':_0x060c('0x9'),'attributes':['id',_0x060c('0x6'),'operator',_0x060c('0x8')]},{'model':'Action','as':_0x060c('0xa'),'attributes':['id','action',_0x060c('0xb'),_0x060c('0xc'),_0x060c('0xd'),_0x060c('0xe'),_0x060c('0xf'),_0x060c('0x10'),'data7']}]},'log':_0x060c('0x11')});};}; \ No newline at end of file +var _0xa546=['GetTrigger','name','status','AllConditions','field','operator','value','Condition','Action','Actions','data1','data2','data5','data6','../client','getTriggers'];(function(_0x2bf4de,_0x49bb74){var _0x291701=function(_0x354767){while(--_0x354767){_0x2bf4de['push'](_0x2bf4de['shift']());}};_0x291701(++_0x49bb74);}(_0xa546,0x12e));var _0x6a54=function(_0x509067,_0x4de2c3){_0x509067=_0x509067-0x0;var _0x2b0b4a=_0xa546[_0x509067];return _0x2b0b4a;};'use strict';var client=require(_0x6a54('0x0'));exports[_0x6a54('0x1')]=function(_0x12c2b7){return function(_0x420ad5){return client['Request'](_0x6a54('0x2'),{'options':{'raw':![],'attributes':['id',_0x6a54('0x3'),'channel',_0x6a54('0x4')],'include':[{'model':'Condition','as':_0x6a54('0x5'),'attributes':['id',_0x6a54('0x6'),_0x6a54('0x7'),_0x6a54('0x8')]},{'model':_0x6a54('0x9'),'as':'AnyConditions','attributes':['id',_0x6a54('0x6'),_0x6a54('0x7'),_0x6a54('0x8')]},{'model':_0x6a54('0xa'),'as':_0x6a54('0xb'),'attributes':['id','action',_0x6a54('0xc'),_0x6a54('0xd'),'data3','data4',_0x6a54('0xe'),_0x6a54('0xf'),'data7']}]},'log':_0x6a54('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 2436c70..c5c7cb5 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 _0xdb23=['registry','defaultuser','GetTrunk','../client','getTrunks','name'];(function(_0x24fdf1,_0x5aeceb){var _0x5b70eb=function(_0x379d84){while(--_0x379d84){_0x24fdf1['push'](_0x24fdf1['shift']());}};_0x5b70eb(++_0x5aeceb);}(_0xdb23,0xd5));var _0x3db2=function(_0x72cc4f,_0x38df3b){_0x72cc4f=_0x72cc4f-0x0;var _0x3c14d5=_0xdb23[_0x72cc4f];return _0x3c14d5;};'use strict';var client=require(_0x3db2('0x0'));exports[_0x3db2('0x1')]=function(_0x4937b6){return function(_0xd93b4f){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x3db2('0x2'),_0x3db2('0x3'),_0x3db2('0x4')]},'log':_0x3db2('0x5')});};}; \ No newline at end of file +var _0xface=['getTrunks','Request','GetTrunk','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xface,0x12c));var _0xefac=function(_0x255c6a,_0x51ccd4){_0x255c6a=_0x255c6a-0x0;var _0x5b1ad7=_0xface[_0x255c6a];return _0x5b1ad7;};'use strict';var client=require('../client');exports[_0xefac('0x0')]=function(_0x5abd58){return function(_0x20f2c1){return client[_0xefac('0x1')](_0xefac('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xefac('0x3'),'registry','defaultuser']},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index c4c2ca0..9091c80 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x2e0f09,_0x5dea9d){var _0x456ca9=function(_0x24a361){while(--_0x24a361){_0x2e0f09['push'](_0x2e0f09['shift']());}};_0x456ca9(++_0x5dea9d);}(_0x70e0,0x17b));var _0x070e=function(_0x4384dc,_0x4e62cc){_0x4384dc=_0x4384dc-0x0;var _0x28fdf6=_0x70e0[_0x4384dc];return _0x28fdf6;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file +var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0xff3cad,_0x4e78c4){var _0x3b3271=function(_0x6e7de9){while(--_0x6e7de9){_0xff3cad['push'](_0xff3cad['shift']());}};_0x3b3271(++_0x4e78c4);}(_0xedd9,0xfc));var _0x9edd=function(_0x4c0438,_0x59d953){_0x4c0438=_0x4c0438-0x0;var _0x32eda9=_0xedd9[_0x4c0438];return _0x32eda9;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ebeb2f6..fe17246 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 _0xad56=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x13cfe4,_0x43242a){var _0x2f1907=function(_0x459ca0){while(--_0x459ca0){_0x13cfe4['push'](_0x13cfe4['shift']());}};_0x2f1907(++_0x43242a);}(_0xad56,0x115));var _0x6ad5=function(_0x1f5afd,_0xe3fb82){_0x1f5afd=_0x1f5afd-0x0;var _0x2f7bbb=_0xad56[_0x1f5afd];return _0x2f7bbb;};'use strict';var client=require(_0x6ad5('0x0'));exports[_0x6ad5('0x1')]=function(_0x13dec3){return client[_0x6ad5('0x2')](_0x6ad5('0x3'),{'body':_0x13dec3,'log':'CreateVoiceAgentReport'});};exports[_0x6ad5('0x4')]=function(_0x452547,_0x2a3c22,_0x20e9e2){return client[_0x6ad5('0x2')](_0x6ad5('0x5'),{'body':_0x452547,'options':{'where':{'uniqueid':_0x2a3c22,'interface':_0x20e9e2,'agentcomplete':!![]}},'log':_0x6ad5('0x5')});}; \ No newline at end of file +var _0x9c9d=['create','Request','CreateVoiceAgentReport','update','../client'];(function(_0x23c087,_0x2d66f3){var _0x11e93f=function(_0x2e8a66){while(--_0x2e8a66){_0x23c087['push'](_0x23c087['shift']());}};_0x11e93f(++_0x2d66f3);}(_0x9c9d,0xb8));var _0xd9c9=function(_0x969b6a,_0x5cc029){_0x969b6a=_0x969b6a-0x0;var _0x4de24b=_0x9c9d[_0x969b6a];return _0x4de24b;};'use strict';var client=require(_0xd9c9('0x0'));exports[_0xd9c9('0x1')]=function(_0x10c4df){return client[_0xd9c9('0x2')](_0xd9c9('0x3'),{'body':_0x10c4df,'log':_0xd9c9('0x3')});};exports[_0xd9c9('0x4')]=function(_0x58b372,_0x324f0e,_0x17bc23){return client[_0xd9c9('0x2')]('UpdateVoiceAgentReport',{'body':_0x58b372,'options':{'where':{'uniqueid':_0x324f0e,'interface':_0x17bc23,'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 5227967..48925ab 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 _0x6112=['util','lodash','../client','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','billableseconds','GetVoiceCallReports'];(function(_0x38129e,_0x23e08a){var _0x57a318=function(_0x1a6d11){while(--_0x1a6d11){_0x38129e['push'](_0x38129e['shift']());}};_0x57a318(++_0x23e08a);}(_0x6112,0xee));var _0x2611=function(_0x51c871,_0x50fd50){_0x51c871=_0x51c871-0x0;var _0x1152f6=_0x6112[_0x51c871];return _0x1152f6;};'use strict';var moment=require('moment');var util=require(_0x2611('0x0'));var _=require(_0x2611('0x1'));var client=require(_0x2611('0x2'));exports['create']=function(_0x4df16d){return client['Request'](_0x2611('0x3'),{'body':_[_0x2611('0x4')](_0x4df16d,{'source':_0x4df16d['calleridnum'],'destinationcontext':_0x4df16d[_0x2611('0x5')],'callerid':_0x4df16d[_0x2611('0x6')],'amaflags':_0x2611('0x7')}),'log':_0x2611('0x3')});};exports[_0x2611('0x8')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x2611('0x9')],'createdAt':{'$between':[moment()['startOf'](_0x2611('0xa'))[_0x2611('0xb')](_0x2611('0xc')),moment()[_0x2611('0xd')](_0x2611('0xa'))[_0x2611('0xb')](_0x2611('0xc'))]}},'attributes':[_0x2611('0xe'),'disposition','duration',_0x2611('0xf')]},'log':_0x2611('0x10')});};}; \ No newline at end of file +var _0x3454=['outbound','startOf','YYYY-MM-DD\x20HH:mm:ss','endOf','day','format','type','disposition','duration','GetVoiceCallReports','util','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum','callerid','Request','GetVoiceCallReport'];(function(_0x175089,_0xa2b08d){var _0x4d2f1c=function(_0x204ac9){while(--_0x204ac9){_0x175089['push'](_0x175089['shift']());}};_0x4d2f1c(++_0xa2b08d);}(_0x3454,0x6e));var _0x4345=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3454[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var util=require(_0x4345('0x0'));var _=require(_0x4345('0x1'));var client=require(_0x4345('0x2'));exports[_0x4345('0x3')]=function(_0x39c929){return client['Request'](_0x4345('0x4'),{'body':_[_0x4345('0x5')](_0x39c929,{'source':_0x39c929[_0x4345('0x6')],'destinationcontext':_0x39c929['context'],'callerid':_0x39c929[_0x4345('0x7')],'amaflags':'DOCUMENTATION'}),'log':_0x4345('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x4345('0x8')](_0x4345('0x9'),{'options':{'where':{'type':[_0x4345('0xa')],'createdAt':{'$between':[moment()[_0x4345('0xb')]('day')['format'](_0x4345('0xc')),moment()[_0x4345('0xd')](_0x4345('0xe'))[_0x4345('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x4345('0x10'),_0x4345('0x11'),_0x4345('0x12'),'billableseconds']},'log':_0x4345('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index b53e72c..d3f69e2 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 _0x9c10=['Request','CreateVoiceDialReport','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c10,0x1ba));var _0x09c1=function(_0x46030a,_0x5ba40d){_0x46030a=_0x46030a-0x0;var _0x2f6ae5=_0x9c10[_0x46030a];return _0x2f6ae5;};'use strict';var client=require(_0x09c1('0x0'));exports[_0x09c1('0x1')]=function(_0x243149){return client[_0x09c1('0x2')](_0x09c1('0x3'),{'body':_0x243149,'log':_0x09c1('0x3')});}; \ No newline at end of file +var _0x5ff1=['create','Request','CreateVoiceDialReport'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x5ff1,0x156));var _0x15ff=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x5ff1[_0x25bea7];return _0x175952;};'use strict';var client=require('../client');exports[_0x15ff('0x0')]=function(_0x1ddb7d){return client[_0x15ff('0x1')](_0x15ff('0x2'),{'body':_0x1ddb7d,'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 1c171f5..1928cac 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 _0xc125=['getVoiceExtensions','GetVoiceExtension','exten','recordingFormat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc125,0x150));var _0x5c12=function(_0x4c6654,_0x31de81){_0x4c6654=_0x4c6654-0x0;var _0x57f82c=_0xc125[_0x4c6654];return _0x57f82c;};'use strict';var client=require('../client');exports[_0x5c12('0x0')]=function(){return function(){return client['Request'](_0x5c12('0x1'),{'options':{'raw':!![],'attributes':['id',_0x5c12('0x2'),_0x5c12('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x5c12('0x0')});};}; \ No newline at end of file +var _0x1be1=['recordingFormat','getVoiceExtensions','Request','GetVoiceExtension'];(function(_0x24a1a5,_0x47b6ea){var _0xcdc7e5=function(_0x252cb0){while(--_0x252cb0){_0x24a1a5['push'](_0x24a1a5['shift']());}};_0xcdc7e5(++_0x47b6ea);}(_0x1be1,0x192));var _0x11be=function(_0x454de3,_0xc0813c){_0x454de3=_0x454de3-0x0;var _0x174b3c=_0x1be1[_0x454de3];return _0x174b3c;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x11be('0x0')](_0x11be('0x1'),{'options':{'raw':!![],'attributes':['id','exten',_0x11be('0x2')],'where':{'VoiceExtensionId':null}},'log':_0x11be('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 9d4fa47..ecb4bb4 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 _0x39fb=['Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','callerid','active'];(function(_0x290a2e,_0x593700){var _0x8bb47b=function(_0x2b7cbd){while(--_0x2b7cbd){_0x290a2e['push'](_0x290a2e['shift']());}};_0x8bb47b(++_0x593700);}(_0x39fb,0x1de));var _0xb39f=function(_0x3c5191,_0x3fb9ee){_0x3c5191=_0x3c5191-0x0;var _0x209c85=_0x39fb[_0x3c5191];return _0x209c85;};'use strict';var client=require('../client');exports['getVoiceQueues']=function(){return function(){return client[_0xb39f('0x0')](_0xb39f('0x1'),{'options':{'raw':![],'attributes':['id',_0xb39f('0x2'),'acw',_0xb39f('0x3'),_0xb39f('0x4'),_0xb39f('0x5'),'type','dialActive',_0xb39f('0x6'),'dialLimitChannel',_0xb39f('0x7'),_0xb39f('0x8'),_0xb39f('0x9'),'dialPredictiveOptimizationPercentage',_0xb39f('0xa'),_0xb39f('0xb'),_0xb39f('0xc'),_0xb39f('0xd'),_0xb39f('0xe'),_0xb39f('0xf'),'dialQueueProject',_0xb39f('0x10'),_0xb39f('0x11'),_0xb39f('0x12'),'dialBusyRetryFrequency',_0xb39f('0x13'),'dialNoAnswerRetryFrequency',_0xb39f('0x14'),_0xb39f('0x15'),'dialGlobalInterval',_0xb39f('0x16'),_0xb39f('0x17'),_0xb39f('0x18'),_0xb39f('0x19'),_0xb39f('0x1a'),_0xb39f('0x1b'),'dialAMDTotalAnalysisTime',_0xb39f('0x1c'),_0xb39f('0x1d'),_0xb39f('0x1e'),_0xb39f('0x1f'),_0xb39f('0x20'),_0xb39f('0x21'),'dialRecallMeTimeout',_0xb39f('0x22'),_0xb39f('0x23'),_0xb39f('0x24'),'dialAgiAfterHangupClient','dialQueueProject2','monitor_format',_0xb39f('0x25'),_0xb39f('0x26'),_0xb39f('0x27'),_0xb39f('0x28'),_0xb39f('0x29'),'dialDropMaxRetry',_0xb39f('0x2a'),_0xb39f('0x2b'),_0xb39f('0x2c'),'dialMachineMaxRetry',_0xb39f('0x2d'),_0xb39f('0x2e'),_0xb39f('0x2f'),_0xb39f('0x30'),'dialPredictiveIntervalMaxThreshold',_0xb39f('0x31')],'include':[{'model':_0xb39f('0x32'),'as':'Trunk','attributes':['id','name',_0xb39f('0x33'),_0xb39f('0x34')]},{'model':_0xb39f('0x35'),'as':_0xb39f('0x36'),'attributes':['id','name']},{'model':_0xb39f('0x32'),'as':_0xb39f('0x37'),'attributes':['id',_0xb39f('0x2'),_0xb39f('0x33'),_0xb39f('0x34')]},{'model':_0xb39f('0x38'),'as':_0xb39f('0x38'),'attributes':['id',_0xb39f('0x2')],'include':[{'model':_0xb39f('0x38'),'as':_0xb39f('0x39'),'attributes':['id',_0xb39f('0x2'),_0xb39f('0x3a')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xa145=['dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','Pause','TrunkBackup','callerid','Interval','Intervals','getVoiceQueues','GetVoiceQueue','name','acw','autopause','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0xa145,0x126));var _0x5a14=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0xa145[_0x39e283];return _0x7de89f;};'use strict';var client=require('../client');exports[_0x5a14('0x0')]=function(){return function(){return client['Request'](_0x5a14('0x1'),{'options':{'raw':![],'attributes':['id',_0x5a14('0x2'),_0x5a14('0x3'),'acwTimeout',_0x5a14('0x4'),'monitor_format','type',_0x5a14('0x5'),_0x5a14('0x6'),_0x5a14('0x7'),_0x5a14('0x8'),_0x5a14('0x9'),_0x5a14('0xa'),_0x5a14('0xb'),_0x5a14('0xc'),'dialOriginateCallerIdName',_0x5a14('0xd'),'dialOriginateTimeout',_0x5a14('0xe'),'dialQueueTimeout',_0x5a14('0xf'),_0x5a14('0x10'),'dialCongestionRetryFrequency',_0x5a14('0x11'),_0x5a14('0x12'),_0x5a14('0x13'),_0x5a14('0x14'),_0x5a14('0x15'),_0x5a14('0x16'),_0x5a14('0x17'),_0x5a14('0x18'),_0x5a14('0x19'),_0x5a14('0x1a'),_0x5a14('0x1b'),_0x5a14('0x1c'),_0x5a14('0x1d'),_0x5a14('0x1e'),_0x5a14('0x1f'),'dialAMDBetweenWordsSilence',_0x5a14('0x20'),_0x5a14('0x21'),_0x5a14('0x22'),_0x5a14('0x23'),_0x5a14('0x24'),'dialRecallInQueue',_0x5a14('0x25'),'dialAgiAfterHangupAgent',_0x5a14('0x26'),'dialQueueProject2',_0x5a14('0x27'),_0x5a14('0x28'),_0x5a14('0x29'),_0x5a14('0x2a'),_0x5a14('0x2b'),_0x5a14('0x2c'),'dialDropMaxRetry',_0x5a14('0x2d'),_0x5a14('0x2e'),_0x5a14('0x2f'),_0x5a14('0x30'),_0x5a14('0x31'),_0x5a14('0x32'),_0x5a14('0x33'),_0x5a14('0x34'),_0x5a14('0x35'),_0x5a14('0x36')],'include':[{'model':_0x5a14('0x37'),'as':_0x5a14('0x37'),'attributes':['id',_0x5a14('0x2'),'callerid','active']},{'model':_0x5a14('0x38'),'as':'mandatoryDispositionPause','attributes':['id',_0x5a14('0x2')]},{'model':_0x5a14('0x37'),'as':_0x5a14('0x39'),'attributes':['id',_0x5a14('0x2'),_0x5a14('0x3a'),'active']},{'model':'Interval','as':'Interval','attributes':['id','name'],'include':[{'model':_0x5a14('0x3b'),'as':_0x5a14('0x3c'),'attributes':['id',_0x5a14('0x2'),'interval']}]}]},'log':_0x5a14('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index da9fdb5..991c24a 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(_0x53a8d3,_0x351468){var _0x344dd3=function(_0x1ba231){while(--_0x1ba231){_0x53a8d3['push'](_0x53a8d3['shift']());}};_0x344dd3(++_0x351468);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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(_0x21aa46,_0x3b17f1){var _0x10ec33=function(_0x3e2dda){while(--_0x3e2dda){_0x21aa46['push'](_0x21aa46['shift']());}};_0x10ec33(++_0x3b17f1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 22fa075..a19a77e 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 _0xa6dd=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client','Request'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xa6dd,0xa2));var _0xda6d=function(_0x4551f6,_0x48151b){_0x4551f6=_0x4551f6-0x0;var _0x581dc2=_0xa6dd[_0x4551f6];return _0x581dc2;};'use strict';var client=require(_0xda6d('0x0'));exports['getVoiceQueueRtPauses']=function(_0x312ec6){return function(){return client[_0xda6d('0x1')](_0xda6d('0x2'),{'options':{'where':{'VoiceQueueId':_0x312ec6,'paused':!![]},'raw':!![]},'log':_0xda6d('0x3')});};}; \ No newline at end of file +var _0xe1b2=['getVoiceQueueRtPauses','../client','Request'];(function(_0x2f21c6,_0x51de35){var _0x32cbd5=function(_0x651591){while(--_0x651591){_0x2f21c6['push'](_0x2f21c6['shift']());}};_0x32cbd5(++_0x51de35);}(_0xe1b2,0x1d8));var _0x2e1b=function(_0x307f56,_0x476bbd){_0x307f56=_0x307f56-0x0;var _0x447c61=_0xe1b2[_0x307f56];return _0x447c61;};'use strict';var client=require(_0x2e1b('0x0'));exports['getVoiceQueueRtPauses']=function(_0x56617f){return function(){return client[_0x2e1b('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x56617f,'paused':!![]},'raw':!![]},'log':_0x2e1b('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index bec05bd..90e714c 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(_0x4ede81,_0xe66cb8){var _0x4135c3=function(_0x4afb2d){while(--_0x4afb2d){_0x4ede81['push'](_0x4ede81['shift']());}};_0x4135c3(++_0xe66cb8);}(_0x7a54,0x106));var _0x47a5=function(_0xb69248,_0x195ba1){_0xb69248=_0xb69248-0x0;var _0x2df8c4=_0x7a54[_0xb69248];return _0x2df8c4;};'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(_0x20f277,_0x351756){var _0x587bae=function(_0x44ceb7){while(--_0x44ceb7){_0x20f277['push'](_0x20f277['shift']());}};_0x587bae(++_0x351756);}(_0x7a54,0x106));var _0x47a5=function(_0x44e72d,_0x210090){_0x44e72d=_0x44e72d-0x0;var _0x2d8b1e=_0x7a54[_0x44e72d];return _0x2d8b1e;};'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 e5190ca..6e33ce2 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 _0x1be6=['transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','Request','CreateVoiceTransferReport','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid'];(function(_0x2cdcc2,_0x20efa7){var _0x1d3a7d=function(_0x5b0ce7){while(--_0x5b0ce7){_0x2cdcc2['push'](_0x2cdcc2['shift']());}};_0x1d3a7d(++_0x20efa7);}(_0x1be6,0xa2));var _0x61be=function(_0xec818c,_0x510c52){_0xec818c=_0xec818c-0x0;var _0x3340c9=_0x1be6[_0xec818c];return _0x3340c9;};'use strict';var client=require('../client');exports['transfers']={};exports['blindTransfer']=function(_0x5d6d6d){return client[_0x61be('0x0')](_0x61be('0x1'),{'body':{'result':_0x5d6d6d[_0x61be('0x2')],'transfererchannel':_0x5d6d6d['transfererchannel'],'transferercalleridnum':_0x5d6d6d[_0x61be('0x3')],'transferercalleridname':_0x5d6d6d[_0x61be('0x4')],'transfererconnectedlinenum':_0x5d6d6d[_0x61be('0x5')],'transfererconnectedlinename':_0x5d6d6d[_0x61be('0x6')],'transfereraccountcode':_0x5d6d6d[_0x61be('0x7')],'transferercontext':_0x5d6d6d[_0x61be('0x8')],'transfererexten':_0x5d6d6d[_0x61be('0x9')],'transfererlinkedid':_0x5d6d6d['transfererlinkedid'],'transfereechannel':_0x5d6d6d['transfereechannel'],'transfereecalleridnum':_0x5d6d6d[_0x61be('0xa')],'transfereecalleridname':_0x5d6d6d[_0x61be('0xb')],'transfereeconnectedlinenum':_0x5d6d6d[_0x61be('0xc')],'transfereeconnectedlinename':_0x5d6d6d[_0x61be('0xd')],'transfereeaccountcode':_0x5d6d6d[_0x61be('0xe')],'transfereecontext':_0x5d6d6d[_0x61be('0xf')],'transfereeexten':_0x5d6d6d['transfereeexten'],'transfereelinkedid':_0x5d6d6d['transfereelinkedid'],'isexternal':_0x5d6d6d[_0x61be('0x10')],'context':_0x5d6d6d[_0x61be('0x11')],'extension':_0x5d6d6d[_0x61be('0x12')],'type':_0x61be('0x13')},'log':_0x61be('0x1')});};exports['attendedTransfer']=function(_0x3e009c){return client[_0x61be('0x0')](_0x61be('0x1'),{'body':{'result':_0x3e009c[_0x61be('0x2')],'transfererchannel':_0x3e009c[_0x61be('0x14')],'transferercalleridnum':_0x3e009c[_0x61be('0x15')],'transferercalleridname':_0x3e009c[_0x61be('0x16')],'transfererconnectedlinenum':_0x3e009c[_0x61be('0x17')],'transfererconnectedlinename':_0x3e009c[_0x61be('0x18')],'transfereraccountcode':_0x3e009c[_0x61be('0x19')],'transferercontext':_0x3e009c[_0x61be('0x1a')],'transfererexten':_0x3e009c['secondtransfererexten'],'transfererlinkedid':_0x3e009c[_0x61be('0x1b')],'transfereechannel':_0x3e009c[_0x61be('0x1c')],'transfereecalleridnum':_0x3e009c[_0x61be('0x1d')],'transfereecalleridname':_0x3e009c[_0x61be('0x1e')],'transfereeconnectedlinenum':_0x3e009c[_0x61be('0x1f')],'transfereeconnectedlinename':_0x3e009c[_0x61be('0x20')],'transfereeaccountcode':_0x3e009c[_0x61be('0x21')],'transfereecontext':_0x3e009c[_0x61be('0x22')],'transfereeexten':_0x3e009c[_0x61be('0x23')],'transfereelinkedid':_0x3e009c['transfertargetlinkedid'],'isexternal':_0x3e009c['isexternal'],'context':_0x3e009c[_0x61be('0x24')],'extension':_0x3e009c[_0x61be('0x25')],'type':'attended'},'log':_0x61be('0x1')});}; \ No newline at end of file +var _0x8cb8=['transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereeexten','transfereelinkedid','extension','blind','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','origtransferercontext','attended','transfers','blindTransfer','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum'];(function(_0x25703e,_0x43f038){var _0xec968f=function(_0x69a3ac){while(--_0x69a3ac){_0x25703e['push'](_0x25703e['shift']());}};_0xec968f(++_0x43f038);}(_0x8cb8,0x18b));var _0x88cb=function(_0xd67723,_0x1e576f){_0xd67723=_0xd67723-0x0;var _0x53b62b=_0x8cb8[_0xd67723];return _0x53b62b;};'use strict';var client=require('../client');exports[_0x88cb('0x0')]={};exports[_0x88cb('0x1')]=function(_0x223966){return client['Request'](_0x88cb('0x2'),{'body':{'result':_0x223966[_0x88cb('0x3')],'transfererchannel':_0x223966[_0x88cb('0x4')],'transferercalleridnum':_0x223966[_0x88cb('0x5')],'transferercalleridname':_0x223966[_0x88cb('0x6')],'transfererconnectedlinenum':_0x223966[_0x88cb('0x7')],'transfererconnectedlinename':_0x223966[_0x88cb('0x8')],'transfereraccountcode':_0x223966['transfereraccountcode'],'transferercontext':_0x223966[_0x88cb('0x9')],'transfererexten':_0x223966[_0x88cb('0xa')],'transfererlinkedid':_0x223966[_0x88cb('0xb')],'transfereechannel':_0x223966['transfereechannel'],'transfereecalleridnum':_0x223966[_0x88cb('0xc')],'transfereecalleridname':_0x223966[_0x88cb('0xd')],'transfereeconnectedlinenum':_0x223966[_0x88cb('0xe')],'transfereeconnectedlinename':_0x223966['transfereeconnectedlinename'],'transfereeaccountcode':_0x223966[_0x88cb('0xf')],'transfereecontext':_0x223966['transfereecontext'],'transfereeexten':_0x223966[_0x88cb('0x10')],'transfereelinkedid':_0x223966[_0x88cb('0x11')],'isexternal':_0x223966['isexternal'],'context':_0x223966['context'],'extension':_0x223966[_0x88cb('0x12')],'type':_0x88cb('0x13')},'log':_0x88cb('0x2')});};exports[_0x88cb('0x14')]=function(_0x18f386){return client[_0x88cb('0x15')](_0x88cb('0x2'),{'body':{'result':_0x18f386[_0x88cb('0x3')],'transfererchannel':_0x18f386[_0x88cb('0x16')],'transferercalleridnum':_0x18f386[_0x88cb('0x17')],'transferercalleridname':_0x18f386['origtransferercalleridname'],'transfererconnectedlinenum':_0x18f386['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x18f386[_0x88cb('0x18')],'transfereraccountcode':_0x18f386[_0x88cb('0x19')],'transferercontext':_0x18f386['secondtransferercontext'],'transfererexten':_0x18f386[_0x88cb('0x1a')],'transfererlinkedid':_0x18f386['origtransfererlinkedid'],'transfereechannel':_0x18f386[_0x88cb('0x1b')],'transfereecalleridnum':_0x18f386['transfertargetcalleridnum'],'transfereecalleridname':_0x18f386[_0x88cb('0x1c')],'transfereeconnectedlinenum':_0x18f386[_0x88cb('0x1d')],'transfereeconnectedlinename':_0x18f386[_0x88cb('0x1e')],'transfereeaccountcode':_0x18f386[_0x88cb('0x1f')],'transfereecontext':_0x18f386['transfertargetcontext'],'transfereeexten':_0x18f386['transfertargetexten'],'transfereelinkedid':_0x18f386['transfertargetlinkedid'],'isexternal':_0x18f386['isexternal'],'context':_0x18f386[_0x88cb('0x20')],'extension':_0x18f386['origtransfererexten'],'type':_0x88cb('0x21')},'log':_0x88cb('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 5757f52..745c59b 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 _0x3d04=['callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','%s.%s','filename','uniqueid','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','catch','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','StopMixMonitor\x20Success','queueChannels','map','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','outboundChannels','campaigns','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','listen','format','%s/%s','timers','timer','updateAcw','agents','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','Reload','Action','then','message','command','action','Command','content','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','type','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active'];(function(_0x233bea,_0x2d4716){var _0x5a88b1=function(_0x248f6c){while(--_0x248f6c){_0x233bea['push'](_0x233bea['shift']());}};_0x5a88b1(++_0x2d4716);}(_0x3d04,0xbe));var _0x43d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d04[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var jayson=require(_0x43d0('0x2'));var schema=require(_0x43d0('0x3'));var BPromise=require(_0x43d0('0x4'));var moment=require(_0x43d0('0x5'));var config=require(_0x43d0('0x6'));var properties=require(_0x43d0('0x7'));var ami=require('../ami');exports[_0x43d0('0x8')]=function(_0x1a75d4,_0x746f5e,_0x617bf){return new BPromise(function(_0x5e284f,_0x484271){var _0x50919e={'QueuePause':function(_0x5efb95){return new Promise(function(_0x457550,_0x3344d3){var _0x331421=util[_0x43d0('0x9')](_0x43d0('0xa'),'SIP',_0x5efb95['name']);if(_0x1a75d4[_0x43d0('0xb')]&&_0x1a75d4['timers'][_0x331421]&&_0x1a75d4['timers'][_0x331421][_0x43d0('0xc')]){_0x1a75d4[_0x43d0('0xb')][_0x331421][_0x43d0('0xd')]();}if(_0x1a75d4[_0x43d0('0xe')][_0x331421]){_0x1a75d4['agents'][_0x331421][_0x43d0('0xf')]({'statePause':_0x5efb95[_0x43d0('0x10')]?!![]:![]});}_0x457550({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x29773b){var _0x3bee8c=this;return new Promise(function(_0x1b4f09,_0x5ed340){if(ami[_0x43d0('0x11')]()==![]){return _0x5ed340(_0x3bee8c[_0x43d0('0x12')](0x1f4,[config[_0x43d0('0x13')]['ip'],config['asterisk'][_0x43d0('0x14')],_0x43d0('0x15')][_0x43d0('0x16')]('\x20')));}_0x29773b=_[_0x43d0('0x17')](_0x29773b,_[_0x43d0('0x18')](properties['module']));_0x29773b['action']=_0x43d0('0x19');return ami[_0x43d0('0x1a')](_0x29773b)[_0x43d0('0x1b')](function(_0x56a27b){_0x1b4f09({'code':0xc8,'message':_0x56a27b[_0x43d0('0x1c')]});})['catch'](function(_0x2c9d06){_0x5ed340(_0x3bee8c[_0x43d0('0x12')](0x1f5,_0x2c9d06[_0x43d0('0x1c')]));});});},'Command':function(_0x4f709a){var _0x3d7dcc=this;return new Promise(function(_0xe494eb,_0x4d9146){if(ami[_0x43d0('0x11')]()==![]){return _0x4d9146(_0x3d7dcc[_0x43d0('0x12')](0x1f4,[config[_0x43d0('0x13')]['ip'],config[_0x43d0('0x13')][_0x43d0('0x14')],_0x43d0('0x15')][_0x43d0('0x16')]('\x20')));}_0x4f709a=_[_0x43d0('0x17')](_0x4f709a,_0x43d0('0x1d'));_0x4f709a[_0x43d0('0x1e')]=_0x43d0('0x1f');return ami[_0x43d0('0x1a')](_0x4f709a)[_0x43d0('0x1b')](function(_0xbc72e6){_0xe494eb({'code':0xc8,'message':_0xbc72e6[_0x43d0('0x20')]});})['catch'](function(_0x2c7b24){_0x4d9146(_0x3d7dcc[_0x43d0('0x12')](0x1f5,_0x2c7b24['message']));});});},'VoiceQueues':function(_0x1fe708){return new Promise(function(_0x5456ab,_0x29c111){var _0x44497b=[];for(var _0x5dd310 in _0x1a75d4[_0x43d0('0x21')]){if(_0x1a75d4[_0x43d0('0x21')]['hasOwnProperty'](_0x5dd310)){var _0x12df30=_0x1a75d4[_0x43d0('0x21')][_0x5dd310];var _0x22ae3c={'id':_0x12df30['id'],'name':_0x12df30['name'],'strategy':_0x12df30[_0x43d0('0x22')],'answered':_0x12df30[_0x43d0('0x23')],'available':_0x12df30[_0x43d0('0x24')],'loggedIn':_0x12df30[_0x43d0('0x25')],'pTalking':_0x12df30[_0x43d0('0x26')],'sumBillable':_0x12df30[_0x43d0('0x27')],'sumDuration':_0x12df30[_0x43d0('0x28')],'sumHoldTime':_0x12df30['sumHoldTime']||0x0,'talking':_0x12df30[_0x43d0('0x29')],'total':_0x12df30[_0x43d0('0x2a')],'type':_0x12df30[_0x43d0('0x2b')],'unmanaged':_0x12df30['unmanaged'],'abandoned':_0x12df30['abandoned'],'waiting':_0x12df30['waiting'],'loggedInDb':_0x12df30[_0x43d0('0x2c')]};if(_0x12df30[_0x43d0('0x2b')]===_0x43d0('0x2d')){_0x22ae3c[_0x43d0('0x2e')]=_0x12df30[_0x43d0('0x2e')];_0x22ae3c[_0x43d0('0x2f')]=_0x12df30['dialMethod'];_0x22ae3c[_0x43d0('0x30')]=_0x12df30[_0x43d0('0x30')];_0x22ae3c[_0x43d0('0x31')]=_0x12df30[_0x43d0('0x31')];_0x22ae3c[_0x43d0('0x32')]=_0x12df30[_0x43d0('0x32')];_0x22ae3c[_0x43d0('0x33')]=_0x12df30[_0x43d0('0x33')];_0x22ae3c[_0x43d0('0x34')]=_0x12df30[_0x43d0('0x34')];_0x22ae3c[_0x43d0('0x35')]=_0x12df30['outboundAnswerAgiCallsDay'];_0x22ae3c[_0x43d0('0x36')]=_0x12df30[_0x43d0('0x36')];_0x22ae3c[_0x43d0('0x37')]=_0x12df30[_0x43d0('0x37')];_0x22ae3c['outboundBusyCallsDay']=_0x12df30[_0x43d0('0x38')];_0x22ae3c['outboundCongestionCallsDay']=_0x12df30[_0x43d0('0x39')];_0x22ae3c[_0x43d0('0x3a')]=_0x12df30['outboundDropCallsDayACS'];_0x22ae3c[_0x43d0('0x3b')]=_0x12df30[_0x43d0('0x3b')];_0x22ae3c[_0x43d0('0x3c')]=_0x12df30[_0x43d0('0x3c')];_0x22ae3c[_0x43d0('0x3d')]=_0x12df30[_0x43d0('0x3d')];_0x22ae3c[_0x43d0('0x3e')]=_0x12df30[_0x43d0('0x3e')];_0x22ae3c[_0x43d0('0x3f')]=_0x12df30[_0x43d0('0x3f')];_0x22ae3c[_0x43d0('0x40')]=_0x12df30['outboundReCallsDay'];_0x22ae3c[_0x43d0('0x41')]=_0x12df30[_0x43d0('0x41')];_0x22ae3c[_0x43d0('0x42')]=_0x12df30[_0x43d0('0x42')];_0x22ae3c[_0x43d0('0x43')]=_0x12df30[_0x43d0('0x43')];_0x22ae3c[_0x43d0('0x44')]=_0x12df30[_0x43d0('0x44')];_0x22ae3c[_0x43d0('0x45')]=_0x12df30[_0x43d0('0x45')];_0x22ae3c[_0x43d0('0x46')]=_0x12df30[_0x43d0('0x46')];_0x22ae3c[_0x43d0('0x47')]=_0x12df30[_0x43d0('0x47')];_0x22ae3c['predictiveIntervalErlangCalls']=_0x12df30[_0x43d0('0x48')];_0x22ae3c[_0x43d0('0x49')]=_0x12df30[_0x43d0('0x49')];_0x22ae3c[_0x43d0('0x4a')]=_0x12df30[_0x43d0('0x4a')];_0x22ae3c[_0x43d0('0x4b')]=_0x12df30[_0x43d0('0x4b')];_0x22ae3c[_0x43d0('0x4c')]=_0x12df30['predictiveIntervalPauses'];_0x22ae3c['predictiveIntervalAvailable']=_0x12df30[_0x43d0('0x4d')];_0x22ae3c['predictiveIntervalTotalCalls']=_0x12df30['predictiveIntervalTotalCalls'];_0x22ae3c[_0x43d0('0x1c')]=_0x12df30['message'];_0x22ae3c[_0x43d0('0x4e')]=_0x12df30['originated'];_0x22ae3c[_0x43d0('0x4f')]=_0x12df30['erlangCalls'];_0x22ae3c[_0x43d0('0x50')]=_0x12df30[_0x43d0('0x50')];_0x22ae3c[_0x43d0('0x51')]=_0x12df30['erlangAbandonmentRate'];_0x22ae3c[_0x43d0('0x52')]=_0x12df30['erlangBusyFactor'];_0x22ae3c[_0x43d0('0x53')]=_0x12df30['startPredictive'];_0x22ae3c['startProgressive']=_0x12df30[_0x43d0('0x54')];}if(_0x12df30[_0x43d0('0x55')]){_0x22ae3c['Trunk']={'id':_0x12df30[_0x43d0('0x55')]['id'],'name':_0x12df30[_0x43d0('0x55')][_0x43d0('0x56')],'active':_0x12df30[_0x43d0('0x55')][_0x43d0('0x57')],'callerid':_0x12df30['Trunk'][_0x43d0('0x58')]};}if(_0x12df30[_0x43d0('0x59')]){_0x22ae3c[_0x43d0('0x59')]={'id':_0x12df30[_0x43d0('0x59')]['id'],'name':_0x12df30['Interval'][_0x43d0('0x56')]};}_0x44497b[_0x43d0('0x5a')](_0x22ae3c);}}_0x5456ab({'count':_0x44497b[_0x43d0('0x5b')],'rows':_0x44497b});});},'UpdateVoiceQueue':function(_0x17396f){return new Promise(function(_0x5e9000,_0x52d26a){var _0x1b8b2a=_[_0x43d0('0x5c')](_0x1a75d4['voiceQueues'],{'id':parseInt(_0x17396f['id'])});var _0x19baae=_[_0x43d0('0x5d')](_0x17396f,['id']);if(_0x1b8b2a){for(var _0x3931f8 in _0x19baae){if(typeof _0x19baae[_0x3931f8]!=='undefined'&&typeof _0x1b8b2a[_0x3931f8]!==_0x43d0('0x5e')){_0x1b8b2a[_0x3931f8]=_0x19baae[_0x3931f8];}}_0x5e9000(_0x1b8b2a);}else{_0x52d26a();}});},'VoiceChannels':function(_0x5ad7df){return new Promise(function(_0x19362e,_0x58d8e7){var _0x1f55e9=_[_0x43d0('0x5f')](_0x1a75d4[_0x43d0('0x60')]);_0x19362e({'count':_0x1f55e9[_0x43d0('0x5b')],'rows':_0x1f55e9});});},'VoiceChannelMixMonitor':function(_0x46723a){var _0x4d8b86=this;return new Promise(function(_0x11f997,_0x4bb2a0){if(ami[_0x43d0('0x11')]()==![]){return _0x4bb2a0(_0x4d8b86[_0x43d0('0x12')](0x1f4,[config[_0x43d0('0x13')]['ip'],config[_0x43d0('0x13')][_0x43d0('0x14')],_0x43d0('0x15')][_0x43d0('0x16')]('\x20')));}var _0x36c9d0=schema(properties[_0x43d0('0x61')])[_0x43d0('0x3')](_0x46723a);if(_0x36c9d0[_0x43d0('0x5b')]>0x0){return _0x4bb2a0(_0x4d8b86[_0x43d0('0x12')](0x1f4,_['map'](_0x36c9d0,_0x43d0('0x1c'))[_0x43d0('0x16')](',\x20')));}var _0x1503bc=_['find'](_0x1a75d4[_0x43d0('0x60')],{'uniqueid':_0x46723a['uniqueid']});if(_0x1503bc&&_0x1503bc['channel']){var _0x2477ec=util[_0x43d0('0x9')](_0x43d0('0x62'),_0x46723a[_0x43d0('0x63')]||_0x46723a[_0x43d0('0x64')],_0x46723a['format']||'wav');return ami[_0x43d0('0x1a')]({'action':'MixMonitor','channel':_0x1503bc[_0x43d0('0x65')],'file':_0x2477ec,'options':_0x43d0('0x66')})['then'](function(_0x53d6c0){var _0x57fbb1=_[_0x43d0('0x5c')](_0x1503bc[_0x43d0('0x67')],{'filename':_0x43d0('0x68')+_0x2477ec[_0x43d0('0x69')]()});if(_[_0x43d0('0x6a')](_0x57fbb1)){_0x1503bc[_0x43d0('0x67')][_0x43d0('0x5a')]({'filename':_0x43d0('0x68')+_0x2477ec[_0x43d0('0x69')](),'createdAt':moment()['format'](_0x43d0('0x6b')),'mixmonitorid':_0x53d6c0[_0x43d0('0x6c')],'status':_0x43d0('0x6d')});}else{_0x57fbb1[_0x43d0('0x6c')]=_0x53d6c0[_0x43d0('0x6c')];_0x57fbb1[_0x43d0('0x6e')]=_0x43d0('0x6d');}_0x11f997({'code':0xc8,'message':[_0x46723a[_0x43d0('0x64')],_0x43d0('0x6f'),_0x53d6c0[_0x43d0('0x6c')]]['join']('\x20'),'mixmonitorid':_0x53d6c0['mixmonitorid']});})[_0x43d0('0x70')](function(_0x12e3c0){_0x4bb2a0(_0x4d8b86[_0x43d0('0x12')](0x1f5,[_0x46723a[_0x43d0('0x64')],_0x12e3c0[_0x43d0('0x1c')][_0x43d0('0x69')]()][_0x43d0('0x16')]('\x20')));});}else{return _0x4bb2a0(_0x4d8b86[_0x43d0('0x12')](0x1f5,_0x43d0('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x1b0a11){var _0xe4f09d=this;return new Promise(function(_0x3c4dcb,_0x155ea8){if(ami[_0x43d0('0x11')]()==![]){return _0x155ea8(_0xe4f09d[_0x43d0('0x12')](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x43d0('0x15')][_0x43d0('0x16')]('\x20')));}var _0x14884e=schema(properties['voicechannel'])['validate'](_0x1b0a11);if(_0x14884e['length']>0x0){return _0x155ea8(_0xe4f09d[_0x43d0('0x12')](0x1f4,_['map'](_0x14884e,_0x43d0('0x1c'))[_0x43d0('0x16')](',\x20')));}var _0x44696d=_['find'](_0x1a75d4[_0x43d0('0x60')],{'uniqueid':_0x1b0a11[_0x43d0('0x64')]});if(_0x44696d){return BPromise[_0x43d0('0x72')]()[_0x43d0('0x1b')](function(){if(_0x44696d[_0x43d0('0x65')]){return ami[_0x43d0('0x1a')]({'action':_0x43d0('0x73'),'channel':_0x44696d[_0x43d0('0x65')],'mixmonitorid':_0x1b0a11[_0x43d0('0x6c')]})[_0x43d0('0x70')](function(_0x5c4b95){});}})[_0x43d0('0x1b')](function(){if(_0x44696d[_0x43d0('0x74')]){return ami[_0x43d0('0x1a')]({'action':_0x43d0('0x73'),'channel':_0x44696d[_0x43d0('0x74')],'mixmonitorid':_0x1b0a11[_0x43d0('0x6c')]})['catch'](function(_0x3951e4){});}})[_0x43d0('0x1b')](function(_0x2290eb){var _0x11d4a6=_[_0x43d0('0x5c')](_0x44696d[_0x43d0('0x67')],{'mixmonitorid':_0x1b0a11['mixmonitorid']});if(_0x11d4a6){_0x11d4a6[_0x43d0('0x6e')]=_0x43d0('0x75');}})[_0x43d0('0x1b')](function(){var _0x19b6ff=util['format'](_0x43d0('0x62'),_0x1b0a11[_0x43d0('0x63')]||_0x1b0a11[_0x43d0('0x64')],_0x1b0a11['format']||'wav');var _0x3ca7a5=_[_0x43d0('0x5c')](_0x44696d['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x19b6ff[_0x43d0('0x69')]()});if(_0x3ca7a5){_0x3ca7a5[_0x43d0('0x6e')]=_0x43d0('0x75');}})[_0x43d0('0x1b')](function(){_0x3c4dcb({'code':0xc8,'message':[_0x1b0a11[_0x43d0('0x64')],_0x43d0('0x76')][_0x43d0('0x16')]('\x20')});})[_0x43d0('0x70')](function(_0x554919){_0x155ea8(_0xe4f09d[_0x43d0('0x12')](0x1f5,[_0x1b0a11[_0x43d0('0x64')],_0x554919['message']['toLowerCase']()]['join']('\x20')));});}else{return _0x155ea8(_0xe4f09d[_0x43d0('0x12')](0x1f5,_0x43d0('0x71')));}});},'VoiceQueuesChannels':function(_0x1f3cda){return new Promise(function(_0x505946,_0x9b5f0d){var _0x39cd52=_['values'](_0x1a75d4[_0x43d0('0x77')]);_0x505946({'count':_0x39cd52[_0x43d0('0x5b')],'rows':_0x39cd52});});},'VoiceQueuesChannel':function(_0x519e2c){var _0x3ed718=this;return new Promise(function(_0x4e5c9f,_0xc383a7){var _0xa43542=schema(properties['voicequeuechannel'])['validate'](_0x519e2c);if(_0xa43542[_0x43d0('0x5b')]>0x0){return _0xc383a7(_0x3ed718[_0x43d0('0x12')](0x1f4,_[_0x43d0('0x78')](_0xa43542,'message')['join'](',\x20')));}var _0x441d46=_[_0x43d0('0x5c')](_0x1a75d4['queueChannels'],{'uniqueid':_0x519e2c[_0x43d0('0x64')]});if(_0x441d46){_0x4e5c9f(_0x441d46);}else{return _0xc383a7(_0x3ed718['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x27a2c7){var _0x1d657a=this;return new Promise(function(_0xb03b17,_0x2b7cf1){if(ami[_0x43d0('0x11')]()==![]){return _0x2b7cf1(_0x1d657a[_0x43d0('0x12')](0x1f4,[config[_0x43d0('0x13')]['ip'],config[_0x43d0('0x13')][_0x43d0('0x14')],_0x43d0('0x15')][_0x43d0('0x16')]('\x20')));}var _0x5b97bc=schema(properties[_0x43d0('0x79')])['validate'](_0x27a2c7);if(_0x5b97bc['length']>0x0){return _0x2b7cf1(_0x1d657a[_0x43d0('0x12')](0x1f4,_[_0x43d0('0x78')](_0x5b97bc,'message')[_0x43d0('0x16')](',\x20')));}var _0x18afba=_[_0x43d0('0x5c')](_0x1a75d4[_0x43d0('0x77')],{'uniqueid':_0x27a2c7[_0x43d0('0x64')]});if(_0x18afba&&_0x18afba[_0x43d0('0x65')]){return ami[_0x43d0('0x1a')]({'action':_0x43d0('0x7a'),'channel':_0x18afba[_0x43d0('0x65')]})[_0x43d0('0x1b')](function(_0x81485b){_0xb03b17({'code':0xc8,'message':[_0x27a2c7[_0x43d0('0x64')],_0x81485b[_0x43d0('0x1c')][_0x43d0('0x69')]()][_0x43d0('0x16')]('\x20')});})['catch'](function(_0x1afbd5){_0x2b7cf1(_0x1d657a[_0x43d0('0x12')](0x1f5,[_0x27a2c7[_0x43d0('0x64')],_0x1afbd5[_0x43d0('0x1c')][_0x43d0('0x69')]()][_0x43d0('0x16')]('\x20')));});}else{return _0x2b7cf1(_0x1d657a['error'](0x1f5,_0x43d0('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x5bf51d){var _0x3c747f=this;return new Promise(function(_0x948a6a,_0x1a809c){if(ami[_0x43d0('0x11')]()==![]){return _0x1a809c(_0x3c747f[_0x43d0('0x12')](0x1f4,[config[_0x43d0('0x13')]['ip'],config[_0x43d0('0x13')]['username'],'ami\x20disconnected'][_0x43d0('0x16')]('\x20')));}var _0x1fe4f8=schema(properties[_0x43d0('0x7b')])[_0x43d0('0x3')](_0x5bf51d);if(_0x1fe4f8[_0x43d0('0x5b')]>0x0){return _0x1a809c(_0x3c747f[_0x43d0('0x12')](0x1f4,_['map'](_0x1fe4f8,'message')[_0x43d0('0x16')](',\x20')));}var _0x5c6b0b=_[_0x43d0('0x5c')](_0x1a75d4[_0x43d0('0x77')],{'uniqueid':_0x5bf51d[_0x43d0('0x64')]});if(_0x5c6b0b&&_0x5c6b0b[_0x43d0('0x65')]){return ami[_0x43d0('0x1a')]({'action':_0x43d0('0x7c'),'channel':_0x5c6b0b[_0x43d0('0x65')],'exten':_0x5bf51d['exten'],'context':_0x5bf51d[_0x43d0('0x7d')]||_0x5c6b0b[_0x43d0('0x7d')],'priority':0x1})[_0x43d0('0x1b')](function(_0x10ea32){_0x948a6a({'code':0xc8,'message':[_0x5bf51d[_0x43d0('0x64')],_0x10ea32[_0x43d0('0x1c')][_0x43d0('0x69')]()][_0x43d0('0x16')]('\x20')});})[_0x43d0('0x70')](function(_0x365d32){_0x1a809c(_0x3c747f[_0x43d0('0x12')](0x1f5,[_0x5bf51d[_0x43d0('0x64')],_0x365d32[_0x43d0('0x1c')][_0x43d0('0x69')]()]['join']('\x20')));});}else{return _0x1a809c(_0x3c747f['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x83096c){return new Promise(function(_0x4387ab,_0x3cc0fa){var _0x3779e5=_['values'](_0x1a75d4[_0x43d0('0xe')]);_0x4387ab({'count':_0x3779e5['length'],'rows':_0x3779e5});});},'Telephones':function(_0x24924a){return new Promise(function(_0x28f523,_0x754cd4){var _0xd2039f=_[_0x43d0('0x5f')](_0x1a75d4[_0x43d0('0x7e')]);_0x28f523({'count':_0xd2039f[_0x43d0('0x5b')],'rows':_0xd2039f});});},'Trunks':function(_0x531ba2){return new Promise(function(_0x36e5c0,_0x162fb0){var _0x4645d3=_[_0x43d0('0x5f')](_0x1a75d4['trunks']);_0x36e5c0({'count':_0x4645d3[_0x43d0('0x5b')],'rows':_0x4645d3});});},'OutboundChannels':function(_0x4cf9fb){return new Promise(function(_0x26bf14,_0x525f7b){var _0x3a5421=_[_0x43d0('0x5f')](_0x1a75d4[_0x43d0('0x7f')]);_0x26bf14({'count':_0x3a5421['length'],'rows':_0x3a5421});});},'Outbound':function(_0x1fd03d){return new Promise(function(_0x3e1e3e,_0x3ff45c){_0x3e1e3e(_0x1a75d4[_0x43d0('0x2d')]);});},'Campaigns':function(_0x52919f){return new Promise(function(_0x3c19f7,_0x1ba6c2){var _0x1f607e=_[_0x43d0('0x5f')](_0x1a75d4[_0x43d0('0x80')]);_0x3c19f7({'count':_0x1f607e[_0x43d0('0x5b')],'rows':_0x1f607e});});},'VoiceQueuesPreview':function(_0x3aad81){var _0x44d85e=this;return new Promise(function(_0x49216b,_0x35793a){_0x746f5e['run'](_0x3aad81['id'])[_0x43d0('0x1b')](function(_0x39de5f){_0x49216b({'code':0xc8,'message':_0x39de5f['message']});})[_0x43d0('0x70')](function(_0x43c85c){_0x35793a(_0x44d85e[_0x43d0('0x12')](0x1f4,_0x43c85c[_0x43d0('0x1c')]));});});},'EventManager':function(_0x1303d7){var _0x591118=this;return new Promise(function(_0x93a97a,_0x56cac9){if(!_0x1303d7[_0x43d0('0x81')]){return _0x56cac9(_0x591118['error'](0x1f4,_0x43d0('0x82')));}ami['emit'](_0x43d0('0x83')+_0x1303d7['event'],_0x1303d7['message']);_0x93a97a({'code':0xc8,'message':_0x1303d7});});},'FaxAccounts':function(_0x259ad8){return new Promise(function(_0x4511fb,_0x41e993){var _0xa016ad=_[_0x43d0('0x5f')](_0x1a75d4[_0x43d0('0x84')]);_0x4511fb({'count':_0xa016ad[_0x43d0('0x5b')],'rows':_0xa016ad});});},'SendFax':function(_0xebf7f9){var _0x23b5dc=this;return new Promise(function(_0x35581e,_0x2e1208){_0x617bf[_0x43d0('0x85')](_0xebf7f9)[_0x43d0('0x1b')](function(_0x5aa2bb){_0x35581e({'code':0xc8,'message':_0x5aa2bb[_0x43d0('0x1c')]});})[_0x43d0('0x70')](function(_0x269f05){_0x2e1208(_0x23b5dc[_0x43d0('0x12')](0x1f4,_0x269f05[_0x43d0('0x1c')]));});});},'CheckAfterSend':function(_0x53ff2b){var _0x44e2a9=this;return new Promise(function(_0x348065,_0x3259af){_0x617bf[_0x43d0('0x86')](_0x53ff2b)[_0x43d0('0x1b')](function(_0x3c4537){_0x348065({'code':0xc8,'message':_0x3c4537['message']});})[_0x43d0('0x70')](function(_0x27def6){_0x3259af(_0x44e2a9[_0x43d0('0x12')](0x1f4,_0x27def6['message']));});});}};var _0x17f76f=jayson[_0x43d0('0x87')](_0x50919e)['http']();_0x17f76f['on']('error',function(_0x10c838){return _0x484271(_0x10c838);});_0x17f76f[_0x43d0('0x8')](0x232a,_0x43d0('0x88'),function(){console[_0x43d0('0x89')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x5e284f(_0x43d0('0x8a')+0x232a);});});}; \ No newline at end of file +var _0xf61e=['action','Action','then','message','catch','command','Command','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','omit','undefined','channels','voicechannel','map','uniqueid','format','%s.%s','wav','MixMonitor','channel','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','resolve','StopMixMonitor','destinationchannel','monitors','stop','StopMixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','values','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf61e,0x191));var _0xef61=function(_0x240fe6,_0xfe443f){_0x240fe6=_0x240fe6-0x0;var _0x23c3e3=_0xf61e[_0x240fe6];return _0x23c3e3;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var jayson=require(_0xef61('0x2'));var schema=require(_0xef61('0x3'));var BPromise=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var config=require(_0xef61('0x6'));var properties=require(_0xef61('0x7'));var ami=require(_0xef61('0x8'));exports[_0xef61('0x9')]=function(_0x239fa9,_0x45a18d,_0x5b00b2){return new BPromise(function(_0x9e17f4,_0x3e2f79){var _0x4f0cc5={'QueuePause':function(_0x2242a7){return new Promise(function(_0x277fa1,_0x106e7f){var _0x4dba00=util['format'](_0xef61('0xa'),_0xef61('0xb'),_0x2242a7[_0xef61('0xc')]);if(_0x239fa9[_0xef61('0xd')]&&_0x239fa9[_0xef61('0xd')][_0x4dba00]&&_0x239fa9[_0xef61('0xd')][_0x4dba00][_0xef61('0xe')]){_0x239fa9[_0xef61('0xd')][_0x4dba00][_0xef61('0xf')]();}if(_0x239fa9[_0xef61('0x10')][_0x4dba00]){_0x239fa9[_0xef61('0x10')][_0x4dba00][_0xef61('0x11')]({'statePause':_0x2242a7[_0xef61('0x12')]?!![]:![]});}_0x277fa1({'code':0xc8,'message':_0xef61('0x13')});});},'Reload':function(_0x5de159){var _0x2a6b04=this;return new Promise(function(_0x58d9a0,_0x106472){if(ami[_0xef61('0x14')]()==![]){return _0x106472(_0x2a6b04[_0xef61('0x15')](0x1f4,[config[_0xef61('0x16')]['ip'],config['asterisk'][_0xef61('0x17')],_0xef61('0x18')][_0xef61('0x19')]('\x20')));}_0x5de159=_[_0xef61('0x1a')](_0x5de159,_['keys'](properties[_0xef61('0x1b')]));_0x5de159[_0xef61('0x1c')]='Reload';return ami[_0xef61('0x1d')](_0x5de159)[_0xef61('0x1e')](function(_0x36f558){_0x58d9a0({'code':0xc8,'message':_0x36f558[_0xef61('0x1f')]});})[_0xef61('0x20')](function(_0x28315a){_0x106472(_0x2a6b04[_0xef61('0x15')](0x1f5,_0x28315a['message']));});});},'Command':function(_0x39443d){var _0x2c8dad=this;return new Promise(function(_0x4a3af6,_0xb7ba69){if(ami[_0xef61('0x14')]()==![]){return _0xb7ba69(_0x2c8dad[_0xef61('0x15')](0x1f4,[config[_0xef61('0x16')]['ip'],config[_0xef61('0x16')][_0xef61('0x17')],_0xef61('0x18')]['join']('\x20')));}_0x39443d=_['pick'](_0x39443d,_0xef61('0x21'));_0x39443d['action']=_0xef61('0x22');return ami['Action'](_0x39443d)['then'](function(_0x2f0569){_0x4a3af6({'code':0xc8,'message':_0x2f0569['content']});})['catch'](function(_0xfbee94){_0xb7ba69(_0x2c8dad[_0xef61('0x15')](0x1f5,_0xfbee94[_0xef61('0x1f')]));});});},'VoiceQueues':function(_0x111bac){return new Promise(function(_0x5e56da,_0x16b144){var _0x4e738f=[];for(var _0x2a6832 in _0x239fa9[_0xef61('0x23')]){if(_0x239fa9[_0xef61('0x23')][_0xef61('0x24')](_0x2a6832)){var _0x2155f1=_0x239fa9[_0xef61('0x23')][_0x2a6832];var _0x258b5a={'id':_0x2155f1['id'],'name':_0x2155f1[_0xef61('0xc')],'strategy':_0x2155f1[_0xef61('0x25')],'answered':_0x2155f1[_0xef61('0x26')],'available':_0x2155f1[_0xef61('0x27')],'loggedIn':_0x2155f1[_0xef61('0x28')],'pTalking':_0x2155f1[_0xef61('0x29')],'sumBillable':_0x2155f1[_0xef61('0x2a')],'sumDuration':_0x2155f1[_0xef61('0x2b')],'sumHoldTime':_0x2155f1[_0xef61('0x2c')]||0x0,'talking':_0x2155f1[_0xef61('0x2d')],'total':_0x2155f1[_0xef61('0x2e')],'type':_0x2155f1[_0xef61('0x2f')],'unmanaged':_0x2155f1[_0xef61('0x30')],'abandoned':_0x2155f1[_0xef61('0x31')],'waiting':_0x2155f1[_0xef61('0x32')],'loggedInDb':_0x2155f1['loggedInDb']};if(_0x2155f1['type']===_0xef61('0x33')){_0x258b5a[_0xef61('0x34')]=_0x2155f1[_0xef61('0x34')];_0x258b5a['dialMethod']=_0x2155f1[_0xef61('0x35')];_0x258b5a[_0xef61('0x36')]=_0x2155f1['dialOriginateCallerIdName'];_0x258b5a[_0xef61('0x37')]=_0x2155f1['dialOriginateCallerIdNumber'];_0x258b5a['dialOriginateTimeout']=_0x2155f1[_0xef61('0x38')];_0x258b5a['dialPrefix']=_0x2155f1[_0xef61('0x39')];_0x258b5a['temp']=_0x2155f1[_0xef61('0x3a')];_0x258b5a[_0xef61('0x3b')]=_0x2155f1[_0xef61('0x3b')];_0x258b5a[_0xef61('0x3c')]=_0x2155f1[_0xef61('0x3c')];_0x258b5a[_0xef61('0x3d')]=_0x2155f1[_0xef61('0x3d')];_0x258b5a[_0xef61('0x3e')]=_0x2155f1[_0xef61('0x3e')];_0x258b5a[_0xef61('0x3f')]=_0x2155f1['outboundCongestionCallsDay'];_0x258b5a[_0xef61('0x40')]=_0x2155f1[_0xef61('0x40')];_0x258b5a[_0xef61('0x41')]=_0x2155f1[_0xef61('0x41')];_0x258b5a[_0xef61('0x42')]=_0x2155f1['outboundDropCallsDayTimeout'];_0x258b5a[_0xef61('0x43')]=_0x2155f1[_0xef61('0x43')];_0x258b5a[_0xef61('0x44')]=_0x2155f1['outboundNoSuchCallsDay'];_0x258b5a['outboundOriginateFailureCallsDay']=_0x2155f1['outboundOriginateFailureCallsDay'];_0x258b5a[_0xef61('0x45')]=_0x2155f1['outboundReCallsDay'];_0x258b5a['outboundRejectCallsDay']=_0x2155f1['outboundRejectCallsDay'];_0x258b5a[_0xef61('0x46')]=_0x2155f1[_0xef61('0x46')];_0x258b5a[_0xef61('0x47')]=_0x2155f1['predictiveIntervalAnsweredCalls'];_0x258b5a['predictiveIntervalAvgHoldtime']=_0x2155f1['predictiveIntervalAvgHoldtime'];_0x258b5a[_0xef61('0x48')]=_0x2155f1[_0xef61('0x48')];_0x258b5a['predictiveIntervalDroppedCallsCallersExit']=_0x2155f1[_0xef61('0x49')];_0x258b5a[_0xef61('0x4a')]=_0x2155f1[_0xef61('0x4a')];_0x258b5a[_0xef61('0x4b')]=_0x2155f1['predictiveIntervalErlangCalls'];_0x258b5a[_0xef61('0x4c')]=_0x2155f1[_0xef61('0x4c')];_0x258b5a[_0xef61('0x4d')]=_0x2155f1[_0xef61('0x4d')];_0x258b5a['predictiveIntervalMultiplicativeFactor']=_0x2155f1['predictiveIntervalMultiplicativeFactor'];_0x258b5a[_0xef61('0x4e')]=_0x2155f1[_0xef61('0x4e')];_0x258b5a[_0xef61('0x4f')]=_0x2155f1['predictiveIntervalAvailable'];_0x258b5a[_0xef61('0x50')]=_0x2155f1[_0xef61('0x50')];_0x258b5a[_0xef61('0x1f')]=_0x2155f1[_0xef61('0x1f')];_0x258b5a['originated']=_0x2155f1['originated'];_0x258b5a['erlangCalls']=_0x2155f1[_0xef61('0x51')];_0x258b5a[_0xef61('0x52')]=_0x2155f1[_0xef61('0x52')];_0x258b5a[_0xef61('0x53')]=_0x2155f1[_0xef61('0x53')];_0x258b5a[_0xef61('0x54')]=_0x2155f1[_0xef61('0x54')];_0x258b5a['startPredictive']=_0x2155f1[_0xef61('0x55')];_0x258b5a[_0xef61('0x56')]=_0x2155f1[_0xef61('0x56')];}if(_0x2155f1[_0xef61('0x57')]){_0x258b5a['Trunk']={'id':_0x2155f1[_0xef61('0x57')]['id'],'name':_0x2155f1[_0xef61('0x57')][_0xef61('0xc')],'active':_0x2155f1[_0xef61('0x57')][_0xef61('0x58')],'callerid':_0x2155f1[_0xef61('0x57')]['callerid']};}if(_0x2155f1[_0xef61('0x59')]){_0x258b5a[_0xef61('0x59')]={'id':_0x2155f1[_0xef61('0x59')]['id'],'name':_0x2155f1['Interval'][_0xef61('0xc')]};}_0x4e738f[_0xef61('0x5a')](_0x258b5a);}}_0x5e56da({'count':_0x4e738f[_0xef61('0x5b')],'rows':_0x4e738f});});},'UpdateVoiceQueue':function(_0x408e7c){return new Promise(function(_0x216916,_0x354ab1){var _0x4efe56=_[_0xef61('0x5c')](_0x239fa9[_0xef61('0x23')],{'id':parseInt(_0x408e7c['id'])});var _0x5c6ab1=_[_0xef61('0x5d')](_0x408e7c,['id']);if(_0x4efe56){for(var _0x37da22 in _0x5c6ab1){if(typeof _0x5c6ab1[_0x37da22]!==_0xef61('0x5e')&&typeof _0x4efe56[_0x37da22]!==_0xef61('0x5e')){_0x4efe56[_0x37da22]=_0x5c6ab1[_0x37da22];}}_0x216916(_0x4efe56);}else{_0x354ab1();}});},'VoiceChannels':function(_0x5aed1e){return new Promise(function(_0x260c42,_0x20e4f2){var _0x5e614b=_['values'](_0x239fa9[_0xef61('0x5f')]);_0x260c42({'count':_0x5e614b[_0xef61('0x5b')],'rows':_0x5e614b});});},'VoiceChannelMixMonitor':function(_0x53bd30){var _0xe9d203=this;return new Promise(function(_0x132c77,_0x13d0f8){if(ami[_0xef61('0x14')]()==![]){return _0x13d0f8(_0xe9d203[_0xef61('0x15')](0x1f4,[config[_0xef61('0x16')]['ip'],config[_0xef61('0x16')]['username'],_0xef61('0x18')]['join']('\x20')));}var _0x89c04e=schema(properties[_0xef61('0x60')])[_0xef61('0x3')](_0x53bd30);if(_0x89c04e[_0xef61('0x5b')]>0x0){return _0x13d0f8(_0xe9d203[_0xef61('0x15')](0x1f4,_[_0xef61('0x61')](_0x89c04e,_0xef61('0x1f'))[_0xef61('0x19')](',\x20')));}var _0x264877=_['find'](_0x239fa9[_0xef61('0x5f')],{'uniqueid':_0x53bd30[_0xef61('0x62')]});if(_0x264877&&_0x264877['channel']){var _0x5316ac=util[_0xef61('0x63')](_0xef61('0x64'),_0x53bd30['filename']||_0x53bd30[_0xef61('0x62')],_0x53bd30['format']||_0xef61('0x65'));return ami[_0xef61('0x1d')]({'action':_0xef61('0x66'),'channel':_0x264877[_0xef61('0x67')],'file':_0x5316ac,'options':_0xef61('0x68')})[_0xef61('0x1e')](function(_0x593a9a){var _0x474dad=_[_0xef61('0x5c')](_0x264877['monitors'],{'filename':_0xef61('0x69')+_0x5316ac[_0xef61('0x6a')]()});if(_['isNil'](_0x474dad)){_0x264877['monitors'][_0xef61('0x5a')]({'filename':'/var/spool/asterisk/monitor/'+_0x5316ac['toLowerCase'](),'createdAt':moment()['format'](_0xef61('0x6b')),'mixmonitorid':_0x593a9a[_0xef61('0x6c')],'status':'rec'});}else{_0x474dad[_0xef61('0x6c')]=_0x593a9a[_0xef61('0x6c')];_0x474dad[_0xef61('0x6d')]=_0xef61('0x6e');}_0x132c77({'code':0xc8,'message':[_0x53bd30[_0xef61('0x62')],_0xef61('0x6f'),_0x593a9a[_0xef61('0x6c')]][_0xef61('0x19')]('\x20'),'mixmonitorid':_0x593a9a['mixmonitorid']});})['catch'](function(_0x1cb2ef){_0x13d0f8(_0xe9d203[_0xef61('0x15')](0x1f5,[_0x53bd30[_0xef61('0x62')],_0x1cb2ef[_0xef61('0x1f')][_0xef61('0x6a')]()]['join']('\x20')));});}else{return _0x13d0f8(_0xe9d203[_0xef61('0x15')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x5f3b97){var _0x290a23=this;return new Promise(function(_0x310206,_0x224f3a){if(ami['isConnected']()==![]){return _0x224f3a(_0x290a23[_0xef61('0x15')](0x1f4,[config[_0xef61('0x16')]['ip'],config[_0xef61('0x16')][_0xef61('0x17')],_0xef61('0x18')][_0xef61('0x19')]('\x20')));}var _0x2984a7=schema(properties[_0xef61('0x60')])[_0xef61('0x3')](_0x5f3b97);if(_0x2984a7[_0xef61('0x5b')]>0x0){return _0x224f3a(_0x290a23['error'](0x1f4,_[_0xef61('0x61')](_0x2984a7,'message')['join'](',\x20')));}var _0x4386a7=_[_0xef61('0x5c')](_0x239fa9[_0xef61('0x5f')],{'uniqueid':_0x5f3b97[_0xef61('0x62')]});if(_0x4386a7){return BPromise[_0xef61('0x70')]()[_0xef61('0x1e')](function(){if(_0x4386a7['channel']){return ami['Action']({'action':_0xef61('0x71'),'channel':_0x4386a7[_0xef61('0x67')],'mixmonitorid':_0x5f3b97[_0xef61('0x6c')]})[_0xef61('0x20')](function(_0x2921b9){});}})[_0xef61('0x1e')](function(){if(_0x4386a7[_0xef61('0x72')]){return ami[_0xef61('0x1d')]({'action':_0xef61('0x71'),'channel':_0x4386a7[_0xef61('0x72')],'mixmonitorid':_0x5f3b97[_0xef61('0x6c')]})['catch'](function(_0x18d0e8){});}})[_0xef61('0x1e')](function(_0x485945){var _0x4559a6=_[_0xef61('0x5c')](_0x4386a7[_0xef61('0x73')],{'mixmonitorid':_0x5f3b97[_0xef61('0x6c')]});if(_0x4559a6){_0x4559a6[_0xef61('0x6d')]=_0xef61('0x74');}})[_0xef61('0x1e')](function(){var _0x3d9760=util['format'](_0xef61('0x64'),_0x5f3b97['filename']||_0x5f3b97['uniqueid'],_0x5f3b97['format']||_0xef61('0x65'));var _0x205f80=_[_0xef61('0x5c')](_0x4386a7['monitors'],{'filename':_0xef61('0x69')+_0x3d9760[_0xef61('0x6a')]()});if(_0x205f80){_0x205f80[_0xef61('0x6d')]=_0xef61('0x74');}})[_0xef61('0x1e')](function(){_0x310206({'code':0xc8,'message':[_0x5f3b97[_0xef61('0x62')],_0xef61('0x75')][_0xef61('0x19')]('\x20')});})[_0xef61('0x20')](function(_0x2d24c4){_0x224f3a(_0x290a23[_0xef61('0x15')](0x1f5,[_0x5f3b97[_0xef61('0x62')],_0x2d24c4[_0xef61('0x1f')][_0xef61('0x6a')]()][_0xef61('0x19')]('\x20')));});}else{return _0x224f3a(_0x290a23[_0xef61('0x15')](0x1f5,_0xef61('0x76')));}});},'VoiceQueuesChannels':function(_0x117d37){return new Promise(function(_0x529a78,_0xb0ab6d){var _0x1a990c=_[_0xef61('0x77')](_0x239fa9[_0xef61('0x78')]);_0x529a78({'count':_0x1a990c[_0xef61('0x5b')],'rows':_0x1a990c});});},'VoiceQueuesChannel':function(_0x346752){var _0x51e179=this;return new Promise(function(_0xd7537e,_0x38d683){var _0x582492=schema(properties[_0xef61('0x79')])['validate'](_0x346752);if(_0x582492[_0xef61('0x5b')]>0x0){return _0x38d683(_0x51e179[_0xef61('0x15')](0x1f4,_['map'](_0x582492,_0xef61('0x1f'))['join'](',\x20')));}var _0x3cba7f=_[_0xef61('0x5c')](_0x239fa9['queueChannels'],{'uniqueid':_0x346752['uniqueid']});if(_0x3cba7f){_0xd7537e(_0x3cba7f);}else{return _0x38d683(_0x51e179[_0xef61('0x15')](0x1f5,_0xef61('0x76')));}});},'VoiceQueuesChannelHangup':function(_0x7083d8){var _0x3b64e2=this;return new Promise(function(_0x46d614,_0x51255b){if(ami[_0xef61('0x14')]()==![]){return _0x51255b(_0x3b64e2[_0xef61('0x15')](0x1f4,[config[_0xef61('0x16')]['ip'],config[_0xef61('0x16')][_0xef61('0x17')],_0xef61('0x18')]['join']('\x20')));}var _0x28f379=schema(properties['voicequeuechannelhangup'])[_0xef61('0x3')](_0x7083d8);if(_0x28f379[_0xef61('0x5b')]>0x0){return _0x51255b(_0x3b64e2[_0xef61('0x15')](0x1f4,_[_0xef61('0x61')](_0x28f379,_0xef61('0x1f'))[_0xef61('0x19')](',\x20')));}var _0x1eef77=_[_0xef61('0x5c')](_0x239fa9[_0xef61('0x78')],{'uniqueid':_0x7083d8[_0xef61('0x62')]});if(_0x1eef77&&_0x1eef77[_0xef61('0x67')]){return ami[_0xef61('0x1d')]({'action':_0xef61('0x7a'),'channel':_0x1eef77['channel']})[_0xef61('0x1e')](function(_0x37f2e8){_0x46d614({'code':0xc8,'message':[_0x7083d8[_0xef61('0x62')],_0x37f2e8[_0xef61('0x1f')]['toLowerCase']()][_0xef61('0x19')]('\x20')});})['catch'](function(_0x5c5a60){_0x51255b(_0x3b64e2[_0xef61('0x15')](0x1f5,[_0x7083d8['uniqueid'],_0x5c5a60[_0xef61('0x1f')]['toLowerCase']()]['join']('\x20')));});}else{return _0x51255b(_0x3b64e2[_0xef61('0x15')](0x1f5,_0xef61('0x76')));}});},'VoiceQueuesChannelRedirect':function(_0x4f6351){var _0x13cb62=this;return new Promise(function(_0x4a2e8c,_0x11f9c8){if(ami[_0xef61('0x14')]()==![]){return _0x11f9c8(_0x13cb62[_0xef61('0x15')](0x1f4,[config[_0xef61('0x16')]['ip'],config['asterisk'][_0xef61('0x17')],'ami\x20disconnected'][_0xef61('0x19')]('\x20')));}var _0x2ddf83=schema(properties[_0xef61('0x7b')])[_0xef61('0x3')](_0x4f6351);if(_0x2ddf83[_0xef61('0x5b')]>0x0){return _0x11f9c8(_0x13cb62[_0xef61('0x15')](0x1f4,_[_0xef61('0x61')](_0x2ddf83,_0xef61('0x1f'))[_0xef61('0x19')](',\x20')));}var _0x540b68=_[_0xef61('0x5c')](_0x239fa9['queueChannels'],{'uniqueid':_0x4f6351[_0xef61('0x62')]});if(_0x540b68&&_0x540b68[_0xef61('0x67')]){return ami['Action']({'action':_0xef61('0x7c'),'channel':_0x540b68['channel'],'exten':_0x4f6351['exten'],'context':_0x4f6351[_0xef61('0x7d')]||_0x540b68[_0xef61('0x7d')],'priority':0x1})['then'](function(_0x1caf33){_0x4a2e8c({'code':0xc8,'message':[_0x4f6351[_0xef61('0x62')],_0x1caf33['message'][_0xef61('0x6a')]()][_0xef61('0x19')]('\x20')});})['catch'](function(_0x6539a5){_0x11f9c8(_0x13cb62['error'](0x1f5,[_0x4f6351[_0xef61('0x62')],_0x6539a5[_0xef61('0x1f')][_0xef61('0x6a')]()][_0xef61('0x19')]('\x20')));});}else{return _0x11f9c8(_0x13cb62['error'](0x1f5,_0xef61('0x76')));}});},'Agents':function(_0x1b48ea){return new Promise(function(_0x113bf2,_0x4dc8c0){var _0xa1b8d2=_[_0xef61('0x77')](_0x239fa9['agents']);_0x113bf2({'count':_0xa1b8d2['length'],'rows':_0xa1b8d2});});},'Telephones':function(_0x146652){return new Promise(function(_0x229f92,_0x30887a){var _0x3d829e=_[_0xef61('0x77')](_0x239fa9[_0xef61('0x7e')]);_0x229f92({'count':_0x3d829e[_0xef61('0x5b')],'rows':_0x3d829e});});},'Trunks':function(_0x113f9c){return new Promise(function(_0x16b0cb,_0x12a8e){var _0x17f16a=_[_0xef61('0x77')](_0x239fa9[_0xef61('0x7f')]);_0x16b0cb({'count':_0x17f16a[_0xef61('0x5b')],'rows':_0x17f16a});});},'OutboundChannels':function(_0x437b81){return new Promise(function(_0x2f5888,_0x5bb94b){var _0x2ca676=_[_0xef61('0x77')](_0x239fa9[_0xef61('0x80')]);_0x2f5888({'count':_0x2ca676[_0xef61('0x5b')],'rows':_0x2ca676});});},'Outbound':function(_0x3d0f55){return new Promise(function(_0x2a13b0,_0x29ef4b){_0x2a13b0(_0x239fa9[_0xef61('0x33')]);});},'Campaigns':function(_0x1aa0b3){return new Promise(function(_0x371dd3,_0x41be5a){var _0x2ebe38=_['values'](_0x239fa9[_0xef61('0x81')]);_0x371dd3({'count':_0x2ebe38[_0xef61('0x5b')],'rows':_0x2ebe38});});},'VoiceQueuesPreview':function(_0x5f25d7){var _0x32d478=this;return new Promise(function(_0x3607f9,_0x4629bf){_0x45a18d[_0xef61('0x82')](_0x5f25d7['id'])[_0xef61('0x1e')](function(_0x51a988){_0x3607f9({'code':0xc8,'message':_0x51a988[_0xef61('0x1f')]});})['catch'](function(_0xb9a4ba){_0x4629bf(_0x32d478[_0xef61('0x15')](0x1f4,_0xb9a4ba[_0xef61('0x1f')]));});});},'EventManager':function(_0x19b1a0){var _0x2c9a86=this;return new Promise(function(_0x35f379,_0x1aeb3b){if(!_0x19b1a0[_0xef61('0x83')]){return _0x1aeb3b(_0x2c9a86['error'](0x1f4,_0xef61('0x84')));}ami[_0xef61('0x85')](_0xef61('0x86')+_0x19b1a0[_0xef61('0x83')],_0x19b1a0[_0xef61('0x1f')]);_0x35f379({'code':0xc8,'message':_0x19b1a0});});},'FaxAccounts':function(_0x3f8bdb){return new Promise(function(_0x411b1b,_0x2c8155){var _0x338d4f=_['values'](_0x239fa9[_0xef61('0x87')]);_0x411b1b({'count':_0x338d4f[_0xef61('0x5b')],'rows':_0x338d4f});});},'SendFax':function(_0x22006a){var _0x317c4a=this;return new Promise(function(_0x5d8ee9,_0x56535f){_0x5b00b2[_0xef61('0x88')](_0x22006a)[_0xef61('0x1e')](function(_0x12d514){_0x5d8ee9({'code':0xc8,'message':_0x12d514[_0xef61('0x1f')]});})[_0xef61('0x20')](function(_0x4680a6){_0x56535f(_0x317c4a[_0xef61('0x15')](0x1f4,_0x4680a6['message']));});});},'CheckAfterSend':function(_0x3f8355){var _0x660c71=this;return new Promise(function(_0x30a2c7,_0x22e342){_0x5b00b2[_0xef61('0x89')](_0x3f8355)['then'](function(_0x3a815d){_0x30a2c7({'code':0xc8,'message':_0x3a815d['message']});})[_0xef61('0x20')](function(_0x25b183){_0x22e342(_0x660c71[_0xef61('0x15')](0x1f4,_0x25b183[_0xef61('0x1f')]));});});}};var _0x4354f6=jayson[_0xef61('0x8a')](_0x4f0cc5)['http']();_0x4354f6['on'](_0xef61('0x15'),function(_0x10e5f0){return _0x3e2f79(_0x10e5f0);});_0x4354f6[_0xef61('0x9')](0x232a,_0xef61('0x8b'),function(){console[_0xef61('0x8c')](_0xef61('0x8d'),0x232a);return _0x9e17f4(_0xef61('0x8e')+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 092e354..679ff26 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 _0xed1f=['trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','isNil','data5','ListId','data3','phone','map','routeId','destcalleridnum','lastName','mobile','fax','createdAt','scheduledAt','union','resolve','then','isEmpty','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','Unknown','destcalleridname','','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger'];(function(_0x909da0,_0x8dfbf6){var _0x3f126d=function(_0x3917ef){while(--_0x3917ef){_0x909da0['push'](_0x909da0['shift']());}};_0x3f126d(++_0x8dfbf6);}(_0xed1f,0x6a));var _0xfed1=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0xed1f[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0xfed1('0x0'));var BPromise=require(_0xfed1('0x1'));var Redis=require(_0xfed1('0x2'));var util=require(_0xfed1('0x3'));var config=require(_0xfed1('0x4'));var logger=require(_0xfed1('0x5'))(_0xfed1('0x6'));var cmContactRpc=require(_0xfed1('0x7'));config[_0xfed1('0x8')]=_[_0xfed1('0x9')](config[_0xfed1('0x8')],{'host':_0xfed1('0xa'),'port':0x18eb});var io=require(_0xfed1('0xb'))(new Redis(config[_0xfed1('0x8')]));function emit(_0x380e18,_0x612b38,_0x2a6082,_0x2967ef,_0x568d48){logger[_0xfed1('0xc')](_0xfed1('0xd'),_0x380e18,_0x612b38['id'],_0x2a6082,_0x2967ef,JSON['stringify'](_0x568d48));io['to'](_0x2a6082)[_0xfed1('0xe')](_0x2967ef,_0x568d48);}exports[_0xfed1('0xf')]=function(_0x4a564e,_0x3ce017,_0x48c338,_0x1c3f40){var _0x234f4e,_0x4a8369;var _0x5c0b5f={};var _0x3d1891=Number(_0x48c338[_0xfed1('0x10')]);var _0x569a6e=_0x48c338[_0xfed1('0x11')]?Boolean(Number(_0x48c338['data2'])):![];var _0x529b3d;var _0x3f6555=![];if(!_[_0xfed1('0x12')](_0x48c338['data5'])){if(_0x48c338[_0xfed1('0x13')]=='1')_0x3f6555=!![];}if(!_0x3f6555){if(_0x1c3f40['xmd-contactid']){_0x5c0b5f['id']=_0x1c3f40['xmd-contactid'];}}if(!_0x5c0b5f['id']){_0x5c0b5f[_0xfed1('0x14')]=_0x3d1891;_0x529b3d=_0x48c338[_0xfed1('0x15')]&&_0x48c338[_0xfed1('0x15')]!=='0'?_0x48c338[_0xfed1('0x15')]['split'](','):[_0xfed1('0x16')];_0x5c0b5f['$or']=_[_0xfed1('0x17')](_0x529b3d,function(_0x29a32f){var _0x489a0f={};_0x489a0f[_0x29a32f]=_0x1c3f40[_0xfed1('0x18')]?_0x1c3f40[_0xfed1('0x19')]:_0x1c3f40['calleridnum'];return _0x489a0f;});}var _0x59509b=['id','firstName',_0xfed1('0x1a'),'phone',_0xfed1('0x1b'),_0xfed1('0x1c'),'ListId',_0xfed1('0x1d'),_0xfed1('0x1e'),'updatedAt'];var _0x3ce944=_[_0xfed1('0x1f')](_0x59509b,_0x529b3d);BPromise[_0xfed1('0x20')]()[_0xfed1('0x21')](cmContactRpc['getContacts']({'attributes':_0x3ce944,'where':_0x5c0b5f}))[_0xfed1('0x21')](function(_0x59333e){_0x4a8369=_0x59333e;if(!_[_0xfed1('0x22')](_0x4a8369)){if(_0x4a8369[_0xfed1('0x23')]===0x1){_0x234f4e=_0x4a8369[0x0];logger[_0xfed1('0xc')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x1c3f40[_0xfed1('0x24')],_0x3ce017['id'],_0x234f4e['id']);}else{logger['info'](_0xfed1('0x25'),_0x1c3f40[_0xfed1('0x24')],_0x3ce017['id'],_[_0xfed1('0x17')](_0x4a8369,'id')[_0xfed1('0x26')](','));}return;}else{logger[_0xfed1('0xc')](_0xfed1('0x27'),_0x1c3f40['uniqueid'],_0x3ce017['id']);var _0x465ce6={'ListId':_0x3d1891};var _0xcb1cdc=_0x48c338['data4']&&_0x48c338[_0xfed1('0x28')]!=='0'?_0x48c338[_0xfed1('0x28')]:_0xfed1('0x16');if(_0x569a6e){logger[_0xfed1('0xc')](_0xfed1('0x29'),_0x1c3f40[_0xfed1('0x24')],_0x3ce017['id']);_0x465ce6[_0xcb1cdc]=_['isNil'](_0x1c3f40[_0xfed1('0x18')])?_0x1c3f40['calleridnum']:_0x1c3f40[_0xfed1('0x19')];if(_['isNil'](_0x1c3f40['routeId'])){_0x465ce6[_0xfed1('0x2a')]=_0x1c3f40[_0xfed1('0x2b')]&&_0x1c3f40[_0xfed1('0x2b')]!==''?_0x1c3f40[_0xfed1('0x2b')]:_0xfed1('0x2c');}else{_0x465ce6[_0xfed1('0x2a')]=_0x1c3f40[_0xfed1('0x2d')]&&_0x1c3f40[_0xfed1('0x2d')]!==_0xfed1('0x2e')?_0x1c3f40['destcalleridname']:_0xfed1('0x2c');}return BPromise[_0xfed1('0x20')]()['then'](cmContactRpc['createContact'](_0x465ce6))[_0xfed1('0x21')](function(_0x2d10f5){_0x234f4e=_0x2d10f5;_0x4a8369[_0xfed1('0x2f')](_0x2d10f5);if(_0x234f4e){logger[_0xfed1('0xc')](_0xfed1('0x30'),_0x1c3f40['uniqueid'],_0x3ce017['id'],_0x234f4e['id']);}return;});}else{logger[_0xfed1('0xc')](_0xfed1('0x31'),_0x1c3f40[_0xfed1('0x24')],_0x3ce017['id']);_0x465ce6[_0xcb1cdc]=_[_0xfed1('0x12')](_0x1c3f40[_0xfed1('0x18')])?_0x1c3f40['calleridnum']:_0x1c3f40[_0xfed1('0x19')];if(_['isNil'](_0x1c3f40[_0xfed1('0x18')])){_0x465ce6[_0xfed1('0x2a')]=_0x1c3f40[_0xfed1('0x2b')]&&_0x1c3f40[_0xfed1('0x2b')]!==_0xfed1('0x2e')?_0x1c3f40[_0xfed1('0x2b')]:_0xfed1('0x2c');}else{_0x465ce6[_0xfed1('0x2a')]=_0x1c3f40['destcalleridname']&&_0x1c3f40[_0xfed1('0x2d')]!==_0xfed1('0x2e')?_0x1c3f40[_0xfed1('0x2d')]:_0xfed1('0x2c');}_0x234f4e=_0x465ce6;_0x4a8369['push'](_0x465ce6);return;}}})['then'](function(){if(_0x4a564e){emit(_0x1c3f40[_0xfed1('0x24')],_0x3ce017,util[_0xfed1('0x32')](_0xfed1('0x33'),_0x4a564e[_0xfed1('0x34')]),util[_0xfed1('0x32')](_0xfed1('0x35'),_0x48c338[_0xfed1('0x36')][_0xfed1('0x37')]()),{'evt':_['merge'](_0x1c3f40,{'autoCreate':_0x569a6e}),'contact':_0x234f4e===undefined?{}:_0x234f4e,'contacts':_0x4a8369['length']===0x0?undefined:_0x4a8369});}});}; \ No newline at end of file +var _0x2dae=['uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','calleridname','Unknown','destcalleridname','','then','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','toLowerCase','lodash','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','info','[CM][%s][%s]','stringify','exec','data1','data2','isNil','data5','xmd-contactid','data3','split','$or','map','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x2dae,0xc3));var _0xe2da=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0x2dae[_0x22e47a];return _0x15a12a;};'use strict';var _=require(_0xe2da('0x0'));var BPromise=require('bluebird');var Redis=require(_0xe2da('0x1'));var util=require(_0xe2da('0x2'));var config=require(_0xe2da('0x3'));var logger=require(_0xe2da('0x4'))(_0xe2da('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0xe2da('0x6')]=_[_0xe2da('0x7')](config[_0xe2da('0x6')],{'host':_0xe2da('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe2da('0x6')]));function emit(_0x89c70b,_0x34cc98,_0x2efbd8,_0x238da3,_0x1c71ea){logger[_0xe2da('0x9')](_0xe2da('0xa'),_0x89c70b,_0x34cc98['id'],_0x2efbd8,_0x238da3,JSON[_0xe2da('0xb')](_0x1c71ea));io['to'](_0x2efbd8)['emit'](_0x238da3,_0x1c71ea);}exports[_0xe2da('0xc')]=function(_0x3baaa8,_0x104fb3,_0x17086c,_0x3c1309){var _0x44ec3e,_0x1a29b9;var _0x173244={};var _0x5aab71=Number(_0x17086c[_0xe2da('0xd')]);var _0x5200b1=_0x17086c[_0xe2da('0xe')]?Boolean(Number(_0x17086c[_0xe2da('0xe')])):![];var _0x37064e;var _0x411b9f=![];if(!_[_0xe2da('0xf')](_0x17086c[_0xe2da('0x10')])){if(_0x17086c[_0xe2da('0x10')]=='1')_0x411b9f=!![];}if(!_0x411b9f){if(_0x3c1309['xmd-contactid']){_0x173244['id']=_0x3c1309[_0xe2da('0x11')];}}if(!_0x173244['id']){_0x173244['ListId']=_0x5aab71;_0x37064e=_0x17086c['data3']&&_0x17086c[_0xe2da('0x12')]!=='0'?_0x17086c[_0xe2da('0x12')][_0xe2da('0x13')](','):['phone'];_0x173244[_0xe2da('0x14')]=_[_0xe2da('0x15')](_0x37064e,function(_0x2ea60e){var _0x33568f={};_0x33568f[_0x2ea60e]=_0x3c1309['routeId']?_0x3c1309[_0xe2da('0x16')]:_0x3c1309[_0xe2da('0x17')];return _0x33568f;});}var _0x417363=['id',_0xe2da('0x18'),_0xe2da('0x19'),'phone',_0xe2da('0x1a'),_0xe2da('0x1b'),'ListId',_0xe2da('0x1c'),_0xe2da('0x1d'),_0xe2da('0x1e')];var _0x203d36=_[_0xe2da('0x1f')](_0x417363,_0x37064e);BPromise[_0xe2da('0x20')]()['then'](cmContactRpc[_0xe2da('0x21')]({'attributes':_0x203d36,'where':_0x173244}))['then'](function(_0x30efdc){_0x1a29b9=_0x30efdc;if(!_[_0xe2da('0x22')](_0x1a29b9)){if(_0x1a29b9[_0xe2da('0x23')]===0x1){_0x44ec3e=_0x1a29b9[0x0];logger[_0xe2da('0x9')](_0xe2da('0x24'),_0x3c1309[_0xe2da('0x25')],_0x104fb3['id'],_0x44ec3e['id']);}else{logger[_0xe2da('0x9')](_0xe2da('0x26'),_0x3c1309['uniqueid'],_0x104fb3['id'],_[_0xe2da('0x15')](_0x1a29b9,'id')[_0xe2da('0x27')](','));}return;}else{logger[_0xe2da('0x9')](_0xe2da('0x28'),_0x3c1309[_0xe2da('0x25')],_0x104fb3['id']);var _0x230fb8={'ListId':_0x5aab71};var _0x124d93=_0x17086c['data4']&&_0x17086c[_0xe2da('0x29')]!=='0'?_0x17086c[_0xe2da('0x29')]:_0xe2da('0x2a');if(_0x5200b1){logger[_0xe2da('0x9')](_0xe2da('0x2b'),_0x3c1309[_0xe2da('0x25')],_0x104fb3['id']);_0x230fb8[_0x124d93]=_[_0xe2da('0xf')](_0x3c1309[_0xe2da('0x2c')])?_0x3c1309['calleridnum']:_0x3c1309['destcalleridnum'];if(_['isNil'](_0x3c1309[_0xe2da('0x2c')])){_0x230fb8[_0xe2da('0x18')]=_0x3c1309[_0xe2da('0x2d')]&&_0x3c1309[_0xe2da('0x2d')]!==''?_0x3c1309['calleridname']:_0xe2da('0x2e');}else{_0x230fb8[_0xe2da('0x18')]=_0x3c1309[_0xe2da('0x2f')]&&_0x3c1309[_0xe2da('0x2f')]!==_0xe2da('0x30')?_0x3c1309[_0xe2da('0x2f')]:_0xe2da('0x2e');}return BPromise[_0xe2da('0x20')]()[_0xe2da('0x31')](cmContactRpc['createContact'](_0x230fb8))['then'](function(_0x672767){_0x44ec3e=_0x672767;_0x1a29b9[_0xe2da('0x32')](_0x672767);if(_0x44ec3e){logger[_0xe2da('0x9')](_0xe2da('0x33'),_0x3c1309[_0xe2da('0x25')],_0x104fb3['id'],_0x44ec3e['id']);}return;});}else{logger[_0xe2da('0x9')](_0xe2da('0x34'),_0x3c1309[_0xe2da('0x25')],_0x104fb3['id']);_0x230fb8[_0x124d93]=_[_0xe2da('0xf')](_0x3c1309[_0xe2da('0x2c')])?_0x3c1309[_0xe2da('0x17')]:_0x3c1309[_0xe2da('0x16')];if(_[_0xe2da('0xf')](_0x3c1309[_0xe2da('0x2c')])){_0x230fb8[_0xe2da('0x18')]=_0x3c1309[_0xe2da('0x2d')]&&_0x3c1309[_0xe2da('0x2d')]!==_0xe2da('0x30')?_0x3c1309['calleridname']:_0xe2da('0x2e');}else{_0x230fb8[_0xe2da('0x18')]=_0x3c1309[_0xe2da('0x2f')]&&_0x3c1309['destcalleridname']!==_0xe2da('0x30')?_0x3c1309[_0xe2da('0x2f')]:_0xe2da('0x2e');}_0x44ec3e=_0x230fb8;_0x1a29b9['push'](_0x230fb8);return;}}})['then'](function(){if(_0x3baaa8){emit(_0x3c1309[_0xe2da('0x25')],_0x104fb3,util[_0xe2da('0x35')]('user:%s',_0x3baaa8[_0xe2da('0x36')]),util[_0xe2da('0x35')](_0xe2da('0x37'),_0x17086c[_0xe2da('0x38')][_0xe2da('0x39')]()),{'evt':_['merge'](_0x3c1309,{'autoCreate':_0x5200b1}),'contact':_0x44ec3e===undefined?{}:_0x44ec3e,'contacts':_0x1a29b9[_0xe2da('0x23')]===0x0?undefined:_0x1a29b9});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 925a15d..c28f13c 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 _0xb41f=['parse','query','search','replace','checkTrigger','channel','AllConditions','every','checkConditions','some','AnyConditions','chat','ChatWebsiteId','value','AccountId','operator','upperFirst','interaction','event','queue','membername','lastevent','routeId','exports','util','lodash','url','mustache','./urlforward','./integration','./script','../../../config/logger','trigger','defaults','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','sugarcrmAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:acceptmessage','emit','info','prototype','undefined','motionChannel','voice','checkTriggers','merge','variables','Actions','length','action','motionbar','browser','data1','data2','html','render','uri','buildUri','data3','isNil','data4','location','windowWidth','data5','800','data6','600','winApplication','winArguments','format','user:%s','interface','name','trigger:%s:%s','jscripty','trigger:%s','toLowerCase','contactmanager','exec','urlforward','script'];(function(_0x33b0bd,_0x182679){var _0x41b549=function(_0x14e3f4){while(--_0x14e3f4){_0x33b0bd['push'](_0x33b0bd['shift']());}};_0x41b549(++_0x182679);}(_0xb41f,0x104));var _0xfb41=function(_0x53b00b,_0x4db05d){_0x53b00b=_0x53b00b-0x0;var _0x54b118=_0xb41f[_0x53b00b];return _0x54b118;};'use strict';var util=require(_0xfb41('0x0'));var _=require(_0xfb41('0x1'));var url=require(_0xfb41('0x2'));var Mustache=require(_0xfb41('0x3'));var Redis=require('ioredis');var urlforward=require(_0xfb41('0x4'));var integration=require(_0xfb41('0x5'));var cmContact=require('./cmContact');var script=require(_0xfb41('0x6'));var config=require('../../../config/environment');var logger=require(_0xfb41('0x7'))(_0xfb41('0x8'));var ami=require('../ami');config['redis']=_[_0xfb41('0x9')](config[_0xfb41('0xa')],{'host':_0xfb41('0xb'),'port':0x18eb});var io=require(_0xfb41('0xc'))(new Redis(config[_0xfb41('0xa')]));var operators={'equals':function(_0xe51bac,_0x5c6605){return _0xe51bac==_0x5c6605;},'not_equals':function(_0x143bc,_0x2e3e94){return _0x143bc!=_0x2e3e94;}};var barAndWebActions=[_0xfb41('0xd'),_0xfb41('0x2'),_0xfb41('0xe')];function Trigger(_0x30919b){this['triggers']=_0x30919b[_0xfb41('0xf')];this[_0xfb41('0x10')]=_0x30919b[_0xfb41('0x10')];this[_0xfb41('0x11')]=_0x30919b[_0xfb41('0x11')];this[_0xfb41('0x12')]=_0x30919b[_0xfb41('0x12')];this[_0xfb41('0x13')]=_0x30919b[_0xfb41('0x13')];this['zendeskAccounts']=_0x30919b[_0xfb41('0x14')];this[_0xfb41('0x15')]=_0x30919b['freshdeskAccounts'];this[_0xfb41('0x16')]=_0x30919b[_0xfb41('0x16')];this['sugarcrmAccounts']=_0x30919b['sugarcrmAccounts'];this[_0xfb41('0x17')]=_0x30919b[_0xfb41('0x17')];this[_0xfb41('0x18')]=_0x30919b[_0xfb41('0x18')];this['vtigerAccounts']=_0x30919b[_0xfb41('0x19')];this[_0xfb41('0x1a')]=_0x30919b['servicenowAccounts'];this[_0xfb41('0x1b')]=_0x30919b['dynamics365Accounts'];this[_0xfb41('0x1c')]=_0x30919b['freshsalesAccounts'];this[_0xfb41('0x1d')]={'zendesk':this[_0xfb41('0x14')],'salesforce':this[_0xfb41('0x16')],'freshdesk':this[_0xfb41('0x15')],'sugarcrm':this[_0xfb41('0x1e')],'zoho':this[_0xfb41('0x17')],'desk':this[_0xfb41('0x18')],'vtiger':this[_0xfb41('0x19')],'dynamics365':this[_0xfb41('0x1b')],'freshsales':this[_0xfb41('0x1c')],'servicenow':this[_0xfb41('0x1a')]};ami['on'](_0xfb41('0x1f'),this[_0xfb41('0x20')]['bind'](this));ami['on'](_0xfb41('0x21'),this['syncCustomEvent'][_0xfb41('0x22')](this));ami['on'](_0xfb41('0x23'),this[_0xfb41('0x20')][_0xfb41('0x22')](this));ami['on'](_0xfb41('0x24'),this[_0xfb41('0x20')]['bind'](this));ami['on'](_0xfb41('0x25'),this[_0xfb41('0x20')][_0xfb41('0x22')](this));ami['on'](_0xfb41('0x26'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentbusy',this[_0xfb41('0x20')][_0xfb41('0x22')](this));ami['on'](_0xfb41('0x27'),this[_0xfb41('0x20')][_0xfb41('0x22')](this));ami['on']('custom:agentreject',this[_0xfb41('0x20')][_0xfb41('0x22')](this));ami['on'](_0xfb41('0x28'),this[_0xfb41('0x20')][_0xfb41('0x22')](this));ami['on'](_0xfb41('0x29'),this[_0xfb41('0x20')][_0xfb41('0x22')](this));ami['on'](_0xfb41('0x2a'),this['syncCustomEvent']['bind'](this));ami['on'](_0xfb41('0x2b'),this[_0xfb41('0x2c')][_0xfb41('0x22')](this));ami['on'](_0xfb41('0x2d'),this[_0xfb41('0x2c')][_0xfb41('0x22')](this));ami['on'](_0xfb41('0x2e'),this['syncAgentDial']['bind'](this));ami['on'](_0xfb41('0x2f'),this[_0xfb41('0x20')][_0xfb41('0x22')](this));ami['on'](_0xfb41('0x30'),this['syncCustomEvent'][_0xfb41('0x22')](this));ami['on'](_0xfb41('0x31'),this[_0xfb41('0x20')][_0xfb41('0x22')](this));ami['on']('custom:outgoingmessage',this[_0xfb41('0x20')]['bind'](this));ami['on'](_0xfb41('0x32'),this[_0xfb41('0x20')][_0xfb41('0x22')](this));ami['on']('custom:rejectmessage',this[_0xfb41('0x20')][_0xfb41('0x22')](this));}Trigger['prototype'][_0xfb41('0x33')]=function(_0xfd3122,_0x20f886,_0x50038f){logger[_0xfb41('0x34')](_0xfd3122,_0x20f886,JSON['stringify'](_0x50038f));io['to'](_0xfd3122)[_0xfb41('0x33')](_0x20f886,_0x50038f);};Trigger[_0xfb41('0x35')][_0xfb41('0x20')]=function(_0x54a48e){var _0x2549ad=_['clone'](_0x54a48e);if(typeof _0x2549ad['motionChannel']===_0xfb41('0x36')){_0x2549ad[_0xfb41('0x37')]=_0xfb41('0x38');}this[_0xfb41('0x39')](_0x2549ad);};Trigger[_0xfb41('0x35')][_0xfb41('0x2c')]=function(_0x5a3dfb){if(this[_0xfb41('0x10')][_0x5a3dfb['interface']]){this[_0xfb41('0x20')](_0x5a3dfb);}};Trigger[_0xfb41('0x35')][_0xfb41('0x39')]=function(_0x4cbdd4){var _0x29c4e2;for(var _0x422f49 in this[_0xfb41('0xf')]){if(this['triggers']['hasOwnProperty'](_0x422f49)){if(this[_0xfb41('0xf')][_0x422f49]['status']){_0x29c4e2=this['checkTrigger'](this['triggers'][_0x422f49],_0x4cbdd4);if(_0x29c4e2){_[_0xfb41('0x3a')](_0x4cbdd4,_0x4cbdd4[_0xfb41('0x3b')]);for(var _0x2723d0=0x0,_0x2bdd01,_0x48b675,_0x424692;_0x2723d00x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x5fc3,0xa8));var _0x35fc=function(_0x56e0e8,_0x16ef91){_0x56e0e8=_0x56e0e8-0x0;var _0x2dab50=_0x5fc3[_0x56e0e8];return _0x2dab50;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 18a8373..078336e 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 _0xfe20=[']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','error',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','request-promise','./util','md5','../../../../config/environment','redis','defaults','localhost','remoteUri','username','password','then','catch',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','isNil','validateEmail','email','userEmail','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','4.0','headers','odata-entityid','substring','lastIndexOf','enduserId','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b',']\x20Enduser\x20Created!','forEach','includes','string','type','nameField','customField','indexOf','content','ticketType','incident','POST','assign','getString','Subjects','Descriptions','phonecall','/contacts(','callDirection','queue','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0xfe20,0x11f));var _0x0fe2=function(_0x2bc04f,_0x39e22a){_0x2bc04f=_0x2bc04f-0x0;var _0x38c218=_0xfe20[_0x2bc04f];return _0x38c218;};'use strict';var _=require(_0x0fe2('0x0'));var BPromise=require('bluebird');var rp=require(_0x0fe2('0x1'));var util=require('util');var intUtil=require(_0x0fe2('0x2'));var md5=require(_0x0fe2('0x3'));var Redis=require('ioredis');var logger=require('../../../../config/logger')('dynamics365');var config=require(_0x0fe2('0x4'));config[_0x0fe2('0x5')]=_[_0x0fe2('0x6')](config[_0x0fe2('0x5')],{'host':_0x0fe2('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x1a50d2,_0x52e72e,_0x171dba){var _0x5a91ac={'method':'POST','uri':_0x52e72e,'form':{'client_id':_0x1a50d2['clientId'],'resource':_0x1a50d2[_0x0fe2('0x8')],'username':_0x1a50d2[_0x0fe2('0x9')],'password':_0x1a50d2[_0x0fe2('0xa')],'grant_type':_0x0fe2('0xa'),'client_secret':_0x1a50d2['clientSecret']},'json':!![]};return rp(_0x5a91ac)[_0x0fe2('0xb')](function(_0x42c2c6){return _0x42c2c6['access_token'];})[_0x0fe2('0xc')](function(_0x17ea81){logger['error']('['+[_0x171dba['toUpperCase']()]+_0x0fe2('0xd'));return _0x17ea81[_0x0fe2('0xe')];});}function getUser(_0x1cecb4,_0x4706f7,_0x674fa9,_0x139d8a,_0x1b466e,_0x35eeba){return new BPromise(function(_0x55d821,_0x3ababd){return getAuthToken(_0x4706f7,_0x139d8a,_0x35eeba)[_0x0fe2('0xb')](function(_0x3c0fa7){var _0x54094d={'method':'GET','uri':_0x1b466e+_0x0fe2('0xf'),'headers':{'Authorization':_0x0fe2('0x10')+_0x3c0fa7,'OData-Version':'4.0'},'json':!![]};return rp(_0x54094d);})['then'](function(_0x5253c9){var _0x5a9a5d=_0x5253c9[_0x0fe2('0x11')];var _0x3cfbc1=![];var _0x27a38b=null;if(!_[_0x0fe2('0x12')](_0x674fa9)){if(intUtil[_0x0fe2('0x13')](_0x674fa9[_0x0fe2('0x14')])){_0x1cecb4[_0x0fe2('0x15')]=_0x674fa9[_0x0fe2('0x14')];for(_0x27a38b=0x0;_0x27a38b<_0x5a9a5d['length'];_0x27a38b++){if(_0x5a9a5d[_0x27a38b][_0x0fe2('0x16')]===_0x674fa9['email']&&!_0x5a9a5d[_0x27a38b]['isdisabled']){_0x3cfbc1=!![];logger[_0x0fe2('0x17')]('['+[_0x35eeba[_0x0fe2('0x18')]()]+_0x0fe2('0x19')+_0x5a9a5d[_0x27a38b][_0x0fe2('0x1a')]+'!');_0x1cecb4[_0x0fe2('0x1b')]=_0x5a9a5d[_0x27a38b]['systemuserid'];}}}}if(!_0x3cfbc1){logger[_0x0fe2('0x17')]('['+[_0x35eeba[_0x0fe2('0x18')]()]+_0x0fe2('0x1c'));_0x1cecb4[_0x0fe2('0x15')]=_0x4706f7['username'];for(_0x27a38b=0x0;_0x27a38b<_0x5a9a5d[_0x0fe2('0x1d')];_0x27a38b++){if(_0x5a9a5d[_0x27a38b]['internalemailaddress']===_0x4706f7[_0x0fe2('0x9')]){_0x1cecb4[_0x0fe2('0x1b')]=_0x5a9a5d[_0x27a38b][_0x0fe2('0x1a')];}}}_0x55d821(_0x1cecb4);})[_0x0fe2('0xc')](function(_0x165fa3){_0x3ababd(_0x165fa3['message']);});});}function createEndUser(_0x1c806e,_0x282bd8,_0x4fe134,_0x2f0121,_0x1ecea8,_0x2025fc){return new BPromise(function(_0x2899a6,_0x6fd715){return getAuthToken(_0x282bd8,_0x4fe134,_0x2025fc)[_0x0fe2('0xb')](function(_0x2a7013){var _0x2b9a37=_0x2025fc[_0x0fe2('0x1e')]()===_0x0fe2('0x1f')?_0x1ecea8[_0x0fe2('0x20')]:_0x1ecea8[_0x0fe2('0x21')];var _0x3b92e2={'method':'POST','uri':_0x2f0121+_0x0fe2('0x22'),'body':{'telephone1':_0x2b9a37,'fullname':_0x2b9a37,'firstname':_0x2b9a37,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x0fe2('0x23')+_0x1c806e[_0x0fe2('0x1b')]+')'},'headers':{'Authorization':_0x0fe2('0x10')+_0x2a7013,'OData-Version':_0x0fe2('0x24')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3b92e2);})['then'](function(_0xb2adc5){var _0x3dba24=_0xb2adc5[_0x0fe2('0x25')][_0x0fe2('0x26')];var _0x1d5838=_0x3dba24[_0x0fe2('0x27')](_0x3dba24['lastIndexOf']('(')+0x1,_0x3dba24[_0x0fe2('0x28')](')'));_0x1c806e[_0x0fe2('0x29')]=_0x1d5838;_0x2899a6(_0x1c806e);})[_0x0fe2('0xc')](function(_0x68a7b7){_0x6fd715(_0x68a7b7[_0x0fe2('0xe')]);});});}function getEndUser(_0xb3b298,_0x88a1ad,_0x40a9ea,_0x254f2b,_0xaaa1d8,_0x25afa7){return new BPromise(function(_0x296e80,_0x46a1ad){var _0x2b4392=_0x25afa7[_0x0fe2('0x1e')]()===_0x0fe2('0x1f')?_0xaaa1d8[_0x0fe2('0x20')]:_0xaaa1d8[_0x0fe2('0x21')];return getAuthToken(_0x88a1ad,_0x40a9ea,_0x25afa7)[_0x0fe2('0xb')](function(_0x402b8a){var _0x24eda7={'method':_0x0fe2('0x2a'),'uri':_0x254f2b+_0x0fe2('0x2b')+_0x2b4392[_0x0fe2('0x2c')]('+',_0x0fe2('0x2d'))+'\x27','headers':{'Authorization':_0x0fe2('0x10')+_0x402b8a,'If-None-Match':null,'OData-Version':_0x0fe2('0x24')},'json':!![]};return rp(_0x24eda7);})[_0x0fe2('0xb')](function(_0x2a9ee3){var _0x11f819=null;if(_0x2a9ee3){var _0x5218d3=_0x2a9ee3[_0x0fe2('0x11')];var _0x394460=![];for(_0x11f819=0x0;_0x11f819<_0x5218d3['length'];_0x11f819++){if(_0x5218d3[_0x11f819]['telephone1']===_0x2b4392){_0x394460=!![];_0xb3b298['enduserId']=_0x5218d3[_0x11f819]['contactid'];}}if(_0x394460){_0x296e80(_0xb3b298);}else{return createEndUser(_0xb3b298,_0x88a1ad,_0x40a9ea,_0x254f2b,_0xaaa1d8,_0x25afa7)[_0x0fe2('0xb')](function(_0x168396){logger[_0x0fe2('0x17')]('['+[_0x25afa7['toUpperCase']()]+']\x20Enduser\x20created!',_0x168396['enduserId']);_0x296e80(_0x168396);});}}else{return createEndUser(_0xb3b298,_0x88a1ad,_0x40a9ea,_0x254f2b,_0xaaa1d8,_0x25afa7)['then'](function(_0x765cd9){logger[_0x0fe2('0x17')]('['+[_0x25afa7[_0x0fe2('0x18')]()]+_0x0fe2('0x2e'),_0x765cd9[_0x0fe2('0x29')]);_0x296e80(_0x765cd9);});}});});}function getCustomFields(_0x55c2cb,_0x142206,_0x1fea68){var _0x25432a={};if(_0x55c2cb[_0x0fe2('0x1d')]>0x0){_[_0x0fe2('0x2f')](_0x55c2cb,function(_0x5d0e95){if(_[_0x0fe2('0x30')]([_0x0fe2('0x31'),'picklist'],_0x5d0e95[_0x0fe2('0x32')])&&_0x5d0e95[_0x0fe2('0x33')]&&!_0x5d0e95[_0x0fe2('0x34')]){var _0x266dc4=_0x5d0e95['idField'][_0x0fe2('0x1e')]();var _0x48ae97=_0x266dc4[_0x0fe2('0x27')](0x0,_0x266dc4[_0x0fe2('0x35')]('_'));var _0x3a6950=_0x266dc4[_0x0fe2('0x27')](_0x266dc4[_0x0fe2('0x35')]('_')+0x1);if(_0x48ae97===_0x1fea68){_0x25432a[_0x3a6950]=_0x5d0e95[_0x0fe2('0x36')];}}});}return _0x25432a;}function getTicket(_0x4d3578,_0xc3a397,_0x1751ba,_0x382063,_0x16c9f8,_0x5321c6,_0x364c89){return new BPromise(function(_0x3456f0,_0x20d856){var _0x55c915;return getAuthToken(_0xc3a397,_0x1751ba,_0x364c89)[_0x0fe2('0xb')](function(_0x32163b){if(_0x5321c6[_0x0fe2('0x37')]===_0x0fe2('0x38')){_0x55c915={'method':_0x0fe2('0x39'),'uri':_0x382063+'incidents','body':Object[_0x0fe2('0x3a')]({},{'title':intUtil[_0x0fe2('0x3b')](_0x5321c6[_0x0fe2('0x3c')],_0x16c9f8,'\x20'),'description':intUtil[_0x0fe2('0x3b')](_0x5321c6[_0x0fe2('0x3d')],_0x16c9f8,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x4d3578['enduserId']+')','ownerid@odata.bind':_0x0fe2('0x23')+_0x4d3578[_0x0fe2('0x1b')]+')','caseorigincode':'1'},getCustomFields(_0x5321c6['Fields'],_0x16c9f8,_0x5321c6[_0x0fe2('0x37')])),'headers':{'Authorization':_0x0fe2('0x10')+_0x32163b,'OData-Version':_0x0fe2('0x24')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5321c6['ticketType']===_0x0fe2('0x3e')){_0x55c915={'method':'POST','uri':_0x382063+'phonecalls','body':Object[_0x0fe2('0x3a')]({},{'subject':intUtil[_0x0fe2('0x3b')](_0x5321c6[_0x0fe2('0x3c')],_0x16c9f8,'\x20'),'phonenumber':String(_0x16c9f8[_0x0fe2('0x21')]),'description':intUtil[_0x0fe2('0x3b')](_0x5321c6[_0x0fe2('0x3d')],_0x16c9f8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x0fe2('0x3f')+_0x4d3578['enduserId']+')','ownerid@odata.bind':_0x0fe2('0x23')+_0x4d3578[_0x0fe2('0x1b')]+')','directioncode':_0x4d3578[_0x0fe2('0x40')]===_0x0fe2('0x41')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x0fe2('0x23')+_0x4d3578['userId']+')','participationtypemask':_0x4d3578[_0x0fe2('0x40')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x0fe2('0x3f')+_0x4d3578[_0x0fe2('0x29')]+')','participationtypemask':_0x4d3578[_0x0fe2('0x40')]===_0x0fe2('0x41')?0x1:0x2}]},getCustomFields(_0x5321c6['Fields'],_0x16c9f8,_0x5321c6[_0x0fe2('0x37')])),'headers':{'Authorization':_0x0fe2('0x10')+_0x32163b,'OData-Version':_0x0fe2('0x24')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x55c915);})[_0x0fe2('0xb')](function(_0x14585e){var _0x173c8a=_0x14585e[_0x0fe2('0x25')][_0x0fe2('0x26')];var _0x1790b6=_0x173c8a['substring'](_0x173c8a[_0x0fe2('0x28')]('(')+0x1,_0x173c8a[_0x0fe2('0x28')](')'));_0x4d3578['ticketId']=_0x1790b6;_0x3456f0(_0x4d3578);})[_0x0fe2('0xc')](function(_0x2b7072){_0x20d856(_0x2b7072[_0x0fe2('0xe')]);});});}function emit(_0x1a227a,_0x2e23df,_0x15d3bb,_0x23166b){var _0x4d0f22={'uri':util[_0x0fe2('0x42')](_0x0fe2('0x43'),_0x1a227a,_0x15d3bb,_0x23166b)};io['to'](util[_0x0fe2('0x42')](_0x0fe2('0x44'),_0x2e23df))[_0x0fe2('0x45')]('trigger:browser:url',_0x4d0f22);}exports['cs']=function(_0x1b25a0,_0x1e5bbc,_0x3be5a0,_0x191f83,_0x4c2ffd,_0x2edf98,_0x1d3ce0,_0x7e37f9){var _0x454488={};_0x2edf98['remoteUri']=intUtil[_0x0fe2('0x46')](_0x2edf98[_0x0fe2('0x8')]);_0x2edf98[_0x0fe2('0x47')]=intUtil[_0x0fe2('0x46')](_0x2edf98[_0x0fe2('0x47')]);_0x454488[_0x0fe2('0x40')]=_0x7e37f9===_0x0fe2('0x41')||_0x7e37f9===_0x0fe2('0x48')?'queue':_0x0fe2('0x1f');var _0x41e3cd=util[_0x0fe2('0x42')](_0x0fe2('0x49'),_0x2edf98[_0x0fe2('0x8')]);var _0x12033d=util[_0x0fe2('0x42')]('https://login.microsoftonline.com/%s/oauth2/token',_0x2edf98[_0x0fe2('0x4a')]);var _0x2b5575=util[_0x0fe2('0x42')](_0x0fe2('0x4b'),_0x2edf98[_0x0fe2('0x47')],_0x1e5bbc[_0x0fe2('0x4c')],md5(_0x1e5bbc['uniqueid']));if(_0x4c2ffd&&_0x4c2ffd[_0x0fe2('0x4d')]){logger[_0x0fe2('0x17')](_0x0fe2('0x4e'),_0x0fe2('0x4f'));_0x1e5bbc[_0x0fe2('0x50')]=_0x2b5575;}else if(_0x1d3ce0&&_0x1d3ce0['recordingFormat']&&_0x1d3ce0[_0x0fe2('0x51')]!==_0x0fe2('0x52')){logger[_0x0fe2('0x17')](_0x0fe2('0x53'),_0x0fe2('0x4f'));_0x1e5bbc[_0x0fe2('0x50')]=_0x2b5575;}else{_0x1e5bbc[_0x0fe2('0x50')]='';}return getUser(_0x454488,_0x2edf98,_0x191f83,_0x12033d,_0x41e3cd,_0x7e37f9)[_0x0fe2('0xb')](function(_0x1e88f8){logger[_0x0fe2('0x17')]('['+_0x7e37f9[_0x0fe2('0x18')]()+_0x0fe2('0x54'),_0x1e88f8[_0x0fe2('0x1b')]);logger['info']('['+_0x7e37f9[_0x0fe2('0x18')]()+']\x20The\x20User\x20email\x20is:',_0x1e88f8[_0x0fe2('0x15')]);return getEndUser(_0x1e88f8,_0x2edf98,_0x12033d,_0x41e3cd,_0x1e5bbc,_0x7e37f9);})['then'](function(_0x124a0b){logger[_0x0fe2('0x17')]('['+_0x7e37f9[_0x0fe2('0x18')]()+_0x0fe2('0x55'),_0x124a0b['enduserId']);logger[_0x0fe2('0x17')]('['+_0x7e37f9[_0x0fe2('0x18')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x1e5bbc[_0x0fe2('0x21')]);return getTicket(_0x124a0b,_0x2edf98,_0x12033d,_0x41e3cd,_0x1e5bbc,_0x3be5a0,_0x7e37f9);})['then'](function(_0x24bcce){logger['info'](util[_0x0fe2('0x42')]('['+_0x7e37f9[_0x0fe2('0x18')]()+_0x0fe2('0x56'),_0x3be5a0['ticketType'],_0x24bcce[_0x0fe2('0x57')]));logger[_0x0fe2('0x17')](util['format']('['+_0x7e37f9[_0x0fe2('0x18')]()+_0x0fe2('0x58'),_0x7e37f9));if(_0x7e37f9!==_0x0fe2('0x48')){logger[_0x0fe2('0x17')]('['+_0x7e37f9['toUpperCase']()+']',_0x0fe2('0x59'));emit(_0x2edf98[_0x0fe2('0x8')],_0x191f83['name'],_0x3be5a0[_0x0fe2('0x37')],_0x24bcce['ticketId']);}})[_0x0fe2('0xc')](function(_0x5fdd4f){logger[_0x0fe2('0x5a')]('['+_0x7e37f9[_0x0fe2('0x18')]()+_0x0fe2('0x5b'),util[_0x0fe2('0x5c')](_0x5fdd4f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0c1c=['phonecall','phonecalls','assign','callDirection','queue','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','ioredis','dynamics365','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','then','access_token','catch','error','toUpperCase','GET','4.0','value','isNil','validateEmail','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','internalemailaddress','userId','message','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','Bearer\x20','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','includes','string','picklist','type','nameField','customField','idField','indexOf','content','incidents','getString','Subjects','Descriptions','/contacts(','Fields','ticketType'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0c1c,0x83));var _0xc0c1=function(_0x16ea87,_0x378d8b){_0x16ea87=_0x16ea87-0x0;var _0x6e7b1c=_0x0c1c[_0x16ea87];return _0x6e7b1c;};'use strict';var _=require(_0xc0c1('0x0'));var BPromise=require(_0xc0c1('0x1'));var rp=require(_0xc0c1('0x2'));var util=require(_0xc0c1('0x3'));var intUtil=require(_0xc0c1('0x4'));var md5=require('md5');var Redis=require(_0xc0c1('0x5'));var logger=require('../../../../config/logger')(_0xc0c1('0x6'));var config=require('../../../../config/environment');config[_0xc0c1('0x7')]=_[_0xc0c1('0x8')](config[_0xc0c1('0x7')],{'host':_0xc0c1('0x9'),'port':0x18eb});var io=require(_0xc0c1('0xa'))(new Redis(config[_0xc0c1('0x7')]));function getAuthToken(_0x2b3b79,_0x1e6727,_0xb2205e){var _0xf6ac99={'method':_0xc0c1('0xb'),'uri':_0x1e6727,'form':{'client_id':_0x2b3b79[_0xc0c1('0xc')],'resource':_0x2b3b79[_0xc0c1('0xd')],'username':_0x2b3b79[_0xc0c1('0xe')],'password':_0x2b3b79['password'],'grant_type':'password','client_secret':_0x2b3b79['clientSecret']},'json':!![]};return rp(_0xf6ac99)[_0xc0c1('0xf')](function(_0x58570e){return _0x58570e[_0xc0c1('0x10')];})[_0xc0c1('0x11')](function(_0x133d4){logger[_0xc0c1('0x12')]('['+[_0xb2205e[_0xc0c1('0x13')]()]+']\x20Wrong\x20credentials!');return _0x133d4['message'];});}function getUser(_0x5b8be6,_0xcda4bf,_0x11dfae,_0xe1e641,_0x1fdd65,_0x5b2506){return new BPromise(function(_0x3f9f05,_0x10a00a){return getAuthToken(_0xcda4bf,_0xe1e641,_0x5b2506)[_0xc0c1('0xf')](function(_0x432363){var _0x2f21aa={'method':_0xc0c1('0x14'),'uri':_0x1fdd65+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x432363,'OData-Version':_0xc0c1('0x15')},'json':!![]};return rp(_0x2f21aa);})[_0xc0c1('0xf')](function(_0x175e63){var _0x23c814=_0x175e63[_0xc0c1('0x16')];var _0x56f7d6=![];var _0x438b25=null;if(!_[_0xc0c1('0x17')](_0x11dfae)){if(intUtil[_0xc0c1('0x18')](_0x11dfae[_0xc0c1('0x19')])){_0x5b8be6[_0xc0c1('0x1a')]=_0x11dfae['email'];for(_0x438b25=0x0;_0x438b25<_0x23c814[_0xc0c1('0x1b')];_0x438b25++){if(_0x23c814[_0x438b25]['internalemailaddress']===_0x11dfae[_0xc0c1('0x19')]&&!_0x23c814[_0x438b25][_0xc0c1('0x1c')]){_0x56f7d6=!![];logger[_0xc0c1('0x1d')]('['+[_0x5b2506[_0xc0c1('0x13')]()]+_0xc0c1('0x1e')+_0x23c814[_0x438b25][_0xc0c1('0x1f')]+'!');_0x5b8be6['userId']=_0x23c814[_0x438b25][_0xc0c1('0x1f')];}}}}if(!_0x56f7d6){logger['info']('['+[_0x5b2506['toUpperCase']()]+_0xc0c1('0x20'));_0x5b8be6[_0xc0c1('0x1a')]=_0xcda4bf['username'];for(_0x438b25=0x0;_0x438b25<_0x23c814[_0xc0c1('0x1b')];_0x438b25++){if(_0x23c814[_0x438b25][_0xc0c1('0x21')]===_0xcda4bf[_0xc0c1('0xe')]){_0x5b8be6[_0xc0c1('0x22')]=_0x23c814[_0x438b25]['systemuserid'];}}}_0x3f9f05(_0x5b8be6);})[_0xc0c1('0x11')](function(_0x204412){_0x10a00a(_0x204412[_0xc0c1('0x23')]);});});}function createEndUser(_0x3d7647,_0x4df131,_0x5599a2,_0x394343,_0x38dfcc,_0x503510){return new BPromise(function(_0x20d173,_0x35b1f9){return getAuthToken(_0x4df131,_0x5599a2,_0x503510)[_0xc0c1('0xf')](function(_0x58d22c){var _0x49d1ad=_0x503510[_0xc0c1('0x24')]()===_0xc0c1('0x25')?_0x38dfcc[_0xc0c1('0x26')]:_0x38dfcc[_0xc0c1('0x27')];var _0xf5b3d7={'method':'POST','uri':_0x394343+'contacts','body':{'telephone1':_0x49d1ad,'fullname':_0x49d1ad,'firstname':_0x49d1ad,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xc0c1('0x28')+_0x3d7647[_0xc0c1('0x22')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x58d22c,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xf5b3d7);})[_0xc0c1('0xf')](function(_0x5c39d3){var _0x11557a=_0x5c39d3['headers'][_0xc0c1('0x29')];var _0x26dba4=_0x11557a[_0xc0c1('0x2a')](_0x11557a['lastIndexOf']('(')+0x1,_0x11557a[_0xc0c1('0x2b')](')'));_0x3d7647[_0xc0c1('0x2c')]=_0x26dba4;_0x20d173(_0x3d7647);})[_0xc0c1('0x11')](function(_0x4ece2d){_0x35b1f9(_0x4ece2d[_0xc0c1('0x23')]);});});}function getEndUser(_0x3bb34e,_0x37a120,_0x2aeee8,_0x71570b,_0x57cb9d,_0x200ed1){return new BPromise(function(_0x32a58e,_0x4912c1){var _0x26483d=_0x200ed1[_0xc0c1('0x24')]()===_0xc0c1('0x25')?_0x57cb9d[_0xc0c1('0x26')]:_0x57cb9d['calleridnum'];return getAuthToken(_0x37a120,_0x2aeee8,_0x200ed1)[_0xc0c1('0xf')](function(_0x47b5dc){var _0x474caa={'method':_0xc0c1('0x14'),'uri':_0x71570b+_0xc0c1('0x2d')+_0x26483d[_0xc0c1('0x2e')]('+',_0xc0c1('0x2f'))+'\x27','headers':{'Authorization':_0xc0c1('0x30')+_0x47b5dc,'If-None-Match':null,'OData-Version':_0xc0c1('0x15')},'json':!![]};return rp(_0x474caa);})[_0xc0c1('0xf')](function(_0x42081d){var _0x7be2f=null;if(_0x42081d){var _0x51f594=_0x42081d['value'];var _0x4a7d21=![];for(_0x7be2f=0x0;_0x7be2f<_0x51f594[_0xc0c1('0x1b')];_0x7be2f++){if(_0x51f594[_0x7be2f][_0xc0c1('0x31')]===_0x26483d){_0x4a7d21=!![];_0x3bb34e[_0xc0c1('0x2c')]=_0x51f594[_0x7be2f][_0xc0c1('0x32')];}}if(_0x4a7d21){_0x32a58e(_0x3bb34e);}else{return createEndUser(_0x3bb34e,_0x37a120,_0x2aeee8,_0x71570b,_0x57cb9d,_0x200ed1)[_0xc0c1('0xf')](function(_0xdd934f){logger[_0xc0c1('0x1d')]('['+[_0x200ed1[_0xc0c1('0x13')]()]+_0xc0c1('0x33'),_0xdd934f[_0xc0c1('0x2c')]);_0x32a58e(_0xdd934f);});}}else{return createEndUser(_0x3bb34e,_0x37a120,_0x2aeee8,_0x71570b,_0x57cb9d,_0x200ed1)[_0xc0c1('0xf')](function(_0x43cc25){logger[_0xc0c1('0x1d')]('['+[_0x200ed1[_0xc0c1('0x13')]()]+_0xc0c1('0x34'),_0x43cc25['enduserId']);_0x32a58e(_0x43cc25);});}});});}function getCustomFields(_0x31ced2,_0x5ad8da,_0x5ac25a){var _0x24cf5c={};if(_0x31ced2['length']>0x0){_['forEach'](_0x31ced2,function(_0x35a0ea){if(_[_0xc0c1('0x35')]([_0xc0c1('0x36'),_0xc0c1('0x37')],_0x35a0ea[_0xc0c1('0x38')])&&_0x35a0ea[_0xc0c1('0x39')]&&!_0x35a0ea[_0xc0c1('0x3a')]){var _0x78790b=_0x35a0ea[_0xc0c1('0x3b')][_0xc0c1('0x24')]();var _0x3de6da=_0x78790b[_0xc0c1('0x2a')](0x0,_0x78790b[_0xc0c1('0x3c')]('_'));var _0x2b977b=_0x78790b[_0xc0c1('0x2a')](_0x78790b[_0xc0c1('0x3c')]('_')+0x1);if(_0x3de6da===_0x5ac25a){_0x24cf5c[_0x2b977b]=_0x35a0ea[_0xc0c1('0x3d')];}}});}return _0x24cf5c;}function getTicket(_0x30a141,_0x50ec45,_0xbc9734,_0x220e09,_0x437fdf,_0x112e9a,_0x4fa755){return new BPromise(function(_0x113683,_0x59f0a5){var _0x4c6514;return getAuthToken(_0x50ec45,_0xbc9734,_0x4fa755)['then'](function(_0x22a649){if(_0x112e9a['ticketType']==='incident'){_0x4c6514={'method':_0xc0c1('0xb'),'uri':_0x220e09+_0xc0c1('0x3e'),'body':Object['assign']({},{'title':intUtil[_0xc0c1('0x3f')](_0x112e9a[_0xc0c1('0x40')],_0x437fdf,'\x20'),'description':intUtil['getString'](_0x112e9a[_0xc0c1('0x41')],_0x437fdf,'\x0a'),'customerid_contact@odata.bind':_0xc0c1('0x42')+_0x30a141['enduserId']+')','ownerid@odata.bind':_0xc0c1('0x28')+_0x30a141['userId']+')','caseorigincode':'1'},getCustomFields(_0x112e9a[_0xc0c1('0x43')],_0x437fdf,_0x112e9a[_0xc0c1('0x44')])),'headers':{'Authorization':'Bearer\x20'+_0x22a649,'OData-Version':_0xc0c1('0x15')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x112e9a[_0xc0c1('0x44')]===_0xc0c1('0x45')){_0x4c6514={'method':'POST','uri':_0x220e09+_0xc0c1('0x46'),'body':Object[_0xc0c1('0x47')]({},{'subject':intUtil[_0xc0c1('0x3f')](_0x112e9a[_0xc0c1('0x40')],_0x437fdf,'\x20'),'phonenumber':String(_0x437fdf[_0xc0c1('0x27')]),'description':intUtil[_0xc0c1('0x3f')](_0x112e9a[_0xc0c1('0x41')],_0x437fdf,'\x0a'),'regardingobjectid_contact@odata.bind':_0xc0c1('0x42')+_0x30a141[_0xc0c1('0x2c')]+')','ownerid@odata.bind':_0xc0c1('0x28')+_0x30a141[_0xc0c1('0x22')]+')','directioncode':_0x30a141[_0xc0c1('0x48')]===_0xc0c1('0x49')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xc0c1('0x28')+_0x30a141['userId']+')','participationtypemask':_0x30a141[_0xc0c1('0x48')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xc0c1('0x42')+_0x30a141['enduserId']+')','participationtypemask':_0x30a141['callDirection']===_0xc0c1('0x49')?0x1:0x2}]},getCustomFields(_0x112e9a[_0xc0c1('0x43')],_0x437fdf,_0x112e9a['ticketType'])),'headers':{'Authorization':_0xc0c1('0x30')+_0x22a649,'OData-Version':_0xc0c1('0x15')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4c6514);})['then'](function(_0xc3a89d){var _0x3e7e2b=_0xc3a89d[_0xc0c1('0x4a')]['odata-entityid'];var _0x635f81=_0x3e7e2b[_0xc0c1('0x2a')](_0x3e7e2b[_0xc0c1('0x2b')]('(')+0x1,_0x3e7e2b[_0xc0c1('0x2b')](')'));_0x30a141[_0xc0c1('0x4b')]=_0x635f81;_0x113683(_0x30a141);})[_0xc0c1('0x11')](function(_0x57ae3b){_0x59f0a5(_0x57ae3b[_0xc0c1('0x23')]);});});}function emit(_0x200509,_0x1527e4,_0x297e34,_0x13670b){var _0xcb6cf3={'uri':util[_0xc0c1('0x4c')](_0xc0c1('0x4d'),_0x200509,_0x297e34,_0x13670b)};io['to'](util[_0xc0c1('0x4c')](_0xc0c1('0x4e'),_0x1527e4))[_0xc0c1('0x4f')]('trigger:browser:url',_0xcb6cf3);}exports['cs']=function(_0x172939,_0xf13a4c,_0x10db1d,_0x4c08bd,_0x2a1511,_0x3c40fe,_0x44e4da,_0x4c12cc){var _0x4d4b28={};_0x3c40fe['remoteUri']=intUtil[_0xc0c1('0x50')](_0x3c40fe['remoteUri']);_0x3c40fe[_0xc0c1('0x51')]=intUtil[_0xc0c1('0x50')](_0x3c40fe[_0xc0c1('0x51')]);_0x4d4b28['callDirection']=_0x4c12cc===_0xc0c1('0x49')||_0x4c12cc===_0xc0c1('0x52')?_0xc0c1('0x49'):'outbound';var _0x4d278a=util['format'](_0xc0c1('0x53'),_0x3c40fe['remoteUri']);var _0x570648=util[_0xc0c1('0x4c')]('https://login.microsoftonline.com/%s/oauth2/token',_0x3c40fe[_0xc0c1('0x54')]);var _0x2d3226=util[_0xc0c1('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c40fe[_0xc0c1('0x51')],_0xf13a4c[_0xc0c1('0x55')],md5(_0xf13a4c['uniqueid']));if(_0x2a1511&&_0x2a1511['monitor_format']){logger[_0xc0c1('0x1d')](_0xc0c1('0x56'),_0xc0c1('0x57'));_0xf13a4c[_0xc0c1('0x58')]=_0x2d3226;}else if(_0x44e4da&&_0x44e4da[_0xc0c1('0x59')]&&_0x44e4da[_0xc0c1('0x59')]!==_0xc0c1('0x5a')){logger[_0xc0c1('0x1d')](_0xc0c1('0x5b'),_0xc0c1('0x57'));_0xf13a4c['recordingURL']=_0x2d3226;}else{_0xf13a4c[_0xc0c1('0x58')]='';}return getUser(_0x4d4b28,_0x3c40fe,_0x4c08bd,_0x570648,_0x4d278a,_0x4c12cc)[_0xc0c1('0xf')](function(_0x3c8df0){logger[_0xc0c1('0x1d')]('['+_0x4c12cc[_0xc0c1('0x13')]()+_0xc0c1('0x5c'),_0x3c8df0[_0xc0c1('0x22')]);logger['info']('['+_0x4c12cc['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x3c8df0[_0xc0c1('0x1a')]);return getEndUser(_0x3c8df0,_0x3c40fe,_0x570648,_0x4d278a,_0xf13a4c,_0x4c12cc);})[_0xc0c1('0xf')](function(_0x59bcd5){logger['info']('['+_0x4c12cc[_0xc0c1('0x13')]()+_0xc0c1('0x5d'),_0x59bcd5[_0xc0c1('0x2c')]);logger[_0xc0c1('0x1d')]('['+_0x4c12cc[_0xc0c1('0x13')]()+_0xc0c1('0x5e'),_0xf13a4c[_0xc0c1('0x27')]);return getTicket(_0x59bcd5,_0x3c40fe,_0x570648,_0x4d278a,_0xf13a4c,_0x10db1d,_0x4c12cc);})[_0xc0c1('0xf')](function(_0x11cd02){logger[_0xc0c1('0x1d')](util[_0xc0c1('0x4c')]('['+_0x4c12cc[_0xc0c1('0x13')]()+_0xc0c1('0x5f'),_0x10db1d[_0xc0c1('0x44')],_0x11cd02['ticketId']));logger['info'](util[_0xc0c1('0x4c')]('['+_0x4c12cc[_0xc0c1('0x13')]()+']\x20Call\x20direction:\x20%s',_0x4c12cc));if(_0x4c12cc!==_0xc0c1('0x52')){logger[_0xc0c1('0x1d')]('['+_0x4c12cc[_0xc0c1('0x13')]()+']',_0xc0c1('0x60'));emit(_0x3c40fe['remoteUri'],_0x4c08bd[_0xc0c1('0x61')],_0x10db1d[_0xc0c1('0x44')],_0x11cd02[_0xc0c1('0x4b')]);}})[_0xc0c1('0x11')](function(_0xa481c2){logger['error']('['+_0x4c12cc[_0xc0c1('0x13')]()+_0xc0c1('0x62'),util[_0xc0c1('0x63')](_0xa481c2,{'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 9109193..43379a1 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 _0xd4a1=['none','[OUTBOUND]','Authorization','destcalleridname','The\x20Enduser\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','Subjects','getString','Descriptions','
','name','Fields','mapValues','keyBy','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','then','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','debug','[HTTP]','stringify','defaults','GET','includes','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat'];(function(_0x3e90b1,_0x4b93c4){var _0xc1ae12=function(_0x172174){while(--_0x172174){_0x3e90b1['push'](_0x3e90b1['shift']());}};_0xc1ae12(++_0x4b93c4);}(_0xd4a1,0xc6));var _0x1d4a=function(_0x174461,_0x52773c){_0x174461=_0x174461-0x0;var _0x2b4e99=_0xd4a1[_0x174461];return _0x2b4e99;};'use strict';var _=require(_0x1d4a('0x0'));var rp=require(_0x1d4a('0x1'));var md5=require(_0x1d4a('0x2'));var util=require(_0x1d4a('0x3'));var Redis=require(_0x1d4a('0x4'));var intUtil=require(_0x1d4a('0x5'));var config=require(_0x1d4a('0x6'));var logger=require(_0x1d4a('0x7'))(_0x1d4a('0x8'));config['redis']=_['defaults'](config[_0x1d4a('0x9')],{'host':_0x1d4a('0xa'),'port':0x18eb});var io=require(_0x1d4a('0xb'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x1d4a('0xc')};function emit(_0x14af77,_0x1cf609,_0x36e537){io['to'](_0x14af77)[_0x1d4a('0xd')](_0x1cf609,_0x36e537);}function getTicket(_0x1f8d10,_0x28b972,_0x4fb016,_0x48f971,_0x3f4f5f){logger[_0x1d4a('0xe')](_0x1d4a('0xf'));var _0x1929f9=_['merge']({'responder_id':_0x28b972['id'],'requester_id':_0x4fb016['id'],'name':util[_0x1d4a('0x10')](_0x1d4a('0x11'),_0x3f4f5f[_0x1d4a('0x12')]),'phone':_0x3f4f5f['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x48f971[_0x1d4a('0x13')],_0x3f4f5f,'\x20'),'description':intUtil[_0x1d4a('0x14')](_0x48f971[_0x1d4a('0x15')],_0x3f4f5f,_0x1d4a('0x16')),'tags':getTags(_0x48f971['Tags'],_0x1d4a('0x17'))},getCustomFields(_0x48f971[_0x1d4a('0x18')],_0x3f4f5f));_0x1929f9['custom_fields']=_[_0x1d4a('0x19')](_[_0x1d4a('0x1a')](_0x1929f9['custom_fields'],'id'),'value');return request({'uri':util[_0x1d4a('0x10')](_0x1d4a('0x1b'),_0x1f8d10[_0x1d4a('0x1c')]),'method':_0x1d4a('0x1d'),'body':_0x1929f9})['then'](function(_0x44f253){logger[_0x1d4a('0xe')](_0x1d4a('0x1e'));return _0x44f253;});}function getUser(_0x5172db,_0x2e3dc3){if(intUtil[_0x1d4a('0x1f')](_0x2e3dc3)){return request({'uri':util[_0x1d4a('0x10')]('%s/api/v2/agents',_0x5172db[_0x1d4a('0x1c')]),'qs':{'email':_0x2e3dc3}})[_0x1d4a('0x20')](function(_0x131fbd){if(_0x131fbd[_0x1d4a('0x21')]){logger[_0x1d4a('0xe')](_0x1d4a('0x22'));return _[_0x1d4a('0x23')](_0x131fbd,function(_0x21bef8){return _0x21bef8[_0x1d4a('0x24')][_0x1d4a('0x25')]===_0x2e3dc3;});}else{logger['info'](_0x1d4a('0x26'));return request({'uri':util[_0x1d4a('0x10')](_0x1d4a('0x27'),_0x5172db['remoteUri'])})['then'](function(_0x46c49f){logger[_0x1d4a('0xe')]('Admin\x20account\x20selected.');return _0x46c49f;});}});}else{logger[_0x1d4a('0xe')](_0x1d4a('0x28'));return request({'uri':util[_0x1d4a('0x10')](_0x1d4a('0x27'),_0x5172db[_0x1d4a('0x1c')])})['then'](function(_0x18bda9){logger['info']('Admin\x20account\x20selected.');return _0x18bda9;});}}function getEndUser(_0x19b806,_0x578a02,_0x17771d){logger[_0x1d4a('0xe')](_0x1d4a('0x29'),_0x17771d);return request({'uri':util['format'](_0x1d4a('0x2a'),_0x19b806[_0x1d4a('0x1c')]),'qs':{'phone':_0x17771d}})[_0x1d4a('0x20')](function(_0x262a07){if(_0x262a07[_0x1d4a('0x21')]){logger['info']('Enduser\x20found!');return _['find'](_0x262a07,{'phone':_0x17771d});}else{logger['info'](_0x1d4a('0x2b'));return request({'uri':util[_0x1d4a('0x10')](_0x1d4a('0x2a'),_0x19b806[_0x1d4a('0x1c')]),'method':_0x1d4a('0x1d'),'body':{'name':_0x578a02,'phone':_0x17771d}})[_0x1d4a('0x20')](function(_0x2cd7bf){logger[_0x1d4a('0xe')](_0x1d4a('0x2c'));return _0x2cd7bf;});}});}function getAuth(_0x864e37){return util[_0x1d4a('0x10')]('Basic\x20%s',new Buffer(_0x864e37[_0x1d4a('0x2d')]+':X')[_0x1d4a('0x2e')]('base64'));}function request(_0x150682){logger[_0x1d4a('0x2f')](_0x1d4a('0x30'),JSON[_0x1d4a('0x31')](_0x150682));return rp(_[_0x1d4a('0x32')](_0x150682,{'method':_0x1d4a('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x9cc2b,_0x5b231a){var _0x425b30=[];if(_0x9cc2b&&_0x9cc2b[_0x1d4a('0x21')]>0x0){_0x425b30=_['map'](_0x9cc2b,_0x5b231a);}return _0x425b30;}function getCustomFields(_0x47da9c,_0x5f54ad){var _0x89578=[];var _0x54be5d={'custom_fields':[]};if(_0x47da9c[_0x1d4a('0x21')]>0x0){_['forEach'](_0x47da9c,function(_0x19a7f2){if(_[_0x1d4a('0x34')](['string',_0x1d4a('0x35')],_0x19a7f2[_0x1d4a('0x36')])&&_0x19a7f2[_0x1d4a('0x37')]&&!_0x19a7f2[_0x1d4a('0x38')]){_0x54be5d[_0x19a7f2['nameField'][_0x1d4a('0x39')]()]=_0x19a7f2[_0x1d4a('0x3a')]['toString']();}else if(_[_0x1d4a('0x34')](['string',_0x1d4a('0x35')],_0x19a7f2[_0x1d4a('0x36')])&&_0x19a7f2[_0x1d4a('0x3b')]&&_0x19a7f2['customField']){_0x54be5d[_0x1d4a('0x3c')][_0x1d4a('0x3d')]({'id':_0x19a7f2[_0x1d4a('0x3b')],'value':_0x19a7f2[_0x1d4a('0x3a')][_0x1d4a('0x2e')]()});}else if(_0x19a7f2[_0x1d4a('0x36')]===_0x1d4a('0x3e')&&_0x19a7f2[_0x1d4a('0x3f')]&&_0x19a7f2[_0x1d4a('0x3b')]&&_0x19a7f2[_0x1d4a('0x38')]){_0x5f54ad[_0x19a7f2[_0x1d4a('0x3f')]]&&_0x54be5d[_0x1d4a('0x3c')][_0x1d4a('0x3d')]({'id':_0x19a7f2['idField'],'value':_0x5f54ad[_0x19a7f2[_0x1d4a('0x3f')]]['toString']()});}else if(_0x19a7f2['type']===_0x1d4a('0x40')&&_0x19a7f2['Variable']&&_0x19a7f2[_0x1d4a('0x41')]['name']&&_0x19a7f2[_0x1d4a('0x3b')]&&_0x19a7f2[_0x1d4a('0x38')]){_0x5f54ad[_0x19a7f2['Variable'][_0x1d4a('0x17')]['toLowerCase']()]&&_0x54be5d[_0x1d4a('0x3c')]['push']({'id':_0x19a7f2[_0x1d4a('0x3b')],'value':_0x5f54ad[_0x19a7f2['Variable']['name'][_0x1d4a('0x39')]()][_0x1d4a('0x2e')]()});}});}return _0x54be5d;}exports['queue']=function(_0x4f56ff,_0x476c70,_0x13f537,_0x45d0ec,_0x269036,_0xcbcccb){var _0x1be34a,_0x513470;_0xcbcccb['remoteUri']=intUtil[_0x1d4a('0x42')](_0xcbcccb['remoteUri']);_0xcbcccb['serverUrl']=intUtil[_0x1d4a('0x42')](_0xcbcccb[_0x1d4a('0x43')]);if(_0x269036&&_0x269036[_0x1d4a('0x44')]){logger[_0x1d4a('0xe')](_0x1d4a('0x45'),_0x1d4a('0x46'));_0x476c70[_0x1d4a('0x47')]=util[_0x1d4a('0x10')](_0x1d4a('0x48'),_0xcbcccb[_0x1d4a('0x43')],_0x476c70[_0x1d4a('0x49')],md5(_0x476c70[_0x1d4a('0x49')]));}else{_0x476c70['recordingURL']='';}headers['Authorization']=getAuth(_0xcbcccb);return getUser(_0xcbcccb,_0x45d0ec[_0x1d4a('0x25')])[_0x1d4a('0x20')](function(_0x2b3dc4){_0x1be34a=_0x2b3dc4;logger[_0x1d4a('0xe')]('The\x20User\x20ID\x20is:',_0x1be34a['id']);return getEndUser(_0xcbcccb,_0x476c70[_0x1d4a('0x12')],_0x476c70['calleridnum']);})[_0x1d4a('0x20')](function(_0x5f21f3){_0x513470=_0x5f21f3;logger[_0x1d4a('0xe')]('The\x20Enduser\x20ID\x20is:',_0x513470['id']);return getTicket(_0xcbcccb,_0x1be34a,_0x513470,_0x13f537,_0x476c70);})[_0x1d4a('0x20')](function(_0x314eda){if(_0x314eda&&_0x314eda['id']){logger[_0x1d4a('0xe')](_0x1d4a('0x1e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x314eda['id']);logger[_0x1d4a('0xe')](_0x1d4a('0x45'),_0x1d4a('0x4a'));emit(util[_0x1d4a('0x10')]('user:%s',_0x45d0ec['name']),_0x1d4a('0x4b'),{'uri':util[_0x1d4a('0x10')](_0x1d4a('0x4c'),_0xcbcccb[_0x1d4a('0x1c')],_0x314eda['id'])});}})[_0x1d4a('0x4d')](function(_0x481bdf){logger[_0x1d4a('0x4e')]('[QUEUE]',JSON['stringify'](_0x481bdf));});};exports[_0x1d4a('0x4f')]=function(_0x4607f1,_0xa4be54,_0xfb1d8e,_0x1783a0,_0x847060,_0x3275eb,_0x2af9d0){var _0x184667,_0x5ce425;_0x3275eb['remoteUri']=intUtil[_0x1d4a('0x42')](_0x3275eb[_0x1d4a('0x1c')]);_0x3275eb['serverUrl']=intUtil[_0x1d4a('0x42')](_0x3275eb['serverUrl']);if(_0x2af9d0&&_0x2af9d0[_0x1d4a('0x50')]&&_0x2af9d0[_0x1d4a('0x50')]!==_0x1d4a('0x51')){logger[_0x1d4a('0xe')](_0x1d4a('0x52'),_0x1d4a('0x46'));_0xa4be54['recordingURL']=util[_0x1d4a('0x10')](_0x1d4a('0x48'),_0x3275eb[_0x1d4a('0x43')],_0xa4be54[_0x1d4a('0x49')],md5(_0xa4be54[_0x1d4a('0x49')]));}headers[_0x1d4a('0x53')]=getAuth(_0x3275eb);return getUser(_0x3275eb,_0x1783a0['email'])[_0x1d4a('0x20')](function(_0x495fae){_0x184667=_0x495fae;logger[_0x1d4a('0xe')]('The\x20User\x20ID\x20is:',_0x184667['id']);return getEndUser(_0x3275eb,_0xa4be54[_0x1d4a('0x54')],_0xa4be54['destcalleridnum']);})['then'](function(_0x3450ae){_0x5ce425=_0x3450ae;logger[_0x1d4a('0xe')](_0x1d4a('0x55'),_0x5ce425['id']);return getTicket(_0x3275eb,_0x184667,_0x5ce425,_0xfb1d8e,_0xa4be54);})[_0x1d4a('0x20')](function(_0x58262b){if(_0x58262b&&_0x58262b['id']){logger[_0x1d4a('0xe')](_0x1d4a('0x1e'));logger[_0x1d4a('0xe')]('The\x20Ticket\x20ID\x20is:',_0x58262b['id']);logger['info'](_0x1d4a('0x52'),_0x1d4a('0x4a'));emit(util[_0x1d4a('0x10')](_0x1d4a('0x56'),_0x1783a0[_0x1d4a('0x17')]),'trigger:browser:url',{'uri':util[_0x1d4a('0x10')]('%s/helpdesk/tickets/%d',_0x3275eb['remoteUri'],_0x58262b['id'])});}})[_0x1d4a('0x4d')](function(_0x5a438){logger[_0x1d4a('0x4e')]('[OUTBOUND]',JSON['stringify'](_0x5a438));});};exports[_0x1d4a('0x57')]=function(_0x33f6e9,_0x443ce4,_0x4d51e8,_0x336239,_0x465e94,_0x19fb32){var _0x565807,_0x80c8af;_0x19fb32['remoteUri']=intUtil[_0x1d4a('0x42')](_0x19fb32['remoteUri']);_0x19fb32['serverUrl']=intUtil['stripTrailingSlash'](_0x19fb32['serverUrl']);if(_0x465e94&&_0x465e94[_0x1d4a('0x44')]){logger[_0x1d4a('0xe')]('['+_0x443ce4[_0x1d4a('0x58')][_0x1d4a('0x59')]()+']',_0x1d4a('0x46'));_0x443ce4['recordingURL']=util[_0x1d4a('0x10')](_0x1d4a('0x48'),_0x19fb32['serverUrl'],_0x443ce4[_0x1d4a('0x49')],md5(_0x443ce4['uniqueid']));}else{_0x443ce4[_0x1d4a('0x47')]='';}headers[_0x1d4a('0x53')]=getAuth(_0x19fb32);return getUser(_0x19fb32,'')[_0x1d4a('0x20')](function(_0x348aea){_0x565807=_0x348aea;logger[_0x1d4a('0xe')](_0x1d4a('0x5a'),_0x565807['id']);return getEndUser(_0x19fb32,_0x443ce4[_0x1d4a('0x12')],_0x443ce4[_0x1d4a('0x5b')]);})['then'](function(_0x5009bb){_0x80c8af=_0x5009bb;logger[_0x1d4a('0xe')](_0x1d4a('0x55'),_0x80c8af['id']);return getTicket(_0x19fb32,_0x565807,_0x80c8af,_0x4d51e8,_0x443ce4);})['then'](function(_0x25e9bf){if(_0x25e9bf){logger[_0x1d4a('0xe')]('Ticket\x20created!');logger[_0x1d4a('0xe')](_0x1d4a('0x5c'),_0x25e9bf['id']);}})[_0x1d4a('0x4d')](function(_0x49b38d){logger[_0x1d4a('0x4e')]('['+_0x443ce4[_0x1d4a('0x58')][_0x1d4a('0x59')]()+']',JSON[_0x1d4a('0x31')](_0x49b38d));});}; \ No newline at end of file +var _0x1513=['trigger:browser:url','outbound','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','%s/helpdesk/tickets/%d','catch','error','unmanaged','monitor_format','lastevent','toUpperCase','lodash','md5','util','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Tags','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','POST','then','validateEmail','%s/api/v2/agents','remoteUri','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/contacts','length','Enduser\x20found!','toString','debug','[HTTP]','stringify','GET','picklist','type','nameField','content','includes','string','idField','customField','push','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x1a89a5,_0x1f895f){var _0x1f351f=function(_0x5c4218){while(--_0x5c4218){_0x1a89a5['push'](_0x1a89a5['shift']());}};_0x1f351f(++_0x1f895f);}(_0x1513,0x117));var _0x3151=function(_0x3cea16,_0x345496){_0x3cea16=_0x3cea16-0x0;var _0x2318e1=_0x1513[_0x3cea16];return _0x2318e1;};'use strict';var _=require(_0x3151('0x0'));var rp=require('request-promise');var md5=require(_0x3151('0x1'));var util=require(_0x3151('0x2'));var Redis=require('ioredis');var intUtil=require(_0x3151('0x3'));var config=require(_0x3151('0x4'));var logger=require('../../../../config/logger')(_0x3151('0x5'));config[_0x3151('0x6')]=_[_0x3151('0x7')](config['redis'],{'host':_0x3151('0x8'),'port':0x18eb});var io=require(_0x3151('0x9'))(new Redis(config[_0x3151('0x6')]));var headers={'Content-Type':_0x3151('0xa'),'Accept':_0x3151('0xa')};function emit(_0xe903b,_0x3c75cf,_0x23c5ec){io['to'](_0xe903b)[_0x3151('0xb')](_0x3c75cf,_0x23c5ec);}function getTicket(_0xa16342,_0x345f8e,_0x3d2174,_0x105429,_0xedb8e1){logger[_0x3151('0xc')](_0x3151('0xd'));var _0x2f5bf9=_[_0x3151('0xe')]({'responder_id':_0x345f8e['id'],'requester_id':_0x3d2174['id'],'name':util[_0x3151('0xf')](_0x3151('0x10'),_0xedb8e1[_0x3151('0x11')]),'phone':_0xedb8e1[_0x3151('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x3151('0x13')](_0x105429[_0x3151('0x14')],_0xedb8e1,'\x20'),'description':intUtil['getString'](_0x105429['Descriptions'],_0xedb8e1,'
'),'tags':getTags(_0x105429[_0x3151('0x15')],_0x3151('0x16'))},getCustomFields(_0x105429[_0x3151('0x17')],_0xedb8e1));_0x2f5bf9[_0x3151('0x18')]=_[_0x3151('0x19')](_['keyBy'](_0x2f5bf9[_0x3151('0x18')],'id'),_0x3151('0x1a'));return request({'uri':util[_0x3151('0xf')](_0x3151('0x1b'),_0xa16342['remoteUri']),'method':_0x3151('0x1c'),'body':_0x2f5bf9})[_0x3151('0x1d')](function(_0x337f06){logger[_0x3151('0xc')]('Ticket\x20created!');return _0x337f06;});}function getUser(_0xc20e0f,_0x128aa3){if(intUtil[_0x3151('0x1e')](_0x128aa3)){return request({'uri':util['format'](_0x3151('0x1f'),_0xc20e0f[_0x3151('0x20')]),'qs':{'email':_0x128aa3}})[_0x3151('0x1d')](function(_0x4d6781){if(_0x4d6781['length']){logger['info'](_0x3151('0x21'));return _[_0x3151('0x22')](_0x4d6781,function(_0x3c84d6){return _0x3c84d6['contact'][_0x3151('0x23')]===_0x128aa3;});}else{logger[_0x3151('0xc')](_0x3151('0x24'));return request({'uri':util[_0x3151('0xf')](_0x3151('0x25'),_0xc20e0f['remoteUri'])})[_0x3151('0x1d')](function(_0x4d65fd){logger[_0x3151('0xc')](_0x3151('0x26'));return _0x4d65fd;});}});}else{logger['info'](_0x3151('0x27'));return request({'uri':util['format'](_0x3151('0x25'),_0xc20e0f[_0x3151('0x20')])})['then'](function(_0x3047cd){logger['info']('Admin\x20account\x20selected.');return _0x3047cd;});}}function getEndUser(_0x56584e,_0x467400,_0x2b7265){logger[_0x3151('0xc')]('Searching\x20enduser\x20with\x20phone',_0x2b7265);return request({'uri':util[_0x3151('0xf')](_0x3151('0x28'),_0x56584e[_0x3151('0x20')]),'qs':{'phone':_0x2b7265}})[_0x3151('0x1d')](function(_0x5c14cd){if(_0x5c14cd[_0x3151('0x29')]){logger[_0x3151('0xc')](_0x3151('0x2a'));return _['find'](_0x5c14cd,{'phone':_0x2b7265});}else{logger[_0x3151('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x3151('0x28'),_0x56584e[_0x3151('0x20')]),'method':_0x3151('0x1c'),'body':{'name':_0x467400,'phone':_0x2b7265}})[_0x3151('0x1d')](function(_0x26dfa7){logger[_0x3151('0xc')]('Enduser\x20created.');return _0x26dfa7;});}});}function getAuth(_0x1b1420){return util['format']('Basic\x20%s',new Buffer(_0x1b1420['apiKey']+':X')[_0x3151('0x2b')]('base64'));}function request(_0x18db98){logger[_0x3151('0x2c')](_0x3151('0x2d'),JSON[_0x3151('0x2e')](_0x18db98));return rp(_[_0x3151('0x7')](_0x18db98,{'method':_0x3151('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x3776d,_0x3f88d6){var _0x2e114a=[];if(_0x3776d&&_0x3776d[_0x3151('0x29')]>0x0){_0x2e114a=_['map'](_0x3776d,_0x3f88d6);}return _0x2e114a;}function getCustomFields(_0x2a6c97,_0x326eb3){var _0x527f4c=[];var _0x1779dc={'custom_fields':[]};if(_0x2a6c97['length']>0x0){_['forEach'](_0x2a6c97,function(_0x393716){if(_['includes'](['string',_0x3151('0x30')],_0x393716[_0x3151('0x31')])&&_0x393716['nameField']&&!_0x393716['customField']){_0x1779dc[_0x393716[_0x3151('0x32')]['toLowerCase']()]=_0x393716[_0x3151('0x33')][_0x3151('0x2b')]();}else if(_[_0x3151('0x34')]([_0x3151('0x35'),'picklist'],_0x393716[_0x3151('0x31')])&&_0x393716[_0x3151('0x36')]&&_0x393716[_0x3151('0x37')]){_0x1779dc['custom_fields'][_0x3151('0x38')]({'id':_0x393716['idField'],'value':_0x393716[_0x3151('0x33')][_0x3151('0x2b')]()});}else if(_0x393716[_0x3151('0x31')]==='variable'&&_0x393716[_0x3151('0x39')]&&_0x393716[_0x3151('0x36')]&&_0x393716[_0x3151('0x37')]){_0x326eb3[_0x393716['variableName']]&&_0x1779dc[_0x3151('0x18')][_0x3151('0x38')]({'id':_0x393716[_0x3151('0x36')],'value':_0x326eb3[_0x393716[_0x3151('0x39')]][_0x3151('0x2b')]()});}else if(_0x393716[_0x3151('0x31')]===_0x3151('0x3a')&&_0x393716[_0x3151('0x3b')]&&_0x393716[_0x3151('0x3b')][_0x3151('0x16')]&&_0x393716[_0x3151('0x36')]&&_0x393716['customField']){_0x326eb3[_0x393716[_0x3151('0x3b')][_0x3151('0x16')][_0x3151('0x3c')]()]&&_0x1779dc['custom_fields'][_0x3151('0x38')]({'id':_0x393716[_0x3151('0x36')],'value':_0x326eb3[_0x393716[_0x3151('0x3b')]['name']['toLowerCase']()][_0x3151('0x2b')]()});}});}return _0x1779dc;}exports[_0x3151('0x3d')]=function(_0x33812f,_0x5f018a,_0x59d65d,_0x2fc9a6,_0x450c93,_0xc54297){var _0xe82bb9,_0x32c7de;_0xc54297[_0x3151('0x20')]=intUtil[_0x3151('0x3e')](_0xc54297['remoteUri']);_0xc54297['serverUrl']=intUtil[_0x3151('0x3e')](_0xc54297[_0x3151('0x3f')]);if(_0x450c93&&_0x450c93['monitor_format']){logger['info'](_0x3151('0x40'),_0x3151('0x41'));_0x5f018a['recordingURL']=util[_0x3151('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xc54297[_0x3151('0x3f')],_0x5f018a[_0x3151('0x42')],md5(_0x5f018a[_0x3151('0x42')]));}else{_0x5f018a[_0x3151('0x43')]='';}headers[_0x3151('0x44')]=getAuth(_0xc54297);return getUser(_0xc54297,_0x2fc9a6[_0x3151('0x23')])[_0x3151('0x1d')](function(_0xa3c448){_0xe82bb9=_0xa3c448;logger[_0x3151('0xc')]('The\x20User\x20ID\x20is:',_0xe82bb9['id']);return getEndUser(_0xc54297,_0x5f018a[_0x3151('0x11')],_0x5f018a[_0x3151('0x12')]);})[_0x3151('0x1d')](function(_0x3ba107){_0x32c7de=_0x3ba107;logger[_0x3151('0xc')](_0x3151('0x45'),_0x32c7de['id']);return getTicket(_0xc54297,_0xe82bb9,_0x32c7de,_0x59d65d,_0x5f018a);})[_0x3151('0x1d')](function(_0x5deb2e){if(_0x5deb2e&&_0x5deb2e['id']){logger[_0x3151('0xc')](_0x3151('0x46'));logger[_0x3151('0xc')]('The\x20Ticket\x20ID\x20is:',_0x5deb2e['id']);logger[_0x3151('0xc')](_0x3151('0x40'),_0x3151('0x47'));emit(util['format'](_0x3151('0x48'),_0x2fc9a6[_0x3151('0x16')]),_0x3151('0x49'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0xc54297[_0x3151('0x20')],_0x5deb2e['id'])});}})['catch'](function(_0x58a2b1){logger['error'](_0x3151('0x40'),JSON[_0x3151('0x2e')](_0x58a2b1));});};exports[_0x3151('0x4a')]=function(_0x99f299,_0x35ecf7,_0x314298,_0xe69a79,_0x18cbe7,_0x2ae2be,_0x150d75){var _0x3a4b9f,_0x3d576c;_0x2ae2be[_0x3151('0x20')]=intUtil[_0x3151('0x3e')](_0x2ae2be[_0x3151('0x20')]);_0x2ae2be[_0x3151('0x3f')]=intUtil[_0x3151('0x3e')](_0x2ae2be['serverUrl']);if(_0x150d75&&_0x150d75['recordingFormat']&&_0x150d75['recordingFormat']!==_0x3151('0x4b')){logger[_0x3151('0xc')](_0x3151('0x4c'),_0x3151('0x41'));_0x35ecf7['recordingURL']=util['format'](_0x3151('0x4d'),_0x2ae2be[_0x3151('0x3f')],_0x35ecf7['uniqueid'],md5(_0x35ecf7[_0x3151('0x42')]));}headers[_0x3151('0x44')]=getAuth(_0x2ae2be);return getUser(_0x2ae2be,_0xe69a79[_0x3151('0x23')])[_0x3151('0x1d')](function(_0x110e6e){_0x3a4b9f=_0x110e6e;logger[_0x3151('0xc')](_0x3151('0x4e'),_0x3a4b9f['id']);return getEndUser(_0x2ae2be,_0x35ecf7[_0x3151('0x4f')],_0x35ecf7[_0x3151('0x50')]);})[_0x3151('0x1d')](function(_0x18fb9e){_0x3d576c=_0x18fb9e;logger['info'](_0x3151('0x45'),_0x3d576c['id']);return getTicket(_0x2ae2be,_0x3a4b9f,_0x3d576c,_0x314298,_0x35ecf7);})[_0x3151('0x1d')](function(_0x208ed2){if(_0x208ed2&&_0x208ed2['id']){logger[_0x3151('0xc')](_0x3151('0x46'));logger[_0x3151('0xc')]('The\x20Ticket\x20ID\x20is:',_0x208ed2['id']);logger['info'](_0x3151('0x4c'),_0x3151('0x47'));emit(util[_0x3151('0xf')](_0x3151('0x48'),_0xe69a79[_0x3151('0x16')]),'trigger:browser:url',{'uri':util[_0x3151('0xf')](_0x3151('0x51'),_0x2ae2be[_0x3151('0x20')],_0x208ed2['id'])});}})[_0x3151('0x52')](function(_0x46d957){logger[_0x3151('0x53')](_0x3151('0x4c'),JSON['stringify'](_0x46d957));});};exports[_0x3151('0x54')]=function(_0x35d629,_0x2cc526,_0x515f74,_0x55969c,_0x5009b5,_0x25028d){var _0x51645b,_0x488f3b;_0x25028d[_0x3151('0x20')]=intUtil[_0x3151('0x3e')](_0x25028d[_0x3151('0x20')]);_0x25028d['serverUrl']=intUtil[_0x3151('0x3e')](_0x25028d[_0x3151('0x3f')]);if(_0x5009b5&&_0x5009b5[_0x3151('0x55')]){logger[_0x3151('0xc')]('['+_0x2cc526[_0x3151('0x56')][_0x3151('0x57')]()+']',_0x3151('0x41'));_0x2cc526['recordingURL']=util[_0x3151('0xf')](_0x3151('0x4d'),_0x25028d['serverUrl'],_0x2cc526['uniqueid'],md5(_0x2cc526[_0x3151('0x42')]));}else{_0x2cc526[_0x3151('0x43')]='';}headers['Authorization']=getAuth(_0x25028d);return getUser(_0x25028d,'')[_0x3151('0x1d')](function(_0x39334f){_0x51645b=_0x39334f;logger['info'](_0x3151('0x4e'),_0x51645b['id']);return getEndUser(_0x25028d,_0x2cc526[_0x3151('0x11')],_0x2cc526['calleridnum']);})[_0x3151('0x1d')](function(_0x573b23){_0x488f3b=_0x573b23;logger[_0x3151('0xc')](_0x3151('0x45'),_0x488f3b['id']);return getTicket(_0x25028d,_0x51645b,_0x488f3b,_0x515f74,_0x2cc526);})['then'](function(_0xa4551b){if(_0xa4551b){logger[_0x3151('0xc')](_0x3151('0x46'));logger[_0x3151('0xc')]('The\x20Ticket\x20ID\x20is:',_0xa4551b['id']);}})[_0x3151('0x52')](function(_0x447ea5){logger['error']('['+_0x2cc526[_0x3151('0x56')][_0x3151('0x57')]()+']',JSON[_0x3151('0x2e')](_0x447ea5));});}; \ 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 b4d07a8..e0f8153 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 _0x8210=['add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','adminEmail','username','toLowerCase','outbound','unmanaged','queue','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','then','users','length','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','POST','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss'];(function(_0x39ee8c,_0x7edb22){var _0x381f12=function(_0x577e2f){while(--_0x577e2f){_0x39ee8c['push'](_0x39ee8c['shift']());}};_0x381f12(++_0x7edb22);}(_0x8210,0xc3));var _0x0821=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x8210[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0x0821('0x0'));var moment=require(_0x0821('0x1'));var Promise=require('bluebird');var Redis=require(_0x0821('0x2'));var intUtil=require(_0x0821('0x3'));var config=require(_0x0821('0x4'));var logger=require(_0x0821('0x5'))(_0x0821('0x6'));config[_0x0821('0x7')]=_['defaults'](config[_0x0821('0x7')],{'host':_0x0821('0x8'),'port':0x18eb});var io=require(_0x0821('0x9'))(new Redis(config['redis']));function getAdminId(_0x22c08f,_0xc1ff8e,_0x2104a7,_0x1402d3){return new Promise(function(_0x188e03,_0x4aaeeb){var _0x11efbe=![];var _0xcedd03={'method':_0x0821('0xa'),'uri':_0x1402d3+_0x0821('0xb'),'json':!![]};_0xcedd03[_0x0821('0xc')]=_0x2104a7;logger[_0x0821('0xd')]('Getting\x20admin\x20information');return rp(_0xcedd03)[_0x0821('0xe')](function(_0x4596cc){if(_0x4596cc){var _0x347249=_0x4596cc[_0x0821('0xf')];var _0x16584b=null;for(_0x16584b=0x0;_0x16584b<_0x347249[_0x0821('0x10')];_0x16584b++){if(_0x347249[_0x16584b]['email']===_0x22c08f['adminEmail']){_0x22c08f[_0x0821('0x11')]=_0x347249[_0x16584b]['id'];_0x11efbe=!![];}}if(_0x11efbe){logger[_0x0821('0xd')](_0x0821('0x12'),_0x22c08f[_0x0821('0x11')]);_0x188e03(_0x22c08f);}else{_0x4aaeeb({'statusCode':0x194,'message':_0x0821('0x13')});}}else{_0x4aaeeb({'statusCode':0x194,'message':_0x0821('0x13')});}})[_0x0821('0x14')](function(_0x3beff4){logger[_0x0821('0x15')]('['+[_0xc1ff8e[_0x0821('0x16')]()]+']',_0x3beff4[_0x0821('0x17')]);_0x4aaeeb(_0x3beff4);});});}function getUser(_0xb1549,_0x500412,_0x59fd93){return function(_0x184652){return new Promise(function(_0x324483,_0x12caca){var _0x416833={'method':_0x0821('0xa'),'uri':_0x59fd93+'/api/selector/owners','json':!![]};_0x416833[_0x0821('0xc')]=_0x500412;logger[_0x0821('0xd')](_0x0821('0x18'));return rp(_0x416833)[_0x0821('0xe')](function(_0x828900){if(_0x828900){var _0x591c44=_0x828900[_0x0821('0xf')];var _0x2e7459=![];var _0x119a39=null;if(_0x184652[_0x0821('0x19')]!==null){logger[_0x0821('0xd')](_0x0821('0x1a'),_0x184652[_0x0821('0x19')]);_0x184652[_0x0821('0x1b')]=_0x184652['agentEmail'];for(_0x119a39=0x0;_0x119a39<_0x591c44[_0x0821('0x10')];_0x119a39++){if(_0x591c44[_0x119a39]['email']===_0x184652['agentEmail']){_0x2e7459=!![];_0x184652[_0x0821('0x1c')]=_0x591c44[_0x119a39]['id'];logger['info'](_0x0821('0x1d'),_0x184652[_0x0821('0x1c')]);}}}if(!_0x2e7459){logger[_0x0821('0xd')](_0x0821('0x1e'));_0x184652[_0x0821('0x1b')]=_0x184652['adminEmail'];_0x184652[_0x0821('0x1c')]=_0x184652[_0x0821('0x11')];_0x2e7459=!![];}if(_0x2e7459){_0x324483(_0x184652);}else{_0x12caca({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x12caca({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x0821('0x14')](function(_0x4277d4){logger[_0x0821('0x15')]('['+[_0xb1549[_0x0821('0x16')]()]+']',_0x4277d4[_0x0821('0x17')]);_0x12caca(_0x4277d4);});});};}function searchContact(_0x4cbb0f,_0x122a0e,_0x38e619,_0x1fe730){return new Promise(function(_0x45866b,_0x9f354b){var _0x591438={'method':_0x0821('0xa'),'headers':_0x122a0e,'uri':_0x4cbb0f+_0x0821('0x1f')+_0x1fe730+'&f='+_0x38e619+_0x0821('0x20'),'json':!![]};rp(_0x591438)['then'](function(_0x4d522f){var _0x5a1ae2=_[_0x0821('0x21')](_0x4d522f[_0x0821('0x22')]['contacts'],[_0x38e619,_0x1fe730]);_0x45866b(_0x5a1ae2);})[_0x0821('0x14')](function(_0x5875e3){_0x9f354b(_0x5875e3);});});}function getEndUser(_0x46520d,_0x590fb2,_0x17becf){return function(_0x2a1c00){return new Promise(function(_0x18b1fe,_0x4ac3fe){logger[_0x0821('0xd')](util[_0x0821('0x23')](_0x0821('0x24'),_0x2a1c00[_0x0821('0x25')]));searchContact(_0x17becf,_0x590fb2,_0x0821('0x26'),_0x2a1c00[_0x0821('0x25')])['then'](function(_0x20bc59){if(_0x20bc59){_0x2a1c00['endUserId']=_0x20bc59['id'];logger['info'](_0x0821('0x27'),_0x2a1c00[_0x0821('0x28')]);return _0x18b1fe(_0x2a1c00);}searchContact(_0x17becf,_0x590fb2,'work_number',_0x2a1c00['contactNumber'])[_0x0821('0xe')](function(_0x23ac5f){if(_0x23ac5f){_0x2a1c00[_0x0821('0x28')]=_0x23ac5f['id'];logger['info'](_0x0821('0x29'),_0x2a1c00[_0x0821('0x28')]);return _0x18b1fe(_0x2a1c00);}createEndUser(_0x2a1c00,_0x46520d,_0x590fb2,_0x17becf)['then'](function(_0x258e6c){logger[_0x0821('0xd')]('Contact\x20created:',_0x258e6c['endUserId']);return _0x18b1fe(_0x258e6c);});});})[_0x0821('0x14')](function(_0x15744b){_0x4ac3fe(_0x15744b);});});};}function createEndUser(_0x3f1ba5,_0x17219d,_0x182481,_0x532c0c){return new Promise(function(_0x269234,_0x160fd8){var _0x23a614=moment();var _0x164adb={'method':_0x0821('0x2a'),'uri':_0x532c0c+'/api/contacts','body':{'contact':{'last_name':_0x3f1ba5['contactNumber'],'work_number':_0x3f1ba5[_0x0821('0x25')],'mobile_number':_0x3f1ba5[_0x0821('0x25')],'owner_id':_0x3f1ba5[_0x0821('0x1c')],'created_at':_0x23a614[_0x0821('0x23')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x164adb[_0x0821('0xc')]=_0x182481;logger['info'](_0x0821('0x2b'));return rp(_0x164adb)[_0x0821('0xe')](function(_0x1010e6){_0x3f1ba5[_0x0821('0x28')]=_0x1010e6[_0x0821('0x2c')]['id'];_0x269234(_0x3f1ba5);})[_0x0821('0x14')](function(_0x32c26c){logger[_0x0821('0x15')]('['+[_0x17219d[_0x0821('0x16')]()]+']',_0x32c26c[_0x0821('0x17')]);_0x160fd8(_0x32c26c[_0x0821('0x17')]);});});}function getTicket(_0x4d4bcd,_0xf5578e,_0x2e39c6,_0x1f5ffb,_0x40e0ca){return function(_0x10c165){logger[_0x0821('0xd')](_0x0821('0x2d'));return new Promise(function(_0x58eca9,_0x5b2f0e){var _0x25dae5=moment();var _0xce1720={'method':_0x0821('0x2a'),'uri':_0x2e39c6+_0x0821('0x2e'),'body':{'title':intUtil[_0x0821('0x2f')](_0x1f5ffb['Subjects'],_0x40e0ca,'\x20'),'description':intUtil[_0x0821('0x2f')](_0x1f5ffb[_0x0821('0x30')],_0x40e0ca,'\x0a'),'owner_id':_0x10c165[_0x0821('0x1c')],'creater_id':_0x10c165[_0x0821('0x11')],'targetable_id':_0x10c165[_0x0821('0x28')],'targetable_type':_0x0821('0x31'),'created_at':_0x25dae5['format'](_0x0821('0x32')),'due_date':_0x25dae5[_0x0821('0x33')](0x1e,'m')[_0x0821('0x23')](_0x0821('0x32'))},'json':!![]};_0xce1720[_0x0821('0xc')]=_0xf5578e;return rp(_0xce1720)[_0x0821('0xe')](function(_0x2833a6){_0x10c165[_0x0821('0x34')]=_0x2833a6[_0x0821('0x35')]['id'];logger[_0x0821('0xd')](_0x0821('0x36'),_0x10c165[_0x0821('0x34')]);_0x58eca9(_0x10c165);})[_0x0821('0x14')](function(_0x2c44f1){logger[_0x0821('0x15')]('['+[_0x4d4bcd['toUpperCase']()]+']',_0x2c44f1['message']);_0x5b2f0e(_0x2c44f1['message']);});});};}function emit(_0x2ffe98,_0x2228f9,_0x38da09){var _0x35ff37={'uri':_0x2ffe98+_0x0821('0x37')+_0x38da09};io['to'](util[_0x0821('0x23')](_0x0821('0x38'),_0x2228f9))[_0x0821('0x39')](_0x0821('0x3a'),_0x35ff37);}exports['cs']=function(_0x56d800,_0x476e3e,_0x294a01,_0x3e28a5,_0x47821d,_0x120064,_0x46a84e,_0x3edd06){var _0x353a99={};var _0x2f1ada={'Authorization':_0x0821('0x3b')+_0x120064[_0x0821('0x3c')]};_0x120064[_0x0821('0x3d')]=intUtil[_0x0821('0x3e')](_0x120064[_0x0821('0x3d')]);_0x120064[_0x0821('0x3f')]=intUtil[_0x0821('0x3e')](_0x120064[_0x0821('0x3f')]);var _0x383fc0=_0x120064[_0x0821('0x3d')];_0x353a99[_0x0821('0x40')]=_0x120064[_0x0821('0x41')];_0x353a99[_0x0821('0x25')]=_0x3edd06[_0x0821('0x42')]()===_0x0821('0x43')?_0x476e3e['destcalleridnum']:_0x476e3e['calleridnum'];_0x353a99['callDirection']=_0x3edd06==='queue'||_0x3edd06===_0x0821('0x44')?_0x0821('0x45'):_0x0821('0x43');if(_0x3e28a5){_0x353a99[_0x0821('0x19')]=_0x3e28a5[_0x0821('0x46')];}var _0xf99448=util['format'](_0x0821('0x47'),_0x120064['serverUrl'],_0x476e3e['uniqueid'],md5(_0x476e3e['uniqueid']));if(_0x47821d&&_0x47821d[_0x0821('0x48')]){logger[_0x0821('0xd')](_0x0821('0x49'),_0x0821('0x4a'));_0x476e3e[_0x0821('0x4b')]=_0xf99448;}else if(_0x46a84e&&_0x46a84e[_0x0821('0x4c')]&&_0x46a84e['recordingFormat']!==_0x0821('0x4d')){logger['info'](_0x0821('0x4e'),_0x0821('0x4a'));_0x476e3e[_0x0821('0x4b')]=_0xf99448;}else{_0x476e3e[_0x0821('0x4b')]='';}return getAdminId(_0x353a99,_0x3edd06,_0x2f1ada,_0x383fc0)[_0x0821('0xe')](getUser(_0x3edd06,_0x2f1ada,_0x383fc0))[_0x0821('0xe')](getEndUser(_0x3edd06,_0x2f1ada,_0x383fc0))['then'](getTicket(_0x3edd06,_0x2f1ada,_0x383fc0,_0x294a01,_0x476e3e))[_0x0821('0xe')](function(_0x193fc1){logger[_0x0821('0xd')](util[_0x0821('0x23')]('The\x20ticket\x20ID\x20is:\x20%s',_0x193fc1[_0x0821('0x34')]));if(_0x3edd06!=='unmanaged'){logger[_0x0821('0xd')]('['+[_0x3edd06['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x383fc0,_0x3e28a5[_0x0821('0x4f')],_0x193fc1[_0x0821('0x28')]);}})[_0x0821('0x14')](function(_0x44e172){logger[_0x0821('0x15')]('['+[_0x3edd06['toUpperCase']()]+_0x0821('0x50'),util[_0x0821('0x51')](_0x44e172,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0f75=['lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','headers','Getting\x20user\x20list','agentEmail','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','POST','/api/contacts','toUpperCase','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','adminEmail','username','toLowerCase','outbound','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect'];(function(_0x1083f0,_0x190add){var _0x3e671f=function(_0x53d219){while(--_0x53d219){_0x1083f0['push'](_0x1083f0['shift']());}};_0x3e671f(++_0x190add);}(_0x0f75,0xa4));var _0x50f7=function(_0x5b1744,_0x301bd8){_0x5b1744=_0x5b1744-0x0;var _0x1d7d75=_0x0f75[_0x5b1744];return _0x1d7d75;};'use strict';var _=require(_0x50f7('0x0'));var rp=require(_0x50f7('0x1'));var md5=require(_0x50f7('0x2'));var util=require(_0x50f7('0x3'));var moment=require(_0x50f7('0x4'));var Promise=require(_0x50f7('0x5'));var Redis=require(_0x50f7('0x6'));var intUtil=require(_0x50f7('0x7'));var config=require('../../../../config/environment');var logger=require(_0x50f7('0x8'))(_0x50f7('0x9'));config[_0x50f7('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x50f7('0xb'))(new Redis(config['redis']));function getAdminId(_0x5b3d25,_0x8391bc,_0x5d1507,_0xc696b7){return new Promise(function(_0x2b84cf,_0x20b9cd){var _0x15840b=![];var _0x45796b={'method':_0x50f7('0xc'),'uri':_0xc696b7+_0x50f7('0xd'),'json':!![]};_0x45796b['headers']=_0x5d1507;logger[_0x50f7('0xe')](_0x50f7('0xf'));return rp(_0x45796b)[_0x50f7('0x10')](function(_0x4e6835){if(_0x4e6835){var _0x4a0689=_0x4e6835[_0x50f7('0x11')];var _0x160be4=null;for(_0x160be4=0x0;_0x160be4<_0x4a0689[_0x50f7('0x12')];_0x160be4++){if(_0x4a0689[_0x160be4][_0x50f7('0x13')]===_0x5b3d25['adminEmail']){_0x5b3d25[_0x50f7('0x14')]=_0x4a0689[_0x160be4]['id'];_0x15840b=!![];}}if(_0x15840b){logger[_0x50f7('0xe')](_0x50f7('0x15'),_0x5b3d25[_0x50f7('0x14')]);_0x2b84cf(_0x5b3d25);}else{_0x20b9cd({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x20b9cd({'statusCode':0x194,'message':_0x50f7('0x16')});}})[_0x50f7('0x17')](function(_0x25bfce){logger[_0x50f7('0x18')]('['+[_0x8391bc['toUpperCase']()]+']',_0x25bfce[_0x50f7('0x19')]);_0x20b9cd(_0x25bfce);});});}function getUser(_0x1ef356,_0xbbb5b4,_0x5d1430){return function(_0x2c5250){return new Promise(function(_0x424e4b,_0x3d9252){var _0x3974bd={'method':_0x50f7('0xc'),'uri':_0x5d1430+'/api/selector/owners','json':!![]};_0x3974bd[_0x50f7('0x1a')]=_0xbbb5b4;logger[_0x50f7('0xe')](_0x50f7('0x1b'));return rp(_0x3974bd)[_0x50f7('0x10')](function(_0x4c1f37){if(_0x4c1f37){var _0x1bec0c=_0x4c1f37[_0x50f7('0x11')];var _0x2c5f46=![];var _0x225dfb=null;if(_0x2c5250[_0x50f7('0x1c')]!==null){logger[_0x50f7('0xe')]('Getting\x20user\x20with\x20email',_0x2c5250[_0x50f7('0x1c')]);_0x2c5250['userEmail']=_0x2c5250[_0x50f7('0x1c')];for(_0x225dfb=0x0;_0x225dfb<_0x1bec0c['length'];_0x225dfb++){if(_0x1bec0c[_0x225dfb][_0x50f7('0x13')]===_0x2c5250[_0x50f7('0x1c')]){_0x2c5f46=!![];_0x2c5250[_0x50f7('0x1d')]=_0x1bec0c[_0x225dfb]['id'];logger[_0x50f7('0xe')](_0x50f7('0x1e'),_0x2c5250[_0x50f7('0x1d')]);}}}if(!_0x2c5f46){logger[_0x50f7('0xe')](_0x50f7('0x1f'));_0x2c5250['userEmail']=_0x2c5250['adminEmail'];_0x2c5250[_0x50f7('0x1d')]=_0x2c5250['adminId'];_0x2c5f46=!![];}if(_0x2c5f46){_0x424e4b(_0x2c5250);}else{_0x3d9252({'statusCode':0x194,'message':_0x50f7('0x16')});}}else{_0x3d9252({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x50f7('0x17')](function(_0x534be2){logger[_0x50f7('0x18')]('['+[_0x1ef356['toUpperCase']()]+']',_0x534be2['message']);_0x3d9252(_0x534be2);});});};}function searchContact(_0x19b9a5,_0x549f57,_0x48c596,_0x2e68f1){return new Promise(function(_0xe669c4,_0x154792){var _0x54709d={'method':_0x50f7('0xc'),'headers':_0x549f57,'uri':_0x19b9a5+_0x50f7('0x20')+_0x2e68f1+'&f='+_0x48c596+'&entities=contact','json':!![]};rp(_0x54709d)[_0x50f7('0x10')](function(_0x13cdbc){var _0x2749b=_['find'](_0x13cdbc[_0x50f7('0x21')][_0x50f7('0x21')],[_0x48c596,_0x2e68f1]);_0xe669c4(_0x2749b);})['catch'](function(_0x237c8d){_0x154792(_0x237c8d);});});}function getEndUser(_0x5881be,_0x2876b0,_0x547c85){return function(_0x1bc9ca){return new Promise(function(_0x6230d8,_0x237701){logger[_0x50f7('0xe')](util[_0x50f7('0x22')](_0x50f7('0x23'),_0x1bc9ca[_0x50f7('0x24')]));searchContact(_0x547c85,_0x2876b0,_0x50f7('0x25'),_0x1bc9ca[_0x50f7('0x24')])['then'](function(_0x8898ba){if(_0x8898ba){_0x1bc9ca[_0x50f7('0x26')]=_0x8898ba['id'];logger[_0x50f7('0xe')](_0x50f7('0x27'),_0x1bc9ca['endUserId']);return _0x6230d8(_0x1bc9ca);}searchContact(_0x547c85,_0x2876b0,_0x50f7('0x28'),_0x1bc9ca[_0x50f7('0x24')])[_0x50f7('0x10')](function(_0x383931){if(_0x383931){_0x1bc9ca['endUserId']=_0x383931['id'];logger['info']('Contact\x20found\x20work_number:',_0x1bc9ca[_0x50f7('0x26')]);return _0x6230d8(_0x1bc9ca);}createEndUser(_0x1bc9ca,_0x5881be,_0x2876b0,_0x547c85)[_0x50f7('0x10')](function(_0x4fb93f){logger[_0x50f7('0xe')]('Contact\x20created:',_0x4fb93f['endUserId']);return _0x6230d8(_0x4fb93f);});});})[_0x50f7('0x17')](function(_0x5e803b){_0x237701(_0x5e803b);});});};}function createEndUser(_0x1442af,_0x402212,_0x5d33a6,_0x54d30f){return new Promise(function(_0x4f5f64,_0x3e35b4){var _0x8efae=moment();var _0x203efc={'method':_0x50f7('0x29'),'uri':_0x54d30f+_0x50f7('0x2a'),'body':{'contact':{'last_name':_0x1442af[_0x50f7('0x24')],'work_number':_0x1442af[_0x50f7('0x24')],'mobile_number':_0x1442af['contactNumber'],'owner_id':_0x1442af[_0x50f7('0x1d')],'created_at':_0x8efae['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x203efc[_0x50f7('0x1a')]=_0x5d33a6;logger[_0x50f7('0xe')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x203efc)['then'](function(_0x484f68){_0x1442af[_0x50f7('0x26')]=_0x484f68['contact']['id'];_0x4f5f64(_0x1442af);})[_0x50f7('0x17')](function(_0x3a7004){logger['error']('['+[_0x402212[_0x50f7('0x2b')]()]+']',_0x3a7004[_0x50f7('0x19')]);_0x3e35b4(_0x3a7004[_0x50f7('0x19')]);});});}function getTicket(_0x166be2,_0x469ee5,_0x516725,_0x393a8d,_0x180197){return function(_0x344a84){logger[_0x50f7('0xe')](_0x50f7('0x2c'));return new Promise(function(_0xb94a5a,_0x172415){var _0x37487f=moment();var _0x41c059={'method':_0x50f7('0x29'),'uri':_0x516725+_0x50f7('0x2d'),'body':{'title':intUtil[_0x50f7('0x2e')](_0x393a8d[_0x50f7('0x2f')],_0x180197,'\x20'),'description':intUtil[_0x50f7('0x2e')](_0x393a8d[_0x50f7('0x30')],_0x180197,'\x0a'),'owner_id':_0x344a84['userId'],'creater_id':_0x344a84[_0x50f7('0x14')],'targetable_id':_0x344a84[_0x50f7('0x26')],'targetable_type':_0x50f7('0x31'),'created_at':_0x37487f[_0x50f7('0x22')](_0x50f7('0x32')),'due_date':_0x37487f[_0x50f7('0x33')](0x1e,'m')['format'](_0x50f7('0x32'))},'json':!![]};_0x41c059[_0x50f7('0x1a')]=_0x469ee5;return rp(_0x41c059)[_0x50f7('0x10')](function(_0x3aa726){_0x344a84[_0x50f7('0x34')]=_0x3aa726[_0x50f7('0x35')]['id'];logger[_0x50f7('0xe')]('Task\x20created:',_0x344a84[_0x50f7('0x34')]);_0xb94a5a(_0x344a84);})[_0x50f7('0x17')](function(_0x3b85f9){logger[_0x50f7('0x18')]('['+[_0x166be2[_0x50f7('0x2b')]()]+']',_0x3b85f9[_0x50f7('0x19')]);_0x172415(_0x3b85f9[_0x50f7('0x19')]);});});};}function emit(_0xf32fcd,_0x5843b3,_0x8b6d5a){var _0x4767ee={'uri':_0xf32fcd+'/contacts/'+_0x8b6d5a};io['to'](util['format'](_0x50f7('0x36'),_0x5843b3))[_0x50f7('0x37')](_0x50f7('0x38'),_0x4767ee);}exports['cs']=function(_0x324afc,_0x3975cf,_0x19d99e,_0x4c04ef,_0xc5afc6,_0x49d407,_0x2bf069,_0x3d7a82){var _0x6148a3={};var _0x4a3394={'Authorization':_0x50f7('0x39')+_0x49d407[_0x50f7('0x3a')]};_0x49d407[_0x50f7('0x3b')]=intUtil[_0x50f7('0x3c')](_0x49d407[_0x50f7('0x3b')]);_0x49d407[_0x50f7('0x3d')]=intUtil['stripTrailingSlash'](_0x49d407[_0x50f7('0x3d')]);var _0x4c84a5=_0x49d407[_0x50f7('0x3b')];_0x6148a3[_0x50f7('0x3e')]=_0x49d407[_0x50f7('0x3f')];_0x6148a3['contactNumber']=_0x3d7a82[_0x50f7('0x40')]()===_0x50f7('0x41')?_0x3975cf[_0x50f7('0x42')]:_0x3975cf[_0x50f7('0x43')];_0x6148a3['callDirection']=_0x3d7a82===_0x50f7('0x44')||_0x3d7a82===_0x50f7('0x45')?_0x50f7('0x44'):_0x50f7('0x41');if(_0x4c04ef){_0x6148a3['agentEmail']=_0x4c04ef[_0x50f7('0x13')];}var _0x5765d2=util['format'](_0x50f7('0x46'),_0x49d407[_0x50f7('0x3d')],_0x3975cf[_0x50f7('0x47')],md5(_0x3975cf[_0x50f7('0x47')]));if(_0xc5afc6&&_0xc5afc6[_0x50f7('0x48')]){logger[_0x50f7('0xe')](_0x50f7('0x49'),_0x50f7('0x4a'));_0x3975cf['recordingURL']=_0x5765d2;}else if(_0x2bf069&&_0x2bf069[_0x50f7('0x4b')]&&_0x2bf069['recordingFormat']!==_0x50f7('0x4c')){logger[_0x50f7('0xe')](_0x50f7('0x4d'),_0x50f7('0x4a'));_0x3975cf['recordingURL']=_0x5765d2;}else{_0x3975cf['recordingURL']='';}return getAdminId(_0x6148a3,_0x3d7a82,_0x4a3394,_0x4c84a5)[_0x50f7('0x10')](getUser(_0x3d7a82,_0x4a3394,_0x4c84a5))[_0x50f7('0x10')](getEndUser(_0x3d7a82,_0x4a3394,_0x4c84a5))[_0x50f7('0x10')](getTicket(_0x3d7a82,_0x4a3394,_0x4c84a5,_0x19d99e,_0x3975cf))[_0x50f7('0x10')](function(_0x865d80){logger[_0x50f7('0xe')](util[_0x50f7('0x22')]('The\x20ticket\x20ID\x20is:\x20%s',_0x865d80['ticketId']));if(_0x3d7a82!==_0x50f7('0x45')){logger[_0x50f7('0xe')]('['+[_0x3d7a82[_0x50f7('0x2b')]()]+']',_0x50f7('0x4e'));emit(_0x4c84a5,_0x4c04ef[_0x50f7('0x4f')],_0x865d80[_0x50f7('0x26')]);}})['catch'](function(_0x38ac4c){logger[_0x50f7('0x18')]('['+[_0x3d7a82[_0x50f7('0x2b')]()]+_0x50f7('0x50'),util[_0x50f7('0x51')](_0x38ac4c,{'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 0eb76a5..1ed8a33 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 _0x394d=['zoho','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','data2','find','data3','queue','outbound','unmanaged','salesforce','log','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./zoho','./desk','./vtiger','./servicenow','./freshsales','zendesk','sugarcrm','freshdesk'];(function(_0x1ca361,_0x573b1c){var _0x454618=function(_0x50531a){while(--_0x50531a){_0x1ca361['push'](_0x1ca361['shift']());}};_0x454618(++_0x573b1c);}(_0x394d,0x1d0));var _0xd394=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x394d[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0xd394('0x0'));var util=require(_0xd394('0x1'));var zendesk=require(_0xd394('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0xd394('0x3'));var freshdesk=require('./freshdesk');var zoho=require(_0xd394('0x4'));var desk=require(_0xd394('0x5'));var vtiger=require(_0xd394('0x6'));var servicenow=require(_0xd394('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0xd394('0x8'));var integrations=[_0xd394('0x9'),'salesforce',_0xd394('0xa'),_0xd394('0xb'),_0xd394('0xc'),'desk',_0xd394('0xd'),_0xd394('0xe'),_0xd394('0xf'),_0xd394('0x10')];exports[_0xd394('0x11')]=function(_0x1424d3,_0x5a08e5,_0x10b77c,_0x5e75bd,_0x5536c9,_0x20af03){if(_0x10b77c){if(_['includes'](integrations,_0x1424d3[_0xd394('0x12')][_0xd394('0x13')]())){try{var _0xc2050a=null;var _0xec7f41='';var _0x50fbfe=_0x10b77c[_0x1424d3[_0xd394('0x12')][_0xd394('0x13')]()];if(_0x50fbfe){var _0x510467=_0x50fbfe[_0x1424d3[_0xd394('0x14')]];if(_0x510467){var _0x19b05f=_[_0xd394('0x15')](_0x510467['Configurations'],{'id':parseInt(_0x1424d3[_0xd394('0x16')],0xa)});if(_0x19b05f){if(_0x5e75bd){if(_0x5536c9&&_0x5a08e5['queue']){_0xec7f41=_0xd394('0x17');}else if(_0x5a08e5['routeId']){_0xec7f41=_0xd394('0x18');}else{console['log']('EVENT\x20UNKNOWN',_0x5a08e5);}}else{_0xec7f41=_0xd394('0x19');}switch(_0x1424d3[_0xd394('0x12')][_0xd394('0x13')]()){case _0xd394('0x9'):zendesk[_0xec7f41](_0x1424d3,_0x5a08e5,_0x19b05f,_0x5e75bd,_0x5536c9,_0x510467,_0x20af03);break;case _0xd394('0x1a'):salesforce[_0xec7f41](_0x1424d3,_0x5a08e5,_0x19b05f,_0x5e75bd,_0x5536c9,_0x510467,_0x20af03);break;case _0xd394('0xa'):sugarcrm[_0xec7f41](_0x1424d3,_0x5a08e5,_0x19b05f,_0x5e75bd,_0x5536c9,_0x510467,_0x20af03);break;case _0xd394('0xb'):freshdesk[_0xec7f41](_0x1424d3,_0x5a08e5,_0x19b05f,_0x5e75bd,_0x5536c9,_0x510467,_0x20af03);break;case _0xd394('0xc'):zoho[_0xec7f41](_0x1424d3,_0x5a08e5,_0x19b05f,_0x5e75bd,_0x5536c9,_0x510467,_0x20af03);break;case'desk':desk[_0xec7f41](_0x1424d3,_0x5a08e5,_0x19b05f,_0x5e75bd,_0x5536c9,_0x510467,_0x20af03);break;case _0xd394('0xd'):vtiger[_0xec7f41](_0x1424d3,_0x5a08e5,_0x19b05f,_0x5e75bd,_0x5536c9,_0x510467,_0x20af03);break;case _0xd394('0xf'):freshsales['cs'](_0x1424d3,_0x5a08e5,_0x19b05f,_0x5e75bd,_0x5536c9,_0x510467,_0x20af03,_0xec7f41);break;case'servicenow':servicenow['cs'](_0x1424d3,_0x5a08e5,_0x19b05f,_0x5e75bd,_0x5536c9,_0x510467,_0x20af03,_0xec7f41);break;case _0xd394('0xe'):dynamics365['cs'](_0x1424d3,_0x5a08e5,_0x19b05f,_0x5e75bd,_0x5536c9,_0x510467,_0x20af03,_0xec7f41);break;default:console[_0xd394('0x1b')]('unknown\x20integration');}}else{_0xc2050a=require(_0xd394('0x1c'))(_0x1424d3[_0xd394('0x12')][_0xd394('0x13')]());_0xc2050a[_0xd394('0x1d')](_0xd394('0x1e'),util[_0xd394('0x1f')](_0xd394('0x20'),_0x1424d3[_0xd394('0x12')][_0xd394('0x13')](),_0x1424d3[_0xd394('0x16')]));}}else{_0xc2050a=require('../../../../config/logger')(_0x1424d3['data1']['toLowerCase']());_0xc2050a[_0xd394('0x1d')]('[EXEC]',util[_0xd394('0x1f')](_0xd394('0x21'),_0x1424d3[_0xd394('0x12')][_0xd394('0x13')](),_0x1424d3[_0xd394('0x14')]));}}else{}}catch(_0x53f2fd){console[_0xd394('0x1d')](_0x53f2fd);}}}}; \ No newline at end of file +var _0x14c2=['zoho','desk','freshsales','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','freshdesk','vtiger','dynamics365','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','lodash','./zendesk','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm'];(function(_0x551ed2,_0x197d2d){var _0x4bb9d1=function(_0x5b49f6){while(--_0x5b49f6){_0x551ed2['push'](_0x551ed2['shift']());}};_0x4bb9d1(++_0x197d2d);}(_0x14c2,0x180));var _0x214c=function(_0x4e434c,_0x1c4105){_0x4e434c=_0x4e434c-0x0;var _0x52bab1=_0x14c2[_0x4e434c];return _0x52bab1;};'use strict';var _=require(_0x214c('0x0'));var util=require('util');var zendesk=require(_0x214c('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0x214c('0x2'));var freshdesk=require(_0x214c('0x3'));var zoho=require(_0x214c('0x4'));var desk=require('./desk');var vtiger=require(_0x214c('0x5'));var servicenow=require(_0x214c('0x6'));var dynamics365=require(_0x214c('0x7'));var freshsales=require(_0x214c('0x8'));var integrations=[_0x214c('0x9'),_0x214c('0xa'),_0x214c('0xb'),'freshdesk',_0x214c('0xc'),_0x214c('0xd'),'vtiger','dynamics365',_0x214c('0xe'),_0x214c('0xf')];exports['exec']=function(_0x42ba71,_0x3cbdbd,_0x19b530,_0x508162,_0x1ac171,_0x3b9239){if(_0x19b530){if(_[_0x214c('0x10')](integrations,_0x42ba71[_0x214c('0x11')]['toLowerCase']())){try{var _0x3fb730=null;var _0xb7c799='';var _0x30750e=_0x19b530[_0x42ba71[_0x214c('0x11')][_0x214c('0x12')]()];if(_0x30750e){var _0x14f7d9=_0x30750e[_0x42ba71[_0x214c('0x13')]];if(_0x14f7d9){var _0x4f2690=_[_0x214c('0x14')](_0x14f7d9[_0x214c('0x15')],{'id':parseInt(_0x42ba71[_0x214c('0x16')],0xa)});if(_0x4f2690){if(_0x508162){if(_0x1ac171&&_0x3cbdbd[_0x214c('0x17')]){_0xb7c799=_0x214c('0x17');}else if(_0x3cbdbd[_0x214c('0x18')]){_0xb7c799=_0x214c('0x19');}else{console[_0x214c('0x1a')](_0x214c('0x1b'),_0x3cbdbd);}}else{_0xb7c799='unmanaged';}switch(_0x42ba71[_0x214c('0x11')]['toLowerCase']()){case _0x214c('0x9'):zendesk[_0xb7c799](_0x42ba71,_0x3cbdbd,_0x4f2690,_0x508162,_0x1ac171,_0x14f7d9,_0x3b9239);break;case'salesforce':salesforce[_0xb7c799](_0x42ba71,_0x3cbdbd,_0x4f2690,_0x508162,_0x1ac171,_0x14f7d9,_0x3b9239);break;case _0x214c('0xb'):sugarcrm[_0xb7c799](_0x42ba71,_0x3cbdbd,_0x4f2690,_0x508162,_0x1ac171,_0x14f7d9,_0x3b9239);break;case _0x214c('0x1c'):freshdesk[_0xb7c799](_0x42ba71,_0x3cbdbd,_0x4f2690,_0x508162,_0x1ac171,_0x14f7d9,_0x3b9239);break;case _0x214c('0xc'):zoho[_0xb7c799](_0x42ba71,_0x3cbdbd,_0x4f2690,_0x508162,_0x1ac171,_0x14f7d9,_0x3b9239);break;case _0x214c('0xd'):desk[_0xb7c799](_0x42ba71,_0x3cbdbd,_0x4f2690,_0x508162,_0x1ac171,_0x14f7d9,_0x3b9239);break;case _0x214c('0x1d'):vtiger[_0xb7c799](_0x42ba71,_0x3cbdbd,_0x4f2690,_0x508162,_0x1ac171,_0x14f7d9,_0x3b9239);break;case _0x214c('0xe'):freshsales['cs'](_0x42ba71,_0x3cbdbd,_0x4f2690,_0x508162,_0x1ac171,_0x14f7d9,_0x3b9239,_0xb7c799);break;case _0x214c('0xf'):servicenow['cs'](_0x42ba71,_0x3cbdbd,_0x4f2690,_0x508162,_0x1ac171,_0x14f7d9,_0x3b9239,_0xb7c799);break;case _0x214c('0x1e'):dynamics365['cs'](_0x42ba71,_0x3cbdbd,_0x4f2690,_0x508162,_0x1ac171,_0x14f7d9,_0x3b9239,_0xb7c799);break;default:console[_0x214c('0x1a')](_0x214c('0x1f'));}}else{_0x3fb730=require(_0x214c('0x20'))(_0x42ba71[_0x214c('0x11')][_0x214c('0x12')]());_0x3fb730[_0x214c('0x21')]('[EXEC]',util[_0x214c('0x22')](_0x214c('0x23'),_0x42ba71[_0x214c('0x11')][_0x214c('0x12')](),_0x42ba71[_0x214c('0x16')]));}}else{_0x3fb730=require(_0x214c('0x20'))(_0x42ba71['data1'][_0x214c('0x12')]());_0x3fb730['error']('[EXEC]',util['format']('%s\x20account\x20#%s\x20not\x20found',_0x42ba71[_0x214c('0x11')][_0x214c('0x12')](),_0x42ba71[_0x214c('0x13')]));}}else{}}catch(_0x4d3ce2){console[_0x214c('0x21')](_0x4d3ce2);}}}}; \ 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 6981d1f..6e3374e 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 _0xa710=['ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','WhatId','Case','ContactId','account','AccountId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','Agent\x20%s\x20found.','identity','resolve','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','additionalSearchContact','merge','Contact','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','$or','Account','length','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','Company','Name','forEach','includes','picklist','idField','toString','variableName','Variable','name','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','outbound','recordingFormat','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','calleridnum','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','catch','moment','bluebird','md5','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task'];(function(_0x4a9efc,_0x26a292){var _0xc4665b=function(_0x2d8e27){while(--_0x2d8e27){_0x4a9efc['push'](_0x4a9efc['shift']());}};_0xc4665b(++_0x26a292);}(_0xa710,0x158));var _0x0a71=function(_0x38569a,_0x1279f2){_0x38569a=_0x38569a-0x0;var _0x5aa538=_0xa710[_0x38569a];return _0x5aa538;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x0a71('0x0'));var BPromise=require(_0x0a71('0x1'));var md5=require(_0x0a71('0x2'));var jsforce=require('jsforce');var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x0a71('0x3'));var logger=require(_0x0a71('0x4'))(_0x0a71('0x5'));config[_0x0a71('0x6')]=_[_0x0a71('0x7')](config[_0x0a71('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x0a71('0x8'))(new Redis(config['redis']));function emit(_0x328f9d,_0x513064,_0x5135ce){io['to'](_0x328f9d)[_0x0a71('0x9')](_0x513064,_0x5135ce);}function getTicket(_0x1026a2,_0x2c96f8,_0x430642,_0x5f0ef8,_0x19eab4,_0x45aed9,_0xb13eec,_0x38ee10){var _0x246fe1=Object[_0x0a71('0xa')]({},{'OwnerId':_0x2c96f8['id'],'Subject':intUtil[_0x0a71('0xb')](_0x5f0ef8[_0x0a71('0xc')],_0x19eab4,'\x20'),'Description':intUtil['getString'](_0x5f0ef8[_0x0a71('0xd')],_0x19eab4,'\x0a')},getCustomFields(_0x45aed9,_0x19eab4));if(_0x430642){if(_0x5f0ef8[_0x0a71('0xe')]===_0x0a71('0xf')){_0x246fe1[_0x0a71('0x10')]=moment[_0x0a71('0x11')]();_0x246fe1[_0x0a71('0x12')]=![];_0x246fe1[_0x0a71('0x13')]=![];if(_0x430642[_0x0a71('0x14')]===_0x0a71('0x15')||_0x430642[_0x0a71('0x14')]===_0x0a71('0x16')){_0x246fe1[_0x0a71('0x17')]=_0x430642['id'];}else if(_0x430642['endUserType']==='account'){_0x246fe1[_0x0a71('0x18')]=_0x430642['id'];}}else if(_0x5f0ef8[_0x0a71('0xe')]===_0x0a71('0x19')){if(_0x430642[_0x0a71('0x14')]==='contact'){_0x246fe1[_0x0a71('0x1a')]=_0x430642['id'];}else if(_0x430642[_0x0a71('0x14')]===_0x0a71('0x1b')){_0x246fe1[_0x0a71('0x1c')]=_0x430642['id'];}else if(_0x430642[_0x0a71('0x14')]===_0x0a71('0x16')&&_0x5f0ef8['leadId']){_0x246fe1[_0x5f0ef8['leadId']]=_0x430642['id'];}else{logger[_0x0a71('0x1d')](_0x0a71('0x1e'));}}}return _0xb13eec[_0x0a71('0x1f')](_0x5f0ef8[_0x0a71('0xe')])[_0x0a71('0x20')](_0x246fe1);}function getUser(_0x578991,_0x50a543,_0x3b55c0){if(!_[_0x0a71('0x21')](_0x50a543)&&intUtil[_0x0a71('0x22')](_0x50a543)){var _0x47de63={'Email':_0x50a543};var _0x4877f9={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3b55c0[_0x0a71('0x1f')](_0x0a71('0x23'))[_0x0a71('0x24')](_0x47de63,_0x4877f9)[_0x0a71('0x25')]()['then'](function(_0x4bc421){if(_0x4bc421['length']){var _0x34af18=_['find'](_0x4bc421,function(_0x5c1e64){return _0x5c1e64['Email']===_0x50a543;});if(_0x34af18){logger['info'](_0x0a71('0x26'),_0x50a543);return BPromise['resolve']({'id':_0x34af18['Id'],'name':_0x34af18['Name']});}}else{logger[_0x0a71('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x50a543);return _0x3b55c0[_0x0a71('0x27')]()['then'](function(_0x1f4e88){return BPromise[_0x0a71('0x28')]({'id':_0x1f4e88['user_id'],'name':_0x1f4e88[_0x0a71('0x29')]});});}});}else{logger[_0x0a71('0x1d')](_0x0a71('0x2a'),_0x50a543);return _0x3b55c0[_0x0a71('0x27')]()[_0x0a71('0x2b')](function(_0x11dfd2){return BPromise[_0x0a71('0x28')]({'id':_0x11dfd2[_0x0a71('0x2c')],'name':_0x11dfd2[_0x0a71('0x29')]});});}}function getEndUser(_0x5d8f27,_0xcaded7,_0x1ee1fb,_0x2dd64f,_0x59d7cb){var _0x1b5dce={'$or':{'Phone':_0x2dd64f}};var _0x30310e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x0a71('0x28')]()[_0x0a71('0x2b')](function(){logger[_0x0a71('0x1d')](_0x0a71('0x2d'),_0x2dd64f,_0xcaded7[_0x0a71('0x2e')]);switch(_0xcaded7[_0x0a71('0x2e')]){case'contact_lead':var _0x292bdb=_['cloneDeep'](_0x1b5dce);if(_0xcaded7[_0x0a71('0x2f')]){var _0x7a06c3={};_0x7a06c3[_0xcaded7[_0x0a71('0x2f')]]=_0x2dd64f;_[_0x0a71('0x30')](_0x292bdb['$or'],_0x7a06c3);}return _0x59d7cb[_0x0a71('0x1f')](_0x0a71('0x31'))['find'](_0x292bdb,_0x30310e)[_0x0a71('0x25')]()[_0x0a71('0x2b')](function(_0x272580){if(_0x272580&&_0x272580['length']){return _0x272580;}else{var _0x5203f9=_[_0x0a71('0x32')](_0x1b5dce);if(_0xcaded7[_0x0a71('0x33')]){var _0x471c8d={};_0x471c8d[_0xcaded7['additionalSearchLead']]=_0x2dd64f;_[_0x0a71('0x30')](_0x5203f9['$or'],_0x471c8d);}return _0x59d7cb[_0x0a71('0x1f')](_0x0a71('0x34'))['find'](_0x5203f9,_0x30310e);}});case _0x0a71('0x35'):var _0x1aa150=_[_0x0a71('0x32')](_0x1b5dce);if(_0xcaded7[_0x0a71('0x36')]){var _0x7a06c3={};_0x7a06c3[_0xcaded7[_0x0a71('0x36')]]=_0x2dd64f;_[_0x0a71('0x30')](_0x1aa150[_0x0a71('0x37')],_0x7a06c3);}return _0x59d7cb['sobject'](_0x0a71('0x38'))['find'](_0x1aa150,_0x30310e)[_0x0a71('0x25')]()[_0x0a71('0x2b')](function(_0x5bfbfc){if(_0x5bfbfc&&_0x5bfbfc[_0x0a71('0x39')]){return _0x5bfbfc;}else{var _0x34ba7b=_['cloneDeep'](_0x1b5dce);if(_0xcaded7[_0x0a71('0x2f')]){var _0x17c2aa={};_0x17c2aa[_0xcaded7[_0x0a71('0x2f')]]=_0x2dd64f;_['merge'](_0x34ba7b[_0x0a71('0x37')],_0x17c2aa);}return _0x59d7cb[_0x0a71('0x1f')]('Contact')[_0x0a71('0x24')](_0x34ba7b,_0x30310e)[_0x0a71('0x2b')](function(_0x3a4d5f){if(_0x3a4d5f&&_0x3a4d5f['length']){return _0x3a4d5f;}else{var _0x30d510=_['cloneDeep'](_0x1b5dce);if(_0xcaded7[_0x0a71('0x33')]){var _0x3bc07f={};_0x3bc07f[_0xcaded7[_0x0a71('0x33')]]=_0x2dd64f;_[_0x0a71('0x30')](_0x30d510[_0x0a71('0x37')],_0x3bc07f);}return _0x59d7cb[_0x0a71('0x1f')](_0x0a71('0x34'))[_0x0a71('0x24')](_0x30d510,_0x30310e);}});}});case _0x0a71('0x15'):var _0x292bdb=_[_0x0a71('0x32')](_0x1b5dce);if(_0xcaded7[_0x0a71('0x2f')]){var _0x7a06c3={};_0x7a06c3[_0xcaded7[_0x0a71('0x2f')]]=_0x2dd64f;_[_0x0a71('0x30')](_0x292bdb[_0x0a71('0x37')],_0x7a06c3);}return _0x59d7cb['sobject']('Contact')[_0x0a71('0x24')](_0x292bdb,_0x30310e)['execute']();case _0x0a71('0x16'):var _0x405b73=_[_0x0a71('0x32')](_0x1b5dce);if(_0xcaded7[_0x0a71('0x33')]){var _0x7a06c3={};_0x7a06c3[_0xcaded7[_0x0a71('0x33')]]=_0x2dd64f;_[_0x0a71('0x30')](_0x405b73[_0x0a71('0x37')],_0x7a06c3);}return _0x59d7cb[_0x0a71('0x1f')](_0x0a71('0x34'))[_0x0a71('0x24')](_0x405b73,_0x30310e);case _0x0a71('0x1b'):var _0x1aa150=_[_0x0a71('0x32')](_0x1b5dce);if(_0xcaded7['additionalSearchAccount']){var _0x7a06c3={};_0x7a06c3[_0xcaded7[_0x0a71('0x36')]]=_0x2dd64f;_[_0x0a71('0x30')](_0x1aa150[_0x0a71('0x37')],_0x7a06c3);}return _0x59d7cb['sobject'](_0x0a71('0x38'))[_0x0a71('0x24')](_0x1aa150,_0x30310e);default:return null;}})[_0x0a71('0x2b')](function(_0x108794){if(_0x108794&&_0x108794[_0x0a71('0x39')]){var _0x2bacbf=_['first'](_0x108794);if(_0x2bacbf){return BPromise['resolve']({'id':_0x2bacbf['Id'],'name':_0x2bacbf['Name'],'phone':_0x2bacbf[_0x0a71('0x3a')],'endUserType':_0x2bacbf[_0x0a71('0x3b')][_0x0a71('0x3c')][_0x0a71('0x3d')]()});}}})['then'](function(_0x1b754a){if(_0x1b754a){logger[_0x0a71('0x1d')](_0x0a71('0x3e'),_0x1b754a[_0x0a71('0x14')],_0x2dd64f);return BPromise[_0x0a71('0x28')](_0x1b754a);}else{logger[_0x0a71('0x1d')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x2dd64f);var _0x153ca1={'Phone':_0x2dd64f};if(_0xcaded7[_0x0a71('0x3f')]){if(_0xcaded7['moduleCreate']===_0x0a71('0x15')){logger[_0x0a71('0x1d')](_0x0a71('0x40'),_0x2dd64f,_0xcaded7[_0x0a71('0x3f')]);_0x153ca1['LastName']=_0x1ee1fb!==_0x0a71('0x41')?_0x1ee1fb:util[_0x0a71('0x42')](_0x0a71('0x43'),_0x2dd64f);}else if(_0xcaded7['moduleCreate']===_0x0a71('0x16')){logger[_0x0a71('0x1d')](_0x0a71('0x40'),_0x2dd64f,_0xcaded7[_0x0a71('0x3f')]);_0x153ca1['LastName']=_0x1ee1fb!==_0x0a71('0x41')?_0x1ee1fb:util['format'](_0x0a71('0x43'),_0x2dd64f);_0x153ca1[_0x0a71('0x44')]='No\x20Company';}else if(_0xcaded7[_0x0a71('0x3f')]===_0x0a71('0x1b')){logger['info'](_0x0a71('0x40'),_0x2dd64f,_0xcaded7[_0x0a71('0x3f')]);_0x153ca1[_0x0a71('0x45')]=_0x1ee1fb!==_0x0a71('0x41')?_0x1ee1fb:util['format'](_0x0a71('0x43'),_0x2dd64f);}else{return null;}}return _0x59d7cb[_0x0a71('0x1f')](_['upperFirst'](_0xcaded7['moduleCreate']))[_0x0a71('0x20')](_0x153ca1)[_0x0a71('0x2b')](function(_0x13cbc6){return BPromise[_0x0a71('0x28')]({'id':_0x13cbc6['id'],'endUserType':_0xcaded7[_0x0a71('0x3f')]});});}});}function getCustomFields(_0x2d57fc,_0x35fecd){var _0x1dea6b={};if(_0x2d57fc['length']>0x0){_[_0x0a71('0x46')](_0x2d57fc,function(_0x16d55c){if(_[_0x0a71('0x47')](['string',_0x0a71('0x48')],_0x16d55c['type'])&&_0x16d55c[_0x0a71('0x49')]){_0x1dea6b[_0x16d55c['idField']]=_0x16d55c['content'][_0x0a71('0x4a')]();}else if(_0x16d55c[_0x0a71('0x3c')]==='variable'&&_0x16d55c['variableName']&&_0x16d55c['idField']){_0x35fecd[_0x16d55c[_0x0a71('0x4b')]]&&(_0x1dea6b[_0x16d55c[_0x0a71('0x49')]]=_0x35fecd[_0x16d55c[_0x0a71('0x4b')]][_0x0a71('0x4a')]());}else if(_0x16d55c[_0x0a71('0x3c')]==='customVariable'&&_0x16d55c[_0x0a71('0x4c')]&&_0x16d55c['Variable'][_0x0a71('0x4d')]&&_0x16d55c[_0x0a71('0x49')]){_0x35fecd[_0x16d55c['Variable'][_0x0a71('0x4d')][_0x0a71('0x3d')]()]&&(_0x1dea6b[_0x16d55c['idField']]=_0x35fecd[_0x16d55c[_0x0a71('0x4c')][_0x0a71('0x4d')][_0x0a71('0x3d')]()][_0x0a71('0x4a')]());}});}return _0x1dea6b;}function getConnection(_0x640457){var _0x12854a=_0x640457['password']['concat'](_0x640457[_0x0a71('0x4e')]);var _0x1fd42a=new jsforce[(_0x0a71('0x4f'))]({'oauth2':{'loginUrl':_0x640457[_0x0a71('0x50')]||_0x0a71('0x51'),'clientId':_0x640457['clientId'],'clientSecret':_0x640457[_0x0a71('0x52')]}});return _0x1fd42a[_0x0a71('0x53')](_0x640457['username'],_0x12854a)[_0x0a71('0x2b')](function(){logger[_0x0a71('0x1d')](_0x0a71('0x54'));return _0x1fd42a;});}exports[_0x0a71('0x55')]=function(_0x143d5c,_0x302945,_0x3168e1,_0x2d18c5,_0x5be7a0,_0x3c42e7){var _0xa089fa,_0x52224f,_0x359df1,_0x1d95d8;_0x3c42e7['serverUrl']=intUtil['stripTrailingSlash'](_0x3c42e7[_0x0a71('0x56')]);_0x3c42e7['remoteUri']=intUtil[_0x0a71('0x57')](_0x3c42e7[_0x0a71('0x50')]);if(_0x5be7a0&&_0x5be7a0[_0x0a71('0x58')]){logger['info'](_0x0a71('0x59'),_0x0a71('0x5a'));_0x302945[_0x0a71('0x5b')]=util[_0x0a71('0x42')](_0x0a71('0x5c'),_0x3c42e7[_0x0a71('0x56')],_0x302945[_0x0a71('0x5d')],md5(_0x302945[_0x0a71('0x5d')]));}else{_0x302945[_0x0a71('0x5b')]='';}return getConnection(_0x3c42e7)[_0x0a71('0x2b')](function(_0x97f035){_0x1d95d8=_0x97f035;return getUser(_0x3c42e7,_0x2d18c5[_0x0a71('0x5e')],_0x1d95d8);})['then'](function(_0x240315){_0xa089fa=_0x240315;return getEndUser(_0x3c42e7,_0x3168e1,_0x302945[_0x0a71('0x5f')],_0x302945['calleridnum'],_0x1d95d8);})['then'](function(_0x433dd3){_0x52224f=_0x433dd3;return getTicket(_0x3c42e7,_0xa089fa,_0x52224f,_0x3168e1,_0x302945,_0x3168e1[_0x0a71('0x60')],_0x1d95d8,'queue');})[_0x0a71('0x2b')](function(_0x4745ce){_0x359df1=_0x4745ce;logger['info'](_0x0a71('0x61'),_0x359df1['id']);logger[_0x0a71('0x1d')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x359df1['id'],_0x2d18c5['name'],_0x3c42e7[_0x0a71('0x3c')]);switch(_0x3c42e7[_0x0a71('0x3c')]){case'integrationTab':emit(util[_0x0a71('0x42')](_0x0a71('0x62'),_0x2d18c5[_0x0a71('0x4d')]),_0x0a71('0x63'),{'recordId':_0x359df1['id']});break;case _0x0a71('0x64'):emit(util[_0x0a71('0x42')](_0x0a71('0x62'),_0x2d18c5['name']),_0x0a71('0x65'),{'uri':util[_0x0a71('0x42')](_0x0a71('0x66'),_0x1d95d8[_0x0a71('0x67')],_0x359df1['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x2e26b3){logger[_0x0a71('0x68')](_0x0a71('0x59'),_0x2e26b3);});};exports[_0x0a71('0x69')]=function(_0x2dfcbb,_0x10b709,_0xe7fea4,_0x255706,_0x5bbf7e,_0x50d68a,_0xc8883d){var _0x31d962,_0x4854d1,_0x1f65d5,_0x2f06ae;_0x50d68a['serverUrl']=intUtil['stripTrailingSlash'](_0x50d68a['serverUrl']);_0x50d68a[_0x0a71('0x50')]=intUtil[_0x0a71('0x57')](_0x50d68a['remoteUri']);if(_0xc8883d&&_0xc8883d[_0x0a71('0x6a')]&&_0xc8883d['recordingFormat']!=='none'){logger[_0x0a71('0x1d')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x10b709[_0x0a71('0x5b')]=util[_0x0a71('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x50d68a[_0x0a71('0x56')],_0x10b709[_0x0a71('0x5d')],md5(_0x10b709[_0x0a71('0x5d')]));}return getConnection(_0x50d68a)['then'](function(_0x4c9229){_0x2f06ae=_0x4c9229;return getUser(_0x50d68a,_0x255706[_0x0a71('0x5e')],_0x2f06ae);})[_0x0a71('0x2b')](function(_0x290d8e){_0x31d962=_0x290d8e;return getEndUser(_0x50d68a,_0xe7fea4,_0x10b709['destcalleridname'],_0x10b709[_0x0a71('0x6b')],_0x2f06ae);})[_0x0a71('0x2b')](function(_0x43836d){_0x4854d1=_0x43836d;return getTicket(_0x50d68a,_0x31d962,_0x4854d1,_0xe7fea4,_0x10b709,_0xe7fea4[_0x0a71('0x60')],_0x2f06ae,_0x0a71('0x69'));})[_0x0a71('0x2b')](function(_0x17f332){_0x1f65d5=_0x17f332;logger[_0x0a71('0x1d')](_0x0a71('0x6c'),_0x1f65d5['id']);logger[_0x0a71('0x1d')](_0x0a71('0x6d'),_0x1f65d5['id'],_0x255706[_0x0a71('0x4d')],_0x50d68a['type']);switch(_0x50d68a[_0x0a71('0x3c')]){case _0x0a71('0x6e'):emit(util[_0x0a71('0x42')](_0x0a71('0x62'),_0x255706[_0x0a71('0x4d')]),_0x0a71('0x63'),{'recordId':_0x1f65d5['id']});break;case'newTab':emit(util[_0x0a71('0x42')]('user:%s',_0x255706['name']),_0x0a71('0x65'),{'uri':util[_0x0a71('0x42')](_0x0a71('0x66'),_0x2f06ae[_0x0a71('0x67')],_0x1f65d5['id'])});break;default:logger['error'](_0x0a71('0x6f'),_0x0a71('0x70'));}})['catch'](function(_0x58f215){logger[_0x0a71('0x68')](_0x0a71('0x6f'),_0x58f215);});};exports[_0x0a71('0x71')]=function(_0x5edf2a,_0x43aac6,_0x22e725,_0x216bdd,_0x48f56f,_0x241a16){var _0x71e876,_0x4d1ddd,_0x1311d3,_0x2d56c8;_0x241a16[_0x0a71('0x56')]=intUtil[_0x0a71('0x57')](_0x241a16[_0x0a71('0x56')]);_0x241a16[_0x0a71('0x50')]=intUtil[_0x0a71('0x57')](_0x241a16[_0x0a71('0x50')]);if(_0x48f56f&&_0x48f56f[_0x0a71('0x58')]){logger[_0x0a71('0x1d')]('['+_0x43aac6['lastevent'][_0x0a71('0x72')]()+']',_0x0a71('0x5a'));_0x43aac6[_0x0a71('0x5b')]=util[_0x0a71('0x42')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x241a16[_0x0a71('0x56')],_0x43aac6[_0x0a71('0x5d')],md5(_0x43aac6[_0x0a71('0x5d')]));}else{_0x43aac6[_0x0a71('0x5b')]='';}return getConnection(_0x241a16)['then'](function(_0x4eaaa2){_0x2d56c8=_0x4eaaa2;if(!_[_0x0a71('0x21')](_0x216bdd)){return getUser(_0x241a16,_0x216bdd[_0x0a71('0x4d')],_0x2d56c8);}else{return getUser(_0x241a16,null,_0x2d56c8);}})[_0x0a71('0x2b')](function(_0x2aebf8){_0x71e876=_0x2aebf8;return getEndUser(_0x241a16,_0x22e725,_0x43aac6[_0x0a71('0x5f')],_0x43aac6[_0x0a71('0x73')],_0x2d56c8);})[_0x0a71('0x2b')](function(_0x469571){_0x4d1ddd=_0x469571;return getTicket(_0x241a16,_0x71e876,_0x4d1ddd,_0x22e725,_0x43aac6,_0x22e725[_0x0a71('0x60')],_0x2d56c8);})[_0x0a71('0x2b')](function(_0x23107b){_0x1311d3=_0x23107b;logger[_0x0a71('0x1d')]('['+_0x43aac6[_0x0a71('0x74')]['toUpperCase']()+_0x0a71('0x75'),_0x1311d3['id']);logger[_0x0a71('0x1d')]('['+_0x43aac6[_0x0a71('0x74')][_0x0a71('0x72')]()+_0x0a71('0x76'),_0x241a16[_0x0a71('0x3c')]);})[_0x0a71('0x77')](function(_0xbe955){logger[_0x0a71('0x68')]('['+_0x43aac6[_0x0a71('0x74')][_0x0a71('0x72')]()+']',_0xbe955);});}; \ No newline at end of file +var _0x0644=['clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','serverUrl','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','ticketType','utc','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','account','WhatId','Case','ContactId','lead','leadId','info','sobject','create','isNil','validateEmail','find','execute','length','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','cloneDeep','first','resolve','Phone','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Company','No\x20Company','forEach','includes','string','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','remoteUri','https://login.salesforce.com'];(function(_0x183dac,_0x26c0d8){var _0x5d1f0d=function(_0x1cc4c8){while(--_0x1cc4c8){_0x183dac['push'](_0x183dac['shift']());}};_0x5d1f0d(++_0x26c0d8);}(_0x0644,0x1b6));var _0x4064=function(_0x130acd,_0x5893da){_0x130acd=_0x130acd-0x0;var _0x39b907=_0x0644[_0x130acd];return _0x39b907;};'use strict';var _=require(_0x4064('0x0'));var rp=require('request-promise');var moment=require(_0x4064('0x1'));var BPromise=require(_0x4064('0x2'));var md5=require(_0x4064('0x3'));var jsforce=require(_0x4064('0x4'));var util=require(_0x4064('0x5'));var Redis=require(_0x4064('0x6'));var intUtil=require(_0x4064('0x7'));var config=require('../../../../config/environment');var logger=require(_0x4064('0x8'))(_0x4064('0x9'));config[_0x4064('0xa')]=_[_0x4064('0xb')](config[_0x4064('0xa')],{'host':_0x4064('0xc'),'port':0x18eb});var io=require(_0x4064('0xd'))(new Redis(config[_0x4064('0xa')]));function emit(_0xf2c19c,_0x2f50ee,_0x3b7907){io['to'](_0xf2c19c)[_0x4064('0xe')](_0x2f50ee,_0x3b7907);}function getTicket(_0x409597,_0x1e57f7,_0x5a5dae,_0x5aa21a,_0x2ce618,_0x4f75cf,_0x32e6d1,_0x153605){var _0x4d55a6=Object[_0x4064('0xf')]({},{'OwnerId':_0x1e57f7['id'],'Subject':intUtil[_0x4064('0x10')](_0x5aa21a[_0x4064('0x11')],_0x2ce618,'\x20'),'Description':intUtil['getString'](_0x5aa21a['Descriptions'],_0x2ce618,'\x0a')},getCustomFields(_0x4f75cf,_0x2ce618));if(_0x5a5dae){if(_0x5aa21a[_0x4064('0x12')]==='Task'){_0x4d55a6['ActivityDate']=moment[_0x4064('0x13')]();_0x4d55a6[_0x4064('0x14')]=![];_0x4d55a6[_0x4064('0x15')]=![];if(_0x5a5dae[_0x4064('0x16')]===_0x4064('0x17')||_0x5a5dae['endUserType']==='lead'){_0x4d55a6[_0x4064('0x18')]=_0x5a5dae['id'];}else if(_0x5a5dae[_0x4064('0x16')]===_0x4064('0x19')){_0x4d55a6[_0x4064('0x1a')]=_0x5a5dae['id'];}}else if(_0x5aa21a[_0x4064('0x12')]===_0x4064('0x1b')){if(_0x5a5dae[_0x4064('0x16')]==='contact'){_0x4d55a6[_0x4064('0x1c')]=_0x5a5dae['id'];}else if(_0x5a5dae[_0x4064('0x16')]===_0x4064('0x19')){_0x4d55a6['AccountId']=_0x5a5dae['id'];}else if(_0x5a5dae['endUserType']===_0x4064('0x1d')&&_0x5aa21a[_0x4064('0x1e')]){_0x4d55a6[_0x5aa21a[_0x4064('0x1e')]]=_0x5a5dae['id'];}else{logger[_0x4064('0x1f')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x32e6d1[_0x4064('0x20')](_0x5aa21a[_0x4064('0x12')])[_0x4064('0x21')](_0x4d55a6);}function getUser(_0x5226f3,_0x4a86d7,_0x494926){if(!_[_0x4064('0x22')](_0x4a86d7)&&intUtil[_0x4064('0x23')](_0x4a86d7)){var _0x332dfc={'Email':_0x4a86d7};var _0x5707fc={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x494926[_0x4064('0x20')]('User')[_0x4064('0x24')](_0x332dfc,_0x5707fc)[_0x4064('0x25')]()['then'](function(_0x5b48cd){if(_0x5b48cd[_0x4064('0x26')]){var _0x3633bf=_[_0x4064('0x24')](_0x5b48cd,function(_0x3a284f){return _0x3a284f['Email']===_0x4a86d7;});if(_0x3633bf){logger['info'](_0x4064('0x27'),_0x4a86d7);return BPromise['resolve']({'id':_0x3633bf['Id'],'name':_0x3633bf[_0x4064('0x28')]});}}else{logger[_0x4064('0x1f')](_0x4064('0x29'),_0x4a86d7);return _0x494926[_0x4064('0x2a')]()[_0x4064('0x2b')](function(_0x435096){return BPromise['resolve']({'id':_0x435096[_0x4064('0x2c')],'name':_0x435096[_0x4064('0x2d')]});});}});}else{logger['info'](_0x4064('0x29'),_0x4a86d7);return _0x494926[_0x4064('0x2a')]()[_0x4064('0x2b')](function(_0x42f22b){return BPromise['resolve']({'id':_0x42f22b[_0x4064('0x2c')],'name':_0x42f22b[_0x4064('0x2d')]});});}}function getEndUser(_0x24d7b0,_0x33cb92,_0x13137c,_0x57ab64,_0x22898b){var _0x21cca5={'$or':{'Phone':_0x57ab64}};var _0x4500f3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger['info'](_0x4064('0x2e'),_0x57ab64,_0x33cb92[_0x4064('0x2f')]);switch(_0x33cb92[_0x4064('0x2f')]){case _0x4064('0x30'):var _0x299c98=_['cloneDeep'](_0x21cca5);if(_0x33cb92['additionalSearchContact']){var _0x1f8483={};_0x1f8483[_0x33cb92[_0x4064('0x31')]]=_0x57ab64;_[_0x4064('0x32')](_0x299c98[_0x4064('0x33')],_0x1f8483);}return _0x22898b[_0x4064('0x20')](_0x4064('0x34'))['find'](_0x299c98,_0x4500f3)[_0x4064('0x25')]()['then'](function(_0x3e3616){if(_0x3e3616&&_0x3e3616['length']){return _0x3e3616;}else{var _0x430591=_['cloneDeep'](_0x21cca5);if(_0x33cb92[_0x4064('0x35')]){var _0x2e29b6={};_0x2e29b6[_0x33cb92['additionalSearchLead']]=_0x57ab64;_[_0x4064('0x32')](_0x430591['$or'],_0x2e29b6);}return _0x22898b[_0x4064('0x20')](_0x4064('0x36'))['find'](_0x430591,_0x4500f3);}});case _0x4064('0x37'):var _0x346a2c=_['cloneDeep'](_0x21cca5);if(_0x33cb92[_0x4064('0x38')]){var _0x1f8483={};_0x1f8483[_0x33cb92[_0x4064('0x38')]]=_0x57ab64;_[_0x4064('0x32')](_0x346a2c[_0x4064('0x33')],_0x1f8483);}return _0x22898b[_0x4064('0x20')](_0x4064('0x39'))[_0x4064('0x24')](_0x346a2c,_0x4500f3)[_0x4064('0x25')]()[_0x4064('0x2b')](function(_0x14bd8e){if(_0x14bd8e&&_0x14bd8e[_0x4064('0x26')]){return _0x14bd8e;}else{var _0x23a9a3=_[_0x4064('0x3a')](_0x21cca5);if(_0x33cb92['additionalSearchContact']){var _0x1a8330={};_0x1a8330[_0x33cb92[_0x4064('0x31')]]=_0x57ab64;_[_0x4064('0x32')](_0x23a9a3[_0x4064('0x33')],_0x1a8330);}return _0x22898b[_0x4064('0x20')]('Contact')[_0x4064('0x24')](_0x23a9a3,_0x4500f3)[_0x4064('0x2b')](function(_0x4a33b7){if(_0x4a33b7&&_0x4a33b7['length']){return _0x4a33b7;}else{var _0x24778f=_[_0x4064('0x3a')](_0x21cca5);if(_0x33cb92['additionalSearchLead']){var _0x1ccb0a={};_0x1ccb0a[_0x33cb92[_0x4064('0x35')]]=_0x57ab64;_[_0x4064('0x32')](_0x24778f[_0x4064('0x33')],_0x1ccb0a);}return _0x22898b['sobject'](_0x4064('0x36'))[_0x4064('0x24')](_0x24778f,_0x4500f3);}});}});case _0x4064('0x17'):var _0x299c98=_[_0x4064('0x3a')](_0x21cca5);if(_0x33cb92[_0x4064('0x31')]){var _0x1f8483={};_0x1f8483[_0x33cb92['additionalSearchContact']]=_0x57ab64;_[_0x4064('0x32')](_0x299c98['$or'],_0x1f8483);}return _0x22898b[_0x4064('0x20')](_0x4064('0x34'))[_0x4064('0x24')](_0x299c98,_0x4500f3)['execute']();case _0x4064('0x1d'):var _0xc1914b=_[_0x4064('0x3a')](_0x21cca5);if(_0x33cb92[_0x4064('0x35')]){var _0x1f8483={};_0x1f8483[_0x33cb92['additionalSearchLead']]=_0x57ab64;_['merge'](_0xc1914b[_0x4064('0x33')],_0x1f8483);}return _0x22898b['sobject'](_0x4064('0x36'))['find'](_0xc1914b,_0x4500f3);case'account':var _0x346a2c=_[_0x4064('0x3a')](_0x21cca5);if(_0x33cb92[_0x4064('0x38')]){var _0x1f8483={};_0x1f8483[_0x33cb92[_0x4064('0x38')]]=_0x57ab64;_[_0x4064('0x32')](_0x346a2c[_0x4064('0x33')],_0x1f8483);}return _0x22898b[_0x4064('0x20')]('Account')[_0x4064('0x24')](_0x346a2c,_0x4500f3);default:return null;}})[_0x4064('0x2b')](function(_0x389eb3){if(_0x389eb3&&_0x389eb3[_0x4064('0x26')]){var _0x4f9e52=_[_0x4064('0x3b')](_0x389eb3);if(_0x4f9e52){return BPromise[_0x4064('0x3c')]({'id':_0x4f9e52['Id'],'name':_0x4f9e52['Name'],'phone':_0x4f9e52[_0x4064('0x3d')],'endUserType':_0x4f9e52['attributes']['type']['toLowerCase']()});}}})['then'](function(_0x258278){if(_0x258278){logger[_0x4064('0x1f')](_0x4064('0x3e'),_0x258278['endUserType'],_0x57ab64);return BPromise[_0x4064('0x3c')](_0x258278);}else{logger[_0x4064('0x1f')](_0x4064('0x3f'),_0x57ab64);var _0x384cc0={'Phone':_0x57ab64};if(_0x33cb92[_0x4064('0x40')]){if(_0x33cb92[_0x4064('0x40')]==='contact'){logger[_0x4064('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x57ab64,_0x33cb92[_0x4064('0x40')]);_0x384cc0[_0x4064('0x41')]=_0x13137c!==''?_0x13137c:util['format'](_0x4064('0x42'),_0x57ab64);}else if(_0x33cb92[_0x4064('0x40')]===_0x4064('0x1d')){logger[_0x4064('0x1f')](_0x4064('0x43'),_0x57ab64,_0x33cb92[_0x4064('0x40')]);_0x384cc0['LastName']=_0x13137c!==_0x4064('0x44')?_0x13137c:util[_0x4064('0x45')]('Caller\x20-\x20%s',_0x57ab64);_0x384cc0[_0x4064('0x46')]=_0x4064('0x47');}else if(_0x33cb92[_0x4064('0x40')]===_0x4064('0x19')){logger[_0x4064('0x1f')](_0x4064('0x43'),_0x57ab64,_0x33cb92['moduleCreate']);_0x384cc0[_0x4064('0x28')]=_0x13137c!==''?_0x13137c:util[_0x4064('0x45')](_0x4064('0x42'),_0x57ab64);}else{return null;}}return _0x22898b[_0x4064('0x20')](_['upperFirst'](_0x33cb92[_0x4064('0x40')]))[_0x4064('0x21')](_0x384cc0)[_0x4064('0x2b')](function(_0x29c6e8){return BPromise[_0x4064('0x3c')]({'id':_0x29c6e8['id'],'endUserType':_0x33cb92[_0x4064('0x40')]});});}});}function getCustomFields(_0x1064df,_0x4af7db){var _0x51618b={};if(_0x1064df['length']>0x0){_[_0x4064('0x48')](_0x1064df,function(_0x3d4923){if(_[_0x4064('0x49')]([_0x4064('0x4a'),'picklist'],_0x3d4923['type'])&&_0x3d4923[_0x4064('0x4b')]){_0x51618b[_0x3d4923[_0x4064('0x4b')]]=_0x3d4923[_0x4064('0x4c')][_0x4064('0x4d')]();}else if(_0x3d4923[_0x4064('0x4e')]===_0x4064('0x4f')&&_0x3d4923[_0x4064('0x50')]&&_0x3d4923[_0x4064('0x4b')]){_0x4af7db[_0x3d4923[_0x4064('0x50')]]&&(_0x51618b[_0x3d4923['idField']]=_0x4af7db[_0x3d4923[_0x4064('0x50')]][_0x4064('0x4d')]());}else if(_0x3d4923['type']===_0x4064('0x51')&&_0x3d4923[_0x4064('0x52')]&&_0x3d4923[_0x4064('0x52')][_0x4064('0x53')]&&_0x3d4923[_0x4064('0x4b')]){_0x4af7db[_0x3d4923[_0x4064('0x52')]['name']['toLowerCase']()]&&(_0x51618b[_0x3d4923['idField']]=_0x4af7db[_0x3d4923[_0x4064('0x52')]['name'][_0x4064('0x54')]()][_0x4064('0x4d')]());}});}return _0x51618b;}function getConnection(_0x184596){var _0x97b461=_0x184596[_0x4064('0x55')][_0x4064('0x56')](_0x184596[_0x4064('0x57')]);var _0x336ad6=new jsforce['Connection']({'oauth2':{'loginUrl':_0x184596[_0x4064('0x58')]||_0x4064('0x59'),'clientId':_0x184596[_0x4064('0x5a')],'clientSecret':_0x184596[_0x4064('0x5b')]}});return _0x336ad6[_0x4064('0x5c')](_0x184596[_0x4064('0x5d')],_0x97b461)[_0x4064('0x2b')](function(){logger[_0x4064('0x1f')](_0x4064('0x5e'));return _0x336ad6;});}exports[_0x4064('0x5f')]=function(_0x591e4c,_0xa9c8e9,_0x2524c7,_0x25292f,_0x273a31,_0x50e070){var _0x5b24da,_0x1b90d2,_0x4bf5d6,_0xc963d7;_0x50e070['serverUrl']=intUtil[_0x4064('0x60')](_0x50e070['serverUrl']);_0x50e070[_0x4064('0x58')]=intUtil[_0x4064('0x60')](_0x50e070['remoteUri']);if(_0x273a31&&_0x273a31[_0x4064('0x61')]){logger[_0x4064('0x1f')](_0x4064('0x62'),'Recording\x20is\x20enabled!');_0xa9c8e9[_0x4064('0x63')]=util[_0x4064('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x50e070['serverUrl'],_0xa9c8e9[_0x4064('0x64')],md5(_0xa9c8e9[_0x4064('0x64')]));}else{_0xa9c8e9[_0x4064('0x63')]='';}return getConnection(_0x50e070)['then'](function(_0x417bb4){_0xc963d7=_0x417bb4;return getUser(_0x50e070,_0x25292f[_0x4064('0x65')],_0xc963d7);})[_0x4064('0x2b')](function(_0x2fab22){_0x5b24da=_0x2fab22;return getEndUser(_0x50e070,_0x2524c7,_0xa9c8e9[_0x4064('0x66')],_0xa9c8e9[_0x4064('0x67')],_0xc963d7);})[_0x4064('0x2b')](function(_0x467f41){_0x1b90d2=_0x467f41;return getTicket(_0x50e070,_0x5b24da,_0x1b90d2,_0x2524c7,_0xa9c8e9,_0x2524c7[_0x4064('0x68')],_0xc963d7,_0x4064('0x5f'));})[_0x4064('0x2b')](function(_0x45386f){_0x4bf5d6=_0x45386f;logger[_0x4064('0x1f')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x4bf5d6['id']);logger[_0x4064('0x1f')](_0x4064('0x69'),_0x4bf5d6['id'],_0x25292f[_0x4064('0x53')],_0x50e070[_0x4064('0x4e')]);switch(_0x50e070[_0x4064('0x4e')]){case'integrationTab':emit(util['format'](_0x4064('0x6a'),_0x25292f[_0x4064('0x53')]),_0x4064('0x6b'),{'recordId':_0x4bf5d6['id']});break;case _0x4064('0x6c'):emit(util[_0x4064('0x45')]('user:%s',_0x25292f[_0x4064('0x53')]),_0x4064('0x6d'),{'uri':util[_0x4064('0x45')]('%s/%s/e',_0xc963d7['instanceUrl'],_0x4bf5d6['id'])});break;default:logger[_0x4064('0x6e')](_0x4064('0x6f'));}})['catch'](function(_0x55c439){logger[_0x4064('0x6e')](_0x4064('0x62'),_0x55c439);});};exports[_0x4064('0x70')]=function(_0x3b8fa6,_0x1ea47a,_0x433588,_0x98f121,_0x470de0,_0x2e4fd9,_0x4f4f3b){var _0x48305a,_0x4356f4,_0x18c2dc,_0x20ebcb;_0x2e4fd9['serverUrl']=intUtil['stripTrailingSlash'](_0x2e4fd9[_0x4064('0x71')]);_0x2e4fd9[_0x4064('0x58')]=intUtil[_0x4064('0x60')](_0x2e4fd9['remoteUri']);if(_0x4f4f3b&&_0x4f4f3b[_0x4064('0x72')]&&_0x4f4f3b[_0x4064('0x72')]!==_0x4064('0x73')){logger[_0x4064('0x1f')](_0x4064('0x74'),_0x4064('0x75'));_0x1ea47a[_0x4064('0x63')]=util[_0x4064('0x45')](_0x4064('0x76'),_0x2e4fd9[_0x4064('0x71')],_0x1ea47a[_0x4064('0x64')],md5(_0x1ea47a['uniqueid']));}return getConnection(_0x2e4fd9)[_0x4064('0x2b')](function(_0x82e9d7){_0x20ebcb=_0x82e9d7;return getUser(_0x2e4fd9,_0x98f121[_0x4064('0x65')],_0x20ebcb);})[_0x4064('0x2b')](function(_0x2b7489){_0x48305a=_0x2b7489;return getEndUser(_0x2e4fd9,_0x433588,_0x1ea47a[_0x4064('0x77')],_0x1ea47a[_0x4064('0x78')],_0x20ebcb);})[_0x4064('0x2b')](function(_0x28af65){_0x4356f4=_0x28af65;return getTicket(_0x2e4fd9,_0x48305a,_0x4356f4,_0x433588,_0x1ea47a,_0x433588['Fields'],_0x20ebcb,_0x4064('0x70'));})[_0x4064('0x2b')](function(_0x412ee1){_0x18c2dc=_0x412ee1;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x18c2dc['id']);logger['info'](_0x4064('0x79'),_0x18c2dc['id'],_0x98f121[_0x4064('0x53')],_0x2e4fd9[_0x4064('0x4e')]);switch(_0x2e4fd9[_0x4064('0x4e')]){case _0x4064('0x7a'):emit(util[_0x4064('0x45')](_0x4064('0x6a'),_0x98f121[_0x4064('0x53')]),_0x4064('0x6b'),{'recordId':_0x18c2dc['id']});break;case'newTab':emit(util[_0x4064('0x45')]('user:%s',_0x98f121[_0x4064('0x53')]),_0x4064('0x6d'),{'uri':util[_0x4064('0x45')](_0x4064('0x7b'),_0x20ebcb[_0x4064('0x7c')],_0x18c2dc['id'])});break;default:logger[_0x4064('0x6e')](_0x4064('0x74'),_0x4064('0x7d'));}})[_0x4064('0x7e')](function(_0xc05a22){logger[_0x4064('0x6e')]('[OUTBOUND]',_0xc05a22);});};exports[_0x4064('0x7f')]=function(_0x3e4c3,_0xfab477,_0x369fd4,_0x23fc08,_0x3f8d79,_0xb4bfad){var _0x25c391,_0x186e3f,_0x1b0c88,_0x314d8d;_0xb4bfad['serverUrl']=intUtil[_0x4064('0x60')](_0xb4bfad[_0x4064('0x71')]);_0xb4bfad[_0x4064('0x58')]=intUtil[_0x4064('0x60')](_0xb4bfad[_0x4064('0x58')]);if(_0x3f8d79&&_0x3f8d79[_0x4064('0x61')]){logger[_0x4064('0x1f')]('['+_0xfab477[_0x4064('0x80')][_0x4064('0x81')]()+']',_0x4064('0x75'));_0xfab477[_0x4064('0x63')]=util[_0x4064('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xb4bfad[_0x4064('0x71')],_0xfab477[_0x4064('0x64')],md5(_0xfab477['uniqueid']));}else{_0xfab477[_0x4064('0x63')]='';}return getConnection(_0xb4bfad)[_0x4064('0x2b')](function(_0x1f9bf4){_0x314d8d=_0x1f9bf4;if(!_[_0x4064('0x22')](_0x23fc08)){return getUser(_0xb4bfad,_0x23fc08['name'],_0x314d8d);}else{return getUser(_0xb4bfad,null,_0x314d8d);}})['then'](function(_0x2292aa){_0x25c391=_0x2292aa;return getEndUser(_0xb4bfad,_0x369fd4,_0xfab477['calleridname'],_0xfab477[_0x4064('0x67')],_0x314d8d);})[_0x4064('0x2b')](function(_0xc8f754){_0x186e3f=_0xc8f754;return getTicket(_0xb4bfad,_0x25c391,_0x186e3f,_0x369fd4,_0xfab477,_0x369fd4[_0x4064('0x68')],_0x314d8d);})[_0x4064('0x2b')](function(_0xcc5b04){_0x1b0c88=_0xcc5b04;logger[_0x4064('0x1f')]('['+_0xfab477[_0x4064('0x80')][_0x4064('0x81')]()+_0x4064('0x82'),_0x1b0c88['id']);logger[_0x4064('0x1f')]('['+_0xfab477[_0x4064('0x80')][_0x4064('0x81')]()+_0x4064('0x83'),_0xb4bfad[_0x4064('0x4e')]);})['catch'](function(_0x2502c0){logger[_0x4064('0x6e')]('['+_0xfab477[_0x4064('0x80')][_0x4064('0x81')]()+']',_0x2502c0);});}; \ 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 d9cff15..efbca61 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 _0xe577=['toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','],\x20getUser\x20rp\x20obj','active','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','forEach','includes','string','type','nameField','customField','toLowerCase','toString','picklist','idField','content','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','format','%s/api/now/table/','isNil','email','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe577,0x1a6));var _0x7e57=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xe577[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x7e57('0x0'));var Promise=require(_0x7e57('0x1'));var rp=require(_0x7e57('0x2'));var util=require(_0x7e57('0x3'));var md5=require(_0x7e57('0x4'));var Redis=require(_0x7e57('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x7e57('0x6'))(_0x7e57('0x7'));config[_0x7e57('0x8')]=_['defaults'](config[_0x7e57('0x8')],{'host':_0x7e57('0x9'),'port':0x18eb});var io=require(_0x7e57('0xa'))(new Redis(config['redis']));function getAdminUser(_0x299bc6,_0x292f65,_0x2a7dec,_0x22ab01,_0x1b6fea,_0x1ea338){return new Promise(function(_0x5b71c1,_0x3664ae){var _0x2f56dd={'method':'GET','uri':_0x22ab01+_0x7e57('0xb')+'&'+_0x1b6fea+'&'+_0x1ea338,'auth':_0x292f65,'json':!![]};return rp(_0x2f56dd)[_0x7e57('0xc')](function(_0x427172){if(_0x427172[_0x7e57('0xd')][_0x7e57('0xe')]>0x0){_0x2a7dec[_0x7e57('0xf')]=_0x427172['result'][0x0][_0x7e57('0x10')];}logger[_0x7e57('0x11')]('['+[_0x299bc6[_0x7e57('0x12')]()]+_0x7e57('0x13'),_0x2a7dec);_0x5b71c1(_0x2a7dec);})[_0x7e57('0x14')](function(_0x10f78c){logger[_0x7e57('0x15')]('['+[_0x299bc6[_0x7e57('0x12')]()]+']',_0x10f78c[_0x7e57('0x16')]);_0x3664ae(_0x10f78c[_0x7e57('0x16')]);});});}function getUser(_0x1a9ad1,_0x551bf5,_0x5ef4db,_0xae3c1e,_0xe66862){return function(_0x5bc9bf){logger[_0x7e57('0x11')]('['+[_0x1a9ad1[_0x7e57('0x12')]()]+_0x7e57('0x17'),_0x5bc9bf);return new Promise(function(_0x5c6130,_0xef21bf){if(intUtil[_0x7e57('0x18')](_0x5bc9bf[_0x7e57('0x19')])){var _0x2f50b5={'method':_0x7e57('0x1a'),'uri':_0x5ef4db+'sys_user?sysparm_query=email%3D'+_0x5bc9bf['userEmail']+'&'+_0xae3c1e+'&'+_0xe66862,'auth':_0x551bf5,'json':!![]};logger[_0x7e57('0x11')]('['+[_0x1a9ad1[_0x7e57('0x12')]()]+_0x7e57('0x1b'),_0x2f50b5);return rp(_0x2f50b5)[_0x7e57('0xc')](function(_0x18b027){logger[_0x7e57('0x11')]('['+[_0x1a9ad1['toUpperCase']()]+'],\x20getUser\x20entity',_0x18b027);if(_0x18b027[_0x7e57('0xd')][_0x7e57('0xe')]>0x0&&String(_0x18b027[_0x7e57('0xd')][0x0][_0x7e57('0x1c')])===_0x7e57('0x1d')){_0x5bc9bf['userId']=_0x18b027['result'][0x0][_0x7e57('0x10')];}else{_0x5bc9bf[_0x7e57('0x1e')]=_0x5bc9bf[_0x7e57('0xf')];_0x5bc9bf['userEmail']=_0x5bc9bf['adminEmail'];}logger[_0x7e57('0x11')]('['+[_0x1a9ad1[_0x7e57('0x12')]()]+_0x7e57('0x1f'),_0x5bc9bf);_0x5c6130(_0x5bc9bf);})[_0x7e57('0x14')](function(_0x30b6f0){logger[_0x7e57('0x15')]('['+[_0x1a9ad1[_0x7e57('0x12')]()]+']',_0x30b6f0['message']);_0xef21bf(_0x30b6f0[_0x7e57('0x16')]);});}else{logger[_0x7e57('0x11')]('['+[_0x1a9ad1[_0x7e57('0x12')]()]+_0x7e57('0x20'));_0x5bc9bf[_0x7e57('0x1e')]=_0x5bc9bf[_0x7e57('0xf')];_0x5bc9bf[_0x7e57('0x19')]=_0x5bc9bf[_0x7e57('0x21')];_0x5c6130(_0x5bc9bf);}});};}function createEndUser(_0x246000,_0x4510ce,_0x129ce7,_0x1519e8,_0x41778e){logger[_0x7e57('0x11')]('['+[_0x246000['toUpperCase']()]+_0x7e57('0x22'),_0x129ce7);return new Promise(function(_0x153a8b,_0x32b1bd){var _0x42a1af={'method':_0x7e57('0x23'),'uri':_0x1519e8+_0x7e57('0x24')+_0x41778e,'body':{'user_name':_0x129ce7[_0x7e57('0x25')],'roles':_0x7e57('0x26'),'first_name':_0x129ce7['endUserNumber'],'active':_0x7e57('0x1d'),'date_format':_0x7e57('0x27'),'phone':_0x129ce7[_0x7e57('0x25')]},'auth':_0x4510ce,'json':!![]};return rp(_0x42a1af)[_0x7e57('0xc')](function(_0x4fbcfd){logger[_0x7e57('0x11')]('['+[_0x246000[_0x7e57('0x12')]()]+_0x7e57('0x28'),_0x4fbcfd[_0x7e57('0xd')]);_0x129ce7[_0x7e57('0x29')]=_0x4fbcfd[_0x7e57('0xd')][_0x7e57('0x10')];_0x153a8b(_0x129ce7);})[_0x7e57('0x14')](function(_0x12d3f8){logger[_0x7e57('0x15')]('['+[_0x246000['toUpperCase']()]+']',_0x12d3f8[_0x7e57('0x16')]);_0x32b1bd(_0x12d3f8[_0x7e57('0x16')]);});});}function getEndUser(_0x19f9da,_0x593bb4,_0x358b5c,_0x5a44d9,_0x1884d2){return function(_0xa1bc81){logger[_0x7e57('0x11')]('['+[_0x19f9da[_0x7e57('0x12')]()]+_0x7e57('0x2a'),_0xa1bc81);return new Promise(function(_0x2f8764,_0x14fc77){var _0x270d70={'method':'GET','uri':_0x358b5c+_0x7e57('0x2b')+_0xa1bc81[_0x7e57('0x25')]+'&'+_0x5a44d9+'&'+_0x1884d2,'auth':_0x593bb4,'json':!![]};return rp(_0x270d70)[_0x7e57('0xc')](function(_0x51b4f1){if(_0x51b4f1['result']['length']>0x0){_0xa1bc81[_0x7e57('0x29')]=_0x51b4f1[_0x7e57('0xd')][0x0][_0x7e57('0x10')];logger[_0x7e57('0x11')]('['+[_0x19f9da['toUpperCase']()]+'],\x20getEndUser\x20crm',_0xa1bc81);_0x2f8764(_0xa1bc81);}else{return createEndUser(_0x19f9da,_0x593bb4,_0xa1bc81,_0x358b5c,_0x5a44d9)[_0x7e57('0xc')](function(_0x2bac96){logger[_0x7e57('0x11')]('['+[_0x19f9da[_0x7e57('0x12')]()]+'],\x20createEndUser\x20crm',_0x2bac96);_0x2f8764(_0x2bac96);});}})['catch'](function(_0x536554){logger[_0x7e57('0x15')]('['+[_0x19f9da['toUpperCase']()]+']',_0x536554[_0x7e57('0x16')]);_0x14fc77(_0x536554[_0x7e57('0x16')]);});});};}function getCustomFields(_0x5cff41,_0x18c607){var _0x307f66={};if(_0x5cff41[_0x7e57('0xe')]>0x0){_[_0x7e57('0x2c')](_0x5cff41,function(_0x5b44a7){if(_[_0x7e57('0x2d')]([_0x7e57('0x2e'),'picklist'],_0x5b44a7[_0x7e57('0x2f')])&&_0x5b44a7[_0x7e57('0x30')]&&!_0x5b44a7[_0x7e57('0x31')]){_0x307f66[_0x5b44a7[_0x7e57('0x30')][_0x7e57('0x32')]()]=_0x5b44a7['content'][_0x7e57('0x33')]();}else if(_[_0x7e57('0x2d')]([_0x7e57('0x2e'),_0x7e57('0x34')],_0x5b44a7['type'])&&_0x5b44a7[_0x7e57('0x35')]&&_0x5b44a7[_0x7e57('0x31')]){_0x307f66[_0x5b44a7['idField']['toLowerCase']()]=_0x5b44a7[_0x7e57('0x36')][_0x7e57('0x33')]();}else if(_0x5b44a7['type']==='variable'&&_0x5b44a7[_0x7e57('0x37')]&&_0x5b44a7[_0x7e57('0x35')]&&_0x5b44a7[_0x7e57('0x31')]){_0x307f66[_0x5b44a7[_0x7e57('0x35')][_0x7e57('0x32')]()]=_0x18c607[_0x5b44a7[_0x7e57('0x37')]][_0x7e57('0x33')]();}else if(_0x5b44a7[_0x7e57('0x2f')]===_0x7e57('0x38')&&_0x5b44a7[_0x7e57('0x39')]&&_0x5b44a7[_0x7e57('0x39')][_0x7e57('0x3a')]&&_0x5b44a7[_0x7e57('0x35')]&&_0x5b44a7[_0x7e57('0x31')]){_0x307f66[_0x5b44a7[_0x7e57('0x35')][_0x7e57('0x32')]()]=_0x18c607[_0x5b44a7[_0x7e57('0x39')]['name'][_0x7e57('0x32')]()][_0x7e57('0x33')]();}});}return _0x307f66;}function getTicket(_0x529d7c,_0x5793a6,_0x51924c,_0x59161e,_0x5476f3,_0x32fb05){return function(_0x3c7287){logger[_0x7e57('0x11')]('['+[_0x529d7c[_0x7e57('0x12')]()]+_0x7e57('0x3b'),_0x3c7287);return new Promise(function(_0x4eb828,_0x16a43b){var _0x2549a3=_0x529d7c['toLowerCase']()===_0x7e57('0x3c')?_0x3c7287[_0x7e57('0x1e')]:_0x3c7287['endUserId'];var _0x56df37={'method':'POST','uri':_0x51924c+'incident'+'?'+_0x32fb05,'body':Object['assign']({},{'active':_0x7e57('0x1d'),'caller_id':_0x2549a3,'assigned_to':_0x3c7287[_0x7e57('0x1e')],'short_description':intUtil[_0x7e57('0x3d')](_0x59161e[_0x7e57('0x3e')],_0x5476f3,'\x20'),'description':intUtil[_0x7e57('0x3d')](_0x59161e[_0x7e57('0x3f')],_0x5476f3,'\x0a')},getCustomFields(_0x59161e['Fields'],_0x5476f3)),'auth':_0x5793a6,'json':!![]};return rp(_0x56df37)[_0x7e57('0xc')](function(_0xef7518){logger['info']('['+[_0x529d7c[_0x7e57('0x12')]()]+_0x7e57('0x40'),_0xef7518[_0x7e57('0xd')]);_0x3c7287[_0x7e57('0x41')]=_0xef7518['result'][_0x7e57('0x10')];_0x3c7287[_0x7e57('0x42')]=_0xef7518[_0x7e57('0xd')][_0x7e57('0x43')];logger[_0x7e57('0x11')]('['+[_0x529d7c[_0x7e57('0x12')]()]+']\x20getTicket\x20crm',_0x3c7287);_0x4eb828(_0x3c7287);})[_0x7e57('0x14')](function(_0x15ac97){logger['error']('['+[_0x529d7c[_0x7e57('0x12')]()]+']',_0x15ac97[_0x7e57('0x16')]);_0x16a43b(_0x15ac97[_0x7e57('0x16')]);});});};}function createRemoteTag(_0x4eaae2,_0x4a6d93,_0x11eb54,_0x2fd944){return new Promise(function(_0x1fea9a,_0xd2b11d){var _0x55024d={'method':_0x7e57('0x23'),'uri':_0x11eb54+'label'+'?'+_0x2fd944,'body':{'short_description':_0x4eaae2,'global':!![],'active':!![],'name':_0x4eaae2},'auth':_0x4a6d93,'json':!![]};return rp(_0x55024d)['then'](function(_0x16d684){var _0x59e387=_0x16d684[_0x7e57('0xd')][_0x7e57('0x10')];_0x1fea9a(_0x59e387);});});}function getRemoteTag(_0x1f2c40,_0x3df471,_0x330800,_0x162c9d,_0x449b9e){return new Promise(function(_0x33f6e3,_0x15741c){var _0x4d6565={'method':_0x7e57('0x1a'),'uri':_0x330800+'label'+_0x7e57('0x44')+_0x1f2c40+'&'+_0x162c9d,'auth':_0x3df471,'json':!![]};return rp(_0x4d6565)[_0x7e57('0xc')](function(_0x3e966e){if(_0x3e966e[_0x7e57('0xd')]['length']>0x0){var _0x27888a=_0x3e966e[_0x7e57('0xd')][0x0][_0x7e57('0x10')];_0x33f6e3(_0x27888a);}else{return createRemoteTag(_0x1f2c40,_0x3df471,_0x330800,_0x162c9d)[_0x7e57('0xc')](function(_0x2a051f){_0x33f6e3(_0x2a051f);});}});});}function assignTagToIncident(_0x4d60a6,_0x4049fc,_0x3a3c7b,_0xe99fea,_0x3c40ed){return new Promise(function(_0x5e6312,_0x4b6b6e){var _0x4ff2a0={'method':_0x7e57('0x23'),'uri':_0x3a3c7b+_0x7e57('0x45')+'?'+_0x3c40ed,'body':{'label':_0x4d60a6,'table':'incident','id_type':_0x7e57('0x46'),'table_key':_0xe99fea[_0x7e57('0x41')],'title':_0x7e57('0x47')+_0xe99fea[_0x7e57('0x42')],'id_display':_0xe99fea[_0x7e57('0x42')]},'auth':_0x4049fc,'json':!![]};return rp(_0x4ff2a0)[_0x7e57('0xc')](function(_0x30f72b){_0x5e6312();})['catch'](function(){_0x5e6312();});});}function manageTags(_0x338c3e,_0xf6a0b7,_0x46237c,_0x864b28,_0xb8657f,_0x5e69bb,_0x58a508){return new Promise(function(_0x20421d,_0x58c1b1){var _0x2ffc7e=[];_0xf6a0b7[_0x7e57('0x2c')](function(_0x3baf16){_0x2ffc7e[_0x7e57('0x48')](getRemoteTag(_0x3baf16,_0x46237c,_0x864b28,_0x5e69bb,_0x58a508));});return Promise[_0x7e57('0x49')](_0x2ffc7e)[_0x7e57('0xc')](function(_0x2c7a1f){if(_0x2c7a1f[_0x7e57('0xe')]){logger[_0x7e57('0x11')]('['+[_0x338c3e[_0x7e57('0x12')]()]+_0x7e57('0x4a'),_0x2c7a1f);var _0x5447bb=[];_0x2c7a1f[_0x7e57('0x2c')](function(_0x529f73){_0x5447bb[_0x7e57('0x48')](assignTagToIncident(_0x529f73,_0x46237c,_0x864b28,_0xb8657f,_0x5e69bb));});return Promise['all'](_0x5447bb)[_0x7e57('0xc')](function(){_0x20421d();})['catch'](function(){_0x20421d();});}else{_0x20421d();}});});}function getTags(_0x5ce57c,_0x4e2415,_0xc27932,_0x1f5fbe,_0x253cba,_0x582806){return function(_0x339d0e){return new Promise(function(_0x4f4dcb,_0xc86eb3){var _0x2d495f=[];var _0x30089c=_0x1f5fbe[_0x7e57('0x4b')];if(_0x30089c&&_0x30089c[_0x7e57('0xe')]>0x0){_0x2d495f=_[_0x7e57('0x4c')](_0x30089c,_0x7e57('0x3a'));}if(_0x2d495f[_0x7e57('0xe')]>0x0){return manageTags(_0x5ce57c,_0x2d495f,_0x4e2415,_0xc27932,_0x339d0e,_0x253cba,_0x582806)[_0x7e57('0xc')](function(){_0x4f4dcb(_0x339d0e);});}else{_0x4f4dcb(_0x339d0e);}});};}function emit(_0x1c8f87,_0x283464,_0x2b639f){var _0x5d53c4=_0x7e57('0x4d')+_0x7e57('0x4e')+_0x7e57('0x4f')+'%255EORDERBYDESCnumber';var _0x3759e4={'uri':_0x1c8f87+_0x7e57('0x50')+_0x2b639f+_0x5d53c4};io['to'](util['format'](_0x7e57('0x51'),_0x283464))[_0x7e57('0x52')]('trigger:browser:url',_0x3759e4);}exports['cs']=function(_0x152b31,_0x3f743b,_0x176b29,_0x92ffde,_0x39cc12,_0x13cfdb,_0x333057,_0x54a123){var _0x807fec={};var _0x21db34={'user':_0x13cfdb['username'],'pass':_0x13cfdb[_0x7e57('0x53')]};var _0x2f1372=_0x7e57('0x54');var _0x3184=_0x7e57('0x55');_0x13cfdb[_0x7e57('0x56')]=intUtil['stripTrailingSlash'](_0x13cfdb[_0x7e57('0x56')]);_0x13cfdb[_0x7e57('0x57')]=intUtil[_0x7e57('0x58')](_0x13cfdb[_0x7e57('0x57')]);var _0x539c40=util[_0x7e57('0x59')](_0x7e57('0x5a'),_0x13cfdb['remoteUri']);_0x807fec[_0x7e57('0x19')]=!_[_0x7e57('0x5b')](_0x92ffde)?_0x92ffde[_0x7e57('0x5c')]:null;_0x807fec[_0x7e57('0x21')]=_0x13cfdb['email'];_0x807fec['endUserNumber']=_0x54a123[_0x7e57('0x32')]()===_0x7e57('0x3c')?_0x3f743b['destcalleridnum']:_0x3f743b[_0x7e57('0x5d')];_0x807fec['callDirection']=_0x54a123===_0x7e57('0x5e')||_0x54a123==='unmanaged'?_0x7e57('0x5e'):_0x7e57('0x3c');var _0x5e7091=util[_0x7e57('0x59')](_0x7e57('0x5f'),_0x13cfdb['serverUrl'],_0x3f743b['uniqueid'],md5(_0x3f743b[_0x7e57('0x60')]));if(_0x39cc12&&_0x39cc12[_0x7e57('0x61')]){logger[_0x7e57('0x11')](_0x7e57('0x62'),_0x7e57('0x63'));_0x3f743b[_0x7e57('0x64')]=_0x5e7091;}else if(_0x333057&&_0x333057[_0x7e57('0x65')]&&_0x333057['recordingFormat']!==_0x7e57('0x66')){logger[_0x7e57('0x11')](_0x7e57('0x67'),_0x7e57('0x63'));_0x3f743b[_0x7e57('0x64')]=_0x5e7091;}else{_0x3f743b[_0x7e57('0x64')]='';}return getAdminUser(_0x54a123,_0x21db34,_0x807fec,_0x539c40,_0x3184,_0x2f1372)[_0x7e57('0xc')](getUser(_0x54a123,_0x21db34,_0x539c40,_0x3184,_0x2f1372))['then'](getEndUser(_0x54a123,_0x21db34,_0x539c40,_0x3184,_0x2f1372))['then'](getTicket(_0x54a123,_0x21db34,_0x539c40,_0x176b29,_0x3f743b,_0x3184))[_0x7e57('0xc')](function(_0x4c791f){logger[_0x7e57('0x11')](util[_0x7e57('0x59')](_0x7e57('0x68'),_0x4c791f['ticketId']));logger[_0x7e57('0x11')](util[_0x7e57('0x59')](_0x7e57('0x69'),_0x54a123));if(_0x54a123!==_0x7e57('0x6a')){logger[_0x7e57('0x11')]('['+[_0x54a123[_0x7e57('0x12')]()]+']',_0x7e57('0x6b'));emit(_0x13cfdb[_0x7e57('0x56')],_0x92ffde[_0x7e57('0x3a')],_0x4c791f[_0x7e57('0x41')]);}})[_0x7e57('0x14')](function(_0x544fee){logger[_0x7e57('0x15')]('['+[_0x54a123['toUpperCase']()]+_0x7e57('0x6c'),util[_0x7e57('0x6d')](_0x544fee,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9e24=['email','outbound','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','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','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','includes','string','type','customField','nameField','toLowerCase','toString','picklist','idField','content','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','assign','getString','Subjects','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','forEach','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','password','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/'];(function(_0x479774,_0x393894){var _0x5f4e5c=function(_0x59f7d2){while(--_0x59f7d2){_0x479774['push'](_0x479774['shift']());}};_0x5f4e5c(++_0x393894);}(_0x9e24,0x84));var _0x49e2=function(_0xcfe8cc,_0xb83aeb){_0xcfe8cc=_0xcfe8cc-0x0;var _0x55ac53=_0x9e24[_0xcfe8cc];return _0x55ac53;};'use strict';var _=require(_0x49e2('0x0'));var Promise=require(_0x49e2('0x1'));var rp=require(_0x49e2('0x2'));var util=require(_0x49e2('0x3'));var md5=require(_0x49e2('0x4'));var Redis=require(_0x49e2('0x5'));var intUtil=require(_0x49e2('0x6'));var config=require(_0x49e2('0x7'));var logger=require(_0x49e2('0x8'))(_0x49e2('0x9'));config['redis']=_[_0x49e2('0xa')](config[_0x49e2('0xb')],{'host':_0x49e2('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x49e2('0xb')]));function getAdminUser(_0x44ea16,_0xf2006c,_0x7bb3cb,_0x592257,_0x5102ab,_0x4e41fc){return new Promise(function(_0x5d7c73,_0x531803){var _0x1a8587={'method':_0x49e2('0xd'),'uri':_0x592257+_0x49e2('0xe')+'&'+_0x5102ab+'&'+_0x4e41fc,'auth':_0xf2006c,'json':!![]};return rp(_0x1a8587)['then'](function(_0x29e00e){if(_0x29e00e['result'][_0x49e2('0xf')]>0x0){_0x7bb3cb[_0x49e2('0x10')]=_0x29e00e[_0x49e2('0x11')][0x0][_0x49e2('0x12')];}logger[_0x49e2('0x13')]('['+[_0x44ea16[_0x49e2('0x14')]()]+_0x49e2('0x15'),_0x7bb3cb);_0x5d7c73(_0x7bb3cb);})[_0x49e2('0x16')](function(_0x52ed44){logger[_0x49e2('0x17')]('['+[_0x44ea16[_0x49e2('0x14')]()]+']',_0x52ed44['message']);_0x531803(_0x52ed44[_0x49e2('0x18')]);});});}function getUser(_0x2bf4ab,_0x18a90d,_0x473103,_0x1d77bf,_0x1dd38b){return function(_0x5d0819){logger['info']('['+[_0x2bf4ab[_0x49e2('0x14')]()]+_0x49e2('0x19'),_0x5d0819);return new Promise(function(_0x198ad9,_0x3ceed2){if(intUtil[_0x49e2('0x1a')](_0x5d0819[_0x49e2('0x1b')])){var _0x55ea8c={'method':_0x49e2('0xd'),'uri':_0x473103+_0x49e2('0x1c')+_0x5d0819[_0x49e2('0x1b')]+'&'+_0x1d77bf+'&'+_0x1dd38b,'auth':_0x18a90d,'json':!![]};logger['info']('['+[_0x2bf4ab[_0x49e2('0x14')]()]+_0x49e2('0x1d'),_0x55ea8c);return rp(_0x55ea8c)[_0x49e2('0x1e')](function(_0x24ed5e){logger[_0x49e2('0x13')]('['+[_0x2bf4ab['toUpperCase']()]+_0x49e2('0x1f'),_0x24ed5e);if(_0x24ed5e['result'][_0x49e2('0xf')]>0x0&&String(_0x24ed5e['result'][0x0]['active'])==='true'){_0x5d0819[_0x49e2('0x20')]=_0x24ed5e[_0x49e2('0x11')][0x0][_0x49e2('0x12')];}else{_0x5d0819[_0x49e2('0x20')]=_0x5d0819[_0x49e2('0x10')];_0x5d0819[_0x49e2('0x1b')]=_0x5d0819['adminEmail'];}logger[_0x49e2('0x13')]('['+[_0x2bf4ab[_0x49e2('0x14')]()]+'],\x20getUser\x20crm',_0x5d0819);_0x198ad9(_0x5d0819);})['catch'](function(_0x564b64){logger[_0x49e2('0x17')]('['+[_0x2bf4ab[_0x49e2('0x14')]()]+']',_0x564b64[_0x49e2('0x18')]);_0x3ceed2(_0x564b64[_0x49e2('0x18')]);});}else{logger[_0x49e2('0x13')]('['+[_0x2bf4ab['toUpperCase']()]+']\x20using\x20admin\x20profile');_0x5d0819[_0x49e2('0x20')]=_0x5d0819[_0x49e2('0x10')];_0x5d0819[_0x49e2('0x1b')]=_0x5d0819[_0x49e2('0x21')];_0x198ad9(_0x5d0819);}});};}function createEndUser(_0x34049c,_0xd197d3,_0x339d75,_0x4d447f,_0xdc5354){logger[_0x49e2('0x13')]('['+[_0x34049c[_0x49e2('0x14')]()]+_0x49e2('0x22'),_0x339d75);return new Promise(function(_0x1fbc99,_0x216f38){var _0x287062={'method':_0x49e2('0x23'),'uri':_0x4d447f+_0x49e2('0x24')+_0xdc5354,'body':{'user_name':_0x339d75[_0x49e2('0x25')],'roles':_0x49e2('0x26'),'first_name':_0x339d75[_0x49e2('0x25')],'active':_0x49e2('0x27'),'date_format':_0x49e2('0x28'),'phone':_0x339d75[_0x49e2('0x25')]},'auth':_0xd197d3,'json':!![]};return rp(_0x287062)[_0x49e2('0x1e')](function(_0x3e8ad0){logger[_0x49e2('0x13')]('['+[_0x34049c['toUpperCase']()]+_0x49e2('0x29'),_0x3e8ad0[_0x49e2('0x11')]);_0x339d75[_0x49e2('0x2a')]=_0x3e8ad0[_0x49e2('0x11')][_0x49e2('0x12')];_0x1fbc99(_0x339d75);})[_0x49e2('0x16')](function(_0x2e000e){logger[_0x49e2('0x17')]('['+[_0x34049c[_0x49e2('0x14')]()]+']',_0x2e000e[_0x49e2('0x18')]);_0x216f38(_0x2e000e[_0x49e2('0x18')]);});});}function getEndUser(_0x48d71b,_0x6623f9,_0x30027c,_0x231675,_0x2af6c6){return function(_0x58f33d){logger[_0x49e2('0x13')]('['+[_0x48d71b[_0x49e2('0x14')]()]+_0x49e2('0x2b'),_0x58f33d);return new Promise(function(_0x1c6dd0,_0x5920dd){var _0x51c601={'method':_0x49e2('0xd'),'uri':_0x30027c+_0x49e2('0x2c')+_0x58f33d[_0x49e2('0x25')]+'&'+_0x231675+'&'+_0x2af6c6,'auth':_0x6623f9,'json':!![]};return rp(_0x51c601)[_0x49e2('0x1e')](function(_0xd554d8){if(_0xd554d8[_0x49e2('0x11')][_0x49e2('0xf')]>0x0){_0x58f33d[_0x49e2('0x2a')]=_0xd554d8['result'][0x0][_0x49e2('0x12')];logger[_0x49e2('0x13')]('['+[_0x48d71b['toUpperCase']()]+'],\x20getEndUser\x20crm',_0x58f33d);_0x1c6dd0(_0x58f33d);}else{return createEndUser(_0x48d71b,_0x6623f9,_0x58f33d,_0x30027c,_0x231675)[_0x49e2('0x1e')](function(_0xab368e){logger[_0x49e2('0x13')]('['+[_0x48d71b['toUpperCase']()]+_0x49e2('0x2d'),_0xab368e);_0x1c6dd0(_0xab368e);});}})[_0x49e2('0x16')](function(_0x21697e){logger['error']('['+[_0x48d71b[_0x49e2('0x14')]()]+']',_0x21697e['message']);_0x5920dd(_0x21697e['message']);});});};}function getCustomFields(_0x1f6d03,_0x528be3){var _0x14706e={};if(_0x1f6d03[_0x49e2('0xf')]>0x0){_['forEach'](_0x1f6d03,function(_0x351c18){if(_[_0x49e2('0x2e')]([_0x49e2('0x2f'),'picklist'],_0x351c18[_0x49e2('0x30')])&&_0x351c18['nameField']&&!_0x351c18[_0x49e2('0x31')]){_0x14706e[_0x351c18[_0x49e2('0x32')][_0x49e2('0x33')]()]=_0x351c18['content'][_0x49e2('0x34')]();}else if(_[_0x49e2('0x2e')]([_0x49e2('0x2f'),_0x49e2('0x35')],_0x351c18[_0x49e2('0x30')])&&_0x351c18[_0x49e2('0x36')]&&_0x351c18[_0x49e2('0x31')]){_0x14706e[_0x351c18[_0x49e2('0x36')][_0x49e2('0x33')]()]=_0x351c18[_0x49e2('0x37')][_0x49e2('0x34')]();}else if(_0x351c18['type']===_0x49e2('0x38')&&_0x351c18[_0x49e2('0x39')]&&_0x351c18[_0x49e2('0x36')]&&_0x351c18[_0x49e2('0x31')]){_0x14706e[_0x351c18[_0x49e2('0x36')]['toLowerCase']()]=_0x528be3[_0x351c18['variableName']]['toString']();}else if(_0x351c18[_0x49e2('0x30')]===_0x49e2('0x3a')&&_0x351c18['Variable']&&_0x351c18[_0x49e2('0x3b')][_0x49e2('0x3c')]&&_0x351c18[_0x49e2('0x36')]&&_0x351c18['customField']){_0x14706e[_0x351c18[_0x49e2('0x36')]['toLowerCase']()]=_0x528be3[_0x351c18[_0x49e2('0x3b')][_0x49e2('0x3c')]['toLowerCase']()][_0x49e2('0x34')]();}});}return _0x14706e;}function getTicket(_0x25427d,_0x1d02f6,_0x4fa63d,_0x65f257,_0x340a60,_0x2ecd23){return function(_0x45e6cf){logger['info']('['+[_0x25427d[_0x49e2('0x14')]()]+_0x49e2('0x3d'),_0x45e6cf);return new Promise(function(_0x1bf1da,_0x3679ad){var _0x474e10=_0x25427d[_0x49e2('0x33')]()==='outbound'?_0x45e6cf[_0x49e2('0x20')]:_0x45e6cf[_0x49e2('0x2a')];var _0x179932={'method':_0x49e2('0x23'),'uri':_0x4fa63d+'incident'+'?'+_0x2ecd23,'body':Object[_0x49e2('0x3e')]({},{'active':_0x49e2('0x27'),'caller_id':_0x474e10,'assigned_to':_0x45e6cf['userId'],'short_description':intUtil[_0x49e2('0x3f')](_0x65f257[_0x49e2('0x40')],_0x340a60,'\x20'),'description':intUtil[_0x49e2('0x3f')](_0x65f257[_0x49e2('0x41')],_0x340a60,'\x0a')},getCustomFields(_0x65f257[_0x49e2('0x42')],_0x340a60)),'auth':_0x1d02f6,'json':!![]};return rp(_0x179932)['then'](function(_0x41f8f2){logger[_0x49e2('0x13')]('['+[_0x25427d[_0x49e2('0x14')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x41f8f2[_0x49e2('0x11')]);_0x45e6cf[_0x49e2('0x43')]=_0x41f8f2['result']['sys_id'];_0x45e6cf[_0x49e2('0x44')]=_0x41f8f2['result'][_0x49e2('0x45')];logger['info']('['+[_0x25427d[_0x49e2('0x14')]()]+_0x49e2('0x46'),_0x45e6cf);_0x1bf1da(_0x45e6cf);})['catch'](function(_0x257926){logger[_0x49e2('0x17')]('['+[_0x25427d[_0x49e2('0x14')]()]+']',_0x257926['message']);_0x3679ad(_0x257926[_0x49e2('0x18')]);});});};}function createRemoteTag(_0x51acad,_0x2e0c92,_0x460afe,_0x58c04d){return new Promise(function(_0x583b79,_0x56d538){var _0x44c96c={'method':_0x49e2('0x23'),'uri':_0x460afe+'label'+'?'+_0x58c04d,'body':{'short_description':_0x51acad,'global':!![],'active':!![],'name':_0x51acad},'auth':_0x2e0c92,'json':!![]};return rp(_0x44c96c)[_0x49e2('0x1e')](function(_0x2ceec0){var _0x1ecc7f=_0x2ceec0['result'][_0x49e2('0x12')];_0x583b79(_0x1ecc7f);});});}function getRemoteTag(_0x46166b,_0x11f879,_0x29d2a8,_0x568a95,_0x564f18){return new Promise(function(_0x56780f,_0x1c8d0d){var _0x12e1f7={'method':_0x49e2('0xd'),'uri':_0x29d2a8+_0x49e2('0x47')+_0x49e2('0x48')+_0x46166b+'&'+_0x568a95,'auth':_0x11f879,'json':!![]};return rp(_0x12e1f7)[_0x49e2('0x1e')](function(_0x2d6cb9){if(_0x2d6cb9[_0x49e2('0x11')]['length']>0x0){var _0x139ac0=_0x2d6cb9['result'][0x0][_0x49e2('0x12')];_0x56780f(_0x139ac0);}else{return createRemoteTag(_0x46166b,_0x11f879,_0x29d2a8,_0x568a95)[_0x49e2('0x1e')](function(_0x4766d2){_0x56780f(_0x4766d2);});}});});}function assignTagToIncident(_0x36bbfe,_0x52ad1b,_0x3e5471,_0x4c8edc,_0x5eb945){return new Promise(function(_0x400aa9,_0x132328){var _0x300c0d={'method':_0x49e2('0x23'),'uri':_0x3e5471+_0x49e2('0x49')+'?'+_0x5eb945,'body':{'label':_0x36bbfe,'table':_0x49e2('0x4a'),'id_type':'Incident','table_key':_0x4c8edc[_0x49e2('0x43')],'title':'Incident\x20-\x20'+_0x4c8edc[_0x49e2('0x44')],'id_display':_0x4c8edc[_0x49e2('0x44')]},'auth':_0x52ad1b,'json':!![]};return rp(_0x300c0d)[_0x49e2('0x1e')](function(_0x342e2){_0x400aa9();})['catch'](function(){_0x400aa9();});});}function manageTags(_0x302c00,_0x57db4d,_0x302857,_0x415f70,_0x344255,_0x4dd94e,_0x48fbec){return new Promise(function(_0x3e29f2,_0x40b1f0){var _0x12af9b=[];_0x57db4d[_0x49e2('0x4b')](function(_0x307996){_0x12af9b['push'](getRemoteTag(_0x307996,_0x302857,_0x415f70,_0x4dd94e,_0x48fbec));});return Promise[_0x49e2('0x4c')](_0x12af9b)[_0x49e2('0x1e')](function(_0x1a32e1){if(_0x1a32e1['length']){logger[_0x49e2('0x13')]('['+[_0x302c00[_0x49e2('0x14')]()]+_0x49e2('0x4d'),_0x1a32e1);var _0x4f859c=[];_0x1a32e1[_0x49e2('0x4b')](function(_0x4275a1){_0x4f859c['push'](assignTagToIncident(_0x4275a1,_0x302857,_0x415f70,_0x344255,_0x4dd94e));});return Promise['all'](_0x4f859c)[_0x49e2('0x1e')](function(){_0x3e29f2();})[_0x49e2('0x16')](function(){_0x3e29f2();});}else{_0x3e29f2();}});});}function getTags(_0x2ae10b,_0xc9fb67,_0x54716b,_0x20e484,_0x25b2bc,_0x2889f5){return function(_0x9fb9ea){return new Promise(function(_0x23aed5,_0x521b8b){var _0x3dbcd0=[];var _0x499cc9=_0x20e484[_0x49e2('0x4e')];if(_0x499cc9&&_0x499cc9[_0x49e2('0xf')]>0x0){_0x3dbcd0=_[_0x49e2('0x4f')](_0x499cc9,_0x49e2('0x3c'));}if(_0x3dbcd0['length']>0x0){return manageTags(_0x2ae10b,_0x3dbcd0,_0xc9fb67,_0x54716b,_0x9fb9ea,_0x25b2bc,_0x2889f5)['then'](function(){_0x23aed5(_0x9fb9ea);});}else{_0x23aed5(_0x9fb9ea);}});};}function emit(_0x421b8b,_0x55db9f,_0x40936d){var _0x2b8d8b='%26sysparm_record_target%3Dincident'+_0x49e2('0x50')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0x49e2('0x51');var _0x194799={'uri':_0x421b8b+_0x49e2('0x52')+_0x40936d+_0x2b8d8b};io['to'](util[_0x49e2('0x53')](_0x49e2('0x54'),_0x55db9f))[_0x49e2('0x55')](_0x49e2('0x56'),_0x194799);}exports['cs']=function(_0x153ba2,_0x3413e2,_0x2f1af4,_0x4f858f,_0x367791,_0x557a9e,_0x1527f2,_0x537c4a){var _0x3cef28={};var _0x1968d0={'user':_0x557a9e[_0x49e2('0x57')],'pass':_0x557a9e[_0x49e2('0x58')]};var _0x443390='sysparm_limit=1';var _0xf6668a=_0x49e2('0x59');_0x557a9e[_0x49e2('0x5a')]=intUtil['stripTrailingSlash'](_0x557a9e['remoteUri']);_0x557a9e[_0x49e2('0x5b')]=intUtil[_0x49e2('0x5c')](_0x557a9e['serverUrl']);var _0x395725=util[_0x49e2('0x53')](_0x49e2('0x5d'),_0x557a9e[_0x49e2('0x5a')]);_0x3cef28['userEmail']=!_['isNil'](_0x4f858f)?_0x4f858f[_0x49e2('0x5e')]:null;_0x3cef28['adminEmail']=_0x557a9e['email'];_0x3cef28[_0x49e2('0x25')]=_0x537c4a[_0x49e2('0x33')]()===_0x49e2('0x5f')?_0x3413e2['destcalleridnum']:_0x3413e2[_0x49e2('0x60')];_0x3cef28[_0x49e2('0x61')]=_0x537c4a==='queue'||_0x537c4a===_0x49e2('0x62')?_0x49e2('0x63'):'outbound';var _0x39cf20=util['format'](_0x49e2('0x64'),_0x557a9e[_0x49e2('0x5b')],_0x3413e2[_0x49e2('0x65')],md5(_0x3413e2[_0x49e2('0x65')]));if(_0x367791&&_0x367791[_0x49e2('0x66')]){logger['info']('[QUEUE]',_0x49e2('0x67'));_0x3413e2[_0x49e2('0x68')]=_0x39cf20;}else if(_0x1527f2&&_0x1527f2[_0x49e2('0x69')]&&_0x1527f2['recordingFormat']!==_0x49e2('0x6a')){logger[_0x49e2('0x13')](_0x49e2('0x6b'),_0x49e2('0x67'));_0x3413e2[_0x49e2('0x68')]=_0x39cf20;}else{_0x3413e2['recordingURL']='';}return getAdminUser(_0x537c4a,_0x1968d0,_0x3cef28,_0x395725,_0xf6668a,_0x443390)[_0x49e2('0x1e')](getUser(_0x537c4a,_0x1968d0,_0x395725,_0xf6668a,_0x443390))[_0x49e2('0x1e')](getEndUser(_0x537c4a,_0x1968d0,_0x395725,_0xf6668a,_0x443390))['then'](getTicket(_0x537c4a,_0x1968d0,_0x395725,_0x2f1af4,_0x3413e2,_0xf6668a))[_0x49e2('0x1e')](function(_0xdaaf16){logger[_0x49e2('0x13')](util['format'](_0x49e2('0x6c'),_0xdaaf16[_0x49e2('0x43')]));logger[_0x49e2('0x13')](util[_0x49e2('0x53')](_0x49e2('0x6d'),_0x537c4a));if(_0x537c4a!==_0x49e2('0x62')){logger[_0x49e2('0x13')]('['+[_0x537c4a[_0x49e2('0x14')]()]+']',_0x49e2('0x6e'));emit(_0x557a9e[_0x49e2('0x5a')],_0x4f858f[_0x49e2('0x3c')],_0xdaaf16[_0x49e2('0x43')]);}})['catch'](function(_0x43f1a9){logger[_0x49e2('0x17')]('['+[_0x537c4a[_0x49e2('0x14')]()]+_0x49e2('0x6f'),util[_0x49e2('0x70')](_0x43f1a9,{'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 ab4a9ac..760eb54 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 _0xe0ec=['./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','replace','duration_minutes','parent_id','parent_type','parent_name','direction','length','forEach','idField','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','map','type','string','customField','content','custom_fields','toString','variable','push','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','version','charAt','monitor_format','toUpperCase','catch','lastevent','request-promise','bluebird','md5','util','ioredis'];(function(_0x3733eb,_0x2d9450){var _0x4c80e3=function(_0x365bce){while(--_0x365bce){_0x3733eb['push'](_0x3733eb['shift']());}};_0x4c80e3(++_0x2d9450);}(_0xe0ec,0x74));var _0xce0e=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0xe0ec[_0x58fc2f];return _0x3a1312;};'use strict';var _=require('lodash');var rp=require(_0xce0e('0x0'));var BPromise=require(_0xce0e('0x1'));var md5=require(_0xce0e('0x2'));var util=require(_0xce0e('0x3'));var Redis=require(_0xce0e('0x4'));var intUtil=require(_0xce0e('0x5'));var config=require(_0xce0e('0x6'));var logger=require(_0xce0e('0x7'))('sugarcrm');config[_0xce0e('0x8')]=_[_0xce0e('0x9')](config[_0xce0e('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xce0e('0xa'))(new Redis(config[_0xce0e('0x8')]));var def={'method':_0xce0e('0xb'),'json':!![]};function emit(_0x5a35b8,_0x350428,_0xd65dbf){io['to'](_0x5a35b8)[_0xce0e('0xc')](_0x350428,_0xd65dbf);}function getTicket(_0x1c0cb5,_0x196043,_0x59d319,_0x44eef1,_0x1257c8,_0x2e8afd,_0x5d028a,_0x314e11){logger[_0xce0e('0xd')]('Creating\x20new\x20ticket...');var _0x3ebbf4=new Date();var _0x335841=[{'name':_0xce0e('0xe'),'value':intUtil[_0xce0e('0xf')](_0x44eef1[_0xce0e('0x10')],_0x1257c8,'\x20')},{'name':_0xce0e('0x11'),'value':_0x196043['id']},{'name':_0xce0e('0x12'),'value':_0x196043['id']},{'name':_0xce0e('0x13'),'value':intUtil[_0xce0e('0xf')](_0x44eef1[_0xce0e('0x14')],_0x1257c8,'\x0a')},{'name':_0xce0e('0x15'),'value':_0x3ebbf4[_0xce0e('0x16')]()[_0xce0e('0x17')](0x0,0x13)[_0xce0e('0x18')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xce0e('0x19'),'value':'15'},{'name':_0xce0e('0x1a'),'value':_0x59d319['id']},{'name':_0xce0e('0x1b'),'value':'Contacts'},{'name':_0xce0e('0x1c'),'value':_0x59d319['name']},{'name':_0xce0e('0x1d'),'value':_0x314e11}];if(_0x2e8afd[_0xce0e('0x1e')]){_[_0xce0e('0x1f')](_0x2e8afd,function(_0x4b74dd){if(_0x1257c8[_0x4b74dd['variableName']]){_0x335841['push']({'name':_0x4b74dd[_0xce0e('0x20')],'value':_0x1257c8[_0x4b74dd[_0xce0e('0x21')]]});}});}return request({'form':{'method':_0xce0e('0x22'),'input_type':_0xce0e('0x23'),'response_type':_0xce0e('0x23'),'rest_data':JSON[_0xce0e('0x24')]({'session':_0x5d028a['id'],'module_name':_0xce0e('0x25'),'name_value_list':_0x335841})}});}function getAuth(_0x53b20b){return util[_0xce0e('0x26')](_0xce0e('0x27'),new Buffer(_0x53b20b['apiKey']+':X')['toString']('base64'));}function getServerInfo(_0x2e4d97){return request({'form':{'method':_0xce0e('0x28'),'input_type':_0xce0e('0x23'),'response_type':_0xce0e('0x23'),'rest_data':JSON[_0xce0e('0x24')]({'session':_0x2e4d97['id']})}});}function getUser(_0x15090d,_0x2247ba,_0x59eaa6){if(!_[_0xce0e('0x29')](_0x2247ba)){logger[_0xce0e('0xd')](_0xce0e('0x2a'),_0x2247ba);return request({'form':{'method':_0xce0e('0x2b'),'input_type':'JSON','response_type':_0xce0e('0x23'),'rest_data':JSON['stringify']({'session':_0x59eaa6['id'],'module_name':'Employees','query':util[_0xce0e('0x26')](_0xce0e('0x2c'),_0x2247ba),'order_by':'','offset':'0','select_fields':['id',_0xce0e('0xe'),_0xce0e('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0xd2ecf5){if(_0xd2ecf5[_0xce0e('0x2e')][_0xce0e('0x1e')]){var _0x26908b=_[_0xce0e('0x2f')](_0xd2ecf5[_0xce0e('0x2e')],function(_0x54f3a3){return _0x54f3a3['name_value_list'][_0xce0e('0x2d')][_0xce0e('0x30')]===_0x2247ba;});if(_0x26908b){logger[_0xce0e('0xd')](_0xce0e('0x31'));return BPromise[_0xce0e('0x32')]({'id':_0x26908b[_0xce0e('0x33')]['id'][_0xce0e('0x30')],'name':_0x26908b['name_value_list']['name'][_0xce0e('0x30')]});}}logger[_0xce0e('0xd')](_0xce0e('0x34'));return BPromise[_0xce0e('0x32')]({'id':_0x59eaa6[_0xce0e('0x33')]['user_id'][_0xce0e('0x30')],'name':_0x59eaa6['name_value_list'][_0xce0e('0x2d')][_0xce0e('0x30')]});});}else{logger[_0xce0e('0xd')](_0xce0e('0x35'));return BPromise[_0xce0e('0x32')]({'id':_0x59eaa6[_0xce0e('0x33')][_0xce0e('0x36')][_0xce0e('0x30')],'name':_0x59eaa6['name_value_list'][_0xce0e('0x2d')][_0xce0e('0x30')]});}}function getEndUser(_0x3fedff,_0x2b38ed,_0x1699b8,_0x564425){logger[_0xce0e('0xd')]('Searching\x20enduser\x20with\x20phone',_0x1699b8);return request({'form':{'method':'get_entry_list','input_type':_0xce0e('0x23'),'response_type':_0xce0e('0x23'),'rest_data':JSON[_0xce0e('0x24')]({'session':_0x564425['id'],'module_name':_0xce0e('0x37'),'query':util['format'](_0xce0e('0x38'),_0x1699b8),'order_by':'','offset':'0','select_fields':['id',_0xce0e('0xe'),_0xce0e('0x39')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xce0e('0x3a')](function(_0x3e00f2){if(_0x3e00f2[_0xce0e('0x2e')]['length']){var _0x252c47=_[_0xce0e('0x2f')](_0x3e00f2['entry_list'],function(_0x2c75c8){return _0x2c75c8[_0xce0e('0x33')][_0xce0e('0x39')][_0xce0e('0x30')]===_0x1699b8;});if(_0x252c47){logger[_0xce0e('0xd')](_0xce0e('0x3b'));return BPromise[_0xce0e('0x32')]({'id':_0x252c47[_0xce0e('0x33')]['id']['value'],'name':_0x252c47[_0xce0e('0x33')][_0xce0e('0xe')][_0xce0e('0x30')],'phone':_0x252c47[_0xce0e('0x33')][_0xce0e('0x39')][_0xce0e('0x30')]});}}else{logger[_0xce0e('0xd')](_0xce0e('0x3c'));return request({'form':{'method':_0xce0e('0x22'),'input_type':'JSON','response_type':_0xce0e('0x23'),'rest_data':JSON[_0xce0e('0x24')]({'session':_0x564425['id'],'module_name':'Contacts','name_value_list':[{'name':_0xce0e('0x3d'),'value':_0x2b38ed!==_0xce0e('0x3e')?_0x2b38ed:util[_0xce0e('0x26')](_0xce0e('0x3f'),_0x1699b8)},{'name':'phone_home','value':_0x1699b8}]})}})[_0xce0e('0x3a')](function(_0xefe0aa){logger['info'](_0xce0e('0x40'));return BPromise[_0xce0e('0x32')]({'id':_0xefe0aa['id'],'name':_0xefe0aa[_0xce0e('0x2e')][_0xce0e('0x3d')][_0xce0e('0x30')],'phone':_0xefe0aa[_0xce0e('0x2e')]['phone_home']['value']});});}});}function request(_0xba000d){logger['debug'](_0xce0e('0x41'),JSON['stringify'](_0xba000d));return rp(_['merge'](def,_0xba000d));}function getTags(_0xbc4b43,_0x81042){var _0x378b93=[];if(_0xbc4b43&&_0xbc4b43[_0xce0e('0x1e')]>0x0){_0x378b93=_[_0xce0e('0x42')](_0xbc4b43,_0x81042);}return _0x378b93;}function getCustomFields(_0x249da9,_0x63b93){var _0x33d24b=[];var _0x32842f={'custom_fields':[]};if(_0x249da9[_0xce0e('0x1e')]>0x0){_[_0xce0e('0x1f')](_0x249da9,function(_0x3268e3){if(_0x3268e3[_0xce0e('0x43')]===_0xce0e('0x44')&&_0x3268e3['nameField']&&!_0x3268e3[_0xce0e('0x45')]){_0x32842f[_0x3268e3['nameField']['toLowerCase']()]=_0x3268e3[_0xce0e('0x46')]['toString']();}else if(_0x3268e3[_0xce0e('0x43')]===_0xce0e('0x44')&&_0x3268e3['idField']&&_0x3268e3[_0xce0e('0x45')]){_0x32842f[_0xce0e('0x47')]['push']({'id':_0x3268e3[_0xce0e('0x20')],'value':_0x3268e3[_0xce0e('0x46')][_0xce0e('0x48')]()});}else if(_0x3268e3[_0xce0e('0x43')]===_0xce0e('0x49')&&_0x3268e3['variableName']&&_0x3268e3[_0xce0e('0x20')]&&_0x3268e3[_0xce0e('0x45')]){_0x63b93[_0x3268e3[_0xce0e('0x21')]]&&_0x32842f[_0xce0e('0x47')][_0xce0e('0x4a')]({'id':_0x3268e3[_0xce0e('0x20')],'value':_0x63b93[_0x3268e3[_0xce0e('0x21')]]['toString']()});}else if(_0x3268e3[_0xce0e('0x43')]==='customVariable'&&_0x3268e3[_0xce0e('0x4b')]&&_0x3268e3[_0xce0e('0x4b')][_0xce0e('0xe')]&&_0x3268e3['idField']&&_0x3268e3[_0xce0e('0x45')]){_0x63b93[_0x3268e3[_0xce0e('0x4b')][_0xce0e('0xe')][_0xce0e('0x4c')]()]&&_0x32842f[_0xce0e('0x47')][_0xce0e('0x4a')]({'id':_0x3268e3[_0xce0e('0x20')],'value':_0x63b93[_0x3268e3[_0xce0e('0x4b')][_0xce0e('0xe')][_0xce0e('0x4c')]()][_0xce0e('0x48')]()});}});}return _0x32842f;}function getConnection(_0x34b93c){return request({'method':'POST','form':{'method':_0xce0e('0x4d'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xce0e('0x24')]({'user_auth':{'user_name':_0x34b93c[_0xce0e('0x4e')],'password':_0x34b93c[_0xce0e('0x4f')],'encryption':_0xce0e('0x50')},'application':_0xce0e('0x51')})}})['then'](function(_0x58d66f){var _0x2047aa=_0x58d66f;if(_0x2047aa['id']){def[_0xce0e('0x52')]=_0x2047aa['id'];return BPromise[_0xce0e('0x32')](_0x2047aa);}else{throw new Error(util[_0xce0e('0x26')]('Account\x20%d\x20is\x20not\x20valid',_0x34b93c['id']));}});}function setRelationship(_0x1abb6a,_0x4873e6,_0x498594,_0x2005c4){return request({'form':{'method':_0xce0e('0x53'),'input_type':_0xce0e('0x23'),'response_type':'JSON','rest_data':JSON[_0xce0e('0x24')]({'session':_0x1abb6a['id'],'module_name':_0xce0e('0x25'),'module_id':_0x498594['id'],'link_field_name':_0x2005c4,'related_ids':[_0x4873e6['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xce0e('0x54')]=function(_0x1b534f,_0x40b656,_0xbf32c2,_0x63aabc,_0x4e36cd,_0x3fcbde){var _0x4f9b72,_0x4f6b7b,_0x137167,_0x249128;_0x3fcbde[_0xce0e('0x55')]=intUtil[_0xce0e('0x56')](_0x3fcbde[_0xce0e('0x55')]);_0x3fcbde[_0xce0e('0x57')]=intUtil[_0xce0e('0x56')](_0x3fcbde[_0xce0e('0x57')]);def[_0xce0e('0x58')]=util[_0xce0e('0x26')](_0xce0e('0x59'),_0x3fcbde['remoteUri']);if(_0x4e36cd&&_0x4e36cd['monitor_format']){logger[_0xce0e('0xd')](_0xce0e('0x5a'),_0xce0e('0x5b'));_0x40b656[_0xce0e('0x5c')]=util[_0xce0e('0x26')](_0xce0e('0x5d'),_0x3fcbde[_0xce0e('0x57')],_0x40b656[_0xce0e('0x5e')],md5(_0x40b656[_0xce0e('0x5e')]));}else{_0x40b656[_0xce0e('0x5c')]='';}return getConnection(_0x3fcbde)[_0xce0e('0x3a')](function(_0xbabfee){_0x249128=_0xbabfee;return getUser(_0x3fcbde,_0x63aabc[_0xce0e('0xe')],_0x249128);})['then'](function(_0x208e49){_0x4f9b72=_0x208e49;logger['info'](_0xce0e('0x5f'),_0x4f9b72['id']);return getEndUser(_0x3fcbde,_0x40b656[_0xce0e('0x60')],_0x40b656[_0xce0e('0x61')],_0x249128);})[_0xce0e('0x3a')](function(_0x873def){_0x4f6b7b=_0x873def;logger[_0xce0e('0xd')](_0xce0e('0x62'),_0x4f6b7b['id']);return getTicket(_0x3fcbde,_0x4f9b72,_0x4f6b7b,_0xbf32c2,_0x40b656,_0xbf32c2[_0xce0e('0x63')],_0x249128,_0xce0e('0x64'));})[_0xce0e('0x3a')](function(_0x36c467){_0x137167=_0x36c467;logger[_0xce0e('0xd')](_0xce0e('0x65'));logger[_0xce0e('0xd')](_0xce0e('0x66'),_0x137167['id']);return setRelationship(_0x249128,_0x4f9b72,_0x137167,_0xce0e('0x67'));})[_0xce0e('0x3a')](function(){return setRelationship(_0x249128,_0x4f6b7b,_0x137167,_0xce0e('0x68'));})['then'](function(){return getServerInfo(_0x249128);})['then'](function(_0x11ac0e){var _0x11e92c=parseInt(_0x11ac0e['version']['charAt'](0x0));var _0x161608=util[_0xce0e('0x26')](_0xce0e('0x69'),_0x3fcbde['remoteUri'],_0x137167['id']);if(_0x11e92c>0x6){_0x161608=util[_0xce0e('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3fcbde['remoteUri'],_0x137167['id']);}logger[_0xce0e('0xd')](_0xce0e('0x5a'),_0xce0e('0x6a'));emit(util['format'](_0xce0e('0x6b'),_0x63aabc[_0xce0e('0xe')]),_0xce0e('0x6c'),{'uri':_0x161608});})['catch'](function(_0x3631e6){logger[_0xce0e('0x6d')](_0xce0e('0x5a'),JSON[_0xce0e('0x24')](_0x3631e6));});};exports['outbound']=function(_0xd2d63d,_0xe67e61,_0x11cbb1,_0x22910f,_0x1391bf,_0x247805,_0x26f9f8){var _0x328e11,_0xa9abe2,_0x5baec5,_0x6e6b11;_0x247805[_0xce0e('0x55')]=intUtil[_0xce0e('0x56')](_0x247805[_0xce0e('0x55')]);_0x247805[_0xce0e('0x57')]=intUtil[_0xce0e('0x56')](_0x247805[_0xce0e('0x57')]);def[_0xce0e('0x58')]=util[_0xce0e('0x26')](_0xce0e('0x59'),_0x247805['remoteUri']);if(_0x26f9f8&&_0x26f9f8[_0xce0e('0x6e')]&&_0x26f9f8[_0xce0e('0x6e')]!==_0xce0e('0x6f')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0xe67e61[_0xce0e('0x5c')]=util[_0xce0e('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x247805[_0xce0e('0x57')],_0xe67e61[_0xce0e('0x5e')],md5(_0xe67e61[_0xce0e('0x5e')]));}return getConnection(_0x247805)[_0xce0e('0x3a')](function(_0x4eac0d){_0x6e6b11=_0x4eac0d;return getUser(_0x247805,_0x22910f[_0xce0e('0xe')],_0x6e6b11);})['then'](function(_0x2d1d7e){_0x328e11=_0x2d1d7e;logger[_0xce0e('0xd')](_0xce0e('0x5f'),_0x328e11['id']);return getEndUser(_0x247805,_0xe67e61[_0xce0e('0x70')],_0xe67e61[_0xce0e('0x71')],_0x6e6b11);})[_0xce0e('0x3a')](function(_0xe00a1a){_0xa9abe2=_0xe00a1a;logger['info'](_0xce0e('0x62'),_0xa9abe2['id']);return getTicket(_0x247805,_0x328e11,_0xa9abe2,_0x11cbb1,_0xe67e61,_0x11cbb1[_0xce0e('0x63')],_0x6e6b11,_0xce0e('0x72'));})[_0xce0e('0x3a')](function(_0x210605){_0x5baec5=_0x210605;logger[_0xce0e('0xd')](_0xce0e('0x65'));logger[_0xce0e('0xd')](_0xce0e('0x66'),_0x5baec5['id']);return setRelationship(_0x6e6b11,_0x328e11,_0x5baec5,_0xce0e('0x67'));})[_0xce0e('0x3a')](function(){return setRelationship(_0x6e6b11,_0xa9abe2,_0x5baec5,'contacts');})[_0xce0e('0x3a')](function(){return getServerInfo(_0x6e6b11);})[_0xce0e('0x3a')](function(_0x195fdf){var _0x26f886=parseInt(_0x195fdf[_0xce0e('0x73')][_0xce0e('0x74')](0x0));var _0x363515=util[_0xce0e('0x26')](_0xce0e('0x69'),_0x247805[_0xce0e('0x55')],_0x5baec5['id']);if(_0x26f886>0x6){_0x363515=util[_0xce0e('0x26')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x247805[_0xce0e('0x55')],_0x5baec5['id']);}logger[_0xce0e('0xd')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xce0e('0x26')]('user:%s',_0x22910f['name']),_0xce0e('0x6c'),{'uri':_0x363515});})['catch'](function(_0x5ba7d0){logger['error']('[OUTBOUND]',JSON[_0xce0e('0x24')](_0x5ba7d0));});};exports['unmanaged']=function(_0x6af211,_0x1c1cdd,_0xc1c6df,_0x37f90a,_0x503ae7,_0x8afd2e){var _0x12a51c,_0x4e0d21,_0x1c58e7,_0x3fc73f;_0x8afd2e[_0xce0e('0x55')]=intUtil[_0xce0e('0x56')](_0x8afd2e[_0xce0e('0x55')]);_0x8afd2e[_0xce0e('0x57')]=intUtil['stripTrailingSlash'](_0x8afd2e[_0xce0e('0x57')]);def[_0xce0e('0x58')]=util[_0xce0e('0x26')]('%s/service/v4_1/rest.php',_0x8afd2e[_0xce0e('0x55')]);if(_0x503ae7&&_0x503ae7[_0xce0e('0x75')]){logger['info']('['+_0x1c1cdd['lastevent'][_0xce0e('0x76')]()+']',_0xce0e('0x5b'));_0x1c1cdd[_0xce0e('0x5c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x8afd2e[_0xce0e('0x57')],_0x1c1cdd[_0xce0e('0x5e')],md5(_0x1c1cdd[_0xce0e('0x5e')]));}else{_0x1c1cdd[_0xce0e('0x5c')]='';}return getConnection(_0x8afd2e)['then'](function(_0x5c518a){_0x3fc73f=_0x5c518a;if(!_['isNil'](_0x37f90a)){return getUser(_0x8afd2e,_0x37f90a[_0xce0e('0xe')],_0x3fc73f);}else{return getUser(_0x8afd2e,null,_0x3fc73f);}})['then'](function(_0x574f3e){_0x12a51c=_0x574f3e;logger[_0xce0e('0xd')](_0xce0e('0x5f'),_0x12a51c['id']);return getEndUser(_0x8afd2e,_0x1c1cdd[_0xce0e('0x60')],_0x1c1cdd[_0xce0e('0x61')],_0x3fc73f);})[_0xce0e('0x3a')](function(_0x6efe39){_0x4e0d21=_0x6efe39;logger[_0xce0e('0xd')](_0xce0e('0x62'),_0x4e0d21['id']);return getTicket(_0x8afd2e,_0x12a51c,_0x4e0d21,_0xc1c6df,_0x1c1cdd,_0xc1c6df[_0xce0e('0x63')],_0x3fc73f,'Inbound');})['then'](function(_0x595fd3){_0x1c58e7=_0x595fd3;logger[_0xce0e('0xd')](_0xce0e('0x65'));logger[_0xce0e('0xd')](_0xce0e('0x66'),_0x1c58e7['id']);return setRelationship(_0x3fc73f,_0x12a51c,_0x1c58e7,_0xce0e('0x67'));})[_0xce0e('0x3a')](function(){return setRelationship(_0x3fc73f,_0x4e0d21,_0x1c58e7,'contacts');})[_0xce0e('0x3a')](function(){return getServerInfo(_0x3fc73f);})[_0xce0e('0x77')](function(_0x3ccbfd){logger[_0xce0e('0x6d')]('['+_0x1c1cdd[_0xce0e('0x78')][_0xce0e('0x76')]()+']',JSON[_0xce0e('0x24')](_0x3ccbfd));});}; \ No newline at end of file +var _0x77df=['unmanaged','monitor_format','toUpperCase','Inbound','lastevent','lodash','request-promise','bluebird','md5','util','./util','../../../../config/logger','redis','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','duration_hours','duration_minutes','parent_id','parent_type','Contacts','name','direction','length','variableName','push','idField','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','get_entry_list','stringify','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','Agent\x20found!','resolve','name_value_list','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','forEach','type','nameField','toLowerCase','content','customField','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','remoteUri','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x77df,0x1ed));var _0xf77d=function(_0x15f39a,_0x4ae9ae){_0x15f39a=_0x15f39a-0x0;var _0x186e52=_0x77df[_0x15f39a];return _0x186e52;};'use strict';var _=require(_0xf77d('0x0'));var rp=require(_0xf77d('0x1'));var BPromise=require(_0xf77d('0x2'));var md5=require(_0xf77d('0x3'));var util=require(_0xf77d('0x4'));var Redis=require('ioredis');var intUtil=require(_0xf77d('0x5'));var config=require('../../../../config/environment');var logger=require(_0xf77d('0x6'))('sugarcrm');config['redis']=_['defaults'](config[_0xf77d('0x7')],{'host':_0xf77d('0x8'),'port':0x18eb});var io=require(_0xf77d('0x9'))(new Redis(config[_0xf77d('0x7')]));var def={'method':_0xf77d('0xa'),'json':!![]};function emit(_0x4c7d79,_0x3603c3,_0x42faaf){io['to'](_0x4c7d79)['emit'](_0x3603c3,_0x42faaf);}function getTicket(_0x7a64b3,_0x20a31f,_0x5a6fbc,_0x386997,_0x4719fc,_0x11bc17,_0x37410f,_0x4eb302){logger[_0xf77d('0xb')](_0xf77d('0xc'));var _0x1878b3=new Date();var _0x51d9ad=[{'name':'name','value':intUtil[_0xf77d('0xd')](_0x386997[_0xf77d('0xe')],_0x4719fc,'\x20')},{'name':_0xf77d('0xf'),'value':_0x20a31f['id']},{'name':_0xf77d('0x10'),'value':_0x20a31f['id']},{'name':_0xf77d('0x11'),'value':intUtil[_0xf77d('0xd')](_0x386997[_0xf77d('0x12')],_0x4719fc,'\x0a')},{'name':_0xf77d('0x13'),'value':_0x1878b3[_0xf77d('0x14')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0xf77d('0x15'),'value':'0'},{'name':_0xf77d('0x16'),'value':'15'},{'name':_0xf77d('0x17'),'value':_0x5a6fbc['id']},{'name':_0xf77d('0x18'),'value':_0xf77d('0x19')},{'name':'parent_name','value':_0x5a6fbc[_0xf77d('0x1a')]},{'name':_0xf77d('0x1b'),'value':_0x4eb302}];if(_0x11bc17[_0xf77d('0x1c')]){_['forEach'](_0x11bc17,function(_0x246314){if(_0x4719fc[_0x246314[_0xf77d('0x1d')]]){_0x51d9ad[_0xf77d('0x1e')]({'name':_0x246314[_0xf77d('0x1f')],'value':_0x4719fc[_0x246314[_0xf77d('0x1d')]]});}});}return request({'form':{'method':_0xf77d('0x20'),'input_type':_0xf77d('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x37410f['id'],'module_name':_0xf77d('0x22'),'name_value_list':_0x51d9ad})}});}function getAuth(_0x17f2e0){return util[_0xf77d('0x23')](_0xf77d('0x24'),new Buffer(_0x17f2e0[_0xf77d('0x25')]+':X')[_0xf77d('0x26')](_0xf77d('0x27')));}function getServerInfo(_0x4dc71a){return request({'form':{'method':_0xf77d('0x28'),'input_type':'JSON','response_type':_0xf77d('0x21'),'rest_data':JSON['stringify']({'session':_0x4dc71a['id']})}});}function getUser(_0x54ba20,_0x5f4261,_0x219b88){if(!_[_0xf77d('0x29')](_0x5f4261)){logger['info']('Getting\x20agent\x20with\x20name',_0x5f4261);return request({'form':{'method':_0xf77d('0x2a'),'input_type':'JSON','response_type':_0xf77d('0x21'),'rest_data':JSON[_0xf77d('0x2b')]({'session':_0x219b88['id'],'module_name':_0xf77d('0x2c'),'query':util[_0xf77d('0x23')](_0xf77d('0x2d'),_0x5f4261),'order_by':'','offset':'0','select_fields':['id',_0xf77d('0x1a'),_0xf77d('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf77d('0x2f')](function(_0x57145d){if(_0x57145d['entry_list'][_0xf77d('0x1c')]){var _0x1a97bb=_['find'](_0x57145d[_0xf77d('0x30')],function(_0x59e1bb){return _0x59e1bb['name_value_list'][_0xf77d('0x2e')]['value']===_0x5f4261;});if(_0x1a97bb){logger[_0xf77d('0xb')](_0xf77d('0x31'));return BPromise[_0xf77d('0x32')]({'id':_0x1a97bb['name_value_list']['id']['value'],'name':_0x1a97bb[_0xf77d('0x33')][_0xf77d('0x1a')][_0xf77d('0x34')]});}}logger[_0xf77d('0xb')](_0xf77d('0x35'));return BPromise[_0xf77d('0x32')]({'id':_0x219b88['name_value_list']['user_id'][_0xf77d('0x34')],'name':_0x219b88['name_value_list'][_0xf77d('0x2e')][_0xf77d('0x34')]});});}else{logger[_0xf77d('0xb')](_0xf77d('0x36'));return BPromise[_0xf77d('0x32')]({'id':_0x219b88[_0xf77d('0x33')][_0xf77d('0x37')][_0xf77d('0x34')],'name':_0x219b88['name_value_list'][_0xf77d('0x2e')][_0xf77d('0x34')]});}}function getEndUser(_0x2678b6,_0x3242f0,_0x1ffbea,_0x4b6d04){logger[_0xf77d('0xb')](_0xf77d('0x38'),_0x1ffbea);return request({'form':{'method':_0xf77d('0x2a'),'input_type':_0xf77d('0x21'),'response_type':'JSON','rest_data':JSON[_0xf77d('0x2b')]({'session':_0x4b6d04['id'],'module_name':_0xf77d('0x19'),'query':util[_0xf77d('0x23')](_0xf77d('0x39'),_0x1ffbea),'order_by':'','offset':'0','select_fields':['id',_0xf77d('0x1a'),_0xf77d('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x334fdb){if(_0x334fdb[_0xf77d('0x30')][_0xf77d('0x1c')]){var _0x596e2b=_[_0xf77d('0x3b')](_0x334fdb[_0xf77d('0x30')],function(_0x46558a){return _0x46558a[_0xf77d('0x33')][_0xf77d('0x3a')][_0xf77d('0x34')]===_0x1ffbea;});if(_0x596e2b){logger[_0xf77d('0xb')]('Enduser\x20found!');return BPromise[_0xf77d('0x32')]({'id':_0x596e2b[_0xf77d('0x33')]['id'][_0xf77d('0x34')],'name':_0x596e2b['name_value_list'][_0xf77d('0x1a')][_0xf77d('0x34')],'phone':_0x596e2b[_0xf77d('0x33')][_0xf77d('0x3a')]['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xf77d('0x20'),'input_type':_0xf77d('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4b6d04['id'],'module_name':_0xf77d('0x19'),'name_value_list':[{'name':'first_name','value':_0x3242f0!==_0xf77d('0x3c')?_0x3242f0:util['format'](_0xf77d('0x3d'),_0x1ffbea)},{'name':'phone_home','value':_0x1ffbea}]})}})[_0xf77d('0x2f')](function(_0x2113b9){logger['info'](_0xf77d('0x3e'));return BPromise[_0xf77d('0x32')]({'id':_0x2113b9['id'],'name':_0x2113b9[_0xf77d('0x30')][_0xf77d('0x3f')]['value'],'phone':_0x2113b9[_0xf77d('0x30')][_0xf77d('0x3a')][_0xf77d('0x34')]});});}});}function request(_0x4a007c){logger[_0xf77d('0x40')](_0xf77d('0x41'),JSON['stringify'](_0x4a007c));return rp(_[_0xf77d('0x42')](def,_0x4a007c));}function getTags(_0x180fc6,_0x1b6c22){var _0x329296=[];if(_0x180fc6&&_0x180fc6[_0xf77d('0x1c')]>0x0){_0x329296=_[_0xf77d('0x43')](_0x180fc6,_0x1b6c22);}return _0x329296;}function getCustomFields(_0x119f40,_0x4e34fb){var _0x552a55=[];var _0x528737={'custom_fields':[]};if(_0x119f40['length']>0x0){_[_0xf77d('0x44')](_0x119f40,function(_0x4709f3){if(_0x4709f3[_0xf77d('0x45')]==='string'&&_0x4709f3[_0xf77d('0x46')]&&!_0x4709f3['customField']){_0x528737[_0x4709f3[_0xf77d('0x46')][_0xf77d('0x47')]()]=_0x4709f3[_0xf77d('0x48')][_0xf77d('0x26')]();}else if(_0x4709f3[_0xf77d('0x45')]==='string'&&_0x4709f3[_0xf77d('0x1f')]&&_0x4709f3[_0xf77d('0x49')]){_0x528737['custom_fields']['push']({'id':_0x4709f3[_0xf77d('0x1f')],'value':_0x4709f3[_0xf77d('0x48')][_0xf77d('0x26')]()});}else if(_0x4709f3[_0xf77d('0x45')]==='variable'&&_0x4709f3[_0xf77d('0x1d')]&&_0x4709f3[_0xf77d('0x1f')]&&_0x4709f3['customField']){_0x4e34fb[_0x4709f3[_0xf77d('0x1d')]]&&_0x528737['custom_fields']['push']({'id':_0x4709f3[_0xf77d('0x1f')],'value':_0x4e34fb[_0x4709f3[_0xf77d('0x1d')]]['toString']()});}else if(_0x4709f3[_0xf77d('0x45')]==='customVariable'&&_0x4709f3[_0xf77d('0x4a')]&&_0x4709f3[_0xf77d('0x4a')][_0xf77d('0x1a')]&&_0x4709f3[_0xf77d('0x1f')]&&_0x4709f3[_0xf77d('0x49')]){_0x4e34fb[_0x4709f3['Variable'][_0xf77d('0x1a')][_0xf77d('0x47')]()]&&_0x528737['custom_fields'][_0xf77d('0x1e')]({'id':_0x4709f3[_0xf77d('0x1f')],'value':_0x4e34fb[_0x4709f3[_0xf77d('0x4a')][_0xf77d('0x1a')]['toLowerCase']()][_0xf77d('0x26')]()});}});}return _0x528737;}function getConnection(_0x1bc03d){return request({'method':_0xf77d('0xa'),'form':{'method':_0xf77d('0x4b'),'input_type':_0xf77d('0x21'),'response_type':_0xf77d('0x21'),'rest_data':JSON[_0xf77d('0x2b')]({'user_auth':{'user_name':_0x1bc03d[_0xf77d('0x4c')],'password':_0x1bc03d['password'],'encryption':_0xf77d('0x4d')},'application':_0xf77d('0x4e')})}})[_0xf77d('0x2f')](function(_0x5e5ea5){var _0x1692f8=_0x5e5ea5;if(_0x1692f8['id']){def[_0xf77d('0x4f')]=_0x1692f8['id'];return BPromise[_0xf77d('0x32')](_0x1692f8);}else{throw new Error(util[_0xf77d('0x23')](_0xf77d('0x50'),_0x1bc03d['id']));}});}function setRelationship(_0x2d7c0e,_0x1091e3,_0x55a252,_0x434d7e){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xf77d('0x2b')]({'session':_0x2d7c0e['id'],'module_name':'Calls','module_id':_0x55a252['id'],'link_field_name':_0x434d7e,'related_ids':[_0x1091e3['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf77d('0x51')]=function(_0x5bbfd6,_0x1b5668,_0x24ec90,_0xeb5359,_0x42eedd,_0x871fdd){var _0x5ca0c1,_0x289e6a,_0x1b91f5,_0x39dccc;_0x871fdd['remoteUri']=intUtil['stripTrailingSlash'](_0x871fdd['remoteUri']);_0x871fdd['serverUrl']=intUtil[_0xf77d('0x52')](_0x871fdd[_0xf77d('0x53')]);def[_0xf77d('0x54')]=util[_0xf77d('0x23')](_0xf77d('0x55'),_0x871fdd[_0xf77d('0x56')]);if(_0x42eedd&&_0x42eedd['monitor_format']){logger[_0xf77d('0xb')](_0xf77d('0x57'),'Recording\x20is\x20enabled!');_0x1b5668[_0xf77d('0x58')]=util[_0xf77d('0x23')](_0xf77d('0x59'),_0x871fdd['serverUrl'],_0x1b5668[_0xf77d('0x5a')],md5(_0x1b5668[_0xf77d('0x5a')]));}else{_0x1b5668[_0xf77d('0x58')]='';}return getConnection(_0x871fdd)[_0xf77d('0x2f')](function(_0x477287){_0x39dccc=_0x477287;return getUser(_0x871fdd,_0xeb5359[_0xf77d('0x1a')],_0x39dccc);})['then'](function(_0x556289){_0x5ca0c1=_0x556289;logger[_0xf77d('0xb')](_0xf77d('0x5b'),_0x5ca0c1['id']);return getEndUser(_0x871fdd,_0x1b5668[_0xf77d('0x5c')],_0x1b5668[_0xf77d('0x5d')],_0x39dccc);})[_0xf77d('0x2f')](function(_0x227b4c){_0x289e6a=_0x227b4c;logger[_0xf77d('0xb')](_0xf77d('0x5e'),_0x289e6a['id']);return getTicket(_0x871fdd,_0x5ca0c1,_0x289e6a,_0x24ec90,_0x1b5668,_0x24ec90[_0xf77d('0x5f')],_0x39dccc,'Inbound');})[_0xf77d('0x2f')](function(_0x3ddb97){_0x1b91f5=_0x3ddb97;logger[_0xf77d('0xb')](_0xf77d('0x60'));logger[_0xf77d('0xb')](_0xf77d('0x61'),_0x1b91f5['id']);return setRelationship(_0x39dccc,_0x5ca0c1,_0x1b91f5,_0xf77d('0x62'));})['then'](function(){return setRelationship(_0x39dccc,_0x289e6a,_0x1b91f5,'contacts');})[_0xf77d('0x2f')](function(){return getServerInfo(_0x39dccc);})[_0xf77d('0x2f')](function(_0xa02b83){var _0xc740a6=parseInt(_0xa02b83[_0xf77d('0x63')]['charAt'](0x0));var _0x469634=util[_0xf77d('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x871fdd[_0xf77d('0x56')],_0x1b91f5['id']);if(_0xc740a6>0x6){_0x469634=util[_0xf77d('0x23')](_0xf77d('0x64'),_0x871fdd[_0xf77d('0x56')],_0x1b91f5['id']);}logger['info'](_0xf77d('0x57'),_0xf77d('0x65'));emit(util['format'](_0xf77d('0x66'),_0xeb5359[_0xf77d('0x1a')]),_0xf77d('0x67'),{'uri':_0x469634});})[_0xf77d('0x68')](function(_0x49231e){logger[_0xf77d('0x69')]('[QUEUE]',JSON['stringify'](_0x49231e));});};exports[_0xf77d('0x6a')]=function(_0x4fec05,_0x4dbf2d,_0x51eb66,_0x55d6e5,_0x3c2844,_0x35e077,_0x5512cb){var _0x1e46d5,_0xf0b0ea,_0x110023,_0x1fceaf;_0x35e077[_0xf77d('0x56')]=intUtil[_0xf77d('0x52')](_0x35e077[_0xf77d('0x56')]);_0x35e077[_0xf77d('0x53')]=intUtil['stripTrailingSlash'](_0x35e077[_0xf77d('0x53')]);def[_0xf77d('0x54')]=util['format'](_0xf77d('0x55'),_0x35e077[_0xf77d('0x56')]);if(_0x5512cb&&_0x5512cb[_0xf77d('0x6b')]&&_0x5512cb[_0xf77d('0x6b')]!==_0xf77d('0x6c')){logger[_0xf77d('0xb')]('[OUTBOUND]',_0xf77d('0x6d'));_0x4dbf2d[_0xf77d('0x58')]=util[_0xf77d('0x23')](_0xf77d('0x59'),_0x35e077[_0xf77d('0x53')],_0x4dbf2d['uniqueid'],md5(_0x4dbf2d[_0xf77d('0x5a')]));}return getConnection(_0x35e077)[_0xf77d('0x2f')](function(_0x57d877){_0x1fceaf=_0x57d877;return getUser(_0x35e077,_0x55d6e5[_0xf77d('0x1a')],_0x1fceaf);})[_0xf77d('0x2f')](function(_0x498624){_0x1e46d5=_0x498624;logger[_0xf77d('0xb')](_0xf77d('0x5b'),_0x1e46d5['id']);return getEndUser(_0x35e077,_0x4dbf2d[_0xf77d('0x6e')],_0x4dbf2d[_0xf77d('0x6f')],_0x1fceaf);})['then'](function(_0x413363){_0xf0b0ea=_0x413363;logger[_0xf77d('0xb')](_0xf77d('0x5e'),_0xf0b0ea['id']);return getTicket(_0x35e077,_0x1e46d5,_0xf0b0ea,_0x51eb66,_0x4dbf2d,_0x51eb66[_0xf77d('0x5f')],_0x1fceaf,_0xf77d('0x70'));})[_0xf77d('0x2f')](function(_0xc3edaa){_0x110023=_0xc3edaa;logger['info'](_0xf77d('0x60'));logger[_0xf77d('0xb')](_0xf77d('0x61'),_0x110023['id']);return setRelationship(_0x1fceaf,_0x1e46d5,_0x110023,_0xf77d('0x62'));})[_0xf77d('0x2f')](function(){return setRelationship(_0x1fceaf,_0xf0b0ea,_0x110023,_0xf77d('0x71'));})[_0xf77d('0x2f')](function(){return getServerInfo(_0x1fceaf);})['then'](function(_0x55a2da){var _0xb975e4=parseInt(_0x55a2da[_0xf77d('0x63')][_0xf77d('0x72')](0x0));var _0x4a3c20=util[_0xf77d('0x23')](_0xf77d('0x73'),_0x35e077[_0xf77d('0x56')],_0x110023['id']);if(_0xb975e4>0x6){_0x4a3c20=util['format'](_0xf77d('0x64'),_0x35e077[_0xf77d('0x56')],_0x110023['id']);}logger[_0xf77d('0xb')](_0xf77d('0x74'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf77d('0x23')](_0xf77d('0x66'),_0x55d6e5[_0xf77d('0x1a')]),_0xf77d('0x67'),{'uri':_0x4a3c20});})[_0xf77d('0x68')](function(_0x8a4ff4){logger[_0xf77d('0x69')](_0xf77d('0x74'),JSON[_0xf77d('0x2b')](_0x8a4ff4));});};exports[_0xf77d('0x75')]=function(_0x2af0fc,_0x4ccc06,_0x4a940a,_0x413d9e,_0x59d47c,_0x416d67){var _0x100fa2,_0x3f958c,_0x12b112,_0x5013bb;_0x416d67['remoteUri']=intUtil[_0xf77d('0x52')](_0x416d67['remoteUri']);_0x416d67[_0xf77d('0x53')]=intUtil[_0xf77d('0x52')](_0x416d67[_0xf77d('0x53')]);def[_0xf77d('0x54')]=util[_0xf77d('0x23')](_0xf77d('0x55'),_0x416d67[_0xf77d('0x56')]);if(_0x59d47c&&_0x59d47c[_0xf77d('0x76')]){logger[_0xf77d('0xb')]('['+_0x4ccc06['lastevent'][_0xf77d('0x77')]()+']',_0xf77d('0x6d'));_0x4ccc06[_0xf77d('0x58')]=util[_0xf77d('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x416d67[_0xf77d('0x53')],_0x4ccc06[_0xf77d('0x5a')],md5(_0x4ccc06[_0xf77d('0x5a')]));}else{_0x4ccc06[_0xf77d('0x58')]='';}return getConnection(_0x416d67)[_0xf77d('0x2f')](function(_0x474acd){_0x5013bb=_0x474acd;if(!_[_0xf77d('0x29')](_0x413d9e)){return getUser(_0x416d67,_0x413d9e[_0xf77d('0x1a')],_0x5013bb);}else{return getUser(_0x416d67,null,_0x5013bb);}})['then'](function(_0x1012c0){_0x100fa2=_0x1012c0;logger[_0xf77d('0xb')](_0xf77d('0x5b'),_0x100fa2['id']);return getEndUser(_0x416d67,_0x4ccc06[_0xf77d('0x5c')],_0x4ccc06['calleridnum'],_0x5013bb);})[_0xf77d('0x2f')](function(_0x5ed086){_0x3f958c=_0x5ed086;logger[_0xf77d('0xb')](_0xf77d('0x5e'),_0x3f958c['id']);return getTicket(_0x416d67,_0x100fa2,_0x3f958c,_0x4a940a,_0x4ccc06,_0x4a940a['Fields'],_0x5013bb,_0xf77d('0x78'));})[_0xf77d('0x2f')](function(_0xc687b3){_0x12b112=_0xc687b3;logger[_0xf77d('0xb')](_0xf77d('0x60'));logger[_0xf77d('0xb')](_0xf77d('0x61'),_0x12b112['id']);return setRelationship(_0x5013bb,_0x100fa2,_0x12b112,_0xf77d('0x62'));})[_0xf77d('0x2f')](function(){return setRelationship(_0x5013bb,_0x3f958c,_0x12b112,_0xf77d('0x71'));})['then'](function(){return getServerInfo(_0x5013bb);})['catch'](function(_0x3ca841){logger[_0xf77d('0x69')]('['+_0x4ccc06[_0xf77d('0x79')][_0xf77d('0x77')]()+']',JSON[_0xf77d('0x2b')](_0x3ca841));});}; \ 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 6e3e78b..e5dd9df 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 _0x8b0c=['push','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','test','lodash','util','getString','sortBy','type','content','variable','variableName'];(function(_0x4b6c20,_0x2f019a){var _0x85861b=function(_0x5d9670){while(--_0x5d9670){_0x4b6c20['push'](_0x4b6c20['shift']());}};_0x85861b(++_0x2f019a);}(_0x8b0c,0x14a));var _0xc8b0=function(_0x546229,_0x21ca37){_0x546229=_0x546229-0x0;var _0x29a3ca=_0x8b0c[_0x546229];return _0x29a3ca;};'use strict';var _=require(_0xc8b0('0x0'));var util=require(_0xc8b0('0x1'));exports[_0xc8b0('0x2')]=function(_0x21bdb8,_0x41e684,_0x2b9487){var _0x4b4e3f=[];if(_0x21bdb8['length']>0x0){var _0x1c4b0e=_[_0xc8b0('0x3')](_0x21bdb8,['id']);for(var _0x52409a=0x0;_0x52409a<_0x1c4b0e['length'];_0x52409a++){var _0x23b6d6=_0x1c4b0e[_0x52409a];if(_0x23b6d6[_0xc8b0('0x4')]==='string'){_0x4b4e3f['push'](_0x23b6d6[_0xc8b0('0x5')]);}else if(_0x23b6d6[_0xc8b0('0x4')]===_0xc8b0('0x6')&&_0x23b6d6['variableName']){_0x41e684[_0x23b6d6[_0xc8b0('0x7')]]&&_0x4b4e3f[_0xc8b0('0x8')](_0x41e684[_0x23b6d6[_0xc8b0('0x7')]][_0xc8b0('0x9')]());}else if(_0x23b6d6[_0xc8b0('0x4')]===_0xc8b0('0xa')&&_0x23b6d6['Variable']&&_0x23b6d6[_0xc8b0('0xb')][_0xc8b0('0xc')]){_0x41e684[_0x23b6d6[_0xc8b0('0xb')]['name'][_0xc8b0('0xd')]()]&&_0x4b4e3f['push'](_0x41e684[_0x23b6d6[_0xc8b0('0xb')][_0xc8b0('0xc')][_0xc8b0('0xd')]()][_0xc8b0('0x9')]());}else if(_0x23b6d6[_0xc8b0('0x4')]===_0xc8b0('0xe')){if(_0x23b6d6[_0xc8b0('0xf')]===_0xc8b0('0x10')&&_0x23b6d6[_0xc8b0('0x11')]){_0x4b4e3f[_0xc8b0('0x8')](util[_0xc8b0('0x12')](_0xc8b0('0x13'),_0x23b6d6[_0xc8b0('0x11')],_0x23b6d6[_0xc8b0('0x14')]));}else if(_0x23b6d6[_0xc8b0('0xf')]===_0xc8b0('0x6')&&_0x23b6d6[_0xc8b0('0x7')]&&_0x23b6d6[_0xc8b0('0x11')]){_0x41e684[_0x23b6d6[_0xc8b0('0x7')]]&&_0x4b4e3f[_0xc8b0('0x8')](util['format'](_0xc8b0('0x13'),_0x23b6d6[_0xc8b0('0x11')],_0x41e684[_0x23b6d6[_0xc8b0('0x7')]]));}else if(_0x23b6d6[_0xc8b0('0xf')]===_0xc8b0('0xa')&&_0x23b6d6[_0xc8b0('0xb')]&&_0x23b6d6[_0xc8b0('0xb')][_0xc8b0('0xc')]&&_0x23b6d6[_0xc8b0('0x11')]){_0x41e684[_0x23b6d6[_0xc8b0('0xb')][_0xc8b0('0xc')]['toLowerCase']()]&&_0x4b4e3f[_0xc8b0('0x8')](util[_0xc8b0('0x12')]('%s:\x20%s',_0x23b6d6[_0xc8b0('0x11')],_0x41e684[_0x23b6d6[_0xc8b0('0xb')][_0xc8b0('0xc')][_0xc8b0('0xd')]()]));}}}}return _0x4b4e3f[_0xc8b0('0x15')](_0x2b9487);};exports[_0xc8b0('0x16')]=function(_0x13e7ad){var _0x13508b=_0x13e7ad[_0xc8b0('0x17')](-0x1);if(_0x13508b==='/'){_0x13e7ad=_0x13e7ad[_0xc8b0('0x18')](0x0,_0x13e7ad['lastIndexOf'](_0x13508b));}return _0x13e7ad;};exports['validateEmail']=function(_0x16df8b){if(!_['isNil'](_0x16df8b)&&_0x16df8b!==''){var _0x3c228d=/^(([^<>()\[\]\\.,;:\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 _0x3c228d[_0xc8b0('0x19')](String(_0x16df8b)[_0xc8b0('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x70a5=['%s:\x20%s','stripTrailingSlash','slice','test','util','getString','sortBy','length','type','push','variable','variableName','toString','customVariable','Variable','toLowerCase','name','keyValue','keyType','string','key','format'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x70a5,0x1d2));var _0x570a=function(_0x593ee1,_0x55167f){_0x593ee1=_0x593ee1-0x0;var _0x1d2613=_0x70a5[_0x593ee1];return _0x1d2613;};'use strict';var _=require('lodash');var util=require(_0x570a('0x0'));exports[_0x570a('0x1')]=function(_0x57309a,_0x48704b,_0xf908f8){var _0x512eaa=[];if(_0x57309a['length']>0x0){var _0x5904db=_[_0x570a('0x2')](_0x57309a,['id']);for(var _0x19fa64=0x0;_0x19fa64<_0x5904db[_0x570a('0x3')];_0x19fa64++){var _0x1d886c=_0x5904db[_0x19fa64];if(_0x1d886c[_0x570a('0x4')]==='string'){_0x512eaa[_0x570a('0x5')](_0x1d886c['content']);}else if(_0x1d886c[_0x570a('0x4')]===_0x570a('0x6')&&_0x1d886c['variableName']){_0x48704b[_0x1d886c[_0x570a('0x7')]]&&_0x512eaa['push'](_0x48704b[_0x1d886c[_0x570a('0x7')]][_0x570a('0x8')]());}else if(_0x1d886c[_0x570a('0x4')]===_0x570a('0x9')&&_0x1d886c[_0x570a('0xa')]&&_0x1d886c[_0x570a('0xa')]['name']){_0x48704b[_0x1d886c[_0x570a('0xa')]['name'][_0x570a('0xb')]()]&&_0x512eaa[_0x570a('0x5')](_0x48704b[_0x1d886c['Variable'][_0x570a('0xc')][_0x570a('0xb')]()][_0x570a('0x8')]());}else if(_0x1d886c[_0x570a('0x4')]===_0x570a('0xd')){if(_0x1d886c[_0x570a('0xe')]===_0x570a('0xf')&&_0x1d886c[_0x570a('0x10')]){_0x512eaa['push'](util[_0x570a('0x11')](_0x570a('0x12'),_0x1d886c[_0x570a('0x10')],_0x1d886c['keyContent']));}else if(_0x1d886c['keyType']===_0x570a('0x6')&&_0x1d886c[_0x570a('0x7')]&&_0x1d886c[_0x570a('0x10')]){_0x48704b[_0x1d886c['variableName']]&&_0x512eaa[_0x570a('0x5')](util[_0x570a('0x11')](_0x570a('0x12'),_0x1d886c['key'],_0x48704b[_0x1d886c[_0x570a('0x7')]]));}else if(_0x1d886c[_0x570a('0xe')]===_0x570a('0x9')&&_0x1d886c['Variable']&&_0x1d886c[_0x570a('0xa')]['name']&&_0x1d886c[_0x570a('0x10')]){_0x48704b[_0x1d886c['Variable'][_0x570a('0xc')][_0x570a('0xb')]()]&&_0x512eaa[_0x570a('0x5')](util[_0x570a('0x11')]('%s:\x20%s',_0x1d886c[_0x570a('0x10')],_0x48704b[_0x1d886c[_0x570a('0xa')][_0x570a('0xc')][_0x570a('0xb')]()]));}}}}return _0x512eaa['join'](_0xf908f8);};exports[_0x570a('0x13')]=function(_0x4a72c4){var _0x2299d0=_0x4a72c4[_0x570a('0x14')](-0x1);if(_0x2299d0==='/'){_0x4a72c4=_0x4a72c4['substring'](0x0,_0x4a72c4['lastIndexOf'](_0x2299d0));}return _0x4a72c4;};exports['validateEmail']=function(_0x1253b3){if(!_['isNil'](_0x1253b3)&&_0x1253b3!==''){var _0x3ba970=/^(([^<>()\[\]\\.,;:\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 _0x3ba970[_0x570a('0x15')](String(_0x1253b3)[_0x570a('0xb')]());}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 cb21d3b..ce90f5b 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(_0x42fd19,_0x4b18d4){var _0x3c9159=function(_0x1d0193){while(--_0x1d0193){_0x42fd19['push'](_0x42fd19['shift']());}};_0x3c9159(++_0x4b18d4);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'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 _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(_0x454305,_0x188d34){var _0x5f0093=function(_0x24f38c){while(--_0x24f38c){_0x454305['push'](_0x454305['shift']());}};_0x5f0093(++_0x188d34);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index fb38962..b805f11 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 _0x7040=['Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','emit','application/json','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','info','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','authType','password','username','token','%s/token:%s','toString','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','customField','nameField','type','push','content','variable','variableName','custom_fields','Variable','idField','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]'];(function(_0x341f3d,_0x505795){var _0x4d759c=function(_0x3fbd1c){while(--_0x3fbd1c){_0x341f3d['push'](_0x341f3d['shift']());}};_0x4d759c(++_0x505795);}(_0x7040,0x1ce));var _0x0704=function(_0x22d664,_0x459d09){_0x22d664=_0x22d664-0x0;var _0x23f910=_0x7040[_0x22d664];return _0x23f910;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x0704('0x0'));var util=require(_0x0704('0x1'));var Redis=require(_0x0704('0x2'));var intUtil=require(_0x0704('0x3'));var config=require(_0x0704('0x4'));var logger=require(_0x0704('0x5'))('zendesk');config['redis']=_[_0x0704('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x592c40,_0x1a9423,_0x5ba563){io['to'](_0x592c40)[_0x0704('0x7')](_0x1a9423,_0x5ba563);}var headers={'Content-Type':_0x0704('0x8'),'Accept':_0x0704('0x8')};function getTicket(_0x579236,_0x4e82c9,_0xee7070,_0x2e5354,_0xcbfe48){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0x0704('0x9')](_0x0704('0xa'),_0x579236[_0x0704('0xb')]),'method':_0x0704('0xc'),'body':{'ticket':_[_0x0704('0xd')]({'requester_id':_0xee7070['id'],'submitter_id':_0x4e82c9?_0x4e82c9['id']:undefined,'assignee_id':_0x4e82c9?_0x4e82c9['id']:undefined,'tags':getTags(_0x2e5354[_0x0704('0xe')],_0x0704('0xf')),'subject':intUtil[_0x0704('0x10')](_0x2e5354['Subjects'],_0xcbfe48,'\x20'),'description':intUtil[_0x0704('0x10')](_0x2e5354[_0x0704('0x11')],_0xcbfe48,'\x0a'),'comment':{'public':![],'body':intUtil[_0x0704('0x10')](_0x2e5354[_0x0704('0x11')],_0xcbfe48,'\x0a')}},getCustomFields(_0x2e5354[_0x0704('0x12')],_0xcbfe48))}})[_0x0704('0x13')](function(_0x4ab87f){logger['info'](_0x0704('0x14'));return _0x4ab87f[_0x0704('0x15')];});}function getUser(_0x844039,_0x3e8fa5){if(intUtil[_0x0704('0x16')](_0x3e8fa5)){logger[_0x0704('0x17')](_0x0704('0x18'),_0x3e8fa5);return request({'uri':util['format'](_0x0704('0x19'),_0x844039[_0x0704('0xb')]),'qs':{'query':util[_0x0704('0x9')](_0x0704('0x1a'),_0x3e8fa5)}})[_0x0704('0x13')](function(_0x1bdbf1){if(_0x1bdbf1['count']){logger['info'](_0x0704('0x1b'));return _[_0x0704('0x1c')](_0x1bdbf1[_0x0704('0x1d')],{'email':_0x3e8fa5,'role':_0x0704('0x1e')});}else{logger[_0x0704('0x17')](_0x0704('0x1f'));return request({'uri':util[_0x0704('0x9')](_0x0704('0x20'),_0x844039[_0x0704('0xb')])})[_0x0704('0x13')](function(_0x50f680){logger[_0x0704('0x17')](_0x0704('0x21'));return _0x50f680[_0x0704('0x22')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x0704('0x20'),_0x844039[_0x0704('0xb')])})[_0x0704('0x13')](function(_0x531c1c){logger[_0x0704('0x17')](_0x0704('0x21'));return _0x531c1c[_0x0704('0x22')];});}}function getEndUser(_0x126592,_0x1d825d,_0x270549){logger[_0x0704('0x17')](_0x0704('0x23'),_0x270549);return request({'uri':util[_0x0704('0x9')]('%s/search.json',_0x126592[_0x0704('0xb')]),'qs':{'query':util[_0x0704('0x9')](_0x0704('0x24'),_0x270549)}})[_0x0704('0x13')](function(_0x227ae2){var _0x4ab484;if(_0x227ae2[_0x0704('0x1d')][_0x0704('0x25')]){_0x227ae2['results']=_[_0x0704('0x26')](_0x227ae2[_0x0704('0x1d')],{'suspended':![],'role':_0x0704('0x27')});if(_0x227ae2[_0x0704('0x1d')][_0x0704('0x25')]){_0x4ab484=_[_0x0704('0x28')](_0x227ae2[_0x0704('0x1d')]);}}if(_0x4ab484){logger[_0x0704('0x17')](_0x0704('0x29'));return _0x4ab484;}else{logger[_0x0704('0x17')](_0x0704('0x2a'));return request({'uri':util[_0x0704('0x9')]('%s/users.json',_0x126592[_0x0704('0xb')]),'method':_0x0704('0xc'),'body':{'user':{'role':_0x0704('0x27'),'name':util[_0x0704('0x9')](_0x0704('0x2b'),_0x1d825d||_0x270549),'phone':_0x270549}}})[_0x0704('0x13')](function(_0x38d2a8){logger[_0x0704('0x17')]('Enduser\x20created.');return _0x38d2a8[_0x0704('0x22')];});}});}function getAuth(_0x5126ab){var _0x25aa29;if(_0x5126ab[_0x0704('0x2c')]===_0x0704('0x2d')){_0x25aa29=util['format']('%s:%s',_0x5126ab[_0x0704('0x2e')],_0x5126ab['password']);}else if(_0x5126ab['authType']===_0x0704('0x2f')){_0x25aa29=util[_0x0704('0x9')](_0x0704('0x30'),_0x5126ab[_0x0704('0x2e')],_0x5126ab[_0x0704('0x2f')]);}return util[_0x0704('0x9')]('Basic\x20%s',new Buffer(_0x25aa29)[_0x0704('0x31')]('base64'));}function request(_0x5e5761){logger[_0x0704('0x32')](_0x0704('0x33'),JSON[_0x0704('0x34')](_0x5e5761));return rp(_[_0x0704('0x6')](_0x5e5761,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x50275d,_0x4fcd5e){var _0x319c76=[];if(_0x50275d&&_0x50275d[_0x0704('0x25')]>0x0){_0x319c76=_[_0x0704('0x35')](_0x50275d,_0x4fcd5e);}return _0x319c76;}function getCustomFields(_0xa062c2,_0x40be42){var _0x32bd68=[];var _0x4d3a21={'custom_fields':[]};if(_0xa062c2[_0x0704('0x25')]>0x0){_[_0x0704('0x36')](_0xa062c2,function(_0x3c9ee5){if(_[_0x0704('0x37')]([_0x0704('0x38'),_0x0704('0x39')],_0x3c9ee5['type'])&&_0x3c9ee5['nameField']&&!_0x3c9ee5[_0x0704('0x3a')]){_0x4d3a21[_0x3c9ee5[_0x0704('0x3b')]['toLowerCase']()]=_0x3c9ee5['content'][_0x0704('0x31')]();}else if(_['includes']([_0x0704('0x38'),'picklist'],_0x3c9ee5[_0x0704('0x3c')])&&_0x3c9ee5['idField']&&_0x3c9ee5[_0x0704('0x3a')]){_0x4d3a21['custom_fields'][_0x0704('0x3d')]({'id':_0x3c9ee5['idField'],'value':_0x3c9ee5[_0x0704('0x3e')]['toString']()});}else if(_0x3c9ee5[_0x0704('0x3c')]===_0x0704('0x3f')&&_0x3c9ee5[_0x0704('0x40')]&&_0x3c9ee5['idField']&&_0x3c9ee5[_0x0704('0x3a')]){_0x40be42[_0x3c9ee5[_0x0704('0x40')]]&&_0x4d3a21[_0x0704('0x41')][_0x0704('0x3d')]({'id':_0x3c9ee5['idField'],'value':_0x40be42[_0x3c9ee5[_0x0704('0x40')]][_0x0704('0x31')]()});}else if(_0x3c9ee5['type']==='customVariable'&&_0x3c9ee5['Variable']&&_0x3c9ee5[_0x0704('0x42')][_0x0704('0xf')]&&_0x3c9ee5[_0x0704('0x43')]&&_0x3c9ee5['customField']){_0x40be42[_0x3c9ee5[_0x0704('0x42')][_0x0704('0xf')][_0x0704('0x44')]()]&&_0x4d3a21['custom_fields'][_0x0704('0x3d')]({'id':_0x3c9ee5[_0x0704('0x43')],'value':_0x40be42[_0x3c9ee5[_0x0704('0x42')]['name'][_0x0704('0x44')]()][_0x0704('0x31')]()});}});}return _0x4d3a21;}exports['queue']=function(_0x17e080,_0x3a0cfa,_0x2c0267,_0x2bfbfb,_0x22e3b2,_0xfac942){var _0x86f31,_0x3e2a35;_0xfac942[_0x0704('0xb')]=intUtil[_0x0704('0x45')](_0xfac942[_0x0704('0xb')]);_0xfac942[_0x0704('0x46')]=intUtil['stripTrailingSlash'](_0xfac942['serverUrl']);if(_0x22e3b2&&_0x22e3b2[_0x0704('0x47')]){logger[_0x0704('0x17')](_0x0704('0x48'),_0x0704('0x49'));_0x3a0cfa[_0x0704('0x4a')]=util[_0x0704('0x9')](_0x0704('0x4b'),_0xfac942['serverUrl'],_0x3a0cfa[_0x0704('0x4c')],md5(_0x3a0cfa['uniqueid']));}else{_0x3a0cfa['recordingURL']='';}headers[_0x0704('0x4d')]=getAuth(_0xfac942);return getUser(_0xfac942,_0x2bfbfb[_0x0704('0x4e')])[_0x0704('0x13')](function(_0x130c8b){_0x86f31=_0x130c8b;logger[_0x0704('0x17')]('The\x20User\x20ID\x20is:',_0x86f31['id']);return getEndUser(_0xfac942,_0x3a0cfa[_0x0704('0x4f')],_0x3a0cfa[_0x0704('0x50')]);})[_0x0704('0x13')](function(_0x1b396e){_0x3e2a35=_0x1b396e;logger[_0x0704('0x17')](_0x0704('0x51'),_0x3e2a35['id']);return getTicket(_0xfac942,_0x86f31,_0x3e2a35,_0x2c0267,_0x3a0cfa);})[_0x0704('0x13')](function(_0x56accd){if(_0x56accd){logger[_0x0704('0x17')](_0x0704('0x52'),_0x56accd['id']);switch(_0xfac942[_0x0704('0x3c')]){case _0x0704('0x53'):logger[_0x0704('0x17')](_0x0704('0x48'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x0704('0x9')](_0x0704('0x54'),_0xfac942[_0x0704('0xb')],_0x86f31['id'],_0x56accd['id']),'method':'POST'});case _0x0704('0x55'):logger[_0x0704('0x17')](_0x0704('0x48'),_0x0704('0x56'));emit(util[_0x0704('0x9')]('user:%s',_0x2bfbfb[_0x0704('0xf')]),_0x0704('0x57'),{'uri':util[_0x0704('0x9')]('%s/agent/tickets/%s',_0xfac942[_0x0704('0xb')]['replace'](_0x0704('0x58'),''),_0x56accd['id'])});break;default:logger[_0x0704('0x59')](_0x0704('0x48'),_0x0704('0x5a'));}}})[_0x0704('0x5b')](function(_0x2ac0cc){logger[_0x0704('0x59')](_0x0704('0x5c'),util[_0x0704('0x5d')](_0x2ac0cc,{'showHidden':!![],'depth':null}));});};exports[_0x0704('0x5e')]=function(_0x56f3dc,_0x79539b,_0xd06dc6,_0x1f60a0,_0xc2bcb3,_0x2b9e86,_0x423443){var _0x3ecf02,_0x909981;_0x2b9e86[_0x0704('0xb')]=intUtil[_0x0704('0x45')](_0x2b9e86[_0x0704('0xb')]);_0x2b9e86[_0x0704('0x46')]=intUtil[_0x0704('0x45')](_0x2b9e86[_0x0704('0x46')]);if(_0x423443&&_0x423443[_0x0704('0x5f')]&&_0x423443[_0x0704('0x5f')]!==_0x0704('0x60')){logger[_0x0704('0x17')](_0x0704('0x61'),'Recording\x20is\x20enabled!');_0x79539b['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b9e86[_0x0704('0x46')],_0x79539b[_0x0704('0x4c')],md5(_0x79539b[_0x0704('0x4c')]));}headers[_0x0704('0x4d')]=getAuth(_0x2b9e86);return getUser(_0x2b9e86,_0x1f60a0[_0x0704('0x4e')])['then'](function(_0x163ce3){_0x3ecf02=_0x163ce3;logger[_0x0704('0x17')](_0x0704('0x62'),_0x3ecf02['id']);return getEndUser(_0x2b9e86,_0x79539b[_0x0704('0x63')],_0x79539b[_0x0704('0x64')]);})['then'](function(_0x10b855){_0x909981=_0x10b855;logger['info'](_0x0704('0x51'),_0x909981['id']);return getTicket(_0x2b9e86,_0x3ecf02,_0x909981,_0xd06dc6,_0x79539b);})[_0x0704('0x13')](function(_0x508539){if(_0x508539){logger[_0x0704('0x17')](_0x0704('0x52'),_0x508539['id']);switch(_0x2b9e86[_0x0704('0x3c')]){case'integrationTab':logger[_0x0704('0x17')](_0x0704('0x61'),_0x0704('0x65'));return request({'uri':util['format'](_0x0704('0x54'),_0x2b9e86['remoteUri'],_0x3ecf02['id'],_0x508539['id']),'method':'POST'});case _0x0704('0x55'):logger[_0x0704('0x17')]('[OUTBOUND]',_0x0704('0x56'));emit(util[_0x0704('0x9')]('user:%s',_0x1f60a0['name']),_0x0704('0x57'),{'uri':util[_0x0704('0x9')]('%s/agent/tickets/%s',_0x2b9e86[_0x0704('0xb')][_0x0704('0x66')](_0x0704('0x58'),''),_0x508539['id'])});break;default:logger[_0x0704('0x59')](_0x0704('0x61'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x0704('0x5b')](function(_0x477eba){logger[_0x0704('0x59')](_0x0704('0x67'),util[_0x0704('0x5d')](_0x477eba,{'showHidden':!![],'depth':null}));});};exports[_0x0704('0x68')]=function(_0x2246d4,_0x19bde9,_0x1d120e,_0x32f800,_0x375118,_0x106f41){var _0x5a1bb3,_0x1a119b;_0x106f41[_0x0704('0xb')]=intUtil['stripTrailingSlash'](_0x106f41[_0x0704('0xb')]);_0x106f41[_0x0704('0x46')]=intUtil[_0x0704('0x45')](_0x106f41['serverUrl']);if(_0x375118&&_0x375118['monitor_format']){logger[_0x0704('0x17')]('['+_0x19bde9[_0x0704('0x69')][_0x0704('0x6a')]()+']','Recording\x20is\x20enabled!');_0x19bde9[_0x0704('0x4a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x106f41[_0x0704('0x46')],_0x19bde9[_0x0704('0x4c')],md5(_0x19bde9[_0x0704('0x4c')]));}else{_0x19bde9['recordingURL']='';}headers[_0x0704('0x4d')]=getAuth(_0x106f41);return getUser(_0x106f41)[_0x0704('0x13')](function(_0x41ca6a){_0x5a1bb3=_0x41ca6a;logger['info']('The\x20User\x20ID\x20is:',_0x5a1bb3['id']);return getEndUser(_0x106f41,_0x19bde9['calleridname'],_0x19bde9[_0x0704('0x50')]);})[_0x0704('0x13')](function(_0x3c698c){_0x1a119b=_0x3c698c;logger[_0x0704('0x17')](_0x0704('0x51'),_0x1a119b['id']);return getTicket(_0x106f41,_0x5a1bb3,_0x1a119b,_0x1d120e,_0x19bde9);})[_0x0704('0x13')](function(_0x2b3bd5){if(_0x2b3bd5){logger[_0x0704('0x17')](_0x0704('0x52'),_0x2b3bd5['id']);}})['catch'](function(_0x54984f){logger['error']('['+_0x19bde9[_0x0704('0x69')][_0x0704('0x6a')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x0704('0x5d')](_0x54984f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0d17=['name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','%s/agent/tickets/%s','/api/v2','unmanaged','lastevent','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','./util','../../../../config/environment','zendesk','defaults','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','getString','Subjects','Descriptions','Fields','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','remoteUri','then','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','%s/search.json','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','toString','base64','debug','[HTTP]','stringify','GET','map','string','picklist','type','customField','nameField','toLowerCase','content','includes','custom_fields','push','variable','variableName','idField','customVariable','Variable'];(function(_0x57dfe5,_0x2b1b1d){var _0x239cc8=function(_0x321d4){while(--_0x321d4){_0x57dfe5['push'](_0x57dfe5['shift']());}};_0x239cc8(++_0x2b1b1d);}(_0x0d17,0x182));var _0x70d1=function(_0x22d11b,_0x26a1dd){_0x22d11b=_0x22d11b-0x0;var _0x59c76c=_0x0d17[_0x22d11b];return _0x59c76c;};'use strict';var _=require('lodash');var rp=require(_0x70d1('0x0'));var md5=require(_0x70d1('0x1'));var util=require(_0x70d1('0x2'));var Redis=require(_0x70d1('0x3'));var intUtil=require(_0x70d1('0x4'));var config=require(_0x70d1('0x5'));var logger=require('../../../../config/logger')(_0x70d1('0x6'));config['redis']=_[_0x70d1('0x7')](config[_0x70d1('0x8')],{'host':_0x70d1('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x4c36b6,_0x50e031,_0x4cd0b0){io['to'](_0x4c36b6)[_0x70d1('0xa')](_0x50e031,_0x4cd0b0);}var headers={'Content-Type':_0x70d1('0xb'),'Accept':_0x70d1('0xb')};function getTicket(_0x1440db,_0x348e10,_0x264603,_0x271738,_0x13dcc0){logger[_0x70d1('0xc')](_0x70d1('0xd'));return request({'uri':util[_0x70d1('0xe')](_0x70d1('0xf'),_0x1440db['remoteUri']),'method':_0x70d1('0x10'),'body':{'ticket':_[_0x70d1('0x11')]({'requester_id':_0x264603['id'],'submitter_id':_0x348e10?_0x348e10['id']:undefined,'assignee_id':_0x348e10?_0x348e10['id']:undefined,'tags':getTags(_0x271738[_0x70d1('0x12')],'name'),'subject':intUtil[_0x70d1('0x13')](_0x271738[_0x70d1('0x14')],_0x13dcc0,'\x20'),'description':intUtil['getString'](_0x271738['Descriptions'],_0x13dcc0,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x271738[_0x70d1('0x15')],_0x13dcc0,'\x0a')}},getCustomFields(_0x271738[_0x70d1('0x16')],_0x13dcc0))}})['then'](function(_0x161a38){logger[_0x70d1('0xc')](_0x70d1('0x17'));return _0x161a38[_0x70d1('0x18')];});}function getUser(_0x52d50b,_0x461243){if(intUtil[_0x70d1('0x19')](_0x461243)){logger[_0x70d1('0xc')](_0x70d1('0x1a'),_0x461243);return request({'uri':util[_0x70d1('0xe')]('%s/search.json',_0x52d50b[_0x70d1('0x1b')]),'qs':{'query':util[_0x70d1('0xe')]('type:user\x20role:agent\x20email:%s',_0x461243)}})[_0x70d1('0x1c')](function(_0x2695d3){if(_0x2695d3[_0x70d1('0x1d')]){logger[_0x70d1('0xc')]('Agent\x20found!');return _[_0x70d1('0x1e')](_0x2695d3[_0x70d1('0x1f')],{'email':_0x461243,'role':_0x70d1('0x20')});}else{logger['info'](_0x70d1('0x21'));return request({'uri':util[_0x70d1('0xe')](_0x70d1('0x22'),_0x52d50b['remoteUri'])})[_0x70d1('0x1c')](function(_0x1ad76a){logger[_0x70d1('0xc')](_0x70d1('0x23'));return _0x1ad76a[_0x70d1('0x24')];});}});}else{logger[_0x70d1('0xc')](_0x70d1('0x21'));return request({'uri':util[_0x70d1('0xe')](_0x70d1('0x22'),_0x52d50b[_0x70d1('0x1b')])})[_0x70d1('0x1c')](function(_0x5567f0){logger[_0x70d1('0xc')](_0x70d1('0x23'));return _0x5567f0[_0x70d1('0x24')];});}}function getEndUser(_0x402152,_0x38b7bb,_0x5920bc){logger[_0x70d1('0xc')]('Searching\x20enduser\x20with\x20phone',_0x5920bc);return request({'uri':util[_0x70d1('0xe')](_0x70d1('0x25'),_0x402152[_0x70d1('0x1b')]),'qs':{'query':util[_0x70d1('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x5920bc)}})[_0x70d1('0x1c')](function(_0x2970ca){var _0xd6849;if(_0x2970ca['results'][_0x70d1('0x26')]){_0x2970ca[_0x70d1('0x1f')]=_[_0x70d1('0x27')](_0x2970ca[_0x70d1('0x1f')],{'suspended':![],'role':_0x70d1('0x28')});if(_0x2970ca[_0x70d1('0x1f')][_0x70d1('0x26')]){_0xd6849=_[_0x70d1('0x29')](_0x2970ca[_0x70d1('0x1f')]);}}if(_0xd6849){logger[_0x70d1('0xc')](_0x70d1('0x2a'));return _0xd6849;}else{logger[_0x70d1('0xc')](_0x70d1('0x2b'));return request({'uri':util[_0x70d1('0xe')](_0x70d1('0x2c'),_0x402152[_0x70d1('0x1b')]),'method':_0x70d1('0x10'),'body':{'user':{'role':_0x70d1('0x28'),'name':util[_0x70d1('0xe')]('Caller\x20-\x20%s',_0x38b7bb||_0x5920bc),'phone':_0x5920bc}}})[_0x70d1('0x1c')](function(_0x1133d7){logger[_0x70d1('0xc')](_0x70d1('0x2d'));return _0x1133d7['user'];});}});}function getAuth(_0x25ad9c){var _0x4f9cca;if(_0x25ad9c['authType']===_0x70d1('0x2e')){_0x4f9cca=util[_0x70d1('0xe')](_0x70d1('0x2f'),_0x25ad9c[_0x70d1('0x30')],_0x25ad9c[_0x70d1('0x2e')]);}else if(_0x25ad9c[_0x70d1('0x31')]===_0x70d1('0x32')){_0x4f9cca=util[_0x70d1('0xe')](_0x70d1('0x33'),_0x25ad9c[_0x70d1('0x30')],_0x25ad9c['token']);}return util['format']('Basic\x20%s',new Buffer(_0x4f9cca)[_0x70d1('0x34')](_0x70d1('0x35')));}function request(_0x167c6b){logger[_0x70d1('0x36')](_0x70d1('0x37'),JSON[_0x70d1('0x38')](_0x167c6b));return rp(_[_0x70d1('0x7')](_0x167c6b,{'method':_0x70d1('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x42c8dd,_0x29e2bf){var _0x1ec5e6=[];if(_0x42c8dd&&_0x42c8dd[_0x70d1('0x26')]>0x0){_0x1ec5e6=_[_0x70d1('0x3a')](_0x42c8dd,_0x29e2bf);}return _0x1ec5e6;}function getCustomFields(_0x440646,_0x111870){var _0x275713=[];var _0x50d578={'custom_fields':[]};if(_0x440646[_0x70d1('0x26')]>0x0){_['forEach'](_0x440646,function(_0x29d7b9){if(_['includes']([_0x70d1('0x3b'),_0x70d1('0x3c')],_0x29d7b9[_0x70d1('0x3d')])&&_0x29d7b9['nameField']&&!_0x29d7b9[_0x70d1('0x3e')]){_0x50d578[_0x29d7b9[_0x70d1('0x3f')][_0x70d1('0x40')]()]=_0x29d7b9[_0x70d1('0x41')][_0x70d1('0x34')]();}else if(_[_0x70d1('0x42')](['string',_0x70d1('0x3c')],_0x29d7b9[_0x70d1('0x3d')])&&_0x29d7b9['idField']&&_0x29d7b9[_0x70d1('0x3e')]){_0x50d578[_0x70d1('0x43')][_0x70d1('0x44')]({'id':_0x29d7b9['idField'],'value':_0x29d7b9['content'][_0x70d1('0x34')]()});}else if(_0x29d7b9[_0x70d1('0x3d')]===_0x70d1('0x45')&&_0x29d7b9[_0x70d1('0x46')]&&_0x29d7b9[_0x70d1('0x47')]&&_0x29d7b9['customField']){_0x111870[_0x29d7b9['variableName']]&&_0x50d578[_0x70d1('0x43')]['push']({'id':_0x29d7b9['idField'],'value':_0x111870[_0x29d7b9[_0x70d1('0x46')]]['toString']()});}else if(_0x29d7b9[_0x70d1('0x3d')]===_0x70d1('0x48')&&_0x29d7b9[_0x70d1('0x49')]&&_0x29d7b9[_0x70d1('0x49')][_0x70d1('0x4a')]&&_0x29d7b9['idField']&&_0x29d7b9[_0x70d1('0x3e')]){_0x111870[_0x29d7b9[_0x70d1('0x49')][_0x70d1('0x4a')][_0x70d1('0x40')]()]&&_0x50d578['custom_fields'][_0x70d1('0x44')]({'id':_0x29d7b9[_0x70d1('0x47')],'value':_0x111870[_0x29d7b9[_0x70d1('0x49')]['name'][_0x70d1('0x40')]()]['toString']()});}});}return _0x50d578;}exports[_0x70d1('0x4b')]=function(_0x5a998d,_0x1ef419,_0x20c43e,_0x390836,_0x4b141e,_0x369731){var _0x3b03d1,_0x2559d2;_0x369731[_0x70d1('0x1b')]=intUtil[_0x70d1('0x4c')](_0x369731[_0x70d1('0x1b')]);_0x369731[_0x70d1('0x4d')]=intUtil[_0x70d1('0x4c')](_0x369731['serverUrl']);if(_0x4b141e&&_0x4b141e[_0x70d1('0x4e')]){logger['info'](_0x70d1('0x4f'),_0x70d1('0x50'));_0x1ef419[_0x70d1('0x51')]=util[_0x70d1('0xe')](_0x70d1('0x52'),_0x369731[_0x70d1('0x4d')],_0x1ef419[_0x70d1('0x53')],md5(_0x1ef419[_0x70d1('0x53')]));}else{_0x1ef419[_0x70d1('0x51')]='';}headers['Authorization']=getAuth(_0x369731);return getUser(_0x369731,_0x390836[_0x70d1('0x54')])[_0x70d1('0x1c')](function(_0x491af0){_0x3b03d1=_0x491af0;logger[_0x70d1('0xc')](_0x70d1('0x55'),_0x3b03d1['id']);return getEndUser(_0x369731,_0x1ef419[_0x70d1('0x56')],_0x1ef419[_0x70d1('0x57')]);})['then'](function(_0x1f947a){_0x2559d2=_0x1f947a;logger['info'](_0x70d1('0x58'),_0x2559d2['id']);return getTicket(_0x369731,_0x3b03d1,_0x2559d2,_0x20c43e,_0x1ef419);})['then'](function(_0x46c1a7){if(_0x46c1a7){logger[_0x70d1('0xc')](_0x70d1('0x59'),_0x46c1a7['id']);switch(_0x369731[_0x70d1('0x3d')]){case _0x70d1('0x5a'):logger[_0x70d1('0xc')]('[QUEUE]',_0x70d1('0x5b'));return request({'uri':util[_0x70d1('0xe')](_0x70d1('0x5c'),_0x369731['remoteUri'],_0x3b03d1['id'],_0x46c1a7['id']),'method':_0x70d1('0x10')});case _0x70d1('0x5d'):logger[_0x70d1('0xc')](_0x70d1('0x4f'),_0x70d1('0x5e'));emit(util['format'](_0x70d1('0x5f'),_0x390836['name']),_0x70d1('0x60'),{'uri':util[_0x70d1('0xe')]('%s/agent/tickets/%s',_0x369731[_0x70d1('0x1b')][_0x70d1('0x61')]('/api/v2',''),_0x46c1a7['id'])});break;default:logger[_0x70d1('0x62')](_0x70d1('0x4f'),_0x70d1('0x63'));}}})[_0x70d1('0x64')](function(_0x10d705){logger[_0x70d1('0x62')](_0x70d1('0x65'),util[_0x70d1('0x66')](_0x10d705,{'showHidden':!![],'depth':null}));});};exports[_0x70d1('0x67')]=function(_0x3ff2cb,_0x433816,_0x78527d,_0x244855,_0x203882,_0x4c08c1,_0x36c2ae){var _0x75a270,_0x398d71;_0x4c08c1[_0x70d1('0x1b')]=intUtil['stripTrailingSlash'](_0x4c08c1[_0x70d1('0x1b')]);_0x4c08c1['serverUrl']=intUtil[_0x70d1('0x4c')](_0x4c08c1[_0x70d1('0x4d')]);if(_0x36c2ae&&_0x36c2ae[_0x70d1('0x68')]&&_0x36c2ae[_0x70d1('0x68')]!==_0x70d1('0x69')){logger[_0x70d1('0xc')](_0x70d1('0x6a'),_0x70d1('0x50'));_0x433816[_0x70d1('0x51')]=util[_0x70d1('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4c08c1[_0x70d1('0x4d')],_0x433816[_0x70d1('0x53')],md5(_0x433816[_0x70d1('0x53')]));}headers[_0x70d1('0x6b')]=getAuth(_0x4c08c1);return getUser(_0x4c08c1,_0x244855[_0x70d1('0x54')])[_0x70d1('0x1c')](function(_0x3fd593){_0x75a270=_0x3fd593;logger[_0x70d1('0xc')](_0x70d1('0x55'),_0x75a270['id']);return getEndUser(_0x4c08c1,_0x433816[_0x70d1('0x6c')],_0x433816[_0x70d1('0x6d')]);})['then'](function(_0x1ea951){_0x398d71=_0x1ea951;logger['info'](_0x70d1('0x58'),_0x398d71['id']);return getTicket(_0x4c08c1,_0x75a270,_0x398d71,_0x78527d,_0x433816);})[_0x70d1('0x1c')](function(_0x10e9bf){if(_0x10e9bf){logger[_0x70d1('0xc')]('The\x20Ticket\x20ID\x20is:',_0x10e9bf['id']);switch(_0x4c08c1['type']){case'integrationTab':logger[_0x70d1('0xc')]('[OUTBOUND]',_0x70d1('0x5b'));return request({'uri':util[_0x70d1('0xe')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x4c08c1[_0x70d1('0x1b')],_0x75a270['id'],_0x10e9bf['id']),'method':_0x70d1('0x10')});case'newTab':logger[_0x70d1('0xc')](_0x70d1('0x6a'),_0x70d1('0x5e'));emit(util[_0x70d1('0xe')](_0x70d1('0x5f'),_0x244855[_0x70d1('0x4a')]),_0x70d1('0x60'),{'uri':util['format'](_0x70d1('0x6e'),_0x4c08c1[_0x70d1('0x1b')]['replace'](_0x70d1('0x6f'),''),_0x10e9bf['id'])});break;default:logger['error'](_0x70d1('0x6a'),_0x70d1('0x63'));}}})['catch'](function(_0x1d8d55){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x70d1('0x66')](_0x1d8d55,{'showHidden':!![],'depth':null}));});};exports[_0x70d1('0x70')]=function(_0x313ea9,_0x56da3b,_0x210672,_0x3d2447,_0x453543,_0x26209a){var _0xc2ac00,_0x47dd05;_0x26209a['remoteUri']=intUtil[_0x70d1('0x4c')](_0x26209a[_0x70d1('0x1b')]);_0x26209a[_0x70d1('0x4d')]=intUtil[_0x70d1('0x4c')](_0x26209a[_0x70d1('0x4d')]);if(_0x453543&&_0x453543[_0x70d1('0x4e')]){logger['info']('['+_0x56da3b['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x56da3b[_0x70d1('0x51')]=util[_0x70d1('0xe')](_0x70d1('0x52'),_0x26209a[_0x70d1('0x4d')],_0x56da3b[_0x70d1('0x53')],md5(_0x56da3b[_0x70d1('0x53')]));}else{_0x56da3b[_0x70d1('0x51')]='';}headers[_0x70d1('0x6b')]=getAuth(_0x26209a);return getUser(_0x26209a)['then'](function(_0x3bca66){_0xc2ac00=_0x3bca66;logger[_0x70d1('0xc')]('The\x20User\x20ID\x20is:',_0xc2ac00['id']);return getEndUser(_0x26209a,_0x56da3b['calleridname'],_0x56da3b[_0x70d1('0x57')]);})[_0x70d1('0x1c')](function(_0x48be10){_0x47dd05=_0x48be10;logger[_0x70d1('0xc')](_0x70d1('0x58'),_0x47dd05['id']);return getTicket(_0x26209a,_0xc2ac00,_0x47dd05,_0x210672,_0x56da3b);})[_0x70d1('0x1c')](function(_0x220684){if(_0x220684){logger[_0x70d1('0xc')](_0x70d1('0x59'),_0x220684['id']);}})['catch'](function(_0x1ad512){logger[_0x70d1('0x62')]('['+_0x56da3b[_0x70d1('0x71')]['toUpperCase']()+']'+_0x70d1('0x72'),util['inspect'](_0x1ad512,{'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 4beee73..f814155 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 _0xc86c=['/downloads?type=uniqueid&token=','zoho.eu','email','calleridname','calleridnum','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','outbound','recordingFormat','none','[OUTBOUND]','com','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','/crm/EntityInfo.do?module=Calls&id=','toUpperCase','lodash','request-promise','./util','moment','ioredis','bluebird','zoho','redis','debug','[HTTP]','length','includes','picklist','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refreshToken','clientSecret','refresh_token','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','Agent\x20found!','profile','user','Administrator','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','https://www.zohoapis.','startCase','role','first_name','SUCCESS','Error:\x20','log','CREATE\x20ERROR','Zoho-oauthtoken\x20','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','moduleCreate','nothing','lead','Creating\x20new\x20call...','administrator','Subjects','Description','getString','Descriptions','Full_Name','First_Name','Last_Name','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Called','complete','Call_Result','abandoned','Abandoned','timeout','Timeout','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','code','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid'];(function(_0x18f924,_0xc421f9){var _0x403839=function(_0x15e2fb){while(--_0x15e2fb){_0x18f924['push'](_0x18f924['shift']());}};_0x403839(++_0xc421f9);}(_0xc86c,0x138));var _0xcc86=function(_0x4dc62b,_0x12eabc){_0x4dc62b=_0x4dc62b-0x0;var _0x3ba92c=_0xc86c[_0x4dc62b];return _0x3ba92c;};'use strict';var _=require(_0xcc86('0x0'));var rp=require(_0xcc86('0x1'));var md5=require('md5');var util=require('util');var intUtil=require(_0xcc86('0x2'));var moment=require(_0xcc86('0x3'));var Redis=require(_0xcc86('0x4'));var BPromise=require(_0xcc86('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xcc86('0x6'));config['redis']=_['defaults'](config[_0xcc86('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcc86('0x7')]));function emit(_0x2b08dd,_0x3d678a,_0x441109){io['to'](_0x2b08dd)['emit'](_0x3d678a,_0x441109);}function request(_0x543e05){logger[_0xcc86('0x8')](_0xcc86('0x9'),JSON['stringify'](_0x543e05));return rp(_0x543e05);}function getCustomFields(_0x323c8a,_0x5a52fc){var _0x4281b6={};if(_0x323c8a[_0xcc86('0xa')]>0x0){_['forEach'](_0x323c8a,function(_0x129c87){if(_[_0xcc86('0xb')](['string',_0xcc86('0xc')],_0x129c87[_0xcc86('0xd')])&&_0x129c87['idField']){_0x4281b6[_0x129c87[_0xcc86('0xe')]]=_0x129c87[_0xcc86('0xf')]['toString']();}else if(_0x129c87[_0xcc86('0xd')]===_0xcc86('0x10')&&_0x129c87['variableName']&&_0x129c87['idField']&&_0x5a52fc[_0x129c87[_0xcc86('0x11')]]){_0x4281b6[_0x129c87[_0xcc86('0xe')]]=_0x5a52fc[_0x129c87[_0xcc86('0x11')]][_0xcc86('0x12')]();}else if(_0x129c87['type']===_0xcc86('0x13')&&_0x129c87[_0xcc86('0x14')]&&_0x129c87[_0xcc86('0x14')][_0xcc86('0x15')]&&_0x129c87['idField']&&_0x5a52fc[_0x129c87['Variable']['name'][_0xcc86('0x16')]()]){_0x4281b6[_0x129c87['idField']]=_0x5a52fc[_0x129c87[_0xcc86('0x14')][_0xcc86('0x15')]['toLowerCase']()][_0xcc86('0x12')]();}});}return _0x4281b6;}function getName(_0x28bbbc){if(_0x28bbbc['indexOf']('\x20')>0x0){var _0x1ff3ee=_0x28bbbc[_0xcc86('0x17')](/ (.+)/);if(_0x1ff3ee[0x1]){return _0x1ff3ee;}}return[_0x28bbbc,_0x28bbbc];}var accountsTokens={};function getAccessToken(_0x84c725){return new Promise(function(_0x8968c6,_0x1b889c){if(!_['isNil'](accountsTokens[_0x84c725['id']])&&!_[_0xcc86('0x18')](accountsTokens[_0x84c725['id']][_0xcc86('0x19')])){if(moment()[_0xcc86('0x1a')](accountsTokens[_0x84c725['id']][_0xcc86('0x1b')])){_0x8968c6(accountsTokens[_0x84c725['id']][_0xcc86('0x19')]);}}var _0x1faf8f;switch(_0x84c725[_0xcc86('0x1c')]){case'US':_0x1faf8f=_0xcc86('0x1d');break;case'AU':_0x1faf8f=_0xcc86('0x1e');break;case'EU':_0x1faf8f='https://accounts.zoho.eu';break;case'IN':_0x1faf8f=_0xcc86('0x1f');break;case'CN':_0x1faf8f=_0xcc86('0x20');break;default:_0x1faf8f=_0xcc86('0x21');break;}var _0x228c00={'method':_0xcc86('0x22'),'uri':_0x1faf8f+'/oauth/v2/token','qs':{'refresh_token':_0x84c725[_0xcc86('0x23')],'client_id':_0x84c725['clientId'],'client_secret':_0x84c725[_0xcc86('0x24')],'grant_type':_0xcc86('0x25')},'json':!![]};return rp(_0x228c00)[_0xcc86('0x26')](function(_0x4cc8b3){accountsTokens[_0x84c725['id']]={'access_token':_0x4cc8b3[_0xcc86('0x19')],'expires_in':moment()['add'](_0x4cc8b3[_0xcc86('0x1b')],_0xcc86('0x27'))};_0x8968c6(_0x4cc8b3['access_token']);})[_0xcc86('0x28')](function(_0x3bd6d8){logger[_0xcc86('0x29')](_0xcc86('0x2a'),_0x3bd6d8[_0xcc86('0x2b')]);_0x1b889c(_0x3bd6d8);});});}function getUser(_0x74e0b1,_0x4ef5be,_0x43b340,_0x3f01f6){logger[_0xcc86('0x2c')](_0xcc86('0x2d'));return request({'method':_0xcc86('0x2e'),'uri':util[_0xcc86('0x2f')](_0xcc86('0x30'),_0x4ef5be),'qs':{'type':_0xcc86('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x74e0b1},'json':!![]})['then'](function(_0x540165){if(_0x540165[_0xcc86('0x32')]){var _0x28f102=-0x1;if(_[_0xcc86('0x33')](_0x540165[_0xcc86('0x32')])){if(!_[_0xcc86('0x18')](_0x3f01f6)){_0x28f102=_[_0xcc86('0x34')](_0x540165['users'],function(_0x174ea8){return _0x174ea8['email']===_0x3f01f6;});}if(_0x28f102>=0x0){logger[_0xcc86('0x2c')](_0xcc86('0x35'));}else{logger['info']('Using\x20the\x20admin\x20account!');_0x28f102=_[_0xcc86('0x34')](_0x540165[_0xcc86('0x32')],function(_0xe75ead){return _0xe75ead[_0xcc86('0x36')][_0xcc86('0x15')]==='Administrator';});}return _0x540165[_0xcc86('0x32')][_0x28f102];}else{if(_0x540165[_0xcc86('0x37')][_0xcc86('0x36')][_0xcc86('0x15')]===_0xcc86('0x38')){logger[_0xcc86('0x2c')]('Using\x20the\x20admin\x20account!');user=_0x540165[_0xcc86('0x37')];return user;}else{logger[_0xcc86('0x29')]('The\x20failing\x20result\x20is',JSON[_0xcc86('0x39')](_0x540165));throw new Error(_0xcc86('0x3a')+JSON[_0xcc86('0x39')](_0x540165));}}}else{logger[_0xcc86('0x29')](_0xcc86('0x3b'),JSON[_0xcc86('0x39')](_0x540165));throw new Error(_0xcc86('0x3a')+JSON['stringify'](_0x540165));}})['catch'](function(_0x33eea6){console[_0xcc86('0x29')](_0x33eea6);});}function getZohoUser(_0x175087,_0x21c8c2){return new BPromise(function(_0x18d77e,_0x27d94d){request(_0x175087)[_0xcc86('0x26')](function(_0xf59d7f){var _0x569df0=null;if(_0xf59d7f){_0x569df0=_0xf59d7f[_0xcc86('0x3c')][0x0];_0x569df0[_0xcc86('0x3d')]=_0x21c8c2;}_0x18d77e(_0x569df0);})['catch'](function(_0x28da37){_0x27d94d(_0x28da37);});});}function createEndUser(_0x381a87,_0x1ee9e2,_0x2ff3fc,_0x46b008,_0x3c7aac,_0x5f3b84){var _0x2ff3fc=getName(_0x2ff3fc);return request({'method':_0xcc86('0x22'),'uri':_0xcc86('0x3e')+_0x1ee9e2+'/crm/v2/'+_[_0xcc86('0x3f')](_0x5f3b84['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x2ff3fc[0x1],'First_Name':_0x2ff3fc[0x0],'Phone':_0x46b008,'Owner':{'name':!_[_0xcc86('0x18')](_0x3c7aac[_0xcc86('0x40')]['name'])?_0x3c7aac[_0xcc86('0x40')][_0xcc86('0x15')]:!_[_0xcc86('0x18')](_0x3c7aac['first_name'])?_0x3c7aac[_0xcc86('0x41')]+'\x20'+_0x3c7aac['last_name']:_0x3c7aac['last_name'],'id':_0x3c7aac['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x381a87},'json':!![]})[_0xcc86('0x26')](function(_0x154d2f){if(_0x154d2f&&_0x154d2f['data'][0x0]['code']===_0xcc86('0x42')){var _0x154a79=_0x154d2f[_0xcc86('0x3c')][0x0]['details'];_0x154a79[_0xcc86('0x3d')]=_[_0xcc86('0x3f')](_0x5f3b84['moduleCreate'])+'s';return _0x154a79;}logger[_0xcc86('0x29')](_0xcc86('0x3b'),JSON[_0xcc86('0x39')](data));throw new Error(_0xcc86('0x43')+JSON[_0xcc86('0x39')](data));})[_0xcc86('0x28')](function(_0x131d08){console[_0xcc86('0x44')](_0xcc86('0x45'),_0x131d08);});}function getEndUser(_0x33814f,_0xa26103,_0x1fb0f1,_0x548e39,_0x4f93e2,_0xa3db85,_0x2c12a4){var _0x1aa8d0={'method':'GET','uri':'','headers':{'Authorization':_0xcc86('0x46')+_0x33814f},'json':!![]};switch(_0x2c12a4[_0xcc86('0x47')]){case _0xcc86('0x48'):_0x1aa8d0[_0xcc86('0x49')]=_0xcc86('0x3e')+_0xa26103+_0xcc86('0x4a')+_0x4f93e2+'))';return getZohoUser(_0x1aa8d0,_0xcc86('0x4b'))['then'](function(_0x122fd0){if(_0x122fd0)return _0x122fd0;_0x1aa8d0[_0xcc86('0x49')]=_0xcc86('0x3e')+_0xa26103+_0xcc86('0x4c')+_0x4f93e2+'))';return getZohoUser(_0x1aa8d0,_0xcc86('0x4d'))[_0xcc86('0x26')](function(_0xaea323){if(_0xaea323)return _0xaea323;if(_0x2c12a4[_0xcc86('0x4e')]!=_0xcc86('0x4f')){return createEndUser(_0x33814f,_0xa26103,_0x548e39,_0x4f93e2,_0xa3db85,_0x2c12a4);}else{return{};}});});break;case'contact':_0x1aa8d0[_0xcc86('0x49')]='https://www.zohoapis.'+_0xa26103+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4f93e2+'))';return getZohoUser(_0x1aa8d0,_0xcc86('0x4b'))[_0xcc86('0x26')](function(_0x1466ce){if(_0x1466ce)return _0x1466ce;if(_0x2c12a4[_0xcc86('0x4e')]!=_0xcc86('0x4f')){return createEndUser(_0x33814f,_0xa26103,_0x548e39,_0x4f93e2,_0xa3db85,_0x2c12a4);}else{return{};}});break;case _0xcc86('0x50'):_0x1aa8d0[_0xcc86('0x49')]=_0xcc86('0x3e')+_0xa26103+_0xcc86('0x4c')+_0x4f93e2+'))';return getZohoUser(_0x1aa8d0,'Leads')[_0xcc86('0x26')](function(_0x30faf4){if(_0x30faf4)return _0x30faf4;if(_0x2c12a4['moduleCreate']!=_0xcc86('0x4f')){return createEndUser(_0x33814f,_0xa26103,_0x548e39,_0x4f93e2,_0xa3db85,_0x2c12a4);}else{return{};}});break;}}function getCall(_0x3ed256,_0x2d28eb,_0x44c21c,_0x1a44ec,_0x2bc54a,_0x2b4e6f,_0x476bd2,_0x234acb){logger['info'](_0xcc86('0x51'));var _0x5df365={};_0x5df365['Owner']={'name':!_['isNil'](_0x1a44ec[_0xcc86('0x40')][_0xcc86('0x15')])&&!_[_0xcc86('0x18')](_0x1a44ec[_0xcc86('0x36')][_0xcc86('0x15')])&&_0x1a44ec[_0xcc86('0x36')][_0xcc86('0x15')]===_0xcc86('0x52')?_0x1a44ec['role'][_0xcc86('0x15')]:!_[_0xcc86('0x18')](_0x1a44ec['first_name'])?_0x1a44ec[_0xcc86('0x41')]+'\x20'+_0x1a44ec['last_name']:_0x1a44ec['last_name'],'id':_0x1a44ec['id']};_0x5df365['Subject']=intUtil['getString'](_0x2b4e6f[_0xcc86('0x53')],_0x476bd2,'\x20');_0x5df365[_0xcc86('0x54')]=intUtil[_0xcc86('0x55')](_0x2b4e6f[_0xcc86('0x56')],_0x476bd2,'\x0a');if(_0x2bc54a[_0xcc86('0x3d')]===_0xcc86('0x4b')){_0x5df365['Who_Id']={'name':!_[_0xcc86('0x18')](_0x2bc54a[_0xcc86('0x57')])?_0x2bc54a[_0xcc86('0x57')]:!_['isNil'](_0x2bc54a[_0xcc86('0x58')])?_0x2bc54a[_0xcc86('0x58')]+'\x20'+_0x2bc54a[_0xcc86('0x59')]:_0x2bc54a['Last_Name'],'id':_0x2bc54a['id']};}if(_0x2bc54a['enduserType']===_0xcc86('0x4d')){_0x5df365['What_Id']={'name':!_[_0xcc86('0x18')](_0x2bc54a[_0xcc86('0x57')])?_0x2bc54a[_0xcc86('0x57')]:!_['isNil'](_0x2bc54a[_0xcc86('0x58')])?_0x2bc54a[_0xcc86('0x58')]+'\x20'+_0x2bc54a[_0xcc86('0x59')]:_0x2bc54a[_0xcc86('0x59')],'id':_0x2bc54a['id']};_0x5df365['$se_module']=_[_0xcc86('0x3f')](_0x2bc54a[_0xcc86('0x3d')]);}if(_0x476bd2[_0xcc86('0x5a')]){_0x5df365[_0xcc86('0x5b')]=moment[_0xcc86('0x5c')](parseInt(_0x476bd2[_0xcc86('0x5a')])*0x3e8)['format'](_0xcc86('0x5d'));}else if(_0x476bd2['answertime']&&_0x476bd2['endtime']){_0x5df365[_0xcc86('0x5b')]=moment[_0xcc86('0x5c')](moment(_0x476bd2[_0xcc86('0x5e')],_0xcc86('0x5f'))[_0xcc86('0x60')](moment(_0x476bd2[_0xcc86('0x61')],_0xcc86('0x5f'))))[_0xcc86('0x2f')](_0xcc86('0x5d'));}switch(_0x476bd2[_0xcc86('0x62')]){case'called':_0x5df365['Call_Result']=_0xcc86('0x63');break;case _0xcc86('0x64'):case'connect':_0x5df365[_0xcc86('0x65')]='Answered';break;case'rejected':_0x5df365[_0xcc86('0x65')]='Rejected';break;case _0xcc86('0x66'):_0x5df365[_0xcc86('0x65')]=_0xcc86('0x67');break;case _0xcc86('0x68'):_0x5df365[_0xcc86('0x65')]=_0xcc86('0x69');default:}_0x5df365['Call_Start_Time']=(_0x234acb==='outbound'?moment(_0x476bd2[_0xcc86('0x61')])[_0xcc86('0x2f')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x476bd2['agentcalledAt'])[_0xcc86('0x2f')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0xcc86('0x2f')]('YYYY-MM-DDTHH:mm:ss');_0x5df365[_0xcc86('0x6a')]=_0x234acb||_0xcc86('0x6b');_0x5df365=_[_0xcc86('0x6c')](_0x5df365,getCustomFields(_0x2b4e6f[_0xcc86('0x6d')],_0x476bd2));return request({'method':_0xcc86('0x22'),'uri':'https://www.zohoapis.'+_0x2d28eb+_0xcc86('0x6e'),'headers':{'Authorization':_0xcc86('0x46')+_0x3ed256},'body':{'data':[_0x5df365]},'json':!![]})[_0xcc86('0x26')](function(_0x5c1dea){if(_0x5c1dea&&_0x5c1dea[_0xcc86('0x3c')][0x0][_0xcc86('0x6f')]===_0xcc86('0x42')){logger[_0xcc86('0x2c')](_0xcc86('0x70'));return{'id':_0x5c1dea[_0xcc86('0x3c')][0x0]['details']['id']};}})[_0xcc86('0x28')](function(_0x375482){logger[_0xcc86('0x2c')](_0xcc86('0x71'),_0x375482[_0xcc86('0x2b')]);console[_0xcc86('0x44')](_0xcc86('0x71'),_0x375482);});}exports[_0xcc86('0x72')]=function(_0x12e769,_0x19abc5,_0x1a8b7b,_0x58ceed,_0x34bcdc,_0x12fbd7){var _0x38aaf5,_0x157851,_0x50b2e8;_0x12fbd7[_0xcc86('0x73')]=intUtil[_0xcc86('0x74')](_0x12fbd7[_0xcc86('0x73')]);_0x12fbd7['serverUrl']=intUtil['stripTrailingSlash'](_0x12fbd7[_0xcc86('0x75')]);if(_0x34bcdc&&_0x34bcdc[_0xcc86('0x76')]){logger['info']('[QUEUE]',_0xcc86('0x77'));_0x19abc5[_0xcc86('0x78')]=_0x12fbd7['serverUrl']+_0xcc86('0x79')+_0x19abc5[_0xcc86('0x7a')]+_0xcc86('0x7b')+md5(_0x19abc5[_0xcc86('0x7a')]);}else{_0x19abc5[_0xcc86('0x78')]='';}var _0x29a783=_0x12fbd7[_0xcc86('0x73')]===_0xcc86('0x7c')?'eu':'com';return getAccessToken(_0x12fbd7)['then'](function(_0x429d7f){_0x50b2e8=_0x429d7f;return getUser(_0x50b2e8,_0x29a783,_0x12fbd7,_0x58ceed[_0xcc86('0x7d')]);})[_0xcc86('0x26')](function(_0xd33510){_0x38aaf5=_0xd33510;logger[_0xcc86('0x2c')]('The\x20User\x20ID\x20is:',_0x38aaf5['id']);return getEndUser(_0x50b2e8,_0x29a783,_0x12fbd7,_0x19abc5[_0xcc86('0x7e')],_0x19abc5[_0xcc86('0x7f')],_0x38aaf5,_0x1a8b7b);})[_0xcc86('0x26')](function(_0x2b51f6){_0x157851=_0x2b51f6;return getCall(_0x50b2e8,_0x29a783,_0x12fbd7,_0x38aaf5,_0x157851,_0x1a8b7b,_0x19abc5,_0xcc86('0x6b'));})[_0xcc86('0x26')](function(_0x218974){if(_0x218974){logger[_0xcc86('0x2c')]('The\x20Call\x20ID\x20is:',_0x218974['id']);logger[_0xcc86('0x2c')](_0xcc86('0x80'),_0xcc86('0x81'));emit(util[_0xcc86('0x2f')](_0xcc86('0x82'),_0x58ceed[_0xcc86('0x15')]),_0xcc86('0x83'),{'uri':_0xcc86('0x84')+_0x12fbd7[_0xcc86('0x73')]+'/crm/EntityInfo.do?module=Calls&id='+_0x218974['id']});}})[_0xcc86('0x28')](function(_0x128c1f){logger[_0xcc86('0x29')](_0xcc86('0x80'),JSON[_0xcc86('0x39')](_0x128c1f));});};exports[_0xcc86('0x85')]=function(_0x3ed0f4,_0x5b51db,_0x4fba7c,_0x2d31d1,_0xd20de,_0x10a483,_0x5cc4aa){var _0x2cda84,_0xfdf568,_0x390e05;_0x10a483['host']=intUtil['stripTrailingSlash'](_0x10a483[_0xcc86('0x73')]);_0x10a483[_0xcc86('0x75')]=intUtil['stripTrailingSlash'](_0x10a483[_0xcc86('0x75')]);if(_0x5cc4aa&&_0x5cc4aa[_0xcc86('0x86')]&&_0x5cc4aa[_0xcc86('0x86')]!==_0xcc86('0x87')){logger['info'](_0xcc86('0x88'),_0xcc86('0x77'));_0x5b51db[_0xcc86('0x78')]=_0x10a483['serverUrl']+_0xcc86('0x79')+_0x5b51db[_0xcc86('0x7a')]+_0xcc86('0x7b')+md5(_0x5b51db['uniqueid']);}var _0x28015c=_0x10a483[_0xcc86('0x73')]===_0xcc86('0x7c')?'eu':_0xcc86('0x89');return getAccessToken(_0x10a483)[_0xcc86('0x26')](function(_0x3fe5e6){_0x390e05=_0x3fe5e6;return getUser(_0x390e05,_0x28015c,_0x10a483,_0x2d31d1[_0xcc86('0x7d')]);})[_0xcc86('0x26')](function(_0x27b069){_0x2cda84=_0x27b069;logger[_0xcc86('0x2c')](_0xcc86('0x8a'),_0x2cda84['id']);return getEndUser(_0x390e05,_0x28015c,_0x10a483,_0x5b51db[_0xcc86('0x8b')],_0x5b51db[_0xcc86('0x8c')],_0x2cda84,_0x4fba7c);})[_0xcc86('0x26')](function(_0x42cf48){_0xfdf568=_0x42cf48;return getCall(_0x390e05,_0x28015c,_0x10a483,_0x2cda84,_0xfdf568,_0x4fba7c,_0x5b51db,_0xcc86('0x8d'));})[_0xcc86('0x26')](function(_0x1a21d3){if(_0x1a21d3){logger[_0xcc86('0x2c')](_0xcc86('0x8e'),_0x1a21d3['id']);logger[_0xcc86('0x2c')]('[OUTBOUND]',_0xcc86('0x81'));emit(util[_0xcc86('0x2f')]('user:%s',_0x2d31d1[_0xcc86('0x15')]),_0xcc86('0x83'),{'uri':_0xcc86('0x84')+_0x10a483[_0xcc86('0x73')]+_0xcc86('0x8f')+_0x1a21d3['id']});}})[_0xcc86('0x28')](function(_0x9a0a5e){logger[_0xcc86('0x29')](_0xcc86('0x88'),JSON[_0xcc86('0x39')](_0x9a0a5e));});};exports['unmanaged']=function(_0x86b386,_0x249187,_0x525cb6,_0x4a538d,_0x17a01b,_0x572639){var _0x2f987c,_0x30ddaa,_0x24e87c;_0x572639[_0xcc86('0x73')]=intUtil[_0xcc86('0x74')](_0x572639[_0xcc86('0x73')]);_0x572639['serverUrl']=intUtil[_0xcc86('0x74')](_0x572639[_0xcc86('0x75')]);if(_0x17a01b&&_0x17a01b[_0xcc86('0x76')]){logger[_0xcc86('0x2c')]('['+_0x249187[_0xcc86('0x62')][_0xcc86('0x90')]()+']',_0xcc86('0x77'));_0x249187['recordingURL']=_0x572639[_0xcc86('0x75')]+'/api/voice/recordings/'+_0x249187['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x249187[_0xcc86('0x7a')]);}else{_0x249187['recordingURL']='';}var _0x4930dd=_0x572639[_0xcc86('0x73')]==='zoho.eu'?'eu':_0xcc86('0x89');return getAccessToken(_0x572639)['then'](function(_0x84bd24){_0x24e87c=_0x84bd24;return getUser(_0x24e87c,_0x4930dd,_0x572639);})[_0xcc86('0x26')](function(_0x196302){_0x2f987c=_0x196302;logger[_0xcc86('0x2c')](_0xcc86('0x8a'),_0x2f987c['id']);return getEndUser(_0x24e87c,_0x4930dd,_0x572639,_0x249187[_0xcc86('0x7e')],_0x249187[_0xcc86('0x7f')],_0x2f987c,_0x525cb6);})[_0xcc86('0x26')](function(_0x1ae8af){_0x30ddaa=_0x1ae8af;return getCall(_0x24e87c,_0x4930dd,_0x572639,_0x2f987c,_0x30ddaa,_0x525cb6,_0x249187,_0xcc86('0x6b'));})[_0xcc86('0x26')](function(_0x5f52f4){if(_0x5f52f4){logger[_0xcc86('0x2c')](_0xcc86('0x8e'),_0x5f52f4['id']);}})[_0xcc86('0x28')](function(_0x34f291){logger['error']('['+_0x249187[_0xcc86('0x62')][_0xcc86('0x90')]()+']',JSON[_0xcc86('0x39')](_0x34f291));});}; \ No newline at end of file +var _0x758e=['variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','isArrayLikeObject','findIndex','email','users','profile','Administrator','Using\x20the\x20admin\x20account!','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','Contacts','then','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Who_Id','Full_Name','First_Name','Last_Name','$se_module','Call_Duration','talktime','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','[OUTBOUND]','destcalleridnum','Outbound','unmanaged','monitor_format','toUpperCase','lodash','util','./util','moment','../../../../config/environment','../../../../config/logger','zoho','redis','localhost','socket.io-emitter','[HTTP]','stringify','forEach','includes','picklist','idField','content','toString','type'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x758e,0x1af));var _0xe758=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x758e[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xe758('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xe758('0x1'));var intUtil=require(_0xe758('0x2'));var moment=require(_0xe758('0x3'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xe758('0x4'));var logger=require(_0xe758('0x5'))(_0xe758('0x6'));config[_0xe758('0x7')]=_['defaults'](config[_0xe758('0x7')],{'host':_0xe758('0x8'),'port':0x18eb});var io=require(_0xe758('0x9'))(new Redis(config['redis']));function emit(_0x4c03ba,_0x454ee0,_0x55601a){io['to'](_0x4c03ba)['emit'](_0x454ee0,_0x55601a);}function request(_0x4c16c3){logger['debug'](_0xe758('0xa'),JSON[_0xe758('0xb')](_0x4c16c3));return rp(_0x4c16c3);}function getCustomFields(_0xa84160,_0x4cdd20){var _0x3971f7={};if(_0xa84160['length']>0x0){_[_0xe758('0xc')](_0xa84160,function(_0x38131a){if(_[_0xe758('0xd')](['string',_0xe758('0xe')],_0x38131a['type'])&&_0x38131a[_0xe758('0xf')]){_0x3971f7[_0x38131a[_0xe758('0xf')]]=_0x38131a[_0xe758('0x10')][_0xe758('0x11')]();}else if(_0x38131a[_0xe758('0x12')]===_0xe758('0x13')&&_0x38131a[_0xe758('0x14')]&&_0x38131a[_0xe758('0xf')]&&_0x4cdd20[_0x38131a[_0xe758('0x14')]]){_0x3971f7[_0x38131a['idField']]=_0x4cdd20[_0x38131a[_0xe758('0x14')]]['toString']();}else if(_0x38131a['type']===_0xe758('0x15')&&_0x38131a[_0xe758('0x16')]&&_0x38131a['Variable']['name']&&_0x38131a[_0xe758('0xf')]&&_0x4cdd20[_0x38131a[_0xe758('0x16')][_0xe758('0x17')][_0xe758('0x18')]()]){_0x3971f7[_0x38131a[_0xe758('0xf')]]=_0x4cdd20[_0x38131a[_0xe758('0x16')]['name']['toLowerCase']()][_0xe758('0x11')]();}});}return _0x3971f7;}function getName(_0x2b5729){if(_0x2b5729[_0xe758('0x19')]('\x20')>0x0){var _0x1dc8fc=_0x2b5729[_0xe758('0x1a')](/ (.+)/);if(_0x1dc8fc[0x1]){return _0x1dc8fc;}}return[_0x2b5729,_0x2b5729];}var accountsTokens={};function getAccessToken(_0x4d35d3){return new Promise(function(_0x4eeb82,_0x2a490f){if(!_[_0xe758('0x1b')](accountsTokens[_0x4d35d3['id']])&&!_[_0xe758('0x1b')](accountsTokens[_0x4d35d3['id']][_0xe758('0x1c')])){if(moment()['isBefore'](accountsTokens[_0x4d35d3['id']][_0xe758('0x1d')])){_0x4eeb82(accountsTokens[_0x4d35d3['id']][_0xe758('0x1c')]);}}var _0x19373a;switch(_0x4d35d3[_0xe758('0x1e')]){case'US':_0x19373a=_0xe758('0x1f');break;case'AU':_0x19373a=_0xe758('0x20');break;case'EU':_0x19373a=_0xe758('0x21');break;case'IN':_0x19373a='https://accounts.zoho.in';break;case'CN':_0x19373a='https://accounts.zoho.com.cn';break;default:_0x19373a='https://accounts.zoho.eu';break;}var _0x4e3828={'method':_0xe758('0x22'),'uri':_0x19373a+_0xe758('0x23'),'qs':{'refresh_token':_0x4d35d3[_0xe758('0x24')],'client_id':_0x4d35d3[_0xe758('0x25')],'client_secret':_0x4d35d3['clientSecret'],'grant_type':_0xe758('0x26')},'json':!![]};return rp(_0x4e3828)['then'](function(_0x3bcdac){accountsTokens[_0x4d35d3['id']]={'access_token':_0x3bcdac['access_token'],'expires_in':moment()['add'](_0x3bcdac[_0xe758('0x1d')],_0xe758('0x27'))};_0x4eeb82(_0x3bcdac[_0xe758('0x1c')]);})[_0xe758('0x28')](function(_0x5d557b){logger[_0xe758('0x29')](_0xe758('0x2a'),_0x5d557b[_0xe758('0x2b')]);_0x2a490f(_0x5d557b);});});}function getUser(_0x1934d9,_0x52279e,_0x3a7e96,_0x596835){logger[_0xe758('0x2c')](_0xe758('0x2d'));return request({'method':_0xe758('0x2e'),'uri':util[_0xe758('0x2f')](_0xe758('0x30'),_0x52279e),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1934d9},'json':!![]})['then'](function(_0x450271){if(_0x450271['users']){var _0x44f767=-0x1;if(_[_0xe758('0x31')](_0x450271['users'])){if(!_['isNil'](_0x596835)){_0x44f767=_[_0xe758('0x32')](_0x450271['users'],function(_0xcd9e89){return _0xcd9e89[_0xe758('0x33')]===_0x596835;});}if(_0x44f767>=0x0){logger[_0xe758('0x2c')]('Agent\x20found!');}else{logger[_0xe758('0x2c')]('Using\x20the\x20admin\x20account!');_0x44f767=_[_0xe758('0x32')](_0x450271[_0xe758('0x34')],function(_0x5a01e1){return _0x5a01e1[_0xe758('0x35')][_0xe758('0x17')]===_0xe758('0x36');});}return _0x450271['users'][_0x44f767];}else{if(_0x450271['user'][_0xe758('0x35')]['name']===_0xe758('0x36')){logger[_0xe758('0x2c')](_0xe758('0x37'));user=_0x450271[_0xe758('0x38')];return user;}else{logger[_0xe758('0x29')](_0xe758('0x39'),JSON['stringify'](_0x450271));throw new Error(_0xe758('0x3a')+JSON['stringify'](_0x450271));}}}else{logger['error'](_0xe758('0x39'),JSON[_0xe758('0xb')](_0x450271));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xe758('0xb')](_0x450271));}})[_0xe758('0x28')](function(_0x473711){console['error'](_0x473711);});}function getZohoUser(_0x2a003b,_0x32457e){return new BPromise(function(_0x43403a,_0xaa0351){request(_0x2a003b)['then'](function(_0x1facc6){var _0x6f31e1=null;if(_0x1facc6){_0x6f31e1=_0x1facc6[_0xe758('0x3b')][0x0];_0x6f31e1[_0xe758('0x3c')]=_0x32457e;}_0x43403a(_0x6f31e1);})['catch'](function(_0x392e1a){_0xaa0351(_0x392e1a);});});}function createEndUser(_0x528b68,_0x50304f,_0x36e6e7,_0x28ecd9,_0x932fad,_0x57190e){var _0x36e6e7=getName(_0x36e6e7);return request({'method':_0xe758('0x22'),'uri':_0xe758('0x3d')+_0x50304f+_0xe758('0x3e')+_['startCase'](_0x57190e[_0xe758('0x3f')])+'s','body':{'data':[{'Last_Name':_0x36e6e7[0x1],'First_Name':_0x36e6e7[0x0],'Phone':_0x28ecd9,'Owner':{'name':!_[_0xe758('0x1b')](_0x932fad[_0xe758('0x40')][_0xe758('0x17')])?_0x932fad['role'][_0xe758('0x17')]:!_['isNil'](_0x932fad[_0xe758('0x41')])?_0x932fad[_0xe758('0x41')]+'\x20'+_0x932fad['last_name']:_0x932fad[_0xe758('0x42')],'id':_0x932fad['id']}}]},'headers':{'Authorization':_0xe758('0x43')+_0x528b68},'json':!![]})['then'](function(_0x42469a){if(_0x42469a&&_0x42469a[_0xe758('0x3b')][0x0][_0xe758('0x44')]===_0xe758('0x45')){var _0x1aec7b=_0x42469a[_0xe758('0x3b')][0x0][_0xe758('0x46')];_0x1aec7b[_0xe758('0x3c')]=_[_0xe758('0x47')](_0x57190e['moduleCreate'])+'s';return _0x1aec7b;}logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error(_0xe758('0x48')+JSON[_0xe758('0xb')](data));})[_0xe758('0x28')](function(_0xb18ce1){console[_0xe758('0x49')](_0xe758('0x4a'),_0xb18ce1);});}function getEndUser(_0x5f5a88,_0x63b899,_0x1a29cd,_0x550903,_0x544993,_0x252000,_0x2d96d7){var _0x3d3d6f={'method':_0xe758('0x2e'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5f5a88},'json':!![]};switch(_0x2d96d7[_0xe758('0x4b')]){case _0xe758('0x4c'):_0x3d3d6f[_0xe758('0x4d')]='https://www.zohoapis.'+_0x63b899+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x544993+'))';return getZohoUser(_0x3d3d6f,_0xe758('0x4e'))[_0xe758('0x4f')](function(_0x26abce){if(_0x26abce)return _0x26abce;_0x3d3d6f[_0xe758('0x4d')]=_0xe758('0x3d')+_0x63b899+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x544993+'))';return getZohoUser(_0x3d3d6f,_0xe758('0x50'))[_0xe758('0x4f')](function(_0x58ebcc){if(_0x58ebcc)return _0x58ebcc;if(_0x2d96d7['moduleCreate']!=_0xe758('0x51')){return createEndUser(_0x5f5a88,_0x63b899,_0x550903,_0x544993,_0x252000,_0x2d96d7);}else{return{};}});});break;case _0xe758('0x52'):_0x3d3d6f['uri']=_0xe758('0x3d')+_0x63b899+_0xe758('0x53')+_0x544993+'))';return getZohoUser(_0x3d3d6f,_0xe758('0x4e'))['then'](function(_0x344bea){if(_0x344bea)return _0x344bea;if(_0x2d96d7[_0xe758('0x3f')]!='nothing'){return createEndUser(_0x5f5a88,_0x63b899,_0x550903,_0x544993,_0x252000,_0x2d96d7);}else{return{};}});break;case _0xe758('0x54'):_0x3d3d6f[_0xe758('0x4d')]='https://www.zohoapis.'+_0x63b899+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x544993+'))';return getZohoUser(_0x3d3d6f,_0xe758('0x50'))[_0xe758('0x4f')](function(_0x16bf26){if(_0x16bf26)return _0x16bf26;if(_0x2d96d7[_0xe758('0x3f')]!=_0xe758('0x51')){return createEndUser(_0x5f5a88,_0x63b899,_0x550903,_0x544993,_0x252000,_0x2d96d7);}else{return{};}});break;}}function getCall(_0x29bc4e,_0x158fb3,_0x1c8364,_0x5a0348,_0xb02e52,_0x457b5d,_0x30d61d,_0x5f50d8){logger['info'](_0xe758('0x55'));var _0x4d66a1={};_0x4d66a1[_0xe758('0x56')]={'name':!_[_0xe758('0x1b')](_0x5a0348['role'][_0xe758('0x17')])&&!_[_0xe758('0x1b')](_0x5a0348[_0xe758('0x35')][_0xe758('0x17')])&&_0x5a0348['profile'][_0xe758('0x17')]===_0xe758('0x57')?_0x5a0348['role'][_0xe758('0x17')]:!_['isNil'](_0x5a0348['first_name'])?_0x5a0348[_0xe758('0x41')]+'\x20'+_0x5a0348[_0xe758('0x42')]:_0x5a0348[_0xe758('0x42')],'id':_0x5a0348['id']};_0x4d66a1[_0xe758('0x58')]=intUtil[_0xe758('0x59')](_0x457b5d[_0xe758('0x5a')],_0x30d61d,'\x20');_0x4d66a1['Description']=intUtil[_0xe758('0x59')](_0x457b5d['Descriptions'],_0x30d61d,'\x0a');if(_0xb02e52[_0xe758('0x3c')]==='Contacts'){_0x4d66a1[_0xe758('0x5b')]={'name':!_[_0xe758('0x1b')](_0xb02e52[_0xe758('0x5c')])?_0xb02e52[_0xe758('0x5c')]:!_['isNil'](_0xb02e52[_0xe758('0x5d')])?_0xb02e52['First_Name']+'\x20'+_0xb02e52[_0xe758('0x5e')]:_0xb02e52['Last_Name'],'id':_0xb02e52['id']};}if(_0xb02e52[_0xe758('0x3c')]===_0xe758('0x50')){_0x4d66a1['What_Id']={'name':!_[_0xe758('0x1b')](_0xb02e52['Full_Name'])?_0xb02e52[_0xe758('0x5c')]:!_[_0xe758('0x1b')](_0xb02e52['First_Name'])?_0xb02e52[_0xe758('0x5d')]+'\x20'+_0xb02e52['Last_Name']:_0xb02e52[_0xe758('0x5e')],'id':_0xb02e52['id']};_0x4d66a1[_0xe758('0x5f')]=_[_0xe758('0x47')](_0xb02e52[_0xe758('0x3c')]);}if(_0x30d61d['talktime']){_0x4d66a1[_0xe758('0x60')]=moment['utc'](parseInt(_0x30d61d[_0xe758('0x61')])*0x3e8)[_0xe758('0x2f')](_0xe758('0x62'));}else if(_0x30d61d[_0xe758('0x63')]&&_0x30d61d[_0xe758('0x64')]){_0x4d66a1['Call_Duration']=moment[_0xe758('0x65')](moment(_0x30d61d[_0xe758('0x64')],_0xe758('0x66'))['diff'](moment(_0x30d61d[_0xe758('0x67')],'YYYY-MM-DDTHH:mm:ss')))[_0xe758('0x2f')](_0xe758('0x62'));}switch(_0x30d61d[_0xe758('0x68')]){case'called':_0x4d66a1[_0xe758('0x69')]='Called';break;case _0xe758('0x6a'):case _0xe758('0x6b'):_0x4d66a1[_0xe758('0x69')]=_0xe758('0x6c');break;case _0xe758('0x6d'):_0x4d66a1[_0xe758('0x69')]=_0xe758('0x6e');break;case _0xe758('0x6f'):_0x4d66a1[_0xe758('0x69')]=_0xe758('0x70');break;case _0xe758('0x71'):_0x4d66a1[_0xe758('0x69')]=_0xe758('0x72');default:}_0x4d66a1[_0xe758('0x73')]=(_0x5f50d8===_0xe758('0x74')?moment(_0x30d61d[_0xe758('0x67')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x30d61d['agentcalledAt'])[_0xe758('0x2f')](_0xe758('0x66')))||moment()[_0xe758('0x2f')](_0xe758('0x66'));_0x4d66a1[_0xe758('0x75')]=_0x5f50d8||_0xe758('0x76');_0x4d66a1=_[_0xe758('0x77')](_0x4d66a1,getCustomFields(_0x457b5d[_0xe758('0x78')],_0x30d61d));return request({'method':_0xe758('0x22'),'uri':_0xe758('0x3d')+_0x158fb3+'/crm/v2/Calls','headers':{'Authorization':_0xe758('0x43')+_0x29bc4e},'body':{'data':[_0x4d66a1]},'json':!![]})[_0xe758('0x4f')](function(_0x108758){if(_0x108758&&_0x108758[_0xe758('0x3b')][0x0][_0xe758('0x44')]===_0xe758('0x45')){logger[_0xe758('0x2c')](_0xe758('0x79'));return{'id':_0x108758['data'][0x0][_0xe758('0x46')]['id']};}})[_0xe758('0x28')](function(_0x53809b){logger[_0xe758('0x2c')]('err',_0x53809b[_0xe758('0x2b')]);console['log'](_0xe758('0x7a'),_0x53809b);});}exports[_0xe758('0x7b')]=function(_0x1d05ee,_0x259a78,_0x3aea99,_0x1268b4,_0x4e61e5,_0x463ae7){var _0x4411fa,_0x2abe24,_0x3aa291;_0x463ae7[_0xe758('0x7c')]=intUtil[_0xe758('0x7d')](_0x463ae7[_0xe758('0x7c')]);_0x463ae7[_0xe758('0x7e')]=intUtil[_0xe758('0x7d')](_0x463ae7[_0xe758('0x7e')]);if(_0x4e61e5&&_0x4e61e5['monitor_format']){logger[_0xe758('0x2c')]('[QUEUE]',_0xe758('0x7f'));_0x259a78[_0xe758('0x80')]=_0x463ae7['serverUrl']+_0xe758('0x81')+_0x259a78['uniqueid']+_0xe758('0x82')+md5(_0x259a78[_0xe758('0x83')]);}else{_0x259a78[_0xe758('0x80')]='';}var _0x405adf=_0x463ae7[_0xe758('0x7c')]===_0xe758('0x84')?'eu':_0xe758('0x85');return getAccessToken(_0x463ae7)[_0xe758('0x4f')](function(_0x2b8c69){_0x3aa291=_0x2b8c69;return getUser(_0x3aa291,_0x405adf,_0x463ae7,_0x1268b4[_0xe758('0x33')]);})['then'](function(_0x14c7d7){_0x4411fa=_0x14c7d7;logger[_0xe758('0x2c')](_0xe758('0x86'),_0x4411fa['id']);return getEndUser(_0x3aa291,_0x405adf,_0x463ae7,_0x259a78[_0xe758('0x87')],_0x259a78[_0xe758('0x88')],_0x4411fa,_0x3aea99);})[_0xe758('0x4f')](function(_0x4fb550){_0x2abe24=_0x4fb550;return getCall(_0x3aa291,_0x405adf,_0x463ae7,_0x4411fa,_0x2abe24,_0x3aea99,_0x259a78,_0xe758('0x76'));})[_0xe758('0x4f')](function(_0x3a41c2){if(_0x3a41c2){logger[_0xe758('0x2c')](_0xe758('0x89'),_0x3a41c2['id']);logger[_0xe758('0x2c')](_0xe758('0x8a'),_0xe758('0x8b'));emit(util[_0xe758('0x2f')](_0xe758('0x8c'),_0x1268b4['name']),'trigger:browser:url',{'uri':_0xe758('0x8d')+_0x463ae7['host']+_0xe758('0x8e')+_0x3a41c2['id']});}})[_0xe758('0x28')](function(_0x12da60){logger[_0xe758('0x29')](_0xe758('0x8a'),JSON[_0xe758('0xb')](_0x12da60));});};exports[_0xe758('0x74')]=function(_0x2f03d6,_0x269610,_0x440c46,_0x34412b,_0x329604,_0x2a190a,_0x955859){var _0x4cf9a7,_0x5559e3,_0x4d887a;_0x2a190a[_0xe758('0x7c')]=intUtil[_0xe758('0x7d')](_0x2a190a[_0xe758('0x7c')]);_0x2a190a[_0xe758('0x7e')]=intUtil[_0xe758('0x7d')](_0x2a190a[_0xe758('0x7e')]);if(_0x955859&&_0x955859['recordingFormat']&&_0x955859[_0xe758('0x8f')]!=='none'){logger[_0xe758('0x2c')](_0xe758('0x90'),_0xe758('0x7f'));_0x269610[_0xe758('0x80')]=_0x2a190a[_0xe758('0x7e')]+_0xe758('0x81')+_0x269610[_0xe758('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x269610[_0xe758('0x83')]);}var _0x3aedbe=_0x2a190a['host']===_0xe758('0x84')?'eu':'com';return getAccessToken(_0x2a190a)[_0xe758('0x4f')](function(_0x864cee){_0x4d887a=_0x864cee;return getUser(_0x4d887a,_0x3aedbe,_0x2a190a,_0x34412b[_0xe758('0x33')]);})[_0xe758('0x4f')](function(_0x21268b){_0x4cf9a7=_0x21268b;logger['info'](_0xe758('0x86'),_0x4cf9a7['id']);return getEndUser(_0x4d887a,_0x3aedbe,_0x2a190a,_0x269610['destcalleridname'],_0x269610[_0xe758('0x91')],_0x4cf9a7,_0x440c46);})[_0xe758('0x4f')](function(_0x16a134){_0x5559e3=_0x16a134;return getCall(_0x4d887a,_0x3aedbe,_0x2a190a,_0x4cf9a7,_0x5559e3,_0x440c46,_0x269610,_0xe758('0x92'));})[_0xe758('0x4f')](function(_0x5555b9){if(_0x5555b9){logger['info'](_0xe758('0x89'),_0x5555b9['id']);logger[_0xe758('0x2c')](_0xe758('0x90'),_0xe758('0x8b'));emit(util[_0xe758('0x2f')](_0xe758('0x8c'),_0x34412b[_0xe758('0x17')]),'trigger:browser:url',{'uri':_0xe758('0x8d')+_0x2a190a['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x5555b9['id']});}})[_0xe758('0x28')](function(_0x5c3465){logger[_0xe758('0x29')](_0xe758('0x90'),JSON[_0xe758('0xb')](_0x5c3465));});};exports[_0xe758('0x93')]=function(_0x5bd737,_0x4474b2,_0x3ab804,_0x5a7986,_0x36b59f,_0x373d24){var _0x43d9cd,_0x4c1b32,_0x1d8600;_0x373d24[_0xe758('0x7c')]=intUtil['stripTrailingSlash'](_0x373d24[_0xe758('0x7c')]);_0x373d24['serverUrl']=intUtil['stripTrailingSlash'](_0x373d24[_0xe758('0x7e')]);if(_0x36b59f&&_0x36b59f[_0xe758('0x94')]){logger[_0xe758('0x2c')]('['+_0x4474b2[_0xe758('0x68')][_0xe758('0x95')]()+']',_0xe758('0x7f'));_0x4474b2[_0xe758('0x80')]=_0x373d24[_0xe758('0x7e')]+_0xe758('0x81')+_0x4474b2[_0xe758('0x83')]+_0xe758('0x82')+md5(_0x4474b2[_0xe758('0x83')]);}else{_0x4474b2[_0xe758('0x80')]='';}var _0x57a702=_0x373d24['host']===_0xe758('0x84')?'eu':'com';return getAccessToken(_0x373d24)['then'](function(_0x401caa){_0x1d8600=_0x401caa;return getUser(_0x1d8600,_0x57a702,_0x373d24);})[_0xe758('0x4f')](function(_0x5127fa){_0x43d9cd=_0x5127fa;logger[_0xe758('0x2c')](_0xe758('0x86'),_0x43d9cd['id']);return getEndUser(_0x1d8600,_0x57a702,_0x373d24,_0x4474b2[_0xe758('0x87')],_0x4474b2['calleridnum'],_0x43d9cd,_0x3ab804);})[_0xe758('0x4f')](function(_0x3ce595){_0x4c1b32=_0x3ce595;return getCall(_0x1d8600,_0x57a702,_0x373d24,_0x43d9cd,_0x4c1b32,_0x3ab804,_0x4474b2,_0xe758('0x76'));})[_0xe758('0x4f')](function(_0x2ad7c2){if(_0x2ad7c2){logger['info'](_0xe758('0x89'),_0x2ad7c2['id']);}})[_0xe758('0x28')](function(_0x45be6e){logger[_0xe758('0x29')]('['+_0x4474b2[_0xe758('0x68')][_0xe758('0x95')]()+']',JSON['stringify'](_0x45be6e));});}; \ 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 4f095ad..d273a0e 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 _0x5626=['trigger','exec','data2','Script','render','data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','mustache'];(function(_0x745ce1,_0x1ef68c){var _0x2a2a40=function(_0x4d6fa1){while(--_0x4d6fa1){_0x745ce1['push'](_0x745ce1['shift']());}};_0x2a2a40(++_0x1ef68c);}(_0x5626,0x102));var _0x6562=function(_0x44a5b0,_0x21b73c){_0x44a5b0=_0x44a5b0-0x0;var _0x42f897=_0x5626[_0x44a5b0];return _0x42f897;};'use strict';var util=require(_0x6562('0x0'));var sh=require('shelljs');var Mustache=require(_0x6562('0x1'));var logger=require('../../../../config/logger')(_0x6562('0x2'));exports[_0x6562('0x3')]=function(_0x29530f,_0x42df45){var _0x4c5141=_0x29530f[_0x6562('0x4')]?_0x29530f[_0x6562('0x4')]:_0x6562('0x5');var _0x4c6726=_0x29530f['data3']?Mustache[_0x6562('0x6')](_0x29530f[_0x6562('0x7')],_0x42df45):_0x42df45;sh[_0x6562('0x3')](_0x4c6726,function(_0x66553b,_0x31181d,_0x380f89){if(_0x66553b!==0x0){logger[_0x6562('0x8')](util['format'](_0x6562('0x9'),_0x4c5141,_0x4c6726,_0x66553b,_0x380f89));}else{logger[_0x6562('0xa')](util[_0x6562('0xb')](_0x6562('0xc'),_0x4c5141,_0x4c6726,_0x31181d));}});}; \ No newline at end of file +var _0x5ffe=['shelljs','../../../../config/logger','exec','data2','data3','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util'];(function(_0x2f73a7,_0x1be12b){var _0x4e8690=function(_0x5b0a74){while(--_0x5b0a74){_0x2f73a7['push'](_0x2f73a7['shift']());}};_0x4e8690(++_0x1be12b);}(_0x5ffe,0xaa));var _0xe5ff=function(_0x32974a,_0xd71e64){_0x32974a=_0x32974a-0x0;var _0x29fb8b=_0x5ffe[_0x32974a];return _0x29fb8b;};'use strict';var util=require(_0xe5ff('0x0'));var sh=require(_0xe5ff('0x1'));var Mustache=require('mustache');var logger=require(_0xe5ff('0x2'))('trigger');exports[_0xe5ff('0x3')]=function(_0x32f381,_0x1a3ded){var _0x34f26d=_0x32f381[_0xe5ff('0x4')]?_0x32f381[_0xe5ff('0x4')]:'Script';var _0x1d1ada=_0x32f381[_0xe5ff('0x5')]?Mustache['render'](_0x32f381[_0xe5ff('0x5')],_0x1a3ded):_0x1a3ded;sh[_0xe5ff('0x3')](_0x1d1ada,function(_0x3426ba,_0x35f582,_0x1efb74){if(_0x3426ba!==0x0){logger['error'](util[_0xe5ff('0x6')](_0xe5ff('0x7'),_0x34f26d,_0x1d1ada,_0x3426ba,_0x1efb74));}else{logger[_0xe5ff('0x8')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x34f26d,_0x1d1ada,_0x35f582));}});}; \ 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 fa30eb8..cc3194b 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 _0x6a35=['POST','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','stringify','then','isNil',',\x20request\x20body:\x20','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','request-promise','lodash','../../../../config/logger','trigger','exec','data1','toUpperCase','data2','data5','number','parse','render','data6','error','stack','GET','DELETE'];(function(_0xce7dc4,_0x13498e){var _0x31f02f=function(_0x5ae1fe){while(--_0x5ae1fe){_0xce7dc4['push'](_0xce7dc4['shift']());}};_0x31f02f(++_0x13498e);}(_0x6a35,0x1c0));var _0x56a3=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x6a35[_0x36ed48];return _0x51c63a;};'use strict';var rp=require(_0x56a3('0x0'));var util=require('util');var _=require(_0x56a3('0x1'));var Mustache=require('mustache');var logger=require(_0x56a3('0x2'))(_0x56a3('0x3'));exports[_0x56a3('0x4')]=function(_0x16d7f9,_0x22e313){var _0x3ddaed,_0x23483c;var _0x388220={'method':_0x16d7f9[_0x56a3('0x5')][_0x56a3('0x6')](),'uri':Mustache['render'](_0x16d7f9[_0x56a3('0x7')],_0x22e313),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x16d7f9[_0x56a3('0x8')])===_0x56a3('0x9')&&parseInt(_0x16d7f9[_0x56a3('0x8')])>=0x1&&parseInt(_0x16d7f9[_0x56a3('0x8')])<=0xa?parseInt(_0x16d7f9[_0x56a3('0x8')])*0x3e8:0x5*0x3e8};try{_0x388220['headers']=_0x16d7f9['data6']?JSON[_0x56a3('0xa')](Mustache[_0x56a3('0xb')](_0x16d7f9[_0x56a3('0xc')],_0x22e313)):{};}catch(_0x158175){logger[_0x56a3('0xd')](_0x158175[_0x56a3('0xe')]);}switch(_0x16d7f9[_0x56a3('0x5')]['toUpperCase']()){case _0x56a3('0xf'):case _0x56a3('0x10'):_0x3ddaed=null;_0x388220['qs']=_0x22e313;break;case _0x56a3('0x11'):case'PUT':if(_0x16d7f9[_0x56a3('0x12')]){try{_0x3ddaed=JSON['parse'](Mustache[_0x56a3('0xb')](_0x16d7f9['data7'],_0x22e313));_0x388220[_0x56a3('0x13')]=_0x3ddaed;}catch(_0x1938a2){logger[_0x56a3('0xd')](_0x1938a2[_0x56a3('0xe')]);logger[_0x56a3('0xd')](_0x56a3('0x14'));}}else{_0x3ddaed=_0x22e313;_0x388220[_0x56a3('0x13')]=_0x3ddaed;}break;}logger[_0x56a3('0x15')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x16d7f9[_0x56a3('0x5')],_0x16d7f9[_0x56a3('0x7')],JSON[_0x56a3('0x16')](_0x388220)));rp(_0x388220)[_0x56a3('0x17')](function(_0x392448){_0x3ddaed=!_[_0x56a3('0x18')](_0x3ddaed)?_0x56a3('0x19')+_0x3ddaed:'';_0x23483c=typeof _0x392448['body']==='object'?JSON[_0x56a3('0x16')](_0x392448['body']):_0x392448['body'];logger[_0x56a3('0x15')](util[_0x56a3('0x1a')](_0x56a3('0x1b'),_0x16d7f9[_0x56a3('0x5')],_0x16d7f9[_0x56a3('0x7')],_0x392448[_0x56a3('0x1c')],_0x23483c));})[_0x56a3('0x1d')](function(_0x171ed5){logger[_0x56a3('0xd')](util[_0x56a3('0x1a')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x16d7f9['data1'],_0x16d7f9[_0x56a3('0x7')],_0x171ed5[_0x56a3('0x1c')],_0x171ed5[_0x56a3('0x1e')],_0x171ed5['message']));});}; \ No newline at end of file +var _0xd40e=['format','then','isNil',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data2','data5','number','parse','render','data6','stack','POST','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0xd40e,0x114));var _0xed40=function(_0x324e86,_0x81b1cb){_0x324e86=_0x324e86-0x0;var _0x592846=_0xd40e[_0x324e86];return _0x592846;};'use strict';var rp=require('request-promise');var util=require(_0xed40('0x0'));var _=require(_0xed40('0x1'));var Mustache=require(_0xed40('0x2'));var logger=require(_0xed40('0x3'))(_0xed40('0x4'));exports[_0xed40('0x5')]=function(_0x524af5,_0x4a0ef7){var _0x41d8e2,_0x9e8127;var _0x5a407c={'method':_0x524af5[_0xed40('0x6')][_0xed40('0x7')](),'uri':Mustache['render'](_0x524af5[_0xed40('0x8')],_0x4a0ef7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x524af5[_0xed40('0x9')])===_0xed40('0xa')&&parseInt(_0x524af5[_0xed40('0x9')])>=0x1&&parseInt(_0x524af5['data5'])<=0xa?parseInt(_0x524af5[_0xed40('0x9')])*0x3e8:0x5*0x3e8};try{_0x5a407c['headers']=_0x524af5['data6']?JSON[_0xed40('0xb')](Mustache[_0xed40('0xc')](_0x524af5[_0xed40('0xd')],_0x4a0ef7)):{};}catch(_0x5820ae){logger['error'](_0x5820ae[_0xed40('0xe')]);}switch(_0x524af5[_0xed40('0x6')][_0xed40('0x7')]()){case'GET':case'DELETE':_0x41d8e2=null;_0x5a407c['qs']=_0x4a0ef7;break;case _0xed40('0xf'):case'PUT':if(_0x524af5[_0xed40('0x10')]){try{_0x41d8e2=JSON[_0xed40('0xb')](Mustache['render'](_0x524af5['data7'],_0x4a0ef7));_0x5a407c[_0xed40('0x11')]=_0x41d8e2;}catch(_0x385822){logger[_0xed40('0x12')](_0x385822[_0xed40('0xe')]);logger['error'](_0xed40('0x13'));}}else{_0x41d8e2=_0x4a0ef7;_0x5a407c[_0xed40('0x11')]=_0x41d8e2;}break;}logger[_0xed40('0x14')](util[_0xed40('0x15')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x524af5[_0xed40('0x6')],_0x524af5[_0xed40('0x8')],JSON['stringify'](_0x5a407c)));rp(_0x5a407c)[_0xed40('0x16')](function(_0x1c9ef6){_0x41d8e2=!_[_0xed40('0x17')](_0x41d8e2)?_0xed40('0x18')+_0x41d8e2:'';_0x9e8127=typeof _0x1c9ef6[_0xed40('0x11')]===_0xed40('0x19')?JSON[_0xed40('0x1a')](_0x1c9ef6[_0xed40('0x11')]):_0x1c9ef6['body'];logger[_0xed40('0x14')](util[_0xed40('0x15')](_0xed40('0x1b'),_0x524af5[_0xed40('0x6')],_0x524af5[_0xed40('0x8')],_0x1c9ef6['statusCode'],_0x9e8127));})[_0xed40('0x1c')](function(_0xbbceda){logger[_0xed40('0x12')](util[_0xed40('0x15')](_0xed40('0x1d'),_0x524af5['data1'],_0x524af5[_0xed40('0x8')],_0xbbceda[_0xed40('0x1e')],_0xbbceda[_0xed40('0x1f')],_0xbbceda[_0xed40('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 1ca82bf..9e50a52 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 _0x5544=['exports','jayson/promise','bluebird','client','Request','request','then','rpc','routing','error','message','result'];(function(_0x1a54a0,_0x49b3f4){var _0x11e76c=function(_0x51af42){while(--_0x51af42){_0x1a54a0['push'](_0x1a54a0['shift']());}};_0x11e76c(++_0x49b3f4);}(_0x5544,0xe5));var _0x4554=function(_0x65c27d,_0x530194){_0x65c27d=_0x65c27d-0x0;var _0x28fc4f=_0x5544[_0x65c27d];return _0x28fc4f;};'use strict';var jayson=require(_0x4554('0x0'));var BPromise=require(_0x4554('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0x4554('0x2')]['http']({'port':0x2329});client[_0x4554('0x3')]=function(_0x2125a1,_0x48d881){return new BPromise(function(_0x491981,_0x230d9b){return client[_0x4554('0x4')](_0x2125a1,_0x48d881)[_0x4554('0x5')](function(_0x692fdc){logger['debug'](_0x4554('0x6'),_0x4554('0x7'),_0x2125a1,_0x48d881,_0x692fdc);if(_0x692fdc[_0x4554('0x8')]){logger[_0x4554('0x8')]('rpc',_0x4554('0x7'),_0x2125a1,_0x692fdc[_0x4554('0x8')][_0x4554('0x9')],_0x48d881);return _0x230d9b(_0x692fdc['error'][_0x4554('0x9')]);}else{return _0x491981(_0x692fdc[_0x4554('0xa')]);}})['catch'](function(_0x5108d5){logger['error'](_0x4554('0x6'),_0x4554('0x7'),_0x2125a1,_0x5108d5,_0x48d881);return _0x230d9b(_0x5108d5);});});};module[_0x4554('0xb')]=client; \ No newline at end of file +var _0x1441=['error','message','result','catch','jayson/promise','bluebird','../../config/logger','routing','http','Request','then','debug','rpc'];(function(_0x35dee3,_0x378ca2){var _0x678664=function(_0x3a591e){while(--_0x3a591e){_0x35dee3['push'](_0x35dee3['shift']());}};_0x678664(++_0x378ca2);}(_0x1441,0x1cb));var _0x1144=function(_0x508abe,_0x37d20c){_0x508abe=_0x508abe-0x0;var _0x23d357=_0x1441[_0x508abe];return _0x23d357;};'use strict';var jayson=require(_0x1144('0x0'));var BPromise=require(_0x1144('0x1'));var logger=require(_0x1144('0x2'))(_0x1144('0x3'));var client=jayson['client'][_0x1144('0x4')]({'port':0x2329});client[_0x1144('0x5')]=function(_0x1f4218,_0x17d985){return new BPromise(function(_0x56471f,_0x2eaa81){return client['request'](_0x1f4218,_0x17d985)[_0x1144('0x6')](function(_0x4004b2){logger[_0x1144('0x7')](_0x1144('0x8'),_0x1144('0x3'),_0x1f4218,_0x17d985,_0x4004b2);if(_0x4004b2[_0x1144('0x9')]){logger['error'](_0x1144('0x8'),_0x1144('0x3'),_0x1f4218,_0x4004b2['error'][_0x1144('0xa')],_0x17d985);return _0x2eaa81(_0x4004b2[_0x1144('0x9')][_0x1144('0xa')]);}else{return _0x56471f(_0x4004b2[_0x1144('0xb')]);}})[_0x1144('0xc')](function(_0x49c976){logger['error']('rpc',_0x1144('0x3'),_0x1f4218,_0x49c976,_0x17d985);return _0x2eaa81(_0x49c976);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 8207777..147e09a 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 _0xfcbb=['resolve','then','getMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','bluebird','./server','./realtime','./rpc/setting'];(function(_0x5dd290,_0x5c1bef){var _0x8a0cc6=function(_0x3d5466){while(--_0x3d5466){_0x5dd290['push'](_0x5dd290['shift']());}};_0x8a0cc6(++_0x5c1bef);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x10b6ae,_0x56a559){_0x10b6ae=_0x10b6ae-0x0;var _0x1321e9=_0xfcbb[_0x10b6ae];return _0x1321e9;};'use strict';var BPromise=require(_0xbfcb('0x0'));var server=require(_0xbfcb('0x1'));var Realtime=require(_0xbfcb('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require(_0xbfcb('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xbfcb('0x4')]()[_0xbfcb('0x5')](mailAccount[_0xbfcb('0x6')]())[_0xbfcb('0x5')](realtime['initMailAccounts']())['then'](function(){email[_0xbfcb('0x7')](realtime[_0xbfcb('0x8')]);return realtime;});}function main(){return server[_0xbfcb('0x9')](realtime,email)[_0xbfcb('0x5')](function(){return initRealtime();})[_0xbfcb('0x5')](function(){return setting[_0xbfcb('0xa')]();})[_0xbfcb('0x5')](function(_0x571001){return setInterval(initRealtime,_0x571001[_0xbfcb('0xb')]*0x3e8);})[_0xbfcb('0xc')](function(_0x346685){console['log'](_0x346685);});}main(); \ No newline at end of file +var _0xd448=['getMailAccounts','initMailAccounts','refresh','getSettings','loginMailFrequency','catch','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','resolve','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd448,0x172));var _0x8d44=function(_0x46d1fe,_0x5799cc){_0x46d1fe=_0x46d1fe-0x0;var _0xb4c964=_0xd448[_0x46d1fe];return _0xb4c964;};'use strict';var BPromise=require('bluebird');var server=require(_0x8d44('0x0'));var Realtime=require(_0x8d44('0x1'));var EmailChannel=require(_0x8d44('0x2'));var mailAccount=require(_0x8d44('0x3'));var setting=require(_0x8d44('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x8d44('0x5')]()[_0x8d44('0x6')](mailAccount[_0x8d44('0x7')]())[_0x8d44('0x6')](realtime[_0x8d44('0x8')]())['then'](function(){email[_0x8d44('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0x8d44('0x6')](function(){return initRealtime();})[_0x8d44('0x6')](function(){return setting[_0x8d44('0xa')]();})[_0x8d44('0x6')](function(_0x51e368){return setInterval(initRealtime,_0x51e368[_0x8d44('0xb')]*0x3e8);})[_0x8d44('0xc')](function(_0x52f047){console['log'](_0x52f047);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index e136f72..5641916 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 _0xe715=['./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','key','active','Imap','status','messageStatus','isNil','emit','prototype','hasOwnProperty','imapAccounts','box','handleImapBox','bind','email','handleImapEmail','handleImapEnd','error','disabled','connected','messages','total','firstName','from','notify','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','sendMail','send','verifySmtp','Smtp','verify','then','verified','catch','moment','md5','ioredis','redis','defaults','./imap'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe715,0x114));var _0x5e71=function(_0x21f508,_0x3f4b97){_0x21f508=_0x21f508-0x0;var _0x11b139=_0xe715[_0x21f508];return _0x11b139;};'use strict';var _=require('lodash');var moment=require(_0x5e71('0x0'));var BPromise=require('bluebird');var md5=require(_0x5e71('0x1'));var Redis=require(_0x5e71('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('email');config[_0x5e71('0x3')]=_[_0x5e71('0x4')](config[_0x5e71('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5e71('0x3')]));var EmailImap=require(_0x5e71('0x5'));var EmailSmtp=require(_0x5e71('0x6'));var mailAccount=require(_0x5e71('0x7'));var md5Accounts={};function EmailChannel(_0x1ca216){logger[_0x5e71('0x8')](_0x5e71('0x9'));this[_0x5e71('0xa')]=_0x1ca216['mailAccounts'];this['imapAccounts']={};this[_0x5e71('0xb')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0xe8bdc9){var _0x3f6dae=this[_0x5e71('0xa')][_0xe8bdc9];var _0xf2701f={'id':_0x3f6dae['id'],'name':_0x3f6dae['name'],'key':_0x3f6dae[_0x5e71('0xc')],'active':_0x3f6dae[_0x5e71('0xd')],'Imap':{'status':_0x3f6dae[_0x5e71('0xe')][_0x5e71('0xf')],'messageStatus':_0x3f6dae[_0x5e71('0xe')][_0x5e71('0x10')],'total':_0x3f6dae[_0x5e71('0xe')]['total']}};if(_[_0x5e71('0x11')](md5Accounts[_0xe8bdc9])){md5Accounts[_0xe8bdc9]={};}var _0x1f16b4=md5(JSON['stringify'](_0xf2701f));if(md5Accounts[_0xe8bdc9]['md5']!==_0x1f16b4){md5Accounts[_0xe8bdc9][_0x5e71('0x1')]=_0x1f16b4;io[_0x5e71('0x12')]('mailAccount:update',_0xf2701f);}};EmailChannel[_0x5e71('0x13')]['refresh']=function(_0x83fec8){for(var _0x818d in _0x83fec8){if(_0x83fec8[_0x5e71('0x14')](_0x818d)){if(_0x83fec8[_0x818d][_0x5e71('0xe')]&&_0x83fec8[_0x818d][_0x5e71('0xd')]){var _0x3d7e21=_0x83fec8[_0x818d]['Imap'];if(!this['imapAccounts'][_0x5e71('0x14')](_0x3d7e21['id'])){this['imapAccounts'][_0x3d7e21['id']]=new EmailImap(_0x3d7e21,_0x83fec8[_0x818d]['email']);this[_0x5e71('0x15')][_0x3d7e21['id']]['on'](_0x5e71('0x16'),this[_0x5e71('0x17')][_0x5e71('0x18')](this,_0x818d));this[_0x5e71('0x15')][_0x3d7e21['id']]['on'](_0x5e71('0x19'),this[_0x5e71('0x1a')]['bind'](this,_0x818d));this[_0x5e71('0x15')][_0x3d7e21['id']]['on']('end',this[_0x5e71('0x1b')][_0x5e71('0x18')](this,_0x818d));this['imapAccounts'][_0x3d7e21['id']]['on'](_0x5e71('0x1c'),this['handleImapError'][_0x5e71('0x18')](this,_0x818d));}}else{if(_[_0x5e71('0x11')](this['mailAccounts'][_0x818d][_0x5e71('0xe')])){this[_0x5e71('0xa')][_0x818d]['Imap']={};}this[_0x5e71('0xa')][_0x818d]['Imap'][_0x5e71('0xf')]=_0x5e71('0x1d');this['mailAccounts'][_0x818d][_0x5e71('0xe')][_0x5e71('0x10')]='';this['emit'](_0x818d);}}}};EmailChannel['prototype'][_0x5e71('0x17')]=function(_0x55a52b,_0x3f6162){if(this[_0x5e71('0xa')][_0x55a52b]){this[_0x5e71('0xa')][_0x55a52b]['Imap'][_0x5e71('0xf')]=_0x5e71('0x1e');this[_0x5e71('0xa')][_0x55a52b][_0x5e71('0xe')]['messageStatus']=_0x3f6162['name'];if(_0x3f6162[_0x5e71('0x1f')]){this[_0x5e71('0xa')][_0x55a52b]['Imap'][_0x5e71('0x20')]=_0x3f6162['messages'][_0x5e71('0x20')];}return this[_0x5e71('0x12')](_0x55a52b);}};EmailChannel['prototype']['handleImapEmail']=function(_0xdfaff7,_0x5c26e3){logger[_0x5e71('0x8')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x5c26e3[_0x5e71('0x21')],_0x5c26e3['lastName'],_0x5c26e3[_0x5e71('0x22')],_0xdfaff7);if(this[_0x5e71('0xa')][_0xdfaff7]){return mailAccount[_0x5e71('0x23')](_0xdfaff7,_0x5c26e3)['then'](function(_0x26dbff){if(_0x26dbff){logger[_0x5e71('0x8')](_0x5e71('0x24'));}})['catch'](function(_0x2cc65c){logger[_0x5e71('0x1c')](_0x5e71('0x25'),JSON[_0x5e71('0x26')](_0x2cc65c));});}};EmailChannel[_0x5e71('0x13')][_0x5e71('0x1b')]=function(_0x1e8f75){if(this['mailAccounts'][_0x1e8f75]&&this[_0x5e71('0xa')][_0x1e8f75][_0x5e71('0xe')]){if(this[_0x5e71('0x15')][this[_0x5e71('0xa')][_0x1e8f75]['Imap']['id']]){delete this['imapAccounts'][this[_0x5e71('0xa')][_0x1e8f75][_0x5e71('0xe')]['id']];}this[_0x5e71('0xa')][_0x1e8f75][_0x5e71('0xe')]['lastSync']=moment();this['emit'](_0x1e8f75);}};EmailChannel['prototype']['handleImapError']=function(_0x172123,_0x28711e){if(this[_0x5e71('0xa')][_0x172123]){this[_0x5e71('0xa')][_0x172123]['Imap']['status']=_0x5e71('0x1c');this[_0x5e71('0xa')][_0x172123][_0x5e71('0xe')]['messageStatus']=_0x28711e;return this['emit'](_0x172123);}};EmailChannel[_0x5e71('0x13')][_0x5e71('0x27')]=function(_0xec94a5,_0xbf7b61){return this[_0x5e71('0xb')][_0x5e71('0x28')](_0xec94a5,_0xbf7b61);};EmailChannel[_0x5e71('0x13')][_0x5e71('0x29')]=function(_0x3530c4){var _0x36e413=this;if(this[_0x5e71('0xa')][_0x3530c4['id']]){if(_[_0x5e71('0x11')](this[_0x5e71('0xa')][_0x3530c4['id']][_0x5e71('0x2a')])){this[_0x5e71('0xa')][_0x3530c4['id']]['Smtp']={};}this[_0x5e71('0xa')][_0x3530c4['id']][_0x5e71('0x2a')]['lastSync']=moment();return new BPromise(function(_0x5295fc,_0x1bd3a3){return _0x36e413[_0x5e71('0xb')][_0x5e71('0x2b')](_0x3530c4)[_0x5e71('0x2c')](function(_0x15194a){_0x36e413[_0x5e71('0xa')][_0x3530c4['id']]['Smtp']['status']=_0x5e71('0x2d');_0x36e413[_0x5e71('0xa')][_0x3530c4['id']]['Smtp'][_0x5e71('0x10')]='';_0x36e413[_0x5e71('0x12')](_0x3530c4['id']);_0x5295fc(_0x15194a);})[_0x5e71('0x2e')](function(_0x45c80a){_0x36e413[_0x5e71('0xa')][_0x3530c4['id']][_0x5e71('0x2a')]['status']=_0x5e71('0x1c');_0x36e413['mailAccounts'][_0x3530c4['id']]['Smtp'][_0x5e71('0x10')]=_0x45c80a;_0x36e413[_0x5e71('0x12')](_0x3530c4['id']);_0x1bd3a3(_0x45c80a);});});}return this[_0x5e71('0xb')][_0x5e71('0x2b')](_0x3530c4);};module['exports']=EmailChannel; \ No newline at end of file +var _0x1bff=['info','start\x20email\x20channel','mailAccounts','smtp','prototype','name','key','active','Imap','status','messageStatus','isNil','stringify','emit','mailAccount:update','hasOwnProperty','imapAccounts','box','handleImapBox','handleImapEmail','bind','end','error','disabled','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','handleImapError','send','Smtp','lastSync','verify','then','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','localhost','redis','./smtp'];(function(_0x3412a0,_0x95dd60){var _0xbfd514=function(_0x11739e){while(--_0x11739e){_0x3412a0['push'](_0x3412a0['shift']());}};_0xbfd514(++_0x95dd60);}(_0x1bff,0x1c9));var _0xf1bf=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0x1bff[_0x1fc84d];return _0x2658fa;};'use strict';var _=require(_0xf1bf('0x0'));var moment=require(_0xf1bf('0x1'));var BPromise=require(_0xf1bf('0x2'));var md5=require(_0xf1bf('0x3'));var Redis=require(_0xf1bf('0x4'));var config=require(_0xf1bf('0x5'));var logger=require(_0xf1bf('0x6'))(_0xf1bf('0x7'));config['redis']=_['defaults'](config['redis'],{'host':_0xf1bf('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf1bf('0x9')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xf1bf('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x20876e){logger[_0xf1bf('0xb')](_0xf1bf('0xc'));this[_0xf1bf('0xd')]=_0x20876e['mailAccounts'];this['imapAccounts']={};this[_0xf1bf('0xe')]=new EmailSmtp();}EmailChannel[_0xf1bf('0xf')]['emit']=function(_0x879667){var _0x551671=this[_0xf1bf('0xd')][_0x879667];var _0x2dbc4a={'id':_0x551671['id'],'name':_0x551671[_0xf1bf('0x10')],'key':_0x551671[_0xf1bf('0x11')],'active':_0x551671[_0xf1bf('0x12')],'Imap':{'status':_0x551671[_0xf1bf('0x13')][_0xf1bf('0x14')],'messageStatus':_0x551671[_0xf1bf('0x13')][_0xf1bf('0x15')],'total':_0x551671['Imap']['total']}};if(_[_0xf1bf('0x16')](md5Accounts[_0x879667])){md5Accounts[_0x879667]={};}var _0x4246bc=md5(JSON[_0xf1bf('0x17')](_0x2dbc4a));if(md5Accounts[_0x879667][_0xf1bf('0x3')]!==_0x4246bc){md5Accounts[_0x879667]['md5']=_0x4246bc;io[_0xf1bf('0x18')](_0xf1bf('0x19'),_0x2dbc4a);}};EmailChannel[_0xf1bf('0xf')]['refresh']=function(_0x5ed2a3){for(var _0x4940bd in _0x5ed2a3){if(_0x5ed2a3[_0xf1bf('0x1a')](_0x4940bd)){if(_0x5ed2a3[_0x4940bd][_0xf1bf('0x13')]&&_0x5ed2a3[_0x4940bd][_0xf1bf('0x12')]){var _0x5a0147=_0x5ed2a3[_0x4940bd][_0xf1bf('0x13')];if(!this[_0xf1bf('0x1b')]['hasOwnProperty'](_0x5a0147['id'])){this[_0xf1bf('0x1b')][_0x5a0147['id']]=new EmailImap(_0x5a0147,_0x5ed2a3[_0x4940bd][_0xf1bf('0x7')]);this[_0xf1bf('0x1b')][_0x5a0147['id']]['on'](_0xf1bf('0x1c'),this[_0xf1bf('0x1d')]['bind'](this,_0x4940bd));this[_0xf1bf('0x1b')][_0x5a0147['id']]['on'](_0xf1bf('0x7'),this[_0xf1bf('0x1e')][_0xf1bf('0x1f')](this,_0x4940bd));this[_0xf1bf('0x1b')][_0x5a0147['id']]['on'](_0xf1bf('0x20'),this['handleImapEnd'][_0xf1bf('0x1f')](this,_0x4940bd));this['imapAccounts'][_0x5a0147['id']]['on'](_0xf1bf('0x21'),this['handleImapError']['bind'](this,_0x4940bd));}}else{if(_[_0xf1bf('0x16')](this[_0xf1bf('0xd')][_0x4940bd][_0xf1bf('0x13')])){this['mailAccounts'][_0x4940bd][_0xf1bf('0x13')]={};}this[_0xf1bf('0xd')][_0x4940bd][_0xf1bf('0x13')][_0xf1bf('0x14')]=_0xf1bf('0x22');this[_0xf1bf('0xd')][_0x4940bd][_0xf1bf('0x13')][_0xf1bf('0x15')]='';this['emit'](_0x4940bd);}}}};EmailChannel[_0xf1bf('0xf')][_0xf1bf('0x1d')]=function(_0x110c7f,_0x54ea0c){if(this['mailAccounts'][_0x110c7f]){this[_0xf1bf('0xd')][_0x110c7f][_0xf1bf('0x13')]['status']='connected';this[_0xf1bf('0xd')][_0x110c7f]['Imap'][_0xf1bf('0x15')]=_0x54ea0c[_0xf1bf('0x10')];if(_0x54ea0c['messages']){this[_0xf1bf('0xd')][_0x110c7f][_0xf1bf('0x13')]['total']=_0x54ea0c['messages'][_0xf1bf('0x23')];}return this[_0xf1bf('0x18')](_0x110c7f);}};EmailChannel['prototype'][_0xf1bf('0x1e')]=function(_0x4b0ea4,_0x5971cf){logger[_0xf1bf('0xb')](_0xf1bf('0x24'),_0x5971cf[_0xf1bf('0x25')],_0x5971cf[_0xf1bf('0x26')],_0x5971cf[_0xf1bf('0x27')],_0x4b0ea4);if(this[_0xf1bf('0xd')][_0x4b0ea4]){return mailAccount[_0xf1bf('0x28')](_0x4b0ea4,_0x5971cf)['then'](function(_0x35c01d){if(_0x35c01d){logger[_0xf1bf('0xb')]('Mail\x20accepted\x20from\x20routing');}})[_0xf1bf('0x29')](function(_0x16d802){logger[_0xf1bf('0x21')](_0xf1bf('0x2a'),JSON[_0xf1bf('0x17')](_0x16d802));});}};EmailChannel[_0xf1bf('0xf')][_0xf1bf('0x2b')]=function(_0x5bd445){if(this[_0xf1bf('0xd')][_0x5bd445]&&this[_0xf1bf('0xd')][_0x5bd445][_0xf1bf('0x13')]){if(this['imapAccounts'][this['mailAccounts'][_0x5bd445]['Imap']['id']]){delete this[_0xf1bf('0x1b')][this[_0xf1bf('0xd')][_0x5bd445][_0xf1bf('0x13')]['id']];}this[_0xf1bf('0xd')][_0x5bd445][_0xf1bf('0x13')]['lastSync']=moment();this[_0xf1bf('0x18')](_0x5bd445);}};EmailChannel[_0xf1bf('0xf')][_0xf1bf('0x2c')]=function(_0x299e05,_0x3f3e3a){if(this['mailAccounts'][_0x299e05]){this[_0xf1bf('0xd')][_0x299e05][_0xf1bf('0x13')][_0xf1bf('0x14')]=_0xf1bf('0x21');this[_0xf1bf('0xd')][_0x299e05][_0xf1bf('0x13')][_0xf1bf('0x15')]=_0x3f3e3a;return this[_0xf1bf('0x18')](_0x299e05);}};EmailChannel[_0xf1bf('0xf')]['sendMail']=function(_0x35c937,_0x249443){return this['smtp'][_0xf1bf('0x2d')](_0x35c937,_0x249443);};EmailChannel['prototype']['verifySmtp']=function(_0x242b26){var _0x43735a=this;if(this[_0xf1bf('0xd')][_0x242b26['id']]){if(_[_0xf1bf('0x16')](this[_0xf1bf('0xd')][_0x242b26['id']][_0xf1bf('0x2e')])){this['mailAccounts'][_0x242b26['id']][_0xf1bf('0x2e')]={};}this[_0xf1bf('0xd')][_0x242b26['id']][_0xf1bf('0x2e')][_0xf1bf('0x2f')]=moment();return new BPromise(function(_0x4e5b80,_0x8c27cb){return _0x43735a[_0xf1bf('0xe')][_0xf1bf('0x30')](_0x242b26)[_0xf1bf('0x31')](function(_0x5aa3d6){_0x43735a[_0xf1bf('0xd')][_0x242b26['id']][_0xf1bf('0x2e')][_0xf1bf('0x14')]=_0xf1bf('0x32');_0x43735a[_0xf1bf('0xd')][_0x242b26['id']][_0xf1bf('0x2e')][_0xf1bf('0x15')]='';_0x43735a[_0xf1bf('0x18')](_0x242b26['id']);_0x4e5b80(_0x5aa3d6);})[_0xf1bf('0x29')](function(_0x8b5970){_0x43735a[_0xf1bf('0xd')][_0x242b26['id']][_0xf1bf('0x2e')][_0xf1bf('0x14')]='error';_0x43735a[_0xf1bf('0xd')][_0x242b26['id']][_0xf1bf('0x2e')]['messageStatus']=_0x8b5970;_0x43735a['emit'](_0x242b26['id']);_0x8c27cb(_0x8b5970);});});}return this['smtp']['verify'](_0x242b26);};module[_0xf1bf('0x33')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 2845a4e..1943ae8 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 _0x4cdd=['email','handleFetchEnd','closeBox','handleEnd','textCode','hasOwnProperty','upperFirst','exports','path','util','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','mailbox','account','getAccount','imap','once','handleReady','bind','connTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','anonymous@xcally.com','prototype','handleOpenBox','handleError','emit','box','readUnseen','handleCloseBox','end','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser'];(function(_0x5538b3,_0x402023){var _0x43ddfe=function(_0x4e7870){while(--_0x4e7870){_0x5538b3['push'](_0x5538b3['shift']());}};_0x43ddfe(++_0x402023);}(_0x4cdd,0x1a5));var _0xd4cd=function(_0x590e6b,_0x3f948d){_0x590e6b=_0x590e6b-0x0;var _0x567118=_0x4cdd[_0x590e6b];return _0x567118;};'use strict';var fs=require('fs');var path=require(_0xd4cd('0x0'));var util=require(_0xd4cd('0x1'));var Imap=require('imap');var _=require('lodash');var rs=require(_0xd4cd('0x2'));var simpleParser=require(_0xd4cd('0x3'))[_0xd4cd('0x4')];var Iconv=require(_0xd4cd('0x5'))[_0xd4cd('0x6')];var EventEmitter=require(_0xd4cd('0x7'))[_0xd4cd('0x8')];var utils=require('./utils');var logger=require('../../../config/logger')('email');function EmailImap(_0x3c3065,_0x4f4739){this[_0xd4cd('0x9')]='INBOX';this[_0xd4cd('0xa')]=this[_0xd4cd('0xb')](_0x3c3065,_0x4f4739);this[_0xd4cd('0xc')]=new Imap(this[_0xd4cd('0xa')]);this[_0xd4cd('0xc')][_0xd4cd('0xd')]('ready',this[_0xd4cd('0xe')][_0xd4cd('0xf')](this));this[_0xd4cd('0xc')]['once']('end',this['handleEnd'][_0xd4cd('0xf')](this));this[_0xd4cd('0xc')]['on']('error',this['handleError'][_0xd4cd('0xf')](this));this[_0xd4cd('0xc')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0xd4cd('0xb')]=function(_0x2bf761,_0x54cf5d){var _0x536e33={'connTimeout':_0x2bf761['connTimeout']?_0x2bf761[_0xd4cd('0x10')]*0x3e8:0x2710,'authTimeout':_0x2bf761['authTimeout']?_0x2bf761['authTimeout']*0x3e8:0x1388};if(_[_0xd4cd('0x11')](_0x2bf761[_0xd4cd('0x12')])){if(_0x2bf761[_0xd4cd('0x13')]){_0x536e33[_0xd4cd('0x14')]=_0x2bf761[_0xd4cd('0x14')];_0x536e33['password']=_0x2bf761[_0xd4cd('0x15')];}_0x536e33[_0xd4cd('0x16')]=_0x2bf761['host'];_0x536e33[_0xd4cd('0x17')]=_0x2bf761[_0xd4cd('0x17')]||0x3e1;if(_0x2bf761['tls']){_0x536e33[_0xd4cd('0x18')]=!![];}else{_0x536e33[_0xd4cd('0x18')]=![];_0x536e33[_0xd4cd('0x19')]=_0xd4cd('0x1a');}}else{_0x536e33[_0xd4cd('0x14')]=_0x2bf761['user'];_0x536e33['password']=_0x2bf761[_0xd4cd('0x15')];_0x536e33[_0xd4cd('0x16')]=utils[_0xd4cd('0x1b')](_0x2bf761[_0xd4cd('0x12')]);_0x536e33[_0xd4cd('0x17')]=0x3e1;_0x536e33[_0xd4cd('0x18')]=!![];}_0x536e33['email']=_0x54cf5d||_0x2bf761[_0xd4cd('0x14')]||_0xd4cd('0x1c');return _0x536e33;};EmailImap['prototype'][_0xd4cd('0xe')]=function(){this[_0xd4cd('0xc')]['openBox'](this[_0xd4cd('0x9')],![],this['handleOpenBox']['bind'](this));};EmailImap[_0xd4cd('0x1d')][_0xd4cd('0x1e')]=function(_0x230eea,_0x138e1a){if(_0x230eea){this[_0xd4cd('0x1f')](_0x230eea,!![]);}else{this[_0xd4cd('0x20')](_0xd4cd('0x21'),_0x138e1a);this[_0xd4cd('0x22')]();}};EmailImap[_0xd4cd('0x1d')][_0xd4cd('0x23')]=function(_0x4773e6){if(_0x4773e6){this[_0xd4cd('0x1f')](_0x4773e6,!![]);}else{this[_0xd4cd('0xc')][_0xd4cd('0x24')]();}};EmailImap['prototype'][_0xd4cd('0x22')]=function(){this[_0xd4cd('0xc')]['search']([_0xd4cd('0x25')],this[_0xd4cd('0x26')]['bind'](this));};EmailImap[_0xd4cd('0x1d')][_0xd4cd('0x26')]=function(_0x390293,_0x10f26d){if(_0x390293){this[_0xd4cd('0x1f')](_0x390293,!![]);}else{if(_0x10f26d[_0xd4cd('0x27')]){try{var _0x484ec6=this['imap'][_0xd4cd('0x28')](_0x10f26d,{'bodies':'','markSeen':!![]});_0x484ec6['on'](_0xd4cd('0x29'),this[_0xd4cd('0x2a')][_0xd4cd('0xf')](this));_0x484ec6['once'](_0xd4cd('0x2b'),this[_0xd4cd('0x2c')][_0xd4cd('0xf')](this));_0x484ec6['once'](_0xd4cd('0x24'),this['handleFetchEnd'][_0xd4cd('0xf')](this));}catch(_0x2a4922){logger[_0xd4cd('0x2b')](_0x2a4922);}}else{this[_0xd4cd('0xc')]['closeBox'](!![],this[_0xd4cd('0x23')][_0xd4cd('0xf')](this));}}};EmailImap[_0xd4cd('0x1d')][_0xd4cd('0x2a')]=function(_0x5dc549,_0x3ab62d){_0x5dc549['on'](_0xd4cd('0x2d'),this[_0xd4cd('0x2e')][_0xd4cd('0xf')](this));_0x5dc549[_0xd4cd('0xd')]('attributes',this[_0xd4cd('0x2f')][_0xd4cd('0xf')](this));_0x5dc549[_0xd4cd('0xd')](_0xd4cd('0x24'),this[_0xd4cd('0x30')][_0xd4cd('0xf')](this));};EmailImap[_0xd4cd('0x1d')][_0xd4cd('0x2e')]=function(_0x536ce0,_0x146e39){simpleParser(_0x536ce0,{'Iconv':Iconv},this[_0xd4cd('0x31')][_0xd4cd('0xf')](this));};EmailImap[_0xd4cd('0x1d')][_0xd4cd('0x2f')]=function(_0x35a712){};EmailImap[_0xd4cd('0x1d')][_0xd4cd('0x30')]=function(){};EmailImap['prototype'][_0xd4cd('0x31')]=function(_0xc9fc61,_0x2def24){if(_0xc9fc61){logger[_0xd4cd('0x2b')](_0xc9fc61);}else{var _0x26d36a=this;utils[_0xd4cd('0x32')](this['account'],_0x2def24,function(_0x42cbb8){_0x26d36a[_0xd4cd('0x20')](_0xd4cd('0x33'),_0x42cbb8);});}};EmailImap[_0xd4cd('0x1d')][_0xd4cd('0x34')]=function(){this['imap'][_0xd4cd('0x35')](!![],this[_0xd4cd('0x23')][_0xd4cd('0xf')](this));};EmailImap['prototype'][_0xd4cd('0x2c')]=function(_0x398535){this[_0xd4cd('0x1f')](_0x398535);this[_0xd4cd('0xc')][_0xd4cd('0x35')](!![],this[_0xd4cd('0x23')]['bind'](this));};EmailImap[_0xd4cd('0x1d')][_0xd4cd('0x36')]=function(){this[_0xd4cd('0x20')](_0xd4cd('0x24'));};EmailImap[_0xd4cd('0x1d')]['handleError']=function(_0x1a9d7e,_0x3f87ab){logger[_0xd4cd('0x2b')](_0xd4cd('0x1f'),this['account']['email'],JSON['stringify'](_0x1a9d7e));var _0x8f891d='';if(_0x1a9d7e){if(_0x1a9d7e[_0xd4cd('0x37')]){_0x8f891d=_0x1a9d7e[_0xd4cd('0x37')];}else{for(var _0x1d52c2 in _0x1a9d7e){if(_0x1a9d7e[_0xd4cd('0x38')](_0x1d52c2)){_0x8f891d+=_[_0xd4cd('0x39')](_0x1d52c2)+':\x20'+_0x1a9d7e[_0x1d52c2]+'\x0a';}}}}if(_0x3f87ab){this[_0xd4cd('0xc')][_0xd4cd('0x24')]();}else{this['emit'](_0xd4cd('0x2b'),_0x8f891d);this['emit'](_0xd4cd('0x24'));}};module[_0xd4cd('0x3a')]=EmailImap; \ No newline at end of file +var _0x0590=['handleReadUnseen','length','message','closeBox','handleCloseBox','handleFetchMessage','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','handleFetchError','textCode','hasOwnProperty','imap','lodash','randomstring','simpleParser','Iconv','events','./utils','../../../config/logger','mailbox','INBOX','getAccount','account','once','ready','handleReady','end','handleEnd','bind','error','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','user','password','port','tls','required','host','email','openBox','handleOpenBox','handleError','emit','box','readUnseen','search','UNSEEN'];(function(_0x18cd65,_0xcf2436){var _0x534efe=function(_0xb82700){while(--_0xb82700){_0x18cd65['push'](_0x18cd65['shift']());}};_0x534efe(++_0xcf2436);}(_0x0590,0x166));var _0x0059=function(_0x2f2601,_0x10b8be){_0x2f2601=_0x2f2601-0x0;var _0x3c6e6=_0x0590[_0x2f2601];return _0x3c6e6;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0x0059('0x0'));var _=require(_0x0059('0x1'));var rs=require(_0x0059('0x2'));var simpleParser=require('mailparser')[_0x0059('0x3')];var Iconv=require('iconv')[_0x0059('0x4')];var EventEmitter=require(_0x0059('0x5'))['EventEmitter'];var utils=require(_0x0059('0x6'));var logger=require(_0x0059('0x7'))('email');function EmailImap(_0x21767b,_0x57b16e){this[_0x0059('0x8')]=_0x0059('0x9');this['account']=this[_0x0059('0xa')](_0x21767b,_0x57b16e);this[_0x0059('0x0')]=new Imap(this[_0x0059('0xb')]);this['imap'][_0x0059('0xc')](_0x0059('0xd'),this[_0x0059('0xe')]['bind'](this));this[_0x0059('0x0')][_0x0059('0xc')](_0x0059('0xf'),this[_0x0059('0x10')][_0x0059('0x11')](this));this[_0x0059('0x0')]['on'](_0x0059('0x12'),this['handleError'][_0x0059('0x11')](this));this[_0x0059('0x0')][_0x0059('0x13')]();}util[_0x0059('0x14')](EmailImap,EventEmitter);EmailImap[_0x0059('0x15')][_0x0059('0xa')]=function(_0x4d83b9,_0xb6f6a2){var _0x1c59dd={'connTimeout':_0x4d83b9['connTimeout']?_0x4d83b9[_0x0059('0x16')]*0x3e8:0x2710,'authTimeout':_0x4d83b9[_0x0059('0x17')]?_0x4d83b9[_0x0059('0x17')]*0x3e8:0x1388};if(_[_0x0059('0x18')](_0x4d83b9[_0x0059('0x19')])){if(_0x4d83b9['authentication']){_0x1c59dd[_0x0059('0x1a')]=_0x4d83b9['user'];_0x1c59dd[_0x0059('0x1b')]=_0x4d83b9['password'];}_0x1c59dd['host']=_0x4d83b9['host'];_0x1c59dd[_0x0059('0x1c')]=_0x4d83b9[_0x0059('0x1c')]||0x3e1;if(_0x4d83b9[_0x0059('0x1d')]){_0x1c59dd[_0x0059('0x1d')]=!![];}else{_0x1c59dd[_0x0059('0x1d')]=![];_0x1c59dd['autotls']=_0x0059('0x1e');}}else{_0x1c59dd[_0x0059('0x1a')]=_0x4d83b9[_0x0059('0x1a')];_0x1c59dd[_0x0059('0x1b')]=_0x4d83b9[_0x0059('0x1b')];_0x1c59dd[_0x0059('0x1f')]=utils['getHost'](_0x4d83b9['service']);_0x1c59dd[_0x0059('0x1c')]=0x3e1;_0x1c59dd[_0x0059('0x1d')]=!![];}_0x1c59dd[_0x0059('0x20')]=_0xb6f6a2||_0x4d83b9[_0x0059('0x1a')]||'anonymous@xcally.com';return _0x1c59dd;};EmailImap[_0x0059('0x15')][_0x0059('0xe')]=function(){this[_0x0059('0x0')][_0x0059('0x21')](this[_0x0059('0x8')],![],this[_0x0059('0x22')]['bind'](this));};EmailImap[_0x0059('0x15')][_0x0059('0x22')]=function(_0x30c020,_0x1a5e5b){if(_0x30c020){this[_0x0059('0x23')](_0x30c020,!![]);}else{this[_0x0059('0x24')](_0x0059('0x25'),_0x1a5e5b);this[_0x0059('0x26')]();}};EmailImap[_0x0059('0x15')]['handleCloseBox']=function(_0x2e63d8){if(_0x2e63d8){this[_0x0059('0x23')](_0x2e63d8,!![]);}else{this['imap'][_0x0059('0xf')]();}};EmailImap[_0x0059('0x15')][_0x0059('0x26')]=function(){this['imap'][_0x0059('0x27')]([_0x0059('0x28')],this[_0x0059('0x29')][_0x0059('0x11')](this));};EmailImap[_0x0059('0x15')][_0x0059('0x29')]=function(_0x3a1e3a,_0x195b3d){if(_0x3a1e3a){this[_0x0059('0x23')](_0x3a1e3a,!![]);}else{if(_0x195b3d[_0x0059('0x2a')]){try{var _0x11e0b7=this['imap']['fetch'](_0x195b3d,{'bodies':'','markSeen':!![]});_0x11e0b7['on'](_0x0059('0x2b'),this['handleFetchMessage']['bind'](this));_0x11e0b7['once']('error',this['handleFetchError'][_0x0059('0x11')](this));_0x11e0b7[_0x0059('0xc')](_0x0059('0xf'),this['handleFetchEnd'][_0x0059('0x11')](this));}catch(_0x346048){logger[_0x0059('0x12')](_0x346048);}}else{this[_0x0059('0x0')][_0x0059('0x2c')](!![],this[_0x0059('0x2d')][_0x0059('0x11')](this));}}};EmailImap[_0x0059('0x15')][_0x0059('0x2e')]=function(_0x4cddd8,_0x3b2f6c){_0x4cddd8['on'](_0x0059('0x2f'),this[_0x0059('0x30')][_0x0059('0x11')](this));_0x4cddd8[_0x0059('0xc')]('attributes',this[_0x0059('0x31')][_0x0059('0x11')](this));_0x4cddd8[_0x0059('0xc')](_0x0059('0xf'),this[_0x0059('0x32')][_0x0059('0x11')](this));};EmailImap[_0x0059('0x15')][_0x0059('0x30')]=function(_0x2b55f3,_0x4ed6f3){simpleParser(_0x2b55f3,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap['prototype'][_0x0059('0x31')]=function(_0x416d30){};EmailImap[_0x0059('0x15')][_0x0059('0x32')]=function(){};EmailImap[_0x0059('0x15')][_0x0059('0x33')]=function(_0x20acf6,_0x1cf95b){if(_0x20acf6){logger[_0x0059('0x12')](_0x20acf6);}else{var _0x1e0510=this;utils[_0x0059('0x34')](this['account'],_0x1cf95b,function(_0x27b656){_0x1e0510[_0x0059('0x24')](_0x0059('0x20'),_0x27b656);});}};EmailImap[_0x0059('0x15')][_0x0059('0x35')]=function(){this[_0x0059('0x0')][_0x0059('0x2c')](!![],this['handleCloseBox'][_0x0059('0x11')](this));};EmailImap['prototype'][_0x0059('0x36')]=function(_0x53e632){this[_0x0059('0x23')](_0x53e632);this[_0x0059('0x0')]['closeBox'](!![],this[_0x0059('0x2d')][_0x0059('0x11')](this));};EmailImap['prototype'][_0x0059('0x10')]=function(){this['emit']('end');};EmailImap[_0x0059('0x15')]['handleError']=function(_0x34227a,_0x1ce46f){logger[_0x0059('0x12')]('handleError',this[_0x0059('0xb')][_0x0059('0x20')],JSON['stringify'](_0x34227a));var _0x2bd82a='';if(_0x34227a){if(_0x34227a[_0x0059('0x37')]){_0x2bd82a=_0x34227a[_0x0059('0x37')];}else{for(var _0x13c09c in _0x34227a){if(_0x34227a[_0x0059('0x38')](_0x13c09c)){_0x2bd82a+=_['upperFirst'](_0x13c09c)+':\x20'+_0x34227a[_0x13c09c]+'\x0a';}}}}if(_0x1ce46f){this[_0x0059('0x0')][_0x0059('0xf')]();}else{this[_0x0059('0x24')](_0x0059('0x12'),_0x2bd82a);this[_0x0059('0x24')](_0x0059('0xf'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 96cd55e..844cc2c 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 _0x583b=['Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','createTransport','use','sendMail','prototype','verify'];(function(_0x235c53,_0xda1f7f){var _0x1fea40=function(_0x23cdd3){while(--_0x23cdd3){_0x235c53['push'](_0x235c53['shift']());}};_0x1fea40(++_0xda1f7f);}(_0x583b,0xc8));var _0xb583=function(_0x2d2913,_0x5d0d36){_0x2d2913=_0x2d2913-0x0;var _0x340718=_0x583b[_0x2d2913];return _0x340718;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xb583('0x0'));var inlineBase64=require(_0xb583('0x1'));function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x27108f,_0x336462){return new BPromise(function(_0x5201df,_0x4230ab){var _0x38445d=nodemailer[_0xb583('0x2')](_0x27108f);_0x38445d[_0xb583('0x3')]('compile',inlineBase64());_0x38445d[_0xb583('0x4')](_0x336462,function(_0x4ffe08,_0x20fbf3){if(_0x4ffe08){_0x4230ab(_0x4ffe08['toString']());}else{_0x5201df(_0x20fbf3);}});});};EmailSmtp[_0xb583('0x5')][_0xb583('0x6')]=function(_0x3f9ba0){return new BPromise(function(_0x4a33ce,_0x3d7f60){var _0x5388c3=nodemailer['createTransport'](_0x3f9ba0);_0x5388c3['verify'](function(_0x5df246,_0x39d708){if(_0x5df246){_0x3d7f60(_0x5df246['toString']());}else{if(_0x39d708){_0x4a33ce(_0x39d708);}else{_0x3d7f60(_0xb583('0x7'));}}});});};module[_0xb583('0x8')]=EmailSmtp; \ No newline at end of file +var _0x9477=['toString','verify','Not\x20verifired','exports','bluebird','prototype','send','createTransport','use','compile','sendMail'];(function(_0x2d56f6,_0x5afd43){var _0x1d3f99=function(_0x32d06e){while(--_0x32d06e){_0x2d56f6['push'](_0x2d56f6['shift']());}};_0x1d3f99(++_0x5afd43);}(_0x9477,0xa9));var _0x7947=function(_0x52b3f4,_0x59b076){_0x52b3f4=_0x52b3f4-0x0;var _0x2988ba=_0x9477[_0x52b3f4];return _0x2988ba;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x7947('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x7947('0x1')][_0x7947('0x2')]=function(_0x122335,_0xd55624){return new BPromise(function(_0x464a79,_0x509542){var _0x902747=nodemailer[_0x7947('0x3')](_0x122335);_0x902747[_0x7947('0x4')](_0x7947('0x5'),inlineBase64());_0x902747[_0x7947('0x6')](_0xd55624,function(_0x54b80e,_0x4f7b0f){if(_0x54b80e){_0x509542(_0x54b80e[_0x7947('0x7')]());}else{_0x464a79(_0x4f7b0f);}});});};EmailSmtp[_0x7947('0x1')][_0x7947('0x8')]=function(_0x1ace23){return new BPromise(function(_0x411667,_0x23bb97){var _0x32a035=nodemailer['createTransport'](_0x1ace23);_0x32a035['verify'](function(_0x572615,_0x5b95f8){if(_0x572615){_0x23bb97(_0x572615[_0x7947('0x7')]());}else{if(_0x5b95f8){_0x411667(_0x5b95f8);}else{_0x23bb97(_0x7947('0x9'));}}});});};module[_0x7947('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 7d617f1..e7fc8b1 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 _0xa30a=['length','pop','@xcally.com','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','isEmpty','originCc','bcc','attach','attachment','attachment-','format','%s-%s','root','server/files/attachments/','writeFileSync','content','contentType','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','Attachments','Title','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','util','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','head','name','substring','indexOf','split','slice','join'];(function(_0x15e43b,_0x2a3132){var _0x537fcf=function(_0x8d67d2){while(--_0x8d67d2){_0x15e43b['push'](_0x15e43b['shift']());}};_0x537fcf(++_0x2a3132);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa30('0x0'));var moment=require(_0xaa30('0x1'));var random=require(_0xaa30('0x2'));var fs=require('fs');var path=require('path');var util=require(_0xaa30('0x3'));var tnef=require(_0xaa30('0x4'));var logger=require(_0xaa30('0x5'))(_0xaa30('0x6'));var config=require(_0xaa30('0x7'));function getAddress(_0x271425){var _0x102ad7=_['head'](_0x271425[_0xaa30('0x8')]);return _0x102ad7&&_0x102ad7['address']?_0x102ad7[_0xaa30('0x9')]:_0xaa30('0xa')+random[_0xaa30('0xb')](0x6)+'@xcally.com';}function getFirstName(_0xedbc45){var _0x40dbda=_[_0xaa30('0xc')](_0xedbc45[_0xaa30('0x8')]);if(_0x40dbda&&_0x40dbda[_0xaa30('0xd')]){if(_0x40dbda[_0xaa30('0xd')]==_0x40dbda['address']){return _0x40dbda['name'][_0xaa30('0xe')](0x0,_0x40dbda['name'][_0xaa30('0xf')]('@'));}var _0x1a5681=_0x40dbda[_0xaa30('0xd')][_0xaa30('0x10')](/\s+/);return _0x1a5681['length']>0x1?_0x1a5681[_0xaa30('0x11')](0x0,-0x1)[_0xaa30('0x12')]('\x20'):_0x40dbda[_0xaa30('0xd')];}return'Anonymous';}function getLastName(_0x33bab7){var _0xdea23a=_[_0xaa30('0xc')](_0x33bab7[_0xaa30('0x8')]);if(_0xdea23a&&_0xdea23a[_0xaa30('0xd')]){var _0x31aa0b=_0xdea23a[_0xaa30('0xd')][_0xaa30('0x10')](/\s+/);return _0x31aa0b[_0xaa30('0x13')]>0x1?_0x31aa0b[_0xaa30('0x14')]():'';}return'';}function getMails(_0x519518,_0x91839d){var _0x591478='';for(var _0x5eb356=0x0;_0x5eb356<_0x91839d[_0xaa30('0x8')][_0xaa30('0x13')];_0x5eb356+=0x1){if(_0x91839d[_0xaa30('0x8')][_0x5eb356]['address']!==_0x519518){if(!_['isEmpty'](_0x591478)){_0x591478+=',';}_0x591478+=_0x91839d['value'][_0x5eb356][_0xaa30('0xd')]||_0x91839d['value'][_0x5eb356][_0xaa30('0x9')]||'';_0x591478+='\x20<';_0x591478+=_0x91839d[_0xaa30('0x8')][_0x5eb356]['address']?_0x91839d['value'][_0x5eb356]['address']:_0xaa30('0xa')+random[_0xaa30('0xb')](0x6)+_0xaa30('0x15');_0x591478+='>';}}return _0x591478;}function parseEmail(_0x35ec07,_0x43a526,_0x4aacfd){if(_0x43a526[_0xaa30('0x16')]){var _0x24bb25=/)<[^<]*)*<\/script>/gi;while(_0x24bb25[_0xaa30('0x17')](_0x43a526[_0xaa30('0x16')])){_0x43a526[_0xaa30('0x16')]=_0x43a526['html'][_0xaa30('0x18')](_0x24bb25,'');}if(_0x43a526[_0xaa30('0x16')][_0xaa30('0x19')](_0xaa30('0x1a'))){var _0x57d1ca=[];_0x43a526[_0xaa30('0x1b')][_0xaa30('0x1c')](_0x19ba52=>{_0x57d1ca[_0xaa30('0x1d')](_0x19ba52[_0xaa30('0x1e')]);});var _0x2a59ce=/]+>/g;var _0x55cccb=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x467850=_0x43a526[_0xaa30('0x16')]['replace'](_0x55cccb,_0xaa30('0x1f'));var _0x5b3efb=_0x467850[_0xaa30('0x18')](_0x2a59ce,_0xaa30('0x20'));for(let _0x2aabf8=0x0;_0x2aabf8<_0x57d1ca[_0xaa30('0x13')];_0x2aabf8++){var _0x37b4a6=_0x5b3efb[_0xaa30('0x18')](_0xaa30('0x20'),_0xaa30('0x21')+_0x57d1ca[_0x2aabf8]+_0xaa30('0x22'));_0x5b3efb=_0x37b4a6;}_0x43a526[_0xaa30('0x16')]=_0x5b3efb;}_0x4aacfd[_0xaa30('0x23')]=_0x43a526[_0xaa30('0x16')];}else{_0x4aacfd[_0xaa30('0x23')]=_0x43a526[_0xaa30('0x24')];}if(_0x4aacfd[_0xaa30('0x23')]){_0x4aacfd[_0xaa30('0x23')]=_0x4aacfd[_0xaa30('0x23')][_0xaa30('0x18')](/0x0){var _0x1f6f53=['Auto-Submitted:\x20auto-replied',_0xaa30('0x35'),_0xaa30('0x36')];for(var _0x22dfa5=0x0;_0x22dfa5<_0x43a526[_0xaa30('0x34')][_0xaa30('0x13')];_0x22dfa5++){var _0x4478cc=_[_0xaa30('0xf')](_0x1f6f53,_0x43a526[_0xaa30('0x34')][_0x22dfa5]['line']);if(_0x4478cc>=0x0){_0x4aacfd['isAutoreply']=!![];}}}return _0x4aacfd;}exports[_0xaa30('0x37')]=function(_0x4a170a,_0x5208f8,_0x505295){var _0x234360={'from':getAddress(_0x5208f8['from']),'firstName':getFirstName(_0x5208f8[_0xaa30('0x38')]),'lastName':getLastName(_0x5208f8['from']),'mapKey':_0xaa30('0x6'),'message':{'from':getMails(_0x4a170a[_0xaa30('0x6')],_0x5208f8[_0xaa30('0x38')]),'to':_0x4a170a[_0xaa30('0x6')],'cc':'','subject':_0x5208f8[_0xaa30('0x39')]||'','messageId':_0x5208f8[_0xaa30('0x3a')],'inReplyTo':_0x5208f8[_0xaa30('0x3b')],'sentAt':moment(_0x5208f8[_0xaa30('0x3c')])[_0xaa30('0x2d')](_0xaa30('0x3d')),'attach':![],'attachments':[]}};if(!_0x5208f8[_0xaa30('0x16')]&&!_0x5208f8['textAsHtml']){var _0x2c6d82=_[_0xaa30('0x3e')](_0x5208f8[_0xaa30('0x1b')],{'contentType':_0xaa30('0x3f')});if(_0x2c6d82[_0xaa30('0x13')]){logger['info'](util['format'](_0xaa30('0x40'),_0x5208f8['messageId']));tnef[_0xaa30('0x41')](_[_0xaa30('0x42')](_0x2c6d82)[_0xaa30('0x32')],function(_0xb29ccc,_0x1f6dd7){if(_0x1f6dd7){_0x5208f8[_0xaa30('0x16')]=_0x1f6dd7[_0xaa30('0x43')]||'

Empty\x20message

';if(_0x1f6dd7[_0xaa30('0x44')]){for(var _0x6c9da6=0x0;_0x6c9da6<_0x1f6dd7[_0xaa30('0x44')]['length'];_0x6c9da6++){var _0x735d1f=_0x1f6dd7[_0xaa30('0x44')][_0x6c9da6];_0x234360['message'][_0xaa30('0x1b')]['push']({'filename':_0x735d1f[_0xaa30('0x45')],'content':Buffer['from'](_0x735d1f['Data'])});}}}_0x505295(parseEmail(_0x4a170a,_0x5208f8,_0x234360));});}else{_0x5208f8[_0xaa30('0x16')]='

Empty\x20message

';_0x505295(parseEmail(_0x4a170a,_0x5208f8,_0x234360));}}else{_0x505295(parseEmail(_0x4a170a,_0x5208f8,_0x234360));}};exports['getHost']=function(_0xf6a737){switch(_0xf6a737){case _0xaa30('0x46'):return _0xaa30('0x47');case _0xaa30('0x48'):return _0xaa30('0x49');case _0xaa30('0x4a'):return'imap-mail.outlook.com';case _0xaa30('0x4b'):return _0xaa30('0x4c');}return _0xaa30('0x4d');}; \ No newline at end of file +var _0xe056=['randomstring','path','util','../../../config/logger','../../../config/environment','address','anonymous','@xcally.com','head','value','name','substring','indexOf','split','length','join','Anonymous','pop','isEmpty','generate','html','test','replace','Empty\x20message

','Attachments','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','127.0.0.1'];(function(_0xa857be,_0x2210f7){var _0x27c44e=function(_0x55f91){while(--_0x55f91){_0xa857be['push'](_0xa857be['shift']());}};_0x27c44e(++_0x2210f7);}(_0xe056,0xdb));var _0x6e05=function(_0x2afbb0,_0x44f16d){_0x2afbb0=_0x2afbb0-0x0;var _0x411ff2=_0xe056[_0x2afbb0];return _0x411ff2;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0x6e05('0x0'));var fs=require('fs');var path=require(_0x6e05('0x1'));var util=require(_0x6e05('0x2'));var tnef=require('node-tnef');var logger=require(_0x6e05('0x3'))('email');var config=require(_0x6e05('0x4'));function getAddress(_0x1bec29){var _0x5205e6=_['head'](_0x1bec29['value']);return _0x5205e6&&_0x5205e6[_0x6e05('0x5')]?_0x5205e6[_0x6e05('0x5')]:_0x6e05('0x6')+random['generate'](0x6)+_0x6e05('0x7');}function getFirstName(_0x177b2c){var _0x1a0ed3=_[_0x6e05('0x8')](_0x177b2c[_0x6e05('0x9')]);if(_0x1a0ed3&&_0x1a0ed3['name']){if(_0x1a0ed3[_0x6e05('0xa')]==_0x1a0ed3[_0x6e05('0x5')]){return _0x1a0ed3[_0x6e05('0xa')][_0x6e05('0xb')](0x0,_0x1a0ed3[_0x6e05('0xa')][_0x6e05('0xc')]('@'));}var _0x4ff533=_0x1a0ed3[_0x6e05('0xa')][_0x6e05('0xd')](/\s+/);return _0x4ff533[_0x6e05('0xe')]>0x1?_0x4ff533['slice'](0x0,-0x1)[_0x6e05('0xf')]('\x20'):_0x1a0ed3[_0x6e05('0xa')];}return _0x6e05('0x10');}function getLastName(_0x1b4dff){var _0x38d325=_['head'](_0x1b4dff[_0x6e05('0x9')]);if(_0x38d325&&_0x38d325[_0x6e05('0xa')]){var _0x560a84=_0x38d325['name'][_0x6e05('0xd')](/\s+/);return _0x560a84[_0x6e05('0xe')]>0x1?_0x560a84[_0x6e05('0x11')]():'';}return'';}function getMails(_0x5c778b,_0x128186){var _0x5e9a38='';for(var _0x3c3ef0=0x0;_0x3c3ef0<_0x128186[_0x6e05('0x9')]['length'];_0x3c3ef0+=0x1){if(_0x128186['value'][_0x3c3ef0][_0x6e05('0x5')]!==_0x5c778b){if(!_[_0x6e05('0x12')](_0x5e9a38)){_0x5e9a38+=',';}_0x5e9a38+=_0x128186[_0x6e05('0x9')][_0x3c3ef0][_0x6e05('0xa')]||_0x128186[_0x6e05('0x9')][_0x3c3ef0]['address']||'';_0x5e9a38+='\x20<';_0x5e9a38+=_0x128186[_0x6e05('0x9')][_0x3c3ef0]['address']?_0x128186['value'][_0x3c3ef0][_0x6e05('0x5')]:_0x6e05('0x6')+random[_0x6e05('0x13')](0x6)+_0x6e05('0x7');_0x5e9a38+='>';}}return _0x5e9a38;}function parseEmail(_0x2e500a,_0x31c52e,_0x247cf6){if(_0x31c52e[_0x6e05('0x14')]){var _0x488055=/)<[^<]*)*<\/script>/gi;while(_0x488055[_0x6e05('0x15')](_0x31c52e['html'])){_0x31c52e[_0x6e05('0x14')]=_0x31c52e[_0x6e05('0x14')][_0x6e05('0x16')](_0x488055,'');}if(_0x31c52e['html']['includes'](_0x6e05('0x17'))){var _0x5d80cd=[];_0x31c52e[_0x6e05('0x18')][_0x6e05('0x19')](_0x34e089=>{_0x5d80cd[_0x6e05('0x1a')](_0x34e089[_0x6e05('0x1b')]);});var _0x19f3a6=/]+>/g;var _0x46ce2e=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5d7701=_0x31c52e[_0x6e05('0x14')][_0x6e05('0x16')](_0x46ce2e,'_SRC');var _0x169684=_0x5d7701[_0x6e05('0x16')](_0x19f3a6,'_IMG');for(let _0x499959=0x0;_0x499959<_0x5d80cd[_0x6e05('0xe')];_0x499959++){var _0x53c447=_0x169684[_0x6e05('0x16')](_0x6e05('0x1c'),'\x20[Attachment:\x20'+_0x5d80cd[_0x499959]+'\x20]');_0x169684=_0x53c447;}_0x31c52e[_0x6e05('0x14')]=_0x169684;}_0x247cf6[_0x6e05('0x1d')]=_0x31c52e[_0x6e05('0x14')];}else{_0x247cf6[_0x6e05('0x1d')]=_0x31c52e['textAsHtml'];}if(_0x247cf6[_0x6e05('0x1d')]){_0x247cf6[_0x6e05('0x1d')]=_0x247cf6[_0x6e05('0x1d')]['replace'](/0x0){var _0x5c9cdd=[_0x6e05('0x2e'),_0x6e05('0x2f'),_0x6e05('0x30')];for(var _0x2a4b2f=0x0;_0x2a4b2f<_0x31c52e[_0x6e05('0x2d')]['length'];_0x2a4b2f++){var _0x34fddc=_['indexOf'](_0x5c9cdd,_0x31c52e['headerLines'][_0x2a4b2f]['line']);if(_0x34fddc>=0x0){_0x247cf6['isAutoreply']=!![];}}}return _0x247cf6;}exports[_0x6e05('0x31')]=function(_0x562dd8,_0x506515,_0x2d3a18){var _0x32a8fb={'from':getAddress(_0x506515[_0x6e05('0x32')]),'firstName':getFirstName(_0x506515[_0x6e05('0x32')]),'lastName':getLastName(_0x506515['from']),'mapKey':_0x6e05('0x1f'),'message':{'from':getMails(_0x562dd8['email'],_0x506515[_0x6e05('0x32')]),'to':_0x562dd8['email'],'cc':'','subject':_0x506515[_0x6e05('0x33')]||'','messageId':_0x506515['messageId'],'inReplyTo':_0x506515[_0x6e05('0x34')],'sentAt':moment(_0x506515['date'])[_0x6e05('0x35')](_0x6e05('0x36')),'attach':![],'attachments':[]}};if(!_0x506515[_0x6e05('0x14')]&&!_0x506515['textAsHtml']){var _0x5154c4=_[_0x6e05('0x37')](_0x506515[_0x6e05('0x18')],{'contentType':'application/ms-tnef'});if(_0x5154c4[_0x6e05('0xe')]){logger[_0x6e05('0x38')](util[_0x6e05('0x35')](_0x6e05('0x39'),_0x506515[_0x6e05('0x3a')]));tnef[_0x6e05('0x3b')](_[_0x6e05('0x3c')](_0x5154c4)[_0x6e05('0x3d')],function(_0x3584a7,_0x3e6c8d){if(_0x3e6c8d){_0x506515[_0x6e05('0x14')]=_0x3e6c8d[_0x6e05('0x3e')]||_0x6e05('0x3f');if(_0x3e6c8d[_0x6e05('0x40')]){for(var _0x30f81c=0x0;_0x30f81c<_0x3e6c8d[_0x6e05('0x40')]['length'];_0x30f81c++){var _0x292f9b=_0x3e6c8d[_0x6e05('0x40')][_0x30f81c];_0x32a8fb[_0x6e05('0x20')][_0x6e05('0x18')]['push']({'filename':_0x292f9b['Title'],'content':Buffer[_0x6e05('0x32')](_0x292f9b['Data'])});}}}_0x2d3a18(parseEmail(_0x562dd8,_0x506515,_0x32a8fb));});}else{_0x506515[_0x6e05('0x14')]=_0x6e05('0x3f');_0x2d3a18(parseEmail(_0x562dd8,_0x506515,_0x32a8fb));}}else{_0x2d3a18(parseEmail(_0x562dd8,_0x506515,_0x32a8fb));}};exports[_0x6e05('0x41')]=function(_0x3d3050){switch(_0x3d3050){case'gmail':return _0x6e05('0x42');case _0x6e05('0x43'):return _0x6e05('0x44');case _0x6e05('0x45'):return _0x6e05('0x46');case'outlook365':return _0x6e05('0x47');}return _0x6e05('0x48');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 4400ed5..1f4c32c 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 _0x6869=['name','Service','key','active','Imap','Smtp','exports','lodash'];(function(_0x96ad7d,_0x1017ba){var _0x32d63a=function(_0xb47ad9){while(--_0xb47ad9){_0x96ad7d['push'](_0x96ad7d['shift']());}};_0x32d63a(++_0x1017ba);}(_0x6869,0xaf));var _0x9686=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6869[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x9686('0x0'));function MailAccount(_0x33eb97){this['id']=_0x33eb97['id']||0x0;this[_0x9686('0x1')]=_0x33eb97['name']||_0x9686('0x2');this[_0x9686('0x3')]=_0x33eb97['key']||'SERV';this[_0x9686('0x4')]=_0x33eb97[_0x9686('0x4')]||![];this['Imap']=_0x33eb97[_0x9686('0x5')]||[];this['Smtp']=_0x33eb97[_0x9686('0x6')]||[];}module[_0x9686('0x7')]=MailAccount; \ No newline at end of file +var _0x06be=['lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0x06be,0x190));var _0xe06b=function(_0x48d067,_0x483a84){_0x48d067=_0x48d067-0x0;var _0x30d411=_0x06be[_0x48d067];return _0x30d411;};'use strict';var _=require(_0xe06b('0x0'));function MailAccount(_0x4c81de){this['id']=_0x4c81de['id']||0x0;this['name']=_0x4c81de[_0xe06b('0x1')]||_0xe06b('0x2');this[_0xe06b('0x3')]=_0x4c81de[_0xe06b('0x3')]||_0xe06b('0x4');this[_0xe06b('0x5')]=_0x4c81de[_0xe06b('0x5')]||![];this[_0xe06b('0x6')]=_0x4c81de[_0xe06b('0x6')]||[];this['Smtp']=_0x4c81de[_0xe06b('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index d6dbb2f..5e79e03 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 _0x71a1=['../model/mailAccount','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','isUndefined','mailAccounts','merge','lodash'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x71a1,0xf1));var _0x171a=function(_0x3a829d,_0x109af3){_0x3a829d=_0x3a829d-0x0;var _0x39a640=_0x71a1[_0x3a829d];return _0x39a640;};'use strict';var _=require(_0x171a('0x0'));var MailAccount=require(_0x171a('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x5b88db,_0xdce5c3,_0x2d1d50){var _0x393525=_[_0x171a('0x2')](_0x5b88db,function(_0x204341,_0xa81a92){return _0x204341[_0x2d1d50];});for(var _0x27360e in _0xdce5c3){if(_0xdce5c3['hasOwnProperty'](_0x27360e)){if(!_0x393525[_0x27360e]){delete _0xdce5c3[_0x27360e];}}}}Realtime[_0x171a('0x3')][_0x171a('0x4')]=function(_0x283dea,_0x211a4a){for(var _0x2ea758 in _0x211a4a){if(_0x283dea[_0x171a('0x5')](_0x2ea758)){_0x283dea[_0x2ea758]=_0x211a4a[_0x2ea758];}}};Realtime['prototype'][_0x171a('0x6')]=function(){var _0x3527de=this;return function(_0x584aa2){if(_0x584aa2){freeIsNotKey(_0x584aa2,_0x3527de['mailAccounts'],'id');for(var _0x2c674a=0x0,_0x3120db={},_0xe1943f={};_0x2c674a<_0x584aa2[_0x171a('0x7')];_0x2c674a+=0x1){_0x3120db=_0x584aa2[_0x2c674a];if(_[_0x171a('0x8')](_0x3527de[_0x171a('0x9')][_0x3120db['id']])){_0x3527de[_0x171a('0x9')][_0x3120db['id']]=new MailAccount(_0x3120db);}else{_[_0x171a('0xa')](_0x3527de['mailAccounts'][_0x3120db['id']],_0x3120db);}}}return _0x3527de[_0x171a('0x9')];};};module['exports']=Realtime; \ No newline at end of file +var _0x2375=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','exports','lodash','../model/mailAccount'];(function(_0x43da9f,_0x2c4a96){var _0x10beb8=function(_0x3a6d62){while(--_0x3a6d62){_0x43da9f['push'](_0x43da9f['shift']());}};_0x10beb8(++_0x2c4a96);}(_0x2375,0x77));var _0x5237=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x2375[_0x5834bc];return _0x3e183a;};'use strict';var _=require(_0x5237('0x0'));var MailAccount=require(_0x5237('0x1'));var Realtime=function(){this[_0x5237('0x2')]={};};function freeIsNotKey(_0x5c3753,_0x33b7c5,_0x3f0cff){var _0x367abc=_[_0x5237('0x3')](_0x5c3753,function(_0x5f3b31,_0x26b02a){return _0x5f3b31[_0x3f0cff];});for(var _0x3c48c6 in _0x33b7c5){if(_0x33b7c5[_0x5237('0x4')](_0x3c48c6)){if(!_0x367abc[_0x3c48c6]){delete _0x33b7c5[_0x3c48c6];}}}}Realtime[_0x5237('0x5')][_0x5237('0x6')]=function(_0x4137bf,_0x40a26b){for(var _0x2422fe in _0x40a26b){if(_0x4137bf[_0x5237('0x4')](_0x2422fe)){_0x4137bf[_0x2422fe]=_0x40a26b[_0x2422fe];}}};Realtime[_0x5237('0x5')][_0x5237('0x7')]=function(){var _0x139854=this;return function(_0x21a2ab){if(_0x21a2ab){freeIsNotKey(_0x21a2ab,_0x139854[_0x5237('0x2')],'id');for(var _0x334080=0x0,_0x481ed3={},_0x5e9436={};_0x334080<_0x21a2ab[_0x5237('0x8')];_0x334080+=0x1){_0x481ed3=_0x21a2ab[_0x334080];if(_[_0x5237('0x9')](_0x139854[_0x5237('0x2')][_0x481ed3['id']])){_0x139854[_0x5237('0x2')][_0x481ed3['id']]=new MailAccount(_0x481ed3);}else{_['merge'](_0x139854[_0x5237('0x2')][_0x481ed3['id']],_0x481ed3);}}}return _0x139854['mailAccounts'];};};module[_0x5237('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 50ff1b0..d5755ff 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 _0xfba8=['Imap','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','email','active','key','TemplateId'];(function(_0x40374d,_0x300fd1){var _0x2a9648=function(_0x4b8c19){while(--_0x4b8c19){_0x40374d['push'](_0x40374d['shift']());}};_0x2a9648(++_0x300fd1);}(_0xfba8,0x1d6));var _0x8fba=function(_0x55754e,_0x286388){_0x55754e=_0x55754e-0x0;var _0x2e9948=_0xfba8[_0x55754e];return _0x2e9948;};'use strict';var client=require(_0x8fba('0x0'));exports[_0x8fba('0x1')]=function(){return function(){return client[_0x8fba('0x2')](_0x8fba('0x3'),{'options':{'attributes':['id',_0x8fba('0x4'),_0x8fba('0x5'),_0x8fba('0x6'),_0x8fba('0x7'),_0x8fba('0x8'),'ListId',_0x8fba('0x9')],'raw':![],'include':[{'model':'MailServerIn','as':_0x8fba('0xa')},{'model':_0x8fba('0xb'),'as':_0x8fba('0xc')}]},'log':_0x8fba('0xd')});};};exports[_0x8fba('0xe')]=function(_0x16312d,_0x1794bc){return client['Request'](_0x8fba('0xf'),{'account':{'id':_0x16312d},'body':_0x1794bc,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xcf2e=['TemplateId','MailServerIn','Imap','MailServerOut','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','service','email','active','key'];(function(_0x2c05aa,_0x5c8eeb){var _0x11eb48=function(_0x5730cd){while(--_0x5730cd){_0x2c05aa['push'](_0x2c05aa['shift']());}};_0x11eb48(++_0x5c8eeb);}(_0xcf2e,0x197));var _0xecf2=function(_0x136cbb,_0x2a97f9){_0x136cbb=_0x136cbb-0x0;var _0x333a69=_0xcf2e[_0x136cbb];return _0x333a69;};'use strict';var client=require(_0xecf2('0x0'));exports[_0xecf2('0x1')]=function(){return function(){return client[_0xecf2('0x2')](_0xecf2('0x3'),{'options':{'attributes':['id',_0xecf2('0x4'),_0xecf2('0x5'),_0xecf2('0x6'),_0xecf2('0x7'),_0xecf2('0x8'),'ListId',_0xecf2('0x9')],'raw':![],'include':[{'model':_0xecf2('0xa'),'as':_0xecf2('0xb')},{'model':_0xecf2('0xc'),'as':'Smtp'}]},'log':_0xecf2('0xd')});};};exports[_0xecf2('0xe')]=function(_0x1665bc,_0x22739d){return client[_0xecf2('0x2')](_0xecf2('0xf'),{'account':{'id':_0x1665bc},'body':_0x22739d,'log':_0xecf2('0xf')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 54b0454..31a0f30 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 _0xabb8=['Request','ShowSetting','loginMailFrequency','../client','getSettings'];(function(_0x2af74b,_0xc40952){var _0x58da22=function(_0x1fc41e){while(--_0x1fc41e){_0x2af74b['push'](_0x2af74b['shift']());}};_0x58da22(++_0xc40952);}(_0xabb8,0x148));var _0x8abb=function(_0x1ebed0,_0x150827){_0x1ebed0=_0x1ebed0-0x0;var _0x358f56=_0xabb8[_0x1ebed0];return _0x358f56;};'use strict';var client=require(_0x8abb('0x0'));exports[_0x8abb('0x1')]=function(){return client[_0x8abb('0x2')](_0x8abb('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x8abb('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x4cca=['ShowSetting','loginMailFrequency','getSettings'];(function(_0x429948,_0x1a6851){var _0x35d5d1=function(_0x574853){while(--_0x574853){_0x429948['push'](_0x429948['shift']());}};_0x35d5d1(++_0x1a6851);}(_0x4cca,0x1be));var _0xa4cc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4cca[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0xa4cc('0x0')]=function(){return client['Request'](_0xa4cc('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa4cc('0x2')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 7806e41..cc06648 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(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 8025df8..ba1189a 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 _0x945f=['polling','defaults','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/express','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','ioredis','../../config/environment','createServer','timeout','listen','socket.io'];(function(_0x51a134,_0x31a8a3){var _0x43ab27=function(_0x286e2b){while(--_0x286e2b){_0x51a134['push'](_0x51a134['shift']());}};_0x43ab27(++_0x31a8a3);}(_0x945f,0xf4));var _0xf945=function(_0x225b8e,_0x51781d){_0x225b8e=_0x225b8e-0x0;var _0x5f3df5=_0x945f[_0x225b8e];return _0x5f3df5;};'use strict';var _=require(_0xf945('0x0'));var http=require(_0xf945('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require(_0xf945('0x2'));var config=require(_0xf945('0x3'));var app=express();var server=http[_0xf945('0x4')](app);server[_0xf945('0x5')]=0xdbba0;if(sticky[_0xf945('0x6')](server,config['port'])){var socketio=require(_0xf945('0x7'))(server,{'transports':['websocket',_0xf945('0x8')]});config['redis']=_[_0xf945('0x9')](config[_0xf945('0xa')],{'host':_0xf945('0xb'),'port':0x18eb});socketio[_0xf945('0xc')](require(_0xf945('0xd'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0xf945('0xe'))[_0xf945('0xf')]();require('../../config/socketio')[_0xf945('0xf')](socketio);require(_0xf945('0x10'))['default'](app);require('../../routes')[_0xf945('0xf')](app);}else{server['once'](_0xf945('0x11'),function(){console['log'](_0xf945('0x12'),config[_0xf945('0x13')]);});}exports=module[_0xf945('0x14')]=app; \ No newline at end of file +var _0xacf7=['port','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','socket.io','websocket','polling','redis','defaults','adapter','socket.io-redis','default','../../config/socketio','../../config/express','../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!'];(function(_0x2768ab,_0x59be88){var _0x2b715f=function(_0x5a42e4){while(--_0x5a42e4){_0x2768ab['push'](_0x2768ab['shift']());}};_0x2b715f(++_0x59be88);}(_0xacf7,0x1dd));var _0x7acf=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xacf7[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x7acf('0x0'));var http=require(_0x7acf('0x1'));var express=require(_0x7acf('0x2'));var sticky=require(_0x7acf('0x3'));var Redis=require(_0x7acf('0x4'));var config=require(_0x7acf('0x5'));var app=express();var server=http[_0x7acf('0x6')](app);server[_0x7acf('0x7')]=0xdbba0;if(sticky[_0x7acf('0x8')](server,config['port'])){var socketio=require(_0x7acf('0x9'))(server,{'transports':[_0x7acf('0xa'),_0x7acf('0xb')]});config[_0x7acf('0xc')]=_[_0x7acf('0xd')](config[_0x7acf('0xc')],{'host':'localhost','port':0x18eb});socketio[_0x7acf('0xe')](require(_0x7acf('0xf'))({'pubClient':new Redis(config[_0x7acf('0xc')]),'subClient':new Redis(config[_0x7acf('0xc')])}));require('../../config/triggers')[_0x7acf('0x10')]();require(_0x7acf('0x11'))['default'](socketio);require(_0x7acf('0x12'))[_0x7acf('0x10')](app);require(_0x7acf('0x13'))[_0x7acf('0x10')](app);}else{server['once'](_0x7acf('0x14'),function(){console[_0x7acf('0x15')](_0x7acf('0x16'),config[_0x7acf('0x17')]);});}exports=module[_0x7acf('0x18')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index f577663..5d9edae 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 _0x213c=['result','catch','exports','bluebird','../../config/logger','routing','client','http','request','then','debug','rpc','error','message'];(function(_0x50bf5a,_0x807bba){var _0x4ddc1d=function(_0x349a61){while(--_0x349a61){_0x50bf5a['push'](_0x50bf5a['shift']());}};_0x4ddc1d(++_0x807bba);}(_0x213c,0xff));var _0xc213=function(_0x1ca7b1,_0x213152){_0x1ca7b1=_0x1ca7b1-0x0;var _0x44f27d=_0x213c[_0x1ca7b1];return _0x44f27d;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xc213('0x0'));var logger=require(_0xc213('0x1'))(_0xc213('0x2'));var client=jayson[_0xc213('0x3')][_0xc213('0x4')]({'port':0x2329});client['Request']=function(_0x24e275,_0x1419a9){return new BPromise(function(_0x283d06,_0x1904cf){return client[_0xc213('0x5')](_0x24e275,_0x1419a9)[_0xc213('0x6')](function(_0x141f8e){logger[_0xc213('0x7')](_0xc213('0x8'),_0xc213('0x2'),_0x24e275,_0x1419a9,_0x141f8e);if(_0x141f8e['error']){logger['error'](_0xc213('0x8'),_0xc213('0x2'),_0x24e275,_0x141f8e[_0xc213('0x9')][_0xc213('0xa')],_0x1419a9);return _0x1904cf(_0x141f8e[_0xc213('0x9')][_0xc213('0xa')]);}else{return _0x283d06(_0x141f8e[_0xc213('0xb')]);}})[_0xc213('0xc')](function(_0x3679ea){logger[_0xc213('0x9')](_0xc213('0x8'),_0xc213('0x2'),_0x24e275,_0x3679ea,_0x1419a9);return _0x1904cf(_0x3679ea);});});};module[_0xc213('0xd')]=client; \ No newline at end of file +var _0xf75a=['result','catch','exports','jayson/promise','bluebird','routing','client','request','debug','error','rpc','message'];(function(_0x597c46,_0x2b832f){var _0x3dd000=function(_0x4faa4a){while(--_0x4faa4a){_0x597c46['push'](_0x597c46['shift']());}};_0x3dd000(++_0x2b832f);}(_0xf75a,0x123));var _0xaf75=function(_0x37fbe7,_0x367180){_0x37fbe7=_0x37fbe7-0x0;var _0x158032=_0xf75a[_0x37fbe7];return _0x158032;};'use strict';var jayson=require(_0xaf75('0x0'));var BPromise=require(_0xaf75('0x1'));var logger=require('../../config/logger')(_0xaf75('0x2'));var client=jayson[_0xaf75('0x3')]['http']({'port':0x2329});client['Request']=function(_0x232bf5,_0x196282){return new BPromise(function(_0x5aad26,_0xfda604){return client[_0xaf75('0x4')](_0x232bf5,_0x196282)['then'](function(_0x540177){logger[_0xaf75('0x5')]('rpc',_0xaf75('0x2'),_0x232bf5,_0x196282,_0x540177);if(_0x540177[_0xaf75('0x6')]){logger[_0xaf75('0x6')](_0xaf75('0x7'),_0xaf75('0x2'),_0x232bf5,_0x540177[_0xaf75('0x6')][_0xaf75('0x8')],_0x196282);return _0xfda604(_0x540177[_0xaf75('0x6')]['message']);}else{return _0x5aad26(_0x540177[_0xaf75('0x9')]);}})[_0xaf75('0xa')](function(_0x420665){logger[_0xaf75('0x6')](_0xaf75('0x7'),_0xaf75('0x2'),_0x232bf5,_0x420665,_0x196282);return _0xfda604(_0x420665);});});};module[_0xaf75('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 103f563..04c261f 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 _0x8157=['then','getAgents','initAgents','getIntervals','initIntervals','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','./server','./rpc/interval','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','resolve'];(function(_0x4e41ff,_0x9c6937){var _0x50b946=function(_0x340b04){while(--_0x340b04){_0x4e41ff['push'](_0x4e41ff['shift']());}};_0x50b946(++_0x9c6937);}(_0x8157,0x15a));var _0x7815=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0x8157[_0x4bfe08];return _0x1f9125;};'use strict';var BPromise=require('bluebird');var server=require(_0x7815('0x0'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x7815('0x1'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x7815('0x2'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x7815('0x3'));var faxQueue=require(_0x7815('0x4'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x7815('0x5')]()[_0x7815('0x6')](user[_0x7815('0x7')]())[_0x7815('0x6')](realtime[_0x7815('0x8')]())[_0x7815('0x6')](interval[_0x7815('0x9')]())[_0x7815('0x6')](realtime[_0x7815('0xa')]())['then'](openchannelQueue['getOpenchannelQueues']())[_0x7815('0x6')](realtime[_0x7815('0xb')]())[_0x7815('0x6')](chatQueue[_0x7815('0xc')]())[_0x7815('0x6')](realtime[_0x7815('0xd')]())[_0x7815('0x6')](smsQueue[_0x7815('0xe')]())[_0x7815('0x6')](realtime[_0x7815('0xf')]())[_0x7815('0x6')](mailQueue[_0x7815('0x10')]())[_0x7815('0x6')](realtime[_0x7815('0x11')]())['then'](faxQueue[_0x7815('0x12')]())[_0x7815('0x6')](realtime[_0x7815('0x13')]())[_0x7815('0x6')](whatsappQueue[_0x7815('0x14')]())[_0x7815('0x6')](realtime['initWhatsappQueues']())[_0x7815('0x6')](function(){return realtime;});}function main(){return server[_0x7815('0x15')](realtime)['then'](function(_0x30e905){return initRealtime();})['then'](function(_0x4c53bd){return setInterval(initRealtime,0x1388);})['catch'](function(_0x9b0f2a){console['log'](_0x9b0f2a);});}main(); \ No newline at end of file +var _0x0870=['./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','getChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/user','./rpc/openchannelQueue'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x0870,0x11c));var _0x0087=function(_0x419187,_0x17277f){_0x419187=_0x419187-0x0;var _0x16ab17=_0x0870[_0x419187];return _0x16ab17;};'use strict';var BPromise=require('bluebird');var server=require(_0x0087('0x0'));var Realtime=require(_0x0087('0x1'));var user=require(_0x0087('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x0087('0x3'));var chatQueue=require(_0x0087('0x4'));var smsQueue=require(_0x0087('0x5'));var mailQueue=require(_0x0087('0x6'));var faxQueue=require(_0x0087('0x7'));var whatsappQueue=require(_0x0087('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x0087('0x9')]()['then'](user['getAgents']())[_0x0087('0xa')](realtime[_0x0087('0xb')]())[_0x0087('0xa')](interval[_0x0087('0xc')]())['then'](realtime[_0x0087('0xd')]())[_0x0087('0xa')](openchannelQueue['getOpenchannelQueues']())[_0x0087('0xa')](realtime['initOpenchannelQueues']())['then'](chatQueue[_0x0087('0xe')]())[_0x0087('0xa')](realtime['initChatQueues']())[_0x0087('0xa')](smsQueue['getSmsQueues']())[_0x0087('0xa')](realtime[_0x0087('0xf')]())[_0x0087('0xa')](mailQueue[_0x0087('0x10')]())['then'](realtime[_0x0087('0x11')]())[_0x0087('0xa')](faxQueue[_0x0087('0x12')]())[_0x0087('0xa')](realtime[_0x0087('0x13')]())[_0x0087('0xa')](whatsappQueue[_0x0087('0x14')]())[_0x0087('0xa')](realtime['initWhatsappQueues']())[_0x0087('0xa')](function(){return realtime;});}function main(){return server[_0x0087('0x15')](realtime)['then'](function(_0x2271ce){return initRealtime();})[_0x0087('0xa')](function(_0x1237f3){return setInterval(initRealtime,0x1388);})[_0x0087('0x16')](function(_0x500651){console[_0x0087('0x17')](_0x500651);});}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 88a5da1..7197e4d 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x5e975e,_0x4cdac4){var _0x124f5c=function(_0x2a10c4){while(--_0x2a10c4){_0x5e975e['push'](_0x5e975e['shift']());}};_0x124f5c(++_0x4cdac4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xc4aa[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0xe00729,_0x2334e2){var _0x7a86e7=function(_0x19755f){while(--_0x19755f){_0xe00729['push'](_0xe00729['shift']());}};_0x7a86e7(++_0x2334e2);}(_0x7a54,0x106));var _0x47a5=function(_0xd0266d,_0xc47f6f){_0xd0266d=_0xd0266d-0x0;var _0x555ad0=_0x7a54[_0xd0266d];return _0x555ad0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index f4c449b..b5cc1f7 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 _0xd8b4=['result','sendMailMessage','bluebird','jayson/promise','client','http','request','then','error'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0xd8b4,0x65));var _0x4d8b=function(_0x1ce7d8,_0x1b1c3b){_0x1ce7d8=_0x1ce7d8-0x0;var _0x36ecea=_0xd8b4[_0x1ce7d8];return _0x36ecea;};'use strict';var BPromise=require(_0x4d8b('0x0'));var jayson=require(_0x4d8b('0x1'));var client=jayson[_0x4d8b('0x2')][_0x4d8b('0x3')]({'port':0x232b});function request(_0x4022d6,_0x14a4f2){return new BPromise(function(_0x1a0bdc,_0x58e016){return client[_0x4d8b('0x4')](_0x4022d6,_0x14a4f2)[_0x4d8b('0x5')](function(_0x5c6320){if(_0x5c6320[_0x4d8b('0x6')]){return _0x58e016(_0x5c6320[_0x4d8b('0x6')]['message']);}else{return _0x1a0bdc(_0x5c6320[_0x4d8b('0x7')]);}})['catch'](function(_0x569c1d){return _0x58e016(_0x569c1d);});});}exports[_0x4d8b('0x8')]=function(_0x2ad098,_0x110a3f){return request('SendMail',{'account':_0x2ad098,'message':_0x110a3f});}; \ No newline at end of file +var _0x0f04=['request','then','error','message','sendMailMessage','SendMail','bluebird','client','http'];(function(_0x495927,_0x357ac2){var _0x4be248=function(_0x30db53){while(--_0x30db53){_0x495927['push'](_0x495927['shift']());}};_0x4be248(++_0x357ac2);}(_0x0f04,0xcc));var _0x40f0=function(_0x48fd18,_0x1dd367){_0x48fd18=_0x48fd18-0x0;var _0x120b98=_0x0f04[_0x48fd18];return _0x120b98;};'use strict';var BPromise=require(_0x40f0('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x40f0('0x1')][_0x40f0('0x2')]({'port':0x232b});function request(_0x4190e9,_0x4d37f9){return new BPromise(function(_0x2e0b48,_0x5d7d0e){return client[_0x40f0('0x3')](_0x4190e9,_0x4d37f9)[_0x40f0('0x4')](function(_0x42d2ed){if(_0x42d2ed[_0x40f0('0x5')]){return _0x5d7d0e(_0x42d2ed['error'][_0x40f0('0x6')]);}else{return _0x2e0b48(_0x42d2ed['result']);}})['catch'](function(_0x55fb72){return _0x5d7d0e(_0x55fb72);});});}exports[_0x40f0('0x7')]=function(_0x3c9baa,_0xf47ac3){return request(_0x40f0('0x8'),{'account':_0x3c9baa,'message':_0xf47ac3});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 2ad40f3..fffc396 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 _0xc052=['voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','prototype','mail','chat','openchannel','fax','whatsapp','Status','format','chatStatusTime','mailCapacity','smsCurrentCapacity','openchannelStatus','openchannelStatusTime','stringify','emit','user:save','exports','lodash','moment','ioredis','../../../config/environment','localhost','redis','name','online'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xc052,0x70));var _0x2c05=function(_0x3a354b,_0x5b3bd7){_0x3a354b=_0x3a354b-0x0;var _0x535494=_0xc052[_0x3a354b];return _0x535494;};'use strict';var _=require(_0x2c05('0x0'));var moment=require(_0x2c05('0x1'));var md5=require('md5');var Redis=require(_0x2c05('0x2'));var config=require(_0x2c05('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0x2c05('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2c05('0x5')]));function Agent(_0x1d7672){this['id']=_0x1d7672['id']||0x0;this[_0x2c05('0x6')]=_0x1d7672[_0x2c05('0x6')]||'';this[_0x2c05('0x7')]=_0x1d7672[_0x2c05('0x7')]||!![];this[_0x2c05('0x8')]=_0x1d7672[_0x2c05('0x8')]||![];this[_0x2c05('0x9')]=_0x1d7672[_0x2c05('0x9')]||![];this[_0x2c05('0xa')]=_0x1d7672[_0x2c05('0xa')]||![];this[_0x2c05('0xb')]=_0x1d7672[_0x2c05('0xb')]||![];this[_0x2c05('0xc')]=_0x1d7672[_0x2c05('0xc')]||![];this[_0x2c05('0xd')]=_0x1d7672[_0x2c05('0xd')]||![];this[_0x2c05('0xe')]=_0x2c05('0xf');this['chatStatusTime']=0x0;this[_0x2c05('0x10')]=_0x1d7672[_0x2c05('0x10')]||0x0;this[_0x2c05('0x11')]=0x0;this[_0x2c05('0x12')]='unknown';this[_0x2c05('0x13')]=0x0;this['mailCapacity']=_0x1d7672['mailCapacity']||0x0;this[_0x2c05('0x14')]=0x0;this[_0x2c05('0x15')]='unknown';this[_0x2c05('0x16')]=0x0;this[_0x2c05('0x17')]=_0x1d7672[_0x2c05('0x17')]||0x0;this[_0x2c05('0x18')]=0x0;this[_0x2c05('0x19')]=_0x2c05('0xf');this[_0x2c05('0x1a')]=0x0;this[_0x2c05('0x1b')]=_0x1d7672[_0x2c05('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x2c05('0x1c')]=_0x2c05('0xf');this[_0x2c05('0x1d')]=0x0;this[_0x2c05('0x1e')]=_0x1d7672[_0x2c05('0x1e')]||0x0;this[_0x2c05('0x1f')]=0x0;this['openchannelStatus']='unknown';this['openchannelStatusTime']=0x0;this[_0x2c05('0x20')]=_0x1d7672[_0x2c05('0x20')]||0x0;this[_0x2c05('0x21')]=0x0;this[_0x2c05('0x22')]=![];this[_0x2c05('0x23')]=undefined;this[_0x2c05('0x24')]='';this[_0x2c05('0x25')]();}Agent['prototype'][_0x2c05('0x26')]=function(_0x42b0bc){if(this[_0x42b0bc+'CurrentCapacity']>0x0){if(this[_0x42b0bc+'Capacity']>0x0&&this[_0x42b0bc+_0x2c05('0x27')]>=this[_0x42b0bc+_0x2c05('0x28')]){return _0x2c05('0x29');}else{return _0x2c05('0x2a');}}else{return'idle';}};Agent[_0x2c05('0x2b')][_0x2c05('0x25')]=function(){var _0x36cbe3=[_0x2c05('0x2c'),_0x2c05('0x2d'),_0x2c05('0x2e'),_0x2c05('0x2f'),'sms',_0x2c05('0x30')];for(var _0x2705c6=0x0;_0x2705c6<_0x36cbe3['length'];_0x2705c6+=0x1){var _0x11a15f=this['getChannelStatus'](_0x36cbe3[_0x2705c6]);if(this[_0x36cbe3[_0x2705c6]+_0x2c05('0x31')]!==_0x11a15f){this[_0x36cbe3[_0x2705c6]+'StatusTime']=_['toNumber'](moment()[_0x2c05('0x32')]('x'));}this[_0x36cbe3[_0x2705c6]+_0x2c05('0x31')]=_0x11a15f;}var _0x7845b5={'id':this['id'],'name':this['name'],'online':this[_0x2c05('0x7')],'voicePause':this['voicePause'],'chatPause':this[_0x2c05('0x9')],'mailPause':this[_0x2c05('0xa')],'smsPause':this[_0x2c05('0xc')],'faxPause':this[_0x2c05('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x2c05('0xe')],'chatStatusTime':this[_0x2c05('0x33')],'chatCapacity':this[_0x2c05('0x10')],'chatCurrentCapacity':this[_0x2c05('0x11')],'mailStatus':this[_0x2c05('0x12')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x2c05('0x34')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x2c05('0x15')],'faxStatusTime':this[_0x2c05('0x16')],'faxCapacity':this[_0x2c05('0x17')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x2c05('0x1a')],'smsCapacity':this[_0x2c05('0x1b')],'smsCurrentCapacity':this[_0x2c05('0x35')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x2c05('0x1d')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x2c05('0x36')],'openchannelStatusTime':this[_0x2c05('0x37')],'openchannelCapacity':this[_0x2c05('0x20')],'openchannelCurrentCapacity':this[_0x2c05('0x21')],'busy':this['busy'],'busyQueue':this[_0x2c05('0x23')]};var _0x3b715e=md5(JSON[_0x2c05('0x38')](_0x7845b5));if(this[_0x2c05('0x24')]!==_0x3b715e){this[_0x2c05('0x24')]=_0x3b715e;io[_0x2c05('0x39')](_0x2c05('0x3a'),_0x7845b5);}};module[_0x2c05('0x3b')]=Agent; \ No newline at end of file +var _0x30ad=['emit','user:save','exports','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','online','voicePause','chatPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','fax','sms','whatsapp','length','Status','StatusTime','toNumber','format','mailPause','chatStatusTime','faxCurrentCapacity','smsStatusTime','smsCurrentCapacity','busyQueue'];(function(_0x53d8f0,_0x22556b){var _0x72439a=function(_0x1ae168){while(--_0x1ae168){_0x53d8f0['push'](_0x53d8f0['shift']());}};_0x72439a(++_0x22556b);}(_0x30ad,0xb7));var _0xd30a=function(_0x2eff74,_0x15c13f){_0x2eff74=_0x2eff74-0x0;var _0x50c09d=_0x30ad[_0x2eff74];return _0x50c09d;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require(_0xd30a('0x0'));var Redis=require(_0xd30a('0x1'));var config=require(_0xd30a('0x2'));config['redis']=_[_0xd30a('0x3')](config[_0xd30a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xd30a('0x5'))(new Redis(config[_0xd30a('0x4')]));function Agent(_0x1b0136){this['id']=_0x1b0136['id']||0x0;this[_0xd30a('0x6')]=_0x1b0136[_0xd30a('0x6')]||'';this['online']=_0x1b0136[_0xd30a('0x7')]||!![];this[_0xd30a('0x8')]=_0x1b0136[_0xd30a('0x8')]||![];this[_0xd30a('0x9')]=_0x1b0136['chatPause']||![];this['mailPause']=_0x1b0136['mailPause']||![];this[_0xd30a('0xa')]=_0x1b0136['faxPause']||![];this['smsPause']=_0x1b0136[_0xd30a('0xb')]||![];this[_0xd30a('0xc')]=_0x1b0136[_0xd30a('0xc')]||![];this[_0xd30a('0xd')]=_0xd30a('0xe');this['chatStatusTime']=0x0;this[_0xd30a('0xf')]=_0x1b0136['chatCapacity']||0x0;this[_0xd30a('0x10')]=0x0;this[_0xd30a('0x11')]='unknown';this['mailStatusTime']=0x0;this[_0xd30a('0x12')]=_0x1b0136['mailCapacity']||0x0;this[_0xd30a('0x13')]=0x0;this[_0xd30a('0x14')]=_0xd30a('0xe');this[_0xd30a('0x15')]=0x0;this[_0xd30a('0x16')]=_0x1b0136[_0xd30a('0x16')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xd30a('0x17')]=_0xd30a('0xe');this['smsStatusTime']=0x0;this[_0xd30a('0x18')]=_0x1b0136[_0xd30a('0x18')]||0x0;this['smsCurrentCapacity']=0x0;this[_0xd30a('0x19')]=_0xd30a('0xe');this[_0xd30a('0x1a')]=0x0;this[_0xd30a('0x1b')]=_0x1b0136[_0xd30a('0x1b')]||0x0;this[_0xd30a('0x1c')]=0x0;this[_0xd30a('0x1d')]=_0xd30a('0xe');this[_0xd30a('0x1e')]=0x0;this[_0xd30a('0x1f')]=_0x1b0136[_0xd30a('0x1f')]||0x0;this[_0xd30a('0x20')]=0x0;this[_0xd30a('0x21')]=![];this['busyQueue']=undefined;this[_0xd30a('0x0')]='';this[_0xd30a('0x22')]();}Agent[_0xd30a('0x23')][_0xd30a('0x24')]=function(_0x2d5a85){if(this[_0x2d5a85+_0xd30a('0x25')]>0x0){if(this[_0x2d5a85+'Capacity']>0x0&&this[_0x2d5a85+'CurrentCapacity']>=this[_0x2d5a85+_0xd30a('0x26')]){return _0xd30a('0x27');}else{return _0xd30a('0x28');}}else{return _0xd30a('0x29');}};Agent[_0xd30a('0x23')][_0xd30a('0x22')]=function(){var _0x2fb43c=[_0xd30a('0x2a'),'chat','openchannel',_0xd30a('0x2b'),_0xd30a('0x2c'),_0xd30a('0x2d')];for(var _0x27c702=0x0;_0x27c702<_0x2fb43c[_0xd30a('0x2e')];_0x27c702+=0x1){var _0x9110e2=this[_0xd30a('0x24')](_0x2fb43c[_0x27c702]);if(this[_0x2fb43c[_0x27c702]+_0xd30a('0x2f')]!==_0x9110e2){this[_0x2fb43c[_0x27c702]+_0xd30a('0x30')]=_[_0xd30a('0x31')](moment()[_0xd30a('0x32')]('x'));}this[_0x2fb43c[_0x27c702]+_0xd30a('0x2f')]=_0x9110e2;}var _0x481752={'id':this['id'],'name':this[_0xd30a('0x6')],'online':this[_0xd30a('0x7')],'voicePause':this[_0xd30a('0x8')],'chatPause':this[_0xd30a('0x9')],'mailPause':this[_0xd30a('0x33')],'smsPause':this[_0xd30a('0xb')],'faxPause':this[_0xd30a('0xa')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xd30a('0x34')],'chatCapacity':this[_0xd30a('0xf')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xd30a('0x11')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xd30a('0x13')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xd30a('0x15')],'faxCapacity':this[_0xd30a('0x16')],'faxCurrentCapacity':this[_0xd30a('0x35')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xd30a('0x36')],'smsCapacity':this[_0xd30a('0x18')],'smsCurrentCapacity':this[_0xd30a('0x37')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xd30a('0x1a')],'whatsappCapacity':this[_0xd30a('0x1b')],'whatsappCurrentCapacity':this[_0xd30a('0x1c')],'openchannelStatus':this[_0xd30a('0x1d')],'openchannelStatusTime':this[_0xd30a('0x1e')],'openchannelCapacity':this[_0xd30a('0x1f')],'openchannelCurrentCapacity':this[_0xd30a('0x20')],'busy':this['busy'],'busyQueue':this[_0xd30a('0x38')]};var _0x49e055=md5(JSON['stringify'](_0x481752));if(this[_0xd30a('0x0')]!==_0x49e055){this['md5']=_0x49e055;io[_0xd30a('0x39')](_0xd30a('0x3a'),_0x481752);}};module[_0xd30a('0x3b')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index da7bb2a..6cc492f 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 _0xd74d=['lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','name','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','online','chatPause','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save'];(function(_0x518b8c,_0x41b086){var _0x588ca2=function(_0x4a3413){while(--_0x4a3413){_0x518b8c['push'](_0x518b8c['shift']());}};_0x588ca2(++_0x41b086);}(_0xd74d,0x8c));var _0xdd74=function(_0x4d1814,_0x143dd7){_0x4d1814=_0x4d1814-0x0;var _0x4a17b7=_0xd74d[_0x4d1814];return _0x4a17b7;};'use strict';var _=require(_0xdd74('0x0'));var md5=require(_0xdd74('0x1'));var util=require('util');var Redis=require(_0xdd74('0x2'));var config=require(_0xdd74('0x3'));config['redis']=_[_0xdd74('0x4')](config[_0xdd74('0x5')],{'host':_0xdd74('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdd74('0x5')]));function ChatQueue(_0x51be9a){this['id']=_0x51be9a['id']||0x0;this[_0xdd74('0x7')]=_0x51be9a[_0xdd74('0x7')]||'';this['timeout']=_0x51be9a['timeout']||0xa;this[_0xdd74('0x8')]=_0x51be9a[_0xdd74('0x8')]||_0xdd74('0x9');this[_0xdd74('0xa')]=_0x51be9a[_0xdd74('0xa')];this[_0xdd74('0xb')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0xdd74('0xc')]();}ChatQueue[_0xdd74('0xd')][_0xdd74('0xe')]=function(){var _0x33c684=this[_0xdd74('0xb')][_0xdd74('0xf')];this[_0xdd74('0xb')]=_[_0xdd74('0x10')](this[_0xdd74('0xa')],'id');this[_0xdd74('0xb')][_0xdd74('0xf')]=_0x33c684;};ChatQueue[_0xdd74('0xd')][_0xdd74('0xc')]=function(){this[_0xdd74('0x11')]=0x0;this[_0xdd74('0x12')]=0x0;for(var _0x32256e=0x0;_0x32256e=0x0?this[_0xdd74('0x15')]:0x0;var _0x4b1a51={'id':this['id'],'available':this[_0xdd74('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xdd74('0x7')],'paused':this[_0xdd74('0x12')],'waiting':this[_0xdd74('0x16')]};var _0x1adcc0=md5(JSON[_0xdd74('0x17')](_0x4b1a51));if(this[_0xdd74('0x1')]!==_0x1adcc0){this['md5']=_0x1adcc0;io['to'](util[_0xdd74('0x18')](_0xdd74('0x19'),_0x4b1a51[_0xdd74('0x7')]))[_0xdd74('0x1a')](_0xdd74('0x1b'),_0x4b1a51);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x1f64=['paused','length','online','chatPause','available','stringify','chat:queue:%s','chat_queue:save','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn'];(function(_0x1ea6f2,_0x4f47ed){var _0x57cbf8=function(_0x203980){while(--_0x203980){_0x1ea6f2['push'](_0x1ea6f2['shift']());}};_0x57cbf8(++_0x4f47ed);}(_0x1f64,0xcc));var _0x41f6=function(_0x2c6561,_0x2c92f5){_0x2c6561=_0x2c6561-0x0;var _0x404bfd=_0x1f64[_0x2c6561];return _0x404bfd;};'use strict';var _=require(_0x41f6('0x0'));var md5=require(_0x41f6('0x1'));var util=require(_0x41f6('0x2'));var Redis=require(_0x41f6('0x3'));var config=require('../../../config/environment');config[_0x41f6('0x4')]=_['defaults'](config['redis'],{'host':_0x41f6('0x5'),'port':0x18eb});var io=require(_0x41f6('0x6'))(new Redis(config[_0x41f6('0x4')]));function ChatQueue(_0x2a64b0){this['id']=_0x2a64b0['id']||0x0;this[_0x41f6('0x7')]=_0x2a64b0[_0x41f6('0x7')]||'';this[_0x41f6('0x8')]=_0x2a64b0[_0x41f6('0x8')]||0xa;this[_0x41f6('0x9')]=_0x2a64b0['strategy']||_0x41f6('0xa');this[_0x41f6('0xb')]=_0x2a64b0[_0x41f6('0xb')];this[_0x41f6('0xc')]={};this[_0x41f6('0xd')]=0x0;this[_0x41f6('0x1')]='';this[_0x41f6('0xe')]();this[_0x41f6('0xf')]();}ChatQueue[_0x41f6('0x10')][_0x41f6('0xe')]=function(){var _0x1d48f1=this[_0x41f6('0xc')][_0x41f6('0x11')];this['mapAgentsId']=_[_0x41f6('0x12')](this['Agents'],'id');this[_0x41f6('0xc')]['_rr']=_0x1d48f1;};ChatQueue[_0x41f6('0x10')][_0x41f6('0xf')]=function(){this[_0x41f6('0x13')]=0x0;this[_0x41f6('0x14')]=0x0;for(var _0x29dc33=0x0;_0x29dc33=0x0?this[_0x41f6('0x18')]:0x0;var _0x5e1ab5={'id':this['id'],'available':this[_0x41f6('0x18')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x41f6('0x14')],'waiting':this[_0x41f6('0xd')]};var _0x46ed40=md5(JSON[_0x41f6('0x19')](_0x5e1ab5));if(this[_0x41f6('0x1')]!==_0x46ed40){this[_0x41f6('0x1')]=_0x46ed40;io['to'](util['format'](_0x41f6('0x1a'),_0x5e1ab5[_0x41f6('0x7')]))['emit'](_0x41f6('0x1b'),_0x5e1ab5);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 76aa9d6..e328f9e 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 _0xb0bb=['updateRouting','_rr','map','updateRealtime','loggedIn','length','online','faxPause','available','paused','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','prototype'];(function(_0x435031,_0x1c187b){var _0x32b0c8=function(_0x4f0e87){while(--_0x4f0e87){_0x435031['push'](_0x435031['shift']());}};_0x32b0c8(++_0x1c187b);}(_0xb0bb,0xa6));var _0xbb0b=function(_0x2f348d,_0x50fff6){_0x2f348d=_0x2f348d-0x0;var _0x14097e=_0xb0bb[_0x2f348d];return _0x14097e;};'use strict';var _=require(_0xbb0b('0x0'));var md5=require(_0xbb0b('0x1'));var util=require(_0xbb0b('0x2'));var Redis=require(_0xbb0b('0x3'));var config=require(_0xbb0b('0x4'));config[_0xbb0b('0x5')]=_['defaults'](config[_0xbb0b('0x5')],{'host':_0xbb0b('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbb0b('0x5')]));function FaxQueue(_0x51cf84){this['id']=_0x51cf84['id']||0x0;this[_0xbb0b('0x7')]=_0x51cf84[_0xbb0b('0x7')]||'';this[_0xbb0b('0x8')]=_0x51cf84[_0xbb0b('0x8')]||0xa;this['strategy']=_0x51cf84[_0xbb0b('0x9')]||_0xbb0b('0xa');this[_0xbb0b('0xb')]=_0x51cf84['Agents'];this[_0xbb0b('0xc')]={};this['waiting']=0x0;this[_0xbb0b('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0xbb0b('0xd')][_0xbb0b('0xe')]=function(){var _0x597c55=this[_0xbb0b('0xc')][_0xbb0b('0xf')];this[_0xbb0b('0xc')]=_[_0xbb0b('0x10')](this[_0xbb0b('0xb')],'id');this[_0xbb0b('0xc')][_0xbb0b('0xf')]=_0x597c55;};FaxQueue['prototype'][_0xbb0b('0x11')]=function(){this[_0xbb0b('0x12')]=0x0;this['paused']=0x0;for(var _0x3c312f=0x0;_0x3c312f=0x0?this[_0xbb0b('0x16')]:0x0;var _0x38f39e={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbb0b('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x476557=md5(JSON[_0xbb0b('0x18')](_0x38f39e));if(this['md5']!==_0x476557){this[_0xbb0b('0x1')]=_0x476557;io['to'](util[_0xbb0b('0x19')](_0xbb0b('0x1a'),_0x38f39e['name']))[_0xbb0b('0x1b')](_0xbb0b('0x1c'),_0x38f39e);}};module[_0xbb0b('0x1d')]=FaxQueue; \ No newline at end of file +var _0x829d=['paused','available','waiting','stringify','fax:queue:%s','emit','fax_queue:save','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','_rr','map','loggedIn','length','online'];(function(_0x40f58f,_0x3b0300){var _0x1a77cc=function(_0x2db877){while(--_0x2db877){_0x40f58f['push'](_0x40f58f['shift']());}};_0x1a77cc(++_0x3b0300);}(_0x829d,0x130));var _0xd829=function(_0x5331d3,_0x4a9db6){_0x5331d3=_0x5331d3-0x0;var _0x5d3a3f=_0x829d[_0x5331d3];return _0x5d3a3f;};'use strict';var _=require('lodash');var md5=require(_0xd829('0x0'));var util=require('util');var Redis=require(_0xd829('0x1'));var config=require(_0xd829('0x2'));config[_0xd829('0x3')]=_[_0xd829('0x4')](config[_0xd829('0x3')],{'host':_0xd829('0x5'),'port':0x18eb});var io=require(_0xd829('0x6'))(new Redis(config[_0xd829('0x3')]));function FaxQueue(_0x4a7d4b){this['id']=_0x4a7d4b['id']||0x0;this[_0xd829('0x7')]=_0x4a7d4b[_0xd829('0x7')]||'';this[_0xd829('0x8')]=_0x4a7d4b[_0xd829('0x8')]||0xa;this[_0xd829('0x9')]=_0x4a7d4b[_0xd829('0x9')]||_0xd829('0xa');this[_0xd829('0xb')]=_0x4a7d4b[_0xd829('0xb')];this[_0xd829('0xc')]={};this['waiting']=0x0;this[_0xd829('0x0')]='';this['updateRouting']();this[_0xd829('0xd')]();}FaxQueue[_0xd829('0xe')]['updateRouting']=function(){var _0x2d4987=this[_0xd829('0xc')][_0xd829('0xf')];this[_0xd829('0xc')]=_[_0xd829('0x10')](this[_0xd829('0xb')],'id');this[_0xd829('0xc')][_0xd829('0xf')]=_0x2d4987;};FaxQueue[_0xd829('0xe')][_0xd829('0xd')]=function(){this[_0xd829('0x11')]=0x0;this['paused']=0x0;for(var _0x45f89e=0x0;_0x45f89e=0x0?this[_0xd829('0x15')]:0x0;var _0x3f0a26={'id':this['id'],'available':this[_0xd829('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xd829('0x7')],'paused':this[_0xd829('0x14')],'waiting':this[_0xd829('0x16')]};var _0x4fdbcf=md5(JSON[_0xd829('0x17')](_0x3f0a26));if(this['md5']!==_0x4fdbcf){this[_0xd829('0x0')]=_0x4fdbcf;io['to'](util['format'](_0xd829('0x18'),_0x3f0a26[_0xd829('0x7')]))[_0xd829('0x19')](_0xd829('0x1a'),_0x3f0a26);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 28f5a9b..c9f59b9 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 _0x2867=['exports','name','Intervals'];(function(_0x46db7d,_0x56b87f){var _0x382193=function(_0x5e26a8){while(--_0x5e26a8){_0x46db7d['push'](_0x46db7d['shift']());}};_0x382193(++_0x56b87f);}(_0x2867,0x79));var _0x7286=function(_0x14911e,_0x578e33){_0x14911e=_0x14911e-0x0;var _0x46ed87=_0x2867[_0x14911e];return _0x46ed87;};'use strict';function Interval(_0x27221e){this['id']=_0x27221e['id']||0x0;this[_0x7286('0x0')]=_0x27221e[_0x7286('0x0')]||'';this['Intervals']=_0x27221e[_0x7286('0x1')]||{};}module[_0x7286('0x2')]=Interval; \ No newline at end of file +var _0x374b=['name','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x374b,0x156));var _0xb374=function(_0x119894,_0x1f4660){_0x119894=_0x119894-0x0;var _0x152b21=_0x374b[_0x119894];return _0x152b21;};'use strict';function Interval(_0x1fdfa6){this['id']=_0x1fdfa6['id']||0x0;this[_0xb374('0x0')]=_0x1fdfa6['name']||'';this['Intervals']=_0x1fdfa6['Intervals']||{};}module[_0xb374('0x1')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index dcd648b..381b823 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 _0xfd41=['lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','mailPause','available','stringify','format','mail_queue:save','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xfd41,0x196));var _0x1fd4=function(_0x197065,_0x2e79d0){_0x197065=_0x197065-0x0;var _0x3d9404=_0xfd41[_0x197065];return _0x3d9404;};'use strict';var _=require(_0x1fd4('0x0'));var md5=require(_0x1fd4('0x1'));var util=require('util');var Redis=require(_0x1fd4('0x2'));var config=require(_0x1fd4('0x3'));config[_0x1fd4('0x4')]=_[_0x1fd4('0x5')](config[_0x1fd4('0x4')],{'host':_0x1fd4('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1fd4('0x4')]));function MailQueue(_0x4c8203){this['id']=_0x4c8203['id']||0x0;this[_0x1fd4('0x7')]=_0x4c8203['name']||'';this[_0x1fd4('0x8')]=_0x4c8203['timeout']||0xa;this[_0x1fd4('0x9')]=_0x4c8203['strategy']||_0x1fd4('0xa');this[_0x1fd4('0xb')]=_0x4c8203['Agents'];this[_0x1fd4('0xc')]={};this[_0x1fd4('0xd')]=0x0;this[_0x1fd4('0x1')]='';this[_0x1fd4('0xe')]();this[_0x1fd4('0xf')]();}MailQueue[_0x1fd4('0x10')][_0x1fd4('0xe')]=function(){var _0x51dc2c=this[_0x1fd4('0xc')][_0x1fd4('0x11')];this['mapAgentsId']=_[_0x1fd4('0x12')](this[_0x1fd4('0xb')],'id');this['mapAgentsId'][_0x1fd4('0x11')]=_0x51dc2c;};MailQueue[_0x1fd4('0x10')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x1fd4('0x13')]=0x0;for(var _0x24d7dc=0x0;_0x24d7dc=0x0?this[_0x1fd4('0x18')]:0x0;var _0x33f8f0={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x1fd4('0x7')],'paused':this[_0x1fd4('0x13')],'waiting':this[_0x1fd4('0xd')]};var _0x1184e6=md5(JSON[_0x1fd4('0x19')](_0x33f8f0));if(this[_0x1fd4('0x1')]!==_0x1184e6){this['md5']=_0x1184e6;io['to'](util[_0x1fd4('0x1a')]('mail:queue:%s',_0x33f8f0[_0x1fd4('0x7')]))['emit'](_0x1fd4('0x1b'),_0x33f8f0);}};module[_0x1fd4('0x1c')]=MailQueue; \ No newline at end of file +var _0x1c4e=['format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','map','prototype','paused','length','online','loggedIn','available','stringify'];(function(_0x24364f,_0x3846b4){var _0x31013f=function(_0x276ead){while(--_0x276ead){_0x24364f['push'](_0x24364f['shift']());}};_0x31013f(++_0x3846b4);}(_0x1c4e,0x18b));var _0xe1c4=function(_0x291086,_0x5b7274){_0x291086=_0x291086-0x0;var _0xe42533=_0x1c4e[_0x291086];return _0xe42533;};'use strict';var _=require(_0xe1c4('0x0'));var md5=require(_0xe1c4('0x1'));var util=require(_0xe1c4('0x2'));var Redis=require(_0xe1c4('0x3'));var config=require(_0xe1c4('0x4'));config[_0xe1c4('0x5')]=_[_0xe1c4('0x6')](config['redis'],{'host':_0xe1c4('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function MailQueue(_0x1efb87){this['id']=_0x1efb87['id']||0x0;this[_0xe1c4('0x8')]=_0x1efb87[_0xe1c4('0x8')]||'';this[_0xe1c4('0x9')]=_0x1efb87[_0xe1c4('0x9')]||0xa;this[_0xe1c4('0xa')]=_0x1efb87[_0xe1c4('0xa')]||'beepall';this['Agents']=_0x1efb87[_0xe1c4('0xb')];this[_0xe1c4('0xc')]={};this[_0xe1c4('0xd')]=0x0;this[_0xe1c4('0x1')]='';this['updateRouting']();this[_0xe1c4('0xe')]();}MailQueue['prototype'][_0xe1c4('0xf')]=function(){var _0x37ee6b=this[_0xe1c4('0xc')][_0xe1c4('0x10')];this[_0xe1c4('0xc')]=_[_0xe1c4('0x11')](this[_0xe1c4('0xb')],'id');this[_0xe1c4('0xc')]['_rr']=_0x37ee6b;};MailQueue[_0xe1c4('0x12')][_0xe1c4('0xe')]=function(){this['loggedIn']=0x0;this[_0xe1c4('0x13')]=0x0;for(var _0x3c540e=0x0;_0x3c540e=0x0?this['available']:0x0;var _0x64dcc5={'id':this['id'],'available':this[_0xe1c4('0x17')],'loggedIn':this['loggedIn'],'name':this[_0xe1c4('0x8')],'paused':this[_0xe1c4('0x13')],'waiting':this[_0xe1c4('0xd')]};var _0x323b53=md5(JSON[_0xe1c4('0x18')](_0x64dcc5));if(this[_0xe1c4('0x1')]!==_0x323b53){this[_0xe1c4('0x1')]=_0x323b53;io['to'](util[_0xe1c4('0x19')](_0xe1c4('0x1a'),_0x64dcc5['name']))[_0xe1c4('0x1b')](_0xe1c4('0x1c'),_0x64dcc5);}};module[_0xe1c4('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index e017491..4cd9c58 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x432403,_0x1e2c7c){var _0x35395a=function(_0x269321){while(--_0x269321){_0x432403['push'](_0x432403['shift']());}};_0x35395a(++_0x1e2c7c);}(_0x814b,0x1a2));var _0xb814=function(_0x104b35,_0x13f218){_0x104b35=_0x104b35-0x0;var _0x55584d=_0x814b[_0x104b35];return _0x55584d;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +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(_0x5f311a,_0x4b3248){var _0x8fa17=function(_0x572705){while(--_0x572705){_0x5f311a['push'](_0x5f311a['shift']());}};_0x8fa17(++_0x4b3248);}(_0x5fc3,0xa8));var _0x35fc=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0x5fc3[_0x376db5];return _0x304c17;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index f13da49..71377c9 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 _0xf403=['sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn','length','online','smsPause','paused','available','md5','format'];(function(_0x3f39f7,_0x25deaa){var _0x110141=function(_0x337f54){while(--_0x337f54){_0x3f39f7['push'](_0x3f39f7['shift']());}};_0x110141(++_0x25deaa);}(_0xf403,0x1d3));var _0x3f40=function(_0x37d127,_0x3812e6){_0x37d127=_0x37d127-0x0;var _0x26acf1=_0xf403[_0x37d127];return _0x26acf1;};'use strict';var _=require(_0x3f40('0x0'));var md5=require('md5');var util=require(_0x3f40('0x1'));var Redis=require(_0x3f40('0x2'));var config=require(_0x3f40('0x3'));config[_0x3f40('0x4')]=_[_0x3f40('0x5')](config[_0x3f40('0x4')],{'host':_0x3f40('0x6'),'port':0x18eb});var io=require(_0x3f40('0x7'))(new Redis(config['redis']));function SmsQueue(_0x4e91bb){this['id']=_0x4e91bb['id']||0x0;this[_0x3f40('0x8')]=_0x4e91bb[_0x3f40('0x8')]||'';this[_0x3f40('0x9')]=_0x4e91bb[_0x3f40('0x9')]||0xa;this['strategy']=_0x4e91bb[_0x3f40('0xa')]||'beepall';this['Agents']=_0x4e91bb[_0x3f40('0xb')];this[_0x3f40('0xc')]={};this[_0x3f40('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x3f40('0xe')]();}SmsQueue[_0x3f40('0xf')][_0x3f40('0x10')]=function(){var _0x4e30e2=this[_0x3f40('0xc')][_0x3f40('0x11')];this[_0x3f40('0xc')]=_['map'](this[_0x3f40('0xb')],'id');this['mapAgentsId'][_0x3f40('0x11')]=_0x4e30e2;};SmsQueue[_0x3f40('0xf')][_0x3f40('0xe')]=function(){this[_0x3f40('0x12')]=0x0;this['paused']=0x0;for(var _0x2b2bfe=0x0;_0x2b2bfe=0x0?this[_0x3f40('0x17')]:0x0;var _0x374644={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3f40('0x12')],'name':this[_0x3f40('0x8')],'paused':this[_0x3f40('0x16')],'waiting':this[_0x3f40('0xd')]};var _0x3129e2=md5(JSON['stringify'](_0x374644));if(this[_0x3f40('0x18')]!==_0x3129e2){this['md5']=_0x3129e2;io['to'](util[_0x3f40('0x19')](_0x3f40('0x1a'),_0x374644[_0x3f40('0x8')]))[_0x3f40('0x1b')](_0x3f40('0x1c'),_0x374644);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x3685=['length','online','smsPause','available','stringify','emit','sms_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','map','prototype','loggedIn','paused'];(function(_0x3d54cb,_0x59331a){var _0x138acb=function(_0x5551d2){while(--_0x5551d2){_0x3d54cb['push'](_0x3d54cb['shift']());}};_0x138acb(++_0x59331a);}(_0x3685,0xf8));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x5368('0x0'));var md5=require('md5');var util=require(_0x5368('0x1'));var Redis=require(_0x5368('0x2'));var config=require(_0x5368('0x3'));config[_0x5368('0x4')]=_[_0x5368('0x5')](config[_0x5368('0x4')],{'host':_0x5368('0x6'),'port':0x18eb});var io=require(_0x5368('0x7'))(new Redis(config[_0x5368('0x4')]));function SmsQueue(_0x3bbe66){this['id']=_0x3bbe66['id']||0x0;this['name']=_0x3bbe66[_0x5368('0x8')]||'';this[_0x5368('0x9')]=_0x3bbe66[_0x5368('0x9')]||0xa;this[_0x5368('0xa')]=_0x3bbe66['strategy']||_0x5368('0xb');this[_0x5368('0xc')]=_0x3bbe66[_0x5368('0xc')];this[_0x5368('0xd')]={};this[_0x5368('0xe')]=0x0;this[_0x5368('0xf')]='';this[_0x5368('0x10')]();this[_0x5368('0x11')]();}SmsQueue['prototype'][_0x5368('0x10')]=function(){var _0x24b9ec=this[_0x5368('0xd')]['_rr'];this[_0x5368('0xd')]=_[_0x5368('0x12')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x24b9ec;};SmsQueue[_0x5368('0x13')][_0x5368('0x11')]=function(){this[_0x5368('0x14')]=0x0;this[_0x5368('0x15')]=0x0;for(var _0xa5ce3c=0x0;_0xa5ce3c=0x0?this['available']:0x0;var _0x3fcae0={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x5368('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x57e355=md5(JSON[_0x5368('0x1a')](_0x3fcae0));if(this[_0x5368('0xf')]!==_0x57e355){this[_0x5368('0xf')]=_0x57e355;io['to'](util['format']('sms:queue:%s',_0x3fcae0[_0x5368('0x8')]))[_0x5368('0x1b')](_0x5368('0x1c'),_0x3fcae0);}};module[_0x5368('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 561c45a..4013243 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 _0x9999=['md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9999,0x143));var _0x9999=function(_0x5b51f5,_0x2fbcb2){_0x5b51f5=_0x5b51f5-0x0;var _0x163c49=_0x9999[_0x5b51f5];return _0x163c49;};'use strict';var _=require(_0x9999('0x0'));var md5=require(_0x9999('0x1'));var util=require(_0x9999('0x2'));var Redis=require(_0x9999('0x3'));var config=require(_0x9999('0x4'));config[_0x9999('0x5')]=_['defaults'](config[_0x9999('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9999('0x6'))(new Redis(config[_0x9999('0x5')]));function WhatsappQueue(_0x575638){this['id']=_0x575638['id']||0x0;this[_0x9999('0x7')]=_0x575638[_0x9999('0x7')]||'';this[_0x9999('0x8')]=_0x575638[_0x9999('0x8')]||0xa;this[_0x9999('0x9')]=_0x575638['strategy']||'beepall';this[_0x9999('0xa')]=_0x575638[_0x9999('0xa')];this[_0x9999('0xb')]={};this[_0x9999('0xc')]=0x0;this[_0x9999('0x1')]='';this[_0x9999('0xd')]();this[_0x9999('0xe')]();}WhatsappQueue[_0x9999('0xf')][_0x9999('0xd')]=function(){var _0x4b99da=this[_0x9999('0xb')][_0x9999('0x10')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0x9999('0xb')][_0x9999('0x10')]=_0x4b99da;};WhatsappQueue[_0x9999('0xf')][_0x9999('0xe')]=function(){this[_0x9999('0x11')]=0x0;this[_0x9999('0x12')]=0x0;for(var _0x4066ff=0x0;_0x4066ff=0x0?this['available']:0x0;var _0x311644={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9999('0x11')],'name':this['name'],'paused':this[_0x9999('0x12')],'waiting':this[_0x9999('0xc')]};var _0x55bb15=md5(JSON['stringify'](_0x311644));if(this[_0x9999('0x1')]!==_0x55bb15){this['md5']=_0x55bb15;io['to'](util[_0x9999('0x16')](_0x9999('0x17'),_0x311644['name']))[_0x9999('0x18')](_0x9999('0x19'),_0x311644);}};module[_0x9999('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0x06a4=['updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','whatsappPause','available','paused','name','waiting','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x10903d,_0x468301){var _0x277e7e=function(_0x199879){while(--_0x199879){_0x10903d['push'](_0x10903d['shift']());}};_0x277e7e(++_0x468301);}(_0x06a4,0xa2));var _0x406a=function(_0x447f33,_0x489af1){_0x447f33=_0x447f33-0x0;var _0x4e0bc7=_0x06a4[_0x447f33];return _0x4e0bc7;};'use strict';var _=require('lodash');var md5=require(_0x406a('0x0'));var util=require(_0x406a('0x1'));var Redis=require(_0x406a('0x2'));var config=require(_0x406a('0x3'));config[_0x406a('0x4')]=_[_0x406a('0x5')](config[_0x406a('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x406a('0x6'))(new Redis(config[_0x406a('0x4')]));function WhatsappQueue(_0x2dcf3b){this['id']=_0x2dcf3b['id']||0x0;this['name']=_0x2dcf3b['name']||'';this[_0x406a('0x7')]=_0x2dcf3b['timeout']||0xa;this[_0x406a('0x8')]=_0x2dcf3b[_0x406a('0x8')]||_0x406a('0x9');this[_0x406a('0xa')]=_0x2dcf3b[_0x406a('0xa')];this[_0x406a('0xb')]={};this['waiting']=0x0;this['md5']='';this[_0x406a('0xc')]();this[_0x406a('0xd')]();}WhatsappQueue[_0x406a('0xe')]['updateRouting']=function(){var _0x318302=this[_0x406a('0xb')]['_rr'];this[_0x406a('0xb')]=_[_0x406a('0xf')](this['Agents'],'id');this['mapAgentsId'][_0x406a('0x10')]=_0x318302;};WhatsappQueue[_0x406a('0xe')]['updateRealtime']=function(){this[_0x406a('0x11')]=0x0;this['paused']=0x0;for(var _0x5223e1=0x0;_0x5223e1=0x0?this[_0x406a('0x14')]:0x0;var _0x19991f={'id':this['id'],'available':this[_0x406a('0x14')],'loggedIn':this[_0x406a('0x11')],'name':this[_0x406a('0x16')],'paused':this[_0x406a('0x15')],'waiting':this[_0x406a('0x17')]};var _0x146514=md5(JSON[_0x406a('0x18')](_0x19991f));if(this['md5']!==_0x146514){this[_0x406a('0x0')]=_0x146514;io['to'](util[_0x406a('0x19')](_0x406a('0x1a'),_0x19991f[_0x406a('0x16')]))['emit'](_0x406a('0x1b'),_0x19991f);}};module[_0x406a('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index fbc1a80..2bd9565 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x4ddfb8,_0xd21e5){var _0x27d47d=function(_0x3b5990){while(--_0x3b5990){_0x4ddfb8['push'](_0x4ddfb8['shift']());}};_0x27d47d(++_0xd21e5);}(_0xb10b,0x12a));var _0xbb10=function(_0x3496d3,_0x4467a2){_0x3496d3=_0x3496d3-0x0;var _0x509096=_0xb10b[_0x3496d3];return _0x509096;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 f53b4bd..c6c952b 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 _0x4cdd=['Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x13279c,_0x44d595){var _0x38183f=function(_0x380c81){while(--_0x380c81){_0x13279c['push'](_0x13279c['shift']());}};_0x38183f(++_0x44d595);}(_0x4cdd,0xbc));var _0xd4cd=function(_0x5c43e1,_0x5d3ed4){_0x5c43e1=_0x5c43e1-0x0;var _0x1940cd=_0x4cdd[_0x5c43e1];return _0x1940cd;};'use strict';var client=require('../client');exports['update']=function(_0x5018a8,_0x5d528b){return client[_0xd4cd('0x0')](_0xd4cd('0x1'),{'body':_0x5d528b,'options':{'where':{'id':_0x5018a8}},'log':_0xd4cd('0x2')});};exports[_0xd4cd('0x3')]=function(_0xd0b6fd,_0x146c21){return client['Request']('AddTagsToChatInteraction',{'body':_0x146c21,'options':{'where':{'id':_0xd0b6fd}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x9186=['addTags','AddTagsToChatInteraction','../client','update','updateChatInteraction'];(function(_0x4c2566,_0x497b3f){var _0x33ed83=function(_0x41d47a){while(--_0x41d47a){_0x4c2566['push'](_0x4c2566['shift']());}};_0x33ed83(++_0x497b3f);}(_0x9186,0x9d));var _0x6918=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9186[_0x6cf19c];return _0xce14f3;};'use strict';var client=require(_0x6918('0x0'));exports[_0x6918('0x1')]=function(_0x536081,_0x1f7a57){return client['Request']('UpdateChatInteraction',{'body':_0x1f7a57,'options':{'where':{'id':_0x536081}},'log':_0x6918('0x2')});};exports[_0x6918('0x3')]=function(_0x3930f6,_0x308916){return client['Request'](_0x6918('0x4'),{'body':_0x308916,'options':{'where':{'id':_0x3930f6}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 1687c07..3a6d27b 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 _0x4a2f=['Request','createChatMessage','../client','create'];(function(_0x44e7b6,_0x227953){var _0x325047=function(_0x5ccc8a){while(--_0x5ccc8a){_0x44e7b6['push'](_0x44e7b6['shift']());}};_0x325047(++_0x227953);}(_0x4a2f,0x9a));var _0xf4a2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4a2f[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0xf4a2('0x0'));exports[_0xf4a2('0x1')]=function(_0x55b911){return client[_0xf4a2('0x2')]('CreateChatMessage',{'body':_0x55b911,'log':_0xf4a2('0x3')});}; \ No newline at end of file +var _0xe239=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xe239,0x126));var _0x9e23=function(_0x2c293e,_0x245577){_0x2c293e=_0x2c293e-0x0;var _0x353c63=_0xe239[_0x2c293e];return _0x353c63;};'use strict';var client=require(_0x9e23('0x0'));exports[_0x9e23('0x1')]=function(_0x18ba3d){return client[_0x9e23('0x2')](_0x9e23('0x3'),{'body':_0x18ba3d,'log':_0x9e23('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index c8a28ca..14584a4 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 _0xd4d1=['strategy','Agents','online','../client','getChatQueues','Request','GetChatQueue','name'];(function(_0x231b2e,_0x2a33f9){var _0x3feb2a=function(_0x5aa472){while(--_0x5aa472){_0x231b2e['push'](_0x231b2e['shift']());}};_0x3feb2a(++_0x2a33f9);}(_0xd4d1,0x123));var _0x1d4d=function(_0x333406,_0x315609){_0x333406=_0x333406-0x0;var _0x26c9f1=_0xd4d1[_0x333406];return _0x26c9f1;};'use strict';var client=require(_0x1d4d('0x0'));exports[_0x1d4d('0x1')]=function(){return function(){return client[_0x1d4d('0x2')](_0x1d4d('0x3'),{'options':{'raw':![],'attributes':['id',_0x1d4d('0x4'),'timeout',_0x1d4d('0x5')],'include':[{'model':'User','as':_0x1d4d('0x6'),'attributes':['id','name',_0x1d4d('0x7'),'chatPause']}]},'log':_0x1d4d('0x1')});};}; \ No newline at end of file +var _0x3c7b=['GetChatQueue','name','online','../client','getChatQueues','Request'];(function(_0x2498b5,_0x514ddb){var _0x5c48d8=function(_0xee9bb5){while(--_0xee9bb5){_0x2498b5['push'](_0x2498b5['shift']());}};_0x5c48d8(++_0x514ddb);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x217aab,_0x3aedfa){_0x217aab=_0x217aab-0x0;var _0x4db8e7=_0x3c7b[_0x217aab];return _0x4db8e7;};'use strict';var client=require(_0xb3c7('0x0'));exports[_0xb3c7('0x1')]=function(){return function(){return client[_0xb3c7('0x2')](_0xb3c7('0x3'),{'options':{'raw':![],'attributes':['id',_0xb3c7('0x4'),'timeout','strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0xb3c7('0x4'),_0xb3c7('0x5'),'chatPause']}]},'log':_0xb3c7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index edb5696..b3e94ce 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 _0x279d=['Request','update','UpdateChatQueueReport','DESC','../client','create'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x279d,0x1d8));var _0xd279=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x279d[_0x42bc91];return _0x3f5507;};'use strict';var client=require(_0xd279('0x0'));exports[_0xd279('0x1')]=function(_0x17cebd){return client[_0xd279('0x2')]('CreateChatQueueReport',{'body':_0x17cebd,'log':'CreateChatQueueReport'});};exports[_0xd279('0x3')]=function(_0x44441d,_0x47cfee){return client[_0xd279('0x2')](_0xd279('0x4'),{'body':_0x47cfee,'options':{'where':{'uniqueid':_0x44441d},'order':[['id',_0xd279('0x5')]],'limit':0x1},'log':_0xd279('0x4')});}; \ No newline at end of file +var _0xe77f=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xe77f,0xba));var _0xfe77=function(_0x596f5f,_0x21b8b3){_0x596f5f=_0x596f5f-0x0;var _0x26208b=_0xe77f[_0x596f5f];return _0x26208b;};'use strict';var client=require(_0xfe77('0x0'));exports[_0xfe77('0x1')]=function(_0x53bc15){return client[_0xfe77('0x2')](_0xfe77('0x3'),{'body':_0x53bc15,'log':'CreateChatQueueReport'});};exports[_0xfe77('0x4')]=function(_0xd99b0d,_0x55a414){return client[_0xfe77('0x2')](_0xfe77('0x5'),{'body':_0x55a414,'options':{'where':{'uniqueid':_0xd99b0d},'order':[['id',_0xfe77('0x6')]],'limit':0x1},'log':_0xfe77('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 8b8c761..9bfbf2d 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(_0xaced2d,_0x1f5c83){var _0x25825=function(_0x51e58d){while(--_0x51e58d){_0xaced2d['push'](_0xaced2d['shift']());}};_0x25825(++_0x1f5c83);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x3e0f52,_0x3754e6){var _0xc558fd=function(_0xdebfaf){while(--_0xdebfaf){_0x3e0f52['push'](_0x3e0f52['shift']());}};_0xc558fd(++_0x3754e6);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 1103082..e8ca267 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 _0x54d5=['createFaxMessage','../client','create','CreateFaxMessage'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x54d5,0xa9));var _0x554d=function(_0x52b4eb,_0x3443f2){_0x52b4eb=_0x52b4eb-0x0;var _0x24c089=_0x54d5[_0x52b4eb];return _0x24c089;};'use strict';var client=require(_0x554d('0x0'));exports[_0x554d('0x1')]=function(_0x1d6e06){return client['Request'](_0x554d('0x2'),{'body':_0x1d6e06,'log':_0x554d('0x3')});}; \ No newline at end of file +var _0xb83e=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x1b2422,_0x1e98d4){var _0x376573=function(_0x5db41b){while(--_0x5db41b){_0x1b2422['push'](_0x1b2422['shift']());}};_0x376573(++_0x1e98d4);}(_0xb83e,0x65));var _0xeb83=function(_0xb1ac31,_0xf393fe){_0xb1ac31=_0xb1ac31-0x0;var _0x1d0aa7=_0xb83e[_0xb1ac31];return _0x1d0aa7;};'use strict';var client=require(_0xeb83('0x0'));exports[_0xeb83('0x1')]=function(_0x5d1791){return client[_0xeb83('0x2')](_0xeb83('0x3'),{'body':_0x5d1791,'log':_0xeb83('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 25ec525..471579a 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 _0xabfa=['online','../client','Request','name','timeout','strategy','Agents'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0xabfa,0x8d));var _0xaabf=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0xabfa[_0xdd2bfa];return _0x55397e;};'use strict';var client=require(_0xaabf('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xaabf('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xaabf('0x2'),_0xaabf('0x3'),_0xaabf('0x4')],'include':[{'model':'User','as':_0xaabf('0x5'),'attributes':['id','name',_0xaabf('0x6'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x75d2=['../client','Request','name','strategy','Agents','getFaxQueues'];(function(_0x222f3f,_0x1001af){var _0x48bc70=function(_0x2ee79f){while(--_0x2ee79f){_0x222f3f['push'](_0x222f3f['shift']());}};_0x48bc70(++_0x1001af);}(_0x75d2,0x144));var _0x275d=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x75d2[_0x3635ce];return _0x97ecd0;};'use strict';var client=require(_0x275d('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x275d('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x275d('0x2'),'timeout',_0x275d('0x3')],'include':[{'model':'User','as':_0x275d('0x4'),'attributes':['id',_0x275d('0x2'),'online','faxPause']}]},'log':_0x275d('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 4fbf2c8..0bdc0a2 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 _0x51b0=['Request','CreateFaxQueueReport','DESC'];(function(_0xca7022,_0xad3bd){var _0x1a6bdc=function(_0x2357e5){while(--_0x2357e5){_0xca7022['push'](_0xca7022['shift']());}};_0x1a6bdc(++_0xad3bd);}(_0x51b0,0x81));var _0x051b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x51b0[_0x2dafbe];return _0x58a45a;};'use strict';var client=require('../client');exports['create']=function(_0xb8a31f){return client[_0x051b('0x0')](_0x051b('0x1'),{'body':_0xb8a31f,'log':_0x051b('0x1')});};exports['update']=function(_0x56ecda,_0x39654a){return client[_0x051b('0x0')]('UpdateFaxQueueReport',{'body':_0x39654a,'options':{'where':{'uniqueid':_0x56ecda},'order':[['id',_0x051b('0x2')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x4348=['../client','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC'];(function(_0x4358f5,_0x5b1ac6){var _0x4d8104=function(_0x1d4aee){while(--_0x1d4aee){_0x4358f5['push'](_0x4358f5['shift']());}};_0x4d8104(++_0x5b1ac6);}(_0x4348,0x192));var _0x8434=function(_0x3a63aa,_0x34e2ce){_0x3a63aa=_0x3a63aa-0x0;var _0x4e21b3=_0x4348[_0x3a63aa];return _0x4e21b3;};'use strict';var client=require(_0x8434('0x0'));exports['create']=function(_0x1c3216){return client[_0x8434('0x1')](_0x8434('0x2'),{'body':_0x1c3216,'log':_0x8434('0x2')});};exports[_0x8434('0x3')]=function(_0xfa8aff,_0x267b67){return client['Request'](_0x8434('0x4'),{'body':_0x267b67,'options':{'where':{'uniqueid':_0xfa8aff},'order':[['id',_0x8434('0x5')]],'limit':0x1},'log':_0x8434('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index fb21144..ad34ef1 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 _0x0470=['interval','../client','getIntervals','Request','GetInterval','name','Interval'];(function(_0x3b04f9,_0x54390f){var _0x15f3b7=function(_0x25073f){while(--_0x25073f){_0x3b04f9['push'](_0x3b04f9['shift']());}};_0x15f3b7(++_0x54390f);}(_0x0470,0xa9));var _0x0047=function(_0x1bdd7b,_0x47b6a6){_0x1bdd7b=_0x1bdd7b-0x0;var _0x48af08=_0x0470[_0x1bdd7b];return _0x48af08;};'use strict';var client=require(_0x0047('0x0'));exports[_0x0047('0x1')]=function(){return function(){return client[_0x0047('0x2')](_0x0047('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x0047('0x4')],'include':[{'model':_0x0047('0x5'),'as':'Intervals','attributes':['id',_0x0047('0x4'),_0x0047('0x6')]}]},'log':_0x0047('0x1')});};}; \ No newline at end of file +var _0x1d92=['name','Interval','Intervals','getIntervals','Request','GetInterval'];(function(_0x45d7e4,_0x3cfd36){var _0x7340fa=function(_0x54e5a5){while(--_0x54e5a5){_0x45d7e4['push'](_0x45d7e4['shift']());}};_0x7340fa(++_0x3cfd36);}(_0x1d92,0xf3));var _0x21d9=function(_0x231a42,_0x39f4db){_0x231a42=_0x231a42-0x0;var _0x3c2a56=_0x1d92[_0x231a42];return _0x3c2a56;};'use strict';var client=require('../client');exports[_0x21d9('0x0')]=function(){return function(){return client[_0x21d9('0x1')](_0x21d9('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x21d9('0x3')],'include':[{'model':_0x21d9('0x4'),'as':_0x21d9('0x5'),'attributes':['id','name','interval']}]},'log':_0x21d9('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index c729b89..075ccae 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 _0x68b3=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','updateMailInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68b3,0x1d8));var _0x368b=function(_0x5e0772,_0x10ae35){_0x5e0772=_0x5e0772-0x0;var _0x56df0d=_0x68b3[_0x5e0772];return _0x56df0d;};'use strict';var client=require(_0x368b('0x0'));exports[_0x368b('0x1')]=function(_0x3e8034,_0xa371c){return client[_0x368b('0x2')]('UpdateMailInteraction',{'body':_0xa371c,'options':{'where':{'id':_0x3e8034}},'log':_0x368b('0x3')});};exports[_0x368b('0x4')]=function(_0xc40116,_0x404282){return client['Request'](_0x368b('0x5'),{'body':_0x404282,'options':{'where':{'id':_0xc40116}},'log':_0x368b('0x6')});}; \ No newline at end of file +var _0xaebd=['updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client','Request','UpdateMailInteraction'];(function(_0x4854e1,_0x3fa960){var _0x2c883b=function(_0x10f254){while(--_0x10f254){_0x4854e1['push'](_0x4854e1['shift']());}};_0x2c883b(++_0x3fa960);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x91394b,_0xc4670a){_0x91394b=_0x91394b-0x0;var _0x448acc=_0xaebd[_0x91394b];return _0x448acc;};'use strict';var client=require(_0xdaeb('0x0'));exports['update']=function(_0x2e2d0c,_0xac84fd){return client[_0xdaeb('0x1')](_0xdaeb('0x2'),{'body':_0xac84fd,'options':{'where':{'id':_0x2e2d0c}},'log':_0xdaeb('0x3')});};exports['addTags']=function(_0x44e982,_0x1c617a){return client[_0xdaeb('0x1')](_0xdaeb('0x4'),{'body':_0x1c617a,'options':{'where':{'id':_0x44e982}},'log':_0xdaeb('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 69f79cf..f0e7bc9 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 _0x8885=['createMailMessage','../client','create','Request','CreateMailMessage'];(function(_0x45cbcf,_0xfbdbc2){var _0x52ece8=function(_0x498579){while(--_0x498579){_0x45cbcf['push'](_0x45cbcf['shift']());}};_0x52ece8(++_0xfbdbc2);}(_0x8885,0x1e6));var _0x5888=function(_0x532f5c,_0xc58ebd){_0x532f5c=_0x532f5c-0x0;var _0x11de84=_0x8885[_0x532f5c];return _0x11de84;};'use strict';var client=require(_0x5888('0x0'));exports[_0x5888('0x1')]=function(_0x38cd78){return client[_0x5888('0x2')](_0x5888('0x3'),{'body':_0x38cd78,'log':_0x5888('0x4')});}; \ No newline at end of file +var _0x8a9f=['CreateMailMessage','createMailMessage'];(function(_0x59831f,_0x5154ca){var _0x11f70c=function(_0x3e7adf){while(--_0x3e7adf){_0x59831f['push'](_0x59831f['shift']());}};_0x11f70c(++_0x5154ca);}(_0x8a9f,0xd6));var _0xf8a9=function(_0x38ac0c,_0x5b11ec){_0x38ac0c=_0x38ac0c-0x0;var _0x173e56=_0x8a9f[_0x38ac0c];return _0x173e56;};'use strict';var client=require('../client');exports['create']=function(_0x263b83){return client['Request'](_0xf8a9('0x0'),{'body':_0x263b83,'log':_0xf8a9('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 9188ef1..364e057 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 _0x0247=['Agents','name','online','mailPause','../client','getMailQueues','Request','GetMailQueue','timeout','strategy','User'];(function(_0x1e6b59,_0x5eca5d){var _0x40d7c5=function(_0x2dd544){while(--_0x2dd544){_0x1e6b59['push'](_0x1e6b59['shift']());}};_0x40d7c5(++_0x5eca5d);}(_0x0247,0x9e));var _0x7024=function(_0x13b753,_0x4ff548){_0x13b753=_0x13b753-0x0;var _0x449c32=_0x0247[_0x13b753];return _0x449c32;};'use strict';var client=require(_0x7024('0x0'));exports[_0x7024('0x1')]=function(){return function(){return client[_0x7024('0x2')](_0x7024('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x7024('0x4'),_0x7024('0x5')],'include':[{'model':_0x7024('0x6'),'as':_0x7024('0x7'),'attributes':['id',_0x7024('0x8'),_0x7024('0x9'),_0x7024('0xa')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x6daf=['GetMailQueue','timeout','User','name','online','../client','getMailQueues','Request'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x6daf,0x115));var _0xf6da=function(_0x5c302e,_0x155d61){_0x5c302e=_0x5c302e-0x0;var _0x30cb39=_0x6daf[_0x5c302e];return _0x30cb39;};'use strict';var client=require(_0xf6da('0x0'));exports[_0xf6da('0x1')]=function(){return function(){return client[_0xf6da('0x2')](_0xf6da('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xf6da('0x4'),'strategy'],'include':[{'model':_0xf6da('0x5'),'as':'Agents','attributes':['id',_0xf6da('0x6'),_0xf6da('0x7'),'mailPause']}]},'log':_0xf6da('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 31c87cc..42a25b3 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 _0x7a22=['../client','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0xda99d6,_0x5d0efa){var _0x4d8540=function(_0x5e2e94){while(--_0x5e2e94){_0xda99d6['push'](_0xda99d6['shift']());}};_0x4d8540(++_0x5d0efa);}(_0x7a22,0x78));var _0x27a2=function(_0x4218e7,_0xd36b17){_0x4218e7=_0x4218e7-0x0;var _0x1b84dc=_0x7a22[_0x4218e7];return _0x1b84dc;};'use strict';var client=require(_0x27a2('0x0'));exports['create']=function(_0x53f747){return client[_0x27a2('0x1')](_0x27a2('0x2'),{'body':_0x53f747,'log':_0x27a2('0x2')});};exports[_0x27a2('0x3')]=function(_0x3a3a64,_0x107f94){return client[_0x27a2('0x1')](_0x27a2('0x4'),{'body':_0x107f94,'options':{'where':{'uniqueid':_0x3a3a64},'order':[['id',_0x27a2('0x5')]],'limit':0x1},'log':_0x27a2('0x4')});}; \ No newline at end of file +var _0xab04=['../client','CreateMailQueueReport','update','Request','UpdateMailQueueReport'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xab04,0x190));var _0x4ab0=function(_0x4b92b9,_0x1bd47d){_0x4b92b9=_0x4b92b9-0x0;var _0x157b9d=_0xab04[_0x4b92b9];return _0x157b9d;};'use strict';var client=require(_0x4ab0('0x0'));exports['create']=function(_0x4450db){return client['Request'](_0x4ab0('0x1'),{'body':_0x4450db,'log':_0x4ab0('0x1')});};exports[_0x4ab0('0x2')]=function(_0x577dce,_0xb7dc08){return client[_0x4ab0('0x3')](_0x4ab0('0x4'),{'body':_0xb7dc08,'options':{'where':{'uniqueid':_0x577dce},'order':[['id','DESC']],'limit':0x1},'log':_0x4ab0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 1d693c8..2908c0e 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 _0x563f=['updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update','Request'];(function(_0x2dd324,_0x2d0881){var _0x33bc5c=function(_0x4bcbc7){while(--_0x4bcbc7){_0x2dd324['push'](_0x2dd324['shift']());}};_0x33bc5c(++_0x2d0881);}(_0x563f,0x80));var _0xf563=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x563f[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require('../client');exports[_0xf563('0x0')]=function(_0x2c8067,_0x242374){return client[_0xf563('0x1')]('UpdateOpenchannelInteraction',{'body':_0x242374,'options':{'where':{'id':_0x2c8067}},'log':_0xf563('0x2')});};exports['addTags']=function(_0x192ffe,_0x12ce62){return client[_0xf563('0x1')](_0xf563('0x3'),{'body':_0x12ce62,'options':{'where':{'id':_0x192ffe}},'log':_0xf563('0x4')});}; \ No newline at end of file +var _0xadae=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x447be7,_0x1d56bf){var _0x8eb0fb=function(_0x5b2a94){while(--_0x5b2a94){_0x447be7['push'](_0x447be7['shift']());}};_0x8eb0fb(++_0x1d56bf);}(_0xadae,0xf5));var _0xeada=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xadae[_0x484e36];return _0xafc85d;};'use strict';var client=require(_0xeada('0x0'));exports[_0xeada('0x1')]=function(_0x28158e,_0x4bb7be){return client[_0xeada('0x2')](_0xeada('0x3'),{'body':_0x4bb7be,'options':{'where':{'id':_0x28158e}},'log':_0xeada('0x4')});};exports[_0xeada('0x5')]=function(_0x409494,_0x1b6505){return client[_0xeada('0x2')](_0xeada('0x6'),{'body':_0x1b6505,'options':{'where':{'id':_0x409494}},'log':_0xeada('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index a38ecc4..abee211 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 _0x0d3d=['Request','createOpenchannelMessage','../client'];(function(_0x40be86,_0x68fe5d){var _0xda3c3b=function(_0x39deab){while(--_0x39deab){_0x40be86['push'](_0x40be86['shift']());}};_0xda3c3b(++_0x68fe5d);}(_0x0d3d,0x1d6));var _0xd0d3=function(_0x5c223b,_0x32dd8d){_0x5c223b=_0x5c223b-0x0;var _0x5738ed=_0x0d3d[_0x5c223b];return _0x5738ed;};'use strict';var client=require(_0xd0d3('0x0'));exports['create']=function(_0x176d09){return client[_0xd0d3('0x1')]('CreateOpenchannelMessage',{'body':_0x176d09,'log':_0xd0d3('0x2')});}; \ No newline at end of file +var _0x94e4=['create','Request','createOpenchannelMessage','../client'];(function(_0x54fbff,_0x53470e){var _0x5cf619=function(_0x28765b){while(--_0x28765b){_0x54fbff['push'](_0x54fbff['shift']());}};_0x5cf619(++_0x53470e);}(_0x94e4,0x113));var _0x494e=function(_0x3f1cd0,_0x35c8bf){_0x3f1cd0=_0x3f1cd0-0x0;var _0x2fe5be=_0x94e4[_0x3f1cd0];return _0x2fe5be;};'use strict';var client=require(_0x494e('0x0'));exports[_0x494e('0x1')]=function(_0x3e8b39){return client[_0x494e('0x2')]('CreateOpenchannelMessage',{'body':_0x3e8b39,'log':_0x494e('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 1dccb90..9696744 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 _0xeef4=['GetOpenchannelQueue','name','timeout','strategy','User','online','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0xf9604b,_0x41bc48){var _0x381b67=function(_0xd87b39){while(--_0xd87b39){_0xf9604b['push'](_0xf9604b['shift']());}};_0x381b67(++_0x41bc48);}(_0xeef4,0x7f));var _0x4eef=function(_0x324e86,_0x81b1cb){_0x324e86=_0x324e86-0x0;var _0x592846=_0xeef4[_0x324e86];return _0x592846;};'use strict';var client=require(_0x4eef('0x0'));exports[_0x4eef('0x1')]=function(){return function(){return client[_0x4eef('0x2')](_0x4eef('0x3'),{'options':{'raw':![],'attributes':['id',_0x4eef('0x4'),_0x4eef('0x5'),_0x4eef('0x6')],'include':[{'model':_0x4eef('0x7'),'as':'Agents','attributes':['id',_0x4eef('0x4'),_0x4eef('0x8'),_0x4eef('0x9')]}]},'log':_0x4eef('0x1')});};}; \ No newline at end of file +var _0xcc8c=['timeout','strategy','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name'];(function(_0x4bd520,_0x39c011){var _0x378bc7=function(_0x34e1c2){while(--_0x34e1c2){_0x4bd520['push'](_0x4bd520['shift']());}};_0x378bc7(++_0x39c011);}(_0xcc8c,0x151));var _0xccc8=function(_0x5d1c9d,_0x8bb82d){_0x5d1c9d=_0x5d1c9d-0x0;var _0x8edfe4=_0xcc8c[_0x5d1c9d];return _0x8edfe4;};'use strict';var client=require(_0xccc8('0x0'));exports[_0xccc8('0x1')]=function(){return function(){return client[_0xccc8('0x2')](_0xccc8('0x3'),{'options':{'raw':![],'attributes':['id',_0xccc8('0x4'),_0xccc8('0x5'),_0xccc8('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xccc8('0x4'),_0xccc8('0x7'),_0xccc8('0x8')]}]},'log':_0xccc8('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index e53fb66..f05c086 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 _0x9d46=['DESC','UpdateOpenchannelQueueReport','../client','create','Request','CreateOpenchannelQueueReport'];(function(_0x24700a,_0x1fce64){var _0x50d5f8=function(_0xde414f){while(--_0xde414f){_0x24700a['push'](_0x24700a['shift']());}};_0x50d5f8(++_0x1fce64);}(_0x9d46,0x1f4));var _0x69d4=function(_0x3de600,_0x3c9ec5){_0x3de600=_0x3de600-0x0;var _0x9dae89=_0x9d46[_0x3de600];return _0x9dae89;};'use strict';var client=require(_0x69d4('0x0'));exports[_0x69d4('0x1')]=function(_0xd48d8f){return client[_0x69d4('0x2')](_0x69d4('0x3'),{'body':_0xd48d8f,'log':_0x69d4('0x3')});};exports['update']=function(_0x43a9d3,_0x402d59){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x402d59,'options':{'where':{'uniqueid':_0x43a9d3},'order':[['id',_0x69d4('0x4')]],'limit':0x1},'log':_0x69d4('0x5')});}; \ No newline at end of file +var _0x2eda=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x296588,_0x49f98d){var _0x2f6d92=function(_0x3f424c){while(--_0x3f424c){_0x296588['push'](_0x296588['shift']());}};_0x2f6d92(++_0x49f98d);}(_0x2eda,0x9f));var _0xa2ed=function(_0x25baa8,_0x4b7337){_0x25baa8=_0x25baa8-0x0;var _0x5c63e2=_0x2eda[_0x25baa8];return _0x5c63e2;};'use strict';var client=require(_0xa2ed('0x0'));exports[_0xa2ed('0x1')]=function(_0x2af866){return client[_0xa2ed('0x2')]('CreateOpenchannelQueueReport',{'body':_0x2af866,'log':_0xa2ed('0x3')});};exports[_0xa2ed('0x4')]=function(_0x5917f8,_0x2d0802){return client[_0xa2ed('0x2')](_0xa2ed('0x5'),{'body':_0x2d0802,'options':{'where':{'uniqueid':_0x5917f8},'order':[['id',_0xa2ed('0x6')]],'limit':0x1},'log':_0xa2ed('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index b1d563e..a3381bb 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 _0x17ba=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x2a812a,_0x484887){var _0x15a205=function(_0x597afc){while(--_0x597afc){_0x2a812a['push'](_0x2a812a['shift']());}};_0x15a205(++_0x484887);}(_0x17ba,0xab));var _0xa17b=function(_0x48e28e,_0x3cf0b6){_0x48e28e=_0x48e28e-0x0;var _0x2fe166=_0x17ba[_0x48e28e];return _0x2fe166;};'use strict';var client=require(_0xa17b('0x0'));exports[_0xa17b('0x1')]=function(_0x4a2032,_0x2ce1c0){return client[_0xa17b('0x2')](_0xa17b('0x3'),{'body':_0x2ce1c0,'options':{'where':{'id':_0x4a2032}},'log':_0xa17b('0x4')});};exports[_0xa17b('0x5')]=function(_0x38c13c,_0x11d7b7){return client[_0xa17b('0x2')](_0xa17b('0x6'),{'body':_0x11d7b7,'options':{'where':{'id':_0x38c13c}},'log':_0xa17b('0x7')});}; \ No newline at end of file +var _0xe14f=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x9f94ac,_0x1e8711){var _0x5da50d=function(_0x5016de){while(--_0x5016de){_0x9f94ac['push'](_0x9f94ac['shift']());}};_0x5da50d(++_0x1e8711);}(_0xe14f,0xea));var _0xfe14=function(_0x319969,_0x201b0e){_0x319969=_0x319969-0x0;var _0x5de8b4=_0xe14f[_0x319969];return _0x5de8b4;};'use strict';var client=require(_0xfe14('0x0'));exports[_0xfe14('0x1')]=function(_0x33ee9b,_0x2d348b){return client[_0xfe14('0x2')](_0xfe14('0x3'),{'body':_0x2d348b,'options':{'where':{'id':_0x33ee9b}},'log':_0xfe14('0x4')});};exports[_0xfe14('0x5')]=function(_0x2b7784,_0x4b7546){return client['Request'](_0xfe14('0x6'),{'body':_0x4b7546,'options':{'where':{'id':_0x2b7784}},'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 9971b15..7392474 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 _0x8529=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x3f92ac,_0x43c39b){var _0x510f87=function(_0x4409c6){while(--_0x4409c6){_0x3f92ac['push'](_0x3f92ac['shift']());}};_0x510f87(++_0x43c39b);}(_0x8529,0x18b));var _0x9852=function(_0x385a58,_0x127519){_0x385a58=_0x385a58-0x0;var _0x38adb8=_0x8529[_0x385a58];return _0x38adb8;};'use strict';var client=require(_0x9852('0x0'));exports[_0x9852('0x1')]=function(_0x529d3e){return client[_0x9852('0x2')](_0x9852('0x3'),{'body':_0x529d3e,'log':_0x9852('0x4')});}; \ No newline at end of file +var _0x4542=['../client','CreateSmsMessage','createSmsMessage'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0x4542,0xab));var _0x2454=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4542[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x2454('0x0'));exports['create']=function(_0x1278aa){return client['Request'](_0x2454('0x1'),{'body':_0x1278aa,'log':_0x2454('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index aee1305..d6c4462 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x1b9d8f,_0x33627a){var _0x2fd97d=function(_0x1eb2bf){while(--_0x1eb2bf){_0x1b9d8f['push'](_0x1b9d8f['shift']());}};_0x2fd97d(++_0x33627a);}(_0xe706,0xa3));var _0x6e70=function(_0x1b8c71,_0x41d8ab){_0x1b8c71=_0x1b8c71-0x0;var _0x539905=_0xe706[_0x1b8c71];return _0x539905;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x2564e6,_0x467065){var _0x39be09=function(_0x121570){while(--_0x121570){_0x2564e6['push'](_0x2564e6['shift']());}};_0x39be09(++_0x467065);}(_0x70e0,0x17b));var _0x070e=function(_0x58ed6d,_0x4d9e18){_0x58ed6d=_0x58ed6d-0x0;var _0x38c689=_0x70e0[_0x58ed6d];return _0x38c689;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 44317cb..bd146e4 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x377c15,_0x57a61e){var _0x528cfe=function(_0x459b47){while(--_0x459b47){_0x377c15['push'](_0x377c15['shift']());}};_0x528cfe(++_0x57a61e);}(_0x34e8,0x12c));var _0x834e=function(_0x32d8e9,_0x3b9788){_0x32d8e9=_0x32d8e9-0x0;var _0x518e11=_0x34e8[_0x32d8e9];return _0x518e11;};'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 +var _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0xf14e07,_0x3a39ba){var _0x8f7e61=function(_0x4658df){while(--_0x4658df){_0xf14e07['push'](_0xf14e07['shift']());}};_0x8f7e61(++_0x3a39ba);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var client=require('../client');exports['create']=function(_0x1ffbbf){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'body':_0x1ffbbf,'log':_0x49c4('0x1')});};exports[_0x49c4('0x2')]=function(_0x2ad237,_0x4e0313){return client['Request'](_0x49c4('0x3'),{'body':_0x4e0313,'options':{'where':{'uniqueid':_0x2ad237},'order':[['id','DESC']],'limit':0x1},'log':_0x49c4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index cdeb706..a2f5e44 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(_0x2c1ae3,_0x36d82e){var _0x26f84f=function(_0x57e90d){while(--_0x57e90d){_0x2c1ae3['push'](_0x2c1ae3['shift']());}};_0x26f84f(++_0x36d82e);}(_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 +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x36a4e5,_0xe2199){var _0x39c2b1=function(_0x1d07f7){while(--_0x1d07f7){_0x36a4e5['push'](_0x36a4e5['shift']());}};_0x39c2b1(++_0xe2199);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 3d09cf7..fb3b1d6 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 _0x9bd9=['../client','update','Request','UpdateWhatsappInteraction','addTags','addTagsToWhatsappInteraction'];(function(_0x4f1da5,_0x4ced17){var _0xe972a8=function(_0x278ba3){while(--_0x278ba3){_0x4f1da5['push'](_0x4f1da5['shift']());}};_0xe972a8(++_0x4ced17);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x31880d,_0x4f0ff3){_0x31880d=_0x31880d-0x0;var _0x423823=_0x9bd9[_0x31880d];return _0x423823;};'use strict';var client=require(_0x99bd('0x0'));exports[_0x99bd('0x1')]=function(_0x2a3101,_0x3ed553){return client[_0x99bd('0x2')](_0x99bd('0x3'),{'body':_0x3ed553,'options':{'where':{'id':_0x2a3101}},'log':'updateWhatsappInteraction'});};exports[_0x99bd('0x4')]=function(_0x4a0491,_0x204fbb){return client[_0x99bd('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x204fbb,'options':{'where':{'id':_0x4a0491}},'log':_0x99bd('0x5')});}; \ No newline at end of file +var _0x2525=['../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x5c4223,_0x5a7575){var _0x31bf03=function(_0x17810d){while(--_0x17810d){_0x5c4223['push'](_0x5c4223['shift']());}};_0x31bf03(++_0x5a7575);}(_0x2525,0x1f0));var _0x5252=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x2525[_0x42f009];return _0x22a1e0;};'use strict';var client=require(_0x5252('0x0'));exports[_0x5252('0x1')]=function(_0x5de98b,_0x166a72){return client[_0x5252('0x2')](_0x5252('0x3'),{'body':_0x166a72,'options':{'where':{'id':_0x5de98b}},'log':_0x5252('0x4')});};exports[_0x5252('0x5')]=function(_0x28efdd,_0x4907eb){return client['Request'](_0x5252('0x6'),{'body':_0x4907eb,'options':{'where':{'id':_0x28efdd}},'log':_0x5252('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index f63021f..e74b0e1 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 _0x92fb=['CreateWhatsappMessage','createWhatsappMessage','create','Request'];(function(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0x92fb,0xa6));var _0xb92f=function(_0x14c696,_0x43e421){_0x14c696=_0x14c696-0x0;var _0x39d58e=_0x92fb[_0x14c696];return _0x39d58e;};'use strict';var client=require('../client');exports[_0xb92f('0x0')]=function(_0x5f13d4){return client[_0xb92f('0x1')](_0xb92f('0x2'),{'body':_0x5f13d4,'log':_0xb92f('0x3')});}; \ No newline at end of file +var _0x59ee=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x437ae5,_0xb4cd0){var _0x11580c=function(_0x47a594){while(--_0x47a594){_0x437ae5['push'](_0x437ae5['shift']());}};_0x11580c(++_0xb4cd0);}(_0x59ee,0x79));var _0xe59e=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0x59ee[_0x149083];return _0x4dc74e;};'use strict';var client=require(_0xe59e('0x0'));exports[_0xe59e('0x1')]=function(_0x311470){return client[_0xe59e('0x2')](_0xe59e('0x3'),{'body':_0x311470,'log':_0xe59e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 3ed750a..4afc11c 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 _0x8d3b=['Agents','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy'];(function(_0x456a84,_0x3454d8){var _0x276eee=function(_0x56f5a1){while(--_0x56f5a1){_0x456a84['push'](_0x456a84['shift']());}};_0x276eee(++_0x3454d8);}(_0x8d3b,0xec));var _0xb8d3=function(_0x2ca0f4,_0x2ac047){_0x2ca0f4=_0x2ca0f4-0x0;var _0x52b579=_0x8d3b[_0x2ca0f4];return _0x52b579;};'use strict';var client=require(_0xb8d3('0x0'));exports[_0xb8d3('0x1')]=function(){return function(){return client[_0xb8d3('0x2')](_0xb8d3('0x3'),{'options':{'raw':![],'attributes':['id',_0xb8d3('0x4'),_0xb8d3('0x5'),_0xb8d3('0x6')],'include':[{'model':'User','as':_0xb8d3('0x7'),'attributes':['id','name','online',_0xb8d3('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x1edb=['Agents','name','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout','strategy'];(function(_0x44521d,_0x49d605){var _0x38ecf2=function(_0xa505f9){while(--_0xa505f9){_0x44521d['push'](_0x44521d['shift']());}};_0x38ecf2(++_0x49d605);}(_0x1edb,0x1e0));var _0xb1ed=function(_0x25487d,_0x2235a4){_0x25487d=_0x25487d-0x0;var _0x581ee4=_0x1edb[_0x25487d];return _0x581ee4;};'use strict';var client=require(_0xb1ed('0x0'));exports[_0xb1ed('0x1')]=function(){return function(){return client[_0xb1ed('0x2')](_0xb1ed('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xb1ed('0x4'),_0xb1ed('0x5')],'include':[{'model':'User','as':_0xb1ed('0x6'),'attributes':['id',_0xb1ed('0x7'),'online',_0xb1ed('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 33cee9c..6d4c19e 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 _0xddf9=['update','UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xddf9,0xa4));var _0x9ddf=function(_0x14a62c,_0x5c77e1){_0x14a62c=_0x14a62c-0x0;var _0x5bab14=_0xddf9[_0x14a62c];return _0x5bab14;};'use strict';var client=require(_0x9ddf('0x0'));exports[_0x9ddf('0x1')]=function(_0x1a2be9){return client[_0x9ddf('0x2')](_0x9ddf('0x3'),{'body':_0x1a2be9,'log':'CreateWhatsappQueueReport'});};exports[_0x9ddf('0x4')]=function(_0x4d46e6,_0x20e5b6){return client[_0x9ddf('0x2')](_0x9ddf('0x5'),{'body':_0x20e5b6,'options':{'where':{'uniqueid':_0x4d46e6},'order':[['id',_0x9ddf('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x63e7=['UpdateWhatsappQueueReport','DESC','../client','Request','CreateWhatsappQueueReport','update'];(function(_0x10401b,_0x10034d){var _0x56692f=function(_0x2d9270){while(--_0x2d9270){_0x10401b['push'](_0x10401b['shift']());}};_0x56692f(++_0x10034d);}(_0x63e7,0xb6));var _0x763e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x63e7[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x763e('0x0'));exports['create']=function(_0x332881){return client[_0x763e('0x1')](_0x763e('0x2'),{'body':_0x332881,'log':'CreateWhatsappQueueReport'});};exports[_0x763e('0x3')]=function(_0x2d5202,_0x34a1cb){return client['Request'](_0x763e('0x4'),{'body':_0x34a1cb,'options':{'where':{'uniqueid':_0x2d5202},'order':[['id',_0x763e('0x5')]],'limit':0x1},'log':_0x763e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 741e816..99ec02f 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 _0xeaac=['[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format'];(function(_0x1467b2,_0x401029){var _0x303b0f=function(_0x60b5d3){while(--_0x60b5d3){_0x1467b2['push'](_0x1467b2['shift']());}};_0x303b0f(++_0x401029);}(_0xeaac,0x1bb));var _0xceaa=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xeaac[_0x550d12];return _0x12103d;};'use strict';var schema=require(_0xceaa('0x0'));var _=require(_0xceaa('0x1'));var util=require(_0xceaa('0x2'));var seqqueue=require(_0xceaa('0x3'));var logger=require(_0xceaa('0x4'))(_0xceaa('0x5'));var strategy=require(_0xceaa('0x6'));var queue=schema({'name':{'type':_0xceaa('0x7'),'required':!![],'message':_0xceaa('0x8')},'timeout':{'type':_0xceaa('0x9'),'message':_0xceaa('0xa')}});function writeLog(_0x5f3eb1,_0x34eed5,_0x274ccd){return logger[_0xceaa('0xb')](util[_0xceaa('0xc')](_0xceaa('0xd'),_0x5f3eb1,_0x34eed5[_0xceaa('0xe')],_0x274ccd));}function handleFindAgent(_0x5bf345){return function(_0xa9ca22){return _0xa9ca22[_0xceaa('0xe')][_0xceaa('0xf')]()===_0x5bf345[_0xceaa('0xf')]();};}exports[_0xceaa('0x10')]=function(_0x5ea124,_0x2dc58a,_0x4da6ef,_0x392740){return function(_0x1f149a){try{var _0x18a6f2={'name':_0x2dc58a[0x0],'timeout':_0x2dc58a[0x1]};var _0x18dcc9=queue['validate'](_0x18a6f2,{'typecast':!![]});if(_0x18dcc9['length']){logger[_0xceaa('0x11')](_0xceaa('0x12'),_0x5ea124,_[_0xceaa('0x13')](_0x18dcc9,_0xceaa('0x14'))[_0xceaa('0x15')](',\x20'));_0x1f149a[_0xceaa('0x16')]();}else{var _0x1d5601=_['find'](_0x4da6ef[_0xceaa('0x17')],handleFindAgent(_0x18a6f2[_0xceaa('0xe')]));if(_0x1d5601){var _0x48abed=(_0x18a6f2[_0xceaa('0x18')]||0xa)*0x3e8;var _0x11de4c,_0x4e3850;var _0x3aba56=seqqueue[_0xceaa('0x19')](_0x48abed);_0x3aba56['id']=_0x5ea124;_0x3aba56['atimeout']=_0x48abed;_0x3aba56[_0xceaa('0x1a')]=_0x392740['channel'];writeLog(_0x5ea124,_0x1d5601,util['format'](_0xceaa('0x1b'),_0x48abed));_0x4da6ef[_0xceaa('0x1c')][_0x5ea124]['on'](_0xceaa('0x1d'),function(){logger['info'](_0xceaa('0x1e'),_0x5ea124);clearTimeout(_0x4e3850);_0x4e3850=undefined;_0x3aba56['close']();if(_0x4da6ef['rules'][_0x5ea124]){delete _0x4da6ef[_0xceaa('0x1c')][_0x5ea124];}_0x1f149a[_0xceaa('0x16')]();});_0x4da6ef[_0xceaa('0x1c')][_0x5ea124]['on'](_0xceaa('0x1f'),function(){if(_0x4da6ef[_0xceaa('0x1c')][_0x5ea124]){delete _0x4da6ef[_0xceaa('0x1c')][_0x5ea124];}});_0x4e3850=setTimeout(function(){logger[_0xceaa('0xb')](_0xceaa('0x20'),_0x5ea124);clearTimeout(_0x4e3850);_0x3aba56['close']();_0x1f149a['next']();},_0x48abed);strategy[_0xceaa('0x21')](_0x3aba56,_0x1d5601,_0x4da6ef,_0x392740);}else{logger[_0xceaa('0x11')](_0xceaa('0x22'),_0x5ea124,_0x18a6f2['name']);_0x1f149a['stop']();}}}catch(_0x3201a1){console[_0xceaa('0x23')](_0x3201a1);logger[_0xceaa('0x11')](_0xceaa('0x24'),_0x5ea124,_0x3201a1[_0xceaa('0x25')]);_0x1f149a[_0xceaa('0x16')]();}};}; \ No newline at end of file +var _0xe80c=['format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info'];(function(_0x255a3a,_0x544c15){var _0x5b8bc1=function(_0x5f2724){while(--_0x5f2724){_0x255a3a['push'](_0x255a3a['shift']());}};_0x5b8bc1(++_0x544c15);}(_0xe80c,0x117));var _0xce80=function(_0x4ec497,_0x48fb4c){_0x4ec497=_0x4ec497-0x0;var _0x4c1990=_0xe80c[_0x4ec497];return _0x4c1990;};'use strict';var schema=require(_0xce80('0x0'));var _=require(_0xce80('0x1'));var util=require(_0xce80('0x2'));var seqqueue=require(_0xce80('0x3'));var logger=require('../../../../config/logger')(_0xce80('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0xce80('0x5'),'required':!![],'message':_0xce80('0x6')},'timeout':{'type':'number','message':_0xce80('0x7')}});function writeLog(_0x24e808,_0x2d23e1,_0x3b31e5){return logger[_0xce80('0x8')](util[_0xce80('0x9')](_0xce80('0xa'),_0x24e808,_0x2d23e1[_0xce80('0xb')],_0x3b31e5));}function handleFindAgent(_0x67096d){return function(_0x23e6e7){return _0x23e6e7[_0xce80('0xb')][_0xce80('0xc')]()===_0x67096d[_0xce80('0xc')]();};}exports[_0xce80('0xd')]=function(_0x3557b3,_0x3431af,_0x1a28c2,_0x27af9a){return function(_0x4a16ac){try{var _0x974d6c={'name':_0x3431af[0x0],'timeout':_0x3431af[0x1]};var _0x3f06d8=queue[_0xce80('0x0')](_0x974d6c,{'typecast':!![]});if(_0x3f06d8['length']){logger['error'](_0xce80('0xe'),_0x3557b3,_[_0xce80('0xf')](_0x3f06d8,_0xce80('0x10'))[_0xce80('0x11')](',\x20'));_0x4a16ac[_0xce80('0x12')]();}else{var _0x24702=_[_0xce80('0x13')](_0x1a28c2[_0xce80('0x14')],handleFindAgent(_0x974d6c[_0xce80('0xb')]));if(_0x24702){var _0x1ab057=(_0x974d6c[_0xce80('0x15')]||0xa)*0x3e8;var _0x416de6,_0x125d87;var _0x68f8fb=seqqueue[_0xce80('0x16')](_0x1ab057);_0x68f8fb['id']=_0x3557b3;_0x68f8fb['atimeout']=_0x1ab057;_0x68f8fb[_0xce80('0x17')]=_0x27af9a[_0xce80('0x17')];writeLog(_0x3557b3,_0x24702,util[_0xce80('0x9')](_0xce80('0x18'),_0x1ab057));_0x1a28c2[_0xce80('0x19')][_0x3557b3]['on'](_0xce80('0x1a'),function(){logger[_0xce80('0x8')](_0xce80('0x1b'),_0x3557b3);clearTimeout(_0x125d87);_0x125d87=undefined;_0x68f8fb[_0xce80('0x1c')]();if(_0x1a28c2[_0xce80('0x19')][_0x3557b3]){delete _0x1a28c2[_0xce80('0x19')][_0x3557b3];}_0x4a16ac[_0xce80('0x12')]();});_0x1a28c2[_0xce80('0x19')][_0x3557b3]['on'](_0xce80('0x1d'),function(){if(_0x1a28c2[_0xce80('0x19')][_0x3557b3]){delete _0x1a28c2[_0xce80('0x19')][_0x3557b3];}});_0x125d87=setTimeout(function(){logger[_0xce80('0x8')](_0xce80('0x1e'),_0x3557b3);clearTimeout(_0x125d87);_0x68f8fb[_0xce80('0x1c')]();_0x4a16ac['next']();},_0x1ab057);strategy[_0xce80('0x1f')](_0x68f8fb,_0x24702,_0x1a28c2,_0x27af9a);}else{logger[_0xce80('0x20')](_0xce80('0x21'),_0x3557b3,_0x974d6c['name']);_0x4a16ac['stop']();}}}catch(_0x8193dc){console[_0xce80('0x22')](_0x8193dc);logger[_0xce80('0x20')](_0xce80('0x23'),_0x3557b3,_0x8193dc['stack']);_0x4a16ac[_0xce80('0x12')]();}};}; \ 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 7bc96d0..bf8f89a 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 _0x025c=['YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','chat','account','upperFirst','AccountId','created','isEmpty','Message','create','body','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','$LATEST','toString','postText','error','message','amazonlex','providerName','providerResponse','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format'];(function(_0x5ba54c,_0x2452ca){var _0x583f3a=function(_0x42a526){while(--_0x42a526){_0x5ba54c['push'](_0x5ba54c['shift']());}};_0x583f3a(++_0x2452ca);}(_0x025c,0x165));var _0xc025=function(_0x2b91de,_0x57d534){_0x2b91de=_0x2b91de-0x0;var _0x3f09a0=_0x025c[_0x2b91de];return _0x3f09a0;};'use strict';var _=require(_0xc025('0x0'));var moment=require(_0xc025('0x1'));var AWS=require(_0xc025('0x2'));var utils=require(_0xc025('0x3'));var logger=require(_0xc025('0x4'))(_0xc025('0x5'));var rpc={'chatMessage':require(_0xc025('0x6')),'openchannelMessage':require(_0xc025('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc025('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xc025('0x9')]=function(_0x326896,_0x2117a7){return function(_0x453e79){try{if(!_[_0xc025('0xa')](this[_0xc025('0xb')][_0xc025('0xc')])){logger[_0xc025('0xd')](_0xc025('0xe'),_0x326896,_0xc025('0xf'));return _0x453e79[_0xc025('0x10')]();}var _0x20aa2c={'ContactId':this[_0xc025('0x11')]['id'],'sentAt':moment()[_0xc025('0x12')](_0xc025('0x13')),'direction':_0xc025('0x14')};if(this[_0xc025('0x15')]===_0xc025('0x16')||this[_0xc025('0x15')]===_0xc025('0x17')){_0x20aa2c['phone']=this[_0xc025('0xb')]['phone'];}var _0x2b4929=this[_0xc025('0x15')];if(_0x2b4929===_0xc025('0x18')){_0x20aa2c['ChatWebsiteId']=this[_0xc025('0x19')]['id'];}else{_0x20aa2c[_[_0xc025('0x1a')](_0x2b4929)+_0xc025('0x1b')]=this[_0xc025('0x19')]['id'];}_0x20aa2c[_[_0xc025('0x1a')](_0x2b4929)+'InteractionId']=this['interaction']['id'];if(this[_0xc025('0xb')][_0xc025('0x1c')]){var _0x3c8a79=_0x2117a7[0x4];if(!_[_0xc025('0x1d')](_0x3c8a79)){_0x20aa2c['body']=utils['getMustacheRender'](_0x3c8a79,this);return rpc[_0x2b4929+_0xc025('0x1e')][_0xc025('0x1f')](_0x20aa2c)['then'](function(_0x3efb9f){logger['info']('[%s][AMAZONLEX]\x20%s',_0x326896,_0x20aa2c[_0xc025('0x20')]);})['catch'](function(_0x5a1f85){logger['error'](_0xc025('0xe'),_0x326896,JSON[_0xc025('0x21')](_0x5a1f85));})[_0xc025('0x22')](function(){logger[_0xc025('0xd')](_0xc025('0x23'),_0x326896);_0x453e79[_0xc025('0x24')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x326896);_0x453e79[_0xc025('0x24')]();}}else{var _0x236bfe=this;var _0x4a4cd3=new AWS['LexRuntime']({'accessKeyId':_0x2117a7[0x0],'secretAccessKey':_0x2117a7[0x1],'region':_0x2117a7[0x2]});var _0x2fb74d={'botAlias':_0xc025('0x25'),'botName':_0x2117a7[0x3],'inputText':this['message'][_0xc025('0x20')],'userId':this[_0xc025('0x15')]+':'+this['interaction']['id'][_0xc025('0x26')]()};_0x4a4cd3[_0xc025('0x27')](_0x2fb74d,function(_0x3ededa,_0x3777ef){if(_0x3ededa){logger[_0xc025('0x28')]('[%s][AMAZONLEX]\x20%s',_0x326896,_0x3ededa['message']);_0x453e79[_0xc025('0x10')]();}else if(_0x3777ef&&_0x3777ef[_0xc025('0x29')]){_0x236bfe[_0xc025('0x20')][_0xc025('0x2a')]=_0x3777ef;_0x20aa2c[_0xc025('0x20')]=_0x3777ef[_0xc025('0x29')];_0x20aa2c[_0xc025('0x2b')]=_0xc025('0x2a');_0x20aa2c[_0xc025('0x2c')]=JSON[_0xc025('0x21')](_0x3777ef);return rpc[_0x2b4929+_0xc025('0x1e')][_0xc025('0x1f')](_0x20aa2c)['then'](function(_0x572bda){logger[_0xc025('0xd')](_0xc025('0xe'),_0x326896,_0x20aa2c[_0xc025('0x20')]);if(_0x3777ef[_0xc025('0x2d')]==_0xc025('0x2e')){_0x453e79['next']();}else{_0x453e79['stop']();}})['catch'](function(_0xa08789){logger[_0xc025('0x28')](_0xc025('0xe'),_0x326896,JSON[_0xc025('0x21')](_0xa08789));_0x453e79['next']();});}else{_0x453e79[_0xc025('0x10')]();}});}}catch(_0x1fee21){logger['error'](_0xc025('0xe'),_0x326896,JSON['stringify'](_0x1fee21));_0x453e79[_0xc025('0x24')]();}};}; \ No newline at end of file +var _0xf8af=['lodash','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','message','toString','postText','next','providerName','amazonlex','providerResponse','create','dialogState','Failed'];(function(_0x3b5578,_0x8294ff){var _0x342d55=function(_0x2ff047){while(--_0x2ff047){_0x3b5578['push'](_0x3b5578['shift']());}};_0x342d55(++_0x8294ff);}(_0xf8af,0x90));var _0xff8a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xf8af[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xff8a('0x0'));var moment=require(_0xff8a('0x1'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0xff8a('0x2'))(_0xff8a('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xff8a('0x4')),'mailMessage':require(_0xff8a('0x5')),'smsMessage':require(_0xff8a('0x6')),'faxMessage':require(_0xff8a('0x7')),'whatsappMessage':require(_0xff8a('0x8'))};exports[_0xff8a('0x9')]=function(_0x167cea,_0x14bc58){return function(_0x101b6f){try{if(!_['isNil'](this['interaction'][_0xff8a('0xa')])){logger[_0xff8a('0xb')](_0xff8a('0xc'),_0x167cea,_0xff8a('0xd'));return _0x101b6f['next']();}var _0x3f8378={'ContactId':this[_0xff8a('0xe')]['id'],'sentAt':moment()['format'](_0xff8a('0xf')),'direction':_0xff8a('0x10')};if(this[_0xff8a('0x11')]==='sms'||this[_0xff8a('0x11')]===_0xff8a('0x12')){_0x3f8378['phone']=this[_0xff8a('0x13')]['phone'];}var _0x5cc8f4=this['channel'];if(_0x5cc8f4===_0xff8a('0x14')){_0x3f8378[_0xff8a('0x15')]=this[_0xff8a('0x16')]['id'];}else{_0x3f8378[_[_0xff8a('0x17')](_0x5cc8f4)+_0xff8a('0x18')]=this[_0xff8a('0x16')]['id'];}_0x3f8378[_[_0xff8a('0x17')](_0x5cc8f4)+_0xff8a('0x19')]=this['interaction']['id'];if(this['interaction'][_0xff8a('0x1a')]){var _0x412f86=_0x14bc58[0x4];if(!_[_0xff8a('0x1b')](_0x412f86)){_0x3f8378[_0xff8a('0x1c')]=utils[_0xff8a('0x1d')](_0x412f86,this);return rpc[_0x5cc8f4+_0xff8a('0x1e')]['create'](_0x3f8378)[_0xff8a('0x1f')](function(_0x1ba247){logger[_0xff8a('0xb')](_0xff8a('0xc'),_0x167cea,_0x3f8378[_0xff8a('0x1c')]);})[_0xff8a('0x20')](function(_0x32e503){logger[_0xff8a('0x21')](_0xff8a('0xc'),_0x167cea,JSON[_0xff8a('0x22')](_0x32e503));})[_0xff8a('0x23')](function(){logger[_0xff8a('0xb')](_0xff8a('0x24'),_0x167cea);_0x101b6f[_0xff8a('0x25')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x167cea);_0x101b6f[_0xff8a('0x25')]();}}else{var _0x5ef27f=this;var _0x1e460f=new AWS['LexRuntime']({'accessKeyId':_0x14bc58[0x0],'secretAccessKey':_0x14bc58[0x1],'region':_0x14bc58[0x2]});var _0x4ddf98={'botAlias':'$LATEST','botName':_0x14bc58[0x3],'inputText':this[_0xff8a('0x26')]['body'],'userId':this[_0xff8a('0x11')]+':'+this[_0xff8a('0x13')]['id'][_0xff8a('0x27')]()};_0x1e460f[_0xff8a('0x28')](_0x4ddf98,function(_0x77e5f9,_0x41a481){if(_0x77e5f9){logger[_0xff8a('0x21')]('[%s][AMAZONLEX]\x20%s',_0x167cea,_0x77e5f9[_0xff8a('0x26')]);_0x101b6f[_0xff8a('0x29')]();}else if(_0x41a481&&_0x41a481['message']){_0x5ef27f['body']['amazonlex']=_0x41a481;_0x3f8378[_0xff8a('0x1c')]=_0x41a481[_0xff8a('0x26')];_0x3f8378[_0xff8a('0x2a')]=_0xff8a('0x2b');_0x3f8378[_0xff8a('0x2c')]=JSON[_0xff8a('0x22')](_0x41a481);return rpc[_0x5cc8f4+'Message'][_0xff8a('0x2d')](_0x3f8378)[_0xff8a('0x1f')](function(_0x33f1fa){logger[_0xff8a('0xb')](_0xff8a('0xc'),_0x167cea,_0x3f8378[_0xff8a('0x1c')]);if(_0x41a481[_0xff8a('0x2e')]==_0xff8a('0x2f')){_0x101b6f[_0xff8a('0x29')]();}else{_0x101b6f[_0xff8a('0x25')]();}})[_0xff8a('0x20')](function(_0x10438d){logger[_0xff8a('0x21')]('[%s][AMAZONLEX]\x20%s',_0x167cea,JSON['stringify'](_0x10438d));_0x101b6f['next']();});}else{_0x101b6f[_0xff8a('0x29')]();}});}}catch(_0x3a7c8f){logger[_0xff8a('0x21')](_0xff8a('0xc'),_0x167cea,JSON[_0xff8a('0x22')](_0x3a7c8f));_0x101b6f[_0xff8a('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 53b578f..1fbe001 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 _0x2a2d=['messageId','html','','headers','auto-replied','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','autoreplyExecuted','Interaction','update','stringify','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','user','pass'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x2a2d,0xb0));var _0xd2a2=function(_0x4796eb,_0x2f8389){_0x4796eb=_0x4796eb-0x0;var _0x1fb1a4=_0x2a2d[_0x4796eb];return _0x1fb1a4;};'use strict';var _=require(_0xd2a2('0x0'));var moment=require('moment');var utils=require(_0xd2a2('0x1'));var logger=require(_0xd2a2('0x2'))(_0xd2a2('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd2a2('0x4')),'smsMessage':require(_0xd2a2('0x5')),'faxMessage':require(_0xd2a2('0x6')),'whatsappMessage':require(_0xd2a2('0x7')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xd2a2('0x8')),'mailInteraction':require(_0xd2a2('0x9')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xd2a2('0xa')),'whatsappInteraction':require(_0xd2a2('0xb'))};var mailRpc=require(_0xd2a2('0xc'));exports['consequence']=function(_0x11974f,_0x1fc43d,_0x2f72be,_0x574854){return function(_0x59a2e4){try{var _0x2668f2=this['channel'];if(_0x2668f2===_0xd2a2('0xd')&&_0x574854[_0xd2a2('0xe')][_0xd2a2('0xf')]){logger[_0xd2a2('0x10')](_0xd2a2('0x11'),_0x11974f,_0xd2a2('0x12'));return _0x59a2e4[_0xd2a2('0x13')]();}if(_0x1fc43d[0x0]==='1'&&(_[_0xd2a2('0x14')](this[_0xd2a2('0x15')][_0xd2a2('0x16')])||!this[_0xd2a2('0x15')]['created'])){logger[_0xd2a2('0x10')]('[%s][AUTOREPLY]\x20%s',_0x11974f,_0xd2a2('0x17'));return _0x59a2e4[_0xd2a2('0x13')]();}if(_0x1fc43d[0x0]==='2'&&this[_0xd2a2('0x15')]['autoreplyExecuted']){logger['info'](_0xd2a2('0x18'),_0x11974f,_0xd2a2('0x19'));return _0x59a2e4[_0xd2a2('0x13')]();}var _0x443e5c={'ContactId':this['contact']['id'],'sentAt':moment()[_0xd2a2('0x1a')](_0xd2a2('0x1b')),'direction':_0xd2a2('0x1c')};if(this[_0xd2a2('0x1d')]===_0xd2a2('0xd')){_0x443e5c[_0xd2a2('0xe')]=utils[_0xd2a2('0x1e')](_0x1fc43d[0x2],this);}else{_0x443e5c[_0xd2a2('0xe')]=utils['getMustacheRender'](_0x1fc43d[0x1],this);}if(this[_0xd2a2('0x1f')]){_0x443e5c['to']=this[_0xd2a2('0x1f')]['from']||'';if(this['channel']===_0xd2a2('0xd')&&_0x1fc43d[0x1]==='1'){_0x443e5c['cc']=this[_0xd2a2('0x1f')]['cc']||'';}_0x443e5c[_0xd2a2('0x20')]=this[_0xd2a2('0x1f')]['to']||'';_0x443e5c['phone']=this[_0xd2a2('0x1f')][_0xd2a2('0x21')]||'';_0x443e5c[_0xd2a2('0x22')]=!![];if(this['message']['subject']){_0x443e5c['subject']='';_0x443e5c[_0xd2a2('0x23')]+=_[_0xd2a2('0x24')](this['message'][_0xd2a2('0x23')],_0xd2a2('0x25'))?'':_0xd2a2('0x26');_0x443e5c[_0xd2a2('0x23')]+=this[_0xd2a2('0x1f')][_0xd2a2('0x23')];}}if(this['channel']===_0xd2a2('0x27')){_0x443e5c[_0xd2a2('0x28')]=this[_0xd2a2('0x29')]['id'];}else{_0x443e5c[_[_0xd2a2('0x2a')](this[_0xd2a2('0x1d')])+_0xd2a2('0x2b')]=this['account']['id'];}_0x443e5c[_[_0xd2a2('0x2a')](this[_0xd2a2('0x1d')])+_0xd2a2('0x2c')]=this[_0xd2a2('0x15')]['id'];var _0xafa522=this[_0xd2a2('0x15')];if(rpc[this[_0xd2a2('0x1d')]+_0xd2a2('0x2d')]){if(this[_0xd2a2('0x1d')]===_0xd2a2('0xd')){var _0x52688d={'tls':{'rejectUnauthorized':![]}};if(this[_0xd2a2('0x29')][_0xd2a2('0x2e')][_0xd2a2('0x2f')]){_0x52688d[_0xd2a2('0x2f')]=this['account']['Smtp'][_0xd2a2('0x2f')];}else{_0x52688d[_0xd2a2('0x30')]=this[_0xd2a2('0x29')][_0xd2a2('0x2e')]['host'];_0x52688d['port']=this[_0xd2a2('0x29')][_0xd2a2('0x2e')][_0xd2a2('0x31')];_0x52688d[_0xd2a2('0x32')]=this[_0xd2a2('0x29')][_0xd2a2('0x2e')][_0xd2a2('0x32')];}if(this[_0xd2a2('0x29')][_0xd2a2('0x2e')][_0xd2a2('0x33')]){_0x52688d[_0xd2a2('0x34')]={'user':this['account']['Smtp'][_0xd2a2('0x35')],'pass':this[_0xd2a2('0x29')][_0xd2a2('0x2e')][_0xd2a2('0x36')]};}_0x443e5c['inReplyTo']=this[_0xd2a2('0x1f')][_0xd2a2('0x37')];_0x443e5c[_0xd2a2('0x38')]=''+_['replace'](_0x443e5c[_0xd2a2('0xe')],_0xd2a2('0x39'),_0xd2a2('0x3a'))+_0xd2a2('0x3b');_0x443e5c[_0xd2a2('0x3c')]={'Auto-Submitted':_0xd2a2('0x3d'),'X-Auto-Response-Suppress':'All','Precedence':_0xd2a2('0x3e')};return mailRpc[_0xd2a2('0x3f')](_0x52688d,_0x443e5c)[_0xd2a2('0x40')](function(_0x86c1d0){logger[_0xd2a2('0x10')](_0xd2a2('0x41'),_0x11974f);_0x443e5c[_0xd2a2('0x37')]=_0x86c1d0[_0xd2a2('0x1f')]['messageId'];return rpc[_0x2668f2+'Message']['create'](_0x443e5c);})['then'](function(_0x5afed8){logger[_0xd2a2('0x10')]('[%s][AUTOREPLY]\x20%s',_0x11974f,JSON['stringify'](_0x5afed8));})[_0xd2a2('0x42')](function(_0x3bc577){logger[_0xd2a2('0x43')](_0xd2a2('0x44'),_0x11974f,JSON['stringify'](_0x3bc577));})['finally'](function(){Promise[_0xd2a2('0x45')]()[_0xd2a2('0x40')](function(){if(_0x1fc43d[0x0]!=='2'||_0xafa522[_0xd2a2('0x46')])return;return rpc[_0x2668f2+_0xd2a2('0x47')][_0xd2a2('0x48')](_0xafa522['id'],{'autoreplyExecuted':!![]})['then'](function(_0x540fb9){logger[_0xd2a2('0x10')](_0xd2a2('0x18'),_0x11974f,JSON[_0xd2a2('0x49')](_0x540fb9));})[_0xd2a2('0x42')](function(_0x46846c){logger[_0xd2a2('0x43')](_0xd2a2('0x4a'),_0x11974f,JSON['stringify'](_0x46846c));});})[_0xd2a2('0x40')](function(){_0x59a2e4[_0xd2a2('0x13')]();});});}else{return rpc[this['channel']+'Message']['create'](_0x443e5c)[_0xd2a2('0x40')](function(_0x1b218d){logger[_0xd2a2('0x10')](_0xd2a2('0x11'),_0x11974f,_0x443e5c[_0xd2a2('0xe')]);})['catch'](function(_0x1fdc59){logger['error'](_0xd2a2('0x11'),_0x11974f,JSON[_0xd2a2('0x49')](_0x1fdc59));})[_0xd2a2('0x4b')](function(){Promise[_0xd2a2('0x45')]()['then'](function(){if(_0x1fc43d[0x0]!=='2'||_0xafa522[_0xd2a2('0x46')])return;return rpc[_0x2668f2+'Interaction']['update'](_0xafa522['id'],{'autoreplyExecuted':!![]})[_0xd2a2('0x40')](function(_0x2137a1){logger['info'](_0xd2a2('0x18'),_0x11974f,JSON['stringify'](_0x2137a1));})[_0xd2a2('0x42')](function(_0x1d4336){logger['error'](_0xd2a2('0x4a'),_0x11974f,JSON[_0xd2a2('0x49')](_0x1d4336));});})[_0xd2a2('0x40')](function(){_0x59a2e4[_0xd2a2('0x13')]();});});}}}catch(_0x4f0207){logger[_0xd2a2('0x43')](_0xd2a2('0x11'),_0x11974f,JSON[_0xd2a2('0x49')](_0x4f0207));_0x59a2e4[_0xd2a2('0x4c')]();}};}; \ No newline at end of file +var _0xf890=['interaction','created','info','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','upperFirst','account','InteractionId','Message','service','host','port','Smtp','secure','authentication','auth','user','pass','inReplyTo','messageId','html','','','headers','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xf890,0x8d));var _0x0f89=function(_0x103fe2,_0x55dd47){_0x103fe2=_0x103fe2-0x0;var _0xf67b45=_0xf890[_0x103fe2];return _0xf67b45;};'use strict';var _=require(_0x0f89('0x0'));var moment=require(_0x0f89('0x1'));var utils=require(_0x0f89('0x2'));var logger=require(_0x0f89('0x3'))(_0x0f89('0x4'));var rpc={'chatMessage':require(_0x0f89('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x0f89('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x0f89('0x7')),'whatsappMessage':require(_0x0f89('0x8')),'chatInteraction':require(_0x0f89('0x9')),'openchannelInteraction':require(_0x0f89('0xa')),'mailInteraction':require(_0x0f89('0xb')),'smsInteraction':require(_0x0f89('0xc')),'faxInteraction':require(_0x0f89('0xd')),'whatsappInteraction':require(_0x0f89('0xe'))};var mailRpc=require(_0x0f89('0xf'));exports[_0x0f89('0x10')]=function(_0x291a8c,_0xce331d,_0x3fbc61,_0x310544){return function(_0x52b0cb){try{var _0x1eb66e=this[_0x0f89('0x11')];if(_0x1eb66e===_0x0f89('0x12')&&_0x310544[_0x0f89('0x13')][_0x0f89('0x14')]){logger['info'](_0x0f89('0x15'),_0x291a8c,_0x0f89('0x16'));return _0x52b0cb[_0x0f89('0x17')]();}if(_0xce331d[0x0]==='1'&&(_[_0x0f89('0x18')](this[_0x0f89('0x19')][_0x0f89('0x1a')])||!this[_0x0f89('0x19')][_0x0f89('0x1a')])){logger[_0x0f89('0x1b')]('[%s][AUTOREPLY]\x20%s',_0x291a8c,'Autoreply\x20already\x20sent');return _0x52b0cb['next']();}if(_0xce331d[0x0]==='2'&&this[_0x0f89('0x19')][_0x0f89('0x1c')]){logger[_0x0f89('0x1b')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x291a8c,_0x0f89('0x1d'));return _0x52b0cb[_0x0f89('0x17')]();}var _0x2ff625={'ContactId':this[_0x0f89('0x1e')]['id'],'sentAt':moment()[_0x0f89('0x1f')](_0x0f89('0x20')),'direction':_0x0f89('0x21')};if(this[_0x0f89('0x11')]==='mail'){_0x2ff625[_0x0f89('0x13')]=utils[_0x0f89('0x22')](_0xce331d[0x2],this);}else{_0x2ff625[_0x0f89('0x13')]=utils[_0x0f89('0x22')](_0xce331d[0x1],this);}if(this['message']){_0x2ff625['to']=this[_0x0f89('0x23')]['from']||'';if(this[_0x0f89('0x11')]===_0x0f89('0x12')&&_0xce331d[0x1]==='1'){_0x2ff625['cc']=this[_0x0f89('0x23')]['cc']||'';}_0x2ff625[_0x0f89('0x24')]=this[_0x0f89('0x23')]['to']||'';_0x2ff625[_0x0f89('0x25')]=this[_0x0f89('0x23')][_0x0f89('0x25')]||'';_0x2ff625[_0x0f89('0x26')]=!![];if(this[_0x0f89('0x23')][_0x0f89('0x27')]){_0x2ff625[_0x0f89('0x27')]='';_0x2ff625[_0x0f89('0x27')]+=_['startsWith'](this['message'][_0x0f89('0x27')],_0x0f89('0x28'))?'':_0x0f89('0x29');_0x2ff625['subject']+=this[_0x0f89('0x23')]['subject'];}}if(this[_0x0f89('0x11')]===_0x0f89('0x2a')){_0x2ff625[_0x0f89('0x2b')]=this['account']['id'];}else{_0x2ff625[_[_0x0f89('0x2c')](this[_0x0f89('0x11')])+'AccountId']=this[_0x0f89('0x2d')]['id'];}_0x2ff625[_[_0x0f89('0x2c')](this[_0x0f89('0x11')])+_0x0f89('0x2e')]=this[_0x0f89('0x19')]['id'];var _0x34db4c=this[_0x0f89('0x19')];if(rpc[this[_0x0f89('0x11')]+_0x0f89('0x2f')]){if(this[_0x0f89('0x11')]===_0x0f89('0x12')){var _0x1ec692={'tls':{'rejectUnauthorized':![]}};if(this[_0x0f89('0x2d')]['Smtp'][_0x0f89('0x30')]){_0x1ec692[_0x0f89('0x30')]=this[_0x0f89('0x2d')]['Smtp'][_0x0f89('0x30')];}else{_0x1ec692['host']=this['account']['Smtp'][_0x0f89('0x31')];_0x1ec692[_0x0f89('0x32')]=this[_0x0f89('0x2d')][_0x0f89('0x33')][_0x0f89('0x32')];_0x1ec692['secure']=this['account'][_0x0f89('0x33')][_0x0f89('0x34')];}if(this['account'][_0x0f89('0x33')][_0x0f89('0x35')]){_0x1ec692[_0x0f89('0x36')]={'user':this[_0x0f89('0x2d')]['Smtp'][_0x0f89('0x37')],'pass':this[_0x0f89('0x2d')][_0x0f89('0x33')][_0x0f89('0x38')]};}_0x2ff625[_0x0f89('0x39')]=this[_0x0f89('0x23')][_0x0f89('0x3a')];_0x2ff625[_0x0f89('0x3b')]=_0x0f89('0x3c')+_['replace'](_0x2ff625[_0x0f89('0x13')],_0x0f89('0x3d'),_0x0f89('0x3e'))+_0x0f89('0x3f');_0x2ff625[_0x0f89('0x40')]={'Auto-Submitted':_0x0f89('0x41'),'X-Auto-Response-Suppress':_0x0f89('0x42'),'Precedence':_0x0f89('0x43')};return mailRpc[_0x0f89('0x44')](_0x1ec692,_0x2ff625)[_0x0f89('0x45')](function(_0x4dd0a1){logger[_0x0f89('0x1b')](_0x0f89('0x46'),_0x291a8c);_0x2ff625[_0x0f89('0x3a')]=_0x4dd0a1[_0x0f89('0x23')]['messageId'];return rpc[_0x1eb66e+_0x0f89('0x2f')][_0x0f89('0x47')](_0x2ff625);})['then'](function(_0x588737){logger[_0x0f89('0x1b')]('[%s][AUTOREPLY]\x20%s',_0x291a8c,JSON[_0x0f89('0x48')](_0x588737));})[_0x0f89('0x49')](function(_0x1c33f2){logger[_0x0f89('0x4a')](_0x0f89('0x4b'),_0x291a8c,JSON['stringify'](_0x1c33f2));})[_0x0f89('0x4c')](function(){Promise[_0x0f89('0x4d')]()[_0x0f89('0x45')](function(){if(_0xce331d[0x0]!=='2'||_0x34db4c[_0x0f89('0x1c')])return;return rpc[_0x1eb66e+'Interaction'][_0x0f89('0x4e')](_0x34db4c['id'],{'autoreplyExecuted':!![]})[_0x0f89('0x45')](function(_0x51c5b9){logger[_0x0f89('0x1b')](_0x0f89('0x4f'),_0x291a8c,JSON['stringify'](_0x51c5b9));})[_0x0f89('0x49')](function(_0x144246){logger[_0x0f89('0x4a')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x291a8c,JSON['stringify'](_0x144246));});})[_0x0f89('0x45')](function(){_0x52b0cb[_0x0f89('0x17')]();});});}else{return rpc[this['channel']+_0x0f89('0x2f')][_0x0f89('0x47')](_0x2ff625)['then'](function(_0xd2d34a){logger[_0x0f89('0x1b')]('[%s][AUTOREPLY]\x20%s',_0x291a8c,_0x2ff625[_0x0f89('0x13')]);})['catch'](function(_0x2dec2b){logger[_0x0f89('0x4a')](_0x0f89('0x15'),_0x291a8c,JSON[_0x0f89('0x48')](_0x2dec2b));})['finally'](function(){Promise[_0x0f89('0x4d')]()[_0x0f89('0x45')](function(){if(_0xce331d[0x0]!=='2'||_0x34db4c[_0x0f89('0x1c')])return;return rpc[_0x1eb66e+_0x0f89('0x50')][_0x0f89('0x4e')](_0x34db4c['id'],{'autoreplyExecuted':!![]})[_0x0f89('0x45')](function(_0x4216d8){logger[_0x0f89('0x1b')](_0x0f89('0x4f'),_0x291a8c,JSON['stringify'](_0x4216d8));})['catch'](function(_0x4b1d40){logger[_0x0f89('0x4a')](_0x0f89('0x51'),_0x291a8c,JSON['stringify'](_0x4b1d40));});})[_0x0f89('0x45')](function(){_0x52b0cb[_0x0f89('0x17')]();});});}}}catch(_0x105bab){logger[_0x0f89('0x4a')](_0x0f89('0x15'),_0x291a8c,JSON['stringify'](_0x105bab));_0x52b0cb[_0x0f89('0x52')]();}};}; \ 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 96bf9a9..bace9e1 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 _0x565d=['info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence'];(function(_0x8e4098,_0xafcfd4){var _0x517834=function(_0x4af58b){while(--_0x4af58b){_0x8e4098['push'](_0x8e4098['shift']());}};_0x517834(++_0xafcfd4);}(_0x565d,0x1c6));var _0xd565=function(_0x3fc3cc,_0x2a3b36){_0x3fc3cc=_0x3fc3cc-0x0;var _0x536d6b=_0x565d[_0x3fc3cc];return _0x536d6b;};'use strict';var moment=require(_0xd565('0x0'));var logger=require('../../../../config/logger')(_0xd565('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xd565('0x2')),'smsInteraction':require(_0xd565('0x3')),'mailInteraction':require(_0xd565('0x4')),'faxInteraction':require(_0xd565('0x5')),'whatsappInteraction':require(_0xd565('0x6'))};exports[_0xd565('0x7')]=function(_0x1bae2b,_0x548e2f,_0x319594,_0x46a757){return function(_0x2fc2be){try{logger[_0xd565('0x8')](_0xd565('0x9'),_0x1bae2b,_0x548e2f[0x0]);var _0x588086={'closed':0x1,'closedAt':moment()['format'](_0xd565('0xa')),'closeReason':_0xd565('0xb'),'disposition':_0x548e2f[0x0]};if(rpc[_0x46a757['channel']+_0xd565('0xc')]){rpc[_0x46a757['channel']+'Interaction'][_0xd565('0xd')](_0x46a757['interaction']['id'],_0x588086)[_0xd565('0xe')](function(_0x3a5dc1){logger[_0xd565('0x8')](_0xd565('0xf'),_0x1bae2b,_0x46a757[_0xd565('0x10')]['id']);})[_0xd565('0x11')](function(_0x2bbc37){logger['error']('[%s][CLOSE]\x20%s',_0x1bae2b,JSON[_0xd565('0x12')](_0x2bbc37));})[_0xd565('0x13')](function(){_0x2fc2be[_0xd565('0x14')]();});}}catch(_0x286033){logger['error'](_0xd565('0x15'),_0x1bae2b,JSON[_0xd565('0x12')](_0x286033));_0x2fc2be[_0xd565('0x14')]();}};}; \ No newline at end of file +var _0xa6cd=['system','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format'];(function(_0x323d87,_0x4ef3f9){var _0x5e8f74=function(_0x185735){while(--_0x185735){_0x323d87['push'](_0x323d87['shift']());}};_0x5e8f74(++_0x4ef3f9);}(_0xa6cd,0xaf));var _0xda6c=function(_0x5ab90f,_0x28811f){_0x5ab90f=_0x5ab90f-0x0;var _0x42dae7=_0xa6cd[_0x5ab90f];return _0x42dae7;};'use strict';var moment=require(_0xda6c('0x0'));var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0xda6c('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xda6c('0x2')),'mailInteraction':require(_0xda6c('0x3')),'faxInteraction':require(_0xda6c('0x4')),'whatsappInteraction':require(_0xda6c('0x5'))};exports[_0xda6c('0x6')]=function(_0xdb8ae0,_0x514af8,_0x500f11,_0x186cca){return function(_0x1571b1){try{logger['info'](_0xda6c('0x7'),_0xdb8ae0,_0x514af8[0x0]);var _0x5d28bf={'closed':0x1,'closedAt':moment()[_0xda6c('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xda6c('0x9'),'disposition':_0x514af8[0x0]};if(rpc[_0x186cca[_0xda6c('0xa')]+_0xda6c('0xb')]){rpc[_0x186cca[_0xda6c('0xa')]+'Interaction'][_0xda6c('0xc')](_0x186cca[_0xda6c('0xd')]['id'],_0x5d28bf)[_0xda6c('0xe')](function(_0x18d423){logger[_0xda6c('0xf')](_0xda6c('0x10'),_0xdb8ae0,_0x186cca[_0xda6c('0xd')]['id']);})[_0xda6c('0x11')](function(_0x30a5df){logger[_0xda6c('0x12')](_0xda6c('0x13'),_0xdb8ae0,JSON[_0xda6c('0x14')](_0x30a5df));})[_0xda6c('0x15')](function(){_0x1571b1[_0xda6c('0x16')]();});}}catch(_0x558392){logger[_0xda6c('0x12')]('[%s][CLOSE]\x20%s',_0xdb8ae0,JSON['stringify'](_0x558392));_0x1571b1[_0xda6c('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index bab4074..298ba55 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 _0x3dba=['catch','error','stringify','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','speech','providerResponse','metadata','endConversation','md5','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','isEmpty','Message','create','then','body'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3dba,0x73));var _0xa3db=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x3dba[_0x2053ea];return _0x2232c4;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require('apiai-promise');var md5=require(_0xa3db('0x0'));var utils=require(_0xa3db('0x1'));var logger=require('../../../../config/logger')(_0xa3db('0x2'));var rpc={'chatMessage':require(_0xa3db('0x3')),'openchannelMessage':require(_0xa3db('0x4')),'mailMessage':require(_0xa3db('0x5')),'smsMessage':require(_0xa3db('0x6')),'faxMessage':require(_0xa3db('0x7')),'whatsappMessage':require(_0xa3db('0x8'))};exports['consequence']=function(_0x5807bb,_0x56b483){return function(_0x4f77df){try{if(!_[_0xa3db('0x9')](this['interaction']['UserId'])){logger['info'](_0xa3db('0xa'),_0x5807bb,_0xa3db('0xb'));return _0x4f77df[_0xa3db('0xc')]();}var _0x18813f={'ContactId':this[_0xa3db('0xd')]['id'],'sentAt':moment()[_0xa3db('0xe')](_0xa3db('0xf')),'direction':_0xa3db('0x10')};if(this[_0xa3db('0x11')]==='sms'||this[_0xa3db('0x11')]===_0xa3db('0x12')){_0x18813f[_0xa3db('0x13')]=this[_0xa3db('0x14')][_0xa3db('0x13')];}var _0x38edf7=this['channel'];if(_0x38edf7==='chat'){_0x18813f[_0xa3db('0x15')]=this[_0xa3db('0x16')]['id'];}else{_0x18813f[_['upperFirst'](_0x38edf7)+_0xa3db('0x17')]=this[_0xa3db('0x16')]['id'];}_0x18813f[_[_0xa3db('0x18')](_0x38edf7)+_0xa3db('0x19')]=this[_0xa3db('0x14')]['id'];if(this[_0xa3db('0x14')][_0xa3db('0x1a')]){var _0x119589=_0x56b483[0x2];if(!_[_0xa3db('0x1b')](_0x119589)){_0x18813f['body']=utils['getMustacheRender'](_0x119589,this);return rpc[_0x38edf7+_0xa3db('0x1c')][_0xa3db('0x1d')](_0x18813f)[_0xa3db('0x1e')](function(_0x3f5e3e){logger['info'](_0xa3db('0xa'),_0x5807bb,_0x18813f[_0xa3db('0x1f')]);})[_0xa3db('0x20')](function(_0x813cda){logger[_0xa3db('0x21')](_0xa3db('0xa'),_0x5807bb,JSON[_0xa3db('0x22')](_0x813cda));})[_0xa3db('0x23')](function(){logger[_0xa3db('0x24')](_0xa3db('0x25'),_0x5807bb);_0x4f77df[_0xa3db('0x26')]();});}else{logger[_0xa3db('0x24')](_0xa3db('0x27'),_0x5807bb);_0x4f77df[_0xa3db('0x26')]();}}else{var _0x195f57=this;var _0x16bc03=apiai(_0x56b483[0x0],{'language':_0x56b483[0x1]||'en'});return _0x16bc03[_0xa3db('0x28')](this[_0xa3db('0x29')][_0xa3db('0x1f')],{'sessionId':md5(this['interaction']['id'])})[_0xa3db('0x1e')](function(_0x49bc1b){_0x195f57[_0xa3db('0x1f')][_0xa3db('0x2a')]=_0x49bc1b;_0x18813f['body']=_0x49bc1b[_0xa3db('0x2b')][_0xa3db('0x2c')][_0xa3db('0x2d')];_0x18813f['providerName']=_0xa3db('0x2a');_0x18813f[_0xa3db('0x2e')]=JSON[_0xa3db('0x22')](_0x49bc1b);return rpc[_0x38edf7+_0xa3db('0x1c')][_0xa3db('0x1d')](_0x18813f)['then'](function(_0x1d050b){logger[_0xa3db('0x24')](_0xa3db('0xa'),_0x5807bb,_0x18813f[_0xa3db('0x1f')]);if(_0x49bc1b[_0xa3db('0x2b')][_0xa3db('0x2f')][_0xa3db('0x30')]){_0x4f77df[_0xa3db('0xc')]();}else{_0x4f77df[_0xa3db('0x26')]();}})[_0xa3db('0x20')](function(_0x52578a){logger[_0xa3db('0x21')](_0xa3db('0xa'),_0x5807bb,JSON[_0xa3db('0x22')](_0x52578a));_0x4f77df['next']();});})[_0xa3db('0x20')](function(_0x3b3436){logger['error'](_0xa3db('0xa'),_0x5807bb,_0x3b3436[_0xa3db('0x29')]);_0x4f77df[_0xa3db('0xc')]();});}}catch(_0x56bef9){logger[_0xa3db('0x21')](_0xa3db('0xa'),_0x5807bb,JSON['stringify'](_0x56bef9));_0x4f77df['stop']();}};}; \ No newline at end of file +var _0x103f=['create','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','metadata','endConversation','next','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','channel','sms','whatsapp','chat','ChatWebsiteId','upperFirst','AccountId','InteractionId','isEmpty','body','getMustacheRender','Message'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x103f,0x13e));var _0xf103=function(_0x4b4679,_0x38cd54){_0x4b4679=_0x4b4679-0x0;var _0x2b05db=_0x103f[_0x4b4679];return _0x2b05db;};'use strict';var _=require(_0xf103('0x0'));var moment=require(_0xf103('0x1'));var apiai=require(_0xf103('0x2'));var md5=require(_0xf103('0x3'));var utils=require(_0xf103('0x4'));var logger=require(_0xf103('0x5'))(_0xf103('0x6'));var rpc={'chatMessage':require(_0xf103('0x7')),'openchannelMessage':require(_0xf103('0x8')),'mailMessage':require(_0xf103('0x9')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xf103('0xa')),'whatsappMessage':require(_0xf103('0xb'))};exports[_0xf103('0xc')]=function(_0x211dbc,_0x36d86b){return function(_0x3cfbd1){try{if(!_[_0xf103('0xd')](this[_0xf103('0xe')][_0xf103('0xf')])){logger[_0xf103('0x10')](_0xf103('0x11'),_0x211dbc,_0xf103('0x12'));return _0x3cfbd1['next']();}var _0x228805={'ContactId':this['contact']['id'],'sentAt':moment()[_0xf103('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0xf103('0x14')]===_0xf103('0x15')||this['channel']===_0xf103('0x16')){_0x228805['phone']=this['interaction']['phone'];}var _0x210aa0=this['channel'];if(_0x210aa0===_0xf103('0x17')){_0x228805[_0xf103('0x18')]=this['account']['id'];}else{_0x228805[_[_0xf103('0x19')](_0x210aa0)+_0xf103('0x1a')]=this['account']['id'];}_0x228805[_[_0xf103('0x19')](_0x210aa0)+_0xf103('0x1b')]=this['interaction']['id'];if(this[_0xf103('0xe')]['created']){var _0x4a1a87=_0x36d86b[0x2];if(!_[_0xf103('0x1c')](_0x4a1a87)){_0x228805[_0xf103('0x1d')]=utils[_0xf103('0x1e')](_0x4a1a87,this);return rpc[_0x210aa0+_0xf103('0x1f')][_0xf103('0x20')](_0x228805)[_0xf103('0x21')](function(_0x5a2e85){logger[_0xf103('0x10')](_0xf103('0x11'),_0x211dbc,_0x228805['body']);})[_0xf103('0x22')](function(_0x1462b1){logger[_0xf103('0x23')](_0xf103('0x11'),_0x211dbc,JSON[_0xf103('0x24')](_0x1462b1));})['finally'](function(){logger[_0xf103('0x10')](_0xf103('0x25'),_0x211dbc);_0x3cfbd1[_0xf103('0x26')]();});}else{logger[_0xf103('0x10')](_0xf103('0x27'),_0x211dbc);_0x3cfbd1[_0xf103('0x26')]();}}else{var _0x3607ce=this;var _0x111e83=apiai(_0x36d86b[0x0],{'language':_0x36d86b[0x1]||'en'});return _0x111e83['textRequest'](this[_0xf103('0x28')]['body'],{'sessionId':md5(this[_0xf103('0xe')]['id'])})['then'](function(_0x3a8d9e){_0x3607ce[_0xf103('0x1d')][_0xf103('0x29')]=_0x3a8d9e;_0x228805[_0xf103('0x1d')]=_0x3a8d9e[_0xf103('0x2a')][_0xf103('0x2b')][_0xf103('0x2c')];_0x228805[_0xf103('0x2d')]='dialogflow';_0x228805[_0xf103('0x2e')]=JSON['stringify'](_0x3a8d9e);return rpc[_0x210aa0+_0xf103('0x1f')]['create'](_0x228805)[_0xf103('0x21')](function(_0x3352e8){logger[_0xf103('0x10')](_0xf103('0x11'),_0x211dbc,_0x228805['body']);if(_0x3a8d9e[_0xf103('0x2a')][_0xf103('0x2f')][_0xf103('0x30')]){_0x3cfbd1['next']();}else{_0x3cfbd1['stop']();}})[_0xf103('0x22')](function(_0x7ee263){logger['error'](_0xf103('0x11'),_0x211dbc,JSON[_0xf103('0x24')](_0x7ee263));_0x3cfbd1[_0xf103('0x31')]();});})[_0xf103('0x22')](function(_0x5becbe){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x211dbc,_0x5becbe['message']);_0x3cfbd1[_0xf103('0x31')]();});}}catch(_0x4bb33a){logger[_0xf103('0x23')](_0xf103('0x11'),_0x211dbc,JSON[_0xf103('0x24')](_0x4bb33a));_0x3cfbd1['stop']();}};}; \ 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 8898392..800cf4a 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 _0xbfec=['action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','fields','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','fulfillmentText','push','all','message','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','clone','body','Message','create','then','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','getMustacheRender','finally','stop','SessionsClient','sessionPath','length','dialogflowV2','queryResult','diagnosticInfo','end_conversation','boolValue'];(function(_0x173dd9,_0x4ecf44){var _0x5a0d5a=function(_0x4d731a){while(--_0x4d731a){_0x173dd9['push'](_0x173dd9['shift']());}};_0x5a0d5a(++_0x4ecf44);}(_0xbfec,0x1b3));var _0xcbfe=function(_0x440dd3,_0x57cf19){_0x440dd3=_0x440dd3-0x0;var _0x1fd616=_0xbfec[_0x440dd3];return _0x1fd616;};'use strict';var _=require(_0xcbfe('0x0'));var dialogflow=require(_0xcbfe('0x1'));var md5=require(_0xcbfe('0x2'));var moment=require(_0xcbfe('0x3'));var Promise=require(_0xcbfe('0x4'));var logger=require(_0xcbfe('0x5'))('routing');var utils=require('./utils');var rpc={'chatMessage':require(_0xcbfe('0x6')),'openchannelMessage':require(_0xcbfe('0x7')),'mailMessage':require(_0xcbfe('0x8')),'smsMessage':require(_0xcbfe('0x9')),'faxMessage':require(_0xcbfe('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x126e7d,_0x31ea87,_0x57f744,_0x467bdb){return new Promise(function(_0x1eef08,_0x36b3fa){var _0x319cb8=_[_0xcbfe('0xb')](_0x57f744);_0x319cb8[_0xcbfe('0xc')]=_0x467bdb;return rpc[_0x31ea87+_0xcbfe('0xd')][_0xcbfe('0xe')](_0x319cb8)[_0xcbfe('0xf')](function(){logger[_0xcbfe('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x126e7d,_0x319cb8[_0xcbfe('0xc')]);_0x1eef08();})[_0xcbfe('0x11')](function(_0xd91067){logger[_0xcbfe('0x12')](_0xcbfe('0x13'),_0x126e7d,JSON['stringify'](_0xd91067));_0x36b3fa(_0xd91067);});});}exports[_0xcbfe('0x14')]=function(_0x1c103d,_0x32338e){return function(_0x366c6c){try{if(!_[_0xcbfe('0x15')](this[_0xcbfe('0x16')][_0xcbfe('0x17')])){logger[_0xcbfe('0x10')](_0xcbfe('0x13'),_0x1c103d,_0xcbfe('0x18'));return _0x366c6c[_0xcbfe('0x19')]();}var _0x57bcdd={'ContactId':this['contact']['id'],'sentAt':moment()[_0xcbfe('0x1a')](_0xcbfe('0x1b')),'direction':'out'};if(this[_0xcbfe('0x1c')]==='sms'||this['channel']===_0xcbfe('0x1d')){_0x57bcdd['phone']=this[_0xcbfe('0x16')]['phone'];}var _0x175cc4=this[_0xcbfe('0x1c')];if(_0x175cc4===_0xcbfe('0x1e')){_0x57bcdd[_0xcbfe('0x1f')]=this[_0xcbfe('0x20')]['id'];}else{_0x57bcdd[_[_0xcbfe('0x21')](_0x175cc4)+_0xcbfe('0x22')]=this[_0xcbfe('0x20')]['id'];}_0x57bcdd[_[_0xcbfe('0x21')](_0x175cc4)+_0xcbfe('0x23')]=this[_0xcbfe('0x16')]['id'];if(this[_0xcbfe('0x16')]['created']){var _0x37227d=_0x32338e[0x4];if(!_[_0xcbfe('0x24')](_0x37227d)){_0x57bcdd[_0xcbfe('0xc')]=utils[_0xcbfe('0x25')](_0x37227d,this);return rpc[_0x175cc4+_0xcbfe('0xd')][_0xcbfe('0xe')](_0x57bcdd)[_0xcbfe('0xf')](function(_0x1ae511){logger[_0xcbfe('0x10')](_0xcbfe('0x13'),_0x1c103d,_0x57bcdd[_0xcbfe('0xc')]);})[_0xcbfe('0x11')](function(_0x49d858){logger[_0xcbfe('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x1c103d,JSON['stringify'](_0x49d858));})[_0xcbfe('0x26')](function(){logger[_0xcbfe('0x10')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1c103d);_0x366c6c[_0xcbfe('0x27')]();});}else{logger[_0xcbfe('0x10')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1c103d);_0x366c6c['stop']();}}else{var _0x752d89=this;var _0x1d9eb5=_0x32338e[0x2]['replace'](/\\n/g,'\x0a');var _0x4c9af0={'credentials':{'private_key':_0x1d9eb5,'client_email':_0x32338e[0x1]}};var _0x52eda2=new dialogflow[(_0xcbfe('0x28'))](_0x4c9af0);var _0x2f23a4=_0x52eda2[_0xcbfe('0x29')](_0x32338e[0x0],md5(_0x752d89[_0xcbfe('0x16')]['id']));var _0x3bdbaa={'session':_0x2f23a4,'queryInput':{'text':{'text':_0x752d89['message'][_0xcbfe('0xc')],'languageCode':_0x32338e[0x3]||'en'}}};return _0x52eda2['detectIntent'](_0x3bdbaa)[_0xcbfe('0xf')](function(_0x509f82){if(_0x509f82&&_0x509f82[_0xcbfe('0x2a')]){_0x752d89['body'][_0xcbfe('0x2b')]=_0x509f82;var _0x4463a0=_0x509f82[0x0];var _0x47e176=_0x4463a0[_0xcbfe('0x2c')][_0xcbfe('0x2d')]&&_0x4463a0[_0xcbfe('0x2c')]['diagnosticInfo']['fields']?_0x4463a0[_0xcbfe('0x2c')][_0xcbfe('0x2d')]['fields'][_0xcbfe('0x2e')][_0xcbfe('0x2f')]:![];_0x752d89[_0xcbfe('0xc')]['DIALOGFLOWV2_ACTION']=_0x4463a0['queryResult'][_0xcbfe('0x30')];_0x752d89[_0xcbfe('0xc')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x4463a0['queryResult'][_0xcbfe('0x31')];_0x752d89['body'][_0xcbfe('0x32')]=_0x4463a0[_0xcbfe('0x2c')][_0xcbfe('0x2d')]&&_0x4463a0[_0xcbfe('0x2c')][_0xcbfe('0x2d')][_0xcbfe('0x33')]?_0x4463a0['queryResult'][_0xcbfe('0x2d')][_0xcbfe('0x33')][_0xcbfe('0x2e')][_0xcbfe('0x2f')]:![];_0x752d89[_0xcbfe('0xc')][_0xcbfe('0x34')]=_0x4463a0['queryResult'][_0xcbfe('0x35')][_0xcbfe('0x36')];_0x752d89['body'][_0xcbfe('0x37')]=_0x4463a0[_0xcbfe('0x2c')]['intent'][_0xcbfe('0x38')];_0x752d89[_0xcbfe('0xc')][_0xcbfe('0x39')]=_0x4463a0[_0xcbfe('0x2c')]['intent'][_0xcbfe('0x3a')];_0x752d89['body'][_0xcbfe('0x3b')]=_0x4463a0[_0xcbfe('0x2c')][_0xcbfe('0x3c')];_0x752d89[_0xcbfe('0xc')][_0xcbfe('0x3d')]=_0x4463a0[_0xcbfe('0x2c')]['queryText'];_0x752d89['body'][_0xcbfe('0x3e')]=_0x4463a0[_0xcbfe('0x2c')][_0xcbfe('0x3f')];_0x57bcdd[_0xcbfe('0x40')]='dialogflowV2';_0x57bcdd['providerResponse']=JSON['stringify'](_0x509f82);var _0x26c2ee=[];for(var _0x480a5a=0x0;_0x480a5a<_0x509f82[_0xcbfe('0x2a')];_0x480a5a++){var _0x3594f0=_0x509f82[_0x480a5a];if(_0x3594f0&&_0x3594f0['queryResult']&&_0x3594f0[_0xcbfe('0x2c')][_0xcbfe('0x41')]){_0x26c2ee[_0xcbfe('0x42')](createMessage(_0x1c103d,_0x175cc4,_0x57bcdd,_0x3594f0[_0xcbfe('0x2c')][_0xcbfe('0x41')]));}}return Promise[_0xcbfe('0x43')](_0x26c2ee)[_0xcbfe('0xf')](function(){if(_0x47e176){_0x366c6c[_0xcbfe('0x19')]();}else{_0x366c6c[_0xcbfe('0x27')]();}})['catch'](function(_0x364fe3){logger[_0xcbfe('0x12')](_0xcbfe('0x13'),_0x1c103d,JSON['stringify'](_0x364fe3));_0x366c6c[_0xcbfe('0x19')]();});}})[_0xcbfe('0x11')](function(_0x7ac316){logger[_0xcbfe('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x1c103d,_0x7ac316[_0xcbfe('0x44')]);_0x366c6c[_0xcbfe('0x19')]();});}}catch(_0xdb3c75){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x1c103d,JSON['stringify'](_0xdb3c75));_0x366c6c[_0xcbfe('0x27')]();}};}; \ No newline at end of file +var _0xf41c=['isNil','interaction','UserId','info','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','stringify','fulfillmentText','push','all','dialogflow','moment','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','body','Message','then','[%s][DIALOGFLOWV2]\x20%s','error','consequence'];(function(_0x24e4f9,_0x1e9a18){var _0x56b977=function(_0x54a104){while(--_0x54a104){_0x24e4f9['push'](_0x24e4f9['shift']());}};_0x56b977(++_0x1e9a18);}(_0xf41c,0x1a6));var _0xcf41=function(_0xa7d87e,_0x214ca0){_0xa7d87e=_0xa7d87e-0x0;var _0x3d29eb=_0xf41c[_0xa7d87e];return _0x3d29eb;};'use strict';var _=require('lodash');var dialogflow=require(_0xcf41('0x0'));var md5=require('md5');var moment=require(_0xcf41('0x1'));var Promise=require('bluebird');var logger=require(_0xcf41('0x2'))(_0xcf41('0x3'));var utils=require(_0xcf41('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xcf41('0x5')),'mailMessage':require(_0xcf41('0x6')),'smsMessage':require(_0xcf41('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xcf41('0x8'))};function createMessage(_0x3f2691,_0x283cbf,_0x5d10e1,_0x2eebf8){return new Promise(function(_0x187789,_0x1eb52f){var _0x37aa8b=_[_0xcf41('0x9')](_0x5d10e1);_0x37aa8b[_0xcf41('0xa')]=_0x2eebf8;return rpc[_0x283cbf+_0xcf41('0xb')]['create'](_0x37aa8b)[_0xcf41('0xc')](function(){logger['info'](_0xcf41('0xd'),_0x3f2691,_0x37aa8b[_0xcf41('0xa')]);_0x187789();})['catch'](function(_0x446b96){logger[_0xcf41('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x3f2691,JSON['stringify'](_0x446b96));_0x1eb52f(_0x446b96);});});}exports[_0xcf41('0xf')]=function(_0x45e2a9,_0x469977){return function(_0x931b98){try{if(!_[_0xcf41('0x10')](this[_0xcf41('0x11')][_0xcf41('0x12')])){logger[_0xcf41('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x45e2a9,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x931b98[_0xcf41('0x14')]();}var _0x518da6={'ContactId':this[_0xcf41('0x15')]['id'],'sentAt':moment()[_0xcf41('0x16')](_0xcf41('0x17')),'direction':_0xcf41('0x18')};if(this[_0xcf41('0x19')]===_0xcf41('0x1a')||this[_0xcf41('0x19')]===_0xcf41('0x1b')){_0x518da6[_0xcf41('0x1c')]=this[_0xcf41('0x11')]['phone'];}var _0x2d0ba0=this[_0xcf41('0x19')];if(_0x2d0ba0===_0xcf41('0x1d')){_0x518da6[_0xcf41('0x1e')]=this[_0xcf41('0x1f')]['id'];}else{_0x518da6[_['upperFirst'](_0x2d0ba0)+_0xcf41('0x20')]=this[_0xcf41('0x1f')]['id'];}_0x518da6[_['upperFirst'](_0x2d0ba0)+_0xcf41('0x21')]=this['interaction']['id'];if(this['interaction'][_0xcf41('0x22')]){var _0x1f7089=_0x469977[0x4];if(!_[_0xcf41('0x23')](_0x1f7089)){_0x518da6[_0xcf41('0xa')]=utils[_0xcf41('0x24')](_0x1f7089,this);return rpc[_0x2d0ba0+'Message'][_0xcf41('0x25')](_0x518da6)[_0xcf41('0xc')](function(_0x2cd37b){logger[_0xcf41('0x13')](_0xcf41('0xd'),_0x45e2a9,_0x518da6['body']);})[_0xcf41('0x26')](function(_0xf2aea4){logger['error'](_0xcf41('0xd'),_0x45e2a9,JSON['stringify'](_0xf2aea4));})[_0xcf41('0x27')](function(){logger[_0xcf41('0x13')](_0xcf41('0x28'),_0x45e2a9);_0x931b98[_0xcf41('0x29')]();});}else{logger[_0xcf41('0x13')](_0xcf41('0x2a'),_0x45e2a9);_0x931b98['stop']();}}else{var _0x14e37f=this;var _0x209f99=_0x469977[0x2]['replace'](/\\n/g,'\x0a');var _0x573a24={'credentials':{'private_key':_0x209f99,'client_email':_0x469977[0x1]}};var _0xed35c0=new dialogflow[(_0xcf41('0x2b'))](_0x573a24);var _0x55ce5c=_0xed35c0[_0xcf41('0x2c')](_0x469977[0x0],md5(_0x14e37f[_0xcf41('0x11')]['id']));var _0x5b1541={'session':_0x55ce5c,'queryInput':{'text':{'text':_0x14e37f[_0xcf41('0x2d')][_0xcf41('0xa')],'languageCode':_0x469977[0x3]||'en'}}};return _0xed35c0[_0xcf41('0x2e')](_0x5b1541)[_0xcf41('0xc')](function(_0x1e12d0){if(_0x1e12d0&&_0x1e12d0[_0xcf41('0x2f')]){_0x14e37f['body'][_0xcf41('0x30')]=_0x1e12d0;var _0x27215b=_0x1e12d0[0x0];var _0x20ecf1=_0x27215b[_0xcf41('0x31')][_0xcf41('0x32')]&&_0x27215b['queryResult'][_0xcf41('0x32')][_0xcf41('0x33')]?_0x27215b[_0xcf41('0x31')][_0xcf41('0x32')]['fields'][_0xcf41('0x34')][_0xcf41('0x35')]:![];_0x14e37f[_0xcf41('0xa')]['DIALOGFLOWV2_ACTION']=_0x27215b[_0xcf41('0x31')]['action'];_0x14e37f[_0xcf41('0xa')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x27215b['queryResult'][_0xcf41('0x36')];_0x14e37f[_0xcf41('0xa')][_0xcf41('0x37')]=_0x27215b[_0xcf41('0x31')][_0xcf41('0x32')]&&_0x27215b[_0xcf41('0x31')][_0xcf41('0x32')]['fields']?_0x27215b['queryResult'][_0xcf41('0x32')][_0xcf41('0x33')][_0xcf41('0x34')][_0xcf41('0x35')]:![];_0x14e37f[_0xcf41('0xa')][_0xcf41('0x38')]=_0x27215b[_0xcf41('0x31')]['intent'][_0xcf41('0x39')];_0x14e37f[_0xcf41('0xa')][_0xcf41('0x3a')]=_0x27215b[_0xcf41('0x31')]['intent'][_0xcf41('0x3b')];_0x14e37f[_0xcf41('0xa')][_0xcf41('0x3c')]=_0x27215b['queryResult'][_0xcf41('0x3d')][_0xcf41('0x3e')];_0x14e37f[_0xcf41('0xa')][_0xcf41('0x3f')]=_0x27215b['queryResult']['languageCode'];_0x14e37f[_0xcf41('0xa')][_0xcf41('0x40')]=_0x27215b[_0xcf41('0x31')][_0xcf41('0x41')];_0x14e37f[_0xcf41('0xa')][_0xcf41('0x42')]=_0x27215b[_0xcf41('0x31')][_0xcf41('0x43')];_0x518da6[_0xcf41('0x44')]='dialogflowV2';_0x518da6['providerResponse']=JSON[_0xcf41('0x45')](_0x1e12d0);var _0x2a2cb3=[];for(var _0x4c4bcc=0x0;_0x4c4bcc<_0x1e12d0[_0xcf41('0x2f')];_0x4c4bcc++){var _0x10ae34=_0x1e12d0[_0x4c4bcc];if(_0x10ae34&&_0x10ae34[_0xcf41('0x31')]&&_0x10ae34[_0xcf41('0x31')][_0xcf41('0x46')]){_0x2a2cb3[_0xcf41('0x47')](createMessage(_0x45e2a9,_0x2d0ba0,_0x518da6,_0x10ae34[_0xcf41('0x31')][_0xcf41('0x46')]));}}return Promise[_0xcf41('0x48')](_0x2a2cb3)['then'](function(){if(_0x20ecf1){_0x931b98['next']();}else{_0x931b98['stop']();}})[_0xcf41('0x26')](function(_0x21b1ef){logger['error'](_0xcf41('0xd'),_0x45e2a9,JSON[_0xcf41('0x45')](_0x21b1ef));_0x931b98[_0xcf41('0x14')]();});}})[_0xcf41('0x26')](function(_0x386005){logger[_0xcf41('0xe')](_0xcf41('0xd'),_0x45e2a9,_0x386005[_0xcf41('0x2d')]);_0x931b98['next']();});}}catch(_0x555ad1){logger[_0xcf41('0xe')](_0xcf41('0xd'),_0x45e2a9,JSON[_0xcf41('0x45')](_0x555ad1));_0x931b98[_0xcf41('0x29')]();}};}; \ 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 d00aeb5..8345d75 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 _0xd841=['../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','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','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd841,0x89));var _0x1d84=function(_0x1deca8,_0x52af73){_0x1deca8=_0x1deca8-0x0;var _0x130f3a=_0xd841[_0x1deca8];return _0x130f3a;};'use strict';var schema=require(_0x1d84('0x0'));var _=require(_0x1d84('0x1'));var htmlToText=require(_0x1d84('0x2'));var utils=require('./utils');var logger=require(_0x1d84('0x3'))(_0x1d84('0x4'));var gotoif=schema({'condition':{'type':_0x1d84('0x5'),'required':!![],'message':_0x1d84('0x6')},'priorityTrue':{'type':_0x1d84('0x7'),'message':_0x1d84('0x8')},'priorityFalse':{'type':_0x1d84('0x7'),'message':_0x1d84('0x9')}});exports[_0x1d84('0xa')]=function(_0xc601d1,_0x5242f6){return function(_0x7777fb){try{var _0x46b0f3={'condition':htmlToText['fromString'](utils[_0x1d84('0xb')](_0x5242f6[0x0],this),{'wordwrap':![]})[_0x1d84('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x5242f6[0x1],'priorityFalse':_0x5242f6[0x2]};var _0x473912=gotoif[_0x1d84('0x0')](_0x46b0f3,{'typecast':!![]});if(_0x473912[_0x1d84('0xd')]){logger['error'](_0x1d84('0xe'),_0xc601d1,_[_0x1d84('0xf')](_0x473912,'message')['join'](',\x20'));_0x7777fb['stop']();}else{try{var _0x5a11e1=eval('('+_0x46b0f3[_0x1d84('0x10')]+')');var _0x5ef309=_0x5a11e1?_0x46b0f3['priorityTrue']:_0x46b0f3[_0x1d84('0x11')];logger[_0x1d84('0x12')](_0x1d84('0x13'),_0xc601d1,_0x46b0f3[_0x1d84('0x10')],_0x5a11e1,_0x5ef309||_0x1d84('0x14'));if(_0x5ef309){var _0x1dee33=_['findIndex'](_0x7777fb[_0x1d84('0x15')](),{'p':_0x5ef309});if(_0x1dee33>=0x0){logger[_0x1d84('0x12')](_0x1d84('0x16'),_0xc601d1,_0x5ef309||_0x1d84('0x14'),_0x1dee33);_0x7777fb[_0x1d84('0x14')](_0x1dee33);}else{logger[_0x1d84('0x12')](_0x1d84('0x17'),_0xc601d1,_0x5ef309||_0x1d84('0x14'));_0x7777fb[_0x1d84('0x18')]();}}else{_0x7777fb[_0x1d84('0x14')]();}}catch(_0x368621){logger[_0x1d84('0x19')](_0x1d84('0x1a'),_0xc601d1,_0x368621['message']);_0x7777fb['stop']();}}}catch(_0x1a165e){logger['error']('[%s][GOTOIF]\x20%s',_0xc601d1,JSON[_0x1d84('0x1b')](_0x1a165e));_0x7777fb[_0x1d84('0x18')]();}};}; \ No newline at end of file +var _0xe003=['[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','stop','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','validate','length','error','[%s][GOTOIF]\x20%s','message','join','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found'];(function(_0xcb0f7e,_0x56c452){var _0x5e021d=function(_0x2d844e){while(--_0x2d844e){_0xcb0f7e['push'](_0xcb0f7e['shift']());}};_0x5e021d(++_0x56c452);}(_0xe003,0x1d3));var _0x3e00=function(_0x59a4be,_0x1ba00a){_0x59a4be=_0x59a4be-0x0;var _0x1d4a28=_0xe003[_0x59a4be];return _0x1d4a28;};'use strict';var schema=require('validate');var _=require(_0x3e00('0x0'));var htmlToText=require(_0x3e00('0x1'));var utils=require(_0x3e00('0x2'));var logger=require(_0x3e00('0x3'))(_0x3e00('0x4'));var gotoif=schema({'condition':{'type':_0x3e00('0x5'),'required':!![],'message':_0x3e00('0x6')},'priorityTrue':{'type':_0x3e00('0x7'),'message':_0x3e00('0x8')},'priorityFalse':{'type':'number','message':_0x3e00('0x9')}});exports['consequence']=function(_0x286ef6,_0x593334){return function(_0x40f5b1){try{var _0x1a8134={'condition':htmlToText[_0x3e00('0xa')](utils[_0x3e00('0xb')](_0x593334[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x593334[0x1],'priorityFalse':_0x593334[0x2]};var _0x357a9c=gotoif[_0x3e00('0xc')](_0x1a8134,{'typecast':!![]});if(_0x357a9c[_0x3e00('0xd')]){logger[_0x3e00('0xe')](_0x3e00('0xf'),_0x286ef6,_['map'](_0x357a9c,_0x3e00('0x10'))[_0x3e00('0x11')](',\x20'));_0x40f5b1['stop']();}else{try{var _0x48cbbb=eval('('+_0x1a8134['condition']+')');var _0x1c4a71=_0x48cbbb?_0x1a8134['priorityTrue']:_0x1a8134[_0x3e00('0x12')];logger[_0x3e00('0x13')](_0x3e00('0x14'),_0x286ef6,_0x1a8134[_0x3e00('0x15')],_0x48cbbb,_0x1c4a71||_0x3e00('0x16'));if(_0x1c4a71){var _0x18316c=_[_0x3e00('0x17')](_0x40f5b1['rules'](),{'p':_0x1c4a71});if(_0x18316c>=0x0){logger[_0x3e00('0x13')](_0x3e00('0x18'),_0x286ef6,_0x1c4a71||_0x3e00('0x16'),_0x18316c);_0x40f5b1[_0x3e00('0x16')](_0x18316c);}else{logger[_0x3e00('0x13')](_0x3e00('0x19'),_0x286ef6,_0x1c4a71||_0x3e00('0x16'));_0x40f5b1['stop']();}}else{_0x40f5b1[_0x3e00('0x16')]();}}catch(_0xbc03f5){logger[_0x3e00('0xe')](_0x3e00('0x1a'),_0x286ef6,_0xbc03f5[_0x3e00('0x10')]);_0x40f5b1['stop']();}}}catch(_0x144d33){logger[_0x3e00('0xe')](_0x3e00('0xf'),_0x286ef6,JSON[_0x3e00('0x1b')](_0x144d33));_0x40f5b1[_0x3e00('0x1c')]();}};}; \ 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 b5b82b9..8d26a35 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 _0x850d=['join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message'];(function(_0x1a5503,_0x3f7645){var _0x409a62=function(_0x1528b5){while(--_0x1528b5){_0x1a5503['push'](_0x1a5503['shift']());}};_0x409a62(++_0x3f7645);}(_0x850d,0x164));var _0xd850=function(_0x1eb13f,_0x2e351a){_0x1eb13f=_0x1eb13f-0x0;var _0x521e95=_0x850d[_0x1eb13f];return _0x521e95;};'use strict';var schema=require(_0xd850('0x0'));var _=require(_0xd850('0x1'));var logger=require(_0xd850('0x2'))(_0xd850('0x3'));var gotop=schema({'priority':{'type':_0xd850('0x4'),'required':!![],'message':_0xd850('0x5')}});exports[_0xd850('0x6')]=function(_0x658455,_0x2d868d){return function(_0x53142c){try{var _0x58303e={'priority':_0x2d868d[0x0]};var _0x4b368a=gotop[_0xd850('0x0')](_0x58303e,{'typecast':!![]});if(_0x4b368a[_0xd850('0x7')]){logger[_0xd850('0x8')](_0xd850('0x9'),_0x658455,_[_0xd850('0xa')](_0x4b368a,_0xd850('0xb'))[_0xd850('0xc')](',\x20'));_0x53142c[_0xd850('0xd')]();}else{logger[_0xd850('0xe')](_0xd850('0xf'),_0x658455,_0x58303e[_0xd850('0x10')]);if(_0x58303e['priority']){var _0x5e4bce=_[_0xd850('0x11')](_0x53142c[_0xd850('0x12')](),{'p':_0x58303e[_0xd850('0x10')]});if(_0x5e4bce>=0x0){logger[_0xd850('0xe')](_0xd850('0x13'),_0x658455,_0x58303e['priority']||_0xd850('0x14'),_0x5e4bce);_0x53142c[_0xd850('0x14')](_0x5e4bce);}else{logger[_0xd850('0xe')](_0xd850('0x15'),_0x658455,_0x58303e[_0xd850('0x10')]||_0xd850('0x14'));_0x53142c['stop']();}}else{_0x53142c[_0xd850('0x14')]();}}}catch(_0x4b359d){logger['error'](_0xd850('0x9'),_0x658455,JSON[_0xd850('0x16')](_0x4b359d));_0x53142c['stop']();}};}; \ No newline at end of file +var _0x5799=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','stop','priority','findIndex','rules','info','next'];(function(_0x198858,_0x13c832){var _0x455134=function(_0xb66eb){while(--_0xb66eb){_0x198858['push'](_0x198858['shift']());}};_0x455134(++_0x13c832);}(_0x5799,0xc7));var _0x9579=function(_0x33caf6,_0x26b95f){_0x33caf6=_0x33caf6-0x0;var _0x1d1771=_0x5799[_0x33caf6];return _0x1d1771;};'use strict';var schema=require(_0x9579('0x0'));var _=require('lodash');var logger=require(_0x9579('0x1'))(_0x9579('0x2'));var gotop=schema({'priority':{'type':_0x9579('0x3'),'required':!![],'message':_0x9579('0x4')}});exports[_0x9579('0x5')]=function(_0x28ca53,_0x4820bc){return function(_0x54112c){try{var _0x27765d={'priority':_0x4820bc[0x0]};var _0x3bea46=gotop[_0x9579('0x0')](_0x27765d,{'typecast':!![]});if(_0x3bea46[_0x9579('0x6')]){logger[_0x9579('0x7')](_0x9579('0x8'),_0x28ca53,_[_0x9579('0x9')](_0x3bea46,_0x9579('0xa'))['join'](',\x20'));_0x54112c[_0x9579('0xb')]();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x28ca53,_0x27765d[_0x9579('0xc')]);if(_0x27765d[_0x9579('0xc')]){var _0x3d062e=_[_0x9579('0xd')](_0x54112c[_0x9579('0xe')](),{'p':_0x27765d['priority']});if(_0x3d062e>=0x0){logger[_0x9579('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x28ca53,_0x27765d['priority']||_0x9579('0x10'),_0x3d062e);_0x54112c[_0x9579('0x10')](_0x3d062e);}else{logger['info'](_0x9579('0x11'),_0x28ca53,_0x27765d[_0x9579('0xc')]||_0x9579('0x10'));_0x54112c[_0x9579('0xb')]();}}else{_0x54112c[_0x9579('0x10')]();}}}catch(_0x1d2b82){logger[_0x9579('0x7')](_0x9579('0x8'),_0x28ca53,JSON['stringify'](_0x1d2b82));_0x54112c['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 5f45d94..fb9a49c 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 _0x32e7=['../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','then','info','body','catch','error','stop','[%s][MESSAGE]\x20%s','stringify','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage'];(function(_0x462af9,_0x555866){var _0x20c16f=function(_0x302874){while(--_0x302874){_0x462af9['push'](_0x462af9['shift']());}};_0x20c16f(++_0x555866);}(_0x32e7,0xc3));var _0x732e=function(_0x431fb0,_0x4c3324){_0x431fb0=_0x431fb0-0x0;var _0x542b89=_0x32e7[_0x431fb0];return _0x542b89;};'use strict';var _=require(_0x732e('0x0'));var utils=require('./utils');var logger=require(_0x732e('0x1'))(_0x732e('0x2'));var rpc={'chatMessage':require(_0x732e('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x732e('0x4')),'smsMessage':require(_0x732e('0x5')),'faxMessage':require(_0x732e('0x6')),'whatsappMessage':require(_0x732e('0x7'))};exports['consequence']=function(_0x547503,_0x1d5c73){return function(_0x55d7b4){try{var _0x1a36ff={'body':utils[_0x732e('0x8')](_0x1d5c73[0x0],this),'ContactId':this['contact']['id']};if(this[_0x732e('0x9')]===_0x732e('0xa')){_0x1a36ff[_0x732e('0xb')]=this['account']['id'];}else{_0x1a36ff[_[_0x732e('0xc')](this['channel'])+_0x732e('0xd')]=this[_0x732e('0xe')]['id'];}_0x1a36ff[_[_0x732e('0xc')](this[_0x732e('0x9')])+_0x732e('0xf')]=this['interaction']['id'];if(rpc[this[_0x732e('0x9')]+_0x732e('0x10')]){return rpc[this[_0x732e('0x9')]+_0x732e('0x10')]['create'](_0x1a36ff)[_0x732e('0x11')](function(_0x1e90e0){logger[_0x732e('0x12')]('[%s][MESSAGE]\x20%s',_0x547503,_0x1a36ff[_0x732e('0x13')]);_0x55d7b4['next']();})[_0x732e('0x14')](function(_0x54ef71){logger[_0x732e('0x15')]('[%s][MESSAGE]\x20%s',_0x547503,JSON['stringify'](_0x54ef71));_0x55d7b4[_0x732e('0x16')]();});}}catch(_0x197e72){logger[_0x732e('0x15')](_0x732e('0x17'),_0x547503,JSON[_0x732e('0x18')](_0x197e72));_0x55d7b4[_0x732e('0x16')]();}};}; \ No newline at end of file +var _0x20a9=['upperFirst','AccountId','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','account'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x20a9,0x14f));var _0x920a=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0x20a9[_0x30bd66];return _0x74c9dd;};'use strict';var _=require(_0x920a('0x0'));var utils=require(_0x920a('0x1'));var logger=require(_0x920a('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x920a('0x3')),'smsMessage':require(_0x920a('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x920a('0x5'))};exports['consequence']=function(_0x5de2c5,_0x535763){return function(_0x4ac9c2){try{var _0x7e6ff6={'body':utils[_0x920a('0x6')](_0x535763[0x0],this),'ContactId':this[_0x920a('0x7')]['id']};if(this[_0x920a('0x8')]==='chat'){_0x7e6ff6['ChatWebsiteId']=this[_0x920a('0x9')]['id'];}else{_0x7e6ff6[_[_0x920a('0xa')](this[_0x920a('0x8')])+_0x920a('0xb')]=this[_0x920a('0x9')]['id'];}_0x7e6ff6[_[_0x920a('0xa')](this[_0x920a('0x8')])+_0x920a('0xc')]=this[_0x920a('0xd')]['id'];if(rpc[this[_0x920a('0x8')]+'Message']){return rpc[this[_0x920a('0x8')]+_0x920a('0xe')][_0x920a('0xf')](_0x7e6ff6)['then'](function(_0x2173c1){logger[_0x920a('0x10')](_0x920a('0x11'),_0x5de2c5,_0x7e6ff6['body']);_0x4ac9c2[_0x920a('0x12')]();})[_0x920a('0x13')](function(_0x4a0eec){logger[_0x920a('0x14')](_0x920a('0x11'),_0x5de2c5,JSON[_0x920a('0x15')](_0x4a0eec));_0x4ac9c2[_0x920a('0x16')]();});}}catch(_0x5bd180){logger[_0x920a('0x14')](_0x920a('0x11'),_0x5de2c5,JSON[_0x920a('0x15')](_0x5bd180));_0x4ac9c2[_0x920a('0x16')]();}};}; \ 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 1bff44f..0e93b46 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 _0x2435=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stop','routing','consequence'];(function(_0x4b6c62,_0x1d1579){var _0x91f1bb=function(_0x31d077){while(--_0x31d077){_0x4b6c62['push'](_0x4b6c62['shift']());}};_0x91f1bb(++_0x1d1579);}(_0x2435,0x16a));var _0x5243=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x2435[_0x16b9ed];return _0x66b1f8;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x5243('0x0'));exports[_0x5243('0x1')]=function(_0x3efc02,_0x1a8242){return function(_0x4d1ba1){try{logger['info'](_0x5243('0x2'),_0x3efc02,utils[_0x5243('0x3')](_0x1a8242[0x0],this));_0x4d1ba1[_0x5243('0x4')]();}catch(_0xcb684f){logger[_0x5243('0x5')]('[%s][NOOP]\x20%s',_0x3efc02,JSON['stringify'](_0xcb684f));_0x4d1ba1[_0x5243('0x6')]();}};}; \ No newline at end of file +var _0xac2d=['next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x219424,_0x38286d){var _0x4d0fae=function(_0x1c311b){while(--_0x1c311b){_0x219424['push'](_0x219424['shift']());}};_0x4d0fae(++_0x38286d);}(_0xac2d,0xca));var _0xdac2=function(_0x4ecb58,_0x233093){_0x4ecb58=_0x4ecb58-0x0;var _0x578d45=_0xac2d[_0x4ecb58];return _0x578d45;};'use strict';var utils=require(_0xdac2('0x0'));var logger=require(_0xdac2('0x1'))(_0xdac2('0x2'));exports[_0xdac2('0x3')]=function(_0x484f69,_0x5218d8){return function(_0x663ba7){try{logger[_0xdac2('0x4')](_0xdac2('0x5'),_0x484f69,utils[_0xdac2('0x6')](_0x5218d8[0x0],this));_0x663ba7[_0xdac2('0x7')]();}catch(_0x40ef2b){logger[_0xdac2('0x8')]('[%s][NOOP]\x20%s',_0x484f69,JSON[_0xdac2('0x9')](_0x40ef2b));_0x663ba7[_0xdac2('0xa')]();}};}; \ 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 047a8bf..316c486 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 _0xf93a=['../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','YYYY-MM-DD\x20HH:mm:ss','accepted','update\x20queue\x20report','update','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','createQueue','atimeout','qtimeout','rules','end','close','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','log','stack','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','redis','defaults','socket.io-emitter','queue','from','joinAt','clone','queue_id','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove'];(function(_0x25a45a,_0x156e4b){var _0x237f87=function(_0x17c9e5){while(--_0x17c9e5){_0x25a45a['push'](_0x25a45a['shift']());}};_0x237f87(++_0x156e4b);}(_0xf93a,0x156));var _0xaf93=function(_0x18c825,_0x5aa7b1){_0x18c825=_0x18c825-0x0;var _0x319d17=_0xf93a[_0x18c825];return _0x319d17;};'use strict';var schema=require('validate');var _=require(_0xaf93('0x0'));var util=require(_0xaf93('0x1'));var seqqueue=require(_0xaf93('0x2'));var moment=require(_0xaf93('0x3'));var Redis=require('ioredis');var config=require(_0xaf93('0x4'));var logger=require(_0xaf93('0x5'))(_0xaf93('0x6'));var strategy=require('./strategy');config[_0xaf93('0x7')]=_[_0xaf93('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xaf93('0x9'))(new Redis(config[_0xaf93('0x7')]));var attributes=['id','queue_id','account',_0xaf93('0xa'),_0xaf93('0xb'),_0xaf93('0xc')];function emit(_0x3cb510,_0x299237,_0x18c7f0){io['to'](_0x3cb510)['emit'](_0x299237,_0x18c7f0);}function emitChannelQueueInteraction(_0x28cf8f,_0x2ff955,_0x8bcbd5,_0x4b3943,_0xab1950,_0x4378b5,_0x29e082,_0xb3c722){var _0x2f38ee=_[_0xaf93('0xd')](_0x8bcbd5);_0x2f38ee[_0xaf93('0xe')]=_0xb3c722;_0x2f38ee[_0xaf93('0xa')]=_0x2ff955;_0x2f38ee[_0xaf93('0xf')]=_0x4b3943;_0x2f38ee['id']=_0xab1950;if(_0x4378b5){_0x29e082[util[_0xaf93('0x10')](_0xaf93('0x11'),_0x28cf8f)][_0xab1950]=_[_0xaf93('0x12')](_0x2f38ee,attributes);}else{delete _0x29e082[util[_0xaf93('0x10')](_0xaf93('0x11'),_0x28cf8f)][_0xab1950];}emit(util[_0xaf93('0x10')](_0xaf93('0x13'),_0x28cf8f,_0x2ff955),util[_0xaf93('0x10')](_0xaf93('0x14'),_0x28cf8f,_0x4378b5?_0xaf93('0x15'):_0xaf93('0x16')),_[_0xaf93('0x12')](_0x2f38ee,attributes));}var rpc={'openchannelQueueReport':require(_0xaf93('0x17')),'mailQueueReport':require(_0xaf93('0x18')),'chatQueueReport':require(_0xaf93('0x19')),'smsQueueReport':require(_0xaf93('0x1a')),'faxQueueReport':require(_0xaf93('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0xaf93('0x1c')},'timeout':{'type':_0xaf93('0x1d'),'message':_0xaf93('0x1e')}});function startRouting(_0x3abfe4,_0x3746b2,_0x3f42dc,_0x45f43a){if(_0x3abfe4&&_0x3746b2&&_0x3f42dc){_0x3746b2[_0xaf93('0x1f')]+=0x1;var _0x2fdc93={'uniqueid':_0x3abfe4,'from':_0x3f42dc[_0xaf93('0x20')]?_0x3f42dc['body'][_0xaf93('0xb')]:'','joinAt':moment()[_0xaf93('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3f42dc[_0xaf93('0x21')]?_0x3f42dc[_0xaf93('0x21')]['id']:null,'ListId':_0x3f42dc[_0xaf93('0x22')]?_0x3f42dc['list']['id']:null};_0x2fdc93[_[_0xaf93('0x23')](_0x3f42dc[_0xaf93('0x24')])+_0xaf93('0x25')]=_0x3746b2['id']||null;_0x2fdc93[_[_0xaf93('0x23')](_0x3f42dc[_0xaf93('0x24')])+_0xaf93('0x26')]=_0x3f42dc[_0xaf93('0x27')]?_0x3f42dc[_0xaf93('0x27')]['id']:null;_0x2fdc93[_[_0xaf93('0x23')](_0x3f42dc[_0xaf93('0x24')])+'MessageId']=_0x3f42dc[_0xaf93('0x28')]?_0x3f42dc[_0xaf93('0x28')]['id']:null;_0x2fdc93[_['upperFirst'](_0x3f42dc[_0xaf93('0x24')])+(_0x3f42dc[_0xaf93('0x24')]!=='chat'?'AccountId':_0xaf93('0x29'))]=_0x3f42dc[_0xaf93('0xf')]?_0x3f42dc['account']['id']:null;logger[_0xaf93('0x2a')](util[_0xaf93('0x10')](_0xaf93('0x2b'),_0x3abfe4,_0x3746b2[_0xaf93('0x2c')]));emitChannelQueueInteraction(_0x3f42dc[_0xaf93('0x24')],_0x3746b2[_0xaf93('0x2c')],_0x2fdc93,_0x3f42dc['account'][_0xaf93('0x2c')],_0x3f42dc[_0xaf93('0x28')]['id'],!![],_0x45f43a,_0x3746b2['id']);if(rpc[_0x3f42dc[_0xaf93('0x24')]+_0xaf93('0x2d')]){return rpc[_0x3f42dc[_0xaf93('0x24')]+'QueueReport']['create'](_0x2fdc93)[_0xaf93('0x2e')](function(_0x3e6d90){logger[_0xaf93('0x2f')]('create\x20queue\x20report');});}}}function stopRouting(_0x236542,_0x48469e,_0x3c4732,_0x48dfc2){if(_0x236542&&_0x48469e){_0x48469e['waiting']-=0x1;var _0x9350b7={'leaveAt':moment()['format'](_0xaf93('0x30')),'acceptAt':moment()[_0xaf93('0x10')](_0xaf93('0x30')),'reason':_0xaf93('0x31')};logger[_0xaf93('0x2a')](util[_0xaf93('0x10')]('[%s][STOP:QUEUE][NAME:%s]',_0x236542,_0x48469e[_0xaf93('0x2c')]));emitChannelQueueInteraction(_0x3c4732['channel'],_0x48469e['name'],_0x3c4732[_0xaf93('0x20')],_0x3c4732[_0xaf93('0xf')]['name'],_0x3c4732[_0xaf93('0x28')]['id'],![],_0x48dfc2,_0x48469e['id']);if(rpc[_0x3c4732[_0xaf93('0x24')]+_0xaf93('0x2d')]){return rpc[_0x3c4732[_0xaf93('0x24')]+'QueueReport']['update'](_0x236542,_0x9350b7)[_0xaf93('0x2e')](function(_0x4b4134){logger[_0xaf93('0x2f')](_0xaf93('0x32'));});}}}function endRouting(_0x14750e,_0x3428c4,_0x4e56fe,_0xa89f2e){if(_0x14750e&&_0x3428c4){_0x3428c4['waiting']-=0x1;var _0x19e1ed={'leaveAt':moment()[_0xaf93('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xaf93('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0xaf93('0x2a')](util['format']('[%s][END:QUEUE][NAME:%s]',_0x14750e,_0x3428c4[_0xaf93('0x2c')]));emitChannelQueueInteraction(_0x4e56fe['channel'],_0x3428c4[_0xaf93('0x2c')],_0x4e56fe[_0xaf93('0x20')],_0x4e56fe[_0xaf93('0xf')][_0xaf93('0x2c')],_0x4e56fe[_0xaf93('0x28')]['id'],![],_0xa89f2e);if(rpc[_0x4e56fe['channel']+'QueueReport']){return rpc[_0x4e56fe[_0xaf93('0x24')]+'QueueReport'][_0xaf93('0x33')](_0x14750e,_0x19e1ed)[_0xaf93('0x2e')](function(_0x13261c){logger['error'](_0xaf93('0x32'));});}}}function handleFindQueue(_0x174cbf){return function(_0x5bb1d0){return _0x5bb1d0[_0xaf93('0x2c')][_0xaf93('0x34')]()===_0x174cbf[_0xaf93('0x34')]();};}exports[_0xaf93('0x35')]=function(_0x59a6c4,_0xfb7ce5,_0x52d81a,_0x780b92){return function(_0x2863ba){try{var _0x23bc88={'name':_0xfb7ce5[0x0],'timeout':_0xfb7ce5[0x1]};var _0x4c75c5=queue['validate'](_0x23bc88,{'typecast':!![]});if(_0x4c75c5['length']){logger[_0xaf93('0x2f')](_0xaf93('0x36'),_0x59a6c4,_[_0xaf93('0x37')](_0x4c75c5,_0xaf93('0x28'))[_0xaf93('0x38')](',\x20'));_0x2863ba[_0xaf93('0x39')]();}else{var _0x267605=_[_0xaf93('0x3a')](_0x52d81a[_0x780b92[_0xaf93('0x24')]+_0xaf93('0x3b')],handleFindQueue(_0x23bc88['name']));if(_0x267605){startRouting(_0x59a6c4,_0x267605,_0x780b92,_0x52d81a);var _0x50d708=(_0x267605[_0xaf93('0x3c')]||0xa)*0x3e8;var _0x14fb44=(_0x23bc88[_0xaf93('0x3c')]||0x14)*0x3e8;var _0xa9d947,_0x2c8847;if(_0x50d708>_0x14fb44){_0x14fb44=_0x50d708;}var _0x66a105=seqqueue[_0xaf93('0x3d')](_0x50d708);_0x66a105['id']=_0x59a6c4;_0x66a105[_0xaf93('0x3e')]=_0x50d708;_0x66a105[_0xaf93('0x3f')]=_0x14fb44;_0x66a105[_0xaf93('0x24')]=_0x780b92[_0xaf93('0x24')];_0x52d81a[_0xaf93('0x40')][_0x59a6c4]['on'](_0xaf93('0x41'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x59a6c4);stopRouting(_0x59a6c4,_0x267605,_0x780b92,_0x52d81a);clearTimeout(_0xa9d947);_0xa9d947=undefined;_0x66a105[_0xaf93('0x42')](!![]);if(_0x52d81a[_0xaf93('0x40')][_0x59a6c4]){delete _0x52d81a[_0xaf93('0x40')][_0x59a6c4];}_0x2863ba[_0xaf93('0x39')]();});_0x52d81a['rules'][_0x59a6c4]['on']('complete',function(){if(_0x52d81a['rules'][_0x59a6c4]){delete _0x52d81a[_0xaf93('0x40')][_0x59a6c4];}});_0xa9d947=setTimeout(function(){logger[_0xaf93('0x2a')](_0xaf93('0x43'),_0x59a6c4);endRouting(_0x59a6c4,_0x267605,_0x780b92,_0x52d81a);clearTimeout(_0xa9d947);_0x66a105[_0xaf93('0x42')](!![]);_0x2863ba['next']();},_0x14fb44);switch(_0x267605[_0xaf93('0x44')]){case _0xaf93('0x45'):strategy[_0xaf93('0x45')](_0x66a105,_0x267605,_0x52d81a,_0x780b92);break;default:strategy[_0xaf93('0x46')](_0x66a105,_0x267605,_0x52d81a,_0x780b92);}}else{logger['error']('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x59a6c4,_0x23bc88[_0xaf93('0x2c')]);_0x2863ba[_0xaf93('0x39')]();}}}catch(_0x287273){console[_0xaf93('0x47')](_0x287273);logger[_0xaf93('0x2f')](_0xaf93('0x36'),_0x59a6c4,_0x287273[_0xaf93('0x48')]);_0x2863ba['stop']();}};}; \ No newline at end of file +var _0x84fd=['routing','./strategy','redis','defaults','localhost','queue','from','emit','queue_id','account','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','timeout\x20is\x20a\x20number','body','contact','list','upperFirst','QueueId','channel','InteractionId','interaction','message','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','waiting','YYYY-MM-DD\x20HH:mm:ss','accepted','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/logger'];(function(_0x27140a,_0x40f606){var _0x1077fd=function(_0x721797){while(--_0x721797){_0x27140a['push'](_0x27140a['shift']());}};_0x1077fd(++_0x40f606);}(_0x84fd,0xda));var _0xd84f=function(_0x79eb23,_0x408131){_0x79eb23=_0x79eb23-0x0;var _0x4b8cf8=_0x84fd[_0x79eb23];return _0x4b8cf8;};'use strict';var schema=require(_0xd84f('0x0'));var _=require(_0xd84f('0x1'));var util=require(_0xd84f('0x2'));var seqqueue=require(_0xd84f('0x3'));var moment=require(_0xd84f('0x4'));var Redis=require(_0xd84f('0x5'));var config=require('../../../../config/environment');var logger=require(_0xd84f('0x6'))(_0xd84f('0x7'));var strategy=require(_0xd84f('0x8'));config[_0xd84f('0x9')]=_[_0xd84f('0xa')](config['redis'],{'host':_0xd84f('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd84f('0x9')]));var attributes=['id','queue_id','account',_0xd84f('0xc'),_0xd84f('0xd'),'joinAt'];function emit(_0x5a5436,_0x4633ea,_0x492c5e){io['to'](_0x5a5436)[_0xd84f('0xe')](_0x4633ea,_0x492c5e);}function emitChannelQueueInteraction(_0x468e9b,_0x268d71,_0x5d1fe7,_0x5c9604,_0x11eb70,_0x5df7ba,_0x3f60d9,_0x436755){var _0x258fb6=_['clone'](_0x5d1fe7);_0x258fb6[_0xd84f('0xf')]=_0x436755;_0x258fb6[_0xd84f('0xc')]=_0x268d71;_0x258fb6[_0xd84f('0x10')]=_0x5c9604;_0x258fb6['id']=_0x11eb70;if(_0x5df7ba){_0x3f60d9[util[_0xd84f('0x11')](_0xd84f('0x12'),_0x468e9b)][_0x11eb70]=_[_0xd84f('0x13')](_0x258fb6,attributes);}else{delete _0x3f60d9[util[_0xd84f('0x11')](_0xd84f('0x12'),_0x468e9b)][_0x11eb70];}emit(util[_0xd84f('0x11')]('%s:queue:%s',_0x468e9b,_0x268d71),util[_0xd84f('0x11')](_0xd84f('0x14'),_0x468e9b,_0x5df7ba?_0xd84f('0x15'):_0xd84f('0x16')),_['pick'](_0x258fb6,attributes));}var rpc={'openchannelQueueReport':require(_0xd84f('0x17')),'mailQueueReport':require(_0xd84f('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xd84f('0x19')),'faxQueueReport':require(_0xd84f('0x1a')),'whatsappQueueReport':require(_0xd84f('0x1b'))};var queue=schema({'name':{'type':_0xd84f('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xd84f('0x1d')}});function startRouting(_0x5dc6f5,_0x34a4df,_0x3d4187,_0xca18bf){if(_0x5dc6f5&&_0x34a4df&&_0x3d4187){_0x34a4df['waiting']+=0x1;var _0x4fccdc={'uniqueid':_0x5dc6f5,'from':_0x3d4187[_0xd84f('0x1e')]?_0x3d4187['body'][_0xd84f('0xd')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3d4187[_0xd84f('0x1f')]?_0x3d4187[_0xd84f('0x1f')]['id']:null,'ListId':_0x3d4187[_0xd84f('0x20')]?_0x3d4187[_0xd84f('0x20')]['id']:null};_0x4fccdc[_[_0xd84f('0x21')](_0x3d4187['channel'])+_0xd84f('0x22')]=_0x34a4df['id']||null;_0x4fccdc[_[_0xd84f('0x21')](_0x3d4187[_0xd84f('0x23')])+_0xd84f('0x24')]=_0x3d4187[_0xd84f('0x25')]?_0x3d4187[_0xd84f('0x25')]['id']:null;_0x4fccdc[_[_0xd84f('0x21')](_0x3d4187['channel'])+'MessageId']=_0x3d4187[_0xd84f('0x26')]?_0x3d4187[_0xd84f('0x26')]['id']:null;_0x4fccdc[_[_0xd84f('0x21')](_0x3d4187[_0xd84f('0x23')])+(_0x3d4187[_0xd84f('0x23')]!=='chat'?_0xd84f('0x27'):'WebsiteId')]=_0x3d4187[_0xd84f('0x10')]?_0x3d4187[_0xd84f('0x10')]['id']:null;logger[_0xd84f('0x28')](util[_0xd84f('0x11')](_0xd84f('0x29'),_0x5dc6f5,_0x34a4df[_0xd84f('0x2a')]));emitChannelQueueInteraction(_0x3d4187['channel'],_0x34a4df['name'],_0x4fccdc,_0x3d4187[_0xd84f('0x10')]['name'],_0x3d4187[_0xd84f('0x26')]['id'],!![],_0xca18bf,_0x34a4df['id']);if(rpc[_0x3d4187[_0xd84f('0x23')]+_0xd84f('0x2b')]){return rpc[_0x3d4187[_0xd84f('0x23')]+_0xd84f('0x2b')][_0xd84f('0x2c')](_0x4fccdc)[_0xd84f('0x2d')](function(_0x3d9a61){logger[_0xd84f('0x2e')]('create\x20queue\x20report');});}}}function stopRouting(_0x478807,_0x3b8237,_0x4b0693,_0x170557){if(_0x478807&&_0x3b8237){_0x3b8237[_0xd84f('0x2f')]-=0x1;var _0x3b3640={'leaveAt':moment()[_0xd84f('0x11')](_0xd84f('0x30')),'acceptAt':moment()[_0xd84f('0x11')](_0xd84f('0x30')),'reason':_0xd84f('0x31')};logger['info'](util[_0xd84f('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x478807,_0x3b8237[_0xd84f('0x2a')]));emitChannelQueueInteraction(_0x4b0693[_0xd84f('0x23')],_0x3b8237[_0xd84f('0x2a')],_0x4b0693[_0xd84f('0x1e')],_0x4b0693[_0xd84f('0x10')]['name'],_0x4b0693[_0xd84f('0x26')]['id'],![],_0x170557,_0x3b8237['id']);if(rpc[_0x4b0693[_0xd84f('0x23')]+_0xd84f('0x2b')]){return rpc[_0x4b0693['channel']+_0xd84f('0x2b')][_0xd84f('0x32')](_0x478807,_0x3b3640)[_0xd84f('0x2d')](function(_0x238705){logger['error'](_0xd84f('0x33'));});}}}function endRouting(_0xcb49e5,_0x59d51c,_0x29eb7c,_0x57ea59){if(_0xcb49e5&&_0x59d51c){_0x59d51c[_0xd84f('0x2f')]-=0x1;var _0x57053e={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xd84f('0x11')](_0xd84f('0x30')),'reason':_0xd84f('0x34')};logger[_0xd84f('0x28')](util[_0xd84f('0x11')](_0xd84f('0x35'),_0xcb49e5,_0x59d51c[_0xd84f('0x2a')]));emitChannelQueueInteraction(_0x29eb7c[_0xd84f('0x23')],_0x59d51c['name'],_0x29eb7c[_0xd84f('0x1e')],_0x29eb7c[_0xd84f('0x10')][_0xd84f('0x2a')],_0x29eb7c[_0xd84f('0x26')]['id'],![],_0x57ea59);if(rpc[_0x29eb7c[_0xd84f('0x23')]+_0xd84f('0x2b')]){return rpc[_0x29eb7c[_0xd84f('0x23')]+_0xd84f('0x2b')]['update'](_0xcb49e5,_0x57053e)[_0xd84f('0x2d')](function(_0x5e0439){logger[_0xd84f('0x2e')](_0xd84f('0x33'));});}}}function handleFindQueue(_0x339459){return function(_0x159cc3){return _0x159cc3[_0xd84f('0x2a')][_0xd84f('0x36')]()===_0x339459[_0xd84f('0x36')]();};}exports[_0xd84f('0x37')]=function(_0x3017f1,_0x307cc8,_0x478835,_0x13ce39){return function(_0x466e73){try{var _0x450539={'name':_0x307cc8[0x0],'timeout':_0x307cc8[0x1]};var _0x2752ea=queue[_0xd84f('0x0')](_0x450539,{'typecast':!![]});if(_0x2752ea[_0xd84f('0x38')]){logger['error'](_0xd84f('0x39'),_0x3017f1,_[_0xd84f('0x3a')](_0x2752ea,_0xd84f('0x26'))[_0xd84f('0x3b')](',\x20'));_0x466e73['stop']();}else{var _0x544eae=_[_0xd84f('0x3c')](_0x478835[_0x13ce39[_0xd84f('0x23')]+'Queues'],handleFindQueue(_0x450539[_0xd84f('0x2a')]));if(_0x544eae){startRouting(_0x3017f1,_0x544eae,_0x13ce39,_0x478835);var _0x2dfff6=(_0x544eae[_0xd84f('0x34')]||0xa)*0x3e8;var _0x5b6bdf=(_0x450539[_0xd84f('0x34')]||0x14)*0x3e8;var _0x25d6c7,_0xd78c05;if(_0x2dfff6>_0x5b6bdf){_0x5b6bdf=_0x2dfff6;}var _0x50d9eb=seqqueue[_0xd84f('0x3d')](_0x2dfff6);_0x50d9eb['id']=_0x3017f1;_0x50d9eb['atimeout']=_0x2dfff6;_0x50d9eb[_0xd84f('0x3e')]=_0x5b6bdf;_0x50d9eb[_0xd84f('0x23')]=_0x13ce39[_0xd84f('0x23')];_0x478835[_0xd84f('0x3f')][_0x3017f1]['on'](_0xd84f('0x40'),function(){logger[_0xd84f('0x28')](_0xd84f('0x41'),_0x3017f1);stopRouting(_0x3017f1,_0x544eae,_0x13ce39,_0x478835);clearTimeout(_0x25d6c7);_0x25d6c7=undefined;_0x50d9eb[_0xd84f('0x42')](!![]);if(_0x478835[_0xd84f('0x3f')][_0x3017f1]){delete _0x478835['rules'][_0x3017f1];}_0x466e73[_0xd84f('0x43')]();});_0x478835[_0xd84f('0x3f')][_0x3017f1]['on'](_0xd84f('0x44'),function(){if(_0x478835[_0xd84f('0x3f')][_0x3017f1]){delete _0x478835[_0xd84f('0x3f')][_0x3017f1];}});_0x25d6c7=setTimeout(function(){logger['info'](_0xd84f('0x45'),_0x3017f1);endRouting(_0x3017f1,_0x544eae,_0x13ce39,_0x478835);clearTimeout(_0x25d6c7);_0x50d9eb['close'](!![]);_0x466e73['next']();},_0x5b6bdf);switch(_0x544eae[_0xd84f('0x46')]){case _0xd84f('0x47'):strategy[_0xd84f('0x47')](_0x50d9eb,_0x544eae,_0x478835,_0x13ce39);break;default:strategy[_0xd84f('0x48')](_0x50d9eb,_0x544eae,_0x478835,_0x13ce39);}}else{logger['error'](_0xd84f('0x49'),_0x3017f1,_0x450539['name']);_0x466e73[_0xd84f('0x43')]();}}}catch(_0x2f0d33){console[_0xd84f('0x4a')](_0x2f0d33);logger[_0xd84f('0x2e')](_0xd84f('0x39'),_0x3017f1,_0x2f0d33['stack']);_0x466e73['stop']();}};}; \ 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 8b81062..b2906ac 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 _0x23ac=['prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout'];(function(_0xc5e8f2,_0x14e77c){var _0x5a6614=function(_0x5bac08){while(--_0x5bac08){_0xc5e8f2['push'](_0xc5e8f2['shift']());}};_0x5a6614(++_0x14e77c);}(_0x23ac,0x1e2));var _0xc23a=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0x23ac[_0x30bd66];return _0x74c9dd;};'use strict';var _=require(_0xc23a('0x0'));var uuid=require(_0xc23a('0x1'));var util=require(_0xc23a('0x2'));var logger=require(_0xc23a('0x3'))(_0xc23a('0x4'));var Agent=function(_0x5a0135,_0x6351bc,_0x3ed9c5,_0x350038){this[_0xc23a('0x5')]=uuid['v4']();this[_0xc23a('0x6')]=_0x5a0135;this[_0xc23a('0x7')]=_0x6351bc;this[_0xc23a('0x8')]=_0x3ed9c5;this[_0xc23a('0x4')]=_0x350038;this[_0xc23a('0x6')][_0xc23a('0x9')](this[_0xc23a('0xa')][_0xc23a('0xb')](this),this[_0xc23a('0xc')][_0xc23a('0xb')](this));this[_0xc23a('0x6')]['on'](_0xc23a('0xd'),this[_0xc23a('0xc')][_0xc23a('0xb')](this));this[_0xc23a('0x6')]['on']('drained',this['handleDrained'][_0xc23a('0xb')](this));};Agent[_0xc23a('0xe')][_0xc23a('0x9')]=function(){this[_0xc23a('0x6')][_0xc23a('0x9')](this[_0xc23a('0xa')]['bind'](this),this[_0xc23a('0xc')][_0xc23a('0xb')](this));};Agent[_0xc23a('0xe')]['handleDrained']=function(){this[_0xc23a('0xc')](!![]);};Agent[_0xc23a('0xe')][_0xc23a('0xa')]=function(_0x6d49c){logger[_0xc23a('0xf')](_0xc23a('0x10'),this[_0xc23a('0x6')]['id'],this[_0xc23a('0x7')]['id']);if(_[_0xc23a('0x11')](this[_0xc23a('0x8')][_0xc23a('0x12')][this[_0xc23a('0x7')]['id']])){logger[_0xc23a('0xf')](_0xc23a('0x13'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0xc23a('0x9')][_0xc23a('0xb')](this),0x3e8);}else{if(this[_0xc23a('0x4')][_0xc23a('0x14')]||util[_0xc23a('0x15')](this[_0xc23a('0x6')]['id'],this['realtime'][_0xc23a('0x12')][this[_0xc23a('0x7')]['id']],this['squeue'][_0xc23a('0x16')],![])){this[_0xc23a('0x8')][_0xc23a('0x12')][this[_0xc23a('0x7')]['id']][_0xc23a('0x17')]=!![];this[_0xc23a('0x8')][_0xc23a('0x12')][this['agent']['id']][_0xc23a('0x18')]=undefined;util[_0xc23a('0x19')](this[_0xc23a('0x5')],this[_0xc23a('0x6')]['id'],this[_0xc23a('0x8')]['agents'][this[_0xc23a('0x7')]['id']],null,this[_0xc23a('0x4')]);util[_0xc23a('0x1a')](this['squeue']['id'],this[_0xc23a('0x8')][_0xc23a('0x12')][this[_0xc23a('0x7')]['id']],'RINGING'+(this[_0xc23a('0x4')]['forcedOwnership']?_0xc23a('0x1b'):''));}else{logger[_0xc23a('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xc23a('0x6')]['id'],this[_0xc23a('0x7')]['id']);setTimeout(this[_0xc23a('0x9')]['bind'](this),0x3e8);}}};Agent[_0xc23a('0xe')][_0xc23a('0xc')]=function(_0x595c4d){if(_[_0xc23a('0x11')](this['realtime'][_0xc23a('0x12')][this[_0xc23a('0x7')]['id']])){return logger[_0xc23a('0xf')](_0xc23a('0x13'),this[_0xc23a('0x6')]['id'],this[_0xc23a('0x7')]['id']);}else{logger[_0xc23a('0xf')](_0xc23a('0x1c'),this[_0xc23a('0x6')]['id'],this[_0xc23a('0x7')]['id']);util[_0xc23a('0x1d')](this[_0xc23a('0x5')],this[_0xc23a('0x6')]['id'],this[_0xc23a('0x8')][_0xc23a('0x12')][this['agent']['id']],null,this[_0xc23a('0x4')]);this[_0xc23a('0x8')][_0xc23a('0x12')][this[_0xc23a('0x7')]['id']]['busy']=![];this['realtime'][_0xc23a('0x12')][this[_0xc23a('0x7')]['id']][_0xc23a('0x18')]=undefined;util['writeLog'](this[_0xc23a('0x6')]['id'],this[_0xc23a('0x8')][_0xc23a('0x12')][this[_0xc23a('0x7')]['id']],_0x595c4d?'STOP':_0xc23a('0x1e'));}if(!_0x595c4d){setTimeout(this[_0xc23a('0x9')]['bind'](this),0x3e8);}};function agent(_0x2b253c,_0x255809,_0x409ae6,_0x107e13){return new Agent(_0x2b253c,_0x255809,_0x409ae6,_0x107e13);}module['exports']=agent; \ No newline at end of file +var _0xb1fb=['push','bind','timeout','handleTimeout','drained','handleDrained','handleRun','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','busy','busyQueue','showNotification','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','lodash','uuid','../../../../../config/logger','notificationId','squeue','realtime','routing'];(function(_0x1c6ef2,_0x8d926a){var _0x404b8c=function(_0x4fdf1e){while(--_0x4fdf1e){_0x1c6ef2['push'](_0x1c6ef2['shift']());}};_0x404b8c(++_0x8d926a);}(_0xb1fb,0x185));var _0xbb1f=function(_0x4aed2c,_0x19fa3f){_0x4aed2c=_0x4aed2c-0x0;var _0x4cebb9=_0xb1fb[_0x4aed2c];return _0x4cebb9;};'use strict';var _=require(_0xbb1f('0x0'));var uuid=require(_0xbb1f('0x1'));var util=require('./util');var logger=require(_0xbb1f('0x2'))('routing');var Agent=function(_0x267a94,_0x54d914,_0x142f96,_0x3a073b){this[_0xbb1f('0x3')]=uuid['v4']();this[_0xbb1f('0x4')]=_0x267a94;this['agent']=_0x54d914;this[_0xbb1f('0x5')]=_0x142f96;this[_0xbb1f('0x6')]=_0x3a073b;this['squeue'][_0xbb1f('0x7')](this['handleRun'][_0xbb1f('0x8')](this),this['handleTimeout'][_0xbb1f('0x8')](this));this[_0xbb1f('0x4')]['on'](_0xbb1f('0x9'),this[_0xbb1f('0xa')][_0xbb1f('0x8')](this));this[_0xbb1f('0x4')]['on'](_0xbb1f('0xb'),this[_0xbb1f('0xc')]['bind'](this));};Agent['prototype'][_0xbb1f('0x7')]=function(){this[_0xbb1f('0x4')][_0xbb1f('0x7')](this[_0xbb1f('0xd')][_0xbb1f('0x8')](this),this[_0xbb1f('0xa')][_0xbb1f('0x8')](this));};Agent[_0xbb1f('0xe')][_0xbb1f('0xc')]=function(){this[_0xbb1f('0xa')](!![]);};Agent[_0xbb1f('0xe')][_0xbb1f('0xd')]=function(_0xf3c67e){logger[_0xbb1f('0xf')](_0xbb1f('0x10'),this['squeue']['id'],this['agent']['id']);if(_[_0xbb1f('0x11')](this[_0xbb1f('0x5')][_0xbb1f('0x12')][this[_0xbb1f('0x13')]['id']])){logger[_0xbb1f('0xf')](_0xbb1f('0x14'),this['squeue']['id'],this[_0xbb1f('0x13')]['id']);setTimeout(this[_0xbb1f('0x7')][_0xbb1f('0x8')](this),0x3e8);}else{if(this[_0xbb1f('0x6')]['forcedOwnership']||util['isAgentAvailable'](this['squeue']['id'],this[_0xbb1f('0x5')][_0xbb1f('0x12')][this[_0xbb1f('0x13')]['id']],this['squeue'][_0xbb1f('0x15')],![])){this[_0xbb1f('0x5')][_0xbb1f('0x12')][this['agent']['id']][_0xbb1f('0x16')]=!![];this['realtime'][_0xbb1f('0x12')][this[_0xbb1f('0x13')]['id']][_0xbb1f('0x17')]=undefined;util[_0xbb1f('0x18')](this[_0xbb1f('0x3')],this['squeue']['id'],this[_0xbb1f('0x5')][_0xbb1f('0x12')][this[_0xbb1f('0x13')]['id']],null,this['routing']);util['writeLog'](this['squeue']['id'],this[_0xbb1f('0x5')][_0xbb1f('0x12')][this[_0xbb1f('0x13')]['id']],_0xbb1f('0x19')+(this[_0xbb1f('0x6')][_0xbb1f('0x1a')]?_0xbb1f('0x1b'):''));}else{logger[_0xbb1f('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0xbb1f('0x4')]['id'],this[_0xbb1f('0x13')]['id']);setTimeout(this[_0xbb1f('0x7')]['bind'](this),0x3e8);}}};Agent[_0xbb1f('0xe')][_0xbb1f('0xa')]=function(_0x42a39a){if(_['isNil'](this[_0xbb1f('0x5')][_0xbb1f('0x12')][this['agent']['id']])){return logger[_0xbb1f('0xf')](_0xbb1f('0x14'),this[_0xbb1f('0x4')]['id'],this[_0xbb1f('0x13')]['id']);}else{logger[_0xbb1f('0xf')](_0xbb1f('0x1c'),this[_0xbb1f('0x4')]['id'],this[_0xbb1f('0x13')]['id']);util[_0xbb1f('0x1d')](this[_0xbb1f('0x3')],this[_0xbb1f('0x4')]['id'],this['realtime'][_0xbb1f('0x12')][this[_0xbb1f('0x13')]['id']],null,this[_0xbb1f('0x6')]);this[_0xbb1f('0x5')]['agents'][this[_0xbb1f('0x13')]['id']]['busy']=![];this[_0xbb1f('0x5')][_0xbb1f('0x12')][this[_0xbb1f('0x13')]['id']]['busyQueue']=undefined;util[_0xbb1f('0x1e')](this[_0xbb1f('0x4')]['id'],this[_0xbb1f('0x5')][_0xbb1f('0x12')][this[_0xbb1f('0x13')]['id']],_0x42a39a?_0xbb1f('0x1f'):_0xbb1f('0x20'));}if(!_0x42a39a){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x53dc94,_0x271d7c,_0x2acbf1,_0x1ea912){return new Agent(_0x53dc94,_0x271d7c,_0x2acbf1,_0x1ea912);}module['exports']=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 40a7c5e..44922d3 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 _0xee14=['hideNotification','STOP','TIMEOUT','exports','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','isNil','queue','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','busy','busyQueue','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY'];(function(_0x1d52e8,_0x41903e){var _0x298689=function(_0x457769){while(--_0x457769){_0x1d52e8['push'](_0x1d52e8['shift']());}};_0x298689(++_0x41903e);}(_0xee14,0x13a));var _0x4ee1=function(_0x573fbe,_0x49aa88){_0x573fbe=_0x573fbe-0x0;var _0x5870ae=_0xee14[_0x573fbe];return _0x5870ae;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x4ee1('0x0'));var logger=require(_0x4ee1('0x1'))(_0x4ee1('0x2'));var Beepall=function(_0x1fa407,_0x18e3c4,_0x236ccd,_0x34a0ae){this[_0x4ee1('0x3')]=uuid['v4']();this[_0x4ee1('0x4')]=_0x1fa407;this['queue']=_0x18e3c4;this[_0x4ee1('0x5')]=_0x236ccd;this['routing']=_0x34a0ae;this[_0x4ee1('0x4')][_0x4ee1('0x6')](this[_0x4ee1('0x7')][_0x4ee1('0x8')](this),this[_0x4ee1('0x9')][_0x4ee1('0x8')](this));this['squeue']['on'](_0x4ee1('0xa'),this[_0x4ee1('0x9')]['bind'](this));this[_0x4ee1('0x4')]['on'](_0x4ee1('0xb'),this[_0x4ee1('0xc')][_0x4ee1('0x8')](this));};Beepall['prototype'][_0x4ee1('0x6')]=function(){this[_0x4ee1('0x4')][_0x4ee1('0x6')](this[_0x4ee1('0x7')][_0x4ee1('0x8')](this),this[_0x4ee1('0x9')]['bind'](this));};Beepall[_0x4ee1('0xd')][_0x4ee1('0xc')]=function(_0x1096a5){this[_0x4ee1('0x9')](!![]);};Beepall[_0x4ee1('0xd')][_0x4ee1('0x7')]=function(_0x2ffb2d){var _0x359bab=!![];if(!_[_0x4ee1('0xe')](this['queue'])&&!_[_0x4ee1('0xe')](this[_0x4ee1('0xf')][_0x4ee1('0x10')])&&this[_0x4ee1('0xf')][_0x4ee1('0x10')][_0x4ee1('0x11')]>0x0){for(var _0x2eff91=0x0,_0x2b8f0e;_0x2eff910x0){for(var _0x4244a2=0x0,_0x47885b;_0x4244a20x0&&_0x3fd56b[_0x57d26e+'CurrentCapacity']>=_0x3fd56b[_0x57d26e+_0xc430('0x1d')]){writeLog(_0x56dd16,_0x3fd56b,_0x57d26e[_0xc430('0x1f')]()+_0xc430('0x20'));return![];}}return!![];};exports[_0xc430('0x21')]=function(_0x285407,_0x57cd72,_0x2ccc13,_0x1a9512,_0x1c1da9){return sendNotification(!![],_0x285407,_0x57cd72,_0x2ccc13,_0x1a9512,_0x1c1da9);};exports[_0xc430('0x22')]=function(_0x542cba,_0x1f8086,_0x4cf56c,_0x1d65ee,_0x4ad29e){return sendNotification(![],_0x542cba,_0x1f8086,_0x4cf56c,_0x1d65ee,_0x4ad29e);};exports[_0xc430('0x23')]=writeLog; \ No newline at end of file +var _0xb091=['user:save','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','showNotification','hideNotification','writeLog','util','../utils','mustache','ioredis','../../../../../config/logger','defaults','redis','socket.io-emitter','emit','format','user:%s','name'];(function(_0x11f555,_0x3fa680){var _0x31e6d1=function(_0x302135){while(--_0x302135){_0x11f555['push'](_0x11f555['shift']());}};_0x31e6d1(++_0x3fa680);}(_0xb091,0x16e));var _0x1b09=function(_0x3461b3,_0x135ae3){_0x3461b3=_0x3461b3-0x0;var _0x4787d4=_0xb091[_0x3461b3];return _0x4787d4;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var utils=require(_0x1b09('0x1'));var Mustache=require(_0x1b09('0x2'));var Redis=require(_0x1b09('0x3'));var config=require('../../../../../config/environment');var logger=require(_0x1b09('0x4'))('routing');config['redis']=_[_0x1b09('0x5')](config[_0x1b09('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x1b09('0x7'))(new Redis(config[_0x1b09('0x6')]));function emit(_0x2bf4f6,_0x5ce726,_0x142c33){io['to'](_0x2bf4f6)[_0x1b09('0x8')](_0x5ce726,_0x142c33);}function sendNotification(_0x2f359f,_0x328815,_0x159b95,_0x3362e4,_0x211f05,_0x124d02){io['to'](util[_0x1b09('0x9')](_0x1b09('0xa'),_0x3362e4[_0x1b09('0xb')]))['emit'](_0x1b09('0xc'),_0x3362e4);var _0x894b73=_0x124d02||{};var _0x5690cb=_0x159b95['split']('.');var _0x3839d9={'uniqueid':_0x328815,'channel':_0x5690cb[0x0],'id':_0x5690cb[0x1],'title':_0x5690cb[0x0]+_0x1b09('0xd'),'interactionId':_0x5690cb[0x2],'queue':_0x211f05?_0x211f05[_0x1b09('0xb')]:null,'sound':_0x894b73[_0x1b09('0xe')][_0x1b09('0xf')],'shake':_0x894b73[_0x1b09('0xe')][_0x1b09('0x10')]};try{if(!_0x894b73['body']){_0x894b73[_0x1b09('0x11')]={};}if(_0x211f05){_0x894b73['body'][_0x1b09('0x12')]=_0x211f05;}else if(_0x894b73[_0x1b09('0x11')][_0x1b09('0x12')]){delete _0x894b73[_0x1b09('0x11')][_0x1b09('0x12')];}_0x3839d9[_0x1b09('0x13')]=utils[_0x1b09('0x14')](_0x894b73[_0x1b09('0xe')][_0x1b09('0x15')],_0x894b73);}catch(_0x32244e){_0x3839d9[_0x1b09('0x13')]=_0x1b09('0x16');logger[_0x1b09('0x17')](util['format'](_0x1b09('0x18'),_0x328815,_0x32244e[_0x1b09('0x19')]));}io['to'](util['format']('user:%s',_0x3362e4[_0x1b09('0xb')]))['emit'](util[_0x1b09('0x9')]('notification:%s',_0x2f359f?_0x1b09('0x1a'):_0x1b09('0x1b')),_0x3839d9);}function writeLog(_0x2d6dba,_0x1e8f97,_0x29dd70){return logger[_0x1b09('0x1c')](util[_0x1b09('0x9')](_0x1b09('0x1d'),_0x2d6dba,_0x1e8f97['name'],_0x29dd70));}exports['isAgentAvailable']=function(_0x27f4f5,_0x41c786,_0x4ce7dc,_0x3c0496){if(_0x41c786[_0x1b09('0x1e')]){writeLog(_0x27f4f5,_0x41c786,_0x1b09('0x1f'));return![];}if(!_0x41c786[_0x1b09('0x20')]){writeLog(_0x27f4f5,_0x41c786,'OFFLINE');return![];}if(_0x41c786[_0x4ce7dc+_0x1b09('0x21')]){writeLog(_0x27f4f5,_0x41c786,_0x1b09('0x22'));return![];}if(_0x3c0496&&_0x41c786['hasOwnProperty'](_0x4ce7dc+_0x1b09('0x23'))&&_0x41c786[_0x1b09('0x24')](_0x4ce7dc+'CurrentCapacity')){if(_0x41c786[_0x4ce7dc+_0x1b09('0x23')]>0x0&&_0x41c786[_0x4ce7dc+_0x1b09('0x25')]>=_0x41c786[_0x4ce7dc+_0x1b09('0x23')]){writeLog(_0x27f4f5,_0x41c786,_0x4ce7dc[_0x1b09('0x26')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x1b09('0x27')]=function(_0x3cdbc5,_0x532589,_0x2d1ec0,_0x406748,_0x26befb){return sendNotification(!![],_0x3cdbc5,_0x532589,_0x2d1ec0,_0x406748,_0x26befb);};exports[_0x1b09('0x28')]=function(_0x11098e,_0x1aa179,_0x34620f,_0x5a503d,_0x22e3ee){return sendNotification(![],_0x11098e,_0x1aa179,_0x34620f,_0x5a503d,_0x22e3ee);};exports[_0x1b09('0x29')]=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 63edebb..021a150 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 _0x547b=['getMustacheRender','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','map','message','join','info','next'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x547b,0x150));var _0xb547=function(_0x656405,_0x397579){_0x656405=_0x656405-0x0;var _0x36f72f=_0x547b[_0x656405];return _0x36f72f;};'use strict';var schema=require(_0xb547('0x0'));var sh=require(_0xb547('0x1'));var _=require(_0xb547('0x2'));var utils=require(_0xb547('0x3'));var logger=require(_0xb547('0x4'))(_0xb547('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0xb547('0x6')}});exports[_0xb547('0x7')]=function(_0x1e0ba8,_0x1d0b25){return function(_0x4f2e3f){try{var _0x31aabf={'command':_0x1d0b25[0x0]};var _0x399477=system['validate'](_0x31aabf,{'typecast':!![]});if(_0x399477[_0xb547('0x8')]){logger['error']('[%s][SYSTEM]\x20%s',_0x1e0ba8,_[_0xb547('0x9')](_0x399477,_0xb547('0xa'))[_0xb547('0xb')](',\x20'));logger[_0xb547('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1e0ba8);_0x4f2e3f[_0xb547('0xd')]();}else{var _0x58d23a=this;var _0x4fbea9=utils[_0xb547('0xe')](_0x1d0b25[0x0],this);logger[_0xb547('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x1e0ba8,_0x4fbea9);sh['exec'](_['trim'](_0x4fbea9),function(_0x1420ba,_0x1dd09b){logger[_0xb547('0xc')](_0xb547('0xf'),_0x1e0ba8,_0x1420ba);if(_0x1420ba==0x0){var _0x918d3e=_0x1dd09b[_0xb547('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0xb547('0x11')](_0x1d0b25[0x1])||_['isEmpty'](_0x1d0b25[0x1])){logger[_0xb547('0xc')](_0xb547('0x12'),_0x1e0ba8);_0x58d23a[_0xb547('0x13')][_0x1d0b25[0x1]]=_0x918d3e;}else{logger[_0xb547('0xc')](_0xb547('0x14'),_0x1e0ba8,_0x1d0b25[0x1],_0x918d3e);_0x58d23a[_0xb547('0x13')][_0x1d0b25[0x1]]=_0x918d3e;}}_0x4f2e3f[_0xb547('0xd')]();});}}catch(_0x2f8062){logger[_0xb547('0x15')]('[%s][SYSTEM]\x20%s',_0x1e0ba8,_[_0xb547('0x16')](_0x2f8062)?JSON[_0xb547('0x17')](_0x2f8062):_0x2f8062);logger[_0xb547('0xc')](_0xb547('0x18'),_0x1e0ba8);_0x4f2e3f[_0xb547('0xd')]();}};}; \ No newline at end of file +var _0x4cbc=['../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','error','isObject','stringify','shelljs','./utils'];(function(_0x440f30,_0xe11022){var _0x26040b=function(_0x4e523e){while(--_0x4e523e){_0x440f30['push'](_0x440f30['shift']());}};_0x26040b(++_0xe11022);}(_0x4cbc,0x127));var _0xc4cb=function(_0x4d56f7,_0x213776){_0x4d56f7=_0x4d56f7-0x0;var _0x431d99=_0x4cbc[_0x4d56f7];return _0x431d99;};'use strict';var schema=require('validate');var sh=require(_0xc4cb('0x0'));var _=require('lodash');var utils=require(_0xc4cb('0x1'));var logger=require(_0xc4cb('0x2'))(_0xc4cb('0x3'));var system=schema({'command':{'type':'string','required':!![],'message':_0xc4cb('0x4')}});exports[_0xc4cb('0x5')]=function(_0x3c33b1,_0x5a7608){return function(_0x2b1502){try{var _0x5cf49e={'command':_0x5a7608[0x0]};var _0x25abb7=system[_0xc4cb('0x6')](_0x5cf49e,{'typecast':!![]});if(_0x25abb7['length']){logger['error'](_0xc4cb('0x7'),_0x3c33b1,_[_0xc4cb('0x8')](_0x25abb7,_0xc4cb('0x9'))[_0xc4cb('0xa')](',\x20'));logger[_0xc4cb('0xb')](_0xc4cb('0xc'),_0x3c33b1);_0x2b1502[_0xc4cb('0xd')]();}else{var _0x579eb6=this;var _0x312c5c=utils['getMustacheRender'](_0x5a7608[0x0],this);logger[_0xc4cb('0xb')](_0xc4cb('0xe'),_0x3c33b1,_0x312c5c);sh[_0xc4cb('0xf')](_[_0xc4cb('0x10')](_0x312c5c),function(_0x153e24,_0x544543){logger['info'](_0xc4cb('0x11'),_0x3c33b1,_0x153e24);if(_0x153e24==0x0){var _0x42d9ff=_0x544543[_0xc4cb('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0xc4cb('0x13')](_0x5a7608[0x1])||_[_0xc4cb('0x14')](_0x5a7608[0x1])){logger['info'](_0xc4cb('0x15'),_0x3c33b1);_0x579eb6['body'][_0x5a7608[0x1]]=_0x42d9ff;}else{logger[_0xc4cb('0xb')](_0xc4cb('0x16'),_0x3c33b1,_0x5a7608[0x1],_0x42d9ff);_0x579eb6[_0xc4cb('0x17')][_0x5a7608[0x1]]=_0x42d9ff;}}_0x2b1502[_0xc4cb('0xd')]();});}}catch(_0x18ca4c){logger[_0xc4cb('0x18')]('[%s][SYSTEM]\x20%s',_0x3c33b1,_[_0xc4cb('0x19')](_0x18ca4c)?JSON[_0xc4cb('0x1a')](_0x18ca4c):_0x18ca4c);logger[_0xc4cb('0xb')](_0xc4cb('0xc'),_0x3c33b1);_0x2b1502[_0xc4cb('0xd')]();}};}; \ 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 cd65f9e..b8bd3f4 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 _0xfaf0=['validate','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','then','info','interaction','catch','stringify','isObject'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0xfaf0,0x187));var _0x0faf=function(_0x1cd2f3,_0x10bd63){_0x1cd2f3=_0x1cd2f3-0x0;var _0x3570c9=_0xfaf0[_0x1cd2f3];return _0x3570c9;};'use strict';var schema=require(_0x0faf('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x0faf('0x1')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x0faf('0x2')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x0faf('0x3'))(_0x0faf('0x4'));var tag=schema({'tag':{'type':_0x0faf('0x5'),'required':!![],'message':_0x0faf('0x6')}});exports[_0x0faf('0x7')]=function(_0x226d23,_0x15132d,_0x3c3040,_0x31a899){return function(_0x57eed2){try{var _0x6e2845={'tag':_0x15132d[0x0]};var _0x9fcd0=tag[_0x0faf('0x0')](_0x6e2845,{'typecast':!![]});if(_0x9fcd0[_0x0faf('0x8')]){logger[_0x0faf('0x9')](_0x0faf('0xa'),_0x226d23,_['map'](_0x9fcd0,_0x0faf('0xb'))[_0x0faf('0xc')](',\x20'));logger['info'](_0x0faf('0xd'),_0x226d23);_0x57eed2[_0x0faf('0xe')]();}else{var _0x557a18={'ids':[_0x15132d[0x0]]};if(rpc[_0x31a899[_0x0faf('0xf')]+'Interaction']){rpc[_0x31a899[_0x0faf('0xf')]+_0x0faf('0x10')]['addTags'](_0x31a899['interaction']['id'],_0x557a18)[_0x0faf('0x11')](function(_0x13d02d){logger[_0x0faf('0x12')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x226d23,_0x15132d[0x1],_0x31a899['channel'],_0x31a899[_0x0faf('0x13')]['id']);})[_0x0faf('0x14')](function(_0x771d1c){logger[_0x0faf('0x9')](_0x0faf('0xa'),_0x226d23,JSON[_0x0faf('0x15')](_0x771d1c));logger[_0x0faf('0x12')](_0x0faf('0xd'),_0x226d23);})['finally'](function(){_0x57eed2[_0x0faf('0xe')]();});}}}catch(_0x264310){logger[_0x0faf('0x9')](_0x0faf('0xa'),_0x226d23,_[_0x0faf('0x16')](_0x264310)?JSON[_0x0faf('0x15')](_0x264310):_0x264310);logger[_0x0faf('0x12')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x226d23);_0x57eed2['next']();}};}; \ No newline at end of file +var _0xb392=['../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','interaction','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','next','[%s][TAG]\x20%s','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0xb392,0x19c));var _0x2b39=function(_0x22ed5b,_0x3690ee){_0x22ed5b=_0x22ed5b-0x0;var _0x416f14=_0xb392[_0x22ed5b];return _0x416f14;};'use strict';var schema=require(_0x2b39('0x0'));var _=require(_0x2b39('0x1'));var rpc={'chatInteraction':require(_0x2b39('0x2')),'openchannelInteraction':require(_0x2b39('0x3')),'smsInteraction':require(_0x2b39('0x4')),'mailInteraction':require(_0x2b39('0x5')),'faxInteraction':require(_0x2b39('0x6')),'whatsappInteraction':require(_0x2b39('0x7'))};var logger=require(_0x2b39('0x8'))(_0x2b39('0x9'));var tag=schema({'tag':{'type':_0x2b39('0xa'),'required':!![],'message':_0x2b39('0xb')}});exports[_0x2b39('0xc')]=function(_0x2b0ed5,_0x23e453,_0x481b60,_0x5d48b3){return function(_0x2e13e7){try{var _0x15418e={'tag':_0x23e453[0x0]};var _0x210fb9=tag['validate'](_0x15418e,{'typecast':!![]});if(_0x210fb9[_0x2b39('0xd')]){logger[_0x2b39('0xe')]('[%s][TAG]\x20%s',_0x2b0ed5,_[_0x2b39('0xf')](_0x210fb9,_0x2b39('0x10'))[_0x2b39('0x11')](',\x20'));logger[_0x2b39('0x12')](_0x2b39('0x13'),_0x2b0ed5);_0x2e13e7['next']();}else{var _0xa60ee8={'ids':[_0x23e453[0x0]]};if(rpc[_0x5d48b3[_0x2b39('0x14')]+'Interaction']){rpc[_0x5d48b3[_0x2b39('0x14')]+_0x2b39('0x15')]['addTags'](_0x5d48b3[_0x2b39('0x16')]['id'],_0xa60ee8)['then'](function(_0x3fb386){logger[_0x2b39('0x12')](_0x2b39('0x17'),_0x2b0ed5,_0x23e453[0x1],_0x5d48b3[_0x2b39('0x14')],_0x5d48b3[_0x2b39('0x16')]['id']);})[_0x2b39('0x18')](function(_0x2a0564){logger['error']('[%s][TAG]\x20%s',_0x2b0ed5,JSON[_0x2b39('0x19')](_0x2a0564));logger[_0x2b39('0x12')](_0x2b39('0x13'),_0x2b0ed5);})[_0x2b39('0x1a')](function(){_0x2e13e7[_0x2b39('0x1b')]();});}}}catch(_0x3726c3){logger['error'](_0x2b39('0x1c'),_0x2b0ed5,_[_0x2b39('0x1d')](_0x3726c3)?JSON[_0x2b39('0x19')](_0x3726c3):_0x3726c3);logger['info'](_0x2b39('0x13'),_0x2b0ed5);_0x2e13e7['next']();}};}; \ 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 086f0e2..dadb905 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(_0x1e3c8,_0x342fa1){var _0x1344e5=function(_0xdfff28){while(--_0xdfff28){_0x1e3c8['push'](_0x1e3c8['shift']());}};_0x1344e5(++_0x342fa1);}(_0xe706,0xa3));var _0x6e70=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0xe706[_0xd816e2];return _0x1f5924;};'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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x20efd3,_0x379a04){var _0x19e7b3=function(_0x224d27){while(--_0x224d27){_0x20efd3['push'](_0x20efd3['shift']());}};_0x19e7b3(++_0x379a04);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 6a6b6cd..71a08f2 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 _0x682e=['path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','join','app','.js','toLowerCase','appdata','mail','push','slice','dialogflow','split','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','matchPath','No\x20applications\x20to\x20execute','agent','agents','busy','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','stack','emit','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','stringify','RPC\x20listening\x20on\x20port:','lodash'];(function(_0x47d618,_0x446d60){var _0x1969f1=function(_0x5d5622){while(--_0x5d5622){_0x47d618['push'](_0x47d618['shift']());}};_0x1969f1(++_0x446d60);}(_0x682e,0x119));var _0xe682=function(_0x43556b,_0x435d2c){_0x43556b=_0x43556b-0x0;var _0x28b0c4=_0x682e[_0x43556b];return _0x28b0c4;};'use strict';var _=require(_0xe682('0x0'));var util=require('util');var path=require(_0xe682('0x1'));var fs=require('fs');var jayson=require(_0xe682('0x2'));var BPromise=require(_0xe682('0x3'));var uuid=require(_0xe682('0x4'));var config=require(_0xe682('0x5'));var logger=require(_0xe682('0x6'))(_0xe682('0x7'));var rpc={'openchannelQueueReport':require(_0xe682('0x8')),'mailQueueReport':require(_0xe682('0x9')),'chatQueueReport':require(_0xe682('0xa')),'smsQueueReport':require(_0xe682('0xb')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xe682('0xc'))};var RuleEngine=require(_0xe682('0xd'));function getId(_0x214393,_0x283937,_0x5d9cd5){return util[_0xe682('0xe')](_0xe682('0xf'),_0x214393,_0x283937||0x0,_0x5d9cd5||0x0);}function getIntervals(_0xc6d5fe,_0x1a85c6){var _0x10a39e=[];if(!_[_0xe682('0x10')](_0x1a85c6['IntervalId'])&&!_[_0xe682('0x10')](_0xc6d5fe[_0x1a85c6[_0xe682('0x11')]])&&!_['isNil'](_0xc6d5fe[_0x1a85c6[_0xe682('0x11')]][_0xe682('0x12')])){_0x10a39e=_[_0xe682('0x13')](_0xc6d5fe[_0x1a85c6[_0xe682('0x11')]][_0xe682('0x12')],_0xe682('0x14'));}else if(!_[_0xe682('0x10')](_0x1a85c6['interval'])){_0x10a39e=[_0x1a85c6[_0xe682('0x14')]];}return _0x10a39e;}exports[_0xe682('0x15')]=function(_0x2036c0){_0x2036c0[_0xe682('0x16')]={};return new BPromise(function(_0x1fa28c,_0xf81087){var _0x174ea9={'Start':function(_0x4f6e13){var _0x59ab3c=this;return new Promise(function(_0x273948,_0xd0f68e){if(_0x4f6e13){try{var _0xaf406e=[];var _0x4df79a=getId(_0x4f6e13[_0xe682('0x17')],_0x4f6e13[_0xe682('0x18')]?_0x4f6e13[_0xe682('0x18')]['id']:0x0,_0x4f6e13[_0xe682('0x19')]?_0x4f6e13['interaction']['id']:0x0);if(_0x4f6e13[_0xe682('0x1a')]&&_[_0xe682('0x1b')](_0x4f6e13['applications'])&&_0x4f6e13['applications'][_0xe682('0x1c')]){for(var _0x3e824c=0x0;_0x3e824c<_0x4f6e13[_0xe682('0x1a')][_0xe682('0x1c')];_0x3e824c+=0x1){var _0x348a12=_0x4f6e13[_0xe682('0x1a')][_0x3e824c];if(fs['existsSync'](path[_0xe682('0x1d')](__dirname,_0xe682('0x1a'),_0x348a12[_0xe682('0x1e')]+_0xe682('0x1f')))){var _0x50cb7f=[];switch(_0x348a12['app'][_0xe682('0x20')]()){case'autoreply':var _0x10ada7=_0x348a12[_0xe682('0x21')]['split'](',');if(_0x4f6e13[_0xe682('0x17')]===_0xe682('0x22')){_0x50cb7f[_0xe682('0x23')](_0x10ada7[0x0]);_0x50cb7f[_0xe682('0x23')](_0x10ada7[0x1]);_0x50cb7f['push'](_0x10ada7['slice'](0x2,_0x10ada7[_0xe682('0x1c')])[_0xe682('0x1d')](','));}else{_0x50cb7f[_0xe682('0x23')](_0x10ada7[0x0]);_0x50cb7f[_0xe682('0x23')](_0x10ada7[_0xe682('0x24')](0x1,_0x10ada7[_0xe682('0x1c')])[_0xe682('0x1d')](','));}break;case _0xe682('0x25'):var _0x4f9a8d=_0x348a12[_0xe682('0x21')][_0xe682('0x26')](',');_0x50cb7f[_0xe682('0x23')](_0x4f9a8d[0x0]);_0x50cb7f['push'](_0x4f9a8d[0x1]);_0x50cb7f['push'](_0x4f9a8d[_0xe682('0x24')](0x2,_0x4f9a8d[_0xe682('0x1c')])[_0xe682('0x1d')](','));break;case'dialogflowv2':var _0x193ad0=_0x348a12[_0xe682('0x21')][_0xe682('0x26')](',');_0x50cb7f['push'](_0x193ad0[0x0]);_0x50cb7f['push'](_0x193ad0[0x1]);_0x50cb7f['push'](_0x193ad0[0x2]);_0x50cb7f['push'](_0x193ad0[0x3]);_0x50cb7f['push'](_0x193ad0[_0xe682('0x24')](0x4,_0x193ad0[_0xe682('0x1c')])[_0xe682('0x1d')](','));break;case _0xe682('0x27'):var _0x1744db=_0x348a12['appdata'][_0xe682('0x26')](',');_0x50cb7f[_0xe682('0x23')](_0x1744db[0x0]);_0x50cb7f[_0xe682('0x23')](_0x1744db[0x1]);_0x50cb7f['push'](_0x1744db[0x2]);_0x50cb7f[_0xe682('0x23')](_0x1744db[0x3]);_0x50cb7f[_0xe682('0x23')](_0x1744db[_0xe682('0x24')](0x4,_0x1744db['length'])[_0xe682('0x1d')](','));break;case _0xe682('0x18'):_0x50cb7f[_0xe682('0x23')](_0x348a12[_0xe682('0x21')]);break;case _0xe682('0x28'):_0x50cb7f[_0xe682('0x23')](_0x348a12[_0xe682('0x29')]);_0x50cb7f[_0xe682('0x23')](_0x348a12[_0xe682('0x21')]);break;default:_0x50cb7f=_['isNil'](_0x348a12[_0xe682('0x21')])?[]:_0x348a12['appdata'][_0xe682('0x26')](',');}var _0x2955e4={'id':util[_0xe682('0xe')](_0xe682('0x2a'),_0x4df79a,_0x348a12['id'],_0x348a12[_0xe682('0x1e')]),'condition':require(_0xe682('0x2b'))[_0xe682('0x2c')](_0x4df79a,getIntervals(_0x2036c0[_0xe682('0x2d')],_0x348a12),_0x2036c0),'consequence':require(_0xe682('0x2e')+_0x348a12['app'])[_0xe682('0x2f')](_0x4df79a,_0x50cb7f,_0x2036c0,_0x4f6e13),'p':_0x348a12[_0xe682('0x30')]||0x0};logger[_0xe682('0x31')](_0xe682('0x32'),_0x2955e4['id'],_0xe682('0x33'),getIntervals(_0x2036c0[_0xe682('0x2d')],_0x348a12)['join'](_0xe682('0x34')));_0xaf406e[_0xe682('0x23')](_0x2955e4);}else{logger[_0xe682('0x35')](_0xe682('0x36'),path[_0xe682('0x1d')](__dirname,'applications',_0x348a12[_0xe682('0x1e')]+_0xe682('0x1f')));}}_0x2036c0[_0xe682('0x16')][_0x4df79a]=new RuleEngine(_0xaf406e);_0x2036c0[_0xe682('0x16')][_0x4df79a]['execute'](_0x4f6e13,function(_0x35818a){logger[_0xe682('0x31')](_0xe682('0x37'),JSON['stringify'](_0x35818a[_0xe682('0x38')]));if(_0x2036c0['rules'][_0x4df79a]){_0x2036c0[_0xe682('0x16')][_0x4df79a]['emit']('complete');}});return _0x273948({'code':0xc8,'message':_0x4f6e13});}else{logger[_0xe682('0x31')](_0xe682('0x39'));return _0x273948({'code':0xc8,'message':_0x4f6e13});}}catch(_0x3807c0){logger['error'](_0x3807c0['stack']);return _0xd0f68e(_0x59ab3c[_0xe682('0x35')](0x1f4,_0x3807c0));}}return _0xd0f68e('routing\x20is\x20empty');});},'AcceptMessage':function(_0x5ea847){var _0x12eec3=this;return new Promise(function(_0x5b31c6,_0x7066c2){if(_0x5ea847[_0xe682('0x3a')]&&_0x5ea847['agent']['id']){if(_0x2036c0[_0xe682('0x3b')][_0x5ea847['agent']['id']]){_0x2036c0[_0xe682('0x3b')][_0x5ea847[_0xe682('0x3a')]['id']][_0xe682('0x3c')]=![];_0x2036c0[_0xe682('0x3b')][_0x5ea847[_0xe682('0x3a')]['id']]['busyQueue']=undefined;}}if(_0x5ea847[_0xe682('0x18')]&&_0x5ea847[_0xe682('0x18')]['id']){try{var _0x4f3d8f=getId(_0x5ea847[_0xe682('0x17')],_0x5ea847[_0xe682('0x18')]?_0x5ea847[_0xe682('0x18')]['id']:0x0,_0x5ea847['interaction']?_0x5ea847[_0xe682('0x19')]['id']:0x0);if(_0x2036c0[_0xe682('0x16')][_0x4f3d8f]){_0x2036c0[_0xe682('0x16')][_0x4f3d8f]['emit'](_0xe682('0x3d'));if(rpc[_0x5ea847[_0xe682('0x17')]+'QueueReport']){rpc[_0x5ea847[_0xe682('0x17')]+_0xe682('0x3e')][_0xe682('0x3f')](_0x4f3d8f,{'UserId':_0x5ea847[_0xe682('0x18')]['UserId']})[_0xe682('0x40')](function(_0x8e39e0){logger['error'](_0xe682('0x41'));});}}return _0x5b31c6({'code':0xc8,'message':_0x5ea847});}catch(_0x95462a){logger[_0xe682('0x35')](_0x95462a['stack']);return _0x7066c2(_0x12eec3[_0xe682('0x35')](0x1f4,_0x95462a));}}logger[_0xe682('0x35')]('message\x20is\x20empty');return _0x7066c2(_0x12eec3[_0xe682('0x35')](0x1f4,_0xe682('0x42')));});},'RejectMessage':function(_0x5a8ea6){var _0x344528=this;return new Promise(function(_0x1c9333,_0x5e54cc){if(_0x5a8ea6['agent']&&_0x5a8ea6[_0xe682('0x3a')]['id']){try{if(_0x2036c0[_0xe682('0x3b')][_0x5a8ea6['agent']['id']]){_0x2036c0[_0xe682('0x3b')][_0x5a8ea6[_0xe682('0x3a')]['id']][_0xe682('0x3c')]=![];_0x2036c0[_0xe682('0x3b')][_0x5a8ea6['agent']['id']][_0xe682('0x43')]=undefined;}return _0x1c9333({'code':0xc8,'message':_0x5a8ea6});}catch(_0x1c6cc1){logger[_0xe682('0x35')](_0x1c6cc1[_0xe682('0x44')]);return _0x5e54cc(_0x344528[_0xe682('0x35')](0x1f4,_0x1c6cc1));}}logger['error'](_0xe682('0x42'));return _0x5e54cc(_0x344528[_0xe682('0x35')](0x1f4,_0xe682('0x42')));});},'AbandonInteraction':function(_0x3d37a0){var _0x2d4467=this;return new Promise(function(_0x4fb11f,_0x3af95d){if(_0x3d37a0[_0xe682('0x17')]&&_0x3d37a0[_0xe682('0x19')]&&_0x3d37a0['interaction']['id']){try{var _0x3c3b04=getId(_0x3d37a0[_0xe682('0x17')],_0x3d37a0[_0xe682('0x18')]?_0x3d37a0[_0xe682('0x18')]['id']:0x0,_0x3d37a0['interaction']?_0x3d37a0['interaction']['id']:0x0);if(_0x2036c0[_0xe682('0x16')][_0x3c3b04]){_0x2036c0[_0xe682('0x16')][_0x3c3b04][_0xe682('0x45')]('end');}return _0x4fb11f({'code':0xc8,'message':_0x3d37a0});}catch(_0x20f8a3){logger['error'](_0x20f8a3[_0xe682('0x44')]);return _0x3af95d(_0x2d4467[_0xe682('0x35')](0x1f4,_0x20f8a3));}}logger[_0xe682('0x35')](_0xe682('0x42'));return _0x3af95d(_0x2d4467[_0xe682('0x35')](0x1f4,_0xe682('0x42')));});},'AgentCapacity':function(_0x37253b){var _0x96250f=this;return new Promise(function(_0x4eeb7a,_0x135e82){if(_0x2036c0[_0xe682('0x3b')][_0xe682('0x46')](_0x37253b['id'])){for(var _0x16cb70 in _0x37253b[_0xe682('0x47')]){if(_0x37253b[_0xe682('0x47')]['hasOwnProperty'](_0x16cb70)){if(_0x2036c0[_0xe682('0x3b')][_0x37253b['id']][_0xe682('0x46')](_0x16cb70+'CurrentCapacity')){_0x2036c0[_0xe682('0x3b')][_0x37253b['id']][_0x16cb70+_0xe682('0x48')]=parseInt(_0x37253b[_0xe682('0x47')][_0x16cb70],0xa);}}}_0x2036c0[_0xe682('0x3b')][_0x37253b['id']]['updateRealtime']();return _0x4eeb7a({'code':0xc8,'message':_0x2036c0[_0xe682('0x3b')][_0x37253b['id']]});}else{return _0x135e82(_0x96250f[_0xe682('0x35')](0x1f4,_0xe682('0x49')));}});},'Agents':function(_0x64e6){return new Promise(function(_0x336d3e,_0x123ffe){var _0x118a0a=_[_0xe682('0x4a')](_0x2036c0[_0xe682('0x3b')]);_0x336d3e({'count':_0x118a0a[_0xe682('0x1c')],'rows':_0x118a0a});});},'ChatQueues':function(_0x3b290b){return new Promise(function(_0x439414,_0x19adb4){var _0x56e16e=[];for(var _0x4f3ee4 in _0x2036c0[_0xe682('0x4b')]){if(_0x2036c0[_0xe682('0x4b')][_0xe682('0x46')](_0x4f3ee4)){var _0x503b10=_0x2036c0[_0xe682('0x4b')][_0x4f3ee4];var _0x1814f9={'id':_0x503b10['id'],'available':_0x503b10['available'],'loggedIn':_0x503b10[_0xe682('0x4c')],'name':_0x503b10[_0xe682('0x4d')],'paused':_0x503b10[_0xe682('0x4e')],'waiting':_0x503b10[_0xe682('0x4f')]};_0x56e16e[_0xe682('0x23')](_0x1814f9);}}_0x439414({'count':_0x56e16e[_0xe682('0x1c')],'rows':_0x56e16e});});},'MailQueues':function(_0x99cf){return new Promise(function(_0x4524c2,_0x1108d5){var _0x25e920=[];for(var _0x47c605 in _0x2036c0[_0xe682('0x50')]){if(_0x2036c0[_0xe682('0x50')][_0xe682('0x46')](_0x47c605)){var _0x2d6a97=_0x2036c0['mailQueues'][_0x47c605];var _0x41feac={'id':_0x2d6a97['id'],'available':_0x2d6a97[_0xe682('0x51')],'loggedIn':_0x2d6a97[_0xe682('0x4c')],'name':_0x2d6a97[_0xe682('0x4d')],'paused':_0x2d6a97['paused'],'waiting':_0x2d6a97[_0xe682('0x4f')]};_0x25e920['push'](_0x41feac);}}_0x4524c2({'count':_0x25e920[_0xe682('0x1c')],'rows':_0x25e920});});},'OpenchannelQueues':function(_0x1327dc){return new Promise(function(_0x4a7ca8,_0xad01a7){var _0x5f153a=[];for(var _0x42ef42 in _0x2036c0[_0xe682('0x52')]){if(_0x2036c0[_0xe682('0x52')]['hasOwnProperty'](_0x42ef42)){var _0x5e8a95=_0x2036c0['openchannelQueues'][_0x42ef42];var _0x47e00c={'id':_0x5e8a95['id'],'available':_0x5e8a95[_0xe682('0x51')],'loggedIn':_0x5e8a95['loggedIn'],'name':_0x5e8a95[_0xe682('0x4d')],'paused':_0x5e8a95['paused'],'waiting':_0x5e8a95['waiting']};_0x5f153a['push'](_0x47e00c);}}_0x4a7ca8({'count':_0x5f153a[_0xe682('0x1c')],'rows':_0x5f153a});});},'SmsQueues':function(_0x442887){return new Promise(function(_0x4cadba,_0x585c18){var _0x5697d5=[];for(var _0x5d3739 in _0x2036c0[_0xe682('0x53')]){if(_0x2036c0[_0xe682('0x53')][_0xe682('0x46')](_0x5d3739)){var _0x3734a2=_0x2036c0['smsQueues'][_0x5d3739];var _0x139d57={'id':_0x3734a2['id'],'available':_0x3734a2[_0xe682('0x51')],'loggedIn':_0x3734a2[_0xe682('0x4c')],'name':_0x3734a2[_0xe682('0x4d')],'paused':_0x3734a2[_0xe682('0x4e')],'waiting':_0x3734a2[_0xe682('0x4f')]};_0x5697d5[_0xe682('0x23')](_0x139d57);}}_0x4cadba({'count':_0x5697d5[_0xe682('0x1c')],'rows':_0x5697d5});});},'FaxQueues':function(_0x2a5712){return new Promise(function(_0x451f07,_0xedde26){var _0x49ea6c=[];for(var _0x50367a in _0x2036c0[_0xe682('0x54')]){if(_0x2036c0[_0xe682('0x54')][_0xe682('0x46')](_0x50367a)){var _0x373765=_0x2036c0[_0xe682('0x54')][_0x50367a];var _0x2b2438={'id':_0x373765['id'],'available':_0x373765[_0xe682('0x51')],'loggedIn':_0x373765[_0xe682('0x4c')],'name':_0x373765[_0xe682('0x4d')],'paused':_0x373765[_0xe682('0x4e')],'waiting':_0x373765[_0xe682('0x4f')]};_0x49ea6c[_0xe682('0x23')](_0x2b2438);}}_0x451f07({'count':_0x49ea6c[_0xe682('0x1c')],'rows':_0x49ea6c});});},'WhatsappQueues':function(_0x3ef44a){return new Promise(function(_0x298a27,_0x22a4eb){var _0x52dcd1=[];for(var _0x54fc5d in _0x2036c0['whatsappQueues']){if(_0x2036c0[_0xe682('0x55')][_0xe682('0x46')](_0x54fc5d)){var _0x46337e=_0x2036c0[_0xe682('0x55')][_0x54fc5d];var _0x3e5410={'id':_0x46337e['id'],'available':_0x46337e[_0xe682('0x51')],'loggedIn':_0x46337e[_0xe682('0x4c')],'name':_0x46337e['name'],'paused':_0x46337e[_0xe682('0x4e')],'waiting':_0x46337e[_0xe682('0x4f')]};_0x52dcd1[_0xe682('0x23')](_0x3e5410);}}_0x298a27({'count':_0x52dcd1[_0xe682('0x1c')],'rows':_0x52dcd1});});},'ChatQueuesWaitingInteractions':function(_0x22961f){return new Promise(function(_0x507834,_0x52dd64){var _0x4af844=_[_0xe682('0x4a')](_0x2036c0['chatQueuesWaitingInteractions']);_0x507834({'count':_0x4af844[_0xe682('0x1c')],'rows':_0x4af844});});},'MailQueuesWaitingInteractions':function(_0x2a17e4){return new Promise(function(_0x37b7ce,_0x26dd33){var _0x33bcd2=_[_0xe682('0x4a')](_0x2036c0[_0xe682('0x56')]);_0x37b7ce({'count':_0x33bcd2[_0xe682('0x1c')],'rows':_0x33bcd2});});},'OpenchannelQueuesWaitingInteractions':function(_0x383ee6){return new Promise(function(_0x15be20,_0x5000d1){var _0x1c2859=_[_0xe682('0x4a')](_0x2036c0[_0xe682('0x57')]);_0x15be20({'count':_0x1c2859['length'],'rows':_0x1c2859});});},'SmsQueuesWaitingInteractions':function(_0x447aad){return new Promise(function(_0x40dc9c,_0x8a2023){var _0x1afb98=_[_0xe682('0x4a')](_0x2036c0[_0xe682('0x58')]);_0x40dc9c({'count':_0x1afb98[_0xe682('0x1c')],'rows':_0x1afb98});});},'FaxQueuesWaitingInteractions':function(_0x101fe8){return new Promise(function(_0x136d78,_0x257d66){var _0x3d3f8d=_[_0xe682('0x4a')](_0x2036c0[_0xe682('0x59')]);_0x136d78({'count':_0x3d3f8d[_0xe682('0x1c')],'rows':_0x3d3f8d});});},'WhatsappQueuesWaitingInteractions':function(_0x580782){return new Promise(function(_0x584b2f,_0x216799){var _0x4b789b=_[_0xe682('0x4a')](_0x2036c0[_0xe682('0x5a')]);_0x584b2f({'count':_0x4b789b[_0xe682('0x1c')],'rows':_0x4b789b});});}};var _0x11cc9f=jayson['server'](_0x174ea9)[_0xe682('0x5b')]();_0x11cc9f['on']('error',function(_0x2b8fa0){logger[_0xe682('0x35')](JSON[_0xe682('0x5c')](_0x2b8fa0));return _0xf81087(_0x2b8fa0);});_0x11cc9f[_0xe682('0x15')](0x232c,'127.0.0.1',function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x1fa28c(_0xe682('0x5d')+0x232c);});});}; \ No newline at end of file +var _0x0f7f=['split','mail','push','slice','join','tag','TagId','condition','intervals','./applications/','app','consequence','priority','info','Push\x20new\x20rule','error','rules','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','catch','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','../../../config/environment','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','channel','message','interaction','applications','length','existsSync','.js','toLowerCase','autoreply','appdata'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0f7f,0x1e4));var _0xf0f7=function(_0x4d66f4,_0xaacaf6){_0x4d66f4=_0x4d66f4-0x0;var _0x130aaa=_0x0f7f[_0x4d66f4];return _0x130aaa;};'use strict';var _=require(_0xf0f7('0x0'));var util=require(_0xf0f7('0x1'));var path=require(_0xf0f7('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xf0f7('0x3'));var uuid=require('uuid');var config=require(_0xf0f7('0x4'));var logger=require('../../../config/logger')('routing');var rpc={'openchannelQueueReport':require(_0xf0f7('0x5')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xf0f7('0x6')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xf0f7('0x7'))};var RuleEngine=require(_0xf0f7('0x8'));function getId(_0x5db587,_0xc0efb6,_0x4dc250){return util[_0xf0f7('0x9')](_0xf0f7('0xa'),_0x5db587,_0xc0efb6||0x0,_0x4dc250||0x0);}function getIntervals(_0x591701,_0x4c6383){var _0x240306=[];if(!_[_0xf0f7('0xb')](_0x4c6383[_0xf0f7('0xc')])&&!_[_0xf0f7('0xb')](_0x591701[_0x4c6383[_0xf0f7('0xc')]])&&!_[_0xf0f7('0xb')](_0x591701[_0x4c6383[_0xf0f7('0xc')]][_0xf0f7('0xd')])){_0x240306=_['map'](_0x591701[_0x4c6383[_0xf0f7('0xc')]][_0xf0f7('0xd')],_0xf0f7('0xe'));}else if(!_[_0xf0f7('0xb')](_0x4c6383[_0xf0f7('0xe')])){_0x240306=[_0x4c6383[_0xf0f7('0xe')]];}return _0x240306;}exports[_0xf0f7('0xf')]=function(_0x1f863c){_0x1f863c['rules']={};return new BPromise(function(_0xc3f23a,_0x3a0f0c){var _0x2f333a={'Start':function(_0x4017aa){var _0x3b8808=this;return new Promise(function(_0x5c75c0,_0x3e6389){if(_0x4017aa){try{var _0x311c08=[];var _0x98c8f8=getId(_0x4017aa[_0xf0f7('0x10')],_0x4017aa['message']?_0x4017aa[_0xf0f7('0x11')]['id']:0x0,_0x4017aa[_0xf0f7('0x12')]?_0x4017aa[_0xf0f7('0x12')]['id']:0x0);if(_0x4017aa[_0xf0f7('0x13')]&&_['isArray'](_0x4017aa['applications'])&&_0x4017aa['applications'][_0xf0f7('0x14')]){for(var _0x507251=0x0;_0x507251<_0x4017aa[_0xf0f7('0x13')][_0xf0f7('0x14')];_0x507251+=0x1){var _0x1afd5a=_0x4017aa[_0xf0f7('0x13')][_0x507251];if(fs[_0xf0f7('0x15')](path['join'](__dirname,_0xf0f7('0x13'),_0x1afd5a['app']+_0xf0f7('0x16')))){var _0x4f048d=[];switch(_0x1afd5a['app'][_0xf0f7('0x17')]()){case _0xf0f7('0x18'):var _0x4441e3=_0x1afd5a[_0xf0f7('0x19')][_0xf0f7('0x1a')](',');if(_0x4017aa[_0xf0f7('0x10')]===_0xf0f7('0x1b')){_0x4f048d[_0xf0f7('0x1c')](_0x4441e3[0x0]);_0x4f048d[_0xf0f7('0x1c')](_0x4441e3[0x1]);_0x4f048d['push'](_0x4441e3[_0xf0f7('0x1d')](0x2,_0x4441e3[_0xf0f7('0x14')])[_0xf0f7('0x1e')](','));}else{_0x4f048d['push'](_0x4441e3[0x0]);_0x4f048d[_0xf0f7('0x1c')](_0x4441e3[_0xf0f7('0x1d')](0x1,_0x4441e3['length'])[_0xf0f7('0x1e')](','));}break;case'dialogflow':var _0x4f1125=_0x1afd5a[_0xf0f7('0x19')][_0xf0f7('0x1a')](',');_0x4f048d[_0xf0f7('0x1c')](_0x4f1125[0x0]);_0x4f048d[_0xf0f7('0x1c')](_0x4f1125[0x1]);_0x4f048d[_0xf0f7('0x1c')](_0x4f1125['slice'](0x2,_0x4f1125[_0xf0f7('0x14')])[_0xf0f7('0x1e')](','));break;case'dialogflowv2':var _0x45c2fe=_0x1afd5a[_0xf0f7('0x19')][_0xf0f7('0x1a')](',');_0x4f048d[_0xf0f7('0x1c')](_0x45c2fe[0x0]);_0x4f048d['push'](_0x45c2fe[0x1]);_0x4f048d[_0xf0f7('0x1c')](_0x45c2fe[0x2]);_0x4f048d[_0xf0f7('0x1c')](_0x45c2fe[0x3]);_0x4f048d['push'](_0x45c2fe[_0xf0f7('0x1d')](0x4,_0x45c2fe[_0xf0f7('0x14')])[_0xf0f7('0x1e')](','));break;case'amazonlex':var _0x823bb2=_0x1afd5a[_0xf0f7('0x19')][_0xf0f7('0x1a')](',');_0x4f048d[_0xf0f7('0x1c')](_0x823bb2[0x0]);_0x4f048d['push'](_0x823bb2[0x1]);_0x4f048d[_0xf0f7('0x1c')](_0x823bb2[0x2]);_0x4f048d[_0xf0f7('0x1c')](_0x823bb2[0x3]);_0x4f048d[_0xf0f7('0x1c')](_0x823bb2[_0xf0f7('0x1d')](0x4,_0x823bb2[_0xf0f7('0x14')])[_0xf0f7('0x1e')](','));break;case _0xf0f7('0x11'):_0x4f048d[_0xf0f7('0x1c')](_0x1afd5a[_0xf0f7('0x19')]);break;case _0xf0f7('0x1f'):_0x4f048d['push'](_0x1afd5a[_0xf0f7('0x20')]);_0x4f048d[_0xf0f7('0x1c')](_0x1afd5a[_0xf0f7('0x19')]);break;default:_0x4f048d=_[_0xf0f7('0xb')](_0x1afd5a[_0xf0f7('0x19')])?[]:_0x1afd5a[_0xf0f7('0x19')][_0xf0f7('0x1a')](',');}var _0x5cca61={'id':util[_0xf0f7('0x9')]('%s:%s:%s',_0x98c8f8,_0x1afd5a['id'],_0x1afd5a['app']),'condition':require('./interval')[_0xf0f7('0x21')](_0x98c8f8,getIntervals(_0x1f863c[_0xf0f7('0x22')],_0x1afd5a),_0x1f863c),'consequence':require(_0xf0f7('0x23')+_0x1afd5a[_0xf0f7('0x24')])[_0xf0f7('0x25')](_0x98c8f8,_0x4f048d,_0x1f863c,_0x4017aa),'p':_0x1afd5a[_0xf0f7('0x26')]||0x0};logger[_0xf0f7('0x27')](_0xf0f7('0x28'),_0x5cca61['id'],'on\x20interval',getIntervals(_0x1f863c[_0xf0f7('0x22')],_0x1afd5a)[_0xf0f7('0x1e')]('\x20|\x20'));_0x311c08[_0xf0f7('0x1c')](_0x5cca61);}else{logger[_0xf0f7('0x29')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xf0f7('0x1e')](__dirname,'applications',_0x1afd5a[_0xf0f7('0x24')]+_0xf0f7('0x16')));}}_0x1f863c['rules'][_0x98c8f8]=new RuleEngine(_0x311c08);_0x1f863c[_0xf0f7('0x2a')][_0x98c8f8][_0xf0f7('0x2b')](_0x4017aa,function(_0x2e53cf){logger[_0xf0f7('0x27')](_0xf0f7('0x2c'),JSON[_0xf0f7('0x2d')](_0x2e53cf[_0xf0f7('0x2e')]));if(_0x1f863c[_0xf0f7('0x2a')][_0x98c8f8]){_0x1f863c[_0xf0f7('0x2a')][_0x98c8f8][_0xf0f7('0x2f')](_0xf0f7('0x30'));}});return _0x5c75c0({'code':0xc8,'message':_0x4017aa});}else{logger[_0xf0f7('0x27')](_0xf0f7('0x31'));return _0x5c75c0({'code':0xc8,'message':_0x4017aa});}}catch(_0x5a6b2b){logger[_0xf0f7('0x29')](_0x5a6b2b[_0xf0f7('0x32')]);return _0x3e6389(_0x3b8808[_0xf0f7('0x29')](0x1f4,_0x5a6b2b));}}return _0x3e6389(_0xf0f7('0x33'));});},'AcceptMessage':function(_0x54e84a){var _0x42fbfb=this;return new Promise(function(_0x16ca9b,_0x3c27b7){if(_0x54e84a['agent']&&_0x54e84a[_0xf0f7('0x34')]['id']){if(_0x1f863c[_0xf0f7('0x35')][_0x54e84a['agent']['id']]){_0x1f863c['agents'][_0x54e84a[_0xf0f7('0x34')]['id']][_0xf0f7('0x36')]=![];_0x1f863c[_0xf0f7('0x35')][_0x54e84a[_0xf0f7('0x34')]['id']][_0xf0f7('0x37')]=undefined;}}if(_0x54e84a[_0xf0f7('0x11')]&&_0x54e84a['message']['id']){try{var _0x512399=getId(_0x54e84a['channel'],_0x54e84a[_0xf0f7('0x11')]?_0x54e84a[_0xf0f7('0x11')]['id']:0x0,_0x54e84a[_0xf0f7('0x12')]?_0x54e84a['interaction']['id']:0x0);if(_0x1f863c[_0xf0f7('0x2a')][_0x512399]){_0x1f863c[_0xf0f7('0x2a')][_0x512399]['emit'](_0xf0f7('0x38'));if(rpc[_0x54e84a['channel']+_0xf0f7('0x39')]){rpc[_0x54e84a[_0xf0f7('0x10')]+'QueueReport']['update'](_0x512399,{'UserId':_0x54e84a[_0xf0f7('0x11')]['UserId']})[_0xf0f7('0x3a')](function(_0x2bc122){logger['error']('error\x20update\x20queue\x20report');});}}return _0x16ca9b({'code':0xc8,'message':_0x54e84a});}catch(_0x36f3aa){logger['error'](_0x36f3aa['stack']);return _0x3c27b7(_0x42fbfb[_0xf0f7('0x29')](0x1f4,_0x36f3aa));}}logger[_0xf0f7('0x29')](_0xf0f7('0x3b'));return _0x3c27b7(_0x42fbfb[_0xf0f7('0x29')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x27f80d){var _0x41d06a=this;return new Promise(function(_0x542793,_0x4ab8eb){if(_0x27f80d[_0xf0f7('0x34')]&&_0x27f80d[_0xf0f7('0x34')]['id']){try{if(_0x1f863c[_0xf0f7('0x35')][_0x27f80d['agent']['id']]){_0x1f863c[_0xf0f7('0x35')][_0x27f80d[_0xf0f7('0x34')]['id']][_0xf0f7('0x36')]=![];_0x1f863c[_0xf0f7('0x35')][_0x27f80d[_0xf0f7('0x34')]['id']]['busyQueue']=undefined;}return _0x542793({'code':0xc8,'message':_0x27f80d});}catch(_0x5d8a9c){logger['error'](_0x5d8a9c[_0xf0f7('0x32')]);return _0x4ab8eb(_0x41d06a[_0xf0f7('0x29')](0x1f4,_0x5d8a9c));}}logger['error'](_0xf0f7('0x3b'));return _0x4ab8eb(_0x41d06a[_0xf0f7('0x29')](0x1f4,_0xf0f7('0x3b')));});},'AbandonInteraction':function(_0x240137){var _0x8d83ab=this;return new Promise(function(_0x1b0645,_0x2833e7){if(_0x240137['channel']&&_0x240137['interaction']&&_0x240137[_0xf0f7('0x12')]['id']){try{var _0x4e282d=getId(_0x240137['channel'],_0x240137[_0xf0f7('0x11')]?_0x240137[_0xf0f7('0x11')]['id']:0x0,_0x240137[_0xf0f7('0x12')]?_0x240137[_0xf0f7('0x12')]['id']:0x0);if(_0x1f863c[_0xf0f7('0x2a')][_0x4e282d]){_0x1f863c['rules'][_0x4e282d][_0xf0f7('0x2f')](_0xf0f7('0x38'));}return _0x1b0645({'code':0xc8,'message':_0x240137});}catch(_0x2311e3){logger['error'](_0x2311e3[_0xf0f7('0x32')]);return _0x2833e7(_0x8d83ab[_0xf0f7('0x29')](0x1f4,_0x2311e3));}}logger[_0xf0f7('0x29')](_0xf0f7('0x3b'));return _0x2833e7(_0x8d83ab[_0xf0f7('0x29')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x457d45){var _0x13a07f=this;return new Promise(function(_0x2d84d9,_0x5ef34b){if(_0x1f863c[_0xf0f7('0x35')][_0xf0f7('0x3c')](_0x457d45['id'])){for(var _0x3a0843 in _0x457d45['capacity']){if(_0x457d45[_0xf0f7('0x3d')][_0xf0f7('0x3c')](_0x3a0843)){if(_0x1f863c['agents'][_0x457d45['id']][_0xf0f7('0x3c')](_0x3a0843+_0xf0f7('0x3e'))){_0x1f863c[_0xf0f7('0x35')][_0x457d45['id']][_0x3a0843+_0xf0f7('0x3e')]=parseInt(_0x457d45['capacity'][_0x3a0843],0xa);}}}_0x1f863c[_0xf0f7('0x35')][_0x457d45['id']]['updateRealtime']();return _0x2d84d9({'code':0xc8,'message':_0x1f863c[_0xf0f7('0x35')][_0x457d45['id']]});}else{return _0x5ef34b(_0x13a07f[_0xf0f7('0x29')](0x1f4,_0xf0f7('0x3f')));}});},'Agents':function(_0x444af9){return new Promise(function(_0x1bf56a,_0xb8c0ac){var _0x32a162=_[_0xf0f7('0x40')](_0x1f863c[_0xf0f7('0x35')]);_0x1bf56a({'count':_0x32a162[_0xf0f7('0x14')],'rows':_0x32a162});});},'ChatQueues':function(_0x38ec97){return new Promise(function(_0x42f865,_0x5ce7ae){var _0x534b25=[];for(var _0x15d258 in _0x1f863c[_0xf0f7('0x41')]){if(_0x1f863c[_0xf0f7('0x41')][_0xf0f7('0x3c')](_0x15d258)){var _0x36aabf=_0x1f863c[_0xf0f7('0x41')][_0x15d258];var _0x1e355a={'id':_0x36aabf['id'],'available':_0x36aabf[_0xf0f7('0x42')],'loggedIn':_0x36aabf[_0xf0f7('0x43')],'name':_0x36aabf[_0xf0f7('0x44')],'paused':_0x36aabf['paused'],'waiting':_0x36aabf[_0xf0f7('0x45')]};_0x534b25['push'](_0x1e355a);}}_0x42f865({'count':_0x534b25[_0xf0f7('0x14')],'rows':_0x534b25});});},'MailQueues':function(_0x2e646e){return new Promise(function(_0x1eedb1,_0x5713cc){var _0x2c73bf=[];for(var _0x50bc42 in _0x1f863c[_0xf0f7('0x46')]){if(_0x1f863c[_0xf0f7('0x46')]['hasOwnProperty'](_0x50bc42)){var _0x33e20d=_0x1f863c[_0xf0f7('0x46')][_0x50bc42];var _0x9264a8={'id':_0x33e20d['id'],'available':_0x33e20d[_0xf0f7('0x42')],'loggedIn':_0x33e20d[_0xf0f7('0x43')],'name':_0x33e20d['name'],'paused':_0x33e20d[_0xf0f7('0x47')],'waiting':_0x33e20d['waiting']};_0x2c73bf['push'](_0x9264a8);}}_0x1eedb1({'count':_0x2c73bf[_0xf0f7('0x14')],'rows':_0x2c73bf});});},'OpenchannelQueues':function(_0x1cbaba){return new Promise(function(_0x139e8a,_0x588272){var _0x317c5c=[];for(var _0x440367 in _0x1f863c[_0xf0f7('0x48')]){if(_0x1f863c[_0xf0f7('0x48')][_0xf0f7('0x3c')](_0x440367)){var _0x33b6eb=_0x1f863c[_0xf0f7('0x48')][_0x440367];var _0x23a668={'id':_0x33b6eb['id'],'available':_0x33b6eb[_0xf0f7('0x42')],'loggedIn':_0x33b6eb['loggedIn'],'name':_0x33b6eb[_0xf0f7('0x44')],'paused':_0x33b6eb[_0xf0f7('0x47')],'waiting':_0x33b6eb[_0xf0f7('0x45')]};_0x317c5c[_0xf0f7('0x1c')](_0x23a668);}}_0x139e8a({'count':_0x317c5c[_0xf0f7('0x14')],'rows':_0x317c5c});});},'SmsQueues':function(_0x3d8f5d){return new Promise(function(_0x3b6aeb,_0x30b280){var _0x107764=[];for(var _0x1b1a80 in _0x1f863c[_0xf0f7('0x49')]){if(_0x1f863c[_0xf0f7('0x49')][_0xf0f7('0x3c')](_0x1b1a80)){var _0x73bc8c=_0x1f863c['smsQueues'][_0x1b1a80];var _0x327eef={'id':_0x73bc8c['id'],'available':_0x73bc8c[_0xf0f7('0x42')],'loggedIn':_0x73bc8c[_0xf0f7('0x43')],'name':_0x73bc8c['name'],'paused':_0x73bc8c[_0xf0f7('0x47')],'waiting':_0x73bc8c[_0xf0f7('0x45')]};_0x107764[_0xf0f7('0x1c')](_0x327eef);}}_0x3b6aeb({'count':_0x107764[_0xf0f7('0x14')],'rows':_0x107764});});},'FaxQueues':function(_0x24bf1){return new Promise(function(_0xc1ca15,_0x238062){var _0x45eef2=[];for(var _0x2eb3f1 in _0x1f863c[_0xf0f7('0x4a')]){if(_0x1f863c['faxQueues'][_0xf0f7('0x3c')](_0x2eb3f1)){var _0x5959e8=_0x1f863c['faxQueues'][_0x2eb3f1];var _0xa52747={'id':_0x5959e8['id'],'available':_0x5959e8[_0xf0f7('0x42')],'loggedIn':_0x5959e8['loggedIn'],'name':_0x5959e8['name'],'paused':_0x5959e8[_0xf0f7('0x47')],'waiting':_0x5959e8[_0xf0f7('0x45')]};_0x45eef2[_0xf0f7('0x1c')](_0xa52747);}}_0xc1ca15({'count':_0x45eef2['length'],'rows':_0x45eef2});});},'WhatsappQueues':function(_0x4a273a){return new Promise(function(_0x4d11f9,_0x1fe418){var _0x29760c=[];for(var _0x1a5adb in _0x1f863c['whatsappQueues']){if(_0x1f863c[_0xf0f7('0x4b')][_0xf0f7('0x3c')](_0x1a5adb)){var _0x5b9b8f=_0x1f863c[_0xf0f7('0x4b')][_0x1a5adb];var _0x21fafe={'id':_0x5b9b8f['id'],'available':_0x5b9b8f[_0xf0f7('0x42')],'loggedIn':_0x5b9b8f[_0xf0f7('0x43')],'name':_0x5b9b8f[_0xf0f7('0x44')],'paused':_0x5b9b8f['paused'],'waiting':_0x5b9b8f[_0xf0f7('0x45')]};_0x29760c[_0xf0f7('0x1c')](_0x21fafe);}}_0x4d11f9({'count':_0x29760c[_0xf0f7('0x14')],'rows':_0x29760c});});},'ChatQueuesWaitingInteractions':function(_0x336cd5){return new Promise(function(_0x2ec203,_0x3ccea0){var _0x1261d3=_[_0xf0f7('0x40')](_0x1f863c[_0xf0f7('0x4c')]);_0x2ec203({'count':_0x1261d3[_0xf0f7('0x14')],'rows':_0x1261d3});});},'MailQueuesWaitingInteractions':function(_0x1393a2){return new Promise(function(_0xd8c830,_0x1bab86){var _0x3964e0=_[_0xf0f7('0x40')](_0x1f863c[_0xf0f7('0x4d')]);_0xd8c830({'count':_0x3964e0[_0xf0f7('0x14')],'rows':_0x3964e0});});},'OpenchannelQueuesWaitingInteractions':function(_0x245445){return new Promise(function(_0x4c4f5f,_0x445b36){var _0x56e65e=_[_0xf0f7('0x40')](_0x1f863c[_0xf0f7('0x4e')]);_0x4c4f5f({'count':_0x56e65e['length'],'rows':_0x56e65e});});},'SmsQueuesWaitingInteractions':function(_0x469e3c){return new Promise(function(_0x3496fa,_0x3967e3){var _0x3d3e63=_['values'](_0x1f863c['smsQueuesWaitingInteractions']);_0x3496fa({'count':_0x3d3e63[_0xf0f7('0x14')],'rows':_0x3d3e63});});},'FaxQueuesWaitingInteractions':function(_0x2825e1){return new Promise(function(_0x3461c1,_0x199b06){var _0x1f678e=_[_0xf0f7('0x40')](_0x1f863c['faxQueuesWaitingInteractions']);_0x3461c1({'count':_0x1f678e[_0xf0f7('0x14')],'rows':_0x1f678e});});},'WhatsappQueuesWaitingInteractions':function(_0x436b75){return new Promise(function(_0x4619fa,_0x4f6020){var _0x4d158d=_[_0xf0f7('0x40')](_0x1f863c['whatsappQueuesWaitingInteractions']);_0x4619fa({'count':_0x4d158d[_0xf0f7('0x14')],'rows':_0x4d158d});});}};var _0x42a1e6=jayson[_0xf0f7('0x4f')](_0x2f333a)[_0xf0f7('0x50')]();_0x42a1e6['on']('error',function(_0x5d45a7){logger[_0xf0f7('0x29')](JSON[_0xf0f7('0x2d')](_0x5d45a7));return _0x3a0f0c(_0x5d45a7);});_0x42a1e6[_0xf0f7('0xf')](0x232c,_0xf0f7('0x51'),function(){console[_0xf0f7('0x52')](_0xf0f7('0x53'),0x232c);return _0xc3f23a(_0xf0f7('0x54')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 3389881..20ee7d2 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 _0x6408=['all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util','bluebird','lodash','../../../config/logger','routing','client','http','request','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','iftime\x20%s','then','message','[%s][INTERVAL]\x20%s'];(function(_0x4167d9,_0x3f8272){var _0x2b9d07=function(_0x39cc94){while(--_0x39cc94){_0x4167d9['push'](_0x4167d9['shift']());}};_0x2b9d07(++_0x3f8272);}(_0x6408,0xbc));var _0x8640=function(_0x2fbb08,_0x216b46){_0x2fbb08=_0x2fbb08-0x0;var _0x5c5d8c=_0x6408[_0x2fbb08];return _0x5c5d8c;};'use strict';var util=require(_0x8640('0x0'));var BPromise=require(_0x8640('0x1'));var jayson=require('jayson/promise');var _=require(_0x8640('0x2'));var logger=require(_0x8640('0x3'))(_0x8640('0x4'));var client=jayson[_0x8640('0x5')][_0x8640('0x6')]({'port':0x232a});function request(_0x224122,_0x299b6a){return new BPromise(function(_0x33b857,_0x131399){return client[_0x8640('0x7')](_0x224122,_0x299b6a)['then'](function(_0x2df402){if(_0x2df402[_0x8640('0x8')]){return _0x131399(_0x2df402[_0x8640('0x8')]['message']);}else{return _0x33b857(_0x2df402[_0x8640('0x9')]);}})[_0x8640('0xa')](function(_0x175453){return _0x131399(_0x175453);});});}exports[_0x8640('0xb')]=function(_0x1fc1aa,_0x166a30,_0x101d7a){return function(_0x5f59d5){if(_0x101d7a[_0x8640('0xc')]&&!_0x101d7a[_0x8640('0xc')][_0x1fc1aa]){logger[_0x8640('0xd')](_0x8640('0xe'),_0x1fc1aa);return _0x5f59d5[_0x8640('0xf')]();}var _0x286d79=[];for(var _0x33d588=0x0;_0x33d588<_0x166a30['length'];_0x33d588+=0x1){_0x286d79[_0x8640('0x10')](request(_0x8640('0x11'),{'command':util['format'](_0x8640('0x12'),_0x166a30[_0x33d588])})[_0x8640('0x13')](function(_0x46b8fa){return _0x46b8fa&&_0x46b8fa[_0x8640('0x14')]&&_0x46b8fa[_0x8640('0x14')]['indexOf']('true')>=0x0?!![]:![];})[_0x8640('0xa')](function(_0x2212bb){logger[_0x8640('0x8')](_0x8640('0x15'),_0x1fc1aa,_0x166a30[_0x33d588]);}));}BPromise[_0x8640('0x16')](_0x286d79)[_0x8640('0x13')](function(_0x2b1212){var _0x33e9d2=_[_0x8640('0x17')](_0x2b1212);logger['info'](_0x8640('0x18'),_0x1fc1aa,_0x166a30[_0x8640('0x19')](_0x8640('0x1a')),_0x33e9d2);_0x5f59d5[_0x8640('0x1b')](_0x33e9d2);})[_0x8640('0xa')](function(_0x2efcc2){console[_0x8640('0x1c')](_0x2efcc2);logger[_0x8640('0x8')]('[%s][INTERVAL]\x20%s\x20%s',_0x1fc1aa,_0x166a30[_0x8640('0x19')](_0x8640('0x1a')),_0x2efcc2[_0x8640('0x1d')]);_0x5f59d5[_0x8640('0xf')]();});};}; \ No newline at end of file +var _0x6f6d=['client','http','request','then','error','result','condition','rules','info','stop','length','push','Command','format','iftime\x20%s','message','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0x6f6d,0x123));var _0xd6f6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f6d[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xd6f6('0x0'));var BPromise=require(_0xd6f6('0x1'));var jayson=require(_0xd6f6('0x2'));var _=require(_0xd6f6('0x3'));var logger=require(_0xd6f6('0x4'))(_0xd6f6('0x5'));var client=jayson[_0xd6f6('0x6')][_0xd6f6('0x7')]({'port':0x232a});function request(_0x3edb9b,_0x500578){return new BPromise(function(_0x350408,_0x32d65a){return client[_0xd6f6('0x8')](_0x3edb9b,_0x500578)[_0xd6f6('0x9')](function(_0x18484){if(_0x18484['error']){return _0x32d65a(_0x18484[_0xd6f6('0xa')]['message']);}else{return _0x350408(_0x18484[_0xd6f6('0xb')]);}})['catch'](function(_0xaf229a){return _0x32d65a(_0xaf229a);});});}exports[_0xd6f6('0xc')]=function(_0x18fb33,_0x53a0f5,_0x67b3f0){return function(_0x6d875b){if(_0x67b3f0[_0xd6f6('0xd')]&&!_0x67b3f0[_0xd6f6('0xd')][_0x18fb33]){logger[_0xd6f6('0xe')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x18fb33);return _0x6d875b[_0xd6f6('0xf')]();}var _0x14e64b=[];for(var _0x2a26e4=0x0;_0x2a26e4<_0x53a0f5[_0xd6f6('0x10')];_0x2a26e4+=0x1){_0x14e64b[_0xd6f6('0x11')](request(_0xd6f6('0x12'),{'command':util[_0xd6f6('0x13')](_0xd6f6('0x14'),_0x53a0f5[_0x2a26e4])})['then'](function(_0x49c47d){return _0x49c47d&&_0x49c47d[_0xd6f6('0x15')]&&_0x49c47d['message'][_0xd6f6('0x16')](_0xd6f6('0x17'))>=0x0?!![]:![];})[_0xd6f6('0x18')](function(_0x91b977){logger[_0xd6f6('0xa')](_0xd6f6('0x19'),_0x18fb33,_0x53a0f5[_0x2a26e4]);}));}BPromise[_0xd6f6('0x1a')](_0x14e64b)['then'](function(_0x4e2692){var _0x4136c5=_['some'](_0x4e2692);logger[_0xd6f6('0xe')](_0xd6f6('0x1b'),_0x18fb33,_0x53a0f5[_0xd6f6('0x1c')]('\x20|\x20'),_0x4136c5);_0x6d875b[_0xd6f6('0x1d')](_0x4136c5);})[_0xd6f6('0x18')](function(_0x1486bf){console[_0xd6f6('0x1e')](_0x1486bf);logger['error'](_0xd6f6('0x1b'),_0x18fb33,_0x53a0f5[_0xd6f6('0x1c')](_0xd6f6('0x1f')),_0x1486bf[_0xd6f6('0x20')]);_0x6d875b[_0xd6f6('0xf')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index be265ac..f7c12dd 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 _0x41bb=['transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','transfertargetuniqueid','clone','hangup','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','complete','[%s][agents][hangup]','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','destuniqueid','lastevent','called','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','ringtime','talktime','push','error','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswer','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connect','forIn','answered_elsewhere','reason','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind'];(function(_0xbab8e4,_0x5ed0bf){var _0x7886dc=function(_0x232ee3){while(--_0x232ee3){_0xbab8e4['push'](_0xbab8e4['shift']());}};_0x7886dc(++_0x5ed0bf);}(_0x41bb,0xc5));var _0xb41b=function(_0x13827d,_0x5892f9){_0x13827d=_0x13827d-0x0;var _0x5409c5=_0x41bb[_0x13827d];return _0x5409c5;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x428431,_0x4d5578){utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x4'),_0x428431[_0xb41b('0x5')],_0x428431['channel'],_0x428431[_0xb41b('0x6')],_0x428431[_0xb41b('0x7')],_0x428431[_0xb41b('0x8')],_0x428431['calleridnum'],_0x428431['connectedlinenum'],_0x428431['lastevent']));if(_0x428431[_0xb41b('0x6')]){utils[_0xb41b('0x9')](_0x428431['queue'])[_0xb41b('0xa')](function(_0x2c1a53){if(_0x2c1a53){_0x428431[_0xb41b('0xb')]=_0x2c1a53[_0xb41b('0xb')];_0x428431[_0xb41b('0xc')]=_0x428431[_0xb41b('0xd')]?_0x2c1a53[_0xb41b('0xe')]:![];_0x428431['acwtime']=_0x428431[_0xb41b('0xc')]?_0x2c1a53['acwTimeout']:0x0;}utils[_0xb41b('0xf')](_0xb41b('0x10'),_0x428431);});}else{utils[_0xb41b('0xf')](_0xb41b('0x10'),_0x428431);}if(_0x4d5578){delete transfers[_0x428431[_0xb41b('0x5')]];}else{delete agents[_0x428431['destuniqueid']];}}exports[_0xb41b('0x11')]=function(_0x2d947a){try{utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x13'),_0x2d947a['uniqueid']),_0x2d947a);agents[_0x2d947a['destuniqueid']]=_0x2d947a;agents[_0x2d947a['destuniqueid']][_0xb41b('0x14')]=utils[_0xb41b('0x15')]();agents[_0x2d947a[_0xb41b('0x16')]][_0xb41b('0x17')]=_0xb41b('0x18');agents[_0x2d947a['destuniqueid']][_0xb41b('0x19')]=null;agents[_0x2d947a[_0xb41b('0x16')]][_0xb41b('0x1a')]=null;utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x1b'),_0x2d947a[_0xb41b('0x5')],agents[_0x2d947a['destuniqueid']]['membername'],_0x2d947a['destuniqueid']));}catch(_0xf109f8){utils['error'](util[_0xb41b('0x3')](_0xb41b('0x13'),_0x2d947a[_0xb41b('0x5')]),_0xf109f8);}};exports['agentringnoanswer']=function(_0x53bc44){try{if(!_[_0xb41b('0x1c')](agents[_0x53bc44[_0xb41b('0x16')]])){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x1d'),_0x53bc44[_0xb41b('0x5')]),_0x53bc44);utils['info'](util['format'](_0xb41b('0x1e'),_0x53bc44[_0xb41b('0x5')],agents[_0x53bc44[_0xb41b('0x16')]]['membername'],_0x53bc44[_0xb41b('0x16')]));agents[_0x53bc44[_0xb41b('0x16')]]['agentringnoanswer']=!![];agents[_0x53bc44[_0xb41b('0x16')]][_0xb41b('0x1f')]=utils['now']();agents[_0x53bc44[_0xb41b('0x16')]]['lastevent']=_0xb41b('0x20');agents[_0x53bc44[_0xb41b('0x16')]]['reason']=_0xb41b('0x20');agents[_0x53bc44[_0xb41b('0x16')]]['holdtime']=_0x53bc44['ringtime']?parseInt(_0x53bc44[_0xb41b('0x21')])/0x3e8:0x0;agents[_0x53bc44[_0xb41b('0x16')]][_0xb41b('0x22')]=0x0;unanswered[_0xb41b('0x23')](_0x53bc44[_0xb41b('0x16')]);}}catch(_0x181cbd){utils[_0xb41b('0x24')](util['format'](_0xb41b('0x1d'),_0x53bc44[_0xb41b('0x5')]),_0x181cbd);}};exports['queuecallerabandon']=function(_0xe64568){try{_['forIn'](agents,function(_0x38277f,_0x31d4cd){if(_0x38277f['uniqueid']==_0xe64568[_0xb41b('0x5')]&&!_['includes'](unanswered,_0x38277f[_0xb41b('0x16')])){utils[_0xb41b('0x12')](util['format'](_0xb41b('0x25'),_0xe64568[_0xb41b('0x5')]),_0xe64568);utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x26'),_0xe64568[_0xb41b('0x5')],_0x38277f[_0xb41b('0x7')],_0x38277f[_0xb41b('0x16')]));_0x38277f[_0xb41b('0x27')]=!![];_0x38277f[_0xb41b('0x1f')]=utils['now']();_0x38277f[_0xb41b('0x17')]='abandoned';_0x38277f['reason']=_0xb41b('0x28');_0x38277f[_0xb41b('0x29')]=_0xe64568[_0xb41b('0x29')];_0x38277f[_0xb41b('0x22')]=0x0;writeDB(_0x38277f);}});}catch(_0x1b8681){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x25'),_0xe64568[_0xb41b('0x5')]),_0x1b8681);}};exports[_0xb41b('0x2a')]=function(_0x3a06a0){try{if(agents[_0x3a06a0['destuniqueid']]){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x2b'),_0x3a06a0[_0xb41b('0x5')]),_0x3a06a0);utils[_0xb41b('0x2')](util[_0xb41b('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x3a06a0['uniqueid'],agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x7')],_0x3a06a0['destuniqueid']));agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x2c')]=utils[_0xb41b('0x15')]();agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x19')]=_0x3a06a0['connectedlinenum'];agents[_0x3a06a0[_0xb41b('0x16')]]['connectedlinename']=_0x3a06a0[_0xb41b('0x1a')];agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x29')]=_0x3a06a0[_0xb41b('0x21')];agents[_0x3a06a0[_0xb41b('0x16')]][_0xb41b('0x17')]=_0xb41b('0x2d');_[_0xb41b('0x2e')](agents,function(_0x2b0721,_0x578b67){if(_0x2b0721['destuniqueid']!=_0x3a06a0['destuniqueid']&&_0x2b0721[_0xb41b('0x5')]==_0x3a06a0['uniqueid']){_0x2b0721['talktime']=0x0;_0x2b0721[_0xb41b('0x29')]=_0x3a06a0['ringtime'];_0x2b0721[_0xb41b('0x27')]=!![];_0x2b0721[_0xb41b('0x1f')]=utils[_0xb41b('0x15')]();_0x2b0721[_0xb41b('0x17')]=_0xb41b('0x2f');_0x2b0721[_0xb41b('0x30')]=_0xb41b('0x2f');_0x2b0721['answeredelsewheredestinationuniqueid']=_0x3a06a0[_0xb41b('0x16')];_0x2b0721[_0xb41b('0x31')]=_0x3a06a0[_0xb41b('0x7')];writeDB(_0x2b0721);}});}}catch(_0x174d6c){utils['error'](util[_0xb41b('0x3')]('[%s][agents][agentconnect]',_0x3a06a0[_0xb41b('0x5')]),_0x174d6c);}};exports[_0xb41b('0xd')]=function(_0x46dbbf){try{if(!_['isNil'](agents[_0x46dbbf['destuniqueid']])){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x32'),_0x46dbbf[_0xb41b('0x5')]),_0x46dbbf);utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x33'),_0x46dbbf['uniqueid'],agents[_0x46dbbf['destuniqueid']][_0xb41b('0x7')],_0x46dbbf['destuniqueid']));agents[_0x46dbbf[_0xb41b('0x16')]]['agentcomplete']=!![];agents[_0x46dbbf[_0xb41b('0x16')]]['agentcompleteAt']=utils[_0xb41b('0x15')]();agents[_0x46dbbf['destuniqueid']][_0xb41b('0x22')]=utils[_0xb41b('0x34')](agents[_0x46dbbf[_0xb41b('0x16')]][_0xb41b('0x35')],agents[_0x46dbbf['destuniqueid']][_0xb41b('0x2c')]);agents[_0x46dbbf[_0xb41b('0x16')]]['reason']=_0x46dbbf[_0xb41b('0x30')];agents[_0x46dbbf['destuniqueid']]['lastevent']='complete';writeDB(agents[_0x46dbbf['destuniqueid']]);}}catch(_0x263d8d){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x32'),_0x46dbbf[_0xb41b('0x5')]),_0x263d8d);}};exports[_0xb41b('0x36')]=function(_0x34d076){try{if(!_[_0xb41b('0x1c')](agents[_0x34d076[_0xb41b('0x37')]])){utils[_0xb41b('0x12')](util[_0xb41b('0x3')](_0xb41b('0x38'),_0x34d076[_0xb41b('0x5')]),_0x34d076);utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x39'),_0x34d076['uniqueid'],agents[_0x34d076[_0xb41b('0x37')]]['membername'],agents[_0x34d076['transfereruniqueid']][_0xb41b('0x5')]));agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3a')]=!![];agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3b')]=_0xb41b('0x3c');agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3d')]=_0x34d076[_0xb41b('0x3e')];agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x3f')]=agents[_0x34d076[_0xb41b('0x37')]][_0xb41b('0x5')];}}catch(_0x3ce89e){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x38'),_0x34d076[_0xb41b('0x5')]),_0x3ce89e);}};exports[_0xb41b('0x40')]=function(_0x247ca0){try{utils[_0xb41b('0x12')](util['format'](_0xb41b('0x41'),_0x247ca0['origtransfereruniqueid']),_0x247ca0);if(_0x247ca0[_0xb41b('0x42')]==_0x247ca0[_0xb41b('0x43')]){if(!_[_0xb41b('0x1c')](agents[_0x247ca0[_0xb41b('0x44')]])){utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x45'),_0x247ca0['origtransfereruniqueid'],agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x7')]));agents[_0x247ca0[_0xb41b('0x44')]]['transfer']=!![];agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x3b')]=_0xb41b('0x46');agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x3d')]=_0x247ca0[_0xb41b('0x47')];agents[_0x247ca0[_0xb41b('0x44')]]['transferuniqueid']=_0x247ca0['origtransfereruniqueid'];}if(_0x247ca0[_0xb41b('0x48')]&&agents[_0x247ca0[_0xb41b('0x48')]]){agents[_0x247ca0['transfereeuniqueid']][_0xb41b('0x49')]=0x1;transfers[_0x247ca0[_0xb41b('0x48')]]=_['clone'](agents[_0x247ca0[_0xb41b('0x48')]]);transfers[_0x247ca0[_0xb41b('0x48')]][_0xb41b('0x4a')]=agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x4a')];transfers[_0x247ca0[_0xb41b('0x48')]][_0xb41b('0x4b')]=agents[_0x247ca0[_0xb41b('0x44')]][_0xb41b('0x4b')];transfers[_0x247ca0[_0xb41b('0x48')]]['agentcalledAt']=utils[_0xb41b('0x15')]();transfers[_0x247ca0[_0xb41b('0x48')]]['agentconnectAt']=utils['now']();transfers[_0x247ca0[_0xb41b('0x48')]][_0xb41b('0x29')]=0x0;transfers[_0x247ca0[_0xb41b('0x48')]]['agententerreason']=0x2;}}else if(_0x247ca0[_0xb41b('0x44')]==_0x247ca0[_0xb41b('0x4c')]){if(!_[_0xb41b('0x1c')](agents[_0x247ca0[_0xb41b('0x42')]])){utils[_0xb41b('0x2')](util[_0xb41b('0x3')](_0xb41b('0x45'),_0x247ca0[_0xb41b('0x42')],agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x7')]));agents[_0x247ca0['origtransfereruniqueid']][_0xb41b('0x3a')]=!![];agents[_0x247ca0[_0xb41b('0x42')]]['transfertype']=_0xb41b('0x46');agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x3d')]=_0x247ca0['secondtransfererexten'];agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x3f')]=_0x247ca0[_0xb41b('0x44')];}if(_0x247ca0[_0xb41b('0x4d')]&&agents[_0x247ca0[_0xb41b('0x4d')]]){agents[_0x247ca0[_0xb41b('0x4d')]][_0xb41b('0x49')]=0x1;transfers[_0x247ca0[_0xb41b('0x4d')]]=_[_0xb41b('0x4e')](agents[_0x247ca0[_0xb41b('0x4d')]]);transfers[_0x247ca0['transfertargetuniqueid']]['calleridnum']=agents[_0x247ca0['origtransfereruniqueid']]['calleridnum'];transfers[_0x247ca0[_0xb41b('0x4d')]][_0xb41b('0x4b')]=agents[_0x247ca0[_0xb41b('0x42')]][_0xb41b('0x4b')];transfers[_0x247ca0[_0xb41b('0x4d')]][_0xb41b('0x14')]=utils['now']();transfers[_0x247ca0[_0xb41b('0x4d')]]['agentconnectAt']=utils[_0xb41b('0x15')]();transfers[_0x247ca0['transfertargetuniqueid']][_0xb41b('0x29')]=0x0;transfers[_0x247ca0['transfertargetuniqueid']][_0xb41b('0x49')]=0x2;}}}catch(_0xc2afd1){utils['error'](util[_0xb41b('0x3')](_0xb41b('0x41'),_0x247ca0[_0xb41b('0x42')]),_0xc2afd1);}};exports[_0xb41b('0x4f')]=function(_0x39f6ad){try{utils[_0xb41b('0x12')](util[_0xb41b('0x3')]('[%s][agents][hangup]',_0x39f6ad[_0xb41b('0x5')]),_0x39f6ad);if(agents[_0x39f6ad['uniqueid']]&&agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')]===_0xb41b('0x20')){if(_0x39f6ad['cause']==='21'){agents[_0x39f6ad['uniqueid']]['reason']='rejected';agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]=_0xb41b('0x50');}utils['info'](util['format'](_0xb41b('0x51'),_0x39f6ad[_0xb41b('0x5')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x7')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')],agents[_0x39f6ad[_0xb41b('0x5')]]['lastevent']));writeDB(agents[_0x39f6ad['uniqueid']]);var _0x303ca3=unanswered[_0xb41b('0x52')](_0x39f6ad['uniqueid']);if(_0x303ca3>-0x1){unanswered[_0xb41b('0x53')](_0x303ca3,0x1);}}if(transfers[_0x39f6ad['uniqueid']]){transfers[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0xd')]=!![];transfers[_0x39f6ad['uniqueid']][_0xb41b('0x35')]=utils[_0xb41b('0x15')]();transfers[_0x39f6ad['uniqueid']]['talktime']=utils[_0xb41b('0x34')](transfers[_0x39f6ad[_0xb41b('0x5')]]['agentcompleteAt'],transfers[_0x39f6ad[_0xb41b('0x5')]]['agentconnectAt']);transfers[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')]='agent';transfers[_0x39f6ad['uniqueid']][_0xb41b('0x17')]=_0xb41b('0x54');utils['info'](util[_0xb41b('0x3')](_0xb41b('0x51'),_0x39f6ad[_0xb41b('0x5')],transfers[_0x39f6ad['uniqueid']][_0xb41b('0x7')],transfers[_0x39f6ad['uniqueid']]['reason'],transfers[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]));writeDB(transfers[_0x39f6ad[_0xb41b('0x5')]],!![]);}if(agents[_0x39f6ad[_0xb41b('0x5')]]&&agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x2c')]){agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0xd')]=!![];agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x35')]=utils[_0xb41b('0x15')]();agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x22')]=utils['diffTime'](agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x35')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x2c')]);agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x30')]=agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x3a')]?'transfer':'agent';agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]=_0xb41b('0x54');utils['info'](util[_0xb41b('0x3')](_0xb41b('0x51'),_0x39f6ad['uniqueid'],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x7')],agents[_0x39f6ad['uniqueid']][_0xb41b('0x30')],agents[_0x39f6ad[_0xb41b('0x5')]][_0xb41b('0x17')]));writeDB(agents[_0x39f6ad[_0xb41b('0x5')]]);}}catch(_0x31c5c1){utils[_0xb41b('0x24')](util[_0xb41b('0x3')](_0xb41b('0x55'),_0x39f6ad[_0xb41b('0x5')]),_0x31c5c1);}}; \ No newline at end of file +var _0x84a0=['transferexten','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','complete','lodash','util','./utils','info','format','channel','queue','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','reason','timeout','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x84a0,0x66));var _0x084a=function(_0x3331f8,_0x492685){_0x3331f8=_0x3331f8-0x0;var _0x422f06=_0x84a0[_0x3331f8];return _0x422f06;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var utils=require(_0x084a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1fff7f,_0x483bfa){utils[_0x084a('0x3')](util[_0x084a('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1fff7f['uniqueid'],_0x1fff7f[_0x084a('0x5')],_0x1fff7f[_0x084a('0x6')],_0x1fff7f['membername'],_0x1fff7f[_0x084a('0x7')],_0x1fff7f[_0x084a('0x8')],_0x1fff7f[_0x084a('0x9')],_0x1fff7f[_0x084a('0xa')]));if(_0x1fff7f[_0x084a('0x6')]){utils['getVoiceQueueByName'](_0x1fff7f[_0x084a('0x6')])[_0x084a('0xb')](function(_0x8198ad){if(_0x8198ad){_0x1fff7f[_0x084a('0xc')]=_0x8198ad[_0x084a('0xc')];_0x1fff7f['agentacw']=_0x1fff7f['agentcomplete']?_0x8198ad[_0x084a('0xd')]:![];_0x1fff7f[_0x084a('0xe')]=_0x1fff7f[_0x084a('0xf')]?_0x8198ad[_0x084a('0x10')]:0x0;}utils[_0x084a('0x11')]('CreateVoiceAgentReport',_0x1fff7f);});}else{utils['request'](_0x084a('0x12'),_0x1fff7f);}if(_0x483bfa){delete transfers[_0x1fff7f[_0x084a('0x13')]];}else{delete agents[_0x1fff7f[_0x084a('0x14')]];}}exports[_0x084a('0x15')]=function(_0x1bdfb8){try{utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x17'),_0x1bdfb8['uniqueid']),_0x1bdfb8);agents[_0x1bdfb8[_0x084a('0x14')]]=_0x1bdfb8;agents[_0x1bdfb8['destuniqueid']][_0x084a('0x18')]=utils[_0x084a('0x19')]();agents[_0x1bdfb8[_0x084a('0x14')]][_0x084a('0xa')]=_0x084a('0x1a');agents[_0x1bdfb8['destuniqueid']][_0x084a('0x9')]=null;agents[_0x1bdfb8['destuniqueid']][_0x084a('0x1b')]=null;utils[_0x084a('0x3')](util['format'](_0x084a('0x1c'),_0x1bdfb8[_0x084a('0x13')],agents[_0x1bdfb8[_0x084a('0x14')]][_0x084a('0x1d')],_0x1bdfb8[_0x084a('0x14')]));}catch(_0x145636){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x17'),_0x1bdfb8[_0x084a('0x13')]),_0x145636);}};exports[_0x084a('0x1f')]=function(_0x279e25){try{if(!_[_0x084a('0x20')](agents[_0x279e25[_0x084a('0x14')]])){utils[_0x084a('0x16')](util['format'](_0x084a('0x21'),_0x279e25[_0x084a('0x13')]),_0x279e25);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x22'),_0x279e25['uniqueid'],agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x1d')],_0x279e25[_0x084a('0x14')]));agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x1f')]=!![];agents[_0x279e25[_0x084a('0x14')]]['agentringnoanswerAt']=utils[_0x084a('0x19')]();agents[_0x279e25[_0x084a('0x14')]][_0x084a('0xa')]='timeout';agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x23')]=_0x084a('0x24');agents[_0x279e25['destuniqueid']]['holdtime']=_0x279e25['ringtime']?parseInt(_0x279e25['ringtime'])/0x3e8:0x0;agents[_0x279e25[_0x084a('0x14')]]['talktime']=0x0;unanswered['push'](_0x279e25['destuniqueid']);}}catch(_0x3b8176){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x21'),_0x279e25[_0x084a('0x13')]),_0x3b8176);}};exports[_0x084a('0x25')]=function(_0x378de6){try{_[_0x084a('0x26')](agents,function(_0x5e6ea8,_0x2ed3cd){if(_0x5e6ea8[_0x084a('0x13')]==_0x378de6['uniqueid']&&!_[_0x084a('0x27')](unanswered,_0x5e6ea8[_0x084a('0x14')])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x28'),_0x378de6[_0x084a('0x13')]),_0x378de6);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x29'),_0x378de6[_0x084a('0x13')],_0x5e6ea8[_0x084a('0x1d')],_0x5e6ea8[_0x084a('0x14')]));_0x5e6ea8[_0x084a('0x1f')]=!![];_0x5e6ea8['agentringnoanswerAt']=utils['now']();_0x5e6ea8[_0x084a('0xa')]=_0x084a('0x2a');_0x5e6ea8[_0x084a('0x23')]=_0x084a('0x2a');_0x5e6ea8[_0x084a('0x2b')]=_0x378de6['holdtime'];_0x5e6ea8[_0x084a('0x2c')]=0x0;writeDB(_0x5e6ea8);}});}catch(_0x1b56ad){utils[_0x084a('0x1e')](util['format'](_0x084a('0x28'),_0x378de6[_0x084a('0x13')]),_0x1b56ad);}};exports[_0x084a('0x2d')]=function(_0x4c4c90){try{if(agents[_0x4c4c90['destuniqueid']]){utils['debug'](util[_0x084a('0x4')](_0x084a('0x2e'),_0x4c4c90[_0x084a('0x13')]),_0x4c4c90);utils['info'](util[_0x084a('0x4')](_0x084a('0x2f'),_0x4c4c90[_0x084a('0x13')],agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x1d')],_0x4c4c90[_0x084a('0x14')]));agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x9')]=_0x4c4c90[_0x084a('0x9')];agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x1b')]=_0x4c4c90[_0x084a('0x1b')];agents[_0x4c4c90['destuniqueid']][_0x084a('0x2b')]=_0x4c4c90[_0x084a('0x31')];agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0xa')]=_0x084a('0x32');_[_0x084a('0x26')](agents,function(_0xa7b652,_0x183e10){if(_0xa7b652[_0x084a('0x14')]!=_0x4c4c90['destuniqueid']&&_0xa7b652[_0x084a('0x13')]==_0x4c4c90[_0x084a('0x13')]){_0xa7b652[_0x084a('0x2c')]=0x0;_0xa7b652[_0x084a('0x2b')]=_0x4c4c90[_0x084a('0x31')];_0xa7b652[_0x084a('0x1f')]=!![];_0xa7b652['agentringnoanswerAt']=utils[_0x084a('0x19')]();_0xa7b652[_0x084a('0xa')]='answered_elsewhere';_0xa7b652[_0x084a('0x23')]=_0x084a('0x33');_0xa7b652[_0x084a('0x34')]=_0x4c4c90['destuniqueid'];_0xa7b652[_0x084a('0x35')]=_0x4c4c90[_0x084a('0x1d')];writeDB(_0xa7b652);}});}}catch(_0x4fe9c2){utils[_0x084a('0x1e')](util[_0x084a('0x4')]('[%s][agents][agentconnect]',_0x4c4c90['uniqueid']),_0x4fe9c2);}};exports[_0x084a('0x36')]=function(_0x17a8d4){try{if(!_[_0x084a('0x20')](agents[_0x17a8d4[_0x084a('0x14')]])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x37'),_0x17a8d4[_0x084a('0x13')]),_0x17a8d4);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x38'),_0x17a8d4['uniqueid'],agents[_0x17a8d4['destuniqueid']][_0x084a('0x1d')],_0x17a8d4[_0x084a('0x14')]));agents[_0x17a8d4[_0x084a('0x14')]]['agentcomplete']=!![];agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x39')]=utils[_0x084a('0x19')]();agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x2c')]=utils['diffTime'](agents[_0x17a8d4[_0x084a('0x14')]]['agentcompleteAt'],agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x30')]);agents[_0x17a8d4[_0x084a('0x14')]]['reason']=_0x17a8d4['reason'];agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0xa')]='complete';writeDB(agents[_0x17a8d4[_0x084a('0x14')]]);}}catch(_0x2c2c2e){utils[_0x084a('0x1e')](util[_0x084a('0x4')]('[%s][agents][agentcomplete]',_0x17a8d4[_0x084a('0x13')]),_0x2c2c2e);}};exports[_0x084a('0x3a')]=function(_0x31677b){try{if(!_[_0x084a('0x20')](agents[_0x31677b['transfereruniqueid']])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x3b'),_0x31677b[_0x084a('0x13')]),_0x31677b);utils['info'](util['format'](_0x084a('0x3c'),_0x31677b[_0x084a('0x13')],agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x1d')],agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x13')]));agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x3e')]=!![];agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x3f')]=_0x084a('0x40');agents[_0x31677b[_0x084a('0x3d')]]['transferexten']=_0x31677b[_0x084a('0x41')];agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x42')]=agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x13')];}}catch(_0x1c972c){utils[_0x084a('0x1e')](util['format'](_0x084a('0x3b'),_0x31677b[_0x084a('0x13')]),_0x1c972c);}};exports[_0x084a('0x43')]=function(_0x54aa6c){try{utils['debug'](util[_0x084a('0x4')]('[%s][agents][attendedtransfer]',_0x54aa6c[_0x084a('0x44')]),_0x54aa6c);if(_0x54aa6c[_0x084a('0x44')]==_0x54aa6c['origtransfererlinkedid']){if(!_[_0x084a('0x20')](agents[_0x54aa6c['secondtransfereruniqueid']])){utils['info'](util[_0x084a('0x4')](_0x084a('0x45'),_0x54aa6c[_0x084a('0x44')],agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x1d')]));agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x3e')]=!![];agents[_0x54aa6c['secondtransfereruniqueid']][_0x084a('0x3f')]=_0x084a('0x47');agents[_0x54aa6c[_0x084a('0x46')]]['transferexten']=_0x54aa6c[_0x084a('0x48')];agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x42')]=_0x54aa6c[_0x084a('0x44')];}if(_0x54aa6c['transfereeuniqueid']&&agents[_0x54aa6c[_0x084a('0x49')]]){agents[_0x54aa6c['transfereeuniqueid']][_0x084a('0x4a')]=0x1;transfers[_0x54aa6c[_0x084a('0x49')]]=_[_0x084a('0x4b')](agents[_0x54aa6c['transfereeuniqueid']]);transfers[_0x54aa6c['transfereeuniqueid']][_0x084a('0x8')]=agents[_0x54aa6c[_0x084a('0x46')]]['calleridnum'];transfers[_0x54aa6c[_0x084a('0x49')]]['calleridname']=agents[_0x54aa6c['secondtransfereruniqueid']][_0x084a('0x4c')];transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x18')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x2b')]=0x0;transfers[_0x54aa6c['transfereeuniqueid']][_0x084a('0x4a')]=0x2;}}else if(_0x54aa6c[_0x084a('0x46')]==_0x54aa6c[_0x084a('0x4d')]){if(!_['isNil'](agents[_0x54aa6c[_0x084a('0x44')]])){utils[_0x084a('0x3')](util['format'](_0x084a('0x45'),_0x54aa6c['origtransfereruniqueid'],agents[_0x54aa6c['origtransfereruniqueid']][_0x084a('0x1d')]));agents[_0x54aa6c['origtransfereruniqueid']]['transfer']=!![];agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x3f')]=_0x084a('0x47');agents[_0x54aa6c['origtransfereruniqueid']][_0x084a('0x4e')]=_0x54aa6c[_0x084a('0x4f')];agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x42')]=_0x54aa6c[_0x084a('0x46')];}if(_0x54aa6c[_0x084a('0x50')]&&agents[_0x54aa6c[_0x084a('0x50')]]){agents[_0x54aa6c['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x54aa6c[_0x084a('0x50')]]=_[_0x084a('0x4b')](agents[_0x54aa6c['transfertargetuniqueid']]);transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x8')]=agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x8')];transfers[_0x54aa6c['transfertargetuniqueid']][_0x084a('0x4c')]=agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x4c')];transfers[_0x54aa6c['transfertargetuniqueid']]['agentcalledAt']=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x2b')]=0x0;transfers[_0x54aa6c[_0x084a('0x50')]]['agententerreason']=0x2;}}}catch(_0x22efb6){utils['error'](util['format'](_0x084a('0x51'),_0x54aa6c[_0x084a('0x44')]),_0x22efb6);}};exports[_0x084a('0x52')]=function(_0x4a2745){try{utils[_0x084a('0x16')](util['format'](_0x084a('0x53'),_0x4a2745[_0x084a('0x13')]),_0x4a2745);if(agents[_0x4a2745[_0x084a('0x13')]]&&agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]===_0x084a('0x24')){if(_0x4a2745['cause']==='21'){agents[_0x4a2745['uniqueid']][_0x084a('0x23')]=_0x084a('0x54');agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]=_0x084a('0x54');}utils[_0x084a('0x3')](util['format'](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x1d')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],agents[_0x4a2745[_0x084a('0x13')]]['lastevent']));writeDB(agents[_0x4a2745[_0x084a('0x13')]]);var _0x38b5b6=unanswered[_0x084a('0x56')](_0x4a2745[_0x084a('0x13')]);if(_0x38b5b6>-0x1){unanswered[_0x084a('0x57')](_0x38b5b6,0x1);}}if(transfers[_0x4a2745[_0x084a('0x13')]]){transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x36')]=!![];transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')]=utils['now']();transfers[_0x4a2745['uniqueid']]['talktime']=utils[_0x084a('0x58')](transfers[_0x4a2745[_0x084a('0x13')]]['agentcompleteAt'],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x30')]);transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]='agent';transfers[_0x4a2745['uniqueid']][_0x084a('0xa')]=_0x084a('0x59');utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],transfers[_0x4a2745[_0x084a('0x13')]]['membername'],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]));writeDB(transfers[_0x4a2745[_0x084a('0x13')]],!![]);}if(agents[_0x4a2745[_0x084a('0x13')]]&&agents[_0x4a2745[_0x084a('0x13')]]['agentconnectAt']){agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x36')]=!![];agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')]=utils[_0x084a('0x19')]();agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x2c')]=utils[_0x084a('0x58')](agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')],agents[_0x4a2745[_0x084a('0x13')]]['agentconnectAt']);agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]=agents[_0x4a2745['uniqueid']][_0x084a('0x3e')]?'transfer':'agent';agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]='complete';utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x1d')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]));writeDB(agents[_0x4a2745[_0x084a('0x13')]]);}}catch(_0x7c85e3){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x53'),_0x4a2745['uniqueid']),_0x7c85e3);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 4c08abf..3fa3c2d 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 _0x1ea1=['[%s][calls][musiconholdstop]','musiconholdstartAt','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][varset]','xmd-originatecalleridnum','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','value','destination','\x22\x20<','variable','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','cdr','substring','lastIndexOf','includes','hangup','execif','set','gotoif','appdata','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','newchannel','debug','linkedid','OutgoingSpoolFailed','context','exten','now','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','ANSWERED','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop'];(function(_0x40ca2b,_0x3fa84f){var _0x990011=function(_0x39682f){while(--_0x39682f){_0x40ca2b['push'](_0x40ca2b['shift']());}};_0x990011(++_0x3fa84f);}(_0x1ea1,0x109));var _0x11ea=function(_0x4457f4,_0x1aaef3){_0x4457f4=_0x4457f4-0x0;var _0x5b4588=_0x1ea1[_0x4457f4];return _0x5b4588;};'use strict';var _=require(_0x11ea('0x0'));var util=require('util');var utils=require(_0x11ea('0x1'));var transfers=require(_0x11ea('0x2'));var dispositions=[_0x11ea('0x3'),'FAILED','FAILED',_0x11ea('0x3'),_0x11ea('0x3'),_0x11ea('0x3'),'ANSWERED','BUSY',_0x11ea('0x4'),_0x11ea('0x4'),_0x11ea('0x4')];var channels={};function writeDB(_0x173017){var _0x245a99;if(transfers[_0x11ea('0x5')][_0x173017['uniqueid']]){_0x245a99=_0x173017[_0x11ea('0x6')];_0x173017[_0x11ea('0x6')]=transfers[_0x11ea('0x5')][_0x173017['uniqueid']][_0x11ea('0x7')];}utils[_0x11ea('0x8')](util[_0x11ea('0x9')](_0x11ea('0xa'),_0x173017[_0x11ea('0x6')],_0x173017[_0x11ea('0xb')],_0x173017['queue'],_0x173017[_0x11ea('0xc')],_0x173017[_0x11ea('0xd')],_0x173017[_0x11ea('0xe')],_0x173017[_0x11ea('0xf')],_0x173017[_0x11ea('0x10')]));if(_0x173017[_0x11ea('0x11')]){utils[_0x11ea('0x12')](_0x173017[_0x11ea('0x11')])[_0x11ea('0x13')](function(_0x1fe7df){if(_0x1fe7df){_0x173017[_0x11ea('0x14')]=_0x1fe7df['id'];}utils['request'](_0x11ea('0x15'),_0x173017);});}else{utils[_0x11ea('0x16')](_0x11ea('0x15'),_0x173017);}if(channels[_0x173017[_0x11ea('0x6')]]){delete channels[_0x173017[_0x11ea('0x6')]];}else if(_0x245a99&&channels[_0x245a99]){delete transfers[_0x11ea('0x5')][_0x245a99];delete channels[_0x245a99];}}exports[_0x11ea('0x17')]=function(_0x45c067){try{utils[_0x11ea('0x18')](util[_0x11ea('0x9')]('[%s][calls][newchannel]',_0x45c067[_0x11ea('0x6')]),_0x45c067);if(_0x45c067[_0x11ea('0x6')]==_0x45c067[_0x11ea('0x19')]&&_0x45c067[_0x11ea('0xb')]!=_0x11ea('0x1a')){utils[_0x11ea('0x8')](util[_0x11ea('0x9')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x45c067[_0x11ea('0x6')],_0x45c067[_0x11ea('0x1b')],_0x45c067[_0x11ea('0x1c')]));channels[_0x45c067[_0x11ea('0x6')]]={'uniqueid':_0x45c067['uniqueid'],'accountcode':_0x45c067[_0x11ea('0x11')],'source':_0x45c067['calleridnum'],'destination':_0x45c067[_0x11ea('0x1c')],'destinationcontext':_0x45c067[_0x11ea('0x1b')],'channel':_0x45c067['channel'],'starttime':utils[_0x11ea('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x11ea('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x1e32f3){utils[_0x11ea('0x1e')](util[_0x11ea('0x9')](_0x11ea('0x1f'),_0x45c067['uniqueid']),_0x1e32f3);}};exports[_0x11ea('0x20')]=function(_0x3c2539){try{utils['debug'](util[_0x11ea('0x9')](_0x11ea('0x21'),_0x3c2539[_0x11ea('0x6')]),_0x3c2539);if(!_[_0x11ea('0x22')](channels[_0x3c2539[_0x11ea('0x6')]])&&_0x3c2539[_0x11ea('0x23')]==0x6){utils['info'](util[_0x11ea('0x9')](_0x11ea('0x24'),_0x3c2539[_0x11ea('0x6')],_0x3c2539['context'],_0x3c2539[_0x11ea('0xb')]));if(_[_0x11ea('0x22')](channels[_0x3c2539[_0x11ea('0x6')]][_0x11ea('0x25')])){channels[_0x3c2539[_0x11ea('0x6')]][_0x11ea('0x25')]=utils[_0x11ea('0x1d')]();}}else if(!_['isNil'](channels[_0x3c2539[_0x11ea('0x19')]])&&_0x3c2539[_0x11ea('0x23')]==0x6&&_0x3c2539[_0x11ea('0x1b')]!='transfer'){utils['info'](util['format'](_0x11ea('0x26'),_0x3c2539[_0x11ea('0x6')],_0x3c2539['linkedid'],_0x3c2539[_0x11ea('0x1b')],_0x3c2539[_0x11ea('0xb')]));channels[_0x3c2539['linkedid']][_0x11ea('0x11')]=_0x3c2539[_0x11ea('0x11')];channels[_0x3c2539[_0x11ea('0x19')]][_0x11ea('0x27')]=_0x3c2539['channel'];if(_['isNil'](channels[_0x3c2539['linkedid']][_0x11ea('0x28')])){channels[_0x3c2539['linkedid']][_0x11ea('0x28')]=utils[_0x11ea('0x1d')]();}channels[_0x3c2539[_0x11ea('0x19')]][_0x11ea('0x29')]=dispositions[_['toNumber'](_0x3c2539[_0x11ea('0x23')])]||_0x11ea('0x2a');}}catch(_0x45e30c){utils[_0x11ea('0x1e')](util[_0x11ea('0x9')]('[%s][calls][newstate]',_0x3c2539[_0x11ea('0x6')]),_0x45e30c);}};exports['hangup']=function(_0x5edd72){try{if(!_[_0x11ea('0x22')](channels[_0x5edd72[_0x11ea('0x6')]])){utils[_0x11ea('0x18')](util[_0x11ea('0x9')](_0x11ea('0x2b'),_0x5edd72[_0x11ea('0x6')]),_0x5edd72);if(_[_0x11ea('0x22')](channels[_0x5edd72[_0x11ea('0x6')]][_0x11ea('0x2c')])){channels[_0x5edd72[_0x11ea('0x6')]][_0x11ea('0x2c')]=_0x5edd72[_0x11ea('0x2d')]+'\x20<'+_0x5edd72[_0x11ea('0xe')]+'>';}utils[_0x11ea('0x8')](util[_0x11ea('0x9')](_0x11ea('0x2e'),_0x5edd72[_0x11ea('0x6')],channels[_0x5edd72[_0x11ea('0x6')]][_0x11ea('0x2c')],_0x5edd72[_0x11ea('0x2f')]));channels[_0x5edd72[_0x11ea('0x6')]][_0x11ea('0x30')]=utils['now']();channels[_0x5edd72[_0x11ea('0x6')]][_0x11ea('0x31')]=utils[_0x11ea('0x32')](channels[_0x5edd72[_0x11ea('0x6')]][_0x11ea('0x30')],channels[_0x5edd72[_0x11ea('0x6')]]['starttime']);channels[_0x5edd72[_0x11ea('0x6')]][_0x11ea('0x33')]=channels[_0x5edd72[_0x11ea('0x6')]][_0x11ea('0x28')]?utils[_0x11ea('0x32')](channels[_0x5edd72[_0x11ea('0x6')]][_0x11ea('0x30')],channels[_0x5edd72[_0x11ea('0x6')]][_0x11ea('0x28')]):0x0;writeDB(channels[_0x5edd72[_0x11ea('0x6')]]);}}catch(_0x28d33c){utils[_0x11ea('0x1e')](util[_0x11ea('0x9')](_0x11ea('0x2b'),_0x5edd72[_0x11ea('0x6')]),_0x28d33c);}};exports[_0x11ea('0x34')]=function(_0x21ea79){try{if(!_[_0x11ea('0x22')](channels[_0x21ea79[_0x11ea('0x35')]])){utils[_0x11ea('0x18')](util[_0x11ea('0x9')]('[%s][calls][attendedtransfer]',_0x21ea79[_0x11ea('0x36')]),_0x21ea79);if(channels[_0x21ea79[_0x11ea('0x35')]][_0x11ea('0xb')]==_0x21ea79[_0x11ea('0x37')]){utils['info'](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x21ea79[_0x11ea('0x36')],_0x21ea79[_0x11ea('0x35')],_0x21ea79['secondtransfererchannel']));channels[_0x21ea79[_0x11ea('0x35')]][_0x11ea('0x27')]=_0x21ea79[_0x11ea('0x38')];channels[_0x21ea79['localtwolinkedid']]['userfield']=_0x11ea('0x39');}else if(channels[_0x21ea79[_0x11ea('0x35')]][_0x11ea('0xb')]=_0x21ea79[_0x11ea('0x3a')]){utils['info'](util[_0x11ea('0x9')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x21ea79[_0x11ea('0x36')],_0x21ea79[_0x11ea('0x35')],_0x21ea79[_0x11ea('0x3b')]));channels[_0x21ea79[_0x11ea('0x35')]]['destinationchannel']=_0x21ea79['origtransfererchannel'];channels[_0x21ea79['localtwolinkedid']][_0x11ea('0x3c')]=_0x11ea('0x39');}}}catch(_0x36b54e){utils[_0x11ea('0x1e')](util[_0x11ea('0x9')](_0x11ea('0x3d'),_0x21ea79['origtransfereruniqueid']),_0x36b54e);}};exports['musiconholdstart']=function(_0x129365){try{if(!_[_0x11ea('0x22')](channels[_0x129365[_0x11ea('0x6')]])){utils[_0x11ea('0x18')](util['format'](_0x11ea('0x3e'),_0x129365[_0x11ea('0x6')]),_0x129365);channels[_0x129365[_0x11ea('0x6')]]['musiconholdstartAt']=utils['now']();utils['info'](util[_0x11ea('0x9')](_0x11ea('0x3f'),_0x129365[_0x11ea('0x6')],channels[_0x129365[_0x11ea('0x6')]]['musiconholdstartAt']));}}catch(_0x39aeea){utils['error'](util[_0x11ea('0x9')](_0x11ea('0x3e'),_0x129365[_0x11ea('0x6')]),_0x39aeea);}};exports[_0x11ea('0x40')]=function(_0x233b44){try{if(!_[_0x11ea('0x22')](channels[_0x233b44[_0x11ea('0x6')]])){utils['debug'](util[_0x11ea('0x9')](_0x11ea('0x41'),_0x233b44[_0x11ea('0x6')]),_0x233b44);if(!_['isNil'](channels[_0x233b44['uniqueid']][_0x11ea('0x42')])){channels[_0x233b44[_0x11ea('0x6')]]['mohtime']+=utils['diffTime'](utils[_0x11ea('0x1d')](),channels[_0x233b44['uniqueid']][_0x11ea('0x42')]);utils[_0x11ea('0x8')](util[_0x11ea('0x9')](_0x11ea('0x43'),_0x233b44[_0x11ea('0x6')],channels[_0x233b44[_0x11ea('0x6')]][_0x11ea('0x44')]));delete channels[_0x233b44[_0x11ea('0x6')]][_0x11ea('0x42')];}}}catch(_0x2aaf6c){utils['error'](util[_0x11ea('0x9')]('[%s][calls][musiconholdstop]',_0x233b44[_0x11ea('0x6')]),_0x2aaf6c);}};exports['varset']=function(_0x806aee){try{if(!_[_0x11ea('0x22')](channels[_0x806aee[_0x11ea('0x6')]])){utils[_0x11ea('0x18')](util[_0x11ea('0x9')](_0x11ea('0x45'),_0x806aee[_0x11ea('0x6')]),_0x806aee);if(!_[_0x11ea('0x22')](_0x806aee['variable'][_0x11ea('0x46')])){utils['info'](util[_0x11ea('0x9')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x806aee[_0x11ea('0x6')],_0x806aee['value']));channels[_0x806aee[_0x11ea('0x6')]][_0x11ea('0x47')]=_0x806aee['value'];}if(!_[_0x11ea('0x22')](_0x806aee['variable'][_0x11ea('0x48')])){utils[_0x11ea('0x8')](util[_0x11ea('0x9')](_0x11ea('0x49'),_0x806aee[_0x11ea('0x6')],_0x806aee[_0x11ea('0x4a')]));channels[_0x806aee[_0x11ea('0x6')]][_0x11ea('0x4b')]=_0x806aee[_0x11ea('0x4a')];channels[_0x806aee[_0x11ea('0x6')]][_0x11ea('0x2c')]='\x22'+_0x806aee['value']+_0x11ea('0x4c')+_0x806aee['value']+'>';}if(!_[_0x11ea('0x22')](_0x806aee[_0x11ea('0x4d')][_0x11ea('0x4e')])||!_[_0x11ea('0x22')](_0x806aee[_0x11ea('0x4d')][_0x11ea('0x4f')])){utils[_0x11ea('0x8')](util[_0x11ea('0x9')](_0x11ea('0x50'),_0x806aee[_0x11ea('0x6')],!_[_0x11ea('0x22')](_0x806aee[_0x11ea('0x4d')][_0x11ea('0x4e')])?'xmd-callerid-preview':_0x11ea('0x4f'),_0x806aee[_0x11ea('0x4a')]));channels[_0x806aee[_0x11ea('0x6')]][_0x11ea('0x2c')]=_0x806aee['value'];}if(!_[_0x11ea('0x22')](_0x806aee[_0x11ea('0x4d')][_0x11ea('0x51')])||!_[_0x11ea('0x22')](_0x806aee[_0x11ea('0x4d')][_0x11ea('0x52')])){utils[_0x11ea('0x8')](util['format'](_0x11ea('0x50'),_0x806aee[_0x11ea('0x6')],!_[_0x11ea('0x22')](_0x806aee['variable'][_0x11ea('0x51')])?_0x11ea('0x51'):_0x11ea('0x52'),_0x806aee['value']));channels[_0x806aee[_0x11ea('0x6')]][_0x11ea('0x53')]=_0x11ea('0x54');channels[_0x806aee[_0x11ea('0x6')]][_0x11ea('0x55')]=_0x806aee[_0x11ea('0x4a')];channels[_0x806aee[_0x11ea('0x6')]][_0x11ea('0x56')]=!![];}if(!_[_0x11ea('0x22')](_0x806aee[_0x11ea('0x4d')][_0x11ea('0x57')])){utils[_0x11ea('0x8')](util[_0x11ea('0x9')](_0x11ea('0x58'),_0x806aee[_0x11ea('0x6')],_0x806aee[_0x11ea('0x4a')]));channels[_0x806aee['uniqueid']][_0x11ea('0x59')]=_0x806aee[_0x11ea('0x4a')];}if(!_[_0x11ea('0x22')](_0x806aee[_0x11ea('0x4d')][_0x11ea('0x5a')])){utils[_0x11ea('0x8')](util[_0x11ea('0x9')](_0x11ea('0x5b'),_0x806aee['uniqueid'],_0x806aee[_0x11ea('0x4a')]));channels[_0x806aee['uniqueid']][_0x11ea('0x5c')]=_0x806aee[_0x11ea('0x4a')];}if(!_[_0x11ea('0x22')](_0x806aee[_0x11ea('0x4d')]['outboundrouteid'])){utils[_0x11ea('0x8')](util[_0x11ea('0x9')](_0x11ea('0x5d'),_0x806aee['uniqueid'],_0x806aee[_0x11ea('0x4a')]));channels[_0x806aee['uniqueid']]['routeid']=_0x806aee['value'];}if(!_['isNil'](_0x806aee[_0x11ea('0x4d')][_0x11ea('0x5e')])){utils[_0x11ea('0x8')](util[_0x11ea('0x9')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x806aee[_0x11ea('0x6')],_0x806aee[_0x11ea('0x4a')]));channels[_0x806aee['uniqueid']][_0x11ea('0x5e')]=_0x806aee['value'];}}}catch(_0xf782da){utils[_0x11ea('0x1e')](util[_0x11ea('0x9')](_0x11ea('0x45'),_0x806aee[_0x11ea('0x6')]),_0xf782da);}};exports[_0x11ea('0x5f')]=function(_0x33a0e9){try{if(!_[_0x11ea('0x22')](channels[_0x33a0e9[_0x11ea('0x6')]])){utils['debug'](util[_0x11ea('0x9')](_0x11ea('0x60'),_0x33a0e9[_0x11ea('0x6')]),_0x33a0e9);utils[_0x11ea('0x8')](util['format'](_0x11ea('0x61'),_0x33a0e9[_0x11ea('0x6')],_0x33a0e9[_0x11ea('0x62')],_0x33a0e9['appdata']));if(_0x33a0e9[_0x11ea('0x62')][_0x11ea('0x63')]()=='set'&&_[_0x11ea('0x64')](_0x33a0e9['appdata'][_0x11ea('0x63')](),_0x11ea('0x65'))){var _0x58a725=_0x33a0e9['appdata']['split']('=');var _0x2488e4=_0x58a725[0x0][_0x11ea('0x66')](_0x58a725[0x0][_0x11ea('0x67')]('(')+0x1,_0x58a725[0x0][_0x11ea('0x67')](')'));var _0x460ee8=_0x58a725[0x1];channels[_0x33a0e9[_0x11ea('0x6')]][_0x2488e4]=_0x460ee8;}if(!_[_0x11ea('0x68')]([_0x11ea('0x69'),'noop',_0x11ea('0x6a'),_0x11ea('0x6b'),_0x11ea('0x6c')],_0x33a0e9[_0x11ea('0x62')][_0x11ea('0x63')]())){channels[_0x33a0e9[_0x11ea('0x6')]]['lastapplication']=_0x33a0e9[_0x11ea('0x62')];channels[_0x33a0e9[_0x11ea('0x6')]][_0x11ea('0x55')]=_0x33a0e9[_0x11ea('0x6d')];}}}catch(_0x581d53){utils[_0x11ea('0x1e')](util[_0x11ea('0x9')](_0x11ea('0x60'),_0x33a0e9[_0x11ea('0x6')]),_0x581d53);}}; \ No newline at end of file +var _0x59a7=['[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','includes','hangup','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','destinationchannel','answertime','toNumber','callerid','calleridname','cause-txt','endtime','duration','diffTime','starttime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt'];(function(_0x39871a,_0x4042cf){var _0x38dd97=function(_0x2a0023){while(--_0x2a0023){_0x39871a['push'](_0x39871a['shift']());}};_0x38dd97(++_0x4042cf);}(_0x59a7,0x17a));var _0x759a=function(_0x5eb81a,_0x5aa6ae){_0x5eb81a=_0x5eb81a-0x0;var _0x4be675=_0x59a7[_0x5eb81a];return _0x4be675;};'use strict';var _=require(_0x759a('0x0'));var util=require(_0x759a('0x1'));var utils=require(_0x759a('0x2'));var transfers=require(_0x759a('0x3'));var dispositions=['NO\x20ANSWER',_0x759a('0x4'),'FAILED',_0x759a('0x5'),_0x759a('0x5'),_0x759a('0x5'),_0x759a('0x6'),_0x759a('0x7'),_0x759a('0x4'),'FAILED','FAILED'];var channels={};function writeDB(_0x3abe4e){var _0x32f707;if(transfers[_0x759a('0x8')][_0x3abe4e[_0x759a('0x9')]]){_0x32f707=_0x3abe4e[_0x759a('0x9')];_0x3abe4e[_0x759a('0x9')]=transfers[_0x759a('0x8')][_0x3abe4e[_0x759a('0x9')]]['transfereeuniqueid'];}utils[_0x759a('0xa')](util[_0x759a('0xb')](_0x759a('0xc'),_0x3abe4e[_0x759a('0x9')],_0x3abe4e[_0x759a('0xd')],_0x3abe4e[_0x759a('0xe')],_0x3abe4e[_0x759a('0xf')],_0x3abe4e['interface'],_0x3abe4e[_0x759a('0x10')],_0x3abe4e[_0x759a('0x11')],_0x3abe4e[_0x759a('0x12')]));if(_0x3abe4e['accountcode']){utils[_0x759a('0x13')](_0x3abe4e[_0x759a('0x14')])[_0x759a('0x15')](function(_0x481d26){if(_0x481d26){_0x3abe4e[_0x759a('0x16')]=_0x481d26['id'];}utils[_0x759a('0x17')](_0x759a('0x18'),_0x3abe4e);});}else{utils[_0x759a('0x17')](_0x759a('0x18'),_0x3abe4e);}if(channels[_0x3abe4e['uniqueid']]){delete channels[_0x3abe4e[_0x759a('0x9')]];}else if(_0x32f707&&channels[_0x32f707]){delete transfers['blinds'][_0x32f707];delete channels[_0x32f707];}}exports[_0x759a('0x19')]=function(_0x51bc3e){try{utils[_0x759a('0x1a')](util[_0x759a('0xb')](_0x759a('0x1b'),_0x51bc3e['uniqueid']),_0x51bc3e);if(_0x51bc3e[_0x759a('0x9')]==_0x51bc3e[_0x759a('0x1c')]&&_0x51bc3e[_0x759a('0xd')]!=_0x759a('0x1d')){utils[_0x759a('0xa')](util['format'](_0x759a('0x1e'),_0x51bc3e[_0x759a('0x9')],_0x51bc3e[_0x759a('0x1f')],_0x51bc3e[_0x759a('0x20')]));channels[_0x51bc3e[_0x759a('0x9')]]={'uniqueid':_0x51bc3e[_0x759a('0x9')],'accountcode':_0x51bc3e[_0x759a('0x14')],'source':_0x51bc3e[_0x759a('0x10')],'destination':_0x51bc3e[_0x759a('0x20')],'destinationcontext':_0x51bc3e[_0x759a('0x1f')],'channel':_0x51bc3e[_0x759a('0xd')],'starttime':utils[_0x759a('0x21')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x759a('0x5'),'amaflags':'DOCUMENTATION'};}}catch(_0x4e83f8){utils[_0x759a('0x22')](util[_0x759a('0xb')](_0x759a('0x1b'),_0x51bc3e[_0x759a('0x9')]),_0x4e83f8);}};exports[_0x759a('0x23')]=function(_0x3b5bb6){try{utils[_0x759a('0x1a')](util[_0x759a('0xb')](_0x759a('0x24'),_0x3b5bb6[_0x759a('0x9')]),_0x3b5bb6);if(!_[_0x759a('0x25')](channels[_0x3b5bb6[_0x759a('0x9')]])&&_0x3b5bb6[_0x759a('0x26')]==0x6){utils[_0x759a('0xa')](util[_0x759a('0xb')](_0x759a('0x27'),_0x3b5bb6[_0x759a('0x9')],_0x3b5bb6[_0x759a('0x1f')],_0x3b5bb6[_0x759a('0xd')]));if(_['isNil'](channels[_0x3b5bb6[_0x759a('0x9')]][_0x759a('0x28')])){channels[_0x3b5bb6[_0x759a('0x9')]][_0x759a('0x28')]=utils['now']();}}else if(!_[_0x759a('0x25')](channels[_0x3b5bb6['linkedid']])&&_0x3b5bb6['channelstate']==0x6&&_0x3b5bb6[_0x759a('0x1f')]!=_0x759a('0x29')){utils[_0x759a('0xa')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3b5bb6[_0x759a('0x9')],_0x3b5bb6[_0x759a('0x1c')],_0x3b5bb6[_0x759a('0x1f')],_0x3b5bb6[_0x759a('0xd')]));channels[_0x3b5bb6[_0x759a('0x1c')]][_0x759a('0x14')]=_0x3b5bb6['accountcode'];channels[_0x3b5bb6[_0x759a('0x1c')]][_0x759a('0x2a')]=_0x3b5bb6['channel'];if(_[_0x759a('0x25')](channels[_0x3b5bb6[_0x759a('0x1c')]][_0x759a('0x2b')])){channels[_0x3b5bb6[_0x759a('0x1c')]]['answertime']=utils[_0x759a('0x21')]();}channels[_0x3b5bb6[_0x759a('0x1c')]]['disposition']=dispositions[_[_0x759a('0x2c')](_0x3b5bb6['channelstate'])]||_0x759a('0x6');}}catch(_0x4ba89a){utils[_0x759a('0x22')](util[_0x759a('0xb')](_0x759a('0x24'),_0x3b5bb6[_0x759a('0x9')]),_0x4ba89a);}};exports['hangup']=function(_0x35af91){try{if(!_[_0x759a('0x25')](channels[_0x35af91[_0x759a('0x9')]])){utils[_0x759a('0x1a')](util[_0x759a('0xb')]('[%s][calls][hangup]',_0x35af91['uniqueid']),_0x35af91);if(_['isNil'](channels[_0x35af91[_0x759a('0x9')]]['callerid'])){channels[_0x35af91['uniqueid']][_0x759a('0x2d')]=_0x35af91[_0x759a('0x2e')]+'\x20<'+_0x35af91[_0x759a('0x10')]+'>';}utils[_0x759a('0xa')](util[_0x759a('0xb')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x35af91[_0x759a('0x9')],channels[_0x35af91['uniqueid']][_0x759a('0x2d')],_0x35af91[_0x759a('0x2f')]));channels[_0x35af91[_0x759a('0x9')]][_0x759a('0x30')]=utils[_0x759a('0x21')]();channels[_0x35af91[_0x759a('0x9')]][_0x759a('0x31')]=utils[_0x759a('0x32')](channels[_0x35af91[_0x759a('0x9')]][_0x759a('0x30')],channels[_0x35af91[_0x759a('0x9')]][_0x759a('0x33')]);channels[_0x35af91[_0x759a('0x9')]]['billableseconds']=channels[_0x35af91['uniqueid']][_0x759a('0x2b')]?utils['diffTime'](channels[_0x35af91[_0x759a('0x9')]]['endtime'],channels[_0x35af91[_0x759a('0x9')]][_0x759a('0x2b')]):0x0;writeDB(channels[_0x35af91[_0x759a('0x9')]]);}}catch(_0x51e5d7){utils[_0x759a('0x22')](util[_0x759a('0xb')](_0x759a('0x34'),_0x35af91[_0x759a('0x9')]),_0x51e5d7);}};exports[_0x759a('0x35')]=function(_0x1f5e39){try{if(!_[_0x759a('0x25')](channels[_0x1f5e39[_0x759a('0x36')]])){utils['debug'](util['format']('[%s][calls][attendedtransfer]',_0x1f5e39[_0x759a('0x37')]),_0x1f5e39);if(channels[_0x1f5e39[_0x759a('0x36')]][_0x759a('0xd')]==_0x1f5e39['transfereechannel']){utils[_0x759a('0xa')](util[_0x759a('0xb')](_0x759a('0x38'),_0x1f5e39['origtransfereruniqueid'],_0x1f5e39[_0x759a('0x36')],_0x1f5e39[_0x759a('0x39')]));channels[_0x1f5e39[_0x759a('0x36')]][_0x759a('0x2a')]=_0x1f5e39[_0x759a('0x39')];channels[_0x1f5e39[_0x759a('0x36')]][_0x759a('0x3a')]=_0x759a('0x3b');}else if(channels[_0x1f5e39[_0x759a('0x36')]][_0x759a('0xd')]=_0x1f5e39[_0x759a('0x3c')]){utils[_0x759a('0xa')](util[_0x759a('0xb')](_0x759a('0x38'),_0x1f5e39[_0x759a('0x37')],_0x1f5e39[_0x759a('0x36')],_0x1f5e39['origtransfererchannel']));channels[_0x1f5e39[_0x759a('0x36')]][_0x759a('0x2a')]=_0x1f5e39[_0x759a('0x3d')];channels[_0x1f5e39[_0x759a('0x36')]][_0x759a('0x3a')]=_0x759a('0x3b');}}}catch(_0x444162){utils[_0x759a('0x22')](util['format'](_0x759a('0x3e'),_0x1f5e39['origtransfereruniqueid']),_0x444162);}};exports[_0x759a('0x3f')]=function(_0x4a8a18){try{if(!_['isNil'](channels[_0x4a8a18[_0x759a('0x9')]])){utils[_0x759a('0x1a')](util[_0x759a('0xb')](_0x759a('0x40'),_0x4a8a18['uniqueid']),_0x4a8a18);channels[_0x4a8a18[_0x759a('0x9')]][_0x759a('0x41')]=utils[_0x759a('0x21')]();utils[_0x759a('0xa')](util[_0x759a('0xb')](_0x759a('0x42'),_0x4a8a18['uniqueid'],channels[_0x4a8a18[_0x759a('0x9')]][_0x759a('0x41')]));}}catch(_0x18ded2){utils[_0x759a('0x22')](util[_0x759a('0xb')](_0x759a('0x40'),_0x4a8a18[_0x759a('0x9')]),_0x18ded2);}};exports[_0x759a('0x43')]=function(_0xf44a9f){try{if(!_[_0x759a('0x25')](channels[_0xf44a9f[_0x759a('0x9')]])){utils[_0x759a('0x1a')](util[_0x759a('0xb')](_0x759a('0x44'),_0xf44a9f[_0x759a('0x9')]),_0xf44a9f);if(!_[_0x759a('0x25')](channels[_0xf44a9f[_0x759a('0x9')]][_0x759a('0x41')])){channels[_0xf44a9f['uniqueid']][_0x759a('0x45')]+=utils[_0x759a('0x32')](utils['now'](),channels[_0xf44a9f[_0x759a('0x9')]][_0x759a('0x41')]);utils[_0x759a('0xa')](util[_0x759a('0xb')](_0x759a('0x46'),_0xf44a9f['uniqueid'],channels[_0xf44a9f['uniqueid']]['mohtime']));delete channels[_0xf44a9f[_0x759a('0x9')]][_0x759a('0x41')];}}}catch(_0x334fad){utils[_0x759a('0x22')](util['format'](_0x759a('0x44'),_0xf44a9f[_0x759a('0x9')]),_0x334fad);}};exports['varset']=function(_0x4a593f){try{if(!_['isNil'](channels[_0x4a593f[_0x759a('0x9')]])){utils['debug'](util[_0x759a('0xb')](_0x759a('0x47'),_0x4a593f[_0x759a('0x9')]),_0x4a593f);if(!_[_0x759a('0x25')](_0x4a593f[_0x759a('0x48')][_0x759a('0x49')])){utils['info'](util[_0x759a('0xb')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x4a593f[_0x759a('0x9')],_0x4a593f[_0x759a('0x4a')]));channels[_0x4a593f[_0x759a('0x9')]][_0x759a('0x4b')]=_0x4a593f['value'];}if(!_[_0x759a('0x25')](_0x4a593f[_0x759a('0x48')][_0x759a('0x4c')])){utils[_0x759a('0xa')](util['format'](_0x759a('0x4d'),_0x4a593f[_0x759a('0x9')],_0x4a593f[_0x759a('0x4a')]));channels[_0x4a593f[_0x759a('0x9')]][_0x759a('0x4e')]=_0x4a593f[_0x759a('0x4a')];channels[_0x4a593f[_0x759a('0x9')]][_0x759a('0x2d')]='\x22'+_0x4a593f[_0x759a('0x4a')]+_0x759a('0x4f')+_0x4a593f[_0x759a('0x4a')]+'>';}if(!_[_0x759a('0x25')](_0x4a593f['variable']['xmd-callerid-preview'])||!_[_0x759a('0x25')](_0x4a593f[_0x759a('0x48')]['xmd-callerid'])){utils[_0x759a('0xa')](util[_0x759a('0xb')](_0x759a('0x50'),_0x4a593f[_0x759a('0x9')],!_[_0x759a('0x25')](_0x4a593f[_0x759a('0x48')][_0x759a('0x51')])?'xmd-callerid-preview':'xmd-callerid',_0x4a593f[_0x759a('0x4a')]));channels[_0x4a593f[_0x759a('0x9')]][_0x759a('0x2d')]=_0x4a593f[_0x759a('0x4a')];}if(!_[_0x759a('0x25')](_0x4a593f[_0x759a('0x48')][_0x759a('0x52')])||!_[_0x759a('0x25')](_0x4a593f['variable'][_0x759a('0x53')])){utils[_0x759a('0xa')](util[_0x759a('0xb')](_0x759a('0x50'),_0x4a593f[_0x759a('0x9')],!_[_0x759a('0x25')](_0x4a593f[_0x759a('0x48')][_0x759a('0x52')])?_0x759a('0x52'):_0x759a('0x53'),_0x4a593f[_0x759a('0x4a')]));channels[_0x4a593f[_0x759a('0x9')]][_0x759a('0x54')]=_0x759a('0x55');channels[_0x4a593f[_0x759a('0x9')]][_0x759a('0x56')]=_0x4a593f[_0x759a('0x4a')];channels[_0x4a593f['uniqueid']]['queue']=!![];}if(!_[_0x759a('0x25')](_0x4a593f[_0x759a('0x48')][_0x759a('0x57')])){utils[_0x759a('0xa')](util['format'](_0x759a('0x58'),_0x4a593f[_0x759a('0x9')],_0x4a593f[_0x759a('0x4a')]));channels[_0x4a593f[_0x759a('0x9')]][_0x759a('0x59')]=_0x4a593f[_0x759a('0x4a')];}if(!_[_0x759a('0x25')](_0x4a593f[_0x759a('0x48')][_0x759a('0x5a')])){utils['info'](util[_0x759a('0xb')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4a593f[_0x759a('0x9')],_0x4a593f['value']));channels[_0x4a593f[_0x759a('0x9')]][_0x759a('0x5b')]=_0x4a593f[_0x759a('0x4a')];}if(!_[_0x759a('0x25')](_0x4a593f[_0x759a('0x48')]['outboundrouteid'])){utils[_0x759a('0xa')](util['format'](_0x759a('0x5c'),_0x4a593f[_0x759a('0x9')],_0x4a593f[_0x759a('0x4a')]));channels[_0x4a593f[_0x759a('0x9')]][_0x759a('0x5d')]=_0x4a593f[_0x759a('0x4a')];}if(!_['isNil'](_0x4a593f[_0x759a('0x48')][_0x759a('0x5e')])){utils[_0x759a('0xa')](util[_0x759a('0xb')](_0x759a('0x5f'),_0x4a593f['uniqueid'],_0x4a593f[_0x759a('0x4a')]));channels[_0x4a593f[_0x759a('0x9')]][_0x759a('0x5e')]=_0x4a593f['value'];}}}catch(_0x4fd227){utils['error'](util[_0x759a('0xb')]('[%s][calls][varset]',_0x4a593f[_0x759a('0x9')]),_0x4fd227);}};exports[_0x759a('0x60')]=function(_0x37c434){try{if(!_[_0x759a('0x25')](channels[_0x37c434[_0x759a('0x9')]])){utils[_0x759a('0x1a')](util[_0x759a('0xb')](_0x759a('0x61'),_0x37c434[_0x759a('0x9')]),_0x37c434);utils[_0x759a('0xa')](util[_0x759a('0xb')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x37c434[_0x759a('0x9')],_0x37c434['application'],_0x37c434['appdata']));if(_0x37c434[_0x759a('0x62')][_0x759a('0x63')]()==_0x759a('0x64')&&_[_0x759a('0x65')](_0x37c434[_0x759a('0x66')][_0x759a('0x63')](),'cdr')){var _0x5200b8=_0x37c434[_0x759a('0x66')][_0x759a('0x67')]('=');var _0x5c8475=_0x5200b8[0x0][_0x759a('0x68')](_0x5200b8[0x0]['lastIndexOf']('(')+0x1,_0x5200b8[0x0][_0x759a('0x69')](')'));var _0x14c5f2=_0x5200b8[0x1];channels[_0x37c434[_0x759a('0x9')]][_0x5c8475]=_0x14c5f2;}if(!_[_0x759a('0x6a')]([_0x759a('0x6b'),_0x759a('0x6c'),_0x759a('0x6d'),_0x759a('0x64'),_0x759a('0x6e')],_0x37c434[_0x759a('0x62')][_0x759a('0x63')]())){channels[_0x37c434[_0x759a('0x9')]][_0x759a('0x54')]=_0x37c434[_0x759a('0x62')];channels[_0x37c434[_0x759a('0x9')]][_0x759a('0x56')]=_0x37c434[_0x759a('0x66')];}}}catch(_0x3cade9){utils[_0x759a('0x22')](util[_0x759a('0xb')](_0x759a('0x61'),_0x37c434[_0x759a('0x9')]),_0x3cade9);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 0b3ec2f..f76d2c8 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 _0x84c2=['shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','connect','info','[core]\x20connected'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x84c2,0x129));var _0x284c=function(_0x402d00,_0x46761f){_0x402d00=_0x402d00-0x0;var _0x23df42=_0x84c2[_0x402d00];return _0x23df42;};'use strict';var utils=require('./utils');exports[_0x284c('0x0')]=function(){utils[_0x284c('0x1')](_0x284c('0x2'));};exports[_0x284c('0x3')]=function(){utils[_0x284c('0x1')](_0x284c('0x4'));};exports[_0x284c('0x5')]=function(){utils[_0x284c('0x1')](_0x284c('0x6'));};exports[_0x284c('0x7')]=function(_0x579872){utils[_0x284c('0x7')]('[core]\x20error',_0x579872);};exports[_0x284c('0x8')]=function(){utils[_0x284c('0x1')](_0x284c('0x9'));};exports['managerevent']=function(_0x293899){}; \ No newline at end of file +var _0xb095=['shutdown','[core]\x20shutdown','error','[core]\x20close','managerevent','connect','info','[core]\x20connected'];(function(_0xd4daaa,_0x308cb7){var _0x286d8d=function(_0x4ca84e){while(--_0x4ca84e){_0xd4daaa['push'](_0xd4daaa['shift']());}};_0x286d8d(++_0x308cb7);}(_0xb095,0xed));var _0x5b09=function(_0x230e01,_0x120b5b){_0x230e01=_0x230e01-0x0;var _0x2babc3=_0xb095[_0x230e01];return _0x2babc3;};'use strict';var utils=require('./utils');exports[_0x5b09('0x0')]=function(){utils[_0x5b09('0x1')](_0x5b09('0x2'));};exports[_0x5b09('0x3')]=function(){utils['info'](_0x5b09('0x4'));};exports['fullybooted']=function(){utils[_0x5b09('0x1')]('[core]\x20fullybooted');};exports['error']=function(_0x406441){utils[_0x5b09('0x5')]('[core]\x20error',_0x406441);};exports['close']=function(){utils[_0x5b09('0x1')](_0x5b09('0x6'));};exports[_0x5b09('0x7')]=function(_0x62cd67){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 28f3c5d..a321287 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 _0xd25f=['now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','[%s][dials][dialbegin]','dialend','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','variable','outboundrouteid','value','[%s][dials][varset]','dialbegin','isNil','assign'];(function(_0x231b2e,_0x2a33f9){var _0x3feb2a=function(_0x5aa472){while(--_0x5aa472){_0x231b2e['push'](_0x231b2e['shift']());}};_0x3feb2a(++_0x2a33f9);}(_0xd25f,0x123));var _0xfd25=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0xd25f[_0x4de877];return _0xb2cfeb;};'use strict';var _=require(_0xfd25('0x0'));var util=require(_0xfd25('0x1'));var utils=require(_0xfd25('0x2'));var dials={};function writeDB(_0x392f8c){utils[_0xfd25('0x3')](util[_0xfd25('0x4')](_0xfd25('0x5'),_0x392f8c['uniqueid'],_0x392f8c[_0xfd25('0x6')],_0x392f8c[_0xfd25('0x7')],_0x392f8c[_0xfd25('0x8')],_0x392f8c[_0xfd25('0x9')],_0x392f8c[_0xfd25('0xa')]));utils[_0xfd25('0xb')](_0xfd25('0xc'),_0x392f8c);delete dials[_0x392f8c[_0xfd25('0xd')]];}exports[_0xfd25('0xe')]=function(_0x241b4d){try{utils[_0xfd25('0xf')](util[_0xfd25('0x4')](_0xfd25('0x10'),_0x241b4d['uniqueid']),_0x241b4d);utils[_0xfd25('0x3')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x241b4d['uniqueid'],_0x241b4d[_0xfd25('0x11')],_0x241b4d[_0xfd25('0x12')]));if(_0x241b4d[_0xfd25('0x11')][_0xfd25('0x13')]()==_0xfd25('0x14')&&_[_0xfd25('0x15')](_0x241b4d[_0xfd25('0x12')]['toLowerCase'](),_0xfd25('0x16'))){var _0x353930=_0x241b4d[_0xfd25('0x12')][_0xfd25('0x17')]('=');dials[_0x241b4d['uniqueid']]={'routeId':_0x353930[0x1]};}}catch(_0x42ed14){utils[_0xfd25('0x18')](util['format']('[%s][dials][newexten]',_0x241b4d['uniqueid']),_0x42ed14);}};exports[_0xfd25('0x19')]=function(_0x1742ed){try{utils[_0xfd25('0xf')](util['format']('[%s][dials][varset]',_0x1742ed[_0xfd25('0xd')]),_0x1742ed);if(!_['isNil'](_0x1742ed[_0xfd25('0x1a')][_0xfd25('0x1b')])){utils[_0xfd25('0x3')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x1742ed['uniqueid'],_0x1742ed[_0xfd25('0x1c')]));dials[_0x1742ed['uniqueid']]={'routeId':_0x1742ed[_0xfd25('0x1c')]};}}catch(_0x30b6d0){utils[_0xfd25('0x18')](util[_0xfd25('0x4')](_0xfd25('0x1d'),_0x1742ed[_0xfd25('0xd')]),_0x30b6d0);}};exports[_0xfd25('0x1e')]=function(_0x5c8938){try{if(!_[_0xfd25('0x1f')](dials[_0x5c8938[_0xfd25('0xd')]])){utils[_0xfd25('0xf')](util[_0xfd25('0x4')]('[%s][dials][dialbegin]',_0x5c8938[_0xfd25('0xd')]),_0x5c8938);dials[_0x5c8938[_0xfd25('0xd')]]=_[_0xfd25('0x20')](dials[_0x5c8938[_0xfd25('0xd')]],_0x5c8938);dials[_0x5c8938[_0xfd25('0xd')]]['starttime']=utils[_0xfd25('0x21')]();dials[_0x5c8938[_0xfd25('0xd')]][_0xfd25('0x22')]='called';utils['info'](util['format'](_0xfd25('0x23'),_0x5c8938[_0xfd25('0xd')],dials[_0x5c8938[_0xfd25('0xd')]][_0xfd25('0x24')]));}}catch(_0x4402b8){utils['error'](util[_0xfd25('0x4')](_0xfd25('0x25'),_0x5c8938['uniqueid']),_0x4402b8);}};exports[_0xfd25('0x26')]=function(_0x4af825){try{if(!_[_0xfd25('0x1f')](dials[_0x4af825[_0xfd25('0xd')]])){utils[_0xfd25('0xf')](util['format']('[%s][dials][dialend]',_0x4af825[_0xfd25('0xd')]),_0x4af825);dials[_0x4af825[_0xfd25('0xd')]]['dialstatus']=_0x4af825[_0xfd25('0xa')];if(_0x4af825[_0xfd25('0xa')]==_0xfd25('0x27')){dials[_0x4af825[_0xfd25('0xd')]]=_['assign'](dials[_0x4af825[_0xfd25('0xd')]],_0x4af825);dials[_0x4af825[_0xfd25('0xd')]][_0xfd25('0x28')]=utils[_0xfd25('0x21')]();dials[_0x4af825[_0xfd25('0xd')]][_0xfd25('0x22')]=_0xfd25('0x29');utils['info'](util[_0xfd25('0x4')](_0xfd25('0x2a'),_0x4af825['uniqueid'],_0x4af825[_0xfd25('0xa')],dials[_0x4af825[_0xfd25('0xd')]][_0xfd25('0x28')]));}else{utils[_0xfd25('0x3')](util[_0xfd25('0x4')](_0xfd25('0x2b'),_0x4af825[_0xfd25('0xd')],_0x4af825[_0xfd25('0xa')]));}}}catch(_0x11a6e9){utils['error'](util[_0xfd25('0x4')](_0xfd25('0x2c'),_0x4af825[_0xfd25('0xd')]),_0x11a6e9);}};exports['hangup']=function(_0x439a42){try{if(!_[_0xfd25('0x1f')](dials[_0x439a42[_0xfd25('0xd')]])){utils[_0xfd25('0xf')](util['format'](_0xfd25('0x2d'),_0x439a42[_0xfd25('0xd')]),_0x439a42);utils[_0xfd25('0x3')](util[_0xfd25('0x4')](_0xfd25('0x2e'),_0x439a42[_0xfd25('0xd')],_0x439a42['calleridnum'],_0x439a42[_0xfd25('0x2f')],_0x439a42[_0xfd25('0x30')]));dials[_0x439a42[_0xfd25('0xd')]]=_[_0xfd25('0x20')](dials[_0x439a42[_0xfd25('0xd')]],{'endtime':utils['now'](),'lastevent':_0xfd25('0x31')});dials[_0x439a42[_0xfd25('0xd')]]['duration']=utils[_0xfd25('0x32')](dials[_0x439a42['uniqueid']][_0xfd25('0x33')],dials[_0x439a42[_0xfd25('0xd')]][_0xfd25('0x24')]);dials[_0x439a42[_0xfd25('0xd')]][_0xfd25('0x34')]=utils[_0xfd25('0x32')](dials[_0x439a42[_0xfd25('0xd')]][_0xfd25('0x28')]||dials[_0x439a42[_0xfd25('0xd')]][_0xfd25('0x33')],dials[_0x439a42['uniqueid']][_0xfd25('0x24')]);dials[_0x439a42[_0xfd25('0xd')]][_0xfd25('0x35')]=dials[_0x439a42[_0xfd25('0xd')]][_0xfd25('0x28')]?utils[_0xfd25('0x32')](dials[_0x439a42[_0xfd25('0xd')]][_0xfd25('0x33')],dials[_0x439a42['uniqueid']][_0xfd25('0x28')]):0x0;writeDB(dials[_0x439a42[_0xfd25('0xd')]]);}}catch(_0x4ac53c){utils['error'](util[_0xfd25('0x4')](_0xfd25('0x2d'),_0x439a42[_0xfd25('0xd')]),_0x4ac53c);}}; \ No newline at end of file +var _0xa559=['debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','starttime','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','dialstatus','ANSWER','[%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','assign','duration','endtime','holdtime','diffTime','lodash','util','info','format','calleridnum','connectedlinenum','CreateVoiceDialReport','uniqueid'];(function(_0x47049d,_0x2107b6){var _0x29dc79=function(_0x1cf388){while(--_0x1cf388){_0x47049d['push'](_0x47049d['shift']());}};_0x29dc79(++_0x2107b6);}(_0xa559,0x160));var _0x9a55=function(_0x3e013c,_0x460dcd){_0x3e013c=_0x3e013c-0x0;var _0x18a947=_0xa559[_0x3e013c];return _0x18a947;};'use strict';var _=require(_0x9a55('0x0'));var util=require(_0x9a55('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x40c1ee){utils[_0x9a55('0x2')](util[_0x9a55('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x40c1ee['uniqueid'],_0x40c1ee['channel'],_0x40c1ee['dialstring'],_0x40c1ee[_0x9a55('0x4')],_0x40c1ee[_0x9a55('0x5')],_0x40c1ee['dialstatus']));utils['request'](_0x9a55('0x6'),_0x40c1ee);delete dials[_0x40c1ee[_0x9a55('0x7')]];}exports['newexten']=function(_0x4dcb63){try{utils[_0x9a55('0x8')](util[_0x9a55('0x3')](_0x9a55('0x9'),_0x4dcb63['uniqueid']),_0x4dcb63);utils['info'](util[_0x9a55('0x3')](_0x9a55('0xa'),_0x4dcb63[_0x9a55('0x7')],_0x4dcb63[_0x9a55('0xb')],_0x4dcb63[_0x9a55('0xc')]));if(_0x4dcb63[_0x9a55('0xb')][_0x9a55('0xd')]()==_0x9a55('0xe')&&_[_0x9a55('0xf')](_0x4dcb63[_0x9a55('0xc')][_0x9a55('0xd')](),_0x9a55('0x10'))){var _0x15a6fc=_0x4dcb63[_0x9a55('0xc')][_0x9a55('0x11')]('=');dials[_0x4dcb63[_0x9a55('0x7')]]={'routeId':_0x15a6fc[0x1]};}}catch(_0x5161fa){utils[_0x9a55('0x12')](util['format']('[%s][dials][newexten]',_0x4dcb63[_0x9a55('0x7')]),_0x5161fa);}};exports['varset']=function(_0x547421){try{utils[_0x9a55('0x8')](util[_0x9a55('0x3')]('[%s][dials][varset]',_0x547421['uniqueid']),_0x547421);if(!_[_0x9a55('0x13')](_0x547421['variable'][_0x9a55('0x14')])){utils[_0x9a55('0x2')](util['format'](_0x9a55('0x15'),_0x547421[_0x9a55('0x7')],_0x547421[_0x9a55('0x16')]));dials[_0x547421[_0x9a55('0x7')]]={'routeId':_0x547421['value']};}}catch(_0x9837d9){utils[_0x9a55('0x12')](util[_0x9a55('0x3')]('[%s][dials][varset]',_0x547421['uniqueid']),_0x9837d9);}};exports[_0x9a55('0x17')]=function(_0x10def3){try{if(!_[_0x9a55('0x13')](dials[_0x10def3[_0x9a55('0x7')]])){utils['debug'](util[_0x9a55('0x3')](_0x9a55('0x18'),_0x10def3[_0x9a55('0x7')]),_0x10def3);dials[_0x10def3[_0x9a55('0x7')]]=_['assign'](dials[_0x10def3[_0x9a55('0x7')]],_0x10def3);dials[_0x10def3[_0x9a55('0x7')]][_0x9a55('0x19')]=utils[_0x9a55('0x1a')]();dials[_0x10def3[_0x9a55('0x7')]]['lastevent']=_0x9a55('0x1b');utils[_0x9a55('0x2')](util[_0x9a55('0x3')](_0x9a55('0x1c'),_0x10def3['uniqueid'],dials[_0x10def3[_0x9a55('0x7')]][_0x9a55('0x19')]));}}catch(_0x4d612d){utils['error'](util[_0x9a55('0x3')](_0x9a55('0x18'),_0x10def3[_0x9a55('0x7')]),_0x4d612d);}};exports['dialend']=function(_0xcd38e8){try{if(!_[_0x9a55('0x13')](dials[_0xcd38e8['uniqueid']])){utils[_0x9a55('0x8')](util[_0x9a55('0x3')](_0x9a55('0x1d'),_0xcd38e8['uniqueid']),_0xcd38e8);dials[_0xcd38e8[_0x9a55('0x7')]]['dialstatus']=_0xcd38e8[_0x9a55('0x1e')];if(_0xcd38e8[_0x9a55('0x1e')]==_0x9a55('0x1f')){dials[_0xcd38e8[_0x9a55('0x7')]]=_['assign'](dials[_0xcd38e8[_0x9a55('0x7')]],_0xcd38e8);dials[_0xcd38e8[_0x9a55('0x7')]]['answertime']=utils[_0x9a55('0x1a')]();dials[_0xcd38e8[_0x9a55('0x7')]]['lastevent']='connect';utils['info'](util['format'](_0x9a55('0x20'),_0xcd38e8[_0x9a55('0x7')],_0xcd38e8['dialstatus'],dials[_0xcd38e8['uniqueid']][_0x9a55('0x21')]));}else{utils['info'](util[_0x9a55('0x3')](_0x9a55('0x22'),_0xcd38e8[_0x9a55('0x7')],_0xcd38e8['dialstatus']));}}}catch(_0x287ee0){utils['error'](util[_0x9a55('0x3')]('[%s][dials][dialend]',_0xcd38e8['uniqueid']),_0x287ee0);}};exports[_0x9a55('0x23')]=function(_0x2f123f){try{if(!_[_0x9a55('0x13')](dials[_0x2f123f[_0x9a55('0x7')]])){utils[_0x9a55('0x8')](util[_0x9a55('0x3')](_0x9a55('0x24'),_0x2f123f[_0x9a55('0x7')]),_0x2f123f);utils['info'](util['format'](_0x9a55('0x25'),_0x2f123f[_0x9a55('0x7')],_0x2f123f[_0x9a55('0x4')],_0x2f123f[_0x9a55('0x26')],_0x2f123f[_0x9a55('0x27')]));dials[_0x2f123f[_0x9a55('0x7')]]=_[_0x9a55('0x28')](dials[_0x2f123f[_0x9a55('0x7')]],{'endtime':utils[_0x9a55('0x1a')](),'lastevent':'complete'});dials[_0x2f123f['uniqueid']][_0x9a55('0x29')]=utils['diffTime'](dials[_0x2f123f['uniqueid']][_0x9a55('0x2a')],dials[_0x2f123f['uniqueid']][_0x9a55('0x19')]);dials[_0x2f123f[_0x9a55('0x7')]][_0x9a55('0x2b')]=utils['diffTime'](dials[_0x2f123f[_0x9a55('0x7')]][_0x9a55('0x21')]||dials[_0x2f123f[_0x9a55('0x7')]]['endtime'],dials[_0x2f123f[_0x9a55('0x7')]][_0x9a55('0x19')]);dials[_0x2f123f[_0x9a55('0x7')]]['billableseconds']=dials[_0x2f123f['uniqueid']][_0x9a55('0x21')]?utils[_0x9a55('0x2c')](dials[_0x2f123f[_0x9a55('0x7')]][_0x9a55('0x2a')],dials[_0x2f123f['uniqueid']][_0x9a55('0x21')]):0x0;writeDB(dials[_0x2f123f['uniqueid']]);}}catch(_0x461def){utils[_0x9a55('0x12')](util[_0x9a55('0x3')](_0x9a55('0x24'),_0x2f123f['uniqueid']),_0x461def);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 03d4338..fc8a53b 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 _0x8fdb=['varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','./utils','util','asterisk','port','username','password','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','connect','shutdown','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','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x8fdb,0x1ca));var _0xb8fd=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x8fdb[_0x243217];return _0x478029;};var AsteriskManager=require('asterisk-manager');var config=require('../../config/environment');var utils=require(_0xb8fd('0x0'));var util=require(_0xb8fd('0x1'));var ami=new AsteriskManager(config[_0xb8fd('0x2')][_0xb8fd('0x3')],config[_0xb8fd('0x2')]['ip'],config[_0xb8fd('0x2')][_0xb8fd('0x4')],config[_0xb8fd('0x2')][_0xb8fd('0x5')],!![]);ami[_0xb8fd('0x6')]();if(config[_0xb8fd('0x7')]&&config[_0xb8fd('0x7')]['disabled']){utils[_0xb8fd('0x8')](_0xb8fd('0x9'));}else{var agents=require(_0xb8fd('0xa'));var calls=require('./calls.controller');var queues=require(_0xb8fd('0xb'));var recordings=require(_0xb8fd('0xc'));var members=require(_0xb8fd('0xd'));var dials=require('./dials.controller');var transfers=require(_0xb8fd('0xe'));var core=require('./core.controller');ami['on'](_0xb8fd('0xf'),core[_0xb8fd('0xf')]);ami['on']('shutdown',core[_0xb8fd('0x10')]);ami['on'](_0xb8fd('0x11'),core['fullybooted']);ami['on'](_0xb8fd('0x12'),core[_0xb8fd('0x12')]);ami['on'](_0xb8fd('0x13'),core[_0xb8fd('0x13')]);ami['on']('managerevent',core[_0xb8fd('0x14')]);ami['on'](_0xb8fd('0x15'),function(_0x9a9453){try{utils[_0xb8fd('0x16')](util[_0xb8fd('0x17')](_0xb8fd('0x18'),_0x9a9453[_0xb8fd('0x19')]),_0x9a9453);members['devicestatechange'](_0x9a9453);}catch(_0x11fca2){utils[_0xb8fd('0x12')](util['format']('[%s][index][devicestatechange]',_0x9a9453[_0xb8fd('0x19')]),_0x11fca2);}});ami['on'](_0xb8fd('0x1a'),function(_0x57e3b9){try{utils[_0xb8fd('0x16')](util[_0xb8fd('0x17')](_0xb8fd('0x1b'),_0x57e3b9[_0xb8fd('0x1c')]),_0x57e3b9);agents[_0xb8fd('0x1a')](_0x57e3b9);}catch(_0x4d98fc){utils[_0xb8fd('0x12')](util[_0xb8fd('0x17')](_0xb8fd('0x1b'),_0x57e3b9[_0xb8fd('0x1c')]),_0x4d98fc);}});ami['on'](_0xb8fd('0x1d'),function(_0x436ea5){try{utils['debug'](util['format'](_0xb8fd('0x1e'),_0x436ea5[_0xb8fd('0x1c')]),_0x436ea5);agents[_0xb8fd('0x1d')](_0x436ea5);}catch(_0x3317de){utils[_0xb8fd('0x12')](util['format'](_0xb8fd('0x1e'),_0x436ea5['uniqueid']),_0x3317de);}});ami['on'](_0xb8fd('0x1f'),function(_0x5cb2a1){try{utils[_0xb8fd('0x16')](util[_0xb8fd('0x17')](_0xb8fd('0x20'),_0x5cb2a1[_0xb8fd('0x1c')]),_0x5cb2a1);agents[_0xb8fd('0x1f')](_0x5cb2a1);queues[_0xb8fd('0x1f')](_0x5cb2a1);}catch(_0x48d6ef){utils[_0xb8fd('0x12')](util[_0xb8fd('0x17')](_0xb8fd('0x20'),_0x5cb2a1[_0xb8fd('0x1c')]),_0x48d6ef);}});ami['on'](_0xb8fd('0x21'),function(_0x22ea4e){try{utils[_0xb8fd('0x16')](util[_0xb8fd('0x17')](_0xb8fd('0x22'),_0x22ea4e['uniqueid']),_0x22ea4e);agents['agentcomplete'](_0x22ea4e);queues[_0xb8fd('0x21')](_0x22ea4e);members[_0xb8fd('0x21')](_0x22ea4e);}catch(_0x501f67){utils[_0xb8fd('0x12')](util[_0xb8fd('0x17')]('[%s][index][agentcomplete]',_0x22ea4e[_0xb8fd('0x1c')]),_0x501f67);}});ami['on'](_0xb8fd('0x23'),function(_0x4730d2){try{utils[_0xb8fd('0x16')](util[_0xb8fd('0x17')](_0xb8fd('0x24'),_0x4730d2[_0xb8fd('0x1c')]),_0x4730d2);agents[_0xb8fd('0x23')](_0x4730d2);queues[_0xb8fd('0x23')](_0x4730d2);}catch(_0x611c3f){utils['error'](util[_0xb8fd('0x17')](_0xb8fd('0x24'),_0x4730d2[_0xb8fd('0x1c')]),_0x611c3f);}});ami['on'](_0xb8fd('0x25'),function(_0x457d61){try{utils[_0xb8fd('0x16')](util[_0xb8fd('0x17')](_0xb8fd('0x26'),_0x457d61[_0xb8fd('0x1c')]),_0x457d61);queues['queuecallerjoin'](_0x457d61);recordings['queuecallerjoin'](_0x457d61);}catch(_0x5ddbd4){utils['error'](util[_0xb8fd('0x17')](_0xb8fd('0x26'),_0x457d61[_0xb8fd('0x1c')]),_0x5ddbd4);}});ami['on'](_0xb8fd('0x27'),function(_0x2183e4){try{utils[_0xb8fd('0x16')](util[_0xb8fd('0x17')](_0xb8fd('0x28'),_0x2183e4[_0xb8fd('0x1c')]),_0x2183e4);queues['queuecallerleave'](_0x2183e4);}catch(_0x4ae996){utils[_0xb8fd('0x12')](util[_0xb8fd('0x17')](_0xb8fd('0x28'),_0x2183e4['uniqueid']),_0x4ae996);}});ami['on'](_0xb8fd('0x29'),function(_0x2dbfef){try{utils[_0xb8fd('0x16')](util['format'](_0xb8fd('0x2a'),_0x2dbfef['uniqueid']),_0x2dbfef);queues[_0xb8fd('0x29')](_0x2dbfef);calls[_0xb8fd('0x29')](_0x2dbfef);}catch(_0x1c94ef){utils['error'](util[_0xb8fd('0x17')](_0xb8fd('0x2a'),_0x2dbfef[_0xb8fd('0x1c')]),_0x1c94ef);}});ami['on']('musiconholdstop',function(_0x118db1){try{utils[_0xb8fd('0x16')](util['format'](_0xb8fd('0x2b'),_0x118db1[_0xb8fd('0x1c')]),_0x118db1);queues[_0xb8fd('0x2c')](_0x118db1);calls['musiconholdstop'](_0x118db1);}catch(_0x40144e){utils[_0xb8fd('0x12')](util['format']('[%s][index][musiconholdstop]',_0x118db1[_0xb8fd('0x1c')]),_0x40144e);}});ami['on']('newstate',function(_0x325472){try{utils[_0xb8fd('0x16')](util[_0xb8fd('0x17')]('[%s][index][newstate]',_0x325472['uniqueid']),_0x325472);calls['newstate'](_0x325472);recordings[_0xb8fd('0x2d')](_0x325472);}catch(_0x5e40c8){utils[_0xb8fd('0x12')](util[_0xb8fd('0x17')]('[%s][index][newstate]',_0x325472[_0xb8fd('0x1c')]),_0x5e40c8);}});ami['on'](_0xb8fd('0x2e'),function(_0x2f1adc){try{utils[_0xb8fd('0x16')](util[_0xb8fd('0x17')](_0xb8fd('0x2f'),_0x2f1adc['uniqueid']),_0x2f1adc);calls[_0xb8fd('0x2e')](_0x2f1adc);recordings[_0xb8fd('0x2e')](_0x2f1adc);dials[_0xb8fd('0x2e')](_0x2f1adc);agents[_0xb8fd('0x2e')](_0x2f1adc);queues[_0xb8fd('0x2e')](_0x2f1adc);}catch(_0x20a230){utils[_0xb8fd('0x12')](util[_0xb8fd('0x17')](_0xb8fd('0x2f'),_0x2f1adc[_0xb8fd('0x1c')]),_0x20a230);}});ami['on'](_0xb8fd('0x30'),function(_0x2298c5){try{utils[_0xb8fd('0x16')](util[_0xb8fd('0x17')](_0xb8fd('0x31'),_0x2298c5[_0xb8fd('0x1c')]),_0x2298c5);members[_0xb8fd('0x30')](_0x2298c5);}catch(_0x958742){utils[_0xb8fd('0x12')](util[_0xb8fd('0x17')](_0xb8fd('0x31'),_0x2298c5['uniqueid']),_0x958742);}});ami['on'](_0xb8fd('0x32'),function(_0x440f53){try{utils[_0xb8fd('0x16')](util[_0xb8fd('0x17')]('[%s][index][blindtransfer]',_0x440f53[_0xb8fd('0x1c')]),_0x440f53);queues[_0xb8fd('0x32')](_0x440f53);agents[_0xb8fd('0x32')](_0x440f53);transfers[_0xb8fd('0x32')](_0x440f53);}catch(_0x5b619a){utils['error'](util[_0xb8fd('0x17')]('[%s][index][blindtransfer]',_0x440f53[_0xb8fd('0x1c')]),_0x5b619a);}});ami['on'](_0xb8fd('0x33'),function(_0x5dac90){try{utils['debug'](util[_0xb8fd('0x17')](_0xb8fd('0x34'),_0x5dac90[_0xb8fd('0x35')]),_0x5dac90);queues[_0xb8fd('0x33')](_0x5dac90);transfers[_0xb8fd('0x33')](_0x5dac90);agents[_0xb8fd('0x33')](_0x5dac90);calls['attendedtransfer'](_0x5dac90);}catch(_0x182d8c){utils[_0xb8fd('0x12')](util['format'](_0xb8fd('0x34'),_0x5dac90[_0xb8fd('0x35')]),_0x182d8c);}});ami['on'](_0xb8fd('0x36'),function(_0x318742){try{utils['debug'](util[_0xb8fd('0x17')](_0xb8fd('0x37'),_0x318742[_0xb8fd('0x1c')]),_0x318742);queues[_0xb8fd('0x36')](_0x318742);recordings[_0xb8fd('0x36')](_0x318742);calls['varset'](_0x318742);dials[_0xb8fd('0x36')](_0x318742);}catch(_0x275765){utils[_0xb8fd('0x12')](util['format']('[%s][index][varset]',_0x318742['uniqueid']),_0x275765);}});ami['on']('newexten',function(_0x33ae90){try{utils[_0xb8fd('0x16')](util[_0xb8fd('0x17')](_0xb8fd('0x38'),_0x33ae90[_0xb8fd('0x1c')]),_0x33ae90);calls[_0xb8fd('0x39')](_0x33ae90);recordings['newexten'](_0x33ae90);dials[_0xb8fd('0x39')](_0x33ae90);}catch(_0x950854){utils[_0xb8fd('0x12')](util[_0xb8fd('0x17')](_0xb8fd('0x38'),_0x33ae90[_0xb8fd('0x1c')]),_0x950854);}});ami['on'](_0xb8fd('0x3a'),function(_0x1a3696){try{utils[_0xb8fd('0x16')](util[_0xb8fd('0x17')](_0xb8fd('0x3b'),_0x1a3696[_0xb8fd('0x1c')]),_0x1a3696);calls[_0xb8fd('0x3a')](_0x1a3696);recordings[_0xb8fd('0x3a')](_0x1a3696);}catch(_0x4dd8b9){utils[_0xb8fd('0x12')](util[_0xb8fd('0x17')]('[%s][index][newchannel]',_0x1a3696['uniqueid']),_0x4dd8b9);}});ami['on'](_0xb8fd('0x3c'),function(_0x248a77){try{utils[_0xb8fd('0x16')](util[_0xb8fd('0x17')]('[%s][index][dialbegin]',_0x248a77[_0xb8fd('0x1c')]),_0x248a77);dials[_0xb8fd('0x3c')](_0x248a77);}catch(_0x3e72dc){utils[_0xb8fd('0x12')](util[_0xb8fd('0x17')](_0xb8fd('0x3d'),_0x248a77[_0xb8fd('0x1c')]),_0x3e72dc);}});ami['on'](_0xb8fd('0x3e'),function(_0xe5eaf1){try{utils[_0xb8fd('0x16')](util['format'](_0xb8fd('0x3f'),_0xe5eaf1[_0xb8fd('0x1c')]),_0xe5eaf1);dials[_0xb8fd('0x3e')](_0xe5eaf1);}catch(_0x33276a){utils['error'](util['format'](_0xb8fd('0x3f'),_0xe5eaf1[_0xb8fd('0x1c')]),_0x33276a);}});} \ No newline at end of file +var _0x2611=['[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','port','asterisk','username','keepConnected','xdr','info','XDR\x20DISABLED','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','devicestatechange','debug','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2611,0x163));var _0x1261=function(_0x38cd17,_0x237962){_0x38cd17=_0x38cd17-0x0;var _0x441ff1=_0x2611[_0x38cd17];return _0x441ff1;};var AsteriskManager=require(_0x1261('0x0'));var config=require(_0x1261('0x1'));var utils=require(_0x1261('0x2'));var util=require(_0x1261('0x3'));var ami=new AsteriskManager(config['asterisk'][_0x1261('0x4')],config[_0x1261('0x5')]['ip'],config['asterisk'][_0x1261('0x6')],config[_0x1261('0x5')]['password'],!![]);ami[_0x1261('0x7')]();if(config['xdr']&&config[_0x1261('0x8')]['disabled']){utils[_0x1261('0x9')](_0x1261('0xa'));}else{var agents=require('./agents.controller');var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0x1261('0xb'));var members=require(_0x1261('0xc'));var dials=require(_0x1261('0xd'));var transfers=require(_0x1261('0xe'));var core=require(_0x1261('0xf'));ami['on'](_0x1261('0x10'),core[_0x1261('0x10')]);ami['on'](_0x1261('0x11'),core['shutdown']);ami['on'](_0x1261('0x12'),core[_0x1261('0x12')]);ami['on'](_0x1261('0x13'),core[_0x1261('0x13')]);ami['on'](_0x1261('0x14'),core[_0x1261('0x14')]);ami['on']('managerevent',core['managerevent']);ami['on'](_0x1261('0x15'),function(_0x57bdab){try{utils[_0x1261('0x16')](util['format']('[%s][index][devicestatechange]',_0x57bdab[_0x1261('0x17')]),_0x57bdab);members[_0x1261('0x15')](_0x57bdab);}catch(_0x6e042a){utils[_0x1261('0x13')](util[_0x1261('0x18')]('[%s][index][devicestatechange]',_0x57bdab[_0x1261('0x17')]),_0x6e042a);}});ami['on'](_0x1261('0x19'),function(_0x219e7b){try{utils[_0x1261('0x16')](util[_0x1261('0x18')](_0x1261('0x1a'),_0x219e7b[_0x1261('0x1b')]),_0x219e7b);agents['agentcalled'](_0x219e7b);}catch(_0x81baac){utils[_0x1261('0x13')](util[_0x1261('0x18')](_0x1261('0x1a'),_0x219e7b['uniqueid']),_0x81baac);}});ami['on'](_0x1261('0x1c'),function(_0x2944cc){try{utils[_0x1261('0x16')](util['format'](_0x1261('0x1d'),_0x2944cc[_0x1261('0x1b')]),_0x2944cc);agents[_0x1261('0x1c')](_0x2944cc);}catch(_0x4aeb87){utils['error'](util[_0x1261('0x18')]('[%s][index][agentringnoanswer]',_0x2944cc[_0x1261('0x1b')]),_0x4aeb87);}});ami['on']('agentconnect',function(_0x5a9aee){try{utils['debug'](util['format'](_0x1261('0x1e'),_0x5a9aee['uniqueid']),_0x5a9aee);agents[_0x1261('0x1f')](_0x5a9aee);queues[_0x1261('0x1f')](_0x5a9aee);}catch(_0x14ba24){utils[_0x1261('0x13')](util[_0x1261('0x18')](_0x1261('0x1e'),_0x5a9aee[_0x1261('0x1b')]),_0x14ba24);}});ami['on'](_0x1261('0x20'),function(_0x228e11){try{utils[_0x1261('0x16')](util['format']('[%s][index][agentcomplete]',_0x228e11[_0x1261('0x1b')]),_0x228e11);agents['agentcomplete'](_0x228e11);queues[_0x1261('0x20')](_0x228e11);members['agentcomplete'](_0x228e11);}catch(_0x58427e){utils[_0x1261('0x13')](util['format'](_0x1261('0x21'),_0x228e11['uniqueid']),_0x58427e);}});ami['on']('queuecallerabandon',function(_0x1ca22b){try{utils[_0x1261('0x16')](util['format']('[%s][index][queuecallerabandon]',_0x1ca22b['uniqueid']),_0x1ca22b);agents[_0x1261('0x22')](_0x1ca22b);queues['queuecallerabandon'](_0x1ca22b);}catch(_0x14d31b){utils['error'](util[_0x1261('0x18')](_0x1261('0x23'),_0x1ca22b[_0x1261('0x1b')]),_0x14d31b);}});ami['on'](_0x1261('0x24'),function(_0x37a4f1){try{utils['debug'](util[_0x1261('0x18')](_0x1261('0x25'),_0x37a4f1[_0x1261('0x1b')]),_0x37a4f1);queues[_0x1261('0x24')](_0x37a4f1);recordings[_0x1261('0x24')](_0x37a4f1);}catch(_0x46b409){utils[_0x1261('0x13')](util[_0x1261('0x18')](_0x1261('0x25'),_0x37a4f1['uniqueid']),_0x46b409);}});ami['on'](_0x1261('0x26'),function(_0x19563a){try{utils[_0x1261('0x16')](util['format'](_0x1261('0x27'),_0x19563a['uniqueid']),_0x19563a);queues['queuecallerleave'](_0x19563a);}catch(_0xa29718){utils[_0x1261('0x13')](util['format'](_0x1261('0x27'),_0x19563a[_0x1261('0x1b')]),_0xa29718);}});ami['on']('musiconholdstart',function(_0x373fb3){try{utils['debug'](util[_0x1261('0x18')](_0x1261('0x28'),_0x373fb3[_0x1261('0x1b')]),_0x373fb3);queues[_0x1261('0x29')](_0x373fb3);calls['musiconholdstart'](_0x373fb3);}catch(_0x2429f7){utils[_0x1261('0x13')](util[_0x1261('0x18')](_0x1261('0x28'),_0x373fb3[_0x1261('0x1b')]),_0x2429f7);}});ami['on']('musiconholdstop',function(_0x2ab0a7){try{utils['debug'](util[_0x1261('0x18')](_0x1261('0x2a'),_0x2ab0a7[_0x1261('0x1b')]),_0x2ab0a7);queues['musiconholdstop'](_0x2ab0a7);calls[_0x1261('0x2b')](_0x2ab0a7);}catch(_0x3131fa){utils[_0x1261('0x13')](util[_0x1261('0x18')](_0x1261('0x2a'),_0x2ab0a7['uniqueid']),_0x3131fa);}});ami['on'](_0x1261('0x2c'),function(_0x11b68e){try{utils[_0x1261('0x16')](util[_0x1261('0x18')]('[%s][index][newstate]',_0x11b68e['uniqueid']),_0x11b68e);calls[_0x1261('0x2c')](_0x11b68e);recordings[_0x1261('0x2c')](_0x11b68e);}catch(_0x518e9f){utils['error'](util[_0x1261('0x18')](_0x1261('0x2d'),_0x11b68e[_0x1261('0x1b')]),_0x518e9f);}});ami['on'](_0x1261('0x2e'),function(_0x3d5ed9){try{utils[_0x1261('0x16')](util[_0x1261('0x18')]('[%s][index][hangup]',_0x3d5ed9['uniqueid']),_0x3d5ed9);calls['hangup'](_0x3d5ed9);recordings[_0x1261('0x2e')](_0x3d5ed9);dials[_0x1261('0x2e')](_0x3d5ed9);agents[_0x1261('0x2e')](_0x3d5ed9);queues[_0x1261('0x2e')](_0x3d5ed9);}catch(_0x2d39a2){utils[_0x1261('0x13')](util['format'](_0x1261('0x2f'),_0x3d5ed9[_0x1261('0x1b')]),_0x2d39a2);}});ami['on']('cdr',function(_0x32d1ca){try{utils[_0x1261('0x16')](util[_0x1261('0x18')](_0x1261('0x30'),_0x32d1ca[_0x1261('0x1b')]),_0x32d1ca);members['cdr'](_0x32d1ca);}catch(_0x46a487){utils['error'](util['format'](_0x1261('0x30'),_0x32d1ca[_0x1261('0x1b')]),_0x46a487);}});ami['on']('blindtransfer',function(_0x2488c2){try{utils[_0x1261('0x16')](util[_0x1261('0x18')](_0x1261('0x31'),_0x2488c2[_0x1261('0x1b')]),_0x2488c2);queues['blindtransfer'](_0x2488c2);agents[_0x1261('0x32')](_0x2488c2);transfers['blindtransfer'](_0x2488c2);}catch(_0x157cde){utils[_0x1261('0x13')](util[_0x1261('0x18')](_0x1261('0x31'),_0x2488c2[_0x1261('0x1b')]),_0x157cde);}});ami['on'](_0x1261('0x33'),function(_0x4fd031){try{utils[_0x1261('0x16')](util[_0x1261('0x18')](_0x1261('0x34'),_0x4fd031[_0x1261('0x35')]),_0x4fd031);queues[_0x1261('0x33')](_0x4fd031);transfers[_0x1261('0x33')](_0x4fd031);agents[_0x1261('0x33')](_0x4fd031);calls['attendedtransfer'](_0x4fd031);}catch(_0x13ac42){utils[_0x1261('0x13')](util['format'](_0x1261('0x34'),_0x4fd031['origtransfereruniqueid']),_0x13ac42);}});ami['on'](_0x1261('0x36'),function(_0x3a1885){try{utils['debug'](util['format'](_0x1261('0x37'),_0x3a1885['uniqueid']),_0x3a1885);queues['varset'](_0x3a1885);recordings[_0x1261('0x36')](_0x3a1885);calls[_0x1261('0x36')](_0x3a1885);dials[_0x1261('0x36')](_0x3a1885);}catch(_0x1dd36e){utils[_0x1261('0x13')](util[_0x1261('0x18')]('[%s][index][varset]',_0x3a1885[_0x1261('0x1b')]),_0x1dd36e);}});ami['on']('newexten',function(_0x27becc){try{utils['debug'](util[_0x1261('0x18')](_0x1261('0x38'),_0x27becc['uniqueid']),_0x27becc);calls['newexten'](_0x27becc);recordings[_0x1261('0x39')](_0x27becc);dials[_0x1261('0x39')](_0x27becc);}catch(_0x585957){utils[_0x1261('0x13')](util[_0x1261('0x18')](_0x1261('0x38'),_0x27becc[_0x1261('0x1b')]),_0x585957);}});ami['on']('newchannel',function(_0x41da46){try{utils[_0x1261('0x16')](util[_0x1261('0x18')](_0x1261('0x3a'),_0x41da46[_0x1261('0x1b')]),_0x41da46);calls['newchannel'](_0x41da46);recordings['newchannel'](_0x41da46);}catch(_0x357567){utils['error'](util['format'](_0x1261('0x3a'),_0x41da46['uniqueid']),_0x357567);}});ami['on'](_0x1261('0x3b'),function(_0x51de04){try{utils[_0x1261('0x16')](util[_0x1261('0x18')](_0x1261('0x3c'),_0x51de04[_0x1261('0x1b')]),_0x51de04);dials[_0x1261('0x3b')](_0x51de04);}catch(_0x672ae6){utils[_0x1261('0x13')](util[_0x1261('0x18')](_0x1261('0x3d'),_0x51de04[_0x1261('0x1b')]),_0x672ae6);}});ami['on']('dialend',function(_0x466dcd){try{utils[_0x1261('0x16')](util[_0x1261('0x18')]('[%s][index][dialend]',_0x466dcd['uniqueid']),_0x466dcd);dials[_0x1261('0x3e')](_0x466dcd);}catch(_0xf69404){utils[_0x1261('0x13')](util[_0x1261('0x18')](_0x1261('0x3f'),_0x466dcd[_0x1261('0x1b')]),_0xf69404);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index a59e352..72f7c24 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 _0xf5f9=['source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','data2','membername','getUserByInterface','internal','request','CreateMemberReport','getUserByName','split','then','name','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','info','state','INUSE','BUSY','voice','TALKING','NOT_INUSE','isNil','exitAt','now','duration','enterAt','agentcomplete','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','data1','type'];(function(_0x22ab11,_0x4b9533){var _0xbf2cca=function(_0xee38e1){while(--_0xee38e1){_0x22ab11['push'](_0x22ab11['shift']());}};_0xbf2cca(++_0x4b9533);}(_0xf5f9,0x6a));var _0x9f5f=function(_0x5a8377,_0x318a4b){_0x5a8377=_0x5a8377-0x0;var _0x42bcd2=_0xf5f9[_0x5a8377];return _0x42bcd2;};'use strict';var _=require(_0x9f5f('0x0'));var util=require(_0x9f5f('0x1'));var utils=require('./utils');var members={};var exclude=[_0x9f5f('0x2'),_0x9f5f('0x3')];function writeDB(_0x2ad3e8){utils['info'](util[_0x9f5f('0x4')](_0x9f5f('0x5'),_0x2ad3e8[_0x9f5f('0x6')],_0x2ad3e8[_0x9f5f('0x7')],_0x2ad3e8['channel'],_0x2ad3e8[_0x9f5f('0x8')],_0x2ad3e8[_0x9f5f('0x9')],_0x2ad3e8['type']));if(_0x2ad3e8[_0x9f5f('0x7')]){utils[_0x9f5f('0xa')](_0x2ad3e8[_0x9f5f('0x7')])['then'](function(_0x41c295){if(_0x41c295){_0x2ad3e8[_0x9f5f('0x9')]=_0x41c295['name'];_0x2ad3e8[_0x9f5f('0xb')]=_0x41c295[_0x9f5f('0xb')];utils[_0x9f5f('0xc')](_0x9f5f('0xd'),_0x2ad3e8);}else{utils[_0x9f5f('0xe')](_0x2ad3e8[_0x9f5f('0x7')][_0x9f5f('0xf')]('/')[0x1])[_0x9f5f('0x10')](function(_0x453ed7){if(_0x453ed7){_0x2ad3e8['membername']=_0x453ed7[_0x9f5f('0x11')];_0x2ad3e8[_0x9f5f('0xb')]=_0x453ed7['internal'];utils['request'](_0x9f5f('0xd'),_0x2ad3e8);}});}})[_0x9f5f('0x12')](function(_0x2696b4){utils[_0x9f5f('0x13')](util[_0x9f5f('0x4')](_0x9f5f('0x14'),_0x2ad3e8[_0x9f5f('0x6')]),_0x2696b4);});}delete members[_0x2ad3e8[_0x9f5f('0x7')]];}function startsWith(_0x2722ac,_0x370781){return _[_0x9f5f('0x15')](_0x2722ac,function(_0x273d88){return _[_0x9f5f('0x16')](_0x370781,_0x273d88);});}exports[_0x9f5f('0x17')]=function(_0x5ef9e0){try{utils[_0x9f5f('0x18')](util['format'](_0x9f5f('0x19'),members[_0x5ef9e0[_0x9f5f('0x1a')]]?members[_0x5ef9e0[_0x9f5f('0x1a')]][_0x9f5f('0x6')]:_0x5ef9e0[_0x9f5f('0x1a')]),_0x5ef9e0);utils[_0x9f5f('0x1b')](util[_0x9f5f('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x5ef9e0[_0x9f5f('0x1a')]]?members[_0x5ef9e0[_0x9f5f('0x1a')]][_0x9f5f('0x6')]:_0x5ef9e0[_0x9f5f('0x1a')],_0x5ef9e0['state'],_0x5ef9e0[_0x9f5f('0x1a')]));switch(_0x5ef9e0[_0x9f5f('0x1c')]){case _0x9f5f('0x1d'):case _0x9f5f('0x1e'):if(!startsWith(exclude,_0x5ef9e0['device'])){members[_0x5ef9e0[_0x9f5f('0x1a')]]={'channel':_0x9f5f('0x1f'),'interface':_0x5ef9e0['device'],'type':_0x9f5f('0x20'),'enterAt':utils['now'](),'role':'agent'};}break;case _0x9f5f('0x21'):if(!_[_0x9f5f('0x22')](members[_0x5ef9e0[_0x9f5f('0x1a')]])){members[_0x5ef9e0['device']][_0x9f5f('0x23')]=utils[_0x9f5f('0x24')]();members[_0x5ef9e0['device']][_0x9f5f('0x25')]=utils['diffTime'](members[_0x5ef9e0['device']]['exitAt'],members[_0x5ef9e0['device']][_0x9f5f('0x26')]);if(members[_0x5ef9e0[_0x9f5f('0x1a')]][_0x9f5f('0x6')]){writeDB(members[_0x5ef9e0[_0x9f5f('0x1a')]]);}}break;default:break;}}catch(_0x53d290){utils['error'](util['format'](_0x9f5f('0x19'),members[_0x5ef9e0['device']]?members[_0x5ef9e0['device']][_0x9f5f('0x6')]:_0x5ef9e0[_0x9f5f('0x1a')]),_0x53d290);}};exports[_0x9f5f('0x27')]=function(_0x55d1c2){try{if(!_[_0x9f5f('0x22')](members[_0x55d1c2[_0x9f5f('0x7')]])){utils['debug'](util[_0x9f5f('0x4')](_0x9f5f('0x28'),_0x55d1c2['uniqueid']),_0x55d1c2);utils['info'](util[_0x9f5f('0x4')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x55d1c2[_0x9f5f('0x6')],_0x55d1c2[_0x9f5f('0x7')],_0x55d1c2[_0x9f5f('0x29')]));members[_0x55d1c2[_0x9f5f('0x7')]]=_[_0x9f5f('0x2a')](members[_0x55d1c2[_0x9f5f('0x7')]],{'data4':_0x55d1c2[_0x9f5f('0x29')],'uniqueid':_0x55d1c2[_0x9f5f('0x6')]});}}catch(_0x375870){utils['error'](util[_0x9f5f('0x4')]('[%s][members][agentcomplete]',_0x55d1c2[_0x9f5f('0x6')]),_0x375870);}};exports[_0x9f5f('0x2b')]=function(_0x40bdf){try{utils[_0x9f5f('0x18')](util[_0x9f5f('0x4')](_0x9f5f('0x2c'),_0x40bdf['uniqueid']),_0x40bdf);if(_0x40bdf['channel']){var _0x4e048d=_0x40bdf['channel'][_0x9f5f('0xf')]('-')[0x0];if(!_[_0x9f5f('0x22')](members[_0x4e048d])){members[_0x4e048d]=_['assign'](members[_0x4e048d],{'data1':members[_0x4e048d][_0x9f5f('0x2d')]||_0x40bdf[_0x9f5f('0x2e')],'data2':members[_0x4e048d]['data2']||_0x40bdf[_0x9f5f('0x2f')],'data3':members[_0x4e048d][_0x9f5f('0x30')]||_0x40bdf[_0x9f5f('0x31')],'uniqueid':members[_0x4e048d][_0x9f5f('0x6')]||_0x40bdf[_0x9f5f('0x6')]});utils[_0x9f5f('0x1b')](util[_0x9f5f('0x4')](_0x9f5f('0x32'),_0x40bdf['uniqueid'],members[_0x4e048d][_0x9f5f('0x2d')],members[_0x4e048d]['data2'],members[_0x4e048d][_0x9f5f('0x30')]));if(members[_0x4e048d]['exitAt']){writeDB(members[_0x4e048d]);}}}if(_0x40bdf['destinationchannel']){var _0x55a868=_0x40bdf['destinationchannel']['split']('-')[0x0];if(!_[_0x9f5f('0x22')](members[_0x55a868])){members[_0x55a868]=_['assign'](members[_0x55a868],{'data1':members[_0x55a868][_0x9f5f('0x2d')]||_0x40bdf['type'],'data2':members[_0x55a868][_0x9f5f('0x8')]||_0x40bdf[_0x9f5f('0x2f')],'data3':members[_0x55a868]['data3']||_0x40bdf['destination'],'uniqueid':members[_0x55a868][_0x9f5f('0x6')]||_0x40bdf[_0x9f5f('0x6')]});utils['info'](util['format'](_0x9f5f('0x32'),_0x40bdf[_0x9f5f('0x6')],members[_0x55a868][_0x9f5f('0x2d')],members[_0x55a868][_0x9f5f('0x8')],members[_0x55a868][_0x9f5f('0x30')]));if(members[_0x55a868][_0x9f5f('0x23')]){writeDB(members[_0x55a868]);}}}}catch(_0x4790a2){utils[_0x9f5f('0x13')](util[_0x9f5f('0x4')]('[%s][members][cdr]',_0x40bdf[_0x9f5f('0x6')]),_0x4790a2);}}; \ No newline at end of file +var _0x59c3=['CreateMemberReport','getUserByName','split','membername','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','source','destination','data3','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','getUserByInterface','then','name','internal','request'];(function(_0x4a6518,_0x598f0f){var _0x1013f1=function(_0x31a8d5){while(--_0x31a8d5){_0x4a6518['push'](_0x4a6518['shift']());}};_0x1013f1(++_0x598f0f);}(_0x59c3,0x133));var _0x359c=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x59c3[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x359c('0x0'));var util=require(_0x359c('0x1'));var utils=require(_0x359c('0x2'));var members={};var exclude=[_0x359c('0x3'),_0x359c('0x4')];function writeDB(_0x308568){utils['info'](util[_0x359c('0x5')](_0x359c('0x6'),_0x308568[_0x359c('0x7')],_0x308568[_0x359c('0x8')],_0x308568[_0x359c('0x9')],_0x308568[_0x359c('0xa')],_0x308568['membername'],_0x308568[_0x359c('0xb')]));if(_0x308568['interface']){utils[_0x359c('0xc')](_0x308568[_0x359c('0x8')])[_0x359c('0xd')](function(_0x682720){if(_0x682720){_0x308568['membername']=_0x682720[_0x359c('0xe')];_0x308568['internal']=_0x682720[_0x359c('0xf')];utils[_0x359c('0x10')](_0x359c('0x11'),_0x308568);}else{utils[_0x359c('0x12')](_0x308568[_0x359c('0x8')][_0x359c('0x13')]('/')[0x1])['then'](function(_0x17943b){if(_0x17943b){_0x308568[_0x359c('0x14')]=_0x17943b[_0x359c('0xe')];_0x308568[_0x359c('0xf')]=_0x17943b[_0x359c('0xf')];utils[_0x359c('0x10')](_0x359c('0x11'),_0x308568);}});}})[_0x359c('0x15')](function(_0x3a73ca){utils[_0x359c('0x16')](util[_0x359c('0x5')](_0x359c('0x17'),_0x308568['uniqueid']),_0x3a73ca);});}delete members[_0x308568[_0x359c('0x8')]];}function startsWith(_0x1901cc,_0x4d4860){return _[_0x359c('0x18')](_0x1901cc,function(_0x186e45){return _[_0x359c('0x19')](_0x4d4860,_0x186e45);});}exports[_0x359c('0x1a')]=function(_0x421bab){try{utils[_0x359c('0x1b')](util[_0x359c('0x5')](_0x359c('0x1c'),members[_0x421bab[_0x359c('0x1d')]]?members[_0x421bab[_0x359c('0x1d')]][_0x359c('0x7')]:_0x421bab[_0x359c('0x1d')]),_0x421bab);utils[_0x359c('0x1e')](util[_0x359c('0x5')](_0x359c('0x1f'),members[_0x421bab[_0x359c('0x1d')]]?members[_0x421bab[_0x359c('0x1d')]][_0x359c('0x7')]:_0x421bab['device'],_0x421bab[_0x359c('0x20')],_0x421bab['device']));switch(_0x421bab[_0x359c('0x20')]){case'INUSE':case _0x359c('0x21'):if(!startsWith(exclude,_0x421bab[_0x359c('0x1d')])){members[_0x421bab[_0x359c('0x1d')]]={'channel':_0x359c('0x22'),'interface':_0x421bab[_0x359c('0x1d')],'type':_0x359c('0x23'),'enterAt':utils[_0x359c('0x24')](),'role':_0x359c('0x25')};}break;case _0x359c('0x26'):if(!_[_0x359c('0x27')](members[_0x421bab[_0x359c('0x1d')]])){members[_0x421bab[_0x359c('0x1d')]][_0x359c('0x28')]=utils[_0x359c('0x24')]();members[_0x421bab[_0x359c('0x1d')]][_0x359c('0x29')]=utils['diffTime'](members[_0x421bab[_0x359c('0x1d')]][_0x359c('0x28')],members[_0x421bab[_0x359c('0x1d')]]['enterAt']);if(members[_0x421bab[_0x359c('0x1d')]][_0x359c('0x7')]){writeDB(members[_0x421bab[_0x359c('0x1d')]]);}}break;default:break;}}catch(_0x532b85){utils[_0x359c('0x16')](util['format'](_0x359c('0x1c'),members[_0x421bab[_0x359c('0x1d')]]?members[_0x421bab[_0x359c('0x1d')]][_0x359c('0x7')]:_0x421bab['device']),_0x532b85);}};exports[_0x359c('0x2a')]=function(_0x366733){try{if(!_[_0x359c('0x27')](members[_0x366733[_0x359c('0x8')]])){utils[_0x359c('0x1b')](util[_0x359c('0x5')]('[%s][members][agentcomplete]',_0x366733['uniqueid']),_0x366733);utils['info'](util[_0x359c('0x5')](_0x359c('0x2b'),_0x366733['uniqueid'],_0x366733[_0x359c('0x8')],_0x366733[_0x359c('0x2c')]));members[_0x366733[_0x359c('0x8')]]=_[_0x359c('0x2d')](members[_0x366733[_0x359c('0x8')]],{'data4':_0x366733['queue'],'uniqueid':_0x366733[_0x359c('0x7')]});}}catch(_0x166928){utils[_0x359c('0x16')](util['format']('[%s][members][agentcomplete]',_0x366733['uniqueid']),_0x166928);}};exports[_0x359c('0x2e')]=function(_0x1cbffa){try{utils['debug'](util[_0x359c('0x5')](_0x359c('0x2f'),_0x1cbffa[_0x359c('0x7')]),_0x1cbffa);if(_0x1cbffa[_0x359c('0x9')]){var _0x155f4a=_0x1cbffa[_0x359c('0x9')]['split']('-')[0x0];if(!_[_0x359c('0x27')](members[_0x155f4a])){members[_0x155f4a]=_[_0x359c('0x2d')](members[_0x155f4a],{'data1':members[_0x155f4a][_0x359c('0x30')]||_0x1cbffa[_0x359c('0xb')],'data2':members[_0x155f4a][_0x359c('0xa')]||_0x1cbffa[_0x359c('0x31')],'data3':members[_0x155f4a]['data3']||_0x1cbffa[_0x359c('0x32')],'uniqueid':members[_0x155f4a]['uniqueid']||_0x1cbffa['uniqueid']});utils[_0x359c('0x1e')](util[_0x359c('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x1cbffa[_0x359c('0x7')],members[_0x155f4a][_0x359c('0x30')],members[_0x155f4a][_0x359c('0xa')],members[_0x155f4a][_0x359c('0x33')]));if(members[_0x155f4a]['exitAt']){writeDB(members[_0x155f4a]);}}}if(_0x1cbffa[_0x359c('0x34')]){var _0x23c673=_0x1cbffa[_0x359c('0x34')]['split']('-')[0x0];if(!_[_0x359c('0x27')](members[_0x23c673])){members[_0x23c673]=_['assign'](members[_0x23c673],{'data1':members[_0x23c673][_0x359c('0x30')]||_0x1cbffa['type'],'data2':members[_0x23c673][_0x359c('0xa')]||_0x1cbffa[_0x359c('0x31')],'data3':members[_0x23c673]['data3']||_0x1cbffa['destination'],'uniqueid':members[_0x23c673][_0x359c('0x7')]||_0x1cbffa[_0x359c('0x7')]});utils[_0x359c('0x1e')](util[_0x359c('0x5')](_0x359c('0x35'),_0x1cbffa[_0x359c('0x7')],members[_0x23c673][_0x359c('0x30')],members[_0x23c673][_0x359c('0xa')],members[_0x23c673]['data3']));if(members[_0x23c673][_0x359c('0x28')]){writeDB(members[_0x23c673]);}}}}catch(_0x3c81de){utils[_0x359c('0x16')](util[_0x359c('0x5')](_0x359c('0x2f'),_0x1cbffa[_0x359c('0x7')]),_0x3c81de);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index f9c47c4..e4c65d6 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 _0x2c91=['transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','position','assign','now','error','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','info','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','membername','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','ATTENDED','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','format','uniqueid','queue','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport'];(function(_0x1adfe5,_0x518ce5){var _0x242fde=function(_0x2016de){while(--_0x2016de){_0x1adfe5['push'](_0x1adfe5['shift']());}};_0x242fde(++_0x518ce5);}(_0x2c91,0xbb));var _0x12c9=function(_0x37005b,_0x5d7236){_0x37005b=_0x37005b-0x0;var _0x14de05=_0x2c91[_0x37005b];return _0x14de05;};'use strict';var _=require(_0x12c9('0x0'));var util=require(_0x12c9('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x3bc164){utils['info'](util[_0x12c9('0x2')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x3bc164[_0x12c9('0x3')],_0x3bc164['channel'],_0x3bc164[_0x12c9('0x4')],_0x3bc164['lastAssignedTo'],_0x3bc164['calleridnum'],_0x3bc164['accountcode'],_0x3bc164[_0x12c9('0x5')]));if(_0x3bc164[_0x12c9('0x4')]){utils[_0x12c9('0x6')](_0x3bc164[_0x12c9('0x4')])[_0x12c9('0x7')](function(_0x127bdc){if(_0x127bdc){_0x3bc164[_0x12c9('0x8')]=_0x127bdc[_0x12c9('0x8')];}utils[_0x12c9('0x9')](_0x12c9('0xa'),_0x3bc164);});}else{utils[_0x12c9('0x9')](_0x12c9('0xa'),_0x3bc164);}if(_0x3bc164['transfereduniqueid']){delete queues[_0x3bc164[_0x12c9('0xb')]];}else{delete queues[_0x3bc164[_0x12c9('0x3')]];}}exports[_0x12c9('0xc')]=function(_0x16fe0b){try{utils[_0x12c9('0xd')](util['format'](_0x12c9('0xe'),_0x16fe0b['uniqueid']),_0x16fe0b);utils['info'](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x16fe0b['uniqueid'],_0x16fe0b[_0x12c9('0x4')],_0x16fe0b[_0x12c9('0xf')]));queues[_0x16fe0b['uniqueid']]=_[_0x12c9('0x10')](_0x16fe0b,{'originalposition':_0x16fe0b[_0x12c9('0xf')],'queuecallerjoinAt':utils[_0x12c9('0x11')](),'mohtime':0x0});}catch(_0x4c28b8){utils[_0x12c9('0x12')](util[_0x12c9('0x2')](_0x12c9('0xe'),_0x16fe0b[_0x12c9('0x3')]),_0x4c28b8);}};exports[_0x12c9('0x13')]=function(_0x2825ee){try{if(!_[_0x12c9('0x14')](queues[_0x2825ee[_0x12c9('0x3')]])){utils[_0x12c9('0xd')](util[_0x12c9('0x2')]('[%s][queues][hangup]',_0x2825ee[_0x12c9('0x3')]),_0x2825ee);if(queues[_0x2825ee['uniqueid']][_0x12c9('0x15')]){if(!queues[_0x2825ee[_0x12c9('0x3')]][_0x12c9('0x16')]&&!queues[_0x2825ee[_0x12c9('0x3')]][_0x12c9('0x17')]){queues[_0x2825ee[_0x12c9('0x3')]][_0x12c9('0x18')]=!![];queues[_0x2825ee[_0x12c9('0x3')]][_0x12c9('0x19')]=utils['now']();queues[_0x2825ee[_0x12c9('0x3')]][_0x12c9('0x5')]=_0x12c9('0x1a');}utils[_0x12c9('0x1b')](util[_0x12c9('0x2')](_0x12c9('0x1c'),_0x2825ee[_0x12c9('0x3')],queues[_0x2825ee['uniqueid']][_0x12c9('0x1d')],queues[_0x2825ee[_0x12c9('0x3')]][_0x12c9('0x5')]));writeDB(queues[_0x2825ee['uniqueid']]);}else if(queues[_0x2825ee[_0x12c9('0x3')]]['transfereduniqueid']){utils['info'](util[_0x12c9('0x2')](_0x12c9('0x1e'),_0x2825ee[_0x12c9('0x3')],queues[_0x2825ee[_0x12c9('0x3')]][_0x12c9('0x1d')],queues[_0x2825ee['uniqueid']]['transfereduniqueid']));queues[queues[_0x2825ee[_0x12c9('0x3')]]['transfereduniqueid']]=queues[_0x2825ee['uniqueid']];queues[queues[_0x2825ee[_0x12c9('0x3')]]['transfereduniqueid']][_0x12c9('0x1f')]=0x2;delete queues[_0x2825ee[_0x12c9('0x3')]];}}}catch(_0xf015c6){utils[_0x12c9('0x12')](util[_0x12c9('0x2')](_0x12c9('0x20'),_0x2825ee['uniqueid']),_0xf015c6);}};exports[_0x12c9('0x21')]=function(_0x4e38a3){try{utils['debug'](util[_0x12c9('0x2')](_0x12c9('0x22'),_0x4e38a3['uniqueid']),_0x4e38a3);if(!_[_0x12c9('0x14')](_0x4e38a3[_0x12c9('0x23')]['queuestatus'])&&_0x4e38a3[_0x12c9('0x24')][_0x12c9('0x25')]()!==_0x12c9('0x26')){if(!_[_0x12c9('0x14')](queues[_0x4e38a3[_0x12c9('0x3')]])){queues[_0x4e38a3[_0x12c9('0x3')]][_0x12c9('0x16')]=![];queues[_0x4e38a3[_0x12c9('0x3')]][_0x12c9('0x27')]=null;queues[_0x4e38a3[_0x12c9('0x3')]][_0x12c9('0x17')]=!![];queues[_0x4e38a3[_0x12c9('0x3')]][_0x12c9('0x28')]=utils[_0x12c9('0x11')]();queues[_0x4e38a3[_0x12c9('0x3')]][_0x12c9('0x5')]=_0x4e38a3[_0x12c9('0x24')][_0x12c9('0x25')]();utils['info'](util['format'](_0x12c9('0x29'),_0x4e38a3[_0x12c9('0x3')],queues[_0x4e38a3[_0x12c9('0x3')]][_0x12c9('0x1d')],_0x4e38a3['value'],queues[_0x4e38a3['uniqueid']][_0x12c9('0x5')]));writeDB(queues[_0x4e38a3[_0x12c9('0x3')]]);}}else if(!_[_0x12c9('0x14')](_0x4e38a3[_0x12c9('0x23')][_0x12c9('0x2a')])){if(!_[_0x12c9('0x14')](queues[_0x4e38a3[_0x12c9('0x3')]])&&!queues[_0x4e38a3[_0x12c9('0x3')]][_0x12c9('0x16')]){queues[_0x4e38a3[_0x12c9('0x3')]][_0x12c9('0x16')]=![];queues[_0x4e38a3[_0x12c9('0x3')]]['queuecallerabandonAt']=null;queues[_0x4e38a3[_0x12c9('0x3')]]['queuecallerexit']=!![];queues[_0x4e38a3[_0x12c9('0x3')]][_0x12c9('0x28')]=utils[_0x12c9('0x11')]();queues[_0x4e38a3[_0x12c9('0x3')]][_0x12c9('0x5')]=_0x12c9('0x2b');utils['info'](util[_0x12c9('0x2')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4e38a3[_0x12c9('0x3')],queues[_0x4e38a3['uniqueid']]['name'],_0x4e38a3[_0x12c9('0x24')],queues[_0x4e38a3['uniqueid']]['queuecallerexitreason']));}}}catch(_0x26acc3){utils[_0x12c9('0x12')](util[_0x12c9('0x2')](_0x12c9('0x22'),_0x4e38a3['uniqueid']),_0x26acc3);}};exports[_0x12c9('0x16')]=function(_0x77a302){try{if(!_[_0x12c9('0x14')](queues[_0x77a302[_0x12c9('0x3')]])){utils[_0x12c9('0xd')](util[_0x12c9('0x2')](_0x12c9('0x2c'),_0x77a302['uniqueid']),_0x77a302);queues[_0x77a302['uniqueid']][_0x12c9('0x17')]=![];queues[_0x77a302[_0x12c9('0x3')]][_0x12c9('0x28')]=null;queues[_0x77a302['uniqueid']][_0x12c9('0x16')]=!![];queues[_0x77a302[_0x12c9('0x3')]]['queuecallerabandonAt']=utils[_0x12c9('0x11')]();queues[_0x77a302['uniqueid']]['queuecallerexitreason']='ABANDONED';utils[_0x12c9('0x1b')](util[_0x12c9('0x2')](_0x12c9('0x2d'),_0x77a302[_0x12c9('0x3')],queues[_0x77a302['uniqueid']][_0x12c9('0x1d')],queues[_0x77a302[_0x12c9('0x3')]][_0x12c9('0x5')]));}}catch(_0x563af2){utils['error'](util['format'](_0x12c9('0x2c'),_0x77a302[_0x12c9('0x3')]),_0x563af2);}};exports[_0x12c9('0x2e')]=function(_0x3b88f1){try{if(!_['isNil'](queues[_0x3b88f1[_0x12c9('0x3')]])){utils[_0x12c9('0xd')](util['format'](_0x12c9('0x2f'),_0x3b88f1['uniqueid']),_0x3b88f1);utils[_0x12c9('0x1b')](util[_0x12c9('0x2')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3b88f1[_0x12c9('0x3')],queues[_0x3b88f1[_0x12c9('0x3')]]['name'],_0x3b88f1['connectedlinenum'],_0x3b88f1[_0x12c9('0x30')]));queues[_0x3b88f1['uniqueid']]['queuecallerleave']=!![];queues[_0x3b88f1['uniqueid']][_0x12c9('0x15')]=utils[_0x12c9('0x11')]();queues[_0x3b88f1[_0x12c9('0x3')]][_0x12c9('0x31')]=utils[_0x12c9('0x32')](queues[_0x3b88f1[_0x12c9('0x3')]][_0x12c9('0x15')],queues[_0x3b88f1['uniqueid']][_0x12c9('0x33')]);queues[_0x3b88f1[_0x12c9('0x3')]][_0x12c9('0xf')]=_0x3b88f1[_0x12c9('0xf')];queues[_0x3b88f1[_0x12c9('0x3')]][_0x12c9('0x34')]=_0x3b88f1[_0x12c9('0x34')];queues[_0x3b88f1[_0x12c9('0x3')]][_0x12c9('0x35')]=_0x3b88f1[_0x12c9('0x35')];queues[_0x3b88f1['uniqueid']]['connectedlinename']=_0x3b88f1['connectedlinename'];}}catch(_0x1d01c9){utils[_0x12c9('0x12')](util[_0x12c9('0x2')](_0x12c9('0x2f'),_0x3b88f1[_0x12c9('0x3')]),_0x1d01c9);}};exports['agentconnect']=function(_0x19e7bb){try{if(!_[_0x12c9('0x14')](queues[_0x19e7bb[_0x12c9('0x3')]])){utils['debug'](util[_0x12c9('0x2')](_0x12c9('0x36'),_0x19e7bb[_0x12c9('0x3')]),_0x19e7bb);utils[_0x12c9('0x1b')](util[_0x12c9('0x2')](_0x12c9('0x37'),_0x19e7bb['uniqueid'],queues[_0x19e7bb[_0x12c9('0x3')]]['name'],_0x19e7bb['membername'],_0x19e7bb[_0x12c9('0x38')]));queues[_0x19e7bb['uniqueid']][_0x12c9('0x16')]=![];queues[_0x19e7bb[_0x12c9('0x3')]][_0x12c9('0x16')]=![];queues[_0x19e7bb[_0x12c9('0x3')]]['queuecallerabandonAt']=null;queues[_0x19e7bb[_0x12c9('0x3')]][_0x12c9('0x17')]=![];queues[_0x19e7bb[_0x12c9('0x3')]]['queuecallerexitreason']=null;queues[_0x19e7bb[_0x12c9('0x3')]][_0x12c9('0x28')]=null;queues[_0x19e7bb[_0x12c9('0x3')]][_0x12c9('0x39')]=!![];queues[_0x19e7bb['uniqueid']]['accountcode']=_0x19e7bb['destaccountcode'];queues[_0x19e7bb['uniqueid']][_0x12c9('0x3a')]=_0x19e7bb['membername'];}}catch(_0x54dddc){utils[_0x12c9('0x12')](util[_0x12c9('0x2')](_0x12c9('0x36'),_0x19e7bb[_0x12c9('0x3')]),_0x54dddc);}};exports[_0x12c9('0x3b')]=function(_0x10e90b){try{if(!_[_0x12c9('0x14')](queues[_0x10e90b[_0x12c9('0x3')]])){if(queues[_0x10e90b[_0x12c9('0x3')]]['queuecallerleaveAt']){utils[_0x12c9('0xd')](util[_0x12c9('0x2')](_0x12c9('0x3c'),_0x10e90b['uniqueid']),_0x10e90b);queues[_0x10e90b[_0x12c9('0x3')]][_0x12c9('0x16')]=![];queues[_0x10e90b[_0x12c9('0x3')]]['queuecallerabandon']=![];queues[_0x10e90b[_0x12c9('0x3')]][_0x12c9('0x27')]=null;queues[_0x10e90b['uniqueid']][_0x12c9('0x17')]=![];queues[_0x10e90b[_0x12c9('0x3')]][_0x12c9('0x28')]=null;queues[_0x10e90b[_0x12c9('0x3')]]['assigned']=!![];queues[_0x10e90b['uniqueid']][_0x12c9('0x3a')]=_0x10e90b[_0x12c9('0x3d')];queues[_0x10e90b[_0x12c9('0x3')]]['queuecallercomplete']=!![];queues[_0x10e90b[_0x12c9('0x3')]][_0x12c9('0x19')]=utils[_0x12c9('0x11')]();if(_0x10e90b[_0x12c9('0x3e')]==_0x12c9('0x3f')){if(!queues[_0x10e90b[_0x12c9('0x3')]][_0x12c9('0x3f')]){queues[_0x10e90b[_0x12c9('0x3')]][_0x12c9('0x5')]=_0x12c9('0x40');}}else{queues[_0x10e90b['uniqueid']][_0x12c9('0x5')]='COMPLETEDBY'+_0x10e90b[_0x12c9('0x3e')]['toUpperCase']();}utils[_0x12c9('0x1b')](util[_0x12c9('0x2')](_0x12c9('0x41'),_0x10e90b[_0x12c9('0x3')],queues[_0x10e90b['uniqueid']][_0x12c9('0x1d')],_0x10e90b['membername'],queues[_0x10e90b['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x10e90b[_0x12c9('0x3')]]);}}}catch(_0x4079e8){utils[_0x12c9('0x12')](util[_0x12c9('0x2')](_0x12c9('0x3c'),_0x10e90b['uniqueid']),_0x4079e8);}};exports[_0x12c9('0x42')]=function(_0x1fcf86){try{if(!_['isNil'](queues[_0x1fcf86[_0x12c9('0x43')]])){utils[_0x12c9('0xd')](util[_0x12c9('0x2')](_0x12c9('0x44'),_0x1fcf86[_0x12c9('0x3')]),_0x1fcf86);queues[_0x1fcf86[_0x12c9('0x43')]][_0x12c9('0x3f')]=!![];queues[_0x1fcf86['transfereeuniqueid']][_0x12c9('0x45')]=_0x12c9('0x46');queues[_0x1fcf86[_0x12c9('0x43')]][_0x12c9('0x47')]=_0x1fcf86[_0x12c9('0x48')];queues[_0x1fcf86[_0x12c9('0x43')]][_0x12c9('0x49')]=_0x1fcf86[_0x12c9('0x43')];queues[_0x1fcf86['transfereeuniqueid']]['queuecallerexitreason']=_0x12c9('0x4a');utils['info'](util[_0x12c9('0x2')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x1fcf86[_0x12c9('0x3')],queues[_0x1fcf86[_0x12c9('0x43')]][_0x12c9('0x1d')],_0x1fcf86['transfereeuniqueid'],_0x1fcf86[_0x12c9('0x48')]));}}catch(_0x5d5e4b){utils[_0x12c9('0x12')](util[_0x12c9('0x2')](_0x12c9('0x44'),_0x1fcf86[_0x12c9('0x3')]),_0x5d5e4b);}};exports[_0x12c9('0x4b')]=function(_0x2e9b37){try{utils[_0x12c9('0xd')](util[_0x12c9('0x2')](_0x12c9('0x4c'),_0x2e9b37[_0x12c9('0x4d')]),_0x2e9b37);if(_0x2e9b37[_0x12c9('0x4d')]==_0x2e9b37[_0x12c9('0x4e')]){if(!_[_0x12c9('0x14')](queues[_0x2e9b37['secondtransfererlinkedid']])){utils[_0x12c9('0x1b')](util['format'](_0x12c9('0x4f'),_0x2e9b37[_0x12c9('0x4d')],queues[_0x2e9b37[_0x12c9('0x50')]][_0x12c9('0x1d')],_0x2e9b37['origtransfererexten']));queues[_0x2e9b37[_0x12c9('0x50')]][_0x12c9('0x3f')]=!![];queues[_0x2e9b37[_0x12c9('0x50')]][_0x12c9('0x45')]=_0x12c9('0x51');queues[_0x2e9b37[_0x12c9('0x50')]]['transferexten']=_0x2e9b37['origtransfererexten'];queues[_0x2e9b37[_0x12c9('0x50')]][_0x12c9('0x49')]=_0x2e9b37[_0x12c9('0x4d')];queues[_0x2e9b37[_0x12c9('0x50')]][_0x12c9('0x5')]='ATTENDEDTRANSFER';}if(!_[_0x12c9('0x14')](queues[_0x2e9b37[_0x12c9('0x4e')]])){if(_0x2e9b37[_0x12c9('0x52')]&&queues[_0x2e9b37[_0x12c9('0x52')]]){queues[_0x2e9b37['transfereelinkedid']][_0x12c9('0x1f')]=0x1;queues[_0x2e9b37[_0x12c9('0x43')]]=_['clone'](queues[_0x2e9b37[_0x12c9('0x52')]]);queues[_0x2e9b37[_0x12c9('0x43')]][_0x12c9('0xb')]=_0x2e9b37[_0x12c9('0x53')];queues[_0x2e9b37[_0x12c9('0x43')]][_0x12c9('0x1f')]=0x2;queues[_0x2e9b37[_0x12c9('0x43')]][_0x12c9('0x54')]=queues[_0x2e9b37['secondtransfererlinkedid']][_0x12c9('0x54')];queues[_0x2e9b37['transfereeuniqueid']][_0x12c9('0x55')]=queues[_0x2e9b37['secondtransfererlinkedid']]['calleridname'];queues[_0x2e9b37[_0x12c9('0x43')]][_0x12c9('0x33')]=utils[_0x12c9('0x11')]();queues[_0x2e9b37[_0x12c9('0x43')]]['queuecallerleaveAt']=utils[_0x12c9('0x11')]();queues[_0x2e9b37[_0x12c9('0x43')]]['holdtime']=0x0;queues[_0x2e9b37['transfereeuniqueid']]['mohtime']=0x0;utils[_0x12c9('0x1b')](util[_0x12c9('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x2e9b37[_0x12c9('0x4d')],queues[_0x2e9b37[_0x12c9('0x43')]]['name'],queues[_0x2e9b37[_0x12c9('0x43')]][_0x12c9('0x54')],queues[_0x2e9b37[_0x12c9('0x43')]][_0x12c9('0x55')]));}else{utils[_0x12c9('0x1b')](util[_0x12c9('0x2')](_0x12c9('0x56'),_0x2e9b37[_0x12c9('0x4d')],queues[_0x2e9b37[_0x12c9('0x4e')]][_0x12c9('0x1d')],_0x2e9b37[_0x12c9('0x50')]));queues[_0x2e9b37[_0x12c9('0x4e')]][_0x12c9('0xb')]=_0x2e9b37[_0x12c9('0x50')];}}}else if(_0x2e9b37[_0x12c9('0x57')]==_0x2e9b37[_0x12c9('0x50')]){if(!_['isNil'](queues[_0x2e9b37[_0x12c9('0x4e')]])){utils[_0x12c9('0x1b')](util[_0x12c9('0x2')](_0x12c9('0x58'),_0x2e9b37[_0x12c9('0x4d')],queues[_0x2e9b37['origtransfererlinkedid']][_0x12c9('0x1d')],_0x2e9b37[_0x12c9('0x57')],_0x2e9b37[_0x12c9('0x59')]));queues[_0x2e9b37['origtransfererlinkedid']][_0x12c9('0x3f')]=!![];queues[_0x2e9b37[_0x12c9('0x4e')]][_0x12c9('0x45')]=_0x12c9('0x51');queues[_0x2e9b37[_0x12c9('0x4e')]]['transferexten']=_0x2e9b37['secondtransfererexten'];queues[_0x2e9b37[_0x12c9('0x4e')]]['transferuniqueid']=_0x2e9b37['secondtransfereruniqueid'];queues[_0x2e9b37[_0x12c9('0x4e')]][_0x12c9('0x5')]=_0x12c9('0x5a');}if(!_[_0x12c9('0x14')](queues[_0x2e9b37[_0x12c9('0x50')]])){if(_0x2e9b37['transfertargetlinkedid']&&queues[_0x2e9b37[_0x12c9('0x5b')]]){queues[_0x2e9b37['transfertargetlinkedid']][_0x12c9('0x1f')]=0x1;queues[_0x2e9b37[_0x12c9('0x53')]]=_['clone'](queues[_0x2e9b37[_0x12c9('0x5b')]]);queues[_0x2e9b37[_0x12c9('0x53')]][_0x12c9('0xb')]=_0x2e9b37['transfertargetuniqueid'];queues[_0x2e9b37[_0x12c9('0x53')]][_0x12c9('0x1f')]=0x2;queues[_0x2e9b37[_0x12c9('0x53')]]['calleridnum']=queues[_0x2e9b37[_0x12c9('0x4e')]]['calleridnum'];queues[_0x2e9b37[_0x12c9('0x53')]][_0x12c9('0x55')]=queues[_0x2e9b37[_0x12c9('0x4e')]][_0x12c9('0x55')];queues[_0x2e9b37[_0x12c9('0x53')]][_0x12c9('0x33')]=utils[_0x12c9('0x11')]();queues[_0x2e9b37[_0x12c9('0x53')]]['queuecallerleaveAt']=utils['now']();queues[_0x2e9b37[_0x12c9('0x53')]][_0x12c9('0x31')]=0x0;queues[_0x2e9b37[_0x12c9('0x53')]][_0x12c9('0x5c')]=0x0;utils[_0x12c9('0x1b')](util[_0x12c9('0x2')](_0x12c9('0x5d'),_0x2e9b37[_0x12c9('0x4d')],queues[_0x2e9b37[_0x12c9('0x53')]]['name'],queues[_0x2e9b37[_0x12c9('0x53')]]['transfereduniqueid'],queues[_0x2e9b37[_0x12c9('0x53')]][_0x12c9('0x54')],queues[_0x2e9b37[_0x12c9('0x53')]][_0x12c9('0x55')]));}else{utils[_0x12c9('0x1b')](util[_0x12c9('0x2')](_0x12c9('0x56'),_0x2e9b37[_0x12c9('0x4d')],queues[_0x2e9b37[_0x12c9('0x50')]][_0x12c9('0x1d')],_0x2e9b37[_0x12c9('0x4e')]));queues[_0x2e9b37[_0x12c9('0x50')]]['transfereduniqueid']=_0x2e9b37[_0x12c9('0x4e')];}}}}catch(_0x3dd828){utils[_0x12c9('0x12')](util[_0x12c9('0x2')](_0x12c9('0x4c'),_0x2e9b37[_0x12c9('0x4d')]),_0x3dd828);}};exports['musiconholdstart']=function(_0x3a6201){try{if(!_['isNil'](queues[_0x3a6201[_0x12c9('0x3')]])){utils['debug'](util[_0x12c9('0x2')](_0x12c9('0x5e'),_0x3a6201['uniqueid']),_0x3a6201);queues[_0x3a6201[_0x12c9('0x3')]][_0x12c9('0x5f')]=utils[_0x12c9('0x11')]();utils[_0x12c9('0x1b')](util[_0x12c9('0x2')](_0x12c9('0x60'),_0x3a6201[_0x12c9('0x3')],queues[_0x3a6201['uniqueid']][_0x12c9('0x1d')],queues[_0x3a6201['uniqueid']][_0x12c9('0x5f')]));}}catch(_0x4c4130){utils['error'](util[_0x12c9('0x2')](_0x12c9('0x5e'),_0x3a6201[_0x12c9('0x3')]),_0x4c4130);}};exports[_0x12c9('0x61')]=function(_0x5e152d){try{if(!_['isNil'](queues[_0x5e152d[_0x12c9('0x3')]])){if(!_['isNil'](queues[_0x5e152d[_0x12c9('0x3')]][_0x12c9('0x5f')])){utils[_0x12c9('0xd')](util['format'](_0x12c9('0x62'),_0x5e152d[_0x12c9('0x3')]),_0x5e152d);queues[_0x5e152d[_0x12c9('0x3')]]['mohtime']+=utils[_0x12c9('0x32')](utils[_0x12c9('0x11')](),queues[_0x5e152d['uniqueid']][_0x12c9('0x5f')]);utils[_0x12c9('0x1b')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x5e152d[_0x12c9('0x3')],queues[_0x5e152d[_0x12c9('0x3')]]['name'],queues[_0x5e152d['uniqueid']][_0x12c9('0x5c')]));delete queues[_0x5e152d[_0x12c9('0x3')]]['musiconholdstartAt'];}}}catch(_0xf4358d){utils[_0x12c9('0x12')](util[_0x12c9('0x2')](_0x12c9('0x62'),_0x5e152d['uniqueid']),_0xf4358d);}}; \ No newline at end of file +var _0xf847=['queue','lastAssignedTo','queuecallerexitreason','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','[%s][queues][varset]','variable','queuestatus','queuecallerabandonAt','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexitAt','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','assigned','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','transfertype','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','secondtransfererlinkedid','ATTENDED','transferexten','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','info','format','uniqueid','channel'];(function(_0x4f4ac3,_0x350004){var _0x3f2db1=function(_0x4b5921){while(--_0x4b5921){_0x4f4ac3['push'](_0x4f4ac3['shift']());}};_0x3f2db1(++_0x350004);}(_0xf847,0xc4));var _0x7f84=function(_0x55810e,_0x41f64d){_0x55810e=_0x55810e-0x0;var _0x53cbf2=_0xf847[_0x55810e];return _0x53cbf2;};'use strict';var _=require(_0x7f84('0x0'));var util=require(_0x7f84('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x38351d){utils[_0x7f84('0x2')](util[_0x7f84('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x38351d[_0x7f84('0x4')],_0x38351d[_0x7f84('0x5')],_0x38351d[_0x7f84('0x6')],_0x38351d[_0x7f84('0x7')],_0x38351d['calleridnum'],_0x38351d['accountcode'],_0x38351d[_0x7f84('0x8')]));if(_0x38351d[_0x7f84('0x6')]){utils['getVoiceQueueByName'](_0x38351d[_0x7f84('0x6')])['then'](function(_0x42c4af){if(_0x42c4af){_0x38351d[_0x7f84('0x9')]=_0x42c4af[_0x7f84('0x9')];}utils['request'](_0x7f84('0xa'),_0x38351d);});}else{utils[_0x7f84('0xb')]('CreateVoiceQueueReport',_0x38351d);}if(_0x38351d[_0x7f84('0xc')]){delete queues[_0x38351d[_0x7f84('0xc')]];}else{delete queues[_0x38351d[_0x7f84('0x4')]];}}exports[_0x7f84('0xd')]=function(_0x5aff2a){try{utils[_0x7f84('0xe')](util['format'](_0x7f84('0xf'),_0x5aff2a[_0x7f84('0x4')]),_0x5aff2a);utils['info'](util[_0x7f84('0x3')](_0x7f84('0x10'),_0x5aff2a[_0x7f84('0x4')],_0x5aff2a[_0x7f84('0x6')],_0x5aff2a[_0x7f84('0x11')]));queues[_0x5aff2a['uniqueid']]=_[_0x7f84('0x12')](_0x5aff2a,{'originalposition':_0x5aff2a[_0x7f84('0x11')],'queuecallerjoinAt':utils[_0x7f84('0x13')](),'mohtime':0x0});}catch(_0x4b97c4){utils['error'](util[_0x7f84('0x3')]('[%s][queues][queuecallerjoin]',_0x5aff2a[_0x7f84('0x4')]),_0x4b97c4);}};exports[_0x7f84('0x14')]=function(_0x3a3af8){try{if(!_[_0x7f84('0x15')](queues[_0x3a3af8[_0x7f84('0x4')]])){utils[_0x7f84('0xe')](util[_0x7f84('0x3')](_0x7f84('0x16'),_0x3a3af8[_0x7f84('0x4')]),_0x3a3af8);if(queues[_0x3a3af8[_0x7f84('0x4')]][_0x7f84('0x17')]){if(!queues[_0x3a3af8[_0x7f84('0x4')]][_0x7f84('0x18')]&&!queues[_0x3a3af8[_0x7f84('0x4')]][_0x7f84('0x19')]){queues[_0x3a3af8[_0x7f84('0x4')]]['queuecallercomplete']=!![];queues[_0x3a3af8[_0x7f84('0x4')]][_0x7f84('0x1a')]=utils[_0x7f84('0x13')]();queues[_0x3a3af8[_0x7f84('0x4')]][_0x7f84('0x8')]=_0x7f84('0x1b');}utils[_0x7f84('0x2')](util[_0x7f84('0x3')](_0x7f84('0x1c'),_0x3a3af8[_0x7f84('0x4')],queues[_0x3a3af8[_0x7f84('0x4')]][_0x7f84('0x1d')],queues[_0x3a3af8['uniqueid']][_0x7f84('0x8')]));writeDB(queues[_0x3a3af8['uniqueid']]);}else if(queues[_0x3a3af8[_0x7f84('0x4')]]['transfereduniqueid']){utils['info'](util[_0x7f84('0x3')](_0x7f84('0x1e'),_0x3a3af8[_0x7f84('0x4')],queues[_0x3a3af8[_0x7f84('0x4')]][_0x7f84('0x1d')],queues[_0x3a3af8[_0x7f84('0x4')]][_0x7f84('0xc')]));queues[queues[_0x3a3af8[_0x7f84('0x4')]][_0x7f84('0xc')]]=queues[_0x3a3af8[_0x7f84('0x4')]];queues[queues[_0x3a3af8[_0x7f84('0x4')]]['transfereduniqueid']][_0x7f84('0x1f')]=0x2;delete queues[_0x3a3af8[_0x7f84('0x4')]];}}}catch(_0x3d442b){utils[_0x7f84('0x20')](util['format'](_0x7f84('0x16'),_0x3a3af8[_0x7f84('0x4')]),_0x3d442b);}};exports['varset']=function(_0x1b1f7a){try{utils[_0x7f84('0xe')](util[_0x7f84('0x3')](_0x7f84('0x21'),_0x1b1f7a[_0x7f84('0x4')]),_0x1b1f7a);if(!_['isNil'](_0x1b1f7a[_0x7f84('0x22')][_0x7f84('0x23')])&&_0x1b1f7a['value']['toUpperCase']()!=='CONTINUE'){if(!_[_0x7f84('0x15')](queues[_0x1b1f7a[_0x7f84('0x4')]])){queues[_0x1b1f7a[_0x7f84('0x4')]][_0x7f84('0x18')]=![];queues[_0x1b1f7a['uniqueid']][_0x7f84('0x24')]=null;queues[_0x1b1f7a['uniqueid']][_0x7f84('0x19')]=!![];queues[_0x1b1f7a['uniqueid']]['queuecallerexitAt']=utils[_0x7f84('0x13')]();queues[_0x1b1f7a[_0x7f84('0x4')]][_0x7f84('0x8')]=_0x1b1f7a[_0x7f84('0x25')][_0x7f84('0x26')]();utils[_0x7f84('0x2')](util[_0x7f84('0x3')](_0x7f84('0x27'),_0x1b1f7a[_0x7f84('0x4')],queues[_0x1b1f7a[_0x7f84('0x4')]][_0x7f84('0x1d')],_0x1b1f7a['value'],queues[_0x1b1f7a[_0x7f84('0x4')]][_0x7f84('0x8')]));writeDB(queues[_0x1b1f7a['uniqueid']]);}}else if(!_[_0x7f84('0x15')](_0x1b1f7a[_0x7f84('0x22')][_0x7f84('0x28')])){if(!_[_0x7f84('0x15')](queues[_0x1b1f7a[_0x7f84('0x4')]])&&!queues[_0x1b1f7a['uniqueid']][_0x7f84('0x18')]){queues[_0x1b1f7a['uniqueid']][_0x7f84('0x18')]=![];queues[_0x1b1f7a[_0x7f84('0x4')]]['queuecallerabandonAt']=null;queues[_0x1b1f7a[_0x7f84('0x4')]][_0x7f84('0x19')]=!![];queues[_0x1b1f7a[_0x7f84('0x4')]][_0x7f84('0x29')]=utils['now']();queues[_0x1b1f7a[_0x7f84('0x4')]]['queuecallerexitreason']='EXITWITHKEY';utils[_0x7f84('0x2')](util[_0x7f84('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x1b1f7a[_0x7f84('0x4')],queues[_0x1b1f7a[_0x7f84('0x4')]][_0x7f84('0x1d')],_0x1b1f7a[_0x7f84('0x25')],queues[_0x1b1f7a[_0x7f84('0x4')]][_0x7f84('0x8')]));}}}catch(_0x52376f){utils['error'](util[_0x7f84('0x3')](_0x7f84('0x21'),_0x1b1f7a[_0x7f84('0x4')]),_0x52376f);}};exports[_0x7f84('0x18')]=function(_0x14d035){try{if(!_['isNil'](queues[_0x14d035[_0x7f84('0x4')]])){utils[_0x7f84('0xe')](util['format'](_0x7f84('0x2a'),_0x14d035[_0x7f84('0x4')]),_0x14d035);queues[_0x14d035[_0x7f84('0x4')]]['queuecallerexit']=![];queues[_0x14d035['uniqueid']]['queuecallerexitAt']=null;queues[_0x14d035[_0x7f84('0x4')]][_0x7f84('0x18')]=!![];queues[_0x14d035[_0x7f84('0x4')]][_0x7f84('0x24')]=utils[_0x7f84('0x13')]();queues[_0x14d035[_0x7f84('0x4')]][_0x7f84('0x8')]=_0x7f84('0x2b');utils[_0x7f84('0x2')](util[_0x7f84('0x3')](_0x7f84('0x2c'),_0x14d035['uniqueid'],queues[_0x14d035[_0x7f84('0x4')]][_0x7f84('0x1d')],queues[_0x14d035[_0x7f84('0x4')]][_0x7f84('0x8')]));}}catch(_0x6c70e9){utils[_0x7f84('0x20')](util[_0x7f84('0x3')]('[%s][queues][queuecallerabandon]',_0x14d035[_0x7f84('0x4')]),_0x6c70e9);}};exports['queuecallerleave']=function(_0x2499d9){try{if(!_['isNil'](queues[_0x2499d9[_0x7f84('0x4')]])){utils[_0x7f84('0xe')](util[_0x7f84('0x3')](_0x7f84('0x2d'),_0x2499d9[_0x7f84('0x4')]),_0x2499d9);utils['info'](util[_0x7f84('0x3')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2499d9[_0x7f84('0x4')],queues[_0x2499d9[_0x7f84('0x4')]][_0x7f84('0x1d')],_0x2499d9['connectedlinenum'],_0x2499d9['connectedlinename']));queues[_0x2499d9['uniqueid']][_0x7f84('0x2e')]=!![];queues[_0x2499d9['uniqueid']][_0x7f84('0x17')]=utils['now']();queues[_0x2499d9[_0x7f84('0x4')]][_0x7f84('0x2f')]=utils[_0x7f84('0x30')](queues[_0x2499d9['uniqueid']][_0x7f84('0x17')],queues[_0x2499d9[_0x7f84('0x4')]][_0x7f84('0x31')]);queues[_0x2499d9['uniqueid']][_0x7f84('0x11')]=_0x2499d9[_0x7f84('0x11')];queues[_0x2499d9[_0x7f84('0x4')]]['count']=_0x2499d9[_0x7f84('0x32')];queues[_0x2499d9['uniqueid']][_0x7f84('0x33')]=_0x2499d9[_0x7f84('0x33')];queues[_0x2499d9[_0x7f84('0x4')]][_0x7f84('0x34')]=_0x2499d9[_0x7f84('0x34')];}}catch(_0x52c796){utils[_0x7f84('0x20')](util[_0x7f84('0x3')](_0x7f84('0x2d'),_0x2499d9[_0x7f84('0x4')]),_0x52c796);}};exports[_0x7f84('0x35')]=function(_0x4698f8){try{if(!_['isNil'](queues[_0x4698f8[_0x7f84('0x4')]])){utils[_0x7f84('0xe')](util['format'](_0x7f84('0x36'),_0x4698f8[_0x7f84('0x4')]),_0x4698f8);utils[_0x7f84('0x2')](util['format'](_0x7f84('0x37'),_0x4698f8[_0x7f84('0x4')],queues[_0x4698f8[_0x7f84('0x4')]][_0x7f84('0x1d')],_0x4698f8[_0x7f84('0x38')],_0x4698f8[_0x7f84('0x39')]));queues[_0x4698f8[_0x7f84('0x4')]][_0x7f84('0x18')]=![];queues[_0x4698f8['uniqueid']]['queuecallerabandon']=![];queues[_0x4698f8[_0x7f84('0x4')]][_0x7f84('0x24')]=null;queues[_0x4698f8[_0x7f84('0x4')]][_0x7f84('0x19')]=![];queues[_0x4698f8['uniqueid']][_0x7f84('0x8')]=null;queues[_0x4698f8[_0x7f84('0x4')]][_0x7f84('0x29')]=null;queues[_0x4698f8[_0x7f84('0x4')]]['assigned']=!![];queues[_0x4698f8[_0x7f84('0x4')]]['accountcode']=_0x4698f8[_0x7f84('0x39')];queues[_0x4698f8[_0x7f84('0x4')]][_0x7f84('0x7')]=_0x4698f8[_0x7f84('0x38')];}}catch(_0x34e797){utils[_0x7f84('0x20')](util[_0x7f84('0x3')](_0x7f84('0x36'),_0x4698f8[_0x7f84('0x4')]),_0x34e797);}};exports[_0x7f84('0x3a')]=function(_0x46647a){try{if(!_['isNil'](queues[_0x46647a[_0x7f84('0x4')]])){if(queues[_0x46647a[_0x7f84('0x4')]]['queuecallerleaveAt']){utils['debug'](util[_0x7f84('0x3')]('[%s][queues][agentcomplete]',_0x46647a['uniqueid']),_0x46647a);queues[_0x46647a[_0x7f84('0x4')]]['queuecallerabandon']=![];queues[_0x46647a[_0x7f84('0x4')]][_0x7f84('0x18')]=![];queues[_0x46647a[_0x7f84('0x4')]][_0x7f84('0x24')]=null;queues[_0x46647a['uniqueid']][_0x7f84('0x19')]=![];queues[_0x46647a[_0x7f84('0x4')]]['queuecallerexitAt']=null;queues[_0x46647a[_0x7f84('0x4')]][_0x7f84('0x3b')]=!![];queues[_0x46647a['uniqueid']][_0x7f84('0x7')]=_0x46647a['membername'];queues[_0x46647a[_0x7f84('0x4')]][_0x7f84('0x3c')]=!![];queues[_0x46647a[_0x7f84('0x4')]][_0x7f84('0x1a')]=utils[_0x7f84('0x13')]();if(_0x46647a[_0x7f84('0x3d')]==_0x7f84('0x3e')){if(!queues[_0x46647a['uniqueid']][_0x7f84('0x3e')]){queues[_0x46647a[_0x7f84('0x4')]][_0x7f84('0x8')]=_0x7f84('0x3f');}}else{queues[_0x46647a[_0x7f84('0x4')]][_0x7f84('0x8')]=_0x7f84('0x40')+_0x46647a[_0x7f84('0x3d')][_0x7f84('0x26')]();}utils[_0x7f84('0x2')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x46647a['uniqueid'],queues[_0x46647a[_0x7f84('0x4')]][_0x7f84('0x1d')],_0x46647a['membername'],queues[_0x46647a['uniqueid']][_0x7f84('0x8')]));writeDB(queues[_0x46647a[_0x7f84('0x4')]]);}}}catch(_0x36af79){utils[_0x7f84('0x20')](util[_0x7f84('0x3')](_0x7f84('0x41'),_0x46647a[_0x7f84('0x4')]),_0x36af79);}};exports[_0x7f84('0x42')]=function(_0x5bf5ac){try{if(!_[_0x7f84('0x15')](queues[_0x5bf5ac[_0x7f84('0x43')]])){utils[_0x7f84('0xe')](util[_0x7f84('0x3')]('[%s][queues][blindtransfer]',_0x5bf5ac['uniqueid']),_0x5bf5ac);queues[_0x5bf5ac[_0x7f84('0x43')]][_0x7f84('0x3e')]=!![];queues[_0x5bf5ac[_0x7f84('0x43')]][_0x7f84('0x44')]='BLIND';queues[_0x5bf5ac[_0x7f84('0x43')]]['transferexten']=_0x5bf5ac[_0x7f84('0x45')];queues[_0x5bf5ac[_0x7f84('0x43')]][_0x7f84('0x46')]=_0x5bf5ac[_0x7f84('0x43')];queues[_0x5bf5ac[_0x7f84('0x43')]][_0x7f84('0x8')]='BLINDTRANSFER';utils[_0x7f84('0x2')](util[_0x7f84('0x3')](_0x7f84('0x47'),_0x5bf5ac[_0x7f84('0x4')],queues[_0x5bf5ac['transfereeuniqueid']][_0x7f84('0x1d')],_0x5bf5ac[_0x7f84('0x43')],_0x5bf5ac[_0x7f84('0x45')]));}}catch(_0x3538e4){utils[_0x7f84('0x20')](util[_0x7f84('0x3')]('[%s][queues][blindtransfer]',_0x5bf5ac['uniqueid']),_0x3538e4);}};exports['attendedtransfer']=function(_0x2b7011){try{utils['debug'](util[_0x7f84('0x3')](_0x7f84('0x48'),_0x2b7011[_0x7f84('0x49')]),_0x2b7011);if(_0x2b7011[_0x7f84('0x49')]==_0x2b7011['origtransfererlinkedid']){if(!_['isNil'](queues[_0x2b7011['secondtransfererlinkedid']])){utils[_0x7f84('0x2')](util[_0x7f84('0x3')](_0x7f84('0x4a'),_0x2b7011[_0x7f84('0x49')],queues[_0x2b7011['secondtransfererlinkedid']][_0x7f84('0x1d')],_0x2b7011[_0x7f84('0x4b')]));queues[_0x2b7011[_0x7f84('0x4c')]][_0x7f84('0x3e')]=!![];queues[_0x2b7011['secondtransfererlinkedid']][_0x7f84('0x44')]=_0x7f84('0x4d');queues[_0x2b7011[_0x7f84('0x4c')]][_0x7f84('0x4e')]=_0x2b7011['origtransfererexten'];queues[_0x2b7011[_0x7f84('0x4c')]][_0x7f84('0x46')]=_0x2b7011['origtransfereruniqueid'];queues[_0x2b7011[_0x7f84('0x4c')]][_0x7f84('0x8')]='ATTENDEDTRANSFER';}if(!_[_0x7f84('0x15')](queues[_0x2b7011[_0x7f84('0x4f')]])){if(_0x2b7011[_0x7f84('0x50')]&&queues[_0x2b7011[_0x7f84('0x50')]]){queues[_0x2b7011[_0x7f84('0x50')]][_0x7f84('0x1f')]=0x1;queues[_0x2b7011['transfereeuniqueid']]=_[_0x7f84('0x51')](queues[_0x2b7011['transfereelinkedid']]);queues[_0x2b7011[_0x7f84('0x43')]][_0x7f84('0xc')]=_0x2b7011[_0x7f84('0x52')];queues[_0x2b7011[_0x7f84('0x43')]]['queuecallerenterreason']=0x2;queues[_0x2b7011[_0x7f84('0x43')]][_0x7f84('0x53')]=queues[_0x2b7011[_0x7f84('0x4c')]][_0x7f84('0x53')];queues[_0x2b7011[_0x7f84('0x43')]][_0x7f84('0x54')]=queues[_0x2b7011[_0x7f84('0x4c')]][_0x7f84('0x54')];queues[_0x2b7011[_0x7f84('0x43')]][_0x7f84('0x31')]=utils[_0x7f84('0x13')]();queues[_0x2b7011['transfereeuniqueid']][_0x7f84('0x17')]=utils[_0x7f84('0x13')]();queues[_0x2b7011[_0x7f84('0x43')]]['holdtime']=0x0;queues[_0x2b7011[_0x7f84('0x43')]][_0x7f84('0x55')]=0x0;utils['info'](util[_0x7f84('0x3')](_0x7f84('0x56'),_0x2b7011[_0x7f84('0x49')],queues[_0x2b7011[_0x7f84('0x43')]][_0x7f84('0x1d')],queues[_0x2b7011[_0x7f84('0x43')]][_0x7f84('0x53')],queues[_0x2b7011[_0x7f84('0x43')]][_0x7f84('0x54')]));}else{utils[_0x7f84('0x2')](util[_0x7f84('0x3')](_0x7f84('0x57'),_0x2b7011[_0x7f84('0x49')],queues[_0x2b7011[_0x7f84('0x4f')]][_0x7f84('0x1d')],_0x2b7011['secondtransfererlinkedid']));queues[_0x2b7011['origtransfererlinkedid']][_0x7f84('0xc')]=_0x2b7011[_0x7f84('0x4c')];}}}else if(_0x2b7011['secondtransfereruniqueid']==_0x2b7011[_0x7f84('0x4c')]){if(!_[_0x7f84('0x15')](queues[_0x2b7011[_0x7f84('0x4f')]])){utils['info'](util[_0x7f84('0x3')](_0x7f84('0x58'),_0x2b7011['origtransfereruniqueid'],queues[_0x2b7011[_0x7f84('0x4f')]][_0x7f84('0x1d')],_0x2b7011[_0x7f84('0x59')],_0x2b7011[_0x7f84('0x5a')]));queues[_0x2b7011[_0x7f84('0x4f')]][_0x7f84('0x3e')]=!![];queues[_0x2b7011['origtransfererlinkedid']][_0x7f84('0x44')]=_0x7f84('0x4d');queues[_0x2b7011[_0x7f84('0x4f')]]['transferexten']=_0x2b7011[_0x7f84('0x5a')];queues[_0x2b7011[_0x7f84('0x4f')]]['transferuniqueid']=_0x2b7011['secondtransfereruniqueid'];queues[_0x2b7011[_0x7f84('0x4f')]][_0x7f84('0x8')]=_0x7f84('0x5b');}if(!_[_0x7f84('0x15')](queues[_0x2b7011[_0x7f84('0x4c')]])){if(_0x2b7011[_0x7f84('0x5c')]&&queues[_0x2b7011['transfertargetlinkedid']]){queues[_0x2b7011['transfertargetlinkedid']][_0x7f84('0x1f')]=0x1;queues[_0x2b7011[_0x7f84('0x52')]]=_[_0x7f84('0x51')](queues[_0x2b7011[_0x7f84('0x5c')]]);queues[_0x2b7011[_0x7f84('0x52')]][_0x7f84('0xc')]=_0x2b7011['transfertargetuniqueid'];queues[_0x2b7011[_0x7f84('0x52')]]['queuecallerenterreason']=0x2;queues[_0x2b7011[_0x7f84('0x52')]][_0x7f84('0x53')]=queues[_0x2b7011[_0x7f84('0x4f')]][_0x7f84('0x53')];queues[_0x2b7011[_0x7f84('0x52')]][_0x7f84('0x54')]=queues[_0x2b7011[_0x7f84('0x4f')]][_0x7f84('0x54')];queues[_0x2b7011[_0x7f84('0x52')]][_0x7f84('0x31')]=utils[_0x7f84('0x13')]();queues[_0x2b7011['transfertargetuniqueid']][_0x7f84('0x17')]=utils['now']();queues[_0x2b7011[_0x7f84('0x52')]][_0x7f84('0x2f')]=0x0;queues[_0x2b7011['transfertargetuniqueid']][_0x7f84('0x55')]=0x0;utils[_0x7f84('0x2')](util[_0x7f84('0x3')](_0x7f84('0x5d'),_0x2b7011[_0x7f84('0x49')],queues[_0x2b7011['transfertargetuniqueid']]['name'],queues[_0x2b7011[_0x7f84('0x52')]]['transfereduniqueid'],queues[_0x2b7011['transfertargetuniqueid']][_0x7f84('0x53')],queues[_0x2b7011[_0x7f84('0x52')]][_0x7f84('0x54')]));}else{utils['info'](util[_0x7f84('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x2b7011['origtransfereruniqueid'],queues[_0x2b7011[_0x7f84('0x4c')]]['name'],_0x2b7011[_0x7f84('0x4f')]));queues[_0x2b7011[_0x7f84('0x4c')]][_0x7f84('0xc')]=_0x2b7011['origtransfererlinkedid'];}}}}catch(_0x2f3dfb){utils['error'](util[_0x7f84('0x3')](_0x7f84('0x48'),_0x2b7011[_0x7f84('0x49')]),_0x2f3dfb);}};exports[_0x7f84('0x5e')]=function(_0x235af5){try{if(!_[_0x7f84('0x15')](queues[_0x235af5[_0x7f84('0x4')]])){utils[_0x7f84('0xe')](util[_0x7f84('0x3')]('[%s][queues][musiconholdstart]',_0x235af5['uniqueid']),_0x235af5);queues[_0x235af5['uniqueid']][_0x7f84('0x5f')]=utils[_0x7f84('0x13')]();utils[_0x7f84('0x2')](util[_0x7f84('0x3')](_0x7f84('0x60'),_0x235af5[_0x7f84('0x4')],queues[_0x235af5['uniqueid']][_0x7f84('0x1d')],queues[_0x235af5[_0x7f84('0x4')]]['musiconholdstartAt']));}}catch(_0x1ef17d){utils[_0x7f84('0x20')](util[_0x7f84('0x3')](_0x7f84('0x61'),_0x235af5['uniqueid']),_0x1ef17d);}};exports[_0x7f84('0x62')]=function(_0x47a711){try{if(!_[_0x7f84('0x15')](queues[_0x47a711[_0x7f84('0x4')]])){if(!_[_0x7f84('0x15')](queues[_0x47a711['uniqueid']][_0x7f84('0x5f')])){utils[_0x7f84('0xe')](util['format']('[%s][queues][musiconholdstop]',_0x47a711[_0x7f84('0x4')]),_0x47a711);queues[_0x47a711[_0x7f84('0x4')]][_0x7f84('0x55')]+=utils[_0x7f84('0x30')](utils[_0x7f84('0x13')](),queues[_0x47a711[_0x7f84('0x4')]][_0x7f84('0x5f')]);utils[_0x7f84('0x2')](util[_0x7f84('0x3')](_0x7f84('0x63'),_0x47a711['uniqueid'],queues[_0x47a711['uniqueid']]['name'],queues[_0x47a711[_0x7f84('0x4')]][_0x7f84('0x55')]));delete queues[_0x47a711['uniqueid']]['musiconholdstartAt'];}}}catch(_0x3f911e){utils[_0x7f84('0x20')](util[_0x7f84('0x3')](_0x7f84('0x64'),_0x47a711[_0x7f84('0x4')]),_0x3f911e);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 4efbff3..9e0eca5 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 _0xed12=['type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','util','info','format','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','.wav49','value','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename'];(function(_0x1da92c,_0x49a417){var _0x35aa9b=function(_0x4a89f1){while(--_0x4a89f1){_0x1da92c['push'](_0x1da92c['shift']());}};_0x35aa9b(++_0x49a417);}(_0xed12,0x1ca));var _0x2ed1=function(_0x57abe0,_0x2a191a){_0x57abe0=_0x57abe0-0x0;var _0x15a2e1=_0xed12[_0x57abe0];return _0x15a2e1;};'use strict';var _=require('lodash');var util=require(_0x2ed1('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x5bbe1a){utils[_0x2ed1('0x1')](util[_0x2ed1('0x2')]('[%s][recordings][writeDB]',_0x5bbe1a[_0x2ed1('0x3')]));if(_0x5bbe1a[_0x2ed1('0x4')]){utils[_0x2ed1('0x5')](_0x5bbe1a['accountcode'])[_0x2ed1('0x6')](function(_0x3a4498){if(_0x3a4498){_0x5bbe1a[_0x2ed1('0x7')]=_0x3a4498[_0x2ed1('0x8')];_0x5bbe1a[_0x2ed1('0x9')]=_0x3a4498['id'];}utils[_0x2ed1('0xa')](_0x2ed1('0xb'),_0x5bbe1a);});}else{utils['request']('CreateVoiceRecording',_0x5bbe1a);}}exports[_0x2ed1('0xc')]=function(_0x1e941a){try{utils[_0x2ed1('0xd')](util['format'](_0x2ed1('0xe'),_0x1e941a[_0x2ed1('0x3')]),_0x1e941a);if(_0x1e941a[_0x2ed1('0x3')]==_0x1e941a['linkedid']){utils[_0x2ed1('0x1')](util[_0x2ed1('0x2')](_0x2ed1('0xf'),_0x1e941a[_0x2ed1('0x3')],_0x1e941a[_0x2ed1('0x10')],_0x1e941a[_0x2ed1('0x11')]));recordings[_0x1e941a[_0x2ed1('0x3')]]={'uniqueid':_0x1e941a['uniqueid'],'accountcode':_0x1e941a[_0x2ed1('0x4')],'exten':_0x1e941a[_0x2ed1('0x11')],'context':_0x1e941a[_0x2ed1('0x10')],'channel':_0x1e941a[_0x2ed1('0x12')],'monitors':[]};}}catch(_0x60044){utils[_0x2ed1('0x13')](util[_0x2ed1('0x2')](_0x2ed1('0xe'),_0x1e941a['uniqueid']),_0x60044);}};exports[_0x2ed1('0x14')]=function(_0x28e6d9){try{utils[_0x2ed1('0xd')](util[_0x2ed1('0x2')](_0x2ed1('0x15'),_0x28e6d9[_0x2ed1('0x3')]),_0x28e6d9);if(!_[_0x2ed1('0x16')](recordings[_0x28e6d9['uniqueid']])&&_0x28e6d9['channelstate']==0x6){utils[_0x2ed1('0x1')](util[_0x2ed1('0x2')](_0x2ed1('0x17'),_0x28e6d9[_0x2ed1('0x3')],_0x28e6d9[_0x2ed1('0x10')],_0x28e6d9[_0x2ed1('0x12')]));}else if(!_[_0x2ed1('0x16')](recordings[_0x28e6d9[_0x2ed1('0x18')]])&&_0x28e6d9['channelstate']==0x6&&_0x28e6d9['context']!=_0x2ed1('0x19')){utils['info'](util[_0x2ed1('0x2')](_0x2ed1('0x1a'),_0x28e6d9[_0x2ed1('0x3')],_0x28e6d9['linkedid'],_0x28e6d9['context'],_0x28e6d9[_0x2ed1('0x12')]));recordings[_0x28e6d9[_0x2ed1('0x18')]]['accountcode']=_0x28e6d9[_0x2ed1('0x4')];}}catch(_0x366131){utils[_0x2ed1('0x13')](util['format'](_0x2ed1('0x15'),_0x28e6d9[_0x2ed1('0x3')]),_0x366131);}};exports[_0x2ed1('0x1b')]=function(_0x20a46d){try{if(!_[_0x2ed1('0x16')](_0x20a46d[_0x2ed1('0x1c')])&&!_['isNil'](_0x20a46d[_0x2ed1('0x1c')][_0x2ed1('0x1d')])){utils['debug'](util['format'](_0x2ed1('0x1e'),_0x20a46d['uniqueid']),_0x20a46d);utils[_0x2ed1('0x1')](util[_0x2ed1('0x2')](_0x2ed1('0x1f'),_0x20a46d[_0x2ed1('0x3')],_0x20a46d[_0x2ed1('0x1c')],_0x20a46d['value']));if(_[_0x2ed1('0x20')](_0x20a46d['value'],_0x2ed1('0x21'))){_0x20a46d['value']=_0x20a46d[_0x2ed1('0x22')][_0x2ed1('0x23')](_0x2ed1('0x21'),_0x2ed1('0x24'));}if(recordings[_0x20a46d[_0x2ed1('0x18')]]){var _0x1f86d5=_['find'](recordings[_0x20a46d['linkedid']][_0x2ed1('0x25')],{'value':_0x20a46d[_0x2ed1('0x22')]});if(_[_0x2ed1('0x16')](_0x1f86d5)){recordings[_0x20a46d[_0x2ed1('0x18')]]['monitors'][_0x2ed1('0x26')]({'value':_0x20a46d[_0x2ed1('0x22')]});}}}}catch(_0x513697){utils['error'](util['format'](_0x2ed1('0x1e'),_0x20a46d[_0x2ed1('0x3')]),_0x513697);}};exports[_0x2ed1('0x27')]=function(_0x2b80ba){try{if(!_[_0x2ed1('0x16')](recordings[_0x2b80ba[_0x2ed1('0x3')]])){utils[_0x2ed1('0xd')](util[_0x2ed1('0x2')](_0x2ed1('0x28'),_0x2b80ba['uniqueid']),_0x2b80ba);utils['info'](util[_0x2ed1('0x2')](_0x2ed1('0x29'),_0x2b80ba[_0x2ed1('0x3')],_0x2b80ba['calleridnum'],_0x2b80ba['calleridname'],_0x2b80ba['cause-txt']));recordings[_0x2b80ba['uniqueid']]['calleridnum']=_0x2b80ba[_0x2ed1('0x2a')];recordings[_0x2b80ba['uniqueid']][_0x2ed1('0x2b')]=_0x2b80ba[_0x2ed1('0x2b')];recordings[_0x2b80ba['uniqueid']][_0x2ed1('0x2c')]=_0x2b80ba['connectedlinenum'];recordings[_0x2b80ba[_0x2ed1('0x3')]][_0x2ed1('0x2d')]=_0x2b80ba[_0x2ed1('0x2d')];if(recordings[_0x2b80ba[_0x2ed1('0x3')]][_0x2ed1('0x2e')]==_0x2ed1('0x2f')&&recordings[_0x2b80ba[_0x2ed1('0x3')]]['accountcode']){recordings[_0x2b80ba[_0x2ed1('0x3')]][_0x2ed1('0x2c')]=recordings[_0x2b80ba['uniqueid']]['accountcode'];recordings[_0x2b80ba[_0x2ed1('0x3')]][_0x2ed1('0x2d')]='';}recordings[_0x2b80ba[_0x2ed1('0x3')]][_0x2ed1('0x25')][_0x2ed1('0x30')](function(_0x12d306){var _0x513145=_[_0x2ed1('0x31')](recordings[_0x2b80ba[_0x2ed1('0x3')]]);_0x513145[_0x2ed1('0x22')]=_0x12d306[_0x2ed1('0x22')];writeDB(_0x513145);});delete recordings[_0x2b80ba[_0x2ed1('0x3')]];}}catch(_0x5b5664){utils[_0x2ed1('0x13')](util['format'](_0x2ed1('0x28'),_0x2b80ba[_0x2ed1('0x3')]),_0x5b5664);}};exports[_0x2ed1('0x32')]=function(_0xa3cb5e){try{if(!_['isNil'](recordings[_0xa3cb5e['uniqueid']])){utils['debug'](util[_0x2ed1('0x2')](_0x2ed1('0x33'),_0xa3cb5e['uniqueid']),_0xa3cb5e);utils['info'](util['format'](_0x2ed1('0x34'),_0xa3cb5e[_0x2ed1('0x3')],_0xa3cb5e[_0x2ed1('0x35')],_0xa3cb5e[_0x2ed1('0x36')]));if(_0xa3cb5e[_0x2ed1('0x35')][_0x2ed1('0x37')]()=='set'&&_[_0x2ed1('0x38')](_0xa3cb5e[_0x2ed1('0x36')][_0x2ed1('0x37')](),_0x2ed1('0x39'))){var _0x64c002=_0xa3cb5e['appdata'][_0x2ed1('0x3a')]('=');var _0x421a5f=_0x64c002[0x0]['substring'](_0x64c002[0x0][_0x2ed1('0x3b')]('(')+0x1,_0x64c002[0x0][_0x2ed1('0x3b')](')'));var _0x4a192f=_0x64c002[0x1];recordings[_0xa3cb5e[_0x2ed1('0x3')]][_0x421a5f]=_0x4a192f;}}}catch(_0xd7311e){utils[_0x2ed1('0x13')](util[_0x2ed1('0x2')](_0x2ed1('0x33'),_0xa3cb5e[_0x2ed1('0x3')]),_0xd7311e);}};exports[_0x2ed1('0x3c')]=function(_0x5506b8){try{if(!_[_0x2ed1('0x16')](recordings[_0x5506b8['uniqueid']])){utils[_0x2ed1('0xd')](util[_0x2ed1('0x2')](_0x2ed1('0x3d'),_0x5506b8['uniqueid']),_0x5506b8);utils[_0x2ed1('0x1')](util[_0x2ed1('0x2')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x5506b8[_0x2ed1('0x3')],_0x5506b8[_0x2ed1('0x3e')]));recordings[_0x5506b8['uniqueid']]['queue']=_0x5506b8['queue'];}}catch(_0x389df4){utils[_0x2ed1('0x13')](util['format'](_0x2ed1('0x3d'),_0x5506b8['uniqueid']),_0x389df4);}}; \ No newline at end of file +var _0xd744=['hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','[%s][recordings][queuecallerjoin]','lodash','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','[%s][recordings][newchannel]','linkedid','exten','context','channel','error','newstate','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd744,0x199));var _0x4d74=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd744[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4d74('0x0'));var util=require('util');var utils=require(_0x4d74('0x1'));var recordings={};function writeDB(_0x280850){utils[_0x4d74('0x2')](util[_0x4d74('0x3')](_0x4d74('0x4'),_0x280850[_0x4d74('0x5')]));if(_0x280850[_0x4d74('0x6')]){utils[_0x4d74('0x7')](_0x280850['accountcode'])[_0x4d74('0x8')](function(_0x1ad9ac){if(_0x1ad9ac){_0x280850['membername']=_0x1ad9ac[_0x4d74('0x9')];_0x280850[_0x4d74('0xa')]=_0x1ad9ac['id'];}utils[_0x4d74('0xb')](_0x4d74('0xc'),_0x280850);});}else{utils['request'](_0x4d74('0xc'),_0x280850);}}exports['newchannel']=function(_0x2110f1){try{utils['debug'](util[_0x4d74('0x3')](_0x4d74('0xd'),_0x2110f1[_0x4d74('0x5')]),_0x2110f1);if(_0x2110f1[_0x4d74('0x5')]==_0x2110f1[_0x4d74('0xe')]){utils['info'](util[_0x4d74('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x2110f1[_0x4d74('0x5')],_0x2110f1['context'],_0x2110f1['exten']));recordings[_0x2110f1[_0x4d74('0x5')]]={'uniqueid':_0x2110f1[_0x4d74('0x5')],'accountcode':_0x2110f1['accountcode'],'exten':_0x2110f1[_0x4d74('0xf')],'context':_0x2110f1[_0x4d74('0x10')],'channel':_0x2110f1[_0x4d74('0x11')],'monitors':[]};}}catch(_0x3a5033){utils[_0x4d74('0x12')](util[_0x4d74('0x3')](_0x4d74('0xd'),_0x2110f1[_0x4d74('0x5')]),_0x3a5033);}};exports[_0x4d74('0x13')]=function(_0x5627bf){try{utils[_0x4d74('0x14')](util['format'](_0x4d74('0x15'),_0x5627bf[_0x4d74('0x5')]),_0x5627bf);if(!_[_0x4d74('0x16')](recordings[_0x5627bf['uniqueid']])&&_0x5627bf[_0x4d74('0x17')]==0x6){utils['info'](util[_0x4d74('0x3')](_0x4d74('0x18'),_0x5627bf[_0x4d74('0x5')],_0x5627bf[_0x4d74('0x10')],_0x5627bf['channel']));}else if(!_['isNil'](recordings[_0x5627bf[_0x4d74('0xe')]])&&_0x5627bf[_0x4d74('0x17')]==0x6&&_0x5627bf[_0x4d74('0x10')]!=_0x4d74('0x19')){utils[_0x4d74('0x2')](util[_0x4d74('0x3')](_0x4d74('0x1a'),_0x5627bf[_0x4d74('0x5')],_0x5627bf[_0x4d74('0xe')],_0x5627bf['context'],_0x5627bf[_0x4d74('0x11')]));recordings[_0x5627bf[_0x4d74('0xe')]][_0x4d74('0x6')]=_0x5627bf['accountcode'];}}catch(_0x52f04b){utils['error'](util[_0x4d74('0x3')](_0x4d74('0x15'),_0x5627bf[_0x4d74('0x5')]),_0x52f04b);}};exports[_0x4d74('0x1b')]=function(_0x2b8a3b){try{if(!_[_0x4d74('0x16')](_0x2b8a3b[_0x4d74('0x1c')])&&!_['isNil'](_0x2b8a3b[_0x4d74('0x1c')]['mixmonitor_filename'])){utils[_0x4d74('0x14')](util[_0x4d74('0x3')](_0x4d74('0x1d'),_0x2b8a3b[_0x4d74('0x5')]),_0x2b8a3b);utils[_0x4d74('0x2')](util[_0x4d74('0x3')](_0x4d74('0x1e'),_0x2b8a3b['uniqueid'],_0x2b8a3b[_0x4d74('0x1c')],_0x2b8a3b[_0x4d74('0x1f')]));if(_[_0x4d74('0x20')](_0x2b8a3b[_0x4d74('0x1f')],_0x4d74('0x21'))){_0x2b8a3b[_0x4d74('0x1f')]=_0x2b8a3b['value'][_0x4d74('0x22')](_0x4d74('0x21'),_0x4d74('0x23'));}if(recordings[_0x2b8a3b[_0x4d74('0xe')]]){var _0x5d009b=_[_0x4d74('0x24')](recordings[_0x2b8a3b[_0x4d74('0xe')]][_0x4d74('0x25')],{'value':_0x2b8a3b['value']});if(_[_0x4d74('0x16')](_0x5d009b)){recordings[_0x2b8a3b['linkedid']][_0x4d74('0x25')][_0x4d74('0x26')]({'value':_0x2b8a3b[_0x4d74('0x1f')]});}}}}catch(_0xfb160f){utils[_0x4d74('0x12')](util[_0x4d74('0x3')]('[%s][recordings][varset]',_0x2b8a3b['uniqueid']),_0xfb160f);}};exports[_0x4d74('0x27')]=function(_0x592904){try{if(!_[_0x4d74('0x16')](recordings[_0x592904[_0x4d74('0x5')]])){utils[_0x4d74('0x14')](util[_0x4d74('0x3')](_0x4d74('0x28'),_0x592904['uniqueid']),_0x592904);utils[_0x4d74('0x2')](util[_0x4d74('0x3')](_0x4d74('0x29'),_0x592904[_0x4d74('0x5')],_0x592904[_0x4d74('0x2a')],_0x592904[_0x4d74('0x2b')],_0x592904[_0x4d74('0x2c')]));recordings[_0x592904[_0x4d74('0x5')]]['calleridnum']=_0x592904[_0x4d74('0x2a')];recordings[_0x592904[_0x4d74('0x5')]]['calleridname']=_0x592904[_0x4d74('0x2b')];recordings[_0x592904[_0x4d74('0x5')]][_0x4d74('0x2d')]=_0x592904[_0x4d74('0x2d')];recordings[_0x592904[_0x4d74('0x5')]][_0x4d74('0x2e')]=_0x592904[_0x4d74('0x2e')];if(recordings[_0x592904[_0x4d74('0x5')]][_0x4d74('0x2f')]==_0x4d74('0x30')&&recordings[_0x592904[_0x4d74('0x5')]]['accountcode']){recordings[_0x592904[_0x4d74('0x5')]]['connectedlinenum']=recordings[_0x592904[_0x4d74('0x5')]]['accountcode'];recordings[_0x592904['uniqueid']][_0x4d74('0x2e')]='';}recordings[_0x592904[_0x4d74('0x5')]]['monitors']['forEach'](function(_0x5bbd88){var _0xaa8a48=_[_0x4d74('0x31')](recordings[_0x592904[_0x4d74('0x5')]]);_0xaa8a48['value']=_0x5bbd88[_0x4d74('0x1f')];writeDB(_0xaa8a48);});delete recordings[_0x592904[_0x4d74('0x5')]];}}catch(_0x5ecdf9){utils['error'](util[_0x4d74('0x3')](_0x4d74('0x28'),_0x592904[_0x4d74('0x5')]),_0x5ecdf9);}};exports[_0x4d74('0x32')]=function(_0x1b1019){try{if(!_[_0x4d74('0x16')](recordings[_0x1b1019[_0x4d74('0x5')]])){utils[_0x4d74('0x14')](util[_0x4d74('0x3')](_0x4d74('0x33'),_0x1b1019[_0x4d74('0x5')]),_0x1b1019);utils[_0x4d74('0x2')](util[_0x4d74('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x1b1019[_0x4d74('0x5')],_0x1b1019[_0x4d74('0x34')],_0x1b1019[_0x4d74('0x35')]));if(_0x1b1019[_0x4d74('0x34')][_0x4d74('0x36')]()==_0x4d74('0x37')&&_[_0x4d74('0x38')](_0x1b1019[_0x4d74('0x35')][_0x4d74('0x36')](),_0x4d74('0x39'))){var _0x2d5a50=_0x1b1019[_0x4d74('0x35')][_0x4d74('0x3a')]('=');var _0x3790ff=_0x2d5a50[0x0][_0x4d74('0x3b')](_0x2d5a50[0x0][_0x4d74('0x3c')]('(')+0x1,_0x2d5a50[0x0][_0x4d74('0x3c')](')'));var _0x2d5f67=_0x2d5a50[0x1];recordings[_0x1b1019['uniqueid']][_0x3790ff]=_0x2d5f67;}}}catch(_0x38c3a4){utils[_0x4d74('0x12')](util[_0x4d74('0x3')](_0x4d74('0x33'),_0x1b1019[_0x4d74('0x5')]),_0x38c3a4);}};exports[_0x4d74('0x3d')]=function(_0x54d83c){try{if(!_[_0x4d74('0x16')](recordings[_0x54d83c['uniqueid']])){utils[_0x4d74('0x14')](util[_0x4d74('0x3')]('[%s][recordings][queuecallerjoin]',_0x54d83c[_0x4d74('0x5')]),_0x54d83c);utils[_0x4d74('0x2')](util[_0x4d74('0x3')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x54d83c[_0x4d74('0x5')],_0x54d83c['queue']));recordings[_0x54d83c['uniqueid']][_0x4d74('0x3e')]=_0x54d83c[_0x4d74('0x3e')];}}catch(_0x4817b0){utils[_0x4d74('0x12')](util[_0x4d74('0x3')](_0x4d74('0x3f'),_0x54d83c[_0x4d74('0x5')]),_0x4817b0);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 769623d..ea8a785 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 _0x4d10=['secondtransfererconnectedlinename','secondtransfererexten','origtransferercontext','isNil','transfereechannel','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','lodash','util','./utils','format','type','attended','origtransfereruniqueid','uniqueid','request','blinds','[%s][transfers][blindtransfer]','info','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum'];(function(_0x468dff,_0x3bafff){var _0x558673=function(_0x53e0ed){while(--_0x53e0ed){_0x468dff['push'](_0x468dff['shift']());}};_0x558673(++_0x3bafff);}(_0x4d10,0x9e));var _0x04d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d10[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x04d1('0x0'));var util=require(_0x04d1('0x1'));var utils=require(_0x04d1('0x2'));function writeDB(_0x3367dd){utils['info'](util[_0x04d1('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x3367dd[_0x04d1('0x4')]===_0x04d1('0x5')?_0x3367dd[_0x04d1('0x6')]:_0x3367dd[_0x04d1('0x7')],_0x3367dd['type']));utils[_0x04d1('0x8')]('CreateVoiceTransferReport',_0x3367dd);}exports[_0x04d1('0x9')]={};exports['blindtransfer']=function(_0x52e7dc){try{utils['debug'](util[_0x04d1('0x3')](_0x04d1('0xa'),_0x52e7dc[_0x04d1('0x7')]),_0x52e7dc);utils[_0x04d1('0xb')](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x52e7dc['uniqueid'],_0x52e7dc[_0x04d1('0xc')],_0x52e7dc[_0x04d1('0xd')],_0x52e7dc[_0x04d1('0xe')],_0x52e7dc[_0x04d1('0xf')]));_0x52e7dc['type']=_0x04d1('0x10');exports['blinds'][_0x52e7dc['transfereruniqueid']]=_0x52e7dc;writeDB(_0x52e7dc);}catch(_0x2de7e7){utils[_0x04d1('0x11')](util['format'](_0x04d1('0xa'),_0x52e7dc[_0x04d1('0x7')]),_0x2de7e7);}};exports[_0x04d1('0x12')]=function(_0x21f5e3){try{utils['debug'](util[_0x04d1('0x3')](_0x04d1('0x13'),_0x21f5e3[_0x04d1('0x6')]),_0x21f5e3);utils['info'](util[_0x04d1('0x3')](_0x04d1('0x14'),_0x21f5e3[_0x04d1('0x6')],_0x21f5e3['origtransferercalleridnum'],_0x21f5e3[_0x04d1('0x15')],_0x21f5e3[_0x04d1('0x16')],_0x21f5e3[_0x04d1('0x17')]));_0x21f5e3=_['assign'](_0x21f5e3,{'transfererchannel':_0x21f5e3[_0x04d1('0x18')],'transferercalleridnum':_0x21f5e3[_0x04d1('0x19')],'transferercalleridname':_0x21f5e3[_0x04d1('0x15')],'transfererconnectedlinenum':_0x21f5e3[_0x04d1('0x1a')],'transfererconnectedlinename':_0x21f5e3[_0x04d1('0x1b')],'transfereraccountcode':_0x21f5e3['origtransfereraccountcode'],'transferercontext':_0x21f5e3['secondtransferercontext'],'transfererexten':_0x21f5e3[_0x04d1('0x1c')],'transfererlinkedid':_0x21f5e3['origtransfererlinkedid'],'context':_0x21f5e3[_0x04d1('0x1d')],'extension':_0x21f5e3['origtransfererexten'],'type':_0x04d1('0x5')});if(_[_0x04d1('0x1e')](_0x21f5e3[_0x04d1('0x1f')])){_0x21f5e3=_[_0x04d1('0x20')](_0x21f5e3,{'transfereechannel':_0x21f5e3[_0x04d1('0x21')],'transfereecalleridnum':_0x21f5e3[_0x04d1('0x16')],'transfereecalleridname':_0x21f5e3['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x21f5e3[_0x04d1('0x22')],'transfereeconnectedlinename':_0x21f5e3['transfertargetconnectedlinename'],'transfereeaccountcode':_0x21f5e3[_0x04d1('0x23')],'transfereecontext':_0x21f5e3['transfertargetcontext'],'transfereeexten':_0x21f5e3[_0x04d1('0x24')],'transfereelinkedid':_0x21f5e3['transfertargetlinkedid']});}writeDB(_0x21f5e3);}catch(_0x3f8ac8){utils['error'](util[_0x04d1('0x3')](_0x04d1('0x13'),_0x21f5e3[_0x04d1('0x6')]),_0x3f8ac8);}}; \ No newline at end of file +var _0xc9e9=['secondtransfererconnectedlinenum','secondtransferercontext','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','lodash','util','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','blind','error','debug','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','origtransfererchannel'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xc9e9,0x1c4));var _0x9c9e=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0xc9e9[_0x28edda];return _0x21f4a4;};'use strict';var _=require(_0x9c9e('0x0'));var util=require(_0x9c9e('0x1'));var utils=require('./utils');function writeDB(_0x255a7f){utils['info'](util[_0x9c9e('0x2')](_0x9c9e('0x3'),_0x255a7f[_0x9c9e('0x4')]===_0x9c9e('0x5')?_0x255a7f['origtransfereruniqueid']:_0x255a7f[_0x9c9e('0x6')],_0x255a7f['type']));utils[_0x9c9e('0x7')](_0x9c9e('0x8'),_0x255a7f);}exports[_0x9c9e('0x9')]={};exports[_0x9c9e('0xa')]=function(_0x5e89ae){try{utils['debug'](util[_0x9c9e('0x2')]('[%s][transfers][blindtransfer]',_0x5e89ae[_0x9c9e('0x6')]),_0x5e89ae);utils['info'](util['format'](_0x9c9e('0xb'),_0x5e89ae['uniqueid'],_0x5e89ae['transferercalleridnum'],_0x5e89ae[_0x9c9e('0xc')],_0x5e89ae['transfereecalleridnum'],_0x5e89ae[_0x9c9e('0xd')]));_0x5e89ae[_0x9c9e('0x4')]=_0x9c9e('0xe');exports[_0x9c9e('0x9')][_0x5e89ae['transfereruniqueid']]=_0x5e89ae;writeDB(_0x5e89ae);}catch(_0x1afedc){utils[_0x9c9e('0xf')](util[_0x9c9e('0x2')]('[%s][transfers][blindtransfer]',_0x5e89ae[_0x9c9e('0x6')]),_0x1afedc);}};exports['attendedtransfer']=function(_0x545017){try{utils[_0x9c9e('0x10')](util[_0x9c9e('0x2')](_0x9c9e('0x11'),_0x545017[_0x9c9e('0x12')]),_0x545017);utils['info'](util[_0x9c9e('0x2')](_0x9c9e('0x13'),_0x545017['origtransfereruniqueid'],_0x545017[_0x9c9e('0x14')],_0x545017[_0x9c9e('0x15')],_0x545017[_0x9c9e('0x16')],_0x545017['transfertargetcalleridname']));_0x545017=_['assign'](_0x545017,{'transfererchannel':_0x545017[_0x9c9e('0x17')],'transferercalleridnum':_0x545017['origtransferercalleridnum'],'transferercalleridname':_0x545017['origtransferercalleridname'],'transfererconnectedlinenum':_0x545017[_0x9c9e('0x18')],'transfererconnectedlinename':_0x545017['secondtransfererconnectedlinename'],'transfereraccountcode':_0x545017['origtransfereraccountcode'],'transferercontext':_0x545017[_0x9c9e('0x19')],'transfererexten':_0x545017['secondtransfererexten'],'transfererlinkedid':_0x545017['origtransfererlinkedid'],'context':_0x545017[_0x9c9e('0x1a')],'extension':_0x545017[_0x9c9e('0x1b')],'type':'attended'});if(_[_0x9c9e('0x1c')](_0x545017[_0x9c9e('0x1d')])){_0x545017=_['assign'](_0x545017,{'transfereechannel':_0x545017[_0x9c9e('0x1e')],'transfereecalleridnum':_0x545017[_0x9c9e('0x16')],'transfereecalleridname':_0x545017['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x545017['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x545017[_0x9c9e('0x1f')],'transfereeaccountcode':_0x545017['transfertargetaccountcode'],'transfereecontext':_0x545017['transfertargetcontext'],'transfereeexten':_0x545017[_0x9c9e('0x20')],'transfereelinkedid':_0x545017[_0x9c9e('0x21')]});}writeDB(_0x545017);}catch(_0x175c69){utils[_0x9c9e('0xf')](util[_0x9c9e('0x2')](_0x9c9e('0x11'),_0x545017[_0x9c9e('0x12')]),_0x175c69);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index b21cb16..55f0d5c 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 _0xf9fb=['acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','format','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','../../config/logger','xdr','info','debug','error','inspect','request','then','[utils][request]\x20name:%s','catch','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue'];(function(_0xf8eff,_0x218b54){var _0x4be5f4=function(_0x293cd3){while(--_0x293cd3){_0xf8eff['push'](_0xf8eff['shift']());}};_0x4be5f4(++_0x218b54);}(_0xf9fb,0x177));var _0xbf9f=function(_0x40fbed,_0x797b4b){_0x40fbed=_0x40fbed-0x0;var _0x7e3e4e=_0xf9fb[_0x40fbed];return _0x7e3e4e;};'use strict';var BPromise=require(_0xbf9f('0x0'));var jayson=require(_0xbf9f('0x1'));var moment=require(_0xbf9f('0x2'));var util=require(_0xbf9f('0x3'));var client=jayson[_0xbf9f('0x4')]['http']({'port':0x2329});var logger=require(_0xbf9f('0x5'))(_0xbf9f('0x6'));exports[_0xbf9f('0x7')]=function(_0x293cfa,_0x621ab){logger[_0xbf9f('0x7')](_0x293cfa,_0x621ab?util['inspect'](_0x621ab,{'showHidden':![],'depth':null}):'');};exports[_0xbf9f('0x8')]=function(_0x5a2877,_0x54fedc){logger['debug'](_0x5a2877,_0x54fedc?util['inspect'](_0x54fedc,{'showHidden':![],'depth':null}):'');};exports[_0xbf9f('0x9')]=function(_0xd85f44,_0x5f2b4a){logger[_0xbf9f('0x9')](_0xd85f44,_0x5f2b4a?util[_0xbf9f('0xa')](_0x5f2b4a,{'showHidden':![],'depth':null}):'');};exports[_0xbf9f('0xb')]=function(_0x59b4fd,_0x470fac){return client[_0xbf9f('0xb')](_0x59b4fd,{'body':_0x470fac})[_0xbf9f('0xc')](function(_0x5ea8cd){logger[_0xbf9f('0x8')](_0xbf9f('0xd'),_0x59b4fd,_0x5ea8cd?util['inspect'](_0x5ea8cd,{'showHidden':![],'depth':null}):'');})[_0xbf9f('0xe')](function(_0x52efb8){logger[_0xbf9f('0x9')](_0xbf9f('0xd'),_0x59b4fd,_0x52efb8?util[_0xbf9f('0xa')](_0x52efb8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x42e650){return client[_0xbf9f('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xbf9f('0xf'),_0xbf9f('0x10'),_0xbf9f('0x11')],'where':_0x42e650,'limit':0x1}})[_0xbf9f('0xc')](function(_0x24f9bc){logger[_0xbf9f('0x8')](_0xbf9f('0x12'),JSON[_0xbf9f('0x13')](_0x42e650),_0x24f9bc?util[_0xbf9f('0xa')](_0x24f9bc,{'showHidden':![],'depth':null}):'');return _0x24f9bc[_0xbf9f('0x14')]['length']?_0x24f9bc['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x39b256){return new BPromise(function(_0x49f5d3,_0x2c06a5){if(_0x39b256){return getUser({'internal':_0x39b256})['then'](function(_0x1f2920){logger[_0xbf9f('0x7')](_0xbf9f('0x15'),_0x39b256,_0x1f2920?_0xbf9f('0x16'):_0xbf9f('0x17'));return _0x49f5d3(_0x1f2920);})[_0xbf9f('0xe')](function(_0x40852a){logger[_0xbf9f('0x9')]('[utils][getUserByInternal]',_0x40852a?util[_0xbf9f('0xa')](_0x40852a,{'showHidden':![],'depth':null}):'');return _0x49f5d3(null);});}return _0x49f5d3(null);});};exports['getUserByInterface']=function(_0x274ea6){return new BPromise(function(_0x72ccdb,_0x3dc016){if(_0x274ea6){return getUser({'interface':_0x274ea6})['then'](function(_0x3d001f){logger['info'](_0xbf9f('0x18'),_0x274ea6,_0x3d001f?'found':'notfound');return _0x72ccdb(_0x3d001f);})['catch'](function(_0x1caf6a){logger[_0xbf9f('0x9')](_0xbf9f('0x19'),_0x1caf6a?util[_0xbf9f('0xa')](_0x1caf6a,{'showHidden':![],'depth':null}):'');return _0x72ccdb(null);});}return _0x72ccdb(null);});};exports['getUserByName']=function(_0x2f6fb0){return new BPromise(function(_0x19451c,_0x336786){if(_0x2f6fb0){return getUser({'name':_0x2f6fb0})[_0xbf9f('0xc')](function(_0x489584){logger[_0xbf9f('0x7')](_0xbf9f('0x1a'),_0x2f6fb0,_0x489584?_0xbf9f('0x16'):_0xbf9f('0x17'));return _0x19451c(_0x489584);})[_0xbf9f('0xe')](function(_0x4f4a84){logger[_0xbf9f('0x9')](_0xbf9f('0x1b'),_0x4f4a84?util[_0xbf9f('0xa')](_0x4f4a84,{'showHidden':![],'depth':null}):'');return _0x19451c(null);});}return _0x19451c(null);});};exports[_0xbf9f('0x1c')]=function(_0x3e152e){return new BPromise(function(_0x5bdd12,_0x1b2839){if(_0x3e152e){return client[_0xbf9f('0xb')](_0xbf9f('0x1d'),{'options':{'raw':!![],'attributes':['id',_0xbf9f('0x10'),'type',_0xbf9f('0x1e'),'acwTimeout'],'where':{'name':_0x3e152e},'limit':0x1}})[_0xbf9f('0xc')](function(_0xdd8bbf){logger[_0xbf9f('0x8')](_0xbf9f('0x1f'),_0x3e152e,_0xdd8bbf?util['inspect'](_0xdd8bbf,{'showHidden':![],'depth':null}):'');logger['info'](_0xbf9f('0x20'),_0x3e152e,_0xdd8bbf?_0xbf9f('0x16'):_0xbf9f('0x17'));return _0x5bdd12(_0xdd8bbf['result'][_0xbf9f('0x21')]?_0xdd8bbf[_0xbf9f('0x14')][0x0]:null);})[_0xbf9f('0xe')](function(_0x240a30){logger[_0xbf9f('0x9')](_0xbf9f('0x22'),_0x240a30?util[_0xbf9f('0xa')](_0x240a30,{'showHidden':![],'depth':null}):'');return _0x5bdd12(null);});}return _0x5bdd12(null);});};exports['addTime']=function(_0x30ca72,_0x2c49f7){return moment(_0x30ca72)['add'](_0x2c49f7,_0xbf9f('0x23'))['format'](_0xbf9f('0x24'));};exports[_0xbf9f('0x25')]=function(_0x518478,_0x1ffe38){return moment(_0x518478)[_0xbf9f('0x26')](_0x1ffe38,_0xbf9f('0x23'))['format'](_0xbf9f('0x24'));};exports['diffTime']=function(_0xca5ebd,_0x5a6cbe){return moment(_0xca5ebd)[_0xbf9f('0x27')](moment(_0x5a6cbe),'seconds');};exports[_0xbf9f('0x28')]=function(_0x22761c,_0x53e257){return parseInt(_0x22761c,0xa)+parseInt(_0x53e257,0xa);};exports[_0xbf9f('0x29')]=function(){return moment()[_0xbf9f('0x2a')](_0xbf9f('0x24'));};exports[_0xbf9f('0x2b')]=function(_0x30ddc5,_0x3dd940){if(_0x3dd940){return moment(_0x30ddc5)[_0xbf9f('0x2b')](_0x3dd940);}return!![];};exports[_0xbf9f('0x2c')]=function(_0xf7da64,_0x4ffacf){if(_0x4ffacf){return moment(_0xf7da64)[_0xbf9f('0x2c')](_0x4ffacf);}else if(_0xf7da64){return!![];}return![];}; \ No newline at end of file +var _0x7a62=['inspect','error','request','[utils][request]\x20name:%s','GetUser','internal','name','then','stringify','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','getUserByInterface','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','result','addTime','format','YYYY-MM-DD\x20HH:mm:ss','subtract','seconds','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','../../config/logger','xdr','info','debug'];(function(_0x5a7229,_0x6229c0){var _0x9b85a0=function(_0x3b75e6){while(--_0x3b75e6){_0x5a7229['push'](_0x5a7229['shift']());}};_0x9b85a0(++_0x6229c0);}(_0x7a62,0x111));var _0x27a6=function(_0x42847a,_0x42880a){_0x42847a=_0x42847a-0x0;var _0x1a0658=_0x7a62[_0x42847a];return _0x1a0658;};'use strict';var BPromise=require(_0x27a6('0x0'));var jayson=require(_0x27a6('0x1'));var moment=require(_0x27a6('0x2'));var util=require('util');var client=jayson[_0x27a6('0x3')][_0x27a6('0x4')]({'port':0x2329});var logger=require(_0x27a6('0x5'))(_0x27a6('0x6'));exports[_0x27a6('0x7')]=function(_0xb9a27a,_0x5bda78){logger[_0x27a6('0x7')](_0xb9a27a,_0x5bda78?util['inspect'](_0x5bda78,{'showHidden':![],'depth':null}):'');};exports[_0x27a6('0x8')]=function(_0x40930f,_0x39f1de){logger['debug'](_0x40930f,_0x39f1de?util[_0x27a6('0x9')](_0x39f1de,{'showHidden':![],'depth':null}):'');};exports[_0x27a6('0xa')]=function(_0x1b1919,_0x2d99d1){logger[_0x27a6('0xa')](_0x1b1919,_0x2d99d1?util[_0x27a6('0x9')](_0x2d99d1,{'showHidden':![],'depth':null}):'');};exports[_0x27a6('0xb')]=function(_0xf38cef,_0x11db25){return client[_0x27a6('0xb')](_0xf38cef,{'body':_0x11db25})['then'](function(_0x38dbba){logger[_0x27a6('0x8')]('[utils][request]\x20name:%s',_0xf38cef,_0x38dbba?util[_0x27a6('0x9')](_0x38dbba,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x4e931d){logger[_0x27a6('0xa')](_0x27a6('0xc'),_0xf38cef,_0x4e931d?util['inspect'](_0x4e931d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x32731a){return client[_0x27a6('0xb')](_0x27a6('0xd'),{'options':{'raw':!![],'attributes':['id',_0x27a6('0xe'),_0x27a6('0xf'),'interface'],'where':_0x32731a,'limit':0x1}})[_0x27a6('0x10')](function(_0x3f3dc1){logger['debug']('[utils][getUser]\x20where:%s',JSON[_0x27a6('0x11')](_0x32731a),_0x3f3dc1?util[_0x27a6('0x9')](_0x3f3dc1,{'showHidden':![],'depth':null}):'');return _0x3f3dc1['result'][_0x27a6('0x12')]?_0x3f3dc1['result'][0x0]:null;});}exports[_0x27a6('0x13')]=function(_0xc5dca4){return new BPromise(function(_0x1c2dd0,_0x589702){if(_0xc5dca4){return getUser({'internal':_0xc5dca4})[_0x27a6('0x10')](function(_0x585a17){logger[_0x27a6('0x7')](_0x27a6('0x14'),_0xc5dca4,_0x585a17?'found':_0x27a6('0x15'));return _0x1c2dd0(_0x585a17);})[_0x27a6('0x16')](function(_0x2b2281){logger[_0x27a6('0xa')](_0x27a6('0x17'),_0x2b2281?util[_0x27a6('0x9')](_0x2b2281,{'showHidden':![],'depth':null}):'');return _0x1c2dd0(null);});}return _0x1c2dd0(null);});};exports[_0x27a6('0x18')]=function(_0x47aa70){return new BPromise(function(_0x360e04,_0x486a44){if(_0x47aa70){return getUser({'interface':_0x47aa70})[_0x27a6('0x10')](function(_0x2646d0){logger[_0x27a6('0x7')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x47aa70,_0x2646d0?_0x27a6('0x19'):'notfound');return _0x360e04(_0x2646d0);})[_0x27a6('0x16')](function(_0x186654){logger[_0x27a6('0xa')](_0x27a6('0x1a'),_0x186654?util['inspect'](_0x186654,{'showHidden':![],'depth':null}):'');return _0x360e04(null);});}return _0x360e04(null);});};exports[_0x27a6('0x1b')]=function(_0xf74df3){return new BPromise(function(_0x2757f1,_0x4e32a2){if(_0xf74df3){return getUser({'name':_0xf74df3})[_0x27a6('0x10')](function(_0x5a7005){logger['info'](_0x27a6('0x1c'),_0xf74df3,_0x5a7005?_0x27a6('0x19'):_0x27a6('0x15'));return _0x2757f1(_0x5a7005);})[_0x27a6('0x16')](function(_0x38fa2c){logger[_0x27a6('0xa')](_0x27a6('0x1d'),_0x38fa2c?util[_0x27a6('0x9')](_0x38fa2c,{'showHidden':![],'depth':null}):'');return _0x2757f1(null);});}return _0x2757f1(null);});};exports[_0x27a6('0x1e')]=function(_0x4735b5){return new BPromise(function(_0x444796,_0x5b31cb){if(_0x4735b5){return client[_0x27a6('0xb')](_0x27a6('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x27a6('0xf'),_0x27a6('0x20'),'acw',_0x27a6('0x21')],'where':{'name':_0x4735b5},'limit':0x1}})[_0x27a6('0x10')](function(_0x4861ec){logger[_0x27a6('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x4735b5,_0x4861ec?util[_0x27a6('0x9')](_0x4861ec,{'showHidden':![],'depth':null}):'');logger['info'](_0x27a6('0x22'),_0x4735b5,_0x4861ec?'found':_0x27a6('0x15'));return _0x444796(_0x4861ec[_0x27a6('0x23')]['length']?_0x4861ec[_0x27a6('0x23')][0x0]:null);})[_0x27a6('0x16')](function(_0x1af890){logger[_0x27a6('0xa')]('[utils][getVoiceQueueByName]',_0x1af890?util['inspect'](_0x1af890,{'showHidden':![],'depth':null}):'');return _0x444796(null);});}return _0x444796(null);});};exports[_0x27a6('0x24')]=function(_0x5cc1b6,_0x22336d){return moment(_0x5cc1b6)['add'](_0x22336d,'seconds')[_0x27a6('0x25')](_0x27a6('0x26'));};exports['subtractTime']=function(_0x307549,_0x53cecf){return moment(_0x307549)[_0x27a6('0x27')](_0x53cecf,_0x27a6('0x28'))[_0x27a6('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x27a6('0x29')]=function(_0x5e88ce,_0x448ef6){return moment(_0x5e88ce)[_0x27a6('0x2a')](moment(_0x448ef6),_0x27a6('0x28'));};exports[_0x27a6('0x2b')]=function(_0xde4d3c,_0x5cfa74){return parseInt(_0xde4d3c,0xa)+parseInt(_0x5cfa74,0xa);};exports[_0x27a6('0x2c')]=function(){return moment()[_0x27a6('0x25')](_0x27a6('0x26'));};exports[_0x27a6('0x2d')]=function(_0xa9054a,_0x350140){if(_0x350140){return moment(_0xa9054a)['isAfter'](_0x350140);}return!![];};exports['isBefore']=function(_0x57ca7d,_0x3efe39){if(_0x3efe39){return moment(_0x57ca7d)[_0x27a6('0x2e')](_0x3efe39);}else if(_0x57ca7d){return!![];}return![];}; \ No newline at end of file -- 1.7.1